From: Andrea Amorese Date: Mon, 13 Sep 2021 07:38:07 +0000 (+0200) Subject: Built motion from commit d5e88c73.|2.5.35 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=70596e6bc04b6355428faefcc711c8d030f57efd;p=motion2.git Built motion from commit d5e88c73.|2.5.35 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 686ae87..631c25e 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-13T07:14:03.351Z", + "time": "2021-09-13T07:27:38.574Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 2d6cf9b..d76f6d2 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-13T07:14:03.351Z", + "time": "2021-09-13T07:27:38.574Z", "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 417119f..6f166a3 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 _0xb808=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x305d8c,_0x153576){var _0x1e6143=function(_0x30913b){while(--_0x30913b){_0x305d8c['push'](_0x305d8c['shift']());}};_0x1e6143(++_0x153576);}(_0xb808,0x12d));var _0x8b80=function(_0x4f1c01,_0x1d8a36){_0x4f1c01=_0x4f1c01-0x0;var _0x5d6913=_0xb808[_0x4f1c01];return _0x5d6913;};'use strict';var Sequelize=require(_0x8b80('0x0'));module[_0x8b80('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5296cc){return this[_0x8b80('0x2')](_0x8b80('0x3'));}},'action':{'type':Sequelize[_0x8b80('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8b80('0x5'),_0x8b80('0x6'),_0x8b80('0x7'),_0x8b80('0x8'),_0x8b80('0x9'),_0x8b80('0xa'),_0x8b80('0xb'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x8b80('0xc')},'data1':{'type':Sequelize[_0x8b80('0x4')](0x1000),'comment':_0x8b80('0xd')},'data2':{'type':Sequelize[_0x8b80('0x4')](0x1000),'comment':_0x8b80('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x8b80('0xf')},'data4':{'type':Sequelize[_0x8b80('0x4')](0x1000),'comments':_0x8b80('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x8b80('0x11')},'data6':{'type':Sequelize['STRING'],'comments':_0x8b80('0x12')},'data7':{'type':Sequelize[_0x8b80('0x13')],'comments':_0x8b80('0x14')}}; \ No newline at end of file +var _0xec47=['sequelize','getDataValue','action','STRING','contactManager','integration','motionbar','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[body]'];(function(_0x11795d,_0x228ac0){var _0x5d1f7a=function(_0x3d4cbd){while(--_0x3d4cbd){_0x11795d['push'](_0x11795d['shift']());}};_0x5d1f7a(++_0x228ac0);}(_0xec47,0x170));var _0x7ec4=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xec47[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x7ec4('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1c7fd1){return this[_0x7ec4('0x1')](_0x7ec4('0x2'));}},'action':{'type':Sequelize[_0x7ec4('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7ec4('0x4'),_0x7ec4('0x5'),_0x7ec4('0x6'),'jscripty','urlForward','browser',_0x7ec4('0x7'),_0x7ec4('0x8')]],'msg':_0x7ec4('0x9')}},'comment':_0x7ec4('0x9')},'data1':{'type':Sequelize[_0x7ec4('0x3')](0x1000),'comment':_0x7ec4('0xa')},'data2':{'type':Sequelize[_0x7ec4('0x3')](0x1000),'comment':_0x7ec4('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x7ec4('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x7ec4('0xd')},'data5':{'type':Sequelize[_0x7ec4('0x3')](0x1000),'comments':_0x7ec4('0xe')},'data6':{'type':Sequelize[_0x7ec4('0x3')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x7ec4('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 81d3237..010cef5 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 _0xe0d9=['send','body','Action','find','params','catch','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xe0d9,0x192));var _0x9e0d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xe0d9[_0x173441];return _0x2423a8;};'use strict';var emlformat=require(_0x9e0d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9e0d('0x1'));var rp=require(_0x9e0d('0x2'));var moment=require('moment');var BPromise=require(_0x9e0d('0x3'));var Mustache=require('mustache');var util=require(_0x9e0d('0x4'));var path=require(_0x9e0d('0x5'));var sox=require(_0x9e0d('0x6'));var csv=require(_0x9e0d('0x7'));var ejs=require(_0x9e0d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e0d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9e0d('0xa'));var deskjs=require(_0x9e0d('0xb'));var toCsv=require(_0x9e0d('0x7'));var querystring=require(_0x9e0d('0xc'));var Papa=require('papaparse');var Redis=require(_0x9e0d('0xd'));var authService=require(_0x9e0d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9e0d('0xf'));var hardwareService=require(_0x9e0d('0x10'));var logger=require(_0x9e0d('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x9e0d('0x12'));var licenseUtil=require(_0x9e0d('0x13'));var db=require(_0x9e0d('0x14'))['db'];function respondWithStatusCode(_0x11edee,_0x3247cc){_0x3247cc=_0x3247cc||0xcc;return function(_0x3d065c){if(_0x3d065c){return _0x11edee[_0x9e0d('0x15')](_0x3247cc);}return _0x11edee[_0x9e0d('0x16')](_0x3247cc)[_0x9e0d('0x17')]();};}function respondWithResult(_0x3d3bbb,_0x46c652){_0x46c652=_0x46c652||0xc8;return function(_0x1f8361){if(_0x1f8361){return _0x3d3bbb[_0x9e0d('0x16')](_0x46c652)[_0x9e0d('0x18')](_0x1f8361);}};}function respondWithFilteredResult(_0x3fad64,_0x388bbc){return function(_0x45838c){if(_0x45838c){var _0x292872=typeof _0x388bbc[_0x9e0d('0x19')]===_0x9e0d('0x1a')&&typeof _0x388bbc[_0x9e0d('0x1b')]===_0x9e0d('0x1a');var _0x1487bf=_0x45838c[_0x9e0d('0x1c')];var _0x5508a8=_0x292872?0x0:_0x388bbc[_0x9e0d('0x19')];var _0x103e22=_0x292872?_0x45838c['count']:_0x388bbc['offset']+_0x388bbc[_0x9e0d('0x1b')];var _0x22fe73;if(_0x103e22>=_0x1487bf){_0x103e22=_0x1487bf;_0x22fe73=0xc8;}else{_0x22fe73=0xce;}_0x3fad64[_0x9e0d('0x16')](_0x22fe73);return _0x3fad64[_0x9e0d('0x1d')]('Content-Range',_0x5508a8+'-'+_0x103e22+'/'+_0x1487bf)[_0x9e0d('0x18')](_0x45838c);}return null;};}function patchUpdates(_0x40eb21){return function(_0x4afdff){try{jsonpatch['apply'](_0x4afdff,_0x40eb21,!![]);}catch(_0x359ae6){return BPromise[_0x9e0d('0x1e')](_0x359ae6);}return _0x4afdff[_0x9e0d('0x1f')]();};}function saveUpdates(_0x4deb1d,_0x5e4050){return function(_0x1b6fcf){if(_0x1b6fcf){return _0x1b6fcf[_0x9e0d('0x20')](_0x4deb1d)[_0x9e0d('0x21')](function(_0x1c1f11){return _0x1c1f11;});}return null;};}function removeEntity(_0x3ae9cf,_0x54a830){return function(_0x11a5a3){if(_0x11a5a3){return _0x11a5a3[_0x9e0d('0x22')]()[_0x9e0d('0x21')](function(){_0x3ae9cf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ce94f,_0x15ff6d){return function(_0x54ca66){if(!_0x54ca66){_0x3ce94f[_0x9e0d('0x15')](0x194);}return _0x54ca66;};}function handleError(_0x4f15dd,_0x4beebb){_0x4beebb=_0x4beebb||0x1f4;return function(_0x3b4561){logger[_0x9e0d('0x23')](_0x3b4561[_0x9e0d('0x24')]);if(_0x3b4561[_0x9e0d('0x25')]){delete _0x3b4561[_0x9e0d('0x25')];}_0x4f15dd[_0x9e0d('0x16')](_0x4beebb)[_0x9e0d('0x26')](_0x3b4561);};}exports[_0x9e0d('0x20')]=function(_0x586bc0,_0x811fe1){if(_0x586bc0[_0x9e0d('0x27')]['id']){delete _0x586bc0[_0x9e0d('0x27')]['id'];}return db[_0x9e0d('0x28')][_0x9e0d('0x29')]({'where':{'id':_0x586bc0[_0x9e0d('0x2a')]['id']}})[_0x9e0d('0x21')](handleEntityNotFound(_0x811fe1,null))[_0x9e0d('0x21')](saveUpdates(_0x586bc0['body'],null))[_0x9e0d('0x21')](respondWithResult(_0x811fe1,null))[_0x9e0d('0x2b')](handleError(_0x811fe1,null));};exports['destroy']=function(_0x2f35ae,_0x123960){return db[_0x9e0d('0x28')][_0x9e0d('0x29')]({'where':{'id':_0x2f35ae[_0x9e0d('0x2a')]['id']}})[_0x9e0d('0x21')](handleEntityNotFound(_0x123960,null))[_0x9e0d('0x21')](removeEntity(_0x123960,null))[_0x9e0d('0x2b')](handleError(_0x123960,null));}; \ No newline at end of file +var _0x1ab6=['to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','destroy','error','stack','name','send','body','Action','find','params','then','catch','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0xf63ddd,_0x1aa06d){var _0x3300ff=function(_0x31635b){while(--_0x31635b){_0xf63ddd['push'](_0xf63ddd['shift']());}};_0x3300ff(++_0x1aa06d);}(_0x1ab6,0x1b1));var _0x61ab=function(_0x4e62ff,_0x448530){_0x4e62ff=_0x4e62ff-0x0;var _0x3b21cd=_0x1ab6[_0x4e62ff];return _0x3b21cd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x61ab('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x61ab('0x1'));var BPromise=require(_0x61ab('0x2'));var Mustache=require(_0x61ab('0x3'));var util=require(_0x61ab('0x4'));var path=require(_0x61ab('0x5'));var sox=require(_0x61ab('0x6'));var csv=require(_0x61ab('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61ab('0x8'));var _=require('lodash');var squel=require(_0x61ab('0x9'));var crypto=require(_0x61ab('0xa'));var jsforce=require(_0x61ab('0xb'));var deskjs=require(_0x61ab('0xc'));var toCsv=require(_0x61ab('0x7'));var querystring=require(_0x61ab('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x61ab('0xe'));var qs=require(_0x61ab('0xf'));var as=require(_0x61ab('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x61ab('0x11'));var utils=require(_0x61ab('0x12'));var config=require(_0x61ab('0x13'));var licenseUtil=require(_0x61ab('0x14'));var db=require(_0x61ab('0x15'))['db'];function respondWithStatusCode(_0x21a564,_0x1f2593){_0x1f2593=_0x1f2593||0xcc;return function(_0x10f5ca){if(_0x10f5ca){return _0x21a564[_0x61ab('0x16')](_0x1f2593);}return _0x21a564[_0x61ab('0x17')](_0x1f2593)['end']();};}function respondWithResult(_0x5dadd2,_0x37173d){_0x37173d=_0x37173d||0xc8;return function(_0x3c1795){if(_0x3c1795){return _0x5dadd2['status'](_0x37173d)[_0x61ab('0x18')](_0x3c1795);}};}function respondWithFilteredResult(_0x1666b0,_0x496bb0){return function(_0x223d2f){if(_0x223d2f){var _0x1bfe9d=typeof _0x496bb0[_0x61ab('0x19')]===_0x61ab('0x1a')&&typeof _0x496bb0['limit']===_0x61ab('0x1a');var _0x279262=_0x223d2f[_0x61ab('0x1b')];var _0x236411=_0x1bfe9d?0x0:_0x496bb0[_0x61ab('0x19')];var _0x305c81=_0x1bfe9d?_0x223d2f[_0x61ab('0x1b')]:_0x496bb0[_0x61ab('0x19')]+_0x496bb0[_0x61ab('0x1c')];var _0x2b919e;if(_0x305c81>=_0x279262){_0x305c81=_0x279262;_0x2b919e=0xc8;}else{_0x2b919e=0xce;}_0x1666b0[_0x61ab('0x17')](_0x2b919e);return _0x1666b0['set']('Content-Range',_0x236411+'-'+_0x305c81+'/'+_0x279262)[_0x61ab('0x18')](_0x223d2f);}return null;};}function patchUpdates(_0x3a10a0){return function(_0x28dde4){try{jsonpatch[_0x61ab('0x1d')](_0x28dde4,_0x3a10a0,!![]);}catch(_0x312a05){return BPromise[_0x61ab('0x1e')](_0x312a05);}return _0x28dde4[_0x61ab('0x1f')]();};}function saveUpdates(_0x3da19b,_0x52e25c){return function(_0x289560){if(_0x289560){return _0x289560[_0x61ab('0x20')](_0x3da19b)['then'](function(_0x3e32c2){return _0x3e32c2;});}return null;};}function removeEntity(_0x2c9240,_0x1ffc8f){return function(_0x70dc0a){if(_0x70dc0a){return _0x70dc0a[_0x61ab('0x21')]()['then'](function(){_0x2c9240[_0x61ab('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8e74,_0x24302f){return function(_0x40d5bb){if(!_0x40d5bb){_0x5d8e74['sendStatus'](0x194);}return _0x40d5bb;};}function handleError(_0x1b0eba,_0x1b58eb){_0x1b58eb=_0x1b58eb||0x1f4;return function(_0x129c2b){logger[_0x61ab('0x22')](_0x129c2b[_0x61ab('0x23')]);if(_0x129c2b[_0x61ab('0x24')]){delete _0x129c2b['name'];}_0x1b0eba[_0x61ab('0x17')](_0x1b58eb)[_0x61ab('0x25')](_0x129c2b);};}exports[_0x61ab('0x20')]=function(_0x13dd86,_0x506acb){if(_0x13dd86['body']['id']){delete _0x13dd86[_0x61ab('0x26')]['id'];}return db[_0x61ab('0x27')][_0x61ab('0x28')]({'where':{'id':_0x13dd86[_0x61ab('0x29')]['id']}})[_0x61ab('0x2a')](handleEntityNotFound(_0x506acb,null))['then'](saveUpdates(_0x13dd86[_0x61ab('0x26')],null))[_0x61ab('0x2a')](respondWithResult(_0x506acb,null))[_0x61ab('0x2b')](handleError(_0x506acb,null));};exports[_0x61ab('0x21')]=function(_0x41d941,_0x3a300d){return db['Action'][_0x61ab('0x28')]({'where':{'id':_0x41d941['params']['id']}})[_0x61ab('0x2a')](handleEntityNotFound(_0x3a300d,null))[_0x61ab('0x2a')](removeEntity(_0x3a300d,null))['catch'](handleError(_0x3a300d,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 393da5e..5b1ddb2 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 _0x16f6=['Action','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./action.attributes','exports','define'];(function(_0x46b295,_0x554b00){var _0x1c4c10=function(_0x58c71b){while(--_0x58c71b){_0x46b295['push'](_0x46b295['shift']());}};_0x1c4c10(++_0x554b00);}(_0x16f6,0x1ae));var _0x616f=function(_0x417dff,_0x49f959){_0x417dff=_0x417dff-0x0;var _0x5c7e13=_0x16f6[_0x417dff];return _0x5c7e13;};'use strict';var _=require(_0x616f('0x0'));var util=require(_0x616f('0x1'));var logger=require(_0x616f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x616f('0x3'));var rp=require(_0x616f('0x4'));var fs=require('fs');var path=require(_0x616f('0x5'));var rimraf=require(_0x616f('0x6'));var config=require('../../config/environment');var attributes=require(_0x616f('0x7'));module[_0x616f('0x8')]=function(_0x42a8f7,_0x5b8df3){return _0x42a8f7[_0x616f('0x9')](_0x616f('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7550=['tools_actions','lodash','util','../../config/logger','api','../../config/environment','./action.attributes','define'];(function(_0x2ff391,_0x5acb82){var _0x4f0647=function(_0x3bc22c){while(--_0x3bc22c){_0x2ff391['push'](_0x2ff391['shift']());}};_0x4f0647(++_0x5acb82);}(_0x7550,0xc9));var _0x0755=function(_0x4d99d2,_0x2d8a11){_0x4d99d2=_0x4d99d2-0x0;var _0x5498c0=_0x7550[_0x4d99d2];return _0x5498c0;};'use strict';var _=require(_0x0755('0x0'));var util=require(_0x0755('0x1'));var logger=require(_0x0755('0x2'))(_0x0755('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0755('0x4'));var attributes=require(_0x0755('0x5'));module['exports']=function(_0xc07402,_0x53a63c){return _0xc07402[_0x0755('0x6')]('Action',attributes,{'tableName':_0x0755('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 6ac673c..c608912 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(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1cb9,0x14e));var _0x91cb=function(_0x28c234,_0xa157e6){_0x28c234=_0x28c234-0x0;var _0x5ea8c3=_0x1cb9[_0x28c234];return _0x5ea8c3;};'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 _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5b58c6,_0x438edf){var _0xe140d9=function(_0x193aea){while(--_0x193aea){_0x5b58c6['push'](_0x5b58c6['shift']());}};_0xe140d9(++_0x438edf);}(_0x326f,0xd1));var _0xf326=function(_0x1cb4e3,_0x39ba88){_0x1cb4e3=_0x1cb4e3-0x0;var _0x4bdfb5=_0x326f[_0x1cb4e3];return _0x4bdfb5;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 8d2ce4b..13913b6 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 _0xbc31=['delete','/:id','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./action.controller','put','update'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xbc31,0x122));var _0x1bc3=function(_0x4f709f,_0x5ef2cf){_0x4f709f=_0x4f709f-0x0;var _0x3699d3=_0xbc31[_0x4f709f];return _0x3699d3;};'use strict';var multer=require(_0x1bc3('0x0'));var util=require(_0x1bc3('0x1'));var path=require(_0x1bc3('0x2'));var timeout=require(_0x1bc3('0x3'));var express=require(_0x1bc3('0x4'));var router=express['Router']();var fs_extra=require(_0x1bc3('0x5'));var auth=require(_0x1bc3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1bc3('0x7'));router[_0x1bc3('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1bc3('0x9')]);router[_0x1bc3('0xa')](_0x1bc3('0xb'),auth[_0x1bc3('0xc')](),controller[_0x1bc3('0xd')]);module[_0x1bc3('0xe')]=router; \ No newline at end of file +var _0xe04d=['fs-extra','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x272f84,_0x153d61){var _0x50470b=function(_0x2e0eca){while(--_0x2e0eca){_0x272f84['push'](_0x272f84['shift']());}};_0x50470b(++_0x153d61);}(_0xe04d,0xdc));var _0xde04=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0xe04d[_0x55c1f0];return _0x1530fa;};'use strict';var multer=require(_0xde04('0x0'));var util=require('util');var path=require(_0xde04('0x1'));var timeout=require(_0xde04('0x2'));var express=require('express');var router=express[_0xde04('0x3')]();var fs_extra=require(_0xde04('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xde04('0x5'));var config=require(_0xde04('0x6'));var controller=require(_0xde04('0x7'));router['put']('/:id',auth[_0xde04('0x8')](),controller[_0xde04('0x9')]);router[_0xde04('0xa')](_0xde04('0xb'),auth[_0xde04('0x8')](),controller[_0xde04('0xc')]);module[_0xde04('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 5c5c517..457b8e1 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 _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x220d76,_0x1ece1d){var _0x15f7d8=function(_0xab3b61){while(--_0xab3b61){_0x220d76['push'](_0x220d76['shift']());}};_0x15f7d8(++_0x1ece1d);}(_0x1883,0xab));var _0x3188=function(_0x1009c9,_0x450515){_0x1009c9=_0x1009c9-0x0;var _0x4fdcdb=_0x1883[_0x1009c9];return _0x4fdcdb;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file +var _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x32cfed,_0x278ecd){var _0x5735e9=function(_0x20af72){while(--_0x20af72){_0x32cfed['push'](_0x32cfed['shift']());}};_0x5735e9(++_0x278ecd);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xf2ca[_0x257495];return _0x3849aa;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0f659c1..e632864 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 _0xc108=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','SUM(%s)','COUNT(DISTINCT\x20%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','rules','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(%s)','AVG(%s)','IS\x20NOT\x20EMPTY','operator','getFields','findAll','metric','clone','output','%s-%s.%s','randomstring','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','from','countTable','COUNT(*)','run','runReport','MAX(%s)','keyBy','DESC','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','CustomReports','UserProfileResource','sendStatus','error','name','index','AnalyticCustomReport','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x5615a9,_0x3831ad){var _0x5a5e3d=function(_0x2f6c26){while(--_0x2f6c26){_0x5615a9['push'](_0x5615a9['shift']());}};_0x5a5e3d(++_0x3831ad);}(_0xc108,0x19d));var _0x8c10=function(_0x557f94,_0x1e6817){_0x557f94=_0x557f94-0x0;var _0x212e8f=_0xc108[_0x557f94];return _0x212e8f;};'use strict';var emlformat=require(_0x8c10('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8c10('0x1'));var rp=require(_0x8c10('0x2'));var moment=require(_0x8c10('0x3'));var BPromise=require(_0x8c10('0x4'));var Mustache=require(_0x8c10('0x5'));var util=require(_0x8c10('0x6'));var path=require('path');var sox=require(_0x8c10('0x7'));var csv=require('to-csv');var ejs=require(_0x8c10('0x8'));var fs=require('fs');var fs_extra=require(_0x8c10('0x9'));var _=require(_0x8c10('0xa'));var squel=require('squel');var crypto=require(_0x8c10('0xb'));var jsforce=require(_0x8c10('0xc'));var deskjs=require(_0x8c10('0xd'));var toCsv=require(_0x8c10('0xe'));var querystring=require(_0x8c10('0xf'));var Papa=require(_0x8c10('0x10'));var Redis=require('ioredis');var authService=require(_0x8c10('0x11'));var qs=require(_0x8c10('0x12'));var as=require(_0x8c10('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c10('0x14'))(_0x8c10('0x15'));var utils=require(_0x8c10('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8c10('0x17'))['db'];var dbH=require(_0x8c10('0x17'))[_0x8c10('0x18')];function respondWithStatusCode(_0x49e126,_0x15cf38){_0x15cf38=_0x15cf38||0xcc;return function(_0x36ec85){if(_0x36ec85){return _0x49e126['sendStatus'](_0x15cf38);}return _0x49e126[_0x8c10('0x19')](_0x15cf38)['end']();};}function respondWithResult(_0x45731d,_0x159b05){_0x159b05=_0x159b05||0xc8;return function(_0x248bc2){if(_0x248bc2){return _0x45731d[_0x8c10('0x19')](_0x159b05)[_0x8c10('0x1a')](_0x248bc2);}};}function respondWithFilteredResult(_0x494b21,_0x565096){return function(_0xeb84a1){if(_0xeb84a1){var _0x27790a=typeof _0x565096[_0x8c10('0x1b')]===_0x8c10('0x1c')&&typeof _0x565096[_0x8c10('0x1d')]===_0x8c10('0x1c');var _0x1f39e6=_0xeb84a1[_0x8c10('0x1e')];var _0x454db6=_0x27790a?0x0:_0x565096['offset'];var _0xc31f0a=_0x27790a?_0xeb84a1[_0x8c10('0x1e')]:_0x565096[_0x8c10('0x1b')]+_0x565096[_0x8c10('0x1d')];var _0x3c0e4e;if(_0xc31f0a>=_0x1f39e6){_0xc31f0a=_0x1f39e6;_0x3c0e4e=0xc8;}else{_0x3c0e4e=0xce;}_0x494b21[_0x8c10('0x19')](_0x3c0e4e);return _0x494b21[_0x8c10('0x1f')](_0x8c10('0x20'),_0x454db6+'-'+_0xc31f0a+'/'+_0x1f39e6)[_0x8c10('0x1a')](_0xeb84a1);}return null;};}function patchUpdates(_0x48faaf){return function(_0x4f49f3){try{jsonpatch[_0x8c10('0x21')](_0x4f49f3,_0x48faaf,!![]);}catch(_0x2cd774){return BPromise[_0x8c10('0x22')](_0x2cd774);}return _0x4f49f3[_0x8c10('0x23')]();};}function saveUpdates(_0x3c6e16,_0x14254b){return function(_0x4df2f8){if(_0x4df2f8){return _0x4df2f8[_0x8c10('0x24')](_0x3c6e16)['then'](function(_0x224fdb){return _0x224fdb;});}return null;};}function removeEntity(_0x1ceae0,_0x452f4b){return function(_0x42a882){if(_0x42a882){return _0x42a882[_0x8c10('0x25')]()[_0x8c10('0x26')](function(){var _0x413279=_0x42a882['get']({'plain':!![]});var _0x236770=_0x8c10('0x27');return db[_0x8c10('0x28')][_0x8c10('0x25')]({'where':{'type':_0x236770,'resourceId':_0x413279['id']}})[_0x8c10('0x26')](function(){return _0x42a882;});})[_0x8c10('0x26')](function(){_0x1ceae0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6ce3,_0x4294dc){return function(_0x57246f){if(!_0x57246f){_0x1e6ce3[_0x8c10('0x29')](0x194);}return _0x57246f;};}function handleError(_0x2e0649,_0x330cb6){_0x330cb6=_0x330cb6||0x1f4;return function(_0x14f7d9){logger[_0x8c10('0x2a')](_0x14f7d9['stack']);if(_0x14f7d9[_0x8c10('0x2b')]){delete _0x14f7d9[_0x8c10('0x2b')];}_0x2e0649['status'](_0x330cb6)['send'](_0x14f7d9);};}exports[_0x8c10('0x2c')]=function(_0x4c3615,_0x507f22){var _0x8390d3={},_0x57173e={},_0x3c969c={'count':0x0,'rows':[]};var _0x13418f=_['map'](db[_0x8c10('0x2d')][_0x8c10('0x2e')],function(_0x36743b){return{'name':_0x36743b[_0x8c10('0x2f')],'type':_0x36743b['type'][_0x8c10('0x30')]};});_0x57173e[_0x8c10('0x31')]=_[_0x8c10('0x32')](_0x13418f,'name');_0x57173e[_0x8c10('0x33')]=_[_0x8c10('0x34')](_0x4c3615['query']);_0x57173e['filters']=_[_0x8c10('0x35')](_0x57173e[_0x8c10('0x31')],_0x57173e['query']);_0x8390d3[_0x8c10('0x36')]=_[_0x8c10('0x35')](_0x57173e[_0x8c10('0x31')],qs['fields'](_0x4c3615[_0x8c10('0x33')][_0x8c10('0x37')]));_0x8390d3[_0x8c10('0x36')]=_0x8390d3[_0x8c10('0x36')][_0x8c10('0x38')]?_0x8390d3[_0x8c10('0x36')]:_0x57173e[_0x8c10('0x31')];if(!_0x4c3615[_0x8c10('0x33')][_0x8c10('0x39')](_0x8c10('0x3a'))){_0x8390d3['limit']=qs[_0x8c10('0x1d')](_0x4c3615[_0x8c10('0x33')][_0x8c10('0x1d')]);_0x8390d3[_0x8c10('0x1b')]=qs[_0x8c10('0x1b')](_0x4c3615[_0x8c10('0x33')][_0x8c10('0x1b')]);}_0x8390d3['order']=qs[_0x8c10('0x3b')](_0x4c3615[_0x8c10('0x33')][_0x8c10('0x3b')]);_0x8390d3['where']=qs[_0x8c10('0x3c')](_[_0x8c10('0x3d')](_0x4c3615[_0x8c10('0x33')],_0x57173e[_0x8c10('0x3c')]),_0x13418f);if(_0x4c3615[_0x8c10('0x33')][_0x8c10('0x3e')]){_0x8390d3[_0x8c10('0x3f')]=_['merge'](_0x8390d3[_0x8c10('0x3f')],{'$or':_[_0x8c10('0x32')](_0x13418f,function(_0x3bc609){if(_0x3bc609[_0x8c10('0x40')]!==_0x8c10('0x41')){var _0x53e31b={};_0x53e31b[_0x3bc609['name']]={'$like':'%'+_0x4c3615[_0x8c10('0x33')]['filter']+'%'};return _0x53e31b;}})});}_0x8390d3=_['merge']({},_0x8390d3,_0x4c3615[_0x8c10('0x42')]);var _0xe61474={'where':_0x8390d3[_0x8c10('0x3f')]};return db[_0x8c10('0x2d')][_0x8c10('0x1e')](_0xe61474)[_0x8c10('0x26')](function(_0x1d93d8){_0x3c969c[_0x8c10('0x1e')]=_0x1d93d8;if(_0x4c3615[_0x8c10('0x33')][_0x8c10('0x43')]){_0x8390d3[_0x8c10('0x44')]=[{'all':!![]}];}return db[_0x8c10('0x2d')]['findAll'](_0x8390d3);})[_0x8c10('0x26')](function(_0x24d998){_0x3c969c[_0x8c10('0x45')]=_0x24d998;return _0x3c969c;})['then'](respondWithFilteredResult(_0x507f22,_0x8390d3))[_0x8c10('0x46')](handleError(_0x507f22,null));};exports[_0x8c10('0x47')]=function(_0xb8df05,_0x366e64){var _0xbac66={'raw':![],'where':{'id':_0xb8df05[_0x8c10('0x48')]['id']}},_0x513490={};_0x513490[_0x8c10('0x31')]=_[_0x8c10('0x34')](db[_0x8c10('0x2d')][_0x8c10('0x2e')]);_0x513490['query']=_[_0x8c10('0x34')](_0xb8df05['query']);_0x513490[_0x8c10('0x3c')]=_['intersection'](_0x513490[_0x8c10('0x31')],_0x513490[_0x8c10('0x33')]);_0xbac66[_0x8c10('0x36')]=_[_0x8c10('0x35')](_0x513490[_0x8c10('0x31')],qs['fields'](_0xb8df05[_0x8c10('0x33')]['fields']));_0xbac66['attributes']=_0xbac66['attributes'][_0x8c10('0x38')]?_0xbac66[_0x8c10('0x36')]:_0x513490['model'];if(_0xb8df05[_0x8c10('0x33')]['includeAll']){_0xbac66[_0x8c10('0x44')]=[{'all':!![]}];}_0xbac66=_[_0x8c10('0x49')]({},_0xbac66,_0xb8df05[_0x8c10('0x42')]);return db['AnalyticCustomReport'][_0x8c10('0x4a')](_0xbac66)['then'](handleEntityNotFound(_0x366e64,null))[_0x8c10('0x26')](respondWithResult(_0x366e64,null))[_0x8c10('0x46')](handleError(_0x366e64,null));};exports[_0x8c10('0x4b')]=function(_0x5f29dc,_0x12b43b){return db[_0x8c10('0x2d')][_0x8c10('0x4b')](_0x5f29dc[_0x8c10('0x4c')],{})[_0x8c10('0x26')](function(_0x6fa624){var _0x412637=_0x5f29dc[_0x8c10('0x4d')][_0x8c10('0x4e')]({'plain':!![]});if(!_0x412637)throw new Error(_0x8c10('0x4f'));if(_0x412637[_0x8c10('0x50')]===_0x8c10('0x4d')){var _0x4e54ba=_0x6fa624[_0x8c10('0x4e')]({'plain':!![]});var _0x4e2f4f='Reports';return db[_0x8c10('0x51')]['find']({'where':{'name':_0x4e2f4f,'userProfileId':_0x412637[_0x8c10('0x52')]},'raw':!![]})[_0x8c10('0x26')](function(_0x554c9e){if(_0x554c9e&&_0x554c9e[_0x8c10('0x53')]===0x0){return db[_0x8c10('0x28')][_0x8c10('0x4b')]({'name':_0x4e54ba['name'],'resourceId':_0x4e54ba['id'],'type':_0x8c10('0x27'),'sectionId':_0x554c9e['id']},{})[_0x8c10('0x26')](function(){return _0x6fa624;});}else{return _0x6fa624;}})[_0x8c10('0x46')](function(_0x5066cf){logger[_0x8c10('0x2a')](_0x8c10('0x54'),_0x5066cf);throw _0x5066cf;});}return _0x6fa624;})[_0x8c10('0x26')](respondWithResult(_0x12b43b,0xc9))[_0x8c10('0x46')](handleError(_0x12b43b,null));};exports[_0x8c10('0x24')]=function(_0x117b50,_0x3ef37a){if(_0x117b50[_0x8c10('0x4c')]['id']){delete _0x117b50[_0x8c10('0x4c')]['id'];}return db[_0x8c10('0x2d')]['find']({'where':{'id':_0x117b50[_0x8c10('0x48')]['id']}})[_0x8c10('0x26')](handleEntityNotFound(_0x3ef37a,null))['then'](saveUpdates(_0x117b50[_0x8c10('0x4c')],null))[_0x8c10('0x26')](respondWithResult(_0x3ef37a,null))[_0x8c10('0x46')](handleError(_0x3ef37a,null));};exports[_0x8c10('0x25')]=function(_0x361044,_0x4836b3){return db['AnalyticCustomReport'][_0x8c10('0x4a')]({'where':{'id':_0x361044['params']['id']}})[_0x8c10('0x26')](handleEntityNotFound(_0x4836b3,null))[_0x8c10('0x26')](removeEntity(_0x4836b3,null))[_0x8c10('0x46')](handleError(_0x4836b3,null));};exports['preview']=function(_0x2ec8a5,_0x33ed40){var _0x30a57f=0xa;var _0xe9f0b8=[_0x8c10('0x55'),_0x8c10('0x56'),_0x8c10('0x57'),'cross_join'];var _0x38b6a6={'SUM':_0x8c10('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x8c10('0x59'),'MAX':'MAX(%s)','MIN':_0x8c10('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x8c10('0x5b'),'GROUP_CONCAT ASC':_0x8c10('0x5c'),'GROUP_CONCAT DESC':_0x8c10('0x5d')};var _0x21fa38={'SEC_TO_TIME':_0x8c10('0x5e'),'DATE':_0x8c10('0x5f'),'HOUR':_0x8c10('0x60'),'ROUND':_0x8c10('0x61'),'UNIX_TIMESTAMP':_0x8c10('0x62')};var _0x23df7e=function(_0x5b3b07){return!_[_0x8c10('0x63')]([_0x8c10('0x64'),_0x8c10('0x65'),_0x8c10('0x66'),'IS\x20NOT\x20EMPTY'],_0x5b3b07);};var _0x44024e=function(_0x450158){if(!_0x450158||!_0x450158[_0x8c10('0x67')][_0x8c10('0x38')]){return'';}for(var _0x11bf5b='(',_0x5b0b63=0x0;_0x5b0b63<_0x450158[_0x8c10('0x67')][_0x8c10('0x38')];_0x5b0b63+=0x1){_0x5b0b63>0x0&&(_0x11bf5b+='\x20'+_0x450158['operator']+'\x20');_0x11bf5b+=_0x450158[_0x8c10('0x67')][_0x5b0b63][_0x8c10('0x68')]?_0x44024e(_0x450158[_0x8c10('0x67')][_0x5b0b63][_0x8c10('0x68')]):_0x450158[_0x8c10('0x67')][_0x5b0b63][_0x8c10('0x69')]+'\x20'+_0x450158[_0x8c10('0x67')][_0x5b0b63]['condition']+(_0x23df7e(_0x450158[_0x8c10('0x67')][_0x5b0b63][_0x8c10('0x6a')])?'\x20'+_0x450158['rules'][_0x5b0b63]['value']:'');}return _0x11bf5b+')';};var _0x227587={'where':{'id':_0x2ec8a5[_0x8c10('0x48')]['id']}},_0x2d0678,_0x38385e,_0x1478cd,_0x58c3d3,_0x2c6173;_0x227587=_[_0x8c10('0x49')]({},_0x227587,_0x2ec8a5[_0x8c10('0x42')]);return db[_0x8c10('0x2d')][_0x8c10('0x4a')](_0x227587)[_0x8c10('0x26')](function(_0x37092e){if(_0x37092e){_0x2d0678=_0x37092e;return _0x37092e['getFields']();}return null;})[_0x8c10('0x26')](function(_0x1d38ce){if(_0x1d38ce){if(!_0x1d38ce['length']){throw new db[(_0x8c10('0x6b'))][(_0x8c10('0x6c'))](_0x8c10('0x6d'),0x193);}_0x38385e=_0x1d38ce;return db[_0x8c10('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x8c10('0x26')](function(_0x5bd537){if(_0x5bd537){_0x1478cd=_['keyBy'](_0x5bd537,'id');var _0x89d3af;var _0x7b6fb0=squel[_0x8c10('0x6f')]();_0x7b6fb0['from'](_0x2d0678[_0x8c10('0x70')]);for(var _0x204153=0x0;_0x204153<_0x38385e['length'];_0x204153+=0x1){_0x89d3af=_0x38385e[_0x204153][_0x8c10('0x71')]?_0x1478cd[_0x38385e[_0x204153][_0x8c10('0x71')]]['metric']:_0x38385e[_0x204153][_0x8c10('0x69')];_0x89d3af=_0x38385e[_0x204153][_0x8c10('0x72')]?_[_0x8c10('0x73')](_0x38b6a6[_0x38385e[_0x204153][_0x8c10('0x72')]],'%s',_0x89d3af):_0x89d3af;_0x89d3af=_0x38385e[_0x204153][_0x8c10('0x74')]?_[_0x8c10('0x73')](_0x21fa38[_0x38385e[_0x204153]['format']],'%s',_0x89d3af):_0x89d3af;if(_0x38385e[_0x204153][_0x8c10('0x75')]){_0x7b6fb0['group'](_0x89d3af);}_0x38385e[_0x204153][_0x8c10('0x76')]&&_0x7b6fb0[_0x8c10('0x77')](_0x89d3af,_0x38385e[_0x204153][_0x8c10('0x76')]==='DESC'?![]:!![]);_0x7b6fb0['field'](_0x89d3af,_0x38385e[_0x204153][_0x8c10('0x78')]||_0x89d3af);}if(_0x2d0678['joins']){_0x2d0678['joins']=JSON['parse'](_0x2d0678['joins']);for(var _0x39acb2=0x0;_0x39acb2<_0x2d0678[_0x8c10('0x79')]['length'];_0x39acb2+=0x1){if(_0x2d0678[_0x8c10('0x79')][_0x39acb2][_0x8c10('0x40')]&&_[_0x8c10('0x63')](_0xe9f0b8,_0x2d0678[_0x8c10('0x79')][_0x39acb2][_0x8c10('0x40')])&&_0x2d0678[_0x8c10('0x79')][_0x39acb2][_0x8c10('0x7a')]&&_0x2d0678[_0x8c10('0x79')][_0x39acb2][_0x8c10('0x7b')]&&_0x2d0678[_0x8c10('0x79')][_0x39acb2][_0x8c10('0x7c')]){_0x7b6fb0[_0x2d0678[_0x8c10('0x79')][_0x39acb2][_0x8c10('0x40')]](_0x2d0678[_0x8c10('0x79')][_0x39acb2][_0x8c10('0x7b')],null,util[_0x8c10('0x74')](_0x8c10('0x7d'),_0x2d0678['table'],_0x2d0678['joins'][_0x39acb2][_0x8c10('0x7a')],_0x2d0678[_0x8c10('0x79')][_0x39acb2]['foreignTable'],_0x2d0678['joins'][_0x39acb2]['foreignKey']));}}}if(_0x2d0678[_0x8c10('0x7e')]){_0x2d0678[_0x8c10('0x7e')]=JSON[_0x8c10('0x7f')](_0x2d0678[_0x8c10('0x7e')]);_0x7b6fb0[_0x8c10('0x3f')](_0x44024e(_0x2d0678[_0x8c10('0x7e')][_0x8c10('0x68')]));}_0x2c6173=_0x7b6fb0['clone']();_0x7b6fb0[_0x8c10('0x1d')](_0x30a57f);_0x7b6fb0['offset'](0x0);logger[_0x8c10('0x80')](_0x8c10('0x81'),_0x7b6fb0[_0x8c10('0x82')]());return dbH[_0x8c10('0x83')][_0x8c10('0x33')](_0x7b6fb0[_0x8c10('0x82')](),{'type':dbH[_0x8c10('0x83')][_0x8c10('0x84')][_0x8c10('0x85')]});}})[_0x8c10('0x26')](respondWithResult(_0x33ed40,null))[_0x8c10('0x46')](handleError(_0x33ed40,null));};function runReport(_0x1c2195,_0x318594,_0x2b6d88){var _0x139157=_0x318594[_0x8c10('0x2b')];var _0x2b8e31=0xa;var _0xedc44e=[_0x8c10('0x55'),_0x8c10('0x56'),_0x8c10('0x57'),_0x8c10('0x86')];var _0x388f10={'SUM':_0x8c10('0x58'),'COUNT':_0x8c10('0x87'),'COUNT DISTINCT':_0x8c10('0x59'),'MAX':'MAX(%s)','MIN':_0x8c10('0x5a'),'AVG':_0x8c10('0x88'),'GROUP_CONCAT':_0x8c10('0x5b'),'GROUP_CONCAT ASC':_0x8c10('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x390559={'SEC_TO_TIME':_0x8c10('0x5e'),'DATE':_0x8c10('0x5f'),'HOUR':_0x8c10('0x60'),'ROUND':_0x8c10('0x61'),'UNIX_TIMESTAMP':_0x8c10('0x62')};var _0x455a78=function(_0x4c2cd7){return!_[_0x8c10('0x63')](['IS\x20NULL',_0x8c10('0x65'),_0x8c10('0x66'),_0x8c10('0x89')],_0x4c2cd7);};var _0x1f6bcb=function(_0x1ed629){if(!_0x1ed629||!_0x1ed629[_0x8c10('0x67')][_0x8c10('0x38')]){return'';}for(var _0x35e0f4='(',_0x195430=0x0;_0x195430<_0x1ed629['rules']['length'];_0x195430+=0x1){_0x195430>0x0&&(_0x35e0f4+='\x20'+_0x1ed629[_0x8c10('0x8a')]+'\x20');_0x35e0f4+=_0x1ed629[_0x8c10('0x67')][_0x195430][_0x8c10('0x68')]?_0x1f6bcb(_0x1ed629[_0x8c10('0x67')][_0x195430]['group']):_0x1ed629['rules'][_0x195430]['field']+'\x20'+_0x1ed629[_0x8c10('0x67')][_0x195430]['condition']+(_0x455a78(_0x1ed629[_0x8c10('0x67')][_0x195430]['condition'])?'\x20'+_0x1ed629['rules'][_0x195430]['value']:'');}return _0x35e0f4+')';};var _0x30e9d2={'where':{'id':_0x1c2195['id']}},_0x43038d,_0x16e63e,_0x583b86,_0x4115b3,_0x577412;_0x30e9d2=_[_0x8c10('0x49')]({},_0x30e9d2,_0x2b6d88);return db[_0x8c10('0x2d')][_0x8c10('0x4a')](_0x30e9d2)[_0x8c10('0x26')](function(_0x551fac){if(_0x551fac){_0x43038d=_0x551fac;return _0x551fac[_0x8c10('0x8b')]();}return null;})[_0x8c10('0x26')](function(_0x369cf9){if(_0x369cf9){if(!_0x369cf9[_0x8c10('0x38')]){throw new db[(_0x8c10('0x6b'))][(_0x8c10('0x6c'))](_0x8c10('0x6d'),0x193);}_0x16e63e=_0x369cf9;return db[_0x8c10('0x6e')][_0x8c10('0x8c')]({'raw':!![]});}return null;})[_0x8c10('0x26')](function(_0x41f3c2){if(_0x41f3c2){_0x583b86=_['keyBy'](_0x41f3c2,'id');var _0x44335f;var _0x4c49a2=squel['select']();_0x4c49a2['from'](_0x43038d[_0x8c10('0x70')]);for(var _0x1cf4a2=0x0;_0x1cf4a2<_0x16e63e[_0x8c10('0x38')];_0x1cf4a2+=0x1){_0x44335f=_0x16e63e[_0x1cf4a2][_0x8c10('0x71')]?_0x583b86[_0x16e63e[_0x1cf4a2][_0x8c10('0x71')]][_0x8c10('0x8d')]:_0x16e63e[_0x1cf4a2][_0x8c10('0x69')];_0x44335f=_0x16e63e[_0x1cf4a2]['function']?_['replace'](_0x388f10[_0x16e63e[_0x1cf4a2]['function']],'%s',_0x44335f):_0x44335f;_0x44335f=_0x16e63e[_0x1cf4a2]['format']?_[_0x8c10('0x73')](_0x390559[_0x16e63e[_0x1cf4a2][_0x8c10('0x74')]],'%s',_0x44335f):_0x44335f;if(_0x16e63e[_0x1cf4a2]['groupBy']){_0x4c49a2[_0x8c10('0x68')](_0x44335f);}_0x16e63e[_0x1cf4a2]['orderBy']&&_0x4c49a2[_0x8c10('0x77')](_0x44335f,_0x16e63e[_0x1cf4a2][_0x8c10('0x76')]==='DESC'?![]:!![]);_0x4c49a2[_0x8c10('0x69')](_0x44335f,_0x16e63e[_0x1cf4a2][_0x8c10('0x78')]||_0x44335f);}if(_0x43038d['joins']){_0x43038d['joins']=JSON[_0x8c10('0x7f')](_0x43038d[_0x8c10('0x79')]);for(var _0x3c1090=0x0;_0x3c1090<_0x43038d[_0x8c10('0x79')][_0x8c10('0x38')];_0x3c1090+=0x1){if(_0x43038d[_0x8c10('0x79')][_0x3c1090][_0x8c10('0x40')]&&_[_0x8c10('0x63')](_0xedc44e,_0x43038d[_0x8c10('0x79')][_0x3c1090][_0x8c10('0x40')])&&_0x43038d['joins'][_0x3c1090][_0x8c10('0x7a')]&&_0x43038d['joins'][_0x3c1090][_0x8c10('0x7b')]&&_0x43038d[_0x8c10('0x79')][_0x3c1090][_0x8c10('0x7c')]){_0x4c49a2[_0x43038d[_0x8c10('0x79')][_0x3c1090]['type']](_0x43038d[_0x8c10('0x79')][_0x3c1090]['foreignTable'],null,util[_0x8c10('0x74')]('%s.%s\x20=\x20%s.%s',_0x43038d['table'],_0x43038d[_0x8c10('0x79')][_0x3c1090][_0x8c10('0x7a')],_0x43038d['joins'][_0x3c1090]['foreignTable'],_0x43038d[_0x8c10('0x79')][_0x3c1090][_0x8c10('0x7c')]));}}}if(_0x43038d[_0x8c10('0x7e')]){_0x43038d['conditions']=JSON['parse'](_0x43038d['conditions']);_0x4c49a2[_0x8c10('0x3f')](_0x1f6bcb(_0x43038d[_0x8c10('0x7e')][_0x8c10('0x68')]));}_0x577412=_0x4c49a2[_0x8c10('0x8e')]();_0x4c49a2[_0x8c10('0x1d')](_0x2b8e31);_0x4c49a2[_0x8c10('0x1b')](0x0);return;}})['then'](function(){if(_0x318594[_0x8c10('0x8f')]==='web'){return null;}var _0x43c78e=_[_0x8c10('0x49')](_0x318594,{'name':_0x318594['fullPath']||_0x318594['name']||_0x43038d[_0x8c10('0x2b')],'basename':_0x139157,'savename':util[_0x8c10('0x74')](_0x8c10('0x90'),_0x318594[_0x8c10('0x2b')]||_0x43038d[_0x8c10('0x2b')],require(_0x8c10('0x91'))['generate'](0x4),_0x318594[_0x8c10('0x8f')]||'csv'),'reportId':_0x43038d['id'],'reportType':_0x8c10('0x92')});return db['AnalyticExtractedReport'][_0x8c10('0x4b')](_0x43c78e,{'raw':!![]});})[_0x8c10('0x26')](function(_0x4f4037){if(_0x43038d[_0x8c10('0x70')]===_0x8c10('0x93')){_0x577412[_0x8c10('0x3f')](_0x43038d[_0x8c10('0x70')]+_0x8c10('0x94'),_0x318594[_0x8c10('0x95')],_0x318594[_0x8c10('0x96')]);}else{_0x577412[_0x8c10('0x3f')](_0x43038d[_0x8c10('0x70')]+_0x8c10('0x97'),_0x318594[_0x8c10('0x95')],_0x318594[_0x8c10('0x96')]);}if(_0x4f4037){logger[_0x8c10('0x98')]('Run\x20Query:',_0x577412['toString']());require(_0x8c10('0x99'))[_0x8c10('0x9a')](path['join'](__dirname,_0x8c10('0x9b'),_0x4f4037[_0x8c10('0x8f')]),[_0x4f4037['id'],_0x577412[_0x8c10('0x82')](),path[_0x8c10('0x55')](__dirname,_0x8c10('0x9c'),_0x4f4037['savename']),_0x139157]);return _0x4f4037;}else{var _0x1f9192=squel[_0x8c10('0x6f')]();_0x1f9192[_0x8c10('0x9d')]('('+_0x577412[_0x8c10('0x82')]()+')',_0x8c10('0x9e'));_0x1f9192['field'](_0x8c10('0x9f'),_0x8c10('0x1e'));_0x577412[_0x8c10('0x1d')](_0x318594[_0x8c10('0x1d')]||_0x2b8e31);_0x577412[_0x8c10('0x1b')](_0x318594[_0x8c10('0x1b')]||0x0);return dbH[_0x8c10('0x83')][_0x8c10('0x33')](_0x1f9192['toString'](),{'type':dbH['sequelize'][_0x8c10('0x84')][_0x8c10('0x85')]})[_0x8c10('0x26')](function(_0x475374){if(!_0x475374[_0x8c10('0x38')]){_0x4115b3=0x0;}else{_0x4115b3=_0x475374[0x0][_0x8c10('0x1e')]||0x0;}return dbH[_0x8c10('0x83')][_0x8c10('0x33')](_0x577412[_0x8c10('0x82')](),{'type':dbH[_0x8c10('0x83')][_0x8c10('0x84')][_0x8c10('0x85')]});})[_0x8c10('0x26')](function(_0x152e45){return{'rows':_0x152e45||[],'count':_0x4115b3};});}});}exports[_0x8c10('0xa0')]=function(_0x4d4e7b,_0x33810f){return runReport(_0x4d4e7b[_0x8c10('0x48')],_0x4d4e7b[_0x8c10('0x33')],_0x4d4e7b[_0x8c10('0x42')])[_0x8c10('0x26')](respondWithResult(_0x33810f,null))[_0x8c10('0x46')](handleError(_0x33810f,null));};exports[_0x8c10('0xa1')]=runReport;exports['query']=function(_0xc4c112,_0x5a0427){var _0x1ff8f5=0xa;var _0x13e8d8=[_0x8c10('0x55'),_0x8c10('0x56'),_0x8c10('0x57'),'cross_join'];var _0x23edd0={'SUM':_0x8c10('0x58'),'COUNT':_0x8c10('0x87'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x8c10('0xa2'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x8c10('0x5b'),'GROUP_CONCAT ASC':_0x8c10('0x5c'),'GROUP_CONCAT DESC':_0x8c10('0x5d')};var _0x5e76fd={'SEC_TO_TIME':_0x8c10('0x5e'),'DATE':'DATE(%s)','HOUR':_0x8c10('0x60'),'ROUND':_0x8c10('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x404991=function(_0x3e06c2){return!_[_0x8c10('0x63')]([_0x8c10('0x64'),_0x8c10('0x65'),_0x8c10('0x66'),'IS\x20NOT\x20EMPTY'],_0x3e06c2);};var _0x19ab46=function(_0x5a5aba){if(!_0x5a5aba||!_0x5a5aba[_0x8c10('0x67')][_0x8c10('0x38')]){return'';}for(var _0x9c3ddd='(',_0x5ef054=0x0;_0x5ef054<_0x5a5aba[_0x8c10('0x67')][_0x8c10('0x38')];_0x5ef054+=0x1){_0x5ef054>0x0&&(_0x9c3ddd+='\x20'+_0x5a5aba['operator']+'\x20');_0x9c3ddd+=_0x5a5aba[_0x8c10('0x67')][_0x5ef054]['group']?_0x19ab46(_0x5a5aba[_0x8c10('0x67')][_0x5ef054]['group']):_0x5a5aba[_0x8c10('0x67')][_0x5ef054][_0x8c10('0x69')]+'\x20'+_0x5a5aba[_0x8c10('0x67')][_0x5ef054]['condition']+(_0x404991(_0x5a5aba[_0x8c10('0x67')][_0x5ef054][_0x8c10('0x6a')])?'\x20'+_0x5a5aba[_0x8c10('0x67')][_0x5ef054]['value']:'');}return _0x9c3ddd+')';};var _0x4442fc={'where':{'id':_0xc4c112[_0x8c10('0x48')]['id']}},_0x439581,_0x19fc4c,_0x4dcfa9,_0x19138d,_0x4d80ed;_0x4442fc=_[_0x8c10('0x49')]({},_0x4442fc,_0xc4c112[_0x8c10('0x42')]);return db[_0x8c10('0x2d')]['find'](_0x4442fc)[_0x8c10('0x26')](function(_0x37e8b0){if(_0x37e8b0){_0x439581=_0x37e8b0;return _0x37e8b0[_0x8c10('0x8b')]();}return null;})['then'](function(_0x420a3d){if(_0x420a3d){if(!_0x420a3d['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x8c10('0x6d'),0x193);}_0x19fc4c=_0x420a3d;return db['AnalyticMetric'][_0x8c10('0x8c')]({'raw':!![]});}return null;})[_0x8c10('0x26')](function(_0x32fec2){if(_0x32fec2){_0x4dcfa9=_[_0x8c10('0xa3')](_0x32fec2,'id');var _0xb65b33;var _0x3ac573=squel[_0x8c10('0x6f')]();_0x3ac573[_0x8c10('0x9d')](_0x439581[_0x8c10('0x70')]);for(var _0x4244f0=0x0;_0x4244f0<_0x19fc4c['length'];_0x4244f0+=0x1){_0xb65b33=_0x19fc4c[_0x4244f0][_0x8c10('0x71')]?_0x4dcfa9[_0x19fc4c[_0x4244f0][_0x8c10('0x71')]]['metric']:_0x19fc4c[_0x4244f0]['field'];_0xb65b33=_0x19fc4c[_0x4244f0][_0x8c10('0x72')]?_['replace'](_0x23edd0[_0x19fc4c[_0x4244f0][_0x8c10('0x72')]],'%s',_0xb65b33):_0xb65b33;_0xb65b33=_0x19fc4c[_0x4244f0][_0x8c10('0x74')]?_[_0x8c10('0x73')](_0x5e76fd[_0x19fc4c[_0x4244f0][_0x8c10('0x74')]],'%s',_0xb65b33):_0xb65b33;if(_0x19fc4c[_0x4244f0][_0x8c10('0x75')]){_0x3ac573['group'](_0xb65b33);}_0x19fc4c[_0x4244f0][_0x8c10('0x76')]&&_0x3ac573['order'](_0xb65b33,_0x19fc4c[_0x4244f0][_0x8c10('0x76')]===_0x8c10('0xa4')?![]:!![]);_0x3ac573[_0x8c10('0x69')](_0xb65b33,_0x19fc4c[_0x4244f0][_0x8c10('0x78')]||_0xb65b33);}if(_0x439581[_0x8c10('0x79')]){_0x439581[_0x8c10('0x79')]=JSON[_0x8c10('0x7f')](_0x439581[_0x8c10('0x79')]);for(var _0x1ff9ed=0x0;_0x1ff9ed<_0x439581['joins']['length'];_0x1ff9ed+=0x1){if(_0x439581[_0x8c10('0x79')][_0x1ff9ed][_0x8c10('0x40')]&&_[_0x8c10('0x63')](_0x13e8d8,_0x439581[_0x8c10('0x79')][_0x1ff9ed][_0x8c10('0x40')])&&_0x439581[_0x8c10('0x79')][_0x1ff9ed][_0x8c10('0x7a')]&&_0x439581['joins'][_0x1ff9ed][_0x8c10('0x7b')]&&_0x439581['joins'][_0x1ff9ed][_0x8c10('0x7c')]){_0x3ac573[_0x439581[_0x8c10('0x79')][_0x1ff9ed][_0x8c10('0x40')]](_0x439581[_0x8c10('0x79')][_0x1ff9ed]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x439581[_0x8c10('0x70')],_0x439581[_0x8c10('0x79')][_0x1ff9ed][_0x8c10('0x7a')],_0x439581[_0x8c10('0x79')][_0x1ff9ed][_0x8c10('0x7b')],_0x439581['joins'][_0x1ff9ed][_0x8c10('0x7c')]));}}}if(_0x439581[_0x8c10('0x7e')]){_0x439581[_0x8c10('0x7e')]=JSON[_0x8c10('0x7f')](_0x439581[_0x8c10('0x7e')]);_0x3ac573[_0x8c10('0x3f')](_0x19ab46(_0x439581[_0x8c10('0x7e')][_0x8c10('0x68')]));}_0x4d80ed=_0x3ac573[_0x8c10('0x8e')]();_0x3ac573[_0x8c10('0x1d')](_0x1ff8f5);_0x3ac573[_0x8c10('0x1b')](0x0);logger[_0x8c10('0x80')]('Limited\x20Query:',_0x3ac573['toString']());return dbH[_0x8c10('0x83')][_0x8c10('0x33')](_0x3ac573[_0x8c10('0x82')](),{'type':dbH[_0x8c10('0x83')]['QueryTypes'][_0x8c10('0x85')]});}})[_0x8c10('0x26')](function(){return{'sql':_0x4d80ed[_0x8c10('0x82')]()};})[_0x8c10('0x26')](respondWithResult(_0x5a0427,null))[_0x8c10('0x46')](handleError(_0x5a0427,null));}; \ No newline at end of file +var _0x31a5=['Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','condition','value','from','metric','field','parentKey','output','web','fullPath','%s-%s.%s','randomstring','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','QueryTypes','run','runReport','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','CustomReports','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','AnalyticCustomReport','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','getFields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31a5,0x186));var _0x531a=function(_0x2044ba,_0x1ebab8){_0x2044ba=_0x2044ba-0x0;var _0x2fa276=_0x31a5[_0x2044ba];return _0x2fa276;};'use strict';var emlformat=require(_0x531a('0x0'));var rimraf=require(_0x531a('0x1'));var zipdir=require(_0x531a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x531a('0x3'));var moment=require(_0x531a('0x4'));var BPromise=require(_0x531a('0x5'));var Mustache=require(_0x531a('0x6'));var util=require(_0x531a('0x7'));var path=require(_0x531a('0x8'));var sox=require(_0x531a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x531a('0xa'));var _=require(_0x531a('0xb'));var squel=require(_0x531a('0xc'));var crypto=require('crypto');var jsforce=require(_0x531a('0xd'));var deskjs=require(_0x531a('0xe'));var toCsv=require(_0x531a('0xf'));var querystring=require(_0x531a('0x10'));var Papa=require(_0x531a('0x11'));var Redis=require(_0x531a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x531a('0x13'));var as=require(_0x531a('0x14'));var hardwareService=require(_0x531a('0x15'));var logger=require(_0x531a('0x16'))(_0x531a('0x17'));var utils=require(_0x531a('0x18'));var config=require(_0x531a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x531a('0x1a'))['db'];var dbH=require('../../mysqldb')[_0x531a('0x1b')];function respondWithStatusCode(_0x4930d6,_0x379c7f){_0x379c7f=_0x379c7f||0xcc;return function(_0x485bd3){if(_0x485bd3){return _0x4930d6[_0x531a('0x1c')](_0x379c7f);}return _0x4930d6[_0x531a('0x1d')](_0x379c7f)['end']();};}function respondWithResult(_0x1e8949,_0x5ead7e){_0x5ead7e=_0x5ead7e||0xc8;return function(_0x244ee4){if(_0x244ee4){return _0x1e8949[_0x531a('0x1d')](_0x5ead7e)[_0x531a('0x1e')](_0x244ee4);}};}function respondWithFilteredResult(_0x13e0e5,_0xda4fcd){return function(_0x2905be){if(_0x2905be){var _0x1423d5=typeof _0xda4fcd[_0x531a('0x1f')]===_0x531a('0x20')&&typeof _0xda4fcd[_0x531a('0x21')]===_0x531a('0x20');var _0x43ebfd=_0x2905be[_0x531a('0x22')];var _0x53de84=_0x1423d5?0x0:_0xda4fcd[_0x531a('0x1f')];var _0x287410=_0x1423d5?_0x2905be[_0x531a('0x22')]:_0xda4fcd[_0x531a('0x1f')]+_0xda4fcd['limit'];var _0x57b9fe;if(_0x287410>=_0x43ebfd){_0x287410=_0x43ebfd;_0x57b9fe=0xc8;}else{_0x57b9fe=0xce;}_0x13e0e5['status'](_0x57b9fe);return _0x13e0e5[_0x531a('0x23')]('Content-Range',_0x53de84+'-'+_0x287410+'/'+_0x43ebfd)['json'](_0x2905be);}return null;};}function patchUpdates(_0x24ad78){return function(_0x23a34f){try{jsonpatch[_0x531a('0x24')](_0x23a34f,_0x24ad78,!![]);}catch(_0x26beea){return BPromise[_0x531a('0x25')](_0x26beea);}return _0x23a34f[_0x531a('0x26')]();};}function saveUpdates(_0x28e872,_0x308417){return function(_0x4f4888){if(_0x4f4888){return _0x4f4888['update'](_0x28e872)[_0x531a('0x27')](function(_0x58f9d1){return _0x58f9d1;});}return null;};}function removeEntity(_0x5e984d,_0x3e6db3){return function(_0xa0d3b9){if(_0xa0d3b9){return _0xa0d3b9['destroy']()[_0x531a('0x27')](function(){var _0x233882=_0xa0d3b9['get']({'plain':!![]});var _0x2b6e32=_0x531a('0x28');return db[_0x531a('0x29')][_0x531a('0x2a')]({'where':{'type':_0x2b6e32,'resourceId':_0x233882['id']}})['then'](function(){return _0xa0d3b9;});})[_0x531a('0x27')](function(){_0x5e984d[_0x531a('0x1d')](0xcc)[_0x531a('0x2b')]();});}};}function handleEntityNotFound(_0x59ec64,_0xb363ef){return function(_0x143e48){if(!_0x143e48){_0x59ec64[_0x531a('0x1c')](0x194);}return _0x143e48;};}function handleError(_0x3da027,_0x5cbab4){_0x5cbab4=_0x5cbab4||0x1f4;return function(_0x2def8b){logger[_0x531a('0x2c')](_0x2def8b[_0x531a('0x2d')]);if(_0x2def8b[_0x531a('0x2e')]){delete _0x2def8b['name'];}_0x3da027['status'](_0x5cbab4)[_0x531a('0x2f')](_0x2def8b);};}exports[_0x531a('0x30')]=function(_0x5c852d,_0x11edad){var _0x2ec1cf={},_0x4c4b8c={},_0x541b2d={'count':0x0,'rows':[]};var _0x16e6c1=_[_0x531a('0x31')](db['AnalyticCustomReport'][_0x531a('0x32')],function(_0x1ad8c0){return{'name':_0x1ad8c0[_0x531a('0x33')],'type':_0x1ad8c0[_0x531a('0x34')]['key']};});_0x4c4b8c[_0x531a('0x35')]=_['map'](_0x16e6c1,'name');_0x4c4b8c[_0x531a('0x36')]=_[_0x531a('0x37')](_0x5c852d[_0x531a('0x36')]);_0x4c4b8c[_0x531a('0x38')]=_[_0x531a('0x39')](_0x4c4b8c[_0x531a('0x35')],_0x4c4b8c[_0x531a('0x36')]);_0x2ec1cf[_0x531a('0x3a')]=_[_0x531a('0x39')](_0x4c4b8c['model'],qs[_0x531a('0x3b')](_0x5c852d[_0x531a('0x36')]['fields']));_0x2ec1cf['attributes']=_0x2ec1cf[_0x531a('0x3a')][_0x531a('0x3c')]?_0x2ec1cf[_0x531a('0x3a')]:_0x4c4b8c['model'];if(!_0x5c852d[_0x531a('0x36')]['hasOwnProperty']('nolimit')){_0x2ec1cf[_0x531a('0x21')]=qs[_0x531a('0x21')](_0x5c852d['query']['limit']);_0x2ec1cf[_0x531a('0x1f')]=qs['offset'](_0x5c852d['query']['offset']);}_0x2ec1cf[_0x531a('0x3d')]=qs[_0x531a('0x3e')](_0x5c852d['query']['sort']);_0x2ec1cf['where']=qs['filters'](_['pick'](_0x5c852d[_0x531a('0x36')],_0x4c4b8c[_0x531a('0x38')]),_0x16e6c1);if(_0x5c852d[_0x531a('0x36')]['filter']){_0x2ec1cf[_0x531a('0x3f')]=_['merge'](_0x2ec1cf[_0x531a('0x3f')],{'$or':_[_0x531a('0x31')](_0x16e6c1,function(_0x4dd6e3){if(_0x4dd6e3[_0x531a('0x34')]!==_0x531a('0x40')){var _0x5278c8={};_0x5278c8[_0x4dd6e3[_0x531a('0x2e')]]={'$like':'%'+_0x5c852d[_0x531a('0x36')]['filter']+'%'};return _0x5278c8;}})});}_0x2ec1cf=_[_0x531a('0x41')]({},_0x2ec1cf,_0x5c852d[_0x531a('0x42')]);var _0x3e7442={'where':_0x2ec1cf[_0x531a('0x3f')]};return db['AnalyticCustomReport'][_0x531a('0x22')](_0x3e7442)[_0x531a('0x27')](function(_0x49e146){_0x541b2d[_0x531a('0x22')]=_0x49e146;if(_0x5c852d[_0x531a('0x36')][_0x531a('0x43')]){_0x2ec1cf[_0x531a('0x44')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x531a('0x45')](_0x2ec1cf);})[_0x531a('0x27')](function(_0x586f37){_0x541b2d[_0x531a('0x46')]=_0x586f37;return _0x541b2d;})[_0x531a('0x27')](respondWithFilteredResult(_0x11edad,_0x2ec1cf))['catch'](handleError(_0x11edad,null));};exports[_0x531a('0x47')]=function(_0x3d2e0c,_0x29b8db){var _0x2643bc={'raw':![],'where':{'id':_0x3d2e0c[_0x531a('0x48')]['id']}},_0x1b67b5={};_0x1b67b5[_0x531a('0x35')]=_['keys'](db['AnalyticCustomReport']['rawAttributes']);_0x1b67b5[_0x531a('0x36')]=_[_0x531a('0x37')](_0x3d2e0c['query']);_0x1b67b5[_0x531a('0x38')]=_['intersection'](_0x1b67b5['model'],_0x1b67b5[_0x531a('0x36')]);_0x2643bc[_0x531a('0x3a')]=_[_0x531a('0x39')](_0x1b67b5[_0x531a('0x35')],qs[_0x531a('0x3b')](_0x3d2e0c['query']['fields']));_0x2643bc[_0x531a('0x3a')]=_0x2643bc[_0x531a('0x3a')][_0x531a('0x3c')]?_0x2643bc[_0x531a('0x3a')]:_0x1b67b5[_0x531a('0x35')];if(_0x3d2e0c['query'][_0x531a('0x43')]){_0x2643bc['include']=[{'all':!![]}];}_0x2643bc=_[_0x531a('0x41')]({},_0x2643bc,_0x3d2e0c['options']);return db[_0x531a('0x49')][_0x531a('0x4a')](_0x2643bc)[_0x531a('0x27')](handleEntityNotFound(_0x29b8db,null))[_0x531a('0x27')](respondWithResult(_0x29b8db,null))[_0x531a('0x4b')](handleError(_0x29b8db,null));};exports[_0x531a('0x4c')]=function(_0x1fa1ed,_0x3ee842){return db[_0x531a('0x49')][_0x531a('0x4c')](_0x1fa1ed[_0x531a('0x4d')],{})[_0x531a('0x27')](function(_0x40c4e1){var _0x54a852=_0x1fa1ed[_0x531a('0x4e')][_0x531a('0x4f')]({'plain':!![]});if(!_0x54a852)throw new Error(_0x531a('0x50'));if(_0x54a852['role']===_0x531a('0x4e')){var _0x42a782=_0x40c4e1[_0x531a('0x4f')]({'plain':!![]});var _0x5cbf88=_0x531a('0x51');return db['UserProfileSection'][_0x531a('0x4a')]({'where':{'name':_0x5cbf88,'userProfileId':_0x54a852['userProfileId']},'raw':!![]})[_0x531a('0x27')](function(_0x140eb2){if(_0x140eb2&&_0x140eb2[_0x531a('0x52')]===0x0){return db[_0x531a('0x29')][_0x531a('0x4c')]({'name':_0x42a782['name'],'resourceId':_0x42a782['id'],'type':_0x531a('0x28'),'sectionId':_0x140eb2['id']},{})['then'](function(){return _0x40c4e1;});}else{return _0x40c4e1;}})[_0x531a('0x4b')](function(_0x5d1a29){logger['error'](_0x531a('0x53'),_0x5d1a29);throw _0x5d1a29;});}return _0x40c4e1;})[_0x531a('0x27')](respondWithResult(_0x3ee842,0xc9))[_0x531a('0x4b')](handleError(_0x3ee842,null));};exports['update']=function(_0x2aeb94,_0x2fbbb9){if(_0x2aeb94['body']['id']){delete _0x2aeb94['body']['id'];}return db[_0x531a('0x49')][_0x531a('0x4a')]({'where':{'id':_0x2aeb94[_0x531a('0x48')]['id']}})['then'](handleEntityNotFound(_0x2fbbb9,null))[_0x531a('0x27')](saveUpdates(_0x2aeb94[_0x531a('0x4d')],null))[_0x531a('0x27')](respondWithResult(_0x2fbbb9,null))[_0x531a('0x4b')](handleError(_0x2fbbb9,null));};exports['destroy']=function(_0x2fe058,_0x197441){return db['AnalyticCustomReport'][_0x531a('0x4a')]({'where':{'id':_0x2fe058[_0x531a('0x48')]['id']}})[_0x531a('0x27')](handleEntityNotFound(_0x197441,null))[_0x531a('0x27')](removeEntity(_0x197441,null))['catch'](handleError(_0x197441,null));};exports[_0x531a('0x54')]=function(_0x22a4e1,_0x326af0){var _0x64c79d=0xa;var _0x149b7a=[_0x531a('0x55'),_0x531a('0x56'),_0x531a('0x57'),_0x531a('0x58')];var _0x12868f={'SUM':_0x531a('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x531a('0x5a'),'MAX':_0x531a('0x5b'),'MIN':_0x531a('0x5c'),'AVG':_0x531a('0x5d'),'GROUP_CONCAT':_0x531a('0x5e'),'GROUP_CONCAT ASC':_0x531a('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x27c3a1={'SEC_TO_TIME':_0x531a('0x60'),'DATE':_0x531a('0x61'),'HOUR':_0x531a('0x62'),'ROUND':_0x531a('0x63'),'UNIX_TIMESTAMP':_0x531a('0x64')};var _0x4c7536=function(_0x2dfefb){return!_[_0x531a('0x65')]([_0x531a('0x66'),'IS\x20NOT\x20NULL',_0x531a('0x67'),'IS\x20NOT\x20EMPTY'],_0x2dfefb);};var _0xf60a4=function(_0x108dc6){if(!_0x108dc6||!_0x108dc6[_0x531a('0x68')]['length']){return'';}for(var _0x71153a='(',_0x383606=0x0;_0x383606<_0x108dc6['rules'][_0x531a('0x3c')];_0x383606+=0x1){_0x383606>0x0&&(_0x71153a+='\x20'+_0x108dc6[_0x531a('0x69')]+'\x20');_0x71153a+=_0x108dc6[_0x531a('0x68')][_0x383606][_0x531a('0x6a')]?_0xf60a4(_0x108dc6[_0x531a('0x68')][_0x383606][_0x531a('0x6a')]):_0x108dc6[_0x531a('0x68')][_0x383606]['field']+'\x20'+_0x108dc6[_0x531a('0x68')][_0x383606]['condition']+(_0x4c7536(_0x108dc6[_0x531a('0x68')][_0x383606]['condition'])?'\x20'+_0x108dc6[_0x531a('0x68')][_0x383606]['value']:'');}return _0x71153a+')';};var _0x361fbf={'where':{'id':_0x22a4e1[_0x531a('0x48')]['id']}},_0x17cc8e,_0x5e0afc,_0x47a051,_0x33cb5a,_0x5ac4dc;_0x361fbf=_[_0x531a('0x41')]({},_0x361fbf,_0x22a4e1[_0x531a('0x42')]);return db[_0x531a('0x49')][_0x531a('0x4a')](_0x361fbf)[_0x531a('0x27')](function(_0x8e202f){if(_0x8e202f){_0x17cc8e=_0x8e202f;return _0x8e202f[_0x531a('0x6b')]();}return null;})[_0x531a('0x27')](function(_0x38a1c6){if(_0x38a1c6){if(!_0x38a1c6['length']){throw new db[(_0x531a('0x6c'))][(_0x531a('0x6d'))](_0x531a('0x6e'),0x193);}_0x5e0afc=_0x38a1c6;return db[_0x531a('0x6f')][_0x531a('0x45')]({'raw':!![]});}return null;})[_0x531a('0x27')](function(_0x3c48b0){if(_0x3c48b0){_0x47a051=_[_0x531a('0x70')](_0x3c48b0,'id');var _0x37db94;var _0x406513=squel[_0x531a('0x71')]();_0x406513['from'](_0x17cc8e['table']);for(var _0x13ddff=0x0;_0x13ddff<_0x5e0afc[_0x531a('0x3c')];_0x13ddff+=0x1){_0x37db94=_0x5e0afc[_0x13ddff][_0x531a('0x72')]?_0x47a051[_0x5e0afc[_0x13ddff][_0x531a('0x72')]]['metric']:_0x5e0afc[_0x13ddff]['field'];_0x37db94=_0x5e0afc[_0x13ddff][_0x531a('0x73')]?_[_0x531a('0x74')](_0x12868f[_0x5e0afc[_0x13ddff]['function']],'%s',_0x37db94):_0x37db94;_0x37db94=_0x5e0afc[_0x13ddff][_0x531a('0x75')]?_[_0x531a('0x74')](_0x27c3a1[_0x5e0afc[_0x13ddff][_0x531a('0x75')]],'%s',_0x37db94):_0x37db94;if(_0x5e0afc[_0x13ddff][_0x531a('0x76')]){_0x406513[_0x531a('0x6a')](_0x37db94);}_0x5e0afc[_0x13ddff][_0x531a('0x77')]&&_0x406513['order'](_0x37db94,_0x5e0afc[_0x13ddff][_0x531a('0x77')]===_0x531a('0x78')?![]:!![]);_0x406513['field'](_0x37db94,_0x5e0afc[_0x13ddff][_0x531a('0x79')]||_0x37db94);}if(_0x17cc8e[_0x531a('0x7a')]){_0x17cc8e['joins']=JSON[_0x531a('0x7b')](_0x17cc8e[_0x531a('0x7a')]);for(var _0x120a26=0x0;_0x120a26<_0x17cc8e[_0x531a('0x7a')][_0x531a('0x3c')];_0x120a26+=0x1){if(_0x17cc8e[_0x531a('0x7a')][_0x120a26][_0x531a('0x34')]&&_[_0x531a('0x65')](_0x149b7a,_0x17cc8e[_0x531a('0x7a')][_0x120a26][_0x531a('0x34')])&&_0x17cc8e[_0x531a('0x7a')][_0x120a26]['parentKey']&&_0x17cc8e[_0x531a('0x7a')][_0x120a26][_0x531a('0x7c')]&&_0x17cc8e[_0x531a('0x7a')][_0x120a26][_0x531a('0x7d')]){_0x406513[_0x17cc8e[_0x531a('0x7a')][_0x120a26]['type']](_0x17cc8e['joins'][_0x120a26]['foreignTable'],null,util['format'](_0x531a('0x7e'),_0x17cc8e[_0x531a('0x7f')],_0x17cc8e[_0x531a('0x7a')][_0x120a26]['parentKey'],_0x17cc8e[_0x531a('0x7a')][_0x120a26][_0x531a('0x7c')],_0x17cc8e[_0x531a('0x7a')][_0x120a26]['foreignKey']));}}}if(_0x17cc8e[_0x531a('0x80')]){_0x17cc8e[_0x531a('0x80')]=JSON[_0x531a('0x7b')](_0x17cc8e[_0x531a('0x80')]);_0x406513[_0x531a('0x3f')](_0xf60a4(_0x17cc8e['conditions'][_0x531a('0x6a')]));}_0x5ac4dc=_0x406513[_0x531a('0x81')]();_0x406513[_0x531a('0x21')](_0x64c79d);_0x406513['offset'](0x0);logger[_0x531a('0x82')](_0x531a('0x83'),_0x406513[_0x531a('0x84')]());return dbH['sequelize']['query'](_0x406513[_0x531a('0x84')](),{'type':dbH[_0x531a('0x85')]['QueryTypes'][_0x531a('0x86')]});}})['then'](respondWithResult(_0x326af0,null))['catch'](handleError(_0x326af0,null));};function runReport(_0x4e4dbe,_0x3ae83b,_0x2c2832){var _0x52b266=_0x3ae83b[_0x531a('0x2e')];var _0x436364=0xa;var _0x53bcda=[_0x531a('0x55'),_0x531a('0x56'),_0x531a('0x57'),'cross_join'];var _0x540c15={'SUM':_0x531a('0x59'),'COUNT':_0x531a('0x87'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x531a('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x531a('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x531a('0x88')};var _0x35fc1a={'SEC_TO_TIME':_0x531a('0x60'),'DATE':_0x531a('0x61'),'HOUR':_0x531a('0x62'),'ROUND':_0x531a('0x63'),'UNIX_TIMESTAMP':_0x531a('0x64')};var _0x2ba3ff=function(_0x3c2f8a){return!_['includes']([_0x531a('0x66'),_0x531a('0x89'),_0x531a('0x67'),_0x531a('0x8a')],_0x3c2f8a);};var _0x2699ce=function(_0x30ad36){if(!_0x30ad36||!_0x30ad36[_0x531a('0x68')][_0x531a('0x3c')]){return'';}for(var _0x19bd0f='(',_0x4e5bed=0x0;_0x4e5bed<_0x30ad36[_0x531a('0x68')][_0x531a('0x3c')];_0x4e5bed+=0x1){_0x4e5bed>0x0&&(_0x19bd0f+='\x20'+_0x30ad36[_0x531a('0x69')]+'\x20');_0x19bd0f+=_0x30ad36['rules'][_0x4e5bed][_0x531a('0x6a')]?_0x2699ce(_0x30ad36[_0x531a('0x68')][_0x4e5bed][_0x531a('0x6a')]):_0x30ad36['rules'][_0x4e5bed]['field']+'\x20'+_0x30ad36[_0x531a('0x68')][_0x4e5bed][_0x531a('0x8b')]+(_0x2ba3ff(_0x30ad36['rules'][_0x4e5bed][_0x531a('0x8b')])?'\x20'+_0x30ad36['rules'][_0x4e5bed][_0x531a('0x8c')]:'');}return _0x19bd0f+')';};var _0x19a9d3={'where':{'id':_0x4e4dbe['id']}},_0x3062fc,_0x3bfe6f,_0x57fc5,_0x5d7398,_0x5c5c7a;_0x19a9d3=_['merge']({},_0x19a9d3,_0x2c2832);return db[_0x531a('0x49')][_0x531a('0x4a')](_0x19a9d3)[_0x531a('0x27')](function(_0xc1047c){if(_0xc1047c){_0x3062fc=_0xc1047c;return _0xc1047c[_0x531a('0x6b')]();}return null;})[_0x531a('0x27')](function(_0x530189){if(_0x530189){if(!_0x530189['length']){throw new db[(_0x531a('0x6c'))][(_0x531a('0x6d'))](_0x531a('0x6e'),0x193);}_0x3bfe6f=_0x530189;return db['AnalyticMetric'][_0x531a('0x45')]({'raw':!![]});}return null;})['then'](function(_0x316189){if(_0x316189){_0x57fc5=_[_0x531a('0x70')](_0x316189,'id');var _0x52163b;var _0x1c4c3a=squel[_0x531a('0x71')]();_0x1c4c3a[_0x531a('0x8d')](_0x3062fc[_0x531a('0x7f')]);for(var _0x1bf37e=0x0;_0x1bf37e<_0x3bfe6f[_0x531a('0x3c')];_0x1bf37e+=0x1){_0x52163b=_0x3bfe6f[_0x1bf37e][_0x531a('0x72')]?_0x57fc5[_0x3bfe6f[_0x1bf37e]['MetricId']][_0x531a('0x8e')]:_0x3bfe6f[_0x1bf37e][_0x531a('0x8f')];_0x52163b=_0x3bfe6f[_0x1bf37e][_0x531a('0x73')]?_[_0x531a('0x74')](_0x540c15[_0x3bfe6f[_0x1bf37e]['function']],'%s',_0x52163b):_0x52163b;_0x52163b=_0x3bfe6f[_0x1bf37e][_0x531a('0x75')]?_[_0x531a('0x74')](_0x35fc1a[_0x3bfe6f[_0x1bf37e][_0x531a('0x75')]],'%s',_0x52163b):_0x52163b;if(_0x3bfe6f[_0x1bf37e]['groupBy']){_0x1c4c3a[_0x531a('0x6a')](_0x52163b);}_0x3bfe6f[_0x1bf37e][_0x531a('0x77')]&&_0x1c4c3a[_0x531a('0x3d')](_0x52163b,_0x3bfe6f[_0x1bf37e][_0x531a('0x77')]===_0x531a('0x78')?![]:!![]);_0x1c4c3a[_0x531a('0x8f')](_0x52163b,_0x3bfe6f[_0x1bf37e]['alias']||_0x52163b);}if(_0x3062fc[_0x531a('0x7a')]){_0x3062fc[_0x531a('0x7a')]=JSON['parse'](_0x3062fc[_0x531a('0x7a')]);for(var _0x431b3b=0x0;_0x431b3b<_0x3062fc[_0x531a('0x7a')]['length'];_0x431b3b+=0x1){if(_0x3062fc[_0x531a('0x7a')][_0x431b3b]['type']&&_[_0x531a('0x65')](_0x53bcda,_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x34')])&&_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x90')]&&_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x7c')]&&_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x7d')]){_0x1c4c3a[_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x34')]](_0x3062fc['joins'][_0x431b3b][_0x531a('0x7c')],null,util[_0x531a('0x75')](_0x531a('0x7e'),_0x3062fc[_0x531a('0x7f')],_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x90')],_0x3062fc[_0x531a('0x7a')][_0x431b3b]['foreignTable'],_0x3062fc[_0x531a('0x7a')][_0x431b3b][_0x531a('0x7d')]));}}}if(_0x3062fc[_0x531a('0x80')]){_0x3062fc[_0x531a('0x80')]=JSON['parse'](_0x3062fc[_0x531a('0x80')]);_0x1c4c3a[_0x531a('0x3f')](_0x2699ce(_0x3062fc[_0x531a('0x80')]['group']));}_0x5c5c7a=_0x1c4c3a[_0x531a('0x81')]();_0x1c4c3a['limit'](_0x436364);_0x1c4c3a['offset'](0x0);return;}})[_0x531a('0x27')](function(){if(_0x3ae83b[_0x531a('0x91')]===_0x531a('0x92')){return null;}var _0x1221ad=_[_0x531a('0x41')](_0x3ae83b,{'name':_0x3ae83b[_0x531a('0x93')]||_0x3ae83b[_0x531a('0x2e')]||_0x3062fc['name'],'basename':_0x52b266,'savename':util[_0x531a('0x75')](_0x531a('0x94'),_0x3ae83b['name']||_0x3062fc[_0x531a('0x2e')],require(_0x531a('0x95'))['generate'](0x4),_0x3ae83b[_0x531a('0x91')]||'csv'),'reportId':_0x3062fc['id'],'reportType':_0x531a('0x96')});return db['AnalyticExtractedReport']['create'](_0x1221ad,{'raw':!![]});})[_0x531a('0x27')](function(_0x56daf3){if(_0x3062fc['table']===_0x531a('0x97')){_0x5c5c7a['where'](_0x3062fc[_0x531a('0x7f')]+_0x531a('0x98'),_0x3ae83b[_0x531a('0x99')],_0x3ae83b[_0x531a('0x9a')]);}else{_0x5c5c7a[_0x531a('0x3f')](_0x3062fc[_0x531a('0x7f')]+_0x531a('0x9b'),_0x3ae83b['startDate'],_0x3ae83b[_0x531a('0x9a')]);}if(_0x56daf3){logger[_0x531a('0x9c')]('Run\x20Query:',_0x5c5c7a[_0x531a('0x84')]());require(_0x531a('0x9d'))[_0x531a('0x9e')](path[_0x531a('0x55')](__dirname,_0x531a('0x9f'),_0x56daf3[_0x531a('0x91')]),[_0x56daf3['id'],_0x5c5c7a[_0x531a('0x84')](),path['join'](__dirname,_0x531a('0xa0'),_0x56daf3[_0x531a('0xa1')]),_0x52b266]);return _0x56daf3;}else{var _0x255265=squel[_0x531a('0x71')]();_0x255265['from']('('+_0x5c5c7a[_0x531a('0x84')]()+')','countTable');_0x255265['field'](_0x531a('0xa2'),_0x531a('0x22'));_0x5c5c7a[_0x531a('0x21')](_0x3ae83b[_0x531a('0x21')]||_0x436364);_0x5c5c7a[_0x531a('0x1f')](_0x3ae83b['offset']||0x0);return dbH[_0x531a('0x85')][_0x531a('0x36')](_0x255265['toString'](),{'type':dbH[_0x531a('0x85')][_0x531a('0xa3')][_0x531a('0x86')]})[_0x531a('0x27')](function(_0x56e5be){if(!_0x56e5be[_0x531a('0x3c')]){_0x5d7398=0x0;}else{_0x5d7398=_0x56e5be[0x0][_0x531a('0x22')]||0x0;}return dbH['sequelize'][_0x531a('0x36')](_0x5c5c7a[_0x531a('0x84')](),{'type':dbH['sequelize'][_0x531a('0xa3')][_0x531a('0x86')]});})[_0x531a('0x27')](function(_0x5b977f){return{'rows':_0x5b977f||[],'count':_0x5d7398};});}});}exports[_0x531a('0xa4')]=function(_0x328eed,_0x32ac85){return runReport(_0x328eed[_0x531a('0x48')],_0x328eed[_0x531a('0x36')],_0x328eed[_0x531a('0x42')])[_0x531a('0x27')](respondWithResult(_0x32ac85,null))[_0x531a('0x4b')](handleError(_0x32ac85,null));};exports[_0x531a('0xa5')]=runReport;exports['query']=function(_0xe46a8b,_0x3791c1){var _0x388ded=0xa;var _0x2977ee=[_0x531a('0x55'),_0x531a('0x56'),_0x531a('0x57'),_0x531a('0x58')];var _0x4b6077={'SUM':_0x531a('0x59'),'COUNT':_0x531a('0x87'),'COUNT DISTINCT':_0x531a('0x5a'),'MAX':'MAX(%s)','MIN':_0x531a('0x5c'),'AVG':_0x531a('0x5d'),'GROUP_CONCAT':_0x531a('0x5e'),'GROUP_CONCAT ASC':_0x531a('0x5f'),'GROUP_CONCAT DESC':_0x531a('0x88')};var _0x4e115d={'SEC_TO_TIME':_0x531a('0x60'),'DATE':'DATE(%s)','HOUR':_0x531a('0x62'),'ROUND':_0x531a('0x63'),'UNIX_TIMESTAMP':_0x531a('0x64')};var _0x3c705f=function(_0x4cc764){return!_[_0x531a('0x65')](['IS\x20NULL',_0x531a('0x89'),_0x531a('0x67'),_0x531a('0x8a')],_0x4cc764);};var _0x44d608=function(_0x3846d1){if(!_0x3846d1||!_0x3846d1[_0x531a('0x68')][_0x531a('0x3c')]){return'';}for(var _0x3da266='(',_0x4a8c2a=0x0;_0x4a8c2a<_0x3846d1['rules'][_0x531a('0x3c')];_0x4a8c2a+=0x1){_0x4a8c2a>0x0&&(_0x3da266+='\x20'+_0x3846d1[_0x531a('0x69')]+'\x20');_0x3da266+=_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x6a')]?_0x44d608(_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x6a')]):_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x8f')]+'\x20'+_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x8b')]+(_0x3c705f(_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x8b')])?'\x20'+_0x3846d1[_0x531a('0x68')][_0x4a8c2a][_0x531a('0x8c')]:'');}return _0x3da266+')';};var _0x25d429={'where':{'id':_0xe46a8b[_0x531a('0x48')]['id']}},_0x3a2da5,_0x210d1b,_0x7d5b94,_0x25b4a6,_0x5d8385;_0x25d429=_['merge']({},_0x25d429,_0xe46a8b[_0x531a('0x42')]);return db[_0x531a('0x49')]['find'](_0x25d429)[_0x531a('0x27')](function(_0x30a8fe){if(_0x30a8fe){_0x3a2da5=_0x30a8fe;return _0x30a8fe[_0x531a('0x6b')]();}return null;})['then'](function(_0x82ce23){if(_0x82ce23){if(!_0x82ce23[_0x531a('0x3c')]){throw new db['Sequelize'][(_0x531a('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x210d1b=_0x82ce23;return db[_0x531a('0x6f')][_0x531a('0x45')]({'raw':!![]});}return null;})[_0x531a('0x27')](function(_0x263db2){if(_0x263db2){_0x7d5b94=_[_0x531a('0x70')](_0x263db2,'id');var _0x54e8ad;var _0x4db1a4=squel[_0x531a('0x71')]();_0x4db1a4['from'](_0x3a2da5[_0x531a('0x7f')]);for(var _0xaf8703=0x0;_0xaf8703<_0x210d1b['length'];_0xaf8703+=0x1){_0x54e8ad=_0x210d1b[_0xaf8703][_0x531a('0x72')]?_0x7d5b94[_0x210d1b[_0xaf8703][_0x531a('0x72')]]['metric']:_0x210d1b[_0xaf8703]['field'];_0x54e8ad=_0x210d1b[_0xaf8703][_0x531a('0x73')]?_[_0x531a('0x74')](_0x4b6077[_0x210d1b[_0xaf8703]['function']],'%s',_0x54e8ad):_0x54e8ad;_0x54e8ad=_0x210d1b[_0xaf8703]['format']?_[_0x531a('0x74')](_0x4e115d[_0x210d1b[_0xaf8703]['format']],'%s',_0x54e8ad):_0x54e8ad;if(_0x210d1b[_0xaf8703][_0x531a('0x76')]){_0x4db1a4[_0x531a('0x6a')](_0x54e8ad);}_0x210d1b[_0xaf8703]['orderBy']&&_0x4db1a4[_0x531a('0x3d')](_0x54e8ad,_0x210d1b[_0xaf8703][_0x531a('0x77')]===_0x531a('0x78')?![]:!![]);_0x4db1a4[_0x531a('0x8f')](_0x54e8ad,_0x210d1b[_0xaf8703]['alias']||_0x54e8ad);}if(_0x3a2da5[_0x531a('0x7a')]){_0x3a2da5[_0x531a('0x7a')]=JSON['parse'](_0x3a2da5[_0x531a('0x7a')]);for(var _0x4db1f9=0x0;_0x4db1f9<_0x3a2da5['joins']['length'];_0x4db1f9+=0x1){if(_0x3a2da5[_0x531a('0x7a')][_0x4db1f9][_0x531a('0x34')]&&_[_0x531a('0x65')](_0x2977ee,_0x3a2da5[_0x531a('0x7a')][_0x4db1f9][_0x531a('0x34')])&&_0x3a2da5[_0x531a('0x7a')][_0x4db1f9][_0x531a('0x90')]&&_0x3a2da5[_0x531a('0x7a')][_0x4db1f9]['foreignTable']&&_0x3a2da5[_0x531a('0x7a')][_0x4db1f9][_0x531a('0x7d')]){_0x4db1a4[_0x3a2da5[_0x531a('0x7a')][_0x4db1f9]['type']](_0x3a2da5['joins'][_0x4db1f9][_0x531a('0x7c')],null,util[_0x531a('0x75')](_0x531a('0x7e'),_0x3a2da5[_0x531a('0x7f')],_0x3a2da5['joins'][_0x4db1f9][_0x531a('0x90')],_0x3a2da5[_0x531a('0x7a')][_0x4db1f9]['foreignTable'],_0x3a2da5['joins'][_0x4db1f9][_0x531a('0x7d')]));}}}if(_0x3a2da5[_0x531a('0x80')]){_0x3a2da5[_0x531a('0x80')]=JSON[_0x531a('0x7b')](_0x3a2da5['conditions']);_0x4db1a4[_0x531a('0x3f')](_0x44d608(_0x3a2da5['conditions'][_0x531a('0x6a')]));}_0x5d8385=_0x4db1a4[_0x531a('0x81')]();_0x4db1a4['limit'](_0x388ded);_0x4db1a4[_0x531a('0x1f')](0x0);logger['debug'](_0x531a('0x83'),_0x4db1a4[_0x531a('0x84')]());return dbH[_0x531a('0x85')][_0x531a('0x36')](_0x4db1a4[_0x531a('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x531a('0x86')]});}})[_0x531a('0x27')](function(){return{'sql':_0x5d8385[_0x531a('0x84')]()};})['then'](respondWithResult(_0x3791c1,null))[_0x531a('0x4b')](handleError(_0x3791c1,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 171c342..16f1614 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 _0x8d1d=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','moment','bluebird','request-promise','path','./analyticCustomReport.attributes'];(function(_0x1d6e56,_0x1959b9){var _0xef8e84=function(_0x175e4e){while(--_0x175e4e){_0x1d6e56['push'](_0x1d6e56['shift']());}};_0xef8e84(++_0x1959b9);}(_0x8d1d,0xf6));var _0xd8d1=function(_0xfa4b3c,_0x3a4dc6){_0xfa4b3c=_0xfa4b3c-0x0;var _0x317dc8=_0x8d1d[_0xfa4b3c];return _0x317dc8;};'use strict';var _=require(_0xd8d1('0x0'));var util=require('util');var logger=require(_0xd8d1('0x1'))('api');var moment=require(_0xd8d1('0x2'));var BPromise=require(_0xd8d1('0x3'));var rp=require(_0xd8d1('0x4'));var fs=require('fs');var path=require(_0xd8d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd8d1('0x6'));module[_0xd8d1('0x7')]=function(_0x1ef1fa,_0x53c68a){return _0x1ef1fa[_0xd8d1('0x8')](_0xd8d1('0x9'),attributes,{'tableName':_0xd8d1('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4972=['moment','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','lodash','util','../../config/logger','api'];(function(_0x173c5e,_0x1a8403){var _0x41c573=function(_0x5bb29e){while(--_0x5bb29e){_0x173c5e['push'](_0x173c5e['shift']());}};_0x41c573(++_0x1a8403);}(_0x4972,0x151));var _0x2497=function(_0xcdecf2,_0x3f8f3e){_0xcdecf2=_0xcdecf2-0x0;var _0x34dbc2=_0x4972[_0xcdecf2];return _0x34dbc2;};'use strict';var _=require(_0x2497('0x0'));var util=require(_0x2497('0x1'));var logger=require(_0x2497('0x2'))(_0x2497('0x3'));var moment=require(_0x2497('0x4'));var BPromise=require(_0x2497('0x5'));var rp=require(_0x2497('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2497('0x7'));var attributes=require(_0x2497('0x8'));module['exports']=function(_0x50513e,_0x3d327a){return _0x50513e[_0x2497('0x9')](_0x2497('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 60584f7..3be83a2 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 _0x2607=['AnalyticCustomReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5793c2,_0x391930){var _0x2ce0cf=function(_0x3a7abb){while(--_0x3a7abb){_0x5793c2['push'](_0x5793c2['shift']());}};_0x2ce0cf(++_0x391930);}(_0x2607,0xba));var _0x7260=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x2607[_0x3207aa];return _0x51758f;};'use strict';var _=require(_0x7260('0x0'));var util=require(_0x7260('0x1'));var moment=require(_0x7260('0x2'));var BPromise=require(_0x7260('0x3'));var rs=require(_0x7260('0x4'));var fs=require('fs');var Redis=require(_0x7260('0x5'));var db=require(_0x7260('0x6'))['db'];var utils=require(_0x7260('0x7'));var logger=require('../../config/logger')(_0x7260('0x8'));var config=require('../../config/environment');var jayson=require(_0x7260('0x9'));var client=jayson[_0x7260('0xa')][_0x7260('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x212ace,_0x5dc15d,_0x3a7940){return new BPromise(function(_0x128de4,_0x125990){return client['request'](_0x212ace,_0x3a7940)[_0x7260('0xc')](function(_0x1c6244){logger[_0x7260('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5dc15d,_0x7260('0xe'));logger[_0x7260('0xf')](_0x7260('0x10'),_0x5dc15d,_0x7260('0xe'),JSON[_0x7260('0x11')](_0x1c6244));if(_0x1c6244[_0x7260('0x12')]){if(_0x1c6244['error'][_0x7260('0x13')]===0x1f4){logger[_0x7260('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5dc15d,_0x1c6244['error']['message']);return _0x125990(_0x1c6244[_0x7260('0x12')][_0x7260('0x14')]);}logger[_0x7260('0x12')](_0x7260('0x15'),_0x5dc15d,_0x1c6244[_0x7260('0x12')][_0x7260('0x14')]);return _0x128de4(_0x1c6244[_0x7260('0x12')][_0x7260('0x14')]);}else{logger[_0x7260('0xd')](_0x7260('0x15'),_0x5dc15d,_0x7260('0xe'));_0x128de4(_0x1c6244[_0x7260('0x16')][_0x7260('0x14')]);}})['catch'](function(_0x123a1c){logger['error'](_0x7260('0x15'),_0x5dc15d,_0x123a1c);_0x125990(_0x123a1c);});});} \ No newline at end of file +var _0xe323=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2341ab,_0x326a6c){var _0x54533e=function(_0x413273){while(--_0x413273){_0x2341ab['push'](_0x2341ab['shift']());}};_0x54533e(++_0x326a6c);}(_0xe323,0x169));var _0x3e32=function(_0x85f3c8,_0x3c74f9){_0x85f3c8=_0x85f3c8-0x0;var _0x5847b8=_0xe323[_0x85f3c8];return _0x5847b8;};'use strict';var _=require(_0x3e32('0x0'));var util=require(_0x3e32('0x1'));var moment=require('moment');var BPromise=require(_0x3e32('0x2'));var rs=require(_0x3e32('0x3'));var fs=require('fs');var Redis=require(_0x3e32('0x4'));var db=require(_0x3e32('0x5'))['db'];var utils=require(_0x3e32('0x6'));var logger=require(_0x3e32('0x7'))(_0x3e32('0x8'));var config=require(_0x3e32('0x9'));var jayson=require(_0x3e32('0xa'));var client=jayson[_0x3e32('0xb')][_0x3e32('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f774e,_0x1e0511,_0x28a84d){return new BPromise(function(_0x146cb5,_0x5782ef){return client[_0x3e32('0xd')](_0x3f774e,_0x28a84d)[_0x3e32('0xe')](function(_0x202c5d){logger[_0x3e32('0xf')](_0x3e32('0x10'),_0x1e0511,_0x3e32('0x11'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1e0511,_0x3e32('0x11'),JSON['stringify'](_0x202c5d));if(_0x202c5d[_0x3e32('0x12')]){if(_0x202c5d[_0x3e32('0x12')][_0x3e32('0x13')]===0x1f4){logger[_0x3e32('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1e0511,_0x202c5d[_0x3e32('0x12')][_0x3e32('0x14')]);return _0x5782ef(_0x202c5d[_0x3e32('0x12')][_0x3e32('0x14')]);}logger['error'](_0x3e32('0x10'),_0x1e0511,_0x202c5d[_0x3e32('0x12')][_0x3e32('0x14')]);return _0x146cb5(_0x202c5d[_0x3e32('0x12')][_0x3e32('0x14')]);}else{logger[_0x3e32('0xf')](_0x3e32('0x10'),_0x1e0511,_0x3e32('0x11'));_0x146cb5(_0x202c5d[_0x3e32('0x15')][_0x3e32('0x14')]);}})['catch'](function(_0x4dc576){logger[_0x3e32('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1e0511,_0x4dc576);_0x5782ef(_0x4dc576);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 7a83396..382f0f5 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 _0x78d7=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','create','put','update','destroy','exports'];(function(_0x39eebb,_0x56ae09){var _0x5bdbba=function(_0x282598){while(--_0x282598){_0x39eebb['push'](_0x39eebb['shift']());}};_0x5bdbba(++_0x56ae09);}(_0x78d7,0x152));var _0x778d=function(_0x490cb4,_0x16c206){_0x490cb4=_0x490cb4-0x0;var _0x1271e5=_0x78d7[_0x490cb4];return _0x1271e5;};'use strict';var multer=require(_0x778d('0x0'));var util=require(_0x778d('0x1'));var path=require(_0x778d('0x2'));var timeout=require(_0x778d('0x3'));var express=require(_0x778d('0x4'));var router=express['Router']();var fs_extra=require(_0x778d('0x5'));var auth=require(_0x778d('0x6'));var interaction=require(_0x778d('0x7'));var config=require(_0x778d('0x8'));var controller=require(_0x778d('0x9'));router[_0x778d('0xa')]('/',auth[_0x778d('0xb')](),controller[_0x778d('0xc')]);router[_0x778d('0xa')](_0x778d('0xd'),auth[_0x778d('0xb')](),controller[_0x778d('0xe')]);router[_0x778d('0xa')](_0x778d('0xf'),auth['isAuthenticated'](),controller[_0x778d('0x10')]);router[_0x778d('0xa')](_0x778d('0x11'),auth['isAuthenticated'](),controller[_0x778d('0x12')]);router['get']('/:id/query',auth[_0x778d('0xb')](),controller[_0x778d('0x13')]);router[_0x778d('0x14')]('/',auth[_0x778d('0xb')](),controller[_0x778d('0x15')]);router[_0x778d('0x16')]('/:id',auth[_0x778d('0xb')](),controller[_0x778d('0x17')]);router['delete'](_0x778d('0xd'),auth[_0x778d('0xb')](),controller[_0x778d('0x18')]);module[_0x778d('0x19')]=router; \ No newline at end of file +var _0xa95e=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','create','put','update','delete','destroy'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa95e,0x1c2));var _0xea95=function(_0x30f12e,_0x2daed5){_0x30f12e=_0x30f12e-0x0;var _0x182b6d=_0xa95e[_0x30f12e];return _0x182b6d;};'use strict';var multer=require(_0xea95('0x0'));var util=require('util');var path=require(_0xea95('0x1'));var timeout=require(_0xea95('0x2'));var express=require(_0xea95('0x3'));var router=express[_0xea95('0x4')]();var fs_extra=require(_0xea95('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea95('0x6'));var config=require(_0xea95('0x7'));var controller=require(_0xea95('0x8'));router[_0xea95('0x9')]('/',auth[_0xea95('0xa')](),controller[_0xea95('0xb')]);router[_0xea95('0x9')](_0xea95('0xc'),auth['isAuthenticated'](),controller[_0xea95('0xd')]);router[_0xea95('0x9')](_0xea95('0xe'),auth[_0xea95('0xa')](),controller[_0xea95('0xf')]);router[_0xea95('0x9')](_0xea95('0x10'),auth[_0xea95('0xa')](),controller[_0xea95('0x11')]);router[_0xea95('0x9')]('/:id/query',auth[_0xea95('0xa')](),controller[_0xea95('0x12')]);router[_0xea95('0x13')]('/',auth[_0xea95('0xa')](),controller[_0xea95('0x14')]);router[_0xea95('0x15')](_0xea95('0xc'),auth[_0xea95('0xa')](),controller[_0xea95('0x16')]);router[_0xea95('0x17')](_0xea95('0xc'),auth[_0xea95('0xa')](),controller[_0xea95('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6dbeff7..77f655f 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 _0x5d17=['sequelize','exports','STRING','TEXT'];(function(_0xd770,_0xf76c73){var _0x4028af=function(_0x2384db){while(--_0x2384db){_0xd770['push'](_0xd770['shift']());}};_0x4028af(++_0xf76c73);}(_0x5d17,0x114));var _0x75d1=function(_0x53eba7,_0x38744c){_0x53eba7=_0x53eba7-0x0;var _0x32491b=_0x5d17[_0x53eba7];return _0x32491b;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x75d1('0x2')]},'table':{'type':Sequelize[_0x75d1('0x2')]},'conditions':{'type':Sequelize[_0x75d1('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0xf494,0x1c6));var _0x4f49=function(_0x29e600,_0x563ae1){_0x29e600=_0x29e600-0x0;var _0x5319ae=_0xf494[_0x29e600];return _0x5319ae;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 78fefc8..1dc48bd 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 _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x289912,_0x1296a9){var _0x31d2af=function(_0x219618){while(--_0x219618){_0x289912['push'](_0x289912['shift']());}};_0x31d2af(++_0x1296a9);}(_0x46ed,0x168));var _0xd46e=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x46ed[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file +var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x22967e,_0x5b31be){var _0x290947=function(_0x108352){while(--_0x108352){_0x22967e['push'](_0x22967e['shift']());}};_0x290947(++_0x5b31be);}(_0x1cb9,0x14e));var _0x91cb=function(_0x128444,_0x4659b0){_0x128444=_0x128444-0x0;var _0x28fa45=_0x1cb9[_0x128444];return _0x28fa45;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 65e9aca..3d2f53b 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 _0x9745=['define','analytics_default_reports','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25a7f5,_0x268d5f){var _0xeae9d3=function(_0x4cbd5a){while(--_0x4cbd5a){_0x25a7f5['push'](_0x25a7f5['shift']());}};_0xeae9d3(++_0x268d5f);}(_0x9745,0x119));var _0x5974=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x9745[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5974('0x0'))('api');var moment=require(_0x5974('0x1'));var BPromise=require(_0x5974('0x2'));var rp=require(_0x5974('0x3'));var fs=require('fs');var path=require(_0x5974('0x4'));var rimraf=require(_0x5974('0x5'));var config=require(_0x5974('0x6'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x26df56,_0x56a9fb){return _0x26df56[_0x5974('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0x5974('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88cc=['define','AnalyticDefaultReport','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x2fbf61,_0x59228b){var _0x55c54a=function(_0x28154f){while(--_0x28154f){_0x2fbf61['push'](_0x2fbf61['shift']());}};_0x55c54a(++_0x59228b);}(_0x88cc,0x146));var _0xc88c=function(_0x529587,_0x7b9e47){_0x529587=_0x529587-0x0;var _0x4ea039=_0x88cc[_0x529587];return _0x4ea039;};'use strict';var _=require('lodash');var util=require(_0xc88c('0x0'));var logger=require(_0xc88c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc88c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc88c('0x3'));var rimraf=require(_0xc88c('0x4'));var config=require(_0xc88c('0x5'));var attributes=require(_0xc88c('0x6'));module['exports']=function(_0x147151,_0x5507f0){return _0x147151[_0xc88c('0x7')](_0xc88c('0x8'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index c9d9b29..45a0098 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 _0x93ac=['bluebird','../../mysqldb','../../config/environment','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x571071,_0x3327fb){var _0x2a2503=function(_0x5b39a2){while(--_0x5b39a2){_0x571071['push'](_0x571071['shift']());}};_0x2a2503(++_0x3327fb);}(_0x93ac,0x69));var _0xc93a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc93a('0x0'));var util=require(_0xc93a('0x1'));var moment=require(_0xc93a('0x2'));var BPromise=require(_0xc93a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc93a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc93a('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc93a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5e72af,_0x244ef2,_0x39d8ac){return new BPromise(function(_0x7998c2,_0x16cdca){return client['request'](_0x5e72af,_0x39d8ac)[_0xc93a('0x7')](function(_0x4cf2d4){logger[_0xc93a('0x8')](_0xc93a('0x9'),_0x244ef2,_0xc93a('0xa'));logger[_0xc93a('0xb')](_0xc93a('0xc'),_0x244ef2,_0xc93a('0xa'),JSON['stringify'](_0x4cf2d4));if(_0x4cf2d4[_0xc93a('0xd')]){if(_0x4cf2d4['error'][_0xc93a('0xe')]===0x1f4){logger[_0xc93a('0xd')](_0xc93a('0x9'),_0x244ef2,_0x4cf2d4[_0xc93a('0xd')]['message']);return _0x16cdca(_0x4cf2d4['error']['message']);}logger[_0xc93a('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x244ef2,_0x4cf2d4[_0xc93a('0xd')]['message']);return _0x7998c2(_0x4cf2d4[_0xc93a('0xd')][_0xc93a('0xf')]);}else{logger[_0xc93a('0x8')](_0xc93a('0x9'),_0x244ef2,_0xc93a('0xa'));_0x7998c2(_0x4cf2d4[_0xc93a('0x10')][_0xc93a('0xf')]);}})[_0xc93a('0x11')](function(_0x424819){logger[_0xc93a('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x244ef2,_0x424819);_0x16cdca(_0x424819);});});} \ No newline at end of file +var _0x7a03=['request','then','info','debug','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x220d07,_0x58dbe7){var _0x242e4a=function(_0x561c8f){while(--_0x561c8f){_0x220d07['push'](_0x220d07['shift']());}};_0x242e4a(++_0x58dbe7);}(_0x7a03,0x1f0));var _0x37a0=function(_0x1b9edd,_0x3e2201){_0x1b9edd=_0x1b9edd-0x0;var _0x448d87=_0x7a03[_0x1b9edd];return _0x448d87;};'use strict';var _=require('lodash');var util=require(_0x37a0('0x0'));var moment=require(_0x37a0('0x1'));var BPromise=require(_0x37a0('0x2'));var rs=require(_0x37a0('0x3'));var fs=require('fs');var Redis=require(_0x37a0('0x4'));var db=require(_0x37a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x37a0('0x6'));var config=require('../../config/environment');var jayson=require(_0x37a0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a35f2,_0x1678bc,_0x40cb09){return new BPromise(function(_0x2a5133,_0x19dced){return client[_0x37a0('0x8')](_0x4a35f2,_0x40cb09)[_0x37a0('0x9')](function(_0x1e8c00){logger[_0x37a0('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1678bc,'request\x20sent');logger[_0x37a0('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1678bc,'request\x20sent',JSON['stringify'](_0x1e8c00));if(_0x1e8c00['error']){if(_0x1e8c00[_0x37a0('0xc')][_0x37a0('0xd')]===0x1f4){logger[_0x37a0('0xc')](_0x37a0('0xe'),_0x1678bc,_0x1e8c00[_0x37a0('0xc')][_0x37a0('0xf')]);return _0x19dced(_0x1e8c00[_0x37a0('0xc')]['message']);}logger[_0x37a0('0xc')](_0x37a0('0xe'),_0x1678bc,_0x1e8c00[_0x37a0('0xc')][_0x37a0('0xf')]);return _0x2a5133(_0x1e8c00[_0x37a0('0xc')]['message']);}else{logger['info'](_0x37a0('0xe'),_0x1678bc,_0x37a0('0x10'));_0x2a5133(_0x1e8c00['result'][_0x37a0('0xf')]);}})[_0x37a0('0x11')](function(_0x18752f){logger['error'](_0x37a0('0xe'),_0x1678bc,_0x18752f);_0x19dced(_0x18752f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f05343e..65fc1ee 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 _0x3ac6=['isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','post','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x19f256,_0x1c8541){var _0x472cfa=function(_0x5bfac5){while(--_0x5bfac5){_0x19f256['push'](_0x19f256['shift']());}};_0x472cfa(++_0x1c8541);}(_0x3ac6,0x69));var _0x63ac=function(_0x3b640b,_0xc19b69){_0x3b640b=_0x3b640b-0x0;var _0x1a0d9e=_0x3ac6[_0x3b640b];return _0x1a0d9e;};'use strict';var multer=require(_0x63ac('0x0'));var util=require(_0x63ac('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x63ac('0x2'));var router=express[_0x63ac('0x3')]();var fs_extra=require(_0x63ac('0x4'));var auth=require(_0x63ac('0x5'));var interaction=require(_0x63ac('0x6'));var config=require(_0x63ac('0x7'));var controller=require(_0x63ac('0x8'));router[_0x63ac('0x9')]('/',auth[_0x63ac('0xa')](),controller[_0x63ac('0xb')]);router[_0x63ac('0x9')](_0x63ac('0xc'),auth[_0x63ac('0xa')](),controller[_0x63ac('0xd')]);router[_0x63ac('0x9')](_0x63ac('0xe'),auth[_0x63ac('0xa')](),controller[_0x63ac('0xf')]);router['get'](_0x63ac('0x10'),auth[_0x63ac('0xa')](),controller['run']);router[_0x63ac('0x9')](_0x63ac('0x11'),auth[_0x63ac('0xa')](),controller['query']);router[_0x63ac('0x12')]('/',auth[_0x63ac('0xa')](),controller['create']);router[_0x63ac('0x13')](_0x63ac('0xc'),auth[_0x63ac('0xa')](),controller['update']);router[_0x63ac('0x14')](_0x63ac('0xc'),auth[_0x63ac('0xa')](),controller[_0x63ac('0x15')]);module[_0x63ac('0x16')]=router; \ No newline at end of file +var _0x0ba3=['delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','/:id/preview','preview','/:id/run','isAuthenticated','/:id/query','query','post','put','update'];(function(_0x39986a,_0x5ee5fb){var _0x294a23=function(_0x99f982){while(--_0x99f982){_0x39986a['push'](_0x39986a['shift']());}};_0x294a23(++_0x5ee5fb);}(_0x0ba3,0x1d0));var _0x30ba=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0x0ba3[_0xffd8b0];return _0x301ba0;};'use strict';var multer=require(_0x30ba('0x0'));var util=require('util');var path=require(_0x30ba('0x1'));var timeout=require(_0x30ba('0x2'));var express=require(_0x30ba('0x3'));var router=express[_0x30ba('0x4')]();var fs_extra=require(_0x30ba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x30ba('0x6'));var config=require(_0x30ba('0x7'));var controller=require(_0x30ba('0x8'));router[_0x30ba('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x30ba('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x30ba('0x9')](_0x30ba('0xa'),auth['isAuthenticated'](),controller[_0x30ba('0xb')]);router[_0x30ba('0x9')](_0x30ba('0xc'),auth[_0x30ba('0xd')](),controller['run']);router[_0x30ba('0x9')](_0x30ba('0xe'),auth['isAuthenticated'](),controller[_0x30ba('0xf')]);router[_0x30ba('0x10')]('/',auth[_0x30ba('0xd')](),controller['create']);router[_0x30ba('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x30ba('0x12')]);router[_0x30ba('0x13')](_0x30ba('0x14'),auth[_0x30ba('0xd')](),controller[_0x30ba('0x15')]);module[_0x30ba('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index a916949..3c02464 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 _0x1ebb=['pdf','DATE','Loading','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x28733,_0x3c8aa4){var _0x36e0e0=function(_0x1003bb){while(--_0x1003bb){_0x28733['push'](_0x28733['shift']());}};_0x36e0e0(++_0x3c8aa4);}(_0x1ebb,0x1c2));var _0xb1eb=function(_0x67bac,_0x5ee30d){_0x67bac=_0x67bac-0x0;var _0x32afa4=_0x1ebb[_0x67bac];return _0x32afa4;};'use strict';var Sequelize=require(_0xb1eb('0x0'));var moment=require(_0xb1eb('0x1'));module[_0xb1eb('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xb1eb('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xb1eb('0x4')](_0xb1eb('0x5'),_0xb1eb('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0xb1eb('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xb1eb('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xb1eb('0x8')},'type':{'type':Sequelize[_0xb1eb('0x4')]('manual',_0xb1eb('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xb1eb('0xa')](0xb)[_0xb1eb('0xb')]},'reportType':{'type':Sequelize[_0xb1eb('0x3')]}}; \ No newline at end of file +var _0xb807=['ENUM','csv','manual','scheduled','INTEGER','UNSIGNED','moment','exports','STRING'];(function(_0x397009,_0x49d1b9){var _0x22cc48=function(_0x5033da){while(--_0x5033da){_0x397009['push'](_0x397009['shift']());}};_0x22cc48(++_0x49d1b9);}(_0xb807,0x153));var _0x7b80=function(_0x386b69,_0x5d9360){_0x386b69=_0x386b69-0x0;var _0x476415=_0xb807[_0x386b69];return _0x476415;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7b80('0x0'));module[_0x7b80('0x1')]={'name':{'type':Sequelize[_0x7b80('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x7b80('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x7b80('0x3')](_0x7b80('0x4'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x7b80('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x7b80('0x3')](_0x7b80('0x5'),_0x7b80('0x6')),'allowNull':![],'defaultValue':_0x7b80('0x5')},'reportId':{'type':Sequelize[_0x7b80('0x7')](0xb)[_0x7b80('0x8')]},'reportType':{'type':Sequelize[_0x7b80('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 0df2e5c..adb5faa 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 _0x3a4f=['ValidationError','Report\x20not\x20found\x20or\x20empty','download','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','existsSync','join','root','server/files/reports','savename','Sequelize'];(function(_0x14d186,_0x5c0dd6){var _0x517cc6=function(_0x45e20a){while(--_0x45e20a){_0x14d186['push'](_0x14d186['shift']());}};_0x517cc6(++_0x5c0dd6);}(_0x3a4f,0x185));var _0xf3a4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a4f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xf3a4('0x0'));var rimraf=require(_0xf3a4('0x1'));var zipdir=require(_0xf3a4('0x2'));var jsonpatch=require(_0xf3a4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf3a4('0x4'));var Mustache=require(_0xf3a4('0x5'));var util=require(_0xf3a4('0x6'));var path=require('path');var sox=require(_0xf3a4('0x7'));var csv=require(_0xf3a4('0x8'));var ejs=require(_0xf3a4('0x9'));var fs=require('fs');var fs_extra=require(_0xf3a4('0xa'));var _=require(_0xf3a4('0xb'));var squel=require(_0xf3a4('0xc'));var crypto=require(_0xf3a4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf3a4('0xe'));var toCsv=require(_0xf3a4('0x8'));var querystring=require('querystring');var Papa=require(_0xf3a4('0xf'));var Redis=require(_0xf3a4('0x10'));var authService=require(_0xf3a4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf3a4('0x12'));var hardwareService=require(_0xf3a4('0x13'));var logger=require(_0xf3a4('0x14'))(_0xf3a4('0x15'));var utils=require(_0xf3a4('0x16'));var config=require(_0xf3a4('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f943c,_0x2960f9){_0x2960f9=_0x2960f9||0xcc;return function(_0x1cafcc){if(_0x1cafcc){return _0x1f943c[_0xf3a4('0x18')](_0x2960f9);}return _0x1f943c['status'](_0x2960f9)[_0xf3a4('0x19')]();};}function respondWithResult(_0x577408,_0x3a150c){_0x3a150c=_0x3a150c||0xc8;return function(_0x324cd1){if(_0x324cd1){return _0x577408['status'](_0x3a150c)[_0xf3a4('0x1a')](_0x324cd1);}};}function respondWithFilteredResult(_0x3f317c,_0x48ae6a){return function(_0x5a61f5){if(_0x5a61f5){var _0x743d2a=typeof _0x48ae6a[_0xf3a4('0x1b')]===_0xf3a4('0x1c')&&typeof _0x48ae6a[_0xf3a4('0x1d')]===_0xf3a4('0x1c');var _0x4c606b=_0x5a61f5['count'];var _0x5835ce=_0x743d2a?0x0:_0x48ae6a['offset'];var _0x28c624=_0x743d2a?_0x5a61f5[_0xf3a4('0x1e')]:_0x48ae6a['offset']+_0x48ae6a[_0xf3a4('0x1d')];var _0x3372bf;if(_0x28c624>=_0x4c606b){_0x28c624=_0x4c606b;_0x3372bf=0xc8;}else{_0x3372bf=0xce;}_0x3f317c[_0xf3a4('0x1f')](_0x3372bf);return _0x3f317c[_0xf3a4('0x20')](_0xf3a4('0x21'),_0x5835ce+'-'+_0x28c624+'/'+_0x4c606b)[_0xf3a4('0x1a')](_0x5a61f5);}return null;};}function patchUpdates(_0x1572d6){return function(_0x5942fe){try{jsonpatch[_0xf3a4('0x22')](_0x5942fe,_0x1572d6,!![]);}catch(_0x4ee1db){return BPromise[_0xf3a4('0x23')](_0x4ee1db);}return _0x5942fe[_0xf3a4('0x24')]();};}function saveUpdates(_0x2a4c87,_0x3a06a0){return function(_0xfb6036){if(_0xfb6036){return _0xfb6036[_0xf3a4('0x25')](_0x2a4c87)[_0xf3a4('0x26')](function(_0x18facd){return _0x18facd;});}return null;};}function removeEntity(_0x3efbf5,_0x1645a8){return function(_0x36aa1f){if(_0x36aa1f){return _0x36aa1f[_0xf3a4('0x27')]()[_0xf3a4('0x26')](function(){var _0x2cbeca=_0x36aa1f[_0xf3a4('0x28')]({'plain':!![]});var _0x5682fe=_0xf3a4('0x29');return db[_0xf3a4('0x2a')][_0xf3a4('0x27')]({'where':{'type':_0x5682fe,'resourceId':_0x2cbeca['id']}})[_0xf3a4('0x26')](function(){return _0x36aa1f;});})[_0xf3a4('0x26')](function(){_0x3efbf5[_0xf3a4('0x1f')](0xcc)[_0xf3a4('0x19')]();});}};}function handleEntityNotFound(_0x20fe84,_0xd52a32){return function(_0x2d21ce){if(!_0x2d21ce){_0x20fe84['sendStatus'](0x194);}return _0x2d21ce;};}function handleError(_0x228f46,_0x1e0626){_0x1e0626=_0x1e0626||0x1f4;return function(_0x10f3b7){logger[_0xf3a4('0x2b')](_0x10f3b7['stack']);if(_0x10f3b7[_0xf3a4('0x2c')]){delete _0x10f3b7[_0xf3a4('0x2c')];}_0x228f46['status'](_0x1e0626)[_0xf3a4('0x2d')](_0x10f3b7);};}exports['index']=function(_0x41a9ce,_0x5aa9d6){var _0x5b1c51={},_0x28e34b={},_0xa7c11d={'count':0x0,'rows':[]};var _0x128315=_[_0xf3a4('0x2e')](db[_0xf3a4('0x2f')][_0xf3a4('0x30')],function(_0x1dc7e9){return{'name':_0x1dc7e9[_0xf3a4('0x31')],'type':_0x1dc7e9['type'][_0xf3a4('0x32')]};});_0x28e34b[_0xf3a4('0x33')]=_[_0xf3a4('0x2e')](_0x128315,'name');_0x28e34b[_0xf3a4('0x34')]=_[_0xf3a4('0x35')](_0x41a9ce[_0xf3a4('0x34')]);_0x28e34b['filters']=_[_0xf3a4('0x36')](_0x28e34b[_0xf3a4('0x33')],_0x28e34b['query']);_0x5b1c51[_0xf3a4('0x37')]=_[_0xf3a4('0x36')](_0x28e34b[_0xf3a4('0x33')],qs[_0xf3a4('0x38')](_0x41a9ce[_0xf3a4('0x34')]['fields']));_0x5b1c51[_0xf3a4('0x37')]=_0x5b1c51[_0xf3a4('0x37')][_0xf3a4('0x39')]?_0x5b1c51[_0xf3a4('0x37')]:_0x28e34b[_0xf3a4('0x33')];if(!_0x41a9ce['query'][_0xf3a4('0x3a')](_0xf3a4('0x3b'))){_0x5b1c51[_0xf3a4('0x1d')]=qs[_0xf3a4('0x1d')](_0x41a9ce['query'][_0xf3a4('0x1d')]);_0x5b1c51[_0xf3a4('0x1b')]=qs[_0xf3a4('0x1b')](_0x41a9ce['query'][_0xf3a4('0x1b')]);}_0x5b1c51[_0xf3a4('0x3c')]=qs[_0xf3a4('0x3d')](_0x41a9ce[_0xf3a4('0x34')]['sort']);_0x5b1c51[_0xf3a4('0x3e')]=qs[_0xf3a4('0x3f')](_[_0xf3a4('0x40')](_0x41a9ce[_0xf3a4('0x34')],_0x28e34b[_0xf3a4('0x3f')]),_0x128315);if(_0x41a9ce[_0xf3a4('0x34')][_0xf3a4('0x41')]){_0x5b1c51[_0xf3a4('0x3e')]=_[_0xf3a4('0x42')](_0x5b1c51[_0xf3a4('0x3e')],{'$or':_[_0xf3a4('0x2e')](_0x128315,function(_0xeb7844){if(_0xeb7844[_0xf3a4('0x43')]!==_0xf3a4('0x44')){var _0xdec1b4={};_0xdec1b4[_0xeb7844['name']]={'$like':'%'+_0x41a9ce['query'][_0xf3a4('0x41')]+'%'};return _0xdec1b4;}})});}_0x5b1c51=_['merge']({},_0x5b1c51,_0x41a9ce[_0xf3a4('0x45')]);var _0x3f576a={'where':_0x5b1c51[_0xf3a4('0x3e')]};return db[_0xf3a4('0x2f')][_0xf3a4('0x1e')](_0x3f576a)[_0xf3a4('0x26')](function(_0x93a8ba){_0xa7c11d[_0xf3a4('0x1e')]=_0x93a8ba;if(_0x41a9ce[_0xf3a4('0x34')][_0xf3a4('0x46')]){_0x5b1c51['include']=[{'all':!![]}];}return db[_0xf3a4('0x2f')][_0xf3a4('0x47')](_0x5b1c51);})['then'](function(_0x573c51){_0xa7c11d['rows']=_0x573c51;return _0xa7c11d;})[_0xf3a4('0x26')](respondWithFilteredResult(_0x5aa9d6,_0x5b1c51))[_0xf3a4('0x48')](handleError(_0x5aa9d6,null));};exports[_0xf3a4('0x49')]=function(_0x2a8c42,_0x144474){var _0x27b564={'raw':!![],'where':{'id':_0x2a8c42[_0xf3a4('0x4a')]['id']}},_0x4de106={};_0x4de106[_0xf3a4('0x33')]=_[_0xf3a4('0x35')](db[_0xf3a4('0x2f')][_0xf3a4('0x30')]);_0x4de106['query']=_[_0xf3a4('0x35')](_0x2a8c42['query']);_0x4de106['filters']=_[_0xf3a4('0x36')](_0x4de106[_0xf3a4('0x33')],_0x4de106[_0xf3a4('0x34')]);_0x27b564[_0xf3a4('0x37')]=_[_0xf3a4('0x36')](_0x4de106[_0xf3a4('0x33')],qs[_0xf3a4('0x38')](_0x2a8c42[_0xf3a4('0x34')][_0xf3a4('0x38')]));_0x27b564[_0xf3a4('0x37')]=_0x27b564[_0xf3a4('0x37')]['length']?_0x27b564[_0xf3a4('0x37')]:_0x4de106['model'];if(_0x2a8c42['query']['includeAll']){_0x27b564[_0xf3a4('0x4b')]=[{'all':!![]}];}_0x27b564=_['merge']({},_0x27b564,_0x2a8c42[_0xf3a4('0x45')]);return db[_0xf3a4('0x2f')]['find'](_0x27b564)[_0xf3a4('0x26')](handleEntityNotFound(_0x144474,null))[_0xf3a4('0x26')](respondWithResult(_0x144474,null))['catch'](handleError(_0x144474,null));};exports[_0xf3a4('0x4c')]=function(_0x3639ac,_0x75953c){return db['AnalyticExtractedReport'][_0xf3a4('0x4c')](_0x3639ac[_0xf3a4('0x4d')],{})[_0xf3a4('0x26')](function(_0x125c82){var _0x2e771a=_0x3639ac[_0xf3a4('0x4e')]['get']({'plain':!![]});if(!_0x2e771a)throw new Error(_0xf3a4('0x4f'));if(_0x2e771a[_0xf3a4('0x50')]===_0xf3a4('0x4e')){var _0x2456fb=_0x125c82['get']({'plain':!![]});var _0x51dfb7=_0xf3a4('0x29');return db[_0xf3a4('0x51')][_0xf3a4('0x52')]({'where':{'name':_0x51dfb7,'userProfileId':_0x2e771a['userProfileId']},'raw':!![]})['then'](function(_0x408883){if(_0x408883&&_0x408883[_0xf3a4('0x53')]===0x0){return db[_0xf3a4('0x2a')][_0xf3a4('0x4c')]({'name':_0x2456fb[_0xf3a4('0x2c')],'resourceId':_0x2456fb['id'],'type':_0x408883[_0xf3a4('0x2c')],'sectionId':_0x408883['id']},{})['then'](function(){return _0x125c82;});}else{return _0x125c82;}})[_0xf3a4('0x48')](function(_0x1c6ce1){logger[_0xf3a4('0x2b')](_0xf3a4('0x54'),_0x1c6ce1);throw _0x1c6ce1;});}return _0x125c82;})[_0xf3a4('0x26')](respondWithResult(_0x75953c,0xc9))['catch'](handleError(_0x75953c,null));};exports[_0xf3a4('0x25')]=function(_0x52720a,_0x50e312){if(_0x52720a['body']['id']){delete _0x52720a[_0xf3a4('0x4d')]['id'];}return db[_0xf3a4('0x2f')][_0xf3a4('0x52')]({'where':{'id':_0x52720a[_0xf3a4('0x4a')]['id']}})[_0xf3a4('0x26')](handleEntityNotFound(_0x50e312,null))[_0xf3a4('0x26')](saveUpdates(_0x52720a[_0xf3a4('0x4d')],null))[_0xf3a4('0x26')](respondWithResult(_0x50e312,null))[_0xf3a4('0x48')](handleError(_0x50e312,null));};exports[_0xf3a4('0x27')]=function(_0x3a77f8,_0x2c82ef){return db[_0xf3a4('0x2f')]['find']({'where':{'id':_0x3a77f8['params']['id']}})[_0xf3a4('0x26')](handleEntityNotFound(_0x2c82ef,null))[_0xf3a4('0x26')](removeEntity(_0x2c82ef,null))[_0xf3a4('0x48')](handleError(_0x2c82ef,null));};exports['download']=function(_0x9dd1e,_0x2de4c7,_0x76bc59){return db[_0xf3a4('0x2f')][_0xf3a4('0x52')]({'where':{'id':_0x9dd1e[_0xf3a4('0x4a')]['id']},'attributes':[_0xf3a4('0x2c'),'basename','savename','output'],'raw':!![]})[_0xf3a4('0x26')](handleEntityNotFound(_0x2de4c7,null))[_0xf3a4('0x26')](function(_0x511ef5){if(_0x511ef5){if(!fs[_0xf3a4('0x55')](path[_0xf3a4('0x56')](config[_0xf3a4('0x57')],_0xf3a4('0x58'),_0x511ef5[_0xf3a4('0x59')]))){throw new db[(_0xf3a4('0x5a'))][(_0xf3a4('0x5b'))](_0xf3a4('0x5c'));}if(_0x9dd1e[_0xf3a4('0x34')]['exists']){return _0x2de4c7['sendStatus'](0xc8);}return _0x2de4c7[_0xf3a4('0x5d')](path[_0xf3a4('0x56')](config[_0xf3a4('0x57')],_0xf3a4('0x58'),_0x511ef5[_0xf3a4('0x59')]),util['format'](_0xf3a4('0x5e'),_0x511ef5['basename']||_0x511ef5[_0xf3a4('0x2c')],_0x511ef5['output'][_0xf3a4('0x5f')]()));}})['catch'](handleError(_0x2de4c7,null));}; \ No newline at end of file +var _0xb5c4=['include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','%s.%s','basename','output','toLowerCase','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','update','then','get','ExtractedReports','UserProfileResource','destroy','error','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll'];(function(_0x58675f,_0x390355){var _0x1cc7f0=function(_0x31d6d6){while(--_0x31d6d6){_0x58675f['push'](_0x58675f['shift']());}};_0x1cc7f0(++_0x390355);}(_0xb5c4,0xd4));var _0x4b5c=function(_0x277c19,_0x22f714){_0x277c19=_0x277c19-0x0;var _0x3281e5=_0xb5c4[_0x277c19];return _0x3281e5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4b5c('0x0'));var moment=require(_0x4b5c('0x1'));var BPromise=require(_0x4b5c('0x2'));var Mustache=require('mustache');var util=require(_0x4b5c('0x3'));var path=require(_0x4b5c('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b5c('0x5'));var fs=require('fs');var fs_extra=require(_0x4b5c('0x6'));var _=require(_0x4b5c('0x7'));var squel=require(_0x4b5c('0x8'));var crypto=require('crypto');var jsforce=require(_0x4b5c('0x9'));var deskjs=require(_0x4b5c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4b5c('0xb'));var Papa=require(_0x4b5c('0xc'));var Redis=require('ioredis');var authService=require(_0x4b5c('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b5c('0xe'));var logger=require(_0x4b5c('0xf'))(_0x4b5c('0x10'));var utils=require(_0x4b5c('0x11'));var config=require(_0x4b5c('0x12'));var licenseUtil=require(_0x4b5c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c0f3,_0x54bd6c){_0x54bd6c=_0x54bd6c||0xcc;return function(_0x5e6ca7){if(_0x5e6ca7){return _0x13c0f3[_0x4b5c('0x14')](_0x54bd6c);}return _0x13c0f3['status'](_0x54bd6c)[_0x4b5c('0x15')]();};}function respondWithResult(_0x3ce8a2,_0x3311be){_0x3311be=_0x3311be||0xc8;return function(_0x4c460d){if(_0x4c460d){return _0x3ce8a2[_0x4b5c('0x16')](_0x3311be)[_0x4b5c('0x17')](_0x4c460d);}};}function respondWithFilteredResult(_0xa602a6,_0x2e93e3){return function(_0x521f8c){if(_0x521f8c){var _0x5f58e9=typeof _0x2e93e3[_0x4b5c('0x18')]===_0x4b5c('0x19')&&typeof _0x2e93e3[_0x4b5c('0x1a')]===_0x4b5c('0x19');var _0x4fe9d2=_0x521f8c[_0x4b5c('0x1b')];var _0x573003=_0x5f58e9?0x0:_0x2e93e3[_0x4b5c('0x18')];var _0x38fdfa=_0x5f58e9?_0x521f8c[_0x4b5c('0x1b')]:_0x2e93e3[_0x4b5c('0x18')]+_0x2e93e3[_0x4b5c('0x1a')];var _0x1b476f;if(_0x38fdfa>=_0x4fe9d2){_0x38fdfa=_0x4fe9d2;_0x1b476f=0xc8;}else{_0x1b476f=0xce;}_0xa602a6[_0x4b5c('0x16')](_0x1b476f);return _0xa602a6[_0x4b5c('0x1c')]('Content-Range',_0x573003+'-'+_0x38fdfa+'/'+_0x4fe9d2)[_0x4b5c('0x17')](_0x521f8c);}return null;};}function patchUpdates(_0x4f18c4){return function(_0x1d02a8){try{jsonpatch['apply'](_0x1d02a8,_0x4f18c4,!![]);}catch(_0x2835a0){return BPromise[_0x4b5c('0x1d')](_0x2835a0);}return _0x1d02a8['save']();};}function saveUpdates(_0x123e34,_0x2b70fb){return function(_0x2171b2){if(_0x2171b2){return _0x2171b2[_0x4b5c('0x1e')](_0x123e34)[_0x4b5c('0x1f')](function(_0x2b5eb9){return _0x2b5eb9;});}return null;};}function removeEntity(_0x1c2856,_0x1aca27){return function(_0x2afe09){if(_0x2afe09){return _0x2afe09['destroy']()['then'](function(){var _0x2b974b=_0x2afe09[_0x4b5c('0x20')]({'plain':!![]});var _0x513f4c=_0x4b5c('0x21');return db[_0x4b5c('0x22')][_0x4b5c('0x23')]({'where':{'type':_0x513f4c,'resourceId':_0x2b974b['id']}})[_0x4b5c('0x1f')](function(){return _0x2afe09;});})[_0x4b5c('0x1f')](function(){_0x1c2856[_0x4b5c('0x16')](0xcc)[_0x4b5c('0x15')]();});}};}function handleEntityNotFound(_0x2a4a8d,_0x56065f){return function(_0x59b24f){if(!_0x59b24f){_0x2a4a8d['sendStatus'](0x194);}return _0x59b24f;};}function handleError(_0x7fe6ac,_0x24970e){_0x24970e=_0x24970e||0x1f4;return function(_0x53cab5){logger[_0x4b5c('0x24')](_0x53cab5['stack']);if(_0x53cab5[_0x4b5c('0x25')]){delete _0x53cab5[_0x4b5c('0x25')];}_0x7fe6ac[_0x4b5c('0x16')](_0x24970e)[_0x4b5c('0x26')](_0x53cab5);};}exports[_0x4b5c('0x27')]=function(_0x87ddb5,_0x3eea3b){var _0x54d221={},_0x3fb861={},_0x460912={'count':0x0,'rows':[]};var _0x65fd53=_[_0x4b5c('0x28')](db[_0x4b5c('0x29')]['rawAttributes'],function(_0x3a7abb){return{'name':_0x3a7abb[_0x4b5c('0x2a')],'type':_0x3a7abb[_0x4b5c('0x2b')][_0x4b5c('0x2c')]};});_0x3fb861[_0x4b5c('0x2d')]=_[_0x4b5c('0x28')](_0x65fd53,_0x4b5c('0x25'));_0x3fb861[_0x4b5c('0x2e')]=_['keys'](_0x87ddb5['query']);_0x3fb861[_0x4b5c('0x2f')]=_[_0x4b5c('0x30')](_0x3fb861['model'],_0x3fb861[_0x4b5c('0x2e')]);_0x54d221[_0x4b5c('0x31')]=_[_0x4b5c('0x30')](_0x3fb861[_0x4b5c('0x2d')],qs['fields'](_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x32')]));_0x54d221[_0x4b5c('0x31')]=_0x54d221[_0x4b5c('0x31')]['length']?_0x54d221['attributes']:_0x3fb861[_0x4b5c('0x2d')];if(!_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x33')](_0x4b5c('0x34'))){_0x54d221['limit']=qs[_0x4b5c('0x1a')](_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x1a')]);_0x54d221[_0x4b5c('0x18')]=qs['offset'](_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x18')]);}_0x54d221[_0x4b5c('0x35')]=qs[_0x4b5c('0x36')](_0x87ddb5[_0x4b5c('0x2e')]['sort']);_0x54d221['where']=qs['filters'](_['pick'](_0x87ddb5[_0x4b5c('0x2e')],_0x3fb861[_0x4b5c('0x2f')]),_0x65fd53);if(_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x37')]){_0x54d221['where']=_[_0x4b5c('0x38')](_0x54d221[_0x4b5c('0x39')],{'$or':_['map'](_0x65fd53,function(_0x1b494b){if(_0x1b494b['type']!==_0x4b5c('0x3a')){var _0x5dd9a6={};_0x5dd9a6[_0x1b494b['name']]={'$like':'%'+_0x87ddb5['query'][_0x4b5c('0x37')]+'%'};return _0x5dd9a6;}})});}_0x54d221=_[_0x4b5c('0x38')]({},_0x54d221,_0x87ddb5[_0x4b5c('0x3b')]);var _0x30fc4a={'where':_0x54d221[_0x4b5c('0x39')]};return db['AnalyticExtractedReport'][_0x4b5c('0x1b')](_0x30fc4a)[_0x4b5c('0x1f')](function(_0x370e9f){_0x460912[_0x4b5c('0x1b')]=_0x370e9f;if(_0x87ddb5[_0x4b5c('0x2e')][_0x4b5c('0x3c')]){_0x54d221[_0x4b5c('0x3d')]=[{'all':!![]}];}return db[_0x4b5c('0x29')][_0x4b5c('0x3e')](_0x54d221);})[_0x4b5c('0x1f')](function(_0x38f74e){_0x460912[_0x4b5c('0x3f')]=_0x38f74e;return _0x460912;})[_0x4b5c('0x1f')](respondWithFilteredResult(_0x3eea3b,_0x54d221))[_0x4b5c('0x40')](handleError(_0x3eea3b,null));};exports[_0x4b5c('0x41')]=function(_0x21b0de,_0xec934d){var _0x59619f={'raw':!![],'where':{'id':_0x21b0de[_0x4b5c('0x42')]['id']}},_0x267d91={};_0x267d91[_0x4b5c('0x2d')]=_[_0x4b5c('0x43')](db[_0x4b5c('0x29')][_0x4b5c('0x44')]);_0x267d91[_0x4b5c('0x2e')]=_['keys'](_0x21b0de[_0x4b5c('0x2e')]);_0x267d91['filters']=_[_0x4b5c('0x30')](_0x267d91[_0x4b5c('0x2d')],_0x267d91[_0x4b5c('0x2e')]);_0x59619f[_0x4b5c('0x31')]=_[_0x4b5c('0x30')](_0x267d91[_0x4b5c('0x2d')],qs['fields'](_0x21b0de['query']['fields']));_0x59619f['attributes']=_0x59619f['attributes'][_0x4b5c('0x45')]?_0x59619f[_0x4b5c('0x31')]:_0x267d91['model'];if(_0x21b0de[_0x4b5c('0x2e')][_0x4b5c('0x3c')]){_0x59619f[_0x4b5c('0x3d')]=[{'all':!![]}];}_0x59619f=_['merge']({},_0x59619f,_0x21b0de['options']);return db[_0x4b5c('0x29')][_0x4b5c('0x46')](_0x59619f)[_0x4b5c('0x1f')](handleEntityNotFound(_0xec934d,null))['then'](respondWithResult(_0xec934d,null))['catch'](handleError(_0xec934d,null));};exports[_0x4b5c('0x47')]=function(_0x385bdd,_0x5eba6f){return db[_0x4b5c('0x29')][_0x4b5c('0x47')](_0x385bdd[_0x4b5c('0x48')],{})[_0x4b5c('0x1f')](function(_0x479e8e){var _0x302d3c=_0x385bdd['user']['get']({'plain':!![]});if(!_0x302d3c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x302d3c['role']===_0x4b5c('0x49')){var _0x894822=_0x479e8e['get']({'plain':!![]});var _0x190160='ExtractedReports';return db[_0x4b5c('0x4a')][_0x4b5c('0x46')]({'where':{'name':_0x190160,'userProfileId':_0x302d3c[_0x4b5c('0x4b')]},'raw':!![]})[_0x4b5c('0x1f')](function(_0x12c672){if(_0x12c672&&_0x12c672[_0x4b5c('0x4c')]===0x0){return db[_0x4b5c('0x22')][_0x4b5c('0x47')]({'name':_0x894822[_0x4b5c('0x25')],'resourceId':_0x894822['id'],'type':_0x12c672[_0x4b5c('0x25')],'sectionId':_0x12c672['id']},{})[_0x4b5c('0x1f')](function(){return _0x479e8e;});}else{return _0x479e8e;}})['catch'](function(_0xde84d1){logger[_0x4b5c('0x24')](_0x4b5c('0x4d'),_0xde84d1);throw _0xde84d1;});}return _0x479e8e;})[_0x4b5c('0x1f')](respondWithResult(_0x5eba6f,0xc9))[_0x4b5c('0x40')](handleError(_0x5eba6f,null));};exports['update']=function(_0x447118,_0x19ae9b){if(_0x447118[_0x4b5c('0x48')]['id']){delete _0x447118[_0x4b5c('0x48')]['id'];}return db['AnalyticExtractedReport'][_0x4b5c('0x46')]({'where':{'id':_0x447118['params']['id']}})[_0x4b5c('0x1f')](handleEntityNotFound(_0x19ae9b,null))[_0x4b5c('0x1f')](saveUpdates(_0x447118[_0x4b5c('0x48')],null))[_0x4b5c('0x1f')](respondWithResult(_0x19ae9b,null))[_0x4b5c('0x40')](handleError(_0x19ae9b,null));};exports[_0x4b5c('0x23')]=function(_0x788474,_0x561275){return db['AnalyticExtractedReport'][_0x4b5c('0x46')]({'where':{'id':_0x788474[_0x4b5c('0x42')]['id']}})[_0x4b5c('0x1f')](handleEntityNotFound(_0x561275,null))[_0x4b5c('0x1f')](removeEntity(_0x561275,null))['catch'](handleError(_0x561275,null));};exports[_0x4b5c('0x4e')]=function(_0x3329b5,_0x479bb0,_0x34701b){return db[_0x4b5c('0x29')][_0x4b5c('0x46')]({'where':{'id':_0x3329b5[_0x4b5c('0x42')]['id']},'attributes':[_0x4b5c('0x25'),'basename',_0x4b5c('0x4f'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x479bb0,null))['then'](function(_0x2999ca){if(_0x2999ca){if(!fs['existsSync'](path[_0x4b5c('0x50')](config[_0x4b5c('0x51')],'server/files/reports',_0x2999ca[_0x4b5c('0x4f')]))){throw new db[(_0x4b5c('0x52'))][(_0x4b5c('0x53'))](_0x4b5c('0x54'));}if(_0x3329b5[_0x4b5c('0x2e')][_0x4b5c('0x55')]){return _0x479bb0[_0x4b5c('0x14')](0xc8);}return _0x479bb0['download'](path[_0x4b5c('0x50')](config[_0x4b5c('0x51')],_0x4b5c('0x56'),_0x2999ca[_0x4b5c('0x4f')]),util['format'](_0x4b5c('0x57'),_0x2999ca[_0x4b5c('0x58')]||_0x2999ca[_0x4b5c('0x25')],_0x2999ca[_0x4b5c('0x59')][_0x4b5c('0x5a')]()));}})[_0x4b5c('0x40')](handleError(_0x479bb0,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 2511432..c4a2a17 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 _0x9f44=['util','api','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x96a2d7,_0x5ad0cd){var _0x48501c=function(_0x522f22){while(--_0x522f22){_0x96a2d7['push'](_0x96a2d7['shift']());}};_0x48501c(++_0x5ad0cd);}(_0x9f44,0x107));var _0x49f4=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x9f44[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x49f4('0x0'));var util=require(_0x49f4('0x1'));var logger=require('../../config/logger')(_0x49f4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x49f4('0x3'));var fs=require('fs');var path=require(_0x49f4('0x4'));var rimraf=require(_0x49f4('0x5'));var config=require(_0x49f4('0x6'));var attributes=require(_0x49f4('0x7'));module[_0x49f4('0x8')]=function(_0x2d8259,_0xa087c0){return _0x2d8259['define'](_0x49f4('0x9'),attributes,{'tableName':_0x49f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f01=['analytics_extracted_reports','util','api','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x437310,_0x20de0b){var _0xb43119=function(_0x36a866){while(--_0x36a866){_0x437310['push'](_0x437310['shift']());}};_0xb43119(++_0x20de0b);}(_0x2f01,0x14b));var _0x12f0=function(_0x49c5c0,_0xcc13f2){_0x49c5c0=_0x49c5c0-0x0;var _0x2b353a=_0x2f01[_0x49c5c0];return _0x2b353a;};'use strict';var _=require('lodash');var util=require(_0x12f0('0x0'));var logger=require('../../config/logger')(_0x12f0('0x1'));var moment=require('moment');var BPromise=require(_0x12f0('0x2'));var rp=require(_0x12f0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12f0('0x4'));var config=require(_0x12f0('0x5'));var attributes=require(_0x12f0('0x6'));module[_0x12f0('0x7')]=function(_0x4eeb05,_0x332c15){return _0x4eeb05[_0x12f0('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x12f0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 7603323..4d8e9cd 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 _0x7ac7=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x457c6c,_0x225eea){var _0x756533=function(_0x591b81){while(--_0x591b81){_0x457c6c['push'](_0x457c6c['shift']());}};_0x756533(++_0x225eea);}(_0x7ac7,0x12e));var _0x77ac=function(_0x4b9a8e,_0x4c2c2d){_0x4b9a8e=_0x4b9a8e-0x0;var _0x5da04d=_0x7ac7[_0x4b9a8e];return _0x5da04d;};'use strict';var _=require(_0x77ac('0x0'));var util=require('util');var moment=require(_0x77ac('0x1'));var BPromise=require(_0x77ac('0x2'));var rs=require(_0x77ac('0x3'));var fs=require('fs');var Redis=require(_0x77ac('0x4'));var db=require(_0x77ac('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77ac('0x6'))(_0x77ac('0x7'));var config=require('../../config/environment');var jayson=require(_0x77ac('0x8'));var client=jayson[_0x77ac('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x378135,_0x211417,_0x3b18e0){return new BPromise(function(_0xbef900,_0x2875bd){return client[_0x77ac('0xa')](_0x378135,_0x3b18e0)[_0x77ac('0xb')](function(_0xbcdc8c){logger[_0x77ac('0xc')](_0x77ac('0xd'),_0x211417,_0x77ac('0xe'));logger[_0x77ac('0xf')](_0x77ac('0x10'),_0x211417,_0x77ac('0xe'),JSON['stringify'](_0xbcdc8c));if(_0xbcdc8c['error']){if(_0xbcdc8c[_0x77ac('0x11')][_0x77ac('0x12')]===0x1f4){logger[_0x77ac('0x11')](_0x77ac('0xd'),_0x211417,_0xbcdc8c[_0x77ac('0x11')][_0x77ac('0x13')]);return _0x2875bd(_0xbcdc8c['error'][_0x77ac('0x13')]);}logger[_0x77ac('0x11')](_0x77ac('0xd'),_0x211417,_0xbcdc8c[_0x77ac('0x11')][_0x77ac('0x13')]);return _0xbef900(_0xbcdc8c[_0x77ac('0x11')][_0x77ac('0x13')]);}else{logger[_0x77ac('0xc')](_0x77ac('0xd'),_0x211417,'request\x20sent');_0xbef900(_0xbcdc8c[_0x77ac('0x14')]['message']);}})['catch'](function(_0x3530c7){logger['error'](_0x77ac('0xd'),_0x211417,_0x3530c7);_0x2875bd(_0x3530c7);});});} \ No newline at end of file +var _0xeae7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird'];(function(_0x559130,_0x56900b){var _0x23b94c=function(_0x581f4e){while(--_0x581f4e){_0x559130['push'](_0x559130['shift']());}};_0x23b94c(++_0x56900b);}(_0xeae7,0x1a1));var _0x7eae=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0xeae7[_0x6173fc];return _0x965fbe;};'use strict';var _=require('lodash');var util=require(_0x7eae('0x0'));var moment=require(_0x7eae('0x1'));var BPromise=require(_0x7eae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eae('0x3'));var db=require(_0x7eae('0x4'))['db'];var utils=require(_0x7eae('0x5'));var logger=require(_0x7eae('0x6'))(_0x7eae('0x7'));var config=require(_0x7eae('0x8'));var jayson=require(_0x7eae('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd01591,_0xfcbb05,_0x4acf71){return new BPromise(function(_0x3141b7,_0x50a3d9){return client[_0x7eae('0xa')](_0xd01591,_0x4acf71)[_0x7eae('0xb')](function(_0x1b6f32){logger[_0x7eae('0xc')](_0x7eae('0xd'),_0xfcbb05,_0x7eae('0xe'));logger[_0x7eae('0xf')](_0x7eae('0x10'),_0xfcbb05,_0x7eae('0xe'),JSON[_0x7eae('0x11')](_0x1b6f32));if(_0x1b6f32[_0x7eae('0x12')]){if(_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x13')]===0x1f4){logger['error'](_0x7eae('0xd'),_0xfcbb05,_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);return _0x50a3d9(_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);}logger[_0x7eae('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xfcbb05,_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);return _0x3141b7(_0x1b6f32[_0x7eae('0x12')]['message']);}else{logger['info'](_0x7eae('0xd'),_0xfcbb05,_0x7eae('0xe'));_0x3141b7(_0x1b6f32['result'][_0x7eae('0x14')]);}})['catch'](function(_0x477a8f){logger[_0x7eae('0x12')](_0x7eae('0xd'),_0xfcbb05,_0x477a8f);_0x50a3d9(_0x477a8f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index f6797e0..3defe4d 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 _0xc8cc=['isAuthenticated','index','get','/:id','show','/:id/download','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x20d847,_0x8e1cf5){var _0x4e9f30=function(_0x45583b){while(--_0x45583b){_0x20d847['push'](_0x20d847['shift']());}};_0x4e9f30(++_0x8e1cf5);}(_0xc8cc,0xae));var _0xcc8c=function(_0x2993fd,_0x255013){_0x2993fd=_0x2993fd-0x0;var _0x50eafa=_0xc8cc[_0x2993fd];return _0x50eafa;};'use strict';var multer=require(_0xcc8c('0x0'));var util=require(_0xcc8c('0x1'));var path=require(_0xcc8c('0x2'));var timeout=require('connect-timeout');var express=require(_0xcc8c('0x3'));var router=express[_0xcc8c('0x4')]();var fs_extra=require(_0xcc8c('0x5'));var auth=require(_0xcc8c('0x6'));var interaction=require(_0xcc8c('0x7'));var config=require(_0xcc8c('0x8'));var controller=require(_0xcc8c('0x9'));router['get']('/',auth[_0xcc8c('0xa')](),controller[_0xcc8c('0xb')]);router[_0xcc8c('0xc')](_0xcc8c('0xd'),auth[_0xcc8c('0xa')](),controller[_0xcc8c('0xe')]);router['get'](_0xcc8c('0xf'),auth['isAuthenticated'](),controller['download']);router[_0xcc8c('0x10')]('/',auth[_0xcc8c('0xa')](),controller[_0xcc8c('0x11')]);router[_0xcc8c('0x12')](_0xcc8c('0xd'),auth['isAuthenticated'](),controller[_0xcc8c('0x13')]);router[_0xcc8c('0x14')](_0xcc8c('0xd'),auth[_0xcc8c('0xa')](),controller[_0xcc8c('0x15')]);module[_0xcc8c('0x16')]=router; \ No newline at end of file +var _0xcc10=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','index','/:id','download','post','isAuthenticated','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x8ef553,_0x444b81){var _0x5e9bd2=function(_0xa12543){while(--_0xa12543){_0x8ef553['push'](_0x8ef553['shift']());}};_0x5e9bd2(++_0x444b81);}(_0xcc10,0x8f));var _0x0cc1=function(_0x3f701b,_0x12dbf9){_0x3f701b=_0x3f701b-0x0;var _0x484fed=_0xcc10[_0x3f701b];return _0x484fed;};'use strict';var multer=require(_0x0cc1('0x0'));var util=require(_0x0cc1('0x1'));var path=require(_0x0cc1('0x2'));var timeout=require(_0x0cc1('0x3'));var express=require(_0x0cc1('0x4'));var router=express[_0x0cc1('0x5')]();var fs_extra=require(_0x0cc1('0x6'));var auth=require(_0x0cc1('0x7'));var interaction=require(_0x0cc1('0x8'));var config=require('../../config/environment');var controller=require(_0x0cc1('0x9'));router[_0x0cc1('0xa')]('/',auth['isAuthenticated'](),controller[_0x0cc1('0xb')]);router[_0x0cc1('0xa')](_0x0cc1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0cc1('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x0cc1('0xd')]);router[_0x0cc1('0xe')]('/',auth[_0x0cc1('0xf')](),controller[_0x0cc1('0x10')]);router[_0x0cc1('0x11')]('/:id',auth[_0x0cc1('0xf')](),controller[_0x0cc1('0x12')]);router[_0x0cc1('0x13')](_0x0cc1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0cc1('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8e426c3..f44f1e7 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 _0x7d1b=['BOOLEAN','sequelize','exports','STRING'];(function(_0x291ebf,_0x51cb96){var _0x5a00bc=function(_0x4e0e43){while(--_0x4e0e43){_0x291ebf['push'](_0x291ebf['shift']());}};_0x5a00bc(++_0x51cb96);}(_0x7d1b,0x17d));var _0xb7d1=function(_0x5ea43c,_0x45bdb1){_0x5ea43c=_0x5ea43c-0x0;var _0x1b432e=_0x7d1b[_0x5ea43c];return _0x1b432e;};'use strict';var Sequelize=require(_0xb7d1('0x0'));module[_0xb7d1('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xb7d1('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb7d1('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb7d1('0x2')]},'custom':{'type':Sequelize[_0xb7d1('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9a0e=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x58a56e,_0x743b79){var _0x4a0f75=function(_0x48fd77){while(--_0x48fd77){_0x58a56e['push'](_0x58a56e['shift']());}};_0x4a0f75(++_0x743b79);}(_0x9a0e,0x1c3));var _0xe9a0=function(_0x247e03,_0x209b53){_0x247e03=_0x247e03-0x0;var _0xa7cae6=_0x9a0e[_0x247e03];return _0xa7cae6;};'use strict';var Sequelize=require(_0xe9a0('0x0'));module[_0xe9a0('0x1')]={'field':{'type':Sequelize[_0xe9a0('0x2')]},'alias':{'type':Sequelize[_0xe9a0('0x3')]},'function':{'type':Sequelize[_0xe9a0('0x3')]},'format':{'type':Sequelize[_0xe9a0('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xe9a0('0x3')]},'custom':{'type':Sequelize[_0xe9a0('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 3f166cc..41e5a84 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 _0x6d82=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','AnalyticFieldReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','bulkCreate','update','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x39b703,_0xd5e18d){var _0x50422c=function(_0x55e88a){while(--_0x55e88a){_0x39b703['push'](_0x39b703['shift']());}};_0x50422c(++_0xd5e18d);}(_0x6d82,0x120));var _0x26d8=function(_0x197e02,_0x281bbc){_0x197e02=_0x197e02-0x0;var _0x3130ab=_0x6d82[_0x197e02];return _0x3130ab;};'use strict';var emlformat=require(_0x26d8('0x0'));var rimraf=require(_0x26d8('0x1'));var zipdir=require(_0x26d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26d8('0x3'));var moment=require(_0x26d8('0x4'));var BPromise=require(_0x26d8('0x5'));var Mustache=require(_0x26d8('0x6'));var util=require(_0x26d8('0x7'));var path=require('path');var sox=require(_0x26d8('0x8'));var csv=require(_0x26d8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26d8('0xa'));var squel=require(_0x26d8('0xb'));var crypto=require(_0x26d8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x26d8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x26d8('0xd'));var authService=require(_0x26d8('0xe'));var qs=require(_0x26d8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x26d8('0x10'));var utils=require('../../config/utils');var config=require(_0x26d8('0x11'));var licenseUtil=require(_0x26d8('0x12'));var db=require(_0x26d8('0x13'))['db'];function respondWithStatusCode(_0x2a348c,_0x2fe7d7){_0x2fe7d7=_0x2fe7d7||0xcc;return function(_0x2cf098){if(_0x2cf098){return _0x2a348c[_0x26d8('0x14')](_0x2fe7d7);}return _0x2a348c[_0x26d8('0x15')](_0x2fe7d7)[_0x26d8('0x16')]();};}function respondWithResult(_0x25beca,_0xc003e7){_0xc003e7=_0xc003e7||0xc8;return function(_0x4beb24){if(_0x4beb24){return _0x25beca[_0x26d8('0x15')](_0xc003e7)['json'](_0x4beb24);}};}function respondWithFilteredResult(_0x3ef8ab,_0x9979c9){return function(_0x35ccce){if(_0x35ccce){var _0x1631ae=typeof _0x9979c9[_0x26d8('0x17')]===_0x26d8('0x18')&&typeof _0x9979c9['limit']===_0x26d8('0x18');var _0x19a962=_0x35ccce[_0x26d8('0x19')];var _0x37d53a=_0x1631ae?0x0:_0x9979c9[_0x26d8('0x17')];var _0x56a9eb=_0x1631ae?_0x35ccce[_0x26d8('0x19')]:_0x9979c9['offset']+_0x9979c9[_0x26d8('0x1a')];var _0x19b4df;if(_0x56a9eb>=_0x19a962){_0x56a9eb=_0x19a962;_0x19b4df=0xc8;}else{_0x19b4df=0xce;}_0x3ef8ab[_0x26d8('0x15')](_0x19b4df);return _0x3ef8ab['set'](_0x26d8('0x1b'),_0x37d53a+'-'+_0x56a9eb+'/'+_0x19a962)['json'](_0x35ccce);}return null;};}function patchUpdates(_0x4af852){return function(_0x1ab3ec){try{jsonpatch[_0x26d8('0x1c')](_0x1ab3ec,_0x4af852,!![]);}catch(_0x2a7709){return BPromise[_0x26d8('0x1d')](_0x2a7709);}return _0x1ab3ec[_0x26d8('0x1e')]();};}function saveUpdates(_0x23270e,_0x1ccf0d){return function(_0x560fdf){if(_0x560fdf){return _0x560fdf['update'](_0x23270e)[_0x26d8('0x1f')](function(_0x325f71){return _0x325f71;});}return null;};}function removeEntity(_0xe84417,_0x28c30a){return function(_0xa9e023){if(_0xa9e023){return _0xa9e023[_0x26d8('0x20')]()[_0x26d8('0x1f')](function(){_0xe84417[_0x26d8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e3b7,_0x31340c){return function(_0x264702){if(!_0x264702){_0x35e3b7['sendStatus'](0x194);}return _0x264702;};}function handleError(_0x2d6c7e,_0x38ddf8){_0x38ddf8=_0x38ddf8||0x1f4;return function(_0x2d1a41){logger['error'](_0x2d1a41[_0x26d8('0x21')]);if(_0x2d1a41[_0x26d8('0x22')]){delete _0x2d1a41[_0x26d8('0x22')];}_0x2d6c7e['status'](_0x38ddf8)[_0x26d8('0x23')](_0x2d1a41);};}exports['index']=function(_0x5e0079,_0x50ef75){var _0x43eea8={},_0x582ab8={},_0x22b559={'count':0x0,'rows':[]};var _0x1ebca2=_['map'](db['AnalyticFieldReport'][_0x26d8('0x24')],function(_0x58c8bd){return{'name':_0x58c8bd[_0x26d8('0x25')],'type':_0x58c8bd[_0x26d8('0x26')]['key']};});_0x582ab8[_0x26d8('0x27')]=_[_0x26d8('0x28')](_0x1ebca2,_0x26d8('0x22'));_0x582ab8[_0x26d8('0x29')]=_[_0x26d8('0x2a')](_0x5e0079[_0x26d8('0x29')]);_0x582ab8[_0x26d8('0x2b')]=_['intersection'](_0x582ab8['model'],_0x582ab8[_0x26d8('0x29')]);_0x43eea8[_0x26d8('0x2c')]=_[_0x26d8('0x2d')](_0x582ab8[_0x26d8('0x27')],qs[_0x26d8('0x2e')](_0x5e0079['query'][_0x26d8('0x2e')]));_0x43eea8[_0x26d8('0x2c')]=_0x43eea8[_0x26d8('0x2c')][_0x26d8('0x2f')]?_0x43eea8[_0x26d8('0x2c')]:_0x582ab8['model'];if(!_0x5e0079[_0x26d8('0x29')][_0x26d8('0x30')](_0x26d8('0x31'))){_0x43eea8[_0x26d8('0x1a')]=qs[_0x26d8('0x1a')](_0x5e0079[_0x26d8('0x29')][_0x26d8('0x1a')]);_0x43eea8['offset']=qs['offset'](_0x5e0079[_0x26d8('0x29')][_0x26d8('0x17')]);}_0x43eea8['order']=qs['sort'](_0x5e0079[_0x26d8('0x29')][_0x26d8('0x32')]);_0x43eea8[_0x26d8('0x33')]=qs[_0x26d8('0x2b')](_[_0x26d8('0x34')](_0x5e0079['query'],_0x582ab8[_0x26d8('0x2b')]),_0x1ebca2);if(_0x5e0079[_0x26d8('0x29')]['filter']){_0x43eea8[_0x26d8('0x33')]=_['merge'](_0x43eea8[_0x26d8('0x33')],{'$or':_['map'](_0x1ebca2,function(_0x5377b8){if(_0x5377b8[_0x26d8('0x26')]!==_0x26d8('0x35')){var _0x547281={};_0x547281[_0x5377b8[_0x26d8('0x22')]]={'$like':'%'+_0x5e0079[_0x26d8('0x29')]['filter']+'%'};return _0x547281;}})});}_0x43eea8=_[_0x26d8('0x36')]({},_0x43eea8,_0x5e0079[_0x26d8('0x37')]);var _0x55ed1b={'where':_0x43eea8[_0x26d8('0x33')]};return db[_0x26d8('0x38')][_0x26d8('0x19')](_0x55ed1b)[_0x26d8('0x1f')](function(_0xbb015){_0x22b559[_0x26d8('0x19')]=_0xbb015;if(_0x5e0079['query']['includeAll']){_0x43eea8[_0x26d8('0x39')]=[{'all':!![]}];}return db[_0x26d8('0x38')][_0x26d8('0x3a')](_0x43eea8);})['then'](function(_0xcf9021){_0x22b559[_0x26d8('0x3b')]=_0xcf9021;return _0x22b559;})['then'](respondWithFilteredResult(_0x50ef75,_0x43eea8))[_0x26d8('0x3c')](handleError(_0x50ef75,null));};exports[_0x26d8('0x3d')]=function(_0xfffae,_0x547f42){var _0x579c09={'raw':![],'where':{'id':_0xfffae[_0x26d8('0x3e')]['id']}},_0x49c14d={};_0x49c14d[_0x26d8('0x27')]=_[_0x26d8('0x2a')](db[_0x26d8('0x38')][_0x26d8('0x24')]);_0x49c14d['query']=_[_0x26d8('0x2a')](_0xfffae[_0x26d8('0x29')]);_0x49c14d['filters']=_[_0x26d8('0x2d')](_0x49c14d[_0x26d8('0x27')],_0x49c14d[_0x26d8('0x29')]);_0x579c09[_0x26d8('0x2c')]=_[_0x26d8('0x2d')](_0x49c14d[_0x26d8('0x27')],qs[_0x26d8('0x2e')](_0xfffae[_0x26d8('0x29')][_0x26d8('0x2e')]));_0x579c09[_0x26d8('0x2c')]=_0x579c09['attributes'][_0x26d8('0x2f')]?_0x579c09['attributes']:_0x49c14d['model'];if(_0xfffae[_0x26d8('0x29')][_0x26d8('0x3f')]){_0x579c09[_0x26d8('0x39')]=[{'all':!![]}];}_0x579c09=_['merge']({},_0x579c09,_0xfffae['options']);return db['AnalyticFieldReport'][_0x26d8('0x40')](_0x579c09)[_0x26d8('0x1f')](handleEntityNotFound(_0x547f42,null))['then'](respondWithResult(_0x547f42,null))[_0x26d8('0x3c')](handleError(_0x547f42,null));};exports[_0x26d8('0x41')]=function(_0x4d6219,_0x3ec2c8){return db[_0x26d8('0x38')]['create'](_0x4d6219[_0x26d8('0x42')],{})[_0x26d8('0x1f')](respondWithResult(_0x3ec2c8,0xc9))['catch'](handleError(_0x3ec2c8,null));};exports[_0x26d8('0x43')]=function(_0x3c6bd0,_0x3142d6){return db[_0x26d8('0x38')][_0x26d8('0x43')](_0x3c6bd0[_0x26d8('0x42')],{'raw':![],'individualHooks':!![]})[_0x26d8('0x1f')](respondWithResult(_0x3142d6,0xc9))[_0x26d8('0x3c')](handleError(_0x3142d6,null));};exports[_0x26d8('0x44')]=function(_0x4597f0,_0x132c5e){if(_0x4597f0[_0x26d8('0x42')]['id']){delete _0x4597f0[_0x26d8('0x42')]['id'];}return db[_0x26d8('0x38')][_0x26d8('0x40')]({'where':{'id':_0x4597f0[_0x26d8('0x3e')]['id']}})[_0x26d8('0x1f')](handleEntityNotFound(_0x132c5e,null))[_0x26d8('0x1f')](saveUpdates(_0x4597f0[_0x26d8('0x42')],null))['then'](respondWithResult(_0x132c5e,null))['catch'](handleError(_0x132c5e,null));};exports[_0x26d8('0x20')]=function(_0x49d079,_0x2da0d7){return db[_0x26d8('0x38')][_0x26d8('0x40')]({'where':{'id':_0x49d079[_0x26d8('0x3e')]['id']}})[_0x26d8('0x1f')](handleEntityNotFound(_0x2da0d7,null))['then'](removeEntity(_0x2da0d7,null))[_0x26d8('0x3c')](handleError(_0x2da0d7,null));};exports[_0x26d8('0x45')]=function(_0x2d0cb0,_0x2a8938){return db[_0x26d8('0x38')][_0x26d8('0x20')]({'where':{'id':_0x2d0cb0[_0x26d8('0x29')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x26d8('0x1f')](respondWithResult(_0x2a8938,0xcc))[_0x26d8('0x3c')](handleError(_0x2a8938,null));};exports[_0x26d8('0x46')]=function(_0x97b24d,_0xe45afd,_0x1be22f){return db[_0x26d8('0x47')][_0x26d8('0x48')]({'where':{'id':_0x97b24d[_0x26d8('0x3e')]['id']}})[_0x26d8('0x1f')](handleEntityNotFound(_0xe45afd,null))[_0x26d8('0x1f')](function(_0x4036ae){if(_0x4036ae){return db[_0x26d8('0x49')][_0x26d8('0x4a')](function(_0x55f3a1){return db[_0x26d8('0x38')][_0x26d8('0x20')]({'where':{'CustomReportId':_0x97b24d[_0x26d8('0x3e')]['id']},'transaction':_0x55f3a1})['then'](function(_0x37887d){var _0x543fd1=_[_0x26d8('0x28')](_0x97b24d[_0x26d8('0x42')],function(_0x3466d1){delete _0x3466d1['id'];_0x3466d1[_0x26d8('0x4b')]=_0x97b24d[_0x26d8('0x3e')]['id'];return _0x3466d1;});return db[_0x26d8('0x38')][_0x26d8('0x43')](_0x543fd1,{'transaction':_0x55f3a1});});})[_0x26d8('0x1f')](function(){return db[_0x26d8('0x38')][_0x26d8('0x3a')]({'where':{'CustomReportId':_0x97b24d[_0x26d8('0x3e')]['id']}});});}})[_0x26d8('0x1f')](respondWithResult(_0xe45afd,null))['catch'](handleError(_0xe45afd,null));}; \ No newline at end of file +var _0x7e39=['includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','bulkCreate','bulkDestroy','ids','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','moment','mustache','path','fs-extra','lodash','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','AnalyticFieldReport','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x38b11c,_0x550c61){var _0x4aef61=function(_0x512f8f){while(--_0x512f8f){_0x38b11c['push'](_0x38b11c['shift']());}};_0x4aef61(++_0x550c61);}(_0x7e39,0x139));var _0x97e3=function(_0x4b00a6,_0x2838d6){_0x4b00a6=_0x4b00a6-0x0;var _0x11c8eb=_0x7e39[_0x4b00a6];return _0x11c8eb;};'use strict';var emlformat=require(_0x97e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x97e3('0x1'));var jsonpatch=require(_0x97e3('0x2'));var rp=require('request-promise');var moment=require(_0x97e3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x97e3('0x4'));var util=require('util');var path=require(_0x97e3('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97e3('0x6'));var _=require(_0x97e3('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x97e3('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x97e3('0x9'));var querystring=require(_0x97e3('0xa'));var Papa=require('papaparse');var Redis=require(_0x97e3('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x97e3('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97e3('0xd'));var logger=require(_0x97e3('0xe'))('api');var utils=require(_0x97e3('0xf'));var config=require(_0x97e3('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x414ff0,_0x2f9bd6){_0x2f9bd6=_0x2f9bd6||0xcc;return function(_0x160111){if(_0x160111){return _0x414ff0[_0x97e3('0x11')](_0x2f9bd6);}return _0x414ff0[_0x97e3('0x12')](_0x2f9bd6)['end']();};}function respondWithResult(_0x1caec1,_0x28f5fa){_0x28f5fa=_0x28f5fa||0xc8;return function(_0x362982){if(_0x362982){return _0x1caec1[_0x97e3('0x12')](_0x28f5fa)[_0x97e3('0x13')](_0x362982);}};}function respondWithFilteredResult(_0xc52a56,_0x5b9b16){return function(_0x36050c){if(_0x36050c){var _0x25ad3a=typeof _0x5b9b16['offset']===_0x97e3('0x14')&&typeof _0x5b9b16[_0x97e3('0x15')]===_0x97e3('0x14');var _0x30c4ba=_0x36050c['count'];var _0xa2dd90=_0x25ad3a?0x0:_0x5b9b16['offset'];var _0x1a80e2=_0x25ad3a?_0x36050c[_0x97e3('0x16')]:_0x5b9b16[_0x97e3('0x17')]+_0x5b9b16[_0x97e3('0x15')];var _0x2dece5;if(_0x1a80e2>=_0x30c4ba){_0x1a80e2=_0x30c4ba;_0x2dece5=0xc8;}else{_0x2dece5=0xce;}_0xc52a56[_0x97e3('0x12')](_0x2dece5);return _0xc52a56[_0x97e3('0x18')](_0x97e3('0x19'),_0xa2dd90+'-'+_0x1a80e2+'/'+_0x30c4ba)[_0x97e3('0x13')](_0x36050c);}return null;};}function patchUpdates(_0x2c552d){return function(_0x26aec8){try{jsonpatch[_0x97e3('0x1a')](_0x26aec8,_0x2c552d,!![]);}catch(_0x100453){return BPromise[_0x97e3('0x1b')](_0x100453);}return _0x26aec8[_0x97e3('0x1c')]();};}function saveUpdates(_0x320b5c,_0x10ee01){return function(_0x16c989){if(_0x16c989){return _0x16c989[_0x97e3('0x1d')](_0x320b5c)[_0x97e3('0x1e')](function(_0x421471){return _0x421471;});}return null;};}function removeEntity(_0xb87b64,_0x1e612e){return function(_0x2c44bd){if(_0x2c44bd){return _0x2c44bd[_0x97e3('0x1f')]()['then'](function(){_0xb87b64[_0x97e3('0x12')](0xcc)[_0x97e3('0x20')]();});}};}function handleEntityNotFound(_0x26d78c,_0x108a75){return function(_0x4c5c82){if(!_0x4c5c82){_0x26d78c[_0x97e3('0x11')](0x194);}return _0x4c5c82;};}function handleError(_0x1f7529,_0x5645c7){_0x5645c7=_0x5645c7||0x1f4;return function(_0x282411){logger['error'](_0x282411[_0x97e3('0x21')]);if(_0x282411[_0x97e3('0x22')]){delete _0x282411[_0x97e3('0x22')];}_0x1f7529['status'](_0x5645c7)[_0x97e3('0x23')](_0x282411);};}exports['index']=function(_0x41e9dd,_0x27e969){var _0x3b6aeb={},_0x178d81={},_0x9374b7={'count':0x0,'rows':[]};var _0xed114a=_['map'](db[_0x97e3('0x24')]['rawAttributes'],function(_0x3d6093){return{'name':_0x3d6093[_0x97e3('0x25')],'type':_0x3d6093[_0x97e3('0x26')][_0x97e3('0x27')]};});_0x178d81['model']=_[_0x97e3('0x28')](_0xed114a,_0x97e3('0x22'));_0x178d81[_0x97e3('0x29')]=_['keys'](_0x41e9dd[_0x97e3('0x29')]);_0x178d81[_0x97e3('0x2a')]=_[_0x97e3('0x2b')](_0x178d81[_0x97e3('0x2c')],_0x178d81[_0x97e3('0x29')]);_0x3b6aeb['attributes']=_[_0x97e3('0x2b')](_0x178d81[_0x97e3('0x2c')],qs['fields'](_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x2d')]));_0x3b6aeb[_0x97e3('0x2e')]=_0x3b6aeb[_0x97e3('0x2e')][_0x97e3('0x2f')]?_0x3b6aeb[_0x97e3('0x2e')]:_0x178d81[_0x97e3('0x2c')];if(!_0x41e9dd['query'][_0x97e3('0x30')](_0x97e3('0x31'))){_0x3b6aeb[_0x97e3('0x15')]=qs['limit'](_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x15')]);_0x3b6aeb[_0x97e3('0x17')]=qs[_0x97e3('0x17')](_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x17')]);}_0x3b6aeb[_0x97e3('0x32')]=qs[_0x97e3('0x33')](_0x41e9dd['query']['sort']);_0x3b6aeb[_0x97e3('0x34')]=qs[_0x97e3('0x2a')](_[_0x97e3('0x35')](_0x41e9dd[_0x97e3('0x29')],_0x178d81[_0x97e3('0x2a')]),_0xed114a);if(_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x36')]){_0x3b6aeb[_0x97e3('0x34')]=_[_0x97e3('0x37')](_0x3b6aeb['where'],{'$or':_[_0x97e3('0x28')](_0xed114a,function(_0x399fc3){if(_0x399fc3[_0x97e3('0x26')]!=='VIRTUAL'){var _0x535d32={};_0x535d32[_0x399fc3[_0x97e3('0x22')]]={'$like':'%'+_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x36')]+'%'};return _0x535d32;}})});}_0x3b6aeb=_['merge']({},_0x3b6aeb,_0x41e9dd[_0x97e3('0x38')]);var _0x52a382={'where':_0x3b6aeb[_0x97e3('0x34')]};return db[_0x97e3('0x24')][_0x97e3('0x16')](_0x52a382)[_0x97e3('0x1e')](function(_0x2b473a){_0x9374b7['count']=_0x2b473a;if(_0x41e9dd[_0x97e3('0x29')][_0x97e3('0x39')]){_0x3b6aeb[_0x97e3('0x3a')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x97e3('0x3b')](_0x3b6aeb);})[_0x97e3('0x1e')](function(_0xe0612b){_0x9374b7[_0x97e3('0x3c')]=_0xe0612b;return _0x9374b7;})['then'](respondWithFilteredResult(_0x27e969,_0x3b6aeb))[_0x97e3('0x3d')](handleError(_0x27e969,null));};exports[_0x97e3('0x3e')]=function(_0x3970a9,_0x22e18e){var _0x50f258={'raw':![],'where':{'id':_0x3970a9[_0x97e3('0x3f')]['id']}},_0x48b368={};_0x48b368[_0x97e3('0x2c')]=_[_0x97e3('0x40')](db[_0x97e3('0x24')][_0x97e3('0x41')]);_0x48b368['query']=_[_0x97e3('0x40')](_0x3970a9[_0x97e3('0x29')]);_0x48b368[_0x97e3('0x2a')]=_[_0x97e3('0x2b')](_0x48b368[_0x97e3('0x2c')],_0x48b368[_0x97e3('0x29')]);_0x50f258[_0x97e3('0x2e')]=_['intersection'](_0x48b368[_0x97e3('0x2c')],qs['fields'](_0x3970a9[_0x97e3('0x29')][_0x97e3('0x2d')]));_0x50f258['attributes']=_0x50f258[_0x97e3('0x2e')][_0x97e3('0x2f')]?_0x50f258[_0x97e3('0x2e')]:_0x48b368[_0x97e3('0x2c')];if(_0x3970a9['query'][_0x97e3('0x39')]){_0x50f258['include']=[{'all':!![]}];}_0x50f258=_[_0x97e3('0x37')]({},_0x50f258,_0x3970a9[_0x97e3('0x38')]);return db['AnalyticFieldReport'][_0x97e3('0x42')](_0x50f258)['then'](handleEntityNotFound(_0x22e18e,null))[_0x97e3('0x1e')](respondWithResult(_0x22e18e,null))[_0x97e3('0x3d')](handleError(_0x22e18e,null));};exports[_0x97e3('0x43')]=function(_0x46d807,_0x2b1370){return db[_0x97e3('0x24')][_0x97e3('0x43')](_0x46d807[_0x97e3('0x44')],{})[_0x97e3('0x1e')](respondWithResult(_0x2b1370,0xc9))[_0x97e3('0x3d')](handleError(_0x2b1370,null));};exports[_0x97e3('0x45')]=function(_0x138f85,_0x1b6956){return db[_0x97e3('0x24')][_0x97e3('0x45')](_0x138f85[_0x97e3('0x44')],{'raw':![],'individualHooks':!![]})[_0x97e3('0x1e')](respondWithResult(_0x1b6956,0xc9))[_0x97e3('0x3d')](handleError(_0x1b6956,null));};exports[_0x97e3('0x1d')]=function(_0x58960d,_0x45c469){if(_0x58960d['body']['id']){delete _0x58960d['body']['id'];}return db[_0x97e3('0x24')][_0x97e3('0x42')]({'where':{'id':_0x58960d[_0x97e3('0x3f')]['id']}})[_0x97e3('0x1e')](handleEntityNotFound(_0x45c469,null))['then'](saveUpdates(_0x58960d[_0x97e3('0x44')],null))[_0x97e3('0x1e')](respondWithResult(_0x45c469,null))[_0x97e3('0x3d')](handleError(_0x45c469,null));};exports[_0x97e3('0x1f')]=function(_0x2d69d7,_0x4ffebf){return db[_0x97e3('0x24')][_0x97e3('0x42')]({'where':{'id':_0x2d69d7[_0x97e3('0x3f')]['id']}})[_0x97e3('0x1e')](handleEntityNotFound(_0x4ffebf,null))[_0x97e3('0x1e')](removeEntity(_0x4ffebf,null))[_0x97e3('0x3d')](handleError(_0x4ffebf,null));};exports[_0x97e3('0x46')]=function(_0xae9765,_0x276e4b){return db[_0x97e3('0x24')][_0x97e3('0x1f')]({'where':{'id':_0xae9765[_0x97e3('0x29')][_0x97e3('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x97e3('0x1e')](respondWithResult(_0x276e4b,0xcc))[_0x97e3('0x3d')](handleError(_0x276e4b,null));};exports['addFields']=function(_0x14a973,_0x2bbae0,_0x1c759d){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x14a973[_0x97e3('0x3f')]['id']}})[_0x97e3('0x1e')](handleEntityNotFound(_0x2bbae0,null))[_0x97e3('0x1e')](function(_0x9fcce4){if(_0x9fcce4){return db['sequelize'][_0x97e3('0x48')](function(_0xb020b6){return db['AnalyticFieldReport'][_0x97e3('0x1f')]({'where':{'CustomReportId':_0x14a973[_0x97e3('0x3f')]['id']},'transaction':_0xb020b6})[_0x97e3('0x1e')](function(_0x5a3517){var _0x217a9a=_[_0x97e3('0x28')](_0x14a973['body'],function(_0x14450e){delete _0x14450e['id'];_0x14450e[_0x97e3('0x49')]=_0x14a973[_0x97e3('0x3f')]['id'];return _0x14450e;});return db['AnalyticFieldReport'][_0x97e3('0x45')](_0x217a9a,{'transaction':_0xb020b6});});})[_0x97e3('0x1e')](function(){return db[_0x97e3('0x24')][_0x97e3('0x3b')]({'where':{'CustomReportId':_0x14a973[_0x97e3('0x3f')]['id']}});});}})['then'](respondWithResult(_0x2bbae0,null))[_0x97e3('0x3d')](handleError(_0x2bbae0,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 58307cc..7a7d7e5 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 _0xf5d3=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0xf5d3,0xa2));var _0x3f5d=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xf5d3[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require(_0x3f5d('0x0'));var logger=require(_0x3f5d('0x1'))(_0x3f5d('0x2'));var moment=require(_0x3f5d('0x3'));var BPromise=require(_0x3f5d('0x4'));var rp=require(_0x3f5d('0x5'));var fs=require('fs');var path=require(_0x3f5d('0x6'));var rimraf=require(_0x3f5d('0x7'));var config=require(_0x3f5d('0x8'));var attributes=require(_0x3f5d('0x9'));module[_0x3f5d('0xa')]=function(_0x5c509d,_0x579ecc){return _0x5c509d[_0x3f5d('0xb')](_0x3f5d('0xc'),attributes,{'tableName':_0x3f5d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce16=['path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5ad190,_0x202756){var _0x57d479=function(_0x35965b){while(--_0x35965b){_0x5ad190['push'](_0x5ad190['shift']());}};_0x57d479(++_0x202756);}(_0xce16,0x127));var _0x6ce1=function(_0xb16d2d,_0x1cc3af){_0xb16d2d=_0xb16d2d-0x0;var _0x490681=_0xce16[_0xb16d2d];return _0x490681;};'use strict';var _=require('lodash');var util=require(_0x6ce1('0x0'));var logger=require(_0x6ce1('0x1'))(_0x6ce1('0x2'));var moment=require('moment');var BPromise=require(_0x6ce1('0x3'));var rp=require(_0x6ce1('0x4'));var fs=require('fs');var path=require(_0x6ce1('0x5'));var rimraf=require(_0x6ce1('0x6'));var config=require('../../config/environment');var attributes=require(_0x6ce1('0x7'));module[_0x6ce1('0x8')]=function(_0x36e9e0,_0x2d43bf){return _0x36e9e0[_0x6ce1('0x9')](_0x6ce1('0xa'),attributes,{'tableName':_0x6ce1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 38fe0a5..aef6ff1 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 _0x0ad6=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x1c0f43,_0x1ea1d5){var _0x1d7923=function(_0x1c17f8){while(--_0x1c17f8){_0x1c0f43['push'](_0x1c0f43['shift']());}};_0x1d7923(++_0x1ea1d5);}(_0x0ad6,0x1ac));var _0x60ad=function(_0x4c108a,_0x446e7d){_0x4c108a=_0x4c108a-0x0;var _0x402892=_0x0ad6[_0x4c108a];return _0x402892;};'use strict';var _=require(_0x60ad('0x0'));var util=require(_0x60ad('0x1'));var moment=require(_0x60ad('0x2'));var BPromise=require(_0x60ad('0x3'));var rs=require(_0x60ad('0x4'));var fs=require('fs');var Redis=require(_0x60ad('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x60ad('0x6'));var logger=require(_0x60ad('0x7'))(_0x60ad('0x8'));var config=require(_0x60ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x60ad('0xa')][_0x60ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ec0ca,_0x350824,_0x2edfab){return new BPromise(function(_0x5ddcde,_0x4b857b){return client['request'](_0x2ec0ca,_0x2edfab)[_0x60ad('0xc')](function(_0x266db1){logger[_0x60ad('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x350824,'request\x20sent');logger[_0x60ad('0xe')](_0x60ad('0xf'),_0x350824,'request\x20sent',JSON[_0x60ad('0x10')](_0x266db1));if(_0x266db1[_0x60ad('0x11')]){if(_0x266db1[_0x60ad('0x11')][_0x60ad('0x12')]===0x1f4){logger[_0x60ad('0x11')](_0x60ad('0x13'),_0x350824,_0x266db1[_0x60ad('0x11')][_0x60ad('0x14')]);return _0x4b857b(_0x266db1[_0x60ad('0x11')][_0x60ad('0x14')]);}logger[_0x60ad('0x11')](_0x60ad('0x13'),_0x350824,_0x266db1[_0x60ad('0x11')][_0x60ad('0x14')]);return _0x5ddcde(_0x266db1[_0x60ad('0x11')][_0x60ad('0x14')]);}else{logger[_0x60ad('0xd')](_0x60ad('0x13'),_0x350824,_0x60ad('0x15'));_0x5ddcde(_0x266db1[_0x60ad('0x16')][_0x60ad('0x14')]);}})[_0x60ad('0x17')](function(_0x5f454f){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x350824,_0x5f454f);_0x4b857b(_0x5f454f);});});} \ No newline at end of file +var _0xcd5f=['error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x22c4f0,_0x16d813){var _0x1d80f1=function(_0x52ae90){while(--_0x52ae90){_0x22c4f0['push'](_0x22c4f0['shift']());}};_0x1d80f1(++_0x16d813);}(_0xcd5f,0x9f));var _0xfcd5=function(_0x1ec3f4,_0x4508e9){_0x1ec3f4=_0x1ec3f4-0x0;var _0x53102d=_0xcd5f[_0x1ec3f4];return _0x53102d;};'use strict';var _=require(_0xfcd5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfcd5('0x1'));var rs=require(_0xfcd5('0x2'));var fs=require('fs');var Redis=require(_0xfcd5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcd5('0x4'));var logger=require(_0xfcd5('0x5'))(_0xfcd5('0x6'));var config=require(_0xfcd5('0x7'));var jayson=require(_0xfcd5('0x8'));var client=jayson['client'][_0xfcd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x315589,_0x54d4a1,_0x1e02c0){return new BPromise(function(_0xd9fcf7,_0x418c5f){return client['request'](_0x315589,_0x1e02c0)[_0xfcd5('0xa')](function(_0x1de43a){logger[_0xfcd5('0xb')](_0xfcd5('0xc'),_0x54d4a1,_0xfcd5('0xd'));logger[_0xfcd5('0xe')](_0xfcd5('0xf'),_0x54d4a1,_0xfcd5('0xd'),JSON[_0xfcd5('0x10')](_0x1de43a));if(_0x1de43a[_0xfcd5('0x11')]){if(_0x1de43a['error'][_0xfcd5('0x12')]===0x1f4){logger[_0xfcd5('0x11')](_0xfcd5('0xc'),_0x54d4a1,_0x1de43a[_0xfcd5('0x11')][_0xfcd5('0x13')]);return _0x418c5f(_0x1de43a[_0xfcd5('0x11')][_0xfcd5('0x13')]);}logger[_0xfcd5('0x11')](_0xfcd5('0xc'),_0x54d4a1,_0x1de43a[_0xfcd5('0x11')][_0xfcd5('0x13')]);return _0xd9fcf7(_0x1de43a[_0xfcd5('0x11')]['message']);}else{logger[_0xfcd5('0xb')](_0xfcd5('0xc'),_0x54d4a1,_0xfcd5('0xd'));_0xd9fcf7(_0x1de43a[_0xfcd5('0x14')][_0xfcd5('0x13')]);}})[_0xfcd5('0x15')](function(_0x440859){logger[_0xfcd5('0x11')](_0xfcd5('0xc'),_0x54d4a1,_0x440859);_0x418c5f(_0x440859);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 87c0e00..69ccca0 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(_0x39bc02,_0x3e07fd){var _0x48b52f=function(_0x1daf7f){while(--_0x1daf7f){_0x39bc02['push'](_0x39bc02['shift']());}};_0x48b52f(++_0x3e07fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x5bebc5,_0x39bdeb){var _0x538278=function(_0x1fb3cb){while(--_0x1fb3cb){_0x5bebc5['push'](_0x5bebc5['shift']());}};_0x538278(++_0x39bdeb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index e64c4ec..74050f1 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 _0x115a=['name','sequelize','exports','STRING'];(function(_0x1534dc,_0x4981c9){var _0x4b3ffd=function(_0x1695d9){while(--_0x1695d9){_0x1534dc['push'](_0x1534dc['shift']());}};_0x4b3ffd(++_0x4981c9);}(_0x115a,0x91));var _0xa115=function(_0x34bc0b,_0x8675f4){_0x34bc0b=_0x34bc0b-0x0;var _0x2e55ee=_0x115a[_0x34bc0b];return _0x2e55ee;};'use strict';var Sequelize=require(_0xa115('0x0'));module[_0xa115('0x1')]={'name':{'type':Sequelize[_0xa115('0x2')],'allowNull':![],'unique':_0xa115('0x3')},'table':{'type':Sequelize[_0xa115('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xa115('0x2')]}}; \ No newline at end of file +var _0x2f8b=['sequelize','exports','name','STRING','TEXT'];(function(_0x10fe20,_0x4f1268){var _0x4c4fa4=function(_0x3fe46c){while(--_0x3fe46c){_0x10fe20['push'](_0x10fe20['shift']());}};_0x4c4fa4(++_0x4f1268);}(_0x2f8b,0x96));var _0xb2f8=function(_0x3d67e3,_0x1e85ce){_0x3d67e3=_0x3d67e3-0x0;var _0x206293=_0x2f8b[_0x3d67e3];return _0x206293;};'use strict';var Sequelize=require(_0xb2f8('0x0'));module[_0xb2f8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb2f8('0x2')},'table':{'type':Sequelize[_0xb2f8('0x3')]},'metric':{'type':Sequelize[_0xb2f8('0x4')]},'description':{'type':Sequelize[_0xb2f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index ea2bb8c..9ff31d9 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 _0x8d0e=['then','get','Metrics','UserProfileResource','end','sendStatus','error','stack','name','send','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy'];(function(_0x2dcf38,_0x33765a){var _0x2295dc=function(_0x1aff4f){while(--_0x1aff4f){_0x2dcf38['push'](_0x2dcf38['shift']());}};_0x2295dc(++_0x33765a);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x585cab,_0x283958){_0x585cab=_0x585cab-0x0;var _0x19bc84=_0x8d0e[_0x585cab];return _0x19bc84;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){var _0xd86c76=_0x106614[_0xe8d0('0x28')]({'plain':!![]});var _0x149dfd=_0xe8d0('0x29');return db[_0xe8d0('0x2a')][_0xe8d0('0x26')]({'where':{'type':_0x149dfd,'resourceId':_0xd86c76['id']}})[_0xe8d0('0x27')](function(){return _0x106614;});})[_0xe8d0('0x27')](function(){_0x9f747['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0x26dd52,_0x10dec2){return function(_0x486f49){if(!_0x486f49){_0x26dd52[_0xe8d0('0x2c')](0x194);}return _0x486f49;};}function handleError(_0x343b08,_0x526240){_0x526240=_0x526240||0x1f4;return function(_0x1519e2){logger[_0xe8d0('0x2d')](_0x1519e2[_0xe8d0('0x2e')]);if(_0x1519e2[_0xe8d0('0x2f')]){delete _0x1519e2[_0xe8d0('0x2f')];}_0x343b08['status'](_0x526240)[_0xe8d0('0x30')](_0x1519e2);};}exports['index']=function(_0x5d3276,_0x50ad3c){var _0x547a2b={},_0x13cd4c={},_0x36ccec={'count':0x0,'rows':[]};var _0x5151fa=_['map'](db[_0xe8d0('0x31')]['rawAttributes'],function(_0x3b5d31){return{'name':_0x3b5d31[_0xe8d0('0x32')],'type':_0x3b5d31[_0xe8d0('0x33')][_0xe8d0('0x34')]};});_0x13cd4c[_0xe8d0('0x35')]=_['map'](_0x5151fa,_0xe8d0('0x2f'));_0x13cd4c[_0xe8d0('0x36')]=_[_0xe8d0('0x37')](_0x5d3276[_0xe8d0('0x36')]);_0x13cd4c['filters']=_[_0xe8d0('0x38')](_0x13cd4c[_0xe8d0('0x35')],_0x13cd4c['query']);_0x547a2b[_0xe8d0('0x39')]=_['intersection'](_0x13cd4c[_0xe8d0('0x35')],qs['fields'](_0x5d3276[_0xe8d0('0x36')]['fields']));_0x547a2b[_0xe8d0('0x39')]=_0x547a2b[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x547a2b[_0xe8d0('0x39')]:_0x13cd4c['model'];if(!_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x547a2b['limit']=qs[_0xe8d0('0x1e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x1e')]);_0x547a2b[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x5d3276['query'][_0xe8d0('0x1f')]);}_0x547a2b[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3e')]);_0x547a2b[_0xe8d0('0x3f')]=qs[_0xe8d0('0x40')](_[_0xe8d0('0x41')](_0x5d3276['query'],_0x13cd4c['filters']),_0x5151fa);if(_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x42')]){_0x547a2b[_0xe8d0('0x3f')]=_[_0xe8d0('0x43')](_0x547a2b[_0xe8d0('0x3f')],{'$or':_['map'](_0x5151fa,function(_0x2e4362){if(_0x2e4362['type']!==_0xe8d0('0x44')){var _0x458294={};_0x458294[_0x2e4362[_0xe8d0('0x2f')]]={'$like':'%'+_0x5d3276['query'][_0xe8d0('0x42')]+'%'};return _0x458294;}})});}_0x547a2b=_[_0xe8d0('0x43')]({},_0x547a2b,_0x5d3276[_0xe8d0('0x45')]);var _0x230a90={'where':_0x547a2b[_0xe8d0('0x3f')]};return db['AnalyticMetric']['count'](_0x230a90)['then'](function(_0x4cf0da){_0x36ccec[_0xe8d0('0x20')]=_0x4cf0da;if(_0x5d3276['query'][_0xe8d0('0x46')]){_0x547a2b[_0xe8d0('0x47')]=[{'all':!![]}];}return db[_0xe8d0('0x31')][_0xe8d0('0x48')](_0x547a2b);})[_0xe8d0('0x27')](function(_0x1156da){_0x36ccec[_0xe8d0('0x49')]=_0x1156da;return _0x36ccec;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x50ad3c,_0x547a2b))['catch'](handleError(_0x50ad3c,null));};exports[_0xe8d0('0x4a')]=function(_0x1da8b2,_0x4a3740){var _0x4bcdff={'raw':!![],'where':{'id':_0x1da8b2[_0xe8d0('0x4b')]['id']}},_0x3825a1={};_0x3825a1[_0xe8d0('0x35')]=_['keys'](db[_0xe8d0('0x31')][_0xe8d0('0x4c')]);_0x3825a1['query']=_[_0xe8d0('0x37')](_0x1da8b2[_0xe8d0('0x36')]);_0x3825a1['filters']=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],_0x3825a1[_0xe8d0('0x36')]);_0x4bcdff[_0xe8d0('0x39')]=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],qs[_0xe8d0('0x4d')](_0x1da8b2[_0xe8d0('0x36')]['fields']));_0x4bcdff[_0xe8d0('0x39')]=_0x4bcdff[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x4bcdff[_0xe8d0('0x39')]:_0x3825a1[_0xe8d0('0x35')];if(_0x1da8b2[_0xe8d0('0x36')][_0xe8d0('0x46')]){_0x4bcdff[_0xe8d0('0x47')]=[{'all':!![]}];}_0x4bcdff=_[_0xe8d0('0x43')]({},_0x4bcdff,_0x1da8b2[_0xe8d0('0x45')]);return db[_0xe8d0('0x31')][_0xe8d0('0x4e')](_0x4bcdff)['then'](handleEntityNotFound(_0x4a3740,null))[_0xe8d0('0x27')](respondWithResult(_0x4a3740,null))[_0xe8d0('0x4f')](handleError(_0x4a3740,null));};exports[_0xe8d0('0x50')]=function(_0xad7d94,_0x34047c){return db[_0xe8d0('0x31')][_0xe8d0('0x50')](_0xad7d94['body'],{})[_0xe8d0('0x27')](function(_0x424764){var _0x151cf4=_0xad7d94[_0xe8d0('0x51')]['get']({'plain':!![]});if(!_0x151cf4)throw new Error(_0xe8d0('0x52'));if(_0x151cf4['role']===_0xe8d0('0x51')){var _0x382ae9=_0x424764[_0xe8d0('0x28')]({'plain':!![]});var _0x158d24=_0xe8d0('0x29');return db[_0xe8d0('0x53')][_0xe8d0('0x4e')]({'where':{'name':_0x158d24,'userProfileId':_0x151cf4['userProfileId']},'raw':!![]})[_0xe8d0('0x27')](function(_0x55f93d){if(_0x55f93d&&_0x55f93d['autoAssociation']===0x0){return db[_0xe8d0('0x2a')]['create']({'name':_0x382ae9[_0xe8d0('0x2f')],'resourceId':_0x382ae9['id'],'type':_0x55f93d['name'],'sectionId':_0x55f93d['id']},{})[_0xe8d0('0x27')](function(){return _0x424764;});}else{return _0x424764;}})[_0xe8d0('0x4f')](function(_0x13713c){logger[_0xe8d0('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13713c);throw _0x13713c;});}return _0x424764;})[_0xe8d0('0x27')](respondWithResult(_0x34047c,0xc9))[_0xe8d0('0x4f')](handleError(_0x34047c,null));};exports[_0xe8d0('0x25')]=function(_0x2e3f1d,_0x18cc14){if(_0x2e3f1d['body']['id']){delete _0x2e3f1d[_0xe8d0('0x54')]['id'];}return db[_0xe8d0('0x31')][_0xe8d0('0x4e')]({'where':{'id':_0x2e3f1d['params']['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x18cc14,null))['then'](saveUpdates(_0x2e3f1d['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x18cc14,null))[_0xe8d0('0x4f')](handleError(_0x18cc14,null));};exports['destroy']=function(_0xcb6ce2,_0x3a8074){return db['AnalyticMetric'][_0xe8d0('0x4e')]({'where':{'id':_0xcb6ce2[_0xe8d0('0x4b')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x3a8074,null))[_0xe8d0('0x27')](removeEntity(_0x3a8074,null))['catch'](handleError(_0x3a8074,null));}; \ No newline at end of file +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5dd5ff,_0x331d18){var _0x127436=function(_0xf47f62){while(--_0xf47f62){_0x5dd5ff['push'](_0x5dd5ff['shift']());}};_0x127436(++_0x331d18);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x146dd7,_0x4d877d){_0x146dd7=_0x146dd7-0x0;var _0x2af0bb=_0xf2ca[_0x146dd7];return _0x2af0bb;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d462a9d..e75505c 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 _0x06bf=['bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x06bf,0x105));var _0xf06b=function(_0x282e8c,_0x2f9461){_0x282e8c=_0x282e8c-0x0;var _0x305a28=_0x06bf[_0x282e8c];return _0x305a28;};'use strict';var _=require(_0xf06b('0x0'));var util=require(_0xf06b('0x1'));var logger=require(_0xf06b('0x2'))(_0xf06b('0x3'));var moment=require(_0xf06b('0x4'));var BPromise=require(_0xf06b('0x5'));var rp=require(_0xf06b('0x6'));var fs=require('fs');var path=require(_0xf06b('0x7'));var rimraf=require('rimraf');var config=require(_0xf06b('0x8'));var attributes=require(_0xf06b('0x9'));module[_0xf06b('0xa')]=function(_0x502d7f,_0x2f1d0e){return _0x502d7f[_0xf06b('0xb')](_0xf06b('0xc'),attributes,{'tableName':_0xf06b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a4f=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1f16f9,_0x470806){var _0x513bf3=function(_0x142e64){while(--_0x142e64){_0x1f16f9['push'](_0x1f16f9['shift']());}};_0x513bf3(++_0x470806);}(_0x5a4f,0x10d));var _0xf5a4=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x5a4f[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0xf5a4('0x0'));var util=require('util');var logger=require(_0xf5a4('0x1'))('api');var moment=require(_0xf5a4('0x2'));var BPromise=require('bluebird');var rp=require(_0xf5a4('0x3'));var fs=require('fs');var path=require(_0xf5a4('0x4'));var rimraf=require(_0xf5a4('0x5'));var config=require(_0xf5a4('0x6'));var attributes=require(_0xf5a4('0x7'));module[_0xf5a4('0x8')]=function(_0x431162,_0x5d2a8c){return _0x431162[_0xf5a4('0x9')](_0xf5a4('0xa'),attributes,{'tableName':_0xf5a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 52980d1..d52df78 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 _0xe1d3=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','AnalyticMetric,\x20%s,\x20%s'];(function(_0x3de2b5,_0x58c151){var _0x1a62b9=function(_0x2303f3){while(--_0x2303f3){_0x3de2b5['push'](_0x3de2b5['shift']());}};_0x1a62b9(++_0x58c151);}(_0xe1d3,0x1ed));var _0x3e1d=function(_0x4b599c,_0x1bd79d){_0x4b599c=_0x4b599c-0x0;var _0x23cebf=_0xe1d3[_0x4b599c];return _0x23cebf;};'use strict';var _=require('lodash');var util=require(_0x3e1d('0x0'));var moment=require(_0x3e1d('0x1'));var BPromise=require(_0x3e1d('0x2'));var rs=require(_0x3e1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1d('0x5'))('rpc');var config=require(_0x3e1d('0x6'));var jayson=require(_0x3e1d('0x7'));var client=jayson['client'][_0x3e1d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51171d,_0x57443a,_0x55e3b4){return new BPromise(function(_0x28ae50,_0x1505ce){return client[_0x3e1d('0x9')](_0x51171d,_0x55e3b4)['then'](function(_0x408bb4){logger['info'](_0x3e1d('0xa'),_0x57443a,_0x3e1d('0xb'));logger[_0x3e1d('0xc')](_0x3e1d('0xd'),_0x57443a,_0x3e1d('0xb'),JSON[_0x3e1d('0xe')](_0x408bb4));if(_0x408bb4[_0x3e1d('0xf')]){if(_0x408bb4[_0x3e1d('0xf')][_0x3e1d('0x10')]===0x1f4){logger[_0x3e1d('0xf')](_0x3e1d('0xa'),_0x57443a,_0x408bb4[_0x3e1d('0xf')][_0x3e1d('0x11')]);return _0x1505ce(_0x408bb4[_0x3e1d('0xf')][_0x3e1d('0x11')]);}logger[_0x3e1d('0xf')](_0x3e1d('0xa'),_0x57443a,_0x408bb4['error'][_0x3e1d('0x11')]);return _0x28ae50(_0x408bb4[_0x3e1d('0xf')][_0x3e1d('0x11')]);}else{logger[_0x3e1d('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x57443a,_0x3e1d('0xb'));_0x28ae50(_0x408bb4[_0x3e1d('0x13')][_0x3e1d('0x11')]);}})[_0x3e1d('0x14')](function(_0x247cee){logger[_0x3e1d('0xf')](_0x3e1d('0xa'),_0x57443a,_0x247cee);_0x1505ce(_0x247cee);});});} \ No newline at end of file +var _0x9ef1=['message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ef1,0xbd));var _0x19ef=function(_0x257996,_0x31432b){_0x257996=_0x257996-0x0;var _0x531817=_0x9ef1[_0x257996];return _0x531817;};'use strict';var _=require(_0x19ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x19ef('0x1'));var rs=require(_0x19ef('0x2'));var fs=require('fs');var Redis=require(_0x19ef('0x3'));var db=require(_0x19ef('0x4'))['db'];var utils=require(_0x19ef('0x5'));var logger=require(_0x19ef('0x6'))(_0x19ef('0x7'));var config=require('../../config/environment');var jayson=require(_0x19ef('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x598f0a,_0x437b50,_0x377716){return new BPromise(function(_0x34ba14,_0x342168){return client[_0x19ef('0x9')](_0x598f0a,_0x377716)[_0x19ef('0xa')](function(_0x4f6e0a){logger[_0x19ef('0xb')](_0x19ef('0xc'),_0x437b50,_0x19ef('0xd'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x437b50,_0x19ef('0xd'),JSON['stringify'](_0x4f6e0a));if(_0x4f6e0a['error']){if(_0x4f6e0a[_0x19ef('0xe')]['code']===0x1f4){logger[_0x19ef('0xe')](_0x19ef('0xc'),_0x437b50,_0x4f6e0a[_0x19ef('0xe')][_0x19ef('0xf')]);return _0x342168(_0x4f6e0a[_0x19ef('0xe')][_0x19ef('0xf')]);}logger[_0x19ef('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x437b50,_0x4f6e0a['error']['message']);return _0x34ba14(_0x4f6e0a[_0x19ef('0xe')][_0x19ef('0xf')]);}else{logger[_0x19ef('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x437b50,_0x19ef('0xd'));_0x34ba14(_0x4f6e0a[_0x19ef('0x10')][_0x19ef('0xf')]);}})['catch'](function(_0x148191){logger[_0x19ef('0xe')](_0x19ef('0xc'),_0x437b50,_0x148191);_0x342168(_0x148191);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d190445..60fb61f 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 _0xfd87=['put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','/:id','show','post'];(function(_0x51b42e,_0x8dea09){var _0x43ed23=function(_0x2de749){while(--_0x2de749){_0x51b42e['push'](_0x51b42e['shift']());}};_0x43ed23(++_0x8dea09);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var path=require(_0x7fd8('0x2'));var timeout=require(_0x7fd8('0x3'));var express=require(_0x7fd8('0x4'));var router=express[_0x7fd8('0x5')]();var fs_extra=require(_0x7fd8('0x6'));var auth=require(_0x7fd8('0x7'));var interaction=require(_0x7fd8('0x8'));var config=require(_0x7fd8('0x9'));var controller=require(_0x7fd8('0xa'));router['get']('/',auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xc')]);router['get'](_0x7fd8('0xd'),auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xe')]);router[_0x7fd8('0xf')]('/',auth[_0x7fd8('0xb')](),controller['create']);router[_0x7fd8('0x10')](_0x7fd8('0xd'),auth[_0x7fd8('0xb')](),controller['update']);router['delete']('/:id',auth[_0x7fd8('0xb')](),controller['destroy']);module[_0x7fd8('0x11')]=router; \ No newline at end of file +var _0x34f8=['../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x179d7e,_0x135be3){var _0x272c4d=function(_0x24635f){while(--_0x24635f){_0x179d7e['push'](_0x179d7e['shift']());}};_0x272c4d(++_0x135be3);}(_0x34f8,0x80));var _0x834f=function(_0x380baf,_0x48ef8b){_0x380baf=_0x380baf-0x0;var _0x5812cb=_0x34f8[_0x380baf];return _0x5812cb;};'use strict';var multer=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var path=require(_0x834f('0x2'));var timeout=require(_0x834f('0x3'));var express=require(_0x834f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x834f('0x5'));var interaction=require(_0x834f('0x6'));var config=require('../../config/environment');var controller=require(_0x834f('0x7'));router[_0x834f('0x8')]('/',auth[_0x834f('0x9')](),controller[_0x834f('0xa')]);router['get']('/:id',auth[_0x834f('0x9')](),controller[_0x834f('0xb')]);router[_0x834f('0xc')]('/',auth[_0x834f('0x9')](),controller['create']);router[_0x834f('0xd')](_0x834f('0xe'),auth['isAuthenticated'](),controller[_0x834f('0xf')]);router[_0x834f('0x10')](_0x834f('0xe'),auth[_0x834f('0x9')](),controller[_0x834f('0x11')]);module[_0x834f('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 242862b..c74a5cd 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 _0x0ae2=['sequelize','exports'];(function(_0x123bec,_0x471832){var _0x2e835c=function(_0x3e957c){while(--_0x3e957c){_0x123bec['push'](_0x123bec['shift']());}};_0x2e835c(++_0x471832);}(_0x0ae2,0xa8));var _0x20ae=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0x0ae2[_0x160248];return _0x4e589d;};'use strict';var Sequelize=require(_0x20ae('0x0'));module[_0x20ae('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x0601=['exports','TEXT','sequelize'];(function(_0x308c59,_0x2ae2cd){var _0x2e372a=function(_0x5eaf85){while(--_0x5eaf85){_0x308c59['push'](_0x308c59['shift']());}};_0x2e372a(++_0x2ae2cd);}(_0x0601,0x6b));var _0x1060=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x0601[_0x172ed7];return _0xfa8f61;};'use strict';var Sequelize=require(_0x1060('0x0'));module[_0x1060('0x1')]={'tree':{'type':Sequelize[_0x1060('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 0a40c3a..cff3cc5 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 _0x487b=['update','destroy','stack','send','index','rawAttributes','fieldName','key','map','name','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','merge','where','VIRTUAL','filter','AnalyticTreeReport','then','includeAll','catch','show','params','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x487b,0x74));var _0xb487=function(_0x3197f6,_0x159a1c){_0x3197f6=_0x3197f6-0x0;var _0x121860=_0x487b[_0x3197f6];return _0x121860;};'use strict';var emlformat=require(_0xb487('0x0'));var rimraf=require(_0xb487('0x1'));var zipdir=require(_0xb487('0x2'));var jsonpatch=require(_0xb487('0x3'));var rp=require(_0xb487('0x4'));var moment=require(_0xb487('0x5'));var BPromise=require(_0xb487('0x6'));var Mustache=require(_0xb487('0x7'));var util=require(_0xb487('0x8'));var path=require(_0xb487('0x9'));var sox=require(_0xb487('0xa'));var csv=require('to-csv');var ejs=require(_0xb487('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb487('0xc'));var jsforce=require(_0xb487('0xd'));var deskjs=require(_0xb487('0xe'));var toCsv=require(_0xb487('0xf'));var querystring=require(_0xb487('0x10'));var Papa=require(_0xb487('0x11'));var Redis=require(_0xb487('0x12'));var authService=require(_0xb487('0x13'));var qs=require(_0xb487('0x14'));var as=require(_0xb487('0x15'));var hardwareService=require(_0xb487('0x16'));var logger=require(_0xb487('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xb487('0x18'));var licenseUtil=require(_0xb487('0x19'));var db=require(_0xb487('0x1a'))['db'];function respondWithStatusCode(_0xae51d3,_0x4e40b0){_0x4e40b0=_0x4e40b0||0xcc;return function(_0xced649){if(_0xced649){return _0xae51d3[_0xb487('0x1b')](_0x4e40b0);}return _0xae51d3[_0xb487('0x1c')](_0x4e40b0)[_0xb487('0x1d')]();};}function respondWithResult(_0x129721,_0x1c0be3){_0x1c0be3=_0x1c0be3||0xc8;return function(_0x51fc80){if(_0x51fc80){return _0x129721[_0xb487('0x1c')](_0x1c0be3)['json'](_0x51fc80);}};}function respondWithFilteredResult(_0x2886f6,_0x2ce7c7){return function(_0x528621){if(_0x528621){var _0x182cf3=typeof _0x2ce7c7[_0xb487('0x1e')]===_0xb487('0x1f')&&typeof _0x2ce7c7[_0xb487('0x20')]===_0xb487('0x1f');var _0x594f8f=_0x528621[_0xb487('0x21')];var _0x260027=_0x182cf3?0x0:_0x2ce7c7['offset'];var _0x372316=_0x182cf3?_0x528621['count']:_0x2ce7c7[_0xb487('0x1e')]+_0x2ce7c7[_0xb487('0x20')];var _0x58891e;if(_0x372316>=_0x594f8f){_0x372316=_0x594f8f;_0x58891e=0xc8;}else{_0x58891e=0xce;}_0x2886f6['status'](_0x58891e);return _0x2886f6[_0xb487('0x22')](_0xb487('0x23'),_0x260027+'-'+_0x372316+'/'+_0x594f8f)[_0xb487('0x24')](_0x528621);}return null;};}function patchUpdates(_0xe02a4a){return function(_0x51b08d){try{jsonpatch[_0xb487('0x25')](_0x51b08d,_0xe02a4a,!![]);}catch(_0x3c4e6a){return BPromise[_0xb487('0x26')](_0x3c4e6a);}return _0x51b08d[_0xb487('0x27')]();};}function saveUpdates(_0x53a5cc,_0x49b342){return function(_0x1b6042){if(_0x1b6042){return _0x1b6042[_0xb487('0x28')](_0x53a5cc)['then'](function(_0x4120){return _0x4120;});}return null;};}function removeEntity(_0x36de72,_0x143ddf){return function(_0x53a8a6){if(_0x53a8a6){return _0x53a8a6[_0xb487('0x29')]()['then'](function(){_0x36de72['status'](0xcc)[_0xb487('0x1d')]();});}};}function handleEntityNotFound(_0x2e75f7,_0x2dc653){return function(_0x292e4d){if(!_0x292e4d){_0x2e75f7[_0xb487('0x1b')](0x194);}return _0x292e4d;};}function handleError(_0x4b7d7c,_0x26e434){_0x26e434=_0x26e434||0x1f4;return function(_0x336ab9){logger['error'](_0x336ab9[_0xb487('0x2a')]);if(_0x336ab9['name']){delete _0x336ab9['name'];}_0x4b7d7c[_0xb487('0x1c')](_0x26e434)[_0xb487('0x2b')](_0x336ab9);};}exports[_0xb487('0x2c')]=function(_0x40bb05,_0x1af1b9){var _0x15551d={},_0x477d35={},_0x1bc9bd={'count':0x0,'rows':[]};var _0x2fcfb9=_['map'](db['AnalyticTreeReport'][_0xb487('0x2d')],function(_0x472081){return{'name':_0x472081[_0xb487('0x2e')],'type':_0x472081['type'][_0xb487('0x2f')]};});_0x477d35['model']=_[_0xb487('0x30')](_0x2fcfb9,_0xb487('0x31'));_0x477d35[_0xb487('0x32')]=_[_0xb487('0x33')](_0x40bb05[_0xb487('0x32')]);_0x477d35['filters']=_[_0xb487('0x34')](_0x477d35['model'],_0x477d35[_0xb487('0x32')]);_0x15551d[_0xb487('0x35')]=_[_0xb487('0x34')](_0x477d35[_0xb487('0x36')],qs[_0xb487('0x37')](_0x40bb05[_0xb487('0x32')][_0xb487('0x37')]));_0x15551d[_0xb487('0x35')]=_0x15551d[_0xb487('0x35')][_0xb487('0x38')]?_0x15551d['attributes']:_0x477d35[_0xb487('0x36')];if(!_0x40bb05[_0xb487('0x32')][_0xb487('0x39')](_0xb487('0x3a'))){_0x15551d[_0xb487('0x20')]=qs['limit'](_0x40bb05[_0xb487('0x32')][_0xb487('0x20')]);_0x15551d[_0xb487('0x1e')]=qs[_0xb487('0x1e')](_0x40bb05[_0xb487('0x32')][_0xb487('0x1e')]);}_0x15551d[_0xb487('0x3b')]=qs[_0xb487('0x3c')](_0x40bb05['query'][_0xb487('0x3c')]);_0x15551d['where']=qs['filters'](_[_0xb487('0x3d')](_0x40bb05[_0xb487('0x32')],_0x477d35[_0xb487('0x3e')]),_0x2fcfb9);if(_0x40bb05[_0xb487('0x32')]['filter']){_0x15551d['where']=_[_0xb487('0x3f')](_0x15551d[_0xb487('0x40')],{'$or':_[_0xb487('0x30')](_0x2fcfb9,function(_0x4fb3b4){if(_0x4fb3b4['type']!==_0xb487('0x41')){var _0x5c0799={};_0x5c0799[_0x4fb3b4['name']]={'$like':'%'+_0x40bb05[_0xb487('0x32')][_0xb487('0x42')]+'%'};return _0x5c0799;}})});}_0x15551d=_['merge']({},_0x15551d,_0x40bb05['options']);var _0x560e9d={'where':_0x15551d[_0xb487('0x40')]};return db[_0xb487('0x43')][_0xb487('0x21')](_0x560e9d)[_0xb487('0x44')](function(_0x10b39b){_0x1bc9bd['count']=_0x10b39b;if(_0x40bb05['query'][_0xb487('0x45')]){_0x15551d['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x15551d);})[_0xb487('0x44')](function(_0x45f72d){_0x1bc9bd['rows']=_0x45f72d;return _0x1bc9bd;})[_0xb487('0x44')](respondWithFilteredResult(_0x1af1b9,_0x15551d))[_0xb487('0x46')](handleError(_0x1af1b9,null));};exports[_0xb487('0x47')]=function(_0x4c6266,_0x2b80e1){var _0x375850={'raw':!![],'where':{'id':_0x4c6266[_0xb487('0x48')]['id']}},_0x37cb1f={};_0x37cb1f[_0xb487('0x36')]=_[_0xb487('0x33')](db[_0xb487('0x43')][_0xb487('0x2d')]);_0x37cb1f['query']=_['keys'](_0x4c6266[_0xb487('0x32')]);_0x37cb1f['filters']=_[_0xb487('0x34')](_0x37cb1f[_0xb487('0x36')],_0x37cb1f[_0xb487('0x32')]);_0x375850[_0xb487('0x35')]=_[_0xb487('0x34')](_0x37cb1f[_0xb487('0x36')],qs[_0xb487('0x37')](_0x4c6266[_0xb487('0x32')][_0xb487('0x37')]));_0x375850[_0xb487('0x35')]=_0x375850[_0xb487('0x35')][_0xb487('0x38')]?_0x375850['attributes']:_0x37cb1f[_0xb487('0x36')];if(_0x4c6266[_0xb487('0x32')][_0xb487('0x45')]){_0x375850[_0xb487('0x49')]=[{'all':!![]}];}_0x375850=_['merge']({},_0x375850,_0x4c6266[_0xb487('0x4a')]);return db[_0xb487('0x43')][_0xb487('0x4b')](_0x375850)[_0xb487('0x44')](handleEntityNotFound(_0x2b80e1,null))[_0xb487('0x44')](respondWithResult(_0x2b80e1,null))['catch'](handleError(_0x2b80e1,null));};exports['create']=function(_0x379526,_0x5061ee){return db['AnalyticTreeReport'][_0xb487('0x4c')](_0x379526[_0xb487('0x4d')],{})[_0xb487('0x44')](respondWithResult(_0x5061ee,0xc9))['catch'](handleError(_0x5061ee,null));};exports[_0xb487('0x28')]=function(_0x201bdf,_0x4505d1){if(_0x201bdf['body']['id']){delete _0x201bdf[_0xb487('0x4d')]['id'];}return db[_0xb487('0x43')][_0xb487('0x4b')]({'where':{'id':_0x201bdf[_0xb487('0x48')]['id']}})['then'](handleEntityNotFound(_0x4505d1,null))[_0xb487('0x44')](saveUpdates(_0x201bdf[_0xb487('0x4d')],null))['then'](respondWithResult(_0x4505d1,null))['catch'](handleError(_0x4505d1,null));};exports[_0xb487('0x29')]=function(_0x548bd1,_0x546614){return db[_0xb487('0x43')][_0xb487('0x4b')]({'where':{'id':_0x548bd1['params']['id']}})[_0xb487('0x44')](handleEntityNotFound(_0x546614,null))[_0xb487('0x44')](removeEntity(_0x546614,null))[_0xb487('0x46')](handleError(_0x546614,null));}; \ No newline at end of file +var _0xd3ce=['rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','params','includeAll','find','catch','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','name','index','map','AnalyticTreeReport'];(function(_0xd4f75c,_0xa2b00){var _0x55844e=function(_0x4b413d){while(--_0x4b413d){_0xd4f75c['push'](_0xd4f75c['shift']());}};_0x55844e(++_0xa2b00);}(_0xd3ce,0xaa));var _0xed3c=function(_0x32eb37,_0x958bf1){_0x32eb37=_0x32eb37-0x0;var _0x16cf63=_0xd3ce[_0x32eb37];return _0x16cf63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed3c('0x0'));var zipdir=require(_0xed3c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed3c('0x2'));var moment=require(_0xed3c('0x3'));var BPromise=require(_0xed3c('0x4'));var Mustache=require(_0xed3c('0x5'));var util=require('util');var path=require(_0xed3c('0x6'));var sox=require(_0xed3c('0x7'));var csv=require(_0xed3c('0x8'));var ejs=require(_0xed3c('0x9'));var fs=require('fs');var fs_extra=require(_0xed3c('0xa'));var _=require(_0xed3c('0xb'));var squel=require(_0xed3c('0xc'));var crypto=require('crypto');var jsforce=require(_0xed3c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed3c('0xe'));var Papa=require('papaparse');var Redis=require(_0xed3c('0xf'));var authService=require(_0xed3c('0x10'));var qs=require(_0xed3c('0x11'));var as=require(_0xed3c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed3c('0x13'))('api');var utils=require(_0xed3c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xed3c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17c9a7,_0x264b69){_0x264b69=_0x264b69||0xcc;return function(_0x5998f6){if(_0x5998f6){return _0x17c9a7[_0xed3c('0x16')](_0x264b69);}return _0x17c9a7[_0xed3c('0x17')](_0x264b69)['end']();};}function respondWithResult(_0x4c6ee0,_0x69d8a7){_0x69d8a7=_0x69d8a7||0xc8;return function(_0x9f7136){if(_0x9f7136){return _0x4c6ee0['status'](_0x69d8a7)[_0xed3c('0x18')](_0x9f7136);}};}function respondWithFilteredResult(_0x3e04dd,_0xb1767){return function(_0x245cd7){if(_0x245cd7){var _0x13cc15=typeof _0xb1767['offset']===_0xed3c('0x19')&&typeof _0xb1767['limit']===_0xed3c('0x19');var _0x59e905=_0x245cd7[_0xed3c('0x1a')];var _0x546076=_0x13cc15?0x0:_0xb1767['offset'];var _0x368653=_0x13cc15?_0x245cd7[_0xed3c('0x1a')]:_0xb1767[_0xed3c('0x1b')]+_0xb1767['limit'];var _0x3070d9;if(_0x368653>=_0x59e905){_0x368653=_0x59e905;_0x3070d9=0xc8;}else{_0x3070d9=0xce;}_0x3e04dd[_0xed3c('0x17')](_0x3070d9);return _0x3e04dd[_0xed3c('0x1c')]('Content-Range',_0x546076+'-'+_0x368653+'/'+_0x59e905)[_0xed3c('0x18')](_0x245cd7);}return null;};}function patchUpdates(_0x1dbe7e){return function(_0x5d920d){try{jsonpatch[_0xed3c('0x1d')](_0x5d920d,_0x1dbe7e,!![]);}catch(_0x8cef1d){return BPromise[_0xed3c('0x1e')](_0x8cef1d);}return _0x5d920d[_0xed3c('0x1f')]();};}function saveUpdates(_0x34afd0,_0x1b86ba){return function(_0x4f41a5){if(_0x4f41a5){return _0x4f41a5[_0xed3c('0x20')](_0x34afd0)[_0xed3c('0x21')](function(_0x263ad5){return _0x263ad5;});}return null;};}function removeEntity(_0x222185,_0x3947f6){return function(_0x34ba4e){if(_0x34ba4e){return _0x34ba4e[_0xed3c('0x22')]()[_0xed3c('0x21')](function(){_0x222185[_0xed3c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2143be,_0x48003b){return function(_0x3b9f52){if(!_0x3b9f52){_0x2143be[_0xed3c('0x16')](0x194);}return _0x3b9f52;};}function handleError(_0x526dda,_0x3ed8d4){_0x3ed8d4=_0x3ed8d4||0x1f4;return function(_0x358e40){logger[_0xed3c('0x23')](_0x358e40['stack']);if(_0x358e40[_0xed3c('0x24')]){delete _0x358e40[_0xed3c('0x24')];}_0x526dda[_0xed3c('0x17')](_0x3ed8d4)['send'](_0x358e40);};}exports[_0xed3c('0x25')]=function(_0x223733,_0x3b4985){var _0x5767af={},_0x2bacbc={},_0x40949f={'count':0x0,'rows':[]};var _0x1f2e0a=_[_0xed3c('0x26')](db[_0xed3c('0x27')][_0xed3c('0x28')],function(_0x535611){return{'name':_0x535611['fieldName'],'type':_0x535611[_0xed3c('0x29')][_0xed3c('0x2a')]};});_0x2bacbc[_0xed3c('0x2b')]=_[_0xed3c('0x26')](_0x1f2e0a,_0xed3c('0x24'));_0x2bacbc['query']=_[_0xed3c('0x2c')](_0x223733[_0xed3c('0x2d')]);_0x2bacbc[_0xed3c('0x2e')]=_[_0xed3c('0x2f')](_0x2bacbc[_0xed3c('0x2b')],_0x2bacbc[_0xed3c('0x2d')]);_0x5767af[_0xed3c('0x30')]=_[_0xed3c('0x2f')](_0x2bacbc['model'],qs[_0xed3c('0x31')](_0x223733[_0xed3c('0x2d')][_0xed3c('0x31')]));_0x5767af[_0xed3c('0x30')]=_0x5767af['attributes'][_0xed3c('0x32')]?_0x5767af[_0xed3c('0x30')]:_0x2bacbc[_0xed3c('0x2b')];if(!_0x223733['query'][_0xed3c('0x33')](_0xed3c('0x34'))){_0x5767af[_0xed3c('0x35')]=qs[_0xed3c('0x35')](_0x223733[_0xed3c('0x2d')][_0xed3c('0x35')]);_0x5767af[_0xed3c('0x1b')]=qs[_0xed3c('0x1b')](_0x223733['query'][_0xed3c('0x1b')]);}_0x5767af['order']=qs[_0xed3c('0x36')](_0x223733['query'][_0xed3c('0x36')]);_0x5767af[_0xed3c('0x37')]=qs[_0xed3c('0x2e')](_[_0xed3c('0x38')](_0x223733[_0xed3c('0x2d')],_0x2bacbc[_0xed3c('0x2e')]),_0x1f2e0a);if(_0x223733[_0xed3c('0x2d')][_0xed3c('0x39')]){_0x5767af['where']=_['merge'](_0x5767af['where'],{'$or':_['map'](_0x1f2e0a,function(_0x117e1a){if(_0x117e1a['type']!==_0xed3c('0x3a')){var _0x4b83e7={};_0x4b83e7[_0x117e1a['name']]={'$like':'%'+_0x223733[_0xed3c('0x2d')]['filter']+'%'};return _0x4b83e7;}})});}_0x5767af=_[_0xed3c('0x3b')]({},_0x5767af,_0x223733[_0xed3c('0x3c')]);var _0x3a96de={'where':_0x5767af['where']};return db['AnalyticTreeReport'][_0xed3c('0x1a')](_0x3a96de)[_0xed3c('0x21')](function(_0x266ab8){_0x40949f['count']=_0x266ab8;if(_0x223733['query']['includeAll']){_0x5767af[_0xed3c('0x3d')]=[{'all':!![]}];}return db[_0xed3c('0x27')][_0xed3c('0x3e')](_0x5767af);})[_0xed3c('0x21')](function(_0x3d68e7){_0x40949f['rows']=_0x3d68e7;return _0x40949f;})[_0xed3c('0x21')](respondWithFilteredResult(_0x3b4985,_0x5767af))['catch'](handleError(_0x3b4985,null));};exports[_0xed3c('0x3f')]=function(_0x4a1036,_0x1f4a5d){var _0x3a81e4={'raw':!![],'where':{'id':_0x4a1036[_0xed3c('0x40')]['id']}},_0x4d0862={};_0x4d0862[_0xed3c('0x2b')]=_[_0xed3c('0x2c')](db[_0xed3c('0x27')]['rawAttributes']);_0x4d0862[_0xed3c('0x2d')]=_[_0xed3c('0x2c')](_0x4a1036[_0xed3c('0x2d')]);_0x4d0862[_0xed3c('0x2e')]=_[_0xed3c('0x2f')](_0x4d0862[_0xed3c('0x2b')],_0x4d0862['query']);_0x3a81e4[_0xed3c('0x30')]=_[_0xed3c('0x2f')](_0x4d0862[_0xed3c('0x2b')],qs[_0xed3c('0x31')](_0x4a1036[_0xed3c('0x2d')][_0xed3c('0x31')]));_0x3a81e4[_0xed3c('0x30')]=_0x3a81e4[_0xed3c('0x30')][_0xed3c('0x32')]?_0x3a81e4['attributes']:_0x4d0862[_0xed3c('0x2b')];if(_0x4a1036[_0xed3c('0x2d')][_0xed3c('0x41')]){_0x3a81e4[_0xed3c('0x3d')]=[{'all':!![]}];}_0x3a81e4=_[_0xed3c('0x3b')]({},_0x3a81e4,_0x4a1036['options']);return db[_0xed3c('0x27')][_0xed3c('0x42')](_0x3a81e4)[_0xed3c('0x21')](handleEntityNotFound(_0x1f4a5d,null))[_0xed3c('0x21')](respondWithResult(_0x1f4a5d,null))[_0xed3c('0x43')](handleError(_0x1f4a5d,null));};exports[_0xed3c('0x44')]=function(_0x396533,_0x5cdc72){return db[_0xed3c('0x27')][_0xed3c('0x44')](_0x396533[_0xed3c('0x45')],{})[_0xed3c('0x21')](respondWithResult(_0x5cdc72,0xc9))[_0xed3c('0x43')](handleError(_0x5cdc72,null));};exports[_0xed3c('0x20')]=function(_0x2dbf4b,_0x436dce){if(_0x2dbf4b[_0xed3c('0x45')]['id']){delete _0x2dbf4b['body']['id'];}return db[_0xed3c('0x27')][_0xed3c('0x42')]({'where':{'id':_0x2dbf4b[_0xed3c('0x40')]['id']}})[_0xed3c('0x21')](handleEntityNotFound(_0x436dce,null))[_0xed3c('0x21')](saveUpdates(_0x2dbf4b['body'],null))['then'](respondWithResult(_0x436dce,null))[_0xed3c('0x43')](handleError(_0x436dce,null));};exports[_0xed3c('0x22')]=function(_0x5aee15,_0x520492){return db[_0xed3c('0x27')][_0xed3c('0x42')]({'where':{'id':_0x5aee15[_0xed3c('0x40')]['id']}})[_0xed3c('0x21')](handleEntityNotFound(_0x520492,null))['then'](removeEntity(_0x520492,null))[_0xed3c('0x43')](handleError(_0x520492,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 4b64c18..44e75ef 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 _0x116c=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x116c,0x1e7));var _0xc116=function(_0x70fc58,_0x52ee70){_0x70fc58=_0x70fc58-0x0;var _0x59ea5d=_0x116c[_0x70fc58];return _0x59ea5d;};'use strict';var _=require(_0xc116('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc116('0x1'));var moment=require(_0xc116('0x2'));var BPromise=require('bluebird');var rp=require(_0xc116('0x3'));var fs=require('fs');var path=require(_0xc116('0x4'));var rimraf=require(_0xc116('0x5'));var config=require(_0xc116('0x6'));var attributes=require(_0xc116('0x7'));module[_0xc116('0x8')]=function(_0x2593a5,_0x1ff00e){return _0x2593a5[_0xc116('0x9')](_0xc116('0xa'),attributes,{'tableName':_0xc116('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b3b=['../../config/environment','define','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbac2,_0x2d93f2){var _0x1c62a0=function(_0x1285e2){while(--_0x1285e2){_0xbac2['push'](_0xbac2['shift']());}};_0x1c62a0(++_0x2d93f2);}(_0x7b3b,0xe7));var _0xb7b3=function(_0x4f29fc,_0x17c58a){_0x4f29fc=_0x4f29fc-0x0;var _0x119cc8=_0x7b3b[_0x4f29fc];return _0x119cc8;};'use strict';var _=require(_0xb7b3('0x0'));var util=require(_0xb7b3('0x1'));var logger=require(_0xb7b3('0x2'))(_0xb7b3('0x3'));var moment=require(_0xb7b3('0x4'));var BPromise=require(_0xb7b3('0x5'));var rp=require(_0xb7b3('0x6'));var fs=require('fs');var path=require(_0xb7b3('0x7'));var rimraf=require(_0xb7b3('0x8'));var config=require(_0xb7b3('0x9'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x23ccc7,_0x3f59fc){return _0x23ccc7[_0xb7b3('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0xb7b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 16d1071..90077a3 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3f04b8,_0x184184){var _0x57095e=function(_0x33b9ed){while(--_0x33b9ed){_0x3f04b8['push'](_0x3f04b8['shift']());}};_0x57095e(++_0x184184);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e1229,_0x1a58e6){_0x1e1229=_0x1e1229-0x0;var _0x3b615d=_0x5f2f[_0x1e1229];return _0x3b615d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x317c75,_0x19b216){var _0x168564=function(_0x4ccfb5){while(--_0x4ccfb5){_0x317c75['push'](_0x317c75['shift']());}};_0x168564(++_0x19b216);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 8484c39..b4dd0f0 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 _0x83b0=['create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','get','/:id','show','post'];(function(_0x10203a,_0x2b2c60){var _0x2c9b3d=function(_0xaf1c14){while(--_0xaf1c14){_0x10203a['push'](_0x10203a['shift']());}};_0x2c9b3d(++_0x2b2c60);}(_0x83b0,0x1a7));var _0x083b=function(_0x40262a,_0x15cfa1){_0x40262a=_0x40262a-0x0;var _0x18b817=_0x83b0[_0x40262a];return _0x18b817;};'use strict';var multer=require(_0x083b('0x0'));var util=require('util');var path=require(_0x083b('0x1'));var timeout=require(_0x083b('0x2'));var express=require(_0x083b('0x3'));var router=express[_0x083b('0x4')]();var fs_extra=require(_0x083b('0x5'));var auth=require(_0x083b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x083b('0x7'));var controller=require(_0x083b('0x8'));router['get']('/',auth[_0x083b('0x9')](),controller['index']);router[_0x083b('0xa')](_0x083b('0xb'),auth[_0x083b('0x9')](),controller[_0x083b('0xc')]);router[_0x083b('0xd')]('/',auth[_0x083b('0x9')](),controller[_0x083b('0xe')]);router[_0x083b('0xf')]('/:id',auth[_0x083b('0x9')](),controller[_0x083b('0x10')]);router[_0x083b('0x11')](_0x083b('0xb'),auth[_0x083b('0x9')](),controller[_0x083b('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe703=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','multer','connect-timeout'];(function(_0x1a0ae6,_0x42a00f){var _0x221760=function(_0xf573aa){while(--_0xf573aa){_0x1a0ae6['push'](_0x1a0ae6['shift']());}};_0x221760(++_0x42a00f);}(_0xe703,0x139));var _0x3e70=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0xe703[_0xaf29da];return _0x295c51;};'use strict';var multer=require(_0x3e70('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e70('0x1'));var express=require('express');var router=express[_0x3e70('0x2')]();var fs_extra=require(_0x3e70('0x3'));var auth=require(_0x3e70('0x4'));var interaction=require(_0x3e70('0x5'));var config=require('../../config/environment');var controller=require(_0x3e70('0x6'));router[_0x3e70('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3e70('0x8'),auth[_0x3e70('0x9')](),controller['show']);router['post']('/',auth[_0x3e70('0x9')](),controller[_0x3e70('0xa')]);router[_0x3e70('0xb')](_0x3e70('0x8'),auth['isAuthenticated'](),controller[_0x3e70('0xc')]);router[_0x3e70('0xd')](_0x3e70('0x8'),auth[_0x3e70('0x9')](),controller[_0x3e70('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index da605ce..01c73df 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 _0xb43b=['STRING','sequelize'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xb43b,0xbf));var _0xbb43=function(_0x633ce7,_0x630cdc){_0x633ce7=_0x633ce7-0x0;var _0x5e7b4e=_0xb43b[_0x633ce7];return _0x5e7b4e;};'use strict';var Sequelize=require(_0xbb43('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb43('0x1')]},'basename':{'type':Sequelize[_0xbb43('0x1')]},'type':{'type':Sequelize[_0xbb43('0x1')]}}; \ No newline at end of file +var _0x6e12=['STRING','sequelize','exports'];(function(_0x3d762b,_0x4c2714){var _0x36d99b=function(_0x3ce04b){while(--_0x3ce04b){_0x3d762b['push'](_0x3d762b['shift']());}};_0x36d99b(++_0x4c2714);}(_0x6e12,0x154));var _0x26e1=function(_0x162829,_0x2f1ec2){_0x162829=_0x162829-0x0;var _0x6d1bdc=_0x6e12[_0x162829];return _0x6d1bdc;};'use strict';var Sequelize=require(_0x26e1('0x0'));module[_0x26e1('0x1')]={'name':{'type':Sequelize[_0x26e1('0x2')]},'basename':{'type':Sequelize[_0x26e1('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index abc8fde..3299da7 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 _0x2a41=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','where','merge','map','VIRTUAL','options','includeAll','rows','show','params','include','catch','omit','createdAt','body','updatedAt','create','find','file','originalname','filename','download','root','server/files/attachments/','join','offline-chat/','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','key','model'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x2a41,0x7a));var _0x12a4=function(_0x23fd7b,_0x394165){_0x23fd7b=_0x23fd7b-0x0;var _0x4a4402=_0x2a41[_0x23fd7b];return _0x4a4402;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x12a4('0x0'));var rp=require(_0x12a4('0x1'));var moment=require(_0x12a4('0x2'));var BPromise=require(_0x12a4('0x3'));var Mustache=require(_0x12a4('0x4'));var util=require(_0x12a4('0x5'));var path=require(_0x12a4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x12a4('0x7'));var fs=require('fs');var fs_extra=require(_0x12a4('0x8'));var _=require(_0x12a4('0x9'));var squel=require(_0x12a4('0xa'));var crypto=require(_0x12a4('0xb'));var jsforce=require(_0x12a4('0xc'));var deskjs=require(_0x12a4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x12a4('0xe'));var Redis=require(_0x12a4('0xf'));var authService=require(_0x12a4('0x10'));var qs=require(_0x12a4('0x11'));var as=require(_0x12a4('0x12'));var hardwareService=require(_0x12a4('0x13'));var logger=require(_0x12a4('0x14'))('api');var utils=require(_0x12a4('0x15'));var config=require(_0x12a4('0x16'));var licenseUtil=require(_0x12a4('0x17'));var db=require(_0x12a4('0x18'))['db'];function respondWithStatusCode(_0x373a09,_0x387639){_0x387639=_0x387639||0xcc;return function(_0x1c7ced){if(_0x1c7ced){return _0x373a09[_0x12a4('0x19')](_0x387639);}return _0x373a09[_0x12a4('0x1a')](_0x387639)['end']();};}function respondWithResult(_0x70a643,_0x5d1993){_0x5d1993=_0x5d1993||0xc8;return function(_0xd202e7){if(_0xd202e7){return _0x70a643[_0x12a4('0x1a')](_0x5d1993)[_0x12a4('0x1b')](_0xd202e7);}};}function respondWithFilteredResult(_0x38a7c6,_0x5a83da){return function(_0x2a122d){if(_0x2a122d){var _0x13c956=typeof _0x5a83da[_0x12a4('0x1c')]==='undefined'&&typeof _0x5a83da[_0x12a4('0x1d')]===_0x12a4('0x1e');var _0x116d7f=_0x2a122d['count'];var _0x4b8bf9=_0x13c956?0x0:_0x5a83da['offset'];var _0x2c0cf6=_0x13c956?_0x2a122d[_0x12a4('0x1f')]:_0x5a83da[_0x12a4('0x1c')]+_0x5a83da[_0x12a4('0x1d')];var _0x16a96a;if(_0x2c0cf6>=_0x116d7f){_0x2c0cf6=_0x116d7f;_0x16a96a=0xc8;}else{_0x16a96a=0xce;}_0x38a7c6[_0x12a4('0x1a')](_0x16a96a);return _0x38a7c6[_0x12a4('0x20')](_0x12a4('0x21'),_0x4b8bf9+'-'+_0x2c0cf6+'/'+_0x116d7f)[_0x12a4('0x1b')](_0x2a122d);}return null;};}function patchUpdates(_0x291b1e){return function(_0x150d56){try{jsonpatch['apply'](_0x150d56,_0x291b1e,!![]);}catch(_0x38aca3){return BPromise['reject'](_0x38aca3);}return _0x150d56[_0x12a4('0x22')]();};}function saveUpdates(_0x11e1a8,_0x53e69f){return function(_0x4d1a1c){if(_0x4d1a1c){return _0x4d1a1c[_0x12a4('0x23')](_0x11e1a8)[_0x12a4('0x24')](function(_0x4b23e4){return _0x4b23e4;});}return null;};}function removeEntity(_0x3304a5,_0x102c31){return function(_0x47e230){if(_0x47e230){return _0x47e230[_0x12a4('0x25')]()[_0x12a4('0x24')](function(){_0x3304a5[_0x12a4('0x1a')](0xcc)[_0x12a4('0x26')]();});}};}function handleEntityNotFound(_0x537413,_0x4f49f6){return function(_0x88a1bc){if(!_0x88a1bc){_0x537413[_0x12a4('0x19')](0x194);}return _0x88a1bc;};}function handleError(_0x169ed0,_0x1af841){_0x1af841=_0x1af841||0x1f4;return function(_0x9a75af){logger[_0x12a4('0x27')](_0x9a75af[_0x12a4('0x28')]);if(_0x9a75af[_0x12a4('0x29')]){delete _0x9a75af[_0x12a4('0x29')];}_0x169ed0['status'](_0x1af841)[_0x12a4('0x2a')](_0x9a75af);};}exports[_0x12a4('0x2b')]=function(_0x3fef41,_0x2fe2c2){var _0x3f9e09={},_0x213567={},_0xef0eb6={'count':0x0,'rows':[]};var _0x305bfd=_['map'](db[_0x12a4('0x2c')][_0x12a4('0x2d')],function(_0x4d0b15){return{'name':_0x4d0b15[_0x12a4('0x2e')],'type':_0x4d0b15[_0x12a4('0x2f')][_0x12a4('0x30')]};});_0x213567[_0x12a4('0x31')]=_['map'](_0x305bfd,'name');_0x213567[_0x12a4('0x32')]=_[_0x12a4('0x33')](_0x3fef41[_0x12a4('0x32')]);_0x213567[_0x12a4('0x34')]=_[_0x12a4('0x35')](_0x213567[_0x12a4('0x31')],_0x213567[_0x12a4('0x32')]);_0x3f9e09[_0x12a4('0x36')]=_['intersection'](_0x213567['model'],qs[_0x12a4('0x37')](_0x3fef41[_0x12a4('0x32')][_0x12a4('0x37')]));_0x3f9e09[_0x12a4('0x36')]=_0x3f9e09[_0x12a4('0x36')][_0x12a4('0x38')]?_0x3f9e09[_0x12a4('0x36')]:_0x213567[_0x12a4('0x31')];if(!_0x3fef41['query'][_0x12a4('0x39')]('nolimit')){_0x3f9e09['limit']=qs[_0x12a4('0x1d')](_0x3fef41['query'][_0x12a4('0x1d')]);_0x3f9e09[_0x12a4('0x1c')]=qs['offset'](_0x3fef41[_0x12a4('0x32')][_0x12a4('0x1c')]);}_0x3f9e09[_0x12a4('0x3a')]=qs['sort'](_0x3fef41['query']['sort']);_0x3f9e09['where']=qs[_0x12a4('0x34')](_[_0x12a4('0x3b')](_0x3fef41[_0x12a4('0x32')],_0x213567['filters']),_0x305bfd);if(_0x3fef41['query'][_0x12a4('0x3c')]){_0x3f9e09[_0x12a4('0x3d')]=_[_0x12a4('0x3e')](_0x3f9e09['where'],{'$or':_[_0x12a4('0x3f')](_0x305bfd,function(_0x3ab88b){if(_0x3ab88b[_0x12a4('0x2f')]!==_0x12a4('0x40')){var _0x269bd2={};_0x269bd2[_0x3ab88b[_0x12a4('0x29')]]={'$like':'%'+_0x3fef41[_0x12a4('0x32')]['filter']+'%'};return _0x269bd2;}})});}_0x3f9e09=_[_0x12a4('0x3e')]({},_0x3f9e09,_0x3fef41[_0x12a4('0x41')]);var _0x5791b1={'where':_0x3f9e09['where']};return db['Attachment'][_0x12a4('0x1f')](_0x5791b1)[_0x12a4('0x24')](function(_0xa60c36){_0xef0eb6[_0x12a4('0x1f')]=_0xa60c36;if(_0x3fef41[_0x12a4('0x32')][_0x12a4('0x42')]){_0x3f9e09['include']=[{'all':!![]}];}return db[_0x12a4('0x2c')]['findAll'](_0x3f9e09);})['then'](function(_0x1697a0){_0xef0eb6[_0x12a4('0x43')]=_0x1697a0;return _0xef0eb6;})[_0x12a4('0x24')](respondWithFilteredResult(_0x2fe2c2,_0x3f9e09))['catch'](handleError(_0x2fe2c2,null));};exports[_0x12a4('0x44')]=function(_0x362894,_0xe7e66f){var _0x348e54={'raw':!![],'where':{'id':_0x362894[_0x12a4('0x45')]['id']}},_0x2fabfb={};_0x2fabfb[_0x12a4('0x31')]=_[_0x12a4('0x33')](db['Attachment'][_0x12a4('0x2d')]);_0x2fabfb['query']=_['keys'](_0x362894['query']);_0x2fabfb['filters']=_[_0x12a4('0x35')](_0x2fabfb[_0x12a4('0x31')],_0x2fabfb[_0x12a4('0x32')]);_0x348e54[_0x12a4('0x36')]=_[_0x12a4('0x35')](_0x2fabfb[_0x12a4('0x31')],qs[_0x12a4('0x37')](_0x362894['query'][_0x12a4('0x37')]));_0x348e54[_0x12a4('0x36')]=_0x348e54[_0x12a4('0x36')][_0x12a4('0x38')]?_0x348e54[_0x12a4('0x36')]:_0x2fabfb[_0x12a4('0x31')];if(_0x362894[_0x12a4('0x32')][_0x12a4('0x42')]){_0x348e54[_0x12a4('0x46')]=[{'all':!![]}];}_0x348e54=_['merge']({},_0x348e54,_0x362894[_0x12a4('0x41')]);return db[_0x12a4('0x2c')]['find'](_0x348e54)[_0x12a4('0x24')](handleEntityNotFound(_0xe7e66f,null))[_0x12a4('0x24')](respondWithResult(_0xe7e66f,null))[_0x12a4('0x47')](handleError(_0xe7e66f,null));};exports['clone']=function(_0x5510c9,_0x2b6640){var _0x2112e3={'where':{'id':_0x5510c9[_0x12a4('0x45')]['id']}},_0x337214={};_0x337214['model']=_[_0x12a4('0x33')](db[_0x12a4('0x2c')]['rawAttributes']);_0x2112e3[_0x12a4('0x36')]=_[_0x12a4('0x35')](_0x337214[_0x12a4('0x31')],qs[_0x12a4('0x37')](_0x5510c9[_0x12a4('0x32')][_0x12a4('0x37')]));_0x2112e3['attributes']=_0x2112e3['attributes'][_0x12a4('0x38')]?_0x2112e3['attributes']:_0x337214[_0x12a4('0x31')];if(_0x5510c9[_0x12a4('0x32')]['includeAll']){_0x2112e3['include']=[{'all':!![]}];}_0x2112e3=_[_0x12a4('0x3e')]({},_0x2112e3,_0x5510c9[_0x12a4('0x41')]);return db['Attachment']['find'](_0x2112e3)[_0x12a4('0x24')](handleEntityNotFound(_0x2b6640,null))[_0x12a4('0x24')](function(_0x45fa74){if(_0x45fa74){var _0x35f833=_0x45fa74['get']({'plain':!![]});_0x35f833=qs[_0x12a4('0x48')](_0x35f833,['id',_0x12a4('0x49'),'updatedAt']);_0x5510c9[_0x12a4('0x4a')]=_['omit'](_0x5510c9['body'],['id','createdAt',_0x12a4('0x4b')]);return db[_0x12a4('0x2c')][_0x12a4('0x4c')](_['merge'](_0x35f833,_0x5510c9[_0x12a4('0x4a')]),{'include':_0x5510c9[_0x12a4('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x12a4('0x24')](respondWithResult(_0x2b6640,0xc9))[_0x12a4('0x47')](handleError(_0x2b6640,null));};exports[_0x12a4('0x23')]=function(_0x50af0f,_0x4a318b){if(_0x50af0f[_0x12a4('0x4a')]['id']){delete _0x50af0f['body']['id'];}return db[_0x12a4('0x2c')][_0x12a4('0x4d')]({'where':{'id':_0x50af0f['params']['id']}})[_0x12a4('0x24')](handleEntityNotFound(_0x4a318b,null))[_0x12a4('0x24')](saveUpdates(_0x50af0f[_0x12a4('0x4a')],null))[_0x12a4('0x24')](respondWithResult(_0x4a318b,null))[_0x12a4('0x47')](handleError(_0x4a318b,null));};exports[_0x12a4('0x25')]=function(_0x33d94e,_0x573ead){return db[_0x12a4('0x2c')][_0x12a4('0x4d')]({'where':{'id':_0x33d94e[_0x12a4('0x45')]['id']}})[_0x12a4('0x24')](handleEntityNotFound(_0x573ead,null))['then'](removeEntity(_0x573ead,null))[_0x12a4('0x47')](handleError(_0x573ead,null));};exports[_0x12a4('0x4c')]=function(_0x2d65be,_0x56cbd3,_0x2aeb13){_0x2d65be['body'][_0x12a4('0x29')]=_0x2d65be[_0x12a4('0x4e')][_0x12a4('0x4f')];_0x2d65be[_0x12a4('0x4a')]['basename']=_0x2d65be[_0x12a4('0x4e')][_0x12a4('0x50')];_0x2d65be[_0x12a4('0x4a')][_0x12a4('0x2f')]=_0x2d65be[_0x12a4('0x4e')]['mimetype'];return db[_0x12a4('0x2c')]['create'](_0x2d65be[_0x12a4('0x4a')])[_0x12a4('0x24')](respondWithResult(_0x56cbd3,0xc9))[_0x12a4('0x47')](handleError(_0x56cbd3,null));};exports[_0x12a4('0x51')]=function(_0x23fb12,_0x36f1ed,_0x43726d){return db[_0x12a4('0x2c')]['findOne']({'where':{'id':_0x23fb12[_0x12a4('0x45')]['id']},'raw':!![]})[_0x12a4('0x24')](handleEntityNotFound(_0x36f1ed,null))[_0x12a4('0x24')](function(_0x33493d){if(_0x33493d){var _0x256b4a=_0x33493d['ChatOfflineMessageId']!==null;var _0x4fb2b7=path['join'](config[_0x12a4('0x52')],_0x12a4('0x53'));if(_0x256b4a){_0x4fb2b7=path[_0x12a4('0x54')](_0x4fb2b7,_0x12a4('0x55'));}var _0x816681=path[_0x12a4('0x54')](_0x4fb2b7,_0x33493d['basename']);return _0x36f1ed[_0x12a4('0x51')](_0x816681);}})['catch'](handleError(_0x36f1ed,null));}; \ No newline at end of file +var _0x48f7=['rows','catch','show','options','find','clone','rawAttributes','get','omit','createdAt','updatedAt','body','create','params','originalname','basename','file','mimetype','findOne','join','root','server/files/attachments/','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','send','index','map','Attachment','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48f7,0x6f));var _0x748f=function(_0x5411f8,_0x5335e3){_0x5411f8=_0x5411f8-0x0;var _0x5f003e=_0x48f7[_0x5411f8];return _0x5f003e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x748f('0x0'));var zipdir=require(_0x748f('0x1'));var jsonpatch=require(_0x748f('0x2'));var rp=require(_0x748f('0x3'));var moment=require('moment');var BPromise=require(_0x748f('0x4'));var Mustache=require(_0x748f('0x5'));var util=require(_0x748f('0x6'));var path=require(_0x748f('0x7'));var sox=require(_0x748f('0x8'));var csv=require(_0x748f('0x9'));var ejs=require(_0x748f('0xa'));var fs=require('fs');var fs_extra=require(_0x748f('0xb'));var _=require(_0x748f('0xc'));var squel=require(_0x748f('0xd'));var crypto=require(_0x748f('0xe'));var jsforce=require(_0x748f('0xf'));var deskjs=require(_0x748f('0x10'));var toCsv=require(_0x748f('0x9'));var querystring=require(_0x748f('0x11'));var Papa=require(_0x748f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x748f('0x13'));var as=require(_0x748f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x748f('0x15'))(_0x748f('0x16'));var utils=require(_0x748f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x748f('0x18'))['db'];function respondWithStatusCode(_0x96763d,_0x1ce535){_0x1ce535=_0x1ce535||0xcc;return function(_0x580008){if(_0x580008){return _0x96763d['sendStatus'](_0x1ce535);}return _0x96763d[_0x748f('0x19')](_0x1ce535)[_0x748f('0x1a')]();};}function respondWithResult(_0x4a208d,_0x1cb870){_0x1cb870=_0x1cb870||0xc8;return function(_0x5b7294){if(_0x5b7294){return _0x4a208d['status'](_0x1cb870)[_0x748f('0x1b')](_0x5b7294);}};}function respondWithFilteredResult(_0x46cf55,_0x49afa3){return function(_0x5660ed){if(_0x5660ed){var _0x45f9c1=typeof _0x49afa3[_0x748f('0x1c')]===_0x748f('0x1d')&&typeof _0x49afa3['limit']===_0x748f('0x1d');var _0x281b6a=_0x5660ed['count'];var _0x51cdb3=_0x45f9c1?0x0:_0x49afa3[_0x748f('0x1c')];var _0x3e27fd=_0x45f9c1?_0x5660ed[_0x748f('0x1e')]:_0x49afa3['offset']+_0x49afa3['limit'];var _0x99ac7c;if(_0x3e27fd>=_0x281b6a){_0x3e27fd=_0x281b6a;_0x99ac7c=0xc8;}else{_0x99ac7c=0xce;}_0x46cf55['status'](_0x99ac7c);return _0x46cf55[_0x748f('0x1f')](_0x748f('0x20'),_0x51cdb3+'-'+_0x3e27fd+'/'+_0x281b6a)['json'](_0x5660ed);}return null;};}function patchUpdates(_0x20661a){return function(_0x1e7e64){try{jsonpatch[_0x748f('0x21')](_0x1e7e64,_0x20661a,!![]);}catch(_0x1d06c4){return BPromise[_0x748f('0x22')](_0x1d06c4);}return _0x1e7e64[_0x748f('0x23')]();};}function saveUpdates(_0x1b0dde,_0x27427d){return function(_0x87a8e9){if(_0x87a8e9){return _0x87a8e9[_0x748f('0x24')](_0x1b0dde)[_0x748f('0x25')](function(_0xb797c0){return _0xb797c0;});}return null;};}function removeEntity(_0x3a2d5d,_0x50b86b){return function(_0x4029b7){if(_0x4029b7){return _0x4029b7[_0x748f('0x26')]()[_0x748f('0x25')](function(){_0x3a2d5d['status'](0xcc)[_0x748f('0x1a')]();});}};}function handleEntityNotFound(_0x1ef832,_0x4a3d01){return function(_0x39a586){if(!_0x39a586){_0x1ef832[_0x748f('0x27')](0x194);}return _0x39a586;};}function handleError(_0x2565b4,_0x16bdde){_0x16bdde=_0x16bdde||0x1f4;return function(_0x1507ad){logger['error'](_0x1507ad['stack']);if(_0x1507ad['name']){delete _0x1507ad['name'];}_0x2565b4[_0x748f('0x19')](_0x16bdde)[_0x748f('0x28')](_0x1507ad);};}exports[_0x748f('0x29')]=function(_0x53e9a0,_0x39c18e){var _0x5b13ad={},_0x3762e1={},_0x5b2368={'count':0x0,'rows':[]};var _0x22aa7b=_[_0x748f('0x2a')](db[_0x748f('0x2b')]['rawAttributes'],function(_0x52ff95){return{'name':_0x52ff95['fieldName'],'type':_0x52ff95[_0x748f('0x2c')][_0x748f('0x2d')]};});_0x3762e1['model']=_[_0x748f('0x2a')](_0x22aa7b,_0x748f('0x2e'));_0x3762e1[_0x748f('0x2f')]=_[_0x748f('0x30')](_0x53e9a0[_0x748f('0x2f')]);_0x3762e1[_0x748f('0x31')]=_['intersection'](_0x3762e1['model'],_0x3762e1[_0x748f('0x2f')]);_0x5b13ad['attributes']=_[_0x748f('0x32')](_0x3762e1[_0x748f('0x33')],qs[_0x748f('0x34')](_0x53e9a0[_0x748f('0x2f')][_0x748f('0x34')]));_0x5b13ad[_0x748f('0x35')]=_0x5b13ad['attributes'][_0x748f('0x36')]?_0x5b13ad[_0x748f('0x35')]:_0x3762e1[_0x748f('0x33')];if(!_0x53e9a0[_0x748f('0x2f')]['hasOwnProperty'](_0x748f('0x37'))){_0x5b13ad[_0x748f('0x38')]=qs['limit'](_0x53e9a0[_0x748f('0x2f')]['limit']);_0x5b13ad[_0x748f('0x1c')]=qs[_0x748f('0x1c')](_0x53e9a0['query'][_0x748f('0x1c')]);}_0x5b13ad['order']=qs[_0x748f('0x39')](_0x53e9a0[_0x748f('0x2f')][_0x748f('0x39')]);_0x5b13ad[_0x748f('0x3a')]=qs[_0x748f('0x31')](_[_0x748f('0x3b')](_0x53e9a0[_0x748f('0x2f')],_0x3762e1[_0x748f('0x31')]),_0x22aa7b);if(_0x53e9a0[_0x748f('0x2f')]['filter']){_0x5b13ad['where']=_[_0x748f('0x3c')](_0x5b13ad[_0x748f('0x3a')],{'$or':_[_0x748f('0x2a')](_0x22aa7b,function(_0xca48be){if(_0xca48be['type']!==_0x748f('0x3d')){var _0x5e378d={};_0x5e378d[_0xca48be[_0x748f('0x2e')]]={'$like':'%'+_0x53e9a0[_0x748f('0x2f')]['filter']+'%'};return _0x5e378d;}})});}_0x5b13ad=_['merge']({},_0x5b13ad,_0x53e9a0['options']);var _0x203ff9={'where':_0x5b13ad[_0x748f('0x3a')]};return db[_0x748f('0x2b')][_0x748f('0x1e')](_0x203ff9)['then'](function(_0x39dc2c){_0x5b2368['count']=_0x39dc2c;if(_0x53e9a0[_0x748f('0x2f')][_0x748f('0x3e')]){_0x5b13ad[_0x748f('0x3f')]=[{'all':!![]}];}return db[_0x748f('0x2b')][_0x748f('0x40')](_0x5b13ad);})[_0x748f('0x25')](function(_0x478501){_0x5b2368[_0x748f('0x41')]=_0x478501;return _0x5b2368;})[_0x748f('0x25')](respondWithFilteredResult(_0x39c18e,_0x5b13ad))[_0x748f('0x42')](handleError(_0x39c18e,null));};exports[_0x748f('0x43')]=function(_0x2eb8aa,_0x52c573){var _0x5c4e99={'raw':!![],'where':{'id':_0x2eb8aa['params']['id']}},_0x17df5d={};_0x17df5d[_0x748f('0x33')]=_['keys'](db['Attachment']['rawAttributes']);_0x17df5d[_0x748f('0x2f')]=_[_0x748f('0x30')](_0x2eb8aa[_0x748f('0x2f')]);_0x17df5d[_0x748f('0x31')]=_[_0x748f('0x32')](_0x17df5d[_0x748f('0x33')],_0x17df5d[_0x748f('0x2f')]);_0x5c4e99['attributes']=_[_0x748f('0x32')](_0x17df5d[_0x748f('0x33')],qs[_0x748f('0x34')](_0x2eb8aa[_0x748f('0x2f')][_0x748f('0x34')]));_0x5c4e99[_0x748f('0x35')]=_0x5c4e99[_0x748f('0x35')][_0x748f('0x36')]?_0x5c4e99[_0x748f('0x35')]:_0x17df5d[_0x748f('0x33')];if(_0x2eb8aa[_0x748f('0x2f')][_0x748f('0x3e')]){_0x5c4e99['include']=[{'all':!![]}];}_0x5c4e99=_['merge']({},_0x5c4e99,_0x2eb8aa[_0x748f('0x44')]);return db[_0x748f('0x2b')][_0x748f('0x45')](_0x5c4e99)['then'](handleEntityNotFound(_0x52c573,null))[_0x748f('0x25')](respondWithResult(_0x52c573,null))[_0x748f('0x42')](handleError(_0x52c573,null));};exports[_0x748f('0x46')]=function(_0x4005c9,_0x5c1eee){var _0x544b93={'where':{'id':_0x4005c9['params']['id']}},_0x7f42be={};_0x7f42be['model']=_[_0x748f('0x30')](db[_0x748f('0x2b')][_0x748f('0x47')]);_0x544b93[_0x748f('0x35')]=_[_0x748f('0x32')](_0x7f42be[_0x748f('0x33')],qs[_0x748f('0x34')](_0x4005c9[_0x748f('0x2f')][_0x748f('0x34')]));_0x544b93['attributes']=_0x544b93[_0x748f('0x35')][_0x748f('0x36')]?_0x544b93[_0x748f('0x35')]:_0x7f42be[_0x748f('0x33')];if(_0x4005c9[_0x748f('0x2f')][_0x748f('0x3e')]){_0x544b93['include']=[{'all':!![]}];}_0x544b93=_[_0x748f('0x3c')]({},_0x544b93,_0x4005c9['options']);return db[_0x748f('0x2b')][_0x748f('0x45')](_0x544b93)['then'](handleEntityNotFound(_0x5c1eee,null))['then'](function(_0x3ed9d8){if(_0x3ed9d8){var _0x4ffbd2=_0x3ed9d8[_0x748f('0x48')]({'plain':!![]});_0x4ffbd2=qs[_0x748f('0x49')](_0x4ffbd2,['id',_0x748f('0x4a'),_0x748f('0x4b')]);_0x4005c9[_0x748f('0x4c')]=_[_0x748f('0x49')](_0x4005c9[_0x748f('0x4c')],['id',_0x748f('0x4a'),_0x748f('0x4b')]);return db[_0x748f('0x2b')][_0x748f('0x4d')](_[_0x748f('0x3c')](_0x4ffbd2,_0x4005c9[_0x748f('0x4c')]),{'include':_0x4005c9[_0x748f('0x2f')][_0x748f('0x3e')]?[{'all':!![]}]:undefined});}})[_0x748f('0x25')](respondWithResult(_0x5c1eee,0xc9))[_0x748f('0x42')](handleError(_0x5c1eee,null));};exports[_0x748f('0x24')]=function(_0x28eb9d,_0x376404){if(_0x28eb9d['body']['id']){delete _0x28eb9d[_0x748f('0x4c')]['id'];}return db['Attachment'][_0x748f('0x45')]({'where':{'id':_0x28eb9d[_0x748f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x376404,null))[_0x748f('0x25')](saveUpdates(_0x28eb9d[_0x748f('0x4c')],null))[_0x748f('0x25')](respondWithResult(_0x376404,null))[_0x748f('0x42')](handleError(_0x376404,null));};exports[_0x748f('0x26')]=function(_0x296737,_0xd9f2e){return db[_0x748f('0x2b')][_0x748f('0x45')]({'where':{'id':_0x296737['params']['id']}})[_0x748f('0x25')](handleEntityNotFound(_0xd9f2e,null))[_0x748f('0x25')](removeEntity(_0xd9f2e,null))['catch'](handleError(_0xd9f2e,null));};exports[_0x748f('0x4d')]=function(_0x57ca71,_0x41152f,_0x196fee){_0x57ca71[_0x748f('0x4c')][_0x748f('0x2e')]=_0x57ca71['file'][_0x748f('0x4f')];_0x57ca71['body'][_0x748f('0x50')]=_0x57ca71[_0x748f('0x51')]['filename'];_0x57ca71[_0x748f('0x4c')][_0x748f('0x2c')]=_0x57ca71[_0x748f('0x51')][_0x748f('0x52')];return db[_0x748f('0x2b')][_0x748f('0x4d')](_0x57ca71['body'])[_0x748f('0x25')](respondWithResult(_0x41152f,0xc9))[_0x748f('0x42')](handleError(_0x41152f,null));};exports['download']=function(_0x5a19db,_0x1f9b81,_0x4c288f){return db[_0x748f('0x2b')][_0x748f('0x53')]({'where':{'id':_0x5a19db[_0x748f('0x4e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1f9b81,null))[_0x748f('0x25')](function(_0x4a703b){if(_0x4a703b){var _0xf75a5b=_0x4a703b['ChatOfflineMessageId']!==null;var _0x336dbd=path[_0x748f('0x54')](config[_0x748f('0x55')],_0x748f('0x56'));if(_0xf75a5b){_0x336dbd=path['join'](_0x336dbd,_0x748f('0x57'));}var _0x189eab=path['join'](_0x336dbd,_0x4a703b[_0x748f('0x50')]);return _0x1f9b81['download'](_0x189eab);}})[_0x748f('0x42')](handleError(_0x1f9b81,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index abe9751..2da5db4 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 _0x7562=['define','Attachment','attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports'];(function(_0xd2c0a5,_0x5a6cf2){var _0x449388=function(_0x5e5c4b){while(--_0x5e5c4b){_0xd2c0a5['push'](_0xd2c0a5['shift']());}};_0x449388(++_0x5a6cf2);}(_0x7562,0x1a3));var _0x2756=function(_0x20ff73,_0x26ac66){_0x20ff73=_0x20ff73-0x0;var _0xf8e97f=_0x7562[_0x20ff73];return _0xf8e97f;};'use strict';var _=require(_0x2756('0x0'));var util=require(_0x2756('0x1'));var logger=require(_0x2756('0x2'))('api');var moment=require(_0x2756('0x3'));var BPromise=require(_0x2756('0x4'));var rp=require(_0x2756('0x5'));var fs=require('fs');var path=require(_0x2756('0x6'));var rimraf=require('rimraf');var config=require(_0x2756('0x7'));var attributes=require(_0x2756('0x8'));module[_0x2756('0x9')]=function(_0x4af95e,_0x1b871a){return _0x4af95e[_0x2756('0xa')](_0x2756('0xb'),attributes,{'tableName':_0x2756('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7346=['./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','request-promise','rimraf'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0x7346,0x113));var _0x6734=function(_0x1b0a0f,_0x5e1bb9){_0x1b0a0f=_0x1b0a0f-0x0;var _0x208490=_0x7346[_0x1b0a0f];return _0x208490;};'use strict';var _=require(_0x6734('0x0'));var util=require(_0x6734('0x1'));var logger=require(_0x6734('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6734('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6734('0x4'));var config=require('../../config/environment');var attributes=require(_0x6734('0x5'));module[_0x6734('0x6')]=function(_0x1f61a7,_0x433d4e){return _0x1f61a7[_0x6734('0x7')](_0x6734('0x8'),attributes,{'tableName':_0x6734('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 1d9c1ab..a366315 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 _0x4b1f=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Attachment,\x20%s,\x20%s','message','Attachment','create','options','CreateAttachment','lodash','util','bluebird'];(function(_0x5ee611,_0x21c91f){var _0x4d8f6e=function(_0x5680a7){while(--_0x5680a7){_0x5ee611['push'](_0x5ee611['shift']());}};_0x4d8f6e(++_0x21c91f);}(_0x4b1f,0x195));var _0xf4b1=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x4b1f[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var moment=require('moment');var BPromise=require(_0xf4b1('0x2'));var rs=require(_0xf4b1('0x3'));var fs=require('fs');var Redis=require(_0xf4b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4b1('0x5'));var logger=require(_0xf4b1('0x6'))(_0xf4b1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf4b1('0x8')][_0xf4b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310db5,_0x3b9c78,_0x1abfc7){return new BPromise(function(_0x50738c,_0x59cf77){return client['request'](_0x310db5,_0x1abfc7)[_0xf4b1('0xa')](function(_0x53a786){logger[_0xf4b1('0xb')]('Attachment,\x20%s,\x20%s',_0x3b9c78,'request\x20sent');logger[_0xf4b1('0xc')](_0xf4b1('0xd'),_0x3b9c78,_0xf4b1('0xe'),JSON[_0xf4b1('0xf')](_0x53a786));if(_0x53a786[_0xf4b1('0x10')]){if(_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x11')]===0x1f4){logger[_0xf4b1('0x10')](_0xf4b1('0x12'),_0x3b9c78,_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x13')]);return _0x59cf77(_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x13')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x3b9c78,_0x53a786[_0xf4b1('0x10')]['message']);return _0x50738c(_0x53a786['error'][_0xf4b1('0x13')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x3b9c78,_0xf4b1('0xe'));_0x50738c(_0x53a786['result']['message']);}})['catch'](function(_0x5cb2a1){logger[_0xf4b1('0x10')](_0xf4b1('0x12'),_0x3b9c78,_0x5cb2a1);_0x59cf77(_0x5cb2a1);});});}exports['CreateAttachment']=function(_0x3b378e){var _0x420f9e=this;return new Promise(function(_0x322b38,_0x465da2){return db[_0xf4b1('0x14')][_0xf4b1('0x15')](_0x3b378e['body'],{'raw':_0x3b378e[_0xf4b1('0x16')]?_0x3b378e[_0xf4b1('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xf4b1('0xa')](function(_0x30c239){logger['info'](_0xf4b1('0x17'),_0x3b378e);logger[_0xf4b1('0xc')](_0xf4b1('0x17'),_0x3b378e,JSON[_0xf4b1('0xf')](_0x30c239));_0x322b38(_0x30c239);})['catch'](function(_0x20013c){logger[_0xf4b1('0x10')](_0xf4b1('0x17'),_0x20013c[_0xf4b1('0x13')],_0x3b378e);_0x465da2(_0x420f9e['error'](0x1f4,_0x20013c[_0xf4b1('0x13')]));});});}; \ No newline at end of file +var _0xfa2b=['Attachment','create','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','code','error','message','result','CreateAttachment'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x9e87d6,_0x5afee5){_0x9e87d6=_0x9e87d6-0x0;var _0x24f3f2=_0xfa2b[_0x9e87d6];return _0x24f3f2;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));var BPromise=require(_0xbfa2('0x3'));var rs=require(_0xbfa2('0x4'));var fs=require('fs');var Redis=require(_0xbfa2('0x5'));var db=require(_0xbfa2('0x6'))['db'];var utils=require(_0xbfa2('0x7'));var logger=require(_0xbfa2('0x8'))(_0xbfa2('0x9'));var config=require(_0xbfa2('0xa'));var jayson=require(_0xbfa2('0xb'));var client=jayson[_0xbfa2('0xc')][_0xbfa2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26ed93,_0x26e9bf,_0x4cd9ae){return new BPromise(function(_0x46a151,_0x4f17e6){return client[_0xbfa2('0xe')](_0x26ed93,_0x4cd9ae)[_0xbfa2('0xf')](function(_0x1b1c13){logger[_0xbfa2('0x10')](_0xbfa2('0x11'),_0x26e9bf,_0xbfa2('0x12'));logger[_0xbfa2('0x13')](_0xbfa2('0x14'),_0x26e9bf,_0xbfa2('0x12'),JSON['stringify'](_0x1b1c13));if(_0x1b1c13['error']){if(_0x1b1c13['error'][_0xbfa2('0x15')]===0x1f4){logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x4f17e6(_0x1b1c13[_0xbfa2('0x16')]['message']);}logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x46a151(_0x1b1c13[_0xbfa2('0x16')]['message']);}else{logger[_0xbfa2('0x10')]('Attachment,\x20%s,\x20%s',_0x26e9bf,'request\x20sent');_0x46a151(_0x1b1c13[_0xbfa2('0x18')]['message']);}})['catch'](function(_0xab2c91){logger[_0xbfa2('0x16')]('Attachment,\x20%s,\x20%s',_0x26e9bf,_0xab2c91);_0x4f17e6(_0xab2c91);});});}exports[_0xbfa2('0x19')]=function(_0x12627a){var _0x28fe6f=this;return new Promise(function(_0x4088c5,_0x37aed6){return db[_0xbfa2('0x1a')][_0xbfa2('0x1b')](_0x12627a['body'],{'raw':_0x12627a[_0xbfa2('0x1c')]?_0x12627a[_0xbfa2('0x1c')][_0xbfa2('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2ac6c3){logger[_0xbfa2('0x10')]('CreateAttachment',_0x12627a);logger[_0xbfa2('0x13')]('CreateAttachment',_0x12627a,JSON['stringify'](_0x2ac6c3));_0x4088c5(_0x2ac6c3);})[_0xbfa2('0x1e')](function(_0xdb059b){logger[_0xbfa2('0x16')](_0xbfa2('0x19'),_0xdb059b['message'],_0x12627a);_0x37aed6(_0x28fe6f['error'](0x1f4,_0xdb059b[_0xbfa2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 96495e6..1e1c26b 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xcff935,_0x13fd88){var _0x8b7ae2=function(_0x53b3e9){while(--_0x53b3e9){_0xcff935['push'](_0xcff935['shift']());}};_0x8b7ae2(++_0x13fd88);}(_0x2032,0xd9));var _0x2203=function(_0x59a989,_0x289679){_0x59a989=_0x59a989-0x0;var _0x5211c0=_0x2032[_0x59a989];return _0x5211c0;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e92af84..365cf31 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 _0xef57=['profile','email','callback','use','google','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','agent','then','disabled','blocked','blockedAt','add','blockDuration','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','/login'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0xef57,0x1ec));var _0x7ef5=function(_0x3ee6d9,_0x5b6235){_0x3ee6d9=_0x3ee6d9-0x0;var _0x241df6=_0xef57[_0x3ee6d9];return _0x241df6;};'use strict';var _=require(_0x7ef5('0x0'));var passport=require(_0x7ef5('0x1'));var GoogleStrategy=require(_0x7ef5('0x2'))[_0x7ef5('0x3')];var moment=require(_0x7ef5('0x4'));var db=require(_0x7ef5('0x5'))['db'];var config=require(_0x7ef5('0x6'));var signToken=require(_0x7ef5('0x7'))[_0x7ef5('0x8')];var utils=require(_0x7ef5('0x9'));exports['login']=passport[_0x7ef5('0xa')]('google',{'failureRedirect':_0x7ef5('0xb'),'scope':[_0x7ef5('0xc'),_0x7ef5('0xd')],'session':![]});exports[_0x7ef5('0xe')]=passport[_0x7ef5('0xa')]('google',{'failureRedirect':_0x7ef5('0xb'),'session':![]});passport[_0x7ef5('0xf')](new GoogleStrategy({'clientID':config[_0x7ef5('0x10')]?config['google'][_0x7ef5('0x11')]:'id','clientSecret':config['google']?config[_0x7ef5('0x10')][_0x7ef5('0x12')]:_0x7ef5('0x13'),'callbackURL':config[_0x7ef5('0x10')]?config['google'][_0x7ef5('0x14')]:''},function(_0x474e8a,_0x2cd37f,_0x514d14,_0x8e6dfa){var _0x2868ba,_0x29c337;return db[_0x7ef5('0x15')][_0x7ef5('0x16')]({'where':{'id':0x1},'attributes':[_0x7ef5('0x17'),'blockDuration'],'raw':!![]})['then'](function(_0x5ece27){_0x2868ba=_0x5ece27;return db[_0x7ef5('0x18')][_0x7ef5('0x19')]({'where':{'email':_[_0x7ef5('0x1a')](_0x514d14[_0x7ef5('0x1b')],_0x7ef5('0x1c')),'role':{'$or':[_0x7ef5('0x1d'),_0x7ef5('0x1e'),_0x7ef5('0x1f')]}}});})[_0x7ef5('0x20')](function(_0x2e1185){_0x29c337=_0x2e1185;if(_0x29c337){if(_0x29c337[_0x7ef5('0x21')]){return _0x8e6dfa('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x2868ba['blockDuration']>0x0){if(_0x29c337[_0x7ef5('0x22')]){if(moment(_0x29c337[_0x7ef5('0x23')])[_0x7ef5('0x24')](_0x2868ba[_0x7ef5('0x25')],_0x7ef5('0x26'))>moment()){return _0x8e6dfa(_0x7ef5('0x27'));}else{return utils['clearBlockUser'](_0x29c337,0x0,![],null)[_0x7ef5('0x20')](function(){return utils[_0x7ef5('0x28')](_0x29c337);})['then'](function(){return _0x8e6dfa(null,_0x29c337);});}}else{return utils[_0x7ef5('0x28')](_0x29c337)[_0x7ef5('0x20')](function(){return _0x8e6dfa(null,_0x29c337);});}}else{return utils[_0x7ef5('0x28')](_0x29c337)[_0x7ef5('0x20')](function(){return _0x8e6dfa(null,_0x29c337);});}}return _0x8e6dfa(_0x7ef5('0x27'));})[_0x7ef5('0x29')](function(_0x2b3715){_0x8e6dfa(_0x2b3715);});})); \ No newline at end of file +var _0xa59f=['value','admin','user','agent','disabled','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','lodash','passport-google-oauth20','moment','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','profile','email','callback','/login','use','clientID','clientSecret','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','find','map','emails'];(function(_0x3b1bdd,_0x1fbf1b){var _0x1d0ad7=function(_0x54fcd7){while(--_0x54fcd7){_0x3b1bdd['push'](_0x3b1bdd['shift']());}};_0x1d0ad7(++_0x1fbf1b);}(_0xa59f,0xea));var _0xfa59=function(_0x5d5e5e,_0x1197a4){_0x5d5e5e=_0x5d5e5e-0x0;var _0x2fa691=_0xa59f[_0x5d5e5e];return _0x2fa691;};'use strict';var _=require(_0xfa59('0x0'));var passport=require('passport');var GoogleStrategy=require(_0xfa59('0x1'))['Strategy'];var moment=require(_0xfa59('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xfa59('0x3'));var signToken=require(_0xfa59('0x4'))['signToken'];var utils=require(_0xfa59('0x5'));exports[_0xfa59('0x6')]=passport[_0xfa59('0x7')](_0xfa59('0x8'),{'failureRedirect':'/login','scope':[_0xfa59('0x9'),_0xfa59('0xa')],'session':![]});exports[_0xfa59('0xb')]=passport[_0xfa59('0x7')](_0xfa59('0x8'),{'failureRedirect':_0xfa59('0xc'),'session':![]});passport[_0xfa59('0xd')](new GoogleStrategy({'clientID':config[_0xfa59('0x8')]?config[_0xfa59('0x8')][_0xfa59('0xe')]:'id','clientSecret':config[_0xfa59('0x8')]?config['google'][_0xfa59('0xf')]:_0xfa59('0x10'),'callbackURL':config[_0xfa59('0x8')]?config[_0xfa59('0x8')][_0xfa59('0x11')]:''},function(_0x458c80,_0x5965b5,_0x28716f,_0x9e10e3){var _0x136df0,_0x3047c9;return db['Setting'][_0xfa59('0x12')]({'where':{'id':0x1},'attributes':[_0xfa59('0x13'),_0xfa59('0x14')],'raw':!![]})[_0xfa59('0x15')](function(_0x132435){_0x136df0=_0x132435;return db['User'][_0xfa59('0x16')]({'where':{'email':_[_0xfa59('0x17')](_0x28716f[_0xfa59('0x18')],_0xfa59('0x19')),'role':{'$or':[_0xfa59('0x1a'),_0xfa59('0x1b'),_0xfa59('0x1c')]}}});})['then'](function(_0x3a5391){_0x3047c9=_0x3a5391;if(_0x3047c9){if(_0x3047c9[_0xfa59('0x1d')]){return _0x9e10e3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x136df0['blockDuration']>0x0){if(_0x3047c9[_0xfa59('0x1e')]){if(moment(_0x3047c9[_0xfa59('0x1f')])[_0xfa59('0x20')](_0x136df0[_0xfa59('0x14')],_0xfa59('0x21'))>moment()){return _0x9e10e3(_0xfa59('0x22'));}else{return utils[_0xfa59('0x23')](_0x3047c9,0x0,![],null)['then'](function(){return utils[_0xfa59('0x24')](_0x3047c9);})[_0xfa59('0x15')](function(){return _0x9e10e3(null,_0x3047c9);});}}else{return utils[_0xfa59('0x24')](_0x3047c9)[_0xfa59('0x15')](function(){return _0x9e10e3(null,_0x3047c9);});}}else{return utils['getLicense'](_0x3047c9)['then'](function(){return _0x9e10e3(null,_0x3047c9);});}}return _0x9e10e3(_0xfa59('0x22'));})['catch'](function(_0x479a04){_0x9e10e3(_0x479a04);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 83a10f2..5ac081f 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 _0x5e52=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x17f665,_0x40288e){var _0x2242eb=function(_0x4053cb){while(--_0x4053cb){_0x17f665['push'](_0x17f665['shift']());}};_0x2242eb(++_0x40288e);}(_0x5e52,0x105));var _0x25e5=function(_0x440b41,_0x408e23){_0x440b41=_0x440b41-0x0;var _0x83ed4b=_0x5e52[_0x440b41];return _0x83ed4b;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x25e5('0x0')]();var controller=require(_0x25e5('0x1'));var userController=require(_0x25e5('0x2'));var authService=require(_0x25e5('0x3'));router[_0x25e5('0x4')]('/',controller[_0x25e5('0x5')]);router[_0x25e5('0x4')](_0x25e5('0x6'),controller[_0x25e5('0x7')],authService[_0x25e5('0x8')],userController[_0x25e5('0x5')],authService[_0x25e5('0x9')]);module[_0x25e5('0xa')]=router; \ No newline at end of file +var _0x3368=['setTokenCookie','exports','express','Router','get','callback','isMiddleware'];(function(_0x3bcb39,_0x2e1bd0){var _0x158bc4=function(_0x5570d3){while(--_0x5570d3){_0x3bcb39['push'](_0x3bcb39['shift']());}};_0x158bc4(++_0x2e1bd0);}(_0x3368,0x19f));var _0x8336=function(_0x4f9ef1,_0x3cead7){_0x4f9ef1=_0x4f9ef1-0x0;var _0x3d3573=_0x3368[_0x4f9ef1];return _0x3d3573;};'use strict';var express=require(_0x8336('0x0'));var passport=require('passport');var router=express[_0x8336('0x1')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x8336('0x2')]('/',controller['login']);router[_0x8336('0x2')]('/callback',controller[_0x8336('0x3')],authService[_0x8336('0x4')],userController['login'],authService[_0x8336('0x5')]);module[_0x8336('0x6')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 23e6af9..919eda7 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 _0x32c3=['../../config/utils','client','Setting','findOne','blockDuration','then','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','add','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','util','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb'];(function(_0x14bf26,_0x47542a){var _0x49a140=function(_0x1f2d10){while(--_0x1f2d10){_0x14bf26['push'](_0x14bf26['shift']());}};_0x49a140(++_0x47542a);}(_0x32c3,0xfb));var _0x332c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32c3[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x332c('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x332c('0x1')];var jayson=require(_0x332c('0x2'));var _=require(_0x332c('0x3'));var rs=require(_0x332c('0x4'));var moment=require(_0x332c('0x5'));var db=require(_0x332c('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x332c('0x7'));var client=jayson[_0x332c('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x536898,_0x3166cb,_0x2b5c0f,_0x299f2a){var _0x37ae7b,_0x5dd11a;return db[_0x332c('0x9')][_0x332c('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x332c('0xb')],'raw':!![]})[_0x332c('0xc')](function(_0xedf7b1){_0x37ae7b=_0xedf7b1;return _0x536898[_0x332c('0xa')]({'attributes':['id','name',_0x332c('0xd'),_0x332c('0xe'),_0x332c('0xf'),_0x332c('0x10'),_0x332c('0x11'),_0x332c('0x12'),_0x332c('0x13')],'where':{'name':_0x3166cb,'role':{'$or':[_0x332c('0x14'),_0x332c('0x15'),_0x332c('0x16')]}}});})[_0x332c('0xc')](function(_0x12df0e){if(!_0x12df0e||_0x12df0e&&_0x12df0e[_0x332c('0x17')]!==_0x3166cb){throw new Error(_0x332c('0x18'));}else{_0x5dd11a=_0x12df0e;return _0x5dd11a;}})[_0x332c('0xc')](function(){_0x5dd11a[_0x332c('0x19')](_0x2b5c0f,function(_0x498838,_0xe76af3){var _0x45ac94=_0x5dd11a[_0x332c('0x13')]+0x1;if(_0x498838){return _0x299f2a(_0x498838);}else if(!_0xe76af3){if(_0x5dd11a['disabled']){return _0x299f2a(null,![],{'message':_0x332c('0x18')});}else if(_0x37ae7b[_0x332c('0x1a')]>0x0){if(_0x5dd11a['blocked']){if(_0x37ae7b[_0x332c('0xb')]>0x0){if(moment(_0x5dd11a['blockedAt'])[_0x332c('0x1b')](_0x37ae7b[_0x332c('0xb')],'minutes')>moment()){return _0x299f2a(null,![],{'message':_0x332c('0x18')});}else{return utils[_0x332c('0x1c')](_0x5dd11a,_0x45ac94,![],null)[_0x332c('0xc')](function(){return _0x299f2a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x299f2a(null,![],{'message':_0x332c('0x18')});}}else{if(_0x45ac94>=_0x37ae7b[_0x332c('0x1a')]){return utils[_0x332c('0x1c')](_0x5dd11a,0x0,!![],moment())['then'](function(){return _0x299f2a(null,![],{'message':_0x332c('0x18')});});}else{return utils[_0x332c('0x1c')](_0x5dd11a,_0x45ac94,![],null)[_0x332c('0xc')](function(){return _0x299f2a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x299f2a(null,![],{'message':_0x332c('0x18')});}}else{if(_0x5dd11a[_0x332c('0x10')]){return _0x299f2a(null,![],{'message':_0x332c('0x18')});}else if(_0x37ae7b[_0x332c('0x1a')]>0x0){if(_0x5dd11a[_0x332c('0x11')]){if(_0x37ae7b[_0x332c('0xb')]>0x0){if(moment(_0x5dd11a[_0x332c('0x12')])[_0x332c('0x1b')](_0x37ae7b['blockDuration'],'minutes')>moment()){return _0x299f2a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x332c('0x1c')](_0x5dd11a,0x0,![],null)[_0x332c('0xc')](function(){return utils[_0x332c('0x1d')](_0x5dd11a);})[_0x332c('0xc')](function(){return _0x299f2a(null,_0x5dd11a);});}}else{return _0x299f2a(null,![],{'message':_0x332c('0x18')});}}else{return utils[_0x332c('0x1c')](_0x5dd11a,0x0,![],null)[_0x332c('0xc')](function(){return utils[_0x332c('0x1d')](_0x5dd11a);})[_0x332c('0xc')](function(){return _0x299f2a(null,_0x5dd11a);})[_0x332c('0x1e')](function(_0x357195){return _0x299f2a(null,![],_0x357195);});}}else{if(_0x5dd11a[_0x332c('0x11')]){return _0x299f2a(null,![],{'message':_0x332c('0x18')});}else{return utils[_0x332c('0x1d')](_0x5dd11a)[_0x332c('0xc')](function(){return _0x299f2a(null,_0x5dd11a);});}}}});})[_0x332c('0x1e')](function(_0x1d28ad){return _0x299f2a(null,![],_0x1d28ad);});}function sendServiceMail(_0x23d4c0){return db[_0x332c('0x1f')][_0x332c('0x20')]({'where':{'service':!![]},'attributes':['id',_0x332c('0x17'),_0x332c('0x21')],'include':[{'model':db[_0x332c('0x22')],'as':_0x332c('0x23')}]})[_0x332c('0xc')](function(_0xe1c464){if(!_0xe1c464){throw new Error(_0x332c('0x24'));}var _0x3f74db={'tls':{'rejectUnauthorized':![]}};if(_0xe1c464[_0x332c('0x23')][_0x332c('0x25')]){_0x3f74db['service']=_0xe1c464['Smtp']['service'];}else{_0x3f74db[_0x332c('0x26')]=_0xe1c464[_0x332c('0x23')][_0x332c('0x26')];_0x3f74db[_0x332c('0x27')]=_0xe1c464[_0x332c('0x23')][_0x332c('0x27')];_0x3f74db[_0x332c('0x28')]=_0xe1c464[_0x332c('0x23')][_0x332c('0x28')];}if(_0xe1c464[_0x332c('0x23')]['authentication']){_0x3f74db[_0x332c('0x29')]={'user':_0xe1c464[_0x332c('0x23')]['user'],'pass':_0xe1c464[_0x332c('0x23')][_0x332c('0x2a')]};}var _0x4100fc={'account':_0x3f74db,'message':_[_0x332c('0x2b')]({'from':util[_0x332c('0x2c')](_0x332c('0x2d'),_0xe1c464[_0x332c('0x17')],_0xe1c464[_0x332c('0x21')]||_0xe1c464[_0x332c('0x23')][_0x332c('0x15')])},_0x23d4c0)};return client[_0x332c('0x2e')](_0x332c('0x2f'),_0x4100fc);})[_0x332c('0xc')](function(_0xbf6192){if(_0xbf6192[_0x332c('0x30')]){throw new Error(util['format'](_0x332c('0x31'),_0xbf6192[_0x332c('0x30')][_0x332c('0x32')]||JSON[_0x332c('0x33')](_0xbf6192[_0x332c('0x30')])));}return!![];});}function handleError(_0x419525,_0x111d46,_0x1ede5a){return _0x419525[_0x332c('0x34')](_0x111d46||0x1f4)[_0x332c('0x35')]({'message':_0x1ede5a?_0x1ede5a[_0x332c('0x32')]||_0x1ede5a:''});}exports[_0x332c('0x36')]=function(_0x12e2d8,_0x3f02fa,_0x3bb005){passport[_0x332c('0x19')]('local',function(_0x803d17,_0x519ed9,_0x41f493){var _0x1e8726=_0x803d17||_0x41f493;if(_0x1e8726){return handleError(_0x3f02fa,0x191,_0x1e8726);}if(!_0x519ed9){return handleError(_0x3f02fa,0x194,{'message':_0x332c('0x37')});}else{var _0x589c0b={'payload':{'id':_0x519ed9['id'],'role':_0x519ed9[_0x332c('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x332c('0x38')](_0x589c0b)[_0x332c('0xc')](function(_0x4e25da){_0x3f02fa['json']({'id':_0x519ed9['id'],'token':_0x4e25da,'statusCall':'','isAlreadyLogged':_0x519ed9[_0x332c('0x39')]});});}})(_0x12e2d8,_0x3f02fa,_0x3bb005);};exports[_0x332c('0x3a')]=function(_0x2c196c,_0x5f5211,_0x477d80){if(!_0x2c196c['body']['email']){return handleError(_0x5f5211,0x1f4,{'message':_0x332c('0x3b')});}var _0x13a6a6=rs[_0x332c('0x3c')]();_0x2c196c['body'][_0x332c('0x21')]=_0x2c196c[_0x332c('0x3d')][_0x332c('0x21')][_0x332c('0x3e')]()[_0x332c('0x3f')]();var _0x363514;return db[_0x332c('0x9')][_0x332c('0xa')]({'where':{'id':0x1},'attributes':[_0x332c('0x1a'),_0x332c('0xb')],'raw':!![]})[_0x332c('0xc')](function(_0xd7aa9a){_0x363514=_0xd7aa9a;return db[_0x332c('0x40')]['find']({'where':{'email':_0x2c196c[_0x332c('0x3d')][_0x332c('0x21')]}});})[_0x332c('0xc')](function(_0x5a2d58){if(!_0x5a2d58){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x5a2d58[_0x332c('0x10')]){throw new Error(_0x332c('0x41'));}if(_0x5a2d58['blocked']){if(moment(_0x5a2d58[_0x332c('0x12')])[_0x332c('0x1b')](_0x363514[_0x332c('0xb')],_0x332c('0x42'))>moment()){throw new Error(_0x332c('0x43'));}else{_0x5a2d58[_0x332c('0x11')]=![];_0x5a2d58[_0x332c('0x12')]=null;}}_0x5a2d58['resetPasswordToken']=_0x13a6a6;_0x5a2d58[_0x332c('0x44')]=Date[_0x332c('0x45')]()+0x36ee80;return _0x5a2d58[_0x332c('0x46')]();})[_0x332c('0xc')](function(){return sendServiceMail({'to':_0x2c196c[_0x332c('0x3d')][_0x332c('0x21')],'subject':_0x332c('0x47'),'text':_0x332c('0x48')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x332c('0x49')+_0x2c196c['headers'][_0x332c('0x26')]+_0x332c('0x4a')+_0x13a6a6+'\x0a\x0a'+_0x332c('0x4b')});})[_0x332c('0xc')](function(){_0x5f5211[_0x332c('0x34')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x332c('0x1e')](function(_0x1dc602){return handleError(_0x5f5211,0x1f4,_0x1dc602);});};exports[_0x332c('0x4c')]=function(_0x431e47,_0x37090d,_0x4d7169){return db[_0x332c('0x40')][_0x332c('0x20')]({'where':{'resetPasswordToken':_0x431e47['params'][_0x332c('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x332c('0x45')]()}}})[_0x332c('0xc')](function(_0x492e8d){if(!_0x492e8d){throw new Error(_0x332c('0x4e'));}return db[_0x332c('0x9')][_0x332c('0xa')]({'attributes':['id','securePassword',_0x332c('0x4f'),_0x332c('0x50')]})[_0x332c('0xc')](function(_0x369543){if(_0x369543[_0x332c('0x51')])authService[_0x332c('0x52')](_0x431e47['body'][_0x332c('0xd')]);if(!_0x369543[_0x332c('0x4f')]||!_0x492e8d[_0x332c('0x53')])return _0x492e8d;authService[_0x332c('0x54')](_0x431e47[_0x332c('0x3d')][_0x332c('0xd')],_0x492e8d[_0x332c('0x53')],_0x369543[_0x332c('0x50')]);return _0x492e8d;})['then'](function(){_0x492e8d[_0x332c('0xd')]=_0x431e47[_0x332c('0x3d')]['password'];_0x492e8d[_0x332c('0x55')]=null;_0x492e8d['resetPasswordExpires']=null;return _0x492e8d['save']();});})['then'](function(){_0x37090d['status'](0xc8)[_0x332c('0x35')]({'message':'Password\x20reset!'});})[_0x332c('0x1e')](function(_0x2486ce){return handleError(_0x37090d,0x1f4,_0x2486ce);});};passport['use'](new LocalStrategy({'usernameField':_0x332c('0x17'),'passwordField':_0x332c('0xd')},function(_0x183477,_0x3070c0,_0x4a6b67){return localAuthenticate(db[_0x332c('0x40')],_0x183477,_0x3070c0,_0x4a6b67);})); \ No newline at end of file +var _0xeee0=['secure','auth','pass','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','password','enforcePasswordHistory','previousPasswords','resetPasswordToken','use','User','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','minutes','getLicense','catch','MailAccount','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port'];(function(_0x3be8a8,_0x2f3e3c){var _0x3e442e=function(_0x3e57d5){while(--_0x3e57d5){_0x3be8a8['push'](_0x3be8a8['shift']());}};_0x3e442e(++_0x2f3e3c);}(_0xeee0,0x183));var _0x0eee=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xeee0[_0x1fd9e7];return _0x1781f2;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x0eee('0x0'))[_0x0eee('0x1')];var jayson=require(_0x0eee('0x2'));var _=require(_0x0eee('0x3'));var rs=require(_0x0eee('0x4'));var moment=require(_0x0eee('0x5'));var db=require(_0x0eee('0x6'))['db'];var authService=require(_0x0eee('0x7'));var utils=require('../../config/utils');var client=jayson[_0x0eee('0x8')][_0x0eee('0x9')]({'port':0x232b});function localAuthenticate(_0x52bcaf,_0x4a94b1,_0x54520a,_0x258d69){var _0x3639b6,_0x341460;return db[_0x0eee('0xa')][_0x0eee('0xb')]({'where':{'id':0x1},'attributes':[_0x0eee('0xc'),_0x0eee('0xd')],'raw':!![]})[_0x0eee('0xe')](function(_0x46e482){_0x3639b6=_0x46e482;return _0x52bcaf[_0x0eee('0xb')]({'attributes':['id',_0x0eee('0xf'),'password','salt',_0x0eee('0x10'),_0x0eee('0x11'),_0x0eee('0x12'),_0x0eee('0x13'),_0x0eee('0x14')],'where':{'name':_0x4a94b1,'role':{'$or':[_0x0eee('0x15'),_0x0eee('0x16'),_0x0eee('0x17')]}}});})[_0x0eee('0xe')](function(_0x196331){if(!_0x196331||_0x196331&&_0x196331[_0x0eee('0xf')]!==_0x4a94b1){throw new Error(_0x0eee('0x18'));}else{_0x341460=_0x196331;return _0x341460;}})[_0x0eee('0xe')](function(){_0x341460[_0x0eee('0x19')](_0x54520a,function(_0xbe0361,_0x17ea7c){var _0x50fe24=_0x341460[_0x0eee('0x14')]+0x1;if(_0xbe0361){return _0x258d69(_0xbe0361);}else if(!_0x17ea7c){if(_0x341460['disabled']){return _0x258d69(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3639b6[_0x0eee('0xc')]>0x0){if(_0x341460['blocked']){if(_0x3639b6['blockDuration']>0x0){if(moment(_0x341460[_0x0eee('0x13')])[_0x0eee('0x1a')](_0x3639b6[_0x0eee('0xd')],'minutes')>moment()){return _0x258d69(null,![],{'message':_0x0eee('0x18')});}else{return utils[_0x0eee('0x1b')](_0x341460,_0x50fe24,![],null)[_0x0eee('0xe')](function(){return _0x258d69(null,![],{'message':_0x0eee('0x18')});});}}else{return _0x258d69(null,![],{'message':_0x0eee('0x18')});}}else{if(_0x50fe24>=_0x3639b6[_0x0eee('0xc')]){return utils[_0x0eee('0x1b')](_0x341460,0x0,!![],moment())[_0x0eee('0xe')](function(){return _0x258d69(null,![],{'message':_0x0eee('0x18')});});}else{return utils[_0x0eee('0x1b')](_0x341460,_0x50fe24,![],null)[_0x0eee('0xe')](function(){return _0x258d69(null,![],{'message':_0x0eee('0x18')});});}}}else{return _0x258d69(null,![],{'message':_0x0eee('0x18')});}}else{if(_0x341460['disabled']){return _0x258d69(null,![],{'message':_0x0eee('0x18')});}else if(_0x3639b6[_0x0eee('0xc')]>0x0){if(_0x341460['blocked']){if(_0x3639b6[_0x0eee('0xd')]>0x0){if(moment(_0x341460['blockedAt'])[_0x0eee('0x1a')](_0x3639b6['blockDuration'],_0x0eee('0x1c'))>moment()){return _0x258d69(null,![],{'message':_0x0eee('0x18')});}else{return utils[_0x0eee('0x1b')](_0x341460,0x0,![],null)[_0x0eee('0xe')](function(){return utils['getLicense'](_0x341460);})[_0x0eee('0xe')](function(){return _0x258d69(null,_0x341460);});}}else{return _0x258d69(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x0eee('0x1b')](_0x341460,0x0,![],null)[_0x0eee('0xe')](function(){return utils[_0x0eee('0x1d')](_0x341460);})[_0x0eee('0xe')](function(){return _0x258d69(null,_0x341460);})['catch'](function(_0x2fbdc2){return _0x258d69(null,![],_0x2fbdc2);});}}else{if(_0x341460[_0x0eee('0x12')]){return _0x258d69(null,![],{'message':_0x0eee('0x18')});}else{return utils['getLicense'](_0x341460)['then'](function(){return _0x258d69(null,_0x341460);});}}}});})[_0x0eee('0x1e')](function(_0x306029){return _0x258d69(null,![],_0x306029);});}function sendServiceMail(_0x81559){return db[_0x0eee('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x0eee('0xf'),_0x0eee('0x20')],'include':[{'model':db['MailServerOut'],'as':_0x0eee('0x21')}]})[_0x0eee('0xe')](function(_0x1d0ac1){if(!_0x1d0ac1){throw new Error(_0x0eee('0x22'));}var _0x346028={'tls':{'rejectUnauthorized':![]}};if(_0x1d0ac1['Smtp'][_0x0eee('0x23')]){_0x346028[_0x0eee('0x23')]=_0x1d0ac1['Smtp']['service'];}else{_0x346028[_0x0eee('0x24')]=_0x1d0ac1[_0x0eee('0x21')][_0x0eee('0x24')];_0x346028[_0x0eee('0x25')]=_0x1d0ac1[_0x0eee('0x21')][_0x0eee('0x25')];_0x346028[_0x0eee('0x26')]=_0x1d0ac1['Smtp'][_0x0eee('0x26')];}if(_0x1d0ac1[_0x0eee('0x21')]['authentication']){_0x346028[_0x0eee('0x27')]={'user':_0x1d0ac1[_0x0eee('0x21')][_0x0eee('0x16')],'pass':_0x1d0ac1[_0x0eee('0x21')][_0x0eee('0x28')]};}var _0xbdb49c={'account':_0x346028,'message':_['merge']({'from':util[_0x0eee('0x29')](_0x0eee('0x2a'),_0x1d0ac1[_0x0eee('0xf')],_0x1d0ac1['email']||_0x1d0ac1[_0x0eee('0x21')]['user'])},_0x81559)};return client[_0x0eee('0x2b')](_0x0eee('0x2c'),_0xbdb49c);})['then'](function(_0x520770){if(_0x520770[_0x0eee('0x2d')]){throw new Error(util[_0x0eee('0x29')](_0x0eee('0x2e'),_0x520770[_0x0eee('0x2d')][_0x0eee('0x2f')]||JSON[_0x0eee('0x30')](_0x520770[_0x0eee('0x2d')])));}return!![];});}function handleError(_0x36ae28,_0x4872d8,_0x51538a){return _0x36ae28[_0x0eee('0x31')](_0x4872d8||0x1f4)[_0x0eee('0x32')]({'message':_0x51538a?_0x51538a[_0x0eee('0x2f')]||_0x51538a:''});}exports[_0x0eee('0x33')]=function(_0x380b27,_0x1c3516,_0x4fb0cc){passport[_0x0eee('0x19')](_0x0eee('0x34'),function(_0x1efee0,_0x2ee3db,_0x2fc899){var _0x13c597=_0x1efee0||_0x2fc899;if(_0x13c597){return handleError(_0x1c3516,0x191,_0x13c597);}if(!_0x2ee3db){return handleError(_0x1c3516,0x194,{'message':_0x0eee('0x35')});}else{var _0x1c966f={'payload':{'id':_0x2ee3db['id'],'role':_0x2ee3db[_0x0eee('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x0eee('0x36')](_0x1c966f)[_0x0eee('0xe')](function(_0x1e2a24){_0x1c3516['json']({'id':_0x2ee3db['id'],'token':_0x1e2a24,'statusCall':'','isAlreadyLogged':_0x2ee3db[_0x0eee('0x37')]});});}})(_0x380b27,_0x1c3516,_0x4fb0cc);};exports[_0x0eee('0x38')]=function(_0x33a034,_0x1fe45d,_0x1072e3){if(!_0x33a034[_0x0eee('0x39')][_0x0eee('0x20')]){return handleError(_0x1fe45d,0x1f4,{'message':_0x0eee('0x3a')});}var _0x1ac26c=rs[_0x0eee('0x3b')]();_0x33a034['body'][_0x0eee('0x20')]=_0x33a034[_0x0eee('0x39')][_0x0eee('0x20')]['trim']()[_0x0eee('0x3c')]();var _0x2625d8;return db[_0x0eee('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x0eee('0xc'),_0x0eee('0xd')],'raw':!![]})[_0x0eee('0xe')](function(_0x24721a){_0x2625d8=_0x24721a;return db['User'][_0x0eee('0x3d')]({'where':{'email':_0x33a034[_0x0eee('0x39')][_0x0eee('0x20')]}});})['then'](function(_0x590a08){if(!_0x590a08){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x590a08[_0x0eee('0x11')]){throw new Error(_0x0eee('0x3e'));}if(_0x590a08[_0x0eee('0x12')]){if(moment(_0x590a08[_0x0eee('0x13')])[_0x0eee('0x1a')](_0x2625d8[_0x0eee('0xd')],_0x0eee('0x1c'))>moment()){throw new Error(_0x0eee('0x3f'));}else{_0x590a08['blocked']=![];_0x590a08[_0x0eee('0x13')]=null;}}_0x590a08['resetPasswordToken']=_0x1ac26c;_0x590a08[_0x0eee('0x40')]=Date[_0x0eee('0x41')]()+0x36ee80;return _0x590a08[_0x0eee('0x42')]();})[_0x0eee('0xe')](function(){return sendServiceMail({'to':_0x33a034['body'][_0x0eee('0x20')],'subject':_0x0eee('0x43'),'text':_0x0eee('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x33a034[_0x0eee('0x45')][_0x0eee('0x24')]+_0x0eee('0x46')+_0x1ac26c+'\x0a\x0a'+_0x0eee('0x47')});})[_0x0eee('0xe')](function(){_0x1fe45d['status'](0xc8)[_0x0eee('0x32')]({'message':_0x0eee('0x48')});})[_0x0eee('0x1e')](function(_0x4fe571){return handleError(_0x1fe45d,0x1f4,_0x4fe571);});};exports[_0x0eee('0x49')]=function(_0x72840f,_0x55d3c8,_0x28b31d){return db['User'][_0x0eee('0x3d')]({'where':{'resetPasswordToken':_0x72840f[_0x0eee('0x4a')][_0x0eee('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x0eee('0x41')]()}}})[_0x0eee('0xe')](function(_0x1003d6){if(!_0x1003d6){throw new Error(_0x0eee('0x4c'));}return db[_0x0eee('0xa')][_0x0eee('0xb')]({'attributes':['id',_0x0eee('0x4d'),'enforcePasswordHistory',_0x0eee('0x4e')]})['then'](function(_0x56f804){if(_0x56f804[_0x0eee('0x4d')])authService['validatePasswordPattern'](_0x72840f[_0x0eee('0x39')][_0x0eee('0x4f')]);if(!_0x56f804[_0x0eee('0x50')]||!_0x1003d6[_0x0eee('0x51')])return _0x1003d6;authService['validatePasswordHistory'](_0x72840f[_0x0eee('0x39')][_0x0eee('0x4f')],_0x1003d6[_0x0eee('0x51')],_0x56f804[_0x0eee('0x4e')]);return _0x1003d6;})['then'](function(){_0x1003d6['password']=_0x72840f[_0x0eee('0x39')][_0x0eee('0x4f')];_0x1003d6[_0x0eee('0x52')]=null;_0x1003d6[_0x0eee('0x40')]=null;return _0x1003d6[_0x0eee('0x42')]();});})[_0x0eee('0xe')](function(){_0x55d3c8['status'](0xc8)['send']({'message':'Password\x20reset!'});})[_0x0eee('0x1e')](function(_0x3108a5){return handleError(_0x55d3c8,0x1f4,_0x3108a5);});};passport[_0x0eee('0x53')](new LocalStrategy({'usernameField':_0x0eee('0xf'),'passwordField':'password'},function(_0x3026be,_0x5b689b,_0x2c900f){return localAuthenticate(db[_0x0eee('0x54')],_0x3026be,_0x5b689b,_0x2c900f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1c0c4c1..063625f 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 _0x8fe8=['/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller','post','login'];(function(_0x683c07,_0xe8247f){var _0x330977=function(_0x2cecc2){while(--_0x2cecc2){_0x683c07['push'](_0x683c07['shift']());}};_0x330977(++_0xe8247f);}(_0x8fe8,0x12d));var _0x88fe=function(_0x4fff05,_0x1f794b){_0x4fff05=_0x4fff05-0x0;var _0x449a29=_0x8fe8[_0x4fff05];return _0x449a29;};'use strict';var express=require(_0x88fe('0x0'));var router=express[_0x88fe('0x1')]();var controller=require(_0x88fe('0x2'));router[_0x88fe('0x3')]('/',controller[_0x88fe('0x4')]);router[_0x88fe('0x3')](_0x88fe('0x5'),controller[_0x88fe('0x6')]);router[_0x88fe('0x3')](_0x88fe('0x7'),controller[_0x88fe('0x8')]);module['exports']=router; \ No newline at end of file +var _0x2640=['/forgot','forgot','/reset/:token','exports','express','Router','./authLocal.controller','login','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2640,0x8b));var _0x0264=function(_0x2668a3,_0x55fbf7){_0x2668a3=_0x2668a3-0x0;var _0x4b2aa0=_0x2640[_0x2668a3];return _0x4b2aa0;};'use strict';var express=require(_0x0264('0x0'));var router=express[_0x0264('0x1')]();var controller=require(_0x0264('0x2'));router['post']('/',controller[_0x0264('0x3')]);router[_0x0264('0x4')](_0x0264('0x5'),controller[_0x0264('0x6')]);router[_0x0264('0x4')](_0x0264('0x7'),controller['reset']);module[_0x0264('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 872caff..e14199a 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 _0x790f=['BOOLEAN','sequelize','STRING'];(function(_0x15db81,_0x23f4cd){var _0x270fee=function(_0x58f08e){while(--_0x58f08e){_0x15db81['push'](_0x15db81['shift']());}};_0x270fee(++_0x23f4cd);}(_0x790f,0x6d));var _0xf790=function(_0x5f49c0,_0x27a1b4){_0x5f49c0=_0x5f49c0-0x0;var _0x5ab653=_0x790f[_0x5f49c0];return _0x5ab653;};'use strict';var Sequelize=require(_0xf790('0x0'));module['exports']={'name':{'type':Sequelize[_0xf790('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xf790('0x1')]},'description':{'type':Sequelize[_0xf790('0x1')]},'status':{'type':Sequelize[_0xf790('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xe8ae=['INTEGER','sequelize','exports','STRING'];(function(_0x4c7b0b,_0x2151a3){var _0x387dc2=function(_0x148a05){while(--_0x148a05){_0x4c7b0b['push'](_0x4c7b0b['shift']());}};_0x387dc2(++_0x2151a3);}(_0xe8ae,0xd9));var _0xee8a=function(_0x77d602,_0x2adebe){_0x77d602=_0x77d602-0x0;var _0x377b21=_0xe8ae[_0x77d602];return _0x377b21;};'use strict';var Sequelize=require(_0xee8a('0x0'));module[_0xee8a('0x1')]={'name':{'type':Sequelize[_0xee8a('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xee8a('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xee8a('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 815e044..af76a90 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 _0x44b9=['end','status','offset','limit','undefined','count','set','json','apply','reject','save','then','destroy','error','name','send','index','map','Automation','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','rows','options','find','catch','create','body','params','Condition','ids','omit','getConditions','filter','addActions','Action','getActions','findOne','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1bc2d7,_0x5e2e0b){var _0x3f359b=function(_0x132f30){while(--_0x132f30){_0x1bc2d7['push'](_0x1bc2d7['shift']());}};_0x3f359b(++_0x5e2e0b);}(_0x44b9,0x13c));var _0x944b=function(_0x9843b7,_0x228b9f){_0x9843b7=_0x9843b7-0x0;var _0x58a925=_0x44b9[_0x9843b7];return _0x58a925;};'use strict';var emlformat=require(_0x944b('0x0'));var rimraf=require(_0x944b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x944b('0x2'));var moment=require(_0x944b('0x3'));var BPromise=require(_0x944b('0x4'));var Mustache=require(_0x944b('0x5'));var util=require(_0x944b('0x6'));var path=require('path');var sox=require(_0x944b('0x7'));var csv=require(_0x944b('0x8'));var ejs=require(_0x944b('0x9'));var fs=require('fs');var fs_extra=require(_0x944b('0xa'));var _=require(_0x944b('0xb'));var squel=require(_0x944b('0xc'));var crypto=require(_0x944b('0xd'));var jsforce=require(_0x944b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x944b('0xf'));var Papa=require(_0x944b('0x10'));var Redis=require(_0x944b('0x11'));var authService=require(_0x944b('0x12'));var qs=require(_0x944b('0x13'));var as=require(_0x944b('0x14'));var hardwareService=require(_0x944b('0x15'));var logger=require(_0x944b('0x16'))(_0x944b('0x17'));var utils=require('../../config/utils');var config=require(_0x944b('0x18'));var licenseUtil=require(_0x944b('0x19'));var db=require(_0x944b('0x1a'))['db'];function respondWithStatusCode(_0x32ab7d,_0x2fdd00){_0x2fdd00=_0x2fdd00||0xcc;return function(_0x192b2e){if(_0x192b2e){return _0x32ab7d[_0x944b('0x1b')](_0x2fdd00);}return _0x32ab7d['status'](_0x2fdd00)[_0x944b('0x1c')]();};}function respondWithResult(_0x1657b8,_0x884d5e){_0x884d5e=_0x884d5e||0xc8;return function(_0x5815e5){if(_0x5815e5){return _0x1657b8[_0x944b('0x1d')](_0x884d5e)['json'](_0x5815e5);}};}function respondWithFilteredResult(_0x4ec69d,_0xdd1e4f){return function(_0x12a034){if(_0x12a034){var _0xdb7bd9=typeof _0xdd1e4f[_0x944b('0x1e')]==='undefined'&&typeof _0xdd1e4f[_0x944b('0x1f')]===_0x944b('0x20');var _0x31538a=_0x12a034[_0x944b('0x21')];var _0x23cb9e=_0xdb7bd9?0x0:_0xdd1e4f['offset'];var _0x4a5b72=_0xdb7bd9?_0x12a034[_0x944b('0x21')]:_0xdd1e4f[_0x944b('0x1e')]+_0xdd1e4f[_0x944b('0x1f')];var _0x284116;if(_0x4a5b72>=_0x31538a){_0x4a5b72=_0x31538a;_0x284116=0xc8;}else{_0x284116=0xce;}_0x4ec69d[_0x944b('0x1d')](_0x284116);return _0x4ec69d[_0x944b('0x22')]('Content-Range',_0x23cb9e+'-'+_0x4a5b72+'/'+_0x31538a)[_0x944b('0x23')](_0x12a034);}return null;};}function patchUpdates(_0x37fea7){return function(_0x424239){try{jsonpatch[_0x944b('0x24')](_0x424239,_0x37fea7,!![]);}catch(_0x15030d){return BPromise[_0x944b('0x25')](_0x15030d);}return _0x424239[_0x944b('0x26')]();};}function saveUpdates(_0x1a2c85,_0x1d2eed){return function(_0xa59684){if(_0xa59684){return _0xa59684['update'](_0x1a2c85)[_0x944b('0x27')](function(_0x2f0501){return _0x2f0501;});}return null;};}function removeEntity(_0x5e33df,_0x453d8c){return function(_0x4e28b2){if(_0x4e28b2){return _0x4e28b2[_0x944b('0x28')]()[_0x944b('0x27')](function(){_0x5e33df[_0x944b('0x1d')](0xcc)[_0x944b('0x1c')]();});}};}function handleEntityNotFound(_0xbb47ae,_0x490e20){return function(_0x1138c0){if(!_0x1138c0){_0xbb47ae[_0x944b('0x1b')](0x194);}return _0x1138c0;};}function handleError(_0x324914,_0x11aeeb){_0x11aeeb=_0x11aeeb||0x1f4;return function(_0x1b7ff7){logger[_0x944b('0x29')](_0x1b7ff7['stack']);if(_0x1b7ff7[_0x944b('0x2a')]){delete _0x1b7ff7[_0x944b('0x2a')];}_0x324914[_0x944b('0x1d')](_0x11aeeb)[_0x944b('0x2b')](_0x1b7ff7);};}exports[_0x944b('0x2c')]=function(_0x2ba36e,_0x39b93b){var _0x19140b={},_0x13db61={},_0x573eb5={'count':0x0,'rows':[]};var _0x3b2fb6=_[_0x944b('0x2d')](db[_0x944b('0x2e')][_0x944b('0x2f')],function(_0x56c333){return{'name':_0x56c333[_0x944b('0x30')],'type':_0x56c333[_0x944b('0x31')][_0x944b('0x32')]};});_0x13db61['model']=_[_0x944b('0x2d')](_0x3b2fb6,_0x944b('0x2a'));_0x13db61[_0x944b('0x33')]=_[_0x944b('0x34')](_0x2ba36e[_0x944b('0x33')]);_0x13db61['filters']=_[_0x944b('0x35')](_0x13db61[_0x944b('0x36')],_0x13db61[_0x944b('0x33')]);_0x19140b['attributes']=_['intersection'](_0x13db61['model'],qs[_0x944b('0x37')](_0x2ba36e[_0x944b('0x33')][_0x944b('0x37')]));_0x19140b[_0x944b('0x38')]=_0x19140b[_0x944b('0x38')][_0x944b('0x39')]?_0x19140b['attributes']:_0x13db61[_0x944b('0x36')];if(!_0x2ba36e[_0x944b('0x33')][_0x944b('0x3a')](_0x944b('0x3b'))){_0x19140b[_0x944b('0x1f')]=qs[_0x944b('0x1f')](_0x2ba36e['query'][_0x944b('0x1f')]);_0x19140b[_0x944b('0x1e')]=qs[_0x944b('0x1e')](_0x2ba36e['query'][_0x944b('0x1e')]);}_0x19140b[_0x944b('0x3c')]=qs[_0x944b('0x3d')](_0x2ba36e[_0x944b('0x33')][_0x944b('0x3d')]);_0x19140b[_0x944b('0x3e')]=qs[_0x944b('0x3f')](_[_0x944b('0x40')](_0x2ba36e['query'],_0x13db61[_0x944b('0x3f')]),_0x3b2fb6);if(_0x2ba36e[_0x944b('0x33')]['filter']){_0x19140b[_0x944b('0x3e')]=_[_0x944b('0x41')](_0x19140b[_0x944b('0x3e')],{'$or':_['map'](_0x3b2fb6,function(_0x251cbf){if(_0x251cbf[_0x944b('0x31')]!==_0x944b('0x42')){var _0x462b7b={};_0x462b7b[_0x251cbf[_0x944b('0x2a')]]={'$like':'%'+_0x2ba36e[_0x944b('0x33')]['filter']+'%'};return _0x462b7b;}})});}_0x19140b=_[_0x944b('0x41')]({},_0x19140b,_0x2ba36e['options']);var _0x103d50={'where':_0x19140b['where']};return db[_0x944b('0x2e')][_0x944b('0x21')](_0x103d50)[_0x944b('0x27')](function(_0xd75d12){_0x573eb5[_0x944b('0x21')]=_0xd75d12;if(_0x2ba36e['query'][_0x944b('0x43')]){_0x19140b[_0x944b('0x44')]=[{'all':!![]}];}return db['Automation'][_0x944b('0x45')](_0x19140b);})[_0x944b('0x27')](function(_0x56174f){_0x573eb5[_0x944b('0x46')]=_0x56174f;return _0x573eb5;})[_0x944b('0x27')](respondWithFilteredResult(_0x39b93b,_0x19140b))['catch'](handleError(_0x39b93b,null));};exports['show']=function(_0x5824c7,_0xf063a){var _0x289e5c={'raw':![],'where':{'id':_0x5824c7['params']['id']}},_0x2922c5={};_0x2922c5[_0x944b('0x36')]=_['keys'](db[_0x944b('0x2e')][_0x944b('0x2f')]);_0x2922c5['query']=_[_0x944b('0x34')](_0x5824c7[_0x944b('0x33')]);_0x2922c5[_0x944b('0x3f')]=_[_0x944b('0x35')](_0x2922c5[_0x944b('0x36')],_0x2922c5[_0x944b('0x33')]);_0x289e5c[_0x944b('0x38')]=_[_0x944b('0x35')](_0x2922c5['model'],qs[_0x944b('0x37')](_0x5824c7[_0x944b('0x33')][_0x944b('0x37')]));_0x289e5c['attributes']=_0x289e5c['attributes']['length']?_0x289e5c[_0x944b('0x38')]:_0x2922c5['model'];if(_0x5824c7[_0x944b('0x33')][_0x944b('0x43')]){_0x289e5c[_0x944b('0x44')]=[{'all':!![]}];}_0x289e5c=_[_0x944b('0x41')]({},_0x289e5c,_0x5824c7[_0x944b('0x47')]);return db[_0x944b('0x2e')][_0x944b('0x48')](_0x289e5c)['then'](handleEntityNotFound(_0xf063a,null))[_0x944b('0x27')](respondWithResult(_0xf063a,null))[_0x944b('0x49')](handleError(_0xf063a,null));};exports[_0x944b('0x4a')]=function(_0x49a57d,_0x16a82b){return db[_0x944b('0x2e')][_0x944b('0x4a')](_0x49a57d[_0x944b('0x4b')],{})[_0x944b('0x27')](respondWithResult(_0x16a82b,0xc9))[_0x944b('0x49')](handleError(_0x16a82b,null));};exports['update']=function(_0x3312e9,_0x2a6779){if(_0x3312e9[_0x944b('0x4b')]['id']){delete _0x3312e9['body']['id'];}return db[_0x944b('0x2e')][_0x944b('0x48')]({'where':{'id':_0x3312e9[_0x944b('0x4c')]['id']}})[_0x944b('0x27')](handleEntityNotFound(_0x2a6779,null))[_0x944b('0x27')](saveUpdates(_0x3312e9['body'],null))['then'](respondWithResult(_0x2a6779,null))['catch'](handleError(_0x2a6779,null));};exports['destroy']=function(_0x280267,_0x324dd6){return db['Automation'][_0x944b('0x48')]({'where':{'id':_0x280267[_0x944b('0x4c')]['id']}})[_0x944b('0x27')](handleEntityNotFound(_0x324dd6,null))[_0x944b('0x27')](removeEntity(_0x324dd6,null))['catch'](handleError(_0x324dd6,null));};exports['addConditions']=function(_0x2345b2,_0x4f9294,_0x2d403d){return db[_0x944b('0x4d')][_0x944b('0x48')]({'where':{'id':_0x2345b2[_0x944b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4f9294,null))[_0x944b('0x27')](function(_0x46f0f4){if(_0x46f0f4){return _0x46f0f4['addConditions'](_0x2345b2[_0x944b('0x4b')][_0x944b('0x4e')],_[_0x944b('0x4f')](_0x2345b2['body'],[_0x944b('0x4e'),'id'])||{});}})[_0x944b('0x27')](respondWithResult(_0x4f9294,null))[_0x944b('0x49')](handleError(_0x4f9294,null));};exports[_0x944b('0x50')]=function(_0x390016,_0x1b230c,_0x9747f6){var _0xc256b6={};var _0x38d2ef={};var _0x1a9ce1;var _0x17c823;return db[_0x944b('0x2e')]['findOne']({'where':{'id':_0x390016['params']['id']}})[_0x944b('0x27')](handleEntityNotFound(_0x1b230c,null))['then'](function(_0xb699a1){if(_0xb699a1){_0x1a9ce1=_0xb699a1;_0x38d2ef[_0x944b('0x36')]=_['keys'](db[_0x944b('0x4d')][_0x944b('0x2f')]);_0x38d2ef[_0x944b('0x33')]=_['keys'](_0x390016['query']);_0x38d2ef[_0x944b('0x3f')]=_['intersection'](_0x38d2ef[_0x944b('0x36')],_0x38d2ef[_0x944b('0x33')]);_0xc256b6['attributes']=_[_0x944b('0x35')](_0x38d2ef['model'],qs[_0x944b('0x37')](_0x390016['query'][_0x944b('0x37')]));_0xc256b6[_0x944b('0x38')]=_0xc256b6[_0x944b('0x38')]['length']?_0xc256b6[_0x944b('0x38')]:_0x38d2ef[_0x944b('0x36')];_0xc256b6[_0x944b('0x3c')]=qs['sort'](_0x390016[_0x944b('0x33')]['sort']);_0xc256b6['where']=qs[_0x944b('0x3f')](_['pick'](_0x390016[_0x944b('0x33')],_0x38d2ef[_0x944b('0x3f')]));if(_0x390016[_0x944b('0x33')][_0x944b('0x51')]){_0xc256b6[_0x944b('0x3e')]=_[_0x944b('0x41')](_0xc256b6[_0x944b('0x3e')],{'$or':_[_0x944b('0x2d')](_0xc256b6[_0x944b('0x38')],function(_0x42d83){var _0x2c65f0={};_0x2c65f0[_0x42d83]={'$like':'%'+_0x390016[_0x944b('0x33')]['filter']+'%'};return _0x2c65f0;})});}_0xc256b6=_[_0x944b('0x41')]({},_0xc256b6,_0x390016[_0x944b('0x47')]);return _0x1a9ce1[_0x944b('0x50')](_0xc256b6);}})['then'](function(_0xa1f1a9){if(_0xa1f1a9){_0x17c823=_0xa1f1a9[_0x944b('0x39')];if(!_0x390016[_0x944b('0x33')][_0x944b('0x3a')](_0x944b('0x3b'))){_0xc256b6[_0x944b('0x1f')]=qs[_0x944b('0x1f')](_0x390016['query'][_0x944b('0x1f')]);_0xc256b6[_0x944b('0x1e')]=qs[_0x944b('0x1e')](_0x390016[_0x944b('0x33')][_0x944b('0x1e')]);}return _0x1a9ce1[_0x944b('0x50')](_0xc256b6);}})[_0x944b('0x27')](function(_0x355401){if(_0x355401){return _0x355401?{'count':_0x17c823,'rows':_0x355401}:null;}})[_0x944b('0x27')](respondWithResult(_0x1b230c,null))[_0x944b('0x49')](handleError(_0x1b230c,null));};exports[_0x944b('0x52')]=function(_0x355095,_0x390d8a,_0x5e5269){return db[_0x944b('0x53')][_0x944b('0x48')]({'where':{'id':_0x355095[_0x944b('0x4c')]['id']}})[_0x944b('0x27')](handleEntityNotFound(_0x390d8a,null))[_0x944b('0x27')](function(_0x2ed0a7){if(_0x2ed0a7){return _0x2ed0a7[_0x944b('0x52')](_0x355095[_0x944b('0x4b')][_0x944b('0x4e')],_[_0x944b('0x4f')](_0x355095[_0x944b('0x4b')],['ids','id'])||{});}})[_0x944b('0x27')](respondWithResult(_0x390d8a,null))[_0x944b('0x49')](handleError(_0x390d8a,null));};exports[_0x944b('0x54')]=function(_0x331a62,_0x468859,_0x2670c7){var _0x3f49d8={};var _0x2f37c0={};var _0x219a40;var _0x5346f9;return db[_0x944b('0x2e')][_0x944b('0x55')]({'where':{'id':_0x331a62[_0x944b('0x4c')]['id']}})[_0x944b('0x27')](handleEntityNotFound(_0x468859,null))[_0x944b('0x27')](function(_0x4bb9b7){if(_0x4bb9b7){_0x219a40=_0x4bb9b7;_0x2f37c0['model']=_[_0x944b('0x34')](db[_0x944b('0x53')]['rawAttributes']);_0x2f37c0['query']=_[_0x944b('0x34')](_0x331a62[_0x944b('0x33')]);_0x2f37c0[_0x944b('0x3f')]=_[_0x944b('0x35')](_0x2f37c0[_0x944b('0x36')],_0x2f37c0[_0x944b('0x33')]);_0x3f49d8[_0x944b('0x38')]=_['intersection'](_0x2f37c0[_0x944b('0x36')],qs[_0x944b('0x37')](_0x331a62[_0x944b('0x33')]['fields']));_0x3f49d8[_0x944b('0x38')]=_0x3f49d8[_0x944b('0x38')]['length']?_0x3f49d8[_0x944b('0x38')]:_0x2f37c0['model'];_0x3f49d8[_0x944b('0x3c')]=qs['sort'](_0x331a62[_0x944b('0x33')][_0x944b('0x3d')]);_0x3f49d8['where']=qs[_0x944b('0x3f')](_[_0x944b('0x40')](_0x331a62[_0x944b('0x33')],_0x2f37c0[_0x944b('0x3f')]));if(_0x331a62[_0x944b('0x33')][_0x944b('0x51')]){_0x3f49d8[_0x944b('0x3e')]=_[_0x944b('0x41')](_0x3f49d8[_0x944b('0x3e')],{'$or':_[_0x944b('0x2d')](_0x3f49d8[_0x944b('0x38')],function(_0x322e30){var _0x1a4573={};_0x1a4573[_0x322e30]={'$like':'%'+_0x331a62['query']['filter']+'%'};return _0x1a4573;})});}_0x3f49d8=_[_0x944b('0x41')]({},_0x3f49d8,_0x331a62[_0x944b('0x47')]);return _0x219a40[_0x944b('0x54')](_0x3f49d8);}})[_0x944b('0x27')](function(_0x4bfde7){if(_0x4bfde7){_0x5346f9=_0x4bfde7['length'];if(!_0x331a62['query'][_0x944b('0x3a')](_0x944b('0x3b'))){_0x3f49d8[_0x944b('0x1f')]=qs[_0x944b('0x1f')](_0x331a62[_0x944b('0x33')][_0x944b('0x1f')]);_0x3f49d8[_0x944b('0x1e')]=qs[_0x944b('0x1e')](_0x331a62['query']['offset']);}return _0x219a40[_0x944b('0x54')](_0x3f49d8);}})[_0x944b('0x27')](function(_0x2727ce){if(_0x2727ce){return _0x2727ce?{'count':_0x5346f9,'rows':_0x2727ce}:null;}})[_0x944b('0x27')](respondWithResult(_0x468859,null))[_0x944b('0x49')](handleError(_0x468859,null));}; \ No newline at end of file +var _0xfa6c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','error','name','send','index','Automation','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','then','includeAll','catch','show','rawAttributes','intersection','include','find','create','body','params','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','eml-format','rimraf','fast-json-patch','request-promise','mustache','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x40077a,_0x5f4803){var _0x46e572=function(_0x4abf86){while(--_0x4abf86){_0x40077a['push'](_0x40077a['shift']());}};_0x46e572(++_0x5f4803);}(_0xfa6c,0x183));var _0xcfa6=function(_0x26f8a6,_0x3717a9){_0x26f8a6=_0x26f8a6-0x0;var _0x2606cb=_0xfa6c[_0x26f8a6];return _0x2606cb;};'use strict';var emlformat=require(_0xcfa6('0x0'));var rimraf=require(_0xcfa6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfa6('0x2'));var rp=require(_0xcfa6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcfa6('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcfa6('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfa6('0x6'));var _=require(_0xcfa6('0x7'));var squel=require('squel');var crypto=require(_0xcfa6('0x8'));var jsforce=require(_0xcfa6('0x9'));var deskjs=require(_0xcfa6('0xa'));var toCsv=require(_0xcfa6('0x5'));var querystring=require('querystring');var Papa=require(_0xcfa6('0xb'));var Redis=require('ioredis');var authService=require(_0xcfa6('0xc'));var qs=require(_0xcfa6('0xd'));var as=require(_0xcfa6('0xe'));var hardwareService=require(_0xcfa6('0xf'));var logger=require(_0xcfa6('0x10'))(_0xcfa6('0x11'));var utils=require(_0xcfa6('0x12'));var config=require(_0xcfa6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xcfa6('0x14'))['db'];function respondWithStatusCode(_0x476af0,_0x566d77){_0x566d77=_0x566d77||0xcc;return function(_0xb0a253){if(_0xb0a253){return _0x476af0[_0xcfa6('0x15')](_0x566d77);}return _0x476af0['status'](_0x566d77)[_0xcfa6('0x16')]();};}function respondWithResult(_0x592e47,_0x21304f){_0x21304f=_0x21304f||0xc8;return function(_0x744d76){if(_0x744d76){return _0x592e47[_0xcfa6('0x17')](_0x21304f)['json'](_0x744d76);}};}function respondWithFilteredResult(_0x141ee2,_0x3baad9){return function(_0x416e3e){if(_0x416e3e){var _0x415261=typeof _0x3baad9['offset']===_0xcfa6('0x18')&&typeof _0x3baad9[_0xcfa6('0x19')]===_0xcfa6('0x18');var _0x2c615e=_0x416e3e[_0xcfa6('0x1a')];var _0x4d0f56=_0x415261?0x0:_0x3baad9[_0xcfa6('0x1b')];var _0x25e70d=_0x415261?_0x416e3e[_0xcfa6('0x1a')]:_0x3baad9[_0xcfa6('0x1b')]+_0x3baad9[_0xcfa6('0x19')];var _0x520574;if(_0x25e70d>=_0x2c615e){_0x25e70d=_0x2c615e;_0x520574=0xc8;}else{_0x520574=0xce;}_0x141ee2['status'](_0x520574);return _0x141ee2[_0xcfa6('0x1c')](_0xcfa6('0x1d'),_0x4d0f56+'-'+_0x25e70d+'/'+_0x2c615e)[_0xcfa6('0x1e')](_0x416e3e);}return null;};}function patchUpdates(_0x2793b7){return function(_0x3d018f){try{jsonpatch[_0xcfa6('0x1f')](_0x3d018f,_0x2793b7,!![]);}catch(_0x3c2d18){return BPromise[_0xcfa6('0x20')](_0x3c2d18);}return _0x3d018f[_0xcfa6('0x21')]();};}function saveUpdates(_0x39f439,_0x54dacd){return function(_0x304b92){if(_0x304b92){return _0x304b92[_0xcfa6('0x22')](_0x39f439)['then'](function(_0xe72149){return _0xe72149;});}return null;};}function removeEntity(_0x5efea2,_0x4665c7){return function(_0x3923c0){if(_0x3923c0){return _0x3923c0[_0xcfa6('0x23')]()['then'](function(){_0x5efea2[_0xcfa6('0x17')](0xcc)[_0xcfa6('0x16')]();});}};}function handleEntityNotFound(_0x14bdba,_0x116671){return function(_0x45765a){if(!_0x45765a){_0x14bdba[_0xcfa6('0x15')](0x194);}return _0x45765a;};}function handleError(_0x54783a,_0x4e8964){_0x4e8964=_0x4e8964||0x1f4;return function(_0x20a66d){logger[_0xcfa6('0x24')](_0x20a66d['stack']);if(_0x20a66d[_0xcfa6('0x25')]){delete _0x20a66d[_0xcfa6('0x25')];}_0x54783a[_0xcfa6('0x17')](_0x4e8964)[_0xcfa6('0x26')](_0x20a66d);};}exports[_0xcfa6('0x27')]=function(_0x12bed5,_0x22c054){var _0xf7e1e5={},_0x517c1e={},_0x5abe42={'count':0x0,'rows':[]};var _0x375a7f=_['map'](db[_0xcfa6('0x28')]['rawAttributes'],function(_0xb8bc1c){return{'name':_0xb8bc1c['fieldName'],'type':_0xb8bc1c[_0xcfa6('0x29')][_0xcfa6('0x2a')]};});_0x517c1e[_0xcfa6('0x2b')]=_[_0xcfa6('0x2c')](_0x375a7f,_0xcfa6('0x25'));_0x517c1e[_0xcfa6('0x2d')]=_[_0xcfa6('0x2e')](_0x12bed5[_0xcfa6('0x2d')]);_0x517c1e[_0xcfa6('0x2f')]=_['intersection'](_0x517c1e['model'],_0x517c1e[_0xcfa6('0x2d')]);_0xf7e1e5[_0xcfa6('0x30')]=_['intersection'](_0x517c1e[_0xcfa6('0x2b')],qs[_0xcfa6('0x31')](_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x31')]));_0xf7e1e5[_0xcfa6('0x30')]=_0xf7e1e5[_0xcfa6('0x30')][_0xcfa6('0x32')]?_0xf7e1e5[_0xcfa6('0x30')]:_0x517c1e[_0xcfa6('0x2b')];if(!_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x33')](_0xcfa6('0x34'))){_0xf7e1e5['limit']=qs[_0xcfa6('0x19')](_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x19')]);_0xf7e1e5['offset']=qs[_0xcfa6('0x1b')](_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x1b')]);}_0xf7e1e5[_0xcfa6('0x35')]=qs[_0xcfa6('0x36')](_0x12bed5['query']['sort']);_0xf7e1e5['where']=qs['filters'](_['pick'](_0x12bed5[_0xcfa6('0x2d')],_0x517c1e['filters']),_0x375a7f);if(_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x37')]){_0xf7e1e5[_0xcfa6('0x38')]=_[_0xcfa6('0x39')](_0xf7e1e5[_0xcfa6('0x38')],{'$or':_[_0xcfa6('0x2c')](_0x375a7f,function(_0x1e43ff){if(_0x1e43ff['type']!=='VIRTUAL'){var _0x4283fa={};_0x4283fa[_0x1e43ff[_0xcfa6('0x25')]]={'$like':'%'+_0x12bed5['query'][_0xcfa6('0x37')]+'%'};return _0x4283fa;}})});}_0xf7e1e5=_[_0xcfa6('0x39')]({},_0xf7e1e5,_0x12bed5[_0xcfa6('0x3a')]);var _0x30762f={'where':_0xf7e1e5[_0xcfa6('0x38')]};return db[_0xcfa6('0x28')][_0xcfa6('0x1a')](_0x30762f)[_0xcfa6('0x3b')](function(_0x402962){_0x5abe42[_0xcfa6('0x1a')]=_0x402962;if(_0x12bed5[_0xcfa6('0x2d')][_0xcfa6('0x3c')]){_0xf7e1e5['include']=[{'all':!![]}];}return db[_0xcfa6('0x28')]['findAll'](_0xf7e1e5);})['then'](function(_0x33c9ab){_0x5abe42['rows']=_0x33c9ab;return _0x5abe42;})['then'](respondWithFilteredResult(_0x22c054,_0xf7e1e5))[_0xcfa6('0x3d')](handleError(_0x22c054,null));};exports[_0xcfa6('0x3e')]=function(_0x1b3118,_0x3b02c4){var _0x4c7411={'raw':![],'where':{'id':_0x1b3118['params']['id']}},_0x3f451a={};_0x3f451a[_0xcfa6('0x2b')]=_['keys'](db[_0xcfa6('0x28')][_0xcfa6('0x3f')]);_0x3f451a[_0xcfa6('0x2d')]=_[_0xcfa6('0x2e')](_0x1b3118[_0xcfa6('0x2d')]);_0x3f451a[_0xcfa6('0x2f')]=_[_0xcfa6('0x40')](_0x3f451a[_0xcfa6('0x2b')],_0x3f451a['query']);_0x4c7411[_0xcfa6('0x30')]=_[_0xcfa6('0x40')](_0x3f451a[_0xcfa6('0x2b')],qs[_0xcfa6('0x31')](_0x1b3118[_0xcfa6('0x2d')][_0xcfa6('0x31')]));_0x4c7411[_0xcfa6('0x30')]=_0x4c7411[_0xcfa6('0x30')][_0xcfa6('0x32')]?_0x4c7411[_0xcfa6('0x30')]:_0x3f451a[_0xcfa6('0x2b')];if(_0x1b3118['query'][_0xcfa6('0x3c')]){_0x4c7411[_0xcfa6('0x41')]=[{'all':!![]}];}_0x4c7411=_[_0xcfa6('0x39')]({},_0x4c7411,_0x1b3118['options']);return db['Automation'][_0xcfa6('0x42')](_0x4c7411)[_0xcfa6('0x3b')](handleEntityNotFound(_0x3b02c4,null))[_0xcfa6('0x3b')](respondWithResult(_0x3b02c4,null))[_0xcfa6('0x3d')](handleError(_0x3b02c4,null));};exports['create']=function(_0x2fa682,_0x494c87){return db[_0xcfa6('0x28')][_0xcfa6('0x43')](_0x2fa682[_0xcfa6('0x44')],{})[_0xcfa6('0x3b')](respondWithResult(_0x494c87,0xc9))[_0xcfa6('0x3d')](handleError(_0x494c87,null));};exports[_0xcfa6('0x22')]=function(_0x540a20,_0x564a5e){if(_0x540a20['body']['id']){delete _0x540a20[_0xcfa6('0x44')]['id'];}return db[_0xcfa6('0x28')][_0xcfa6('0x42')]({'where':{'id':_0x540a20[_0xcfa6('0x45')]['id']}})[_0xcfa6('0x3b')](handleEntityNotFound(_0x564a5e,null))[_0xcfa6('0x3b')](saveUpdates(_0x540a20[_0xcfa6('0x44')],null))[_0xcfa6('0x3b')](respondWithResult(_0x564a5e,null))[_0xcfa6('0x3d')](handleError(_0x564a5e,null));};exports['destroy']=function(_0x32e770,_0x5acf39){return db['Automation'][_0xcfa6('0x42')]({'where':{'id':_0x32e770[_0xcfa6('0x45')]['id']}})['then'](handleEntityNotFound(_0x5acf39,null))[_0xcfa6('0x3b')](removeEntity(_0x5acf39,null))[_0xcfa6('0x3d')](handleError(_0x5acf39,null));};exports[_0xcfa6('0x46')]=function(_0x2eb72e,_0x15f128,_0x3bc234){return db[_0xcfa6('0x47')][_0xcfa6('0x42')]({'where':{'id':_0x2eb72e[_0xcfa6('0x45')]['id']}})[_0xcfa6('0x3b')](handleEntityNotFound(_0x15f128,null))[_0xcfa6('0x3b')](function(_0x1e4ab4){if(_0x1e4ab4){return _0x1e4ab4[_0xcfa6('0x46')](_0x2eb72e[_0xcfa6('0x44')][_0xcfa6('0x48')],_['omit'](_0x2eb72e[_0xcfa6('0x44')],[_0xcfa6('0x48'),'id'])||{});}})[_0xcfa6('0x3b')](respondWithResult(_0x15f128,null))[_0xcfa6('0x3d')](handleError(_0x15f128,null));};exports['getConditions']=function(_0x55e1e6,_0xc450b,_0x54a9b3){var _0x2fc46e={};var _0x6e3bd0={};var _0x42bbc7;var _0x489b9e;return db[_0xcfa6('0x28')][_0xcfa6('0x49')]({'where':{'id':_0x55e1e6[_0xcfa6('0x45')]['id']}})[_0xcfa6('0x3b')](handleEntityNotFound(_0xc450b,null))[_0xcfa6('0x3b')](function(_0x330d4b){if(_0x330d4b){_0x42bbc7=_0x330d4b;_0x6e3bd0[_0xcfa6('0x2b')]=_[_0xcfa6('0x2e')](db[_0xcfa6('0x47')][_0xcfa6('0x3f')]);_0x6e3bd0[_0xcfa6('0x2d')]=_[_0xcfa6('0x2e')](_0x55e1e6[_0xcfa6('0x2d')]);_0x6e3bd0[_0xcfa6('0x2f')]=_[_0xcfa6('0x40')](_0x6e3bd0[_0xcfa6('0x2b')],_0x6e3bd0[_0xcfa6('0x2d')]);_0x2fc46e['attributes']=_[_0xcfa6('0x40')](_0x6e3bd0['model'],qs[_0xcfa6('0x31')](_0x55e1e6[_0xcfa6('0x2d')][_0xcfa6('0x31')]));_0x2fc46e[_0xcfa6('0x30')]=_0x2fc46e[_0xcfa6('0x30')]['length']?_0x2fc46e[_0xcfa6('0x30')]:_0x6e3bd0['model'];_0x2fc46e[_0xcfa6('0x35')]=qs['sort'](_0x55e1e6['query'][_0xcfa6('0x36')]);_0x2fc46e[_0xcfa6('0x38')]=qs[_0xcfa6('0x2f')](_[_0xcfa6('0x4a')](_0x55e1e6[_0xcfa6('0x2d')],_0x6e3bd0[_0xcfa6('0x2f')]));if(_0x55e1e6['query'][_0xcfa6('0x37')]){_0x2fc46e[_0xcfa6('0x38')]=_['merge'](_0x2fc46e['where'],{'$or':_[_0xcfa6('0x2c')](_0x2fc46e[_0xcfa6('0x30')],function(_0x366530){var _0x55144a={};_0x55144a[_0x366530]={'$like':'%'+_0x55e1e6[_0xcfa6('0x2d')][_0xcfa6('0x37')]+'%'};return _0x55144a;})});}_0x2fc46e=_['merge']({},_0x2fc46e,_0x55e1e6[_0xcfa6('0x3a')]);return _0x42bbc7[_0xcfa6('0x4b')](_0x2fc46e);}})[_0xcfa6('0x3b')](function(_0x1283f8){if(_0x1283f8){_0x489b9e=_0x1283f8[_0xcfa6('0x32')];if(!_0x55e1e6[_0xcfa6('0x2d')]['hasOwnProperty']('nolimit')){_0x2fc46e[_0xcfa6('0x19')]=qs[_0xcfa6('0x19')](_0x55e1e6[_0xcfa6('0x2d')][_0xcfa6('0x19')]);_0x2fc46e[_0xcfa6('0x1b')]=qs['offset'](_0x55e1e6['query']['offset']);}return _0x42bbc7[_0xcfa6('0x4b')](_0x2fc46e);}})['then'](function(_0x322fb8){if(_0x322fb8){return _0x322fb8?{'count':_0x489b9e,'rows':_0x322fb8}:null;}})[_0xcfa6('0x3b')](respondWithResult(_0xc450b,null))['catch'](handleError(_0xc450b,null));};exports[_0xcfa6('0x4c')]=function(_0x50852e,_0x5b52a8,_0x13a1ec){return db[_0xcfa6('0x4d')]['find']({'where':{'id':_0x50852e[_0xcfa6('0x45')]['id']}})[_0xcfa6('0x3b')](handleEntityNotFound(_0x5b52a8,null))[_0xcfa6('0x3b')](function(_0xefc71a){if(_0xefc71a){return _0xefc71a[_0xcfa6('0x4c')](_0x50852e['body'][_0xcfa6('0x48')],_[_0xcfa6('0x4e')](_0x50852e[_0xcfa6('0x44')],[_0xcfa6('0x48'),'id'])||{});}})['then'](respondWithResult(_0x5b52a8,null))[_0xcfa6('0x3d')](handleError(_0x5b52a8,null));};exports[_0xcfa6('0x4f')]=function(_0x2851c2,_0x4a4f8c,_0x487258){var _0xc94991={};var _0x14ae5a={};var _0x2980c2;var _0x4a4d74;return db[_0xcfa6('0x28')][_0xcfa6('0x49')]({'where':{'id':_0x2851c2['params']['id']}})['then'](handleEntityNotFound(_0x4a4f8c,null))['then'](function(_0x53c64a){if(_0x53c64a){_0x2980c2=_0x53c64a;_0x14ae5a[_0xcfa6('0x2b')]=_['keys'](db['Action'][_0xcfa6('0x3f')]);_0x14ae5a['query']=_[_0xcfa6('0x2e')](_0x2851c2[_0xcfa6('0x2d')]);_0x14ae5a[_0xcfa6('0x2f')]=_[_0xcfa6('0x40')](_0x14ae5a[_0xcfa6('0x2b')],_0x14ae5a[_0xcfa6('0x2d')]);_0xc94991[_0xcfa6('0x30')]=_[_0xcfa6('0x40')](_0x14ae5a[_0xcfa6('0x2b')],qs[_0xcfa6('0x31')](_0x2851c2[_0xcfa6('0x2d')][_0xcfa6('0x31')]));_0xc94991[_0xcfa6('0x30')]=_0xc94991[_0xcfa6('0x30')]['length']?_0xc94991[_0xcfa6('0x30')]:_0x14ae5a[_0xcfa6('0x2b')];_0xc94991[_0xcfa6('0x35')]=qs['sort'](_0x2851c2['query'][_0xcfa6('0x36')]);_0xc94991[_0xcfa6('0x38')]=qs[_0xcfa6('0x2f')](_['pick'](_0x2851c2[_0xcfa6('0x2d')],_0x14ae5a[_0xcfa6('0x2f')]));if(_0x2851c2['query'][_0xcfa6('0x37')]){_0xc94991[_0xcfa6('0x38')]=_[_0xcfa6('0x39')](_0xc94991[_0xcfa6('0x38')],{'$or':_[_0xcfa6('0x2c')](_0xc94991[_0xcfa6('0x30')],function(_0x189326){var _0x5be985={};_0x5be985[_0x189326]={'$like':'%'+_0x2851c2[_0xcfa6('0x2d')][_0xcfa6('0x37')]+'%'};return _0x5be985;})});}_0xc94991=_[_0xcfa6('0x39')]({},_0xc94991,_0x2851c2[_0xcfa6('0x3a')]);return _0x2980c2['getActions'](_0xc94991);}})[_0xcfa6('0x3b')](function(_0x3d196f){if(_0x3d196f){_0x4a4d74=_0x3d196f[_0xcfa6('0x32')];if(!_0x2851c2[_0xcfa6('0x2d')][_0xcfa6('0x33')]('nolimit')){_0xc94991[_0xcfa6('0x19')]=qs[_0xcfa6('0x19')](_0x2851c2[_0xcfa6('0x2d')]['limit']);_0xc94991[_0xcfa6('0x1b')]=qs[_0xcfa6('0x1b')](_0x2851c2[_0xcfa6('0x2d')][_0xcfa6('0x1b')]);}return _0x2980c2[_0xcfa6('0x4f')](_0xc94991);}})[_0xcfa6('0x3b')](function(_0x40acb0){if(_0x40acb0){return _0x40acb0?{'count':_0x4a4d74,'rows':_0x40acb0}:null;}})['then'](respondWithResult(_0x4a4f8c,null))[_0xcfa6('0x3d')](handleError(_0x4a4f8c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index e7909c1..68fdcf1 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 _0x8e5c=['tools_automations','lodash','api','request-promise','rimraf','./automation.attributes','exports','define','Automation'];(function(_0x5e0a18,_0x544093){var _0x7bc05e=function(_0xa2e2e2){while(--_0xa2e2e2){_0x5e0a18['push'](_0x5e0a18['shift']());}};_0x7bc05e(++_0x544093);}(_0x8e5c,0xeb));var _0xc8e5=function(_0x27786a,_0x5a3c98){_0x27786a=_0x27786a-0x0;var _0x76741b=_0x8e5c[_0x27786a];return _0x76741b;};'use strict';var _=require(_0xc8e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc8e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc8e5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8e5('0x3'));var config=require('../../config/environment');var attributes=require(_0xc8e5('0x4'));module[_0xc8e5('0x5')]=function(_0x2a3100,_0xb7268){return _0x2a3100[_0xc8e5('0x6')](_0xc8e5('0x7'),attributes,{'tableName':_0xc8e5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89d8=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation'];(function(_0x31747b,_0x4d1d3a){var _0x56639a=function(_0x8f8213){while(--_0x8f8213){_0x31747b['push'](_0x31747b['shift']());}};_0x56639a(++_0x4d1d3a);}(_0x89d8,0xa8));var _0x889d=function(_0x1893da,_0x2d0c72){_0x1893da=_0x1893da-0x0;var _0x2becec=_0x89d8[_0x1893da];return _0x2becec;};'use strict';var _=require(_0x889d('0x0'));var util=require(_0x889d('0x1'));var logger=require(_0x889d('0x2'))('api');var moment=require(_0x889d('0x3'));var BPromise=require(_0x889d('0x4'));var rp=require(_0x889d('0x5'));var fs=require('fs');var path=require(_0x889d('0x6'));var rimraf=require(_0x889d('0x7'));var config=require('../../config/environment');var attributes=require(_0x889d('0x8'));module[_0x889d('0x9')]=function(_0x40ef60,_0x22d0c3){return _0x40ef60[_0x889d('0xa')](_0x889d('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 6b59330..4436c28 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 _0xf970=['../../config/logger','../../config/environment','jayson/promise','client','http','Automation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f97('0x0'));var util=require('util');var moment=require(_0x0f97('0x1'));var BPromise=require(_0x0f97('0x2'));var rs=require(_0x0f97('0x3'));var fs=require('fs');var Redis=require(_0x0f97('0x4'));var db=require(_0x0f97('0x5'))['db'];var utils=require(_0x0f97('0x6'));var logger=require(_0x0f97('0x7'))('rpc');var config=require(_0x0f97('0x8'));var jayson=require(_0x0f97('0x9'));var client=jayson[_0x0f97('0xa')][_0x0f97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3515,_0x3244a6,_0x12fbb3){return new BPromise(function(_0x374083,_0x2891f7){return client['request'](_0x2e3515,_0x12fbb3)['then'](function(_0x12397b){logger['info'](_0x0f97('0xc'),_0x3244a6,_0x0f97('0xd'));logger[_0x0f97('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x3244a6,_0x0f97('0xd'),JSON['stringify'](_0x12397b));if(_0x12397b[_0x0f97('0xf')]){if(_0x12397b[_0x0f97('0xf')][_0x0f97('0x10')]===0x1f4){logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x12397b['error'][_0x0f97('0x11')]);return _0x2891f7(_0x12397b[_0x0f97('0xf')][_0x0f97('0x11')]);}logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x12397b[_0x0f97('0xf')][_0x0f97('0x11')]);return _0x374083(_0x12397b['error']['message']);}else{logger[_0x0f97('0x12')](_0x0f97('0xc'),_0x3244a6,_0x0f97('0xd'));_0x374083(_0x12397b[_0x0f97('0x13')]['message']);}})['catch'](function(_0x336f61){logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x336f61);_0x2891f7(_0x336f61);});});} \ No newline at end of file +var _0x5453=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x59ea42,_0x4ddc78){var _0x1a24da=function(_0x3e90d1){while(--_0x3e90d1){_0x59ea42['push'](_0x59ea42['shift']());}};_0x1a24da(++_0x4ddc78);}(_0x5453,0x18b));var _0x3545=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5453[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x3545('0x0'));var util=require(_0x3545('0x1'));var moment=require(_0x3545('0x2'));var BPromise=require(_0x3545('0x3'));var rs=require(_0x3545('0x4'));var fs=require('fs');var Redis=require(_0x3545('0x5'));var db=require(_0x3545('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3545('0x7'));var config=require(_0x3545('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3545('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x290aa5,_0x496d6b,_0x5d5808){return new BPromise(function(_0x2974ae,_0x3cf0cc){return client[_0x3545('0xa')](_0x290aa5,_0x5d5808)['then'](function(_0x21dc51){logger[_0x3545('0xb')](_0x3545('0xc'),_0x496d6b,_0x3545('0xd'));logger[_0x3545('0xe')](_0x3545('0xf'),_0x496d6b,_0x3545('0xd'),JSON['stringify'](_0x21dc51));if(_0x21dc51['error']){if(_0x21dc51[_0x3545('0x10')][_0x3545('0x11')]===0x1f4){logger[_0x3545('0x10')](_0x3545('0xc'),_0x496d6b,_0x21dc51['error']['message']);return _0x3cf0cc(_0x21dc51['error'][_0x3545('0x12')]);}logger[_0x3545('0x10')]('Automation,\x20%s,\x20%s',_0x496d6b,_0x21dc51[_0x3545('0x10')]['message']);return _0x2974ae(_0x21dc51['error'][_0x3545('0x12')]);}else{logger[_0x3545('0xb')]('Automation,\x20%s,\x20%s',_0x496d6b,_0x3545('0xd'));_0x2974ae(_0x21dc51[_0x3545('0x13')]['message']);}})[_0x3545('0x14')](function(_0x51f69b){logger[_0x3545('0x10')](_0x3545('0xc'),_0x496d6b,_0x51f69b);_0x3cf0cc(_0x51f69b);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index ccc2785..89ee0b3 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 _0xc8f3=['put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','post'];(function(_0x17df16,_0x84c577){var _0x1ba549=function(_0x4a368c){while(--_0x4a368c){_0x17df16['push'](_0x17df16['shift']());}};_0x1ba549(++_0x84c577);}(_0xc8f3,0x1d3));var _0x3c8f=function(_0x96e434,_0x39d14a){_0x96e434=_0x96e434-0x0;var _0x17e687=_0xc8f3[_0x96e434];return _0x17e687;};'use strict';var multer=require(_0x3c8f('0x0'));var util=require(_0x3c8f('0x1'));var path=require(_0x3c8f('0x2'));var timeout=require(_0x3c8f('0x3'));var express=require(_0x3c8f('0x4'));var router=express[_0x3c8f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3c8f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3c8f('0x7'));router[_0x3c8f('0x8')]('/',auth[_0x3c8f('0x9')](),controller[_0x3c8f('0xa')]);router[_0x3c8f('0x8')]('/:id',auth[_0x3c8f('0x9')](),controller[_0x3c8f('0xb')]);router[_0x3c8f('0x8')](_0x3c8f('0xc'),auth[_0x3c8f('0x9')](),controller[_0x3c8f('0xd')]);router[_0x3c8f('0x8')](_0x3c8f('0xe'),auth[_0x3c8f('0x9')](),controller['getActions']);router[_0x3c8f('0xf')]('/',auth[_0x3c8f('0x9')](),controller['create']);router[_0x3c8f('0xf')](_0x3c8f('0xc'),auth[_0x3c8f('0x9')](),controller['addConditions']);router[_0x3c8f('0xf')]('/:id/actions',auth[_0x3c8f('0x9')](),controller['addActions']);router[_0x3c8f('0x10')]('/:id',auth[_0x3c8f('0x9')](),controller[_0x3c8f('0x11')]);router['delete'](_0x3c8f('0x12'),auth['isAuthenticated'](),controller[_0x3c8f('0x13')]);module[_0x3c8f('0x14')]=router; \ No newline at end of file +var _0x292e=['getConditions','/:id/actions','post','/:id/conditions','addConditions','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x99a8a7,_0x42b27c){var _0x21d8e0=function(_0x73188c){while(--_0x73188c){_0x99a8a7['push'](_0x99a8a7['shift']());}};_0x21d8e0(++_0x42b27c);}(_0x292e,0xcb));var _0xe292=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x292e[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xe292('0x0'));var util=require(_0xe292('0x1'));var path=require(_0xe292('0x2'));var timeout=require(_0xe292('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe292('0x4'));var auth=require(_0xe292('0x5'));var interaction=require(_0xe292('0x6'));var config=require(_0xe292('0x7'));var controller=require('./automation.controller');router[_0xe292('0x8')]('/',auth['isAuthenticated'](),controller[_0xe292('0x9')]);router[_0xe292('0x8')](_0xe292('0xa'),auth[_0xe292('0xb')](),controller[_0xe292('0xc')]);router[_0xe292('0x8')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xe292('0xd')]);router[_0xe292('0x8')](_0xe292('0xe'),auth[_0xe292('0xb')](),controller['getActions']);router[_0xe292('0xf')]('/',auth[_0xe292('0xb')](),controller['create']);router[_0xe292('0xf')](_0xe292('0x10'),auth[_0xe292('0xb')](),controller[_0xe292('0x11')]);router[_0xe292('0xf')](_0xe292('0xe'),auth['isAuthenticated'](),controller[_0xe292('0x12')]);router[_0xe292('0x13')](_0xe292('0xa'),auth[_0xe292('0xb')](),controller[_0xe292('0x14')]);router[_0xe292('0x15')](_0xe292('0xa'),auth['isAuthenticated'](),controller[_0xe292('0x16')]);module[_0xe292('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 0ecde94..bb23b89 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 _0xd795=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#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)','exports','STRING','name','ivr','BOOLEAN','Max\x20200\x20calls.','INTEGER','UNSIGNED','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting'];(function(_0x43b900,_0x43a23a){var _0x3dffe6=function(_0x3e15dd){while(--_0x3e15dd){_0x43b900['push'](_0x43b900['shift']());}};_0x3dffe6(++_0x43a23a);}(_0xd795,0x155));var _0x5d79=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd795[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');module[_0x5d79('0x0')]={'name':{'type':Sequelize[_0x5d79('0x1')],'unique':_0x5d79('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x5d79('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5d79('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5d79('0x5')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5d79('0x6')](0x3)[_0x5d79('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x5d79('0x6')](0x3)[_0x5d79('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5d79('0x6')](0x5)[_0x5d79('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d79('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x5d79('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d79('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5d79('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5d79('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d79('0xa')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5d79('0x6')](0x3)[_0x5d79('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5d79('0xb')},'dialTimezone':{'type':Sequelize[_0x5d79('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5d79('0x1')],'defaultValue':_0x5d79('0xc')},'dialCheckDuplicateType':{'type':Sequelize[_0x5d79('0xd')](_0x5d79('0xe'),_0x5d79('0xf'),_0x5d79('0x10')),'defaultValue':_0x5d79('0xe')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5d79('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x5d79('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x5d79('0x6')](0x9)[_0x5d79('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5d79('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5d79('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5d79('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5d79('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0x5d79('0x6')](0x9)[_0x5d79('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5d79('0x6')](0x9)[_0x5d79('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5d79('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x5d79('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5d79('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5d79('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5d79('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5d79('0x6')](0x9)[_0x5d79('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5d79('0x17')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x5d79('0x18'),_0x5d79('0x19')),'defaultValue':_0x5d79('0x18')},'dialPrefix':{'type':Sequelize[_0x5d79('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5d79('0x6')](0x3)[_0x5d79('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5d79('0x1a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5d79('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5d79('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5d79('0x6')](0x3)[_0x5d79('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5d79('0x6')](0x5)[_0x5d79('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5d79('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d79('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x5d79('0x6')](0x5)[_0x5d79('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d79('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5d79('0x6')](0x3)[_0x5d79('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d79('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5d79('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d79('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x5d79('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d79('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5d79('0x6')](0x5)[_0x5d79('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d79('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5d79('0x6')](0x3)[_0x5d79('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d79('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5d79('0x6')](0x5)[_0x5d79('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d79('0x23')}}; \ No newline at end of file +var _0xf404=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','STRING','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0x4b868c,_0x27456b){var _0x280c11=function(_0x3ea4ab){while(--_0x3ea4ab){_0x4b868c['push'](_0x4b868c['shift']());}};_0x280c11(++_0x27456b);}(_0xf404,0xe4));var _0x4f40=function(_0x56a679,_0xbdf67c){_0x56a679=_0x56a679-0x0;var _0x13b777=_0xf404[_0x56a679];return _0x13b777;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4f40('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x4f40('0x1')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4f40('0x2')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x4f40('0x3')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4f40('0x4')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4f40('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f40('0x6')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4f40('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4f40('0x5')](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0x7')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f40('0x8')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4f40('0x5')](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'comment':_0x4f40('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4f40('0x5')](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0xb')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4f40('0xc')},'dialTimezone':{'type':Sequelize[_0x4f40('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4f40('0x0')],'defaultValue':_0x4f40('0xd')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4f40('0xe'),_0x4f40('0xf'),_0x4f40('0x10')),'defaultValue':_0x4f40('0xe')},'dialAMDActive':{'type':Sequelize[_0x4f40('0x2')],'defaultValue':0x0,'comment':_0x4f40('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x4f40('0x5')](0x9)[_0x4f40('0x3')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4f40('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x4f40('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4f40('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4f40('0x5')](0x9)[_0x4f40('0x3')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4f40('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x4f40('0x3')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4f40('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4f40('0x3')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4f40('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4f40('0x5')](0x9)[_0x4f40('0x3')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4f40('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4f40('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4f40('0x3')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4f40('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4f40('0x3')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x4f40('0x1a')](_0x4f40('0x1b'),_0x4f40('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4f40('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x4f40('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4f40('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f40('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x4f40('0x5')](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f40('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f40('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4f40('0x5')](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f40('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4f40('0x5')](0x3)[_0x4f40('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4f40('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 7969a39..c54ddba 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 _0x7ca5=['show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','body','updatedAt','role','userProfileId','autoAssociation','update','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','hasOwnProperty','nolimit','getHopperFinals','CmHopperFinal','pick','getHopperBlacks','CmHopperBlack','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','scheduledAt','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','toString','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x49b72e,_0x4db0de){var _0x30a4d8=function(_0x559a52){while(--_0x559a52){_0x49b72e['push'](_0x49b72e['shift']());}};_0x30a4d8(++_0x4db0de);}(_0x7ca5,0x159));var _0x57ca=function(_0x3feafa,_0x51be7c){_0x3feafa=_0x3feafa-0x0;var _0x4651ea=_0x7ca5[_0x3feafa];return _0x4651ea;};'use strict';var emlformat=require(_0x57ca('0x0'));var rimraf=require(_0x57ca('0x1'));var zipdir=require(_0x57ca('0x2'));var jsonpatch=require(_0x57ca('0x3'));var rp=require(_0x57ca('0x4'));var moment=require(_0x57ca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x57ca('0x6'));var util=require(_0x57ca('0x7'));var path=require('path');var sox=require(_0x57ca('0x8'));var csv=require(_0x57ca('0x9'));var ejs=require(_0x57ca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57ca('0xb'));var squel=require(_0x57ca('0xc'));var crypto=require(_0x57ca('0xd'));var jsforce=require(_0x57ca('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x57ca('0x9'));var querystring=require('querystring');var Papa=require(_0x57ca('0xf'));var Redis=require('ioredis');var authService=require(_0x57ca('0x10'));var qs=require(_0x57ca('0x11'));var as=require(_0x57ca('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x57ca('0x13'));var config=require(_0x57ca('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x57ca('0x15'))['db'];function respondWithStatusCode(_0x22c38c,_0x33190f){_0x33190f=_0x33190f||0xcc;return function(_0x89957d){if(_0x89957d){return _0x22c38c[_0x57ca('0x16')](_0x33190f);}return _0x22c38c[_0x57ca('0x17')](_0x33190f)[_0x57ca('0x18')]();};}function respondWithResult(_0x2752b2,_0x55a254){_0x55a254=_0x55a254||0xc8;return function(_0x3a90fe){if(_0x3a90fe){return _0x2752b2[_0x57ca('0x17')](_0x55a254)[_0x57ca('0x19')](_0x3a90fe);}};}function respondWithFilteredResult(_0x26e4cb,_0x44a4eb){return function(_0x426626){if(_0x426626){var _0x4ef7fc=typeof _0x44a4eb[_0x57ca('0x1a')]==='undefined'&&typeof _0x44a4eb[_0x57ca('0x1b')]===_0x57ca('0x1c');var _0x92f73=_0x426626['count'];var _0x3b1fc1=_0x4ef7fc?0x0:_0x44a4eb[_0x57ca('0x1a')];var _0x5dd737=_0x4ef7fc?_0x426626[_0x57ca('0x1d')]:_0x44a4eb[_0x57ca('0x1a')]+_0x44a4eb[_0x57ca('0x1b')];var _0x3e986d;if(_0x5dd737>=_0x92f73){_0x5dd737=_0x92f73;_0x3e986d=0xc8;}else{_0x3e986d=0xce;}_0x26e4cb[_0x57ca('0x17')](_0x3e986d);return _0x26e4cb[_0x57ca('0x1e')](_0x57ca('0x1f'),_0x3b1fc1+'-'+_0x5dd737+'/'+_0x92f73)[_0x57ca('0x19')](_0x426626);}return null;};}function patchUpdates(_0x42ab44){return function(_0x112585){try{jsonpatch[_0x57ca('0x20')](_0x112585,_0x42ab44,!![]);}catch(_0xe6e72){return BPromise['reject'](_0xe6e72);}return _0x112585[_0x57ca('0x21')]();};}function saveUpdates(_0x506c31,_0xfdf9f9){return function(_0xe8dce3){if(_0xe8dce3){return _0xe8dce3['update'](_0x506c31)[_0x57ca('0x22')](function(_0x5318e6){return _0x5318e6;});}return null;};}function removeEntity(_0x4c335a,_0x1c352b){return function(_0x1cf4f0){if(_0x1cf4f0){return _0x1cf4f0[_0x57ca('0x23')]()[_0x57ca('0x22')](function(){var _0x1b30a2=_0x1cf4f0[_0x57ca('0x24')]({'plain':!![]});var _0x2cc970=_0x57ca('0x25');return db[_0x57ca('0x26')][_0x57ca('0x23')]({'where':{'type':_0x2cc970,'resourceId':_0x1b30a2['id']}})[_0x57ca('0x22')](function(){return _0x1cf4f0;});})[_0x57ca('0x22')](function(){_0x4c335a[_0x57ca('0x17')](0xcc)[_0x57ca('0x18')]();});}};}function handleEntityNotFound(_0x167cb7,_0x4815b8){return function(_0x11fc0a){if(!_0x11fc0a){_0x167cb7[_0x57ca('0x16')](0x194);}return _0x11fc0a;};}function handleError(_0x3d8d3d,_0x12d314){_0x12d314=_0x12d314||0x1f4;return function(_0xdbe4d6){logger['error'](_0xdbe4d6[_0x57ca('0x27')]);if(_0xdbe4d6[_0x57ca('0x28')]){delete _0xdbe4d6['name'];}_0x3d8d3d[_0x57ca('0x17')](_0x12d314)[_0x57ca('0x29')](_0xdbe4d6);};}exports[_0x57ca('0x2a')]=function(_0x15ac3d,_0x46c27e){var _0x933a28={},_0x4b1ee7={},_0x49442e={'count':0x0,'rows':[]};var _0x4f93b7=_[_0x57ca('0x2b')](db[_0x57ca('0x2c')][_0x57ca('0x2d')],function(_0x7869d0){return{'name':_0x7869d0[_0x57ca('0x2e')],'type':_0x7869d0[_0x57ca('0x2f')][_0x57ca('0x30')]};});_0x4b1ee7['model']=_['map'](_0x4f93b7,'name');_0x4b1ee7['query']=_[_0x57ca('0x31')](_0x15ac3d[_0x57ca('0x32')]);_0x4b1ee7[_0x57ca('0x33')]=_[_0x57ca('0x34')](_0x4b1ee7[_0x57ca('0x35')],_0x4b1ee7[_0x57ca('0x32')]);_0x933a28[_0x57ca('0x36')]=_[_0x57ca('0x34')](_0x4b1ee7['model'],qs[_0x57ca('0x37')](_0x15ac3d[_0x57ca('0x32')][_0x57ca('0x37')]));_0x933a28[_0x57ca('0x36')]=_0x933a28[_0x57ca('0x36')][_0x57ca('0x38')]?_0x933a28[_0x57ca('0x36')]:_0x4b1ee7[_0x57ca('0x35')];if(!_0x15ac3d['query']['hasOwnProperty']('nolimit')){_0x933a28['limit']=qs[_0x57ca('0x1b')](_0x15ac3d[_0x57ca('0x32')][_0x57ca('0x1b')]);_0x933a28[_0x57ca('0x1a')]=qs[_0x57ca('0x1a')](_0x15ac3d[_0x57ca('0x32')][_0x57ca('0x1a')]);}_0x933a28[_0x57ca('0x39')]=qs[_0x57ca('0x3a')](_0x15ac3d[_0x57ca('0x32')]['sort']);_0x933a28[_0x57ca('0x3b')]=qs[_0x57ca('0x33')](_['pick'](_0x15ac3d[_0x57ca('0x32')],_0x4b1ee7[_0x57ca('0x33')]),_0x4f93b7);if(_0x15ac3d[_0x57ca('0x32')][_0x57ca('0x3c')]){_0x933a28[_0x57ca('0x3b')]=_[_0x57ca('0x3d')](_0x933a28[_0x57ca('0x3b')],{'$or':_[_0x57ca('0x2b')](_0x4f93b7,function(_0x332929){if(_0x332929[_0x57ca('0x2f')]!==_0x57ca('0x3e')){var _0x4c9029={};_0x4c9029[_0x332929[_0x57ca('0x28')]]={'$like':'%'+_0x15ac3d[_0x57ca('0x32')][_0x57ca('0x3c')]+'%'};return _0x4c9029;}})});}_0x933a28=_[_0x57ca('0x3d')]({},_0x933a28,_0x15ac3d[_0x57ca('0x3f')]);var _0x89f98b={'where':_0x933a28[_0x57ca('0x3b')]};return db[_0x57ca('0x2c')]['count'](_0x89f98b)[_0x57ca('0x22')](function(_0x34155c){_0x49442e[_0x57ca('0x1d')]=_0x34155c;if(_0x15ac3d[_0x57ca('0x32')][_0x57ca('0x40')]){_0x933a28[_0x57ca('0x41')]=[{'all':!![]}];}return db[_0x57ca('0x2c')][_0x57ca('0x42')](_0x933a28);})[_0x57ca('0x22')](function(_0x14097b){_0x49442e[_0x57ca('0x43')]=_0x14097b;return _0x49442e;})['then'](respondWithFilteredResult(_0x46c27e,_0x933a28))[_0x57ca('0x44')](handleError(_0x46c27e,null));};exports[_0x57ca('0x45')]=function(_0x9b0d8b,_0x233dae){var _0x47a09a={'raw':![],'where':{'id':_0x9b0d8b['params']['id']}},_0x310a8e={};_0x310a8e['model']=_[_0x57ca('0x31')](db[_0x57ca('0x2c')][_0x57ca('0x2d')]);_0x310a8e[_0x57ca('0x32')]=_[_0x57ca('0x31')](_0x9b0d8b[_0x57ca('0x32')]);_0x310a8e[_0x57ca('0x33')]=_[_0x57ca('0x34')](_0x310a8e[_0x57ca('0x35')],_0x310a8e[_0x57ca('0x32')]);_0x47a09a[_0x57ca('0x36')]=_['intersection'](_0x310a8e['model'],qs['fields'](_0x9b0d8b[_0x57ca('0x32')][_0x57ca('0x37')]));_0x47a09a[_0x57ca('0x36')]=_0x47a09a[_0x57ca('0x36')][_0x57ca('0x38')]?_0x47a09a[_0x57ca('0x36')]:_0x310a8e[_0x57ca('0x35')];if(_0x9b0d8b[_0x57ca('0x32')][_0x57ca('0x40')]){_0x47a09a[_0x57ca('0x41')]=[{'all':!![]}];}_0x47a09a=_['merge']({},_0x47a09a,_0x9b0d8b[_0x57ca('0x3f')]);return db[_0x57ca('0x2c')][_0x57ca('0x46')](_0x47a09a)[_0x57ca('0x22')](handleEntityNotFound(_0x233dae,null))[_0x57ca('0x22')](respondWithResult(_0x233dae,null))['catch'](handleError(_0x233dae,null));};exports[_0x57ca('0x47')]=function(_0x5e155b,_0xb2b52c){return db[_0x57ca('0x2c')][_0x57ca('0x47')](_0x5e155b['body'],{})[_0x57ca('0x22')](function(_0x4f3315){var _0x1ae705=_0x5e155b[_0x57ca('0x48')][_0x57ca('0x24')]({'plain':!![]});if(!_0x1ae705)throw new Error(_0x57ca('0x49'));if(_0x1ae705['role']===_0x57ca('0x48')){var _0x26a68c=_0x4f3315[_0x57ca('0x24')]({'plain':!![]});var _0x5b636f='IvrCampaigns';return db[_0x57ca('0x4a')][_0x57ca('0x46')]({'where':{'name':_0x5b636f,'userProfileId':_0x1ae705['userProfileId']},'raw':!![]})[_0x57ca('0x22')](function(_0x46ca98){if(_0x46ca98&&_0x46ca98['autoAssociation']===0x0){return db[_0x57ca('0x26')][_0x57ca('0x47')]({'name':_0x26a68c[_0x57ca('0x28')],'resourceId':_0x26a68c['id'],'type':_0x46ca98[_0x57ca('0x28')],'sectionId':_0x46ca98['id']},{})[_0x57ca('0x22')](function(){return _0x4f3315;});}else{return _0x4f3315;}})['catch'](function(_0x9c6bce){logger[_0x57ca('0x4b')](_0x57ca('0x4c'),_0x9c6bce);throw _0x9c6bce;});}return _0x4f3315;})[_0x57ca('0x22')](respondWithResult(_0xb2b52c,0xc9))[_0x57ca('0x44')](handleError(_0xb2b52c,null));};exports[_0x57ca('0x4d')]=function(_0x32ea3f,_0x8fc44e){var _0x508e8c={'where':{'id':_0x32ea3f[_0x57ca('0x4e')]['id']}},_0x2227e8={};_0x2227e8['model']=_[_0x57ca('0x31')](db[_0x57ca('0x2c')][_0x57ca('0x2d')]);_0x508e8c[_0x57ca('0x36')]=_[_0x57ca('0x34')](_0x2227e8[_0x57ca('0x35')],qs[_0x57ca('0x37')](_0x32ea3f[_0x57ca('0x32')][_0x57ca('0x37')]));_0x508e8c['attributes']=_0x508e8c['attributes']['length']?_0x508e8c[_0x57ca('0x36')]:_0x2227e8[_0x57ca('0x35')];if(_0x32ea3f[_0x57ca('0x32')][_0x57ca('0x40')]){_0x508e8c[_0x57ca('0x41')]=[{'all':!![]}];}_0x508e8c=_[_0x57ca('0x3d')]({},_0x508e8c,_0x32ea3f[_0x57ca('0x3f')]);return db[_0x57ca('0x2c')][_0x57ca('0x46')](_0x508e8c)[_0x57ca('0x22')](handleEntityNotFound(_0x8fc44e,null))['then'](function(_0x11eb6f){if(_0x11eb6f){var _0x5bc4dd=_0x11eb6f[_0x57ca('0x24')]({'plain':!![]});_0x5bc4dd=qs[_0x57ca('0x4f')](_0x5bc4dd,['id',_0x57ca('0x50'),'updatedAt']);_0x32ea3f[_0x57ca('0x51')]=_['omit'](_0x32ea3f[_0x57ca('0x51')],['id','createdAt',_0x57ca('0x52')]);return db[_0x57ca('0x2c')][_0x57ca('0x47')](_['merge'](_0x5bc4dd,_0x32ea3f[_0x57ca('0x51')]),{'include':_0x32ea3f[_0x57ca('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0x57ca('0x22')](function(_0xc1742){var _0x47baca=_0x32ea3f[_0x57ca('0x48')]['get']({'plain':!![]});if(!_0x47baca)throw new Error(_0x57ca('0x49'));if(_0x47baca[_0x57ca('0x53')]==='user'){var _0x1c1319=_0xc1742[_0x57ca('0x24')]({'plain':!![]});var _0x2d641f='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x2d641f,'userProfileId':_0x47baca[_0x57ca('0x54')]},'raw':!![]})[_0x57ca('0x22')](function(_0x13efa8){if(_0x13efa8&&_0x13efa8[_0x57ca('0x55')]===0x0){return db[_0x57ca('0x26')][_0x57ca('0x47')]({'name':_0x1c1319[_0x57ca('0x28')],'resourceId':_0x1c1319['id'],'type':_0x13efa8[_0x57ca('0x28')],'sectionId':_0x13efa8['id']},{})[_0x57ca('0x22')](function(){return _0xc1742;});}else{return _0xc1742;}})[_0x57ca('0x44')](function(_0x5d6520){logger[_0x57ca('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d6520);throw _0x5d6520;});}return _0xc1742;});}})['then'](respondWithResult(_0x8fc44e,0xc9))[_0x57ca('0x44')](handleError(_0x8fc44e,null));};exports[_0x57ca('0x56')]=function(_0x9abf70,_0xc3f365){if(_0x9abf70[_0x57ca('0x51')]['id']){delete _0x9abf70[_0x57ca('0x51')]['id'];}return db[_0x57ca('0x2c')][_0x57ca('0x46')]({'where':{'id':_0x9abf70['params']['id']}})[_0x57ca('0x22')](handleEntityNotFound(_0xc3f365,null))['then'](saveUpdates(_0x9abf70[_0x57ca('0x51')],null))[_0x57ca('0x22')](respondWithResult(_0xc3f365,null))[_0x57ca('0x44')](handleError(_0xc3f365,null));};exports[_0x57ca('0x23')]=function(_0x265657,_0x8760fb){return db[_0x57ca('0x2c')][_0x57ca('0x46')]({'where':{'id':_0x265657['params']['id']}})[_0x57ca('0x22')](handleEntityNotFound(_0x8760fb,null))[_0x57ca('0x22')](removeEntity(_0x8760fb,null))[_0x57ca('0x44')](handleError(_0x8760fb,null));};exports[_0x57ca('0x57')]=function(_0x2808ae,_0x35c81f,_0x32f054){var _0xa22a8a={'raw':!![],'where':{}};var _0x334d47={};var _0x22e6dc={'count':0x0,'rows':[]};return db[_0x57ca('0x2c')][_0x57ca('0x58')]({'where':{'id':_0x2808ae[_0x57ca('0x4e')]['id']}})['then'](handleEntityNotFound(_0x35c81f,null))[_0x57ca('0x22')](function(_0xc9f81c){if(_0xc9f81c){_0x334d47[_0x57ca('0x35')]=_[_0x57ca('0x31')](db['CmHopper']['rawAttributes']);_0x334d47[_0x57ca('0x32')]=_[_0x57ca('0x31')](_0x2808ae[_0x57ca('0x32')]);_0x334d47['filters']=_[_0x57ca('0x34')](_0x334d47['model'],_0x334d47[_0x57ca('0x32')]);_0xa22a8a['attributes']=_[_0x57ca('0x34')](_0x334d47['model'],qs[_0x57ca('0x37')](_0x2808ae['query'][_0x57ca('0x37')]));_0xa22a8a[_0x57ca('0x36')]=_0xa22a8a[_0x57ca('0x36')][_0x57ca('0x38')]?_0xa22a8a[_0x57ca('0x36')]:_0x334d47[_0x57ca('0x35')];if(!_0x2808ae[_0x57ca('0x32')]['hasOwnProperty']('nolimit')){_0xa22a8a[_0x57ca('0x1b')]=qs[_0x57ca('0x1b')](_0x2808ae[_0x57ca('0x32')][_0x57ca('0x1b')]);_0xa22a8a[_0x57ca('0x1a')]=qs[_0x57ca('0x1a')](_0x2808ae[_0x57ca('0x32')][_0x57ca('0x1a')]);}_0xa22a8a[_0x57ca('0x39')]=qs[_0x57ca('0x3a')](_0x2808ae['query'][_0x57ca('0x3a')]);_0xa22a8a['where']=qs[_0x57ca('0x33')](_['pick'](_0x2808ae[_0x57ca('0x32')],_0x334d47[_0x57ca('0x33')]));_0xa22a8a[_0x57ca('0x3b')][_0x57ca('0x59')]=_0xc9f81c['id'];if(_0x2808ae[_0x57ca('0x32')][_0x57ca('0x3c')]){_0xa22a8a[_0x57ca('0x3b')]=_[_0x57ca('0x3d')](_0xa22a8a[_0x57ca('0x3b')],{'$or':_[_0x57ca('0x2b')](_0xa22a8a[_0x57ca('0x36')],function(_0xd1a92a){var _0x4f23ba={};_0x4f23ba[_0xd1a92a]={'$like':'%'+_0x2808ae['query'][_0x57ca('0x3c')]+'%'};return _0x4f23ba;})});}_0xa22a8a=_[_0x57ca('0x3d')]({},_0xa22a8a,_0x2808ae[_0x57ca('0x3f')]);return db[_0x57ca('0x5a')][_0x57ca('0x1d')]({'where':_0xa22a8a[_0x57ca('0x3b')]})[_0x57ca('0x22')](function(_0x15c20a){_0x22e6dc[_0x57ca('0x1d')]=_0x15c20a;if(_0x2808ae[_0x57ca('0x32')][_0x57ca('0x40')]){_0xa22a8a[_0x57ca('0x41')]=[{'all':!![]}];}return db[_0x57ca('0x5a')][_0x57ca('0x42')](_0xa22a8a);})[_0x57ca('0x22')](function(_0x3b43a6){_0x22e6dc[_0x57ca('0x43')]=_0x3b43a6;return _0x22e6dc;});}})['then'](respondWithFilteredResult(_0x35c81f,_0xa22a8a))['catch'](handleError(_0x35c81f,null));};exports[_0x57ca('0x5b')]=function(_0x372dbf,_0x359c6b,_0x319954){var _0x2f2588={'raw':!![],'where':{}};var _0x59effc={};var _0x1d901f={'count':0x0,'rows':[]};return db['Campaign'][_0x57ca('0x58')]({'where':{'id':_0x372dbf['params']['id']}})[_0x57ca('0x22')](handleEntityNotFound(_0x359c6b,null))['then'](function(_0x3c6a8d){if(_0x3c6a8d){_0x59effc[_0x57ca('0x35')]=_[_0x57ca('0x31')](db[_0x57ca('0x5c')]['rawAttributes']);_0x59effc[_0x57ca('0x32')]=_['keys'](_0x372dbf['query']);_0x59effc[_0x57ca('0x33')]=_['intersection'](_0x59effc[_0x57ca('0x35')],_0x59effc[_0x57ca('0x32')]);_0x2f2588[_0x57ca('0x36')]=_[_0x57ca('0x34')](_0x59effc[_0x57ca('0x35')],qs[_0x57ca('0x37')](_0x372dbf[_0x57ca('0x32')][_0x57ca('0x37')]));_0x2f2588[_0x57ca('0x36')]=_0x2f2588[_0x57ca('0x36')][_0x57ca('0x38')]?_0x2f2588['attributes']:_0x59effc[_0x57ca('0x35')];if(!_0x372dbf[_0x57ca('0x32')][_0x57ca('0x5d')](_0x57ca('0x5e'))){_0x2f2588[_0x57ca('0x1b')]=qs[_0x57ca('0x1b')](_0x372dbf[_0x57ca('0x32')][_0x57ca('0x1b')]);_0x2f2588[_0x57ca('0x1a')]=qs['offset'](_0x372dbf['query']['offset']);}_0x2f2588['order']=qs[_0x57ca('0x3a')](_0x372dbf[_0x57ca('0x32')][_0x57ca('0x3a')]);_0x2f2588[_0x57ca('0x3b')]=qs[_0x57ca('0x33')](_['pick'](_0x372dbf[_0x57ca('0x32')],_0x59effc['filters']));_0x2f2588[_0x57ca('0x3b')][_0x57ca('0x59')]=_0x3c6a8d['id'];if(_0x372dbf[_0x57ca('0x32')][_0x57ca('0x3c')]){_0x2f2588[_0x57ca('0x3b')]=_[_0x57ca('0x3d')](_0x2f2588[_0x57ca('0x3b')],{'$or':_[_0x57ca('0x2b')](_0x2f2588[_0x57ca('0x36')],function(_0x2b3c03){var _0xac40ac={};_0xac40ac[_0x2b3c03]={'$like':'%'+_0x372dbf[_0x57ca('0x32')][_0x57ca('0x3c')]+'%'};return _0xac40ac;})});}_0x2f2588=_[_0x57ca('0x3d')]({},_0x2f2588,_0x372dbf[_0x57ca('0x3f')]);return db[_0x57ca('0x5c')][_0x57ca('0x1d')]({'where':_0x2f2588['where']})[_0x57ca('0x22')](function(_0x373d73){_0x1d901f[_0x57ca('0x1d')]=_0x373d73;if(_0x372dbf[_0x57ca('0x32')][_0x57ca('0x40')]){_0x2f2588['include']=[{'all':!![]}];}return db[_0x57ca('0x5c')][_0x57ca('0x42')](_0x2f2588);})['then'](function(_0x15ad22){_0x1d901f[_0x57ca('0x43')]=_0x15ad22;return _0x1d901f;});}})[_0x57ca('0x22')](respondWithFilteredResult(_0x359c6b,_0x2f2588))['catch'](handleError(_0x359c6b,null));};exports[_0x57ca('0x5f')]=function(_0x341e0d,_0x27a04f,_0x15e4b1){var _0x2b0117={'raw':!![],'where':{}};var _0x21e030={};var _0x4f33d5={'count':0x0,'rows':[]};return db['Campaign'][_0x57ca('0x58')]({'where':{'id':_0x341e0d[_0x57ca('0x4e')]['id']}})['then'](handleEntityNotFound(_0x27a04f,null))[_0x57ca('0x22')](function(_0x345e01){if(_0x345e01){_0x21e030[_0x57ca('0x35')]=_['keys'](db[_0x57ca('0x60')][_0x57ca('0x2d')]);_0x21e030[_0x57ca('0x32')]=_[_0x57ca('0x31')](_0x341e0d[_0x57ca('0x32')]);_0x21e030[_0x57ca('0x33')]=_[_0x57ca('0x34')](_0x21e030[_0x57ca('0x35')],_0x21e030['query']);_0x2b0117[_0x57ca('0x36')]=_[_0x57ca('0x34')](_0x21e030['model'],qs[_0x57ca('0x37')](_0x341e0d['query'][_0x57ca('0x37')]));_0x2b0117[_0x57ca('0x36')]=_0x2b0117[_0x57ca('0x36')][_0x57ca('0x38')]?_0x2b0117[_0x57ca('0x36')]:_0x21e030['model'];if(!_0x341e0d[_0x57ca('0x32')][_0x57ca('0x5d')](_0x57ca('0x5e'))){_0x2b0117[_0x57ca('0x1b')]=qs[_0x57ca('0x1b')](_0x341e0d['query'][_0x57ca('0x1b')]);_0x2b0117[_0x57ca('0x1a')]=qs[_0x57ca('0x1a')](_0x341e0d[_0x57ca('0x32')][_0x57ca('0x1a')]);}_0x2b0117['order']=qs['sort'](_0x341e0d['query']['sort']);_0x2b0117['where']=qs['filters'](_[_0x57ca('0x61')](_0x341e0d['query'],_0x21e030[_0x57ca('0x33')]));_0x2b0117[_0x57ca('0x3b')][_0x57ca('0x59')]=_0x345e01['id'];if(_0x341e0d[_0x57ca('0x32')][_0x57ca('0x3c')]){_0x2b0117['where']=_[_0x57ca('0x3d')](_0x2b0117[_0x57ca('0x3b')],{'$or':_[_0x57ca('0x2b')](_0x2b0117[_0x57ca('0x36')],function(_0x35fa43){var _0x33535={};_0x33535[_0x35fa43]={'$like':'%'+_0x341e0d[_0x57ca('0x32')][_0x57ca('0x3c')]+'%'};return _0x33535;})});}_0x2b0117=_[_0x57ca('0x3d')]({},_0x2b0117,_0x341e0d[_0x57ca('0x3f')]);return db[_0x57ca('0x60')]['count']({'where':_0x2b0117[_0x57ca('0x3b')]})[_0x57ca('0x22')](function(_0x3d9154){_0x4f33d5[_0x57ca('0x1d')]=_0x3d9154;if(_0x341e0d[_0x57ca('0x32')][_0x57ca('0x40')]){_0x2b0117[_0x57ca('0x41')]=[{'all':!![]}];}return db[_0x57ca('0x60')][_0x57ca('0x42')](_0x2b0117);})[_0x57ca('0x22')](function(_0x27a42b){_0x4f33d5['rows']=_0x27a42b;return _0x4f33d5;});}})[_0x57ca('0x22')](respondWithFilteredResult(_0x27a04f,_0x2b0117))[_0x57ca('0x44')](handleError(_0x27a04f,null));};exports[_0x57ca('0x62')]=function(_0x3c8fb9,_0x402ede,_0x5cd648){var _0x2b7bdf={'raw':!![],'where':{}};var _0x46cfe8={};var _0x27c555={'count':0x0,'rows':[]};return db[_0x57ca('0x2c')][_0x57ca('0x58')]({'where':{'id':_0x3c8fb9[_0x57ca('0x4e')]['id']}})['then'](handleEntityNotFound(_0x402ede,null))[_0x57ca('0x22')](function(_0x964593){if(_0x964593){_0x46cfe8['model']=_[_0x57ca('0x31')](db['CmHopperBlack']['rawAttributes']);_0x46cfe8[_0x57ca('0x32')]=_[_0x57ca('0x31')](_0x3c8fb9[_0x57ca('0x32')]);_0x46cfe8[_0x57ca('0x33')]=_[_0x57ca('0x34')](_0x46cfe8[_0x57ca('0x35')],_0x46cfe8[_0x57ca('0x32')]);_0x2b7bdf[_0x57ca('0x36')]=_[_0x57ca('0x34')](_0x46cfe8[_0x57ca('0x35')],qs[_0x57ca('0x37')](_0x3c8fb9[_0x57ca('0x32')][_0x57ca('0x37')]));_0x2b7bdf[_0x57ca('0x36')]=_0x2b7bdf[_0x57ca('0x36')][_0x57ca('0x38')]?_0x2b7bdf['attributes']:_0x46cfe8[_0x57ca('0x35')];if(!_0x3c8fb9[_0x57ca('0x32')][_0x57ca('0x5d')](_0x57ca('0x5e'))){_0x2b7bdf['limit']=qs[_0x57ca('0x1b')](_0x3c8fb9[_0x57ca('0x32')][_0x57ca('0x1b')]);_0x2b7bdf['offset']=qs[_0x57ca('0x1a')](_0x3c8fb9['query'][_0x57ca('0x1a')]);}_0x2b7bdf[_0x57ca('0x39')]=qs['sort'](_0x3c8fb9[_0x57ca('0x32')][_0x57ca('0x3a')]);_0x2b7bdf[_0x57ca('0x3b')]=qs[_0x57ca('0x33')](_['pick'](_0x3c8fb9[_0x57ca('0x32')],_0x46cfe8[_0x57ca('0x33')]));_0x2b7bdf['where']['CampaignId']=_0x964593['id'];if(_0x3c8fb9[_0x57ca('0x32')][_0x57ca('0x3c')]){_0x2b7bdf[_0x57ca('0x3b')]=_[_0x57ca('0x3d')](_0x2b7bdf['where'],{'$or':_[_0x57ca('0x2b')](_0x2b7bdf[_0x57ca('0x36')],function(_0x3c19b7){var _0xdcd1b7={};_0xdcd1b7[_0x3c19b7]={'$like':'%'+_0x3c8fb9[_0x57ca('0x32')][_0x57ca('0x3c')]+'%'};return _0xdcd1b7;})});}_0x2b7bdf=_[_0x57ca('0x3d')]({},_0x2b7bdf,_0x3c8fb9[_0x57ca('0x3f')]);return db[_0x57ca('0x63')][_0x57ca('0x1d')]({'where':_0x2b7bdf[_0x57ca('0x3b')]})[_0x57ca('0x22')](function(_0x2f7f71){_0x27c555['count']=_0x2f7f71;if(_0x3c8fb9[_0x57ca('0x32')]['includeAll']){_0x2b7bdf[_0x57ca('0x41')]=[{'all':!![]}];}return db[_0x57ca('0x63')][_0x57ca('0x42')](_0x2b7bdf);})[_0x57ca('0x22')](function(_0x47b8e8){_0x27c555[_0x57ca('0x43')]=_0x47b8e8;return _0x27c555;});}})[_0x57ca('0x22')](respondWithFilteredResult(_0x402ede,_0x2b7bdf))[_0x57ca('0x44')](handleError(_0x402ede,null));};exports['getLists']=function(_0x27f484,_0x272464,_0x2408ac){var _0xbfa31f={};var _0x52fc57={};var _0x56ddfe;var _0x166186;return db[_0x57ca('0x2c')]['findOne']({'where':{'id':_0x27f484[_0x57ca('0x4e')]['id']}})[_0x57ca('0x22')](handleEntityNotFound(_0x272464,null))[_0x57ca('0x22')](function(_0x20bda6){if(_0x20bda6){_0x56ddfe=_0x20bda6;_0x52fc57[_0x57ca('0x35')]=_[_0x57ca('0x31')](db[_0x57ca('0x64')][_0x57ca('0x2d')]);_0x52fc57['query']=_[_0x57ca('0x31')](_0x27f484[_0x57ca('0x32')]);_0x52fc57[_0x57ca('0x33')]=_['intersection'](_0x52fc57['model'],_0x52fc57[_0x57ca('0x32')]);_0xbfa31f[_0x57ca('0x36')]=_[_0x57ca('0x34')](_0x52fc57[_0x57ca('0x35')],qs[_0x57ca('0x37')](_0x27f484[_0x57ca('0x32')][_0x57ca('0x37')]));_0xbfa31f['attributes']=_0xbfa31f[_0x57ca('0x36')][_0x57ca('0x38')]?_0xbfa31f[_0x57ca('0x36')]:_0x52fc57[_0x57ca('0x35')];_0xbfa31f['order']=qs[_0x57ca('0x3a')](_0x27f484[_0x57ca('0x32')][_0x57ca('0x3a')]);_0xbfa31f[_0x57ca('0x3b')]=qs['filters'](_['pick'](_0x27f484[_0x57ca('0x32')],_0x52fc57[_0x57ca('0x33')]));if(_0x27f484[_0x57ca('0x32')][_0x57ca('0x3c')]){_0xbfa31f[_0x57ca('0x3b')]=_[_0x57ca('0x3d')](_0xbfa31f[_0x57ca('0x3b')],{'$or':_[_0x57ca('0x2b')](_0xbfa31f['attributes'],function(_0x11cc8f){var _0x3aaa13={};_0x3aaa13[_0x11cc8f]={'$like':'%'+_0x27f484['query'][_0x57ca('0x3c')]+'%'};return _0x3aaa13;})});}_0xbfa31f=_['merge']({},_0xbfa31f,_0x27f484[_0x57ca('0x3f')]);return _0x56ddfe['getLists'](_0xbfa31f);}})[_0x57ca('0x22')](function(_0x82c2c8){if(_0x82c2c8){_0x166186=_0x82c2c8[_0x57ca('0x38')];if(!_0x27f484['query']['hasOwnProperty'](_0x57ca('0x5e'))){_0xbfa31f[_0x57ca('0x1b')]=qs[_0x57ca('0x1b')](_0x27f484['query']['limit']);_0xbfa31f['offset']=qs[_0x57ca('0x1a')](_0x27f484[_0x57ca('0x32')][_0x57ca('0x1a')]);}return _0x56ddfe['getLists'](_0xbfa31f);}})[_0x57ca('0x22')](function(_0x281ee9){if(_0x281ee9){return _0x281ee9?{'count':_0x166186,'rows':_0x281ee9}:null;}})['then'](respondWithResult(_0x272464,null))[_0x57ca('0x44')](handleError(_0x272464,null));};exports[_0x57ca('0x65')]=function(_0x5b5337,_0x4c89ad,_0xdff08b){var _0x7ccabe,_0xc70e0f;return db[_0x57ca('0x2c')][_0x57ca('0x46')]({'where':{'id':_0x5b5337[_0x57ca('0x4e')]['id']}})[_0x57ca('0x22')](handleEntityNotFound(_0x4c89ad,null))['then'](function(_0x1472d7){if(_0x1472d7){_0xc70e0f=_0x1472d7;return _0x1472d7[_0x57ca('0x65')](_0x5b5337[_0x57ca('0x51')][_0x57ca('0x66')],_[_0x57ca('0x4f')](_0x5b5337[_0x57ca('0x51')],[_0x57ca('0x66'),'id'])||{});}return null;})[_0x57ca('0x67')](function(_0x25d48b){var _0x4b6cfa;_0x7ccabe=_0x25d48b||[];var _0xfccb86=[];if(_0x25d48b){for(var _0x53cd4a=0x0;_0x53cd4a<_0x25d48b[_0x57ca('0x38')];_0x53cd4a+=0x1){var _0x148057=_0x25d48b[_0x53cd4a][_0x57ca('0x24')]({'plain':!![]});_0xc70e0f[_0x57ca('0x68')]=_0x5b5337[_0x57ca('0x51')]['dialCheckDuplicateType']?_0x5b5337[_0x57ca('0x51')]['dialCheckDuplicateType']:_0xc70e0f[_0x57ca('0x68')];switch(_0xc70e0f[_0x57ca('0x68')]){case _0x57ca('0x69'):_0x4b6cfa=squel[_0x57ca('0x6a')]()[_0x57ca('0x6b')](_0x57ca('0x6c'))[_0x57ca('0x6d')]([_0x57ca('0x6e'),'scheduledAt',_0x57ca('0x6f'),_0x57ca('0x70'),_0x57ca('0x59'),'createdAt',_0x57ca('0x52')],squel['select']()['field'](_0x57ca('0x6e'),'phone')[_0x57ca('0x71')](_0x57ca('0x72'),_0x57ca('0x73'))['field']('id','ContactId')['field'](_0x148057['CmListId']['toString'](),_0x57ca('0x70'))[_0x57ca('0x71')](_0x5b5337['params']['id']['toString'](),_0x57ca('0x59'))[_0x57ca('0x71')](_0x57ca('0x72'),_0x57ca('0x50'))['field'](_0x57ca('0x72'),_0x57ca('0x52'))[_0x57ca('0x74')]('cm_contacts')[_0x57ca('0x3b')](_0x57ca('0x75'))[_0x57ca('0x3b')](_0x57ca('0x76'),_0x148057[_0x57ca('0x77')][_0x57ca('0x78')]())[_0x57ca('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x57ca('0x3b')](_0x57ca('0x79'),squel[_0x57ca('0x7a')]()[_0x57ca('0x71')](_0x57ca('0x7b'))[_0x57ca('0x74')](_0x57ca('0x7c'))[_0x57ca('0x3b')](_0x57ca('0x7d'),_0x5b5337['params']['id'][_0x57ca('0x78')]()))[_0x57ca('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x57ca('0x7a')]()[_0x57ca('0x71')](_0x57ca('0x7e'))[_0x57ca('0x74')](_0x57ca('0x6c'))[_0x57ca('0x3b')](_0x57ca('0x7d'),_0x5b5337[_0x57ca('0x4e')]['id'][_0x57ca('0x78')]())))[_0x57ca('0x78')]();break;case _0x57ca('0x7f'):_0x4b6cfa=squel[_0x57ca('0x6a')]()['into'](_0x57ca('0x6c'))[_0x57ca('0x6d')]([_0x57ca('0x6e'),_0x57ca('0x73'),'ContactId','ListId',_0x57ca('0x59'),'createdAt',_0x57ca('0x52')],squel[_0x57ca('0x7a')]()[_0x57ca('0x71')]('phone',_0x57ca('0x6e'))[_0x57ca('0x71')]('NOW()',_0x57ca('0x73'))[_0x57ca('0x71')]('id',_0x57ca('0x6f'))[_0x57ca('0x71')](_0x148057[_0x57ca('0x77')][_0x57ca('0x78')](),_0x57ca('0x70'))[_0x57ca('0x71')](_0x5b5337[_0x57ca('0x4e')]['id'][_0x57ca('0x78')](),'CampaignId')[_0x57ca('0x71')]('NOW()','createdAt')['field'](_0x57ca('0x72'),'updatedAt')[_0x57ca('0x74')](_0x57ca('0x80'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x57ca('0x76'),_0x148057['CmListId'][_0x57ca('0x78')]())[_0x57ca('0x3b')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x57ca('0x79'),squel[_0x57ca('0x7a')]()['field'](_0x57ca('0x7e'))[_0x57ca('0x74')]('cm_hopper')[_0x57ca('0x3b')](_0x57ca('0x7d'),_0x5b5337[_0x57ca('0x4e')]['id'][_0x57ca('0x78')]())))[_0x57ca('0x78')]();break;default:_0x4b6cfa=squel[_0x57ca('0x6a')]()[_0x57ca('0x6b')](_0x57ca('0x6c'))['fromQuery']([_0x57ca('0x6e'),_0x57ca('0x73'),_0x57ca('0x6f'),_0x57ca('0x70'),_0x57ca('0x59'),_0x57ca('0x50'),'updatedAt'],squel[_0x57ca('0x7a')]()[_0x57ca('0x71')](_0x57ca('0x6e'),_0x57ca('0x6e'))[_0x57ca('0x71')](_0x57ca('0x72'),_0x57ca('0x73'))[_0x57ca('0x71')]('id',_0x57ca('0x6f'))[_0x57ca('0x71')](_0x148057[_0x57ca('0x77')]['toString'](),_0x57ca('0x70'))[_0x57ca('0x71')](_0x5b5337[_0x57ca('0x4e')]['id'][_0x57ca('0x78')](),_0x57ca('0x59'))[_0x57ca('0x71')](_0x57ca('0x72'),_0x57ca('0x50'))['field'](_0x57ca('0x72'),_0x57ca('0x52'))[_0x57ca('0x74')](_0x57ca('0x80'))[_0x57ca('0x3b')](_0x57ca('0x75'))['where'](_0x57ca('0x76'),_0x148057[_0x57ca('0x77')]['toString']())[_0x57ca('0x3b')](_0x57ca('0x81')))[_0x57ca('0x78')]();}_0xfccb86[_0x57ca('0x82')](db[_0x57ca('0x83')][_0x57ca('0x32')](_0x4b6cfa));}return BPromise[_0x57ca('0x84')](_0xfccb86);}})['then'](function(){return _0x7ccabe;})['then'](respondWithResult(_0x4c89ad,null))['catch'](handleError(_0x4c89ad,null));};exports['removeLists']=function(_0x11feb5,_0xd7e40e,_0x3a7b7a){return db[_0x57ca('0x2c')]['find']({'where':{'id':_0x11feb5['params']['id']}})[_0x57ca('0x22')](handleEntityNotFound(_0xd7e40e,null))['then'](function(_0x4bf5bb){if(_0x4bf5bb){return _0x4bf5bb[_0x57ca('0x85')](_0x11feb5[_0x57ca('0x32')][_0x57ca('0x66')]);}})[_0x57ca('0x22')](function(_0x3ed1e0){if(_0x3ed1e0){return db[_0x57ca('0x5a')][_0x57ca('0x23')]({'where':{'ListId':_0x11feb5[_0x57ca('0x32')][_0x57ca('0x66')],'CampaignId':_0x11feb5['params']['id']}})['then'](function(){return _0x3ed1e0;});}})[_0x57ca('0x22')](respondWithStatusCode(_0xd7e40e,null))[_0x57ca('0x44')](handleError(_0xd7e40e,null));};exports[_0x57ca('0x86')]=function(_0x532a6c,_0x11d987,_0x1ddab7){var _0x3af36f={};var _0x541a1f={};var _0x3adb13;var _0xa640af;return db[_0x57ca('0x2c')]['findOne']({'where':{'id':_0x532a6c[_0x57ca('0x4e')]['id']}})[_0x57ca('0x22')](handleEntityNotFound(_0x11d987,null))[_0x57ca('0x22')](function(_0x4165b6){if(_0x4165b6){_0x3adb13=_0x4165b6;_0x541a1f[_0x57ca('0x35')]=_[_0x57ca('0x31')](db['CmList'][_0x57ca('0x2d')]);_0x541a1f[_0x57ca('0x32')]=_['keys'](_0x532a6c[_0x57ca('0x32')]);_0x541a1f[_0x57ca('0x33')]=_[_0x57ca('0x34')](_0x541a1f[_0x57ca('0x35')],_0x541a1f[_0x57ca('0x32')]);_0x3af36f[_0x57ca('0x36')]=_[_0x57ca('0x34')](_0x541a1f[_0x57ca('0x35')],qs[_0x57ca('0x37')](_0x532a6c[_0x57ca('0x32')][_0x57ca('0x37')]));_0x3af36f[_0x57ca('0x36')]=_0x3af36f[_0x57ca('0x36')][_0x57ca('0x38')]?_0x3af36f['attributes']:_0x541a1f['model'];_0x3af36f[_0x57ca('0x39')]=qs[_0x57ca('0x3a')](_0x532a6c['query'][_0x57ca('0x3a')]);_0x3af36f[_0x57ca('0x3b')]=qs['filters'](_['pick'](_0x532a6c['query'],_0x541a1f[_0x57ca('0x33')]));if(_0x532a6c[_0x57ca('0x32')][_0x57ca('0x3c')]){_0x3af36f[_0x57ca('0x3b')]=_[_0x57ca('0x3d')](_0x3af36f[_0x57ca('0x3b')],{'$or':_[_0x57ca('0x2b')](_0x3af36f['attributes'],function(_0x3538ae){var _0x1f4bd9={};_0x1f4bd9[_0x3538ae]={'$like':'%'+_0x532a6c['query'][_0x57ca('0x3c')]+'%'};return _0x1f4bd9;})});}_0x3af36f=_['merge']({},_0x3af36f,_0x532a6c[_0x57ca('0x3f')]);return _0x3adb13['getBlackLists'](_0x3af36f);}})[_0x57ca('0x22')](function(_0x29c96f){if(_0x29c96f){_0xa640af=_0x29c96f[_0x57ca('0x38')];if(!_0x532a6c['query'][_0x57ca('0x5d')](_0x57ca('0x5e'))){_0x3af36f[_0x57ca('0x1b')]=qs[_0x57ca('0x1b')](_0x532a6c[_0x57ca('0x32')][_0x57ca('0x1b')]);_0x3af36f[_0x57ca('0x1a')]=qs[_0x57ca('0x1a')](_0x532a6c['query']['offset']);}return _0x3adb13[_0x57ca('0x86')](_0x3af36f);}})[_0x57ca('0x22')](function(_0x4edac7){if(_0x4edac7){return _0x4edac7?{'count':_0xa640af,'rows':_0x4edac7}:null;}})['then'](respondWithResult(_0x11d987,null))['catch'](handleError(_0x11d987,null));};exports[_0x57ca('0x87')]=function(_0x5a24c8,_0x45d79d,_0x3201ff){var _0x3e7734,_0x3b3661;return db[_0x57ca('0x2c')][_0x57ca('0x46')]({'where':{'id':_0x5a24c8[_0x57ca('0x4e')]['id']}})[_0x57ca('0x22')](handleEntityNotFound(_0x45d79d,null))[_0x57ca('0x22')](function(_0x16451e){if(_0x16451e){_0x3b3661=_0x16451e;return _0x16451e[_0x57ca('0x87')](_0x5a24c8[_0x57ca('0x51')][_0x57ca('0x66')],_[_0x57ca('0x4f')](_0x5a24c8[_0x57ca('0x51')],[_0x57ca('0x66'),'id'])||{});}return null;})[_0x57ca('0x67')](function(_0x2c9233){var _0x3e62b4;_0x3e7734=_0x2c9233||[];var _0x311e64=[];if(_0x2c9233){for(var _0xa6cd98=0x0;_0xa6cd98<_0x2c9233['length'];_0xa6cd98+=0x1){var _0x11daa1=_0x2c9233[_0xa6cd98]['get']({'plain':!![]});_0x3e62b4=squel[_0x57ca('0x6a')]()[_0x57ca('0x6b')](_0x57ca('0x88'))[_0x57ca('0x6d')](['phone','ContactId',_0x57ca('0x70'),_0x57ca('0x59'),_0x57ca('0x50'),'updatedAt'],squel[_0x57ca('0x7a')]()['field']('phone',_0x57ca('0x6e'))['field']('id',_0x57ca('0x6f'))[_0x57ca('0x71')](_0x11daa1[_0x57ca('0x77')][_0x57ca('0x78')](),_0x57ca('0x70'))[_0x57ca('0x71')](_0x5a24c8[_0x57ca('0x4e')]['id'][_0x57ca('0x78')](),_0x57ca('0x59'))[_0x57ca('0x71')](_0x57ca('0x72'),'createdAt')[_0x57ca('0x71')](_0x57ca('0x72'),_0x57ca('0x52'))[_0x57ca('0x74')](_0x57ca('0x80'))[_0x57ca('0x3b')](_0x57ca('0x75'))['where'](_0x57ca('0x76'),_0x11daa1[_0x57ca('0x77')][_0x57ca('0x78')]())[_0x57ca('0x3b')](_0x57ca('0x81')))['toString']();_0x311e64[_0x57ca('0x82')](db[_0x57ca('0x83')][_0x57ca('0x32')](_0x3e62b4));}return BPromise[_0x57ca('0x84')](_0x311e64);}})[_0x57ca('0x22')](function(){return _0x3e7734;})[_0x57ca('0x22')](respondWithResult(_0x45d79d,null))[_0x57ca('0x44')](handleError(_0x45d79d,null));};exports[_0x57ca('0x89')]=function(_0x5b08b1,_0x3b4672,_0x526ad0){return db[_0x57ca('0x2c')][_0x57ca('0x46')]({'where':{'id':_0x5b08b1['params']['id']}})[_0x57ca('0x22')](handleEntityNotFound(_0x3b4672,null))[_0x57ca('0x22')](function(_0x2b3eae){if(_0x2b3eae){return _0x2b3eae[_0x57ca('0x89')](_0x5b08b1[_0x57ca('0x32')][_0x57ca('0x66')]);}})[_0x57ca('0x22')](function(_0x39d3f3){if(_0x39d3f3){return db[_0x57ca('0x63')][_0x57ca('0x23')]({'where':{'ListId':_0x5b08b1[_0x57ca('0x32')][_0x57ca('0x66')],'CampaignId':_0x5b08b1[_0x57ca('0x4e')]['id']}})[_0x57ca('0x22')](function(){return _0x39d3f3;});}})[_0x57ca('0x22')](respondWithStatusCode(_0x3b4672,null))[_0x57ca('0x44')](handleError(_0x3b4672,null));}; \ No newline at end of file +var _0x6da8=['options','includeAll','include','catch','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','update','findOne','CampaignId','CmHopper','findAll','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','fromQuery','push','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','send','index','Campaign','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x6da8,0x14e));var _0x86da=function(_0xb1e77,_0x4442b7){_0xb1e77=_0xb1e77-0x0;var _0xeaa0d8=_0x6da8[_0xb1e77];return _0xeaa0d8;};'use strict';var emlformat=require(_0x86da('0x0'));var rimraf=require(_0x86da('0x1'));var zipdir=require(_0x86da('0x2'));var jsonpatch=require(_0x86da('0x3'));var rp=require('request-promise');var moment=require(_0x86da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x86da('0x5'));var util=require(_0x86da('0x6'));var path=require(_0x86da('0x7'));var sox=require('sox');var csv=require(_0x86da('0x8'));var ejs=require(_0x86da('0x9'));var fs=require('fs');var fs_extra=require(_0x86da('0xa'));var _=require(_0x86da('0xb'));var squel=require(_0x86da('0xc'));var crypto=require(_0x86da('0xd'));var jsforce=require(_0x86da('0xe'));var deskjs=require(_0x86da('0xf'));var toCsv=require(_0x86da('0x8'));var querystring=require(_0x86da('0x10'));var Papa=require(_0x86da('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x86da('0x12'));var as=require(_0x86da('0x13'));var hardwareService=require(_0x86da('0x14'));var logger=require(_0x86da('0x15'))(_0x86da('0x16'));var utils=require(_0x86da('0x17'));var config=require(_0x86da('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x86da('0x19'))['db'];function respondWithStatusCode(_0x2c6b04,_0x2b4f4f){_0x2b4f4f=_0x2b4f4f||0xcc;return function(_0x440585){if(_0x440585){return _0x2c6b04['sendStatus'](_0x2b4f4f);}return _0x2c6b04[_0x86da('0x1a')](_0x2b4f4f)[_0x86da('0x1b')]();};}function respondWithResult(_0x1f1309,_0x1cbeb0){_0x1cbeb0=_0x1cbeb0||0xc8;return function(_0x11e019){if(_0x11e019){return _0x1f1309[_0x86da('0x1a')](_0x1cbeb0)[_0x86da('0x1c')](_0x11e019);}};}function respondWithFilteredResult(_0x399495,_0x43f3bf){return function(_0x92febf){if(_0x92febf){var _0x2446e0=typeof _0x43f3bf[_0x86da('0x1d')]===_0x86da('0x1e')&&typeof _0x43f3bf[_0x86da('0x1f')]===_0x86da('0x1e');var _0x329226=_0x92febf[_0x86da('0x20')];var _0xf696a4=_0x2446e0?0x0:_0x43f3bf[_0x86da('0x1d')];var _0x3f6fad=_0x2446e0?_0x92febf[_0x86da('0x20')]:_0x43f3bf[_0x86da('0x1d')]+_0x43f3bf[_0x86da('0x1f')];var _0x406f5c;if(_0x3f6fad>=_0x329226){_0x3f6fad=_0x329226;_0x406f5c=0xc8;}else{_0x406f5c=0xce;}_0x399495[_0x86da('0x1a')](_0x406f5c);return _0x399495[_0x86da('0x21')]('Content-Range',_0xf696a4+'-'+_0x3f6fad+'/'+_0x329226)[_0x86da('0x1c')](_0x92febf);}return null;};}function patchUpdates(_0x34657d){return function(_0x14913f){try{jsonpatch['apply'](_0x14913f,_0x34657d,!![]);}catch(_0x5ddc19){return BPromise[_0x86da('0x22')](_0x5ddc19);}return _0x14913f['save']();};}function saveUpdates(_0x3cd3a9,_0x26735a){return function(_0x2eaff4){if(_0x2eaff4){return _0x2eaff4['update'](_0x3cd3a9)[_0x86da('0x23')](function(_0x125e32){return _0x125e32;});}return null;};}function removeEntity(_0x29293f,_0x23b8c3){return function(_0x4dc3f9){if(_0x4dc3f9){return _0x4dc3f9[_0x86da('0x24')]()[_0x86da('0x23')](function(){var _0x39b21b=_0x4dc3f9['get']({'plain':!![]});var _0x469ff9=_0x86da('0x25');return db[_0x86da('0x26')][_0x86da('0x24')]({'where':{'type':_0x469ff9,'resourceId':_0x39b21b['id']}})[_0x86da('0x23')](function(){return _0x4dc3f9;});})[_0x86da('0x23')](function(){_0x29293f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32bf79,_0x2c9d75){return function(_0x1aa7d5){if(!_0x1aa7d5){_0x32bf79['sendStatus'](0x194);}return _0x1aa7d5;};}function handleError(_0x3051fd,_0x1e0a3c){_0x1e0a3c=_0x1e0a3c||0x1f4;return function(_0x327292){logger[_0x86da('0x27')](_0x327292[_0x86da('0x28')]);if(_0x327292['name']){delete _0x327292[_0x86da('0x29')];}_0x3051fd[_0x86da('0x1a')](_0x1e0a3c)[_0x86da('0x2a')](_0x327292);};}exports[_0x86da('0x2b')]=function(_0xdecb62,_0x47a7ae){var _0x49d9c0={},_0x5f4d48={},_0x1070c0={'count':0x0,'rows':[]};var _0x86c270=_['map'](db[_0x86da('0x2c')][_0x86da('0x2d')],function(_0x3eb952){return{'name':_0x3eb952[_0x86da('0x2e')],'type':_0x3eb952[_0x86da('0x2f')]['key']};});_0x5f4d48[_0x86da('0x30')]=_[_0x86da('0x31')](_0x86c270,_0x86da('0x29'));_0x5f4d48[_0x86da('0x32')]=_[_0x86da('0x33')](_0xdecb62[_0x86da('0x32')]);_0x5f4d48[_0x86da('0x34')]=_['intersection'](_0x5f4d48[_0x86da('0x30')],_0x5f4d48[_0x86da('0x32')]);_0x49d9c0[_0x86da('0x35')]=_[_0x86da('0x36')](_0x5f4d48['model'],qs[_0x86da('0x37')](_0xdecb62[_0x86da('0x32')]['fields']));_0x49d9c0[_0x86da('0x35')]=_0x49d9c0[_0x86da('0x35')]['length']?_0x49d9c0[_0x86da('0x35')]:_0x5f4d48[_0x86da('0x30')];if(!_0xdecb62[_0x86da('0x32')][_0x86da('0x38')](_0x86da('0x39'))){_0x49d9c0[_0x86da('0x1f')]=qs[_0x86da('0x1f')](_0xdecb62[_0x86da('0x32')][_0x86da('0x1f')]);_0x49d9c0[_0x86da('0x1d')]=qs[_0x86da('0x1d')](_0xdecb62[_0x86da('0x32')][_0x86da('0x1d')]);}_0x49d9c0[_0x86da('0x3a')]=qs[_0x86da('0x3b')](_0xdecb62['query'][_0x86da('0x3b')]);_0x49d9c0[_0x86da('0x3c')]=qs[_0x86da('0x34')](_[_0x86da('0x3d')](_0xdecb62[_0x86da('0x32')],_0x5f4d48[_0x86da('0x34')]),_0x86c270);if(_0xdecb62['query'][_0x86da('0x3e')]){_0x49d9c0[_0x86da('0x3c')]=_[_0x86da('0x3f')](_0x49d9c0[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0x86c270,function(_0x45c1dc){if(_0x45c1dc['type']!==_0x86da('0x40')){var _0x4b341a={};_0x4b341a[_0x45c1dc['name']]={'$like':'%'+_0xdecb62['query']['filter']+'%'};return _0x4b341a;}})});}_0x49d9c0=_[_0x86da('0x3f')]({},_0x49d9c0,_0xdecb62[_0x86da('0x41')]);var _0x1eec2e={'where':_0x49d9c0['where']};return db[_0x86da('0x2c')][_0x86da('0x20')](_0x1eec2e)[_0x86da('0x23')](function(_0x2a6d11){_0x1070c0['count']=_0x2a6d11;if(_0xdecb62[_0x86da('0x32')][_0x86da('0x42')]){_0x49d9c0[_0x86da('0x43')]=[{'all':!![]}];}return db[_0x86da('0x2c')]['findAll'](_0x49d9c0);})[_0x86da('0x23')](function(_0x2c6db3){_0x1070c0['rows']=_0x2c6db3;return _0x1070c0;})['then'](respondWithFilteredResult(_0x47a7ae,_0x49d9c0))[_0x86da('0x44')](handleError(_0x47a7ae,null));};exports['show']=function(_0x4ace25,_0x31cdc0){var _0x5ec9f3={'raw':![],'where':{'id':_0x4ace25[_0x86da('0x45')]['id']}},_0x617457={};_0x617457[_0x86da('0x30')]=_[_0x86da('0x33')](db[_0x86da('0x2c')][_0x86da('0x2d')]);_0x617457['query']=_[_0x86da('0x33')](_0x4ace25[_0x86da('0x32')]);_0x617457[_0x86da('0x34')]=_['intersection'](_0x617457[_0x86da('0x30')],_0x617457['query']);_0x5ec9f3['attributes']=_[_0x86da('0x36')](_0x617457[_0x86da('0x30')],qs[_0x86da('0x37')](_0x4ace25[_0x86da('0x32')][_0x86da('0x37')]));_0x5ec9f3['attributes']=_0x5ec9f3[_0x86da('0x35')][_0x86da('0x46')]?_0x5ec9f3[_0x86da('0x35')]:_0x617457[_0x86da('0x30')];if(_0x4ace25[_0x86da('0x32')]['includeAll']){_0x5ec9f3[_0x86da('0x43')]=[{'all':!![]}];}_0x5ec9f3=_['merge']({},_0x5ec9f3,_0x4ace25[_0x86da('0x41')]);return db['Campaign'][_0x86da('0x47')](_0x5ec9f3)[_0x86da('0x23')](handleEntityNotFound(_0x31cdc0,null))[_0x86da('0x23')](respondWithResult(_0x31cdc0,null))[_0x86da('0x44')](handleError(_0x31cdc0,null));};exports[_0x86da('0x48')]=function(_0x2914ca,_0x26e1eb){return db['Campaign']['create'](_0x2914ca[_0x86da('0x49')],{})[_0x86da('0x23')](function(_0x1cfc9b){var _0xac1fee=_0x2914ca[_0x86da('0x4a')][_0x86da('0x4b')]({'plain':!![]});if(!_0xac1fee)throw new Error(_0x86da('0x4c'));if(_0xac1fee[_0x86da('0x4d')]==='user'){var _0x4f40f8=_0x1cfc9b['get']({'plain':!![]});var _0x3aa06d=_0x86da('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x3aa06d,'userProfileId':_0xac1fee[_0x86da('0x4e')]},'raw':!![]})[_0x86da('0x23')](function(_0x383181){if(_0x383181&&_0x383181['autoAssociation']===0x0){return db[_0x86da('0x26')][_0x86da('0x48')]({'name':_0x4f40f8[_0x86da('0x29')],'resourceId':_0x4f40f8['id'],'type':_0x383181[_0x86da('0x29')],'sectionId':_0x383181['id']},{})[_0x86da('0x23')](function(){return _0x1cfc9b;});}else{return _0x1cfc9b;}})['catch'](function(_0x423ff4){logger[_0x86da('0x27')](_0x86da('0x4f'),_0x423ff4);throw _0x423ff4;});}return _0x1cfc9b;})[_0x86da('0x23')](respondWithResult(_0x26e1eb,0xc9))[_0x86da('0x44')](handleError(_0x26e1eb,null));};exports[_0x86da('0x50')]=function(_0x51b3bf,_0xb6c41){var _0x5ede09={'where':{'id':_0x51b3bf['params']['id']}},_0x352dd5={};_0x352dd5[_0x86da('0x30')]=_[_0x86da('0x33')](db[_0x86da('0x2c')]['rawAttributes']);_0x5ede09[_0x86da('0x35')]=_['intersection'](_0x352dd5[_0x86da('0x30')],qs[_0x86da('0x37')](_0x51b3bf[_0x86da('0x32')]['fields']));_0x5ede09[_0x86da('0x35')]=_0x5ede09[_0x86da('0x35')][_0x86da('0x46')]?_0x5ede09['attributes']:_0x352dd5['model'];if(_0x51b3bf[_0x86da('0x32')]['includeAll']){_0x5ede09[_0x86da('0x43')]=[{'all':!![]}];}_0x5ede09=_[_0x86da('0x3f')]({},_0x5ede09,_0x51b3bf['options']);return db[_0x86da('0x2c')]['find'](_0x5ede09)['then'](handleEntityNotFound(_0xb6c41,null))[_0x86da('0x23')](function(_0x14e0e3){if(_0x14e0e3){var _0x580513=_0x14e0e3[_0x86da('0x4b')]({'plain':!![]});_0x580513=qs[_0x86da('0x51')](_0x580513,['id',_0x86da('0x52'),_0x86da('0x53')]);_0x51b3bf[_0x86da('0x49')]=_[_0x86da('0x51')](_0x51b3bf[_0x86da('0x49')],['id',_0x86da('0x52'),_0x86da('0x53')]);return db[_0x86da('0x2c')][_0x86da('0x48')](_['merge'](_0x580513,_0x51b3bf[_0x86da('0x49')]),{'include':_0x51b3bf[_0x86da('0x32')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x393744){var _0x64682b=_0x51b3bf[_0x86da('0x4a')]['get']({'plain':!![]});if(!_0x64682b)throw new Error(_0x86da('0x4c'));if(_0x64682b['role']==='user'){var _0x12520e=_0x393744[_0x86da('0x4b')]({'plain':!![]});var _0x28ac3d=_0x86da('0x25');return db[_0x86da('0x54')][_0x86da('0x47')]({'where':{'name':_0x28ac3d,'userProfileId':_0x64682b[_0x86da('0x4e')]},'raw':!![]})[_0x86da('0x23')](function(_0x1bf3e){if(_0x1bf3e&&_0x1bf3e[_0x86da('0x55')]===0x0){return db[_0x86da('0x26')]['create']({'name':_0x12520e[_0x86da('0x29')],'resourceId':_0x12520e['id'],'type':_0x1bf3e[_0x86da('0x29')],'sectionId':_0x1bf3e['id']},{})['then'](function(){return _0x393744;});}else{return _0x393744;}})[_0x86da('0x44')](function(_0x24a3e5){logger[_0x86da('0x27')](_0x86da('0x4f'),_0x24a3e5);throw _0x24a3e5;});}return _0x393744;});}})[_0x86da('0x23')](respondWithResult(_0xb6c41,0xc9))['catch'](handleError(_0xb6c41,null));};exports[_0x86da('0x56')]=function(_0x19897f,_0x412164){if(_0x19897f[_0x86da('0x49')]['id']){delete _0x19897f['body']['id'];}return db['Campaign']['find']({'where':{'id':_0x19897f[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x412164,null))[_0x86da('0x23')](saveUpdates(_0x19897f[_0x86da('0x49')],null))['then'](respondWithResult(_0x412164,null))[_0x86da('0x44')](handleError(_0x412164,null));};exports['destroy']=function(_0x5760b3,_0x749760){return db[_0x86da('0x2c')][_0x86da('0x47')]({'where':{'id':_0x5760b3[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x749760,null))[_0x86da('0x23')](removeEntity(_0x749760,null))[_0x86da('0x44')](handleError(_0x749760,null));};exports['getHoppers']=function(_0x2f127c,_0xc3644c,_0x444b2f){var _0x40d9d3={'raw':!![],'where':{}};var _0x74bd6d={};var _0xb8f1e9={'count':0x0,'rows':[]};return db[_0x86da('0x2c')][_0x86da('0x57')]({'where':{'id':_0x2f127c[_0x86da('0x45')]['id']}})['then'](handleEntityNotFound(_0xc3644c,null))[_0x86da('0x23')](function(_0x533068){if(_0x533068){_0x74bd6d[_0x86da('0x30')]=_[_0x86da('0x33')](db['CmHopper'][_0x86da('0x2d')]);_0x74bd6d[_0x86da('0x32')]=_[_0x86da('0x33')](_0x2f127c[_0x86da('0x32')]);_0x74bd6d[_0x86da('0x34')]=_[_0x86da('0x36')](_0x74bd6d[_0x86da('0x30')],_0x74bd6d[_0x86da('0x32')]);_0x40d9d3['attributes']=_['intersection'](_0x74bd6d[_0x86da('0x30')],qs[_0x86da('0x37')](_0x2f127c[_0x86da('0x32')][_0x86da('0x37')]));_0x40d9d3['attributes']=_0x40d9d3[_0x86da('0x35')]['length']?_0x40d9d3[_0x86da('0x35')]:_0x74bd6d['model'];if(!_0x2f127c[_0x86da('0x32')][_0x86da('0x38')]('nolimit')){_0x40d9d3[_0x86da('0x1f')]=qs[_0x86da('0x1f')](_0x2f127c[_0x86da('0x32')][_0x86da('0x1f')]);_0x40d9d3[_0x86da('0x1d')]=qs[_0x86da('0x1d')](_0x2f127c[_0x86da('0x32')][_0x86da('0x1d')]);}_0x40d9d3[_0x86da('0x3a')]=qs[_0x86da('0x3b')](_0x2f127c['query'][_0x86da('0x3b')]);_0x40d9d3[_0x86da('0x3c')]=qs[_0x86da('0x34')](_[_0x86da('0x3d')](_0x2f127c[_0x86da('0x32')],_0x74bd6d[_0x86da('0x34')]));_0x40d9d3[_0x86da('0x3c')][_0x86da('0x58')]=_0x533068['id'];if(_0x2f127c[_0x86da('0x32')][_0x86da('0x3e')]){_0x40d9d3[_0x86da('0x3c')]=_[_0x86da('0x3f')](_0x40d9d3[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0x40d9d3[_0x86da('0x35')],function(_0x3eeed9){var _0x24aafe={};_0x24aafe[_0x3eeed9]={'$like':'%'+_0x2f127c[_0x86da('0x32')][_0x86da('0x3e')]+'%'};return _0x24aafe;})});}_0x40d9d3=_[_0x86da('0x3f')]({},_0x40d9d3,_0x2f127c[_0x86da('0x41')]);return db[_0x86da('0x59')][_0x86da('0x20')]({'where':_0x40d9d3[_0x86da('0x3c')]})[_0x86da('0x23')](function(_0x327fcb){_0xb8f1e9[_0x86da('0x20')]=_0x327fcb;if(_0x2f127c[_0x86da('0x32')][_0x86da('0x42')]){_0x40d9d3[_0x86da('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0x86da('0x5a')](_0x40d9d3);})[_0x86da('0x23')](function(_0x5b7ca5){_0xb8f1e9[_0x86da('0x5b')]=_0x5b7ca5;return _0xb8f1e9;});}})[_0x86da('0x23')](respondWithFilteredResult(_0xc3644c,_0x40d9d3))['catch'](handleError(_0xc3644c,null));};exports[_0x86da('0x5c')]=function(_0x2f122e,_0x239e59,_0x2351da){var _0x3b58bb={'raw':!![],'where':{}};var _0x2f1c2f={};var _0x2cccc4={'count':0x0,'rows':[]};return db[_0x86da('0x2c')][_0x86da('0x57')]({'where':{'id':_0x2f122e[_0x86da('0x45')]['id']}})['then'](handleEntityNotFound(_0x239e59,null))[_0x86da('0x23')](function(_0x436715){if(_0x436715){_0x2f1c2f['model']=_[_0x86da('0x33')](db['CmHopperHistory'][_0x86da('0x2d')]);_0x2f1c2f[_0x86da('0x32')]=_[_0x86da('0x33')](_0x2f122e['query']);_0x2f1c2f['filters']=_[_0x86da('0x36')](_0x2f1c2f[_0x86da('0x30')],_0x2f1c2f['query']);_0x3b58bb['attributes']=_[_0x86da('0x36')](_0x2f1c2f['model'],qs[_0x86da('0x37')](_0x2f122e['query'][_0x86da('0x37')]));_0x3b58bb[_0x86da('0x35')]=_0x3b58bb[_0x86da('0x35')][_0x86da('0x46')]?_0x3b58bb[_0x86da('0x35')]:_0x2f1c2f['model'];if(!_0x2f122e[_0x86da('0x32')]['hasOwnProperty'](_0x86da('0x39'))){_0x3b58bb[_0x86da('0x1f')]=qs['limit'](_0x2f122e['query'][_0x86da('0x1f')]);_0x3b58bb['offset']=qs['offset'](_0x2f122e['query'][_0x86da('0x1d')]);}_0x3b58bb[_0x86da('0x3a')]=qs['sort'](_0x2f122e[_0x86da('0x32')][_0x86da('0x3b')]);_0x3b58bb[_0x86da('0x3c')]=qs[_0x86da('0x34')](_[_0x86da('0x3d')](_0x2f122e[_0x86da('0x32')],_0x2f1c2f[_0x86da('0x34')]));_0x3b58bb[_0x86da('0x3c')][_0x86da('0x58')]=_0x436715['id'];if(_0x2f122e[_0x86da('0x32')][_0x86da('0x3e')]){_0x3b58bb[_0x86da('0x3c')]=_[_0x86da('0x3f')](_0x3b58bb[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0x3b58bb['attributes'],function(_0xdaf0fd){var _0x34c2f8={};_0x34c2f8[_0xdaf0fd]={'$like':'%'+_0x2f122e[_0x86da('0x32')][_0x86da('0x3e')]+'%'};return _0x34c2f8;})});}_0x3b58bb=_[_0x86da('0x3f')]({},_0x3b58bb,_0x2f122e['options']);return db['CmHopperHistory'][_0x86da('0x20')]({'where':_0x3b58bb[_0x86da('0x3c')]})[_0x86da('0x23')](function(_0x585c89){_0x2cccc4['count']=_0x585c89;if(_0x2f122e[_0x86da('0x32')][_0x86da('0x42')]){_0x3b58bb[_0x86da('0x43')]=[{'all':!![]}];}return db[_0x86da('0x5d')][_0x86da('0x5a')](_0x3b58bb);})[_0x86da('0x23')](function(_0x268dcc){_0x2cccc4[_0x86da('0x5b')]=_0x268dcc;return _0x2cccc4;});}})[_0x86da('0x23')](respondWithFilteredResult(_0x239e59,_0x3b58bb))['catch'](handleError(_0x239e59,null));};exports['getHopperFinals']=function(_0x43470c,_0x2cf47a,_0x33eedf){var _0x3c27c6={'raw':!![],'where':{}};var _0x4b5e52={};var _0x5b86db={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x43470c[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x2cf47a,null))[_0x86da('0x23')](function(_0x43c8ee){if(_0x43c8ee){_0x4b5e52['model']=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x4b5e52[_0x86da('0x32')]=_['keys'](_0x43470c['query']);_0x4b5e52['filters']=_[_0x86da('0x36')](_0x4b5e52['model'],_0x4b5e52[_0x86da('0x32')]);_0x3c27c6['attributes']=_[_0x86da('0x36')](_0x4b5e52['model'],qs[_0x86da('0x37')](_0x43470c[_0x86da('0x32')][_0x86da('0x37')]));_0x3c27c6['attributes']=_0x3c27c6[_0x86da('0x35')]['length']?_0x3c27c6['attributes']:_0x4b5e52[_0x86da('0x30')];if(!_0x43470c[_0x86da('0x32')][_0x86da('0x38')](_0x86da('0x39'))){_0x3c27c6['limit']=qs[_0x86da('0x1f')](_0x43470c[_0x86da('0x32')]['limit']);_0x3c27c6[_0x86da('0x1d')]=qs['offset'](_0x43470c[_0x86da('0x32')][_0x86da('0x1d')]);}_0x3c27c6[_0x86da('0x3a')]=qs[_0x86da('0x3b')](_0x43470c[_0x86da('0x32')][_0x86da('0x3b')]);_0x3c27c6[_0x86da('0x3c')]=qs['filters'](_[_0x86da('0x3d')](_0x43470c[_0x86da('0x32')],_0x4b5e52[_0x86da('0x34')]));_0x3c27c6[_0x86da('0x3c')][_0x86da('0x58')]=_0x43c8ee['id'];if(_0x43470c['query'][_0x86da('0x3e')]){_0x3c27c6[_0x86da('0x3c')]=_['merge'](_0x3c27c6[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0x3c27c6['attributes'],function(_0x5a6174){var _0x3651d4={};_0x3651d4[_0x5a6174]={'$like':'%'+_0x43470c[_0x86da('0x32')][_0x86da('0x3e')]+'%'};return _0x3651d4;})});}_0x3c27c6=_[_0x86da('0x3f')]({},_0x3c27c6,_0x43470c[_0x86da('0x41')]);return db[_0x86da('0x5e')][_0x86da('0x20')]({'where':_0x3c27c6[_0x86da('0x3c')]})[_0x86da('0x23')](function(_0x5f0c3d){_0x5b86db['count']=_0x5f0c3d;if(_0x43470c['query']['includeAll']){_0x3c27c6['include']=[{'all':!![]}];}return db[_0x86da('0x5e')][_0x86da('0x5a')](_0x3c27c6);})[_0x86da('0x23')](function(_0x5971c0){_0x5b86db[_0x86da('0x5b')]=_0x5971c0;return _0x5b86db;});}})[_0x86da('0x23')](respondWithFilteredResult(_0x2cf47a,_0x3c27c6))[_0x86da('0x44')](handleError(_0x2cf47a,null));};exports['getHopperBlacks']=function(_0x34b05f,_0x35dd43,_0x166d0e){var _0x2431c0={'raw':!![],'where':{}};var _0x4bf8b7={};var _0x2f7236={'count':0x0,'rows':[]};return db[_0x86da('0x2c')][_0x86da('0x57')]({'where':{'id':_0x34b05f[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x35dd43,null))[_0x86da('0x23')](function(_0x3ed648){if(_0x3ed648){_0x4bf8b7[_0x86da('0x30')]=_[_0x86da('0x33')](db[_0x86da('0x5f')]['rawAttributes']);_0x4bf8b7['query']=_[_0x86da('0x33')](_0x34b05f[_0x86da('0x32')]);_0x4bf8b7['filters']=_[_0x86da('0x36')](_0x4bf8b7[_0x86da('0x30')],_0x4bf8b7['query']);_0x2431c0[_0x86da('0x35')]=_[_0x86da('0x36')](_0x4bf8b7['model'],qs[_0x86da('0x37')](_0x34b05f[_0x86da('0x32')]['fields']));_0x2431c0[_0x86da('0x35')]=_0x2431c0[_0x86da('0x35')]['length']?_0x2431c0[_0x86da('0x35')]:_0x4bf8b7[_0x86da('0x30')];if(!_0x34b05f['query'][_0x86da('0x38')]('nolimit')){_0x2431c0[_0x86da('0x1f')]=qs[_0x86da('0x1f')](_0x34b05f[_0x86da('0x32')][_0x86da('0x1f')]);_0x2431c0[_0x86da('0x1d')]=qs[_0x86da('0x1d')](_0x34b05f[_0x86da('0x32')][_0x86da('0x1d')]);}_0x2431c0[_0x86da('0x3a')]=qs[_0x86da('0x3b')](_0x34b05f[_0x86da('0x32')][_0x86da('0x3b')]);_0x2431c0[_0x86da('0x3c')]=qs['filters'](_[_0x86da('0x3d')](_0x34b05f['query'],_0x4bf8b7[_0x86da('0x34')]));_0x2431c0['where'][_0x86da('0x58')]=_0x3ed648['id'];if(_0x34b05f[_0x86da('0x32')][_0x86da('0x3e')]){_0x2431c0['where']=_['merge'](_0x2431c0[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0x2431c0[_0x86da('0x35')],function(_0x3179b8){var _0x19fb6a={};_0x19fb6a[_0x3179b8]={'$like':'%'+_0x34b05f[_0x86da('0x32')][_0x86da('0x3e')]+'%'};return _0x19fb6a;})});}_0x2431c0=_['merge']({},_0x2431c0,_0x34b05f[_0x86da('0x41')]);return db[_0x86da('0x5f')]['count']({'where':_0x2431c0[_0x86da('0x3c')]})[_0x86da('0x23')](function(_0x160987){_0x2f7236[_0x86da('0x20')]=_0x160987;if(_0x34b05f[_0x86da('0x32')]['includeAll']){_0x2431c0[_0x86da('0x43')]=[{'all':!![]}];}return db[_0x86da('0x5f')][_0x86da('0x5a')](_0x2431c0);})[_0x86da('0x23')](function(_0x3572b4){_0x2f7236[_0x86da('0x5b')]=_0x3572b4;return _0x2f7236;});}})['then'](respondWithFilteredResult(_0x35dd43,_0x2431c0))['catch'](handleError(_0x35dd43,null));};exports[_0x86da('0x60')]=function(_0x99cfbe,_0x14a431,_0x104a12){var _0x3020d3={};var _0x4193ca={};var _0x1d3981;var _0x550eed;return db[_0x86da('0x2c')][_0x86da('0x57')]({'where':{'id':_0x99cfbe['params']['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x14a431,null))[_0x86da('0x23')](function(_0x4cc0a0){if(_0x4cc0a0){_0x1d3981=_0x4cc0a0;_0x4193ca['model']=_['keys'](db[_0x86da('0x61')][_0x86da('0x2d')]);_0x4193ca[_0x86da('0x32')]=_['keys'](_0x99cfbe['query']);_0x4193ca['filters']=_[_0x86da('0x36')](_0x4193ca['model'],_0x4193ca['query']);_0x3020d3[_0x86da('0x35')]=_[_0x86da('0x36')](_0x4193ca[_0x86da('0x30')],qs[_0x86da('0x37')](_0x99cfbe[_0x86da('0x32')][_0x86da('0x37')]));_0x3020d3['attributes']=_0x3020d3[_0x86da('0x35')][_0x86da('0x46')]?_0x3020d3[_0x86da('0x35')]:_0x4193ca[_0x86da('0x30')];_0x3020d3[_0x86da('0x3a')]=qs[_0x86da('0x3b')](_0x99cfbe[_0x86da('0x32')][_0x86da('0x3b')]);_0x3020d3[_0x86da('0x3c')]=qs['filters'](_['pick'](_0x99cfbe['query'],_0x4193ca[_0x86da('0x34')]));if(_0x99cfbe[_0x86da('0x32')][_0x86da('0x3e')]){_0x3020d3[_0x86da('0x3c')]=_[_0x86da('0x3f')](_0x3020d3['where'],{'$or':_[_0x86da('0x31')](_0x3020d3[_0x86da('0x35')],function(_0x1c2667){var _0x50fe7d={};_0x50fe7d[_0x1c2667]={'$like':'%'+_0x99cfbe['query'][_0x86da('0x3e')]+'%'};return _0x50fe7d;})});}_0x3020d3=_[_0x86da('0x3f')]({},_0x3020d3,_0x99cfbe['options']);return _0x1d3981[_0x86da('0x60')](_0x3020d3);}})[_0x86da('0x23')](function(_0x57db0e){if(_0x57db0e){_0x550eed=_0x57db0e[_0x86da('0x46')];if(!_0x99cfbe[_0x86da('0x32')]['hasOwnProperty'](_0x86da('0x39'))){_0x3020d3[_0x86da('0x1f')]=qs['limit'](_0x99cfbe[_0x86da('0x32')][_0x86da('0x1f')]);_0x3020d3[_0x86da('0x1d')]=qs[_0x86da('0x1d')](_0x99cfbe[_0x86da('0x32')][_0x86da('0x1d')]);}return _0x1d3981['getLists'](_0x3020d3);}})['then'](function(_0x1b9f78){if(_0x1b9f78){return _0x1b9f78?{'count':_0x550eed,'rows':_0x1b9f78}:null;}})['then'](respondWithResult(_0x14a431,null))[_0x86da('0x44')](handleError(_0x14a431,null));};exports[_0x86da('0x62')]=function(_0x418db2,_0x1bd9a1,_0x3c4d9c){var _0x41e429,_0x3bba3d;return db[_0x86da('0x2c')][_0x86da('0x47')]({'where':{'id':_0x418db2[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x1bd9a1,null))[_0x86da('0x23')](function(_0x20f426){if(_0x20f426){_0x3bba3d=_0x20f426;return _0x20f426[_0x86da('0x62')](_0x418db2[_0x86da('0x49')]['ids'],_[_0x86da('0x51')](_0x418db2['body'],['ids','id'])||{});}return null;})[_0x86da('0x63')](function(_0x37d907){var _0x3f405a;_0x41e429=_0x37d907||[];var _0x1f1955=[];if(_0x37d907){for(var _0x5231a7=0x0;_0x5231a7<_0x37d907[_0x86da('0x46')];_0x5231a7+=0x1){var _0x995b56=_0x37d907[_0x5231a7]['get']({'plain':!![]});_0x3bba3d[_0x86da('0x64')]=_0x418db2[_0x86da('0x49')]['dialCheckDuplicateType']?_0x418db2['body'][_0x86da('0x64')]:_0x3bba3d[_0x86da('0x64')];switch(_0x3bba3d[_0x86da('0x64')]){case _0x86da('0x65'):_0x3f405a=squel[_0x86da('0x66')]()[_0x86da('0x67')](_0x86da('0x68'))['fromQuery']([_0x86da('0x69'),_0x86da('0x6a'),_0x86da('0x6b'),_0x86da('0x6c'),_0x86da('0x58'),'createdAt',_0x86da('0x53')],squel[_0x86da('0x6d')]()[_0x86da('0x6e')]('phone',_0x86da('0x69'))[_0x86da('0x6e')](_0x86da('0x6f'),'scheduledAt')['field']('id',_0x86da('0x6b'))['field'](_0x995b56[_0x86da('0x70')][_0x86da('0x71')](),_0x86da('0x6c'))[_0x86da('0x6e')](_0x418db2[_0x86da('0x45')]['id'][_0x86da('0x71')](),_0x86da('0x58'))[_0x86da('0x6e')]('NOW()',_0x86da('0x52'))['field'](_0x86da('0x6f'),_0x86da('0x53'))[_0x86da('0x72')](_0x86da('0x73'))[_0x86da('0x3c')](_0x86da('0x74'))[_0x86da('0x3c')]('ListId\x20=\x20?',_0x995b56['CmListId']['toString']())[_0x86da('0x3c')](_0x86da('0x75'))[_0x86da('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x86da('0x6d')]()[_0x86da('0x6e')]('COALESCE(calleridnum,\x27\x27)')[_0x86da('0x72')](_0x86da('0x76'))[_0x86da('0x3c')](_0x86da('0x77'),_0x418db2[_0x86da('0x45')]['id']['toString']()))[_0x86da('0x3c')](_0x86da('0x78'),squel['select']()['field'](_0x86da('0x79'))['from'](_0x86da('0x68'))['where'](_0x86da('0x77'),_0x418db2[_0x86da('0x45')]['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x3f405a=squel[_0x86da('0x66')]()[_0x86da('0x67')](_0x86da('0x68'))['fromQuery']([_0x86da('0x69'),_0x86da('0x6a'),_0x86da('0x6b'),_0x86da('0x6c'),_0x86da('0x58'),'createdAt',_0x86da('0x53')],squel[_0x86da('0x6d')]()[_0x86da('0x6e')]('phone',_0x86da('0x69'))['field'](_0x86da('0x6f'),_0x86da('0x6a'))[_0x86da('0x6e')]('id','ContactId')['field'](_0x995b56[_0x86da('0x70')][_0x86da('0x71')](),_0x86da('0x6c'))[_0x86da('0x6e')](_0x418db2[_0x86da('0x45')]['id'][_0x86da('0x71')](),_0x86da('0x58'))[_0x86da('0x6e')](_0x86da('0x6f'),'createdAt')[_0x86da('0x6e')](_0x86da('0x6f'),_0x86da('0x53'))[_0x86da('0x72')](_0x86da('0x73'))[_0x86da('0x3c')](_0x86da('0x74'))[_0x86da('0x3c')](_0x86da('0x7a'),_0x995b56[_0x86da('0x70')][_0x86da('0x71')]())[_0x86da('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x86da('0x3c')](_0x86da('0x78'),squel[_0x86da('0x6d')]()[_0x86da('0x6e')](_0x86da('0x79'))['from'](_0x86da('0x68'))[_0x86da('0x3c')](_0x86da('0x77'),_0x418db2[_0x86da('0x45')]['id'][_0x86da('0x71')]())))[_0x86da('0x71')]();break;default:_0x3f405a=squel[_0x86da('0x66')]()[_0x86da('0x67')](_0x86da('0x68'))['fromQuery']([_0x86da('0x69'),_0x86da('0x6a'),'ContactId',_0x86da('0x6c'),_0x86da('0x58'),_0x86da('0x52'),_0x86da('0x53')],squel[_0x86da('0x6d')]()[_0x86da('0x6e')](_0x86da('0x69'),_0x86da('0x69'))[_0x86da('0x6e')]('NOW()','scheduledAt')['field']('id',_0x86da('0x6b'))[_0x86da('0x6e')](_0x995b56[_0x86da('0x70')][_0x86da('0x71')](),_0x86da('0x6c'))[_0x86da('0x6e')](_0x418db2[_0x86da('0x45')]['id'][_0x86da('0x71')](),_0x86da('0x58'))[_0x86da('0x6e')](_0x86da('0x6f'),_0x86da('0x52'))[_0x86da('0x6e')](_0x86da('0x6f'),_0x86da('0x53'))[_0x86da('0x72')](_0x86da('0x73'))[_0x86da('0x3c')](_0x86da('0x74'))[_0x86da('0x3c')](_0x86da('0x7a'),_0x995b56[_0x86da('0x70')][_0x86da('0x71')]())[_0x86da('0x3c')](_0x86da('0x75')))[_0x86da('0x71')]();}_0x1f1955['push'](db[_0x86da('0x7b')][_0x86da('0x32')](_0x3f405a));}return BPromise[_0x86da('0x7c')](_0x1f1955);}})[_0x86da('0x23')](function(){return _0x41e429;})[_0x86da('0x23')](respondWithResult(_0x1bd9a1,null))[_0x86da('0x44')](handleError(_0x1bd9a1,null));};exports[_0x86da('0x7d')]=function(_0x23138a,_0x35e12e,_0x16dc90){return db['Campaign']['find']({'where':{'id':_0x23138a[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x35e12e,null))['then'](function(_0x3161d7){if(_0x3161d7){return _0x3161d7[_0x86da('0x7d')](_0x23138a[_0x86da('0x32')][_0x86da('0x7e')]);}})[_0x86da('0x23')](function(_0x18aebe){if(_0x18aebe){return db[_0x86da('0x59')][_0x86da('0x24')]({'where':{'ListId':_0x23138a[_0x86da('0x32')][_0x86da('0x7e')],'CampaignId':_0x23138a[_0x86da('0x45')]['id']}})[_0x86da('0x23')](function(){return _0x18aebe;});}})['then'](respondWithStatusCode(_0x35e12e,null))[_0x86da('0x44')](handleError(_0x35e12e,null));};exports[_0x86da('0x7f')]=function(_0x218b50,_0x13c769,_0x565751){var _0xedae27={};var _0x202e19={};var _0x4a078e;var _0x37c7c4;return db['Campaign']['findOne']({'where':{'id':_0x218b50['params']['id']}})['then'](handleEntityNotFound(_0x13c769,null))[_0x86da('0x23')](function(_0x2aaab4){if(_0x2aaab4){_0x4a078e=_0x2aaab4;_0x202e19[_0x86da('0x30')]=_['keys'](db[_0x86da('0x61')][_0x86da('0x2d')]);_0x202e19[_0x86da('0x32')]=_[_0x86da('0x33')](_0x218b50[_0x86da('0x32')]);_0x202e19[_0x86da('0x34')]=_['intersection'](_0x202e19['model'],_0x202e19[_0x86da('0x32')]);_0xedae27[_0x86da('0x35')]=_[_0x86da('0x36')](_0x202e19[_0x86da('0x30')],qs[_0x86da('0x37')](_0x218b50[_0x86da('0x32')][_0x86da('0x37')]));_0xedae27[_0x86da('0x35')]=_0xedae27[_0x86da('0x35')]['length']?_0xedae27['attributes']:_0x202e19[_0x86da('0x30')];_0xedae27[_0x86da('0x3a')]=qs['sort'](_0x218b50[_0x86da('0x32')][_0x86da('0x3b')]);_0xedae27[_0x86da('0x3c')]=qs[_0x86da('0x34')](_[_0x86da('0x3d')](_0x218b50[_0x86da('0x32')],_0x202e19[_0x86da('0x34')]));if(_0x218b50[_0x86da('0x32')]['filter']){_0xedae27[_0x86da('0x3c')]=_['merge'](_0xedae27[_0x86da('0x3c')],{'$or':_[_0x86da('0x31')](_0xedae27[_0x86da('0x35')],function(_0x23ad45){var _0x51372d={};_0x51372d[_0x23ad45]={'$like':'%'+_0x218b50[_0x86da('0x32')][_0x86da('0x3e')]+'%'};return _0x51372d;})});}_0xedae27=_[_0x86da('0x3f')]({},_0xedae27,_0x218b50[_0x86da('0x41')]);return _0x4a078e[_0x86da('0x7f')](_0xedae27);}})['then'](function(_0x850e2a){if(_0x850e2a){_0x37c7c4=_0x850e2a[_0x86da('0x46')];if(!_0x218b50[_0x86da('0x32')][_0x86da('0x38')]('nolimit')){_0xedae27[_0x86da('0x1f')]=qs['limit'](_0x218b50['query'][_0x86da('0x1f')]);_0xedae27[_0x86da('0x1d')]=qs[_0x86da('0x1d')](_0x218b50[_0x86da('0x32')]['offset']);}return _0x4a078e[_0x86da('0x7f')](_0xedae27);}})[_0x86da('0x23')](function(_0x5ecaf5){if(_0x5ecaf5){return _0x5ecaf5?{'count':_0x37c7c4,'rows':_0x5ecaf5}:null;}})[_0x86da('0x23')](respondWithResult(_0x13c769,null))[_0x86da('0x44')](handleError(_0x13c769,null));};exports[_0x86da('0x80')]=function(_0x401a83,_0x538cf7,_0x4cd16e){var _0x3bc045,_0x46dc3b;return db[_0x86da('0x2c')][_0x86da('0x47')]({'where':{'id':_0x401a83[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x538cf7,null))[_0x86da('0x23')](function(_0x1344b1){if(_0x1344b1){_0x46dc3b=_0x1344b1;return _0x1344b1[_0x86da('0x80')](_0x401a83['body'][_0x86da('0x7e')],_[_0x86da('0x51')](_0x401a83[_0x86da('0x49')],[_0x86da('0x7e'),'id'])||{});}return null;})[_0x86da('0x63')](function(_0x2e01cd){var _0x4b8f9a;_0x3bc045=_0x2e01cd||[];var _0x4e34d9=[];if(_0x2e01cd){for(var _0x3d7d8f=0x0;_0x3d7d8f<_0x2e01cd[_0x86da('0x46')];_0x3d7d8f+=0x1){var _0x1c69c5=_0x2e01cd[_0x3d7d8f]['get']({'plain':!![]});_0x4b8f9a=squel[_0x86da('0x66')]()[_0x86da('0x67')](_0x86da('0x81'))[_0x86da('0x82')]([_0x86da('0x69'),'ContactId',_0x86da('0x6c'),_0x86da('0x58'),'createdAt','updatedAt'],squel[_0x86da('0x6d')]()[_0x86da('0x6e')]('phone',_0x86da('0x69'))[_0x86da('0x6e')]('id','ContactId')['field'](_0x1c69c5[_0x86da('0x70')][_0x86da('0x71')](),_0x86da('0x6c'))[_0x86da('0x6e')](_0x401a83[_0x86da('0x45')]['id'][_0x86da('0x71')](),_0x86da('0x58'))[_0x86da('0x6e')]('NOW()',_0x86da('0x52'))['field'](_0x86da('0x6f'),_0x86da('0x53'))[_0x86da('0x72')](_0x86da('0x73'))[_0x86da('0x3c')](_0x86da('0x74'))[_0x86da('0x3c')]('ListId\x20=\x20?',_0x1c69c5[_0x86da('0x70')][_0x86da('0x71')]())[_0x86da('0x3c')](_0x86da('0x75')))[_0x86da('0x71')]();_0x4e34d9[_0x86da('0x83')](db[_0x86da('0x7b')][_0x86da('0x32')](_0x4b8f9a));}return BPromise[_0x86da('0x7c')](_0x4e34d9);}})[_0x86da('0x23')](function(){return _0x3bc045;})[_0x86da('0x23')](respondWithResult(_0x538cf7,null))[_0x86da('0x44')](handleError(_0x538cf7,null));};exports[_0x86da('0x84')]=function(_0x2a1676,_0x2b48e2,_0x6b43df){return db['Campaign'][_0x86da('0x47')]({'where':{'id':_0x2a1676[_0x86da('0x45')]['id']}})[_0x86da('0x23')](handleEntityNotFound(_0x2b48e2,null))['then'](function(_0x4c5db7){if(_0x4c5db7){return _0x4c5db7['removeBlackLists'](_0x2a1676[_0x86da('0x32')][_0x86da('0x7e')]);}})[_0x86da('0x23')](function(_0x270c0b){if(_0x270c0b){return db[_0x86da('0x5f')][_0x86da('0x24')]({'where':{'ListId':_0x2a1676['query'][_0x86da('0x7e')],'CampaignId':_0x2a1676[_0x86da('0x45')]['id']}})[_0x86da('0x23')](function(){return _0x270c0b;});}})[_0x86da('0x23')](respondWithStatusCode(_0x2b48e2,null))[_0x86da('0x44')](handleError(_0x2b48e2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7138dda..120f156 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(_0x4c6a7f,_0x452cf6){var _0x1a5474=function(_0x5531ee){while(--_0x5531ee){_0x4c6a7f['push'](_0x4c6a7f['shift']());}};_0x1a5474(++_0x452cf6);}(_0x7a54,0x106));var _0x47a5=function(_0x4b52f7,_0x26d0b2){_0x4b52f7=_0x4b52f7-0x0;var _0x116a3f=_0x7a54[_0x4b52f7];return _0x116a3f;};'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(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 4f4dba8..1aaed5c 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 _0x8fcf=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetCampaign','Campaign','findAll','options','raw','attributes','include','map','model','lodash','util','moment','randomstring','../../config/logger'];(function(_0x4165c3,_0x43b27e){var _0xff7102=function(_0x48bbf2){while(--_0x48bbf2){_0x4165c3['push'](_0x4165c3['shift']());}};_0xff7102(++_0x43b27e);}(_0x8fcf,0x1db));var _0xf8fc=function(_0x3da4dd,_0x143cde){_0x3da4dd=_0x3da4dd-0x0;var _0x1c5e90=_0x8fcf[_0x3da4dd];return _0x1c5e90;};'use strict';var _=require(_0xf8fc('0x0'));var util=require(_0xf8fc('0x1'));var moment=require(_0xf8fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf8fc('0x4'))(_0xf8fc('0x5'));var config=require(_0xf8fc('0x6'));var jayson=require(_0xf8fc('0x7'));var client=jayson[_0xf8fc('0x8')][_0xf8fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1448de,_0x43719b,_0x59c401){return new BPromise(function(_0x13c2a7,_0x5b91e9){return client[_0xf8fc('0xa')](_0x1448de,_0x59c401)[_0xf8fc('0xb')](function(_0xf2e390){logger[_0xf8fc('0xc')](_0xf8fc('0xd'),_0x43719b,'request\x20sent');logger[_0xf8fc('0xe')](_0xf8fc('0xf'),_0x43719b,'request\x20sent',JSON[_0xf8fc('0x10')](_0xf2e390));if(_0xf2e390[_0xf8fc('0x11')]){if(_0xf2e390[_0xf8fc('0x11')][_0xf8fc('0x12')]===0x1f4){logger[_0xf8fc('0x11')](_0xf8fc('0xd'),_0x43719b,_0xf2e390['error'][_0xf8fc('0x13')]);return _0x5b91e9(_0xf2e390[_0xf8fc('0x11')][_0xf8fc('0x13')]);}logger[_0xf8fc('0x11')]('Campaign,\x20%s,\x20%s',_0x43719b,_0xf2e390['error']['message']);return _0x13c2a7(_0xf2e390['error'][_0xf8fc('0x13')]);}else{logger[_0xf8fc('0xc')](_0xf8fc('0xd'),_0x43719b,_0xf8fc('0x14'));_0x13c2a7(_0xf2e390[_0xf8fc('0x15')]['message']);}})[_0xf8fc('0x16')](function(_0x3230cc){logger[_0xf8fc('0x11')](_0xf8fc('0xd'),_0x43719b,_0x3230cc);_0x5b91e9(_0x3230cc);});});}exports[_0xf8fc('0x17')]=function(_0xe2770c){var _0x2ad960=this;return new Promise(function(_0x396cf5,_0x292257){return db[_0xf8fc('0x18')][_0xf8fc('0x19')]({'raw':_0xe2770c[_0xf8fc('0x1a')]?_0xe2770c['options'][_0xf8fc('0x1b')]===undefined?!![]:![]:!![],'where':_0xe2770c[_0xf8fc('0x1a')]?_0xe2770c[_0xf8fc('0x1a')]['where']||null:null,'attributes':_0xe2770c[_0xf8fc('0x1a')]?_0xe2770c['options'][_0xf8fc('0x1c')]||null:null,'limit':_0xe2770c[_0xf8fc('0x1a')]?_0xe2770c[_0xf8fc('0x1a')]['limit']||null:null,'include':_0xe2770c[_0xf8fc('0x1a')]?_0xe2770c[_0xf8fc('0x1a')][_0xf8fc('0x1d')]?_[_0xf8fc('0x1e')](_0xe2770c[_0xf8fc('0x1a')]['include'],function(_0x4e0ea1){return{'model':db[_0x4e0ea1['model']],'as':_0x4e0ea1['as'],'attributes':_0x4e0ea1[_0xf8fc('0x1c')],'include':_0x4e0ea1[_0xf8fc('0x1d')]?_['map'](_0x4e0ea1['include'],function(_0x429b7a){return{'model':db[_0x429b7a[_0xf8fc('0x1f')]],'as':_0x429b7a['as'],'attributes':_0x429b7a[_0xf8fc('0x1c')],'include':_0x429b7a[_0xf8fc('0x1d')]?_[_0xf8fc('0x1e')](_0x429b7a[_0xf8fc('0x1d')],function(_0x2bcdf1){return{'model':db[_0x2bcdf1[_0xf8fc('0x1f')]],'as':_0x2bcdf1['as'],'attributes':_0x2bcdf1[_0xf8fc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf8fc('0xb')](function(_0x47c92c){logger[_0xf8fc('0xc')](_0xf8fc('0x17'),_0xe2770c);logger[_0xf8fc('0xe')](_0xf8fc('0x17'),_0xe2770c,JSON['stringify'](_0x47c92c));_0x396cf5(_0x47c92c);})[_0xf8fc('0x16')](function(_0x551cd3){logger[_0xf8fc('0x11')](_0xf8fc('0x17'),_0x551cd3['message'],_0xe2770c);_0x292257(_0x2ad960[_0xf8fc('0x11')](0x1f4,_0x551cd3[_0xf8fc('0x13')]));});});}; \ No newline at end of file +var _0x847d=['request','then','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','Campaign,\x20%s,\x20%s','message','info','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','debug','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x13ad22,_0x29a4e7){var _0x54af2b=function(_0x44878a){while(--_0x44878a){_0x13ad22['push'](_0x13ad22['shift']());}};_0x54af2b(++_0x29a4e7);}(_0x847d,0x14a));var _0xd847=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x847d[_0x3be7ff];return _0x186721;};'use strict';var _=require('lodash');var util=require(_0xd847('0x0'));var moment=require(_0xd847('0x1'));var BPromise=require(_0xd847('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd847('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd847('0x4'));var logger=require(_0xd847('0x5'))('rpc');var config=require(_0xd847('0x6'));var jayson=require(_0xd847('0x7'));var client=jayson[_0xd847('0x8')][_0xd847('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f3349,_0x20dbfd,_0x19fdb5){return new BPromise(function(_0x2bb22b,_0x235e82){return client[_0xd847('0xa')](_0x5f3349,_0x19fdb5)[_0xd847('0xb')](function(_0x17cb36){logger['info']('Campaign,\x20%s,\x20%s',_0x20dbfd,'request\x20sent');logger['debug'](_0xd847('0xc'),_0x20dbfd,_0xd847('0xd'),JSON[_0xd847('0xe')](_0x17cb36));if(_0x17cb36['error']){if(_0x17cb36['error'][_0xd847('0xf')]===0x1f4){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x235e82(_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);}logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x2bb22b(_0x17cb36['error'][_0xd847('0x12')]);}else{logger[_0xd847('0x13')](_0xd847('0x11'),_0x20dbfd,_0xd847('0xd'));_0x2bb22b(_0x17cb36[_0xd847('0x14')]['message']);}})[_0xd847('0x15')](function(_0x3e1e1c){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x3e1e1c);_0x235e82(_0x3e1e1c);});});}exports['GetCampaign']=function(_0x1ef765){var _0x5eb665=this;return new Promise(function(_0x4b6264,_0x44a57b){return db[_0xd847('0x16')][_0xd847('0x17')]({'raw':_0x1ef765[_0xd847('0x18')]?_0x1ef765['options'][_0xd847('0x19')]===undefined?!![]:![]:!![],'where':_0x1ef765['options']?_0x1ef765['options'][_0xd847('0x1a')]||null:null,'attributes':_0x1ef765[_0xd847('0x18')]?_0x1ef765[_0xd847('0x18')][_0xd847('0x1b')]||null:null,'limit':_0x1ef765[_0xd847('0x18')]?_0x1ef765[_0xd847('0x18')][_0xd847('0x1c')]||null:null,'include':_0x1ef765[_0xd847('0x18')]?_0x1ef765[_0xd847('0x18')][_0xd847('0x1d')]?_[_0xd847('0x1e')](_0x1ef765[_0xd847('0x18')]['include'],function(_0x560563){return{'model':db[_0x560563[_0xd847('0x1f')]],'as':_0x560563['as'],'attributes':_0x560563[_0xd847('0x1b')],'include':_0x560563[_0xd847('0x1d')]?_['map'](_0x560563[_0xd847('0x1d')],function(_0x246920){return{'model':db[_0x246920[_0xd847('0x1f')]],'as':_0x246920['as'],'attributes':_0x246920[_0xd847('0x1b')],'include':_0x246920[_0xd847('0x1d')]?_[_0xd847('0x1e')](_0x246920[_0xd847('0x1d')],function(_0x460eba){return{'model':db[_0x460eba[_0xd847('0x1f')]],'as':_0x460eba['as'],'attributes':_0x460eba['attributes']};}):[]};}):[]};}):[]:[]})[_0xd847('0xb')](function(_0x1d03e2){logger[_0xd847('0x13')](_0xd847('0x20'),_0x1ef765);logger[_0xd847('0x21')](_0xd847('0x20'),_0x1ef765,JSON['stringify'](_0x1d03e2));_0x4b6264(_0x1d03e2);})[_0xd847('0x15')](function(_0x5375fe){logger['error']('GetCampaign',_0x5375fe[_0xd847('0x12')],_0x1ef765);_0x44a57b(_0x5eb665[_0xd847('0x10')](0x1f4,_0x5375fe[_0xd847('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e4882c3..f42a96f 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 _0x720e=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','clone','addBlackLists','put','destroy','delete','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x28dbc9,_0x1e8d74){var _0x208ead=function(_0x4c2ff4){while(--_0x4c2ff4){_0x28dbc9['push'](_0x28dbc9['shift']());}};_0x208ead(++_0x1e8d74);}(_0x720e,0x1b3));var _0xe720=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x720e[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0xe720('0x0'));var util=require(_0xe720('0x1'));var path=require(_0xe720('0x2'));var timeout=require(_0xe720('0x3'));var express=require(_0xe720('0x4'));var router=express[_0xe720('0x5')]();var fs_extra=require(_0xe720('0x6'));var auth=require(_0xe720('0x7'));var interaction=require(_0xe720('0x8'));var config=require(_0xe720('0x9'));var controller=require(_0xe720('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe720('0xb')](_0xe720('0xc'),auth['isAuthenticated'](),controller[_0xe720('0xd')]);router[_0xe720('0xb')](_0xe720('0xe'),auth[_0xe720('0xf')](),controller[_0xe720('0x10')]);router[_0xe720('0xb')](_0xe720('0x11'),auth[_0xe720('0xf')](),controller[_0xe720('0x12')]);router[_0xe720('0xb')](_0xe720('0x13'),auth['isAuthenticated'](),controller[_0xe720('0x14')]);router['get'](_0xe720('0x15'),auth['isAuthenticated'](),controller[_0xe720('0x16')]);router[_0xe720('0xb')](_0xe720('0x17'),auth['isAuthenticated'](),controller['getLists']);router[_0xe720('0xb')](_0xe720('0x18'),auth[_0xe720('0xf')](),controller[_0xe720('0x19')]);router[_0xe720('0x1a')]('/',auth[_0xe720('0xf')](),controller[_0xe720('0x1b')]);router[_0xe720('0x1a')]('/:id/clone',auth[_0xe720('0xf')](),controller[_0xe720('0x1c')]);router[_0xe720('0x1a')](_0xe720('0x17'),auth[_0xe720('0xf')](),controller['addLists']);router[_0xe720('0x1a')](_0xe720('0x18'),auth[_0xe720('0xf')](),controller[_0xe720('0x1d')]);router[_0xe720('0x1e')](_0xe720('0xc'),auth[_0xe720('0xf')](),controller['update']);router['delete'](_0xe720('0xc'),auth[_0xe720('0xf')](),controller[_0xe720('0x1f')]);router[_0xe720('0x20')](_0xe720('0x17'),auth[_0xe720('0xf')](),controller[_0xe720('0x21')]);router[_0xe720('0x20')](_0xe720('0x18'),auth[_0xe720('0xf')](),controller[_0xe720('0x22')]);module['exports']=router; \ No newline at end of file +var _0xf421=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','util','path'];(function(_0x317cb9,_0x3afb86){var _0x54121f=function(_0xbfdd8a){while(--_0xbfdd8a){_0x317cb9['push'](_0x317cb9['shift']());}};_0x54121f(++_0x3afb86);}(_0xf421,0x64));var _0x1f42=function(_0x32c48c,_0x5d669e){_0x32c48c=_0x32c48c-0x0;var _0x133729=_0xf421[_0x32c48c];return _0x133729;};'use strict';var multer=require('multer');var util=require(_0x1f42('0x0'));var path=require(_0x1f42('0x1'));var timeout=require(_0x1f42('0x2'));var express=require(_0x1f42('0x3'));var router=express[_0x1f42('0x4')]();var fs_extra=require(_0x1f42('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f42('0x6'));var config=require(_0x1f42('0x7'));var controller=require(_0x1f42('0x8'));router[_0x1f42('0x9')]('/',auth[_0x1f42('0xa')](),controller['index']);router['get'](_0x1f42('0xb'),auth[_0x1f42('0xa')](),controller[_0x1f42('0xc')]);router[_0x1f42('0x9')](_0x1f42('0xd'),auth[_0x1f42('0xa')](),controller[_0x1f42('0xe')]);router[_0x1f42('0x9')](_0x1f42('0xf'),auth['isAuthenticated'](),controller[_0x1f42('0x10')]);router[_0x1f42('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x1f42('0x11')]);router[_0x1f42('0x9')]('/:id/hopper_black',auth[_0x1f42('0xa')](),controller[_0x1f42('0x12')]);router[_0x1f42('0x9')](_0x1f42('0x13'),auth[_0x1f42('0xa')](),controller[_0x1f42('0x14')]);router[_0x1f42('0x9')](_0x1f42('0x15'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x1f42('0x16')]('/',auth[_0x1f42('0xa')](),controller[_0x1f42('0x17')]);router[_0x1f42('0x16')]('/:id/clone',auth[_0x1f42('0xa')](),controller[_0x1f42('0x18')]);router[_0x1f42('0x16')](_0x1f42('0x13'),auth[_0x1f42('0xa')](),controller[_0x1f42('0x19')]);router[_0x1f42('0x16')](_0x1f42('0x15'),auth['isAuthenticated'](),controller[_0x1f42('0x1a')]);router[_0x1f42('0x1b')]('/:id',auth[_0x1f42('0xa')](),controller[_0x1f42('0x1c')]);router[_0x1f42('0x1d')](_0x1f42('0xb'),auth[_0x1f42('0xa')](),controller[_0x1f42('0x1e')]);router[_0x1f42('0x1d')](_0x1f42('0x13'),auth[_0x1f42('0xa')](),controller[_0x1f42('0x1f')]);router[_0x1f42('0x1d')](_0x1f42('0x15'),auth['isAuthenticated'](),controller[_0x1f42('0x20')]);module[_0x1f42('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3b9f2eb..445cb15 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 _0xeda8=['TEXT','getDataValue'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0xeda8,0x1a4));var _0x8eda=function(_0x4f6237,_0x45d165){_0x4f6237=_0x4f6237-0x0;var _0x22992d=_0xeda8[_0x4f6237];return _0x22992d;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x8eda('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8eda('0x1')]('key');}}}; \ No newline at end of file +var _0xd457=['VIRTUAL','key','exports','STRING','TEXT'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xd457,0x197));var _0x7d45=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xd457[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require('sequelize');module[_0x7d45('0x0')]={'key':{'type':Sequelize[_0x7d45('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x7d45('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7d45('0x1')]},'name':{'type':Sequelize[_0x7d45('0x3')],'get':function(){return this['getDataValue'](_0x7d45('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index a0a994c..6c45633 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 _0x1fca=['options','CannedAnswer','include','findAll','rows','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','get','CannedAnswers','UserProfileResource','destroy','stack','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4bd0f2,_0x1d6f1d){var _0x3a7157=function(_0x42c594){while(--_0x42c594){_0x4bd0f2['push'](_0x4bd0f2['shift']());}};_0x3a7157(++_0x1d6f1d);}(_0x1fca,0xd2));var _0xa1fc=function(_0x10c830,_0x66eec2){_0x10c830=_0x10c830-0x0;var _0x1d2f38=_0x1fca[_0x10c830];return _0x1d2f38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1fc('0x0'));var zipdir=require(_0xa1fc('0x1'));var jsonpatch=require(_0xa1fc('0x2'));var rp=require(_0xa1fc('0x3'));var moment=require(_0xa1fc('0x4'));var BPromise=require(_0xa1fc('0x5'));var Mustache=require('mustache');var util=require(_0xa1fc('0x6'));var path=require(_0xa1fc('0x7'));var sox=require(_0xa1fc('0x8'));var csv=require('to-csv');var ejs=require(_0xa1fc('0x9'));var fs=require('fs');var fs_extra=require(_0xa1fc('0xa'));var _=require(_0xa1fc('0xb'));var squel=require('squel');var crypto=require(_0xa1fc('0xc'));var jsforce=require(_0xa1fc('0xd'));var deskjs=require(_0xa1fc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa1fc('0xf'));var Papa=require(_0xa1fc('0x10'));var Redis=require('ioredis');var authService=require(_0xa1fc('0x11'));var qs=require(_0xa1fc('0x12'));var as=require(_0xa1fc('0x13'));var hardwareService=require(_0xa1fc('0x14'));var logger=require(_0xa1fc('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa1fc('0x16'));var licenseUtil=require(_0xa1fc('0x17'));var db=require(_0xa1fc('0x18'))['db'];function respondWithStatusCode(_0x55a6bb,_0x1e2855){_0x1e2855=_0x1e2855||0xcc;return function(_0x4bfdf0){if(_0x4bfdf0){return _0x55a6bb[_0xa1fc('0x19')](_0x1e2855);}return _0x55a6bb[_0xa1fc('0x1a')](_0x1e2855)[_0xa1fc('0x1b')]();};}function respondWithResult(_0x2c1918,_0x13246e){_0x13246e=_0x13246e||0xc8;return function(_0x58af82){if(_0x58af82){return _0x2c1918[_0xa1fc('0x1a')](_0x13246e)['json'](_0x58af82);}};}function respondWithFilteredResult(_0xb10b84,_0x366873){return function(_0x3a5a07){if(_0x3a5a07){var _0x157b1d=typeof _0x366873[_0xa1fc('0x1c')]==='undefined'&&typeof _0x366873[_0xa1fc('0x1d')]===_0xa1fc('0x1e');var _0x8dbd77=_0x3a5a07[_0xa1fc('0x1f')];var _0xfc5099=_0x157b1d?0x0:_0x366873['offset'];var _0x16bc72=_0x157b1d?_0x3a5a07[_0xa1fc('0x1f')]:_0x366873['offset']+_0x366873[_0xa1fc('0x1d')];var _0x2cda9e;if(_0x16bc72>=_0x8dbd77){_0x16bc72=_0x8dbd77;_0x2cda9e=0xc8;}else{_0x2cda9e=0xce;}_0xb10b84[_0xa1fc('0x1a')](_0x2cda9e);return _0xb10b84[_0xa1fc('0x20')](_0xa1fc('0x21'),_0xfc5099+'-'+_0x16bc72+'/'+_0x8dbd77)[_0xa1fc('0x22')](_0x3a5a07);}return null;};}function patchUpdates(_0x27f9f9){return function(_0x2c6378){try{jsonpatch[_0xa1fc('0x23')](_0x2c6378,_0x27f9f9,!![]);}catch(_0x1ec9ff){return BPromise['reject'](_0x1ec9ff);}return _0x2c6378[_0xa1fc('0x24')]();};}function saveUpdates(_0x53f49b,_0x45c336){return function(_0x1feb71){if(_0x1feb71){return _0x1feb71[_0xa1fc('0x25')](_0x53f49b)[_0xa1fc('0x26')](function(_0x5e5c32){return _0x5e5c32;});}return null;};}function removeEntity(_0x437d33,_0x27a3fe){return function(_0x5dd1aa){if(_0x5dd1aa){return _0x5dd1aa['destroy']()[_0xa1fc('0x26')](function(){var _0x13f493=_0x5dd1aa[_0xa1fc('0x27')]({'plain':!![]});var _0x3c6dde=_0xa1fc('0x28');return db[_0xa1fc('0x29')][_0xa1fc('0x2a')]({'where':{'type':_0x3c6dde,'resourceId':_0x13f493['id']}})[_0xa1fc('0x26')](function(){return _0x5dd1aa;});})['then'](function(){_0x437d33[_0xa1fc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a22a,_0x2d06b9){return function(_0x4f2100){if(!_0x4f2100){_0x59a22a['sendStatus'](0x194);}return _0x4f2100;};}function handleError(_0x2106dd,_0x15f047){_0x15f047=_0x15f047||0x1f4;return function(_0x1c93dd){logger['error'](_0x1c93dd[_0xa1fc('0x2b')]);if(_0x1c93dd[_0xa1fc('0x2c')]){delete _0x1c93dd[_0xa1fc('0x2c')];}_0x2106dd[_0xa1fc('0x1a')](_0x15f047)[_0xa1fc('0x2d')](_0x1c93dd);};}exports['index']=function(_0x48eb96,_0x15d940){var _0x3af486={},_0x3c47ea={},_0x4cb40e={'count':0x0,'rows':[]};var _0x14f2f8=_[_0xa1fc('0x2e')](db['CannedAnswer'][_0xa1fc('0x2f')],function(_0x32f37c){return{'name':_0x32f37c['fieldName'],'type':_0x32f37c[_0xa1fc('0x30')][_0xa1fc('0x31')]};});_0x3c47ea['model']=_[_0xa1fc('0x2e')](_0x14f2f8,_0xa1fc('0x2c'));_0x3c47ea[_0xa1fc('0x32')]=_[_0xa1fc('0x33')](_0x48eb96['query']);_0x3c47ea[_0xa1fc('0x34')]=_[_0xa1fc('0x35')](_0x3c47ea['model'],_0x3c47ea[_0xa1fc('0x32')]);_0x3af486['attributes']=_[_0xa1fc('0x35')](_0x3c47ea[_0xa1fc('0x36')],qs['fields'](_0x48eb96['query'][_0xa1fc('0x37')]));_0x3af486[_0xa1fc('0x38')]=_0x3af486[_0xa1fc('0x38')][_0xa1fc('0x39')]?_0x3af486['attributes']:_0x3c47ea[_0xa1fc('0x36')];if(!_0x48eb96['query'][_0xa1fc('0x3a')](_0xa1fc('0x3b'))){_0x3af486[_0xa1fc('0x1d')]=qs['limit'](_0x48eb96['query'][_0xa1fc('0x1d')]);_0x3af486['offset']=qs['offset'](_0x48eb96[_0xa1fc('0x32')][_0xa1fc('0x1c')]);}_0x3af486[_0xa1fc('0x3c')]=qs['sort'](_0x48eb96[_0xa1fc('0x32')][_0xa1fc('0x3d')]);_0x3af486[_0xa1fc('0x3e')]=qs[_0xa1fc('0x34')](_[_0xa1fc('0x3f')](_0x48eb96[_0xa1fc('0x32')],_0x3c47ea['filters']),_0x14f2f8);if(_0x48eb96[_0xa1fc('0x32')][_0xa1fc('0x40')]){_0x3af486[_0xa1fc('0x3e')]=_['merge'](_0x3af486[_0xa1fc('0x3e')],{'$or':[{'key':{'$like':'%'+_0x48eb96[_0xa1fc('0x32')][_0xa1fc('0x40')]+'%'}},{'value':{'$like':'%'+_0x48eb96[_0xa1fc('0x32')][_0xa1fc('0x40')]+'%'}}]});}_0x3af486=_[_0xa1fc('0x41')]({},_0x3af486,_0x48eb96[_0xa1fc('0x42')]);var _0x2e791c={'where':_0x3af486[_0xa1fc('0x3e')]};return db[_0xa1fc('0x43')]['count'](_0x2e791c)[_0xa1fc('0x26')](function(_0x1c2ee2){_0x4cb40e[_0xa1fc('0x1f')]=_0x1c2ee2;if(_0x48eb96['query']['includeAll']){_0x3af486[_0xa1fc('0x44')]=[{'all':!![]}];}return db[_0xa1fc('0x43')][_0xa1fc('0x45')](_0x3af486);})[_0xa1fc('0x26')](function(_0x41a106){_0x4cb40e[_0xa1fc('0x46')]=_0x41a106;return _0x4cb40e;})[_0xa1fc('0x26')](respondWithFilteredResult(_0x15d940,_0x3af486))[_0xa1fc('0x47')](handleError(_0x15d940,null));};exports[_0xa1fc('0x48')]=function(_0x4fdbf9,_0x438d13){var _0x42fb85={'raw':!![],'where':{'id':_0x4fdbf9[_0xa1fc('0x49')]['id']}},_0x23596b={};_0x23596b[_0xa1fc('0x36')]=_[_0xa1fc('0x33')](db[_0xa1fc('0x43')]['rawAttributes']);_0x23596b[_0xa1fc('0x32')]=_[_0xa1fc('0x33')](_0x4fdbf9[_0xa1fc('0x32')]);_0x23596b[_0xa1fc('0x34')]=_[_0xa1fc('0x35')](_0x23596b['model'],_0x23596b[_0xa1fc('0x32')]);_0x42fb85[_0xa1fc('0x38')]=_['intersection'](_0x23596b[_0xa1fc('0x36')],qs['fields'](_0x4fdbf9[_0xa1fc('0x32')][_0xa1fc('0x37')]));_0x42fb85[_0xa1fc('0x38')]=_0x42fb85[_0xa1fc('0x38')][_0xa1fc('0x39')]?_0x42fb85[_0xa1fc('0x38')]:_0x23596b[_0xa1fc('0x36')];if(_0x4fdbf9[_0xa1fc('0x32')]['includeAll']){_0x42fb85[_0xa1fc('0x44')]=[{'all':!![]}];}_0x42fb85=_[_0xa1fc('0x41')]({},_0x42fb85,_0x4fdbf9['options']);return db[_0xa1fc('0x43')][_0xa1fc('0x4a')](_0x42fb85)['then'](handleEntityNotFound(_0x438d13,null))[_0xa1fc('0x26')](respondWithResult(_0x438d13,null))[_0xa1fc('0x47')](handleError(_0x438d13,null));};exports['update']=function(_0x51d56c,_0x3c4ec9){if(_0x51d56c[_0xa1fc('0x4b')]['id']){delete _0x51d56c[_0xa1fc('0x4b')]['id'];}return db[_0xa1fc('0x43')][_0xa1fc('0x4a')]({'where':{'id':_0x51d56c[_0xa1fc('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c4ec9,null))['then'](saveUpdates(_0x51d56c[_0xa1fc('0x4b')],null))[_0xa1fc('0x26')](respondWithResult(_0x3c4ec9,null))[_0xa1fc('0x47')](handleError(_0x3c4ec9,null));};exports['destroy']=function(_0x55c101,_0x1fd93e){return db[_0xa1fc('0x43')]['find']({'where':{'id':_0x55c101[_0xa1fc('0x49')]['id']}})[_0xa1fc('0x26')](handleEntityNotFound(_0x1fd93e,null))[_0xa1fc('0x26')](removeEntity(_0x1fd93e,null))[_0xa1fc('0x47')](handleError(_0x1fd93e,null));};exports[_0xa1fc('0x4c')]=function(_0x3bcf2c,_0x24a9f4){var _0x4fcbae={'key':_0x3bcf2c[_0xa1fc('0x4b')][_0xa1fc('0x31')]};if(_0x3bcf2c[_0xa1fc('0x4b')][_0xa1fc('0x4d')]){_0x4fcbae[_0xa1fc('0x4d')]=_0x3bcf2c[_0xa1fc('0x4b')][_0xa1fc('0x4d')];}else if(_0x3bcf2c[_0xa1fc('0x4b')][_0xa1fc('0x4e')]){_0x4fcbae[_0xa1fc('0x4e')]=_0x3bcf2c['body'][_0xa1fc('0x4e')];}else if(_0x3bcf2c[_0xa1fc('0x4b')][_0xa1fc('0x4f')]){_0x4fcbae[_0xa1fc('0x4f')]=_0x3bcf2c[_0xa1fc('0x4b')][_0xa1fc('0x4f')];}else if(_0x3bcf2c[_0xa1fc('0x4b')][_0xa1fc('0x50')]){_0x4fcbae[_0xa1fc('0x50')]=_0x3bcf2c[_0xa1fc('0x4b')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x4fcbae})['then'](function(_0x594efe){if(_0x594efe){throw new db[(_0xa1fc('0x51'))][(_0xa1fc('0x52'))](_0xa1fc('0x53'));}return db[_0xa1fc('0x43')][_0xa1fc('0x4c')](_0x3bcf2c[_0xa1fc('0x4b')]);})[_0xa1fc('0x26')](function(_0x482039){var _0x190280=_0x3bcf2c[_0xa1fc('0x54')][_0xa1fc('0x27')]({'plain':!![]});if(!_0x190280)throw new Error(_0xa1fc('0x55'));if(_0x190280[_0xa1fc('0x56')]==='user'){var _0x673d1b=_0x482039[_0xa1fc('0x27')]({'plain':!![]});return db[_0xa1fc('0x57')][_0xa1fc('0x4a')]({'where':{'name':'CannedAnswers','userProfileId':_0x190280[_0xa1fc('0x58')]},'raw':!![]})[_0xa1fc('0x26')](function(_0x1ae031){if(_0x1ae031&&_0x1ae031[_0xa1fc('0x59')]===0x0){return db['UserProfileResource'][_0xa1fc('0x4c')]({'name':_0x673d1b[_0xa1fc('0x2c')],'resourceId':_0x673d1b['id'],'type':_0x1ae031['name'],'sectionId':_0x1ae031['id']},{})[_0xa1fc('0x26')](function(){return _0x482039;});}else{return _0x482039;}})[_0xa1fc('0x47')](function(_0x56d050){logger[_0xa1fc('0x5a')](_0xa1fc('0x5b'),_0x56d050);throw _0x56d050;});}return _0x482039;})[_0xa1fc('0x26')](respondWithResult(_0x24a9f4,0xc9))[_0xa1fc('0x47')](handleError(_0x24a9f4,null));}; \ No newline at end of file +var _0x45d5=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','CannedAnswers','UserProfileResource','then','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','options','includeAll','include','rows','catch','body','find','params','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x45d5,0xa4));var _0x545d=function(_0x597afe,_0x6748ca){_0x597afe=_0x597afe-0x0;var _0x4e3adc=_0x45d5[_0x597afe];return _0x4e3adc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x545d('0x0'));var zipdir=require(_0x545d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x545d('0x2'));var moment=require('moment');var BPromise=require(_0x545d('0x3'));var Mustache=require(_0x545d('0x4'));var util=require(_0x545d('0x5'));var path=require(_0x545d('0x6'));var sox=require(_0x545d('0x7'));var csv=require(_0x545d('0x8'));var ejs=require(_0x545d('0x9'));var fs=require('fs');var fs_extra=require(_0x545d('0xa'));var _=require(_0x545d('0xb'));var squel=require('squel');var crypto=require(_0x545d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x545d('0xd'));var toCsv=require(_0x545d('0x8'));var querystring=require(_0x545d('0xe'));var Papa=require(_0x545d('0xf'));var Redis=require(_0x545d('0x10'));var authService=require(_0x545d('0x11'));var qs=require(_0x545d('0x12'));var as=require(_0x545d('0x13'));var hardwareService=require(_0x545d('0x14'));var logger=require(_0x545d('0x15'))(_0x545d('0x16'));var utils=require('../../config/utils');var config=require(_0x545d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43834f,_0x522b8e){_0x522b8e=_0x522b8e||0xcc;return function(_0x2ae645){if(_0x2ae645){return _0x43834f[_0x545d('0x18')](_0x522b8e);}return _0x43834f['status'](_0x522b8e)[_0x545d('0x19')]();};}function respondWithResult(_0x228311,_0x508b79){_0x508b79=_0x508b79||0xc8;return function(_0x59c9f2){if(_0x59c9f2){return _0x228311[_0x545d('0x1a')](_0x508b79)['json'](_0x59c9f2);}};}function respondWithFilteredResult(_0x54fddf,_0x410b64){return function(_0x45a024){if(_0x45a024){var _0x3012a3=typeof _0x410b64[_0x545d('0x1b')]===_0x545d('0x1c')&&typeof _0x410b64[_0x545d('0x1d')]===_0x545d('0x1c');var _0x3cc31f=_0x45a024[_0x545d('0x1e')];var _0x5814d6=_0x3012a3?0x0:_0x410b64[_0x545d('0x1b')];var _0x4e602f=_0x3012a3?_0x45a024[_0x545d('0x1e')]:_0x410b64[_0x545d('0x1b')]+_0x410b64['limit'];var _0x14e662;if(_0x4e602f>=_0x3cc31f){_0x4e602f=_0x3cc31f;_0x14e662=0xc8;}else{_0x14e662=0xce;}_0x54fddf[_0x545d('0x1a')](_0x14e662);return _0x54fddf[_0x545d('0x1f')](_0x545d('0x20'),_0x5814d6+'-'+_0x4e602f+'/'+_0x3cc31f)[_0x545d('0x21')](_0x45a024);}return null;};}function patchUpdates(_0x687cf){return function(_0x4d895e){try{jsonpatch[_0x545d('0x22')](_0x4d895e,_0x687cf,!![]);}catch(_0x49bac5){return BPromise[_0x545d('0x23')](_0x49bac5);}return _0x4d895e[_0x545d('0x24')]();};}function saveUpdates(_0x38e09e,_0x396bb3){return function(_0xb1f623){if(_0xb1f623){return _0xb1f623[_0x545d('0x25')](_0x38e09e)['then'](function(_0x285e10){return _0x285e10;});}return null;};}function removeEntity(_0x52657a,_0x50bfd0){return function(_0xe2afdf){if(_0xe2afdf){return _0xe2afdf[_0x545d('0x26')]()['then'](function(){var _0x5d44e3=_0xe2afdf[_0x545d('0x27')]({'plain':!![]});var _0x5f22ed=_0x545d('0x28');return db[_0x545d('0x29')][_0x545d('0x26')]({'where':{'type':_0x5f22ed,'resourceId':_0x5d44e3['id']}})[_0x545d('0x2a')](function(){return _0xe2afdf;});})[_0x545d('0x2a')](function(){_0x52657a[_0x545d('0x1a')](0xcc)[_0x545d('0x19')]();});}};}function handleEntityNotFound(_0x1311e4,_0x47fe21){return function(_0x1af7cc){if(!_0x1af7cc){_0x1311e4[_0x545d('0x18')](0x194);}return _0x1af7cc;};}function handleError(_0x460237,_0x46fe77){_0x46fe77=_0x46fe77||0x1f4;return function(_0x35bdcf){logger[_0x545d('0x2b')](_0x35bdcf[_0x545d('0x2c')]);if(_0x35bdcf[_0x545d('0x2d')]){delete _0x35bdcf[_0x545d('0x2d')];}_0x460237[_0x545d('0x1a')](_0x46fe77)['send'](_0x35bdcf);};}exports['index']=function(_0x2a0525,_0x43aeab){var _0x46442a={},_0x256b1b={},_0x166ba5={'count':0x0,'rows':[]};var _0x122713=_[_0x545d('0x2e')](db[_0x545d('0x2f')][_0x545d('0x30')],function(_0x9b2511){return{'name':_0x9b2511[_0x545d('0x31')],'type':_0x9b2511[_0x545d('0x32')]['key']};});_0x256b1b[_0x545d('0x33')]=_[_0x545d('0x2e')](_0x122713,_0x545d('0x2d'));_0x256b1b[_0x545d('0x34')]=_[_0x545d('0x35')](_0x2a0525['query']);_0x256b1b[_0x545d('0x36')]=_[_0x545d('0x37')](_0x256b1b[_0x545d('0x33')],_0x256b1b[_0x545d('0x34')]);_0x46442a[_0x545d('0x38')]=_[_0x545d('0x37')](_0x256b1b[_0x545d('0x33')],qs[_0x545d('0x39')](_0x2a0525[_0x545d('0x34')]['fields']));_0x46442a[_0x545d('0x38')]=_0x46442a[_0x545d('0x38')][_0x545d('0x3a')]?_0x46442a[_0x545d('0x38')]:_0x256b1b[_0x545d('0x33')];if(!_0x2a0525[_0x545d('0x34')]['hasOwnProperty'](_0x545d('0x3b'))){_0x46442a[_0x545d('0x1d')]=qs['limit'](_0x2a0525[_0x545d('0x34')][_0x545d('0x1d')]);_0x46442a[_0x545d('0x1b')]=qs[_0x545d('0x1b')](_0x2a0525['query'][_0x545d('0x1b')]);}_0x46442a[_0x545d('0x3c')]=qs[_0x545d('0x3d')](_0x2a0525['query']['sort']);_0x46442a['where']=qs[_0x545d('0x36')](_[_0x545d('0x3e')](_0x2a0525[_0x545d('0x34')],_0x256b1b['filters']),_0x122713);if(_0x2a0525[_0x545d('0x34')]['filter']){_0x46442a[_0x545d('0x3f')]=_[_0x545d('0x40')](_0x46442a[_0x545d('0x3f')],{'$or':[{'key':{'$like':'%'+_0x2a0525[_0x545d('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x2a0525[_0x545d('0x34')]['filter']+'%'}}]});}_0x46442a=_[_0x545d('0x40')]({},_0x46442a,_0x2a0525[_0x545d('0x41')]);var _0x16476f={'where':_0x46442a[_0x545d('0x3f')]};return db[_0x545d('0x2f')][_0x545d('0x1e')](_0x16476f)[_0x545d('0x2a')](function(_0x2fa4e2){_0x166ba5[_0x545d('0x1e')]=_0x2fa4e2;if(_0x2a0525[_0x545d('0x34')][_0x545d('0x42')]){_0x46442a[_0x545d('0x43')]=[{'all':!![]}];}return db[_0x545d('0x2f')]['findAll'](_0x46442a);})[_0x545d('0x2a')](function(_0x55f216){_0x166ba5[_0x545d('0x44')]=_0x55f216;return _0x166ba5;})[_0x545d('0x2a')](respondWithFilteredResult(_0x43aeab,_0x46442a))[_0x545d('0x45')](handleError(_0x43aeab,null));};exports['show']=function(_0x146eb4,_0xc7f4df){var _0x10f64b={'raw':!![],'where':{'id':_0x146eb4['params']['id']}},_0x490091={};_0x490091[_0x545d('0x33')]=_[_0x545d('0x35')](db[_0x545d('0x2f')]['rawAttributes']);_0x490091[_0x545d('0x34')]=_['keys'](_0x146eb4[_0x545d('0x34')]);_0x490091[_0x545d('0x36')]=_['intersection'](_0x490091[_0x545d('0x33')],_0x490091[_0x545d('0x34')]);_0x10f64b[_0x545d('0x38')]=_[_0x545d('0x37')](_0x490091[_0x545d('0x33')],qs[_0x545d('0x39')](_0x146eb4['query']['fields']));_0x10f64b[_0x545d('0x38')]=_0x10f64b[_0x545d('0x38')][_0x545d('0x3a')]?_0x10f64b['attributes']:_0x490091[_0x545d('0x33')];if(_0x146eb4[_0x545d('0x34')][_0x545d('0x42')]){_0x10f64b[_0x545d('0x43')]=[{'all':!![]}];}_0x10f64b=_[_0x545d('0x40')]({},_0x10f64b,_0x146eb4[_0x545d('0x41')]);return db[_0x545d('0x2f')]['find'](_0x10f64b)[_0x545d('0x2a')](handleEntityNotFound(_0xc7f4df,null))[_0x545d('0x2a')](respondWithResult(_0xc7f4df,null))['catch'](handleError(_0xc7f4df,null));};exports[_0x545d('0x25')]=function(_0x80b016,_0x130be0){if(_0x80b016[_0x545d('0x46')]['id']){delete _0x80b016[_0x545d('0x46')]['id'];}return db[_0x545d('0x2f')][_0x545d('0x47')]({'where':{'id':_0x80b016[_0x545d('0x48')]['id']}})[_0x545d('0x2a')](handleEntityNotFound(_0x130be0,null))[_0x545d('0x2a')](saveUpdates(_0x80b016['body'],null))[_0x545d('0x2a')](respondWithResult(_0x130be0,null))['catch'](handleError(_0x130be0,null));};exports['destroy']=function(_0x424a83,_0x548bab){return db[_0x545d('0x2f')][_0x545d('0x47')]({'where':{'id':_0x424a83[_0x545d('0x48')]['id']}})['then'](handleEntityNotFound(_0x548bab,null))[_0x545d('0x2a')](removeEntity(_0x548bab,null))[_0x545d('0x45')](handleError(_0x548bab,null));};exports['create']=function(_0x55d7a2,_0x580aaa){var _0x291d5f={'key':_0x55d7a2[_0x545d('0x46')][_0x545d('0x49')]};if(_0x55d7a2[_0x545d('0x46')][_0x545d('0x4a')]){_0x291d5f[_0x545d('0x4a')]=_0x55d7a2[_0x545d('0x46')][_0x545d('0x4a')];}else if(_0x55d7a2['body'][_0x545d('0x4b')]){_0x291d5f[_0x545d('0x4b')]=_0x55d7a2[_0x545d('0x46')]['SmsAccountId'];}else if(_0x55d7a2[_0x545d('0x46')]['OpenchannelAccountId']){_0x291d5f[_0x545d('0x4c')]=_0x55d7a2['body']['OpenchannelAccountId'];}else if(_0x55d7a2['body'][_0x545d('0x4d')]){_0x291d5f['ChatWebsiteId']=_0x55d7a2[_0x545d('0x46')][_0x545d('0x4d')];}return db[_0x545d('0x2f')][_0x545d('0x47')]({'where':_0x291d5f})['then'](function(_0x3d7d58){if(_0x3d7d58){throw new db[(_0x545d('0x4e'))][(_0x545d('0x4f'))](_0x545d('0x50'));}return db[_0x545d('0x2f')][_0x545d('0x51')](_0x55d7a2['body']);})[_0x545d('0x2a')](function(_0x593d56){var _0x1fedd4=_0x55d7a2['user'][_0x545d('0x27')]({'plain':!![]});if(!_0x1fedd4)throw new Error(_0x545d('0x52'));if(_0x1fedd4[_0x545d('0x53')]===_0x545d('0x54')){var _0x52778e=_0x593d56[_0x545d('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x545d('0x47')]({'where':{'name':_0x545d('0x28'),'userProfileId':_0x1fedd4[_0x545d('0x55')]},'raw':!![]})[_0x545d('0x2a')](function(_0x210073){if(_0x210073&&_0x210073[_0x545d('0x56')]===0x0){return db[_0x545d('0x29')][_0x545d('0x51')]({'name':_0x52778e['name'],'resourceId':_0x52778e['id'],'type':_0x210073[_0x545d('0x2d')],'sectionId':_0x210073['id']},{})['then'](function(){return _0x593d56;});}else{return _0x593d56;}})['catch'](function(_0x135828){logger[_0x545d('0x2b')](_0x545d('0x57'),_0x135828);throw _0x135828;});}return _0x593d56;})[_0x545d('0x2a')](respondWithResult(_0x580aaa,0xc9))[_0x545d('0x45')](handleError(_0x580aaa,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index bb95901..ce6d5ca 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 _0x3d6d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CannedAnswer','tools_canned_answers','util'];(function(_0x47da3c,_0x1ab06d){var _0x1d0942=function(_0x346ab5){while(--_0x346ab5){_0x47da3c['push'](_0x47da3c['shift']());}};_0x1d0942(++_0x1ab06d);}(_0x3d6d,0x1af));var _0xd3d6=function(_0xf65bf8,_0x494a66){_0xf65bf8=_0xf65bf8-0x0;var _0x2e4a66=_0x3d6d[_0xf65bf8];return _0x2e4a66;};'use strict';var _=require('lodash');var util=require(_0xd3d6('0x0'));var logger=require(_0xd3d6('0x1'))(_0xd3d6('0x2'));var moment=require(_0xd3d6('0x3'));var BPromise=require(_0xd3d6('0x4'));var rp=require(_0xd3d6('0x5'));var fs=require('fs');var path=require(_0xd3d6('0x6'));var rimraf=require(_0xd3d6('0x7'));var config=require(_0xd3d6('0x8'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x5ddced,_0xb6aa2b){return _0x5ddced[_0xd3d6('0x9')](_0xd3d6('0xa'),attributes,{'tableName':_0xd3d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcf76=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x481724,_0x598eb6){var _0x5ef8d6=function(_0x2ff593){while(--_0x2ff593){_0x481724['push'](_0x481724['shift']());}};_0x5ef8d6(++_0x598eb6);}(_0xcf76,0x10d));var _0x6cf7=function(_0x3dd345,_0x273fbb){_0x3dd345=_0x3dd345-0x0;var _0x15e015=_0xcf76[_0x3dd345];return _0x15e015;};'use strict';var _=require(_0x6cf7('0x0'));var util=require('util');var logger=require(_0x6cf7('0x1'))(_0x6cf7('0x2'));var moment=require(_0x6cf7('0x3'));var BPromise=require(_0x6cf7('0x4'));var rp=require(_0x6cf7('0x5'));var fs=require('fs');var path=require(_0x6cf7('0x6'));var rimraf=require(_0x6cf7('0x7'));var config=require(_0x6cf7('0x8'));var attributes=require(_0x6cf7('0x9'));module[_0x6cf7('0xa')]=function(_0x58b692,_0x1ffe30){return _0x58b692[_0x6cf7('0xb')](_0x6cf7('0xc'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6cf7('0xd'),'collate':_0x6cf7('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 7cc4273..5f7bfa4 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(_0x2313bc,_0x5188a3){var _0x328078=function(_0x571841){while(--_0x571841){_0x2313bc['push'](_0x2313bc['shift']());}};_0x328078(++_0x5188a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x3fd55c,_0x4de0f6){var _0x1fd315=function(_0x487c11){while(--_0x487c11){_0x3fd55c['push'](_0x3fd55c['shift']());}};_0x1fd315(++_0x4de0f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 0d75788..da1a6bb 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 _0xef9a=['get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xef9a,0x14e));var _0xaef9=function(_0x3feda8,_0x461b26){_0x3feda8=_0x3feda8-0x0;var _0x8f8a62=_0xef9a[_0x3feda8];return _0x8f8a62;};'use strict';var multer=require(_0xaef9('0x0'));var util=require(_0xaef9('0x1'));var path=require(_0xaef9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaef9('0x3')]();var fs_extra=require(_0xaef9('0x4'));var auth=require(_0xaef9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaef9('0x6'));var controller=require(_0xaef9('0x7'));router[_0xaef9('0x8')]('/',auth[_0xaef9('0x9')](),controller[_0xaef9('0xa')]);router['get'](_0xaef9('0xb'),auth[_0xaef9('0x9')](),controller[_0xaef9('0xc')]);router['post']('/',auth[_0xaef9('0x9')](),controller[_0xaef9('0xd')]);router['put'](_0xaef9('0xb'),auth[_0xaef9('0x9')](),controller[_0xaef9('0xe')]);router[_0xaef9('0xf')]('/:id',auth[_0xaef9('0x9')](),controller[_0xaef9('0x10')]);module[_0xaef9('0x11')]=router; \ No newline at end of file +var _0x29dd=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x29dd,0x7f));var _0xd29d=function(_0x3f6849,_0x43437d){_0x3f6849=_0x3f6849-0x0;var _0x24b0ec=_0x29dd[_0x3f6849];return _0x24b0ec;};'use strict';var multer=require(_0xd29d('0x0'));var util=require(_0xd29d('0x1'));var path=require(_0xd29d('0x2'));var timeout=require('connect-timeout');var express=require(_0xd29d('0x3'));var router=express['Router']();var fs_extra=require(_0xd29d('0x4'));var auth=require(_0xd29d('0x5'));var interaction=require(_0xd29d('0x6'));var config=require(_0xd29d('0x7'));var controller=require(_0xd29d('0x8'));router['get']('/',auth[_0xd29d('0x9')](),controller['index']);router[_0xd29d('0xa')]('/:id',auth[_0xd29d('0x9')](),controller[_0xd29d('0xb')]);router[_0xd29d('0xc')]('/',auth[_0xd29d('0x9')](),controller[_0xd29d('0xd')]);router[_0xd29d('0xe')](_0xd29d('0xf'),auth[_0xd29d('0x9')](),controller[_0xd29d('0x10')]);router[_0xd29d('0x11')]('/:id',auth[_0xd29d('0x9')](),controller[_0xd29d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 5f3cce6..8664d70 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 _0x4345=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x55ecba,_0x3a94e1){var _0xfb6474=function(_0x5a690b){while(--_0x5a690b){_0x55ecba['push'](_0x55ecba['shift']());}};_0xfb6474(++_0x3a94e1);}(_0x4345,0x77));var _0x5434=function(_0xc98cce,_0x3bdb9f){_0xc98cce=_0xc98cce-0x0;var _0xeb1a1e=_0x4345[_0xc98cce];return _0xeb1a1e;};'use strict';var Sequelize=require(_0x5434('0x0'));module[_0x5434('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x5434('0x2')},'clid':{'type':Sequelize[_0x5434('0x3')]},'src':{'type':Sequelize[_0x5434('0x3')]},'dst':{'type':Sequelize[_0x5434('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5434('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x5434('0x3')]},'lastdata':{'type':Sequelize[_0x5434('0x3')]},'duration':{'type':Sequelize[_0x5434('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5434('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5434('0x3')]},'userfield':{'type':Sequelize[_0x5434('0x3')]},'uniqueid':{'type':Sequelize[_0x5434('0x3')]},'linkedid':{'type':Sequelize[_0x5434('0x3')]},'sequence':{'type':Sequelize[_0x5434('0x3')]},'peeraccount':{'type':Sequelize[_0x5434('0x3')]},'type':{'type':Sequelize[_0x5434('0x3')]},'tag':{'type':Sequelize[_0x5434('0x3')]}}; \ No newline at end of file +var _0xb5f8=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x4d4fc3,_0x4fc2ac){var _0x3330a8=function(_0x392ce4){while(--_0x392ce4){_0x4d4fc3['push'](_0x4d4fc3['shift']());}};_0x3330a8(++_0x4fc2ac);}(_0xb5f8,0x88));var _0x8b5f=function(_0xcc4c73,_0x400e8c){_0xcc4c73=_0xcc4c73-0x0;var _0x24f7df=_0xb5f8[_0xcc4c73];return _0x24f7df;};'use strict';var Sequelize=require(_0x8b5f('0x0'));module[_0x8b5f('0x1')]={'calldate':{'type':Sequelize[_0x8b5f('0x2')],'allowNull':![],'defaultValue':_0x8b5f('0x3')},'clid':{'type':Sequelize[_0x8b5f('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8b5f('0x4')]},'dcontext':{'type':Sequelize[_0x8b5f('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x8b5f('0x4')]},'lastapp':{'type':Sequelize[_0x8b5f('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x8b5f('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8b5f('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8b5f('0x4')]},'userfield':{'type':Sequelize[_0x8b5f('0x4')]},'uniqueid':{'type':Sequelize[_0x8b5f('0x4')]},'linkedid':{'type':Sequelize[_0x8b5f('0x4')]},'sequence':{'type':Sequelize[_0x8b5f('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8b5f('0x4')]},'tag':{'type':Sequelize[_0x8b5f('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 87f4020..9fdf9d2 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 _0x3831=['error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','count','include','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3831,0x14c));var _0x1383=function(_0x2d33c7,_0x20e736){_0x2d33c7=_0x2d33c7-0x0;var _0x3f5a29=_0x3831[_0x2d33c7];return _0x3f5a29;};'use strict';var emlformat=require(_0x1383('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1383('0x1'));var jsonpatch=require(_0x1383('0x2'));var rp=require(_0x1383('0x3'));var moment=require(_0x1383('0x4'));var BPromise=require(_0x1383('0x5'));var Mustache=require('mustache');var util=require(_0x1383('0x6'));var path=require('path');var sox=require(_0x1383('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1383('0x8'));var squel=require('squel');var crypto=require(_0x1383('0x9'));var jsforce=require(_0x1383('0xa'));var deskjs=require(_0x1383('0xb'));var toCsv=require(_0x1383('0xc'));var querystring=require(_0x1383('0xd'));var Papa=require(_0x1383('0xe'));var Redis=require(_0x1383('0xf'));var authService=require(_0x1383('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1383('0x11'));var hardwareService=require(_0x1383('0x12'));var logger=require(_0x1383('0x13'))(_0x1383('0x14'));var utils=require(_0x1383('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1383('0x16'));var db=require(_0x1383('0x17'))['db'];function respondWithStatusCode(_0x1d35fc,_0x48c107){_0x48c107=_0x48c107||0xcc;return function(_0x5e7f63){if(_0x5e7f63){return _0x1d35fc[_0x1383('0x18')](_0x48c107);}return _0x1d35fc[_0x1383('0x19')](_0x48c107)[_0x1383('0x1a')]();};}function respondWithResult(_0x1ba3d1,_0x1e02d7){_0x1e02d7=_0x1e02d7||0xc8;return function(_0x2c8931){if(_0x2c8931){return _0x1ba3d1[_0x1383('0x19')](_0x1e02d7)[_0x1383('0x1b')](_0x2c8931);}};}function respondWithFilteredResult(_0x5e9ed9,_0x7a50d0){return function(_0x1f46de){if(_0x1f46de){var _0x41d895=typeof _0x7a50d0[_0x1383('0x1c')]===_0x1383('0x1d')&&typeof _0x7a50d0[_0x1383('0x1e')]===_0x1383('0x1d');var _0x5ca7fc=_0x1f46de['count'];var _0x2301a6=_0x41d895?0x0:_0x7a50d0['offset'];var _0x236b29=_0x41d895?_0x1f46de['count']:_0x7a50d0['offset']+_0x7a50d0['limit'];var _0x1c8fe7;if(_0x236b29>=_0x5ca7fc){_0x236b29=_0x5ca7fc;_0x1c8fe7=0xc8;}else{_0x1c8fe7=0xce;}_0x5e9ed9['status'](_0x1c8fe7);return _0x5e9ed9[_0x1383('0x1f')]('Content-Range',_0x2301a6+'-'+_0x236b29+'/'+_0x5ca7fc)[_0x1383('0x1b')](_0x1f46de);}return null;};}function patchUpdates(_0x1e6d5e){return function(_0xca314){try{jsonpatch[_0x1383('0x20')](_0xca314,_0x1e6d5e,!![]);}catch(_0x32fb05){return BPromise[_0x1383('0x21')](_0x32fb05);}return _0xca314[_0x1383('0x22')]();};}function saveUpdates(_0x10ed33,_0x2afbd2){return function(_0x505093){if(_0x505093){return _0x505093[_0x1383('0x23')](_0x10ed33)[_0x1383('0x24')](function(_0x39fea2){return _0x39fea2;});}return null;};}function removeEntity(_0x241c3d,_0x186524){return function(_0x2a9502){if(_0x2a9502){return _0x2a9502[_0x1383('0x25')]()['then'](function(){_0x241c3d['status'](0xcc)[_0x1383('0x1a')]();});}};}function handleEntityNotFound(_0x160497,_0x38b48a){return function(_0x3b158d){if(!_0x3b158d){_0x160497[_0x1383('0x18')](0x194);}return _0x3b158d;};}function handleError(_0x4aaee1,_0x5391e0){_0x5391e0=_0x5391e0||0x1f4;return function(_0x4a8b6e){logger[_0x1383('0x26')](_0x4a8b6e[_0x1383('0x27')]);if(_0x4a8b6e[_0x1383('0x28')]){delete _0x4a8b6e[_0x1383('0x28')];}_0x4aaee1['status'](_0x5391e0)[_0x1383('0x29')](_0x4a8b6e);};}exports['index']=function(_0x3c788b,_0xf0037f){var _0x42d63f={},_0x23e541={},_0x3357e9={'count':0x0,'rows':[]};var _0x15a3c4=_[_0x1383('0x2a')](db[_0x1383('0x2b')][_0x1383('0x2c')],function(_0x29ca05){return{'name':_0x29ca05[_0x1383('0x2d')],'type':_0x29ca05[_0x1383('0x2e')][_0x1383('0x2f')]};});_0x23e541[_0x1383('0x30')]=_['map'](_0x15a3c4,_0x1383('0x28'));_0x23e541[_0x1383('0x31')]=_[_0x1383('0x32')](_0x3c788b[_0x1383('0x31')]);_0x23e541[_0x1383('0x33')]=_[_0x1383('0x34')](_0x23e541['model'],_0x23e541[_0x1383('0x31')]);_0x42d63f[_0x1383('0x35')]=_[_0x1383('0x34')](_0x23e541[_0x1383('0x30')],qs[_0x1383('0x36')](_0x3c788b[_0x1383('0x31')]['fields']));_0x42d63f[_0x1383('0x35')]=_0x42d63f['attributes']['length']?_0x42d63f[_0x1383('0x35')]:_0x23e541[_0x1383('0x30')];if(!_0x3c788b[_0x1383('0x31')]['hasOwnProperty']('nolimit')){_0x42d63f['limit']=qs[_0x1383('0x1e')](_0x3c788b[_0x1383('0x31')][_0x1383('0x1e')]);_0x42d63f['offset']=qs['offset'](_0x3c788b[_0x1383('0x31')][_0x1383('0x1c')]);}_0x42d63f[_0x1383('0x37')]=qs[_0x1383('0x38')](_0x3c788b['query']['sort']);_0x42d63f[_0x1383('0x39')]=qs[_0x1383('0x33')](_[_0x1383('0x3a')](_0x3c788b[_0x1383('0x31')],_0x23e541[_0x1383('0x33')]),_0x15a3c4);if(_0x3c788b[_0x1383('0x31')][_0x1383('0x3b')]){_0x42d63f['where']=_[_0x1383('0x3c')](_0x42d63f['where'],{'$or':_[_0x1383('0x2a')](_0x15a3c4,function(_0x311072){if(_0x311072[_0x1383('0x2e')]!=='VIRTUAL'){var _0x277689={};_0x277689[_0x311072['name']]={'$like':'%'+_0x3c788b['query'][_0x1383('0x3b')]+'%'};return _0x277689;}})});}_0x42d63f=_[_0x1383('0x3c')]({},_0x42d63f,_0x3c788b[_0x1383('0x3d')]);var _0x53bcb0={'where':_0x42d63f[_0x1383('0x39')]};return db[_0x1383('0x2b')][_0x1383('0x3e')](_0x53bcb0)[_0x1383('0x24')](function(_0x56c269){_0x3357e9[_0x1383('0x3e')]=_0x56c269;if(_0x3c788b['query']['includeAll']){_0x42d63f[_0x1383('0x3f')]=[{'all':!![]}];}return db[_0x1383('0x2b')]['findAll'](_0x42d63f);})['then'](function(_0x5ca90f){_0x3357e9[_0x1383('0x40')]=_0x5ca90f;return _0x3357e9;})[_0x1383('0x24')](respondWithFilteredResult(_0xf0037f,_0x42d63f))[_0x1383('0x41')](handleError(_0xf0037f,null));};exports[_0x1383('0x42')]=function(_0x3dea24,_0x3e737a){var _0x12d58d={'raw':!![],'where':{'id':_0x3dea24[_0x1383('0x43')]['id']}},_0x43ac2f={};_0x43ac2f['model']=_[_0x1383('0x32')](db[_0x1383('0x2b')][_0x1383('0x2c')]);_0x43ac2f['query']=_[_0x1383('0x32')](_0x3dea24['query']);_0x43ac2f[_0x1383('0x33')]=_[_0x1383('0x34')](_0x43ac2f[_0x1383('0x30')],_0x43ac2f[_0x1383('0x31')]);_0x12d58d[_0x1383('0x35')]=_[_0x1383('0x34')](_0x43ac2f[_0x1383('0x30')],qs[_0x1383('0x36')](_0x3dea24[_0x1383('0x31')]['fields']));_0x12d58d['attributes']=_0x12d58d['attributes'][_0x1383('0x44')]?_0x12d58d[_0x1383('0x35')]:_0x43ac2f[_0x1383('0x30')];if(_0x3dea24[_0x1383('0x31')][_0x1383('0x45')]){_0x12d58d[_0x1383('0x3f')]=[{'all':!![]}];}_0x12d58d=_['merge']({},_0x12d58d,_0x3dea24[_0x1383('0x3d')]);return db[_0x1383('0x2b')][_0x1383('0x46')](_0x12d58d)['then'](handleEntityNotFound(_0x3e737a,null))[_0x1383('0x24')](respondWithResult(_0x3e737a,null))[_0x1383('0x41')](handleError(_0x3e737a,null));};exports[_0x1383('0x47')]=function(_0x1bc99a,_0x171066){return db['Cdr'][_0x1383('0x47')](_0x1bc99a['body'],{})[_0x1383('0x24')](respondWithResult(_0x171066,0xc9))[_0x1383('0x41')](handleError(_0x171066,null));};exports['update']=function(_0x16c74e,_0x2e41c3){if(_0x16c74e[_0x1383('0x48')]['id']){delete _0x16c74e[_0x1383('0x48')]['id'];}return db[_0x1383('0x2b')][_0x1383('0x46')]({'where':{'id':_0x16c74e[_0x1383('0x43')]['id']}})[_0x1383('0x24')](handleEntityNotFound(_0x2e41c3,null))[_0x1383('0x24')](saveUpdates(_0x16c74e[_0x1383('0x48')],null))['then'](respondWithResult(_0x2e41c3,null))[_0x1383('0x41')](handleError(_0x2e41c3,null));};exports[_0x1383('0x25')]=function(_0x23f8d7,_0x2ac880){return db[_0x1383('0x2b')][_0x1383('0x46')]({'where':{'id':_0x23f8d7[_0x1383('0x43')]['id']}})[_0x1383('0x24')](handleEntityNotFound(_0x2ac880,null))[_0x1383('0x24')](removeEntity(_0x2ac880,null))['catch'](handleError(_0x2ac880,null));};exports[_0x1383('0x49')]=function(_0x228af7,_0x45a3e5){return db['Cdr'][_0x1383('0x49')]()[_0x1383('0x24')](respondWithResult(_0x45a3e5,null))['catch'](handleError(_0x45a3e5,null));}; \ No newline at end of file +var _0xa990=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','json','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x294b7a,_0x51b167){var _0x30d2a3=function(_0x13a696){while(--_0x13a696){_0x294b7a['push'](_0x294b7a['shift']());}};_0x30d2a3(++_0x51b167);}(_0xa990,0xc9));var _0x0a99=function(_0xf5af70,_0x18fe1f){_0xf5af70=_0xf5af70-0x0;var _0x8fd0aa=_0xa990[_0xf5af70];return _0x8fd0aa;};'use strict';var emlformat=require(_0x0a99('0x0'));var rimraf=require(_0x0a99('0x1'));var zipdir=require(_0x0a99('0x2'));var jsonpatch=require(_0x0a99('0x3'));var rp=require(_0x0a99('0x4'));var moment=require(_0x0a99('0x5'));var BPromise=require(_0x0a99('0x6'));var Mustache=require(_0x0a99('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0a99('0x8'));var csv=require(_0x0a99('0x9'));var ejs=require(_0x0a99('0xa'));var fs=require('fs');var fs_extra=require(_0x0a99('0xb'));var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0x9'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a99('0x19'))['db'];function respondWithStatusCode(_0x3aaaad,_0x57ab88){_0x57ab88=_0x57ab88||0xcc;return function(_0xb6a34d){if(_0xb6a34d){return _0x3aaaad[_0x0a99('0x1a')](_0x57ab88);}return _0x3aaaad[_0x0a99('0x1b')](_0x57ab88)[_0x0a99('0x1c')]();};}function respondWithResult(_0x346061,_0x23d018){_0x23d018=_0x23d018||0xc8;return function(_0x18c124){if(_0x18c124){return _0x346061[_0x0a99('0x1b')](_0x23d018)['json'](_0x18c124);}};}function respondWithFilteredResult(_0x5a17e1,_0x2c40db){return function(_0x3ac17e){if(_0x3ac17e){var _0xb7356c=typeof _0x2c40db['offset']===_0x0a99('0x1d')&&typeof _0x2c40db['limit']==='undefined';var _0x20104c=_0x3ac17e[_0x0a99('0x1e')];var _0x3de006=_0xb7356c?0x0:_0x2c40db[_0x0a99('0x1f')];var _0x572ce5=_0xb7356c?_0x3ac17e['count']:_0x2c40db[_0x0a99('0x1f')]+_0x2c40db[_0x0a99('0x20')];var _0xbe23f3;if(_0x572ce5>=_0x20104c){_0x572ce5=_0x20104c;_0xbe23f3=0xc8;}else{_0xbe23f3=0xce;}_0x5a17e1[_0x0a99('0x1b')](_0xbe23f3);return _0x5a17e1['set']('Content-Range',_0x3de006+'-'+_0x572ce5+'/'+_0x20104c)[_0x0a99('0x21')](_0x3ac17e);}return null;};}function patchUpdates(_0x4d0c78){return function(_0x1e8d30){try{jsonpatch['apply'](_0x1e8d30,_0x4d0c78,!![]);}catch(_0x191ee4){return BPromise['reject'](_0x191ee4);}return _0x1e8d30[_0x0a99('0x22')]();};}function saveUpdates(_0x356681,_0x3b1d60){return function(_0x1c1e5c){if(_0x1c1e5c){return _0x1c1e5c[_0x0a99('0x23')](_0x356681)[_0x0a99('0x24')](function(_0x19c870){return _0x19c870;});}return null;};}function removeEntity(_0x1d803c,_0x398dd2){return function(_0x5745ca){if(_0x5745ca){return _0x5745ca['destroy']()[_0x0a99('0x24')](function(){_0x1d803c[_0x0a99('0x1b')](0xcc)[_0x0a99('0x1c')]();});}};}function handleEntityNotFound(_0x518617,_0x5d917c){return function(_0x371b31){if(!_0x371b31){_0x518617[_0x0a99('0x1a')](0x194);}return _0x371b31;};}function handleError(_0x1b0e94,_0x40e765){_0x40e765=_0x40e765||0x1f4;return function(_0x10e70f){logger[_0x0a99('0x25')](_0x10e70f[_0x0a99('0x26')]);if(_0x10e70f[_0x0a99('0x27')]){delete _0x10e70f[_0x0a99('0x27')];}_0x1b0e94['status'](_0x40e765)[_0x0a99('0x28')](_0x10e70f);};}exports['index']=function(_0x47bc34,_0x4e597b){var _0x223bdb={},_0x379c7e={},_0x13d26a={'count':0x0,'rows':[]};var _0x26c0c0=_[_0x0a99('0x29')](db[_0x0a99('0x2a')][_0x0a99('0x2b')],function(_0x47da33){return{'name':_0x47da33[_0x0a99('0x2c')],'type':_0x47da33[_0x0a99('0x2d')][_0x0a99('0x2e')]};});_0x379c7e[_0x0a99('0x2f')]=_['map'](_0x26c0c0,'name');_0x379c7e['query']=_[_0x0a99('0x30')](_0x47bc34[_0x0a99('0x31')]);_0x379c7e[_0x0a99('0x32')]=_['intersection'](_0x379c7e[_0x0a99('0x2f')],_0x379c7e[_0x0a99('0x31')]);_0x223bdb[_0x0a99('0x33')]=_[_0x0a99('0x34')](_0x379c7e[_0x0a99('0x2f')],qs[_0x0a99('0x35')](_0x47bc34[_0x0a99('0x31')]['fields']));_0x223bdb[_0x0a99('0x33')]=_0x223bdb[_0x0a99('0x33')][_0x0a99('0x36')]?_0x223bdb[_0x0a99('0x33')]:_0x379c7e[_0x0a99('0x2f')];if(!_0x47bc34['query'][_0x0a99('0x37')]('nolimit')){_0x223bdb['limit']=qs['limit'](_0x47bc34['query'][_0x0a99('0x20')]);_0x223bdb['offset']=qs[_0x0a99('0x1f')](_0x47bc34[_0x0a99('0x31')][_0x0a99('0x1f')]);}_0x223bdb[_0x0a99('0x38')]=qs[_0x0a99('0x39')](_0x47bc34[_0x0a99('0x31')][_0x0a99('0x39')]);_0x223bdb[_0x0a99('0x3a')]=qs[_0x0a99('0x32')](_[_0x0a99('0x3b')](_0x47bc34[_0x0a99('0x31')],_0x379c7e[_0x0a99('0x32')]),_0x26c0c0);if(_0x47bc34[_0x0a99('0x31')]['filter']){_0x223bdb[_0x0a99('0x3a')]=_[_0x0a99('0x3c')](_0x223bdb['where'],{'$or':_[_0x0a99('0x29')](_0x26c0c0,function(_0x549bb9){if(_0x549bb9[_0x0a99('0x2d')]!=='VIRTUAL'){var _0x541178={};_0x541178[_0x549bb9[_0x0a99('0x27')]]={'$like':'%'+_0x47bc34[_0x0a99('0x31')][_0x0a99('0x3d')]+'%'};return _0x541178;}})});}_0x223bdb=_['merge']({},_0x223bdb,_0x47bc34[_0x0a99('0x3e')]);var _0x11e046={'where':_0x223bdb[_0x0a99('0x3a')]};return db['Cdr'][_0x0a99('0x1e')](_0x11e046)[_0x0a99('0x24')](function(_0x23e4b9){_0x13d26a[_0x0a99('0x1e')]=_0x23e4b9;if(_0x47bc34['query'][_0x0a99('0x3f')]){_0x223bdb['include']=[{'all':!![]}];}return db['Cdr'][_0x0a99('0x40')](_0x223bdb);})['then'](function(_0x185495){_0x13d26a['rows']=_0x185495;return _0x13d26a;})[_0x0a99('0x24')](respondWithFilteredResult(_0x4e597b,_0x223bdb))[_0x0a99('0x41')](handleError(_0x4e597b,null));};exports[_0x0a99('0x42')]=function(_0x29da8a,_0x57b999){var _0xcee64a={'raw':!![],'where':{'id':_0x29da8a[_0x0a99('0x43')]['id']}},_0x97158c={};_0x97158c[_0x0a99('0x2f')]=_['keys'](db['Cdr']['rawAttributes']);_0x97158c[_0x0a99('0x31')]=_['keys'](_0x29da8a[_0x0a99('0x31')]);_0x97158c['filters']=_['intersection'](_0x97158c['model'],_0x97158c['query']);_0xcee64a[_0x0a99('0x33')]=_['intersection'](_0x97158c[_0x0a99('0x2f')],qs[_0x0a99('0x35')](_0x29da8a['query'][_0x0a99('0x35')]));_0xcee64a[_0x0a99('0x33')]=_0xcee64a['attributes'][_0x0a99('0x36')]?_0xcee64a['attributes']:_0x97158c[_0x0a99('0x2f')];if(_0x29da8a[_0x0a99('0x31')]['includeAll']){_0xcee64a[_0x0a99('0x44')]=[{'all':!![]}];}_0xcee64a=_['merge']({},_0xcee64a,_0x29da8a['options']);return db[_0x0a99('0x2a')][_0x0a99('0x45')](_0xcee64a)[_0x0a99('0x24')](handleEntityNotFound(_0x57b999,null))[_0x0a99('0x24')](respondWithResult(_0x57b999,null))[_0x0a99('0x41')](handleError(_0x57b999,null));};exports['create']=function(_0x476207,_0x174298){return db[_0x0a99('0x2a')][_0x0a99('0x46')](_0x476207[_0x0a99('0x47')],{})[_0x0a99('0x24')](respondWithResult(_0x174298,0xc9))[_0x0a99('0x41')](handleError(_0x174298,null));};exports[_0x0a99('0x23')]=function(_0x1cd328,_0x1621d9){if(_0x1cd328['body']['id']){delete _0x1cd328['body']['id'];}return db[_0x0a99('0x2a')][_0x0a99('0x45')]({'where':{'id':_0x1cd328[_0x0a99('0x43')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x1621d9,null))[_0x0a99('0x24')](saveUpdates(_0x1cd328[_0x0a99('0x47')],null))['then'](respondWithResult(_0x1621d9,null))[_0x0a99('0x41')](handleError(_0x1621d9,null));};exports[_0x0a99('0x48')]=function(_0x55fee0,_0x11ed07){return db[_0x0a99('0x2a')]['find']({'where':{'id':_0x55fee0[_0x0a99('0x43')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x11ed07,null))[_0x0a99('0x24')](removeEntity(_0x11ed07,null))[_0x0a99('0x41')](handleError(_0x11ed07,null));};exports[_0x0a99('0x49')]=function(_0x2411ea,_0xbdfb18){return db['Cdr'][_0x0a99('0x49')]()[_0x0a99('0x24')](respondWithResult(_0xbdfb18,null))[_0x0a99('0x41')](handleError(_0xbdfb18,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 95eb2f6..29a108e 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(_0x4acb39,_0x216b9b){var _0x290866=function(_0x45e5bc){while(--_0x45e5bc){_0x4acb39['push'](_0x4acb39['shift']());}};_0x290866(++_0x216b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x134079,_0x2db647){_0x134079=_0x134079-0x0;var _0x3e5c43=_0x7a54[_0x134079];return _0x3e5c43;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x190559,_0x126322){var _0x3802b6=function(_0x3387f4){while(--_0x3387f4){_0x190559['push'](_0x190559['shift']());}};_0x3802b6(++_0x126322);}(_0x7a54,0x106));var _0x47a5=function(_0x2effb7,_0x1fba38){_0x2effb7=_0x2effb7-0x0;var _0x120c03=_0x7a54[_0x2effb7];return _0x120c03;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 17e76ec..c493f8e 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 _0x6b8f=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','then'];(function(_0x3106f4,_0x1f64cd){var _0xb6f58a=function(_0x565a34){while(--_0x565a34){_0x3106f4['push'](_0x3106f4['shift']());}};_0xb6f58a(++_0x1f64cd);}(_0x6b8f,0x1ab));var _0xf6b8=function(_0x5273f7,_0x3d05d8){_0x5273f7=_0x5273f7-0x0;var _0x3e5827=_0x6b8f[_0x5273f7];return _0x3e5827;};'use strict';var _=require(_0xf6b8('0x0'));var util=require(_0xf6b8('0x1'));var moment=require(_0xf6b8('0x2'));var BPromise=require(_0xf6b8('0x3'));var rs=require(_0xf6b8('0x4'));var fs=require('fs');var Redis=require(_0xf6b8('0x5'));var db=require(_0xf6b8('0x6'))['db'];var utils=require(_0xf6b8('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf6b8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35c181,_0x2c4ed4,_0x201233){return new BPromise(function(_0x5bd8a4,_0x3b8e79){return client['request'](_0x35c181,_0x201233)[_0xf6b8('0x9')](function(_0xd69436){logger[_0xf6b8('0xa')](_0xf6b8('0xb'),_0x2c4ed4,_0xf6b8('0xc'));logger[_0xf6b8('0xd')](_0xf6b8('0xe'),_0x2c4ed4,_0xf6b8('0xc'),JSON['stringify'](_0xd69436));if(_0xd69436[_0xf6b8('0xf')]){if(_0xd69436[_0xf6b8('0xf')][_0xf6b8('0x10')]===0x1f4){logger[_0xf6b8('0xf')](_0xf6b8('0xb'),_0x2c4ed4,_0xd69436['error'][_0xf6b8('0x11')]);return _0x3b8e79(_0xd69436[_0xf6b8('0xf')][_0xf6b8('0x11')]);}logger[_0xf6b8('0xf')]('Cdr,\x20%s,\x20%s',_0x2c4ed4,_0xd69436[_0xf6b8('0xf')][_0xf6b8('0x11')]);return _0x5bd8a4(_0xd69436[_0xf6b8('0xf')][_0xf6b8('0x11')]);}else{logger[_0xf6b8('0xa')](_0xf6b8('0xb'),_0x2c4ed4,_0xf6b8('0xc'));_0x5bd8a4(_0xd69436['result'][_0xf6b8('0x11')]);}})[_0xf6b8('0x12')](function(_0xabc7ca){logger[_0xf6b8('0xf')]('Cdr,\x20%s,\x20%s',_0x2c4ed4,_0xabc7ca);_0x3b8e79(_0xabc7ca);});});} \ No newline at end of file +var _0xddfa=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x329b34,_0x3c18d8){var _0x4aabcb=function(_0x11ef33){while(--_0x11ef33){_0x329b34['push'](_0x329b34['shift']());}};_0x4aabcb(++_0x3c18d8);}(_0xddfa,0x14b));var _0xaddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddfa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaddf('0x0'));var util=require(_0xaddf('0x1'));var moment=require(_0xaddf('0x2'));var BPromise=require(_0xaddf('0x3'));var rs=require(_0xaddf('0x4'));var fs=require('fs');var Redis=require(_0xaddf('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaddf('0x6'))('rpc');var config=require(_0xaddf('0x7'));var jayson=require(_0xaddf('0x8'));var client=jayson[_0xaddf('0x9')][_0xaddf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f0574,_0x5cf5e7,_0xb66282){return new BPromise(function(_0xf565ba,_0x12b4b3){return client['request'](_0x4f0574,_0xb66282)[_0xaddf('0xb')](function(_0x56554d){logger[_0xaddf('0xc')](_0xaddf('0xd'),_0x5cf5e7,_0xaddf('0xe'));logger[_0xaddf('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x5cf5e7,_0xaddf('0xe'),JSON[_0xaddf('0x10')](_0x56554d));if(_0x56554d[_0xaddf('0x11')]){if(_0x56554d[_0xaddf('0x11')][_0xaddf('0x12')]===0x1f4){logger[_0xaddf('0x11')]('Cdr,\x20%s,\x20%s',_0x5cf5e7,_0x56554d[_0xaddf('0x11')][_0xaddf('0x13')]);return _0x12b4b3(_0x56554d[_0xaddf('0x11')][_0xaddf('0x13')]);}logger[_0xaddf('0x11')]('Cdr,\x20%s,\x20%s',_0x5cf5e7,_0x56554d[_0xaddf('0x11')][_0xaddf('0x13')]);return _0xf565ba(_0x56554d[_0xaddf('0x11')][_0xaddf('0x13')]);}else{logger[_0xaddf('0xc')](_0xaddf('0xd'),_0x5cf5e7,_0xaddf('0xe'));_0xf565ba(_0x56554d[_0xaddf('0x14')][_0xaddf('0x13')]);}})[_0xaddf('0x15')](function(_0x6b50ce){logger[_0xaddf('0x11')]('Cdr,\x20%s,\x20%s',_0x5cf5e7,_0x6b50ce);_0x12b4b3(_0x6b50ce);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index cb05919..9f5e590 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5c16e1,_0x12ea72){var _0x4f59d0=function(_0x48ed32){while(--_0x48ed32){_0x5c16e1['push'](_0x5c16e1['shift']());}};_0x4f59d0(++_0x12ea72);}(_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 +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x115b95,_0xa1f8b9){var _0x460b3d=function(_0x510c02){while(--_0x510c02){_0x115b95['push'](_0x115b95['shift']());}};_0x460b3d(++_0xa1f8b9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index cde57e0..c22a89d 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 _0xe2e3=['sequelize','exports','STRING','*,*,*,*'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0xe2e3,0x114));var _0x3e2e=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xe2e3[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0x3e2e('0x0'));module[_0x3e2e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3e2e('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3e2e('0x2')],'defaultValue':_0x3e2e('0x3')}}; \ No newline at end of file +var _0xd987=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x143d08,_0x59d4d9){var _0x363ddd=function(_0x1f0a93){while(--_0x1f0a93){_0x143d08['push'](_0x143d08['shift']());}};_0x363ddd(++_0x59d4d9);}(_0xd987,0x15d));var _0x7d98=function(_0x1defa0,_0x564c7f){_0x1defa0=_0x1defa0-0x0;var _0x3cd429=_0xd987[_0x1defa0];return _0x3cd429;};'use strict';var Sequelize=require(_0x7d98('0x0'));module[_0x7d98('0x1')]={'priority':{'type':Sequelize[_0x7d98('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7d98('0x3')],'allowNull':![],'defaultValue':_0x7d98('0x4')},'appdata':{'type':Sequelize[_0x7d98('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7d98('0x3')],'defaultValue':_0x7d98('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index cafda39..116aa8e 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 _0x2285=['keys','ChatApplication','rawAttributes','query','intersection','model','fields','attributes','includeAll','merge','options','find','update','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','params'];(function(_0x27f5e0,_0x137712){var _0x359127=function(_0x59c0fc){while(--_0x59c0fc){_0x27f5e0['push'](_0x27f5e0['shift']());}};_0x359127(++_0x137712);}(_0x2285,0x177));var _0x5228=function(_0x372381,_0x1f6fb9){_0x372381=_0x372381-0x0;var _0x299c4c=_0x2285[_0x372381];return _0x299c4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5228('0x0'));var zipdir=require(_0x5228('0x1'));var jsonpatch=require(_0x5228('0x2'));var rp=require(_0x5228('0x3'));var moment=require(_0x5228('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5228('0x5'));var util=require(_0x5228('0x6'));var path=require('path');var sox=require(_0x5228('0x7'));var csv=require(_0x5228('0x8'));var ejs=require(_0x5228('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5228('0xa'));var squel=require(_0x5228('0xb'));var crypto=require(_0x5228('0xc'));var jsforce=require(_0x5228('0xd'));var deskjs=require(_0x5228('0xe'));var toCsv=require(_0x5228('0x8'));var querystring=require(_0x5228('0xf'));var Papa=require(_0x5228('0x10'));var Redis=require(_0x5228('0x11'));var authService=require(_0x5228('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5228('0x13'));var hardwareService=require(_0x5228('0x14'));var logger=require(_0x5228('0x15'))(_0x5228('0x16'));var utils=require('../../config/utils');var config=require(_0x5228('0x17'));var licenseUtil=require(_0x5228('0x18'));var db=require(_0x5228('0x19'))['db'];function respondWithStatusCode(_0x3e984a,_0x5bbdfe){_0x5bbdfe=_0x5bbdfe||0xcc;return function(_0x2a939d){if(_0x2a939d){return _0x3e984a[_0x5228('0x1a')](_0x5bbdfe);}return _0x3e984a[_0x5228('0x1b')](_0x5bbdfe)[_0x5228('0x1c')]();};}function respondWithResult(_0x19c075,_0x530f36){_0x530f36=_0x530f36||0xc8;return function(_0x4d74d7){if(_0x4d74d7){return _0x19c075[_0x5228('0x1b')](_0x530f36)[_0x5228('0x1d')](_0x4d74d7);}};}function respondWithFilteredResult(_0x55f637,_0xa4aab9){return function(_0x271e3b){if(_0x271e3b){var _0x52d74c=typeof _0xa4aab9[_0x5228('0x1e')]===_0x5228('0x1f')&&typeof _0xa4aab9[_0x5228('0x20')]===_0x5228('0x1f');var _0x5ebf0c=_0x271e3b[_0x5228('0x21')];var _0x23419b=_0x52d74c?0x0:_0xa4aab9['offset'];var _0x41b812=_0x52d74c?_0x271e3b[_0x5228('0x21')]:_0xa4aab9[_0x5228('0x1e')]+_0xa4aab9['limit'];var _0x2dfc47;if(_0x41b812>=_0x5ebf0c){_0x41b812=_0x5ebf0c;_0x2dfc47=0xc8;}else{_0x2dfc47=0xce;}_0x55f637['status'](_0x2dfc47);return _0x55f637[_0x5228('0x22')](_0x5228('0x23'),_0x23419b+'-'+_0x41b812+'/'+_0x5ebf0c)[_0x5228('0x1d')](_0x271e3b);}return null;};}function patchUpdates(_0x52d49e){return function(_0x2c6837){try{jsonpatch[_0x5228('0x24')](_0x2c6837,_0x52d49e,!![]);}catch(_0xc7949f){return BPromise[_0x5228('0x25')](_0xc7949f);}return _0x2c6837['save']();};}function saveUpdates(_0x4d19a5,_0x28aba5){return function(_0x266419){if(_0x266419){return _0x266419['update'](_0x4d19a5)[_0x5228('0x26')](function(_0x2a738d){return _0x2a738d;});}return null;};}function removeEntity(_0xd82625,_0x1ae2df){return function(_0x63ce01){if(_0x63ce01){return _0x63ce01[_0x5228('0x27')]()[_0x5228('0x26')](function(){_0xd82625['status'](0xcc)[_0x5228('0x1c')]();});}};}function handleEntityNotFound(_0x531f16,_0x253207){return function(_0x3f587d){if(!_0x3f587d){_0x531f16['sendStatus'](0x194);}return _0x3f587d;};}function handleError(_0x594edf,_0x53cb40){_0x53cb40=_0x53cb40||0x1f4;return function(_0xfc158e){logger[_0x5228('0x28')](_0xfc158e[_0x5228('0x29')]);if(_0xfc158e['name']){delete _0xfc158e[_0x5228('0x2a')];}_0x594edf[_0x5228('0x1b')](_0x53cb40)[_0x5228('0x2b')](_0xfc158e);};}exports['show']=function(_0x31fc1a,_0x21398c){var _0x3e2561={'raw':!![],'where':{'id':_0x31fc1a[_0x5228('0x2c')]['id']}},_0x2adfb5={};_0x2adfb5['model']=_[_0x5228('0x2d')](db[_0x5228('0x2e')][_0x5228('0x2f')]);_0x2adfb5[_0x5228('0x30')]=_[_0x5228('0x2d')](_0x31fc1a['query']);_0x2adfb5['filters']=_[_0x5228('0x31')](_0x2adfb5[_0x5228('0x32')],_0x2adfb5['query']);_0x3e2561['attributes']=_[_0x5228('0x31')](_0x2adfb5['model'],qs[_0x5228('0x33')](_0x31fc1a[_0x5228('0x30')]['fields']));_0x3e2561[_0x5228('0x34')]=_0x3e2561['attributes']['length']?_0x3e2561[_0x5228('0x34')]:_0x2adfb5[_0x5228('0x32')];if(_0x31fc1a[_0x5228('0x30')][_0x5228('0x35')]){_0x3e2561['include']=[{'all':!![]}];}_0x3e2561=_[_0x5228('0x36')]({},_0x3e2561,_0x31fc1a[_0x5228('0x37')]);return db[_0x5228('0x2e')][_0x5228('0x38')](_0x3e2561)[_0x5228('0x26')](handleEntityNotFound(_0x21398c,null))[_0x5228('0x26')](respondWithResult(_0x21398c,null))['catch'](handleError(_0x21398c,null));};exports[_0x5228('0x39')]=function(_0x5dce78,_0x1ca305){if(_0x5dce78[_0x5228('0x3a')]['id']){delete _0x5dce78['body']['id'];}return db['ChatApplication']['find']({'where':{'id':_0x5dce78[_0x5228('0x2c')]['id']}})[_0x5228('0x26')](handleEntityNotFound(_0x1ca305,null))[_0x5228('0x26')](saveUpdates(_0x5dce78[_0x5228('0x3a')],null))[_0x5228('0x26')](respondWithResult(_0x1ca305,null))[_0x5228('0x3b')](handleError(_0x1ca305,null));};exports['destroy']=function(_0x493a05,_0x3601fb){return db[_0x5228('0x2e')]['find']({'where':{'id':_0x493a05[_0x5228('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3601fb,null))['then'](removeEntity(_0x3601fb,null))[_0x5228('0x3b')](handleError(_0x3601fb,null));}; \ No newline at end of file +var _0x9348=['undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x4685a9,_0x57af26){var _0x220a87=function(_0xd2f9aa){while(--_0xd2f9aa){_0x4685a9['push'](_0x4685a9['shift']());}};_0x220a87(++_0x57af26);}(_0x9348,0x10d));var _0x8934=function(_0x26911e,_0x121a02){_0x26911e=_0x26911e-0x0;var _0x47eb93=_0x9348[_0x26911e];return _0x47eb93;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={'raw':!![],'where':{'id':_0x3d93c7[_0x8934('0x2c')]['id']}},_0x3f328a={};_0x3f328a[_0x8934('0x2d')]=_[_0x8934('0x2e')](db['ChatApplication'][_0x8934('0x2f')]);_0x3f328a[_0x8934('0x30')]=_['keys'](_0x3d93c7[_0x8934('0x30')]);_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3f328a[_0x8934('0x2d')],_0x3f328a['query']);_0x20d448[_0x8934('0x33')]=_[_0x8934('0x32')](_0x3f328a[_0x8934('0x2d')],qs[_0x8934('0x34')](_0x3d93c7[_0x8934('0x30')]['fields']));_0x20d448[_0x8934('0x33')]=_0x20d448['attributes']['length']?_0x20d448[_0x8934('0x33')]:_0x3f328a[_0x8934('0x2d')];if(_0x3d93c7[_0x8934('0x30')][_0x8934('0x35')]){_0x20d448['include']=[{'all':!![]}];}_0x20d448=_[_0x8934('0x36')]({},_0x20d448,_0x3d93c7[_0x8934('0x37')]);return db[_0x8934('0x38')][_0x8934('0x39')](_0x20d448)[_0x8934('0x25')](handleEntityNotFound(_0x44972b,null))['then'](respondWithResult(_0x44972b,null))[_0x8934('0x3a')](handleError(_0x44972b,null));};exports[_0x8934('0x24')]=function(_0x5d5bc2,_0x5914b9){if(_0x5d5bc2[_0x8934('0x3b')]['id']){delete _0x5d5bc2[_0x8934('0x3b')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x5d5bc2[_0x8934('0x2c')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x5914b9,null))[_0x8934('0x25')](saveUpdates(_0x5d5bc2[_0x8934('0x3b')],null))[_0x8934('0x25')](respondWithResult(_0x5914b9,null))[_0x8934('0x3a')](handleError(_0x5914b9,null));};exports[_0x8934('0x26')]=function(_0x1bc2d8,_0x27920e){return db[_0x8934('0x38')][_0x8934('0x39')]({'where':{'id':_0x1bc2d8['params']['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x27920e,null))[_0x8934('0x25')](removeEntity(_0x27920e,null))['catch'](handleError(_0x27920e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a79e178..d7693ad 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 _0xed1c=['request-promise','path','exports','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x146284,_0x391083){var _0x472293=function(_0x29749c){while(--_0x29749c){_0x146284['push'](_0x146284['shift']());}};_0x472293(++_0x391083);}(_0xed1c,0x7f));var _0xced1=function(_0x38e31a,_0x43dc19){_0x38e31a=_0x38e31a-0x0;var _0x3e6817=_0xed1c[_0x38e31a];return _0x3e6817;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')(_0xced1('0x2'));var moment=require(_0xced1('0x3'));var BPromise=require(_0xced1('0x4'));var rp=require(_0xced1('0x5'));var fs=require('fs');var path=require(_0xced1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xced1('0x7')]=function(_0x4846c3,_0x39baa1){return _0x4846c3['define'](_0xced1('0x8'),attributes,{'tableName':_0xced1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xced1('0xa')});}; \ No newline at end of file +var _0xbc4b=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0xaf24cd,_0x10644a){var _0x1d9bda=function(_0x59a069){while(--_0x59a069){_0xaf24cd['push'](_0xaf24cd['shift']());}};_0x1d9bda(++_0x10644a);}(_0xbc4b,0x17a));var _0xbbc4=function(_0x134a26,_0x241d2c){_0x134a26=_0x134a26-0x0;var _0x5f3f9c=_0xbc4b[_0x134a26];return _0x5f3f9c;};'use strict';var _=require(_0xbbc4('0x0'));var util=require('util');var logger=require(_0xbbc4('0x1'))('api');var moment=require(_0xbbc4('0x2'));var BPromise=require(_0xbbc4('0x3'));var rp=require(_0xbbc4('0x4'));var fs=require('fs');var path=require(_0xbbc4('0x5'));var rimraf=require(_0xbbc4('0x6'));var config=require(_0xbbc4('0x7'));var attributes=require(_0xbbc4('0x8'));module[_0xbbc4('0x9')]=function(_0x5f7b1b,_0xf424ec){return _0x5f7b1b[_0xbbc4('0xa')](_0xbbc4('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbbc4('0xc'),'collate':_0xbbc4('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 3e9e313..bec75be 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 _0xdde0=['stringify','error','code','message','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3f2a54,_0x3f8876){var _0x3312e8=function(_0x43dc7a){while(--_0x43dc7a){_0x3f2a54['push'](_0x3f2a54['shift']());}};_0x3312e8(++_0x3f8876);}(_0xdde0,0x94));var _0x0dde=function(_0x2b7d51,_0x4aa4d7){_0x2b7d51=_0x2b7d51-0x0;var _0x2f1d84=_0xdde0[_0x2b7d51];return _0x2f1d84;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0dde('0x0'));var BPromise=require(_0x0dde('0x1'));var rs=require(_0x0dde('0x2'));var fs=require('fs');var Redis=require(_0x0dde('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0dde('0x4'));var logger=require('../../config/logger')(_0x0dde('0x5'));var config=require(_0x0dde('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0dde('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x488bff,_0x4026d5,_0x35f636){return new BPromise(function(_0x600dcf,_0x5f2282){return client['request'](_0x488bff,_0x35f636)[_0x0dde('0x8')](function(_0x412ac2){logger[_0x0dde('0x9')](_0x0dde('0xa'),_0x4026d5,'request\x20sent');logger[_0x0dde('0xb')](_0x0dde('0xc'),_0x4026d5,_0x0dde('0xd'),JSON[_0x0dde('0xe')](_0x412ac2));if(_0x412ac2[_0x0dde('0xf')]){if(_0x412ac2[_0x0dde('0xf')][_0x0dde('0x10')]===0x1f4){logger[_0x0dde('0xf')](_0x0dde('0xa'),_0x4026d5,_0x412ac2[_0x0dde('0xf')][_0x0dde('0x11')]);return _0x5f2282(_0x412ac2[_0x0dde('0xf')][_0x0dde('0x11')]);}logger[_0x0dde('0xf')](_0x0dde('0xa'),_0x4026d5,_0x412ac2['error'][_0x0dde('0x11')]);return _0x600dcf(_0x412ac2[_0x0dde('0xf')]['message']);}else{logger['info'](_0x0dde('0xa'),_0x4026d5,_0x0dde('0xd'));_0x600dcf(_0x412ac2['result']['message']);}})['catch'](function(_0x3ae4b9){logger['error']('ChatApplication,\x20%s,\x20%s',_0x4026d5,_0x3ae4b9);_0x5f2282(_0x3ae4b9);});});} \ No newline at end of file +var _0x039b=['then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x039b,0x8f));var _0xb039=function(_0x54e2ff,_0x11360a){_0x54e2ff=_0x54e2ff-0x0;var _0x6b1bec=_0x039b[_0x54e2ff];return _0x6b1bec;};'use strict';var _=require(_0xb039('0x0'));var util=require(_0xb039('0x1'));var moment=require('moment');var BPromise=require(_0xb039('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb039('0x3'));var db=require(_0xb039('0x4'))['db'];var utils=require(_0xb039('0x5'));var logger=require('../../config/logger')(_0xb039('0x6'));var config=require('../../config/environment');var jayson=require(_0xb039('0x7'));var client=jayson[_0xb039('0x8')][_0xb039('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35371d,_0x357eca,_0x5a129c){return new BPromise(function(_0x23970c,_0x2154d7){return client[_0xb039('0xa')](_0x35371d,_0x5a129c)[_0xb039('0xb')](function(_0x38fc43){logger[_0xb039('0xc')](_0xb039('0xd'),_0x357eca,_0xb039('0xe'));logger[_0xb039('0xf')](_0xb039('0x10'),_0x357eca,_0xb039('0xe'),JSON[_0xb039('0x11')](_0x38fc43));if(_0x38fc43[_0xb039('0x12')]){if(_0x38fc43['error'][_0xb039('0x13')]===0x1f4){logger['error'](_0xb039('0xd'),_0x357eca,_0x38fc43['error'][_0xb039('0x14')]);return _0x2154d7(_0x38fc43[_0xb039('0x12')][_0xb039('0x14')]);}logger[_0xb039('0x12')](_0xb039('0xd'),_0x357eca,_0x38fc43[_0xb039('0x12')][_0xb039('0x14')]);return _0x23970c(_0x38fc43[_0xb039('0x12')]['message']);}else{logger[_0xb039('0xc')](_0xb039('0xd'),_0x357eca,_0xb039('0xe'));_0x23970c(_0x38fc43[_0xb039('0x15')]['message']);}})['catch'](function(_0x43ffe4){logger[_0xb039('0x12')](_0xb039('0xd'),_0x357eca,_0x43ffe4);_0x2154d7(_0x43ffe4);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 49016cd..b3a0eb7 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 _0x5789=['express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','isAuthenticated','show','put','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4abbea,_0x364655){var _0x3b73ee=function(_0x53475e){while(--_0x53475e){_0x4abbea['push'](_0x4abbea['shift']());}};_0x3b73ee(++_0x364655);}(_0x5789,0x12e));var _0x9578=function(_0x39e40c,_0x50faa6){_0x39e40c=_0x39e40c-0x0;var _0x1456ea=_0x5789[_0x39e40c];return _0x1456ea;};'use strict';var multer=require(_0x9578('0x0'));var util=require(_0x9578('0x1'));var path=require(_0x9578('0x2'));var timeout=require(_0x9578('0x3'));var express=require(_0x9578('0x4'));var router=express[_0x9578('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9578('0x6'));var interaction=require(_0x9578('0x7'));var config=require('../../config/environment');var controller=require(_0x9578('0x8'));router[_0x9578('0x9')]('/:id',auth[_0x9578('0xa')](),controller[_0x9578('0xb')]);router[_0x9578('0xc')](_0x9578('0xd'),auth['isAuthenticated'](),controller[_0x9578('0xe')]);router['delete'](_0x9578('0xd'),auth[_0x9578('0xa')](),controller[_0x9578('0xf')]);module[_0x9578('0x10')]=router; \ No newline at end of file +var _0xf32a=['./chatApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xf32a,0x91));var _0xaf32=function(_0x2a0929,_0x4abe7c){_0x2a0929=_0x2a0929-0x0;var _0x50e47b=_0xf32a[_0x2a0929];return _0x50e47b;};'use strict';var multer=require(_0xaf32('0x0'));var util=require(_0xaf32('0x1'));var path=require(_0xaf32('0x2'));var timeout=require(_0xaf32('0x3'));var express=require('express');var router=express[_0xaf32('0x4')]();var fs_extra=require(_0xaf32('0x5'));var auth=require(_0xaf32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf32('0x7'));var controller=require(_0xaf32('0x8'));router[_0xaf32('0x9')](_0xaf32('0xa'),auth['isAuthenticated'](),controller[_0xaf32('0xb')]);router['put'](_0xaf32('0xa'),auth[_0xaf32('0xc')](),controller[_0xaf32('0xd')]);router[_0xaf32('0xe')](_0xaf32('0xa'),auth[_0xaf32('0xc')](),controller[_0xaf32('0xf')]);module[_0xaf32('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 4e733d5..bb846f0 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 _0x6829=['sequelize','exports'];(function(_0x36046c,_0x42b4c8){var _0x1997d1=function(_0x11beab){while(--_0x11beab){_0x36046c['push'](_0x36046c['shift']());}};_0x1997d1(++_0x42b4c8);}(_0x6829,0x14c));var _0x9682=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x6829[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0x9682('0x0'));module[_0x9682('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x35b5=['sequelize','exports','STRING','BOOLEAN'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x35b5,0xd4));var _0x535b=function(_0x38eea6,_0x567ed2){_0x38eea6=_0x38eea6-0x0;var _0x272571=_0x35b5[_0x38eea6];return _0x272571;};'use strict';var Sequelize=require(_0x535b('0x0'));module[_0x535b('0x1')]={'name':{'type':Sequelize[_0x535b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x535b('0x2')]},'write':{'type':Sequelize[_0x535b('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index c78f2f3..b1cfd18 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 _0x118e=['include','findAll','catch','show','params','includeAll','options','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','User','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x118e,0xe9));var _0xe118=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x118e[_0x35da42];return _0x370035;};'use strict';var emlformat=require(_0xe118('0x0'));var rimraf=require(_0xe118('0x1'));var zipdir=require(_0xe118('0x2'));var jsonpatch=require(_0xe118('0x3'));var rp=require(_0xe118('0x4'));var moment=require(_0xe118('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe118('0x6'));var util=require(_0xe118('0x7'));var path=require(_0xe118('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe118('0x9'));var fs=require('fs');var fs_extra=require(_0xe118('0xa'));var _=require(_0xe118('0xb'));var squel=require(_0xe118('0xc'));var crypto=require(_0xe118('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe118('0xe'));var toCsv=require(_0xe118('0xf'));var querystring=require(_0xe118('0x10'));var Papa=require(_0xe118('0x11'));var Redis=require(_0xe118('0x12'));var authService=require(_0xe118('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe118('0x14'));var logger=require(_0xe118('0x15'))(_0xe118('0x16'));var utils=require(_0xe118('0x17'));var config=require(_0xe118('0x18'));var licenseUtil=require(_0xe118('0x19'));var db=require(_0xe118('0x1a'))['db'];config[_0xe118('0x1b')]=_[_0xe118('0x1c')](config['redis'],{'host':_0xe118('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe118('0x1b')]));require('./chatGroup.socket')[_0xe118('0x1e')](socket);function respondWithStatusCode(_0x2f0cee,_0x2e1084){_0x2e1084=_0x2e1084||0xcc;return function(_0x9391d4){if(_0x9391d4){return _0x2f0cee[_0xe118('0x1f')](_0x2e1084);}return _0x2f0cee[_0xe118('0x20')](_0x2e1084)['end']();};}function respondWithResult(_0x21c3e1,_0x4decac){_0x4decac=_0x4decac||0xc8;return function(_0x548e4f){if(_0x548e4f){return _0x21c3e1[_0xe118('0x20')](_0x4decac)[_0xe118('0x21')](_0x548e4f);}};}function respondWithFilteredResult(_0x17ff83,_0x7c0b01){return function(_0x30c694){if(_0x30c694){var _0x2c910d=typeof _0x7c0b01[_0xe118('0x22')]===_0xe118('0x23')&&typeof _0x7c0b01['limit']==='undefined';var _0x27d607=_0x30c694[_0xe118('0x24')];var _0x515c63=_0x2c910d?0x0:_0x7c0b01[_0xe118('0x22')];var _0x50abfa=_0x2c910d?_0x30c694['count']:_0x7c0b01[_0xe118('0x22')]+_0x7c0b01[_0xe118('0x25')];var _0x10f0d4;if(_0x50abfa>=_0x27d607){_0x50abfa=_0x27d607;_0x10f0d4=0xc8;}else{_0x10f0d4=0xce;}_0x17ff83['status'](_0x10f0d4);return _0x17ff83[_0xe118('0x26')](_0xe118('0x27'),_0x515c63+'-'+_0x50abfa+'/'+_0x27d607)[_0xe118('0x21')](_0x30c694);}return null;};}function patchUpdates(_0x416878){return function(_0x1417bc){try{jsonpatch['apply'](_0x1417bc,_0x416878,!![]);}catch(_0xe6520f){return BPromise[_0xe118('0x28')](_0xe6520f);}return _0x1417bc[_0xe118('0x29')]();};}function saveUpdates(_0x3f6d2a,_0x3ec425){return function(_0x3a3826){if(_0x3a3826){return _0x3a3826[_0xe118('0x2a')](_0x3f6d2a)[_0xe118('0x2b')](function(_0x43f5cd){return _0x43f5cd;});}return null;};}function removeEntity(_0x5f145e,_0x226af4){return function(_0x37766d){if(_0x37766d){return _0x37766d[_0xe118('0x2c')]()[_0xe118('0x2b')](function(){_0x5f145e[_0xe118('0x20')](0xcc)[_0xe118('0x2d')]();});}};}function handleEntityNotFound(_0x2cf29,_0x2a5bc3){return function(_0x19b1f0){if(!_0x19b1f0){_0x2cf29['sendStatus'](0x194);}return _0x19b1f0;};}function handleError(_0x45ca1a,_0x485a84){_0x485a84=_0x485a84||0x1f4;return function(_0x3875c9){logger[_0xe118('0x2e')](_0x3875c9[_0xe118('0x2f')]);if(_0x3875c9[_0xe118('0x30')]){delete _0x3875c9[_0xe118('0x30')];}_0x45ca1a['status'](_0x485a84)[_0xe118('0x31')](_0x3875c9);};}exports[_0xe118('0x32')]=function(_0x331604,_0x34f7be){var _0x18487b={},_0x1b6bff={},_0x350413={'count':0x0,'rows':[]};var _0x38645b=_['map'](db[_0xe118('0x33')][_0xe118('0x34')],function(_0x5e5423){return{'name':_0x5e5423[_0xe118('0x35')],'type':_0x5e5423[_0xe118('0x36')][_0xe118('0x37')]};});_0x1b6bff[_0xe118('0x38')]=_[_0xe118('0x39')](_0x38645b,_0xe118('0x30'));_0x1b6bff[_0xe118('0x3a')]=_[_0xe118('0x3b')](_0x331604[_0xe118('0x3a')]);_0x1b6bff[_0xe118('0x3c')]=_[_0xe118('0x3d')](_0x1b6bff[_0xe118('0x38')],_0x1b6bff[_0xe118('0x3a')]);_0x18487b[_0xe118('0x3e')]=_['intersection'](_0x1b6bff[_0xe118('0x38')],qs[_0xe118('0x3f')](_0x331604[_0xe118('0x3a')][_0xe118('0x3f')]));_0x18487b[_0xe118('0x3e')]=_0x18487b['attributes'][_0xe118('0x40')]?_0x18487b[_0xe118('0x3e')]:_0x1b6bff['model'];if(!_0x331604[_0xe118('0x3a')][_0xe118('0x41')]('nolimit')){_0x18487b[_0xe118('0x25')]=qs['limit'](_0x331604['query'][_0xe118('0x25')]);_0x18487b['offset']=qs[_0xe118('0x22')](_0x331604[_0xe118('0x3a')][_0xe118('0x22')]);}_0x18487b[_0xe118('0x42')]=qs[_0xe118('0x43')](_0x331604[_0xe118('0x3a')][_0xe118('0x43')]);_0x18487b[_0xe118('0x44')]=qs[_0xe118('0x3c')](_[_0xe118('0x45')](_0x331604[_0xe118('0x3a')],_0x1b6bff['filters']),_0x38645b);if(_0x331604['query']['filter']){_0x18487b['where']=_[_0xe118('0x46')](_0x18487b[_0xe118('0x44')],{'$or':_[_0xe118('0x39')](_0x38645b,function(_0x44f6eb){if(_0x44f6eb[_0xe118('0x36')]!==_0xe118('0x47')){var _0x124754={};_0x124754[_0x44f6eb[_0xe118('0x30')]]={'$like':'%'+_0x331604[_0xe118('0x3a')][_0xe118('0x48')]+'%'};return _0x124754;}})});}_0x18487b=_['merge']({},_0x18487b,_0x331604['options']);var _0x5e0974={'where':_0x18487b[_0xe118('0x44')]};return db[_0xe118('0x33')][_0xe118('0x24')](_0x5e0974)[_0xe118('0x2b')](function(_0x1cfe55){_0x350413['count']=_0x1cfe55;if(_0x331604[_0xe118('0x3a')]['includeAll']){_0x18487b[_0xe118('0x49')]=[{'all':!![]}];}return db['ChatGroup'][_0xe118('0x4a')](_0x18487b);})[_0xe118('0x2b')](function(_0x5a1e9e){_0x350413['rows']=_0x5a1e9e;return _0x350413;})['then'](respondWithFilteredResult(_0x34f7be,_0x18487b))[_0xe118('0x4b')](handleError(_0x34f7be,null));};exports[_0xe118('0x4c')]=function(_0x5477fd,_0x3a3fa3){var _0x54e3b2={'raw':!![],'where':{'id':_0x5477fd[_0xe118('0x4d')]['id']}},_0x313d37={};_0x313d37[_0xe118('0x38')]=_[_0xe118('0x3b')](db[_0xe118('0x33')]['rawAttributes']);_0x313d37['query']=_['keys'](_0x5477fd[_0xe118('0x3a')]);_0x313d37[_0xe118('0x3c')]=_[_0xe118('0x3d')](_0x313d37[_0xe118('0x38')],_0x313d37['query']);_0x54e3b2[_0xe118('0x3e')]=_['intersection'](_0x313d37[_0xe118('0x38')],qs['fields'](_0x5477fd['query'][_0xe118('0x3f')]));_0x54e3b2[_0xe118('0x3e')]=_0x54e3b2['attributes'][_0xe118('0x40')]?_0x54e3b2[_0xe118('0x3e')]:_0x313d37['model'];if(_0x5477fd[_0xe118('0x3a')][_0xe118('0x4e')]){_0x54e3b2[_0xe118('0x49')]=[{'all':!![]}];}_0x54e3b2=_['merge']({},_0x54e3b2,_0x5477fd[_0xe118('0x4f')]);return db[_0xe118('0x33')][_0xe118('0x50')](_0x54e3b2)[_0xe118('0x2b')](handleEntityNotFound(_0x3a3fa3,null))[_0xe118('0x2b')](respondWithResult(_0x3a3fa3,null))['catch'](handleError(_0x3a3fa3,null));};exports['create']=function(_0x4371f3,_0x3871c9){return db[_0xe118('0x33')][_0xe118('0x51')](_0x4371f3[_0xe118('0x52')],{})['then'](respondWithResult(_0x3871c9,0xc9))[_0xe118('0x4b')](handleError(_0x3871c9,null));};exports['update']=function(_0x4a7cff,_0x1febc3){if(_0x4a7cff[_0xe118('0x52')]['id']){delete _0x4a7cff[_0xe118('0x52')]['id'];}return db['ChatGroup'][_0xe118('0x50')]({'where':{'id':_0x4a7cff['params']['id']}})[_0xe118('0x2b')](handleEntityNotFound(_0x1febc3,null))[_0xe118('0x2b')](saveUpdates(_0x4a7cff['body'],null))[_0xe118('0x2b')](respondWithResult(_0x1febc3,null))['catch'](handleError(_0x1febc3,null));};exports[_0xe118('0x2c')]=function(_0x357fd5,_0x4d9f56){return db[_0xe118('0x33')]['find']({'where':{'id':_0x357fd5[_0xe118('0x4d')]['id']}})[_0xe118('0x2b')](handleEntityNotFound(_0x4d9f56,null))['then'](removeEntity(_0x4d9f56,null))[_0xe118('0x4b')](handleError(_0x4d9f56,null));};exports[_0xe118('0x53')]=function(_0x2e7910,_0xa54349){return db[_0xe118('0x33')][_0xe118('0x53')]()[_0xe118('0x2b')](respondWithResult(_0xa54349,null))[_0xe118('0x4b')](handleError(_0xa54349,null));};exports[_0xe118('0x54')]=function(_0x53b85a,_0xa736c1,_0x3e325e){return db[_0xe118('0x55')][_0xe118('0x24')]({'where':{'ChatGroupId':_0x53b85a[_0xe118('0x4d')]['id'],'ToId':_0x53b85a['user']['id'],'read':![]}})[_0xe118('0x2b')](function(_0x481563){return{'id':_[_0xe118('0x56')](_0x53b85a['params']['id']),'count':_0x481563};})['then'](respondWithResult(_0xa736c1,null))['catch'](handleError(_0xa736c1,null));};exports[_0xe118('0x57')]=function(_0x270680,_0x378416,_0x265e99){return db[_0xe118('0x33')][_0xe118('0x50')]({'where':{'id':_0x270680[_0xe118('0x4d')]['id']}})[_0xe118('0x2b')](handleEntityNotFound(_0x378416,null))[_0xe118('0x2b')](function(_0x2be046){if(_0x2be046){return _0x2be046['addMembers'](_0x270680[_0xe118('0x52')][_0xe118('0x58')],_[_0xe118('0x59')](_0x270680[_0xe118('0x52')],[_0xe118('0x58'),'id'])||{});}})[_0xe118('0x2b')](respondWithResult(_0x378416,null))['catch'](handleError(_0x378416,null));};exports[_0xe118('0x5a')]=function(_0x4ff72b,_0x1d8357,_0x1b5b85){var _0x47d4a4={};var _0x14b122={};var _0x3ec73d;var _0x872de7;return db[_0xe118('0x33')]['findOne']({'where':{'id':_0x4ff72b[_0xe118('0x4d')]['id']}})[_0xe118('0x2b')](handleEntityNotFound(_0x1d8357,null))[_0xe118('0x2b')](function(_0x5c78ab){if(_0x5c78ab){_0x3ec73d=_0x5c78ab;_0x14b122['model']=_[_0xe118('0x3b')](db[_0xe118('0x5b')][_0xe118('0x34')]);_0x14b122[_0xe118('0x3a')]=_[_0xe118('0x3b')](_0x4ff72b[_0xe118('0x3a')]);_0x14b122[_0xe118('0x3c')]=_[_0xe118('0x3d')](_0x14b122[_0xe118('0x38')],_0x14b122[_0xe118('0x3a')]);_0x47d4a4[_0xe118('0x3e')]=_[_0xe118('0x3d')](_0x14b122[_0xe118('0x38')],qs[_0xe118('0x3f')](_0x4ff72b[_0xe118('0x3a')][_0xe118('0x3f')]));_0x47d4a4['attributes']=_0x47d4a4[_0xe118('0x3e')][_0xe118('0x40')]?_0x47d4a4[_0xe118('0x3e')]:_0x14b122['model'];_0x47d4a4[_0xe118('0x42')]=qs[_0xe118('0x43')](_0x4ff72b[_0xe118('0x3a')][_0xe118('0x43')]);_0x47d4a4['where']=qs[_0xe118('0x3c')](_[_0xe118('0x45')](_0x4ff72b['query'],_0x14b122[_0xe118('0x3c')]));if(_0x4ff72b[_0xe118('0x3a')][_0xe118('0x48')]){_0x47d4a4[_0xe118('0x44')]=_[_0xe118('0x46')](_0x47d4a4[_0xe118('0x44')],{'$or':_[_0xe118('0x39')](_0x47d4a4[_0xe118('0x3e')],function(_0x3bcb0f){var _0x139cbd={};_0x139cbd[_0x3bcb0f]={'$like':'%'+_0x4ff72b[_0xe118('0x3a')]['filter']+'%'};return _0x139cbd;})});}_0x47d4a4=_[_0xe118('0x46')]({},_0x47d4a4,_0x4ff72b[_0xe118('0x4f')]);return _0x3ec73d[_0xe118('0x5a')](_0x47d4a4);}})[_0xe118('0x2b')](function(_0x70eb3d){if(_0x70eb3d){_0x872de7=_0x70eb3d['length'];if(!_0x4ff72b['query'][_0xe118('0x41')](_0xe118('0x5c'))){_0x47d4a4[_0xe118('0x25')]=qs[_0xe118('0x25')](_0x4ff72b[_0xe118('0x3a')]['limit']);_0x47d4a4[_0xe118('0x22')]=qs[_0xe118('0x22')](_0x4ff72b['query'][_0xe118('0x22')]);}return _0x3ec73d[_0xe118('0x5a')](_0x47d4a4);}})[_0xe118('0x2b')](function(_0x1f9388){if(_0x1f9388){return _0x1f9388?{'count':_0x872de7,'rows':_0x1f9388}:null;}})[_0xe118('0x2b')](respondWithResult(_0x1d8357,null))[_0xe118('0x4b')](handleError(_0x1d8357,null));};exports['removeMembers']=function(_0x23f999,_0x5c7e08,_0x521bb5){return db[_0xe118('0x33')][_0xe118('0x50')]({'where':{'id':_0x23f999[_0xe118('0x4d')]['id']}})[_0xe118('0x2b')](handleEntityNotFound(_0x5c7e08,null))[_0xe118('0x2b')](function(_0xf30bb2){if(_0xf30bb2){return _0xf30bb2[_0xe118('0x5d')](_0x23f999['query'][_0xe118('0x58')]);}})['then'](respondWithStatusCode(_0x5c7e08,null))['catch'](handleError(_0x5c7e08,null));};exports[_0xe118('0x5e')]=function(_0x360747,_0x4257be,_0x2d4b9a){if(_0x360747['body']['id']){delete _0x360747['body']['id'];}return db[_0xe118('0x33')][_0xe118('0x50')]({'where':{'id':_0x360747[_0xe118('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4257be,null))[_0xe118('0x2b')](function(_0x5237ab){if(_0x5237ab){_0x360747[_0xe118('0x52')][_0xe118('0x5f')]=_0x5237ab['id'];return db['ChatInternalMessage']['create'](_0x360747[_0xe118('0x52')]);}})[_0xe118('0x2b')](respondWithResult(_0x4257be,null))[_0xe118('0x4b')](handleError(_0x4257be,null));};exports[_0xe118('0x60')]=function(_0x3ad6d4,_0x275b53,_0x341cb2){var _0xff7ac0={};var _0x41948a={};var _0x51b70b;var _0xd63dcb;return db[_0xe118('0x33')][_0xe118('0x61')]({'where':{'id':_0x3ad6d4['params']['id']}})['then'](handleEntityNotFound(_0x275b53,null))[_0xe118('0x2b')](function(_0x152e75){if(_0x152e75){_0x51b70b=_0x152e75;_0x41948a['model']=_['keys'](db[_0xe118('0x55')][_0xe118('0x34')]);_0x41948a[_0xe118('0x3a')]=_[_0xe118('0x3b')](_0x3ad6d4[_0xe118('0x3a')]);_0x41948a['filters']=_['intersection'](_0x41948a[_0xe118('0x38')],_0x41948a['query']);_0xff7ac0[_0xe118('0x3e')]=_[_0xe118('0x3d')](_0x41948a[_0xe118('0x38')],qs[_0xe118('0x3f')](_0x3ad6d4['query'][_0xe118('0x3f')]));_0xff7ac0['attributes']=_0xff7ac0[_0xe118('0x3e')][_0xe118('0x40')]?_0xff7ac0[_0xe118('0x3e')]:_0x41948a[_0xe118('0x38')];_0xff7ac0['order']=qs[_0xe118('0x43')](_0x3ad6d4[_0xe118('0x3a')]['sort']);_0xff7ac0[_0xe118('0x44')]=qs[_0xe118('0x3c')](_[_0xe118('0x45')](_0x3ad6d4[_0xe118('0x3a')],_0x41948a[_0xe118('0x3c')]));if(_0x3ad6d4[_0xe118('0x3a')][_0xe118('0x48')]){_0xff7ac0['where']=_[_0xe118('0x46')](_0xff7ac0[_0xe118('0x44')],{'$or':_[_0xe118('0x39')](_0xff7ac0[_0xe118('0x3e')],function(_0x18d6d8){var _0x129175={};_0x129175[_0x18d6d8]={'$like':'%'+_0x3ad6d4[_0xe118('0x3a')][_0xe118('0x48')]+'%'};return _0x129175;})});}if(_0x3ad6d4[_0xe118('0x3a')]['$gte']){var _0x120e6e=_0x3ad6d4[_0xe118('0x3a')][_0xe118('0x62')][_0xe118('0x63')](',');var _0x537789={};_0x537789[_0x120e6e[0x0]]={'$gte':moment(_0x120e6e[0x1])[_0xe118('0x64')](_0xe118('0x65'))};_0xff7ac0[_0xe118('0x44')]=_[_0xe118('0x46')](_0xff7ac0['where'],_0x537789);}_0xff7ac0=_[_0xe118('0x46')]({},_0xff7ac0,_0x3ad6d4[_0xe118('0x4f')]);return _0x51b70b['getMessages'](_0xff7ac0);}})[_0xe118('0x2b')](function(_0x2fa3b6){if(_0x2fa3b6){_0xd63dcb=_0x2fa3b6[_0xe118('0x40')];if(!_0x3ad6d4['query'][_0xe118('0x41')]('nolimit')){_0xff7ac0[_0xe118('0x25')]=qs[_0xe118('0x25')](_0x3ad6d4[_0xe118('0x3a')][_0xe118('0x25')]);_0xff7ac0['offset']=qs[_0xe118('0x22')](_0x3ad6d4[_0xe118('0x3a')][_0xe118('0x22')]);}return _0x51b70b['getMessages'](_0xff7ac0);}})[_0xe118('0x2b')](function(_0x224231){if(_0x224231){return _0x224231?{'count':_0xd63dcb,'rows':_0x224231}:null;}})['then'](respondWithResult(_0x275b53,null))[_0xe118('0x4b')](handleError(_0x275b53,null));}; \ No newline at end of file +var _0x28b0=['create','body','find','describe','getUnread','user','addMembers','omit','ids','getMembers','findOne','User','order','pick','removeMembers','addMessage','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','ChatGroup','includeAll','include','findAll','params','catch'];(function(_0x18ca74,_0x1fe2aa){var _0x5c853b=function(_0x396362){while(--_0x396362){_0x18ca74['push'](_0x18ca74['shift']());}};_0x5c853b(++_0x1fe2aa);}(_0x28b0,0xcc));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x028b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x028b('0x1'));var rp=require(_0x028b('0x2'));var moment=require(_0x028b('0x3'));var BPromise=require(_0x028b('0x4'));var Mustache=require('mustache');var util=require(_0x028b('0x5'));var path=require(_0x028b('0x6'));var sox=require(_0x028b('0x7'));var csv=require(_0x028b('0x8'));var ejs=require(_0x028b('0x9'));var fs=require('fs');var fs_extra=require(_0x028b('0xa'));var _=require(_0x028b('0xb'));var squel=require(_0x028b('0xc'));var crypto=require('crypto');var jsforce=require(_0x028b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x028b('0x8'));var querystring=require('querystring');var Papa=require(_0x028b('0xe'));var Redis=require('ioredis');var authService=require(_0x028b('0xf'));var qs=require(_0x028b('0x10'));var as=require(_0x028b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x028b('0x12'));var utils=require(_0x028b('0x13'));var config=require(_0x028b('0x14'));var licenseUtil=require(_0x028b('0x15'));var db=require(_0x028b('0x16'))['db'];config[_0x028b('0x17')]=_['defaults'](config[_0x028b('0x17')],{'host':_0x028b('0x18'),'port':0x18eb});var socket=require(_0x028b('0x19'))(new Redis(config[_0x028b('0x17')]));require(_0x028b('0x1a'))['register'](socket);function respondWithStatusCode(_0x13a913,_0x589554){_0x589554=_0x589554||0xcc;return function(_0x2e6747){if(_0x2e6747){return _0x13a913['sendStatus'](_0x589554);}return _0x13a913[_0x028b('0x1b')](_0x589554)[_0x028b('0x1c')]();};}function respondWithResult(_0x4cf82a,_0x21ec89){_0x21ec89=_0x21ec89||0xc8;return function(_0x3c37bf){if(_0x3c37bf){return _0x4cf82a['status'](_0x21ec89)[_0x028b('0x1d')](_0x3c37bf);}};}function respondWithFilteredResult(_0x235219,_0x5d46ed){return function(_0x118b17){if(_0x118b17){var _0x2a8fcf=typeof _0x5d46ed[_0x028b('0x1e')]===_0x028b('0x1f')&&typeof _0x5d46ed[_0x028b('0x20')]===_0x028b('0x1f');var _0x176d89=_0x118b17['count'];var _0x41e72d=_0x2a8fcf?0x0:_0x5d46ed[_0x028b('0x1e')];var _0x1085de=_0x2a8fcf?_0x118b17[_0x028b('0x21')]:_0x5d46ed[_0x028b('0x1e')]+_0x5d46ed[_0x028b('0x20')];var _0x3de8af;if(_0x1085de>=_0x176d89){_0x1085de=_0x176d89;_0x3de8af=0xc8;}else{_0x3de8af=0xce;}_0x235219[_0x028b('0x1b')](_0x3de8af);return _0x235219[_0x028b('0x22')]('Content-Range',_0x41e72d+'-'+_0x1085de+'/'+_0x176d89)[_0x028b('0x1d')](_0x118b17);}return null;};}function patchUpdates(_0xa4f05e){return function(_0x46d66c){try{jsonpatch['apply'](_0x46d66c,_0xa4f05e,!![]);}catch(_0x29029c){return BPromise[_0x028b('0x23')](_0x29029c);}return _0x46d66c[_0x028b('0x24')]();};}function saveUpdates(_0x352558,_0x22eea0){return function(_0x447c96){if(_0x447c96){return _0x447c96[_0x028b('0x25')](_0x352558)[_0x028b('0x26')](function(_0xd8804d){return _0xd8804d;});}return null;};}function removeEntity(_0x5d4573,_0x43ab1a){return function(_0x5e7d02){if(_0x5e7d02){return _0x5e7d02['destroy']()['then'](function(){_0x5d4573[_0x028b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a528,_0x3ab27d){return function(_0x27d9aa){if(!_0x27d9aa){_0x19a528['sendStatus'](0x194);}return _0x27d9aa;};}function handleError(_0x3395c8,_0x3ae998){_0x3ae998=_0x3ae998||0x1f4;return function(_0x2fc8f1){logger[_0x028b('0x27')](_0x2fc8f1['stack']);if(_0x2fc8f1[_0x028b('0x28')]){delete _0x2fc8f1[_0x028b('0x28')];}_0x3395c8[_0x028b('0x1b')](_0x3ae998)[_0x028b('0x29')](_0x2fc8f1);};}exports[_0x028b('0x2a')]=function(_0x4c4320,_0x1afeab){var _0x41efec={},_0xb2c9c3={},_0x1908e9={'count':0x0,'rows':[]};var _0x5bcc40=_[_0x028b('0x2b')](db['ChatGroup'][_0x028b('0x2c')],function(_0x55e573){return{'name':_0x55e573[_0x028b('0x2d')],'type':_0x55e573[_0x028b('0x2e')][_0x028b('0x2f')]};});_0xb2c9c3[_0x028b('0x30')]=_['map'](_0x5bcc40,_0x028b('0x28'));_0xb2c9c3['query']=_[_0x028b('0x31')](_0x4c4320[_0x028b('0x32')]);_0xb2c9c3[_0x028b('0x33')]=_['intersection'](_0xb2c9c3[_0x028b('0x30')],_0xb2c9c3[_0x028b('0x32')]);_0x41efec[_0x028b('0x34')]=_[_0x028b('0x35')](_0xb2c9c3[_0x028b('0x30')],qs[_0x028b('0x36')](_0x4c4320['query']['fields']));_0x41efec[_0x028b('0x34')]=_0x41efec[_0x028b('0x34')][_0x028b('0x37')]?_0x41efec[_0x028b('0x34')]:_0xb2c9c3[_0x028b('0x30')];if(!_0x4c4320[_0x028b('0x32')][_0x028b('0x38')](_0x028b('0x39'))){_0x41efec[_0x028b('0x20')]=qs[_0x028b('0x20')](_0x4c4320['query'][_0x028b('0x20')]);_0x41efec['offset']=qs['offset'](_0x4c4320[_0x028b('0x32')][_0x028b('0x1e')]);}_0x41efec['order']=qs[_0x028b('0x3a')](_0x4c4320['query'][_0x028b('0x3a')]);_0x41efec['where']=qs['filters'](_['pick'](_0x4c4320[_0x028b('0x32')],_0xb2c9c3[_0x028b('0x33')]),_0x5bcc40);if(_0x4c4320[_0x028b('0x32')][_0x028b('0x3b')]){_0x41efec[_0x028b('0x3c')]=_[_0x028b('0x3d')](_0x41efec[_0x028b('0x3c')],{'$or':_['map'](_0x5bcc40,function(_0x135f64){if(_0x135f64[_0x028b('0x2e')]!==_0x028b('0x3e')){var _0xa9602f={};_0xa9602f[_0x135f64[_0x028b('0x28')]]={'$like':'%'+_0x4c4320[_0x028b('0x32')]['filter']+'%'};return _0xa9602f;}})});}_0x41efec=_['merge']({},_0x41efec,_0x4c4320['options']);var _0x3dda46={'where':_0x41efec['where']};return db[_0x028b('0x3f')]['count'](_0x3dda46)[_0x028b('0x26')](function(_0x4b862a){_0x1908e9['count']=_0x4b862a;if(_0x4c4320[_0x028b('0x32')][_0x028b('0x40')]){_0x41efec[_0x028b('0x41')]=[{'all':!![]}];}return db['ChatGroup'][_0x028b('0x42')](_0x41efec);})[_0x028b('0x26')](function(_0x18107e){_0x1908e9['rows']=_0x18107e;return _0x1908e9;})[_0x028b('0x26')](respondWithFilteredResult(_0x1afeab,_0x41efec))['catch'](handleError(_0x1afeab,null));};exports['show']=function(_0x37fb92,_0x4481f6){var _0x1cdd12={'raw':!![],'where':{'id':_0x37fb92[_0x028b('0x43')]['id']}},_0x4170fc={};_0x4170fc['model']=_[_0x028b('0x31')](db[_0x028b('0x3f')][_0x028b('0x2c')]);_0x4170fc[_0x028b('0x32')]=_[_0x028b('0x31')](_0x37fb92[_0x028b('0x32')]);_0x4170fc[_0x028b('0x33')]=_[_0x028b('0x35')](_0x4170fc[_0x028b('0x30')],_0x4170fc[_0x028b('0x32')]);_0x1cdd12[_0x028b('0x34')]=_[_0x028b('0x35')](_0x4170fc[_0x028b('0x30')],qs[_0x028b('0x36')](_0x37fb92['query'][_0x028b('0x36')]));_0x1cdd12[_0x028b('0x34')]=_0x1cdd12[_0x028b('0x34')]['length']?_0x1cdd12[_0x028b('0x34')]:_0x4170fc[_0x028b('0x30')];if(_0x37fb92[_0x028b('0x32')][_0x028b('0x40')]){_0x1cdd12[_0x028b('0x41')]=[{'all':!![]}];}_0x1cdd12=_['merge']({},_0x1cdd12,_0x37fb92['options']);return db[_0x028b('0x3f')]['find'](_0x1cdd12)[_0x028b('0x26')](handleEntityNotFound(_0x4481f6,null))[_0x028b('0x26')](respondWithResult(_0x4481f6,null))[_0x028b('0x44')](handleError(_0x4481f6,null));};exports[_0x028b('0x45')]=function(_0x3d613a,_0x4adbd5){return db['ChatGroup']['create'](_0x3d613a[_0x028b('0x46')],{})[_0x028b('0x26')](respondWithResult(_0x4adbd5,0xc9))[_0x028b('0x44')](handleError(_0x4adbd5,null));};exports['update']=function(_0x55f98f,_0x35d663){if(_0x55f98f[_0x028b('0x46')]['id']){delete _0x55f98f[_0x028b('0x46')]['id'];}return db['ChatGroup'][_0x028b('0x47')]({'where':{'id':_0x55f98f['params']['id']}})[_0x028b('0x26')](handleEntityNotFound(_0x35d663,null))['then'](saveUpdates(_0x55f98f[_0x028b('0x46')],null))['then'](respondWithResult(_0x35d663,null))[_0x028b('0x44')](handleError(_0x35d663,null));};exports['destroy']=function(_0x9ef9d3,_0x145e26){return db[_0x028b('0x3f')][_0x028b('0x47')]({'where':{'id':_0x9ef9d3[_0x028b('0x43')]['id']}})['then'](handleEntityNotFound(_0x145e26,null))[_0x028b('0x26')](removeEntity(_0x145e26,null))[_0x028b('0x44')](handleError(_0x145e26,null));};exports[_0x028b('0x48')]=function(_0x56757e,_0x54dd36){return db['ChatGroup'][_0x028b('0x48')]()[_0x028b('0x26')](respondWithResult(_0x54dd36,null))[_0x028b('0x44')](handleError(_0x54dd36,null));};exports[_0x028b('0x49')]=function(_0x357beb,_0x1da2d8,_0x4ac890){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x357beb['params']['id'],'ToId':_0x357beb[_0x028b('0x4a')]['id'],'read':![]}})[_0x028b('0x26')](function(_0x1b6e76){return{'id':_['toInteger'](_0x357beb['params']['id']),'count':_0x1b6e76};})['then'](respondWithResult(_0x1da2d8,null))[_0x028b('0x44')](handleError(_0x1da2d8,null));};exports[_0x028b('0x4b')]=function(_0x1e15a6,_0x1eb346,_0x1a33f4){return db[_0x028b('0x3f')][_0x028b('0x47')]({'where':{'id':_0x1e15a6[_0x028b('0x43')]['id']}})[_0x028b('0x26')](handleEntityNotFound(_0x1eb346,null))[_0x028b('0x26')](function(_0x2b7208){if(_0x2b7208){return _0x2b7208[_0x028b('0x4b')](_0x1e15a6[_0x028b('0x46')]['ids'],_[_0x028b('0x4c')](_0x1e15a6[_0x028b('0x46')],[_0x028b('0x4d'),'id'])||{});}})[_0x028b('0x26')](respondWithResult(_0x1eb346,null))[_0x028b('0x44')](handleError(_0x1eb346,null));};exports[_0x028b('0x4e')]=function(_0x140bcd,_0x2e1928,_0x1666df){var _0x367688={};var _0x57846a={};var _0xc6d9fe;var _0x233e10;return db[_0x028b('0x3f')][_0x028b('0x4f')]({'where':{'id':_0x140bcd[_0x028b('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e1928,null))[_0x028b('0x26')](function(_0x3671a6){if(_0x3671a6){_0xc6d9fe=_0x3671a6;_0x57846a[_0x028b('0x30')]=_['keys'](db[_0x028b('0x50')]['rawAttributes']);_0x57846a[_0x028b('0x32')]=_[_0x028b('0x31')](_0x140bcd['query']);_0x57846a[_0x028b('0x33')]=_['intersection'](_0x57846a[_0x028b('0x30')],_0x57846a[_0x028b('0x32')]);_0x367688['attributes']=_[_0x028b('0x35')](_0x57846a[_0x028b('0x30')],qs[_0x028b('0x36')](_0x140bcd[_0x028b('0x32')][_0x028b('0x36')]));_0x367688['attributes']=_0x367688[_0x028b('0x34')][_0x028b('0x37')]?_0x367688['attributes']:_0x57846a[_0x028b('0x30')];_0x367688[_0x028b('0x51')]=qs['sort'](_0x140bcd['query'][_0x028b('0x3a')]);_0x367688['where']=qs['filters'](_[_0x028b('0x52')](_0x140bcd['query'],_0x57846a[_0x028b('0x33')]));if(_0x140bcd['query'][_0x028b('0x3b')]){_0x367688[_0x028b('0x3c')]=_[_0x028b('0x3d')](_0x367688[_0x028b('0x3c')],{'$or':_[_0x028b('0x2b')](_0x367688[_0x028b('0x34')],function(_0x28a8c8){var _0x2f1a43={};_0x2f1a43[_0x28a8c8]={'$like':'%'+_0x140bcd[_0x028b('0x32')][_0x028b('0x3b')]+'%'};return _0x2f1a43;})});}_0x367688=_[_0x028b('0x3d')]({},_0x367688,_0x140bcd['options']);return _0xc6d9fe['getMembers'](_0x367688);}})[_0x028b('0x26')](function(_0x1388ba){if(_0x1388ba){_0x233e10=_0x1388ba[_0x028b('0x37')];if(!_0x140bcd[_0x028b('0x32')][_0x028b('0x38')]('nolimit')){_0x367688[_0x028b('0x20')]=qs[_0x028b('0x20')](_0x140bcd[_0x028b('0x32')][_0x028b('0x20')]);_0x367688[_0x028b('0x1e')]=qs[_0x028b('0x1e')](_0x140bcd[_0x028b('0x32')][_0x028b('0x1e')]);}return _0xc6d9fe[_0x028b('0x4e')](_0x367688);}})[_0x028b('0x26')](function(_0x5465f3){if(_0x5465f3){return _0x5465f3?{'count':_0x233e10,'rows':_0x5465f3}:null;}})[_0x028b('0x26')](respondWithResult(_0x2e1928,null))[_0x028b('0x44')](handleError(_0x2e1928,null));};exports[_0x028b('0x53')]=function(_0x2ef7b8,_0x38ff7c,_0x1b4cd3){return db[_0x028b('0x3f')]['find']({'where':{'id':_0x2ef7b8['params']['id']}})[_0x028b('0x26')](handleEntityNotFound(_0x38ff7c,null))[_0x028b('0x26')](function(_0x120154){if(_0x120154){return _0x120154[_0x028b('0x53')](_0x2ef7b8[_0x028b('0x32')][_0x028b('0x4d')]);}})['then'](respondWithStatusCode(_0x38ff7c,null))['catch'](handleError(_0x38ff7c,null));};exports[_0x028b('0x54')]=function(_0x508d1e,_0x28b985,_0x177b11){if(_0x508d1e['body']['id']){delete _0x508d1e[_0x028b('0x46')]['id'];}return db[_0x028b('0x3f')][_0x028b('0x47')]({'where':{'id':_0x508d1e[_0x028b('0x43')]['id']}})['then'](handleEntityNotFound(_0x28b985,null))['then'](function(_0x36a681){if(_0x36a681){_0x508d1e[_0x028b('0x46')]['ChatGroupId']=_0x36a681['id'];return db['ChatInternalMessage'][_0x028b('0x45')](_0x508d1e[_0x028b('0x46')]);}})[_0x028b('0x26')](respondWithResult(_0x28b985,null))[_0x028b('0x44')](handleError(_0x28b985,null));};exports['getMessages']=function(_0x1c54f0,_0x3328e9,_0x2d17d5){var _0x4bcbdc={};var _0x899ca8={};var _0x3c0247;var _0x2cc64a;return db[_0x028b('0x3f')]['findOne']({'where':{'id':_0x1c54f0[_0x028b('0x43')]['id']}})['then'](handleEntityNotFound(_0x3328e9,null))[_0x028b('0x26')](function(_0x1488c3){if(_0x1488c3){_0x3c0247=_0x1488c3;_0x899ca8[_0x028b('0x30')]=_[_0x028b('0x31')](db[_0x028b('0x55')][_0x028b('0x2c')]);_0x899ca8[_0x028b('0x32')]=_[_0x028b('0x31')](_0x1c54f0[_0x028b('0x32')]);_0x899ca8[_0x028b('0x33')]=_[_0x028b('0x35')](_0x899ca8[_0x028b('0x30')],_0x899ca8['query']);_0x4bcbdc[_0x028b('0x34')]=_[_0x028b('0x35')](_0x899ca8[_0x028b('0x30')],qs[_0x028b('0x36')](_0x1c54f0[_0x028b('0x32')][_0x028b('0x36')]));_0x4bcbdc['attributes']=_0x4bcbdc['attributes'][_0x028b('0x37')]?_0x4bcbdc['attributes']:_0x899ca8[_0x028b('0x30')];_0x4bcbdc['order']=qs[_0x028b('0x3a')](_0x1c54f0[_0x028b('0x32')][_0x028b('0x3a')]);_0x4bcbdc[_0x028b('0x3c')]=qs['filters'](_['pick'](_0x1c54f0['query'],_0x899ca8['filters']));if(_0x1c54f0[_0x028b('0x32')][_0x028b('0x3b')]){_0x4bcbdc['where']=_[_0x028b('0x3d')](_0x4bcbdc[_0x028b('0x3c')],{'$or':_['map'](_0x4bcbdc[_0x028b('0x34')],function(_0x4d7ca4){var _0x13b5d0={};_0x13b5d0[_0x4d7ca4]={'$like':'%'+_0x1c54f0[_0x028b('0x32')][_0x028b('0x3b')]+'%'};return _0x13b5d0;})});}if(_0x1c54f0[_0x028b('0x32')]['$gte']){var _0x50b17c=_0x1c54f0[_0x028b('0x32')][_0x028b('0x56')][_0x028b('0x57')](',');var _0x4de26e={};_0x4de26e[_0x50b17c[0x0]]={'$gte':moment(_0x50b17c[0x1])[_0x028b('0x58')](_0x028b('0x59'))};_0x4bcbdc[_0x028b('0x3c')]=_[_0x028b('0x3d')](_0x4bcbdc['where'],_0x4de26e);}_0x4bcbdc=_['merge']({},_0x4bcbdc,_0x1c54f0[_0x028b('0x5a')]);return _0x3c0247['getMessages'](_0x4bcbdc);}})[_0x028b('0x26')](function(_0x1dc66d){if(_0x1dc66d){_0x2cc64a=_0x1dc66d[_0x028b('0x37')];if(!_0x1c54f0[_0x028b('0x32')]['hasOwnProperty']('nolimit')){_0x4bcbdc[_0x028b('0x20')]=qs[_0x028b('0x20')](_0x1c54f0[_0x028b('0x32')][_0x028b('0x20')]);_0x4bcbdc[_0x028b('0x1e')]=qs[_0x028b('0x1e')](_0x1c54f0[_0x028b('0x32')][_0x028b('0x1e')]);}return _0x3c0247['getMessages'](_0x4bcbdc);}})[_0x028b('0x26')](function(_0x3b7c90){if(_0x3b7c90){return _0x3b7c90?{'count':_0x2cc64a,'rows':_0x3b7c90}:null;}})[_0x028b('0x26')](respondWithResult(_0x3328e9,null))['catch'](handleError(_0x3328e9,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6975a93..4db91e6 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 _0x524e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','ChatGroup'];(function(_0xdd2348,_0x5d3232){var _0x2e0a02=function(_0x38e687){while(--_0x38e687){_0xdd2348['push'](_0xdd2348['shift']());}};_0x2e0a02(++_0x5d3232);}(_0x524e,0x15e));var _0xe524=function(_0x5166c6,_0x2d546b){_0x5166c6=_0x5166c6-0x0;var _0x131daa=_0x524e[_0x5166c6];return _0x131daa;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0xe524('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe524('0x1')](0x0);var events={'afterCreate':_0xe524('0x2'),'afterUpdate':_0xe524('0x3'),'afterDestroy':_0xe524('0x4')};function emitEvent(_0x379eb1){return function(_0xabd694,_0x32c90b,_0x10d37a){ChatGroupEvents[_0xe524('0x5')](_0x379eb1+':'+_0xabd694['id'],_0xabd694);ChatGroupEvents['emit'](_0x379eb1,_0xabd694);_0x10d37a(null);};}for(var e in events){if(events[_0xe524('0x6')](e)){var event=events[e];ChatGroup[_0xe524('0x7')](e,emitEvent(event));}}module[_0xe524('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x8969=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','remove'];(function(_0x442db0,_0x19392b){var _0x328bc1=function(_0x5bb704){while(--_0x5bb704){_0x442db0['push'](_0x442db0['shift']());}};_0x328bc1(++_0x19392b);}(_0x8969,0xc2));var _0x9896=function(_0x125ea4,_0xcb917f){_0x125ea4=_0x125ea4-0x0;var _0x4e8e73=_0x8969[_0x125ea4];return _0x4e8e73;};'use strict';var EventEmitter=require(_0x9896('0x0'));var ChatGroup=require(_0x9896('0x1'))['db'][_0x9896('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9896('0x3')](0x0);var events={'afterCreate':_0x9896('0x4'),'afterUpdate':'update','afterDestroy':_0x9896('0x5')};function emitEvent(_0x180bfa){return function(_0x1aeed5,_0x2cf7f6,_0x3d2dea){ChatGroupEvents[_0x9896('0x6')](_0x180bfa+':'+_0x1aeed5['id'],_0x1aeed5);ChatGroupEvents['emit'](_0x180bfa,_0x1aeed5);_0x3d2dea(null);};}for(var e in events){if(events[_0x9896('0x7')](e)){var event=events[e];ChatGroup[_0x9896('0x8')](e,emitEvent(event));}}module[_0x9896('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 239762e..2f9715f 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 _0x15c0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x5edcc3,_0xfb8f0a){var _0x328c8b=function(_0x57efa4){while(--_0x57efa4){_0x5edcc3['push'](_0x5edcc3['shift']());}};_0x328c8b(++_0xfb8f0a);}(_0x15c0,0x12c));var _0x015c=function(_0x28e388,_0x5ed424){_0x28e388=_0x28e388-0x0;var _0x45cb01=_0x15c0[_0x28e388];return _0x45cb01;};'use strict';var _=require(_0x015c('0x0'));var util=require(_0x015c('0x1'));var logger=require(_0x015c('0x2'))(_0x015c('0x3'));var moment=require(_0x015c('0x4'));var BPromise=require(_0x015c('0x5'));var rp=require(_0x015c('0x6'));var fs=require('fs');var path=require(_0x015c('0x7'));var rimraf=require(_0x015c('0x8'));var config=require(_0x015c('0x9'));var attributes=require(_0x015c('0xa'));module[_0x015c('0xb')]=function(_0x1f5a92,_0x26df75){return _0x1f5a92[_0x015c('0xc')](_0x015c('0xd'),attributes,{'tableName':_0x015c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecd8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','lodash','../../config/logger','api'];(function(_0x5d4078,_0x8da411){var _0x49fb8f=function(_0x2686cf){while(--_0x2686cf){_0x5d4078['push'](_0x5d4078['shift']());}};_0x49fb8f(++_0x8da411);}(_0xecd8,0xba));var _0x8ecd=function(_0x3ff950,_0x4cf40e){_0x3ff950=_0x3ff950-0x0;var _0x4a8799=_0xecd8[_0x3ff950];return _0x4a8799;};'use strict';var _=require(_0x8ecd('0x0'));var util=require('util');var logger=require(_0x8ecd('0x1'))(_0x8ecd('0x2'));var moment=require(_0x8ecd('0x3'));var BPromise=require(_0x8ecd('0x4'));var rp=require(_0x8ecd('0x5'));var fs=require('fs');var path=require(_0x8ecd('0x6'));var rimraf=require(_0x8ecd('0x7'));var config=require(_0x8ecd('0x8'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x54b8ad,_0x6d42dc){return _0x54b8ad['define']('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 897483b..a0a4ef8 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 _0xdbf7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','message','lodash','util','moment'];(function(_0x92ca66,_0x221539){var _0x442565=function(_0x4605cb){while(--_0x4605cb){_0x92ca66['push'](_0x92ca66['shift']());}};_0x442565(++_0x221539);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x1f0448,_0xa2865f){_0x1f0448=_0x1f0448-0x0;var _0x16fe78=_0xdbf7[_0x1f0448];return _0x16fe78;};'use strict';var _=require(_0x7dbf('0x0'));var util=require(_0x7dbf('0x1'));var moment=require(_0x7dbf('0x2'));var BPromise=require(_0x7dbf('0x3'));var rs=require(_0x7dbf('0x4'));var fs=require('fs');var Redis=require(_0x7dbf('0x5'));var db=require(_0x7dbf('0x6'))['db'];var utils=require(_0x7dbf('0x7'));var logger=require('../../config/logger')(_0x7dbf('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7dbf('0x9')][_0x7dbf('0xa')]({'port':0x232a});config[_0x7dbf('0xb')]=_[_0x7dbf('0xc')](config[_0x7dbf('0xb')],{'host':_0x7dbf('0xd'),'port':0x18eb});var socket=require(_0x7dbf('0xe'))(new Redis(config[_0x7dbf('0xb')]));require(_0x7dbf('0xf'))[_0x7dbf('0x10')](socket);function respondWithRpcPromise(_0x3591ee,_0x406ad4,_0x1c5276){return new BPromise(function(_0x13deaa,_0x3a27c8){return client['request'](_0x3591ee,_0x1c5276)[_0x7dbf('0x11')](function(_0x101a8a){logger[_0x7dbf('0x12')](_0x7dbf('0x13'),_0x406ad4,_0x7dbf('0x14'));logger[_0x7dbf('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x406ad4,_0x7dbf('0x14'),JSON['stringify'](_0x101a8a));if(_0x101a8a['error']){if(_0x101a8a['error']['code']===0x1f4){logger[_0x7dbf('0x16')](_0x7dbf('0x13'),_0x406ad4,_0x101a8a[_0x7dbf('0x16')]['message']);return _0x3a27c8(_0x101a8a[_0x7dbf('0x16')][_0x7dbf('0x17')]);}logger[_0x7dbf('0x16')]('ChatGroup,\x20%s,\x20%s',_0x406ad4,_0x101a8a[_0x7dbf('0x16')][_0x7dbf('0x17')]);return _0x13deaa(_0x101a8a[_0x7dbf('0x16')][_0x7dbf('0x17')]);}else{logger[_0x7dbf('0x12')](_0x7dbf('0x13'),_0x406ad4,_0x7dbf('0x14'));_0x13deaa(_0x101a8a['result'][_0x7dbf('0x17')]);}})['catch'](function(_0x46940c){logger['error'](_0x7dbf('0x13'),_0x406ad4,_0x46940c);_0x3a27c8(_0x46940c);});});} \ No newline at end of file +var _0xbbb8=['client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4bd049,_0x4e3176){var _0x1478d2=function(_0x1b5480){while(--_0x1b5480){_0x4bd049['push'](_0x4bd049['shift']());}};_0x1478d2(++_0x4e3176);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x1c136e,_0x451288){_0x1c136e=_0x1c136e-0x0;var _0x4754c5=_0xbbb8[_0x1c136e];return _0x4754c5;};'use strict';var _=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var moment=require('moment');var BPromise=require(_0x8bbb('0x2'));var rs=require(_0x8bbb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bbb('0x4'))['db'];var utils=require(_0x8bbb('0x5'));var logger=require(_0x8bbb('0x6'))(_0x8bbb('0x7'));var config=require(_0x8bbb('0x8'));var jayson=require(_0x8bbb('0x9'));var client=jayson[_0x8bbb('0xa')][_0x8bbb('0xb')]({'port':0x232a});config[_0x8bbb('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8bbb('0xd'))(new Redis(config[_0x8bbb('0xc')]));require(_0x8bbb('0xe'))[_0x8bbb('0xf')](socket);function respondWithRpcPromise(_0x95e93a,_0x45e1bd,_0x1c220e){return new BPromise(function(_0x3f571f,_0x598827){return client[_0x8bbb('0x10')](_0x95e93a,_0x1c220e)[_0x8bbb('0x11')](function(_0x37ce77){logger['info'](_0x8bbb('0x12'),_0x45e1bd,_0x8bbb('0x13'));logger[_0x8bbb('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x45e1bd,_0x8bbb('0x13'),JSON[_0x8bbb('0x15')](_0x37ce77));if(_0x37ce77[_0x8bbb('0x16')]){if(_0x37ce77[_0x8bbb('0x16')]['code']===0x1f4){logger[_0x8bbb('0x16')](_0x8bbb('0x12'),_0x45e1bd,_0x37ce77['error'][_0x8bbb('0x17')]);return _0x598827(_0x37ce77[_0x8bbb('0x16')][_0x8bbb('0x17')]);}logger[_0x8bbb('0x16')](_0x8bbb('0x12'),_0x45e1bd,_0x37ce77[_0x8bbb('0x16')][_0x8bbb('0x17')]);return _0x3f571f(_0x37ce77[_0x8bbb('0x16')][_0x8bbb('0x17')]);}else{logger[_0x8bbb('0x18')](_0x8bbb('0x12'),_0x45e1bd,_0x8bbb('0x13'));_0x3f571f(_0x37ce77[_0x8bbb('0x19')]['message']);}})[_0x8bbb('0x1a')](function(_0x28e52a){logger[_0x8bbb('0x16')](_0x8bbb('0x12'),_0x45e1bd,_0x28e52a);_0x598827(_0x28e52a);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 5630c6c..5fb8e71 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 _0x4b5d=['chatGroup:','./chatGroup.events','save','remove','emit','removeListener'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4b5d,0x1c9));var _0xd4b5=function(_0x1fd3e2,_0x1a6772){_0x1fd3e2=_0x1fd3e2-0x0;var _0x5a9210=_0x4b5d[_0x1fd3e2];return _0x5a9210;};'use strict';var ChatGroupEvents=require(_0xd4b5('0x0'));var events=[_0xd4b5('0x1'),_0xd4b5('0x2'),'update'];function createListener(_0x1e29b9,_0x1c62b1){return function(_0xba9985){_0x1c62b1[_0xd4b5('0x3')](_0x1e29b9,_0xba9985);};}function removeListener(_0xa87b0b,_0x338155){return function(){ChatGroupEvents[_0xd4b5('0x4')](_0xa87b0b,_0x338155);};}exports['register']=function(_0x3efefd){for(var _0x4b1666=0x0,_0x424fa2=events['length'];_0x4b1666<_0x424fa2;_0x4b1666++){var _0x459c29=events[_0x4b1666];var _0x139576=createListener(_0xd4b5('0x5')+_0x459c29,_0x3efefd);ChatGroupEvents['on'](_0x459c29,_0x139576);}}; \ No newline at end of file +var _0x3630=['emit','removeListener','register','length','remove','update'];(function(_0x24a8e7,_0x417bae){var _0x470122=function(_0x394d36){while(--_0x394d36){_0x24a8e7['push'](_0x24a8e7['shift']());}};_0x470122(++_0x417bae);}(_0x3630,0x178));var _0x0363=function(_0x41cd5b,_0x382a0c){_0x41cd5b=_0x41cd5b-0x0;var _0x340594=_0x3630[_0x41cd5b];return _0x340594;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x0363('0x0'),_0x0363('0x1')];function createListener(_0x695bd1,_0x4cf97f){return function(_0x58c934){_0x4cf97f[_0x0363('0x2')](_0x695bd1,_0x58c934);};}function removeListener(_0x2f1160,_0x13379f){return function(){ChatGroupEvents[_0x0363('0x3')](_0x2f1160,_0x13379f);};}exports[_0x0363('0x4')]=function(_0x4d615e){for(var _0x3ea921=0x0,_0x5ca843=events[_0x0363('0x5')];_0x3ea921<_0x5ca843;_0x3ea921++){var _0x401d08=events[_0x3ea921];var _0x59ea7d=createListener('chatGroup:'+_0x401d08,_0x4d615e);ChatGroupEvents['on'](_0x401d08,_0x59ea7d);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index aa324f6..8475e17 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 _0xf5b5=['/:id/members','create','addMembers','post','/:id/messages','addMessage','/:id','destroy','delete','removeMembers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','index','get','describe','isAuthenticated','show','/:id/unread','getUnread'];(function(_0x27aa97,_0x4296ea){var _0x2dddd8=function(_0x1b0590){while(--_0x1b0590){_0x27aa97['push'](_0x27aa97['shift']());}};_0x2dddd8(++_0x4296ea);}(_0xf5b5,0x192));var _0x5f5b=function(_0x94c52b,_0x408a6c){_0x94c52b=_0x94c52b-0x0;var _0x2c0c54=_0xf5b5[_0x94c52b];return _0x2c0c54;};'use strict';var multer=require(_0x5f5b('0x0'));var util=require(_0x5f5b('0x1'));var path=require(_0x5f5b('0x2'));var timeout=require(_0x5f5b('0x3'));var express=require(_0x5f5b('0x4'));var router=express[_0x5f5b('0x5')]();var fs_extra=require(_0x5f5b('0x6'));var auth=require(_0x5f5b('0x7'));var interaction=require(_0x5f5b('0x8'));var config=require(_0x5f5b('0x9'));var controller=require(_0x5f5b('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x5f5b('0xb')]);router[_0x5f5b('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x5f5b('0xd')]);router[_0x5f5b('0xc')]('/:id',auth[_0x5f5b('0xe')](),controller[_0x5f5b('0xf')]);router[_0x5f5b('0xc')](_0x5f5b('0x10'),auth[_0x5f5b('0xe')](),controller[_0x5f5b('0x11')]);router[_0x5f5b('0xc')](_0x5f5b('0x12'),auth[_0x5f5b('0xe')](),controller['getMembers']);router['get']('/:id/messages',auth[_0x5f5b('0xe')](),controller['getMessages']);router['post']('/',auth[_0x5f5b('0xe')](),controller[_0x5f5b('0x13')]);router['post'](_0x5f5b('0x12'),auth[_0x5f5b('0xe')](),controller[_0x5f5b('0x14')]);router[_0x5f5b('0x15')](_0x5f5b('0x16'),auth['isAuthenticated'](),controller[_0x5f5b('0x17')]);router['put'](_0x5f5b('0x18'),auth[_0x5f5b('0xe')](),controller['update']);router['delete']('/:id',auth[_0x5f5b('0xe')](),controller[_0x5f5b('0x19')]);router[_0x5f5b('0x1a')](_0x5f5b('0x12'),auth['isAuthenticated'](),controller[_0x5f5b('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x1259=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','post','addMessage','put','update','destroy','removeMembers','connect-timeout'];(function(_0x2f9854,_0x23b8bb){var _0x3be4df=function(_0x47187c){while(--_0x47187c){_0x2f9854['push'](_0x2f9854['shift']());}};_0x3be4df(++_0x23b8bb);}(_0x1259,0xfc));var _0x9125=function(_0x360581,_0x208bdc){_0x360581=_0x360581-0x0;var _0x3c0f5c=_0x1259[_0x360581];return _0x3c0f5c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9125('0x0'));var express=require('express');var router=express[_0x9125('0x1')]();var fs_extra=require(_0x9125('0x2'));var auth=require(_0x9125('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9125('0x4'));var controller=require(_0x9125('0x5'));router['get']('/',auth[_0x9125('0x6')](),controller[_0x9125('0x7')]);router[_0x9125('0x8')](_0x9125('0x9'),auth[_0x9125('0x6')](),controller[_0x9125('0xa')]);router[_0x9125('0x8')](_0x9125('0xb'),auth[_0x9125('0x6')](),controller[_0x9125('0xc')]);router[_0x9125('0x8')](_0x9125('0xd'),auth[_0x9125('0x6')](),controller[_0x9125('0xe')]);router[_0x9125('0x8')](_0x9125('0xf'),auth[_0x9125('0x6')](),controller['getMembers']);router[_0x9125('0x8')](_0x9125('0x10'),auth[_0x9125('0x6')](),controller['getMessages']);router[_0x9125('0x11')]('/',auth[_0x9125('0x6')](),controller['create']);router['post'](_0x9125('0xf'),auth[_0x9125('0x6')](),controller['addMembers']);router['post'](_0x9125('0x10'),auth[_0x9125('0x6')](),controller[_0x9125('0x12')]);router[_0x9125('0x13')](_0x9125('0xb'),auth[_0x9125('0x6')](),controller[_0x9125('0x14')]);router['delete'](_0x9125('0xb'),auth['isAuthenticated'](),controller[_0x9125('0x15')]);router['delete'](_0x9125('0xf'),auth[_0x9125('0x6')](),controller[_0x9125('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 25121a2..ee1bf91 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 _0x915a=['ENUM','thumb','TEXT','STRING','DATE','out','sequelize','exports','BOOLEAN','INTEGER'];(function(_0xfbe187,_0x2744fa){var _0x49e7ec=function(_0x3dff25){while(--_0x3dff25){_0xfbe187['push'](_0xfbe187['shift']());}};_0x49e7ec(++_0x2744fa);}(_0x915a,0x1d2));var _0xa915=function(_0x1f1b6e,_0x490a54){_0x1f1b6e=_0x1f1b6e-0x0;var _0x389d0f=_0x915a[_0x1f1b6e];return _0x389d0f;};'use strict';var Sequelize=require(_0xa915('0x0'));module[_0xa915('0x1')]={'closed':{'type':Sequelize[_0xa915('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa915('0x3')]},'ratingType':{'type':Sequelize[_0xa915('0x4')]('star',_0xa915('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xa915('0x6')]},'mailTranscript':{'type':Sequelize[_0xa915('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa915('0x8')]},'disposition':{'type':Sequelize[_0xa915('0x7')]},'secondDisposition':{'type':Sequelize[_0xa915('0x7')]},'thirdDisposition':{'type':Sequelize[_0xa915('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xa915('0x7')]},'osName':{'type':Sequelize[_0xa915('0x7')]},'osVersion':{'type':Sequelize[_0xa915('0x7')]},'deviceModel':{'type':Sequelize[_0xa915('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xa915('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa915('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xa915('0x8')]},'lastMsgAt':{'type':Sequelize[_0xa915('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xa915('0x4')]('in',_0xa915('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xa915('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x236c=['long','sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x3c0e33,_0x4e9903){var _0x48d10c=function(_0x227823){while(--_0x227823){_0x3c0e33['push'](_0x3c0e33['shift']());}};_0x48d10c(++_0x4e9903);}(_0x236c,0x155));var _0xc236=function(_0x55d351,_0x209cb9){_0x55d351=_0x55d351-0x0;var _0x3a75bd=_0x236c[_0x55d351];return _0x3a75bd;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc236('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc236('0x2')]},'ratingType':{'type':Sequelize[_0xc236('0x3')](_0xc236('0x4'),_0xc236('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xc236('0x6')]},'pathTranscript':{'type':Sequelize[_0xc236('0x6')]},'mailTranscript':{'type':Sequelize[_0xc236('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc236('0x8')]},'disposition':{'type':Sequelize[_0xc236('0x7')]},'secondDisposition':{'type':Sequelize[_0xc236('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc236('0x7')]},'browserName':{'type':Sequelize[_0xc236('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xc236('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xc236('0x7')]},'referer':{'type':Sequelize[_0xc236('0x6')]},'customerIp':{'type':Sequelize[_0xc236('0x7')]},'formData':{'type':Sequelize[_0xc236('0x6')](_0xc236('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xc236('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xc236('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc236('0x7')]},'customerPort':{'type':Sequelize[_0xc236('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xc236('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 30c1820..3d0fdcd 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 _0x5eb8=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','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)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','rows','show','params','includeAll','include','options','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','CmContact','%s%d','agentAlias','agentIdentifier','website_alias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','Mail\x20Transcript','addMessage','ids','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','omit','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','transcript-%d-%s.zip','firstName','lastName','attachments','Account','Owner','mkdirSync','Chat','N.A.','closedAt','referer','customerIp','customerPort','tail','existsSync','renderFile','.pdf','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','render','body','interaction','map','TagIds','Tags','forEach','catch','index','ChatInteraction','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','from','tools_tags','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','User','UserId','some','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte'];(function(_0x212b03,_0x1f1b50){var _0x423115=function(_0x35ab9d){while(--_0x35ab9d){_0x212b03['push'](_0x212b03['shift']());}};_0x423115(++_0x1f1b50);}(_0x5eb8,0xb0));var _0x85eb=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x5eb8[_0x14a862];return _0x245eb5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var pdf=require(_0x85eb('0x14'));var hardwareService=require(_0x85eb('0x15'));var logger=require('../../config/logger')(_0x85eb('0x16'));var utils=require(_0x85eb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x85eb('0x18'));var db=require(_0x85eb('0x19'))['db'];config[_0x85eb('0x1a')]=_[_0x85eb('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x85eb('0x1c'))(new Redis(config['redis']));require(_0x85eb('0x1d'))[_0x85eb('0x1e')](socket);var jayson=require(_0x85eb('0x1f'));var client=jayson[_0x85eb('0x20')][_0x85eb('0x21')]({'port':0x232b});var client9004=jayson['client'][_0x85eb('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x59237b,_0x17140b,_0x10c2c9,_0x3e23e8){return new BPromise(function(_0x5deab1,_0x5dbeda){var _0x5c5cbb=_0x3e23e8||client;return _0x5c5cbb['request'](_0x59237b,_0x10c2c9)[_0x85eb('0x22')](function(_0x39ca96){logger[_0x85eb('0x23')](_0x85eb('0x24'),_0x17140b,_0x85eb('0x25'));logger[_0x85eb('0x26')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x17140b,_0x85eb('0x25'),JSON[_0x85eb('0x27')](_0x39ca96));if(_0x39ca96[_0x85eb('0x28')]){if(_0x39ca96['error']['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x17140b,_0x39ca96[_0x85eb('0x28')][_0x85eb('0x29')]);return _0x5dbeda(_0x39ca96[_0x85eb('0x28')][_0x85eb('0x29')]);}logger[_0x85eb('0x28')](_0x85eb('0x24'),_0x17140b,_0x39ca96['error']['message']);return _0x5deab1(_0x39ca96['error'][_0x85eb('0x29')]);}else{logger[_0x85eb('0x23')](_0x85eb('0x24'),_0x17140b,_0x85eb('0x25'));_0x5deab1(_0x39ca96[_0x85eb('0x2a')][_0x85eb('0x29')]);}})['catch'](function(_0x39d3fe){logger[_0x85eb('0x28')](_0x85eb('0x24'),_0x17140b,_0x39d3fe);_0x5dbeda(_0x39d3fe);});});}function respondWithStatusCode(_0x30e766,_0x3e2326){_0x3e2326=_0x3e2326||0xcc;return function(_0x57a03c){if(_0x57a03c){return _0x30e766[_0x85eb('0x2b')](_0x3e2326);}return _0x30e766[_0x85eb('0x2c')](_0x3e2326)[_0x85eb('0x2d')]();};}function respondWithResult(_0x3e7eb9,_0x40f13e){_0x40f13e=_0x40f13e||0xc8;return function(_0x29d262){if(_0x29d262){return _0x3e7eb9['status'](_0x40f13e)['json'](_0x29d262);}};}function respondWithFilteredResult(_0x37515c,_0x585f2a){return function(_0xa9b14f){if(_0xa9b14f){var _0x5255eb=typeof _0x585f2a[_0x85eb('0x2e')]===_0x85eb('0x2f')&&typeof _0x585f2a[_0x85eb('0x30')]===_0x85eb('0x2f');var _0xa67e1c=_0xa9b14f[_0x85eb('0x31')];var _0x41ed76=_0x5255eb?0x0:_0x585f2a['offset'];var _0x237f19=_0x5255eb?_0xa9b14f[_0x85eb('0x31')]:_0x585f2a['offset']+_0x585f2a[_0x85eb('0x30')];var _0x5af2de;if(_0x237f19>=_0xa67e1c){_0x237f19=_0xa67e1c;_0x5af2de=0xc8;}else{_0x5af2de=0xce;}_0x37515c['status'](_0x5af2de);return _0x37515c[_0x85eb('0x32')](_0x85eb('0x33'),_0x41ed76+'-'+_0x237f19+'/'+_0xa67e1c)[_0x85eb('0x34')](_0xa9b14f);}return null;};}function patchUpdates(_0x246dda){return function(_0x33c05f){try{jsonpatch[_0x85eb('0x35')](_0x33c05f,_0x246dda,!![]);}catch(_0x39b574){return BPromise[_0x85eb('0x36')](_0x39b574);}return _0x33c05f[_0x85eb('0x37')]();};}function saveUpdates(_0x1008bf,_0x4cbee0){return function(_0x14fe58){if(_0x14fe58){return _0x14fe58[_0x85eb('0x38')](_0x1008bf)['then'](function(_0x505321){return _0x505321;});}return null;};}function removeEntity(_0x340745,_0x13f245){return function(_0x38b96e){if(_0x38b96e){return _0x38b96e[_0x85eb('0x39')]()[_0x85eb('0x22')](function(){_0x340745[_0x85eb('0x2c')](0xcc)[_0x85eb('0x2d')]();});}};}function handleEntityNotFound(_0x35f092,_0x272a99){return function(_0x373e5f){if(!_0x373e5f){_0x35f092[_0x85eb('0x2b')](0x194);}return _0x373e5f;};}function handleError(_0x317d19,_0x317d86){_0x317d86=_0x317d86||0x1f4;return function(_0x33605a){logger['error'](_0x33605a[_0x85eb('0x3a')]);if(_0x33605a[_0x85eb('0x3b')]){delete _0x33605a['name'];}_0x317d19['status'](_0x317d86)[_0x85eb('0x3c')](_0x33605a);};}function getMustacheRender(_0xe22d16,_0x5389d8){return Mustache[_0x85eb('0x3d')](_0xe22d16,_['merge'](_0x5389d8[_0x85eb('0x3e')],{'contact':_0x5389d8['contact'],'message':_0x5389d8[_0x85eb('0x29')],'agent':_0x5389d8['agent'],'interaction':_0x5389d8[_0x85eb('0x3f')],'account':_0x5389d8['account']}))||'';}function getInteractionUsers(_0x38ab0f,_0x16202e){return new BPromise(function(_0x4de24e,_0x313989){try{if(_0x16202e[_0x38ab0f['id']]){_0x38ab0f['Users']=_[_0x85eb('0x40')](_0x16202e[_0x38ab0f['id']],function(_0x331260){return{'id':_0x331260['id'],'fullname':_0x331260['fullname']};});}}catch(_0x241488){_0x313989(_0x241488);}_0x4de24e(_0x38ab0f);});}function getInteractionTags(_0x4c25ed,_0x5495cf){return new BPromise(function(_0x1b8a71,_0x4edb2d){try{if(_0x4c25ed[_0x85eb('0x41')]){_0x4c25ed[_0x85eb('0x42')]=[];_0x4c25ed['TagIds']['split'](',')[_0x85eb('0x43')](function(_0x422ec3){_0x4c25ed['Tags']['push'](_0x5495cf[_0x422ec3]);});}delete _0x4c25ed[_0x85eb('0x41')];}catch(_0x2d1b32){_0x4edb2d(_0x2d1b32);}_0x1b8a71(_0x4c25ed);});}function updateChatInteraction(_0x2211f9,_0x202681,_0x3be961){return new BPromise(function(_0x5b7411,_0x5ccf8a){return getInteractionUsers(_0x2211f9,_0x3be961)[_0x85eb('0x22')](function(_0x208c27){return getInteractionTags(_0x208c27,_0x202681);})[_0x85eb('0x22')](function(_0x2ed39d){_0x5b7411(_0x2ed39d);})[_0x85eb('0x44')](function(_0x40e2a2){_0x5ccf8a(_0x40e2a2);});});}exports[_0x85eb('0x45')]=function(_0x469639,_0x540c7a){var _0x3a06af={},_0x1cabcb={},_0x5d90cc={'count':0x0,'rows':[]};var _0x1b77b3=_[_0x85eb('0x40')](db[_0x85eb('0x46')][_0x85eb('0x47')],function(_0x1b1559){return{'name':_0x1b1559[_0x85eb('0x48')],'type':_0x1b1559['type'][_0x85eb('0x49')]};});_0x1cabcb[_0x85eb('0x4a')]=_[_0x85eb('0x40')](_0x1b77b3,_0x85eb('0x3b'));_0x1cabcb[_0x85eb('0x4b')]=_[_0x85eb('0x4c')](_0x469639[_0x85eb('0x4b')]);_0x1cabcb[_0x85eb('0x4d')]=_['intersection'](_0x1cabcb[_0x85eb('0x4a')],_0x1cabcb[_0x85eb('0x4b')]);_0x3a06af[_0x85eb('0x4e')]=_[_0x85eb('0x4f')](_0x1cabcb[_0x85eb('0x4a')],qs[_0x85eb('0x50')](_0x469639[_0x85eb('0x4b')][_0x85eb('0x50')]));_0x3a06af[_0x85eb('0x4e')]=_0x3a06af[_0x85eb('0x4e')][_0x85eb('0x51')]?_0x3a06af[_0x85eb('0x4e')]:_0x1cabcb['model'];if(!_0x469639[_0x85eb('0x4b')][_0x85eb('0x52')](_0x85eb('0x53'))){_0x3a06af['limit']=qs[_0x85eb('0x30')](_0x469639[_0x85eb('0x4b')][_0x85eb('0x30')]);_0x3a06af[_0x85eb('0x2e')]=qs[_0x85eb('0x2e')](_0x469639['query'][_0x85eb('0x2e')]);}_0x3a06af[_0x85eb('0x54')]=qs[_0x85eb('0x55')](_0x469639['query'][_0x85eb('0x55')]);_0x3a06af[_0x85eb('0x56')]=qs[_0x85eb('0x4d')](_['pick'](_0x469639['query'],_0x1cabcb[_0x85eb('0x4d')]),_0x1b77b3);var _0x52996f=[];var _0x5ed98a=squel[_0x85eb('0x57')]()['field']('id')[_0x85eb('0x58')](_0x85eb('0x3b'))['field']('color')[_0x85eb('0x59')](_0x85eb('0x5a'));var _0x178d76=squel[_0x85eb('0x57')]()[_0x85eb('0x58')]('u.id')[_0x85eb('0x58')](_0x85eb('0x5b'))[_0x85eb('0x58')](_0x85eb('0x5c'))[_0x85eb('0x59')]('user_has_chat_interactions','ui')[_0x85eb('0x5d')]('users','u',_0x85eb('0x5e'));var _0x40d846=squel['select']()[_0x85eb('0x59')](_0x85eb('0x5f'),'i')[_0x85eb('0x5d')](_0x85eb('0x60'),'c',_0x85eb('0x61'))[_0x85eb('0x5d')]('users','o',_0x85eb('0x62'))['left_join'](_0x85eb('0x63'),'a',_0x85eb('0x64'))['left_join'](_0x85eb('0x65'),'me',_0x85eb('0x66'))['left_join'](_0x85eb('0x67'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x85eb('0x5d')](_0x85eb('0x5a'),'t',_0x85eb('0x68'));var _0x13c0b3=squel[_0x85eb('0x69')]();var _0x15d4a7=[];var _0x5a729e=squel[_0x85eb('0x69')]();var _0x76a9c6;if(_0x469639[_0x85eb('0x4b')][_0x85eb('0x6a')]){_0x76a9c6=as[_0x85eb('0x6b')](_0x469639[_0x85eb('0x4b')][_0x85eb('0x6a')]);var _0x1cb659=_0x76a9c6[_0x85eb('0x6c')];for(var _0x13cc2a=0x0;_0x13cc2a<_0x76a9c6[_0x85eb('0x6d')]['length'];_0x13cc2a++){var _0x271842=_0x76a9c6[_0x85eb('0x6d')][_0x13cc2a];var _0x46e5d3='i';var _0xdaf2fe=_[_0x85eb('0x6e')](_0x1b77b3,[_0x85eb('0x3b'),_0x271842['field']]);if(!_0xdaf2fe){switch(_0x271842[_0x85eb('0x58')]){case'unreadMessages':if(_0x271842[_0x85eb('0x6f')]==0x1){_0x40d846[_0x85eb('0x70')]('`'+_0x271842[_0x85eb('0x58')]+_0x85eb('0x71'));}else{_0x40d846[_0x85eb('0x70')]('`'+_0x271842['field']+_0x85eb('0x72'));}break;case _0x85eb('0x73'):if(_0x271842[_0x85eb('0x74')]===_0x85eb('0x75')){if(_0x271842[_0x85eb('0x6f')][_0x85eb('0x76')]('\x20')[_0x85eb('0x51')]>0x1){_0x13c0b3[_0x1cb659](_0x85eb('0x77'),qs['getFullTextValue'](_0x271842[_0x85eb('0x6f')]),null);}else{var _0x4d27bd='%'+_0x271842[_0x85eb('0x6f')]+'%';_0x13c0b3[_0x1cb659](_0x85eb('0x78'),_0x4d27bd,_0x4d27bd,_0x4d27bd);}}else{_0xdaf2fe=_[_0x85eb('0x6e')](_0x1b77b3,[_0x85eb('0x3b'),_0x85eb('0x79')]);_0x271842['field']=_0x85eb('0x79');_0x3ba160=as[_0x85eb('0x7a')](_0x46e5d3,_0xdaf2fe[_0x85eb('0x7b')],_0x271842);_0x13c0b3[_0x1cb659](_0x3ba160[_0x85eb('0x7c')],_0x3ba160[_0x85eb('0x6f')][_0x85eb('0x7d')],_0x3ba160['value']['end']);}break;case _0x85eb('0x7e'):var _0x572560=_0x271842[_0x85eb('0x6f')][_0x85eb('0x76')](',')[_0x85eb('0x40')](function(_0x23f24a){return Number(_0x23f24a);});_0x572560[_0x85eb('0x43')](function(_0x2b7258){_0x5a729e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2b7258+',%');});_0x15d4a7=_[_0x85eb('0x7f')](_0x15d4a7,_0x572560);break;case _0x85eb('0x80'):if(_0x271842[_0x85eb('0x74')]===_0x85eb('0x75')){_0x13c0b3[_0x1cb659]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x271842[_0x85eb('0x6f')]+'%',null);}else{_0xdaf2fe=_[_0x85eb('0x6e')](_0x1b77b3,[_0x85eb('0x3b'),_0x85eb('0x81')]);_0x271842['field']=_0x85eb('0x81');_0x3ba160=as[_0x85eb('0x7a')](_0x46e5d3,_0xdaf2fe[_0x85eb('0x7b')],_0x271842);_0x13c0b3[_0x1cb659](_0x3ba160[_0x85eb('0x7c')],_0x3ba160[_0x85eb('0x6f')][_0x85eb('0x7d')],_0x3ba160[_0x85eb('0x6f')][_0x85eb('0x2d')]);}break;case _0x85eb('0x3e'):_0x3ba160=as[_0x85eb('0x7a')]('me',null,_0x271842);_0x13c0b3[_0x1cb659](_0x3ba160[_0x85eb('0x7c')],_0x3ba160[_0x85eb('0x6f')][_0x85eb('0x7d')],_0x3ba160[_0x85eb('0x6f')][_0x85eb('0x2d')]);break;}}else{var _0x3ba160=as[_0x85eb('0x7a')](_0x46e5d3,_0xdaf2fe[_0x85eb('0x7b')],_0x271842);_0x13c0b3[_0x1cb659](_0x3ba160[_0x85eb('0x7c')],_0x3ba160['value'][_0x85eb('0x7d')],_0x3ba160['value'][_0x85eb('0x2d')]);}}}else{var _0x2346b1=_(_0x469639[_0x85eb('0x4b')])[_0x85eb('0x4c')]()[_0x85eb('0x40')](function(_0x3de724){return _[_0x85eb('0x82')](_0x1b77b3,[_0x85eb('0x3b'),_0x3de724])?_0x3de724:undefined;})[_0x85eb('0x83')]()['value']();if(!_[_0x85eb('0x84')](_0x2346b1)){_0x2346b1[_0x85eb('0x43')](function(_0x2d795b){if(_0x2d795b===_0x85eb('0x85')){_0x40d846[_0x85eb('0x56')]('i.ChatWebsiteId\x20IN\x20?',[][_0x85eb('0x86')](_0x469639['query'][_0x2d795b]));}else if(_0x2d795b===_0x85eb('0x87')){var _0x330c2b=JSON[_0x85eb('0x88')](_0x469639['query'][_0x2d795b])[_0x85eb('0x89')];var _0x2e358d=JSON[_0x85eb('0x88')](_0x469639['query'][_0x2d795b])['$lte'];_0x40d846[_0x85eb('0x56')](_0x85eb('0x8a'),_0x330c2b,_0x2e358d);}else{if(_0x469639[_0x85eb('0x4b')][_0x2d795b]===_0x85eb('0x8b')){_0x40d846['where']('i.'+_0x2d795b+_0x85eb('0x8c'));}else{_0x40d846['where']('i.'+_0x2d795b+_0x85eb('0x8d'),_0x469639[_0x85eb('0x4b')][_0x2d795b]);}}});}if(_0x469639[_0x85eb('0x4b')][_0x85eb('0x8e')]){if(_0x469639[_0x85eb('0x4b')][_0x85eb('0x8e')]==0x1){_0x40d846['having'](_0x85eb('0x8f'));}else{_0x40d846['having'](_0x85eb('0x90'));}}if(_0x469639[_0x85eb('0x4b')][_0x85eb('0x91')]){_0x15d4a7=_[_0x85eb('0x92')](_0x469639[_0x85eb('0x4b')][_0x85eb('0x91')])?_0x469639[_0x85eb('0x4b')][_0x85eb('0x91')]:new Array(_0x469639[_0x85eb('0x4b')]['tag']);_0x15d4a7[_0x85eb('0x43')](function(_0xd0c1d4){_0x5a729e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xd0c1d4+',%');});}if(_0x469639['query'][_0x85eb('0x93')]){var _0x4a5e00=_0x469639[_0x85eb('0x4b')]['filter'][_0x85eb('0x94')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x85eb('0x95')](_0x4a5e00)){_0x13c0b3['or'](_0x85eb('0x96'),_0x4a5e00+'%');}else{_0x13c0b3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x85eb('0x97')](_0x4a5e00))['or'](_0x85eb('0x98'),_0x4a5e00+'%');}}}_0x40d846['where'](_0x13c0b3);_0x40d846[_0x85eb('0x99')](_0x85eb('0x9a'));var _0xf076af={'type':db[_0x85eb('0x9b')]['QueryTypes'][_0x85eb('0x9c')],'raw':!![]};var _0x53ccc5=_0x40d846[_0x85eb('0x9d')]();_0x53ccc5[_0x85eb('0x58')](_0x85eb('0x9a'));_0x53ccc5['field'](_0x85eb('0x9e'),_0x85eb('0x9f'));if(_0x3a06af[_0x85eb('0x54')]){_0x3a06af['order'][_0x85eb('0x43')](function(_0x5eb629){var _0x26cc46=_0x5eb629[0x0]===_0x85eb('0xa0')?_0x5eb629[0x0]:'i.'+_0x5eb629[0x0];_0x40d846[_0x85eb('0x54')](_0x26cc46,_0x5eb629[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x15d4a7)){_0x40d846['having'](_0x5a729e);_0x53ccc5[_0x85eb('0x56')](_0x85eb('0xa1'),_0x15d4a7);}BPromise[_0x85eb('0xa2')]()['then'](function(){if(!_0x76a9c6){if(_0x469639[_0x85eb('0x4b')][_0x85eb('0x85')])return;_0x53ccc5[_0x85eb('0x56')](_0x85eb('0xa3'));_0x40d846[_0x85eb('0x56')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x469639['user'][_0x85eb('0xa4')]!==_0x85eb('0xa5'))return;return _0x469639['user'][_0x85eb('0xa6')]({'attributes':['id'],'raw':!![]})[_0x85eb('0x22')](function(_0x3bc357){if(_[_0x85eb('0x84')](_0x3bc357)){_0x53ccc5[_0x85eb('0x56')](_0x85eb('0xa7'));_0x40d846[_0x85eb('0x56')](_0x85eb('0xa7'));}else{_0x53ccc5[_0x85eb('0x56')](_0x85eb('0xa8'),_[_0x85eb('0x40')](_0x3bc357,'id'));_0x40d846[_0x85eb('0x56')](_0x85eb('0xa8'),_[_0x85eb('0x40')](_0x3bc357,'id'));}});})[_0x85eb('0x22')](function(){if(_0x469639['user'][_0x85eb('0xa4')]===_0x85eb('0xa5')&&!_0x76a9c6&&!_0x469639[_0x85eb('0x4b')][_0x85eb('0x85')])return[];return db[_0x85eb('0xa9')][_0x85eb('0x4b')](_0x53ccc5[_0x85eb('0xaa')](),_0xf076af);})[_0x85eb('0x22')](function(_0x2c0ab5){_0x5d90cc[_0x85eb('0x31')]=_0x2c0ab5['length'];if(_0x5d90cc[_0x85eb('0x31')]===0x0)return[];return db[_0x85eb('0xa9')][_0x85eb('0x4b')](_0x5ed98a[_0x85eb('0xaa')](),_0xf076af)['then'](function(_0x2caf89){_0x52996f=_[_0x85eb('0xab')](_0x2caf89,'id');_0xf076af=_[_0x85eb('0xac')](_0xf076af,{'model':db[_0x85eb('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x469639[_0x85eb('0x4b')][_0x85eb('0x50')]){_0x3a06af['attributes'][_0x85eb('0x43')](function(_0x36dbb1){_0x40d846[_0x85eb('0x58')]('i.'+_0x36dbb1);});}else{_0x40d846['field'](_0x85eb('0x9e'),_0x85eb('0x9f'));_0x40d846[_0x85eb('0x58')](_0x85eb('0xad'),_0x85eb('0xae'));_0x40d846[_0x85eb('0x58')](_0x85eb('0xaf'),_0x85eb('0xb0'));_0x40d846['field'](_0x85eb('0xb1'),_0x85eb('0xa0'));_0x40d846['field']('i.*');_0x40d846[_0x85eb('0x58')]('c.firstName',_0x85eb('0xb2'));_0x40d846[_0x85eb('0x58')](_0x85eb('0xb3'),_0x85eb('0xb4'));_0x40d846['field']('c.email',_0x85eb('0xb5'));_0x40d846['field'](_0x85eb('0xb6'),_0x85eb('0xb7'));_0x40d846[_0x85eb('0x58')](_0x85eb('0xb8'),'Contact.mobile');_0x40d846['field'](_0x85eb('0xb9'),_0x85eb('0xba'));_0x40d846[_0x85eb('0x58')]('o.fullname','Owner.fullname');_0x40d846[_0x85eb('0x58')](_0x85eb('0xbb'),_0x85eb('0xbc'));_0x40d846[_0x85eb('0x58')](_0x85eb('0xbd'),_0x85eb('0x41'));}if(_0x3a06af[_0x85eb('0x30')])_0x40d846[_0x85eb('0x30')](_0x3a06af[_0x85eb('0x30')]);if(_0x3a06af[_0x85eb('0x2e')])_0x40d846[_0x85eb('0x2e')](_0x3a06af['offset']);return db[_0x85eb('0xa9')][_0x85eb('0x4b')](_0x40d846['toString'](),_0xf076af);})[_0x85eb('0x22')](function(_0x3c8e3e){if(_0x3c8e3e[_0x85eb('0x51')]>0x0)_0x178d76[_0x85eb('0x56')](_0x85eb('0xbe'),_[_0x85eb('0x40')](_0x3c8e3e,'id'));return db['sequelize']['query'](_0x178d76[_0x85eb('0xaa')](),_0xf076af)['then'](function(_0x2f1ff1){var _0x5596c1=_[_0x85eb('0xbf')](_0x2f1ff1,_0x85eb('0xc0'));var _0x5e8478=[];_0x3c8e3e['forEach'](function(_0x119f69){_0x5e8478[_0x85eb('0xc1')](updateChatInteraction(_0x119f69,_0x52996f,_0x5596c1));});return BPromise['all'](_0x5e8478);});});})[_0x85eb('0x22')](function(_0x2e44b5){_0x5d90cc[_0x85eb('0xc2')]=_0x2e44b5;return _0x5d90cc;})['then'](respondWithFilteredResult(_0x540c7a,_0x3a06af))['catch'](handleError(_0x540c7a,null));};exports[_0x85eb('0xc3')]=function(_0x3a8d0d,_0x189733){var _0x422d33={'raw':![],'where':{'id':_0x3a8d0d[_0x85eb('0xc4')]['id']}},_0x1d695c={};_0x1d695c[_0x85eb('0x4a')]=_[_0x85eb('0x4c')](db[_0x85eb('0x46')][_0x85eb('0x47')]);_0x1d695c['query']=_[_0x85eb('0x4c')](_0x3a8d0d['query']);_0x1d695c[_0x85eb('0x4d')]=_[_0x85eb('0x4f')](_0x1d695c[_0x85eb('0x4a')],_0x1d695c[_0x85eb('0x4b')]);_0x422d33[_0x85eb('0x4e')]=_['intersection'](_0x1d695c[_0x85eb('0x4a')],qs[_0x85eb('0x50')](_0x3a8d0d[_0x85eb('0x4b')]['fields']));_0x422d33[_0x85eb('0x4e')]=_0x422d33[_0x85eb('0x4e')][_0x85eb('0x51')]?_0x422d33[_0x85eb('0x4e')]:_0x1d695c[_0x85eb('0x4a')];if(_0x3a8d0d[_0x85eb('0x4b')][_0x85eb('0xc5')]){_0x422d33[_0x85eb('0xc6')]=[{'all':!![]}];}_0x422d33=_[_0x85eb('0xac')]({},_0x422d33,_0x3a8d0d[_0x85eb('0xc7')]);return db[_0x85eb('0x46')][_0x85eb('0x6e')](_0x422d33)[_0x85eb('0x22')](handleEntityNotFound(_0x189733,null))[_0x85eb('0x22')](respondWithResult(_0x189733,null))[_0x85eb('0x44')](handleError(_0x189733,null));};exports[_0x85eb('0xc8')]=function(_0x576bc0,_0x364f29){return db[_0x85eb('0x46')][_0x85eb('0xc8')](_0x576bc0[_0x85eb('0x3e')],{})[_0x85eb('0x22')](respondWithResult(_0x364f29,0xc9))[_0x85eb('0x44')](handleError(_0x364f29,null));};exports[_0x85eb('0x38')]=function(_0x55255d,_0x419f52){if(_0x55255d[_0x85eb('0x3e')]['id']){delete _0x55255d['body']['id'];}return db[_0x85eb('0x46')]['find']({'where':{'id':_0x55255d[_0x85eb('0xc4')]['id']}})[_0x85eb('0x22')](handleEntityNotFound(_0x419f52,null))[_0x85eb('0x22')](saveUpdates(_0x55255d[_0x85eb('0x3e')],null))[_0x85eb('0x22')](respondWithResult(_0x419f52,null))[_0x85eb('0x44')](handleError(_0x419f52,null));};exports[_0x85eb('0x39')]=function(_0x1233be,_0x5906d2){return db['ChatInteraction'][_0x85eb('0x6e')]({'where':{'id':_0x1233be[_0x85eb('0xc4')]['id']}})[_0x85eb('0x22')](handleEntityNotFound(_0x5906d2,null))[_0x85eb('0x22')](removeEntity(_0x5906d2,null))['catch'](handleError(_0x5906d2,null));};exports[_0x85eb('0xc9')]=function(_0x2e2af5,_0x3d2e7d){return db['ChatInteraction'][_0x85eb('0xc9')]()[_0x85eb('0x22')](respondWithResult(_0x3d2e7d,null))[_0x85eb('0x44')](handleError(_0x3d2e7d,null));};exports['createVidaooSession']=function(_0x1fa8f6,_0x38f314){var _0x2a355b=_0x1fa8f6['params']['id'];var _0x18404c;var _0x466d54;var _0x404fef;return db[_0x85eb('0x46')][_0x85eb('0xca')]({'where':{'id':_0x2a355b}})[_0x85eb('0x22')](function(_0x3bb3e5){_0x18404c=_0x3bb3e5;return db[_0x85eb('0xcb')][_0x85eb('0xca')]({'where':{'id':_0x3bb3e5['ChatWebsiteId']},'attributes':['id',_0x85eb('0xcc'),_0x85eb('0xcd'),_0x85eb('0xce'),_0x85eb('0xcf'),_0x85eb('0xd0')],'raw':!![]});})[_0x85eb('0x22')](function(_0x5c80b1){if(_0x5c80b1&&_0x5c80b1['vidaooApiKey']&&_0x5c80b1[_0x85eb('0xcd')]){_0x466d54=_0x5c80b1;var _0x3b0878={'interaction':{'id':_0x2a355b},'agent':{'id':_0x1fa8f6[_0x85eb('0xd1')]['id'],'name':_0x1fa8f6[_0x85eb('0xd1')][_0x85eb('0x3b')],'fullname':_0x1fa8f6[_0x85eb('0xd1')][_0x85eb('0xd2')],'email':_0x1fa8f6['user'][_0x85eb('0xd3')]},'contact':_0x1fa8f6[_0x85eb('0x3e')]['contact'],'account':_0x1fa8f6[_0x85eb('0x3e')][_0x85eb('0xd4')]};var _0x1a5c26={'rejectUnauthorized':![],'method':_0x85eb('0xd5'),'url':_0x85eb('0xd6'),'headers':{'X-APIKEY':_0x5c80b1[_0x85eb('0xcc')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1fa8f6[_0x85eb('0xd1')][_0x85eb('0xd3')]],'buttons':null,'topic':_0x466d54[_0x85eb('0xce')],'note':_['isNull'](_0x466d54['vidaooNote'])?null:getMustacheRender(_0x466d54['vidaooNote'],_0x3b0878),'metadata':null},'redirect':_0x85eb('0xd7'),'json':!![]};try{if(!_[_0x85eb('0xd8')](_0x466d54[_0x85eb('0xd0')])){var _0x413509=getMustacheRender(_0x466d54[_0x85eb('0xd0')],_0x3b0878);var _0x368f63=JSON[_0x85eb('0x88')](_0x413509);_0x1a5c26[_0x85eb('0x3e')][_0x85eb('0xd9')]=_0x368f63;}}catch(_0x2305a9){throw new db['Sequelize'][(_0x85eb('0xda'))](_0x85eb('0xdb'));}return rp(_0x1a5c26);}else{throw new db[(_0x85eb('0x9b'))][(_0x85eb('0xda'))](_0x85eb('0xdc'));}})[_0x85eb('0x22')](function(_0x495b8f){_0x404fef=_0x495b8f;if(_0x404fef['id']){var _0x1bbe41={'body':_0x404fef['join_url'],'ChatWebsiteId':_0x466d54['id'],'ChatInteractionId':_0x18404c['id'],'direction':_0x85eb('0xdd'),'UserId':_0x1fa8f6['user']['id']};return db[_0x85eb('0xde')][_0x85eb('0xc8')](_0x1bbe41,{});}else{throw new db[(_0x85eb('0x9b'))][(_0x85eb('0xda'))](_0x85eb('0xdf'));}})[_0x85eb('0x22')](function(){return _0x18404c[_0x85eb('0xe0')]({'vidaooSessionId':_0x404fef['id']});})[_0x85eb('0x22')](respondWithResult(_0x38f314,null))['catch'](handleError(_0x38f314,null));};exports['customUpdate']=function(_0x1c0550,_0x19261b){if(_0x1c0550[_0x85eb('0x3e')]['id']){delete _0x1c0550[_0x85eb('0x3e')]['id'];}return db[_0x85eb('0x46')]['find']({'where':{'id':_0x1c0550[_0x85eb('0xc4')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x85eb('0x22')](handleEntityNotFound(_0x19261b,null))[_0x85eb('0x22')](saveUpdates(_0x1c0550['body'],null))[_0x85eb('0x22')](respondWithResult(_0x19261b,null))[_0x85eb('0x44')](handleError(_0x19261b,null));};exports[_0x85eb('0xe1')]=function(_0x643bd3,_0x22cdc1,_0x490d17){if(_0x643bd3[_0x85eb('0x3e')]['id']){delete _0x643bd3[_0x85eb('0x3e')]['id'];}return db[_0x85eb('0x46')][_0x85eb('0x6e')]({'where':{'id':_0x643bd3[_0x85eb('0xc4')]['id']}})[_0x85eb('0x22')](function(_0x452460){if(!_0x452460){logger[_0x85eb('0x28')](_0x85eb('0xe2'),_0x85eb('0xe1'),0x194,'entity\x20not\x20found');_0x22cdc1['sendStatus'](0x194);}else{if(_0x452460['UserId']){throw new db[(_0x85eb('0x9b'))][(_0x85eb('0xda'))](_0x85eb('0xe3'));}}return _0x452460;})['then'](function(_0x2d3772){if(_0x2d3772){return _0x2d3772[_0x85eb('0x38')]({'closed':_0x643bd3['body'][_0x85eb('0xe4')],'disposition':_0x643bd3[_0x85eb('0x3e')][_0x85eb('0xe5')]})[_0x85eb('0x22')](function(_0x521580){return _0x521580;});}})[_0x85eb('0x22')](function(_0x38fd1b){return respondWithRpcPromise(_0x85eb('0xe6'),_0x85eb('0xe1'),_0x643bd3[_0x85eb('0x3e')],client9004);})[_0x85eb('0x22')](respondWithResult(_0x22cdc1,null))[_0x85eb('0x44')](handleError(_0x22cdc1,null));};exports[_0x85eb('0xe7')]=function(_0x518eda,_0x299d7b,_0x120553){_0x518eda['body'][_0x85eb('0x3b')]=_0x518eda['file'][_0x85eb('0xe8')];_0x518eda[_0x85eb('0x3e')][_0x85eb('0xe9')]=_0x518eda[_0x85eb('0xea')][_0x85eb('0xeb')];_0x518eda['body'][_0x85eb('0x7b')]=_0x518eda['file']['mimetype'];return db[_0x85eb('0xec')][_0x85eb('0xc8')](_0x518eda['body'])[_0x85eb('0x22')](respondWithResult(_0x299d7b,0xc9))['catch'](handleError(_0x299d7b,null));};exports[_0x85eb('0xed')]=function(_0x36a522,_0x437908,_0xd0d358){return db[_0x85eb('0x46')][_0x85eb('0xca')]({'where':{'id':_0x36a522[_0x85eb('0xc4')]['id']},'raw':!![]})[_0x85eb('0x22')](handleEntityNotFound(_0x437908,null))['then'](function(_0x5122fc){if(_0x5122fc){if(_0x5122fc[_0x85eb('0xe4')]){return _0x437908[_0x85eb('0x2c')](0x193)[_0x85eb('0x34')]({'status':0x193,'message':_0x85eb('0xee')});}return db[_0x85eb('0xec')][_0x85eb('0xca')]({'where':{'id':_0x36a522[_0x85eb('0x4b')][_0x85eb('0xef')]},'raw':!![]})[_0x85eb('0x22')](handleEntityNotFound(_0x437908,null));}})[_0x85eb('0x22')](function(_0x2785e5){if(_0x2785e5){var _0x31422d=_0x2785e5[_0x85eb('0xf0')]!==null;var _0x4fd2c5=path[_0x85eb('0xf1')](config[_0x85eb('0xf2')],'server/files/attachments/');if(_0x31422d){_0x4fd2c5=path['join'](_0x4fd2c5,'offline-chat/');}var _0x1f8971=path[_0x85eb('0xf1')](_0x4fd2c5,_0x2785e5[_0x85eb('0xe9')]);return _0x437908[_0x85eb('0xf3')](_0x1f8971);}})['catch'](handleError(_0x437908,null));};exports[_0x85eb('0xf4')]=function(_0x8e8898,_0x2fb509){var _0x39bd74=null;var _0x3818db=null;var _0x529048=null;var _0x242488=null;if(_0x8e8898[_0x85eb('0x3e')]['id']){delete _0x8e8898['body']['id'];}if(_0x8e8898[_0x85eb('0x3e')][_0x85eb('0xf5')]){_0x242488=path[_0x85eb('0xf1')](config[_0x85eb('0xf2')],_0x85eb('0xf6'),util[_0x85eb('0xf7')](_0x85eb('0xf8'),Date[_0x85eb('0xf9')]()));_0x8e8898['body']['pathTranscript']=_0x242488;}return db['ChatInteraction'][_0x85eb('0x6e')]({'where':{'id':_0x8e8898['params']['id']},'include':[{'model':db[_0x85eb('0xde')],'as':_0x85eb('0xfa'),'include':[{'model':db[_0x85eb('0x80')],'as':_0x85eb('0x80')}]}]})[_0x85eb('0x22')](handleEntityNotFound(_0x2fb509,null))[_0x85eb('0x22')](saveUpdates(_0x8e8898['body'],null))[_0x85eb('0x22')](function(_0x3a276c){if(_0x3a276c){_0x39bd74=_0x3a276c;return db[_0x85eb('0xcb')][_0x85eb('0x6e')]({'where':{'id':_0x39bd74[_0x85eb('0x85')]}});}})[_0x85eb('0x22')](function(_0x6c7095){if(_0x6c7095){_0x529048=_0x6c7095;return db[_0x85eb('0xfb')][_0x85eb('0x6e')]({'where':{'id':_0x39bd74['ContactId']}});}})[_0x85eb('0x22')](function(_0x3aec49){if(_0x3aec49){_0x3818db=_0x3aec49;if(_0x242488){var _0x4c8ad6=null;for(var _0x20cbea=0x1;_0x20cbea<_0x39bd74[_0x85eb('0xfa')][_0x85eb('0x51')];++_0x20cbea){_0x4c8ad6=_0x39bd74[_0x85eb('0xfa')][_0x20cbea];var _0x401936=_0x4c8ad6[_0x85eb('0x81')]?util['format'](_0x85eb('0xfc'),_0x529048[_0x85eb('0xfd')],_0x4c8ad6['UserId']):'System';var _0x4660b6=_0x8e8898[_0x85eb('0x3e')]['customer']||util[_0x85eb('0xf7')](_0x85eb('0xfc'),'Visitor',_0x4c8ad6[_0x85eb('0x79')]);switch(_0x529048[_0x85eb('0xfe')]){case _0x85eb('0xff'):_0x401936=_0x4c8ad6[_0x85eb('0x81')]?util[_0x85eb('0xf7')]('%s%d',_0x529048['agentAlias'],_0x4c8ad6[_0x85eb('0x81')]):_0x85eb('0x100');break;case _0x85eb('0x101'):_0x401936=_0x4c8ad6[_0x85eb('0x81')]?_0x4c8ad6[_0x85eb('0x80')][_0x85eb('0x102')]||_0x4c8ad6[_0x85eb('0x80')]['fullname']:_0x85eb('0x100');break;case _0x85eb('0x103'):_0x401936=_0x4c8ad6[_0x85eb('0x81')]?_0x4c8ad6[_0x85eb('0x80')][_0x85eb('0xd2')]:_0x85eb('0x100');break;default:_0x401936=_0x4c8ad6[_0x85eb('0x81')]?util[_0x85eb('0xf7')](_0x85eb('0xfc'),_0x529048[_0x85eb('0xfd')],_0x4c8ad6['UserId']):_0x85eb('0x100');}var _0x2e7563=util[_0x85eb('0xf7')](_0x85eb('0x104'),moment(_0x4c8ad6[_0x85eb('0x87')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x4c8ad6[_0x85eb('0x105')]==='in'?_0x4660b6:_0x401936,_0x4c8ad6[_0x85eb('0x3e')]);if(!_0x4c8ad6[_0x85eb('0x106')]){fs[_0x85eb('0x107')](_0x242488,_0x2e7563);}}return db[_0x85eb('0x108')][_0x85eb('0xca')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x85eb('0x109'),'raw':!![]}]});}}})[_0x85eb('0x22')](function(_0x113c06){if(_0x113c06&&_0x113c06['Smtp']&&_0x8e8898[_0x85eb('0x3e')]){var _0x54e411={'tls':{'rejectUnauthorized':![]}};if(_0x113c06[_0x85eb('0x109')]['service']){_0x54e411[_0x85eb('0x10a')]=_0x113c06[_0x85eb('0x109')][_0x85eb('0x10a')];}else{_0x54e411['host']=_0x113c06[_0x85eb('0x109')][_0x85eb('0x10b')];_0x54e411[_0x85eb('0x10c')]=_0x113c06[_0x85eb('0x109')]['port'];_0x54e411[_0x85eb('0x10d')]=_0x113c06[_0x85eb('0x109')]['secure'];}if(_0x113c06[_0x85eb('0x109')][_0x85eb('0x10e')]){_0x54e411[_0x85eb('0x10f')]={'user':_0x113c06['Smtp']['user'],'pass':_0x113c06[_0x85eb('0x109')][_0x85eb('0x110')]};}return respondWithRpcPromise(_0x85eb('0x111'),_0x85eb('0x112'),{'account':_0x54e411,'message':{'from':util[_0x85eb('0xf7')]('\x22%s\x22\x20<%s>',_0x113c06[_0x85eb('0x3b')],_0x113c06[_0x85eb('0xd3')]||_0x113c06['Smtp'][_0x85eb('0xd1')]),'to':_0x8e8898[_0x85eb('0x3e')][_0x85eb('0xf5')],'subject':_0x85eb('0x113'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x8e8898[_0x85eb('0x3e')][_0x85eb('0xf5')]),'attachments':[{'path':_0x242488}]}})['then'](function(){return _0x39bd74;})['catch'](function(_0x3c794c){console[_0x85eb('0x28')](_0x3c794c);});}else{return _0x39bd74;}})[_0x85eb('0x22')](respondWithStatusCode(_0x2fb509,0xc8))['catch'](handleError(_0x2fb509,null));};exports[_0x85eb('0x114')]=function(_0x1bdbc5,_0x4edc7d,_0x32222c){return db[_0x85eb('0xde')][_0x85eb('0x6e')]({'where':{'id':_0x1bdbc5[_0x85eb('0xc4')]['id']}})[_0x85eb('0x22')](handleEntityNotFound(_0x4edc7d,null))[_0x85eb('0x22')](function(_0x52c186){if(_0x52c186){return _0x52c186[_0x85eb('0x114')](_0x1bdbc5[_0x85eb('0x3e')][_0x85eb('0x115')],_['omit'](_0x1bdbc5['body'],['ids','id'])||{});}})[_0x85eb('0x22')](respondWithResult(_0x4edc7d,null))['catch'](handleError(_0x4edc7d,null));};exports[_0x85eb('0x116')]=function(_0x46a2c4,_0x1b5db9,_0x386c1a){var _0x3ed32c={'raw':![],'where':{}};var _0x3d04e7={};var _0x1e2b79={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x85eb('0xca')]({'where':{'id':_0x46a2c4[_0x85eb('0xc4')]['id']}})[_0x85eb('0x22')](handleEntityNotFound(_0x1b5db9,null))[_0x85eb('0x22')](function(_0x4307f4){if(_0x4307f4){_0x3d04e7[_0x85eb('0x4a')]=_[_0x85eb('0x4c')](db[_0x85eb('0xde')][_0x85eb('0x47')]);_0x3d04e7[_0x85eb('0x4b')]=_[_0x85eb('0x4c')](_0x46a2c4[_0x85eb('0x4b')]);_0x3d04e7[_0x85eb('0x4d')]=_[_0x85eb('0x4f')](_0x3d04e7[_0x85eb('0x4a')],_0x3d04e7['query']);_0x3ed32c[_0x85eb('0x4e')]=_[_0x85eb('0x4f')](_0x3d04e7[_0x85eb('0x4a')],qs[_0x85eb('0x50')](_0x46a2c4['query'][_0x85eb('0x50')]));_0x3ed32c[_0x85eb('0x4e')]=_0x3ed32c[_0x85eb('0x4e')][_0x85eb('0x51')]?_0x3ed32c[_0x85eb('0x4e')]:_0x3d04e7[_0x85eb('0x4a')];if(!_0x46a2c4['query']['hasOwnProperty']('nolimit')){_0x3ed32c[_0x85eb('0x30')]=qs[_0x85eb('0x30')](_0x46a2c4[_0x85eb('0x4b')]['limit']);_0x3ed32c[_0x85eb('0x2e')]=qs[_0x85eb('0x2e')](_0x46a2c4['query'][_0x85eb('0x2e')]);}_0x3ed32c[_0x85eb('0x54')]=qs[_0x85eb('0x55')](_0x46a2c4[_0x85eb('0x4b')][_0x85eb('0x55')]);_0x3ed32c[_0x85eb('0x56')]=qs[_0x85eb('0x4d')](_[_0x85eb('0x117')](_0x46a2c4[_0x85eb('0x4b')],_0x3d04e7[_0x85eb('0x4d')]));_0x3ed32c[_0x85eb('0x56')][_0x85eb('0xc0')]=_0x4307f4['id'];if(_0x46a2c4['query'][_0x85eb('0x93')]){_0x3ed32c[_0x85eb('0x56')]=_['merge'](_0x3ed32c[_0x85eb('0x56')],{'$or':_['map'](_0x3ed32c[_0x85eb('0x4e')],function(_0x2037ef){var _0x200c28={};_0x200c28[_0x2037ef]={'$like':'%'+_0x46a2c4[_0x85eb('0x4b')][_0x85eb('0x93')]+'%'};return _0x200c28;})});}if(_0x46a2c4[_0x85eb('0x4b')][_0x85eb('0x89')]){var _0xe74bd5=_0x46a2c4['query']['$gte'][_0x85eb('0x76')](',');var _0x6b9b57={};_0x6b9b57[_0xe74bd5[0x0]]={'$gte':moment(_0xe74bd5[0x1])['format'](_0x85eb('0x118'))};_0x3ed32c[_0x85eb('0x56')]=_['merge'](_0x3ed32c[_0x85eb('0x56')],_0x6b9b57);}_0x3ed32c=_[_0x85eb('0xac')]({},_0x3ed32c,_0x46a2c4[_0x85eb('0xc7')]);return db['ChatMessage'][_0x85eb('0x31')]({'where':_0x3ed32c['where']})[_0x85eb('0x22')](function(_0x5badd){_0x1e2b79[_0x85eb('0x31')]=_0x5badd;if(_0x46a2c4[_0x85eb('0x4b')]['includeAll']){_0x3ed32c[_0x85eb('0xc6')]=[{'all':!![]}];}return db[_0x85eb('0xde')][_0x85eb('0x119')](_0x3ed32c);})[_0x85eb('0x22')](function(_0x4d7d3b){_0x1e2b79[_0x85eb('0xc2')]=_0x4d7d3b;return _0x1e2b79;});}})[_0x85eb('0x22')](respondWithFilteredResult(_0x1b5db9,_0x3ed32c))[_0x85eb('0x44')](handleError(_0x1b5db9,null));};exports[_0x85eb('0x11a')]=function(_0x1bdeea,_0x37ef17,_0x54e0a2){var _0x3b205e={'where':{}},_0x37bcff={},_0x5d4a73={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x85eb('0xca')]({'where':{'id':_0x1bdeea[_0x85eb('0xc4')]['id']}})[_0x85eb('0x22')](handleEntityNotFound(_0x37ef17,null))[_0x85eb('0x22')](function(_0x17d94e){if(_0x17d94e){_0x37bcff[_0x85eb('0x4a')]=_[_0x85eb('0x4c')](db[_0x85eb('0xde')][_0x85eb('0x47')]);_0x37bcff['query']=_[_0x85eb('0x4c')](_0x1bdeea[_0x85eb('0x4b')]);_0x37bcff[_0x85eb('0x4d')]=_[_0x85eb('0x4f')](_0x37bcff[_0x85eb('0x4a')],_0x37bcff[_0x85eb('0x4b')]);_0x3b205e[_0x85eb('0x4e')]=_['intersection'](_0x37bcff[_0x85eb('0x4a')],qs[_0x85eb('0x50')](_0x1bdeea['query']['fields']));_0x3b205e[_0x85eb('0x4e')]=_0x3b205e[_0x85eb('0x4e')][_0x85eb('0x51')]?_0x3b205e[_0x85eb('0x4e')]:_0x37bcff['model'];if(!_0x1bdeea['query'][_0x85eb('0x52')]('nolimit')){_0x3b205e[_0x85eb('0x30')]=qs[_0x85eb('0x30')](_0x1bdeea[_0x85eb('0x4b')]['limit']);_0x3b205e['offset']=qs[_0x85eb('0x2e')](_0x1bdeea[_0x85eb('0x4b')][_0x85eb('0x2e')]);}_0x3b205e[_0x85eb('0x54')]=qs['sort'](_0x1bdeea[_0x85eb('0x4b')][_0x85eb('0x55')]);_0x3b205e[_0x85eb('0x56')]=qs['filters'](_[_0x85eb('0x117')](_0x1bdeea['query'],_0x37bcff['filters']));_0x3b205e[_0x85eb('0x56')][_0x85eb('0xc0')]=_0x17d94e['id'];if(_0x1bdeea[_0x85eb('0x4b')][_0x85eb('0x93')]){_0x3b205e['where']=_[_0x85eb('0xac')](_0x3b205e[_0x85eb('0x56')],{'$or':_[_0x85eb('0x40')](_0x3b205e[_0x85eb('0x4e')],function(_0x32cf84){var _0x3f7ede={};_0x3f7ede[_0x32cf84]={'$like':'%'+_0x1bdeea[_0x85eb('0x4b')]['filter']+'%'};return _0x3f7ede;})});}_0x3b205e[_0x85eb('0x56')][_0x85eb('0x106')]=![];if(_0x1bdeea[_0x85eb('0x4b')]['id']){_0x3b205e[_0x85eb('0x56')]['id']={'$gt':_0x1bdeea[_0x85eb('0x4b')]['id']};}_0x3b205e=_['merge']({},_0x3b205e,_0x1bdeea[_0x85eb('0xc7')]);return db[_0x85eb('0xde')][_0x85eb('0x31')]({'where':_0x3b205e[_0x85eb('0x56')]})['then'](function(_0x761ba8){_0x5d4a73[_0x85eb('0x31')]=_0x761ba8;_0x3b205e[_0x85eb('0xc6')]=[];if(_0x1bdeea['query'][_0x85eb('0x11b')]){_0x3b205e[_0x85eb('0xc6')][_0x85eb('0xc1')]({'model':db[_0x85eb('0x80')],'as':_0x85eb('0x80'),'attributes':['id','fullname',_0x85eb('0x102')]});}if(_0x1bdeea['query'][_0x85eb('0xc5')]){_0x3b205e['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x3b205e);})['then'](function(_0x30eeb7){_0x5d4a73[_0x85eb('0xc2')]=_0x30eeb7;return _0x5d4a73;});}})['then'](respondWithFilteredResult(_0x37ef17,_0x3b205e))['catch'](handleError(_0x37ef17,null));};exports[_0x85eb('0x11c')]=function(_0x532769,_0x590d0d,_0x59fd91){return db[_0x85eb('0x46')][_0x85eb('0x6e')]({'where':{'id':_0x532769['params']['id']}})['then'](handleEntityNotFound(_0x590d0d,null))[_0x85eb('0x22')](function(_0x3971f5){if(_0x3971f5){return _0x3971f5['setTags'](_0x532769[_0x85eb('0x3e')][_0x85eb('0x115')],_[_0x85eb('0x11d')](_0x532769[_0x85eb('0x3e')],[_0x85eb('0x115'),'id'])||{})[_0x85eb('0x11e')](function(){return db[_0x85eb('0x7e')][_0x85eb('0x119')]({'attributes':['id',_0x85eb('0x3b'),_0x85eb('0x11f')],'where':{'id':_0x532769[_0x85eb('0x3e')][_0x85eb('0x115')]}});})['then'](function(_0x36ea41){socket[_0x85eb('0x120')](_0x85eb('0x121'),{'id':Number(_0x532769[_0x85eb('0xc4')]['id']),'tags':_0x36ea41||[]});return{'id':Number(_0x532769[_0x85eb('0xc4')]['id']),'tags':_0x36ea41||[]};});}})[_0x85eb('0x22')](respondWithResult(_0x590d0d,null))[_0x85eb('0x44')](handleError(_0x590d0d,null));};exports[_0x85eb('0x122')]=function(_0x1be39a,_0x2461f9,_0x356d32){return db[_0x85eb('0x46')][_0x85eb('0x6e')]({'where':{'id':_0x1be39a['params']['id']}})['then'](handleEntityNotFound(_0x2461f9,null))[_0x85eb('0x22')](function(_0x8c6dc0){if(_0x8c6dc0){return _0x8c6dc0[_0x85eb('0x122')](_0x1be39a[_0x85eb('0x4b')]['ids']);}})[_0x85eb('0x22')](respondWithStatusCode(_0x2461f9,null))[_0x85eb('0x44')](handleError(_0x2461f9,null));};exports['download']=function(_0x1f4e87,_0x1c3ed4){var _0x411f08=moment()[_0x85eb('0x123')]()['toString']();var _0x24b1f3=path[_0x85eb('0xf1')](config[_0x85eb('0xf2')],_0x85eb('0x124'),_0x85eb('0x125'),'tmp');var _0x163a17=path[_0x85eb('0xf1')](config[_0x85eb('0xf2')],_0x85eb('0x124'),_0x85eb('0x125'),'attachments');var _0x27ea02=path[_0x85eb('0xf1')](_0x24b1f3,_0x411f08);var _0x5a3a94=util[_0x85eb('0xf7')](_0x85eb('0x126'),_0x1f4e87[_0x85eb('0xc4')]['id'],_0x411f08);var _0x4675d1=path[_0x85eb('0xf1')](_0x24b1f3,_0x5a3a94);var _0x5f72cd=[];_0x5f72cd['push']({'model':db[_0x85eb('0x80')],'as':_0x85eb('0x80'),'attributes':['id',_0x85eb('0xd2')],'raw':!![]});_0x5f72cd[_0x85eb('0xc1')]({'model':db[_0x85eb('0xfb')],'as':_0x85eb('0x73'),'attributes':['id',_0x85eb('0x127'),_0x85eb('0x128')],'raw':!![]});if(_0x1f4e87['query'][_0x85eb('0x129')]){_0x5f72cd['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x4d8940=[{'model':db[_0x85eb('0xde')],'as':_0x85eb('0xfa'),'attributes':['id',_0x85eb('0x3e'),_0x85eb('0x87'),'direction',_0x85eb('0x106'),_0x85eb('0x8e')],'include':_0x5f72cd}];_0x4d8940[_0x85eb('0xc1')]({'model':db[_0x85eb('0xcb')],'as':_0x85eb('0x12a'),'attributes':['id',_0x85eb('0x3b')]});_0x4d8940[_0x85eb('0xc1')]({'model':db[_0x85eb('0x80')],'as':_0x85eb('0x12b'),'attributes':['id',_0x85eb('0xd2')]});return db[_0x85eb('0x46')][_0x85eb('0x6e')]({'where':{'id':_0x1f4e87['params']['id']},'include':_0x4d8940})[_0x85eb('0x22')](handleEntityNotFound(_0x1c3ed4,null))[_0x85eb('0x22')](function(_0x38217f){if(_0x38217f){var _0x49146a=_0x38217f['get']({'plain':!![]});fs[_0x85eb('0x12c')](_0x27ea02);var _0xa82740={'channel':_0x85eb('0x12d'),'account':_0x49146a[_0x85eb('0x12a')]['name'],'agent':_0x49146a['Owner']?_0x49146a[_0x85eb('0x12b')][_0x85eb('0xd2')]:_0x85eb('0x12e'),'createdAt':moment(_0x49146a[_0x85eb('0x87')])[_0x85eb('0xf7')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x49146a[_0x85eb('0xe4')]?moment(_0x49146a[_0x85eb('0x12f')])[_0x85eb('0xf7')](_0x85eb('0x118'))[_0x85eb('0xaa')]():'','disposition':_0x49146a[_0x85eb('0xe5')],'chatInfo':{'browser':_0x49146a['browserName'],'os':_0x49146a['osName'],'referer':_0x49146a[_0x85eb('0x130')],'customerIp':_0x49146a[_0x85eb('0x131')],'customerPort':_0x49146a[_0x85eb('0x132')]?_0x49146a[_0x85eb('0x132')]:'N.A.'},'messages':_(_0x49146a['Messages'])[_0x85eb('0x133')]()['filter']({'secret':![]})[_0x85eb('0x40')](function(_0x2d1a82){if(_0x2d1a82[_0x85eb('0xec')]){var _0x188ace=path[_0x85eb('0xf1')](_0x163a17,_0x2d1a82[_0x85eb('0xec')][_0x85eb('0xe9')]);if(fs[_0x85eb('0x134')](_0x188ace)){fs['createReadStream'](_0x188ace)['pipe'](fs['createWriteStream'](path['join'](_0x27ea02,_0x2d1a82[_0x85eb('0xec')][_0x85eb('0xe9')])));}}return{'date':moment(_0x2d1a82[_0x85eb('0x87')])[_0x85eb('0xf7')](_0x85eb('0x118'))[_0x85eb('0xaa')](),'sender':_0x2d1a82[_0x85eb('0x105')]===_0x85eb('0xdd')?_0x2d1a82[_0x85eb('0x80')]?_0x2d1a82['User'][_0x85eb('0xd2')]:_0x85eb('0x100'):_0x2d1a82[_0x85eb('0x73')]['firstName']+(_0x2d1a82['Contact'][_0x85eb('0x128')]?'\x20'+_0x2d1a82['Contact']['lastName']:''),'body':_0x2d1a82[_0x85eb('0xec')]?_0x2d1a82[_0x85eb('0xec')]['basename']:_0x2d1a82['body'],'direction':_0x2d1a82[_0x85eb('0x105')]===_0x85eb('0xdd')?'A':'C','secret':_0x2d1a82[_0x85eb('0x106')],'read':_0x2d1a82['read'],'attachment':_0x2d1a82[_0x85eb('0xec')]};})[_0x85eb('0x6f')]()};return ejs[_0x85eb('0x135')](path[_0x85eb('0xf1')](config[_0x85eb('0xf2')],_0x85eb('0x124'),'views','downloadInteraction.ejs'),{'interaction':_0xa82740})[_0x85eb('0x22')](function(_0x226fbf){var _0x5f38af=path['join'](_0x27ea02,'transcript-'+_0x49146a['id']+'-'+_0x411f08+_0x85eb('0x136'));var _0x16b750={'path':_0x5f38af,'channel':_0x85eb('0x12d'),'interactionId':_0x49146a['id']};return pdf['createPdfFromHTML'](_0x226fbf,_0x16b750);})[_0x85eb('0x22')](function(){return new BPromise(function(_0x28229e,_0x46330e){zipdir(_0x27ea02,{'saveTo':_0x4675d1},function(_0x5ab7ab,_0x9be3b4){if(_0x5ab7ab)return _0x46330e(_0x5ab7ab);return _0x28229e(_0x9be3b4);});})[_0x85eb('0x22')](function(){return new BPromise(function(_0x4ee6d3,_0x42c865){rimraf(_0x27ea02,function(_0x329ba3){if(_0x329ba3)_0x42c865(_0x329ba3);return _0x4ee6d3();});});})[_0x85eb('0x22')](function(){return _0x1c3ed4['download'](_0x4675d1,_0x5a3a94,function(_0x3dc0d5){if(_0x3dc0d5){console[_0x85eb('0x137')](_0x85eb('0x138'),_0x3dc0d5);}else{fs[_0x85eb('0x139')](_0x4675d1);}});});});}else{return _0x1c3ed4[_0x85eb('0x2b')](0xc8);}})[_0x85eb('0x44')](handleError(_0x1c3ed4,null));}; \ No newline at end of file +var _0x9ffd=['MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','params','includeAll','find','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooNote','vidaooApiKey','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','create','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','secret','include','includeAgent','push','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','CmContact','firstName','attachments','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','lastName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','stack','name','render','merge','body','contact','account','Users','fullname','Tags','TagIds','split','forEach','index','ChatInteraction','rawAttributes','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','select','field','color','from','left_join','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x394bee,_0x5a98c5){_0x394bee=_0x394bee-0x0;var _0x228b1d=_0x9ffd[_0x394bee];return _0x228b1d;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var pdf=require(_0xd9ff('0x13'));var hardwareService=require(_0xd9ff('0x14'));var logger=require(_0xd9ff('0x15'))(_0xd9ff('0x16'));var utils=require(_0xd9ff('0x17'));var config=require(_0xd9ff('0x18'));var licenseUtil=require(_0xd9ff('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd9ff('0x1a')](config[_0xd9ff('0x1b')],{'host':_0xd9ff('0x1c'),'port':0x18eb});var socket=require(_0xd9ff('0x1d'))(new Redis(config[_0xd9ff('0x1b')]));require('./chatInteraction.socket')[_0xd9ff('0x1e')](socket);var jayson=require(_0xd9ff('0x1f'));var client=jayson['client'][_0xd9ff('0x20')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x547e28,_0x4c5718,_0x271287,_0x4f9d6d){return new BPromise(function(_0x35679e,_0xa30fd2){var _0x39c6ce=_0x4f9d6d||client;return _0x39c6ce[_0xd9ff('0x21')](_0x547e28,_0x271287)[_0xd9ff('0x22')](function(_0x2d4df1){logger[_0xd9ff('0x23')](_0xd9ff('0x24'),_0x4c5718,_0xd9ff('0x25'));logger[_0xd9ff('0x26')](_0xd9ff('0x27'),_0x4c5718,_0xd9ff('0x25'),JSON[_0xd9ff('0x28')](_0x2d4df1));if(_0x2d4df1['error']){if(_0x2d4df1['error'][_0xd9ff('0x29')]===0x1f4){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x2d4df1['error']['message']);return _0xa30fd2(_0x2d4df1['error'][_0xd9ff('0x2b')]);}logger['error'](_0xd9ff('0x24'),_0x4c5718,_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);return _0x35679e(_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);}else{logger[_0xd9ff('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,'request\x20sent');_0x35679e(_0x2d4df1[_0xd9ff('0x2c')]['message']);}})[_0xd9ff('0x2d')](function(_0x4d86fe){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x4d86fe);_0xa30fd2(_0x4d86fe);});});}function respondWithStatusCode(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0xcc;return function(_0x2138b4){if(_0x2138b4){return _0x10cbdd[_0xd9ff('0x2e')](_0x159e56);}return _0x10cbdd['status'](_0x159e56)[_0xd9ff('0x2f')]();};}function respondWithResult(_0xe11f88,_0x1c78c4){_0x1c78c4=_0x1c78c4||0xc8;return function(_0x4390f7){if(_0x4390f7){return _0xe11f88['status'](_0x1c78c4)[_0xd9ff('0x30')](_0x4390f7);}};}function respondWithFilteredResult(_0x3792d9,_0x44b5a7){return function(_0x45fb63){if(_0x45fb63){var _0x263d3a=typeof _0x44b5a7[_0xd9ff('0x31')]===_0xd9ff('0x32')&&typeof _0x44b5a7[_0xd9ff('0x33')]===_0xd9ff('0x32');var _0x5706cf=_0x45fb63[_0xd9ff('0x34')];var _0x4ba2be=_0x263d3a?0x0:_0x44b5a7[_0xd9ff('0x31')];var _0x29c532=_0x263d3a?_0x45fb63[_0xd9ff('0x34')]:_0x44b5a7['offset']+_0x44b5a7[_0xd9ff('0x33')];var _0x3b26da;if(_0x29c532>=_0x5706cf){_0x29c532=_0x5706cf;_0x3b26da=0xc8;}else{_0x3b26da=0xce;}_0x3792d9[_0xd9ff('0x35')](_0x3b26da);return _0x3792d9[_0xd9ff('0x36')]('Content-Range',_0x4ba2be+'-'+_0x29c532+'/'+_0x5706cf)[_0xd9ff('0x30')](_0x45fb63);}return null;};}function patchUpdates(_0x5743de){return function(_0x18c28b){try{jsonpatch[_0xd9ff('0x37')](_0x18c28b,_0x5743de,!![]);}catch(_0x323cb5){return BPromise[_0xd9ff('0x38')](_0x323cb5);}return _0x18c28b[_0xd9ff('0x39')]();};}function saveUpdates(_0xdf3947,_0x2cc2ae){return function(_0x281c7b){if(_0x281c7b){return _0x281c7b[_0xd9ff('0x3a')](_0xdf3947)[_0xd9ff('0x22')](function(_0x4813a5){return _0x4813a5;});}return null;};}function removeEntity(_0x34e9a9,_0x4670e4){return function(_0x66f4d){if(_0x66f4d){return _0x66f4d['destroy']()[_0xd9ff('0x22')](function(){_0x34e9a9[_0xd9ff('0x35')](0xcc)[_0xd9ff('0x2f')]();});}};}function handleEntityNotFound(_0x4ab10f,_0x3d449d){return function(_0x5e3ff9){if(!_0x5e3ff9){_0x4ab10f[_0xd9ff('0x2e')](0x194);}return _0x5e3ff9;};}function handleError(_0x4ae56b,_0x20a021){_0x20a021=_0x20a021||0x1f4;return function(_0x5db498){logger[_0xd9ff('0x2a')](_0x5db498[_0xd9ff('0x3b')]);if(_0x5db498[_0xd9ff('0x3c')]){delete _0x5db498['name'];}_0x4ae56b['status'](_0x20a021)['send'](_0x5db498);};}function getMustacheRender(_0x7ac3d1,_0x30fc5b){return Mustache[_0xd9ff('0x3d')](_0x7ac3d1,_[_0xd9ff('0x3e')](_0x30fc5b[_0xd9ff('0x3f')],{'contact':_0x30fc5b[_0xd9ff('0x40')],'message':_0x30fc5b['message'],'agent':_0x30fc5b['agent'],'interaction':_0x30fc5b['interaction'],'account':_0x30fc5b[_0xd9ff('0x41')]}))||'';}function getInteractionUsers(_0x252edc,_0x918c9a){return new BPromise(function(_0x32adae,_0x56b94d){try{if(_0x918c9a[_0x252edc['id']]){_0x252edc[_0xd9ff('0x42')]=_['map'](_0x918c9a[_0x252edc['id']],function(_0x3cff52){return{'id':_0x3cff52['id'],'fullname':_0x3cff52[_0xd9ff('0x43')]};});}}catch(_0x1bedaf){_0x56b94d(_0x1bedaf);}_0x32adae(_0x252edc);});}function getInteractionTags(_0x169dc7,_0x59fc07){return new BPromise(function(_0x1e34da,_0x2d4d97){try{if(_0x169dc7['TagIds']){_0x169dc7[_0xd9ff('0x44')]=[];_0x169dc7[_0xd9ff('0x45')][_0xd9ff('0x46')](',')[_0xd9ff('0x47')](function(_0x1fe44d){_0x169dc7[_0xd9ff('0x44')]['push'](_0x59fc07[_0x1fe44d]);});}delete _0x169dc7[_0xd9ff('0x45')];}catch(_0x116f28){_0x2d4d97(_0x116f28);}_0x1e34da(_0x169dc7);});}function updateChatInteraction(_0x10533a,_0x39fbbb,_0x472724){return new BPromise(function(_0x52aab8,_0x3178cd){return getInteractionUsers(_0x10533a,_0x472724)[_0xd9ff('0x22')](function(_0xe0bc49){return getInteractionTags(_0xe0bc49,_0x39fbbb);})['then'](function(_0x5d06dd){_0x52aab8(_0x5d06dd);})[_0xd9ff('0x2d')](function(_0x7eb1a){_0x3178cd(_0x7eb1a);});});}exports[_0xd9ff('0x48')]=function(_0x2dfb8f,_0x437561){var _0x30c69d={},_0x564ef4={},_0xd64585={'count':0x0,'rows':[]};var _0x2d3013=_['map'](db[_0xd9ff('0x49')][_0xd9ff('0x4a')],function(_0x13a1ec){return{'name':_0x13a1ec[_0xd9ff('0x4b')],'type':_0x13a1ec[_0xd9ff('0x4c')]['key']};});_0x564ef4['model']=_['map'](_0x2d3013,_0xd9ff('0x3c'));_0x564ef4['query']=_[_0xd9ff('0x4d')](_0x2dfb8f[_0xd9ff('0x4e')]);_0x564ef4[_0xd9ff('0x4f')]=_['intersection'](_0x564ef4[_0xd9ff('0x50')],_0x564ef4[_0xd9ff('0x4e')]);_0x30c69d['attributes']=_[_0xd9ff('0x51')](_0x564ef4[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x2dfb8f[_0xd9ff('0x4e')]['fields']));_0x30c69d[_0xd9ff('0x53')]=_0x30c69d['attributes'][_0xd9ff('0x54')]?_0x30c69d['attributes']:_0x564ef4[_0xd9ff('0x50')];if(!_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x30c69d[_0xd9ff('0x33')]=qs['limit'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x30c69d[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2dfb8f['query']['offset']);}_0x30c69d['order']=qs[_0xd9ff('0x57')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x30c69d['where']=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0x2dfb8f[_0xd9ff('0x4e')],_0x564ef4[_0xd9ff('0x4f')]),_0x2d3013);var _0xfede73=[];var _0x40d391=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5a')]('id')[_0xd9ff('0x5a')](_0xd9ff('0x3c'))[_0xd9ff('0x5a')](_0xd9ff('0x5b'))[_0xd9ff('0x5c')]('tools_tags');var _0x3ed112=squel['select']()[_0xd9ff('0x5a')]('u.id')[_0xd9ff('0x5a')]('u.fullname')[_0xd9ff('0x5a')]('ui.ChatInteractionId')[_0xd9ff('0x5c')]('user_has_chat_interactions','ui')[_0xd9ff('0x5d')]('users','u',_0xd9ff('0x5e'));var _0x5da1a8=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5c')](_0xd9ff('0x5f'),'i')[_0xd9ff('0x5d')]('cm_contacts','c',_0xd9ff('0x60'))[_0xd9ff('0x5d')](_0xd9ff('0x61'),'o','o.id\x20=\x20i.UserId')[_0xd9ff('0x5d')](_0xd9ff('0x62'),'a',_0xd9ff('0x63'))[_0xd9ff('0x5d')](_0xd9ff('0x64'),'me','me.ChatInteractionId\x20=\x20i.id')[_0xd9ff('0x5d')](_0xd9ff('0x65'),'it',_0xd9ff('0x66'))[_0xd9ff('0x5d')](_0xd9ff('0x67'),'t',_0xd9ff('0x68'));var _0x458fd4=squel['expr']();var _0x3be850=[];var _0x11251f=squel['expr']();var _0x1c885f;if(_0x2dfb8f[_0xd9ff('0x4e')]['search']){_0x1c885f=as[_0xd9ff('0x69')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x6a')]);var _0x54ea27=_0x1c885f['sqlOperator'];for(var _0x39473e=0x0;_0x39473e<_0x1c885f['conditions'][_0xd9ff('0x54')];_0x39473e++){var _0x1e4d0c=_0x1c885f[_0xd9ff('0x6b')][_0x39473e];var _0x102aea='i';var _0x53a230=_['find'](_0x2d3013,['name',_0x1e4d0c[_0xd9ff('0x5a')]]);if(!_0x53a230){switch(_0x1e4d0c[_0xd9ff('0x5a')]){case _0xd9ff('0x6c'):if(_0x1e4d0c[_0xd9ff('0x6d')]==0x1){_0x5da1a8[_0xd9ff('0x6e')]('`'+_0x1e4d0c['field']+_0xd9ff('0x6f'));}else{_0x5da1a8['having']('`'+_0x1e4d0c[_0xd9ff('0x5a')]+_0xd9ff('0x70'));}break;case _0xd9ff('0x71'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){if(_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')]('\x20')[_0xd9ff('0x54')]>0x1){_0x458fd4[_0x54ea27]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd9ff('0x74')](_0x1e4d0c[_0xd9ff('0x6d')]),null);}else{var _0x4f5338='%'+_0x1e4d0c['value']+'%';_0x458fd4[_0x54ea27](_0xd9ff('0x75'),_0x4f5338,_0x4f5338,_0x4f5338);}}else{_0x53a230=_['find'](_0x2d3013,[_0xd9ff('0x3c'),_0xd9ff('0x76')]);_0x1e4d0c['field']=_0xd9ff('0x76');_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')]['start'],_0x58c9c2[_0xd9ff('0x6d')]['end']);}break;case'Tag':var _0x3dabb1=_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')](',')[_0xd9ff('0x79')](function(_0x56d822){return Number(_0x56d822);});_0x3dabb1[_0xd9ff('0x47')](function(_0x23b816){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x23b816+',%');});_0x3be850=_[_0xd9ff('0x7b')](_0x3be850,_0x3dabb1);break;case _0xd9ff('0x7c'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){_0x458fd4[_0x54ea27](_0xd9ff('0x7d'),'%'+_0x1e4d0c['value']+'%',null);}else{_0x53a230=_['find'](_0x2d3013,['name',_0xd9ff('0x7e')]);_0x1e4d0c[_0xd9ff('0x5a')]='UserId';_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}break;case _0xd9ff('0x3f'):_0x58c9c2=as['buildExpression']('me',null,_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2['value'][_0xd9ff('0x2f')]);break;}}else{var _0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2['value'][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}}}else{var _0x1cd620=_(_0x2dfb8f['query'])[_0xd9ff('0x4d')]()[_0xd9ff('0x79')](function(_0x1de5c9){return _['some'](_0x2d3013,[_0xd9ff('0x3c'),_0x1de5c9])?_0x1de5c9:undefined;})[_0xd9ff('0x80')]()[_0xd9ff('0x6d')]();if(!_['isEmpty'](_0x1cd620)){_0x1cd620[_0xd9ff('0x47')](function(_0x35926f){if(_0x35926f===_0xd9ff('0x81')){_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0x83'),[]['concat'](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]));}else if(_0x35926f===_0xd9ff('0x84')){var _0x59af0a=JSON[_0xd9ff('0x85')](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f])[_0xd9ff('0x86')];var _0x5d1973=JSON[_0xd9ff('0x85')](_0x2dfb8f['query'][_0x35926f])[_0xd9ff('0x87')];_0x5da1a8['where'](_0xd9ff('0x88'),_0x59af0a,_0x5d1973);}else{if(_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]===_0xd9ff('0x89')){_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8a'));}else{_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8b'),_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]);}}});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8c')]){if(_0x2dfb8f['query'][_0xd9ff('0x8c')]==0x1){_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8d'));}else{_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8e'));}}if(_0x2dfb8f[_0xd9ff('0x4e')]['tag']){_0x3be850=_['isArray'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')])?_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]:new Array(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]);_0x3be850['forEach'](function(_0x1d34a1){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x1d34a1+',%');});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x90')]){var _0x14c89f=_0x2dfb8f[_0xd9ff('0x4e')]['filter'][_0xd9ff('0x91')]('\x5c','\x5c\x5c')[_0xd9ff('0x91')](/'/g,'\x27\x27');if(qs[_0xd9ff('0x92')](_0x14c89f)){_0x458fd4['or'](_0xd9ff('0x93'),_0x14c89f+'%');}else{_0x458fd4['or'](_0xd9ff('0x94'),qs[_0xd9ff('0x74')](_0x14c89f))['or'](_0xd9ff('0x95'),_0x14c89f+'%');}}}_0x5da1a8[_0xd9ff('0x82')](_0x458fd4);_0x5da1a8['group'](_0xd9ff('0x96'));var _0x4c2ad5={'type':db[_0xd9ff('0x97')][_0xd9ff('0x98')][_0xd9ff('0x99')],'raw':!![]};var _0x2d2d1c=_0x5da1a8[_0xd9ff('0x9a')]();_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x96'));_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));if(_0x30c69d[_0xd9ff('0x9c')]){_0x30c69d[_0xd9ff('0x9c')][_0xd9ff('0x47')](function(_0x5d29b9){var _0x4413c4=_0x5d29b9[0x0]===_0xd9ff('0x9d')?_0x5d29b9[0x0]:'i.'+_0x5d29b9[0x0];_0x5da1a8[_0xd9ff('0x9c')](_0x4413c4,_0x5d29b9[0x1]===_0xd9ff('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x3be850)){_0x5da1a8[_0xd9ff('0x6e')](_0x11251f);_0x2d2d1c[_0xd9ff('0x82')]('t.id\x20IN\x20?',_0x3be850);}BPromise[_0xd9ff('0x9f')]()[_0xd9ff('0x22')](function(){if(!_0x1c885f){if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x81')])return;_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa0'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x2dfb8f[_0xd9ff('0xa1')]['role']!==_0xd9ff('0xa2'))return;return _0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa3')]({'attributes':['id'],'raw':!![]})[_0xd9ff('0x22')](function(_0x320adb){if(_[_0xd9ff('0xa4')](_0x320adb)){_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa5'));_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0xa5'));}else{_0x2d2d1c[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));}});})[_0xd9ff('0x22')](function(){if(_0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa6')]===_0xd9ff('0xa2')&&!_0x1c885f&&!_0x2dfb8f[_0xd9ff('0x4e')]['ChatWebsiteId'])return[];return db['sequelize'][_0xd9ff('0x4e')](_0x2d2d1c['toString'](),_0x4c2ad5);})['then'](function(_0x4a55c1){_0xd64585['count']=_0x4a55c1[_0xd9ff('0x54')];if(_0xd64585[_0xd9ff('0x34')]===0x0)return[];return db[_0xd9ff('0xa7')]['query'](_0x40d391['toString'](),_0x4c2ad5)[_0xd9ff('0x22')](function(_0x5e7f52){_0xfede73=_[_0xd9ff('0xa8')](_0x5e7f52,'id');_0x4c2ad5=_['merge'](_0x4c2ad5,{'model':db[_0xd9ff('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x52')]){_0x30c69d[_0xd9ff('0x53')][_0xd9ff('0x47')](function(_0x4e6dd2){_0x5da1a8['field']('i.'+_0x4e6dd2);});}else{_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xa9'),'Account.key');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xaa'),_0xd9ff('0xab'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xac'),_0xd9ff('0x9d'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xad'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xae'),_0xd9ff('0xaf'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb0'),'Contact.lastName');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb1'),'Contact.email');_0x5da1a8['field'](_0xd9ff('0xb2'),_0xd9ff('0xb3'));_0x5da1a8['field'](_0xd9ff('0xb4'),_0xd9ff('0xb5'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb6'),_0xd9ff('0xb7'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb8'),_0xd9ff('0xb9'));_0x5da1a8['field']('o.internal','Owner.internal');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xba'),_0xd9ff('0x45'));}if(_0x30c69d['limit'])_0x5da1a8[_0xd9ff('0x33')](_0x30c69d[_0xd9ff('0x33')]);if(_0x30c69d[_0xd9ff('0x31')])_0x5da1a8[_0xd9ff('0x31')](_0x30c69d[_0xd9ff('0x31')]);return db[_0xd9ff('0xa7')]['query'](_0x5da1a8[_0xd9ff('0xbb')](),_0x4c2ad5);})['then'](function(_0x5cb3af){if(_0x5cb3af[_0xd9ff('0x54')]>0x0)_0x3ed112[_0xd9ff('0x82')](_0xd9ff('0xbc'),_['map'](_0x5cb3af,'id'));return db[_0xd9ff('0xa7')][_0xd9ff('0x4e')](_0x3ed112['toString'](),_0x4c2ad5)['then'](function(_0x4aa6d5){var _0x11840a=_[_0xd9ff('0xbd')](_0x4aa6d5,'ChatInteractionId');var _0x2871ec=[];_0x5cb3af[_0xd9ff('0x47')](function(_0x16e130){_0x2871ec['push'](updateChatInteraction(_0x16e130,_0xfede73,_0x11840a));});return BPromise['all'](_0x2871ec);});});})['then'](function(_0xdf2e33){_0xd64585['rows']=_0xdf2e33;return _0xd64585;})[_0xd9ff('0x22')](respondWithFilteredResult(_0x437561,_0x30c69d))[_0xd9ff('0x2d')](handleError(_0x437561,null));};exports['show']=function(_0x1b048b,_0x5eeeaf){var _0x3339e5={'raw':![],'where':{'id':_0x1b048b[_0xd9ff('0xbe')]['id']}},_0x1f7d87={};_0x1f7d87['model']=_[_0xd9ff('0x4d')](db['ChatInteraction']['rawAttributes']);_0x1f7d87['query']=_[_0xd9ff('0x4d')](_0x1b048b[_0xd9ff('0x4e')]);_0x1f7d87[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x1f7d87['model'],_0x1f7d87['query']);_0x3339e5[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x1f7d87[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x1b048b[_0xd9ff('0x4e')]['fields']));_0x3339e5['attributes']=_0x3339e5[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x3339e5[_0xd9ff('0x53')]:_0x1f7d87[_0xd9ff('0x50')];if(_0x1b048b[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x3339e5['include']=[{'all':!![]}];}_0x3339e5=_[_0xd9ff('0x3e')]({},_0x3339e5,_0x1b048b['options']);return db['ChatInteraction'][_0xd9ff('0xc0')](_0x3339e5)[_0xd9ff('0x22')](handleEntityNotFound(_0x5eeeaf,null))[_0xd9ff('0x22')](respondWithResult(_0x5eeeaf,null))[_0xd9ff('0x2d')](handleError(_0x5eeeaf,null));};exports['create']=function(_0x4e3fdd,_0x2cf8da){return db['ChatInteraction']['create'](_0x4e3fdd[_0xd9ff('0x3f')],{})['then'](respondWithResult(_0x2cf8da,0xc9))[_0xd9ff('0x2d')](handleError(_0x2cf8da,null));};exports['update']=function(_0x327cd8,_0xd95329){if(_0x327cd8[_0xd9ff('0x3f')]['id']){delete _0x327cd8[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x327cd8[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0xd95329,null))[_0xd9ff('0x22')](saveUpdates(_0x327cd8['body'],null))['then'](respondWithResult(_0xd95329,null))[_0xd9ff('0x2d')](handleError(_0xd95329,null));};exports[_0xd9ff('0xc1')]=function(_0x499869,_0x3c86ac){return db['ChatInteraction']['find']({'where':{'id':_0x499869[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x3c86ac,null))[_0xd9ff('0x22')](removeEntity(_0x3c86ac,null))[_0xd9ff('0x2d')](handleError(_0x3c86ac,null));};exports[_0xd9ff('0xc2')]=function(_0x11c84f,_0x2d0261){return db[_0xd9ff('0x49')][_0xd9ff('0xc2')]()[_0xd9ff('0x22')](respondWithResult(_0x2d0261,null))[_0xd9ff('0x2d')](handleError(_0x2d0261,null));};exports[_0xd9ff('0xc3')]=function(_0x73cfcf,_0x538f20){var _0x51feff=_0x73cfcf['params']['id'];var _0x30c62c;var _0x50b6b2;var _0x413aef;return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x51feff}})[_0xd9ff('0x22')](function(_0x54c390){_0x30c62c=_0x54c390;return db[_0xd9ff('0xc5')]['findOne']({'where':{'id':_0x54c390[_0xd9ff('0x81')]},'attributes':['id','vidaooApiKey','vidaooEscalation','vidaooTopic',_0xd9ff('0xc6'),'vidaooMetadata'],'raw':!![]});})[_0xd9ff('0x22')](function(_0x54524c){if(_0x54524c&&_0x54524c[_0xd9ff('0xc7')]&&_0x54524c[_0xd9ff('0xc8')]){_0x50b6b2=_0x54524c;var _0x696e18={'interaction':{'id':_0x51feff},'agent':{'id':_0x73cfcf[_0xd9ff('0xa1')]['id'],'name':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0x3c')],'fullname':_0x73cfcf['user']['fullname'],'email':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]},'contact':_0x73cfcf[_0xd9ff('0x3f')][_0xd9ff('0x40')],'account':_0x73cfcf[_0xd9ff('0x3f')]['account']};var _0x432854={'rejectUnauthorized':![],'method':_0xd9ff('0xca'),'url':_0xd9ff('0xcb'),'headers':{'X-APIKEY':_0x54524c[_0xd9ff('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]],'buttons':null,'topic':_0x50b6b2['vidaooTopic'],'note':_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xc6')])?null:getMustacheRender(_0x50b6b2[_0xd9ff('0xc6')],_0x696e18),'metadata':null},'redirect':_0xd9ff('0xcd'),'json':!![]};try{if(!_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xce')])){var _0x1c8e55=getMustacheRender(_0x50b6b2[_0xd9ff('0xce')],_0x696e18);var _0x29fdb8=JSON[_0xd9ff('0x85')](_0x1c8e55);_0x432854[_0xd9ff('0x3f')][_0xd9ff('0xcf')]=_0x29fdb8;}}catch(_0xfc755a){throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))](_0xd9ff('0xd1'));}return rp(_0x432854);}else{throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xd9ff('0x22')](function(_0x282183){_0x413aef=_0x282183;if(_0x413aef['id']){var _0x3aba00={'body':_0x413aef[_0xd9ff('0xd2')],'ChatWebsiteId':_0x50b6b2['id'],'ChatInteractionId':_0x30c62c['id'],'direction':_0xd9ff('0xd3'),'UserId':_0x73cfcf[_0xd9ff('0xa1')]['id']};return db[_0xd9ff('0xd4')][_0xd9ff('0xd5')](_0x3aba00,{});}else{throw new db['Sequelize'][(_0xd9ff('0xd0'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xd9ff('0x22')](function(){return _0x30c62c[_0xd9ff('0xd6')]({'vidaooSessionId':_0x413aef['id']});})[_0xd9ff('0x22')](respondWithResult(_0x538f20,null))[_0xd9ff('0x2d')](handleError(_0x538f20,null));};exports[_0xd9ff('0xd7')]=function(_0x204127,_0xf98666){if(_0x204127['body']['id']){delete _0x204127[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x204127[_0xd9ff('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0xd9ff('0x71')}]})[_0xd9ff('0x22')](handleEntityNotFound(_0xf98666,null))['then'](saveUpdates(_0x204127[_0xd9ff('0x3f')],null))[_0xd9ff('0x22')](respondWithResult(_0xf98666,null))['catch'](handleError(_0xf98666,null));};exports['abandon']=function(_0x5c4138,_0x560ea2,_0x1e6d5a){if(_0x5c4138[_0xd9ff('0x3f')]['id']){delete _0x5c4138[_0xd9ff('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5c4138[_0xd9ff('0xbe')]['id']}})['then'](function(_0x43a941){if(!_0x43a941){logger[_0xd9ff('0x2a')](_0xd9ff('0xd8'),'abandon',0x194,'entity\x20not\x20found');_0x560ea2['sendStatus'](0x194);}else{if(_0x43a941[_0xd9ff('0x7e')]){throw new db[(_0xd9ff('0x97'))]['ValidationError'](_0xd9ff('0xd9'));}}return _0x43a941;})[_0xd9ff('0x22')](function(_0x7efe12){if(_0x7efe12){return _0x7efe12[_0xd9ff('0x3a')]({'closed':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xda')],'disposition':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xdb')]})[_0xd9ff('0x22')](function(_0x3b7aeb){return _0x3b7aeb;});}})[_0xd9ff('0x22')](function(_0x37eb49){return respondWithRpcPromise(_0xd9ff('0xdc'),_0xd9ff('0xdd'),_0x5c4138[_0xd9ff('0x3f')],client9004);})[_0xd9ff('0x22')](respondWithResult(_0x560ea2,null))[_0xd9ff('0x2d')](handleError(_0x560ea2,null));};exports[_0xd9ff('0xde')]=function(_0x3b05c4,_0x32c04e,_0x1bcf8f){_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0x3c')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe0')];_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0xe1')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe2')];_0x3b05c4['body'][_0xd9ff('0x4c')]=_0x3b05c4[_0xd9ff('0xdf')]['mimetype'];return db[_0xd9ff('0xe3')][_0xd9ff('0xd5')](_0x3b05c4[_0xd9ff('0x3f')])[_0xd9ff('0x22')](respondWithResult(_0x32c04e,0xc9))[_0xd9ff('0x2d')](handleError(_0x32c04e,null));};exports[_0xd9ff('0xe4')]=function(_0x5978ad,_0x4ddfe7,_0x30c520){return db['ChatInteraction']['findOne']({'where':{'id':_0x5978ad[_0xd9ff('0xbe')]['id']},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null))['then'](function(_0x327362){if(_0x327362){if(_0x327362[_0xd9ff('0xda')]){return _0x4ddfe7[_0xd9ff('0x35')](0x193)[_0xd9ff('0x30')]({'status':0x193,'message':'Unauthorized'});}return db[_0xd9ff('0xe3')][_0xd9ff('0xc4')]({'where':{'id':_0x5978ad['query'][_0xd9ff('0xe5')]},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null));}})['then'](function(_0x62f1f3){if(_0x62f1f3){var _0xd188cf=_0x62f1f3[_0xd9ff('0xe6')]!==null;var _0x5b2e9c=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],_0xd9ff('0xe9'));if(_0xd188cf){_0x5b2e9c=path['join'](_0x5b2e9c,_0xd9ff('0xea'));}var _0x53a25a=path[_0xd9ff('0xe7')](_0x5b2e9c,_0x62f1f3[_0xd9ff('0xe1')]);return _0x4ddfe7[_0xd9ff('0xeb')](_0x53a25a);}})[_0xd9ff('0x2d')](handleError(_0x4ddfe7,null));};exports[_0xd9ff('0xec')]=function(_0x10397d,_0x51039f){var _0x37ea50=null;var _0x3cf2ef=null;var _0x171195=null;var _0x24c066=null;if(_0x10397d[_0xd9ff('0x3f')]['id']){delete _0x10397d['body']['id'];}if(_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]){_0x24c066=path['join'](config[_0xd9ff('0xe8')],_0xd9ff('0xee'),util[_0xd9ff('0xef')](_0xd9ff('0xf0'),Date[_0xd9ff('0xf1')]()));_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xf2')]=_0x24c066;}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x10397d[_0xd9ff('0xbe')]['id']},'include':[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'include':[{'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c')}]}]})[_0xd9ff('0x22')](handleEntityNotFound(_0x51039f,null))[_0xd9ff('0x22')](saveUpdates(_0x10397d['body'],null))['then'](function(_0x497e36){if(_0x497e36){_0x37ea50=_0x497e36;return db[_0xd9ff('0xc5')]['find']({'where':{'id':_0x37ea50[_0xd9ff('0x81')]}});}})['then'](function(_0x4d4cc0){if(_0x4d4cc0){_0x171195=_0x4d4cc0;return db['CmContact'][_0xd9ff('0xc0')]({'where':{'id':_0x37ea50['ContactId']}});}})['then'](function(_0x474b4c){if(_0x474b4c){_0x3cf2ef=_0x474b4c;if(_0x24c066){var _0x144cf7=null;for(var _0x9eac7f=0x1;_0x9eac7f<_0x37ea50[_0xd9ff('0xf3')][_0xd9ff('0x54')];++_0x9eac7f){_0x144cf7=_0x37ea50[_0xd9ff('0xf3')][_0x9eac7f];var _0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');var _0x4531bc=_0x10397d['body']['customer']||util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0xd9ff('0xf7'),_0x144cf7[_0xd9ff('0x76')]);switch(_0x171195[_0xd9ff('0xf8')]){case _0xd9ff('0xf9'):_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')]('%s%d',_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');break;case _0xd9ff('0xfa'):_0x2450da=_0x144cf7['UserId']?_0x144cf7['User'][_0xd9ff('0xfb')]||_0x144cf7[_0xd9ff('0x7c')]['fullname']:_0xd9ff('0xf6');break;case _0xd9ff('0xfc'):_0x2450da=_0x144cf7['UserId']?_0x144cf7[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6');break;default:_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7['UserId']):_0xd9ff('0xf6');}var _0x62b518=util[_0xd9ff('0xef')](_0xd9ff('0xfd'),moment(_0x144cf7[_0xd9ff('0x84')])['format'](_0xd9ff('0xfe')),_0x144cf7[_0xd9ff('0xff')]==='in'?_0x4531bc:_0x2450da,_0x144cf7[_0xd9ff('0x3f')]);if(!_0x144cf7['secret']){fs[_0xd9ff('0x100')](_0x24c066,_0x62b518);}}return db[_0xd9ff('0x101')][_0xd9ff('0xc4')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd9ff('0x102'),'raw':!![]}]});}}})['then'](function(_0x5e07ae){if(_0x5e07ae&&_0x5e07ae['Smtp']&&_0x10397d['body']){var _0x578f41={'tls':{'rejectUnauthorized':![]}};if(_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')]){_0x578f41['service']=_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')];}else{_0x578f41[_0xd9ff('0x104')]=_0x5e07ae['Smtp'][_0xd9ff('0x104')];_0x578f41['port']=_0x5e07ae['Smtp'][_0xd9ff('0x105')];_0x578f41[_0xd9ff('0x106')]=_0x5e07ae[_0xd9ff('0x102')]['secure'];}if(_0x5e07ae['Smtp'][_0xd9ff('0x107')]){_0x578f41[_0xd9ff('0x108')]={'user':_0x5e07ae['Smtp'][_0xd9ff('0xa1')],'pass':_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x109')]};}return respondWithRpcPromise(_0xd9ff('0x10a'),_0xd9ff('0x10b'),{'account':_0x578f41,'message':{'from':util[_0xd9ff('0xef')](_0xd9ff('0x10c'),_0x5e07ae['name'],_0x5e07ae[_0xd9ff('0xc9')]||_0x5e07ae[_0xd9ff('0x102')]['user']),'to':_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')],'subject':'Mail\x20Transcript','text':util[_0xd9ff('0xef')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]),'attachments':[{'path':_0x24c066}]}})['then'](function(){return _0x37ea50;})[_0xd9ff('0x2d')](function(_0x4d6172){console[_0xd9ff('0x2a')](_0x4d6172);});}else{return _0x37ea50;}})[_0xd9ff('0x22')](respondWithStatusCode(_0x51039f,0xc8))[_0xd9ff('0x2d')](handleError(_0x51039f,null));};exports[_0xd9ff('0x10d')]=function(_0x6a2524,_0x356583,_0x5c1165){return db['ChatMessage'][_0xd9ff('0xc0')]({'where':{'id':_0x6a2524['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x356583,null))[_0xd9ff('0x22')](function(_0x599273){if(_0x599273){return _0x599273['addMessage'](_0x6a2524['body'][_0xd9ff('0x10e')],_[_0xd9ff('0x10f')](_0x6a2524[_0xd9ff('0x3f')],['ids','id'])||{});}})[_0xd9ff('0x22')](respondWithResult(_0x356583,null))[_0xd9ff('0x2d')](handleError(_0x356583,null));};exports[_0xd9ff('0x110')]=function(_0x2832b7,_0x618c47,_0x109140){var _0x278670={'raw':![],'where':{}};var _0x5e064d={};var _0x231b46={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x2832b7[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x618c47,null))[_0xd9ff('0x22')](function(_0x1802b1){if(_0x1802b1){_0x5e064d[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')][_0xd9ff('0x4a')]);_0x5e064d['query']=_['keys'](_0x2832b7[_0xd9ff('0x4e')]);_0x5e064d['filters']=_['intersection'](_0x5e064d[_0xd9ff('0x50')],_0x5e064d[_0xd9ff('0x4e')]);_0x278670[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x5e064d[_0xd9ff('0x50')],qs['fields'](_0x2832b7[_0xd9ff('0x4e')]['fields']));_0x278670[_0xd9ff('0x53')]=_0x278670[_0xd9ff('0x53')]['length']?_0x278670[_0xd9ff('0x53')]:_0x5e064d[_0xd9ff('0x50')];if(!_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x278670[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0x2832b7['query'][_0xd9ff('0x33')]);_0x278670[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x31')]);}_0x278670[_0xd9ff('0x9c')]=qs['sort'](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x278670[_0xd9ff('0x82')]=qs['filters'](_[_0xd9ff('0x58')](_0x2832b7['query'],_0x5e064d[_0xd9ff('0x4f')]));_0x278670['where'][_0xd9ff('0x111')]=_0x1802b1['id'];if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x278670['where']=_[_0xd9ff('0x3e')](_0x278670['where'],{'$or':_[_0xd9ff('0x79')](_0x278670[_0xd9ff('0x53')],function(_0x2b2a50){var _0x34f3f0={};_0x34f3f0[_0x2b2a50]={'$like':'%'+_0x2832b7[_0xd9ff('0x4e')]['filter']+'%'};return _0x34f3f0;})});}if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')]){var _0x955328=_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')][_0xd9ff('0x46')](',');var _0x5d95b1={};_0x5d95b1[_0x955328[0x0]]={'$gte':moment(_0x955328[0x1])['format'](_0xd9ff('0x112'))};_0x278670[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x278670[_0xd9ff('0x82')],_0x5d95b1);}_0x278670=_[_0xd9ff('0x3e')]({},_0x278670,_0x2832b7[_0xd9ff('0x113')]);return db[_0xd9ff('0xd4')]['count']({'where':_0x278670[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x3e90fe){_0x231b46[_0xd9ff('0x34')]=_0x3e90fe;if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x278670['include']=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x278670);})[_0xd9ff('0x22')](function(_0x33f933){_0x231b46[_0xd9ff('0x115')]=_0x33f933;return _0x231b46;});}})[_0xd9ff('0x22')](respondWithFilteredResult(_0x618c47,_0x278670))['catch'](handleError(_0x618c47,null));};exports['getMyMessages']=function(_0xf3a93b,_0x473ecf,_0x1213a4){var _0x6f731a={'where':{}},_0x193c57={},_0x4572b2={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0xf3a93b['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x473ecf,null))[_0xd9ff('0x22')](function(_0x4115a3){if(_0x4115a3){_0x193c57[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')]['rawAttributes']);_0x193c57[_0xd9ff('0x4e')]=_['keys'](_0xf3a93b['query']);_0x193c57[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],_0x193c57[_0xd9ff('0x4e')]);_0x6f731a[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0xf3a93b['query'][_0xd9ff('0x52')]));_0x6f731a['attributes']=_0x6f731a[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x6f731a[_0xd9ff('0x53')]:_0x193c57[_0xd9ff('0x50')];if(!_0xf3a93b['query'][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x6f731a[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x6f731a[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0xf3a93b[_0xd9ff('0x4e')]['offset']);}_0x6f731a[_0xd9ff('0x9c')]=qs['sort'](_0xf3a93b['query'][_0xd9ff('0x57')]);_0x6f731a[_0xd9ff('0x82')]=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0xf3a93b[_0xd9ff('0x4e')],_0x193c57[_0xd9ff('0x4f')]));_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x111')]=_0x4115a3['id'];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x6f731a[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x6f731a['where'],{'$or':_[_0xd9ff('0x79')](_0x6f731a['attributes'],function(_0x1bb980){var _0x3ccf5d={};_0x3ccf5d[_0x1bb980]={'$like':'%'+_0xf3a93b['query']['filter']+'%'};return _0x3ccf5d;})});}_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x116')]=![];if(_0xf3a93b['query']['id']){_0x6f731a[_0xd9ff('0x82')]['id']={'$gt':_0xf3a93b[_0xd9ff('0x4e')]['id']};}_0x6f731a=_['merge']({},_0x6f731a,_0xf3a93b[_0xd9ff('0x113')]);return db['ChatMessage'][_0xd9ff('0x34')]({'where':_0x6f731a[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x42d9ff){_0x4572b2[_0xd9ff('0x34')]=_0x42d9ff;_0x6f731a[_0xd9ff('0x117')]=[];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x118')]){_0x6f731a[_0xd9ff('0x117')][_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43'),_0xd9ff('0xfb')]});}if(_0xf3a93b['query'][_0xd9ff('0xbf')]){_0x6f731a[_0xd9ff('0x117')]=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x6f731a);})[_0xd9ff('0x22')](function(_0x314f18){_0x4572b2['rows']=_0x314f18;return _0x4572b2;});}})['then'](respondWithFilteredResult(_0x473ecf,_0x6f731a))['catch'](handleError(_0x473ecf,null));};exports['addTags']=function(_0x4699d3,_0x2e91a8,_0x4956b2){return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x4699d3[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2e91a8,null))['then'](function(_0x217023){if(_0x217023){return _0x217023[_0xd9ff('0x11a')](_0x4699d3['body']['ids'],_['omit'](_0x4699d3['body'],['ids','id'])||{})[_0xd9ff('0x11b')](function(){return db[_0xd9ff('0x11c')][_0xd9ff('0x114')]({'attributes':['id',_0xd9ff('0x3c'),_0xd9ff('0x5b')],'where':{'id':_0x4699d3[_0xd9ff('0x3f')][_0xd9ff('0x10e')]}});})[_0xd9ff('0x22')](function(_0x317f93){socket[_0xd9ff('0x11d')](_0xd9ff('0x11e'),{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]});return{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]};});}})[_0xd9ff('0x22')](respondWithResult(_0x2e91a8,null))[_0xd9ff('0x2d')](handleError(_0x2e91a8,null));};exports[_0xd9ff('0x11f')]=function(_0x404baf,_0x5d73cd,_0xdb719b){return db['ChatInteraction'][_0xd9ff('0xc0')]({'where':{'id':_0x404baf['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x5d73cd,null))[_0xd9ff('0x22')](function(_0x10935d){if(_0x10935d){return _0x10935d['removeTags'](_0x404baf['query']['ids']);}})['then'](respondWithStatusCode(_0x5d73cd,null))['catch'](handleError(_0x5d73cd,null));};exports[_0xd9ff('0xeb')]=function(_0x2031e9,_0x3b50d9){var _0x410fae=moment()[_0xd9ff('0x120')]()[_0xd9ff('0xbb')]();var _0x494da6=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server','files',_0xd9ff('0x121'));var _0x49c9cc=path[_0xd9ff('0xe7')](config['root'],_0xd9ff('0x122'),_0xd9ff('0x123'),'attachments');var _0x378746=path[_0xd9ff('0xe7')](_0x494da6,_0x410fae);var _0x2acbe3=util[_0xd9ff('0xef')]('transcript-%d-%s.zip',_0x2031e9['params']['id'],_0x410fae);var _0x46d12c=path[_0xd9ff('0xe7')](_0x494da6,_0x2acbe3);var _0x54f4aa=[];_0x54f4aa[_0xd9ff('0x119')]({'model':db['User'],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43')],'raw':!![]});_0x54f4aa[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x124')],'as':_0xd9ff('0x71'),'attributes':['id',_0xd9ff('0x125'),'lastName'],'raw':!![]});if(_0x2031e9['query'][_0xd9ff('0x126')]){_0x54f4aa['push']({'model':db[_0xd9ff('0xe3')],'as':'Attachment','raw':!![]});}var _0xd015e9=[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'attributes':['id','body',_0xd9ff('0x84'),_0xd9ff('0xff'),'secret','read'],'include':_0x54f4aa}];_0xd015e9['push']({'model':db[_0xd9ff('0xc5')],'as':_0xd9ff('0x127'),'attributes':['id',_0xd9ff('0x3c')]});_0xd015e9[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x128'),'attributes':['id',_0xd9ff('0x43')]});return db[_0xd9ff('0x49')]['find']({'where':{'id':_0x2031e9[_0xd9ff('0xbe')]['id']},'include':_0xd015e9})[_0xd9ff('0x22')](handleEntityNotFound(_0x3b50d9,null))[_0xd9ff('0x22')](function(_0x1b452e){if(_0x1b452e){var _0x3ab927=_0x1b452e[_0xd9ff('0x129')]({'plain':!![]});fs[_0xd9ff('0x12a')](_0x378746);var _0x2b6e15={'channel':_0xd9ff('0x12b'),'account':_0x3ab927['Account']['name'],'agent':_0x3ab927['Owner']?_0x3ab927[_0xd9ff('0x128')][_0xd9ff('0x43')]:'N.A.','createdAt':moment(_0x3ab927[_0xd9ff('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd9ff('0xbb')](),'closedAt':_0x3ab927[_0xd9ff('0xda')]?moment(_0x3ab927[_0xd9ff('0x12c')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')]():'','disposition':_0x3ab927['disposition'],'chatInfo':{'browser':_0x3ab927[_0xd9ff('0x12d')],'os':_0x3ab927[_0xd9ff('0x12e')],'referer':_0x3ab927[_0xd9ff('0x12f')],'customerIp':_0x3ab927[_0xd9ff('0x130')],'customerPort':_0x3ab927[_0xd9ff('0x131')]?_0x3ab927['customerPort']:'N.A.'},'messages':_(_0x3ab927[_0xd9ff('0xf3')])[_0xd9ff('0x132')]()[_0xd9ff('0x90')]({'secret':![]})[_0xd9ff('0x79')](function(_0x319248){if(_0x319248[_0xd9ff('0xe3')]){var _0x1ea603=path[_0xd9ff('0xe7')](_0x49c9cc,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')]);if(fs[_0xd9ff('0x133')](_0x1ea603)){fs[_0xd9ff('0x134')](_0x1ea603)[_0xd9ff('0x135')](fs['createWriteStream'](path[_0xd9ff('0xe7')](_0x378746,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')])));}}return{'date':moment(_0x319248[_0xd9ff('0x84')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')](),'sender':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?_0x319248[_0xd9ff('0x7c')]?_0x319248[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6'):_0x319248['Contact'][_0xd9ff('0x125')]+(_0x319248[_0xd9ff('0x71')][_0xd9ff('0x136')]?'\x20'+_0x319248[_0xd9ff('0x71')]['lastName']:''),'body':_0x319248[_0xd9ff('0xe3')]?_0x319248['Attachment']['basename']:_0x319248[_0xd9ff('0x3f')],'direction':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?'A':'C','secret':_0x319248[_0xd9ff('0x116')],'read':_0x319248[_0xd9ff('0x8c')],'attachment':_0x319248[_0xd9ff('0xe3')]};})[_0xd9ff('0x6d')]()};return ejs['renderFile'](path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server',_0xd9ff('0x137'),_0xd9ff('0x138')),{'interaction':_0x2b6e15})[_0xd9ff('0x22')](function(_0xb07a14){var _0x1c419f=path[_0xd9ff('0xe7')](_0x378746,_0xd9ff('0x139')+_0x3ab927['id']+'-'+_0x410fae+_0xd9ff('0x13a'));var _0x3156c8={'path':_0x1c419f,'channel':_0xd9ff('0x12b'),'interactionId':_0x3ab927['id']};return pdf[_0xd9ff('0x13b')](_0xb07a14,_0x3156c8);})['then'](function(){return new BPromise(function(_0x567007,_0x1019f9){zipdir(_0x378746,{'saveTo':_0x46d12c},function(_0x2ab78a,_0x4649d9){if(_0x2ab78a)return _0x1019f9(_0x2ab78a);return _0x567007(_0x4649d9);});})[_0xd9ff('0x22')](function(){return new BPromise(function(_0x166033,_0x3c40e4){rimraf(_0x378746,function(_0x346d93){if(_0x346d93)_0x3c40e4(_0x346d93);return _0x166033();});});})[_0xd9ff('0x22')](function(){return _0x3b50d9['download'](_0x46d12c,_0x2acbe3,function(_0x22680e){if(_0x22680e){console['log'](_0xd9ff('0x13c'),_0x22680e);}else{fs[_0xd9ff('0x13d')](_0x46d12c);}});});});}else{return _0x3b50d9['sendStatus'](0xc8);}})[_0xd9ff('0x2d')](handleError(_0x3b50d9,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 1fe11d2..6331b94 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 _0xecff=['hasOwnProperty','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages'];(function(_0x581ffa,_0x202e7b){var _0x3a9eb4=function(_0x547ee0){while(--_0x547ee0){_0x581ffa['push'](_0x581ffa['shift']());}};_0x3a9eb4(++_0x202e7b);}(_0xecff,0x121));var _0xfecf=function(_0x20a029,_0xab677e){_0x20a029=_0x20a029-0x0;var _0x3943fc=_0xecff[_0x20a029];return _0x3943fc;};'use strict';var EventEmitter=require(_0xfecf('0x0'));var ChatInteraction=require(_0xfecf('0x1'))['db'][_0xfecf('0x2')];var ChatMessage=require(_0xfecf('0x1'))['db'][_0xfecf('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xfecf('0x4')](0x0);var events={'afterCreate':_0xfecf('0x5'),'afterUpdate':_0xfecf('0x6'),'afterDestroy':_0xfecf('0x7')};function emitEvent(_0x52a262){return function(_0x38e058,_0x567272,_0xbd327a){_0x38e058[_0xfecf('0x8')]({'attributes':['id'],'raw':!![]})[_0xfecf('0x9')](function(_0x20d842){_0x38e058['setDataValue'](_0xfecf('0xa'),_0x20d842[_0xfecf('0xb')](function(_0x10f145){return{'id':_0x10f145['id']};}));return ChatMessage[_0xfecf('0xc')]({'where':{'ChatInteractionId':_0x38e058['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfecf('0x9')](function(_0x26608b){_0x38e058[_0xfecf('0xd')](_0xfecf('0xe'),_0x26608b['length']);ChatInteractionEvents['emit'](_0x52a262+':'+_0x38e058['id'],_0x38e058);ChatInteractionEvents['emit'](_0x52a262,_0x38e058);_0xbd327a(null);})['catch'](_0xbd327a(null));};}for(var e in events){if(events[_0xfecf('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xeae5=['catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','map','findAll','then','setDataValue','unreadMessages','length','emit'];(function(_0x144c95,_0x55dc04){var _0x21a474=function(_0x490698){while(--_0x490698){_0x144c95['push'](_0x144c95['shift']());}};_0x21a474(++_0x55dc04);}(_0xeae5,0x1f0));var _0x5eae=function(_0x252ac8,_0xdeb607){_0x252ac8=_0x252ac8-0x0;var _0x6de399=_0xeae5[_0x252ac8];return _0x6de399;};'use strict';var EventEmitter=require(_0x5eae('0x0'));var ChatInteraction=require(_0x5eae('0x1'))['db'][_0x5eae('0x2')];var ChatMessage=require(_0x5eae('0x1'))['db'][_0x5eae('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5eae('0x4')](0x0);var events={'afterCreate':_0x5eae('0x5'),'afterUpdate':_0x5eae('0x6'),'afterDestroy':'remove'};function emitEvent(_0x45f344){return function(_0x1ddf01,_0x41520a,_0x2d89a3){_0x1ddf01['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x4a2486){_0x1ddf01['setDataValue']('Users',_0x4a2486[_0x5eae('0x7')](function(_0x1ef17b){return{'id':_0x1ef17b['id']};}));return ChatMessage[_0x5eae('0x8')]({'where':{'ChatInteractionId':_0x1ddf01['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5eae('0x9')](function(_0x37588b){_0x1ddf01[_0x5eae('0xa')](_0x5eae('0xb'),_0x37588b[_0x5eae('0xc')]);ChatInteractionEvents[_0x5eae('0xd')](_0x45f344+':'+_0x1ddf01['id'],_0x1ddf01);ChatInteractionEvents[_0x5eae('0xd')](_0x45f344,_0x1ddf01);_0x2d89a3(null);})[_0x5eae('0xe')](_0x2d89a3(null));};}for(var e in events){if(events[_0x5eae('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x5eae('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 71baba3..15cf456 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 _0x1850=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xa10a3f,_0x24ad3c){var _0x2a5321=function(_0x5b91b2){while(--_0x5b91b2){_0xa10a3f['push'](_0xa10a3f['shift']());}};_0x2a5321(++_0x24ad3c);}(_0x1850,0x12d));var _0x0185=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1850[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0185('0x0'));var logger=require(_0x0185('0x1'))(_0x0185('0x2'));var moment=require(_0x0185('0x3'));var BPromise=require(_0x0185('0x4'));var rp=require(_0x0185('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0185('0x6'));var config=require(_0x0185('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x0185('0x8')]=function(_0x13625e,_0x372bf1){return _0x13625e[_0x0185('0x9')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb19f70,_0x2e61d1,_0x42872e){if(_0xb19f70['changed']('closed')){_0xb19f70['closedAt']=moment()['format'](_0x0185('0xa'));}_0x42872e(null,_0xb19f70);}},'charset':_0x0185('0xb'),'collate':_0x0185('0xc')});}; \ No newline at end of file +var _0xaed7=['../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1557c3,_0x5e6999){var _0x4227cb=function(_0x14c893){while(--_0x14c893){_0x1557c3['push'](_0x1557c3['shift']());}};_0x4227cb(++_0x5e6999);}(_0xaed7,0x1aa));var _0x7aed=function(_0x162b3e,_0x49a58b){_0x162b3e=_0x162b3e-0x0;var _0x3c206e=_0xaed7[_0x162b3e];return _0x3c206e;};'use strict';var _=require('lodash');var util=require(_0x7aed('0x0'));var logger=require(_0x7aed('0x1'))('api');var moment=require(_0x7aed('0x2'));var BPromise=require(_0x7aed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7aed('0x4'));var rimraf=require(_0x7aed('0x5'));var config=require(_0x7aed('0x6'));var attributes=require(_0x7aed('0x7'));module[_0x7aed('0x8')]=function(_0x3ffb33,_0xe96ee2){return _0x3ffb33['define'](_0x7aed('0x9'),attributes,{'tableName':_0x7aed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x491971,_0x5ddfe0,_0x4c639d){if(_0x491971[_0x7aed('0xb')](_0x7aed('0xc'))){_0x491971[_0x7aed('0xd')]=moment()[_0x7aed('0xe')](_0x7aed('0xf'));}_0x4c639d(null,_0x491971);}},'charset':_0x7aed('0x10'),'collate':_0x7aed('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 980d7e9..d8250c6 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 _0x2cf4=['raw','options','where','attributes','then','UpdateChatInteraction','debug','catch','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','update','body'];(function(_0x385c05,_0x1471b5){var _0x4a1d32=function(_0x5917fe){while(--_0x5917fe){_0x385c05['push'](_0x385c05['shift']());}};_0x4a1d32(++_0x1471b5);}(_0x2cf4,0x6c));var _0x42cf=function(_0x4320ce,_0x49f5f5){_0x4320ce=_0x4320ce-0x0;var _0x537dae=_0x2cf4[_0x4320ce];return _0x537dae;};'use strict';var _=require(_0x42cf('0x0'));var util=require(_0x42cf('0x1'));var moment=require(_0x42cf('0x2'));var BPromise=require(_0x42cf('0x3'));var rs=require(_0x42cf('0x4'));var fs=require('fs');var Redis=require(_0x42cf('0x5'));var db=require(_0x42cf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x42cf('0x7'))(_0x42cf('0x8'));var config=require(_0x42cf('0x9'));var jayson=require(_0x42cf('0xa'));var client=jayson[_0x42cf('0xb')][_0x42cf('0xc')]({'port':0x232a});config['redis']=_[_0x42cf('0xd')](config[_0x42cf('0xe')],{'host':_0x42cf('0xf'),'port':0x18eb});var socket=require(_0x42cf('0x10'))(new Redis(config[_0x42cf('0xe')]));require(_0x42cf('0x11'))[_0x42cf('0x12')](socket);function respondWithRpcPromise(_0x47e67d,_0x1da89c,_0x465536){return new BPromise(function(_0x6c0166,_0x1292d3){return client[_0x42cf('0x13')](_0x47e67d,_0x465536)['then'](function(_0x492446){logger[_0x42cf('0x14')](_0x42cf('0x15'),_0x1da89c,_0x42cf('0x16'));logger['debug'](_0x42cf('0x17'),_0x1da89c,'request\x20sent',JSON[_0x42cf('0x18')](_0x492446));if(_0x492446[_0x42cf('0x19')]){if(_0x492446[_0x42cf('0x19')]['code']===0x1f4){logger[_0x42cf('0x19')](_0x42cf('0x15'),_0x1da89c,_0x492446['error']['message']);return _0x1292d3(_0x492446[_0x42cf('0x19')][_0x42cf('0x1a')]);}logger['error'](_0x42cf('0x15'),_0x1da89c,_0x492446[_0x42cf('0x19')][_0x42cf('0x1a')]);return _0x6c0166(_0x492446[_0x42cf('0x19')][_0x42cf('0x1a')]);}else{logger[_0x42cf('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x1da89c,_0x42cf('0x16'));_0x6c0166(_0x492446[_0x42cf('0x1b')][_0x42cf('0x1a')]);}})['catch'](function(_0x7b00b5){logger['error'](_0x42cf('0x15'),_0x1da89c,_0x7b00b5);_0x1292d3(_0x7b00b5);});});}exports['UpdateChatInteraction']=function(_0x5a7860){var _0x71010a=this;return new Promise(function(_0x26fe2a,_0x5d9437){return db['ChatInteraction'][_0x42cf('0x1c')](_0x5a7860[_0x42cf('0x1d')],{'raw':_0x5a7860['options']?_0x5a7860['options'][_0x42cf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7860[_0x42cf('0x1f')]?_0x5a7860[_0x42cf('0x1f')][_0x42cf('0x20')]||null:null,'attributes':_0x5a7860[_0x42cf('0x1f')]?_0x5a7860[_0x42cf('0x1f')][_0x42cf('0x21')]||null:null,'limit':_0x5a7860[_0x42cf('0x1f')]?_0x5a7860['options']['limit']||null:null})[_0x42cf('0x22')](function(_0x4c2479){logger[_0x42cf('0x14')](_0x42cf('0x23'),_0x5a7860);logger[_0x42cf('0x24')]('UpdateChatInteraction',_0x5a7860,JSON['stringify'](_0x4c2479));_0x26fe2a(_0x4c2479);})[_0x42cf('0x25')](function(_0x4a7e9a){logger['error'](_0x42cf('0x23'),_0x4a7e9a[_0x42cf('0x1a')],_0x5a7860);_0x5d9437(_0x71010a[_0x42cf('0x19')](0x1f4,_0x4a7e9a[_0x42cf('0x1a')]));});});};exports[_0x42cf('0x26')]=function(_0x1c5c3e){return new Promise(function(_0x41923f,_0x26f3e9){return db[_0x42cf('0x27')][_0x42cf('0x28')]({'where':_0x1c5c3e[_0x42cf('0x1f')]?_0x1c5c3e[_0x42cf('0x1f')]['where']||null:null})[_0x42cf('0x22')](function(_0x551487){if(_0x551487){return _0x551487[_0x42cf('0x29')](_0x1c5c3e[_0x42cf('0x1d')][_0x42cf('0x2a')],_[_0x42cf('0x2b')](_0x1c5c3e['body'],[_0x42cf('0x2a'),'id'])||{});}})[_0x42cf('0x2c')](function(_0x326183){logger['info']('AddTags',_0x1c5c3e);logger[_0x42cf('0x24')]('AddTags',_0x1c5c3e,JSON[_0x42cf('0x18')](_0x326183));_0x41923f(_0x326183);})[_0x42cf('0x25')](function(_0x3f6a35){logger[_0x42cf('0x19')](_0x42cf('0x2d'),_0x3f6a35[_0x42cf('0x1a')],_0x1c5c3e);_0x26f3e9(_this[_0x42cf('0x19')](0x1f4,_0x3f6a35[_0x42cf('0x1a')]));});});}; \ No newline at end of file +var _0x36aa=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','ChatInteraction','body','options','raw','attributes','limit','UpdateChatInteraction','stringify','catch','find','where','addTags','ids','spread','AddTags','lodash','util'];(function(_0x504315,_0x4813fe){var _0xf99b17=function(_0x477f0e){while(--_0x477f0e){_0x504315['push'](_0x504315['shift']());}};_0xf99b17(++_0x4813fe);}(_0x36aa,0x1ea));var _0xa36a=function(_0x2b28d9,_0x94546d){_0x2b28d9=_0x2b28d9-0x0;var _0x109778=_0x36aa[_0x2b28d9];return _0x109778;};'use strict';var _=require(_0xa36a('0x0'));var util=require(_0xa36a('0x1'));var moment=require(_0xa36a('0x2'));var BPromise=require(_0xa36a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa36a('0x4'));var db=require(_0xa36a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa36a('0x6'))(_0xa36a('0x7'));var config=require(_0xa36a('0x8'));var jayson=require(_0xa36a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xa36a('0xa')]=_['defaults'](config[_0xa36a('0xa')],{'host':_0xa36a('0xb'),'port':0x18eb});var socket=require(_0xa36a('0xc'))(new Redis(config['redis']));require(_0xa36a('0xd'))[_0xa36a('0xe')](socket);function respondWithRpcPromise(_0x37e035,_0x797fd6,_0x5b2f18){return new BPromise(function(_0x3c1c2d,_0x2e04c8){return client[_0xa36a('0xf')](_0x37e035,_0x5b2f18)[_0xa36a('0x10')](function(_0x3f2d5a){logger[_0xa36a('0x11')](_0xa36a('0x12'),_0x797fd6,_0xa36a('0x13'));logger[_0xa36a('0x14')](_0xa36a('0x15'),_0x797fd6,'request\x20sent',JSON['stringify'](_0x3f2d5a));if(_0x3f2d5a['error']){if(_0x3f2d5a[_0xa36a('0x16')][_0xa36a('0x17')]===0x1f4){logger['error'](_0xa36a('0x12'),_0x797fd6,_0x3f2d5a[_0xa36a('0x16')][_0xa36a('0x18')]);return _0x2e04c8(_0x3f2d5a[_0xa36a('0x16')][_0xa36a('0x18')]);}logger[_0xa36a('0x16')](_0xa36a('0x12'),_0x797fd6,_0x3f2d5a[_0xa36a('0x16')][_0xa36a('0x18')]);return _0x3c1c2d(_0x3f2d5a[_0xa36a('0x16')][_0xa36a('0x18')]);}else{logger[_0xa36a('0x11')](_0xa36a('0x12'),_0x797fd6,'request\x20sent');_0x3c1c2d(_0x3f2d5a[_0xa36a('0x19')][_0xa36a('0x18')]);}})['catch'](function(_0x7eb89a){logger['error'](_0xa36a('0x12'),_0x797fd6,_0x7eb89a);_0x2e04c8(_0x7eb89a);});});}exports['UpdateChatInteraction']=function(_0x4c9168){var _0xa783ef=this;return new Promise(function(_0x3c8d9b,_0x2f7ee1){return db[_0xa36a('0x1a')]['update'](_0x4c9168[_0xa36a('0x1b')],{'raw':_0x4c9168['options']?_0x4c9168[_0xa36a('0x1c')][_0xa36a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c9168[_0xa36a('0x1c')]?_0x4c9168['options']['where']||null:null,'attributes':_0x4c9168[_0xa36a('0x1c')]?_0x4c9168[_0xa36a('0x1c')][_0xa36a('0x1e')]||null:null,'limit':_0x4c9168[_0xa36a('0x1c')]?_0x4c9168[_0xa36a('0x1c')][_0xa36a('0x1f')]||null:null})[_0xa36a('0x10')](function(_0xb0706a){logger[_0xa36a('0x11')]('UpdateChatInteraction',_0x4c9168);logger[_0xa36a('0x14')](_0xa36a('0x20'),_0x4c9168,JSON[_0xa36a('0x21')](_0xb0706a));_0x3c8d9b(_0xb0706a);})[_0xa36a('0x22')](function(_0x826d07){logger['error'](_0xa36a('0x20'),_0x826d07[_0xa36a('0x18')],_0x4c9168);_0x2f7ee1(_0xa783ef[_0xa36a('0x16')](0x1f4,_0x826d07['message']));});});};exports['AddTagsToChatInteraction']=function(_0x47b837){return new Promise(function(_0x4d71f8,_0x2cdcb1){return db['ChatInteraction'][_0xa36a('0x23')]({'where':_0x47b837[_0xa36a('0x1c')]?_0x47b837[_0xa36a('0x1c')][_0xa36a('0x24')]||null:null})[_0xa36a('0x10')](function(_0x484c33){if(_0x484c33){return _0x484c33[_0xa36a('0x25')](_0x47b837[_0xa36a('0x1b')][_0xa36a('0x26')],_['omit'](_0x47b837[_0xa36a('0x1b')],[_0xa36a('0x26'),'id'])||{});}})[_0xa36a('0x27')](function(_0x2c4c65){logger[_0xa36a('0x11')](_0xa36a('0x28'),_0x47b837);logger[_0xa36a('0x14')](_0xa36a('0x28'),_0x47b837,JSON['stringify'](_0x2c4c65));_0x4d71f8(_0x2c4c65);})[_0xa36a('0x22')](function(_0x4e0941){logger['error'](_0xa36a('0x28'),_0x4e0941[_0xa36a('0x18')],_0x47b837);_0x2cdcb1(_this['error'](0x1f4,_0x4e0941['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 63d0f70..9b266e8 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 _0xf5c0=['update','emit','removeListener','register','length','save'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xf5c0,0x71));var _0x0f5c=function(_0x9bb5cb,_0x1f8301){_0x9bb5cb=_0x9bb5cb-0x0;var _0x3d611c=_0xf5c0[_0x9bb5cb];return _0x3d611c;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x0f5c('0x0'),'remove',_0x0f5c('0x1')];function createListener(_0x10f2e5,_0x437bb8){return function(_0x39031d){_0x437bb8[_0x0f5c('0x2')](_0x10f2e5,_0x39031d);};}function removeListener(_0x13d4c9,_0x100943){return function(){ChatInteractionEvents[_0x0f5c('0x3')](_0x13d4c9,_0x100943);};}exports[_0x0f5c('0x4')]=function(_0x1c69da){for(var _0x2752d2=0x0,_0x5d0242=events[_0x0f5c('0x5')];_0x2752d2<_0x5d0242;_0x2752d2++){var _0x1eda94=events[_0x2752d2];var _0x414f5d=createListener('chatInteraction:'+_0x1eda94,_0x1c69da);ChatInteractionEvents['on'](_0x1eda94,_0x414f5d);}}; \ No newline at end of file +var _0xe5d5=['length','chatInteraction:','remove','removeListener','register'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0xe5d5,0x156));var _0x5e5d=function(_0x44b67a,_0x5113fa){_0x44b67a=_0x44b67a-0x0;var _0x2e8cac=_0xe5d5[_0x44b67a];return _0x2e8cac;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x5e5d('0x0'),'update'];function createListener(_0x9f47d6,_0x4b8ae9){return function(_0x50afd3){_0x4b8ae9['emit'](_0x9f47d6,_0x50afd3);};}function removeListener(_0x3e2410,_0x191980){return function(){ChatInteractionEvents[_0x5e5d('0x1')](_0x3e2410,_0x191980);};}exports[_0x5e5d('0x2')]=function(_0x13bcb7){for(var _0x39077f=0x0,_0x3200d5=events[_0x5e5d('0x3')];_0x39077f<_0x3200d5;_0x39077f++){var _0x23de8d=events[_0x39077f];var _0x131a59=createListener(_0x5e5d('0x4')+_0x23de8d,_0x13bcb7);ChatInteractionEvents['on'](_0x23de8d,_0x131a59);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0a14d8c..b10a1a5 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 _0xe2af=['%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','isChatInteractionAuthorized','addMessage','/:id/tags','chatinteraction:addtags','put','tracked','chat','chatinteraction:update','update','/:id/custom_update','/:id/abandon','close','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','diskStorage','join','root','format'];(function(_0x20828e,_0x286fb4){var _0x2fd9f8=function(_0x8c8bbd){while(--_0x8c8bbd){_0x20828e['push'](_0x20828e['shift']());}};_0x2fd9f8(++_0x286fb4);}(_0xe2af,0x1cf));var _0xfe2a=function(_0x1e651d,_0x1893aa){_0x1e651d=_0x1e651d-0x0;var _0x489a6f=_0xe2af[_0x1e651d];return _0x489a6f;};'use strict';var multer=require(_0xfe2a('0x0'));var util=require(_0xfe2a('0x1'));var path=require(_0xfe2a('0x2'));var timeout=require(_0xfe2a('0x3'));var express=require(_0xfe2a('0x4'));var router=express[_0xfe2a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe2a('0x6'));var config=require(_0xfe2a('0x7'));var controller=require(_0xfe2a('0x8'));router[_0xfe2a('0x9')]('/',auth[_0xfe2a('0xa')](),controller[_0xfe2a('0xb')]);router[_0xfe2a('0x9')](_0xfe2a('0xc'),auth[_0xfe2a('0xa')](),controller['describe']);router['get'](_0xfe2a('0xd'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0xfe2a('0x9')](_0xfe2a('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xfe2a('0xf')]);router[_0xfe2a('0x9')](_0xfe2a('0x10'),auth[_0xfe2a('0xa')](),controller[_0xfe2a('0x11')]);router['get'](_0xfe2a('0x12'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router['get'](_0xfe2a('0x13'),auth[_0xfe2a('0xa')](),controller[_0xfe2a('0x14')]);router[_0xfe2a('0x15')]('/',auth[_0xfe2a('0xa')](),controller[_0xfe2a('0x16')]);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xfe2a('0x17')]({'destination':function(_0x18b2ad,_0x393abf,_0x285b7b){_0x285b7b(null,path[_0xfe2a('0x18')](config[_0xfe2a('0x19')],'server/files/attachments/'));},'filename':function(_0x1b195b,_0x3d0181,_0x8f99b9){_0x8f99b9(null,util[_0xfe2a('0x1a')](_0xfe2a('0x1b'),Date[_0xfe2a('0x1c')](),_0x3d0181[_0xfe2a('0x1d')][_0xfe2a('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfe2a('0x15')](_0xfe2a('0x1f'),upload['single'](_0xfe2a('0x20')),controller[_0xfe2a('0x21')]);router['post'](_0xfe2a('0x10'),auth[_0xfe2a('0x22')](),controller[_0xfe2a('0x23')]);router[_0xfe2a('0x15')](_0xfe2a('0x24'),auth[_0xfe2a('0xa')](),interaction['tracked']('chat',_0xfe2a('0x25')),controller['addTags']);router[_0xfe2a('0x26')](_0xfe2a('0xd'),auth['isAuthenticated'](),interaction[_0xfe2a('0x27')](_0xfe2a('0x28'),_0xfe2a('0x29')),controller[_0xfe2a('0x2a')]);router['put'](_0xfe2a('0x2b'),controller['customUpdate']);router[_0xfe2a('0x26')](_0xfe2a('0x2c'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0xfe2a('0x26')]('/:id/close',controller[_0xfe2a('0x2d')]);router['delete'](_0xfe2a('0xd'),auth['isAuthenticated'](),interaction[_0xfe2a('0x27')](_0xfe2a('0x28'),'chatinteraction:destroy'),controller['destroy']);router[_0xfe2a('0x2e')](_0xfe2a('0x24'),auth['isAuthenticated'](),controller[_0xfe2a('0x2f')]);module[_0xfe2a('0x30')]=router; \ No newline at end of file +var _0x5657=['../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','post','create','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','replace','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x4d9757,_0x28fad9){var _0x512f60=function(_0xa4947e){while(--_0xa4947e){_0x4d9757['push'](_0x4d9757['shift']());}};_0x512f60(++_0x28fad9);}(_0x5657,0xf5));var _0x7565=function(_0xb3653a,_0xc54c40){_0xb3653a=_0xb3653a-0x0;var _0x27fef5=_0x5657[_0xb3653a];return _0x27fef5;};'use strict';var multer=require('multer');var util=require(_0x7565('0x0'));var path=require(_0x7565('0x1'));var timeout=require(_0x7565('0x2'));var express=require(_0x7565('0x3'));var router=express['Router']();var fs_extra=require(_0x7565('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7565('0x5'));var config=require(_0x7565('0x6'));var controller=require(_0x7565('0x7'));router[_0x7565('0x8')]('/',auth[_0x7565('0x9')](),controller[_0x7565('0xa')]);router[_0x7565('0x8')](_0x7565('0xb'),auth[_0x7565('0x9')](),controller[_0x7565('0xc')]);router[_0x7565('0x8')](_0x7565('0xd'),auth[_0x7565('0xe')](),controller[_0x7565('0xf')]);router[_0x7565('0x8')](_0x7565('0x10'),auth[_0x7565('0xe')](),controller[_0x7565('0x11')]);router[_0x7565('0x8')](_0x7565('0x12'),auth['isAuthenticated'](),controller[_0x7565('0x13')]);router[_0x7565('0x8')](_0x7565('0x14'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router['get'](_0x7565('0x15'),auth[_0x7565('0x9')](),controller['download']);router[_0x7565('0x16')]('/',auth[_0x7565('0x9')](),controller[_0x7565('0x17')]);router['post']('/:id/vidaoo',auth[_0x7565('0x9')](),controller[_0x7565('0x18')]);var upload=multer({'storage':multer[_0x7565('0x19')]({'destination':function(_0x3299e,_0x14f3c5,_0x1e3615){_0x1e3615(null,path[_0x7565('0x1a')](config[_0x7565('0x1b')],_0x7565('0x1c')));},'filename':function(_0x3506fc,_0x321cd1,_0x51a166){_0x51a166(null,util[_0x7565('0x1d')]('%s-%s',Date[_0x7565('0x1e')](),_0x321cd1['originalname'][_0x7565('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7565('0x16')]('/:id/attachment_upload',upload[_0x7565('0x20')](_0x7565('0x21')),controller[_0x7565('0x22')]);router[_0x7565('0x16')](_0x7565('0x12'),auth[_0x7565('0xe')](),controller[_0x7565('0x23')]);router['post'](_0x7565('0x24'),auth['isAuthenticated'](),interaction[_0x7565('0x25')]('chat',_0x7565('0x26')),controller['addTags']);router[_0x7565('0x27')](_0x7565('0xd'),auth['isAuthenticated'](),interaction[_0x7565('0x25')]('chat',_0x7565('0x28')),controller[_0x7565('0x29')]);router[_0x7565('0x27')]('/:id/custom_update',controller[_0x7565('0x2a')]);router[_0x7565('0x27')](_0x7565('0x2b'),auth[_0x7565('0xe')](),controller[_0x7565('0x2c')]);router[_0x7565('0x27')](_0x7565('0x2d'),controller[_0x7565('0x2e')]);router[_0x7565('0x2f')](_0x7565('0xd'),auth[_0x7565('0x9')](),interaction[_0x7565('0x25')]('chat','chatinteraction:destroy'),controller[_0x7565('0x30')]);router[_0x7565('0x2f')](_0x7565('0x24'),auth['isAuthenticated'](),controller['removeTags']);module[_0x7565('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 84cf1aa..38ac3ee 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 _0xeb46=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0xc64d27,_0x253c60){var _0x134c19=function(_0x55e6f1){while(--_0x55e6f1){_0xc64d27['push'](_0xc64d27['shift']());}};_0x134c19(++_0x253c60);}(_0xeb46,0xd8));var _0x6eb4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeb46[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6eb4('0x0'));module[_0x6eb4('0x1')]={'body':{'type':Sequelize[_0x6eb4('0x2')](_0x6eb4('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6eb4('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6eb4('0x5')]}}; \ No newline at end of file +var _0xeb36=['TEXT','medium','INTEGER','sequelize'];(function(_0x1f1241,_0x3f068a){var _0x4030d2=function(_0x21a3e3){while(--_0x21a3e3){_0x1f1241['push'](_0x1f1241['shift']());}};_0x4030d2(++_0x3f068a);}(_0xeb36,0x11b));var _0x6eb3=function(_0x1f8cfa,_0x426e48){_0x1f8cfa=_0x1f8cfa-0x0;var _0x3bfe42=_0xeb36[_0x1f8cfa];return _0x3bfe42;};'use strict';var Sequelize=require(_0x6eb3('0x0'));module['exports']={'body':{'type':Sequelize[_0x6eb3('0x1')](_0x6eb3('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6eb3('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 057177e..fd6fa1b 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 _0x9ddc=['filter','merge','VIRTUAL','count','includeAll','findAll','rows','params','include','options','find','catch','create','body','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','user','role','userpic','internal','lastLoginAt','allowmessenger','sort','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','-createdAt','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','end','sendStatus','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','where','pick'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x9ddc,0x97));var _0xc9dd=function(_0x20d481,_0x300a67){_0x20d481=_0x20d481-0x0;var _0x49eb48=_0x9ddc[_0x20d481];return _0x49eb48;};'use strict';var emlformat=require(_0xc9dd('0x0'));var rimraf=require(_0xc9dd('0x1'));var zipdir=require(_0xc9dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9dd('0x3'));var moment=require(_0xc9dd('0x4'));var BPromise=require(_0xc9dd('0x5'));var Mustache=require(_0xc9dd('0x6'));var util=require(_0xc9dd('0x7'));var path=require(_0xc9dd('0x8'));var sox=require('sox');var csv=require(_0xc9dd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9dd('0xa'));var _=require(_0xc9dd('0xb'));var squel=require('squel');var crypto=require(_0xc9dd('0xc'));var jsforce=require(_0xc9dd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc9dd('0x9'));var querystring=require(_0xc9dd('0xe'));var Papa=require(_0xc9dd('0xf'));var Redis=require(_0xc9dd('0x10'));var authService=require(_0xc9dd('0x11'));var qs=require(_0xc9dd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9dd('0x13'));var logger=require(_0xc9dd('0x14'))(_0xc9dd('0x15'));var utils=require('../../config/utils');var config=require(_0xc9dd('0x16'));var licenseUtil=require(_0xc9dd('0x17'));var db=require(_0xc9dd('0x18'))['db'];config[_0xc9dd('0x19')]=_[_0xc9dd('0x1a')](config[_0xc9dd('0x19')],{'host':_0xc9dd('0x1b'),'port':0x18eb});var socket=require(_0xc9dd('0x1c'))(new Redis(config[_0xc9dd('0x19')]));require(_0xc9dd('0x1d'))[_0xc9dd('0x1e')](socket);function respondWithStatusCode(_0x2aab8b,_0x2f1ac4){_0x2f1ac4=_0x2f1ac4||0xcc;return function(_0x230a34){if(_0x230a34){return _0x2aab8b['sendStatus'](_0x2f1ac4);}return _0x2aab8b['status'](_0x2f1ac4)['end']();};}function respondWithResult(_0x8908b,_0x3af077){_0x3af077=_0x3af077||0xc8;return function(_0x26b889){if(_0x26b889){return _0x8908b[_0xc9dd('0x1f')](_0x3af077)[_0xc9dd('0x20')](_0x26b889);}};}function respondWithFilteredResult(_0x588095,_0x4f5f7a){return function(_0x495590){if(_0x495590){var _0x4d946b=typeof _0x4f5f7a[_0xc9dd('0x21')]===_0xc9dd('0x22')&&typeof _0x4f5f7a[_0xc9dd('0x23')]===_0xc9dd('0x22');var _0x148f65=_0x495590['count'];var _0x5c4e64=_0x4d946b?0x0:_0x4f5f7a['offset'];var _0x3b3399=_0x4d946b?_0x495590['count']:_0x4f5f7a['offset']+_0x4f5f7a[_0xc9dd('0x23')];var _0x2069f5;if(_0x3b3399>=_0x148f65){_0x3b3399=_0x148f65;_0x2069f5=0xc8;}else{_0x2069f5=0xce;}_0x588095[_0xc9dd('0x1f')](_0x2069f5);return _0x588095[_0xc9dd('0x24')](_0xc9dd('0x25'),_0x5c4e64+'-'+_0x3b3399+'/'+_0x148f65)[_0xc9dd('0x20')](_0x495590);}return null;};}function patchUpdates(_0xfba40){return function(_0x15f80a){try{jsonpatch['apply'](_0x15f80a,_0xfba40,!![]);}catch(_0x5daae3){return BPromise[_0xc9dd('0x26')](_0x5daae3);}return _0x15f80a[_0xc9dd('0x27')]();};}function saveUpdates(_0x26438c,_0x17e42e){return function(_0x300aee){if(_0x300aee){return _0x300aee[_0xc9dd('0x28')](_0x26438c)[_0xc9dd('0x29')](function(_0x1a1977){return _0x1a1977;});}return null;};}function removeEntity(_0x2aa06a,_0x23e230){return function(_0x21d143){if(_0x21d143){return _0x21d143['destroy']()[_0xc9dd('0x29')](function(){_0x2aa06a[_0xc9dd('0x1f')](0xcc)[_0xc9dd('0x2a')]();});}};}function handleEntityNotFound(_0x47bc62,_0x2e67af){return function(_0x44c58f){if(!_0x44c58f){_0x47bc62[_0xc9dd('0x2b')](0x194);}return _0x44c58f;};}function handleError(_0x5915a7,_0x43dd91){_0x43dd91=_0x43dd91||0x1f4;return function(_0x15a948){logger['error'](_0x15a948[_0xc9dd('0x2c')]);if(_0x15a948[_0xc9dd('0x2d')]){delete _0x15a948[_0xc9dd('0x2d')];}_0x5915a7[_0xc9dd('0x1f')](_0x43dd91)[_0xc9dd('0x2e')](_0x15a948);};}exports[_0xc9dd('0x2f')]=function(_0x1174a1,_0x3dd784){var _0x2ff2e0={},_0x5ee85e={},_0x58deb3={'count':0x0,'rows':[]};var _0x492550=_[_0xc9dd('0x30')](db[_0xc9dd('0x31')][_0xc9dd('0x32')],function(_0x3d4114){return{'name':_0x3d4114['fieldName'],'type':_0x3d4114[_0xc9dd('0x33')][_0xc9dd('0x34')]};});_0x5ee85e[_0xc9dd('0x35')]=_['map'](_0x492550,_0xc9dd('0x2d'));_0x5ee85e['query']=_[_0xc9dd('0x36')](_0x1174a1[_0xc9dd('0x37')]);_0x5ee85e[_0xc9dd('0x38')]=_[_0xc9dd('0x39')](_0x5ee85e[_0xc9dd('0x35')],_0x5ee85e[_0xc9dd('0x37')]);_0x2ff2e0[_0xc9dd('0x3a')]=_[_0xc9dd('0x39')](_0x5ee85e[_0xc9dd('0x35')],qs[_0xc9dd('0x3b')](_0x1174a1[_0xc9dd('0x37')]['fields']));_0x2ff2e0[_0xc9dd('0x3a')]=_0x2ff2e0['attributes'][_0xc9dd('0x3c')]?_0x2ff2e0[_0xc9dd('0x3a')]:_0x5ee85e[_0xc9dd('0x35')];if(!_0x1174a1[_0xc9dd('0x37')]['hasOwnProperty']('nolimit')){_0x2ff2e0[_0xc9dd('0x23')]=qs[_0xc9dd('0x23')](_0x1174a1['query'][_0xc9dd('0x23')]);_0x2ff2e0['offset']=qs[_0xc9dd('0x21')](_0x1174a1['query'][_0xc9dd('0x21')]);}_0x2ff2e0['order']=qs['sort'](_0x1174a1['query']['sort']);_0x2ff2e0[_0xc9dd('0x3d')]=qs['filters'](_[_0xc9dd('0x3e')](_0x1174a1[_0xc9dd('0x37')],_0x5ee85e[_0xc9dd('0x38')]),_0x492550);if(_0x1174a1[_0xc9dd('0x37')][_0xc9dd('0x3f')]){_0x2ff2e0[_0xc9dd('0x3d')]=_[_0xc9dd('0x40')](_0x2ff2e0['where'],{'$or':_['map'](_0x492550,function(_0x28f936){if(_0x28f936[_0xc9dd('0x33')]!==_0xc9dd('0x41')){var _0x5bb0d4={};_0x5bb0d4[_0x28f936[_0xc9dd('0x2d')]]={'$like':'%'+_0x1174a1[_0xc9dd('0x37')][_0xc9dd('0x3f')]+'%'};return _0x5bb0d4;}})});}_0x2ff2e0=_['merge']({},_0x2ff2e0,_0x1174a1['options']);var _0x535735={'where':_0x2ff2e0[_0xc9dd('0x3d')]};return db[_0xc9dd('0x31')][_0xc9dd('0x42')](_0x535735)[_0xc9dd('0x29')](function(_0x4ce5d3){_0x58deb3[_0xc9dd('0x42')]=_0x4ce5d3;if(_0x1174a1[_0xc9dd('0x37')][_0xc9dd('0x43')]){_0x2ff2e0['include']=[{'all':!![]}];}return db[_0xc9dd('0x31')][_0xc9dd('0x44')](_0x2ff2e0);})['then'](function(_0x1926d4){_0x58deb3[_0xc9dd('0x45')]=_0x1926d4;return _0x58deb3;})['then'](respondWithFilteredResult(_0x3dd784,_0x2ff2e0))['catch'](handleError(_0x3dd784,null));};exports['show']=function(_0x48bdba,_0x3fc589){var _0x79864={'raw':!![],'where':{'id':_0x48bdba[_0xc9dd('0x46')]['id']}},_0x5f51d6={};_0x5f51d6['model']=_[_0xc9dd('0x36')](db[_0xc9dd('0x31')]['rawAttributes']);_0x5f51d6[_0xc9dd('0x37')]=_[_0xc9dd('0x36')](_0x48bdba[_0xc9dd('0x37')]);_0x5f51d6[_0xc9dd('0x38')]=_[_0xc9dd('0x39')](_0x5f51d6[_0xc9dd('0x35')],_0x5f51d6['query']);_0x79864[_0xc9dd('0x3a')]=_[_0xc9dd('0x39')](_0x5f51d6[_0xc9dd('0x35')],qs[_0xc9dd('0x3b')](_0x48bdba[_0xc9dd('0x37')][_0xc9dd('0x3b')]));_0x79864['attributes']=_0x79864[_0xc9dd('0x3a')]['length']?_0x79864['attributes']:_0x5f51d6[_0xc9dd('0x35')];if(_0x48bdba[_0xc9dd('0x37')]['includeAll']){_0x79864[_0xc9dd('0x47')]=[{'all':!![]}];}_0x79864=_['merge']({},_0x79864,_0x48bdba[_0xc9dd('0x48')]);return db[_0xc9dd('0x31')][_0xc9dd('0x49')](_0x79864)[_0xc9dd('0x29')](handleEntityNotFound(_0x3fc589,null))[_0xc9dd('0x29')](respondWithResult(_0x3fc589,null))[_0xc9dd('0x4a')](handleError(_0x3fc589,null));};exports[_0xc9dd('0x4b')]=function(_0x3cc991,_0x4a8661){return db['ChatInternalMessage'][_0xc9dd('0x4b')](_0x3cc991[_0xc9dd('0x4c')],{})['then'](respondWithResult(_0x4a8661,0xc9))[_0xc9dd('0x4a')](handleError(_0x4a8661,null));};exports[_0xc9dd('0x28')]=function(_0x1a69fa,_0x428e59){if(_0x1a69fa[_0xc9dd('0x4c')]['id']){delete _0x1a69fa[_0xc9dd('0x4c')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x1a69fa[_0xc9dd('0x46')]['id']}})[_0xc9dd('0x29')](handleEntityNotFound(_0x428e59,null))[_0xc9dd('0x29')](saveUpdates(_0x1a69fa[_0xc9dd('0x4c')],null))['then'](respondWithResult(_0x428e59,null))[_0xc9dd('0x4a')](handleError(_0x428e59,null));};exports['destroy']=function(_0x2d40bf,_0x103f52){return db[_0xc9dd('0x31')][_0xc9dd('0x49')]({'where':{'id':_0x2d40bf[_0xc9dd('0x46')]['id']}})[_0xc9dd('0x29')](handleEntityNotFound(_0x103f52,null))[_0xc9dd('0x29')](removeEntity(_0x103f52,null))[_0xc9dd('0x4a')](handleError(_0x103f52,null));};exports[_0xc9dd('0x4d')]=function(_0x996ae9,_0x3435f0){return db['ChatInternalMessage'][_0xc9dd('0x4d')]()[_0xc9dd('0x29')](respondWithResult(_0x3435f0,null))[_0xc9dd('0x4a')](handleError(_0x3435f0,null));};function wrapUser(_0x4ff5e5){return function(_0x339a76){var _0xb3f171=_0x4ff5e5[_0xc9dd('0x4e')]({'plain':!![]});_0xb3f171['messages']=[];if(_0x339a76){_0xb3f171['lastMessageAt']=_0x339a76[_0xc9dd('0x4f')];_0xb3f171[_0xc9dd('0x50')]=_0x339a76;}else{_0xb3f171[_0xc9dd('0x51')]=moment(0x0)[_0xc9dd('0x52')](_0xc9dd('0x53'));_0xb3f171['lastMessage']={};}return _0xb3f171;};}exports['getUsers']=function(_0x4ddac8,_0x4ef61f,_0x377fe0){var _0x2b3542=[];return db[_0xc9dd('0x54')][_0xc9dd('0x44')]({'where':{'role':[_0xc9dd('0x55'),'admin',_0xc9dd('0x56')]},'attributes':['id','fullname',_0xc9dd('0x2d'),_0xc9dd('0x57'),_0xc9dd('0x58'),_0xc9dd('0x59'),'online',_0xc9dd('0x5a'),_0xc9dd('0x5b'),'showWebBar'],'order':qs[_0xc9dd('0x5c')]('-online'),'include':[{'model':db[_0xc9dd('0x5d')],'as':_0xc9dd('0x5e'),'attributes':['id',_0xc9dd('0x2d'),_0xc9dd('0x33')],'through':{'attributes':[]}}]})[_0xc9dd('0x29')](function(_0x23f3a3){if(_0x23f3a3){var _0x467493=_0x4ddac8['user'][_0xc9dd('0x4e')]({'plain':!![]});if(!_0x467493)throw new Error(_0xc9dd('0x5f'));if(_0x467493['role']===_0xc9dd('0x56')){return db[_0xc9dd('0x60')]['find']({'where':{'name':_0xc9dd('0x61'),'userProfileId':_0x467493[_0xc9dd('0x62')]},'raw':!![]})[_0xc9dd('0x29')](function(_0x30e1fa){if(_0x30e1fa){if(_0x30e1fa[_0xc9dd('0x63')]===0x0){return db[_0xc9dd('0x64')][_0xc9dd('0x44')]({'where':{'sectionId':_0x30e1fa['id']},'raw':!![]})[_0xc9dd('0x29')](function(_0x510f07){var _0x10b061=[];if(_[_0xc9dd('0x65')](_0x510f07)){_0x10b061=_[_0xc9dd('0x3f')](_0x23f3a3,function(_0x26a47e){if(_0x26a47e['role']!=='agent'){return _0x26a47e;}});return _0x10b061;}else{for(var _0x337815=0x0;_0x337815<_0x23f3a3[_0xc9dd('0x3c')];_0x337815++){var _0x1d6cb8=_0x23f3a3[_0x337815];if(_0x1d6cb8[_0xc9dd('0x57')]==='agent'){var _0x28dcd4=_['find'](_0x510f07,function(_0x462f6b){return _0x462f6b[_0xc9dd('0x66')]===_0x1d6cb8['id'];});if(_0x28dcd4)_0x10b061[_0xc9dd('0x67')](_0x1d6cb8);}else{_0x10b061[_0xc9dd('0x67')](_0x1d6cb8);}}return _0x10b061;}});}else{return _0x23f3a3;}}else{var _0x33f516=_[_0xc9dd('0x3f')](_0x23f3a3,function(_0x5e7a9b){if(_0x5e7a9b[_0xc9dd('0x57')]!=='agent'){return _0x5e7a9b;}});return _0x33f516;}});}else{return _0x23f3a3;}}})[_0xc9dd('0x29')](function(_0x5c9ba7){var _0x36a6ca=[];if(_0x5c9ba7){_0x2b3542=_0x5c9ba7;for(var _0x4a1aa8=0x0;_0x4a1aa8<_0x5c9ba7[_0xc9dd('0x3c')];_0x4a1aa8+=0x1){_0x2b3542[_0x4a1aa8]['messages']=[];_0x36a6ca[_0xc9dd('0x67')](db['ChatInternalMessage'][_0xc9dd('0x49')]({'where':{'FromId':[_0x4ddac8[_0xc9dd('0x56')]['id'],_0x5c9ba7[_0x4a1aa8]['id']],'ToId':[_0x4ddac8[_0xc9dd('0x56')]['id'],_0x5c9ba7[_0x4a1aa8]['id']],'ChatGroupId':null},'attributes':['id',_0xc9dd('0x4f'),_0xc9dd('0x68'),_0xc9dd('0x69'),'read',_0xc9dd('0x4c')],'order':qs['sort'](_0xc9dd('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc9dd('0x29')](wrapUser(_0x5c9ba7[_0x4a1aa8])));}return BPromise['all'](_0x36a6ca);}return[];})[_0xc9dd('0x29')](function(_0x189e44){return{'rows':_0x189e44,'count':_0x189e44[_0xc9dd('0x3c')]};})[_0xc9dd('0x29')](respondWithResult(_0x4ef61f,null))[_0xc9dd('0x4a')](handleError(_0x4ef61f,null));}; \ No newline at end of file +var _0x0105=['fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','describe','lastMessageAt','lastMessage','format','getUsers','User','agent','admin','user','fullname','role','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','messages','createdAt','ToId','read','body','all','eml-format','rimraf','zip-dir'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x0105,0x1bd));var _0x5010=function(_0x1cb39f,_0x17212a){_0x1cb39f=_0x1cb39f-0x0;var _0x5026ee=_0x0105[_0x1cb39f];return _0x5026ee;};'use strict';var emlformat=require(_0x5010('0x0'));var rimraf=require(_0x5010('0x1'));var zipdir=require(_0x5010('0x2'));var jsonpatch=require(_0x5010('0x3'));var rp=require('request-promise');var moment=require(_0x5010('0x4'));var BPromise=require(_0x5010('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5010('0x6'));var sox=require(_0x5010('0x7'));var csv=require(_0x5010('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5010('0x9'));var _=require('lodash');var squel=require(_0x5010('0xa'));var crypto=require(_0x5010('0xb'));var jsforce=require(_0x5010('0xc'));var deskjs=require(_0x5010('0xd'));var toCsv=require(_0x5010('0x8'));var querystring=require(_0x5010('0xe'));var Papa=require(_0x5010('0xf'));var Redis=require(_0x5010('0x10'));var authService=require(_0x5010('0x11'));var qs=require(_0x5010('0x12'));var as=require(_0x5010('0x13'));var hardwareService=require(_0x5010('0x14'));var logger=require(_0x5010('0x15'))('api');var utils=require(_0x5010('0x16'));var config=require(_0x5010('0x17'));var licenseUtil=require(_0x5010('0x18'));var db=require(_0x5010('0x19'))['db'];config[_0x5010('0x1a')]=_[_0x5010('0x1b')](config[_0x5010('0x1a')],{'host':_0x5010('0x1c'),'port':0x18eb});var socket=require(_0x5010('0x1d'))(new Redis(config[_0x5010('0x1a')]));require(_0x5010('0x1e'))[_0x5010('0x1f')](socket);function respondWithStatusCode(_0x26a12f,_0x28d603){_0x28d603=_0x28d603||0xcc;return function(_0x424564){if(_0x424564){return _0x26a12f[_0x5010('0x20')](_0x28d603);}return _0x26a12f[_0x5010('0x21')](_0x28d603)['end']();};}function respondWithResult(_0x51dde2,_0x1f2407){_0x1f2407=_0x1f2407||0xc8;return function(_0x360c5d){if(_0x360c5d){return _0x51dde2['status'](_0x1f2407)[_0x5010('0x22')](_0x360c5d);}};}function respondWithFilteredResult(_0x119d77,_0x13f417){return function(_0x86460){if(_0x86460){var _0x44f8ff=typeof _0x13f417[_0x5010('0x23')]===_0x5010('0x24')&&typeof _0x13f417[_0x5010('0x25')]==='undefined';var _0x5b14f9=_0x86460[_0x5010('0x26')];var _0x195317=_0x44f8ff?0x0:_0x13f417[_0x5010('0x23')];var _0x4bcb65=_0x44f8ff?_0x86460[_0x5010('0x26')]:_0x13f417['offset']+_0x13f417[_0x5010('0x25')];var _0x5caed2;if(_0x4bcb65>=_0x5b14f9){_0x4bcb65=_0x5b14f9;_0x5caed2=0xc8;}else{_0x5caed2=0xce;}_0x119d77[_0x5010('0x21')](_0x5caed2);return _0x119d77['set'](_0x5010('0x27'),_0x195317+'-'+_0x4bcb65+'/'+_0x5b14f9)[_0x5010('0x22')](_0x86460);}return null;};}function patchUpdates(_0x33bd3b){return function(_0x38ac14){try{jsonpatch['apply'](_0x38ac14,_0x33bd3b,!![]);}catch(_0x5e9fd4){return BPromise['reject'](_0x5e9fd4);}return _0x38ac14[_0x5010('0x28')]();};}function saveUpdates(_0x468ea9,_0x57ddea){return function(_0x5bf20d){if(_0x5bf20d){return _0x5bf20d[_0x5010('0x29')](_0x468ea9)[_0x5010('0x2a')](function(_0x6d3367){return _0x6d3367;});}return null;};}function removeEntity(_0x3a8eb0,_0x370931){return function(_0x1c82eb){if(_0x1c82eb){return _0x1c82eb['destroy']()[_0x5010('0x2a')](function(){_0x3a8eb0[_0x5010('0x21')](0xcc)[_0x5010('0x2b')]();});}};}function handleEntityNotFound(_0x340ba9,_0x23ce20){return function(_0x57acb4){if(!_0x57acb4){_0x340ba9[_0x5010('0x20')](0x194);}return _0x57acb4;};}function handleError(_0x3eadb0,_0x48ba75){_0x48ba75=_0x48ba75||0x1f4;return function(_0x4a3897){logger[_0x5010('0x2c')](_0x4a3897[_0x5010('0x2d')]);if(_0x4a3897[_0x5010('0x2e')]){delete _0x4a3897[_0x5010('0x2e')];}_0x3eadb0['status'](_0x48ba75)[_0x5010('0x2f')](_0x4a3897);};}exports[_0x5010('0x30')]=function(_0xf27724,_0x5f3676){var _0x471c9c={},_0x1fdb58={},_0x43acd2={'count':0x0,'rows':[]};var _0x23ffaf=_[_0x5010('0x31')](db[_0x5010('0x32')][_0x5010('0x33')],function(_0x11cdfe){return{'name':_0x11cdfe[_0x5010('0x34')],'type':_0x11cdfe[_0x5010('0x35')]['key']};});_0x1fdb58[_0x5010('0x36')]=_[_0x5010('0x31')](_0x23ffaf,_0x5010('0x2e'));_0x1fdb58['query']=_[_0x5010('0x37')](_0xf27724[_0x5010('0x38')]);_0x1fdb58[_0x5010('0x39')]=_[_0x5010('0x3a')](_0x1fdb58[_0x5010('0x36')],_0x1fdb58[_0x5010('0x38')]);_0x471c9c['attributes']=_['intersection'](_0x1fdb58[_0x5010('0x36')],qs[_0x5010('0x3b')](_0xf27724[_0x5010('0x38')][_0x5010('0x3b')]));_0x471c9c[_0x5010('0x3c')]=_0x471c9c[_0x5010('0x3c')]['length']?_0x471c9c[_0x5010('0x3c')]:_0x1fdb58[_0x5010('0x36')];if(!_0xf27724[_0x5010('0x38')][_0x5010('0x3d')](_0x5010('0x3e'))){_0x471c9c[_0x5010('0x25')]=qs[_0x5010('0x25')](_0xf27724[_0x5010('0x38')][_0x5010('0x25')]);_0x471c9c[_0x5010('0x23')]=qs[_0x5010('0x23')](_0xf27724[_0x5010('0x38')][_0x5010('0x23')]);}_0x471c9c[_0x5010('0x3f')]=qs['sort'](_0xf27724['query'][_0x5010('0x40')]);_0x471c9c['where']=qs[_0x5010('0x39')](_[_0x5010('0x41')](_0xf27724['query'],_0x1fdb58[_0x5010('0x39')]),_0x23ffaf);if(_0xf27724[_0x5010('0x38')][_0x5010('0x42')]){_0x471c9c[_0x5010('0x43')]=_[_0x5010('0x44')](_0x471c9c[_0x5010('0x43')],{'$or':_[_0x5010('0x31')](_0x23ffaf,function(_0x3e7e0d){if(_0x3e7e0d[_0x5010('0x35')]!==_0x5010('0x45')){var _0x1eb556={};_0x1eb556[_0x3e7e0d[_0x5010('0x2e')]]={'$like':'%'+_0xf27724['query']['filter']+'%'};return _0x1eb556;}})});}_0x471c9c=_['merge']({},_0x471c9c,_0xf27724[_0x5010('0x46')]);var _0xd95878={'where':_0x471c9c['where']};return db[_0x5010('0x32')][_0x5010('0x26')](_0xd95878)[_0x5010('0x2a')](function(_0x423e96){_0x43acd2['count']=_0x423e96;if(_0xf27724[_0x5010('0x38')][_0x5010('0x47')]){_0x471c9c['include']=[{'all':!![]}];}return db[_0x5010('0x32')][_0x5010('0x48')](_0x471c9c);})['then'](function(_0x5d2a31){_0x43acd2[_0x5010('0x49')]=_0x5d2a31;return _0x43acd2;})[_0x5010('0x2a')](respondWithFilteredResult(_0x5f3676,_0x471c9c))[_0x5010('0x4a')](handleError(_0x5f3676,null));};exports['show']=function(_0x5de3f3,_0x5ccf3b){var _0x52ff00={'raw':!![],'where':{'id':_0x5de3f3[_0x5010('0x4b')]['id']}},_0x2cc18f={};_0x2cc18f[_0x5010('0x36')]=_[_0x5010('0x37')](db[_0x5010('0x32')]['rawAttributes']);_0x2cc18f[_0x5010('0x38')]=_[_0x5010('0x37')](_0x5de3f3[_0x5010('0x38')]);_0x2cc18f[_0x5010('0x39')]=_[_0x5010('0x3a')](_0x2cc18f[_0x5010('0x36')],_0x2cc18f[_0x5010('0x38')]);_0x52ff00[_0x5010('0x3c')]=_[_0x5010('0x3a')](_0x2cc18f[_0x5010('0x36')],qs[_0x5010('0x3b')](_0x5de3f3['query'][_0x5010('0x3b')]));_0x52ff00[_0x5010('0x3c')]=_0x52ff00[_0x5010('0x3c')][_0x5010('0x4c')]?_0x52ff00[_0x5010('0x3c')]:_0x2cc18f[_0x5010('0x36')];if(_0x5de3f3[_0x5010('0x38')][_0x5010('0x47')]){_0x52ff00[_0x5010('0x4d')]=[{'all':!![]}];}_0x52ff00=_[_0x5010('0x44')]({},_0x52ff00,_0x5de3f3[_0x5010('0x46')]);return db[_0x5010('0x32')][_0x5010('0x4e')](_0x52ff00)[_0x5010('0x2a')](handleEntityNotFound(_0x5ccf3b,null))[_0x5010('0x2a')](respondWithResult(_0x5ccf3b,null))['catch'](handleError(_0x5ccf3b,null));};exports[_0x5010('0x4f')]=function(_0x13a47a,_0x1c2b6e){return db[_0x5010('0x32')][_0x5010('0x4f')](_0x13a47a['body'],{})[_0x5010('0x2a')](respondWithResult(_0x1c2b6e,0xc9))['catch'](handleError(_0x1c2b6e,null));};exports[_0x5010('0x29')]=function(_0x326bf9,_0x402681){if(_0x326bf9['body']['id']){delete _0x326bf9['body']['id'];}return db['ChatInternalMessage'][_0x5010('0x4e')]({'where':{'id':_0x326bf9[_0x5010('0x4b')]['id']}})[_0x5010('0x2a')](handleEntityNotFound(_0x402681,null))[_0x5010('0x2a')](saveUpdates(_0x326bf9['body'],null))[_0x5010('0x2a')](respondWithResult(_0x402681,null))[_0x5010('0x4a')](handleError(_0x402681,null));};exports['destroy']=function(_0x1d51a5,_0xa33002){return db[_0x5010('0x32')][_0x5010('0x4e')]({'where':{'id':_0x1d51a5[_0x5010('0x4b')]['id']}})[_0x5010('0x2a')](handleEntityNotFound(_0xa33002,null))[_0x5010('0x2a')](removeEntity(_0xa33002,null))[_0x5010('0x4a')](handleError(_0xa33002,null));};exports[_0x5010('0x50')]=function(_0x497fd2,_0x2d8592){return db[_0x5010('0x32')][_0x5010('0x50')]()[_0x5010('0x2a')](respondWithResult(_0x2d8592,null))['catch'](handleError(_0x2d8592,null));};function wrapUser(_0x56eb70){return function(_0xf089df){var _0x579eae=_0x56eb70['get']({'plain':!![]});_0x579eae['messages']=[];if(_0xf089df){_0x579eae[_0x5010('0x51')]=_0xf089df['createdAt'];_0x579eae[_0x5010('0x52')]=_0xf089df;}else{_0x579eae['lastMessageAt']=moment(0x0)[_0x5010('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x579eae[_0x5010('0x52')]={};}return _0x579eae;};}exports[_0x5010('0x54')]=function(_0x162fa8,_0x2cbbea,_0x34ac2b){var _0xc8c590=[];return db[_0x5010('0x55')]['findAll']({'where':{'role':[_0x5010('0x56'),_0x5010('0x57'),_0x5010('0x58')]},'attributes':['id',_0x5010('0x59'),_0x5010('0x2e'),_0x5010('0x5a'),'userpic','internal',_0x5010('0x5b'),_0x5010('0x5c'),_0x5010('0x5d'),_0x5010('0x5e')],'order':qs[_0x5010('0x40')](_0x5010('0x5f')),'include':[{'model':db[_0x5010('0x60')],'as':_0x5010('0x61'),'attributes':['id',_0x5010('0x2e'),_0x5010('0x35')],'through':{'attributes':[]}}]})[_0x5010('0x2a')](function(_0x5e2f96){if(_0x5e2f96){var _0x22649c=_0x162fa8[_0x5010('0x58')][_0x5010('0x62')]({'plain':!![]});if(!_0x22649c)throw new Error(_0x5010('0x63'));if(_0x22649c['role']==='user'){return db['UserProfileSection']['find']({'where':{'name':_0x5010('0x64'),'userProfileId':_0x22649c[_0x5010('0x65')]},'raw':!![]})['then'](function(_0x217502){if(_0x217502){if(_0x217502[_0x5010('0x66')]===0x0){return db['UserProfileResource'][_0x5010('0x48')]({'where':{'sectionId':_0x217502['id']},'raw':!![]})['then'](function(_0x312f18){var _0x440629=[];if(_[_0x5010('0x67')](_0x312f18)){_0x440629=_[_0x5010('0x42')](_0x5e2f96,function(_0x2b29bd){if(_0x2b29bd['role']!==_0x5010('0x56')){return _0x2b29bd;}});return _0x440629;}else{for(var _0xcf9073=0x0;_0xcf9073<_0x5e2f96[_0x5010('0x4c')];_0xcf9073++){var _0x1299ce=_0x5e2f96[_0xcf9073];if(_0x1299ce[_0x5010('0x5a')]==='agent'){var _0x3c4509=_[_0x5010('0x4e')](_0x312f18,function(_0xbcec99){return _0xbcec99[_0x5010('0x68')]===_0x1299ce['id'];});if(_0x3c4509)_0x440629[_0x5010('0x69')](_0x1299ce);}else{_0x440629[_0x5010('0x69')](_0x1299ce);}}return _0x440629;}});}else{return _0x5e2f96;}}else{var _0x5086ef=_['filter'](_0x5e2f96,function(_0x31be1c){if(_0x31be1c[_0x5010('0x5a')]!==_0x5010('0x56')){return _0x31be1c;}});return _0x5086ef;}});}else{return _0x5e2f96;}}})[_0x5010('0x2a')](function(_0x159ffc){var _0x42628b=[];if(_0x159ffc){_0xc8c590=_0x159ffc;for(var _0x150a73=0x0;_0x150a73<_0x159ffc[_0x5010('0x4c')];_0x150a73+=0x1){_0xc8c590[_0x150a73][_0x5010('0x6a')]=[];_0x42628b[_0x5010('0x69')](db[_0x5010('0x32')][_0x5010('0x4e')]({'where':{'FromId':[_0x162fa8[_0x5010('0x58')]['id'],_0x159ffc[_0x150a73]['id']],'ToId':[_0x162fa8[_0x5010('0x58')]['id'],_0x159ffc[_0x150a73]['id']],'ChatGroupId':null},'attributes':['id',_0x5010('0x6b'),'FromId',_0x5010('0x6c'),_0x5010('0x6d'),_0x5010('0x6e')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5010('0x2a')](wrapUser(_0x159ffc[_0x150a73])));}return BPromise[_0x5010('0x6f')](_0x42628b);}return[];})['then'](function(_0x54b6ac){return{'rows':_0x54b6ac,'count':_0x54b6ac[_0x5010('0x4c')]};})[_0x5010('0x2a')](respondWithResult(_0x2cbbea,null))[_0x5010('0x4a')](handleError(_0x2cbbea,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d635e14..7b1084f 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 _0xe516=['ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x552db9,_0x7f1e7){var _0x556ffb=function(_0x2d2933){while(--_0x2d2933){_0x552db9['push'](_0x552db9['shift']());}};_0x556ffb(++_0x7f1e7);}(_0xe516,0x17a));var _0x6e51=function(_0x49b14d,_0x578d07){_0x49b14d=_0x49b14d-0x0;var _0x3d2488=_0xe516[_0x49b14d];return _0x3d2488;};'use strict';var EventEmitter=require(_0x6e51('0x0'));var ChatInternalMessage=require(_0x6e51('0x1'))['db'][_0x6e51('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6e51('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6e51('0x4'),'afterDestroy':_0x6e51('0x5')};function emitEvent(_0x2d6e96){return function(_0x2b16c3,_0x39e763,_0x48771c){ChatInternalMessageEvents[_0x6e51('0x6')](_0x2d6e96+':'+_0x2b16c3['id'],_0x2b16c3);ChatInternalMessageEvents[_0x6e51('0x6')](_0x2d6e96,_0x2b16c3);_0x48771c(null);};}for(var e in events){if(events[_0x6e51('0x7')](e)){var event=events[e];ChatInternalMessage[_0x6e51('0x8')](e,emitEvent(event));}}module[_0x6e51('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x5746=['exports','events','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x6cfb8a,_0x53be6f){var _0x29ba1d=function(_0x104303){while(--_0x104303){_0x6cfb8a['push'](_0x6cfb8a['shift']());}};_0x29ba1d(++_0x53be6f);}(_0x5746,0x1f2));var _0x6574=function(_0x563318,_0x1ee60f){_0x563318=_0x563318-0x0;var _0x2f345c=_0x5746[_0x563318];return _0x2f345c;};'use strict';var EventEmitter=require(_0x6574('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6574('0x1')](0x0);var events={'afterCreate':_0x6574('0x2'),'afterUpdate':'update','afterDestroy':_0x6574('0x3')};function emitEvent(_0xb718de){return function(_0x936bd9,_0x15aae6,_0x175462){ChatInternalMessageEvents[_0x6574('0x4')](_0xb718de+':'+_0x936bd9['id'],_0x936bd9);ChatInternalMessageEvents[_0x6574('0x4')](_0xb718de,_0x936bd9);_0x175462(null);};}for(var e in events){if(events[_0x6574('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x6574('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 66d5ac8..5ec4464 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 _0x7983=['./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','request-promise','rimraf'];(function(_0x3f25a3,_0x3b6718){var _0x307877=function(_0x2d1bf1){while(--_0x2d1bf1){_0x3f25a3['push'](_0x3f25a3['shift']());}};_0x307877(++_0x3b6718);}(_0x7983,0x1c8));var _0x3798=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x7983[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x3798('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3798('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3798('0x2'));var config=require('../../config/environment');var attributes=require(_0x3798('0x3'));module['exports']=function(_0x446a39,_0x2a51ac){return _0x446a39[_0x3798('0x4')](_0x3798('0x5'),attributes,{'tableName':_0x3798('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3798('0x7'),'collate':_0x3798('0x8')});}; \ No newline at end of file +var _0x61d9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1a7588,_0x38b20a){var _0xd1fbb2=function(_0x3fca2b){while(--_0x3fca2b){_0x1a7588['push'](_0x1a7588['shift']());}};_0xd1fbb2(++_0x38b20a);}(_0x61d9,0x1a0));var _0x961d=function(_0x4d742f,_0x271308){_0x4d742f=_0x4d742f-0x0;var _0x57f3ac=_0x61d9[_0x4d742f];return _0x57f3ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x961d('0x0'));var moment=require(_0x961d('0x1'));var BPromise=require(_0x961d('0x2'));var rp=require(_0x961d('0x3'));var fs=require('fs');var path=require(_0x961d('0x4'));var rimraf=require(_0x961d('0x5'));var config=require(_0x961d('0x6'));var attributes=require(_0x961d('0x7'));module[_0x961d('0x8')]=function(_0x3373b8,_0xd62546){return _0x3373b8[_0x961d('0x9')]('ChatInternalMessage',attributes,{'tableName':_0x961d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x961d('0xb'),'collate':_0x961d('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b232105..08b9db6 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 _0xd7ce=['request','then','info','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','ChatInternalMessage,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x494ff3,_0x28b306){var _0x55f03=function(_0x418fd1){while(--_0x418fd1){_0x494ff3['push'](_0x494ff3['shift']());}};_0x55f03(++_0x28b306);}(_0xd7ce,0x16b));var _0xed7c=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0xd7ce[_0x11dc39];return _0x457277;};'use strict';var _=require(_0xed7c('0x0'));var util=require(_0xed7c('0x1'));var moment=require(_0xed7c('0x2'));var BPromise=require(_0xed7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed7c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xed7c('0x5'));var jayson=require(_0xed7c('0x6'));var client=jayson[_0xed7c('0x7')][_0xed7c('0x8')]({'port':0x232a});config[_0xed7c('0x9')]=_[_0xed7c('0xa')](config[_0xed7c('0x9')],{'host':_0xed7c('0xb'),'port':0x18eb});var socket=require(_0xed7c('0xc'))(new Redis(config[_0xed7c('0x9')]));require(_0xed7c('0xd'))[_0xed7c('0xe')](socket);function respondWithRpcPromise(_0x5beb1c,_0x3902d9,_0x1e337e){return new BPromise(function(_0x30867e,_0x425a81){return client[_0xed7c('0xf')](_0x5beb1c,_0x1e337e)[_0xed7c('0x10')](function(_0x5f431b){logger[_0xed7c('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x3902d9,'request\x20sent');logger['debug'](_0xed7c('0x12'),_0x3902d9,_0xed7c('0x13'),JSON[_0xed7c('0x14')](_0x5f431b));if(_0x5f431b['error']){if(_0x5f431b['error'][_0xed7c('0x15')]===0x1f4){logger['error'](_0xed7c('0x16'),_0x3902d9,_0x5f431b[_0xed7c('0x17')]['message']);return _0x425a81(_0x5f431b[_0xed7c('0x17')][_0xed7c('0x18')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x3902d9,_0x5f431b[_0xed7c('0x17')][_0xed7c('0x18')]);return _0x30867e(_0x5f431b[_0xed7c('0x17')]['message']);}else{logger['info'](_0xed7c('0x16'),_0x3902d9,_0xed7c('0x13'));_0x30867e(_0x5f431b[_0xed7c('0x19')][_0xed7c('0x18')]);}})[_0xed7c('0x1a')](function(_0x396555){logger[_0xed7c('0x17')](_0xed7c('0x16'),_0x3902d9,_0x396555);_0x425a81(_0x396555);});});} \ No newline at end of file +var _0xeef0=['http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x8958a2,_0x25ec6c){var _0x5dca35=function(_0x15333f){while(--_0x15333f){_0x8958a2['push'](_0x8958a2['shift']());}};_0x5dca35(++_0x25ec6c);}(_0xeef0,0x1c4));var _0x0eef=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xeef0[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x0eef('0x0'));var util=require(_0x0eef('0x1'));var moment=require(_0x0eef('0x2'));var BPromise=require(_0x0eef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0eef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0eef('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0eef('0x6'));var client=jayson[_0x0eef('0x7')][_0x0eef('0x8')]({'port':0x232a});config[_0x0eef('0x9')]=_['defaults'](config[_0x0eef('0x9')],{'host':_0x0eef('0xa'),'port':0x18eb});var socket=require(_0x0eef('0xb'))(new Redis(config['redis']));require(_0x0eef('0xc'))[_0x0eef('0xd')](socket);function respondWithRpcPromise(_0x5bac12,_0x412a98,_0x234349){return new BPromise(function(_0x415fde,_0x4d00c0){return client['request'](_0x5bac12,_0x234349)[_0x0eef('0xe')](function(_0x59a535){logger[_0x0eef('0xf')](_0x0eef('0x10'),_0x412a98,_0x0eef('0x11'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x412a98,_0x0eef('0x11'),JSON['stringify'](_0x59a535));if(_0x59a535[_0x0eef('0x12')]){if(_0x59a535[_0x0eef('0x12')][_0x0eef('0x13')]===0x1f4){logger['error'](_0x0eef('0x10'),_0x412a98,_0x59a535[_0x0eef('0x12')][_0x0eef('0x14')]);return _0x4d00c0(_0x59a535[_0x0eef('0x12')][_0x0eef('0x14')]);}logger[_0x0eef('0x12')](_0x0eef('0x10'),_0x412a98,_0x59a535[_0x0eef('0x12')][_0x0eef('0x14')]);return _0x415fde(_0x59a535[_0x0eef('0x12')]['message']);}else{logger[_0x0eef('0xf')](_0x0eef('0x10'),_0x412a98,'request\x20sent');_0x415fde(_0x59a535[_0x0eef('0x15')][_0x0eef('0x14')]);}})[_0x0eef('0x16')](function(_0x2bbeb6){logger[_0x0eef('0x12')](_0x0eef('0x10'),_0x412a98,_0x2bbeb6);_0x4d00c0(_0x2bbeb6);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 1d13744..6b1b3fb 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 _0x9d42=['removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x5e18b1,_0x4cc07b){var _0x2219ec=function(_0x4c2bfb){while(--_0x4c2bfb){_0x5e18b1['push'](_0x5e18b1['shift']());}};_0x2219ec(++_0x4cc07b);}(_0x9d42,0x129));var _0x29d4=function(_0x58850c,_0x510e14){_0x58850c=_0x58850c-0x0;var _0x1e098f=_0x9d42[_0x58850c];return _0x1e098f;};'use strict';var ChatInternalMessageEvents=require(_0x29d4('0x0'));var events=[_0x29d4('0x1'),_0x29d4('0x2'),_0x29d4('0x3')];function createListener(_0x5604bc,_0x5d8769){return function(_0x4f3929){_0x5d8769['emit'](_0x5604bc,_0x4f3929);};}function removeListener(_0x107ca5,_0xa254b6){return function(){ChatInternalMessageEvents[_0x29d4('0x4')](_0x107ca5,_0xa254b6);};}exports[_0x29d4('0x5')]=function(_0x1bf22b){for(var _0x4094f1=0x0,_0x7bda98=events['length'];_0x4094f1<_0x7bda98;_0x4094f1++){var _0x3d9eb3=events[_0x4094f1];var _0x969045=createListener(_0x29d4('0x6')+_0x3d9eb3,_0x1bf22b);ChatInternalMessageEvents['on'](_0x3d9eb3,_0x969045);}}; \ No newline at end of file +var _0x916a=['register','length','chatInternalMessage:','./chatInternalMessage.events','remove','emit'];(function(_0x4df7d6,_0x24e8eb){var _0xc14992=function(_0x47cf4e){while(--_0x47cf4e){_0x4df7d6['push'](_0x4df7d6['shift']());}};_0xc14992(++_0x24e8eb);}(_0x916a,0x189));var _0xa916=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0x916a[_0x58175c];return _0x55b88f;};'use strict';var ChatInternalMessageEvents=require(_0xa916('0x0'));var events=['save',_0xa916('0x1'),'update'];function createListener(_0x1e2c8d,_0xd79a2){return function(_0x53934f){_0xd79a2[_0xa916('0x2')](_0x1e2c8d,_0x53934f);};}function removeListener(_0x2e90ca,_0xee00b8){return function(){ChatInternalMessageEvents['removeListener'](_0x2e90ca,_0xee00b8);};}exports[_0xa916('0x3')]=function(_0x514ee2){for(var _0x4cd2e4=0x0,_0x33cf59=events[_0xa916('0x4')];_0x4cd2e4<_0x33cf59;_0x4cd2e4++){var _0x58a91a=events[_0x4cd2e4];var _0x3f5234=createListener(_0xa916('0x5')+_0x58a91a,_0x514ee2);ChatInternalMessageEvents['on'](_0x58a91a,_0x3f5234);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7430d14..460e9a1 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 _0x6e81=['put','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/users','getUsers','/:id','show','create'];(function(_0xbd61a7,_0x3239ce){var _0x2e2a76=function(_0x5b03e1){while(--_0x5b03e1){_0xbd61a7['push'](_0xbd61a7['shift']());}};_0x2e2a76(++_0x3239ce);}(_0x6e81,0x191));var _0x16e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e81[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x16e8('0x0'));var util=require(_0x16e8('0x1'));var path=require(_0x16e8('0x2'));var timeout=require(_0x16e8('0x3'));var express=require(_0x16e8('0x4'));var router=express[_0x16e8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x16e8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x16e8('0x7'));var controller=require(_0x16e8('0x8'));router[_0x16e8('0x9')]('/',auth[_0x16e8('0xa')](),controller[_0x16e8('0xb')]);router[_0x16e8('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x16e8('0x9')](_0x16e8('0xc'),auth[_0x16e8('0xa')](),controller[_0x16e8('0xd')]);router[_0x16e8('0x9')](_0x16e8('0xe'),auth[_0x16e8('0xa')](),controller[_0x16e8('0xf')]);router['post']('/',auth[_0x16e8('0xa')](),controller[_0x16e8('0x10')]);router[_0x16e8('0x11')](_0x16e8('0xe'),controller['update']);router[_0x16e8('0x12')](_0x16e8('0xe'),auth[_0x16e8('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x49a4=['describe','/users','/:id','show','post','create','put','update','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index'];(function(_0x57cc16,_0x444378){var _0x5421e5=function(_0xbcb1d3){while(--_0xbcb1d3){_0x57cc16['push'](_0x57cc16['shift']());}};_0x5421e5(++_0x444378);}(_0x49a4,0x149));var _0x449a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x49a4[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x449a('0x0'));var express=require(_0x449a('0x1'));var router=express[_0x449a('0x2')]();var fs_extra=require(_0x449a('0x3'));var auth=require(_0x449a('0x4'));var interaction=require(_0x449a('0x5'));var config=require(_0x449a('0x6'));var controller=require(_0x449a('0x7'));router[_0x449a('0x8')]('/',auth[_0x449a('0x9')](),controller[_0x449a('0xa')]);router['get']('/describe',auth[_0x449a('0x9')](),controller[_0x449a('0xb')]);router[_0x449a('0x8')](_0x449a('0xc'),auth[_0x449a('0x9')](),controller['getUsers']);router[_0x449a('0x8')](_0x449a('0xd'),auth['isAuthenticated'](),controller[_0x449a('0xe')]);router[_0x449a('0xf')]('/',auth['isAuthenticated'](),controller[_0x449a('0x10')]);router[_0x449a('0x11')](_0x449a('0xd'),controller[_0x449a('0x12')]);router['delete'](_0x449a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x449a('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f9f96f2..d41363d 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 _0x1775=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x493057,_0x44d38b){var _0x3c8f43=function(_0x54d91a){while(--_0x54d91a){_0x493057['push'](_0x493057['shift']());}};_0x3c8f43(++_0x44d38b);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'body':{'type':Sequelize[_0x5177('0x1')](_0x5177('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5177('0x4')]('in',_0x5177('0x5')),'defaultValue':_0x5177('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5177('0x6')]},'providerName':{'type':Sequelize[_0x5177('0x7')]},'providerResponse':{'type':Sequelize[_0x5177('0x1')]}}; \ No newline at end of file +var _0x28f2=['TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x35e2d7,_0x1729b7){var _0x3fcbf2=function(_0x1e225e){while(--_0x1e225e){_0x35e2d7['push'](_0x35e2d7['shift']());}};_0x3fcbf2(++_0x1729b7);}(_0x28f2,0x193));var _0x228f=function(_0x3adf1b,_0x53317d){_0x3adf1b=_0x3adf1b-0x0;var _0x4300d5=_0x28f2[_0x3adf1b];return _0x4300d5;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'body':{'type':Sequelize[_0x228f('0x2')](_0x228f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x228f('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x228f('0x5')]('in',_0x228f('0x6')),'defaultValue':_0x228f('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x228f('0x7')]},'providerName':{'type':Sequelize[_0x228f('0x8')]},'providerResponse':{'type':Sequelize[_0x228f('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d1a9c8e..c1ab92c 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 _0x75ed=['find','describe','chat-interactions','chat','read','readAt','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','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','sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','acceptmessage','parse','formData','RejectMessage','rejectMessage','Sequelize','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','redis','./chatMessage.socket','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','params','length','create','body'];(function(_0x4e3f0e,_0x5939fe){var _0x5ed6e4=function(_0x3d41fc){while(--_0x3d41fc){_0x4e3f0e['push'](_0x4e3f0e['shift']());}};_0x5ed6e4(++_0x5939fe);}(_0x75ed,0x124));var _0xd75e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x75ed[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xd75e('0x0'));var rimraf=require(_0xd75e('0x1'));var zipdir=require(_0xd75e('0x2'));var jsonpatch=require(_0xd75e('0x3'));var rp=require('request-promise');var moment=require(_0xd75e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd75e('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd75e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd75e('0x7'));var squel=require(_0xd75e('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd75e('0x9'));var toCsv=require('to-csv');var querystring=require(_0xd75e('0xa'));var Papa=require(_0xd75e('0xb'));var Redis=require('ioredis');var authService=require(_0xd75e('0xc'));var qs=require(_0xd75e('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd75e('0xe'))(_0xd75e('0xf'));var utils=require(_0xd75e('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xd75e('0x11'));var db=require(_0xd75e('0x12'))['db'];config['redis']=_[_0xd75e('0x13')](config['redis'],{'host':_0xd75e('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd75e('0x15')]));require(_0xd75e('0x16'))['register'](socket);var jayson=require(_0xd75e('0x17'));var client=jayson[_0xd75e('0x18')]['http']({'port':0x232c});var client9002=jayson['client'][_0xd75e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3b2b68,_0x2a14a0,_0xebeae0,_0x1ff050){return new BPromise(function(_0x1a3cac,_0x21a02c){var _0x2bf433=_0x1ff050||client;return _0x2bf433['request'](_0x3b2b68,_0xebeae0)[_0xd75e('0x1a')](function(_0x16ea05){logger[_0xd75e('0x1b')](_0xd75e('0x1c'),_0x2a14a0,_0xd75e('0x1d'));logger['debug'](_0xd75e('0x1e'),_0x2a14a0,_0xd75e('0x1d'),JSON[_0xd75e('0x1f')](_0x16ea05));if(_0x16ea05['error']){if(_0x16ea05[_0xd75e('0x20')][_0xd75e('0x21')]===0x1f4){logger[_0xd75e('0x20')](_0xd75e('0x1c'),_0x2a14a0,_0x16ea05[_0xd75e('0x20')][_0xd75e('0x22')]);return _0x21a02c(_0x16ea05[_0xd75e('0x20')][_0xd75e('0x22')]);}logger[_0xd75e('0x20')](_0xd75e('0x1c'),_0x2a14a0,_0x16ea05['error'][_0xd75e('0x22')]);return _0x1a3cac(_0x16ea05[_0xd75e('0x20')][_0xd75e('0x22')]);}else{logger[_0xd75e('0x1b')](_0xd75e('0x1c'),_0x2a14a0,_0xd75e('0x1d'));_0x1a3cac(_0x16ea05[_0xd75e('0x23')][_0xd75e('0x22')]);}})[_0xd75e('0x24')](function(_0x236589){logger['error'](_0xd75e('0x1c'),_0x2a14a0,_0x236589);_0x21a02c(_0x236589);});});}function respondWithStatusCode(_0x127ac5,_0x44b9b8){_0x44b9b8=_0x44b9b8||0xcc;return function(_0x166f70){if(_0x166f70){return _0x127ac5['sendStatus'](_0x44b9b8);}return _0x127ac5['status'](_0x44b9b8)['end']();};}function respondWithResult(_0x353b5f,_0x1e6dbb){_0x1e6dbb=_0x1e6dbb||0xc8;return function(_0x40e5e2){if(_0x40e5e2){return _0x353b5f['status'](_0x1e6dbb)[_0xd75e('0x25')](_0x40e5e2);}};}function respondWithFilteredResult(_0x5d1719,_0x5f3fb9){return function(_0x47f657){if(_0x47f657){var _0x5e0ef1=typeof _0x5f3fb9['offset']===_0xd75e('0x26')&&typeof _0x5f3fb9[_0xd75e('0x27')]===_0xd75e('0x26');var _0x521df0=_0x47f657[_0xd75e('0x28')];var _0x166d84=_0x5e0ef1?0x0:_0x5f3fb9[_0xd75e('0x29')];var _0x54e253=_0x5e0ef1?_0x47f657['count']:_0x5f3fb9['offset']+_0x5f3fb9[_0xd75e('0x27')];var _0x58b3c2;if(_0x54e253>=_0x521df0){_0x54e253=_0x521df0;_0x58b3c2=0xc8;}else{_0x58b3c2=0xce;}_0x5d1719[_0xd75e('0x2a')](_0x58b3c2);return _0x5d1719['set'](_0xd75e('0x2b'),_0x166d84+'-'+_0x54e253+'/'+_0x521df0)['json'](_0x47f657);}return null;};}function patchUpdates(_0x36124){return function(_0x340f62){try{jsonpatch[_0xd75e('0x2c')](_0x340f62,_0x36124,!![]);}catch(_0x432f69){return BPromise[_0xd75e('0x2d')](_0x432f69);}return _0x340f62[_0xd75e('0x2e')]();};}function saveUpdates(_0x49fd8c,_0x3a124a){return function(_0xe7f92a){if(_0xe7f92a){return _0xe7f92a[_0xd75e('0x2f')](_0x49fd8c)[_0xd75e('0x1a')](function(_0x8c6785){return _0x8c6785;});}return null;};}function removeEntity(_0x12a9c5,_0x1d2f9a){return function(_0x497f4c){if(_0x497f4c){return _0x497f4c[_0xd75e('0x30')]()['then'](function(){_0x12a9c5['status'](0xcc)[_0xd75e('0x31')]();});}};}function handleEntityNotFound(_0x450531,_0x46dbfa){return function(_0xe8bb12){if(!_0xe8bb12){_0x450531[_0xd75e('0x32')](0x194);}return _0xe8bb12;};}function handleError(_0x2f8e39,_0x3ddf33){_0x3ddf33=_0x3ddf33||0x1f4;return function(_0x20e64e){logger['error'](_0x20e64e['stack']);if(_0x20e64e[_0xd75e('0x33')]){delete _0x20e64e['name'];}_0x2f8e39[_0xd75e('0x2a')](_0x3ddf33)[_0xd75e('0x34')](_0x20e64e);};}exports[_0xd75e('0x35')]=function(_0x502026,_0x53d032){var _0x2cfe43={},_0x86c7bd={},_0x248e50={'count':0x0,'rows':[]};var _0x401446=_[_0xd75e('0x36')](db[_0xd75e('0x37')][_0xd75e('0x38')],function(_0x33adca){return{'name':_0x33adca[_0xd75e('0x39')],'type':_0x33adca[_0xd75e('0x3a')][_0xd75e('0x3b')]};});_0x86c7bd[_0xd75e('0x3c')]=_[_0xd75e('0x36')](_0x401446,_0xd75e('0x33'));_0x86c7bd['query']=_[_0xd75e('0x3d')](_0x502026['query']);_0x86c7bd[_0xd75e('0x3e')]=_[_0xd75e('0x3f')](_0x86c7bd['model'],_0x86c7bd[_0xd75e('0x40')]);_0x2cfe43['attributes']=_[_0xd75e('0x3f')](_0x86c7bd[_0xd75e('0x3c')],qs[_0xd75e('0x41')](_0x502026[_0xd75e('0x40')]['fields']));_0x2cfe43[_0xd75e('0x42')]=_0x2cfe43[_0xd75e('0x42')]['length']?_0x2cfe43[_0xd75e('0x42')]:_0x86c7bd[_0xd75e('0x3c')];if(!_0x502026[_0xd75e('0x40')][_0xd75e('0x43')](_0xd75e('0x44'))){_0x2cfe43[_0xd75e('0x27')]=qs[_0xd75e('0x27')](_0x502026[_0xd75e('0x40')][_0xd75e('0x27')]);_0x2cfe43[_0xd75e('0x29')]=qs['offset'](_0x502026[_0xd75e('0x40')]['offset']);}_0x2cfe43['order']=qs['sort'](_0x502026[_0xd75e('0x40')][_0xd75e('0x45')]);_0x2cfe43['where']=qs['filters'](_[_0xd75e('0x46')](_0x502026[_0xd75e('0x40')],_0x86c7bd[_0xd75e('0x3e')]),_0x401446);if(_0x502026['query'][_0xd75e('0x47')]){_0x2cfe43[_0xd75e('0x48')]=_[_0xd75e('0x49')](_0x2cfe43[_0xd75e('0x48')],{'$or':_[_0xd75e('0x36')](_0x401446,function(_0xb4c1c9){if(_0xb4c1c9[_0xd75e('0x3a')]!==_0xd75e('0x4a')){var _0x444ab9={};_0x444ab9[_0xb4c1c9['name']]={'$like':'%'+_0x502026['query']['filter']+'%'};return _0x444ab9;}})});}_0x2cfe43=_[_0xd75e('0x49')]({},_0x2cfe43,_0x502026[_0xd75e('0x4b')]);var _0x223587={'where':_0x2cfe43[_0xd75e('0x48')]};return db['ChatMessage']['count'](_0x223587)['then'](function(_0x1f7f49){_0x248e50[_0xd75e('0x28')]=_0x1f7f49;if(_0x502026[_0xd75e('0x40')][_0xd75e('0x4c')]){_0x2cfe43[_0xd75e('0x4d')]=[{'all':!![]}];}return db[_0xd75e('0x37')][_0xd75e('0x4e')](_0x2cfe43);})[_0xd75e('0x1a')](function(_0x56c048){_0x248e50['rows']=_0x56c048;return _0x248e50;})[_0xd75e('0x1a')](respondWithFilteredResult(_0x53d032,_0x2cfe43))['catch'](handleError(_0x53d032,null));};exports['show']=function(_0x3d0990,_0x301c1f){var _0xe3a347={'raw':!![],'where':{'id':_0x3d0990[_0xd75e('0x4f')]['id']}},_0x222d72={};_0x222d72[_0xd75e('0x3c')]=_[_0xd75e('0x3d')](db[_0xd75e('0x37')]['rawAttributes']);_0x222d72[_0xd75e('0x40')]=_[_0xd75e('0x3d')](_0x3d0990[_0xd75e('0x40')]);_0x222d72[_0xd75e('0x3e')]=_['intersection'](_0x222d72[_0xd75e('0x3c')],_0x222d72[_0xd75e('0x40')]);_0xe3a347['attributes']=_['intersection'](_0x222d72[_0xd75e('0x3c')],qs[_0xd75e('0x41')](_0x3d0990['query'][_0xd75e('0x41')]));_0xe3a347[_0xd75e('0x42')]=_0xe3a347[_0xd75e('0x42')][_0xd75e('0x50')]?_0xe3a347[_0xd75e('0x42')]:_0x222d72[_0xd75e('0x3c')];if(_0x3d0990[_0xd75e('0x40')][_0xd75e('0x4c')]){_0xe3a347[_0xd75e('0x4d')]=[{'all':!![]}];}_0xe3a347=_[_0xd75e('0x49')]({},_0xe3a347,_0x3d0990[_0xd75e('0x4b')]);return db[_0xd75e('0x37')]['find'](_0xe3a347)[_0xd75e('0x1a')](handleEntityNotFound(_0x301c1f,null))['then'](respondWithResult(_0x301c1f,null))[_0xd75e('0x24')](handleError(_0x301c1f,null));};exports['create']=function(_0x13146c,_0x15a396){return db[_0xd75e('0x37')][_0xd75e('0x51')](_0x13146c['body'],{})[_0xd75e('0x1a')](respondWithResult(_0x15a396,0xc9))[_0xd75e('0x24')](handleError(_0x15a396,null));};exports[_0xd75e('0x2f')]=function(_0xfffe33,_0x49f8c7){if(_0xfffe33[_0xd75e('0x52')]['id']){delete _0xfffe33['body']['id'];}return db[_0xd75e('0x37')][_0xd75e('0x53')]({'where':{'id':_0xfffe33[_0xd75e('0x4f')]['id']}})[_0xd75e('0x1a')](handleEntityNotFound(_0x49f8c7,null))[_0xd75e('0x1a')](saveUpdates(_0xfffe33['body'],null))[_0xd75e('0x1a')](respondWithResult(_0x49f8c7,null))['catch'](handleError(_0x49f8c7,null));};exports[_0xd75e('0x30')]=function(_0x4aa9db,_0x3c72d6){return db[_0xd75e('0x37')][_0xd75e('0x53')]({'where':{'id':_0x4aa9db[_0xd75e('0x4f')]['id']}})[_0xd75e('0x1a')](handleEntityNotFound(_0x3c72d6,null))['then'](removeEntity(_0x3c72d6,null))[_0xd75e('0x24')](handleError(_0x3c72d6,null));};exports[_0xd75e('0x54')]=function(_0x22bd5c,_0x28a485){return db[_0xd75e('0x37')][_0xd75e('0x54')]()[_0xd75e('0x1a')](respondWithResult(_0x28a485,null))[_0xd75e('0x24')](handleError(_0x28a485,null));};var interaction_log=require('../../config/logger')(_0xd75e('0x55'));exports['accept']=function(_0x32885b,_0x3732e6,_0x50bc91){var _0x578b7c={'agent':{},'channel':_0xd75e('0x56')};if(_0x32885b[_0xd75e('0x52')]['id']){delete _0x32885b['body']['id'];}_0x32885b['body'][_0xd75e('0x57')]=!![];_0x32885b['body'][_0xd75e('0x58')]=moment()[_0xd75e('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x32885b[_0xd75e('0x52')][_0xd75e('0x5a')]=_0x32885b[_0xd75e('0x52')][_0xd75e('0x5a')]||_0x32885b[_0xd75e('0x5b')]['id'];_0x578b7c[_0xd75e('0x5c')]['id']=_0x32885b[_0xd75e('0x52')]['UserId'];return db[_0xd75e('0x37')]['find']({'where':{'id':_0x32885b[_0xd75e('0x4f')]['id'],'UserId':null}})[_0xd75e('0x1a')](handleEntityNotFound(_0x3732e6,null))[_0xd75e('0x1a')](saveUpdates(_0x32885b[_0xd75e('0x52')],null))['then'](function(_0x23d52b){if(_0x23d52b){_0x578b7c[_0xd75e('0x22')]=_0x23d52b[_0xd75e('0x5d')]({'plain':!![]});return db[_0xd75e('0x5e')]['find']({'where':{'id':_0x23d52b[_0xd75e('0x5f')]}});}return null;})[_0xd75e('0x1a')](handleEntityNotFound(_0x3732e6,null))[_0xd75e('0x1a')](function(_0x5e6c94){if(_0x5e6c94){return _0x5e6c94[_0xd75e('0x2f')]({'UserId':_0x32885b[_0xd75e('0x52')][_0xd75e('0x5a')],'read1stAt':_[_0xd75e('0x60')](_0x5e6c94['read1stAt'])?moment()[_0xd75e('0x59')](_0xd75e('0x61')):undefined});}return null;})[_0xd75e('0x1a')](function(_0x500902){if(_0x500902){_0x578b7c[_0xd75e('0x62')]=_0x500902[_0xd75e('0x5d')]({'plain':!![]});interaction_log[_0xd75e('0x1b')](_0xd75e('0x63'),_0x32885b[_0xd75e('0x5b')]['id'],_0x32885b[_0xd75e('0x5b')][_0xd75e('0x33')],_0x32885b[_0xd75e('0x5b')][_0xd75e('0x64')],_0x578b7c[_0xd75e('0x62')]['id'],_0x32885b[_0xd75e('0x52')]?JSON['stringify'](_0x32885b[_0xd75e('0x52')]):_0xd75e('0x65'));return respondWithRpcPromise(_0xd75e('0x66'),_0xd75e('0x67'),_0x578b7c);}return null;})[_0xd75e('0x1a')](function(_0x29dfe4){var _0x389ca1=_0xd75e('0x68')+_0x29dfe4[_0xd75e('0x22')]['ContactId'];return db[_0xd75e('0x69')][_0xd75e('0x40')](_0x389ca1,{'type':db['Sequelize'][_0xd75e('0x6a')]['SELECT'],'raw':!![]})[_0xd75e('0x1a')](function(_0x1a4fa5){return _0x1a4fa5;});})['then'](function(_0x53f21a){if(_0x53f21a){_0x578b7c[_0xd75e('0x22')][_0xd75e('0x6b')]=_0x53f21a[0x0];if(!_0x32885b[_0xd75e('0x52')][_0xd75e('0x5a')])return;return db[_0xd75e('0x6c')]['find']({'where':{'id':_0x32885b[_0xd75e('0x52')][_0xd75e('0x5a')],'role':_0xd75e('0x5c')},'attributes':['id',_0xd75e('0x33'),_0xd75e('0x6d'),_0xd75e('0x6e'),_0xd75e('0x6f')],'raw':!![]});}return null;})[_0xd75e('0x1a')](function(_0x410346){if(!_0x410346)return null;_0x578b7c[_0xd75e('0x22')]['agent']=_0x410346;return _0x578b7c;})['then'](function(_0x30f36a){if(_0x30f36a){if(_0x32885b[_0xd75e('0x52')]['manual']){_0x578b7c['message'][_0xd75e('0x70')]=util['format'](_0xd75e('0x71'),_0x32885b['user']['name']);_0x578b7c['message'][_0xd75e('0x72')]=_0x578b7c[_0xd75e('0x72')];_0x578b7c['message'][_0xd75e('0x73')]=_0x578b7c[_0xd75e('0x72')];_0x578b7c['message'][_0xd75e('0x74')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xd75e('0x75'),'message':_['merge'](_0x578b7c[_0xd75e('0x22')],JSON[_0xd75e('0x76')](_0x578b7c[_0xd75e('0x62')][_0xd75e('0x77')]))},client9002)['then'](function(){return _0x578b7c;});}return _0x578b7c;}return null;})['then'](respondWithResult(_0x3732e6,null))[_0xd75e('0x24')](handleError(_0x3732e6,null));};var interaction_log=require('../../config/logger')(_0xd75e('0x55'));exports['reject']=function(_0xd4ade8,_0x5d53b8,_0x5857e7){var _0x449b95={'agent':{},'channel':_0xd75e('0x56')};if(_0xd4ade8[_0xd75e('0x52')]['id']){delete _0xd4ade8[_0xd75e('0x52')]['id'];}_0xd4ade8['body']['UserId']=_0xd4ade8[_0xd75e('0x52')][_0xd75e('0x5a')]||_0xd4ade8[_0xd75e('0x5b')]['id'];_0x449b95[_0xd75e('0x5c')]['id']=_0xd4ade8[_0xd75e('0x52')][_0xd75e('0x5a')];return db[_0xd75e('0x37')][_0xd75e('0x53')]({'where':{'id':_0xd4ade8[_0xd75e('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5d53b8,null))[_0xd75e('0x1a')](function(_0x283a3e){if(_0x283a3e){_0x449b95[_0xd75e('0x22')]=_0x283a3e[_0xd75e('0x5d')]({'plain':!![]});return db['ChatInteraction'][_0xd75e('0x53')]({'where':{'id':_0x283a3e[_0xd75e('0x5f')]}});}return null;})[_0xd75e('0x1a')](handleEntityNotFound(_0x5d53b8,null))[_0xd75e('0x1a')](function(_0x43f208){if(_0x43f208){_0x449b95[_0xd75e('0x62')]=_0x43f208[_0xd75e('0x5d')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd4ade8[_0xd75e('0x5b')]['id'],_0xd4ade8[_0xd75e('0x5b')]['name'],_0xd4ade8[_0xd75e('0x5b')]['role'],_0x449b95[_0xd75e('0x62')]['id'],_0xd4ade8[_0xd75e('0x52')]?JSON[_0xd75e('0x1f')](_0xd4ade8['body']):'null');return respondWithRpcPromise(_0xd75e('0x78'),_0xd75e('0x79'),_0x449b95);}return null;})[_0xd75e('0x1a')](function(_0x596a0c){var _0x19e61e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x596a0c[_0xd75e('0x22')]['ContactId'];return db['sequelize'][_0xd75e('0x40')](_0x19e61e,{'type':db[_0xd75e('0x7a')][_0xd75e('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0x3781e6){return _0x3781e6;});})[_0xd75e('0x1a')](function(_0x5109a6){if(_0x5109a6){_0x449b95[_0xd75e('0x22')][_0xd75e('0x6b')]=_0x5109a6[0x0];if(!_0xd4ade8['body'][_0xd75e('0x5a')])return;return db[_0xd75e('0x6c')][_0xd75e('0x53')]({'where':{'id':_0xd4ade8[_0xd75e('0x52')][_0xd75e('0x5a')],'role':_0xd75e('0x5c')},'attributes':['id',_0xd75e('0x33'),'fullname',_0xd75e('0x6e'),_0xd75e('0x6f')],'raw':!![]});}return null;})[_0xd75e('0x1a')](function(_0x29499a){if(!_0x29499a)return null;_0x449b95[_0xd75e('0x22')][_0xd75e('0x5c')]=_0x29499a;return _0x449b95;})[_0xd75e('0x1a')](function(_0x16337a){if(_0x16337a){_0x16337a['message']['interface']=util[_0xd75e('0x59')](_0xd75e('0x71'),_0xd4ade8[_0xd75e('0x5b')][_0xd75e('0x33')]);_0x16337a[_0xd75e('0x22')][_0xd75e('0x72')]=_0x449b95['channel'];_0x16337a[_0xd75e('0x22')][_0xd75e('0x73')]=_0x449b95[_0xd75e('0x72')];_0x16337a['message'][_0xd75e('0x74')]='reject';respondWithRpcPromise(_0xd75e('0x7b'),_0xd75e('0x7b'),{'event':_0xd75e('0x7c'),'message':_['merge'](_0x449b95[_0xd75e('0x22')],JSON[_0xd75e('0x76')](_0x449b95[_0xd75e('0x62')][_0xd75e('0x77')]))},client9002);return _0x449b95;}return null;})[_0xd75e('0x1a')](respondWithResult(_0x5d53b8,null))[_0xd75e('0x24')](handleError(_0x5d53b8,null));}; \ No newline at end of file +var _0x32ac=['[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','interface','rejectmessage','formData','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','offset','undefined','count','limit','set','json','reject','save','update','then','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','where','type','VIRTUAL','merge','includeAll','include','rows','show','options','find','create','body','params','accept','chat','read','readAt','format','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','chat-interactions'];(function(_0x399f46,_0x48d930){var _0x4e11cc=function(_0x5e6978){while(--_0x5e6978){_0x399f46['push'](_0x399f46['shift']());}};_0x4e11cc(++_0x48d930);}(_0x32ac,0x90));var _0xc32a=function(_0x5422bd,_0x4ff360){_0x5422bd=_0x5422bd-0x0;var _0x42a047=_0x32ac[_0x5422bd];return _0x42a047;};'use strict';var emlformat=require(_0xc32a('0x0'));var rimraf=require(_0xc32a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc32a('0x2'));var rp=require(_0xc32a('0x3'));var moment=require(_0xc32a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc32a('0x5'));var util=require(_0xc32a('0x6'));var path=require(_0xc32a('0x7'));var sox=require(_0xc32a('0x8'));var csv=require(_0xc32a('0x9'));var ejs=require(_0xc32a('0xa'));var fs=require('fs');var fs_extra=require(_0xc32a('0xb'));var _=require(_0xc32a('0xc'));var squel=require(_0xc32a('0xd'));var crypto=require(_0xc32a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc32a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc32a('0x10'));var Redis=require(_0xc32a('0x11'));var authService=require(_0xc32a('0x12'));var qs=require(_0xc32a('0x13'));var as=require(_0xc32a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc32a('0x15'))(_0xc32a('0x16'));var utils=require(_0xc32a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc32a('0x18'));var db=require(_0xc32a('0x19'))['db'];config[_0xc32a('0x1a')]=_[_0xc32a('0x1b')](config[_0xc32a('0x1a')],{'host':_0xc32a('0x1c'),'port':0x18eb});var socket=require(_0xc32a('0x1d'))(new Redis(config[_0xc32a('0x1a')]));require(_0xc32a('0x1e'))['register'](socket);var jayson=require(_0xc32a('0x1f'));var client=jayson[_0xc32a('0x20')][_0xc32a('0x21')]({'port':0x232c});var client9002=jayson[_0xc32a('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59baad,_0x25abd2,_0xb090bb,_0x497058){return new BPromise(function(_0x3f6c6d,_0x35ead2){var _0x34fdf5=_0x497058||client;return _0x34fdf5[_0xc32a('0x22')](_0x59baad,_0xb090bb)['then'](function(_0x201cab){logger['info']('ChatMessage,\x20%s,\x20%s',_0x25abd2,_0xc32a('0x23'));logger[_0xc32a('0x24')](_0xc32a('0x25'),_0x25abd2,_0xc32a('0x23'),JSON[_0xc32a('0x26')](_0x201cab));if(_0x201cab['error']){if(_0x201cab['error'][_0xc32a('0x27')]===0x1f4){logger[_0xc32a('0x28')](_0xc32a('0x29'),_0x25abd2,_0x201cab['error']['message']);return _0x35ead2(_0x201cab[_0xc32a('0x28')]['message']);}logger[_0xc32a('0x28')](_0xc32a('0x29'),_0x25abd2,_0x201cab[_0xc32a('0x28')][_0xc32a('0x2a')]);return _0x3f6c6d(_0x201cab[_0xc32a('0x28')][_0xc32a('0x2a')]);}else{logger[_0xc32a('0x2b')](_0xc32a('0x29'),_0x25abd2,_0xc32a('0x23'));_0x3f6c6d(_0x201cab[_0xc32a('0x2c')][_0xc32a('0x2a')]);}})[_0xc32a('0x2d')](function(_0x1dd542){logger[_0xc32a('0x28')]('ChatMessage,\x20%s,\x20%s',_0x25abd2,_0x1dd542);_0x35ead2(_0x1dd542);});});}function respondWithStatusCode(_0x36b4dc,_0x546f56){_0x546f56=_0x546f56||0xcc;return function(_0x1cb1b0){if(_0x1cb1b0){return _0x36b4dc[_0xc32a('0x2e')](_0x546f56);}return _0x36b4dc[_0xc32a('0x2f')](_0x546f56)['end']();};}function respondWithResult(_0x929c0d,_0x3c7adf){_0x3c7adf=_0x3c7adf||0xc8;return function(_0x2777a4){if(_0x2777a4){return _0x929c0d[_0xc32a('0x2f')](_0x3c7adf)['json'](_0x2777a4);}};}function respondWithFilteredResult(_0x3c88fa,_0x85cb54){return function(_0x480510){if(_0x480510){var _0x22174e=typeof _0x85cb54[_0xc32a('0x30')]===_0xc32a('0x31')&&typeof _0x85cb54['limit']==='undefined';var _0x3e2445=_0x480510['count'];var _0x5a8001=_0x22174e?0x0:_0x85cb54[_0xc32a('0x30')];var _0xab77f8=_0x22174e?_0x480510[_0xc32a('0x32')]:_0x85cb54[_0xc32a('0x30')]+_0x85cb54[_0xc32a('0x33')];var _0x59b49a;if(_0xab77f8>=_0x3e2445){_0xab77f8=_0x3e2445;_0x59b49a=0xc8;}else{_0x59b49a=0xce;}_0x3c88fa[_0xc32a('0x2f')](_0x59b49a);return _0x3c88fa[_0xc32a('0x34')]('Content-Range',_0x5a8001+'-'+_0xab77f8+'/'+_0x3e2445)[_0xc32a('0x35')](_0x480510);}return null;};}function patchUpdates(_0x3419b0){return function(_0x526027){try{jsonpatch['apply'](_0x526027,_0x3419b0,!![]);}catch(_0x4315c9){return BPromise[_0xc32a('0x36')](_0x4315c9);}return _0x526027[_0xc32a('0x37')]();};}function saveUpdates(_0x1bcb91,_0x1248df){return function(_0x470b14){if(_0x470b14){return _0x470b14[_0xc32a('0x38')](_0x1bcb91)[_0xc32a('0x39')](function(_0x4870cd){return _0x4870cd;});}return null;};}function removeEntity(_0x6afb97,_0x3a2229){return function(_0x218f57){if(_0x218f57){return _0x218f57[_0xc32a('0x3a')]()[_0xc32a('0x39')](function(){_0x6afb97[_0xc32a('0x2f')](0xcc)[_0xc32a('0x3b')]();});}};}function handleEntityNotFound(_0x3171cf,_0xc36cea){return function(_0x40b255){if(!_0x40b255){_0x3171cf['sendStatus'](0x194);}return _0x40b255;};}function handleError(_0x5c1795,_0xb19c1f){_0xb19c1f=_0xb19c1f||0x1f4;return function(_0x1dfe54){logger['error'](_0x1dfe54[_0xc32a('0x3c')]);if(_0x1dfe54['name']){delete _0x1dfe54[_0xc32a('0x3d')];}_0x5c1795['status'](_0xb19c1f)[_0xc32a('0x3e')](_0x1dfe54);};}exports[_0xc32a('0x3f')]=function(_0x5ad705,_0x455df0){var _0x2ae965={},_0x40323a={},_0x276823={'count':0x0,'rows':[]};var _0x430f3b=_[_0xc32a('0x40')](db[_0xc32a('0x41')][_0xc32a('0x42')],function(_0x2aea0d){return{'name':_0x2aea0d[_0xc32a('0x43')],'type':_0x2aea0d['type'][_0xc32a('0x44')]};});_0x40323a[_0xc32a('0x45')]=_[_0xc32a('0x40')](_0x430f3b,_0xc32a('0x3d'));_0x40323a[_0xc32a('0x46')]=_[_0xc32a('0x47')](_0x5ad705[_0xc32a('0x46')]);_0x40323a['filters']=_[_0xc32a('0x48')](_0x40323a['model'],_0x40323a['query']);_0x2ae965[_0xc32a('0x49')]=_['intersection'](_0x40323a[_0xc32a('0x45')],qs[_0xc32a('0x4a')](_0x5ad705[_0xc32a('0x46')][_0xc32a('0x4a')]));_0x2ae965[_0xc32a('0x49')]=_0x2ae965[_0xc32a('0x49')][_0xc32a('0x4b')]?_0x2ae965[_0xc32a('0x49')]:_0x40323a[_0xc32a('0x45')];if(!_0x5ad705['query'][_0xc32a('0x4c')](_0xc32a('0x4d'))){_0x2ae965[_0xc32a('0x33')]=qs['limit'](_0x5ad705[_0xc32a('0x46')][_0xc32a('0x33')]);_0x2ae965[_0xc32a('0x30')]=qs[_0xc32a('0x30')](_0x5ad705[_0xc32a('0x46')][_0xc32a('0x30')]);}_0x2ae965['order']=qs[_0xc32a('0x4e')](_0x5ad705[_0xc32a('0x46')][_0xc32a('0x4e')]);_0x2ae965['where']=qs[_0xc32a('0x4f')](_['pick'](_0x5ad705[_0xc32a('0x46')],_0x40323a[_0xc32a('0x4f')]),_0x430f3b);if(_0x5ad705['query']['filter']){_0x2ae965[_0xc32a('0x50')]=_['merge'](_0x2ae965[_0xc32a('0x50')],{'$or':_[_0xc32a('0x40')](_0x430f3b,function(_0x559fb1){if(_0x559fb1[_0xc32a('0x51')]!==_0xc32a('0x52')){var _0x29150f={};_0x29150f[_0x559fb1['name']]={'$like':'%'+_0x5ad705['query']['filter']+'%'};return _0x29150f;}})});}_0x2ae965=_[_0xc32a('0x53')]({},_0x2ae965,_0x5ad705['options']);var _0x2ec4bf={'where':_0x2ae965[_0xc32a('0x50')]};return db[_0xc32a('0x41')][_0xc32a('0x32')](_0x2ec4bf)[_0xc32a('0x39')](function(_0x4f072a){_0x276823[_0xc32a('0x32')]=_0x4f072a;if(_0x5ad705[_0xc32a('0x46')][_0xc32a('0x54')]){_0x2ae965[_0xc32a('0x55')]=[{'all':!![]}];}return db[_0xc32a('0x41')]['findAll'](_0x2ae965);})['then'](function(_0x426d42){_0x276823[_0xc32a('0x56')]=_0x426d42;return _0x276823;})[_0xc32a('0x39')](respondWithFilteredResult(_0x455df0,_0x2ae965))['catch'](handleError(_0x455df0,null));};exports[_0xc32a('0x57')]=function(_0x327d0c,_0x3d767e){var _0x45a49c={'raw':!![],'where':{'id':_0x327d0c['params']['id']}},_0x440e16={};_0x440e16[_0xc32a('0x45')]=_['keys'](db[_0xc32a('0x41')][_0xc32a('0x42')]);_0x440e16['query']=_[_0xc32a('0x47')](_0x327d0c['query']);_0x440e16[_0xc32a('0x4f')]=_['intersection'](_0x440e16[_0xc32a('0x45')],_0x440e16[_0xc32a('0x46')]);_0x45a49c[_0xc32a('0x49')]=_[_0xc32a('0x48')](_0x440e16[_0xc32a('0x45')],qs['fields'](_0x327d0c[_0xc32a('0x46')][_0xc32a('0x4a')]));_0x45a49c[_0xc32a('0x49')]=_0x45a49c['attributes'][_0xc32a('0x4b')]?_0x45a49c[_0xc32a('0x49')]:_0x440e16[_0xc32a('0x45')];if(_0x327d0c[_0xc32a('0x46')]['includeAll']){_0x45a49c[_0xc32a('0x55')]=[{'all':!![]}];}_0x45a49c=_[_0xc32a('0x53')]({},_0x45a49c,_0x327d0c[_0xc32a('0x58')]);return db[_0xc32a('0x41')][_0xc32a('0x59')](_0x45a49c)[_0xc32a('0x39')](handleEntityNotFound(_0x3d767e,null))[_0xc32a('0x39')](respondWithResult(_0x3d767e,null))[_0xc32a('0x2d')](handleError(_0x3d767e,null));};exports[_0xc32a('0x5a')]=function(_0x3cf52d,_0x1f1358){return db['ChatMessage'][_0xc32a('0x5a')](_0x3cf52d[_0xc32a('0x5b')],{})['then'](respondWithResult(_0x1f1358,0xc9))[_0xc32a('0x2d')](handleError(_0x1f1358,null));};exports[_0xc32a('0x38')]=function(_0x3072ba,_0x39a1d8){if(_0x3072ba[_0xc32a('0x5b')]['id']){delete _0x3072ba[_0xc32a('0x5b')]['id'];}return db['ChatMessage'][_0xc32a('0x59')]({'where':{'id':_0x3072ba['params']['id']}})['then'](handleEntityNotFound(_0x39a1d8,null))[_0xc32a('0x39')](saveUpdates(_0x3072ba[_0xc32a('0x5b')],null))[_0xc32a('0x39')](respondWithResult(_0x39a1d8,null))['catch'](handleError(_0x39a1d8,null));};exports[_0xc32a('0x3a')]=function(_0x3a29c4,_0x1a4b85){return db['ChatMessage'][_0xc32a('0x59')]({'where':{'id':_0x3a29c4[_0xc32a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1a4b85,null))[_0xc32a('0x39')](removeEntity(_0x1a4b85,null))['catch'](handleError(_0x1a4b85,null));};exports['describe']=function(_0x2501b2,_0x2aa036){return db[_0xc32a('0x41')]['describe']()[_0xc32a('0x39')](respondWithResult(_0x2aa036,null))[_0xc32a('0x2d')](handleError(_0x2aa036,null));};var interaction_log=require(_0xc32a('0x15'))('chat-interactions');exports[_0xc32a('0x5d')]=function(_0x35c5ba,_0x2403b5,_0x523ba8){var _0x34f948={'agent':{},'channel':_0xc32a('0x5e')};if(_0x35c5ba[_0xc32a('0x5b')]['id']){delete _0x35c5ba[_0xc32a('0x5b')]['id'];}_0x35c5ba[_0xc32a('0x5b')][_0xc32a('0x5f')]=!![];_0x35c5ba['body'][_0xc32a('0x60')]=moment()[_0xc32a('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x35c5ba['body'][_0xc32a('0x62')]=_0x35c5ba[_0xc32a('0x5b')][_0xc32a('0x62')]||_0x35c5ba['user']['id'];_0x34f948[_0xc32a('0x63')]['id']=_0x35c5ba['body']['UserId'];return db[_0xc32a('0x41')][_0xc32a('0x59')]({'where':{'id':_0x35c5ba[_0xc32a('0x5c')]['id'],'UserId':null}})[_0xc32a('0x39')](handleEntityNotFound(_0x2403b5,null))[_0xc32a('0x39')](saveUpdates(_0x35c5ba[_0xc32a('0x5b')],null))[_0xc32a('0x39')](function(_0x4eab54){if(_0x4eab54){_0x34f948['message']=_0x4eab54[_0xc32a('0x64')]({'plain':!![]});return db[_0xc32a('0x65')]['find']({'where':{'id':_0x4eab54[_0xc32a('0x66')]}});}return null;})[_0xc32a('0x39')](handleEntityNotFound(_0x2403b5,null))['then'](function(_0x4cfea5){if(_0x4cfea5){return _0x4cfea5[_0xc32a('0x38')]({'UserId':_0x35c5ba[_0xc32a('0x5b')][_0xc32a('0x62')],'read1stAt':_[_0xc32a('0x67')](_0x4cfea5[_0xc32a('0x68')])?moment()[_0xc32a('0x61')](_0xc32a('0x69')):undefined});}return null;})[_0xc32a('0x39')](function(_0x480432){if(_0x480432){_0x34f948[_0xc32a('0x6a')]=_0x480432[_0xc32a('0x64')]({'plain':!![]});interaction_log[_0xc32a('0x2b')](_0xc32a('0x6b'),_0x35c5ba['user']['id'],_0x35c5ba['user']['name'],_0x35c5ba[_0xc32a('0x6c')][_0xc32a('0x6d')],_0x34f948[_0xc32a('0x6a')]['id'],_0x35c5ba['body']?JSON[_0xc32a('0x26')](_0x35c5ba[_0xc32a('0x5b')]):_0xc32a('0x6e'));return respondWithRpcPromise('AcceptMessage',_0xc32a('0x6f'),_0x34f948);}return null;})[_0xc32a('0x39')](function(_0x1f0b2a){var _0x568ac2=_0xc32a('0x70')+_0x1f0b2a[_0xc32a('0x2a')]['ContactId'];return db[_0xc32a('0x71')][_0xc32a('0x46')](_0x568ac2,{'type':db[_0xc32a('0x72')][_0xc32a('0x73')][_0xc32a('0x74')],'raw':!![]})[_0xc32a('0x39')](function(_0x2c29f8){return _0x2c29f8;});})[_0xc32a('0x39')](function(_0x4028d3){if(_0x4028d3){_0x34f948['message'][_0xc32a('0x75')]=_0x4028d3[0x0];if(!_0x35c5ba[_0xc32a('0x5b')][_0xc32a('0x62')])return;return db[_0xc32a('0x76')][_0xc32a('0x59')]({'where':{'id':_0x35c5ba[_0xc32a('0x5b')]['UserId'],'role':_0xc32a('0x63')},'attributes':['id',_0xc32a('0x3d'),_0xc32a('0x77'),_0xc32a('0x78'),_0xc32a('0x79')],'raw':!![]});}return null;})[_0xc32a('0x39')](function(_0x3d55c4){if(!_0x3d55c4)return null;_0x34f948[_0xc32a('0x2a')][_0xc32a('0x63')]=_0x3d55c4;return _0x34f948;})['then'](function(_0x39246a){if(_0x39246a){if(_0x35c5ba['body']['manual']){_0x34f948[_0xc32a('0x2a')]['interface']=util['format'](_0xc32a('0x7a'),_0x35c5ba['user'][_0xc32a('0x3d')]);_0x34f948[_0xc32a('0x2a')][_0xc32a('0x7b')]=_0x34f948['channel'];_0x34f948[_0xc32a('0x2a')][_0xc32a('0x7c')]=_0x34f948[_0xc32a('0x7b')];_0x34f948[_0xc32a('0x2a')][_0xc32a('0x7d')]=_0xc32a('0x5d');return respondWithRpcPromise(_0xc32a('0x7e'),'EventManager',{'event':_0xc32a('0x7f'),'message':_['merge'](_0x34f948[_0xc32a('0x2a')],JSON[_0xc32a('0x80')](_0x34f948[_0xc32a('0x6a')]['formData']))},client9002)[_0xc32a('0x39')](function(){return _0x34f948;});}return _0x34f948;}return null;})[_0xc32a('0x39')](respondWithResult(_0x2403b5,null))[_0xc32a('0x2d')](handleError(_0x2403b5,null));};var interaction_log=require(_0xc32a('0x15'))(_0xc32a('0x81'));exports['reject']=function(_0x37b670,_0x2cf48b,_0x3e54c7){var _0x331814={'agent':{},'channel':_0xc32a('0x5e')};if(_0x37b670[_0xc32a('0x5b')]['id']){delete _0x37b670['body']['id'];}_0x37b670[_0xc32a('0x5b')][_0xc32a('0x62')]=_0x37b670[_0xc32a('0x5b')][_0xc32a('0x62')]||_0x37b670[_0xc32a('0x6c')]['id'];_0x331814['agent']['id']=_0x37b670[_0xc32a('0x5b')][_0xc32a('0x62')];return db[_0xc32a('0x41')][_0xc32a('0x59')]({'where':{'id':_0x37b670[_0xc32a('0x5c')]['id'],'UserId':null}})[_0xc32a('0x39')](handleEntityNotFound(_0x2cf48b,null))[_0xc32a('0x39')](function(_0x336d94){if(_0x336d94){_0x331814['message']=_0x336d94[_0xc32a('0x64')]({'plain':!![]});return db[_0xc32a('0x65')]['find']({'where':{'id':_0x336d94[_0xc32a('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2cf48b,null))[_0xc32a('0x39')](function(_0x87a37b){if(_0x87a37b){_0x331814[_0xc32a('0x6a')]=_0x87a37b['get']({'plain':!![]});interaction_log[_0xc32a('0x2b')](_0xc32a('0x82'),_0x37b670[_0xc32a('0x6c')]['id'],_0x37b670[_0xc32a('0x6c')][_0xc32a('0x3d')],_0x37b670['user'][_0xc32a('0x6d')],_0x331814[_0xc32a('0x6a')]['id'],_0x37b670[_0xc32a('0x5b')]?JSON[_0xc32a('0x26')](_0x37b670['body']):_0xc32a('0x6e'));return respondWithRpcPromise(_0xc32a('0x83'),_0xc32a('0x84'),_0x331814);}return null;})[_0xc32a('0x39')](function(_0x4e8b6d){var _0x1f3adb=_0xc32a('0x70')+_0x4e8b6d[_0xc32a('0x2a')][_0xc32a('0x85')];return db[_0xc32a('0x71')][_0xc32a('0x46')](_0x1f3adb,{'type':db[_0xc32a('0x72')][_0xc32a('0x73')][_0xc32a('0x74')],'raw':!![]})[_0xc32a('0x39')](function(_0x61d1c1){return _0x61d1c1;});})[_0xc32a('0x39')](function(_0x30be61){if(_0x30be61){_0x331814['message'][_0xc32a('0x75')]=_0x30be61[0x0];if(!_0x37b670[_0xc32a('0x5b')]['UserId'])return;return db[_0xc32a('0x76')][_0xc32a('0x59')]({'where':{'id':_0x37b670[_0xc32a('0x5b')][_0xc32a('0x62')],'role':_0xc32a('0x63')},'attributes':['id',_0xc32a('0x3d'),_0xc32a('0x77'),_0xc32a('0x78'),_0xc32a('0x79')],'raw':!![]});}return null;})[_0xc32a('0x39')](function(_0x4793bc){if(!_0x4793bc)return null;_0x331814[_0xc32a('0x2a')][_0xc32a('0x63')]=_0x4793bc;return _0x331814;})['then'](function(_0x465afb){if(_0x465afb){_0x465afb[_0xc32a('0x2a')][_0xc32a('0x86')]=util[_0xc32a('0x61')]('SIP/%s',_0x37b670['user'][_0xc32a('0x3d')]);_0x465afb[_0xc32a('0x2a')][_0xc32a('0x7b')]=_0x331814['channel'];_0x465afb[_0xc32a('0x2a')][_0xc32a('0x7c')]=_0x331814[_0xc32a('0x7b')];_0x465afb['message']['event']=_0xc32a('0x36');respondWithRpcPromise(_0xc32a('0x7e'),_0xc32a('0x7e'),{'event':_0xc32a('0x87'),'message':_[_0xc32a('0x53')](_0x331814[_0xc32a('0x2a')],JSON[_0xc32a('0x80')](_0x331814[_0xc32a('0x6a')][_0xc32a('0x88')]))},client9002);return _0x331814;}return null;})[_0xc32a('0x39')](respondWithResult(_0x2cf48b,null))[_0xc32a('0x2d')](handleError(_0x2cf48b,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 4146517..910b278 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 _0x6f74=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1b1a68,_0x20375a){var _0x2bc69b=function(_0x4b3849){while(--_0x4b3849){_0x1b1a68['push'](_0x1b1a68['shift']());}};_0x2bc69b(++_0x20375a);}(_0x6f74,0x128));var _0x46f7=function(_0x223ee7,_0x570db2){_0x223ee7=_0x223ee7-0x0;var _0x508164=_0x6f74[_0x223ee7];return _0x508164;};'use strict';var EventEmitter=require(_0x46f7('0x0'));var ChatMessage=require(_0x46f7('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x46f7('0x2'),'afterUpdate':_0x46f7('0x3'),'afterDestroy':_0x46f7('0x4')};function emitEvent(_0x33caae){return function(_0x5077bb,_0x3155c0,_0x53a10){ChatMessageEvents[_0x46f7('0x5')](_0x33caae+':'+_0x5077bb['id'],_0x5077bb);ChatMessageEvents[_0x46f7('0x5')](_0x33caae,_0x5077bb);_0x53a10(null);};}for(var e in events){if(events[_0x46f7('0x6')](e)){var event=events[e];ChatMessage[_0x46f7('0x7')](e,emitEvent(event));}}module[_0x46f7('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xeb82=['hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','update','emit'];(function(_0x95ed4c,_0x2a89e6){var _0x4630cd=function(_0x36c572){while(--_0x36c572){_0x95ed4c['push'](_0x95ed4c['shift']());}};_0x4630cd(++_0x2a89e6);}(_0xeb82,0x163));var _0x2eb8=function(_0x1e18d3,_0x3099aa){_0x1e18d3=_0x1e18d3-0x0;var _0x4660e9=_0xeb82[_0x1e18d3];return _0x4660e9;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x2eb8('0x0'))['db'][_0x2eb8('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2eb8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2eb8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x91f7b){return function(_0x33ede9,_0x5b22a0,_0x397297){ChatMessageEvents[_0x2eb8('0x4')](_0x91f7b+':'+_0x33ede9['id'],_0x33ede9);ChatMessageEvents[_0x2eb8('0x4')](_0x91f7b,_0x33ede9);_0x397297(null);};}for(var e in events){if(events[_0x2eb8('0x5')](e)){var event=events[e];ChatMessage[_0x2eb8('0x6')](e,emitEvent(event));}}module[_0x2eb8('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 2a2ee93..fc8fc5d 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 _0xa67b=['path','rimraf','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2399e4,_0x2fba91){var _0x3554df=function(_0x497a68){while(--_0x497a68){_0x2399e4['push'](_0x2399e4['shift']());}};_0x3554df(++_0x2fba91);}(_0xa67b,0x14a));var _0xba67=function(_0x3635d1,_0x43429f){_0x3635d1=_0x3635d1-0x0;var _0x3654e9=_0xa67b[_0x3635d1];return _0x3654e9;};'use strict';var _=require(_0xba67('0x0'));var util=require(_0xba67('0x1'));var logger=require(_0xba67('0x2'))(_0xba67('0x3'));var moment=require(_0xba67('0x4'));var BPromise=require(_0xba67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba67('0x6'));var rimraf=require(_0xba67('0x7'));var config=require('../../config/environment');var attributes=require(_0xba67('0x8'));module['exports']=function(_0x39baa2,_0x351b19){return _0x39baa2[_0xba67('0x9')](_0xba67('0xa'),attributes,{'tableName':_0xba67('0xb'),'paranoid':![],'indexes':[{'name':_0xba67('0xc'),'fields':[_0xba67('0xd')],'type':_0xba67('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x170008,_0x507e0e,_0x4d64b2){var _0x31b5e1=_0x39baa2[_0xba67('0xf')];var _0x573ce4=_0x170008[_0xba67('0x10')]({'plain':!![]});if(_0x573ce4[_0xba67('0x11')]['toLowerCase']()==='in'||_0x573ce4['direction'][_0xba67('0x12')]()==='out'&&!_0x573ce4[_0xba67('0x13')]&&!_[_0xba67('0x14')](_0x573ce4[_0xba67('0x15')])){_0x31b5e1[_0xba67('0x16')][_0xba67('0x17')]({'where':{'id':_0x573ce4[_0xba67('0x18')]}})['then'](function(_0x34a5e0){if(_0x34a5e0){_0x34a5e0['update']({'lastMsgAt':_0x573ce4[_0xba67('0x19')],'lastMsgDirection':_0x573ce4['direction']['toLowerCase']()});}})[_0xba67('0x1a')](function(_0x3354e6){console['error'](_0x3354e6);});}_0x4d64b2();}},'charset':'utf8mb4','collate':_0xba67('0x1b')});}; \ No newline at end of file +var _0x8d0e=['bluebird','request-promise','path','rimraf','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','ChatInteraction','ChatInteractionId','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5bc022,_0x6b78e5){_0x5bc022=_0x5bc022-0x0;var _0x229e50=_0x8d0e[_0x5bc022];return _0x229e50;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[{'name':_0xe8d0('0xd'),'fields':[_0xe8d0('0xe')],'type':_0xe8d0('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x37deac,_0x5605a0,_0x10e56c){var _0x19c3d0=_0x560dab[_0xe8d0('0x10')];var _0x599bc3=_0x37deac['get']({'plain':!![]});if(_0x599bc3[_0xe8d0('0x11')][_0xe8d0('0x12')]()==='in'||_0x599bc3[_0xe8d0('0x11')][_0xe8d0('0x12')]()===_0xe8d0('0x13')&&!_0x599bc3[_0xe8d0('0x14')]&&!_['isNil'](_0x599bc3[_0xe8d0('0x15')])){_0x19c3d0[_0xe8d0('0x16')]['findOne']({'where':{'id':_0x599bc3[_0xe8d0('0x17')]}})['then'](function(_0x59b4b7){if(_0x59b4b7){_0x59b4b7[_0xe8d0('0x18')]({'lastMsgAt':_0x599bc3[_0xe8d0('0x19')],'lastMsgDirection':_0x599bc3[_0xe8d0('0x11')][_0xe8d0('0x12')]()});}})[_0xe8d0('0x1a')](function(_0x7151c6){console['error'](_0x7151c6);});}_0x10e56c();}},'charset':_0xe8d0('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 04185aa..12285d1 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 _0x87e3=['stringify','error','message','request\x20sent','result','CreateChatMessage','ChatMessage','create','options','raw','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','register','then','info','ChatMessage,\x20%s,\x20%s'];(function(_0x1ef604,_0x3af47a){var _0x45813c=function(_0x4d5a81){while(--_0x4d5a81){_0x1ef604['push'](_0x1ef604['shift']());}};_0x45813c(++_0x3af47a);}(_0x87e3,0x80));var _0x387e=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x87e3[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0x387e('0x0'));var util=require(_0x387e('0x1'));var moment=require(_0x387e('0x2'));var BPromise=require('bluebird');var rs=require(_0x387e('0x3'));var fs=require('fs');var Redis=require(_0x387e('0x4'));var db=require(_0x387e('0x5'))['db'];var utils=require(_0x387e('0x6'));var logger=require(_0x387e('0x7'))(_0x387e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x387e('0x9')][_0x387e('0xa')]({'port':0x232a});config[_0x387e('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x387e('0xc'))(new Redis(config[_0x387e('0xb')]));require('./chatMessage.socket')[_0x387e('0xd')](socket);function respondWithRpcPromise(_0x4b2a09,_0x4fcda4,_0x5ee4fc){return new BPromise(function(_0x184334,_0x5847ac){return client['request'](_0x4b2a09,_0x5ee4fc)[_0x387e('0xe')](function(_0x51534d){logger[_0x387e('0xf')](_0x387e('0x10'),_0x4fcda4,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4fcda4,'request\x20sent',JSON[_0x387e('0x11')](_0x51534d));if(_0x51534d['error']){if(_0x51534d[_0x387e('0x12')]['code']===0x1f4){logger['error'](_0x387e('0x10'),_0x4fcda4,_0x51534d[_0x387e('0x12')][_0x387e('0x13')]);return _0x5847ac(_0x51534d[_0x387e('0x12')]['message']);}logger['error'](_0x387e('0x10'),_0x4fcda4,_0x51534d['error'][_0x387e('0x13')]);return _0x184334(_0x51534d[_0x387e('0x12')][_0x387e('0x13')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x4fcda4,_0x387e('0x14'));_0x184334(_0x51534d[_0x387e('0x15')][_0x387e('0x13')]);}})['catch'](function(_0x4b3881){logger[_0x387e('0x12')](_0x387e('0x10'),_0x4fcda4,_0x4b3881);_0x5847ac(_0x4b3881);});});}exports[_0x387e('0x16')]=function(_0x5de18d){var _0xc90d5a=this;return new Promise(function(_0x5642e7,_0x207618){return db[_0x387e('0x17')][_0x387e('0x18')](_0x5de18d['body'],{'raw':_0x5de18d[_0x387e('0x19')]?_0x5de18d[_0x387e('0x19')][_0x387e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5969ad){logger[_0x387e('0xf')](_0x387e('0x16'),_0x5de18d);logger[_0x387e('0x1b')](_0x387e('0x16'),_0x5de18d,JSON[_0x387e('0x11')](_0x5969ad));_0x5642e7(_0x5969ad);})[_0x387e('0x1c')](function(_0x16e25b){logger['error'](_0x387e('0x16'),_0x16e25b['message'],_0x5de18d);_0x207618(_0xc90d5a[_0x387e('0x12')](0x1f4,_0x16e25b['message']));});});}; \ No newline at end of file +var _0xc9d2=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b6667,_0x2ec2d9){var _0x2803ad=function(_0x599e94){while(--_0x599e94){_0x3b6667['push'](_0x3b6667['shift']());}};_0x2803ad(++_0x2ec2d9);}(_0xc9d2,0x137));var _0x2c9d=function(_0x405a9f,_0x5d49d8){_0x405a9f=_0x405a9f-0x0;var _0x243149=_0xc9d2[_0x405a9f];return _0x243149;};'use strict';var _=require(_0x2c9d('0x0'));var util=require(_0x2c9d('0x1'));var moment=require(_0x2c9d('0x2'));var BPromise=require(_0x2c9d('0x3'));var rs=require(_0x2c9d('0x4'));var fs=require('fs');var Redis=require(_0x2c9d('0x5'));var db=require(_0x2c9d('0x6'))['db'];var utils=require(_0x2c9d('0x7'));var logger=require(_0x2c9d('0x8'))(_0x2c9d('0x9'));var config=require(_0x2c9d('0xa'));var jayson=require(_0x2c9d('0xb'));var client=jayson['client'][_0x2c9d('0xc')]({'port':0x232a});config[_0x2c9d('0xd')]=_[_0x2c9d('0xe')](config[_0x2c9d('0xd')],{'host':_0x2c9d('0xf'),'port':0x18eb});var socket=require(_0x2c9d('0x10'))(new Redis(config[_0x2c9d('0xd')]));require('./chatMessage.socket')[_0x2c9d('0x11')](socket);function respondWithRpcPromise(_0x46f3da,_0x372f56,_0x2814a8){return new BPromise(function(_0x5bc82d,_0x1c9017){return client[_0x2c9d('0x12')](_0x46f3da,_0x2814a8)[_0x2c9d('0x13')](function(_0x415ff1){logger[_0x2c9d('0x14')](_0x2c9d('0x15'),_0x372f56,_0x2c9d('0x16'));logger[_0x2c9d('0x17')](_0x2c9d('0x18'),_0x372f56,_0x2c9d('0x16'),JSON[_0x2c9d('0x19')](_0x415ff1));if(_0x415ff1[_0x2c9d('0x1a')]){if(_0x415ff1[_0x2c9d('0x1a')][_0x2c9d('0x1b')]===0x1f4){logger['error'](_0x2c9d('0x15'),_0x372f56,_0x415ff1[_0x2c9d('0x1a')][_0x2c9d('0x1c')]);return _0x1c9017(_0x415ff1[_0x2c9d('0x1a')]['message']);}logger[_0x2c9d('0x1a')](_0x2c9d('0x15'),_0x372f56,_0x415ff1[_0x2c9d('0x1a')][_0x2c9d('0x1c')]);return _0x5bc82d(_0x415ff1['error'][_0x2c9d('0x1c')]);}else{logger['info'](_0x2c9d('0x15'),_0x372f56,'request\x20sent');_0x5bc82d(_0x415ff1[_0x2c9d('0x1d')][_0x2c9d('0x1c')]);}})['catch'](function(_0x5d8fbe){logger[_0x2c9d('0x1a')](_0x2c9d('0x15'),_0x372f56,_0x5d8fbe);_0x1c9017(_0x5d8fbe);});});}exports[_0x2c9d('0x1e')]=function(_0x421e3d){var _0x1dce15=this;return new Promise(function(_0x4e7b7d,_0x44e27f){return db['ChatMessage'][_0x2c9d('0x1f')](_0x421e3d[_0x2c9d('0x20')],{'raw':_0x421e3d[_0x2c9d('0x21')]?_0x421e3d['options'][_0x2c9d('0x22')]===undefined?!![]:![]:!![]})[_0x2c9d('0x13')](function(_0x37a5b3){logger[_0x2c9d('0x14')](_0x2c9d('0x1e'),_0x421e3d);logger[_0x2c9d('0x17')](_0x2c9d('0x1e'),_0x421e3d,JSON[_0x2c9d('0x19')](_0x37a5b3));_0x4e7b7d(_0x37a5b3);})[_0x2c9d('0x23')](function(_0x579465){logger['error']('CreateChatMessage',_0x579465[_0x2c9d('0x1c')],_0x421e3d);_0x44e27f(_0x1dce15['error'](0x1f4,_0x579465[_0x2c9d('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a86df78..48d35b2 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 _0x8098=['register','chatMessage:','remove','update','removeListener'];(function(_0x39509b,_0xb0cb44){var _0x3f97ec=function(_0x40fae7){while(--_0x40fae7){_0x39509b['push'](_0x39509b['shift']());}};_0x3f97ec(++_0xb0cb44);}(_0x8098,0x1ba));var _0x8809=function(_0x1feee1,_0x1a261f){_0x1feee1=_0x1feee1-0x0;var _0x39b21a=_0x8098[_0x1feee1];return _0x39b21a;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x8809('0x0'),_0x8809('0x1')];function createListener(_0x4037be,_0x22f28d){return function(_0x3348e0){_0x22f28d['emit'](_0x4037be,_0x3348e0);};}function removeListener(_0x2bb438,_0x1d7425){return function(){ChatMessageEvents[_0x8809('0x2')](_0x2bb438,_0x1d7425);};}exports[_0x8809('0x3')]=function(_0x5804f0){for(var _0xeb811=0x0,_0x2af39c=events['length'];_0xeb811<_0x2af39c;_0xeb811++){var _0x3f4bee=events[_0xeb811];var _0x3fd084=createListener(_0x8809('0x4')+_0x3f4bee,_0x5804f0);ChatMessageEvents['on'](_0x3f4bee,_0x3fd084);}}; \ No newline at end of file +var _0x6dac=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x27b175,_0x35ad4c){var _0x22bd77=function(_0x41e046){while(--_0x41e046){_0x27b175['push'](_0x27b175['shift']());}};_0x22bd77(++_0x35ad4c);}(_0x6dac,0x16e));var _0xc6da=function(_0x2477cf,_0xefe750){_0x2477cf=_0x2477cf-0x0;var _0x42ac3a=_0x6dac[_0x2477cf];return _0x42ac3a;};'use strict';var ChatMessageEvents=require(_0xc6da('0x0'));var events=[_0xc6da('0x1'),_0xc6da('0x2'),_0xc6da('0x3')];function createListener(_0x133ecc,_0x224a52){return function(_0x3391f5){_0x224a52[_0xc6da('0x4')](_0x133ecc,_0x3391f5);};}function removeListener(_0x28663f,_0x338470){return function(){ChatMessageEvents[_0xc6da('0x5')](_0x28663f,_0x338470);};}exports[_0xc6da('0x6')]=function(_0x325f49){for(var _0x5caf49=0x0,_0x1ebd11=events[_0xc6da('0x7')];_0x5caf49<_0x1ebd11;_0x5caf49++){var _0x5a0d8d=events[_0x5caf49];var _0x3047d3=createListener(_0xc6da('0x8')+_0x5a0d8d,_0x325f49);ChatMessageEvents['on'](_0x5a0d8d,_0x3047d3);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f3dbda2..fb36d70 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 _0x1acf=['post','chat','chatmessage:create','create','/:id','update','/:id/accept','accept','put','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated'];(function(_0x4fd832,_0x2e2c1c){var _0x5e4702=function(_0x5db51e){while(--_0x5db51e){_0x4fd832['push'](_0x4fd832['shift']());}};_0x5e4702(++_0x2e2c1c);}(_0x1acf,0xcc));var _0xf1ac=function(_0x4b8444,_0x3e420c){_0x4b8444=_0x4b8444-0x0;var _0x360749=_0x1acf[_0x4b8444];return _0x360749;};'use strict';var multer=require(_0xf1ac('0x0'));var util=require(_0xf1ac('0x1'));var path=require(_0xf1ac('0x2'));var timeout=require(_0xf1ac('0x3'));var express=require(_0xf1ac('0x4'));var router=express[_0xf1ac('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf1ac('0x6'));var interaction=require(_0xf1ac('0x7'));var config=require(_0xf1ac('0x8'));var controller=require(_0xf1ac('0x9'));router[_0xf1ac('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf1ac('0xa')]('/describe',auth[_0xf1ac('0xb')](),controller['describe']);router[_0xf1ac('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf1ac('0xc')]('/',auth[_0xf1ac('0xb')](),interaction['tracked'](_0xf1ac('0xd'),_0xf1ac('0xe')),controller[_0xf1ac('0xf')]);router['put'](_0xf1ac('0x10'),controller[_0xf1ac('0x11')]);router['put'](_0xf1ac('0x12'),auth[_0xf1ac('0xb')](),controller[_0xf1ac('0x13')]);router[_0xf1ac('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xf1ac('0x15')]);router[_0xf1ac('0x16')](_0xf1ac('0x10'),auth[_0xf1ac('0xb')](),controller[_0xf1ac('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd2c1=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','show','post','tracked','chat','chatmessage:create','create','put','update'];(function(_0x368924,_0x14f790){var _0x3236d=function(_0x172452){while(--_0x172452){_0x368924['push'](_0x368924['shift']());}};_0x3236d(++_0x14f790);}(_0xd2c1,0x77));var _0x1d2c=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0xd2c1[_0x40ebff];return _0x40122a;};'use strict';var multer=require('multer');var util=require(_0x1d2c('0x0'));var path=require(_0x1d2c('0x1'));var timeout=require(_0x1d2c('0x2'));var express=require(_0x1d2c('0x3'));var router=express[_0x1d2c('0x4')]();var fs_extra=require(_0x1d2c('0x5'));var auth=require(_0x1d2c('0x6'));var interaction=require(_0x1d2c('0x7'));var config=require(_0x1d2c('0x8'));var controller=require(_0x1d2c('0x9'));router[_0x1d2c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1d2c('0xa')]('/describe',auth[_0x1d2c('0xb')](),controller[_0x1d2c('0xc')]);router[_0x1d2c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1d2c('0xd')]);router[_0x1d2c('0xe')]('/',auth[_0x1d2c('0xb')](),interaction[_0x1d2c('0xf')](_0x1d2c('0x10'),_0x1d2c('0x11')),controller[_0x1d2c('0x12')]);router[_0x1d2c('0x13')]('/:id',controller[_0x1d2c('0x14')]);router['put'](_0x1d2c('0x15'),auth[_0x1d2c('0xb')](),controller[_0x1d2c('0x16')]);router[_0x1d2c('0x13')](_0x1d2c('0x17'),auth['isAuthenticated'](),controller[_0x1d2c('0x18')]);router[_0x1d2c('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x1d2c('0x1a')]);module[_0x1d2c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c29f621..00dbee5 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 _0x8579=['exports','TEXT','medium','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8579,0x147));var _0x9857=function(_0x3601d0,_0x57d96f){_0x3601d0=_0x3601d0-0x0;var _0x4b3dd9=_0x8579[_0x3601d0];return _0x4b3dd9;};'use strict';var Sequelize=require(_0x9857('0x0'));module[_0x9857('0x1')]={'body':{'type':Sequelize[_0x9857('0x2')](_0x9857('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x1ea4=['TEXT','medium','exports'];(function(_0x26c025,_0x14321d){var _0x4f9865=function(_0x45af80){while(--_0x45af80){_0x26c025['push'](_0x26c025['shift']());}};_0x4f9865(++_0x14321d);}(_0x1ea4,0x1b2));var _0x41ea=function(_0x44c243,_0x4be132){_0x44c243=_0x44c243-0x0;var _0x505b0f=_0x1ea4[_0x44c243];return _0x505b0f;};'use strict';var Sequelize=require('sequelize');module[_0x41ea('0x0')]={'body':{'type':Sequelize[_0x41ea('0x1')](_0x41ea('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 6a8875d..003bb8f 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(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x7a54,0x106));var _0x47a5=function(_0x29909c,_0x2d8cd8){_0x29909c=_0x29909c-0x0;var _0x933389=_0x7a54[_0x29909c];return _0x933389;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7a54,0x106));var _0x47a5=function(_0x4354b5,_0x4d9d26){_0x4354b5=_0x4354b5-0x0;var _0x26931a=_0x7a54[_0x4354b5];return _0x26931a;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index ef43c01..a2248c6 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 _0xaab6=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xaab6,0x1e9));var _0x6aab=function(_0x58ef68,_0x275204){_0x58ef68=_0x58ef68-0x0;var _0x169a7f=_0xaab6[_0x58ef68];return _0x169a7f;};'use strict';var _=require(_0x6aab('0x0'));var util=require(_0x6aab('0x1'));var logger=require(_0x6aab('0x2'))(_0x6aab('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6aab('0x4'));var fs=require('fs');var path=require(_0x6aab('0x5'));var rimraf=require(_0x6aab('0x6'));var config=require(_0x6aab('0x7'));var attributes=require('./chatOfflineMessage.attributes');module[_0x6aab('0x8')]=function(_0x3769ea,_0x37e3dc){return _0x3769ea[_0x6aab('0x9')](_0x6aab('0xa'),attributes,{'tableName':_0x6aab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6aab('0xc'),'collate':_0x6aab('0xd')});}; \ No newline at end of file +var _0x8d24=['exports','define','api','moment','bluebird','request-promise','path'];(function(_0x16ba74,_0x2ebcfa){var _0x4333a6=function(_0x13b137){while(--_0x13b137){_0x16ba74['push'](_0x16ba74['shift']());}};_0x4333a6(++_0x2ebcfa);}(_0x8d24,0x11a));var _0x48d2=function(_0x119880,_0x4f291f){_0x119880=_0x119880-0x0;var _0x4a1707=_0x8d24[_0x119880];return _0x4a1707;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x48d2('0x0'));var moment=require(_0x48d2('0x1'));var BPromise=require(_0x48d2('0x2'));var rp=require(_0x48d2('0x3'));var fs=require('fs');var path=require(_0x48d2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module[_0x48d2('0x5')]=function(_0x2285d0,_0x5a9be5){return _0x2285d0[_0x48d2('0x6')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 9b565b1..579a69c 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 _0x2494=['../../config/utils','../../config/environment','client','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x16d57c,_0xdfb50a){var _0x338127=function(_0x3fff1b){while(--_0x3fff1b){_0x16d57c['push'](_0x16d57c['shift']());}};_0x338127(++_0xdfb50a);}(_0x2494,0x82));var _0x4249=function(_0x58b798,_0x2aba38){_0x58b798=_0x58b798-0x0;var _0x214567=_0x2494[_0x58b798];return _0x214567;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var moment=require(_0x4249('0x1'));var BPromise=require(_0x4249('0x2'));var rs=require(_0x4249('0x3'));var fs=require('fs');var Redis=require(_0x4249('0x4'));var db=require(_0x4249('0x5'))['db'];var utils=require(_0x4249('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4249('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4249('0x8')][_0x4249('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed716a,_0x5b1b17,_0x326336){return new BPromise(function(_0x2b7934,_0x21060d){return client['request'](_0xed716a,_0x326336)['then'](function(_0x3efaa6){logger[_0x4249('0xa')](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));logger[_0x4249('0xd')](_0x4249('0xe'),_0x5b1b17,_0x4249('0xc'),JSON['stringify'](_0x3efaa6));if(_0x3efaa6['error']){if(_0x3efaa6[_0x4249('0xf')]['code']===0x1f4){logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6['error'][_0x4249('0x10')]);return _0x21060d(_0x3efaa6[_0x4249('0xf')]['message']);}logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);return _0x2b7934(_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);}else{logger['info'](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));_0x2b7934(_0x3efaa6['result'][_0x4249('0x10')]);}})['catch'](function(_0x501e9c){logger['error'](_0x4249('0xb'),_0x5b1b17,_0x501e9c);_0x21060d(_0x501e9c);});});} \ No newline at end of file +var _0xaf66=['../../config/utils','rpc','../../config/environment','jayson/promise','client','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x803363,_0x4c77bc){var _0x55e30f=function(_0x40def4){while(--_0x40def4){_0x803363['push'](_0x803363['shift']());}};_0x55e30f(++_0x4c77bc);}(_0xaf66,0x7f));var _0x6af6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xaf66[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x6af6('0x0'));var util=require(_0x6af6('0x1'));var moment=require(_0x6af6('0x2'));var BPromise=require(_0x6af6('0x3'));var rs=require(_0x6af6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6af6('0x5'))['db'];var utils=require(_0x6af6('0x6'));var logger=require('../../config/logger')(_0x6af6('0x7'));var config=require(_0x6af6('0x8'));var jayson=require(_0x6af6('0x9'));var client=jayson[_0x6af6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x102ea5,_0xbe04fb,_0x27993c){return new BPromise(function(_0x318904,_0x34d53e){return client['request'](_0x102ea5,_0x27993c)['then'](function(_0xf8fe2){logger[_0x6af6('0xb')](_0x6af6('0xc'),_0xbe04fb,'request\x20sent');logger[_0x6af6('0xd')](_0x6af6('0xe'),_0xbe04fb,'request\x20sent',JSON['stringify'](_0xf8fe2));if(_0xf8fe2[_0x6af6('0xf')]){if(_0xf8fe2[_0x6af6('0xf')]['code']===0x1f4){logger[_0x6af6('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0xbe04fb,_0xf8fe2[_0x6af6('0xf')]['message']);return _0x34d53e(_0xf8fe2[_0x6af6('0xf')][_0x6af6('0x10')]);}logger['error'](_0x6af6('0xc'),_0xbe04fb,_0xf8fe2['error'][_0x6af6('0x10')]);return _0x318904(_0xf8fe2['error'][_0x6af6('0x10')]);}else{logger[_0x6af6('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0xbe04fb,_0x6af6('0x11'));_0x318904(_0xf8fe2['result'][_0x6af6('0x10')]);}})[_0x6af6('0x12')](function(_0x2ee1b2){logger[_0x6af6('0xf')](_0x6af6('0xc'),_0xbe04fb,_0x2ee1b2);_0x34d53e(_0x2ee1b2);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 33bf6cc..25a32d6 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 _0x6d9a=['create','put','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post'];(function(_0x4d6a57,_0x208176){var _0x675523=function(_0x2bf15c){while(--_0x2bf15c){_0x4d6a57['push'](_0x4d6a57['shift']());}};_0x675523(++_0x208176);}(_0x6d9a,0x1a7));var _0xa6d9=function(_0x4a3d52,_0x202cd2){_0x4a3d52=_0x4a3d52-0x0;var _0x4da63f=_0x6d9a[_0x4a3d52];return _0x4da63f;};'use strict';var multer=require(_0xa6d9('0x0'));var util=require(_0xa6d9('0x1'));var path=require(_0xa6d9('0x2'));var timeout=require(_0xa6d9('0x3'));var express=require(_0xa6d9('0x4'));var router=express[_0xa6d9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa6d9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa6d9('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0xa6d9('0x8')]('/',auth[_0xa6d9('0x9')](),controller[_0xa6d9('0xa')]);router[_0xa6d9('0x8')](_0xa6d9('0xb'),auth[_0xa6d9('0x9')](),controller[_0xa6d9('0xc')]);router[_0xa6d9('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa6d9('0xd')]('/',auth['isAuthenticated'](),controller[_0xa6d9('0xe')]);router[_0xa6d9('0xf')]('/:id',auth[_0xa6d9('0x9')](),controller['update']);router[_0xa6d9('0x10')](_0xa6d9('0x11'),auth[_0xa6d9('0x9')](),controller['destroy']);module[_0xa6d9('0x12')]=router; \ No newline at end of file +var _0xc079=['../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','exports','util','express','fs-extra'];(function(_0x13c199,_0x3caddc){var _0x266fab=function(_0x1af803){while(--_0x1af803){_0x13c199['push'](_0x13c199['shift']());}};_0x266fab(++_0x3caddc);}(_0xc079,0x12f));var _0x9c07=function(_0x582a3c,_0x2fd335){_0x582a3c=_0x582a3c-0x0;var _0x34f871=_0xc079[_0x582a3c];return _0x34f871;};'use strict';var multer=require('multer');var util=require(_0x9c07('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9c07('0x1'));var router=express['Router']();var fs_extra=require(_0x9c07('0x2'));var auth=require(_0x9c07('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9c07('0x4'));var controller=require(_0x9c07('0x5'));router[_0x9c07('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9c07('0x6')]('/describe',auth[_0x9c07('0x7')](),controller[_0x9c07('0x8')]);router[_0x9c07('0x6')]('/:id',auth[_0x9c07('0x7')](),controller[_0x9c07('0x9')]);router[_0x9c07('0xa')]('/',auth[_0x9c07('0x7')](),controller[_0x9c07('0xb')]);router[_0x9c07('0xc')](_0x9c07('0xd'),auth[_0x9c07('0x7')](),controller[_0x9c07('0xe')]);router['delete']('/:id',auth[_0x9c07('0x7')](),controller[_0x9c07('0xf')]);module[_0x9c07('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 41ec33a..35447b0 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 _0x3f1e=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x3f1e,0xf9));var _0xe3f1=function(_0x26a0d4,_0x4e402e){_0x26a0d4=_0x26a0d4-0x0;var _0x2302e6=_0x3f1e[_0x26a0d4];return _0x2302e6;};'use strict';var Sequelize=require(_0xe3f1('0x0'));module[_0xe3f1('0x1')]={'name':{'type':Sequelize[_0xe3f1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe3f1('0x3')](_0xe3f1('0x4'),_0xe3f1('0x5')),'defaultValue':_0xe3f1('0x4')},'selector':{'type':Sequelize[_0xe3f1('0x2')]},'timeout':{'type':Sequelize[_0xe3f1('0x6')]}}; \ No newline at end of file +var _0x1050=['timeout','INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0xc3e938,_0x11b0bf){var _0x5360ca=function(_0xc06bf4){while(--_0xc06bf4){_0xc3e938['push'](_0xc3e938['shift']());}};_0x5360ca(++_0x11b0bf);}(_0x1050,0xc8));var _0x0105=function(_0x39049a,_0x2fa775){_0x39049a=_0x39049a-0x0;var _0x2ed061=_0x1050[_0x39049a];return _0x2ed061;};'use strict';var Sequelize=require(_0x0105('0x0'));module[_0x0105('0x1')]={'name':{'type':Sequelize[_0x0105('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0105('0x3'),_0x0105('0x4')),'defaultValue':_0x0105('0x3')},'selector':{'type':Sequelize[_0x0105('0x2')]},'timeout':{'type':Sequelize[_0x0105('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2e862a3..aa5b7f0 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 _0xea89=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x414536,_0x4f9948){var _0x1c17b4=function(_0x2a4557){while(--_0x2a4557){_0x414536['push'](_0x414536['shift']());}};_0x1c17b4(++_0x4f9948);}(_0xea89,0x1e2));var _0x9ea8=function(_0x2ed1a5,_0x897c95){_0x2ed1a5=_0x2ed1a5-0x0;var _0x517528=_0xea89[_0x2ed1a5];return _0x517528;};'use strict';var emlformat=require(_0x9ea8('0x0'));var rimraf=require(_0x9ea8('0x1'));var zipdir=require(_0x9ea8('0x2'));var jsonpatch=require(_0x9ea8('0x3'));var rp=require(_0x9ea8('0x4'));var moment=require('moment');var BPromise=require(_0x9ea8('0x5'));var Mustache=require('mustache');var util=require(_0x9ea8('0x6'));var path=require('path');var sox=require(_0x9ea8('0x7'));var csv=require(_0x9ea8('0x8'));var ejs=require(_0x9ea8('0x9'));var fs=require('fs');var fs_extra=require(_0x9ea8('0xa'));var _=require(_0x9ea8('0xb'));var squel=require(_0x9ea8('0xc'));var crypto=require(_0x9ea8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9ea8('0xe'));var toCsv=require(_0x9ea8('0x8'));var querystring=require('querystring');var Papa=require(_0x9ea8('0xf'));var Redis=require(_0x9ea8('0x10'));var authService=require(_0x9ea8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9ea8('0x12'));var hardwareService=require(_0x9ea8('0x13'));var logger=require(_0x9ea8('0x14'))(_0x9ea8('0x15'));var utils=require(_0x9ea8('0x16'));var config=require(_0x9ea8('0x17'));var licenseUtil=require(_0x9ea8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a38a6,_0x3b5d21){_0x3b5d21=_0x3b5d21||0xcc;return function(_0x148f01){if(_0x148f01){return _0x3a38a6['sendStatus'](_0x3b5d21);}return _0x3a38a6[_0x9ea8('0x19')](_0x3b5d21)[_0x9ea8('0x1a')]();};}function respondWithResult(_0x61f839,_0x1b8bd6){_0x1b8bd6=_0x1b8bd6||0xc8;return function(_0x423c7a){if(_0x423c7a){return _0x61f839[_0x9ea8('0x19')](_0x1b8bd6)[_0x9ea8('0x1b')](_0x423c7a);}};}function respondWithFilteredResult(_0x5866f3,_0x5226d5){return function(_0x205f37){if(_0x205f37){var _0x2e5a7d=typeof _0x5226d5['offset']===_0x9ea8('0x1c')&&typeof _0x5226d5['limit']===_0x9ea8('0x1c');var _0x26de62=_0x205f37[_0x9ea8('0x1d')];var _0x475fcf=_0x2e5a7d?0x0:_0x5226d5[_0x9ea8('0x1e')];var _0xe844a5=_0x2e5a7d?_0x205f37[_0x9ea8('0x1d')]:_0x5226d5['offset']+_0x5226d5[_0x9ea8('0x1f')];var _0x400e8e;if(_0xe844a5>=_0x26de62){_0xe844a5=_0x26de62;_0x400e8e=0xc8;}else{_0x400e8e=0xce;}_0x5866f3[_0x9ea8('0x19')](_0x400e8e);return _0x5866f3[_0x9ea8('0x20')](_0x9ea8('0x21'),_0x475fcf+'-'+_0xe844a5+'/'+_0x26de62)[_0x9ea8('0x1b')](_0x205f37);}return null;};}function patchUpdates(_0x7c7190){return function(_0x3ee7c5){try{jsonpatch[_0x9ea8('0x22')](_0x3ee7c5,_0x7c7190,!![]);}catch(_0x14f411){return BPromise[_0x9ea8('0x23')](_0x14f411);}return _0x3ee7c5['save']();};}function saveUpdates(_0x34c607,_0x4d0098){return function(_0x40451f){if(_0x40451f){return _0x40451f[_0x9ea8('0x24')](_0x34c607)[_0x9ea8('0x25')](function(_0x13d2b7){return _0x13d2b7;});}return null;};}function removeEntity(_0x1bfd77,_0x518662){return function(_0x3a42e1){if(_0x3a42e1){return _0x3a42e1[_0x9ea8('0x26')]()[_0x9ea8('0x25')](function(){_0x1bfd77[_0x9ea8('0x19')](0xcc)[_0x9ea8('0x1a')]();});}};}function handleEntityNotFound(_0x366dd2,_0x2b20b7){return function(_0x4c0a6b){if(!_0x4c0a6b){_0x366dd2['sendStatus'](0x194);}return _0x4c0a6b;};}function handleError(_0x3b3e9f,_0x2d8c9e){_0x2d8c9e=_0x2d8c9e||0x1f4;return function(_0x4f4265){logger[_0x9ea8('0x27')](_0x4f4265[_0x9ea8('0x28')]);if(_0x4f4265[_0x9ea8('0x29')]){delete _0x4f4265['name'];}_0x3b3e9f['status'](_0x2d8c9e)[_0x9ea8('0x2a')](_0x4f4265);};}exports[_0x9ea8('0x2b')]=function(_0x462f2,_0x2543a9){var _0x563a6c={'raw':!![],'where':{'id':_0x462f2[_0x9ea8('0x2c')]['id']}},_0x58878a={};_0x58878a[_0x9ea8('0x2d')]=_[_0x9ea8('0x2e')](db[_0x9ea8('0x2f')][_0x9ea8('0x30')]);_0x58878a[_0x9ea8('0x31')]=_['keys'](_0x462f2[_0x9ea8('0x31')]);_0x58878a[_0x9ea8('0x32')]=_[_0x9ea8('0x33')](_0x58878a[_0x9ea8('0x2d')],_0x58878a[_0x9ea8('0x31')]);_0x563a6c[_0x9ea8('0x34')]=_[_0x9ea8('0x33')](_0x58878a[_0x9ea8('0x2d')],qs[_0x9ea8('0x35')](_0x462f2[_0x9ea8('0x31')][_0x9ea8('0x35')]));_0x563a6c[_0x9ea8('0x34')]=_0x563a6c['attributes']['length']?_0x563a6c[_0x9ea8('0x34')]:_0x58878a['model'];if(_0x462f2[_0x9ea8('0x31')][_0x9ea8('0x36')]){_0x563a6c[_0x9ea8('0x37')]=[{'all':!![]}];}_0x563a6c=_[_0x9ea8('0x38')]({},_0x563a6c,_0x462f2['options']);return db[_0x9ea8('0x2f')][_0x9ea8('0x39')](_0x563a6c)[_0x9ea8('0x25')](handleEntityNotFound(_0x2543a9,null))[_0x9ea8('0x25')](respondWithResult(_0x2543a9,null))[_0x9ea8('0x3a')](handleError(_0x2543a9,null));};exports[_0x9ea8('0x3b')]=function(_0x5d55d5,_0x580b23){return db[_0x9ea8('0x2f')]['create'](_0x5d55d5[_0x9ea8('0x3c')],{})[_0x9ea8('0x25')](respondWithResult(_0x580b23,0xc9))[_0x9ea8('0x3a')](handleError(_0x580b23,null));};exports['update']=function(_0x35b8c4,_0x55c521){if(_0x35b8c4[_0x9ea8('0x3c')]['id']){delete _0x35b8c4[_0x9ea8('0x3c')]['id'];}return db[_0x9ea8('0x2f')][_0x9ea8('0x39')]({'where':{'id':_0x35b8c4[_0x9ea8('0x2c')]['id']}})[_0x9ea8('0x25')](handleEntityNotFound(_0x55c521,null))[_0x9ea8('0x25')](saveUpdates(_0x35b8c4[_0x9ea8('0x3c')],null))[_0x9ea8('0x25')](respondWithResult(_0x55c521,null))[_0x9ea8('0x3a')](handleError(_0x55c521,null));};exports[_0x9ea8('0x26')]=function(_0x3f8005,_0xb3f217){return db['ChatProactiveAction'][_0x9ea8('0x39')]({'where':{'id':_0x3f8005[_0x9ea8('0x2c')]['id']}})[_0x9ea8('0x25')](handleEntityNotFound(_0xb3f217,null))['then'](removeEntity(_0xb3f217,null))['catch'](handleError(_0xb3f217,null));}; \ No newline at end of file +var _0xb4c7=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','include','merge','find','create','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0x563a22,_0x379dc1){var _0x5b9ae3=function(_0x4bd477){while(--_0x4bd477){_0x563a22['push'](_0x563a22['shift']());}};_0x5b9ae3(++_0x379dc1);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1d86d3,_0x2b8e24){_0x1d86d3=_0x1d86d3-0x0;var _0x46f670=_0xb4c7[_0x1d86d3];return _0x46f670;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require('moment');var BPromise=require(_0x7b4c('0x5'));var Mustache=require(_0x7b4c('0x6'));var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require(_0x7b4c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xf'));var querystring=require(_0x7b4c('0x10'));var Papa=require(_0x7b4c('0x11'));var Redis=require(_0x7b4c('0x12'));var authService=require(_0x7b4c('0x13'));var qs=require(_0x7b4c('0x14'));var as=require(_0x7b4c('0x15'));var hardwareService=require(_0x7b4c('0x16'));var logger=require(_0x7b4c('0x17'))(_0x7b4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x19'));var db=require(_0x7b4c('0x1a'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1b')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1c')](_0x1722ad)[_0x7b4c('0x1d')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1c')](_0x387488)[_0x7b4c('0x1e')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=typeof _0x2a0e2f[_0x7b4c('0x1f')]===_0x7b4c('0x20')&&typeof _0x2a0e2f['limit']===_0x7b4c('0x20');var _0xe71d88=_0xa0a812[_0x7b4c('0x21')];var _0x36c02a=_0x2471b3?0x0:_0x2a0e2f['offset'];var _0x3ce10c=_0x2471b3?_0xa0a812[_0x7b4c('0x21')]:_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x22')];var _0x2d4c72;if(_0x3ce10c>=_0xe71d88){_0x3ce10c=_0xe71d88;_0x2d4c72=0xc8;}else{_0x2d4c72=0xce;}_0xdc71cd[_0x7b4c('0x1c')](_0x2d4c72);return _0xdc71cd[_0x7b4c('0x23')](_0x7b4c('0x24'),_0x36c02a+'-'+_0x3ce10c+'/'+_0xe71d88)[_0x7b4c('0x1e')](_0xa0a812);}return null;};}function patchUpdates(_0x55e3df){return function(_0x1f06ec){try{jsonpatch[_0x7b4c('0x25')](_0x1f06ec,_0x55e3df,!![]);}catch(_0x11996d){return BPromise[_0x7b4c('0x26')](_0x11996d);}return _0x1f06ec[_0x7b4c('0x27')]();};}function saveUpdates(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')](_0x168ac9)[_0x7b4c('0x29')](function(_0x5eec1e){return _0x5eec1e;});}return null;};}function removeEntity(_0x45438c,_0x4350c9){return function(_0x276271){if(_0x276271){return _0x276271[_0x7b4c('0x2a')]()[_0x7b4c('0x29')](function(){_0x45438c[_0x7b4c('0x1c')](0xcc)[_0x7b4c('0x1d')]();});}};}function handleEntityNotFound(_0x459eb4,_0x1f311e){return function(_0x1a69db){if(!_0x1a69db){_0x459eb4[_0x7b4c('0x1b')](0x194);}return _0x1a69db;};}function handleError(_0x257da2,_0x316e5f){_0x316e5f=_0x316e5f||0x1f4;return function(_0x501f75){logger[_0x7b4c('0x2b')](_0x501f75[_0x7b4c('0x2c')]);if(_0x501f75[_0x7b4c('0x2d')]){delete _0x501f75[_0x7b4c('0x2d')];}_0x257da2[_0x7b4c('0x1c')](_0x316e5f)[_0x7b4c('0x2e')](_0x501f75);};}exports[_0x7b4c('0x2f')]=function(_0x2552f9,_0x3e4a46){var _0x9a799b={'raw':!![],'where':{'id':_0x2552f9[_0x7b4c('0x30')]['id']}},_0x3585cd={};_0x3585cd[_0x7b4c('0x31')]=_[_0x7b4c('0x32')](db[_0x7b4c('0x33')][_0x7b4c('0x34')]);_0x3585cd[_0x7b4c('0x35')]=_[_0x7b4c('0x32')](_0x2552f9[_0x7b4c('0x35')]);_0x3585cd['filters']=_['intersection'](_0x3585cd['model'],_0x3585cd[_0x7b4c('0x35')]);_0x9a799b[_0x7b4c('0x36')]=_[_0x7b4c('0x37')](_0x3585cd[_0x7b4c('0x31')],qs['fields'](_0x2552f9[_0x7b4c('0x35')][_0x7b4c('0x38')]));_0x9a799b['attributes']=_0x9a799b[_0x7b4c('0x36')]['length']?_0x9a799b[_0x7b4c('0x36')]:_0x3585cd[_0x7b4c('0x31')];if(_0x2552f9[_0x7b4c('0x35')]['includeAll']){_0x9a799b[_0x7b4c('0x39')]=[{'all':!![]}];}_0x9a799b=_[_0x7b4c('0x3a')]({},_0x9a799b,_0x2552f9['options']);return db[_0x7b4c('0x33')][_0x7b4c('0x3b')](_0x9a799b)[_0x7b4c('0x29')](handleEntityNotFound(_0x3e4a46,null))[_0x7b4c('0x29')](respondWithResult(_0x3e4a46,null))['catch'](handleError(_0x3e4a46,null));};exports['create']=function(_0x1325c1,_0x460fd4){return db['ChatProactiveAction'][_0x7b4c('0x3c')](_0x1325c1['body'],{})['then'](respondWithResult(_0x460fd4,0xc9))[_0x7b4c('0x3d')](handleError(_0x460fd4,null));};exports[_0x7b4c('0x28')]=function(_0x39d69a,_0x250901){if(_0x39d69a['body']['id']){delete _0x39d69a[_0x7b4c('0x3e')]['id'];}return db[_0x7b4c('0x33')][_0x7b4c('0x3b')]({'where':{'id':_0x39d69a[_0x7b4c('0x30')]['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x250901,null))[_0x7b4c('0x29')](saveUpdates(_0x39d69a[_0x7b4c('0x3e')],null))['then'](respondWithResult(_0x250901,null))['catch'](handleError(_0x250901,null));};exports[_0x7b4c('0x2a')]=function(_0x37f136,_0x31ef1e){return db[_0x7b4c('0x33')][_0x7b4c('0x3b')]({'where':{'id':_0x37f136['params']['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x31ef1e,null))[_0x7b4c('0x29')](removeEntity(_0x31ef1e,null))[_0x7b4c('0x3d')](handleError(_0x31ef1e,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index f5969e6..db13c72 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 _0xc912=['rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xc912,0x1de));var _0x2c91=function(_0xc8bc13,_0x4daaf4){_0xc8bc13=_0xc8bc13-0x0;var _0x517453=_0xc912[_0xc8bc13];return _0x517453;};'use strict';var _=require('lodash');var util=require(_0x2c91('0x0'));var logger=require(_0x2c91('0x1'))(_0x2c91('0x2'));var moment=require(_0x2c91('0x3'));var BPromise=require(_0x2c91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c91('0x5'));var rimraf=require(_0x2c91('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c91('0x7'));module[_0x2c91('0x8')]=function(_0x4b5c98,_0x596823){return _0x4b5c98['define'](_0x2c91('0x9'),attributes,{'tableName':_0x2c91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28b7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger','api'];(function(_0x3f6dc8,_0x54dea6){var _0x1c5c16=function(_0x3b8d9f){while(--_0x3b8d9f){_0x3f6dc8['push'](_0x3f6dc8['shift']());}};_0x1c5c16(++_0x54dea6);}(_0x28b7,0x11a));var _0x728b=function(_0x182aa3,_0x55cb6c){_0x182aa3=_0x182aa3-0x0;var _0x4bd366=_0x28b7[_0x182aa3];return _0x4bd366;};'use strict';var _=require(_0x728b('0x0'));var util=require(_0x728b('0x1'));var logger=require(_0x728b('0x2'))(_0x728b('0x3'));var moment=require(_0x728b('0x4'));var BPromise=require(_0x728b('0x5'));var rp=require(_0x728b('0x6'));var fs=require('fs');var path=require(_0x728b('0x7'));var rimraf=require(_0x728b('0x8'));var config=require(_0x728b('0x9'));var attributes=require('./chatProactiveAction.attributes');module[_0x728b('0xa')]=function(_0x134544,_0x479ee2){return _0x134544['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 48e3cc7..0beb78f 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 _0xd920=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then'];(function(_0x27933e,_0x3dd9e1){var _0x4647c1=function(_0x3d68ca){while(--_0x3d68ca){_0x27933e['push'](_0x27933e['shift']());}};_0x4647c1(++_0x3dd9e1);}(_0xd920,0x1ee));var _0x0d92=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xd920[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require('lodash');var util=require(_0x0d92('0x0'));var moment=require(_0x0d92('0x1'));var BPromise=require(_0x0d92('0x2'));var rs=require(_0x0d92('0x3'));var fs=require('fs');var Redis=require(_0x0d92('0x4'));var db=require(_0x0d92('0x5'))['db'];var utils=require(_0x0d92('0x6'));var logger=require(_0x0d92('0x7'))('rpc');var config=require(_0x0d92('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d92('0x9')][_0x0d92('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7b69,_0x150f15,_0x178602){return new BPromise(function(_0x120112,_0x4cc7b4){return client['request'](_0x3f7b69,_0x178602)[_0x0d92('0xb')](function(_0x85b97e){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x150f15,_0x0d92('0xc'));logger[_0x0d92('0xd')](_0x0d92('0xe'),_0x150f15,_0x0d92('0xc'),JSON['stringify'](_0x85b97e));if(_0x85b97e['error']){if(_0x85b97e[_0x0d92('0xf')][_0x0d92('0x10')]===0x1f4){logger[_0x0d92('0xf')](_0x0d92('0x11'),_0x150f15,_0x85b97e[_0x0d92('0xf')][_0x0d92('0x12')]);return _0x4cc7b4(_0x85b97e[_0x0d92('0xf')][_0x0d92('0x12')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x150f15,_0x85b97e[_0x0d92('0xf')][_0x0d92('0x12')]);return _0x120112(_0x85b97e[_0x0d92('0xf')]['message']);}else{logger[_0x0d92('0x13')](_0x0d92('0x11'),_0x150f15,_0x0d92('0xc'));_0x120112(_0x85b97e[_0x0d92('0x14')][_0x0d92('0x12')]);}})[_0x0d92('0x15')](function(_0x43961f){logger['error'](_0x0d92('0x11'),_0x150f15,_0x43961f);_0x4cc7b4(_0x43961f);});});} \ No newline at end of file +var _0x36bd=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x438537,_0x4adce6){var _0x2a55d0=function(_0x26e3ad){while(--_0x26e3ad){_0x438537['push'](_0x438537['shift']());}};_0x2a55d0(++_0x4adce6);}(_0x36bd,0x179));var _0xd36b=function(_0x4b24d1,_0x3726b6){_0x4b24d1=_0x4b24d1-0x0;var _0x3221d0=_0x36bd[_0x4b24d1];return _0x3221d0;};'use strict';var _=require(_0xd36b('0x0'));var util=require(_0xd36b('0x1'));var moment=require('moment');var BPromise=require(_0xd36b('0x2'));var rs=require(_0xd36b('0x3'));var fs=require('fs');var Redis=require(_0xd36b('0x4'));var db=require(_0xd36b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd36b('0x6'))('rpc');var config=require(_0xd36b('0x7'));var jayson=require(_0xd36b('0x8'));var client=jayson[_0xd36b('0x9')][_0xd36b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18113e,_0x501b6e,_0x4069fe){return new BPromise(function(_0x26a0d5,_0x5c224f){return client[_0xd36b('0xb')](_0x18113e,_0x4069fe)['then'](function(_0x50ab15){logger[_0xd36b('0xc')](_0xd36b('0xd'),_0x501b6e,_0xd36b('0xe'));logger[_0xd36b('0xf')](_0xd36b('0x10'),_0x501b6e,_0xd36b('0xe'),JSON[_0xd36b('0x11')](_0x50ab15));if(_0x50ab15['error']){if(_0x50ab15[_0xd36b('0x12')][_0xd36b('0x13')]===0x1f4){logger[_0xd36b('0x12')](_0xd36b('0xd'),_0x501b6e,_0x50ab15['error'][_0xd36b('0x14')]);return _0x5c224f(_0x50ab15[_0xd36b('0x12')][_0xd36b('0x14')]);}logger[_0xd36b('0x12')](_0xd36b('0xd'),_0x501b6e,_0x50ab15[_0xd36b('0x12')][_0xd36b('0x14')]);return _0x26a0d5(_0x50ab15[_0xd36b('0x12')][_0xd36b('0x14')]);}else{logger[_0xd36b('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x501b6e,_0xd36b('0xe'));_0x26a0d5(_0x50ab15[_0xd36b('0x15')][_0xd36b('0x14')]);}})[_0xd36b('0x16')](function(_0x3c9f88){logger[_0xd36b('0x12')](_0xd36b('0xd'),_0x501b6e,_0x3c9f88);_0x5c224f(_0x3c9f88);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 1ad47d2..a30fc48 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 _0x5075=['show','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated'];(function(_0x2f94bf,_0x40def6){var _0x3bbac2=function(_0x30654d){while(--_0x30654d){_0x2f94bf['push'](_0x2f94bf['shift']());}};_0x3bbac2(++_0x40def6);}(_0x5075,0x73));var _0x5507=function(_0x164b96,_0x12f735){_0x164b96=_0x164b96-0x0;var _0x5489d9=_0x5075[_0x164b96];return _0x5489d9;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/:id',auth[_0x5507('0xa')](),controller[_0x5507('0xb')]);router['post']('/',auth[_0x5507('0xa')](),controller[_0x5507('0xc')]);router[_0x5507('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')](_0x5507('0x10'),auth[_0x5507('0xa')](),controller['destroy']);module[_0x5507('0x11')]=router; \ No newline at end of file +var _0x5fc3=['create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','show','isAuthenticated'];(function(_0x2157b5,_0x1c39c8){var _0x217a78=function(_0x479b60){while(--_0x479b60){_0x2157b5['push'](_0x2157b5['shift']());}};_0x217a78(++_0x1c39c8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0x5fc3[_0x2c3a88];return _0x4a7925;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x35fc('0xa')]);router['post']('/',auth[_0x35fc('0xb')](),controller[_0x35fc('0xc')]);router[_0x35fc('0xd')](_0x35fc('0xe'),auth[_0x35fc('0xb')](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xb')](),controller[_0x35fc('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a67d520..a1be28a 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 _0xaf53=['name','INTEGER','ENUM','beepall','roundrobin','exports','STRING'];(function(_0x43ce91,_0x591b24){var _0x2b39d3=function(_0x5efc9b){while(--_0x5efc9b){_0x43ce91['push'](_0x43ce91['shift']());}};_0x2b39d3(++_0x591b24);}(_0xaf53,0x14e));var _0x3af5=function(_0x526f25,_0x3f15dd){_0x526f25=_0x526f25-0x0;var _0xfbe7de=_0xaf53[_0x526f25];return _0xfbe7de;};'use strict';var Sequelize=require('sequelize');module[_0x3af5('0x0')]={'name':{'type':Sequelize[_0x3af5('0x1')],'unique':_0x3af5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3af5('0x1')]},'timeout':{'type':Sequelize[_0x3af5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3af5('0x4')]('rrmemory',_0x3af5('0x5'),_0x3af5('0x6'))}}; \ No newline at end of file +var _0xff7e=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5e8821,_0x5a623e){var _0x440c43=function(_0x5cd302){while(--_0x5cd302){_0x5e8821['push'](_0x5e8821['shift']());}};_0x440c43(++_0x5a623e);}(_0xff7e,0xdd));var _0xeff7=function(_0x287902,_0x37fd61){_0x287902=_0x287902-0x0;var _0x500e0a=_0xff7e[_0x287902];return _0x500e0a;};'use strict';var Sequelize=require(_0xeff7('0x0'));module[_0xeff7('0x1')]={'name':{'type':Sequelize[_0xeff7('0x2')],'unique':_0xeff7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeff7('0x2')]},'timeout':{'type':Sequelize[_0xeff7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xeff7('0x5'),_0xeff7('0x6'),_0xeff7('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a0abab3..2c84ff0 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 _0x187f=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','ChatQueues','UserProfileResource','name','send','index','map','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','options','ChatQueue','includeAll','include','show','params','find','body','user','get','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','pick','ChatQueueId','filter','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','%s/%s','getTeams','addTeams','ids','Team','findAll','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','omit','spread','userChatQueue:save','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x30eecc,_0x447e86){var _0x14edd5=function(_0x52b58f){while(--_0x52b58f){_0x30eecc['push'](_0x30eecc['shift']());}};_0x14edd5(++_0x447e86);}(_0x187f,0x83));var _0xf187=function(_0x51d3b0,_0x29df60){_0x51d3b0=_0x51d3b0-0x0;var _0x844274=_0x187f[_0x51d3b0];return _0x844274;};'use strict';var emlformat=require(_0xf187('0x0'));var rimraf=require(_0xf187('0x1'));var zipdir=require(_0xf187('0x2'));var jsonpatch=require(_0xf187('0x3'));var rp=require(_0xf187('0x4'));var moment=require(_0xf187('0x5'));var BPromise=require(_0xf187('0x6'));var Mustache=require(_0xf187('0x7'));var util=require(_0xf187('0x8'));var path=require(_0xf187('0x9'));var sox=require(_0xf187('0xa'));var csv=require(_0xf187('0xb'));var ejs=require(_0xf187('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf187('0xd'));var jsforce=require(_0xf187('0xe'));var deskjs=require(_0xf187('0xf'));var toCsv=require(_0xf187('0xb'));var querystring=require(_0xf187('0x10'));var Papa=require(_0xf187('0x11'));var Redis=require(_0xf187('0x12'));var authService=require(_0xf187('0x13'));var qs=require(_0xf187('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf187('0x15'));var logger=require(_0xf187('0x16'))(_0xf187('0x17'));var utils=require(_0xf187('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf187('0x19'));var db=require(_0xf187('0x1a'))['db'];config[_0xf187('0x1b')]=_['defaults'](config[_0xf187('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf187('0x1b')]));require(_0xf187('0x1c'))[_0xf187('0x1d')](socket);var jayson=require(_0xf187('0x1e'));var client=jayson['client'][_0xf187('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1db2d8,_0x466ea7,_0x4d87d6,_0x422588){return new BPromise(function(_0x3a1575,_0x6ab586){var _0x369dcf=_0x422588||client;return _0x369dcf[_0xf187('0x20')](_0x1db2d8,_0x4d87d6)[_0xf187('0x21')](function(_0x542f2c){logger[_0xf187('0x22')](_0xf187('0x23'),_0x466ea7,_0xf187('0x24'));logger[_0xf187('0x25')](_0xf187('0x26'),_0x466ea7,'request\x20sent',JSON[_0xf187('0x27')](_0x542f2c));if(_0x542f2c['error']){if(_0x542f2c[_0xf187('0x28')][_0xf187('0x29')]===0x1f4){logger[_0xf187('0x28')](_0xf187('0x23'),_0x466ea7,_0x542f2c['error'][_0xf187('0x2a')]);return _0x6ab586(_0x542f2c[_0xf187('0x28')][_0xf187('0x2a')]);}logger[_0xf187('0x28')](_0xf187('0x23'),_0x466ea7,_0x542f2c[_0xf187('0x28')][_0xf187('0x2a')]);return _0x3a1575(_0x542f2c[_0xf187('0x28')][_0xf187('0x2a')]);}else{logger[_0xf187('0x22')](_0xf187('0x23'),_0x466ea7,_0xf187('0x24'));_0x3a1575(_0x542f2c[_0xf187('0x2b')][_0xf187('0x2a')]);}})[_0xf187('0x2c')](function(_0x5763e9){logger[_0xf187('0x28')](_0xf187('0x23'),_0x466ea7,_0x5763e9);_0x6ab586(_0x5763e9);});});}function respondWithStatusCode(_0x4c68c9,_0x15c3fd){_0x15c3fd=_0x15c3fd||0xcc;return function(_0x1a23c0){if(_0x1a23c0){return _0x4c68c9[_0xf187('0x2d')](_0x15c3fd);}return _0x4c68c9[_0xf187('0x2e')](_0x15c3fd)['end']();};}function respondWithResult(_0x1c34fc,_0x8ea8bd){_0x8ea8bd=_0x8ea8bd||0xc8;return function(_0x14fbb4){if(_0x14fbb4){return _0x1c34fc[_0xf187('0x2e')](_0x8ea8bd)[_0xf187('0x2f')](_0x14fbb4);}};}function respondWithFilteredResult(_0x4120ae,_0x5e6aaf){return function(_0x13544f){if(_0x13544f){var _0x3af55b=typeof _0x5e6aaf[_0xf187('0x30')]===_0xf187('0x31')&&typeof _0x5e6aaf[_0xf187('0x32')]===_0xf187('0x31');var _0x1a6181=_0x13544f[_0xf187('0x33')];var _0x4a09e0=_0x3af55b?0x0:_0x5e6aaf[_0xf187('0x30')];var _0x4f94eb=_0x3af55b?_0x13544f['count']:_0x5e6aaf[_0xf187('0x30')]+_0x5e6aaf[_0xf187('0x32')];var _0x367a27;if(_0x4f94eb>=_0x1a6181){_0x4f94eb=_0x1a6181;_0x367a27=0xc8;}else{_0x367a27=0xce;}_0x4120ae['status'](_0x367a27);return _0x4120ae['set'](_0xf187('0x34'),_0x4a09e0+'-'+_0x4f94eb+'/'+_0x1a6181)['json'](_0x13544f);}return null;};}function patchUpdates(_0x45e55b){return function(_0x49d7a9){try{jsonpatch[_0xf187('0x35')](_0x49d7a9,_0x45e55b,!![]);}catch(_0x36a4fa){return BPromise[_0xf187('0x36')](_0x36a4fa);}return _0x49d7a9['save']();};}function saveUpdates(_0x4e975f,_0x1c4e76){return function(_0x18eb9b){if(_0x18eb9b){return _0x18eb9b[_0xf187('0x37')](_0x4e975f)['then'](function(_0x2ba1e8){return _0x2ba1e8;});}return null;};}function removeEntity(_0x190bc1,_0x958e10){return function(_0x132313){if(_0x132313){return _0x132313[_0xf187('0x38')]()[_0xf187('0x21')](function(){var _0x4c2428=_0x132313['get']({'plain':!![]});var _0x4ba5ae=_0xf187('0x39');return db[_0xf187('0x3a')][_0xf187('0x38')]({'where':{'type':_0x4ba5ae,'resourceId':_0x4c2428['id']}})['then'](function(){return _0x132313;});})[_0xf187('0x21')](function(){_0x190bc1[_0xf187('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5794e3,_0x3db7fc){return function(_0x4ce90e){if(!_0x4ce90e){_0x5794e3['sendStatus'](0x194);}return _0x4ce90e;};}function handleError(_0x46ec92,_0x239c4f){_0x239c4f=_0x239c4f||0x1f4;return function(_0x5a6c1d){logger['error'](_0x5a6c1d['stack']);if(_0x5a6c1d[_0xf187('0x3b')]){delete _0x5a6c1d[_0xf187('0x3b')];}_0x46ec92[_0xf187('0x2e')](_0x239c4f)[_0xf187('0x3c')](_0x5a6c1d);};}exports[_0xf187('0x3d')]=function(_0x84f371,_0x5eb5b6){var _0x5f1425={},_0x56231a={},_0x3e3282={'count':0x0,'rows':[]};var _0x12b483=_[_0xf187('0x3e')](db['ChatQueue'][_0xf187('0x3f')],function(_0x48f269){return{'name':_0x48f269['fieldName'],'type':_0x48f269['type']['key']};});_0x56231a[_0xf187('0x40')]=_['map'](_0x12b483,'name');_0x56231a['query']=_[_0xf187('0x41')](_0x84f371[_0xf187('0x42')]);_0x56231a[_0xf187('0x43')]=_[_0xf187('0x44')](_0x56231a[_0xf187('0x40')],_0x56231a[_0xf187('0x42')]);_0x5f1425[_0xf187('0x45')]=_[_0xf187('0x44')](_0x56231a[_0xf187('0x40')],qs[_0xf187('0x46')](_0x84f371[_0xf187('0x42')]['fields']));_0x5f1425[_0xf187('0x45')]=_0x5f1425[_0xf187('0x45')][_0xf187('0x47')]?_0x5f1425[_0xf187('0x45')]:_0x56231a[_0xf187('0x40')];if(!_0x84f371[_0xf187('0x42')]['hasOwnProperty'](_0xf187('0x48'))){_0x5f1425[_0xf187('0x32')]=qs[_0xf187('0x32')](_0x84f371[_0xf187('0x42')][_0xf187('0x32')]);_0x5f1425[_0xf187('0x30')]=qs[_0xf187('0x30')](_0x84f371[_0xf187('0x42')][_0xf187('0x30')]);}_0x5f1425[_0xf187('0x49')]=qs[_0xf187('0x4a')](_0x84f371['query'][_0xf187('0x4a')]);_0x5f1425[_0xf187('0x4b')]=qs['filters'](_['pick'](_0x84f371[_0xf187('0x42')],_0x56231a[_0xf187('0x43')]),_0x12b483);if(_0x84f371[_0xf187('0x42')]['filter']){_0x5f1425['where']=_[_0xf187('0x4c')](_0x5f1425[_0xf187('0x4b')],{'$or':_[_0xf187('0x3e')](_0x12b483,function(_0x3e22a5){if(_0x3e22a5[_0xf187('0x4d')]!==_0xf187('0x4e')){var _0x3cd48c={};_0x3cd48c[_0x3e22a5[_0xf187('0x3b')]]={'$like':'%'+_0x84f371['query']['filter']+'%'};return _0x3cd48c;}})});}_0x5f1425=_['merge']({},_0x5f1425,_0x84f371[_0xf187('0x4f')]);var _0x354d57={'where':_0x5f1425[_0xf187('0x4b')]};return db[_0xf187('0x50')][_0xf187('0x33')](_0x354d57)['then'](function(_0x2b3830){_0x3e3282[_0xf187('0x33')]=_0x2b3830;if(_0x84f371['query'][_0xf187('0x51')]){_0x5f1425[_0xf187('0x52')]=[{'all':!![]}];}return db[_0xf187('0x50')]['findAll'](_0x5f1425);})[_0xf187('0x21')](function(_0x364a6b){_0x3e3282['rows']=_0x364a6b;return _0x3e3282;})[_0xf187('0x21')](respondWithFilteredResult(_0x5eb5b6,_0x5f1425))['catch'](handleError(_0x5eb5b6,null));};exports[_0xf187('0x53')]=function(_0x2f2246,_0x54007c){var _0x10e281={'raw':!![],'where':{'id':_0x2f2246[_0xf187('0x54')]['id']}},_0x34e672={};_0x34e672[_0xf187('0x40')]=_[_0xf187('0x41')](db['ChatQueue'][_0xf187('0x3f')]);_0x34e672[_0xf187('0x42')]=_['keys'](_0x2f2246['query']);_0x34e672['filters']=_[_0xf187('0x44')](_0x34e672[_0xf187('0x40')],_0x34e672[_0xf187('0x42')]);_0x10e281[_0xf187('0x45')]=_[_0xf187('0x44')](_0x34e672[_0xf187('0x40')],qs[_0xf187('0x46')](_0x2f2246['query'][_0xf187('0x46')]));_0x10e281[_0xf187('0x45')]=_0x10e281['attributes'][_0xf187('0x47')]?_0x10e281[_0xf187('0x45')]:_0x34e672[_0xf187('0x40')];if(_0x2f2246['query']['includeAll']){_0x10e281[_0xf187('0x52')]=[{'all':!![]}];}_0x10e281=_[_0xf187('0x4c')]({},_0x10e281,_0x2f2246[_0xf187('0x4f')]);return db[_0xf187('0x50')][_0xf187('0x55')](_0x10e281)['then'](handleEntityNotFound(_0x54007c,null))['then'](respondWithResult(_0x54007c,null))[_0xf187('0x2c')](handleError(_0x54007c,null));};exports['create']=function(_0x38f76a,_0x25a770){return db[_0xf187('0x50')]['create'](_0x38f76a[_0xf187('0x56')],{})[_0xf187('0x21')](function(_0x1eb0a6){var _0x4df0c1=_0x38f76a[_0xf187('0x57')][_0xf187('0x58')]({'plain':!![]});if(!_0x4df0c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4df0c1['role']===_0xf187('0x57')){var _0x14fc18=_0x1eb0a6[_0xf187('0x58')]({'plain':!![]});var _0xf3236f=_0xf187('0x39');return db['UserProfileSection'][_0xf187('0x55')]({'where':{'name':_0xf3236f,'userProfileId':_0x4df0c1[_0xf187('0x59')]},'raw':!![]})[_0xf187('0x21')](function(_0x428046){if(_0x428046&&_0x428046['autoAssociation']===0x0){return db[_0xf187('0x3a')][_0xf187('0x5a')]({'name':_0x14fc18[_0xf187('0x3b')],'resourceId':_0x14fc18['id'],'type':_0x428046[_0xf187('0x3b')],'sectionId':_0x428046['id']},{})['then'](function(){return _0x1eb0a6;});}else{return _0x1eb0a6;}})[_0xf187('0x2c')](function(_0x37f54f){logger[_0xf187('0x28')](_0xf187('0x5b'),_0x37f54f);throw _0x37f54f;});}return _0x1eb0a6;})[_0xf187('0x21')](respondWithResult(_0x25a770,0xc9))['catch'](handleError(_0x25a770,null));};exports['update']=function(_0x3640c6,_0x1479cd){if(_0x3640c6[_0xf187('0x56')]['id']){delete _0x3640c6[_0xf187('0x56')]['id'];}return db[_0xf187('0x50')][_0xf187('0x55')]({'where':{'id':_0x3640c6[_0xf187('0x54')]['id']}})[_0xf187('0x21')](handleEntityNotFound(_0x1479cd,null))['then'](saveUpdates(_0x3640c6[_0xf187('0x56')],null))[_0xf187('0x21')](respondWithResult(_0x1479cd,null))[_0xf187('0x2c')](handleError(_0x1479cd,null));};exports[_0xf187('0x38')]=function(_0x45dc41,_0x1b69e2){return db['ChatQueue'][_0xf187('0x55')]({'where':{'id':_0x45dc41['params']['id']}})[_0xf187('0x21')](handleEntityNotFound(_0x1b69e2,null))[_0xf187('0x21')](removeEntity(_0x1b69e2,null))[_0xf187('0x2c')](handleError(_0x1b69e2,null));};exports[_0xf187('0x5c')]=function(_0x2c0b33,_0x27a6d2){return db[_0xf187('0x50')][_0xf187('0x5c')]()[_0xf187('0x21')](respondWithResult(_0x27a6d2,null))['catch'](handleError(_0x27a6d2,null));};exports[_0xf187('0x5d')]=function(_0x58f267,_0x4e69db,_0x41406e){var _0x4a0038={'raw':!![],'where':{}},_0x32fdb0={},_0x4392a2;return db[_0xf187('0x50')][_0xf187('0x5e')]({'where':{'id':_0x58f267['params']['id']}})['then'](handleEntityNotFound(_0x4e69db,null))[_0xf187('0x21')](function(_0x7d7021){if(_0x7d7021){_0x4392a2=_0x7d7021[_0xf187('0x58')]({'plain':!![]});_0x32fdb0[_0xf187('0x40')]=_[_0xf187('0x41')](db['UserChatQueue'][_0xf187('0x3f')]);_0x32fdb0['query']=_[_0xf187('0x41')](_0x58f267['query']);_0x32fdb0['filters']=_[_0xf187('0x44')](_0x32fdb0[_0xf187('0x40')],_0x32fdb0[_0xf187('0x42')]);_0x4a0038[_0xf187('0x45')]=_[_0xf187('0x44')](_0x32fdb0[_0xf187('0x40')],qs['fields'](_0x58f267['query'][_0xf187('0x46')]));_0x4a0038[_0xf187('0x45')]=_0x4a0038[_0xf187('0x45')][_0xf187('0x47')]?_0x4a0038[_0xf187('0x45')]:_0x32fdb0['model'];if(!_0x58f267['query'][_0xf187('0x5f')](_0xf187('0x48'))){_0x4a0038['limit']=qs[_0xf187('0x32')](_0x58f267[_0xf187('0x42')][_0xf187('0x32')]);_0x4a0038['offset']=qs[_0xf187('0x30')](_0x58f267[_0xf187('0x42')][_0xf187('0x30')]);}_0x4a0038[_0xf187('0x49')]=qs[_0xf187('0x4a')](_0x58f267[_0xf187('0x42')]['sort']);_0x4a0038[_0xf187('0x4b')]=qs['filters'](_[_0xf187('0x60')](_0x58f267[_0xf187('0x42')],_0x32fdb0[_0xf187('0x43')]));_0x4a0038[_0xf187('0x4b')][_0xf187('0x61')]=_0x7d7021['id'];if(_0x58f267[_0xf187('0x42')][_0xf187('0x62')]){_0x4a0038[_0xf187('0x4b')]=_[_0xf187('0x4c')](_0x4a0038[_0xf187('0x4b')],{'$or':_[_0xf187('0x3e')](_0x4a0038[_0xf187('0x45')],function(_0x3bb008){var _0x1da04c={};_0x1da04c[_0x3bb008]={'$like':'%'+_0x58f267['query'][_0xf187('0x62')]+'%'};return _0x1da04c;})});}_0x4a0038=_[_0xf187('0x4c')]({},_0x4a0038,_0x58f267[_0xf187('0x4f')]);return db[_0xf187('0x63')]['findAll'](_0x4a0038);}})[_0xf187('0x21')](function(_0x309ce6){if(_0x309ce6){return db[_0xf187('0x64')][_0xf187('0x65')]({'where':{'id':_[_0xf187('0x3e')](_0x309ce6,_0xf187('0x66')),'role':_0xf187('0x67')},'attributes':['id',_0xf187('0x3b'),_0xf187('0x68'),_0xf187('0x69'),_0xf187('0x6a')]});}})['then'](function(_0x3ac233){if(_0x3ac233){return{'count':_0x3ac233[_0xf187('0x33')],'rows':_[_0xf187('0x3e')](_0x3ac233[_0xf187('0x6b')],function(_0x4946a7){return{'membername':_0x4946a7['name'],'UserId':_0x4946a7['id'],'queue_name':_0x4392a2['name'],'ChatQueueId':_0x4392a2['id'],'interface':util['format'](_0xf187('0x6c'),'SIP',_0x4946a7[_0xf187('0x3b')]),'penalty':0x0,'paused':_0x4946a7[_0xf187('0x68')],'createdAt':_0x4946a7[_0xf187('0x6a')],'updatedAt':_0x4946a7[_0xf187('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf187('0x21')](respondWithFilteredResult(_0x4e69db,_0x4a0038))[_0xf187('0x2c')](handleError(_0x4e69db,null));};exports[_0xf187('0x6d')]=function(_0x27be57,_0x4f1782,_0x590868){var _0x2bd1a8={};var _0x527504={};var _0x1f7327;var _0x1b178b;return db[_0xf187('0x50')][_0xf187('0x5e')]({'where':{'id':_0x27be57['params']['id']}})[_0xf187('0x21')](handleEntityNotFound(_0x4f1782,null))['then'](function(_0x1b3929){if(_0x1b3929){_0x1f7327=_0x1b3929;_0x527504[_0xf187('0x40')]=_[_0xf187('0x41')](db['Team'][_0xf187('0x3f')]);_0x527504['query']=_['keys'](_0x27be57['query']);_0x527504[_0xf187('0x43')]=_[_0xf187('0x44')](_0x527504[_0xf187('0x40')],_0x527504[_0xf187('0x42')]);_0x2bd1a8['attributes']=_[_0xf187('0x44')](_0x527504[_0xf187('0x40')],qs['fields'](_0x27be57[_0xf187('0x42')][_0xf187('0x46')]));_0x2bd1a8[_0xf187('0x45')]=_0x2bd1a8[_0xf187('0x45')][_0xf187('0x47')]?_0x2bd1a8[_0xf187('0x45')]:_0x527504['model'];_0x2bd1a8[_0xf187('0x49')]=qs[_0xf187('0x4a')](_0x27be57[_0xf187('0x42')][_0xf187('0x4a')]);_0x2bd1a8[_0xf187('0x4b')]=qs[_0xf187('0x43')](_[_0xf187('0x60')](_0x27be57[_0xf187('0x42')],_0x527504[_0xf187('0x43')]));if(_0x27be57['query'][_0xf187('0x62')]){_0x2bd1a8[_0xf187('0x4b')]=_[_0xf187('0x4c')](_0x2bd1a8['where'],{'$or':_[_0xf187('0x3e')](_0x2bd1a8[_0xf187('0x45')],function(_0x563641){var _0x28c0db={};_0x28c0db[_0x563641]={'$like':'%'+_0x27be57[_0xf187('0x42')][_0xf187('0x62')]+'%'};return _0x28c0db;})});}_0x2bd1a8=_[_0xf187('0x4c')]({},_0x2bd1a8,_0x27be57[_0xf187('0x4f')]);return _0x1f7327['getTeams'](_0x2bd1a8);}})[_0xf187('0x21')](function(_0x2408fe){if(_0x2408fe){_0x1b178b=_0x2408fe['length'];if(!_0x27be57['query']['hasOwnProperty'](_0xf187('0x48'))){_0x2bd1a8[_0xf187('0x32')]=qs[_0xf187('0x32')](_0x27be57[_0xf187('0x42')][_0xf187('0x32')]);_0x2bd1a8[_0xf187('0x30')]=qs[_0xf187('0x30')](_0x27be57[_0xf187('0x42')]['offset']);}return _0x1f7327[_0xf187('0x6d')](_0x2bd1a8);}})[_0xf187('0x21')](function(_0x392161){if(_0x392161){return _0x392161?{'count':_0x1b178b,'rows':_0x392161}:null;}})[_0xf187('0x21')](respondWithResult(_0x4f1782,null))[_0xf187('0x2c')](handleError(_0x4f1782,null));};exports[_0xf187('0x6e')]=function(_0x50ccb0,_0x11f62a,_0x4fd6a7){var _0x1f1c50=_0x50ccb0[_0xf187('0x56')][_0xf187('0x6f')];return db[_0xf187('0x70')][_0xf187('0x71')]({'where':{'id':_0x1f1c50},'attributes':['id'],'include':[{'model':db[_0xf187('0x64')],'as':_0xf187('0x72'),'attributes':['id',_0xf187('0x3b'),_0xf187('0x73'),'voicePause',_0xf187('0x74')],'raw':!![]}]})[_0xf187('0x21')](function(_0x83a2f9){if(_0x83a2f9){var _0xa324f5=_[_0xf187('0x75')](_0x83a2f9,function(_0x181569){var _0x313afa=_0x181569[_0xf187('0x58')]({'plain':!![]});return _0x313afa[_0xf187('0x72')];});return db['ChatQueue']['find']({'where':{'id':_0x50ccb0[_0xf187('0x54')]['id']}})[_0xf187('0x21')](function(_0x1c4c62){return db[_0xf187('0x76')][_0xf187('0x77')](function(_0x38f4b2){return _0x1c4c62[_0xf187('0x6e')](_0x1f1c50,{'transaction':_0x38f4b2})[_0xf187('0x21')](function(){return BPromise[_0xf187('0x78')](_0xa324f5,function(_0xb2a02b){return db[_0xf187('0x63')][_0xf187('0x79')]({'where':{'UserId':_0xb2a02b['id'],'ChatQueueId':_0x50ccb0[_0xf187('0x54')]['id']},'transaction':_0x38f4b2});});})[_0xf187('0x21')](function(){_0xa324f5['forEach'](function(_0x1dd44d){socket[_0xf187('0x7a')]('userChatQueue:save',{'UserId':_0x1dd44d['id'],'ChatQueueId':_0x1c4c62['id']});});});});});}})[_0xf187('0x21')](respondWithStatusCode(_0x11f62a,null))['catch'](handleError(_0x11f62a,null));};exports[_0xf187('0x7b')]=function(_0x4b4ba2,_0x241b26,_0x105151){return db[_0xf187('0x70')][_0xf187('0x71')]({'where':{'id':_0x4b4ba2[_0xf187('0x42')][_0xf187('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xf187('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x241b26,null))[_0xf187('0x21')](function(_0x1a41f6){var _0x50ae44=_['map'](_0x1a41f6,'id');var _0x3fabb9=[];var _0x4171a3=[];var _0x9d44c8=squel[_0xf187('0x7c')]();_0x9d44c8[_0xf187('0x7d')]('tq.TeamId')[_0xf187('0x7e')]('team_has_chat_queues','tq')[_0xf187('0x7f')](_0xf187('0x80'),'ut',_0xf187('0x81'))[_0xf187('0x4b')](_0xf187('0x82'),_0x4b4ba2['params']['id']);for(var _0x54d7af=0x0;_0x54d7af<_0x1a41f6[_0xf187('0x47')];_0x54d7af+=0x1){let _0x2fa41b=_0x1a41f6[_0x54d7af];for(var _0x3acf00=0x0;_0x3acf00<_0x2fa41b[_0xf187('0x72')][_0xf187('0x47')];_0x3acf00+=0x1){let _0x5d1775=_0x2fa41b[_0xf187('0x72')][_0x3acf00];var _0x37b67c=_0x9d44c8[_0xf187('0x83')]();_0x37b67c[_0xf187('0x4b')]('ut.UserId\x20=\x20?',_0x5d1775['id']);_0x4171a3[_0xf187('0x84')](db['sequelize'][_0xf187('0x42')](_0x37b67c[_0xf187('0x85')](),{'type':db[_0xf187('0x76')][_0xf187('0x86')][_0xf187('0x87')]})[_0xf187('0x21')](function(_0x43d451){if(_0x43d451[_0xf187('0x47')]===0x1){return _0x5d1775['id'];}else{var _0x433d8b=_[_0xf187('0x88')](_[_0xf187('0x3e')](_0x43d451,'TeamId'),function(_0x214f15){return _[_0xf187('0x89')](_0x50ae44,_0x214f15);});if(_0x433d8b){return _0x5d1775['id'];}}}));}}return BPromise[_0xf187('0x8a')](_0x4171a3)['then'](function(_0x3f2f8b){_0x3fabb9=_(_0x3fabb9)[_0xf187('0x8b')](_0x3f2f8b)[_0xf187('0x8c')]()[_0xf187('0x8d')]();return db['ChatQueue']['find']({'where':{'id':_0x4b4ba2['params']['id']}})[_0xf187('0x21')](function(_0x30c8c2){return db['sequelize'][_0xf187('0x77')](function(_0x21cd0c){return _0x30c8c2['removeTeams'](_0x4b4ba2[_0xf187('0x42')]['ids'],{'transaction':_0x21cd0c})[_0xf187('0x21')](function(){if(!_[_0xf187('0x8e')](_0x3fabb9)){return _0x30c8c2[_0xf187('0x8f')](_0x3fabb9,{'transaction':_0x21cd0c});}})[_0xf187('0x21')](function(){_0x3fabb9['forEach'](function(_0x22124e){socket[_0xf187('0x7a')]('userChatQueue:remove',{'UserId':_0x22124e,'ChatQueueId':_0x30c8c2['id']});});});});});});})[_0xf187('0x21')](respondWithStatusCode(_0x241b26,null))[_0xf187('0x2c')](handleError(_0x241b26,null));};exports['addAgents']=function(_0x1aa936,_0x4b5838,_0x4b9724){return db['ChatQueue'][_0xf187('0x55')]({'where':{'id':_0x1aa936[_0xf187('0x54')]['id']}})[_0xf187('0x21')](handleEntityNotFound(_0x4b5838,null))[_0xf187('0x21')](function(_0x364898){if(_0x364898){return _0x364898['addAgents'](_0x1aa936['body'][_0xf187('0x6f')],_[_0xf187('0x90')](_0x1aa936[_0xf187('0x56')],['ids','id'])||{})[_0xf187('0x91')](function(_0x33ae49){for(var _0x1416df=0x0;_0x1416df<_0x1aa936[_0xf187('0x56')][_0xf187('0x6f')][_0xf187('0x47')];_0x1416df+=0x1){socket['emit'](_0xf187('0x92'),{'UserId':Number(_0x1aa936[_0xf187('0x56')][_0xf187('0x6f')][_0x1416df]),'ChatQueueId':Number(_0x1aa936[_0xf187('0x54')]['id'])});}return _0x33ae49;});}})[_0xf187('0x21')](respondWithResult(_0x4b5838,null))['catch'](handleError(_0x4b5838,null));};exports['removeAgents']=function(_0x538d09,_0x93817a,_0x42656f){return db[_0xf187('0x50')]['find']({'where':{'id':_0x538d09[_0xf187('0x54')]['id']}})['then'](handleEntityNotFound(_0x93817a,null))[_0xf187('0x21')](function(_0x86b6d8){if(_0x86b6d8){return _0x86b6d8['removeAgents'](_0x538d09['query'][_0xf187('0x6f')])[_0xf187('0x21')](function(){if(_[_0xf187('0x93')](_0x538d09[_0xf187('0x42')][_0xf187('0x6f')])){for(var _0x1de5b5=0x0;_0x1de5b5<_0x538d09['query'][_0xf187('0x6f')][_0xf187('0x47')];_0x1de5b5+=0x1){socket['emit'](_0xf187('0x94'),{'UserId':Number(_0x538d09[_0xf187('0x42')][_0xf187('0x6f')][_0x1de5b5]),'ChatQueueId':Number(_0x538d09[_0xf187('0x54')]['id'])});}}else{socket[_0xf187('0x7a')](_0xf187('0x94'),{'UserId':Number(_0x538d09[_0xf187('0x42')][_0xf187('0x6f')]),'ChatQueueId':Number(_0x538d09[_0xf187('0x54')]['id'])});}});}})[_0xf187('0x21')](respondWithStatusCode(_0x93817a,null))[_0xf187('0x2c')](handleError(_0x93817a,null));};exports[_0xf187('0x95')]=function(_0x526463,_0x1b0596,_0x16c34a){var _0x4a5523={};var _0x8e52b8={};var _0x2584fa;var _0x318237;return db[_0xf187('0x50')][_0xf187('0x5e')]({'where':{'id':_0x526463[_0xf187('0x54')]['id']}})[_0xf187('0x21')](handleEntityNotFound(_0x1b0596,null))[_0xf187('0x21')](function(_0x191fc0){if(_0x191fc0){_0x2584fa=_0x191fc0;_0x8e52b8[_0xf187('0x40')]=_['keys'](db[_0xf187('0x64')][_0xf187('0x3f')]);_0x8e52b8[_0xf187('0x42')]=_['keys'](_0x526463[_0xf187('0x42')]);_0x8e52b8[_0xf187('0x43')]=_[_0xf187('0x44')](_0x8e52b8[_0xf187('0x40')],_0x8e52b8[_0xf187('0x42')]);_0x4a5523['attributes']=_[_0xf187('0x44')](_0x8e52b8[_0xf187('0x40')],qs[_0xf187('0x46')](_0x526463[_0xf187('0x42')]['fields']));_0x4a5523['attributes']=_0x4a5523[_0xf187('0x45')][_0xf187('0x47')]?_0x4a5523[_0xf187('0x45')]:_0x8e52b8[_0xf187('0x40')];_0x4a5523['order']=qs[_0xf187('0x4a')](_0x526463[_0xf187('0x42')][_0xf187('0x4a')]);_0x4a5523[_0xf187('0x4b')]=qs[_0xf187('0x43')](_[_0xf187('0x60')](_0x526463[_0xf187('0x42')],_0x8e52b8[_0xf187('0x43')]));if(_0x526463[_0xf187('0x42')][_0xf187('0x62')]){_0x4a5523['where']=_[_0xf187('0x4c')](_0x4a5523[_0xf187('0x4b')],{'$or':_[_0xf187('0x3e')](_0x4a5523[_0xf187('0x45')],function(_0x3d5403){var _0x4525ff={};_0x4525ff[_0x3d5403]={'$like':'%'+_0x526463[_0xf187('0x42')]['filter']+'%'};return _0x4525ff;})});}_0x4a5523=_['merge']({},_0x4a5523,_0x526463[_0xf187('0x4f')]);return _0x2584fa[_0xf187('0x95')](_0x4a5523);}})[_0xf187('0x21')](function(_0x4a2553){if(_0x4a2553){_0x318237=_0x4a2553[_0xf187('0x47')];if(!_0x526463[_0xf187('0x42')][_0xf187('0x5f')]('nolimit')){_0x4a5523[_0xf187('0x32')]=qs[_0xf187('0x32')](_0x526463[_0xf187('0x42')][_0xf187('0x32')]);_0x4a5523[_0xf187('0x30')]=qs[_0xf187('0x30')](_0x526463['query'][_0xf187('0x30')]);}return _0x2584fa[_0xf187('0x95')](_0x4a5523);}})['then'](function(_0x512c25){if(_0x512c25){return _0x512c25?{'count':_0x318237,'rows':_0x512c25}:null;}})[_0xf187('0x21')](respondWithResult(_0x1b0596,null))[_0xf187('0x2c')](handleError(_0x1b0596,null));}; \ No newline at end of file +var _0x4011=['%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userChatQueue:save','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','userChatQueue:remove','addAgents','spread','removeAgents','getAgents','findOne','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatQueue.socket','register','jayson/promise','client','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','get','UserProfileResource','name','index','map','ChatQueue','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserChatQueue','hasOwnProperty','pick','User','UserId','chatPause','createdAt','format'];(function(_0x1441a3,_0x2cf7e9){var _0x192769=function(_0x2560f2){while(--_0x2560f2){_0x1441a3['push'](_0x1441a3['shift']());}};_0x192769(++_0x2cf7e9);}(_0x4011,0x1d2));var _0x1401=function(_0x4ebf3a,_0x26377e){_0x4ebf3a=_0x4ebf3a-0x0;var _0x3811d9=_0x4011[_0x4ebf3a];return _0x3811d9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1401('0x0'));var jsonpatch=require(_0x1401('0x1'));var rp=require(_0x1401('0x2'));var moment=require(_0x1401('0x3'));var BPromise=require(_0x1401('0x4'));var Mustache=require(_0x1401('0x5'));var util=require('util');var path=require(_0x1401('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1401('0x7'));var _=require(_0x1401('0x8'));var squel=require('squel');var crypto=require(_0x1401('0x9'));var jsforce=require(_0x1401('0xa'));var deskjs=require(_0x1401('0xb'));var toCsv=require(_0x1401('0xc'));var querystring=require(_0x1401('0xd'));var Papa=require(_0x1401('0xe'));var Redis=require('ioredis');var authService=require(_0x1401('0xf'));var qs=require(_0x1401('0x10'));var as=require(_0x1401('0x11'));var hardwareService=require(_0x1401('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1401('0x13'));var config=require(_0x1401('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1401('0x15'))['db'];config[_0x1401('0x16')]=_['defaults'](config[_0x1401('0x16')],{'host':_0x1401('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1401('0x16')]));require(_0x1401('0x18'))[_0x1401('0x19')](socket);var jayson=require(_0x1401('0x1a'));var client=jayson[_0x1401('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x699fb,_0x39229e,_0x502710,_0x231a94){return new BPromise(function(_0x9fda03,_0x58829d){var _0x525999=_0x231a94||client;return _0x525999[_0x1401('0x1c')](_0x699fb,_0x502710)[_0x1401('0x1d')](function(_0x238a6a){logger[_0x1401('0x1e')](_0x1401('0x1f'),_0x39229e,'request\x20sent');logger['debug'](_0x1401('0x20'),_0x39229e,'request\x20sent',JSON[_0x1401('0x21')](_0x238a6a));if(_0x238a6a[_0x1401('0x22')]){if(_0x238a6a[_0x1401('0x22')][_0x1401('0x23')]===0x1f4){logger[_0x1401('0x22')]('ChatQueue,\x20%s,\x20%s',_0x39229e,_0x238a6a[_0x1401('0x22')]['message']);return _0x58829d(_0x238a6a[_0x1401('0x22')][_0x1401('0x24')]);}logger[_0x1401('0x22')](_0x1401('0x1f'),_0x39229e,_0x238a6a[_0x1401('0x22')][_0x1401('0x24')]);return _0x9fda03(_0x238a6a[_0x1401('0x22')][_0x1401('0x24')]);}else{logger[_0x1401('0x1e')](_0x1401('0x1f'),_0x39229e,'request\x20sent');_0x9fda03(_0x238a6a[_0x1401('0x25')]['message']);}})[_0x1401('0x26')](function(_0x153fb1){logger[_0x1401('0x22')]('ChatQueue,\x20%s,\x20%s',_0x39229e,_0x153fb1);_0x58829d(_0x153fb1);});});}function respondWithStatusCode(_0x150d5d,_0x29aff2){_0x29aff2=_0x29aff2||0xcc;return function(_0x4ea5cb){if(_0x4ea5cb){return _0x150d5d[_0x1401('0x27')](_0x29aff2);}return _0x150d5d['status'](_0x29aff2)[_0x1401('0x28')]();};}function respondWithResult(_0x40dce9,_0x365366){_0x365366=_0x365366||0xc8;return function(_0x30c433){if(_0x30c433){return _0x40dce9[_0x1401('0x29')](_0x365366)['json'](_0x30c433);}};}function respondWithFilteredResult(_0x544f56,_0x3e27a8){return function(_0x2f3214){if(_0x2f3214){var _0x2f0a71=typeof _0x3e27a8[_0x1401('0x2a')]===_0x1401('0x2b')&&typeof _0x3e27a8[_0x1401('0x2c')]==='undefined';var _0x2bbff2=_0x2f3214[_0x1401('0x2d')];var _0x12ea3f=_0x2f0a71?0x0:_0x3e27a8[_0x1401('0x2a')];var _0x56c486=_0x2f0a71?_0x2f3214[_0x1401('0x2d')]:_0x3e27a8[_0x1401('0x2a')]+_0x3e27a8['limit'];var _0x5304ac;if(_0x56c486>=_0x2bbff2){_0x56c486=_0x2bbff2;_0x5304ac=0xc8;}else{_0x5304ac=0xce;}_0x544f56[_0x1401('0x29')](_0x5304ac);return _0x544f56['set'](_0x1401('0x2e'),_0x12ea3f+'-'+_0x56c486+'/'+_0x2bbff2)['json'](_0x2f3214);}return null;};}function patchUpdates(_0x24d848){return function(_0x57649c){try{jsonpatch[_0x1401('0x2f')](_0x57649c,_0x24d848,!![]);}catch(_0x725ca4){return BPromise['reject'](_0x725ca4);}return _0x57649c[_0x1401('0x30')]();};}function saveUpdates(_0x29e860,_0x33522c){return function(_0x3c6857){if(_0x3c6857){return _0x3c6857[_0x1401('0x31')](_0x29e860)['then'](function(_0x51040f){return _0x51040f;});}return null;};}function removeEntity(_0xd15f8b,_0x3848a6){return function(_0x541de8){if(_0x541de8){return _0x541de8[_0x1401('0x32')]()[_0x1401('0x1d')](function(){var _0x46e170=_0x541de8[_0x1401('0x33')]({'plain':!![]});var _0x53372d='ChatQueues';return db[_0x1401('0x34')][_0x1401('0x32')]({'where':{'type':_0x53372d,'resourceId':_0x46e170['id']}})[_0x1401('0x1d')](function(){return _0x541de8;});})['then'](function(){_0xd15f8b[_0x1401('0x29')](0xcc)[_0x1401('0x28')]();});}};}function handleEntityNotFound(_0x5ef8d5,_0x4b8c18){return function(_0xcb1da6){if(!_0xcb1da6){_0x5ef8d5[_0x1401('0x27')](0x194);}return _0xcb1da6;};}function handleError(_0x3108d8,_0x26dffc){_0x26dffc=_0x26dffc||0x1f4;return function(_0x4dc043){logger[_0x1401('0x22')](_0x4dc043['stack']);if(_0x4dc043['name']){delete _0x4dc043[_0x1401('0x35')];}_0x3108d8[_0x1401('0x29')](_0x26dffc)['send'](_0x4dc043);};}exports[_0x1401('0x36')]=function(_0x36f982,_0x29c1eb){var _0x1a89ac={},_0xac5cc1={},_0x23d272={'count':0x0,'rows':[]};var _0x35755d=_[_0x1401('0x37')](db[_0x1401('0x38')][_0x1401('0x39')],function(_0x121d15){return{'name':_0x121d15['fieldName'],'type':_0x121d15[_0x1401('0x3a')][_0x1401('0x3b')]};});_0xac5cc1[_0x1401('0x3c')]=_[_0x1401('0x37')](_0x35755d,_0x1401('0x35'));_0xac5cc1[_0x1401('0x3d')]=_[_0x1401('0x3e')](_0x36f982['query']);_0xac5cc1['filters']=_[_0x1401('0x3f')](_0xac5cc1[_0x1401('0x3c')],_0xac5cc1['query']);_0x1a89ac[_0x1401('0x40')]=_[_0x1401('0x3f')](_0xac5cc1['model'],qs[_0x1401('0x41')](_0x36f982[_0x1401('0x3d')][_0x1401('0x41')]));_0x1a89ac['attributes']=_0x1a89ac[_0x1401('0x40')][_0x1401('0x42')]?_0x1a89ac[_0x1401('0x40')]:_0xac5cc1[_0x1401('0x3c')];if(!_0x36f982[_0x1401('0x3d')]['hasOwnProperty']('nolimit')){_0x1a89ac[_0x1401('0x2c')]=qs[_0x1401('0x2c')](_0x36f982['query'][_0x1401('0x2c')]);_0x1a89ac[_0x1401('0x2a')]=qs[_0x1401('0x2a')](_0x36f982[_0x1401('0x3d')]['offset']);}_0x1a89ac[_0x1401('0x43')]=qs[_0x1401('0x44')](_0x36f982[_0x1401('0x3d')][_0x1401('0x44')]);_0x1a89ac['where']=qs[_0x1401('0x45')](_['pick'](_0x36f982['query'],_0xac5cc1[_0x1401('0x45')]),_0x35755d);if(_0x36f982['query']['filter']){_0x1a89ac[_0x1401('0x46')]=_[_0x1401('0x47')](_0x1a89ac['where'],{'$or':_[_0x1401('0x37')](_0x35755d,function(_0x2ace59){if(_0x2ace59[_0x1401('0x3a')]!==_0x1401('0x48')){var _0x497506={};_0x497506[_0x2ace59['name']]={'$like':'%'+_0x36f982[_0x1401('0x3d')][_0x1401('0x49')]+'%'};return _0x497506;}})});}_0x1a89ac=_[_0x1401('0x47')]({},_0x1a89ac,_0x36f982[_0x1401('0x4a')]);var _0x368bf3={'where':_0x1a89ac[_0x1401('0x46')]};return db[_0x1401('0x38')][_0x1401('0x2d')](_0x368bf3)[_0x1401('0x1d')](function(_0x2819c5){_0x23d272[_0x1401('0x2d')]=_0x2819c5;if(_0x36f982[_0x1401('0x3d')][_0x1401('0x4b')]){_0x1a89ac[_0x1401('0x4c')]=[{'all':!![]}];}return db[_0x1401('0x38')][_0x1401('0x4d')](_0x1a89ac);})[_0x1401('0x1d')](function(_0x16b43c){_0x23d272[_0x1401('0x4e')]=_0x16b43c;return _0x23d272;})[_0x1401('0x1d')](respondWithFilteredResult(_0x29c1eb,_0x1a89ac))[_0x1401('0x26')](handleError(_0x29c1eb,null));};exports[_0x1401('0x4f')]=function(_0x2e5591,_0x313802){var _0x1a4cea={'raw':!![],'where':{'id':_0x2e5591['params']['id']}},_0x53423c={};_0x53423c[_0x1401('0x3c')]=_[_0x1401('0x3e')](db[_0x1401('0x38')][_0x1401('0x39')]);_0x53423c[_0x1401('0x3d')]=_[_0x1401('0x3e')](_0x2e5591['query']);_0x53423c[_0x1401('0x45')]=_[_0x1401('0x3f')](_0x53423c[_0x1401('0x3c')],_0x53423c[_0x1401('0x3d')]);_0x1a4cea[_0x1401('0x40')]=_[_0x1401('0x3f')](_0x53423c['model'],qs[_0x1401('0x41')](_0x2e5591[_0x1401('0x3d')][_0x1401('0x41')]));_0x1a4cea['attributes']=_0x1a4cea['attributes'][_0x1401('0x42')]?_0x1a4cea[_0x1401('0x40')]:_0x53423c[_0x1401('0x3c')];if(_0x2e5591[_0x1401('0x3d')][_0x1401('0x4b')]){_0x1a4cea[_0x1401('0x4c')]=[{'all':!![]}];}_0x1a4cea=_[_0x1401('0x47')]({},_0x1a4cea,_0x2e5591[_0x1401('0x4a')]);return db[_0x1401('0x38')][_0x1401('0x50')](_0x1a4cea)[_0x1401('0x1d')](handleEntityNotFound(_0x313802,null))[_0x1401('0x1d')](respondWithResult(_0x313802,null))['catch'](handleError(_0x313802,null));};exports['create']=function(_0x238a43,_0x24717c){return db[_0x1401('0x38')]['create'](_0x238a43[_0x1401('0x51')],{})['then'](function(_0xdfaf9b){var _0x2a4066=_0x238a43[_0x1401('0x52')][_0x1401('0x33')]({'plain':!![]});if(!_0x2a4066)throw new Error(_0x1401('0x53'));if(_0x2a4066[_0x1401('0x54')]===_0x1401('0x52')){var _0x2c16d0=_0xdfaf9b[_0x1401('0x33')]({'plain':!![]});var _0x3e6cdc=_0x1401('0x55');return db[_0x1401('0x56')][_0x1401('0x50')]({'where':{'name':_0x3e6cdc,'userProfileId':_0x2a4066[_0x1401('0x57')]},'raw':!![]})['then'](function(_0x20743e){if(_0x20743e&&_0x20743e[_0x1401('0x58')]===0x0){return db[_0x1401('0x34')][_0x1401('0x59')]({'name':_0x2c16d0['name'],'resourceId':_0x2c16d0['id'],'type':_0x20743e[_0x1401('0x35')],'sectionId':_0x20743e['id']},{})[_0x1401('0x1d')](function(){return _0xdfaf9b;});}else{return _0xdfaf9b;}})[_0x1401('0x26')](function(_0x787604){logger['error'](_0x1401('0x5a'),_0x787604);throw _0x787604;});}return _0xdfaf9b;})[_0x1401('0x1d')](respondWithResult(_0x24717c,0xc9))[_0x1401('0x26')](handleError(_0x24717c,null));};exports[_0x1401('0x31')]=function(_0x360a4e,_0x4d9874){if(_0x360a4e['body']['id']){delete _0x360a4e['body']['id'];}return db[_0x1401('0x38')][_0x1401('0x50')]({'where':{'id':_0x360a4e['params']['id']}})['then'](handleEntityNotFound(_0x4d9874,null))[_0x1401('0x1d')](saveUpdates(_0x360a4e[_0x1401('0x51')],null))[_0x1401('0x1d')](respondWithResult(_0x4d9874,null))[_0x1401('0x26')](handleError(_0x4d9874,null));};exports['destroy']=function(_0x7f5095,_0x6c9d6c){return db['ChatQueue'][_0x1401('0x50')]({'where':{'id':_0x7f5095[_0x1401('0x5b')]['id']}})[_0x1401('0x1d')](handleEntityNotFound(_0x6c9d6c,null))[_0x1401('0x1d')](removeEntity(_0x6c9d6c,null))[_0x1401('0x26')](handleError(_0x6c9d6c,null));};exports[_0x1401('0x5c')]=function(_0x10e994,_0x2780af){return db['ChatQueue']['describe']()[_0x1401('0x1d')](respondWithResult(_0x2780af,null))[_0x1401('0x26')](handleError(_0x2780af,null));};exports[_0x1401('0x5d')]=function(_0x2ffa58,_0x5a6baf,_0x576b3a){var _0x435efc={'raw':!![],'where':{}},_0x257b8={},_0x3d6a1e;return db[_0x1401('0x38')]['findOne']({'where':{'id':_0x2ffa58[_0x1401('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5a6baf,null))[_0x1401('0x1d')](function(_0x4ad019){if(_0x4ad019){_0x3d6a1e=_0x4ad019[_0x1401('0x33')]({'plain':!![]});_0x257b8[_0x1401('0x3c')]=_[_0x1401('0x3e')](db[_0x1401('0x5e')][_0x1401('0x39')]);_0x257b8[_0x1401('0x3d')]=_['keys'](_0x2ffa58['query']);_0x257b8['filters']=_[_0x1401('0x3f')](_0x257b8[_0x1401('0x3c')],_0x257b8['query']);_0x435efc['attributes']=_[_0x1401('0x3f')](_0x257b8[_0x1401('0x3c')],qs[_0x1401('0x41')](_0x2ffa58['query'][_0x1401('0x41')]));_0x435efc[_0x1401('0x40')]=_0x435efc[_0x1401('0x40')][_0x1401('0x42')]?_0x435efc[_0x1401('0x40')]:_0x257b8[_0x1401('0x3c')];if(!_0x2ffa58[_0x1401('0x3d')][_0x1401('0x5f')]('nolimit')){_0x435efc[_0x1401('0x2c')]=qs[_0x1401('0x2c')](_0x2ffa58[_0x1401('0x3d')][_0x1401('0x2c')]);_0x435efc['offset']=qs[_0x1401('0x2a')](_0x2ffa58[_0x1401('0x3d')][_0x1401('0x2a')]);}_0x435efc['order']=qs[_0x1401('0x44')](_0x2ffa58['query']['sort']);_0x435efc[_0x1401('0x46')]=qs[_0x1401('0x45')](_[_0x1401('0x60')](_0x2ffa58[_0x1401('0x3d')],_0x257b8[_0x1401('0x45')]));_0x435efc[_0x1401('0x46')]['ChatQueueId']=_0x4ad019['id'];if(_0x2ffa58[_0x1401('0x3d')]['filter']){_0x435efc[_0x1401('0x46')]=_[_0x1401('0x47')](_0x435efc[_0x1401('0x46')],{'$or':_[_0x1401('0x37')](_0x435efc[_0x1401('0x40')],function(_0x2d2f78){var _0x530844={};_0x530844[_0x2d2f78]={'$like':'%'+_0x2ffa58[_0x1401('0x3d')][_0x1401('0x49')]+'%'};return _0x530844;})});}_0x435efc=_['merge']({},_0x435efc,_0x2ffa58[_0x1401('0x4a')]);return db[_0x1401('0x5e')][_0x1401('0x4d')](_0x435efc);}})['then'](function(_0x232831){if(_0x232831){return db[_0x1401('0x61')]['findAndCountAll']({'where':{'id':_[_0x1401('0x37')](_0x232831,_0x1401('0x62')),'role':'agent'},'attributes':['id','name',_0x1401('0x63'),'updatedAt',_0x1401('0x64')]});}})[_0x1401('0x1d')](function(_0x3ddb18){if(_0x3ddb18){return{'count':_0x3ddb18[_0x1401('0x2d')],'rows':_[_0x1401('0x37')](_0x3ddb18['rows'],function(_0x34c8c6){return{'membername':_0x34c8c6[_0x1401('0x35')],'UserId':_0x34c8c6['id'],'queue_name':_0x3d6a1e[_0x1401('0x35')],'ChatQueueId':_0x3d6a1e['id'],'interface':util[_0x1401('0x65')](_0x1401('0x66'),_0x1401('0x67'),_0x34c8c6[_0x1401('0x35')]),'penalty':0x0,'paused':_0x34c8c6[_0x1401('0x63')],'createdAt':_0x34c8c6[_0x1401('0x64')],'updatedAt':_0x34c8c6[_0x1401('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1401('0x1d')](respondWithFilteredResult(_0x5a6baf,_0x435efc))[_0x1401('0x26')](handleError(_0x5a6baf,null));};exports[_0x1401('0x69')]=function(_0x3fb95e,_0x5aedb2,_0x5ab5a5){var _0x232494={};var _0x59a952={};var _0x22c27c;var _0x58657d;return db[_0x1401('0x38')]['findOne']({'where':{'id':_0x3fb95e[_0x1401('0x5b')]['id']}})[_0x1401('0x1d')](handleEntityNotFound(_0x5aedb2,null))[_0x1401('0x1d')](function(_0x1a7697){if(_0x1a7697){_0x22c27c=_0x1a7697;_0x59a952['model']=_[_0x1401('0x3e')](db[_0x1401('0x6a')][_0x1401('0x39')]);_0x59a952[_0x1401('0x3d')]=_['keys'](_0x3fb95e[_0x1401('0x3d')]);_0x59a952['filters']=_['intersection'](_0x59a952[_0x1401('0x3c')],_0x59a952[_0x1401('0x3d')]);_0x232494[_0x1401('0x40')]=_[_0x1401('0x3f')](_0x59a952[_0x1401('0x3c')],qs['fields'](_0x3fb95e[_0x1401('0x3d')]['fields']));_0x232494[_0x1401('0x40')]=_0x232494[_0x1401('0x40')]['length']?_0x232494[_0x1401('0x40')]:_0x59a952[_0x1401('0x3c')];_0x232494[_0x1401('0x43')]=qs['sort'](_0x3fb95e['query'][_0x1401('0x44')]);_0x232494[_0x1401('0x46')]=qs[_0x1401('0x45')](_[_0x1401('0x60')](_0x3fb95e[_0x1401('0x3d')],_0x59a952['filters']));if(_0x3fb95e['query'][_0x1401('0x49')]){_0x232494[_0x1401('0x46')]=_['merge'](_0x232494[_0x1401('0x46')],{'$or':_['map'](_0x232494[_0x1401('0x40')],function(_0x45c951){var _0x1e96ce={};_0x1e96ce[_0x45c951]={'$like':'%'+_0x3fb95e[_0x1401('0x3d')][_0x1401('0x49')]+'%'};return _0x1e96ce;})});}_0x232494=_[_0x1401('0x47')]({},_0x232494,_0x3fb95e[_0x1401('0x4a')]);return _0x22c27c['getTeams'](_0x232494);}})[_0x1401('0x1d')](function(_0xa7d0eb){if(_0xa7d0eb){_0x58657d=_0xa7d0eb['length'];if(!_0x3fb95e[_0x1401('0x3d')][_0x1401('0x5f')]('nolimit')){_0x232494[_0x1401('0x2c')]=qs['limit'](_0x3fb95e[_0x1401('0x3d')][_0x1401('0x2c')]);_0x232494[_0x1401('0x2a')]=qs[_0x1401('0x2a')](_0x3fb95e[_0x1401('0x3d')][_0x1401('0x2a')]);}return _0x22c27c[_0x1401('0x69')](_0x232494);}})['then'](function(_0x5a69cc){if(_0x5a69cc){return _0x5a69cc?{'count':_0x58657d,'rows':_0x5a69cc}:null;}})[_0x1401('0x1d')](respondWithResult(_0x5aedb2,null))[_0x1401('0x26')](handleError(_0x5aedb2,null));};exports[_0x1401('0x6b')]=function(_0x3c534a,_0x227c60,_0x5da838){var _0x36b6c0=_0x3c534a[_0x1401('0x51')][_0x1401('0x6c')];return db[_0x1401('0x6a')][_0x1401('0x4d')]({'where':{'id':_0x36b6c0},'attributes':['id'],'include':[{'model':db[_0x1401('0x61')],'as':'Agents','attributes':['id',_0x1401('0x35'),'online','voicePause',_0x1401('0x6d')],'raw':!![]}]})['then'](function(_0x11838c){if(_0x11838c){var _0x44c87c=_[_0x1401('0x6e')](_0x11838c,function(_0x38a610){var _0x16ab4a=_0x38a610[_0x1401('0x33')]({'plain':!![]});return _0x16ab4a[_0x1401('0x6f')];});return db[_0x1401('0x38')]['find']({'where':{'id':_0x3c534a[_0x1401('0x5b')]['id']}})[_0x1401('0x1d')](function(_0x28303b){return db[_0x1401('0x70')][_0x1401('0x71')](function(_0x417271){return _0x28303b[_0x1401('0x6b')](_0x36b6c0,{'transaction':_0x417271})['then'](function(){return BPromise[_0x1401('0x72')](_0x44c87c,function(_0xfaff86){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0xfaff86['id'],'ChatQueueId':_0x3c534a[_0x1401('0x5b')]['id']},'transaction':_0x417271});});})['then'](function(){_0x44c87c[_0x1401('0x73')](function(_0x229e0a){socket[_0x1401('0x74')](_0x1401('0x75'),{'UserId':_0x229e0a['id'],'ChatQueueId':_0x28303b['id']});});});});});}})[_0x1401('0x1d')](respondWithStatusCode(_0x227c60,null))[_0x1401('0x26')](handleError(_0x227c60,null));};exports['removeTeams']=function(_0x4ca257,_0x3fb259,_0x4c89a1){return db['Team'][_0x1401('0x4d')]({'where':{'id':_0x4ca257[_0x1401('0x3d')][_0x1401('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1401('0x1d')](handleEntityNotFound(_0x3fb259,null))[_0x1401('0x1d')](function(_0x31f152){var _0x1a2837=_[_0x1401('0x37')](_0x31f152,'id');var _0x1d4040=[];var _0xa162c=[];var _0x23e73f=squel[_0x1401('0x76')]();_0x23e73f[_0x1401('0x77')]('tq.TeamId')[_0x1401('0x78')]('team_has_chat_queues','tq')['join'](_0x1401('0x79'),'ut',_0x1401('0x7a'))[_0x1401('0x46')](_0x1401('0x7b'),_0x4ca257[_0x1401('0x5b')]['id']);for(var _0x423dfb=0x0;_0x423dfb<_0x31f152[_0x1401('0x42')];_0x423dfb+=0x1){let _0x1cc1d9=_0x31f152[_0x423dfb];for(var _0x555815=0x0;_0x555815<_0x1cc1d9[_0x1401('0x6f')]['length'];_0x555815+=0x1){let _0x2fe89b=_0x1cc1d9[_0x1401('0x6f')][_0x555815];var _0x27ca82=_0x23e73f[_0x1401('0x7c')]();_0x27ca82[_0x1401('0x46')](_0x1401('0x7d'),_0x2fe89b['id']);_0xa162c[_0x1401('0x7e')](db[_0x1401('0x70')][_0x1401('0x3d')](_0x27ca82[_0x1401('0x7f')](),{'type':db[_0x1401('0x70')][_0x1401('0x80')][_0x1401('0x81')]})[_0x1401('0x1d')](function(_0x582ba2){if(_0x582ba2[_0x1401('0x42')]===0x1){return _0x2fe89b['id'];}else{var _0x884dd4=_['every'](_['map'](_0x582ba2,_0x1401('0x82')),function(_0x1a3182){return _[_0x1401('0x83')](_0x1a2837,_0x1a3182);});if(_0x884dd4){return _0x2fe89b['id'];}}}));}}return BPromise[_0x1401('0x84')](_0xa162c)[_0x1401('0x1d')](function(_0x3d6642){_0x1d4040=_(_0x1d4040)[_0x1401('0x85')](_0x3d6642)['compact']()[_0x1401('0x86')]();return db[_0x1401('0x38')][_0x1401('0x50')]({'where':{'id':_0x4ca257[_0x1401('0x5b')]['id']}})[_0x1401('0x1d')](function(_0x5f305a){return db[_0x1401('0x70')][_0x1401('0x71')](function(_0x19da0a){return _0x5f305a['removeTeams'](_0x4ca257[_0x1401('0x3d')]['ids'],{'transaction':_0x19da0a})[_0x1401('0x1d')](function(){if(!_['isEmpty'](_0x1d4040)){return _0x5f305a['removeAgents'](_0x1d4040,{'transaction':_0x19da0a});}})[_0x1401('0x1d')](function(){_0x1d4040[_0x1401('0x73')](function(_0x56a6d2){socket[_0x1401('0x74')](_0x1401('0x87'),{'UserId':_0x56a6d2,'ChatQueueId':_0x5f305a['id']});});});});});});})[_0x1401('0x1d')](respondWithStatusCode(_0x3fb259,null))[_0x1401('0x26')](handleError(_0x3fb259,null));};exports['addAgents']=function(_0x21a83d,_0xcd1545,_0x4f6413){return db['ChatQueue']['find']({'where':{'id':_0x21a83d['params']['id']}})[_0x1401('0x1d')](handleEntityNotFound(_0xcd1545,null))[_0x1401('0x1d')](function(_0xa6d842){if(_0xa6d842){return _0xa6d842[_0x1401('0x88')](_0x21a83d[_0x1401('0x51')][_0x1401('0x6c')],_['omit'](_0x21a83d[_0x1401('0x51')],['ids','id'])||{})[_0x1401('0x89')](function(_0x5ecd8d){for(var _0x23eca8=0x0;_0x23eca8<_0x21a83d['body'][_0x1401('0x6c')][_0x1401('0x42')];_0x23eca8+=0x1){socket[_0x1401('0x74')](_0x1401('0x75'),{'UserId':Number(_0x21a83d[_0x1401('0x51')]['ids'][_0x23eca8]),'ChatQueueId':Number(_0x21a83d[_0x1401('0x5b')]['id'])});}return _0x5ecd8d;});}})['then'](respondWithResult(_0xcd1545,null))[_0x1401('0x26')](handleError(_0xcd1545,null));};exports[_0x1401('0x8a')]=function(_0x4d349f,_0x492857,_0x1e9cd7){return db[_0x1401('0x38')][_0x1401('0x50')]({'where':{'id':_0x4d349f[_0x1401('0x5b')]['id']}})[_0x1401('0x1d')](handleEntityNotFound(_0x492857,null))['then'](function(_0x4a8968){if(_0x4a8968){return _0x4a8968[_0x1401('0x8a')](_0x4d349f['query'][_0x1401('0x6c')])[_0x1401('0x1d')](function(){if(_['isArray'](_0x4d349f[_0x1401('0x3d')][_0x1401('0x6c')])){for(var _0xb157b0=0x0;_0xb157b0<_0x4d349f['query'][_0x1401('0x6c')][_0x1401('0x42')];_0xb157b0+=0x1){socket[_0x1401('0x74')](_0x1401('0x87'),{'UserId':Number(_0x4d349f['query']['ids'][_0xb157b0]),'ChatQueueId':Number(_0x4d349f[_0x1401('0x5b')]['id'])});}}else{socket['emit'](_0x1401('0x87'),{'UserId':Number(_0x4d349f[_0x1401('0x3d')][_0x1401('0x6c')]),'ChatQueueId':Number(_0x4d349f[_0x1401('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x492857,null))[_0x1401('0x26')](handleError(_0x492857,null));};exports[_0x1401('0x8b')]=function(_0x399e22,_0x317d30,_0x58bd99){var _0x200118={};var _0x5d22c5={};var _0x2d77e8;var _0x4de82a;return db[_0x1401('0x38')][_0x1401('0x8c')]({'where':{'id':_0x399e22['params']['id']}})[_0x1401('0x1d')](handleEntityNotFound(_0x317d30,null))[_0x1401('0x1d')](function(_0x17ca6e){if(_0x17ca6e){_0x2d77e8=_0x17ca6e;_0x5d22c5[_0x1401('0x3c')]=_[_0x1401('0x3e')](db[_0x1401('0x61')][_0x1401('0x39')]);_0x5d22c5['query']=_['keys'](_0x399e22['query']);_0x5d22c5['filters']=_[_0x1401('0x3f')](_0x5d22c5['model'],_0x5d22c5[_0x1401('0x3d')]);_0x200118[_0x1401('0x40')]=_[_0x1401('0x3f')](_0x5d22c5[_0x1401('0x3c')],qs['fields'](_0x399e22[_0x1401('0x3d')][_0x1401('0x41')]));_0x200118[_0x1401('0x40')]=_0x200118[_0x1401('0x40')][_0x1401('0x42')]?_0x200118[_0x1401('0x40')]:_0x5d22c5[_0x1401('0x3c')];_0x200118['order']=qs['sort'](_0x399e22[_0x1401('0x3d')][_0x1401('0x44')]);_0x200118[_0x1401('0x46')]=qs[_0x1401('0x45')](_['pick'](_0x399e22[_0x1401('0x3d')],_0x5d22c5['filters']));if(_0x399e22['query'][_0x1401('0x49')]){_0x200118[_0x1401('0x46')]=_['merge'](_0x200118['where'],{'$or':_[_0x1401('0x37')](_0x200118['attributes'],function(_0x50ee40){var _0x33db6b={};_0x33db6b[_0x50ee40]={'$like':'%'+_0x399e22[_0x1401('0x3d')][_0x1401('0x49')]+'%'};return _0x33db6b;})});}_0x200118=_[_0x1401('0x47')]({},_0x200118,_0x399e22[_0x1401('0x4a')]);return _0x2d77e8[_0x1401('0x8b')](_0x200118);}})[_0x1401('0x1d')](function(_0x14747f){if(_0x14747f){_0x4de82a=_0x14747f[_0x1401('0x42')];if(!_0x399e22[_0x1401('0x3d')]['hasOwnProperty'](_0x1401('0x8d'))){_0x200118[_0x1401('0x2c')]=qs[_0x1401('0x2c')](_0x399e22[_0x1401('0x3d')][_0x1401('0x2c')]);_0x200118[_0x1401('0x2a')]=qs[_0x1401('0x2a')](_0x399e22[_0x1401('0x3d')][_0x1401('0x2a')]);}return _0x2d77e8[_0x1401('0x8b')](_0x200118);}})[_0x1401('0x1d')](function(_0x470579){if(_0x470579){return _0x470579?{'count':_0x4de82a,'rows':_0x470579}:null;}})['then'](respondWithResult(_0x317d30,null))[_0x1401('0x26')](handleError(_0x317d30,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index bb92008..c632e25 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 _0x3442=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x3442,0x118));var _0x2344=function(_0xa0dc65,_0x4d3421){_0xa0dc65=_0xa0dc65-0x0;var _0x5ee2b3=_0x3442[_0xa0dc65];return _0x5ee2b3;};'use strict';var EventEmitter=require(_0x2344('0x0'));var ChatQueue=require(_0x2344('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x2344('0x2')](0x0);var events={'afterCreate':_0x2344('0x3'),'afterUpdate':_0x2344('0x4'),'afterDestroy':_0x2344('0x5')};function emitEvent(_0x334e79){return function(_0x1903b9,_0xd13499,_0x30134d){ChatQueueEvents[_0x2344('0x6')](_0x334e79+':'+_0x1903b9['id'],_0x1903b9);ChatQueueEvents['emit'](_0x334e79,_0x1903b9);_0x30134d(null);};}for(var e in events){if(events[_0x2344('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x2344('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xf6b4=['events','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x3d200f,_0x1d7823){var _0x444366=function(_0x39e8bd){while(--_0x39e8bd){_0x3d200f['push'](_0x3d200f['shift']());}};_0x444366(++_0x1d7823);}(_0xf6b4,0x196));var _0x4f6b=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0xf6b4[_0x126f47];return _0x49508a;};'use strict';var EventEmitter=require(_0x4f6b('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4f6b('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4f6b('0x2')](0x0);var events={'afterCreate':_0x4f6b('0x3'),'afterUpdate':_0x4f6b('0x4'),'afterDestroy':_0x4f6b('0x5')};function emitEvent(_0x3cd5a4){return function(_0x44caf8,_0x350d74,_0x6dc615){ChatQueueEvents[_0x4f6b('0x6')](_0x3cd5a4+':'+_0x44caf8['id'],_0x44caf8);ChatQueueEvents['emit'](_0x3cd5a4,_0x44caf8);_0x6dc615(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 31d5610..7d9e2ae 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 _0x93cc=['exports','define','ChatQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x2fcca0,_0xfd9fd3){var _0x265779=function(_0x32a4bb){while(--_0x32a4bb){_0x2fcca0['push'](_0x2fcca0['shift']());}};_0x265779(++_0xfd9fd3);}(_0x93cc,0x65));var _0xc93c=function(_0x4a47ee,_0x5bd210){_0x4a47ee=_0x4a47ee-0x0;var _0x5c70c0=_0x93cc[_0x4a47ee];return _0x5c70c0;};'use strict';var _=require(_0xc93c('0x0'));var util=require(_0xc93c('0x1'));var logger=require(_0xc93c('0x2'))(_0xc93c('0x3'));var moment=require(_0xc93c('0x4'));var BPromise=require(_0xc93c('0x5'));var rp=require(_0xc93c('0x6'));var fs=require('fs');var path=require(_0xc93c('0x7'));var rimraf=require(_0xc93c('0x8'));var config=require(_0xc93c('0x9'));var attributes=require(_0xc93c('0xa'));module[_0xc93c('0xb')]=function(_0x13d34d,_0x4fe033){return _0x13d34d[_0xc93c('0xc')](_0xc93c('0xd'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0d9=['./chatQueue.attributes','exports','define','chat_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd0d9,0x130));var _0x9d0d=function(_0x5b1a4b,_0x5496a5){_0x5b1a4b=_0x5b1a4b-0x0;var _0x4fbb3d=_0xd0d9[_0x5b1a4b];return _0x4fbb3d;};'use strict';var _=require(_0x9d0d('0x0'));var util=require(_0x9d0d('0x1'));var logger=require('../../config/logger')(_0x9d0d('0x2'));var moment=require(_0x9d0d('0x3'));var BPromise=require(_0x9d0d('0x4'));var rp=require(_0x9d0d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d0d('0x6'));var config=require(_0x9d0d('0x7'));var attributes=require(_0x9d0d('0x8'));module[_0x9d0d('0x9')]=function(_0x293126,_0x47286b){return _0x293126[_0x9d0d('0xa')]('ChatQueue',attributes,{'tableName':_0x9d0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 5c95c32..5e1e889 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 _0x731b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatQueue','findAll','options','where','attributes','limit','include','map','model','GetChatQueue','debug','ShowChatQueue','find','raw','lodash','util','bluebird','randomstring','ioredis'];(function(_0x166e88,_0x1bae10){var _0x43ec68=function(_0x2924a5){while(--_0x2924a5){_0x166e88['push'](_0x166e88['shift']());}};_0x43ec68(++_0x1bae10);}(_0x731b,0xf7));var _0xb731=function(_0xfbc5a5,_0x2e542d){_0xfbc5a5=_0xfbc5a5-0x0;var _0x48960a=_0x731b[_0xfbc5a5];return _0x48960a;};'use strict';var _=require(_0xb731('0x0'));var util=require(_0xb731('0x1'));var moment=require('moment');var BPromise=require(_0xb731('0x2'));var rs=require(_0xb731('0x3'));var fs=require('fs');var Redis=require(_0xb731('0x4'));var db=require(_0xb731('0x5'))['db'];var utils=require(_0xb731('0x6'));var logger=require(_0xb731('0x7'))('rpc');var config=require(_0xb731('0x8'));var jayson=require(_0xb731('0x9'));var client=jayson[_0xb731('0xa')][_0xb731('0xb')]({'port':0x232a});config[_0xb731('0xc')]=_[_0xb731('0xd')](config[_0xb731('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb731('0xe'))(new Redis(config[_0xb731('0xc')]));require(_0xb731('0xf'))[_0xb731('0x10')](socket);function respondWithRpcPromise(_0x410999,_0x2f9d04,_0x330788){return new BPromise(function(_0xd220e6,_0x271d46){return client[_0xb731('0x11')](_0x410999,_0x330788)[_0xb731('0x12')](function(_0x35ce57){logger[_0xb731('0x13')](_0xb731('0x14'),_0x2f9d04,_0xb731('0x15'));logger['debug'](_0xb731('0x16'),_0x2f9d04,'request\x20sent',JSON[_0xb731('0x17')](_0x35ce57));if(_0x35ce57[_0xb731('0x18')]){if(_0x35ce57[_0xb731('0x18')]['code']===0x1f4){logger[_0xb731('0x18')]('ChatQueue,\x20%s,\x20%s',_0x2f9d04,_0x35ce57['error']['message']);return _0x271d46(_0x35ce57[_0xb731('0x18')][_0xb731('0x19')]);}logger['error'](_0xb731('0x14'),_0x2f9d04,_0x35ce57[_0xb731('0x18')]['message']);return _0xd220e6(_0x35ce57[_0xb731('0x18')][_0xb731('0x19')]);}else{logger[_0xb731('0x13')](_0xb731('0x14'),_0x2f9d04,_0xb731('0x15'));_0xd220e6(_0x35ce57[_0xb731('0x1a')][_0xb731('0x19')]);}})[_0xb731('0x1b')](function(_0x2c5c62){logger['error'](_0xb731('0x14'),_0x2f9d04,_0x2c5c62);_0x271d46(_0x2c5c62);});});}exports['GetChatQueue']=function(_0x4b4cb4){var _0x21870e=this;return new Promise(function(_0x537556,_0x396997){return db[_0xb731('0x1c')][_0xb731('0x1d')]({'raw':_0x4b4cb4[_0xb731('0x1e')]?_0x4b4cb4[_0xb731('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4b4cb4['options']?_0x4b4cb4[_0xb731('0x1e')][_0xb731('0x1f')]||null:null,'attributes':_0x4b4cb4['options']?_0x4b4cb4['options'][_0xb731('0x20')]||null:null,'limit':_0x4b4cb4['options']?_0x4b4cb4[_0xb731('0x1e')][_0xb731('0x21')]||null:null,'include':_0x4b4cb4['options']?_0x4b4cb4[_0xb731('0x1e')][_0xb731('0x22')]?_[_0xb731('0x23')](_0x4b4cb4[_0xb731('0x1e')]['include'],function(_0x9fabd8){return{'model':db[_0x9fabd8[_0xb731('0x24')]],'as':_0x9fabd8['as'],'attributes':_0x9fabd8[_0xb731('0x20')],'include':_0x9fabd8[_0xb731('0x22')]?_[_0xb731('0x23')](_0x9fabd8['include'],function(_0x582989){return{'model':db[_0x582989[_0xb731('0x24')]],'as':_0x582989['as'],'attributes':_0x582989[_0xb731('0x20')],'include':_0x582989['include']?_['map'](_0x582989[_0xb731('0x22')],function(_0x5e4a21){return{'model':db[_0x5e4a21[_0xb731('0x24')]],'as':_0x5e4a21['as'],'attributes':_0x5e4a21['attributes']};}):[]};}):[]};}):[]:[]})[_0xb731('0x12')](function(_0x32a863){logger[_0xb731('0x13')](_0xb731('0x25'),_0x4b4cb4);logger[_0xb731('0x26')]('GetChatQueue',_0x4b4cb4,JSON['stringify'](_0x32a863));_0x537556(_0x32a863);})['catch'](function(_0x4c0a33){logger[_0xb731('0x18')](_0xb731('0x25'),_0x4c0a33['message'],_0x4b4cb4);_0x396997(_0x21870e[_0xb731('0x18')](0x1f4,_0x4c0a33['message']));});});};exports[_0xb731('0x27')]=function(_0xbcb6a){var _0x4918f7=this;return new Promise(function(_0x1efc04,_0x9eddb8){return db['ChatQueue'][_0xb731('0x28')]({'raw':_0xbcb6a[_0xb731('0x1e')]?_0xbcb6a[_0xb731('0x1e')][_0xb731('0x29')]===undefined?!![]:![]:!![],'where':_0xbcb6a[_0xb731('0x1e')]?_0xbcb6a[_0xb731('0x1e')][_0xb731('0x1f')]||null:null,'attributes':_0xbcb6a['options']?_0xbcb6a[_0xb731('0x1e')][_0xb731('0x20')]||null:null,'include':_0xbcb6a[_0xb731('0x1e')]?_0xbcb6a[_0xb731('0x1e')][_0xb731('0x22')]?_[_0xb731('0x23')](_0xbcb6a[_0xb731('0x1e')][_0xb731('0x22')],function(_0xfb0fb0){return{'model':db[_0xfb0fb0[_0xb731('0x24')]],'as':_0xfb0fb0['as'],'attributes':_0xfb0fb0[_0xb731('0x20')],'include':_0xfb0fb0[_0xb731('0x22')]?_[_0xb731('0x23')](_0xfb0fb0[_0xb731('0x22')],function(_0x6d1c8b){return{'model':db[_0x6d1c8b[_0xb731('0x24')]],'as':_0x6d1c8b['as'],'attributes':_0x6d1c8b[_0xb731('0x20')],'include':_0x6d1c8b[_0xb731('0x22')]?_['map'](_0x6d1c8b[_0xb731('0x22')],function(_0x5519be){return{'model':db[_0x5519be[_0xb731('0x24')]],'as':_0x5519be['as'],'attributes':_0x5519be[_0xb731('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb731('0x12')](function(_0x576a37){logger['info'](_0xb731('0x27'),_0xbcb6a);logger[_0xb731('0x26')](_0xb731('0x27'),_0xbcb6a,JSON['stringify'](_0x576a37));_0x1efc04(_0x576a37);})['catch'](function(_0x4f5cb3){logger[_0xb731('0x18')](_0xb731('0x27'),_0x4f5cb3[_0xb731('0x19')],_0xbcb6a);_0x9eddb8(_0x4918f7[_0xb731('0x18')](0x1f4,_0x4f5cb3[_0xb731('0x19')]));});});}; \ No newline at end of file +var _0x48ae=['register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueue','options','raw','where','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','find','lodash','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48ae,0x142));var _0xe48a=function(_0x3e0a08,_0x2b7f4d){_0x3e0a08=_0x3e0a08-0x0;var _0x279db=_0x48ae[_0x3e0a08];return _0x279db;};'use strict';var _=require(_0xe48a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe48a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe48a('0x2'))['db'];var utils=require(_0xe48a('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe48a('0x4'));var client=jayson['client'][_0xe48a('0x5')]({'port':0x232a});config[_0xe48a('0x6')]=_[_0xe48a('0x7')](config['redis'],{'host':_0xe48a('0x8'),'port':0x18eb});var socket=require(_0xe48a('0x9'))(new Redis(config[_0xe48a('0x6')]));require(_0xe48a('0xa'))[_0xe48a('0xb')](socket);function respondWithRpcPromise(_0xf31d44,_0x3e8734,_0x403cc1){return new BPromise(function(_0x41fe19,_0x4fdc89){return client[_0xe48a('0xc')](_0xf31d44,_0x403cc1)[_0xe48a('0xd')](function(_0x2ad037){logger[_0xe48a('0xe')](_0xe48a('0xf'),_0x3e8734,_0xe48a('0x10'));logger[_0xe48a('0x11')](_0xe48a('0x12'),_0x3e8734,_0xe48a('0x10'),JSON[_0xe48a('0x13')](_0x2ad037));if(_0x2ad037[_0xe48a('0x14')]){if(_0x2ad037[_0xe48a('0x14')][_0xe48a('0x15')]===0x1f4){logger[_0xe48a('0x14')](_0xe48a('0xf'),_0x3e8734,_0x2ad037[_0xe48a('0x14')]['message']);return _0x4fdc89(_0x2ad037[_0xe48a('0x14')][_0xe48a('0x16')]);}logger[_0xe48a('0x14')](_0xe48a('0xf'),_0x3e8734,_0x2ad037[_0xe48a('0x14')][_0xe48a('0x16')]);return _0x41fe19(_0x2ad037[_0xe48a('0x14')]['message']);}else{logger[_0xe48a('0xe')](_0xe48a('0xf'),_0x3e8734,_0xe48a('0x10'));_0x41fe19(_0x2ad037[_0xe48a('0x17')][_0xe48a('0x16')]);}})[_0xe48a('0x18')](function(_0x5160bd){logger[_0xe48a('0x14')](_0xe48a('0xf'),_0x3e8734,_0x5160bd);_0x4fdc89(_0x5160bd);});});}exports['GetChatQueue']=function(_0x520fd8){var _0x38ae00=this;return new Promise(function(_0x30cd41,_0x458f44){return db[_0xe48a('0x19')]['findAll']({'raw':_0x520fd8[_0xe48a('0x1a')]?_0x520fd8[_0xe48a('0x1a')][_0xe48a('0x1b')]===undefined?!![]:![]:!![],'where':_0x520fd8[_0xe48a('0x1a')]?_0x520fd8['options'][_0xe48a('0x1c')]||null:null,'attributes':_0x520fd8[_0xe48a('0x1a')]?_0x520fd8[_0xe48a('0x1a')][_0xe48a('0x1d')]||null:null,'limit':_0x520fd8['options']?_0x520fd8['options'][_0xe48a('0x1e')]||null:null,'include':_0x520fd8[_0xe48a('0x1a')]?_0x520fd8[_0xe48a('0x1a')][_0xe48a('0x1f')]?_[_0xe48a('0x20')](_0x520fd8['options'][_0xe48a('0x1f')],function(_0x566bb4){return{'model':db[_0x566bb4['model']],'as':_0x566bb4['as'],'attributes':_0x566bb4[_0xe48a('0x1d')],'include':_0x566bb4[_0xe48a('0x1f')]?_[_0xe48a('0x20')](_0x566bb4[_0xe48a('0x1f')],function(_0x3a2b52){return{'model':db[_0x3a2b52[_0xe48a('0x21')]],'as':_0x3a2b52['as'],'attributes':_0x3a2b52[_0xe48a('0x1d')],'include':_0x3a2b52[_0xe48a('0x1f')]?_[_0xe48a('0x20')](_0x3a2b52['include'],function(_0x45739c){return{'model':db[_0x45739c[_0xe48a('0x21')]],'as':_0x45739c['as'],'attributes':_0x45739c[_0xe48a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe48a('0xd')](function(_0x32a6cf){logger['info'](_0xe48a('0x22'),_0x520fd8);logger[_0xe48a('0x11')](_0xe48a('0x22'),_0x520fd8,JSON[_0xe48a('0x13')](_0x32a6cf));_0x30cd41(_0x32a6cf);})['catch'](function(_0x3f7323){logger['error'](_0xe48a('0x22'),_0x3f7323[_0xe48a('0x16')],_0x520fd8);_0x458f44(_0x38ae00[_0xe48a('0x14')](0x1f4,_0x3f7323['message']));});});};exports[_0xe48a('0x23')]=function(_0x57689b){var _0x143336=this;return new Promise(function(_0xdcb935,_0xab4c47){return db[_0xe48a('0x19')][_0xe48a('0x24')]({'raw':_0x57689b['options']?_0x57689b[_0xe48a('0x1a')][_0xe48a('0x1b')]===undefined?!![]:![]:!![],'where':_0x57689b[_0xe48a('0x1a')]?_0x57689b[_0xe48a('0x1a')][_0xe48a('0x1c')]||null:null,'attributes':_0x57689b[_0xe48a('0x1a')]?_0x57689b[_0xe48a('0x1a')][_0xe48a('0x1d')]||null:null,'include':_0x57689b['options']?_0x57689b['options'][_0xe48a('0x1f')]?_['map'](_0x57689b['options'][_0xe48a('0x1f')],function(_0x1311a7){return{'model':db[_0x1311a7[_0xe48a('0x21')]],'as':_0x1311a7['as'],'attributes':_0x1311a7['attributes'],'include':_0x1311a7['include']?_[_0xe48a('0x20')](_0x1311a7[_0xe48a('0x1f')],function(_0x5b7fa6){return{'model':db[_0x5b7fa6[_0xe48a('0x21')]],'as':_0x5b7fa6['as'],'attributes':_0x5b7fa6[_0xe48a('0x1d')],'include':_0x5b7fa6['include']?_[_0xe48a('0x20')](_0x5b7fa6['include'],function(_0x4a1730){return{'model':db[_0x4a1730['model']],'as':_0x4a1730['as'],'attributes':_0x4a1730[_0xe48a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe48a('0xd')](function(_0x3221f3){logger[_0xe48a('0xe')](_0xe48a('0x23'),_0x57689b);logger[_0xe48a('0x11')](_0xe48a('0x23'),_0x57689b,JSON['stringify'](_0x3221f3));_0xdcb935(_0x3221f3);})[_0xe48a('0x18')](function(_0x226c6c){logger[_0xe48a('0x14')](_0xe48a('0x23'),_0x226c6c[_0xe48a('0x16')],_0x57689b);_0xab4c47(_0x143336['error'](0x1f4,_0x226c6c[_0xe48a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 1d76abe..432321e 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 _0x6737=['chatQueue:','save','remove','emit','removeListener'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6737,0xe2));var _0x7673=function(_0x400975,_0x3ac074){_0x400975=_0x400975-0x0;var _0x3874cc=_0x6737[_0x400975];return _0x3874cc;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x7673('0x0'),_0x7673('0x1'),'update'];function createListener(_0x2f05d4,_0x2a9cd0){return function(_0x43ee27){_0x2a9cd0[_0x7673('0x2')](_0x2f05d4,_0x43ee27);};}function removeListener(_0x54002e,_0x32e6f2){return function(){ChatQueueEvents[_0x7673('0x3')](_0x54002e,_0x32e6f2);};}exports['register']=function(_0x2f5edc){for(var _0x15230f=0x0,_0x5af802=events['length'];_0x15230f<_0x5af802;_0x15230f++){var _0x53d67d=events[_0x15230f];var _0x5292f7=createListener(_0x7673('0x4')+_0x53d67d,_0x2f5edc);ChatQueueEvents['on'](_0x53d67d,_0x5292f7);}}; \ No newline at end of file +var _0xcb99=['chatQueue:','./chatQueue.events','remove','emit','removeListener','length'];(function(_0x559f56,_0x6fdb3){var _0x437f81=function(_0x176fa5){while(--_0x176fa5){_0x559f56['push'](_0x559f56['shift']());}};_0x437f81(++_0x6fdb3);}(_0xcb99,0x8b));var _0x9cb9=function(_0x503641,_0x33a3cf){_0x503641=_0x503641-0x0;var _0x17757d=_0xcb99[_0x503641];return _0x17757d;};'use strict';var ChatQueueEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatQueueEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatQueueEvents['on'](_0x1bf9b7,_0x1dd62f);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 1e516fc..dbcefff 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0x28e99e,_0x272b24){_0x28e99e=_0x28e99e-0x0;var _0x13ea41=_0x3e74[_0x28e99e];return _0x13ea41;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0xf61bc2,_0x3d535e){var _0x1c6c56=function(_0x5ac552){while(--_0x5ac552){_0xf61bc2['push'](_0xf61bc2['shift']());}};_0x1c6c56(++_0x3d535e);}(_0x814b,0x1a2));var _0xb814=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x814b[_0x25d386];return _0x857f4a;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c8d1d6b..d0a8100 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 _0xa1d3=['sequelize','STRING','DATE','moment'];(function(_0x185a5a,_0x19442b){var _0x39bd2d=function(_0xfe0213){while(--_0xfe0213){_0x185a5a['push'](_0x185a5a['shift']());}};_0x39bd2d(++_0x19442b);}(_0xa1d3,0x147));var _0x3a1d=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0xa1d3[_0x3f55de];return _0x2698de;};'use strict';var moment=require(_0x3a1d('0x0'));var Sequelize=require(_0x3a1d('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3a1d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3a1d('0x2')]},'joinAt':{'type':Sequelize[_0x3a1d('0x3')]},'leaveAt':{'type':Sequelize[_0x3a1d('0x3')]},'acceptAt':{'type':Sequelize[_0x3a1d('0x3')]},'exitAt':{'type':Sequelize[_0x3a1d('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x16eb=['sequelize','STRING','DATE','moment'];(function(_0x32cbd9,_0x1bbeb7){var _0x242d1e=function(_0x5362a4){while(--_0x5362a4){_0x32cbd9['push'](_0x32cbd9['shift']());}};_0x242d1e(++_0x1bbeb7);}(_0x16eb,0x73));var _0xb16e=function(_0x55ec67,_0x1c90d5){_0x55ec67=_0x55ec67-0x0;var _0x1350f6=_0x16eb[_0x55ec67];return _0x1350f6;};'use strict';var moment=require(_0xb16e('0x0'));var Sequelize=require(_0xb16e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb16e('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb16e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb16e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 9517bcf..7625f00 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 _0x41fe=['fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','keys','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0xf237f6,_0x155da2){var _0x16baf8=function(_0x3b2cb7){while(--_0x3b2cb7){_0xf237f6['push'](_0xf237f6['shift']());}};_0x16baf8(++_0x155da2);}(_0x41fe,0xd1));var _0xe41f=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x41fe[_0x3a2a3c];return _0x50ac9a;};'use strict';var emlformat=require(_0xe41f('0x0'));var rimraf=require(_0xe41f('0x1'));var zipdir=require(_0xe41f('0x2'));var jsonpatch=require(_0xe41f('0x3'));var rp=require(_0xe41f('0x4'));var moment=require(_0xe41f('0x5'));var BPromise=require(_0xe41f('0x6'));var Mustache=require(_0xe41f('0x7'));var util=require(_0xe41f('0x8'));var path=require(_0xe41f('0x9'));var sox=require(_0xe41f('0xa'));var csv=require(_0xe41f('0xb'));var ejs=require(_0xe41f('0xc'));var fs=require('fs');var fs_extra=require(_0xe41f('0xd'));var _=require(_0xe41f('0xe'));var squel=require(_0xe41f('0xf'));var crypto=require(_0xe41f('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xe41f('0x11'));var toCsv=require(_0xe41f('0xb'));var querystring=require('querystring');var Papa=require(_0xe41f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe41f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe41f('0x14'));var config=require(_0xe41f('0x15'));var licenseUtil=require(_0xe41f('0x16'));var db=require(_0xe41f('0x17'))['db'];function respondWithStatusCode(_0x2ed268,_0x139162){_0x139162=_0x139162||0xcc;return function(_0x34ae3a){if(_0x34ae3a){return _0x2ed268[_0xe41f('0x18')](_0x139162);}return _0x2ed268[_0xe41f('0x19')](_0x139162)[_0xe41f('0x1a')]();};}function respondWithResult(_0x53e2f6,_0x445e1c){_0x445e1c=_0x445e1c||0xc8;return function(_0x13a2dd){if(_0x13a2dd){return _0x53e2f6['status'](_0x445e1c)[_0xe41f('0x1b')](_0x13a2dd);}};}function respondWithFilteredResult(_0x9cb27c,_0x3b5992){return function(_0x1fb373){if(_0x1fb373){var _0x194653=typeof _0x3b5992[_0xe41f('0x1c')]===_0xe41f('0x1d')&&typeof _0x3b5992['limit']==='undefined';var _0x2b5688=_0x1fb373['count'];var _0x5b5dd7=_0x194653?0x0:_0x3b5992[_0xe41f('0x1c')];var _0x15f6c1=_0x194653?_0x1fb373[_0xe41f('0x1e')]:_0x3b5992[_0xe41f('0x1c')]+_0x3b5992[_0xe41f('0x1f')];var _0x5bd220;if(_0x15f6c1>=_0x2b5688){_0x15f6c1=_0x2b5688;_0x5bd220=0xc8;}else{_0x5bd220=0xce;}_0x9cb27c[_0xe41f('0x19')](_0x5bd220);return _0x9cb27c['set'](_0xe41f('0x20'),_0x5b5dd7+'-'+_0x15f6c1+'/'+_0x2b5688)[_0xe41f('0x1b')](_0x1fb373);}return null;};}function patchUpdates(_0x4dcb21){return function(_0x3ce4d8){try{jsonpatch[_0xe41f('0x21')](_0x3ce4d8,_0x4dcb21,!![]);}catch(_0x171851){return BPromise['reject'](_0x171851);}return _0x3ce4d8[_0xe41f('0x22')]();};}function saveUpdates(_0x3666c3,_0x37fce9){return function(_0x10ee63){if(_0x10ee63){return _0x10ee63[_0xe41f('0x23')](_0x3666c3)[_0xe41f('0x24')](function(_0x9c0c33){return _0x9c0c33;});}return null;};}function removeEntity(_0x520136,_0x18c6ba){return function(_0x5a443f){if(_0x5a443f){return _0x5a443f['destroy']()[_0xe41f('0x24')](function(){_0x520136[_0xe41f('0x19')](0xcc)[_0xe41f('0x1a')]();});}};}function handleEntityNotFound(_0x4f7965,_0x1ac25a){return function(_0x573b3){if(!_0x573b3){_0x4f7965[_0xe41f('0x18')](0x194);}return _0x573b3;};}function handleError(_0x479387,_0x15ccae){_0x15ccae=_0x15ccae||0x1f4;return function(_0x5790ae){logger[_0xe41f('0x25')](_0x5790ae[_0xe41f('0x26')]);if(_0x5790ae['name']){delete _0x5790ae[_0xe41f('0x27')];}_0x479387[_0xe41f('0x19')](_0x15ccae)[_0xe41f('0x28')](_0x5790ae);};}exports[_0xe41f('0x29')]=function(_0x348531,_0x2a7bf4){var _0x1a182b={},_0x4438cf={},_0x6ec664={'count':0x0,'rows':[]};var _0x1c3c38=_[_0xe41f('0x2a')](db[_0xe41f('0x2b')][_0xe41f('0x2c')],function(_0xbca5b0){return{'name':_0xbca5b0[_0xe41f('0x2d')],'type':_0xbca5b0['type'][_0xe41f('0x2e')]};});_0x4438cf[_0xe41f('0x2f')]=_[_0xe41f('0x2a')](_0x1c3c38,_0xe41f('0x27'));_0x4438cf[_0xe41f('0x30')]=_['keys'](_0x348531[_0xe41f('0x30')]);_0x4438cf[_0xe41f('0x31')]=_[_0xe41f('0x32')](_0x4438cf[_0xe41f('0x2f')],_0x4438cf['query']);_0x1a182b['attributes']=_['intersection'](_0x4438cf[_0xe41f('0x2f')],qs[_0xe41f('0x33')](_0x348531[_0xe41f('0x30')]['fields']));_0x1a182b[_0xe41f('0x34')]=_0x1a182b[_0xe41f('0x34')][_0xe41f('0x35')]?_0x1a182b[_0xe41f('0x34')]:_0x4438cf[_0xe41f('0x2f')];if(!_0x348531[_0xe41f('0x30')][_0xe41f('0x36')](_0xe41f('0x37'))){_0x1a182b[_0xe41f('0x1f')]=qs[_0xe41f('0x1f')](_0x348531[_0xe41f('0x30')][_0xe41f('0x1f')]);_0x1a182b['offset']=qs[_0xe41f('0x1c')](_0x348531['query'][_0xe41f('0x1c')]);}_0x1a182b['order']=qs[_0xe41f('0x38')](_0x348531['query']['sort']);_0x1a182b[_0xe41f('0x39')]=qs[_0xe41f('0x31')](_[_0xe41f('0x3a')](_0x348531[_0xe41f('0x30')],_0x4438cf[_0xe41f('0x31')]),_0x1c3c38);if(_0x348531['query'][_0xe41f('0x3b')]){_0x1a182b[_0xe41f('0x39')]=_[_0xe41f('0x3c')](_0x1a182b[_0xe41f('0x39')],{'$or':_[_0xe41f('0x2a')](_0x1c3c38,function(_0x10083c){if(_0x10083c[_0xe41f('0x3d')]!=='VIRTUAL'){var _0x438ead={};_0x438ead[_0x10083c[_0xe41f('0x27')]]={'$like':'%'+_0x348531[_0xe41f('0x30')][_0xe41f('0x3b')]+'%'};return _0x438ead;}})});}_0x1a182b=_[_0xe41f('0x3c')]({},_0x1a182b,_0x348531[_0xe41f('0x3e')]);var _0x2d0cf7={'where':_0x1a182b[_0xe41f('0x39')]};return db[_0xe41f('0x2b')]['count'](_0x2d0cf7)['then'](function(_0x537fbf){_0x6ec664['count']=_0x537fbf;if(_0x348531[_0xe41f('0x30')][_0xe41f('0x3f')]){_0x1a182b[_0xe41f('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xe41f('0x41')](_0x1a182b);})[_0xe41f('0x24')](function(_0x55bf6f){_0x6ec664['rows']=_0x55bf6f;return _0x6ec664;})[_0xe41f('0x24')](respondWithFilteredResult(_0x2a7bf4,_0x1a182b))[_0xe41f('0x42')](handleError(_0x2a7bf4,null));};exports[_0xe41f('0x43')]=function(_0x384001,_0x27bdee){var _0x56e180={'raw':!![],'where':{'id':_0x384001['params']['id']}},_0x82727b={};_0x82727b[_0xe41f('0x2f')]=_[_0xe41f('0x44')](db['ChatQueueReport'][_0xe41f('0x2c')]);_0x82727b['query']=_[_0xe41f('0x44')](_0x384001[_0xe41f('0x30')]);_0x82727b[_0xe41f('0x31')]=_['intersection'](_0x82727b[_0xe41f('0x2f')],_0x82727b['query']);_0x56e180[_0xe41f('0x34')]=_[_0xe41f('0x32')](_0x82727b[_0xe41f('0x2f')],qs[_0xe41f('0x33')](_0x384001[_0xe41f('0x30')][_0xe41f('0x33')]));_0x56e180[_0xe41f('0x34')]=_0x56e180[_0xe41f('0x34')]['length']?_0x56e180[_0xe41f('0x34')]:_0x82727b['model'];if(_0x384001[_0xe41f('0x30')]['includeAll']){_0x56e180[_0xe41f('0x40')]=[{'all':!![]}];}_0x56e180=_[_0xe41f('0x3c')]({},_0x56e180,_0x384001[_0xe41f('0x3e')]);return db[_0xe41f('0x2b')]['find'](_0x56e180)[_0xe41f('0x24')](handleEntityNotFound(_0x27bdee,null))['then'](respondWithResult(_0x27bdee,null))[_0xe41f('0x42')](handleError(_0x27bdee,null));};exports[_0xe41f('0x45')]=function(_0x6154a,_0x3a5974){return db['ChatQueueReport'][_0xe41f('0x45')](_0x6154a['body'],{})['then'](respondWithResult(_0x3a5974,0xc9))['catch'](handleError(_0x3a5974,null));};exports[_0xe41f('0x23')]=function(_0x25b374,_0x59ef57){if(_0x25b374[_0xe41f('0x46')]['id']){delete _0x25b374[_0xe41f('0x46')]['id'];}return db[_0xe41f('0x2b')][_0xe41f('0x47')]({'where':{'id':_0x25b374[_0xe41f('0x48')]['id']}})[_0xe41f('0x24')](handleEntityNotFound(_0x59ef57,null))[_0xe41f('0x24')](saveUpdates(_0x25b374[_0xe41f('0x46')],null))[_0xe41f('0x24')](respondWithResult(_0x59ef57,null))[_0xe41f('0x42')](handleError(_0x59ef57,null));};exports['destroy']=function(_0x119e32,_0x97c6c6){return db[_0xe41f('0x2b')]['find']({'where':{'id':_0x119e32[_0xe41f('0x48')]['id']}})[_0xe41f('0x24')](handleEntityNotFound(_0x97c6c6,null))[_0xe41f('0x24')](removeEntity(_0x97c6c6,null))[_0xe41f('0x42')](handleError(_0x97c6c6,null));};exports[_0xe41f('0x49')]=function(_0x4f8f47,_0x23cb73){return db[_0xe41f('0x2b')]['describe']()['then'](respondWithResult(_0x23cb73,null))['catch'](handleError(_0x23cb73,null));}; \ No newline at end of file +var _0x6f44=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','map','ChatQueueReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','count','includeAll','include','rows','catch','params','keys','rawAttributes','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1afd94,_0x4562a1){var _0x481f3d=function(_0x1c08b7){while(--_0x1c08b7){_0x1afd94['push'](_0x1afd94['shift']());}};_0x481f3d(++_0x4562a1);}(_0x6f44,0x1ea));var _0x46f4=function(_0x47523f,_0x318789){_0x47523f=_0x47523f-0x0;var _0x4ac247=_0x6f44[_0x47523f];return _0x4ac247;};'use strict';var emlformat=require(_0x46f4('0x0'));var rimraf=require(_0x46f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46f4('0x2'));var rp=require(_0x46f4('0x3'));var moment=require(_0x46f4('0x4'));var BPromise=require(_0x46f4('0x5'));var Mustache=require(_0x46f4('0x6'));var util=require(_0x46f4('0x7'));var path=require(_0x46f4('0x8'));var sox=require(_0x46f4('0x9'));var csv=require(_0x46f4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46f4('0xb'));var _=require(_0x46f4('0xc'));var squel=require(_0x46f4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46f4('0xe'));var toCsv=require(_0x46f4('0xa'));var querystring=require('querystring');var Papa=require(_0x46f4('0xf'));var Redis=require('ioredis');var authService=require(_0x46f4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x46f4('0x11'));var hardwareService=require(_0x46f4('0x12'));var logger=require(_0x46f4('0x13'))(_0x46f4('0x14'));var utils=require(_0x46f4('0x15'));var config=require(_0x46f4('0x16'));var licenseUtil=require(_0x46f4('0x17'));var db=require(_0x46f4('0x18'))['db'];function respondWithStatusCode(_0x21d4a6,_0x1f4748){_0x1f4748=_0x1f4748||0xcc;return function(_0x1dd233){if(_0x1dd233){return _0x21d4a6[_0x46f4('0x19')](_0x1f4748);}return _0x21d4a6['status'](_0x1f4748)[_0x46f4('0x1a')]();};}function respondWithResult(_0x33f73c,_0x52db86){_0x52db86=_0x52db86||0xc8;return function(_0x44a55b){if(_0x44a55b){return _0x33f73c[_0x46f4('0x1b')](_0x52db86)[_0x46f4('0x1c')](_0x44a55b);}};}function respondWithFilteredResult(_0x4dd2fb,_0x3dc516){return function(_0x4e0661){if(_0x4e0661){var _0x4e84ce=typeof _0x3dc516[_0x46f4('0x1d')]===_0x46f4('0x1e')&&typeof _0x3dc516[_0x46f4('0x1f')]==='undefined';var _0x5c191a=_0x4e0661['count'];var _0x5d3471=_0x4e84ce?0x0:_0x3dc516[_0x46f4('0x1d')];var _0x433297=_0x4e84ce?_0x4e0661['count']:_0x3dc516[_0x46f4('0x1d')]+_0x3dc516[_0x46f4('0x1f')];var _0x2232d6;if(_0x433297>=_0x5c191a){_0x433297=_0x5c191a;_0x2232d6=0xc8;}else{_0x2232d6=0xce;}_0x4dd2fb[_0x46f4('0x1b')](_0x2232d6);return _0x4dd2fb['set'](_0x46f4('0x20'),_0x5d3471+'-'+_0x433297+'/'+_0x5c191a)[_0x46f4('0x1c')](_0x4e0661);}return null;};}function patchUpdates(_0x1627db){return function(_0x6476f0){try{jsonpatch[_0x46f4('0x21')](_0x6476f0,_0x1627db,!![]);}catch(_0xdb9f25){return BPromise['reject'](_0xdb9f25);}return _0x6476f0[_0x46f4('0x22')]();};}function saveUpdates(_0x2b88d3,_0x39760b){return function(_0x4ba21a){if(_0x4ba21a){return _0x4ba21a[_0x46f4('0x23')](_0x2b88d3)[_0x46f4('0x24')](function(_0x185ec2){return _0x185ec2;});}return null;};}function removeEntity(_0x47528b,_0x36092e){return function(_0x41be5e){if(_0x41be5e){return _0x41be5e[_0x46f4('0x25')]()[_0x46f4('0x24')](function(){_0x47528b[_0x46f4('0x1b')](0xcc)[_0x46f4('0x1a')]();});}};}function handleEntityNotFound(_0x2ad553,_0x16cd7f){return function(_0x197e55){if(!_0x197e55){_0x2ad553['sendStatus'](0x194);}return _0x197e55;};}function handleError(_0x46e96d,_0x30d4fc){_0x30d4fc=_0x30d4fc||0x1f4;return function(_0xb23194){logger[_0x46f4('0x26')](_0xb23194[_0x46f4('0x27')]);if(_0xb23194[_0x46f4('0x28')]){delete _0xb23194['name'];}_0x46e96d[_0x46f4('0x1b')](_0x30d4fc)['send'](_0xb23194);};}exports['index']=function(_0x53ac21,_0x2cf22c){var _0x57ff78={},_0x1fb343={},_0x183f0c={'count':0x0,'rows':[]};var _0x3c8c91=_[_0x46f4('0x29')](db[_0x46f4('0x2a')]['rawAttributes'],function(_0x1d512b){return{'name':_0x1d512b[_0x46f4('0x2b')],'type':_0x1d512b[_0x46f4('0x2c')]['key']};});_0x1fb343[_0x46f4('0x2d')]=_[_0x46f4('0x29')](_0x3c8c91,_0x46f4('0x28'));_0x1fb343['query']=_['keys'](_0x53ac21[_0x46f4('0x2e')]);_0x1fb343[_0x46f4('0x2f')]=_[_0x46f4('0x30')](_0x1fb343['model'],_0x1fb343[_0x46f4('0x2e')]);_0x57ff78[_0x46f4('0x31')]=_['intersection'](_0x1fb343[_0x46f4('0x2d')],qs['fields'](_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x32')]));_0x57ff78[_0x46f4('0x31')]=_0x57ff78[_0x46f4('0x31')][_0x46f4('0x33')]?_0x57ff78['attributes']:_0x1fb343[_0x46f4('0x2d')];if(!_0x53ac21[_0x46f4('0x2e')]['hasOwnProperty'](_0x46f4('0x34'))){_0x57ff78[_0x46f4('0x1f')]=qs[_0x46f4('0x1f')](_0x53ac21[_0x46f4('0x2e')]['limit']);_0x57ff78[_0x46f4('0x1d')]=qs['offset'](_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x1d')]);}_0x57ff78[_0x46f4('0x35')]=qs[_0x46f4('0x36')](_0x53ac21['query'][_0x46f4('0x36')]);_0x57ff78['where']=qs['filters'](_[_0x46f4('0x37')](_0x53ac21['query'],_0x1fb343['filters']),_0x3c8c91);if(_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x38')]){_0x57ff78['where']=_[_0x46f4('0x39')](_0x57ff78['where'],{'$or':_[_0x46f4('0x29')](_0x3c8c91,function(_0x190c1a){if(_0x190c1a[_0x46f4('0x2c')]!==_0x46f4('0x3a')){var _0x5c6662={};_0x5c6662[_0x190c1a[_0x46f4('0x28')]]={'$like':'%'+_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x38')]+'%'};return _0x5c6662;}})});}_0x57ff78=_['merge']({},_0x57ff78,_0x53ac21['options']);var _0x4a44a6={'where':_0x57ff78[_0x46f4('0x3b')]};return db[_0x46f4('0x2a')][_0x46f4('0x3c')](_0x4a44a6)[_0x46f4('0x24')](function(_0x57bfd2){_0x183f0c[_0x46f4('0x3c')]=_0x57bfd2;if(_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x3d')]){_0x57ff78[_0x46f4('0x3e')]=[{'all':!![]}];}return db[_0x46f4('0x2a')]['findAll'](_0x57ff78);})[_0x46f4('0x24')](function(_0x306400){_0x183f0c[_0x46f4('0x3f')]=_0x306400;return _0x183f0c;})[_0x46f4('0x24')](respondWithFilteredResult(_0x2cf22c,_0x57ff78))[_0x46f4('0x40')](handleError(_0x2cf22c,null));};exports['show']=function(_0x549af3,_0x4e11cb){var _0x21ce83={'raw':!![],'where':{'id':_0x549af3[_0x46f4('0x41')]['id']}},_0x1c0513={};_0x1c0513['model']=_[_0x46f4('0x42')](db[_0x46f4('0x2a')][_0x46f4('0x43')]);_0x1c0513[_0x46f4('0x2e')]=_[_0x46f4('0x42')](_0x549af3[_0x46f4('0x2e')]);_0x1c0513[_0x46f4('0x2f')]=_[_0x46f4('0x30')](_0x1c0513[_0x46f4('0x2d')],_0x1c0513[_0x46f4('0x2e')]);_0x21ce83[_0x46f4('0x31')]=_[_0x46f4('0x30')](_0x1c0513[_0x46f4('0x2d')],qs['fields'](_0x549af3[_0x46f4('0x2e')][_0x46f4('0x32')]));_0x21ce83[_0x46f4('0x31')]=_0x21ce83[_0x46f4('0x31')][_0x46f4('0x33')]?_0x21ce83[_0x46f4('0x31')]:_0x1c0513['model'];if(_0x549af3['query']['includeAll']){_0x21ce83[_0x46f4('0x3e')]=[{'all':!![]}];}_0x21ce83=_[_0x46f4('0x39')]({},_0x21ce83,_0x549af3[_0x46f4('0x44')]);return db[_0x46f4('0x2a')][_0x46f4('0x45')](_0x21ce83)[_0x46f4('0x24')](handleEntityNotFound(_0x4e11cb,null))[_0x46f4('0x24')](respondWithResult(_0x4e11cb,null))[_0x46f4('0x40')](handleError(_0x4e11cb,null));};exports[_0x46f4('0x46')]=function(_0xf73c15,_0x21319d){return db[_0x46f4('0x2a')]['create'](_0xf73c15[_0x46f4('0x47')],{})[_0x46f4('0x24')](respondWithResult(_0x21319d,0xc9))[_0x46f4('0x40')](handleError(_0x21319d,null));};exports['update']=function(_0x5a6d1f,_0x1fedc8){if(_0x5a6d1f[_0x46f4('0x47')]['id']){delete _0x5a6d1f[_0x46f4('0x47')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5a6d1f[_0x46f4('0x41')]['id']}})[_0x46f4('0x24')](handleEntityNotFound(_0x1fedc8,null))[_0x46f4('0x24')](saveUpdates(_0x5a6d1f[_0x46f4('0x47')],null))[_0x46f4('0x24')](respondWithResult(_0x1fedc8,null))[_0x46f4('0x40')](handleError(_0x1fedc8,null));};exports['destroy']=function(_0x18f0e0,_0x2bbb25){return db[_0x46f4('0x2a')]['find']({'where':{'id':_0x18f0e0[_0x46f4('0x41')]['id']}})[_0x46f4('0x24')](handleEntityNotFound(_0x2bbb25,null))[_0x46f4('0x24')](removeEntity(_0x2bbb25,null))[_0x46f4('0x40')](handleError(_0x2bbb25,null));};exports['describe']=function(_0x26f39a,_0x478dd7){return db[_0x46f4('0x2a')][_0x46f4('0x48')]()[_0x46f4('0x24')](respondWithResult(_0x478dd7,null))['catch'](handleError(_0x478dd7,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b24ba16..420cbd5 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x58efa6,_0x2c00bd){var _0x5d643c=function(_0x1d1ef2){while(--_0x1d1ef2){_0x58efa6['push'](_0x58efa6['shift']());}};_0x5d643c(++_0x2c00bd);}(_0xe706,0xa3));var _0x6e70=function(_0x4144ef,_0x3ed22b){_0x4144ef=_0x4144ef-0x0;var _0x3691ba=_0xe706[_0x4144ef];return _0x3691ba;};'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 _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x50c7a2,_0x296413){var _0x3d11bb=function(_0x436128){while(--_0x436128){_0x50c7a2['push'](_0x50c7a2['shift']());}};_0x3d11bb(++_0x296413);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xcb91[_0x46efd7];return _0x5637e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1087767..37fd7f9 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 _0x5e43=['request','then','request\x20sent','debug','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','limit','UpdateChatQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0xfa600a,_0x3a32d4){var _0x5cae44=function(_0x5ab4b9){while(--_0x5ab4b9){_0xfa600a['push'](_0xfa600a['shift']());}};_0x5cae44(++_0x3a32d4);}(_0x5e43,0x1f2));var _0x35e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e43[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x35e4('0x0'));var util=require(_0x35e4('0x1'));var moment=require(_0x35e4('0x2'));var BPromise=require('bluebird');var rs=require(_0x35e4('0x3'));var fs=require('fs');var Redis=require(_0x35e4('0x4'));var db=require(_0x35e4('0x5'))['db'];var utils=require(_0x35e4('0x6'));var logger=require(_0x35e4('0x7'))('rpc');var config=require(_0x35e4('0x8'));var jayson=require(_0x35e4('0x9'));var client=jayson[_0x35e4('0xa')][_0x35e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1be59b,_0x398c03,_0x422baa){return new BPromise(function(_0x2304fa,_0x193159){return client[_0x35e4('0xc')](_0x1be59b,_0x422baa)[_0x35e4('0xd')](function(_0x17619e){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x398c03,_0x35e4('0xe'));logger[_0x35e4('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x398c03,'request\x20sent',JSON[_0x35e4('0x10')](_0x17619e));if(_0x17619e['error']){if(_0x17619e[_0x35e4('0x11')][_0x35e4('0x12')]===0x1f4){logger['error'](_0x35e4('0x13'),_0x398c03,_0x17619e['error']['message']);return _0x193159(_0x17619e[_0x35e4('0x11')]['message']);}logger[_0x35e4('0x11')](_0x35e4('0x13'),_0x398c03,_0x17619e[_0x35e4('0x11')][_0x35e4('0x14')]);return _0x2304fa(_0x17619e[_0x35e4('0x11')][_0x35e4('0x14')]);}else{logger[_0x35e4('0x15')](_0x35e4('0x13'),_0x398c03,_0x35e4('0xe'));_0x2304fa(_0x17619e[_0x35e4('0x16')][_0x35e4('0x14')]);}})[_0x35e4('0x17')](function(_0x17cbdc){logger[_0x35e4('0x11')](_0x35e4('0x13'),_0x398c03,_0x17cbdc);_0x193159(_0x17cbdc);});});}exports[_0x35e4('0x18')]=function(_0x307485){var _0x3dcf89=this;return new Promise(function(_0x556fe6,_0xc6565a){return db[_0x35e4('0x19')][_0x35e4('0x1a')](_0x307485[_0x35e4('0x1b')],{'raw':_0x307485[_0x35e4('0x1c')]?_0x307485[_0x35e4('0x1c')][_0x35e4('0x1d')]===undefined?!![]:![]:!![]})[_0x35e4('0xd')](function(_0x45c8d7){logger['info'](_0x35e4('0x18'),_0x307485);logger[_0x35e4('0xf')]('CreateChatQueueReport',_0x307485,JSON[_0x35e4('0x10')](_0x45c8d7));_0x556fe6(_0x45c8d7);})[_0x35e4('0x17')](function(_0x2d8fef){logger[_0x35e4('0x11')](_0x35e4('0x18'),_0x2d8fef[_0x35e4('0x14')],_0x307485);_0xc6565a(_0x3dcf89[_0x35e4('0x11')](0x1f4,_0x2d8fef[_0x35e4('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x239c6a){var _0x1b138f=this;return new Promise(function(_0x3eda5a,_0x15e76d){return db[_0x35e4('0x19')][_0x35e4('0x1e')](_0x239c6a['body'],{'raw':_0x239c6a[_0x35e4('0x1c')]?_0x239c6a[_0x35e4('0x1c')][_0x35e4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x239c6a['options']?_0x239c6a['options'][_0x35e4('0x1f')]||null:null,'attributes':_0x239c6a[_0x35e4('0x1c')]?_0x239c6a[_0x35e4('0x1c')]['attributes']||null:null,'limit':_0x239c6a[_0x35e4('0x1c')]?_0x239c6a['options'][_0x35e4('0x20')]||null:null})[_0x35e4('0xd')](function(_0x24ca0e){logger['info'](_0x35e4('0x21'),_0x239c6a);logger['debug']('UpdateChatQueueReport',_0x239c6a,JSON[_0x35e4('0x10')](_0x24ca0e));_0x3eda5a(_0x24ca0e);})[_0x35e4('0x17')](function(_0x59c3eb){logger['error'](_0x35e4('0x21'),_0x59c3eb['message'],_0x239c6a);_0x15e76d(_0x1b138f[_0x35e4('0x11')](0x1f4,_0x59c3eb[_0x35e4('0x14')]));});});}; \ No newline at end of file +var _0x38f9=['catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','limit','UpdateChatQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x3cc3c6,_0x39c09b){var _0x19d856=function(_0x19ca85){while(--_0x19ca85){_0x3cc3c6['push'](_0x3cc3c6['shift']());}};_0x19d856(++_0x39c09b);}(_0x38f9,0x1af));var _0x938f=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x38f9[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x938f('0x0'));var util=require(_0x938f('0x1'));var moment=require(_0x938f('0x2'));var BPromise=require('bluebird');var rs=require(_0x938f('0x3'));var fs=require('fs');var Redis=require(_0x938f('0x4'));var db=require(_0x938f('0x5'))['db'];var utils=require(_0x938f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x938f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x938f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x275a93,_0x345bfd,_0x439921){return new BPromise(function(_0xf2db39,_0x3c9fb6){return client['request'](_0x275a93,_0x439921)[_0x938f('0x9')](function(_0x355eee){logger[_0x938f('0xa')](_0x938f('0xb'),_0x345bfd,_0x938f('0xc'));logger[_0x938f('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x345bfd,_0x938f('0xc'),JSON[_0x938f('0xe')](_0x355eee));if(_0x355eee['error']){if(_0x355eee[_0x938f('0xf')][_0x938f('0x10')]===0x1f4){logger[_0x938f('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x345bfd,_0x355eee[_0x938f('0xf')][_0x938f('0x11')]);return _0x3c9fb6(_0x355eee[_0x938f('0xf')][_0x938f('0x11')]);}logger[_0x938f('0xf')](_0x938f('0xb'),_0x345bfd,_0x355eee['error']['message']);return _0xf2db39(_0x355eee[_0x938f('0xf')]['message']);}else{logger['info'](_0x938f('0xb'),_0x345bfd,_0x938f('0xc'));_0xf2db39(_0x355eee[_0x938f('0x12')][_0x938f('0x11')]);}})[_0x938f('0x13')](function(_0x4bdcb3){logger[_0x938f('0xf')](_0x938f('0xb'),_0x345bfd,_0x4bdcb3);_0x3c9fb6(_0x4bdcb3);});});}exports[_0x938f('0x14')]=function(_0x1dbdce){var _0x55116c=this;return new Promise(function(_0x5915a5,_0x314709){return db[_0x938f('0x15')][_0x938f('0x16')](_0x1dbdce[_0x938f('0x17')],{'raw':_0x1dbdce[_0x938f('0x18')]?_0x1dbdce['options'][_0x938f('0x19')]===undefined?!![]:![]:!![]})[_0x938f('0x9')](function(_0x54394c){logger['info']('CreateChatQueueReport',_0x1dbdce);logger[_0x938f('0xd')](_0x938f('0x14'),_0x1dbdce,JSON[_0x938f('0xe')](_0x54394c));_0x5915a5(_0x54394c);})['catch'](function(_0x44001e){logger[_0x938f('0xf')](_0x938f('0x14'),_0x44001e[_0x938f('0x11')],_0x1dbdce);_0x314709(_0x55116c['error'](0x1f4,_0x44001e['message']));});});};exports['UpdateChatQueueReport']=function(_0x2f6ba7){var _0x52e0d=this;return new Promise(function(_0x230375,_0x9e1cc8){return db['ChatQueueReport'][_0x938f('0x1a')](_0x2f6ba7[_0x938f('0x17')],{'raw':_0x2f6ba7[_0x938f('0x18')]?_0x2f6ba7[_0x938f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f6ba7[_0x938f('0x18')]?_0x2f6ba7[_0x938f('0x18')][_0x938f('0x1b')]||null:null,'attributes':_0x2f6ba7[_0x938f('0x18')]?_0x2f6ba7[_0x938f('0x18')]['attributes']||null:null,'limit':_0x2f6ba7[_0x938f('0x18')]?_0x2f6ba7[_0x938f('0x18')][_0x938f('0x1c')]||null:null})[_0x938f('0x9')](function(_0x2c5d38){logger[_0x938f('0xa')](_0x938f('0x1d'),_0x2f6ba7);logger[_0x938f('0xd')](_0x938f('0x1d'),_0x2f6ba7,JSON[_0x938f('0xe')](_0x2c5d38));_0x230375(_0x2c5d38);})[_0x938f('0x13')](function(_0x1c160b){logger[_0x938f('0xf')]('UpdateChatQueueReport',_0x1c160b['message'],_0x2f6ba7);_0x9e1cc8(_0x52e0d['error'](0x1f4,_0x1c160b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2eaff8c..867b453 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 _0x9c11=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x389c5a,_0x17ea2a){var _0xf823b=function(_0x133de6){while(--_0x133de6){_0x389c5a['push'](_0x389c5a['shift']());}};_0xf823b(++_0x17ea2a);}(_0x9c11,0x196));var _0x19c1=function(_0x28f182,_0x3d35d5){_0x28f182=_0x28f182-0x0;var _0xaa7f9d=_0x9c11[_0x28f182];return _0xaa7f9d;};'use strict';var multer=require(_0x19c1('0x0'));var util=require(_0x19c1('0x1'));var path=require(_0x19c1('0x2'));var timeout=require(_0x19c1('0x3'));var express=require('express');var router=express[_0x19c1('0x4')]();var fs_extra=require(_0x19c1('0x5'));var auth=require(_0x19c1('0x6'));var interaction=require(_0x19c1('0x7'));var config=require('../../config/environment');var controller=require(_0x19c1('0x8'));router[_0x19c1('0x9')]('/',auth[_0x19c1('0xa')](),controller[_0x19c1('0xb')]);router[_0x19c1('0x9')](_0x19c1('0xc'),auth[_0x19c1('0xa')](),controller['describe']);router[_0x19c1('0x9')](_0x19c1('0xd'),auth[_0x19c1('0xa')](),controller[_0x19c1('0xe')]);router[_0x19c1('0xf')]('/',auth[_0x19c1('0xa')](),controller[_0x19c1('0x10')]);router['put'](_0x19c1('0xd'),auth[_0x19c1('0xa')](),controller[_0x19c1('0x11')]);router[_0x19c1('0x12')]('/:id',auth[_0x19c1('0xa')](),controller[_0x19c1('0x13')]);module[_0x19c1('0x14')]=router; \ No newline at end of file +var _0x4f52=['express','Router','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x5a3737,_0x3bf296){var _0x1e7fb8=function(_0x372a18){while(--_0x372a18){_0x5a3737['push'](_0x5a3737['shift']());}};_0x1e7fb8(++_0x3bf296);}(_0x4f52,0x6f));var _0x24f5=function(_0x201153,_0x1db225){_0x201153=_0x201153-0x0;var _0x3a2a8e=_0x4f52[_0x201153];return _0x3a2a8e;};'use strict';var multer=require(_0x24f5('0x0'));var util=require(_0x24f5('0x1'));var path=require('path');var timeout=require(_0x24f5('0x2'));var express=require(_0x24f5('0x3'));var router=express[_0x24f5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x24f5('0x5'));var config=require('../../config/environment');var controller=require(_0x24f5('0x6'));router[_0x24f5('0x7')]('/',auth[_0x24f5('0x8')](),controller[_0x24f5('0x9')]);router['get'](_0x24f5('0xa'),auth[_0x24f5('0x8')](),controller['describe']);router['get'](_0x24f5('0xb'),auth[_0x24f5('0x8')](),controller[_0x24f5('0xc')]);router[_0x24f5('0xd')]('/',auth[_0x24f5('0x8')](),controller[_0x24f5('0xe')]);router[_0x24f5('0xf')]('/:id',auth[_0x24f5('0x8')](),controller[_0x24f5('0x10')]);router[_0x24f5('0x11')](_0x24f5('0xb'),auth['isAuthenticated'](),controller[_0x24f5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 85de397..5ef1499 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xa1db73,_0x48bb81){var _0x19d714=function(_0x4773ab){while(--_0x4773ab){_0xa1db73['push'](_0xa1db73['shift']());}};_0x19d714(++_0x48bb81);}(_0xf4eb,0xec));var _0xbf4e=function(_0xc646e1,_0x21de56){_0xc646e1=_0xc646e1-0x0;var _0x4880a8=_0xf4eb[_0xc646e1];return _0x4880a8;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5af89d,_0xa40ecd){var _0x44e390=function(_0x296473){while(--_0x296473){_0x5af89d['push'](_0x5af89d['shift']());}};_0x44e390(++_0xa40ecd);}(_0x34e8,0x12c));var _0x834e=function(_0x40dd6a,_0x15332f){_0x40dd6a=_0x40dd6a-0x0;var _0x2be2fa=_0x34e8[_0x40dd6a];return _0x2be2fa;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index c3f12ec..3980c83 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 _0xc4b9=['create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find'];(function(_0x2c7644,_0x32a74c){var _0x34df97=function(_0x38a5fe){while(--_0x38a5fe){_0x2c7644['push'](_0x2c7644['shift']());}};_0x34df97(++_0x32a74c);}(_0xc4b9,0x12f));var _0x9c4b=function(_0x109524,_0x2b02e9){_0x109524=_0x109524-0x0;var _0x1906f8=_0xc4b9[_0x109524];return _0x1906f8;};'use strict';var emlformat=require(_0x9c4b('0x0'));var rimraf=require(_0x9c4b('0x1'));var zipdir=require(_0x9c4b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c4b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9c4b('0x4'));var util=require('util');var path=require(_0x9c4b('0x5'));var sox=require(_0x9c4b('0x6'));var csv=require('to-csv');var ejs=require(_0x9c4b('0x7'));var fs=require('fs');var fs_extra=require(_0x9c4b('0x8'));var _=require(_0x9c4b('0x9'));var squel=require(_0x9c4b('0xa'));var crypto=require(_0x9c4b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9c4b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9c4b('0xd'));var Papa=require(_0x9c4b('0xe'));var Redis=require(_0x9c4b('0xf'));var authService=require(_0x9c4b('0x10'));var qs=require(_0x9c4b('0x11'));var as=require(_0x9c4b('0x12'));var hardwareService=require(_0x9c4b('0x13'));var logger=require('../../config/logger')(_0x9c4b('0x14'));var utils=require(_0x9c4b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9c4b('0x16'));var db=require(_0x9c4b('0x17'))['db'];function respondWithStatusCode(_0x3b34a3,_0x12b587){_0x12b587=_0x12b587||0xcc;return function(_0x3c7142){if(_0x3c7142){return _0x3b34a3['sendStatus'](_0x12b587);}return _0x3b34a3[_0x9c4b('0x18')](_0x12b587)[_0x9c4b('0x19')]();};}function respondWithResult(_0x414043,_0x4ca1f2){_0x4ca1f2=_0x4ca1f2||0xc8;return function(_0xb59371){if(_0xb59371){return _0x414043[_0x9c4b('0x18')](_0x4ca1f2)[_0x9c4b('0x1a')](_0xb59371);}};}function respondWithFilteredResult(_0x2a7c93,_0x785de0){return function(_0x32e9e8){if(_0x32e9e8){var _0x19c6e5=typeof _0x785de0[_0x9c4b('0x1b')]===_0x9c4b('0x1c')&&typeof _0x785de0[_0x9c4b('0x1d')]===_0x9c4b('0x1c');var _0x7126b9=_0x32e9e8['count'];var _0x1a8d8a=_0x19c6e5?0x0:_0x785de0['offset'];var _0x4bd8e4=_0x19c6e5?_0x32e9e8[_0x9c4b('0x1e')]:_0x785de0[_0x9c4b('0x1b')]+_0x785de0[_0x9c4b('0x1d')];var _0x2ef194;if(_0x4bd8e4>=_0x7126b9){_0x4bd8e4=_0x7126b9;_0x2ef194=0xc8;}else{_0x2ef194=0xce;}_0x2a7c93[_0x9c4b('0x18')](_0x2ef194);return _0x2a7c93[_0x9c4b('0x1f')]('Content-Range',_0x1a8d8a+'-'+_0x4bd8e4+'/'+_0x7126b9)[_0x9c4b('0x1a')](_0x32e9e8);}return null;};}function patchUpdates(_0x405ac6){return function(_0x44af83){try{jsonpatch['apply'](_0x44af83,_0x405ac6,!![]);}catch(_0x14cf92){return BPromise[_0x9c4b('0x20')](_0x14cf92);}return _0x44af83[_0x9c4b('0x21')]();};}function saveUpdates(_0x2e6083,_0x478361){return function(_0x125fe5){if(_0x125fe5){return _0x125fe5[_0x9c4b('0x22')](_0x2e6083)[_0x9c4b('0x23')](function(_0xb3ac2b){return _0xb3ac2b;});}return null;};}function removeEntity(_0x47f04a,_0x334cde){return function(_0x490644){if(_0x490644){return _0x490644[_0x9c4b('0x24')]()['then'](function(){_0x47f04a[_0x9c4b('0x18')](0xcc)[_0x9c4b('0x19')]();});}};}function handleEntityNotFound(_0x83a552,_0xe9f1f7){return function(_0x39b445){if(!_0x39b445){_0x83a552[_0x9c4b('0x25')](0x194);}return _0x39b445;};}function handleError(_0x27c49f,_0x17a883){_0x17a883=_0x17a883||0x1f4;return function(_0x3c79e3){logger[_0x9c4b('0x26')](_0x3c79e3[_0x9c4b('0x27')]);if(_0x3c79e3[_0x9c4b('0x28')]){delete _0x3c79e3['name'];}_0x27c49f[_0x9c4b('0x18')](_0x17a883)[_0x9c4b('0x29')](_0x3c79e3);};}exports['index']=function(_0x1217da,_0x2d2e2c){var _0x3f94ac={},_0x297143={},_0x36e51f={'count':0x0,'rows':[]};var _0x345c29=_['map'](db[_0x9c4b('0x2a')][_0x9c4b('0x2b')],function(_0x206369){return{'name':_0x206369[_0x9c4b('0x2c')],'type':_0x206369[_0x9c4b('0x2d')][_0x9c4b('0x2e')]};});_0x297143[_0x9c4b('0x2f')]=_[_0x9c4b('0x30')](_0x345c29,_0x9c4b('0x28'));_0x297143[_0x9c4b('0x31')]=_[_0x9c4b('0x32')](_0x1217da[_0x9c4b('0x31')]);_0x297143['filters']=_[_0x9c4b('0x33')](_0x297143[_0x9c4b('0x2f')],_0x297143['query']);_0x3f94ac['attributes']=_['intersection'](_0x297143[_0x9c4b('0x2f')],qs['fields'](_0x1217da['query'][_0x9c4b('0x34')]));_0x3f94ac[_0x9c4b('0x35')]=_0x3f94ac[_0x9c4b('0x35')]['length']?_0x3f94ac['attributes']:_0x297143[_0x9c4b('0x2f')];if(!_0x1217da[_0x9c4b('0x31')][_0x9c4b('0x36')](_0x9c4b('0x37'))){_0x3f94ac[_0x9c4b('0x1d')]=qs['limit'](_0x1217da['query']['limit']);_0x3f94ac[_0x9c4b('0x1b')]=qs[_0x9c4b('0x1b')](_0x1217da[_0x9c4b('0x31')][_0x9c4b('0x1b')]);}_0x3f94ac['order']=qs[_0x9c4b('0x38')](_0x1217da[_0x9c4b('0x31')]['sort']);_0x3f94ac[_0x9c4b('0x39')]=qs[_0x9c4b('0x3a')](_['pick'](_0x1217da[_0x9c4b('0x31')],_0x297143[_0x9c4b('0x3a')]),_0x345c29);if(_0x1217da[_0x9c4b('0x31')][_0x9c4b('0x3b')]){_0x3f94ac['where']=_[_0x9c4b('0x3c')](_0x3f94ac[_0x9c4b('0x39')],{'$or':_[_0x9c4b('0x30')](_0x345c29,function(_0x34eff2){if(_0x34eff2[_0x9c4b('0x2d')]!==_0x9c4b('0x3d')){var _0x22f736={};_0x22f736[_0x34eff2['name']]={'$like':'%'+_0x1217da[_0x9c4b('0x31')][_0x9c4b('0x3b')]+'%'};return _0x22f736;}})});}_0x3f94ac=_[_0x9c4b('0x3c')]({},_0x3f94ac,_0x1217da['options']);var _0x3de291={'where':_0x3f94ac['where']};return db[_0x9c4b('0x2a')][_0x9c4b('0x1e')](_0x3de291)[_0x9c4b('0x23')](function(_0x294118){_0x36e51f[_0x9c4b('0x1e')]=_0x294118;if(_0x1217da[_0x9c4b('0x31')][_0x9c4b('0x3e')]){_0x3f94ac[_0x9c4b('0x3f')]=[{'all':!![]}];}return db[_0x9c4b('0x2a')][_0x9c4b('0x40')](_0x3f94ac);})[_0x9c4b('0x23')](function(_0x42638b){_0x36e51f[_0x9c4b('0x41')]=_0x42638b;return _0x36e51f;})[_0x9c4b('0x23')](respondWithFilteredResult(_0x2d2e2c,_0x3f94ac))[_0x9c4b('0x42')](handleError(_0x2d2e2c,null));};exports[_0x9c4b('0x43')]=function(_0x128806,_0x2f5ff3){var _0x4bdf92={'raw':!![],'where':{'id':_0x128806[_0x9c4b('0x44')]['id']}},_0x3fa303={};_0x3fa303[_0x9c4b('0x2f')]=_[_0x9c4b('0x32')](db[_0x9c4b('0x2a')][_0x9c4b('0x2b')]);_0x3fa303[_0x9c4b('0x31')]=_[_0x9c4b('0x32')](_0x128806[_0x9c4b('0x31')]);_0x3fa303['filters']=_[_0x9c4b('0x33')](_0x3fa303['model'],_0x3fa303[_0x9c4b('0x31')]);_0x4bdf92[_0x9c4b('0x35')]=_[_0x9c4b('0x33')](_0x3fa303[_0x9c4b('0x2f')],qs[_0x9c4b('0x34')](_0x128806[_0x9c4b('0x31')][_0x9c4b('0x34')]));_0x4bdf92[_0x9c4b('0x35')]=_0x4bdf92[_0x9c4b('0x35')][_0x9c4b('0x45')]?_0x4bdf92['attributes']:_0x3fa303[_0x9c4b('0x2f')];if(_0x128806[_0x9c4b('0x31')][_0x9c4b('0x3e')]){_0x4bdf92[_0x9c4b('0x3f')]=[{'all':!![]}];}_0x4bdf92=_[_0x9c4b('0x3c')]({},_0x4bdf92,_0x128806[_0x9c4b('0x46')]);return db[_0x9c4b('0x2a')][_0x9c4b('0x47')](_0x4bdf92)[_0x9c4b('0x23')](handleEntityNotFound(_0x2f5ff3,null))[_0x9c4b('0x23')](respondWithResult(_0x2f5ff3,null))[_0x9c4b('0x42')](handleError(_0x2f5ff3,null));};exports[_0x9c4b('0x48')]=function(_0x19ecc9,_0x5afc01){return db[_0x9c4b('0x2a')][_0x9c4b('0x48')](_0x19ecc9['body'],{})[_0x9c4b('0x23')](respondWithResult(_0x5afc01,0xc9))[_0x9c4b('0x42')](handleError(_0x5afc01,null));};exports[_0x9c4b('0x22')]=function(_0x2401bd,_0x5d910d){if(_0x2401bd[_0x9c4b('0x49')]['id']){delete _0x2401bd[_0x9c4b('0x49')]['id'];}return db[_0x9c4b('0x2a')]['find']({'where':{'id':_0x2401bd[_0x9c4b('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d910d,null))[_0x9c4b('0x23')](saveUpdates(_0x2401bd[_0x9c4b('0x49')],null))['then'](respondWithResult(_0x5d910d,null))[_0x9c4b('0x42')](handleError(_0x5d910d,null));};exports[_0x9c4b('0x24')]=function(_0x3c7378,_0x1d8746){return db['ChatTransferReport'][_0x9c4b('0x47')]({'where':{'id':_0x3c7378[_0x9c4b('0x44')]['id']}})[_0x9c4b('0x23')](handleEntityNotFound(_0x1d8746,null))[_0x9c4b('0x23')](removeEntity(_0x1d8746,null))[_0x9c4b('0x42')](handleError(_0x1d8746,null));};exports[_0x9c4b('0x4a')]=function(_0x37747a,_0x1e2602){return db[_0x9c4b('0x2a')][_0x9c4b('0x4a')]()['then'](respondWithResult(_0x1e2602,null))[_0x9c4b('0x42')](handleError(_0x1e2602,null));}; \ No newline at end of file +var _0xfe44=['name','index','fieldName','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','ChatTransferReport','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set','Content-Range','json','reject','save','update','then','end','stack'];(function(_0x8c567e,_0x21c0c2){var _0xed00f0=function(_0x3bd9ab){while(--_0x3bd9ab){_0x8c567e['push'](_0x8c567e['shift']());}};_0xed00f0(++_0x21c0c2);}(_0xfe44,0x1b5));var _0x4fe4=function(_0x2b547d,_0x39b277){_0x2b547d=_0x2b547d-0x0;var _0x29caaa=_0xfe44[_0x2b547d];return _0x29caaa;};'use strict';var emlformat=require(_0x4fe4('0x0'));var rimraf=require(_0x4fe4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4fe4('0x2'));var rp=require(_0x4fe4('0x3'));var moment=require(_0x4fe4('0x4'));var BPromise=require(_0x4fe4('0x5'));var Mustache=require(_0x4fe4('0x6'));var util=require(_0x4fe4('0x7'));var path=require(_0x4fe4('0x8'));var sox=require(_0x4fe4('0x9'));var csv=require(_0x4fe4('0xa'));var ejs=require(_0x4fe4('0xb'));var fs=require('fs');var fs_extra=require(_0x4fe4('0xc'));var _=require(_0x4fe4('0xd'));var squel=require(_0x4fe4('0xe'));var crypto=require(_0x4fe4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4fe4('0x10'));var toCsv=require(_0x4fe4('0xa'));var querystring=require(_0x4fe4('0x11'));var Papa=require('papaparse');var Redis=require(_0x4fe4('0x12'));var authService=require(_0x4fe4('0x13'));var qs=require(_0x4fe4('0x14'));var as=require(_0x4fe4('0x15'));var hardwareService=require(_0x4fe4('0x16'));var logger=require(_0x4fe4('0x17'))(_0x4fe4('0x18'));var utils=require(_0x4fe4('0x19'));var config=require(_0x4fe4('0x1a'));var licenseUtil=require(_0x4fe4('0x1b'));var db=require(_0x4fe4('0x1c'))['db'];function respondWithStatusCode(_0x482105,_0x447594){_0x447594=_0x447594||0xcc;return function(_0x48ba45){if(_0x48ba45){return _0x482105[_0x4fe4('0x1d')](_0x447594);}return _0x482105[_0x4fe4('0x1e')](_0x447594)['end']();};}function respondWithResult(_0x2144f7,_0x2cbc62){_0x2cbc62=_0x2cbc62||0xc8;return function(_0x2a8071){if(_0x2a8071){return _0x2144f7[_0x4fe4('0x1e')](_0x2cbc62)['json'](_0x2a8071);}};}function respondWithFilteredResult(_0x18a6e5,_0x444c97){return function(_0x407b08){if(_0x407b08){var _0xe7d24c=typeof _0x444c97['offset']==='undefined'&&typeof _0x444c97[_0x4fe4('0x1f')]==='undefined';var _0x3aac75=_0x407b08[_0x4fe4('0x20')];var _0x22cae7=_0xe7d24c?0x0:_0x444c97[_0x4fe4('0x21')];var _0x502984=_0xe7d24c?_0x407b08[_0x4fe4('0x20')]:_0x444c97[_0x4fe4('0x21')]+_0x444c97[_0x4fe4('0x1f')];var _0x14a108;if(_0x502984>=_0x3aac75){_0x502984=_0x3aac75;_0x14a108=0xc8;}else{_0x14a108=0xce;}_0x18a6e5[_0x4fe4('0x1e')](_0x14a108);return _0x18a6e5[_0x4fe4('0x22')](_0x4fe4('0x23'),_0x22cae7+'-'+_0x502984+'/'+_0x3aac75)[_0x4fe4('0x24')](_0x407b08);}return null;};}function patchUpdates(_0x3f3932){return function(_0x328bd5){try{jsonpatch['apply'](_0x328bd5,_0x3f3932,!![]);}catch(_0x2645d2){return BPromise[_0x4fe4('0x25')](_0x2645d2);}return _0x328bd5[_0x4fe4('0x26')]();};}function saveUpdates(_0x48dd21,_0x474ec9){return function(_0xf045e3){if(_0xf045e3){return _0xf045e3[_0x4fe4('0x27')](_0x48dd21)[_0x4fe4('0x28')](function(_0x13660b){return _0x13660b;});}return null;};}function removeEntity(_0x22f27e,_0x19fb6e){return function(_0x2efcf7){if(_0x2efcf7){return _0x2efcf7['destroy']()[_0x4fe4('0x28')](function(){_0x22f27e[_0x4fe4('0x1e')](0xcc)[_0x4fe4('0x29')]();});}};}function handleEntityNotFound(_0x1e91cc,_0x661622){return function(_0x45a6e2){if(!_0x45a6e2){_0x1e91cc[_0x4fe4('0x1d')](0x194);}return _0x45a6e2;};}function handleError(_0x16464c,_0x59051f){_0x59051f=_0x59051f||0x1f4;return function(_0x45c466){logger['error'](_0x45c466[_0x4fe4('0x2a')]);if(_0x45c466[_0x4fe4('0x2b')]){delete _0x45c466[_0x4fe4('0x2b')];}_0x16464c[_0x4fe4('0x1e')](_0x59051f)['send'](_0x45c466);};}exports[_0x4fe4('0x2c')]=function(_0x1f58bf,_0x440571){var _0x2059ee={},_0x44cd7f={},_0x2b19ec={'count':0x0,'rows':[]};var _0x1c72d0=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x292f35){return{'name':_0x292f35[_0x4fe4('0x2d')],'type':_0x292f35['type'][_0x4fe4('0x2e')]};});_0x44cd7f[_0x4fe4('0x2f')]=_['map'](_0x1c72d0,'name');_0x44cd7f['query']=_[_0x4fe4('0x30')](_0x1f58bf[_0x4fe4('0x31')]);_0x44cd7f['filters']=_[_0x4fe4('0x32')](_0x44cd7f[_0x4fe4('0x2f')],_0x44cd7f[_0x4fe4('0x31')]);_0x2059ee[_0x4fe4('0x33')]=_[_0x4fe4('0x32')](_0x44cd7f[_0x4fe4('0x2f')],qs[_0x4fe4('0x34')](_0x1f58bf['query'][_0x4fe4('0x34')]));_0x2059ee[_0x4fe4('0x33')]=_0x2059ee[_0x4fe4('0x33')]['length']?_0x2059ee[_0x4fe4('0x33')]:_0x44cd7f[_0x4fe4('0x2f')];if(!_0x1f58bf[_0x4fe4('0x31')]['hasOwnProperty'](_0x4fe4('0x35'))){_0x2059ee[_0x4fe4('0x1f')]=qs[_0x4fe4('0x1f')](_0x1f58bf['query'][_0x4fe4('0x1f')]);_0x2059ee['offset']=qs[_0x4fe4('0x21')](_0x1f58bf['query'][_0x4fe4('0x21')]);}_0x2059ee[_0x4fe4('0x36')]=qs[_0x4fe4('0x37')](_0x1f58bf[_0x4fe4('0x31')][_0x4fe4('0x37')]);_0x2059ee[_0x4fe4('0x38')]=qs[_0x4fe4('0x39')](_[_0x4fe4('0x3a')](_0x1f58bf[_0x4fe4('0x31')],_0x44cd7f['filters']),_0x1c72d0);if(_0x1f58bf['query'][_0x4fe4('0x3b')]){_0x2059ee[_0x4fe4('0x38')]=_[_0x4fe4('0x3c')](_0x2059ee['where'],{'$or':_[_0x4fe4('0x3d')](_0x1c72d0,function(_0x1ba478){if(_0x1ba478[_0x4fe4('0x3e')]!==_0x4fe4('0x3f')){var _0x39bf1c={};_0x39bf1c[_0x1ba478[_0x4fe4('0x2b')]]={'$like':'%'+_0x1f58bf[_0x4fe4('0x31')][_0x4fe4('0x3b')]+'%'};return _0x39bf1c;}})});}_0x2059ee=_['merge']({},_0x2059ee,_0x1f58bf[_0x4fe4('0x40')]);var _0x52cda0={'where':_0x2059ee[_0x4fe4('0x38')]};return db['ChatTransferReport'][_0x4fe4('0x20')](_0x52cda0)[_0x4fe4('0x28')](function(_0x11d72b){_0x2b19ec[_0x4fe4('0x20')]=_0x11d72b;if(_0x1f58bf[_0x4fe4('0x31')][_0x4fe4('0x41')]){_0x2059ee[_0x4fe4('0x42')]=[{'all':!![]}];}return db[_0x4fe4('0x43')][_0x4fe4('0x44')](_0x2059ee);})[_0x4fe4('0x28')](function(_0xaab45){_0x2b19ec[_0x4fe4('0x45')]=_0xaab45;return _0x2b19ec;})[_0x4fe4('0x28')](respondWithFilteredResult(_0x440571,_0x2059ee))[_0x4fe4('0x46')](handleError(_0x440571,null));};exports[_0x4fe4('0x47')]=function(_0x5b64b4,_0x32117f){var _0x479003={'raw':!![],'where':{'id':_0x5b64b4['params']['id']}},_0x4db113={};_0x4db113[_0x4fe4('0x2f')]=_['keys'](db[_0x4fe4('0x43')][_0x4fe4('0x48')]);_0x4db113[_0x4fe4('0x31')]=_['keys'](_0x5b64b4[_0x4fe4('0x31')]);_0x4db113[_0x4fe4('0x39')]=_[_0x4fe4('0x32')](_0x4db113['model'],_0x4db113['query']);_0x479003[_0x4fe4('0x33')]=_[_0x4fe4('0x32')](_0x4db113['model'],qs[_0x4fe4('0x34')](_0x5b64b4[_0x4fe4('0x31')]['fields']));_0x479003['attributes']=_0x479003[_0x4fe4('0x33')][_0x4fe4('0x49')]?_0x479003[_0x4fe4('0x33')]:_0x4db113[_0x4fe4('0x2f')];if(_0x5b64b4[_0x4fe4('0x31')][_0x4fe4('0x41')]){_0x479003[_0x4fe4('0x42')]=[{'all':!![]}];}_0x479003=_[_0x4fe4('0x3c')]({},_0x479003,_0x5b64b4[_0x4fe4('0x40')]);return db[_0x4fe4('0x43')][_0x4fe4('0x4a')](_0x479003)['then'](handleEntityNotFound(_0x32117f,null))[_0x4fe4('0x28')](respondWithResult(_0x32117f,null))[_0x4fe4('0x46')](handleError(_0x32117f,null));};exports[_0x4fe4('0x4b')]=function(_0x216193,_0x55daf5){return db[_0x4fe4('0x43')][_0x4fe4('0x4b')](_0x216193[_0x4fe4('0x4c')],{})[_0x4fe4('0x28')](respondWithResult(_0x55daf5,0xc9))[_0x4fe4('0x46')](handleError(_0x55daf5,null));};exports['update']=function(_0x19a27c,_0x47bfb7){if(_0x19a27c[_0x4fe4('0x4c')]['id']){delete _0x19a27c[_0x4fe4('0x4c')]['id'];}return db['ChatTransferReport'][_0x4fe4('0x4a')]({'where':{'id':_0x19a27c[_0x4fe4('0x4d')]['id']}})[_0x4fe4('0x28')](handleEntityNotFound(_0x47bfb7,null))[_0x4fe4('0x28')](saveUpdates(_0x19a27c[_0x4fe4('0x4c')],null))[_0x4fe4('0x28')](respondWithResult(_0x47bfb7,null))[_0x4fe4('0x46')](handleError(_0x47bfb7,null));};exports[_0x4fe4('0x4e')]=function(_0x16765d,_0x5cde39){return db[_0x4fe4('0x43')][_0x4fe4('0x4a')]({'where':{'id':_0x16765d[_0x4fe4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5cde39,null))['then'](removeEntity(_0x5cde39,null))['catch'](handleError(_0x5cde39,null));};exports[_0x4fe4('0x4f')]=function(_0x1e7780,_0x39076d){return db[_0x4fe4('0x43')]['describe']()[_0x4fe4('0x28')](respondWithResult(_0x39076d,null))[_0x4fe4('0x46')](handleError(_0x39076d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 60e2f42..5555bc3 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 _0x23bd=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash'];(function(_0x13e78d,_0x219922){var _0x1d730d=function(_0x9ca0f5){while(--_0x9ca0f5){_0x13e78d['push'](_0x13e78d['shift']());}};_0x1d730d(++_0x219922);}(_0x23bd,0x68));var _0xd23b=function(_0x370ec4,_0x22420d){_0x370ec4=_0x370ec4-0x0;var _0xeb47c0=_0x23bd[_0x370ec4];return _0xeb47c0;};'use strict';var _=require(_0xd23b('0x0'));var util=require(_0xd23b('0x1'));var logger=require(_0xd23b('0x2'))(_0xd23b('0x3'));var moment=require(_0xd23b('0x4'));var BPromise=require(_0xd23b('0x5'));var rp=require(_0xd23b('0x6'));var fs=require('fs');var path=require(_0xd23b('0x7'));var rimraf=require(_0xd23b('0x8'));var config=require(_0xd23b('0x9'));var attributes=require(_0xd23b('0xa'));module[_0xd23b('0xb')]=function(_0x10e5b6,_0x94b47e){return _0x10e5b6[_0xd23b('0xc')]('ChatTransferReport',attributes,{'tableName':_0xd23b('0xd'),'paranoid':![],'indexes':[{'name':_0xd23b('0xe'),'fields':[_0xd23b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0949=['request-promise','path','rimraf','exports','report_chat_transfer','lodash','util','../../config/logger','api'];(function(_0x18bfa5,_0x27f81c){var _0x43863d=function(_0x3cfb6b){while(--_0x3cfb6b){_0x18bfa5['push'](_0x18bfa5['shift']());}};_0x43863d(++_0x27f81c);}(_0x0949,0x1d9));var _0x9094=function(_0x4147e6,_0x57174e){_0x4147e6=_0x4147e6-0x0;var _0x3305ba=_0x0949[_0x4147e6];return _0x3305ba;};'use strict';var _=require(_0x9094('0x0'));var util=require(_0x9094('0x1'));var logger=require(_0x9094('0x2'))(_0x9094('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9094('0x4'));var fs=require('fs');var path=require(_0x9094('0x5'));var rimraf=require(_0x9094('0x6'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0x9094('0x7')]=function(_0x4af324,_0x512e07){return _0x4af324['define']('ChatTransferReport',attributes,{'tableName':_0x9094('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5547a06..5c608bf 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 _0xaf33=['client','request','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatTransferReport,\x20%s,\x20%s','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x73e5b0,_0x241ec0){var _0x23ed6f=function(_0x12825c){while(--_0x12825c){_0x73e5b0['push'](_0x73e5b0['shift']());}};_0x23ed6f(++_0x241ec0);}(_0xaf33,0x1d7));var _0x3af3=function(_0x40fe9b,_0x32c044){_0x40fe9b=_0x40fe9b-0x0;var _0x4847ad=_0xaf33[_0x40fe9b];return _0x4847ad;};'use strict';var _=require(_0x3af3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3af3('0x1'));var rs=require(_0x3af3('0x2'));var fs=require('fs');var Redis=require(_0x3af3('0x3'));var db=require(_0x3af3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3af3('0x5'))(_0x3af3('0x6'));var config=require(_0x3af3('0x7'));var jayson=require(_0x3af3('0x8'));var client=jayson[_0x3af3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2abc60,_0xd7016a,_0x48c86e){return new BPromise(function(_0x58bef6,_0x2e473f){return client[_0x3af3('0xa')](_0x2abc60,_0x48c86e)['then'](function(_0x44c6fd){logger[_0x3af3('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0xd7016a,_0x3af3('0xc'));logger[_0x3af3('0xd')](_0x3af3('0xe'),_0xd7016a,'request\x20sent',JSON[_0x3af3('0xf')](_0x44c6fd));if(_0x44c6fd[_0x3af3('0x10')]){if(_0x44c6fd[_0x3af3('0x10')][_0x3af3('0x11')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0xd7016a,_0x44c6fd[_0x3af3('0x10')][_0x3af3('0x12')]);return _0x2e473f(_0x44c6fd[_0x3af3('0x10')][_0x3af3('0x12')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0xd7016a,_0x44c6fd[_0x3af3('0x10')][_0x3af3('0x12')]);return _0x58bef6(_0x44c6fd[_0x3af3('0x10')][_0x3af3('0x12')]);}else{logger[_0x3af3('0xb')](_0x3af3('0x13'),_0xd7016a,'request\x20sent');_0x58bef6(_0x44c6fd['result'][_0x3af3('0x12')]);}})['catch'](function(_0x3f2787){logger['error'](_0x3af3('0x13'),_0xd7016a,_0x3f2787);_0x2e473f(_0x3f2787);});});} \ No newline at end of file +var _0xee33=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3bf120,_0x5eafe4){var _0x3b71ad=function(_0x2f7e83){while(--_0x2f7e83){_0x3bf120['push'](_0x3bf120['shift']());}};_0x3b71ad(++_0x5eafe4);}(_0xee33,0x1e1));var _0x3ee3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xee33[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ee3('0x0'));var BPromise=require('bluebird');var rs=require(_0x3ee3('0x1'));var fs=require('fs');var Redis=require(_0x3ee3('0x2'));var db=require(_0x3ee3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ee3('0x4'))(_0x3ee3('0x5'));var config=require(_0x3ee3('0x6'));var jayson=require(_0x3ee3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x597cba,_0x3679f8,_0x5e3126){return new BPromise(function(_0x5dd804,_0xe98a1){return client[_0x3ee3('0x8')](_0x597cba,_0x5e3126)[_0x3ee3('0x9')](function(_0x1b99c7){logger[_0x3ee3('0xa')](_0x3ee3('0xb'),_0x3679f8,_0x3ee3('0xc'));logger[_0x3ee3('0xd')](_0x3ee3('0xe'),_0x3679f8,_0x3ee3('0xc'),JSON['stringify'](_0x1b99c7));if(_0x1b99c7['error']){if(_0x1b99c7['error'][_0x3ee3('0xf')]===0x1f4){logger[_0x3ee3('0x10')](_0x3ee3('0xb'),_0x3679f8,_0x1b99c7[_0x3ee3('0x10')][_0x3ee3('0x11')]);return _0xe98a1(_0x1b99c7[_0x3ee3('0x10')][_0x3ee3('0x11')]);}logger[_0x3ee3('0x10')](_0x3ee3('0xb'),_0x3679f8,_0x1b99c7[_0x3ee3('0x10')][_0x3ee3('0x11')]);return _0x5dd804(_0x1b99c7[_0x3ee3('0x10')]['message']);}else{logger[_0x3ee3('0xa')](_0x3ee3('0xb'),_0x3679f8,_0x3ee3('0xc'));_0x5dd804(_0x1b99c7[_0x3ee3('0x12')][_0x3ee3('0x11')]);}})['catch'](function(_0x2e25fb){logger[_0x3ee3('0x10')](_0x3ee3('0xb'),_0x3679f8,_0x2e25fb);_0xe98a1(_0x2e25fb);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index fe8c325..60296b1 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 _0xa1a6=['multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','destroy'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xa1a6,0x165));var _0x6a1a=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xa1a6[_0x3207aa];return _0x51758f;};'use strict';var multer=require(_0x6a1a('0x0'));var util=require(_0x6a1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a1a('0x2'));var router=express['Router']();var fs_extra=require(_0x6a1a('0x3'));var auth=require(_0x6a1a('0x4'));var interaction=require(_0x6a1a('0x5'));var config=require(_0x6a1a('0x6'));var controller=require(_0x6a1a('0x7'));router[_0x6a1a('0x8')]('/',auth[_0x6a1a('0x9')](),controller[_0x6a1a('0xa')]);router['get'](_0x6a1a('0xb'),auth[_0x6a1a('0x9')](),controller['describe']);router[_0x6a1a('0x8')](_0x6a1a('0xc'),auth['isAuthenticated'](),controller[_0x6a1a('0xd')]);router[_0x6a1a('0xe')]('/',auth['isAuthenticated'](),controller[_0x6a1a('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x6a1a('0xc'),auth[_0x6a1a('0x9')](),controller[_0x6a1a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1e34=['./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment'];(function(_0x4489f2,_0x1f9128){var _0x5cc527=function(_0x44201f){while(--_0x44201f){_0x4489f2['push'](_0x4489f2['shift']());}};_0x5cc527(++_0x1f9128);}(_0x1e34,0x182));var _0x41e3=function(_0x1fef10,_0x13447d){_0x1fef10=_0x1fef10-0x0;var _0x548cf8=_0x1e34[_0x1fef10];return _0x548cf8;};'use strict';var multer=require(_0x41e3('0x0'));var util=require(_0x41e3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x41e3('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x41e3('0x3'));var config=require(_0x41e3('0x4'));var controller=require(_0x41e3('0x5'));router[_0x41e3('0x6')]('/',auth[_0x41e3('0x7')](),controller[_0x41e3('0x8')]);router[_0x41e3('0x6')]('/describe',auth[_0x41e3('0x7')](),controller[_0x41e3('0x9')]);router[_0x41e3('0x6')](_0x41e3('0xa'),auth[_0x41e3('0x7')](),controller['show']);router[_0x41e3('0xb')]('/',auth['isAuthenticated'](),controller[_0x41e3('0xc')]);router[_0x41e3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x41e3('0xe')]);router['delete'](_0x41e3('0xa'),auth[_0x41e3('0x7')](),controller[_0x41e3('0xf')]);module[_0x41e3('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 4cc2220..f27605c 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 _0x6fbb=['mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','onlineForm','setDataValue','textarea','Comments','offlineForm','parse','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6fbb,0x19b));var _0xb6fb=function(_0x52bdfe,_0x5282ec){_0x52bdfe=_0x52bdfe-0x0;var _0x5c6df7=_0x6fbb[_0x52bdfe];return _0x5c6df7;};'use strict';var Sequelize=require(_0xb6fb('0x0'));var rs=require(_0xb6fb('0x1'));module[_0xb6fb('0x2')]={'name':{'type':Sequelize[_0xb6fb('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xb6fb('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xb6fb('0x3')]},'mapKey':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0xb6fb('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x5')},'customerAlias':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb6fb('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb6fb('0x3')],'allowNull':![],'defaultValue':_0xb6fb('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb6fb('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb6fb('0x3')]},'animation':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb6fb('0x9')](_0xb6fb('0xa'),_0xb6fb('0xb')),'defaultValue':_0xb6fb('0xa')},'header_online':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0xc')},'start_chat_button':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0xd')},'offline_chat_button':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb6fb('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb6fb('0x10')]},'closingQuestion':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x13')},'noteTitle':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x14')},'placeholderMessage':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x15')},'closingMessage':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x16')},'closingMessageButton':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x17')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xb6fb('0x18')},'conditionAgreement':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb6fb('0x19')},'ratingType':{'type':Sequelize[_0xb6fb('0x9')](_0xb6fb('0x1a'),_0xb6fb('0x1b')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xb6fb('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb6fb('0x10')],'defaultValue':function(){return JSON[_0xb6fb('0x1c')]({'items':[{'type':_0xb6fb('0x1d'),'variable':null,'config':{'placeholder':'name','type':_0xb6fb('0x1e'),'required':!![]},'props':{'title':_0xb6fb('0x1f'),'helpText':''}},{'type':_0xb6fb('0x1d'),'props':{'title':_0xb6fb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb6fb('0x4'),'type':_0xb6fb('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb6fb('0x20')](_0xb6fb('0x21'))?JSON['parse'](this['getDataValue'](_0xb6fb('0x21'))):{};},'set':function(_0x22eecf){return this[_0xb6fb('0x22')](_0xb6fb('0x21'),JSON[_0xb6fb('0x1c')](_0x22eecf));}},'offlineForm':{'type':Sequelize[_0xb6fb('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0xb6fb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb6fb('0x4'),'type':_0xb6fb('0x4')},'variable':null},{'type':_0xb6fb('0x23'),'config':{'placeholder':_0xb6fb('0x24')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xb6fb('0x20')](_0xb6fb('0x25'))?JSON[_0xb6fb('0x26')](this['getDataValue'](_0xb6fb('0x25'))):{};},'set':function(_0x255860){return this[_0xb6fb('0x22')](_0xb6fb('0x25'),JSON[_0xb6fb('0x1c')](_0x255860));}},'token':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb6fb('0x3')]},'forwardOffline':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb6fb('0x3')]},'waitingTitle':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb6fb('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xb6fb('0x18')},'sendUnmanaged':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb6fb('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb6fb('0x10')],'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[_0xb6fb('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb6fb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x2b')},'verticalAlignment':{'type':Sequelize[_0xb6fb('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':_0xb6fb('0x2c')},'defaultTitle':{'type':Sequelize[_0xb6fb('0x3')]},'customerAvatar':{'type':Sequelize[_0xb6fb('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb6fb('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb6fb('0x3')],'allowNull':![],'defaultValue':_0xb6fb('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb6fb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb6fb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xb6fb('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb6fb('0xe')],'comment':_0xb6fb('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x516c8a){if(!_0x516c8a)this[_0xb6fb('0x22')](_0xb6fb('0x30'),null);this[_0xb6fb('0x22')]('mandatoryDisposition',_0x516c8a);}},'vidaooEscalation':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb6fb('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb6fb('0x31')},'vidaooNote':{'type':Sequelize[_0xb6fb('0x3')],'defaultValue':function(){return _0xb6fb('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xb6fb('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb6fb('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc574=['star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','textarea','Comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback'];(function(_0x44b005,_0x51199e){var _0x304f0b=function(_0x5a810e){while(--_0x5a810e){_0x44b005['push'](_0x44b005['shift']());}};_0x304f0b(++_0x51199e);}(_0xc574,0x1a3));var _0x4c57=function(_0x59773b,_0x40b836){_0x59773b=_0x59773b-0x0;var _0x5b16b4=_0xc574[_0x59773b];return _0x5b16b4;};'use strict';var Sequelize=require(_0x4c57('0x0'));var rs=require(_0x4c57('0x1'));module['exports']={'name':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![],'unique':_0x4c57('0x3')},'description':{'type':Sequelize[_0x4c57('0x2')]},'mapKey':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x4')},'mapKeyOffline':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x5')},'customerAlias':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![],'defaultValue':_0x4c57('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![],'defaultValue':_0x4c57('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x4c57('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4c57('0x2')]},'animation':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4c57('0x9')](_0x4c57('0xa'),'squared'),'defaultValue':_0x4c57('0xa')},'header_online':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4c57('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4c57('0xd')},'header_offline':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0xe')},'download_transcript':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4c57('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4c57('0x10')]},'closingQuestion':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4c57('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4c57('0x13')},'noteTitle':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x4c57('0x16'),_0x4c57('0x17')),'defaultValue':_0x4c57('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x4c57('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4c57('0x10')],'defaultValue':function(){return JSON[_0x4c57('0x18')]({'items':[{'type':_0x4c57('0x19'),'variable':null,'config':{'placeholder':'name','type':_0x4c57('0x1a'),'required':!![]},'props':{'title':_0x4c57('0x1b'),'helpText':''}},{'type':_0x4c57('0x19'),'props':{'title':_0x4c57('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4c57('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4c57('0x1c')](_0x4c57('0x1d'))?JSON[_0x4c57('0x1e')](this[_0x4c57('0x1c')](_0x4c57('0x1d'))):{};},'set':function(_0x55c7cd){return this['setDataValue'](_0x4c57('0x1d'),JSON[_0x4c57('0x18')](_0x55c7cd));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x4c57('0x18')]({'items':[{'type':_0x4c57('0x19'),'props':{'title':_0x4c57('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4c57('0x4'),'type':'email'},'variable':null},{'type':_0x4c57('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x4c57('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x4c57('0x1c')](_0x4c57('0x21'))?JSON[_0x4c57('0x1e')](this['getDataValue'](_0x4c57('0x21'))):{};},'set':function(_0x41118f){return this[_0x4c57('0x22')]('offlineForm',JSON[_0x4c57('0x18')](_0x41118f));}},'token':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':function(){return rs[_0x4c57('0x23')]();}},'autoclose':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x24')},'waitingMessage':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x25')},'offlineMessageBody':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4c57('0x27')},'skipUnmanaged':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x28')},'sendUnmanaged':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4c57('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4c57('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4c57('0x10')],'defaultValue':function(){return _0x4c57('0x29');}},'notificationSound':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x2a')},'verticalAlignment':{'type':Sequelize[_0x4c57('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':_0x4c57('0x2b')},'defaultTitle':{'type':Sequelize[_0x4c57('0x2')]},'customerAvatar':{'type':Sequelize[_0x4c57('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4c57('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4c57('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4c57('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x4c57('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4c57('0x7')],'comment':_0x4c57('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4c57('0x2d'),'set':function(_0x363d15){if(!_0x363d15)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x4c57('0x22')](_0x4c57('0x2e'),_0x363d15);}},'vidaooEscalation':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4c57('0x2')]},'vidaooTopic':{'type':Sequelize[_0x4c57('0x2')],'allowNull':![],'defaultValue':_0x4c57('0x2f')},'vidaooNote':{'type':Sequelize[_0x4c57('0x2')],'defaultValue':function(){return _0x4c57('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x4c57('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4c57('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4c57('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 2d5cc48..99fa9c9 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 _0x38d5=['format','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','lastName','messageId','created','autoclose','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','forcedOwnership','Start','startRouting','EventManager','offline','files','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','defaults','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','render','toPairs','originalname','mimetype','server','attachments','basename','openNewInteraction','transaction','Attachment','MailServerOut','Smtp','forwardOffline','service','host','port','secure','authentication','pass','SendMail','sendMail','email','forwardOfflineAddress','offlineMessageSubject','toPairsIn','mapValues','subjectOffline','Chat','MailAccountId','NotifyMailAccount','notifyMail','offline-chat','remove','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','increment','chatLicenseExceeded','push','all','server/files/chat/iframe.ejs','utf8','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','color_button','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','online','onlineForm','items','fromKey','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','User','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','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','offset','undefined','limit','count','status','set','apply','save','update','get','ChatWebsites','UserProfileResource','destroy','end','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','keys','include','create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','filename','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','from','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','DESC','ChatApplication','Applications','account','applications','list','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor'];(function(_0x331a2c,_0xc59b3e){var _0x508e83=function(_0x5e8d02){while(--_0x5e8d02){_0x331a2c['push'](_0x331a2c['shift']());}};_0x508e83(++_0xc59b3e);}(_0x38d5,0x7a));var _0x538d=function(_0x45056a,_0x1f5923){_0x45056a=_0x45056a-0x0;var _0x54dcbb=_0x38d5[_0x45056a];return _0x54dcbb;};'use strict';var emlformat=require(_0x538d('0x0'));var rimraf=require(_0x538d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x538d('0x2'));var moment=require(_0x538d('0x3'));var BPromise=require(_0x538d('0x4'));var Mustache=require(_0x538d('0x5'));var util=require('util');var path=require(_0x538d('0x6'));var sox=require(_0x538d('0x7'));var csv=require(_0x538d('0x8'));var ejs=require(_0x538d('0x9'));var fs=require('fs');var fs_extra=require(_0x538d('0xa'));var _=require(_0x538d('0xb'));var squel=require(_0x538d('0xc'));var crypto=require(_0x538d('0xd'));var jsforce=require(_0x538d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x538d('0x8'));var querystring=require(_0x538d('0xf'));var Papa=require(_0x538d('0x10'));var Redis=require(_0x538d('0x11'));var authService=require(_0x538d('0x12'));var qs=require(_0x538d('0x13'));var as=require(_0x538d('0x14'));var hardwareService=require(_0x538d('0x15'));var logger=require(_0x538d('0x16'))(_0x538d('0x17'));var utils=require(_0x538d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x538d('0x19'));var db=require(_0x538d('0x1a'))['db'];config[_0x538d('0x1b')]=_['defaults'](config[_0x538d('0x1b')],{'host':_0x538d('0x1c'),'port':0x18eb});var socket=require(_0x538d('0x1d'))(new Redis(config[_0x538d('0x1b')]));require('./chatWebsite.socket')[_0x538d('0x1e')](socket);var jayson=require(_0x538d('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x538d('0x20')][_0x538d('0x21')]({'port':0x232a});var client9003=jayson[_0x538d('0x20')][_0x538d('0x21')]({'port':0x232b});var client9001=jayson[_0x538d('0x20')][_0x538d('0x21')]({'port':0x2329});function respondWithRpcPromise(_0x5bfe99,_0x330716,_0x1a1fd1,_0x28e69f){return new BPromise(function(_0xce9b18,_0x389ac1){var _0x3e7b5f=_0x28e69f||client;return _0x3e7b5f[_0x538d('0x22')](_0x5bfe99,_0x1a1fd1)[_0x538d('0x23')](function(_0x1e7418){logger[_0x538d('0x24')](_0x538d('0x25'),_0x330716,_0x538d('0x26'));logger[_0x538d('0x27')](_0x538d('0x28'),_0x330716,_0x538d('0x26'),JSON[_0x538d('0x29')](_0x1e7418));if(_0x1e7418[_0x538d('0x2a')]){if(_0x1e7418[_0x538d('0x2a')][_0x538d('0x2b')]===0x1f4){logger[_0x538d('0x2a')](_0x538d('0x25'),_0x330716,_0x1e7418[_0x538d('0x2a')]['message']);return _0x389ac1(_0x1e7418[_0x538d('0x2a')][_0x538d('0x2c')]);}logger[_0x538d('0x2a')]('ChatWebsite,\x20%s,\x20%s',_0x330716,_0x1e7418[_0x538d('0x2a')][_0x538d('0x2c')]);return _0xce9b18(_0x1e7418[_0x538d('0x2a')][_0x538d('0x2c')]);}else{logger[_0x538d('0x24')](_0x538d('0x25'),_0x330716,_0x538d('0x26'));_0xce9b18(_0x1e7418[_0x538d('0x2d')][_0x538d('0x2c')]);}})['catch'](function(_0x1789e1){logger[_0x538d('0x2a')](_0x538d('0x25'),_0x330716,_0x1789e1);_0x389ac1(_0x1789e1);});});}function respondWithStatusCode(_0x5917d3,_0x2ffac2){_0x2ffac2=_0x2ffac2||0xcc;return function(_0x1e30c8){if(_0x1e30c8){return _0x5917d3['sendStatus'](_0x2ffac2);}return _0x5917d3['status'](_0x2ffac2)['end']();};}function respondWithResult(_0x5d8a16,_0x21a1ce){_0x21a1ce=_0x21a1ce||0xc8;return function(_0x18e4b9){if(_0x18e4b9){return _0x5d8a16['status'](_0x21a1ce)['json'](_0x18e4b9);}};}function respondWithFilteredResult(_0x40dcab,_0x4eafed){return function(_0x2c82f0){if(_0x2c82f0){var _0x13f6fb=typeof _0x4eafed[_0x538d('0x2e')]===_0x538d('0x2f')&&typeof _0x4eafed[_0x538d('0x30')]===_0x538d('0x2f');var _0x114558=_0x2c82f0[_0x538d('0x31')];var _0x559723=_0x13f6fb?0x0:_0x4eafed[_0x538d('0x2e')];var _0xed4fb9=_0x13f6fb?_0x2c82f0['count']:_0x4eafed['offset']+_0x4eafed[_0x538d('0x30')];var _0x3a51f3;if(_0xed4fb9>=_0x114558){_0xed4fb9=_0x114558;_0x3a51f3=0xc8;}else{_0x3a51f3=0xce;}_0x40dcab[_0x538d('0x32')](_0x3a51f3);return _0x40dcab[_0x538d('0x33')]('Content-Range',_0x559723+'-'+_0xed4fb9+'/'+_0x114558)['json'](_0x2c82f0);}return null;};}function patchUpdates(_0x5f5c3b){return function(_0x16822c){try{jsonpatch[_0x538d('0x34')](_0x16822c,_0x5f5c3b,!![]);}catch(_0x190535){return BPromise['reject'](_0x190535);}return _0x16822c[_0x538d('0x35')]();};}function saveUpdates(_0x4f561f,_0xf8c187){return function(_0x502f34){if(_0x502f34){return _0x502f34[_0x538d('0x36')](_0x4f561f)[_0x538d('0x23')](function(_0x14a6d5){return _0x14a6d5;});}return null;};}function removeEntity(_0x564b89,_0x52cda6){return function(_0x37c4cc){if(_0x37c4cc){return _0x37c4cc['destroy']()['then'](function(){var _0x4c9b09=_0x37c4cc[_0x538d('0x37')]({'plain':!![]});var _0x165960=_0x538d('0x38');return db[_0x538d('0x39')][_0x538d('0x3a')]({'where':{'type':_0x165960,'resourceId':_0x4c9b09['id']}})[_0x538d('0x23')](function(){return _0x37c4cc;});})['then'](function(){_0x564b89[_0x538d('0x32')](0xcc)[_0x538d('0x3b')]();});}};}function handleEntityNotFound(_0x482fc9,_0xf3f329){return function(_0x4fb1b1){if(!_0x4fb1b1){_0x482fc9[_0x538d('0x3c')](0x194);}return _0x4fb1b1;};}function handleError(_0x2fd659,_0x688c92){_0x688c92=_0x688c92||0x1f4;return function(_0x2861ac){logger[_0x538d('0x2a')](_0x2861ac['stack']);if(_0x2861ac[_0x538d('0x3d')]){delete _0x2861ac['name'];}_0x2fd659['status'](_0x688c92)[_0x538d('0x3e')](_0x2861ac);};}exports[_0x538d('0x3f')]=function(_0x234258,_0x4b6297){var _0x2c9e4d={'include':[{'model':db[_0x538d('0x40')],'as':_0x538d('0x41')}]},_0x46b4bf={},_0x45321c={'count':0x0,'rows':[]};var _0xc48b60=_[_0x538d('0x42')](db[_0x538d('0x43')][_0x538d('0x44')],function(_0x62b761){return{'name':_0x62b761[_0x538d('0x45')],'type':_0x62b761[_0x538d('0x46')][_0x538d('0x47')]};});_0x46b4bf[_0x538d('0x48')]=_[_0x538d('0x42')](_0xc48b60,'name');_0x46b4bf['query']=_['keys'](_0x234258[_0x538d('0x49')]);_0x46b4bf[_0x538d('0x4a')]=_[_0x538d('0x4b')](_0x46b4bf['model'],_0x46b4bf[_0x538d('0x49')]);_0x2c9e4d[_0x538d('0x4c')]=_[_0x538d('0x4b')](_0x46b4bf[_0x538d('0x48')],qs['fields'](_0x234258[_0x538d('0x49')][_0x538d('0x4d')]));_0x2c9e4d[_0x538d('0x4c')]=_0x2c9e4d[_0x538d('0x4c')][_0x538d('0x4e')]?_0x2c9e4d['attributes']:_0x46b4bf[_0x538d('0x48')];if(!_0x234258[_0x538d('0x49')][_0x538d('0x4f')](_0x538d('0x50'))){_0x2c9e4d[_0x538d('0x30')]=qs[_0x538d('0x30')](_0x234258[_0x538d('0x49')]['limit']);_0x2c9e4d['offset']=qs[_0x538d('0x2e')](_0x234258[_0x538d('0x49')][_0x538d('0x2e')]);}_0x2c9e4d['order']=qs[_0x538d('0x51')](_0x234258['query'][_0x538d('0x51')]);_0x2c9e4d[_0x538d('0x52')]=qs['filters'](_[_0x538d('0x53')](_0x234258[_0x538d('0x49')],_0x46b4bf['filters']),_0xc48b60);if(_0x234258['query'][_0x538d('0x54')]){_0x2c9e4d[_0x538d('0x52')]=_['merge'](_0x2c9e4d['where'],{'$or':_[_0x538d('0x42')](_0xc48b60,function(_0x40baf9){if(_0x40baf9[_0x538d('0x46')]!==_0x538d('0x55')){var _0x4d8ebf={};_0x4d8ebf[_0x40baf9[_0x538d('0x3d')]]={'$like':'%'+_0x234258[_0x538d('0x49')][_0x538d('0x54')]+'%'};return _0x4d8ebf;}})});}_0x2c9e4d=_[_0x538d('0x56')]({},_0x2c9e4d,_0x234258[_0x538d('0x57')]);var _0x32f9f7={'where':_0x2c9e4d['where']};return db['ChatWebsite'][_0x538d('0x31')](_0x32f9f7)[_0x538d('0x23')](function(_0x463d52){_0x45321c['count']=_0x463d52;if(_0x234258['query'][_0x538d('0x58')]){_0x2c9e4d['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x538d('0x59')](_0x2c9e4d);})[_0x538d('0x23')](function(_0x1d5b8c){_0x45321c[_0x538d('0x5a')]=_0x1d5b8c;return _0x45321c;})[_0x538d('0x23')](respondWithFilteredResult(_0x4b6297,_0x2c9e4d))[_0x538d('0x5b')](handleError(_0x4b6297,null));};exports['show']=function(_0x44b611,_0x1d5a20){var _0x384b1c={'raw':![],'where':{'id':_0x44b611[_0x538d('0x5c')]['id']},'include':[{'model':db[_0x538d('0x40')],'as':_0x538d('0x41')}]},_0x322027={};_0x322027[_0x538d('0x48')]=_[_0x538d('0x5d')](db['ChatWebsite'][_0x538d('0x44')]);_0x322027[_0x538d('0x49')]=_[_0x538d('0x5d')](_0x44b611[_0x538d('0x49')]);_0x322027[_0x538d('0x4a')]=_[_0x538d('0x4b')](_0x322027[_0x538d('0x48')],_0x322027['query']);_0x384b1c[_0x538d('0x4c')]=_[_0x538d('0x4b')](_0x322027[_0x538d('0x48')],qs[_0x538d('0x4d')](_0x44b611[_0x538d('0x49')][_0x538d('0x4d')]));_0x384b1c[_0x538d('0x4c')]=_0x384b1c[_0x538d('0x4c')][_0x538d('0x4e')]?_0x384b1c[_0x538d('0x4c')]:_0x322027[_0x538d('0x48')];if(_0x44b611[_0x538d('0x49')][_0x538d('0x58')]){_0x384b1c[_0x538d('0x5e')]=[{'all':!![]}];}_0x384b1c=_['merge']({},_0x384b1c,_0x44b611[_0x538d('0x57')]);return db['ChatWebsite']['find'](_0x384b1c)[_0x538d('0x23')](handleEntityNotFound(_0x1d5a20,null))[_0x538d('0x23')](respondWithResult(_0x1d5a20,null))[_0x538d('0x5b')](handleError(_0x1d5a20,null));};exports['create']=function(_0x3915cf,_0x5d85a6){return db[_0x538d('0x43')][_0x538d('0x5f')](_0x3915cf[_0x538d('0x60')],{})[_0x538d('0x23')](function(_0x8ca805){var _0x5e9fe8=_0x3915cf[_0x538d('0x61')][_0x538d('0x37')]({'plain':!![]});if(!_0x5e9fe8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e9fe8[_0x538d('0x62')]===_0x538d('0x61')){var _0x38c96e=_0x8ca805['get']({'plain':!![]});var _0x6412c6='ChatWebsites';return db[_0x538d('0x63')][_0x538d('0x64')]({'where':{'name':_0x6412c6,'userProfileId':_0x5e9fe8['userProfileId']},'raw':!![]})[_0x538d('0x23')](function(_0x30811d){if(_0x30811d&&_0x30811d[_0x538d('0x65')]===0x0){return db['UserProfileResource'][_0x538d('0x5f')]({'name':_0x38c96e[_0x538d('0x3d')],'resourceId':_0x38c96e['id'],'type':_0x30811d[_0x538d('0x3d')],'sectionId':_0x30811d['id']},{})[_0x538d('0x23')](function(){return _0x8ca805;});}else{return _0x8ca805;}})[_0x538d('0x5b')](function(_0xe208a6){logger[_0x538d('0x2a')](_0x538d('0x66'),_0xe208a6);throw _0xe208a6;});}return _0x8ca805;})[_0x538d('0x23')](respondWithResult(_0x5d85a6,0xc9))[_0x538d('0x5b')](handleError(_0x5d85a6,null));};exports[_0x538d('0x36')]=function(_0x2e5d60,_0x1ffe43){if(_0x2e5d60[_0x538d('0x60')]['id']){delete _0x2e5d60[_0x538d('0x60')]['id'];}return db[_0x538d('0x43')]['find']({'where':{'id':_0x2e5d60[_0x538d('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x538d('0x41')}]})[_0x538d('0x23')](handleEntityNotFound(_0x1ffe43,null))[_0x538d('0x23')](saveUpdates(_0x2e5d60[_0x538d('0x60')],null))[_0x538d('0x23')](respondWithResult(_0x1ffe43,null))[_0x538d('0x5b')](handleError(_0x1ffe43,null));};exports[_0x538d('0x3a')]=function(_0x188d16,_0x58d37c){return db[_0x538d('0x43')]['find']({'where':{'id':_0x188d16[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x58d37c,null))['then'](removeEntity(_0x58d37c,null))['catch'](handleError(_0x58d37c,null));};exports[_0x538d('0x67')]=function(_0x1a3f5f,_0x3dd206){return db[_0x538d('0x43')][_0x538d('0x67')]()[_0x538d('0x23')](respondWithResult(_0x3dd206,null))[_0x538d('0x5b')](handleError(_0x3dd206,null));};exports[_0x538d('0x68')]=function(_0x15a83d,_0x4e3ec0,_0x5a3df0){if(_0x15a83d[_0x538d('0x60')]['id']){delete _0x15a83d[_0x538d('0x60')]['id'];}return db[_0x538d('0x43')]['find']({'where':{'id':_0x15a83d[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x4e3ec0,null))[_0x538d('0x23')](function(_0x60f920){if(_0x60f920){_0x15a83d['body'][_0x538d('0x69')]=_0x60f920['id'];return db[_0x538d('0x6a')][_0x538d('0x5f')](_0x15a83d[_0x538d('0x60')]);}})[_0x538d('0x23')](respondWithResult(_0x4e3ec0,null))[_0x538d('0x5b')](handleError(_0x4e3ec0,null));};exports[_0x538d('0x6b')]=function(_0x422cbe,_0x7da2de,_0x13c4b7){var _0x4041ea={'raw':![],'where':{}};var _0x5bc2ea={};var _0xacdeaf={'count':0x0,'rows':[]};return db[_0x538d('0x43')][_0x538d('0x6c')]({'where':{'id':_0x422cbe[_0x538d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x7da2de,null))[_0x538d('0x23')](function(_0x38b5cd){if(_0x38b5cd){_0x5bc2ea[_0x538d('0x48')]=_['keys'](db[_0x538d('0x6a')][_0x538d('0x44')]);_0x5bc2ea[_0x538d('0x49')]=_[_0x538d('0x5d')](_0x422cbe[_0x538d('0x49')]);_0x5bc2ea[_0x538d('0x4a')]=_['intersection'](_0x5bc2ea[_0x538d('0x48')],_0x5bc2ea[_0x538d('0x49')]);_0x4041ea[_0x538d('0x4c')]=_['intersection'](_0x5bc2ea[_0x538d('0x48')],qs[_0x538d('0x4d')](_0x422cbe[_0x538d('0x49')]['fields']));_0x4041ea[_0x538d('0x4c')]=_0x4041ea[_0x538d('0x4c')][_0x538d('0x4e')]?_0x4041ea[_0x538d('0x4c')]:_0x5bc2ea[_0x538d('0x48')];if(!_0x422cbe[_0x538d('0x49')][_0x538d('0x4f')](_0x538d('0x50'))){_0x4041ea[_0x538d('0x30')]=qs['limit'](_0x422cbe[_0x538d('0x49')][_0x538d('0x30')]);_0x4041ea['offset']=qs[_0x538d('0x2e')](_0x422cbe['query'][_0x538d('0x2e')]);}_0x4041ea[_0x538d('0x6d')]=qs['sort'](_0x422cbe[_0x538d('0x49')][_0x538d('0x51')]);_0x4041ea[_0x538d('0x52')]=qs[_0x538d('0x4a')](_[_0x538d('0x53')](_0x422cbe[_0x538d('0x49')],_0x5bc2ea[_0x538d('0x4a')]));_0x4041ea[_0x538d('0x52')]['ChatWebsiteId']=_0x38b5cd['id'];if(_0x422cbe[_0x538d('0x49')][_0x538d('0x54')]){_0x4041ea['where']=_[_0x538d('0x56')](_0x4041ea[_0x538d('0x52')],{'$or':_[_0x538d('0x42')](_0x4041ea['attributes'],function(_0x33fbb7){var _0xead20={};_0xead20[_0x33fbb7]={'$like':'%'+_0x422cbe[_0x538d('0x49')][_0x538d('0x54')]+'%'};return _0xead20;})});}_0x4041ea=_[_0x538d('0x56')]({},_0x4041ea,_0x422cbe[_0x538d('0x57')]);return db[_0x538d('0x6a')][_0x538d('0x31')]({'where':_0x4041ea[_0x538d('0x52')]})['then'](function(_0x50d94e){_0xacdeaf[_0x538d('0x31')]=_0x50d94e;if(_0x422cbe['query'][_0x538d('0x58')]){_0x4041ea[_0x538d('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0x538d('0x59')](_0x4041ea);})[_0x538d('0x23')](function(_0x327fae){_0xacdeaf['rows']=_0x327fae;return _0xacdeaf;});}})[_0x538d('0x23')](respondWithFilteredResult(_0x7da2de,_0x4041ea))['catch'](handleError(_0x7da2de,null));};exports['removeDispositions']=function(_0x1fc7ee,_0x45dc26,_0x339962){return db[_0x538d('0x43')][_0x538d('0x64')]({'where':{'id':_0x1fc7ee[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x45dc26,null))[_0x538d('0x23')](function(_0xdd8d90){if(_0xdd8d90){return _0xdd8d90[_0x538d('0x6e')](_0x1fc7ee[_0x538d('0x49')][_0x538d('0x6f')]);}})[_0x538d('0x23')](respondWithStatusCode(_0x45dc26,null))['catch'](handleError(_0x45dc26,null));};exports[_0x538d('0x70')]=function(_0x416429,_0x2a879f,_0x302404){if(_0x416429[_0x538d('0x60')]['id']){delete _0x416429[_0x538d('0x60')]['id'];}return db['ChatWebsite'][_0x538d('0x64')]({'where':{'id':_0x416429['params']['id']}})['then'](handleEntityNotFound(_0x2a879f,null))['then'](function(_0x44cebf){if(_0x44cebf){_0x416429['body']['ChatWebsiteId']=_0x44cebf['id'];return db[_0x538d('0x71')][_0x538d('0x5f')](_0x416429[_0x538d('0x60')]);}})[_0x538d('0x23')](respondWithResult(_0x2a879f,null))['catch'](handleError(_0x2a879f,null));};exports[_0x538d('0x72')]=function(_0x3ce2e0,_0x55d2a8,_0xac0ae0){var _0xec491a={'raw':![],'where':{}};var _0x40bfd8={};var _0x58119b={'count':0x0,'rows':[]};return db[_0x538d('0x43')][_0x538d('0x6c')]({'where':{'id':_0x3ce2e0['params']['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x55d2a8,null))[_0x538d('0x23')](function(_0x40fb76){if(_0x40fb76){_0x40bfd8[_0x538d('0x48')]=_['keys'](db[_0x538d('0x71')][_0x538d('0x44')]);_0x40bfd8[_0x538d('0x49')]=_[_0x538d('0x5d')](_0x3ce2e0[_0x538d('0x49')]);_0x40bfd8['filters']=_[_0x538d('0x4b')](_0x40bfd8[_0x538d('0x48')],_0x40bfd8['query']);_0xec491a[_0x538d('0x4c')]=_['intersection'](_0x40bfd8[_0x538d('0x48')],qs[_0x538d('0x4d')](_0x3ce2e0[_0x538d('0x49')][_0x538d('0x4d')]));_0xec491a[_0x538d('0x4c')]=_0xec491a['attributes'][_0x538d('0x4e')]?_0xec491a[_0x538d('0x4c')]:_0x40bfd8[_0x538d('0x48')];if(!_0x3ce2e0[_0x538d('0x49')][_0x538d('0x4f')](_0x538d('0x50'))){_0xec491a[_0x538d('0x30')]=qs[_0x538d('0x30')](_0x3ce2e0[_0x538d('0x49')][_0x538d('0x30')]);_0xec491a[_0x538d('0x2e')]=qs[_0x538d('0x2e')](_0x3ce2e0[_0x538d('0x49')][_0x538d('0x2e')]);}_0xec491a[_0x538d('0x6d')]=qs[_0x538d('0x51')](_0x3ce2e0[_0x538d('0x49')][_0x538d('0x51')]);_0xec491a[_0x538d('0x52')]=qs[_0x538d('0x4a')](_[_0x538d('0x53')](_0x3ce2e0[_0x538d('0x49')],_0x40bfd8[_0x538d('0x4a')]));_0xec491a[_0x538d('0x52')][_0x538d('0x69')]=_0x40fb76['id'];if(_0x3ce2e0[_0x538d('0x49')][_0x538d('0x54')]){_0xec491a[_0x538d('0x52')]=_[_0x538d('0x56')](_0xec491a['where'],{'$or':_[_0x538d('0x42')](_0xec491a[_0x538d('0x4c')],function(_0xf3dd56){var _0x304089={};_0x304089[_0xf3dd56]={'$like':'%'+_0x3ce2e0[_0x538d('0x49')][_0x538d('0x54')]+'%'};return _0x304089;})});}_0xec491a=_[_0x538d('0x56')]({},_0xec491a,_0x3ce2e0['options']);return db[_0x538d('0x71')][_0x538d('0x31')]({'where':_0xec491a[_0x538d('0x52')]})['then'](function(_0x1cf9f0){_0x58119b['count']=_0x1cf9f0;if(_0x3ce2e0[_0x538d('0x49')][_0x538d('0x58')]){_0xec491a['include']=[{'all':!![]}];}return db[_0x538d('0x71')][_0x538d('0x59')](_0xec491a);})[_0x538d('0x23')](function(_0x23a931){_0x58119b[_0x538d('0x5a')]=_0x23a931;return _0x58119b;});}})[_0x538d('0x23')](respondWithFilteredResult(_0x55d2a8,_0xec491a))['catch'](handleError(_0x55d2a8,null));};exports[_0x538d('0x73')]=function(_0x2ed555,_0x519ee3,_0x5714c7){return db[_0x538d('0x43')][_0x538d('0x64')]({'where':{'id':_0x2ed555[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x519ee3,null))[_0x538d('0x23')](function(_0x155eb0){if(_0x155eb0){return _0x155eb0[_0x538d('0x73')](_0x2ed555[_0x538d('0x49')][_0x538d('0x6f')]);}})[_0x538d('0x23')](respondWithStatusCode(_0x519ee3,null))[_0x538d('0x5b')](handleError(_0x519ee3,null));};exports[_0x538d('0x74')]=function(_0x4a55cb,_0x361488,_0xe80ad3){_0x4a55cb[_0x538d('0x60')][_0x538d('0x75')]=_0x4a55cb['file']['filename'];return db['ChatWebsite'][_0x538d('0x64')]({'where':{'id':_0x4a55cb[_0x538d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x361488,null))['then'](saveUpdates(_0x4a55cb['body'],null))[_0x538d('0x23')](respondWithResult(_0x361488,null))[_0x538d('0x5b')](handleError(_0x361488,null));};exports[_0x538d('0x76')]=function(_0x265bc5,_0x3544da,_0x5957c2){_0x265bc5['body'][_0x538d('0x77')]=_0x265bc5[_0x538d('0x78')]['filename'];return db[_0x538d('0x43')][_0x538d('0x64')]({'where':{'id':_0x265bc5[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x3544da,null))[_0x538d('0x23')](saveUpdates(_0x265bc5[_0x538d('0x60')],null))[_0x538d('0x23')](respondWithResult(_0x3544da,null))['catch'](handleError(_0x3544da,null));};exports[_0x538d('0x79')]=function(_0x3c90bd,_0x40fced,_0x439faa){_0x3c90bd[_0x538d('0x60')][_0x538d('0x7a')]=_0x3c90bd['file'][_0x538d('0x7b')];return db['ChatWebsite'][_0x538d('0x64')]({'where':{'id':_0x3c90bd[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x40fced,null))[_0x538d('0x23')](saveUpdates(_0x3c90bd[_0x538d('0x60')],null))[_0x538d('0x23')](respondWithResult(_0x40fced,null))['catch'](handleError(_0x40fced,null));};exports[_0x538d('0x7c')]=function(_0x3c8f99,_0x441dc7,_0x40fbc7){_0x3c8f99[_0x538d('0x60')][_0x538d('0x7d')]=_0x3c8f99[_0x538d('0x78')][_0x538d('0x7b')];return db['ChatWebsite'][_0x538d('0x64')]({'where':{'id':_0x3c8f99[_0x538d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x441dc7,null))[_0x538d('0x23')](saveUpdates(_0x3c8f99[_0x538d('0x60')],null))[_0x538d('0x23')](respondWithResult(_0x441dc7,null))[_0x538d('0x5b')](handleError(_0x441dc7,null));};exports['getLogo']=function(_0x2419dc,_0x2fa638,_0x5b9185){var _0x572a78=path[_0x538d('0x7e')](config[_0x538d('0x7f')],_0x538d('0x80'));var _0x3a418f={'where':{'id':_0x2419dc['params']['id']},'attributes':['id',_0x538d('0x75')],'raw':!![]};var _0x1295b8=![];return require('../../config/license/util')[_0x538d('0x81')]()[_0x538d('0x23')](function(_0x5d7a38){if(_0x5d7a38){_0x1295b8=_0x5d7a38[_0x538d('0x82')];}})['then'](function(){return db[_0x538d('0x43')][_0x538d('0x64')](_0x3a418f);})['then'](handleEntityNotFound(_0x2fa638,null))['then'](function(_0x209ccf){if(_0x209ccf){if(!_[_0x538d('0x83')](_0x209ccf[_0x538d('0x75')])){if(fs[_0x538d('0x84')](path[_0x538d('0x7e')](config[_0x538d('0x7f')],_0x538d('0x85'),_0x209ccf[_0x538d('0x75')]))&&_0x1295b8){_0x572a78=path['join'](config[_0x538d('0x7f')],'server/files/images/logos/',_0x209ccf[_0x538d('0x75')]);}}return _0x2fa638[_0x538d('0x86')](_0x572a78);}})['catch'](handleError(_0x2fa638,null));};exports['getAvatar']=function(_0x2a3796,_0xb022c5,_0x4f8cb8){var _0x212d80=path[_0x538d('0x7e')](config['root'],_0x538d('0x87'));var _0x398e7f={'where':{'id':_0x2a3796[_0x538d('0x5c')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x538d('0x43')][_0x538d('0x64')](_0x398e7f)[_0x538d('0x23')](handleEntityNotFound(_0xb022c5,null))[_0x538d('0x23')](function(_0x8facaf){if(_0x8facaf){if(!_[_0x538d('0x83')](_0x8facaf[_0x538d('0x77')])){if(fs[_0x538d('0x84')](path[_0x538d('0x7e')](config[_0x538d('0x7f')],_0x538d('0x88'),_0x8facaf[_0x538d('0x77')]))){_0x212d80=path[_0x538d('0x7e')](config['root'],'server/files/images/avatars/',_0x8facaf[_0x538d('0x77')]);}}return _0xb022c5['download'](_0x212d80);}})['catch'](handleError(_0xb022c5,null));};exports['getCustomerAvatar']=function(_0x42ecc8,_0x3c1069,_0x12ae71){var _0x28065=path[_0x538d('0x7e')](config[_0x538d('0x7f')],_0x538d('0x89'));var _0x42ed6d={'where':{'id':_0x42ecc8[_0x538d('0x5c')]['id']},'attributes':['id',_0x538d('0x7a'),_0x538d('0x8a')],'raw':!![]};return db[_0x538d('0x43')]['find'](_0x42ed6d)[_0x538d('0x23')](handleEntityNotFound(_0x3c1069,null))['then'](function(_0x1ea249){if(_0x1ea249){if(!_['isNil'](_0x1ea249['customerAvatar'])){if(fs['existsSync'](path['join'](config[_0x538d('0x7f')],_0x538d('0x88'),_0x1ea249[_0x538d('0x7a')]))&&_0x1ea249[_0x538d('0x8a')]){_0x28065=path[_0x538d('0x7e')](config[_0x538d('0x7f')],_0x538d('0x88'),_0x1ea249[_0x538d('0x7a')]);}}return _0x3c1069[_0x538d('0x86')](_0x28065);}})['catch'](handleError(_0x3c1069,null));};exports[_0x538d('0x8b')]=function(_0x31c4ee,_0x57066b,_0x31227e){var _0x2ba4b9=path['join'](config[_0x538d('0x7f')],_0x538d('0x8c'));var _0x36de54={'where':{'id':_0x31c4ee[_0x538d('0x5c')]['id']},'attributes':['id',_0x538d('0x7d')],'raw':!![]};return db[_0x538d('0x43')][_0x538d('0x64')](_0x36de54)[_0x538d('0x23')](handleEntityNotFound(_0x57066b,null))[_0x538d('0x23')](function(_0x899f3b){if(_0x899f3b){if(!_[_0x538d('0x83')](_0x899f3b[_0x538d('0x7d')])){if(fs[_0x538d('0x84')](path[_0x538d('0x7e')](config[_0x538d('0x7f')],_0x538d('0x88'),_0x899f3b['systemAvatar']))){_0x2ba4b9=path[_0x538d('0x7e')](config[_0x538d('0x7f')],'server/files/images/avatars/',_0x899f3b[_0x538d('0x7d')]);}}return _0x57066b['download'](_0x2ba4b9);}})['catch'](handleError(_0x57066b,null));};exports['notify']=function(_0x3ba7c3,_0x5dcbde,_0x41ed7d){var _0x4c86cc=require(_0x538d('0x8d'));var _0x1f8797=new _0x4c86cc();var _0x231db6=_0x1f8797[_0x538d('0x8e')](_0x3ba7c3[_0x538d('0x8f')][_0x538d('0x90')])[_0x538d('0x91')]();var _0x5a3a23={'body':_0x3ba7c3['body'],'channel':_0x538d('0x92')};var _0x3a99a7=[];var _0x221b7f=[];var _0x123385={};var _0x4d6fe9=![];return db[_0x538d('0x93')][_0x538d('0x67')]()[_0x538d('0x23')](function(_0xf31f50){if(!_0xf31f50){throw new db['Sequelize']['ValidationError'](_0x538d('0x94'));}_0x3a99a7=_[_0x538d('0x95')](_['keys'](_0xf31f50),['createdAt','updatedAt']);_0x221b7f=_[_0x538d('0x95')](_[_0x538d('0x5d')](_0xf31f50),[_0x538d('0x96'),'updatedAt',_0x538d('0x97'),_0x538d('0x98')]);if(_0x3ba7c3['body']['id']){delete _0x3ba7c3['body']['id'];}if(_[_0x538d('0x83')](_0x3ba7c3['body'][_0x538d('0x99')])){throw new db[(_0x538d('0x9a'))][(_0x538d('0x9b'))]('from\x20is\x20mandatory');}if(_[_0x538d('0x83')](_0x3ba7c3['body']['body'])||_0x3ba7c3[_0x538d('0x60')]['body']===''){throw new db['Sequelize'][(_0x538d('0x9b'))](_0x538d('0x9c'));}if(_['isNil'](_0x3ba7c3[_0x538d('0x60')]['mapKey'])){throw new db[(_0x538d('0x9a'))]['ValidationError'](_0x538d('0x9d')+_0x221b7f);}if(!_[_0x538d('0x9e')](_0x221b7f,_0x3ba7c3[_0x538d('0x60')][_0x538d('0x9f')])){throw new db[(_0x538d('0x9a'))][(_0x538d('0x9b'))](_0x538d('0xa0')+_0x221b7f);}_0x123385[_0x3ba7c3['body'][_0x538d('0x9f')]]=_0x3ba7c3[_0x538d('0x60')][_0x538d('0x99')];})[_0x538d('0x23')](function(){return db[_0x538d('0x43')][_0x538d('0x64')]({'where':{'id':_0x3ba7c3['params']['id']},'include':[{'model':db[_0x538d('0xa1')],'as':_0x538d('0xa2'),'include':[{'model':db[_0x538d('0x93')],'as':_0x538d('0xa3'),'where':_0x123385,'limit':0x1,'order':[[_0x538d('0xa4'),_0x538d('0xa5')]]}]},{'model':db[_0x538d('0xa6')],'as':_0x538d('0xa7')}]});})[_0x538d('0x23')](handleEntityNotFound(_0x5dcbde,null))['then'](function(_0x45e39c){if(_0x45e39c&&_0x45e39c['List']){_0x5a3a23[_0x538d('0xa8')]=_0x45e39c;_0x5a3a23[_0x538d('0xa9')]=_0x45e39c[_0x538d('0xa7')];_0x5a3a23[_0x538d('0xaa')]=_0x45e39c[_0x538d('0xa2')];_0x5a3a23[_0x538d('0xa9')]=_['orderBy'](_0x5a3a23[_0x538d('0xa9')],[_0x538d('0xab')],[_0x538d('0xac')]);if(_0x5a3a23['account'][_0x538d('0xa7')]){delete _0x5a3a23[_0x538d('0xa8')]['Applications'];}if(_0x5a3a23[_0x538d('0xa8')][_0x538d('0xa2')]&&_0x5a3a23['account']['List'][_0x538d('0xa3')][_0x538d('0x4e')]){return _0x5a3a23[_0x538d('0xa8')]['List'][_0x538d('0xa3')][0x0];}var _0x12d6ef=_['defaults'](_0x3ba7c3['body'],{'firstName':_0x3ba7c3[_0x538d('0x60')][_0x538d('0x99')],'ListId':_0x45e39c[_0x538d('0x98')]});_0x12d6ef[_0x3ba7c3[_0x538d('0x60')]['mapKey']]=_0x3ba7c3[_0x538d('0x60')]['from'];return db[_0x538d('0x93')]['create'](_0x12d6ef,{'fields':_0x3a99a7,'raw':!![]});}})[_0x538d('0x23')](handleEntityNotFound(_0x5dcbde,null))['then'](function(_0xaf67b1){_0x5a3a23[_0x538d('0xad')]=_0xaf67b1;var _0x5fb766=_0x3ba7c3['body'][_0x538d('0xae')];if(_0x3ba7c3[_0x538d('0x8f')][_0x538d('0xaf')]){_0x5fb766=_0x3ba7c3[_0x538d('0x8f')][_0x538d('0xaf')];}else if(_0x3ba7c3[_0x538d('0x8f')][_0x538d('0xb0')]){_0x5fb766=_['first'](_0x3ba7c3[_0x538d('0x8f')][_0x538d('0xb0')][_0x538d('0xb1')](','));}if(_0xaf67b1){var _0x14368c={'ContactId':_0xaf67b1['id'],'ChatWebsiteId':_0x3ba7c3['params']['id'],'from':(_0xaf67b1['firstName']||'')+'\x20'+(_0xaf67b1['lastName']||''),'customerIp':_0x5fb766,'customerPort':_0x3ba7c3['headers'][_0x538d('0xb2')]?_0x3ba7c3[_0x538d('0x8f')]['x-real-port']:null,'referer':_0x3ba7c3[_0x538d('0x60')][_0x538d('0xb3')],'browserName':_0x231db6[_0x538d('0xb4')][_0x538d('0x3d')]&&_0x231db6['browser'][_0x538d('0xb5')]?util['format'](_0x538d('0xb6'),_0x231db6[_0x538d('0xb4')][_0x538d('0x3d')],_0x231db6[_0x538d('0xb4')][_0x538d('0xb5')]):_0x538d('0xb7'),'browserVersion':_0x231db6[_0x538d('0xb4')][_0x538d('0xb5')]||_0x538d('0xb7'),'osName':util['format'](_0x538d('0xb6'),_0x231db6['os']['name'],_0x231db6['os'][_0x538d('0xb5')]),'osVersion':_0x231db6['os'][_0x538d('0xb5')],'deviceModel':_0x231db6[_0x538d('0xb8')][_0x538d('0x48')]&&_0x231db6[_0x538d('0xb8')][_0x538d('0xb9')]?util[_0x538d('0xba')](_0x538d('0xbb'),_0x231db6[_0x538d('0xb8')][_0x538d('0x48')],_0x231db6['device'][_0x538d('0xb9')],_0x231db6['device'][_0x538d('0x46')]):null,'deviceVendor':_0x231db6['device'][_0x538d('0xb9')],'deviceType':_0x231db6[_0x538d('0xb8')][_0x538d('0x46')],'formData':JSON[_0x538d('0x29')](_0x3ba7c3[_0x538d('0x60')])};var _0x3d299b={'ChatWebsiteId':_0x3ba7c3[_0x538d('0x5c')]['id'],'closed':![]};if(_0x3ba7c3[_0x538d('0x60')][_0x538d('0xbc')]){_0x3d299b[_0x538d('0xbc')]=_0x3ba7c3[_0x538d('0x60')]['threadId'];return db[_0x538d('0xbd')][_0x538d('0x64')]({'where':_0x3d299b})[_0x538d('0x23')](function(_0x63849b){if(_0x63849b){return[_0x63849b,![]];}_0x14368c[_0x538d('0xbc')]=_0x3ba7c3[_0x538d('0x60')]['threadId'];_0x14368c[_0x538d('0xbe')]=_0x3ba7c3[_0x538d('0x60')]['externalUrl'];return db['ChatInteraction']['create'](_0x14368c)[_0x538d('0x23')](function(_0x5da848){return[_0x5da848,!![]];});});}_0x3d299b[_0x538d('0xbf')]=_0xaf67b1['id'];if(_0x3ba7c3['body']['interaction']&&_0x3ba7c3['body'][_0x538d('0xc0')]['id']){_0x3d299b['id']=_0x3ba7c3[_0x538d('0x60')][_0x538d('0xc0')]['id'];return db[_0x538d('0xbd')]['find']({'where':_0x3d299b})[_0x538d('0x23')](function(_0xf7927c){if(_0xf7927c){return[_0xf7927c,![]];}return db[_0x538d('0xbd')][_0x538d('0x5f')](_0x14368c)['then'](function(_0x462fdc){return[_0x462fdc,!![]];});});}return db[_0x538d('0xbd')][_0x538d('0x5f')](_0x14368c)['then'](function(_0x5a394e){return[_0x5a394e,!![]];});}})['spread'](function(_0x1c3f18,_0x1a57d8){if(_0x1c3f18){_0x4d6fe9=_0x1a57d8;if(!_0x1a57d8){var _0x4d1c8d={'from':(_0x5a3a23[_0x538d('0xad')][_0x538d('0xc1')]||'')+'\x20'+(_0x5a3a23['contact'][_0x538d('0xc2')]||'')};if(_0x3ba7c3[_0x538d('0x60')][_0x538d('0xbc')]&&_0x3ba7c3['body'][_0x538d('0xc3')]&&_0x3ba7c3[_0x538d('0x60')][_0x538d('0xbc')]!=_0x3ba7c3[_0x538d('0x60')][_0x538d('0xc3')]){_0x4d1c8d[_0x538d('0xbc')]=_0x3ba7c3[_0x538d('0x60')][_0x538d('0xc3')];}return _0x1c3f18[_0x538d('0x36')](_0x4d1c8d);}else{return _0x1c3f18;}}})['then'](function(_0x30aa5d){_0x5a3a23[_0x538d('0xc0')]=_0x30aa5d[_0x538d('0x37')]({'plain':!![]});_0x5a3a23[_0x538d('0xc0')][_0x538d('0xc4')]=_0x4d6fe9;if(_0x5a3a23[_0x538d('0xc0')][_0x538d('0xc4')]){if(_0x5a3a23['account'][_0x538d('0xc5')]){_0x5a3a23[_0x538d('0xa9')]['push']({'id':0x0,'priority':_0x5a3a23['applications'][_0x538d('0x4e')]+0x1,'app':'close','appdata':_0x538d('0xc6'),'interval':_0x538d('0xc7')});}}return db[_0x538d('0xc8')][_0x538d('0x5f')]({'body':_0x3ba7c3[_0x538d('0x60')][_0x538d('0x60')],'ChatWebsiteId':_0x3ba7c3[_0x538d('0x5c')]['id'],'ChatInteractionId':_0x30aa5d['id'],'direction':'in','ContactId':_0x5a3a23[_0x538d('0xad')]['id'],'AttachmentId':_0x3ba7c3[_0x538d('0x60')][_0x538d('0xc9')]});})[_0x538d('0x23')](function(_0x58c45b){_0x5a3a23[_0x538d('0x2c')]=_0x58c45b;if(_0x5a3a23[_0x538d('0xc0')]['UserId']){return db['User']['find']({'attributes':['id',_0x538d('0x3d')],'where':{'id':_0x5a3a23[_0x538d('0xc0')][_0x538d('0xca')]}})['then'](function(_0x3883f4){if(_0x3883f4){_0x5a3a23['applications'][_0x538d('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3883f4['name']+','+(_0x5a3a23['account']['waitForTheAssignedAgent']||0xa),'interval':_0x538d('0xc7')});_0x5a3a23[_0x538d('0xcc')]=!![];}return respondWithRpcPromise(_0x538d('0xcd'),_0x538d('0xce'),_0x5a3a23);});}return respondWithRpcPromise(_0x538d('0xcd'),'startRouting',_0x5a3a23);})['then'](function(_0x34d134){respondWithRpcPromise(_0x538d('0xcf'),_0x538d('0xcf'),{'event':'notify','message':_0x34d134},client9002);return _0x34d134;})[_0x538d('0x23')](respondWithResult(_0x5dcbde,null))['catch'](handleError(_0x5dcbde,null));};exports[_0x538d('0xd0')]=function(_0x83df35,_0xcd2ce3,_0x4ac788){var _0x2aeaf0,_0x410d03,_0x17a497;var _0x5d3daa=[];var _0x14b8e9=[];var _0x21eeca={};var _0x51173c=_0x83df35[_0x538d('0xd1')]||[];var _0x2131ca=[];var _0x58c90e;return db['CmContact'][_0x538d('0x67')]()['then'](function(_0x22e684){if(!_0x22e684){throw new db[(_0x538d('0x9a'))][(_0x538d('0x9b'))]('no\x20available\x20attributes');}_0x14b8e9=_[_0x538d('0x95')](_[_0x538d('0x5d')](_0x22e684),[_0x538d('0x96'),_0x538d('0xa4')]);_0x5d3daa=_[_0x538d('0x95')](_[_0x538d('0x5d')](_0x22e684),[_0x538d('0x96'),_0x538d('0xa4'),'CompanyId',_0x538d('0x98')]);if(_0x83df35[_0x538d('0x60')]['id']){delete _0x83df35['body']['id'];}if(_[_0x538d('0x83')](_0x83df35[_0x538d('0x60')][_0x538d('0x99')])){throw _0xcd2ce3[_0x538d('0x32')](0x1f4)[_0x538d('0x3e')](new db[(_0x538d('0x9a'))][(_0x538d('0x9b'))](_0x538d('0xd2')));}if(_[_0x538d('0x83')](_0x83df35[_0x538d('0x60')][_0x538d('0x60')])||_0x83df35['body'][_0x538d('0x60')]===''){throw _0xcd2ce3[_0x538d('0x32')](0x1f4)[_0x538d('0x3e')](new db[(_0x538d('0x9a'))]['ValidationError'](_0x538d('0x9c')));}if(_[_0x538d('0x83')](_0x83df35['body']['mapKeyOffline'])){throw _0xcd2ce3[_0x538d('0x32')](0x1f4)[_0x538d('0x3e')](new db[(_0x538d('0x9a'))][(_0x538d('0x9b'))](_0x538d('0xd3')+_0x5d3daa));}if(!_[_0x538d('0x9e')](_0x5d3daa,_0x83df35[_0x538d('0x60')]['mapKeyOffline'])){throw _0xcd2ce3[_0x538d('0x32')](0x1f4)['send'](new db[(_0x538d('0x9a'))]['ValidationError'](_0x538d('0xd4')+_0x5d3daa));}_0x21eeca[_0x83df35[_0x538d('0x60')]['mapKeyOffline']]=_0x83df35[_0x538d('0x60')]['from'];})[_0x538d('0x23')](function(){return db[_0x538d('0x43')][_0x538d('0x64')]({'where':{'id':_0x83df35[_0x538d('0x5c')]['id']},'include':[{'model':db[_0x538d('0xa1')],'as':_0x538d('0xa2')},{'model':db['MailAccount'],'as':_0x538d('0xd5')}]});})['then'](handleEntityNotFound(_0xcd2ce3,null))[_0x538d('0x23')](function(_0x2b7ae8){if(_0x2b7ae8&&_0x2b7ae8[_0x538d('0xa2')]){_0x410d03=_0x2b7ae8;var _0x3a5498=_[_0x538d('0xd6')](_0x83df35[_0x538d('0x60')],{'firstName':_0x83df35['body'][_0x538d('0x99')],'phone':_0x83df35['body'][_0x538d('0x99')],'ListId':_0x2b7ae8['ListId']});_0x3a5498[_0x83df35[_0x538d('0x60')]['mapKeyOffline']]=_0x83df35['body'][_0x538d('0x99')];return db[_0x538d('0x93')][_0x538d('0xd7')]({'where':_0x21eeca,'defaults':_0x3a5498});}})[_0x538d('0xd8')](function(_0x1bf424){if(_0x1bf424){_0x17a497=_0x1bf424;var _0x4d779b=fs['readFileSync'](path[_0x538d('0x7e')](config[_0x538d('0x7f')],_0x538d('0xd9')),'utf8');var _0x54a5f0=ejs[_0x538d('0xda')](_0x4d779b,{'body':_[_0x538d('0xdb')](_0x83df35[_0x538d('0x60')]['body']),'bodyTitle':_0x410d03['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x54a5f0,'ContactId':_0x1bf424['id'],'ChatWebsiteId':_0x410d03['id']});}})['then'](function(_0x2f6b10){_0x58c90e=_0x2f6b10;if(_0x51173c[_0x538d('0x4e')]){var _0x416a90=_0x51173c[_0x538d('0x42')](function(_0x5e80e3){return{'name':_0x5e80e3[_0x538d('0xdc')],'basename':_0x5e80e3[_0x538d('0x7b')],'type':_0x5e80e3[_0x538d('0xdd')],'ChatOfflineMessageId':_0x2f6b10['id']};});_0x2131ca=_0x416a90['map'](_0x3a9b76=>{var _0x137e85={'filename':_0x3a9b76[_0x538d('0x3d')],'path':path[_0x538d('0x7e')](config[_0x538d('0x7f')],_0x538d('0xde'),_0x538d('0xd1'),_0x538d('0xdf'),'offline-chat',_0x3a9b76[_0x538d('0xe0')])};return _0x137e85;});if(!_0x410d03[_0x538d('0xe1')]){return db['sequelize'][_0x538d('0xe2')](function(_0x1125a0){return db[_0x538d('0xe3')]['bulkCreate'](_0x416a90,{'transaction':_0x1125a0});});}}})[_0x538d('0x23')](function(){if(_0x58c90e){_0x2aeaf0=_0x58c90e;return db['MailAccount'][_0x538d('0x6c')]({'where':{'active':!![]},'include':[{'model':db[_0x538d('0xe4')],'as':_0x538d('0xe5'),'raw':!![]}]});}})[_0x538d('0x23')](function(_0x4458de){if(_0x4458de&&_0x4458de['Smtp']&&_0x410d03[_0x538d('0xe6')]&&_0x410d03['forwardOfflineAddress']){var _0x346104={'tls':{'rejectUnauthorized':![]}};if(_0x4458de['Smtp'][_0x538d('0xe7')]){_0x346104[_0x538d('0xe7')]=_0x4458de[_0x538d('0xe5')]['service'];}else{_0x346104[_0x538d('0xe8')]=_0x4458de['Smtp']['host'];_0x346104[_0x538d('0xe9')]=_0x4458de[_0x538d('0xe5')][_0x538d('0xe9')];_0x346104[_0x538d('0xea')]=_0x4458de[_0x538d('0xe5')][_0x538d('0xea')];}if(_0x4458de[_0x538d('0xe5')][_0x538d('0xeb')]){_0x346104['auth']={'user':_0x4458de[_0x538d('0xe5')][_0x538d('0x61')],'pass':_0x4458de[_0x538d('0xe5')][_0x538d('0xec')]};}return respondWithRpcPromise(_0x538d('0xed'),_0x538d('0xee'),{'account':_0x346104,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4458de[_0x538d('0x3d')],_0x4458de[_0x538d('0xef')]||_0x4458de[_0x538d('0xe5')][_0x538d('0x61')]),'to':_0x410d03[_0x538d('0xf0')],'subject':_0x410d03[_0x538d('0xf1')],'html':_0x2aeaf0[_0x538d('0x60')],'attachments':_0x2131ca}},client9003)[_0x538d('0x23')](function(){return _0x2aeaf0;})['catch'](function(_0x4d7e2f){console['error'](_0x4d7e2f);});}})[_0x538d('0x23')](function(){if(_0x410d03&&_0x410d03['openNewInteraction']&&_0x410d03['MailAccountId']){var _0x529213=[];if(_0x51173c[_0x538d('0x4e')]){_0x529213=_0x51173c['map'](function(_0x58b84d){return{'name':_0x58b84d[_0x538d('0xdc')],'basename':_0x58b84d[_0x538d('0x7b')],'type':_0x58b84d[_0x538d('0xdd')],'ChatOfflineMessageId':_0x58c90e['id']};});}var _0x1bd427;if(!_['isNil'](_0x410d03['subjectOffline'])){var _0x7247b6=_[_0x538d('0x42')](_0x83df35[_0x538d('0x60')],function(_0x5b00f5){return _0x5b00f5;});var _0x323e8c=_[_0x538d('0xf2')](_0x7247b6)[0x0];var _0x255213=_[_0x538d('0xf3')](_0x323e8c,function(_0x5ac8a5){return _0x5ac8a5;});_0x1bd427=_0x255213[0x1][_0x410d03[_0x538d('0xf4')]];}var _0x39f8fe={'from':_0x17a497[_0x538d('0xef')],'firstName':_0x17a497[_0x538d('0xc1')],'lastName':_0x17a497['lastName'],'mapKey':_0x538d('0xef'),'message':{'from':_0x17a497[_0x538d('0xef')],'to':_0x410d03[_0x538d('0xd5')]['email'],'cc':'','subject':_['isNil'](_0x1bd427)?_0x410d03[_0x538d('0xf1')]:_0x1bd427,'messageId':'','sentAt':new Date(),'attach':_0x529213[_0x538d('0x4e')],'attachments':_0x529213,'originChannel':_0x538d('0xf5'),'ChatWebsiteId':_0x410d03['id'],'ChatOfflineMessageId':_0x2aeaf0['id'],'originTo':_0x410d03[_0x538d('0xd5')][_0x538d('0xef')]},'body':_0x2aeaf0['body']};var _0x12a9f6={'account':{'id':_0x410d03[_0x538d('0xf6')]},'body':_0x39f8fe,'log':_0x538d('0xf7')};return respondWithRpcPromise('NotifyMailAccount',_0x538d('0xf8'),_0x12a9f6,client9001)['then'](function(){return _0x2aeaf0;})['catch'](function(_0x3e2145){console['error'](_0x3e2145);});}return;})[_0x538d('0x23')](function(){if(_0x2aeaf0){return _0x2aeaf0;}})[_0x538d('0x23')](respondWithResult(_0xcd2ce3,null))['catch'](function(_0x4aaadb){console[_0x538d('0x2a')](_0x538d('0x5b'),_0x4aaadb);for(var _0x227f85 of _0x51173c){var _0x141342=path[_0x538d('0x7e')](config[_0x538d('0x7f')],_0x538d('0xde'),'files',_0x538d('0xdf'),_0x538d('0xf9'),_0x227f85[_0x538d('0x7b')]);fs_extra[_0x538d('0xfa')](_0x141342)[_0x538d('0x5b')](function(_0x24aaf9){console[_0x538d('0x2a')]('Could\x20not\x20remove\x20attachment\x20file',_0x141342,_0x24aaf9);});}});};exports['addInteraction']=function(_0x272811,_0x64e9a,_0x1ec37a){return db[_0x538d('0xbd')][_0x538d('0x64')]({'where':{'id':_0x272811[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x64e9a,null))[_0x538d('0x23')](function(_0x214d87){if(_0x214d87){return _0x214d87[_0x538d('0xfb')](_0x272811[_0x538d('0x60')][_0x538d('0x6f')],_[_0x538d('0xfc')](_0x272811['body'],['ids','id'])||{});}})[_0x538d('0x23')](respondWithResult(_0x64e9a,null))[_0x538d('0x5b')](handleError(_0x64e9a,null));};exports[_0x538d('0xfd')]=function(_0x50fb3a,_0x16ee75,_0x2988df){var _0x280fd0={'raw':![],'where':{}};var _0x220055={};var _0x5093d2={'count':0x0,'rows':[]};return db[_0x538d('0x43')][_0x538d('0x6c')]({'where':{'id':_0x50fb3a[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x16ee75,null))[_0x538d('0x23')](function(_0x1a98e5){if(_0x1a98e5){_0x220055[_0x538d('0x48')]=_[_0x538d('0x5d')](db['ChatInteraction'][_0x538d('0x44')]);_0x220055[_0x538d('0x49')]=_[_0x538d('0x5d')](_0x50fb3a[_0x538d('0x49')]);_0x220055[_0x538d('0x4a')]=_[_0x538d('0x4b')](_0x220055['model'],_0x220055['query']);_0x280fd0[_0x538d('0x4c')]=_[_0x538d('0x4b')](_0x220055[_0x538d('0x48')],qs['fields'](_0x50fb3a[_0x538d('0x49')][_0x538d('0x4d')]));_0x280fd0[_0x538d('0x4c')]=_0x280fd0[_0x538d('0x4c')][_0x538d('0x4e')]?_0x280fd0[_0x538d('0x4c')]:_0x220055[_0x538d('0x48')];if(!_0x50fb3a[_0x538d('0x49')]['hasOwnProperty']('nolimit')){_0x280fd0['limit']=qs['limit'](_0x50fb3a[_0x538d('0x49')][_0x538d('0x30')]);_0x280fd0[_0x538d('0x2e')]=qs['offset'](_0x50fb3a[_0x538d('0x49')][_0x538d('0x2e')]);}_0x280fd0['order']=qs[_0x538d('0x51')](_0x50fb3a[_0x538d('0x49')]['sort']);_0x280fd0[_0x538d('0x52')]=qs[_0x538d('0x4a')](_[_0x538d('0x53')](_0x50fb3a[_0x538d('0x49')],_0x220055[_0x538d('0x4a')]));_0x280fd0[_0x538d('0x52')][_0x538d('0x69')]=_0x1a98e5['id'];if(_0x50fb3a['query'][_0x538d('0x54')]){_0x280fd0['where']=_['merge'](_0x280fd0[_0x538d('0x52')],{'$or':_[_0x538d('0x42')](_0x280fd0['attributes'],function(_0x3e6e29){var _0x1e7193={};_0x1e7193[_0x3e6e29]={'$like':'%'+_0x50fb3a[_0x538d('0x49')][_0x538d('0x54')]+'%'};return _0x1e7193;})});}_0x280fd0=_[_0x538d('0x56')]({},_0x280fd0,_0x50fb3a['options']);return db[_0x538d('0xbd')][_0x538d('0x31')]({'where':_0x280fd0[_0x538d('0x52')]})['then'](function(_0x4c4976){_0x5093d2[_0x538d('0x31')]=_0x4c4976;if(_0x50fb3a['query'][_0x538d('0x58')]){_0x280fd0[_0x538d('0x5e')]=[{'model':db[_0x538d('0x93')],'as':_0x538d('0xfe'),'required':![]},{'model':db['User'],'as':_0x538d('0xff'),'attributes':[_0x538d('0x3d'),_0x538d('0x100'),_0x538d('0x101')],'required':![]},{'model':db[_0x538d('0x102')],'as':_0x538d('0x103'),'attributes':['id',_0x538d('0x3d'),_0x538d('0x104')],'where':_0x50fb3a[_0x538d('0x49')][_0x538d('0x105')]?{'id':_0x50fb3a['query'][_0x538d('0x105')]}:undefined,'required':_0x50fb3a['query']['tag']?!![]:![]}];}return db[_0x538d('0xbd')][_0x538d('0x59')](_0x280fd0);})[_0x538d('0x23')](function(_0x20d793){_0x5093d2[_0x538d('0x5a')]=_0x20d793;return _0x5093d2;});}})[_0x538d('0x23')](respondWithFilteredResult(_0x16ee75,_0x280fd0))[_0x538d('0x5b')](handleError(_0x16ee75,null));};function iftimePromise(_0xc9f4fb,_0x236852){return respondWithRpcPromise(_0x538d('0x106'),'getSnippet',{'command':_0x236852[_0x538d('0x107')]?util[_0x538d('0xba')](_0x538d('0x108'),_0xc9f4fb[_0x538d('0x109')],_0x236852[_0x538d('0x107')]):util[_0x538d('0xba')](_0x538d('0x10a'),_0xc9f4fb['interval'])},client9002)[_0x538d('0x23')](function(_0x3628e5){var _0xc37888=_0x3628e5&&_0x3628e5['indexOf'](_0x538d('0x10b'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x236852['id'],_0xc9f4fb['id'],_0xc9f4fb[_0x538d('0x109')],_0xc37888?'ONLINE':_0x538d('0x10c'),_0x236852['timezone']?_0x236852[_0x538d('0x107')]:_0x538d('0x10d'));return _0xc37888;})[_0x538d('0x5b')](function(_0x56b56f){logger['error'](_0x538d('0x10e'),_0x236852['id'],_0xc9f4fb['id'],_0xc9f4fb[_0x538d('0x109')],util[_0x538d('0x10f')](_0x56b56f,{'showHidden':![],'depth':null}),_0x236852['timezone']?_0x236852[_0x538d('0x107')]:_0x538d('0x10d'));return![];});}exports['getSnippet']=function(_0x42f3e6,_0x405d55,_0x115f19){var _0x5a3af9=0x0;var _0x2245b1=0x0;var _0x2f7aff=![];var _0x38eb8f;var _0x20337c;return db[_0x538d('0x43')]['find']({'where':{'id':_0x42f3e6['params']['id']},'include':[{'model':db[_0x538d('0x110')],'as':_0x538d('0x110'),'include':[{'model':db[_0x538d('0x110')],'as':_0x538d('0x111'),'attributes':['id',_0x538d('0x109')],'raw':!![]}]}]})[_0x538d('0x23')](handleEntityNotFound(_0x405d55,null))[_0x538d('0x23')](function(_0x1177ac){if(_0x1177ac){_0x38eb8f=_0x1177ac;return _0x1177ac[_0x538d('0x112')]({'raw':!![]});}})[_0x538d('0x23')](function(_0x33b272){if(_0x38eb8f){if(_0x33b272){_0x20337c=_0x33b272;}}return require(_0x538d('0x19'))[_0x538d('0x81')]();})[_0x538d('0x23')](function(_0x4c612a){if(_0x4c612a){_0x2245b1=_0x4c612a['virtual'];_0x2f7aff=_0x4c612a[_0x538d('0x82')];}})[_0x538d('0x23')](function(){return db['ChatInteraction'][_0x538d('0x31')]({'where':{'closed':![]}});})[_0x538d('0x23')](function(_0x4f8b78){_0x5a3af9=_0x4f8b78;if(_0x2245b1&&_0x4f8b78>_0x2245b1){return db['License'][_0x538d('0x6c')]({'where':{'id':0x1}})[_0x538d('0x23')](function(_0x3d1a13){if(_0x3d1a13){_0x3d1a13[_0x538d('0x113')](_0x538d('0x114'));}});}})[_0x538d('0x23')](function(){if(_0x38eb8f[_0x538d('0x110')]&&_0x38eb8f[_0x538d('0x110')][_0x538d('0x111')]){var _0x5736fd=[];for(var _0x2589f3=0x0;_0x2589f3<_0x38eb8f[_0x538d('0x110')][_0x538d('0x111')]['length'];_0x2589f3++){var _0xafbfa8=_0x38eb8f[_0x538d('0x110')][_0x538d('0x111')][_0x2589f3][_0x538d('0x37')]({'plain':!![]});_0x5736fd[_0x538d('0x115')](iftimePromise(_0xafbfa8,_0x38eb8f));}return BPromise[_0x538d('0x116')](_0x5736fd)[_0x538d('0x23')](function(_0x54ae15){return _['some'](_0x54ae15);});}else{return!![];}})['then'](function(_0x512518){var _0x1d6d44=fs['readFileSync'](path[_0x538d('0x7e')](config[_0x538d('0x7f')],_0x538d('0x117')),_0x538d('0x118'));var _0x484c4d={'remote':_0x38eb8f['remote'],'query':querystring[_0x538d('0x29')](_[_0x538d('0x56')](_0x38eb8f['get']({'plain':!![]}),{'customerIp':_0x42f3e6[_0x538d('0x8f')][_0x538d('0xb0')]||_0x42f3e6[_0x538d('0x8f')][_0x538d('0x119')]||_0x42f3e6[_0x538d('0x11a')][_0x538d('0x11b')]||_0x42f3e6['ip'],'referer':_0x42f3e6[_0x538d('0x8f')]['referer'],'openedInteractions':_0x5a3af9,'maxInteractions':_0x2245b1,'virtual':_0x2f7aff['virtual'],'online':_0x512518,'custom':_0x2f7aff}))['replace'](/'/g,'\x5c\x27')};_0x405d55[_0x538d('0x3e')](ejs[_0x538d('0xda')](Mustache[_0x538d('0xda')](_0x1d6d44,_0x484c4d),{'proactiveActions':_0x20337c,'alignment':_0x38eb8f[_0x538d('0x11c')],'verticalAlignment':_0x38eb8f[_0x538d('0x11d')],'div_color':_0x38eb8f[_0x538d('0x104')],'text_color':_0x38eb8f['textColor'],'button_color':_0x38eb8f[_0x538d('0x11e')],'background_color':_0x38eb8f['backgroundColor']}));})[_0x538d('0x5b')](handleError(_0x405d55,null));};exports[_0x538d('0x11f')]=function(_0xa862f2,_0xf627e1,_0x762062){return db[_0x538d('0x43')][_0x538d('0x6c')]({'where':{'id':_0xa862f2['params']['id']}})[_0x538d('0x23')](handleEntityNotFound(_0xf627e1,null))[_0x538d('0x23')](function(_0x20f404){if(_0x20f404){return db[_0x538d('0x120')][_0x538d('0xe2')](function(_0x4b9792){return db['ChatApplication'][_0x538d('0x3a')]({'where':{'ChatWebsiteId':_0xa862f2[_0x538d('0x5c')]['id']},'transaction':_0x4b9792})[_0x538d('0x23')](function(_0x4b8f02){var _0x3d1034=_[_0x538d('0x42')](_0xa862f2[_0x538d('0x60')],function(_0x314fb0){_0x314fb0['ChatWebsiteId']=_0xa862f2[_0x538d('0x5c')]['id'];return _0x314fb0;});return db[_0x538d('0xa6')][_0x538d('0x121')](_0x3d1034,{'transaction':_0x4b9792});});})[_0x538d('0x23')](function(){return db['ChatApplication'][_0x538d('0x122')]({'where':{'ChatWebsiteId':_0xa862f2['params']['id']},'order':_0x538d('0xab')});});}})[_0x538d('0x23')](respondWithResult(_0xf627e1,null))[_0x538d('0x5b')](handleError(_0xf627e1,null));};exports[_0x538d('0x123')]=function(_0x33351e,_0x2c9107,_0x120b59){var _0x9c66c7={};var _0x5890ab={};var _0x415c97;var _0x43eced;return db[_0x538d('0x43')]['findOne']({'where':{'id':_0x33351e[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x2c9107,null))[_0x538d('0x23')](function(_0x4cd550){if(_0x4cd550){_0x415c97=_0x4cd550;_0x5890ab[_0x538d('0x48')]=_[_0x538d('0x5d')](db['ChatApplication'][_0x538d('0x44')]);_0x5890ab[_0x538d('0x49')]=_[_0x538d('0x5d')](_0x33351e[_0x538d('0x49')]);_0x5890ab[_0x538d('0x4a')]=_['intersection'](_0x5890ab[_0x538d('0x48')],_0x5890ab['query']);_0x9c66c7[_0x538d('0x4c')]=_[_0x538d('0x4b')](_0x5890ab['model'],qs[_0x538d('0x4d')](_0x33351e[_0x538d('0x49')][_0x538d('0x4d')]));_0x9c66c7[_0x538d('0x4c')]=_0x9c66c7[_0x538d('0x4c')][_0x538d('0x4e')]?_0x9c66c7[_0x538d('0x4c')]:_0x5890ab[_0x538d('0x48')];_0x9c66c7[_0x538d('0x6d')]=qs[_0x538d('0x51')](_0x33351e[_0x538d('0x49')]['sort']);_0x9c66c7[_0x538d('0x52')]=qs[_0x538d('0x4a')](_['pick'](_0x33351e[_0x538d('0x49')],_0x5890ab['filters']));if(_0x33351e['query'][_0x538d('0x54')]){_0x9c66c7['where']=_[_0x538d('0x56')](_0x9c66c7[_0x538d('0x52')],{'$or':_[_0x538d('0x42')](_0x9c66c7[_0x538d('0x4c')],function(_0x5261db){var _0x1cf780={};_0x1cf780[_0x5261db]={'$like':'%'+_0x33351e[_0x538d('0x49')]['filter']+'%'};return _0x1cf780;})});}_0x9c66c7=_[_0x538d('0x56')]({},_0x9c66c7,_0x33351e[_0x538d('0x57')]);return _0x415c97[_0x538d('0x123')](_0x9c66c7);}})[_0x538d('0x23')](function(_0x35e81b){if(_0x35e81b){_0x43eced=_0x35e81b['length'];if(!_0x33351e[_0x538d('0x49')][_0x538d('0x4f')](_0x538d('0x50'))){_0x9c66c7[_0x538d('0x30')]=qs[_0x538d('0x30')](_0x33351e[_0x538d('0x49')][_0x538d('0x30')]);_0x9c66c7['offset']=qs[_0x538d('0x2e')](_0x33351e[_0x538d('0x49')][_0x538d('0x2e')]);}return _0x415c97[_0x538d('0x123')](_0x9c66c7);}})[_0x538d('0x23')](function(_0x101ac3){if(_0x101ac3){return _0x101ac3?{'count':_0x43eced,'rows':_0x101ac3}:null;}})[_0x538d('0x23')](respondWithResult(_0x2c9107,null))[_0x538d('0x5b')](handleError(_0x2c9107,null));};exports['addProactiveActions']=function(_0x58fcfe,_0x41ea2a,_0x161e70){return db['chatProactiveAction'][_0x538d('0x64')]({'where':{'id':_0x58fcfe['params']['id']}})['then'](handleEntityNotFound(_0x41ea2a,null))[_0x538d('0x23')](function(_0x33f39c){if(_0x33f39c){return _0x33f39c[_0x538d('0x124')](_0x58fcfe[_0x538d('0x60')][_0x538d('0x6f')],_[_0x538d('0xfc')](_0x58fcfe['body'],['ids','id'])||{});}})[_0x538d('0x23')](respondWithResult(_0x41ea2a,null))[_0x538d('0x5b')](handleError(_0x41ea2a,null));};exports[_0x538d('0x112')]=function(_0x1ccff8,_0x13fc3a,_0x590ff4){var _0x8efe52={};var _0x9c121a={};var _0x2f6338;var _0x5a1dd9;return db[_0x538d('0x43')]['findOne']({'where':{'id':_0x1ccff8[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x13fc3a,null))[_0x538d('0x23')](function(_0x1f22b5){if(_0x1f22b5){_0x2f6338=_0x1f22b5;_0x9c121a[_0x538d('0x48')]=_[_0x538d('0x5d')](db[_0x538d('0x125')]['rawAttributes']);_0x9c121a[_0x538d('0x49')]=_[_0x538d('0x5d')](_0x1ccff8[_0x538d('0x49')]);_0x9c121a[_0x538d('0x4a')]=_['intersection'](_0x9c121a['model'],_0x9c121a[_0x538d('0x49')]);_0x8efe52['attributes']=_[_0x538d('0x4b')](_0x9c121a[_0x538d('0x48')],qs[_0x538d('0x4d')](_0x1ccff8[_0x538d('0x49')][_0x538d('0x4d')]));_0x8efe52[_0x538d('0x4c')]=_0x8efe52['attributes'][_0x538d('0x4e')]?_0x8efe52[_0x538d('0x4c')]:_0x9c121a[_0x538d('0x48')];_0x8efe52[_0x538d('0x6d')]=qs[_0x538d('0x51')](_0x1ccff8['query']['sort']);_0x8efe52[_0x538d('0x52')]=qs[_0x538d('0x4a')](_[_0x538d('0x53')](_0x1ccff8[_0x538d('0x49')],_0x9c121a[_0x538d('0x4a')]));if(_0x1ccff8['query'][_0x538d('0x54')]){_0x8efe52[_0x538d('0x52')]=_[_0x538d('0x56')](_0x8efe52[_0x538d('0x52')],{'$or':_[_0x538d('0x42')](_0x8efe52[_0x538d('0x4c')],function(_0x93fddc){var _0x2fb685={};_0x2fb685[_0x93fddc]={'$like':'%'+_0x1ccff8[_0x538d('0x49')][_0x538d('0x54')]+'%'};return _0x2fb685;})});}_0x8efe52=_[_0x538d('0x56')]({},_0x8efe52,_0x1ccff8[_0x538d('0x57')]);return _0x2f6338[_0x538d('0x112')](_0x8efe52);}})[_0x538d('0x23')](function(_0x1708cb){if(_0x1708cb){_0x5a1dd9=_0x1708cb[_0x538d('0x4e')];if(!_0x1ccff8[_0x538d('0x49')]['hasOwnProperty'](_0x538d('0x50'))){_0x8efe52['limit']=qs['limit'](_0x1ccff8[_0x538d('0x49')][_0x538d('0x30')]);_0x8efe52[_0x538d('0x2e')]=qs[_0x538d('0x2e')](_0x1ccff8[_0x538d('0x49')]['offset']);}return _0x2f6338[_0x538d('0x112')](_0x8efe52);}})[_0x538d('0x23')](function(_0x4ced69){if(_0x4ced69){return _0x4ced69?{'count':_0x5a1dd9,'rows':_0x4ced69}:null;}})['then'](respondWithResult(_0x13fc3a,null))[_0x538d('0x5b')](handleError(_0x13fc3a,null));};exports['getFields']=function(_0x36a04d,_0x4fa347,_0x5a0c97){var _0x2a5335=_0x36a04d[_0x538d('0x49')][_0x538d('0x126')]==='false'?'offlineForm':_0x538d('0x127');return db['ChatWebsite'][_0x538d('0x64')]({'attributes':['id',_0x2a5335],'where':{'id':_0x36a04d[_0x538d('0x5c')]['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x4fa347,null))[_0x538d('0x23')](function(_0x18ab41){if(_0x18ab41){var _0x9d91e2=_0x18ab41[_0x2a5335];var _0x39edcd=_0x9d91e2&&_0x9d91e2[_0x538d('0x128')]?_0x9d91e2[_0x538d('0x128')]:[];_0x4fa347[_0x538d('0x3e')]({'fromKey':_[_0x538d('0x83')](_0x9d91e2[_0x538d('0x129')])?undefined:_0x9d91e2[_0x538d('0x129')],'count':_0x39edcd['length'],'rows':_0x39edcd});}})['catch'](handleError(_0x4fa347,null));};exports['getOfflineMessages']=function(_0x346921,_0x1f2361,_0x40b6f9){var _0x1a7f1f={'raw':![],'where':{}};var _0x118892={};var _0x5f1348={'count':0x0,'rows':[]};return db[_0x538d('0x43')]['findOne']({'where':{'id':_0x346921['params']['id']}})[_0x538d('0x23')](handleEntityNotFound(_0x1f2361,null))[_0x538d('0x23')](function(_0x105e25){if(_0x105e25){_0x118892['model']=_[_0x538d('0x5d')](db[_0x538d('0x12a')][_0x538d('0x44')]);_0x118892[_0x538d('0x49')]=_['keys'](_0x346921[_0x538d('0x49')]);_0x118892[_0x538d('0x4a')]=_[_0x538d('0x4b')](_0x118892[_0x538d('0x48')],_0x118892[_0x538d('0x49')]);_0x1a7f1f['attributes']=_[_0x538d('0x4b')](_0x118892['model'],qs[_0x538d('0x4d')](_0x346921['query']['fields']));_0x1a7f1f[_0x538d('0x4c')]=_0x1a7f1f[_0x538d('0x4c')][_0x538d('0x4e')]?_0x1a7f1f['attributes']:_0x118892['model'];if(!_0x346921[_0x538d('0x49')]['hasOwnProperty'](_0x538d('0x50'))){_0x1a7f1f[_0x538d('0x30')]=qs[_0x538d('0x30')](_0x346921[_0x538d('0x49')][_0x538d('0x30')]);_0x1a7f1f[_0x538d('0x2e')]=qs['offset'](_0x346921[_0x538d('0x49')][_0x538d('0x2e')]);}_0x1a7f1f[_0x538d('0x6d')]=qs[_0x538d('0x51')](_0x346921[_0x538d('0x49')][_0x538d('0x51')]);_0x1a7f1f[_0x538d('0x52')]=qs[_0x538d('0x4a')](_['pick'](_0x346921[_0x538d('0x49')],_0x118892[_0x538d('0x4a')]));_0x1a7f1f[_0x538d('0x52')][_0x538d('0x69')]=_0x105e25['id'];if(_0x346921[_0x538d('0x49')][_0x538d('0x54')]){_0x1a7f1f['where']=_['merge'](_0x1a7f1f[_0x538d('0x52')],{'$or':_[_0x538d('0x42')](_0x1a7f1f[_0x538d('0x4c')],function(_0x1f729c){var _0x5ccac7={};_0x5ccac7[_0x1f729c]={'$like':'%'+_0x346921['query'][_0x538d('0x54')]+'%'};return _0x5ccac7;})});}_0x1a7f1f=_['merge']({},_0x1a7f1f,_0x346921[_0x538d('0x57')]);return db['ChatOfflineMessage'][_0x538d('0x31')]({'where':_0x1a7f1f['where']})[_0x538d('0x23')](function(_0x5b5db3){_0x5f1348[_0x538d('0x31')]=_0x5b5db3;if(_0x346921['query'][_0x538d('0x58')]){_0x1a7f1f['include']=[{'all':!![]}];}else{_0x1a7f1f[_0x538d('0x5e')]=[{'model':db[_0x538d('0x93')],'as':_0x538d('0xfe'),'required':![]},{'model':db[_0x538d('0xe3')],'as':_0x538d('0x12b'),'required':![]}];}return db[_0x538d('0x12a')]['findAll'](_0x1a7f1f);})[_0x538d('0x23')](function(_0x5f1280){_0x5f1348[_0x538d('0x5a')]=_0x5f1280;return _0x5f1348;});}})[_0x538d('0x23')](respondWithFilteredResult(_0x1f2361,_0x1a7f1f))[_0x538d('0x5b')](handleError(_0x1f2361,null));};exports[_0x538d('0x12c')]=function(_0x2a1d84,_0x3b0d6b,_0x3ab7cb){return db[_0x538d('0x43')][_0x538d('0x64')]({'where':{'id':_0x2a1d84['params']['id']}})['then'](handleEntityNotFound(_0x3b0d6b,null))[_0x538d('0x23')](function(_0x1a8b9e){if(_0x1a8b9e){return _0x1a8b9e[_0x538d('0x12c')](_0x2a1d84[_0x538d('0x60')][_0x538d('0x6f')],_[_0x538d('0xfc')](_0x2a1d84[_0x538d('0x60')],['ids','id'])||{})[_0x538d('0xd8')](function(_0x5ea2b0){for(var _0x2dce5c=0x0;_0x2dce5c<_0x2a1d84[_0x538d('0x60')][_0x538d('0x6f')][_0x538d('0x4e')];_0x2dce5c+=0x1){socket[_0x538d('0x12d')](_0x538d('0x12e'),{'UserId':Number(_0x2a1d84[_0x538d('0x60')][_0x538d('0x6f')][_0x2dce5c]),'ChatWebsiteId':Number(_0x2a1d84[_0x538d('0x5c')]['id'])});}return _0x5ea2b0;});}})[_0x538d('0x23')](respondWithResult(_0x3b0d6b,null))[_0x538d('0x5b')](handleError(_0x3b0d6b,null));};exports[_0x538d('0x12f')]=function(_0xa02987,_0x10c677,_0x5dd596){return db[_0x538d('0x43')][_0x538d('0x64')]({'where':{'id':_0xa02987['params']['id']}})['then'](handleEntityNotFound(_0x10c677,null))[_0x538d('0x23')](function(_0x2d8831){if(_0x2d8831){return _0x2d8831[_0x538d('0x12f')](_0xa02987['query'][_0x538d('0x6f')])[_0x538d('0x23')](function(){if(_[_0x538d('0x130')](_0xa02987['query'][_0x538d('0x6f')])){for(var _0x3e2754=0x0;_0x3e2754<_0xa02987[_0x538d('0x49')][_0x538d('0x6f')]['length'];_0x3e2754+=0x1){socket[_0x538d('0x12d')](_0x538d('0x131'),{'UserId':Number(_0xa02987['query'][_0x538d('0x6f')][_0x3e2754]),'ChatWebsiteId':Number(_0xa02987[_0x538d('0x5c')]['id'])});}}else{socket[_0x538d('0x12d')](_0x538d('0x131'),{'UserId':Number(_0xa02987['query'][_0x538d('0x6f')]),'ChatWebsiteId':Number(_0xa02987[_0x538d('0x5c')]['id'])});}});}})[_0x538d('0x23')](respondWithStatusCode(_0x10c677,null))[_0x538d('0x5b')](handleError(_0x10c677,null));};exports[_0x538d('0x132')]=function(_0x38d6d1,_0x2caaec,_0x25c8ba){var _0x507908={};var _0x49722b={};var _0x2f731e;var _0x26a4b9;return db[_0x538d('0x43')][_0x538d('0x6c')]({'where':{'id':_0x38d6d1[_0x538d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2caaec,null))[_0x538d('0x23')](function(_0x4fdbe4){if(_0x4fdbe4){_0x2f731e=_0x4fdbe4;_0x49722b[_0x538d('0x48')]=_[_0x538d('0x5d')](db[_0x538d('0x133')]['rawAttributes']);_0x49722b[_0x538d('0x49')]=_['keys'](_0x38d6d1[_0x538d('0x49')]);_0x49722b[_0x538d('0x4a')]=_['intersection'](_0x49722b[_0x538d('0x48')],_0x49722b[_0x538d('0x49')]);_0x507908[_0x538d('0x4c')]=_[_0x538d('0x4b')](_0x49722b['model'],qs[_0x538d('0x4d')](_0x38d6d1[_0x538d('0x49')][_0x538d('0x4d')]));_0x507908[_0x538d('0x4c')]=_0x507908[_0x538d('0x4c')]['length']?_0x507908[_0x538d('0x4c')]:_0x49722b['model'];_0x507908[_0x538d('0x6d')]=qs[_0x538d('0x51')](_0x38d6d1[_0x538d('0x49')][_0x538d('0x51')]);_0x507908['where']=qs[_0x538d('0x4a')](_[_0x538d('0x53')](_0x38d6d1[_0x538d('0x49')],_0x49722b[_0x538d('0x4a')]));if(_0x38d6d1[_0x538d('0x49')][_0x538d('0x54')]){_0x507908[_0x538d('0x52')]=_[_0x538d('0x56')](_0x507908[_0x538d('0x52')],{'$or':_[_0x538d('0x42')](_0x507908[_0x538d('0x4c')],function(_0x828f28){var _0x2ddb25={};_0x2ddb25[_0x828f28]={'$like':'%'+_0x38d6d1[_0x538d('0x49')]['filter']+'%'};return _0x2ddb25;})});}_0x507908=_[_0x538d('0x56')]({},_0x507908,_0x38d6d1[_0x538d('0x57')]);return _0x2f731e['getAgents'](_0x507908);}})[_0x538d('0x23')](function(_0x3ca509){if(_0x3ca509){_0x26a4b9=_0x3ca509[_0x538d('0x4e')];if(!_0x38d6d1['query']['hasOwnProperty'](_0x538d('0x50'))){_0x507908['limit']=qs[_0x538d('0x30')](_0x38d6d1[_0x538d('0x49')]['limit']);_0x507908[_0x538d('0x2e')]=qs[_0x538d('0x2e')](_0x38d6d1[_0x538d('0x49')][_0x538d('0x2e')]);}return _0x2f731e[_0x538d('0x132')](_0x507908);}})['then'](function(_0x193ff7){if(_0x193ff7){return _0x193ff7?{'count':_0x26a4b9,'rows':_0x193ff7}:null;}})[_0x538d('0x23')](respondWithResult(_0x2caaec,null))['catch'](handleError(_0x2caaec,null));}; \ No newline at end of file +var _0xf77a=['user-agent','getResult','CmContact','Sequelize','updatedAt','difference','createdAt','CompanyId','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','list','priority','asc','account','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','vendor','device','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','no\x20available\x20attributes','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','mapKeyOffline','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','user','pass','SendMail','sendMail','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','tag','getSnippet','timezone','iftime\x20%s,%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','some','server/files/chat/iframe.ejs','remote','x-real-ip','render','verticalAlignment','textColor','color_button','backgroundColor','addApplications','bulkCreate','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatWebsite.socket','http','client','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','ChatWebsite','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','rawAttributes','length','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','ChatWebsiteId','removeAnswers','ids','addLogo','sitepic','file','filename','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','customerAvatar','showCustomerAvatar','getSystemAvatar','user-agent-parser','setUA'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xf77a,0xa6));var _0xaf77=function(_0x22c1cf,_0x415015){_0x22c1cf=_0x22c1cf-0x0;var _0x3029c1=_0xf77a[_0x22c1cf];return _0x3029c1;};'use strict';var emlformat=require(_0xaf77('0x0'));var rimraf=require(_0xaf77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf77('0x2'));var rp=require(_0xaf77('0x3'));var moment=require(_0xaf77('0x4'));var BPromise=require(_0xaf77('0x5'));var Mustache=require(_0xaf77('0x6'));var util=require('util');var path=require('path');var sox=require(_0xaf77('0x7'));var csv=require(_0xaf77('0x8'));var ejs=require(_0xaf77('0x9'));var fs=require('fs');var fs_extra=require(_0xaf77('0xa'));var _=require(_0xaf77('0xb'));var squel=require(_0xaf77('0xc'));var crypto=require(_0xaf77('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaf77('0xe'));var toCsv=require(_0xaf77('0x8'));var querystring=require(_0xaf77('0xf'));var Papa=require(_0xaf77('0x10'));var Redis=require('ioredis');var authService=require(_0xaf77('0x11'));var qs=require(_0xaf77('0x12'));var as=require(_0xaf77('0x13'));var hardwareService=require(_0xaf77('0x14'));var logger=require(_0xaf77('0x15'))(_0xaf77('0x16'));var utils=require(_0xaf77('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xaf77('0x18'));var db=require(_0xaf77('0x19'))['db'];config['redis']=_[_0xaf77('0x1a')](config[_0xaf77('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf77('0x1c'))(new Redis(config[_0xaf77('0x1b')]));require(_0xaf77('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xaf77('0x1e')]({'port':0x232c});var client9002=jayson[_0xaf77('0x1f')][_0xaf77('0x1e')]({'port':0x232a});var client9003=jayson[_0xaf77('0x1f')][_0xaf77('0x1e')]({'port':0x232b});var client9001=jayson[_0xaf77('0x1f')][_0xaf77('0x1e')]({'port':0x2329});function respondWithRpcPromise(_0x1ee367,_0x5eb747,_0x2b47e4,_0x117c53){return new BPromise(function(_0x5029c1,_0x263ff4){var _0x17e485=_0x117c53||client;return _0x17e485[_0xaf77('0x20')](_0x1ee367,_0x2b47e4)[_0xaf77('0x21')](function(_0x3707f3){logger[_0xaf77('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x5eb747,_0xaf77('0x23'));logger[_0xaf77('0x24')](_0xaf77('0x25'),_0x5eb747,_0xaf77('0x23'),JSON[_0xaf77('0x26')](_0x3707f3));if(_0x3707f3['error']){if(_0x3707f3[_0xaf77('0x27')][_0xaf77('0x28')]===0x1f4){logger[_0xaf77('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x5eb747,_0x3707f3['error'][_0xaf77('0x29')]);return _0x263ff4(_0x3707f3[_0xaf77('0x27')][_0xaf77('0x29')]);}logger[_0xaf77('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x5eb747,_0x3707f3[_0xaf77('0x27')][_0xaf77('0x29')]);return _0x5029c1(_0x3707f3[_0xaf77('0x27')][_0xaf77('0x29')]);}else{logger[_0xaf77('0x22')](_0xaf77('0x2a'),_0x5eb747,'request\x20sent');_0x5029c1(_0x3707f3['result'][_0xaf77('0x29')]);}})[_0xaf77('0x2b')](function(_0x223cee){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5eb747,_0x223cee);_0x263ff4(_0x223cee);});});}function respondWithStatusCode(_0x1613ef,_0x5edf16){_0x5edf16=_0x5edf16||0xcc;return function(_0xc4acb7){if(_0xc4acb7){return _0x1613ef[_0xaf77('0x2c')](_0x5edf16);}return _0x1613ef[_0xaf77('0x2d')](_0x5edf16)[_0xaf77('0x2e')]();};}function respondWithResult(_0x1f2935,_0x5d3978){_0x5d3978=_0x5d3978||0xc8;return function(_0x1bc186){if(_0x1bc186){return _0x1f2935[_0xaf77('0x2d')](_0x5d3978)[_0xaf77('0x2f')](_0x1bc186);}};}function respondWithFilteredResult(_0x3055d3,_0x3bb10b){return function(_0x4ba01d){if(_0x4ba01d){var _0x5422bc=typeof _0x3bb10b[_0xaf77('0x30')]===_0xaf77('0x31')&&typeof _0x3bb10b[_0xaf77('0x32')]===_0xaf77('0x31');var _0x1fcdd6=_0x4ba01d['count'];var _0x1f8f25=_0x5422bc?0x0:_0x3bb10b[_0xaf77('0x30')];var _0x2d54d6=_0x5422bc?_0x4ba01d['count']:_0x3bb10b[_0xaf77('0x30')]+_0x3bb10b[_0xaf77('0x32')];var _0x23793d;if(_0x2d54d6>=_0x1fcdd6){_0x2d54d6=_0x1fcdd6;_0x23793d=0xc8;}else{_0x23793d=0xce;}_0x3055d3['status'](_0x23793d);return _0x3055d3['set'](_0xaf77('0x33'),_0x1f8f25+'-'+_0x2d54d6+'/'+_0x1fcdd6)[_0xaf77('0x2f')](_0x4ba01d);}return null;};}function patchUpdates(_0x35e907){return function(_0x487835){try{jsonpatch['apply'](_0x487835,_0x35e907,!![]);}catch(_0x411ebf){return BPromise['reject'](_0x411ebf);}return _0x487835['save']();};}function saveUpdates(_0x24eabd,_0x3b6d88){return function(_0x58a766){if(_0x58a766){return _0x58a766[_0xaf77('0x34')](_0x24eabd)[_0xaf77('0x21')](function(_0x43c39c){return _0x43c39c;});}return null;};}function removeEntity(_0x3e16c2,_0x53c0a0){return function(_0x5e3a76){if(_0x5e3a76){return _0x5e3a76[_0xaf77('0x35')]()[_0xaf77('0x21')](function(){var _0x4b6c11=_0x5e3a76[_0xaf77('0x36')]({'plain':!![]});var _0x59fc91='ChatWebsites';return db[_0xaf77('0x37')]['destroy']({'where':{'type':_0x59fc91,'resourceId':_0x4b6c11['id']}})['then'](function(){return _0x5e3a76;});})[_0xaf77('0x21')](function(){_0x3e16c2['status'](0xcc)[_0xaf77('0x2e')]();});}};}function handleEntityNotFound(_0x1c66e7,_0x1c9632){return function(_0x10d817){if(!_0x10d817){_0x1c66e7['sendStatus'](0x194);}return _0x10d817;};}function handleError(_0x4d263f,_0x539ed8){_0x539ed8=_0x539ed8||0x1f4;return function(_0x5f539a){logger[_0xaf77('0x27')](_0x5f539a[_0xaf77('0x38')]);if(_0x5f539a[_0xaf77('0x39')]){delete _0x5f539a['name'];}_0x4d263f[_0xaf77('0x2d')](_0x539ed8)[_0xaf77('0x3a')](_0x5f539a);};}exports[_0xaf77('0x3b')]=function(_0x666e10,_0x17d59a){var _0x16ecad={'include':[{'model':db[_0xaf77('0x3c')],'as':_0xaf77('0x3d')}]},_0x58ef6f={},_0x5c2b7c={'count':0x0,'rows':[]};var _0x47edde=_[_0xaf77('0x3e')](db['ChatWebsite']['rawAttributes'],function(_0x40ab1a){return{'name':_0x40ab1a[_0xaf77('0x3f')],'type':_0x40ab1a['type'][_0xaf77('0x40')]};});_0x58ef6f[_0xaf77('0x41')]=_['map'](_0x47edde,_0xaf77('0x39'));_0x58ef6f[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x666e10[_0xaf77('0x42')]);_0x58ef6f[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0x58ef6f[_0xaf77('0x41')],_0x58ef6f[_0xaf77('0x42')]);_0x16ecad[_0xaf77('0x46')]=_['intersection'](_0x58ef6f[_0xaf77('0x41')],qs[_0xaf77('0x47')](_0x666e10[_0xaf77('0x42')][_0xaf77('0x47')]));_0x16ecad['attributes']=_0x16ecad[_0xaf77('0x46')]['length']?_0x16ecad[_0xaf77('0x46')]:_0x58ef6f[_0xaf77('0x41')];if(!_0x666e10[_0xaf77('0x42')][_0xaf77('0x48')](_0xaf77('0x49'))){_0x16ecad[_0xaf77('0x32')]=qs[_0xaf77('0x32')](_0x666e10[_0xaf77('0x42')][_0xaf77('0x32')]);_0x16ecad[_0xaf77('0x30')]=qs[_0xaf77('0x30')](_0x666e10[_0xaf77('0x42')][_0xaf77('0x30')]);}_0x16ecad['order']=qs['sort'](_0x666e10['query'][_0xaf77('0x4a')]);_0x16ecad['where']=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x666e10[_0xaf77('0x42')],_0x58ef6f[_0xaf77('0x44')]),_0x47edde);if(_0x666e10[_0xaf77('0x42')][_0xaf77('0x4c')]){_0x16ecad[_0xaf77('0x4d')]=_[_0xaf77('0x4e')](_0x16ecad['where'],{'$or':_[_0xaf77('0x3e')](_0x47edde,function(_0x1a8355){if(_0x1a8355[_0xaf77('0x4f')]!==_0xaf77('0x50')){var _0x21acdd={};_0x21acdd[_0x1a8355[_0xaf77('0x39')]]={'$like':'%'+_0x666e10['query'][_0xaf77('0x4c')]+'%'};return _0x21acdd;}})});}_0x16ecad=_[_0xaf77('0x4e')]({},_0x16ecad,_0x666e10['options']);var _0x497bc1={'where':_0x16ecad[_0xaf77('0x4d')]};return db['ChatWebsite'][_0xaf77('0x51')](_0x497bc1)[_0xaf77('0x21')](function(_0x15e151){_0x5c2b7c[_0xaf77('0x51')]=_0x15e151;if(_0x666e10[_0xaf77('0x42')][_0xaf77('0x52')]){_0x16ecad[_0xaf77('0x53')]=[{'all':!![]}];}return db['ChatWebsite'][_0xaf77('0x54')](_0x16ecad);})['then'](function(_0x3aea01){_0x5c2b7c[_0xaf77('0x55')]=_0x3aea01;return _0x5c2b7c;})[_0xaf77('0x21')](respondWithFilteredResult(_0x17d59a,_0x16ecad))[_0xaf77('0x2b')](handleError(_0x17d59a,null));};exports[_0xaf77('0x56')]=function(_0x37acee,_0x47b107){var _0x921805={'raw':![],'where':{'id':_0x37acee[_0xaf77('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xaf77('0x3d')}]},_0x3120ac={};_0x3120ac['model']=_[_0xaf77('0x43')](db[_0xaf77('0x58')]['rawAttributes']);_0x3120ac['query']=_[_0xaf77('0x43')](_0x37acee['query']);_0x3120ac[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0x3120ac['model'],_0x3120ac[_0xaf77('0x42')]);_0x921805[_0xaf77('0x46')]=_[_0xaf77('0x45')](_0x3120ac['model'],qs['fields'](_0x37acee[_0xaf77('0x42')][_0xaf77('0x47')]));_0x921805[_0xaf77('0x46')]=_0x921805['attributes']['length']?_0x921805['attributes']:_0x3120ac[_0xaf77('0x41')];if(_0x37acee[_0xaf77('0x42')]['includeAll']){_0x921805[_0xaf77('0x53')]=[{'all':!![]}];}_0x921805=_['merge']({},_0x921805,_0x37acee[_0xaf77('0x59')]);return db[_0xaf77('0x58')][_0xaf77('0x5a')](_0x921805)[_0xaf77('0x21')](handleEntityNotFound(_0x47b107,null))[_0xaf77('0x21')](respondWithResult(_0x47b107,null))['catch'](handleError(_0x47b107,null));};exports[_0xaf77('0x5b')]=function(_0x34f1ce,_0x4b0179){return db['ChatWebsite'][_0xaf77('0x5b')](_0x34f1ce[_0xaf77('0x5c')],{})['then'](function(_0x463b57){var _0x1ed097=_0x34f1ce['user']['get']({'plain':!![]});if(!_0x1ed097)throw new Error(_0xaf77('0x5d'));if(_0x1ed097[_0xaf77('0x5e')]==='user'){var _0x3c85e8=_0x463b57[_0xaf77('0x36')]({'plain':!![]});var _0xc2370d=_0xaf77('0x5f');return db['UserProfileSection']['find']({'where':{'name':_0xc2370d,'userProfileId':_0x1ed097[_0xaf77('0x60')]},'raw':!![]})[_0xaf77('0x21')](function(_0x5bf8d8){if(_0x5bf8d8&&_0x5bf8d8[_0xaf77('0x61')]===0x0){return db[_0xaf77('0x37')][_0xaf77('0x5b')]({'name':_0x3c85e8[_0xaf77('0x39')],'resourceId':_0x3c85e8['id'],'type':_0x5bf8d8[_0xaf77('0x39')],'sectionId':_0x5bf8d8['id']},{})[_0xaf77('0x21')](function(){return _0x463b57;});}else{return _0x463b57;}})[_0xaf77('0x2b')](function(_0x38bbc0){logger[_0xaf77('0x27')](_0xaf77('0x62'),_0x38bbc0);throw _0x38bbc0;});}return _0x463b57;})[_0xaf77('0x21')](respondWithResult(_0x4b0179,0xc9))['catch'](handleError(_0x4b0179,null));};exports[_0xaf77('0x34')]=function(_0x5b61b4,_0x3ffe74){if(_0x5b61b4['body']['id']){delete _0x5b61b4[_0xaf77('0x5c')]['id'];}return db['ChatWebsite'][_0xaf77('0x5a')]({'where':{'id':_0x5b61b4[_0xaf77('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xaf77('0x3d')}]})[_0xaf77('0x21')](handleEntityNotFound(_0x3ffe74,null))[_0xaf77('0x21')](saveUpdates(_0x5b61b4['body'],null))[_0xaf77('0x21')](respondWithResult(_0x3ffe74,null))['catch'](handleError(_0x3ffe74,null));};exports[_0xaf77('0x35')]=function(_0x57ed77,_0x40c8d6){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x57ed77[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x40c8d6,null))['then'](removeEntity(_0x40c8d6,null))['catch'](handleError(_0x40c8d6,null));};exports[_0xaf77('0x63')]=function(_0x41d0bc,_0x5ccf8b){return db[_0xaf77('0x58')]['describe']()['then'](respondWithResult(_0x5ccf8b,null))[_0xaf77('0x2b')](handleError(_0x5ccf8b,null));};exports[_0xaf77('0x64')]=function(_0x45bbf2,_0x32a46d,_0x3e6226){if(_0x45bbf2[_0xaf77('0x5c')]['id']){delete _0x45bbf2[_0xaf77('0x5c')]['id'];}return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x45bbf2[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x32a46d,null))['then'](function(_0x1e9d0b){if(_0x1e9d0b){_0x45bbf2['body']['ChatWebsiteId']=_0x1e9d0b['id'];return db[_0xaf77('0x65')][_0xaf77('0x5b')](_0x45bbf2[_0xaf77('0x5c')]);}})['then'](respondWithResult(_0x32a46d,null))[_0xaf77('0x2b')](handleError(_0x32a46d,null));};exports['getDispositions']=function(_0x31eb08,_0x5f54cd,_0x2cf527){var _0xd9fdab={'raw':![],'where':{}};var _0x26cb7b={};var _0x126c4a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xaf77('0x66')]({'where':{'id':_0x31eb08[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x5f54cd,null))[_0xaf77('0x21')](function(_0x5c99cc){if(_0x5c99cc){_0x26cb7b[_0xaf77('0x41')]=_['keys'](db[_0xaf77('0x65')][_0xaf77('0x67')]);_0x26cb7b[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x31eb08['query']);_0x26cb7b['filters']=_[_0xaf77('0x45')](_0x26cb7b[_0xaf77('0x41')],_0x26cb7b[_0xaf77('0x42')]);_0xd9fdab[_0xaf77('0x46')]=_['intersection'](_0x26cb7b[_0xaf77('0x41')],qs[_0xaf77('0x47')](_0x31eb08[_0xaf77('0x42')]['fields']));_0xd9fdab[_0xaf77('0x46')]=_0xd9fdab[_0xaf77('0x46')][_0xaf77('0x68')]?_0xd9fdab[_0xaf77('0x46')]:_0x26cb7b[_0xaf77('0x41')];if(!_0x31eb08['query'][_0xaf77('0x48')]('nolimit')){_0xd9fdab[_0xaf77('0x32')]=qs['limit'](_0x31eb08[_0xaf77('0x42')][_0xaf77('0x32')]);_0xd9fdab[_0xaf77('0x30')]=qs[_0xaf77('0x30')](_0x31eb08[_0xaf77('0x42')][_0xaf77('0x30')]);}_0xd9fdab[_0xaf77('0x69')]=qs[_0xaf77('0x4a')](_0x31eb08[_0xaf77('0x42')][_0xaf77('0x4a')]);_0xd9fdab['where']=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x31eb08[_0xaf77('0x42')],_0x26cb7b[_0xaf77('0x44')]));_0xd9fdab[_0xaf77('0x4d')]['ChatWebsiteId']=_0x5c99cc['id'];if(_0x31eb08['query'][_0xaf77('0x4c')]){_0xd9fdab['where']=_[_0xaf77('0x4e')](_0xd9fdab[_0xaf77('0x4d')],{'$or':_[_0xaf77('0x3e')](_0xd9fdab[_0xaf77('0x46')],function(_0x40967e){var _0x1ca061={};_0x1ca061[_0x40967e]={'$like':'%'+_0x31eb08['query']['filter']+'%'};return _0x1ca061;})});}_0xd9fdab=_[_0xaf77('0x4e')]({},_0xd9fdab,_0x31eb08[_0xaf77('0x59')]);return db[_0xaf77('0x65')][_0xaf77('0x51')]({'where':_0xd9fdab['where']})[_0xaf77('0x21')](function(_0x3caec1){_0x126c4a['count']=_0x3caec1;if(_0x31eb08[_0xaf77('0x42')]['includeAll']){_0xd9fdab[_0xaf77('0x53')]=[{'all':!![]}];}return db[_0xaf77('0x65')][_0xaf77('0x54')](_0xd9fdab);})['then'](function(_0x445e29){_0x126c4a[_0xaf77('0x55')]=_0x445e29;return _0x126c4a;});}})[_0xaf77('0x21')](respondWithFilteredResult(_0x5f54cd,_0xd9fdab))[_0xaf77('0x2b')](handleError(_0x5f54cd,null));};exports[_0xaf77('0x6a')]=function(_0x4c29d8,_0x287e24,_0x17ada6){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x4c29d8[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x287e24,null))['then'](function(_0x4cde94){if(_0x4cde94){return _0x4cde94[_0xaf77('0x6a')](_0x4c29d8[_0xaf77('0x42')]['ids']);}})[_0xaf77('0x21')](respondWithStatusCode(_0x287e24,null))[_0xaf77('0x2b')](handleError(_0x287e24,null));};exports[_0xaf77('0x6b')]=function(_0x3343e9,_0x4816f6,_0x353579){if(_0x3343e9['body']['id']){delete _0x3343e9[_0xaf77('0x5c')]['id'];}return db['ChatWebsite'][_0xaf77('0x5a')]({'where':{'id':_0x3343e9[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x4816f6,null))[_0xaf77('0x21')](function(_0x35ca1d){if(_0x35ca1d){_0x3343e9['body']['ChatWebsiteId']=_0x35ca1d['id'];return db[_0xaf77('0x6c')][_0xaf77('0x5b')](_0x3343e9['body']);}})['then'](respondWithResult(_0x4816f6,null))[_0xaf77('0x2b')](handleError(_0x4816f6,null));};exports[_0xaf77('0x6d')]=function(_0x4daeee,_0x1b8773,_0x371d88){var _0x531738={'raw':![],'where':{}};var _0xc5b527={};var _0x19b4e9={'count':0x0,'rows':[]};return db[_0xaf77('0x58')][_0xaf77('0x66')]({'where':{'id':_0x4daeee[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x1b8773,null))[_0xaf77('0x21')](function(_0x434ff4){if(_0x434ff4){_0xc5b527[_0xaf77('0x41')]=_[_0xaf77('0x43')](db[_0xaf77('0x6c')][_0xaf77('0x67')]);_0xc5b527['query']=_[_0xaf77('0x43')](_0x4daeee[_0xaf77('0x42')]);_0xc5b527[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0xc5b527['model'],_0xc5b527[_0xaf77('0x42')]);_0x531738[_0xaf77('0x46')]=_[_0xaf77('0x45')](_0xc5b527[_0xaf77('0x41')],qs[_0xaf77('0x47')](_0x4daeee[_0xaf77('0x42')][_0xaf77('0x47')]));_0x531738[_0xaf77('0x46')]=_0x531738['attributes'][_0xaf77('0x68')]?_0x531738['attributes']:_0xc5b527['model'];if(!_0x4daeee[_0xaf77('0x42')][_0xaf77('0x48')](_0xaf77('0x49'))){_0x531738[_0xaf77('0x32')]=qs[_0xaf77('0x32')](_0x4daeee[_0xaf77('0x42')][_0xaf77('0x32')]);_0x531738[_0xaf77('0x30')]=qs[_0xaf77('0x30')](_0x4daeee['query'][_0xaf77('0x30')]);}_0x531738[_0xaf77('0x69')]=qs[_0xaf77('0x4a')](_0x4daeee['query'][_0xaf77('0x4a')]);_0x531738['where']=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x4daeee[_0xaf77('0x42')],_0xc5b527[_0xaf77('0x44')]));_0x531738[_0xaf77('0x4d')][_0xaf77('0x6e')]=_0x434ff4['id'];if(_0x4daeee[_0xaf77('0x42')][_0xaf77('0x4c')]){_0x531738['where']=_[_0xaf77('0x4e')](_0x531738[_0xaf77('0x4d')],{'$or':_[_0xaf77('0x3e')](_0x531738['attributes'],function(_0x24b936){var _0x52c937={};_0x52c937[_0x24b936]={'$like':'%'+_0x4daeee['query'][_0xaf77('0x4c')]+'%'};return _0x52c937;})});}_0x531738=_[_0xaf77('0x4e')]({},_0x531738,_0x4daeee[_0xaf77('0x59')]);return db['CannedAnswer']['count']({'where':_0x531738[_0xaf77('0x4d')]})[_0xaf77('0x21')](function(_0x53019b){_0x19b4e9[_0xaf77('0x51')]=_0x53019b;if(_0x4daeee[_0xaf77('0x42')][_0xaf77('0x52')]){_0x531738[_0xaf77('0x53')]=[{'all':!![]}];}return db[_0xaf77('0x6c')][_0xaf77('0x54')](_0x531738);})[_0xaf77('0x21')](function(_0x8746){_0x19b4e9['rows']=_0x8746;return _0x19b4e9;});}})[_0xaf77('0x21')](respondWithFilteredResult(_0x1b8773,_0x531738))['catch'](handleError(_0x1b8773,null));};exports[_0xaf77('0x6f')]=function(_0x523600,_0x10122f,_0x16f4c3){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x523600[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x10122f,null))[_0xaf77('0x21')](function(_0x556f44){if(_0x556f44){return _0x556f44[_0xaf77('0x6f')](_0x523600[_0xaf77('0x42')][_0xaf77('0x70')]);}})[_0xaf77('0x21')](respondWithStatusCode(_0x10122f,null))[_0xaf77('0x2b')](handleError(_0x10122f,null));};exports[_0xaf77('0x71')]=function(_0x209aee,_0x147734,_0x150d1e){_0x209aee['body'][_0xaf77('0x72')]=_0x209aee[_0xaf77('0x73')][_0xaf77('0x74')];return db['ChatWebsite'][_0xaf77('0x5a')]({'where':{'id':_0x209aee['params']['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x147734,null))[_0xaf77('0x21')](saveUpdates(_0x209aee['body'],null))[_0xaf77('0x21')](respondWithResult(_0x147734,null))[_0xaf77('0x2b')](handleError(_0x147734,null));};exports['addAvatar']=function(_0x161fe8,_0x5ec144,_0x1aab7c){_0x161fe8['body']['agentAvatar']=_0x161fe8['file'][_0xaf77('0x74')];return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x161fe8['params']['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x5ec144,null))[_0xaf77('0x21')](saveUpdates(_0x161fe8[_0xaf77('0x5c')],null))[_0xaf77('0x21')](respondWithResult(_0x5ec144,null))[_0xaf77('0x2b')](handleError(_0x5ec144,null));};exports[_0xaf77('0x75')]=function(_0x46103b,_0x9b67ec,_0xa1aeb6){_0x46103b[_0xaf77('0x5c')]['customerAvatar']=_0x46103b[_0xaf77('0x73')][_0xaf77('0x74')];return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x46103b['params']['id']}})['then'](handleEntityNotFound(_0x9b67ec,null))[_0xaf77('0x21')](saveUpdates(_0x46103b[_0xaf77('0x5c')],null))[_0xaf77('0x21')](respondWithResult(_0x9b67ec,null))[_0xaf77('0x2b')](handleError(_0x9b67ec,null));};exports[_0xaf77('0x76')]=function(_0x4870f1,_0x244ff2,_0x26d1ff){_0x4870f1['body'][_0xaf77('0x77')]=_0x4870f1['file'][_0xaf77('0x74')];return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x4870f1[_0xaf77('0x57')]['id']}})['then'](handleEntityNotFound(_0x244ff2,null))[_0xaf77('0x21')](saveUpdates(_0x4870f1['body'],null))[_0xaf77('0x21')](respondWithResult(_0x244ff2,null))[_0xaf77('0x2b')](handleError(_0x244ff2,null));};exports[_0xaf77('0x78')]=function(_0xcea8da,_0x599e7c,_0x4e4de9){var _0x1d337d=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x7b'));var _0x256e09={'where':{'id':_0xcea8da[_0xaf77('0x57')]['id']},'attributes':['id',_0xaf77('0x72')],'raw':!![]};var _0x40b179=![];return require(_0xaf77('0x18'))[_0xaf77('0x7c')]()['then'](function(_0x5d7108){if(_0x5d7108){_0x40b179=_0x5d7108[_0xaf77('0x7d')];}})[_0xaf77('0x21')](function(){return db[_0xaf77('0x58')][_0xaf77('0x5a')](_0x256e09);})[_0xaf77('0x21')](handleEntityNotFound(_0x599e7c,null))[_0xaf77('0x21')](function(_0xef0303){if(_0xef0303){if(!_[_0xaf77('0x7e')](_0xef0303[_0xaf77('0x72')])){if(fs[_0xaf77('0x7f')](path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x80'),_0xef0303[_0xaf77('0x72')]))&&_0x40b179){_0x1d337d=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],'server/files/images/logos/',_0xef0303[_0xaf77('0x72')]);}}return _0x599e7c['download'](_0x1d337d);}})[_0xaf77('0x2b')](handleError(_0x599e7c,null));};exports['getAvatar']=function(_0x5f17e8,_0x3b5548,_0x4d43f2){var _0x133fd3=path[_0xaf77('0x79')](config['root'],_0xaf77('0x81'));var _0x526054={'where':{'id':_0x5f17e8[_0xaf77('0x57')]['id']},'attributes':['id',_0xaf77('0x82')],'raw':!![]};return db['ChatWebsite']['find'](_0x526054)[_0xaf77('0x21')](handleEntityNotFound(_0x3b5548,null))['then'](function(_0x2374f4){if(_0x2374f4){if(!_['isNil'](_0x2374f4[_0xaf77('0x82')])){if(fs['existsSync'](path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x2374f4[_0xaf77('0x82')]))){_0x133fd3=path['join'](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x2374f4[_0xaf77('0x82')]);}}return _0x3b5548[_0xaf77('0x84')](_0x133fd3);}})['catch'](handleError(_0x3b5548,null));};exports[_0xaf77('0x85')]=function(_0x2d54f1,_0x5b919f,_0x567d68){var _0x5b870d=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x78d71c={'where':{'id':_0x2d54f1[_0xaf77('0x57')]['id']},'attributes':['id',_0xaf77('0x86'),_0xaf77('0x87')],'raw':!![]};return db[_0xaf77('0x58')][_0xaf77('0x5a')](_0x78d71c)[_0xaf77('0x21')](handleEntityNotFound(_0x5b919f,null))['then'](function(_0x412a44){if(_0x412a44){if(!_['isNil'](_0x412a44['customerAvatar'])){if(fs[_0xaf77('0x7f')](path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x412a44[_0xaf77('0x86')]))&&_0x412a44[_0xaf77('0x87')]){_0x5b870d=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x412a44[_0xaf77('0x86')]);}}return _0x5b919f['download'](_0x5b870d);}})[_0xaf77('0x2b')](handleError(_0x5b919f,null));};exports[_0xaf77('0x88')]=function(_0x559f73,_0x3bc712,_0x28b857){var _0x16cf9f=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],'server/files/images/avatars/system_avatar.png');var _0x348c0e={'where':{'id':_0x559f73[_0xaf77('0x57')]['id']},'attributes':['id',_0xaf77('0x77')],'raw':!![]};return db[_0xaf77('0x58')][_0xaf77('0x5a')](_0x348c0e)['then'](handleEntityNotFound(_0x3bc712,null))[_0xaf77('0x21')](function(_0x5a9d00){if(_0x5a9d00){if(!_[_0xaf77('0x7e')](_0x5a9d00[_0xaf77('0x77')])){if(fs[_0xaf77('0x7f')](path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x5a9d00[_0xaf77('0x77')]))){_0x16cf9f=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0x83'),_0x5a9d00['systemAvatar']);}}return _0x3bc712[_0xaf77('0x84')](_0x16cf9f);}})[_0xaf77('0x2b')](handleError(_0x3bc712,null));};exports['notify']=function(_0x49183a,_0x5635df,_0x48ddda){var _0x39eefc=require(_0xaf77('0x89'));var _0x199d68=new _0x39eefc();var _0x10b88c=_0x199d68[_0xaf77('0x8a')](_0x49183a['headers'][_0xaf77('0x8b')])[_0xaf77('0x8c')]();var _0x38db84={'body':_0x49183a[_0xaf77('0x5c')],'channel':'chat'};var _0x3ca3e3=[];var _0x18a51a=[];var _0x54cfd4={};var _0x381857=![];return db[_0xaf77('0x8d')]['describe']()[_0xaf77('0x21')](function(_0x313054){if(!_0x313054){throw new db[(_0xaf77('0x8e'))]['ValidationError']('no\x20available\x20attributes');}_0x3ca3e3=_['difference'](_[_0xaf77('0x43')](_0x313054),['createdAt',_0xaf77('0x8f')]);_0x18a51a=_[_0xaf77('0x90')](_['keys'](_0x313054),[_0xaf77('0x91'),_0xaf77('0x8f'),_0xaf77('0x92'),_0xaf77('0x93')]);if(_0x49183a[_0xaf77('0x5c')]['id']){delete _0x49183a[_0xaf77('0x5c')]['id'];}if(_[_0xaf77('0x7e')](_0x49183a['body'][_0xaf77('0x94')])){throw new db[(_0xaf77('0x8e'))][(_0xaf77('0x95'))]('from\x20is\x20mandatory');}if(_[_0xaf77('0x7e')](_0x49183a[_0xaf77('0x5c')]['body'])||_0x49183a[_0xaf77('0x5c')][_0xaf77('0x5c')]===''){throw new db[(_0xaf77('0x8e'))][(_0xaf77('0x95'))](_0xaf77('0x96'));}if(_[_0xaf77('0x7e')](_0x49183a[_0xaf77('0x5c')][_0xaf77('0x97')])){throw new db['Sequelize'][(_0xaf77('0x95'))](_0xaf77('0x98')+_0x18a51a);}if(!_['includes'](_0x18a51a,_0x49183a['body'][_0xaf77('0x97')])){throw new db[(_0xaf77('0x8e'))][(_0xaf77('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18a51a);}_0x54cfd4[_0x49183a[_0xaf77('0x5c')][_0xaf77('0x97')]]=_0x49183a[_0xaf77('0x5c')][_0xaf77('0x94')];})[_0xaf77('0x21')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x49183a['params']['id']},'include':[{'model':db[_0xaf77('0x99')],'as':_0xaf77('0x9a'),'include':[{'model':db[_0xaf77('0x8d')],'as':_0xaf77('0x9b'),'where':_0x54cfd4,'limit':0x1,'order':[[_0xaf77('0x8f'),_0xaf77('0x9c')]]}]},{'model':db[_0xaf77('0x9d')],'as':_0xaf77('0x9e')}]});})['then'](handleEntityNotFound(_0x5635df,null))[_0xaf77('0x21')](function(_0x1066ec){if(_0x1066ec&&_0x1066ec[_0xaf77('0x9a')]){_0x38db84['account']=_0x1066ec;_0x38db84[_0xaf77('0x9f')]=_0x1066ec[_0xaf77('0x9e')];_0x38db84[_0xaf77('0xa0')]=_0x1066ec[_0xaf77('0x9a')];_0x38db84[_0xaf77('0x9f')]=_['orderBy'](_0x38db84[_0xaf77('0x9f')],[_0xaf77('0xa1')],[_0xaf77('0xa2')]);if(_0x38db84[_0xaf77('0xa3')][_0xaf77('0x9e')]){delete _0x38db84[_0xaf77('0xa3')][_0xaf77('0x9e')];}if(_0x38db84[_0xaf77('0xa3')]['List']&&_0x38db84['account'][_0xaf77('0x9a')][_0xaf77('0x9b')][_0xaf77('0x68')]){return _0x38db84[_0xaf77('0xa3')][_0xaf77('0x9a')][_0xaf77('0x9b')][0x0];}var _0x595744=_[_0xaf77('0x1a')](_0x49183a[_0xaf77('0x5c')],{'firstName':_0x49183a[_0xaf77('0x5c')][_0xaf77('0x94')],'ListId':_0x1066ec[_0xaf77('0x93')]});_0x595744[_0x49183a[_0xaf77('0x5c')][_0xaf77('0x97')]]=_0x49183a[_0xaf77('0x5c')]['from'];return db[_0xaf77('0x8d')]['create'](_0x595744,{'fields':_0x3ca3e3,'raw':!![]});}})[_0xaf77('0x21')](handleEntityNotFound(_0x5635df,null))[_0xaf77('0x21')](function(_0x25e72a){_0x38db84[_0xaf77('0xa4')]=_0x25e72a;var _0x4e5c93=_0x49183a['body'][_0xaf77('0xa5')];if(_0x49183a[_0xaf77('0xa6')][_0xaf77('0xa7')]){_0x4e5c93=_0x49183a[_0xaf77('0xa6')][_0xaf77('0xa7')];}else if(_0x49183a[_0xaf77('0xa6')][_0xaf77('0xa8')]){_0x4e5c93=_[_0xaf77('0xa9')](_0x49183a['headers'][_0xaf77('0xa8')]['split'](','));}if(_0x25e72a){var _0x8dfe6={'ContactId':_0x25e72a['id'],'ChatWebsiteId':_0x49183a[_0xaf77('0x57')]['id'],'from':(_0x25e72a[_0xaf77('0xaa')]||'')+'\x20'+(_0x25e72a[_0xaf77('0xab')]||''),'customerIp':_0x4e5c93,'customerPort':_0x49183a[_0xaf77('0xa6')][_0xaf77('0xac')]?_0x49183a[_0xaf77('0xa6')][_0xaf77('0xac')]:null,'referer':_0x49183a[_0xaf77('0x5c')][_0xaf77('0xad')],'browserName':_0x10b88c['browser'][_0xaf77('0x39')]&&_0x10b88c[_0xaf77('0xae')][_0xaf77('0xaf')]?util[_0xaf77('0xb0')](_0xaf77('0xb1'),_0x10b88c[_0xaf77('0xae')]['name'],_0x10b88c[_0xaf77('0xae')][_0xaf77('0xaf')]):_0xaf77('0xb2'),'browserVersion':_0x10b88c[_0xaf77('0xae')]['version']||'unknown','osName':util[_0xaf77('0xb0')](_0xaf77('0xb1'),_0x10b88c['os'][_0xaf77('0x39')],_0x10b88c['os']['version']),'osVersion':_0x10b88c['os']['version'],'deviceModel':_0x10b88c['device'][_0xaf77('0x41')]&&_0x10b88c['device'][_0xaf77('0xb3')]?util[_0xaf77('0xb0')]('%s\x20%s\x20%s',_0x10b88c[_0xaf77('0xb4')]['model'],_0x10b88c[_0xaf77('0xb4')]['vendor'],_0x10b88c['device'][_0xaf77('0x4f')]):null,'deviceVendor':_0x10b88c[_0xaf77('0xb4')][_0xaf77('0xb3')],'deviceType':_0x10b88c[_0xaf77('0xb4')][_0xaf77('0x4f')],'formData':JSON[_0xaf77('0x26')](_0x49183a[_0xaf77('0x5c')])};var _0x1286de={'ChatWebsiteId':_0x49183a[_0xaf77('0x57')]['id'],'closed':![]};if(_0x49183a[_0xaf77('0x5c')][_0xaf77('0xb5')]){_0x1286de[_0xaf77('0xb5')]=_0x49183a[_0xaf77('0x5c')][_0xaf77('0xb5')];return db[_0xaf77('0xb6')][_0xaf77('0x5a')]({'where':_0x1286de})['then'](function(_0x404941){if(_0x404941){return[_0x404941,![]];}_0x8dfe6[_0xaf77('0xb5')]=_0x49183a[_0xaf77('0x5c')][_0xaf77('0xb5')];_0x8dfe6['externalUrl']=_0x49183a['body'][_0xaf77('0xb7')];return db['ChatInteraction'][_0xaf77('0x5b')](_0x8dfe6)[_0xaf77('0x21')](function(_0x17e709){return[_0x17e709,!![]];});});}_0x1286de[_0xaf77('0xb8')]=_0x25e72a['id'];if(_0x49183a['body']['interaction']&&_0x49183a['body'][_0xaf77('0xb9')]['id']){_0x1286de['id']=_0x49183a[_0xaf77('0x5c')]['interaction']['id'];return db[_0xaf77('0xb6')]['find']({'where':_0x1286de})['then'](function(_0x16310e){if(_0x16310e){return[_0x16310e,![]];}return db[_0xaf77('0xb6')]['create'](_0x8dfe6)['then'](function(_0x4d7858){return[_0x4d7858,!![]];});});}return db[_0xaf77('0xb6')][_0xaf77('0x5b')](_0x8dfe6)[_0xaf77('0x21')](function(_0x1b5157){return[_0x1b5157,!![]];});}})[_0xaf77('0xba')](function(_0x3eb97f,_0x2a6b5f){if(_0x3eb97f){_0x381857=_0x2a6b5f;if(!_0x2a6b5f){var _0x45ae79={'from':(_0x38db84[_0xaf77('0xa4')][_0xaf77('0xaa')]||'')+'\x20'+(_0x38db84[_0xaf77('0xa4')][_0xaf77('0xab')]||'')};if(_0x49183a[_0xaf77('0x5c')][_0xaf77('0xb5')]&&_0x49183a['body']['messageId']&&_0x49183a[_0xaf77('0x5c')][_0xaf77('0xb5')]!=_0x49183a[_0xaf77('0x5c')][_0xaf77('0xbb')]){_0x45ae79[_0xaf77('0xb5')]=_0x49183a[_0xaf77('0x5c')][_0xaf77('0xbb')];}return _0x3eb97f[_0xaf77('0x34')](_0x45ae79);}else{return _0x3eb97f;}}})[_0xaf77('0x21')](function(_0xf26985){_0x38db84[_0xaf77('0xb9')]=_0xf26985['get']({'plain':!![]});_0x38db84[_0xaf77('0xb9')]['created']=_0x381857;if(_0x38db84[_0xaf77('0xb9')][_0xaf77('0xbc')]){if(_0x38db84[_0xaf77('0xa3')][_0xaf77('0xbd')]){_0x38db84[_0xaf77('0x9f')][_0xaf77('0xbe')]({'id':0x0,'priority':_0x38db84[_0xaf77('0x9f')][_0xaf77('0x68')]+0x1,'app':'close','appdata':_0xaf77('0xbf'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x49183a[_0xaf77('0x5c')][_0xaf77('0x5c')],'ChatWebsiteId':_0x49183a['params']['id'],'ChatInteractionId':_0xf26985['id'],'direction':'in','ContactId':_0x38db84[_0xaf77('0xa4')]['id'],'AttachmentId':_0x49183a['body'][_0xaf77('0xc0')]});})[_0xaf77('0x21')](function(_0x182e32){_0x38db84['message']=_0x182e32;if(_0x38db84[_0xaf77('0xb9')]['UserId']){return db[_0xaf77('0xc1')][_0xaf77('0x5a')]({'attributes':['id',_0xaf77('0x39')],'where':{'id':_0x38db84[_0xaf77('0xb9')][_0xaf77('0xc2')]}})[_0xaf77('0x21')](function(_0x3c6a8f){if(_0x3c6a8f){_0x38db84['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xaf77('0xc3'),'appdata':_0x3c6a8f[_0xaf77('0x39')]+','+(_0x38db84['account'][_0xaf77('0xc4')]||0xa),'interval':_0xaf77('0xc5')});_0x38db84[_0xaf77('0xc6')]=!![];}return respondWithRpcPromise(_0xaf77('0xc7'),'startRouting',_0x38db84);});}return respondWithRpcPromise(_0xaf77('0xc7'),_0xaf77('0xc8'),_0x38db84);})[_0xaf77('0x21')](function(_0x5110da){respondWithRpcPromise(_0xaf77('0xc9'),_0xaf77('0xc9'),{'event':_0xaf77('0xca'),'message':_0x5110da},client9002);return _0x5110da;})[_0xaf77('0x21')](respondWithResult(_0x5635df,null))[_0xaf77('0x2b')](handleError(_0x5635df,null));};exports[_0xaf77('0xcb')]=function(_0x471de7,_0x3c94d3,_0x3070a3){var _0x392250,_0x1b5d94,_0x434edf;var _0x4c5377=[];var _0x1f0b2a=[];var _0x32ad0f={};var _0xa8999a=_0x471de7[_0xaf77('0xcc')]||[];var _0x218f89=[];var _0x66eecd;return db[_0xaf77('0x8d')]['describe']()[_0xaf77('0x21')](function(_0x5f3984){if(!_0x5f3984){throw new db['Sequelize'][(_0xaf77('0x95'))](_0xaf77('0xcd'));}_0x1f0b2a=_['difference'](_[_0xaf77('0x43')](_0x5f3984),[_0xaf77('0x91'),_0xaf77('0x8f')]);_0x4c5377=_[_0xaf77('0x90')](_[_0xaf77('0x43')](_0x5f3984),[_0xaf77('0x91'),_0xaf77('0x8f'),_0xaf77('0x92'),_0xaf77('0x93')]);if(_0x471de7['body']['id']){delete _0x471de7[_0xaf77('0x5c')]['id'];}if(_[_0xaf77('0x7e')](_0x471de7[_0xaf77('0x5c')][_0xaf77('0x94')])){throw _0x3c94d3[_0xaf77('0x2d')](0x1f4)[_0xaf77('0x3a')](new db[(_0xaf77('0x8e'))][(_0xaf77('0x95'))](_0xaf77('0xce')));}if(_['isNil'](_0x471de7['body'][_0xaf77('0x5c')])||_0x471de7[_0xaf77('0x5c')][_0xaf77('0x5c')]===''){throw _0x3c94d3['status'](0x1f4)[_0xaf77('0x3a')](new db['Sequelize'][(_0xaf77('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xaf77('0x7e')](_0x471de7[_0xaf77('0x5c')]['mapKeyOffline'])){throw _0x3c94d3[_0xaf77('0x2d')](0x1f4)[_0xaf77('0x3a')](new db['Sequelize'][(_0xaf77('0x95'))](_0xaf77('0xcf')+_0x4c5377));}if(!_[_0xaf77('0xd0')](_0x4c5377,_0x471de7[_0xaf77('0x5c')]['mapKeyOffline'])){throw _0x3c94d3['status'](0x1f4)[_0xaf77('0x3a')](new db['Sequelize'][(_0xaf77('0x95'))](_0xaf77('0xd1')+_0x4c5377));}_0x32ad0f[_0x471de7[_0xaf77('0x5c')]['mapKeyOffline']]=_0x471de7[_0xaf77('0x5c')]['from'];})[_0xaf77('0x21')](function(){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x471de7[_0xaf77('0x57')]['id']},'include':[{'model':db[_0xaf77('0x99')],'as':_0xaf77('0x9a')},{'model':db[_0xaf77('0xd2')],'as':_0xaf77('0xd2')}]});})['then'](handleEntityNotFound(_0x3c94d3,null))[_0xaf77('0x21')](function(_0x247941){if(_0x247941&&_0x247941[_0xaf77('0x9a')]){_0x1b5d94=_0x247941;var _0x3c7116=_[_0xaf77('0x1a')](_0x471de7[_0xaf77('0x5c')],{'firstName':_0x471de7['body'][_0xaf77('0x94')],'phone':_0x471de7[_0xaf77('0x5c')][_0xaf77('0x94')],'ListId':_0x247941[_0xaf77('0x93')]});_0x3c7116[_0x471de7[_0xaf77('0x5c')][_0xaf77('0xd3')]]=_0x471de7['body'][_0xaf77('0x94')];return db[_0xaf77('0x8d')][_0xaf77('0xd4')]({'where':_0x32ad0f,'defaults':_0x3c7116});}})['spread'](function(_0x163720){if(_0x163720){_0x434edf=_0x163720;var _0x212794=fs[_0xaf77('0xd5')](path['join'](config[_0xaf77('0x7a')],_0xaf77('0xd6')),_0xaf77('0xd7'));var _0x3293d8=ejs['render'](_0x212794,{'body':_[_0xaf77('0xd8')](_0x471de7[_0xaf77('0x5c')]['body']),'bodyTitle':_0x1b5d94['offlineMessageBody']});return db[_0xaf77('0xd9')][_0xaf77('0x5b')]({'body':_0x3293d8,'ContactId':_0x163720['id'],'ChatWebsiteId':_0x1b5d94['id']});}})[_0xaf77('0x21')](function(_0x2e6697){_0x66eecd=_0x2e6697;if(_0xa8999a['length']){var _0x4f40d6=_0xa8999a['map'](function(_0x243f04){return{'name':_0x243f04['originalname'],'basename':_0x243f04[_0xaf77('0x74')],'type':_0x243f04[_0xaf77('0xda')],'ChatOfflineMessageId':_0x2e6697['id']};});_0x218f89=_0x4f40d6[_0xaf77('0x3e')](_0x11b681=>{var _0x62697c={'filename':_0x11b681[_0xaf77('0x39')],'path':path[_0xaf77('0x79')](config[_0xaf77('0x7a')],_0xaf77('0xdb'),_0xaf77('0xcc'),_0xaf77('0xdc'),_0xaf77('0xdd'),_0x11b681[_0xaf77('0xde')])};return _0x62697c;});if(!_0x1b5d94[_0xaf77('0xdf')]){return db['sequelize'][_0xaf77('0xe0')](function(_0x593aa3){return db[_0xaf77('0xe1')]['bulkCreate'](_0x4f40d6,{'transaction':_0x593aa3});});}}})[_0xaf77('0x21')](function(){if(_0x66eecd){_0x392250=_0x66eecd;return db[_0xaf77('0xd2')][_0xaf77('0x66')]({'where':{'active':!![]},'include':[{'model':db[_0xaf77('0xe2')],'as':_0xaf77('0xe3'),'raw':!![]}]});}})[_0xaf77('0x21')](function(_0x2099b6){if(_0x2099b6&&_0x2099b6[_0xaf77('0xe3')]&&_0x1b5d94['forwardOffline']&&_0x1b5d94[_0xaf77('0xe4')]){var _0x4ddae1={'tls':{'rejectUnauthorized':![]}};if(_0x2099b6[_0xaf77('0xe3')][_0xaf77('0xe5')]){_0x4ddae1[_0xaf77('0xe5')]=_0x2099b6[_0xaf77('0xe3')]['service'];}else{_0x4ddae1['host']=_0x2099b6[_0xaf77('0xe3')][_0xaf77('0xe6')];_0x4ddae1[_0xaf77('0xe7')]=_0x2099b6[_0xaf77('0xe3')]['port'];_0x4ddae1[_0xaf77('0xe8')]=_0x2099b6[_0xaf77('0xe3')]['secure'];}if(_0x2099b6['Smtp'][_0xaf77('0xe9')]){_0x4ddae1[_0xaf77('0xea')]={'user':_0x2099b6[_0xaf77('0xe3')][_0xaf77('0xeb')],'pass':_0x2099b6[_0xaf77('0xe3')][_0xaf77('0xec')]};}return respondWithRpcPromise(_0xaf77('0xed'),_0xaf77('0xee'),{'account':_0x4ddae1,'message':{'from':util[_0xaf77('0xb0')]('\x22%s\x22\x20<%s>',_0x2099b6['name'],_0x2099b6['email']||_0x2099b6[_0xaf77('0xe3')][_0xaf77('0xeb')]),'to':_0x1b5d94['forwardOfflineAddress'],'subject':_0x1b5d94[_0xaf77('0xef')],'html':_0x392250[_0xaf77('0x5c')],'attachments':_0x218f89}},client9003)[_0xaf77('0x21')](function(){return _0x392250;})['catch'](function(_0x212eea){console['error'](_0x212eea);});}})[_0xaf77('0x21')](function(){if(_0x1b5d94&&_0x1b5d94['openNewInteraction']&&_0x1b5d94[_0xaf77('0xf0')]){var _0x1d6332=[];if(_0xa8999a['length']){_0x1d6332=_0xa8999a[_0xaf77('0x3e')](function(_0x334f50){return{'name':_0x334f50[_0xaf77('0xf1')],'basename':_0x334f50[_0xaf77('0x74')],'type':_0x334f50[_0xaf77('0xda')],'ChatOfflineMessageId':_0x66eecd['id']};});}var _0x3fa5df;if(!_[_0xaf77('0x7e')](_0x1b5d94[_0xaf77('0xf2')])){var _0x2b5c9e=_[_0xaf77('0x3e')](_0x471de7[_0xaf77('0x5c')],function(_0x498142){return _0x498142;});var _0x3820c0=_[_0xaf77('0xf3')](_0x2b5c9e)[0x0];var _0x1d69a8=_[_0xaf77('0xf4')](_0x3820c0,function(_0x128279){return _0x128279;});_0x3fa5df=_0x1d69a8[0x1][_0x1b5d94['subjectOffline']];}var _0x28e88c={'from':_0x434edf[_0xaf77('0xf5')],'firstName':_0x434edf[_0xaf77('0xaa')],'lastName':_0x434edf[_0xaf77('0xab')],'mapKey':_0xaf77('0xf5'),'message':{'from':_0x434edf[_0xaf77('0xf5')],'to':_0x1b5d94['MailAccount']['email'],'cc':'','subject':_[_0xaf77('0x7e')](_0x3fa5df)?_0x1b5d94[_0xaf77('0xef')]:_0x3fa5df,'messageId':'','sentAt':new Date(),'attach':_0x1d6332['length'],'attachments':_0x1d6332,'originChannel':_0xaf77('0xf6'),'ChatWebsiteId':_0x1b5d94['id'],'ChatOfflineMessageId':_0x392250['id'],'originTo':_0x1b5d94[_0xaf77('0xd2')][_0xaf77('0xf5')]},'body':_0x392250['body']};var _0x4b20a6={'account':{'id':_0x1b5d94[_0xaf77('0xf0')]},'body':_0x28e88c,'log':_0xaf77('0xf7')};return respondWithRpcPromise('NotifyMailAccount',_0xaf77('0xf8'),_0x4b20a6,client9001)[_0xaf77('0x21')](function(){return _0x392250;})[_0xaf77('0x2b')](function(_0x4e1ed4){console['error'](_0x4e1ed4);});}return;})['then'](function(){if(_0x392250){return _0x392250;}})['then'](respondWithResult(_0x3c94d3,null))['catch'](function(_0x284664){console[_0xaf77('0x27')](_0xaf77('0x2b'),_0x284664);for(var _0x551279 of _0xa8999a){var _0x3c7fad=path[_0xaf77('0x79')](config[_0xaf77('0x7a')],'server',_0xaf77('0xcc'),_0xaf77('0xdc'),_0xaf77('0xdd'),_0x551279[_0xaf77('0x74')]);fs_extra[_0xaf77('0xf9')](_0x3c7fad)[_0xaf77('0x2b')](function(_0x17b194){console[_0xaf77('0x27')](_0xaf77('0xfa'),_0x3c7fad,_0x17b194);});}});};exports[_0xaf77('0xfb')]=function(_0x4fccf8,_0xf7f478,_0x367ec0){return db['ChatInteraction'][_0xaf77('0x5a')]({'where':{'id':_0x4fccf8['params']['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0xf7f478,null))[_0xaf77('0x21')](function(_0x483146){if(_0x483146){return _0x483146['addInteraction'](_0x4fccf8[_0xaf77('0x5c')][_0xaf77('0x70')],_[_0xaf77('0xfc')](_0x4fccf8[_0xaf77('0x5c')],['ids','id'])||{});}})[_0xaf77('0x21')](respondWithResult(_0xf7f478,null))[_0xaf77('0x2b')](handleError(_0xf7f478,null));};exports[_0xaf77('0xfd')]=function(_0x5b8d13,_0x1e3e62,_0xda940d){var _0x5232d9={'raw':![],'where':{}};var _0x42a64b={};var _0x5c334c={'count':0x0,'rows':[]};return db[_0xaf77('0x58')]['findOne']({'where':{'id':_0x5b8d13[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x1e3e62,null))[_0xaf77('0x21')](function(_0x4ace10){if(_0x4ace10){_0x42a64b['model']=_['keys'](db['ChatInteraction'][_0xaf77('0x67')]);_0x42a64b[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x5b8d13[_0xaf77('0x42')]);_0x42a64b[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0x42a64b['model'],_0x42a64b[_0xaf77('0x42')]);_0x5232d9[_0xaf77('0x46')]=_[_0xaf77('0x45')](_0x42a64b['model'],qs[_0xaf77('0x47')](_0x5b8d13[_0xaf77('0x42')]['fields']));_0x5232d9[_0xaf77('0x46')]=_0x5232d9['attributes'][_0xaf77('0x68')]?_0x5232d9[_0xaf77('0x46')]:_0x42a64b[_0xaf77('0x41')];if(!_0x5b8d13['query'][_0xaf77('0x48')](_0xaf77('0x49'))){_0x5232d9[_0xaf77('0x32')]=qs['limit'](_0x5b8d13['query'][_0xaf77('0x32')]);_0x5232d9[_0xaf77('0x30')]=qs[_0xaf77('0x30')](_0x5b8d13[_0xaf77('0x42')][_0xaf77('0x30')]);}_0x5232d9[_0xaf77('0x69')]=qs['sort'](_0x5b8d13['query'][_0xaf77('0x4a')]);_0x5232d9['where']=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x5b8d13[_0xaf77('0x42')],_0x42a64b['filters']));_0x5232d9[_0xaf77('0x4d')][_0xaf77('0x6e')]=_0x4ace10['id'];if(_0x5b8d13[_0xaf77('0x42')]['filter']){_0x5232d9[_0xaf77('0x4d')]=_[_0xaf77('0x4e')](_0x5232d9[_0xaf77('0x4d')],{'$or':_['map'](_0x5232d9[_0xaf77('0x46')],function(_0x15d39a){var _0x4b12db={};_0x4b12db[_0x15d39a]={'$like':'%'+_0x5b8d13[_0xaf77('0x42')]['filter']+'%'};return _0x4b12db;})});}_0x5232d9=_[_0xaf77('0x4e')]({},_0x5232d9,_0x5b8d13[_0xaf77('0x59')]);return db['ChatInteraction']['count']({'where':_0x5232d9[_0xaf77('0x4d')]})[_0xaf77('0x21')](function(_0x12f71a){_0x5c334c['count']=_0x12f71a;if(_0x5b8d13[_0xaf77('0x42')][_0xaf77('0x52')]){_0x5232d9[_0xaf77('0x53')]=[{'model':db[_0xaf77('0x8d')],'as':_0xaf77('0xfe'),'required':![]},{'model':db['User'],'as':_0xaf77('0xff'),'attributes':['name','fullname',_0xaf77('0x100')],'required':![]},{'model':db[_0xaf77('0x101')],'as':_0xaf77('0x102'),'attributes':['id',_0xaf77('0x39'),'color'],'where':_0x5b8d13[_0xaf77('0x42')][_0xaf77('0x103')]?{'id':_0x5b8d13['query'][_0xaf77('0x103')]}:undefined,'required':_0x5b8d13[_0xaf77('0x42')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0xaf77('0x54')](_0x5232d9);})[_0xaf77('0x21')](function(_0x256282){_0x5c334c[_0xaf77('0x55')]=_0x256282;return _0x5c334c;});}})[_0xaf77('0x21')](respondWithFilteredResult(_0x1e3e62,_0x5232d9))['catch'](handleError(_0x1e3e62,null));};function iftimePromise(_0x38e297,_0x36ab61){return respondWithRpcPromise('Command',_0xaf77('0x104'),{'command':_0x36ab61[_0xaf77('0x105')]?util[_0xaf77('0xb0')](_0xaf77('0x106'),_0x38e297['interval'],_0x36ab61['timezone']):util[_0xaf77('0xb0')]('iftime\x20%s',_0x38e297['interval'])},client9002)[_0xaf77('0x21')](function(_0xa9a313){var _0xc4d50f=_0xa9a313&&_0xa9a313[_0xaf77('0x107')](_0xaf77('0x108'))>=0x0?!![]:![];logger[_0xaf77('0x22')](_0xaf77('0x109'),_0x36ab61['id'],_0x38e297['id'],_0x38e297[_0xaf77('0x10a')],_0xc4d50f?'ONLINE':'OFFLINE',_0x36ab61[_0xaf77('0x105')]?_0x36ab61[_0xaf77('0x105')]:_0xaf77('0x10b'));return _0xc4d50f;})[_0xaf77('0x2b')](function(_0x4dcc7c){logger[_0xaf77('0x27')](_0xaf77('0x109'),_0x36ab61['id'],_0x38e297['id'],_0x38e297[_0xaf77('0x10a')],util[_0xaf77('0x10c')](_0x4dcc7c,{'showHidden':![],'depth':null}),_0x36ab61[_0xaf77('0x105')]?_0x36ab61[_0xaf77('0x105')]:_0xaf77('0x10b'));return![];});}exports[_0xaf77('0x104')]=function(_0x5b6e13,_0x28a226,_0x5c1c86){var _0x525653=0x0;var _0x4baa0f=0x0;var _0x46bee9=![];var _0x437a5b;var _0x1db6af;return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x5b6e13[_0xaf77('0x57')]['id']},'include':[{'model':db[_0xaf77('0x10d')],'as':_0xaf77('0x10d'),'include':[{'model':db[_0xaf77('0x10d')],'as':_0xaf77('0x10e'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x28a226,null))[_0xaf77('0x21')](function(_0x312888){if(_0x312888){_0x437a5b=_0x312888;return _0x312888[_0xaf77('0x10f')]({'raw':!![]});}})[_0xaf77('0x21')](function(_0x4e5313){if(_0x437a5b){if(_0x4e5313){_0x1db6af=_0x4e5313;}}return require('../../config/license/util')[_0xaf77('0x7c')]();})['then'](function(_0x4efe27){if(_0x4efe27){_0x4baa0f=_0x4efe27[_0xaf77('0x110')];_0x46bee9=_0x4efe27['custom'];}})['then'](function(){return db[_0xaf77('0xb6')]['count']({'where':{'closed':![]}});})[_0xaf77('0x21')](function(_0x5cf6dc){_0x525653=_0x5cf6dc;if(_0x4baa0f&&_0x5cf6dc>_0x4baa0f){return db[_0xaf77('0x111')][_0xaf77('0x66')]({'where':{'id':0x1}})[_0xaf77('0x21')](function(_0x34a6fd){if(_0x34a6fd){_0x34a6fd[_0xaf77('0x112')](_0xaf77('0x113'));}});}})[_0xaf77('0x21')](function(){if(_0x437a5b['Interval']&&_0x437a5b[_0xaf77('0x10d')][_0xaf77('0x10e')]){var _0x55677c=[];for(var _0x4f13ca=0x0;_0x4f13ca<_0x437a5b['Interval'][_0xaf77('0x10e')][_0xaf77('0x68')];_0x4f13ca++){var _0x2adf92=_0x437a5b[_0xaf77('0x10d')][_0xaf77('0x10e')][_0x4f13ca][_0xaf77('0x36')]({'plain':!![]});_0x55677c[_0xaf77('0xbe')](iftimePromise(_0x2adf92,_0x437a5b));}return BPromise['all'](_0x55677c)[_0xaf77('0x21')](function(_0x367e32){return _[_0xaf77('0x114')](_0x367e32);});}else{return!![];}})['then'](function(_0xb5133d){var _0x266a4c=fs[_0xaf77('0xd5')](path['join'](config[_0xaf77('0x7a')],_0xaf77('0x115')),'utf8');var _0x405ddc={'remote':_0x437a5b[_0xaf77('0x116')],'query':querystring[_0xaf77('0x26')](_[_0xaf77('0x4e')](_0x437a5b[_0xaf77('0x36')]({'plain':!![]}),{'customerIp':_0x5b6e13['headers'][_0xaf77('0xa8')]||_0x5b6e13[_0xaf77('0xa6')][_0xaf77('0x117')]||_0x5b6e13['connection']['remoteAddress']||_0x5b6e13['ip'],'referer':_0x5b6e13['headers'][_0xaf77('0xad')],'openedInteractions':_0x525653,'maxInteractions':_0x4baa0f,'virtual':_0x46bee9[_0xaf77('0x110')],'online':_0xb5133d,'custom':_0x46bee9}))['replace'](/'/g,'\x5c\x27')};_0x28a226['send'](ejs[_0xaf77('0x118')](Mustache[_0xaf77('0x118')](_0x266a4c,_0x405ddc),{'proactiveActions':_0x1db6af,'alignment':_0x437a5b['alignment'],'verticalAlignment':_0x437a5b[_0xaf77('0x119')],'div_color':_0x437a5b['color'],'text_color':_0x437a5b[_0xaf77('0x11a')],'button_color':_0x437a5b[_0xaf77('0x11b')],'background_color':_0x437a5b[_0xaf77('0x11c')]}));})[_0xaf77('0x2b')](handleError(_0x28a226,null));};exports[_0xaf77('0x11d')]=function(_0x521377,_0x41865c,_0x413fe8){return db[_0xaf77('0x58')]['findOne']({'where':{'id':_0x521377[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x41865c,null))[_0xaf77('0x21')](function(_0x3fda03){if(_0x3fda03){return db['sequelize'][_0xaf77('0xe0')](function(_0x12ab67){return db[_0xaf77('0x9d')][_0xaf77('0x35')]({'where':{'ChatWebsiteId':_0x521377[_0xaf77('0x57')]['id']},'transaction':_0x12ab67})[_0xaf77('0x21')](function(_0x2de891){var _0x4c20e2=_['map'](_0x521377[_0xaf77('0x5c')],function(_0xabe3b){_0xabe3b['ChatWebsiteId']=_0x521377[_0xaf77('0x57')]['id'];return _0xabe3b;});return db['ChatApplication'][_0xaf77('0x11e')](_0x4c20e2,{'transaction':_0x12ab67});});})['then'](function(){return db[_0xaf77('0x9d')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x521377[_0xaf77('0x57')]['id']},'order':_0xaf77('0xa1')});});}})[_0xaf77('0x21')](respondWithResult(_0x41865c,null))[_0xaf77('0x2b')](handleError(_0x41865c,null));};exports[_0xaf77('0x11f')]=function(_0x4bc531,_0x5e067d,_0x4b5c2b){var _0x5f2659={};var _0x42ac18={};var _0x2cfa0a;var _0x271908;return db[_0xaf77('0x58')][_0xaf77('0x66')]({'where':{'id':_0x4bc531[_0xaf77('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e067d,null))['then'](function(_0x3b6a2f){if(_0x3b6a2f){_0x2cfa0a=_0x3b6a2f;_0x42ac18[_0xaf77('0x41')]=_[_0xaf77('0x43')](db['ChatApplication']['rawAttributes']);_0x42ac18[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x4bc531[_0xaf77('0x42')]);_0x42ac18[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0x42ac18[_0xaf77('0x41')],_0x42ac18[_0xaf77('0x42')]);_0x5f2659['attributes']=_[_0xaf77('0x45')](_0x42ac18[_0xaf77('0x41')],qs['fields'](_0x4bc531[_0xaf77('0x42')][_0xaf77('0x47')]));_0x5f2659['attributes']=_0x5f2659[_0xaf77('0x46')][_0xaf77('0x68')]?_0x5f2659[_0xaf77('0x46')]:_0x42ac18['model'];_0x5f2659[_0xaf77('0x69')]=qs[_0xaf77('0x4a')](_0x4bc531[_0xaf77('0x42')][_0xaf77('0x4a')]);_0x5f2659[_0xaf77('0x4d')]=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x4bc531[_0xaf77('0x42')],_0x42ac18['filters']));if(_0x4bc531['query'][_0xaf77('0x4c')]){_0x5f2659['where']=_[_0xaf77('0x4e')](_0x5f2659['where'],{'$or':_[_0xaf77('0x3e')](_0x5f2659['attributes'],function(_0x2349c6){var _0x157d43={};_0x157d43[_0x2349c6]={'$like':'%'+_0x4bc531[_0xaf77('0x42')][_0xaf77('0x4c')]+'%'};return _0x157d43;})});}_0x5f2659=_[_0xaf77('0x4e')]({},_0x5f2659,_0x4bc531['options']);return _0x2cfa0a[_0xaf77('0x11f')](_0x5f2659);}})[_0xaf77('0x21')](function(_0x2454ae){if(_0x2454ae){_0x271908=_0x2454ae[_0xaf77('0x68')];if(!_0x4bc531[_0xaf77('0x42')]['hasOwnProperty'](_0xaf77('0x49'))){_0x5f2659['limit']=qs['limit'](_0x4bc531['query'][_0xaf77('0x32')]);_0x5f2659[_0xaf77('0x30')]=qs[_0xaf77('0x30')](_0x4bc531['query'][_0xaf77('0x30')]);}return _0x2cfa0a['getApplications'](_0x5f2659);}})[_0xaf77('0x21')](function(_0x3b5255){if(_0x3b5255){return _0x3b5255?{'count':_0x271908,'rows':_0x3b5255}:null;}})['then'](respondWithResult(_0x5e067d,null))[_0xaf77('0x2b')](handleError(_0x5e067d,null));};exports[_0xaf77('0x120')]=function(_0x3cab4e,_0x98c13,_0x3ebc19){return db['chatProactiveAction'][_0xaf77('0x5a')]({'where':{'id':_0x3cab4e[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x98c13,null))[_0xaf77('0x21')](function(_0x24bf71){if(_0x24bf71){return _0x24bf71[_0xaf77('0x120')](_0x3cab4e[_0xaf77('0x5c')][_0xaf77('0x70')],_[_0xaf77('0xfc')](_0x3cab4e['body'],[_0xaf77('0x70'),'id'])||{});}})[_0xaf77('0x21')](respondWithResult(_0x98c13,null))[_0xaf77('0x2b')](handleError(_0x98c13,null));};exports[_0xaf77('0x10f')]=function(_0x3d294c,_0x4072b1,_0x5829d6){var _0x3bd8c9={};var _0x42558a={};var _0x3c8b2b;var _0x31575f;return db[_0xaf77('0x58')][_0xaf77('0x66')]({'where':{'id':_0x3d294c['params']['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x4072b1,null))[_0xaf77('0x21')](function(_0x4682f6){if(_0x4682f6){_0x3c8b2b=_0x4682f6;_0x42558a[_0xaf77('0x41')]=_[_0xaf77('0x43')](db[_0xaf77('0x121')][_0xaf77('0x67')]);_0x42558a[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x3d294c[_0xaf77('0x42')]);_0x42558a[_0xaf77('0x44')]=_['intersection'](_0x42558a[_0xaf77('0x41')],_0x42558a[_0xaf77('0x42')]);_0x3bd8c9[_0xaf77('0x46')]=_[_0xaf77('0x45')](_0x42558a[_0xaf77('0x41')],qs[_0xaf77('0x47')](_0x3d294c['query'][_0xaf77('0x47')]));_0x3bd8c9[_0xaf77('0x46')]=_0x3bd8c9[_0xaf77('0x46')][_0xaf77('0x68')]?_0x3bd8c9[_0xaf77('0x46')]:_0x42558a['model'];_0x3bd8c9[_0xaf77('0x69')]=qs[_0xaf77('0x4a')](_0x3d294c['query'][_0xaf77('0x4a')]);_0x3bd8c9[_0xaf77('0x4d')]=qs[_0xaf77('0x44')](_[_0xaf77('0x4b')](_0x3d294c[_0xaf77('0x42')],_0x42558a[_0xaf77('0x44')]));if(_0x3d294c[_0xaf77('0x42')][_0xaf77('0x4c')]){_0x3bd8c9[_0xaf77('0x4d')]=_['merge'](_0x3bd8c9[_0xaf77('0x4d')],{'$or':_[_0xaf77('0x3e')](_0x3bd8c9[_0xaf77('0x46')],function(_0x350afe){var _0x528950={};_0x528950[_0x350afe]={'$like':'%'+_0x3d294c['query']['filter']+'%'};return _0x528950;})});}_0x3bd8c9=_[_0xaf77('0x4e')]({},_0x3bd8c9,_0x3d294c[_0xaf77('0x59')]);return _0x3c8b2b[_0xaf77('0x10f')](_0x3bd8c9);}})[_0xaf77('0x21')](function(_0x48e365){if(_0x48e365){_0x31575f=_0x48e365[_0xaf77('0x68')];if(!_0x3d294c[_0xaf77('0x42')][_0xaf77('0x48')](_0xaf77('0x49'))){_0x3bd8c9[_0xaf77('0x32')]=qs['limit'](_0x3d294c[_0xaf77('0x42')][_0xaf77('0x32')]);_0x3bd8c9['offset']=qs[_0xaf77('0x30')](_0x3d294c[_0xaf77('0x42')][_0xaf77('0x30')]);}return _0x3c8b2b[_0xaf77('0x10f')](_0x3bd8c9);}})[_0xaf77('0x21')](function(_0x69252b){if(_0x69252b){return _0x69252b?{'count':_0x31575f,'rows':_0x69252b}:null;}})[_0xaf77('0x21')](respondWithResult(_0x4072b1,null))[_0xaf77('0x2b')](handleError(_0x4072b1,null));};exports[_0xaf77('0x122')]=function(_0x5a7422,_0x642c,_0x35341d){var _0x2feb0a=_0x5a7422[_0xaf77('0x42')][_0xaf77('0x123')]===_0xaf77('0x124')?_0xaf77('0x125'):'onlineForm';return db['ChatWebsite'][_0xaf77('0x5a')]({'attributes':['id',_0x2feb0a],'where':{'id':_0x5a7422[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x642c,null))[_0xaf77('0x21')](function(_0x484fae){if(_0x484fae){var _0x392ceb=_0x484fae[_0x2feb0a];var _0x577ed2=_0x392ceb&&_0x392ceb[_0xaf77('0x126')]?_0x392ceb[_0xaf77('0x126')]:[];_0x642c[_0xaf77('0x3a')]({'fromKey':_[_0xaf77('0x7e')](_0x392ceb[_0xaf77('0x127')])?undefined:_0x392ceb[_0xaf77('0x127')],'count':_0x577ed2[_0xaf77('0x68')],'rows':_0x577ed2});}})[_0xaf77('0x2b')](handleError(_0x642c,null));};exports[_0xaf77('0x128')]=function(_0x3e350d,_0x138e27,_0x46e69d){var _0x571049={'raw':![],'where':{}};var _0x497da2={};var _0x56f328={'count':0x0,'rows':[]};return db[_0xaf77('0x58')][_0xaf77('0x66')]({'where':{'id':_0x3e350d[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x138e27,null))[_0xaf77('0x21')](function(_0x1b5981){if(_0x1b5981){_0x497da2[_0xaf77('0x41')]=_[_0xaf77('0x43')](db['ChatOfflineMessage']['rawAttributes']);_0x497da2[_0xaf77('0x42')]=_[_0xaf77('0x43')](_0x3e350d['query']);_0x497da2[_0xaf77('0x44')]=_[_0xaf77('0x45')](_0x497da2['model'],_0x497da2[_0xaf77('0x42')]);_0x571049['attributes']=_[_0xaf77('0x45')](_0x497da2[_0xaf77('0x41')],qs['fields'](_0x3e350d[_0xaf77('0x42')][_0xaf77('0x47')]));_0x571049[_0xaf77('0x46')]=_0x571049['attributes'][_0xaf77('0x68')]?_0x571049[_0xaf77('0x46')]:_0x497da2[_0xaf77('0x41')];if(!_0x3e350d[_0xaf77('0x42')]['hasOwnProperty'](_0xaf77('0x49'))){_0x571049['limit']=qs['limit'](_0x3e350d[_0xaf77('0x42')]['limit']);_0x571049['offset']=qs['offset'](_0x3e350d[_0xaf77('0x42')][_0xaf77('0x30')]);}_0x571049[_0xaf77('0x69')]=qs[_0xaf77('0x4a')](_0x3e350d[_0xaf77('0x42')]['sort']);_0x571049['where']=qs['filters'](_[_0xaf77('0x4b')](_0x3e350d[_0xaf77('0x42')],_0x497da2['filters']));_0x571049[_0xaf77('0x4d')][_0xaf77('0x6e')]=_0x1b5981['id'];if(_0x3e350d['query'][_0xaf77('0x4c')]){_0x571049['where']=_[_0xaf77('0x4e')](_0x571049[_0xaf77('0x4d')],{'$or':_['map'](_0x571049[_0xaf77('0x46')],function(_0x15265c){var _0x209d91={};_0x209d91[_0x15265c]={'$like':'%'+_0x3e350d[_0xaf77('0x42')][_0xaf77('0x4c')]+'%'};return _0x209d91;})});}_0x571049=_['merge']({},_0x571049,_0x3e350d[_0xaf77('0x59')]);return db[_0xaf77('0xd9')][_0xaf77('0x51')]({'where':_0x571049[_0xaf77('0x4d')]})[_0xaf77('0x21')](function(_0x496f6e){_0x56f328[_0xaf77('0x51')]=_0x496f6e;if(_0x3e350d['query']['includeAll']){_0x571049[_0xaf77('0x53')]=[{'all':!![]}];}else{_0x571049[_0xaf77('0x53')]=[{'model':db[_0xaf77('0x8d')],'as':_0xaf77('0xfe'),'required':![]},{'model':db[_0xaf77('0xe1')],'as':_0xaf77('0x129'),'required':![]}];}return db[_0xaf77('0xd9')][_0xaf77('0x54')](_0x571049);})[_0xaf77('0x21')](function(_0x5797c9){_0x56f328[_0xaf77('0x55')]=_0x5797c9;return _0x56f328;});}})[_0xaf77('0x21')](respondWithFilteredResult(_0x138e27,_0x571049))[_0xaf77('0x2b')](handleError(_0x138e27,null));};exports['addAgents']=function(_0xd597d4,_0x56e77a,_0x2beb72){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0xd597d4[_0xaf77('0x57')]['id']}})['then'](handleEntityNotFound(_0x56e77a,null))[_0xaf77('0x21')](function(_0x1b3755){if(_0x1b3755){return _0x1b3755[_0xaf77('0x12a')](_0xd597d4[_0xaf77('0x5c')]['ids'],_[_0xaf77('0xfc')](_0xd597d4['body'],['ids','id'])||{})[_0xaf77('0xba')](function(_0x1d448a){for(var _0x26038b=0x0;_0x26038b<_0xd597d4['body'][_0xaf77('0x70')][_0xaf77('0x68')];_0x26038b+=0x1){socket[_0xaf77('0x12b')](_0xaf77('0x12c'),{'UserId':Number(_0xd597d4['body']['ids'][_0x26038b]),'ChatWebsiteId':Number(_0xd597d4[_0xaf77('0x57')]['id'])});}return _0x1d448a;});}})[_0xaf77('0x21')](respondWithResult(_0x56e77a,null))['catch'](handleError(_0x56e77a,null));};exports[_0xaf77('0x12d')]=function(_0x287c89,_0x4a5282,_0x2175a7){return db[_0xaf77('0x58')][_0xaf77('0x5a')]({'where':{'id':_0x287c89[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x4a5282,null))[_0xaf77('0x21')](function(_0xe02d0e){if(_0xe02d0e){return _0xe02d0e['removeAgents'](_0x287c89[_0xaf77('0x42')][_0xaf77('0x70')])[_0xaf77('0x21')](function(){if(_[_0xaf77('0x12e')](_0x287c89['query'][_0xaf77('0x70')])){for(var _0x522161=0x0;_0x522161<_0x287c89[_0xaf77('0x42')]['ids'][_0xaf77('0x68')];_0x522161+=0x1){socket['emit'](_0xaf77('0x12f'),{'UserId':Number(_0x287c89[_0xaf77('0x42')][_0xaf77('0x70')][_0x522161]),'ChatWebsiteId':Number(_0x287c89[_0xaf77('0x57')]['id'])});}}else{socket[_0xaf77('0x12b')](_0xaf77('0x12f'),{'UserId':Number(_0x287c89['query'][_0xaf77('0x70')]),'ChatWebsiteId':Number(_0x287c89[_0xaf77('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a5282,null))[_0xaf77('0x2b')](handleError(_0x4a5282,null));};exports[_0xaf77('0x130')]=function(_0x432573,_0x29f23f,_0x5361ee){var _0x207e2e={};var _0x2d12d8={};var _0x26a3d9;var _0x3fe11d;return db[_0xaf77('0x58')][_0xaf77('0x66')]({'where':{'id':_0x432573[_0xaf77('0x57')]['id']}})[_0xaf77('0x21')](handleEntityNotFound(_0x29f23f,null))[_0xaf77('0x21')](function(_0x5829c1){if(_0x5829c1){_0x26a3d9=_0x5829c1;_0x2d12d8[_0xaf77('0x41')]=_['keys'](db[_0xaf77('0xc1')][_0xaf77('0x67')]);_0x2d12d8['query']=_[_0xaf77('0x43')](_0x432573[_0xaf77('0x42')]);_0x2d12d8[_0xaf77('0x44')]=_['intersection'](_0x2d12d8[_0xaf77('0x41')],_0x2d12d8[_0xaf77('0x42')]);_0x207e2e[_0xaf77('0x46')]=_[_0xaf77('0x45')](_0x2d12d8[_0xaf77('0x41')],qs[_0xaf77('0x47')](_0x432573[_0xaf77('0x42')][_0xaf77('0x47')]));_0x207e2e[_0xaf77('0x46')]=_0x207e2e[_0xaf77('0x46')][_0xaf77('0x68')]?_0x207e2e[_0xaf77('0x46')]:_0x2d12d8['model'];_0x207e2e[_0xaf77('0x69')]=qs['sort'](_0x432573['query']['sort']);_0x207e2e[_0xaf77('0x4d')]=qs[_0xaf77('0x44')](_['pick'](_0x432573[_0xaf77('0x42')],_0x2d12d8[_0xaf77('0x44')]));if(_0x432573['query'][_0xaf77('0x4c')]){_0x207e2e['where']=_[_0xaf77('0x4e')](_0x207e2e['where'],{'$or':_[_0xaf77('0x3e')](_0x207e2e['attributes'],function(_0x2f4db6){var _0x21eb05={};_0x21eb05[_0x2f4db6]={'$like':'%'+_0x432573[_0xaf77('0x42')][_0xaf77('0x4c')]+'%'};return _0x21eb05;})});}_0x207e2e=_[_0xaf77('0x4e')]({},_0x207e2e,_0x432573[_0xaf77('0x59')]);return _0x26a3d9[_0xaf77('0x130')](_0x207e2e);}})[_0xaf77('0x21')](function(_0x549011){if(_0x549011){_0x3fe11d=_0x549011['length'];if(!_0x432573[_0xaf77('0x42')][_0xaf77('0x48')]('nolimit')){_0x207e2e[_0xaf77('0x32')]=qs[_0xaf77('0x32')](_0x432573[_0xaf77('0x42')][_0xaf77('0x32')]);_0x207e2e['offset']=qs[_0xaf77('0x30')](_0x432573['query'][_0xaf77('0x30')]);}return _0x26a3d9['getAgents'](_0x207e2e);}})[_0xaf77('0x21')](function(_0x3bf581){if(_0x3bf581){return _0x3bf581?{'count':_0x3fe11d,'rows':_0x3bf581}:null;}})[_0xaf77('0x21')](respondWithResult(_0x29f23f,null))[_0xaf77('0x2b')](handleError(_0x29f23f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 6eeec6e..622467d 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 _0x4677=['save','remove','emit','hasOwnProperty','hook','events','ChatWebsite','setMaxListeners'];(function(_0x4fffd7,_0x259a11){var _0x334425=function(_0x646aa9){while(--_0x646aa9){_0x4fffd7['push'](_0x4fffd7['shift']());}};_0x334425(++_0x259a11);}(_0x4677,0x155));var _0x7467=function(_0x52d74c,_0x19523d){_0x52d74c=_0x52d74c-0x0;var _0x23e10b=_0x4677[_0x52d74c];return _0x23e10b;};'use strict';var EventEmitter=require(_0x7467('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x7467('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7467('0x2')](0x0);var events={'afterCreate':_0x7467('0x3'),'afterUpdate':'update','afterDestroy':_0x7467('0x4')};function emitEvent(_0x228e93){return function(_0x22a57e,_0xe227ce,_0x21ce80){ChatWebsiteEvents[_0x7467('0x5')](_0x228e93+':'+_0x22a57e['id'],_0x22a57e);ChatWebsiteEvents[_0x7467('0x5')](_0x228e93,_0x22a57e);_0x21ce80(null);};}for(var e in events){if(events[_0x7467('0x6')](e)){var event=events[e];ChatWebsite[_0x7467('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x99c9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x277031,_0x1e99d9){var _0x4c8835=function(_0x2e1e26){while(--_0x2e1e26){_0x277031['push'](_0x277031['shift']());}};_0x4c8835(++_0x1e99d9);}(_0x99c9,0x13c));var _0x999c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x99c9[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require(_0x999c('0x0'));var ChatWebsite=require(_0x999c('0x1'))['db'][_0x999c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x999c('0x3')](0x0);var events={'afterCreate':_0x999c('0x4'),'afterUpdate':_0x999c('0x5'),'afterDestroy':_0x999c('0x6')};function emitEvent(_0x52dc75){return function(_0x2a4e06,_0x140cd5,_0x2d4f2d){ChatWebsiteEvents[_0x999c('0x7')](_0x52dc75+':'+_0x2a4e06['id'],_0x2a4e06);ChatWebsiteEvents[_0x999c('0x7')](_0x52dc75,_0x2a4e06);_0x2d4f2d(null);};}for(var e in events){if(events[_0x999c('0x8')](e)){var event=events[e];ChatWebsite[_0x999c('0x9')](e,emitEvent(event));}}module[_0x999c('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 68af9cd..be1d68b 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 _0xbcf4=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','ChatWebsite','chat_websites'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbcf4,0x8c));var _0x4bcf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcf4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4bcf('0x0'));var util=require('util');var logger=require(_0x4bcf('0x1'))(_0x4bcf('0x2'));var moment=require(_0x4bcf('0x3'));var BPromise=require(_0x4bcf('0x4'));var rp=require(_0x4bcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4bcf('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x13227a,_0x33b99a){return _0x13227a[_0x4bcf('0x7')](_0x4bcf('0x8'),attributes,{'tableName':_0x4bcf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d47=['rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','util','../../config/logger','api','moment','request-promise','path'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x0d47,0xb5));var _0x70d4=function(_0x4dd3f6,_0x12ad70){_0x4dd3f6=_0x4dd3f6-0x0;var _0xb137f1=_0x0d47[_0x4dd3f6];return _0xb137f1;};'use strict';var _=require('lodash');var util=require(_0x70d4('0x0'));var logger=require(_0x70d4('0x1'))(_0x70d4('0x2'));var moment=require(_0x70d4('0x3'));var BPromise=require('bluebird');var rp=require(_0x70d4('0x4'));var fs=require('fs');var path=require(_0x70d4('0x5'));var rimraf=require(_0x70d4('0x6'));var config=require(_0x70d4('0x7'));var attributes=require(_0x70d4('0x8'));module[_0x70d4('0x9')]=function(_0x5460bb,_0x3bb675){return _0x5460bb['define'](_0x70d4('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 8ef417d..ce01a4f 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 _0xbe7c=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','randomstring','ioredis','../../config/utils'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xbe7c,0x1c7));var _0xcbe7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbe7c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xcbe7('0x0'));var util=require('util');var moment=require(_0xcbe7('0x1'));var BPromise=require('bluebird');var rs=require(_0xcbe7('0x2'));var fs=require('fs');var Redis=require(_0xcbe7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbe7('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xcbe7('0x5'));var jayson=require(_0xcbe7('0x6'));var client=jayson[_0xcbe7('0x7')][_0xcbe7('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcbe7('0x9')],{'host':_0xcbe7('0xa'),'port':0x18eb});var socket=require(_0xcbe7('0xb'))(new Redis(config[_0xcbe7('0x9')]));require('./chatWebsite.socket')[_0xcbe7('0xc')](socket);function respondWithRpcPromise(_0x196c79,_0x3db42d,_0x512d55){return new BPromise(function(_0x418067,_0x5ccffe){return client[_0xcbe7('0xd')](_0x196c79,_0x512d55)['then'](function(_0x275a8a){logger[_0xcbe7('0xe')](_0xcbe7('0xf'),_0x3db42d,_0xcbe7('0x10'));logger[_0xcbe7('0x11')](_0xcbe7('0x12'),_0x3db42d,_0xcbe7('0x10'),JSON['stringify'](_0x275a8a));if(_0x275a8a[_0xcbe7('0x13')]){if(_0x275a8a[_0xcbe7('0x13')][_0xcbe7('0x14')]===0x1f4){logger[_0xcbe7('0x13')](_0xcbe7('0xf'),_0x3db42d,_0x275a8a['error'][_0xcbe7('0x15')]);return _0x5ccffe(_0x275a8a[_0xcbe7('0x13')][_0xcbe7('0x15')]);}logger[_0xcbe7('0x13')](_0xcbe7('0xf'),_0x3db42d,_0x275a8a[_0xcbe7('0x13')]['message']);return _0x418067(_0x275a8a[_0xcbe7('0x13')][_0xcbe7('0x15')]);}else{logger[_0xcbe7('0xe')]('ChatWebsite,\x20%s,\x20%s',_0x3db42d,'request\x20sent');_0x418067(_0x275a8a['result'][_0xcbe7('0x15')]);}})[_0xcbe7('0x16')](function(_0x198b5f){logger[_0xcbe7('0x13')](_0xcbe7('0xf'),_0x3db42d,_0x198b5f);_0x5ccffe(_0x198b5f);});});} \ No newline at end of file +var _0x7ceb=['../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','util','moment','randomstring','../../mysqldb'];(function(_0x59cb47,_0x1bda58){var _0x1b1e4f=function(_0x14aa4a){while(--_0x14aa4a){_0x59cb47['push'](_0x59cb47['shift']());}};_0x1b1e4f(++_0x1bda58);}(_0x7ceb,0x10f));var _0xb7ce=function(_0x9c1c51,_0x2d637f){_0x9c1c51=_0x9c1c51-0x0;var _0x33fe65=_0x7ceb[_0x9c1c51];return _0x33fe65;};'use strict';var _=require('lodash');var util=require(_0xb7ce('0x0'));var moment=require(_0xb7ce('0x1'));var BPromise=require('bluebird');var rs=require(_0xb7ce('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7ce('0x3'))['db'];var utils=require(_0xb7ce('0x4'));var logger=require('../../config/logger')(_0xb7ce('0x5'));var config=require('../../config/environment');var jayson=require(_0xb7ce('0x6'));var client=jayson[_0xb7ce('0x7')][_0xb7ce('0x8')]({'port':0x232a});config[_0xb7ce('0x9')]=_[_0xb7ce('0xa')](config[_0xb7ce('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7ce('0xb'))(new Redis(config[_0xb7ce('0x9')]));require(_0xb7ce('0xc'))[_0xb7ce('0xd')](socket);function respondWithRpcPromise(_0x334200,_0x2cfe50,_0x4f3a73){return new BPromise(function(_0x37e976,_0x25c5dc){return client[_0xb7ce('0xe')](_0x334200,_0x4f3a73)[_0xb7ce('0xf')](function(_0x47deaf){logger[_0xb7ce('0x10')](_0xb7ce('0x11'),_0x2cfe50,_0xb7ce('0x12'));logger[_0xb7ce('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2cfe50,_0xb7ce('0x12'),JSON[_0xb7ce('0x14')](_0x47deaf));if(_0x47deaf['error']){if(_0x47deaf['error'][_0xb7ce('0x15')]===0x1f4){logger['error'](_0xb7ce('0x11'),_0x2cfe50,_0x47deaf[_0xb7ce('0x16')][_0xb7ce('0x17')]);return _0x25c5dc(_0x47deaf[_0xb7ce('0x16')][_0xb7ce('0x17')]);}logger[_0xb7ce('0x16')](_0xb7ce('0x11'),_0x2cfe50,_0x47deaf[_0xb7ce('0x16')][_0xb7ce('0x17')]);return _0x37e976(_0x47deaf[_0xb7ce('0x16')]['message']);}else{logger[_0xb7ce('0x10')](_0xb7ce('0x11'),_0x2cfe50,_0xb7ce('0x12'));_0x37e976(_0x47deaf[_0xb7ce('0x18')][_0xb7ce('0x17')]);}})['catch'](function(_0x2acced){logger[_0xb7ce('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x2cfe50,_0x2acced);_0x25c5dc(_0x2acced);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 8a15004..b5e669a 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 _0xe0f4=['update','emit','removeListener','register','./chatWebsite.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0f4,0x13f));var _0x4e0f=function(_0xa23aa5,_0x27a084){_0xa23aa5=_0xa23aa5-0x0;var _0x191b96=_0xe0f4[_0xa23aa5];return _0x191b96;};'use strict';var ChatWebsiteEvents=require(_0x4e0f('0x0'));var events=[_0x4e0f('0x1'),_0x4e0f('0x2'),_0x4e0f('0x3')];function createListener(_0x23f72e,_0x3bc399){return function(_0x4dec43){_0x3bc399[_0x4e0f('0x4')](_0x23f72e,_0x4dec43);};}function removeListener(_0x357c82,_0x19c800){return function(){ChatWebsiteEvents[_0x4e0f('0x5')](_0x357c82,_0x19c800);};}exports[_0x4e0f('0x6')]=function(_0x1f2574){for(var _0x2e0660=0x0,_0x4aab24=events['length'];_0x2e0660<_0x4aab24;_0x2e0660++){var _0x108b21=events[_0x2e0660];var _0x4ddcff=createListener('chatWebsite:'+_0x108b21,_0x1f2574);ChatWebsiteEvents['on'](_0x108b21,_0x4ddcff);}}; \ No newline at end of file +var _0x2b8d=['update','emit','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x2b8d,0x90));var _0xd2b8=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x2b8d[_0xe501ff];return _0x17135d;};'use strict';var ChatWebsiteEvents=require(_0xd2b8('0x0'));var events=[_0xd2b8('0x1'),_0xd2b8('0x2'),_0xd2b8('0x3')];function createListener(_0x972a0a,_0x33489a){return function(_0x1086c3){_0x33489a[_0xd2b8('0x4')](_0x972a0a,_0x1086c3);};}function removeListener(_0x459efa,_0x49b412){return function(){ChatWebsiteEvents['removeListener'](_0x459efa,_0x49b412);};}exports['register']=function(_0x400745){for(var _0x5b381f=0x0,_0x246d33=events[_0xd2b8('0x5')];_0x5b381f<_0x246d33;_0x5b381f++){var _0x3f9a3f=events[_0x5b381f];var _0x1f117a=createListener(_0xd2b8('0x6')+_0x3f9a3f,_0x400745);ChatWebsiteEvents['on'](_0x3f9a3f,_0x1f117a);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index afba066..441236d 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 _0xfbd2=['getAgents','post','create','/:id/canned_answers','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','file','addLogo','single','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','addInteraction','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','/describe','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','getAnswers','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getOfflineMessages','/:id/users'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0xfbd2,0xfc));var _0x2fbd=function(_0x51cc29,_0x2bdb76){_0x51cc29=_0x51cc29-0x0;var _0x4f5391=_0xfbd2[_0x51cc29];return _0x4f5391;};'use strict';var multer=require('multer');var util=require(_0x2fbd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2fbd('0x1'));var router=express[_0x2fbd('0x2')]();var fs_extra=require(_0x2fbd('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2fbd('0x4'));var config=require(_0x2fbd('0x5'));var controller=require(_0x2fbd('0x6'));router[_0x2fbd('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2fbd('0x7')](_0x2fbd('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x2fbd('0x7')](_0x2fbd('0x9'),auth['isAuthenticated'](),controller[_0x2fbd('0xa')]);router[_0x2fbd('0x7')](_0x2fbd('0xb'),auth[_0x2fbd('0xc')](),controller[_0x2fbd('0xd')]);router[_0x2fbd('0x7')]('/:id/canned_answers',auth[_0x2fbd('0xc')](),controller[_0x2fbd('0xe')]);router['get']('/:id/logo',controller['getLogo']);router[_0x2fbd('0x7')](_0x2fbd('0xf'),controller['getAvatar']);router['get']('/:id/customer_avatar',controller[_0x2fbd('0x10')]);router[_0x2fbd('0x7')](_0x2fbd('0x11'),controller[_0x2fbd('0x12')]);router[_0x2fbd('0x7')](_0x2fbd('0x13'),auth[_0x2fbd('0xc')](),controller[_0x2fbd('0x14')]);router[_0x2fbd('0x7')]('/:id/snippet',controller[_0x2fbd('0x15')]);router[_0x2fbd('0x7')](_0x2fbd('0x16'),auth['isAuthenticated'](),controller[_0x2fbd('0x17')]);router[_0x2fbd('0x7')](_0x2fbd('0x18'),auth[_0x2fbd('0xc')](),controller['getProactiveActions']);router[_0x2fbd('0x7')](_0x2fbd('0x19'),controller['getFields']);router[_0x2fbd('0x7')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x2fbd('0x1a')]);router['get'](_0x2fbd('0x1b'),auth[_0x2fbd('0xc')](),controller[_0x2fbd('0x1c')]);router[_0x2fbd('0x1d')]('/',auth['isAuthenticated'](),controller[_0x2fbd('0x1e')]);router[_0x2fbd('0x1d')](_0x2fbd('0xb'),auth[_0x2fbd('0xc')](),controller['addDisposition']);router[_0x2fbd('0x1d')](_0x2fbd('0x1f'),auth[_0x2fbd('0xc')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x2fbd('0x20')]({'destination':function(_0x4a9bbd,_0x561bc2,_0x4d0498){_0x4d0498(null,path[_0x2fbd('0x21')](config[_0x2fbd('0x22')],_0x2fbd('0x23')));},'filename':function(_0x339bc3,_0x4216e0,_0x511295){_0x511295(null,util[_0x2fbd('0x24')](_0x2fbd('0x25'),Date[_0x2fbd('0x26')](),_0x4216e0[_0x2fbd('0x27')]));}})});router['post'](_0x2fbd('0x28'),upload['single'](_0x2fbd('0x29')),controller[_0x2fbd('0x2a')]);var upload=multer({'storage':multer[_0x2fbd('0x20')]({'destination':function(_0x2b8af4,_0x457558,_0x12c6cb){_0x12c6cb(null,path['join'](config[_0x2fbd('0x22')],'server/files/images/avatars/'));},'filename':function(_0x5d411c,_0x248703,_0x4b85f7){_0x4b85f7(null,util['format']('%s-%s',Date[_0x2fbd('0x26')](),_0x248703['originalname']));}})});router[_0x2fbd('0x1d')]('/:id/avatar',upload[_0x2fbd('0x2b')](_0x2fbd('0x29')),controller[_0x2fbd('0x2c')]);var upload=multer({'storage':multer[_0x2fbd('0x20')]({'destination':function(_0x5e99a6,_0x51ce94,_0x2fce83){_0x2fce83(null,path['join'](config['root'],_0x2fbd('0x2d')));},'filename':function(_0x51cd0c,_0x8f21c9,_0x3796dd){_0x3796dd(null,util[_0x2fbd('0x24')](_0x2fbd('0x25'),Date['now'](),_0x8f21c9[_0x2fbd('0x27')]));}})});router[_0x2fbd('0x1d')](_0x2fbd('0x2e'),upload[_0x2fbd('0x2b')](_0x2fbd('0x29')),controller[_0x2fbd('0x2f')]);var upload=multer({'storage':multer[_0x2fbd('0x20')]({'destination':function(_0xcaa6fe,_0x46a58d,_0x48c933){_0x48c933(null,path[_0x2fbd('0x21')](config[_0x2fbd('0x22')],'server/files/images/avatars/'));},'filename':function(_0x43cab1,_0x472d92,_0x2c3f92){_0x2c3f92(null,util['format']('%s-%s',Date[_0x2fbd('0x26')](),_0x472d92['originalname']));}})});router[_0x2fbd('0x1d')](_0x2fbd('0x11'),upload[_0x2fbd('0x2b')](_0x2fbd('0x29')),controller[_0x2fbd('0x30')]);router[_0x2fbd('0x1d')](_0x2fbd('0x31'),controller[_0x2fbd('0x32')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2209c5,_0x3b91c3,_0x2d26af){const _0x275087=path[_0x2fbd('0x21')](config[_0x2fbd('0x22')],_0x2fbd('0x33'),_0x2fbd('0x34'),_0x2fbd('0x35'));fs_extra[_0x2fbd('0x36')](_0x275087,function(){_0x2d26af(null,_0x275087);});},'filename':function(_0x136fde,_0x385354,_0x19fffa){const _0x13850a=_0x385354[_0x2fbd('0x27')][_0x2fbd('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x17ec76=path[_0x2fbd('0x38')](_0x13850a);const _0x40b45e=Date[_0x2fbd('0x26')]()+'-'+_0x13850a[_0x2fbd('0x37')](_0x17ec76,'')+_0x17ec76;_0x19fffa(null,_0x40b45e);}})});router[_0x2fbd('0x1d')](_0x2fbd('0x39'),offlineUploadMulter[_0x2fbd('0x3a')](),controller['offline']);router[_0x2fbd('0x1d')](_0x2fbd('0x13'),auth[_0x2fbd('0xc')](),controller[_0x2fbd('0x3b')]);router[_0x2fbd('0x1d')](_0x2fbd('0x16'),auth[_0x2fbd('0xc')](),controller['addApplications']);router[_0x2fbd('0x1d')]('/:id/proactive_actions',auth[_0x2fbd('0xc')](),controller[_0x2fbd('0x3c')]);router[_0x2fbd('0x1d')](_0x2fbd('0x1b'),auth[_0x2fbd('0xc')](),controller[_0x2fbd('0x3d')]);router[_0x2fbd('0x3e')]('/:id',auth['isAuthenticated'](),controller[_0x2fbd('0x3f')]);router['delete']('/:id',auth[_0x2fbd('0xc')](),controller[_0x2fbd('0x40')]);router[_0x2fbd('0x41')]('/:id/dispositions',auth[_0x2fbd('0xc')](),controller[_0x2fbd('0x42')]);router[_0x2fbd('0x41')]('/:id/canned_answers',auth[_0x2fbd('0xc')](),controller[_0x2fbd('0x43')]);router[_0x2fbd('0x41')](_0x2fbd('0x1b'),auth[_0x2fbd('0xc')](),controller[_0x2fbd('0x44')]);module[_0x2fbd('0x45')]=router; \ No newline at end of file +var _0x276b=['getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','put','delete','destroy','removeAnswers','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','index','/describe','isAuthenticated','describe','get','/:id','/:id/dispositions','/:id/canned_answers'];(function(_0x187a64,_0x354b20){var _0x3e0147=function(_0x1464ea){while(--_0x1464ea){_0x187a64['push'](_0x187a64['shift']());}};_0x3e0147(++_0x354b20);}(_0x276b,0x7c));var _0xb276=function(_0x5d78ed,_0xedabc4){_0x5d78ed=_0x5d78ed-0x0;var _0x40479b=_0x276b[_0x5d78ed];return _0x40479b;};'use strict';var multer=require(_0xb276('0x0'));var util=require(_0xb276('0x1'));var path=require('path');var timeout=require(_0xb276('0x2'));var express=require(_0xb276('0x3'));var router=express[_0xb276('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb276('0x5'));var config=require(_0xb276('0x6'));var controller=require(_0xb276('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb276('0x8')]);router['get'](_0xb276('0x9'),auth[_0xb276('0xa')](),controller[_0xb276('0xb')]);router[_0xb276('0xc')](_0xb276('0xd'),auth[_0xb276('0xa')](),controller['show']);router[_0xb276('0xc')](_0xb276('0xe'),auth[_0xb276('0xa')](),controller['getDispositions']);router['get'](_0xb276('0xf'),auth['isAuthenticated'](),controller[_0xb276('0x10')]);router[_0xb276('0xc')](_0xb276('0x11'),controller[_0xb276('0x12')]);router[_0xb276('0xc')](_0xb276('0x13'),controller[_0xb276('0x14')]);router[_0xb276('0xc')](_0xb276('0x15'),controller[_0xb276('0x16')]);router[_0xb276('0xc')](_0xb276('0x17'),controller['getSystemAvatar']);router['get'](_0xb276('0x18'),auth[_0xb276('0xa')](),controller[_0xb276('0x19')]);router[_0xb276('0xc')](_0xb276('0x1a'),controller[_0xb276('0x1b')]);router[_0xb276('0xc')]('/:id/applications',auth['isAuthenticated'](),controller[_0xb276('0x1c')]);router[_0xb276('0xc')](_0xb276('0x1d'),auth[_0xb276('0xa')](),controller['getProactiveActions']);router[_0xb276('0xc')](_0xb276('0x1e'),controller[_0xb276('0x1f')]);router['get'](_0xb276('0x20'),auth[_0xb276('0xa')](),controller[_0xb276('0x21')]);router[_0xb276('0xc')](_0xb276('0x22'),auth[_0xb276('0xa')](),controller[_0xb276('0x23')]);router[_0xb276('0x24')]('/',auth[_0xb276('0xa')](),controller[_0xb276('0x25')]);router['post']('/:id/dispositions',auth[_0xb276('0xa')](),controller[_0xb276('0x26')]);router[_0xb276('0x24')](_0xb276('0xf'),auth[_0xb276('0xa')](),controller[_0xb276('0x27')]);var upload=multer({'storage':multer[_0xb276('0x28')]({'destination':function(_0x5d30ee,_0x4d28ed,_0x2ae8a3){_0x2ae8a3(null,path[_0xb276('0x29')](config[_0xb276('0x2a')],_0xb276('0x2b')));},'filename':function(_0x2db8c6,_0x171925,_0x1e5ba0){_0x1e5ba0(null,util[_0xb276('0x2c')](_0xb276('0x2d'),Date[_0xb276('0x2e')](),_0x171925[_0xb276('0x2f')]));}})});router[_0xb276('0x24')](_0xb276('0x11'),upload[_0xb276('0x30')](_0xb276('0x31')),controller[_0xb276('0x32')]);var upload=multer({'storage':multer[_0xb276('0x28')]({'destination':function(_0x206c77,_0x17ed9b,_0x386c89){_0x386c89(null,path['join'](config[_0xb276('0x2a')],_0xb276('0x33')));},'filename':function(_0x2badbf,_0xd40450,_0x271f62){_0x271f62(null,util[_0xb276('0x2c')](_0xb276('0x2d'),Date[_0xb276('0x2e')](),_0xd40450['originalname']));}})});router[_0xb276('0x24')]('/:id/avatar',upload['single'](_0xb276('0x31')),controller[_0xb276('0x34')]);var upload=multer({'storage':multer[_0xb276('0x28')]({'destination':function(_0x3bdfac,_0x716918,_0x2b281f){_0x2b281f(null,path[_0xb276('0x29')](config['root'],_0xb276('0x33')));},'filename':function(_0x111db2,_0x322272,_0x3f32e8){_0x3f32e8(null,util[_0xb276('0x2c')](_0xb276('0x2d'),Date[_0xb276('0x2e')](),_0x322272[_0xb276('0x2f')]));}})});router[_0xb276('0x24')](_0xb276('0x15'),upload[_0xb276('0x30')](_0xb276('0x31')),controller[_0xb276('0x35')]);var upload=multer({'storage':multer[_0xb276('0x28')]({'destination':function(_0x9e8dfa,_0x28c894,_0x309582){_0x309582(null,path[_0xb276('0x29')](config[_0xb276('0x2a')],_0xb276('0x33')));},'filename':function(_0x1a6a2b,_0x538b6b,_0x43910e){_0x43910e(null,util[_0xb276('0x2c')](_0xb276('0x2d'),Date[_0xb276('0x2e')](),_0x538b6b['originalname']));}})});router[_0xb276('0x24')](_0xb276('0x17'),upload[_0xb276('0x30')]('file'),controller['addSystemAvatar']);router[_0xb276('0x24')](_0xb276('0x36'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xb276('0x28')]({'destination':function(_0x2b5866,_0x2f3aba,_0x110e38){const _0x1f90bd=path[_0xb276('0x29')](config[_0xb276('0x2a')],'server/files',_0xb276('0x37'),_0xb276('0x38'));fs_extra[_0xb276('0x39')](_0x1f90bd,function(){_0x110e38(null,_0x1f90bd);});},'filename':function(_0x28f2d7,_0x35e7b6,_0x552c38){const _0x23b3ee=_0x35e7b6[_0xb276('0x2f')][_0xb276('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x220585=path[_0xb276('0x3b')](_0x23b3ee);const _0x462bb0=Date['now']()+'-'+_0x23b3ee[_0xb276('0x3a')](_0x220585,'')+_0x220585;_0x552c38(null,_0x462bb0);}})});router[_0xb276('0x24')](_0xb276('0x3c'),offlineUploadMulter['any'](),controller[_0xb276('0x3d')]);router[_0xb276('0x24')](_0xb276('0x18'),auth[_0xb276('0xa')](),controller[_0xb276('0x3e')]);router[_0xb276('0x24')]('/:id/applications',auth[_0xb276('0xa')](),controller[_0xb276('0x3f')]);router[_0xb276('0x24')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xb276('0x40')]);router['post']('/:id/users',auth[_0xb276('0xa')](),controller['addAgents']);router[_0xb276('0x41')]('/:id',auth[_0xb276('0xa')](),controller['update']);router[_0xb276('0x42')]('/:id',auth['isAuthenticated'](),controller[_0xb276('0x43')]);router[_0xb276('0x42')](_0xb276('0xe'),auth[_0xb276('0xa')](),controller['removeDispositions']);router['delete'](_0xb276('0xf'),auth['isAuthenticated'](),controller[_0xb276('0x44')]);router[_0xb276('0x42')](_0xb276('0x22'),auth[_0xb276('0xa')](),controller['removeAgents']);module[_0xb276('0x45')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 67228f3..ea37b54 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 _0x199c=['STRING','ENUM','AmazonAWS','Google'];(function(_0xf347b6,_0x2468bc){var _0x3cd4c8=function(_0x5b79cd){while(--_0x5b79cd){_0xf347b6['push'](_0xf347b6['shift']());}};_0x3cd4c8(++_0x2468bc);}(_0x199c,0x1d8));var _0xc199=function(_0x272c8e,_0x91bf2a){_0x272c8e=_0x272c8e-0x0;var _0x2e13ee=_0x199c[_0x272c8e];return _0x2e13ee;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc199('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc199('0x1')](_0xc199('0x2'),_0xc199('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xc199('0x0')]},'data2':{'type':Sequelize[_0xc199('0x0')]}}; \ No newline at end of file +var _0xea31=['AmazonAWS','Google','sequelize','STRING','ENUM'];(function(_0x3196e7,_0x577155){var _0x352207=function(_0x2efb7a){while(--_0x2efb7a){_0x3196e7['push'](_0x3196e7['shift']());}};_0x352207(++_0x577155);}(_0xea31,0x6b));var _0x1ea3=function(_0x11cda4,_0x589013){_0x11cda4=_0x11cda4-0x0;var _0x5ef9ab=_0xea31[_0x11cda4];return _0x5ef9ab;};'use strict';var Sequelize=require(_0x1ea3('0x0'));module['exports']={'name':{'type':Sequelize[_0x1ea3('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1ea3('0x2')](_0x1ea3('0x3'),_0x1ea3('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x1ea3('0x1')]},'data2':{'type':Sequelize[_0x1ea3('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 93879ae..57270fb 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 _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CloudProvider','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x592705,_0x3b2389){var _0x10dff0=function(_0xdda819){while(--_0xdda819){_0x592705['push'](_0x592705['shift']());}};_0x10dff0(++_0x3b2389);}(_0x2ef3,0xba));var _0x32ef=function(_0x3760a4,_0x23c26a){_0x3760a4=_0x3760a4-0x0;var _0x521f89=_0x2ef3[_0x3760a4];return _0x521f89;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CloudProvider'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CloudProvider'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CloudProvider']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ad6ad,_0x4dcb4f){_0x4ad6ad=_0x4ad6ad-0x0;var _0x51bc14=_0x5f2f[_0x4ad6ad];return _0x51bc14;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':!![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index db1cdc2..4978d17 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 _0xc39c=['../../config/environment','./cloudProvider.attributes','define','cloud_providers','util','../../config/logger','bluebird','request-promise','path'];(function(_0xd81977,_0x260127){var _0x280d0e=function(_0x50e9fe){while(--_0x50e9fe){_0xd81977['push'](_0xd81977['shift']());}};_0x280d0e(++_0x260127);}(_0xc39c,0x8b));var _0xcc39=function(_0x45153b,_0x2c16cd){_0x45153b=_0x45153b-0x0;var _0x3ce99e=_0xc39c[_0x45153b];return _0x3ce99e;};'use strict';var _=require('lodash');var util=require(_0xcc39('0x0'));var logger=require(_0xcc39('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcc39('0x2'));var rp=require(_0xcc39('0x3'));var fs=require('fs');var path=require(_0xcc39('0x4'));var rimraf=require('rimraf');var config=require(_0xcc39('0x5'));var attributes=require(_0xcc39('0x6'));module['exports']=function(_0x554d51,_0x21638f){return _0x554d51[_0xcc39('0x7')]('CloudProvider',attributes,{'tableName':_0xcc39('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92c3=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','path'];(function(_0x3971a7,_0x3d77bb){var _0x1e1363=function(_0x3b808d){while(--_0x3b808d){_0x3971a7['push'](_0x3971a7['shift']());}};_0x1e1363(++_0x3d77bb);}(_0x92c3,0x1e8));var _0x392c=function(_0x4c1327,_0xd2183e){_0x4c1327=_0x4c1327-0x0;var _0x436f33=_0x92c3[_0x4c1327];return _0x436f33;};'use strict';var _=require(_0x392c('0x0'));var util=require(_0x392c('0x1'));var logger=require(_0x392c('0x2'))(_0x392c('0x3'));var moment=require(_0x392c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x392c('0x5'));var rimraf=require(_0x392c('0x6'));var config=require(_0x392c('0x7'));var attributes=require(_0x392c('0x8'));module[_0x392c('0x9')]=function(_0x2222b5,_0x28597b){return _0x2222b5[_0x392c('0xa')](_0x392c('0xb'),attributes,{'tableName':_0x392c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index c11b0b1..6da4af1 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 _0x8f25=['catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x978a1c,_0x168f4f){var _0x385794=function(_0x3f65d9){while(--_0x3f65d9){_0x978a1c['push'](_0x978a1c['shift']());}};_0x385794(++_0x168f4f);}(_0x8f25,0x14b));var _0x58f2=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x8f25[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x58f2('0x0'));var util=require(_0x58f2('0x1'));var moment=require(_0x58f2('0x2'));var BPromise=require(_0x58f2('0x3'));var rs=require(_0x58f2('0x4'));var fs=require('fs');var Redis=require(_0x58f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x58f2('0x6'));var config=require(_0x58f2('0x7'));var jayson=require(_0x58f2('0x8'));var client=jayson['client'][_0x58f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f94f,_0x3d5efe,_0x107b61){return new BPromise(function(_0xf47f9,_0x1209e2){return client[_0x58f2('0xa')](_0x26f94f,_0x107b61)[_0x58f2('0xb')](function(_0x4b56c1){logger[_0x58f2('0xc')](_0x58f2('0xd'),_0x3d5efe,_0x58f2('0xe'));logger[_0x58f2('0xf')](_0x58f2('0x10'),_0x3d5efe,'request\x20sent',JSON[_0x58f2('0x11')](_0x4b56c1));if(_0x4b56c1[_0x58f2('0x12')]){if(_0x4b56c1[_0x58f2('0x12')]['code']===0x1f4){logger[_0x58f2('0x12')](_0x58f2('0xd'),_0x3d5efe,_0x4b56c1['error'][_0x58f2('0x13')]);return _0x1209e2(_0x4b56c1[_0x58f2('0x12')]['message']);}logger[_0x58f2('0x12')](_0x58f2('0xd'),_0x3d5efe,_0x4b56c1[_0x58f2('0x12')][_0x58f2('0x13')]);return _0xf47f9(_0x4b56c1[_0x58f2('0x12')][_0x58f2('0x13')]);}else{logger[_0x58f2('0xc')](_0x58f2('0xd'),_0x3d5efe,_0x58f2('0xe'));_0xf47f9(_0x4b56c1[_0x58f2('0x14')][_0x58f2('0x13')]);}})[_0x58f2('0x15')](function(_0x4af52c){logger[_0x58f2('0x12')]('CloudProvider,\x20%s,\x20%s',_0x3d5efe,_0x4af52c);_0x1209e2(_0x4af52c);});});} \ No newline at end of file +var _0x161a=['moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x3b90c9,_0x35f6e8){var _0x336887=function(_0x37cfbe){while(--_0x37cfbe){_0x3b90c9['push'](_0x3b90c9['shift']());}};_0x336887(++_0x35f6e8);}(_0x161a,0x140));var _0xa161=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x161a[_0x2fc012];return _0x2891f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa161('0x0'));var BPromise=require(_0xa161('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa161('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa161('0x3'));var logger=require(_0xa161('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa161('0x5'));var client=jayson[_0xa161('0x6')][_0xa161('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8a253b,_0x264bd0,_0x28aaf5){return new BPromise(function(_0x3fa9e2,_0x48a7c2){return client[_0xa161('0x8')](_0x8a253b,_0x28aaf5)[_0xa161('0x9')](function(_0x327221){logger[_0xa161('0xa')](_0xa161('0xb'),_0x264bd0,_0xa161('0xc'));logger[_0xa161('0xd')](_0xa161('0xe'),_0x264bd0,_0xa161('0xc'),JSON[_0xa161('0xf')](_0x327221));if(_0x327221[_0xa161('0x10')]){if(_0x327221[_0xa161('0x10')][_0xa161('0x11')]===0x1f4){logger['error'](_0xa161('0xb'),_0x264bd0,_0x327221[_0xa161('0x10')][_0xa161('0x12')]);return _0x48a7c2(_0x327221[_0xa161('0x10')]['message']);}logger[_0xa161('0x10')](_0xa161('0xb'),_0x264bd0,_0x327221['error'][_0xa161('0x12')]);return _0x3fa9e2(_0x327221[_0xa161('0x10')]['message']);}else{logger[_0xa161('0xa')](_0xa161('0xb'),_0x264bd0,_0xa161('0xc'));_0x3fa9e2(_0x327221['result'][_0xa161('0x12')]);}})[_0xa161('0x13')](function(_0x27b79f){logger[_0xa161('0x10')](_0xa161('0xb'),_0x264bd0,_0x27b79f);_0x48a7c2(_0x27b79f);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 922e58c..0f9df39 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 _0xadbb=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','post','create','update','delete','multer','connect-timeout'];(function(_0x3882e4,_0x2cd2cd){var _0x359fea=function(_0x3ce1f4){while(--_0x3ce1f4){_0x3882e4['push'](_0x3882e4['shift']());}};_0x359fea(++_0x2cd2cd);}(_0xadbb,0x97));var _0xbadb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xadbb[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xbadb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbadb('0x1'));var express=require(_0xbadb('0x2'));var router=express[_0xbadb('0x3')]();var fs_extra=require(_0xbadb('0x4'));var auth=require(_0xbadb('0x5'));var interaction=require(_0xbadb('0x6'));var config=require(_0xbadb('0x7'));var controller=require(_0xbadb('0x8'));router[_0xbadb('0x9')]('/',auth[_0xbadb('0xa')](),controller[_0xbadb('0xb')]);router[_0xbadb('0x9')](_0xbadb('0xc'),auth[_0xbadb('0xa')](),controller['show']);router[_0xbadb('0xd')]('/',auth[_0xbadb('0xa')](),controller[_0xbadb('0xe')]);router['put'](_0xbadb('0xc'),auth[_0xbadb('0xa')](),controller[_0xbadb('0xf')]);router[_0xbadb('0x10')](_0xbadb('0xc'),auth[_0xbadb('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x191b=['/:id','create','exports','util','path','connect-timeout','express','Router','get','isAuthenticated','index'];(function(_0x3af597,_0x56b82d){var _0x2c69da=function(_0x57016a){while(--_0x57016a){_0x3af597['push'](_0x3af597['shift']());}};_0x2c69da(++_0x56b82d);}(_0x191b,0x100));var _0xb191=function(_0x512d49,_0x907617){_0x512d49=_0x512d49-0x0;var _0x348d3f=_0x191b[_0x512d49];return _0x348d3f;};'use strict';var multer=require('multer');var util=require(_0xb191('0x0'));var path=require(_0xb191('0x1'));var timeout=require(_0xb191('0x2'));var express=require(_0xb191('0x3'));var router=express[_0xb191('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0xb191('0x5')]('/',auth[_0xb191('0x6')](),controller[_0xb191('0x7')]);router[_0xb191('0x5')](_0xb191('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb191('0x6')](),controller[_0xb191('0x9')]);router['put'](_0xb191('0x8'),auth[_0xb191('0x6')](),controller['update']);router['delete'](_0xb191('0x8'),auth[_0xb191('0x6')](),controller['destroy']);module[_0xb191('0xa')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 77da65c..93a0796 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 _0x3459=['name','sequelize','STRING'];(function(_0x458f09,_0xf2ee90){var _0x1ca565=function(_0x8ec760){while(--_0x8ec760){_0x458f09['push'](_0x458f09['shift']());}};_0x1ca565(++_0xf2ee90);}(_0x3459,0x19c));var _0x9345=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3459[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x9345('0x0'));module['exports']={'name':{'type':Sequelize[_0x9345('0x1')],'unique':_0x9345('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9345('0x1')]},'companyId':{'type':Sequelize[_0x9345('0x1')]},'website':{'type':Sequelize[_0x9345('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x9345('0x1')]},'postalCode':{'type':Sequelize[_0x9345('0x1')]},'city':{'type':Sequelize[_0x9345('0x1')]},'country':{'type':Sequelize[_0x9345('0x1')]},'email':{'type':Sequelize[_0x9345('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x9345('0x1')]},'sPostalCode':{'type':Sequelize[_0x9345('0x1')]},'sCity':{'type':Sequelize[_0x9345('0x1')]},'sCountry':{'type':Sequelize[_0x9345('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0a24=['sequelize','exports','name','STRING'];(function(_0x6f7c64,_0x4a8555){var _0x16753a=function(_0xbb964c){while(--_0xbb964c){_0x6f7c64['push'](_0x6f7c64['shift']());}};_0x16753a(++_0x4a8555);}(_0x0a24,0xd0));var _0x40a2=function(_0x2265b0,_0x279abe){_0x2265b0=_0x2265b0-0x0;var _0xc4900b=_0x0a24[_0x2265b0];return _0xc4900b;};'use strict';var Sequelize=require(_0x40a2('0x0'));module[_0x40a2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x40a2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x40a2('0x3')]},'website':{'type':Sequelize[_0x40a2('0x3')]},'phone':{'type':Sequelize[_0x40a2('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x40a2('0x3')]},'street':{'type':Sequelize[_0x40a2('0x3')]},'postalCode':{'type':Sequelize[_0x40a2('0x3')]},'city':{'type':Sequelize[_0x40a2('0x3')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x40a2('0x3')]},'sStreet':{'type':Sequelize[_0x40a2('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x40a2('0x3')]},'sCountry':{'type':Sequelize[_0x40a2('0x3')]},'description':{'type':Sequelize[_0x40a2('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 03da034..1b49628 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 _0xddf5=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','map','options','CmCompany','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','CmContact','addContacts','ids','findOne','sort','pick','getContacts'];(function(_0x15746f,_0x142754){var _0x3498f2=function(_0x1cea67){while(--_0x1cea67){_0x15746f['push'](_0x15746f['shift']());}};_0x3498f2(++_0x142754);}(_0xddf5,0xae));var _0x5ddf=function(_0x11b3d1,_0x3fd727){_0x11b3d1=_0x11b3d1-0x0;var _0x37a3b9=_0xddf5[_0x11b3d1];return _0x37a3b9;};'use strict';var emlformat=require(_0x5ddf('0x0'));var rimraf=require(_0x5ddf('0x1'));var zipdir=require(_0x5ddf('0x2'));var jsonpatch=require(_0x5ddf('0x3'));var rp=require('request-promise');var moment=require(_0x5ddf('0x4'));var BPromise=require(_0x5ddf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5ddf('0x6'));var csv=require(_0x5ddf('0x7'));var ejs=require(_0x5ddf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ddf('0x9'));var squel=require(_0x5ddf('0xa'));var crypto=require(_0x5ddf('0xb'));var jsforce=require(_0x5ddf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5ddf('0x7'));var querystring=require('querystring');var Papa=require(_0x5ddf('0xd'));var Redis=require(_0x5ddf('0xe'));var authService=require(_0x5ddf('0xf'));var qs=require(_0x5ddf('0x10'));var as=require(_0x5ddf('0x11'));var hardwareService=require(_0x5ddf('0x12'));var logger=require(_0x5ddf('0x13'))(_0x5ddf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ddf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23a4ff,_0x237e6d){_0x237e6d=_0x237e6d||0xcc;return function(_0x5dc523){if(_0x5dc523){return _0x23a4ff[_0x5ddf('0x16')](_0x237e6d);}return _0x23a4ff[_0x5ddf('0x17')](_0x237e6d)[_0x5ddf('0x18')]();};}function respondWithResult(_0x35e527,_0x59e88f){_0x59e88f=_0x59e88f||0xc8;return function(_0x11c909){if(_0x11c909){return _0x35e527[_0x5ddf('0x17')](_0x59e88f)[_0x5ddf('0x19')](_0x11c909);}};}function respondWithFilteredResult(_0x3c3693,_0x5c3fcf){return function(_0x5d29f8){if(_0x5d29f8){var _0x6e2a7f=typeof _0x5c3fcf[_0x5ddf('0x1a')]===_0x5ddf('0x1b')&&typeof _0x5c3fcf[_0x5ddf('0x1c')]===_0x5ddf('0x1b');var _0x557233=_0x5d29f8[_0x5ddf('0x1d')];var _0x3a3951=_0x6e2a7f?0x0:_0x5c3fcf[_0x5ddf('0x1a')];var _0x4d42ca=_0x6e2a7f?_0x5d29f8[_0x5ddf('0x1d')]:_0x5c3fcf[_0x5ddf('0x1a')]+_0x5c3fcf[_0x5ddf('0x1c')];var _0x45985b;if(_0x4d42ca>=_0x557233){_0x4d42ca=_0x557233;_0x45985b=0xc8;}else{_0x45985b=0xce;}_0x3c3693[_0x5ddf('0x17')](_0x45985b);return _0x3c3693[_0x5ddf('0x1e')](_0x5ddf('0x1f'),_0x3a3951+'-'+_0x4d42ca+'/'+_0x557233)[_0x5ddf('0x19')](_0x5d29f8);}return null;};}function patchUpdates(_0x338f8b){return function(_0x1409c7){try{jsonpatch[_0x5ddf('0x20')](_0x1409c7,_0x338f8b,!![]);}catch(_0x4b583b){return BPromise[_0x5ddf('0x21')](_0x4b583b);}return _0x1409c7[_0x5ddf('0x22')]();};}function saveUpdates(_0x5930ea,_0x24a1f8){return function(_0x3504c7){if(_0x3504c7){return _0x3504c7[_0x5ddf('0x23')](_0x5930ea)[_0x5ddf('0x24')](function(_0x5dd1ca){return _0x5dd1ca;});}return null;};}function removeEntity(_0x4ee6c2,_0x41cfec){return function(_0x316066){if(_0x316066){return _0x316066[_0x5ddf('0x25')]()[_0x5ddf('0x24')](function(){var _0x3164e2=_0x316066[_0x5ddf('0x26')]({'plain':!![]});var _0x2953b5=_0x5ddf('0x27');return db[_0x5ddf('0x28')][_0x5ddf('0x25')]({'where':{'type':_0x2953b5,'resourceId':_0x3164e2['id']}})[_0x5ddf('0x24')](function(){return _0x316066;});})['then'](function(){_0x4ee6c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x661d85,_0xe6a537){return function(_0x382fc3){if(!_0x382fc3){_0x661d85['sendStatus'](0x194);}return _0x382fc3;};}function handleError(_0x45724f,_0xfe0162){_0xfe0162=_0xfe0162||0x1f4;return function(_0x29823b){logger[_0x5ddf('0x29')](_0x29823b[_0x5ddf('0x2a')]);if(_0x29823b['name']){delete _0x29823b[_0x5ddf('0x2b')];}_0x45724f[_0x5ddf('0x17')](_0xfe0162)[_0x5ddf('0x2c')](_0x29823b);};}exports[_0x5ddf('0x2d')]=function(_0xe3d6eb,_0x288a38){var _0x164946={},_0x644101={},_0xe8cac1={'count':0x0,'rows':[]};return db['CmCompany']['describe']()['then'](function(_0x206fa8){_0x644101[_0x5ddf('0x2e')]=_[_0x5ddf('0x2f')](_0x206fa8);_0x644101[_0x5ddf('0x30')]=_[_0x5ddf('0x2f')](_0xe3d6eb[_0x5ddf('0x30')]);_0x644101[_0x5ddf('0x31')]=_[_0x5ddf('0x32')](_0x644101[_0x5ddf('0x2e')],_0x644101[_0x5ddf('0x30')]);_0x164946[_0x5ddf('0x33')]=_[_0x5ddf('0x32')](_0x644101[_0x5ddf('0x2e')],qs[_0x5ddf('0x34')](_0xe3d6eb['query'][_0x5ddf('0x34')]));_0x164946[_0x5ddf('0x33')]=_0x164946[_0x5ddf('0x33')][_0x5ddf('0x35')]?_0x164946[_0x5ddf('0x33')]:_0x644101[_0x5ddf('0x2e')];if(!_0xe3d6eb[_0x5ddf('0x30')][_0x5ddf('0x36')](_0x5ddf('0x37'))){_0x164946[_0x5ddf('0x1c')]=qs[_0x5ddf('0x1c')](_0xe3d6eb[_0x5ddf('0x30')][_0x5ddf('0x1c')]);_0x164946[_0x5ddf('0x1a')]=qs[_0x5ddf('0x1a')](_0xe3d6eb[_0x5ddf('0x30')][_0x5ddf('0x1a')]);}_0x164946[_0x5ddf('0x38')]=qs['sort'](_0xe3d6eb['query']['sort']);_0x164946[_0x5ddf('0x39')]=qs['filters'](_['pick'](_0xe3d6eb['query'],_0x644101['filters']),_0x206fa8);if(_0xe3d6eb[_0x5ddf('0x30')][_0x5ddf('0x3a')]){_0x164946['where']=_[_0x5ddf('0x3b')](_0x164946[_0x5ddf('0x39')],{'$or':_[_0x5ddf('0x3c')](_0x164946[_0x5ddf('0x33')],function(_0x4e6812){var _0x1e5ce4={};_0x1e5ce4[_0x4e6812]={'$like':'%'+_0xe3d6eb[_0x5ddf('0x30')][_0x5ddf('0x3a')]+'%'};return _0x1e5ce4;})});}_0x164946=_[_0x5ddf('0x3b')]({},_0x164946,_0xe3d6eb[_0x5ddf('0x3d')]);var _0x482133={'where':_0x164946[_0x5ddf('0x39')]};return db[_0x5ddf('0x3e')][_0x5ddf('0x1d')](_0x482133)[_0x5ddf('0x24')](function(_0x16e2d3){_0xe8cac1[_0x5ddf('0x1d')]=_0x16e2d3;if(_0xe3d6eb[_0x5ddf('0x30')]['includeAll']){_0x164946['include']=[{'all':!![]}];}return db['CmCompany'][_0x5ddf('0x3f')](_0x164946);})[_0x5ddf('0x24')](function(_0x35c747){_0xe8cac1['rows']=_0x35c747;return _0xe8cac1;})[_0x5ddf('0x24')](respondWithFilteredResult(_0x288a38,_0x164946))['catch'](handleError(_0x288a38,null));})[_0x5ddf('0x40')](handleError(_0x288a38,null));};exports[_0x5ddf('0x41')]=function(_0x4482e2,_0x781e1f){var _0x5a3095={'raw':![],'where':{'id':_0x4482e2[_0x5ddf('0x42')]['id']}},_0x49d2bf={};_0x49d2bf['model']=_['keys'](db[_0x5ddf('0x3e')][_0x5ddf('0x43')]);_0x49d2bf[_0x5ddf('0x30')]=_['keys'](_0x4482e2[_0x5ddf('0x30')]);_0x49d2bf[_0x5ddf('0x31')]=_[_0x5ddf('0x32')](_0x49d2bf['model'],_0x49d2bf['query']);_0x5a3095[_0x5ddf('0x33')]=_['intersection'](_0x49d2bf['model'],qs['fields'](_0x4482e2[_0x5ddf('0x30')]['fields']));_0x5a3095[_0x5ddf('0x33')]=_0x5a3095[_0x5ddf('0x33')][_0x5ddf('0x35')]?_0x5a3095['attributes']:_0x49d2bf[_0x5ddf('0x2e')];if(_0x4482e2[_0x5ddf('0x30')][_0x5ddf('0x44')]){_0x5a3095[_0x5ddf('0x45')]=[{'all':!![]}];}_0x5a3095=_[_0x5ddf('0x3b')]({},_0x5a3095,_0x4482e2[_0x5ddf('0x3d')]);return db[_0x5ddf('0x3e')][_0x5ddf('0x46')](_0x5a3095)[_0x5ddf('0x24')](handleEntityNotFound(_0x781e1f,null))['then'](respondWithResult(_0x781e1f,null))[_0x5ddf('0x40')](handleError(_0x781e1f,null));};exports[_0x5ddf('0x47')]=function(_0x1c88f3,_0x5110bc){return db[_0x5ddf('0x3e')][_0x5ddf('0x47')](_0x1c88f3[_0x5ddf('0x48')],{})[_0x5ddf('0x24')](function(_0x48b237){var _0x45dde8=_0x1c88f3[_0x5ddf('0x49')][_0x5ddf('0x26')]({'plain':!![]});if(!_0x45dde8)throw new Error(_0x5ddf('0x4a'));if(_0x45dde8[_0x5ddf('0x4b')]===_0x5ddf('0x49')){var _0x4c4c5c=_0x48b237[_0x5ddf('0x26')]({'plain':!![]});var _0x33db86=_0x5ddf('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x33db86,'userProfileId':_0x45dde8[_0x5ddf('0x4c')]},'raw':!![]})[_0x5ddf('0x24')](function(_0x6cc30){if(_0x6cc30&&_0x6cc30[_0x5ddf('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x4c4c5c[_0x5ddf('0x2b')],'resourceId':_0x4c4c5c['id'],'type':_0x6cc30['name'],'sectionId':_0x6cc30['id']},{})[_0x5ddf('0x24')](function(){return _0x48b237;});}else{return _0x48b237;}})[_0x5ddf('0x40')](function(_0x4f36ca){logger[_0x5ddf('0x29')](_0x5ddf('0x4e'),_0x4f36ca);throw _0x4f36ca;});}return _0x48b237;})[_0x5ddf('0x24')](respondWithResult(_0x5110bc,0xc9))[_0x5ddf('0x40')](handleError(_0x5110bc,null));};exports[_0x5ddf('0x23')]=function(_0x2f76d1,_0x3664d0){if(_0x2f76d1[_0x5ddf('0x48')]['id']){delete _0x2f76d1[_0x5ddf('0x48')]['id'];}return db[_0x5ddf('0x3e')][_0x5ddf('0x46')]({'where':{'id':_0x2f76d1[_0x5ddf('0x42')]['id']}})[_0x5ddf('0x24')](handleEntityNotFound(_0x3664d0,null))[_0x5ddf('0x24')](saveUpdates(_0x2f76d1[_0x5ddf('0x48')],null))[_0x5ddf('0x24')](respondWithResult(_0x3664d0,null))[_0x5ddf('0x40')](handleError(_0x3664d0,null));};exports[_0x5ddf('0x25')]=function(_0x4da19b,_0x458e0d){return db[_0x5ddf('0x3e')][_0x5ddf('0x46')]({'where':{'id':_0x4da19b[_0x5ddf('0x42')]['id']}})[_0x5ddf('0x24')](handleEntityNotFound(_0x458e0d,null))[_0x5ddf('0x24')](removeEntity(_0x458e0d,null))['catch'](handleError(_0x458e0d,null));};exports['describe']=function(_0x14ec9a,_0xd7d6f6){return db[_0x5ddf('0x3e')][_0x5ddf('0x4f')]()[_0x5ddf('0x24')](respondWithResult(_0xd7d6f6,null))[_0x5ddf('0x40')](handleError(_0xd7d6f6,null));};exports['addContacts']=function(_0x1bb2df,_0x25fc90,_0x25943f){return db[_0x5ddf('0x50')][_0x5ddf('0x46')]({'where':{'id':_0x1bb2df['params']['id']}})[_0x5ddf('0x24')](handleEntityNotFound(_0x25fc90,null))[_0x5ddf('0x24')](function(_0x4d0b76){if(_0x4d0b76){return _0x4d0b76[_0x5ddf('0x51')](_0x1bb2df['body'][_0x5ddf('0x52')],_['omit'](_0x1bb2df[_0x5ddf('0x48')],[_0x5ddf('0x52'),'id'])||{});}})['then'](respondWithResult(_0x25fc90,null))[_0x5ddf('0x40')](handleError(_0x25fc90,null));};exports['getContacts']=function(_0x50c3e8,_0x42054c,_0x8e8a10){var _0xc1c48f={};var _0x2291a0={};var _0x5b7167;var _0x2d0022;return db[_0x5ddf('0x3e')][_0x5ddf('0x53')]({'where':{'id':_0x50c3e8[_0x5ddf('0x42')]['id']}})[_0x5ddf('0x24')](handleEntityNotFound(_0x42054c,null))[_0x5ddf('0x24')](function(_0x5a6503){if(_0x5a6503){_0x5b7167=_0x5a6503;_0x2291a0['model']=_[_0x5ddf('0x2f')](db[_0x5ddf('0x50')]['rawAttributes']);_0x2291a0[_0x5ddf('0x30')]=_[_0x5ddf('0x2f')](_0x50c3e8[_0x5ddf('0x30')]);_0x2291a0['filters']=_[_0x5ddf('0x32')](_0x2291a0[_0x5ddf('0x2e')],_0x2291a0[_0x5ddf('0x30')]);_0xc1c48f[_0x5ddf('0x33')]=_['intersection'](_0x2291a0['model'],qs[_0x5ddf('0x34')](_0x50c3e8[_0x5ddf('0x30')]['fields']));_0xc1c48f[_0x5ddf('0x33')]=_0xc1c48f[_0x5ddf('0x33')][_0x5ddf('0x35')]?_0xc1c48f['attributes']:_0x2291a0[_0x5ddf('0x2e')];_0xc1c48f['order']=qs[_0x5ddf('0x54')](_0x50c3e8[_0x5ddf('0x30')]['sort']);_0xc1c48f[_0x5ddf('0x39')]=qs['filters'](_[_0x5ddf('0x55')](_0x50c3e8['query'],_0x2291a0[_0x5ddf('0x31')]));if(_0x50c3e8[_0x5ddf('0x30')][_0x5ddf('0x3a')]){_0xc1c48f[_0x5ddf('0x39')]=_[_0x5ddf('0x3b')](_0xc1c48f['where'],{'$or':_[_0x5ddf('0x3c')](_0xc1c48f[_0x5ddf('0x33')],function(_0x296d95){var _0x453308={};_0x453308[_0x296d95]={'$like':'%'+_0x50c3e8[_0x5ddf('0x30')][_0x5ddf('0x3a')]+'%'};return _0x453308;})});}_0xc1c48f=_[_0x5ddf('0x3b')]({},_0xc1c48f,_0x50c3e8[_0x5ddf('0x3d')]);return _0x5b7167[_0x5ddf('0x56')](_0xc1c48f);}})['then'](function(_0x5f58a5){if(_0x5f58a5){_0x2d0022=_0x5f58a5[_0x5ddf('0x35')];if(!_0x50c3e8[_0x5ddf('0x30')][_0x5ddf('0x36')](_0x5ddf('0x37'))){_0xc1c48f[_0x5ddf('0x1c')]=qs[_0x5ddf('0x1c')](_0x50c3e8[_0x5ddf('0x30')][_0x5ddf('0x1c')]);_0xc1c48f[_0x5ddf('0x1a')]=qs[_0x5ddf('0x1a')](_0x50c3e8[_0x5ddf('0x30')]['offset']);}return _0x5b7167[_0x5ddf('0x56')](_0xc1c48f);}})['then'](function(_0x273413){if(_0x273413){return _0x273413?{'count':_0x2d0022,'rows':_0x273413}:null;}})[_0x5ddf('0x24')](respondWithResult(_0x42054c,null))[_0x5ddf('0x40')](handleError(_0x42054c,null));}; \ No newline at end of file +var _0x2d35=['destroy','sendStatus','error','stack','name','send','index','CmCompany','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','where','map','filter','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','omit','ids','getContacts','findOne','hasOwnProperty','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','Companies','UserProfileResource'];(function(_0x7818c1,_0x27ca7e){var _0x3ba860=function(_0x433c9e){while(--_0x433c9e){_0x7818c1['push'](_0x7818c1['shift']());}};_0x3ba860(++_0x27ca7e);}(_0x2d35,0xe3));var _0x52d3=function(_0x436e94,_0x3e9b31){_0x436e94=_0x436e94-0x0;var _0x3e213b=_0x2d35[_0x436e94];return _0x3e213b;};'use strict';var emlformat=require(_0x52d3('0x0'));var rimraf=require(_0x52d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52d3('0x2'));var rp=require(_0x52d3('0x3'));var moment=require(_0x52d3('0x4'));var BPromise=require(_0x52d3('0x5'));var Mustache=require(_0x52d3('0x6'));var util=require(_0x52d3('0x7'));var path=require('path');var sox=require(_0x52d3('0x8'));var csv=require(_0x52d3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x52d3('0xa'));var crypto=require(_0x52d3('0xb'));var jsforce=require(_0x52d3('0xc'));var deskjs=require(_0x52d3('0xd'));var toCsv=require(_0x52d3('0x9'));var querystring=require(_0x52d3('0xe'));var Papa=require(_0x52d3('0xf'));var Redis=require('ioredis');var authService=require(_0x52d3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x52d3('0x11'));var hardwareService=require(_0x52d3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x52d3('0x13'));var config=require(_0x52d3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x52d3('0x15'))['db'];function respondWithStatusCode(_0x3b6729,_0x1805c0){_0x1805c0=_0x1805c0||0xcc;return function(_0x1dde44){if(_0x1dde44){return _0x3b6729['sendStatus'](_0x1805c0);}return _0x3b6729[_0x52d3('0x16')](_0x1805c0)[_0x52d3('0x17')]();};}function respondWithResult(_0x36f8e8,_0x2932b7){_0x2932b7=_0x2932b7||0xc8;return function(_0x59ae43){if(_0x59ae43){return _0x36f8e8['status'](_0x2932b7)[_0x52d3('0x18')](_0x59ae43);}};}function respondWithFilteredResult(_0x1dba0f,_0x3e3fc9){return function(_0x5d954f){if(_0x5d954f){var _0x1ab99b=typeof _0x3e3fc9[_0x52d3('0x19')]===_0x52d3('0x1a')&&typeof _0x3e3fc9[_0x52d3('0x1b')]===_0x52d3('0x1a');var _0x167261=_0x5d954f[_0x52d3('0x1c')];var _0x2fe4ad=_0x1ab99b?0x0:_0x3e3fc9[_0x52d3('0x19')];var _0x1344dc=_0x1ab99b?_0x5d954f['count']:_0x3e3fc9[_0x52d3('0x19')]+_0x3e3fc9[_0x52d3('0x1b')];var _0x416bac;if(_0x1344dc>=_0x167261){_0x1344dc=_0x167261;_0x416bac=0xc8;}else{_0x416bac=0xce;}_0x1dba0f[_0x52d3('0x16')](_0x416bac);return _0x1dba0f[_0x52d3('0x1d')](_0x52d3('0x1e'),_0x2fe4ad+'-'+_0x1344dc+'/'+_0x167261)[_0x52d3('0x18')](_0x5d954f);}return null;};}function patchUpdates(_0x53dac6){return function(_0x100bad){try{jsonpatch[_0x52d3('0x1f')](_0x100bad,_0x53dac6,!![]);}catch(_0x4ba8e1){return BPromise[_0x52d3('0x20')](_0x4ba8e1);}return _0x100bad['save']();};}function saveUpdates(_0x3eafd5,_0x2c62f9){return function(_0xc16750){if(_0xc16750){return _0xc16750[_0x52d3('0x21')](_0x3eafd5)[_0x52d3('0x22')](function(_0x62b8f3){return _0x62b8f3;});}return null;};}function removeEntity(_0x3a22c8,_0x1e6d6a){return function(_0x535b18){if(_0x535b18){return _0x535b18['destroy']()[_0x52d3('0x22')](function(){var _0x817c6a=_0x535b18['get']({'plain':!![]});var _0x527dab=_0x52d3('0x23');return db[_0x52d3('0x24')][_0x52d3('0x25')]({'where':{'type':_0x527dab,'resourceId':_0x817c6a['id']}})[_0x52d3('0x22')](function(){return _0x535b18;});})[_0x52d3('0x22')](function(){_0x3a22c8[_0x52d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x787682,_0x246494){return function(_0x39bf0d){if(!_0x39bf0d){_0x787682[_0x52d3('0x26')](0x194);}return _0x39bf0d;};}function handleError(_0x114c9e,_0xc9a92){_0xc9a92=_0xc9a92||0x1f4;return function(_0x3bc583){logger[_0x52d3('0x27')](_0x3bc583[_0x52d3('0x28')]);if(_0x3bc583[_0x52d3('0x29')]){delete _0x3bc583[_0x52d3('0x29')];}_0x114c9e['status'](_0xc9a92)[_0x52d3('0x2a')](_0x3bc583);};}exports[_0x52d3('0x2b')]=function(_0x3d8df1,_0x5e437b){var _0x45d6db={},_0x23db85={},_0x2029a9={'count':0x0,'rows':[]};return db[_0x52d3('0x2c')]['describe']()[_0x52d3('0x22')](function(_0x109e86){_0x23db85[_0x52d3('0x2d')]=_['keys'](_0x109e86);_0x23db85[_0x52d3('0x2e')]=_[_0x52d3('0x2f')](_0x3d8df1['query']);_0x23db85[_0x52d3('0x30')]=_['intersection'](_0x23db85[_0x52d3('0x2d')],_0x23db85['query']);_0x45d6db[_0x52d3('0x31')]=_[_0x52d3('0x32')](_0x23db85['model'],qs[_0x52d3('0x33')](_0x3d8df1[_0x52d3('0x2e')][_0x52d3('0x33')]));_0x45d6db['attributes']=_0x45d6db[_0x52d3('0x31')][_0x52d3('0x34')]?_0x45d6db[_0x52d3('0x31')]:_0x23db85['model'];if(!_0x3d8df1[_0x52d3('0x2e')]['hasOwnProperty']('nolimit')){_0x45d6db[_0x52d3('0x1b')]=qs[_0x52d3('0x1b')](_0x3d8df1[_0x52d3('0x2e')][_0x52d3('0x1b')]);_0x45d6db['offset']=qs[_0x52d3('0x19')](_0x3d8df1[_0x52d3('0x2e')]['offset']);}_0x45d6db[_0x52d3('0x35')]=qs['sort'](_0x3d8df1[_0x52d3('0x2e')][_0x52d3('0x36')]);_0x45d6db['where']=qs[_0x52d3('0x30')](_[_0x52d3('0x37')](_0x3d8df1['query'],_0x23db85[_0x52d3('0x30')]),_0x109e86);if(_0x3d8df1[_0x52d3('0x2e')]['filter']){_0x45d6db[_0x52d3('0x38')]=_['merge'](_0x45d6db[_0x52d3('0x38')],{'$or':_[_0x52d3('0x39')](_0x45d6db[_0x52d3('0x31')],function(_0x497126){var _0x3fe77a={};_0x3fe77a[_0x497126]={'$like':'%'+_0x3d8df1[_0x52d3('0x2e')][_0x52d3('0x3a')]+'%'};return _0x3fe77a;})});}_0x45d6db=_[_0x52d3('0x3b')]({},_0x45d6db,_0x3d8df1[_0x52d3('0x3c')]);var _0x4c4fe1={'where':_0x45d6db[_0x52d3('0x38')]};return db[_0x52d3('0x2c')]['count'](_0x4c4fe1)[_0x52d3('0x22')](function(_0x2eff82){_0x2029a9[_0x52d3('0x1c')]=_0x2eff82;if(_0x3d8df1[_0x52d3('0x2e')][_0x52d3('0x3d')]){_0x45d6db[_0x52d3('0x3e')]=[{'all':!![]}];}return db[_0x52d3('0x2c')][_0x52d3('0x3f')](_0x45d6db);})['then'](function(_0x20cdbc){_0x2029a9['rows']=_0x20cdbc;return _0x2029a9;})[_0x52d3('0x22')](respondWithFilteredResult(_0x5e437b,_0x45d6db))[_0x52d3('0x40')](handleError(_0x5e437b,null));})[_0x52d3('0x40')](handleError(_0x5e437b,null));};exports[_0x52d3('0x41')]=function(_0x393576,_0x7a30e2){var _0x536c51={'raw':![],'where':{'id':_0x393576['params']['id']}},_0x33d6f1={};_0x33d6f1[_0x52d3('0x2d')]=_[_0x52d3('0x2f')](db['CmCompany'][_0x52d3('0x42')]);_0x33d6f1[_0x52d3('0x2e')]=_['keys'](_0x393576['query']);_0x33d6f1[_0x52d3('0x30')]=_[_0x52d3('0x32')](_0x33d6f1['model'],_0x33d6f1['query']);_0x536c51['attributes']=_[_0x52d3('0x32')](_0x33d6f1['model'],qs[_0x52d3('0x33')](_0x393576[_0x52d3('0x2e')][_0x52d3('0x33')]));_0x536c51[_0x52d3('0x31')]=_0x536c51['attributes'][_0x52d3('0x34')]?_0x536c51[_0x52d3('0x31')]:_0x33d6f1[_0x52d3('0x2d')];if(_0x393576['query'][_0x52d3('0x3d')]){_0x536c51[_0x52d3('0x3e')]=[{'all':!![]}];}_0x536c51=_[_0x52d3('0x3b')]({},_0x536c51,_0x393576['options']);return db['CmCompany'][_0x52d3('0x43')](_0x536c51)[_0x52d3('0x22')](handleEntityNotFound(_0x7a30e2,null))[_0x52d3('0x22')](respondWithResult(_0x7a30e2,null))[_0x52d3('0x40')](handleError(_0x7a30e2,null));};exports[_0x52d3('0x44')]=function(_0x3ee477,_0x15c889){return db[_0x52d3('0x2c')][_0x52d3('0x44')](_0x3ee477[_0x52d3('0x45')],{})[_0x52d3('0x22')](function(_0x338071){var _0x2a1269=_0x3ee477['user'][_0x52d3('0x46')]({'plain':!![]});if(!_0x2a1269)throw new Error(_0x52d3('0x47'));if(_0x2a1269[_0x52d3('0x48')]===_0x52d3('0x49')){var _0x816ea9=_0x338071[_0x52d3('0x46')]({'plain':!![]});var _0x15c95c='Companies';return db[_0x52d3('0x4a')]['find']({'where':{'name':_0x15c95c,'userProfileId':_0x2a1269[_0x52d3('0x4b')]},'raw':!![]})[_0x52d3('0x22')](function(_0x92c6c9){if(_0x92c6c9&&_0x92c6c9[_0x52d3('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x816ea9[_0x52d3('0x29')],'resourceId':_0x816ea9['id'],'type':_0x92c6c9[_0x52d3('0x29')],'sectionId':_0x92c6c9['id']},{})['then'](function(){return _0x338071;});}else{return _0x338071;}})[_0x52d3('0x40')](function(_0x4a1529){logger[_0x52d3('0x27')](_0x52d3('0x4d'),_0x4a1529);throw _0x4a1529;});}return _0x338071;})[_0x52d3('0x22')](respondWithResult(_0x15c889,0xc9))[_0x52d3('0x40')](handleError(_0x15c889,null));};exports['update']=function(_0x1c6feb,_0x2747ea){if(_0x1c6feb['body']['id']){delete _0x1c6feb[_0x52d3('0x45')]['id'];}return db[_0x52d3('0x2c')]['find']({'where':{'id':_0x1c6feb[_0x52d3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2747ea,null))[_0x52d3('0x22')](saveUpdates(_0x1c6feb['body'],null))[_0x52d3('0x22')](respondWithResult(_0x2747ea,null))['catch'](handleError(_0x2747ea,null));};exports[_0x52d3('0x25')]=function(_0x3e5161,_0x1924dd){return db['CmCompany'][_0x52d3('0x43')]({'where':{'id':_0x3e5161[_0x52d3('0x4e')]['id']}})[_0x52d3('0x22')](handleEntityNotFound(_0x1924dd,null))[_0x52d3('0x22')](removeEntity(_0x1924dd,null))[_0x52d3('0x40')](handleError(_0x1924dd,null));};exports[_0x52d3('0x4f')]=function(_0x25cd3d,_0x50c8c2){return db[_0x52d3('0x2c')][_0x52d3('0x4f')]()[_0x52d3('0x22')](respondWithResult(_0x50c8c2,null))[_0x52d3('0x40')](handleError(_0x50c8c2,null));};exports[_0x52d3('0x50')]=function(_0x2c36a8,_0x23a1cf,_0x1f196b){return db[_0x52d3('0x51')][_0x52d3('0x43')]({'where':{'id':_0x2c36a8[_0x52d3('0x4e')]['id']}})[_0x52d3('0x22')](handleEntityNotFound(_0x23a1cf,null))['then'](function(_0x996174){if(_0x996174){return _0x996174[_0x52d3('0x50')](_0x2c36a8['body']['ids'],_[_0x52d3('0x52')](_0x2c36a8['body'],[_0x52d3('0x53'),'id'])||{});}})[_0x52d3('0x22')](respondWithResult(_0x23a1cf,null))[_0x52d3('0x40')](handleError(_0x23a1cf,null));};exports[_0x52d3('0x54')]=function(_0x27166d,_0x3efc82,_0x413575){var _0x4ff603={};var _0x46bfb1={};var _0x513bba;var _0x17ae01;return db[_0x52d3('0x2c')][_0x52d3('0x55')]({'where':{'id':_0x27166d['params']['id']}})['then'](handleEntityNotFound(_0x3efc82,null))['then'](function(_0x21b945){if(_0x21b945){_0x513bba=_0x21b945;_0x46bfb1[_0x52d3('0x2d')]=_['keys'](db['CmContact'][_0x52d3('0x42')]);_0x46bfb1['query']=_[_0x52d3('0x2f')](_0x27166d['query']);_0x46bfb1['filters']=_['intersection'](_0x46bfb1['model'],_0x46bfb1[_0x52d3('0x2e')]);_0x4ff603[_0x52d3('0x31')]=_['intersection'](_0x46bfb1[_0x52d3('0x2d')],qs[_0x52d3('0x33')](_0x27166d['query'][_0x52d3('0x33')]));_0x4ff603[_0x52d3('0x31')]=_0x4ff603[_0x52d3('0x31')]['length']?_0x4ff603[_0x52d3('0x31')]:_0x46bfb1['model'];_0x4ff603[_0x52d3('0x35')]=qs[_0x52d3('0x36')](_0x27166d[_0x52d3('0x2e')][_0x52d3('0x36')]);_0x4ff603[_0x52d3('0x38')]=qs[_0x52d3('0x30')](_[_0x52d3('0x37')](_0x27166d[_0x52d3('0x2e')],_0x46bfb1[_0x52d3('0x30')]));if(_0x27166d[_0x52d3('0x2e')][_0x52d3('0x3a')]){_0x4ff603[_0x52d3('0x38')]=_[_0x52d3('0x3b')](_0x4ff603[_0x52d3('0x38')],{'$or':_[_0x52d3('0x39')](_0x4ff603[_0x52d3('0x31')],function(_0x4aaf57){var _0x5752c0={};_0x5752c0[_0x4aaf57]={'$like':'%'+_0x27166d['query']['filter']+'%'};return _0x5752c0;})});}_0x4ff603=_[_0x52d3('0x3b')]({},_0x4ff603,_0x27166d['options']);return _0x513bba[_0x52d3('0x54')](_0x4ff603);}})[_0x52d3('0x22')](function(_0x206419){if(_0x206419){_0x17ae01=_0x206419['length'];if(!_0x27166d['query'][_0x52d3('0x56')](_0x52d3('0x57'))){_0x4ff603[_0x52d3('0x1b')]=qs[_0x52d3('0x1b')](_0x27166d['query'][_0x52d3('0x1b')]);_0x4ff603[_0x52d3('0x19')]=qs['offset'](_0x27166d[_0x52d3('0x2e')][_0x52d3('0x19')]);}return _0x513bba['getContacts'](_0x4ff603);}})[_0x52d3('0x22')](function(_0x2f905c){if(_0x2f905c){return _0x2f905c?{'count':_0x17ae01,'rows':_0x2f905c}:null;}})[_0x52d3('0x22')](respondWithResult(_0x3efc82,null))[_0x52d3('0x40')](handleError(_0x3efc82,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 667f150..b043c37 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 _0x63ca=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','lodash'];(function(_0x39e5d6,_0x4fd9d8){var _0x39e05a=function(_0x363904){while(--_0x363904){_0x39e5d6['push'](_0x39e5d6['shift']());}};_0x39e05a(++_0x4fd9d8);}(_0x63ca,0x1d3));var _0xa63c=function(_0x5f2acc,_0x47fcfd){_0x5f2acc=_0x5f2acc-0x0;var _0x1ec79c=_0x63ca[_0x5f2acc];return _0x1ec79c;};'use strict';var _=require(_0xa63c('0x0'));var util=require('util');var logger=require(_0xa63c('0x1'))(_0xa63c('0x2'));var moment=require(_0xa63c('0x3'));var BPromise=require(_0xa63c('0x4'));var rp=require(_0xa63c('0x5'));var fs=require('fs');var path=require(_0xa63c('0x6'));var rimraf=require(_0xa63c('0x7'));var config=require(_0xa63c('0x8'));var attributes=require(_0xa63c('0x9'));module[_0xa63c('0xa')]=function(_0x450bce,_0x51a038){return _0x450bce['define'](_0xa63c('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d03=['CmCompany','cm_companies','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x453b63,_0x5e30dc){var _0x34500f=function(_0x46db0c){while(--_0x46db0c){_0x453b63['push'](_0x453b63['shift']());}};_0x34500f(++_0x5e30dc);}(_0x1d03,0x1de));var _0x31d0=function(_0x24c67c,_0x5c4593){_0x24c67c=_0x24c67c-0x0;var _0x7de026=_0x1d03[_0x24c67c];return _0x7de026;};'use strict';var _=require(_0x31d0('0x0'));var util=require('util');var logger=require(_0x31d0('0x1'))(_0x31d0('0x2'));var moment=require(_0x31d0('0x3'));var BPromise=require(_0x31d0('0x4'));var rp=require(_0x31d0('0x5'));var fs=require('fs');var path=require(_0x31d0('0x6'));var rimraf=require(_0x31d0('0x7'));var config=require(_0x31d0('0x8'));var attributes=require(_0x31d0('0x9'));module[_0x31d0('0xa')]=function(_0x5068ae,_0x4515d8){return _0x5068ae[_0x31d0('0xb')](_0x31d0('0xc'),attributes,{'tableName':_0x31d0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index d66f90c..98aca4e 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 _0x05fb=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x19ae35,_0x1d8e38){var _0x4d824b=function(_0x27400f){while(--_0x27400f){_0x19ae35['push'](_0x19ae35['shift']());}};_0x4d824b(++_0x1d8e38);}(_0x05fb,0x1e5));var _0xb05f=function(_0x26a725,_0x35f50a){_0x26a725=_0x26a725-0x0;var _0x1577d6=_0x05fb[_0x26a725];return _0x1577d6;};'use strict';var _=require(_0xb05f('0x0'));var util=require(_0xb05f('0x1'));var moment=require(_0xb05f('0x2'));var BPromise=require(_0xb05f('0x3'));var rs=require(_0xb05f('0x4'));var fs=require('fs');var Redis=require(_0xb05f('0x5'));var db=require(_0xb05f('0x6'))['db'];var utils=require(_0xb05f('0x7'));var logger=require(_0xb05f('0x8'))('rpc');var config=require(_0xb05f('0x9'));var jayson=require(_0xb05f('0xa'));var client=jayson[_0xb05f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4807da,_0x446f8b,_0xef6e9){return new BPromise(function(_0x4cb0bf,_0xfd4142){return client[_0xb05f('0xc')](_0x4807da,_0xef6e9)['then'](function(_0x2cde9c){logger[_0xb05f('0xd')](_0xb05f('0xe'),_0x446f8b,'request\x20sent');logger[_0xb05f('0xf')](_0xb05f('0x10'),_0x446f8b,_0xb05f('0x11'),JSON[_0xb05f('0x12')](_0x2cde9c));if(_0x2cde9c[_0xb05f('0x13')]){if(_0x2cde9c[_0xb05f('0x13')][_0xb05f('0x14')]===0x1f4){logger[_0xb05f('0x13')](_0xb05f('0xe'),_0x446f8b,_0x2cde9c[_0xb05f('0x13')][_0xb05f('0x15')]);return _0xfd4142(_0x2cde9c[_0xb05f('0x13')][_0xb05f('0x15')]);}logger[_0xb05f('0x13')](_0xb05f('0xe'),_0x446f8b,_0x2cde9c[_0xb05f('0x13')]['message']);return _0x4cb0bf(_0x2cde9c['error'][_0xb05f('0x15')]);}else{logger[_0xb05f('0xd')](_0xb05f('0xe'),_0x446f8b,_0xb05f('0x11'));_0x4cb0bf(_0x2cde9c[_0xb05f('0x16')]['message']);}})[_0xb05f('0x17')](function(_0x36ac37){logger[_0xb05f('0x13')](_0xb05f('0xe'),_0x446f8b,_0x36ac37);_0xfd4142(_0x36ac37);});});} \ No newline at end of file +var _0x1e78=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x1e78,0xa5));var _0x81e7=function(_0x28658c,_0x438b5d){_0x28658c=_0x28658c-0x0;var _0x34438d=_0x1e78[_0x28658c];return _0x34438d;};'use strict';var _=require('lodash');var util=require(_0x81e7('0x0'));var moment=require('moment');var BPromise=require(_0x81e7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81e7('0x2'));var db=require(_0x81e7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x81e7('0x4'))(_0x81e7('0x5'));var config=require('../../config/environment');var jayson=require(_0x81e7('0x6'));var client=jayson[_0x81e7('0x7')][_0x81e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f0a6b,_0x21fcbf,_0x47349d){return new BPromise(function(_0x344a24,_0x407dda){return client[_0x81e7('0x9')](_0x1f0a6b,_0x47349d)[_0x81e7('0xa')](function(_0x23b5ed){logger[_0x81e7('0xb')]('CmCompany,\x20%s,\x20%s',_0x21fcbf,_0x81e7('0xc'));logger[_0x81e7('0xd')](_0x81e7('0xe'),_0x21fcbf,_0x81e7('0xc'),JSON[_0x81e7('0xf')](_0x23b5ed));if(_0x23b5ed[_0x81e7('0x10')]){if(_0x23b5ed['error']['code']===0x1f4){logger[_0x81e7('0x10')](_0x81e7('0x11'),_0x21fcbf,_0x23b5ed[_0x81e7('0x10')][_0x81e7('0x12')]);return _0x407dda(_0x23b5ed[_0x81e7('0x10')][_0x81e7('0x12')]);}logger['error'](_0x81e7('0x11'),_0x21fcbf,_0x23b5ed[_0x81e7('0x10')][_0x81e7('0x12')]);return _0x344a24(_0x23b5ed[_0x81e7('0x10')][_0x81e7('0x12')]);}else{logger['info'](_0x81e7('0x11'),_0x21fcbf,_0x81e7('0xc'));_0x344a24(_0x23b5ed[_0x81e7('0x13')][_0x81e7('0x12')]);}})[_0x81e7('0x14')](function(_0x1d321e){logger[_0x81e7('0x10')](_0x81e7('0x11'),_0x21fcbf,_0x1d321e);_0x407dda(_0x1d321e);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index fc214f9..f22fe46 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 _0x952e=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','create','post','update','delete'];(function(_0x3b3390,_0x179617){var _0x2adcf0=function(_0x46d7d4){while(--_0x46d7d4){_0x3b3390['push'](_0x3b3390['shift']());}};_0x2adcf0(++_0x179617);}(_0x952e,0xd1));var _0xe952=function(_0x39ba9b,_0x3e09f3){_0x39ba9b=_0x39ba9b-0x0;var _0x236c0d=_0x952e[_0x39ba9b];return _0x236c0d;};'use strict';var multer=require(_0xe952('0x0'));var util=require('util');var path=require(_0xe952('0x1'));var timeout=require(_0xe952('0x2'));var express=require(_0xe952('0x3'));var router=express[_0xe952('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe952('0x5'));var interaction=require(_0xe952('0x6'));var config=require(_0xe952('0x7'));var controller=require(_0xe952('0x8'));router[_0xe952('0x9')]('/',auth['isAuthenticated'](),controller[_0xe952('0xa')]);router[_0xe952('0x9')](_0xe952('0xb'),auth[_0xe952('0xc')](),controller[_0xe952('0xd')]);router['get'](_0xe952('0xe'),auth[_0xe952('0xc')](),controller[_0xe952('0xf')]);router['get']('/:id/contacts',auth[_0xe952('0xc')](),controller[_0xe952('0x10')]);router['post']('/',auth[_0xe952('0xc')](),controller[_0xe952('0x11')]);router[_0xe952('0x12')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router['put']('/:id',auth[_0xe952('0xc')](),controller[_0xe952('0x13')]);router[_0xe952('0x14')](_0xe952('0xe'),auth[_0xe952('0xc')](),controller[_0xe952('0x15')]);module[_0xe952('0x16')]=router; \ No newline at end of file +var _0x2b94=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/contacts','getContacts','post','create','addContacts','put','/:id','update','delete','destroy','exports','path','express','Router'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x2b94,0xad));var _0x42b9=function(_0x55c710,_0x38e4c8){_0x55c710=_0x55c710-0x0;var _0x1bd2df=_0x2b94[_0x55c710];return _0x1bd2df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x42b9('0x0'));var timeout=require('connect-timeout');var express=require(_0x42b9('0x1'));var router=express[_0x42b9('0x2')]();var fs_extra=require(_0x42b9('0x3'));var auth=require(_0x42b9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x42b9('0x5'));var controller=require('./cmCompany.controller');router[_0x42b9('0x6')]('/',auth[_0x42b9('0x7')](),controller[_0x42b9('0x8')]);router[_0x42b9('0x6')]('/describe',auth[_0x42b9('0x7')](),controller[_0x42b9('0x9')]);router['get']('/:id',auth[_0x42b9('0x7')](),controller[_0x42b9('0xa')]);router['get'](_0x42b9('0xb'),auth[_0x42b9('0x7')](),controller[_0x42b9('0xc')]);router[_0x42b9('0xd')]('/',auth[_0x42b9('0x7')](),controller[_0x42b9('0xe')]);router['post'](_0x42b9('0xb'),auth[_0x42b9('0x7')](),controller[_0x42b9('0xf')]);router[_0x42b9('0x10')](_0x42b9('0x11'),auth[_0x42b9('0x7')](),controller[_0x42b9('0x12')]);router[_0x42b9('0x13')](_0x42b9('0x11'),auth[_0x42b9('0x7')](),controller[_0x42b9('0x14')]);module[_0x42b9('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f3b803b..95d3a52 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 _0x7e06=['INTEGER','UNSIGNED','NOW','lodash','STRING'];(function(_0x5b4f63,_0x5b09ef){var _0x42f7cb=function(_0x4b52e6){while(--_0x4b52e6){_0x5b4f63['push'](_0x5b4f63['shift']());}};_0x42f7cb(++_0x5b09ef);}(_0x7e06,0x8f));var _0x67e0=function(_0x493906,_0x39b909){_0x493906=_0x493906-0x0;var _0x51341b=_0x7e06[_0x493906];return _0x51341b;};'use strict';var _=require(_0x67e0('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0x67e0('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x67e0('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x67e0('0x1')]},'country':{'type':Sequelize[_0x67e0('0x1')]},'dateOfBirth':{'type':Sequelize[_0x67e0('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x67e0('0x1')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x67e0('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x67e0('0x1')]},'facebook':{'type':Sequelize[_0x67e0('0x1')]},'fb_data':{'type':Sequelize[_0x67e0('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x67e0('0x1')]},'teams':{'type':Sequelize[_0x67e0('0x1')]},'viber':{'type':Sequelize[_0x67e0('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x67e0('0x1')]},'telegram':{'type':Sequelize[_0x67e0('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x67e0('0x2')](0x2)[_0x67e0('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x67e0('0x4')]}}; \ No newline at end of file +var _0x6155=['lodash','sequelize','exports','STRING','TEXT','INTEGER','DATE'];(function(_0x4f8a29,_0x13a35d){var _0x2fbee9=function(_0xe45f62){while(--_0xe45f62){_0x4f8a29['push'](_0x4f8a29['shift']());}};_0x2fbee9(++_0x13a35d);}(_0x6155,0x142));var _0x5615=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x6155[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x5615('0x0'));var Sequelize=require(_0x5615('0x1'));module[_0x5615('0x2')]={'firstName':{'type':Sequelize[_0x5615('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x5615('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5615('0x3')]},'city':{'type':Sequelize[_0x5615('0x3')]},'country':{'type':Sequelize[_0x5615('0x3')]},'dateOfBirth':{'type':Sequelize[_0x5615('0x3')]},'description':{'type':Sequelize[_0x5615('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x5615('0x3')]},'fax':{'type':Sequelize[_0x5615('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x5615('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x5615('0x3')]},'skype':{'type':Sequelize[_0x5615('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x5615('0x3')]},'line':{'type':Sequelize[_0x5615('0x3')]},'wechat':{'type':Sequelize[_0x5615('0x3')]},'telegram':{'type':Sequelize[_0x5615('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x5615('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5615('0x6')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index a2a0b95..ba8d9aa 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 _0xf511=['$and','omit','findAll','table','id\x20=\x20?','phone','getTags','rawAttributes','merge','options','nolimit','setTags','ids','getHoppers','ContactId','includeAll','getHopperHistories','include','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','upload','createReadStream','path','parse','file','meta','import','binding','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','chat','sms','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','uniqueid','source','callerid','starttime','endtime','duration','note','userSecondDisposition','UserId','fullname','DESC','findAndCountAll','Website','Account','closed','closedAt','createdAt','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','subject','openchannel','externalUrl','startCase','Interaction','Owner','flatten','reverse','slice','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./cmContact.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','CmContact','length','keys','startsWith','cf_','push','findOne','trimStart','all','fieldType','type','query','model','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','select','field','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','expr','search','parseSearch','sqlOperator','conditions','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','DATE','buildExpression','isNil','Contact','ListId','c.ListId\x20IN\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.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','isEmpty','having','t.id\x20IN\x20?','resolve','user','role','agent','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','c.firstName','c.phone','c.mobile','c.createdAt','GROUP_CONCAT(DISTINCT\x20t.id)','Tags','TagIds','rows','catch','params','describe','tags','columnName','displayName','CmCustomField','alias','custom','values','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','info','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','find','color','tag'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf511,0x180));var _0x1f51=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xf511[_0x174ef5];return _0x1cc379;};'use strict';var emlformat=require(_0x1f51('0x0'));var rimraf=require(_0x1f51('0x1'));var zipdir=require(_0x1f51('0x2'));var jsonpatch=require(_0x1f51('0x3'));var rp=require(_0x1f51('0x4'));var moment=require(_0x1f51('0x5'));var BPromise=require(_0x1f51('0x6'));var Mustache=require(_0x1f51('0x7'));var util=require('util');var path=require('path');var sox=require(_0x1f51('0x8'));var csv=require(_0x1f51('0x9'));var ejs=require(_0x1f51('0xa'));var fs=require('fs');var fs_extra=require(_0x1f51('0xb'));var _=require(_0x1f51('0xc'));var squel=require(_0x1f51('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1f51('0xe'));var toCsv=require(_0x1f51('0x9'));var querystring=require(_0x1f51('0xf'));var Papa=require(_0x1f51('0x10'));var Redis=require(_0x1f51('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f51('0x12'));var logger=require(_0x1f51('0x13'))(_0x1f51('0x14'));var utils=require(_0x1f51('0x15'));var config=require(_0x1f51('0x16'));var licenseUtil=require(_0x1f51('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x1f51('0x18')],{'host':_0x1f51('0x19'),'port':0x18eb});var socket=require(_0x1f51('0x1a'))(new Redis(config[_0x1f51('0x18')]));require(_0x1f51('0x1b'))['register'](socket);function respondWithStatusCode(_0x280c11,_0x4eae48){_0x4eae48=_0x4eae48||0xcc;return function(_0x3046aa){if(_0x3046aa){return _0x280c11[_0x1f51('0x1c')](_0x4eae48);}return _0x280c11[_0x1f51('0x1d')](_0x4eae48)[_0x1f51('0x1e')]();};}function respondWithResult(_0x2ee573,_0x3f0d59){_0x3f0d59=_0x3f0d59||0xc8;return function(_0x5a4061){if(_0x5a4061){return _0x2ee573[_0x1f51('0x1d')](_0x3f0d59)[_0x1f51('0x1f')](_0x5a4061);}};}function respondWithFilteredResult(_0x225f17,_0x5f0d8e){return function(_0x50f63d){if(_0x50f63d){var _0x216f53=typeof _0x5f0d8e[_0x1f51('0x20')]===_0x1f51('0x21')&&typeof _0x5f0d8e[_0x1f51('0x22')]==='undefined';var _0x5b287e=_0x50f63d[_0x1f51('0x23')];var _0x49eff0=_0x216f53?0x0:_0x5f0d8e[_0x1f51('0x20')];var _0x1b537b=_0x216f53?_0x50f63d[_0x1f51('0x23')]:_0x5f0d8e[_0x1f51('0x20')]+_0x5f0d8e['limit'];var _0x4a3750;if(_0x1b537b>=_0x5b287e){_0x1b537b=_0x5b287e;_0x4a3750=0xc8;}else{_0x4a3750=0xce;}_0x225f17[_0x1f51('0x1d')](_0x4a3750);return _0x225f17[_0x1f51('0x24')](_0x1f51('0x25'),_0x49eff0+'-'+_0x1b537b+'/'+_0x5b287e)[_0x1f51('0x1f')](_0x50f63d);}return null;};}function patchUpdates(_0x4c8815){return function(_0x2a37b6){try{jsonpatch[_0x1f51('0x26')](_0x2a37b6,_0x4c8815,!![]);}catch(_0x21d0be){return BPromise[_0x1f51('0x27')](_0x21d0be);}return _0x2a37b6[_0x1f51('0x28')]();};}function saveUpdates(_0x5d4c01,_0x274e7c){return function(_0x544725){if(_0x544725){return _0x544725['update'](_0x5d4c01)[_0x1f51('0x29')](function(_0x391f40){return _0x391f40;});}return null;};}function removeEntity(_0x556d31,_0x287066){return function(_0x1ae395){if(_0x1ae395){return _0x1ae395[_0x1f51('0x2a')]()[_0x1f51('0x29')](function(){_0x556d31['status'](0xcc)[_0x1f51('0x1e')]();});}};}function handleEntityNotFound(_0x496dd8,_0x3a8b13){return function(_0xdb7ebe){if(!_0xdb7ebe){_0x496dd8[_0x1f51('0x1c')](0x194);}return _0xdb7ebe;};}function handleError(_0x3e073e,_0x2a3bc2){_0x2a3bc2=_0x2a3bc2||0x1f4;return function(_0x244199){logger[_0x1f51('0x2b')](_0x244199[_0x1f51('0x2c')]);if(_0x244199[_0x1f51('0x2d')]){delete _0x244199[_0x1f51('0x2d')];}_0x3e073e[_0x1f51('0x1d')](_0x2a3bc2)['send'](_0x244199);};}exports[_0x1f51('0x2e')]=function(_0x114375,_0xb3c11b){var _0x27dacc={},_0x1abb7d={},_0x62273e={'count':0x0,'rows':[]};return db[_0x1f51('0x2f')]['describe']()[_0x1f51('0x29')](function(_0x30f6d1){var _0x638a73=[];for(var _0x47a060=0x0;_0x47a0600x1){_0x558d04['or'](_0x1f51('0x67'),qs[_0x1f51('0x68')](_0x44c337),null);}else{if(qs[_0x1f51('0x69')](_0x44c337)){_0x558d04['or']('c.id\x20LIKE\x20?',_0x44c337+'%');_0x558d04['or'](_0x1f51('0x6a'),_0x44c337+'%');_0x558d04['or'](_0x1f51('0x6b'),_0x44c337+'%');_0x558d04['or'](_0x1f51('0x6c'),_0x44c337+'%');}else if(qs[_0x1f51('0x6d')](_0x44c337)){_0x558d04['or'](_0x1f51('0x6e'),_0x44c337+'%');}else{_0x558d04['or']('c.firstName\x20LIKE\x20?','%'+_0x44c337+'%');_0x558d04['or']('c.lastName\x20LIKE\x20?','%'+_0x44c337+'%');_0x558d04['or'](_0x1f51('0x6e'),'%'+_0x44c337+'%');}}}}_0x20abc0[_0x1f51('0x42')](_0x558d04);_0x20abc0[_0x1f51('0x6f')](_0x1f51('0x70'));var _0x35cb6a={'type':db[_0x1f51('0x71')][_0x1f51('0x72')][_0x1f51('0x73')],'raw':!![]};var _0x2cee78=_0x20abc0['clone']()[_0x1f51('0x46')](_0x1f51('0x70'));if(_0x27dacc[_0x1f51('0x40')]){_0x27dacc[_0x1f51('0x40')][_0x1f51('0x57')](function(_0x52e89a){_0x20abc0[_0x1f51('0x40')]('c.'+_0x52e89a[0x0],_0x52e89a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x1f51('0x74')](_0x1e797f)){_0x20abc0[_0x1f51('0x75')](_0x2af49f);_0x2cee78['where'](_0x1f51('0x76'),_0x1e797f);}BPromise[_0x1f51('0x77')]()[_0x1f51('0x29')](function(){if(!_0xd808c1)return;if(_0x114375[_0x1f51('0x78')][_0x1f51('0x79')]!==_0x1f51('0x7a'))return;if(!_['some'](_0xd808c1[_0x1f51('0x53')],['field',_0x1f51('0x5a')])){return _0x114375[_0x1f51('0x78')][_0x1f51('0x7b')]({'attributes':['id'],'raw':!![]})[_0x1f51('0x29')](function(_0x40f31a){if(_[_0x1f51('0x74')](_0x40f31a)){_0x2cee78[_0x1f51('0x42')](_0x1f51('0x7c'));_0x20abc0['where']('c.ListId\x20IS\x20NULL');}else{_0x2cee78[_0x1f51('0x42')]('c.ListId\x20IN\x20?',_[_0x1f51('0x56')](_0x40f31a,'id'));_0x20abc0[_0x1f51('0x42')](_0x1f51('0x64'),_[_0x1f51('0x56')](_0x40f31a,'id'));}});}})[_0x1f51('0x29')](function(){if(_0x114375['user'][_0x1f51('0x79')]===_0x1f51('0x7a')&&!_0xd808c1&&!_0x114375[_0x1f51('0x3a')]['ListId'])return[];return db[_0x1f51('0x7d')][_0x1f51('0x3a')](_0x2cee78[_0x1f51('0x7e')](),_0x35cb6a);})[_0x1f51('0x29')](function(_0x330831){_0x62273e[_0x1f51('0x23')]=_0x330831[_0x1f51('0x30')];if(_0x62273e[_0x1f51('0x23')]===0x0)return[];return db['sequelize'][_0x1f51('0x3a')](_0x4f54cb[_0x1f51('0x7e')](),_0x35cb6a)[_0x1f51('0x29')](function(_0x36a33f){_0x5a72de=_[_0x1f51('0x7f')](_0x36a33f,'id');_0x35cb6a=_['merge'](_0x35cb6a,{'model':db[_0x1f51('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x114375[_0x1f51('0x3a')][_0x1f51('0x3d')]){_0x27dacc[_0x1f51('0x3e')]['forEach'](function(_0x4ba77e){_0x20abc0[_0x1f51('0x46')]('c.'+_0x4ba77e);});}else{_0x20abc0['field'](_0x1f51('0x70'));_0x20abc0['field'](_0x1f51('0x80'));_0x20abc0['field']('c.lastName');_0x20abc0[_0x1f51('0x46')](_0x1f51('0x81'));_0x20abc0[_0x1f51('0x46')](_0x1f51('0x82'));_0x20abc0['field']('c.fax');_0x20abc0[_0x1f51('0x46')]('c.email');_0x20abc0[_0x1f51('0x46')]('c.ListId');_0x20abc0[_0x1f51('0x46')](_0x1f51('0x83'));_0x20abc0[_0x1f51('0x46')]('c.deletedAt');_0x20abc0[_0x1f51('0x46')]('c.CompanyId');_0x20abc0[_0x1f51('0x46')](_0x1f51('0x84'),'TagIds');}if(_0x27dacc[_0x1f51('0x22')])_0x20abc0[_0x1f51('0x22')](_0x27dacc['limit']);if(_0x27dacc['offset'])_0x20abc0[_0x1f51('0x20')](_0x27dacc[_0x1f51('0x20')]);return db[_0x1f51('0x7d')][_0x1f51('0x3a')](_0x20abc0['toString'](),_0x35cb6a);});})[_0x1f51('0x29')](function(_0x417364){_0x417364[_0x1f51('0x57')](function(_0x4ebfb7){if(_0x4ebfb7['TagIds']){_0x4ebfb7[_0x1f51('0x85')]=[];_0x4ebfb7[_0x1f51('0x86')][_0x1f51('0x55')](',')[_0x1f51('0x57')](function(_0x7feefe){_0x4ebfb7['Tags'][_0x1f51('0x34')](_0x5a72de[_0x7feefe]);});}delete _0x4ebfb7['TagIds'];});_0x62273e[_0x1f51('0x87')]=_0x417364;return _0x62273e;})[_0x1f51('0x29')](respondWithFilteredResult(_0xb3c11b,_0x27dacc));})[_0x1f51('0x88')](handleError(_0xb3c11b,null));};exports[_0x1f51('0x2a')]=function(_0x23cd06,_0x3ca667){return db[_0x1f51('0x2f')]['find']({'where':{'id':_0x23cd06[_0x1f51('0x89')]['id']}})['then'](handleEntityNotFound(_0x3ca667,null))[_0x1f51('0x29')](removeEntity(_0x3ca667,null))['catch'](handleError(_0x3ca667,null));};exports['describe']=function(_0x3994a2,_0x39f84b){return db['CmContact'][_0x1f51('0x8a')]()[_0x1f51('0x29')](function(_0x4f509d){delete _0x4f509d[_0x1f51('0x8b')];for(var _0x3b73bc=0x0;_0x3b73bc=_0x7abe5e){_0x38bb6b=_0x7abe5e;_0x399c5e=0xc8;}else{_0x399c5e=0xce;}_0x23ceca[_0xa614('0x24')](_0x399c5e);return _0x23ceca[_0xa614('0x25')](_0xa614('0x26'),_0x3fb8e3+'-'+_0x38bb6b+'/'+_0x7abe5e)['json'](_0x1bd05e);}return null;};}function patchUpdates(_0x250658){return function(_0x3b70dc){try{jsonpatch[_0xa614('0x27')](_0x3b70dc,_0x250658,!![]);}catch(_0x365450){return BPromise[_0xa614('0x28')](_0x365450);}return _0x3b70dc[_0xa614('0x29')]();};}function saveUpdates(_0x25ada6,_0x5bc01f){return function(_0x1818b1){if(_0x1818b1){return _0x1818b1['update'](_0x25ada6)['then'](function(_0x3420a8){return _0x3420a8;});}return null;};}function removeEntity(_0x29b08e,_0x4ada33){return function(_0x25ccdd){if(_0x25ccdd){return _0x25ccdd[_0xa614('0x2a')]()[_0xa614('0x2b')](function(){_0x29b08e[_0xa614('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42c459,_0x3e3d1c){return function(_0x56eb42){if(!_0x56eb42){_0x42c459[_0xa614('0x1e')](0x194);}return _0x56eb42;};}function handleError(_0xe69f8d,_0x1fc8ec){_0x1fc8ec=_0x1fc8ec||0x1f4;return function(_0x3ea20b){logger[_0xa614('0x2c')](_0x3ea20b[_0xa614('0x2d')]);if(_0x3ea20b[_0xa614('0x2e')]){delete _0x3ea20b['name'];}_0xe69f8d['status'](_0x1fc8ec)[_0xa614('0x2f')](_0x3ea20b);};}exports[_0xa614('0x30')]=function(_0x14dfec,_0x4e7e9a){var _0x2e9855={},_0x5cf8a5={},_0x38d186={'count':0x0,'rows':[]};return db[_0xa614('0x31')][_0xa614('0x32')]()[_0xa614('0x2b')](function(_0x4b90af){var _0x3d79c7=[];for(var _0x32af30=0x0;_0x32af300x1){_0x1718cd['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa614('0x6f')](_0x277c57),null);}else{if(qs[_0xa614('0x70')](_0x277c57)){_0x1718cd['or'](_0xa614('0x71'),_0x277c57+'%');_0x1718cd['or'](_0xa614('0x72'),_0x277c57+'%');_0x1718cd['or'](_0xa614('0x73'),_0x277c57+'%');_0x1718cd['or'](_0xa614('0x74'),_0x277c57+'%');}else if(qs['isEmail'](_0x277c57)){_0x1718cd['or'](_0xa614('0x75'),_0x277c57+'%');}else{_0x1718cd['or'](_0xa614('0x76'),'%'+_0x277c57+'%');_0x1718cd['or']('c.lastName\x20LIKE\x20?','%'+_0x277c57+'%');_0x1718cd['or'](_0xa614('0x75'),'%'+_0x277c57+'%');}}}}_0x1a44f9['where'](_0x1718cd);_0x1a44f9[_0xa614('0x77')](_0xa614('0x78'));var _0x305e27={'type':db[_0xa614('0x79')][_0xa614('0x7a')]['SELECT'],'raw':!![]};var _0x4bc38b=_0x1a44f9[_0xa614('0x7b')]()[_0xa614('0x46')](_0xa614('0x78'));if(_0x2e9855[_0xa614('0x41')]){_0x2e9855[_0xa614('0x41')][_0xa614('0x58')](function(_0x206c0d){_0x1a44f9[_0xa614('0x41')]('c.'+_0x206c0d[0x0],_0x206c0d[0x1]===_0xa614('0x7c')?![]:!![]);});}if(!_[_0xa614('0x67')](_0x20da67)){_0x1a44f9[_0xa614('0x7d')](_0xbc6b2b);_0x4bc38b[_0xa614('0x43')](_0xa614('0x7e'),_0x20da67);}BPromise[_0xa614('0x7f')]()['then'](function(){if(!_0x525a15)return;if(_0x14dfec[_0xa614('0x80')]['role']!=='agent')return;if(!_[_0xa614('0x81')](_0x525a15[_0xa614('0x53')],[_0xa614('0x46'),_0xa614('0x5b')])){return _0x14dfec[_0xa614('0x80')][_0xa614('0x82')]({'attributes':['id'],'raw':!![]})[_0xa614('0x2b')](function(_0x5b25c0){if(_[_0xa614('0x67')](_0x5b25c0)){_0x4bc38b[_0xa614('0x43')](_0xa614('0x83'));_0x1a44f9[_0xa614('0x43')]('c.ListId\x20IS\x20NULL');}else{_0x4bc38b['where'](_0xa614('0x69'),_[_0xa614('0x57')](_0x5b25c0,'id'));_0x1a44f9['where']('c.ListId\x20IN\x20?',_[_0xa614('0x57')](_0x5b25c0,'id'));}});}})[_0xa614('0x2b')](function(){if(_0x14dfec[_0xa614('0x80')][_0xa614('0x84')]===_0xa614('0x85')&&!_0x525a15&&!_0x14dfec[_0xa614('0x3a')][_0xa614('0x68')])return[];return db[_0xa614('0x86')][_0xa614('0x3a')](_0x4bc38b[_0xa614('0x87')](),_0x305e27);})['then'](function(_0x385ab8){_0x38d186[_0xa614('0x23')]=_0x385ab8['length'];if(_0x38d186[_0xa614('0x23')]===0x0)return[];return db['sequelize'][_0xa614('0x3a')](_0x42e5ac[_0xa614('0x87')](),_0x305e27)['then'](function(_0x4cad77){_0x399a67=_['keyBy'](_0x4cad77,'id');_0x305e27=_['merge'](_0x305e27,{'model':db[_0xa614('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14dfec['query'][_0xa614('0x3f')]){_0x2e9855[_0xa614('0x3e')][_0xa614('0x58')](function(_0x395cf0){_0x1a44f9[_0xa614('0x46')]('c.'+_0x395cf0);});}else{_0x1a44f9[_0xa614('0x46')](_0xa614('0x78'));_0x1a44f9['field']('c.firstName');_0x1a44f9[_0xa614('0x46')](_0xa614('0x88'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x89'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x8a'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x8b'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x8c'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x8d'));_0x1a44f9[_0xa614('0x46')](_0xa614('0x8e'));_0x1a44f9[_0xa614('0x46')]('c.deletedAt');_0x1a44f9[_0xa614('0x46')](_0xa614('0x8f'));_0x1a44f9['field'](_0xa614('0x90'),_0xa614('0x91'));}if(_0x2e9855[_0xa614('0x22')])_0x1a44f9['limit'](_0x2e9855['limit']);if(_0x2e9855[_0xa614('0x20')])_0x1a44f9[_0xa614('0x20')](_0x2e9855[_0xa614('0x20')]);return db['sequelize'][_0xa614('0x3a')](_0x1a44f9[_0xa614('0x87')](),_0x305e27);});})[_0xa614('0x2b')](function(_0xdd675e){_0xdd675e[_0xa614('0x58')](function(_0x4f10f7){if(_0x4f10f7[_0xa614('0x91')]){_0x4f10f7[_0xa614('0x92')]=[];_0x4f10f7[_0xa614('0x91')]['split'](',')[_0xa614('0x58')](function(_0x1042c3){_0x4f10f7[_0xa614('0x92')]['push'](_0x399a67[_0x1042c3]);});}delete _0x4f10f7[_0xa614('0x91')];});_0x38d186['rows']=_0xdd675e;return _0x38d186;})[_0xa614('0x2b')](respondWithFilteredResult(_0x4e7e9a,_0x2e9855));})[_0xa614('0x93')](handleError(_0x4e7e9a,null));};exports[_0xa614('0x2a')]=function(_0x3a446f,_0x3a3625){return db[_0xa614('0x31')]['find']({'where':{'id':_0x3a446f[_0xa614('0x94')]['id']}})[_0xa614('0x2b')](handleEntityNotFound(_0x3a3625,null))['then'](removeEntity(_0x3a3625,null))['catch'](handleError(_0x3a3625,null));};exports[_0xa614('0x32')]=function(_0x8319e4,_0x49a037){return db['CmContact']['describe']()[_0xa614('0x2b')](function(_0x45a90c){delete _0x45a90c[_0xa614('0x95')];for(var _0x4abadc=0x0;_0x4abadc{}\s\\|]/g,'-');_0x42439c(null,util[_0x5164('0x1e')]('%s-%s%s',path[_0x5164('0x1f')](_0x1a28da['originalname'],path[_0x5164('0x20')](_0x1a28da[_0x5164('0x1c')])),Date['now'](),path['extname'](_0x1a28da[_0x5164('0x1c')])));}})});router[_0x5164('0x15')](_0x5164('0x21'),upload[_0x5164('0x22')](_0x5164('0x23')),controller[_0x5164('0x24')]);var upload=multer({'storage':multer[_0x5164('0x18')]({'destination':function(_0x4166e9,_0x58101f,_0x5754b1){_0x5754b1(null,path['join'](config[_0x5164('0x1a')],'server/files/tmp'));},'filename':function(_0x576de5,_0xf2d839,_0x39a018){_0xf2d839[_0x5164('0x1c')]=_0xf2d839['originalname'][_0x5164('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x39a018(null,util['format'](_0x5164('0x25'),path['basename'](_0xf2d839[_0x5164('0x1c')],path[_0x5164('0x20')](_0xf2d839[_0x5164('0x1c')])),Date[_0x5164('0x26')](),path['extname'](_0xf2d839['originalname'])));}})});router[_0x5164('0x15')](_0x5164('0x27'),upload[_0x5164('0x22')](_0x5164('0x23')),controller['upload']);router[_0x5164('0x15')](_0x5164('0x28'),auth[_0x5164('0xa')](),controller[_0x5164('0x29')]);router[_0x5164('0x2a')](_0x5164('0x2b'),auth[_0x5164('0xa')](),controller['update']);router[_0x5164('0x2c')](_0x5164('0x2b'),auth[_0x5164('0xa')](),controller[_0x5164('0x2d')]);module[_0x5164('0x2e')]=router; \ No newline at end of file +var _0x24fe=['basename','extname','now','/csv','single','file','diskStorage','root','format','/upload','upload','/upload/:id','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','describe','/:id','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','setTags','join','server/files/tmp','originalname','replace','%s-%s%s'];(function(_0x48941d,_0x5cd819){var _0x4b5b58=function(_0x17ca95){while(--_0x17ca95){_0x48941d['push'](_0x48941d['shift']());}};_0x4b5b58(++_0x5cd819);}(_0x24fe,0xb0));var _0xe24f=function(_0x5a7d12,_0x33226f){_0x5a7d12=_0x5a7d12-0x0;var _0xb6af25=_0x24fe[_0x5a7d12];return _0xb6af25;};'use strict';var multer=require('multer');var util=require(_0xe24f('0x0'));var path=require(_0xe24f('0x1'));var timeout=require('connect-timeout');var express=require(_0xe24f('0x2'));var router=express[_0xe24f('0x3')]();var fs_extra=require(_0xe24f('0x4'));var auth=require(_0xe24f('0x5'));var interaction=require(_0xe24f('0x6'));var config=require(_0xe24f('0x7'));var controller=require(_0xe24f('0x8'));router[_0xe24f('0x9')]('/',auth[_0xe24f('0xa')](),controller[_0xe24f('0xb')]);router[_0xe24f('0x9')]('/describe',auth[_0xe24f('0xa')](),controller[_0xe24f('0xc')]);router['get'](_0xe24f('0xd'),auth[_0xe24f('0xa')](),controller['show']);router[_0xe24f('0x9')](_0xe24f('0xe'),auth[_0xe24f('0xa')](),controller[_0xe24f('0xf')]);router['get'](_0xe24f('0x10'),auth[_0xe24f('0xa')](),controller[_0xe24f('0x11')]);router[_0xe24f('0x9')](_0xe24f('0x12'),auth[_0xe24f('0xa')](),controller[_0xe24f('0x13')]);router[_0xe24f('0x9')](_0xe24f('0x14'),auth['isAuthenticated'](),controller[_0xe24f('0x15')]);router['get'](_0xe24f('0x16'),auth[_0xe24f('0xa')](),controller[_0xe24f('0x17')]);router[_0xe24f('0x9')](_0xe24f('0x18'),auth[_0xe24f('0xa')](),controller[_0xe24f('0x19')]);router[_0xe24f('0x1a')](_0xe24f('0x1b'),auth[_0xe24f('0xa')](),controller[_0xe24f('0x1c')]);router[_0xe24f('0x1a')]('/',auth[_0xe24f('0xa')](),controller[_0xe24f('0x1d')]);router[_0xe24f('0x1a')]('/create_many',auth[_0xe24f('0xa')](),controller['bulkCreate']);router[_0xe24f('0x1a')](_0xe24f('0xe'),auth[_0xe24f('0xa')](),controller[_0xe24f('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16a4b0,_0x1497b7,_0x4bb1a9){_0x4bb1a9(null,path[_0xe24f('0x1f')](config['root'],_0xe24f('0x20')));},'filename':function(_0x3c5822,_0x496904,_0x4aad2d){_0x496904[_0xe24f('0x21')]=_0x496904[_0xe24f('0x21')][_0xe24f('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4aad2d(null,util['format'](_0xe24f('0x23'),path[_0xe24f('0x24')](_0x496904['originalname'],path[_0xe24f('0x25')](_0x496904[_0xe24f('0x21')])),Date[_0xe24f('0x26')](),path[_0xe24f('0x25')](_0x496904[_0xe24f('0x21')])));}})});router[_0xe24f('0x1a')](_0xe24f('0x27'),upload[_0xe24f('0x28')](_0xe24f('0x29')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xe24f('0x2a')]({'destination':function(_0x10133c,_0x5de3bc,_0x13a551){_0x13a551(null,path[_0xe24f('0x1f')](config[_0xe24f('0x2b')],_0xe24f('0x20')));},'filename':function(_0x385ea3,_0x358855,_0x2e2908){_0x358855['originalname']=_0x358855['originalname'][_0xe24f('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2e2908(null,util[_0xe24f('0x2c')](_0xe24f('0x23'),path[_0xe24f('0x24')](_0x358855[_0xe24f('0x21')],path[_0xe24f('0x25')](_0x358855[_0xe24f('0x21')])),Date[_0xe24f('0x26')](),path['extname'](_0x358855[_0xe24f('0x21')])));}})});router[_0xe24f('0x1a')](_0xe24f('0x2d'),upload['single']('file'),controller[_0xe24f('0x2e')]);router[_0xe24f('0x1a')](_0xe24f('0x2f'),auth[_0xe24f('0xa')](),controller['import']);router[_0xe24f('0x30')]('/:id',auth['isAuthenticated'](),controller[_0xe24f('0x31')]);router[_0xe24f('0x32')](_0xe24f('0xd'),auth[_0xe24f('0xa')](),controller[_0xe24f('0x33')]);module[_0xe24f('0x34')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b5bd930..436e67a 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 _0x14d8=['sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','parse','values','isArray','BOOLEAN','ENUM','voice'];(function(_0x2064b6,_0x49272f){var _0x1ad489=function(_0x4182c1){while(--_0x4182c1){_0x2064b6['push'](_0x2064b6['shift']());}};_0x1ad489(++_0x49272f);}(_0x14d8,0x1e6));var _0x814d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x14d8[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x814d('0x0'));var _=require(_0x814d('0x1'));module[_0x814d('0x2')]={'name':{'type':Sequelize[_0x814d('0x3')],'get':function(_0x3a4a31){return this[_0x814d('0x4')](_0x814d('0x5'));}},'alias':{'type':Sequelize[_0x814d('0x6')],'allowNull':![],'set':function(_0x2c3aac){this[_0x814d('0x7')](_0x814d('0x5'),_0x2c3aac?_0x2c3aac:this[_0x814d('0x4')](_0x814d('0x8')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x814d('0x9')](_0x814d('0xa')),'get':function(){if(this[_0x814d('0x4')](_0x814d('0xb'))==='select'){return JSON[_0x814d('0xc')](this[_0x814d('0x4')]('values'));}else{return this[_0x814d('0x4')](_0x814d('0xd'));}},'set':function(_0x2d399c){if(Array[_0x814d('0xe')](_0x2d399c)){this[_0x814d('0x7')]('values',JSON['stringify'](_0x2d399c));}else{this['setDataValue'](_0x814d('0xd'),_0x2d399c);}}},'required':{'type':Sequelize[_0x814d('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x814d('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x814d('0x10')](_0x814d('0x11'))}}; \ No newline at end of file +var _0xa624=['stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','values','isArray'];(function(_0x104f8f,_0x223643){var _0x207a1f=function(_0x3c3a99){while(--_0x3c3a99){_0x104f8f['push'](_0x104f8f['shift']());}};_0x207a1f(++_0x223643);}(_0xa624,0x17a));var _0x4a62=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0xa624[_0x4c1ec2];return _0x3f6f1c;};'use strict';var Sequelize=require(_0x4a62('0x0'));var _=require(_0x4a62('0x1'));module[_0x4a62('0x2')]={'name':{'type':Sequelize[_0x4a62('0x3')],'get':function(_0xc78e6e){return this[_0x4a62('0x4')](_0x4a62('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x379aa9){this[_0x4a62('0x6')]('alias',_0x379aa9?_0x379aa9:this['getDataValue'](_0x4a62('0x7')));}},'type':{'type':Sequelize[_0x4a62('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x4a62('0x9')](_0x4a62('0xa')),'get':function(){if(this['getDataValue']('type')==='select'){return JSON['parse'](this[_0x4a62('0x4')](_0x4a62('0xb')));}else{return this[_0x4a62('0x4')](_0x4a62('0xb'));}},'set':function(_0x228ede){if(Array[_0x4a62('0xc')](_0x228ede)){this[_0x4a62('0x6')](_0x4a62('0xb'),JSON[_0x4a62('0xd')](_0x228ede));}else{this['setDataValue'](_0x4a62('0xb'),_0x228ede);}}},'required':{'type':Sequelize[_0x4a62('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4a62('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4a62('0xf')](_0x4a62('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 733e728..3864dc1 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 _0xa715=['TEXT','INTEGER','switch','BOOLEAN','defaultValue','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','count','apply','reject','update','then','end','sendStatus','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','length','includeAll','include','find','catch','body','destroy','sequelize','transaction','create','Sequelize','text'];(function(_0x263b02,_0x14e7f1){var _0x2c20ad=function(_0x3ea621){while(--_0x3ea621){_0x263b02['push'](_0x263b02['shift']());}};_0x2c20ad(++_0x14e7f1);}(_0xa715,0x1b1));var _0x5a71=function(_0x3bcef5,_0x118679){_0x3bcef5=_0x3bcef5-0x0;var _0x44e4b1=_0xa715[_0x3bcef5];return _0x44e4b1;};'use strict';var emlformat=require(_0x5a71('0x0'));var rimraf=require(_0x5a71('0x1'));var zipdir=require(_0x5a71('0x2'));var jsonpatch=require(_0x5a71('0x3'));var rp=require('request-promise');var moment=require(_0x5a71('0x4'));var BPromise=require(_0x5a71('0x5'));var Mustache=require('mustache');var util=require(_0x5a71('0x6'));var path=require(_0x5a71('0x7'));var sox=require(_0x5a71('0x8'));var csv=require(_0x5a71('0x9'));var ejs=require(_0x5a71('0xa'));var fs=require('fs');var fs_extra=require(_0x5a71('0xb'));var _=require(_0x5a71('0xc'));var squel=require(_0x5a71('0xd'));var crypto=require('crypto');var jsforce=require(_0x5a71('0xe'));var deskjs=require(_0x5a71('0xf'));var toCsv=require(_0x5a71('0x9'));var querystring=require(_0x5a71('0x10'));var Papa=require(_0x5a71('0x11'));var Redis=require('ioredis');var authService=require(_0x5a71('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a71('0x13'));var logger=require(_0x5a71('0x14'))(_0x5a71('0x15'));var utils=require(_0x5a71('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5a71('0x17'));var db=require(_0x5a71('0x18'))['db'];function respondWithStatusCode(_0x52a73f,_0x532d64){_0x532d64=_0x532d64||0xcc;return function(_0x1f36e5){if(_0x1f36e5){return _0x52a73f['sendStatus'](_0x532d64);}return _0x52a73f[_0x5a71('0x19')](_0x532d64)['end']();};}function respondWithResult(_0x132e38,_0xf5f176){_0xf5f176=_0xf5f176||0xc8;return function(_0x488fc7){if(_0x488fc7){return _0x132e38[_0x5a71('0x19')](_0xf5f176)[_0x5a71('0x1a')](_0x488fc7);}};}function respondWithFilteredResult(_0x3c540c,_0x5f6d00){return function(_0xa675e3){if(_0xa675e3){var _0x862881=typeof _0x5f6d00[_0x5a71('0x1b')]==='undefined'&&typeof _0x5f6d00[_0x5a71('0x1c')]==='undefined';var _0x1aa521=_0xa675e3['count'];var _0x3d94b2=_0x862881?0x0:_0x5f6d00[_0x5a71('0x1b')];var _0x36d602=_0x862881?_0xa675e3[_0x5a71('0x1d')]:_0x5f6d00[_0x5a71('0x1b')]+_0x5f6d00[_0x5a71('0x1c')];var _0x18abf2;if(_0x36d602>=_0x1aa521){_0x36d602=_0x1aa521;_0x18abf2=0xc8;}else{_0x18abf2=0xce;}_0x3c540c[_0x5a71('0x19')](_0x18abf2);return _0x3c540c['set']('Content-Range',_0x3d94b2+'-'+_0x36d602+'/'+_0x1aa521)[_0x5a71('0x1a')](_0xa675e3);}return null;};}function patchUpdates(_0xd5e4a6){return function(_0xa0d4){try{jsonpatch[_0x5a71('0x1e')](_0xa0d4,_0xd5e4a6,!![]);}catch(_0x4a3e36){return BPromise[_0x5a71('0x1f')](_0x4a3e36);}return _0xa0d4['save']();};}function saveUpdates(_0x1e3430,_0x18187f){return function(_0x3d2346){if(_0x3d2346){return _0x3d2346[_0x5a71('0x20')](_0x1e3430)[_0x5a71('0x21')](function(_0x116287){return _0x116287;});}return null;};}function removeEntity(_0x14ce18,_0x5b5f78){return function(_0x245a08){if(_0x245a08){return _0x245a08['destroy']()[_0x5a71('0x21')](function(){_0x14ce18['status'](0xcc)[_0x5a71('0x22')]();});}};}function handleEntityNotFound(_0x578d23,_0xe22a3f){return function(_0x1223b7){if(!_0x1223b7){_0x578d23[_0x5a71('0x23')](0x194);}return _0x1223b7;};}function handleError(_0x52cf9e,_0x25a3f7){_0x25a3f7=_0x25a3f7||0x1f4;return function(_0x4783b6){logger['error'](_0x4783b6[_0x5a71('0x24')]);if(_0x4783b6[_0x5a71('0x25')]){delete _0x4783b6[_0x5a71('0x25')];}_0x52cf9e['status'](_0x25a3f7)[_0x5a71('0x26')](_0x4783b6);};}exports[_0x5a71('0x27')]=function(_0x33139f,_0x10dbcc){var _0x9e9b22={},_0x387ac5={},_0xbff760={'count':0x0,'rows':[]};var _0x578fce=_[_0x5a71('0x28')](db[_0x5a71('0x29')][_0x5a71('0x2a')],function(_0xaa61f2){return{'name':_0xaa61f2[_0x5a71('0x2b')],'type':_0xaa61f2[_0x5a71('0x2c')][_0x5a71('0x2d')]};});_0x387ac5[_0x5a71('0x2e')]=_[_0x5a71('0x2f')](_['map'](_0x578fce,_0x5a71('0x25')),['name']);_0x387ac5['query']=_[_0x5a71('0x30')](_0x33139f[_0x5a71('0x31')]);_0x387ac5[_0x5a71('0x32')]=_['intersection'](_0x387ac5[_0x5a71('0x2e')],_0x387ac5[_0x5a71('0x31')]);_0x9e9b22['attributes']=_[_0x5a71('0x33')](_0x387ac5[_0x5a71('0x2e')],qs[_0x5a71('0x34')](_0x33139f[_0x5a71('0x31')]['fields']));_0x9e9b22[_0x5a71('0x35')]=_0x9e9b22[_0x5a71('0x35')]['length']?_0x9e9b22[_0x5a71('0x35')]:_0x387ac5[_0x5a71('0x2e')];if(!_0x33139f[_0x5a71('0x31')]['hasOwnProperty']('nolimit')){_0x9e9b22[_0x5a71('0x1c')]=qs[_0x5a71('0x1c')](_0x33139f[_0x5a71('0x31')][_0x5a71('0x1c')]);_0x9e9b22[_0x5a71('0x1b')]=qs[_0x5a71('0x1b')](_0x33139f[_0x5a71('0x31')][_0x5a71('0x1b')]);}_0x9e9b22['order']=qs[_0x5a71('0x36')](_0x33139f[_0x5a71('0x31')][_0x5a71('0x36')]);_0x9e9b22['where']=qs[_0x5a71('0x32')](_[_0x5a71('0x37')](_0x33139f[_0x5a71('0x31')],_0x387ac5[_0x5a71('0x32')]),_0x578fce);if(_0x33139f[_0x5a71('0x31')][_0x5a71('0x38')]){_0x9e9b22[_0x5a71('0x39')]=_[_0x5a71('0x3a')](_0x9e9b22[_0x5a71('0x39')],{'$or':_[_0x5a71('0x28')](_0x578fce,function(_0x4c852d){if(_0x4c852d[_0x5a71('0x2c')]!==_0x5a71('0x3b')){var _0x430a2b={};_0x430a2b[_0x4c852d[_0x5a71('0x25')]]={'$like':'%'+_0x33139f[_0x5a71('0x31')][_0x5a71('0x38')]+'%'};return _0x430a2b;}})});}_0x9e9b22=_[_0x5a71('0x3a')]({},_0x9e9b22,_0x33139f[_0x5a71('0x3c')]);var _0x1fb9a2={'where':_0x9e9b22[_0x5a71('0x39')]};return db[_0x5a71('0x29')]['count'](_0x1fb9a2)['then'](function(_0x59aa3f){_0xbff760[_0x5a71('0x1d')]=_0x59aa3f;if(_0x33139f[_0x5a71('0x31')]['includeAll']){_0x9e9b22['include']=[{'all':!![]}];}return db[_0x5a71('0x29')][_0x5a71('0x3d')](_0x9e9b22);})[_0x5a71('0x21')](function(_0x443444){_0xbff760[_0x5a71('0x3e')]=_0x443444;return _0xbff760;})['then'](respondWithFilteredResult(_0x10dbcc,_0x9e9b22))['catch'](handleError(_0x10dbcc,null));};exports[_0x5a71('0x3f')]=function(_0x5f4824,_0xf6fbd){var _0x4ffe7a={'raw':!![],'where':{'id':_0x5f4824[_0x5a71('0x40')]['id']}},_0x5d9396={};_0x5d9396[_0x5a71('0x2e')]=_[_0x5a71('0x30')](db['CmCustomField'][_0x5a71('0x2a')]);_0x5d9396[_0x5a71('0x31')]=_[_0x5a71('0x30')](_0x5f4824['query']);_0x5d9396[_0x5a71('0x32')]=_[_0x5a71('0x33')](_0x5d9396[_0x5a71('0x2e')],_0x5d9396[_0x5a71('0x31')]);_0x4ffe7a[_0x5a71('0x35')]=_[_0x5a71('0x33')](_0x5d9396[_0x5a71('0x2e')],qs[_0x5a71('0x34')](_0x5f4824[_0x5a71('0x31')][_0x5a71('0x34')]));_0x4ffe7a['attributes']=_0x4ffe7a[_0x5a71('0x35')][_0x5a71('0x41')]?_0x4ffe7a[_0x5a71('0x35')]:_0x5d9396[_0x5a71('0x2e')];if(_0x5f4824[_0x5a71('0x31')][_0x5a71('0x42')]){_0x4ffe7a[_0x5a71('0x43')]=[{'all':!![]}];}_0x4ffe7a=_['merge']({},_0x4ffe7a,_0x5f4824[_0x5a71('0x3c')]);return db[_0x5a71('0x29')][_0x5a71('0x44')](_0x4ffe7a)[_0x5a71('0x21')](handleEntityNotFound(_0xf6fbd,null))[_0x5a71('0x21')](respondWithResult(_0xf6fbd,null))[_0x5a71('0x45')](handleError(_0xf6fbd,null));};exports[_0x5a71('0x20')]=function(_0x63f91a,_0x4b9dbe){if(_0x63f91a[_0x5a71('0x46')]['id']){delete _0x63f91a[_0x5a71('0x46')]['id'];}return db[_0x5a71('0x29')][_0x5a71('0x44')]({'where':{'id':_0x63f91a[_0x5a71('0x40')]['id']}})[_0x5a71('0x21')](handleEntityNotFound(_0x4b9dbe,null))[_0x5a71('0x21')](saveUpdates(_0x63f91a[_0x5a71('0x46')],null))['then'](respondWithResult(_0x4b9dbe,null))[_0x5a71('0x45')](handleError(_0x4b9dbe,null));};exports[_0x5a71('0x47')]=function(_0x4e6339,_0x2c9d4e){return db['CmCustomField']['find']({'where':{'id':_0x4e6339[_0x5a71('0x40')]['id']}})[_0x5a71('0x21')](handleEntityNotFound(_0x2c9d4e,null))[_0x5a71('0x21')](removeEntity(_0x2c9d4e,null))[_0x5a71('0x45')](handleError(_0x2c9d4e,null));};exports['create']=function(_0xfafb64,_0x1325f6){var _0x138040;return db[_0x5a71('0x48')][_0x5a71('0x49')](function(_0x3033a2){return db[_0x5a71('0x29')][_0x5a71('0x4a')](_0xfafb64[_0x5a71('0x46')],{'transaction':_0x3033a2})['then'](function(_0x5c33b6){_0x138040=_0x5c33b6;var _0xaa228d={'type':db[_0x5a71('0x4b')]['TEXT'],'transaction':_0x3033a2};switch(_0xfafb64['body'][_0x5a71('0x2c')]){case _0x5a71('0x4c'):_0xaa228d[_0x5a71('0x2c')]=db[_0x5a71('0x4b')][_0x5a71('0x4d')];break;case'number':_0xaa228d['type']=db[_0x5a71('0x4b')][_0x5a71('0x4e')];break;case _0x5a71('0x4f'):_0xaa228d[_0x5a71('0x2c')]=db['Sequelize'][_0x5a71('0x50')];_0xaa228d[_0x5a71('0x51')]=![];break;default:}return db[_0x5a71('0x48')]['queryInterface'][_0x5a71('0x52')]('cm_contacts',util[_0x5a71('0x53')](_0x5a71('0x54'),_0x138040['id']),_0xaa228d);})[_0x5a71('0x21')](function(){return _0x138040;});})[_0x5a71('0x21')](respondWithResult(_0x1325f6,0xc9))['catch'](handleError(_0x1325f6,null));}; \ No newline at end of file +var _0xd381=['where','pick','filters','filter','merge','options','includeAll','include','rows','catch','show','params','intersection','find','body','create','sequelize','Sequelize','TEXT','type','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','set','reject','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','differenceBy','keys','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x494d34,_0x353f86){var _0x80a59c=function(_0x43b737){while(--_0x43b737){_0x494d34['push'](_0x494d34['shift']());}};_0x80a59c(++_0x353f86);}(_0xd381,0xcc));var _0x1d38=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xd381[_0x1344d6];return _0xf45b24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d38('0x0'));var zipdir=require(_0x1d38('0x1'));var jsonpatch=require(_0x1d38('0x2'));var rp=require(_0x1d38('0x3'));var moment=require(_0x1d38('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1d38('0x5'));var util=require(_0x1d38('0x6'));var path=require(_0x1d38('0x7'));var sox=require('sox');var csv=require(_0x1d38('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d38('0x9'));var _=require(_0x1d38('0xa'));var squel=require(_0x1d38('0xb'));var crypto=require(_0x1d38('0xc'));var jsforce=require(_0x1d38('0xd'));var deskjs=require(_0x1d38('0xe'));var toCsv=require(_0x1d38('0x8'));var querystring=require(_0x1d38('0xf'));var Papa=require(_0x1d38('0x10'));var Redis=require(_0x1d38('0x11'));var authService=require(_0x1d38('0x12'));var qs=require(_0x1d38('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d38('0x14'))(_0x1d38('0x15'));var utils=require(_0x1d38('0x16'));var config=require(_0x1d38('0x17'));var licenseUtil=require(_0x1d38('0x18'));var db=require(_0x1d38('0x19'))['db'];function respondWithStatusCode(_0x6539f9,_0x2545e0){_0x2545e0=_0x2545e0||0xcc;return function(_0x132e8e){if(_0x132e8e){return _0x6539f9['sendStatus'](_0x2545e0);}return _0x6539f9[_0x1d38('0x1a')](_0x2545e0)['end']();};}function respondWithResult(_0xd38e38,_0x440c55){_0x440c55=_0x440c55||0xc8;return function(_0x511ea6){if(_0x511ea6){return _0xd38e38[_0x1d38('0x1a')](_0x440c55)[_0x1d38('0x1b')](_0x511ea6);}};}function respondWithFilteredResult(_0x47a96a,_0x3cbad1){return function(_0x398a47){if(_0x398a47){var _0x2fef1a=typeof _0x3cbad1['offset']==='undefined'&&typeof _0x3cbad1[_0x1d38('0x1c')]===_0x1d38('0x1d');var _0x3f2c99=_0x398a47[_0x1d38('0x1e')];var _0x392676=_0x2fef1a?0x0:_0x3cbad1[_0x1d38('0x1f')];var _0x4058fa=_0x2fef1a?_0x398a47[_0x1d38('0x1e')]:_0x3cbad1[_0x1d38('0x1f')]+_0x3cbad1[_0x1d38('0x1c')];var _0x38da08;if(_0x4058fa>=_0x3f2c99){_0x4058fa=_0x3f2c99;_0x38da08=0xc8;}else{_0x38da08=0xce;}_0x47a96a[_0x1d38('0x1a')](_0x38da08);return _0x47a96a[_0x1d38('0x20')]('Content-Range',_0x392676+'-'+_0x4058fa+'/'+_0x3f2c99)[_0x1d38('0x1b')](_0x398a47);}return null;};}function patchUpdates(_0x187e0b){return function(_0x39fd4e){try{jsonpatch['apply'](_0x39fd4e,_0x187e0b,!![]);}catch(_0x34eae0){return BPromise[_0x1d38('0x21')](_0x34eae0);}return _0x39fd4e['save']();};}function saveUpdates(_0x47bdbf,_0x88f5ff){return function(_0x4e42d1){if(_0x4e42d1){return _0x4e42d1[_0x1d38('0x22')](_0x47bdbf)['then'](function(_0x1cc2ce){return _0x1cc2ce;});}return null;};}function removeEntity(_0x4cfc67,_0x464cbe){return function(_0x3c1a3b){if(_0x3c1a3b){return _0x3c1a3b[_0x1d38('0x23')]()[_0x1d38('0x24')](function(){_0x4cfc67['status'](0xcc)[_0x1d38('0x25')]();});}};}function handleEntityNotFound(_0xc2ccb9,_0x21e34a){return function(_0x21f839){if(!_0x21f839){_0xc2ccb9[_0x1d38('0x26')](0x194);}return _0x21f839;};}function handleError(_0x147395,_0x5e6b5d){_0x5e6b5d=_0x5e6b5d||0x1f4;return function(_0x207b7b){logger[_0x1d38('0x27')](_0x207b7b[_0x1d38('0x28')]);if(_0x207b7b['name']){delete _0x207b7b[_0x1d38('0x29')];}_0x147395['status'](_0x5e6b5d)[_0x1d38('0x2a')](_0x207b7b);};}exports[_0x1d38('0x2b')]=function(_0x207bf9,_0x1397ae){var _0x1e0f9e={},_0x4a4368={},_0x40690a={'count':0x0,'rows':[]};var _0x3fb02f=_[_0x1d38('0x2c')](db[_0x1d38('0x2d')][_0x1d38('0x2e')],function(_0x358119){return{'name':_0x358119[_0x1d38('0x2f')],'type':_0x358119['type'][_0x1d38('0x30')]};});_0x4a4368['model']=_[_0x1d38('0x31')](_['map'](_0x3fb02f,_0x1d38('0x29')),[_0x1d38('0x29')]);_0x4a4368['query']=_[_0x1d38('0x32')](_0x207bf9[_0x1d38('0x33')]);_0x4a4368['filters']=_['intersection'](_0x4a4368[_0x1d38('0x34')],_0x4a4368['query']);_0x1e0f9e[_0x1d38('0x35')]=_['intersection'](_0x4a4368['model'],qs['fields'](_0x207bf9[_0x1d38('0x33')][_0x1d38('0x36')]));_0x1e0f9e[_0x1d38('0x35')]=_0x1e0f9e['attributes'][_0x1d38('0x37')]?_0x1e0f9e['attributes']:_0x4a4368['model'];if(!_0x207bf9[_0x1d38('0x33')][_0x1d38('0x38')](_0x1d38('0x39'))){_0x1e0f9e[_0x1d38('0x1c')]=qs[_0x1d38('0x1c')](_0x207bf9[_0x1d38('0x33')]['limit']);_0x1e0f9e[_0x1d38('0x1f')]=qs[_0x1d38('0x1f')](_0x207bf9[_0x1d38('0x33')][_0x1d38('0x1f')]);}_0x1e0f9e[_0x1d38('0x3a')]=qs[_0x1d38('0x3b')](_0x207bf9[_0x1d38('0x33')][_0x1d38('0x3b')]);_0x1e0f9e[_0x1d38('0x3c')]=qs['filters'](_[_0x1d38('0x3d')](_0x207bf9['query'],_0x4a4368[_0x1d38('0x3e')]),_0x3fb02f);if(_0x207bf9[_0x1d38('0x33')]['filter']){_0x1e0f9e['where']=_['merge'](_0x1e0f9e[_0x1d38('0x3c')],{'$or':_[_0x1d38('0x2c')](_0x3fb02f,function(_0x478f13){if(_0x478f13['type']!=='VIRTUAL'){var _0x5ccae1={};_0x5ccae1[_0x478f13[_0x1d38('0x29')]]={'$like':'%'+_0x207bf9['query'][_0x1d38('0x3f')]+'%'};return _0x5ccae1;}})});}_0x1e0f9e=_[_0x1d38('0x40')]({},_0x1e0f9e,_0x207bf9[_0x1d38('0x41')]);var _0x176404={'where':_0x1e0f9e['where']};return db[_0x1d38('0x2d')][_0x1d38('0x1e')](_0x176404)[_0x1d38('0x24')](function(_0x18bc6e){_0x40690a[_0x1d38('0x1e')]=_0x18bc6e;if(_0x207bf9['query'][_0x1d38('0x42')]){_0x1e0f9e[_0x1d38('0x43')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x1e0f9e);})[_0x1d38('0x24')](function(_0x45a6be){_0x40690a[_0x1d38('0x44')]=_0x45a6be;return _0x40690a;})[_0x1d38('0x24')](respondWithFilteredResult(_0x1397ae,_0x1e0f9e))[_0x1d38('0x45')](handleError(_0x1397ae,null));};exports[_0x1d38('0x46')]=function(_0x4b780a,_0x547915){var _0x5a47f6={'raw':!![],'where':{'id':_0x4b780a[_0x1d38('0x47')]['id']}},_0x4a83b9={};_0x4a83b9[_0x1d38('0x34')]=_[_0x1d38('0x32')](db[_0x1d38('0x2d')][_0x1d38('0x2e')]);_0x4a83b9[_0x1d38('0x33')]=_[_0x1d38('0x32')](_0x4b780a[_0x1d38('0x33')]);_0x4a83b9[_0x1d38('0x3e')]=_[_0x1d38('0x48')](_0x4a83b9[_0x1d38('0x34')],_0x4a83b9[_0x1d38('0x33')]);_0x5a47f6[_0x1d38('0x35')]=_[_0x1d38('0x48')](_0x4a83b9[_0x1d38('0x34')],qs[_0x1d38('0x36')](_0x4b780a[_0x1d38('0x33')][_0x1d38('0x36')]));_0x5a47f6[_0x1d38('0x35')]=_0x5a47f6['attributes'][_0x1d38('0x37')]?_0x5a47f6[_0x1d38('0x35')]:_0x4a83b9[_0x1d38('0x34')];if(_0x4b780a['query'][_0x1d38('0x42')]){_0x5a47f6['include']=[{'all':!![]}];}_0x5a47f6=_[_0x1d38('0x40')]({},_0x5a47f6,_0x4b780a['options']);return db[_0x1d38('0x2d')][_0x1d38('0x49')](_0x5a47f6)['then'](handleEntityNotFound(_0x547915,null))[_0x1d38('0x24')](respondWithResult(_0x547915,null))['catch'](handleError(_0x547915,null));};exports[_0x1d38('0x22')]=function(_0x43748d,_0x2334d6){if(_0x43748d[_0x1d38('0x4a')]['id']){delete _0x43748d['body']['id'];}return db[_0x1d38('0x2d')][_0x1d38('0x49')]({'where':{'id':_0x43748d[_0x1d38('0x47')]['id']}})[_0x1d38('0x24')](handleEntityNotFound(_0x2334d6,null))[_0x1d38('0x24')](saveUpdates(_0x43748d['body'],null))[_0x1d38('0x24')](respondWithResult(_0x2334d6,null))[_0x1d38('0x45')](handleError(_0x2334d6,null));};exports[_0x1d38('0x23')]=function(_0x2e34ba,_0x18c41d){return db['CmCustomField'][_0x1d38('0x49')]({'where':{'id':_0x2e34ba[_0x1d38('0x47')]['id']}})[_0x1d38('0x24')](handleEntityNotFound(_0x18c41d,null))[_0x1d38('0x24')](removeEntity(_0x18c41d,null))['catch'](handleError(_0x18c41d,null));};exports[_0x1d38('0x4b')]=function(_0x44bbc1,_0xad1cd8){var _0x1f694c;return db[_0x1d38('0x4c')]['transaction'](function(_0x5c51e4){return db[_0x1d38('0x2d')]['create'](_0x44bbc1[_0x1d38('0x4a')],{'transaction':_0x5c51e4})[_0x1d38('0x24')](function(_0x4b1122){_0x1f694c=_0x4b1122;var _0x4246de={'type':db[_0x1d38('0x4d')][_0x1d38('0x4e')],'transaction':_0x5c51e4};switch(_0x44bbc1['body'][_0x1d38('0x4f')]){case _0x1d38('0x50'):_0x4246de['type']=db[_0x1d38('0x4d')][_0x1d38('0x4e')];break;case'number':_0x4246de[_0x1d38('0x4f')]=db[_0x1d38('0x4d')]['INTEGER'];break;case _0x1d38('0x51'):_0x4246de['type']=db[_0x1d38('0x4d')][_0x1d38('0x52')];_0x4246de[_0x1d38('0x53')]=![];break;default:}return db[_0x1d38('0x4c')][_0x1d38('0x54')][_0x1d38('0x55')](_0x1d38('0x56'),util[_0x1d38('0x57')]('cf_%d',_0x1f694c['id']),_0x4246de);})['then'](function(){return _0x1f694c;});})[_0x1d38('0x24')](respondWithResult(_0xad1cd8,0xc9))[_0x1d38('0x45')](handleError(_0xad1cd8,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 1bfc84a..7754a93 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 _0x44b9=['CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmCustomField.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44b9,0x141));var _0x944b=function(_0xf8d7bd,_0x233f83){_0xf8d7bd=_0xf8d7bd-0x0;var _0x2ec2e3=_0x44b9[_0xf8d7bd];return _0x2ec2e3;};'use strict';var _=require(_0x944b('0x0'));var util=require(_0x944b('0x1'));var logger=require(_0x944b('0x2'))(_0x944b('0x3'));var moment=require(_0x944b('0x4'));var BPromise=require('bluebird');var rp=require(_0x944b('0x5'));var fs=require('fs');var path=require(_0x944b('0x6'));var rimraf=require('rimraf');var config=require(_0x944b('0x7'));var attributes=require(_0x944b('0x8'));module['exports']=function(_0x579ac7,_0x49a009){return _0x579ac7['define'](_0x944b('0x9'),attributes,{'tableName':_0x944b('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd204=['define','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x590300,_0x263466){var _0x15ffdc=function(_0x412a1c){while(--_0x412a1c){_0x590300['push'](_0x590300['shift']());}};_0x15ffdc(++_0x263466);}(_0xd204,0x9c));var _0x4d20=function(_0x13464b,_0x402bf4){_0x13464b=_0x13464b-0x0;var _0xf6c8fa=_0xd204[_0x13464b];return _0xf6c8fa;};'use strict';var _=require(_0x4d20('0x0'));var util=require(_0x4d20('0x1'));var logger=require(_0x4d20('0x2'))(_0x4d20('0x3'));var moment=require(_0x4d20('0x4'));var BPromise=require(_0x4d20('0x5'));var rp=require(_0x4d20('0x6'));var fs=require('fs');var path=require(_0x4d20('0x7'));var rimraf=require(_0x4d20('0x8'));var config=require(_0x4d20('0x9'));var attributes=require(_0x4d20('0xa'));module[_0x4d20('0xb')]=function(_0x1f0942,_0x302643){return _0x1f0942[_0x4d20('0xc')]('CmCustomField',attributes,{'tableName':_0x4d20('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 430432a..31e7f63 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 _0xc36e=['http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x3e14f3,_0x4ece0b){var _0x3bc183=function(_0xa21cc){while(--_0xa21cc){_0x3e14f3['push'](_0x3e14f3['shift']());}};_0x3bc183(++_0x4ece0b);}(_0xc36e,0x15c));var _0xec36=function(_0x9c205c,_0x3a698d){_0x9c205c=_0x9c205c-0x0;var _0x58110=_0xc36e[_0x9c205c];return _0x58110;};'use strict';var _=require(_0xec36('0x0'));var util=require(_0xec36('0x1'));var moment=require(_0xec36('0x2'));var BPromise=require('bluebird');var rs=require(_0xec36('0x3'));var fs=require('fs');var Redis=require(_0xec36('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec36('0x5'));var logger=require('../../config/logger')(_0xec36('0x6'));var config=require('../../config/environment');var jayson=require(_0xec36('0x7'));var client=jayson[_0xec36('0x8')][_0xec36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x574397,_0x45f5af,_0x1d87ff){return new BPromise(function(_0x5198c5,_0x55fcf2){return client['request'](_0x574397,_0x1d87ff)[_0xec36('0xa')](function(_0x21645a){logger[_0xec36('0xb')](_0xec36('0xc'),_0x45f5af,_0xec36('0xd'));logger[_0xec36('0xe')](_0xec36('0xf'),_0x45f5af,_0xec36('0xd'),JSON[_0xec36('0x10')](_0x21645a));if(_0x21645a[_0xec36('0x11')]){if(_0x21645a[_0xec36('0x11')][_0xec36('0x12')]===0x1f4){logger['error'](_0xec36('0xc'),_0x45f5af,_0x21645a[_0xec36('0x11')][_0xec36('0x13')]);return _0x55fcf2(_0x21645a['error'][_0xec36('0x13')]);}logger['error'](_0xec36('0xc'),_0x45f5af,_0x21645a[_0xec36('0x11')][_0xec36('0x13')]);return _0x5198c5(_0x21645a[_0xec36('0x11')][_0xec36('0x13')]);}else{logger['info'](_0xec36('0xc'),_0x45f5af,_0xec36('0xd'));_0x5198c5(_0x21645a[_0xec36('0x14')][_0xec36('0x13')]);}})['catch'](function(_0x58e9d7){logger[_0xec36('0x11')]('CmCustomField,\x20%s,\x20%s',_0x45f5af,_0x58e9d7);_0x55fcf2(_0x58e9d7);});});} \ No newline at end of file +var _0x566a=['stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x101ccf,_0x470d63){var _0x58021a=function(_0x45a46d){while(--_0x45a46d){_0x101ccf['push'](_0x101ccf['shift']());}};_0x58021a(++_0x470d63);}(_0x566a,0x9f));var _0xa566=function(_0x487adb,_0x336c93){_0x487adb=_0x487adb-0x0;var _0x282753=_0x566a[_0x487adb];return _0x282753;};'use strict';var _=require(_0xa566('0x0'));var util=require('util');var moment=require(_0xa566('0x1'));var BPromise=require(_0xa566('0x2'));var rs=require(_0xa566('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa566('0x4'))['db'];var utils=require(_0xa566('0x5'));var logger=require(_0xa566('0x6'))(_0xa566('0x7'));var config=require(_0xa566('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa566('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18e355,_0x2adb69,_0x50dcf9){return new BPromise(function(_0x4ab3d6,_0x2f8733){return client[_0xa566('0xa')](_0x18e355,_0x50dcf9)[_0xa566('0xb')](function(_0x2204a3){logger[_0xa566('0xc')](_0xa566('0xd'),_0x2adb69,_0xa566('0xe'));logger[_0xa566('0xf')](_0xa566('0x10'),_0x2adb69,'request\x20sent',JSON[_0xa566('0x11')](_0x2204a3));if(_0x2204a3[_0xa566('0x12')]){if(_0x2204a3['error'][_0xa566('0x13')]===0x1f4){logger['error'](_0xa566('0xd'),_0x2adb69,_0x2204a3[_0xa566('0x12')][_0xa566('0x14')]);return _0x2f8733(_0x2204a3[_0xa566('0x12')][_0xa566('0x14')]);}logger[_0xa566('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2adb69,_0x2204a3['error']['message']);return _0x4ab3d6(_0x2204a3[_0xa566('0x12')][_0xa566('0x14')]);}else{logger[_0xa566('0xc')](_0xa566('0xd'),_0x2adb69,_0xa566('0xe'));_0x4ab3d6(_0x2204a3['result']['message']);}})[_0xa566('0x15')](function(_0x4f6ad2){logger[_0xa566('0x12')](_0xa566('0xd'),_0x2adb69,_0x4f6ad2);_0x2f8733(_0x4f6ad2);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 82227c0..5114740 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 _0x972c=['destroy','exports','path','connect-timeout','Router','fs-extra','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','put','update','delete'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x972c,0xf2));var _0xc972=function(_0x3d4cdd,_0x2c96ad){_0x3d4cdd=_0x3d4cdd-0x0;var _0x33b5d7=_0x972c[_0x3d4cdd];return _0x33b5d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc972('0x0'));var timeout=require(_0xc972('0x1'));var express=require('express');var router=express[_0xc972('0x2')]();var fs_extra=require(_0xc972('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc972('0x4'));var controller=require(_0xc972('0x5'));router[_0xc972('0x6')]('/',auth['isAuthenticated'](),controller[_0xc972('0x7')]);router['get'](_0xc972('0x8'),auth[_0xc972('0x9')](),controller[_0xc972('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc972('0xb')]('/:id',auth[_0xc972('0x9')](),controller[_0xc972('0xc')]);router[_0xc972('0xd')](_0xc972('0x8'),auth[_0xc972('0x9')](),controller[_0xc972('0xe')]);module[_0xc972('0xf')]=router; \ No newline at end of file +var _0x41fe=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','put','delete','exports'];(function(_0x120577,_0x592df5){var _0x3c5bdc=function(_0xf03a32){while(--_0xf03a32){_0x120577['push'](_0x120577['shift']());}};_0x3c5bdc(++_0x592df5);}(_0x41fe,0xd1));var _0xe41f=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x41fe[_0x5c2c7c];return _0xea7ffe;};'use strict';var multer=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var path=require(_0xe41f('0x2'));var timeout=require(_0xe41f('0x3'));var express=require(_0xe41f('0x4'));var router=express[_0xe41f('0x5')]();var fs_extra=require(_0xe41f('0x6'));var auth=require(_0xe41f('0x7'));var interaction=require(_0xe41f('0x8'));var config=require(_0xe41f('0x9'));var controller=require(_0xe41f('0xa'));router[_0xe41f('0xb')]('/',auth[_0xe41f('0xc')](),controller[_0xe41f('0xd')]);router[_0xe41f('0xb')](_0xe41f('0xe'),auth[_0xe41f('0xc')](),controller['show']);router[_0xe41f('0xf')]('/',auth[_0xe41f('0xc')](),controller['create']);router[_0xe41f('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe41f('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe41f('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 1cb369f..81e5c57 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 _0x5e41=['contactListQueue','moment','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x5e41,0xd0));var _0x15e4=function(_0x32a0f4,_0x1b6208){_0x32a0f4=_0x32a0f4-0x0;var _0x5e2f57=_0x5e41[_0x32a0f4];return _0x5e2f57;};'use strict';var moment=require(_0x15e4('0x0'));var Sequelize=require('sequelize');module[_0x15e4('0x1')]={'phone':{'type':Sequelize[_0x15e4('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x15e4('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x15e4('0x4')],'defaultValue':moment()[_0x15e4('0x5')](_0x15e4('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x15e4('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x15e4('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x15e4('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x15e4('0x4')]},'priority':{'type':Sequelize[_0x15e4('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x15e4('0x7')],'unique':_0x15e4('0x8')},'ListId':{'type':Sequelize[_0x15e4('0x7')],'unique':_0x15e4('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x15e4('0x7')],'unique':_0x15e4('0x8')},'CampaignId':{'type':Sequelize[_0x15e4('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x15e4('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x15e4('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x15e4('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c2b=['sequelize','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','moment'];(function(_0xa88f7d,_0x470fe6){var _0xb1abdb=function(_0x144c69){while(--_0x144c69){_0xa88f7d['push'](_0xa88f7d['shift']());}};_0xb1abdb(++_0x470fe6);}(_0x1c2b,0xc7));var _0xb1c2=function(_0x4f153b,_0x39818f){_0x4f153b=_0x4f153b-0x0;var _0x4e0cf8=_0x1c2b[_0x4f153b];return _0x4e0cf8;};'use strict';var moment=require(_0xb1c2('0x0'));var Sequelize=require(_0xb1c2('0x1'));module['exports']={'phone':{'type':Sequelize[_0xb1c2('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xb1c2('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xb1c2('0x4')](_0xb1c2('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb1c2('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb1c2('0x7')]},'priority':{'type':Sequelize[_0xb1c2('0x6')](0x2)[_0xb1c2('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb1c2('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb1c2('0x6')],'unique':_0xb1c2('0x9')},'ListId':{'type':Sequelize[_0xb1c2('0x6')],'unique':_0xb1c2('0x9')},'UserId':{'type':Sequelize[_0xb1c2('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xb1c2('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xb1c2('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb1c2('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index f462be0..2d1781e 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 _0x8f8f=['includeAll','include','rows','catch','show','params','options','find','create','body','update','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','calleridnum','phone','campaigntype','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','length','transaction','format','direction','prev','hopperIds','priority','ASC','scheduledAt','literal','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','List','Queue','getOpenContacts','YYYY-MM-DD\x20HH:mm:ss','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','reject','save','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$gt','$gte','$ne','$not','$in','$like','$iLike','$notILike','$overlap','$contains','$contained','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0xb011d6,_0x74d4eb){var _0x1e30f1=function(_0x5009ba){while(--_0x5009ba){_0xb011d6['push'](_0xb011d6['shift']());}};_0x1e30f1(++_0x74d4eb);}(_0x8f8f,0xd3));var _0xf8f8=function(_0x1acc1e,_0x34a777){_0x1acc1e=_0x1acc1e-0x0;var _0x2dda72=_0x8f8f[_0x1acc1e];return _0x2dda72;};'use strict';var emlformat=require(_0xf8f8('0x0'));var rimraf=require(_0xf8f8('0x1'));var zipdir=require(_0xf8f8('0x2'));var jsonpatch=require(_0xf8f8('0x3'));var rp=require(_0xf8f8('0x4'));var moment=require('moment');var BPromise=require(_0xf8f8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf8f8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf8f8('0x7'));var fs=require('fs');var fs_extra=require(_0xf8f8('0x8'));var _=require(_0xf8f8('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf8f8('0xa'));var deskjs=require(_0xf8f8('0xb'));var toCsv=require(_0xf8f8('0xc'));var querystring=require('querystring');var Papa=require(_0xf8f8('0xd'));var Redis=require('ioredis');var authService=require(_0xf8f8('0xe'));var qs=require(_0xf8f8('0xf'));var as=require(_0xf8f8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8f8('0x11'))(_0xf8f8('0x12'));var utils=require(_0xf8f8('0x13'));var config=require(_0xf8f8('0x14'));var licenseUtil=require(_0xf8f8('0x15'));var db=require(_0xf8f8('0x16'))['db'];function respondWithStatusCode(_0x4d61d9,_0x2682f0){_0x2682f0=_0x2682f0||0xcc;return function(_0x46241b){if(_0x46241b){return _0x4d61d9[_0xf8f8('0x17')](_0x2682f0);}return _0x4d61d9[_0xf8f8('0x18')](_0x2682f0)[_0xf8f8('0x19')]();};}function respondWithResult(_0x2c4d8d,_0x366676){_0x366676=_0x366676||0xc8;return function(_0x2fec20){if(_0x2fec20){return _0x2c4d8d['status'](_0x366676)['json'](_0x2fec20);}};}function respondWithFilteredResult(_0x599fd1,_0x469f07){return function(_0x3f78cb){if(_0x3f78cb){var _0x901805=typeof _0x469f07[_0xf8f8('0x1a')]===_0xf8f8('0x1b')&&typeof _0x469f07[_0xf8f8('0x1c')]===_0xf8f8('0x1b');var _0x1985f6=_0x3f78cb['count'];var _0x434cb1=_0x901805?0x0:_0x469f07['offset'];var _0x2923cd=_0x901805?_0x3f78cb[_0xf8f8('0x1d')]:_0x469f07[_0xf8f8('0x1a')]+_0x469f07['limit'];var _0x3a51e0;if(_0x2923cd>=_0x1985f6){_0x2923cd=_0x1985f6;_0x3a51e0=0xc8;}else{_0x3a51e0=0xce;}_0x599fd1[_0xf8f8('0x18')](_0x3a51e0);return _0x599fd1['set']('Content-Range',_0x434cb1+'-'+_0x2923cd+'/'+_0x1985f6)[_0xf8f8('0x1e')](_0x3f78cb);}return null;};}function patchUpdates(_0x26a285){return function(_0x1cfd3b){try{jsonpatch['apply'](_0x1cfd3b,_0x26a285,!![]);}catch(_0x47e663){return BPromise[_0xf8f8('0x1f')](_0x47e663);}return _0x1cfd3b[_0xf8f8('0x20')]();};}function saveUpdates(_0x222bae,_0x49f6bb){return function(_0x2cad31){if(_0x2cad31){return _0x2cad31['update'](_0x222bae)[_0xf8f8('0x21')](function(_0x4a32be){return _0x4a32be;});}return null;};}function removeEntity(_0x10aa26,_0x275901){return function(_0x4b4678){if(_0x4b4678){return _0x4b4678[_0xf8f8('0x22')]()[_0xf8f8('0x21')](function(){_0x10aa26[_0xf8f8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12542f,_0x585db9){return function(_0x57816a){if(!_0x57816a){_0x12542f[_0xf8f8('0x17')](0x194);}return _0x57816a;};}function handleError(_0x286b66,_0x204afc){_0x204afc=_0x204afc||0x1f4;return function(_0x597b5d){logger[_0xf8f8('0x23')](_0x597b5d[_0xf8f8('0x24')]);if(_0x597b5d[_0xf8f8('0x25')]){delete _0x597b5d[_0xf8f8('0x25')];}_0x286b66[_0xf8f8('0x18')](_0x204afc)[_0xf8f8('0x26')](_0x597b5d);};}exports[_0xf8f8('0x27')]=function(_0x2c4740,_0x48317c){var _0x1da4e3={},_0x5cc341={},_0x2bef6e={'count':0x0,'rows':[]};var _0x3a193c=_[_0xf8f8('0x28')](db[_0xf8f8('0x29')][_0xf8f8('0x2a')],function(_0x4d09c8){return{'name':_0x4d09c8[_0xf8f8('0x2b')],'type':_0x4d09c8[_0xf8f8('0x2c')]['key']};});_0x5cc341[_0xf8f8('0x2d')]=_[_0xf8f8('0x28')](_0x3a193c,_0xf8f8('0x25'));_0x5cc341[_0xf8f8('0x2e')]=_[_0xf8f8('0x2f')](_0x2c4740[_0xf8f8('0x2e')]);_0x5cc341[_0xf8f8('0x30')]=_[_0xf8f8('0x31')](_0x5cc341[_0xf8f8('0x2d')],_0x5cc341[_0xf8f8('0x2e')]);_0x5cc341[_0xf8f8('0x30')]=_[_0xf8f8('0x32')](_0x5cc341[_0xf8f8('0x30')],['$and','$or',_0xf8f8('0x33'),_0xf8f8('0x34'),'$lt','$lte',_0xf8f8('0x35'),'$eq',_0xf8f8('0x36'),'$between','$notBetween',_0xf8f8('0x37'),'$notIn',_0xf8f8('0x38'),'$notLike',_0xf8f8('0x39'),_0xf8f8('0x3a'),_0xf8f8('0x38'),_0xf8f8('0x3b'),_0xf8f8('0x3c'),_0xf8f8('0x3d'),'$any']);_0x1da4e3['attributes']=_[_0xf8f8('0x31')](_0x5cc341[_0xf8f8('0x2d')],qs['fields'](_0x2c4740[_0xf8f8('0x2e')][_0xf8f8('0x3e')]));_0x1da4e3[_0xf8f8('0x3f')]=_0x1da4e3[_0xf8f8('0x3f')]['length']?_0x1da4e3['attributes']:_0x5cc341[_0xf8f8('0x2d')];if(!_0x2c4740[_0xf8f8('0x2e')][_0xf8f8('0x40')](_0xf8f8('0x41'))){_0x1da4e3[_0xf8f8('0x1c')]=qs[_0xf8f8('0x1c')](_0x2c4740[_0xf8f8('0x2e')][_0xf8f8('0x1c')]);_0x1da4e3[_0xf8f8('0x1a')]=qs[_0xf8f8('0x1a')](_0x2c4740[_0xf8f8('0x2e')]['offset']);}_0x1da4e3[_0xf8f8('0x42')]=qs[_0xf8f8('0x43')](_0x2c4740[_0xf8f8('0x2e')]['sort']);_0x1da4e3[_0xf8f8('0x44')]=qs[_0xf8f8('0x30')](_[_0xf8f8('0x45')](_0x2c4740['query'],_0x5cc341[_0xf8f8('0x30')]),_0x3a193c);if(_0x2c4740['query'][_0xf8f8('0x46')]){_0x1da4e3[_0xf8f8('0x44')]=_[_0xf8f8('0x47')](_0x1da4e3[_0xf8f8('0x44')],{'$or':_[_0xf8f8('0x28')](_0x3a193c,function(_0x2e29e9){if(_0x2e29e9[_0xf8f8('0x2c')]!==_0xf8f8('0x48')){var _0x142dd6={};_0x142dd6[_0x2e29e9[_0xf8f8('0x25')]]={'$like':'%'+_0x2c4740[_0xf8f8('0x2e')][_0xf8f8('0x46')]+'%'};return _0x142dd6;}})});}_0x1da4e3=_[_0xf8f8('0x47')]({},_0x1da4e3,_0x2c4740['options']);var _0x60bac3={'where':_0x1da4e3[_0xf8f8('0x44')]};return db[_0xf8f8('0x29')][_0xf8f8('0x1d')](_0x60bac3)['then'](function(_0x594f58){_0x2bef6e[_0xf8f8('0x1d')]=_0x594f58;if(_0x2c4740[_0xf8f8('0x2e')][_0xf8f8('0x49')]){_0x1da4e3[_0xf8f8('0x4a')]=[{'all':!![]}];}return db[_0xf8f8('0x29')]['findAll'](_0x1da4e3);})[_0xf8f8('0x21')](function(_0x650157){_0x2bef6e[_0xf8f8('0x4b')]=_0x650157;return _0x2bef6e;})[_0xf8f8('0x21')](respondWithFilteredResult(_0x48317c,_0x1da4e3))[_0xf8f8('0x4c')](handleError(_0x48317c,null));};exports[_0xf8f8('0x4d')]=function(_0x41cab3,_0x358206){var _0x22f5c5={'raw':!![],'where':{'id':_0x41cab3[_0xf8f8('0x4e')]['id']}},_0x43210b={};_0x43210b[_0xf8f8('0x2d')]=_[_0xf8f8('0x2f')](db['CmHopper'][_0xf8f8('0x2a')]);_0x43210b[_0xf8f8('0x2e')]=_[_0xf8f8('0x2f')](_0x41cab3[_0xf8f8('0x2e')]);_0x43210b[_0xf8f8('0x30')]=_['intersection'](_0x43210b['model'],_0x43210b['query']);_0x22f5c5['attributes']=_[_0xf8f8('0x31')](_0x43210b[_0xf8f8('0x2d')],qs['fields'](_0x41cab3['query']['fields']));_0x22f5c5[_0xf8f8('0x3f')]=_0x22f5c5[_0xf8f8('0x3f')]['length']?_0x22f5c5['attributes']:_0x43210b[_0xf8f8('0x2d')];if(_0x41cab3[_0xf8f8('0x2e')][_0xf8f8('0x49')]){_0x22f5c5[_0xf8f8('0x4a')]=[{'all':!![]}];}_0x22f5c5=_[_0xf8f8('0x47')]({},_0x22f5c5,_0x41cab3[_0xf8f8('0x4f')]);return db[_0xf8f8('0x29')][_0xf8f8('0x50')](_0x22f5c5)[_0xf8f8('0x21')](handleEntityNotFound(_0x358206,null))[_0xf8f8('0x21')](respondWithResult(_0x358206,null))[_0xf8f8('0x4c')](handleError(_0x358206,null));};exports[_0xf8f8('0x51')]=function(_0x5ef316,_0x18e91e){return db[_0xf8f8('0x29')][_0xf8f8('0x51')](_0x5ef316[_0xf8f8('0x52')],{})[_0xf8f8('0x21')](respondWithResult(_0x18e91e,0xc9))[_0xf8f8('0x4c')](handleError(_0x18e91e,null));};exports[_0xf8f8('0x53')]=function(_0x4caff7,_0x11365c){if(_0x4caff7['body']['id']){delete _0x4caff7['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0x4caff7[_0xf8f8('0x4e')]['id']}})[_0xf8f8('0x21')](handleEntityNotFound(_0x11365c,null))[_0xf8f8('0x21')](saveUpdates(_0x4caff7[_0xf8f8('0x52')],null))[_0xf8f8('0x21')](respondWithResult(_0x11365c,null))[_0xf8f8('0x4c')](handleError(_0x11365c,null));};exports[_0xf8f8('0x54')]=function(_0x21bb83,_0x1158f9){return db['CmHopper'][_0xf8f8('0x54')]()['then'](respondWithResult(_0x1158f9,null))[_0xf8f8('0x4c')](handleError(_0x1158f9,null));};exports[_0xf8f8('0x22')]=function(_0x200898,_0x254dd9){var _0x1fd77f;return db[_0xf8f8('0x29')][_0xf8f8('0x50')]({'where':{'id':_0x200898[_0xf8f8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x254dd9,null))['then'](function(_0x95cc16){if(_0x95cc16){return _0x95cc16[_0xf8f8('0x22')]()[_0xf8f8('0x21')](function(_0x556d13){return _0x556d13;});}})['then'](function(_0x7b9b3b){_0x1fd77f=_0x7b9b3b;if(_0x7b9b3b){if(_0x7b9b3b[_0xf8f8('0x55')]||_0x7b9b3b['CampaignId']){return db[_0x7b9b3b[_0xf8f8('0x55')]?_0xf8f8('0x56'):_0xf8f8('0x57')][_0xf8f8('0x50')]({'where':{'id':_0x7b9b3b[_0xf8f8('0x55')]?_0x7b9b3b[_0xf8f8('0x55')]:_0x7b9b3b[_0xf8f8('0x58')]},'attributes':['id',_0xf8f8('0x25')],'raw':!![]});}}})[_0xf8f8('0x21')](function(_0x3d7191){var _0x14b09f={};if(_0x3d7191){_['merge'](_0x14b09f,_[_0xf8f8('0x59')](_0x1fd77f[_0xf8f8('0x5a')],['createdAt',_0xf8f8('0x5b'),'id']));_0x14b09f[_0xf8f8('0x5c')]=0x15;_0x14b09f[_0xf8f8('0x5d')]=_0xf8f8('0x5e');_0x14b09f[_0xf8f8('0x5f')]=_0x3d7191['name'];_0x14b09f[_0xf8f8('0x60')]=_0x200898[_0xf8f8('0x61')][_0xf8f8('0x25')];_0x14b09f[_0xf8f8('0x62')]=_0x200898[_0xf8f8('0x61')]['id'];_0x14b09f[_0xf8f8('0x5e')]=!![];_0x14b09f[_0xf8f8('0x63')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x14b09f[_0xf8f8('0x64')]=_0x1fd77f[_0xf8f8('0x65')];_0x14b09f[_0xf8f8('0x66')]=_0x1fd77f[_0xf8f8('0x55')]?'queue':'ivr';return db[_0xf8f8('0x67')][_0xf8f8('0x50')]({'where':{'id':_0x14b09f[_0xf8f8('0x68')]},'attributes':[_0xf8f8('0x69'),_0xf8f8('0x6a')]})[_0xf8f8('0x21')](function(_0x5cb160){if(!_[_0xf8f8('0x6b')](_0x254dd9)&&!_['isNil'](_0x5cb160['firstName'])){_0x14b09f['calleridname']=_0x5cb160[_0xf8f8('0x69')];if(!_['isNil'](_0x5cb160[_0xf8f8('0x6a')])){_0x14b09f[_0xf8f8('0x6c')]+='\x20'+_0x5cb160[_0xf8f8('0x6a')];}}})[_0xf8f8('0x6d')](function(){return db[_0xf8f8('0x6e')][_0xf8f8('0x51')](_0x14b09f);});}})['then'](function(){return _0x254dd9[_0xf8f8('0x18')](0xcc)[_0xf8f8('0x19')]();})['catch'](handleError(_0x254dd9,null));};exports[_0xf8f8('0x6f')]=function(_0x116926,_0xffd6f9,_0x1df528){var _0x379c1b=[];return db['CmContact'][_0xf8f8('0x54')]()[_0xf8f8('0x21')](function(_0x4b4492){_0x379c1b=_[_0xf8f8('0x2f')](_0x4b4492);return _0x116926['user'][_0xf8f8('0x70')]({'where':{'type':_0xf8f8('0x71'),'dialActive':!![],'dialMethod':_0xf8f8('0x72')},'attributes':['id',_0xf8f8('0x73')],'raw':!![]});})[_0xf8f8('0x21')](function(_0x495665){if(_0x495665&&_0x495665[_0xf8f8('0x74')]){return db['sequelize'][_0xf8f8('0x75')](function(_0xdcb819){var _0x4dc2fa={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf8f8('0x76')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x495665,'id')},'$or':[{'UserId':null},{'UserId':_0x116926[_0xf8f8('0x61')]['id']}]};var _0x2a47c9=[];if(_0x116926[_0xf8f8('0x52')][_0xf8f8('0x77')]&&_0x116926[_0xf8f8('0x52')][_0xf8f8('0x77')]===_0xf8f8('0x78')){if(!_['isEmpty'](_0x116926['body'][_0xf8f8('0x79')])){_0x4dc2fa['id']={'$in':_0x116926[_0xf8f8('0x52')][_0xf8f8('0x79')]};}_0x2a47c9=[[_0xf8f8('0x7a'),_0xf8f8('0x7b')],[_0xf8f8('0x7c'),_0x495665[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':_0xf8f8('0x7b')],db['sequelize'][_0xf8f8('0x7d')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x116926['body']['hopperIds'])){_0x4dc2fa['id']={'$notIn':_0x116926[_0xf8f8('0x52')]['hopperIds']};}_0x2a47c9=[['priority',_0xf8f8('0x7e')],['scheduledAt',_0x495665[0x0][_0xf8f8('0x73')]],db[_0xf8f8('0x7f')]['literal'](_0xf8f8('0x80')),['id',_0xf8f8('0x7b')]];}return db[_0xf8f8('0x29')]['findOne']({'attributes':['id',_0xf8f8('0x81')],'where':_0x4dc2fa,'order':_0x2a47c9,'transaction':_0xdcb819,'lock':_0xdcb819[_0xf8f8('0x82')][_0xf8f8('0x83')],'include':[{'model':db[_0xf8f8('0x67')],'as':'Contact','attributes':_0x379c1b,'include':[{'model':db[_0xf8f8('0x84')],'as':_0xf8f8('0x85'),'attributes':['id','name']}]},{'model':db[_0xf8f8('0x86')],'as':_0xf8f8('0x87'),'attributes':['id',_0xf8f8('0x25')]},{'model':db[_0xf8f8('0x56')],'as':_0xf8f8('0x88'),'attributes':['id',_0xf8f8('0x25'),'dialActive']}]})[_0xf8f8('0x21')](function(_0x4f4cad){if(_0x4f4cad){return _0x4f4cad['update']({'UserId':_0x116926['user']['id']},{'transaction':_0xdcb819});}});});}})[_0xf8f8('0x21')](handleEntityNotFound(_0xffd6f9,null))['then'](respondWithResult(_0xffd6f9,null))[_0xf8f8('0x4c')](handleError(_0xffd6f9,null));};exports[_0xf8f8('0x89')]=function(_0x4b80eb,_0x1d0136,_0x1a329a){return _0x4b80eb[_0xf8f8('0x61')][_0xf8f8('0x70')]({'where':{'type':_0xf8f8('0x71'),'dialActive':!![],'dialMethod':_0xf8f8('0x72')},'attributes':['id'],'raw':!![]})[_0xf8f8('0x21')](function(_0x4f0211){if(_0x4f0211&&_0x4f0211[_0xf8f8('0x74')]){return db[_0xf8f8('0x29')][_0xf8f8('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf8f8('0x76')](_0xf8f8('0x8a'))},'VoiceQueueId':{'$in':_[_0xf8f8('0x28')](_0x4f0211,'id')},'$or':[{'UserId':null},{'UserId':_0x4b80eb['user']['id']}]}});}return 0x0;})[_0xf8f8('0x21')](function(_0x4d94b9){if(!_[_0xf8f8('0x6b')](_0x4d94b9)&&_[_0xf8f8('0x8b')](_0x4d94b9)){return _0x1d0136['status'](0xc8)[_0xf8f8('0x1e')]({'contacts':_0x4d94b9});}else{logger[_0xf8f8('0x23')](_0xf8f8('0x8c'),'getOpenContacts',0x194,_0xf8f8('0x8d'));_0x1d0136['sendStatus'](0x194);}})[_0xf8f8('0x4c')](handleError(_0x1d0136,null));}; \ No newline at end of file +var _0x0aab=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','$and','$or','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','find','create','body','describe','params','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','statedesc','deleted','membername','user','format','calleridnum','phone','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','getOpenContacts','YYYY-MM-DD\x20HH:mm:ss','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','CmHopper'];(function(_0x483056,_0x34c5eb){var _0x13e41d=function(_0x454043){while(--_0x454043){_0x483056['push'](_0x483056['shift']());}};_0x13e41d(++_0x34c5eb);}(_0x0aab,0x179));var _0xb0aa=function(_0x54c10d,_0x2f2251){_0x54c10d=_0x54c10d-0x0;var _0x1fa703=_0x0aab[_0x54c10d];return _0x1fa703;};'use strict';var emlformat=require(_0xb0aa('0x0'));var rimraf=require(_0xb0aa('0x1'));var zipdir=require(_0xb0aa('0x2'));var jsonpatch=require(_0xb0aa('0x3'));var rp=require(_0xb0aa('0x4'));var moment=require(_0xb0aa('0x5'));var BPromise=require(_0xb0aa('0x6'));var Mustache=require(_0xb0aa('0x7'));var util=require(_0xb0aa('0x8'));var path=require(_0xb0aa('0x9'));var sox=require('sox');var csv=require(_0xb0aa('0xa'));var ejs=require(_0xb0aa('0xb'));var fs=require('fs');var fs_extra=require(_0xb0aa('0xc'));var _=require('lodash');var squel=require(_0xb0aa('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb0aa('0xe'));var Papa=require(_0xb0aa('0xf'));var Redis=require('ioredis');var authService=require(_0xb0aa('0x10'));var qs=require(_0xb0aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0aa('0x12'));var logger=require(_0xb0aa('0x13'))(_0xb0aa('0x14'));var utils=require('../../config/utils');var config=require(_0xb0aa('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0aa('0x16'))['db'];function respondWithStatusCode(_0x3e3a8f,_0x1e1c6e){_0x1e1c6e=_0x1e1c6e||0xcc;return function(_0x5115af){if(_0x5115af){return _0x3e3a8f[_0xb0aa('0x17')](_0x1e1c6e);}return _0x3e3a8f[_0xb0aa('0x18')](_0x1e1c6e)[_0xb0aa('0x19')]();};}function respondWithResult(_0x56d043,_0x289695){_0x289695=_0x289695||0xc8;return function(_0x51f987){if(_0x51f987){return _0x56d043[_0xb0aa('0x18')](_0x289695)['json'](_0x51f987);}};}function respondWithFilteredResult(_0x58ec14,_0x54ed87){return function(_0x4005cf){if(_0x4005cf){var _0x404625=typeof _0x54ed87[_0xb0aa('0x1a')]===_0xb0aa('0x1b')&&typeof _0x54ed87[_0xb0aa('0x1c')]===_0xb0aa('0x1b');var _0x186237=_0x4005cf[_0xb0aa('0x1d')];var _0x10386c=_0x404625?0x0:_0x54ed87[_0xb0aa('0x1a')];var _0x24311a=_0x404625?_0x4005cf[_0xb0aa('0x1d')]:_0x54ed87['offset']+_0x54ed87[_0xb0aa('0x1c')];var _0x454a47;if(_0x24311a>=_0x186237){_0x24311a=_0x186237;_0x454a47=0xc8;}else{_0x454a47=0xce;}_0x58ec14[_0xb0aa('0x18')](_0x454a47);return _0x58ec14[_0xb0aa('0x1e')](_0xb0aa('0x1f'),_0x10386c+'-'+_0x24311a+'/'+_0x186237)['json'](_0x4005cf);}return null;};}function patchUpdates(_0x50b8b3){return function(_0xabf20a){try{jsonpatch[_0xb0aa('0x20')](_0xabf20a,_0x50b8b3,!![]);}catch(_0x28c47e){return BPromise[_0xb0aa('0x21')](_0x28c47e);}return _0xabf20a['save']();};}function saveUpdates(_0x276b63,_0xf2b224){return function(_0x47b691){if(_0x47b691){return _0x47b691[_0xb0aa('0x22')](_0x276b63)['then'](function(_0x3ef2e6){return _0x3ef2e6;});}return null;};}function removeEntity(_0x3c85a1,_0x2223ca){return function(_0x26a316){if(_0x26a316){return _0x26a316[_0xb0aa('0x23')]()[_0xb0aa('0x24')](function(){_0x3c85a1['status'](0xcc)[_0xb0aa('0x19')]();});}};}function handleEntityNotFound(_0x1e9f0d,_0x5e522b){return function(_0xa5ba32){if(!_0xa5ba32){_0x1e9f0d[_0xb0aa('0x17')](0x194);}return _0xa5ba32;};}function handleError(_0x59d76f,_0x23aa87){_0x23aa87=_0x23aa87||0x1f4;return function(_0x431af8){logger[_0xb0aa('0x25')](_0x431af8[_0xb0aa('0x26')]);if(_0x431af8['name']){delete _0x431af8[_0xb0aa('0x27')];}_0x59d76f[_0xb0aa('0x18')](_0x23aa87)[_0xb0aa('0x28')](_0x431af8);};}exports['index']=function(_0x43623a,_0x56529c){var _0x2aa981={},_0x5457a6={},_0x60c9f={'count':0x0,'rows':[]};var _0x113c03=_[_0xb0aa('0x29')](db[_0xb0aa('0x2a')][_0xb0aa('0x2b')],function(_0x3815a3){return{'name':_0x3815a3[_0xb0aa('0x2c')],'type':_0x3815a3[_0xb0aa('0x2d')]['key']};});_0x5457a6[_0xb0aa('0x2e')]=_[_0xb0aa('0x29')](_0x113c03,_0xb0aa('0x27'));_0x5457a6[_0xb0aa('0x2f')]=_[_0xb0aa('0x30')](_0x43623a['query']);_0x5457a6[_0xb0aa('0x31')]=_[_0xb0aa('0x32')](_0x5457a6[_0xb0aa('0x2e')],_0x5457a6[_0xb0aa('0x2f')]);_0x5457a6[_0xb0aa('0x31')]=_['concat'](_0x5457a6['filters'],[_0xb0aa('0x33'),_0xb0aa('0x34'),'$gt','$gte','$lt','$lte','$ne',_0xb0aa('0x35'),'$not','$between',_0xb0aa('0x36'),_0xb0aa('0x37'),_0xb0aa('0x38'),_0xb0aa('0x39'),_0xb0aa('0x3a'),_0xb0aa('0x3b'),_0xb0aa('0x3c'),_0xb0aa('0x39'),_0xb0aa('0x3d'),_0xb0aa('0x3e'),_0xb0aa('0x3f'),_0xb0aa('0x40')]);_0x2aa981[_0xb0aa('0x41')]=_[_0xb0aa('0x32')](_0x5457a6[_0xb0aa('0x2e')],qs[_0xb0aa('0x42')](_0x43623a['query']['fields']));_0x2aa981[_0xb0aa('0x41')]=_0x2aa981[_0xb0aa('0x41')][_0xb0aa('0x43')]?_0x2aa981[_0xb0aa('0x41')]:_0x5457a6[_0xb0aa('0x2e')];if(!_0x43623a[_0xb0aa('0x2f')][_0xb0aa('0x44')](_0xb0aa('0x45'))){_0x2aa981[_0xb0aa('0x1c')]=qs[_0xb0aa('0x1c')](_0x43623a[_0xb0aa('0x2f')][_0xb0aa('0x1c')]);_0x2aa981[_0xb0aa('0x1a')]=qs[_0xb0aa('0x1a')](_0x43623a[_0xb0aa('0x2f')][_0xb0aa('0x1a')]);}_0x2aa981[_0xb0aa('0x46')]=qs[_0xb0aa('0x47')](_0x43623a['query'][_0xb0aa('0x47')]);_0x2aa981[_0xb0aa('0x48')]=qs[_0xb0aa('0x31')](_[_0xb0aa('0x49')](_0x43623a['query'],_0x5457a6[_0xb0aa('0x31')]),_0x113c03);if(_0x43623a[_0xb0aa('0x2f')]['filter']){_0x2aa981[_0xb0aa('0x48')]=_[_0xb0aa('0x4a')](_0x2aa981[_0xb0aa('0x48')],{'$or':_[_0xb0aa('0x29')](_0x113c03,function(_0x3e2fdc){if(_0x3e2fdc[_0xb0aa('0x2d')]!==_0xb0aa('0x4b')){var _0x518268={};_0x518268[_0x3e2fdc[_0xb0aa('0x27')]]={'$like':'%'+_0x43623a[_0xb0aa('0x2f')][_0xb0aa('0x4c')]+'%'};return _0x518268;}})});}_0x2aa981=_[_0xb0aa('0x4a')]({},_0x2aa981,_0x43623a[_0xb0aa('0x4d')]);var _0xd07e1b={'where':_0x2aa981['where']};return db[_0xb0aa('0x2a')]['count'](_0xd07e1b)['then'](function(_0x22c0af){_0x60c9f[_0xb0aa('0x1d')]=_0x22c0af;if(_0x43623a[_0xb0aa('0x2f')][_0xb0aa('0x4e')]){_0x2aa981[_0xb0aa('0x4f')]=[{'all':!![]}];}return db[_0xb0aa('0x2a')][_0xb0aa('0x50')](_0x2aa981);})[_0xb0aa('0x24')](function(_0x1522c4){_0x60c9f[_0xb0aa('0x51')]=_0x1522c4;return _0x60c9f;})[_0xb0aa('0x24')](respondWithFilteredResult(_0x56529c,_0x2aa981))[_0xb0aa('0x52')](handleError(_0x56529c,null));};exports['show']=function(_0x3b70e7,_0x273bf9){var _0x3e29f8={'raw':!![],'where':{'id':_0x3b70e7['params']['id']}},_0x409852={};_0x409852[_0xb0aa('0x2e')]=_[_0xb0aa('0x30')](db['CmHopper']['rawAttributes']);_0x409852[_0xb0aa('0x2f')]=_[_0xb0aa('0x30')](_0x3b70e7['query']);_0x409852[_0xb0aa('0x31')]=_[_0xb0aa('0x32')](_0x409852[_0xb0aa('0x2e')],_0x409852[_0xb0aa('0x2f')]);_0x3e29f8[_0xb0aa('0x41')]=_['intersection'](_0x409852[_0xb0aa('0x2e')],qs[_0xb0aa('0x42')](_0x3b70e7[_0xb0aa('0x2f')][_0xb0aa('0x42')]));_0x3e29f8[_0xb0aa('0x41')]=_0x3e29f8[_0xb0aa('0x41')][_0xb0aa('0x43')]?_0x3e29f8[_0xb0aa('0x41')]:_0x409852['model'];if(_0x3b70e7[_0xb0aa('0x2f')]['includeAll']){_0x3e29f8[_0xb0aa('0x4f')]=[{'all':!![]}];}_0x3e29f8=_[_0xb0aa('0x4a')]({},_0x3e29f8,_0x3b70e7[_0xb0aa('0x4d')]);return db[_0xb0aa('0x2a')][_0xb0aa('0x53')](_0x3e29f8)[_0xb0aa('0x24')](handleEntityNotFound(_0x273bf9,null))[_0xb0aa('0x24')](respondWithResult(_0x273bf9,null))[_0xb0aa('0x52')](handleError(_0x273bf9,null));};exports[_0xb0aa('0x54')]=function(_0x5176b0,_0x41f1fb){return db[_0xb0aa('0x2a')][_0xb0aa('0x54')](_0x5176b0[_0xb0aa('0x55')],{})[_0xb0aa('0x24')](respondWithResult(_0x41f1fb,0xc9))[_0xb0aa('0x52')](handleError(_0x41f1fb,null));};exports[_0xb0aa('0x22')]=function(_0x538c4d,_0x112a4e){if(_0x538c4d[_0xb0aa('0x55')]['id']){delete _0x538c4d[_0xb0aa('0x55')]['id'];}return db[_0xb0aa('0x2a')][_0xb0aa('0x53')]({'where':{'id':_0x538c4d['params']['id']}})[_0xb0aa('0x24')](handleEntityNotFound(_0x112a4e,null))[_0xb0aa('0x24')](saveUpdates(_0x538c4d[_0xb0aa('0x55')],null))['then'](respondWithResult(_0x112a4e,null))['catch'](handleError(_0x112a4e,null));};exports[_0xb0aa('0x56')]=function(_0x304b7d,_0xe6de20){return db[_0xb0aa('0x2a')][_0xb0aa('0x56')]()[_0xb0aa('0x24')](respondWithResult(_0xe6de20,null))['catch'](handleError(_0xe6de20,null));};exports[_0xb0aa('0x23')]=function(_0x503544,_0x27eea0){var _0x3ec7c4;return db[_0xb0aa('0x2a')][_0xb0aa('0x53')]({'where':{'id':_0x503544[_0xb0aa('0x57')]['id']}})[_0xb0aa('0x24')](handleEntityNotFound(_0x27eea0,null))[_0xb0aa('0x24')](function(_0x5dfddc){if(_0x5dfddc){return _0x5dfddc['destroy']()[_0xb0aa('0x24')](function(_0x30f016){return _0x30f016;});}})['then'](function(_0x5ede23){_0x3ec7c4=_0x5ede23;if(_0x5ede23){if(_0x5ede23[_0xb0aa('0x58')]||_0x5ede23[_0xb0aa('0x59')]){return db[_0x5ede23['VoiceQueueId']?_0xb0aa('0x5a'):_0xb0aa('0x5b')][_0xb0aa('0x53')]({'where':{'id':_0x5ede23[_0xb0aa('0x58')]?_0x5ede23['VoiceQueueId']:_0x5ede23['CampaignId']},'attributes':['id',_0xb0aa('0x27')],'raw':!![]});}}})[_0xb0aa('0x24')](function(_0x4caf0f){var _0x1ce18e={};if(_0x4caf0f){_[_0xb0aa('0x4a')](_0x1ce18e,_[_0xb0aa('0x5c')](_0x3ec7c4['dataValues'],['createdAt',_0xb0aa('0x5d'),'id']));_0x1ce18e['state']=0x15;_0x1ce18e[_0xb0aa('0x5e')]=_0xb0aa('0x5f');_0x1ce18e['campaign']=_0x4caf0f[_0xb0aa('0x27')];_0x1ce18e[_0xb0aa('0x60')]=_0x503544[_0xb0aa('0x61')][_0xb0aa('0x27')];_0x1ce18e['UserId']=_0x503544['user']['id'];_0x1ce18e[_0xb0aa('0x5f')]=!![];_0x1ce18e['deletedat']=moment()[_0xb0aa('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ce18e[_0xb0aa('0x63')]=_0x3ec7c4[_0xb0aa('0x64')];_0x1ce18e['campaigntype']=_0x3ec7c4[_0xb0aa('0x58')]?'queue':'ivr';return db[_0xb0aa('0x65')]['find']({'where':{'id':_0x1ce18e['ContactId']},'attributes':[_0xb0aa('0x66'),_0xb0aa('0x67')]})[_0xb0aa('0x24')](function(_0x4142fd){if(!_[_0xb0aa('0x68')](_0x27eea0)&&!_[_0xb0aa('0x68')](_0x4142fd['firstName'])){_0x1ce18e[_0xb0aa('0x69')]=_0x4142fd[_0xb0aa('0x66')];if(!_['isNil'](_0x4142fd['lastName'])){_0x1ce18e[_0xb0aa('0x69')]+='\x20'+_0x4142fd[_0xb0aa('0x67')];}}})[_0xb0aa('0x6a')](function(){return db[_0xb0aa('0x6b')][_0xb0aa('0x54')](_0x1ce18e);});}})[_0xb0aa('0x24')](function(){return _0x27eea0[_0xb0aa('0x18')](0xcc)[_0xb0aa('0x19')]();})[_0xb0aa('0x52')](handleError(_0x27eea0,null));};exports['getPreview']=function(_0x3a7d60,_0x4a155a,_0x3f1d11){var _0x1f586b=[];return db[_0xb0aa('0x65')]['describe']()['then'](function(_0x45a45c){_0x1f586b=_['keys'](_0x45a45c);return _0x3a7d60['user'][_0xb0aa('0x6c')]({'where':{'type':_0xb0aa('0x6d'),'dialActive':!![],'dialMethod':_0xb0aa('0x6e')},'attributes':['id',_0xb0aa('0x6f')],'raw':!![]});})[_0xb0aa('0x24')](function(_0x332ffc){if(_0x332ffc&&_0x332ffc[_0xb0aa('0x43')]){return db[_0xb0aa('0x70')][_0xb0aa('0x71')](function(_0x38046c){var _0x287926={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x332ffc,'id')},'$or':[{'UserId':null},{'UserId':_0x3a7d60[_0xb0aa('0x61')]['id']}]};var _0x3f18c4=[];if(_0x3a7d60[_0xb0aa('0x55')][_0xb0aa('0x72')]&&_0x3a7d60[_0xb0aa('0x55')]['direction']===_0xb0aa('0x73')){if(!_[_0xb0aa('0x74')](_0x3a7d60[_0xb0aa('0x55')][_0xb0aa('0x75')])){_0x287926['id']={'$in':_0x3a7d60['body'][_0xb0aa('0x75')]};}_0x3f18c4=[[_0xb0aa('0x76'),'ASC'],['scheduledAt',_0x332ffc[0x0][_0xb0aa('0x6f')]===_0xb0aa('0x77')?_0xb0aa('0x78'):_0xb0aa('0x77')],db[_0xb0aa('0x70')][_0xb0aa('0x79')](_0xb0aa('0x7a')),['id',_0xb0aa('0x78')]];}else{if(!_[_0xb0aa('0x74')](_0x3a7d60[_0xb0aa('0x55')][_0xb0aa('0x75')])){_0x287926['id']={'$notIn':_0x3a7d60['body']['hopperIds']};}_0x3f18c4=[[_0xb0aa('0x76'),_0xb0aa('0x78')],[_0xb0aa('0x7b'),_0x332ffc[0x0]['dialOrderByScheduledAt']],db[_0xb0aa('0x70')]['literal'](_0xb0aa('0x7c')),['id',_0xb0aa('0x77')]];}return db[_0xb0aa('0x2a')][_0xb0aa('0x7d')]({'attributes':['id',_0xb0aa('0x7e')],'where':_0x287926,'order':_0x3f18c4,'transaction':_0x38046c,'lock':_0x38046c['LOCK'][_0xb0aa('0x7f')],'include':[{'model':db[_0xb0aa('0x65')],'as':_0xb0aa('0x80'),'attributes':_0x1f586b,'include':[{'model':db[_0xb0aa('0x81')],'as':_0xb0aa('0x82'),'attributes':['id',_0xb0aa('0x27')]}]},{'model':db[_0xb0aa('0x83')],'as':_0xb0aa('0x84'),'attributes':['id',_0xb0aa('0x27')]},{'model':db[_0xb0aa('0x5a')],'as':_0xb0aa('0x85'),'attributes':['id',_0xb0aa('0x27'),'dialActive']}]})[_0xb0aa('0x24')](function(_0x4f6a0d){if(_0x4f6a0d){return _0x4f6a0d['update']({'UserId':_0x3a7d60[_0xb0aa('0x61')]['id']},{'transaction':_0x38046c});}});});}})[_0xb0aa('0x24')](handleEntityNotFound(_0x4a155a,null))['then'](respondWithResult(_0x4a155a,null))[_0xb0aa('0x52')](handleError(_0x4a155a,null));};exports[_0xb0aa('0x86')]=function(_0x54448b,_0x310712,_0x3c42c9){return _0x54448b[_0xb0aa('0x61')]['getVoiceQueues']({'where':{'type':_0xb0aa('0x6d'),'dialActive':!![],'dialMethod':_0xb0aa('0x6e')},'attributes':['id'],'raw':!![]})['then'](function(_0x3b13f0){if(_0x3b13f0&&_0x3b13f0['length']){return db[_0xb0aa('0x2a')][_0xb0aa('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xb0aa('0x87'))},'VoiceQueueId':{'$in':_[_0xb0aa('0x29')](_0x3b13f0,'id')},'$or':[{'UserId':null},{'UserId':_0x54448b[_0xb0aa('0x61')]['id']}]}});}return 0x0;})[_0xb0aa('0x24')](function(_0x57b691){if(!_[_0xb0aa('0x68')](_0x57b691)&&_[_0xb0aa('0x88')](_0x57b691)){return _0x310712['status'](0xc8)[_0xb0aa('0x89')]({'contacts':_0x57b691});}else{logger[_0xb0aa('0x25')](_0xb0aa('0x8a'),_0xb0aa('0x86'),0x194,_0xb0aa('0x8b'));_0x310712['sendStatus'](0x194);}})[_0xb0aa('0x52')](handleError(_0x310712,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index fbc3273..7a8b5f9 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 _0xfdbd=['path','rimraf','./cmHopper.attributes','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x56204f,_0x24d3b4){var _0x42b2c4=function(_0x34fcac){while(--_0x34fcac){_0x56204f['push'](_0x56204f['shift']());}};_0x42b2c4(++_0x24d3b4);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0xfdbd[_0x2ee790];return _0x5a54a5;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xdfdb('0xa'),'fields':[_0xdfdb('0xa')]},{'name':'phone','fields':[_0xdfdb('0xb')]},{'name':_0xdfdb('0xc'),'fields':[_0xdfdb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x233811,_0x1283e9){_0x233811=_0x233811-0x0;var _0x292f41=_0x687b[_0x233811];return _0x292f41;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 4f51505..86e7583 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 _0x1825=['format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','LOCK','UPDATE','GetCmHopperPreview','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetCmHopper','raw','options','where','attributes','limit','include','map','model','ShowCmHopper','find','CreateCmHopper','CmHopper','create','UpdateCmHopper','update','body','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','findAll','order','Contact','User','Agent','name','voicePause','length','UserId','push','includes','all','MoveContactManagedDialer','CountReScheduled','COUNT','\x22%s\x22'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1825,0x15c));var _0x5182=function(_0x22c48c,_0x5f426f){_0x22c48c=_0x22c48c-0x0;var _0x3b58bc=_0x1825[_0x22c48c];return _0x3b58bc;};'use strict';var _=require(_0x5182('0x0'));var util=require(_0x5182('0x1'));var moment=require('moment');var BPromise=require(_0x5182('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5182('0x3'));var db=require(_0x5182('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5182('0x5'))('rpc');var config=require(_0x5182('0x6'));var jayson=require(_0x5182('0x7'));var client=jayson[_0x5182('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x372839,_0x111b7f,_0x50fb49){return new BPromise(function(_0x576abf,_0x15c386){return client[_0x5182('0x9')](_0x372839,_0x50fb49)[_0x5182('0xa')](function(_0x28bc3b){logger[_0x5182('0xb')](_0x5182('0xc'),_0x111b7f,'request\x20sent');logger[_0x5182('0xd')](_0x5182('0xe'),_0x111b7f,_0x5182('0xf'),JSON[_0x5182('0x10')](_0x28bc3b));if(_0x28bc3b[_0x5182('0x11')]){if(_0x28bc3b['error'][_0x5182('0x12')]===0x1f4){logger[_0x5182('0x11')](_0x5182('0xc'),_0x111b7f,_0x28bc3b[_0x5182('0x11')]['message']);return _0x15c386(_0x28bc3b[_0x5182('0x11')][_0x5182('0x13')]);}logger['error'](_0x5182('0xc'),_0x111b7f,_0x28bc3b[_0x5182('0x11')][_0x5182('0x13')]);return _0x576abf(_0x28bc3b['error'][_0x5182('0x13')]);}else{logger[_0x5182('0xb')](_0x5182('0xc'),_0x111b7f,_0x5182('0xf'));_0x576abf(_0x28bc3b['result'][_0x5182('0x13')]);}})[_0x5182('0x14')](function(_0x2af352){logger['error'](_0x5182('0xc'),_0x111b7f,_0x2af352);_0x15c386(_0x2af352);});});}exports[_0x5182('0x15')]=function(_0x5c1011){var _0x103d39=this;return new Promise(function(_0x30c8f6,_0x198298){return db['CmHopper']['findAll']({'raw':_0x5c1011['options']?_0x5c1011['options'][_0x5182('0x16')]===undefined?!![]:![]:!![],'where':_0x5c1011[_0x5182('0x17')]?_0x5c1011['options'][_0x5182('0x18')]||null:null,'attributes':_0x5c1011[_0x5182('0x17')]?_0x5c1011['options'][_0x5182('0x19')]||null:null,'limit':_0x5c1011[_0x5182('0x17')]?_0x5c1011[_0x5182('0x17')][_0x5182('0x1a')]||null:null,'include':_0x5c1011[_0x5182('0x17')]?_0x5c1011[_0x5182('0x17')][_0x5182('0x1b')]?_[_0x5182('0x1c')](_0x5c1011[_0x5182('0x17')][_0x5182('0x1b')],function(_0x91cd69){return{'model':db[_0x91cd69[_0x5182('0x1d')]],'as':_0x91cd69['as'],'attributes':_0x91cd69[_0x5182('0x19')],'include':_0x91cd69['include']?_['map'](_0x91cd69[_0x5182('0x1b')],function(_0x58bfea){return{'model':db[_0x58bfea[_0x5182('0x1d')]],'as':_0x58bfea['as'],'attributes':_0x58bfea[_0x5182('0x19')],'include':_0x58bfea[_0x5182('0x1b')]?_[_0x5182('0x1c')](_0x58bfea[_0x5182('0x1b')],function(_0x2cf912){return{'model':db[_0x2cf912[_0x5182('0x1d')]],'as':_0x2cf912['as'],'attributes':_0x2cf912['attributes']};}):[]};}):[]};}):[]:[]})[_0x5182('0xa')](function(_0x1a5915){logger[_0x5182('0xb')]('GetCmHopper',_0x5c1011);logger['debug'](_0x5182('0x15'),_0x5c1011,JSON[_0x5182('0x10')](_0x1a5915));_0x30c8f6(_0x1a5915);})[_0x5182('0x14')](function(_0x31b885){logger[_0x5182('0x11')](_0x5182('0x15'),_0x31b885['message'],_0x5c1011);_0x198298(_0x103d39[_0x5182('0x11')](0x1f4,_0x31b885[_0x5182('0x13')]));});});};exports[_0x5182('0x1e')]=function(_0x5583a2){var _0xf16ce4=this;return new Promise(function(_0x1e64f6,_0x1b6c1a){return db['CmHopper'][_0x5182('0x1f')]({'raw':_0x5583a2[_0x5182('0x17')]?_0x5583a2[_0x5182('0x17')][_0x5182('0x16')]===undefined?!![]:![]:!![],'where':_0x5583a2[_0x5182('0x17')]?_0x5583a2[_0x5182('0x17')][_0x5182('0x18')]||null:null,'attributes':_0x5583a2['options']?_0x5583a2[_0x5182('0x17')][_0x5182('0x19')]||null:null,'include':_0x5583a2[_0x5182('0x17')]?_0x5583a2[_0x5182('0x17')][_0x5182('0x1b')]?_['map'](_0x5583a2[_0x5182('0x17')][_0x5182('0x1b')],function(_0x4a50ce){return{'model':db[_0x4a50ce['model']],'as':_0x4a50ce['as'],'attributes':_0x4a50ce[_0x5182('0x19')],'include':_0x4a50ce[_0x5182('0x1b')]?_[_0x5182('0x1c')](_0x4a50ce[_0x5182('0x1b')],function(_0x53bc36){return{'model':db[_0x53bc36[_0x5182('0x1d')]],'as':_0x53bc36['as'],'attributes':_0x53bc36[_0x5182('0x19')],'include':_0x53bc36[_0x5182('0x1b')]?_[_0x5182('0x1c')](_0x53bc36[_0x5182('0x1b')],function(_0x1187bd){return{'model':db[_0x1187bd['model']],'as':_0x1187bd['as'],'attributes':_0x1187bd[_0x5182('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5182('0xa')](function(_0x298982){logger[_0x5182('0xb')](_0x5182('0x1e'),_0x5583a2);logger[_0x5182('0xd')](_0x5182('0x1e'),_0x5583a2,JSON[_0x5182('0x10')](_0x298982));_0x1e64f6(_0x298982);})[_0x5182('0x14')](function(_0x52ccbb){logger['error'](_0x5182('0x1e'),_0x52ccbb[_0x5182('0x13')],_0x5583a2);_0x1b6c1a(_0xf16ce4[_0x5182('0x11')](0x1f4,_0x52ccbb['message']));});});};exports[_0x5182('0x20')]=function(_0x3e89db){var _0x52ad72=this;return new Promise(function(_0x15dc14,_0x5cf403){return db[_0x5182('0x21')][_0x5182('0x22')](_0x3e89db['body'],{'raw':_0x3e89db[_0x5182('0x17')]?_0x3e89db[_0x5182('0x17')][_0x5182('0x16')]===undefined?!![]:![]:!![]})[_0x5182('0xa')](function(_0x2f6629){logger['info'](_0x5182('0x20'),_0x3e89db);logger[_0x5182('0xd')](_0x5182('0x20'),_0x3e89db,JSON['stringify'](_0x2f6629));_0x15dc14(_0x2f6629);})[_0x5182('0x14')](function(_0x10aa51){logger[_0x5182('0x11')]('CreateCmHopper',_0x10aa51[_0x5182('0x13')],_0x3e89db);_0x5cf403(_0x52ad72[_0x5182('0x11')](0x1f4,_0x10aa51[_0x5182('0x13')]));});});};exports[_0x5182('0x23')]=function(_0x5b325b){var _0x1bae37=this;return new Promise(function(_0x51bca0,_0x1bea79){return db[_0x5182('0x21')][_0x5182('0x24')](_0x5b325b[_0x5182('0x25')],{'raw':_0x5b325b[_0x5182('0x17')]?_0x5b325b['options'][_0x5182('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b325b[_0x5182('0x17')]?_0x5b325b[_0x5182('0x17')][_0x5182('0x18')]||null:null,'attributes':_0x5b325b[_0x5182('0x17')]?_0x5b325b[_0x5182('0x17')][_0x5182('0x19')]||null:null,'limit':_0x5b325b[_0x5182('0x17')]?_0x5b325b['options'][_0x5182('0x1a')]||null:null})['then'](function(_0x210865){logger[_0x5182('0xb')](_0x5182('0x23'),_0x5b325b);logger[_0x5182('0xd')](_0x5182('0x23'),_0x5b325b,JSON[_0x5182('0x10')](_0x210865));_0x51bca0(_0x210865);})[_0x5182('0x14')](function(_0x502be7){logger[_0x5182('0x11')]('UpdateCmHopper',_0x502be7[_0x5182('0x13')],_0x5b325b);_0x1bea79(_0x1bae37[_0x5182('0x11')](0x1f4,_0x502be7[_0x5182('0x13')]));});});};exports[_0x5182('0x26')]=function(_0x511906){var _0x2aea42=this;return new Promise(function(_0xfa7411,_0x28553b){return db['CmHopper'][_0x5182('0x27')]({'where':_0x511906['options']?_0x511906[_0x5182('0x17')][_0x5182('0x18')]||null:null})['then'](function(_0x4980a4){logger[_0x5182('0xb')](_0x5182('0x26'),_0x511906);logger[_0x5182('0xd')]('DestroyCmHopper',_0x511906,JSON['stringify'](_0x4980a4));_0xfa7411(_0x4980a4);})[_0x5182('0x14')](function(_0x5286c1){logger['error'](_0x5182('0x26'),_0x5286c1[_0x5182('0x13')],_0x511906);_0x28553b(_0x2aea42[_0x5182('0x11')](0x1f4,_0x5286c1[_0x5182('0x13')]));});});};exports[_0x5182('0x28')]=function(_0x56216d){var _0x119c3b=this;return new Promise(function(_0x78bb3d,_0xa7ae63){return db[_0x5182('0x29')]['describe']()[_0x5182('0xa')](function(_0xa02973){return db[_0x5182('0x2a')][_0x5182('0x2b')](function(_0x1645c6){return db[_0x5182('0x21')][_0x5182('0x2c')]({'where':_0x56216d[_0x5182('0x17')]?_0x56216d[_0x5182('0x17')][_0x5182('0x18')]||null:null,'attributes':_0x56216d['options']?_0x56216d['options'][_0x5182('0x19')]||null:null,'limit':_0x56216d[_0x5182('0x17')]?_0x56216d[_0x5182('0x17')][_0x5182('0x1a')]||null:null,'order':_0x56216d[_0x5182('0x17')]?_0x56216d[_0x5182('0x17')][_0x5182('0x2d')]||null:null,'transaction':_0x1645c6,'lock':_0x1645c6['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x5182('0x2e'),'attributes':_['keys'](_0xa02973)},{'model':db[_0x5182('0x2f')],'as':_0x5182('0x30'),'attributes':['id',_0x5182('0x31'),_0x5182('0x32')]}]})[_0x5182('0xa')](function(_0x330ce8){var _0x597afe=[];var _0x544dcf=[];for(var _0x5e59bd=0x0;_0x5e59bd<_0x330ce8[_0x5182('0x33')];_0x5e59bd+=0x1){var _0x257df7=_0x330ce8[_0x5e59bd][_0x5182('0x34')];if(_0x257df7===null){_0x597afe[_0x5182('0x35')](_0x330ce8[_0x5e59bd][_0x5182('0x24')](_0x56216d[_0x5182('0x25')],{'transaction':_0x1645c6}));}else if(!_0x544dcf[_0x5182('0x36')](_0x257df7)){_0x544dcf[_0x5182('0x35')](_0x257df7);_0x597afe['push'](_0x330ce8[_0x5e59bd][_0x5182('0x24')](_0x56216d[_0x5182('0x25')],{'transaction':_0x1645c6}));}}return BPromise[_0x5182('0x37')](_0x597afe);});})[_0x5182('0xa')](function(_0x7a1b8f){logger[_0x5182('0xb')](_0x5182('0x28'),_0x56216d);logger[_0x5182('0xd')](_0x5182('0x28'),_0x56216d,JSON[_0x5182('0x10')](_0x7a1b8f));_0x78bb3d(_0x7a1b8f);})['catch'](function(_0x381079){logger[_0x5182('0x11')](_0x5182('0x28'),_0x381079[_0x5182('0x13')],_0x56216d);_0xa7ae63(_0x119c3b[_0x5182('0x11')](0x1f4,_0x381079[_0x5182('0x13')]));});});});};exports[_0x5182('0x38')]=function(_0x349eb8){var _0x2fe9b8=this;return new Promise(function(_0x172a5a,_0x1835ab){return db[_0x5182('0x2a')][_0x5182('0x2b')](function(_0x14021a){return db['CmHopperFinal'][_0x5182('0x22')](_0x349eb8[_0x5182('0x25')],{'raw':_0x349eb8[_0x5182('0x17')]?_0x349eb8[_0x5182('0x17')][_0x5182('0x16')]===undefined?!![]:![]:!![],'transaction':_0x14021a})['then'](function(){return db[_0x5182('0x21')][_0x5182('0x27')]({'where':_0x349eb8[_0x5182('0x17')]?_0x349eb8[_0x5182('0x17')][_0x5182('0x18')]||null:null,'transaction':_0x14021a});});})[_0x5182('0xa')](function(_0x3da9b3){logger['info']('MoveContactManagedDialer',_0x349eb8);logger['debug'](_0x5182('0x38'),_0x349eb8,JSON[_0x5182('0x10')](_0x3da9b3));_0x172a5a(_0x3da9b3);})[_0x5182('0x14')](function(_0x84249e){logger['error'](_0x5182('0x38'),_0x84249e[_0x5182('0x13')],_0x349eb8);_0x1835ab(_0x2fe9b8[_0x5182('0x11')](0x1f4,_0x84249e[_0x5182('0x13')]));});});};exports[_0x5182('0x39')]=function(_0xc80094){var _0x5139a9=this;return new Promise(function(_0x23bfa8,_0x4d4126){return db[_0x5182('0x21')][_0x5182('0x2c')]({'raw':_0xc80094[_0x5182('0x17')]?_0xc80094[_0x5182('0x17')][_0x5182('0x16')]===undefined?!![]:![]:!![],'where':_0xc80094[_0x5182('0x17')]?_0xc80094[_0x5182('0x17')]['where']||null:null,'attributes':[[db[_0x5182('0x2a')]['fn'](_0x5182('0x3a'),db[_0x5182('0x2a')]['fn']('IF',db[_0x5182('0x2a')]['literal']('`scheduledat`\x20>=\x20'+util['format'](_0x5182('0x3b'),moment()[_0x5182('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x5182('0x3d')))),_0x5182('0x3e')]]})['then'](function(_0x3253c2){logger[_0x5182('0xb')](_0x5182('0x39'),_0xc80094);logger[_0x5182('0xd')]('CountReScheduled',_0xc80094,JSON[_0x5182('0x10')](_0x3253c2));_0x23bfa8(_0x3253c2);})[_0x5182('0x14')](function(_0x3cdacb){logger[_0x5182('0x11')](_0x5182('0x39'),_0x3cdacb[_0x5182('0x13')],_0xc80094);_0x4d4126(_0x5139a9[_0x5182('0x11')](0x1f4,_0x3cdacb[_0x5182('0x13')]));});});};exports[_0x5182('0x3f')]=function(_0x115b12){var _0x25e41c=this;return new Promise(function(_0x21153c,_0x2a3112){return db[_0x5182('0x29')][_0x5182('0x40')]()[_0x5182('0xa')](function(_0x1a952b){return db[_0x5182('0x2a')][_0x5182('0x2b')](function(_0x5d2ab1){return db['CmHopper'][_0x5182('0x2c')]({'where':_0x115b12[_0x5182('0x17')]?_0x115b12[_0x5182('0x17')][_0x5182('0x18')]||null:null,'attributes':_0x115b12[_0x5182('0x17')]?_0x115b12[_0x5182('0x17')][_0x5182('0x19')]||null:null,'limit':0x1,'order':_0x115b12['options']?_0x115b12[_0x5182('0x17')]['order']||null:null,'group':db[_0x5182('0x21')][_0x5182('0x34')],'transaction':_0x5d2ab1,'lock':_0x5d2ab1[_0x5182('0x41')][_0x5182('0x42')],'include':_0x115b12[_0x5182('0x17')]?_0x115b12[_0x5182('0x17')][_0x5182('0x1b')]?_['map'](_0x115b12[_0x5182('0x17')]['include'],function(_0x53aa85){return{'model':db[_0x53aa85['model']],'as':_0x53aa85['as'],'attributes':_0x53aa85[_0x5182('0x19')],'include':_0x53aa85[_0x5182('0x1b')]?_['map'](_0x53aa85['include'],function(_0x31a78f){return{'model':db[_0x31a78f[_0x5182('0x1d')]],'as':_0x31a78f['as'],'attributes':_0x31a78f[_0x5182('0x19')],'include':_0x31a78f[_0x5182('0x1b')]?_[_0x5182('0x1c')](_0x31a78f[_0x5182('0x1b')],function(_0xe70573){return{'model':db[_0xe70573['model']],'as':_0xe70573['as'],'attributes':_0xe70573[_0x5182('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5182('0xa')](function(_0x39a8d7){var _0x26f7b2=[];for(var _0x12ece6=0x0;_0x12ece6<_0x39a8d7[_0x5182('0x33')];_0x12ece6+=0x1){_0x26f7b2[_0x5182('0x35')](_0x39a8d7[_0x12ece6][_0x5182('0x24')](_0x115b12[_0x5182('0x25')],{'transaction':_0x5d2ab1}));}return BPromise[_0x5182('0x37')](_0x26f7b2);});})[_0x5182('0xa')](function(_0x1d18b8){logger['info'](_0x5182('0x3f'),_0x115b12);logger[_0x5182('0xd')](_0x5182('0x3f'),_0x115b12,JSON[_0x5182('0x10')](_0x1d18b8));_0x21153c(_0x1d18b8);})[_0x5182('0x14')](function(_0x5e166b){logger[_0x5182('0x11')](_0x5182('0x3f'),_0x5e166b[_0x5182('0x13')],_0x115b12);_0x2a3112(_0x25e41c[_0x5182('0x11')](0x1f4,_0x5e166b['message']));});});});};exports[_0x5182('0x43')]=function(_0x5a4d21){var _0x8d65be=this;return new Promise(function(_0x5344e7,_0x106382){db[_0x5182('0x29')]['describe']()[_0x5182('0xa')](function(_0x117008){return db[_0x5182('0x21')][_0x5182('0x2c')]({'raw':_0x5a4d21[_0x5182('0x17')]?_0x5a4d21['options'][_0x5182('0x16')]===undefined?!![]:![]:!![],'where':_0x5a4d21[_0x5182('0x17')]?_0x5a4d21['options'][_0x5182('0x18')]||null:null,'attributes':_0x5a4d21['options']?_0x5a4d21[_0x5182('0x17')][_0x5182('0x19')]||null:null,'limit':_0x5a4d21[_0x5182('0x17')]?_0x5a4d21['options']['limit']||null:null,'include':_0x5a4d21['options']?_0x5a4d21['options'][_0x5182('0x1b')]?_[_0x5182('0x1c')](_0x5a4d21['options'][_0x5182('0x1b')],function(_0x3852df){return{'model':db[_0x3852df[_0x5182('0x1d')]],'as':_0x3852df['as'],'attributes':_0x3852df['as']===_0x5182('0x2e')?_['keys'](_0x117008):_0x3852df['attributes'],'include':_0x3852df[_0x5182('0x1b')]?_[_0x5182('0x1c')](_0x3852df[_0x5182('0x1b')],function(_0x228b49){return{'model':db[_0x228b49[_0x5182('0x1d')]],'as':_0x228b49['as'],'attributes':_0x228b49['attributes'],'include':_0x228b49['include']?_['map'](_0x228b49['include'],function(_0x2b7911){return{'model':db[_0x2b7911[_0x5182('0x1d')]],'as':_0x2b7911['as'],'attributes':_0x2b7911['attributes']};}):[]};}):[]};}):[]:[]})[_0x5182('0xa')](function(_0x2175d6){logger['info'](_0x5182('0x15'),_0x5a4d21);logger['debug'](_0x5182('0x15'),_0x5a4d21,JSON[_0x5182('0x10')](_0x2175d6));_0x5344e7(_0x2175d6);})[_0x5182('0x14')](function(_0x3e5ab8){logger[_0x5182('0x11')](_0x5182('0x15'),_0x3e5ab8[_0x5182('0x13')],_0x5a4d21);_0x106382(_0x8d65be[_0x5182('0x11')](0x1f4,_0x3e5ab8[_0x5182('0x13')]));});});});}; \ No newline at end of file +var _0xb125=['transaction','findAll','order','LOCK','Contact','keys','User','Agent','name','voicePause','length','UserId','includes','push','all','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','CmHopper,\x20%s,\x20%s','result','catch','GetCmHopper','CmHopper','options','raw','where','limit','include','map','model','attributes','then','debug','find','ShowCmHopper','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize'];(function(_0x3e4db1,_0x385cd6){var _0x33ecd5=function(_0x1213ad){while(--_0x1213ad){_0x3e4db1['push'](_0x3e4db1['shift']());}};_0x33ecd5(++_0x385cd6);}(_0xb125,0xf3));var _0x5b12=function(_0x282146,_0x2e01b6){_0x282146=_0x282146-0x0;var _0x1e8b80=_0xb125[_0x282146];return _0x1e8b80;};'use strict';var _=require('lodash');var util=require(_0x5b12('0x0'));var moment=require(_0x5b12('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b12('0x2'));var fs=require('fs');var Redis=require(_0x5b12('0x3'));var db=require(_0x5b12('0x4'))['db'];var utils=require(_0x5b12('0x5'));var logger=require(_0x5b12('0x6'))(_0x5b12('0x7'));var config=require('../../config/environment');var jayson=require(_0x5b12('0x8'));var client=jayson[_0x5b12('0x9')][_0x5b12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c9d5e,_0x35546e,_0xa73a56){return new BPromise(function(_0x3e9c06,_0x2b5fe6){return client[_0x5b12('0xb')](_0x1c9d5e,_0xa73a56)['then'](function(_0x1bc2e1){logger[_0x5b12('0xc')]('CmHopper,\x20%s,\x20%s',_0x35546e,_0x5b12('0xd'));logger['debug'](_0x5b12('0xe'),_0x35546e,_0x5b12('0xd'),JSON[_0x5b12('0xf')](_0x1bc2e1));if(_0x1bc2e1['error']){if(_0x1bc2e1[_0x5b12('0x10')]['code']===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x35546e,_0x1bc2e1['error']['message']);return _0x2b5fe6(_0x1bc2e1[_0x5b12('0x10')][_0x5b12('0x11')]);}logger[_0x5b12('0x10')](_0x5b12('0x12'),_0x35546e,_0x1bc2e1[_0x5b12('0x10')]['message']);return _0x3e9c06(_0x1bc2e1['error']['message']);}else{logger[_0x5b12('0xc')](_0x5b12('0x12'),_0x35546e,_0x5b12('0xd'));_0x3e9c06(_0x1bc2e1[_0x5b12('0x13')][_0x5b12('0x11')]);}})[_0x5b12('0x14')](function(_0xe3453d){logger['error'](_0x5b12('0x12'),_0x35546e,_0xe3453d);_0x2b5fe6(_0xe3453d);});});}exports[_0x5b12('0x15')]=function(_0x2cf908){var _0x8ea82c=this;return new Promise(function(_0xf486f6,_0x2b876e){return db[_0x5b12('0x16')]['findAll']({'raw':_0x2cf908[_0x5b12('0x17')]?_0x2cf908[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![],'where':_0x2cf908[_0x5b12('0x17')]?_0x2cf908[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'attributes':_0x2cf908[_0x5b12('0x17')]?_0x2cf908[_0x5b12('0x17')]['attributes']||null:null,'limit':_0x2cf908[_0x5b12('0x17')]?_0x2cf908[_0x5b12('0x17')][_0x5b12('0x1a')]||null:null,'include':_0x2cf908[_0x5b12('0x17')]?_0x2cf908[_0x5b12('0x17')][_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x2cf908[_0x5b12('0x17')][_0x5b12('0x1b')],function(_0x505d9c){return{'model':db[_0x505d9c[_0x5b12('0x1d')]],'as':_0x505d9c['as'],'attributes':_0x505d9c[_0x5b12('0x1e')],'include':_0x505d9c['include']?_['map'](_0x505d9c[_0x5b12('0x1b')],function(_0x116d84){return{'model':db[_0x116d84[_0x5b12('0x1d')]],'as':_0x116d84['as'],'attributes':_0x116d84['attributes'],'include':_0x116d84[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x116d84['include'],function(_0x55285e){return{'model':db[_0x55285e['model']],'as':_0x55285e['as'],'attributes':_0x55285e[_0x5b12('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5b12('0x1f')](function(_0x57a5d2){logger['info'](_0x5b12('0x15'),_0x2cf908);logger[_0x5b12('0x20')](_0x5b12('0x15'),_0x2cf908,JSON[_0x5b12('0xf')](_0x57a5d2));_0xf486f6(_0x57a5d2);})[_0x5b12('0x14')](function(_0x4ddbbb){logger[_0x5b12('0x10')]('GetCmHopper',_0x4ddbbb[_0x5b12('0x11')],_0x2cf908);_0x2b876e(_0x8ea82c['error'](0x1f4,_0x4ddbbb[_0x5b12('0x11')]));});});};exports['ShowCmHopper']=function(_0x166fae){var _0x3fa5ea=this;return new Promise(function(_0x5e30ef,_0x453f96){return db[_0x5b12('0x16')][_0x5b12('0x21')]({'raw':_0x166fae['options']?_0x166fae[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![],'where':_0x166fae[_0x5b12('0x17')]?_0x166fae[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'attributes':_0x166fae[_0x5b12('0x17')]?_0x166fae[_0x5b12('0x17')]['attributes']||null:null,'include':_0x166fae[_0x5b12('0x17')]?_0x166fae[_0x5b12('0x17')][_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x166fae[_0x5b12('0x17')][_0x5b12('0x1b')],function(_0xd56215){return{'model':db[_0xd56215[_0x5b12('0x1d')]],'as':_0xd56215['as'],'attributes':_0xd56215[_0x5b12('0x1e')],'include':_0xd56215[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0xd56215['include'],function(_0x3bbd85){return{'model':db[_0x3bbd85['model']],'as':_0x3bbd85['as'],'attributes':_0x3bbd85[_0x5b12('0x1e')],'include':_0x3bbd85[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x3bbd85[_0x5b12('0x1b')],function(_0x56f4c2){return{'model':db[_0x56f4c2[_0x5b12('0x1d')]],'as':_0x56f4c2['as'],'attributes':_0x56f4c2[_0x5b12('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41a307){logger[_0x5b12('0xc')](_0x5b12('0x22'),_0x166fae);logger['debug'](_0x5b12('0x22'),_0x166fae,JSON['stringify'](_0x41a307));_0x5e30ef(_0x41a307);})['catch'](function(_0x2ad7d5){logger[_0x5b12('0x10')](_0x5b12('0x22'),_0x2ad7d5['message'],_0x166fae);_0x453f96(_0x3fa5ea[_0x5b12('0x10')](0x1f4,_0x2ad7d5['message']));});});};exports['CreateCmHopper']=function(_0x1e586d){var _0x3a3f80=this;return new Promise(function(_0x52368e,_0x3e42c1){return db['CmHopper'][_0x5b12('0x23')](_0x1e586d[_0x5b12('0x24')],{'raw':_0x1e586d['options']?_0x1e586d[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![]})[_0x5b12('0x1f')](function(_0x2b057b){logger[_0x5b12('0xc')](_0x5b12('0x25'),_0x1e586d);logger[_0x5b12('0x20')](_0x5b12('0x25'),_0x1e586d,JSON['stringify'](_0x2b057b));_0x52368e(_0x2b057b);})[_0x5b12('0x14')](function(_0x37365a){logger['error'](_0x5b12('0x25'),_0x37365a['message'],_0x1e586d);_0x3e42c1(_0x3a3f80['error'](0x1f4,_0x37365a[_0x5b12('0x11')]));});});};exports['UpdateCmHopper']=function(_0x43c23b){var _0x48f0af=this;return new Promise(function(_0x5159cf,_0x17aec9){return db['CmHopper'][_0x5b12('0x26')](_0x43c23b[_0x5b12('0x24')],{'raw':_0x43c23b[_0x5b12('0x17')]?_0x43c23b['options'][_0x5b12('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c23b['options']?_0x43c23b[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'attributes':_0x43c23b[_0x5b12('0x17')]?_0x43c23b[_0x5b12('0x17')][_0x5b12('0x1e')]||null:null,'limit':_0x43c23b[_0x5b12('0x17')]?_0x43c23b[_0x5b12('0x17')][_0x5b12('0x1a')]||null:null})['then'](function(_0x5643e0){logger[_0x5b12('0xc')](_0x5b12('0x27'),_0x43c23b);logger[_0x5b12('0x20')](_0x5b12('0x27'),_0x43c23b,JSON[_0x5b12('0xf')](_0x5643e0));_0x5159cf(_0x5643e0);})[_0x5b12('0x14')](function(_0x9fc449){logger[_0x5b12('0x10')](_0x5b12('0x27'),_0x9fc449[_0x5b12('0x11')],_0x43c23b);_0x17aec9(_0x48f0af[_0x5b12('0x10')](0x1f4,_0x9fc449[_0x5b12('0x11')]));});});};exports[_0x5b12('0x28')]=function(_0x23fde9){var _0x26aaba=this;return new Promise(function(_0x1e7a9d,_0x24cad9){return db[_0x5b12('0x16')][_0x5b12('0x29')]({'where':_0x23fde9['options']?_0x23fde9[_0x5b12('0x17')][_0x5b12('0x19')]||null:null})[_0x5b12('0x1f')](function(_0xdc0782){logger['info'](_0x5b12('0x28'),_0x23fde9);logger['debug'](_0x5b12('0x28'),_0x23fde9,JSON[_0x5b12('0xf')](_0xdc0782));_0x1e7a9d(_0xdc0782);})[_0x5b12('0x14')](function(_0x42f491){logger[_0x5b12('0x10')](_0x5b12('0x28'),_0x42f491['message'],_0x23fde9);_0x24cad9(_0x26aaba[_0x5b12('0x10')](0x1f4,_0x42f491[_0x5b12('0x11')]));});});};exports[_0x5b12('0x2a')]=function(_0x1463a3){var _0x388f36=this;return new Promise(function(_0x408935,_0x3edad1){return db[_0x5b12('0x2b')]['describe']()[_0x5b12('0x1f')](function(_0x495e76){return db[_0x5b12('0x2c')][_0x5b12('0x2d')](function(_0x2ec740){return db[_0x5b12('0x16')][_0x5b12('0x2e')]({'where':_0x1463a3['options']?_0x1463a3['options'][_0x5b12('0x19')]||null:null,'attributes':_0x1463a3['options']?_0x1463a3[_0x5b12('0x17')][_0x5b12('0x1e')]||null:null,'limit':_0x1463a3[_0x5b12('0x17')]?_0x1463a3['options'][_0x5b12('0x1a')]||null:null,'order':_0x1463a3[_0x5b12('0x17')]?_0x1463a3[_0x5b12('0x17')][_0x5b12('0x2f')]||null:null,'transaction':_0x2ec740,'lock':_0x2ec740[_0x5b12('0x30')]['UPDATE'],'include':[{'model':db[_0x5b12('0x2b')],'as':_0x5b12('0x31'),'attributes':_[_0x5b12('0x32')](_0x495e76)},{'model':db[_0x5b12('0x33')],'as':_0x5b12('0x34'),'attributes':['id',_0x5b12('0x35'),_0x5b12('0x36')]}]})[_0x5b12('0x1f')](function(_0x50b42e){var _0xc72342=[];var _0x12446e=[];for(var _0xb9520e=0x0;_0xb9520e<_0x50b42e[_0x5b12('0x37')];_0xb9520e+=0x1){var _0xbcc37a=_0x50b42e[_0xb9520e][_0x5b12('0x38')];if(_0xbcc37a===null){_0xc72342['push'](_0x50b42e[_0xb9520e][_0x5b12('0x26')](_0x1463a3[_0x5b12('0x24')],{'transaction':_0x2ec740}));}else if(!_0x12446e[_0x5b12('0x39')](_0xbcc37a)){_0x12446e[_0x5b12('0x3a')](_0xbcc37a);_0xc72342[_0x5b12('0x3a')](_0x50b42e[_0xb9520e][_0x5b12('0x26')](_0x1463a3[_0x5b12('0x24')],{'transaction':_0x2ec740}));}}return BPromise[_0x5b12('0x3b')](_0xc72342);});})[_0x5b12('0x1f')](function(_0xb4c4b9){logger[_0x5b12('0xc')](_0x5b12('0x2a'),_0x1463a3);logger[_0x5b12('0x20')]('GetContactDialer',_0x1463a3,JSON[_0x5b12('0xf')](_0xb4c4b9));_0x408935(_0xb4c4b9);})[_0x5b12('0x14')](function(_0x45a9cf){logger[_0x5b12('0x10')](_0x5b12('0x2a'),_0x45a9cf[_0x5b12('0x11')],_0x1463a3);_0x3edad1(_0x388f36[_0x5b12('0x10')](0x1f4,_0x45a9cf[_0x5b12('0x11')]));});});});};exports[_0x5b12('0x3c')]=function(_0x171ace){var _0x469fce=this;return new Promise(function(_0x4adfcf,_0x6e4022){return db[_0x5b12('0x2c')]['transaction'](function(_0x55f018){return db['CmHopperFinal'][_0x5b12('0x23')](_0x171ace[_0x5b12('0x24')],{'raw':_0x171ace['options']?_0x171ace[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![],'transaction':_0x55f018})[_0x5b12('0x1f')](function(){return db[_0x5b12('0x16')][_0x5b12('0x29')]({'where':_0x171ace[_0x5b12('0x17')]?_0x171ace[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'transaction':_0x55f018});});})[_0x5b12('0x1f')](function(_0x2ee5d1){logger[_0x5b12('0xc')]('MoveContactManagedDialer',_0x171ace);logger[_0x5b12('0x20')](_0x5b12('0x3c'),_0x171ace,JSON[_0x5b12('0xf')](_0x2ee5d1));_0x4adfcf(_0x2ee5d1);})['catch'](function(_0x35e154){logger[_0x5b12('0x10')]('MoveContactManagedDialer',_0x35e154[_0x5b12('0x11')],_0x171ace);_0x6e4022(_0x469fce[_0x5b12('0x10')](0x1f4,_0x35e154[_0x5b12('0x11')]));});});};exports['CountReScheduled']=function(_0x45ffd7){var _0x4c58b1=this;return new Promise(function(_0x34f17e,_0x4aca60){return db[_0x5b12('0x16')][_0x5b12('0x2e')]({'raw':_0x45ffd7[_0x5b12('0x17')]?_0x45ffd7[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![],'where':_0x45ffd7['options']?_0x45ffd7[_0x5b12('0x17')]['where']||null:null,'attributes':[[db[_0x5b12('0x2c')]['fn'](_0x5b12('0x3d'),db[_0x5b12('0x2c')]['fn']('IF',db[_0x5b12('0x2c')][_0x5b12('0x3e')](_0x5b12('0x3f')+util[_0x5b12('0x40')]('\x22%s\x22',moment()[_0x5b12('0x40')](_0x5b12('0x41')))+_0x5b12('0x42')))),_0x5b12('0x43')]]})['then'](function(_0x1afe96){logger[_0x5b12('0xc')](_0x5b12('0x44'),_0x45ffd7);logger[_0x5b12('0x20')](_0x5b12('0x44'),_0x45ffd7,JSON[_0x5b12('0xf')](_0x1afe96));_0x34f17e(_0x1afe96);})['catch'](function(_0x2ab9c5){logger[_0x5b12('0x10')]('CountReScheduled',_0x2ab9c5[_0x5b12('0x11')],_0x45ffd7);_0x4aca60(_0x4c58b1[_0x5b12('0x10')](0x1f4,_0x2ab9c5[_0x5b12('0x11')]));});});};exports[_0x5b12('0x45')]=function(_0x4ff719){var _0x24c3fe=this;return new Promise(function(_0x436c41,_0x2eeb34){return db[_0x5b12('0x2b')]['describe']()[_0x5b12('0x1f')](function(_0x27467f){return db[_0x5b12('0x2c')][_0x5b12('0x2d')](function(_0x58c045){return db[_0x5b12('0x16')][_0x5b12('0x2e')]({'where':_0x4ff719[_0x5b12('0x17')]?_0x4ff719[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'attributes':_0x4ff719[_0x5b12('0x17')]?_0x4ff719['options'][_0x5b12('0x1e')]||null:null,'limit':0x1,'order':_0x4ff719[_0x5b12('0x17')]?_0x4ff719[_0x5b12('0x17')]['order']||null:null,'group':db[_0x5b12('0x16')][_0x5b12('0x38')],'transaction':_0x58c045,'lock':_0x58c045[_0x5b12('0x30')][_0x5b12('0x46')],'include':_0x4ff719[_0x5b12('0x17')]?_0x4ff719[_0x5b12('0x17')][_0x5b12('0x1b')]?_['map'](_0x4ff719[_0x5b12('0x17')]['include'],function(_0x551ace){return{'model':db[_0x551ace[_0x5b12('0x1d')]],'as':_0x551ace['as'],'attributes':_0x551ace[_0x5b12('0x1e')],'include':_0x551ace[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x551ace[_0x5b12('0x1b')],function(_0x456035){return{'model':db[_0x456035['model']],'as':_0x456035['as'],'attributes':_0x456035[_0x5b12('0x1e')],'include':_0x456035[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x456035[_0x5b12('0x1b')],function(_0x47f175){return{'model':db[_0x47f175['model']],'as':_0x47f175['as'],'attributes':_0x47f175[_0x5b12('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5b12('0x1f')](function(_0x39ea0e){var _0x442baa=[];for(var _0x12d45d=0x0;_0x12d45d<_0x39ea0e[_0x5b12('0x37')];_0x12d45d+=0x1){_0x442baa[_0x5b12('0x3a')](_0x39ea0e[_0x12d45d][_0x5b12('0x26')](_0x4ff719[_0x5b12('0x24')],{'transaction':_0x58c045}));}return BPromise[_0x5b12('0x3b')](_0x442baa);});})['then'](function(_0x28feb1){logger['info'](_0x5b12('0x45'),_0x4ff719);logger[_0x5b12('0x20')]('GetContactRecallMe',_0x4ff719,JSON['stringify'](_0x28feb1));_0x436c41(_0x28feb1);})['catch'](function(_0x1e0763){logger[_0x5b12('0x10')](_0x5b12('0x45'),_0x1e0763[_0x5b12('0x11')],_0x4ff719);_0x2eeb34(_0x24c3fe[_0x5b12('0x10')](0x1f4,_0x1e0763[_0x5b12('0x11')]));});});});};exports[_0x5b12('0x47')]=function(_0x361617){var _0x6c92f9=this;return new Promise(function(_0x441844,_0x5ec51c){db[_0x5b12('0x2b')]['describe']()[_0x5b12('0x1f')](function(_0x566acb){return db[_0x5b12('0x16')][_0x5b12('0x2e')]({'raw':_0x361617[_0x5b12('0x17')]?_0x361617[_0x5b12('0x17')][_0x5b12('0x18')]===undefined?!![]:![]:!![],'where':_0x361617[_0x5b12('0x17')]?_0x361617[_0x5b12('0x17')][_0x5b12('0x19')]||null:null,'attributes':_0x361617['options']?_0x361617[_0x5b12('0x17')][_0x5b12('0x1e')]||null:null,'limit':_0x361617[_0x5b12('0x17')]?_0x361617['options'][_0x5b12('0x1a')]||null:null,'include':_0x361617[_0x5b12('0x17')]?_0x361617[_0x5b12('0x17')][_0x5b12('0x1b')]?_['map'](_0x361617[_0x5b12('0x17')][_0x5b12('0x1b')],function(_0xbd6c7a){return{'model':db[_0xbd6c7a[_0x5b12('0x1d')]],'as':_0xbd6c7a['as'],'attributes':_0xbd6c7a['as']==='Contact'?_['keys'](_0x566acb):_0xbd6c7a[_0x5b12('0x1e')],'include':_0xbd6c7a[_0x5b12('0x1b')]?_['map'](_0xbd6c7a[_0x5b12('0x1b')],function(_0x56bea8){return{'model':db[_0x56bea8[_0x5b12('0x1d')]],'as':_0x56bea8['as'],'attributes':_0x56bea8[_0x5b12('0x1e')],'include':_0x56bea8[_0x5b12('0x1b')]?_[_0x5b12('0x1c')](_0x56bea8[_0x5b12('0x1b')],function(_0x3cc5d4){return{'model':db[_0x3cc5d4['model']],'as':_0x3cc5d4['as'],'attributes':_0x3cc5d4[_0x5b12('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5b12('0x1f')](function(_0x3fd90e){logger['info'](_0x5b12('0x15'),_0x361617);logger[_0x5b12('0x20')](_0x5b12('0x15'),_0x361617,JSON[_0x5b12('0xf')](_0x3fd90e));_0x441844(_0x3fd90e);})[_0x5b12('0x14')](function(_0x1548f0){logger[_0x5b12('0x10')](_0x5b12('0x15'),_0x1548f0['message'],_0x361617);_0x5ec51c(_0x6c92f9[_0x5b12('0x10')](0x1f4,_0x1548f0[_0x5b12('0x11')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 7721f57..d96ca96 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 _0xc02a=['delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','post','create','/preview','put','/:id','update'];(function(_0x387955,_0x14fac8){var _0x1631c3=function(_0x422498){while(--_0x422498){_0x387955['push'](_0x387955['shift']());}};_0x1631c3(++_0x14fac8);}(_0xc02a,0x191));var _0xac02=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc02a[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xac02('0x0'));var util=require(_0xac02('0x1'));var path=require(_0xac02('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac02('0x3')]();var fs_extra=require(_0xac02('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xac02('0x5'));var config=require('../../config/environment');var controller=require(_0xac02('0x6'));router[_0xac02('0x7')]('/',auth[_0xac02('0x8')](),controller[_0xac02('0x9')]);router[_0xac02('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xac02('0xa')]);router[_0xac02('0x7')](_0xac02('0xb'),auth[_0xac02('0x8')](),controller[_0xac02('0xc')]);router[_0xac02('0x7')]('/:id',auth[_0xac02('0x8')](),controller['show']);router[_0xac02('0xd')]('/',auth[_0xac02('0x8')](),controller[_0xac02('0xe')]);router[_0xac02('0xd')](_0xac02('0xf'),auth[_0xac02('0x8')](),controller['getPreview']);router[_0xac02('0x10')](_0xac02('0x11'),auth[_0xac02('0x8')](),controller[_0xac02('0x12')]);router[_0xac02('0x13')]('/:id',auth[_0xac02('0x8')](),controller['destroy']);module[_0xac02('0x14')]=router; \ No newline at end of file +var _0xf4e7=['update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/:id','show','create','post','/preview','getPreview','put'];(function(_0x56c744,_0x4bbd5b){var _0x38ba64=function(_0xedd6f4){while(--_0xedd6f4){_0x56c744['push'](_0x56c744['shift']());}};_0x38ba64(++_0x4bbd5b);}(_0xf4e7,0xfe));var _0x7f4e=function(_0x22e345,_0x376766){_0x22e345=_0x22e345-0x0;var _0xcc3698=_0xf4e7[_0x22e345];return _0xcc3698;};'use strict';var multer=require('multer');var util=require(_0x7f4e('0x0'));var path=require(_0x7f4e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7f4e('0x2'));var router=express[_0x7f4e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7f4e('0x4'));var interaction=require(_0x7f4e('0x5'));var config=require(_0x7f4e('0x6'));var controller=require(_0x7f4e('0x7'));router[_0x7f4e('0x8')]('/',auth[_0x7f4e('0x9')](),controller['index']);router[_0x7f4e('0x8')](_0x7f4e('0xa'),auth['isAuthenticated'](),controller[_0x7f4e('0xb')]);router[_0x7f4e('0x8')](_0x7f4e('0xc'),auth['isAuthenticated'](),controller[_0x7f4e('0xd')]);router[_0x7f4e('0x8')](_0x7f4e('0xe'),auth['isAuthenticated'](),controller[_0x7f4e('0xf')]);router['post']('/',auth[_0x7f4e('0x9')](),controller[_0x7f4e('0x10')]);router[_0x7f4e('0x11')](_0x7f4e('0x12'),auth[_0x7f4e('0x9')](),controller[_0x7f4e('0x13')]);router[_0x7f4e('0x14')](_0x7f4e('0xe'),auth[_0x7f4e('0x9')](),controller[_0x7f4e('0x15')]);router[_0x7f4e('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7f4e('0x17')]);module[_0x7f4e('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index b5c75b4..86c9113 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 _0xfd16=['INTEGER','contactListQueue','moment'];(function(_0x2a0350,_0x249319){var _0x425220=function(_0x1d5f78){while(--_0x1d5f78){_0x2a0350['push'](_0x2a0350['shift']());}};_0x425220(++_0x249319);}(_0xfd16,0x113));var _0x6fd1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfd16[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x6fd1('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6fd1('0x1')],'unique':_0x6fd1('0x2')},'ListId':{'type':Sequelize[_0x6fd1('0x1')],'unique':_0x6fd1('0x2')},'VoiceQueueId':{'type':Sequelize[_0x6fd1('0x1')],'unique':_0x6fd1('0x2')}}; \ No newline at end of file +var _0xad68=['exports','STRING','INTEGER','contactListQueue'];(function(_0x3e2fc3,_0x3b6f89){var _0x463b89=function(_0x1fcbae){while(--_0x1fcbae){_0x3e2fc3['push'](_0x3e2fc3['shift']());}};_0x463b89(++_0x3b6f89);}(_0xad68,0x100));var _0x8ad6=function(_0x2aee7b,_0x181285){_0x2aee7b=_0x2aee7b-0x0;var _0x5a4554=_0xad68[_0x2aee7b];return _0x5a4554;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x8ad6('0x0')]={'phone':{'type':Sequelize[_0x8ad6('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8ad6('0x2')],'unique':_0x8ad6('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8ad6('0x2')],'unique':_0x8ad6('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0b5153f..6ed21db 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 _0xa33c=['mustache','path','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name','send','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5d6996,_0x4048c6){var _0x18d38f=function(_0x27a904){while(--_0x27a904){_0x5d6996['push'](_0x5d6996['shift']());}};_0x18d38f(++_0x4048c6);}(_0xa33c,0xd4));var _0xca33=function(_0x1fb8d3,_0x4d7a9c){_0x1fb8d3=_0x1fb8d3-0x0;var _0x5f5354=_0xa33c[_0x1fb8d3];return _0x5f5354;};'use strict';var emlformat=require(_0xca33('0x0'));var rimraf=require(_0xca33('0x1'));var zipdir=require(_0xca33('0x2'));var jsonpatch=require(_0xca33('0x3'));var rp=require(_0xca33('0x4'));var moment=require(_0xca33('0x5'));var BPromise=require(_0xca33('0x6'));var Mustache=require(_0xca33('0x7'));var util=require('util');var path=require(_0xca33('0x8'));var sox=require('sox');var csv=require(_0xca33('0x9'));var ejs=require(_0xca33('0xa'));var fs=require('fs');var fs_extra=require(_0xca33('0xb'));var _=require(_0xca33('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xca33('0x9'));var querystring=require(_0xca33('0xd'));var Papa=require(_0xca33('0xe'));var Redis=require(_0xca33('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca33('0x10'));var as=require(_0xca33('0x11'));var hardwareService=require(_0xca33('0x12'));var logger=require(_0xca33('0x13'))('api');var utils=require(_0xca33('0x14'));var config=require(_0xca33('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xca33('0x16'))['db'];function respondWithStatusCode(_0x55083b,_0x18e8a0){_0x18e8a0=_0x18e8a0||0xcc;return function(_0x49cc40){if(_0x49cc40){return _0x55083b['sendStatus'](_0x18e8a0);}return _0x55083b[_0xca33('0x17')](_0x18e8a0)[_0xca33('0x18')]();};}function respondWithResult(_0x38aaff,_0x122738){_0x122738=_0x122738||0xc8;return function(_0x5ad02a){if(_0x5ad02a){return _0x38aaff['status'](_0x122738)['json'](_0x5ad02a);}};}function respondWithFilteredResult(_0x297074,_0x5982e3){return function(_0x1df8a8){if(_0x1df8a8){var _0x21b173=typeof _0x5982e3[_0xca33('0x19')]===_0xca33('0x1a')&&typeof _0x5982e3[_0xca33('0x1b')]==='undefined';var _0x5c25f8=_0x1df8a8['count'];var _0x57a270=_0x21b173?0x0:_0x5982e3[_0xca33('0x19')];var _0x5cff55=_0x21b173?_0x1df8a8[_0xca33('0x1c')]:_0x5982e3[_0xca33('0x19')]+_0x5982e3[_0xca33('0x1b')];var _0x1161e0;if(_0x5cff55>=_0x5c25f8){_0x5cff55=_0x5c25f8;_0x1161e0=0xc8;}else{_0x1161e0=0xce;}_0x297074['status'](_0x1161e0);return _0x297074[_0xca33('0x1d')](_0xca33('0x1e'),_0x57a270+'-'+_0x5cff55+'/'+_0x5c25f8)[_0xca33('0x1f')](_0x1df8a8);}return null;};}function patchUpdates(_0x5b4801){return function(_0x113adb){try{jsonpatch[_0xca33('0x20')](_0x113adb,_0x5b4801,!![]);}catch(_0x839d01){return BPromise[_0xca33('0x21')](_0x839d01);}return _0x113adb['save']();};}function saveUpdates(_0x37752e,_0x181bfc){return function(_0x4e10fa){if(_0x4e10fa){return _0x4e10fa[_0xca33('0x22')](_0x37752e)[_0xca33('0x23')](function(_0x237ebb){return _0x237ebb;});}return null;};}function removeEntity(_0x269ea1,_0xc268e){return function(_0x37ceb4){if(_0x37ceb4){return _0x37ceb4['destroy']()['then'](function(){_0x269ea1['status'](0xcc)[_0xca33('0x18')]();});}};}function handleEntityNotFound(_0x202808,_0x3a3bd5){return function(_0x18991d){if(!_0x18991d){_0x202808[_0xca33('0x24')](0x194);}return _0x18991d;};}function handleError(_0x561349,_0x4043fd){_0x4043fd=_0x4043fd||0x1f4;return function(_0x121188){logger[_0xca33('0x25')](_0x121188[_0xca33('0x26')]);if(_0x121188[_0xca33('0x27')]){delete _0x121188[_0xca33('0x27')];}_0x561349[_0xca33('0x17')](_0x4043fd)[_0xca33('0x28')](_0x121188);};}exports['index']=function(_0x3f951b,_0x5b4bef){var _0x5c25b1={},_0x476a11={},_0x3f4863={'count':0x0,'rows':[]};var _0xfbeb8a=_['map'](db[_0xca33('0x29')][_0xca33('0x2a')],function(_0x46380a){return{'name':_0x46380a[_0xca33('0x2b')],'type':_0x46380a[_0xca33('0x2c')][_0xca33('0x2d')]};});_0x476a11[_0xca33('0x2e')]=_[_0xca33('0x2f')](_0xfbeb8a,'name');_0x476a11['query']=_[_0xca33('0x30')](_0x3f951b['query']);_0x476a11['filters']=_[_0xca33('0x31')](_0x476a11[_0xca33('0x2e')],_0x476a11[_0xca33('0x32')]);_0x5c25b1['attributes']=_[_0xca33('0x31')](_0x476a11[_0xca33('0x2e')],qs[_0xca33('0x33')](_0x3f951b[_0xca33('0x32')]['fields']));_0x5c25b1[_0xca33('0x34')]=_0x5c25b1['attributes'][_0xca33('0x35')]?_0x5c25b1[_0xca33('0x34')]:_0x476a11['model'];if(!_0x3f951b['query'][_0xca33('0x36')]('nolimit')){_0x5c25b1['limit']=qs['limit'](_0x3f951b[_0xca33('0x32')][_0xca33('0x1b')]);_0x5c25b1[_0xca33('0x19')]=qs[_0xca33('0x19')](_0x3f951b[_0xca33('0x32')][_0xca33('0x19')]);}_0x5c25b1['order']=qs[_0xca33('0x37')](_0x3f951b[_0xca33('0x32')][_0xca33('0x37')]);_0x5c25b1[_0xca33('0x38')]=qs[_0xca33('0x39')](_[_0xca33('0x3a')](_0x3f951b[_0xca33('0x32')],_0x476a11[_0xca33('0x39')]),_0xfbeb8a);if(_0x3f951b['query'][_0xca33('0x3b')]){_0x5c25b1[_0xca33('0x38')]=_[_0xca33('0x3c')](_0x5c25b1[_0xca33('0x38')],{'$or':_['map'](_0xfbeb8a,function(_0x57f608){if(_0x57f608[_0xca33('0x2c')]!==_0xca33('0x3d')){var _0x46a2de={};_0x46a2de[_0x57f608['name']]={'$like':'%'+_0x3f951b[_0xca33('0x32')][_0xca33('0x3b')]+'%'};return _0x46a2de;}})});}_0x5c25b1=_['merge']({},_0x5c25b1,_0x3f951b[_0xca33('0x3e')]);var _0x3e874e={'where':_0x5c25b1[_0xca33('0x38')]};return db[_0xca33('0x29')][_0xca33('0x1c')](_0x3e874e)['then'](function(_0x2ff344){_0x3f4863[_0xca33('0x1c')]=_0x2ff344;if(_0x3f951b[_0xca33('0x32')][_0xca33('0x3f')]){_0x5c25b1[_0xca33('0x40')]=[{'all':!![]}];}return db[_0xca33('0x29')][_0xca33('0x41')](_0x5c25b1);})[_0xca33('0x23')](function(_0x6c21b4){_0x3f4863[_0xca33('0x42')]=_0x6c21b4;return _0x3f4863;})[_0xca33('0x23')](respondWithFilteredResult(_0x5b4bef,_0x5c25b1))[_0xca33('0x43')](handleError(_0x5b4bef,null));};exports[_0xca33('0x44')]=function(_0x31975a,_0xfe8005){var _0x5b1167={'raw':!![],'where':{'id':_0x31975a[_0xca33('0x45')]['id']}},_0x256c89={};_0x256c89[_0xca33('0x2e')]=_['keys'](db[_0xca33('0x29')]['rawAttributes']);_0x256c89[_0xca33('0x32')]=_[_0xca33('0x30')](_0x31975a[_0xca33('0x32')]);_0x256c89['filters']=_[_0xca33('0x31')](_0x256c89['model'],_0x256c89[_0xca33('0x32')]);_0x5b1167['attributes']=_[_0xca33('0x31')](_0x256c89['model'],qs[_0xca33('0x33')](_0x31975a[_0xca33('0x32')][_0xca33('0x33')]));_0x5b1167[_0xca33('0x34')]=_0x5b1167[_0xca33('0x34')][_0xca33('0x35')]?_0x5b1167[_0xca33('0x34')]:_0x256c89[_0xca33('0x2e')];if(_0x31975a['query'][_0xca33('0x3f')]){_0x5b1167['include']=[{'all':!![]}];}_0x5b1167=_['merge']({},_0x5b1167,_0x31975a[_0xca33('0x3e')]);return db[_0xca33('0x29')][_0xca33('0x46')](_0x5b1167)[_0xca33('0x23')](handleEntityNotFound(_0xfe8005,null))[_0xca33('0x23')](respondWithResult(_0xfe8005,null))[_0xca33('0x43')](handleError(_0xfe8005,null));};exports[_0xca33('0x22')]=function(_0x48b776,_0x216e3a){if(_0x48b776[_0xca33('0x47')]['id']){delete _0x48b776[_0xca33('0x47')]['id'];}return db[_0xca33('0x29')][_0xca33('0x46')]({'where':{'id':_0x48b776[_0xca33('0x45')]['id']}})['then'](handleEntityNotFound(_0x216e3a,null))[_0xca33('0x23')](saveUpdates(_0x48b776[_0xca33('0x47')],null))[_0xca33('0x23')](respondWithResult(_0x216e3a,null))[_0xca33('0x43')](handleError(_0x216e3a,null));};exports['destroy']=function(_0x40f4a3,_0x38ecf0){return db['CmHopperBlack'][_0xca33('0x46')]({'where':{'id':_0x40f4a3[_0xca33('0x45')]['id']}})['then'](handleEntityNotFound(_0x38ecf0,null))[_0xca33('0x23')](removeEntity(_0x38ecf0,null))['catch'](handleError(_0x38ecf0,null));};exports['describe']=function(_0x5bd6ff,_0x1d88bd){return db['CmHopperBlack'][_0xca33('0x48')]()['then'](respondWithResult(_0x1d88bd,null))[_0xca33('0x43')](handleError(_0x1d88bd,null));}; \ No newline at end of file +var _0x77aa=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','end','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','update','body','destroy'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x77aa,0x1f1));var _0xa77a=function(_0x261917,_0x5ce7ee){_0x261917=_0x261917-0x0;var _0x1cb997=_0x77aa[_0x261917];return _0x1cb997;};'use strict';var emlformat=require(_0xa77a('0x0'));var rimraf=require(_0xa77a('0x1'));var zipdir=require(_0xa77a('0x2'));var jsonpatch=require(_0xa77a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa77a('0x4'));var Mustache=require('mustache');var util=require(_0xa77a('0x5'));var path=require('path');var sox=require(_0xa77a('0x6'));var csv=require(_0xa77a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa77a('0x8'));var squel=require('squel');var crypto=require(_0xa77a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa77a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa77a('0xb'));var Papa=require('papaparse');var Redis=require(_0xa77a('0xc'));var authService=require(_0xa77a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa77a('0xe'));var hardwareService=require(_0xa77a('0xf'));var logger=require(_0xa77a('0x10'))(_0xa77a('0x11'));var utils=require(_0xa77a('0x12'));var config=require(_0xa77a('0x13'));var licenseUtil=require(_0xa77a('0x14'));var db=require(_0xa77a('0x15'))['db'];function respondWithStatusCode(_0xcf7948,_0x563d3a){_0x563d3a=_0x563d3a||0xcc;return function(_0x117a4f){if(_0x117a4f){return _0xcf7948['sendStatus'](_0x563d3a);}return _0xcf7948['status'](_0x563d3a)['end']();};}function respondWithResult(_0x5ef6cb,_0x4b7352){_0x4b7352=_0x4b7352||0xc8;return function(_0x36feed){if(_0x36feed){return _0x5ef6cb[_0xa77a('0x16')](_0x4b7352)['json'](_0x36feed);}};}function respondWithFilteredResult(_0x465b95,_0x232c26){return function(_0x4e7263){if(_0x4e7263){var _0x2a8de9=typeof _0x232c26[_0xa77a('0x17')]===_0xa77a('0x18')&&typeof _0x232c26[_0xa77a('0x19')]===_0xa77a('0x18');var _0x41ea92=_0x4e7263[_0xa77a('0x1a')];var _0x4b310b=_0x2a8de9?0x0:_0x232c26['offset'];var _0x257c1c=_0x2a8de9?_0x4e7263[_0xa77a('0x1a')]:_0x232c26[_0xa77a('0x17')]+_0x232c26[_0xa77a('0x19')];var _0x4a8d62;if(_0x257c1c>=_0x41ea92){_0x257c1c=_0x41ea92;_0x4a8d62=0xc8;}else{_0x4a8d62=0xce;}_0x465b95[_0xa77a('0x16')](_0x4a8d62);return _0x465b95[_0xa77a('0x1b')](_0xa77a('0x1c'),_0x4b310b+'-'+_0x257c1c+'/'+_0x41ea92)[_0xa77a('0x1d')](_0x4e7263);}return null;};}function patchUpdates(_0x5967b2){return function(_0x364df1){try{jsonpatch[_0xa77a('0x1e')](_0x364df1,_0x5967b2,!![]);}catch(_0x3d9ed9){return BPromise[_0xa77a('0x1f')](_0x3d9ed9);}return _0x364df1['save']();};}function saveUpdates(_0x163bac,_0x514bf1){return function(_0x1e4504){if(_0x1e4504){return _0x1e4504['update'](_0x163bac)[_0xa77a('0x20')](function(_0x34dd1b){return _0x34dd1b;});}return null;};}function removeEntity(_0x4fd7be,_0x4125b2){return function(_0x1a7158){if(_0x1a7158){return _0x1a7158['destroy']()['then'](function(){_0x4fd7be[_0xa77a('0x16')](0xcc)[_0xa77a('0x21')]();});}};}function handleEntityNotFound(_0x1e9395,_0x5633ad){return function(_0x589fb4){if(!_0x589fb4){_0x1e9395['sendStatus'](0x194);}return _0x589fb4;};}function handleError(_0x167b82,_0x232477){_0x232477=_0x232477||0x1f4;return function(_0x19d7fd){logger[_0xa77a('0x22')](_0x19d7fd[_0xa77a('0x23')]);if(_0x19d7fd[_0xa77a('0x24')]){delete _0x19d7fd[_0xa77a('0x24')];}_0x167b82[_0xa77a('0x16')](_0x232477)[_0xa77a('0x25')](_0x19d7fd);};}exports['index']=function(_0x142004,_0x1e2830){var _0x2ad051={},_0x292db1={},_0x326a99={'count':0x0,'rows':[]};var _0x8e1f8f=_[_0xa77a('0x26')](db[_0xa77a('0x27')][_0xa77a('0x28')],function(_0x3d1d44){return{'name':_0x3d1d44[_0xa77a('0x29')],'type':_0x3d1d44[_0xa77a('0x2a')]['key']};});_0x292db1[_0xa77a('0x2b')]=_[_0xa77a('0x26')](_0x8e1f8f,_0xa77a('0x24'));_0x292db1['query']=_['keys'](_0x142004[_0xa77a('0x2c')]);_0x292db1[_0xa77a('0x2d')]=_[_0xa77a('0x2e')](_0x292db1[_0xa77a('0x2b')],_0x292db1[_0xa77a('0x2c')]);_0x2ad051[_0xa77a('0x2f')]=_[_0xa77a('0x2e')](_0x292db1['model'],qs[_0xa77a('0x30')](_0x142004[_0xa77a('0x2c')]['fields']));_0x2ad051[_0xa77a('0x2f')]=_0x2ad051[_0xa77a('0x2f')][_0xa77a('0x31')]?_0x2ad051[_0xa77a('0x2f')]:_0x292db1[_0xa77a('0x2b')];if(!_0x142004[_0xa77a('0x2c')][_0xa77a('0x32')](_0xa77a('0x33'))){_0x2ad051[_0xa77a('0x19')]=qs[_0xa77a('0x19')](_0x142004[_0xa77a('0x2c')][_0xa77a('0x19')]);_0x2ad051[_0xa77a('0x17')]=qs[_0xa77a('0x17')](_0x142004[_0xa77a('0x2c')][_0xa77a('0x17')]);}_0x2ad051[_0xa77a('0x34')]=qs[_0xa77a('0x35')](_0x142004[_0xa77a('0x2c')][_0xa77a('0x35')]);_0x2ad051[_0xa77a('0x36')]=qs[_0xa77a('0x2d')](_[_0xa77a('0x37')](_0x142004[_0xa77a('0x2c')],_0x292db1[_0xa77a('0x2d')]),_0x8e1f8f);if(_0x142004[_0xa77a('0x2c')]['filter']){_0x2ad051[_0xa77a('0x36')]=_['merge'](_0x2ad051[_0xa77a('0x36')],{'$or':_[_0xa77a('0x26')](_0x8e1f8f,function(_0x4149bf){if(_0x4149bf['type']!==_0xa77a('0x38')){var _0x274633={};_0x274633[_0x4149bf[_0xa77a('0x24')]]={'$like':'%'+_0x142004[_0xa77a('0x2c')]['filter']+'%'};return _0x274633;}})});}_0x2ad051=_[_0xa77a('0x39')]({},_0x2ad051,_0x142004[_0xa77a('0x3a')]);var _0x5f4e40={'where':_0x2ad051['where']};return db[_0xa77a('0x27')]['count'](_0x5f4e40)[_0xa77a('0x20')](function(_0x2dae62){_0x326a99['count']=_0x2dae62;if(_0x142004['query'][_0xa77a('0x3b')]){_0x2ad051[_0xa77a('0x3c')]=[{'all':!![]}];}return db[_0xa77a('0x27')][_0xa77a('0x3d')](_0x2ad051);})[_0xa77a('0x20')](function(_0x2984a3){_0x326a99[_0xa77a('0x3e')]=_0x2984a3;return _0x326a99;})[_0xa77a('0x20')](respondWithFilteredResult(_0x1e2830,_0x2ad051))[_0xa77a('0x3f')](handleError(_0x1e2830,null));};exports[_0xa77a('0x40')]=function(_0x1a292c,_0x291463){var _0x3ec3f0={'raw':!![],'where':{'id':_0x1a292c[_0xa77a('0x41')]['id']}},_0xc3cf77={};_0xc3cf77['model']=_[_0xa77a('0x42')](db[_0xa77a('0x27')][_0xa77a('0x28')]);_0xc3cf77[_0xa77a('0x2c')]=_[_0xa77a('0x42')](_0x1a292c[_0xa77a('0x2c')]);_0xc3cf77[_0xa77a('0x2d')]=_[_0xa77a('0x2e')](_0xc3cf77[_0xa77a('0x2b')],_0xc3cf77[_0xa77a('0x2c')]);_0x3ec3f0[_0xa77a('0x2f')]=_[_0xa77a('0x2e')](_0xc3cf77[_0xa77a('0x2b')],qs[_0xa77a('0x30')](_0x1a292c['query'][_0xa77a('0x30')]));_0x3ec3f0[_0xa77a('0x2f')]=_0x3ec3f0[_0xa77a('0x2f')]['length']?_0x3ec3f0[_0xa77a('0x2f')]:_0xc3cf77[_0xa77a('0x2b')];if(_0x1a292c[_0xa77a('0x2c')][_0xa77a('0x3b')]){_0x3ec3f0[_0xa77a('0x3c')]=[{'all':!![]}];}_0x3ec3f0=_[_0xa77a('0x39')]({},_0x3ec3f0,_0x1a292c[_0xa77a('0x3a')]);return db[_0xa77a('0x27')][_0xa77a('0x43')](_0x3ec3f0)['then'](handleEntityNotFound(_0x291463,null))[_0xa77a('0x20')](respondWithResult(_0x291463,null))[_0xa77a('0x3f')](handleError(_0x291463,null));};exports[_0xa77a('0x44')]=function(_0x3a0d13,_0x4fa21a){if(_0x3a0d13[_0xa77a('0x45')]['id']){delete _0x3a0d13[_0xa77a('0x45')]['id'];}return db[_0xa77a('0x27')][_0xa77a('0x43')]({'where':{'id':_0x3a0d13[_0xa77a('0x41')]['id']}})[_0xa77a('0x20')](handleEntityNotFound(_0x4fa21a,null))[_0xa77a('0x20')](saveUpdates(_0x3a0d13[_0xa77a('0x45')],null))[_0xa77a('0x20')](respondWithResult(_0x4fa21a,null))['catch'](handleError(_0x4fa21a,null));};exports[_0xa77a('0x46')]=function(_0x25276a,_0x37495c){return db[_0xa77a('0x27')][_0xa77a('0x43')]({'where':{'id':_0x25276a['params']['id']}})[_0xa77a('0x20')](handleEntityNotFound(_0x37495c,null))[_0xa77a('0x20')](removeEntity(_0x37495c,null))[_0xa77a('0x3f')](handleError(_0x37495c,null));};exports['describe']=function(_0x490b0d,_0xc5dba2){return db[_0xa77a('0x27')]['describe']()[_0xa77a('0x20')](respondWithResult(_0xc5dba2,null))[_0xa77a('0x3f')](handleError(_0xc5dba2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 32cb799..d017b7f 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 _0x443c=['CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','define'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x443c,0x92));var _0xc443=function(_0x195686,_0xd329df){_0x195686=_0x195686-0x0;var _0xaf27a1=_0x443c[_0x195686];return _0xaf27a1;};'use strict';var _=require(_0xc443('0x0'));var util=require(_0xc443('0x1'));var logger=require('../../config/logger')(_0xc443('0x2'));var moment=require(_0xc443('0x3'));var BPromise=require(_0xc443('0x4'));var rp=require(_0xc443('0x5'));var fs=require('fs');var path=require(_0xc443('0x6'));var rimraf=require(_0xc443('0x7'));var config=require('../../config/environment');var attributes=require(_0xc443('0x8'));module['exports']=function(_0x597577,_0x233bf2){return _0x597577[_0xc443('0x9')](_0xc443('0xa'),attributes,{'tableName':_0xc443('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x948d=['exports','define','cm_hopper_black','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5713f3,_0x4df455){var _0x541456=function(_0x19ec8f){while(--_0x19ec8f){_0x5713f3['push'](_0x5713f3['shift']());}};_0x541456(++_0x4df455);}(_0x948d,0xea));var _0xd948=function(_0x414691,_0x31baf2){_0x414691=_0x414691-0x0;var _0x1705c3=_0x948d[_0x414691];return _0x1705c3;};'use strict';var _=require(_0xd948('0x0'));var util=require(_0xd948('0x1'));var logger=require(_0xd948('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd948('0x3'));var rp=require(_0xd948('0x4'));var fs=require('fs');var path=require(_0xd948('0x5'));var rimraf=require(_0xd948('0x6'));var config=require(_0xd948('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0xd948('0x8')]=function(_0x5267a0,_0x245bdf){return _0x5267a0[_0xd948('0x9')]('CmHopperBlack',attributes,{'tableName':_0xd948('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 459bd35..f8ce033 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 _0xe7ac=['util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','stringify','UpdateCmHopperBlack','body','limit','DestroyCmHopperBlack','lodash'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xe7ac,0x155));var _0xce7a=function(_0x3d2b3c,_0x432bf2){_0x3d2b3c=_0x3d2b3c-0x0;var _0x2c2459=_0xe7ac[_0x3d2b3c];return _0x2c2459;};'use strict';var _=require(_0xce7a('0x0'));var util=require(_0xce7a('0x1'));var moment=require(_0xce7a('0x2'));var BPromise=require(_0xce7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce7a('0x4'));var db=require(_0xce7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xce7a('0x6'));var config=require(_0xce7a('0x7'));var jayson=require(_0xce7a('0x8'));var client=jayson[_0xce7a('0x9')][_0xce7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fa24d,_0x68100c,_0x10bbfc){return new BPromise(function(_0x1c7e00,_0x3145d5){return client[_0xce7a('0xb')](_0x3fa24d,_0x10bbfc)[_0xce7a('0xc')](function(_0x411de2){logger[_0xce7a('0xd')](_0xce7a('0xe'),_0x68100c,_0xce7a('0xf'));logger[_0xce7a('0x10')](_0xce7a('0x11'),_0x68100c,_0xce7a('0xf'),JSON['stringify'](_0x411de2));if(_0x411de2[_0xce7a('0x12')]){if(_0x411de2[_0xce7a('0x12')][_0xce7a('0x13')]===0x1f4){logger['error'](_0xce7a('0xe'),_0x68100c,_0x411de2[_0xce7a('0x12')][_0xce7a('0x14')]);return _0x3145d5(_0x411de2[_0xce7a('0x12')]['message']);}logger['error'](_0xce7a('0xe'),_0x68100c,_0x411de2[_0xce7a('0x12')]['message']);return _0x1c7e00(_0x411de2[_0xce7a('0x12')][_0xce7a('0x14')]);}else{logger[_0xce7a('0xd')](_0xce7a('0xe'),_0x68100c,_0xce7a('0xf'));_0x1c7e00(_0x411de2[_0xce7a('0x15')][_0xce7a('0x14')]);}})[_0xce7a('0x16')](function(_0x5cbc95){logger['error'](_0xce7a('0xe'),_0x68100c,_0x5cbc95);_0x3145d5(_0x5cbc95);});});}exports[_0xce7a('0x17')]=function(_0x53f7ce){var _0x1a4428=this;return new Promise(function(_0xd0e1d2,_0x3860b5){return db[_0xce7a('0x18')][_0xce7a('0x19')]({'raw':_0x53f7ce['options']?_0x53f7ce[_0xce7a('0x1a')][_0xce7a('0x1b')]===undefined?!![]:![]:!![],'where':_0x53f7ce['options']?_0x53f7ce[_0xce7a('0x1a')][_0xce7a('0x1c')]||null:null,'attributes':_0x53f7ce[_0xce7a('0x1a')]?_0x53f7ce['options'][_0xce7a('0x1d')]||null:null,'limit':_0x53f7ce[_0xce7a('0x1a')]?_0x53f7ce[_0xce7a('0x1a')]['limit']||null:null,'include':_0x53f7ce[_0xce7a('0x1a')]?_0x53f7ce[_0xce7a('0x1a')][_0xce7a('0x1e')]?_[_0xce7a('0x1f')](_0x53f7ce['options'][_0xce7a('0x1e')],function(_0x298970){return{'model':db[_0x298970['model']],'as':_0x298970['as'],'attributes':_0x298970['attributes'],'include':_0x298970['include']?_[_0xce7a('0x1f')](_0x298970[_0xce7a('0x1e')],function(_0x26a8d4){return{'model':db[_0x26a8d4[_0xce7a('0x20')]],'as':_0x26a8d4['as'],'attributes':_0x26a8d4[_0xce7a('0x1d')],'include':_0x26a8d4[_0xce7a('0x1e')]?_[_0xce7a('0x1f')](_0x26a8d4[_0xce7a('0x1e')],function(_0x230f9b){return{'model':db[_0x230f9b[_0xce7a('0x20')]],'as':_0x230f9b['as'],'attributes':_0x230f9b[_0xce7a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xce7a('0xc')](function(_0x50456c){logger['info'](_0xce7a('0x17'),_0x53f7ce);logger[_0xce7a('0x10')](_0xce7a('0x17'),_0x53f7ce,JSON[_0xce7a('0x21')](_0x50456c));_0xd0e1d2(_0x50456c);})['catch'](function(_0x53cfa7){logger[_0xce7a('0x12')](_0xce7a('0x17'),_0x53cfa7[_0xce7a('0x14')],_0x53f7ce);_0x3860b5(_0x1a4428[_0xce7a('0x12')](0x1f4,_0x53cfa7[_0xce7a('0x14')]));});});};exports[_0xce7a('0x22')]=function(_0x148f59){var _0x446d2d=this;return new Promise(function(_0x52ff3e,_0x6a1773){return db[_0xce7a('0x18')]['update'](_0x148f59[_0xce7a('0x23')],{'raw':_0x148f59[_0xce7a('0x1a')]?_0x148f59[_0xce7a('0x1a')][_0xce7a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x148f59[_0xce7a('0x1a')]?_0x148f59['options'][_0xce7a('0x1c')]||null:null,'attributes':_0x148f59[_0xce7a('0x1a')]?_0x148f59['options']['attributes']||null:null,'limit':_0x148f59['options']?_0x148f59[_0xce7a('0x1a')][_0xce7a('0x24')]||null:null})[_0xce7a('0xc')](function(_0x1f1e03){logger[_0xce7a('0xd')](_0xce7a('0x22'),_0x148f59);logger[_0xce7a('0x10')]('UpdateCmHopperBlack',_0x148f59,JSON[_0xce7a('0x21')](_0x1f1e03));_0x52ff3e(_0x1f1e03);})[_0xce7a('0x16')](function(_0x1839b0){logger['error'](_0xce7a('0x22'),_0x1839b0[_0xce7a('0x14')],_0x148f59);_0x6a1773(_0x446d2d[_0xce7a('0x12')](0x1f4,_0x1839b0['message']));});});};exports[_0xce7a('0x25')]=function(_0x51a9a4){var _0x30efcb=this;return new Promise(function(_0xef7772,_0x380d5c){return db['CmHopperBlack']['destroy']({'where':_0x51a9a4[_0xce7a('0x1a')]?_0x51a9a4[_0xce7a('0x1a')][_0xce7a('0x1c')]||null:null})[_0xce7a('0xc')](function(_0x4a4d19){logger[_0xce7a('0xd')](_0xce7a('0x25'),_0x51a9a4);logger[_0xce7a('0x10')](_0xce7a('0x25'),_0x51a9a4,JSON[_0xce7a('0x21')](_0x4a4d19));_0xef7772(_0x4a4d19);})[_0xce7a('0x16')](function(_0x3aae24){logger[_0xce7a('0x12')](_0xce7a('0x25'),_0x3aae24[_0xce7a('0x14')],_0x51a9a4);_0x380d5c(_0x30efcb['error'](0x1f4,_0x3aae24[_0xce7a('0x14')]));});});}; \ No newline at end of file +var _0xf13a=['moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','GetCmHopperBlack','CmHopperBlack','options','where','limit','include','map','model','attributes','UpdateCmHopperBlack','update','body','raw','catch','DestroyCmHopperBlack','destroy','lodash','util'];(function(_0x58a295,_0x407f4d){var _0x1b6a20=function(_0xcce711){while(--_0xcce711){_0x58a295['push'](_0x58a295['shift']());}};_0x1b6a20(++_0x407f4d);}(_0xf13a,0xb7));var _0xaf13=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xf13a[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0xaf13('0x0'));var util=require(_0xaf13('0x1'));var moment=require(_0xaf13('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf13('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaf13('0x4'));var logger=require('../../config/logger')(_0xaf13('0x5'));var config=require(_0xaf13('0x6'));var jayson=require(_0xaf13('0x7'));var client=jayson[_0xaf13('0x8')][_0xaf13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4de3f1,_0x536170,_0x11e020){return new BPromise(function(_0x1c69c2,_0x3820f6){return client['request'](_0x4de3f1,_0x11e020)[_0xaf13('0xa')](function(_0x1fcbd8){logger[_0xaf13('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x536170,_0xaf13('0xc'));logger[_0xaf13('0xd')](_0xaf13('0xe'),_0x536170,_0xaf13('0xc'),JSON[_0xaf13('0xf')](_0x1fcbd8));if(_0x1fcbd8[_0xaf13('0x10')]){if(_0x1fcbd8['error'][_0xaf13('0x11')]===0x1f4){logger[_0xaf13('0x10')](_0xaf13('0x12'),_0x536170,_0x1fcbd8[_0xaf13('0x10')][_0xaf13('0x13')]);return _0x3820f6(_0x1fcbd8[_0xaf13('0x10')][_0xaf13('0x13')]);}logger['error'](_0xaf13('0x12'),_0x536170,_0x1fcbd8[_0xaf13('0x10')][_0xaf13('0x13')]);return _0x1c69c2(_0x1fcbd8[_0xaf13('0x10')][_0xaf13('0x13')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x536170,_0xaf13('0xc'));_0x1c69c2(_0x1fcbd8[_0xaf13('0x14')]['message']);}})['catch'](function(_0x26d142){logger[_0xaf13('0x10')](_0xaf13('0x12'),_0x536170,_0x26d142);_0x3820f6(_0x26d142);});});}exports[_0xaf13('0x15')]=function(_0x72db58){var _0x2ca83e=this;return new Promise(function(_0x283f55,_0x168174){return db[_0xaf13('0x16')]['findAll']({'raw':_0x72db58[_0xaf13('0x17')]?_0x72db58[_0xaf13('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x72db58['options']?_0x72db58[_0xaf13('0x17')][_0xaf13('0x18')]||null:null,'attributes':_0x72db58[_0xaf13('0x17')]?_0x72db58[_0xaf13('0x17')]['attributes']||null:null,'limit':_0x72db58[_0xaf13('0x17')]?_0x72db58['options'][_0xaf13('0x19')]||null:null,'include':_0x72db58['options']?_0x72db58[_0xaf13('0x17')][_0xaf13('0x1a')]?_[_0xaf13('0x1b')](_0x72db58[_0xaf13('0x17')][_0xaf13('0x1a')],function(_0x215e50){return{'model':db[_0x215e50[_0xaf13('0x1c')]],'as':_0x215e50['as'],'attributes':_0x215e50[_0xaf13('0x1d')],'include':_0x215e50['include']?_['map'](_0x215e50[_0xaf13('0x1a')],function(_0x28ac49){return{'model':db[_0x28ac49['model']],'as':_0x28ac49['as'],'attributes':_0x28ac49[_0xaf13('0x1d')],'include':_0x28ac49['include']?_[_0xaf13('0x1b')](_0x28ac49[_0xaf13('0x1a')],function(_0x1bc2ed){return{'model':db[_0x1bc2ed[_0xaf13('0x1c')]],'as':_0x1bc2ed['as'],'attributes':_0x1bc2ed[_0xaf13('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaf13('0xa')](function(_0x257195){logger['info'](_0xaf13('0x15'),_0x72db58);logger['debug'](_0xaf13('0x15'),_0x72db58,JSON[_0xaf13('0xf')](_0x257195));_0x283f55(_0x257195);})['catch'](function(_0x3cf59a){logger[_0xaf13('0x10')]('GetCmHopperBlack',_0x3cf59a[_0xaf13('0x13')],_0x72db58);_0x168174(_0x2ca83e['error'](0x1f4,_0x3cf59a[_0xaf13('0x13')]));});});};exports[_0xaf13('0x1e')]=function(_0x1b85f5){var _0x50c60f=this;return new Promise(function(_0x39b59c,_0x377a32){return db[_0xaf13('0x16')][_0xaf13('0x1f')](_0x1b85f5[_0xaf13('0x20')],{'raw':_0x1b85f5[_0xaf13('0x17')]?_0x1b85f5['options'][_0xaf13('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b85f5[_0xaf13('0x17')]?_0x1b85f5['options'][_0xaf13('0x18')]||null:null,'attributes':_0x1b85f5[_0xaf13('0x17')]?_0x1b85f5[_0xaf13('0x17')]['attributes']||null:null,'limit':_0x1b85f5[_0xaf13('0x17')]?_0x1b85f5[_0xaf13('0x17')]['limit']||null:null})[_0xaf13('0xa')](function(_0x501b46){logger[_0xaf13('0xb')](_0xaf13('0x1e'),_0x1b85f5);logger['debug'](_0xaf13('0x1e'),_0x1b85f5,JSON['stringify'](_0x501b46));_0x39b59c(_0x501b46);})[_0xaf13('0x22')](function(_0x279928){logger[_0xaf13('0x10')](_0xaf13('0x1e'),_0x279928[_0xaf13('0x13')],_0x1b85f5);_0x377a32(_0x50c60f[_0xaf13('0x10')](0x1f4,_0x279928[_0xaf13('0x13')]));});});};exports[_0xaf13('0x23')]=function(_0x582696){var _0x5c6d9a=this;return new Promise(function(_0x36423d,_0x1017f3){return db[_0xaf13('0x16')][_0xaf13('0x24')]({'where':_0x582696[_0xaf13('0x17')]?_0x582696[_0xaf13('0x17')][_0xaf13('0x18')]||null:null})[_0xaf13('0xa')](function(_0x57f692){logger[_0xaf13('0xb')](_0xaf13('0x23'),_0x582696);logger[_0xaf13('0xd')]('DestroyCmHopperBlack',_0x582696,JSON[_0xaf13('0xf')](_0x57f692));_0x36423d(_0x57f692);})['catch'](function(_0x201ae6){logger[_0xaf13('0x10')](_0xaf13('0x23'),_0x201ae6[_0xaf13('0x13')],_0x582696);_0x1017f3(_0x5c6d9a[_0xaf13('0x10')](0x1f4,_0x201ae6[_0xaf13('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 6432439..b127138 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 _0xafc4=['multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','put','delete','destroy'];(function(_0x4d05a6,_0xfc674e){var _0x400039=function(_0x359d64){while(--_0x359d64){_0x4d05a6['push'](_0x4d05a6['shift']());}};_0x400039(++_0xfc674e);}(_0xafc4,0x69));var _0x4afc=function(_0xe0147a,_0x38b371){_0xe0147a=_0xe0147a-0x0;var _0x2e8792=_0xafc4[_0xe0147a];return _0x2e8792;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['describe']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4afc('0xd')]('/:id',auth[_0x4afc('0x7')](),controller[_0x4afc('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1db9=['isAuthenticated','describe','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe'];(function(_0x127283,_0x4158d6){var _0x5faf6a=function(_0x168d73){while(--_0x168d73){_0x127283['push'](_0x127283['shift']());}};_0x5faf6a(++_0x4158d6);}(_0x1db9,0x176));var _0x91db=function(_0x567cb9,_0xeb8d2b){_0x567cb9=_0x567cb9-0x0;var _0x319657=_0x1db9[_0x567cb9];return _0x319657;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91db('0x6'));var interaction=require(_0x91db('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x91db('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x91db('0x8')](_0x91db('0x9'),auth[_0x91db('0xa')](),controller[_0x91db('0xb')]);router[_0x91db('0x8')]('/:id',auth[_0x91db('0xa')](),controller['show']);router[_0x91db('0xc')](_0x91db('0xd'),auth[_0x91db('0xa')](),controller['update']);router[_0x91db('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x91db('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index ffc1a57..99b1676 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 _0x683e=['STRING','DATE','getDataValue','setDataValue','diff','dispositionat','BOOLEAN','moment','exports','INTEGER'];(function(_0x4ecf18,_0x327a60){var _0xe1a4e8=function(_0x434fd5){while(--_0x434fd5){_0x4ecf18['push'](_0x4ecf18['shift']());}};_0xe1a4e8(++_0x327a60);}(_0x683e,0x6b));var _0xe683=function(_0x3c126c,_0x22f353){_0x3c126c=_0x3c126c-0x0;var _0x3b89e4=_0x683e[_0x3c126c];return _0x3b89e4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe683('0x0'));module[_0xe683('0x1')]={'state':{'type':Sequelize[_0xe683('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xe683('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe683('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe683('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe683('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xe683('0x3')]},'originatecalleridname':{'type':Sequelize[_0xe683('0x3')]},'calleridnum':{'type':Sequelize[_0xe683('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe683('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe683('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe683('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe683('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe683('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe683('0x3')]},'campaign':{'type':Sequelize[_0xe683('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xe683('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xe683('0x4')],'set':function(_0x13b081){var _0x1a9aaf=this[_0xe683('0x5')]('endtime');if(_0x1a9aaf&&_0x13b081){this[_0xe683('0x6')]('followuptime',moment(_0x13b081)[_0xe683('0x7')](moment(_0x1a9aaf),'seconds'));}return this[_0xe683('0x6')](_0xe683('0x8'),_0x13b081);}},'amd':{'type':Sequelize[_0xe683('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe683('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe683('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe683('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe683('0x4')]},'callback':{'type':Sequelize[_0xe683('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xe683('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe683('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe683('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe683('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe683('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe683('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb3b6=['setDataValue','dispositionat','BOOLEAN','STRING','DATE','INTEGER','getDataValue','endtime','diff','seconds'];(function(_0x2ed806,_0x4e64aa){var _0x55f7aa=function(_0x139a81){while(--_0x139a81){_0x2ed806['push'](_0x2ed806['shift']());}};_0x55f7aa(++_0x4e64aa);}(_0xb3b6,0xe9));var _0x6b3b=function(_0x529a5f,_0x5db03e){_0x529a5f=_0x529a5f-0x0;var _0xc468da=_0xb3b6[_0x529a5f];return _0xc468da;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6b3b('0x0')]},'scheduledat':{'type':Sequelize[_0x6b3b('0x1')]},'countbusyretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6b3b('0x0')]},'originatecalleridnum':{'type':Sequelize[_0x6b3b('0x0')]},'originatecalleridname':{'type':Sequelize[_0x6b3b('0x0')]},'calleridnum':{'type':Sequelize[_0x6b3b('0x0')]},'calleridname':{'type':Sequelize[_0x6b3b('0x0')]},'starttime':{'type':Sequelize[_0x6b3b('0x1')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6b3b('0x1')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6b3b('0x1')]},'ringtime':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6b3b('0x0')]},'campaign':{'type':Sequelize[_0x6b3b('0x0')]},'campaigntype':{'type':Sequelize[_0x6b3b('0x0')]},'membername':{'type':Sequelize[_0x6b3b('0x0')]},'reason':{'type':Sequelize[_0x6b3b('0x0')]},'disposition':{'type':Sequelize[_0x6b3b('0x0')]},'secondDisposition':{'type':Sequelize[_0x6b3b('0x0')]},'thirdDisposition':{'type':Sequelize[_0x6b3b('0x0')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x24f7cb){var _0x588029=this[_0x6b3b('0x3')](_0x6b3b('0x4'));if(_0x588029&&_0x24f7cb){this['setDataValue']('followuptime',moment(_0x24f7cb)[_0x6b3b('0x5')](moment(_0x588029),_0x6b3b('0x6')));}return this[_0x6b3b('0x7')](_0x6b3b('0x8'),_0x24f7cb);}},'amd':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6b3b('0x1')]},'callback':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6b3b('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6b3b('0x1')]},'deleted':{'type':Sequelize[_0x6b3b('0x0')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6b3b('0x1')]},'recallme':{'type':Sequelize[_0x6b3b('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6b3b('0x1')]},'countnosuchnumberretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6b3b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 42954a5..7eaa89f 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 _0xc2c7=['`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','calleridnum','state\x20=\x204','checkContactHopper','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','uniqueid','params','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal'];(function(_0x2cc25d,_0x34eb25){var _0x5aa2f1=function(_0x2ffa33){while(--_0x2ffa33){_0x2cc25d['push'](_0x2cc25d['shift']());}};_0x5aa2f1(++_0x34eb25);}(_0xc2c7,0x134));var _0x7c2c=function(_0x48fe55,_0x512ef5){_0x48fe55=_0x48fe55-0x0;var _0x3c4476=_0xc2c7[_0x48fe55];return _0x3c4476;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':!![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['CmHopperFinal'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['describe']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['describe']()['then'](respondWithResult(_0x3091bd,null))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x39d5af,_0x2b79d5){if(_0x39d5af['body']['uniqueid']){delete _0x39d5af['body'][_0x7c2c('0x48')];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'uniqueid':_0x39d5af[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x2b79d5,null))['then'](saveUpdates(_0x39d5af[_0x7c2c('0x4a')],null))[_0x7c2c('0x26')](respondWithResult(_0x2b79d5,null))['catch'](handleError(_0x2b79d5,null));};exports[_0x7c2c('0x4b')]=function(_0x56e09d,_0xfba6a7,_0x3806f4){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x56e09d['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x4d')))),_0x7c2c('0x4e')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x7c2c('0x53')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x54')))),'congestionContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x58')))),_0x7c2c('0x59')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7c2c('0x26')](handleEntityNotFound(_0xfba6a7,null))[_0x7c2c('0x26')](respondWithResult(_0xfba6a7,null))[_0x7c2c('0x45')](handleError(_0xfba6a7,null));};exports[_0x7c2c('0x5a')]=function(_0x44602a,_0x1ad537,_0x2d04da){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'CampaignId':_0x44602a['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x7c2c('0x4e')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x5b')))),'busyContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7c2c('0x54')))),_0x7c2c('0x5c')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5d')))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x58')))),'reCallContacts'],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5e')))),_0x7c2c('0x5f')]]})['then'](handleEntityNotFound(_0x1ad537,null))[_0x7c2c('0x26')](respondWithResult(_0x1ad537,null))['catch'](handleError(_0x1ad537,null));};exports[_0x7c2c('0x60')]=function(_0x2b597d,_0x20eb63,_0x56f737){return db[_0x7c2c('0x61')][_0x7c2c('0x47')]({'where':{'id':_0x2b597d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x20eb63,null))['then'](function(_0x158352){var _0x1e711e;if(_0x158352){_0x1e711e=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')](_0x7c2c('0x64'))[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),'ListId',_0x7c2c('0x69'),_0x7c2c('0x6a'),'updatedAt'],squel[_0x7c2c('0x6b')]()['field']('ANY_VALUE(calleridnum)',_0x7c2c('0x66'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),'scheduledAt')[_0x7c2c('0x6c')](_0x7c2c('0x6e'),_0x7c2c('0x68'))['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')](_0x7c2c('0x71'),'VoiceQueueId')[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),_0x7c2c('0x72'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2b597d[_0x7c2c('0x4a')][_0x7c2c('0x77')][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x66'))[_0x7c2c('0x73')](_0x7c2c('0x64'))['where'](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel['select']()[_0x7c2c('0x6c')]('calleridnum')[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')]('state\x20=\x204'))[_0x7c2c('0x7b')](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x1e711e);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x20eb63,null))[_0x7c2c('0x45')](handleError(_0x20eb63,null));};exports[_0x7c2c('0x7c')]=function(_0x2f249d,_0x136226,_0x354236){return db[_0x7c2c('0x7d')][_0x7c2c('0x47')]({'where':{'id':_0x2f249d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x136226,null))[_0x7c2c('0x26')](function(_0xb47bf0){var _0x4d0922;if(_0xb47bf0){_0x4d0922=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')]('cm_hopper')[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),_0x7c2c('0x70'),'CampaignId',_0x7c2c('0x6a'),_0x7c2c('0x72')],squel[_0x7c2c('0x6b')]()['field'](_0x7c2c('0x7e'),_0x7c2c('0x66'))[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x67'))['field'](_0x7c2c('0x6e'),'ContactId')['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')]('ANY_VALUE(CampaignId)',_0x7c2c('0x7f'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),'updatedAt')['from']('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2f249d[_0x7c2c('0x4a')]['state'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()['field']('phone')[_0x7c2c('0x73')](_0x7c2c('0x64'))[_0x7c2c('0x3d')](_0x7c2c('0x80'),_0x2f249d['params']['id'][_0x7c2c('0x78')]()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x81'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')]('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())['where'](_0x7c2c('0x82')))['group'](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x4d0922);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x136226,null))[_0x7c2c('0x45')](handleError(_0x136226,null));};exports[_0x7c2c('0x83')]=function(_0x309051,_0x3f8683,_0x1eeb00){return db[_0x7c2c('0x84')]['findOne']({'where':{'VoiceQueueId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x69')],'CampaignId':_0x309051[_0x7c2c('0x4a')]['CampaignId'],'ContactId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x68')]}})['then'](handleEntityNotFound(_0x3f8683,null))[_0x7c2c('0x26')](function(_0x511158){if(_0x511158){return _0x511158;}return null;})[_0x7c2c('0x26')](respondWithResult(_0x3f8683,null))['catch'](handleError(_0x3f8683,null));}; \ No newline at end of file +var _0xbd51=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','then','includeAll','include','rows','show','params','keys','length','catch','describe','body','uniqueid','find','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x208,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt'];(function(_0x158e40,_0x40fa60){var _0x57b63c=function(_0x27a42f){while(--_0x27a42f){_0x158e40['push'](_0x158e40['shift']());}};_0x57b63c(++_0x40fa60);}(_0xbd51,0x1a8));var _0x1bd5=function(_0xb2823d,_0x2e1faf){_0xb2823d=_0xb2823d-0x0;var _0x112587=_0xbd51[_0xb2823d];return _0x112587;};'use strict';var emlformat=require(_0x1bd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bd5('0x1'));var jsonpatch=require(_0x1bd5('0x2'));var rp=require(_0x1bd5('0x3'));var moment=require(_0x1bd5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1bd5('0x5'));var csv=require(_0x1bd5('0x6'));var ejs=require(_0x1bd5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];function respondWithStatusCode(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xcc;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0x17')](_0x14606b);}return _0x37e8e1[_0x1bd5('0x18')](_0x14606b)['end']();};}function respondWithResult(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0xc8;return function(_0x6d2c40){if(_0x6d2c40){return _0x5650b5[_0x1bd5('0x18')](_0x8b2390)[_0x1bd5('0x19')](_0x6d2c40);}};}function respondWithFilteredResult(_0x48d048,_0x5072c2){return function(_0xa63190){if(_0xa63190){var _0xc7277e=typeof _0x5072c2[_0x1bd5('0x1a')]===_0x1bd5('0x1b')&&typeof _0x5072c2[_0x1bd5('0x1c')]===_0x1bd5('0x1b');var _0x13cf34=_0xa63190[_0x1bd5('0x1d')];var _0x4670b5=_0xc7277e?0x0:_0x5072c2['offset'];var _0x53ad5e=_0xc7277e?_0xa63190[_0x1bd5('0x1d')]:_0x5072c2[_0x1bd5('0x1a')]+_0x5072c2[_0x1bd5('0x1c')];var _0xb95d4e;if(_0x53ad5e>=_0x13cf34){_0x53ad5e=_0x13cf34;_0xb95d4e=0xc8;}else{_0xb95d4e=0xce;}_0x48d048[_0x1bd5('0x18')](_0xb95d4e);return _0x48d048[_0x1bd5('0x1e')](_0x1bd5('0x1f'),_0x4670b5+'-'+_0x53ad5e+'/'+_0x13cf34)[_0x1bd5('0x19')](_0xa63190);}return null;};}function patchUpdates(_0x456051){return function(_0xb1ac1e){try{jsonpatch[_0x1bd5('0x20')](_0xb1ac1e,_0x456051,!![]);}catch(_0x2447c4){return BPromise[_0x1bd5('0x21')](_0x2447c4);}return _0xb1ac1e[_0x1bd5('0x22')]();};}function saveUpdates(_0x253d79,_0x46c580){return function(_0x1f13e7){if(_0x1f13e7){return _0x1f13e7[_0x1bd5('0x23')](_0x253d79)['then'](function(_0x42c43d){return _0x42c43d;});}return null;};}function removeEntity(_0x50c663,_0x18fd18){return function(_0x1e534e){if(_0x1e534e){return _0x1e534e[_0x1bd5('0x24')]()['then'](function(){_0x50c663[_0x1bd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed551,_0x30676d){return function(_0x3dba4f){if(!_0x3dba4f){_0x2ed551[_0x1bd5('0x17')](0x194);}return _0x3dba4f;};}function handleError(_0x47c84b,_0x202ed3){_0x202ed3=_0x202ed3||0x1f4;return function(_0x69bb17){logger[_0x1bd5('0x25')](_0x69bb17[_0x1bd5('0x26')]);if(_0x69bb17['name']){delete _0x69bb17[_0x1bd5('0x27')];}_0x47c84b[_0x1bd5('0x18')](_0x202ed3)[_0x1bd5('0x28')](_0x69bb17);};}exports[_0x1bd5('0x29')]=function(_0xe54b9f,_0xc73670){var _0x4e72b2={},_0x289097={},_0x472b22={'count':0x0,'rows':[]};var _0x8d53ba=_['map'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')],function(_0x345181){return{'name':_0x345181[_0x1bd5('0x2c')],'type':_0x345181[_0x1bd5('0x2d')][_0x1bd5('0x2e')]};});_0x289097['model']=_['map'](_0x8d53ba,_0x1bd5('0x27'));_0x289097[_0x1bd5('0x2f')]=_['keys'](_0xe54b9f[_0x1bd5('0x2f')]);_0x289097[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],_0x289097['query']);_0x4e72b2[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],qs[_0x1bd5('0x34')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x4e72b2[_0x1bd5('0x33')]=_0x4e72b2[_0x1bd5('0x33')]['length']?_0x4e72b2[_0x1bd5('0x33')]:_0x289097[_0x1bd5('0x32')];if(!_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x35')](_0x1bd5('0x36'))){_0x4e72b2[_0x1bd5('0x1c')]=qs[_0x1bd5('0x1c')](_0xe54b9f['query'][_0x1bd5('0x1c')]);_0x4e72b2[_0x1bd5('0x1a')]=qs[_0x1bd5('0x1a')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x1a')]);}_0x4e72b2[_0x1bd5('0x37')]=qs[_0x1bd5('0x38')](_0xe54b9f['query']['sort']);_0x4e72b2[_0x1bd5('0x39')]=qs[_0x1bd5('0x30')](_[_0x1bd5('0x3a')](_0xe54b9f['query'],_0x289097[_0x1bd5('0x30')]),_0x8d53ba);if(_0xe54b9f['query'][_0x1bd5('0x3b')]){_0x4e72b2[_0x1bd5('0x39')]=_[_0x1bd5('0x3c')](_0x4e72b2[_0x1bd5('0x39')],{'$or':_[_0x1bd5('0x3d')](_0x8d53ba,function(_0x2470ec){if(_0x2470ec[_0x1bd5('0x2d')]!==_0x1bd5('0x3e')){var _0x4bbefc={};_0x4bbefc[_0x2470ec[_0x1bd5('0x27')]]={'$like':'%'+_0xe54b9f[_0x1bd5('0x2f')]['filter']+'%'};return _0x4bbefc;}})});}_0x4e72b2=_[_0x1bd5('0x3c')]({},_0x4e72b2,_0xe54b9f[_0x1bd5('0x3f')]);var _0x20b25c={'where':_0x4e72b2['where']};return db[_0x1bd5('0x2a')][_0x1bd5('0x1d')](_0x20b25c)[_0x1bd5('0x40')](function(_0x4074f1){_0x472b22['count']=_0x4074f1;if(_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x41')]){_0x4e72b2[_0x1bd5('0x42')]=[{'all':!![]}];}return db[_0x1bd5('0x2a')]['findAll'](_0x4e72b2);})['then'](function(_0x40eeff){_0x472b22[_0x1bd5('0x43')]=_0x40eeff;return _0x472b22;})[_0x1bd5('0x40')](respondWithFilteredResult(_0xc73670,_0x4e72b2))['catch'](handleError(_0xc73670,null));};exports[_0x1bd5('0x44')]=function(_0x3b1092,_0x574d95){var _0x1eacac={'raw':!![],'where':{'id':_0x3b1092[_0x1bd5('0x45')]['id']}},_0x5761b8={};_0x5761b8[_0x1bd5('0x32')]=_['keys'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')]);_0x5761b8[_0x1bd5('0x2f')]=_[_0x1bd5('0x46')](_0x3b1092[_0x1bd5('0x2f')]);_0x5761b8[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],_0x5761b8[_0x1bd5('0x2f')]);_0x1eacac[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],qs['fields'](_0x3b1092[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x1eacac[_0x1bd5('0x33')]=_0x1eacac['attributes'][_0x1bd5('0x47')]?_0x1eacac[_0x1bd5('0x33')]:_0x5761b8['model'];if(_0x3b1092[_0x1bd5('0x2f')]['includeAll']){_0x1eacac[_0x1bd5('0x42')]=[{'all':!![]}];}_0x1eacac=_['merge']({},_0x1eacac,_0x3b1092[_0x1bd5('0x3f')]);return db[_0x1bd5('0x2a')]['find'](_0x1eacac)[_0x1bd5('0x40')](handleEntityNotFound(_0x574d95,null))['then'](respondWithResult(_0x574d95,null))[_0x1bd5('0x48')](handleError(_0x574d95,null));};exports[_0x1bd5('0x49')]=function(_0x1a29f3,_0xe71454){return db[_0x1bd5('0x2a')][_0x1bd5('0x49')]()[_0x1bd5('0x40')](respondWithResult(_0xe71454,null))[_0x1bd5('0x48')](handleError(_0xe71454,null));};exports['update']=function(_0x13985e,_0x227a68){if(_0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')]){delete _0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')];}return db['CmHopperFinal'][_0x1bd5('0x4c')]({'where':{'uniqueid':_0x13985e[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x227a68,null))[_0x1bd5('0x40')](saveUpdates(_0x13985e[_0x1bd5('0x4a')],null))[_0x1bd5('0x40')](respondWithResult(_0x227a68,null))[_0x1bd5('0x48')](handleError(_0x227a68,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x587c46,_0x126221,_0x2d713b){return db[_0x1bd5('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x587c46[_0x1bd5('0x45')]['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x51')))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x52')))),_0x1bd5('0x53')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x1bd5('0x54')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x55')))),_0x1bd5('0x56')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),_0x1bd5('0x58')],[db['sequelize']['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),'reCallContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x126221,null))['then'](respondWithResult(_0x126221,null))['catch'](handleError(_0x126221,null));};exports[_0x1bd5('0x5c')]=function(_0xec9fac,_0x1790af,_0x54a8c4){return db['CmHopperFinal'][_0x1bd5('0x5d')]({'raw':![],'where':{'CampaignId':_0xec9fac['params']['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5e')))),'congestionContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x55')))),'dropContacts'],[db[_0x1bd5('0x4d')]['fn']('COUNT',db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),'abandonedContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),_0x1bd5('0x5f')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x1790af,null))[_0x1bd5('0x40')](respondWithResult(_0x1790af,null))[_0x1bd5('0x48')](handleError(_0x1790af,null));};exports[_0x1bd5('0x60')]=function(_0x195176,_0x393a8f,_0x1ffbab){return db[_0x1bd5('0x61')][_0x1bd5('0x4c')]({'where':{'id':_0x195176[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x393a8f,null))['then'](function(_0x3bd058){var _0x1d6223;if(_0x3bd058){_0x1d6223=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),'scheduledAt',_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x69'),_0x1bd5('0x6a'),'updatedAt'],squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),'ContactId')['field'](_0x1bd5('0x71'),'ListId')[_0x1bd5('0x6c')](_0x1bd5('0x72'),'VoiceQueueId')[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x73'))['from'](_0x1bd5('0x74'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x195176[_0x1bd5('0x4a')][_0x1bd5('0x77')][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()['field'](_0x1bd5('0x66'))[_0x1bd5('0x7a')](_0x1bd5('0x64'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')['from']('cm_hopper_final')[_0x1bd5('0x39')]('VoiceQueueId\x20=\x20?',_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')](_0x1bd5('0x7c')))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db['sequelize'][_0x1bd5('0x2f')](_0x1d6223);}return[];})['then'](respondWithResult(_0x393a8f,null))[_0x1bd5('0x48')](handleError(_0x393a8f,null));};exports[_0x1bd5('0x7e')]=function(_0x7d097,_0x50f2ac,_0x5db61c){return db[_0x1bd5('0x7f')]['find']({'where':{'id':_0x7d097[_0x1bd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x50f2ac,null))[_0x1bd5('0x40')](function(_0x16f996){var _0x248d66;if(_0x16f996){_0x248d66=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),_0x1bd5('0x6f'),_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x80'),_0x1bd5('0x6a'),_0x1bd5('0x73')],squel['select']()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),_0x1bd5('0x67'))[_0x1bd5('0x6c')]('ANY_VALUE(ListId)',_0x1bd5('0x68'))[_0x1bd5('0x6c')](_0x1bd5('0x81'),_0x1bd5('0x80'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')]('NOW()',_0x1bd5('0x73'))[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x7d097['body']['state'][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))[_0x1bd5('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x66'))['from'](_0x1bd5('0x64'))['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')]('state\x20=\x204'))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db[_0x1bd5('0x4d')][_0x1bd5('0x2f')](_0x248d66);}return[];})[_0x1bd5('0x40')](respondWithResult(_0x50f2ac,null))[_0x1bd5('0x48')](handleError(_0x50f2ac,null));};exports[_0x1bd5('0x83')]=function(_0x22e1f4,_0x347d06,_0x3cf023){return db[_0x1bd5('0x84')][_0x1bd5('0x85')]({'where':{'VoiceQueueId':_0x22e1f4[_0x1bd5('0x4a')]['VoiceQueueId'],'CampaignId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x80')],'ContactId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x67')]}})[_0x1bd5('0x40')](handleEntityNotFound(_0x347d06,null))[_0x1bd5('0x40')](function(_0x28f567){if(_0x28f567){return _0x28f567;}return null;})[_0x1bd5('0x40')](respondWithResult(_0x347d06,null))[_0x1bd5('0x48')](handleError(_0x347d06,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 41c5a7e..690f696 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 _0xad2a=['moment','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api'];(function(_0x5add7c,_0x3b8f67){var _0x13e590=function(_0x37c902){while(--_0x37c902){_0x5add7c['push'](_0x5add7c['shift']());}};_0x13e590(++_0x3b8f67);}(_0xad2a,0x1cb));var _0xaad2=function(_0x240f82,_0x488d66){_0x240f82=_0x240f82-0x0;var _0x3245be=_0xad2a[_0x240f82];return _0x3245be;};'use strict';var _=require(_0xaad2('0x0'));var util=require(_0xaad2('0x1'));var logger=require('../../config/logger')(_0xaad2('0x2'));var moment=require(_0xaad2('0x3'));var BPromise=require(_0xaad2('0x4'));var rp=require(_0xaad2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaad2('0x6'));var attributes=require(_0xaad2('0x7'));module[_0xaad2('0x8')]=function(_0xbde63f,_0x50f204){return _0xbde63f[_0xaad2('0x9')](_0xaad2('0xa'),attributes,{'tableName':_0xaad2('0xb'),'paranoid':![],'indexes':[{'name':_0xaad2('0xc'),'fields':[_0xaad2('0xc')]},{'name':'uniqueid','fields':[_0xaad2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0adc=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes'];(function(_0x22dc2c,_0x4829f3){var _0x327e50=function(_0x25a9d5){while(--_0x25a9d5){_0x22dc2c['push'](_0x22dc2c['shift']());}};_0x327e50(++_0x4829f3);}(_0x0adc,0x1e5));var _0xc0ad=function(_0xad727e,_0x1088d2){_0xad727e=_0xad727e-0x0;var _0xb1d7b2=_0x0adc[_0xad727e];return _0xb1d7b2;};'use strict';var _=require(_0xc0ad('0x0'));var util=require(_0xc0ad('0x1'));var logger=require(_0xc0ad('0x2'))(_0xc0ad('0x3'));var moment=require(_0xc0ad('0x4'));var BPromise=require(_0xc0ad('0x5'));var rp=require(_0xc0ad('0x6'));var fs=require('fs');var path=require(_0xc0ad('0x7'));var rimraf=require(_0xc0ad('0x8'));var config=require('../../config/environment');var attributes=require(_0xc0ad('0x9'));module['exports']=function(_0x8dfaf8,_0x2a500a){return _0x8dfaf8[_0xc0ad('0xa')](_0xc0ad('0xb'),attributes,{'tableName':_0xc0ad('0xc'),'paranoid':![],'indexes':[{'name':_0xc0ad('0xd'),'fields':[_0xc0ad('0xd')]},{'name':_0xc0ad('0xe'),'fields':[_0xc0ad('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 022de2a..63b8bcc 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4344ff,_0xa30186){var _0x512609=function(_0xcee5b1){while(--_0xcee5b1){_0x4344ff['push'](_0x4344ff['shift']());}};_0x512609(++_0xa30186);}(_0xb10b,0x12a));var _0xbb10=function(_0x2330a1,_0x4bb8d3){_0x2330a1=_0x2330a1-0x0;var _0x32c0a6=_0xb10b[_0x2330a1];return _0x32c0a6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2adb30,_0x32650c){var _0x27f506=function(_0x4c0db0){while(--_0x4c0db0){_0x2adb30['push'](_0x2adb30['shift']());}};_0x27f506(++_0x32650c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e5d32,_0x19ce13){_0x3e5d32=_0x3e5d32-0x0;var _0x3e7822=_0xb10b[_0x3e5d32];return _0x3e7822;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 25ff15e..37b5a25 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 _0x8761=['util','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','exports'];(function(_0x491de3,_0xa9a4e4){var _0x2179a1=function(_0x156134){while(--_0x156134){_0x491de3['push'](_0x491de3['shift']());}};_0x2179a1(++_0xa9a4e4);}(_0x8761,0x168));var _0x1876=function(_0x4bce60,_0x2d1345){_0x4bce60=_0x4bce60-0x0;var _0x42175a=_0x8761[_0x4bce60];return _0x42175a;};'use strict';var multer=require('multer');var util=require(_0x1876('0x0'));var path=require('path');var timeout=require(_0x1876('0x1'));var express=require('express');var router=express[_0x1876('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1876('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1876('0x4'));var controller=require(_0x1876('0x5'));router[_0x1876('0x6')]('/',auth[_0x1876('0x7')](),controller[_0x1876('0x8')]);router[_0x1876('0x6')](_0x1876('0x9'),auth['isAuthenticated'](),controller[_0x1876('0xa')]);router[_0x1876('0x6')](_0x1876('0xb'),auth[_0x1876('0x7')](),controller[_0x1876('0xc')]);router[_0x1876('0x6')](_0x1876('0xd'),auth['isAuthenticated'](),controller[_0x1876('0xe')]);router[_0x1876('0x6')]('/campaign/countAttributes/:id',auth[_0x1876('0x7')](),controller[_0x1876('0xf')]);router[_0x1876('0x10')](_0x1876('0x11'),auth[_0x1876('0x7')](),controller[_0x1876('0x12')]);router['post'](_0x1876('0x13'),auth[_0x1876('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x1876('0x10')](_0x1876('0x14'),auth[_0x1876('0x7')](),controller[_0x1876('0x15')]);router[_0x1876('0x16')](_0x1876('0xb'),auth[_0x1876('0x7')](),controller['update']);module[_0x1876('0x17')]=router; \ No newline at end of file +var _0xa168=['put','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper'];(function(_0x278a8f,_0x2cddc3){var _0x41b514=function(_0x4c9f66){while(--_0x4c9f66){_0x278a8f['push'](_0x278a8f['shift']());}};_0x41b514(++_0x2cddc3);}(_0xa168,0x95));var _0x8a16=function(_0x3eb671,_0x1f2c1d){_0x3eb671=_0x3eb671-0x0;var _0x41eac5=_0xa168[_0x3eb671];return _0x41eac5;};'use strict';var multer=require(_0x8a16('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8a16('0x1'));var express=require(_0x8a16('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8a16('0x3'));var interaction=require(_0x8a16('0x4'));var config=require(_0x8a16('0x5'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x8a16('0x6')](),controller[_0x8a16('0x7')]);router['get'](_0x8a16('0x8'),auth[_0x8a16('0x6')](),controller[_0x8a16('0x9')]);router[_0x8a16('0xa')](_0x8a16('0xb'),auth[_0x8a16('0x6')](),controller['show']);router[_0x8a16('0xa')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x8a16('0xa')](_0x8a16('0xc'),auth[_0x8a16('0x6')](),controller[_0x8a16('0xd')]);router[_0x8a16('0xe')]('/voice/queue/moveContacts/:id',auth[_0x8a16('0x6')](),controller[_0x8a16('0xf')]);router[_0x8a16('0xe')](_0x8a16('0x10'),auth[_0x8a16('0x6')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x8a16('0x11'),auth[_0x8a16('0x6')](),controller[_0x8a16('0x12')]);router[_0x8a16('0x13')](_0x8a16('0xb'),auth[_0x8a16('0x6')](),controller['update']);module[_0x8a16('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index cc99fd9..ab649c9 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 _0xb2e1=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x10a154,_0x283602){var _0x24883a=function(_0x3ad744){while(--_0x3ad744){_0x10a154['push'](_0x10a154['shift']());}};_0x24883a(++_0x283602);}(_0xb2e1,0x1bf));var _0x1b2e=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0xb2e1[_0x4bfe08];return _0x1f9125;};'use strict';var Sequelize=require(_0x1b2e('0x0'));module[_0x1b2e('0x1')]={'state':{'type':Sequelize[_0x1b2e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1b2e('0x3')]},'scheduledat':{'type':Sequelize[_0x1b2e('0x4')]},'countbusyretry':{'type':Sequelize[_0x1b2e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1b2e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1b2e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1b2e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x1b2e('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1b2e('0x3')]},'calleridname':{'type':Sequelize[_0x1b2e('0x3')]},'starttime':{'type':Sequelize[_0x1b2e('0x4')]},'responsetime':{'type':Sequelize[_0x1b2e('0x4')]},'answertime':{'type':Sequelize[_0x1b2e('0x4')]},'droptime':{'type':Sequelize[_0x1b2e('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1b2e('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1b2e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1b2e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1b2e('0x3')]},'campaign':{'type':Sequelize[_0x1b2e('0x3')]},'campaigntype':{'type':Sequelize[_0x1b2e('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x1b2e('0x3')]},'amd':{'type':Sequelize[_0x1b2e('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1b2e('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1b2e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1b2e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1b2e('0x4')]},'recallme':{'type':Sequelize[_0x1b2e('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1b2e('0x4')]},'edited':{'type':Sequelize[_0x1b2e('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1b2e('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1b2e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1b2e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x49b7=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x47a67b,_0x52042d){var _0x498d4f=function(_0x53a3ed){while(--_0x53a3ed){_0x47a67b['push'](_0x47a67b['shift']());}};_0x498d4f(++_0x52042d);}(_0x49b7,0x8d));var _0x749b=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x49b7[_0x2f48cd];return _0x193ae2;};'use strict';var Sequelize=require(_0x749b('0x0'));module[_0x749b('0x1')]={'state':{'type':Sequelize[_0x749b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x749b('0x3')]},'scheduledat':{'type':Sequelize[_0x749b('0x4')]},'countbusyretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x749b('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x749b('0x3')]},'calleridnum':{'type':Sequelize[_0x749b('0x3')]},'calleridname':{'type':Sequelize[_0x749b('0x3')]},'starttime':{'type':Sequelize[_0x749b('0x4')]},'responsetime':{'type':Sequelize[_0x749b('0x4')]},'answertime':{'type':Sequelize[_0x749b('0x4')]},'droptime':{'type':Sequelize[_0x749b('0x4')]},'endtime':{'type':Sequelize[_0x749b('0x4')]},'ringtime':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x749b('0x3')]},'campaign':{'type':Sequelize[_0x749b('0x3')]},'campaigntype':{'type':Sequelize[_0x749b('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x749b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x749b('0x4')]},'edited':{'type':Sequelize[_0x749b('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x749b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 4d9cab2..bbd1f0c 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 _0x6e87=['nolimit','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','sendStatus','error','stack','name','send','map','CmHopperHistory','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x6e87,0x1df));var _0x76e8=function(_0x5afa1e,_0x53e2a8){_0x5afa1e=_0x5afa1e-0x0;var _0xd44a00=_0x6e87[_0x5afa1e];return _0xd44a00;};'use strict';var emlformat=require(_0x76e8('0x0'));var rimraf=require(_0x76e8('0x1'));var zipdir=require(_0x76e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76e8('0x3'));var moment=require(_0x76e8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76e8('0x5'));var util=require(_0x76e8('0x6'));var path=require(_0x76e8('0x7'));var sox=require(_0x76e8('0x8'));var csv=require(_0x76e8('0x9'));var ejs=require(_0x76e8('0xa'));var fs=require('fs');var fs_extra=require(_0x76e8('0xb'));var _=require(_0x76e8('0xc'));var squel=require(_0x76e8('0xd'));var crypto=require('crypto');var jsforce=require(_0x76e8('0xe'));var deskjs=require(_0x76e8('0xf'));var toCsv=require(_0x76e8('0x9'));var querystring=require(_0x76e8('0x10'));var Papa=require(_0x76e8('0x11'));var Redis=require(_0x76e8('0x12'));var authService=require(_0x76e8('0x13'));var qs=require(_0x76e8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x76e8('0x15'))('api');var utils=require(_0x76e8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x76e8('0x17'));var db=require(_0x76e8('0x18'))['db'];function respondWithStatusCode(_0x2e6631,_0x2d94e1){_0x2d94e1=_0x2d94e1||0xcc;return function(_0x1922b4){if(_0x1922b4){return _0x2e6631['sendStatus'](_0x2d94e1);}return _0x2e6631[_0x76e8('0x19')](_0x2d94e1)[_0x76e8('0x1a')]();};}function respondWithResult(_0x5a0c85,_0x2d2978){_0x2d2978=_0x2d2978||0xc8;return function(_0x3ebeed){if(_0x3ebeed){return _0x5a0c85[_0x76e8('0x19')](_0x2d2978)[_0x76e8('0x1b')](_0x3ebeed);}};}function respondWithFilteredResult(_0x31806d,_0x516f1f){return function(_0x1b17ac){if(_0x1b17ac){var _0x21145a=typeof _0x516f1f[_0x76e8('0x1c')]===_0x76e8('0x1d')&&typeof _0x516f1f[_0x76e8('0x1e')]===_0x76e8('0x1d');var _0x48bc15=_0x1b17ac[_0x76e8('0x1f')];var _0x48283b=_0x21145a?0x0:_0x516f1f[_0x76e8('0x1c')];var _0x207e94=_0x21145a?_0x1b17ac[_0x76e8('0x1f')]:_0x516f1f[_0x76e8('0x1c')]+_0x516f1f[_0x76e8('0x1e')];var _0x4da716;if(_0x207e94>=_0x48bc15){_0x207e94=_0x48bc15;_0x4da716=0xc8;}else{_0x4da716=0xce;}_0x31806d[_0x76e8('0x19')](_0x4da716);return _0x31806d[_0x76e8('0x20')]('Content-Range',_0x48283b+'-'+_0x207e94+'/'+_0x48bc15)['json'](_0x1b17ac);}return null;};}function patchUpdates(_0x31e2c3){return function(_0x1e6d9b){try{jsonpatch['apply'](_0x1e6d9b,_0x31e2c3,!![]);}catch(_0x4f74b8){return BPromise[_0x76e8('0x21')](_0x4f74b8);}return _0x1e6d9b[_0x76e8('0x22')]();};}function saveUpdates(_0x4a119e,_0x3bd7a7){return function(_0x5e9790){if(_0x5e9790){return _0x5e9790['update'](_0x4a119e)[_0x76e8('0x23')](function(_0xf4a84e){return _0xf4a84e;});}return null;};}function removeEntity(_0x510328,_0x3a1fc1){return function(_0x2247a4){if(_0x2247a4){return _0x2247a4[_0x76e8('0x24')]()[_0x76e8('0x23')](function(){_0x510328[_0x76e8('0x19')](0xcc)[_0x76e8('0x1a')]();});}};}function handleEntityNotFound(_0x1817bf,_0xa6b2a4){return function(_0x82dd31){if(!_0x82dd31){_0x1817bf[_0x76e8('0x25')](0x194);}return _0x82dd31;};}function handleError(_0x52178a,_0x492cda){_0x492cda=_0x492cda||0x1f4;return function(_0x2b3a93){logger[_0x76e8('0x26')](_0x2b3a93[_0x76e8('0x27')]);if(_0x2b3a93[_0x76e8('0x28')]){delete _0x2b3a93['name'];}_0x52178a[_0x76e8('0x19')](_0x492cda)[_0x76e8('0x29')](_0x2b3a93);};}exports['index']=function(_0x541ab3,_0xba0484){var _0x216b7d={},_0x1b7276={},_0x8a4342={'count':0x0,'rows':[]};var _0x25a07c=_[_0x76e8('0x2a')](db[_0x76e8('0x2b')]['rawAttributes'],function(_0x21e52c){return{'name':_0x21e52c['fieldName'],'type':_0x21e52c['type'][_0x76e8('0x2c')]};});_0x1b7276['model']=_['map'](_0x25a07c,_0x76e8('0x28'));_0x1b7276[_0x76e8('0x2d')]=_[_0x76e8('0x2e')](_0x541ab3[_0x76e8('0x2d')]);_0x1b7276[_0x76e8('0x2f')]=_[_0x76e8('0x30')](_0x1b7276[_0x76e8('0x31')],_0x1b7276['query']);_0x216b7d[_0x76e8('0x32')]=_['intersection'](_0x1b7276[_0x76e8('0x31')],qs[_0x76e8('0x33')](_0x541ab3[_0x76e8('0x2d')]['fields']));_0x216b7d[_0x76e8('0x32')]=_0x216b7d[_0x76e8('0x32')]['length']?_0x216b7d[_0x76e8('0x32')]:_0x1b7276[_0x76e8('0x31')];if(!_0x541ab3[_0x76e8('0x2d')][_0x76e8('0x34')](_0x76e8('0x35'))){_0x216b7d[_0x76e8('0x1e')]=qs['limit'](_0x541ab3['query'][_0x76e8('0x1e')]);_0x216b7d[_0x76e8('0x1c')]=qs['offset'](_0x541ab3['query']['offset']);}_0x216b7d['order']=qs[_0x76e8('0x36')](_0x541ab3[_0x76e8('0x2d')][_0x76e8('0x36')]);_0x216b7d['where']=qs[_0x76e8('0x2f')](_[_0x76e8('0x37')](_0x541ab3[_0x76e8('0x2d')],_0x1b7276[_0x76e8('0x2f')]),_0x25a07c);if(_0x541ab3[_0x76e8('0x2d')]['filter']){_0x216b7d[_0x76e8('0x38')]=_[_0x76e8('0x39')](_0x216b7d[_0x76e8('0x38')],{'$or':_[_0x76e8('0x2a')](_0x25a07c,function(_0x4cbcea){if(_0x4cbcea[_0x76e8('0x3a')]!==_0x76e8('0x3b')){var _0x1a8cd1={};_0x1a8cd1[_0x4cbcea['name']]={'$like':'%'+_0x541ab3[_0x76e8('0x2d')]['filter']+'%'};return _0x1a8cd1;}})});}_0x216b7d=_['merge']({},_0x216b7d,_0x541ab3[_0x76e8('0x3c')]);var _0x141163={'where':_0x216b7d[_0x76e8('0x38')]};return db[_0x76e8('0x2b')][_0x76e8('0x1f')](_0x141163)[_0x76e8('0x23')](function(_0x5ae3ae){_0x8a4342[_0x76e8('0x1f')]=_0x5ae3ae;if(_0x541ab3[_0x76e8('0x2d')][_0x76e8('0x3d')]){_0x216b7d[_0x76e8('0x3e')]=[{'all':!![]}];}return db[_0x76e8('0x2b')][_0x76e8('0x3f')](_0x216b7d);})[_0x76e8('0x23')](function(_0x1f6e59){_0x8a4342[_0x76e8('0x40')]=_0x1f6e59;return _0x8a4342;})['then'](respondWithFilteredResult(_0xba0484,_0x216b7d))['catch'](handleError(_0xba0484,null));};exports[_0x76e8('0x41')]=function(_0x4c0736,_0x3e69a4){var _0x294798={'raw':!![],'where':{'id':_0x4c0736[_0x76e8('0x42')]['id']}},_0x31ab40={};_0x31ab40[_0x76e8('0x31')]=_[_0x76e8('0x2e')](db[_0x76e8('0x2b')][_0x76e8('0x43')]);_0x31ab40[_0x76e8('0x2d')]=_['keys'](_0x4c0736['query']);_0x31ab40[_0x76e8('0x2f')]=_['intersection'](_0x31ab40['model'],_0x31ab40[_0x76e8('0x2d')]);_0x294798[_0x76e8('0x32')]=_['intersection'](_0x31ab40[_0x76e8('0x31')],qs[_0x76e8('0x33')](_0x4c0736[_0x76e8('0x2d')]['fields']));_0x294798[_0x76e8('0x32')]=_0x294798['attributes'][_0x76e8('0x44')]?_0x294798[_0x76e8('0x32')]:_0x31ab40[_0x76e8('0x31')];if(_0x4c0736[_0x76e8('0x2d')]['includeAll']){_0x294798[_0x76e8('0x3e')]=[{'all':!![]}];}_0x294798=_[_0x76e8('0x39')]({},_0x294798,_0x4c0736[_0x76e8('0x3c')]);return db[_0x76e8('0x2b')][_0x76e8('0x45')](_0x294798)[_0x76e8('0x23')](handleEntityNotFound(_0x3e69a4,null))[_0x76e8('0x23')](respondWithResult(_0x3e69a4,null))[_0x76e8('0x46')](handleError(_0x3e69a4,null));};exports[_0x76e8('0x47')]=function(_0x3db93c,_0x4101fe){return db['CmHopperHistory']['create'](_0x3db93c[_0x76e8('0x48')],{})[_0x76e8('0x23')](respondWithResult(_0x4101fe,0xc9))[_0x76e8('0x46')](handleError(_0x4101fe,null));};exports[_0x76e8('0x49')]=function(_0x45149f,_0x3b45cb){return db[_0x76e8('0x2b')]['describe']()[_0x76e8('0x23')](respondWithResult(_0x3b45cb,null))[_0x76e8('0x46')](handleError(_0x3b45cb,null));};exports[_0x76e8('0x4a')]=function(_0x39ba2d,_0x3bc776){if(_0x39ba2d[_0x76e8('0x48')][_0x76e8('0x4b')]){delete _0x39ba2d[_0x76e8('0x48')][_0x76e8('0x4b')];}return db[_0x76e8('0x2b')][_0x76e8('0x45')]({'where':{'uniqueid':_0x39ba2d['params']['id']}})[_0x76e8('0x23')](handleEntityNotFound(_0x3bc776,null))[_0x76e8('0x23')](saveUpdates(_0x39ba2d[_0x76e8('0x48')],null))[_0x76e8('0x23')](respondWithResult(_0x3bc776,null))[_0x76e8('0x46')](handleError(_0x3bc776,null));}; \ No newline at end of file +var _0xd883=['sendStatus','error','stack','name','send','index','map','CmHopperHistory','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','keys','options','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy'];(function(_0x5a03fa,_0xcf3275){var _0x29e6c2=function(_0x10638b){while(--_0x10638b){_0x5a03fa['push'](_0x5a03fa['shift']());}};_0x29e6c2(++_0xcf3275);}(_0xd883,0xc8));var _0x3d88=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xd883[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0x3d88('0x0'));var rimraf=require(_0x3d88('0x1'));var zipdir=require(_0x3d88('0x2'));var jsonpatch=require(_0x3d88('0x3'));var rp=require(_0x3d88('0x4'));var moment=require(_0x3d88('0x5'));var BPromise=require(_0x3d88('0x6'));var Mustache=require('mustache');var util=require(_0x3d88('0x7'));var path=require(_0x3d88('0x8'));var sox=require(_0x3d88('0x9'));var csv=require(_0x3d88('0xa'));var ejs=require(_0x3d88('0xb'));var fs=require('fs');var fs_extra=require(_0x3d88('0xc'));var _=require(_0x3d88('0xd'));var squel=require(_0x3d88('0xe'));var crypto=require(_0x3d88('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3d88('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3d88('0x11'));var Papa=require(_0x3d88('0x12'));var Redis=require(_0x3d88('0x13'));var authService=require(_0x3d88('0x14'));var qs=require(_0x3d88('0x15'));var as=require(_0x3d88('0x16'));var hardwareService=require(_0x3d88('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x3d88('0x18'));var config=require(_0x3d88('0x19'));var licenseUtil=require(_0x3d88('0x1a'));var db=require(_0x3d88('0x1b'))['db'];function respondWithStatusCode(_0x2923d8,_0x38057d){_0x38057d=_0x38057d||0xcc;return function(_0x1f4883){if(_0x1f4883){return _0x2923d8['sendStatus'](_0x38057d);}return _0x2923d8['status'](_0x38057d)[_0x3d88('0x1c')]();};}function respondWithResult(_0x5e9673,_0x3d18ee){_0x3d18ee=_0x3d18ee||0xc8;return function(_0x8b5a45){if(_0x8b5a45){return _0x5e9673[_0x3d88('0x1d')](_0x3d18ee)[_0x3d88('0x1e')](_0x8b5a45);}};}function respondWithFilteredResult(_0x592d05,_0x1aae4b){return function(_0x43a79e){if(_0x43a79e){var _0x19d74a=typeof _0x1aae4b[_0x3d88('0x1f')]===_0x3d88('0x20')&&typeof _0x1aae4b['limit']==='undefined';var _0x168716=_0x43a79e[_0x3d88('0x21')];var _0x5984fc=_0x19d74a?0x0:_0x1aae4b[_0x3d88('0x1f')];var _0x20cfea=_0x19d74a?_0x43a79e[_0x3d88('0x21')]:_0x1aae4b['offset']+_0x1aae4b['limit'];var _0x57d286;if(_0x20cfea>=_0x168716){_0x20cfea=_0x168716;_0x57d286=0xc8;}else{_0x57d286=0xce;}_0x592d05[_0x3d88('0x1d')](_0x57d286);return _0x592d05[_0x3d88('0x22')](_0x3d88('0x23'),_0x5984fc+'-'+_0x20cfea+'/'+_0x168716)[_0x3d88('0x1e')](_0x43a79e);}return null;};}function patchUpdates(_0x10d7c0){return function(_0x1e5c3c){try{jsonpatch[_0x3d88('0x24')](_0x1e5c3c,_0x10d7c0,!![]);}catch(_0x5c0b3a){return BPromise['reject'](_0x5c0b3a);}return _0x1e5c3c['save']();};}function saveUpdates(_0x138d8d,_0x5b8a61){return function(_0x699408){if(_0x699408){return _0x699408[_0x3d88('0x25')](_0x138d8d)[_0x3d88('0x26')](function(_0x387fcf){return _0x387fcf;});}return null;};}function removeEntity(_0x2f3387,_0x411460){return function(_0x351ed5){if(_0x351ed5){return _0x351ed5[_0x3d88('0x27')]()[_0x3d88('0x26')](function(){_0x2f3387[_0x3d88('0x1d')](0xcc)[_0x3d88('0x1c')]();});}};}function handleEntityNotFound(_0x384205,_0x5e0cec){return function(_0x53eef2){if(!_0x53eef2){_0x384205[_0x3d88('0x28')](0x194);}return _0x53eef2;};}function handleError(_0xed8f1d,_0x1e4209){_0x1e4209=_0x1e4209||0x1f4;return function(_0x42ee1e){logger[_0x3d88('0x29')](_0x42ee1e[_0x3d88('0x2a')]);if(_0x42ee1e[_0x3d88('0x2b')]){delete _0x42ee1e[_0x3d88('0x2b')];}_0xed8f1d[_0x3d88('0x1d')](_0x1e4209)[_0x3d88('0x2c')](_0x42ee1e);};}exports[_0x3d88('0x2d')]=function(_0x363f8d,_0x56ef60){var _0x5f5013={},_0x43922f={},_0x56983d={'count':0x0,'rows':[]};var _0x1c858c=_[_0x3d88('0x2e')](db[_0x3d88('0x2f')]['rawAttributes'],function(_0x41becd){return{'name':_0x41becd[_0x3d88('0x30')],'type':_0x41becd[_0x3d88('0x31')]['key']};});_0x43922f['model']=_['map'](_0x1c858c,_0x3d88('0x2b'));_0x43922f[_0x3d88('0x32')]=_['keys'](_0x363f8d[_0x3d88('0x32')]);_0x43922f[_0x3d88('0x33')]=_[_0x3d88('0x34')](_0x43922f[_0x3d88('0x35')],_0x43922f[_0x3d88('0x32')]);_0x5f5013[_0x3d88('0x36')]=_['intersection'](_0x43922f['model'],qs['fields'](_0x363f8d['query'][_0x3d88('0x37')]));_0x5f5013[_0x3d88('0x36')]=_0x5f5013['attributes'][_0x3d88('0x38')]?_0x5f5013[_0x3d88('0x36')]:_0x43922f[_0x3d88('0x35')];if(!_0x363f8d[_0x3d88('0x32')][_0x3d88('0x39')](_0x3d88('0x3a'))){_0x5f5013[_0x3d88('0x3b')]=qs[_0x3d88('0x3b')](_0x363f8d[_0x3d88('0x32')]['limit']);_0x5f5013['offset']=qs[_0x3d88('0x1f')](_0x363f8d[_0x3d88('0x32')][_0x3d88('0x1f')]);}_0x5f5013['order']=qs[_0x3d88('0x3c')](_0x363f8d[_0x3d88('0x32')][_0x3d88('0x3c')]);_0x5f5013[_0x3d88('0x3d')]=qs[_0x3d88('0x33')](_[_0x3d88('0x3e')](_0x363f8d[_0x3d88('0x32')],_0x43922f[_0x3d88('0x33')]),_0x1c858c);if(_0x363f8d[_0x3d88('0x32')][_0x3d88('0x3f')]){_0x5f5013[_0x3d88('0x3d')]=_[_0x3d88('0x40')](_0x5f5013['where'],{'$or':_[_0x3d88('0x2e')](_0x1c858c,function(_0x2477e5){if(_0x2477e5[_0x3d88('0x31')]!==_0x3d88('0x41')){var _0x3dac39={};_0x3dac39[_0x2477e5[_0x3d88('0x2b')]]={'$like':'%'+_0x363f8d[_0x3d88('0x32')][_0x3d88('0x3f')]+'%'};return _0x3dac39;}})});}_0x5f5013=_[_0x3d88('0x40')]({},_0x5f5013,_0x363f8d['options']);var _0x3c700d={'where':_0x5f5013[_0x3d88('0x3d')]};return db[_0x3d88('0x2f')][_0x3d88('0x21')](_0x3c700d)['then'](function(_0x3a9cf6){_0x56983d[_0x3d88('0x21')]=_0x3a9cf6;if(_0x363f8d[_0x3d88('0x32')][_0x3d88('0x42')]){_0x5f5013[_0x3d88('0x43')]=[{'all':!![]}];}return db[_0x3d88('0x2f')]['findAll'](_0x5f5013);})[_0x3d88('0x26')](function(_0x23ff30){_0x56983d[_0x3d88('0x44')]=_0x23ff30;return _0x56983d;})[_0x3d88('0x26')](respondWithFilteredResult(_0x56ef60,_0x5f5013))[_0x3d88('0x45')](handleError(_0x56ef60,null));};exports[_0x3d88('0x46')]=function(_0x3f4da5,_0x502bc6){var _0x11c5ca={'raw':!![],'where':{'id':_0x3f4da5[_0x3d88('0x47')]['id']}},_0x78786b={};_0x78786b[_0x3d88('0x35')]=_['keys'](db[_0x3d88('0x2f')][_0x3d88('0x48')]);_0x78786b[_0x3d88('0x32')]=_[_0x3d88('0x49')](_0x3f4da5[_0x3d88('0x32')]);_0x78786b[_0x3d88('0x33')]=_['intersection'](_0x78786b[_0x3d88('0x35')],_0x78786b[_0x3d88('0x32')]);_0x11c5ca['attributes']=_['intersection'](_0x78786b[_0x3d88('0x35')],qs[_0x3d88('0x37')](_0x3f4da5[_0x3d88('0x32')][_0x3d88('0x37')]));_0x11c5ca[_0x3d88('0x36')]=_0x11c5ca['attributes'][_0x3d88('0x38')]?_0x11c5ca[_0x3d88('0x36')]:_0x78786b[_0x3d88('0x35')];if(_0x3f4da5['query']['includeAll']){_0x11c5ca['include']=[{'all':!![]}];}_0x11c5ca=_[_0x3d88('0x40')]({},_0x11c5ca,_0x3f4da5[_0x3d88('0x4a')]);return db[_0x3d88('0x2f')][_0x3d88('0x4b')](_0x11c5ca)[_0x3d88('0x26')](handleEntityNotFound(_0x502bc6,null))[_0x3d88('0x26')](respondWithResult(_0x502bc6,null))['catch'](handleError(_0x502bc6,null));};exports[_0x3d88('0x4c')]=function(_0x3b33ca,_0x3af7a8){return db['CmHopperHistory'][_0x3d88('0x4c')](_0x3b33ca[_0x3d88('0x4d')],{})[_0x3d88('0x26')](respondWithResult(_0x3af7a8,0xc9))['catch'](handleError(_0x3af7a8,null));};exports['describe']=function(_0x47e823,_0xa28ff6){return db[_0x3d88('0x2f')][_0x3d88('0x4e')]()[_0x3d88('0x26')](respondWithResult(_0xa28ff6,null))[_0x3d88('0x45')](handleError(_0xa28ff6,null));};exports['update']=function(_0x3f35fe,_0x19271f){if(_0x3f35fe[_0x3d88('0x4d')]['uniqueid']){delete _0x3f35fe[_0x3d88('0x4d')][_0x3d88('0x4f')];}return db[_0x3d88('0x2f')][_0x3d88('0x4b')]({'where':{'uniqueid':_0x3f35fe[_0x3d88('0x47')]['id']}})['then'](handleEntityNotFound(_0x19271f,null))[_0x3d88('0x26')](saveUpdates(_0x3f35fe[_0x3d88('0x4d')],null))[_0x3d88('0x26')](respondWithResult(_0x19271f,null))[_0x3d88('0x45')](handleError(_0x19271f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 18c181d..fcaf3fa 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 _0x2d0b=['api','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2d0b,0x102));var _0xb2d0=function(_0x50cb4f,_0x544d36){_0x50cb4f=_0x50cb4f-0x0;var _0x5463ca=_0x2d0b[_0x50cb4f];return _0x5463ca;};'use strict';var _=require('lodash');var util=require(_0xb2d0('0x0'));var logger=require(_0xb2d0('0x1'))(_0xb2d0('0x2'));var moment=require('moment');var BPromise=require(_0xb2d0('0x3'));var rp=require(_0xb2d0('0x4'));var fs=require('fs');var path=require(_0xb2d0('0x5'));var rimraf=require(_0xb2d0('0x6'));var config=require('../../config/environment');var attributes=require(_0xb2d0('0x7'));module['exports']=function(_0x395e69,_0x41521f){return _0x395e69[_0xb2d0('0x8')](_0xb2d0('0x9'),attributes,{'tableName':_0xb2d0('0xa'),'paranoid':![],'indexes':[{'name':_0xb2d0('0xb'),'fields':[_0xb2d0('0xb')]},{'name':_0xb2d0('0xc'),'fields':[_0xb2d0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf65d=['cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x14bfbf,_0x552595){var _0x3a29d4=function(_0x1fae62){while(--_0x1fae62){_0x14bfbf['push'](_0x14bfbf['shift']());}};_0x3a29d4(++_0x552595);}(_0xf65d,0x9f));var _0xdf65=function(_0x3f0743,_0x19c784){_0x3f0743=_0x3f0743-0x0;var _0x291c35=_0xf65d[_0x3f0743];return _0x291c35;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('CmHopperHistory',attributes,{'tableName':_0xdf65('0x9'),'paranoid':![],'indexes':[{'name':_0xdf65('0xa'),'fields':[_0xdf65('0xa')]},{'name':_0xdf65('0xb'),'fields':[_0xdf65('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index ad60da5..5c35e72 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 _0xc743=['CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperHistory,\x20%s,\x20%s','message','info','catch','CreateCmHopperHistory'];(function(_0x3a7258,_0x4f9d4f){var _0x2f6012=function(_0x237b44){while(--_0x237b44){_0x3a7258['push'](_0x3a7258['shift']());}};_0x2f6012(++_0x4f9d4f);}(_0xc743,0x15c));var _0x3c74=function(_0x2cf37c,_0x3f9ce3){_0x2cf37c=_0x2cf37c-0x0;var _0x5cc456=_0xc743[_0x2cf37c];return _0x5cc456;};'use strict';var _=require('lodash');var util=require(_0x3c74('0x0'));var moment=require('moment');var BPromise=require(_0x3c74('0x1'));var rs=require(_0x3c74('0x2'));var fs=require('fs');var Redis=require(_0x3c74('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c74('0x4'))(_0x3c74('0x5'));var config=require(_0x3c74('0x6'));var jayson=require(_0x3c74('0x7'));var client=jayson[_0x3c74('0x8')][_0x3c74('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dde75,_0x4aac2e,_0x39fc3f){return new BPromise(function(_0x337754,_0x4991b7){return client[_0x3c74('0xa')](_0x3dde75,_0x39fc3f)[_0x3c74('0xb')](function(_0x206322){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x4aac2e,'request\x20sent');logger[_0x3c74('0xc')](_0x3c74('0xd'),_0x4aac2e,_0x3c74('0xe'),JSON['stringify'](_0x206322));if(_0x206322[_0x3c74('0xf')]){if(_0x206322[_0x3c74('0xf')][_0x3c74('0x10')]===0x1f4){logger[_0x3c74('0xf')](_0x3c74('0x11'),_0x4aac2e,_0x206322['error']['message']);return _0x4991b7(_0x206322[_0x3c74('0xf')][_0x3c74('0x12')]);}logger[_0x3c74('0xf')](_0x3c74('0x11'),_0x4aac2e,_0x206322[_0x3c74('0xf')][_0x3c74('0x12')]);return _0x337754(_0x206322['error']['message']);}else{logger[_0x3c74('0x13')](_0x3c74('0x11'),_0x4aac2e,'request\x20sent');_0x337754(_0x206322['result'][_0x3c74('0x12')]);}})[_0x3c74('0x14')](function(_0xd23661){logger['error'](_0x3c74('0x11'),_0x4aac2e,_0xd23661);_0x4991b7(_0xd23661);});});}exports[_0x3c74('0x15')]=function(_0x307055){var _0x3709b1=this;return new Promise(function(_0x29c147,_0x15bf26){return db[_0x3c74('0x16')][_0x3c74('0x17')](_0x307055[_0x3c74('0x18')],{'raw':_0x307055[_0x3c74('0x19')]?_0x307055['options'][_0x3c74('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2064e0){logger['info'](_0x3c74('0x15'),_0x307055);logger[_0x3c74('0xc')](_0x3c74('0x15'),_0x307055,JSON[_0x3c74('0x1b')](_0x2064e0));_0x29c147(_0x2064e0);})[_0x3c74('0x14')](function(_0x54ff2a){logger[_0x3c74('0xf')](_0x3c74('0x15'),_0x54ff2a[_0x3c74('0x12')],_0x307055);_0x15bf26(_0x3709b1['error'](0x1f4,_0x54ff2a[_0x3c74('0x12')]));});});};exports[_0x3c74('0x1c')]=function(_0x481457){var _0x2331c9=this;return new Promise(function(_0x4d2535,_0x24aacc){return db['CmHopperHistory'][_0x3c74('0x1d')]({'raw':_0x481457[_0x3c74('0x19')]?_0x481457['options']['raw']===undefined?!![]:![]:!![],'where':_0x481457[_0x3c74('0x19')]?_0x481457[_0x3c74('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')][_0x3c74('0x20')]('id')),_0x3c74('0x21')],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')]['fn']('IF',db['sequelize'][_0x3c74('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x3c74('0x23')],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')][_0x3c74('0x22')](_0x3c74('0x24')))),_0x3c74('0x25')],[db['sequelize']['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')][_0x3c74('0x22')](_0x3c74('0x26')))),_0x3c74('0x27')],[db['sequelize']['fn'](_0x3c74('0x28'),db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')][_0x3c74('0x22')](_0x3c74('0x29')))),'predictiveIntervalAvgHoldtime'],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0x3c74('0x22')](_0x3c74('0x2a')))),_0x3c74('0x2b')]]})[_0x3c74('0xb')](function(_0x26db44){logger[_0x3c74('0x13')](_0x3c74('0x1c'),_0x481457);logger[_0x3c74('0xc')](_0x3c74('0x1c'),_0x481457,JSON[_0x3c74('0x1b')](_0x26db44));_0x4d2535(_0x26db44);})[_0x3c74('0x14')](function(_0x11c667){logger['error'](_0x3c74('0x1c'),_0x11c667[_0x3c74('0x12')],_0x481457);_0x24aacc(_0x2331c9['error'](0x1f4,_0x11c667[_0x3c74('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x173268){var _0x309fce=this;return new Promise(function(_0x3106ea,_0x16a2ff){return db[_0x3c74('0x16')][_0x3c74('0x1d')]({'raw':_0x173268[_0x3c74('0x19')]?_0x173268[_0x3c74('0x19')][_0x3c74('0x1a')]===undefined?!![]:![]:!![],'where':_0x173268[_0x3c74('0x19')]?_0x173268[_0x3c74('0x19')][_0x3c74('0x2c')]||null:null,'attributes':[['campaign','name'],[db[_0x3c74('0x1f')]['fn']('COUNT',db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')]['literal'](_0x3c74('0x2d')))),_0x3c74('0x2e')],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')][_0x3c74('0x22')](_0x3c74('0x2f')))),_0x3c74('0x30')],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x1e'),db['sequelize']['fn']('IF',db[_0x3c74('0x1f')]['literal'](_0x3c74('0x31')))),_0x3c74('0x32')],[db[_0x3c74('0x1f')]['fn']('COUNT',db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')][_0x3c74('0x22')](_0x3c74('0x33')))),_0x3c74('0x34')],[db['sequelize']['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')]['fn']('IF',db['sequelize'][_0x3c74('0x22')](_0x3c74('0x35')))),_0x3c74('0x36')],[db['sequelize']['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')]['literal'](_0x3c74('0x37')))),_0x3c74('0x38')],[db[_0x3c74('0x1f')]['fn']('COUNT',db[_0x3c74('0x1f')]['fn']('IF',db['sequelize'][_0x3c74('0x22')](_0x3c74('0x39')))),_0x3c74('0x3a')],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')][_0x3c74('0x22')](_0x3c74('0x3b')))),'outboundUnknownCallsDay'],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3c74('0x3c')))),_0x3c74('0x3d')],[db['sequelize']['fn'](_0x3c74('0x1e'),db['sequelize']['fn']('IF',db[_0x3c74('0x1f')][_0x3c74('0x22')](_0x3c74('0x3e')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3c74('0x1f')]['literal'](_0x3c74('0x3f')))),_0x3c74('0x40')],[db[_0x3c74('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3c74('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')][_0x3c74('0x22')](_0x3c74('0x41')))),_0x3c74('0x40')],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')][_0x3c74('0x22')](_0x3c74('0x42')))),_0x3c74('0x43')]],'group':[_0x3c74('0x44')]})[_0x3c74('0xb')](function(_0x1052b3){logger[_0x3c74('0x13')](_0x3c74('0x45'),_0x173268);logger[_0x3c74('0xc')](_0x3c74('0x45'),_0x173268,JSON['stringify'](_0x1052b3));_0x3106ea(_0x1052b3);})[_0x3c74('0x14')](function(_0x3713da){logger[_0x3c74('0xf')]('GetVoiceQueueHopperHistory',_0x3713da['message'],_0x173268);_0x16a2ff(_0x309fce[_0x3c74('0xf')](0x1f4,_0x3713da[_0x3c74('0x12')]));});});};exports[_0x3c74('0x46')]=function(_0x3fb7e6){var _0x1cbcc7=this;return new Promise(function(_0x13c988,_0x291c50){return db['CmHopperHistory']['findAll']({'raw':_0x3fb7e6['options']?_0x3fb7e6[_0x3c74('0x19')][_0x3c74('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fb7e6['options']?_0x3fb7e6[_0x3c74('0x19')][_0x3c74('0x2c')]||null:null,'attributes':[[_0x3c74('0x44'),_0x3c74('0x47')],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')][_0x3c74('0x20')]('id')),_0x3c74('0x48')],[db[_0x3c74('0x1f')]['fn'](_0x3c74('0x1e'),db[_0x3c74('0x1f')]['fn']('IF',db[_0x3c74('0x1f')][_0x3c74('0x22')](_0x3c74('0x31')))),_0x3c74('0x49')]],'group':['campaign']})[_0x3c74('0xb')](function(_0xbdab7e){logger[_0x3c74('0x13')](_0x3c74('0x46'),_0x3fb7e6);logger[_0x3c74('0xc')](_0x3c74('0x46'),_0x3fb7e6,JSON[_0x3c74('0x1b')](_0xbdab7e));_0x13c988(_0xbdab7e);})[_0x3c74('0x14')](function(_0x230c4d){logger['error']('GetCampaignHopperHistory',_0x230c4d[_0x3c74('0x12')],_0x3fb7e6);_0x291c50(_0x1cbcc7[_0x3c74('0xf')](0x1f4,_0x230c4d[_0x3c74('0x12')]));});});}; \ No newline at end of file +var _0xb921=['outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','where','sequelize','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','literal','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null'];(function(_0x3491f5,_0x222f0c){var _0x26e38a=function(_0x58392b){while(--_0x58392b){_0x3491f5['push'](_0x3491f5['shift']());}};_0x26e38a(++_0x222f0c);}(_0xb921,0x16a));var _0x1b92=function(_0x2c823e,_0x1067c9){_0x2c823e=_0x2c823e-0x0;var _0x21b297=_0xb921[_0x2c823e];return _0x21b297;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a6282,_0x7973df,_0x352406){return new BPromise(function(_0x1545f9,_0x64a3ed){return client[_0x1b92('0xc')](_0x8a6282,_0x352406)[_0x1b92('0xd')](function(_0x4567ab){logger['info'](_0x1b92('0xe'),_0x7973df,_0x1b92('0xf'));logger[_0x1b92('0x10')](_0x1b92('0x11'),_0x7973df,_0x1b92('0xf'),JSON[_0x1b92('0x12')](_0x4567ab));if(_0x4567ab[_0x1b92('0x13')]){if(_0x4567ab['error'][_0x1b92('0x14')]===0x1f4){logger[_0x1b92('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x7973df,_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);return _0x64a3ed(_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);}logger[_0x1b92('0x13')](_0x1b92('0xe'),_0x7973df,_0x4567ab[_0x1b92('0x13')]['message']);return _0x1545f9(_0x4567ab[_0x1b92('0x13')]['message']);}else{logger[_0x1b92('0x16')]('CmHopperHistory,\x20%s,\x20%s',_0x7973df,_0x1b92('0xf'));_0x1545f9(_0x4567ab['result'][_0x1b92('0x15')]);}})[_0x1b92('0x17')](function(_0x688aef){logger['error'](_0x1b92('0xe'),_0x7973df,_0x688aef);_0x64a3ed(_0x688aef);});});}exports[_0x1b92('0x18')]=function(_0x289523){var _0xf62817=this;return new Promise(function(_0x4368dc,_0x5010cd){return db[_0x1b92('0x19')][_0x1b92('0x1a')](_0x289523[_0x1b92('0x1b')],{'raw':_0x289523['options']?_0x289523[_0x1b92('0x1c')][_0x1b92('0x1d')]===undefined?!![]:![]:!![]})[_0x1b92('0xd')](function(_0x4bfc51){logger[_0x1b92('0x16')]('CreateCmHopperHistory',_0x289523);logger[_0x1b92('0x10')](_0x1b92('0x18'),_0x289523,JSON['stringify'](_0x4bfc51));_0x4368dc(_0x4bfc51);})['catch'](function(_0x34c5c9){logger[_0x1b92('0x13')](_0x1b92('0x18'),_0x34c5c9[_0x1b92('0x15')],_0x289523);_0x5010cd(_0xf62817[_0x1b92('0x13')](0x1f4,_0x34c5c9[_0x1b92('0x15')]));});});};exports['AvgHandleTime']=function(_0x3be220){var _0x1dcdd5=this;return new Promise(function(_0x2c8580,_0x39dcaa){return db['CmHopperHistory'][_0x1b92('0x1e')]({'raw':_0x3be220['options']?_0x3be220[_0x1b92('0x1c')][_0x1b92('0x1d')]===undefined?!![]:![]:!![],'where':_0x3be220[_0x1b92('0x1c')]?_0x3be220[_0x1b92('0x1c')][_0x1b92('0x1f')]||null:null,'attributes':[[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['col']('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')]['literal'](_0x1b92('0x22')))),_0x1b92('0x23')],[db[_0x1b92('0x20')]['fn']('COUNT',db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x1b92('0x24')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')]['literal'](_0x1b92('0x25')))),_0x1b92('0x26')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x27'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x1b92('0x29')],[db[_0x1b92('0x20')]['fn']('AVG',db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x1b92('0x2a')]]})[_0x1b92('0xd')](function(_0x5cce14){logger['info'](_0x1b92('0x2b'),_0x3be220);logger[_0x1b92('0x10')](_0x1b92('0x2b'),_0x3be220,JSON[_0x1b92('0x12')](_0x5cce14));_0x2c8580(_0x5cce14);})['catch'](function(_0x5f0543){logger['error'](_0x1b92('0x2b'),_0x5f0543[_0x1b92('0x15')],_0x3be220);_0x39dcaa(_0x1dcdd5[_0x1b92('0x13')](0x1f4,_0x5f0543[_0x1b92('0x15')]));});});};exports[_0x1b92('0x2c')]=function(_0x258b34){var _0x3f629e=this;return new Promise(function(_0x55389f,_0x351ac0){return db[_0x1b92('0x19')]['findAll']({'raw':_0x258b34[_0x1b92('0x1c')]?_0x258b34[_0x1b92('0x1c')][_0x1b92('0x1d')]===undefined?!![]:![]:!![],'where':_0x258b34[_0x1b92('0x1c')]?_0x258b34[_0x1b92('0x1c')][_0x1b92('0x1f')]||null:null,'attributes':[[_0x1b92('0x2d'),_0x1b92('0x2e')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')]['literal'](_0x1b92('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x30')))),_0x1b92('0x31')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')]['literal'](_0x1b92('0x22')))),_0x1b92('0x32')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x33')))),_0x1b92('0x34')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x35')))),_0x1b92('0x36')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1b92('0x37')],[db['sequelize']['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')]['literal'](_0x1b92('0x38')))),_0x1b92('0x39')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x3a')))),_0x1b92('0x3b')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')]('`state`\x20=\x2013,\x201,\x20null'))),_0x1b92('0x3c')],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x3d')))),_0x1b92('0x3e')],[db[_0x1b92('0x20')]['fn']('COUNT',db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x3f')))),_0x1b92('0x40')],[db['sequelize']['fn']('COUNT',db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x41')))),'outboundAnswerAgiCallsDay'],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db['sequelize']['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x42')))),'outboundRejectCallsDay'],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x43')))),_0x1b92('0x44')]],'group':[_0x1b92('0x2d')]})['then'](function(_0x140202){logger['info'](_0x1b92('0x2c'),_0x258b34);logger[_0x1b92('0x10')](_0x1b92('0x2c'),_0x258b34,JSON[_0x1b92('0x12')](_0x140202));_0x55389f(_0x140202);})[_0x1b92('0x17')](function(_0x3cab8e){logger[_0x1b92('0x13')](_0x1b92('0x2c'),_0x3cab8e[_0x1b92('0x15')],_0x258b34);_0x351ac0(_0x3f629e[_0x1b92('0x13')](0x1f4,_0x3cab8e[_0x1b92('0x15')]));});});};exports[_0x1b92('0x45')]=function(_0x80e88b){var _0x181e03=this;return new Promise(function(_0x2304ef,_0x1e9888){return db[_0x1b92('0x19')][_0x1b92('0x1e')]({'raw':_0x80e88b[_0x1b92('0x1c')]?_0x80e88b[_0x1b92('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x80e88b[_0x1b92('0x1c')]?_0x80e88b[_0x1b92('0x1c')]['where']||null:null,'attributes':[[_0x1b92('0x2d'),_0x1b92('0x2e')],[db['sequelize']['fn']('COUNT',db[_0x1b92('0x20')][_0x1b92('0x46')]('id')),'ivrTotalCallsDays'],[db[_0x1b92('0x20')]['fn'](_0x1b92('0x21'),db[_0x1b92('0x20')]['fn']('IF',db[_0x1b92('0x20')][_0x1b92('0x28')](_0x1b92('0x22')))),'ivrAnswerCallsDay']],'group':[_0x1b92('0x2d')]})['then'](function(_0x4b5b60){logger[_0x1b92('0x16')](_0x1b92('0x45'),_0x80e88b);logger[_0x1b92('0x10')](_0x1b92('0x45'),_0x80e88b,JSON[_0x1b92('0x12')](_0x4b5b60));_0x2304ef(_0x4b5b60);})[_0x1b92('0x17')](function(_0x37c28d){logger[_0x1b92('0x13')](_0x1b92('0x45'),_0x37c28d[_0x1b92('0x15')],_0x80e88b);_0x1e9888(_0x181e03['error'](0x1f4,_0x37c28d[_0x1b92('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ca98a20..a1ce550 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 _0x5865=['post','put','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id'];(function(_0x11fcf4,_0x48541d){var _0x1d2d8c=function(_0x27b2e7){while(--_0x27b2e7){_0x11fcf4['push'](_0x11fcf4['shift']());}};_0x1d2d8c(++_0x48541d);}(_0x5865,0xc3));var _0x5586=function(_0x413729,_0x58d905){_0x413729=_0x413729-0x0;var _0x105135=_0x5865[_0x413729];return _0x105135;};'use strict';var multer=require(_0x5586('0x0'));var util=require(_0x5586('0x1'));var path=require(_0x5586('0x2'));var timeout=require(_0x5586('0x3'));var express=require(_0x5586('0x4'));var router=express[_0x5586('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5586('0x6'));var interaction=require(_0x5586('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x5586('0x8')]('/',auth[_0x5586('0x9')](),controller['index']);router[_0x5586('0x8')](_0x5586('0xa'),auth[_0x5586('0x9')](),controller[_0x5586('0xb')]);router[_0x5586('0x8')](_0x5586('0xc'),auth[_0x5586('0x9')](),controller['show']);router[_0x5586('0xd')]('/',auth[_0x5586('0x9')](),controller['create']);router[_0x5586('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x5586('0xf')]=router; \ No newline at end of file +var _0x46eb=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','multer'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x46eb,0x1cb));var _0xb46e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x46eb[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xb46e('0x0'));var util=require(_0xb46e('0x1'));var path=require(_0xb46e('0x2'));var timeout=require(_0xb46e('0x3'));var express=require(_0xb46e('0x4'));var router=express['Router']();var fs_extra=require(_0xb46e('0x5'));var auth=require(_0xb46e('0x6'));var interaction=require(_0xb46e('0x7'));var config=require('../../config/environment');var controller=require(_0xb46e('0x8'));router[_0xb46e('0x9')]('/',auth[_0xb46e('0xa')](),controller[_0xb46e('0xb')]);router[_0xb46e('0x9')](_0xb46e('0xc'),auth[_0xb46e('0xa')](),controller[_0xb46e('0xd')]);router[_0xb46e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb46e('0xe')]);router[_0xb46e('0xf')]('/',auth[_0xb46e('0xa')](),controller[_0xb46e('0x10')]);router[_0xb46e('0x11')](_0xb46e('0x12'),auth[_0xb46e('0xa')](),controller[_0xb46e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 525b451..bc0ba49 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 _0x8958=['exports'];(function(_0x377972,_0x5c40ff){var _0x46987a=function(_0x2c1ea0){while(--_0x2c1ea0){_0x377972['push'](_0x377972['shift']());}};_0x46987a(++_0x5c40ff);}(_0x8958,0x93));var _0x8895=function(_0x493765,_0x44f6d6){_0x493765=_0x493765-0x0;var _0x220718=_0x8958[_0x493765];return _0x220718;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc73a=['exports','STRING','name'];(function(_0x24bef4,_0x3c9d66){var _0x800c3a=function(_0x2ab5c2){while(--_0x2ab5c2){_0x24bef4['push'](_0x24bef4['shift']());}};_0x800c3a(++_0x3c9d66);}(_0xc73a,0x72));var _0xac73=function(_0x28d626,_0x52745f){_0x28d626=_0x28d626-0x0;var _0x8df84a=_0xc73a[_0x28d626];return _0x8df84a;};'use strict';var Sequelize=require('sequelize');module[_0xac73('0x0')]={'name':{'type':Sequelize[_0xac73('0x1')],'unique':_0xac73('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index c589a2e..077209e 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 _0xc9b6=['format','cf_%d','raw','getContactsCsv','pick','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','text/csv','download','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts','cf_%s','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','get','Lists','UserProfileResource','end','error','stack','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','CmList','includeAll','include','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','getDispositions','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0xc9b6,0xb6));var _0x6c9b=function(_0x217b17,_0x35fc8d){_0x217b17=_0x217b17-0x0;var _0x150d1b=_0xc9b6[_0x217b17];return _0x150d1b;};'use strict';var emlformat=require(_0x6c9b('0x0'));var rimraf=require(_0x6c9b('0x1'));var zipdir=require(_0x6c9b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c9b('0x3'));var moment=require(_0x6c9b('0x4'));var BPromise=require(_0x6c9b('0x5'));var Mustache=require('mustache');var util=require(_0x6c9b('0x6'));var path=require(_0x6c9b('0x7'));var sox=require(_0x6c9b('0x8'));var csv=require(_0x6c9b('0x9'));var ejs=require(_0x6c9b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6c9b('0xb'));var crypto=require(_0x6c9b('0xc'));var jsforce=require(_0x6c9b('0xd'));var deskjs=require(_0x6c9b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6c9b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6c9b('0x10'));var as=require(_0x6c9b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c9b('0x12'))(_0x6c9b('0x13'));var utils=require(_0x6c9b('0x14'));var config=require(_0x6c9b('0x15'));var licenseUtil=require(_0x6c9b('0x16'));var db=require(_0x6c9b('0x17'))['db'];config[_0x6c9b('0x18')]=_[_0x6c9b('0x19')](config[_0x6c9b('0x18')],{'host':_0x6c9b('0x1a'),'port':0x18eb});var socket=require(_0x6c9b('0x1b'))(new Redis(config['redis']));require(_0x6c9b('0x1c'))['register'](socket);function respondWithStatusCode(_0x1d0cf3,_0x6a210e){_0x6a210e=_0x6a210e||0xcc;return function(_0x24ac99){if(_0x24ac99){return _0x1d0cf3[_0x6c9b('0x1d')](_0x6a210e);}return _0x1d0cf3[_0x6c9b('0x1e')](_0x6a210e)['end']();};}function respondWithResult(_0x2fdfbd,_0x2e81e1){_0x2e81e1=_0x2e81e1||0xc8;return function(_0x28648c){if(_0x28648c){return _0x2fdfbd['status'](_0x2e81e1)[_0x6c9b('0x1f')](_0x28648c);}};}function respondWithFilteredResult(_0x2b0dc4,_0x46605a){return function(_0x34ebaa){if(_0x34ebaa){var _0x502b11=typeof _0x46605a[_0x6c9b('0x20')]===_0x6c9b('0x21')&&typeof _0x46605a[_0x6c9b('0x22')]==='undefined';var _0x2af3d9=_0x34ebaa[_0x6c9b('0x23')];var _0x25c3c7=_0x502b11?0x0:_0x46605a[_0x6c9b('0x20')];var _0x4b735d=_0x502b11?_0x34ebaa[_0x6c9b('0x23')]:_0x46605a[_0x6c9b('0x20')]+_0x46605a[_0x6c9b('0x22')];var _0x156314;if(_0x4b735d>=_0x2af3d9){_0x4b735d=_0x2af3d9;_0x156314=0xc8;}else{_0x156314=0xce;}_0x2b0dc4[_0x6c9b('0x1e')](_0x156314);return _0x2b0dc4['set'](_0x6c9b('0x24'),_0x25c3c7+'-'+_0x4b735d+'/'+_0x2af3d9)[_0x6c9b('0x1f')](_0x34ebaa);}return null;};}function patchUpdates(_0x1e90fc){return function(_0x615d4a){try{jsonpatch[_0x6c9b('0x25')](_0x615d4a,_0x1e90fc,!![]);}catch(_0x24d28a){return BPromise[_0x6c9b('0x26')](_0x24d28a);}return _0x615d4a['save']();};}function saveUpdates(_0xc262e4,_0x27f7cb){return function(_0x2f9cac){if(_0x2f9cac){return _0x2f9cac['update'](_0xc262e4)['then'](function(_0x8996cc){return _0x8996cc;});}return null;};}function removeEntity(_0x55cd5b,_0x35ec99){return function(_0x1fcc5f){if(_0x1fcc5f){return _0x1fcc5f[_0x6c9b('0x27')]()[_0x6c9b('0x28')](function(){var _0x4303c1=_0x1fcc5f[_0x6c9b('0x29')]({'plain':!![]});var _0x44de4a=_0x6c9b('0x2a');return db[_0x6c9b('0x2b')]['destroy']({'where':{'type':_0x44de4a,'resourceId':_0x4303c1['id']}})[_0x6c9b('0x28')](function(){return _0x1fcc5f;});})[_0x6c9b('0x28')](function(){_0x55cd5b[_0x6c9b('0x1e')](0xcc)[_0x6c9b('0x2c')]();});}};}function handleEntityNotFound(_0x19e7a5,_0x435885){return function(_0x392dbe){if(!_0x392dbe){_0x19e7a5[_0x6c9b('0x1d')](0x194);}return _0x392dbe;};}function handleError(_0x24edbf,_0xa02c60){_0xa02c60=_0xa02c60||0x1f4;return function(_0x101c37){logger[_0x6c9b('0x2d')](_0x101c37[_0x6c9b('0x2e')]);if(_0x101c37['name']){delete _0x101c37['name'];}_0x24edbf[_0x6c9b('0x1e')](_0xa02c60)['send'](_0x101c37);};}exports['index']=function(_0x274c53,_0x2c6cd0){var _0x5c8cca={},_0xab718e={},_0x8eaeb1={'count':0x0,'rows':[]};var _0x337b42=_['map'](db['CmList'][_0x6c9b('0x2f')],function(_0x4b8d1c){return{'name':_0x4b8d1c[_0x6c9b('0x30')],'type':_0x4b8d1c[_0x6c9b('0x31')][_0x6c9b('0x32')]};});_0xab718e[_0x6c9b('0x33')]=_[_0x6c9b('0x34')](_0x337b42,_0x6c9b('0x35'));_0xab718e[_0x6c9b('0x36')]=_[_0x6c9b('0x37')](_0x274c53[_0x6c9b('0x36')]);_0xab718e[_0x6c9b('0x38')]=_[_0x6c9b('0x39')](_0xab718e[_0x6c9b('0x33')],_0xab718e[_0x6c9b('0x36')]);_0x5c8cca[_0x6c9b('0x3a')]=_['intersection'](_0xab718e[_0x6c9b('0x33')],qs[_0x6c9b('0x3b')](_0x274c53[_0x6c9b('0x36')][_0x6c9b('0x3b')]));_0x5c8cca[_0x6c9b('0x3a')]=_0x5c8cca[_0x6c9b('0x3a')][_0x6c9b('0x3c')]?_0x5c8cca[_0x6c9b('0x3a')]:_0xab718e['model'];if(!_0x274c53[_0x6c9b('0x36')][_0x6c9b('0x3d')](_0x6c9b('0x3e'))){_0x5c8cca['limit']=qs[_0x6c9b('0x22')](_0x274c53[_0x6c9b('0x36')][_0x6c9b('0x22')]);_0x5c8cca['offset']=qs[_0x6c9b('0x20')](_0x274c53[_0x6c9b('0x36')][_0x6c9b('0x20')]);}_0x5c8cca[_0x6c9b('0x3f')]=qs[_0x6c9b('0x40')](_0x274c53[_0x6c9b('0x36')][_0x6c9b('0x40')]);_0x5c8cca[_0x6c9b('0x41')]=qs[_0x6c9b('0x38')](_['pick'](_0x274c53[_0x6c9b('0x36')],_0xab718e[_0x6c9b('0x38')]),_0x337b42);if(_0x274c53['query'][_0x6c9b('0x42')]){_0x5c8cca[_0x6c9b('0x41')]=_[_0x6c9b('0x43')](_0x5c8cca['where'],{'$or':_['map'](_0x337b42,function(_0x562821){if(_0x562821['type']!==_0x6c9b('0x44')){var _0x24ebce={};_0x24ebce[_0x562821[_0x6c9b('0x35')]]={'$like':'%'+_0x274c53[_0x6c9b('0x36')]['filter']+'%'};return _0x24ebce;}})});}_0x5c8cca=_[_0x6c9b('0x43')]({},_0x5c8cca,_0x274c53['options']);var _0x33afef={'where':_0x5c8cca[_0x6c9b('0x41')]};return db[_0x6c9b('0x45')]['count'](_0x33afef)['then'](function(_0x2c4e3b){_0x8eaeb1[_0x6c9b('0x23')]=_0x2c4e3b;if(_0x274c53[_0x6c9b('0x36')][_0x6c9b('0x46')]){_0x5c8cca[_0x6c9b('0x47')]=[{'all':!![]}];}return db[_0x6c9b('0x45')]['findAll'](_0x5c8cca);})[_0x6c9b('0x28')](function(_0x1de7c1){_0x8eaeb1[_0x6c9b('0x48')]=_0x1de7c1;return _0x8eaeb1;})[_0x6c9b('0x28')](respondWithFilteredResult(_0x2c6cd0,_0x5c8cca))[_0x6c9b('0x49')](handleError(_0x2c6cd0,null));};exports[_0x6c9b('0x4a')]=function(_0x13546c,_0xe9ee3b){var _0xc3fdf0={'raw':![],'where':{'id':_0x13546c[_0x6c9b('0x4b')]['id']}},_0x6b26b0={};_0x6b26b0[_0x6c9b('0x33')]=_[_0x6c9b('0x37')](db['CmList'][_0x6c9b('0x2f')]);_0x6b26b0[_0x6c9b('0x36')]=_['keys'](_0x13546c[_0x6c9b('0x36')]);_0x6b26b0[_0x6c9b('0x38')]=_[_0x6c9b('0x39')](_0x6b26b0[_0x6c9b('0x33')],_0x6b26b0[_0x6c9b('0x36')]);_0xc3fdf0['attributes']=_[_0x6c9b('0x39')](_0x6b26b0[_0x6c9b('0x33')],qs[_0x6c9b('0x3b')](_0x13546c[_0x6c9b('0x36')][_0x6c9b('0x3b')]));_0xc3fdf0['attributes']=_0xc3fdf0['attributes']['length']?_0xc3fdf0[_0x6c9b('0x3a')]:_0x6b26b0['model'];if(_0x13546c[_0x6c9b('0x36')][_0x6c9b('0x46')]){_0xc3fdf0['include']=[{'all':!![]}];}_0xc3fdf0=_[_0x6c9b('0x43')]({},_0xc3fdf0,_0x13546c[_0x6c9b('0x4c')]);return db[_0x6c9b('0x45')][_0x6c9b('0x4d')](_0xc3fdf0)[_0x6c9b('0x28')](handleEntityNotFound(_0xe9ee3b,null))[_0x6c9b('0x28')](respondWithResult(_0xe9ee3b,null))[_0x6c9b('0x49')](handleError(_0xe9ee3b,null));};exports[_0x6c9b('0x4e')]=function(_0x2fab4c,_0x1f602b){return db[_0x6c9b('0x45')][_0x6c9b('0x4e')](_0x2fab4c['body'],{})[_0x6c9b('0x28')](function(_0x5c7109){var _0x5e8054=_0x2fab4c[_0x6c9b('0x4f')][_0x6c9b('0x29')]({'plain':!![]});if(!_0x5e8054)throw new Error(_0x6c9b('0x50'));if(_0x5e8054[_0x6c9b('0x51')]===_0x6c9b('0x4f')){var _0x3d11c4=_0x5c7109[_0x6c9b('0x29')]({'plain':!![]});var _0x1303f5=_0x6c9b('0x2a');return db[_0x6c9b('0x52')]['find']({'where':{'name':_0x1303f5,'userProfileId':_0x5e8054[_0x6c9b('0x53')]},'raw':!![]})['then'](function(_0x500fee){if(_0x500fee&&_0x500fee[_0x6c9b('0x54')]===0x0){return db[_0x6c9b('0x2b')][_0x6c9b('0x4e')]({'name':_0x3d11c4[_0x6c9b('0x35')],'resourceId':_0x3d11c4['id'],'type':_0x500fee['name'],'sectionId':_0x500fee['id']},{})['then'](function(){return _0x5c7109;});}else{return _0x5c7109;}})[_0x6c9b('0x49')](function(_0x2e25ad){logger[_0x6c9b('0x2d')](_0x6c9b('0x55'),_0x2e25ad);throw _0x2e25ad;});}return _0x5c7109;})[_0x6c9b('0x28')](respondWithResult(_0x1f602b,0xc9))['catch'](handleError(_0x1f602b,null));};exports['update']=function(_0x4fcdf1,_0x21a9be){if(_0x4fcdf1[_0x6c9b('0x56')]['id']){delete _0x4fcdf1[_0x6c9b('0x56')]['id'];}return db['CmList'][_0x6c9b('0x4d')]({'where':{'id':_0x4fcdf1[_0x6c9b('0x4b')]['id']}})[_0x6c9b('0x28')](handleEntityNotFound(_0x21a9be,null))[_0x6c9b('0x28')](saveUpdates(_0x4fcdf1[_0x6c9b('0x56')],null))['then'](respondWithResult(_0x21a9be,null))['catch'](handleError(_0x21a9be,null));};exports['destroy']=function(_0x3159a5,_0x2fbc0c){return db[_0x6c9b('0x45')][_0x6c9b('0x4d')]({'where':{'id':_0x3159a5[_0x6c9b('0x4b')]['id']}})[_0x6c9b('0x28')](handleEntityNotFound(_0x2fbc0c,null))['then'](removeEntity(_0x2fbc0c,null))[_0x6c9b('0x49')](handleError(_0x2fbc0c,null));};exports[_0x6c9b('0x57')]=function(_0x2db5eb,_0x2796bd){return db[_0x6c9b('0x45')][_0x6c9b('0x57')]()[_0x6c9b('0x28')](respondWithResult(_0x2796bd,null))[_0x6c9b('0x49')](handleError(_0x2796bd,null));};exports[_0x6c9b('0x58')]=function(_0x5d1827,_0xe9639a,_0x2d31e3){if(_0x5d1827['body']['id']){delete _0x5d1827[_0x6c9b('0x56')]['id'];}return db[_0x6c9b('0x45')][_0x6c9b('0x4d')]({'where':{'id':_0x5d1827[_0x6c9b('0x4b')]['id']}})[_0x6c9b('0x28')](handleEntityNotFound(_0xe9639a,null))[_0x6c9b('0x28')](function(_0x1ed1eb){if(_0x1ed1eb){_0x5d1827['body'][_0x6c9b('0x59')]=_0x1ed1eb['id'];return db[_0x6c9b('0x5a')][_0x6c9b('0x4e')](_0x5d1827[_0x6c9b('0x56')]);}})['then'](respondWithResult(_0xe9639a,null))[_0x6c9b('0x49')](handleError(_0xe9639a,null));};exports[_0x6c9b('0x5b')]=function(_0x59f530,_0x5952fc,_0x346009){var _0x3b81ad={'raw':![],'where':{}};var _0x43e281={};var _0x129cce={'count':0x0,'rows':[]};return db[_0x6c9b('0x45')]['findOne']({'where':{'id':_0x59f530[_0x6c9b('0x4b')]['id']}})[_0x6c9b('0x28')](handleEntityNotFound(_0x5952fc,null))['then'](function(_0x2e9876){if(_0x2e9876){_0x43e281[_0x6c9b('0x33')]=_[_0x6c9b('0x37')](db[_0x6c9b('0x5a')][_0x6c9b('0x2f')]);_0x43e281['query']=_[_0x6c9b('0x37')](_0x59f530['query']);_0x43e281[_0x6c9b('0x38')]=_[_0x6c9b('0x39')](_0x43e281[_0x6c9b('0x33')],_0x43e281[_0x6c9b('0x36')]);_0x3b81ad['attributes']=_[_0x6c9b('0x39')](_0x43e281[_0x6c9b('0x33')],qs[_0x6c9b('0x3b')](_0x59f530[_0x6c9b('0x36')]['fields']));_0x3b81ad['attributes']=_0x3b81ad[_0x6c9b('0x3a')][_0x6c9b('0x3c')]?_0x3b81ad[_0x6c9b('0x3a')]:_0x43e281[_0x6c9b('0x33')];if(!_0x59f530['query'][_0x6c9b('0x3d')](_0x6c9b('0x3e'))){_0x3b81ad['limit']=qs['limit'](_0x59f530[_0x6c9b('0x36')][_0x6c9b('0x22')]);_0x3b81ad['offset']=qs[_0x6c9b('0x20')](_0x59f530[_0x6c9b('0x36')][_0x6c9b('0x20')]);}_0x3b81ad[_0x6c9b('0x3f')]=qs[_0x6c9b('0x40')](_0x59f530[_0x6c9b('0x36')][_0x6c9b('0x40')]);_0x3b81ad[_0x6c9b('0x41')]=qs[_0x6c9b('0x38')](_['pick'](_0x59f530[_0x6c9b('0x36')],_0x43e281['filters']));_0x3b81ad[_0x6c9b('0x41')]['ListId']=_0x2e9876['id'];if(_0x59f530[_0x6c9b('0x36')][_0x6c9b('0x42')]){_0x3b81ad['where']=_[_0x6c9b('0x43')](_0x3b81ad['where'],{'$or':_[_0x6c9b('0x34')](_0x3b81ad[_0x6c9b('0x3a')],function(_0x512ef9){var _0x4f7eac={};_0x4f7eac[_0x512ef9]={'$like':'%'+_0x59f530[_0x6c9b('0x36')][_0x6c9b('0x42')]+'%'};return _0x4f7eac;})});}_0x3b81ad=_[_0x6c9b('0x43')]({},_0x3b81ad,_0x59f530[_0x6c9b('0x4c')]);return db[_0x6c9b('0x5a')][_0x6c9b('0x23')]({'where':_0x3b81ad[_0x6c9b('0x41')]})[_0x6c9b('0x28')](function(_0x5c4395){_0x129cce[_0x6c9b('0x23')]=_0x5c4395;if(_0x59f530['query'][_0x6c9b('0x46')]){_0x3b81ad[_0x6c9b('0x47')]=[{'all':!![]}];}return db[_0x6c9b('0x5a')][_0x6c9b('0x5c')](_0x3b81ad);})[_0x6c9b('0x28')](function(_0x297fd1){_0x129cce['rows']=_0x297fd1;return _0x129cce;});}})[_0x6c9b('0x28')](respondWithFilteredResult(_0x5952fc,_0x3b81ad))['catch'](handleError(_0x5952fc,null));};exports[_0x6c9b('0x5d')]=function(_0x3eec8f,_0x100f8b,_0x12dd53){return db['CmList'][_0x6c9b('0x4d')]({'where':{'id':_0x3eec8f[_0x6c9b('0x4b')]['id']}})[_0x6c9b('0x28')](handleEntityNotFound(_0x100f8b,null))['then'](function(_0x5a7d76){if(_0x5a7d76){return _0x5a7d76['removeDispositions'](_0x3eec8f[_0x6c9b('0x36')][_0x6c9b('0x5e')]);}})['then'](respondWithStatusCode(_0x100f8b,null))[_0x6c9b('0x49')](handleError(_0x100f8b,null));};exports[_0x6c9b('0x5f')]=function(_0x8f2bc9,_0x29b63f,_0x30df43){return db[_0x6c9b('0x45')][_0x6c9b('0x4d')]({'where':{'id':_0x8f2bc9[_0x6c9b('0x4b')]['id']}})[_0x6c9b('0x28')](handleEntityNotFound(_0x29b63f,null))[_0x6c9b('0x28')](function(_0x3edbda){if(_0x3edbda){var _0x2b8413=[];var _0x34db8e={'success':[],'errors':[]};return db[_0x6c9b('0x60')]['describe']()[_0x6c9b('0x28')](function(_0x45ae8f){if(_0x8f2bc9[_0x6c9b('0x56')][_0x6c9b('0x61')]&&_[_0x6c9b('0x62')](_0x8f2bc9['body']['tags'])){if(_0x8f2bc9[_0x6c9b('0x56')]['tags'][_0x6c9b('0x3c')]){_0x8f2bc9['body'][_0x6c9b('0x61')]=_0x8f2bc9[_0x6c9b('0x56')][_0x6c9b('0x61')][_0x6c9b('0x63')](';')+';';}else{_0x8f2bc9['body'][_0x6c9b('0x61')]=null;}}else{_0x8f2bc9[_0x6c9b('0x56')]['tags']=null;}if(_0x8f2bc9[_0x6c9b('0x56')]&&_['isArray'](_0x8f2bc9[_0x6c9b('0x56')])){for(var _0x4cb7cf=0x0;_0x4cb7cf<_0x8f2bc9[_0x6c9b('0x56')][_0x6c9b('0x3c')];_0x4cb7cf+=0x1){_0x8f2bc9['body'][_0x4cb7cf]['ListId']=_0x8f2bc9['params']['id'];_0x2b8413[_0x6c9b('0x64')](_0x8f2bc9['body'][_0x4cb7cf]);}return BPromise[_0x6c9b('0x65')](_0x2b8413,function(_0x328679){return db[_0x6c9b('0x60')]['create'](_['omit'](_0x328679,[_0x6c9b('0x5e'),'id'])||{},{'fields':_['keys'](_0x45ae8f),'raw':!![]})[_0x6c9b('0x28')](function(_0x497e1c){_0x34db8e['success'][_0x6c9b('0x64')](_0x497e1c[_0x6c9b('0x66')]);})[_0x6c9b('0x49')](function(_0x2e993a){_0x34db8e[_0x6c9b('0x67')][_0x6c9b('0x64')]({'data':_0x328679,'error':_0x2e993a[_0x6c9b('0x68')]});});})['then'](function(_0x439e51){return _0x34db8e;})[_0x6c9b('0x49')](function(_0x263f49){return _0x263f49;});}else{_0x29b63f[_0x6c9b('0x1e')](0x190)[_0x6c9b('0x1f')]({'message':_0x6c9b('0x69')});}});}})['then'](respondWithResult(_0x29b63f,null))[_0x6c9b('0x49')](handleError(_0x29b63f,null));};exports[_0x6c9b('0x6a')]=function(_0x2725ca,_0x3a4d60,_0x35fd07){var _0x4c830e;return db[_0x6c9b('0x45')][_0x6c9b('0x4d')]({'where':{'id':_0x2725ca[_0x6c9b('0x4b')]['id']},'include':[{'model':db[_0x6c9b('0x6b')],'as':_0x6c9b('0x6c')}]})['then'](handleEntityNotFound(_0x3a4d60,null))[_0x6c9b('0x28')](function(_0x54d779){if(_0x54d779){_0x4c830e=_0x54d779;return db[_0x6c9b('0x60')]['rawAttributes'];}})['then'](function(_0x2db553){if(_0x2db553){var _0x192803={};var _0xfb021={};_0xfb021['model']=_[_0x6c9b('0x6d')](_[_0x6c9b('0x37')](_0x2db553),_[_0x6c9b('0x34')](_0x4c830e[_0x6c9b('0x6c')],function(_0x2c6dde){return util[_0x6c9b('0x6e')](_0x6c9b('0x6f'),_0x2c6dde['id']);}));_0xfb021[_0x6c9b('0x36')]=_[_0x6c9b('0x37')](_0x2725ca['query']);_0xfb021['filters']=_['intersection'](_0xfb021['model'],_0xfb021['query']);_0x192803[_0x6c9b('0x3a')]=_[_0x6c9b('0x39')](_0xfb021[_0x6c9b('0x33')],qs[_0x6c9b('0x3b')](_0x2725ca[_0x6c9b('0x36')][_0x6c9b('0x3b')]));_0x192803['attributes']=_0x192803[_0x6c9b('0x3a')][_0x6c9b('0x3c')]?_0x192803['attributes']:_0xfb021[_0x6c9b('0x33')];if(!_0x2725ca[_0x6c9b('0x36')][_0x6c9b('0x3d')](_0x6c9b('0x3e'))){_0x192803[_0x6c9b('0x22')]=qs['limit'](_0x2725ca[_0x6c9b('0x36')][_0x6c9b('0x22')]);_0x192803['offset']=qs['offset'](_0x2725ca['query'][_0x6c9b('0x20')]);}_0x192803[_0x6c9b('0x3f')]=qs[_0x6c9b('0x40')](_0x2725ca[_0x6c9b('0x36')][_0x6c9b('0x40')]);_0x192803[_0x6c9b('0x41')]=qs[_0x6c9b('0x38')](_['pick'](_0x2725ca['query'],_0xfb021[_0x6c9b('0x38')]));_0x192803[_0x6c9b('0x70')]=!![];if(_0x2725ca[_0x6c9b('0x36')]['filter']){_0x192803[_0x6c9b('0x41')]=_[_0x6c9b('0x43')](_0x192803[_0x6c9b('0x41')],{'$or':_[_0x6c9b('0x34')](_0x192803[_0x6c9b('0x3a')],function(_0x3214ff){var _0x2d1488={};_0x2d1488[_0x3214ff]={'$like':'%'+_0x2725ca[_0x6c9b('0x36')][_0x6c9b('0x42')]+'%'};return _0x2d1488;})});}_0x192803=_[_0x6c9b('0x43')]({},_0x192803,_0x2725ca[_0x6c9b('0x4c')]);return _0x4c830e[_0x6c9b('0x6a')](_0x192803);}})[_0x6c9b('0x28')](respondWithResult(_0x3a4d60,null))[_0x6c9b('0x49')](handleError(_0x3a4d60,null));};exports[_0x6c9b('0x71')]=function(_0x349d49,_0x388b26,_0xf955cf){var _0x6d217a;return db[_0x6c9b('0x45')][_0x6c9b('0x4d')]({'where':{'id':_0x349d49['params']['id']},'include':[{'model':db[_0x6c9b('0x6b')],'as':_0x6c9b('0x6c')}]})[_0x6c9b('0x28')](handleEntityNotFound(_0x388b26,null))[_0x6c9b('0x28')](function(_0x2ba954){if(_0x2ba954){_0x6d217a=_0x2ba954;return db[_0x6c9b('0x60')][_0x6c9b('0x2f')];}})['then'](function(_0x27f17a){if(_0x27f17a){var _0xf07af4={};var _0x52c3df={};_0x52c3df[_0x6c9b('0x33')]=_[_0x6c9b('0x6d')](_[_0x6c9b('0x37')](_0x27f17a),_[_0x6c9b('0x34')](_0x6d217a[_0x6c9b('0x6c')],function(_0x5cc6b0){return util[_0x6c9b('0x6e')](_0x6c9b('0x6f'),_0x5cc6b0['id']);}));_0x52c3df[_0x6c9b('0x36')]=_[_0x6c9b('0x37')](_0x349d49[_0x6c9b('0x36')]);_0x52c3df['filters']=_[_0x6c9b('0x39')](_0x52c3df[_0x6c9b('0x33')],_0x52c3df[_0x6c9b('0x36')]);_0xf07af4[_0x6c9b('0x3a')]=_[_0x6c9b('0x39')](_0x52c3df[_0x6c9b('0x33')],qs[_0x6c9b('0x3b')](_0x349d49[_0x6c9b('0x36')][_0x6c9b('0x3b')]));_0xf07af4[_0x6c9b('0x3a')]=_0xf07af4[_0x6c9b('0x3a')]['length']?_0xf07af4[_0x6c9b('0x3a')]:_0x52c3df[_0x6c9b('0x33')];if(!_0x349d49[_0x6c9b('0x36')][_0x6c9b('0x3d')]('nolimit')){_0xf07af4[_0x6c9b('0x22')]=qs[_0x6c9b('0x22')](_0x349d49['query']['limit']);_0xf07af4[_0x6c9b('0x20')]=qs[_0x6c9b('0x20')](_0x349d49[_0x6c9b('0x36')][_0x6c9b('0x20')]);}_0xf07af4[_0x6c9b('0x3f')]=qs[_0x6c9b('0x40')](_0x349d49[_0x6c9b('0x36')][_0x6c9b('0x40')]);_0xf07af4[_0x6c9b('0x41')]=qs[_0x6c9b('0x38')](_[_0x6c9b('0x72')](_0x349d49[_0x6c9b('0x36')],_0x52c3df['filters']));_0xf07af4[_0x6c9b('0x70')]=!![];if(_0x349d49[_0x6c9b('0x36')][_0x6c9b('0x42')]){_0xf07af4[_0x6c9b('0x41')]=_[_0x6c9b('0x43')](_0xf07af4['where'],{'$or':_[_0x6c9b('0x34')](_0xf07af4[_0x6c9b('0x3a')],function(_0x4c6ab1){var _0x1f4960={};_0x1f4960[_0x4c6ab1]={'$like':'%'+_0x349d49[_0x6c9b('0x36')][_0x6c9b('0x42')]+'%'};return _0x1f4960;})});}_0xf07af4=_[_0x6c9b('0x43')]({},_0xf07af4,_0x349d49['options']);return _0x6d217a['getContacts'](_0xf07af4);}})[_0x6c9b('0x28')](function(_0x31c40e){if(!_[_0x6c9b('0x73')](_0x31c40e)){var _0x46250b=toCsv(_0x31c40e);var _0x516ef0=Date[_0x6c9b('0x74')]();fs[_0x6c9b('0x75')](util['format'](_0x6c9b('0x76'),_0x6d217a['id'],_0x516ef0),_0x46250b);_0x388b26[_0x6c9b('0x77')](_0x6c9b('0x78'),'attachment;\x20filename='+util[_0x6c9b('0x6e')]('list_%d_%s.csv',_0x6d217a['id'],_0x516ef0));_0x388b26[_0x6c9b('0x77')](_0x6c9b('0x79'),_0x6c9b('0x7a'));return _0x388b26[_0x6c9b('0x7b')](util[_0x6c9b('0x6e')](_0x6c9b('0x76'),_0x6d217a['id'],_0x516ef0));}else{return _0x388b26['sendStatus'](0xcc);}})[_0x6c9b('0x49')](handleError(_0x388b26,null));};exports['addCustomField']=function(_0x2a49d9,_0x11258d,_0x1b07ed){var _0x31051c;delete _0x2a49d9[_0x6c9b('0x56')]['id'];return db[_0x6c9b('0x45')][_0x6c9b('0x7c')]({'where':{'id':_0x2a49d9['params']['id']}})['then'](handleEntityNotFound(_0x11258d,null))[_0x6c9b('0x28')](function(_0xb3d981){if(_0xb3d981){return db[_0x6c9b('0x7d')]['transaction'](function(_0x2b0f20){return db[_0x6c9b('0x6b')][_0x6c9b('0x4e')](_0x2a49d9[_0x6c9b('0x56')],{'transaction':_0x2b0f20})[_0x6c9b('0x28')](function(_0x54275b){_0x31051c=_0x54275b;return _0xb3d981[_0x6c9b('0x7e')](_0x54275b,{'transaction':_0x2b0f20});})[_0x6c9b('0x28')](function(){var _0x55f1ca={'type':db[_0x6c9b('0x7f')][_0x6c9b('0x80')],'transaction':_0x2b0f20};switch(_0x2a49d9[_0x6c9b('0x56')][_0x6c9b('0x31')]){case _0x6c9b('0x81'):_0x55f1ca[_0x6c9b('0x31')]=db[_0x6c9b('0x7f')][_0x6c9b('0x80')];break;case _0x6c9b('0x82'):_0x55f1ca[_0x6c9b('0x31')]=db[_0x6c9b('0x7f')][_0x6c9b('0x83')];break;case _0x6c9b('0x84'):_0x55f1ca[_0x6c9b('0x31')]=db[_0x6c9b('0x7f')][_0x6c9b('0x85')];_0x55f1ca['defaultValue']=![];break;default:}return db[_0x6c9b('0x7d')][_0x6c9b('0x86')]['addColumn'](_0x6c9b('0x87'),util[_0x6c9b('0x6e')](_0x6c9b('0x88'),_0x31051c['id']),_0x55f1ca);})[_0x6c9b('0x28')](function(){return _0x31051c;});});}})['then'](respondWithResult(_0x11258d,null))['catch'](handleError(_0x11258d,null));};exports['getCustomFields']=function(_0x189c04,_0x5a7a7e,_0x505247){var _0x7a0616={};var _0x583f68={};var _0x48f773;var _0x37af90;return db[_0x6c9b('0x45')][_0x6c9b('0x7c')]({'where':{'id':_0x189c04['params']['id']}})[_0x6c9b('0x28')](handleEntityNotFound(_0x5a7a7e,null))[_0x6c9b('0x28')](function(_0x4baf58){if(_0x4baf58){_0x48f773=_0x4baf58;_0x583f68[_0x6c9b('0x33')]=_[_0x6c9b('0x37')](db[_0x6c9b('0x6b')]['rawAttributes']);_0x583f68[_0x6c9b('0x36')]=_[_0x6c9b('0x37')](_0x189c04[_0x6c9b('0x36')]);_0x583f68[_0x6c9b('0x38')]=_[_0x6c9b('0x39')](_0x583f68[_0x6c9b('0x33')],_0x583f68['query']);_0x7a0616['attributes']=_['intersection'](_0x583f68[_0x6c9b('0x33')],qs['fields'](_0x189c04[_0x6c9b('0x36')][_0x6c9b('0x3b')]));_0x7a0616[_0x6c9b('0x3a')]=_0x7a0616['attributes'][_0x6c9b('0x3c')]?_0x7a0616[_0x6c9b('0x3a')]:_0x583f68[_0x6c9b('0x33')];_0x7a0616[_0x6c9b('0x3f')]=qs[_0x6c9b('0x40')](_0x189c04[_0x6c9b('0x36')][_0x6c9b('0x40')]);_0x7a0616[_0x6c9b('0x41')]=qs['filters'](_[_0x6c9b('0x72')](_0x189c04['query'],_0x583f68[_0x6c9b('0x38')]));_0x7a0616[_0x6c9b('0x41')]=_[_0x6c9b('0x43')](_0x7a0616[_0x6c9b('0x41')],{'$or':[{'ListId':_0x4baf58['id']},{'ListId':null}]});if(_0x189c04[_0x6c9b('0x36')][_0x6c9b('0x42')]){_0x7a0616[_0x6c9b('0x41')]=_[_0x6c9b('0x43')](_0x7a0616[_0x6c9b('0x41')],{'$or':_[_0x6c9b('0x34')](_0x7a0616[_0x6c9b('0x3a')],function(_0x221e60){var _0x3050ff={};_0x3050ff[_0x221e60]={'$like':'%'+_0x189c04['query'][_0x6c9b('0x42')]+'%'};return _0x3050ff;})});}_0x7a0616=_[_0x6c9b('0x43')]({},_0x7a0616,_0x189c04[_0x6c9b('0x4c')]);return db[_0x6c9b('0x6b')][_0x6c9b('0x89')](_0x7a0616);}})[_0x6c9b('0x28')](respondWithResult(_0x5a7a7e,null))[_0x6c9b('0x49')](handleError(_0x5a7a7e,null));};exports[_0x6c9b('0x8a')]=function(_0x226615,_0x57a98c,_0x1fe7a3){return db[_0x6c9b('0x45')]['find']({'where':{'id':_0x226615[_0x6c9b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57a98c,null))[_0x6c9b('0x28')](function(_0x334bd1){if(_0x334bd1){return _0x334bd1['addAgents'](_0x226615[_0x6c9b('0x56')][_0x6c9b('0x5e')],_[_0x6c9b('0x8b')](_0x226615['body'],[_0x6c9b('0x5e'),'id'])||{})[_0x6c9b('0x8c')](function(_0x3dfb14){for(var _0x2e5b0d=0x0;_0x2e5b0d<_0x226615[_0x6c9b('0x56')]['ids'][_0x6c9b('0x3c')];_0x2e5b0d+=0x1){socket[_0x6c9b('0x8d')](_0x6c9b('0x8e'),{'UserId':Number(_0x226615['body'][_0x6c9b('0x5e')][_0x2e5b0d]),'CmListId':Number(_0x226615['params']['id'])});}return _0x3dfb14;});}})[_0x6c9b('0x28')](respondWithResult(_0x57a98c,null))['catch'](handleError(_0x57a98c,null));};exports[_0x6c9b('0x8f')]=function(_0x187a96,_0x2a9293,_0x4b1e66){return db[_0x6c9b('0x45')]['find']({'where':{'id':_0x187a96[_0x6c9b('0x4b')]['id']}})[_0x6c9b('0x28')](handleEntityNotFound(_0x2a9293,null))[_0x6c9b('0x28')](function(_0x3692b9){if(_0x3692b9){return _0x3692b9['removeAgents'](_0x187a96['query'][_0x6c9b('0x5e')])[_0x6c9b('0x28')](function(){if(_[_0x6c9b('0x62')](_0x187a96['query'][_0x6c9b('0x5e')])){for(var _0x135bf5=0x0;_0x135bf5<_0x187a96[_0x6c9b('0x36')]['ids'][_0x6c9b('0x3c')];_0x135bf5+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x187a96[_0x6c9b('0x36')][_0x6c9b('0x5e')][_0x135bf5]),'CmListId':Number(_0x187a96['params']['id'])});}}else{socket[_0x6c9b('0x8d')](_0x6c9b('0x90'),{'UserId':Number(_0x187a96[_0x6c9b('0x36')][_0x6c9b('0x5e')]),'CmListId':Number(_0x187a96[_0x6c9b('0x4b')]['id'])});}});}})[_0x6c9b('0x28')](respondWithStatusCode(_0x2a9293,null))[_0x6c9b('0x49')](handleError(_0x2a9293,null));};exports['getAgents']=function(_0xb1a0b,_0x91242d,_0x40bb7d){var _0x173f8f={};var _0x29439b={};var _0x35d692;var _0x39c154;return db[_0x6c9b('0x45')][_0x6c9b('0x7c')]({'where':{'id':_0xb1a0b['params']['id']}})[_0x6c9b('0x28')](handleEntityNotFound(_0x91242d,null))[_0x6c9b('0x28')](function(_0x29ce13){if(_0x29ce13){_0x35d692=_0x29ce13;_0x29439b[_0x6c9b('0x33')]=_[_0x6c9b('0x37')](db['User'][_0x6c9b('0x2f')]);_0x29439b[_0x6c9b('0x36')]=_[_0x6c9b('0x37')](_0xb1a0b[_0x6c9b('0x36')]);_0x29439b[_0x6c9b('0x38')]=_[_0x6c9b('0x39')](_0x29439b['model'],_0x29439b[_0x6c9b('0x36')]);_0x173f8f[_0x6c9b('0x3a')]=_['intersection'](_0x29439b[_0x6c9b('0x33')],qs[_0x6c9b('0x3b')](_0xb1a0b[_0x6c9b('0x36')][_0x6c9b('0x3b')]));_0x173f8f[_0x6c9b('0x3a')]=_0x173f8f[_0x6c9b('0x3a')]['length']?_0x173f8f[_0x6c9b('0x3a')]:_0x29439b[_0x6c9b('0x33')];_0x173f8f[_0x6c9b('0x3f')]=qs[_0x6c9b('0x40')](_0xb1a0b[_0x6c9b('0x36')][_0x6c9b('0x40')]);_0x173f8f[_0x6c9b('0x41')]=qs[_0x6c9b('0x38')](_[_0x6c9b('0x72')](_0xb1a0b['query'],_0x29439b[_0x6c9b('0x38')]));if(_0xb1a0b[_0x6c9b('0x36')]['filter']){_0x173f8f[_0x6c9b('0x41')]=_[_0x6c9b('0x43')](_0x173f8f[_0x6c9b('0x41')],{'$or':_[_0x6c9b('0x34')](_0x173f8f[_0x6c9b('0x3a')],function(_0x4c89e7){var _0x5fae82={};_0x5fae82[_0x4c89e7]={'$like':'%'+_0xb1a0b[_0x6c9b('0x36')]['filter']+'%'};return _0x5fae82;})});}_0x173f8f=_[_0x6c9b('0x43')]({},_0x173f8f,_0xb1a0b['options']);return _0x35d692[_0x6c9b('0x91')](_0x173f8f);}})[_0x6c9b('0x28')](function(_0x3ae168){if(_0x3ae168){_0x39c154=_0x3ae168[_0x6c9b('0x3c')];if(!_0xb1a0b['query'][_0x6c9b('0x3d')](_0x6c9b('0x3e'))){_0x173f8f['limit']=qs[_0x6c9b('0x22')](_0xb1a0b[_0x6c9b('0x36')]['limit']);_0x173f8f[_0x6c9b('0x20')]=qs[_0x6c9b('0x20')](_0xb1a0b[_0x6c9b('0x36')][_0x6c9b('0x20')]);}return _0x35d692[_0x6c9b('0x91')](_0x173f8f);}})[_0x6c9b('0x28')](function(_0x3a7beb){if(_0x3a7beb){return _0x3a7beb?{'count':_0x39c154,'rows':_0x3a7beb}:null;}})[_0x6c9b('0x28')](respondWithResult(_0x91242d,null))[_0x6c9b('0x49')](handleError(_0x91242d,null));}; \ No newline at end of file +var _0xc6f6=['stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','ListId','Disposition','rows','removeDispositions','addContacts','tags','isArray','push','each','CmContact','omit','success','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','addColumn','cf_%s','addAgents','ids','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','get','Lists','destroy','sendStatus','error'];(function(_0x6b035c,_0x11d7cb){var _0x95b5f1=function(_0x31852f){while(--_0x31852f){_0x6b035c['push'](_0x6b035c['shift']());}};_0x95b5f1(++_0x11d7cb);}(_0xc6f6,0xeb));var _0x6c6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc6f6[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x6c6f('0x0'));var rimraf=require(_0x6c6f('0x1'));var zipdir=require(_0x6c6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6c6f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6c6f('0x4'));var util=require(_0x6c6f('0x5'));var path=require(_0x6c6f('0x6'));var sox=require(_0x6c6f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c6f('0x8'));var _=require(_0x6c6f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c6f('0xa'));var deskjs=require(_0x6c6f('0xb'));var toCsv=require(_0x6c6f('0xc'));var querystring=require(_0x6c6f('0xd'));var Papa=require(_0x6c6f('0xe'));var Redis=require(_0x6c6f('0xf'));var authService=require(_0x6c6f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6c6f('0x11'));var hardwareService=require(_0x6c6f('0x12'));var logger=require(_0x6c6f('0x13'))(_0x6c6f('0x14'));var utils=require(_0x6c6f('0x15'));var config=require(_0x6c6f('0x16'));var licenseUtil=require(_0x6c6f('0x17'));var db=require(_0x6c6f('0x18'))['db'];config['redis']=_[_0x6c6f('0x19')](config[_0x6c6f('0x1a')],{'host':_0x6c6f('0x1b'),'port':0x18eb});var socket=require(_0x6c6f('0x1c'))(new Redis(config[_0x6c6f('0x1a')]));require('./cmList.socket')[_0x6c6f('0x1d')](socket);function respondWithStatusCode(_0x4fc8a8,_0x182f8d){_0x182f8d=_0x182f8d||0xcc;return function(_0x309f9e){if(_0x309f9e){return _0x4fc8a8['sendStatus'](_0x182f8d);}return _0x4fc8a8[_0x6c6f('0x1e')](_0x182f8d)[_0x6c6f('0x1f')]();};}function respondWithResult(_0x2518cb,_0x31680e){_0x31680e=_0x31680e||0xc8;return function(_0x51a5ba){if(_0x51a5ba){return _0x2518cb['status'](_0x31680e)[_0x6c6f('0x20')](_0x51a5ba);}};}function respondWithFilteredResult(_0x42e65b,_0x404777){return function(_0x453607){if(_0x453607){var _0x3027e7=typeof _0x404777['offset']===_0x6c6f('0x21')&&typeof _0x404777[_0x6c6f('0x22')]===_0x6c6f('0x21');var _0x364e58=_0x453607['count'];var _0x2f780a=_0x3027e7?0x0:_0x404777[_0x6c6f('0x23')];var _0x203a6c=_0x3027e7?_0x453607[_0x6c6f('0x24')]:_0x404777[_0x6c6f('0x23')]+_0x404777[_0x6c6f('0x22')];var _0x2b2371;if(_0x203a6c>=_0x364e58){_0x203a6c=_0x364e58;_0x2b2371=0xc8;}else{_0x2b2371=0xce;}_0x42e65b[_0x6c6f('0x1e')](_0x2b2371);return _0x42e65b['set'](_0x6c6f('0x25'),_0x2f780a+'-'+_0x203a6c+'/'+_0x364e58)['json'](_0x453607);}return null;};}function patchUpdates(_0x14fad9){return function(_0x1f05c2){try{jsonpatch[_0x6c6f('0x26')](_0x1f05c2,_0x14fad9,!![]);}catch(_0x46e827){return BPromise['reject'](_0x46e827);}return _0x1f05c2[_0x6c6f('0x27')]();};}function saveUpdates(_0x1a1f07,_0x23d050){return function(_0x1bb70e){if(_0x1bb70e){return _0x1bb70e[_0x6c6f('0x28')](_0x1a1f07)[_0x6c6f('0x29')](function(_0x3e2d8d){return _0x3e2d8d;});}return null;};}function removeEntity(_0x1a9706,_0x41672c){return function(_0x9981cc){if(_0x9981cc){return _0x9981cc['destroy']()['then'](function(){var _0x44c2f5=_0x9981cc[_0x6c6f('0x2a')]({'plain':!![]});var _0x2c5134=_0x6c6f('0x2b');return db['UserProfileResource'][_0x6c6f('0x2c')]({'where':{'type':_0x2c5134,'resourceId':_0x44c2f5['id']}})['then'](function(){return _0x9981cc;});})[_0x6c6f('0x29')](function(){_0x1a9706['status'](0xcc)[_0x6c6f('0x1f')]();});}};}function handleEntityNotFound(_0x2aaabd,_0x4adc3d){return function(_0x232bad){if(!_0x232bad){_0x2aaabd[_0x6c6f('0x2d')](0x194);}return _0x232bad;};}function handleError(_0x2b1c01,_0x4ef29e){_0x4ef29e=_0x4ef29e||0x1f4;return function(_0x1cfde0){logger[_0x6c6f('0x2e')](_0x1cfde0[_0x6c6f('0x2f')]);if(_0x1cfde0[_0x6c6f('0x30')]){delete _0x1cfde0['name'];}_0x2b1c01[_0x6c6f('0x1e')](_0x4ef29e)[_0x6c6f('0x31')](_0x1cfde0);};}exports[_0x6c6f('0x32')]=function(_0x1f2f71,_0x11ef6d){var _0x5a72a8={},_0x1a333e={},_0x3f8140={'count':0x0,'rows':[]};var _0x488ba2=_[_0x6c6f('0x33')](db[_0x6c6f('0x34')][_0x6c6f('0x35')],function(_0x50d40d){return{'name':_0x50d40d[_0x6c6f('0x36')],'type':_0x50d40d[_0x6c6f('0x37')][_0x6c6f('0x38')]};});_0x1a333e['model']=_[_0x6c6f('0x33')](_0x488ba2,_0x6c6f('0x30'));_0x1a333e[_0x6c6f('0x39')]=_[_0x6c6f('0x3a')](_0x1f2f71[_0x6c6f('0x39')]);_0x1a333e[_0x6c6f('0x3b')]=_[_0x6c6f('0x3c')](_0x1a333e[_0x6c6f('0x3d')],_0x1a333e['query']);_0x5a72a8['attributes']=_[_0x6c6f('0x3c')](_0x1a333e[_0x6c6f('0x3d')],qs[_0x6c6f('0x3e')](_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x3e')]));_0x5a72a8[_0x6c6f('0x3f')]=_0x5a72a8[_0x6c6f('0x3f')][_0x6c6f('0x40')]?_0x5a72a8['attributes']:_0x1a333e['model'];if(!_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x41')](_0x6c6f('0x42'))){_0x5a72a8[_0x6c6f('0x22')]=qs[_0x6c6f('0x22')](_0x1f2f71['query'][_0x6c6f('0x22')]);_0x5a72a8['offset']=qs[_0x6c6f('0x23')](_0x1f2f71[_0x6c6f('0x39')]['offset']);}_0x5a72a8[_0x6c6f('0x43')]=qs['sort'](_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x44')]);_0x5a72a8['where']=qs[_0x6c6f('0x3b')](_[_0x6c6f('0x45')](_0x1f2f71[_0x6c6f('0x39')],_0x1a333e['filters']),_0x488ba2);if(_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x46')]){_0x5a72a8[_0x6c6f('0x47')]=_[_0x6c6f('0x48')](_0x5a72a8[_0x6c6f('0x47')],{'$or':_[_0x6c6f('0x33')](_0x488ba2,function(_0x507c4c){if(_0x507c4c[_0x6c6f('0x37')]!=='VIRTUAL'){var _0x467ac8={};_0x467ac8[_0x507c4c[_0x6c6f('0x30')]]={'$like':'%'+_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x46')]+'%'};return _0x467ac8;}})});}_0x5a72a8=_[_0x6c6f('0x48')]({},_0x5a72a8,_0x1f2f71[_0x6c6f('0x49')]);var _0x219687={'where':_0x5a72a8[_0x6c6f('0x47')]};return db[_0x6c6f('0x34')][_0x6c6f('0x24')](_0x219687)[_0x6c6f('0x29')](function(_0x120925){_0x3f8140[_0x6c6f('0x24')]=_0x120925;if(_0x1f2f71[_0x6c6f('0x39')][_0x6c6f('0x4a')]){_0x5a72a8[_0x6c6f('0x4b')]=[{'all':!![]}];}return db[_0x6c6f('0x34')][_0x6c6f('0x4c')](_0x5a72a8);})[_0x6c6f('0x29')](function(_0x3eb321){_0x3f8140['rows']=_0x3eb321;return _0x3f8140;})[_0x6c6f('0x29')](respondWithFilteredResult(_0x11ef6d,_0x5a72a8))['catch'](handleError(_0x11ef6d,null));};exports['show']=function(_0x49c685,_0x1bf8eb){var _0x13c279={'raw':![],'where':{'id':_0x49c685[_0x6c6f('0x4d')]['id']}},_0xf1cd8d={};_0xf1cd8d[_0x6c6f('0x3d')]=_[_0x6c6f('0x3a')](db['CmList']['rawAttributes']);_0xf1cd8d[_0x6c6f('0x39')]=_['keys'](_0x49c685[_0x6c6f('0x39')]);_0xf1cd8d[_0x6c6f('0x3b')]=_['intersection'](_0xf1cd8d[_0x6c6f('0x3d')],_0xf1cd8d[_0x6c6f('0x39')]);_0x13c279['attributes']=_[_0x6c6f('0x3c')](_0xf1cd8d[_0x6c6f('0x3d')],qs[_0x6c6f('0x3e')](_0x49c685[_0x6c6f('0x39')][_0x6c6f('0x3e')]));_0x13c279['attributes']=_0x13c279['attributes'][_0x6c6f('0x40')]?_0x13c279['attributes']:_0xf1cd8d[_0x6c6f('0x3d')];if(_0x49c685[_0x6c6f('0x39')]['includeAll']){_0x13c279[_0x6c6f('0x4b')]=[{'all':!![]}];}_0x13c279=_[_0x6c6f('0x48')]({},_0x13c279,_0x49c685[_0x6c6f('0x49')]);return db['CmList']['find'](_0x13c279)[_0x6c6f('0x29')](handleEntityNotFound(_0x1bf8eb,null))[_0x6c6f('0x29')](respondWithResult(_0x1bf8eb,null))[_0x6c6f('0x4e')](handleError(_0x1bf8eb,null));};exports[_0x6c6f('0x4f')]=function(_0x437a82,_0x261acd){return db[_0x6c6f('0x34')][_0x6c6f('0x4f')](_0x437a82[_0x6c6f('0x50')],{})[_0x6c6f('0x29')](function(_0x43bb4d){var _0x56be50=_0x437a82[_0x6c6f('0x51')][_0x6c6f('0x2a')]({'plain':!![]});if(!_0x56be50)throw new Error(_0x6c6f('0x52'));if(_0x56be50[_0x6c6f('0x53')]===_0x6c6f('0x51')){var _0x5c1836=_0x43bb4d[_0x6c6f('0x2a')]({'plain':!![]});var _0x18d619=_0x6c6f('0x2b');return db[_0x6c6f('0x54')]['find']({'where':{'name':_0x18d619,'userProfileId':_0x56be50['userProfileId']},'raw':!![]})[_0x6c6f('0x29')](function(_0x368195){if(_0x368195&&_0x368195[_0x6c6f('0x55')]===0x0){return db[_0x6c6f('0x56')][_0x6c6f('0x4f')]({'name':_0x5c1836['name'],'resourceId':_0x5c1836['id'],'type':_0x368195[_0x6c6f('0x30')],'sectionId':_0x368195['id']},{})[_0x6c6f('0x29')](function(){return _0x43bb4d;});}else{return _0x43bb4d;}})[_0x6c6f('0x4e')](function(_0x4e61e7){logger[_0x6c6f('0x2e')](_0x6c6f('0x57'),_0x4e61e7);throw _0x4e61e7;});}return _0x43bb4d;})[_0x6c6f('0x29')](respondWithResult(_0x261acd,0xc9))['catch'](handleError(_0x261acd,null));};exports[_0x6c6f('0x28')]=function(_0x3fbcad,_0x665a32){if(_0x3fbcad[_0x6c6f('0x50')]['id']){delete _0x3fbcad[_0x6c6f('0x50')]['id'];}return db[_0x6c6f('0x34')]['find']({'where':{'id':_0x3fbcad['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x665a32,null))[_0x6c6f('0x29')](saveUpdates(_0x3fbcad['body'],null))['then'](respondWithResult(_0x665a32,null))['catch'](handleError(_0x665a32,null));};exports[_0x6c6f('0x2c')]=function(_0x94917e,_0x541f01){return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x94917e['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x541f01,null))[_0x6c6f('0x29')](removeEntity(_0x541f01,null))[_0x6c6f('0x4e')](handleError(_0x541f01,null));};exports[_0x6c6f('0x59')]=function(_0x3fbda4,_0x784832){return db[_0x6c6f('0x34')]['describe']()[_0x6c6f('0x29')](respondWithResult(_0x784832,null))[_0x6c6f('0x4e')](handleError(_0x784832,null));};exports[_0x6c6f('0x5a')]=function(_0x5d631b,_0x2c830b,_0x5279fd){if(_0x5d631b['body']['id']){delete _0x5d631b[_0x6c6f('0x50')]['id'];}return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x5d631b['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x2c830b,null))[_0x6c6f('0x29')](function(_0x361853){if(_0x361853){_0x5d631b['body'][_0x6c6f('0x5b')]=_0x361853['id'];return db[_0x6c6f('0x5c')][_0x6c6f('0x4f')](_0x5d631b[_0x6c6f('0x50')]);}})[_0x6c6f('0x29')](respondWithResult(_0x2c830b,null))['catch'](handleError(_0x2c830b,null));};exports['getDispositions']=function(_0x3bfc97,_0x286f79,_0x3a08bb){var _0x738c18={'raw':![],'where':{}};var _0x1f02a5={};var _0x49323f={'count':0x0,'rows':[]};return db[_0x6c6f('0x34')]['findOne']({'where':{'id':_0x3bfc97[_0x6c6f('0x4d')]['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x286f79,null))[_0x6c6f('0x29')](function(_0x17ad1d){if(_0x17ad1d){_0x1f02a5[_0x6c6f('0x3d')]=_[_0x6c6f('0x3a')](db[_0x6c6f('0x5c')][_0x6c6f('0x35')]);_0x1f02a5['query']=_[_0x6c6f('0x3a')](_0x3bfc97[_0x6c6f('0x39')]);_0x1f02a5['filters']=_['intersection'](_0x1f02a5[_0x6c6f('0x3d')],_0x1f02a5[_0x6c6f('0x39')]);_0x738c18['attributes']=_[_0x6c6f('0x3c')](_0x1f02a5[_0x6c6f('0x3d')],qs['fields'](_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x3e')]));_0x738c18['attributes']=_0x738c18[_0x6c6f('0x3f')]['length']?_0x738c18[_0x6c6f('0x3f')]:_0x1f02a5['model'];if(!_0x3bfc97['query'][_0x6c6f('0x41')](_0x6c6f('0x42'))){_0x738c18['limit']=qs[_0x6c6f('0x22')](_0x3bfc97[_0x6c6f('0x39')]['limit']);_0x738c18[_0x6c6f('0x23')]=qs[_0x6c6f('0x23')](_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x23')]);}_0x738c18['order']=qs['sort'](_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x44')]);_0x738c18[_0x6c6f('0x47')]=qs[_0x6c6f('0x3b')](_[_0x6c6f('0x45')](_0x3bfc97['query'],_0x1f02a5[_0x6c6f('0x3b')]));_0x738c18['where']['ListId']=_0x17ad1d['id'];if(_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x46')]){_0x738c18['where']=_[_0x6c6f('0x48')](_0x738c18[_0x6c6f('0x47')],{'$or':_['map'](_0x738c18['attributes'],function(_0x4c4ac7){var _0x1c5b40={};_0x1c5b40[_0x4c4ac7]={'$like':'%'+_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x46')]+'%'};return _0x1c5b40;})});}_0x738c18=_[_0x6c6f('0x48')]({},_0x738c18,_0x3bfc97['options']);return db[_0x6c6f('0x5c')][_0x6c6f('0x24')]({'where':_0x738c18[_0x6c6f('0x47')]})[_0x6c6f('0x29')](function(_0x2ef710){_0x49323f[_0x6c6f('0x24')]=_0x2ef710;if(_0x3bfc97[_0x6c6f('0x39')][_0x6c6f('0x4a')]){_0x738c18[_0x6c6f('0x4b')]=[{'all':!![]}];}return db[_0x6c6f('0x5c')]['findAll'](_0x738c18);})[_0x6c6f('0x29')](function(_0x1d75d5){_0x49323f[_0x6c6f('0x5d')]=_0x1d75d5;return _0x49323f;});}})[_0x6c6f('0x29')](respondWithFilteredResult(_0x286f79,_0x738c18))[_0x6c6f('0x4e')](handleError(_0x286f79,null));};exports['removeDispositions']=function(_0x969354,_0x1566ea,_0x9e3cc){return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x969354[_0x6c6f('0x4d')]['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x1566ea,null))[_0x6c6f('0x29')](function(_0x1dd50f){if(_0x1dd50f){return _0x1dd50f[_0x6c6f('0x5e')](_0x969354[_0x6c6f('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x1566ea,null))['catch'](handleError(_0x1566ea,null));};exports[_0x6c6f('0x5f')]=function(_0x212211,_0x246ee9,_0x3da09d){return db['CmList']['find']({'where':{'id':_0x212211['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x246ee9,null))['then'](function(_0x2084fd){if(_0x2084fd){var _0x5048b8=[];var _0x3ae712={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x6c6f('0x29')](function(_0x23eae5){if(_0x212211[_0x6c6f('0x50')]['tags']&&_['isArray'](_0x212211['body'][_0x6c6f('0x60')])){if(_0x212211[_0x6c6f('0x50')]['tags'][_0x6c6f('0x40')]){_0x212211[_0x6c6f('0x50')]['tags']=_0x212211[_0x6c6f('0x50')][_0x6c6f('0x60')]['join'](';')+';';}else{_0x212211[_0x6c6f('0x50')]['tags']=null;}}else{_0x212211[_0x6c6f('0x50')]['tags']=null;}if(_0x212211[_0x6c6f('0x50')]&&_[_0x6c6f('0x61')](_0x212211[_0x6c6f('0x50')])){for(var _0x4e909a=0x0;_0x4e909a<_0x212211[_0x6c6f('0x50')]['length'];_0x4e909a+=0x1){_0x212211['body'][_0x4e909a]['ListId']=_0x212211[_0x6c6f('0x4d')]['id'];_0x5048b8[_0x6c6f('0x62')](_0x212211[_0x6c6f('0x50')][_0x4e909a]);}return BPromise[_0x6c6f('0x63')](_0x5048b8,function(_0x7760b3){return db[_0x6c6f('0x64')][_0x6c6f('0x4f')](_[_0x6c6f('0x65')](_0x7760b3,['ids','id'])||{},{'fields':_['keys'](_0x23eae5),'raw':!![]})[_0x6c6f('0x29')](function(_0x2e174f){_0x3ae712[_0x6c6f('0x66')][_0x6c6f('0x62')](_0x2e174f[_0x6c6f('0x67')]);})[_0x6c6f('0x4e')](function(_0x49fdbf){_0x3ae712['errors']['push']({'data':_0x7760b3,'error':_0x49fdbf['message']});});})[_0x6c6f('0x29')](function(_0x4332e5){return _0x3ae712;})['catch'](function(_0x34c605){return _0x34c605;});}else{_0x246ee9[_0x6c6f('0x1e')](0x190)[_0x6c6f('0x20')]({'message':_0x6c6f('0x68')});}});}})[_0x6c6f('0x29')](respondWithResult(_0x246ee9,null))[_0x6c6f('0x4e')](handleError(_0x246ee9,null));};exports[_0x6c6f('0x69')]=function(_0x13c43b,_0x2a1ca4,_0x432b60){var _0x41253c;return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x13c43b['params']['id']},'include':[{'model':db[_0x6c6f('0x6a')],'as':_0x6c6f('0x6b')}]})[_0x6c6f('0x29')](handleEntityNotFound(_0x2a1ca4,null))[_0x6c6f('0x29')](function(_0x5775cc){if(_0x5775cc){_0x41253c=_0x5775cc;return db['CmContact']['rawAttributes'];}})[_0x6c6f('0x29')](function(_0x3ac4e5){if(_0x3ac4e5){var _0x5c3b75={};var _0x55bb6d={};_0x55bb6d[_0x6c6f('0x3d')]=_[_0x6c6f('0x6c')](_[_0x6c6f('0x3a')](_0x3ac4e5),_[_0x6c6f('0x33')](_0x41253c['CustomFields'],function(_0x5612e9){return util[_0x6c6f('0x6d')]('cf_%d',_0x5612e9['id']);}));_0x55bb6d[_0x6c6f('0x39')]=_['keys'](_0x13c43b[_0x6c6f('0x39')]);_0x55bb6d[_0x6c6f('0x3b')]=_[_0x6c6f('0x3c')](_0x55bb6d[_0x6c6f('0x3d')],_0x55bb6d[_0x6c6f('0x39')]);_0x5c3b75['attributes']=_[_0x6c6f('0x3c')](_0x55bb6d[_0x6c6f('0x3d')],qs[_0x6c6f('0x3e')](_0x13c43b['query'][_0x6c6f('0x3e')]));_0x5c3b75['attributes']=_0x5c3b75['attributes'][_0x6c6f('0x40')]?_0x5c3b75['attributes']:_0x55bb6d[_0x6c6f('0x3d')];if(!_0x13c43b[_0x6c6f('0x39')][_0x6c6f('0x41')](_0x6c6f('0x42'))){_0x5c3b75[_0x6c6f('0x22')]=qs[_0x6c6f('0x22')](_0x13c43b[_0x6c6f('0x39')]['limit']);_0x5c3b75['offset']=qs['offset'](_0x13c43b['query']['offset']);}_0x5c3b75[_0x6c6f('0x43')]=qs[_0x6c6f('0x44')](_0x13c43b[_0x6c6f('0x39')][_0x6c6f('0x44')]);_0x5c3b75[_0x6c6f('0x47')]=qs[_0x6c6f('0x3b')](_[_0x6c6f('0x45')](_0x13c43b[_0x6c6f('0x39')],_0x55bb6d['filters']));_0x5c3b75[_0x6c6f('0x6e')]=!![];if(_0x13c43b[_0x6c6f('0x39')][_0x6c6f('0x46')]){_0x5c3b75[_0x6c6f('0x47')]=_[_0x6c6f('0x48')](_0x5c3b75['where'],{'$or':_['map'](_0x5c3b75[_0x6c6f('0x3f')],function(_0x22571b){var _0x361ec7={};_0x361ec7[_0x22571b]={'$like':'%'+_0x13c43b['query'][_0x6c6f('0x46')]+'%'};return _0x361ec7;})});}_0x5c3b75=_['merge']({},_0x5c3b75,_0x13c43b[_0x6c6f('0x49')]);return _0x41253c[_0x6c6f('0x69')](_0x5c3b75);}})['then'](respondWithResult(_0x2a1ca4,null))[_0x6c6f('0x4e')](handleError(_0x2a1ca4,null));};exports['getContactsCsv']=function(_0x244c07,_0x50aac3,_0x647b93){var _0x4b8c62;return db[_0x6c6f('0x34')]['find']({'where':{'id':_0x244c07['params']['id']},'include':[{'model':db[_0x6c6f('0x6a')],'as':_0x6c6f('0x6b')}]})[_0x6c6f('0x29')](handleEntityNotFound(_0x50aac3,null))[_0x6c6f('0x29')](function(_0x3570e0){if(_0x3570e0){_0x4b8c62=_0x3570e0;return db[_0x6c6f('0x64')]['rawAttributes'];}})[_0x6c6f('0x29')](function(_0x3bcfd2){if(_0x3bcfd2){var _0x3222b9={};var _0x3cf533={};_0x3cf533[_0x6c6f('0x3d')]=_['concat'](_[_0x6c6f('0x3a')](_0x3bcfd2),_[_0x6c6f('0x33')](_0x4b8c62['CustomFields'],function(_0x3f84a8){return util[_0x6c6f('0x6d')]('cf_%d',_0x3f84a8['id']);}));_0x3cf533[_0x6c6f('0x39')]=_['keys'](_0x244c07[_0x6c6f('0x39')]);_0x3cf533[_0x6c6f('0x3b')]=_[_0x6c6f('0x3c')](_0x3cf533[_0x6c6f('0x3d')],_0x3cf533['query']);_0x3222b9[_0x6c6f('0x3f')]=_[_0x6c6f('0x3c')](_0x3cf533[_0x6c6f('0x3d')],qs[_0x6c6f('0x3e')](_0x244c07[_0x6c6f('0x39')]['fields']));_0x3222b9[_0x6c6f('0x3f')]=_0x3222b9[_0x6c6f('0x3f')][_0x6c6f('0x40')]?_0x3222b9['attributes']:_0x3cf533[_0x6c6f('0x3d')];if(!_0x244c07[_0x6c6f('0x39')][_0x6c6f('0x41')](_0x6c6f('0x42'))){_0x3222b9[_0x6c6f('0x22')]=qs[_0x6c6f('0x22')](_0x244c07[_0x6c6f('0x39')]['limit']);_0x3222b9['offset']=qs['offset'](_0x244c07['query'][_0x6c6f('0x23')]);}_0x3222b9['order']=qs[_0x6c6f('0x44')](_0x244c07[_0x6c6f('0x39')][_0x6c6f('0x44')]);_0x3222b9[_0x6c6f('0x47')]=qs[_0x6c6f('0x3b')](_[_0x6c6f('0x45')](_0x244c07[_0x6c6f('0x39')],_0x3cf533[_0x6c6f('0x3b')]));_0x3222b9[_0x6c6f('0x6e')]=!![];if(_0x244c07[_0x6c6f('0x39')]['filter']){_0x3222b9['where']=_[_0x6c6f('0x48')](_0x3222b9[_0x6c6f('0x47')],{'$or':_[_0x6c6f('0x33')](_0x3222b9['attributes'],function(_0xcc6dd6){var _0x591ce0={};_0x591ce0[_0xcc6dd6]={'$like':'%'+_0x244c07[_0x6c6f('0x39')]['filter']+'%'};return _0x591ce0;})});}_0x3222b9=_['merge']({},_0x3222b9,_0x244c07[_0x6c6f('0x49')]);return _0x4b8c62[_0x6c6f('0x69')](_0x3222b9);}})['then'](function(_0x3e7ab0){if(!_[_0x6c6f('0x6f')](_0x3e7ab0)){var _0x51491c=toCsv(_0x3e7ab0);var _0x4a4cc8=Date[_0x6c6f('0x70')]();fs[_0x6c6f('0x71')](util[_0x6c6f('0x6d')](_0x6c6f('0x72'),_0x4b8c62['id'],_0x4a4cc8),_0x51491c);_0x50aac3[_0x6c6f('0x73')](_0x6c6f('0x74'),_0x6c6f('0x75')+util[_0x6c6f('0x6d')](_0x6c6f('0x76'),_0x4b8c62['id'],_0x4a4cc8));_0x50aac3['setHeader']('Content-type',_0x6c6f('0x77'));return _0x50aac3[_0x6c6f('0x78')](util['format']('/tmp/list_%d_%s.csv',_0x4b8c62['id'],_0x4a4cc8));}else{return _0x50aac3[_0x6c6f('0x2d')](0xcc);}})[_0x6c6f('0x4e')](handleError(_0x50aac3,null));};exports[_0x6c6f('0x79')]=function(_0x4eb412,_0x454601,_0x45f7d0){var _0x36638f;delete _0x4eb412['body']['id'];return db['CmList'][_0x6c6f('0x7a')]({'where':{'id':_0x4eb412[_0x6c6f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x454601,null))[_0x6c6f('0x29')](function(_0x4ee626){if(_0x4ee626){return db[_0x6c6f('0x7b')][_0x6c6f('0x7c')](function(_0x31a0b2){return db[_0x6c6f('0x6a')]['create'](_0x4eb412[_0x6c6f('0x50')],{'transaction':_0x31a0b2})['then'](function(_0x1da2a0){_0x36638f=_0x1da2a0;return _0x4ee626[_0x6c6f('0x7d')](_0x1da2a0,{'transaction':_0x31a0b2});})[_0x6c6f('0x29')](function(){var _0x12bbc2={'type':db[_0x6c6f('0x7e')]['TEXT'],'transaction':_0x31a0b2};switch(_0x4eb412[_0x6c6f('0x50')][_0x6c6f('0x37')]){case'text':_0x12bbc2[_0x6c6f('0x37')]=db[_0x6c6f('0x7e')][_0x6c6f('0x7f')];break;case _0x6c6f('0x80'):_0x12bbc2[_0x6c6f('0x37')]=db[_0x6c6f('0x7e')][_0x6c6f('0x81')];break;case _0x6c6f('0x82'):_0x12bbc2['type']=db[_0x6c6f('0x7e')]['BOOLEAN'];_0x12bbc2['defaultValue']=![];break;default:}return db[_0x6c6f('0x7b')]['queryInterface'][_0x6c6f('0x83')]('cm_contacts',util[_0x6c6f('0x6d')](_0x6c6f('0x84'),_0x36638f['id']),_0x12bbc2);})[_0x6c6f('0x29')](function(){return _0x36638f;});});}})[_0x6c6f('0x29')](respondWithResult(_0x454601,null))['catch'](handleError(_0x454601,null));};exports['getCustomFields']=function(_0x4f0e1c,_0x5a9dde,_0x17c666){var _0x83b746={};var _0x1f9ef4={};var _0x1982a4;var _0x5c5725;return db['CmList'][_0x6c6f('0x7a')]({'where':{'id':_0x4f0e1c['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x5a9dde,null))[_0x6c6f('0x29')](function(_0x1643e6){if(_0x1643e6){_0x1982a4=_0x1643e6;_0x1f9ef4[_0x6c6f('0x3d')]=_['keys'](db[_0x6c6f('0x6a')][_0x6c6f('0x35')]);_0x1f9ef4[_0x6c6f('0x39')]=_[_0x6c6f('0x3a')](_0x4f0e1c[_0x6c6f('0x39')]);_0x1f9ef4['filters']=_[_0x6c6f('0x3c')](_0x1f9ef4['model'],_0x1f9ef4[_0x6c6f('0x39')]);_0x83b746[_0x6c6f('0x3f')]=_[_0x6c6f('0x3c')](_0x1f9ef4[_0x6c6f('0x3d')],qs['fields'](_0x4f0e1c[_0x6c6f('0x39')][_0x6c6f('0x3e')]));_0x83b746['attributes']=_0x83b746[_0x6c6f('0x3f')][_0x6c6f('0x40')]?_0x83b746[_0x6c6f('0x3f')]:_0x1f9ef4[_0x6c6f('0x3d')];_0x83b746[_0x6c6f('0x43')]=qs[_0x6c6f('0x44')](_0x4f0e1c[_0x6c6f('0x39')][_0x6c6f('0x44')]);_0x83b746[_0x6c6f('0x47')]=qs[_0x6c6f('0x3b')](_[_0x6c6f('0x45')](_0x4f0e1c[_0x6c6f('0x39')],_0x1f9ef4[_0x6c6f('0x3b')]));_0x83b746['where']=_['merge'](_0x83b746[_0x6c6f('0x47')],{'$or':[{'ListId':_0x1643e6['id']},{'ListId':null}]});if(_0x4f0e1c['query'][_0x6c6f('0x46')]){_0x83b746[_0x6c6f('0x47')]=_[_0x6c6f('0x48')](_0x83b746['where'],{'$or':_[_0x6c6f('0x33')](_0x83b746[_0x6c6f('0x3f')],function(_0x1cc27a){var _0x3bbe4d={};_0x3bbe4d[_0x1cc27a]={'$like':'%'+_0x4f0e1c[_0x6c6f('0x39')]['filter']+'%'};return _0x3bbe4d;})});}_0x83b746=_['merge']({},_0x83b746,_0x4f0e1c[_0x6c6f('0x49')]);return db[_0x6c6f('0x6a')]['findAndCountAll'](_0x83b746);}})[_0x6c6f('0x29')](respondWithResult(_0x5a9dde,null))[_0x6c6f('0x4e')](handleError(_0x5a9dde,null));};exports['addAgents']=function(_0x11b37d,_0x2ffb1e,_0x4f8228){return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x11b37d[_0x6c6f('0x4d')]['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x2ffb1e,null))[_0x6c6f('0x29')](function(_0x4f0f2a){if(_0x4f0f2a){return _0x4f0f2a[_0x6c6f('0x85')](_0x11b37d[_0x6c6f('0x50')][_0x6c6f('0x86')],_['omit'](_0x11b37d[_0x6c6f('0x50')],['ids','id'])||{})[_0x6c6f('0x87')](function(_0x100e84){for(var _0x716462=0x0;_0x716462<_0x11b37d[_0x6c6f('0x50')][_0x6c6f('0x86')][_0x6c6f('0x40')];_0x716462+=0x1){socket[_0x6c6f('0x88')]('userCmList:save',{'UserId':Number(_0x11b37d[_0x6c6f('0x50')]['ids'][_0x716462]),'CmListId':Number(_0x11b37d[_0x6c6f('0x4d')]['id'])});}return _0x100e84;});}})[_0x6c6f('0x29')](respondWithResult(_0x2ffb1e,null))[_0x6c6f('0x4e')](handleError(_0x2ffb1e,null));};exports[_0x6c6f('0x89')]=function(_0x551bb6,_0x45472b,_0x1bd6c1){return db[_0x6c6f('0x34')][_0x6c6f('0x58')]({'where':{'id':_0x551bb6['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x45472b,null))['then'](function(_0x468202){if(_0x468202){return _0x468202[_0x6c6f('0x89')](_0x551bb6[_0x6c6f('0x39')][_0x6c6f('0x86')])[_0x6c6f('0x29')](function(){if(_[_0x6c6f('0x61')](_0x551bb6[_0x6c6f('0x39')][_0x6c6f('0x86')])){for(var _0x78ebd8=0x0;_0x78ebd8<_0x551bb6[_0x6c6f('0x39')]['ids'][_0x6c6f('0x40')];_0x78ebd8+=0x1){socket['emit'](_0x6c6f('0x8a'),{'UserId':Number(_0x551bb6['query']['ids'][_0x78ebd8]),'CmListId':Number(_0x551bb6[_0x6c6f('0x4d')]['id'])});}}else{socket[_0x6c6f('0x88')](_0x6c6f('0x8a'),{'UserId':Number(_0x551bb6['query'][_0x6c6f('0x86')]),'CmListId':Number(_0x551bb6['params']['id'])});}});}})[_0x6c6f('0x29')](respondWithStatusCode(_0x45472b,null))[_0x6c6f('0x4e')](handleError(_0x45472b,null));};exports[_0x6c6f('0x8b')]=function(_0x520c7a,_0x1432f8,_0x45cb84){var _0x147864={};var _0x372931={};var _0x5b9cff;var _0x5d44db;return db[_0x6c6f('0x34')][_0x6c6f('0x7a')]({'where':{'id':_0x520c7a['params']['id']}})[_0x6c6f('0x29')](handleEntityNotFound(_0x1432f8,null))[_0x6c6f('0x29')](function(_0x38de25){if(_0x38de25){_0x5b9cff=_0x38de25;_0x372931[_0x6c6f('0x3d')]=_['keys'](db[_0x6c6f('0x8c')][_0x6c6f('0x35')]);_0x372931['query']=_[_0x6c6f('0x3a')](_0x520c7a[_0x6c6f('0x39')]);_0x372931[_0x6c6f('0x3b')]=_[_0x6c6f('0x3c')](_0x372931[_0x6c6f('0x3d')],_0x372931['query']);_0x147864[_0x6c6f('0x3f')]=_[_0x6c6f('0x3c')](_0x372931[_0x6c6f('0x3d')],qs['fields'](_0x520c7a['query'][_0x6c6f('0x3e')]));_0x147864[_0x6c6f('0x3f')]=_0x147864['attributes']['length']?_0x147864['attributes']:_0x372931['model'];_0x147864[_0x6c6f('0x43')]=qs['sort'](_0x520c7a['query'][_0x6c6f('0x44')]);_0x147864['where']=qs['filters'](_[_0x6c6f('0x45')](_0x520c7a[_0x6c6f('0x39')],_0x372931[_0x6c6f('0x3b')]));if(_0x520c7a[_0x6c6f('0x39')][_0x6c6f('0x46')]){_0x147864[_0x6c6f('0x47')]=_[_0x6c6f('0x48')](_0x147864[_0x6c6f('0x47')],{'$or':_[_0x6c6f('0x33')](_0x147864[_0x6c6f('0x3f')],function(_0x440995){var _0x5c1967={};_0x5c1967[_0x440995]={'$like':'%'+_0x520c7a[_0x6c6f('0x39')]['filter']+'%'};return _0x5c1967;})});}_0x147864=_[_0x6c6f('0x48')]({},_0x147864,_0x520c7a['options']);return _0x5b9cff[_0x6c6f('0x8b')](_0x147864);}})[_0x6c6f('0x29')](function(_0x480a4a){if(_0x480a4a){_0x5d44db=_0x480a4a['length'];if(!_0x520c7a[_0x6c6f('0x39')][_0x6c6f('0x41')](_0x6c6f('0x42'))){_0x147864['limit']=qs[_0x6c6f('0x22')](_0x520c7a[_0x6c6f('0x39')]['limit']);_0x147864[_0x6c6f('0x23')]=qs[_0x6c6f('0x23')](_0x520c7a[_0x6c6f('0x39')]['offset']);}return _0x5b9cff[_0x6c6f('0x8b')](_0x147864);}})['then'](function(_0x242218){if(_0x242218){return _0x242218?{'count':_0x5d44db,'rows':_0x242218}:null;}})['then'](respondWithResult(_0x1432f8,null))[_0x6c6f('0x4e')](handleError(_0x1432f8,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 50db22b..4341243 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x2170fe,_0x46562d){_0x2170fe=_0x2170fe-0x0;var _0xd6775c=_0x3e74[_0x2170fe];return _0xd6775c;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x13fef9,_0xbb55cc){var _0x110c18=function(_0x34ba1b){while(--_0x34ba1b){_0x13fef9['push'](_0x13fef9['shift']());}};_0x110c18(++_0xbb55cc);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 9e0d715..a70537c 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','lodash'];(function(_0x326454,_0x3ef969){var _0x5bce4c=function(_0x12ded2){while(--_0x12ded2){_0x326454['push'](_0x326454['shift']());}};_0x5bce4c(++_0x3ef969);}(_0xdace,0xc5));var _0xedac=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0xdace[_0x29d623];return _0x242e59;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./cmList.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x668b=['cm_lists','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cmList.attributes','define','CmList'];(function(_0x142156,_0x5169f8){var _0x5b1ea3=function(_0x26080b){while(--_0x26080b){_0x142156['push'](_0x142156['shift']());}};_0x5b1ea3(++_0x5169f8);}(_0x668b,0x140));var _0xb668=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x668b[_0x35a140];return _0x30ab82;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index c4f0548..57c0bce 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 _0x499f=['rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x160001,_0x43ccc5){var _0x284669=function(_0x5482ac){while(--_0x5482ac){_0x160001['push'](_0x160001['shift']());}};_0x284669(++_0x43ccc5);}(_0x499f,0x1bd));var _0xf499=function(_0x1b5d5f,_0x5ed766){_0x1b5d5f=_0x1b5d5f-0x0;var _0x3c9347=_0x499f[_0x1b5d5f];return _0x3c9347;};'use strict';var _=require(_0xf499('0x0'));var util=require(_0xf499('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf499('0x2'));var db=require(_0xf499('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf499('0x4'))(_0xf499('0x5'));var config=require(_0xf499('0x6'));var jayson=require(_0xf499('0x7'));var client=jayson[_0xf499('0x8')]['http']({'port':0x232a});config[_0xf499('0x9')]=_['defaults'](config[_0xf499('0x9')],{'host':_0xf499('0xa'),'port':0x18eb});var socket=require(_0xf499('0xb'))(new Redis(config[_0xf499('0x9')]));require(_0xf499('0xc'))[_0xf499('0xd')](socket);function respondWithRpcPromise(_0x506ac9,_0x5bf0ae,_0xaf6df8){return new BPromise(function(_0xbab3ec,_0x55d44f){return client['request'](_0x506ac9,_0xaf6df8)[_0xf499('0xe')](function(_0x303301){logger[_0xf499('0xf')](_0xf499('0x10'),_0x5bf0ae,'request\x20sent');logger[_0xf499('0x11')](_0xf499('0x12'),_0x5bf0ae,'request\x20sent',JSON[_0xf499('0x13')](_0x303301));if(_0x303301[_0xf499('0x14')]){if(_0x303301['error'][_0xf499('0x15')]===0x1f4){logger[_0xf499('0x14')](_0xf499('0x10'),_0x5bf0ae,_0x303301[_0xf499('0x14')][_0xf499('0x16')]);return _0x55d44f(_0x303301[_0xf499('0x14')][_0xf499('0x16')]);}logger[_0xf499('0x14')](_0xf499('0x10'),_0x5bf0ae,_0x303301[_0xf499('0x14')][_0xf499('0x16')]);return _0xbab3ec(_0x303301[_0xf499('0x14')][_0xf499('0x16')]);}else{logger[_0xf499('0xf')](_0xf499('0x10'),_0x5bf0ae,'request\x20sent');_0xbab3ec(_0x303301[_0xf499('0x17')][_0xf499('0x16')]);}})[_0xf499('0x18')](function(_0x3d1c03){logger[_0xf499('0x14')](_0xf499('0x10'),_0x5bf0ae,_0x3d1c03);_0x55d44f(_0x3d1c03);});});} \ No newline at end of file +var _0x6164=['defaults','socket.io-emitter','./cmList.socket','request','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis'];(function(_0x206711,_0x4125b4){var _0x4fe02b=function(_0x27dc45){while(--_0x27dc45){_0x206711['push'](_0x206711['shift']());}};_0x4fe02b(++_0x4125b4);}(_0x6164,0x6d));var _0x4616=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0x6164[_0x3e2480];return _0x652c0;};'use strict';var _=require(_0x4616('0x0'));var util=require(_0x4616('0x1'));var moment=require(_0x4616('0x2'));var BPromise=require(_0x4616('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4616('0x4'));var db=require(_0x4616('0x5'))['db'];var utils=require(_0x4616('0x6'));var logger=require('../../config/logger')(_0x4616('0x7'));var config=require('../../config/environment');var jayson=require(_0x4616('0x8'));var client=jayson[_0x4616('0x9')]['http']({'port':0x232a});config[_0x4616('0xa')]=_[_0x4616('0xb')](config[_0x4616('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4616('0xc'))(new Redis(config['redis']));require(_0x4616('0xd'))['register'](socket);function respondWithRpcPromise(_0x1e2f2d,_0x10d5e8,_0x3a1be6){return new BPromise(function(_0x1ccc6b,_0x376555){return client[_0x4616('0xe')](_0x1e2f2d,_0x3a1be6)['then'](function(_0x11970b){logger['info'](_0x4616('0xf'),_0x10d5e8,_0x4616('0x10'));logger[_0x4616('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x10d5e8,_0x4616('0x10'),JSON[_0x4616('0x12')](_0x11970b));if(_0x11970b[_0x4616('0x13')]){if(_0x11970b[_0x4616('0x13')][_0x4616('0x14')]===0x1f4){logger[_0x4616('0x13')](_0x4616('0xf'),_0x10d5e8,_0x11970b[_0x4616('0x13')][_0x4616('0x15')]);return _0x376555(_0x11970b['error'][_0x4616('0x15')]);}logger['error'](_0x4616('0xf'),_0x10d5e8,_0x11970b[_0x4616('0x13')][_0x4616('0x15')]);return _0x1ccc6b(_0x11970b[_0x4616('0x13')]['message']);}else{logger[_0x4616('0x16')](_0x4616('0xf'),_0x10d5e8,_0x4616('0x10'));_0x1ccc6b(_0x11970b[_0x4616('0x17')]['message']);}})['catch'](function(_0x2efa96){logger[_0x4616('0x13')]('CmList,\x20%s,\x20%s',_0x10d5e8,_0x2efa96);_0x376555(_0x2efa96);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 58878f3..7ae51e9 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 _0xe11b=['length','cmList:','./cmList.events','save','update','emit','removeListener'];(function(_0x3b64b7,_0x154cf9){var _0x38161f=function(_0x5bef38){while(--_0x5bef38){_0x3b64b7['push'](_0x3b64b7['shift']());}};_0x38161f(++_0x154cf9);}(_0xe11b,0xaa));var _0xbe11=function(_0x7050ad,_0x9b2f03){_0x7050ad=_0x7050ad-0x0;var _0x35113c=_0xe11b[_0x7050ad];return _0x35113c;};'use strict';var CmListEvents=require(_0xbe11('0x0'));var events=[_0xbe11('0x1'),'remove',_0xbe11('0x2')];function createListener(_0x228bf3,_0x2912bf){return function(_0x410b1e){_0x2912bf[_0xbe11('0x3')](_0x228bf3,_0x410b1e);};}function removeListener(_0x564c63,_0x330f8e){return function(){CmListEvents[_0xbe11('0x4')](_0x564c63,_0x330f8e);};}exports['register']=function(_0x16a0e5){for(var _0x2bd8e0=0x0,_0xb802d2=events[_0xbe11('0x5')];_0x2bd8e0<_0xb802d2;_0x2bd8e0++){var _0x4278dd=events[_0x2bd8e0];var _0xae10ef=createListener(_0xbe11('0x6')+_0x4278dd,_0x16a0e5);CmListEvents['on'](_0x4278dd,_0xae10ef);}}; \ No newline at end of file +var _0xe776=['remove','update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x1d4d67,_0x5c92b6){var _0x9fd1fb=function(_0x44d9e9){while(--_0x44d9e9){_0x1d4d67['push'](_0x1d4d67['shift']());}};_0x9fd1fb(++_0x5c92b6);}(_0xe776,0xc4));var _0x6e77=function(_0x4c727f,_0x312e30){_0x4c727f=_0x4c727f-0x0;var _0x10b72b=_0xe776[_0x4c727f];return _0x10b72b;};'use strict';var CmListEvents=require(_0x6e77('0x0'));var events=[_0x6e77('0x1'),_0x6e77('0x2'),_0x6e77('0x3')];function createListener(_0x48b69b,_0x11b191){return function(_0x44adbb){_0x11b191[_0x6e77('0x4')](_0x48b69b,_0x44adbb);};}function removeListener(_0x48af48,_0x52383c){return function(){CmListEvents[_0x6e77('0x5')](_0x48af48,_0x52383c);};}exports[_0x6e77('0x6')]=function(_0x106ca9){for(var _0x5a1a50=0x0,_0x3e771d=events[_0x6e77('0x7')];_0x5a1a50<_0x3e771d;_0x5a1a50++){var _0x53c51c=events[_0x5a1a50];var _0x112485=createListener(_0x6e77('0x8')+_0x53c51c,_0x106ca9);CmListEvents['on'](_0x53c51c,_0x112485);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c3f6274..ef4005e 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 _0x7452=['removeDispositions','removeAgents','exports','util','path','connect-timeout','Router','./cmList.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','post','/:id/dispositions','addDisposition','/:id/contacts','addContacts','addAgents','/:id','update','delete','destroy'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0x7452,0x12f));var _0x2745=function(_0x460c41,_0x10df8e){_0x460c41=_0x460c41-0x0;var _0x19b931=_0x7452[_0x460c41];return _0x19b931;};'use strict';var multer=require('multer');var util=require(_0x2745('0x0'));var path=require(_0x2745('0x1'));var timeout=require(_0x2745('0x2'));var express=require('express');var router=express[_0x2745('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(_0x2745('0x4'));router[_0x2745('0x5')]('/',auth[_0x2745('0x6')](),controller[_0x2745('0x7')]);router[_0x2745('0x5')](_0x2745('0x8'),auth[_0x2745('0x6')](),controller[_0x2745('0x9')]);router[_0x2745('0x5')]('/:id',auth[_0x2745('0x6')](),controller[_0x2745('0xa')]);router[_0x2745('0x5')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2745('0xb')]);router[_0x2745('0x5')]('/:id/contacts',auth[_0x2745('0x6')](),controller[_0x2745('0xc')]);router[_0x2745('0x5')](_0x2745('0xd'),auth[_0x2745('0x6')](),controller[_0x2745('0xe')]);router[_0x2745('0x5')](_0x2745('0xf'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0x2745('0x5')](_0x2745('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x2745('0x11')]('/',auth[_0x2745('0x6')](),controller['create']);router[_0x2745('0x11')](_0x2745('0x12'),auth['isAuthenticated'](),controller[_0x2745('0x13')]);router['post'](_0x2745('0x14'),auth[_0x2745('0x6')](),controller[_0x2745('0x15')]);router[_0x2745('0x11')](_0x2745('0xf'),auth[_0x2745('0x6')](),controller['addCustomField']);router[_0x2745('0x11')]('/:id/users',auth[_0x2745('0x6')](),controller[_0x2745('0x16')]);router['put'](_0x2745('0x17'),auth[_0x2745('0x6')](),controller[_0x2745('0x18')]);router[_0x2745('0x19')](_0x2745('0x17'),auth[_0x2745('0x6')](),controller[_0x2745('0x1a')]);router['delete'](_0x2745('0x12'),auth['isAuthenticated'](),controller[_0x2745('0x1b')]);router[_0x2745('0x19')](_0x2745('0x10'),auth[_0x2745('0x6')](),controller[_0x2745('0x1c')]);module[_0x2745('0x1d')]=router; \ No newline at end of file +var _0x668d=['delete','/:id/dispositions','removeDispositions','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','/:id','update'];(function(_0x3fb9ca,_0x28de6d){var _0x5e0b5e=function(_0x5ad64d){while(--_0x5ad64d){_0x3fb9ca['push'](_0x3fb9ca['shift']());}};_0x5e0b5e(++_0x28de6d);}(_0x668d,0x1c0));var _0xd668=function(_0x4d6d8a,_0x4efda0){_0x4d6d8a=_0x4d6d8a-0x0;var _0x306157=_0x668d[_0x4d6d8a];return _0x306157;};'use strict';var multer=require(_0xd668('0x0'));var util=require(_0xd668('0x1'));var path=require(_0xd668('0x2'));var timeout=require(_0xd668('0x3'));var express=require('express');var router=express[_0xd668('0x4')]();var fs_extra=require(_0xd668('0x5'));var auth=require(_0xd668('0x6'));var interaction=require(_0xd668('0x7'));var config=require(_0xd668('0x8'));var controller=require(_0xd668('0x9'));router[_0xd668('0xa')]('/',auth[_0xd668('0xb')](),controller[_0xd668('0xc')]);router[_0xd668('0xa')](_0xd668('0xd'),auth[_0xd668('0xb')](),controller[_0xd668('0xe')]);router[_0xd668('0xa')]('/:id',auth[_0xd668('0xb')](),controller[_0xd668('0xf')]);router[_0xd668('0xa')]('/:id/dispositions',auth[_0xd668('0xb')](),controller[_0xd668('0x10')]);router[_0xd668('0xa')](_0xd668('0x11'),auth[_0xd668('0xb')](),controller[_0xd668('0x12')]);router['get'](_0xd668('0x13'),auth[_0xd668('0xb')](),controller[_0xd668('0x14')]);router[_0xd668('0xa')](_0xd668('0x15'),auth[_0xd668('0xb')](),controller[_0xd668('0x16')]);router[_0xd668('0xa')](_0xd668('0x17'),auth[_0xd668('0xb')](),controller[_0xd668('0x18')]);router[_0xd668('0x19')]('/',auth['isAuthenticated'](),controller[_0xd668('0x1a')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd668('0x1b')]);router[_0xd668('0x19')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router['post'](_0xd668('0x15'),auth['isAuthenticated'](),controller[_0xd668('0x1c')]);router[_0xd668('0x19')](_0xd668('0x17'),auth[_0xd668('0xb')](),controller[_0xd668('0x1d')]);router[_0xd668('0x1e')](_0xd668('0x1f'),auth['isAuthenticated'](),controller[_0xd668('0x20')]);router[_0xd668('0x21')](_0xd668('0x1f'),auth['isAuthenticated'](),controller['destroy']);router[_0xd668('0x21')](_0xd668('0x22'),auth[_0xd668('0xb')](),controller[_0xd668('0x23')]);router[_0xd668('0x21')](_0xd668('0x17'),auth[_0xd668('0xb')](),controller['removeAgents']);module[_0xd668('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index ad58cc3..438d814 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 _0x4657=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0x2ec553,_0x292192){var _0x5d3c89=function(_0x5ab0d4){while(--_0x5ab0d4){_0x2ec553['push'](_0x2ec553['shift']());}};_0x5d3c89(++_0x292192);}(_0x4657,0x120));var _0x7465=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0x4657[_0x5e7b6c];return _0x3afdbd;};'use strict';var Sequelize=require(_0x7465('0x0'));module[_0x7465('0x1')]={'name':{'type':Sequelize[_0x7465('0x2')],'get':function(_0x557db2){return this[_0x7465('0x3')]('field');}},'field':{'type':Sequelize[_0x7465('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7465('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xd97a=['VIRTUAL','field','STRING','exports'];(function(_0x5c879e,_0xe58074){var _0x30942b=function(_0x535b57){while(--_0x535b57){_0x5c879e['push'](_0x5c879e['shift']());}};_0x30942b(++_0xe58074);}(_0xd97a,0xef));var _0xad97=function(_0x111fd9,_0x237b96){_0x111fd9=_0x111fd9-0x0;var _0x397c7e=_0xd97a[_0x111fd9];return _0x397c7e;};'use strict';var Sequelize=require('sequelize');module[_0xad97('0x0')]={'name':{'type':Sequelize[_0xad97('0x1')],'get':function(_0x2cdbd0){return this['getDataValue'](_0xad97('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xad97('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xad97('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index baee8e3..0349c89 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(_0x4ce76c,_0xac166){var _0x48fe02=function(_0x616af0){while(--_0x616af0){_0x4ce76c['push'](_0x4ce76c['shift']());}};_0x48fe02(++_0xac166);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x266181,_0x2e0297){var _0x215552=function(_0x53aa06){while(--_0x53aa06){_0x266181['push'](_0x266181['shift']());}};_0x215552(++_0x2e0297);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a66e195..1892d7e 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 _0x5c83=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./condition.attributes','define','Condition','tools_conditions'];(function(_0x4cd0a9,_0x3039a1){var _0x13e7a4=function(_0x34649b){while(--_0x34649b){_0x4cd0a9['push'](_0x4cd0a9['shift']());}};_0x13e7a4(++_0x3039a1);}(_0x5c83,0x18c));var _0x35c8=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x5c83[_0x2a2166];return _0x3bcf50;};'use strict';var _=require(_0x35c8('0x0'));var util=require(_0x35c8('0x1'));var logger=require(_0x35c8('0x2'))(_0x35c8('0x3'));var moment=require('moment');var BPromise=require(_0x35c8('0x4'));var rp=require(_0x35c8('0x5'));var fs=require('fs');var path=require(_0x35c8('0x6'));var rimraf=require(_0x35c8('0x7'));var config=require('../../config/environment');var attributes=require(_0x35c8('0x8'));module['exports']=function(_0x22133b,_0x5d1a13){return _0x22133b[_0x35c8('0x9')](_0x35c8('0xa'),attributes,{'tableName':_0x35c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x296b=['Condition','tools_conditions','lodash','../../config/logger','api','bluebird','request-promise','path','./condition.attributes','define'];(function(_0x3e10be,_0x1542c8){var _0x53ff27=function(_0x3d2377){while(--_0x3d2377){_0x3e10be['push'](_0x3e10be['shift']());}};_0x53ff27(++_0x1542c8);}(_0x296b,0x1b0));var _0xb296=function(_0x273f88,_0x5d4150){_0x273f88=_0x273f88-0x0;var _0x177ca1=_0x296b[_0x273f88];return _0x177ca1;};'use strict';var _=require(_0xb296('0x0'));var util=require('util');var logger=require(_0xb296('0x1'))(_0xb296('0x2'));var moment=require('moment');var BPromise=require(_0xb296('0x3'));var rp=require(_0xb296('0x4'));var fs=require('fs');var path=require(_0xb296('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb296('0x6'));module['exports']=function(_0xe42119,_0x18ed4c){return _0xe42119[_0xb296('0x7')](_0xb296('0x8'),attributes,{'tableName':_0xb296('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 1466e60..319de4a 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 _0xfa5d=['request\x20sent','debug','stringify','error','code','message','Condition,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x27a89f,_0x54ebc9){var _0x319072=function(_0x536c6d){while(--_0x536c6d){_0x27a89f['push'](_0x27a89f['shift']());}};_0x319072(++_0x54ebc9);}(_0xfa5d,0x1a9));var _0xdfa5=function(_0x215d4e,_0x4a9102){_0x215d4e=_0x215d4e-0x0;var _0x499403=_0xfa5d[_0x215d4e];return _0x499403;};'use strict';var _=require(_0xdfa5('0x0'));var util=require(_0xdfa5('0x1'));var moment=require('moment');var BPromise=require(_0xdfa5('0x2'));var rs=require(_0xdfa5('0x3'));var fs=require('fs');var Redis=require(_0xdfa5('0x4'));var db=require(_0xdfa5('0x5'))['db'];var utils=require(_0xdfa5('0x6'));var logger=require(_0xdfa5('0x7'))(_0xdfa5('0x8'));var config=require(_0xdfa5('0x9'));var jayson=require(_0xdfa5('0xa'));var client=jayson['client'][_0xdfa5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10c5a3,_0x3edfd7,_0x647892){return new BPromise(function(_0x52292b,_0x2dc85a){return client[_0xdfa5('0xc')](_0x10c5a3,_0x647892)[_0xdfa5('0xd')](function(_0x154bf1){logger[_0xdfa5('0xe')]('Condition,\x20%s,\x20%s',_0x3edfd7,_0xdfa5('0xf'));logger[_0xdfa5('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x3edfd7,_0xdfa5('0xf'),JSON[_0xdfa5('0x11')](_0x154bf1));if(_0x154bf1[_0xdfa5('0x12')]){if(_0x154bf1[_0xdfa5('0x12')][_0xdfa5('0x13')]===0x1f4){logger[_0xdfa5('0x12')]('Condition,\x20%s,\x20%s',_0x3edfd7,_0x154bf1[_0xdfa5('0x12')][_0xdfa5('0x14')]);return _0x2dc85a(_0x154bf1['error'][_0xdfa5('0x14')]);}logger[_0xdfa5('0x12')](_0xdfa5('0x15'),_0x3edfd7,_0x154bf1[_0xdfa5('0x12')][_0xdfa5('0x14')]);return _0x52292b(_0x154bf1[_0xdfa5('0x12')][_0xdfa5('0x14')]);}else{logger[_0xdfa5('0xe')](_0xdfa5('0x15'),_0x3edfd7,_0xdfa5('0xf'));_0x52292b(_0x154bf1['result'][_0xdfa5('0x14')]);}})['catch'](function(_0xe3e13a){logger[_0xdfa5('0x12')](_0xdfa5('0x15'),_0x3edfd7,_0xe3e13a);_0x2dc85a(_0xe3e13a);});});} \ No newline at end of file +var _0x1603=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','request\x20sent','moment'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1603,0x1f3));var _0x3160=function(_0x1203ef,_0x4c69a1){_0x1203ef=_0x1203ef-0x0;var _0x1f2b50=_0x1603[_0x1203ef];return _0x1f2b50;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3160('0x0'));var BPromise=require(_0x3160('0x1'));var rs=require(_0x3160('0x2'));var fs=require('fs');var Redis=require(_0x3160('0x3'));var db=require(_0x3160('0x4'))['db'];var utils=require(_0x3160('0x5'));var logger=require(_0x3160('0x6'))(_0x3160('0x7'));var config=require(_0x3160('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3160('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51cf07,_0x36331a,_0x2b0808){return new BPromise(function(_0x3e0e90,_0x5cf66e){return client[_0x3160('0xa')](_0x51cf07,_0x2b0808)[_0x3160('0xb')](function(_0x29d444){logger[_0x3160('0xc')]('Condition,\x20%s,\x20%s',_0x36331a,'request\x20sent');logger[_0x3160('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x36331a,'request\x20sent',JSON[_0x3160('0xe')](_0x29d444));if(_0x29d444[_0x3160('0xf')]){if(_0x29d444['error'][_0x3160('0x10')]===0x1f4){logger[_0x3160('0xf')](_0x3160('0x11'),_0x36331a,_0x29d444[_0x3160('0xf')][_0x3160('0x12')]);return _0x5cf66e(_0x29d444[_0x3160('0xf')][_0x3160('0x12')]);}logger['error'](_0x3160('0x11'),_0x36331a,_0x29d444[_0x3160('0xf')]['message']);return _0x3e0e90(_0x29d444[_0x3160('0xf')][_0x3160('0x12')]);}else{logger[_0x3160('0xc')](_0x3160('0x11'),_0x36331a,_0x3160('0x13'));_0x3e0e90(_0x29d444['result'][_0x3160('0x12')]);}})['catch'](function(_0x64551e){logger[_0x3160('0xf')](_0x3160('0x11'),_0x36331a,_0x64551e);_0x5cf66e(_0x64551e);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index fa57701..0feffab 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 _0x7d18=['isAuthenticated','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','delete'];(function(_0x4ffb4a,_0xcbec64){var _0x55c2ee=function(_0xd48574){while(--_0xd48574){_0x4ffb4a['push'](_0x4ffb4a['shift']());}};_0x55c2ee(++_0xcbec64);}(_0x7d18,0x1ca));var _0x87d1=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x7d18[_0x48d6a3];return _0x38bfa0;};'use strict';var multer=require('multer');var util=require(_0x87d1('0x0'));var path=require(_0x87d1('0x1'));var timeout=require(_0x87d1('0x2'));var express=require('express');var router=express[_0x87d1('0x3')]();var fs_extra=require(_0x87d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x87d1('0x5'));var config=require(_0x87d1('0x6'));var controller=require(_0x87d1('0x7'));router[_0x87d1('0x8')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x87d1('0x9')]('/:id',auth[_0x87d1('0xa')](),controller[_0x87d1('0xb')]);module[_0x87d1('0xc')]=router; \ No newline at end of file +var _0x5caf=['isAuthenticated','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put'];(function(_0x397f0d,_0x321cdb){var _0x44059c=function(_0x2f8929){while(--_0x2f8929){_0x397f0d['push'](_0x397f0d['shift']());}};_0x44059c(++_0x321cdb);}(_0x5caf,0x149));var _0xf5ca=function(_0x396e2d,_0x7831f8){_0x396e2d=_0x396e2d-0x0;var _0x31b7bb=_0x5caf[_0x396e2d];return _0x31b7bb;};'use strict';var multer=require(_0xf5ca('0x0'));var util=require(_0xf5ca('0x1'));var path=require(_0xf5ca('0x2'));var timeout=require('connect-timeout');var express=require(_0xf5ca('0x3'));var router=express[_0xf5ca('0x4')]();var fs_extra=require(_0xf5ca('0x5'));var auth=require(_0xf5ca('0x6'));var interaction=require(_0xf5ca('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xf5ca('0x8')]('/:id',auth[_0xf5ca('0x9')](),controller['update']);router['delete'](_0xf5ca('0xa'),auth[_0xf5ca('0x9')](),controller[_0xf5ca('0xb')]);module[_0xf5ca('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index bf6120d..9eafe90 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 _0x2032=['name','exports','STRING'];(function(_0xc70602,_0x531f15){var _0x338b62=function(_0x47bec1){while(--_0x47bec1){_0xc70602['push'](_0xc70602['shift']());}};_0x338b62(++_0x531f15);}(_0x2032,0xd9));var _0x2203=function(_0xf4b244,_0x356f88){_0xf4b244=_0xf4b244-0x0;var _0x1fa1bf=_0x2032[_0xf4b244];return _0x1fa1bf;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0xab19c8,_0x3debf2){var _0x5e459f=function(_0x3af030){while(--_0x3af030){_0xab19c8['push'](_0xab19c8['shift']());}};_0x5e459f(++_0x3debf2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 37441f3..b6b2b6f 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 _0x9e5a=['map','Dashboard','rawAttributes','type','model','name','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','intersection','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','params','iframe','attrUrl','attrs','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardItem','getItems','pick','eml-format','request-promise','moment','bluebird','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./dashboard.socket','register','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','error','stack'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x9e5a,0x12f));var _0xa9e5=function(_0x3fbcc4,_0x77e012){_0x3fbcc4=_0x3fbcc4-0x0;var _0x136a54=_0x9e5a[_0x3fbcc4];return _0x136a54;};'use strict';var emlformat=require(_0xa9e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa9e5('0x1'));var moment=require(_0xa9e5('0x2'));var BPromise=require(_0xa9e5('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa9e5('0x4'));var fs=require('fs');var fs_extra=require(_0xa9e5('0x5'));var _=require(_0xa9e5('0x6'));var squel=require(_0xa9e5('0x7'));var crypto=require(_0xa9e5('0x8'));var jsforce=require(_0xa9e5('0x9'));var deskjs=require(_0xa9e5('0xa'));var toCsv=require(_0xa9e5('0xb'));var querystring=require(_0xa9e5('0xc'));var Papa=require(_0xa9e5('0xd'));var Redis=require(_0xa9e5('0xe'));var authService=require(_0xa9e5('0xf'));var qs=require(_0xa9e5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9e5('0x11'));var logger=require(_0xa9e5('0x12'))(_0xa9e5('0x13'));var utils=require(_0xa9e5('0x14'));var config=require(_0xa9e5('0x15'));var licenseUtil=require(_0xa9e5('0x16'));var db=require(_0xa9e5('0x17'))['db'];config['redis']=_[_0xa9e5('0x18')](config[_0xa9e5('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9e5('0x19')]));require(_0xa9e5('0x1a'))[_0xa9e5('0x1b')](socket);function respondWithStatusCode(_0x11abc8,_0x280a6c){_0x280a6c=_0x280a6c||0xcc;return function(_0x35c28e){if(_0x35c28e){return _0x11abc8['sendStatus'](_0x280a6c);}return _0x11abc8['status'](_0x280a6c)[_0xa9e5('0x1c')]();};}function respondWithResult(_0x3086d5,_0x401ab6){_0x401ab6=_0x401ab6||0xc8;return function(_0x2025fb){if(_0x2025fb){return _0x3086d5[_0xa9e5('0x1d')](_0x401ab6)[_0xa9e5('0x1e')](_0x2025fb);}};}function respondWithFilteredResult(_0x3c3e29,_0x397cba){return function(_0x21215c){if(_0x21215c){var _0xd9fbfd=typeof _0x397cba['offset']==='undefined'&&typeof _0x397cba[_0xa9e5('0x1f')]===_0xa9e5('0x20');var _0x4bd8c7=_0x21215c[_0xa9e5('0x21')];var _0x284fe8=_0xd9fbfd?0x0:_0x397cba[_0xa9e5('0x22')];var _0x4a3c90=_0xd9fbfd?_0x21215c[_0xa9e5('0x21')]:_0x397cba[_0xa9e5('0x22')]+_0x397cba[_0xa9e5('0x1f')];var _0x31518f;if(_0x4a3c90>=_0x4bd8c7){_0x4a3c90=_0x4bd8c7;_0x31518f=0xc8;}else{_0x31518f=0xce;}_0x3c3e29[_0xa9e5('0x1d')](_0x31518f);return _0x3c3e29[_0xa9e5('0x23')](_0xa9e5('0x24'),_0x284fe8+'-'+_0x4a3c90+'/'+_0x4bd8c7)[_0xa9e5('0x1e')](_0x21215c);}return null;};}function patchUpdates(_0x42db64){return function(_0x460bca){try{jsonpatch[_0xa9e5('0x25')](_0x460bca,_0x42db64,!![]);}catch(_0x22f14d){return BPromise[_0xa9e5('0x26')](_0x22f14d);}return _0x460bca['save']();};}function saveUpdates(_0x4f062a,_0x105ca8){return function(_0xfa1e0d){if(_0xfa1e0d){return _0xfa1e0d[_0xa9e5('0x27')](_0x4f062a)[_0xa9e5('0x28')](function(_0x3a9e67){return _0x3a9e67;});}return null;};}function removeEntity(_0x328475,_0x58fdb1){return function(_0x57adee){if(_0x57adee){return _0x57adee[_0xa9e5('0x29')]()[_0xa9e5('0x28')](function(){var _0x2e53da=_0x57adee[_0xa9e5('0x2a')]({'plain':!![]});var _0x16b17d=_0xa9e5('0x2b');return db[_0xa9e5('0x2c')]['destroy']({'where':{'type':_0x16b17d,'resourceId':_0x2e53da['id']}})[_0xa9e5('0x28')](function(){return _0x57adee;});})['then'](function(){_0x328475[_0xa9e5('0x1d')](0xcc)[_0xa9e5('0x1c')]();});}};}function handleEntityNotFound(_0x56fafd,_0x5472c0){return function(_0x1d1dd6){if(!_0x1d1dd6){_0x56fafd[_0xa9e5('0x2d')](0x194);}return _0x1d1dd6;};}function handleError(_0x1d8a05,_0x50a786){_0x50a786=_0x50a786||0x1f4;return function(_0x85960c){logger[_0xa9e5('0x2e')](_0x85960c[_0xa9e5('0x2f')]);if(_0x85960c['name']){delete _0x85960c['name'];}_0x1d8a05[_0xa9e5('0x1d')](_0x50a786)['send'](_0x85960c);};}exports['index']=function(_0x28a25e,_0x5aff18){var _0x18da3a={},_0x406404={},_0xb23a39={'count':0x0,'rows':[]};var _0x5b8967=_[_0xa9e5('0x30')](db[_0xa9e5('0x31')][_0xa9e5('0x32')],function(_0x583149){return{'name':_0x583149['fieldName'],'type':_0x583149[_0xa9e5('0x33')]['key']};});_0x406404[_0xa9e5('0x34')]=_['map'](_0x5b8967,_0xa9e5('0x35'));_0x406404[_0xa9e5('0x36')]=_[_0xa9e5('0x37')](_0x28a25e[_0xa9e5('0x36')]);_0x406404[_0xa9e5('0x38')]=_['intersection'](_0x406404[_0xa9e5('0x34')],_0x406404[_0xa9e5('0x36')]);_0x18da3a['attributes']=_['intersection'](_0x406404[_0xa9e5('0x34')],qs['fields'](_0x28a25e[_0xa9e5('0x36')]['fields']));_0x18da3a[_0xa9e5('0x39')]=_0x18da3a['attributes'][_0xa9e5('0x3a')]?_0x18da3a[_0xa9e5('0x39')]:_0x406404['model'];if(!_0x28a25e[_0xa9e5('0x36')][_0xa9e5('0x3b')](_0xa9e5('0x3c'))){_0x18da3a['limit']=qs[_0xa9e5('0x1f')](_0x28a25e[_0xa9e5('0x36')][_0xa9e5('0x1f')]);_0x18da3a[_0xa9e5('0x22')]=qs[_0xa9e5('0x22')](_0x28a25e['query'][_0xa9e5('0x22')]);}_0x18da3a[_0xa9e5('0x3d')]=qs[_0xa9e5('0x3e')](_0x28a25e['query'][_0xa9e5('0x3e')]);_0x18da3a[_0xa9e5('0x3f')]=qs[_0xa9e5('0x38')](_['pick'](_0x28a25e[_0xa9e5('0x36')],_0x406404[_0xa9e5('0x38')]),_0x5b8967);if(_0x28a25e[_0xa9e5('0x36')]['filter']){_0x18da3a[_0xa9e5('0x3f')]=_[_0xa9e5('0x40')](_0x18da3a[_0xa9e5('0x3f')],{'$or':_[_0xa9e5('0x30')](_0x5b8967,function(_0x3dc2e3){if(_0x3dc2e3['type']!==_0xa9e5('0x41')){var _0x48ff47={};_0x48ff47[_0x3dc2e3[_0xa9e5('0x35')]]={'$like':'%'+_0x28a25e[_0xa9e5('0x36')][_0xa9e5('0x42')]+'%'};return _0x48ff47;}})});}_0x18da3a=_[_0xa9e5('0x40')]({},_0x18da3a,_0x28a25e[_0xa9e5('0x43')]);var _0x5d8465={'where':_0x18da3a['where']};return db[_0xa9e5('0x31')][_0xa9e5('0x21')](_0x5d8465)[_0xa9e5('0x28')](function(_0x353719){_0xb23a39[_0xa9e5('0x21')]=_0x353719;if(_0x28a25e[_0xa9e5('0x36')][_0xa9e5('0x44')]){_0x18da3a[_0xa9e5('0x45')]=[{'all':!![]}];}return db[_0xa9e5('0x31')][_0xa9e5('0x46')](_0x18da3a);})[_0xa9e5('0x28')](function(_0x100ce4){_0xb23a39[_0xa9e5('0x47')]=_0x100ce4;return _0xb23a39;})[_0xa9e5('0x28')](respondWithFilteredResult(_0x5aff18,_0x18da3a))[_0xa9e5('0x48')](handleError(_0x5aff18,null));};exports[_0xa9e5('0x49')]=function(_0x48b1cf,_0x4e42a5){var _0xf1e3dc={'raw':![],'where':{'id':_0x48b1cf['params']['id']}},_0x57b88e={};_0x57b88e[_0xa9e5('0x34')]=_[_0xa9e5('0x37')](db[_0xa9e5('0x31')][_0xa9e5('0x32')]);_0x57b88e['query']=_[_0xa9e5('0x37')](_0x48b1cf[_0xa9e5('0x36')]);_0x57b88e[_0xa9e5('0x38')]=_['intersection'](_0x57b88e[_0xa9e5('0x34')],_0x57b88e[_0xa9e5('0x36')]);_0xf1e3dc[_0xa9e5('0x39')]=_[_0xa9e5('0x4a')](_0x57b88e[_0xa9e5('0x34')],qs[_0xa9e5('0x4b')](_0x48b1cf[_0xa9e5('0x36')]['fields']));_0xf1e3dc['attributes']=_0xf1e3dc[_0xa9e5('0x39')]['length']?_0xf1e3dc[_0xa9e5('0x39')]:_0x57b88e[_0xa9e5('0x34')];if(_0x48b1cf[_0xa9e5('0x36')][_0xa9e5('0x44')]){_0xf1e3dc[_0xa9e5('0x45')]=[{'all':!![]}];}_0xf1e3dc=_['merge']({},_0xf1e3dc,_0x48b1cf[_0xa9e5('0x43')]);return db['Dashboard'][_0xa9e5('0x4c')](_0xf1e3dc)[_0xa9e5('0x28')](handleEntityNotFound(_0x4e42a5,null))[_0xa9e5('0x28')](respondWithResult(_0x4e42a5,null))[_0xa9e5('0x48')](handleError(_0x4e42a5,null));};exports[_0xa9e5('0x4d')]=function(_0x5563d8,_0x42398b){return db[_0xa9e5('0x31')]['create'](_0x5563d8[_0xa9e5('0x4e')],{})[_0xa9e5('0x28')](function(_0x5556d9){var _0x2949d8=_0x5563d8[_0xa9e5('0x4f')]['get']({'plain':!![]});if(!_0x2949d8)throw new Error(_0xa9e5('0x50'));if(_0x2949d8[_0xa9e5('0x51')]===_0xa9e5('0x4f')){var _0x420b5d=_0x5556d9[_0xa9e5('0x2a')]({'plain':!![]});var _0x47c251=_0xa9e5('0x2b');return db[_0xa9e5('0x52')][_0xa9e5('0x4c')]({'where':{'name':_0x47c251,'userProfileId':_0x2949d8[_0xa9e5('0x53')]},'raw':!![]})['then'](function(_0x623a7a){if(_0x623a7a&&_0x623a7a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x420b5d[_0xa9e5('0x35')],'resourceId':_0x420b5d['id'],'type':_0x623a7a['name'],'sectionId':_0x623a7a['id']},{})[_0xa9e5('0x28')](function(){return _0x5556d9;});}else{return _0x5556d9;}})[_0xa9e5('0x48')](function(_0x38b3c1){logger[_0xa9e5('0x2e')](_0xa9e5('0x54'),_0x38b3c1);throw _0x38b3c1;});}return _0x5556d9;})[_0xa9e5('0x28')](respondWithResult(_0x42398b,0xc9))['catch'](handleError(_0x42398b,null));};exports[_0xa9e5('0x55')]=function(_0x1c742f,_0x8f6b94){var _0x56b77d={'where':{'id':_0x1c742f['params']['id']}},_0x56eb2c={};_0x56eb2c['model']=_['keys'](db[_0xa9e5('0x31')][_0xa9e5('0x32')]);_0x56b77d[_0xa9e5('0x39')]=_['intersection'](_0x56eb2c[_0xa9e5('0x34')],qs[_0xa9e5('0x4b')](_0x1c742f[_0xa9e5('0x36')][_0xa9e5('0x4b')]));_0x56b77d[_0xa9e5('0x39')]=_0x56b77d[_0xa9e5('0x39')]['length']?_0x56b77d[_0xa9e5('0x39')]:_0x56eb2c['model'];if(_0x1c742f[_0xa9e5('0x36')][_0xa9e5('0x44')]){_0x56b77d['include']=[{'all':!![]}];}_0x56b77d=_[_0xa9e5('0x40')]({},_0x56b77d,_0x1c742f[_0xa9e5('0x43')]);return db[_0xa9e5('0x31')][_0xa9e5('0x4c')](_0x56b77d)[_0xa9e5('0x28')](handleEntityNotFound(_0x8f6b94,null))[_0xa9e5('0x28')](function(_0xc31e86){if(_0xc31e86){var _0xda3de6=_0xc31e86[_0xa9e5('0x2a')]({'plain':!![]});_0xda3de6=qs[_0xa9e5('0x56')](_0xda3de6,['id',_0xa9e5('0x57'),_0xa9e5('0x58')]);_0x1c742f['body']=_[_0xa9e5('0x56')](_0x1c742f[_0xa9e5('0x4e')],['id',_0xa9e5('0x57'),_0xa9e5('0x58')]);return db[_0xa9e5('0x31')][_0xa9e5('0x4d')](_['merge'](_0xda3de6,_0x1c742f['body']),{'include':_0x1c742f[_0xa9e5('0x36')][_0xa9e5('0x44')]?[{'all':!![]}]:undefined})[_0xa9e5('0x28')](function(_0x57ba2e){var _0x4742d8=_0x1c742f[_0xa9e5('0x4f')][_0xa9e5('0x2a')]({'plain':!![]});if(!_0x4742d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4742d8[_0xa9e5('0x51')]==='user'){var _0x370d6c=_0x57ba2e[_0xa9e5('0x2a')]({'plain':!![]});var _0xfbda4b=_0xa9e5('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0xfbda4b,'userProfileId':_0x4742d8[_0xa9e5('0x53')]},'raw':!![]})[_0xa9e5('0x28')](function(_0x15ca71){if(_0x15ca71&&_0x15ca71[_0xa9e5('0x59')]===0x0){return db[_0xa9e5('0x2c')][_0xa9e5('0x4d')]({'name':_0x370d6c['name'],'resourceId':_0x370d6c['id'],'type':_0x15ca71[_0xa9e5('0x35')],'sectionId':_0x15ca71['id']},{})[_0xa9e5('0x28')](function(){return _0x57ba2e;});}else{return _0x57ba2e;}})[_0xa9e5('0x48')](function(_0x21108f){logger[_0xa9e5('0x2e')](_0xa9e5('0x54'),_0x21108f);throw _0x21108f;});}return _0x57ba2e;});}})[_0xa9e5('0x28')](respondWithResult(_0x8f6b94,0xc9))['catch'](handleError(_0x8f6b94,null));};exports[_0xa9e5('0x27')]=function(_0x5b6eb9,_0x3c2471){if(_0x5b6eb9[_0xa9e5('0x4e')]['id']){delete _0x5b6eb9[_0xa9e5('0x4e')]['id'];}return db[_0xa9e5('0x31')][_0xa9e5('0x4c')]({'where':{'id':_0x5b6eb9[_0xa9e5('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3c2471,null))[_0xa9e5('0x28')](saveUpdates(_0x5b6eb9[_0xa9e5('0x4e')],null))[_0xa9e5('0x28')](respondWithResult(_0x3c2471,null))[_0xa9e5('0x48')](handleError(_0x3c2471,null));};exports[_0xa9e5('0x29')]=function(_0x56dc0f,_0x438281){return db[_0xa9e5('0x31')][_0xa9e5('0x4c')]({'where':{'id':_0x56dc0f[_0xa9e5('0x5a')]['id']}})[_0xa9e5('0x28')](handleEntityNotFound(_0x438281,null))['then'](removeEntity(_0x438281,null))[_0xa9e5('0x48')](handleError(_0x438281,null));};function widgetAttributes(_0x1b73be){try{switch(_0x1b73be[_0xa9e5('0x33')]){case _0xa9e5('0x5b'):return[{'name':_0xa9e5('0x5c'),'value':_0x1b73be[_0xa9e5('0x5c')]||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be[_0xa9e5('0x5d')][0x0]?_0x1b73be[_0xa9e5('0x5d')][0x0]['value']:undefined)||'https://'}];case _0xa9e5('0x5e'):return[{'name':'attrPath','value':_0x1b73be[_0xa9e5('0x5f')]||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be[_0xa9e5('0x5d')][0x0]?_0x1b73be[_0xa9e5('0x5d')][0x0][_0xa9e5('0x60')]:undefined)||''}];case'clock':return[{'name':_0xa9e5('0x61'),'value':_0x1b73be[_0xa9e5('0x61')]||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be[_0xa9e5('0x5d')][0x0]?_0x1b73be['attrs'][0x0][_0xa9e5('0x60')]:undefined)||_0xa9e5('0x62')},{'name':_0xa9e5('0x63'),'value':_0x1b73be[_0xa9e5('0x63')]||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be['attrs'][0x1]?_0x1b73be['attrs'][0x1][_0xa9e5('0x60')]:undefined)||_0xa9e5('0x64')},{'name':'attrFontSize','value':_0x1b73be[_0xa9e5('0x65')]||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be['attrs'][0x2]?_0x1b73be[_0xa9e5('0x5d')][0x2][_0xa9e5('0x60')]:undefined)||0xc}];case _0xa9e5('0x66'):return[{'name':_0xa9e5('0x67'),'value':_0x1b73be[_0xa9e5('0x67')]||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be['attrs'][0x0]?_0x1b73be['attrs'][0x0][_0xa9e5('0x60')]:undefined)||_0xa9e5('0x68')},{'name':'attrVoiceQueues','value':_0x1b73be[_0xa9e5('0x69')]||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be[_0xa9e5('0x5d')][0x1]?_0x1b73be[_0xa9e5('0x5d')][0x1][_0xa9e5('0x60')]:undefined)||[]},{'name':_0xa9e5('0x65'),'value':_0x1b73be[_0xa9e5('0x65')]||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be[_0xa9e5('0x5d')][0x2]?_0x1b73be[_0xa9e5('0x5d')][0x2][_0xa9e5('0x60')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x1b73be[_0xa9e5('0x6a')]||(_0x1b73be['attrs']&&_0x1b73be[_0xa9e5('0x5d')][0x0]?_0x1b73be[_0xa9e5('0x5d')][0x0][_0xa9e5('0x60')]:undefined)||_0xa9e5('0x68')},{'name':_0xa9e5('0x6b'),'value':_0x1b73be[_0xa9e5('0x6b')]||(_0x1b73be['attrs']&&_0x1b73be[_0xa9e5('0x5d')][0x1]?_0x1b73be['attrs'][0x1][_0xa9e5('0x60')]:undefined)||null},{'name':_0xa9e5('0x6c'),'value':_0x1b73be['attrSerie3']||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be[_0xa9e5('0x5d')][0x2]?_0x1b73be[_0xa9e5('0x5d')][0x2][_0xa9e5('0x60')]:undefined)||null},{'name':_0xa9e5('0x69'),'value':_0x1b73be[_0xa9e5('0x69')]||(_0x1b73be['attrs']&&_0x1b73be['attrs'][0x3]?_0x1b73be['attrs'][0x3][_0xa9e5('0x60')]:undefined)||[]}];case'web-report':return[{'name':_0xa9e5('0x6d'),'type':_0x1b73be[_0xa9e5('0x6e')]||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be['attrs'][0x0]?_0x1b73be[_0xa9e5('0x5d')][0x0]['type']:undefined)||null,'value':_0x1b73be[_0xa9e5('0x6d')]||(_0x1b73be[_0xa9e5('0x5d')]&&_0x1b73be[_0xa9e5('0x5d')][0x0]?_0x1b73be[_0xa9e5('0x5d')][0x0][_0xa9e5('0x60')]:undefined)||null},{'name':_0xa9e5('0x6f'),'value':_0x1b73be[_0xa9e5('0x6f')]||(_0x1b73be['attrs']&&_0x1b73be['attrs'][0x1]?_0x1b73be[_0xa9e5('0x5d')][0x1][_0xa9e5('0x60')]:undefined)||0x0}];default:return[];}}catch(_0xa35d5){logger['error'](_0xa9e5('0x70'),JSON[_0xa9e5('0x71')](_0xa35d5));return[];}}exports['addItem']=function(_0x395a60,_0x3ed460,_0x7dce49){if(_0x395a60['body']['id']){delete _0x395a60['body']['id'];}return db[_0xa9e5('0x31')][_0xa9e5('0x4c')]({'where':{'id':_0x395a60['params']['id']}})[_0xa9e5('0x28')](handleEntityNotFound(_0x3ed460,null))[_0xa9e5('0x28')](function(_0x298f52){if(_0x298f52){_0x395a60[_0xa9e5('0x4e')]['DashboardId']=_0x298f52['id'];_0x395a60[_0xa9e5('0x4e')][_0xa9e5('0x5d')]=widgetAttributes(_0x395a60[_0xa9e5('0x4e')]);return db[_0xa9e5('0x72')]['create'](_0x395a60['body']);}})[_0xa9e5('0x28')](respondWithResult(_0x3ed460,null))['catch'](handleError(_0x3ed460,null));};exports[_0xa9e5('0x73')]=function(_0x4a7cbd,_0x41daf7,_0x3c20f5){var _0x180c67={};var _0x4c58f0={};var _0x583345;var _0x5d2afd;return db[_0xa9e5('0x31')]['findOne']({'where':{'id':_0x4a7cbd['params']['id']}})[_0xa9e5('0x28')](handleEntityNotFound(_0x41daf7,null))[_0xa9e5('0x28')](function(_0x23ed20){if(_0x23ed20){_0x583345=_0x23ed20;_0x4c58f0['model']=_[_0xa9e5('0x37')](db[_0xa9e5('0x72')][_0xa9e5('0x32')]);_0x4c58f0[_0xa9e5('0x36')]=_[_0xa9e5('0x37')](_0x4a7cbd[_0xa9e5('0x36')]);_0x4c58f0[_0xa9e5('0x38')]=_[_0xa9e5('0x4a')](_0x4c58f0[_0xa9e5('0x34')],_0x4c58f0[_0xa9e5('0x36')]);_0x180c67[_0xa9e5('0x39')]=_[_0xa9e5('0x4a')](_0x4c58f0[_0xa9e5('0x34')],qs[_0xa9e5('0x4b')](_0x4a7cbd[_0xa9e5('0x36')][_0xa9e5('0x4b')]));_0x180c67[_0xa9e5('0x39')]=_0x180c67[_0xa9e5('0x39')][_0xa9e5('0x3a')]?_0x180c67[_0xa9e5('0x39')]:_0x4c58f0['model'];_0x180c67[_0xa9e5('0x3d')]=qs['sort'](_0x4a7cbd[_0xa9e5('0x36')][_0xa9e5('0x3e')]);_0x180c67[_0xa9e5('0x3f')]=qs[_0xa9e5('0x38')](_[_0xa9e5('0x74')](_0x4a7cbd[_0xa9e5('0x36')],_0x4c58f0['filters']));if(_0x4a7cbd[_0xa9e5('0x36')][_0xa9e5('0x42')]){_0x180c67[_0xa9e5('0x3f')]=_[_0xa9e5('0x40')](_0x180c67[_0xa9e5('0x3f')],{'$or':_[_0xa9e5('0x30')](_0x180c67[_0xa9e5('0x39')],function(_0x3c9571){var _0x33bfe8={};_0x33bfe8[_0x3c9571]={'$like':'%'+_0x4a7cbd[_0xa9e5('0x36')][_0xa9e5('0x42')]+'%'};return _0x33bfe8;})});}_0x180c67=_[_0xa9e5('0x40')]({},_0x180c67,_0x4a7cbd[_0xa9e5('0x43')]);return _0x583345[_0xa9e5('0x73')](_0x180c67);}})[_0xa9e5('0x28')](function(_0x1e63a9){if(_0x1e63a9){_0x5d2afd=_0x1e63a9['length'];if(!_0x4a7cbd[_0xa9e5('0x36')][_0xa9e5('0x3b')](_0xa9e5('0x3c'))){_0x180c67[_0xa9e5('0x1f')]=qs[_0xa9e5('0x1f')](_0x4a7cbd[_0xa9e5('0x36')]['limit']);_0x180c67[_0xa9e5('0x22')]=qs['offset'](_0x4a7cbd[_0xa9e5('0x36')][_0xa9e5('0x22')]);}return _0x583345[_0xa9e5('0x73')](_0x180c67);}})[_0xa9e5('0x28')](function(_0x51b054){if(_0x51b054){return _0x51b054?{'count':_0x5d2afd,'rows':_0x51b054}:null;}})[_0xa9e5('0x28')](respondWithResult(_0x41daf7,null))[_0xa9e5('0x48')](handleError(_0x41daf7,null));}; \ No newline at end of file +var _0x4b16=['attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','findOne','hasOwnProperty','getItems','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','Dashboard','includeAll','include','findAll','rows','catch','show','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt'];(function(_0xca8ee6,_0x500814){var _0x338251=function(_0x5ef912){while(--_0x5ef912){_0xca8ee6['push'](_0xca8ee6['shift']());}};_0x338251(++_0x500814);}(_0x4b16,0x183));var _0x64b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b16[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x64b1('0x0'));var rp=require(_0x64b1('0x1'));var moment=require(_0x64b1('0x2'));var BPromise=require(_0x64b1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x64b1('0x4'));var sox=require(_0x64b1('0x5'));var csv=require('to-csv');var ejs=require(_0x64b1('0x6'));var fs=require('fs');var fs_extra=require(_0x64b1('0x7'));var _=require(_0x64b1('0x8'));var squel=require(_0x64b1('0x9'));var crypto=require(_0x64b1('0xa'));var jsforce=require(_0x64b1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x64b1('0xc'));var querystring=require('querystring');var Papa=require(_0x64b1('0xd'));var Redis=require(_0x64b1('0xe'));var authService=require(_0x64b1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x64b1('0x10'));var hardwareService=require(_0x64b1('0x11'));var logger=require(_0x64b1('0x12'))('api');var utils=require(_0x64b1('0x13'));var config=require(_0x64b1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x64b1('0x15'))['db'];config[_0x64b1('0x16')]=_[_0x64b1('0x17')](config[_0x64b1('0x16')],{'host':_0x64b1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x64b1('0x16')]));require(_0x64b1('0x19'))['register'](socket);function respondWithStatusCode(_0x30e505,_0x3fd932){_0x3fd932=_0x3fd932||0xcc;return function(_0x52dfd0){if(_0x52dfd0){return _0x30e505[_0x64b1('0x1a')](_0x3fd932);}return _0x30e505[_0x64b1('0x1b')](_0x3fd932)['end']();};}function respondWithResult(_0x15316c,_0x243ef4){_0x243ef4=_0x243ef4||0xc8;return function(_0x4c8806){if(_0x4c8806){return _0x15316c[_0x64b1('0x1b')](_0x243ef4)[_0x64b1('0x1c')](_0x4c8806);}};}function respondWithFilteredResult(_0x42c8f7,_0x146e39){return function(_0x67fa46){if(_0x67fa46){var _0x23ae3c=typeof _0x146e39[_0x64b1('0x1d')]===_0x64b1('0x1e')&&typeof _0x146e39[_0x64b1('0x1f')]===_0x64b1('0x1e');var _0x2cda64=_0x67fa46[_0x64b1('0x20')];var _0x2d7d37=_0x23ae3c?0x0:_0x146e39['offset'];var _0x5c859a=_0x23ae3c?_0x67fa46['count']:_0x146e39[_0x64b1('0x1d')]+_0x146e39[_0x64b1('0x1f')];var _0x44668e;if(_0x5c859a>=_0x2cda64){_0x5c859a=_0x2cda64;_0x44668e=0xc8;}else{_0x44668e=0xce;}_0x42c8f7[_0x64b1('0x1b')](_0x44668e);return _0x42c8f7[_0x64b1('0x21')](_0x64b1('0x22'),_0x2d7d37+'-'+_0x5c859a+'/'+_0x2cda64)['json'](_0x67fa46);}return null;};}function patchUpdates(_0x3aad5e){return function(_0x3f8083){try{jsonpatch[_0x64b1('0x23')](_0x3f8083,_0x3aad5e,!![]);}catch(_0x2d1e4c){return BPromise[_0x64b1('0x24')](_0x2d1e4c);}return _0x3f8083[_0x64b1('0x25')]();};}function saveUpdates(_0x44f006,_0x660c6f){return function(_0xbec921){if(_0xbec921){return _0xbec921[_0x64b1('0x26')](_0x44f006)[_0x64b1('0x27')](function(_0x9cf3e7){return _0x9cf3e7;});}return null;};}function removeEntity(_0x19a8d7,_0x431a4e){return function(_0x3ed91e){if(_0x3ed91e){return _0x3ed91e['destroy']()['then'](function(){var _0x5f2c59=_0x3ed91e[_0x64b1('0x28')]({'plain':!![]});var _0xd46e='CustomDashboards';return db[_0x64b1('0x29')]['destroy']({'where':{'type':_0xd46e,'resourceId':_0x5f2c59['id']}})[_0x64b1('0x27')](function(){return _0x3ed91e;});})[_0x64b1('0x27')](function(){_0x19a8d7[_0x64b1('0x1b')](0xcc)[_0x64b1('0x2a')]();});}};}function handleEntityNotFound(_0x35ee09,_0x53dfa6){return function(_0x331b79){if(!_0x331b79){_0x35ee09[_0x64b1('0x1a')](0x194);}return _0x331b79;};}function handleError(_0x1c00d2,_0x436533){_0x436533=_0x436533||0x1f4;return function(_0x3a247f){logger[_0x64b1('0x2b')](_0x3a247f[_0x64b1('0x2c')]);if(_0x3a247f[_0x64b1('0x2d')]){delete _0x3a247f[_0x64b1('0x2d')];}_0x1c00d2[_0x64b1('0x1b')](_0x436533)['send'](_0x3a247f);};}exports['index']=function(_0x597c92,_0x58fc91){var _0x2b9fd8={},_0x1b3438={},_0x3f8e50={'count':0x0,'rows':[]};var _0x30a917=_[_0x64b1('0x2e')](db['Dashboard'][_0x64b1('0x2f')],function(_0x518f93){return{'name':_0x518f93[_0x64b1('0x30')],'type':_0x518f93[_0x64b1('0x31')][_0x64b1('0x32')]};});_0x1b3438[_0x64b1('0x33')]=_['map'](_0x30a917,_0x64b1('0x2d'));_0x1b3438[_0x64b1('0x34')]=_[_0x64b1('0x35')](_0x597c92[_0x64b1('0x34')]);_0x1b3438[_0x64b1('0x36')]=_[_0x64b1('0x37')](_0x1b3438[_0x64b1('0x33')],_0x1b3438['query']);_0x2b9fd8[_0x64b1('0x38')]=_[_0x64b1('0x37')](_0x1b3438[_0x64b1('0x33')],qs[_0x64b1('0x39')](_0x597c92[_0x64b1('0x34')][_0x64b1('0x39')]));_0x2b9fd8[_0x64b1('0x38')]=_0x2b9fd8[_0x64b1('0x38')][_0x64b1('0x3a')]?_0x2b9fd8['attributes']:_0x1b3438[_0x64b1('0x33')];if(!_0x597c92[_0x64b1('0x34')]['hasOwnProperty'](_0x64b1('0x3b'))){_0x2b9fd8[_0x64b1('0x1f')]=qs[_0x64b1('0x1f')](_0x597c92[_0x64b1('0x34')][_0x64b1('0x1f')]);_0x2b9fd8[_0x64b1('0x1d')]=qs['offset'](_0x597c92[_0x64b1('0x34')][_0x64b1('0x1d')]);}_0x2b9fd8[_0x64b1('0x3c')]=qs[_0x64b1('0x3d')](_0x597c92[_0x64b1('0x34')][_0x64b1('0x3d')]);_0x2b9fd8[_0x64b1('0x3e')]=qs[_0x64b1('0x36')](_[_0x64b1('0x3f')](_0x597c92[_0x64b1('0x34')],_0x1b3438[_0x64b1('0x36')]),_0x30a917);if(_0x597c92[_0x64b1('0x34')]['filter']){_0x2b9fd8[_0x64b1('0x3e')]=_[_0x64b1('0x40')](_0x2b9fd8[_0x64b1('0x3e')],{'$or':_[_0x64b1('0x2e')](_0x30a917,function(_0x26c281){if(_0x26c281[_0x64b1('0x31')]!=='VIRTUAL'){var _0x35bb32={};_0x35bb32[_0x26c281[_0x64b1('0x2d')]]={'$like':'%'+_0x597c92[_0x64b1('0x34')][_0x64b1('0x41')]+'%'};return _0x35bb32;}})});}_0x2b9fd8=_[_0x64b1('0x40')]({},_0x2b9fd8,_0x597c92[_0x64b1('0x42')]);var _0x2bee6b={'where':_0x2b9fd8[_0x64b1('0x3e')]};return db[_0x64b1('0x43')]['count'](_0x2bee6b)[_0x64b1('0x27')](function(_0x1989c9){_0x3f8e50[_0x64b1('0x20')]=_0x1989c9;if(_0x597c92[_0x64b1('0x34')][_0x64b1('0x44')]){_0x2b9fd8[_0x64b1('0x45')]=[{'all':!![]}];}return db[_0x64b1('0x43')][_0x64b1('0x46')](_0x2b9fd8);})[_0x64b1('0x27')](function(_0x1291bb){_0x3f8e50[_0x64b1('0x47')]=_0x1291bb;return _0x3f8e50;})[_0x64b1('0x27')](respondWithFilteredResult(_0x58fc91,_0x2b9fd8))[_0x64b1('0x48')](handleError(_0x58fc91,null));};exports[_0x64b1('0x49')]=function(_0x193ccd,_0x4fe1c5){var _0x14e61d={'raw':![],'where':{'id':_0x193ccd['params']['id']}},_0x4586af={};_0x4586af['model']=_[_0x64b1('0x35')](db[_0x64b1('0x43')][_0x64b1('0x2f')]);_0x4586af[_0x64b1('0x34')]=_[_0x64b1('0x35')](_0x193ccd[_0x64b1('0x34')]);_0x4586af['filters']=_[_0x64b1('0x37')](_0x4586af[_0x64b1('0x33')],_0x4586af[_0x64b1('0x34')]);_0x14e61d['attributes']=_['intersection'](_0x4586af[_0x64b1('0x33')],qs['fields'](_0x193ccd[_0x64b1('0x34')][_0x64b1('0x39')]));_0x14e61d['attributes']=_0x14e61d['attributes'][_0x64b1('0x3a')]?_0x14e61d[_0x64b1('0x38')]:_0x4586af['model'];if(_0x193ccd[_0x64b1('0x34')]['includeAll']){_0x14e61d[_0x64b1('0x45')]=[{'all':!![]}];}_0x14e61d=_['merge']({},_0x14e61d,_0x193ccd[_0x64b1('0x42')]);return db[_0x64b1('0x43')][_0x64b1('0x4a')](_0x14e61d)[_0x64b1('0x27')](handleEntityNotFound(_0x4fe1c5,null))[_0x64b1('0x27')](respondWithResult(_0x4fe1c5,null))[_0x64b1('0x48')](handleError(_0x4fe1c5,null));};exports['create']=function(_0x3a4bda,_0x2a9ef2){return db[_0x64b1('0x43')]['create'](_0x3a4bda[_0x64b1('0x4b')],{})[_0x64b1('0x27')](function(_0x2dc33c){var _0x5f282a=_0x3a4bda[_0x64b1('0x4c')][_0x64b1('0x28')]({'plain':!![]});if(!_0x5f282a)throw new Error(_0x64b1('0x4d'));if(_0x5f282a[_0x64b1('0x4e')]===_0x64b1('0x4c')){var _0x443dbe=_0x2dc33c[_0x64b1('0x28')]({'plain':!![]});var _0x1f71fa=_0x64b1('0x4f');return db[_0x64b1('0x50')]['find']({'where':{'name':_0x1f71fa,'userProfileId':_0x5f282a[_0x64b1('0x51')]},'raw':!![]})[_0x64b1('0x27')](function(_0x7c6520){if(_0x7c6520&&_0x7c6520[_0x64b1('0x52')]===0x0){return db[_0x64b1('0x29')][_0x64b1('0x53')]({'name':_0x443dbe['name'],'resourceId':_0x443dbe['id'],'type':_0x7c6520['name'],'sectionId':_0x7c6520['id']},{})[_0x64b1('0x27')](function(){return _0x2dc33c;});}else{return _0x2dc33c;}})['catch'](function(_0x57983e){logger[_0x64b1('0x2b')](_0x64b1('0x54'),_0x57983e);throw _0x57983e;});}return _0x2dc33c;})[_0x64b1('0x27')](respondWithResult(_0x2a9ef2,0xc9))['catch'](handleError(_0x2a9ef2,null));};exports[_0x64b1('0x55')]=function(_0x4b141a,_0x1f2606){var _0x2d0641={'where':{'id':_0x4b141a[_0x64b1('0x56')]['id']}},_0x453760={};_0x453760[_0x64b1('0x33')]=_['keys'](db[_0x64b1('0x43')][_0x64b1('0x2f')]);_0x2d0641[_0x64b1('0x38')]=_[_0x64b1('0x37')](_0x453760[_0x64b1('0x33')],qs['fields'](_0x4b141a[_0x64b1('0x34')][_0x64b1('0x39')]));_0x2d0641['attributes']=_0x2d0641[_0x64b1('0x38')][_0x64b1('0x3a')]?_0x2d0641[_0x64b1('0x38')]:_0x453760[_0x64b1('0x33')];if(_0x4b141a['query']['includeAll']){_0x2d0641['include']=[{'all':!![]}];}_0x2d0641=_[_0x64b1('0x40')]({},_0x2d0641,_0x4b141a[_0x64b1('0x42')]);return db[_0x64b1('0x43')][_0x64b1('0x4a')](_0x2d0641)[_0x64b1('0x27')](handleEntityNotFound(_0x1f2606,null))['then'](function(_0x133ec4){if(_0x133ec4){var _0x3d5fad=_0x133ec4[_0x64b1('0x28')]({'plain':!![]});_0x3d5fad=qs[_0x64b1('0x57')](_0x3d5fad,['id','createdAt',_0x64b1('0x58')]);_0x4b141a[_0x64b1('0x4b')]=_[_0x64b1('0x57')](_0x4b141a[_0x64b1('0x4b')],['id','createdAt','updatedAt']);return db[_0x64b1('0x43')]['create'](_['merge'](_0x3d5fad,_0x4b141a['body']),{'include':_0x4b141a[_0x64b1('0x34')][_0x64b1('0x44')]?[{'all':!![]}]:undefined})[_0x64b1('0x27')](function(_0x482586){var _0x7adcf9=_0x4b141a['user'][_0x64b1('0x28')]({'plain':!![]});if(!_0x7adcf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7adcf9['role']===_0x64b1('0x4c')){var _0x32866b=_0x482586[_0x64b1('0x28')]({'plain':!![]});var _0x15f9a8=_0x64b1('0x4f');return db[_0x64b1('0x50')][_0x64b1('0x4a')]({'where':{'name':_0x15f9a8,'userProfileId':_0x7adcf9[_0x64b1('0x51')]},'raw':!![]})[_0x64b1('0x27')](function(_0x525816){if(_0x525816&&_0x525816[_0x64b1('0x52')]===0x0){return db[_0x64b1('0x29')]['create']({'name':_0x32866b[_0x64b1('0x2d')],'resourceId':_0x32866b['id'],'type':_0x525816[_0x64b1('0x2d')],'sectionId':_0x525816['id']},{})['then'](function(){return _0x482586;});}else{return _0x482586;}})[_0x64b1('0x48')](function(_0x46e7cf){logger[_0x64b1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46e7cf);throw _0x46e7cf;});}return _0x482586;});}})[_0x64b1('0x27')](respondWithResult(_0x1f2606,0xc9))[_0x64b1('0x48')](handleError(_0x1f2606,null));};exports[_0x64b1('0x26')]=function(_0x59b817,_0x21ea55){if(_0x59b817['body']['id']){delete _0x59b817[_0x64b1('0x4b')]['id'];}return db[_0x64b1('0x43')]['find']({'where':{'id':_0x59b817[_0x64b1('0x56')]['id']}})[_0x64b1('0x27')](handleEntityNotFound(_0x21ea55,null))[_0x64b1('0x27')](saveUpdates(_0x59b817[_0x64b1('0x4b')],null))[_0x64b1('0x27')](respondWithResult(_0x21ea55,null))[_0x64b1('0x48')](handleError(_0x21ea55,null));};exports['destroy']=function(_0x153b68,_0x91d576){return db['Dashboard']['find']({'where':{'id':_0x153b68['params']['id']}})[_0x64b1('0x27')](handleEntityNotFound(_0x91d576,null))['then'](removeEntity(_0x91d576,null))[_0x64b1('0x48')](handleError(_0x91d576,null));};function widgetAttributes(_0x287250){try{switch(_0x287250[_0x64b1('0x31')]){case'iframe':return[{'name':_0x64b1('0x59'),'value':_0x287250[_0x64b1('0x59')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250['attrs'][0x0]?_0x287250[_0x64b1('0x5a')][0x0][_0x64b1('0x5b')]:undefined)||_0x64b1('0x5c')}];case'custom':return[{'name':'attrPath','value':_0x287250[_0x64b1('0x5d')]||(_0x287250['attrs']&&_0x287250[_0x64b1('0x5a')][0x0]?_0x287250['attrs'][0x0][_0x64b1('0x5b')]:undefined)||''}];case _0x64b1('0x5e'):return[{'name':_0x64b1('0x5f'),'value':_0x287250[_0x64b1('0x5f')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x0]?_0x287250['attrs'][0x0][_0x64b1('0x5b')]:undefined)||_0x64b1('0x60')},{'name':_0x64b1('0x61'),'value':_0x287250['attrTimezone']||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x1]?_0x287250[_0x64b1('0x5a')][0x1][_0x64b1('0x5b')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x287250[_0x64b1('0x62')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250['attrs'][0x2]?_0x287250['attrs'][0x2]['value']:undefined)||0xc}];case _0x64b1('0x63'):return[{'name':_0x64b1('0x64'),'value':_0x287250[_0x64b1('0x64')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x0]?_0x287250[_0x64b1('0x5a')][0x0]['value']:undefined)||'total'},{'name':_0x64b1('0x65'),'value':_0x287250[_0x64b1('0x65')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x1]?_0x287250[_0x64b1('0x5a')][0x1][_0x64b1('0x5b')]:undefined)||[]},{'name':_0x64b1('0x62'),'value':_0x287250['attrFontSize']||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x2]?_0x287250[_0x64b1('0x5a')][0x2]['value']:undefined)||0x14}];case _0x64b1('0x66'):case _0x64b1('0x67'):return[{'name':_0x64b1('0x68'),'value':_0x287250[_0x64b1('0x68')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x0]?_0x287250['attrs'][0x0][_0x64b1('0x5b')]:undefined)||_0x64b1('0x69')},{'name':_0x64b1('0x6a'),'value':_0x287250['attrSerie2']||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x1]?_0x287250[_0x64b1('0x5a')][0x1][_0x64b1('0x5b')]:undefined)||null},{'name':'attrSerie3','value':_0x287250[_0x64b1('0x6b')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250['attrs'][0x2]?_0x287250[_0x64b1('0x5a')][0x2][_0x64b1('0x5b')]:undefined)||null},{'name':_0x64b1('0x65'),'value':_0x287250[_0x64b1('0x65')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250[_0x64b1('0x5a')][0x3]?_0x287250[_0x64b1('0x5a')][0x3][_0x64b1('0x5b')]:undefined)||[]}];case _0x64b1('0x6c'):return[{'name':_0x64b1('0x6d'),'type':_0x287250[_0x64b1('0x6e')]||(_0x287250[_0x64b1('0x5a')]&&_0x287250['attrs'][0x0]?_0x287250[_0x64b1('0x5a')][0x0]['type']:undefined)||null,'value':_0x287250[_0x64b1('0x6d')]||(_0x287250['attrs']&&_0x287250['attrs'][0x0]?_0x287250[_0x64b1('0x5a')][0x0][_0x64b1('0x5b')]:undefined)||null},{'name':'attrRefresh','value':_0x287250[_0x64b1('0x6f')]||(_0x287250['attrs']&&_0x287250[_0x64b1('0x5a')][0x1]?_0x287250[_0x64b1('0x5a')][0x1][_0x64b1('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x1cf88d){logger[_0x64b1('0x2b')](_0x64b1('0x70'),JSON[_0x64b1('0x71')](_0x1cf88d));return[];}}exports['addItem']=function(_0x25decf,_0x4e2066,_0x745acf){if(_0x25decf[_0x64b1('0x4b')]['id']){delete _0x25decf['body']['id'];}return db[_0x64b1('0x43')][_0x64b1('0x4a')]({'where':{'id':_0x25decf['params']['id']}})['then'](handleEntityNotFound(_0x4e2066,null))['then'](function(_0x36ef3f){if(_0x36ef3f){_0x25decf[_0x64b1('0x4b')][_0x64b1('0x72')]=_0x36ef3f['id'];_0x25decf[_0x64b1('0x4b')][_0x64b1('0x5a')]=widgetAttributes(_0x25decf[_0x64b1('0x4b')]);return db[_0x64b1('0x73')][_0x64b1('0x53')](_0x25decf[_0x64b1('0x4b')]);}})['then'](respondWithResult(_0x4e2066,null))[_0x64b1('0x48')](handleError(_0x4e2066,null));};exports['getItems']=function(_0x11c1fe,_0x1c27f8,_0x1cef06){var _0x1ae594={};var _0x11fb5c={};var _0x3fd693;var _0x46f874;return db[_0x64b1('0x43')][_0x64b1('0x74')]({'where':{'id':_0x11c1fe['params']['id']}})[_0x64b1('0x27')](handleEntityNotFound(_0x1c27f8,null))[_0x64b1('0x27')](function(_0xdae77d){if(_0xdae77d){_0x3fd693=_0xdae77d;_0x11fb5c[_0x64b1('0x33')]=_[_0x64b1('0x35')](db[_0x64b1('0x73')]['rawAttributes']);_0x11fb5c['query']=_[_0x64b1('0x35')](_0x11c1fe[_0x64b1('0x34')]);_0x11fb5c[_0x64b1('0x36')]=_[_0x64b1('0x37')](_0x11fb5c['model'],_0x11fb5c['query']);_0x1ae594['attributes']=_[_0x64b1('0x37')](_0x11fb5c['model'],qs['fields'](_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x39')]));_0x1ae594['attributes']=_0x1ae594[_0x64b1('0x38')]['length']?_0x1ae594[_0x64b1('0x38')]:_0x11fb5c[_0x64b1('0x33')];_0x1ae594['order']=qs[_0x64b1('0x3d')](_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x3d')]);_0x1ae594[_0x64b1('0x3e')]=qs[_0x64b1('0x36')](_[_0x64b1('0x3f')](_0x11c1fe[_0x64b1('0x34')],_0x11fb5c[_0x64b1('0x36')]));if(_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x41')]){_0x1ae594[_0x64b1('0x3e')]=_[_0x64b1('0x40')](_0x1ae594[_0x64b1('0x3e')],{'$or':_[_0x64b1('0x2e')](_0x1ae594[_0x64b1('0x38')],function(_0x5f3c96){var _0x22324a={};_0x22324a[_0x5f3c96]={'$like':'%'+_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x41')]+'%'};return _0x22324a;})});}_0x1ae594=_[_0x64b1('0x40')]({},_0x1ae594,_0x11c1fe['options']);return _0x3fd693['getItems'](_0x1ae594);}})[_0x64b1('0x27')](function(_0x4d2609){if(_0x4d2609){_0x46f874=_0x4d2609[_0x64b1('0x3a')];if(!_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x75')](_0x64b1('0x3b'))){_0x1ae594[_0x64b1('0x1f')]=qs[_0x64b1('0x1f')](_0x11c1fe['query'][_0x64b1('0x1f')]);_0x1ae594[_0x64b1('0x1d')]=qs[_0x64b1('0x1d')](_0x11c1fe[_0x64b1('0x34')][_0x64b1('0x1d')]);}return _0x3fd693[_0x64b1('0x76')](_0x1ae594);}})[_0x64b1('0x27')](function(_0x48fc17){if(_0x48fc17){return _0x48fc17?{'count':_0x46f874,'rows':_0x48fc17}:null;}})['then'](respondWithResult(_0x1c27f8,null))[_0x64b1('0x48')](handleError(_0x1c27f8,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 4a1382b..6fe726c 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 _0xb962=['hasOwnProperty','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb962,0x88));var _0x2b96=function(_0x3cf66f,_0x477efa){_0x3cf66f=_0x3cf66f-0x0;var _0x1c6e92=_0xb962[_0x3cf66f];return _0x1c6e92;};'use strict';var EventEmitter=require(_0x2b96('0x0'));var Dashboard=require(_0x2b96('0x1'))['db'][_0x2b96('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2b96('0x3')](0x0);var events={'afterCreate':_0x2b96('0x4'),'afterUpdate':_0x2b96('0x5'),'afterDestroy':_0x2b96('0x6')};function emitEvent(_0x40947f){return function(_0x4384a3,_0x302784,_0x3b5c7b){DashboardEvents[_0x2b96('0x7')](_0x40947f+':'+_0x4384a3['id'],_0x4384a3);DashboardEvents['emit'](_0x40947f,_0x4384a3);_0x3b5c7b(null);};}for(var e in events){if(events[_0x2b96('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xfea2=['events','../../mysqldb','Dashboard','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0xfea2,0x156));var _0x2fea=function(_0x2eaa66,_0x2062c0){_0x2eaa66=_0x2eaa66-0x0;var _0x3b1dd3=_0xfea2[_0x2eaa66];return _0x3b1dd3;};'use strict';var EventEmitter=require(_0x2fea('0x0'));var Dashboard=require(_0x2fea('0x1'))['db'][_0x2fea('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2fea('0x3'),'afterUpdate':_0x2fea('0x4'),'afterDestroy':_0x2fea('0x5')};function emitEvent(_0x7d9268){return function(_0x33052b,_0x1db390,_0x23818b){DashboardEvents['emit'](_0x7d9268+':'+_0x33052b['id'],_0x33052b);DashboardEvents[_0x2fea('0x6')](_0x7d9268,_0x33052b);_0x23818b(null);};}for(var e in events){if(events[_0x2fea('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x2fea('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ebced09..0f45d49 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 _0x6825=['define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./dashboard.attributes','exports'];(function(_0x3ec510,_0x196121){var _0x30a8f7=function(_0x447e97){while(--_0x447e97){_0x3ec510['push'](_0x3ec510['shift']());}};_0x30a8f7(++_0x196121);}(_0x6825,0x16f));var _0x5682=function(_0x5c8de6,_0x50f858){_0x5c8de6=_0x5c8de6-0x0;var _0x5d584c=_0x6825[_0x5c8de6];return _0x5d584c;};'use strict';var _=require(_0x5682('0x0'));var util=require(_0x5682('0x1'));var logger=require(_0x5682('0x2'))(_0x5682('0x3'));var moment=require(_0x5682('0x4'));var BPromise=require(_0x5682('0x5'));var rp=require(_0x5682('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5682('0x7'));var attributes=require(_0x5682('0x8'));module[_0x5682('0x9')]=function(_0x456f33,_0xf92024){return _0x456f33[_0x5682('0xa')](_0x5682('0xb'),attributes,{'tableName':_0x5682('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x553e=['exports','define','Dashboard','dashboards','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x545654,_0x5d47e7){var _0x2605a6=function(_0x53007d){while(--_0x53007d){_0x545654['push'](_0x545654['shift']());}};_0x2605a6(++_0x5d47e7);}(_0x553e,0x94));var _0xe553=function(_0x13354b,_0x38f631){_0x13354b=_0x13354b-0x0;var _0x3e1aa4=_0x553e[_0x13354b];return _0x3e1aa4;};'use strict';var _=require('lodash');var util=require(_0xe553('0x0'));var logger=require(_0xe553('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe553('0x2'));var rp=require(_0xe553('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe553('0x4'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xe553('0x5')]=function(_0x5ebb7f,_0x51a822){return _0x5ebb7f[_0xe553('0x6')](_0xe553('0x7'),attributes,{'tableName':_0xe553('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index eb5aa4f..1fceac5 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 _0x45a4=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','request','then','info','Dashboard,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x396921,_0x178337){var _0x5b2048=function(_0x2d880f){while(--_0x2d880f){_0x396921['push'](_0x396921['shift']());}};_0x5b2048(++_0x178337);}(_0x45a4,0xa4));var _0x445a=function(_0x30ecc4,_0x4c8a18){_0x30ecc4=_0x30ecc4-0x0;var _0x519df6=_0x45a4[_0x30ecc4];return _0x519df6;};'use strict';var _=require(_0x445a('0x0'));var util=require(_0x445a('0x1'));var moment=require(_0x445a('0x2'));var BPromise=require(_0x445a('0x3'));var rs=require(_0x445a('0x4'));var fs=require('fs');var Redis=require(_0x445a('0x5'));var db=require(_0x445a('0x6'))['db'];var utils=require(_0x445a('0x7'));var logger=require(_0x445a('0x8'))(_0x445a('0x9'));var config=require(_0x445a('0xa'));var jayson=require(_0x445a('0xb'));var client=jayson[_0x445a('0xc')][_0x445a('0xd')]({'port':0x232a});config['redis']=_[_0x445a('0xe')](config[_0x445a('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x445a('0xf')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x4c0fbc,_0x851943,_0x19986a){return new BPromise(function(_0x257ae8,_0x5092c8){return client[_0x445a('0x10')](_0x4c0fbc,_0x19986a)[_0x445a('0x11')](function(_0x176815){logger[_0x445a('0x12')](_0x445a('0x13'),_0x851943,'request\x20sent');logger[_0x445a('0x14')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x851943,_0x445a('0x15'),JSON[_0x445a('0x16')](_0x176815));if(_0x176815[_0x445a('0x17')]){if(_0x176815[_0x445a('0x17')][_0x445a('0x18')]===0x1f4){logger[_0x445a('0x17')]('Dashboard,\x20%s,\x20%s',_0x851943,_0x176815[_0x445a('0x17')][_0x445a('0x19')]);return _0x5092c8(_0x176815['error'][_0x445a('0x19')]);}logger[_0x445a('0x17')](_0x445a('0x13'),_0x851943,_0x176815[_0x445a('0x17')]['message']);return _0x257ae8(_0x176815[_0x445a('0x17')]['message']);}else{logger[_0x445a('0x12')](_0x445a('0x13'),_0x851943,'request\x20sent');_0x257ae8(_0x176815[_0x445a('0x1a')][_0x445a('0x19')]);}})['catch'](function(_0xc0cfcf){logger['error']('Dashboard,\x20%s,\x20%s',_0x851943,_0xc0cfcf);_0x5092c8(_0xc0cfcf);});});} \ No newline at end of file +var _0x323f=['client','http','redis','defaults','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x277079,_0x511204){var _0x205a0b=function(_0x4f7df8){while(--_0x4f7df8){_0x277079['push'](_0x277079['shift']());}};_0x205a0b(++_0x511204);}(_0x323f,0xc8));var _0xf323=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x323f[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require(_0xf323('0x1'));var BPromise=require('bluebird');var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf323('0x5'))('rpc');var config=require(_0xf323('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf323('0x7')][_0xf323('0x8')]({'port':0x232a});config[_0xf323('0x9')]=_[_0xf323('0xa')](config[_0xf323('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf323('0x9')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x3d2766,_0x2aed45,_0x24ac21){return new BPromise(function(_0xc9ee82,_0x2d0996){return client[_0xf323('0xb')](_0x3d2766,_0x24ac21)[_0xf323('0xc')](function(_0x321b3b){logger[_0xf323('0xd')](_0xf323('0xe'),_0x2aed45,_0xf323('0xf'));logger[_0xf323('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x2aed45,'request\x20sent',JSON[_0xf323('0x11')](_0x321b3b));if(_0x321b3b['error']){if(_0x321b3b[_0xf323('0x12')][_0xf323('0x13')]===0x1f4){logger['error'](_0xf323('0xe'),_0x2aed45,_0x321b3b[_0xf323('0x12')][_0xf323('0x14')]);return _0x2d0996(_0x321b3b[_0xf323('0x12')]['message']);}logger[_0xf323('0x12')](_0xf323('0xe'),_0x2aed45,_0x321b3b[_0xf323('0x12')][_0xf323('0x14')]);return _0xc9ee82(_0x321b3b[_0xf323('0x12')]['message']);}else{logger[_0xf323('0xd')](_0xf323('0xe'),_0x2aed45,_0xf323('0xf'));_0xc9ee82(_0x321b3b[_0xf323('0x15')][_0xf323('0x14')]);}})[_0xf323('0x16')](function(_0xd48cbe){logger['error'](_0xf323('0xe'),_0x2aed45,_0xd48cbe);_0x2d0996(_0xd48cbe);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index df92ffd..54ce011 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 _0xaf0c=['removeListener','register','length','./dashboard.events','save','remove','update','emit'];(function(_0x409af1,_0x2b2ef2){var _0x28c0b8=function(_0x4e9ef9){while(--_0x4e9ef9){_0x409af1['push'](_0x409af1['shift']());}};_0x28c0b8(++_0x2b2ef2);}(_0xaf0c,0x113));var _0xcaf0=function(_0x31f2dc,_0x4b13bd){_0x31f2dc=_0x31f2dc-0x0;var _0x2359b2=_0xaf0c[_0x31f2dc];return _0x2359b2;};'use strict';var DashboardEvents=require(_0xcaf0('0x0'));var events=[_0xcaf0('0x1'),_0xcaf0('0x2'),_0xcaf0('0x3')];function createListener(_0x432ad5,_0x24cc04){return function(_0x378aac){_0x24cc04[_0xcaf0('0x4')](_0x432ad5,_0x378aac);};}function removeListener(_0x3dd381,_0x220982){return function(){DashboardEvents[_0xcaf0('0x5')](_0x3dd381,_0x220982);};}exports[_0xcaf0('0x6')]=function(_0x46d780){for(var _0x21d05c=0x0,_0x2b57cc=events[_0xcaf0('0x7')];_0x21d05c<_0x2b57cc;_0x21d05c++){var _0x2e1092=events[_0x21d05c];var _0x4e16fb=createListener('dashboard:'+_0x2e1092,_0x46d780);DashboardEvents['on'](_0x2e1092,_0x4e16fb);}}; \ No newline at end of file +var _0x017d=['./dashboard.events','remove','emit','register'];(function(_0xfbceb4,_0x392f3b){var _0x563dbe=function(_0x3ac1cf){while(--_0x3ac1cf){_0xfbceb4['push'](_0xfbceb4['shift']());}};_0x563dbe(++_0x392f3b);}(_0x017d,0x1ec));var _0xd017=function(_0x11a1ba,_0x2613c8){_0x11a1ba=_0x11a1ba-0x0;var _0x26b430=_0x017d[_0x11a1ba];return _0x26b430;};'use strict';var DashboardEvents=require(_0xd017('0x0'));var events=['save',_0xd017('0x1'),'update'];function createListener(_0x3ee124,_0x529885){return function(_0x26f6fd){_0x529885[_0xd017('0x2')](_0x3ee124,_0x26f6fd);};}function removeListener(_0x48fbfd,_0x3feffd){return function(){DashboardEvents['removeListener'](_0x48fbfd,_0x3feffd);};}exports[_0xd017('0x3')]=function(_0x356997){for(var _0x1c79e9=0x0,_0x31f67a=events['length'];_0x1c79e9<_0x31f67a;_0x1c79e9++){var _0x1dbc91=events[_0x1c79e9];var _0x1f7586=createListener('dashboard:'+_0x1dbc91,_0x356997);DashboardEvents['on'](_0x1dbc91,_0x1f7586);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 1aa6010..0eee409 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 _0x6bee=['path','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','show','/:id/items','post','create','addItem','put','update','delete','destroy','exports','multer'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x6bee,0x167));var _0xe6be=function(_0x7e35b2,_0x7b06ce){_0x7e35b2=_0x7e35b2-0x0;var _0x4729e1=_0x6bee[_0x7e35b2];return _0x4729e1;};'use strict';var multer=require(_0xe6be('0x0'));var util=require('util');var path=require(_0xe6be('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe6be('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xe6be('0x3'));var config=require(_0xe6be('0x4'));var controller=require(_0xe6be('0x5'));router['get']('/',auth[_0xe6be('0x6')](),controller[_0xe6be('0x7')]);router[_0xe6be('0x8')](_0xe6be('0x9'),auth['isAuthenticated'](),controller[_0xe6be('0xa')]);router['get'](_0xe6be('0xb'),auth[_0xe6be('0x6')](),controller['getItems']);router[_0xe6be('0xc')]('/',auth[_0xe6be('0x6')](),controller[_0xe6be('0xd')]);router[_0xe6be('0xc')]('/:id/clone',auth[_0xe6be('0x6')](),controller['clone']);router['post'](_0xe6be('0xb'),auth['isAuthenticated'](),controller[_0xe6be('0xe')]);router[_0xe6be('0xf')](_0xe6be('0x9'),auth[_0xe6be('0x6')](),controller[_0xe6be('0x10')]);router[_0xe6be('0x11')](_0xe6be('0x9'),auth['isAuthenticated'](),controller[_0xe6be('0x12')]);module[_0xe6be('0x13')]=router; \ No newline at end of file +var _0x6d87=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','get','/:id','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','exports','multer','path','connect-timeout'];(function(_0x375661,_0x118333){var _0x441062=function(_0x11889a){while(--_0x11889a){_0x375661['push'](_0x375661['shift']());}};_0x441062(++_0x118333);}(_0x6d87,0x1a1));var _0x76d8=function(_0x40296a,_0x5531e7){_0x40296a=_0x40296a-0x0;var _0x41ceac=_0x6d87[_0x40296a];return _0x41ceac;};'use strict';var multer=require(_0x76d8('0x0'));var util=require('util');var path=require(_0x76d8('0x1'));var timeout=require(_0x76d8('0x2'));var express=require(_0x76d8('0x3'));var router=express[_0x76d8('0x4')]();var fs_extra=require(_0x76d8('0x5'));var auth=require(_0x76d8('0x6'));var interaction=require(_0x76d8('0x7'));var config=require('../../config/environment');var controller=require(_0x76d8('0x8'));router['get']('/',auth[_0x76d8('0x9')](),controller['index']);router[_0x76d8('0xa')](_0x76d8('0xb'),auth[_0x76d8('0x9')](),controller['show']);router['get'](_0x76d8('0xc'),auth['isAuthenticated'](),controller[_0x76d8('0xd')]);router[_0x76d8('0xe')]('/',auth['isAuthenticated'](),controller[_0x76d8('0xf')]);router[_0x76d8('0xe')](_0x76d8('0x10'),auth['isAuthenticated'](),controller[_0x76d8('0x11')]);router[_0x76d8('0xe')](_0x76d8('0xc'),auth[_0x76d8('0x9')](),controller[_0x76d8('0x12')]);router[_0x76d8('0x13')](_0x76d8('0xb'),auth[_0x76d8('0x9')](),controller['update']);router['delete'](_0x76d8('0xb'),auth[_0x76d8('0x9')](),controller['destroy']);module[_0x76d8('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index eb82ecc..4bcd0f3 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 _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x39c079,_0x44792d){var _0x3da96b=function(_0x1361bf){while(--_0x1361bf){_0x39c079['push'](_0x39c079['shift']());}};_0x3da96b(++_0x44792d);}(_0x5fab,0x177));var _0xb5fa=function(_0x598efc,_0x5e971c){_0x598efc=_0x598efc-0x0;var _0x435e4f=_0x5fab[_0x598efc];return _0x435e4f;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x53ec=['getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','long'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x53ec,0x192));var _0xc53e=function(_0x6e51f1,_0x11371a){_0x6e51f1=_0x6e51f1-0x0;var _0x141b4c=_0x53ec[_0x6e51f1];return _0x141b4c;};'use strict';var Sequelize=require(_0xc53e('0x0'));var squel=require(_0xc53e('0x1'));var _=require(_0xc53e('0x2'));module[_0xc53e('0x3')]={'title':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xc53e('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xc53e('0x5')),'get':function(){try{return JSON['parse'](this[_0xc53e('0x6')](_0xc53e('0x7')));}catch(_0x4a9c59){return[];}},'set':function(_0x2f1414){try{this['setDataValue'](_0xc53e('0x7'),JSON[_0xc53e('0x8')](_0x2f1414));}catch(_0x5d3b28){this[_0xc53e('0x9')](_0xc53e('0x7'),JSON[_0xc53e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xc53e('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xc53e('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xc53e('0xa')]},'col':{'type':Sequelize[_0xc53e('0xa')]},'background':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![],'defaultValue':_0xc53e('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xc53e('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index e32491c..d7c4310 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 _0xfcf0=['attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','show','params','model','keys','DashboardItem','query','filters','attributes','intersection','fields','length','includeAll','merge','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00'];(function(_0x1f2450,_0x702b2e){var _0x3b0556=function(_0x1047da){while(--_0x1047da){_0x1f2450['push'](_0x1f2450['shift']());}};_0x3b0556(++_0x702b2e);}(_0xfcf0,0xc8));var _0x0fcf=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0xfcf0[_0xd7b0a4];return _0x184e9e;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require(_0x0fcf('0x2'));var jsonpatch=require(_0x0fcf('0x3'));var rp=require(_0x0fcf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0fcf('0x5'));var path=require(_0x0fcf('0x6'));var sox=require(_0x0fcf('0x7'));var csv=require(_0x0fcf('0x8'));var ejs=require(_0x0fcf('0x9'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xa'));var _=require(_0x0fcf('0xb'));var squel=require(_0x0fcf('0xc'));var crypto=require(_0x0fcf('0xd'));var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x8'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require(_0x0fcf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fcf('0x14'));var logger=require(_0x0fcf('0x15'))(_0x0fcf('0x16'));var utils=require('../../config/utils');var config=require(_0x0fcf('0x17'));var licenseUtil=require(_0x0fcf('0x18'));var db=require(_0x0fcf('0x19'))['db'];config[_0x0fcf('0x1a')]=_[_0x0fcf('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0fcf('0x1c'))(new Redis(config[_0x0fcf('0x1a')]));require(_0x0fcf('0x1d'))[_0x0fcf('0x1e')](socket);function respondWithStatusCode(_0x1a71d0,_0x538333){_0x538333=_0x538333||0xcc;return function(_0x53bbe1){if(_0x53bbe1){return _0x1a71d0[_0x0fcf('0x1f')](_0x538333);}return _0x1a71d0[_0x0fcf('0x20')](_0x538333)['end']();};}function respondWithResult(_0x43dd6c,_0x3d1ee5){_0x3d1ee5=_0x3d1ee5||0xc8;return function(_0x2aa395){if(_0x2aa395){return _0x43dd6c[_0x0fcf('0x20')](_0x3d1ee5)[_0x0fcf('0x21')](_0x2aa395);}};}function respondWithFilteredResult(_0x299723,_0x50c142){return function(_0x3cb737){if(_0x3cb737){var _0x4049f8=typeof _0x50c142['offset']===_0x0fcf('0x22')&&typeof _0x50c142['limit']===_0x0fcf('0x22');var _0x301200=_0x3cb737['count'];var _0x362137=_0x4049f8?0x0:_0x50c142[_0x0fcf('0x23')];var _0x16cc4e=_0x4049f8?_0x3cb737[_0x0fcf('0x24')]:_0x50c142[_0x0fcf('0x23')]+_0x50c142['limit'];var _0x27c704;if(_0x16cc4e>=_0x301200){_0x16cc4e=_0x301200;_0x27c704=0xc8;}else{_0x27c704=0xce;}_0x299723[_0x0fcf('0x20')](_0x27c704);return _0x299723[_0x0fcf('0x25')](_0x0fcf('0x26'),_0x362137+'-'+_0x16cc4e+'/'+_0x301200)[_0x0fcf('0x21')](_0x3cb737);}return null;};}function patchUpdates(_0x484804){return function(_0x31a5dc){try{jsonpatch[_0x0fcf('0x27')](_0x31a5dc,_0x484804,!![]);}catch(_0x5b0764){return BPromise[_0x0fcf('0x28')](_0x5b0764);}return _0x31a5dc[_0x0fcf('0x29')]();};}function saveUpdates(_0x1e7cc8,_0x418741){return function(_0x2b0b02){if(_0x2b0b02){return _0x2b0b02[_0x0fcf('0x2a')](_0x1e7cc8)['then'](function(_0x224eac){return _0x224eac;});}return null;};}function removeEntity(_0x4ab72a,_0x5a3c21){return function(_0x22c860){if(_0x22c860){return _0x22c860[_0x0fcf('0x2b')]()[_0x0fcf('0x2c')](function(){_0x4ab72a['status'](0xcc)[_0x0fcf('0x2d')]();});}};}function handleEntityNotFound(_0x368c39,_0x4f0941){return function(_0x33718b){if(!_0x33718b){_0x368c39[_0x0fcf('0x1f')](0x194);}return _0x33718b;};}function handleError(_0x5b8649,_0x327209){_0x327209=_0x327209||0x1f4;return function(_0x2fb2d1){logger[_0x0fcf('0x2e')](_0x2fb2d1[_0x0fcf('0x2f')]);if(_0x2fb2d1[_0x0fcf('0x30')]){delete _0x2fb2d1[_0x0fcf('0x30')];}_0x5b8649[_0x0fcf('0x20')](_0x327209)['send'](_0x2fb2d1);};}exports[_0x0fcf('0x31')]=function(_0x427dde,_0x50ac37){var _0x212717={'raw':![],'where':{'id':_0x427dde[_0x0fcf('0x32')]['id']}},_0x3761f1={};_0x3761f1[_0x0fcf('0x33')]=_[_0x0fcf('0x34')](db[_0x0fcf('0x35')]['rawAttributes']);_0x3761f1[_0x0fcf('0x36')]=_[_0x0fcf('0x34')](_0x427dde[_0x0fcf('0x36')]);_0x3761f1[_0x0fcf('0x37')]=_['intersection'](_0x3761f1[_0x0fcf('0x33')],_0x3761f1[_0x0fcf('0x36')]);_0x212717[_0x0fcf('0x38')]=_[_0x0fcf('0x39')](_0x3761f1[_0x0fcf('0x33')],qs[_0x0fcf('0x3a')](_0x427dde['query'][_0x0fcf('0x3a')]));_0x212717[_0x0fcf('0x38')]=_0x212717[_0x0fcf('0x38')][_0x0fcf('0x3b')]?_0x212717[_0x0fcf('0x38')]:_0x3761f1[_0x0fcf('0x33')];if(_0x427dde['query'][_0x0fcf('0x3c')]){_0x212717['include']=[{'all':!![]}];}_0x212717=_[_0x0fcf('0x3d')]({},_0x212717,_0x427dde['options']);return db[_0x0fcf('0x35')][_0x0fcf('0x3e')](_0x212717)['then'](handleEntityNotFound(_0x50ac37,null))[_0x0fcf('0x2c')](respondWithResult(_0x50ac37,null))['catch'](handleError(_0x50ac37,null));};exports[_0x0fcf('0x2b')]=function(_0x3762ec,_0x3a15cf){return db['DashboardItem'][_0x0fcf('0x3e')]({'where':{'id':_0x3762ec[_0x0fcf('0x32')]['id']}})[_0x0fcf('0x2c')](handleEntityNotFound(_0x3a15cf,null))[_0x0fcf('0x2c')](removeEntity(_0x3a15cf,null))[_0x0fcf('0x3f')](handleError(_0x3a15cf,null));};function widgetAttributes(_0x320b8){try{switch(_0x320b8[_0x0fcf('0x40')]){case _0x0fcf('0x41'):return[{'name':_0x0fcf('0x42'),'value':_0x320b8[_0x0fcf('0x42')]||(_0x320b8['attrs']&&_0x320b8['attrs'][0x0]?_0x320b8[_0x0fcf('0x43')][0x0][_0x0fcf('0x44')]:undefined)||_0x0fcf('0x45')}];case'custom':return[{'name':_0x0fcf('0x46'),'value':_0x320b8['attrPath']||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8[_0x0fcf('0x43')][0x0]?_0x320b8[_0x0fcf('0x43')][0x0][_0x0fcf('0x44')]:undefined)||''}];case _0x0fcf('0x47'):return[{'name':_0x0fcf('0x48'),'value':_0x320b8[_0x0fcf('0x48')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8['attrs'][0x0]?_0x320b8[_0x0fcf('0x43')][0x0][_0x0fcf('0x44')]:undefined)||_0x0fcf('0x49')},{'name':_0x0fcf('0x4a'),'value':_0x320b8[_0x0fcf('0x4a')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8[_0x0fcf('0x43')][0x1]?_0x320b8[_0x0fcf('0x43')][0x1][_0x0fcf('0x44')]:undefined)||_0x0fcf('0x4b')},{'name':'attrFontSize','value':_0x320b8[_0x0fcf('0x4c')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8[_0x0fcf('0x43')][0x2]?_0x320b8[_0x0fcf('0x43')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x320b8[_0x0fcf('0x4d')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8['attrs'][0x0]?_0x320b8['attrs'][0x0][_0x0fcf('0x44')]:undefined)||_0x0fcf('0x4e')},{'name':_0x0fcf('0x4f'),'value':_0x320b8[_0x0fcf('0x4f')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8[_0x0fcf('0x43')][0x1]?_0x320b8['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x320b8[_0x0fcf('0x4c')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8[_0x0fcf('0x43')][0x2]?_0x320b8[_0x0fcf('0x43')][0x2]['value']:undefined)||0x14}];case _0x0fcf('0x50'):case _0x0fcf('0x51'):return[{'name':_0x0fcf('0x52'),'value':_0x320b8[_0x0fcf('0x52')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8['attrs'][0x0]?_0x320b8[_0x0fcf('0x43')][0x0][_0x0fcf('0x44')]:undefined)||_0x0fcf('0x4e')},{'name':_0x0fcf('0x53'),'value':_0x320b8[_0x0fcf('0x53')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8[_0x0fcf('0x43')][0x1]?_0x320b8['attrs'][0x1]['value']:undefined)||null},{'name':_0x0fcf('0x54'),'value':_0x320b8[_0x0fcf('0x54')]||(_0x320b8['attrs']&&_0x320b8[_0x0fcf('0x43')][0x2]?_0x320b8['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x320b8[_0x0fcf('0x4f')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8[_0x0fcf('0x43')][0x3]?_0x320b8['attrs'][0x3][_0x0fcf('0x44')]:undefined)||[]}];case'web-report':return[{'name':_0x0fcf('0x55'),'type':_0x320b8[_0x0fcf('0x56')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8['attrs'][0x0]?_0x320b8[_0x0fcf('0x43')][0x0]['type']:undefined)||null,'value':_0x320b8['attrReport']||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8['attrs'][0x0]?_0x320b8['attrs'][0x0][_0x0fcf('0x44')]:undefined)||null},{'name':_0x0fcf('0x57'),'value':_0x320b8[_0x0fcf('0x57')]||(_0x320b8[_0x0fcf('0x43')]&&_0x320b8[_0x0fcf('0x43')][0x1]?_0x320b8[_0x0fcf('0x43')][0x1][_0x0fcf('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x110787){logger[_0x0fcf('0x2e')](_0x0fcf('0x58'),JSON[_0x0fcf('0x59')](_0x110787));return[];}}exports[_0x0fcf('0x5a')]=function(_0x1e8e69,_0x1af728){if(_0x1e8e69['body']){_0x1e8e69[_0x0fcf('0x5b')][_0x0fcf('0x43')]=widgetAttributes(_0x1e8e69[_0x0fcf('0x5b')]);}return db[_0x0fcf('0x35')][_0x0fcf('0x5a')](_0x1e8e69[_0x0fcf('0x5b')],{})[_0x0fcf('0x2c')](respondWithResult(_0x1af728,0xc9))[_0x0fcf('0x3f')](handleError(_0x1af728,null));};exports[_0x0fcf('0x2a')]=function(_0x136d35,_0x1385ae){if(_0x136d35['body']['id']){delete _0x136d35['body']['id'];}_0x136d35[_0x0fcf('0x5b')][_0x0fcf('0x43')]=widgetAttributes(_0x136d35[_0x0fcf('0x5b')]);return db[_0x0fcf('0x35')][_0x0fcf('0x3e')]({'where':{'id':_0x136d35[_0x0fcf('0x32')]['id']}})[_0x0fcf('0x2c')](handleEntityNotFound(_0x1385ae,null))[_0x0fcf('0x2c')](saveUpdates(_0x136d35[_0x0fcf('0x5b')],null))[_0x0fcf('0x2c')](respondWithResult(_0x1385ae,null))['catch'](handleError(_0x1385ae,null));}; \ No newline at end of file +var _0x6dd0=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','error','stack','name','show','params','keys','DashboardItem','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x6dd0,0xae));var _0x06dd=function(_0x286f07,_0x40e03a){_0x286f07=_0x286f07-0x0;var _0x437c35=_0x6dd0[_0x286f07];return _0x437c35;};'use strict';var emlformat=require(_0x06dd('0x0'));var rimraf=require(_0x06dd('0x1'));var zipdir=require(_0x06dd('0x2'));var jsonpatch=require(_0x06dd('0x3'));var rp=require(_0x06dd('0x4'));var moment=require(_0x06dd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x06dd('0x6'));var path=require(_0x06dd('0x7'));var sox=require(_0x06dd('0x8'));var csv=require(_0x06dd('0x9'));var ejs=require(_0x06dd('0xa'));var fs=require('fs');var fs_extra=require(_0x06dd('0xb'));var _=require('lodash');var squel=require(_0x06dd('0xc'));var crypto=require(_0x06dd('0xd'));var jsforce=require(_0x06dd('0xe'));var deskjs=require(_0x06dd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x06dd('0x10'));var Papa=require(_0x06dd('0x11'));var Redis=require('ioredis');var authService=require(_0x06dd('0x12'));var qs=require(_0x06dd('0x13'));var as=require(_0x06dd('0x14'));var hardwareService=require(_0x06dd('0x15'));var logger=require(_0x06dd('0x16'))(_0x06dd('0x17'));var utils=require('../../config/utils');var config=require(_0x06dd('0x18'));var licenseUtil=require(_0x06dd('0x19'));var db=require(_0x06dd('0x1a'))['db'];config[_0x06dd('0x1b')]=_['defaults'](config[_0x06dd('0x1b')],{'host':_0x06dd('0x1c'),'port':0x18eb});var socket=require(_0x06dd('0x1d'))(new Redis(config[_0x06dd('0x1b')]));require(_0x06dd('0x1e'))['register'](socket);function respondWithStatusCode(_0x3b4042,_0x3bf79e){_0x3bf79e=_0x3bf79e||0xcc;return function(_0x5396c4){if(_0x5396c4){return _0x3b4042[_0x06dd('0x1f')](_0x3bf79e);}return _0x3b4042['status'](_0x3bf79e)[_0x06dd('0x20')]();};}function respondWithResult(_0x42dfe8,_0x594fda){_0x594fda=_0x594fda||0xc8;return function(_0x476484){if(_0x476484){return _0x42dfe8[_0x06dd('0x21')](_0x594fda)[_0x06dd('0x22')](_0x476484);}};}function respondWithFilteredResult(_0x99d879,_0x482b3b){return function(_0x1326a4){if(_0x1326a4){var _0x490792=typeof _0x482b3b['offset']===_0x06dd('0x23')&&typeof _0x482b3b[_0x06dd('0x24')]==='undefined';var _0x3a83b6=_0x1326a4[_0x06dd('0x25')];var _0x229cd6=_0x490792?0x0:_0x482b3b['offset'];var _0x3f15f6=_0x490792?_0x1326a4['count']:_0x482b3b[_0x06dd('0x26')]+_0x482b3b[_0x06dd('0x24')];var _0x534806;if(_0x3f15f6>=_0x3a83b6){_0x3f15f6=_0x3a83b6;_0x534806=0xc8;}else{_0x534806=0xce;}_0x99d879[_0x06dd('0x21')](_0x534806);return _0x99d879[_0x06dd('0x27')](_0x06dd('0x28'),_0x229cd6+'-'+_0x3f15f6+'/'+_0x3a83b6)[_0x06dd('0x22')](_0x1326a4);}return null;};}function patchUpdates(_0x362865){return function(_0x4757fe){try{jsonpatch[_0x06dd('0x29')](_0x4757fe,_0x362865,!![]);}catch(_0x38b1b3){return BPromise['reject'](_0x38b1b3);}return _0x4757fe[_0x06dd('0x2a')]();};}function saveUpdates(_0x4d1d62,_0x39ae65){return function(_0x2fe65b){if(_0x2fe65b){return _0x2fe65b['update'](_0x4d1d62)[_0x06dd('0x2b')](function(_0xca0c00){return _0xca0c00;});}return null;};}function removeEntity(_0x1bb9b2,_0x12d3c2){return function(_0xfd530){if(_0xfd530){return _0xfd530['destroy']()[_0x06dd('0x2b')](function(){_0x1bb9b2[_0x06dd('0x21')](0xcc)[_0x06dd('0x20')]();});}};}function handleEntityNotFound(_0x2668b2,_0x8b7213){return function(_0x50e312){if(!_0x50e312){_0x2668b2['sendStatus'](0x194);}return _0x50e312;};}function handleError(_0x5f0c97,_0x29b25b){_0x29b25b=_0x29b25b||0x1f4;return function(_0x2d30f6){logger[_0x06dd('0x2c')](_0x2d30f6[_0x06dd('0x2d')]);if(_0x2d30f6[_0x06dd('0x2e')]){delete _0x2d30f6[_0x06dd('0x2e')];}_0x5f0c97[_0x06dd('0x21')](_0x29b25b)['send'](_0x2d30f6);};}exports[_0x06dd('0x2f')]=function(_0x358aa3,_0x251d66){var _0x3db9f6={'raw':![],'where':{'id':_0x358aa3[_0x06dd('0x30')]['id']}},_0x38c505={};_0x38c505['model']=_[_0x06dd('0x31')](db[_0x06dd('0x32')]['rawAttributes']);_0x38c505[_0x06dd('0x33')]=_[_0x06dd('0x31')](_0x358aa3['query']);_0x38c505[_0x06dd('0x34')]=_['intersection'](_0x38c505['model'],_0x38c505['query']);_0x3db9f6['attributes']=_[_0x06dd('0x35')](_0x38c505[_0x06dd('0x36')],qs[_0x06dd('0x37')](_0x358aa3[_0x06dd('0x33')]['fields']));_0x3db9f6[_0x06dd('0x38')]=_0x3db9f6['attributes'][_0x06dd('0x39')]?_0x3db9f6[_0x06dd('0x38')]:_0x38c505[_0x06dd('0x36')];if(_0x358aa3[_0x06dd('0x33')][_0x06dd('0x3a')]){_0x3db9f6[_0x06dd('0x3b')]=[{'all':!![]}];}_0x3db9f6=_[_0x06dd('0x3c')]({},_0x3db9f6,_0x358aa3[_0x06dd('0x3d')]);return db[_0x06dd('0x32')][_0x06dd('0x3e')](_0x3db9f6)[_0x06dd('0x2b')](handleEntityNotFound(_0x251d66,null))['then'](respondWithResult(_0x251d66,null))['catch'](handleError(_0x251d66,null));};exports['destroy']=function(_0x2f9b4a,_0x1d9439){return db[_0x06dd('0x32')]['find']({'where':{'id':_0x2f9b4a[_0x06dd('0x30')]['id']}})[_0x06dd('0x2b')](handleEntityNotFound(_0x1d9439,null))[_0x06dd('0x2b')](removeEntity(_0x1d9439,null))['catch'](handleError(_0x1d9439,null));};function widgetAttributes(_0x5e5d66){try{switch(_0x5e5d66[_0x06dd('0x3f')]){case _0x06dd('0x40'):return[{'name':_0x06dd('0x41'),'value':_0x5e5d66[_0x06dd('0x41')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x0]?_0x5e5d66['attrs'][0x0][_0x06dd('0x43')]:undefined)||_0x06dd('0x44')}];case _0x06dd('0x45'):return[{'name':_0x06dd('0x46'),'value':_0x5e5d66['attrPath']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66['attrs'][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0][_0x06dd('0x43')]:undefined)||''}];case'clock':return[{'name':_0x06dd('0x47'),'value':_0x5e5d66[_0x06dd('0x47')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0][_0x06dd('0x43')]:undefined)||_0x06dd('0x48')},{'name':'attrTimezone','value':_0x5e5d66[_0x06dd('0x49')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66['attrs'][0x1]?_0x5e5d66['attrs'][0x1][_0x06dd('0x43')]:undefined)||_0x06dd('0x4a')},{'name':'attrFontSize','value':_0x5e5d66[_0x06dd('0x4b')]||(_0x5e5d66['attrs']&&_0x5e5d66['attrs'][0x2]?_0x5e5d66[_0x06dd('0x42')][0x2][_0x06dd('0x43')]:undefined)||0xc}];case _0x06dd('0x4c'):return[{'name':_0x06dd('0x4d'),'value':_0x5e5d66['attrMetric']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66['attrs'][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0]['value']:undefined)||_0x06dd('0x4e')},{'name':_0x06dd('0x4f'),'value':_0x5e5d66[_0x06dd('0x4f')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x1]?_0x5e5d66[_0x06dd('0x42')][0x1][_0x06dd('0x43')]:undefined)||[]},{'name':'attrFontSize','value':_0x5e5d66['attrFontSize']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x2]?_0x5e5d66[_0x06dd('0x42')][0x2][_0x06dd('0x43')]:undefined)||0x14}];case _0x06dd('0x50'):case _0x06dd('0x51'):return[{'name':_0x06dd('0x52'),'value':_0x5e5d66['attrSerie1']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66['attrs'][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0][_0x06dd('0x43')]:undefined)||_0x06dd('0x4e')},{'name':_0x06dd('0x53'),'value':_0x5e5d66['attrSerie2']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x1]?_0x5e5d66[_0x06dd('0x42')][0x1]['value']:undefined)||null},{'name':_0x06dd('0x54'),'value':_0x5e5d66['attrSerie3']||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x2]?_0x5e5d66[_0x06dd('0x42')][0x2][_0x06dd('0x43')]:undefined)||null},{'name':_0x06dd('0x4f'),'value':_0x5e5d66[_0x06dd('0x4f')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x3]?_0x5e5d66[_0x06dd('0x42')][0x3]['value']:undefined)||[]}];case _0x06dd('0x55'):return[{'name':'attrReport','type':_0x5e5d66[_0x06dd('0x56')]||(_0x5e5d66[_0x06dd('0x42')]&&_0x5e5d66[_0x06dd('0x42')][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0][_0x06dd('0x3f')]:undefined)||null,'value':_0x5e5d66['attrReport']||(_0x5e5d66['attrs']&&_0x5e5d66[_0x06dd('0x42')][0x0]?_0x5e5d66[_0x06dd('0x42')][0x0][_0x06dd('0x43')]:undefined)||null},{'name':_0x06dd('0x57'),'value':_0x5e5d66['attrRefresh']||(_0x5e5d66['attrs']&&_0x5e5d66[_0x06dd('0x42')][0x1]?_0x5e5d66['attrs'][0x1][_0x06dd('0x43')]:undefined)||0x0}];default:return[];}}catch(_0xcba7b0){logger[_0x06dd('0x2c')](_0x06dd('0x58'),JSON[_0x06dd('0x59')](_0xcba7b0));return[];}}exports[_0x06dd('0x5a')]=function(_0x309750,_0x339702){if(_0x309750[_0x06dd('0x5b')]){_0x309750[_0x06dd('0x5b')][_0x06dd('0x42')]=widgetAttributes(_0x309750[_0x06dd('0x5b')]);}return db[_0x06dd('0x32')]['create'](_0x309750[_0x06dd('0x5b')],{})['then'](respondWithResult(_0x339702,0xc9))[_0x06dd('0x5c')](handleError(_0x339702,null));};exports[_0x06dd('0x5d')]=function(_0x53db09,_0x405336){if(_0x53db09[_0x06dd('0x5b')]['id']){delete _0x53db09['body']['id'];}_0x53db09[_0x06dd('0x5b')][_0x06dd('0x42')]=widgetAttributes(_0x53db09[_0x06dd('0x5b')]);return db[_0x06dd('0x32')][_0x06dd('0x3e')]({'where':{'id':_0x53db09[_0x06dd('0x30')]['id']}})['then'](handleEntityNotFound(_0x405336,null))[_0x06dd('0x2b')](saveUpdates(_0x53db09[_0x06dd('0x5b')],null))['then'](respondWithResult(_0x405336,null))[_0x06dd('0x5c')](handleError(_0x405336,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 96e5477..2ba33fc 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 _0xd837=['hook','exports','events','DashboardItem','setMaxListeners','save','remove','emit'];(function(_0x44507f,_0x2f3434){var _0x4efbec=function(_0x4a6128){while(--_0x4a6128){_0x44507f['push'](_0x44507f['shift']());}};_0x4efbec(++_0x2f3434);}(_0xd837,0x1f2));var _0x7d83=function(_0x2211ed,_0x1bca0b){_0x2211ed=_0x2211ed-0x0;var _0x4d78cc=_0xd837[_0x2211ed];return _0x4d78cc;};'use strict';var EventEmitter=require(_0x7d83('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x7d83('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7d83('0x2')](0x0);var events={'afterCreate':_0x7d83('0x3'),'afterUpdate':'update','afterDestroy':_0x7d83('0x4')};function emitEvent(_0x18d24a){return function(_0x3188b6,_0x31b7e7,_0x3f66aa){DashboardItemEvents[_0x7d83('0x5')](_0x18d24a+':'+_0x3188b6['id'],_0x3188b6);DashboardItemEvents[_0x7d83('0x5')](_0x18d24a,_0x3188b6);_0x3f66aa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x7d83('0x6')](e,emitEvent(event));}}module[_0x7d83('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xa413=['update','emit','hasOwnProperty','hook','exports','events','DashboardItem','save'];(function(_0x5c0b94,_0x5d4ae3){var _0x2429b4=function(_0x1d649b){while(--_0x1d649b){_0x5c0b94['push'](_0x5c0b94['shift']());}};_0x2429b4(++_0x5d4ae3);}(_0xa413,0x1e5));var _0x3a41=function(_0x156023,_0x1be9af){_0x156023=_0x156023-0x0;var _0x44b162=_0xa413[_0x156023];return _0x44b162;};'use strict';var EventEmitter=require(_0x3a41('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x3a41('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3a41('0x2'),'afterUpdate':_0x3a41('0x3'),'afterDestroy':'remove'};function emitEvent(_0x53ca9c){return function(_0x32a053,_0x212eb6,_0x118b7a){DashboardItemEvents[_0x3a41('0x4')](_0x53ca9c+':'+_0x32a053['id'],_0x32a053);DashboardItemEvents[_0x3a41('0x4')](_0x53ca9c,_0x32a053);_0x118b7a(null);};}for(var e in events){if(events[_0x3a41('0x5')](e)){var event=events[e];DashboardItem[_0x3a41('0x6')](e,emitEvent(event));}}module[_0x3a41('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index ccacd66..1e1a469 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 _0x3182=['DashboardItem','lodash','../../config/logger','moment','request-promise','../../config/environment','exports','define'];(function(_0x5aa70e,_0x40feb2){var _0x11146d=function(_0x4847db){while(--_0x4847db){_0x5aa70e['push'](_0x5aa70e['shift']());}};_0x11146d(++_0x40feb2);}(_0x3182,0x99));var _0x2318=function(_0x166d2e,_0x4c023){_0x166d2e=_0x166d2e-0x0;var _0x36146f=_0x3182[_0x166d2e];return _0x36146f;};'use strict';var _=require(_0x2318('0x0'));var util=require('util');var logger=require(_0x2318('0x1'))('api');var moment=require(_0x2318('0x2'));var BPromise=require('bluebird');var rp=require(_0x2318('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2318('0x4'));var attributes=require('./dashboardItem.attributes');module[_0x2318('0x5')]=function(_0x2125b9,_0xe140e9){return _0x2125b9[_0x2318('0x6')](_0x2318('0x7'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3954=['dashboard_items','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3954,0x16d));var _0x4395=function(_0x18227a,_0x198ce6){_0x18227a=_0x18227a-0x0;var _0x53b481=_0x3954[_0x18227a];return _0x53b481;};'use strict';var _=require(_0x4395('0x0'));var util=require(_0x4395('0x1'));var logger=require('../../config/logger')(_0x4395('0x2'));var moment=require('moment');var BPromise=require(_0x4395('0x3'));var rp=require(_0x4395('0x4'));var fs=require('fs');var path=require(_0x4395('0x5'));var rimraf=require(_0x4395('0x6'));var config=require(_0x4395('0x7'));var attributes=require(_0x4395('0x8'));module[_0x4395('0x9')]=function(_0x4ee6b0,_0x5463d5){return _0x4ee6b0[_0x4395('0xa')](_0x4395('0xb'),attributes,{'tableName':_0x4395('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 4225340..c4a8b99 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 _0xc1bc=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2273a0,_0x3ce94e){var _0x507082=function(_0x41e560){while(--_0x41e560){_0x2273a0['push'](_0x2273a0['shift']());}};_0x507082(++_0x3ce94e);}(_0xc1bc,0x132));var _0xcc1b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc1bc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xcc1b('0x0'));var moment=require('moment');var BPromise=require(_0xcc1b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc1b('0x2'));var db=require(_0xcc1b('0x3'))['db'];var utils=require(_0xcc1b('0x4'));var logger=require('../../config/logger')(_0xcc1b('0x5'));var config=require(_0xcc1b('0x6'));var jayson=require(_0xcc1b('0x7'));var client=jayson[_0xcc1b('0x8')][_0xcc1b('0x9')]({'port':0x232a});config[_0xcc1b('0xa')]=_[_0xcc1b('0xb')](config['redis'],{'host':_0xcc1b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc1b('0xa')]));require(_0xcc1b('0xd'))[_0xcc1b('0xe')](socket);function respondWithRpcPromise(_0x141a90,_0x324819,_0x5eb7df){return new BPromise(function(_0x1fedd6,_0x438113){return client['request'](_0x141a90,_0x5eb7df)[_0xcc1b('0xf')](function(_0x250377){logger[_0xcc1b('0x10')](_0xcc1b('0x11'),_0x324819,'request\x20sent');logger['debug'](_0xcc1b('0x12'),_0x324819,_0xcc1b('0x13'),JSON[_0xcc1b('0x14')](_0x250377));if(_0x250377[_0xcc1b('0x15')]){if(_0x250377['error'][_0xcc1b('0x16')]===0x1f4){logger[_0xcc1b('0x15')](_0xcc1b('0x11'),_0x324819,_0x250377[_0xcc1b('0x15')]['message']);return _0x438113(_0x250377[_0xcc1b('0x15')][_0xcc1b('0x17')]);}logger[_0xcc1b('0x15')]('DashboardItem,\x20%s,\x20%s',_0x324819,_0x250377[_0xcc1b('0x15')][_0xcc1b('0x17')]);return _0x1fedd6(_0x250377['error'][_0xcc1b('0x17')]);}else{logger[_0xcc1b('0x10')](_0xcc1b('0x11'),_0x324819,_0xcc1b('0x13'));_0x1fedd6(_0x250377[_0xcc1b('0x18')][_0xcc1b('0x17')]);}})[_0xcc1b('0x19')](function(_0x4b39c4){logger[_0xcc1b('0x15')](_0xcc1b('0x11'),_0x324819,_0x4b39c4);_0x438113(_0x4b39c4);});});} \ No newline at end of file +var _0x1049=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','request\x20sent','debug','stringify','error','DashboardItem,\x20%s,\x20%s','message','info','result','catch'];(function(_0x511d41,_0x14b3ca){var _0x1030e3=function(_0x4e38d2){while(--_0x4e38d2){_0x511d41['push'](_0x511d41['shift']());}};_0x1030e3(++_0x14b3ca);}(_0x1049,0x134));var _0x9104=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1049[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9104('0x0'));var util=require(_0x9104('0x1'));var moment=require(_0x9104('0x2'));var BPromise=require(_0x9104('0x3'));var rs=require(_0x9104('0x4'));var fs=require('fs');var Redis=require(_0x9104('0x5'));var db=require(_0x9104('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9104('0x7'))(_0x9104('0x8'));var config=require('../../config/environment');var jayson=require(_0x9104('0x9'));var client=jayson['client'][_0x9104('0xa')]({'port':0x232a});config[_0x9104('0xb')]=_[_0x9104('0xc')](config[_0x9104('0xb')],{'host':_0x9104('0xd'),'port':0x18eb});var socket=require(_0x9104('0xe'))(new Redis(config[_0x9104('0xb')]));require(_0x9104('0xf'))[_0x9104('0x10')](socket);function respondWithRpcPromise(_0x3e98cf,_0x4bd299,_0x552162){return new BPromise(function(_0x13231d,_0x85629d){return client[_0x9104('0x11')](_0x3e98cf,_0x552162)[_0x9104('0x12')](function(_0xc13335){logger['info']('DashboardItem,\x20%s,\x20%s',_0x4bd299,_0x9104('0x13'));logger[_0x9104('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4bd299,_0x9104('0x13'),JSON[_0x9104('0x15')](_0xc13335));if(_0xc13335[_0x9104('0x16')]){if(_0xc13335[_0x9104('0x16')]['code']===0x1f4){logger['error'](_0x9104('0x17'),_0x4bd299,_0xc13335[_0x9104('0x16')][_0x9104('0x18')]);return _0x85629d(_0xc13335[_0x9104('0x16')][_0x9104('0x18')]);}logger[_0x9104('0x16')](_0x9104('0x17'),_0x4bd299,_0xc13335[_0x9104('0x16')]['message']);return _0x13231d(_0xc13335['error'][_0x9104('0x18')]);}else{logger[_0x9104('0x19')](_0x9104('0x17'),_0x4bd299,_0x9104('0x13'));_0x13231d(_0xc13335[_0x9104('0x1a')][_0x9104('0x18')]);}})[_0x9104('0x1b')](function(_0x51928c){logger['error'](_0x9104('0x17'),_0x4bd299,_0x51928c);_0x85629d(_0x51928c);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d83cadb..127d03c 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 _0x4b76=['removeListener','./dashboardItem.events','save','remove','update','emit'];(function(_0x38e3f9,_0x71ddb8){var _0x3ff2bf=function(_0x2c78fc){while(--_0x2c78fc){_0x38e3f9['push'](_0x38e3f9['shift']());}};_0x3ff2bf(++_0x71ddb8);}(_0x4b76,0x115));var _0x64b7=function(_0xcd71ae,_0xb54c34){_0xcd71ae=_0xcd71ae-0x0;var _0x271179=_0x4b76[_0xcd71ae];return _0x271179;};'use strict';var DashboardItemEvents=require(_0x64b7('0x0'));var events=[_0x64b7('0x1'),_0x64b7('0x2'),_0x64b7('0x3')];function createListener(_0xdc9374,_0x1a7521){return function(_0x539b32){_0x1a7521[_0x64b7('0x4')](_0xdc9374,_0x539b32);};}function removeListener(_0x46345f,_0xb25edd){return function(){DashboardItemEvents[_0x64b7('0x5')](_0x46345f,_0xb25edd);};}exports['register']=function(_0x17c905){for(var _0x3c542b=0x0,_0x1e3572=events['length'];_0x3c542b<_0x1e3572;_0x3c542b++){var _0x49b8cd=events[_0x3c542b];var _0x2168bf=createListener('dashboardItem:'+_0x49b8cd,_0x17c905);DashboardItemEvents['on'](_0x49b8cd,_0x2168bf);}}; \ No newline at end of file +var _0xf00e=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x55f233,_0x5c8281){var _0x37554a=function(_0x4370d6){while(--_0x4370d6){_0x55f233['push'](_0x55f233['shift']());}};_0x37554a(++_0x5c8281);}(_0xf00e,0x80));var _0xef00=function(_0x96e9a1,_0x33e139){_0x96e9a1=_0x96e9a1-0x0;var _0x5bff77=_0xf00e[_0x96e9a1];return _0x5bff77;};'use strict';var DashboardItemEvents=require(_0xef00('0x0'));var events=[_0xef00('0x1'),_0xef00('0x2'),_0xef00('0x3')];function createListener(_0x172806,_0x23561a){return function(_0x46cd20){_0x23561a[_0xef00('0x4')](_0x172806,_0x46cd20);};}function removeListener(_0x3660e4,_0x59e043){return function(){DashboardItemEvents['removeListener'](_0x3660e4,_0x59e043);};}exports['register']=function(_0x12912b){for(var _0x13ea80=0x0,_0x30c256=events[_0xef00('0x5')];_0x13ea80<_0x30c256;_0x13ea80++){var _0x62f882=events[_0x13ea80];var _0xde2f8c=createListener(_0xef00('0x6')+_0x62f882,_0x12912b);DashboardItemEvents['on'](_0x62f882,_0xde2f8c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 43e6bea..670d8f5 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 _0x8bf2=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','show','put','update','delete','/:id'];(function(_0x453647,_0x1f7fcb){var _0x152936=function(_0x12e222){while(--_0x12e222){_0x453647['push'](_0x453647['shift']());}};_0x152936(++_0x1f7fcb);}(_0x8bf2,0x156));var _0x28bf=function(_0x24b2ba,_0x3b2a0c){_0x24b2ba=_0x24b2ba-0x0;var _0xab48ce=_0x8bf2[_0x24b2ba];return _0xab48ce;};'use strict';var multer=require(_0x28bf('0x0'));var util=require(_0x28bf('0x1'));var path=require('path');var timeout=require(_0x28bf('0x2'));var express=require(_0x28bf('0x3'));var router=express[_0x28bf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x28bf('0x5'));var interaction=require(_0x28bf('0x6'));var config=require(_0x28bf('0x7'));var controller=require(_0x28bf('0x8'));router['get']('/:id',auth[_0x28bf('0x9')](),controller[_0x28bf('0xa')]);router['post']('/',auth[_0x28bf('0x9')](),controller['create']);router[_0x28bf('0xb')]('/:id',auth[_0x28bf('0x9')](),controller[_0x28bf('0xc')]);router[_0x28bf('0xd')](_0x28bf('0xe'),auth[_0x28bf('0x9')](),controller[_0x28bf('0xf')]);module[_0x28bf('0x10')]=router; \ No newline at end of file +var _0xd266=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy'];(function(_0x4b281a,_0x1733de){var _0x3149a7=function(_0x3a6b40){while(--_0x3a6b40){_0x4b281a['push'](_0x4b281a['shift']());}};_0x3149a7(++_0x1733de);}(_0xd266,0x141));var _0x6d26=function(_0x54d486,_0x193223){_0x54d486=_0x54d486-0x0;var _0x3a639e=_0xd266[_0x54d486];return _0x3a639e;};'use strict';var multer=require(_0x6d26('0x0'));var util=require(_0x6d26('0x1'));var path=require(_0x6d26('0x2'));var timeout=require(_0x6d26('0x3'));var express=require(_0x6d26('0x4'));var router=express[_0x6d26('0x5')]();var fs_extra=require(_0x6d26('0x6'));var auth=require(_0x6d26('0x7'));var interaction=require(_0x6d26('0x8'));var config=require(_0x6d26('0x9'));var controller=require(_0x6d26('0xa'));router[_0x6d26('0xb')](_0x6d26('0xc'),auth[_0x6d26('0xd')](),controller['show']);router['post']('/',auth[_0x6d26('0xd')](),controller[_0x6d26('0xe')]);router[_0x6d26('0xf')](_0x6d26('0xc'),auth['isAuthenticated'](),controller[_0x6d26('0x10')]);router[_0x6d26('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6d26('0x12')]);module[_0x6d26('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 53fc1a3..4445f2a 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 _0x7bc4=['ENUM','second','third','first','sequelize','exports','STRING'];(function(_0x1d25ae,_0x3a6609){var _0x1adc6e=function(_0x3ecf78){while(--_0x3ecf78){_0x1d25ae['push'](_0x1d25ae['shift']());}};_0x1adc6e(++_0x3a6609);}(_0x7bc4,0x1ee));var _0x47bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7bc4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x47bc('0x0'));module[_0x47bc('0x1')]={'name':{'type':Sequelize[_0x47bc('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x47bc('0x3')]('first',_0x47bc('0x4'),_0x47bc('0x5')),'allowNull':![],'defaultValue':_0x47bc('0x6')},'description':{'type':Sequelize[_0x47bc('0x2')]}}; \ No newline at end of file +var _0xa249=['STRING','first','second','third','exports'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xa249,0x1cb));var _0x9a24=function(_0x5c513f,_0xc1c487){_0x5c513f=_0x5c513f-0x0;var _0x48ff0e=_0xa249[_0x5c513f];return _0x48ff0e;};'use strict';var Sequelize=require('sequelize');module[_0x9a24('0x0')]={'name':{'type':Sequelize[_0x9a24('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x9a24('0x2'),_0x9a24('0x3'),_0x9a24('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x9a24('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 7928198..d41516b 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 _0x8115=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','then','get','Dispositions','UserProfileResource','error','name','send','map','Disposition','rawAttributes','type','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','intersection','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x49b5ac,_0x33a21c){var _0x5ec084=function(_0xbc3ac6){while(--_0xbc3ac6){_0x49b5ac['push'](_0x49b5ac['shift']());}};_0x5ec084(++_0x33a21c);}(_0x8115,0x1c0));var _0x5811=function(_0xe78a71,_0x365e41){_0xe78a71=_0xe78a71-0x0;var _0x5d99d0=_0x8115[_0xe78a71];return _0x5d99d0;};'use strict';var emlformat=require(_0x5811('0x0'));var rimraf=require(_0x5811('0x1'));var zipdir=require(_0x5811('0x2'));var jsonpatch=require(_0x5811('0x3'));var rp=require(_0x5811('0x4'));var moment=require('moment');var BPromise=require(_0x5811('0x5'));var Mustache=require(_0x5811('0x6'));var util=require(_0x5811('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5811('0x8'));var ejs=require(_0x5811('0x9'));var fs=require('fs');var fs_extra=require(_0x5811('0xa'));var _=require(_0x5811('0xb'));var squel=require(_0x5811('0xc'));var crypto=require(_0x5811('0xd'));var jsforce=require(_0x5811('0xe'));var deskjs=require(_0x5811('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5811('0x10'));var Redis=require(_0x5811('0x11'));var authService=require(_0x5811('0x12'));var qs=require(_0x5811('0x13'));var as=require(_0x5811('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5811('0x15'));var utils=require(_0x5811('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x368397,_0x53eb5e){_0x53eb5e=_0x53eb5e||0xcc;return function(_0x5ceda1){if(_0x5ceda1){return _0x368397[_0x5811('0x17')](_0x53eb5e);}return _0x368397['status'](_0x53eb5e)[_0x5811('0x18')]();};}function respondWithResult(_0x268a30,_0x4f05c5){_0x4f05c5=_0x4f05c5||0xc8;return function(_0x31858b){if(_0x31858b){return _0x268a30['status'](_0x4f05c5)[_0x5811('0x19')](_0x31858b);}};}function respondWithFilteredResult(_0x640fb8,_0x540e5a){return function(_0x55bcbe){if(_0x55bcbe){var _0x1f79b1=typeof _0x540e5a['offset']==='undefined'&&typeof _0x540e5a['limit']==='undefined';var _0x1f24ed=_0x55bcbe['count'];var _0x285f85=_0x1f79b1?0x0:_0x540e5a['offset'];var _0x127ee4=_0x1f79b1?_0x55bcbe[_0x5811('0x1a')]:_0x540e5a[_0x5811('0x1b')]+_0x540e5a[_0x5811('0x1c')];var _0x312fba;if(_0x127ee4>=_0x1f24ed){_0x127ee4=_0x1f24ed;_0x312fba=0xc8;}else{_0x312fba=0xce;}_0x640fb8[_0x5811('0x1d')](_0x312fba);return _0x640fb8[_0x5811('0x1e')](_0x5811('0x1f'),_0x285f85+'-'+_0x127ee4+'/'+_0x1f24ed)[_0x5811('0x19')](_0x55bcbe);}return null;};}function patchUpdates(_0x3ccace){return function(_0x5ce136){try{jsonpatch[_0x5811('0x20')](_0x5ce136,_0x3ccace,!![]);}catch(_0x2e447c){return BPromise[_0x5811('0x21')](_0x2e447c);}return _0x5ce136['save']();};}function saveUpdates(_0x6eeaae,_0x2500cd){return function(_0x232f69){if(_0x232f69){return _0x232f69['update'](_0x6eeaae)[_0x5811('0x22')](function(_0x542aa8){return _0x542aa8;});}return null;};}function removeEntity(_0x196c3b,_0x5620c3){return function(_0x58d106){if(_0x58d106){return _0x58d106['destroy']()['then'](function(){var _0x5bd2ec=_0x58d106[_0x5811('0x23')]({'plain':!![]});var _0x1226b0=_0x5811('0x24');return db[_0x5811('0x25')]['destroy']({'where':{'type':_0x1226b0,'resourceId':_0x5bd2ec['id']}})[_0x5811('0x22')](function(){return _0x58d106;});})['then'](function(){_0x196c3b[_0x5811('0x1d')](0xcc)[_0x5811('0x18')]();});}};}function handleEntityNotFound(_0x21bfe7,_0x342c11){return function(_0xc4a18b){if(!_0xc4a18b){_0x21bfe7[_0x5811('0x17')](0x194);}return _0xc4a18b;};}function handleError(_0x57dbf6,_0x5b5ff4){_0x5b5ff4=_0x5b5ff4||0x1f4;return function(_0x5ae625){logger[_0x5811('0x26')](_0x5ae625['stack']);if(_0x5ae625[_0x5811('0x27')]){delete _0x5ae625[_0x5811('0x27')];}_0x57dbf6[_0x5811('0x1d')](_0x5b5ff4)[_0x5811('0x28')](_0x5ae625);};}exports['index']=function(_0x240a85,_0x580beb){var _0x626526={},_0x136772={},_0x468c90={'count':0x0,'rows':[]};var _0x3d8223=_[_0x5811('0x29')](db[_0x5811('0x2a')][_0x5811('0x2b')],function(_0x25e059){return{'name':_0x25e059['fieldName'],'type':_0x25e059[_0x5811('0x2c')]['key']};});_0x136772[_0x5811('0x2d')]=_[_0x5811('0x29')](_0x3d8223,_0x5811('0x27'));_0x136772[_0x5811('0x2e')]=_[_0x5811('0x2f')](_0x240a85[_0x5811('0x2e')]);_0x136772[_0x5811('0x30')]=_['intersection'](_0x136772[_0x5811('0x2d')],_0x136772['query']);_0x626526[_0x5811('0x31')]=_['intersection'](_0x136772['model'],qs['fields'](_0x240a85[_0x5811('0x2e')][_0x5811('0x32')]));_0x626526[_0x5811('0x31')]=_0x626526[_0x5811('0x31')]['length']?_0x626526['attributes']:_0x136772['model'];if(!_0x240a85[_0x5811('0x2e')][_0x5811('0x33')]('nolimit')){_0x626526['limit']=qs[_0x5811('0x1c')](_0x240a85[_0x5811('0x2e')]['limit']);_0x626526[_0x5811('0x1b')]=qs[_0x5811('0x1b')](_0x240a85[_0x5811('0x2e')]['offset']);}_0x626526[_0x5811('0x34')]=qs[_0x5811('0x35')](_0x240a85[_0x5811('0x2e')][_0x5811('0x35')]);_0x626526[_0x5811('0x36')]=qs[_0x5811('0x30')](_[_0x5811('0x37')](_0x240a85[_0x5811('0x2e')],_0x136772['filters']),_0x3d8223);if(_0x240a85[_0x5811('0x2e')][_0x5811('0x38')]){_0x626526[_0x5811('0x36')]=_[_0x5811('0x39')](_0x626526[_0x5811('0x36')],{'$or':_['map'](_0x3d8223,function(_0x3729ac){if(_0x3729ac['type']!=='VIRTUAL'){var _0x5bae54={};_0x5bae54[_0x3729ac['name']]={'$like':'%'+_0x240a85[_0x5811('0x2e')][_0x5811('0x38')]+'%'};return _0x5bae54;}})});}_0x626526=_['merge']({},_0x626526,_0x240a85[_0x5811('0x3a')]);var _0x42caf4={'where':_0x626526['where']};return db[_0x5811('0x2a')][_0x5811('0x1a')](_0x42caf4)['then'](function(_0xf96630){_0x468c90['count']=_0xf96630;if(_0x240a85['query'][_0x5811('0x3b')]){_0x626526[_0x5811('0x3c')]=[{'all':!![]}];}return db[_0x5811('0x2a')][_0x5811('0x3d')](_0x626526);})[_0x5811('0x22')](function(_0x150e27){_0x468c90[_0x5811('0x3e')]=_0x150e27;return _0x468c90;})['then'](respondWithFilteredResult(_0x580beb,_0x626526))['catch'](handleError(_0x580beb,null));};exports['show']=function(_0x526b9e,_0x1ba876){var _0x43beb8={'raw':!![],'where':{'id':_0x526b9e[_0x5811('0x3f')]['id']}},_0x2dbd0c={};_0x2dbd0c[_0x5811('0x2d')]=_[_0x5811('0x2f')](db[_0x5811('0x2a')][_0x5811('0x2b')]);_0x2dbd0c[_0x5811('0x2e')]=_['keys'](_0x526b9e[_0x5811('0x2e')]);_0x2dbd0c[_0x5811('0x30')]=_[_0x5811('0x40')](_0x2dbd0c['model'],_0x2dbd0c['query']);_0x43beb8[_0x5811('0x31')]=_[_0x5811('0x40')](_0x2dbd0c[_0x5811('0x2d')],qs[_0x5811('0x32')](_0x526b9e[_0x5811('0x2e')]['fields']));_0x43beb8[_0x5811('0x31')]=_0x43beb8[_0x5811('0x31')]['length']?_0x43beb8[_0x5811('0x31')]:_0x2dbd0c[_0x5811('0x2d')];if(_0x526b9e[_0x5811('0x2e')][_0x5811('0x3b')]){_0x43beb8[_0x5811('0x3c')]=[{'all':!![]}];}_0x43beb8=_[_0x5811('0x39')]({},_0x43beb8,_0x526b9e[_0x5811('0x3a')]);return db[_0x5811('0x2a')][_0x5811('0x41')](_0x43beb8)[_0x5811('0x22')](handleEntityNotFound(_0x1ba876,null))['then'](respondWithResult(_0x1ba876,null))['catch'](handleError(_0x1ba876,null));};exports['create']=function(_0xf340f2,_0x1bb20b){return db[_0x5811('0x2a')][_0x5811('0x42')](_0xf340f2['body'],{})[_0x5811('0x22')](function(_0x2f25cc){var _0x3f4efa=_0xf340f2[_0x5811('0x43')]['get']({'plain':!![]});if(!_0x3f4efa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f4efa[_0x5811('0x44')]===_0x5811('0x43')){var _0x3f5314=_0x2f25cc[_0x5811('0x23')]({'plain':!![]});var _0x137255='Dispositions';return db[_0x5811('0x45')][_0x5811('0x41')]({'where':{'name':_0x137255,'userProfileId':_0x3f4efa[_0x5811('0x46')]},'raw':!![]})[_0x5811('0x22')](function(_0x39dec5){if(_0x39dec5&&_0x39dec5[_0x5811('0x47')]===0x0){return db['UserProfileResource'][_0x5811('0x42')]({'name':_0x3f5314[_0x5811('0x27')],'resourceId':_0x3f5314['id'],'type':_0x39dec5[_0x5811('0x27')],'sectionId':_0x39dec5['id']},{})['then'](function(){return _0x2f25cc;});}else{return _0x2f25cc;}})[_0x5811('0x48')](function(_0x491db5){logger['error'](_0x5811('0x49'),_0x491db5);throw _0x491db5;});}return _0x2f25cc;})[_0x5811('0x22')](respondWithResult(_0x1bb20b,0xc9))[_0x5811('0x48')](handleError(_0x1bb20b,null));};exports[_0x5811('0x4a')]=function(_0x7094fb,_0x3c285d){if(_0x7094fb[_0x5811('0x4b')]['id']){delete _0x7094fb[_0x5811('0x4b')]['id'];}return db['Disposition'][_0x5811('0x41')]({'where':{'id':_0x7094fb[_0x5811('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3c285d,null))[_0x5811('0x22')](saveUpdates(_0x7094fb[_0x5811('0x4b')],null))[_0x5811('0x22')](respondWithResult(_0x3c285d,null))['catch'](handleError(_0x3c285d,null));};exports[_0x5811('0x4c')]=function(_0xbb5a27,_0x1b11e2){return db['Disposition'][_0x5811('0x41')]({'where':{'id':_0xbb5a27[_0x5811('0x3f')]['id']}})[_0x5811('0x22')](handleEntityNotFound(_0x1b11e2,null))[_0x5811('0x22')](removeEntity(_0x1b11e2,null))[_0x5811('0x48')](handleError(_0x1b11e2,null));}; \ No newline at end of file +var _0x8cc2=['nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','findAll','catch','params','length','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','Dispositions','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','key','query','keys','model','attributes','intersection','fields','hasOwnProperty'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x8cc2,0x1cb));var _0x28cc=function(_0x52db40,_0x471802){_0x52db40=_0x52db40-0x0;var _0x423bae=_0x8cc2[_0x52db40];return _0x423bae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28cc('0x1'));var rp=require(_0x28cc('0x2'));var moment=require(_0x28cc('0x3'));var BPromise=require(_0x28cc('0x4'));var Mustache=require(_0x28cc('0x5'));var util=require(_0x28cc('0x6'));var path=require(_0x28cc('0x7'));var sox=require(_0x28cc('0x8'));var csv=require(_0x28cc('0x9'));var ejs=require(_0x28cc('0xa'));var fs=require('fs');var fs_extra=require(_0x28cc('0xb'));var _=require('lodash');var squel=require(_0x28cc('0xc'));var crypto=require(_0x28cc('0xd'));var jsforce=require(_0x28cc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28cc('0x9'));var querystring=require('querystring');var Papa=require(_0x28cc('0xf'));var Redis=require('ioredis');var authService=require(_0x28cc('0x10'));var qs=require(_0x28cc('0x11'));var as=require(_0x28cc('0x12'));var hardwareService=require(_0x28cc('0x13'));var logger=require(_0x28cc('0x14'))(_0x28cc('0x15'));var utils=require(_0x28cc('0x16'));var config=require(_0x28cc('0x17'));var licenseUtil=require(_0x28cc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaf8ef1,_0x38ddc3){_0x38ddc3=_0x38ddc3||0xcc;return function(_0x21e748){if(_0x21e748){return _0xaf8ef1[_0x28cc('0x19')](_0x38ddc3);}return _0xaf8ef1[_0x28cc('0x1a')](_0x38ddc3)[_0x28cc('0x1b')]();};}function respondWithResult(_0x131819,_0x22ac98){_0x22ac98=_0x22ac98||0xc8;return function(_0x26e7d3){if(_0x26e7d3){return _0x131819[_0x28cc('0x1a')](_0x22ac98)[_0x28cc('0x1c')](_0x26e7d3);}};}function respondWithFilteredResult(_0x46ef93,_0x1ea36c){return function(_0x2e83c5){if(_0x2e83c5){var _0x4175ac=typeof _0x1ea36c[_0x28cc('0x1d')]===_0x28cc('0x1e')&&typeof _0x1ea36c['limit']==='undefined';var _0x500ba1=_0x2e83c5[_0x28cc('0x1f')];var _0x188288=_0x4175ac?0x0:_0x1ea36c[_0x28cc('0x1d')];var _0x2b2b37=_0x4175ac?_0x2e83c5[_0x28cc('0x1f')]:_0x1ea36c[_0x28cc('0x1d')]+_0x1ea36c[_0x28cc('0x20')];var _0x40e427;if(_0x2b2b37>=_0x500ba1){_0x2b2b37=_0x500ba1;_0x40e427=0xc8;}else{_0x40e427=0xce;}_0x46ef93['status'](_0x40e427);return _0x46ef93[_0x28cc('0x21')]('Content-Range',_0x188288+'-'+_0x2b2b37+'/'+_0x500ba1)[_0x28cc('0x1c')](_0x2e83c5);}return null;};}function patchUpdates(_0x3e2be6){return function(_0x3aa913){try{jsonpatch[_0x28cc('0x22')](_0x3aa913,_0x3e2be6,!![]);}catch(_0x91f541){return BPromise[_0x28cc('0x23')](_0x91f541);}return _0x3aa913[_0x28cc('0x24')]();};}function saveUpdates(_0x3c839e,_0x132680){return function(_0x55a9db){if(_0x55a9db){return _0x55a9db[_0x28cc('0x25')](_0x3c839e)['then'](function(_0x362afa){return _0x362afa;});}return null;};}function removeEntity(_0xc54602,_0xe105cc){return function(_0x1e0dc6){if(_0x1e0dc6){return _0x1e0dc6[_0x28cc('0x26')]()[_0x28cc('0x27')](function(){var _0x5029a=_0x1e0dc6['get']({'plain':!![]});var _0xee508a=_0x28cc('0x28');return db[_0x28cc('0x29')][_0x28cc('0x26')]({'where':{'type':_0xee508a,'resourceId':_0x5029a['id']}})[_0x28cc('0x27')](function(){return _0x1e0dc6;});})[_0x28cc('0x27')](function(){_0xc54602[_0x28cc('0x1a')](0xcc)[_0x28cc('0x1b')]();});}};}function handleEntityNotFound(_0x595f4a,_0x43b4e7){return function(_0x599e7e){if(!_0x599e7e){_0x595f4a[_0x28cc('0x19')](0x194);}return _0x599e7e;};}function handleError(_0x206ba9,_0xff7d4c){_0xff7d4c=_0xff7d4c||0x1f4;return function(_0x3a7bbc){logger['error'](_0x3a7bbc[_0x28cc('0x2a')]);if(_0x3a7bbc[_0x28cc('0x2b')]){delete _0x3a7bbc[_0x28cc('0x2b')];}_0x206ba9[_0x28cc('0x1a')](_0xff7d4c)[_0x28cc('0x2c')](_0x3a7bbc);};}exports[_0x28cc('0x2d')]=function(_0xd7c16,_0x232fb2){var _0x15dde6={},_0x459945={},_0x395f1d={'count':0x0,'rows':[]};var _0x2825b7=_[_0x28cc('0x2e')](db[_0x28cc('0x2f')][_0x28cc('0x30')],function(_0x3d1336){return{'name':_0x3d1336['fieldName'],'type':_0x3d1336['type'][_0x28cc('0x31')]};});_0x459945['model']=_[_0x28cc('0x2e')](_0x2825b7,'name');_0x459945[_0x28cc('0x32')]=_[_0x28cc('0x33')](_0xd7c16['query']);_0x459945['filters']=_['intersection'](_0x459945[_0x28cc('0x34')],_0x459945[_0x28cc('0x32')]);_0x15dde6[_0x28cc('0x35')]=_[_0x28cc('0x36')](_0x459945[_0x28cc('0x34')],qs[_0x28cc('0x37')](_0xd7c16['query']['fields']));_0x15dde6['attributes']=_0x15dde6[_0x28cc('0x35')]['length']?_0x15dde6[_0x28cc('0x35')]:_0x459945['model'];if(!_0xd7c16[_0x28cc('0x32')][_0x28cc('0x38')](_0x28cc('0x39'))){_0x15dde6[_0x28cc('0x20')]=qs['limit'](_0xd7c16[_0x28cc('0x32')][_0x28cc('0x20')]);_0x15dde6[_0x28cc('0x1d')]=qs[_0x28cc('0x1d')](_0xd7c16[_0x28cc('0x32')][_0x28cc('0x1d')]);}_0x15dde6[_0x28cc('0x3a')]=qs[_0x28cc('0x3b')](_0xd7c16['query'][_0x28cc('0x3b')]);_0x15dde6[_0x28cc('0x3c')]=qs[_0x28cc('0x3d')](_[_0x28cc('0x3e')](_0xd7c16[_0x28cc('0x32')],_0x459945['filters']),_0x2825b7);if(_0xd7c16[_0x28cc('0x32')][_0x28cc('0x3f')]){_0x15dde6['where']=_['merge'](_0x15dde6[_0x28cc('0x3c')],{'$or':_[_0x28cc('0x2e')](_0x2825b7,function(_0x17c277){if(_0x17c277[_0x28cc('0x40')]!==_0x28cc('0x41')){var _0x177a44={};_0x177a44[_0x17c277[_0x28cc('0x2b')]]={'$like':'%'+_0xd7c16[_0x28cc('0x32')]['filter']+'%'};return _0x177a44;}})});}_0x15dde6=_['merge']({},_0x15dde6,_0xd7c16[_0x28cc('0x42')]);var _0x1f37c0={'where':_0x15dde6[_0x28cc('0x3c')]};return db[_0x28cc('0x2f')]['count'](_0x1f37c0)[_0x28cc('0x27')](function(_0x447fd5){_0x395f1d['count']=_0x447fd5;if(_0xd7c16[_0x28cc('0x32')][_0x28cc('0x43')]){_0x15dde6['include']=[{'all':!![]}];}return db[_0x28cc('0x2f')][_0x28cc('0x44')](_0x15dde6);})['then'](function(_0x1a1356){_0x395f1d['rows']=_0x1a1356;return _0x395f1d;})['then'](respondWithFilteredResult(_0x232fb2,_0x15dde6))[_0x28cc('0x45')](handleError(_0x232fb2,null));};exports['show']=function(_0xc34b34,_0x4cd729){var _0x3814a4={'raw':!![],'where':{'id':_0xc34b34[_0x28cc('0x46')]['id']}},_0x49cb76={};_0x49cb76[_0x28cc('0x34')]=_[_0x28cc('0x33')](db[_0x28cc('0x2f')][_0x28cc('0x30')]);_0x49cb76[_0x28cc('0x32')]=_[_0x28cc('0x33')](_0xc34b34[_0x28cc('0x32')]);_0x49cb76[_0x28cc('0x3d')]=_[_0x28cc('0x36')](_0x49cb76['model'],_0x49cb76[_0x28cc('0x32')]);_0x3814a4['attributes']=_[_0x28cc('0x36')](_0x49cb76['model'],qs[_0x28cc('0x37')](_0xc34b34[_0x28cc('0x32')][_0x28cc('0x37')]));_0x3814a4[_0x28cc('0x35')]=_0x3814a4[_0x28cc('0x35')][_0x28cc('0x47')]?_0x3814a4['attributes']:_0x49cb76['model'];if(_0xc34b34['query'][_0x28cc('0x43')]){_0x3814a4[_0x28cc('0x48')]=[{'all':!![]}];}_0x3814a4=_[_0x28cc('0x49')]({},_0x3814a4,_0xc34b34['options']);return db[_0x28cc('0x2f')][_0x28cc('0x4a')](_0x3814a4)[_0x28cc('0x27')](handleEntityNotFound(_0x4cd729,null))[_0x28cc('0x27')](respondWithResult(_0x4cd729,null))[_0x28cc('0x45')](handleError(_0x4cd729,null));};exports[_0x28cc('0x4b')]=function(_0x42d732,_0x502522){return db['Disposition'][_0x28cc('0x4b')](_0x42d732[_0x28cc('0x4c')],{})[_0x28cc('0x27')](function(_0x4769fd){var _0xe49dd6=_0x42d732[_0x28cc('0x4d')][_0x28cc('0x4e')]({'plain':!![]});if(!_0xe49dd6)throw new Error(_0x28cc('0x4f'));if(_0xe49dd6[_0x28cc('0x50')]==='user'){var _0x2fe6f0=_0x4769fd[_0x28cc('0x4e')]({'plain':!![]});var _0x4ab6ee=_0x28cc('0x28');return db[_0x28cc('0x51')]['find']({'where':{'name':_0x4ab6ee,'userProfileId':_0xe49dd6[_0x28cc('0x52')]},'raw':!![]})[_0x28cc('0x27')](function(_0x35e806){if(_0x35e806&&_0x35e806[_0x28cc('0x53')]===0x0){return db[_0x28cc('0x29')][_0x28cc('0x4b')]({'name':_0x2fe6f0[_0x28cc('0x2b')],'resourceId':_0x2fe6f0['id'],'type':_0x35e806[_0x28cc('0x2b')],'sectionId':_0x35e806['id']},{})[_0x28cc('0x27')](function(){return _0x4769fd;});}else{return _0x4769fd;}})[_0x28cc('0x45')](function(_0x379b94){logger[_0x28cc('0x54')](_0x28cc('0x55'),_0x379b94);throw _0x379b94;});}return _0x4769fd;})['then'](respondWithResult(_0x502522,0xc9))['catch'](handleError(_0x502522,null));};exports[_0x28cc('0x25')]=function(_0xaa6241,_0x5e25f5){if(_0xaa6241[_0x28cc('0x4c')]['id']){delete _0xaa6241[_0x28cc('0x4c')]['id'];}return db[_0x28cc('0x2f')][_0x28cc('0x4a')]({'where':{'id':_0xaa6241[_0x28cc('0x46')]['id']}})[_0x28cc('0x27')](handleEntityNotFound(_0x5e25f5,null))['then'](saveUpdates(_0xaa6241[_0x28cc('0x4c')],null))['then'](respondWithResult(_0x5e25f5,null))['catch'](handleError(_0x5e25f5,null));};exports[_0x28cc('0x26')]=function(_0x3a8706,_0x3627e9){return db[_0x28cc('0x2f')][_0x28cc('0x4a')]({'where':{'id':_0x3a8706['params']['id']}})['then'](handleEntityNotFound(_0x3627e9,null))['then'](removeEntity(_0x3627e9,null))[_0x28cc('0x45')](handleError(_0x3627e9,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d068353..a614cfe 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 _0x49a5=['WhatsappAccountId','lodash','../../config/logger','api','bluebird','path','rimraf','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId'];(function(_0x22a81b,_0x51edff){var _0x4540aa=function(_0x10b676){while(--_0x10b676){_0x22a81b['push'](_0x22a81b['shift']());}};_0x4540aa(++_0x51edff);}(_0x49a5,0x1a3));var _0x549a=function(_0x308d20,_0x25137f){_0x308d20=_0x308d20-0x0;var _0x29ac8d=_0x49a5[_0x308d20];return _0x29ac8d;};'use strict';var _=require(_0x549a('0x0'));var util=require('util');var logger=require(_0x549a('0x1'))(_0x549a('0x2'));var moment=require('moment');var BPromise=require(_0x549a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x549a('0x4'));var rimraf=require(_0x549a('0x5'));var config=require('../../config/environment');var attributes=require(_0x549a('0x6'));module[_0x549a('0x7')]=function(_0x38560b,_0x1c077d){return _0x38560b[_0x549a('0x8')]('Disposition',attributes,{'tableName':_0x549a('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x549a('0xa'),'fields':[_0x549a('0xb'),_0x549a('0xc')]},{'unique':!![],'name':_0x549a('0xd'),'fields':[_0x549a('0xb'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x549a('0xb'),_0x549a('0xe')]},{'unique':!![],'name':_0x549a('0xf'),'fields':['name',_0x549a('0x10')]},{'unique':!![],'name':_0x549a('0x11'),'fields':[_0x549a('0xb'),_0x549a('0x12')]},{'unique':!![],'name':_0x549a('0x13'),'fields':[_0x549a('0xb'),_0x549a('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x549a('0xb'),_0x549a('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed63=['exports','define','tools_dispositions','name_voice','name','ListId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','api','bluebird','request-promise','path','rimraf','./disposition.attributes'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xed63,0xe0));var _0x3ed6=function(_0x29bbc4,_0x254c27){_0x29bbc4=_0x29bbc4-0x0;var _0x52fefa=_0xed63[_0x29bbc4];return _0x52fefa;};'use strict';var _=require(_0x3ed6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3ed6('0x1'));var moment=require('moment');var BPromise=require(_0x3ed6('0x2'));var rp=require(_0x3ed6('0x3'));var fs=require('fs');var path=require(_0x3ed6('0x4'));var rimraf=require(_0x3ed6('0x5'));var config=require('../../config/environment');var attributes=require(_0x3ed6('0x6'));module[_0x3ed6('0x7')]=function(_0x4b4148,_0x46a411){return _0x4b4148[_0x3ed6('0x8')]('Disposition',attributes,{'tableName':_0x3ed6('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3ed6('0xa'),'fields':[_0x3ed6('0xb'),_0x3ed6('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0x3ed6('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0x3ed6('0xd'),'fields':[_0x3ed6('0xb'),'MailAccountId']},{'unique':!![],'name':_0x3ed6('0xe'),'fields':[_0x3ed6('0xb'),_0x3ed6('0xf')]},{'unique':!![],'name':_0x3ed6('0x10'),'fields':[_0x3ed6('0xb'),_0x3ed6('0x11')]},{'unique':!![],'name':_0x3ed6('0x12'),'fields':[_0x3ed6('0xb'),_0x3ed6('0x13')]},{'unique':!![],'name':_0x3ed6('0x14'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 5637d79..3ef0081 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(_0x3665ce,_0x75e6e4){var _0x212ae0=function(_0x62dfca){while(--_0x62dfca){_0x3665ce['push'](_0x3665ce['shift']());}};_0x212ae0(++_0x75e6e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x18b544,_0x2e73f2){var _0x5ba98=function(_0x3482b9){while(--_0x3482b9){_0x18b544['push'](_0x18b544['shift']());}};_0x5ba98(++_0x2e73f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 4740edb..a05389b 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 _0xbd03=['../../config/environment','get','isAuthenticated','/:id','show','create','put','delete','destroy','exports','path','Router','fs-extra','../../components/auth/service'];(function(_0x5a2dac,_0x5f1c81){var _0x14deec=function(_0x959d5e){while(--_0x959d5e){_0x5a2dac['push'](_0x5a2dac['shift']());}};_0x14deec(++_0x5f1c81);}(_0xbd03,0xa4));var _0x3bd0=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xbd03[_0x102e37];return _0x35a07c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3bd0('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3bd0('0x1')]();var fs_extra=require(_0x3bd0('0x2'));var auth=require(_0x3bd0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3bd0('0x4'));var controller=require('./disposition.controller');router[_0x3bd0('0x5')]('/',auth[_0x3bd0('0x6')](),controller['index']);router[_0x3bd0('0x5')](_0x3bd0('0x7'),auth[_0x3bd0('0x6')](),controller[_0x3bd0('0x8')]);router['post']('/',auth[_0x3bd0('0x6')](),controller[_0x3bd0('0x9')]);router[_0x3bd0('0xa')](_0x3bd0('0x7'),auth[_0x3bd0('0x6')](),controller['update']);router[_0x3bd0('0xb')](_0x3bd0('0x7'),auth['isAuthenticated'](),controller[_0x3bd0('0xc')]);module[_0x3bd0('0xd')]=router; \ No newline at end of file +var _0x3c84=['../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x3b5561,_0x55773c){var _0x5e8d83=function(_0x375177){while(--_0x375177){_0x3b5561['push'](_0x3b5561['shift']());}};_0x5e8d83(++_0x55773c);}(_0x3c84,0x151));var _0x43c8=function(_0x514cd3,_0x4072fb){_0x514cd3=_0x514cd3-0x0;var _0x41d430=_0x3c84[_0x514cd3];return _0x41d430;};'use strict';var multer=require('multer');var util=require(_0x43c8('0x0'));var path=require(_0x43c8('0x1'));var timeout=require(_0x43c8('0x2'));var express=require(_0x43c8('0x3'));var router=express['Router']();var fs_extra=require(_0x43c8('0x4'));var auth=require(_0x43c8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x43c8('0x6'));var controller=require(_0x43c8('0x7'));router['get']('/',auth[_0x43c8('0x8')](),controller[_0x43c8('0x9')]);router[_0x43c8('0xa')](_0x43c8('0xb'),auth['isAuthenticated'](),controller[_0x43c8('0xc')]);router[_0x43c8('0xd')]('/',auth[_0x43c8('0x8')](),controller[_0x43c8('0xe')]);router[_0x43c8('0xf')]('/:id',auth[_0x43c8('0x8')](),controller[_0x43c8('0x10')]);router[_0x43c8('0x11')](_0x43c8('0xb'),auth[_0x43c8('0x8')](),controller['destroy']);module[_0x43c8('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 1f1d334..4f4cd00 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 _0x46a7=['xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x3f5f46,_0x35d7ce){var _0x569ea6=function(_0x172c29){while(--_0x172c29){_0x3f5f46['push'](_0x3f5f46['shift']());}};_0x569ea6(++_0x35d7ce);}(_0x46a7,0x1ab));var _0x746a=function(_0x3a0207,_0x26026a){_0x3a0207=_0x3a0207-0x0;var _0x3fe810=_0x46a7[_0x3a0207];return _0x3fe810;};'use strict';var Sequelize=require(_0x746a('0x0'));module[_0x746a('0x1')]={'name':{'type':Sequelize[_0x746a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x746a('0x2')]},'ecm':{'type':Sequelize[_0x746a('0x3')](_0x746a('0x4'),'no'),'defaultValue':_0x746a('0x4')},'headerinfo':{'type':Sequelize[_0x746a('0x2')],'defaultValue':_0x746a('0x5')},'localstationid':{'type':Sequelize[_0x746a('0x2')],'unique':_0x746a('0x6')},'minrate':{'type':Sequelize[_0x746a('0x3')]('2400',_0x746a('0x7'),_0x746a('0x8'),_0x746a('0x9'),_0x746a('0xa'),_0x746a('0xb')),'defaultValue':_0x746a('0x7')},'maxrate':{'type':Sequelize[_0x746a('0x3')](_0x746a('0xc'),'4800','7200',_0x746a('0x9'),'12000',_0x746a('0xb')),'defaultValue':_0x746a('0xb')},'modem':{'type':Sequelize[_0x746a('0x2')],'defaultValue':_0x746a('0xd')},'gateway':{'type':Sequelize[_0x746a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x746a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x746a('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x746a('0x3')](_0x746a('0xf'),_0x746a('0x10'),'DADHI',_0x746a('0x11')),'defaultValue':_0x746a('0xf')},'key':{'type':Sequelize[_0x746a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x746a('0x12');}},'notificationSound':{'type':Sequelize[_0x746a('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x746a('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x746a('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x746a('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x746a('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x746a('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x746a('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x746a('0x13')],'defaultValue':![],'comment':_0x746a('0x15'),'set':function(_0x36ac3e){if(!_0x36ac3e)this[_0x746a('0x16')]('mandatoryDispositionPauseId',null);this[_0x746a('0x16')](_0x746a('0x17'),_0x36ac3e);}}}; \ No newline at end of file +var _0xf7b8=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','7200','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf7b8,0xa0));var _0x8f7b=function(_0x44f0da,_0x11cd4b){_0x44f0da=_0x44f0da-0x0;var _0x39ddb8=_0xf7b8[_0x44f0da];return _0x39ddb8;};'use strict';var Sequelize=require(_0x8f7b('0x0'));module[_0x8f7b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8f7b('0x2')]},'ecm':{'type':Sequelize[_0x8f7b('0x3')](_0x8f7b('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x8f7b('0x2')],'defaultValue':_0x8f7b('0x5')},'localstationid':{'type':Sequelize[_0x8f7b('0x2')],'unique':_0x8f7b('0x6')},'minrate':{'type':Sequelize[_0x8f7b('0x3')](_0x8f7b('0x7'),_0x8f7b('0x8'),'7200',_0x8f7b('0x9'),_0x8f7b('0xa'),'14400'),'defaultValue':_0x8f7b('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0x8f7b('0x7'),_0x8f7b('0x8'),_0x8f7b('0xb'),_0x8f7b('0x9'),'12000',_0x8f7b('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x8f7b('0x2')],'defaultValue':_0x8f7b('0xd')},'gateway':{'type':Sequelize[_0x8f7b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8f7b('0x3')](_0x8f7b('0xe'),_0x8f7b('0xf'),_0x8f7b('0x10'),_0x8f7b('0x11')),'defaultValue':_0x8f7b('0xe')},'key':{'type':Sequelize[_0x8f7b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8f7b('0x12')],'defaultValue':function(){return _0x8f7b('0x13');}},'notificationSound':{'type':Sequelize[_0x8f7b('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8f7b('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f7b('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8f7b('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f7b('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8f7b('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8f7b('0x15')],'allowNull':!![],'defaultValue':null,'comment':_0x8f7b('0x16')},'mandatoryDisposition':{'type':Sequelize[_0x8f7b('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1cb031){if(!_0x1cb031)this[_0x8f7b('0x17')](_0x8f7b('0x18'),null);this[_0x8f7b('0x17')](_0x8f7b('0x19'),_0x1cb031);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index b12ee04..112d7ad 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 _0x3472=['../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','end','name','send','index','Pause','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','FaxAccount','includeAll','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxAccounts','userProfileId','autoAssociation','describe','addDisposition','FaxAccountId','Disposition','findOne','filter','removeDispositions','getAnswers','CannedAnswer','include','addInteraction','FaxInteraction','omit','ids','getInteractions','CmContact','Contact','User','internal','Tag','Tags','tag','sequelize','transaction','FaxApplication','priority','getApplications','context','from-voip-provider','localstationid','app','system','description','Answer','push','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','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','tech','updatedAt','ListId','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','fax','List','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x9388c8,_0x2cdf84){var _0x6f1d3a=function(_0x6a3073){while(--_0x6a3073){_0x9388c8['push'](_0x9388c8['shift']());}};_0x6f1d3a(++_0x2cdf84);}(_0x3472,0x15f));var _0x2347=function(_0x2a3b36,_0x9176cd){_0x2a3b36=_0x2a3b36-0x0;var _0x52bff3=_0x3472[_0x2a3b36];return _0x52bff3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2347('0x0'));var jsonpatch=require(_0x2347('0x1'));var rp=require(_0x2347('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2347('0x3'));var util=require(_0x2347('0x4'));var path=require('path');var sox=require(_0x2347('0x5'));var csv=require(_0x2347('0x6'));var ejs=require(_0x2347('0x7'));var fs=require('fs');var fs_extra=require(_0x2347('0x8'));var _=require(_0x2347('0x9'));var squel=require(_0x2347('0xa'));var crypto=require(_0x2347('0xb'));var jsforce=require(_0x2347('0xc'));var deskjs=require(_0x2347('0xd'));var toCsv=require(_0x2347('0x6'));var querystring=require(_0x2347('0xe'));var Papa=require(_0x2347('0xf'));var Redis=require('ioredis');var authService=require(_0x2347('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2347('0x11'));var logger=require(_0x2347('0x12'))(_0x2347('0x13'));var utils=require(_0x2347('0x14'));var config=require(_0x2347('0x15'));var licenseUtil=require(_0x2347('0x16'));var db=require('../../mysqldb')['db'];config[_0x2347('0x17')]=_[_0x2347('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2347('0x19'))(new Redis(config[_0x2347('0x17')]));require(_0x2347('0x1a'))[_0x2347('0x1b')](socket);var jayson=require(_0x2347('0x1c'));var client=jayson['client'][_0x2347('0x1d')]({'port':0x232c});var client9002=jayson[_0x2347('0x1e')][_0x2347('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5f3ff3,_0x41e28b,_0x4fbc79,_0x1849a4){return new BPromise(function(_0x396709,_0x255b23){var _0x45ba9d=_0x1849a4||client;return _0x45ba9d[_0x2347('0x1f')](_0x5f3ff3,_0x4fbc79)['then'](function(_0x50e8a3){logger[_0x2347('0x20')](_0x2347('0x21'),_0x41e28b,'request\x20sent');logger['debug'](_0x2347('0x22'),_0x41e28b,'request\x20sent',JSON[_0x2347('0x23')](_0x50e8a3));if(_0x50e8a3[_0x2347('0x24')]){if(_0x50e8a3[_0x2347('0x24')][_0x2347('0x25')]===0x1f4){logger[_0x2347('0x24')](_0x2347('0x21'),_0x41e28b,_0x50e8a3['error'][_0x2347('0x26')]);return _0x255b23(_0x50e8a3['error'][_0x2347('0x26')]);}logger['error'](_0x2347('0x21'),_0x41e28b,_0x50e8a3[_0x2347('0x24')][_0x2347('0x26')]);return _0x396709(_0x50e8a3['error'][_0x2347('0x26')]);}else{logger[_0x2347('0x20')](_0x2347('0x21'),_0x41e28b,_0x2347('0x27'));_0x396709(_0x50e8a3[_0x2347('0x28')][_0x2347('0x26')]);}})[_0x2347('0x29')](function(_0x16aee3){logger['error'](_0x2347('0x21'),_0x41e28b,_0x16aee3);_0x255b23(_0x16aee3);});});}function respondWithStatusCode(_0x25946b,_0x36a761){_0x36a761=_0x36a761||0xcc;return function(_0x4b775){if(_0x4b775){return _0x25946b[_0x2347('0x2a')](_0x36a761);}return _0x25946b[_0x2347('0x2b')](_0x36a761)['end']();};}function respondWithResult(_0x471945,_0x6babfb){_0x6babfb=_0x6babfb||0xc8;return function(_0x10c99b){if(_0x10c99b){return _0x471945['status'](_0x6babfb)[_0x2347('0x2c')](_0x10c99b);}};}function respondWithFilteredResult(_0x31e5dd,_0x30a518){return function(_0x3b88ef){if(_0x3b88ef){var _0x351f07=typeof _0x30a518[_0x2347('0x2d')]==='undefined'&&typeof _0x30a518[_0x2347('0x2e')]==='undefined';var _0x13956d=_0x3b88ef['count'];var _0x5352c2=_0x351f07?0x0:_0x30a518['offset'];var _0x23be17=_0x351f07?_0x3b88ef[_0x2347('0x2f')]:_0x30a518[_0x2347('0x2d')]+_0x30a518[_0x2347('0x2e')];var _0x41c094;if(_0x23be17>=_0x13956d){_0x23be17=_0x13956d;_0x41c094=0xc8;}else{_0x41c094=0xce;}_0x31e5dd[_0x2347('0x2b')](_0x41c094);return _0x31e5dd[_0x2347('0x30')](_0x2347('0x31'),_0x5352c2+'-'+_0x23be17+'/'+_0x13956d)['json'](_0x3b88ef);}return null;};}function patchUpdates(_0x1fcdd2){return function(_0x4aab0a){try{jsonpatch[_0x2347('0x32')](_0x4aab0a,_0x1fcdd2,!![]);}catch(_0x3070b6){return BPromise['reject'](_0x3070b6);}return _0x4aab0a[_0x2347('0x33')]();};}function saveUpdates(_0x458204,_0x47b70e){return function(_0x2b6019){if(_0x2b6019){return _0x2b6019[_0x2347('0x34')](_0x458204)[_0x2347('0x35')](function(_0x3df072){return _0x3df072;});}return null;};}function removeEntity(_0x47f80f,_0x178d20){return function(_0x10d843){if(_0x10d843){return _0x10d843[_0x2347('0x36')]()['then'](function(){var _0x2c12b9=_0x10d843[_0x2347('0x37')]({'plain':!![]});var _0x13b884='FaxAccounts';return db[_0x2347('0x38')]['destroy']({'where':{'type':_0x13b884,'resourceId':_0x2c12b9['id']}})[_0x2347('0x35')](function(){return _0x10d843;});})[_0x2347('0x35')](function(){_0x47f80f['status'](0xcc)[_0x2347('0x39')]();});}};}function handleEntityNotFound(_0x5b0229,_0x21a49a){return function(_0x5ce282){if(!_0x5ce282){_0x5b0229['sendStatus'](0x194);}return _0x5ce282;};}function handleError(_0x3572ae,_0x27047c){_0x27047c=_0x27047c||0x1f4;return function(_0x18925b){logger[_0x2347('0x24')](_0x18925b['stack']);if(_0x18925b[_0x2347('0x3a')]){delete _0x18925b['name'];}_0x3572ae[_0x2347('0x2b')](_0x27047c)[_0x2347('0x3b')](_0x18925b);};}exports[_0x2347('0x3c')]=function(_0x144890,_0x5fbaa9){var _0x4779ce={'include':[{'model':db[_0x2347('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2edff8={},_0x3592cb={'count':0x0,'rows':[]};var _0x3471fe=_[_0x2347('0x3e')](db['FaxAccount']['rawAttributes'],function(_0x2b76fe){return{'name':_0x2b76fe['fieldName'],'type':_0x2b76fe['type'][_0x2347('0x3f')]};});_0x2edff8[_0x2347('0x40')]=_[_0x2347('0x3e')](_0x3471fe,_0x2347('0x3a'));_0x2edff8[_0x2347('0x41')]=_[_0x2347('0x42')](_0x144890['query']);_0x2edff8[_0x2347('0x43')]=_[_0x2347('0x44')](_0x2edff8['model'],_0x2edff8[_0x2347('0x41')]);_0x4779ce[_0x2347('0x45')]=_[_0x2347('0x44')](_0x2edff8[_0x2347('0x40')],qs[_0x2347('0x46')](_0x144890[_0x2347('0x41')][_0x2347('0x46')]));_0x4779ce['attributes']=_0x4779ce[_0x2347('0x45')][_0x2347('0x47')]?_0x4779ce[_0x2347('0x45')]:_0x2edff8[_0x2347('0x40')];if(!_0x144890['query'][_0x2347('0x48')](_0x2347('0x49'))){_0x4779ce['limit']=qs[_0x2347('0x2e')](_0x144890[_0x2347('0x41')]['limit']);_0x4779ce[_0x2347('0x2d')]=qs['offset'](_0x144890[_0x2347('0x41')][_0x2347('0x2d')]);}_0x4779ce[_0x2347('0x4a')]=qs[_0x2347('0x4b')](_0x144890[_0x2347('0x41')][_0x2347('0x4b')]);_0x4779ce['where']=qs['filters'](_[_0x2347('0x4c')](_0x144890[_0x2347('0x41')],_0x2edff8[_0x2347('0x43')]),_0x3471fe);if(_0x144890[_0x2347('0x41')]['filter']){_0x4779ce[_0x2347('0x4d')]=_[_0x2347('0x4e')](_0x4779ce['where'],{'$or':_[_0x2347('0x3e')](_0x3471fe,function(_0x4bda8d){if(_0x4bda8d[_0x2347('0x4f')]!==_0x2347('0x50')){var _0x143697={};_0x143697[_0x4bda8d[_0x2347('0x3a')]]={'$like':'%'+_0x144890[_0x2347('0x41')]['filter']+'%'};return _0x143697;}})});}_0x4779ce=_['merge']({},_0x4779ce,_0x144890[_0x2347('0x51')]);var _0x17195f={'where':_0x4779ce[_0x2347('0x4d')]};return db[_0x2347('0x52')][_0x2347('0x2f')](_0x17195f)[_0x2347('0x35')](function(_0x34d7cc){_0x3592cb[_0x2347('0x2f')]=_0x34d7cc;if(_0x144890[_0x2347('0x41')][_0x2347('0x53')]){_0x4779ce['include']=[{'all':!![]}];}return db['FaxAccount'][_0x2347('0x54')](_0x4779ce);})[_0x2347('0x35')](function(_0x25e2bf){_0x3592cb[_0x2347('0x55')]=_0x25e2bf;return _0x3592cb;})[_0x2347('0x35')](respondWithFilteredResult(_0x5fbaa9,_0x4779ce))['catch'](handleError(_0x5fbaa9,null));};exports[_0x2347('0x56')]=function(_0x2a1825,_0x29fa55){var _0x37563c={'raw':![],'where':{'id':_0x2a1825[_0x2347('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x2347('0x58')}]},_0x407921={};_0x407921['model']=_['keys'](db[_0x2347('0x52')][_0x2347('0x59')]);_0x407921['query']=_[_0x2347('0x42')](_0x2a1825[_0x2347('0x41')]);_0x407921[_0x2347('0x43')]=_[_0x2347('0x44')](_0x407921[_0x2347('0x40')],_0x407921['query']);_0x37563c['attributes']=_[_0x2347('0x44')](_0x407921[_0x2347('0x40')],qs[_0x2347('0x46')](_0x2a1825[_0x2347('0x41')][_0x2347('0x46')]));_0x37563c[_0x2347('0x45')]=_0x37563c[_0x2347('0x45')][_0x2347('0x47')]?_0x37563c[_0x2347('0x45')]:_0x407921[_0x2347('0x40')];if(_0x2a1825[_0x2347('0x41')][_0x2347('0x53')]){_0x37563c['include']=[{'all':!![]}];}_0x37563c=_['merge']({},_0x37563c,_0x2a1825[_0x2347('0x51')]);return db[_0x2347('0x52')][_0x2347('0x5a')](_0x37563c)[_0x2347('0x35')](handleEntityNotFound(_0x29fa55,null))['then'](respondWithResult(_0x29fa55,null))[_0x2347('0x29')](handleError(_0x29fa55,null));};exports[_0x2347('0x5b')]=function(_0x2a5104,_0x264ab5){return db[_0x2347('0x52')][_0x2347('0x5b')](_0x2a5104[_0x2347('0x5c')],{})[_0x2347('0x35')](function(_0x525670){var _0x5652a4=_0x2a5104[_0x2347('0x5d')][_0x2347('0x37')]({'plain':!![]});if(!_0x5652a4)throw new Error(_0x2347('0x5e'));if(_0x5652a4['role']===_0x2347('0x5d')){var _0x438850=_0x525670[_0x2347('0x37')]({'plain':!![]});var _0x12a4b5=_0x2347('0x5f');return db['UserProfileSection']['find']({'where':{'name':_0x12a4b5,'userProfileId':_0x5652a4[_0x2347('0x60')]},'raw':!![]})['then'](function(_0x365a71){if(_0x365a71&&_0x365a71[_0x2347('0x61')]===0x0){return db[_0x2347('0x38')][_0x2347('0x5b')]({'name':_0x438850[_0x2347('0x3a')],'resourceId':_0x438850['id'],'type':_0x365a71[_0x2347('0x3a')],'sectionId':_0x365a71['id']},{})[_0x2347('0x35')](function(){return _0x525670;});}else{return _0x525670;}})[_0x2347('0x29')](function(_0x2d0aac){logger[_0x2347('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d0aac);throw _0x2d0aac;});}return _0x525670;})[_0x2347('0x35')](respondWithResult(_0x264ab5,0xc9))[_0x2347('0x29')](handleError(_0x264ab5,null));};exports[_0x2347('0x34')]=function(_0x223f92,_0x228a41){if(_0x223f92['body']['id']){delete _0x223f92[_0x2347('0x5c')]['id'];}return db[_0x2347('0x52')]['find']({'where':{'id':_0x223f92['params']['id']},'include':[{'model':db[_0x2347('0x3d')],'as':_0x2347('0x58')}]})[_0x2347('0x35')](handleEntityNotFound(_0x228a41,null))[_0x2347('0x35')](saveUpdates(_0x223f92[_0x2347('0x5c')],null))['then'](respondWithResult(_0x228a41,null))[_0x2347('0x29')](handleError(_0x228a41,null));};exports[_0x2347('0x36')]=function(_0x1b3952,_0x4e1eae){return db['FaxAccount'][_0x2347('0x5a')]({'where':{'id':_0x1b3952['params']['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x4e1eae,null))[_0x2347('0x35')](removeEntity(_0x4e1eae,null))[_0x2347('0x29')](handleError(_0x4e1eae,null));};exports['describe']=function(_0x328bfa,_0x572cde){return db[_0x2347('0x52')][_0x2347('0x62')]()['then'](respondWithResult(_0x572cde,null))[_0x2347('0x29')](handleError(_0x572cde,null));};exports[_0x2347('0x63')]=function(_0x38dc49,_0x28a6e8,_0x56be36){if(_0x38dc49[_0x2347('0x5c')]['id']){delete _0x38dc49['body']['id'];}return db['FaxAccount'][_0x2347('0x5a')]({'where':{'id':_0x38dc49['params']['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x28a6e8,null))['then'](function(_0x271cbb){if(_0x271cbb){_0x38dc49[_0x2347('0x5c')][_0x2347('0x64')]=_0x271cbb['id'];return db[_0x2347('0x65')]['create'](_0x38dc49[_0x2347('0x5c')]);}})[_0x2347('0x35')](respondWithResult(_0x28a6e8,null))[_0x2347('0x29')](handleError(_0x28a6e8,null));};exports['getDispositions']=function(_0x261c2a,_0x3bf2a7,_0xd2f9fb){var _0x1531db={'raw':![],'where':{}};var _0x558335={};var _0x156686={'count':0x0,'rows':[]};return db[_0x2347('0x52')][_0x2347('0x66')]({'where':{'id':_0x261c2a[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x3bf2a7,null))[_0x2347('0x35')](function(_0x54773c){if(_0x54773c){_0x558335[_0x2347('0x40')]=_[_0x2347('0x42')](db[_0x2347('0x65')][_0x2347('0x59')]);_0x558335[_0x2347('0x41')]=_['keys'](_0x261c2a[_0x2347('0x41')]);_0x558335[_0x2347('0x43')]=_[_0x2347('0x44')](_0x558335[_0x2347('0x40')],_0x558335[_0x2347('0x41')]);_0x1531db['attributes']=_[_0x2347('0x44')](_0x558335['model'],qs[_0x2347('0x46')](_0x261c2a[_0x2347('0x41')][_0x2347('0x46')]));_0x1531db[_0x2347('0x45')]=_0x1531db[_0x2347('0x45')][_0x2347('0x47')]?_0x1531db[_0x2347('0x45')]:_0x558335['model'];if(!_0x261c2a[_0x2347('0x41')]['hasOwnProperty'](_0x2347('0x49'))){_0x1531db[_0x2347('0x2e')]=qs['limit'](_0x261c2a[_0x2347('0x41')][_0x2347('0x2e')]);_0x1531db['offset']=qs[_0x2347('0x2d')](_0x261c2a[_0x2347('0x41')][_0x2347('0x2d')]);}_0x1531db['order']=qs[_0x2347('0x4b')](_0x261c2a[_0x2347('0x41')]['sort']);_0x1531db[_0x2347('0x4d')]=qs[_0x2347('0x43')](_['pick'](_0x261c2a['query'],_0x558335['filters']));_0x1531db[_0x2347('0x4d')][_0x2347('0x64')]=_0x54773c['id'];if(_0x261c2a[_0x2347('0x41')][_0x2347('0x67')]){_0x1531db['where']=_[_0x2347('0x4e')](_0x1531db[_0x2347('0x4d')],{'$or':_[_0x2347('0x3e')](_0x1531db[_0x2347('0x45')],function(_0x492e0b){var _0x5af525={};_0x5af525[_0x492e0b]={'$like':'%'+_0x261c2a[_0x2347('0x41')][_0x2347('0x67')]+'%'};return _0x5af525;})});}_0x1531db=_[_0x2347('0x4e')]({},_0x1531db,_0x261c2a['options']);return db[_0x2347('0x65')][_0x2347('0x2f')]({'where':_0x1531db[_0x2347('0x4d')]})[_0x2347('0x35')](function(_0x5b4f66){_0x156686['count']=_0x5b4f66;if(_0x261c2a[_0x2347('0x41')]['includeAll']){_0x1531db['include']=[{'all':!![]}];}return db[_0x2347('0x65')][_0x2347('0x54')](_0x1531db);})[_0x2347('0x35')](function(_0x3d2482){_0x156686['rows']=_0x3d2482;return _0x156686;});}})['then'](respondWithFilteredResult(_0x3bf2a7,_0x1531db))[_0x2347('0x29')](handleError(_0x3bf2a7,null));};exports[_0x2347('0x68')]=function(_0x2b6265,_0xa8e572,_0x27e2d6){return db['FaxAccount'][_0x2347('0x5a')]({'where':{'id':_0x2b6265[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0xa8e572,null))[_0x2347('0x35')](function(_0xc428f1){if(_0xc428f1){return _0xc428f1['removeDispositions'](_0x2b6265['query']['ids']);}})[_0x2347('0x35')](respondWithStatusCode(_0xa8e572,null))[_0x2347('0x29')](handleError(_0xa8e572,null));};exports['addAnswer']=function(_0x4ade7d,_0x3cdd08,_0x1a1681){if(_0x4ade7d[_0x2347('0x5c')]['id']){delete _0x4ade7d[_0x2347('0x5c')]['id'];}return db[_0x2347('0x52')][_0x2347('0x5a')]({'where':{'id':_0x4ade7d[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x3cdd08,null))['then'](function(_0x384901){if(_0x384901){_0x4ade7d[_0x2347('0x5c')][_0x2347('0x64')]=_0x384901['id'];return db['CannedAnswer']['create'](_0x4ade7d[_0x2347('0x5c')]);}})['then'](respondWithResult(_0x3cdd08,null))['catch'](handleError(_0x3cdd08,null));};exports[_0x2347('0x69')]=function(_0x192c2f,_0x3f2b80,_0x501ebf){var _0x18b690={'raw':![],'where':{}};var _0x5e333d={};var _0x38faaf={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2347('0x66')]({'where':{'id':_0x192c2f[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x3f2b80,null))[_0x2347('0x35')](function(_0x2ada2d){if(_0x2ada2d){_0x5e333d[_0x2347('0x40')]=_[_0x2347('0x42')](db[_0x2347('0x6a')]['rawAttributes']);_0x5e333d[_0x2347('0x41')]=_[_0x2347('0x42')](_0x192c2f['query']);_0x5e333d[_0x2347('0x43')]=_[_0x2347('0x44')](_0x5e333d['model'],_0x5e333d[_0x2347('0x41')]);_0x18b690['attributes']=_[_0x2347('0x44')](_0x5e333d[_0x2347('0x40')],qs[_0x2347('0x46')](_0x192c2f['query']['fields']));_0x18b690[_0x2347('0x45')]=_0x18b690[_0x2347('0x45')][_0x2347('0x47')]?_0x18b690['attributes']:_0x5e333d[_0x2347('0x40')];if(!_0x192c2f[_0x2347('0x41')][_0x2347('0x48')](_0x2347('0x49'))){_0x18b690[_0x2347('0x2e')]=qs['limit'](_0x192c2f[_0x2347('0x41')][_0x2347('0x2e')]);_0x18b690[_0x2347('0x2d')]=qs['offset'](_0x192c2f[_0x2347('0x41')][_0x2347('0x2d')]);}_0x18b690[_0x2347('0x4a')]=qs[_0x2347('0x4b')](_0x192c2f['query'][_0x2347('0x4b')]);_0x18b690[_0x2347('0x4d')]=qs['filters'](_['pick'](_0x192c2f[_0x2347('0x41')],_0x5e333d[_0x2347('0x43')]));_0x18b690[_0x2347('0x4d')][_0x2347('0x64')]=_0x2ada2d['id'];if(_0x192c2f[_0x2347('0x41')][_0x2347('0x67')]){_0x18b690['where']=_[_0x2347('0x4e')](_0x18b690[_0x2347('0x4d')],{'$or':_[_0x2347('0x3e')](_0x18b690[_0x2347('0x45')],function(_0x780168){var _0x348d03={};_0x348d03[_0x780168]={'$like':'%'+_0x192c2f[_0x2347('0x41')][_0x2347('0x67')]+'%'};return _0x348d03;})});}_0x18b690=_[_0x2347('0x4e')]({},_0x18b690,_0x192c2f['options']);return db[_0x2347('0x6a')][_0x2347('0x2f')]({'where':_0x18b690[_0x2347('0x4d')]})['then'](function(_0x5ee199){_0x38faaf[_0x2347('0x2f')]=_0x5ee199;if(_0x192c2f['query'][_0x2347('0x53')]){_0x18b690[_0x2347('0x6b')]=[{'all':!![]}];}return db[_0x2347('0x6a')][_0x2347('0x54')](_0x18b690);})[_0x2347('0x35')](function(_0x4b48ef){_0x38faaf[_0x2347('0x55')]=_0x4b48ef;return _0x38faaf;});}})['then'](respondWithFilteredResult(_0x3f2b80,_0x18b690))[_0x2347('0x29')](handleError(_0x3f2b80,null));};exports['removeAnswers']=function(_0x343a4e,_0x485290,_0x406e5c){return db[_0x2347('0x52')][_0x2347('0x5a')]({'where':{'id':_0x343a4e[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x485290,null))[_0x2347('0x35')](function(_0x31a69f){if(_0x31a69f){return _0x31a69f['removeAnswers'](_0x343a4e[_0x2347('0x41')]['ids']);}})[_0x2347('0x35')](respondWithStatusCode(_0x485290,null))['catch'](handleError(_0x485290,null));};exports[_0x2347('0x6c')]=function(_0x31f306,_0x5d9639,_0x1600e4){return db[_0x2347('0x6d')][_0x2347('0x5a')]({'where':{'id':_0x31f306[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x5d9639,null))[_0x2347('0x35')](function(_0x41348d){if(_0x41348d){return _0x41348d['addInteraction'](_0x31f306[_0x2347('0x5c')]['ids'],_[_0x2347('0x6e')](_0x31f306[_0x2347('0x5c')],[_0x2347('0x6f'),'id'])||{});}})[_0x2347('0x35')](respondWithResult(_0x5d9639,null))[_0x2347('0x29')](handleError(_0x5d9639,null));};exports[_0x2347('0x70')]=function(_0x24939f,_0x14f215,_0x25a5b7){var _0x1b457a={'raw':![],'where':{}};var _0xf28a06={};var _0x560b39={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2347('0x66')]({'where':{'id':_0x24939f[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x14f215,null))[_0x2347('0x35')](function(_0x43d9d8){if(_0x43d9d8){_0xf28a06[_0x2347('0x40')]=_['keys'](db[_0x2347('0x6d')][_0x2347('0x59')]);_0xf28a06['query']=_[_0x2347('0x42')](_0x24939f[_0x2347('0x41')]);_0xf28a06[_0x2347('0x43')]=_[_0x2347('0x44')](_0xf28a06['model'],_0xf28a06[_0x2347('0x41')]);_0x1b457a['attributes']=_[_0x2347('0x44')](_0xf28a06[_0x2347('0x40')],qs[_0x2347('0x46')](_0x24939f[_0x2347('0x41')][_0x2347('0x46')]));_0x1b457a[_0x2347('0x45')]=_0x1b457a[_0x2347('0x45')]['length']?_0x1b457a['attributes']:_0xf28a06[_0x2347('0x40')];if(!_0x24939f['query'][_0x2347('0x48')](_0x2347('0x49'))){_0x1b457a[_0x2347('0x2e')]=qs['limit'](_0x24939f['query'][_0x2347('0x2e')]);_0x1b457a[_0x2347('0x2d')]=qs['offset'](_0x24939f['query']['offset']);}_0x1b457a[_0x2347('0x4a')]=qs[_0x2347('0x4b')](_0x24939f['query'][_0x2347('0x4b')]);_0x1b457a[_0x2347('0x4d')]=qs[_0x2347('0x43')](_[_0x2347('0x4c')](_0x24939f[_0x2347('0x41')],_0xf28a06[_0x2347('0x43')]));_0x1b457a[_0x2347('0x4d')][_0x2347('0x64')]=_0x43d9d8['id'];if(_0x24939f[_0x2347('0x41')][_0x2347('0x67')]){_0x1b457a[_0x2347('0x4d')]=_[_0x2347('0x4e')](_0x1b457a[_0x2347('0x4d')],{'$or':_['map'](_0x1b457a['attributes'],function(_0x1a0b66){var _0x36a93c={};_0x36a93c[_0x1a0b66]={'$like':'%'+_0x24939f[_0x2347('0x41')][_0x2347('0x67')]+'%'};return _0x36a93c;})});}_0x1b457a=_[_0x2347('0x4e')]({},_0x1b457a,_0x24939f[_0x2347('0x51')]);return db[_0x2347('0x6d')]['count']({'where':_0x1b457a['where']})[_0x2347('0x35')](function(_0x6fdaca){_0x560b39['count']=_0x6fdaca;if(_0x24939f[_0x2347('0x41')][_0x2347('0x53')]){_0x1b457a[_0x2347('0x6b')]=[{'model':db[_0x2347('0x71')],'as':_0x2347('0x72'),'required':![]},{'model':db[_0x2347('0x73')],'as':'Owner','attributes':[_0x2347('0x3a'),'fullname',_0x2347('0x74')],'required':![]},{'model':db[_0x2347('0x75')],'as':_0x2347('0x76'),'attributes':['id',_0x2347('0x3a'),'color'],'where':_0x24939f[_0x2347('0x41')][_0x2347('0x77')]?{'id':_0x24939f[_0x2347('0x41')][_0x2347('0x77')]}:undefined,'required':_0x24939f[_0x2347('0x41')][_0x2347('0x77')]?!![]:![]}];}return db[_0x2347('0x6d')]['findAll'](_0x1b457a);})[_0x2347('0x35')](function(_0x16d4d1){_0x560b39[_0x2347('0x55')]=_0x16d4d1;return _0x560b39;});}})['then'](respondWithFilteredResult(_0x14f215,_0x1b457a))[_0x2347('0x29')](handleError(_0x14f215,null));};exports['addApplications']=function(_0x257ebe,_0x45080b,_0x54dcf4){return db[_0x2347('0x52')]['findOne']({'where':{'id':_0x257ebe[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x45080b,null))[_0x2347('0x35')](function(_0x109f79){if(_0x109f79){return db[_0x2347('0x78')][_0x2347('0x79')](function(_0x3cd3c2){return db[_0x2347('0x7a')][_0x2347('0x36')]({'where':{'FaxAccountId':_0x257ebe[_0x2347('0x57')]['id']},'transaction':_0x3cd3c2})[_0x2347('0x35')](function(_0x23bb2c){var _0x1ab7dc=_[_0x2347('0x3e')](_0x257ebe[_0x2347('0x5c')],function(_0x5736d1){_0x5736d1[_0x2347('0x64')]=_0x257ebe[_0x2347('0x57')]['id'];return _0x5736d1;});return db[_0x2347('0x7a')]['bulkCreate'](_0x1ab7dc,{'transaction':_0x3cd3c2});});})['then'](function(){return db[_0x2347('0x7a')]['findAndCountAll']({'where':{'FaxAccountId':_0x257ebe[_0x2347('0x57')]['id']},'order':_0x2347('0x7b')});});}})[_0x2347('0x35')](respondWithResult(_0x45080b,null))[_0x2347('0x29')](handleError(_0x45080b,null));};exports[_0x2347('0x7c')]=function(_0x56c5b6,_0x5ae221,_0x32e0f3){var _0x5aaf69={};var _0x4e342f={};var _0x25a941;var _0xaca56c;return db[_0x2347('0x52')][_0x2347('0x66')]({'where':{'id':_0x56c5b6[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x5ae221,null))['then'](function(_0x4779a6){if(_0x4779a6){_0x25a941=_0x4779a6;_0x4e342f[_0x2347('0x40')]=_[_0x2347('0x42')](db['FaxApplication'][_0x2347('0x59')]);_0x4e342f[_0x2347('0x41')]=_[_0x2347('0x42')](_0x56c5b6[_0x2347('0x41')]);_0x4e342f['filters']=_[_0x2347('0x44')](_0x4e342f[_0x2347('0x40')],_0x4e342f[_0x2347('0x41')]);_0x5aaf69[_0x2347('0x45')]=_[_0x2347('0x44')](_0x4e342f['model'],qs['fields'](_0x56c5b6[_0x2347('0x41')][_0x2347('0x46')]));_0x5aaf69[_0x2347('0x45')]=_0x5aaf69[_0x2347('0x45')][_0x2347('0x47')]?_0x5aaf69[_0x2347('0x45')]:_0x4e342f[_0x2347('0x40')];_0x5aaf69[_0x2347('0x4a')]=qs[_0x2347('0x4b')](_0x56c5b6[_0x2347('0x41')]['sort']);_0x5aaf69[_0x2347('0x4d')]=qs[_0x2347('0x43')](_[_0x2347('0x4c')](_0x56c5b6[_0x2347('0x41')],_0x4e342f[_0x2347('0x43')]));if(_0x56c5b6[_0x2347('0x41')]['filter']){_0x5aaf69['where']=_[_0x2347('0x4e')](_0x5aaf69[_0x2347('0x4d')],{'$or':_['map'](_0x5aaf69['attributes'],function(_0x1cd568){var _0x59ac79={};_0x59ac79[_0x1cd568]={'$like':'%'+_0x56c5b6[_0x2347('0x41')]['filter']+'%'};return _0x59ac79;})});}_0x5aaf69=_[_0x2347('0x4e')]({},_0x5aaf69,_0x56c5b6[_0x2347('0x51')]);return _0x25a941['getApplications'](_0x5aaf69);}})[_0x2347('0x35')](function(_0x2f3610){if(_0x2f3610){_0xaca56c=_0x2f3610[_0x2347('0x47')];if(!_0x56c5b6[_0x2347('0x41')][_0x2347('0x48')](_0x2347('0x49'))){_0x5aaf69[_0x2347('0x2e')]=qs[_0x2347('0x2e')](_0x56c5b6['query'][_0x2347('0x2e')]);_0x5aaf69[_0x2347('0x2d')]=qs['offset'](_0x56c5b6['query'][_0x2347('0x2d')]);}return _0x25a941[_0x2347('0x7c')](_0x5aaf69);}})[_0x2347('0x35')](function(_0x18cb8d){if(_0x18cb8d){return _0x18cb8d?{'count':_0xaca56c,'rows':_0x18cb8d}:null;}})['then'](respondWithResult(_0x5ae221,null))[_0x2347('0x29')](handleError(_0x5ae221,null));};function Extension(_0x3cc234,_0x460b46,_0x40fcfe,_0x5bd346){this[_0x2347('0x7d')]=_0x2347('0x7e');this['exten']=_0x3cc234[_0x2347('0x7f')];this[_0x2347('0x80')]=_0x5bd346;this[_0x2347('0x4f')]=_0x2347('0x81');this[_0x2347('0x82')]='Fax\x20Extension';this['FaxAccountId']=_0x3cc234['id'];this[_0x2347('0x7b')]=_0x460b46;this['appdata']=_0x40fcfe;}function createExtensionsReciveFax(_0x43d3ed){var _0x32e3fe=0x1;var _0x1b1052=[];_0x1b1052['push'](new Extension(_0x43d3ed,_0x32e3fe,'',_0x2347('0x83')));_0x32e3fe+=0x1;_0x1b1052[_0x2347('0x84')](new Extension(_0x43d3ed,_0x32e3fe,'CDR(type)=inbound-fax','Set'));_0x32e3fe+=0x1;for(var _0x5e79f8 in _0x43d3ed){if(_0x43d3ed['hasOwnProperty'](_0x5e79f8)&&(_0x5e79f8==='ecm'||_0x5e79f8===_0x2347('0x7f')||_0x5e79f8===_0x2347('0x85')||_0x5e79f8===_0x2347('0x86')||_0x5e79f8===_0x2347('0x87')||_0x5e79f8===_0x2347('0x88')||_0x5e79f8==='minrate'||_0x5e79f8===_0x2347('0x89')||_0x5e79f8===_0x2347('0x8a'))){_0x1b1052[_0x2347('0x84')](new Extension(_0x43d3ed,_0x32e3fe,_0x2347('0x8b')+_0x5e79f8+')='+_0x43d3ed[_0x5e79f8],_0x2347('0x8c')));_0x32e3fe+=0x1;}}_0x1b1052[_0x2347('0x84')](new Extension(_0x43d3ed,_0x32e3fe,'6',_0x2347('0x8d')));_0x32e3fe+=0x1;_0x1b1052['push'](new Extension(_0x43d3ed,_0x32e3fe,_0x2347('0x8e'),'ReceiveFax'));_0x32e3fe=0x0;return _0x1b1052;}exports[_0x2347('0x8f')]=function(_0x57f559,_0x4fd462,_0x485797){var _0x1bc438;return db[_0x2347('0x78')]['transaction'](function(_0x220430){return db[_0x2347('0x52')]['create'](_0x57f559[_0x2347('0x5c')],{'transaction':_0x220430})[_0x2347('0x35')](function(_0x3bdd4a){_0x1bc438=_0x3bdd4a[_0x2347('0x37')]({'plain':!![]});return db[_0x2347('0x90')][_0x2347('0x91')](createExtensionsReciveFax(_0x1bc438),{'transaction':_0x220430});});})[_0x2347('0x35')](function(){return _0x1bc438;})['then'](respondWithResult(_0x4fd462,null))[_0x2347('0x29')](handleError(_0x4fd462,null));};exports[_0x2347('0x92')]=function(_0x322831,_0x57e045,_0x2c81f2){var _0x5d2a8b;return db[_0x2347('0x78')]['transaction'](function(_0x4232fe){return db[_0x2347('0x52')]['update'](_0x322831['body'],{'where':{'id':_0x322831[_0x2347('0x5c')]['id']},'transaction':_0x4232fe})[_0x2347('0x35')](function(_0x13db02){return db[_0x2347('0x90')]['destroy']({'where':{'FaxAccountId':_0x322831[_0x2347('0x5c')]['id']},'transaction':_0x4232fe})[_0x2347('0x35')](function(_0x470a62){return db[_0x2347('0x90')][_0x2347('0x91')](createExtensionsReciveFax(_[_0x2347('0x6e')](_0x322831[_0x2347('0x5c')],[_0x2347('0x93'),_0x2347('0x3f'),'createdAt',_0x2347('0x94'),'TrunkId',_0x2347('0x95')])),{'transaction':_0x4232fe});});});})[_0x2347('0x35')](function(){return db[_0x2347('0x52')]['findById'](_0x322831[_0x2347('0x5c')]['id']);})[_0x2347('0x35')](respondWithResult(_0x57e045,null))['catch'](handleError(_0x57e045,null));};exports[_0x2347('0x96')]=function(_0x2a8c6b,_0x2f7dc4,_0x1e879d){var _0x22160e={'raw':!![],'where':{}};var _0x8a65cd={};var _0x41df3a={'count':0x0,'rows':[]};return db[_0x2347('0x52')][_0x2347('0x66')]({'where':{'id':_0x2a8c6b[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x2f7dc4,null))[_0x2347('0x35')](function(_0x2d2fca){if(_0x2d2fca){_0x8a65cd['model']=_[_0x2347('0x42')](db[_0x2347('0x97')][_0x2347('0x59')]);_0x8a65cd[_0x2347('0x41')]=_['keys'](_0x2a8c6b[_0x2347('0x41')]);_0x8a65cd[_0x2347('0x43')]=_[_0x2347('0x44')](_0x8a65cd[_0x2347('0x40')],_0x8a65cd[_0x2347('0x41')]);_0x22160e[_0x2347('0x45')]=_[_0x2347('0x44')](_0x8a65cd[_0x2347('0x40')],qs[_0x2347('0x46')](_0x2a8c6b[_0x2347('0x41')][_0x2347('0x46')]));_0x22160e[_0x2347('0x45')]=_0x22160e[_0x2347('0x45')][_0x2347('0x47')]?_0x22160e[_0x2347('0x45')]:_0x8a65cd['model'];if(!_0x2a8c6b['query'][_0x2347('0x48')](_0x2347('0x49'))){_0x22160e['limit']=qs[_0x2347('0x2e')](_0x2a8c6b[_0x2347('0x41')][_0x2347('0x2e')]);_0x22160e[_0x2347('0x2d')]=qs[_0x2347('0x2d')](_0x2a8c6b[_0x2347('0x41')][_0x2347('0x2d')]);}_0x22160e['order']=qs[_0x2347('0x4b')](_0x2a8c6b['query']['sort']);_0x22160e[_0x2347('0x4d')]=qs['filters'](_[_0x2347('0x4c')](_0x2a8c6b[_0x2347('0x41')],_0x8a65cd[_0x2347('0x43')]));_0x22160e[_0x2347('0x4d')][_0x2347('0x64')]=_0x2d2fca['id'];if(_0x2a8c6b[_0x2347('0x41')][_0x2347('0x67')]){_0x22160e[_0x2347('0x4d')]=_[_0x2347('0x4e')](_0x22160e[_0x2347('0x4d')],{'$or':_[_0x2347('0x3e')](_0x22160e[_0x2347('0x45')],function(_0x15afca){var _0x1927f8={};_0x1927f8[_0x15afca]={'$like':'%'+_0x2a8c6b[_0x2347('0x41')]['filter']+'%'};return _0x1927f8;})});}if(_0x2a8c6b['query'][_0x2347('0x98')]){var _0x15b7a0=_0x2a8c6b[_0x2347('0x41')][_0x2347('0x98')][_0x2347('0x99')](',');var _0x590544={};_0x590544[_0x15b7a0[0x0]]={'$gte':moment(_0x15b7a0[0x1])['format'](_0x2347('0x9a'))};_0x22160e[_0x2347('0x4d')]=_['merge'](_0x22160e[_0x2347('0x4d')],_0x590544);}_0x22160e=_[_0x2347('0x4e')]({},_0x22160e,_0x2a8c6b[_0x2347('0x51')]);return db[_0x2347('0x97')][_0x2347('0x2f')]({'where':_0x22160e[_0x2347('0x4d')]})[_0x2347('0x35')](function(_0x1893bd){_0x41df3a[_0x2347('0x2f')]=_0x1893bd;if(_0x2a8c6b[_0x2347('0x41')]['includeAll']){_0x22160e[_0x2347('0x6b')]=[{'all':!![]}];}return db['FaxMessage'][_0x2347('0x54')](_0x22160e);})[_0x2347('0x35')](function(_0x5e7b8c){_0x41df3a[_0x2347('0x55')]=_0x5e7b8c;return _0x41df3a;});}})['then'](respondWithFilteredResult(_0x2f7dc4,_0x22160e))[_0x2347('0x29')](handleError(_0x2f7dc4,null));};exports[_0x2347('0x3b')]=function(_0x48d2b3,_0x13da2a,_0x3142ad){var _0x326ee1,_0x1f7241={},_0x3d7283;if(_0x48d2b3[_0x2347('0x5c')]['to']){_0x3d7283=_0x48d2b3[_0x2347('0x5c')]['to'][0x0];}return db[_0x2347('0x52')][_0x2347('0x5a')]({'where':{'id':_0x48d2b3[_0x2347('0x57')]['id']},'include':[{'model':db[_0x2347('0x9b')],'as':'List','include':[{'model':db[_0x2347('0x71')],'as':_0x2347('0x9c'),'where':{'fax':_0x3d7283},'limit':0x1,'order':[[_0x2347('0x94'),_0x2347('0x9d')]]}]}]})[_0x2347('0x35')](handleEntityNotFound(_0x13da2a,null))[_0x2347('0x35')](function(_0x21f0ea){_0x326ee1=_0x21f0ea;if(_0x48d2b3['body'][_0x2347('0x9e')]&&_0x48d2b3[_0x2347('0x5c')][_0x2347('0x9e')]['length']){for(var _0x24209d=0x0;_0x24209d<_0x48d2b3['body'][_0x2347('0x9e')]['length'];_0x24209d+=0x1){_0x48d2b3[_0x2347('0x5c')][_0x2347('0x9e')][_0x24209d]={'filename':_0x48d2b3[_0x2347('0x5c')]['attachments'][_0x24209d]['name'],'id':_0x48d2b3[_0x2347('0x5c')][_0x2347('0x9e')][_0x24209d]['id'],'path':path[_0x2347('0x9f')](config[_0x2347('0xa0')],_0x2347('0xa1'),_0x48d2b3[_0x2347('0x5c')][_0x2347('0x9e')][_0x24209d]['basename'])};}}return respondWithRpcPromise(_0x2347('0xa2'),_0x2347('0xa2'),{'FaxAccountId':_[_0x2347('0xa3')](_0x48d2b3['params']['id'])?undefined:_0x48d2b3[_0x2347('0x57')]['id'],'path':_['isNil'](_0x48d2b3[_0x2347('0x5c')][_0x2347('0x9e')][0x0][_0x2347('0xa4')])?undefined:_0x48d2b3['body']['attachments'][0x0][_0x2347('0xa4')],'fax':_[_0x2347('0xa3')](_0x48d2b3['body']['to'][0x0])?undefined:_0x48d2b3[_0x2347('0x5c')]['to'][0x0]},client9002);})[_0x2347('0x35')](function(){if(_0x326ee1){if(_['isNil'](_0x48d2b3[_0x2347('0x5c')][_0x2347('0xa5')])){_0x48d2b3[_0x2347('0x5c')]['from']=util[_0x2347('0xa6')](_0x2347('0xa7'),_0x326ee1[_0x2347('0x3a')],_0x326ee1[_0x2347('0xa8')]);}if(_0x326ee1[_0x2347('0xa9')]){if(_0x326ee1[_0x2347('0xa9')][_0x2347('0x9c')][_0x2347('0x47')]){return _0x326ee1['List'][_0x2347('0x9c')][0x0];}else{return db[_0x2347('0x71')][_0x2347('0x5b')](_[_0x2347('0x18')](_0x48d2b3[_0x2347('0x5c')],{'firstName':_0x48d2b3['body']['to'][0x0],'phone':_0x48d2b3['body']['to'][0x0],'fax':_0x48d2b3[_0x2347('0x5c')]['to'][0x0],'ListId':_0x326ee1['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x2347('0xaa'));}})['then'](function(_0x79a8c7){if(_0x79a8c7){return db[_0x2347('0x6d')][_0x2347('0x5a')]({'where':{'ContactId':_0x79a8c7['id'],'closed':![],'FaxAccountId':_0x326ee1['id']}})[_0x2347('0x35')](function(_0x1a8556){if(_0x1a8556){return[_0x1a8556,![]];}return db[_0x2347('0x6d')][_0x2347('0x5b')]({'UserId':_0x48d2b3['user']['id'],'ContactId':_0x79a8c7['id'],'FaxAccountId':_0x326ee1['id'],'fax':_0x48d2b3[_0x2347('0x5c')]['to'][0x0],'firstMsgDirection':_0x2347('0xab'),'Messages':[_[_0x2347('0x4e')](_0x48d2b3[_0x2347('0x5c')],{'read':![],'body':_0x48d2b3[_0x2347('0x5c')][_0x2347('0x9e')][0x0][_0x2347('0xac')],'FaxAccountId':_0x326ee1['id'],'UserId':_0x48d2b3[_0x2347('0x5d')]['id'],'ContactId':_0x79a8c7['id'],'AttachmentId':_0x48d2b3['body'][_0x2347('0x9e')][0x0]['id']})]},{'include':[{'model':db[_0x2347('0x97')],'as':'Messages'}]})['then'](function(_0x1eee3e){return[_0x1eee3e,!![]];});});}else{throw new Error(_0x2347('0xad'));}})[_0x2347('0xae')](function(_0x674642,_0x5d7af6){if(_0x5d7af6){return _0x674642;}return db[_0x2347('0x97')]['create']({'direction':_0x2347('0xab'),'read':![],'body':_0x48d2b3[_0x2347('0x5c')][_0x2347('0x9e')][0x0][_0x2347('0xac')],'FaxAccountId':_0x326ee1['id'],'FaxInteractionId':_0x674642['id'],'UserId':_0x48d2b3[_0x2347('0x5d')]['id'],'ContactId':_0x674642[_0x2347('0xaf')],'AttachmentId':_0x48d2b3[_0x2347('0x5c')]['attachments'][0x0]['id']})[_0x2347('0x35')](function(_0x371095){_0x674642[_0x2347('0xb0')][_0x2347('0xb1')]=[];_0x674642[_0x2347('0xb0')][_0x2347('0xb1')][_0x2347('0x84')](_0x371095[_0x2347('0xb0')]);return _0x674642;});})[_0x2347('0x35')](function(_0x4f4f6c){respondWithRpcPromise(_0x2347('0xb2'),_0x2347('0xb2'),{'FaxAccountId':_[_0x2347('0xa3')](_0x48d2b3[_0x2347('0x57')]['id'])?undefined:_0x48d2b3[_0x2347('0x57')]['id'],'path':_['isNil'](_0x48d2b3['body'][_0x2347('0x9e')][0x0][_0x2347('0xa4')])?undefined:_0x48d2b3[_0x2347('0x5c')][_0x2347('0x9e')][0x0][_0x2347('0xa4')],'fax':_['isNil'](_0x48d2b3[_0x2347('0x5c')]['to'][0x0])?undefined:_0x48d2b3[_0x2347('0x5c')]['to'][0x0],'AttachmentId':_0x48d2b3['body']['attachments'][0x0]['id']},client9002)[_0x2347('0x35')](function(_0x5145a0){logger['info'](_0x2347('0xb3'),_0x5145a0);})[_0x2347('0x29')](function(_0x2c8934){logger['info'](_0x2347('0xb3'),_0x2c8934);});return _0x4f4f6c;})[_0x2347('0x35')](respondWithResult(_0x13da2a,null))[_0x2347('0x29')](handleError(_0x13da2a,null));};exports[_0x2347('0xb4')]=function(_0x318bc3,_0x31ee08,_0x266c4d){return db[_0x2347('0x52')][_0x2347('0x5a')]({'where':{'id':_0x318bc3[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x31ee08,null))[_0x2347('0x35')](function(_0x15f160){if(_0x15f160){return _0x15f160['addAgents'](_0x318bc3['body'][_0x2347('0x6f')],_[_0x2347('0x6e')](_0x318bc3[_0x2347('0x5c')],[_0x2347('0x6f'),'id'])||{})['spread'](function(_0x49d3d8){for(var _0x2e3bce=0x0;_0x2e3bce<_0x318bc3[_0x2347('0x5c')][_0x2347('0x6f')][_0x2347('0x47')];_0x2e3bce+=0x1){socket[_0x2347('0xb5')]('userFaxAccount:save',{'UserId':Number(_0x318bc3['body'][_0x2347('0x6f')][_0x2e3bce]),'FaxAccountId':Number(_0x318bc3[_0x2347('0x57')]['id'])});}return _0x49d3d8;});}})[_0x2347('0x35')](respondWithResult(_0x31ee08,null))[_0x2347('0x29')](handleError(_0x31ee08,null));};exports[_0x2347('0xb6')]=function(_0x43a9c7,_0x1d9eca,_0x131cf6){return db[_0x2347('0x52')][_0x2347('0x5a')]({'where':{'id':_0x43a9c7[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x1d9eca,null))[_0x2347('0x35')](function(_0x33710d){if(_0x33710d){return _0x33710d[_0x2347('0xb6')](_0x43a9c7[_0x2347('0x41')]['ids'])[_0x2347('0x35')](function(){if(_[_0x2347('0xb7')](_0x43a9c7['query'][_0x2347('0x6f')])){for(var _0x4309fb=0x0;_0x4309fb<_0x43a9c7[_0x2347('0x41')][_0x2347('0x6f')]['length'];_0x4309fb+=0x1){socket['emit'](_0x2347('0xb8'),{'UserId':Number(_0x43a9c7[_0x2347('0x41')]['ids'][_0x4309fb]),'FaxAccountId':Number(_0x43a9c7[_0x2347('0x57')]['id'])});}}else{socket[_0x2347('0xb5')](_0x2347('0xb8'),{'UserId':Number(_0x43a9c7['query']['ids']),'FaxAccountId':Number(_0x43a9c7['params']['id'])});}});}})[_0x2347('0x35')](respondWithStatusCode(_0x1d9eca,null))[_0x2347('0x29')](handleError(_0x1d9eca,null));};exports[_0x2347('0xb9')]=function(_0x455cb5,_0x47543c,_0x44e2bb){var _0x4e3d3={};var _0x3b5f43={};var _0x450ecf;var _0x56eb83;return db[_0x2347('0x52')][_0x2347('0x66')]({'where':{'id':_0x455cb5[_0x2347('0x57')]['id']}})[_0x2347('0x35')](handleEntityNotFound(_0x47543c,null))[_0x2347('0x35')](function(_0x2990ec){if(_0x2990ec){_0x450ecf=_0x2990ec;_0x3b5f43[_0x2347('0x40')]=_[_0x2347('0x42')](db[_0x2347('0x73')]['rawAttributes']);_0x3b5f43['query']=_['keys'](_0x455cb5['query']);_0x3b5f43[_0x2347('0x43')]=_['intersection'](_0x3b5f43['model'],_0x3b5f43['query']);_0x4e3d3[_0x2347('0x45')]=_[_0x2347('0x44')](_0x3b5f43[_0x2347('0x40')],qs[_0x2347('0x46')](_0x455cb5[_0x2347('0x41')][_0x2347('0x46')]));_0x4e3d3[_0x2347('0x45')]=_0x4e3d3[_0x2347('0x45')][_0x2347('0x47')]?_0x4e3d3[_0x2347('0x45')]:_0x3b5f43[_0x2347('0x40')];_0x4e3d3[_0x2347('0x4a')]=qs[_0x2347('0x4b')](_0x455cb5[_0x2347('0x41')][_0x2347('0x4b')]);_0x4e3d3['where']=qs[_0x2347('0x43')](_['pick'](_0x455cb5[_0x2347('0x41')],_0x3b5f43[_0x2347('0x43')]));if(_0x455cb5[_0x2347('0x41')]['filter']){_0x4e3d3['where']=_['merge'](_0x4e3d3[_0x2347('0x4d')],{'$or':_[_0x2347('0x3e')](_0x4e3d3[_0x2347('0x45')],function(_0x3a7af7){var _0x14f54d={};_0x14f54d[_0x3a7af7]={'$like':'%'+_0x455cb5[_0x2347('0x41')]['filter']+'%'};return _0x14f54d;})});}_0x4e3d3=_[_0x2347('0x4e')]({},_0x4e3d3,_0x455cb5[_0x2347('0x51')]);return _0x450ecf[_0x2347('0xb9')](_0x4e3d3);}})[_0x2347('0x35')](function(_0x41d214){if(_0x41d214){_0x56eb83=_0x41d214[_0x2347('0x47')];if(!_0x455cb5['query'][_0x2347('0x48')]('nolimit')){_0x4e3d3[_0x2347('0x2e')]=qs['limit'](_0x455cb5[_0x2347('0x41')]['limit']);_0x4e3d3[_0x2347('0x2d')]=qs[_0x2347('0x2d')](_0x455cb5[_0x2347('0x41')][_0x2347('0x2d')]);}return _0x450ecf[_0x2347('0xb9')](_0x4e3d3);}})[_0x2347('0x35')](function(_0x45b648){if(_0x45b648){return _0x45b648?{'count':_0x56eb83,'rows':_0x45b648}:null;}})['then'](respondWithResult(_0x47543c,null))['catch'](handleError(_0x47543c,null));}; \ No newline at end of file +var _0x52c5=['info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','FaxAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','rawAttributes','options','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','Disposition','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','omit','order','FaxInteraction','CmContact','User','Owner','fullname','internal','Tag','Tags','tag','transaction','FaxApplication','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','sequelize','bulkCreate','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','List','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http'];(function(_0x1bc320,_0x3e43b5){var _0x4f5b7d=function(_0x49f3a6){while(--_0x49f3a6){_0x1bc320['push'](_0x1bc320['shift']());}};_0x4f5b7d(++_0x3e43b5);}(_0x52c5,0x160));var _0x552c=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0x52c5[_0x4f35f4];return _0x2e9a70;};'use strict';var emlformat=require(_0x552c('0x0'));var rimraf=require(_0x552c('0x1'));var zipdir=require(_0x552c('0x2'));var jsonpatch=require(_0x552c('0x3'));var rp=require(_0x552c('0x4'));var moment=require(_0x552c('0x5'));var BPromise=require(_0x552c('0x6'));var Mustache=require('mustache');var util=require(_0x552c('0x7'));var path=require(_0x552c('0x8'));var sox=require(_0x552c('0x9'));var csv=require(_0x552c('0xa'));var ejs=require(_0x552c('0xb'));var fs=require('fs');var fs_extra=require(_0x552c('0xc'));var _=require(_0x552c('0xd'));var squel=require(_0x552c('0xe'));var crypto=require(_0x552c('0xf'));var jsforce=require(_0x552c('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x552c('0xa'));var querystring=require(_0x552c('0x11'));var Papa=require(_0x552c('0x12'));var Redis=require(_0x552c('0x13'));var authService=require(_0x552c('0x14'));var qs=require(_0x552c('0x15'));var as=require(_0x552c('0x16'));var hardwareService=require(_0x552c('0x17'));var logger=require(_0x552c('0x18'))(_0x552c('0x19'));var utils=require(_0x552c('0x1a'));var config=require(_0x552c('0x1b'));var licenseUtil=require(_0x552c('0x1c'));var db=require(_0x552c('0x1d'))['db'];config[_0x552c('0x1e')]=_[_0x552c('0x1f')](config[_0x552c('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x552c('0x20'))(new Redis(config[_0x552c('0x1e')]));require(_0x552c('0x21'))[_0x552c('0x22')](socket);var jayson=require(_0x552c('0x23'));var client=jayson[_0x552c('0x24')]['http']({'port':0x232c});var client9002=jayson[_0x552c('0x24')][_0x552c('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x423016,_0x1cf396,_0x55b653,_0x11a555){return new BPromise(function(_0x1e615c,_0x56052f){var _0x4262aa=_0x11a555||client;return _0x4262aa['request'](_0x423016,_0x55b653)['then'](function(_0x43dd99){logger[_0x552c('0x26')](_0x552c('0x27'),_0x1cf396,_0x552c('0x28'));logger[_0x552c('0x29')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1cf396,_0x552c('0x28'),JSON[_0x552c('0x2a')](_0x43dd99));if(_0x43dd99[_0x552c('0x2b')]){if(_0x43dd99['error'][_0x552c('0x2c')]===0x1f4){logger[_0x552c('0x2b')](_0x552c('0x27'),_0x1cf396,_0x43dd99[_0x552c('0x2b')][_0x552c('0x2d')]);return _0x56052f(_0x43dd99[_0x552c('0x2b')][_0x552c('0x2d')]);}logger[_0x552c('0x2b')](_0x552c('0x27'),_0x1cf396,_0x43dd99[_0x552c('0x2b')][_0x552c('0x2d')]);return _0x1e615c(_0x43dd99[_0x552c('0x2b')][_0x552c('0x2d')]);}else{logger[_0x552c('0x26')]('FaxAccount,\x20%s,\x20%s',_0x1cf396,_0x552c('0x28'));_0x1e615c(_0x43dd99[_0x552c('0x2e')]['message']);}})[_0x552c('0x2f')](function(_0x289b00){logger[_0x552c('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x1cf396,_0x289b00);_0x56052f(_0x289b00);});});}function respondWithStatusCode(_0x5b0fc8,_0x515ece){_0x515ece=_0x515ece||0xcc;return function(_0x3b893d){if(_0x3b893d){return _0x5b0fc8[_0x552c('0x30')](_0x515ece);}return _0x5b0fc8[_0x552c('0x31')](_0x515ece)[_0x552c('0x32')]();};}function respondWithResult(_0x3c1343,_0x2465d9){_0x2465d9=_0x2465d9||0xc8;return function(_0x5401fe){if(_0x5401fe){return _0x3c1343[_0x552c('0x31')](_0x2465d9)[_0x552c('0x33')](_0x5401fe);}};}function respondWithFilteredResult(_0x42216d,_0x9d5431){return function(_0x1a1dbb){if(_0x1a1dbb){var _0x22b53a=typeof _0x9d5431[_0x552c('0x34')]===_0x552c('0x35')&&typeof _0x9d5431[_0x552c('0x36')]===_0x552c('0x35');var _0x7f8c8f=_0x1a1dbb[_0x552c('0x37')];var _0xc5a3fa=_0x22b53a?0x0:_0x9d5431[_0x552c('0x34')];var _0x990a77=_0x22b53a?_0x1a1dbb['count']:_0x9d5431[_0x552c('0x34')]+_0x9d5431['limit'];var _0x1ffc27;if(_0x990a77>=_0x7f8c8f){_0x990a77=_0x7f8c8f;_0x1ffc27=0xc8;}else{_0x1ffc27=0xce;}_0x42216d['status'](_0x1ffc27);return _0x42216d[_0x552c('0x38')]('Content-Range',_0xc5a3fa+'-'+_0x990a77+'/'+_0x7f8c8f)[_0x552c('0x33')](_0x1a1dbb);}return null;};}function patchUpdates(_0x4b72d7){return function(_0x41ae9a){try{jsonpatch[_0x552c('0x39')](_0x41ae9a,_0x4b72d7,!![]);}catch(_0x245652){return BPromise[_0x552c('0x3a')](_0x245652);}return _0x41ae9a['save']();};}function saveUpdates(_0x348684,_0x37a711){return function(_0x14d8e0){if(_0x14d8e0){return _0x14d8e0[_0x552c('0x3b')](_0x348684)[_0x552c('0x3c')](function(_0x3eb21b){return _0x3eb21b;});}return null;};}function removeEntity(_0x167203,_0x13ad92){return function(_0x40d8e7){if(_0x40d8e7){return _0x40d8e7[_0x552c('0x3d')]()[_0x552c('0x3c')](function(){var _0x35f790=_0x40d8e7['get']({'plain':!![]});var _0x3cb50e=_0x552c('0x3e');return db[_0x552c('0x3f')][_0x552c('0x3d')]({'where':{'type':_0x3cb50e,'resourceId':_0x35f790['id']}})[_0x552c('0x3c')](function(){return _0x40d8e7;});})[_0x552c('0x3c')](function(){_0x167203[_0x552c('0x31')](0xcc)[_0x552c('0x32')]();});}};}function handleEntityNotFound(_0xb3ba82,_0x30eb6d){return function(_0x137c66){if(!_0x137c66){_0xb3ba82[_0x552c('0x30')](0x194);}return _0x137c66;};}function handleError(_0x326901,_0x20afc5){_0x20afc5=_0x20afc5||0x1f4;return function(_0x21bffa){logger[_0x552c('0x2b')](_0x21bffa[_0x552c('0x40')]);if(_0x21bffa[_0x552c('0x41')]){delete _0x21bffa['name'];}_0x326901['status'](_0x20afc5)['send'](_0x21bffa);};}exports['index']=function(_0xbf55f1,_0x1f50fa){var _0x2adf27={'include':[{'model':db[_0x552c('0x42')],'as':_0x552c('0x43')}]},_0x498af9={},_0x4e0870={'count':0x0,'rows':[]};var _0x4a6343=_[_0x552c('0x44')](db[_0x552c('0x45')]['rawAttributes'],function(_0x5baa33){return{'name':_0x5baa33[_0x552c('0x46')],'type':_0x5baa33[_0x552c('0x47')]['key']};});_0x498af9[_0x552c('0x48')]=_[_0x552c('0x44')](_0x4a6343,_0x552c('0x41'));_0x498af9[_0x552c('0x49')]=_[_0x552c('0x4a')](_0xbf55f1[_0x552c('0x49')]);_0x498af9[_0x552c('0x4b')]=_[_0x552c('0x4c')](_0x498af9[_0x552c('0x48')],_0x498af9[_0x552c('0x49')]);_0x2adf27[_0x552c('0x4d')]=_[_0x552c('0x4c')](_0x498af9[_0x552c('0x48')],qs[_0x552c('0x4e')](_0xbf55f1[_0x552c('0x49')][_0x552c('0x4e')]));_0x2adf27[_0x552c('0x4d')]=_0x2adf27['attributes'][_0x552c('0x4f')]?_0x2adf27['attributes']:_0x498af9[_0x552c('0x48')];if(!_0xbf55f1[_0x552c('0x49')][_0x552c('0x50')](_0x552c('0x51'))){_0x2adf27[_0x552c('0x36')]=qs[_0x552c('0x36')](_0xbf55f1[_0x552c('0x49')][_0x552c('0x36')]);_0x2adf27[_0x552c('0x34')]=qs['offset'](_0xbf55f1[_0x552c('0x49')][_0x552c('0x34')]);}_0x2adf27['order']=qs[_0x552c('0x52')](_0xbf55f1[_0x552c('0x49')][_0x552c('0x52')]);_0x2adf27[_0x552c('0x53')]=qs[_0x552c('0x4b')](_[_0x552c('0x54')](_0xbf55f1['query'],_0x498af9[_0x552c('0x4b')]),_0x4a6343);if(_0xbf55f1[_0x552c('0x49')][_0x552c('0x55')]){_0x2adf27[_0x552c('0x53')]=_[_0x552c('0x56')](_0x2adf27[_0x552c('0x53')],{'$or':_[_0x552c('0x44')](_0x4a6343,function(_0xd18908){if(_0xd18908[_0x552c('0x47')]!=='VIRTUAL'){var _0x5dce6b={};_0x5dce6b[_0xd18908[_0x552c('0x41')]]={'$like':'%'+_0xbf55f1['query'][_0x552c('0x55')]+'%'};return _0x5dce6b;}})});}_0x2adf27=_['merge']({},_0x2adf27,_0xbf55f1['options']);var _0x52b7cf={'where':_0x2adf27['where']};return db['FaxAccount'][_0x552c('0x37')](_0x52b7cf)['then'](function(_0x1000ec){_0x4e0870['count']=_0x1000ec;if(_0xbf55f1[_0x552c('0x49')][_0x552c('0x57')]){_0x2adf27[_0x552c('0x58')]=[{'all':!![]}];}return db[_0x552c('0x45')][_0x552c('0x59')](_0x2adf27);})[_0x552c('0x3c')](function(_0x14b970){_0x4e0870[_0x552c('0x5a')]=_0x14b970;return _0x4e0870;})['then'](respondWithFilteredResult(_0x1f50fa,_0x2adf27))[_0x552c('0x2f')](handleError(_0x1f50fa,null));};exports['show']=function(_0x4877e2,_0x431d6f){var _0xd55b70={'raw':![],'where':{'id':_0x4877e2[_0x552c('0x5b')]['id']},'include':[{'model':db[_0x552c('0x42')],'as':_0x552c('0x43')}]},_0x446dca={};_0x446dca[_0x552c('0x48')]=_[_0x552c('0x4a')](db['FaxAccount'][_0x552c('0x5c')]);_0x446dca[_0x552c('0x49')]=_[_0x552c('0x4a')](_0x4877e2[_0x552c('0x49')]);_0x446dca[_0x552c('0x4b')]=_['intersection'](_0x446dca[_0x552c('0x48')],_0x446dca['query']);_0xd55b70[_0x552c('0x4d')]=_['intersection'](_0x446dca[_0x552c('0x48')],qs['fields'](_0x4877e2[_0x552c('0x49')][_0x552c('0x4e')]));_0xd55b70[_0x552c('0x4d')]=_0xd55b70[_0x552c('0x4d')][_0x552c('0x4f')]?_0xd55b70[_0x552c('0x4d')]:_0x446dca['model'];if(_0x4877e2['query'][_0x552c('0x57')]){_0xd55b70[_0x552c('0x58')]=[{'all':!![]}];}_0xd55b70=_[_0x552c('0x56')]({},_0xd55b70,_0x4877e2[_0x552c('0x5d')]);return db[_0x552c('0x45')][_0x552c('0x5e')](_0xd55b70)[_0x552c('0x3c')](handleEntityNotFound(_0x431d6f,null))['then'](respondWithResult(_0x431d6f,null))[_0x552c('0x2f')](handleError(_0x431d6f,null));};exports[_0x552c('0x5f')]=function(_0xfb735c,_0x11e858){return db[_0x552c('0x45')][_0x552c('0x5f')](_0xfb735c[_0x552c('0x60')],{})[_0x552c('0x3c')](function(_0x13770e){var _0x5ab787=_0xfb735c[_0x552c('0x61')][_0x552c('0x62')]({'plain':!![]});if(!_0x5ab787)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ab787['role']===_0x552c('0x61')){var _0x4a0828=_0x13770e['get']({'plain':!![]});var _0x358cb6='FaxAccounts';return db[_0x552c('0x63')][_0x552c('0x5e')]({'where':{'name':_0x358cb6,'userProfileId':_0x5ab787[_0x552c('0x64')]},'raw':!![]})[_0x552c('0x3c')](function(_0x1556f8){if(_0x1556f8&&_0x1556f8[_0x552c('0x65')]===0x0){return db[_0x552c('0x3f')]['create']({'name':_0x4a0828[_0x552c('0x41')],'resourceId':_0x4a0828['id'],'type':_0x1556f8[_0x552c('0x41')],'sectionId':_0x1556f8['id']},{})['then'](function(){return _0x13770e;});}else{return _0x13770e;}})['catch'](function(_0x1ba5ac){logger[_0x552c('0x2b')](_0x552c('0x66'),_0x1ba5ac);throw _0x1ba5ac;});}return _0x13770e;})['then'](respondWithResult(_0x11e858,0xc9))['catch'](handleError(_0x11e858,null));};exports['update']=function(_0x32a1ed,_0x1fa7af){if(_0x32a1ed['body']['id']){delete _0x32a1ed[_0x552c('0x60')]['id'];}return db[_0x552c('0x45')][_0x552c('0x5e')]({'where':{'id':_0x32a1ed['params']['id']},'include':[{'model':db[_0x552c('0x42')],'as':_0x552c('0x43')}]})[_0x552c('0x3c')](handleEntityNotFound(_0x1fa7af,null))['then'](saveUpdates(_0x32a1ed[_0x552c('0x60')],null))[_0x552c('0x3c')](respondWithResult(_0x1fa7af,null))[_0x552c('0x2f')](handleError(_0x1fa7af,null));};exports[_0x552c('0x3d')]=function(_0x49f021,_0x3c63f1){return db['FaxAccount'][_0x552c('0x5e')]({'where':{'id':_0x49f021[_0x552c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3c63f1,null))['then'](removeEntity(_0x3c63f1,null))['catch'](handleError(_0x3c63f1,null));};exports[_0x552c('0x67')]=function(_0x5d057b,_0x435950){return db[_0x552c('0x45')][_0x552c('0x67')]()['then'](respondWithResult(_0x435950,null))[_0x552c('0x2f')](handleError(_0x435950,null));};exports[_0x552c('0x68')]=function(_0xc8847f,_0x5dc314,_0x5e9700){if(_0xc8847f[_0x552c('0x60')]['id']){delete _0xc8847f[_0x552c('0x60')]['id'];}return db[_0x552c('0x45')][_0x552c('0x5e')]({'where':{'id':_0xc8847f[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x5dc314,null))['then'](function(_0x18c856){if(_0x18c856){_0xc8847f[_0x552c('0x60')][_0x552c('0x69')]=_0x18c856['id'];return db['Disposition'][_0x552c('0x5f')](_0xc8847f[_0x552c('0x60')]);}})['then'](respondWithResult(_0x5dc314,null))[_0x552c('0x2f')](handleError(_0x5dc314,null));};exports[_0x552c('0x6a')]=function(_0x19dc3e,_0x6b9a93,_0x45d4ac){var _0x179c92={'raw':![],'where':{}};var _0x3e6f1a={};var _0x49a30b={'count':0x0,'rows':[]};return db[_0x552c('0x45')]['findOne']({'where':{'id':_0x19dc3e['params']['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x6b9a93,null))[_0x552c('0x3c')](function(_0x374e48){if(_0x374e48){_0x3e6f1a['model']=_[_0x552c('0x4a')](db['Disposition'][_0x552c('0x5c')]);_0x3e6f1a[_0x552c('0x49')]=_[_0x552c('0x4a')](_0x19dc3e[_0x552c('0x49')]);_0x3e6f1a[_0x552c('0x4b')]=_[_0x552c('0x4c')](_0x3e6f1a[_0x552c('0x48')],_0x3e6f1a[_0x552c('0x49')]);_0x179c92[_0x552c('0x4d')]=_['intersection'](_0x3e6f1a[_0x552c('0x48')],qs[_0x552c('0x4e')](_0x19dc3e[_0x552c('0x49')][_0x552c('0x4e')]));_0x179c92['attributes']=_0x179c92[_0x552c('0x4d')]['length']?_0x179c92['attributes']:_0x3e6f1a[_0x552c('0x48')];if(!_0x19dc3e[_0x552c('0x49')][_0x552c('0x50')](_0x552c('0x51'))){_0x179c92[_0x552c('0x36')]=qs['limit'](_0x19dc3e[_0x552c('0x49')][_0x552c('0x36')]);_0x179c92['offset']=qs[_0x552c('0x34')](_0x19dc3e[_0x552c('0x49')][_0x552c('0x34')]);}_0x179c92['order']=qs['sort'](_0x19dc3e[_0x552c('0x49')][_0x552c('0x52')]);_0x179c92['where']=qs[_0x552c('0x4b')](_[_0x552c('0x54')](_0x19dc3e[_0x552c('0x49')],_0x3e6f1a[_0x552c('0x4b')]));_0x179c92['where'][_0x552c('0x69')]=_0x374e48['id'];if(_0x19dc3e[_0x552c('0x49')][_0x552c('0x55')]){_0x179c92[_0x552c('0x53')]=_[_0x552c('0x56')](_0x179c92[_0x552c('0x53')],{'$or':_[_0x552c('0x44')](_0x179c92[_0x552c('0x4d')],function(_0x4203ee){var _0x42336a={};_0x42336a[_0x4203ee]={'$like':'%'+_0x19dc3e[_0x552c('0x49')][_0x552c('0x55')]+'%'};return _0x42336a;})});}_0x179c92=_[_0x552c('0x56')]({},_0x179c92,_0x19dc3e[_0x552c('0x5d')]);return db[_0x552c('0x6b')]['count']({'where':_0x179c92[_0x552c('0x53')]})[_0x552c('0x3c')](function(_0x27b8ce){_0x49a30b[_0x552c('0x37')]=_0x27b8ce;if(_0x19dc3e[_0x552c('0x49')][_0x552c('0x57')]){_0x179c92[_0x552c('0x58')]=[{'all':!![]}];}return db[_0x552c('0x6b')][_0x552c('0x59')](_0x179c92);})[_0x552c('0x3c')](function(_0x4b0c5d){_0x49a30b['rows']=_0x4b0c5d;return _0x49a30b;});}})[_0x552c('0x3c')](respondWithFilteredResult(_0x6b9a93,_0x179c92))[_0x552c('0x2f')](handleError(_0x6b9a93,null));};exports['removeDispositions']=function(_0x522169,_0x4fa825,_0x1551f3){return db['FaxAccount'][_0x552c('0x5e')]({'where':{'id':_0x522169[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x4fa825,null))[_0x552c('0x3c')](function(_0x1fb99e){if(_0x1fb99e){return _0x1fb99e['removeDispositions'](_0x522169[_0x552c('0x49')][_0x552c('0x6c')]);}})[_0x552c('0x3c')](respondWithStatusCode(_0x4fa825,null))[_0x552c('0x2f')](handleError(_0x4fa825,null));};exports[_0x552c('0x6d')]=function(_0x5e5c0c,_0x4cf3f0,_0x1898e4){if(_0x5e5c0c[_0x552c('0x60')]['id']){delete _0x5e5c0c[_0x552c('0x60')]['id'];}return db['FaxAccount'][_0x552c('0x5e')]({'where':{'id':_0x5e5c0c[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x4cf3f0,null))[_0x552c('0x3c')](function(_0x1828b2){if(_0x1828b2){_0x5e5c0c[_0x552c('0x60')][_0x552c('0x69')]=_0x1828b2['id'];return db[_0x552c('0x6e')][_0x552c('0x5f')](_0x5e5c0c[_0x552c('0x60')]);}})[_0x552c('0x3c')](respondWithResult(_0x4cf3f0,null))[_0x552c('0x2f')](handleError(_0x4cf3f0,null));};exports[_0x552c('0x6f')]=function(_0x442158,_0x3bb618,_0x201737){var _0x198b32={'raw':![],'where':{}};var _0x4e6fd1={};var _0x24781c={'count':0x0,'rows':[]};return db[_0x552c('0x45')][_0x552c('0x70')]({'where':{'id':_0x442158[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3bb618,null))['then'](function(_0x3e2d8){if(_0x3e2d8){_0x4e6fd1[_0x552c('0x48')]=_['keys'](db['CannedAnswer'][_0x552c('0x5c')]);_0x4e6fd1[_0x552c('0x49')]=_[_0x552c('0x4a')](_0x442158[_0x552c('0x49')]);_0x4e6fd1[_0x552c('0x4b')]=_[_0x552c('0x4c')](_0x4e6fd1[_0x552c('0x48')],_0x4e6fd1[_0x552c('0x49')]);_0x198b32[_0x552c('0x4d')]=_[_0x552c('0x4c')](_0x4e6fd1['model'],qs[_0x552c('0x4e')](_0x442158['query']['fields']));_0x198b32['attributes']=_0x198b32[_0x552c('0x4d')][_0x552c('0x4f')]?_0x198b32[_0x552c('0x4d')]:_0x4e6fd1[_0x552c('0x48')];if(!_0x442158[_0x552c('0x49')]['hasOwnProperty'](_0x552c('0x51'))){_0x198b32[_0x552c('0x36')]=qs[_0x552c('0x36')](_0x442158[_0x552c('0x49')][_0x552c('0x36')]);_0x198b32[_0x552c('0x34')]=qs[_0x552c('0x34')](_0x442158['query'][_0x552c('0x34')]);}_0x198b32['order']=qs[_0x552c('0x52')](_0x442158[_0x552c('0x49')][_0x552c('0x52')]);_0x198b32['where']=qs[_0x552c('0x4b')](_[_0x552c('0x54')](_0x442158[_0x552c('0x49')],_0x4e6fd1[_0x552c('0x4b')]));_0x198b32[_0x552c('0x53')][_0x552c('0x69')]=_0x3e2d8['id'];if(_0x442158[_0x552c('0x49')][_0x552c('0x55')]){_0x198b32[_0x552c('0x53')]=_[_0x552c('0x56')](_0x198b32['where'],{'$or':_[_0x552c('0x44')](_0x198b32[_0x552c('0x4d')],function(_0x4d5800){var _0x27e3b7={};_0x27e3b7[_0x4d5800]={'$like':'%'+_0x442158[_0x552c('0x49')][_0x552c('0x55')]+'%'};return _0x27e3b7;})});}_0x198b32=_['merge']({},_0x198b32,_0x442158[_0x552c('0x5d')]);return db[_0x552c('0x6e')][_0x552c('0x37')]({'where':_0x198b32[_0x552c('0x53')]})[_0x552c('0x3c')](function(_0x218e9a){_0x24781c[_0x552c('0x37')]=_0x218e9a;if(_0x442158[_0x552c('0x49')]['includeAll']){_0x198b32[_0x552c('0x58')]=[{'all':!![]}];}return db[_0x552c('0x6e')][_0x552c('0x59')](_0x198b32);})[_0x552c('0x3c')](function(_0x5709dd){_0x24781c[_0x552c('0x5a')]=_0x5709dd;return _0x24781c;});}})[_0x552c('0x3c')](respondWithFilteredResult(_0x3bb618,_0x198b32))[_0x552c('0x2f')](handleError(_0x3bb618,null));};exports[_0x552c('0x71')]=function(_0x5ddb6d,_0x3f3aa8,_0x390bb2){return db[_0x552c('0x45')][_0x552c('0x5e')]({'where':{'id':_0x5ddb6d[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3f3aa8,null))[_0x552c('0x3c')](function(_0x4fda65){if(_0x4fda65){return _0x4fda65[_0x552c('0x71')](_0x5ddb6d[_0x552c('0x49')][_0x552c('0x6c')]);}})[_0x552c('0x3c')](respondWithStatusCode(_0x3f3aa8,null))['catch'](handleError(_0x3f3aa8,null));};exports[_0x552c('0x72')]=function(_0x5ab09c,_0x3d7469,_0x33d52){return db['FaxInteraction'][_0x552c('0x5e')]({'where':{'id':_0x5ab09c[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3d7469,null))[_0x552c('0x3c')](function(_0x28be04){if(_0x28be04){return _0x28be04[_0x552c('0x72')](_0x5ab09c['body']['ids'],_[_0x552c('0x73')](_0x5ab09c[_0x552c('0x60')],[_0x552c('0x6c'),'id'])||{});}})[_0x552c('0x3c')](respondWithResult(_0x3d7469,null))['catch'](handleError(_0x3d7469,null));};exports['getInteractions']=function(_0x21da6a,_0x3374f5,_0x3477b5){var _0x559127={'raw':![],'where':{}};var _0x2d6354={};var _0x482851={'count':0x0,'rows':[]};return db['FaxAccount'][_0x552c('0x70')]({'where':{'id':_0x21da6a[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3374f5,null))[_0x552c('0x3c')](function(_0x2bd563){if(_0x2bd563){_0x2d6354['model']=_[_0x552c('0x4a')](db['FaxInteraction'][_0x552c('0x5c')]);_0x2d6354['query']=_['keys'](_0x21da6a[_0x552c('0x49')]);_0x2d6354[_0x552c('0x4b')]=_['intersection'](_0x2d6354['model'],_0x2d6354[_0x552c('0x49')]);_0x559127['attributes']=_[_0x552c('0x4c')](_0x2d6354[_0x552c('0x48')],qs[_0x552c('0x4e')](_0x21da6a[_0x552c('0x49')][_0x552c('0x4e')]));_0x559127[_0x552c('0x4d')]=_0x559127[_0x552c('0x4d')][_0x552c('0x4f')]?_0x559127[_0x552c('0x4d')]:_0x2d6354[_0x552c('0x48')];if(!_0x21da6a[_0x552c('0x49')][_0x552c('0x50')](_0x552c('0x51'))){_0x559127[_0x552c('0x36')]=qs[_0x552c('0x36')](_0x21da6a[_0x552c('0x49')][_0x552c('0x36')]);_0x559127['offset']=qs['offset'](_0x21da6a[_0x552c('0x49')][_0x552c('0x34')]);}_0x559127[_0x552c('0x74')]=qs[_0x552c('0x52')](_0x21da6a[_0x552c('0x49')][_0x552c('0x52')]);_0x559127[_0x552c('0x53')]=qs['filters'](_['pick'](_0x21da6a[_0x552c('0x49')],_0x2d6354[_0x552c('0x4b')]));_0x559127['where'][_0x552c('0x69')]=_0x2bd563['id'];if(_0x21da6a['query'][_0x552c('0x55')]){_0x559127['where']=_[_0x552c('0x56')](_0x559127[_0x552c('0x53')],{'$or':_[_0x552c('0x44')](_0x559127[_0x552c('0x4d')],function(_0x3b2c39){var _0x42d17f={};_0x42d17f[_0x3b2c39]={'$like':'%'+_0x21da6a[_0x552c('0x49')][_0x552c('0x55')]+'%'};return _0x42d17f;})});}_0x559127=_['merge']({},_0x559127,_0x21da6a[_0x552c('0x5d')]);return db[_0x552c('0x75')][_0x552c('0x37')]({'where':_0x559127[_0x552c('0x53')]})[_0x552c('0x3c')](function(_0x42389d){_0x482851[_0x552c('0x37')]=_0x42389d;if(_0x21da6a[_0x552c('0x49')][_0x552c('0x57')]){_0x559127['include']=[{'model':db[_0x552c('0x76')],'as':'Contact','required':![]},{'model':db[_0x552c('0x77')],'as':_0x552c('0x78'),'attributes':[_0x552c('0x41'),_0x552c('0x79'),_0x552c('0x7a')],'required':![]},{'model':db[_0x552c('0x7b')],'as':_0x552c('0x7c'),'attributes':['id',_0x552c('0x41'),'color'],'where':_0x21da6a[_0x552c('0x49')][_0x552c('0x7d')]?{'id':_0x21da6a['query']['tag']}:undefined,'required':_0x21da6a['query'][_0x552c('0x7d')]?!![]:![]}];}return db[_0x552c('0x75')][_0x552c('0x59')](_0x559127);})['then'](function(_0x54dc2d){_0x482851[_0x552c('0x5a')]=_0x54dc2d;return _0x482851;});}})['then'](respondWithFilteredResult(_0x3374f5,_0x559127))[_0x552c('0x2f')](handleError(_0x3374f5,null));};exports['addApplications']=function(_0x114e92,_0x5d6889,_0x2f365b){return db[_0x552c('0x45')][_0x552c('0x70')]({'where':{'id':_0x114e92[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x5d6889,null))['then'](function(_0x2a830a){if(_0x2a830a){return db['sequelize'][_0x552c('0x7e')](function(_0x121a3c){return db[_0x552c('0x7f')][_0x552c('0x3d')]({'where':{'FaxAccountId':_0x114e92[_0x552c('0x5b')]['id']},'transaction':_0x121a3c})[_0x552c('0x3c')](function(_0x14058e){var _0xf63792=_['map'](_0x114e92[_0x552c('0x60')],function(_0x2c968d){_0x2c968d[_0x552c('0x69')]=_0x114e92[_0x552c('0x5b')]['id'];return _0x2c968d;});return db[_0x552c('0x7f')]['bulkCreate'](_0xf63792,{'transaction':_0x121a3c});});})['then'](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x114e92[_0x552c('0x5b')]['id']},'order':_0x552c('0x80')});});}})[_0x552c('0x3c')](respondWithResult(_0x5d6889,null))[_0x552c('0x2f')](handleError(_0x5d6889,null));};exports[_0x552c('0x81')]=function(_0x5b4291,_0x1246ce,_0x4be854){var _0x31a05b={};var _0x45741e={};var _0x5f5ccb;var _0x2b7bba;return db['FaxAccount'][_0x552c('0x70')]({'where':{'id':_0x5b4291[_0x552c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1246ce,null))[_0x552c('0x3c')](function(_0x5da39b){if(_0x5da39b){_0x5f5ccb=_0x5da39b;_0x45741e[_0x552c('0x48')]=_['keys'](db[_0x552c('0x7f')][_0x552c('0x5c')]);_0x45741e[_0x552c('0x49')]=_['keys'](_0x5b4291[_0x552c('0x49')]);_0x45741e[_0x552c('0x4b')]=_[_0x552c('0x4c')](_0x45741e[_0x552c('0x48')],_0x45741e['query']);_0x31a05b[_0x552c('0x4d')]=_[_0x552c('0x4c')](_0x45741e[_0x552c('0x48')],qs[_0x552c('0x4e')](_0x5b4291[_0x552c('0x49')]['fields']));_0x31a05b[_0x552c('0x4d')]=_0x31a05b[_0x552c('0x4d')][_0x552c('0x4f')]?_0x31a05b['attributes']:_0x45741e['model'];_0x31a05b[_0x552c('0x74')]=qs['sort'](_0x5b4291[_0x552c('0x49')][_0x552c('0x52')]);_0x31a05b[_0x552c('0x53')]=qs[_0x552c('0x4b')](_['pick'](_0x5b4291[_0x552c('0x49')],_0x45741e[_0x552c('0x4b')]));if(_0x5b4291['query']['filter']){_0x31a05b[_0x552c('0x53')]=_['merge'](_0x31a05b[_0x552c('0x53')],{'$or':_[_0x552c('0x44')](_0x31a05b[_0x552c('0x4d')],function(_0x3c3cc2){var _0x4d918f={};_0x4d918f[_0x3c3cc2]={'$like':'%'+_0x5b4291[_0x552c('0x49')][_0x552c('0x55')]+'%'};return _0x4d918f;})});}_0x31a05b=_['merge']({},_0x31a05b,_0x5b4291[_0x552c('0x5d')]);return _0x5f5ccb[_0x552c('0x81')](_0x31a05b);}})[_0x552c('0x3c')](function(_0x1e82cd){if(_0x1e82cd){_0x2b7bba=_0x1e82cd[_0x552c('0x4f')];if(!_0x5b4291[_0x552c('0x49')]['hasOwnProperty'](_0x552c('0x51'))){_0x31a05b['limit']=qs[_0x552c('0x36')](_0x5b4291[_0x552c('0x49')][_0x552c('0x36')]);_0x31a05b[_0x552c('0x34')]=qs['offset'](_0x5b4291[_0x552c('0x49')][_0x552c('0x34')]);}return _0x5f5ccb[_0x552c('0x81')](_0x31a05b);}})['then'](function(_0x57a34c){if(_0x57a34c){return _0x57a34c?{'count':_0x2b7bba,'rows':_0x57a34c}:null;}})[_0x552c('0x3c')](respondWithResult(_0x1246ce,null))['catch'](handleError(_0x1246ce,null));};function Extension(_0x7e4e35,_0x204b73,_0x1b6ede,_0x37466d){this[_0x552c('0x82')]=_0x552c('0x83');this[_0x552c('0x84')]=_0x7e4e35[_0x552c('0x85')];this[_0x552c('0x86')]=_0x37466d;this[_0x552c('0x47')]=_0x552c('0x87');this['description']=_0x552c('0x88');this[_0x552c('0x69')]=_0x7e4e35['id'];this[_0x552c('0x80')]=_0x204b73;this[_0x552c('0x89')]=_0x1b6ede;}function createExtensionsReciveFax(_0x5396da){var _0x17012e=0x1;var _0x189586=[];_0x189586[_0x552c('0x8a')](new Extension(_0x5396da,_0x17012e,'',_0x552c('0x8b')));_0x17012e+=0x1;_0x189586[_0x552c('0x8a')](new Extension(_0x5396da,_0x17012e,'CDR(type)=inbound-fax',_0x552c('0x8c')));_0x17012e+=0x1;for(var _0x351e3c in _0x5396da){if(_0x5396da[_0x552c('0x50')](_0x351e3c)&&(_0x351e3c===_0x552c('0x8d')||_0x351e3c===_0x552c('0x85')||_0x351e3c===_0x552c('0x8e')||_0x351e3c===_0x552c('0x8f')||_0x351e3c===_0x552c('0x90')||_0x351e3c===_0x552c('0x91')||_0x351e3c===_0x552c('0x92')||_0x351e3c===_0x552c('0x93')||_0x351e3c===_0x552c('0x94'))){_0x189586['push'](new Extension(_0x5396da,_0x17012e,'FAXOPT('+_0x351e3c+')='+_0x5396da[_0x351e3c],_0x552c('0x8c')));_0x17012e+=0x1;}}_0x189586[_0x552c('0x8a')](new Extension(_0x5396da,_0x17012e,'6',_0x552c('0x95')));_0x17012e+=0x1;_0x189586[_0x552c('0x8a')](new Extension(_0x5396da,_0x17012e,_0x552c('0x96'),_0x552c('0x97')));_0x17012e=0x0;return _0x189586;}exports['addAccountApplications']=function(_0x4a1c7a,_0x22a599,_0x320715){var _0x31ad31;return db[_0x552c('0x98')][_0x552c('0x7e')](function(_0x43713f){return db[_0x552c('0x45')]['create'](_0x4a1c7a[_0x552c('0x60')],{'transaction':_0x43713f})[_0x552c('0x3c')](function(_0x56f81d){_0x31ad31=_0x56f81d['get']({'plain':!![]});return db['VoiceExtension'][_0x552c('0x99')](createExtensionsReciveFax(_0x31ad31),{'transaction':_0x43713f});});})['then'](function(){return _0x31ad31;})[_0x552c('0x3c')](respondWithResult(_0x22a599,null))[_0x552c('0x2f')](handleError(_0x22a599,null));};exports['updateAccountApplications']=function(_0x21344d,_0x3f59a7,_0x10722d){var _0x420f35;return db[_0x552c('0x98')][_0x552c('0x7e')](function(_0x104146){return db[_0x552c('0x45')][_0x552c('0x3b')](_0x21344d['body'],{'where':{'id':_0x21344d['body']['id']},'transaction':_0x104146})['then'](function(_0x28c8f5){return db[_0x552c('0x9a')][_0x552c('0x3d')]({'where':{'FaxAccountId':_0x21344d['body']['id']},'transaction':_0x104146})[_0x552c('0x3c')](function(_0x31a77f){return db[_0x552c('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0x552c('0x73')](_0x21344d[_0x552c('0x60')],[_0x552c('0x9b'),'key',_0x552c('0x9c'),_0x552c('0x9d'),_0x552c('0x9e'),'ListId'])),{'transaction':_0x104146});});});})[_0x552c('0x3c')](function(){return db[_0x552c('0x45')][_0x552c('0x9f')](_0x21344d['body']['id']);})[_0x552c('0x3c')](respondWithResult(_0x3f59a7,null))[_0x552c('0x2f')](handleError(_0x3f59a7,null));};exports[_0x552c('0xa0')]=function(_0x2b5d07,_0x3b229a,_0x397b99){var _0x330887={'raw':!![],'where':{}};var _0x4464a8={};var _0x30d761={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2b5d07[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3b229a,null))[_0x552c('0x3c')](function(_0x57e8fe){if(_0x57e8fe){_0x4464a8[_0x552c('0x48')]=_[_0x552c('0x4a')](db[_0x552c('0xa1')][_0x552c('0x5c')]);_0x4464a8[_0x552c('0x49')]=_[_0x552c('0x4a')](_0x2b5d07[_0x552c('0x49')]);_0x4464a8['filters']=_[_0x552c('0x4c')](_0x4464a8['model'],_0x4464a8[_0x552c('0x49')]);_0x330887[_0x552c('0x4d')]=_['intersection'](_0x4464a8['model'],qs[_0x552c('0x4e')](_0x2b5d07[_0x552c('0x49')][_0x552c('0x4e')]));_0x330887[_0x552c('0x4d')]=_0x330887['attributes'][_0x552c('0x4f')]?_0x330887[_0x552c('0x4d')]:_0x4464a8[_0x552c('0x48')];if(!_0x2b5d07[_0x552c('0x49')][_0x552c('0x50')](_0x552c('0x51'))){_0x330887[_0x552c('0x36')]=qs[_0x552c('0x36')](_0x2b5d07[_0x552c('0x49')]['limit']);_0x330887[_0x552c('0x34')]=qs['offset'](_0x2b5d07[_0x552c('0x49')][_0x552c('0x34')]);}_0x330887[_0x552c('0x74')]=qs[_0x552c('0x52')](_0x2b5d07['query'][_0x552c('0x52')]);_0x330887[_0x552c('0x53')]=qs['filters'](_[_0x552c('0x54')](_0x2b5d07['query'],_0x4464a8[_0x552c('0x4b')]));_0x330887[_0x552c('0x53')]['FaxAccountId']=_0x57e8fe['id'];if(_0x2b5d07[_0x552c('0x49')][_0x552c('0x55')]){_0x330887[_0x552c('0x53')]=_[_0x552c('0x56')](_0x330887['where'],{'$or':_['map'](_0x330887['attributes'],function(_0x16bbde){var _0x10a4cd={};_0x10a4cd[_0x16bbde]={'$like':'%'+_0x2b5d07[_0x552c('0x49')][_0x552c('0x55')]+'%'};return _0x10a4cd;})});}if(_0x2b5d07[_0x552c('0x49')][_0x552c('0xa2')]){var _0x19ab9f=_0x2b5d07['query'][_0x552c('0xa2')][_0x552c('0xa3')](',');var _0x132148={};_0x132148[_0x19ab9f[0x0]]={'$gte':moment(_0x19ab9f[0x1])[_0x552c('0xa4')](_0x552c('0xa5'))};_0x330887[_0x552c('0x53')]=_['merge'](_0x330887[_0x552c('0x53')],_0x132148);}_0x330887=_[_0x552c('0x56')]({},_0x330887,_0x2b5d07['options']);return db[_0x552c('0xa1')][_0x552c('0x37')]({'where':_0x330887[_0x552c('0x53')]})['then'](function(_0x3652c6){_0x30d761[_0x552c('0x37')]=_0x3652c6;if(_0x2b5d07[_0x552c('0x49')][_0x552c('0x57')]){_0x330887[_0x552c('0x58')]=[{'all':!![]}];}return db[_0x552c('0xa1')]['findAll'](_0x330887);})[_0x552c('0x3c')](function(_0x1bc04f){_0x30d761[_0x552c('0x5a')]=_0x1bc04f;return _0x30d761;});}})[_0x552c('0x3c')](respondWithFilteredResult(_0x3b229a,_0x330887))['catch'](handleError(_0x3b229a,null));};exports[_0x552c('0xa6')]=function(_0xfff6bc,_0x2d95e9,_0x3fb9d1){var _0x313766,_0x4c30aa={},_0x4351e2;if(_0xfff6bc[_0x552c('0x60')]['to']){_0x4351e2=_0xfff6bc[_0x552c('0x60')]['to'][0x0];}return db[_0x552c('0x45')]['find']({'where':{'id':_0xfff6bc[_0x552c('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x552c('0xa7'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x4351e2},'limit':0x1,'order':[[_0x552c('0x9d'),_0x552c('0xa8')]]}]}]})[_0x552c('0x3c')](handleEntityNotFound(_0x2d95e9,null))['then'](function(_0x52195e){_0x313766=_0x52195e;if(_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')]&&_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][_0x552c('0x4f')]){for(var _0x4bae34=0x0;_0x4bae34<_0xfff6bc[_0x552c('0x60')]['attachments']['length'];_0x4bae34+=0x1){_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][_0x4bae34]={'filename':_0xfff6bc['body'][_0x552c('0xa9')][_0x4bae34][_0x552c('0x41')],'id':_0xfff6bc['body'][_0x552c('0xa9')][_0x4bae34]['id'],'path':path[_0x552c('0xaa')](config['root'],_0x552c('0xab'),_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][_0x4bae34][_0x552c('0xac')])};}}return respondWithRpcPromise(_0x552c('0xad'),_0x552c('0xad'),{'FaxAccountId':_[_0x552c('0xae')](_0xfff6bc[_0x552c('0x5b')]['id'])?undefined:_0xfff6bc[_0x552c('0x5b')]['id'],'path':_[_0x552c('0xae')](_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][0x0][_0x552c('0x8')])?undefined:_0xfff6bc[_0x552c('0x60')]['attachments'][0x0][_0x552c('0x8')],'fax':_[_0x552c('0xae')](_0xfff6bc['body']['to'][0x0])?undefined:_0xfff6bc[_0x552c('0x60')]['to'][0x0]},client9002);})[_0x552c('0x3c')](function(){if(_0x313766){if(_[_0x552c('0xae')](_0xfff6bc[_0x552c('0x60')][_0x552c('0xaf')])){_0xfff6bc['body'][_0x552c('0xaf')]=util[_0x552c('0xa4')](_0x552c('0xb0'),_0x313766[_0x552c('0x41')],_0x313766[_0x552c('0xb1')]);}if(_0x313766[_0x552c('0xa7')]){if(_0x313766['List'][_0x552c('0xb2')][_0x552c('0x4f')]){return _0x313766[_0x552c('0xa7')]['Contacts'][0x0];}else{return db[_0x552c('0x76')][_0x552c('0x5f')](_['defaults'](_0xfff6bc[_0x552c('0x60')],{'firstName':_0xfff6bc[_0x552c('0x60')]['to'][0x0],'phone':_0xfff6bc['body']['to'][0x0],'fax':_0xfff6bc[_0x552c('0x60')]['to'][0x0],'ListId':_0x313766['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x552c('0xb3'));}})['then'](function(_0x521e1a){if(_0x521e1a){return db['FaxInteraction'][_0x552c('0x5e')]({'where':{'ContactId':_0x521e1a['id'],'closed':![],'FaxAccountId':_0x313766['id']}})[_0x552c('0x3c')](function(_0x5291bf){if(_0x5291bf){return[_0x5291bf,![]];}return db[_0x552c('0x75')]['create']({'UserId':_0xfff6bc[_0x552c('0x61')]['id'],'ContactId':_0x521e1a['id'],'FaxAccountId':_0x313766['id'],'fax':_0xfff6bc[_0x552c('0x60')]['to'][0x0],'firstMsgDirection':_0x552c('0xb4'),'Messages':[_[_0x552c('0x56')](_0xfff6bc[_0x552c('0x60')],{'read':![],'body':_0xfff6bc['body']['attachments'][0x0][_0x552c('0xb5')],'FaxAccountId':_0x313766['id'],'UserId':_0xfff6bc[_0x552c('0x61')]['id'],'ContactId':_0x521e1a['id'],'AttachmentId':_0xfff6bc[_0x552c('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x552c('0xa1')],'as':_0x552c('0xb6')}]})[_0x552c('0x3c')](function(_0x1579a8){return[_0x1579a8,!![]];});});}else{throw new Error(_0x552c('0xb7'));}})[_0x552c('0xb8')](function(_0x33fe74,_0x2f4b8d){if(_0x2f4b8d){return _0x33fe74;}return db['FaxMessage'][_0x552c('0x5f')]({'direction':_0x552c('0xb4'),'read':![],'body':_0xfff6bc['body']['attachments'][0x0][_0x552c('0xb5')],'FaxAccountId':_0x313766['id'],'FaxInteractionId':_0x33fe74['id'],'UserId':_0xfff6bc[_0x552c('0x61')]['id'],'ContactId':_0x33fe74[_0x552c('0xb9')],'AttachmentId':_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][0x0]['id']})[_0x552c('0x3c')](function(_0x1bd069){_0x33fe74[_0x552c('0xba')][_0x552c('0xb6')]=[];_0x33fe74[_0x552c('0xba')][_0x552c('0xb6')][_0x552c('0x8a')](_0x1bd069[_0x552c('0xba')]);return _0x33fe74;});})['then'](function(_0x50c658){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x552c('0xae')](_0xfff6bc[_0x552c('0x5b')]['id'])?undefined:_0xfff6bc[_0x552c('0x5b')]['id'],'path':_['isNil'](_0xfff6bc['body'][_0x552c('0xa9')][0x0][_0x552c('0x8')])?undefined:_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][0x0]['path'],'fax':_['isNil'](_0xfff6bc['body']['to'][0x0])?undefined:_0xfff6bc[_0x552c('0x60')]['to'][0x0],'AttachmentId':_0xfff6bc[_0x552c('0x60')][_0x552c('0xa9')][0x0]['id']},client9002)[_0x552c('0x3c')](function(_0x488374){logger[_0x552c('0x26')](_0x552c('0xbb'),_0x488374);})[_0x552c('0x2f')](function(_0x311ff8){logger[_0x552c('0x26')]('SendFaxRpc,\x20%s',_0x311ff8);});return _0x50c658;})[_0x552c('0x3c')](respondWithResult(_0x2d95e9,null))[_0x552c('0x2f')](handleError(_0x2d95e9,null));};exports['addAgents']=function(_0x1ab91d,_0x4a5a53,_0x4ec491){return db[_0x552c('0x45')][_0x552c('0x5e')]({'where':{'id':_0x1ab91d[_0x552c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4a5a53,null))['then'](function(_0x426438){if(_0x426438){return _0x426438[_0x552c('0xbc')](_0x1ab91d[_0x552c('0x60')][_0x552c('0x6c')],_[_0x552c('0x73')](_0x1ab91d['body'],['ids','id'])||{})['spread'](function(_0x4adf8c){for(var _0x558b3d=0x0;_0x558b3d<_0x1ab91d[_0x552c('0x60')][_0x552c('0x6c')][_0x552c('0x4f')];_0x558b3d+=0x1){socket[_0x552c('0xbd')](_0x552c('0xbe'),{'UserId':Number(_0x1ab91d['body'][_0x552c('0x6c')][_0x558b3d]),'FaxAccountId':Number(_0x1ab91d['params']['id'])});}return _0x4adf8c;});}})[_0x552c('0x3c')](respondWithResult(_0x4a5a53,null))[_0x552c('0x2f')](handleError(_0x4a5a53,null));};exports['removeAgents']=function(_0x5c9d77,_0x18fea8,_0x4020b2){return db[_0x552c('0x45')][_0x552c('0x5e')]({'where':{'id':_0x5c9d77[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x18fea8,null))[_0x552c('0x3c')](function(_0x444492){if(_0x444492){return _0x444492[_0x552c('0xbf')](_0x5c9d77['query']['ids'])[_0x552c('0x3c')](function(){if(_[_0x552c('0xc0')](_0x5c9d77[_0x552c('0x49')][_0x552c('0x6c')])){for(var _0x446f7d=0x0;_0x446f7d<_0x5c9d77[_0x552c('0x49')][_0x552c('0x6c')][_0x552c('0x4f')];_0x446f7d+=0x1){socket['emit'](_0x552c('0xc1'),{'UserId':Number(_0x5c9d77[_0x552c('0x49')][_0x552c('0x6c')][_0x446f7d]),'FaxAccountId':Number(_0x5c9d77[_0x552c('0x5b')]['id'])});}}else{socket[_0x552c('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x5c9d77[_0x552c('0x49')][_0x552c('0x6c')]),'FaxAccountId':Number(_0x5c9d77[_0x552c('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x18fea8,null))[_0x552c('0x2f')](handleError(_0x18fea8,null));};exports[_0x552c('0xc2')]=function(_0x3d1947,_0x3aea87,_0x257024){var _0x595580={};var _0x118d24={};var _0x3c2baf;var _0x3af542;return db[_0x552c('0x45')][_0x552c('0x70')]({'where':{'id':_0x3d1947[_0x552c('0x5b')]['id']}})[_0x552c('0x3c')](handleEntityNotFound(_0x3aea87,null))[_0x552c('0x3c')](function(_0x572d99){if(_0x572d99){_0x3c2baf=_0x572d99;_0x118d24[_0x552c('0x48')]=_[_0x552c('0x4a')](db['User']['rawAttributes']);_0x118d24[_0x552c('0x49')]=_[_0x552c('0x4a')](_0x3d1947['query']);_0x118d24[_0x552c('0x4b')]=_['intersection'](_0x118d24['model'],_0x118d24[_0x552c('0x49')]);_0x595580['attributes']=_['intersection'](_0x118d24[_0x552c('0x48')],qs[_0x552c('0x4e')](_0x3d1947['query'][_0x552c('0x4e')]));_0x595580[_0x552c('0x4d')]=_0x595580['attributes']['length']?_0x595580[_0x552c('0x4d')]:_0x118d24['model'];_0x595580[_0x552c('0x74')]=qs[_0x552c('0x52')](_0x3d1947[_0x552c('0x49')][_0x552c('0x52')]);_0x595580['where']=qs['filters'](_['pick'](_0x3d1947[_0x552c('0x49')],_0x118d24['filters']));if(_0x3d1947[_0x552c('0x49')][_0x552c('0x55')]){_0x595580['where']=_['merge'](_0x595580['where'],{'$or':_['map'](_0x595580[_0x552c('0x4d')],function(_0x274f7c){var _0x220d8b={};_0x220d8b[_0x274f7c]={'$like':'%'+_0x3d1947[_0x552c('0x49')]['filter']+'%'};return _0x220d8b;})});}_0x595580=_[_0x552c('0x56')]({},_0x595580,_0x3d1947[_0x552c('0x5d')]);return _0x3c2baf[_0x552c('0xc2')](_0x595580);}})[_0x552c('0x3c')](function(_0x5d8950){if(_0x5d8950){_0x3af542=_0x5d8950[_0x552c('0x4f')];if(!_0x3d1947[_0x552c('0x49')]['hasOwnProperty'](_0x552c('0x51'))){_0x595580[_0x552c('0x36')]=qs['limit'](_0x3d1947[_0x552c('0x49')]['limit']);_0x595580['offset']=qs[_0x552c('0x34')](_0x3d1947[_0x552c('0x49')][_0x552c('0x34')]);}return _0x3c2baf[_0x552c('0xc2')](_0x595580);}})[_0x552c('0x3c')](function(_0x577a03){if(_0x577a03){return _0x577a03?{'count':_0x3af542,'rows':_0x577a03}:null;}})['then'](respondWithResult(_0x3aea87,null))[_0x552c('0x2f')](handleError(_0x3aea87,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b790e7f..3c746ef 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 _0x7e2e=['save','remove','emit','exports','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x4a7a57,_0x306c38){var _0x109991=function(_0x1880c6){while(--_0x1880c6){_0x4a7a57['push'](_0x4a7a57['shift']());}};_0x109991(++_0x306c38);}(_0x7e2e,0x193));var _0xe7e2=function(_0x2eb66f,_0x18d160){_0x2eb66f=_0x2eb66f-0x0;var _0x15abf1=_0x7e2e[_0x2eb66f];return _0x15abf1;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xe7e2('0x0'))['db'][_0xe7e2('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe7e2('0x2')](0x0);var events={'afterCreate':_0xe7e2('0x3'),'afterUpdate':'update','afterDestroy':_0xe7e2('0x4')};function emitEvent(_0x9cacab){return function(_0x11bf71,_0x46ce58,_0x39b543){FaxAccountEvents[_0xe7e2('0x5')](_0x9cacab+':'+_0x11bf71['id'],_0x11bf71);FaxAccountEvents[_0xe7e2('0x5')](_0x9cacab,_0x11bf71);_0x39b543(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xe7e2('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0xf960=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxAccount'];(function(_0x27e9b3,_0x1b17af){var _0x553cac=function(_0x5c368e){while(--_0x5c368e){_0x27e9b3['push'](_0x27e9b3['shift']());}};_0x553cac(++_0x1b17af);}(_0xf960,0xde));var _0x0f96=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0xf960[_0x58efa6];return _0x5d643c;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x0f96('0x0'))['db'][_0x0f96('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0f96('0x2')](0x0);var events={'afterCreate':_0x0f96('0x3'),'afterUpdate':'update','afterDestroy':_0x0f96('0x4')};function emitEvent(_0x370dcb){return function(_0x5f4622,_0x26b2ee,_0xba6655){FaxAccountEvents[_0x0f96('0x5')](_0x370dcb+':'+_0x5f4622['id'],_0x5f4622);FaxAccountEvents['emit'](_0x370dcb,_0x5f4622);_0xba6655(null);};}for(var e in events){if(events[_0x0f96('0x6')](e)){var event=events[e];FaxAccount[_0x0f96('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 0e049ec..4b0a57e 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 _0xc0be=['moment','bluebird','path','exports','define','FaxAccount','fax_accounts','lodash','util'];(function(_0x4c2e88,_0x5bfd5a){var _0x1f60a3=function(_0x517e8a){while(--_0x517e8a){_0x4c2e88['push'](_0x4c2e88['shift']());}};_0x1f60a3(++_0x5bfd5a);}(_0xc0be,0xbb));var _0xec0b=function(_0x531130,_0x457c4e){_0x531130=_0x531130-0x0;var _0x16eb0e=_0xc0be[_0x531130];return _0x16eb0e;};'use strict';var _=require(_0xec0b('0x0'));var util=require(_0xec0b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xec0b('0x2'));var BPromise=require(_0xec0b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec0b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xec0b('0x5')]=function(_0x24316c,_0x5a2db1){return _0x24316c[_0xec0b('0x6')](_0xec0b('0x7'),attributes,{'tableName':_0xec0b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89e6=['path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','bluebird'];(function(_0x32a548,_0x2cbe5a){var _0x2a7d54=function(_0x588c14){while(--_0x588c14){_0x32a548['push'](_0x32a548['shift']());}};_0x2a7d54(++_0x2cbe5a);}(_0x89e6,0x75));var _0x689e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x89e6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x689e('0x0'));var util=require(_0x689e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x689e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x689e('0x3'));var rimraf=require(_0x689e('0x4'));var config=require('../../config/environment');var attributes=require(_0x689e('0x5'));module[_0x689e('0x6')]=function(_0x3f6c0e,_0x10d7e8){return _0x3f6c0e[_0x689e('0x7')](_0x689e('0x8'),attributes,{'tableName':_0x689e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index db55efc..2ed35df 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 _0xe60d=['./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','debug','catch','NotifyFaxAccount','body','CmContact','difference','keys','updatedAt','createdAt','CompanyId','ListId','from','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','get','applications','Applications','list','priority','asc','length','defaults','create','contact','FaxInteraction','find','Contact\x20not\x20found','autoclose','close','unmanaged','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x22681f,_0x1c6ba3){var _0x133109=function(_0x5d83c0){while(--_0x5d83c0){_0x22681f['push'](_0x22681f['shift']());}};_0x133109(++_0x1c6ba3);}(_0xe60d,0x151));var _0xde60=function(_0x3ba701,_0x5beef6){_0x3ba701=_0x3ba701-0x0;var _0x32e966=_0xe60d[_0x3ba701];return _0x32e966;};'use strict';var _=require(_0xde60('0x0'));var util=require(_0xde60('0x1'));var moment=require(_0xde60('0x2'));var BPromise=require(_0xde60('0x3'));var rs=require(_0xde60('0x4'));var fs=require('fs');var Redis=require(_0xde60('0x5'));var db=require(_0xde60('0x6'))['db'];var utils=require(_0xde60('0x7'));var logger=require('../../config/logger')(_0xde60('0x8'));var config=require(_0xde60('0x9'));var jayson=require(_0xde60('0xa'));var client=jayson['client'][_0xde60('0xb')]({'port':0x232c});config['redis']=_['defaults'](config[_0xde60('0xc')],{'host':_0xde60('0xd'),'port':0x18eb});var socket=require(_0xde60('0xe'))(new Redis(config[_0xde60('0xc')]));require(_0xde60('0xf'))[_0xde60('0x10')](socket);function respondWithRpcPromise(_0x82df9c,_0x529dc5,_0x4d1eed){return new BPromise(function(_0x255f3d,_0x436068){return client['request'](_0x82df9c,_0x4d1eed)[_0xde60('0x11')](function(_0x430ceb){logger['info'](_0xde60('0x12'),_0x529dc5,_0xde60('0x13'));logger['debug'](_0xde60('0x14'),_0x529dc5,_0xde60('0x13'),JSON[_0xde60('0x15')](_0x430ceb));if(_0x430ceb[_0xde60('0x16')]){if(_0x430ceb[_0xde60('0x16')]['code']===0x1f4){logger[_0xde60('0x16')](_0xde60('0x12'),_0x529dc5,_0x430ceb['error'][_0xde60('0x17')]);return _0x436068(_0x430ceb[_0xde60('0x16')][_0xde60('0x17')]);}logger[_0xde60('0x16')](_0xde60('0x12'),_0x529dc5,_0x430ceb[_0xde60('0x16')][_0xde60('0x17')]);return _0x255f3d(_0x430ceb[_0xde60('0x16')][_0xde60('0x17')]);}else{logger[_0xde60('0x18')](_0xde60('0x12'),_0x529dc5,'request\x20sent');_0x255f3d(_0x430ceb['result'][_0xde60('0x17')]);}})['catch'](function(_0x38a391){logger[_0xde60('0x16')](_0xde60('0x12'),_0x529dc5,_0x38a391);_0x436068(_0x38a391);});});}exports[_0xde60('0x19')]=function(_0x2c308b){var _0xe45d60=this;return new Promise(function(_0x133769,_0x19b2ec){return db[_0xde60('0x1a')][_0xde60('0x1b')]({'raw':_0x2c308b[_0xde60('0x1c')]?_0x2c308b[_0xde60('0x1c')][_0xde60('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c308b[_0xde60('0x1c')]?_0x2c308b[_0xde60('0x1c')]['where']||null:null,'attributes':_0x2c308b['options']?_0x2c308b[_0xde60('0x1c')][_0xde60('0x1e')]||null:null,'limit':_0x2c308b[_0xde60('0x1c')]?_0x2c308b[_0xde60('0x1c')][_0xde60('0x1f')]||null:null,'include':_0x2c308b[_0xde60('0x1c')]?_0x2c308b['options'][_0xde60('0x20')]?_[_0xde60('0x21')](_0x2c308b[_0xde60('0x1c')][_0xde60('0x20')],function(_0x215768){return{'model':db[_0x215768[_0xde60('0x22')]],'as':_0x215768['as'],'attributes':_0x215768[_0xde60('0x1e')],'include':_0x215768[_0xde60('0x20')]?_[_0xde60('0x21')](_0x215768[_0xde60('0x20')],function(_0x2432aa){return{'model':db[_0x2432aa[_0xde60('0x22')]],'as':_0x2432aa['as'],'attributes':_0x2432aa[_0xde60('0x1e')],'include':_0x2432aa[_0xde60('0x20')]?_[_0xde60('0x21')](_0x2432aa[_0xde60('0x20')],function(_0x2dfe3e){return{'model':db[_0x2dfe3e[_0xde60('0x22')]],'as':_0x2dfe3e['as'],'attributes':_0x2dfe3e[_0xde60('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde60('0x11')](function(_0x46a73d){logger[_0xde60('0x18')](_0xde60('0x19'),_0x2c308b);logger[_0xde60('0x23')](_0xde60('0x19'),_0x2c308b,JSON[_0xde60('0x15')](_0x46a73d));_0x133769(_0x46a73d);})[_0xde60('0x24')](function(_0xfbaf9e){logger[_0xde60('0x16')](_0xde60('0x19'),_0xfbaf9e[_0xde60('0x17')],_0x2c308b);_0x19b2ec(_0xe45d60[_0xde60('0x16')](0x1f4,_0xfbaf9e[_0xde60('0x17')]));});});};exports[_0xde60('0x25')]=function(_0x19b47e,_0x443a92,_0x5821c6){var _0x3b3165=this;return new Promise(function(_0x5ce277,_0x3afa62){var _0x442089={'body':_0x19b47e[_0xde60('0x26')],'channel':'fax'};var _0x4ca03c=[];var _0x3703f4=[];var _0x2b6804={};return db[_0xde60('0x27')]['describe']()[_0xde60('0x11')](function(_0x644aa0){if(!_0x644aa0){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x4ca03c=_[_0xde60('0x28')](_[_0xde60('0x29')](_0x644aa0),['createdAt',_0xde60('0x2a')]);_0x3703f4=_[_0xde60('0x28')](_[_0xde60('0x29')](_0x644aa0),[_0xde60('0x2b'),_0xde60('0x2a'),_0xde60('0x2c'),_0xde60('0x2d')]);if(_0x19b47e[_0xde60('0x26')]['id']){delete _0x19b47e[_0xde60('0x26')]['id'];}if(_['isNil'](_0x19b47e['body'][_0xde60('0x2e')])){throw new db[(_0xde60('0x2f'))][(_0xde60('0x30'))](_0xde60('0x31'));}if(_[_0xde60('0x32')](_0x19b47e['body'][_0xde60('0x26')])||_0x19b47e[_0xde60('0x26')][_0xde60('0x26')]===''){throw new db[(_0xde60('0x2f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xde60('0x32')](_0x19b47e[_0xde60('0x26')][_0xde60('0x33')])){throw new db[(_0xde60('0x2f'))][(_0xde60('0x30'))](_0xde60('0x34')+_0x3703f4);}if(!_[_0xde60('0x35')](_0x3703f4,_0x19b47e[_0xde60('0x26')][_0xde60('0x33')])){throw new db[(_0xde60('0x2f'))]['ValidationError'](_0xde60('0x36')+_0x3703f4);}_0x2b6804[_0x19b47e[_0xde60('0x26')][_0xde60('0x33')]]=_0x19b47e[_0xde60('0x26')][_0xde60('0x2e')];})[_0xde60('0x11')](function(){return db[_0xde60('0x1a')]['find']({'where':{'id':_0x19b47e[_0xde60('0x37')]['id']},'include':[{'model':db[_0xde60('0x38')],'as':_0xde60('0x39'),'include':[{'model':db['CmContact'],'as':_0xde60('0x3a'),'where':_0x2b6804,'limit':0x1,'order':[[_0xde60('0x2a'),'DESC']]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0xde60('0x11')](function(_0x89d8df){if(_0x89d8df&&_0x89d8df[_0xde60('0x39')]){var _0x4437cb=_0x89d8df[_0xde60('0x3b')]({'plain':!![]});_0x442089[_0xde60('0x37')]=_0x4437cb;_0x442089[_0xde60('0x3c')]=_0x4437cb[_0xde60('0x3d')];_0x442089[_0xde60('0x3e')]=_0x4437cb[_0xde60('0x39')];_0x442089[_0xde60('0x3c')]=_['orderBy'](_0x442089['applications'],[_0xde60('0x3f')],[_0xde60('0x40')]);if(_0x442089[_0xde60('0x37')]['Applications']){delete _0x442089[_0xde60('0x37')][_0xde60('0x3d')];}if(_0x442089[_0xde60('0x37')][_0xde60('0x39')]&&_0x442089[_0xde60('0x37')]['List']['Contacts'][_0xde60('0x41')]){return _0x442089[_0xde60('0x37')]['List'][_0xde60('0x3a')][0x0];}var _0x9d252d=_[_0xde60('0x42')](_0x19b47e[_0xde60('0x26')],{'firstName':_0x19b47e[_0xde60('0x26')][_0xde60('0x2e')],'ListId':_0x4437cb['ListId']});_0x9d252d[_0x19b47e['body'][_0xde60('0x33')]]=_0x19b47e['body'][_0xde60('0x2e')];return db[_0xde60('0x27')][_0xde60('0x43')](_0x9d252d,{'fields':_0x4ca03c,'raw':!![]});}})['then'](function(_0x42b775){_0x442089[_0xde60('0x44')]=_0x42b775;if(_0x42b775){var _0x1ba1f4={'ContactId':_0x42b775['id'],'FaxAccountId':_0x19b47e[_0xde60('0x37')]['id'],'fax':_0x42b775['fax']};return db[_0xde60('0x45')][_0xde60('0x46')]({'where':{'ContactId':_0x42b775['id'],'closed':![],'FaxAccountId':_0x19b47e[_0xde60('0x37')]['id']}})[_0xde60('0x11')](function(_0x261439){if(_0x261439){return[_0x261439,![]];}return db[_0xde60('0x45')][_0xde60('0x43')](_0x1ba1f4)[_0xde60('0x11')](function(_0x2275c6){return[_0x2275c6,!![]];});});}else{throw new Error(_0xde60('0x47'));}})['spread'](function(_0xd634df,_0x4b2b25){var _0x11771c=_0xd634df[_0xde60('0x3b')]({'plain':!![]});if(_0x4b2b25){if(_0x442089[_0xde60('0x37')][_0xde60('0x48')]){_0x442089['applications']['push']({'id':0x0,'priority':_0x442089['applications'][_0xde60('0x41')]+0x1,'app':_0xde60('0x49'),'appdata':_0xde60('0x4a'),'interval':'*,*,*,*'});}_0x11771c[_0xde60('0x4b')]=!![];}else{_0x11771c[_0xde60('0x4b')]=![];}_0x442089[_0xde60('0x4c')]=_0x11771c;return db[_0xde60('0x4d')]['create']({'body':_0x19b47e['body'][_0xde60('0x26')],'FaxAccountId':_0x19b47e[_0xde60('0x37')]['id'],'FaxInteractionId':_0xd634df['id'],'direction':'in','ContactId':_0xd634df['ContactId'],'AttachmentId':_0x19b47e[_0xde60('0x26')][_0xde60('0x4e')]});})[_0xde60('0x11')](function(_0x417d2a){_0x442089[_0xde60('0x17')]=_0x417d2a;if(_0x442089[_0xde60('0x4c')][_0xde60('0x4f')]){return db[_0xde60('0x50')][_0xde60('0x46')]({'attributes':['id',_0xde60('0x51')],'where':{'id':_0x442089['interaction'][_0xde60('0x4f')]}})[_0xde60('0x11')](function(_0x40fc97){if(_0x40fc97){_0x442089['applications'][_0xde60('0x52')]({'id':0x0,'priority':0x0,'app':_0xde60('0x53'),'appdata':_0x40fc97[_0xde60('0x51')]+','+(_0x442089[_0xde60('0x37')][_0xde60('0x54')]||0xa),'interval':_0xde60('0x55')});}return respondWithRpcPromise(_0xde60('0x56'),_0xde60('0x57'),_0x442089);});}return respondWithRpcPromise(_0xde60('0x56'),'startRouting',_0x442089);})['then'](function(_0x19ecdf){_0x5ce277(_0x19ecdf);})[_0xde60('0x24')](function(_0xe0813d){_0x3afa62(_0x3b3165[_0xde60('0x16')](0x1f4,_0xe0813d[_0xde60('0x17')]));});});}; \ No newline at end of file +var _0xfaee=['no\x20available\x20attributes','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','get','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','User','name','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','GetFaxAccount','findAll','options','raw','attributes','limit','include','map','model','then','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0xfaee,0x1a0));var _0xefae=function(_0x58779c,_0xe8471b){_0x58779c=_0x58779c-0x0;var _0x5e1897=_0xfaee[_0x58779c];return _0x5e1897;};'use strict';var _=require('lodash');var util=require(_0xefae('0x0'));var moment=require('moment');var BPromise=require(_0xefae('0x1'));var rs=require(_0xefae('0x2'));var fs=require('fs');var Redis=require(_0xefae('0x3'));var db=require(_0xefae('0x4'))['db'];var utils=require(_0xefae('0x5'));var logger=require(_0xefae('0x6'))(_0xefae('0x7'));var config=require(_0xefae('0x8'));var jayson=require(_0xefae('0x9'));var client=jayson[_0xefae('0xa')][_0xefae('0xb')]({'port':0x232c});config[_0xefae('0xc')]=_['defaults'](config[_0xefae('0xc')],{'host':_0xefae('0xd'),'port':0x18eb});var socket=require(_0xefae('0xe'))(new Redis(config['redis']));require(_0xefae('0xf'))[_0xefae('0x10')](socket);function respondWithRpcPromise(_0x7f6f96,_0x36fb3e,_0x2c9164){return new BPromise(function(_0x30d9ea,_0x1245c2){return client['request'](_0x7f6f96,_0x2c9164)['then'](function(_0x219e1f){logger['info']('FaxAccount,\x20%s,\x20%s',_0x36fb3e,'request\x20sent');logger[_0xefae('0x11')](_0xefae('0x12'),_0x36fb3e,_0xefae('0x13'),JSON[_0xefae('0x14')](_0x219e1f));if(_0x219e1f[_0xefae('0x15')]){if(_0x219e1f['error'][_0xefae('0x16')]===0x1f4){logger[_0xefae('0x15')](_0xefae('0x17'),_0x36fb3e,_0x219e1f['error'][_0xefae('0x18')]);return _0x1245c2(_0x219e1f[_0xefae('0x15')][_0xefae('0x18')]);}logger[_0xefae('0x15')](_0xefae('0x17'),_0x36fb3e,_0x219e1f['error'][_0xefae('0x18')]);return _0x30d9ea(_0x219e1f[_0xefae('0x15')][_0xefae('0x18')]);}else{logger[_0xefae('0x19')](_0xefae('0x17'),_0x36fb3e,_0xefae('0x13'));_0x30d9ea(_0x219e1f[_0xefae('0x1a')]['message']);}})[_0xefae('0x1b')](function(_0x3afd23){logger['error'](_0xefae('0x17'),_0x36fb3e,_0x3afd23);_0x1245c2(_0x3afd23);});});}exports[_0xefae('0x1c')]=function(_0x2a31a4){var _0x437271=this;return new Promise(function(_0x48ae4d,_0x461fa6){return db['FaxAccount'][_0xefae('0x1d')]({'raw':_0x2a31a4[_0xefae('0x1e')]?_0x2a31a4[_0xefae('0x1e')][_0xefae('0x1f')]===undefined?!![]:![]:!![],'where':_0x2a31a4['options']?_0x2a31a4[_0xefae('0x1e')]['where']||null:null,'attributes':_0x2a31a4[_0xefae('0x1e')]?_0x2a31a4[_0xefae('0x1e')][_0xefae('0x20')]||null:null,'limit':_0x2a31a4['options']?_0x2a31a4['options'][_0xefae('0x21')]||null:null,'include':_0x2a31a4[_0xefae('0x1e')]?_0x2a31a4[_0xefae('0x1e')][_0xefae('0x22')]?_[_0xefae('0x23')](_0x2a31a4['options'][_0xefae('0x22')],function(_0x39ec40){return{'model':db[_0x39ec40[_0xefae('0x24')]],'as':_0x39ec40['as'],'attributes':_0x39ec40[_0xefae('0x20')],'include':_0x39ec40[_0xefae('0x22')]?_[_0xefae('0x23')](_0x39ec40[_0xefae('0x22')],function(_0x45348b){return{'model':db[_0x45348b[_0xefae('0x24')]],'as':_0x45348b['as'],'attributes':_0x45348b[_0xefae('0x20')],'include':_0x45348b[_0xefae('0x22')]?_[_0xefae('0x23')](_0x45348b['include'],function(_0x4669c8){return{'model':db[_0x4669c8[_0xefae('0x24')]],'as':_0x4669c8['as'],'attributes':_0x4669c8[_0xefae('0x20')]};}):[]};}):[]};}):[]:[]})[_0xefae('0x25')](function(_0x2e46e0){logger[_0xefae('0x19')](_0xefae('0x1c'),_0x2a31a4);logger['debug']('GetFaxAccount',_0x2a31a4,JSON[_0xefae('0x14')](_0x2e46e0));_0x48ae4d(_0x2e46e0);})['catch'](function(_0x1e6270){logger[_0xefae('0x15')](_0xefae('0x1c'),_0x1e6270[_0xefae('0x18')],_0x2a31a4);_0x461fa6(_0x437271['error'](0x1f4,_0x1e6270[_0xefae('0x18')]));});});};exports[_0xefae('0x26')]=function(_0x348d42,_0x4a4345,_0x328a89){var _0x95dde4=this;return new Promise(function(_0x21101c,_0x329c97){var _0x2d51d2={'body':_0x348d42['body'],'channel':_0xefae('0x27')};var _0x3e154e=[];var _0x21f3d3=[];var _0x40a999={};return db[_0xefae('0x28')][_0xefae('0x29')]()['then'](function(_0x478aa3){if(!_0x478aa3){throw new db[(_0xefae('0x2a'))][(_0xefae('0x2b'))](_0xefae('0x2c'));}_0x3e154e=_['difference'](_[_0xefae('0x2d')](_0x478aa3),[_0xefae('0x2e'),'updatedAt']);_0x21f3d3=_['difference'](_[_0xefae('0x2d')](_0x478aa3),['createdAt',_0xefae('0x2f'),_0xefae('0x30'),_0xefae('0x31')]);if(_0x348d42[_0xefae('0x32')]['id']){delete _0x348d42['body']['id'];}if(_[_0xefae('0x33')](_0x348d42[_0xefae('0x32')][_0xefae('0x34')])){throw new db[(_0xefae('0x2a'))]['ValidationError'](_0xefae('0x35'));}if(_['isNil'](_0x348d42[_0xefae('0x32')]['body'])||_0x348d42[_0xefae('0x32')][_0xefae('0x32')]===''){throw new db['Sequelize'][(_0xefae('0x2b'))](_0xefae('0x36'));}if(_['isNil'](_0x348d42[_0xefae('0x32')][_0xefae('0x37')])){throw new db['Sequelize']['ValidationError'](_0xefae('0x38')+_0x21f3d3);}if(!_[_0xefae('0x39')](_0x21f3d3,_0x348d42[_0xefae('0x32')][_0xefae('0x37')])){throw new db['Sequelize'][(_0xefae('0x2b'))](_0xefae('0x3a')+_0x21f3d3);}_0x40a999[_0x348d42[_0xefae('0x32')]['mapKey']]=_0x348d42[_0xefae('0x32')][_0xefae('0x34')];})[_0xefae('0x25')](function(){return db[_0xefae('0x3b')][_0xefae('0x3c')]({'where':{'id':_0x348d42['account']['id']},'include':[{'model':db['CmList'],'as':_0xefae('0x3d'),'include':[{'model':db[_0xefae('0x28')],'as':_0xefae('0x3e'),'where':_0x40a999,'limit':0x1,'order':[[_0xefae('0x2f'),_0xefae('0x3f')]]}]},{'model':db['FaxApplication'],'as':_0xefae('0x40')}]});})[_0xefae('0x25')](function(_0x5ec2bc){if(_0x5ec2bc&&_0x5ec2bc[_0xefae('0x3d')]){var _0x56cd47=_0x5ec2bc['get']({'plain':!![]});_0x2d51d2[_0xefae('0x41')]=_0x56cd47;_0x2d51d2[_0xefae('0x42')]=_0x56cd47['Applications'];_0x2d51d2[_0xefae('0x43')]=_0x56cd47[_0xefae('0x3d')];_0x2d51d2['applications']=_[_0xefae('0x44')](_0x2d51d2[_0xefae('0x42')],[_0xefae('0x45')],['asc']);if(_0x2d51d2[_0xefae('0x41')]['Applications']){delete _0x2d51d2[_0xefae('0x41')][_0xefae('0x40')];}if(_0x2d51d2[_0xefae('0x41')]['List']&&_0x2d51d2[_0xefae('0x41')]['List'][_0xefae('0x3e')][_0xefae('0x46')]){return _0x2d51d2[_0xefae('0x41')][_0xefae('0x3d')]['Contacts'][0x0];}var _0x3a0423=_[_0xefae('0x47')](_0x348d42['body'],{'firstName':_0x348d42[_0xefae('0x32')][_0xefae('0x34')],'ListId':_0x56cd47[_0xefae('0x31')]});_0x3a0423[_0x348d42[_0xefae('0x32')]['mapKey']]=_0x348d42['body'][_0xefae('0x34')];return db['CmContact'][_0xefae('0x48')](_0x3a0423,{'fields':_0x3e154e,'raw':!![]});}})['then'](function(_0x2ea5b7){_0x2d51d2[_0xefae('0x49')]=_0x2ea5b7;if(_0x2ea5b7){var _0x282762={'ContactId':_0x2ea5b7['id'],'FaxAccountId':_0x348d42[_0xefae('0x41')]['id'],'fax':_0x2ea5b7[_0xefae('0x27')]};return db[_0xefae('0x4a')][_0xefae('0x3c')]({'where':{'ContactId':_0x2ea5b7['id'],'closed':![],'FaxAccountId':_0x348d42['account']['id']}})['then'](function(_0x4daf2d){if(_0x4daf2d){return[_0x4daf2d,![]];}return db[_0xefae('0x4a')][_0xefae('0x48')](_0x282762)[_0xefae('0x25')](function(_0x3c1b66){return[_0x3c1b66,!![]];});});}else{throw new Error(_0xefae('0x4b'));}})['spread'](function(_0x510bb3,_0x5542f8){var _0x1a99e4=_0x510bb3[_0xefae('0x4c')]({'plain':!![]});if(_0x5542f8){if(_0x2d51d2['account'][_0xefae('0x4d')]){_0x2d51d2[_0xefae('0x42')][_0xefae('0x4e')]({'id':0x0,'priority':_0x2d51d2['applications'][_0xefae('0x46')]+0x1,'app':'close','appdata':_0xefae('0x4f'),'interval':_0xefae('0x50')});}_0x1a99e4[_0xefae('0x51')]=!![];}else{_0x1a99e4[_0xefae('0x51')]=![];}_0x2d51d2[_0xefae('0x52')]=_0x1a99e4;return db[_0xefae('0x53')][_0xefae('0x48')]({'body':_0x348d42[_0xefae('0x32')]['body'],'FaxAccountId':_0x348d42[_0xefae('0x41')]['id'],'FaxInteractionId':_0x510bb3['id'],'direction':'in','ContactId':_0x510bb3['ContactId'],'AttachmentId':_0x348d42[_0xefae('0x32')][_0xefae('0x54')]});})[_0xefae('0x25')](function(_0x167f5f){_0x2d51d2[_0xefae('0x18')]=_0x167f5f;if(_0x2d51d2[_0xefae('0x52')]['UserId']){return db[_0xefae('0x55')][_0xefae('0x3c')]({'attributes':['id',_0xefae('0x56')],'where':{'id':_0x2d51d2[_0xefae('0x52')][_0xefae('0x57')]}})[_0xefae('0x25')](function(_0x200714){if(_0x200714){_0x2d51d2[_0xefae('0x42')][_0xefae('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x200714[_0xefae('0x56')]+','+(_0x2d51d2['account'][_0xefae('0x59')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xefae('0x5a'),_0xefae('0x5b'),_0x2d51d2);});}return respondWithRpcPromise('Start',_0xefae('0x5b'),_0x2d51d2);})[_0xefae('0x25')](function(_0x2a1428){_0x21101c(_0x2a1428);})[_0xefae('0x1b')](function(_0x1e2b55){_0x329c97(_0x95dde4[_0xefae('0x15')](0x1f4,_0x1e2b55[_0xefae('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 90c6d39..2e68c48 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 _0x0d3c=['register','length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x0d3c,0x9c));var _0xc0d3=function(_0x2bd0be,_0xf63d47){_0x2bd0be=_0x2bd0be-0x0;var _0x3e8e85=_0x0d3c[_0x2bd0be];return _0x3e8e85;};'use strict';var FaxAccountEvents=require(_0xc0d3('0x0'));var events=[_0xc0d3('0x1'),_0xc0d3('0x2'),_0xc0d3('0x3')];function createListener(_0x2280a2,_0x1e648b){return function(_0xbc191c){_0x1e648b[_0xc0d3('0x4')](_0x2280a2,_0xbc191c);};}function removeListener(_0x42546e,_0x3e710b){return function(){FaxAccountEvents[_0xc0d3('0x5')](_0x42546e,_0x3e710b);};}exports[_0xc0d3('0x6')]=function(_0x1ccbe6){for(var _0x522a2a=0x0,_0x1967e3=events[_0xc0d3('0x7')];_0x522a2a<_0x1967e3;_0x522a2a++){var _0x39154e=events[_0x522a2a];var _0x5c24f0=createListener(_0xc0d3('0x8')+_0x39154e,_0x1ccbe6);FaxAccountEvents['on'](_0x39154e,_0x5c24f0);}}; \ No newline at end of file +var _0x4942=['removeListener','register','length','faxAccount:','./faxAccount.events','remove','emit'];(function(_0x18c937,_0x32d230){var _0xc920b3=function(_0x3f8610){while(--_0x3f8610){_0x18c937['push'](_0x18c937['shift']());}};_0xc920b3(++_0x32d230);}(_0x4942,0xc8));var _0x2494=function(_0xc97891,_0x4b95f3){_0xc97891=_0xc97891-0x0;var _0x2d7a33=_0x4942[_0xc97891];return _0x2d7a33;};'use strict';var FaxAccountEvents=require(_0x2494('0x0'));var events=['save',_0x2494('0x1'),'update'];function createListener(_0xfb7c07,_0x425872){return function(_0x28f93c){_0x425872[_0x2494('0x2')](_0xfb7c07,_0x28f93c);};}function removeListener(_0x37147d,_0x8a0d85){return function(){FaxAccountEvents[_0x2494('0x3')](_0x37147d,_0x8a0d85);};}exports[_0x2494('0x4')]=function(_0x53b1e6){for(var _0x5f1de8=0x0,_0x87a6c2=events[_0x2494('0x5')];_0x5f1de8<_0x87a6c2;_0x5f1de8++){var _0x349159=events[_0x5f1de8];var _0x116f42=createListener(_0x2494('0x6')+_0x349159,_0x53b1e6);FaxAccountEvents['on'](_0x349159,_0x116f42);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6b6f729..9aac7b7 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(_0x5805a2,_0x3cb76b){var _0x542db2=function(_0x447342){while(--_0x447342){_0x5805a2['push'](_0x5805a2['shift']());}};_0x542db2(++_0x3cb76b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x30d719,_0x22729b){var _0x21358e=function(_0x9c8042){while(--_0x9c8042){_0x30d719['push'](_0x30d719['shift']());}};_0x21358e(++_0x22729b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 018e3b5..78c2e42 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 _0xc5e9=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2bb556,_0x202392){var _0xd6d2b8=function(_0x3ffeb8){while(--_0x3ffeb8){_0x2bb556['push'](_0x2bb556['shift']());}};_0xd6d2b8(++_0x202392);}(_0xc5e9,0x130));var _0x9c5e=function(_0x58c5bb,_0xc29f20){_0x58c5bb=_0x58c5bb-0x0;var _0x1e39f1=_0xc5e9[_0x58c5bb];return _0x1e39f1;};'use strict';var Sequelize=require(_0x9c5e('0x0'));module[_0x9c5e('0x1')]={'priority':{'type':Sequelize[_0x9c5e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9c5e('0x3')],'allowNull':![],'defaultValue':_0x9c5e('0x4')},'appdata':{'type':Sequelize[_0x9c5e('0x5')]()},'description':{'type':Sequelize[_0x9c5e('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9c5e('0x6')}}; \ No newline at end of file +var _0x834d=['INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x43fb6c,_0x360ecd){var _0x37e001=function(_0x2a256f){while(--_0x2a256f){_0x43fb6c['push'](_0x43fb6c['shift']());}};_0x37e001(++_0x360ecd);}(_0x834d,0xcf));var _0xd834=function(_0x21786b,_0x3bbc84){_0x21786b=_0x21786b-0x0;var _0x31b824=_0x834d[_0x21786b];return _0x31b824;};'use strict';var Sequelize=require(_0xd834('0x0'));module['exports']={'priority':{'type':Sequelize[_0xd834('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd834('0x2')],'defaultValue':_0xd834('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 7f1190b..c6eea82 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 _0x95e4=['crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','catch','params','keys','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel'];(function(_0xccc0d4,_0x2f6bf7){var _0x27a653=function(_0x285e63){while(--_0x285e63){_0xccc0d4['push'](_0xccc0d4['shift']());}};_0x27a653(++_0x2f6bf7);}(_0x95e4,0x84));var _0x495e=function(_0x573dde,_0x15d6db){_0x573dde=_0x573dde-0x0;var _0x295a0a=_0x95e4[_0x573dde];return _0x295a0a;};'use strict';var emlformat=require(_0x495e('0x0'));var rimraf=require(_0x495e('0x1'));var zipdir=require(_0x495e('0x2'));var jsonpatch=require(_0x495e('0x3'));var rp=require(_0x495e('0x4'));var moment=require(_0x495e('0x5'));var BPromise=require(_0x495e('0x6'));var Mustache=require(_0x495e('0x7'));var util=require('util');var path=require(_0x495e('0x8'));var sox=require(_0x495e('0x9'));var csv=require(_0x495e('0xa'));var ejs=require(_0x495e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x495e('0xc'));var squel=require(_0x495e('0xd'));var crypto=require(_0x495e('0xe'));var jsforce=require(_0x495e('0xf'));var deskjs=require(_0x495e('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x495e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x495e('0x12'));var as=require(_0x495e('0x13'));var hardwareService=require(_0x495e('0x14'));var logger=require(_0x495e('0x15'))(_0x495e('0x16'));var utils=require('../../config/utils');var config=require(_0x495e('0x17'));var licenseUtil=require(_0x495e('0x18'));var db=require(_0x495e('0x19'))['db'];function respondWithStatusCode(_0x5e326a,_0x20dc74){_0x20dc74=_0x20dc74||0xcc;return function(_0xd06e6){if(_0xd06e6){return _0x5e326a[_0x495e('0x1a')](_0x20dc74);}return _0x5e326a[_0x495e('0x1b')](_0x20dc74)[_0x495e('0x1c')]();};}function respondWithResult(_0x31afb2,_0x27886f){_0x27886f=_0x27886f||0xc8;return function(_0x4c5f1c){if(_0x4c5f1c){return _0x31afb2[_0x495e('0x1b')](_0x27886f)[_0x495e('0x1d')](_0x4c5f1c);}};}function respondWithFilteredResult(_0x401248,_0x5ba52c){return function(_0x59fff7){if(_0x59fff7){var _0x3919c8=typeof _0x5ba52c[_0x495e('0x1e')]===_0x495e('0x1f')&&typeof _0x5ba52c[_0x495e('0x20')]===_0x495e('0x1f');var _0x431d73=_0x59fff7[_0x495e('0x21')];var _0x22d1bd=_0x3919c8?0x0:_0x5ba52c[_0x495e('0x1e')];var _0x1e5e86=_0x3919c8?_0x59fff7[_0x495e('0x21')]:_0x5ba52c['offset']+_0x5ba52c['limit'];var _0x11eb08;if(_0x1e5e86>=_0x431d73){_0x1e5e86=_0x431d73;_0x11eb08=0xc8;}else{_0x11eb08=0xce;}_0x401248[_0x495e('0x1b')](_0x11eb08);return _0x401248['set'](_0x495e('0x22'),_0x22d1bd+'-'+_0x1e5e86+'/'+_0x431d73)['json'](_0x59fff7);}return null;};}function patchUpdates(_0x520ff2){return function(_0x297234){try{jsonpatch['apply'](_0x297234,_0x520ff2,!![]);}catch(_0x5ca3b4){return BPromise[_0x495e('0x23')](_0x5ca3b4);}return _0x297234[_0x495e('0x24')]();};}function saveUpdates(_0x26b95a,_0x3679af){return function(_0x2ee623){if(_0x2ee623){return _0x2ee623[_0x495e('0x25')](_0x26b95a)[_0x495e('0x26')](function(_0x401b0f){return _0x401b0f;});}return null;};}function removeEntity(_0x29ae10,_0x4b9bcd){return function(_0x3e565d){if(_0x3e565d){return _0x3e565d['destroy']()[_0x495e('0x26')](function(){_0x29ae10[_0x495e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x84a767,_0x19b570){return function(_0xb9c6e8){if(!_0xb9c6e8){_0x84a767[_0x495e('0x1a')](0x194);}return _0xb9c6e8;};}function handleError(_0x50eedc,_0x260a6e){_0x260a6e=_0x260a6e||0x1f4;return function(_0x2cc497){logger['error'](_0x2cc497['stack']);if(_0x2cc497[_0x495e('0x27')]){delete _0x2cc497[_0x495e('0x27')];}_0x50eedc[_0x495e('0x1b')](_0x260a6e)[_0x495e('0x28')](_0x2cc497);};}exports[_0x495e('0x29')]=function(_0x3bb6d5,_0x325c4e){var _0x546f87={},_0xbbba5b={},_0x29f199={'count':0x0,'rows':[]};var _0x1a4f42=_[_0x495e('0x2a')](db[_0x495e('0x2b')][_0x495e('0x2c')],function(_0xd32628){return{'name':_0xd32628[_0x495e('0x2d')],'type':_0xd32628['type'][_0x495e('0x2e')]};});_0xbbba5b[_0x495e('0x2f')]=_[_0x495e('0x2a')](_0x1a4f42,_0x495e('0x27'));_0xbbba5b[_0x495e('0x30')]=_['keys'](_0x3bb6d5[_0x495e('0x30')]);_0xbbba5b[_0x495e('0x31')]=_['intersection'](_0xbbba5b['model'],_0xbbba5b[_0x495e('0x30')]);_0x546f87[_0x495e('0x32')]=_[_0x495e('0x33')](_0xbbba5b[_0x495e('0x2f')],qs[_0x495e('0x34')](_0x3bb6d5[_0x495e('0x30')][_0x495e('0x34')]));_0x546f87[_0x495e('0x32')]=_0x546f87[_0x495e('0x32')][_0x495e('0x35')]?_0x546f87['attributes']:_0xbbba5b[_0x495e('0x2f')];if(!_0x3bb6d5[_0x495e('0x30')][_0x495e('0x36')](_0x495e('0x37'))){_0x546f87[_0x495e('0x20')]=qs[_0x495e('0x20')](_0x3bb6d5['query'][_0x495e('0x20')]);_0x546f87[_0x495e('0x1e')]=qs[_0x495e('0x1e')](_0x3bb6d5[_0x495e('0x30')][_0x495e('0x1e')]);}_0x546f87['order']=qs['sort'](_0x3bb6d5[_0x495e('0x30')][_0x495e('0x38')]);_0x546f87[_0x495e('0x39')]=qs[_0x495e('0x31')](_['pick'](_0x3bb6d5['query'],_0xbbba5b['filters']),_0x1a4f42);if(_0x3bb6d5[_0x495e('0x30')]['filter']){_0x546f87[_0x495e('0x39')]=_[_0x495e('0x3a')](_0x546f87['where'],{'$or':_['map'](_0x1a4f42,function(_0x3b5199){if(_0x3b5199[_0x495e('0x3b')]!==_0x495e('0x3c')){var _0x2655eb={};_0x2655eb[_0x3b5199[_0x495e('0x27')]]={'$like':'%'+_0x3bb6d5[_0x495e('0x30')][_0x495e('0x3d')]+'%'};return _0x2655eb;}})});}_0x546f87=_['merge']({},_0x546f87,_0x3bb6d5[_0x495e('0x3e')]);var _0x20ecdb={'where':_0x546f87[_0x495e('0x39')]};return db[_0x495e('0x2b')][_0x495e('0x21')](_0x20ecdb)[_0x495e('0x26')](function(_0x337806){_0x29f199[_0x495e('0x21')]=_0x337806;if(_0x3bb6d5['query']['includeAll']){_0x546f87[_0x495e('0x3f')]=[{'all':!![]}];}return db[_0x495e('0x2b')][_0x495e('0x40')](_0x546f87);})['then'](function(_0x1dddd4){_0x29f199['rows']=_0x1dddd4;return _0x29f199;})[_0x495e('0x26')](respondWithFilteredResult(_0x325c4e,_0x546f87))[_0x495e('0x41')](handleError(_0x325c4e,null));};exports['show']=function(_0x96271,_0x39c94f){var _0x4d6e87={'raw':!![],'where':{'id':_0x96271[_0x495e('0x42')]['id']}},_0x1915dc={};_0x1915dc[_0x495e('0x2f')]=_[_0x495e('0x43')](db[_0x495e('0x2b')]['rawAttributes']);_0x1915dc[_0x495e('0x30')]=_[_0x495e('0x43')](_0x96271[_0x495e('0x30')]);_0x1915dc[_0x495e('0x31')]=_['intersection'](_0x1915dc['model'],_0x1915dc[_0x495e('0x30')]);_0x4d6e87[_0x495e('0x32')]=_['intersection'](_0x1915dc[_0x495e('0x2f')],qs['fields'](_0x96271[_0x495e('0x30')][_0x495e('0x34')]));_0x4d6e87['attributes']=_0x4d6e87['attributes'][_0x495e('0x35')]?_0x4d6e87[_0x495e('0x32')]:_0x1915dc['model'];if(_0x96271[_0x495e('0x30')][_0x495e('0x44')]){_0x4d6e87[_0x495e('0x3f')]=[{'all':!![]}];}_0x4d6e87=_[_0x495e('0x3a')]({},_0x4d6e87,_0x96271['options']);return db['FaxApplication'][_0x495e('0x45')](_0x4d6e87)[_0x495e('0x26')](handleEntityNotFound(_0x39c94f,null))['then'](respondWithResult(_0x39c94f,null))[_0x495e('0x41')](handleError(_0x39c94f,null));};exports[_0x495e('0x46')]=function(_0x14177e,_0x223902){return db[_0x495e('0x2b')][_0x495e('0x46')](_0x14177e[_0x495e('0x47')],{})[_0x495e('0x26')](respondWithResult(_0x223902,0xc9))[_0x495e('0x41')](handleError(_0x223902,null));};exports['update']=function(_0x4f6fc4,_0x4f422b){if(_0x4f6fc4[_0x495e('0x47')]['id']){delete _0x4f6fc4[_0x495e('0x47')]['id'];}return db[_0x495e('0x2b')][_0x495e('0x45')]({'where':{'id':_0x4f6fc4[_0x495e('0x42')]['id']}})[_0x495e('0x26')](handleEntityNotFound(_0x4f422b,null))[_0x495e('0x26')](saveUpdates(_0x4f6fc4[_0x495e('0x47')],null))[_0x495e('0x26')](respondWithResult(_0x4f422b,null))[_0x495e('0x41')](handleError(_0x4f422b,null));};exports[_0x495e('0x48')]=function(_0x16bcf4,_0xf9ed1c){return db[_0x495e('0x2b')][_0x495e('0x45')]({'where':{'id':_0x16bcf4[_0x495e('0x42')]['id']}})[_0x495e('0x26')](handleEntityNotFound(_0xf9ed1c,null))['then'](removeEntity(_0xf9ed1c,null))[_0x495e('0x41')](handleError(_0xf9ed1c,null));}; \ No newline at end of file +var _0x2299=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','include','findAll','rows','show','params','includeAll','merge','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x5a1d58,_0x42ab8d){var _0x5911a9=function(_0x3769a4){while(--_0x3769a4){_0x5a1d58['push'](_0x5a1d58['shift']());}};_0x5911a9(++_0x42ab8d);}(_0x2299,0x88));var _0x9229=function(_0x5ab08e,_0x2cf537){_0x5ab08e=_0x5ab08e-0x0;var _0x52234e=_0x2299[_0x5ab08e];return _0x52234e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9229('0x0'));var zipdir=require(_0x9229('0x1'));var jsonpatch=require(_0x9229('0x2'));var rp=require(_0x9229('0x3'));var moment=require('moment');var BPromise=require(_0x9229('0x4'));var Mustache=require(_0x9229('0x5'));var util=require(_0x9229('0x6'));var path=require(_0x9229('0x7'));var sox=require(_0x9229('0x8'));var csv=require(_0x9229('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9229('0xa'));var _=require(_0x9229('0xb'));var squel=require(_0x9229('0xc'));var crypto=require(_0x9229('0xd'));var jsforce=require(_0x9229('0xe'));var deskjs=require(_0x9229('0xf'));var toCsv=require(_0x9229('0x9'));var querystring=require(_0x9229('0x10'));var Papa=require('papaparse');var Redis=require(_0x9229('0x11'));var authService=require(_0x9229('0x12'));var qs=require(_0x9229('0x13'));var as=require(_0x9229('0x14'));var hardwareService=require(_0x9229('0x15'));var logger=require(_0x9229('0x16'))('api');var utils=require(_0x9229('0x17'));var config=require(_0x9229('0x18'));var licenseUtil=require(_0x9229('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22cfcb,_0x239e92){_0x239e92=_0x239e92||0xcc;return function(_0x28f087){if(_0x28f087){return _0x22cfcb[_0x9229('0x1a')](_0x239e92);}return _0x22cfcb[_0x9229('0x1b')](_0x239e92)['end']();};}function respondWithResult(_0x31f9d5,_0x254b79){_0x254b79=_0x254b79||0xc8;return function(_0x3f0e41){if(_0x3f0e41){return _0x31f9d5[_0x9229('0x1b')](_0x254b79)['json'](_0x3f0e41);}};}function respondWithFilteredResult(_0x711864,_0x34ea8c){return function(_0xe134b7){if(_0xe134b7){var _0x4458bd=typeof _0x34ea8c[_0x9229('0x1c')]===_0x9229('0x1d')&&typeof _0x34ea8c[_0x9229('0x1e')]===_0x9229('0x1d');var _0x1ea90b=_0xe134b7[_0x9229('0x1f')];var _0x18a1f3=_0x4458bd?0x0:_0x34ea8c[_0x9229('0x1c')];var _0xe989ae=_0x4458bd?_0xe134b7[_0x9229('0x1f')]:_0x34ea8c[_0x9229('0x1c')]+_0x34ea8c[_0x9229('0x1e')];var _0x504aec;if(_0xe989ae>=_0x1ea90b){_0xe989ae=_0x1ea90b;_0x504aec=0xc8;}else{_0x504aec=0xce;}_0x711864['status'](_0x504aec);return _0x711864['set'](_0x9229('0x20'),_0x18a1f3+'-'+_0xe989ae+'/'+_0x1ea90b)['json'](_0xe134b7);}return null;};}function patchUpdates(_0x5b89cb){return function(_0x2dba31){try{jsonpatch['apply'](_0x2dba31,_0x5b89cb,!![]);}catch(_0x485a83){return BPromise[_0x9229('0x21')](_0x485a83);}return _0x2dba31[_0x9229('0x22')]();};}function saveUpdates(_0x343050,_0x247b88){return function(_0x32ab5a){if(_0x32ab5a){return _0x32ab5a[_0x9229('0x23')](_0x343050)[_0x9229('0x24')](function(_0x5b03dc){return _0x5b03dc;});}return null;};}function removeEntity(_0x53e548,_0x1cebb5){return function(_0x4b1221){if(_0x4b1221){return _0x4b1221['destroy']()[_0x9229('0x24')](function(){_0x53e548[_0x9229('0x1b')](0xcc)[_0x9229('0x25')]();});}};}function handleEntityNotFound(_0x19944c,_0x3648c1){return function(_0x2c4e84){if(!_0x2c4e84){_0x19944c[_0x9229('0x1a')](0x194);}return _0x2c4e84;};}function handleError(_0x3d5bea,_0x7021be){_0x7021be=_0x7021be||0x1f4;return function(_0x6e1eec){logger[_0x9229('0x26')](_0x6e1eec[_0x9229('0x27')]);if(_0x6e1eec[_0x9229('0x28')]){delete _0x6e1eec[_0x9229('0x28')];}_0x3d5bea[_0x9229('0x1b')](_0x7021be)[_0x9229('0x29')](_0x6e1eec);};}exports[_0x9229('0x2a')]=function(_0x3f02b8,_0x4bdb92){var _0x23e7ee={},_0x3ddcef={},_0x252380={'count':0x0,'rows':[]};var _0x4e1a15=_[_0x9229('0x2b')](db[_0x9229('0x2c')][_0x9229('0x2d')],function(_0x2d0079){return{'name':_0x2d0079['fieldName'],'type':_0x2d0079[_0x9229('0x2e')][_0x9229('0x2f')]};});_0x3ddcef[_0x9229('0x30')]=_[_0x9229('0x2b')](_0x4e1a15,_0x9229('0x28'));_0x3ddcef[_0x9229('0x31')]=_[_0x9229('0x32')](_0x3f02b8['query']);_0x3ddcef['filters']=_[_0x9229('0x33')](_0x3ddcef['model'],_0x3ddcef[_0x9229('0x31')]);_0x23e7ee[_0x9229('0x34')]=_['intersection'](_0x3ddcef[_0x9229('0x30')],qs[_0x9229('0x35')](_0x3f02b8[_0x9229('0x31')][_0x9229('0x35')]));_0x23e7ee['attributes']=_0x23e7ee[_0x9229('0x34')][_0x9229('0x36')]?_0x23e7ee['attributes']:_0x3ddcef[_0x9229('0x30')];if(!_0x3f02b8[_0x9229('0x31')][_0x9229('0x37')](_0x9229('0x38'))){_0x23e7ee[_0x9229('0x1e')]=qs[_0x9229('0x1e')](_0x3f02b8[_0x9229('0x31')][_0x9229('0x1e')]);_0x23e7ee[_0x9229('0x1c')]=qs[_0x9229('0x1c')](_0x3f02b8[_0x9229('0x31')][_0x9229('0x1c')]);}_0x23e7ee[_0x9229('0x39')]=qs[_0x9229('0x3a')](_0x3f02b8[_0x9229('0x31')][_0x9229('0x3a')]);_0x23e7ee[_0x9229('0x3b')]=qs['filters'](_[_0x9229('0x3c')](_0x3f02b8[_0x9229('0x31')],_0x3ddcef[_0x9229('0x3d')]),_0x4e1a15);if(_0x3f02b8[_0x9229('0x31')][_0x9229('0x3e')]){_0x23e7ee[_0x9229('0x3b')]=_['merge'](_0x23e7ee['where'],{'$or':_[_0x9229('0x2b')](_0x4e1a15,function(_0x56cc5f){if(_0x56cc5f['type']!==_0x9229('0x3f')){var _0x69c6ae={};_0x69c6ae[_0x56cc5f[_0x9229('0x28')]]={'$like':'%'+_0x3f02b8[_0x9229('0x31')][_0x9229('0x3e')]+'%'};return _0x69c6ae;}})});}_0x23e7ee=_['merge']({},_0x23e7ee,_0x3f02b8[_0x9229('0x40')]);var _0x13d50c={'where':_0x23e7ee['where']};return db[_0x9229('0x2c')]['count'](_0x13d50c)[_0x9229('0x24')](function(_0x2daa3d){_0x252380['count']=_0x2daa3d;if(_0x3f02b8[_0x9229('0x31')]['includeAll']){_0x23e7ee[_0x9229('0x41')]=[{'all':!![]}];}return db[_0x9229('0x2c')][_0x9229('0x42')](_0x23e7ee);})[_0x9229('0x24')](function(_0x18e030){_0x252380[_0x9229('0x43')]=_0x18e030;return _0x252380;})[_0x9229('0x24')](respondWithFilteredResult(_0x4bdb92,_0x23e7ee))['catch'](handleError(_0x4bdb92,null));};exports[_0x9229('0x44')]=function(_0x3a4587,_0x10fa1d){var _0x5bd4bd={'raw':!![],'where':{'id':_0x3a4587[_0x9229('0x45')]['id']}},_0x362b62={};_0x362b62['model']=_[_0x9229('0x32')](db[_0x9229('0x2c')][_0x9229('0x2d')]);_0x362b62[_0x9229('0x31')]=_[_0x9229('0x32')](_0x3a4587['query']);_0x362b62[_0x9229('0x3d')]=_[_0x9229('0x33')](_0x362b62[_0x9229('0x30')],_0x362b62['query']);_0x5bd4bd[_0x9229('0x34')]=_['intersection'](_0x362b62[_0x9229('0x30')],qs['fields'](_0x3a4587[_0x9229('0x31')]['fields']));_0x5bd4bd[_0x9229('0x34')]=_0x5bd4bd[_0x9229('0x34')]['length']?_0x5bd4bd[_0x9229('0x34')]:_0x362b62[_0x9229('0x30')];if(_0x3a4587[_0x9229('0x31')][_0x9229('0x46')]){_0x5bd4bd['include']=[{'all':!![]}];}_0x5bd4bd=_[_0x9229('0x47')]({},_0x5bd4bd,_0x3a4587[_0x9229('0x40')]);return db[_0x9229('0x2c')][_0x9229('0x48')](_0x5bd4bd)['then'](handleEntityNotFound(_0x10fa1d,null))[_0x9229('0x24')](respondWithResult(_0x10fa1d,null))[_0x9229('0x49')](handleError(_0x10fa1d,null));};exports[_0x9229('0x4a')]=function(_0x4a9c17,_0x36798a){return db[_0x9229('0x2c')][_0x9229('0x4a')](_0x4a9c17[_0x9229('0x4b')],{})['then'](respondWithResult(_0x36798a,0xc9))[_0x9229('0x49')](handleError(_0x36798a,null));};exports['update']=function(_0x27f119,_0xbd8f31){if(_0x27f119['body']['id']){delete _0x27f119['body']['id'];}return db[_0x9229('0x2c')]['find']({'where':{'id':_0x27f119[_0x9229('0x45')]['id']}})[_0x9229('0x24')](handleEntityNotFound(_0xbd8f31,null))[_0x9229('0x24')](saveUpdates(_0x27f119[_0x9229('0x4b')],null))[_0x9229('0x24')](respondWithResult(_0xbd8f31,null))['catch'](handleError(_0xbd8f31,null));};exports[_0x9229('0x4c')]=function(_0x449a05,_0x20a62a){return db[_0x9229('0x2c')][_0x9229('0x48')]({'where':{'id':_0x449a05[_0x9229('0x45')]['id']}})['then'](handleEntityNotFound(_0x20a62a,null))[_0x9229('0x24')](removeEntity(_0x20a62a,null))[_0x9229('0x49')](handleError(_0x20a62a,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 44487fe..305f4b3 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 _0x34af=['lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0x34af,0x104));var _0xf34a=function(_0x5c683f,_0x229635){_0x5c683f=_0x5c683f-0x0;var _0x2a2c7=_0x34af[_0x5c683f];return _0x2a2c7;};'use strict';var _=require(_0xf34a('0x0'));var util=require(_0xf34a('0x1'));var logger=require(_0xf34a('0x2'))('api');var moment=require(_0xf34a('0x3'));var BPromise=require(_0xf34a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf34a('0x5'));var config=require(_0xf34a('0x6'));var attributes=require(_0xf34a('0x7'));module[_0xf34a('0x8')]=function(_0x416adf,_0x12bd8c){return _0x416adf[_0xf34a('0x9')]('FaxApplication',attributes,{'tableName':_0xf34a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf34a('0xb'),'collate':_0xf34a('0xc')});}; \ No newline at end of file +var _0x07ca=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x07ca,0x89));var _0xa07c=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x07ca[_0x234ce7];return _0x57c561;};'use strict';var _=require(_0xa07c('0x0'));var util=require('util');var logger=require(_0xa07c('0x1'))(_0xa07c('0x2'));var moment=require(_0xa07c('0x3'));var BPromise=require(_0xa07c('0x4'));var rp=require(_0xa07c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa07c('0x6'));var config=require(_0xa07c('0x7'));var attributes=require(_0xa07c('0x8'));module[_0xa07c('0x9')]=function(_0x559650,_0x4c52b5){return _0x559650[_0xa07c('0xa')](_0xa07c('0xb'),attributes,{'tableName':_0xa07c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa07c('0xd'),'collate':_0xa07c('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index b22eabc..d942421 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 _0x3efe=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','catch'];(function(_0x51c832,_0x25aebc){var _0x57608d=function(_0x363cd9){while(--_0x363cd9){_0x51c832['push'](_0x51c832['shift']());}};_0x57608d(++_0x25aebc);}(_0x3efe,0x136));var _0xe3ef=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3efe[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xe3ef('0x0'));var util=require(_0xe3ef('0x1'));var moment=require(_0xe3ef('0x2'));var BPromise=require(_0xe3ef('0x3'));var rs=require(_0xe3ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3ef('0x6'))('rpc');var config=require(_0xe3ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe3ef('0x8')][_0xe3ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25a996,_0x4f8957,_0x28431f){return new BPromise(function(_0xb1ad21,_0x22e5bf){return client[_0xe3ef('0xa')](_0x25a996,_0x28431f)[_0xe3ef('0xb')](function(_0x1ddb5d){logger[_0xe3ef('0xc')](_0xe3ef('0xd'),_0x4f8957,_0xe3ef('0xe'));logger[_0xe3ef('0xf')](_0xe3ef('0x10'),_0x4f8957,_0xe3ef('0xe'),JSON[_0xe3ef('0x11')](_0x1ddb5d));if(_0x1ddb5d[_0xe3ef('0x12')]){if(_0x1ddb5d[_0xe3ef('0x12')][_0xe3ef('0x13')]===0x1f4){logger[_0xe3ef('0x12')](_0xe3ef('0xd'),_0x4f8957,_0x1ddb5d[_0xe3ef('0x12')][_0xe3ef('0x14')]);return _0x22e5bf(_0x1ddb5d[_0xe3ef('0x12')]['message']);}logger['error'](_0xe3ef('0xd'),_0x4f8957,_0x1ddb5d[_0xe3ef('0x12')][_0xe3ef('0x14')]);return _0xb1ad21(_0x1ddb5d[_0xe3ef('0x12')][_0xe3ef('0x14')]);}else{logger[_0xe3ef('0xc')]('FaxApplication,\x20%s,\x20%s',_0x4f8957,_0xe3ef('0xe'));_0xb1ad21(_0x1ddb5d[_0xe3ef('0x15')][_0xe3ef('0x14')]);}})['catch'](function(_0x41c278){logger[_0xe3ef('0x12')](_0xe3ef('0xd'),_0x4f8957,_0x41c278);_0x22e5bf(_0x41c278);});});}exports['UpdateFaxApplication']=function(_0x43a66c){var _0x428f1d=this;return new Promise(function(_0x270175,_0x361000){return db['FaxApplication'][_0xe3ef('0x16')](_0x43a66c[_0xe3ef('0x17')],{'raw':_0x43a66c[_0xe3ef('0x18')]?_0x43a66c[_0xe3ef('0x18')][_0xe3ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43a66c[_0xe3ef('0x18')]?_0x43a66c[_0xe3ef('0x18')][_0xe3ef('0x1a')]||null:null,'attributes':_0x43a66c[_0xe3ef('0x18')]?_0x43a66c[_0xe3ef('0x18')][_0xe3ef('0x1b')]||null:null,'limit':_0x43a66c[_0xe3ef('0x18')]?_0x43a66c[_0xe3ef('0x18')][_0xe3ef('0x1c')]||null:null})[_0xe3ef('0xb')](function(_0x4f8ed8){logger[_0xe3ef('0xc')](_0xe3ef('0x1d'),_0x43a66c);logger['debug'](_0xe3ef('0x1d'),_0x43a66c,JSON[_0xe3ef('0x11')](_0x4f8ed8));_0x270175(_0x4f8ed8);})[_0xe3ef('0x1e')](function(_0x51a3b6){logger[_0xe3ef('0x12')](_0xe3ef('0x1d'),_0x51a3b6[_0xe3ef('0x14')],_0x43a66c);_0x361000(_0x428f1d[_0xe3ef('0x12')](0x1f4,_0x51a3b6['message']));});});}; \ No newline at end of file +var _0xbbd6=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','options','where','attributes','limit','lodash','util'];(function(_0x306edb,_0x32622c){var _0x487ce5=function(_0x4efb4a){while(--_0x4efb4a){_0x306edb['push'](_0x306edb['shift']());}};_0x487ce5(++_0x32622c);}(_0xbbd6,0x1be));var _0x6bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6bbd('0x0'));var util=require(_0x6bbd('0x1'));var moment=require('moment');var BPromise=require(_0x6bbd('0x2'));var rs=require(_0x6bbd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bbd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bbd('0x5'))(_0x6bbd('0x6'));var config=require('../../config/environment');var jayson=require(_0x6bbd('0x7'));var client=jayson[_0x6bbd('0x8')][_0x6bbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37af6d,_0x118840,_0x5bb6a9){return new BPromise(function(_0x2a1701,_0x410874){return client[_0x6bbd('0xa')](_0x37af6d,_0x5bb6a9)[_0x6bbd('0xb')](function(_0xa7cb5b){logger[_0x6bbd('0xc')](_0x6bbd('0xd'),_0x118840,_0x6bbd('0xe'));logger[_0x6bbd('0xf')](_0x6bbd('0x10'),_0x118840,_0x6bbd('0xe'),JSON[_0x6bbd('0x11')](_0xa7cb5b));if(_0xa7cb5b[_0x6bbd('0x12')]){if(_0xa7cb5b[_0x6bbd('0x12')]['code']===0x1f4){logger[_0x6bbd('0x12')]('FaxApplication,\x20%s,\x20%s',_0x118840,_0xa7cb5b['error'][_0x6bbd('0x13')]);return _0x410874(_0xa7cb5b[_0x6bbd('0x12')][_0x6bbd('0x13')]);}logger[_0x6bbd('0x12')]('FaxApplication,\x20%s,\x20%s',_0x118840,_0xa7cb5b[_0x6bbd('0x12')][_0x6bbd('0x13')]);return _0x2a1701(_0xa7cb5b[_0x6bbd('0x12')][_0x6bbd('0x13')]);}else{logger['info'](_0x6bbd('0xd'),_0x118840,_0x6bbd('0xe'));_0x2a1701(_0xa7cb5b[_0x6bbd('0x14')][_0x6bbd('0x13')]);}})[_0x6bbd('0x15')](function(_0x4f75f1){logger['error'](_0x6bbd('0xd'),_0x118840,_0x4f75f1);_0x410874(_0x4f75f1);});});}exports[_0x6bbd('0x16')]=function(_0x8bbd7e){var _0x820cba=this;return new Promise(function(_0x3c213d,_0x4b4646){return db[_0x6bbd('0x17')]['update'](_0x8bbd7e['body'],{'raw':_0x8bbd7e[_0x6bbd('0x18')]?_0x8bbd7e[_0x6bbd('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8bbd7e[_0x6bbd('0x18')]?_0x8bbd7e[_0x6bbd('0x18')][_0x6bbd('0x19')]||null:null,'attributes':_0x8bbd7e[_0x6bbd('0x18')]?_0x8bbd7e['options'][_0x6bbd('0x1a')]||null:null,'limit':_0x8bbd7e['options']?_0x8bbd7e[_0x6bbd('0x18')][_0x6bbd('0x1b')]||null:null})[_0x6bbd('0xb')](function(_0x28df1a){logger['info'](_0x6bbd('0x16'),_0x8bbd7e);logger[_0x6bbd('0xf')](_0x6bbd('0x16'),_0x8bbd7e,JSON['stringify'](_0x28df1a));_0x3c213d(_0x28df1a);})[_0x6bbd('0x15')](function(_0x39c4af){logger[_0x6bbd('0x12')](_0x6bbd('0x16'),_0x39c4af['message'],_0x8bbd7e);_0x4b4646(_0x820cba[_0x6bbd('0x12')](0x1f4,_0x39c4af[_0x6bbd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index d637e1f..af0dba4 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxApplication.controller'];(function(_0x4c67d9,_0x351438){var _0x26f975=function(_0x43f193){while(--_0x43f193){_0x4c67d9['push'](_0x4c67d9['shift']());}};_0x26f975(++_0x351438);}(_0x14a0,0x8e));var _0x014a=function(_0x38e31f,_0x51efc4){_0x38e31f=_0x38e31f-0x0;var _0x567363=_0x14a0[_0x38e31f];return _0x567363;};'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 _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x955f,0x1eb));var _0xf955=function(_0x2e9a03,_0x12285d){_0x2e9a03=_0x2e9a03-0x0;var _0x553bf7=_0x955f[_0x2e9a03];return _0x553bf7;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 39d61ba..eb219be 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 _0x90d2=['ENUM','out','sequelize','exports','STRING','DATE'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x90d2,0x86));var _0x290d=function(_0x7d8569,_0x2810c8){_0x7d8569=_0x7d8569-0x0;var _0x1b7291=_0x90d2[_0x7d8569];return _0x1b7291;};'use strict';var Sequelize=require(_0x290d('0x0'));module[_0x290d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x290d('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x290d('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x290d('0x3')]},'fax':{'type':Sequelize[_0x290d('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x290d('0x4')]('in',_0x290d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x290d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x290d('0x4')]('in',_0x290d('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xcd94=['STRING','DATE','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x34a7b5,_0x15c8fe){var _0x28dcf4=function(_0xe27734){while(--_0xe27734){_0x34a7b5['push'](_0x34a7b5['shift']());}};_0x28dcf4(++_0x15c8fe);}(_0xcd94,0x1ee));var _0x4cd9=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xcd94[_0x31e5cb];return _0x4170df;};'use strict';var Sequelize=require(_0x4cd9('0x0'));module[_0x4cd9('0x1')]={'closed':{'type':Sequelize[_0x4cd9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4cd9('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4cd9('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4cd9('0x4')]},'fax':{'type':Sequelize[_0x4cd9('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4cd9('0x5')]('in',_0x4cd9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4cd9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x4cd9('0x5')]('in',_0x4cd9('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index e1ac26c..c1d6b0f 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 _0x1345=['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','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','catch','index','FaxInteraction','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','text','some','compact','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','isEmpty','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rawAttributes','includeAll','include','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','filter','$gte','split','findAll','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x2f676e,_0x43d0bd){var _0x447c2a=function(_0x47b654){while(--_0x47b654){_0x2f676e['push'](_0x2f676e['shift']());}};_0x447c2a(++_0x43d0bd);}(_0x1345,0x1b6));var _0x5134=function(_0x2f7048,_0x27bf94){_0x2f7048=_0x2f7048-0x0;var _0x5e1499=_0x1345[_0x2f7048];return _0x5e1499;};'use strict';var emlformat=require(_0x5134('0x0'));var rimraf=require(_0x5134('0x1'));var zipdir=require(_0x5134('0x2'));var jsonpatch=require(_0x5134('0x3'));var rp=require('request-promise');var moment=require(_0x5134('0x4'));var BPromise=require(_0x5134('0x5'));var Mustache=require(_0x5134('0x6'));var util=require('util');var path=require(_0x5134('0x7'));var sox=require(_0x5134('0x8'));var csv=require(_0x5134('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5134('0xa'));var _=require(_0x5134('0xb'));var squel=require(_0x5134('0xc'));var crypto=require('crypto');var jsforce=require(_0x5134('0xd'));var deskjs=require(_0x5134('0xe'));var toCsv=require(_0x5134('0x9'));var querystring=require(_0x5134('0xf'));var Papa=require(_0x5134('0x10'));var Redis=require(_0x5134('0x11'));var authService=require(_0x5134('0x12'));var qs=require(_0x5134('0x13'));var as=require(_0x5134('0x14'));var hardwareService=require(_0x5134('0x15'));var logger=require(_0x5134('0x16'))(_0x5134('0x17'));var utils=require('../../config/utils');var config=require(_0x5134('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5134('0x19'))['db'];config[_0x5134('0x1a')]=_['defaults'](config[_0x5134('0x1a')],{'host':_0x5134('0x1b'),'port':0x18eb});var socket=require(_0x5134('0x1c'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x5134('0x1d')](socket);function respondWithStatusCode(_0x37d693,_0x1591b7){_0x1591b7=_0x1591b7||0xcc;return function(_0x4ff3e3){if(_0x4ff3e3){return _0x37d693[_0x5134('0x1e')](_0x1591b7);}return _0x37d693[_0x5134('0x1f')](_0x1591b7)[_0x5134('0x20')]();};}function respondWithResult(_0x4ee881,_0x18cb67){_0x18cb67=_0x18cb67||0xc8;return function(_0xf76dc5){if(_0xf76dc5){return _0x4ee881['status'](_0x18cb67)[_0x5134('0x21')](_0xf76dc5);}};}function respondWithFilteredResult(_0x13091e,_0x2c24fc){return function(_0xc9f3e){if(_0xc9f3e){var _0x53359a=typeof _0x2c24fc[_0x5134('0x22')]==='undefined'&&typeof _0x2c24fc[_0x5134('0x23')]===_0x5134('0x24');var _0x37b827=_0xc9f3e['count'];var _0x16b3b1=_0x53359a?0x0:_0x2c24fc['offset'];var _0x1de7b4=_0x53359a?_0xc9f3e[_0x5134('0x25')]:_0x2c24fc['offset']+_0x2c24fc[_0x5134('0x23')];var _0x245f3b;if(_0x1de7b4>=_0x37b827){_0x1de7b4=_0x37b827;_0x245f3b=0xc8;}else{_0x245f3b=0xce;}_0x13091e['status'](_0x245f3b);return _0x13091e[_0x5134('0x26')]('Content-Range',_0x16b3b1+'-'+_0x1de7b4+'/'+_0x37b827)[_0x5134('0x21')](_0xc9f3e);}return null;};}function patchUpdates(_0x84824d){return function(_0x1e0de0){try{jsonpatch[_0x5134('0x27')](_0x1e0de0,_0x84824d,!![]);}catch(_0x5c67b3){return BPromise[_0x5134('0x28')](_0x5c67b3);}return _0x1e0de0[_0x5134('0x29')]();};}function saveUpdates(_0x58f3ef,_0x413c36){return function(_0x38b86f){if(_0x38b86f){return _0x38b86f[_0x5134('0x2a')](_0x58f3ef)[_0x5134('0x2b')](function(_0xa10c98){return _0xa10c98;});}return null;};}function removeEntity(_0x43fbd1,_0x51c81e){return function(_0xc03885){if(_0xc03885){return _0xc03885[_0x5134('0x2c')]()['then'](function(){_0x43fbd1[_0x5134('0x1f')](0xcc)[_0x5134('0x20')]();});}};}function handleEntityNotFound(_0x5e9426,_0x84a094){return function(_0x2f2ea6){if(!_0x2f2ea6){_0x5e9426['sendStatus'](0x194);}return _0x2f2ea6;};}function handleError(_0x217f7b,_0x25c0b0){_0x25c0b0=_0x25c0b0||0x1f4;return function(_0xdf0a6e){logger[_0x5134('0x2d')](_0xdf0a6e[_0x5134('0x2e')]);if(_0xdf0a6e[_0x5134('0x2f')]){delete _0xdf0a6e[_0x5134('0x2f')];}_0x217f7b[_0x5134('0x1f')](_0x25c0b0)[_0x5134('0x30')](_0xdf0a6e);};}function getInteractionUsers(_0xb60422,_0x4ed454){return new BPromise(function(_0x3a815e,_0x4dad6e){try{if(_0x4ed454[_0xb60422['id']]){_0xb60422[_0x5134('0x31')]=_[_0x5134('0x32')](_0x4ed454[_0xb60422['id']],function(_0x666e20){return{'id':_0x666e20['id'],'fullname':_0x666e20[_0x5134('0x33')]};});}}catch(_0x2d567f){_0x4dad6e(_0x2d567f);}_0x3a815e(_0xb60422);});}function getInteractionTags(_0x3c7247,_0x5e510f){return new BPromise(function(_0x569fed,_0x29a570){try{if(_0x3c7247[_0x5134('0x34')]){_0x3c7247[_0x5134('0x35')]=[];_0x3c7247[_0x5134('0x34')]['split'](',')[_0x5134('0x36')](function(_0x21dbb3){_0x3c7247[_0x5134('0x35')]['push'](_0x5e510f[_0x21dbb3]);});}delete _0x3c7247[_0x5134('0x34')];}catch(_0x4deea6){_0x29a570(_0x4deea6);}_0x569fed(_0x3c7247);});}function updateFaxInteraction(_0x403d4d,_0x16a8cd,_0x40ce0b){return new BPromise(function(_0x5e95fc,_0x504fb1){return getInteractionUsers(_0x403d4d,_0x40ce0b)[_0x5134('0x2b')](function(_0x4536d4){return getInteractionTags(_0x4536d4,_0x16a8cd);})[_0x5134('0x2b')](function(_0x284b3d){_0x5e95fc(_0x284b3d);})[_0x5134('0x37')](function(_0x6a85f7){_0x504fb1(_0x6a85f7);});});}exports[_0x5134('0x38')]=function(_0x332744,_0x1a56c6){var _0x2ecec3={},_0x4d78cf={},_0x16b779={'count':0x0,'rows':[]};var _0xbca191=_['map'](db[_0x5134('0x39')]['rawAttributes'],function(_0x293d0d){return{'name':_0x293d0d['fieldName'],'type':_0x293d0d[_0x5134('0x3a')][_0x5134('0x3b')]};});_0x4d78cf[_0x5134('0x3c')]=_[_0x5134('0x32')](_0xbca191,_0x5134('0x2f'));_0x4d78cf[_0x5134('0x3d')]=_[_0x5134('0x3e')](_0x332744[_0x5134('0x3d')]);_0x4d78cf[_0x5134('0x3f')]=_['intersection'](_0x4d78cf[_0x5134('0x3c')],_0x4d78cf[_0x5134('0x3d')]);_0x2ecec3[_0x5134('0x40')]=_[_0x5134('0x41')](_0x4d78cf['model'],qs[_0x5134('0x42')](_0x332744['query'][_0x5134('0x42')]));_0x2ecec3[_0x5134('0x40')]=_0x2ecec3[_0x5134('0x40')]['length']?_0x2ecec3[_0x5134('0x40')]:_0x4d78cf[_0x5134('0x3c')];if(!_0x332744[_0x5134('0x3d')][_0x5134('0x43')](_0x5134('0x44'))){_0x2ecec3[_0x5134('0x23')]=qs['limit'](_0x332744['query'][_0x5134('0x23')]);_0x2ecec3[_0x5134('0x22')]=qs['offset'](_0x332744[_0x5134('0x3d')]['offset']);}_0x2ecec3[_0x5134('0x45')]=qs[_0x5134('0x46')](_0x332744['query'][_0x5134('0x46')]);_0x2ecec3['where']=qs[_0x5134('0x3f')](_[_0x5134('0x47')](_0x332744['query'],_0x4d78cf[_0x5134('0x3f')]),_0xbca191);var _0x4514e7=[];var _0xf8b6f5=squel[_0x5134('0x48')]()['field']('id')['field'](_0x5134('0x2f'))[_0x5134('0x49')](_0x5134('0x4a'))[_0x5134('0x4b')](_0x5134('0x4c'));var _0x11fb36=squel[_0x5134('0x48')]()['field']('u.id')[_0x5134('0x49')](_0x5134('0x4d'))[_0x5134('0x49')](_0x5134('0x4e'))[_0x5134('0x4b')](_0x5134('0x4f'),'ui')['left_join']('users','u',_0x5134('0x50'));var _0xf039f1=squel[_0x5134('0x48')]()[_0x5134('0x4b')](_0x5134('0x51'),'i')['left_join'](_0x5134('0x52'),'c',_0x5134('0x53'))[_0x5134('0x54')](_0x5134('0x55'),'o',_0x5134('0x56'))[_0x5134('0x54')](_0x5134('0x57'),'a',_0x5134('0x58'))[_0x5134('0x54')](_0x5134('0x59'),'me',_0x5134('0x5a'))[_0x5134('0x54')](_0x5134('0x5b'),'it',_0x5134('0x5c'))['left_join']('tools_tags','t',_0x5134('0x5d'));var _0x4e0777=squel[_0x5134('0x5e')]();var _0x33de9f=[];var _0x1f01e0=squel[_0x5134('0x5e')]();var _0x169d57;if(_0x332744[_0x5134('0x3d')][_0x5134('0x5f')]){_0x169d57=as['parseSearch'](_0x332744[_0x5134('0x3d')][_0x5134('0x5f')]);var _0x423f0d=_0x169d57[_0x5134('0x60')];for(var _0x5dc2da=0x0;_0x5dc2da<_0x169d57[_0x5134('0x61')]['length'];_0x5dc2da++){var _0x2f849e=_0x169d57[_0x5134('0x61')][_0x5dc2da];var _0x1b1d19='i';var _0x5b68d3=_[_0x5134('0x62')](_0xbca191,[_0x5134('0x2f'),_0x2f849e[_0x5134('0x49')]]);if(!_0x5b68d3){switch(_0x2f849e[_0x5134('0x49')]){case'unreadMessages':if(_0x2f849e[_0x5134('0x63')]==0x1){_0xf039f1['having']('`'+_0x2f849e[_0x5134('0x49')]+_0x5134('0x64'));}else{_0xf039f1[_0x5134('0x65')]('`'+_0x2f849e[_0x5134('0x49')]+_0x5134('0x66'));}break;case'Contact':if(_0x2f849e[_0x5134('0x67')]===_0x5134('0x68')){if(_0x2f849e[_0x5134('0x63')]['split']('\x20')[_0x5134('0x69')]>0x1){_0x4e0777[_0x423f0d](_0x5134('0x6a'),qs[_0x5134('0x6b')](_0x2f849e[_0x5134('0x63')]),null);}else{var _0x3e704d='%'+_0x2f849e[_0x5134('0x63')]+'%';_0x4e0777[_0x423f0d](_0x5134('0x6c'),_0x3e704d,_0x3e704d,_0x3e704d);}}else{_0x5b68d3=_[_0x5134('0x62')](_0xbca191,['name',_0x5134('0x6d')]);_0x2f849e[_0x5134('0x49')]=_0x5134('0x6d');_0x5d5228=as[_0x5134('0x6e')](_0x1b1d19,_0x5b68d3[_0x5134('0x3a')],_0x2f849e);_0x4e0777[_0x423f0d](_0x5d5228['text'],_0x5d5228[_0x5134('0x63')][_0x5134('0x6f')],_0x5d5228['value'][_0x5134('0x20')]);}break;case _0x5134('0x70'):var _0x216b18=_0x2f849e[_0x5134('0x63')]['split'](',')['map'](function(_0x1afeb0){return Number(_0x1afeb0);});_0x216b18[_0x5134('0x36')](function(_0x31cc90){_0x1f01e0['or'](_0x5134('0x71'),'%,'+_0x31cc90+',%');});_0x33de9f=_[_0x5134('0x72')](_0x33de9f,_0x216b18);break;case _0x5134('0x73'):if(_0x2f849e[_0x5134('0x67')]===_0x5134('0x68')){_0x4e0777[_0x423f0d](_0x5134('0x74'),'%'+_0x2f849e['value']+'%',null);}else{_0x5b68d3=_['find'](_0xbca191,['name',_0x5134('0x75')]);_0x2f849e[_0x5134('0x49')]=_0x5134('0x75');_0x5d5228=as[_0x5134('0x6e')](_0x1b1d19,_0x5b68d3[_0x5134('0x3a')],_0x2f849e);_0x4e0777[_0x423f0d](_0x5d5228['text'],_0x5d5228[_0x5134('0x63')][_0x5134('0x6f')],_0x5d5228[_0x5134('0x63')]['end']);}break;case _0x5134('0x76'):_0x5d5228=as['buildExpression']('me',null,_0x2f849e);_0x4e0777[_0x423f0d](_0x5d5228[_0x5134('0x77')],_0x5d5228[_0x5134('0x63')]['start'],_0x5d5228[_0x5134('0x63')][_0x5134('0x20')]);break;}}else{var _0x5d5228=as[_0x5134('0x6e')](_0x1b1d19,_0x5b68d3[_0x5134('0x3a')],_0x2f849e);_0x4e0777[_0x423f0d](_0x5d5228[_0x5134('0x77')],_0x5d5228['value'][_0x5134('0x6f')],_0x5d5228['value'][_0x5134('0x20')]);}}}else{var _0x38815d=_(_0x332744['query'])[_0x5134('0x3e')]()['map'](function(_0x237a20){return _[_0x5134('0x78')](_0xbca191,[_0x5134('0x2f'),_0x237a20])?_0x237a20:undefined;})[_0x5134('0x79')]()[_0x5134('0x63')]();if(!_['isEmpty'](_0x38815d)){_0x38815d[_0x5134('0x36')](function(_0x541f64){if(_0x541f64===_0x5134('0x7a')){_0xf039f1[_0x5134('0x7b')](_0x5134('0x7c'),[]['concat'](_0x332744['query'][_0x541f64]));}else if(_0x541f64==='createdAt'){var _0x251078=JSON[_0x5134('0x7d')](_0x332744[_0x5134('0x3d')][_0x541f64])['$gte'];var _0x39d6a9=JSON[_0x5134('0x7d')](_0x332744[_0x5134('0x3d')][_0x541f64])['$lte'];_0xf039f1[_0x5134('0x7b')](_0x5134('0x7e'),_0x251078,_0x39d6a9);}else{if(_0x332744[_0x5134('0x3d')][_0x541f64]===_0x5134('0x7f')){_0xf039f1['where']('i.'+_0x541f64+_0x5134('0x80'));}else{_0xf039f1[_0x5134('0x7b')]('i.'+_0x541f64+_0x5134('0x81'),_0x332744[_0x5134('0x3d')][_0x541f64]);}}});}if(_0x332744[_0x5134('0x3d')][_0x5134('0x82')]){if(_0x332744['query'][_0x5134('0x82')]==0x1){_0xf039f1[_0x5134('0x65')](_0x5134('0x83'));}else{_0xf039f1[_0x5134('0x65')](_0x5134('0x84'));}}if(_0x332744[_0x5134('0x3d')][_0x5134('0x85')]){_0x33de9f=_[_0x5134('0x86')](_0x332744['query'][_0x5134('0x85')])?_0x332744[_0x5134('0x3d')][_0x5134('0x85')]:new Array(_0x332744[_0x5134('0x3d')]['tag']);_0x33de9f[_0x5134('0x36')](function(_0x4e1b2c){_0x1f01e0['or'](_0x5134('0x71'),'%,'+_0x4e1b2c+',%');});}if(_0x332744[_0x5134('0x3d')]['filter']){var _0x25b99f=_0x332744[_0x5134('0x3d')]['filter'][_0x5134('0x87')]('\x5c','\x5c\x5c')[_0x5134('0x87')](/'/g,'\x27\x27');if(qs[_0x5134('0x88')](_0x25b99f)){_0x4e0777['or'](_0x5134('0x89'),_0x25b99f+'%')['or'](_0x5134('0x8a'),_0x25b99f+'%');}_0x4e0777['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x25b99f+'%');}}_0xf039f1[_0x5134('0x7b')](_0x4e0777);_0xf039f1[_0x5134('0x8b')]('i.id');var _0x1ee0a5={'type':db[_0x5134('0x8c')]['QueryTypes'][_0x5134('0x8d')],'raw':!![]};var _0x512ed6=_0xf039f1[_0x5134('0x8e')]();_0x512ed6['field']('i.id');_0x512ed6['field'](_0x5134('0x8f'),_0x5134('0x90'));if(_0x2ecec3[_0x5134('0x45')]){_0x2ecec3[_0x5134('0x45')]['forEach'](function(_0x1c05f4){var _0x3e2d19=_0x1c05f4[0x0]===_0x5134('0x91')?_0x1c05f4[0x0]:'i.'+_0x1c05f4[0x0];_0xf039f1[_0x5134('0x45')](_0x3e2d19,_0x1c05f4[0x1]===_0x5134('0x92')?![]:!![]);});}if(!_[_0x5134('0x93')](_0x33de9f)){_0xf039f1[_0x5134('0x65')](_0x1f01e0);_0x512ed6[_0x5134('0x7b')]('t.id\x20IN\x20?',_0x33de9f);}BPromise['resolve']()[_0x5134('0x2b')](function(){if(!_0x169d57){if(_0x332744[_0x5134('0x3d')][_0x5134('0x7a')])return;_0x512ed6[_0x5134('0x7b')](_0x5134('0x94'));_0xf039f1['where'](_0x5134('0x94'));return;}if(_0x332744[_0x5134('0x95')][_0x5134('0x96')]!==_0x5134('0x97'))return;return _0x332744[_0x5134('0x95')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x5134('0x2b')](function(_0x3e210a){if(_[_0x5134('0x93')](_0x3e210a)){_0x512ed6['where'](_0x5134('0x98'));_0xf039f1[_0x5134('0x7b')](_0x5134('0x98'));}else{_0x512ed6['where'](_0x5134('0x7c'),_[_0x5134('0x32')](_0x3e210a,'id'));_0xf039f1[_0x5134('0x7b')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x3e210a,'id'));}});})[_0x5134('0x2b')](function(){if(_0x332744[_0x5134('0x95')][_0x5134('0x96')]==='agent'&&!_0x169d57&&!_0x332744[_0x5134('0x3d')][_0x5134('0x7a')])return[];return db['sequelize']['query'](_0x512ed6[_0x5134('0x99')](),_0x1ee0a5);})[_0x5134('0x2b')](function(_0x5f0d75){_0x16b779[_0x5134('0x25')]=_0x5f0d75[_0x5134('0x69')];if(_0x16b779[_0x5134('0x25')]===0x0)return[];return db[_0x5134('0x9a')][_0x5134('0x3d')](_0xf8b6f5['toString'](),_0x1ee0a5)[_0x5134('0x2b')](function(_0x3b8bfc){_0x4514e7=_[_0x5134('0x9b')](_0x3b8bfc,'id');_0x1ee0a5=_[_0x5134('0x9c')](_0x1ee0a5,{'model':db[_0x5134('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332744[_0x5134('0x3d')][_0x5134('0x42')]){_0x2ecec3['attributes'][_0x5134('0x36')](function(_0x28db85){_0xf039f1[_0x5134('0x49')]('i.'+_0x28db85);});}else{_0xf039f1[_0x5134('0x49')](_0x5134('0x8f'),_0x5134('0x90'));_0xf039f1['field']('a.key',_0x5134('0x9d'));_0xf039f1[_0x5134('0x49')](_0x5134('0x9e'),_0x5134('0x9f'));_0xf039f1[_0x5134('0x49')](_0x5134('0xa0'),_0x5134('0x91'));_0xf039f1['field'](_0x5134('0xa1'));_0xf039f1['field'](_0x5134('0xa2'),_0x5134('0xa3'));_0xf039f1['field'](_0x5134('0xa4'),_0x5134('0xa5'));_0xf039f1[_0x5134('0x49')](_0x5134('0xa6'),'Contact.email');_0xf039f1[_0x5134('0x49')](_0x5134('0xa7'),_0x5134('0xa8'));_0xf039f1['field'](_0x5134('0xa9'),_0x5134('0xaa'));_0xf039f1[_0x5134('0x49')](_0x5134('0xab'),_0x5134('0xac'));_0xf039f1[_0x5134('0x49')](_0x5134('0xad'),_0x5134('0xae'));_0xf039f1[_0x5134('0x49')]('o.internal','Owner.internal');_0xf039f1['field'](_0x5134('0xaf'),'TagIds');}if(_0x2ecec3[_0x5134('0x23')])_0xf039f1['limit'](_0x2ecec3[_0x5134('0x23')]);if(_0x2ecec3[_0x5134('0x22')])_0xf039f1[_0x5134('0x22')](_0x2ecec3[_0x5134('0x22')]);return db[_0x5134('0x9a')][_0x5134('0x3d')](_0xf039f1[_0x5134('0x99')](),_0x1ee0a5);})[_0x5134('0x2b')](function(_0x3bb8a2){if(_0x3bb8a2[_0x5134('0x69')]>0x0)_0x11fb36['where'](_0x5134('0xb0'),_[_0x5134('0x32')](_0x3bb8a2,'id'));return db['sequelize'][_0x5134('0x3d')](_0x11fb36['toString'](),_0x1ee0a5)[_0x5134('0x2b')](function(_0x1636de){var _0x188c4e=_[_0x5134('0xb1')](_0x1636de,_0x5134('0xb2'));var _0x3dcfea=[];_0x3bb8a2['forEach'](function(_0x27942d){_0x3dcfea['push'](updateFaxInteraction(_0x27942d,_0x4514e7,_0x188c4e));});return BPromise[_0x5134('0xb3')](_0x3dcfea);});});})['then'](function(_0x1e6833){_0x16b779['rows']=_0x1e6833;return _0x16b779;})[_0x5134('0x2b')](respondWithFilteredResult(_0x1a56c6,_0x2ecec3))[_0x5134('0x37')](handleError(_0x1a56c6,null));};exports['show']=function(_0x4f7de4,_0x3d56c7){var _0x4ceebd={'raw':![],'where':{'id':_0x4f7de4['params']['id']}},_0xca78d1={};_0xca78d1[_0x5134('0x3c')]=_[_0x5134('0x3e')](db[_0x5134('0x39')][_0x5134('0xb4')]);_0xca78d1[_0x5134('0x3d')]=_['keys'](_0x4f7de4[_0x5134('0x3d')]);_0xca78d1[_0x5134('0x3f')]=_[_0x5134('0x41')](_0xca78d1['model'],_0xca78d1[_0x5134('0x3d')]);_0x4ceebd[_0x5134('0x40')]=_[_0x5134('0x41')](_0xca78d1[_0x5134('0x3c')],qs[_0x5134('0x42')](_0x4f7de4['query'][_0x5134('0x42')]));_0x4ceebd[_0x5134('0x40')]=_0x4ceebd[_0x5134('0x40')][_0x5134('0x69')]?_0x4ceebd['attributes']:_0xca78d1[_0x5134('0x3c')];if(_0x4f7de4[_0x5134('0x3d')][_0x5134('0xb5')]){_0x4ceebd[_0x5134('0xb6')]=[{'all':!![]}];}_0x4ceebd=_[_0x5134('0x9c')]({},_0x4ceebd,_0x4f7de4[_0x5134('0xb7')]);return db[_0x5134('0x39')][_0x5134('0x62')](_0x4ceebd)[_0x5134('0x2b')](handleEntityNotFound(_0x3d56c7,null))[_0x5134('0x2b')](respondWithResult(_0x3d56c7,null))[_0x5134('0x37')](handleError(_0x3d56c7,null));};exports[_0x5134('0xb8')]=function(_0x54447d,_0x466978){return db[_0x5134('0x39')][_0x5134('0xb8')](_0x54447d[_0x5134('0x76')],{})[_0x5134('0x2b')](respondWithResult(_0x466978,0xc9))[_0x5134('0x37')](handleError(_0x466978,null));};exports[_0x5134('0x2a')]=function(_0x1a9376,_0x1eeb68){if(_0x1a9376['body']['id']){delete _0x1a9376['body']['id'];}return db[_0x5134('0x39')][_0x5134('0x62')]({'where':{'id':_0x1a9376['params']['id']}})['then'](handleEntityNotFound(_0x1eeb68,null))[_0x5134('0x2b')](saveUpdates(_0x1a9376[_0x5134('0x76')],null))[_0x5134('0x2b')](respondWithResult(_0x1eeb68,null))[_0x5134('0x37')](handleError(_0x1eeb68,null));};exports[_0x5134('0x2c')]=function(_0x13435f,_0x579fef){return db[_0x5134('0x39')][_0x5134('0x62')]({'where':{'id':_0x13435f[_0x5134('0xb9')]['id']}})[_0x5134('0x2b')](handleEntityNotFound(_0x579fef,null))[_0x5134('0x2b')](removeEntity(_0x579fef,null))[_0x5134('0x37')](handleError(_0x579fef,null));};exports[_0x5134('0xba')]=function(_0x2c6c96,_0x1f4054){return db['FaxInteraction']['describe']()[_0x5134('0x2b')](respondWithResult(_0x1f4054,null))[_0x5134('0x37')](handleError(_0x1f4054,null));};exports[_0x5134('0xbb')]=function(_0x5e1870,_0x24f923,_0x50ca9e){return db[_0x5134('0xbc')][_0x5134('0x62')]({'where':{'id':_0x5e1870[_0x5134('0xb9')]['id']}})[_0x5134('0x2b')](handleEntityNotFound(_0x24f923,null))[_0x5134('0x2b')](function(_0x19e006){if(_0x19e006){return _0x19e006[_0x5134('0xbb')](_0x5e1870[_0x5134('0x76')][_0x5134('0xbd')],_[_0x5134('0xbe')](_0x5e1870['body'],['ids','id'])||{});}})[_0x5134('0x2b')](respondWithResult(_0x24f923,null))[_0x5134('0x37')](handleError(_0x24f923,null));};exports[_0x5134('0xbf')]=function(_0x324cb7,_0x443974,_0x297e2a){var _0x118860={'raw':![],'where':{}};var _0x12eea3={};var _0x31b4cb={'count':0x0,'rows':[]};return db[_0x5134('0x39')][_0x5134('0xc0')]({'where':{'id':_0x324cb7['params']['id']}})[_0x5134('0x2b')](handleEntityNotFound(_0x443974,null))['then'](function(_0x5451d9){if(_0x5451d9){_0x12eea3[_0x5134('0x3c')]=_[_0x5134('0x3e')](db['FaxMessage'][_0x5134('0xb4')]);_0x12eea3[_0x5134('0x3d')]=_['keys'](_0x324cb7[_0x5134('0x3d')]);_0x12eea3['filters']=_['intersection'](_0x12eea3['model'],_0x12eea3[_0x5134('0x3d')]);_0x118860['attributes']=_['intersection'](_0x12eea3['model'],qs[_0x5134('0x42')](_0x324cb7[_0x5134('0x3d')][_0x5134('0x42')]));_0x118860['attributes']=_0x118860[_0x5134('0x40')][_0x5134('0x69')]?_0x118860[_0x5134('0x40')]:_0x12eea3[_0x5134('0x3c')];if(!_0x324cb7[_0x5134('0x3d')][_0x5134('0x43')](_0x5134('0x44'))){_0x118860['limit']=qs[_0x5134('0x23')](_0x324cb7[_0x5134('0x3d')]['limit']);_0x118860[_0x5134('0x22')]=qs['offset'](_0x324cb7[_0x5134('0x3d')][_0x5134('0x22')]);}_0x118860[_0x5134('0x45')]=qs[_0x5134('0x46')](_0x324cb7[_0x5134('0x3d')][_0x5134('0x46')]);_0x118860['where']=qs[_0x5134('0x3f')](_[_0x5134('0x47')](_0x324cb7[_0x5134('0x3d')],_0x12eea3['filters']));_0x118860[_0x5134('0x7b')][_0x5134('0xb2')]=_0x5451d9['id'];if(_0x324cb7[_0x5134('0x3d')][_0x5134('0xc1')]){_0x118860[_0x5134('0x7b')]=_['merge'](_0x118860[_0x5134('0x7b')],{'$or':_[_0x5134('0x32')](_0x118860[_0x5134('0x40')],function(_0x2b9cab){var _0x20d9ce={};_0x20d9ce[_0x2b9cab]={'$like':'%'+_0x324cb7[_0x5134('0x3d')]['filter']+'%'};return _0x20d9ce;})});}if(_0x324cb7[_0x5134('0x3d')]['$gte']){var _0x48063b=_0x324cb7[_0x5134('0x3d')][_0x5134('0xc2')][_0x5134('0xc3')](',');var _0x206e44={};_0x206e44[_0x48063b[0x0]]={'$gte':moment(_0x48063b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x118860['where']=_[_0x5134('0x9c')](_0x118860['where'],_0x206e44);}_0x118860=_[_0x5134('0x9c')]({},_0x118860,_0x324cb7['options']);return db[_0x5134('0xbc')][_0x5134('0x25')]({'where':_0x118860[_0x5134('0x7b')]})[_0x5134('0x2b')](function(_0xd79df5){_0x31b4cb[_0x5134('0x25')]=_0xd79df5;if(_0x324cb7['query']['includeAll']){_0x118860[_0x5134('0xb6')]=[{'all':!![]}];}return db['FaxMessage'][_0x5134('0xc4')](_0x118860);})[_0x5134('0x2b')](function(_0x472be1){_0x31b4cb['rows']=_0x472be1;return _0x31b4cb;});}})[_0x5134('0x2b')](respondWithFilteredResult(_0x443974,_0x118860))['catch'](handleError(_0x443974,null));};exports['addTags']=function(_0x3ffb53,_0x5a6c87,_0x3661b0){return db[_0x5134('0x39')][_0x5134('0x62')]({'where':{'id':_0x3ffb53['params']['id']}})[_0x5134('0x2b')](handleEntityNotFound(_0x5a6c87,null))[_0x5134('0x2b')](function(_0x2b53a5){if(_0x2b53a5){return _0x2b53a5[_0x5134('0xc5')](_0x3ffb53[_0x5134('0x76')][_0x5134('0xbd')],_['omit'](_0x3ffb53[_0x5134('0x76')],[_0x5134('0xbd'),'id'])||{})[_0x5134('0xc6')](function(){return db[_0x5134('0x70')][_0x5134('0xc4')]({'attributes':['id',_0x5134('0x2f'),_0x5134('0x4a')],'where':{'id':_0x3ffb53[_0x5134('0x76')][_0x5134('0xbd')]}});})[_0x5134('0x2b')](function(_0x387e11){socket[_0x5134('0xc7')](_0x5134('0xc8'),{'id':Number(_0x3ffb53[_0x5134('0xb9')]['id']),'tags':_0x387e11||[]});return{'id':Number(_0x3ffb53['params']['id']),'tags':_0x387e11||[]};});}})['then'](respondWithResult(_0x5a6c87,null))[_0x5134('0x37')](handleError(_0x5a6c87,null));};exports[_0x5134('0xc9')]=function(_0x199cf6,_0x37c919,_0x49a972){return db['FaxInteraction'][_0x5134('0x62')]({'where':{'id':_0x199cf6[_0x5134('0xb9')]['id']}})[_0x5134('0x2b')](handleEntityNotFound(_0x37c919,null))['then'](function(_0x4d7c12){if(_0x4d7c12){return _0x4d7c12['removeTags'](_0x199cf6[_0x5134('0x3d')][_0x5134('0xbd')]);}})[_0x5134('0x2b')](respondWithStatusCode(_0x37c919,null))['catch'](handleError(_0x37c919,null));};exports[_0x5134('0xca')]=function(_0x174935,_0x116293){var _0x195ccb=moment()[_0x5134('0xcb')]()[_0x5134('0x99')]();var _0x1622a7=path['join'](config[_0x5134('0xcc')],_0x5134('0xcd'),_0x5134('0xce'),_0x5134('0xcf'));var _0x25a2c6=path[_0x5134('0xd0')](config[_0x5134('0xcc')],_0x5134('0xcd'),_0x5134('0xce'),_0x5134('0xd1'));var _0x483884=path[_0x5134('0xd0')](_0x1622a7,_0x195ccb);var _0x147b2e=util[_0x5134('0xd2')](_0x5134('0xd3'),_0x174935[_0x5134('0xb9')]['id'],_0x195ccb);var _0x280e65=path[_0x5134('0xd0')](_0x1622a7,_0x147b2e);var _0x25595a=[];_0x25595a[_0x5134('0xd4')]({'model':db[_0x5134('0xd5')],'as':'Attachment','raw':!![]});var _0x58ee91=[{'model':db['FaxMessage'],'as':_0x5134('0xd6'),'attributes':['id',_0x5134('0x76'),_0x5134('0xd7')],'include':_0x25595a}];return db['FaxInteraction'][_0x5134('0x62')]({'where':{'id':_0x174935[_0x5134('0xb9')]['id']},'include':_0x58ee91})['then'](handleEntityNotFound(_0x116293,null))[_0x5134('0x2b')](function(_0x5e9fd9){if(_0x5e9fd9&&_0x5e9fd9[_0x5134('0xd6')]){var _0x37f1fd=_0x5e9fd9['get']({'plain':!![]});fs[_0x5134('0xd8')](_0x483884);for(var _0x19a14d=0x0;_0x19a14d<_0x37f1fd[_0x5134('0xd6')]['length'];_0x19a14d++){var _0x5854c8=_0x37f1fd[_0x5134('0xd6')][_0x19a14d][_0x5134('0xd5')];if(_0x5854c8){var _0x16187f=path['join'](_0x25a2c6,_0x5854c8[_0x5134('0xd9')]);if(fs[_0x5134('0xda')](_0x16187f)){fs[_0x5134('0xdb')](_0x16187f)[_0x5134('0xdc')](fs['createWriteStream'](path[_0x5134('0xd0')](_0x483884,_0x5854c8[_0x5134('0xd9')])));}}}return BPromise['resolve']()[_0x5134('0x2b')](function(){return new BPromise(function(_0x13e1f9,_0x31f7f3){zipdir(_0x483884,{'saveTo':_0x280e65},function(_0x55d0a5,_0x110da1){if(_0x55d0a5)return _0x31f7f3(_0x55d0a5);return _0x13e1f9(_0x110da1);});})['then'](function(){return new BPromise(function(_0x33ec7e,_0x4ef199){rimraf(_0x483884,function(_0xfc3084){if(_0xfc3084)_0x4ef199(_0xfc3084);return _0x33ec7e();});});})[_0x5134('0x2b')](function(){return _0x116293['download'](_0x280e65,_0x147b2e,function(_0x5f57ee){if(_0x5f57ee){console[_0x5134('0xdd')](_0x5134('0xde'),_0x5f57ee);}else{fs[_0x5134('0xdf')](_0x280e65);}});});});}else{return _0x116293[_0x5134('0x1e')](0xc8);}})[_0x5134('0x37')](handleError(_0x116293,null));}; \ No newline at end of file +var _0x12e1=['resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','includeAll','include','merge','create','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','FaxInteractionId','format','options','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createWriteStream','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','then','stack','name','send','Users','map','fullname','TagIds','split','Tags','push','catch','FaxInteraction','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','keys','some','compact','isEmpty','FaxAccountId','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','forEach','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?'];(function(_0x2f1bce,_0xc614e1){var _0x5cd1db=function(_0x5d34dd){while(--_0x5d34dd){_0x2f1bce['push'](_0x2f1bce['shift']());}};_0x5cd1db(++_0xc614e1);}(_0x12e1,0x119));var _0x112e=function(_0x324f63,_0x43eace){_0x324f63=_0x324f63-0x0;var _0x24a0bc=_0x12e1[_0x324f63];return _0x24a0bc;};'use strict';var emlformat=require(_0x112e('0x0'));var rimraf=require(_0x112e('0x1'));var zipdir=require(_0x112e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x112e('0x3'));var moment=require(_0x112e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x112e('0x5'));var util=require(_0x112e('0x6'));var path=require(_0x112e('0x7'));var sox=require(_0x112e('0x8'));var csv=require(_0x112e('0x9'));var ejs=require(_0x112e('0xa'));var fs=require('fs');var fs_extra=require(_0x112e('0xb'));var _=require(_0x112e('0xc'));var squel=require(_0x112e('0xd'));var crypto=require(_0x112e('0xe'));var jsforce=require(_0x112e('0xf'));var deskjs=require(_0x112e('0x10'));var toCsv=require(_0x112e('0x9'));var querystring=require(_0x112e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x112e('0x12'));var qs=require(_0x112e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x112e('0x14'));var logger=require(_0x112e('0x15'))(_0x112e('0x16'));var utils=require(_0x112e('0x17'));var config=require(_0x112e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x112e('0x19'))['db'];config[_0x112e('0x1a')]=_[_0x112e('0x1b')](config[_0x112e('0x1a')],{'host':_0x112e('0x1c'),'port':0x18eb});var socket=require(_0x112e('0x1d'))(new Redis(config[_0x112e('0x1a')]));require(_0x112e('0x1e'))[_0x112e('0x1f')](socket);function respondWithStatusCode(_0x13c65f,_0x1c49b1){_0x1c49b1=_0x1c49b1||0xcc;return function(_0x359a53){if(_0x359a53){return _0x13c65f[_0x112e('0x20')](_0x1c49b1);}return _0x13c65f[_0x112e('0x21')](_0x1c49b1)[_0x112e('0x22')]();};}function respondWithResult(_0xd3559a,_0x47f7c4){_0x47f7c4=_0x47f7c4||0xc8;return function(_0x281939){if(_0x281939){return _0xd3559a['status'](_0x47f7c4)['json'](_0x281939);}};}function respondWithFilteredResult(_0x504738,_0x2eea5f){return function(_0x5d9ec4){if(_0x5d9ec4){var _0x49e178=typeof _0x2eea5f[_0x112e('0x23')]===_0x112e('0x24')&&typeof _0x2eea5f['limit']==='undefined';var _0x20f419=_0x5d9ec4['count'];var _0x9f1725=_0x49e178?0x0:_0x2eea5f[_0x112e('0x23')];var _0x18e971=_0x49e178?_0x5d9ec4[_0x112e('0x25')]:_0x2eea5f[_0x112e('0x23')]+_0x2eea5f[_0x112e('0x26')];var _0x24bf8d;if(_0x18e971>=_0x20f419){_0x18e971=_0x20f419;_0x24bf8d=0xc8;}else{_0x24bf8d=0xce;}_0x504738[_0x112e('0x21')](_0x24bf8d);return _0x504738[_0x112e('0x27')](_0x112e('0x28'),_0x9f1725+'-'+_0x18e971+'/'+_0x20f419)[_0x112e('0x29')](_0x5d9ec4);}return null;};}function patchUpdates(_0x20b8f0){return function(_0x7c9056){try{jsonpatch[_0x112e('0x2a')](_0x7c9056,_0x20b8f0,!![]);}catch(_0x1411b8){return BPromise['reject'](_0x1411b8);}return _0x7c9056[_0x112e('0x2b')]();};}function saveUpdates(_0x53c6bf,_0x164187){return function(_0x42b932){if(_0x42b932){return _0x42b932[_0x112e('0x2c')](_0x53c6bf)['then'](function(_0x2a6b99){return _0x2a6b99;});}return null;};}function removeEntity(_0x454dfc,_0x2f9e4d){return function(_0x17a836){if(_0x17a836){return _0x17a836[_0x112e('0x2d')]()[_0x112e('0x2e')](function(){_0x454dfc[_0x112e('0x21')](0xcc)[_0x112e('0x22')]();});}};}function handleEntityNotFound(_0x237830,_0x528882){return function(_0x3d3b30){if(!_0x3d3b30){_0x237830[_0x112e('0x20')](0x194);}return _0x3d3b30;};}function handleError(_0x485ab2,_0x25595a){_0x25595a=_0x25595a||0x1f4;return function(_0x3da149){logger['error'](_0x3da149[_0x112e('0x2f')]);if(_0x3da149[_0x112e('0x30')]){delete _0x3da149['name'];}_0x485ab2[_0x112e('0x21')](_0x25595a)[_0x112e('0x31')](_0x3da149);};}function getInteractionUsers(_0x3a1263,_0x53f88e){return new BPromise(function(_0x43c3d1,_0x4fd94c){try{if(_0x53f88e[_0x3a1263['id']]){_0x3a1263[_0x112e('0x32')]=_[_0x112e('0x33')](_0x53f88e[_0x3a1263['id']],function(_0x4efb0b){return{'id':_0x4efb0b['id'],'fullname':_0x4efb0b[_0x112e('0x34')]};});}}catch(_0xf628c4){_0x4fd94c(_0xf628c4);}_0x43c3d1(_0x3a1263);});}function getInteractionTags(_0x5c848c,_0x528e7d){return new BPromise(function(_0x44d380,_0x118d92){try{if(_0x5c848c['TagIds']){_0x5c848c['Tags']=[];_0x5c848c[_0x112e('0x35')][_0x112e('0x36')](',')['forEach'](function(_0x1c8092){_0x5c848c[_0x112e('0x37')][_0x112e('0x38')](_0x528e7d[_0x1c8092]);});}delete _0x5c848c[_0x112e('0x35')];}catch(_0x58cf54){_0x118d92(_0x58cf54);}_0x44d380(_0x5c848c);});}function updateFaxInteraction(_0x588d51,_0xa980b7,_0x1b4f4b){return new BPromise(function(_0x10bc45,_0x195d54){return getInteractionUsers(_0x588d51,_0x1b4f4b)[_0x112e('0x2e')](function(_0x3f14be){return getInteractionTags(_0x3f14be,_0xa980b7);})['then'](function(_0x4d9e14){_0x10bc45(_0x4d9e14);})[_0x112e('0x39')](function(_0x3d08a8){_0x195d54(_0x3d08a8);});});}exports['index']=function(_0x594fba,_0x321c61){var _0x255735={},_0x2eadb1={},_0x1ed5d6={'count':0x0,'rows':[]};var _0x21ba27=_[_0x112e('0x33')](db[_0x112e('0x3a')][_0x112e('0x3b')],function(_0x465550){return{'name':_0x465550[_0x112e('0x3c')],'type':_0x465550[_0x112e('0x3d')]['key']};});_0x2eadb1[_0x112e('0x3e')]=_['map'](_0x21ba27,'name');_0x2eadb1[_0x112e('0x3f')]=_['keys'](_0x594fba[_0x112e('0x3f')]);_0x2eadb1['filters']=_['intersection'](_0x2eadb1[_0x112e('0x3e')],_0x2eadb1['query']);_0x255735[_0x112e('0x40')]=_[_0x112e('0x41')](_0x2eadb1[_0x112e('0x3e')],qs[_0x112e('0x42')](_0x594fba[_0x112e('0x3f')][_0x112e('0x42')]));_0x255735[_0x112e('0x40')]=_0x255735[_0x112e('0x40')][_0x112e('0x43')]?_0x255735['attributes']:_0x2eadb1[_0x112e('0x3e')];if(!_0x594fba[_0x112e('0x3f')][_0x112e('0x44')](_0x112e('0x45'))){_0x255735[_0x112e('0x26')]=qs[_0x112e('0x26')](_0x594fba[_0x112e('0x3f')][_0x112e('0x26')]);_0x255735[_0x112e('0x23')]=qs[_0x112e('0x23')](_0x594fba[_0x112e('0x3f')][_0x112e('0x23')]);}_0x255735[_0x112e('0x46')]=qs['sort'](_0x594fba[_0x112e('0x3f')][_0x112e('0x47')]);_0x255735[_0x112e('0x48')]=qs['filters'](_[_0x112e('0x49')](_0x594fba[_0x112e('0x3f')],_0x2eadb1[_0x112e('0x4a')]),_0x21ba27);var _0x2663c2=[];var _0x330010=squel[_0x112e('0x4b')]()[_0x112e('0x4c')]('id')[_0x112e('0x4c')](_0x112e('0x30'))['field'](_0x112e('0x4d'))[_0x112e('0x4e')](_0x112e('0x4f'));var _0x1ab160=squel[_0x112e('0x4b')]()[_0x112e('0x4c')](_0x112e('0x50'))[_0x112e('0x4c')](_0x112e('0x51'))[_0x112e('0x4c')](_0x112e('0x52'))['from'](_0x112e('0x53'),'ui')[_0x112e('0x54')](_0x112e('0x55'),'u','u.id\x20=\x20ui.UserId');var _0x5c3ff4=squel[_0x112e('0x4b')]()[_0x112e('0x4e')](_0x112e('0x56'),'i')['left_join']('cm_contacts','c',_0x112e('0x57'))[_0x112e('0x54')](_0x112e('0x55'),'o',_0x112e('0x58'))['left_join'](_0x112e('0x59'),'a',_0x112e('0x5a'))[_0x112e('0x54')](_0x112e('0x5b'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x112e('0x54')](_0x112e('0x5c'),'it',_0x112e('0x5d'))[_0x112e('0x54')](_0x112e('0x4f'),'t',_0x112e('0x5e'));var _0x3bd5e1=squel[_0x112e('0x5f')]();var _0x5729b5=[];var _0x35f017=squel[_0x112e('0x5f')]();var _0x19d3d7;if(_0x594fba[_0x112e('0x3f')][_0x112e('0x60')]){_0x19d3d7=as[_0x112e('0x61')](_0x594fba[_0x112e('0x3f')]['search']);var _0x5a4388=_0x19d3d7[_0x112e('0x62')];for(var _0x1cd45a=0x0;_0x1cd45a<_0x19d3d7['conditions'][_0x112e('0x43')];_0x1cd45a++){var _0x4dd4a4=_0x19d3d7['conditions'][_0x1cd45a];var _0x8f6b68='i';var _0x4fcdf1=_[_0x112e('0x63')](_0x21ba27,[_0x112e('0x30'),_0x4dd4a4[_0x112e('0x4c')]]);if(!_0x4fcdf1){switch(_0x4dd4a4[_0x112e('0x4c')]){case _0x112e('0x64'):if(_0x4dd4a4[_0x112e('0x65')]==0x1){_0x5c3ff4[_0x112e('0x66')]('`'+_0x4dd4a4[_0x112e('0x4c')]+_0x112e('0x67'));}else{_0x5c3ff4[_0x112e('0x66')]('`'+_0x4dd4a4[_0x112e('0x4c')]+_0x112e('0x68'));}break;case'Contact':if(_0x4dd4a4[_0x112e('0x69')]==='$substring'){if(_0x4dd4a4[_0x112e('0x65')]['split']('\x20')[_0x112e('0x43')]>0x1){_0x3bd5e1[_0x5a4388]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4dd4a4['value']),null);}else{var _0x3f7eac='%'+_0x4dd4a4[_0x112e('0x65')]+'%';_0x3bd5e1[_0x5a4388]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3f7eac,_0x3f7eac,_0x3f7eac);}}else{_0x4fcdf1=_['find'](_0x21ba27,['name',_0x112e('0x6a')]);_0x4dd4a4[_0x112e('0x4c')]=_0x112e('0x6a');_0x52fb2=as['buildExpression'](_0x8f6b68,_0x4fcdf1['type'],_0x4dd4a4);_0x3bd5e1[_0x5a4388](_0x52fb2[_0x112e('0x6b')],_0x52fb2[_0x112e('0x65')]['start'],_0x52fb2['value'][_0x112e('0x22')]);}break;case _0x112e('0x6c'):var _0x4a3db8=_0x4dd4a4[_0x112e('0x65')]['split'](',')[_0x112e('0x33')](function(_0x2d92a5){return Number(_0x2d92a5);});_0x4a3db8['forEach'](function(_0x3c8ef5){_0x35f017['or'](_0x112e('0x6d'),'%,'+_0x3c8ef5+',%');});_0x5729b5=_[_0x112e('0x6e')](_0x5729b5,_0x4a3db8);break;case'User':if(_0x4dd4a4['operator']===_0x112e('0x6f')){_0x3bd5e1[_0x5a4388](_0x112e('0x70'),'%'+_0x4dd4a4[_0x112e('0x65')]+'%',null);}else{_0x4fcdf1=_[_0x112e('0x63')](_0x21ba27,['name',_0x112e('0x71')]);_0x4dd4a4[_0x112e('0x4c')]='UserId';_0x52fb2=as[_0x112e('0x72')](_0x8f6b68,_0x4fcdf1[_0x112e('0x3d')],_0x4dd4a4);_0x3bd5e1[_0x5a4388](_0x52fb2['text'],_0x52fb2[_0x112e('0x65')][_0x112e('0x73')],_0x52fb2[_0x112e('0x65')][_0x112e('0x22')]);}break;case _0x112e('0x74'):_0x52fb2=as[_0x112e('0x72')]('me',null,_0x4dd4a4);_0x3bd5e1[_0x5a4388](_0x52fb2[_0x112e('0x6b')],_0x52fb2[_0x112e('0x65')]['start'],_0x52fb2[_0x112e('0x65')][_0x112e('0x22')]);break;}}else{var _0x52fb2=as[_0x112e('0x72')](_0x8f6b68,_0x4fcdf1[_0x112e('0x3d')],_0x4dd4a4);_0x3bd5e1[_0x5a4388](_0x52fb2[_0x112e('0x6b')],_0x52fb2['value'][_0x112e('0x73')],_0x52fb2[_0x112e('0x65')][_0x112e('0x22')]);}}}else{var _0x176165=_(_0x594fba[_0x112e('0x3f')])[_0x112e('0x75')]()[_0x112e('0x33')](function(_0x37d0ba){return _[_0x112e('0x76')](_0x21ba27,[_0x112e('0x30'),_0x37d0ba])?_0x37d0ba:undefined;})[_0x112e('0x77')]()[_0x112e('0x65')]();if(!_[_0x112e('0x78')](_0x176165)){_0x176165['forEach'](function(_0x2edae1){if(_0x2edae1===_0x112e('0x79')){_0x5c3ff4[_0x112e('0x48')]('i.FaxAccountId\x20IN\x20?',[][_0x112e('0x7a')](_0x594fba['query'][_0x2edae1]));}else if(_0x2edae1===_0x112e('0x7b')){var _0x71a792=JSON['parse'](_0x594fba[_0x112e('0x3f')][_0x2edae1])[_0x112e('0x7c')];var _0x16e41f=JSON[_0x112e('0x7d')](_0x594fba[_0x112e('0x3f')][_0x2edae1])['$lte'];_0x5c3ff4['where'](_0x112e('0x7e'),_0x71a792,_0x16e41f);}else{if(_0x594fba['query'][_0x2edae1]===_0x112e('0x7f')){_0x5c3ff4[_0x112e('0x48')]('i.'+_0x2edae1+'\x20IS\x20NULL');}else{_0x5c3ff4[_0x112e('0x48')]('i.'+_0x2edae1+_0x112e('0x80'),_0x594fba['query'][_0x2edae1]);}}});}if(_0x594fba[_0x112e('0x3f')][_0x112e('0x81')]){if(_0x594fba[_0x112e('0x3f')]['read']==0x1){_0x5c3ff4[_0x112e('0x66')]('`unreadMessages`\x20=\x200');}else{_0x5c3ff4[_0x112e('0x66')](_0x112e('0x82'));}}if(_0x594fba[_0x112e('0x3f')]['tag']){_0x5729b5=_['isArray'](_0x594fba[_0x112e('0x3f')][_0x112e('0x83')])?_0x594fba[_0x112e('0x3f')]['tag']:new Array(_0x594fba[_0x112e('0x3f')][_0x112e('0x83')]);_0x5729b5[_0x112e('0x84')](function(_0x3921ab){_0x35f017['or'](_0x112e('0x6d'),'%,'+_0x3921ab+',%');});}if(_0x594fba[_0x112e('0x3f')][_0x112e('0x85')]){var _0x47e6d6=_0x594fba['query'][_0x112e('0x85')]['replace']('\x5c','\x5c\x5c')[_0x112e('0x86')](/'/g,'\x27\x27');if(qs[_0x112e('0x87')](_0x47e6d6)){_0x3bd5e1['or'](_0x112e('0x88'),_0x47e6d6+'%')['or'](_0x112e('0x89'),_0x47e6d6+'%');}_0x3bd5e1['or'](_0x112e('0x8a'),_0x47e6d6+'%');}}_0x5c3ff4['where'](_0x3bd5e1);_0x5c3ff4[_0x112e('0x8b')](_0x112e('0x8c'));var _0xd60e7={'type':db[_0x112e('0x8d')][_0x112e('0x8e')][_0x112e('0x8f')],'raw':!![]};var _0x3341bd=_0x5c3ff4[_0x112e('0x90')]();_0x3341bd[_0x112e('0x4c')](_0x112e('0x8c'));_0x3341bd[_0x112e('0x4c')](_0x112e('0x91'),_0x112e('0x64'));if(_0x255735[_0x112e('0x46')]){_0x255735[_0x112e('0x46')][_0x112e('0x84')](function(_0x227f09){var _0xf33195=_0x227f09[0x0]===_0x112e('0x92')?_0x227f09[0x0]:'i.'+_0x227f09[0x0];_0x5c3ff4[_0x112e('0x46')](_0xf33195,_0x227f09[0x1]===_0x112e('0x93')?![]:!![]);});}if(!_[_0x112e('0x78')](_0x5729b5)){_0x5c3ff4[_0x112e('0x66')](_0x35f017);_0x3341bd[_0x112e('0x48')](_0x112e('0x94'),_0x5729b5);}BPromise[_0x112e('0x95')]()[_0x112e('0x2e')](function(){if(!_0x19d3d7){if(_0x594fba[_0x112e('0x3f')][_0x112e('0x79')])return;_0x3341bd['where'](_0x112e('0x96'));_0x5c3ff4[_0x112e('0x48')](_0x112e('0x96'));return;}if(_0x594fba[_0x112e('0x97')][_0x112e('0x98')]!=='agent')return;return _0x594fba[_0x112e('0x97')][_0x112e('0x99')]({'attributes':['id'],'raw':!![]})[_0x112e('0x2e')](function(_0xbb9e2d){if(_[_0x112e('0x78')](_0xbb9e2d)){_0x3341bd[_0x112e('0x48')](_0x112e('0x9a'));_0x5c3ff4['where'](_0x112e('0x9a'));}else{_0x3341bd[_0x112e('0x48')](_0x112e('0x9b'),_['map'](_0xbb9e2d,'id'));_0x5c3ff4[_0x112e('0x48')](_0x112e('0x9b'),_[_0x112e('0x33')](_0xbb9e2d,'id'));}});})[_0x112e('0x2e')](function(){if(_0x594fba[_0x112e('0x97')]['role']==='agent'&&!_0x19d3d7&&!_0x594fba[_0x112e('0x3f')][_0x112e('0x79')])return[];return db[_0x112e('0x9c')][_0x112e('0x3f')](_0x3341bd[_0x112e('0x9d')](),_0xd60e7);})[_0x112e('0x2e')](function(_0x4aa88){_0x1ed5d6[_0x112e('0x25')]=_0x4aa88[_0x112e('0x43')];if(_0x1ed5d6['count']===0x0)return[];return db[_0x112e('0x9c')][_0x112e('0x3f')](_0x330010[_0x112e('0x9d')](),_0xd60e7)['then'](function(_0x1525b4){_0x2663c2=_[_0x112e('0x9e')](_0x1525b4,'id');_0xd60e7=_['merge'](_0xd60e7,{'model':db[_0x112e('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x594fba[_0x112e('0x3f')][_0x112e('0x42')]){_0x255735['attributes'][_0x112e('0x84')](function(_0x3ad091){_0x5c3ff4['field']('i.'+_0x3ad091);});}else{_0x5c3ff4['field'](_0x112e('0x91'),_0x112e('0x64'));_0x5c3ff4['field'](_0x112e('0x9f'),_0x112e('0xa0'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xa1'),_0x112e('0xa2'));_0x5c3ff4[_0x112e('0x4c')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x112e('0x92'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xa3'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xa4'),_0x112e('0xa5'));_0x5c3ff4['field']('c.lastName',_0x112e('0xa6'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xa7'),'Contact.email');_0x5c3ff4['field'](_0x112e('0xa8'),_0x112e('0xa9'));_0x5c3ff4['field']('c.mobile',_0x112e('0xaa'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xab'),_0x112e('0xac'));_0x5c3ff4['field']('o.fullname',_0x112e('0xad'));_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xae'),'Owner.internal');_0x5c3ff4[_0x112e('0x4c')](_0x112e('0xaf'),'TagIds');}if(_0x255735[_0x112e('0x26')])_0x5c3ff4[_0x112e('0x26')](_0x255735[_0x112e('0x26')]);if(_0x255735[_0x112e('0x23')])_0x5c3ff4[_0x112e('0x23')](_0x255735['offset']);return db['sequelize'][_0x112e('0x3f')](_0x5c3ff4[_0x112e('0x9d')](),_0xd60e7);})[_0x112e('0x2e')](function(_0x26cb33){if(_0x26cb33['length']>0x0)_0x1ab160[_0x112e('0x48')]('ui.FaxInteractionId\x20IN\x20?',_[_0x112e('0x33')](_0x26cb33,'id'));return db[_0x112e('0x9c')][_0x112e('0x3f')](_0x1ab160[_0x112e('0x9d')](),_0xd60e7)[_0x112e('0x2e')](function(_0x31db9b){var _0x5ca2fc=_[_0x112e('0xb0')](_0x31db9b,'FaxInteractionId');var _0x3120a0=[];_0x26cb33[_0x112e('0x84')](function(_0x347347){_0x3120a0['push'](updateFaxInteraction(_0x347347,_0x2663c2,_0x5ca2fc));});return BPromise[_0x112e('0xb1')](_0x3120a0);});});})['then'](function(_0x365450){_0x1ed5d6[_0x112e('0xb2')]=_0x365450;return _0x1ed5d6;})[_0x112e('0x2e')](respondWithFilteredResult(_0x321c61,_0x255735))[_0x112e('0x39')](handleError(_0x321c61,null));};exports[_0x112e('0xb3')]=function(_0x5825af,_0x32dbd4){var _0x28a7c0={'raw':![],'where':{'id':_0x5825af[_0x112e('0xb4')]['id']}},_0x337f82={};_0x337f82[_0x112e('0x3e')]=_[_0x112e('0x75')](db[_0x112e('0x3a')][_0x112e('0x3b')]);_0x337f82[_0x112e('0x3f')]=_[_0x112e('0x75')](_0x5825af[_0x112e('0x3f')]);_0x337f82[_0x112e('0x4a')]=_[_0x112e('0x41')](_0x337f82[_0x112e('0x3e')],_0x337f82[_0x112e('0x3f')]);_0x28a7c0[_0x112e('0x40')]=_['intersection'](_0x337f82[_0x112e('0x3e')],qs[_0x112e('0x42')](_0x5825af[_0x112e('0x3f')][_0x112e('0x42')]));_0x28a7c0[_0x112e('0x40')]=_0x28a7c0[_0x112e('0x40')][_0x112e('0x43')]?_0x28a7c0[_0x112e('0x40')]:_0x337f82['model'];if(_0x5825af[_0x112e('0x3f')][_0x112e('0xb5')]){_0x28a7c0[_0x112e('0xb6')]=[{'all':!![]}];}_0x28a7c0=_[_0x112e('0xb7')]({},_0x28a7c0,_0x5825af['options']);return db['FaxInteraction'][_0x112e('0x63')](_0x28a7c0)[_0x112e('0x2e')](handleEntityNotFound(_0x32dbd4,null))['then'](respondWithResult(_0x32dbd4,null))['catch'](handleError(_0x32dbd4,null));};exports[_0x112e('0xb8')]=function(_0x5362ad,_0x1b5f33){return db[_0x112e('0x3a')][_0x112e('0xb8')](_0x5362ad['body'],{})['then'](respondWithResult(_0x1b5f33,0xc9))[_0x112e('0x39')](handleError(_0x1b5f33,null));};exports[_0x112e('0x2c')]=function(_0x1a216b,_0x4861fc){if(_0x1a216b[_0x112e('0x74')]['id']){delete _0x1a216b['body']['id'];}return db[_0x112e('0x3a')][_0x112e('0x63')]({'where':{'id':_0x1a216b[_0x112e('0xb4')]['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x4861fc,null))['then'](saveUpdates(_0x1a216b[_0x112e('0x74')],null))[_0x112e('0x2e')](respondWithResult(_0x4861fc,null))['catch'](handleError(_0x4861fc,null));};exports[_0x112e('0x2d')]=function(_0x484027,_0x175173){return db['FaxInteraction'][_0x112e('0x63')]({'where':{'id':_0x484027[_0x112e('0xb4')]['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x175173,null))[_0x112e('0x2e')](removeEntity(_0x175173,null))[_0x112e('0x39')](handleError(_0x175173,null));};exports[_0x112e('0xb9')]=function(_0x544b0f,_0x8c5541){return db[_0x112e('0x3a')][_0x112e('0xb9')]()[_0x112e('0x2e')](respondWithResult(_0x8c5541,null))[_0x112e('0x39')](handleError(_0x8c5541,null));};exports['addMessage']=function(_0x1fb387,_0x4b46fd,_0x333e42){return db['FaxMessage']['find']({'where':{'id':_0x1fb387['params']['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x4b46fd,null))[_0x112e('0x2e')](function(_0x550d60){if(_0x550d60){return _0x550d60[_0x112e('0xba')](_0x1fb387[_0x112e('0x74')][_0x112e('0xbb')],_[_0x112e('0xbc')](_0x1fb387[_0x112e('0x74')],[_0x112e('0xbb'),'id'])||{});}})[_0x112e('0x2e')](respondWithResult(_0x4b46fd,null))[_0x112e('0x39')](handleError(_0x4b46fd,null));};exports[_0x112e('0xbd')]=function(_0x1a2fb9,_0x8c2b76,_0x122b19){var _0x2f7720={'raw':![],'where':{}};var _0x1b887a={};var _0x477aef={'count':0x0,'rows':[]};return db[_0x112e('0x3a')][_0x112e('0xbe')]({'where':{'id':_0x1a2fb9['params']['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x8c2b76,null))['then'](function(_0x55142f){if(_0x55142f){_0x1b887a[_0x112e('0x3e')]=_[_0x112e('0x75')](db[_0x112e('0xbf')]['rawAttributes']);_0x1b887a['query']=_[_0x112e('0x75')](_0x1a2fb9[_0x112e('0x3f')]);_0x1b887a['filters']=_[_0x112e('0x41')](_0x1b887a['model'],_0x1b887a[_0x112e('0x3f')]);_0x2f7720[_0x112e('0x40')]=_[_0x112e('0x41')](_0x1b887a['model'],qs[_0x112e('0x42')](_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x42')]));_0x2f7720[_0x112e('0x40')]=_0x2f7720[_0x112e('0x40')]['length']?_0x2f7720[_0x112e('0x40')]:_0x1b887a[_0x112e('0x3e')];if(!_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x44')](_0x112e('0x45'))){_0x2f7720[_0x112e('0x26')]=qs[_0x112e('0x26')](_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x26')]);_0x2f7720[_0x112e('0x23')]=qs[_0x112e('0x23')](_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x23')]);}_0x2f7720[_0x112e('0x46')]=qs[_0x112e('0x47')](_0x1a2fb9['query'][_0x112e('0x47')]);_0x2f7720[_0x112e('0x48')]=qs[_0x112e('0x4a')](_[_0x112e('0x49')](_0x1a2fb9[_0x112e('0x3f')],_0x1b887a['filters']));_0x2f7720[_0x112e('0x48')][_0x112e('0xc0')]=_0x55142f['id'];if(_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x85')]){_0x2f7720[_0x112e('0x48')]=_[_0x112e('0xb7')](_0x2f7720['where'],{'$or':_[_0x112e('0x33')](_0x2f7720[_0x112e('0x40')],function(_0x1beee5){var _0x1ea903={};_0x1ea903[_0x1beee5]={'$like':'%'+_0x1a2fb9[_0x112e('0x3f')]['filter']+'%'};return _0x1ea903;})});}if(_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x7c')]){var _0xc068e4=_0x1a2fb9[_0x112e('0x3f')][_0x112e('0x7c')][_0x112e('0x36')](',');var _0x428e89={};_0x428e89[_0xc068e4[0x0]]={'$gte':moment(_0xc068e4[0x1])[_0x112e('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f7720[_0x112e('0x48')]=_['merge'](_0x2f7720[_0x112e('0x48')],_0x428e89);}_0x2f7720=_[_0x112e('0xb7')]({},_0x2f7720,_0x1a2fb9[_0x112e('0xc2')]);return db[_0x112e('0xbf')][_0x112e('0x25')]({'where':_0x2f7720[_0x112e('0x48')]})[_0x112e('0x2e')](function(_0x18ede6){_0x477aef['count']=_0x18ede6;if(_0x1a2fb9['query'][_0x112e('0xb5')]){_0x2f7720[_0x112e('0xb6')]=[{'all':!![]}];}return db[_0x112e('0xbf')]['findAll'](_0x2f7720);})[_0x112e('0x2e')](function(_0x37d1fe){_0x477aef[_0x112e('0xb2')]=_0x37d1fe;return _0x477aef;});}})[_0x112e('0x2e')](respondWithFilteredResult(_0x8c2b76,_0x2f7720))['catch'](handleError(_0x8c2b76,null));};exports['addTags']=function(_0x3ec8d6,_0x461cbc,_0x51a9e1){return db[_0x112e('0x3a')][_0x112e('0x63')]({'where':{'id':_0x3ec8d6[_0x112e('0xb4')]['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x461cbc,null))[_0x112e('0x2e')](function(_0x58f42d){if(_0x58f42d){return _0x58f42d['setTags'](_0x3ec8d6[_0x112e('0x74')][_0x112e('0xbb')],_[_0x112e('0xbc')](_0x3ec8d6[_0x112e('0x74')],[_0x112e('0xbb'),'id'])||{})[_0x112e('0xc3')](function(){return db[_0x112e('0x6c')]['findAll']({'attributes':['id',_0x112e('0x30'),_0x112e('0x4d')],'where':{'id':_0x3ec8d6[_0x112e('0x74')][_0x112e('0xbb')]}});})[_0x112e('0x2e')](function(_0x43d081){socket[_0x112e('0xc4')](_0x112e('0xc5'),{'id':Number(_0x3ec8d6[_0x112e('0xb4')]['id']),'tags':_0x43d081||[]});return{'id':Number(_0x3ec8d6['params']['id']),'tags':_0x43d081||[]};});}})[_0x112e('0x2e')](respondWithResult(_0x461cbc,null))[_0x112e('0x39')](handleError(_0x461cbc,null));};exports[_0x112e('0xc6')]=function(_0xff1e77,_0x10cc83,_0x25d8f8){return db['FaxInteraction'][_0x112e('0x63')]({'where':{'id':_0xff1e77['params']['id']}})[_0x112e('0x2e')](handleEntityNotFound(_0x10cc83,null))[_0x112e('0x2e')](function(_0x22f669){if(_0x22f669){return _0x22f669[_0x112e('0xc6')](_0xff1e77[_0x112e('0x3f')][_0x112e('0xbb')]);}})[_0x112e('0x2e')](respondWithStatusCode(_0x10cc83,null))[_0x112e('0x39')](handleError(_0x10cc83,null));};exports[_0x112e('0xc7')]=function(_0x2bae67,_0x35bdbf){var _0x4fc35b=moment()[_0x112e('0xc8')]()[_0x112e('0x9d')]();var _0x574f8b=path[_0x112e('0xc9')](config[_0x112e('0xca')],_0x112e('0xcb'),'files','tmp');var _0x7f81b0=path[_0x112e('0xc9')](config[_0x112e('0xca')],'server',_0x112e('0xcc'),_0x112e('0xcd'));var _0x1b9b6d=path[_0x112e('0xc9')](_0x574f8b,_0x4fc35b);var _0x103343=util[_0x112e('0xc1')](_0x112e('0xce'),_0x2bae67['params']['id'],_0x4fc35b);var _0x4adc3a=path[_0x112e('0xc9')](_0x574f8b,_0x103343);var _0x39150f=[];_0x39150f[_0x112e('0x38')]({'model':db['Attachment'],'as':_0x112e('0xcf'),'raw':!![]});var _0x2019a6=[{'model':db[_0x112e('0xbf')],'as':_0x112e('0xd0'),'attributes':['id','body',_0x112e('0x7b')],'include':_0x39150f}];return db[_0x112e('0x3a')][_0x112e('0x63')]({'where':{'id':_0x2bae67['params']['id']},'include':_0x2019a6})[_0x112e('0x2e')](handleEntityNotFound(_0x35bdbf,null))[_0x112e('0x2e')](function(_0x2e65b7){if(_0x2e65b7&&_0x2e65b7[_0x112e('0xd0')]){var _0x1c2ecc=_0x2e65b7[_0x112e('0xd1')]({'plain':!![]});fs[_0x112e('0xd2')](_0x1b9b6d);for(var _0xd6949e=0x0;_0xd6949e<_0x1c2ecc[_0x112e('0xd0')][_0x112e('0x43')];_0xd6949e++){var _0x230198=_0x1c2ecc[_0x112e('0xd0')][_0xd6949e][_0x112e('0xcf')];if(_0x230198){var _0x47407c=path[_0x112e('0xc9')](_0x7f81b0,_0x230198[_0x112e('0xd3')]);if(fs[_0x112e('0xd4')](_0x47407c)){fs['createReadStream'](_0x47407c)['pipe'](fs[_0x112e('0xd5')](path[_0x112e('0xc9')](_0x1b9b6d,_0x230198[_0x112e('0xd3')])));}}}return BPromise[_0x112e('0x95')]()[_0x112e('0x2e')](function(){return new BPromise(function(_0x37219f,_0xd6cfc){zipdir(_0x1b9b6d,{'saveTo':_0x4adc3a},function(_0x159f8a,_0x3b9fe4){if(_0x159f8a)return _0xd6cfc(_0x159f8a);return _0x37219f(_0x3b9fe4);});})[_0x112e('0x2e')](function(){return new BPromise(function(_0x307390,_0x56c581){rimraf(_0x1b9b6d,function(_0x2a3fef){if(_0x2a3fef)_0x56c581(_0x2a3fef);return _0x307390();});});})['then'](function(){return _0x35bdbf[_0x112e('0xc7')](_0x4adc3a,_0x103343,function(_0x579b93){if(_0x579b93){console['log']('err',_0x579b93);}else{fs[_0x112e('0xd6')](_0x4adc3a);}});});});}else{return _0x35bdbf['sendStatus'](0xc8);}})[_0x112e('0x39')](handleError(_0x35bdbf,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2603ca9..e492d8d 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 _0x1952=['then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','remove','getUsers'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0x1952,0x144));var _0x2195=function(_0x456f63,_0x38006b){_0x456f63=_0x456f63-0x0;var _0x2e0566=_0x1952[_0x456f63];return _0x2e0566;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x2195('0x0'))['db'][_0x2195('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x2195('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2195('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2195('0x4')};function emitEvent(_0x56af16){return function(_0x2691cc,_0x2528e1,_0x4f4636){_0x2691cc[_0x2195('0x5')]({'attributes':['id'],'raw':!![]})[_0x2195('0x6')](function(_0x487e1b){_0x2691cc[_0x2195('0x7')](_0x2195('0x8'),_0x487e1b['map'](function(_0x17718a){return{'id':_0x17718a['id']};}));return FaxMessage[_0x2195('0x9')]({'where':{'FaxInteractionId':_0x2691cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2195('0x6')](function(_0x301079){_0x2691cc[_0x2195('0x7')]('unreadMessages',_0x301079[_0x2195('0xa')]);FaxInteractionEvents[_0x2195('0xb')](_0x56af16+':'+_0x2691cc['id'],_0x2691cc);FaxInteractionEvents[_0x2195('0xb')](_0x56af16,_0x2691cc);_0x4f4636(null);})[_0x2195('0xc')](_0x4f4636(null));};}for(var e in events){if(events[_0x2195('0xd')](e)){var event=events[e];FaxInteraction[_0x2195('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x6a3f=['then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x17562c,_0x25f747){var _0x1e53a1=function(_0x526420){while(--_0x526420){_0x17562c['push'](_0x17562c['shift']());}};_0x1e53a1(++_0x25f747);}(_0x6a3f,0x123));var _0xf6a3=function(_0x5eb10f,_0x1be4fb){_0x5eb10f=_0x5eb10f-0x0;var _0x1af57a=_0x6a3f[_0x5eb10f];return _0x1af57a;};'use strict';var EventEmitter=require(_0xf6a3('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xf6a3('0x1')];var FaxMessage=require(_0xf6a3('0x2'))['db'][_0xf6a3('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf6a3('0x4')](0x0);var events={'afterCreate':_0xf6a3('0x5'),'afterUpdate':_0xf6a3('0x6'),'afterDestroy':_0xf6a3('0x7')};function emitEvent(_0x359710){return function(_0x26fb75,_0x4ac1cb,_0x5cb51f){_0x26fb75[_0xf6a3('0x8')]({'attributes':['id'],'raw':!![]})[_0xf6a3('0x9')](function(_0x56327c){_0x26fb75[_0xf6a3('0xa')](_0xf6a3('0xb'),_0x56327c[_0xf6a3('0xc')](function(_0xb1a431){return{'id':_0xb1a431['id']};}));return FaxMessage[_0xf6a3('0xd')]({'where':{'FaxInteractionId':_0x26fb75['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf6a3('0x9')](function(_0x137de7){_0x26fb75[_0xf6a3('0xa')](_0xf6a3('0xe'),_0x137de7['length']);FaxInteractionEvents['emit'](_0x359710+':'+_0x26fb75['id'],_0x26fb75);FaxInteractionEvents[_0xf6a3('0xf')](_0x359710,_0x26fb75);_0x5cb51f(null);})[_0xf6a3('0x10')](_0x5cb51f(null));};}for(var e in events){if(events[_0xf6a3('0x11')](e)){var event=events[e];FaxInteraction[_0xf6a3('0x12')](e,emitEvent(event));}}module[_0xf6a3('0x13')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 0d80f69..0e66c7a 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 _0xbc1d=['bluebird','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0x3f7149,_0x346ecd){var _0x20fb03=function(_0x8921f4){while(--_0x8921f4){_0x3f7149['push'](_0x3f7149['shift']());}};_0x20fb03(++_0x346ecd);}(_0xbc1d,0x19e));var _0xdbc1=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0xbc1d[_0x54ccd7];return _0x4e667b;};'use strict';var _=require('lodash');var util=require(_0xdbc1('0x0'));var logger=require(_0xdbc1('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdbc1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdbc1('0x3'));var attributes=require(_0xdbc1('0x4'));module[_0xdbc1('0x5')]=function(_0xd22d88,_0x21d327){return _0xd22d88[_0xdbc1('0x6')](_0xdbc1('0x7'),attributes,{'tableName':_0xdbc1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc6afae,_0x5663ac,_0x5edb42){if(_0xc6afae[_0xdbc1('0x9')]('closed')){_0xc6afae[_0xdbc1('0xa')]=moment()[_0xdbc1('0xb')](_0xdbc1('0xc'));}_0x5edb42(null,_0xc6afae);}}});}; \ No newline at end of file +var _0xa3d4=['moment','request-promise','define','FaxInteraction','fax_interactions','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa3d4,0x151));var _0x4a3d=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa3d4[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x4a3d('0x0'));var util=require('util');var logger=require(_0x4a3d('0x1'))(_0x4a3d('0x2'));var moment=require(_0x4a3d('0x3'));var BPromise=require('bluebird');var rp=require(_0x4a3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x3ab704,_0x461b5c){return _0x3ab704[_0x4a3d('0x5')](_0x4a3d('0x6'),attributes,{'tableName':_0x4a3d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4580f9,_0x3011e6,_0x79f478){if(_0x4580f9[_0x4a3d('0x8')]('closed')){_0x4580f9['closedAt']=moment()['format'](_0x4a3d('0x9'));}_0x79f478(null,_0x4580f9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6c9cab1..e476ed7 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 _0x9ad1=['addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','attributes','AddTagsToFaxInteraction','find','where'];(function(_0x2c0f4e,_0x3e8d74){var _0x3b1118=function(_0x5f48db){while(--_0x5f48db){_0x2c0f4e['push'](_0x2c0f4e['shift']());}};_0x3b1118(++_0x3e8d74);}(_0x9ad1,0xf5));var _0x19ad=function(_0x292dc1,_0x5b1afe){_0x292dc1=_0x292dc1-0x0;var _0x2a3ba7=_0x9ad1[_0x292dc1];return _0x2a3ba7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x19ad('0x0'));var BPromise=require(_0x19ad('0x1'));var rs=require(_0x19ad('0x2'));var fs=require('fs');var Redis=require(_0x19ad('0x3'));var db=require(_0x19ad('0x4'))['db'];var utils=require(_0x19ad('0x5'));var logger=require('../../config/logger')(_0x19ad('0x6'));var config=require('../../config/environment');var jayson=require(_0x19ad('0x7'));var client=jayson['client'][_0x19ad('0x8')]({'port':0x232a});config[_0x19ad('0x9')]=_[_0x19ad('0xa')](config['redis'],{'host':_0x19ad('0xb'),'port':0x18eb});var socket=require(_0x19ad('0xc'))(new Redis(config[_0x19ad('0x9')]));require(_0x19ad('0xd'))[_0x19ad('0xe')](socket);function respondWithRpcPromise(_0x103eae,_0x99c127,_0x147308){return new BPromise(function(_0x5f0465,_0x183589){return client['request'](_0x103eae,_0x147308)[_0x19ad('0xf')](function(_0x46c8b1){logger[_0x19ad('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x99c127,_0x19ad('0x11'));logger[_0x19ad('0x12')](_0x19ad('0x13'),_0x99c127,_0x19ad('0x11'),JSON[_0x19ad('0x14')](_0x46c8b1));if(_0x46c8b1[_0x19ad('0x15')]){if(_0x46c8b1[_0x19ad('0x15')][_0x19ad('0x16')]===0x1f4){logger[_0x19ad('0x15')](_0x19ad('0x17'),_0x99c127,_0x46c8b1[_0x19ad('0x15')][_0x19ad('0x18')]);return _0x183589(_0x46c8b1[_0x19ad('0x15')][_0x19ad('0x18')]);}logger[_0x19ad('0x15')](_0x19ad('0x17'),_0x99c127,_0x46c8b1[_0x19ad('0x15')]['message']);return _0x5f0465(_0x46c8b1[_0x19ad('0x15')][_0x19ad('0x18')]);}else{logger[_0x19ad('0x10')](_0x19ad('0x17'),_0x99c127,_0x19ad('0x11'));_0x5f0465(_0x46c8b1['result'][_0x19ad('0x18')]);}})[_0x19ad('0x19')](function(_0x16125a){logger[_0x19ad('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x99c127,_0x16125a);_0x183589(_0x16125a);});});}exports[_0x19ad('0x1a')]=function(_0x4ff6b3){var _0x587da5=this;return new Promise(function(_0x366d6c,_0x76ee5c){return db[_0x19ad('0x1b')]['update'](_0x4ff6b3[_0x19ad('0x1c')],{'raw':_0x4ff6b3[_0x19ad('0x1d')]?_0x4ff6b3['options'][_0x19ad('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ff6b3[_0x19ad('0x1d')]?_0x4ff6b3[_0x19ad('0x1d')]['where']||null:null,'attributes':_0x4ff6b3['options']?_0x4ff6b3[_0x19ad('0x1d')][_0x19ad('0x1f')]||null:null,'limit':_0x4ff6b3[_0x19ad('0x1d')]?_0x4ff6b3[_0x19ad('0x1d')]['limit']||null:null})[_0x19ad('0xf')](function(_0x4dcfdf){logger[_0x19ad('0x10')](_0x19ad('0x1a'),_0x4ff6b3);logger['debug']('UpdateFaxInteraction',_0x4ff6b3,JSON[_0x19ad('0x14')](_0x4dcfdf));_0x366d6c(_0x4dcfdf);})['catch'](function(_0x4dc274){logger[_0x19ad('0x15')](_0x19ad('0x1a'),_0x4dc274[_0x19ad('0x18')],_0x4ff6b3);_0x76ee5c(_0x587da5[_0x19ad('0x15')](0x1f4,_0x4dc274[_0x19ad('0x18')]));});});};exports[_0x19ad('0x20')]=function(_0x4b5c67){return new Promise(function(_0x21c1de,_0x604622){return db[_0x19ad('0x1b')][_0x19ad('0x21')]({'where':_0x4b5c67['options']?_0x4b5c67[_0x19ad('0x1d')][_0x19ad('0x22')]||null:null})[_0x19ad('0xf')](function(_0x305350){if(_0x305350){return _0x305350[_0x19ad('0x23')](_0x4b5c67['body'][_0x19ad('0x24')],_[_0x19ad('0x25')](_0x4b5c67[_0x19ad('0x1c')],[_0x19ad('0x24'),'id'])||{});}})[_0x19ad('0x26')](function(_0x4d9f01){logger[_0x19ad('0x10')](_0x19ad('0x27'),_0x4b5c67);logger[_0x19ad('0x12')]('AddTags',_0x4b5c67,JSON['stringify'](_0x4d9f01));_0x21c1de(_0x4d9f01);})[_0x19ad('0x19')](function(_0x50edbe){logger[_0x19ad('0x15')](_0x19ad('0x27'),_0x50edbe['message'],_0x4b5c67);_0x604622(_this[_0x19ad('0x15')](0x1f4,_0x50edbe['message']));});});}; \ No newline at end of file +var _0x8722=['ids','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','limit','debug','AddTagsToFaxInteraction','addTags'];(function(_0xf61d62,_0x5e1ce1){var _0x1b8b00=function(_0x21dbba){while(--_0x21dbba){_0xf61d62['push'](_0xf61d62['shift']());}};_0x1b8b00(++_0x5e1ce1);}(_0x8722,0x189));var _0x2872=function(_0x11faee,_0x3124b5){_0x11faee=_0x11faee-0x0;var _0x11e7d3=_0x8722[_0x11faee];return _0x11e7d3;};'use strict';var _=require(_0x2872('0x0'));var util=require(_0x2872('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2872('0x2'));var fs=require('fs');var Redis=require(_0x2872('0x3'));var db=require(_0x2872('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2872('0x5'))('rpc');var config=require(_0x2872('0x6'));var jayson=require(_0x2872('0x7'));var client=jayson[_0x2872('0x8')][_0x2872('0x9')]({'port':0x232a});config['redis']=_[_0x2872('0xa')](config[_0x2872('0xb')],{'host':_0x2872('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2872('0xd'))[_0x2872('0xe')](socket);function respondWithRpcPromise(_0x50fb1d,_0x2cc80f,_0x195534){return new BPromise(function(_0x947916,_0x59f8fd){return client[_0x2872('0xf')](_0x50fb1d,_0x195534)[_0x2872('0x10')](function(_0x2fdfbb){logger['info'](_0x2872('0x11'),_0x2cc80f,_0x2872('0x12'));logger['debug'](_0x2872('0x13'),_0x2cc80f,'request\x20sent',JSON[_0x2872('0x14')](_0x2fdfbb));if(_0x2fdfbb[_0x2872('0x15')]){if(_0x2fdfbb[_0x2872('0x15')][_0x2872('0x16')]===0x1f4){logger[_0x2872('0x15')](_0x2872('0x11'),_0x2cc80f,_0x2fdfbb[_0x2872('0x15')]['message']);return _0x59f8fd(_0x2fdfbb[_0x2872('0x15')][_0x2872('0x17')]);}logger[_0x2872('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x2cc80f,_0x2fdfbb[_0x2872('0x15')]['message']);return _0x947916(_0x2fdfbb['error']['message']);}else{logger[_0x2872('0x18')](_0x2872('0x11'),_0x2cc80f,_0x2872('0x12'));_0x947916(_0x2fdfbb[_0x2872('0x19')][_0x2872('0x17')]);}})[_0x2872('0x1a')](function(_0x4a06a1){logger[_0x2872('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x2cc80f,_0x4a06a1);_0x59f8fd(_0x4a06a1);});});}exports[_0x2872('0x1b')]=function(_0x166a92){var _0x51edf6=this;return new Promise(function(_0x4f7b1e,_0x2aabb2){return db[_0x2872('0x1c')]['update'](_0x166a92[_0x2872('0x1d')],{'raw':_0x166a92['options']?_0x166a92[_0x2872('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x166a92[_0x2872('0x1e')]?_0x166a92[_0x2872('0x1e')][_0x2872('0x1f')]||null:null,'attributes':_0x166a92[_0x2872('0x1e')]?_0x166a92[_0x2872('0x1e')]['attributes']||null:null,'limit':_0x166a92[_0x2872('0x1e')]?_0x166a92['options'][_0x2872('0x20')]||null:null})[_0x2872('0x10')](function(_0x4ac130){logger[_0x2872('0x18')](_0x2872('0x1b'),_0x166a92);logger[_0x2872('0x21')](_0x2872('0x1b'),_0x166a92,JSON[_0x2872('0x14')](_0x4ac130));_0x4f7b1e(_0x4ac130);})[_0x2872('0x1a')](function(_0x33afed){logger[_0x2872('0x15')](_0x2872('0x1b'),_0x33afed['message'],_0x166a92);_0x2aabb2(_0x51edf6[_0x2872('0x15')](0x1f4,_0x33afed[_0x2872('0x17')]));});});};exports[_0x2872('0x22')]=function(_0x1aea3b){return new Promise(function(_0x4d3688,_0x540ea1){return db[_0x2872('0x1c')]['find']({'where':_0x1aea3b[_0x2872('0x1e')]?_0x1aea3b['options'][_0x2872('0x1f')]||null:null})['then'](function(_0x221994){if(_0x221994){return _0x221994[_0x2872('0x23')](_0x1aea3b[_0x2872('0x1d')][_0x2872('0x24')],_['omit'](_0x1aea3b[_0x2872('0x1d')],[_0x2872('0x24'),'id'])||{});}})[_0x2872('0x25')](function(_0x48cb14){logger['info'](_0x2872('0x26'),_0x1aea3b);logger[_0x2872('0x21')](_0x2872('0x26'),_0x1aea3b,JSON['stringify'](_0x48cb14));_0x4d3688(_0x48cb14);})[_0x2872('0x1a')](function(_0x300317){logger[_0x2872('0x15')](_0x2872('0x26'),_0x300317['message'],_0x1aea3b);_0x540ea1(_this[_0x2872('0x15')](0x1f4,_0x300317[_0x2872('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1335959..1e8715a 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 _0x4809=['./faxInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x4a9520,_0x4e67b2){var _0x27d098=function(_0x3e367c){while(--_0x3e367c){_0x4a9520['push'](_0x4a9520['shift']());}};_0x27d098(++_0x4e67b2);}(_0x4809,0x173));var _0x9480=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x4809[_0x261522];return _0x98a25a;};'use strict';var FaxInteractionEvents=require(_0x9480('0x0'));var events=[_0x9480('0x1'),_0x9480('0x2'),_0x9480('0x3')];function createListener(_0x2bf5e8,_0x1799e4){return function(_0x3dc5ce){_0x1799e4['emit'](_0x2bf5e8,_0x3dc5ce);};}function removeListener(_0x10dcf3,_0x408c36){return function(){FaxInteractionEvents[_0x9480('0x4')](_0x10dcf3,_0x408c36);};}exports[_0x9480('0x5')]=function(_0x318273){for(var _0x5c81ee=0x0,_0xf2705b=events[_0x9480('0x6')];_0x5c81ee<_0xf2705b;_0x5c81ee++){var _0x5bb729=events[_0x5c81ee];var _0x448494=createListener('faxInteraction:'+_0x5bb729,_0x318273);FaxInteractionEvents['on'](_0x5bb729,_0x448494);}}; \ No newline at end of file +var _0x6252=['emit','removeListener','faxInteraction:','./faxInteraction.events','remove','update'];(function(_0x5929d6,_0x4f3835){var _0x52d38b=function(_0x99f48f){while(--_0x99f48f){_0x5929d6['push'](_0x5929d6['shift']());}};_0x52d38b(++_0x4f3835);}(_0x6252,0xc3));var _0x2625=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x6252[_0x49b207];return _0x2dc8fa;};'use strict';var FaxInteractionEvents=require(_0x2625('0x0'));var events=['save',_0x2625('0x1'),_0x2625('0x2')];function createListener(_0x4e1de8,_0x4b09e7){return function(_0x17597c){_0x4b09e7[_0x2625('0x3')](_0x4e1de8,_0x17597c);};}function removeListener(_0x247748,_0x46568d){return function(){FaxInteractionEvents[_0x2625('0x4')](_0x247748,_0x46568d);};}exports['register']=function(_0x511b62){for(var _0x43fc8d=0x0,_0x3ffa88=events['length'];_0x43fc8d<_0x3ffa88;_0x43fc8d++){var _0x396c4f=events[_0x43fc8d];var _0x4cb5af=createListener(_0x2625('0x5')+_0x396c4f,_0x511b62);FaxInteractionEvents['on'](_0x396c4f,_0x4cb5af);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 27b14ce..578f8ce 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 _0x2c59=['put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','post','addMessage','/:id/tags','tracked','faxinteraction:addtags'];(function(_0x577acd,_0x2dddb2){var _0x2bfd74=function(_0x39d069){while(--_0x39d069){_0x577acd['push'](_0x577acd['shift']());}};_0x2bfd74(++_0x2dddb2);}(_0x2c59,0x1e9));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x92c5('0x0'));var util=require(_0x92c5('0x1'));var path=require('path');var timeout=require(_0x92c5('0x2'));var express=require('express');var router=express[_0x92c5('0x3')]();var fs_extra=require(_0x92c5('0x4'));var auth=require(_0x92c5('0x5'));var interaction=require(_0x92c5('0x6'));var config=require(_0x92c5('0x7'));var controller=require(_0x92c5('0x8'));router[_0x92c5('0x9')]('/',auth[_0x92c5('0xa')](),controller[_0x92c5('0xb')]);router[_0x92c5('0x9')](_0x92c5('0xc'),auth[_0x92c5('0xa')](),controller['describe']);router[_0x92c5('0x9')](_0x92c5('0xd'),auth[_0x92c5('0xa')](),controller[_0x92c5('0xe')]);router[_0x92c5('0x9')]('/:id/messages',auth[_0x92c5('0xa')](),controller['getMessages']);router['get'](_0x92c5('0xf'),auth[_0x92c5('0xa')](),controller['download']);router['post']('/',auth[_0x92c5('0xa')](),controller['create']);router[_0x92c5('0x10')]('/:id/messages',auth[_0x92c5('0xa')](),controller[_0x92c5('0x11')]);router[_0x92c5('0x10')](_0x92c5('0x12'),auth['isAuthenticated'](),interaction[_0x92c5('0x13')]('fax',_0x92c5('0x14')),controller['addTags']);router[_0x92c5('0x15')](_0x92c5('0xd'),auth[_0x92c5('0xa')](),interaction[_0x92c5('0x13')](_0x92c5('0x16'),_0x92c5('0x17')),controller[_0x92c5('0x18')]);router[_0x92c5('0x19')](_0x92c5('0xd'),auth[_0x92c5('0xa')](),interaction[_0x92c5('0x13')](_0x92c5('0x16'),_0x92c5('0x1a')),controller[_0x92c5('0x1b')]);router['delete'](_0x92c5('0x12'),auth[_0x92c5('0xa')](),controller[_0x92c5('0x1c')]);module[_0x92c5('0x1d')]=router; \ No newline at end of file +var _0x75a4=['tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags'];(function(_0x5a8e47,_0x177836){var _0xacd8d3=function(_0x31344f){while(--_0x31344f){_0x5a8e47['push'](_0x5a8e47['shift']());}};_0xacd8d3(++_0x177836);}(_0x75a4,0x180));var _0x475a=function(_0x335278,_0x22e892){_0x335278=_0x335278-0x0;var _0x590908=_0x75a4[_0x335278];return _0x590908;};'use strict';var multer=require(_0x475a('0x0'));var util=require(_0x475a('0x1'));var path=require(_0x475a('0x2'));var timeout=require('connect-timeout');var express=require(_0x475a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x475a('0x4'));var config=require('../../config/environment');var controller=require(_0x475a('0x5'));router[_0x475a('0x6')]('/',auth[_0x475a('0x7')](),controller[_0x475a('0x8')]);router[_0x475a('0x6')](_0x475a('0x9'),auth[_0x475a('0x7')](),controller[_0x475a('0xa')]);router[_0x475a('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x475a('0xb')]);router[_0x475a('0x6')](_0x475a('0xc'),auth[_0x475a('0x7')](),controller[_0x475a('0xd')]);router[_0x475a('0x6')](_0x475a('0xe'),auth[_0x475a('0x7')](),controller['download']);router[_0x475a('0xf')]('/',auth[_0x475a('0x7')](),controller[_0x475a('0x10')]);router[_0x475a('0xf')](_0x475a('0xc'),auth[_0x475a('0x7')](),controller[_0x475a('0x11')]);router[_0x475a('0xf')](_0x475a('0x12'),auth['isAuthenticated'](),interaction[_0x475a('0x13')](_0x475a('0x14'),_0x475a('0x15')),controller[_0x475a('0x16')]);router[_0x475a('0x17')](_0x475a('0x18'),auth[_0x475a('0x7')](),interaction[_0x475a('0x13')](_0x475a('0x14'),_0x475a('0x19')),controller['update']);router[_0x475a('0x1a')](_0x475a('0x18'),auth[_0x475a('0x7')](),interaction[_0x475a('0x13')](_0x475a('0x14'),_0x475a('0x1b')),controller[_0x475a('0x1c')]);router[_0x475a('0x1a')]('/:id/tags',auth[_0x475a('0x7')](),controller[_0x475a('0x1d')]);module[_0x475a('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 773c552..54987e9 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 _0x1306=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3d90b4,_0x1e2fc6){var _0x4c65d3=function(_0x311abc){while(--_0x311abc){_0x3d90b4['push'](_0x3d90b4['shift']());}};_0x4c65d3(++_0x1e2fc6);}(_0x1306,0x17a));var _0x6130=function(_0x14896c,_0x317d64){_0x14896c=_0x14896c-0x0;var _0x42f805=_0x1306[_0x14896c];return _0x42f805;};'use strict';var Sequelize=require(_0x6130('0x0'));module[_0x6130('0x1')]={'body':{'type':Sequelize[_0x6130('0x2')](_0x6130('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6130('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6130('0x5')]('in',_0x6130('0x6')),'defaultValue':_0x6130('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6130('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6130('0x7')]}}; \ No newline at end of file +var _0x66fa=['sequelize','exports','TEXT','ENUM','out','DATE'];(function(_0x22dfca,_0x2c6e8d){var _0x5b8794=function(_0x52f50d){while(--_0x52f50d){_0x22dfca['push'](_0x22dfca['shift']());}};_0x5b8794(++_0x2c6e8d);}(_0x66fa,0x168));var _0xa66f=function(_0xbbc489,_0x14aac4){_0xbbc489=_0xbbc489-0x0;var _0x132d80=_0x66fa[_0xbbc489];return _0x132d80;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'body':{'type':Sequelize[_0xa66f('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa66f('0x3')]('in',_0xa66f('0x4')),'defaultValue':_0xa66f('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa66f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa66f('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 380f2fb..f7a5fa4 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 _0x9f26=['http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','name','index','FaxMessage','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','include','findAll','rows','show','params','rawAttributes','intersection','includeAll','options','find','body','fax-interactions','read','format','UserId','user','agent','FaxInteraction','FaxInteractionId','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','QueryTypes','contact','event','rejectmessage','create','CmContact','findOne','fax','Attachment','AttachmentId','SendFax','isNil','/var/opt/motion2/server/files/attachments/%s','basename','download','root','files','attachments','join','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client'];(function(_0x28b836,_0xfdb5d9){var _0x42c968=function(_0x1bdba3){while(--_0x1bdba3){_0x28b836['push'](_0x28b836['shift']());}};_0x42c968(++_0xfdb5d9);}(_0x9f26,0x183));var _0x69f2=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0x9f26[_0x379799];return _0x46e431;};'use strict';var emlformat=require(_0x69f2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x69f2('0x1'));var rp=require(_0x69f2('0x2'));var moment=require('moment');var BPromise=require(_0x69f2('0x3'));var Mustache=require(_0x69f2('0x4'));var util=require(_0x69f2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x69f2('0x6'));var ejs=require(_0x69f2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x69f2('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x69f2('0x9'));var toCsv=require(_0x69f2('0x6'));var querystring=require(_0x69f2('0xa'));var Papa=require(_0x69f2('0xb'));var Redis=require('ioredis');var authService=require(_0x69f2('0xc'));var qs=require(_0x69f2('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x69f2('0xe'))('api');var utils=require(_0x69f2('0xf'));var config=require(_0x69f2('0x10'));var licenseUtil=require(_0x69f2('0x11'));var db=require(_0x69f2('0x12'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x69f2('0x13'))(new Redis(config['redis']));require(_0x69f2('0x14'))[_0x69f2('0x15')](socket);var jayson=require(_0x69f2('0x16'));var client=jayson[_0x69f2('0x17')]['http']({'port':0x232c});var client9002=jayson['client'][_0x69f2('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x57eb04,_0x1b3409,_0x4519f1,_0x1bad6c){return new BPromise(function(_0x85e164,_0x33bdab){var _0x3a00de=_0x1bad6c||client;return _0x3a00de[_0x69f2('0x19')](_0x57eb04,_0x4519f1)[_0x69f2('0x1a')](function(_0x46ea29){logger[_0x69f2('0x1b')](_0x69f2('0x1c'),_0x1b3409,_0x69f2('0x1d'));logger[_0x69f2('0x1e')](_0x69f2('0x1f'),_0x1b3409,_0x69f2('0x1d'),JSON[_0x69f2('0x20')](_0x46ea29));if(_0x46ea29[_0x69f2('0x21')]){if(_0x46ea29[_0x69f2('0x21')][_0x69f2('0x22')]===0x1f4){logger[_0x69f2('0x21')](_0x69f2('0x1c'),_0x1b3409,_0x46ea29['error'][_0x69f2('0x23')]);return _0x33bdab(_0x46ea29[_0x69f2('0x21')][_0x69f2('0x23')]);}logger['error'](_0x69f2('0x1c'),_0x1b3409,_0x46ea29[_0x69f2('0x21')][_0x69f2('0x23')]);return _0x85e164(_0x46ea29['error'][_0x69f2('0x23')]);}else{logger[_0x69f2('0x1b')](_0x69f2('0x1c'),_0x1b3409,_0x69f2('0x1d'));_0x85e164(_0x46ea29[_0x69f2('0x24')][_0x69f2('0x23')]);}})[_0x69f2('0x25')](function(_0x3f36c0){logger[_0x69f2('0x21')](_0x69f2('0x1c'),_0x1b3409,_0x3f36c0);_0x33bdab(_0x3f36c0);});});}function respondWithStatusCode(_0x4839d0,_0x16eb66){_0x16eb66=_0x16eb66||0xcc;return function(_0x3eefea){if(_0x3eefea){return _0x4839d0[_0x69f2('0x26')](_0x16eb66);}return _0x4839d0[_0x69f2('0x27')](_0x16eb66)[_0x69f2('0x28')]();};}function respondWithResult(_0x53ed62,_0x34f5de){_0x34f5de=_0x34f5de||0xc8;return function(_0x2bf2ad){if(_0x2bf2ad){return _0x53ed62[_0x69f2('0x27')](_0x34f5de)[_0x69f2('0x29')](_0x2bf2ad);}};}function respondWithFilteredResult(_0x11e8e8,_0x207e21){return function(_0x24e2f3){if(_0x24e2f3){var _0x3bebaf=typeof _0x207e21['offset']===_0x69f2('0x2a')&&typeof _0x207e21[_0x69f2('0x2b')]==='undefined';var _0x22b724=_0x24e2f3['count'];var _0x56a8e8=_0x3bebaf?0x0:_0x207e21[_0x69f2('0x2c')];var _0x36af42=_0x3bebaf?_0x24e2f3[_0x69f2('0x2d')]:_0x207e21[_0x69f2('0x2c')]+_0x207e21['limit'];var _0x14b3f7;if(_0x36af42>=_0x22b724){_0x36af42=_0x22b724;_0x14b3f7=0xc8;}else{_0x14b3f7=0xce;}_0x11e8e8[_0x69f2('0x27')](_0x14b3f7);return _0x11e8e8[_0x69f2('0x2e')](_0x69f2('0x2f'),_0x56a8e8+'-'+_0x36af42+'/'+_0x22b724)[_0x69f2('0x29')](_0x24e2f3);}return null;};}function patchUpdates(_0x158151){return function(_0x201a2d){try{jsonpatch[_0x69f2('0x30')](_0x201a2d,_0x158151,!![]);}catch(_0xe2dbe5){return BPromise[_0x69f2('0x31')](_0xe2dbe5);}return _0x201a2d[_0x69f2('0x32')]();};}function saveUpdates(_0x183d23,_0x85a4a6){return function(_0xc8695a){if(_0xc8695a){return _0xc8695a[_0x69f2('0x33')](_0x183d23)[_0x69f2('0x1a')](function(_0x5b5d73){return _0x5b5d73;});}return null;};}function removeEntity(_0xe8b4b1,_0xefa48c){return function(_0xf60681){if(_0xf60681){return _0xf60681[_0x69f2('0x34')]()[_0x69f2('0x1a')](function(){_0xe8b4b1[_0x69f2('0x27')](0xcc)[_0x69f2('0x28')]();});}};}function handleEntityNotFound(_0x4d6b51,_0x56d30e){return function(_0x29c92a){if(!_0x29c92a){_0x4d6b51[_0x69f2('0x26')](0x194);}return _0x29c92a;};}function handleError(_0x28e832,_0xc41e0a){_0xc41e0a=_0xc41e0a||0x1f4;return function(_0x41f9f5){logger['error'](_0x41f9f5['stack']);if(_0x41f9f5[_0x69f2('0x35')]){delete _0x41f9f5[_0x69f2('0x35')];}_0x28e832[_0x69f2('0x27')](_0xc41e0a)['send'](_0x41f9f5);};}exports[_0x69f2('0x36')]=function(_0x40f813,_0x162763){var _0x50d02d={},_0x2f9cd9={},_0x4ba505={'count':0x0,'rows':[]};var _0x105598=_['map'](db[_0x69f2('0x37')]['rawAttributes'],function(_0x36927d){return{'name':_0x36927d[_0x69f2('0x38')],'type':_0x36927d[_0x69f2('0x39')][_0x69f2('0x3a')]};});_0x2f9cd9['model']=_['map'](_0x105598,_0x69f2('0x35'));_0x2f9cd9[_0x69f2('0x3b')]=_[_0x69f2('0x3c')](_0x40f813[_0x69f2('0x3b')]);_0x2f9cd9[_0x69f2('0x3d')]=_['intersection'](_0x2f9cd9[_0x69f2('0x3e')],_0x2f9cd9[_0x69f2('0x3b')]);_0x50d02d[_0x69f2('0x3f')]=_['intersection'](_0x2f9cd9['model'],qs[_0x69f2('0x40')](_0x40f813[_0x69f2('0x3b')][_0x69f2('0x40')]));_0x50d02d[_0x69f2('0x3f')]=_0x50d02d['attributes'][_0x69f2('0x41')]?_0x50d02d['attributes']:_0x2f9cd9[_0x69f2('0x3e')];if(!_0x40f813[_0x69f2('0x3b')][_0x69f2('0x42')](_0x69f2('0x43'))){_0x50d02d[_0x69f2('0x2b')]=qs[_0x69f2('0x2b')](_0x40f813[_0x69f2('0x3b')]['limit']);_0x50d02d[_0x69f2('0x2c')]=qs['offset'](_0x40f813[_0x69f2('0x3b')]['offset']);}_0x50d02d['order']=qs['sort'](_0x40f813[_0x69f2('0x3b')][_0x69f2('0x44')]);_0x50d02d[_0x69f2('0x45')]=qs['filters'](_[_0x69f2('0x46')](_0x40f813['query'],_0x2f9cd9[_0x69f2('0x3d')]),_0x105598);if(_0x40f813[_0x69f2('0x3b')]['filter']){_0x50d02d['where']=_[_0x69f2('0x47')](_0x50d02d[_0x69f2('0x45')],{'$or':_[_0x69f2('0x48')](_0x105598,function(_0x37e1d1){if(_0x37e1d1['type']!==_0x69f2('0x49')){var _0x18fca5={};_0x18fca5[_0x37e1d1[_0x69f2('0x35')]]={'$like':'%'+_0x40f813['query'][_0x69f2('0x4a')]+'%'};return _0x18fca5;}})});}_0x50d02d=_['merge']({},_0x50d02d,_0x40f813['options']);var _0xb26ff8={'where':_0x50d02d[_0x69f2('0x45')]};return db[_0x69f2('0x37')][_0x69f2('0x2d')](_0xb26ff8)[_0x69f2('0x1a')](function(_0x5614f9){_0x4ba505[_0x69f2('0x2d')]=_0x5614f9;if(_0x40f813[_0x69f2('0x3b')]['includeAll']){_0x50d02d[_0x69f2('0x4b')]=[{'all':!![]}];}return db[_0x69f2('0x37')][_0x69f2('0x4c')](_0x50d02d);})['then'](function(_0x4f6659){_0x4ba505[_0x69f2('0x4d')]=_0x4f6659;return _0x4ba505;})['then'](respondWithFilteredResult(_0x162763,_0x50d02d))[_0x69f2('0x25')](handleError(_0x162763,null));};exports[_0x69f2('0x4e')]=function(_0x31787a,_0x36f72c){var _0x136f30={'raw':!![],'where':{'id':_0x31787a[_0x69f2('0x4f')]['id']}},_0x4a89d3={};_0x4a89d3[_0x69f2('0x3e')]=_['keys'](db[_0x69f2('0x37')][_0x69f2('0x50')]);_0x4a89d3['query']=_[_0x69f2('0x3c')](_0x31787a[_0x69f2('0x3b')]);_0x4a89d3[_0x69f2('0x3d')]=_['intersection'](_0x4a89d3[_0x69f2('0x3e')],_0x4a89d3[_0x69f2('0x3b')]);_0x136f30[_0x69f2('0x3f')]=_[_0x69f2('0x51')](_0x4a89d3[_0x69f2('0x3e')],qs[_0x69f2('0x40')](_0x31787a[_0x69f2('0x3b')][_0x69f2('0x40')]));_0x136f30[_0x69f2('0x3f')]=_0x136f30[_0x69f2('0x3f')][_0x69f2('0x41')]?_0x136f30[_0x69f2('0x3f')]:_0x4a89d3['model'];if(_0x31787a[_0x69f2('0x3b')][_0x69f2('0x52')]){_0x136f30['include']=[{'all':!![]}];}_0x136f30=_[_0x69f2('0x47')]({},_0x136f30,_0x31787a[_0x69f2('0x53')]);return db[_0x69f2('0x37')][_0x69f2('0x54')](_0x136f30)[_0x69f2('0x1a')](handleEntityNotFound(_0x36f72c,null))[_0x69f2('0x1a')](respondWithResult(_0x36f72c,null))['catch'](handleError(_0x36f72c,null));};exports[_0x69f2('0x33')]=function(_0x463b52,_0x4dcfd6){if(_0x463b52[_0x69f2('0x55')]['id']){delete _0x463b52[_0x69f2('0x55')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x463b52[_0x69f2('0x4f')]['id']}})[_0x69f2('0x1a')](handleEntityNotFound(_0x4dcfd6,null))[_0x69f2('0x1a')](saveUpdates(_0x463b52[_0x69f2('0x55')],null))[_0x69f2('0x1a')](respondWithResult(_0x4dcfd6,null))[_0x69f2('0x25')](handleError(_0x4dcfd6,null));};exports[_0x69f2('0x34')]=function(_0x44181c,_0x5bd59b){return db[_0x69f2('0x37')][_0x69f2('0x54')]({'where':{'id':_0x44181c[_0x69f2('0x4f')]['id']}})[_0x69f2('0x1a')](handleEntityNotFound(_0x5bd59b,null))['then'](removeEntity(_0x5bd59b,null))[_0x69f2('0x25')](handleError(_0x5bd59b,null));};exports['describe']=function(_0x4abed5,_0x45359b){return db[_0x69f2('0x37')]['describe']()[_0x69f2('0x1a')](respondWithResult(_0x45359b,null))[_0x69f2('0x25')](handleError(_0x45359b,null));};var interaction_log=require(_0x69f2('0xe'))(_0x69f2('0x56'));exports['accept']=function(_0x3bf64a,_0xc29540,_0x2d1632){var _0x1a0157={'agent':{},'channel':'fax'};if(_0x3bf64a[_0x69f2('0x55')]['id']){delete _0x3bf64a[_0x69f2('0x55')]['id'];}_0x3bf64a[_0x69f2('0x55')][_0x69f2('0x57')]=!![];_0x3bf64a[_0x69f2('0x55')]['readAt']=moment()[_0x69f2('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bf64a[_0x69f2('0x55')]['UserId']=_0x3bf64a['body'][_0x69f2('0x59')]||_0x3bf64a[_0x69f2('0x5a')]['id'];_0x1a0157[_0x69f2('0x5b')]['id']=_0x3bf64a[_0x69f2('0x55')][_0x69f2('0x59')];return db[_0x69f2('0x37')][_0x69f2('0x54')]({'where':{'id':_0x3bf64a[_0x69f2('0x4f')]['id'],'UserId':null}})[_0x69f2('0x1a')](handleEntityNotFound(_0xc29540,null))['then'](saveUpdates(_0x3bf64a[_0x69f2('0x55')],null))[_0x69f2('0x1a')](function(_0x2c8b4a){if(_0x2c8b4a){_0x1a0157['message']=_0x2c8b4a['get']({'plain':!![]});return db[_0x69f2('0x5c')]['find']({'where':{'id':_0x2c8b4a[_0x69f2('0x5d')]}});}return null;})[_0x69f2('0x1a')](handleEntityNotFound(_0xc29540,null))[_0x69f2('0x1a')](function(_0x177e50){if(_0x177e50){return _0x177e50[_0x69f2('0x33')]({'UserId':_0x3bf64a[_0x69f2('0x55')]['UserId'],'read1stAt':_['isNil'](_0x177e50['read1stAt'])?moment()[_0x69f2('0x58')](_0x69f2('0x5e')):undefined});}return null;})['then'](function(_0x23e69b){if(_0x23e69b){_0x1a0157[_0x69f2('0x5f')]=_0x23e69b[_0x69f2('0x60')]({'plain':!![]});interaction_log[_0x69f2('0x1b')](_0x69f2('0x61'),_0x3bf64a[_0x69f2('0x5a')]['id'],_0x3bf64a[_0x69f2('0x5a')][_0x69f2('0x35')],_0x3bf64a[_0x69f2('0x5a')]['role'],_0x1a0157[_0x69f2('0x5f')]['id'],_0x3bf64a['body']?JSON[_0x69f2('0x20')](_0x3bf64a[_0x69f2('0x55')]):_0x69f2('0x62'));return respondWithRpcPromise('AcceptMessage',_0x69f2('0x63'),_0x1a0157);}return null;})['then'](function(_0x547a59){var _0x33121c=_0x69f2('0x64')+_0x547a59[_0x69f2('0x23')][_0x69f2('0x65')];return db[_0x69f2('0x66')]['query'](_0x33121c,{'type':db[_0x69f2('0x67')]['QueryTypes']['SELECT'],'raw':!![]})[_0x69f2('0x1a')](function(_0x454149){return _0x454149;});})[_0x69f2('0x1a')](function(_0x14e6d8){if(_0x14e6d8){_0x1a0157[_0x69f2('0x23')]['contact']=_0x14e6d8[0x0];if(!_0x3bf64a[_0x69f2('0x55')][_0x69f2('0x59')])return;return db[_0x69f2('0x68')][_0x69f2('0x54')]({'where':{'id':_0x3bf64a['body'][_0x69f2('0x59')],'role':_0x69f2('0x5b')},'attributes':['id',_0x69f2('0x35'),_0x69f2('0x69'),_0x69f2('0x6a'),_0x69f2('0x6b')],'raw':!![]});}return null;})[_0x69f2('0x1a')](function(_0xdd671){if(!_0xdd671)return null;_0x1a0157[_0x69f2('0x23')]['agent']=_0xdd671;return _0x1a0157;})[_0x69f2('0x1a')](function(_0xf5be6b){if(_0xf5be6b){if(_0x3bf64a['body'][_0x69f2('0x6c')]){_0x1a0157['message'][_0x69f2('0x6d')]=util[_0x69f2('0x58')](_0x69f2('0x6e'),_0x3bf64a[_0x69f2('0x5a')][_0x69f2('0x35')]);_0x1a0157[_0x69f2('0x23')][_0x69f2('0x6f')]=_0x1a0157[_0x69f2('0x6f')];_0x1a0157[_0x69f2('0x23')][_0x69f2('0x70')]=_0x1a0157[_0x69f2('0x6f')];_0x1a0157[_0x69f2('0x23')]['event']=_0x69f2('0x71');return respondWithRpcPromise('EventManager',_0x69f2('0x72'),{'event':'acceptmessage','message':_0x1a0157[_0x69f2('0x23')]},client9002)[_0x69f2('0x1a')](function(){return _0x1a0157;});}return _0x1a0157;}return null;})[_0x69f2('0x1a')](respondWithResult(_0xc29540,null))[_0x69f2('0x25')](handleError(_0xc29540,null));};var interaction_log=require('../../config/logger')(_0x69f2('0x56'));exports[_0x69f2('0x31')]=function(_0x2ab110,_0x3b5c33,_0x53b45b){var _0x2f7d80={'agent':{},'channel':'fax'};if(_0x2ab110[_0x69f2('0x55')]['id']){delete _0x2ab110['body']['id'];}_0x2ab110['body'][_0x69f2('0x59')]=_0x2ab110[_0x69f2('0x55')][_0x69f2('0x59')]||_0x2ab110[_0x69f2('0x5a')]['id'];_0x2f7d80[_0x69f2('0x5b')]['id']=_0x2ab110[_0x69f2('0x55')][_0x69f2('0x59')];return db[_0x69f2('0x37')][_0x69f2('0x54')]({'where':{'id':_0x2ab110[_0x69f2('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3b5c33,null))[_0x69f2('0x1a')](function(_0xf31cb9){if(_0xf31cb9){_0x2f7d80[_0x69f2('0x23')]=_0xf31cb9[_0x69f2('0x60')]({'plain':!![]});return db[_0x69f2('0x5c')][_0x69f2('0x54')]({'where':{'id':_0xf31cb9[_0x69f2('0x5d')]}});}return null;})[_0x69f2('0x1a')](handleEntityNotFound(_0x3b5c33,null))[_0x69f2('0x1a')](function(_0x3a5ae8){if(_0x3a5ae8){_0x2f7d80[_0x69f2('0x5f')]=_0x3a5ae8[_0x69f2('0x60')]({'plain':!![]});interaction_log['info'](_0x69f2('0x73'),_0x2ab110[_0x69f2('0x5a')]['id'],_0x2ab110[_0x69f2('0x5a')][_0x69f2('0x35')],_0x2ab110[_0x69f2('0x5a')][_0x69f2('0x74')],_0x2f7d80[_0x69f2('0x5f')]['id'],_0x2ab110[_0x69f2('0x55')]?JSON['stringify'](_0x2ab110[_0x69f2('0x55')]):'null');return respondWithRpcPromise('RejectMessage',_0x69f2('0x75'),_0x2f7d80);}return null;})[_0x69f2('0x1a')](function(_0x37e930){var _0x1140f2=_0x69f2('0x64')+_0x37e930[_0x69f2('0x23')][_0x69f2('0x65')];return db[_0x69f2('0x66')][_0x69f2('0x3b')](_0x1140f2,{'type':db[_0x69f2('0x67')][_0x69f2('0x76')]['SELECT'],'raw':!![]})[_0x69f2('0x1a')](function(_0x5a13f1){return _0x5a13f1;});})['then'](function(_0x6cbcf2){if(_0x6cbcf2){_0x2f7d80[_0x69f2('0x23')][_0x69f2('0x77')]=_0x6cbcf2[0x0];if(!_0x2ab110[_0x69f2('0x55')][_0x69f2('0x59')])return;return db[_0x69f2('0x68')][_0x69f2('0x54')]({'where':{'id':_0x2ab110[_0x69f2('0x55')][_0x69f2('0x59')],'role':'agent'},'attributes':['id',_0x69f2('0x35'),_0x69f2('0x69'),_0x69f2('0x6a'),_0x69f2('0x6b')],'raw':!![]});}return null;})[_0x69f2('0x1a')](function(_0x2c1b02){if(!_0x2c1b02)return null;_0x2f7d80[_0x69f2('0x23')][_0x69f2('0x5b')]=_0x2c1b02;return _0x2f7d80;})[_0x69f2('0x1a')](function(_0xfad7ea){if(_0xfad7ea){_0xfad7ea[_0x69f2('0x23')][_0x69f2('0x6d')]=util[_0x69f2('0x58')](_0x69f2('0x6e'),_0x2ab110['user'][_0x69f2('0x35')]);_0xfad7ea[_0x69f2('0x23')][_0x69f2('0x6f')]=_0x2f7d80[_0x69f2('0x6f')];_0xfad7ea[_0x69f2('0x23')][_0x69f2('0x70')]=_0x2f7d80[_0x69f2('0x6f')];_0xfad7ea[_0x69f2('0x23')][_0x69f2('0x78')]='reject';respondWithRpcPromise('EventManager',_0x69f2('0x72'),{'event':_0x69f2('0x79'),'message':_0xfad7ea['message']},client9002);return _0x2f7d80;}return null;})[_0x69f2('0x1a')](respondWithResult(_0x3b5c33,null))[_0x69f2('0x25')](handleError(_0x3b5c33,null));};exports[_0x69f2('0x7a')]=function(_0x273397,_0x3baae1){var _0x44e477;return db[_0x69f2('0x37')][_0x69f2('0x7a')](_0x273397[_0x69f2('0x55')],{})[_0x69f2('0x1a')](function(_0x487eda){_0x44e477=_0x487eda;return db[_0x69f2('0x7b')][_0x69f2('0x7c')]({'where':{'id':_0x44e477[_0x69f2('0x65')]}});})[_0x69f2('0x1a')](function(_0x309241){if(_['isNil'](_0x309241)){return;}else{_0x44e477[_0x69f2('0x7d')]=_0x309241[_0x69f2('0x7d')];return db[_0x69f2('0x7e')][_0x69f2('0x7c')]({'where':{'id':_0x44e477[_0x69f2('0x7f')]}});}})['then'](function(_0x18d5ec){return respondWithRpcPromise('SendFax',_0x69f2('0x80'),{'FaxAccountId':_['isNil'](_0x273397[_0x69f2('0x55')])?undefined:_0x273397[_0x69f2('0x55')]['FaxAccountId'],'path':_[_0x69f2('0x81')](_0x18d5ec)?undefined:util[_0x69f2('0x58')](_0x69f2('0x82'),_0x18d5ec[_0x69f2('0x83')]),'fax':_['isNil'](_0x44e477['fax'])?undefined:_0x44e477['fax'],'AttachmentId':_0x44e477['AttachmentId']},client9002);})[_0x69f2('0x1a')](respondWithResult(_0x3baae1,0xc9))['catch'](handleError(_0x3baae1,null));};exports[_0x69f2('0x84')]=function(_0x40368a,_0x535471){var _0xc37f50=path['join'](config[_0x69f2('0x85')],'server',_0x69f2('0x86'),_0x69f2('0x87'));return db[_0x69f2('0x37')]['find']({'where':{'id':_0x40368a['params']['id']},'include':[{'model':db[_0x69f2('0x7e')],'as':'Attachment'}]})[_0x69f2('0x1a')](handleEntityNotFound(_0x535471,null))[_0x69f2('0x1a')](function(_0xe3d6bf){if(_0xe3d6bf){return _0x535471[_0x69f2('0x84')](path[_0x69f2('0x88')](_0xc37f50,_0xe3d6bf['Attachment']['basename']));}})[_0x69f2('0x25')](handleError(_0x535471,null));}; \ No newline at end of file +var _0xd090=['destroy','end','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','body','describe','../../config/logger','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','manual','channel','motionChannel','event','accept','EventManager','fax','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','SIP/%s','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','files','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then'];(function(_0x8ff7a6,_0x5929d2){var _0x437bae=function(_0x5127c6){while(--_0x5127c6){_0x8ff7a6['push'](_0x8ff7a6['shift']());}};_0x437bae(++_0x5929d2);}(_0xd090,0xeb));var _0x0d09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd090[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0d09('0x0'));var rimraf=require(_0x0d09('0x1'));var zipdir=require(_0x0d09('0x2'));var jsonpatch=require(_0x0d09('0x3'));var rp=require(_0x0d09('0x4'));var moment=require(_0x0d09('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d09('0x6'));var path=require(_0x0d09('0x7'));var sox=require('sox');var csv=require(_0x0d09('0x8'));var ejs=require(_0x0d09('0x9'));var fs=require('fs');var fs_extra=require(_0x0d09('0xa'));var _=require(_0x0d09('0xb'));var squel=require(_0x0d09('0xc'));var crypto=require(_0x0d09('0xd'));var jsforce=require(_0x0d09('0xe'));var deskjs=require(_0x0d09('0xf'));var toCsv=require(_0x0d09('0x8'));var querystring=require('querystring');var Papa=require(_0x0d09('0x10'));var Redis=require('ioredis');var authService=require(_0x0d09('0x11'));var qs=require(_0x0d09('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d09('0x13'));var logger=require('../../config/logger')(_0x0d09('0x14'));var utils=require(_0x0d09('0x15'));var config=require(_0x0d09('0x16'));var licenseUtil=require(_0x0d09('0x17'));var db=require(_0x0d09('0x18'))['db'];config[_0x0d09('0x19')]=_[_0x0d09('0x1a')](config[_0x0d09('0x19')],{'host':_0x0d09('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')[_0x0d09('0x1c')](socket);var jayson=require(_0x0d09('0x1d'));var client=jayson[_0x0d09('0x1e')][_0x0d09('0x1f')]({'port':0x232c});var client9002=jayson[_0x0d09('0x1e')][_0x0d09('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x54c9b2,_0x156ca5,_0x5b451e,_0x2b9b9b){return new BPromise(function(_0xe3eadf,_0x3f16c0){var _0x5ed71a=_0x2b9b9b||client;return _0x5ed71a[_0x0d09('0x20')](_0x54c9b2,_0x5b451e)['then'](function(_0x21ab6c){logger[_0x0d09('0x21')](_0x0d09('0x22'),_0x156ca5,_0x0d09('0x23'));logger[_0x0d09('0x24')](_0x0d09('0x25'),_0x156ca5,_0x0d09('0x23'),JSON[_0x0d09('0x26')](_0x21ab6c));if(_0x21ab6c[_0x0d09('0x27')]){if(_0x21ab6c[_0x0d09('0x27')][_0x0d09('0x28')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x156ca5,_0x21ab6c[_0x0d09('0x27')]['message']);return _0x3f16c0(_0x21ab6c[_0x0d09('0x27')][_0x0d09('0x29')]);}logger[_0x0d09('0x27')](_0x0d09('0x22'),_0x156ca5,_0x21ab6c[_0x0d09('0x27')]['message']);return _0xe3eadf(_0x21ab6c['error'][_0x0d09('0x29')]);}else{logger[_0x0d09('0x21')]('FaxMessage,\x20%s,\x20%s',_0x156ca5,_0x0d09('0x23'));_0xe3eadf(_0x21ab6c[_0x0d09('0x2a')][_0x0d09('0x29')]);}})['catch'](function(_0xb471ef){logger[_0x0d09('0x27')](_0x0d09('0x22'),_0x156ca5,_0xb471ef);_0x3f16c0(_0xb471ef);});});}function respondWithStatusCode(_0x1ffc2d,_0x3ad395){_0x3ad395=_0x3ad395||0xcc;return function(_0x2a842e){if(_0x2a842e){return _0x1ffc2d[_0x0d09('0x2b')](_0x3ad395);}return _0x1ffc2d['status'](_0x3ad395)['end']();};}function respondWithResult(_0x4456fc,_0x566a55){_0x566a55=_0x566a55||0xc8;return function(_0x3a1d12){if(_0x3a1d12){return _0x4456fc[_0x0d09('0x2c')](_0x566a55)['json'](_0x3a1d12);}};}function respondWithFilteredResult(_0xda4c58,_0x55f85c){return function(_0x8cdd63){if(_0x8cdd63){var _0x52216b=typeof _0x55f85c[_0x0d09('0x2d')]===_0x0d09('0x2e')&&typeof _0x55f85c[_0x0d09('0x2f')]===_0x0d09('0x2e');var _0x387e5a=_0x8cdd63[_0x0d09('0x30')];var _0xfe993c=_0x52216b?0x0:_0x55f85c[_0x0d09('0x2d')];var _0x5be12e=_0x52216b?_0x8cdd63[_0x0d09('0x30')]:_0x55f85c['offset']+_0x55f85c[_0x0d09('0x2f')];var _0x1f7829;if(_0x5be12e>=_0x387e5a){_0x5be12e=_0x387e5a;_0x1f7829=0xc8;}else{_0x1f7829=0xce;}_0xda4c58[_0x0d09('0x2c')](_0x1f7829);return _0xda4c58['set'](_0x0d09('0x31'),_0xfe993c+'-'+_0x5be12e+'/'+_0x387e5a)[_0x0d09('0x32')](_0x8cdd63);}return null;};}function patchUpdates(_0x1ef665){return function(_0x57d112){try{jsonpatch['apply'](_0x57d112,_0x1ef665,!![]);}catch(_0x48d242){return BPromise[_0x0d09('0x33')](_0x48d242);}return _0x57d112[_0x0d09('0x34')]();};}function saveUpdates(_0x5ba9f7,_0x258f56){return function(_0x470bf4){if(_0x470bf4){return _0x470bf4[_0x0d09('0x35')](_0x5ba9f7)[_0x0d09('0x36')](function(_0x5090a6){return _0x5090a6;});}return null;};}function removeEntity(_0x303414,_0x218062){return function(_0x22d4c8){if(_0x22d4c8){return _0x22d4c8[_0x0d09('0x37')]()['then'](function(){_0x303414[_0x0d09('0x2c')](0xcc)[_0x0d09('0x38')]();});}};}function handleEntityNotFound(_0x8a67cd,_0x370bb6){return function(_0x234fbe){if(!_0x234fbe){_0x8a67cd[_0x0d09('0x2b')](0x194);}return _0x234fbe;};}function handleError(_0x10742a,_0x2b67f6){_0x2b67f6=_0x2b67f6||0x1f4;return function(_0x3250ad){logger['error'](_0x3250ad[_0x0d09('0x39')]);if(_0x3250ad[_0x0d09('0x3a')]){delete _0x3250ad[_0x0d09('0x3a')];}_0x10742a['status'](_0x2b67f6)[_0x0d09('0x3b')](_0x3250ad);};}exports[_0x0d09('0x3c')]=function(_0x54219d,_0x5c9330){var _0x413459={},_0x5f46fa={},_0x3276cc={'count':0x0,'rows':[]};var _0x598b01=_[_0x0d09('0x3d')](db[_0x0d09('0x3e')][_0x0d09('0x3f')],function(_0xd2c84f){return{'name':_0xd2c84f['fieldName'],'type':_0xd2c84f[_0x0d09('0x40')][_0x0d09('0x41')]};});_0x5f46fa[_0x0d09('0x42')]=_[_0x0d09('0x3d')](_0x598b01,_0x0d09('0x3a'));_0x5f46fa[_0x0d09('0x43')]=_[_0x0d09('0x44')](_0x54219d[_0x0d09('0x43')]);_0x5f46fa['filters']=_['intersection'](_0x5f46fa['model'],_0x5f46fa[_0x0d09('0x43')]);_0x413459[_0x0d09('0x45')]=_['intersection'](_0x5f46fa['model'],qs[_0x0d09('0x46')](_0x54219d[_0x0d09('0x43')]['fields']));_0x413459['attributes']=_0x413459[_0x0d09('0x45')][_0x0d09('0x47')]?_0x413459['attributes']:_0x5f46fa[_0x0d09('0x42')];if(!_0x54219d[_0x0d09('0x43')]['hasOwnProperty'](_0x0d09('0x48'))){_0x413459[_0x0d09('0x2f')]=qs[_0x0d09('0x2f')](_0x54219d[_0x0d09('0x43')]['limit']);_0x413459['offset']=qs[_0x0d09('0x2d')](_0x54219d[_0x0d09('0x43')][_0x0d09('0x2d')]);}_0x413459[_0x0d09('0x49')]=qs['sort'](_0x54219d[_0x0d09('0x43')][_0x0d09('0x4a')]);_0x413459[_0x0d09('0x4b')]=qs['filters'](_[_0x0d09('0x4c')](_0x54219d[_0x0d09('0x43')],_0x5f46fa[_0x0d09('0x4d')]),_0x598b01);if(_0x54219d[_0x0d09('0x43')]['filter']){_0x413459[_0x0d09('0x4b')]=_[_0x0d09('0x4e')](_0x413459[_0x0d09('0x4b')],{'$or':_[_0x0d09('0x3d')](_0x598b01,function(_0x569ee0){if(_0x569ee0[_0x0d09('0x40')]!==_0x0d09('0x4f')){var _0x257906={};_0x257906[_0x569ee0[_0x0d09('0x3a')]]={'$like':'%'+_0x54219d[_0x0d09('0x43')][_0x0d09('0x50')]+'%'};return _0x257906;}})});}_0x413459=_[_0x0d09('0x4e')]({},_0x413459,_0x54219d['options']);var _0x2d2a89={'where':_0x413459[_0x0d09('0x4b')]};return db[_0x0d09('0x3e')][_0x0d09('0x30')](_0x2d2a89)[_0x0d09('0x36')](function(_0x3e86ee){_0x3276cc[_0x0d09('0x30')]=_0x3e86ee;if(_0x54219d[_0x0d09('0x43')]['includeAll']){_0x413459[_0x0d09('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0x0d09('0x52')](_0x413459);})[_0x0d09('0x36')](function(_0x311a6d){_0x3276cc[_0x0d09('0x53')]=_0x311a6d;return _0x3276cc;})[_0x0d09('0x36')](respondWithFilteredResult(_0x5c9330,_0x413459))[_0x0d09('0x54')](handleError(_0x5c9330,null));};exports[_0x0d09('0x55')]=function(_0x1fab63,_0x335386){var _0x13a3f3={'raw':!![],'where':{'id':_0x1fab63[_0x0d09('0x56')]['id']}},_0x6a2e7e={};_0x6a2e7e[_0x0d09('0x42')]=_['keys'](db[_0x0d09('0x3e')][_0x0d09('0x3f')]);_0x6a2e7e[_0x0d09('0x43')]=_[_0x0d09('0x44')](_0x1fab63['query']);_0x6a2e7e[_0x0d09('0x4d')]=_[_0x0d09('0x57')](_0x6a2e7e[_0x0d09('0x42')],_0x6a2e7e['query']);_0x13a3f3['attributes']=_[_0x0d09('0x57')](_0x6a2e7e[_0x0d09('0x42')],qs[_0x0d09('0x46')](_0x1fab63[_0x0d09('0x43')][_0x0d09('0x46')]));_0x13a3f3[_0x0d09('0x45')]=_0x13a3f3['attributes'][_0x0d09('0x47')]?_0x13a3f3[_0x0d09('0x45')]:_0x6a2e7e[_0x0d09('0x42')];if(_0x1fab63[_0x0d09('0x43')][_0x0d09('0x58')]){_0x13a3f3[_0x0d09('0x51')]=[{'all':!![]}];}_0x13a3f3=_[_0x0d09('0x4e')]({},_0x13a3f3,_0x1fab63[_0x0d09('0x59')]);return db['FaxMessage'][_0x0d09('0x5a')](_0x13a3f3)[_0x0d09('0x36')](handleEntityNotFound(_0x335386,null))['then'](respondWithResult(_0x335386,null))[_0x0d09('0x54')](handleError(_0x335386,null));};exports[_0x0d09('0x35')]=function(_0x411116,_0x3b194d){if(_0x411116['body']['id']){delete _0x411116[_0x0d09('0x5b')]['id'];}return db['FaxMessage'][_0x0d09('0x5a')]({'where':{'id':_0x411116[_0x0d09('0x56')]['id']}})[_0x0d09('0x36')](handleEntityNotFound(_0x3b194d,null))[_0x0d09('0x36')](saveUpdates(_0x411116['body'],null))[_0x0d09('0x36')](respondWithResult(_0x3b194d,null))[_0x0d09('0x54')](handleError(_0x3b194d,null));};exports[_0x0d09('0x37')]=function(_0x515a61,_0x57066a){return db[_0x0d09('0x3e')][_0x0d09('0x5a')]({'where':{'id':_0x515a61[_0x0d09('0x56')]['id']}})['then'](handleEntityNotFound(_0x57066a,null))[_0x0d09('0x36')](removeEntity(_0x57066a,null))['catch'](handleError(_0x57066a,null));};exports[_0x0d09('0x5c')]=function(_0xc75246,_0x16bbc4){return db[_0x0d09('0x3e')]['describe']()[_0x0d09('0x36')](respondWithResult(_0x16bbc4,null))['catch'](handleError(_0x16bbc4,null));};var interaction_log=require(_0x0d09('0x5d'))('fax-interactions');exports['accept']=function(_0x5252f4,_0x2b3e1b,_0x26f752){var _0x49d9df={'agent':{},'channel':'fax'};if(_0x5252f4['body']['id']){delete _0x5252f4[_0x0d09('0x5b')]['id'];}_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x5e')]=!![];_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x5f')]=moment()[_0x0d09('0x60')](_0x0d09('0x61'));_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x62')]=_0x5252f4[_0x0d09('0x5b')]['UserId']||_0x5252f4['user']['id'];_0x49d9df['agent']['id']=_0x5252f4[_0x0d09('0x5b')]['UserId'];return db['FaxMessage'][_0x0d09('0x5a')]({'where':{'id':_0x5252f4[_0x0d09('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b3e1b,null))[_0x0d09('0x36')](saveUpdates(_0x5252f4[_0x0d09('0x5b')],null))[_0x0d09('0x36')](function(_0x5aa3ab){if(_0x5aa3ab){_0x49d9df[_0x0d09('0x29')]=_0x5aa3ab[_0x0d09('0x63')]({'plain':!![]});return db[_0x0d09('0x64')][_0x0d09('0x5a')]({'where':{'id':_0x5aa3ab['FaxInteractionId']}});}return null;})[_0x0d09('0x36')](handleEntityNotFound(_0x2b3e1b,null))[_0x0d09('0x36')](function(_0x446571){if(_0x446571){return _0x446571[_0x0d09('0x35')]({'UserId':_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x62')],'read1stAt':_[_0x0d09('0x65')](_0x446571[_0x0d09('0x66')])?moment()['format'](_0x0d09('0x61')):undefined});}return null;})[_0x0d09('0x36')](function(_0x2c0480){if(_0x2c0480){_0x49d9df[_0x0d09('0x67')]=_0x2c0480[_0x0d09('0x63')]({'plain':!![]});interaction_log['info'](_0x0d09('0x68'),_0x5252f4[_0x0d09('0x69')]['id'],_0x5252f4['user'][_0x0d09('0x3a')],_0x5252f4['user'][_0x0d09('0x6a')],_0x49d9df[_0x0d09('0x67')]['id'],_0x5252f4[_0x0d09('0x5b')]?JSON['stringify'](_0x5252f4[_0x0d09('0x5b')]):_0x0d09('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x49d9df);}return null;})[_0x0d09('0x36')](function(_0x33339f){var _0x53f292=_0x0d09('0x6c')+_0x33339f[_0x0d09('0x29')][_0x0d09('0x6d')];return db[_0x0d09('0x6e')]['query'](_0x53f292,{'type':db[_0x0d09('0x6f')][_0x0d09('0x70')][_0x0d09('0x71')],'raw':!![]})[_0x0d09('0x36')](function(_0x526701){return _0x526701;});})['then'](function(_0x1b0769){if(_0x1b0769){_0x49d9df[_0x0d09('0x29')][_0x0d09('0x72')]=_0x1b0769[0x0];if(!_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x62')])return;return db[_0x0d09('0x73')][_0x0d09('0x5a')]({'where':{'id':_0x5252f4['body'][_0x0d09('0x62')],'role':'agent'},'attributes':['id','name',_0x0d09('0x74'),_0x0d09('0x75'),_0x0d09('0x76')],'raw':!![]});}return null;})['then'](function(_0x1dcab){if(!_0x1dcab)return null;_0x49d9df[_0x0d09('0x29')][_0x0d09('0x77')]=_0x1dcab;return _0x49d9df;})[_0x0d09('0x36')](function(_0x452466){if(_0x452466){if(_0x5252f4[_0x0d09('0x5b')][_0x0d09('0x78')]){_0x49d9df[_0x0d09('0x29')]['interface']=util[_0x0d09('0x60')]('SIP/%s',_0x5252f4[_0x0d09('0x69')][_0x0d09('0x3a')]);_0x49d9df[_0x0d09('0x29')][_0x0d09('0x79')]=_0x49d9df[_0x0d09('0x79')];_0x49d9df[_0x0d09('0x29')][_0x0d09('0x7a')]=_0x49d9df[_0x0d09('0x79')];_0x49d9df[_0x0d09('0x29')][_0x0d09('0x7b')]=_0x0d09('0x7c');return respondWithRpcPromise(_0x0d09('0x7d'),_0x0d09('0x7d'),{'event':'acceptmessage','message':_0x49d9df[_0x0d09('0x29')]},client9002)['then'](function(){return _0x49d9df;});}return _0x49d9df;}return null;})[_0x0d09('0x36')](respondWithResult(_0x2b3e1b,null))['catch'](handleError(_0x2b3e1b,null));};var interaction_log=require(_0x0d09('0x5d'))('fax-interactions');exports[_0x0d09('0x33')]=function(_0xb8fefb,_0x18d724,_0x5bb3ab){var _0x2dc191={'agent':{},'channel':_0x0d09('0x7e')};if(_0xb8fefb['body']['id']){delete _0xb8fefb[_0x0d09('0x5b')]['id'];}_0xb8fefb[_0x0d09('0x5b')][_0x0d09('0x62')]=_0xb8fefb[_0x0d09('0x5b')][_0x0d09('0x62')]||_0xb8fefb['user']['id'];_0x2dc191[_0x0d09('0x77')]['id']=_0xb8fefb['body'][_0x0d09('0x62')];return db['FaxMessage'][_0x0d09('0x5a')]({'where':{'id':_0xb8fefb[_0x0d09('0x56')]['id'],'UserId':null}})[_0x0d09('0x36')](handleEntityNotFound(_0x18d724,null))[_0x0d09('0x36')](function(_0x181861){if(_0x181861){_0x2dc191[_0x0d09('0x29')]=_0x181861[_0x0d09('0x63')]({'plain':!![]});return db['FaxInteraction'][_0x0d09('0x5a')]({'where':{'id':_0x181861[_0x0d09('0x7f')]}});}return null;})[_0x0d09('0x36')](handleEntityNotFound(_0x18d724,null))[_0x0d09('0x36')](function(_0x13faf5){if(_0x13faf5){_0x2dc191[_0x0d09('0x67')]=_0x13faf5[_0x0d09('0x63')]({'plain':!![]});interaction_log[_0x0d09('0x21')](_0x0d09('0x80'),_0xb8fefb['user']['id'],_0xb8fefb[_0x0d09('0x69')][_0x0d09('0x3a')],_0xb8fefb[_0x0d09('0x69')]['role'],_0x2dc191[_0x0d09('0x67')]['id'],_0xb8fefb[_0x0d09('0x5b')]?JSON[_0x0d09('0x26')](_0xb8fefb[_0x0d09('0x5b')]):'null');return respondWithRpcPromise('RejectMessage',_0x0d09('0x81'),_0x2dc191);}return null;})[_0x0d09('0x36')](function(_0x485ba6){var _0x53f177='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x485ba6[_0x0d09('0x29')]['ContactId'];return db[_0x0d09('0x6e')][_0x0d09('0x43')](_0x53f177,{'type':db['Sequelize'][_0x0d09('0x70')][_0x0d09('0x71')],'raw':!![]})[_0x0d09('0x36')](function(_0x5557cc){return _0x5557cc;});})[_0x0d09('0x36')](function(_0x283c){if(_0x283c){_0x2dc191[_0x0d09('0x29')][_0x0d09('0x72')]=_0x283c[0x0];if(!_0xb8fefb[_0x0d09('0x5b')][_0x0d09('0x62')])return;return db[_0x0d09('0x73')][_0x0d09('0x5a')]({'where':{'id':_0xb8fefb['body'][_0x0d09('0x62')],'role':_0x0d09('0x77')},'attributes':['id','name','fullname','email',_0x0d09('0x76')],'raw':!![]});}return null;})[_0x0d09('0x36')](function(_0x1f538c){if(!_0x1f538c)return null;_0x2dc191[_0x0d09('0x29')][_0x0d09('0x77')]=_0x1f538c;return _0x2dc191;})[_0x0d09('0x36')](function(_0x1afc49){if(_0x1afc49){_0x1afc49[_0x0d09('0x29')][_0x0d09('0x82')]=util[_0x0d09('0x60')](_0x0d09('0x83'),_0xb8fefb['user'][_0x0d09('0x3a')]);_0x1afc49['message'][_0x0d09('0x79')]=_0x2dc191[_0x0d09('0x79')];_0x1afc49[_0x0d09('0x29')][_0x0d09('0x7a')]=_0x2dc191[_0x0d09('0x79')];_0x1afc49[_0x0d09('0x29')]['event']=_0x0d09('0x33');respondWithRpcPromise('EventManager',_0x0d09('0x7d'),{'event':'rejectmessage','message':_0x1afc49[_0x0d09('0x29')]},client9002);return _0x2dc191;}return null;})[_0x0d09('0x36')](respondWithResult(_0x18d724,null))[_0x0d09('0x54')](handleError(_0x18d724,null));};exports[_0x0d09('0x84')]=function(_0x3cc9e2,_0x338215){var _0x1c91bf;return db[_0x0d09('0x3e')][_0x0d09('0x84')](_0x3cc9e2['body'],{})[_0x0d09('0x36')](function(_0x64702a){_0x1c91bf=_0x64702a;return db[_0x0d09('0x85')][_0x0d09('0x86')]({'where':{'id':_0x1c91bf['ContactId']}});})[_0x0d09('0x36')](function(_0x4a191f){if(_[_0x0d09('0x65')](_0x4a191f)){return;}else{_0x1c91bf[_0x0d09('0x7e')]=_0x4a191f[_0x0d09('0x7e')];return db['Attachment'][_0x0d09('0x86')]({'where':{'id':_0x1c91bf[_0x0d09('0x87')]}});}})[_0x0d09('0x36')](function(_0x418c26){return respondWithRpcPromise(_0x0d09('0x88'),_0x0d09('0x88'),{'FaxAccountId':_['isNil'](_0x3cc9e2[_0x0d09('0x5b')])?undefined:_0x3cc9e2[_0x0d09('0x5b')][_0x0d09('0x89')],'path':_['isNil'](_0x418c26)?undefined:util[_0x0d09('0x60')]('/var/opt/motion2/server/files/attachments/%s',_0x418c26[_0x0d09('0x8a')]),'fax':_['isNil'](_0x1c91bf[_0x0d09('0x7e')])?undefined:_0x1c91bf['fax'],'AttachmentId':_0x1c91bf[_0x0d09('0x87')]},client9002);})[_0x0d09('0x36')](respondWithResult(_0x338215,0xc9))[_0x0d09('0x54')](handleError(_0x338215,null));};exports[_0x0d09('0x8b')]=function(_0xc304f2,_0x520de6){var _0x1f8ef5=path[_0x0d09('0x8c')](config[_0x0d09('0x8d')],_0x0d09('0x8e'),_0x0d09('0x8f'),'attachments');return db[_0x0d09('0x3e')][_0x0d09('0x5a')]({'where':{'id':_0xc304f2['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x520de6,null))['then'](function(_0x36b5f1){if(_0x36b5f1){return _0x520de6[_0x0d09('0x8b')](path['join'](_0x1f8ef5,_0x36b5f1[_0x0d09('0x90')]['basename']));}})[_0x0d09('0x54')](handleError(_0x520de6,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 6420d93..cce926e 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 _0xf954=['events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x259b7c,_0x42af89){var _0x7486c4=function(_0x51efc6){while(--_0x51efc6){_0x259b7c['push'](_0x259b7c['shift']());}};_0x7486c4(++_0x42af89);}(_0xf954,0x10e));var _0x4f95=function(_0x246cbe,_0x19305c){_0x246cbe=_0x246cbe-0x0;var _0x855b0=_0xf954[_0x246cbe];return _0x855b0;};'use strict';var EventEmitter=require(_0x4f95('0x0'));var FaxMessage=require(_0x4f95('0x1'))['db'][_0x4f95('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4f95('0x3')](0x0);var events={'afterCreate':_0x4f95('0x4'),'afterUpdate':_0x4f95('0x5'),'afterDestroy':_0x4f95('0x6')};function emitEvent(_0x56b04c){return function(_0x5476e1,_0x3e7ef4,_0x124804){FaxMessageEvents[_0x4f95('0x7')](_0x56b04c+':'+_0x5476e1['id'],_0x5476e1);FaxMessageEvents[_0x4f95('0x7')](_0x56b04c,_0x5476e1);_0x124804(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x4f95('0x8')](e,emitEvent(event));}}module[_0x4f95('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xb296=['FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3f2ed0,_0x55e1d7){var _0x4a035d=function(_0x574e11){while(--_0x574e11){_0x3f2ed0['push'](_0x3f2ed0['shift']());}};_0x4a035d(++_0x55e1d7);}(_0xb296,0xa3));var _0x6b29=function(_0x111264,_0x38cd3d){_0x111264=_0x111264-0x0;var _0xa767b3=_0xb296[_0x111264];return _0xa767b3;};'use strict';var EventEmitter=require(_0x6b29('0x0'));var FaxMessage=require(_0x6b29('0x1'))['db'][_0x6b29('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6b29('0x3')](0x0);var events={'afterCreate':_0x6b29('0x4'),'afterUpdate':_0x6b29('0x5'),'afterDestroy':_0x6b29('0x6')};function emitEvent(_0x48e967){return function(_0x3ff65c,_0x5c1cf5,_0x50a1ba){FaxMessageEvents[_0x6b29('0x7')](_0x48e967+':'+_0x3ff65c['id'],_0x3ff65c);FaxMessageEvents['emit'](_0x48e967,_0x3ff65c);_0x50a1ba(null);};}for(var e in events){if(events[_0x6b29('0x8')](e)){var event=events[e];FaxMessage[_0x6b29('0x9')](e,emitEvent(event));}}module[_0x6b29('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 884b5a0..9f0620d 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 _0xbcac=['utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','utf8mb4'];(function(_0x54d03d,_0x56e299){var _0x318209=function(_0x12800c){while(--_0x12800c){_0x54d03d['push'](_0x54d03d['shift']());}};_0x318209(++_0x56e299);}(_0xbcac,0x8d));var _0xcbca=function(_0x49ecfc,_0x27023e){_0x49ecfc=_0x49ecfc-0x0;var _0x4ae1a4=_0xbcac[_0x49ecfc];return _0x4ae1a4;};'use strict';var _=require(_0xcbca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcbca('0x1'));var moment=require(_0xcbca('0x2'));var BPromise=require(_0xcbca('0x3'));var rp=require(_0xcbca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcbca('0x5'));var attributes=require(_0xcbca('0x6'));module[_0xcbca('0x7')]=function(_0x1bbf19,_0x3a3768){return _0x1bbf19[_0xcbca('0x8')]('FaxMessage',attributes,{'tableName':_0xcbca('0x9'),'paranoid':![],'indexes':[{'name':_0xcbca('0xa'),'fields':[_0xcbca('0xb')],'type':_0xcbca('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48e87d,_0x1a7c7e,_0x36ba99){var _0x15eac6=_0x1bbf19[_0xcbca('0xd')];var _0x5a2044=_0x48e87d[_0xcbca('0xe')]({'plain':!![]});if(_0x5a2044[_0xcbca('0xf')]['toLowerCase']()==='in'||_0x5a2044[_0xcbca('0xf')][_0xcbca('0x10')]()==='out'&&!_0x5a2044[_0xcbca('0x11')]&&!_[_0xcbca('0x12')](_0x5a2044[_0xcbca('0x13')])){_0x15eac6['FaxInteraction'][_0xcbca('0x14')]({'where':{'id':_0x5a2044['FaxInteractionId']}})[_0xcbca('0x15')](function(_0xa490b2){if(_0xa490b2){_0xa490b2[_0xcbca('0x16')]({'lastMsgAt':_0x5a2044[_0xcbca('0x17')],'lastMsgDirection':_0x5a2044[_0xcbca('0xf')]['toLowerCase']()});}})[_0xcbca('0x18')](function(_0x50b639){console[_0xcbca('0x19')](_0x50b639);});}_0x36ba99();}},'charset':_0xcbca('0x1a'),'collate':_0xcbca('0x1b')});}; \ No newline at end of file +var _0x6c1a=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','update','createdAt','catch','error'];(function(_0xd7a1c0,_0x18fb30){var _0x2612ac=function(_0x206bc0){while(--_0x206bc0){_0xd7a1c0['push'](_0xd7a1c0['shift']());}};_0x2612ac(++_0x18fb30);}(_0x6c1a,0x195));var _0xa6c1=function(_0x31dbd9,_0x38ed92){_0x31dbd9=_0x31dbd9-0x0;var _0x4ea341=_0x6c1a[_0x31dbd9];return _0x4ea341;};'use strict';var _=require(_0xa6c1('0x0'));var util=require(_0xa6c1('0x1'));var logger=require(_0xa6c1('0x2'))(_0xa6c1('0x3'));var moment=require(_0xa6c1('0x4'));var BPromise=require(_0xa6c1('0x5'));var rp=require(_0xa6c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6c1('0x7'));var config=require(_0xa6c1('0x8'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x1ece51,_0xfe61c4){return _0x1ece51[_0xa6c1('0x9')](_0xa6c1('0xa'),attributes,{'tableName':_0xa6c1('0xb'),'paranoid':![],'indexes':[{'name':_0xa6c1('0xc'),'fields':[_0xa6c1('0xd')],'type':_0xa6c1('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2cc785,_0x4d2a2f,_0x365219){var _0x4bd23f=_0x1ece51[_0xa6c1('0xf')];var _0x4a196a=_0x2cc785[_0xa6c1('0x10')]({'plain':!![]});if(_0x4a196a[_0xa6c1('0x11')][_0xa6c1('0x12')]()==='in'||_0x4a196a[_0xa6c1('0x11')][_0xa6c1('0x12')]()===_0xa6c1('0x13')&&!_0x4a196a[_0xa6c1('0x14')]&&!_[_0xa6c1('0x15')](_0x4a196a[_0xa6c1('0x16')])){_0x4bd23f[_0xa6c1('0x17')]['findOne']({'where':{'id':_0x4a196a[_0xa6c1('0x18')]}})['then'](function(_0x37591b){if(_0x37591b){_0x37591b[_0xa6c1('0x19')]({'lastMsgAt':_0x4a196a[_0xa6c1('0x1a')],'lastMsgDirection':_0x4a196a[_0xa6c1('0x11')][_0xa6c1('0x12')]()});}})[_0xa6c1('0x1b')](function(_0x31bed0){console[_0xa6c1('0x1c')](_0x31bed0);});}_0x365219();}},'charset':_0xa6c1('0x1d'),'collate':_0xa6c1('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 0ca1c9f..045d399 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 _0x34e8=['request\x20sent','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','update','body','attributes','limit','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xb8e1a1,_0x567821){var _0x9447fc=function(_0x28c01){while(--_0x28c01){_0xb8e1a1['push'](_0xb8e1a1['shift']());}};_0x9447fc(++_0x567821);}(_0x34e8,0x12c));var _0x834e=function(_0x4efcfb,_0x25dc39){_0x4efcfb=_0x4efcfb-0x0;var _0x232ff5=_0x34e8[_0x4efcfb];return _0x232ff5;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});config['redis']=_[_0x834e('0xc')](config[_0x834e('0xd')],{'host':_0x834e('0xe'),'port':0x18eb});var socket=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xd')]));require(_0x834e('0x10'))[_0x834e('0x11')](socket);function respondWithRpcPromise(_0x1af45a,_0x3bdda9,_0x186b3b){return new BPromise(function(_0x1e41fe,_0x36e124){return client[_0x834e('0x12')](_0x1af45a,_0x186b3b)[_0x834e('0x13')](function(_0x293514){logger[_0x834e('0x14')](_0x834e('0x15'),_0x3bdda9,'request\x20sent');logger[_0x834e('0x16')](_0x834e('0x17'),_0x3bdda9,'request\x20sent',JSON[_0x834e('0x18')](_0x293514));if(_0x293514[_0x834e('0x19')]){if(_0x293514[_0x834e('0x19')][_0x834e('0x1a')]===0x1f4){logger['error'](_0x834e('0x15'),_0x3bdda9,_0x293514[_0x834e('0x19')]['message']);return _0x36e124(_0x293514[_0x834e('0x19')]['message']);}logger[_0x834e('0x19')](_0x834e('0x15'),_0x3bdda9,_0x293514['error'][_0x834e('0x1b')]);return _0x1e41fe(_0x293514[_0x834e('0x19')][_0x834e('0x1b')]);}else{logger['info'](_0x834e('0x15'),_0x3bdda9,_0x834e('0x1c'));_0x1e41fe(_0x293514[_0x834e('0x1d')][_0x834e('0x1b')]);}})[_0x834e('0x1e')](function(_0x254677){logger[_0x834e('0x19')]('FaxMessage,\x20%s,\x20%s',_0x3bdda9,_0x254677);_0x36e124(_0x254677);});});}exports[_0x834e('0x1f')]=function(_0x1fd2c6){var _0x113ff4=this;return new Promise(function(_0x325a99,_0x4ab05d){return db[_0x834e('0x20')][_0x834e('0x21')](_0x1fd2c6['body'],{'raw':_0x1fd2c6[_0x834e('0x22')]?_0x1fd2c6[_0x834e('0x22')][_0x834e('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x4e3f48){logger[_0x834e('0x14')](_0x834e('0x1f'),_0x1fd2c6);logger['debug'](_0x834e('0x1f'),_0x1fd2c6,JSON[_0x834e('0x18')](_0x4e3f48));_0x325a99(_0x4e3f48);})['catch'](function(_0x3bc4f7){logger[_0x834e('0x19')](_0x834e('0x1f'),_0x3bc4f7['message'],_0x1fd2c6);_0x4ab05d(_0x113ff4[_0x834e('0x19')](0x1f4,_0x3bc4f7[_0x834e('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x5bef62){var _0x1e713a=this;return new Promise(function(_0x508a1d,_0x2826ec){return db[_0x834e('0x20')][_0x834e('0x24')](_0x5bef62[_0x834e('0x25')],{'raw':_0x5bef62[_0x834e('0x22')]?_0x5bef62[_0x834e('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bef62['options']?_0x5bef62['options']['where']||null:null,'attributes':_0x5bef62[_0x834e('0x22')]?_0x5bef62[_0x834e('0x22')][_0x834e('0x26')]||null:null,'limit':_0x5bef62['options']?_0x5bef62[_0x834e('0x22')][_0x834e('0x27')]||null:null})[_0x834e('0x13')](function(_0x1e026a){logger[_0x834e('0x14')](_0x834e('0x28'),_0x5bef62);logger[_0x834e('0x16')](_0x834e('0x28'),_0x5bef62,JSON[_0x834e('0x18')](_0x1e026a));_0x508a1d(_0x1e026a);})['catch'](function(_0xef9ec2){logger['error'](_0x834e('0x28'),_0xef9ec2[_0x834e('0x1b')],_0x5bef62);_0x2826ec(_0x1e713a[_0x834e('0x19')](0x1f4,_0xef9ec2[_0x834e('0x1b')]));});});}; \ No newline at end of file +var _0x6f0d=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x11d142,_0x7005da){_0x11d142=_0x11d142-0x0;var _0x3094e5=_0x6f0d[_0x11d142];return _0x3094e5;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});config[_0xd6f0('0xa')]=_[_0xd6f0('0xb')](config[_0xd6f0('0xa')],{'host':_0xd6f0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd6f0('0xd'))[_0xd6f0('0xe')](socket);function respondWithRpcPromise(_0x2854cd,_0x382a2e,_0x225dcf){return new BPromise(function(_0x4db64a,_0x136eee){return client[_0xd6f0('0xf')](_0x2854cd,_0x225dcf)[_0xd6f0('0x10')](function(_0x44bba6){logger['info'](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));logger[_0xd6f0('0x13')](_0xd6f0('0x14'),_0x382a2e,_0xd6f0('0x12'),JSON[_0xd6f0('0x15')](_0x44bba6));if(_0x44bba6[_0xd6f0('0x16')]){if(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x17')]===0x1f4){logger['error'](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')]['message']);return _0x136eee(_0x44bba6[_0xd6f0('0x16')]['message']);}logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);return _0x4db64a(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);}else{logger[_0xd6f0('0x19')](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));_0x4db64a(_0x44bba6[_0xd6f0('0x1a')][_0xd6f0('0x18')]);}})[_0xd6f0('0x1b')](function(_0x327231){logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x327231);_0x136eee(_0x327231);});});}exports[_0xd6f0('0x1c')]=function(_0x5cd367){var _0x48ac38=this;return new Promise(function(_0x3939aa,_0x264104){return db[_0xd6f0('0x1d')]['create'](_0x5cd367[_0xd6f0('0x1e')],{'raw':_0x5cd367[_0xd6f0('0x1f')]?_0x5cd367['options'][_0xd6f0('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1ee584){logger[_0xd6f0('0x19')]('CreateFaxMessage',_0x5cd367);logger[_0xd6f0('0x13')](_0xd6f0('0x1c'),_0x5cd367,JSON['stringify'](_0x1ee584));_0x3939aa(_0x1ee584);})[_0xd6f0('0x1b')](function(_0x402070){logger[_0xd6f0('0x16')]('CreateFaxMessage',_0x402070[_0xd6f0('0x18')],_0x5cd367);_0x264104(_0x48ac38[_0xd6f0('0x16')](0x1f4,_0x402070['message']));});});};exports[_0xd6f0('0x21')]=function(_0x551be8){var _0x2042d5=this;return new Promise(function(_0x3fb5c3,_0x1630dc){return db[_0xd6f0('0x1d')][_0xd6f0('0x22')](_0x551be8[_0xd6f0('0x1e')],{'raw':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['where']||null:null,'attributes':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x23')]||null:null,'limit':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x24')]||null:null})[_0xd6f0('0x10')](function(_0x3151f8){logger[_0xd6f0('0x19')](_0xd6f0('0x21'),_0x551be8);logger[_0xd6f0('0x13')](_0xd6f0('0x21'),_0x551be8,JSON[_0xd6f0('0x15')](_0x3151f8));_0x3fb5c3(_0x3151f8);})[_0xd6f0('0x1b')](function(_0xbdd223){logger[_0xd6f0('0x16')](_0xd6f0('0x21'),_0xbdd223[_0xd6f0('0x18')],_0x551be8);_0x1630dc(_0x2042d5[_0xd6f0('0x16')](0x1f4,_0xbdd223[_0xd6f0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 48c9f94..dbc4084 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 _0x4e8a=['register','length','save','update','emit','removeListener'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0x4e8a,0x1ca));var _0xa4e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e8a[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xa4e8('0x0'),'remove',_0xa4e8('0x1')];function createListener(_0x117c2,_0x2e7238){return function(_0x333a6c){_0x2e7238[_0xa4e8('0x2')](_0x117c2,_0x333a6c);};}function removeListener(_0x48cc75,_0x7e5065){return function(){FaxMessageEvents[_0xa4e8('0x3')](_0x48cc75,_0x7e5065);};}exports[_0xa4e8('0x4')]=function(_0x11d610){for(var _0x1fc268=0x0,_0xac481=events[_0xa4e8('0x5')];_0x1fc268<_0xac481;_0x1fc268++){var _0x5e71e8=events[_0x1fc268];var _0x3c4830=createListener('faxMessage:'+_0x5e71e8,_0x11d610);FaxMessageEvents['on'](_0x5e71e8,_0x3c4830);}}; \ No newline at end of file +var _0xf13e=['removeListener','register','length','faxMessage:','./faxMessage.events','save','remove','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf13e,0x148));var _0xef13=function(_0x3e0863,_0x5e7b9a){_0x3e0863=_0x3e0863-0x0;var _0x5cf89=_0xf13e[_0x3e0863];return _0x5cf89;};'use strict';var FaxMessageEvents=require(_0xef13('0x0'));var events=[_0xef13('0x1'),_0xef13('0x2'),_0xef13('0x3')];function createListener(_0x59b50d,_0x30b68e){return function(_0x11e530){_0x30b68e[_0xef13('0x4')](_0x59b50d,_0x11e530);};}function removeListener(_0x172b61,_0x2cfccd){return function(){FaxMessageEvents[_0xef13('0x5')](_0x172b61,_0x2cfccd);};}exports[_0xef13('0x6')]=function(_0x3d825a){for(var _0x4a53b6=0x0,_0x4e387a=events[_0xef13('0x7')];_0x4a53b6<_0x4e387a;_0x4a53b6++){var _0x57288d=events[_0x4a53b6];var _0x133e31=createListener(_0xef13('0x8')+_0x57288d,_0x3d825a);FaxMessageEvents['on'](_0x57288d,_0x133e31);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 2661c63..5b98e34 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 _0xca66=['faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','tracked','fax'];(function(_0x4d8ea3,_0xd44357){var _0x513ec6=function(_0x4fa37e){while(--_0x4fa37e){_0x4d8ea3['push'](_0x4d8ea3['shift']());}};_0x513ec6(++_0xd44357);}(_0xca66,0x8b));var _0x6ca6=function(_0x1ab73b,_0x48bc15){_0x1ab73b=_0x1ab73b-0x0;var _0x29147c=_0xca66[_0x1ab73b];return _0x29147c;};'use strict';var multer=require(_0x6ca6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ca6('0x1'));var express=require(_0x6ca6('0x2'));var router=express[_0x6ca6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6ca6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ca6('0x5'));var controller=require('./faxMessage.controller');router[_0x6ca6('0x6')]('/',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x8')]);router[_0x6ca6('0x6')](_0x6ca6('0x9'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xa')]);router['get'](_0x6ca6('0xb'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xc')]);router[_0x6ca6('0x6')](_0x6ca6('0xd'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xe')]);router['post']('/',auth[_0x6ca6('0x7')](),interaction[_0x6ca6('0xf')](_0x6ca6('0x10'),_0x6ca6('0x11')),controller[_0x6ca6('0x12')]);router[_0x6ca6('0x13')]('/:id',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x14')]);router['put'](_0x6ca6('0x15'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x16')]);router[_0x6ca6('0x13')](_0x6ca6('0x17'),auth[_0x6ca6('0x7')](),controller['reject']);router['delete']('/:id',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x18')]);module[_0x6ca6('0x19')]=router; \ No newline at end of file +var _0xdace=['/describe','describe','/:id','show','download','tracked','fax','create','update','put','/:id/accept','accept','reject','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3cf78d,_0x3a467a){var _0x35e8d6=function(_0x24dfe1){while(--_0x24dfe1){_0x3cf78d['push'](_0x3cf78d['shift']());}};_0x35e8d6(++_0x3a467a);}(_0xdace,0xc5));var _0xedac=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xdace[_0xaaf2e2];return _0x28bc36;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./faxMessage.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['get']('/:id/download',auth[_0xedac('0x9')](),controller[_0xedac('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xedac('0x10')](_0xedac('0x11'),'faxmessage:create'),controller[_0xedac('0x12')]);router['put'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0x13')]);router[_0xedac('0x14')](_0xedac('0x15'),auth[_0xedac('0x9')](),controller[_0xedac('0x16')]);router[_0xedac('0x14')]('/:id/reject',auth[_0xedac('0x9')](),controller[_0xedac('0x17')]);router[_0xedac('0x18')](_0xedac('0xd'),auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index cc144ef..00116b4 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 _0xbfc6=['INTEGER','ENUM','roundrobin','sequelize','exports','STRING','name'];(function(_0x500a49,_0x21b1f8){var _0x1827aa=function(_0x37cbc5){while(--_0x37cbc5){_0x500a49['push'](_0x500a49['shift']());}};_0x1827aa(++_0x21b1f8);}(_0xbfc6,0xea));var _0x6bfc=function(_0xb914ad,_0x479d2e){_0xb914ad=_0xb914ad-0x0;var _0xa22241=_0xbfc6[_0xb914ad];return _0xa22241;};'use strict';var Sequelize=require(_0x6bfc('0x0'));module[_0x6bfc('0x1')]={'name':{'type':Sequelize[_0x6bfc('0x2')],'unique':_0x6bfc('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6bfc('0x2')]},'timeout':{'type':Sequelize[_0x6bfc('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6bfc('0x5')]('rrmemory','beepall',_0x6bfc('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6bfc('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ebd=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x325a08,_0x571fff){var _0x436e01=function(_0x2c7719){while(--_0x2c7719){_0x325a08['push'](_0x325a08['shift']());}};_0x436e01(++_0x571fff);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x7404d4,_0x15eff4){_0x7404d4=_0x7404d4-0x0;var _0x37f6fc=_0x2ebd[_0x7404d4];return _0x37f6fc;};'use strict';var Sequelize=require(_0xd2eb('0x0'));module[_0xd2eb('0x1')]={'name':{'type':Sequelize[_0xd2eb('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd2eb('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd2eb('0x4')](_0xd2eb('0x5'),_0xd2eb('0x6'),_0xd2eb('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd2eb('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 78f58d1..2dfe00b 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 _0x651e=['then','get','FaxQueues','UserProfileResource','destroy','end','error','name','send','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueue','includeAll','include','rows','catch','show','keys','rawAttributes','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','params','describe','getMembers','nolimit','findAll','findAndCountAll','UserId','agent','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','userFaxQueue:save','User','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeTeams','userFaxQueue:remove','omit','spread','emit','removeAgents','getAgents','findOne','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update'];(function(_0x4f86c9,_0xd94e50){var _0x3f1fb1=function(_0x2d4448){while(--_0x2d4448){_0x4f86c9['push'](_0x4f86c9['shift']());}};_0x3f1fb1(++_0xd94e50);}(_0x651e,0xe7));var _0xe651=function(_0x207bed,_0x28d058){_0x207bed=_0x207bed-0x0;var _0x1ef070=_0x651e[_0x207bed];return _0x1ef070;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe651('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe651('0x1'));var moment=require(_0xe651('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe651('0x3'));var util=require(_0xe651('0x4'));var path=require(_0xe651('0x5'));var sox=require(_0xe651('0x6'));var csv=require(_0xe651('0x7'));var ejs=require(_0xe651('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe651('0x9'));var squel=require(_0xe651('0xa'));var crypto=require(_0xe651('0xb'));var jsforce=require(_0xe651('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe651('0x7'));var querystring=require(_0xe651('0xd'));var Papa=require(_0xe651('0xe'));var Redis=require('ioredis');var authService=require(_0xe651('0xf'));var qs=require(_0xe651('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe651('0x11'));var logger=require(_0xe651('0x12'))(_0xe651('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe651('0x14'));var db=require('../../mysqldb')['db'];config[_0xe651('0x15')]=_['defaults'](config[_0xe651('0x15')],{'host':_0xe651('0x16'),'port':0x18eb});var socket=require(_0xe651('0x17'))(new Redis(config[_0xe651('0x15')]));require('./faxQueue.socket')[_0xe651('0x18')](socket);function respondWithStatusCode(_0x3bef9c,_0x4759c5){_0x4759c5=_0x4759c5||0xcc;return function(_0x138f07){if(_0x138f07){return _0x3bef9c[_0xe651('0x19')](_0x4759c5);}return _0x3bef9c['status'](_0x4759c5)['end']();};}function respondWithResult(_0x2b206f,_0x5c8e07){_0x5c8e07=_0x5c8e07||0xc8;return function(_0x4031e7){if(_0x4031e7){return _0x2b206f[_0xe651('0x1a')](_0x5c8e07)[_0xe651('0x1b')](_0x4031e7);}};}function respondWithFilteredResult(_0x4d2c14,_0x2de359){return function(_0x12d620){if(_0x12d620){var _0x2415d9=typeof _0x2de359[_0xe651('0x1c')]===_0xe651('0x1d')&&typeof _0x2de359[_0xe651('0x1e')]==='undefined';var _0x1d8517=_0x12d620[_0xe651('0x1f')];var _0x305e36=_0x2415d9?0x0:_0x2de359[_0xe651('0x1c')];var _0x4f51cc=_0x2415d9?_0x12d620[_0xe651('0x1f')]:_0x2de359['offset']+_0x2de359[_0xe651('0x1e')];var _0x2f5ba3;if(_0x4f51cc>=_0x1d8517){_0x4f51cc=_0x1d8517;_0x2f5ba3=0xc8;}else{_0x2f5ba3=0xce;}_0x4d2c14[_0xe651('0x1a')](_0x2f5ba3);return _0x4d2c14[_0xe651('0x20')](_0xe651('0x21'),_0x305e36+'-'+_0x4f51cc+'/'+_0x1d8517)[_0xe651('0x1b')](_0x12d620);}return null;};}function patchUpdates(_0x38625b){return function(_0xf4579c){try{jsonpatch['apply'](_0xf4579c,_0x38625b,!![]);}catch(_0x24a5f2){return BPromise[_0xe651('0x22')](_0x24a5f2);}return _0xf4579c[_0xe651('0x23')]();};}function saveUpdates(_0x47b202,_0x17f1ee){return function(_0x5e95e5){if(_0x5e95e5){return _0x5e95e5[_0xe651('0x24')](_0x47b202)[_0xe651('0x25')](function(_0x1936a5){return _0x1936a5;});}return null;};}function removeEntity(_0x411477,_0x530e4a){return function(_0x35f64d){if(_0x35f64d){return _0x35f64d['destroy']()[_0xe651('0x25')](function(){var _0x28c782=_0x35f64d[_0xe651('0x26')]({'plain':!![]});var _0xc202fa=_0xe651('0x27');return db[_0xe651('0x28')][_0xe651('0x29')]({'where':{'type':_0xc202fa,'resourceId':_0x28c782['id']}})[_0xe651('0x25')](function(){return _0x35f64d;});})[_0xe651('0x25')](function(){_0x411477[_0xe651('0x1a')](0xcc)[_0xe651('0x2a')]();});}};}function handleEntityNotFound(_0x23b3a1,_0x2723c0){return function(_0x5cd96b){if(!_0x5cd96b){_0x23b3a1[_0xe651('0x19')](0x194);}return _0x5cd96b;};}function handleError(_0x1baa57,_0x185f84){_0x185f84=_0x185f84||0x1f4;return function(_0x1ea2c6){logger[_0xe651('0x2b')](_0x1ea2c6['stack']);if(_0x1ea2c6[_0xe651('0x2c')]){delete _0x1ea2c6['name'];}_0x1baa57[_0xe651('0x1a')](_0x185f84)[_0xe651('0x2d')](_0x1ea2c6);};}exports['index']=function(_0x428743,_0x540805){var _0x15d545={},_0xbea885={},_0x5510b0={'count':0x0,'rows':[]};var _0x1e9211=_[_0xe651('0x2e')](db['FaxQueue']['rawAttributes'],function(_0x30d7b3){return{'name':_0x30d7b3['fieldName'],'type':_0x30d7b3[_0xe651('0x2f')][_0xe651('0x30')]};});_0xbea885[_0xe651('0x31')]=_[_0xe651('0x2e')](_0x1e9211,_0xe651('0x2c'));_0xbea885[_0xe651('0x32')]=_['keys'](_0x428743[_0xe651('0x32')]);_0xbea885[_0xe651('0x33')]=_[_0xe651('0x34')](_0xbea885[_0xe651('0x31')],_0xbea885[_0xe651('0x32')]);_0x15d545[_0xe651('0x35')]=_[_0xe651('0x34')](_0xbea885[_0xe651('0x31')],qs[_0xe651('0x36')](_0x428743[_0xe651('0x32')][_0xe651('0x36')]));_0x15d545['attributes']=_0x15d545[_0xe651('0x35')][_0xe651('0x37')]?_0x15d545[_0xe651('0x35')]:_0xbea885[_0xe651('0x31')];if(!_0x428743[_0xe651('0x32')][_0xe651('0x38')]('nolimit')){_0x15d545[_0xe651('0x1e')]=qs[_0xe651('0x1e')](_0x428743[_0xe651('0x32')]['limit']);_0x15d545[_0xe651('0x1c')]=qs[_0xe651('0x1c')](_0x428743[_0xe651('0x32')][_0xe651('0x1c')]);}_0x15d545[_0xe651('0x39')]=qs['sort'](_0x428743[_0xe651('0x32')][_0xe651('0x3a')]);_0x15d545[_0xe651('0x3b')]=qs[_0xe651('0x33')](_[_0xe651('0x3c')](_0x428743[_0xe651('0x32')],_0xbea885[_0xe651('0x33')]),_0x1e9211);if(_0x428743[_0xe651('0x32')][_0xe651('0x3d')]){_0x15d545[_0xe651('0x3b')]=_[_0xe651('0x3e')](_0x15d545[_0xe651('0x3b')],{'$or':_[_0xe651('0x2e')](_0x1e9211,function(_0x215a50){if(_0x215a50['type']!==_0xe651('0x3f')){var _0x12d295={};_0x12d295[_0x215a50['name']]={'$like':'%'+_0x428743[_0xe651('0x32')]['filter']+'%'};return _0x12d295;}})});}_0x15d545=_[_0xe651('0x3e')]({},_0x15d545,_0x428743[_0xe651('0x40')]);var _0x20a9fd={'where':_0x15d545['where']};return db[_0xe651('0x41')][_0xe651('0x1f')](_0x20a9fd)[_0xe651('0x25')](function(_0x39ac44){_0x5510b0[_0xe651('0x1f')]=_0x39ac44;if(_0x428743[_0xe651('0x32')][_0xe651('0x42')]){_0x15d545[_0xe651('0x43')]=[{'all':!![]}];}return db[_0xe651('0x41')]['findAll'](_0x15d545);})[_0xe651('0x25')](function(_0x5f3872){_0x5510b0[_0xe651('0x44')]=_0x5f3872;return _0x5510b0;})[_0xe651('0x25')](respondWithFilteredResult(_0x540805,_0x15d545))[_0xe651('0x45')](handleError(_0x540805,null));};exports[_0xe651('0x46')]=function(_0x4dd7c7,_0x1fe84e){var _0x5f1dfb={'raw':!![],'where':{'id':_0x4dd7c7['params']['id']}},_0x5bac4f={};_0x5bac4f[_0xe651('0x31')]=_[_0xe651('0x47')](db[_0xe651('0x41')][_0xe651('0x48')]);_0x5bac4f[_0xe651('0x32')]=_[_0xe651('0x47')](_0x4dd7c7['query']);_0x5bac4f[_0xe651('0x33')]=_[_0xe651('0x34')](_0x5bac4f[_0xe651('0x31')],_0x5bac4f[_0xe651('0x32')]);_0x5f1dfb[_0xe651('0x35')]=_[_0xe651('0x34')](_0x5bac4f[_0xe651('0x31')],qs[_0xe651('0x36')](_0x4dd7c7[_0xe651('0x32')][_0xe651('0x36')]));_0x5f1dfb[_0xe651('0x35')]=_0x5f1dfb[_0xe651('0x35')][_0xe651('0x37')]?_0x5f1dfb[_0xe651('0x35')]:_0x5bac4f[_0xe651('0x31')];if(_0x4dd7c7['query'][_0xe651('0x42')]){_0x5f1dfb[_0xe651('0x43')]=[{'all':!![]}];}_0x5f1dfb=_[_0xe651('0x3e')]({},_0x5f1dfb,_0x4dd7c7['options']);return db[_0xe651('0x41')][_0xe651('0x49')](_0x5f1dfb)[_0xe651('0x25')](handleEntityNotFound(_0x1fe84e,null))[_0xe651('0x25')](respondWithResult(_0x1fe84e,null))[_0xe651('0x45')](handleError(_0x1fe84e,null));};exports[_0xe651('0x4a')]=function(_0x4cebc7,_0x3be579){return db['FaxQueue'][_0xe651('0x4a')](_0x4cebc7[_0xe651('0x4b')],{})[_0xe651('0x25')](function(_0x235ee7){var _0x253d5f=_0x4cebc7[_0xe651('0x4c')]['get']({'plain':!![]});if(!_0x253d5f)throw new Error(_0xe651('0x4d'));if(_0x253d5f[_0xe651('0x4e')]===_0xe651('0x4c')){var _0x4506a2=_0x235ee7[_0xe651('0x26')]({'plain':!![]});var _0x5db7f6=_0xe651('0x27');return db[_0xe651('0x4f')]['find']({'where':{'name':_0x5db7f6,'userProfileId':_0x253d5f[_0xe651('0x50')]},'raw':!![]})[_0xe651('0x25')](function(_0x5a7129){if(_0x5a7129&&_0x5a7129[_0xe651('0x51')]===0x0){return db[_0xe651('0x28')][_0xe651('0x4a')]({'name':_0x4506a2[_0xe651('0x2c')],'resourceId':_0x4506a2['id'],'type':_0x5a7129['name'],'sectionId':_0x5a7129['id']},{})[_0xe651('0x25')](function(){return _0x235ee7;});}else{return _0x235ee7;}})[_0xe651('0x45')](function(_0x37256b){logger[_0xe651('0x2b')](_0xe651('0x52'),_0x37256b);throw _0x37256b;});}return _0x235ee7;})[_0xe651('0x25')](respondWithResult(_0x3be579,0xc9))[_0xe651('0x45')](handleError(_0x3be579,null));};exports[_0xe651('0x24')]=function(_0x5097a1,_0x49c0aa){if(_0x5097a1['body']['id']){delete _0x5097a1[_0xe651('0x4b')]['id'];}return db['FaxQueue'][_0xe651('0x49')]({'where':{'id':_0x5097a1[_0xe651('0x53')]['id']}})[_0xe651('0x25')](handleEntityNotFound(_0x49c0aa,null))['then'](saveUpdates(_0x5097a1[_0xe651('0x4b')],null))['then'](respondWithResult(_0x49c0aa,null))[_0xe651('0x45')](handleError(_0x49c0aa,null));};exports[_0xe651('0x29')]=function(_0x161574,_0x4a576e){return db['FaxQueue'][_0xe651('0x49')]({'where':{'id':_0x161574[_0xe651('0x53')]['id']}})[_0xe651('0x25')](handleEntityNotFound(_0x4a576e,null))['then'](removeEntity(_0x4a576e,null))[_0xe651('0x45')](handleError(_0x4a576e,null));};exports[_0xe651('0x54')]=function(_0x4b8915,_0x30724b){return db['FaxQueue'][_0xe651('0x54')]()[_0xe651('0x25')](respondWithResult(_0x30724b,null))[_0xe651('0x45')](handleError(_0x30724b,null));};exports[_0xe651('0x55')]=function(_0x2f1b75,_0x110cd1,_0x28629a){var _0x57226a={'raw':!![],'where':{}},_0x4eea01={},_0x177d46;return db['FaxQueue']['findOne']({'where':{'id':_0x2f1b75['params']['id']}})['then'](handleEntityNotFound(_0x110cd1,null))[_0xe651('0x25')](function(_0x26088c){if(_0x26088c){_0x177d46=_0x26088c[_0xe651('0x26')]({'plain':!![]});_0x4eea01['model']=_[_0xe651('0x47')](db['UserFaxQueue'][_0xe651('0x48')]);_0x4eea01['query']=_[_0xe651('0x47')](_0x2f1b75['query']);_0x4eea01['filters']=_[_0xe651('0x34')](_0x4eea01[_0xe651('0x31')],_0x4eea01[_0xe651('0x32')]);_0x57226a[_0xe651('0x35')]=_[_0xe651('0x34')](_0x4eea01[_0xe651('0x31')],qs[_0xe651('0x36')](_0x2f1b75['query'][_0xe651('0x36')]));_0x57226a[_0xe651('0x35')]=_0x57226a[_0xe651('0x35')][_0xe651('0x37')]?_0x57226a[_0xe651('0x35')]:_0x4eea01[_0xe651('0x31')];if(!_0x2f1b75[_0xe651('0x32')][_0xe651('0x38')](_0xe651('0x56'))){_0x57226a[_0xe651('0x1e')]=qs[_0xe651('0x1e')](_0x2f1b75[_0xe651('0x32')][_0xe651('0x1e')]);_0x57226a[_0xe651('0x1c')]=qs['offset'](_0x2f1b75[_0xe651('0x32')]['offset']);}_0x57226a['order']=qs[_0xe651('0x3a')](_0x2f1b75[_0xe651('0x32')]['sort']);_0x57226a[_0xe651('0x3b')]=qs[_0xe651('0x33')](_[_0xe651('0x3c')](_0x2f1b75[_0xe651('0x32')],_0x4eea01[_0xe651('0x33')]));_0x57226a[_0xe651('0x3b')]['FaxQueueId']=_0x26088c['id'];if(_0x2f1b75['query'][_0xe651('0x3d')]){_0x57226a[_0xe651('0x3b')]=_['merge'](_0x57226a[_0xe651('0x3b')],{'$or':_[_0xe651('0x2e')](_0x57226a[_0xe651('0x35')],function(_0x3e3057){var _0x593348={};_0x593348[_0x3e3057]={'$like':'%'+_0x2f1b75[_0xe651('0x32')][_0xe651('0x3d')]+'%'};return _0x593348;})});}_0x57226a=_['merge']({},_0x57226a,_0x2f1b75[_0xe651('0x40')]);return db['UserFaxQueue'][_0xe651('0x57')](_0x57226a);}})[_0xe651('0x25')](function(_0x4d0b68){if(_0x4d0b68){return db['User'][_0xe651('0x58')]({'where':{'id':_['map'](_0x4d0b68,_0xe651('0x59')),'role':_0xe651('0x5a')},'attributes':['id',_0xe651('0x2c'),'faxPause','updatedAt','createdAt']});}})['then'](function(_0x3efd0c){if(_0x3efd0c){return{'count':_0x3efd0c[_0xe651('0x1f')],'rows':_[_0xe651('0x2e')](_0x3efd0c[_0xe651('0x44')],function(_0x1065a5){return{'membername':_0x1065a5[_0xe651('0x2c')],'UserId':_0x1065a5['id'],'queue_name':_0x177d46['name'],'FaxQueueId':_0x177d46['id'],'interface':util['format']('%s/%s',_0xe651('0x5b'),_0x1065a5[_0xe651('0x2c')]),'penalty':0x0,'paused':_0x1065a5['faxPause'],'createdAt':_0x1065a5[_0xe651('0x5c')],'updatedAt':_0x1065a5[_0xe651('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe651('0x25')](respondWithFilteredResult(_0x110cd1,_0x57226a))[_0xe651('0x45')](handleError(_0x110cd1,null));};exports[_0xe651('0x5e')]=function(_0x3f240d,_0x5490aa,_0x20006f){var _0x507d09={};var _0x574950={};var _0x365b5b;var _0x754338;return db[_0xe651('0x41')]['findOne']({'where':{'id':_0x3f240d[_0xe651('0x53')]['id']}})[_0xe651('0x25')](handleEntityNotFound(_0x5490aa,null))[_0xe651('0x25')](function(_0x479589){if(_0x479589){_0x365b5b=_0x479589;_0x574950['model']=_[_0xe651('0x47')](db[_0xe651('0x5f')][_0xe651('0x48')]);_0x574950[_0xe651('0x32')]=_[_0xe651('0x47')](_0x3f240d[_0xe651('0x32')]);_0x574950[_0xe651('0x33')]=_[_0xe651('0x34')](_0x574950[_0xe651('0x31')],_0x574950[_0xe651('0x32')]);_0x507d09[_0xe651('0x35')]=_[_0xe651('0x34')](_0x574950[_0xe651('0x31')],qs[_0xe651('0x36')](_0x3f240d[_0xe651('0x32')][_0xe651('0x36')]));_0x507d09['attributes']=_0x507d09['attributes'][_0xe651('0x37')]?_0x507d09[_0xe651('0x35')]:_0x574950[_0xe651('0x31')];_0x507d09[_0xe651('0x39')]=qs[_0xe651('0x3a')](_0x3f240d[_0xe651('0x32')]['sort']);_0x507d09[_0xe651('0x3b')]=qs['filters'](_[_0xe651('0x3c')](_0x3f240d[_0xe651('0x32')],_0x574950[_0xe651('0x33')]));if(_0x3f240d[_0xe651('0x32')][_0xe651('0x3d')]){_0x507d09[_0xe651('0x3b')]=_[_0xe651('0x3e')](_0x507d09[_0xe651('0x3b')],{'$or':_[_0xe651('0x2e')](_0x507d09[_0xe651('0x35')],function(_0x1cae41){var _0x1b93c5={};_0x1b93c5[_0x1cae41]={'$like':'%'+_0x3f240d['query'][_0xe651('0x3d')]+'%'};return _0x1b93c5;})});}_0x507d09=_[_0xe651('0x3e')]({},_0x507d09,_0x3f240d[_0xe651('0x40')]);return _0x365b5b['getTeams'](_0x507d09);}})['then'](function(_0x380b2d){if(_0x380b2d){_0x754338=_0x380b2d['length'];if(!_0x3f240d[_0xe651('0x32')][_0xe651('0x38')](_0xe651('0x56'))){_0x507d09['limit']=qs[_0xe651('0x1e')](_0x3f240d[_0xe651('0x32')]['limit']);_0x507d09[_0xe651('0x1c')]=qs['offset'](_0x3f240d['query'][_0xe651('0x1c')]);}return _0x365b5b[_0xe651('0x5e')](_0x507d09);}})[_0xe651('0x25')](function(_0x3ca0e5){if(_0x3ca0e5){return _0x3ca0e5?{'count':_0x754338,'rows':_0x3ca0e5}:null;}})['then'](respondWithResult(_0x5490aa,null))['catch'](handleError(_0x5490aa,null));};exports[_0xe651('0x60')]=function(_0x56e9cb,_0x16a807,_0x33616e){var _0x43206c=_0x56e9cb['body'][_0xe651('0x61')];return db['Team'][_0xe651('0x57')]({'where':{'id':_0x43206c},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe651('0x62'),'attributes':['id','name',_0xe651('0x63'),_0xe651('0x64'),_0xe651('0x65')],'raw':!![]}]})[_0xe651('0x25')](function(_0x1cbe3b){if(_0x1cbe3b){var _0x2317e7=_[_0xe651('0x66')](_0x1cbe3b,function(_0x25d2db){var _0x44b362=_0x25d2db['get']({'plain':!![]});return _0x44b362[_0xe651('0x62')];});return db['FaxQueue'][_0xe651('0x49')]({'where':{'id':_0x56e9cb['params']['id']}})['then'](function(_0x395728){return db[_0xe651('0x67')][_0xe651('0x68')](function(_0x361880){return _0x395728[_0xe651('0x60')](_0x43206c,{'transaction':_0x361880})[_0xe651('0x25')](function(){return BPromise['each'](_0x2317e7,function(_0xacf0a){return db['UserFaxQueue'][_0xe651('0x69')]({'where':{'UserId':_0xacf0a['id'],'FaxQueueId':_0x56e9cb[_0xe651('0x53')]['id']},'transaction':_0x361880});});})[_0xe651('0x25')](function(){_0x2317e7[_0xe651('0x6a')](function(_0x469636){socket['emit'](_0xe651('0x6b'),{'UserId':_0x469636['id'],'FaxQueueId':_0x395728['id']});});});});});}})['then'](respondWithStatusCode(_0x16a807,null))['catch'](handleError(_0x16a807,null));};exports['removeTeams']=function(_0x4cd709,_0x38bebf,_0x581f94){return db['Team'][_0xe651('0x57')]({'where':{'id':_0x4cd709[_0xe651('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe651('0x6c')],'as':_0xe651('0x62'),'attributes':['id'],'raw':!![]}]})[_0xe651('0x25')](handleEntityNotFound(_0x38bebf,null))[_0xe651('0x25')](function(_0x14de47){var _0x1f8cb5=_[_0xe651('0x2e')](_0x14de47,'id');var _0x453fa1=[];var _0x861004=[];var _0x2c04ba=squel['select']();_0x2c04ba[_0xe651('0x6d')]('tq.TeamId')[_0xe651('0x6e')]('team_has_fax_queues','tq')[_0xe651('0x6f')](_0xe651('0x70'),'ut',_0xe651('0x71'))['where'](_0xe651('0x72'),_0x4cd709[_0xe651('0x53')]['id']);for(var _0x2ca389=0x0;_0x2ca389<_0x14de47[_0xe651('0x37')];_0x2ca389+=0x1){let _0x2a36af=_0x14de47[_0x2ca389];for(var _0x5e8e39=0x0;_0x5e8e39<_0x2a36af[_0xe651('0x62')][_0xe651('0x37')];_0x5e8e39+=0x1){let _0x408edf=_0x2a36af[_0xe651('0x62')][_0x5e8e39];var _0x259141=_0x2c04ba[_0xe651('0x73')]();_0x259141['where']('ut.UserId\x20=\x20?',_0x408edf['id']);_0x861004[_0xe651('0x74')](db[_0xe651('0x67')][_0xe651('0x32')](_0x259141[_0xe651('0x75')](),{'type':db[_0xe651('0x67')][_0xe651('0x76')][_0xe651('0x77')]})[_0xe651('0x25')](function(_0x2e0f53){if(_0x2e0f53[_0xe651('0x37')]===0x1){return _0x408edf['id'];}else{var _0x4ecd34=_[_0xe651('0x78')](_[_0xe651('0x2e')](_0x2e0f53,_0xe651('0x79')),function(_0x175f56){return _[_0xe651('0x7a')](_0x1f8cb5,_0x175f56);});if(_0x4ecd34){return _0x408edf['id'];}}}));}}return BPromise[_0xe651('0x7b')](_0x861004)[_0xe651('0x25')](function(_0x49b445){_0x453fa1=_(_0x453fa1)[_0xe651('0x7c')](_0x49b445)[_0xe651('0x7d')]()['value']();return db[_0xe651('0x41')][_0xe651('0x49')]({'where':{'id':_0x4cd709['params']['id']}})[_0xe651('0x25')](function(_0x4c98bd){return db[_0xe651('0x67')][_0xe651('0x68')](function(_0x3f0b37){return _0x4c98bd[_0xe651('0x7e')](_0x4cd709[_0xe651('0x32')][_0xe651('0x61')],{'transaction':_0x3f0b37})[_0xe651('0x25')](function(){if(!_['isEmpty'](_0x453fa1)){return _0x4c98bd['removeAgents'](_0x453fa1,{'transaction':_0x3f0b37});}})[_0xe651('0x25')](function(){_0x453fa1['forEach'](function(_0x3288ba){socket['emit'](_0xe651('0x7f'),{'UserId':_0x3288ba,'FaxQueueId':_0x4c98bd['id']});});});});});});})[_0xe651('0x25')](respondWithStatusCode(_0x38bebf,null))[_0xe651('0x45')](handleError(_0x38bebf,null));};exports['addAgents']=function(_0x2680b3,_0xff59d1,_0x1bf7ab){return db[_0xe651('0x41')][_0xe651('0x49')]({'where':{'id':_0x2680b3[_0xe651('0x53')]['id']}})[_0xe651('0x25')](handleEntityNotFound(_0xff59d1,null))['then'](function(_0x452c5d){if(_0x452c5d){return _0x452c5d['addAgents'](_0x2680b3[_0xe651('0x4b')][_0xe651('0x61')],_[_0xe651('0x80')](_0x2680b3[_0xe651('0x4b')],['ids','id'])||{})[_0xe651('0x81')](function(_0x4b8234){for(var _0x19f93e=0x0;_0x19f93e<_0x2680b3[_0xe651('0x4b')]['ids'][_0xe651('0x37')];_0x19f93e+=0x1){socket[_0xe651('0x82')]('userFaxQueue:save',{'UserId':Number(_0x2680b3[_0xe651('0x4b')]['ids'][_0x19f93e]),'FaxQueueId':Number(_0x2680b3['params']['id'])});}return _0x4b8234;});}})[_0xe651('0x25')](respondWithResult(_0xff59d1,null))[_0xe651('0x45')](handleError(_0xff59d1,null));};exports['removeAgents']=function(_0x1b98ee,_0x9782dd,_0x2fb017){return db[_0xe651('0x41')][_0xe651('0x49')]({'where':{'id':_0x1b98ee['params']['id']}})[_0xe651('0x25')](handleEntityNotFound(_0x9782dd,null))[_0xe651('0x25')](function(_0xd845d){if(_0xd845d){return _0xd845d[_0xe651('0x83')](_0x1b98ee[_0xe651('0x32')][_0xe651('0x61')])[_0xe651('0x25')](function(){if(_['isArray'](_0x1b98ee[_0xe651('0x32')][_0xe651('0x61')])){for(var _0x26bc41=0x0;_0x26bc41<_0x1b98ee[_0xe651('0x32')][_0xe651('0x61')][_0xe651('0x37')];_0x26bc41+=0x1){socket['emit'](_0xe651('0x7f'),{'UserId':Number(_0x1b98ee[_0xe651('0x32')]['ids'][_0x26bc41]),'FaxQueueId':Number(_0x1b98ee[_0xe651('0x53')]['id'])});}}else{socket[_0xe651('0x82')](_0xe651('0x7f'),{'UserId':Number(_0x1b98ee['query']['ids']),'FaxQueueId':Number(_0x1b98ee[_0xe651('0x53')]['id'])});}});}})[_0xe651('0x25')](respondWithStatusCode(_0x9782dd,null))[_0xe651('0x45')](handleError(_0x9782dd,null));};exports[_0xe651('0x84')]=function(_0x217b79,_0x2ba02a,_0x5c5b1a){var _0x552602={};var _0x59587e={};var _0x3810e5;var _0x5d8d82;return db['FaxQueue'][_0xe651('0x85')]({'where':{'id':_0x217b79[_0xe651('0x53')]['id']}})['then'](handleEntityNotFound(_0x2ba02a,null))['then'](function(_0x29046d){if(_0x29046d){_0x3810e5=_0x29046d;_0x59587e[_0xe651('0x31')]=_[_0xe651('0x47')](db[_0xe651('0x6c')][_0xe651('0x48')]);_0x59587e[_0xe651('0x32')]=_[_0xe651('0x47')](_0x217b79[_0xe651('0x32')]);_0x59587e[_0xe651('0x33')]=_[_0xe651('0x34')](_0x59587e[_0xe651('0x31')],_0x59587e[_0xe651('0x32')]);_0x552602['attributes']=_[_0xe651('0x34')](_0x59587e[_0xe651('0x31')],qs[_0xe651('0x36')](_0x217b79[_0xe651('0x32')][_0xe651('0x36')]));_0x552602[_0xe651('0x35')]=_0x552602[_0xe651('0x35')]['length']?_0x552602[_0xe651('0x35')]:_0x59587e[_0xe651('0x31')];_0x552602[_0xe651('0x39')]=qs[_0xe651('0x3a')](_0x217b79[_0xe651('0x32')][_0xe651('0x3a')]);_0x552602[_0xe651('0x3b')]=qs[_0xe651('0x33')](_['pick'](_0x217b79[_0xe651('0x32')],_0x59587e[_0xe651('0x33')]));if(_0x217b79['query'][_0xe651('0x3d')]){_0x552602[_0xe651('0x3b')]=_[_0xe651('0x3e')](_0x552602[_0xe651('0x3b')],{'$or':_[_0xe651('0x2e')](_0x552602['attributes'],function(_0x5e0d7c){var _0x523c64={};_0x523c64[_0x5e0d7c]={'$like':'%'+_0x217b79[_0xe651('0x32')][_0xe651('0x3d')]+'%'};return _0x523c64;})});}_0x552602=_['merge']({},_0x552602,_0x217b79[_0xe651('0x40')]);return _0x3810e5[_0xe651('0x84')](_0x552602);}})[_0xe651('0x25')](function(_0x1cd2d7){if(_0x1cd2d7){_0x5d8d82=_0x1cd2d7[_0xe651('0x37')];if(!_0x217b79[_0xe651('0x32')]['hasOwnProperty']('nolimit')){_0x552602[_0xe651('0x1e')]=qs[_0xe651('0x1e')](_0x217b79['query'][_0xe651('0x1e')]);_0x552602[_0xe651('0x1c')]=qs['offset'](_0x217b79[_0xe651('0x32')][_0xe651('0x1c')]);}return _0x3810e5[_0xe651('0x84')](_0x552602);}})[_0xe651('0x25')](function(_0x1cdf98){if(_0x1cdf98){return _0x1cdf98?{'count':_0x5d8d82,'rows':_0x1cdf98}:null;}})[_0xe651('0x25')](respondWithResult(_0x2ba02a,null))[_0xe651('0x45')](handleError(_0x2ba02a,null));}; \ No newline at end of file +var _0x079f=['count','limit','set','Content-Range','json','apply','reject','save','update','then','get','FaxQueues','UserProfileResource','stack','name','index','FaxQueue','fieldName','map','query','keys','filters','attributes','intersection','model','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','error','find','describe','getMembers','nolimit','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','rows','%s/%s','getTeams','findOne','Team','ids','Agents','online','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','addAgents','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','offset','undefined'];(function(_0x19118e,_0x148a16){var _0x5a0c20=function(_0x57f03a){while(--_0x57f03a){_0x19118e['push'](_0x19118e['shift']());}};_0x5a0c20(++_0x148a16);}(_0x079f,0xef));var _0xf079=function(_0x50f6e5,_0x151ccb){_0x50f6e5=_0x50f6e5-0x0;var _0x5988c5=_0x079f[_0x50f6e5];return _0x5988c5;};'use strict';var emlformat=require(_0xf079('0x0'));var rimraf=require(_0xf079('0x1'));var zipdir=require(_0xf079('0x2'));var jsonpatch=require(_0xf079('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf079('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf079('0x5'));var csv=require(_0xf079('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf079('0x7'));var _=require('lodash');var squel=require(_0xf079('0x8'));var crypto=require(_0xf079('0x9'));var jsforce=require(_0xf079('0xa'));var deskjs=require(_0xf079('0xb'));var toCsv=require(_0xf079('0x6'));var querystring=require(_0xf079('0xc'));var Papa=require(_0xf079('0xd'));var Redis=require(_0xf079('0xe'));var authService=require(_0xf079('0xf'));var qs=require(_0xf079('0x10'));var as=require(_0xf079('0x11'));var hardwareService=require(_0xf079('0x12'));var logger=require(_0xf079('0x13'))(_0xf079('0x14'));var utils=require(_0xf079('0x15'));var config=require(_0xf079('0x16'));var licenseUtil=require(_0xf079('0x17'));var db=require(_0xf079('0x18'))['db'];config[_0xf079('0x19')]=_[_0xf079('0x1a')](config['redis'],{'host':_0xf079('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf079('0x19')]));require(_0xf079('0x1c'))[_0xf079('0x1d')](socket);function respondWithStatusCode(_0x32cd1d,_0x1fe4ef){_0x1fe4ef=_0x1fe4ef||0xcc;return function(_0x2d3779){if(_0x2d3779){return _0x32cd1d[_0xf079('0x1e')](_0x1fe4ef);}return _0x32cd1d[_0xf079('0x1f')](_0x1fe4ef)[_0xf079('0x20')]();};}function respondWithResult(_0x4468e7,_0x15b724){_0x15b724=_0x15b724||0xc8;return function(_0xe30f42){if(_0xe30f42){return _0x4468e7[_0xf079('0x1f')](_0x15b724)['json'](_0xe30f42);}};}function respondWithFilteredResult(_0x354d0a,_0x1265a0){return function(_0x43cb0c){if(_0x43cb0c){var _0x1b85de=typeof _0x1265a0[_0xf079('0x21')]===_0xf079('0x22')&&typeof _0x1265a0['limit']===_0xf079('0x22');var _0x22117a=_0x43cb0c[_0xf079('0x23')];var _0x3b4176=_0x1b85de?0x0:_0x1265a0[_0xf079('0x21')];var _0x3d778e=_0x1b85de?_0x43cb0c[_0xf079('0x23')]:_0x1265a0[_0xf079('0x21')]+_0x1265a0[_0xf079('0x24')];var _0x5d3d10;if(_0x3d778e>=_0x22117a){_0x3d778e=_0x22117a;_0x5d3d10=0xc8;}else{_0x5d3d10=0xce;}_0x354d0a[_0xf079('0x1f')](_0x5d3d10);return _0x354d0a[_0xf079('0x25')](_0xf079('0x26'),_0x3b4176+'-'+_0x3d778e+'/'+_0x22117a)[_0xf079('0x27')](_0x43cb0c);}return null;};}function patchUpdates(_0x28324a){return function(_0x4a38a7){try{jsonpatch[_0xf079('0x28')](_0x4a38a7,_0x28324a,!![]);}catch(_0x4e7c74){return BPromise[_0xf079('0x29')](_0x4e7c74);}return _0x4a38a7[_0xf079('0x2a')]();};}function saveUpdates(_0x6ca7cb,_0x2ad4bd){return function(_0x5c0d85){if(_0x5c0d85){return _0x5c0d85[_0xf079('0x2b')](_0x6ca7cb)['then'](function(_0x1d6274){return _0x1d6274;});}return null;};}function removeEntity(_0x832561,_0x14c432){return function(_0x2b5d9e){if(_0x2b5d9e){return _0x2b5d9e['destroy']()[_0xf079('0x2c')](function(){var _0x15b5e5=_0x2b5d9e[_0xf079('0x2d')]({'plain':!![]});var _0x3de0e4=_0xf079('0x2e');return db[_0xf079('0x2f')]['destroy']({'where':{'type':_0x3de0e4,'resourceId':_0x15b5e5['id']}})[_0xf079('0x2c')](function(){return _0x2b5d9e;});})[_0xf079('0x2c')](function(){_0x832561[_0xf079('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dc5b8,_0xe18534){return function(_0x15f7f3){if(!_0x15f7f3){_0x2dc5b8[_0xf079('0x1e')](0x194);}return _0x15f7f3;};}function handleError(_0xf7b18d,_0x4766b4){_0x4766b4=_0x4766b4||0x1f4;return function(_0x448377){logger['error'](_0x448377[_0xf079('0x30')]);if(_0x448377['name']){delete _0x448377[_0xf079('0x31')];}_0xf7b18d[_0xf079('0x1f')](_0x4766b4)['send'](_0x448377);};}exports[_0xf079('0x32')]=function(_0x1136c6,_0x1f8b9f){var _0x17d707={},_0x2d262a={},_0x26eeeb={'count':0x0,'rows':[]};var _0x2d2b58=_['map'](db[_0xf079('0x33')]['rawAttributes'],function(_0x14d2cf){return{'name':_0x14d2cf[_0xf079('0x34')],'type':_0x14d2cf['type']['key']};});_0x2d262a['model']=_[_0xf079('0x35')](_0x2d2b58,_0xf079('0x31'));_0x2d262a[_0xf079('0x36')]=_[_0xf079('0x37')](_0x1136c6[_0xf079('0x36')]);_0x2d262a[_0xf079('0x38')]=_['intersection'](_0x2d262a['model'],_0x2d262a[_0xf079('0x36')]);_0x17d707[_0xf079('0x39')]=_[_0xf079('0x3a')](_0x2d262a[_0xf079('0x3b')],qs[_0xf079('0x3c')](_0x1136c6[_0xf079('0x36')][_0xf079('0x3c')]));_0x17d707[_0xf079('0x39')]=_0x17d707['attributes'][_0xf079('0x3d')]?_0x17d707['attributes']:_0x2d262a[_0xf079('0x3b')];if(!_0x1136c6[_0xf079('0x36')]['hasOwnProperty']('nolimit')){_0x17d707[_0xf079('0x24')]=qs['limit'](_0x1136c6[_0xf079('0x36')]['limit']);_0x17d707[_0xf079('0x21')]=qs['offset'](_0x1136c6[_0xf079('0x36')]['offset']);}_0x17d707[_0xf079('0x3e')]=qs[_0xf079('0x3f')](_0x1136c6[_0xf079('0x36')][_0xf079('0x3f')]);_0x17d707[_0xf079('0x40')]=qs['filters'](_[_0xf079('0x41')](_0x1136c6[_0xf079('0x36')],_0x2d262a[_0xf079('0x38')]),_0x2d2b58);if(_0x1136c6[_0xf079('0x36')][_0xf079('0x42')]){_0x17d707[_0xf079('0x40')]=_[_0xf079('0x43')](_0x17d707[_0xf079('0x40')],{'$or':_[_0xf079('0x35')](_0x2d2b58,function(_0x4665f4){if(_0x4665f4['type']!==_0xf079('0x44')){var _0x4df9bf={};_0x4df9bf[_0x4665f4[_0xf079('0x31')]]={'$like':'%'+_0x1136c6[_0xf079('0x36')][_0xf079('0x42')]+'%'};return _0x4df9bf;}})});}_0x17d707=_[_0xf079('0x43')]({},_0x17d707,_0x1136c6['options']);var _0x564b69={'where':_0x17d707[_0xf079('0x40')]};return db['FaxQueue'][_0xf079('0x23')](_0x564b69)[_0xf079('0x2c')](function(_0x95b007){_0x26eeeb[_0xf079('0x23')]=_0x95b007;if(_0x1136c6[_0xf079('0x36')][_0xf079('0x45')]){_0x17d707['include']=[{'all':!![]}];}return db['FaxQueue'][_0xf079('0x46')](_0x17d707);})[_0xf079('0x2c')](function(_0x5eca06){_0x26eeeb['rows']=_0x5eca06;return _0x26eeeb;})[_0xf079('0x2c')](respondWithFilteredResult(_0x1f8b9f,_0x17d707))[_0xf079('0x47')](handleError(_0x1f8b9f,null));};exports[_0xf079('0x48')]=function(_0x3c8d57,_0x547438){var _0x123e99={'raw':!![],'where':{'id':_0x3c8d57[_0xf079('0x49')]['id']}},_0x11a91f={};_0x11a91f['model']=_[_0xf079('0x37')](db[_0xf079('0x33')][_0xf079('0x4a')]);_0x11a91f['query']=_[_0xf079('0x37')](_0x3c8d57['query']);_0x11a91f[_0xf079('0x38')]=_[_0xf079('0x3a')](_0x11a91f['model'],_0x11a91f[_0xf079('0x36')]);_0x123e99[_0xf079('0x39')]=_[_0xf079('0x3a')](_0x11a91f[_0xf079('0x3b')],qs[_0xf079('0x3c')](_0x3c8d57[_0xf079('0x36')][_0xf079('0x3c')]));_0x123e99[_0xf079('0x39')]=_0x123e99['attributes'][_0xf079('0x3d')]?_0x123e99[_0xf079('0x39')]:_0x11a91f['model'];if(_0x3c8d57[_0xf079('0x36')]['includeAll']){_0x123e99['include']=[{'all':!![]}];}_0x123e99=_[_0xf079('0x43')]({},_0x123e99,_0x3c8d57[_0xf079('0x4b')]);return db[_0xf079('0x33')]['find'](_0x123e99)[_0xf079('0x2c')](handleEntityNotFound(_0x547438,null))[_0xf079('0x2c')](respondWithResult(_0x547438,null))[_0xf079('0x47')](handleError(_0x547438,null));};exports[_0xf079('0x4c')]=function(_0x1376cc,_0x4393ff){return db[_0xf079('0x33')]['create'](_0x1376cc[_0xf079('0x4d')],{})[_0xf079('0x2c')](function(_0x49377b){var _0x3fe076=_0x1376cc['user'][_0xf079('0x2d')]({'plain':!![]});if(!_0x3fe076)throw new Error(_0xf079('0x4e'));if(_0x3fe076[_0xf079('0x4f')]===_0xf079('0x50')){var _0x3fe381=_0x49377b[_0xf079('0x2d')]({'plain':!![]});var _0x341de9=_0xf079('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x341de9,'userProfileId':_0x3fe076['userProfileId']},'raw':!![]})[_0xf079('0x2c')](function(_0x47bfa3){if(_0x47bfa3&&_0x47bfa3[_0xf079('0x51')]===0x0){return db[_0xf079('0x2f')][_0xf079('0x4c')]({'name':_0x3fe381['name'],'resourceId':_0x3fe381['id'],'type':_0x47bfa3[_0xf079('0x31')],'sectionId':_0x47bfa3['id']},{})[_0xf079('0x2c')](function(){return _0x49377b;});}else{return _0x49377b;}})[_0xf079('0x47')](function(_0x12b813){logger[_0xf079('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12b813);throw _0x12b813;});}return _0x49377b;})[_0xf079('0x2c')](respondWithResult(_0x4393ff,0xc9))[_0xf079('0x47')](handleError(_0x4393ff,null));};exports['update']=function(_0x23e916,_0xd6bc4f){if(_0x23e916['body']['id']){delete _0x23e916[_0xf079('0x4d')]['id'];}return db[_0xf079('0x33')][_0xf079('0x53')]({'where':{'id':_0x23e916[_0xf079('0x49')]['id']}})[_0xf079('0x2c')](handleEntityNotFound(_0xd6bc4f,null))[_0xf079('0x2c')](saveUpdates(_0x23e916[_0xf079('0x4d')],null))['then'](respondWithResult(_0xd6bc4f,null))[_0xf079('0x47')](handleError(_0xd6bc4f,null));};exports['destroy']=function(_0x432c0b,_0x343ac9){return db[_0xf079('0x33')][_0xf079('0x53')]({'where':{'id':_0x432c0b[_0xf079('0x49')]['id']}})[_0xf079('0x2c')](handleEntityNotFound(_0x343ac9,null))[_0xf079('0x2c')](removeEntity(_0x343ac9,null))[_0xf079('0x47')](handleError(_0x343ac9,null));};exports[_0xf079('0x54')]=function(_0x4b831a,_0x14b6a5){return db['FaxQueue'][_0xf079('0x54')]()[_0xf079('0x2c')](respondWithResult(_0x14b6a5,null))[_0xf079('0x47')](handleError(_0x14b6a5,null));};exports[_0xf079('0x55')]=function(_0x3b2a40,_0x2d47d9,_0x2891ee){var _0x2c5fb9={'raw':!![],'where':{}},_0x9681b7={},_0x168a97;return db[_0xf079('0x33')]['findOne']({'where':{'id':_0x3b2a40[_0xf079('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d47d9,null))[_0xf079('0x2c')](function(_0x24105d){if(_0x24105d){_0x168a97=_0x24105d[_0xf079('0x2d')]({'plain':!![]});_0x9681b7[_0xf079('0x3b')]=_[_0xf079('0x37')](db['UserFaxQueue'][_0xf079('0x4a')]);_0x9681b7[_0xf079('0x36')]=_[_0xf079('0x37')](_0x3b2a40['query']);_0x9681b7[_0xf079('0x38')]=_['intersection'](_0x9681b7['model'],_0x9681b7['query']);_0x2c5fb9['attributes']=_[_0xf079('0x3a')](_0x9681b7[_0xf079('0x3b')],qs[_0xf079('0x3c')](_0x3b2a40[_0xf079('0x36')]['fields']));_0x2c5fb9['attributes']=_0x2c5fb9[_0xf079('0x39')]['length']?_0x2c5fb9[_0xf079('0x39')]:_0x9681b7[_0xf079('0x3b')];if(!_0x3b2a40[_0xf079('0x36')]['hasOwnProperty'](_0xf079('0x56'))){_0x2c5fb9[_0xf079('0x24')]=qs[_0xf079('0x24')](_0x3b2a40[_0xf079('0x36')][_0xf079('0x24')]);_0x2c5fb9['offset']=qs['offset'](_0x3b2a40['query'][_0xf079('0x21')]);}_0x2c5fb9[_0xf079('0x3e')]=qs['sort'](_0x3b2a40[_0xf079('0x36')][_0xf079('0x3f')]);_0x2c5fb9[_0xf079('0x40')]=qs[_0xf079('0x38')](_[_0xf079('0x41')](_0x3b2a40[_0xf079('0x36')],_0x9681b7[_0xf079('0x38')]));_0x2c5fb9[_0xf079('0x40')][_0xf079('0x57')]=_0x24105d['id'];if(_0x3b2a40[_0xf079('0x36')][_0xf079('0x42')]){_0x2c5fb9[_0xf079('0x40')]=_['merge'](_0x2c5fb9[_0xf079('0x40')],{'$or':_[_0xf079('0x35')](_0x2c5fb9['attributes'],function(_0x49a42a){var _0x5157db={};_0x5157db[_0x49a42a]={'$like':'%'+_0x3b2a40['query'][_0xf079('0x42')]+'%'};return _0x5157db;})});}_0x2c5fb9=_[_0xf079('0x43')]({},_0x2c5fb9,_0x3b2a40[_0xf079('0x4b')]);return db[_0xf079('0x58')][_0xf079('0x46')](_0x2c5fb9);}})[_0xf079('0x2c')](function(_0x372431){if(_0x372431){return db[_0xf079('0x59')][_0xf079('0x5a')]({'where':{'id':_[_0xf079('0x35')](_0x372431,_0xf079('0x5b')),'role':'agent'},'attributes':['id',_0xf079('0x31'),_0xf079('0x5c'),_0xf079('0x5d'),_0xf079('0x5e')]});}})[_0xf079('0x2c')](function(_0x5370db){if(_0x5370db){return{'count':_0x5370db[_0xf079('0x23')],'rows':_[_0xf079('0x35')](_0x5370db[_0xf079('0x5f')],function(_0x453021){return{'membername':_0x453021[_0xf079('0x31')],'UserId':_0x453021['id'],'queue_name':_0x168a97[_0xf079('0x31')],'FaxQueueId':_0x168a97['id'],'interface':util['format'](_0xf079('0x60'),'SIP',_0x453021[_0xf079('0x31')]),'penalty':0x0,'paused':_0x453021[_0xf079('0x5c')],'createdAt':_0x453021[_0xf079('0x5e')],'updatedAt':_0x453021[_0xf079('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf079('0x2c')](respondWithFilteredResult(_0x2d47d9,_0x2c5fb9))['catch'](handleError(_0x2d47d9,null));};exports[_0xf079('0x61')]=function(_0x59caf3,_0x2598e5,_0x4467f8){var _0x4935f5={};var _0x487a17={};var _0x506f3d;var _0xd659f7;return db[_0xf079('0x33')][_0xf079('0x62')]({'where':{'id':_0x59caf3['params']['id']}})[_0xf079('0x2c')](handleEntityNotFound(_0x2598e5,null))[_0xf079('0x2c')](function(_0x775f2){if(_0x775f2){_0x506f3d=_0x775f2;_0x487a17[_0xf079('0x3b')]=_[_0xf079('0x37')](db[_0xf079('0x63')][_0xf079('0x4a')]);_0x487a17['query']=_[_0xf079('0x37')](_0x59caf3[_0xf079('0x36')]);_0x487a17['filters']=_[_0xf079('0x3a')](_0x487a17[_0xf079('0x3b')],_0x487a17[_0xf079('0x36')]);_0x4935f5[_0xf079('0x39')]=_[_0xf079('0x3a')](_0x487a17[_0xf079('0x3b')],qs[_0xf079('0x3c')](_0x59caf3[_0xf079('0x36')][_0xf079('0x3c')]));_0x4935f5[_0xf079('0x39')]=_0x4935f5['attributes'][_0xf079('0x3d')]?_0x4935f5[_0xf079('0x39')]:_0x487a17['model'];_0x4935f5[_0xf079('0x3e')]=qs[_0xf079('0x3f')](_0x59caf3[_0xf079('0x36')]['sort']);_0x4935f5[_0xf079('0x40')]=qs[_0xf079('0x38')](_[_0xf079('0x41')](_0x59caf3['query'],_0x487a17[_0xf079('0x38')]));if(_0x59caf3[_0xf079('0x36')][_0xf079('0x42')]){_0x4935f5['where']=_[_0xf079('0x43')](_0x4935f5[_0xf079('0x40')],{'$or':_[_0xf079('0x35')](_0x4935f5[_0xf079('0x39')],function(_0x59a7fa){var _0x2cfca4={};_0x2cfca4[_0x59a7fa]={'$like':'%'+_0x59caf3['query'][_0xf079('0x42')]+'%'};return _0x2cfca4;})});}_0x4935f5=_[_0xf079('0x43')]({},_0x4935f5,_0x59caf3[_0xf079('0x4b')]);return _0x506f3d[_0xf079('0x61')](_0x4935f5);}})[_0xf079('0x2c')](function(_0x317709){if(_0x317709){_0xd659f7=_0x317709['length'];if(!_0x59caf3[_0xf079('0x36')]['hasOwnProperty'](_0xf079('0x56'))){_0x4935f5[_0xf079('0x24')]=qs[_0xf079('0x24')](_0x59caf3[_0xf079('0x36')]['limit']);_0x4935f5[_0xf079('0x21')]=qs[_0xf079('0x21')](_0x59caf3[_0xf079('0x36')][_0xf079('0x21')]);}return _0x506f3d[_0xf079('0x61')](_0x4935f5);}})[_0xf079('0x2c')](function(_0x23bcdd){if(_0x23bcdd){return _0x23bcdd?{'count':_0xd659f7,'rows':_0x23bcdd}:null;}})['then'](respondWithResult(_0x2598e5,null))[_0xf079('0x47')](handleError(_0x2598e5,null));};exports['addTeams']=function(_0x317368,_0x742400,_0x8a7ae0){var _0x23ec1b=_0x317368['body'][_0xf079('0x64')];return db[_0xf079('0x63')][_0xf079('0x46')]({'where':{'id':_0x23ec1b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf079('0x65'),'attributes':['id',_0xf079('0x31'),_0xf079('0x66'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1a7c76){if(_0x1a7c76){var _0x5d8419=_[_0xf079('0x67')](_0x1a7c76,function(_0x7e2f8b){var _0x5ba611=_0x7e2f8b[_0xf079('0x2d')]({'plain':!![]});return _0x5ba611[_0xf079('0x65')];});return db[_0xf079('0x33')]['find']({'where':{'id':_0x317368[_0xf079('0x49')]['id']}})['then'](function(_0x1c8333){return db[_0xf079('0x68')][_0xf079('0x69')](function(_0xfd9ba7){return _0x1c8333[_0xf079('0x6a')](_0x23ec1b,{'transaction':_0xfd9ba7})['then'](function(){return BPromise['each'](_0x5d8419,function(_0x384542){return db[_0xf079('0x58')][_0xf079('0x6b')]({'where':{'UserId':_0x384542['id'],'FaxQueueId':_0x317368[_0xf079('0x49')]['id']},'transaction':_0xfd9ba7});});})[_0xf079('0x2c')](function(){_0x5d8419[_0xf079('0x6c')](function(_0x311de3){socket[_0xf079('0x6d')](_0xf079('0x6e'),{'UserId':_0x311de3['id'],'FaxQueueId':_0x1c8333['id']});});});});});}})[_0xf079('0x2c')](respondWithStatusCode(_0x742400,null))['catch'](handleError(_0x742400,null));};exports[_0xf079('0x6f')]=function(_0x442583,_0x5d27ed,_0x1cf79d){return db[_0xf079('0x63')]['findAll']({'where':{'id':_0x442583[_0xf079('0x36')][_0xf079('0x64')]},'attributes':['id'],'include':[{'model':db[_0xf079('0x59')],'as':_0xf079('0x65'),'attributes':['id'],'raw':!![]}]})[_0xf079('0x2c')](handleEntityNotFound(_0x5d27ed,null))[_0xf079('0x2c')](function(_0x19355e){var _0x108941=_['map'](_0x19355e,'id');var _0x28c742=[];var _0x3bb077=[];var _0x1f0100=squel[_0xf079('0x70')]();_0x1f0100[_0xf079('0x71')](_0xf079('0x72'))['from'](_0xf079('0x73'),'tq')[_0xf079('0x74')]('user_has_teams','ut',_0xf079('0x75'))[_0xf079('0x40')](_0xf079('0x76'),_0x442583[_0xf079('0x49')]['id']);for(var _0xb616c3=0x0;_0xb616c3<_0x19355e[_0xf079('0x3d')];_0xb616c3+=0x1){let _0x3a9db9=_0x19355e[_0xb616c3];for(var _0x1e1e73=0x0;_0x1e1e73<_0x3a9db9['Agents']['length'];_0x1e1e73+=0x1){let _0x33c0f2=_0x3a9db9['Agents'][_0x1e1e73];var _0x3fd22d=_0x1f0100['clone']();_0x3fd22d[_0xf079('0x40')](_0xf079('0x77'),_0x33c0f2['id']);_0x3bb077['push'](db[_0xf079('0x68')][_0xf079('0x36')](_0x3fd22d[_0xf079('0x78')](),{'type':db[_0xf079('0x68')][_0xf079('0x79')][_0xf079('0x7a')]})[_0xf079('0x2c')](function(_0x5b7b73){if(_0x5b7b73[_0xf079('0x3d')]===0x1){return _0x33c0f2['id'];}else{var _0x36aaea=_[_0xf079('0x7b')](_[_0xf079('0x35')](_0x5b7b73,_0xf079('0x7c')),function(_0x3d2fa6){return _[_0xf079('0x7d')](_0x108941,_0x3d2fa6);});if(_0x36aaea){return _0x33c0f2['id'];}}}));}}return BPromise['all'](_0x3bb077)['then'](function(_0x4151ad){_0x28c742=_(_0x28c742)[_0xf079('0x7e')](_0x4151ad)[_0xf079('0x7f')]()[_0xf079('0x80')]();return db['FaxQueue'][_0xf079('0x53')]({'where':{'id':_0x442583[_0xf079('0x49')]['id']}})[_0xf079('0x2c')](function(_0x2958f3){return db['sequelize'][_0xf079('0x69')](function(_0x290ef9){return _0x2958f3[_0xf079('0x6f')](_0x442583[_0xf079('0x36')]['ids'],{'transaction':_0x290ef9})['then'](function(){if(!_[_0xf079('0x81')](_0x28c742)){return _0x2958f3['removeAgents'](_0x28c742,{'transaction':_0x290ef9});}})[_0xf079('0x2c')](function(){_0x28c742['forEach'](function(_0x19b0af){socket['emit']('userFaxQueue:remove',{'UserId':_0x19b0af,'FaxQueueId':_0x2958f3['id']});});});});});});})[_0xf079('0x2c')](respondWithStatusCode(_0x5d27ed,null))['catch'](handleError(_0x5d27ed,null));};exports[_0xf079('0x82')]=function(_0x15375e,_0x23c776,_0x2ac4ec){return db['FaxQueue'][_0xf079('0x53')]({'where':{'id':_0x15375e[_0xf079('0x49')]['id']}})['then'](handleEntityNotFound(_0x23c776,null))[_0xf079('0x2c')](function(_0x3472ea){if(_0x3472ea){return _0x3472ea[_0xf079('0x82')](_0x15375e['body'][_0xf079('0x64')],_['omit'](_0x15375e['body'],[_0xf079('0x64'),'id'])||{})[_0xf079('0x83')](function(_0x121e8d){for(var _0x4c5c40=0x0;_0x4c5c40<_0x15375e[_0xf079('0x4d')]['ids']['length'];_0x4c5c40+=0x1){socket['emit'](_0xf079('0x6e'),{'UserId':Number(_0x15375e[_0xf079('0x4d')]['ids'][_0x4c5c40]),'FaxQueueId':Number(_0x15375e[_0xf079('0x49')]['id'])});}return _0x121e8d;});}})[_0xf079('0x2c')](respondWithResult(_0x23c776,null))[_0xf079('0x47')](handleError(_0x23c776,null));};exports[_0xf079('0x84')]=function(_0x203b71,_0x2081da,_0xc9f93){return db[_0xf079('0x33')][_0xf079('0x53')]({'where':{'id':_0x203b71[_0xf079('0x49')]['id']}})['then'](handleEntityNotFound(_0x2081da,null))[_0xf079('0x2c')](function(_0x88a8f4){if(_0x88a8f4){return _0x88a8f4[_0xf079('0x84')](_0x203b71[_0xf079('0x36')][_0xf079('0x64')])[_0xf079('0x2c')](function(){if(_[_0xf079('0x85')](_0x203b71[_0xf079('0x36')][_0xf079('0x64')])){for(var _0x140946=0x0;_0x140946<_0x203b71['query'][_0xf079('0x64')][_0xf079('0x3d')];_0x140946+=0x1){socket[_0xf079('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x203b71[_0xf079('0x36')]['ids'][_0x140946]),'FaxQueueId':Number(_0x203b71[_0xf079('0x49')]['id'])});}}else{socket['emit'](_0xf079('0x86'),{'UserId':Number(_0x203b71[_0xf079('0x36')][_0xf079('0x64')]),'FaxQueueId':Number(_0x203b71[_0xf079('0x49')]['id'])});}});}})[_0xf079('0x2c')](respondWithStatusCode(_0x2081da,null))[_0xf079('0x47')](handleError(_0x2081da,null));};exports[_0xf079('0x87')]=function(_0x45aedf,_0x96c62e,_0x539ac0){var _0x4b0502={};var _0x447c00={};var _0x63ed3f;var _0x520711;return db[_0xf079('0x33')]['findOne']({'where':{'id':_0x45aedf[_0xf079('0x49')]['id']}})['then'](handleEntityNotFound(_0x96c62e,null))[_0xf079('0x2c')](function(_0x266681){if(_0x266681){_0x63ed3f=_0x266681;_0x447c00[_0xf079('0x3b')]=_[_0xf079('0x37')](db['User']['rawAttributes']);_0x447c00[_0xf079('0x36')]=_[_0xf079('0x37')](_0x45aedf[_0xf079('0x36')]);_0x447c00[_0xf079('0x38')]=_['intersection'](_0x447c00[_0xf079('0x3b')],_0x447c00[_0xf079('0x36')]);_0x4b0502[_0xf079('0x39')]=_[_0xf079('0x3a')](_0x447c00[_0xf079('0x3b')],qs[_0xf079('0x3c')](_0x45aedf['query']['fields']));_0x4b0502[_0xf079('0x39')]=_0x4b0502[_0xf079('0x39')][_0xf079('0x3d')]?_0x4b0502[_0xf079('0x39')]:_0x447c00[_0xf079('0x3b')];_0x4b0502[_0xf079('0x3e')]=qs[_0xf079('0x3f')](_0x45aedf[_0xf079('0x36')]['sort']);_0x4b0502['where']=qs[_0xf079('0x38')](_[_0xf079('0x41')](_0x45aedf[_0xf079('0x36')],_0x447c00['filters']));if(_0x45aedf['query'][_0xf079('0x42')]){_0x4b0502['where']=_[_0xf079('0x43')](_0x4b0502[_0xf079('0x40')],{'$or':_[_0xf079('0x35')](_0x4b0502[_0xf079('0x39')],function(_0x12e477){var _0x38d9df={};_0x38d9df[_0x12e477]={'$like':'%'+_0x45aedf[_0xf079('0x36')][_0xf079('0x42')]+'%'};return _0x38d9df;})});}_0x4b0502=_[_0xf079('0x43')]({},_0x4b0502,_0x45aedf[_0xf079('0x4b')]);return _0x63ed3f['getAgents'](_0x4b0502);}})[_0xf079('0x2c')](function(_0x4d87f8){if(_0x4d87f8){_0x520711=_0x4d87f8['length'];if(!_0x45aedf['query'][_0xf079('0x88')](_0xf079('0x56'))){_0x4b0502[_0xf079('0x24')]=qs['limit'](_0x45aedf['query'][_0xf079('0x24')]);_0x4b0502[_0xf079('0x21')]=qs[_0xf079('0x21')](_0x45aedf[_0xf079('0x36')][_0xf079('0x21')]);}return _0x63ed3f[_0xf079('0x87')](_0x4b0502);}})[_0xf079('0x2c')](function(_0x4da63b){if(_0x4da63b){return _0x4da63b?{'count':_0x520711,'rows':_0x4da63b}:null;}})[_0xf079('0x2c')](respondWithResult(_0x96c62e,null))[_0xf079('0x47')](handleError(_0x96c62e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index c44d725..50e6109 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 _0x0e1f=['events','../../mysqldb','FaxQueue','update','emit','hasOwnProperty','hook','exports'];(function(_0x15ec35,_0x5b9972){var _0x937cce=function(_0x59326b){while(--_0x59326b){_0x15ec35['push'](_0x15ec35['shift']());}};_0x937cce(++_0x5b9972);}(_0x0e1f,0x108));var _0xf0e1=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0e1f[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0xf0e1('0x0'));var FaxQueue=require(_0xf0e1('0x1'))['db'][_0xf0e1('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf0e1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x145475){return function(_0x22ec86,_0x336840,_0xa0034c){FaxQueueEvents['emit'](_0x145475+':'+_0x22ec86['id'],_0x22ec86);FaxQueueEvents[_0xf0e1('0x4')](_0x145475,_0x22ec86);_0xa0034c(null);};}for(var e in events){if(events[_0xf0e1('0x5')](e)){var event=events[e];FaxQueue[_0xf0e1('0x6')](e,emitEvent(event));}}module[_0xf0e1('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x1e52=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update'];(function(_0x2dbeae,_0x331c62){var _0x1dd1ed=function(_0x25b628){while(--_0x25b628){_0x2dbeae['push'](_0x2dbeae['shift']());}};_0x1dd1ed(++_0x331c62);}(_0x1e52,0x118));var _0x21e5=function(_0x159969,_0x48b72a){_0x159969=_0x159969-0x0;var _0x21fb4b=_0x1e52[_0x159969];return _0x21fb4b;};'use strict';var EventEmitter=require(_0x21e5('0x0'));var FaxQueue=require(_0x21e5('0x1'))['db'][_0x21e5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x21e5('0x3')](0x0);var events={'afterCreate':_0x21e5('0x4'),'afterUpdate':_0x21e5('0x5'),'afterDestroy':_0x21e5('0x6')};function emitEvent(_0x3e327f){return function(_0x15a84e,_0x3cf833,_0x138570){FaxQueueEvents[_0x21e5('0x7')](_0x3e327f+':'+_0x15a84e['id'],_0x15a84e);FaxQueueEvents[_0x21e5('0x7')](_0x3e327f,_0x15a84e);_0x138570(null);};}for(var e in events){if(events[_0x21e5('0x8')](e)){var event=events[e];FaxQueue[_0x21e5('0x9')](e,emitEvent(event));}}module[_0x21e5('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 5a4a56a..e2e8cf9 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 _0xe6eb=['fax_queues','util','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x5d3788,_0x39fd95){var _0xc24869=function(_0x469e90){while(--_0x469e90){_0x5d3788['push'](_0x5d3788['shift']());}};_0xc24869(++_0x39fd95);}(_0xe6eb,0x1de));var _0xbe6e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe6eb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xbe6e('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbe6e('0x1'));var rp=require(_0xbe6e('0x2'));var fs=require('fs');var path=require(_0xbe6e('0x3'));var rimraf=require(_0xbe6e('0x4'));var config=require(_0xbe6e('0x5'));var attributes=require(_0xbe6e('0x6'));module[_0xbe6e('0x7')]=function(_0x232024,_0x406928){return _0x232024['define']('FaxQueue',attributes,{'tableName':_0xbe6e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fd8=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','lodash','util','api','moment','bluebird','request-promise'];(function(_0xbdc283,_0x5e0184){var _0x319b3d=function(_0x2456f6){while(--_0x2456f6){_0xbdc283['push'](_0xbdc283['shift']());}};_0x319b3d(++_0x5e0184);}(_0x4fd8,0x165));var _0x84fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fd8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x84fd('0x0'));var util=require(_0x84fd('0x1'));var logger=require('../../config/logger')(_0x84fd('0x2'));var moment=require(_0x84fd('0x3'));var BPromise=require(_0x84fd('0x4'));var rp=require(_0x84fd('0x5'));var fs=require('fs');var path=require(_0x84fd('0x6'));var rimraf=require(_0x84fd('0x7'));var config=require(_0x84fd('0x8'));var attributes=require(_0x84fd('0x9'));module[_0x84fd('0xa')]=function(_0x1d11bc,_0x375d10){return _0x1d11bc['define']('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 28d7061..d110794 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 _0x4720=['findAll','options','where','limit','map','include','attributes','then','ShowFaxQueue','FaxQueue','raw','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x4720,0x1c4));var _0x0472=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0x4720[_0x39157f];return _0x1ae4e2;};'use strict';var _=require(_0x0472('0x0'));var util=require(_0x0472('0x1'));var moment=require(_0x0472('0x2'));var BPromise=require('bluebird');var rs=require(_0x0472('0x3'));var fs=require('fs');var Redis=require(_0x0472('0x4'));var db=require(_0x0472('0x5'))['db'];var utils=require(_0x0472('0x6'));var logger=require(_0x0472('0x7'))(_0x0472('0x8'));var config=require(_0x0472('0x9'));var jayson=require(_0x0472('0xa'));var client=jayson[_0x0472('0xb')][_0x0472('0xc')]({'port':0x232a});config[_0x0472('0xd')]=_[_0x0472('0xe')](config[_0x0472('0xd')],{'host':_0x0472('0xf'),'port':0x18eb});var socket=require(_0x0472('0x10'))(new Redis(config[_0x0472('0xd')]));require(_0x0472('0x11'))[_0x0472('0x12')](socket);function respondWithRpcPromise(_0x196901,_0x465459,_0x46995e){return new BPromise(function(_0x3e280a,_0x5882af){return client[_0x0472('0x13')](_0x196901,_0x46995e)['then'](function(_0x59f344){logger['info'](_0x0472('0x14'),_0x465459,_0x0472('0x15'));logger[_0x0472('0x16')](_0x0472('0x17'),_0x465459,_0x0472('0x15'),JSON[_0x0472('0x18')](_0x59f344));if(_0x59f344[_0x0472('0x19')]){if(_0x59f344[_0x0472('0x19')][_0x0472('0x1a')]===0x1f4){logger[_0x0472('0x19')]('FaxQueue,\x20%s,\x20%s',_0x465459,_0x59f344[_0x0472('0x19')]['message']);return _0x5882af(_0x59f344[_0x0472('0x19')][_0x0472('0x1b')]);}logger[_0x0472('0x19')]('FaxQueue,\x20%s,\x20%s',_0x465459,_0x59f344[_0x0472('0x19')][_0x0472('0x1b')]);return _0x3e280a(_0x59f344['error'][_0x0472('0x1b')]);}else{logger[_0x0472('0x1c')]('FaxQueue,\x20%s,\x20%s',_0x465459,'request\x20sent');_0x3e280a(_0x59f344[_0x0472('0x1d')]['message']);}})[_0x0472('0x1e')](function(_0x3cc7c5){logger[_0x0472('0x19')]('FaxQueue,\x20%s,\x20%s',_0x465459,_0x3cc7c5);_0x5882af(_0x3cc7c5);});});}exports[_0x0472('0x1f')]=function(_0x454099){var _0x307ce7=this;return new Promise(function(_0x334918,_0x3a506e){return db['FaxQueue'][_0x0472('0x20')]({'raw':_0x454099[_0x0472('0x21')]?_0x454099[_0x0472('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x454099[_0x0472('0x21')]?_0x454099[_0x0472('0x21')][_0x0472('0x22')]||null:null,'attributes':_0x454099[_0x0472('0x21')]?_0x454099[_0x0472('0x21')]['attributes']||null:null,'limit':_0x454099[_0x0472('0x21')]?_0x454099['options'][_0x0472('0x23')]||null:null,'include':_0x454099[_0x0472('0x21')]?_0x454099[_0x0472('0x21')]['include']?_[_0x0472('0x24')](_0x454099[_0x0472('0x21')][_0x0472('0x25')],function(_0x35b6be){return{'model':db[_0x35b6be['model']],'as':_0x35b6be['as'],'attributes':_0x35b6be[_0x0472('0x26')],'include':_0x35b6be[_0x0472('0x25')]?_[_0x0472('0x24')](_0x35b6be[_0x0472('0x25')],function(_0x55f918){return{'model':db[_0x55f918['model']],'as':_0x55f918['as'],'attributes':_0x55f918[_0x0472('0x26')],'include':_0x55f918[_0x0472('0x25')]?_[_0x0472('0x24')](_0x55f918[_0x0472('0x25')],function(_0x4dcc3a){return{'model':db[_0x4dcc3a['model']],'as':_0x4dcc3a['as'],'attributes':_0x4dcc3a[_0x0472('0x26')]};}):[]};}):[]};}):[]:[]})[_0x0472('0x27')](function(_0x5304a8){logger[_0x0472('0x1c')](_0x0472('0x1f'),_0x454099);logger[_0x0472('0x16')]('GetFaxQueue',_0x454099,JSON[_0x0472('0x18')](_0x5304a8));_0x334918(_0x5304a8);})['catch'](function(_0x51ab4f){logger[_0x0472('0x19')]('GetFaxQueue',_0x51ab4f[_0x0472('0x1b')],_0x454099);_0x3a506e(_0x307ce7[_0x0472('0x19')](0x1f4,_0x51ab4f[_0x0472('0x1b')]));});});};exports[_0x0472('0x28')]=function(_0x5641d2){var _0x5152f4=this;return new Promise(function(_0x4a942e,_0x47ca4d){return db[_0x0472('0x29')]['find']({'raw':_0x5641d2['options']?_0x5641d2['options'][_0x0472('0x2a')]===undefined?!![]:![]:!![],'where':_0x5641d2['options']?_0x5641d2[_0x0472('0x21')][_0x0472('0x22')]||null:null,'attributes':_0x5641d2[_0x0472('0x21')]?_0x5641d2[_0x0472('0x21')][_0x0472('0x26')]||null:null,'include':_0x5641d2['options']?_0x5641d2[_0x0472('0x21')]['include']?_[_0x0472('0x24')](_0x5641d2[_0x0472('0x21')][_0x0472('0x25')],function(_0x5b8844){return{'model':db[_0x5b8844['model']],'as':_0x5b8844['as'],'attributes':_0x5b8844[_0x0472('0x26')],'include':_0x5b8844[_0x0472('0x25')]?_[_0x0472('0x24')](_0x5b8844['include'],function(_0x541e4d){return{'model':db[_0x541e4d[_0x0472('0x2b')]],'as':_0x541e4d['as'],'attributes':_0x541e4d['attributes'],'include':_0x541e4d[_0x0472('0x25')]?_['map'](_0x541e4d[_0x0472('0x25')],function(_0x510dc6){return{'model':db[_0x510dc6['model']],'as':_0x510dc6['as'],'attributes':_0x510dc6[_0x0472('0x26')]};}):[]};}):[]};}):[]:[]})[_0x0472('0x27')](function(_0x4b4310){logger['info']('ShowFaxQueue',_0x5641d2);logger[_0x0472('0x16')](_0x0472('0x28'),_0x5641d2,JSON[_0x0472('0x18')](_0x4b4310));_0x4a942e(_0x4b4310);})[_0x0472('0x1e')](function(_0x4aee0e){logger[_0x0472('0x19')](_0x0472('0x28'),_0x4aee0e['message'],_0x5641d2);_0x47ca4d(_0x5152f4[_0x0472('0x19')](0x1f4,_0x4aee0e['message']));});});}; \ No newline at end of file +var _0x2412=['debug','stringify','find','ShowFaxQueue','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','FaxQueue','options','where','attributes','limit','map','include','model','GetFaxQueue'];(function(_0x411fd8,_0x56f775){var _0x594859=function(_0x372def){while(--_0x372def){_0x411fd8['push'](_0x411fd8['shift']());}};_0x594859(++_0x56f775);}(_0x2412,0x1f2));var _0x2241=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2412[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2241('0x0'));var util=require('util');var moment=require(_0x2241('0x1'));var BPromise=require(_0x2241('0x2'));var rs=require(_0x2241('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2241('0x4'));var logger=require(_0x2241('0x5'))(_0x2241('0x6'));var config=require('../../config/environment');var jayson=require(_0x2241('0x7'));var client=jayson[_0x2241('0x8')][_0x2241('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2241('0xa')],{'host':_0x2241('0xb'),'port':0x18eb});var socket=require(_0x2241('0xc'))(new Redis(config[_0x2241('0xa')]));require(_0x2241('0xd'))[_0x2241('0xe')](socket);function respondWithRpcPromise(_0xcf8c3f,_0x4d0922,_0x4b21d7){return new BPromise(function(_0x23f294,_0x1c7470){return client[_0x2241('0xf')](_0xcf8c3f,_0x4b21d7)[_0x2241('0x10')](function(_0x4176ff){logger[_0x2241('0x11')]('FaxQueue,\x20%s,\x20%s',_0x4d0922,'request\x20sent');logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x4d0922,_0x2241('0x12'),JSON['stringify'](_0x4176ff));if(_0x4176ff[_0x2241('0x13')]){if(_0x4176ff[_0x2241('0x13')][_0x2241('0x14')]===0x1f4){logger[_0x2241('0x13')](_0x2241('0x15'),_0x4d0922,_0x4176ff[_0x2241('0x13')][_0x2241('0x16')]);return _0x1c7470(_0x4176ff[_0x2241('0x13')][_0x2241('0x16')]);}logger['error'](_0x2241('0x15'),_0x4d0922,_0x4176ff['error'][_0x2241('0x16')]);return _0x23f294(_0x4176ff[_0x2241('0x13')][_0x2241('0x16')]);}else{logger['info'](_0x2241('0x15'),_0x4d0922,_0x2241('0x12'));_0x23f294(_0x4176ff[_0x2241('0x17')][_0x2241('0x16')]);}})[_0x2241('0x18')](function(_0x5eef5d){logger[_0x2241('0x13')](_0x2241('0x15'),_0x4d0922,_0x5eef5d);_0x1c7470(_0x5eef5d);});});}exports['GetFaxQueue']=function(_0x439d87){var _0x29f592=this;return new Promise(function(_0x1a29f9,_0x363468){return db[_0x2241('0x19')]['findAll']({'raw':_0x439d87['options']?_0x439d87[_0x2241('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x439d87[_0x2241('0x1a')]?_0x439d87[_0x2241('0x1a')][_0x2241('0x1b')]||null:null,'attributes':_0x439d87['options']?_0x439d87[_0x2241('0x1a')][_0x2241('0x1c')]||null:null,'limit':_0x439d87[_0x2241('0x1a')]?_0x439d87['options'][_0x2241('0x1d')]||null:null,'include':_0x439d87[_0x2241('0x1a')]?_0x439d87['options']['include']?_[_0x2241('0x1e')](_0x439d87[_0x2241('0x1a')][_0x2241('0x1f')],function(_0x556941){return{'model':db[_0x556941['model']],'as':_0x556941['as'],'attributes':_0x556941[_0x2241('0x1c')],'include':_0x556941[_0x2241('0x1f')]?_[_0x2241('0x1e')](_0x556941[_0x2241('0x1f')],function(_0x5a1543){return{'model':db[_0x5a1543['model']],'as':_0x5a1543['as'],'attributes':_0x5a1543[_0x2241('0x1c')],'include':_0x5a1543['include']?_['map'](_0x5a1543['include'],function(_0x5dec68){return{'model':db[_0x5dec68[_0x2241('0x20')]],'as':_0x5dec68['as'],'attributes':_0x5dec68[_0x2241('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2241('0x10')](function(_0xf0c3c3){logger[_0x2241('0x11')](_0x2241('0x21'),_0x439d87);logger[_0x2241('0x22')]('GetFaxQueue',_0x439d87,JSON[_0x2241('0x23')](_0xf0c3c3));_0x1a29f9(_0xf0c3c3);})[_0x2241('0x18')](function(_0xcda0af){logger['error']('GetFaxQueue',_0xcda0af[_0x2241('0x16')],_0x439d87);_0x363468(_0x29f592[_0x2241('0x13')](0x1f4,_0xcda0af[_0x2241('0x16')]));});});};exports['ShowFaxQueue']=function(_0x5e7d1f){var _0x49b701=this;return new Promise(function(_0x5ec868,_0x5c9a9a){return db[_0x2241('0x19')][_0x2241('0x24')]({'raw':_0x5e7d1f['options']?_0x5e7d1f['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e7d1f['options']?_0x5e7d1f[_0x2241('0x1a')][_0x2241('0x1b')]||null:null,'attributes':_0x5e7d1f[_0x2241('0x1a')]?_0x5e7d1f[_0x2241('0x1a')][_0x2241('0x1c')]||null:null,'include':_0x5e7d1f[_0x2241('0x1a')]?_0x5e7d1f[_0x2241('0x1a')][_0x2241('0x1f')]?_[_0x2241('0x1e')](_0x5e7d1f['options']['include'],function(_0x470110){return{'model':db[_0x470110['model']],'as':_0x470110['as'],'attributes':_0x470110[_0x2241('0x1c')],'include':_0x470110[_0x2241('0x1f')]?_[_0x2241('0x1e')](_0x470110[_0x2241('0x1f')],function(_0xc49a44){return{'model':db[_0xc49a44[_0x2241('0x20')]],'as':_0xc49a44['as'],'attributes':_0xc49a44[_0x2241('0x1c')],'include':_0xc49a44[_0x2241('0x1f')]?_[_0x2241('0x1e')](_0xc49a44[_0x2241('0x1f')],function(_0x83dc80){return{'model':db[_0x83dc80[_0x2241('0x20')]],'as':_0x83dc80['as'],'attributes':_0x83dc80[_0x2241('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2241('0x10')](function(_0x28806f){logger['info'](_0x2241('0x25'),_0x5e7d1f);logger[_0x2241('0x22')](_0x2241('0x25'),_0x5e7d1f,JSON[_0x2241('0x23')](_0x28806f));_0x5ec868(_0x28806f);})[_0x2241('0x18')](function(_0x78fa51){logger[_0x2241('0x13')](_0x2241('0x25'),_0x78fa51[_0x2241('0x16')],_0x5e7d1f);_0x5c9a9a(_0x49b701['error'](0x1f4,_0x78fa51[_0x2241('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 35b3a38..b19981a 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 _0xebda=['emit','removeListener','length','faxQueue:','save','remove','update'];(function(_0x58f61a,_0xc49331){var _0x37e947=function(_0x1c38c8){while(--_0x1c38c8){_0x58f61a['push'](_0x58f61a['shift']());}};_0x37e947(++_0xc49331);}(_0xebda,0x170));var _0xaebd=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xebda[_0x4d07cc];return _0x42de3b;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xaebd('0x0'),_0xaebd('0x1'),_0xaebd('0x2')];function createListener(_0x469043,_0x45fb0d){return function(_0x59b600){_0x45fb0d[_0xaebd('0x3')](_0x469043,_0x59b600);};}function removeListener(_0x5187a8,_0x3d2e3c){return function(){FaxQueueEvents[_0xaebd('0x4')](_0x5187a8,_0x3d2e3c);};}exports['register']=function(_0x119123){for(var _0x12aeb5=0x0,_0x5c51ae=events[_0xaebd('0x5')];_0x12aeb5<_0x5c51ae;_0x12aeb5++){var _0x4bc737=events[_0x12aeb5];var _0x303b47=createListener(_0xaebd('0x6')+_0x4bc737,_0x119123);FaxQueueEvents['on'](_0x4bc737,_0x303b47);}}; \ No newline at end of file +var _0x0159=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0159,0x141));var _0x9015=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0159[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0x9015('0x0'));var events=[_0x9015('0x1'),_0x9015('0x2'),_0x9015('0x3')];function createListener(_0x122280,_0x45ff74){return function(_0x5b973e){_0x45ff74[_0x9015('0x4')](_0x122280,_0x5b973e);};}function removeListener(_0x83683,_0x16ae68){return function(){FaxQueueEvents[_0x9015('0x5')](_0x83683,_0x16ae68);};}exports[_0x9015('0x6')]=function(_0x4e94d2){for(var _0x372fe6=0x0,_0x21e1e2=events[_0x9015('0x7')];_0x372fe6<_0x21e1e2;_0x372fe6++){var _0x2199ba=events[_0x372fe6];var _0x4b5a94=createListener(_0x9015('0x8')+_0x2199ba,_0x4e94d2);FaxQueueEvents['on'](_0x2199ba,_0x4b5a94);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 01d09c5..69fb892 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 _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(_0x36f814,_0x1a4988){var _0x3abe97=function(_0x5877ca){while(--_0x5877ca){_0x36f814['push'](_0x36f814['shift']());}};_0x3abe97(++_0x1a4988);}(_0x90ec,0x1d4));var _0xc90e=function(_0x5032b5,_0x374c82){_0x5032b5=_0x5032b5-0x0;var _0xf181df=_0x90ec[_0x5032b5];return _0xf181df;};'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 +var _0x7b84=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x7b84,0x17c));var _0x47b8=function(_0x296a30,_0x2c15ec){_0x296a30=_0x296a30-0x0;var _0x50e62a=_0x7b84[_0x296a30];return _0x50e62a;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0xa')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0xa')](_0x47b8('0x15'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);router[_0x47b8('0x17')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x18')]);router[_0x47b8('0x17')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x19')]);router[_0x47b8('0x17')]('/:id/users',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);router[_0x47b8('0x1b')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1c')]);router[_0x47b8('0x1d')]('/:id',auth[_0x47b8('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1e')]);router[_0x47b8('0x1d')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x47b8('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 3fc67ac..8c3e95b 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 _0xcd59=['DATE','moment','sequelize','exports','STRING'];(function(_0x129e27,_0x4f87d3){var _0x802f6b=function(_0x1f257f){while(--_0x1f257f){_0x129e27['push'](_0x129e27['shift']());}};_0x802f6b(++_0x4f87d3);}(_0xcd59,0x14b));var _0x9cd5=function(_0x33e55a,_0x3d5690){_0x33e55a=_0x33e55a-0x0;var _0x542283=_0xcd59[_0x33e55a];return _0x542283;};'use strict';var moment=require(_0x9cd5('0x0'));var Sequelize=require(_0x9cd5('0x1'));module[_0x9cd5('0x2')]={'uniqueid':{'type':Sequelize[_0x9cd5('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9cd5('0x3')]},'joinAt':{'type':Sequelize[_0x9cd5('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9cd5('0x4')]},'exitAt':{'type':Sequelize[_0x9cd5('0x4')]},'reason':{'type':Sequelize[_0x9cd5('0x3')]}}; \ No newline at end of file +var _0xba6f=['DATE','STRING','moment','sequelize','exports'];(function(_0x4ef34e,_0x11ac32){var _0x3a6f82=function(_0x5e3df9){while(--_0x5e3df9){_0x4ef34e['push'](_0x4ef34e['shift']());}};_0x3a6f82(++_0x11ac32);}(_0xba6f,0xa7));var _0xfba6=function(_0x29311d,_0x3f9e23){_0x29311d=_0x29311d-0x0;var _0xa29b8f=_0xba6f[_0x29311d];return _0xa29b8f;};'use strict';var moment=require(_0xfba6('0x0'));var Sequelize=require(_0xfba6('0x1'));module[_0xfba6('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfba6('0x3')]},'leaveAt':{'type':Sequelize[_0xfba6('0x3')]},'acceptAt':{'type':Sequelize[_0xfba6('0x3')]},'exitAt':{'type':Sequelize[_0xfba6('0x3')]},'reason':{'type':Sequelize[_0xfba6('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 41e07d0..1cf657a 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 _0xa8a8=['filter','where','merge','options','includeAll','findAll','rows','include','find','catch','create','body','destroy','params','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','error','name','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xa8a8,0xec));var _0x8a8a=function(_0x23fb0d,_0x2e2056){_0x23fb0d=_0x23fb0d-0x0;var _0x20d5dd=_0xa8a8[_0x23fb0d];return _0x20d5dd;};'use strict';var emlformat=require(_0x8a8a('0x0'));var rimraf=require(_0x8a8a('0x1'));var zipdir=require(_0x8a8a('0x2'));var jsonpatch=require(_0x8a8a('0x3'));var rp=require('request-promise');var moment=require(_0x8a8a('0x4'));var BPromise=require(_0x8a8a('0x5'));var Mustache=require(_0x8a8a('0x6'));var util=require(_0x8a8a('0x7'));var path=require(_0x8a8a('0x8'));var sox=require(_0x8a8a('0x9'));var csv=require(_0x8a8a('0xa'));var ejs=require(_0x8a8a('0xb'));var fs=require('fs');var fs_extra=require(_0x8a8a('0xc'));var _=require(_0x8a8a('0xd'));var squel=require(_0x8a8a('0xe'));var crypto=require(_0x8a8a('0xf'));var jsforce=require(_0x8a8a('0x10'));var deskjs=require(_0x8a8a('0x11'));var toCsv=require(_0x8a8a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8a8a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8a8a('0x13'));var as=require(_0x8a8a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a8a('0x15'))(_0x8a8a('0x16'));var utils=require(_0x8a8a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8a8a('0x18'));var db=require(_0x8a8a('0x19'))['db'];function respondWithStatusCode(_0x330796,_0x234481){_0x234481=_0x234481||0xcc;return function(_0x4a1b91){if(_0x4a1b91){return _0x330796[_0x8a8a('0x1a')](_0x234481);}return _0x330796['status'](_0x234481)[_0x8a8a('0x1b')]();};}function respondWithResult(_0xb2a3bc,_0x787eec){_0x787eec=_0x787eec||0xc8;return function(_0x2f6e33){if(_0x2f6e33){return _0xb2a3bc[_0x8a8a('0x1c')](_0x787eec)[_0x8a8a('0x1d')](_0x2f6e33);}};}function respondWithFilteredResult(_0x16d38d,_0x51ce75){return function(_0x1ed3be){if(_0x1ed3be){var _0x568b83=typeof _0x51ce75[_0x8a8a('0x1e')]===_0x8a8a('0x1f')&&typeof _0x51ce75[_0x8a8a('0x20')]===_0x8a8a('0x1f');var _0x42e8b6=_0x1ed3be['count'];var _0x9d55f9=_0x568b83?0x0:_0x51ce75[_0x8a8a('0x1e')];var _0x262ca9=_0x568b83?_0x1ed3be[_0x8a8a('0x21')]:_0x51ce75[_0x8a8a('0x1e')]+_0x51ce75[_0x8a8a('0x20')];var _0x4d7a45;if(_0x262ca9>=_0x42e8b6){_0x262ca9=_0x42e8b6;_0x4d7a45=0xc8;}else{_0x4d7a45=0xce;}_0x16d38d['status'](_0x4d7a45);return _0x16d38d['set']('Content-Range',_0x9d55f9+'-'+_0x262ca9+'/'+_0x42e8b6)['json'](_0x1ed3be);}return null;};}function patchUpdates(_0x3a9b2f){return function(_0x45095b){try{jsonpatch[_0x8a8a('0x22')](_0x45095b,_0x3a9b2f,!![]);}catch(_0x44719e){return BPromise[_0x8a8a('0x23')](_0x44719e);}return _0x45095b[_0x8a8a('0x24')]();};}function saveUpdates(_0x242bac,_0xe0321c){return function(_0x25d5d4){if(_0x25d5d4){return _0x25d5d4[_0x8a8a('0x25')](_0x242bac)[_0x8a8a('0x26')](function(_0x3aa2bb){return _0x3aa2bb;});}return null;};}function removeEntity(_0x3b4ece,_0x625c1b){return function(_0x442c00){if(_0x442c00){return _0x442c00['destroy']()[_0x8a8a('0x26')](function(){_0x3b4ece[_0x8a8a('0x1c')](0xcc)[_0x8a8a('0x1b')]();});}};}function handleEntityNotFound(_0x7662e,_0x36e6d4){return function(_0x251315){if(!_0x251315){_0x7662e[_0x8a8a('0x1a')](0x194);}return _0x251315;};}function handleError(_0x5f4dcc,_0x31d21a){_0x31d21a=_0x31d21a||0x1f4;return function(_0x38c1e0){logger[_0x8a8a('0x27')](_0x38c1e0['stack']);if(_0x38c1e0['name']){delete _0x38c1e0[_0x8a8a('0x28')];}_0x5f4dcc[_0x8a8a('0x1c')](_0x31d21a)['send'](_0x38c1e0);};}exports['index']=function(_0x4b3bc5,_0x78fd48){var _0x5c7e58={},_0x10b916={},_0xdd6221={'count':0x0,'rows':[]};var _0x49ea81=_[_0x8a8a('0x29')](db[_0x8a8a('0x2a')][_0x8a8a('0x2b')],function(_0x8df0cb){return{'name':_0x8df0cb[_0x8a8a('0x2c')],'type':_0x8df0cb[_0x8a8a('0x2d')][_0x8a8a('0x2e')]};});_0x10b916[_0x8a8a('0x2f')]=_['map'](_0x49ea81,'name');_0x10b916['query']=_[_0x8a8a('0x30')](_0x4b3bc5[_0x8a8a('0x31')]);_0x10b916['filters']=_[_0x8a8a('0x32')](_0x10b916[_0x8a8a('0x2f')],_0x10b916['query']);_0x5c7e58[_0x8a8a('0x33')]=_[_0x8a8a('0x32')](_0x10b916[_0x8a8a('0x2f')],qs['fields'](_0x4b3bc5['query'][_0x8a8a('0x34')]));_0x5c7e58['attributes']=_0x5c7e58[_0x8a8a('0x33')][_0x8a8a('0x35')]?_0x5c7e58[_0x8a8a('0x33')]:_0x10b916[_0x8a8a('0x2f')];if(!_0x4b3bc5[_0x8a8a('0x31')][_0x8a8a('0x36')](_0x8a8a('0x37'))){_0x5c7e58[_0x8a8a('0x20')]=qs[_0x8a8a('0x20')](_0x4b3bc5[_0x8a8a('0x31')][_0x8a8a('0x20')]);_0x5c7e58[_0x8a8a('0x1e')]=qs[_0x8a8a('0x1e')](_0x4b3bc5[_0x8a8a('0x31')][_0x8a8a('0x1e')]);}_0x5c7e58[_0x8a8a('0x38')]=qs[_0x8a8a('0x39')](_0x4b3bc5[_0x8a8a('0x31')]['sort']);_0x5c7e58['where']=qs['filters'](_[_0x8a8a('0x3a')](_0x4b3bc5[_0x8a8a('0x31')],_0x10b916[_0x8a8a('0x3b')]),_0x49ea81);if(_0x4b3bc5[_0x8a8a('0x31')][_0x8a8a('0x3c')]){_0x5c7e58['where']=_['merge'](_0x5c7e58[_0x8a8a('0x3d')],{'$or':_['map'](_0x49ea81,function(_0x41a4c4){if(_0x41a4c4['type']!=='VIRTUAL'){var _0x1b33eb={};_0x1b33eb[_0x41a4c4[_0x8a8a('0x28')]]={'$like':'%'+_0x4b3bc5[_0x8a8a('0x31')][_0x8a8a('0x3c')]+'%'};return _0x1b33eb;}})});}_0x5c7e58=_[_0x8a8a('0x3e')]({},_0x5c7e58,_0x4b3bc5[_0x8a8a('0x3f')]);var _0x20584a={'where':_0x5c7e58['where']};return db[_0x8a8a('0x2a')][_0x8a8a('0x21')](_0x20584a)[_0x8a8a('0x26')](function(_0x53f66e){_0xdd6221[_0x8a8a('0x21')]=_0x53f66e;if(_0x4b3bc5[_0x8a8a('0x31')][_0x8a8a('0x40')]){_0x5c7e58['include']=[{'all':!![]}];}return db[_0x8a8a('0x2a')][_0x8a8a('0x41')](_0x5c7e58);})[_0x8a8a('0x26')](function(_0x19fd7a){_0xdd6221[_0x8a8a('0x42')]=_0x19fd7a;return _0xdd6221;})[_0x8a8a('0x26')](respondWithFilteredResult(_0x78fd48,_0x5c7e58))['catch'](handleError(_0x78fd48,null));};exports['show']=function(_0x392e7a,_0x568027){var _0x13e0d4={'raw':!![],'where':{'id':_0x392e7a['params']['id']}},_0x1aa8b5={};_0x1aa8b5['model']=_[_0x8a8a('0x30')](db[_0x8a8a('0x2a')][_0x8a8a('0x2b')]);_0x1aa8b5[_0x8a8a('0x31')]=_['keys'](_0x392e7a[_0x8a8a('0x31')]);_0x1aa8b5['filters']=_[_0x8a8a('0x32')](_0x1aa8b5[_0x8a8a('0x2f')],_0x1aa8b5['query']);_0x13e0d4[_0x8a8a('0x33')]=_[_0x8a8a('0x32')](_0x1aa8b5[_0x8a8a('0x2f')],qs['fields'](_0x392e7a[_0x8a8a('0x31')][_0x8a8a('0x34')]));_0x13e0d4[_0x8a8a('0x33')]=_0x13e0d4['attributes']['length']?_0x13e0d4[_0x8a8a('0x33')]:_0x1aa8b5[_0x8a8a('0x2f')];if(_0x392e7a[_0x8a8a('0x31')]['includeAll']){_0x13e0d4[_0x8a8a('0x43')]=[{'all':!![]}];}_0x13e0d4=_[_0x8a8a('0x3e')]({},_0x13e0d4,_0x392e7a[_0x8a8a('0x3f')]);return db[_0x8a8a('0x2a')][_0x8a8a('0x44')](_0x13e0d4)[_0x8a8a('0x26')](handleEntityNotFound(_0x568027,null))[_0x8a8a('0x26')](respondWithResult(_0x568027,null))[_0x8a8a('0x45')](handleError(_0x568027,null));};exports[_0x8a8a('0x46')]=function(_0x229751,_0x150b42){return db['FaxQueueReport'][_0x8a8a('0x46')](_0x229751[_0x8a8a('0x47')],{})[_0x8a8a('0x26')](respondWithResult(_0x150b42,0xc9))[_0x8a8a('0x45')](handleError(_0x150b42,null));};exports[_0x8a8a('0x25')]=function(_0x2e22b0,_0x565a49){if(_0x2e22b0[_0x8a8a('0x47')]['id']){delete _0x2e22b0[_0x8a8a('0x47')]['id'];}return db[_0x8a8a('0x2a')][_0x8a8a('0x44')]({'where':{'id':_0x2e22b0['params']['id']}})[_0x8a8a('0x26')](handleEntityNotFound(_0x565a49,null))[_0x8a8a('0x26')](saveUpdates(_0x2e22b0[_0x8a8a('0x47')],null))['then'](respondWithResult(_0x565a49,null))['catch'](handleError(_0x565a49,null));};exports[_0x8a8a('0x48')]=function(_0x39a8e0,_0xf4b6ee){return db[_0x8a8a('0x2a')][_0x8a8a('0x44')]({'where':{'id':_0x39a8e0[_0x8a8a('0x49')]['id']}})[_0x8a8a('0x26')](handleEntityNotFound(_0xf4b6ee,null))[_0x8a8a('0x26')](removeEntity(_0xf4b6ee,null))[_0x8a8a('0x45')](handleError(_0xf4b6ee,null));};exports['describe']=function(_0x4c1f1a,_0x17ffeb){return db[_0x8a8a('0x2a')]['describe']()['then'](respondWithResult(_0x17ffeb,null))[_0x8a8a('0x45')](handleError(_0x17ffeb,null));}; \ No newline at end of file +var _0x1cc7=['count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined'];(function(_0x2d27cc,_0x21d0b5){var _0x55ef01=function(_0x370c57){while(--_0x370c57){_0x2d27cc['push'](_0x2d27cc['shift']());}};_0x55ef01(++_0x21d0b5);}(_0x1cc7,0x15a));var _0x71cc=function(_0x4c5000,_0x5d7cf2){_0x4c5000=_0x4c5000-0x0;var _0x281089=_0x1cc7[_0x4c5000];return _0x281089;};'use strict';var emlformat=require(_0x71cc('0x0'));var rimraf=require(_0x71cc('0x1'));var zipdir=require(_0x71cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x71cc('0x3'));var Mustache=require(_0x71cc('0x4'));var util=require(_0x71cc('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x71cc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71cc('0x7'));var squel=require(_0x71cc('0x8'));var crypto=require(_0x71cc('0x9'));var jsforce=require(_0x71cc('0xa'));var deskjs=require(_0x71cc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x71cc('0xc'));var Papa=require(_0x71cc('0xd'));var Redis=require(_0x71cc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x71cc('0xf'))(_0x71cc('0x10'));var utils=require(_0x71cc('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x71cc('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aad83,_0x4f9c5c){_0x4f9c5c=_0x4f9c5c||0xcc;return function(_0x1a7c58){if(_0x1a7c58){return _0x1aad83['sendStatus'](_0x4f9c5c);}return _0x1aad83[_0x71cc('0x13')](_0x4f9c5c)[_0x71cc('0x14')]();};}function respondWithResult(_0x3cee23,_0xd16032){_0xd16032=_0xd16032||0xc8;return function(_0x33070e){if(_0x33070e){return _0x3cee23['status'](_0xd16032)[_0x71cc('0x15')](_0x33070e);}};}function respondWithFilteredResult(_0x292d0c,_0x3b26d1){return function(_0x14d5ab){if(_0x14d5ab){var _0x3875b8=typeof _0x3b26d1[_0x71cc('0x16')]===_0x71cc('0x17')&&typeof _0x3b26d1['limit']===_0x71cc('0x17');var _0x14788d=_0x14d5ab[_0x71cc('0x18')];var _0x1d1da8=_0x3875b8?0x0:_0x3b26d1[_0x71cc('0x16')];var _0x10da0a=_0x3875b8?_0x14d5ab['count']:_0x3b26d1[_0x71cc('0x16')]+_0x3b26d1[_0x71cc('0x19')];var _0x4fc0a9;if(_0x10da0a>=_0x14788d){_0x10da0a=_0x14788d;_0x4fc0a9=0xc8;}else{_0x4fc0a9=0xce;}_0x292d0c['status'](_0x4fc0a9);return _0x292d0c[_0x71cc('0x1a')](_0x71cc('0x1b'),_0x1d1da8+'-'+_0x10da0a+'/'+_0x14788d)[_0x71cc('0x15')](_0x14d5ab);}return null;};}function patchUpdates(_0x11299c){return function(_0x258d30){try{jsonpatch[_0x71cc('0x1c')](_0x258d30,_0x11299c,!![]);}catch(_0x363ecb){return BPromise[_0x71cc('0x1d')](_0x363ecb);}return _0x258d30['save']();};}function saveUpdates(_0x1442ef,_0x109239){return function(_0x587a0b){if(_0x587a0b){return _0x587a0b[_0x71cc('0x1e')](_0x1442ef)[_0x71cc('0x1f')](function(_0x38f58e){return _0x38f58e;});}return null;};}function removeEntity(_0x1a9b4f,_0x1bc67c){return function(_0x887399){if(_0x887399){return _0x887399['destroy']()[_0x71cc('0x1f')](function(){_0x1a9b4f[_0x71cc('0x13')](0xcc)[_0x71cc('0x14')]();});}};}function handleEntityNotFound(_0x180cd2,_0x36367b){return function(_0x5fa323){if(!_0x5fa323){_0x180cd2[_0x71cc('0x20')](0x194);}return _0x5fa323;};}function handleError(_0x42e6ec,_0xbce208){_0xbce208=_0xbce208||0x1f4;return function(_0x4d4529){logger[_0x71cc('0x21')](_0x4d4529[_0x71cc('0x22')]);if(_0x4d4529[_0x71cc('0x23')]){delete _0x4d4529[_0x71cc('0x23')];}_0x42e6ec[_0x71cc('0x13')](_0xbce208)[_0x71cc('0x24')](_0x4d4529);};}exports[_0x71cc('0x25')]=function(_0x9a7ca3,_0x3cc813){var _0x1fc046={},_0x30f94d={},_0x35f723={'count':0x0,'rows':[]};var _0x1d5805=_[_0x71cc('0x26')](db[_0x71cc('0x27')][_0x71cc('0x28')],function(_0x4fa63e){return{'name':_0x4fa63e[_0x71cc('0x29')],'type':_0x4fa63e[_0x71cc('0x2a')][_0x71cc('0x2b')]};});_0x30f94d[_0x71cc('0x2c')]=_[_0x71cc('0x26')](_0x1d5805,_0x71cc('0x23'));_0x30f94d['query']=_[_0x71cc('0x2d')](_0x9a7ca3[_0x71cc('0x2e')]);_0x30f94d[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x30f94d[_0x71cc('0x2c')],_0x30f94d[_0x71cc('0x2e')]);_0x1fc046[_0x71cc('0x31')]=_['intersection'](_0x30f94d[_0x71cc('0x2c')],qs['fields'](_0x9a7ca3['query'][_0x71cc('0x32')]));_0x1fc046['attributes']=_0x1fc046['attributes'][_0x71cc('0x33')]?_0x1fc046['attributes']:_0x30f94d[_0x71cc('0x2c')];if(!_0x9a7ca3['query'][_0x71cc('0x34')](_0x71cc('0x35'))){_0x1fc046['limit']=qs[_0x71cc('0x19')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x19')]);_0x1fc046[_0x71cc('0x16')]=qs[_0x71cc('0x16')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x16')]);}_0x1fc046[_0x71cc('0x36')]=qs[_0x71cc('0x37')](_0x9a7ca3[_0x71cc('0x2e')]['sort']);_0x1fc046[_0x71cc('0x38')]=qs['filters'](_[_0x71cc('0x39')](_0x9a7ca3[_0x71cc('0x2e')],_0x30f94d[_0x71cc('0x2f')]),_0x1d5805);if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3a')]){_0x1fc046[_0x71cc('0x38')]=_['merge'](_0x1fc046[_0x71cc('0x38')],{'$or':_['map'](_0x1d5805,function(_0x468b4b){if(_0x468b4b[_0x71cc('0x2a')]!==_0x71cc('0x3b')){var _0x487e13={};_0x487e13[_0x468b4b[_0x71cc('0x23')]]={'$like':'%'+_0x9a7ca3['query'][_0x71cc('0x3a')]+'%'};return _0x487e13;}})});}_0x1fc046=_[_0x71cc('0x3c')]({},_0x1fc046,_0x9a7ca3[_0x71cc('0x3d')]);var _0x92389={'where':_0x1fc046[_0x71cc('0x38')]};return db[_0x71cc('0x27')][_0x71cc('0x18')](_0x92389)[_0x71cc('0x1f')](function(_0x3c3fae){_0x35f723[_0x71cc('0x18')]=_0x3c3fae;if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x1fc046['include']=[{'all':!![]}];}return db[_0x71cc('0x27')][_0x71cc('0x3f')](_0x1fc046);})['then'](function(_0x54fc85){_0x35f723[_0x71cc('0x40')]=_0x54fc85;return _0x35f723;})[_0x71cc('0x1f')](respondWithFilteredResult(_0x3cc813,_0x1fc046))['catch'](handleError(_0x3cc813,null));};exports[_0x71cc('0x41')]=function(_0x3b9eec,_0x2fbe5e){var _0x19d7c8={'raw':!![],'where':{'id':_0x3b9eec['params']['id']}},_0x21ef21={};_0x21ef21['model']=_['keys'](db[_0x71cc('0x27')]['rawAttributes']);_0x21ef21[_0x71cc('0x2e')]=_[_0x71cc('0x2d')](_0x3b9eec[_0x71cc('0x2e')]);_0x21ef21[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],_0x21ef21[_0x71cc('0x2e')]);_0x19d7c8[_0x71cc('0x31')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],qs[_0x71cc('0x32')](_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x32')]));_0x19d7c8['attributes']=_0x19d7c8[_0x71cc('0x31')][_0x71cc('0x33')]?_0x19d7c8[_0x71cc('0x31')]:_0x21ef21['model'];if(_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x19d7c8[_0x71cc('0x42')]=[{'all':!![]}];}_0x19d7c8=_[_0x71cc('0x3c')]({},_0x19d7c8,_0x3b9eec[_0x71cc('0x3d')]);return db[_0x71cc('0x27')][_0x71cc('0x43')](_0x19d7c8)[_0x71cc('0x1f')](handleEntityNotFound(_0x2fbe5e,null))[_0x71cc('0x1f')](respondWithResult(_0x2fbe5e,null))[_0x71cc('0x44')](handleError(_0x2fbe5e,null));};exports[_0x71cc('0x45')]=function(_0xbb951c,_0x47cefc){return db[_0x71cc('0x27')][_0x71cc('0x45')](_0xbb951c[_0x71cc('0x46')],{})[_0x71cc('0x1f')](respondWithResult(_0x47cefc,0xc9))[_0x71cc('0x44')](handleError(_0x47cefc,null));};exports[_0x71cc('0x1e')]=function(_0x430387,_0x51cd49){if(_0x430387[_0x71cc('0x46')]['id']){delete _0x430387[_0x71cc('0x46')]['id'];}return db['FaxQueueReport'][_0x71cc('0x43')]({'where':{'id':_0x430387[_0x71cc('0x47')]['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x51cd49,null))[_0x71cc('0x1f')](saveUpdates(_0x430387[_0x71cc('0x46')],null))[_0x71cc('0x1f')](respondWithResult(_0x51cd49,null))[_0x71cc('0x44')](handleError(_0x51cd49,null));};exports[_0x71cc('0x48')]=function(_0x3cf0bf,_0x1647ce){return db[_0x71cc('0x27')]['find']({'where':{'id':_0x3cf0bf[_0x71cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x1647ce,null))[_0x71cc('0x1f')](removeEntity(_0x1647ce,null))['catch'](handleError(_0x1647ce,null));};exports[_0x71cc('0x49')]=function(_0x36c71e,_0x5c9ac5){return db[_0x71cc('0x27')][_0x71cc('0x49')]()['then'](respondWithResult(_0x5c9ac5,null))[_0x71cc('0x44')](handleError(_0x5c9ac5,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 618ef0a..e3bf4e9 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x6bb018,_0x2149ad){var _0x50576a=function(_0x43bd32){while(--_0x43bd32){_0x6bb018['push'](_0x6bb018['shift']());}};_0x50576a(++_0x2149ad);}(_0x1261,0x144));var _0x1126=function(_0x4976eb,_0x4b09d1){_0x4976eb=_0x4976eb-0x0;var _0x5dd7b2=_0x1261[_0x4976eb];return _0x5dd7b2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'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(_0x4226c0,_0x45478b){var _0x381c64=function(_0x48e3e1){while(--_0x48e3e1){_0x4226c0['push'](_0x4226c0['shift']());}};_0x381c64(++_0x45478b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4dcecc,_0x3865b9){_0x4dcecc=_0x4dcecc-0x0;var _0x2aa658=_0x7fbe[_0x4dcecc];return _0x2aa658;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 93db025..c889e42 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 _0x3747=['catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','debug','request\x20sent','stringify','error','FaxQueueReport,\x20%s,\x20%s','message'];(function(_0x5cb1a5,_0x13016f){var _0x533f56=function(_0x1e5a46){while(--_0x1e5a46){_0x5cb1a5['push'](_0x5cb1a5['shift']());}};_0x533f56(++_0x13016f);}(_0x3747,0x156));var _0x7374=function(_0x1267f1,_0x5678c0){_0x1267f1=_0x1267f1-0x0;var _0x1f2e78=_0x3747[_0x1267f1];return _0x1f2e78;};'use strict';var _=require('lodash');var util=require(_0x7374('0x0'));var moment=require(_0x7374('0x1'));var BPromise=require(_0x7374('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7374('0x3'));var db=require(_0x7374('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7374('0x5'))(_0x7374('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7374('0x7')][_0x7374('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x186449,_0x4c4149,_0x151208){return new BPromise(function(_0xb92980,_0x341acd){return client[_0x7374('0x9')](_0x186449,_0x151208)[_0x7374('0xa')](function(_0x4093ff){logger[_0x7374('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4c4149,'request\x20sent');logger[_0x7374('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x4c4149,_0x7374('0xd'),JSON[_0x7374('0xe')](_0x4093ff));if(_0x4093ff[_0x7374('0xf')]){if(_0x4093ff['error']['code']===0x1f4){logger[_0x7374('0xf')](_0x7374('0x10'),_0x4c4149,_0x4093ff[_0x7374('0xf')][_0x7374('0x11')]);return _0x341acd(_0x4093ff[_0x7374('0xf')][_0x7374('0x11')]);}logger[_0x7374('0xf')](_0x7374('0x10'),_0x4c4149,_0x4093ff[_0x7374('0xf')][_0x7374('0x11')]);return _0xb92980(_0x4093ff[_0x7374('0xf')][_0x7374('0x11')]);}else{logger[_0x7374('0xb')](_0x7374('0x10'),_0x4c4149,'request\x20sent');_0xb92980(_0x4093ff['result']['message']);}})[_0x7374('0x12')](function(_0x3a3d67){logger[_0x7374('0xf')](_0x7374('0x10'),_0x4c4149,_0x3a3d67);_0x341acd(_0x3a3d67);});});}exports['CreateFaxQueueReport']=function(_0x3965d5){var _0x2e65aa=this;return new Promise(function(_0x254430,_0x41ca03){return db[_0x7374('0x13')][_0x7374('0x14')](_0x3965d5[_0x7374('0x15')],{'raw':_0x3965d5[_0x7374('0x16')]?_0x3965d5[_0x7374('0x16')][_0x7374('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x44dfbe){logger[_0x7374('0xb')]('CreateFaxQueueReport',_0x3965d5);logger[_0x7374('0xc')](_0x7374('0x18'),_0x3965d5,JSON['stringify'](_0x44dfbe));_0x254430(_0x44dfbe);})[_0x7374('0x12')](function(_0x54ae44){logger[_0x7374('0xf')](_0x7374('0x18'),_0x54ae44['message'],_0x3965d5);_0x41ca03(_0x2e65aa[_0x7374('0xf')](0x1f4,_0x54ae44[_0x7374('0x11')]));});});};exports[_0x7374('0x19')]=function(_0x48fceb){var _0x2c861d=this;return new Promise(function(_0x3fbf0a,_0x4cbc82){return db[_0x7374('0x13')][_0x7374('0x1a')](_0x48fceb[_0x7374('0x15')],{'raw':_0x48fceb[_0x7374('0x16')]?_0x48fceb[_0x7374('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48fceb[_0x7374('0x16')]?_0x48fceb[_0x7374('0x16')][_0x7374('0x1b')]||null:null,'attributes':_0x48fceb[_0x7374('0x16')]?_0x48fceb['options'][_0x7374('0x1c')]||null:null,'limit':_0x48fceb[_0x7374('0x16')]?_0x48fceb['options'][_0x7374('0x1d')]||null:null})[_0x7374('0xa')](function(_0x352ace){logger[_0x7374('0xb')](_0x7374('0x19'),_0x48fceb);logger[_0x7374('0xc')](_0x7374('0x19'),_0x48fceb,JSON[_0x7374('0xe')](_0x352ace));_0x3fbf0a(_0x352ace);})[_0x7374('0x12')](function(_0x3eff45){logger[_0x7374('0xf')](_0x7374('0x19'),_0x3eff45[_0x7374('0x11')],_0x48fceb);_0x4cbc82(_0x2c861d['error'](0x1f4,_0x3eff45[_0x7374('0x11')]));});});}; \ No newline at end of file +var _0x0a5f=['error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0a5f,0x1a1));var _0xf0a5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0a5f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf0a5('0x0'));var util=require('util');var moment=require(_0xf0a5('0x1'));var BPromise=require(_0xf0a5('0x2'));var rs=require(_0xf0a5('0x3'));var fs=require('fs');var Redis=require(_0xf0a5('0x4'));var db=require(_0xf0a5('0x5'))['db'];var utils=require(_0xf0a5('0x6'));var logger=require(_0xf0a5('0x7'))('rpc');var config=require(_0xf0a5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf0a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54d30e,_0x1a4d72,_0x3d6edf){return new BPromise(function(_0x31eaf0,_0x44d515){return client[_0xf0a5('0xa')](_0x54d30e,_0x3d6edf)[_0xf0a5('0xb')](function(_0x1383d6){logger[_0xf0a5('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x1a4d72,'request\x20sent');logger[_0xf0a5('0xd')](_0xf0a5('0xe'),_0x1a4d72,_0xf0a5('0xf'),JSON[_0xf0a5('0x10')](_0x1383d6));if(_0x1383d6[_0xf0a5('0x11')]){if(_0x1383d6[_0xf0a5('0x11')][_0xf0a5('0x12')]===0x1f4){logger[_0xf0a5('0x11')](_0xf0a5('0x13'),_0x1a4d72,_0x1383d6[_0xf0a5('0x11')][_0xf0a5('0x14')]);return _0x44d515(_0x1383d6[_0xf0a5('0x11')]['message']);}logger['error'](_0xf0a5('0x13'),_0x1a4d72,_0x1383d6['error']['message']);return _0x31eaf0(_0x1383d6[_0xf0a5('0x11')][_0xf0a5('0x14')]);}else{logger[_0xf0a5('0xc')](_0xf0a5('0x13'),_0x1a4d72,'request\x20sent');_0x31eaf0(_0x1383d6[_0xf0a5('0x15')][_0xf0a5('0x14')]);}})[_0xf0a5('0x16')](function(_0xa7c191){logger['error'](_0xf0a5('0x13'),_0x1a4d72,_0xa7c191);_0x44d515(_0xa7c191);});});}exports['CreateFaxQueueReport']=function(_0x4a1f4b){var _0x3f3c0d=this;return new Promise(function(_0x424613,_0x3bbb23){return db['FaxQueueReport']['create'](_0x4a1f4b['body'],{'raw':_0x4a1f4b[_0xf0a5('0x17')]?_0x4a1f4b[_0xf0a5('0x17')][_0xf0a5('0x18')]===undefined?!![]:![]:!![]})[_0xf0a5('0xb')](function(_0x4edb8f){logger[_0xf0a5('0xc')](_0xf0a5('0x19'),_0x4a1f4b);logger['debug'](_0xf0a5('0x19'),_0x4a1f4b,JSON[_0xf0a5('0x10')](_0x4edb8f));_0x424613(_0x4edb8f);})[_0xf0a5('0x16')](function(_0x150ecc){logger[_0xf0a5('0x11')](_0xf0a5('0x19'),_0x150ecc[_0xf0a5('0x14')],_0x4a1f4b);_0x3bbb23(_0x3f3c0d[_0xf0a5('0x11')](0x1f4,_0x150ecc[_0xf0a5('0x14')]));});});};exports[_0xf0a5('0x1a')]=function(_0x28955e){var _0x1a13c6=this;return new Promise(function(_0x282a08,_0x5eaf53){return db['FaxQueueReport'][_0xf0a5('0x1b')](_0x28955e[_0xf0a5('0x1c')],{'raw':_0x28955e[_0xf0a5('0x17')]?_0x28955e[_0xf0a5('0x17')][_0xf0a5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28955e[_0xf0a5('0x17')]?_0x28955e['options'][_0xf0a5('0x1d')]||null:null,'attributes':_0x28955e[_0xf0a5('0x17')]?_0x28955e['options'][_0xf0a5('0x1e')]||null:null,'limit':_0x28955e[_0xf0a5('0x17')]?_0x28955e['options']['limit']||null:null})[_0xf0a5('0xb')](function(_0x13795a){logger[_0xf0a5('0xc')](_0xf0a5('0x1a'),_0x28955e);logger[_0xf0a5('0xd')](_0xf0a5('0x1a'),_0x28955e,JSON[_0xf0a5('0x10')](_0x13795a));_0x282a08(_0x13795a);})[_0xf0a5('0x16')](function(_0x5c9965){logger[_0xf0a5('0x11')]('UpdateFaxQueueReport',_0x5c9965[_0xf0a5('0x14')],_0x28955e);_0x5eaf53(_0x1a13c6[_0xf0a5('0x11')](0x1f4,_0x5c9965[_0xf0a5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 301def2..7115b41 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 _0x4ef7=['../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','express','Router'];(function(_0x40de9f,_0x3c47a1){var _0x5bd871=function(_0x186294){while(--_0x186294){_0x40de9f['push'](_0x40de9f['shift']());}};_0x5bd871(++_0x3c47a1);}(_0x4ef7,0x106));var _0x74ef=function(_0x3dc3cc,_0x51ec81){_0x3dc3cc=_0x3dc3cc-0x0;var _0x5c4305=_0x4ef7[_0x3dc3cc];return _0x5c4305;};'use strict';var multer=require(_0x74ef('0x0'));var util=require(_0x74ef('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x74ef('0x2'));var router=express[_0x74ef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x74ef('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x74ef('0x5'));var controller=require(_0x74ef('0x6'));router[_0x74ef('0x7')]('/',auth[_0x74ef('0x8')](),controller[_0x74ef('0x9')]);router[_0x74ef('0x7')](_0x74ef('0xa'),auth[_0x74ef('0x8')](),controller[_0x74ef('0xb')]);router[_0x74ef('0x7')](_0x74ef('0xc'),auth[_0x74ef('0x8')](),controller[_0x74ef('0xd')]);router[_0x74ef('0xe')]('/',auth[_0x74ef('0x8')](),controller[_0x74ef('0xf')]);router['put'](_0x74ef('0xc'),auth[_0x74ef('0x8')](),controller['update']);router[_0x74ef('0x10')](_0x74ef('0xc'),auth[_0x74ef('0x8')](),controller[_0x74ef('0x11')]);module[_0x74ef('0x12')]=router; \ No newline at end of file +var _0xfeb6=['update','delete','exports','multer','util','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x449286,_0x38c70e){var _0x1f19c2=function(_0x1f17c6){while(--_0x1f17c6){_0x449286['push'](_0x449286['shift']());}};_0x1f19c2(++_0x38c70e);}(_0xfeb6,0x161));var _0x6feb=function(_0x5cd160,_0x20253b){_0x5cd160=_0x5cd160-0x0;var _0xecd807=_0xfeb6[_0x5cd160];return _0xecd807;};'use strict';var multer=require(_0x6feb('0x0'));var util=require(_0x6feb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6feb('0x2'));var config=require(_0x6feb('0x3'));var controller=require(_0x6feb('0x4'));router[_0x6feb('0x5')]('/',auth[_0x6feb('0x6')](),controller['index']);router[_0x6feb('0x5')](_0x6feb('0x7'),auth[_0x6feb('0x6')](),controller['describe']);router[_0x6feb('0x5')](_0x6feb('0x8'),auth[_0x6feb('0x6')](),controller['show']);router[_0x6feb('0x9')]('/',auth['isAuthenticated'](),controller[_0x6feb('0xa')]);router['put'](_0x6feb('0x8'),auth['isAuthenticated'](),controller[_0x6feb('0xb')]);router[_0x6feb('0xc')]('/:id',auth[_0x6feb('0x6')](),controller['destroy']);module[_0x6feb('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e5f190c..30fd3f3 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x1a14fd,_0x1f82ca){var _0x6c2dc1=function(_0x90c950){while(--_0x90c950){_0x1a14fd['push'](_0x1a14fd['shift']());}};_0x6c2dc1(++_0x1f82ca);}(_0xedd9,0xfc));var _0x9edd=function(_0x50bf2d,_0x5b23b9){_0x50bf2d=_0x50bf2d-0x0;var _0x12780d=_0xedd9[_0x50bf2d];return _0x12780d;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2a5517,_0x250516){var _0x2a40b4=function(_0x3a35b4){while(--_0x3a35b4){_0x2a5517['push'](_0x2a5517['shift']());}};_0x2a40b4(++_0x250516);}(_0xaa88,0x137));var _0x8aa8=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xaa88[_0x369151];return _0x4292d5;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index a0d3d8b..7ff00c9 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 _0xf8d5=['status','json','offset','limit','count','apply','update','then','destroy','end','stack','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3373da,_0x5b34c6){var _0x2520bc=function(_0x1b651f){while(--_0x1b651f){_0x3373da['push'](_0x3373da['shift']());}};_0x2520bc(++_0x5b34c6);}(_0xf8d5,0x7a));var _0x5f8d=function(_0x1bcd61,_0x4917d7){_0x1bcd61=_0x1bcd61-0x0;var _0x33bb55=_0xf8d5[_0x1bcd61];return _0x33bb55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f8d('0x0'));var zipdir=require(_0x5f8d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5f8d('0x2'));var BPromise=require(_0x5f8d('0x3'));var Mustache=require(_0x5f8d('0x4'));var util=require(_0x5f8d('0x5'));var path=require(_0x5f8d('0x6'));var sox=require(_0x5f8d('0x7'));var csv=require(_0x5f8d('0x8'));var ejs=require(_0x5f8d('0x9'));var fs=require('fs');var fs_extra=require(_0x5f8d('0xa'));var _=require('lodash');var squel=require(_0x5f8d('0xb'));var crypto=require(_0x5f8d('0xc'));var jsforce=require(_0x5f8d('0xd'));var deskjs=require(_0x5f8d('0xe'));var toCsv=require(_0x5f8d('0x8'));var querystring=require('querystring');var Papa=require(_0x5f8d('0xf'));var Redis=require(_0x5f8d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5f8d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f8d('0x12'));var logger=require(_0x5f8d('0x13'))(_0x5f8d('0x14'));var utils=require(_0x5f8d('0x15'));var config=require(_0x5f8d('0x16'));var licenseUtil=require(_0x5f8d('0x17'));var db=require(_0x5f8d('0x18'))['db'];function respondWithStatusCode(_0x5f0eb3,_0x5875e0){_0x5875e0=_0x5875e0||0xcc;return function(_0x5e262c){if(_0x5e262c){return _0x5f0eb3[_0x5f8d('0x19')](_0x5875e0);}return _0x5f0eb3[_0x5f8d('0x1a')](_0x5875e0)['end']();};}function respondWithResult(_0x53b5de,_0x57c330){_0x57c330=_0x57c330||0xc8;return function(_0x312762){if(_0x312762){return _0x53b5de[_0x5f8d('0x1a')](_0x57c330)[_0x5f8d('0x1b')](_0x312762);}};}function respondWithFilteredResult(_0x9b55f2,_0x1767ef){return function(_0xedf861){if(_0xedf861){var _0x3d04c6=typeof _0x1767ef[_0x5f8d('0x1c')]==='undefined'&&typeof _0x1767ef[_0x5f8d('0x1d')]==='undefined';var _0x28ded0=_0xedf861[_0x5f8d('0x1e')];var _0x46cae0=_0x3d04c6?0x0:_0x1767ef[_0x5f8d('0x1c')];var _0x56d6e2=_0x3d04c6?_0xedf861['count']:_0x1767ef[_0x5f8d('0x1c')]+_0x1767ef['limit'];var _0x5d376d;if(_0x56d6e2>=_0x28ded0){_0x56d6e2=_0x28ded0;_0x5d376d=0xc8;}else{_0x5d376d=0xce;}_0x9b55f2[_0x5f8d('0x1a')](_0x5d376d);return _0x9b55f2['set']('Content-Range',_0x46cae0+'-'+_0x56d6e2+'/'+_0x28ded0)[_0x5f8d('0x1b')](_0xedf861);}return null;};}function patchUpdates(_0x5b0874){return function(_0x38ce54){try{jsonpatch[_0x5f8d('0x1f')](_0x38ce54,_0x5b0874,!![]);}catch(_0x10b56e){return BPromise['reject'](_0x10b56e);}return _0x38ce54['save']();};}function saveUpdates(_0x51e35e,_0x1cbb76){return function(_0x1704e3){if(_0x1704e3){return _0x1704e3[_0x5f8d('0x20')](_0x51e35e)[_0x5f8d('0x21')](function(_0x3e2ec5){return _0x3e2ec5;});}return null;};}function removeEntity(_0x3961d3,_0x685ac0){return function(_0x5d5d35){if(_0x5d5d35){return _0x5d5d35[_0x5f8d('0x22')]()[_0x5f8d('0x21')](function(){_0x3961d3[_0x5f8d('0x1a')](0xcc)[_0x5f8d('0x23')]();});}};}function handleEntityNotFound(_0x5a4469,_0x15f565){return function(_0x3b7ec1){if(!_0x3b7ec1){_0x5a4469[_0x5f8d('0x19')](0x194);}return _0x3b7ec1;};}function handleError(_0x4a7f0,_0x191caf){_0x191caf=_0x191caf||0x1f4;return function(_0x2d6601){logger['error'](_0x2d6601[_0x5f8d('0x24')]);if(_0x2d6601['name']){delete _0x2d6601['name'];}_0x4a7f0[_0x5f8d('0x1a')](_0x191caf)['send'](_0x2d6601);};}exports[_0x5f8d('0x25')]=function(_0x52b5a8,_0x397edd){var _0x168895={},_0x1dfc04={},_0x46eac0={'count':0x0,'rows':[]};var _0x1bf3e8=_[_0x5f8d('0x26')](db[_0x5f8d('0x27')][_0x5f8d('0x28')],function(_0x2923ce){return{'name':_0x2923ce[_0x5f8d('0x29')],'type':_0x2923ce[_0x5f8d('0x2a')][_0x5f8d('0x2b')]};});_0x1dfc04['model']=_[_0x5f8d('0x26')](_0x1bf3e8,_0x5f8d('0x2c'));_0x1dfc04['query']=_['keys'](_0x52b5a8[_0x5f8d('0x2d')]);_0x1dfc04[_0x5f8d('0x2e')]=_[_0x5f8d('0x2f')](_0x1dfc04[_0x5f8d('0x30')],_0x1dfc04[_0x5f8d('0x2d')]);_0x168895[_0x5f8d('0x31')]=_['intersection'](_0x1dfc04[_0x5f8d('0x30')],qs[_0x5f8d('0x32')](_0x52b5a8[_0x5f8d('0x2d')][_0x5f8d('0x32')]));_0x168895[_0x5f8d('0x31')]=_0x168895[_0x5f8d('0x31')][_0x5f8d('0x33')]?_0x168895[_0x5f8d('0x31')]:_0x1dfc04['model'];if(!_0x52b5a8[_0x5f8d('0x2d')][_0x5f8d('0x34')](_0x5f8d('0x35'))){_0x168895['limit']=qs['limit'](_0x52b5a8['query'][_0x5f8d('0x1d')]);_0x168895['offset']=qs[_0x5f8d('0x1c')](_0x52b5a8[_0x5f8d('0x2d')][_0x5f8d('0x1c')]);}_0x168895[_0x5f8d('0x36')]=qs[_0x5f8d('0x37')](_0x52b5a8['query'][_0x5f8d('0x37')]);_0x168895[_0x5f8d('0x38')]=qs[_0x5f8d('0x2e')](_[_0x5f8d('0x39')](_0x52b5a8[_0x5f8d('0x2d')],_0x1dfc04[_0x5f8d('0x2e')]),_0x1bf3e8);if(_0x52b5a8[_0x5f8d('0x2d')][_0x5f8d('0x3a')]){_0x168895[_0x5f8d('0x38')]=_[_0x5f8d('0x3b')](_0x168895[_0x5f8d('0x38')],{'$or':_[_0x5f8d('0x26')](_0x1bf3e8,function(_0x7f4273){if(_0x7f4273[_0x5f8d('0x2a')]!==_0x5f8d('0x3c')){var _0x3c2ac5={};_0x3c2ac5[_0x7f4273['name']]={'$like':'%'+_0x52b5a8['query'][_0x5f8d('0x3a')]+'%'};return _0x3c2ac5;}})});}_0x168895=_[_0x5f8d('0x3b')]({},_0x168895,_0x52b5a8[_0x5f8d('0x3d')]);var _0x5f5388={'where':_0x168895[_0x5f8d('0x38')]};return db[_0x5f8d('0x27')][_0x5f8d('0x1e')](_0x5f5388)['then'](function(_0x31ec89){_0x46eac0[_0x5f8d('0x1e')]=_0x31ec89;if(_0x52b5a8[_0x5f8d('0x2d')][_0x5f8d('0x3e')]){_0x168895[_0x5f8d('0x3f')]=[{'all':!![]}];}return db[_0x5f8d('0x27')][_0x5f8d('0x40')](_0x168895);})[_0x5f8d('0x21')](function(_0x593025){_0x46eac0[_0x5f8d('0x41')]=_0x593025;return _0x46eac0;})[_0x5f8d('0x21')](respondWithFilteredResult(_0x397edd,_0x168895))[_0x5f8d('0x42')](handleError(_0x397edd,null));};exports[_0x5f8d('0x43')]=function(_0x8a8815,_0x30b8b3){var _0x1759d3={'raw':!![],'where':{'id':_0x8a8815[_0x5f8d('0x44')]['id']}},_0x1cdfce={};_0x1cdfce['model']=_[_0x5f8d('0x45')](db[_0x5f8d('0x27')][_0x5f8d('0x28')]);_0x1cdfce['query']=_[_0x5f8d('0x45')](_0x8a8815[_0x5f8d('0x2d')]);_0x1cdfce[_0x5f8d('0x2e')]=_['intersection'](_0x1cdfce['model'],_0x1cdfce[_0x5f8d('0x2d')]);_0x1759d3[_0x5f8d('0x31')]=_[_0x5f8d('0x2f')](_0x1cdfce[_0x5f8d('0x30')],qs[_0x5f8d('0x32')](_0x8a8815[_0x5f8d('0x2d')][_0x5f8d('0x32')]));_0x1759d3[_0x5f8d('0x31')]=_0x1759d3[_0x5f8d('0x31')][_0x5f8d('0x33')]?_0x1759d3[_0x5f8d('0x31')]:_0x1cdfce[_0x5f8d('0x30')];if(_0x8a8815[_0x5f8d('0x2d')][_0x5f8d('0x3e')]){_0x1759d3[_0x5f8d('0x3f')]=[{'all':!![]}];}_0x1759d3=_[_0x5f8d('0x3b')]({},_0x1759d3,_0x8a8815[_0x5f8d('0x3d')]);return db['FaxTransferReport'][_0x5f8d('0x46')](_0x1759d3)[_0x5f8d('0x21')](handleEntityNotFound(_0x30b8b3,null))[_0x5f8d('0x21')](respondWithResult(_0x30b8b3,null))['catch'](handleError(_0x30b8b3,null));};exports[_0x5f8d('0x47')]=function(_0x2b9b35,_0xc17e24){return db[_0x5f8d('0x27')]['create'](_0x2b9b35[_0x5f8d('0x48')],{})['then'](respondWithResult(_0xc17e24,0xc9))[_0x5f8d('0x42')](handleError(_0xc17e24,null));};exports[_0x5f8d('0x20')]=function(_0x4cc409,_0x38ca61){if(_0x4cc409[_0x5f8d('0x48')]['id']){delete _0x4cc409['body']['id'];}return db[_0x5f8d('0x27')][_0x5f8d('0x46')]({'where':{'id':_0x4cc409[_0x5f8d('0x44')]['id']}})[_0x5f8d('0x21')](handleEntityNotFound(_0x38ca61,null))[_0x5f8d('0x21')](saveUpdates(_0x4cc409[_0x5f8d('0x48')],null))[_0x5f8d('0x21')](respondWithResult(_0x38ca61,null))[_0x5f8d('0x42')](handleError(_0x38ca61,null));};exports[_0x5f8d('0x22')]=function(_0x46cc26,_0x46636b){return db[_0x5f8d('0x27')][_0x5f8d('0x46')]({'where':{'id':_0x46cc26['params']['id']}})[_0x5f8d('0x21')](handleEntityNotFound(_0x46636b,null))[_0x5f8d('0x21')](removeEntity(_0x46636b,null))[_0x5f8d('0x42')](handleError(_0x46636b,null));};exports[_0x5f8d('0x49')]=function(_0x41863b,_0xe448ba){return db['FaxTransferReport'][_0x5f8d('0x49')]()[_0x5f8d('0x21')](respondWithResult(_0xe448ba,null))[_0x5f8d('0x42')](handleError(_0xe448ba,null));}; \ No newline at end of file +var _0x139b=['body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','catch','show','params','intersection','find','create'];(function(_0x240ad5,_0x5e125b){var _0x9cc8f5=function(_0x1e376e){while(--_0x1e376e){_0x240ad5['push'](_0x240ad5['shift']());}};_0x9cc8f5(++_0x5e125b);}(_0x139b,0x12e));var _0xb139=function(_0x1c4545,_0x9bad83){_0x1c4545=_0x1c4545-0x0;var _0x1e13c0=_0x139b[_0x1c4545];return _0x1e13c0;};'use strict';var emlformat=require(_0xb139('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb139('0x1'));var rp=require('request-promise');var moment=require(_0xb139('0x2'));var BPromise=require(_0xb139('0x3'));var Mustache=require(_0xb139('0x4'));var util=require('util');var path=require(_0xb139('0x5'));var sox=require(_0xb139('0x6'));var csv=require(_0xb139('0x7'));var ejs=require(_0xb139('0x8'));var fs=require('fs');var fs_extra=require(_0xb139('0x9'));var _=require(_0xb139('0xa'));var squel=require(_0xb139('0xb'));var crypto=require(_0xb139('0xc'));var jsforce=require(_0xb139('0xd'));var deskjs=require(_0xb139('0xe'));var toCsv=require(_0xb139('0x7'));var querystring=require(_0xb139('0xf'));var Papa=require(_0xb139('0x10'));var Redis=require('ioredis');var authService=require(_0xb139('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb139('0x12'));var hardwareService=require(_0xb139('0x13'));var logger=require(_0xb139('0x14'))(_0xb139('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb139('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x235308,_0x46e035){_0x46e035=_0x46e035||0xcc;return function(_0x455cef){if(_0x455cef){return _0x235308[_0xb139('0x17')](_0x46e035);}return _0x235308[_0xb139('0x18')](_0x46e035)[_0xb139('0x19')]();};}function respondWithResult(_0x19e0da,_0x1d0929){_0x1d0929=_0x1d0929||0xc8;return function(_0x23817a){if(_0x23817a){return _0x19e0da[_0xb139('0x18')](_0x1d0929)['json'](_0x23817a);}};}function respondWithFilteredResult(_0x3e06fd,_0x40d98){return function(_0x72c1f8){if(_0x72c1f8){var _0x501019=typeof _0x40d98[_0xb139('0x1a')]===_0xb139('0x1b')&&typeof _0x40d98['limit']===_0xb139('0x1b');var _0x38c9b6=_0x72c1f8['count'];var _0x1b007b=_0x501019?0x0:_0x40d98[_0xb139('0x1a')];var _0x56ef2b=_0x501019?_0x72c1f8[_0xb139('0x1c')]:_0x40d98[_0xb139('0x1a')]+_0x40d98[_0xb139('0x1d')];var _0x447f03;if(_0x56ef2b>=_0x38c9b6){_0x56ef2b=_0x38c9b6;_0x447f03=0xc8;}else{_0x447f03=0xce;}_0x3e06fd[_0xb139('0x18')](_0x447f03);return _0x3e06fd[_0xb139('0x1e')](_0xb139('0x1f'),_0x1b007b+'-'+_0x56ef2b+'/'+_0x38c9b6)['json'](_0x72c1f8);}return null;};}function patchUpdates(_0x3461c9){return function(_0x1c62b8){try{jsonpatch['apply'](_0x1c62b8,_0x3461c9,!![]);}catch(_0x575197){return BPromise[_0xb139('0x20')](_0x575197);}return _0x1c62b8[_0xb139('0x21')]();};}function saveUpdates(_0x2233bf,_0x32cab7){return function(_0x141233){if(_0x141233){return _0x141233[_0xb139('0x22')](_0x2233bf)['then'](function(_0x4597a1){return _0x4597a1;});}return null;};}function removeEntity(_0x40ca43,_0xcdcee7){return function(_0x475dc3){if(_0x475dc3){return _0x475dc3[_0xb139('0x23')]()['then'](function(){_0x40ca43[_0xb139('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b985,_0x5eb233){return function(_0x308d80){if(!_0x308d80){_0x35b985[_0xb139('0x17')](0x194);}return _0x308d80;};}function handleError(_0x2a3335,_0x4cc077){_0x4cc077=_0x4cc077||0x1f4;return function(_0x12291c){logger[_0xb139('0x24')](_0x12291c[_0xb139('0x25')]);if(_0x12291c[_0xb139('0x26')]){delete _0x12291c[_0xb139('0x26')];}_0x2a3335[_0xb139('0x18')](_0x4cc077)[_0xb139('0x27')](_0x12291c);};}exports[_0xb139('0x28')]=function(_0x32fe3a,_0x164a97){var _0x4a24ae={},_0x13cf9b={},_0xdd5ae6={'count':0x0,'rows':[]};var _0x49956e=_[_0xb139('0x29')](db[_0xb139('0x2a')][_0xb139('0x2b')],function(_0x487c19){return{'name':_0x487c19[_0xb139('0x2c')],'type':_0x487c19[_0xb139('0x2d')][_0xb139('0x2e')]};});_0x13cf9b[_0xb139('0x2f')]=_['map'](_0x49956e,_0xb139('0x26'));_0x13cf9b[_0xb139('0x30')]=_[_0xb139('0x31')](_0x32fe3a[_0xb139('0x30')]);_0x13cf9b[_0xb139('0x32')]=_['intersection'](_0x13cf9b[_0xb139('0x2f')],_0x13cf9b['query']);_0x4a24ae['attributes']=_['intersection'](_0x13cf9b['model'],qs['fields'](_0x32fe3a[_0xb139('0x30')][_0xb139('0x33')]));_0x4a24ae[_0xb139('0x34')]=_0x4a24ae[_0xb139('0x34')][_0xb139('0x35')]?_0x4a24ae[_0xb139('0x34')]:_0x13cf9b['model'];if(!_0x32fe3a[_0xb139('0x30')][_0xb139('0x36')](_0xb139('0x37'))){_0x4a24ae[_0xb139('0x1d')]=qs['limit'](_0x32fe3a[_0xb139('0x30')][_0xb139('0x1d')]);_0x4a24ae['offset']=qs[_0xb139('0x1a')](_0x32fe3a[_0xb139('0x30')][_0xb139('0x1a')]);}_0x4a24ae['order']=qs[_0xb139('0x38')](_0x32fe3a[_0xb139('0x30')][_0xb139('0x38')]);_0x4a24ae['where']=qs[_0xb139('0x32')](_[_0xb139('0x39')](_0x32fe3a[_0xb139('0x30')],_0x13cf9b[_0xb139('0x32')]),_0x49956e);if(_0x32fe3a[_0xb139('0x30')][_0xb139('0x3a')]){_0x4a24ae[_0xb139('0x3b')]=_[_0xb139('0x3c')](_0x4a24ae[_0xb139('0x3b')],{'$or':_['map'](_0x49956e,function(_0x2db5da){if(_0x2db5da[_0xb139('0x2d')]!=='VIRTUAL'){var _0x469727={};_0x469727[_0x2db5da['name']]={'$like':'%'+_0x32fe3a['query'][_0xb139('0x3a')]+'%'};return _0x469727;}})});}_0x4a24ae=_[_0xb139('0x3c')]({},_0x4a24ae,_0x32fe3a[_0xb139('0x3d')]);var _0x231f2f={'where':_0x4a24ae[_0xb139('0x3b')]};return db[_0xb139('0x2a')][_0xb139('0x1c')](_0x231f2f)[_0xb139('0x3e')](function(_0x2d7286){_0xdd5ae6[_0xb139('0x1c')]=_0x2d7286;if(_0x32fe3a['query'][_0xb139('0x3f')]){_0x4a24ae[_0xb139('0x40')]=[{'all':!![]}];}return db[_0xb139('0x2a')][_0xb139('0x41')](_0x4a24ae);})[_0xb139('0x3e')](function(_0x447769){_0xdd5ae6[_0xb139('0x42')]=_0x447769;return _0xdd5ae6;})[_0xb139('0x3e')](respondWithFilteredResult(_0x164a97,_0x4a24ae))[_0xb139('0x43')](handleError(_0x164a97,null));};exports[_0xb139('0x44')]=function(_0x500252,_0x3e094e){var _0x4c56e4={'raw':!![],'where':{'id':_0x500252[_0xb139('0x45')]['id']}},_0x1b9f03={};_0x1b9f03[_0xb139('0x2f')]=_[_0xb139('0x31')](db[_0xb139('0x2a')][_0xb139('0x2b')]);_0x1b9f03[_0xb139('0x30')]=_[_0xb139('0x31')](_0x500252[_0xb139('0x30')]);_0x1b9f03[_0xb139('0x32')]=_[_0xb139('0x46')](_0x1b9f03[_0xb139('0x2f')],_0x1b9f03[_0xb139('0x30')]);_0x4c56e4[_0xb139('0x34')]=_[_0xb139('0x46')](_0x1b9f03[_0xb139('0x2f')],qs['fields'](_0x500252['query'][_0xb139('0x33')]));_0x4c56e4['attributes']=_0x4c56e4['attributes']['length']?_0x4c56e4[_0xb139('0x34')]:_0x1b9f03[_0xb139('0x2f')];if(_0x500252[_0xb139('0x30')][_0xb139('0x3f')]){_0x4c56e4[_0xb139('0x40')]=[{'all':!![]}];}_0x4c56e4=_[_0xb139('0x3c')]({},_0x4c56e4,_0x500252[_0xb139('0x3d')]);return db[_0xb139('0x2a')][_0xb139('0x47')](_0x4c56e4)[_0xb139('0x3e')](handleEntityNotFound(_0x3e094e,null))['then'](respondWithResult(_0x3e094e,null))[_0xb139('0x43')](handleError(_0x3e094e,null));};exports[_0xb139('0x48')]=function(_0x1797c3,_0x1a727f){return db[_0xb139('0x2a')][_0xb139('0x48')](_0x1797c3[_0xb139('0x49')],{})[_0xb139('0x3e')](respondWithResult(_0x1a727f,0xc9))[_0xb139('0x43')](handleError(_0x1a727f,null));};exports[_0xb139('0x22')]=function(_0x4955d3,_0x48014f){if(_0x4955d3['body']['id']){delete _0x4955d3[_0xb139('0x49')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x4955d3[_0xb139('0x45')]['id']}})[_0xb139('0x3e')](handleEntityNotFound(_0x48014f,null))[_0xb139('0x3e')](saveUpdates(_0x4955d3[_0xb139('0x49')],null))[_0xb139('0x3e')](respondWithResult(_0x48014f,null))[_0xb139('0x43')](handleError(_0x48014f,null));};exports[_0xb139('0x23')]=function(_0x1115e3,_0x419c7c){return db[_0xb139('0x2a')][_0xb139('0x47')]({'where':{'id':_0x1115e3[_0xb139('0x45')]['id']}})[_0xb139('0x3e')](handleEntityNotFound(_0x419c7c,null))[_0xb139('0x3e')](removeEntity(_0x419c7c,null))[_0xb139('0x43')](handleError(_0x419c7c,null));};exports['describe']=function(_0x245b87,_0x378bb3){return db['FaxTransferReport'][_0xb139('0x4a')]()[_0xb139('0x3e')](respondWithResult(_0x378bb3,null))[_0xb139('0x43')](handleError(_0x378bb3,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7be8e74..4816bca 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 _0x5d07=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x5d07,0x11f));var _0x75d0=function(_0x431d47,_0x297de3){_0x431d47=_0x431d47-0x0;var _0x4c5f4f=_0x5d07[_0x431d47];return _0x4c5f4f;};'use strict';var _=require(_0x75d0('0x0'));var util=require(_0x75d0('0x1'));var logger=require(_0x75d0('0x2'))(_0x75d0('0x3'));var moment=require(_0x75d0('0x4'));var BPromise=require(_0x75d0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75d0('0x6'));var rimraf=require(_0x75d0('0x7'));var config=require(_0x75d0('0x8'));var attributes=require(_0x75d0('0x9'));module[_0x75d0('0xa')]=function(_0x491f78,_0x331ad3){return _0x491f78[_0x75d0('0xb')](_0x75d0('0xc'),attributes,{'tableName':_0x75d0('0xd'),'paranoid':![],'indexes':[{'name':_0x75d0('0xe'),'fields':[_0x75d0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6426=['moment','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x49fc48,_0x1c9e46){var _0xc50548=function(_0x479530){while(--_0x479530){_0x49fc48['push'](_0x49fc48['shift']());}};_0xc50548(++_0x1c9e46);}(_0x6426,0x15b));var _0x6642=function(_0x9e646,_0x474a87){_0x9e646=_0x9e646-0x0;var _0x44264e=_0x6426[_0x9e646];return _0x44264e;};'use strict';var _=require(_0x6642('0x0'));var util=require(_0x6642('0x1'));var logger=require(_0x6642('0x2'))(_0x6642('0x3'));var moment=require(_0x6642('0x4'));var BPromise=require('bluebird');var rp=require(_0x6642('0x5'));var fs=require('fs');var path=require(_0x6642('0x6'));var rimraf=require('rimraf');var config=require(_0x6642('0x7'));var attributes=require(_0x6642('0x8'));module[_0x6642('0x9')]=function(_0x217323,_0x40eddc){return _0x217323[_0x6642('0xa')]('FaxTransferReport',attributes,{'tableName':_0x6642('0xb'),'paranoid':![],'indexes':[{'name':_0x6642('0xc'),'fields':[_0x6642('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 31db507..2fc1e52 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 _0x7e4f=['info','request\x20sent','debug','stringify','FaxTransferReport,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7e4f,0x1c1));var _0xf7e4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7e4f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xf7e4('0x0'));var util=require('util');var moment=require(_0xf7e4('0x1'));var BPromise=require(_0xf7e4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7e4('0x3'))['db'];var utils=require(_0xf7e4('0x4'));var logger=require(_0xf7e4('0x5'))(_0xf7e4('0x6'));var config=require(_0xf7e4('0x7'));var jayson=require(_0xf7e4('0x8'));var client=jayson[_0xf7e4('0x9')][_0xf7e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x546f5d,_0x4f8735,_0x2d7ca6){return new BPromise(function(_0x30f548,_0x39f39b){return client[_0xf7e4('0xb')](_0x546f5d,_0x2d7ca6)[_0xf7e4('0xc')](function(_0x5476ac){logger[_0xf7e4('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x4f8735,_0xf7e4('0xe'));logger[_0xf7e4('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x4f8735,'request\x20sent',JSON[_0xf7e4('0x10')](_0x5476ac));if(_0x5476ac['error']){if(_0x5476ac['error']['code']===0x1f4){logger['error'](_0xf7e4('0x11'),_0x4f8735,_0x5476ac[_0xf7e4('0x12')][_0xf7e4('0x13')]);return _0x39f39b(_0x5476ac[_0xf7e4('0x12')]['message']);}logger[_0xf7e4('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x4f8735,_0x5476ac[_0xf7e4('0x12')][_0xf7e4('0x13')]);return _0x30f548(_0x5476ac[_0xf7e4('0x12')][_0xf7e4('0x13')]);}else{logger[_0xf7e4('0xd')](_0xf7e4('0x11'),_0x4f8735,_0xf7e4('0xe'));_0x30f548(_0x5476ac[_0xf7e4('0x14')]['message']);}})[_0xf7e4('0x15')](function(_0x507c1b){logger[_0xf7e4('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x4f8735,_0x507c1b);_0x39f39b(_0x507c1b);});});} \ No newline at end of file +var _0x1450=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x1450,0xda));var _0x0145=function(_0xa01473,_0xf2386e){_0xa01473=_0xa01473-0x0;var _0x1c0870=_0x1450[_0xa01473];return _0x1c0870;};'use strict';var _=require(_0x0145('0x0'));var util=require(_0x0145('0x1'));var moment=require(_0x0145('0x2'));var BPromise=require(_0x0145('0x3'));var rs=require(_0x0145('0x4'));var fs=require('fs');var Redis=require(_0x0145('0x5'));var db=require(_0x0145('0x6'))['db'];var utils=require(_0x0145('0x7'));var logger=require(_0x0145('0x8'))(_0x0145('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0145('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x564586,_0x4942d5,_0x5f1576){return new BPromise(function(_0x1744b8,_0x2168ba){return client[_0x0145('0xb')](_0x564586,_0x5f1576)['then'](function(_0x27774b){logger[_0x0145('0xc')](_0x0145('0xd'),_0x4942d5,_0x0145('0xe'));logger['debug'](_0x0145('0xf'),_0x4942d5,'request\x20sent',JSON['stringify'](_0x27774b));if(_0x27774b[_0x0145('0x10')]){if(_0x27774b[_0x0145('0x10')][_0x0145('0x11')]===0x1f4){logger['error'](_0x0145('0xd'),_0x4942d5,_0x27774b['error'][_0x0145('0x12')]);return _0x2168ba(_0x27774b[_0x0145('0x10')][_0x0145('0x12')]);}logger[_0x0145('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x4942d5,_0x27774b['error'][_0x0145('0x12')]);return _0x1744b8(_0x27774b['error']['message']);}else{logger['info'](_0x0145('0xd'),_0x4942d5,_0x0145('0xe'));_0x1744b8(_0x27774b[_0x0145('0x13')]['message']);}})[_0x0145('0x14')](function(_0x437441){logger[_0x0145('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x4942d5,_0x437441);_0x2168ba(_0x437441);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3546b14..60e8887 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 _0x63f2=['util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2a2f92,_0x3ecf80){var _0x93a5f7=function(_0x2fd7fd){while(--_0x2fd7fd){_0x2a2f92['push'](_0x2a2f92['shift']());}};_0x93a5f7(++_0x3ecf80);}(_0x63f2,0x1cd));var _0x263f=function(_0x4662ca,_0x1d8200){_0x4662ca=_0x4662ca-0x0;var _0x30eee6=_0x63f2[_0x4662ca];return _0x30eee6;};'use strict';var multer=require(_0x263f('0x0'));var util=require(_0x263f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x263f('0x2'));var router=express['Router']();var fs_extra=require(_0x263f('0x3'));var auth=require(_0x263f('0x4'));var interaction=require(_0x263f('0x5'));var config=require(_0x263f('0x6'));var controller=require(_0x263f('0x7'));router['get']('/',auth[_0x263f('0x8')](),controller[_0x263f('0x9')]);router[_0x263f('0xa')](_0x263f('0xb'),auth[_0x263f('0x8')](),controller[_0x263f('0xc')]);router[_0x263f('0xa')](_0x263f('0xd'),auth[_0x263f('0x8')](),controller['show']);router[_0x263f('0xe')]('/',auth[_0x263f('0x8')](),controller[_0x263f('0xf')]);router[_0x263f('0x10')](_0x263f('0xd'),auth[_0x263f('0x8')](),controller[_0x263f('0x11')]);router[_0x263f('0x12')](_0x263f('0xd'),auth['isAuthenticated'](),controller[_0x263f('0x13')]);module[_0x263f('0x14')]=router; \ No newline at end of file +var _0xd9bb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x54193e,_0xd18505){var _0x1303f5=function(_0x577ac2){while(--_0x577ac2){_0x54193e['push'](_0x54193e['shift']());}};_0x1303f5(++_0xd18505);}(_0xd9bb,0xa4));var _0xbd9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9bb[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbd9b('0x0'));var util=require(_0xbd9b('0x1'));var path=require(_0xbd9b('0x2'));var timeout=require(_0xbd9b('0x3'));var express=require('express');var router=express[_0xbd9b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbd9b('0x5'));var interaction=require(_0xbd9b('0x6'));var config=require(_0xbd9b('0x7'));var controller=require(_0xbd9b('0x8'));router['get']('/',auth[_0xbd9b('0x9')](),controller[_0xbd9b('0xa')]);router[_0xbd9b('0xb')](_0xbd9b('0xc'),auth[_0xbd9b('0x9')](),controller[_0xbd9b('0xd')]);router['get']('/:id',auth[_0xbd9b('0x9')](),controller['show']);router[_0xbd9b('0xe')]('/',auth['isAuthenticated'](),controller[_0xbd9b('0xf')]);router[_0xbd9b('0x10')](_0xbd9b('0x11'),auth[_0xbd9b('0x9')](),controller[_0xbd9b('0x12')]);router[_0xbd9b('0x13')](_0xbd9b('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xbd9b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c66ab6d..efb8b26 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 _0x3200=['post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x48241e,_0x52f671){var _0x299d1f=function(_0x3db753){while(--_0x3db753){_0x48241e['push'](_0x48241e['shift']());}};_0x299d1f(++_0x52f671);}(_0x3200,0x1ad));var _0x0320=function(_0x5e60ae,_0x531daa){_0x5e60ae=_0x5e60ae-0x0;var _0x388ac7=_0x3200[_0x5e60ae];return _0x388ac7;};'use strict';var multer=require(_0x0320('0x0'));var util=require(_0x0320('0x1'));var path=require(_0x0320('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0320('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0320('0x4'));var controller=require(_0x0320('0x5'));router[_0x0320('0x6')]('/',auth[_0x0320('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0320('0x6')](_0x0320('0x8'),auth['isAuthenticated'](),controller[_0x0320('0x9')]);router[_0x0320('0x6')](_0x0320('0xa'),auth['isAuthenticated'](),controller[_0x0320('0xb')]);router[_0x0320('0xc')]('/',auth[_0x0320('0x7')](),controller[_0x0320('0xd')]);router[_0x0320('0xc')](_0x0320('0x8'),auth[_0x0320('0x7')](),controller[_0x0320('0xe')]);router[_0x0320('0xf')](_0x0320('0x10'),auth['isAuthenticated'](),controller[_0x0320('0x11')]);router[_0x0320('0x12')]('/:id',auth[_0x0320('0x7')](),controller[_0x0320('0x13')]);module[_0x0320('0x14')]=router; \ No newline at end of file +var _0xcb20=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','/:id','update','delete','destroy'];(function(_0x18aa2a,_0x251095){var _0x300e3c=function(_0x2e33e2){while(--_0x2e33e2){_0x18aa2a['push'](_0x18aa2a['shift']());}};_0x300e3c(++_0x251095);}(_0xcb20,0x177));var _0x0cb2=function(_0x44624a,_0x4e868a){_0x44624a=_0x44624a-0x0;var _0x58b641=_0xcb20[_0x44624a];return _0x58b641;};'use strict';var multer=require(_0x0cb2('0x0'));var util=require(_0x0cb2('0x1'));var path=require('path');var timeout=require(_0x0cb2('0x2'));var express=require(_0x0cb2('0x3'));var router=express[_0x0cb2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0cb2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0cb2('0x6'));var controller=require('./intDeskAccount.controller');router[_0x0cb2('0x7')]('/',auth[_0x0cb2('0x8')](),controller[_0x0cb2('0x9')]);router['get']('/:id',auth[_0x0cb2('0x8')](),controller[_0x0cb2('0xa')]);router[_0x0cb2('0x7')](_0x0cb2('0xb'),auth[_0x0cb2('0x8')](),controller[_0x0cb2('0xc')]);router[_0x0cb2('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0cb2('0xd')]);router[_0x0cb2('0xe')]('/',auth[_0x0cb2('0x8')](),controller[_0x0cb2('0xf')]);router['post'](_0x0cb2('0xb'),auth[_0x0cb2('0x8')](),controller[_0x0cb2('0x10')]);router['put'](_0x0cb2('0x11'),auth[_0x0cb2('0x8')](),controller[_0x0cb2('0x12')]);router[_0x0cb2('0x13')](_0x0cb2('0x11'),auth[_0x0cb2('0x8')](),controller[_0x0cb2('0x14')]);module[_0x0cb2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index c94ecb1..78e8c3d 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 _0xeb38=['newTab','integrationTab','sequelize','exports','STRING','basic','ENUM'];(function(_0xddcb6f,_0x34f5c1){var _0x22a491=function(_0x240b1c){while(--_0x240b1c){_0xddcb6f['push'](_0xddcb6f['shift']());}};_0x22a491(++_0x34f5c1);}(_0xeb38,0x6b));var _0x8eb3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xeb38[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x8eb3('0x0'));module[_0x8eb3('0x1')]={'name':{'type':Sequelize[_0x8eb3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8eb3('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x8eb3('0x3')),'defaultValue':_0x8eb3('0x3')},'password':{'type':Sequelize[_0x8eb3('0x2')]},'consumerKey':{'type':Sequelize[_0x8eb3('0x2')]},'consumerSecret':{'type':Sequelize[_0x8eb3('0x2')]},'token':{'type':Sequelize[_0x8eb3('0x2')]},'tokenSecret':{'type':Sequelize[_0x8eb3('0x2')]},'serverUrl':{'type':Sequelize[_0x8eb3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8eb3('0x4')]('integrationTab',_0x8eb3('0x5')),'defaultValue':_0x8eb3('0x6')}}; \ No newline at end of file +var _0xe406=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x447a41,_0xca926){var _0x108ec6=function(_0x4a49e8){while(--_0x4a49e8){_0x447a41['push'](_0x447a41['shift']());}};_0x108ec6(++_0xca926);}(_0xe406,0x125));var _0x6e40=function(_0x47af95,_0x5beef9){_0x47af95=_0x47af95-0x0;var _0x534d8=_0xe406[_0x47af95];return _0x534d8;};'use strict';var Sequelize=require(_0x6e40('0x0'));module[_0x6e40('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6e40('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x6e40('0x3')](_0x6e40('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x6e40('0x2')]},'consumerKey':{'type':Sequelize[_0x6e40('0x2')]},'consumerSecret':{'type':Sequelize[_0x6e40('0x2')]},'token':{'type':Sequelize[_0x6e40('0x2')]},'tokenSecret':{'type':Sequelize[_0x6e40('0x2')]},'serverUrl':{'type':Sequelize[_0x6e40('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6e40('0x3')](_0x6e40('0x5'),_0x6e40('0x6')),'defaultValue':_0x6e40('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 8544c4a..3d1cb11 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 _0x7823=['label','test','statusCode','error','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','Authorization','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','active'];(function(_0x41e06c,_0x85cff6){var _0xc7e86d=function(_0x55ac80){while(--_0x55ac80){_0x41e06c['push'](_0x41e06c['shift']());}};_0xc7e86d(++_0x85cff6);}(_0x7823,0x1e1));var _0x3782=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7823[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x3782('0x0'));var rimraf=require(_0x3782('0x1'));var zipdir=require(_0x3782('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3782('0x3'));var moment=require(_0x3782('0x4'));var BPromise=require(_0x3782('0x5'));var Mustache=require(_0x3782('0x6'));var util=require('util');var path=require(_0x3782('0x7'));var sox=require('sox');var csv=require(_0x3782('0x8'));var ejs=require(_0x3782('0x9'));var fs=require('fs');var fs_extra=require(_0x3782('0xa'));var _=require('lodash');var squel=require(_0x3782('0xb'));var crypto=require(_0x3782('0xc'));var jsforce=require(_0x3782('0xd'));var deskjs=require(_0x3782('0xe'));var toCsv=require(_0x3782('0x8'));var querystring=require(_0x3782('0xf'));var Papa=require(_0x3782('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3782('0x11'));var hardwareService=require(_0x3782('0x12'));var logger=require(_0x3782('0x13'))(_0x3782('0x14'));var utils=require(_0x3782('0x15'));var config=require(_0x3782('0x16'));var licenseUtil=require(_0x3782('0x17'));var db=require(_0x3782('0x18'))['db'];var integrations=require(_0x3782('0x19'));function respondWithStatusCode(_0x508bc3,_0x11c774){_0x11c774=_0x11c774||0xcc;return function(_0x355fb7){if(_0x355fb7){return _0x508bc3[_0x3782('0x1a')](_0x11c774);}return _0x508bc3[_0x3782('0x1b')](_0x11c774)['end']();};}function respondWithResult(_0x35691b,_0x72b497){_0x72b497=_0x72b497||0xc8;return function(_0x28ed96){if(_0x28ed96){return _0x35691b['status'](_0x72b497)[_0x3782('0x1c')](_0x28ed96);}};}function respondWithFilteredResult(_0x578a6b,_0x15c151){return function(_0x5d7b11){if(_0x5d7b11){var _0x215d9f=typeof _0x15c151[_0x3782('0x1d')]==='undefined'&&typeof _0x15c151['limit']===_0x3782('0x1e');var _0x10019a=_0x5d7b11[_0x3782('0x1f')];var _0x4989cc=_0x215d9f?0x0:_0x15c151['offset'];var _0x5d4a0e=_0x215d9f?_0x5d7b11[_0x3782('0x1f')]:_0x15c151[_0x3782('0x1d')]+_0x15c151[_0x3782('0x20')];var _0x2a41d6;if(_0x5d4a0e>=_0x10019a){_0x5d4a0e=_0x10019a;_0x2a41d6=0xc8;}else{_0x2a41d6=0xce;}_0x578a6b[_0x3782('0x1b')](_0x2a41d6);return _0x578a6b[_0x3782('0x21')](_0x3782('0x22'),_0x4989cc+'-'+_0x5d4a0e+'/'+_0x10019a)[_0x3782('0x1c')](_0x5d7b11);}return null;};}function patchUpdates(_0xd99205){return function(_0x408853){try{jsonpatch[_0x3782('0x23')](_0x408853,_0xd99205,!![]);}catch(_0x47955b){return BPromise[_0x3782('0x24')](_0x47955b);}return _0x408853[_0x3782('0x25')]();};}function saveUpdates(_0x204e27,_0x4c171c){return function(_0x501210){if(_0x501210){return _0x501210[_0x3782('0x26')](_0x204e27)[_0x3782('0x27')](function(_0xcae224){return _0xcae224;});}return null;};}function removeEntity(_0x160648,_0x209e33){return function(_0x51d12d){if(_0x51d12d){return _0x51d12d[_0x3782('0x28')]()[_0x3782('0x27')](function(){_0x160648[_0x3782('0x1b')](0xcc)[_0x3782('0x29')]();});}};}function handleEntityNotFound(_0x335053,_0x414467){return function(_0x4d6ecd){if(!_0x4d6ecd){_0x335053[_0x3782('0x1a')](0x194);}return _0x4d6ecd;};}function handleError(_0x3f934c,_0xb4277d){_0xb4277d=_0xb4277d||0x1f4;return function(_0x4e7f0b){logger['error'](_0x4e7f0b[_0x3782('0x2a')]);if(_0x4e7f0b[_0x3782('0x2b')]){delete _0x4e7f0b[_0x3782('0x2b')];}_0x3f934c[_0x3782('0x1b')](_0xb4277d)[_0x3782('0x2c')](_0x4e7f0b);};}exports[_0x3782('0x2d')]=function(_0x2afa39,_0x2a40cb){var _0x11bdf9={},_0x4c7e37={},_0x517894={'count':0x0,'rows':[]};var _0x330531=_[_0x3782('0x2e')](db[_0x3782('0x2f')][_0x3782('0x30')],function(_0x3b1924){return{'name':_0x3b1924[_0x3782('0x31')],'type':_0x3b1924[_0x3782('0x32')][_0x3782('0x33')]};});_0x4c7e37[_0x3782('0x34')]=_[_0x3782('0x2e')](_0x330531,'name');_0x4c7e37[_0x3782('0x35')]=_[_0x3782('0x36')](_0x2afa39[_0x3782('0x35')]);_0x4c7e37[_0x3782('0x37')]=_[_0x3782('0x38')](_0x4c7e37['model'],_0x4c7e37[_0x3782('0x35')]);_0x11bdf9[_0x3782('0x39')]=_[_0x3782('0x38')](_0x4c7e37[_0x3782('0x34')],qs['fields'](_0x2afa39[_0x3782('0x35')][_0x3782('0x3a')]));_0x11bdf9['attributes']=_0x11bdf9[_0x3782('0x39')][_0x3782('0x3b')]?_0x11bdf9[_0x3782('0x39')]:_0x4c7e37[_0x3782('0x34')];if(!_0x2afa39['query'][_0x3782('0x3c')](_0x3782('0x3d'))){_0x11bdf9[_0x3782('0x20')]=qs[_0x3782('0x20')](_0x2afa39[_0x3782('0x35')]['limit']);_0x11bdf9['offset']=qs['offset'](_0x2afa39[_0x3782('0x35')][_0x3782('0x1d')]);}_0x11bdf9[_0x3782('0x3e')]=qs[_0x3782('0x3f')](_0x2afa39['query'][_0x3782('0x3f')]);_0x11bdf9['where']=qs[_0x3782('0x37')](_[_0x3782('0x40')](_0x2afa39['query'],_0x4c7e37[_0x3782('0x37')]),_0x330531);if(_0x2afa39[_0x3782('0x35')]['filter']){_0x11bdf9['where']=_[_0x3782('0x41')](_0x11bdf9[_0x3782('0x42')],{'$or':_['map'](_0x330531,function(_0x47a9c6){if(_0x47a9c6['type']!==_0x3782('0x43')){var _0x4cdc0d={};_0x4cdc0d[_0x47a9c6[_0x3782('0x2b')]]={'$like':'%'+_0x2afa39['query'][_0x3782('0x44')]+'%'};return _0x4cdc0d;}})});}_0x11bdf9=_[_0x3782('0x41')]({},_0x11bdf9,_0x2afa39[_0x3782('0x45')]);var _0x26a682={'where':_0x11bdf9[_0x3782('0x42')]};return db[_0x3782('0x2f')]['count'](_0x26a682)[_0x3782('0x27')](function(_0x29dcca){_0x517894[_0x3782('0x1f')]=_0x29dcca;if(_0x2afa39[_0x3782('0x35')][_0x3782('0x46')]){_0x11bdf9[_0x3782('0x47')]=[{'all':!![]}];}return db[_0x3782('0x2f')][_0x3782('0x48')](_0x11bdf9);})[_0x3782('0x27')](function(_0x25f8c1){_0x517894[_0x3782('0x49')]=_0x25f8c1;return _0x517894;})[_0x3782('0x27')](respondWithFilteredResult(_0x2a40cb,_0x11bdf9))[_0x3782('0x4a')](handleError(_0x2a40cb,null));};exports[_0x3782('0x4b')]=function(_0xcc88a9,_0x107e0a){var _0x49b896={'raw':![],'where':{'id':_0xcc88a9[_0x3782('0x4c')]['id']}},_0x86468b={};_0x86468b[_0x3782('0x34')]=_['keys'](db[_0x3782('0x2f')][_0x3782('0x30')]);_0x86468b[_0x3782('0x35')]=_[_0x3782('0x36')](_0xcc88a9['query']);_0x86468b['filters']=_[_0x3782('0x38')](_0x86468b['model'],_0x86468b[_0x3782('0x35')]);_0x49b896[_0x3782('0x39')]=_[_0x3782('0x38')](_0x86468b[_0x3782('0x34')],qs['fields'](_0xcc88a9[_0x3782('0x35')][_0x3782('0x3a')]));_0x49b896[_0x3782('0x39')]=_0x49b896[_0x3782('0x39')][_0x3782('0x3b')]?_0x49b896['attributes']:_0x86468b[_0x3782('0x34')];if(_0xcc88a9[_0x3782('0x35')][_0x3782('0x46')]){_0x49b896[_0x3782('0x47')]=[{'all':!![]}];}_0x49b896=_[_0x3782('0x41')]({},_0x49b896,_0xcc88a9[_0x3782('0x45')]);return db[_0x3782('0x2f')]['find'](_0x49b896)[_0x3782('0x27')](handleEntityNotFound(_0x107e0a,null))[_0x3782('0x27')](respondWithResult(_0x107e0a,null))[_0x3782('0x4a')](handleError(_0x107e0a,null));};exports[_0x3782('0x4d')]=function(_0x13a246,_0x1aa60e){return db['DeskAccount'][_0x3782('0x4d')](_0x13a246[_0x3782('0x4e')],{})[_0x3782('0x27')](respondWithResult(_0x1aa60e,0xc9))[_0x3782('0x4a')](handleError(_0x1aa60e,null));};exports[_0x3782('0x26')]=function(_0x5d06e7,_0x4e3483){if(_0x5d06e7[_0x3782('0x4e')]['id']){delete _0x5d06e7['body']['id'];}return db[_0x3782('0x2f')][_0x3782('0x4f')]({'where':{'id':_0x5d06e7[_0x3782('0x4c')]['id']}})[_0x3782('0x27')](handleEntityNotFound(_0x4e3483,null))[_0x3782('0x27')](saveUpdates(_0x5d06e7[_0x3782('0x4e')],null))['then'](respondWithResult(_0x4e3483,null))[_0x3782('0x4a')](handleError(_0x4e3483,null));};exports[_0x3782('0x28')]=function(_0x10ea80,_0x3ca894){return db[_0x3782('0x2f')][_0x3782('0x4f')]({'where':{'id':_0x10ea80[_0x3782('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ca894,null))[_0x3782('0x27')](removeEntity(_0x3ca894,null))['catch'](handleError(_0x3ca894,null));};exports[_0x3782('0x50')]=function(_0x2433f2,_0x22dcd4,_0x23bafb){var _0x9bbb7d={};var _0x26948b={};var _0x122af6;var _0x3d9782;return db[_0x3782('0x2f')][_0x3782('0x51')]({'where':{'id':_0x2433f2[_0x3782('0x4c')]['id']}})[_0x3782('0x27')](handleEntityNotFound(_0x22dcd4,null))[_0x3782('0x27')](function(_0x585063){if(_0x585063){_0x122af6=_0x585063;_0x26948b[_0x3782('0x34')]=_[_0x3782('0x36')](db[_0x3782('0x52')][_0x3782('0x30')]);_0x26948b['query']=_['keys'](_0x2433f2[_0x3782('0x35')]);_0x26948b[_0x3782('0x37')]=_[_0x3782('0x38')](_0x26948b[_0x3782('0x34')],_0x26948b[_0x3782('0x35')]);_0x9bbb7d[_0x3782('0x39')]=_[_0x3782('0x38')](_0x26948b[_0x3782('0x34')],qs['fields'](_0x2433f2[_0x3782('0x35')]['fields']));_0x9bbb7d['attributes']=_0x9bbb7d[_0x3782('0x39')]['length']?_0x9bbb7d[_0x3782('0x39')]:_0x26948b['model'];_0x9bbb7d[_0x3782('0x3e')]=qs['sort'](_0x2433f2[_0x3782('0x35')][_0x3782('0x3f')]);_0x9bbb7d[_0x3782('0x42')]=qs[_0x3782('0x37')](_[_0x3782('0x40')](_0x2433f2[_0x3782('0x35')],_0x26948b[_0x3782('0x37')]));if(_0x2433f2['query'][_0x3782('0x44')]){_0x9bbb7d[_0x3782('0x42')]=_[_0x3782('0x41')](_0x9bbb7d[_0x3782('0x42')],{'$or':_[_0x3782('0x2e')](_0x9bbb7d['attributes'],function(_0x43759b){var _0x426cb1={};_0x426cb1[_0x43759b]={'$like':'%'+_0x2433f2[_0x3782('0x35')]['filter']+'%'};return _0x426cb1;})});}_0x9bbb7d=_[_0x3782('0x41')]({},_0x9bbb7d,_0x2433f2[_0x3782('0x45')]);return _0x122af6['getConfigurations'](_0x9bbb7d);}})[_0x3782('0x27')](function(_0x310fdb){if(_0x310fdb){_0x3d9782=_0x310fdb[_0x3782('0x3b')];if(!_0x2433f2[_0x3782('0x35')][_0x3782('0x3c')](_0x3782('0x3d'))){_0x9bbb7d[_0x3782('0x20')]=qs[_0x3782('0x20')](_0x2433f2['query']['limit']);_0x9bbb7d[_0x3782('0x1d')]=qs[_0x3782('0x1d')](_0x2433f2[_0x3782('0x35')][_0x3782('0x1d')]);}return _0x122af6[_0x3782('0x50')](_0x9bbb7d);}})[_0x3782('0x27')](function(_0x6456fe){if(_0x6456fe){return _0x6456fe?{'count':_0x3d9782,'rows':_0x6456fe}:null;}})[_0x3782('0x27')](respondWithResult(_0x22dcd4,null))[_0x3782('0x4a')](handleError(_0x22dcd4,null));};exports[_0x3782('0x53')]=function(_0x4069a5,_0x1ca00e,_0x4dfbcf){if(_0x4069a5[_0x3782('0x4e')]['id']){delete _0x4069a5[_0x3782('0x4e')]['id'];}return db['DeskAccount'][_0x3782('0x51')]({'where':{'id':_0x4069a5[_0x3782('0x4c')]['id']}})[_0x3782('0x27')](handleEntityNotFound(_0x1ca00e,null))[_0x3782('0x27')](function(_0xc9340){if(_0xc9340){_0x4069a5['body'][_0x3782('0x54')]=_0xc9340['id'];_0x4069a5[_0x3782('0x4e')][_0x3782('0x55')]=integrations['getSubjects'](_0x4069a5[_0x3782('0x4e')][_0x3782('0x56')],_0x4069a5['body'][_0x3782('0x32')]);_0x4069a5[_0x3782('0x4e')]['Descriptions']=integrations[_0x3782('0x57')](_0x4069a5['body']['channel'],_0x4069a5[_0x3782('0x4e')]['type']);return db[_0x3782('0x52')][_0x3782('0x4d')](_0x4069a5[_0x3782('0x4e')],{'include':[{'model':db[_0x3782('0x58')],'as':_0x3782('0x55')},{'model':db[_0x3782('0x58')],'as':_0x3782('0x59')}]});}return null;})[_0x3782('0x27')](respondWithResult(_0x1ca00e,null))[_0x3782('0x4a')](handleError(_0x1ca00e,null));};exports[_0x3782('0x5a')]=function(_0x204489,_0xfa168a,_0x31f598){var _0x1277b0=[{'name':_0x3782('0x5b'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x423f4e='';return db[_0x3782('0x2f')]['findOne']({'where':{'id':_0x204489['params']['id']},'attributes':['id',_0x3782('0x5c'),_0x3782('0x5d'),_0x3782('0x5e'),'password','consumerKey',_0x3782('0x5f'),_0x3782('0x60'),_0x3782('0x61')]})[_0x3782('0x27')](handleEntityNotFound(_0xfa168a,null))['then'](function(_0x10b11d){if(_0x10b11d){_0x423f4e=_0x10b11d['remoteUri'];var _0x50e900=_0x423f4e[_0x3782('0x62')](-0x1);if(_0x50e900==='/'){_0x423f4e=_0x423f4e[_0x3782('0x63')](0x0,_0x423f4e['lastIndexOf'](_0x50e900));}var _0x490fd3={'method':_0x3782('0x64'),'uri':util[_0x3782('0x65')](_0x3782('0x66'),_0x423f4e),'headers':{'Content-Type':'application/json','Accept':_0x3782('0x67')},'json':!![]};if(_0x10b11d[_0x3782('0x5d')]==='basic'){_0x490fd3['headers'][_0x3782('0x68')]=util[_0x3782('0x65')](_0x3782('0x69'),new Buffer(util[_0x3782('0x65')](_0x3782('0x6a'),_0x10b11d['username'],_0x10b11d[_0x3782('0x6b')]))[_0x3782('0x6c')](_0x3782('0x6d')));}return rp(_0x490fd3)[_0x3782('0x27')](function(_0x5ca553){return _0x1277b0[_0x3782('0x6e')](_['map'](_0x5ca553[_0x3782('0x6f')][_0x3782('0x70')],function(_0x33ac7f){return{'id':_0x33ac7f[_0x3782('0x2b')],'name':_0x33ac7f['name'],'type':_0x33ac7f[_0x3782('0x32')],'active':_0x33ac7f[_0x3782('0x71')],'label':_0x33ac7f[_0x3782('0x72')],'custom':!![]};}));});}})[_0x3782('0x27')](function(_0xa5e841){return{'count':_0xa5e841['length'],'rows':_0xa5e841};})[_0x3782('0x27')](respondWithResult(_0xfa168a,null))[_0x3782('0x4a')](function(_0x45a570){var _0x3319f3=_0x204489['query'][_0x3782('0x73')]?0x1f4:_0x45a570[_0x3782('0x74')]||0x1f4;logger[_0x3782('0x75')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3319f3,JSON['stringify'](_0x45a570));delete _0x45a570[_0x3782('0x2b')];if(_0x3319f3===0x191){_0x3319f3=0x190;}_0xfa168a[_0x3782('0x1b')](_0x3319f3)[_0x3782('0x2c')](_0x204489[_0x3782('0x35')][_0x3782('0x73')]?{'message':_0x3782('0x76'),'statusCode':_0x45a570[_0x3782('0x74')]}:_0x45a570);});}; \ No newline at end of file +var _0x1e3c=['basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','Subjects','getSubjects','getDescriptions','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','tokenSecret','slice','substring','GET','format','application/json'];(function(_0x3aa3b4,_0x417691){var _0x24c99b=function(_0xc4b9f8){while(--_0xc4b9f8){_0x3aa3b4['push'](_0x3aa3b4['shift']());}};_0x24c99b(++_0x417691);}(_0x1e3c,0x1e8));var _0xc1e3=function(_0x237120,_0x2e7c40){_0x237120=_0x237120-0x0;var _0x5d7957=_0x1e3c[_0x237120];return _0x5d7957;};'use strict';var emlformat=require(_0xc1e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1e3('0x1'));var jsonpatch=require(_0xc1e3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc1e3('0x3'));var Mustache=require(_0xc1e3('0x4'));var util=require('util');var path=require(_0xc1e3('0x5'));var sox=require(_0xc1e3('0x6'));var csv=require('to-csv');var ejs=require(_0xc1e3('0x7'));var fs=require('fs');var fs_extra=require(_0xc1e3('0x8'));var _=require(_0xc1e3('0x9'));var squel=require('squel');var crypto=require(_0xc1e3('0xa'));var jsforce=require(_0xc1e3('0xb'));var deskjs=require(_0xc1e3('0xc'));var toCsv=require(_0xc1e3('0xd'));var querystring=require(_0xc1e3('0xe'));var Papa=require(_0xc1e3('0xf'));var Redis=require(_0xc1e3('0x10'));var authService=require(_0xc1e3('0x11'));var qs=require(_0xc1e3('0x12'));var as=require(_0xc1e3('0x13'));var hardwareService=require(_0xc1e3('0x14'));var logger=require('../../config/logger')(_0xc1e3('0x15'));var utils=require(_0xc1e3('0x16'));var config=require(_0xc1e3('0x17'));var licenseUtil=require(_0xc1e3('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc1e3('0x19'));function respondWithStatusCode(_0x2e3eb1,_0x18cb5d){_0x18cb5d=_0x18cb5d||0xcc;return function(_0x1ca0dc){if(_0x1ca0dc){return _0x2e3eb1[_0xc1e3('0x1a')](_0x18cb5d);}return _0x2e3eb1[_0xc1e3('0x1b')](_0x18cb5d)[_0xc1e3('0x1c')]();};}function respondWithResult(_0x1df242,_0x5dd7f9){_0x5dd7f9=_0x5dd7f9||0xc8;return function(_0xd48942){if(_0xd48942){return _0x1df242[_0xc1e3('0x1b')](_0x5dd7f9)['json'](_0xd48942);}};}function respondWithFilteredResult(_0x3367d3,_0x39569e){return function(_0x68279b){if(_0x68279b){var _0x18c5ef=typeof _0x39569e[_0xc1e3('0x1d')]===_0xc1e3('0x1e')&&typeof _0x39569e[_0xc1e3('0x1f')]==='undefined';var _0x4f4e6c=_0x68279b[_0xc1e3('0x20')];var _0x27130e=_0x18c5ef?0x0:_0x39569e[_0xc1e3('0x1d')];var _0x30bb90=_0x18c5ef?_0x68279b[_0xc1e3('0x20')]:_0x39569e[_0xc1e3('0x1d')]+_0x39569e[_0xc1e3('0x1f')];var _0x56a7ec;if(_0x30bb90>=_0x4f4e6c){_0x30bb90=_0x4f4e6c;_0x56a7ec=0xc8;}else{_0x56a7ec=0xce;}_0x3367d3[_0xc1e3('0x1b')](_0x56a7ec);return _0x3367d3['set'](_0xc1e3('0x21'),_0x27130e+'-'+_0x30bb90+'/'+_0x4f4e6c)[_0xc1e3('0x22')](_0x68279b);}return null;};}function patchUpdates(_0x31fc06){return function(_0x4dc69c){try{jsonpatch[_0xc1e3('0x23')](_0x4dc69c,_0x31fc06,!![]);}catch(_0x7c5227){return BPromise[_0xc1e3('0x24')](_0x7c5227);}return _0x4dc69c[_0xc1e3('0x25')]();};}function saveUpdates(_0x405099,_0x37c329){return function(_0x3d6fca){if(_0x3d6fca){return _0x3d6fca[_0xc1e3('0x26')](_0x405099)['then'](function(_0x2ddb64){return _0x2ddb64;});}return null;};}function removeEntity(_0x28fea1,_0x2b6b98){return function(_0x3e685f){if(_0x3e685f){return _0x3e685f[_0xc1e3('0x27')]()[_0xc1e3('0x28')](function(){_0x28fea1[_0xc1e3('0x1b')](0xcc)[_0xc1e3('0x1c')]();});}};}function handleEntityNotFound(_0x7ae6cd,_0xe072b2){return function(_0xaefd86){if(!_0xaefd86){_0x7ae6cd[_0xc1e3('0x1a')](0x194);}return _0xaefd86;};}function handleError(_0x260638,_0x31a719){_0x31a719=_0x31a719||0x1f4;return function(_0x4b534c){logger[_0xc1e3('0x29')](_0x4b534c[_0xc1e3('0x2a')]);if(_0x4b534c[_0xc1e3('0x2b')]){delete _0x4b534c['name'];}_0x260638[_0xc1e3('0x1b')](_0x31a719)[_0xc1e3('0x2c')](_0x4b534c);};}exports[_0xc1e3('0x2d')]=function(_0xe647f,_0x481458){var _0x500d70={},_0x1f3b72={},_0x4a0d8a={'count':0x0,'rows':[]};var _0x4d5700=_[_0xc1e3('0x2e')](db[_0xc1e3('0x2f')][_0xc1e3('0x30')],function(_0x4b7165){return{'name':_0x4b7165[_0xc1e3('0x31')],'type':_0x4b7165[_0xc1e3('0x32')]['key']};});_0x1f3b72[_0xc1e3('0x33')]=_['map'](_0x4d5700,_0xc1e3('0x2b'));_0x1f3b72[_0xc1e3('0x34')]=_[_0xc1e3('0x35')](_0xe647f[_0xc1e3('0x34')]);_0x1f3b72[_0xc1e3('0x36')]=_[_0xc1e3('0x37')](_0x1f3b72[_0xc1e3('0x33')],_0x1f3b72[_0xc1e3('0x34')]);_0x500d70[_0xc1e3('0x38')]=_[_0xc1e3('0x37')](_0x1f3b72[_0xc1e3('0x33')],qs[_0xc1e3('0x39')](_0xe647f[_0xc1e3('0x34')][_0xc1e3('0x39')]));_0x500d70[_0xc1e3('0x38')]=_0x500d70[_0xc1e3('0x38')][_0xc1e3('0x3a')]?_0x500d70['attributes']:_0x1f3b72[_0xc1e3('0x33')];if(!_0xe647f['query'][_0xc1e3('0x3b')]('nolimit')){_0x500d70[_0xc1e3('0x1f')]=qs['limit'](_0xe647f[_0xc1e3('0x34')]['limit']);_0x500d70[_0xc1e3('0x1d')]=qs[_0xc1e3('0x1d')](_0xe647f[_0xc1e3('0x34')][_0xc1e3('0x1d')]);}_0x500d70[_0xc1e3('0x3c')]=qs['sort'](_0xe647f[_0xc1e3('0x34')][_0xc1e3('0x3d')]);_0x500d70[_0xc1e3('0x3e')]=qs[_0xc1e3('0x36')](_[_0xc1e3('0x3f')](_0xe647f[_0xc1e3('0x34')],_0x1f3b72[_0xc1e3('0x36')]),_0x4d5700);if(_0xe647f[_0xc1e3('0x34')][_0xc1e3('0x40')]){_0x500d70[_0xc1e3('0x3e')]=_[_0xc1e3('0x41')](_0x500d70[_0xc1e3('0x3e')],{'$or':_[_0xc1e3('0x2e')](_0x4d5700,function(_0x1a7653){if(_0x1a7653[_0xc1e3('0x32')]!==_0xc1e3('0x42')){var _0x3c1cf3={};_0x3c1cf3[_0x1a7653['name']]={'$like':'%'+_0xe647f[_0xc1e3('0x34')][_0xc1e3('0x40')]+'%'};return _0x3c1cf3;}})});}_0x500d70=_['merge']({},_0x500d70,_0xe647f[_0xc1e3('0x43')]);var _0x8892aa={'where':_0x500d70[_0xc1e3('0x3e')]};return db[_0xc1e3('0x2f')][_0xc1e3('0x20')](_0x8892aa)[_0xc1e3('0x28')](function(_0x267c35){_0x4a0d8a[_0xc1e3('0x20')]=_0x267c35;if(_0xe647f[_0xc1e3('0x34')]['includeAll']){_0x500d70[_0xc1e3('0x44')]=[{'all':!![]}];}return db['DeskAccount'][_0xc1e3('0x45')](_0x500d70);})[_0xc1e3('0x28')](function(_0x225c15){_0x4a0d8a[_0xc1e3('0x46')]=_0x225c15;return _0x4a0d8a;})[_0xc1e3('0x28')](respondWithFilteredResult(_0x481458,_0x500d70))['catch'](handleError(_0x481458,null));};exports[_0xc1e3('0x47')]=function(_0x2b4a8a,_0x25f96f){var _0x421c00={'raw':![],'where':{'id':_0x2b4a8a[_0xc1e3('0x48')]['id']}},_0x5cac6f={};_0x5cac6f[_0xc1e3('0x33')]=_[_0xc1e3('0x35')](db[_0xc1e3('0x2f')]['rawAttributes']);_0x5cac6f['query']=_[_0xc1e3('0x35')](_0x2b4a8a['query']);_0x5cac6f[_0xc1e3('0x36')]=_[_0xc1e3('0x37')](_0x5cac6f[_0xc1e3('0x33')],_0x5cac6f['query']);_0x421c00[_0xc1e3('0x38')]=_[_0xc1e3('0x37')](_0x5cac6f[_0xc1e3('0x33')],qs[_0xc1e3('0x39')](_0x2b4a8a[_0xc1e3('0x34')][_0xc1e3('0x39')]));_0x421c00[_0xc1e3('0x38')]=_0x421c00['attributes'][_0xc1e3('0x3a')]?_0x421c00['attributes']:_0x5cac6f[_0xc1e3('0x33')];if(_0x2b4a8a[_0xc1e3('0x34')][_0xc1e3('0x49')]){_0x421c00[_0xc1e3('0x44')]=[{'all':!![]}];}_0x421c00=_[_0xc1e3('0x41')]({},_0x421c00,_0x2b4a8a[_0xc1e3('0x43')]);return db[_0xc1e3('0x2f')][_0xc1e3('0x4a')](_0x421c00)[_0xc1e3('0x28')](handleEntityNotFound(_0x25f96f,null))[_0xc1e3('0x28')](respondWithResult(_0x25f96f,null))[_0xc1e3('0x4b')](handleError(_0x25f96f,null));};exports[_0xc1e3('0x4c')]=function(_0x5bc4c9,_0x51861a){return db[_0xc1e3('0x2f')][_0xc1e3('0x4c')](_0x5bc4c9['body'],{})[_0xc1e3('0x28')](respondWithResult(_0x51861a,0xc9))[_0xc1e3('0x4b')](handleError(_0x51861a,null));};exports[_0xc1e3('0x26')]=function(_0x2ebbb7,_0x23b738){if(_0x2ebbb7[_0xc1e3('0x4d')]['id']){delete _0x2ebbb7[_0xc1e3('0x4d')]['id'];}return db[_0xc1e3('0x2f')][_0xc1e3('0x4a')]({'where':{'id':_0x2ebbb7['params']['id']}})[_0xc1e3('0x28')](handleEntityNotFound(_0x23b738,null))[_0xc1e3('0x28')](saveUpdates(_0x2ebbb7[_0xc1e3('0x4d')],null))[_0xc1e3('0x28')](respondWithResult(_0x23b738,null))[_0xc1e3('0x4b')](handleError(_0x23b738,null));};exports[_0xc1e3('0x27')]=function(_0x5a3daf,_0x472c4d){return db[_0xc1e3('0x2f')]['find']({'where':{'id':_0x5a3daf[_0xc1e3('0x48')]['id']}})[_0xc1e3('0x28')](handleEntityNotFound(_0x472c4d,null))['then'](removeEntity(_0x472c4d,null))[_0xc1e3('0x4b')](handleError(_0x472c4d,null));};exports[_0xc1e3('0x4e')]=function(_0x8164c7,_0x453aaf,_0x15aaa1){var _0x534c69={};var _0x32d093={};var _0x160c5d;var _0x279135;return db[_0xc1e3('0x2f')][_0xc1e3('0x4f')]({'where':{'id':_0x8164c7[_0xc1e3('0x48')]['id']}})[_0xc1e3('0x28')](handleEntityNotFound(_0x453aaf,null))[_0xc1e3('0x28')](function(_0x877e4c){if(_0x877e4c){_0x160c5d=_0x877e4c;_0x32d093[_0xc1e3('0x33')]=_[_0xc1e3('0x35')](db[_0xc1e3('0x50')][_0xc1e3('0x30')]);_0x32d093[_0xc1e3('0x34')]=_[_0xc1e3('0x35')](_0x8164c7[_0xc1e3('0x34')]);_0x32d093['filters']=_[_0xc1e3('0x37')](_0x32d093[_0xc1e3('0x33')],_0x32d093[_0xc1e3('0x34')]);_0x534c69[_0xc1e3('0x38')]=_['intersection'](_0x32d093[_0xc1e3('0x33')],qs['fields'](_0x8164c7['query']['fields']));_0x534c69[_0xc1e3('0x38')]=_0x534c69[_0xc1e3('0x38')][_0xc1e3('0x3a')]?_0x534c69[_0xc1e3('0x38')]:_0x32d093[_0xc1e3('0x33')];_0x534c69[_0xc1e3('0x3c')]=qs[_0xc1e3('0x3d')](_0x8164c7['query'][_0xc1e3('0x3d')]);_0x534c69['where']=qs[_0xc1e3('0x36')](_['pick'](_0x8164c7[_0xc1e3('0x34')],_0x32d093[_0xc1e3('0x36')]));if(_0x8164c7[_0xc1e3('0x34')][_0xc1e3('0x40')]){_0x534c69['where']=_[_0xc1e3('0x41')](_0x534c69[_0xc1e3('0x3e')],{'$or':_[_0xc1e3('0x2e')](_0x534c69[_0xc1e3('0x38')],function(_0x6eecb6){var _0x32c8f6={};_0x32c8f6[_0x6eecb6]={'$like':'%'+_0x8164c7[_0xc1e3('0x34')][_0xc1e3('0x40')]+'%'};return _0x32c8f6;})});}_0x534c69=_[_0xc1e3('0x41')]({},_0x534c69,_0x8164c7[_0xc1e3('0x43')]);return _0x160c5d[_0xc1e3('0x4e')](_0x534c69);}})[_0xc1e3('0x28')](function(_0xb6a402){if(_0xb6a402){_0x279135=_0xb6a402[_0xc1e3('0x3a')];if(!_0x8164c7[_0xc1e3('0x34')][_0xc1e3('0x3b')](_0xc1e3('0x51'))){_0x534c69[_0xc1e3('0x1f')]=qs[_0xc1e3('0x1f')](_0x8164c7[_0xc1e3('0x34')][_0xc1e3('0x1f')]);_0x534c69[_0xc1e3('0x1d')]=qs['offset'](_0x8164c7[_0xc1e3('0x34')][_0xc1e3('0x1d')]);}return _0x160c5d[_0xc1e3('0x4e')](_0x534c69);}})[_0xc1e3('0x28')](function(_0x3f8baa){if(_0x3f8baa){return _0x3f8baa?{'count':_0x279135,'rows':_0x3f8baa}:null;}})[_0xc1e3('0x28')](respondWithResult(_0x453aaf,null))[_0xc1e3('0x4b')](handleError(_0x453aaf,null));};exports[_0xc1e3('0x52')]=function(_0x543366,_0x19f88c,_0x1da511){if(_0x543366[_0xc1e3('0x4d')]['id']){delete _0x543366[_0xc1e3('0x4d')]['id'];}return db['DeskAccount'][_0xc1e3('0x4f')]({'where':{'id':_0x543366[_0xc1e3('0x48')]['id']}})[_0xc1e3('0x28')](handleEntityNotFound(_0x19f88c,null))[_0xc1e3('0x28')](function(_0x48979f){if(_0x48979f){_0x543366['body']['AccountId']=_0x48979f['id'];_0x543366[_0xc1e3('0x4d')][_0xc1e3('0x53')]=integrations[_0xc1e3('0x54')](_0x543366[_0xc1e3('0x4d')]['channel'],_0x543366[_0xc1e3('0x4d')][_0xc1e3('0x32')]);_0x543366[_0xc1e3('0x4d')]['Descriptions']=integrations[_0xc1e3('0x55')](_0x543366['body'][_0xc1e3('0x56')],_0x543366['body']['type']);return db[_0xc1e3('0x50')][_0xc1e3('0x4c')](_0x543366[_0xc1e3('0x4d')],{'include':[{'model':db[_0xc1e3('0x57')],'as':_0xc1e3('0x53')},{'model':db[_0xc1e3('0x57')],'as':_0xc1e3('0x58')}]});}return null;})['then'](respondWithResult(_0x19f88c,null))[_0xc1e3('0x4b')](handleError(_0x19f88c,null));};exports[_0xc1e3('0x59')]=function(_0x4c57f9,_0x3cc7f5,_0x15235e){var _0x1ef84d=[{'name':_0xc1e3('0x5a'),'label':_0xc1e3('0x5a'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x37bde7='';return db[_0xc1e3('0x2f')][_0xc1e3('0x4f')]({'where':{'id':_0x4c57f9['params']['id']},'attributes':['id',_0xc1e3('0x5b'),_0xc1e3('0x5c'),_0xc1e3('0x5d'),_0xc1e3('0x5e'),_0xc1e3('0x5f'),'consumerSecret','token',_0xc1e3('0x60')]})[_0xc1e3('0x28')](handleEntityNotFound(_0x3cc7f5,null))[_0xc1e3('0x28')](function(_0x44760c){if(_0x44760c){_0x37bde7=_0x44760c['remoteUri'];var _0x34e4f7=_0x37bde7[_0xc1e3('0x61')](-0x1);if(_0x34e4f7==='/'){_0x37bde7=_0x37bde7[_0xc1e3('0x62')](0x0,_0x37bde7['lastIndexOf'](_0x34e4f7));}var _0x3d6cd4={'method':_0xc1e3('0x63'),'uri':util[_0xc1e3('0x64')]('%s/custom_fields',_0x37bde7),'headers':{'Content-Type':'application/json','Accept':_0xc1e3('0x65')},'json':!![]};if(_0x44760c[_0xc1e3('0x5c')]===_0xc1e3('0x66')){_0x3d6cd4[_0xc1e3('0x67')][_0xc1e3('0x68')]=util[_0xc1e3('0x64')](_0xc1e3('0x69'),new Buffer(util[_0xc1e3('0x64')](_0xc1e3('0x6a'),_0x44760c[_0xc1e3('0x5d')],_0x44760c[_0xc1e3('0x5e')]))[_0xc1e3('0x6b')](_0xc1e3('0x6c')));}return rp(_0x3d6cd4)[_0xc1e3('0x28')](function(_0x13012a){return _0x1ef84d[_0xc1e3('0x6d')](_[_0xc1e3('0x2e')](_0x13012a['_embedded'][_0xc1e3('0x6e')],function(_0x1fc0fb){return{'id':_0x1fc0fb['name'],'name':_0x1fc0fb[_0xc1e3('0x2b')],'type':_0x1fc0fb['type'],'active':_0x1fc0fb[_0xc1e3('0x6f')],'label':_0x1fc0fb[_0xc1e3('0x70')],'custom':!![]};}));});}})[_0xc1e3('0x28')](function(_0x2f3f9a){return{'count':_0x2f3f9a[_0xc1e3('0x3a')],'rows':_0x2f3f9a};})['then'](respondWithResult(_0x3cc7f5,null))[_0xc1e3('0x4b')](function(_0x2fd4ad){var _0x5b9d1d=_0x4c57f9['query']['test']?0x1f4:_0x2fd4ad[_0xc1e3('0x71')]||0x1f4;logger[_0xc1e3('0x29')](_0xc1e3('0x72'),_0xc1e3('0x59'),_0x5b9d1d,JSON[_0xc1e3('0x73')](_0x2fd4ad));delete _0x2fd4ad[_0xc1e3('0x2b')];if(_0x5b9d1d===0x191){_0x5b9d1d=0x190;}_0x3cc7f5[_0xc1e3('0x1b')](_0x5b9d1d)[_0xc1e3('0x2c')](_0x4c57f9['query'][_0xc1e3('0x74')]?{'message':_0xc1e3('0x75'),'statusCode':_0x2fd4ad[_0xc1e3('0x71')]}:_0x2fd4ad);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f04e45b..1b9d24a 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 _0x34dd=['rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','../../config/logger','api','request-promise','path'];(function(_0x2b98d4,_0x1de753){var _0x76ce5b=function(_0x5bfe11){while(--_0x5bfe11){_0x2b98d4['push'](_0x2b98d4['shift']());}};_0x76ce5b(++_0x1de753);}(_0x34dd,0x8c));var _0xd34d=function(_0x54432b,_0x2e693b){_0x54432b=_0x54432b-0x0;var _0x82ba20=_0x34dd[_0x54432b];return _0x82ba20;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd34d('0x0'))(_0xd34d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd34d('0x2'));var fs=require('fs');var path=require(_0xd34d('0x3'));var rimraf=require(_0xd34d('0x4'));var config=require(_0xd34d('0x5'));var attributes=require(_0xd34d('0x6'));var integrations=require(_0xd34d('0x7'));module[_0xd34d('0x8')]=function(_0xd757fd,_0x573027){return _0xd757fd[_0xd34d('0x9')](_0xd34d('0xa'),attributes,{'tableName':_0xd34d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49c1=['util','../../config/logger','api','moment','bluebird','request-promise','path','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts'];(function(_0x2d0384,_0xae28cd){var _0x381567=function(_0x5eeec0){while(--_0x5eeec0){_0x2d0384['push'](_0x2d0384['shift']());}};_0x381567(++_0xae28cd);}(_0x49c1,0x168));var _0x149c=function(_0x1fe2dd,_0x14917a){_0x1fe2dd=_0x1fe2dd-0x0;var _0x159f82=_0x49c1[_0x1fe2dd];return _0x159f82;};'use strict';var _=require('lodash');var util=require(_0x149c('0x0'));var logger=require(_0x149c('0x1'))(_0x149c('0x2'));var moment=require(_0x149c('0x3'));var BPromise=require(_0x149c('0x4'));var rp=require(_0x149c('0x5'));var fs=require('fs');var path=require(_0x149c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x149c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x149c('0x8')]=function(_0x516191,_0x41a9a0){return _0x516191[_0x149c('0x9')](_0x149c('0xa'),attributes,{'tableName':_0x149c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 694c7fe..f76e0de 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 _0xf79a=['http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','DeskAccount','findAll','options','raw','where','limit','map','model','attributes','include','GetDeskAccount','catch','ShowDeskAccount','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x466aed,_0x4812f0){var _0x4db0d2=function(_0x323725){while(--_0x323725){_0x466aed['push'](_0x466aed['shift']());}};_0x4db0d2(++_0x4812f0);}(_0xf79a,0x65));var _0xaf79=function(_0xd5f3ec,_0x4980cc){_0xd5f3ec=_0xd5f3ec-0x0;var _0x2a1264=_0xf79a[_0xd5f3ec];return _0x2a1264;};'use strict';var _=require('lodash');var util=require(_0xaf79('0x0'));var moment=require(_0xaf79('0x1'));var BPromise=require(_0xaf79('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf79('0x3'));var db=require(_0xaf79('0x4'))['db'];var utils=require(_0xaf79('0x5'));var logger=require(_0xaf79('0x6'))('rpc');var config=require(_0xaf79('0x7'));var jayson=require(_0xaf79('0x8'));var client=jayson[_0xaf79('0x9')][_0xaf79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ae009,_0x340110,_0x2d89e0){return new BPromise(function(_0x3d4d24,_0x1a60d9){return client[_0xaf79('0xb')](_0x2ae009,_0x2d89e0)[_0xaf79('0xc')](function(_0x30b1e2){logger['info'](_0xaf79('0xd'),_0x340110,_0xaf79('0xe'));logger[_0xaf79('0xf')](_0xaf79('0x10'),_0x340110,'request\x20sent',JSON[_0xaf79('0x11')](_0x30b1e2));if(_0x30b1e2['error']){if(_0x30b1e2[_0xaf79('0x12')][_0xaf79('0x13')]===0x1f4){logger[_0xaf79('0x12')](_0xaf79('0xd'),_0x340110,_0x30b1e2['error'][_0xaf79('0x14')]);return _0x1a60d9(_0x30b1e2[_0xaf79('0x12')][_0xaf79('0x14')]);}logger['error'](_0xaf79('0xd'),_0x340110,_0x30b1e2[_0xaf79('0x12')]['message']);return _0x3d4d24(_0x30b1e2['error'][_0xaf79('0x14')]);}else{logger[_0xaf79('0x15')]('DeskAccount,\x20%s,\x20%s',_0x340110,_0xaf79('0xe'));_0x3d4d24(_0x30b1e2[_0xaf79('0x16')][_0xaf79('0x14')]);}})['catch'](function(_0x5a3bc6){logger['error'](_0xaf79('0xd'),_0x340110,_0x5a3bc6);_0x1a60d9(_0x5a3bc6);});});}exports['GetDeskAccount']=function(_0x490d80){var _0x545a57=this;return new Promise(function(_0x47b74b,_0x53ecd6){return db[_0xaf79('0x17')][_0xaf79('0x18')]({'raw':_0x490d80[_0xaf79('0x19')]?_0x490d80[_0xaf79('0x19')][_0xaf79('0x1a')]===undefined?!![]:![]:!![],'where':_0x490d80[_0xaf79('0x19')]?_0x490d80[_0xaf79('0x19')][_0xaf79('0x1b')]||null:null,'attributes':_0x490d80[_0xaf79('0x19')]?_0x490d80[_0xaf79('0x19')]['attributes']||null:null,'limit':_0x490d80[_0xaf79('0x19')]?_0x490d80['options'][_0xaf79('0x1c')]||null:null,'include':_0x490d80[_0xaf79('0x19')]?_0x490d80[_0xaf79('0x19')]['include']?_[_0xaf79('0x1d')](_0x490d80[_0xaf79('0x19')]['include'],function(_0x500e3a){return{'model':db[_0x500e3a[_0xaf79('0x1e')]],'as':_0x500e3a['as'],'attributes':_0x500e3a[_0xaf79('0x1f')],'include':_0x500e3a[_0xaf79('0x20')]?_[_0xaf79('0x1d')](_0x500e3a[_0xaf79('0x20')],function(_0x2b76e4){return{'model':db[_0x2b76e4['model']],'as':_0x2b76e4['as'],'attributes':_0x2b76e4[_0xaf79('0x1f')],'include':_0x2b76e4[_0xaf79('0x20')]?_['map'](_0x2b76e4['include'],function(_0x49ef35){return{'model':db[_0x49ef35[_0xaf79('0x1e')]],'as':_0x49ef35['as'],'attributes':_0x49ef35[_0xaf79('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaf79('0xc')](function(_0x532ebd){logger[_0xaf79('0x15')]('GetDeskAccount',_0x490d80);logger['debug'](_0xaf79('0x21'),_0x490d80,JSON[_0xaf79('0x11')](_0x532ebd));_0x47b74b(_0x532ebd);})[_0xaf79('0x22')](function(_0x205c0b){logger[_0xaf79('0x12')]('GetDeskAccount',_0x205c0b['message'],_0x490d80);_0x53ecd6(_0x545a57[_0xaf79('0x12')](0x1f4,_0x205c0b[_0xaf79('0x14')]));});});};exports[_0xaf79('0x23')]=function(_0x131088){var _0x1f2a91=this;return new Promise(function(_0x9dcec4,_0x492d02){return db[_0xaf79('0x17')][_0xaf79('0x24')]({'raw':_0x131088[_0xaf79('0x19')]?_0x131088[_0xaf79('0x19')][_0xaf79('0x1a')]===undefined?!![]:![]:!![],'where':_0x131088[_0xaf79('0x19')]?_0x131088[_0xaf79('0x19')][_0xaf79('0x1b')]||null:null,'attributes':_0x131088[_0xaf79('0x19')]?_0x131088[_0xaf79('0x19')][_0xaf79('0x1f')]||null:null,'include':_0x131088[_0xaf79('0x19')]?_0x131088[_0xaf79('0x19')][_0xaf79('0x20')]?_[_0xaf79('0x1d')](_0x131088[_0xaf79('0x19')][_0xaf79('0x20')],function(_0x3621c){return{'model':db[_0x3621c[_0xaf79('0x1e')]],'as':_0x3621c['as'],'attributes':_0x3621c[_0xaf79('0x1f')],'include':_0x3621c[_0xaf79('0x20')]?_[_0xaf79('0x1d')](_0x3621c[_0xaf79('0x20')],function(_0x513709){return{'model':db[_0x513709[_0xaf79('0x1e')]],'as':_0x513709['as'],'attributes':_0x513709[_0xaf79('0x1f')],'include':_0x513709[_0xaf79('0x20')]?_[_0xaf79('0x1d')](_0x513709[_0xaf79('0x20')],function(_0x4fc5a6){return{'model':db[_0x4fc5a6[_0xaf79('0x1e')]],'as':_0x4fc5a6['as'],'attributes':_0x4fc5a6[_0xaf79('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d74e5){logger[_0xaf79('0x15')](_0xaf79('0x23'),_0x131088);logger['debug'](_0xaf79('0x23'),_0x131088,JSON[_0xaf79('0x11')](_0x1d74e5));_0x9dcec4(_0x1d74e5);})[_0xaf79('0x22')](function(_0x504a6a){logger['error'](_0xaf79('0x23'),_0x504a6a[_0xaf79('0x14')],_0x131088);_0x492d02(_0x1f2a91[_0xaf79('0x12')](0x1f4,_0x504a6a[_0xaf79('0x14')]));});});}; \ No newline at end of file +var _0xf5cf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','map','attributes','include','model','debug','catch','ShowDeskAccount','find','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x12d245,_0x3ce3f7){var _0x58cf96=function(_0x14c5ee){while(--_0x14c5ee){_0x12d245['push'](_0x12d245['shift']());}};_0x58cf96(++_0x3ce3f7);}(_0xf5cf,0x8f));var _0xff5c=function(_0x372a38,_0x310c5f){_0x372a38=_0x372a38-0x0;var _0x194cac=_0xf5cf[_0x372a38];return _0x194cac;};'use strict';var _=require('lodash');var util=require(_0xff5c('0x0'));var moment=require(_0xff5c('0x1'));var BPromise=require(_0xff5c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff5c('0x3'));var db=require(_0xff5c('0x4'))['db'];var utils=require(_0xff5c('0x5'));var logger=require(_0xff5c('0x6'))(_0xff5c('0x7'));var config=require(_0xff5c('0x8'));var jayson=require(_0xff5c('0x9'));var client=jayson[_0xff5c('0xa')][_0xff5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21a900,_0x24bceb,_0x18bf13){return new BPromise(function(_0x28ccf1,_0x3e7c14){return client[_0xff5c('0xc')](_0x21a900,_0x18bf13)[_0xff5c('0xd')](function(_0x474550){logger[_0xff5c('0xe')](_0xff5c('0xf'),_0x24bceb,_0xff5c('0x10'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x24bceb,'request\x20sent',JSON[_0xff5c('0x11')](_0x474550));if(_0x474550['error']){if(_0x474550[_0xff5c('0x12')][_0xff5c('0x13')]===0x1f4){logger[_0xff5c('0x12')](_0xff5c('0xf'),_0x24bceb,_0x474550[_0xff5c('0x12')][_0xff5c('0x14')]);return _0x3e7c14(_0x474550[_0xff5c('0x12')][_0xff5c('0x14')]);}logger[_0xff5c('0x12')](_0xff5c('0xf'),_0x24bceb,_0x474550[_0xff5c('0x12')][_0xff5c('0x14')]);return _0x28ccf1(_0x474550['error'][_0xff5c('0x14')]);}else{logger[_0xff5c('0xe')](_0xff5c('0xf'),_0x24bceb,_0xff5c('0x10'));_0x28ccf1(_0x474550[_0xff5c('0x15')][_0xff5c('0x14')]);}})['catch'](function(_0x11a956){logger[_0xff5c('0x12')](_0xff5c('0xf'),_0x24bceb,_0x11a956);_0x3e7c14(_0x11a956);});});}exports[_0xff5c('0x16')]=function(_0x33c8db){var _0x28a280=this;return new Promise(function(_0x4cc3ae,_0x3a89f9){return db[_0xff5c('0x17')][_0xff5c('0x18')]({'raw':_0x33c8db[_0xff5c('0x19')]?_0x33c8db[_0xff5c('0x19')][_0xff5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x33c8db[_0xff5c('0x19')]?_0x33c8db['options'][_0xff5c('0x1b')]||null:null,'attributes':_0x33c8db[_0xff5c('0x19')]?_0x33c8db[_0xff5c('0x19')]['attributes']||null:null,'limit':_0x33c8db[_0xff5c('0x19')]?_0x33c8db[_0xff5c('0x19')][_0xff5c('0x1c')]||null:null,'include':_0x33c8db[_0xff5c('0x19')]?_0x33c8db['options']['include']?_[_0xff5c('0x1d')](_0x33c8db[_0xff5c('0x19')]['include'],function(_0x2615c4){return{'model':db[_0x2615c4['model']],'as':_0x2615c4['as'],'attributes':_0x2615c4[_0xff5c('0x1e')],'include':_0x2615c4[_0xff5c('0x1f')]?_[_0xff5c('0x1d')](_0x2615c4[_0xff5c('0x1f')],function(_0x49d570){return{'model':db[_0x49d570[_0xff5c('0x20')]],'as':_0x49d570['as'],'attributes':_0x49d570['attributes'],'include':_0x49d570['include']?_['map'](_0x49d570[_0xff5c('0x1f')],function(_0x4b0c65){return{'model':db[_0x4b0c65[_0xff5c('0x20')]],'as':_0x4b0c65['as'],'attributes':_0x4b0c65['attributes']};}):[]};}):[]};}):[]:[]})[_0xff5c('0xd')](function(_0x45522a){logger[_0xff5c('0xe')](_0xff5c('0x16'),_0x33c8db);logger[_0xff5c('0x21')](_0xff5c('0x16'),_0x33c8db,JSON[_0xff5c('0x11')](_0x45522a));_0x4cc3ae(_0x45522a);})[_0xff5c('0x22')](function(_0x5d5b17){logger[_0xff5c('0x12')]('GetDeskAccount',_0x5d5b17[_0xff5c('0x14')],_0x33c8db);_0x3a89f9(_0x28a280[_0xff5c('0x12')](0x1f4,_0x5d5b17[_0xff5c('0x14')]));});});};exports[_0xff5c('0x23')]=function(_0x5846e4){var _0x544ca1=this;return new Promise(function(_0x56bb24,_0x2d2e55){return db[_0xff5c('0x17')][_0xff5c('0x24')]({'raw':_0x5846e4[_0xff5c('0x19')]?_0x5846e4['options'][_0xff5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x5846e4[_0xff5c('0x19')]?_0x5846e4[_0xff5c('0x19')]['where']||null:null,'attributes':_0x5846e4[_0xff5c('0x19')]?_0x5846e4[_0xff5c('0x19')][_0xff5c('0x1e')]||null:null,'include':_0x5846e4['options']?_0x5846e4[_0xff5c('0x19')]['include']?_['map'](_0x5846e4['options'][_0xff5c('0x1f')],function(_0x29f341){return{'model':db[_0x29f341[_0xff5c('0x20')]],'as':_0x29f341['as'],'attributes':_0x29f341[_0xff5c('0x1e')],'include':_0x29f341['include']?_[_0xff5c('0x1d')](_0x29f341[_0xff5c('0x1f')],function(_0x49b8b4){return{'model':db[_0x49b8b4[_0xff5c('0x20')]],'as':_0x49b8b4['as'],'attributes':_0x49b8b4[_0xff5c('0x1e')],'include':_0x49b8b4['include']?_[_0xff5c('0x1d')](_0x49b8b4[_0xff5c('0x1f')],function(_0x29d484){return{'model':db[_0x29d484[_0xff5c('0x20')]],'as':_0x29d484['as'],'attributes':_0x29d484[_0xff5c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xff5c('0xd')](function(_0x493c1e){logger[_0xff5c('0xe')](_0xff5c('0x23'),_0x5846e4);logger[_0xff5c('0x21')]('ShowDeskAccount',_0x5846e4,JSON['stringify'](_0x493c1e));_0x56bb24(_0x493c1e);})[_0xff5c('0x22')](function(_0x3bd147){logger[_0xff5c('0x12')](_0xff5c('0x23'),_0x3bd147[_0xff5c('0x14')],_0x5846e4);_0x2d2e55(_0x544ca1['error'](0x1f4,_0x3bd147[_0xff5c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index b91f489..e6d213f 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x55ca,0x126));var _0xa55c=function(_0x234cdb,_0x28750b){_0x234cdb=_0x234cdb-0x0;var _0x1d18bb=_0x55ca[_0x234cdb];return _0x1d18bb;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x39124e,_0x15f4bf){var _0x1ad849=function(_0x74d7ba){while(--_0x74d7ba){_0x39124e['push'](_0x39124e['shift']());}};_0x1ad849(++_0x15f4bf);}(_0x3e74,0x175));var _0x43e7=function(_0xe34f08,_0x1ec62c){_0xe34f08=_0xe34f08-0x0;var _0x54724b=_0x3e74[_0xe34f08];return _0x54724b;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 3e53609..8088992 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 _0xed57=['STRING','sequelize'];(function(_0x315b7c,_0x19ff8e){var _0x3a99eb=function(_0x21afc2){while(--_0x21afc2){_0x315b7c['push'](_0x315b7c['shift']());}};_0x3a99eb(++_0x19ff8e);}(_0xed57,0xf9));var _0x7ed5=function(_0x164717,_0x11959c){_0x164717=_0x164717-0x0;var _0x1f14b6=_0xed57[_0x164717];return _0x1f14b6;};'use strict';var Sequelize=require(_0x7ed5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7ed5('0x1')]}}; \ No newline at end of file +var _0xeb09=['STRING','sequelize'];(function(_0x542ce8,_0x206715){var _0x36838a=function(_0x277a6a){while(--_0x277a6a){_0x542ce8['push'](_0x542ce8['shift']());}};_0x36838a(++_0x206715);}(_0xeb09,0x1bf));var _0x9eb0=function(_0x1727c1,_0x19afcd){_0x1727c1=_0x1727c1-0x0;var _0x412013=_0xeb09[_0x1727c1];return _0x412013;};'use strict';var Sequelize=require(_0x9eb0('0x0'));module['exports']={'name':{'type':Sequelize[_0x9eb0('0x1')]},'description':{'type':Sequelize[_0x9eb0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4683969..695ea57 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 _0xde51=['getDescriptions','getTags','setTags','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','error','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','then','include','findAll','catch','show','includeAll','find','create','body','params','getFields','findOne','DeskField','order','pick','getSubjects'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xde51,0xff));var _0x1de5=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xde51[_0x2f2360];return _0x1cc8d3;};'use strict';var emlformat=require(_0x1de5('0x0'));var rimraf=require(_0x1de5('0x1'));var zipdir=require(_0x1de5('0x2'));var jsonpatch=require(_0x1de5('0x3'));var rp=require(_0x1de5('0x4'));var moment=require(_0x1de5('0x5'));var BPromise=require(_0x1de5('0x6'));var Mustache=require(_0x1de5('0x7'));var util=require(_0x1de5('0x8'));var path=require(_0x1de5('0x9'));var sox=require(_0x1de5('0xa'));var csv=require('to-csv');var ejs=require(_0x1de5('0xb'));var fs=require('fs');var fs_extra=require(_0x1de5('0xc'));var _=require('lodash');var squel=require(_0x1de5('0xd'));var crypto=require(_0x1de5('0xe'));var jsforce=require(_0x1de5('0xf'));var deskjs=require(_0x1de5('0x10'));var toCsv=require(_0x1de5('0x11'));var querystring=require(_0x1de5('0x12'));var Papa=require(_0x1de5('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1de5('0x14'));var hardwareService=require(_0x1de5('0x15'));var logger=require(_0x1de5('0x16'))(_0x1de5('0x17'));var utils=require(_0x1de5('0x18'));var config=require(_0x1de5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1de5('0x1a'))['db'];function respondWithStatusCode(_0x5ef2fd,_0x28ed50){_0x28ed50=_0x28ed50||0xcc;return function(_0x1b988e){if(_0x1b988e){return _0x5ef2fd[_0x1de5('0x1b')](_0x28ed50);}return _0x5ef2fd[_0x1de5('0x1c')](_0x28ed50)[_0x1de5('0x1d')]();};}function respondWithResult(_0x3cf4c9,_0x58a4cd){_0x58a4cd=_0x58a4cd||0xc8;return function(_0x3155c5){if(_0x3155c5){return _0x3cf4c9['status'](_0x58a4cd)[_0x1de5('0x1e')](_0x3155c5);}};}function respondWithFilteredResult(_0x1299b8,_0x341c07){return function(_0x139c08){if(_0x139c08){var _0x32aec4=typeof _0x341c07['offset']===_0x1de5('0x1f')&&typeof _0x341c07[_0x1de5('0x20')]===_0x1de5('0x1f');var _0x2cdf06=_0x139c08[_0x1de5('0x21')];var _0x10ae5f=_0x32aec4?0x0:_0x341c07['offset'];var _0xd9ab4c=_0x32aec4?_0x139c08[_0x1de5('0x21')]:_0x341c07[_0x1de5('0x22')]+_0x341c07[_0x1de5('0x20')];var _0x1540fa;if(_0xd9ab4c>=_0x2cdf06){_0xd9ab4c=_0x2cdf06;_0x1540fa=0xc8;}else{_0x1540fa=0xce;}_0x1299b8[_0x1de5('0x1c')](_0x1540fa);return _0x1299b8['set'](_0x1de5('0x23'),_0x10ae5f+'-'+_0xd9ab4c+'/'+_0x2cdf06)['json'](_0x139c08);}return null;};}function patchUpdates(_0x5a84d5){return function(_0x329fd3){try{jsonpatch[_0x1de5('0x24')](_0x329fd3,_0x5a84d5,!![]);}catch(_0x476794){return BPromise[_0x1de5('0x25')](_0x476794);}return _0x329fd3[_0x1de5('0x26')]();};}function saveUpdates(_0x37b214,_0x33c1a3){return function(_0x275580){if(_0x275580){return _0x275580['update'](_0x37b214)['then'](function(_0x2d912c){return _0x2d912c;});}return null;};}function removeEntity(_0x3f8056,_0x2f2e4c){return function(_0x2a7ac2){if(_0x2a7ac2){return _0x2a7ac2['destroy']()['then'](function(){_0x3f8056[_0x1de5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47495b,_0x4e9455){return function(_0x1fc21f){if(!_0x1fc21f){_0x47495b[_0x1de5('0x1b')](0x194);}return _0x1fc21f;};}function handleError(_0x4facdb,_0x2290e8){_0x2290e8=_0x2290e8||0x1f4;return function(_0x23b4e6){logger[_0x1de5('0x27')](_0x23b4e6['stack']);if(_0x23b4e6[_0x1de5('0x28')]){delete _0x23b4e6[_0x1de5('0x28')];}_0x4facdb['status'](_0x2290e8)[_0x1de5('0x29')](_0x23b4e6);};}exports[_0x1de5('0x2a')]=function(_0x50d6c9,_0x51f794){var _0x2a99ca={},_0x1561e3={},_0x35dd77={'count':0x0,'rows':[]};var _0x20dcb2=_[_0x1de5('0x2b')](db[_0x1de5('0x2c')][_0x1de5('0x2d')],function(_0x22c7f5){return{'name':_0x22c7f5[_0x1de5('0x2e')],'type':_0x22c7f5[_0x1de5('0x2f')][_0x1de5('0x30')]};});_0x1561e3[_0x1de5('0x31')]=_[_0x1de5('0x2b')](_0x20dcb2,_0x1de5('0x28'));_0x1561e3[_0x1de5('0x32')]=_[_0x1de5('0x33')](_0x50d6c9['query']);_0x1561e3[_0x1de5('0x34')]=_['intersection'](_0x1561e3[_0x1de5('0x31')],_0x1561e3['query']);_0x2a99ca[_0x1de5('0x35')]=_[_0x1de5('0x36')](_0x1561e3['model'],qs[_0x1de5('0x37')](_0x50d6c9['query']['fields']));_0x2a99ca['attributes']=_0x2a99ca['attributes'][_0x1de5('0x38')]?_0x2a99ca[_0x1de5('0x35')]:_0x1561e3[_0x1de5('0x31')];if(!_0x50d6c9[_0x1de5('0x32')][_0x1de5('0x39')](_0x1de5('0x3a'))){_0x2a99ca[_0x1de5('0x20')]=qs[_0x1de5('0x20')](_0x50d6c9[_0x1de5('0x32')]['limit']);_0x2a99ca['offset']=qs['offset'](_0x50d6c9['query'][_0x1de5('0x22')]);}_0x2a99ca['order']=qs[_0x1de5('0x3b')](_0x50d6c9['query'][_0x1de5('0x3b')]);_0x2a99ca[_0x1de5('0x3c')]=qs[_0x1de5('0x34')](_['pick'](_0x50d6c9[_0x1de5('0x32')],_0x1561e3['filters']),_0x20dcb2);if(_0x50d6c9[_0x1de5('0x32')]['filter']){_0x2a99ca[_0x1de5('0x3c')]=_[_0x1de5('0x3d')](_0x2a99ca[_0x1de5('0x3c')],{'$or':_[_0x1de5('0x2b')](_0x20dcb2,function(_0x1360ae){if(_0x1360ae[_0x1de5('0x2f')]!==_0x1de5('0x3e')){var _0xa08e6c={};_0xa08e6c[_0x1360ae[_0x1de5('0x28')]]={'$like':'%'+_0x50d6c9['query'][_0x1de5('0x3f')]+'%'};return _0xa08e6c;}})});}_0x2a99ca=_['merge']({},_0x2a99ca,_0x50d6c9[_0x1de5('0x40')]);var _0x50e769={'where':_0x2a99ca[_0x1de5('0x3c')]};return db[_0x1de5('0x2c')]['count'](_0x50e769)[_0x1de5('0x41')](function(_0x17e307){_0x35dd77[_0x1de5('0x21')]=_0x17e307;if(_0x50d6c9[_0x1de5('0x32')]['includeAll']){_0x2a99ca[_0x1de5('0x42')]=[{'all':!![]}];}return db[_0x1de5('0x2c')][_0x1de5('0x43')](_0x2a99ca);})[_0x1de5('0x41')](function(_0x39d018){_0x35dd77['rows']=_0x39d018;return _0x35dd77;})['then'](respondWithFilteredResult(_0x51f794,_0x2a99ca))[_0x1de5('0x44')](handleError(_0x51f794,null));};exports[_0x1de5('0x45')]=function(_0x412d5a,_0x444c9c){var _0x2786fc={'raw':![],'where':{'id':_0x412d5a['params']['id']}},_0x2bef89={};_0x2bef89[_0x1de5('0x31')]=_['keys'](db[_0x1de5('0x2c')]['rawAttributes']);_0x2bef89['query']=_[_0x1de5('0x33')](_0x412d5a['query']);_0x2bef89[_0x1de5('0x34')]=_['intersection'](_0x2bef89[_0x1de5('0x31')],_0x2bef89['query']);_0x2786fc['attributes']=_[_0x1de5('0x36')](_0x2bef89['model'],qs[_0x1de5('0x37')](_0x412d5a[_0x1de5('0x32')]['fields']));_0x2786fc[_0x1de5('0x35')]=_0x2786fc[_0x1de5('0x35')][_0x1de5('0x38')]?_0x2786fc['attributes']:_0x2bef89[_0x1de5('0x31')];if(_0x412d5a[_0x1de5('0x32')][_0x1de5('0x46')]){_0x2786fc[_0x1de5('0x42')]=[{'all':!![]}];}_0x2786fc=_[_0x1de5('0x3d')]({},_0x2786fc,_0x412d5a['options']);return db[_0x1de5('0x2c')][_0x1de5('0x47')](_0x2786fc)['then'](handleEntityNotFound(_0x444c9c,null))[_0x1de5('0x41')](respondWithResult(_0x444c9c,null))['catch'](handleError(_0x444c9c,null));};exports[_0x1de5('0x48')]=function(_0x40cc49,_0xd7e0f2){return db[_0x1de5('0x2c')][_0x1de5('0x48')](_0x40cc49[_0x1de5('0x49')],{})[_0x1de5('0x41')](respondWithResult(_0xd7e0f2,0xc9))[_0x1de5('0x44')](handleError(_0xd7e0f2,null));};exports['update']=function(_0x334c17,_0x22d4a){if(_0x334c17['body']['id']){delete _0x334c17[_0x1de5('0x49')]['id'];}return db[_0x1de5('0x2c')][_0x1de5('0x47')]({'where':{'id':_0x334c17[_0x1de5('0x4a')]['id']}})[_0x1de5('0x41')](handleEntityNotFound(_0x22d4a,null))[_0x1de5('0x41')](saveUpdates(_0x334c17['body'],null))[_0x1de5('0x41')](respondWithResult(_0x22d4a,null))[_0x1de5('0x44')](handleError(_0x22d4a,null));};exports['destroy']=function(_0x2e202b,_0x21bb5e){return db[_0x1de5('0x2c')][_0x1de5('0x47')]({'where':{'id':_0x2e202b['params']['id']}})['then'](handleEntityNotFound(_0x21bb5e,null))['then'](removeEntity(_0x21bb5e,null))[_0x1de5('0x44')](handleError(_0x21bb5e,null));};exports[_0x1de5('0x4b')]=function(_0x15b11f,_0x1b790e,_0x3f69a2){var _0x479a2f={};var _0x58f837={};var _0x2307ba;var _0x13ff74;return db['DeskConfiguration'][_0x1de5('0x4c')]({'where':{'id':_0x15b11f[_0x1de5('0x4a')]['id']}})[_0x1de5('0x41')](handleEntityNotFound(_0x1b790e,null))[_0x1de5('0x41')](function(_0x443ebd){if(_0x443ebd){_0x2307ba=_0x443ebd;_0x58f837[_0x1de5('0x31')]=_['keys'](db[_0x1de5('0x4d')][_0x1de5('0x2d')]);_0x58f837[_0x1de5('0x32')]=_[_0x1de5('0x33')](_0x15b11f[_0x1de5('0x32')]);_0x58f837[_0x1de5('0x34')]=_[_0x1de5('0x36')](_0x58f837[_0x1de5('0x31')],_0x58f837[_0x1de5('0x32')]);_0x479a2f['attributes']=_[_0x1de5('0x36')](_0x58f837['model'],qs[_0x1de5('0x37')](_0x15b11f[_0x1de5('0x32')][_0x1de5('0x37')]));_0x479a2f[_0x1de5('0x35')]=_0x479a2f['attributes'][_0x1de5('0x38')]?_0x479a2f[_0x1de5('0x35')]:_0x58f837['model'];_0x479a2f[_0x1de5('0x4e')]=qs[_0x1de5('0x3b')](_0x15b11f['query'][_0x1de5('0x3b')]);_0x479a2f[_0x1de5('0x3c')]=qs[_0x1de5('0x34')](_[_0x1de5('0x4f')](_0x15b11f['query'],_0x58f837[_0x1de5('0x34')]));if(_0x15b11f[_0x1de5('0x32')][_0x1de5('0x3f')]){_0x479a2f[_0x1de5('0x3c')]=_[_0x1de5('0x3d')](_0x479a2f[_0x1de5('0x3c')],{'$or':_[_0x1de5('0x2b')](_0x479a2f[_0x1de5('0x35')],function(_0x46fb6b){var _0x18abd2={};_0x18abd2[_0x46fb6b]={'$like':'%'+_0x15b11f[_0x1de5('0x32')][_0x1de5('0x3f')]+'%'};return _0x18abd2;})});}_0x479a2f=_[_0x1de5('0x3d')]({},_0x479a2f,_0x15b11f[_0x1de5('0x40')]);return _0x2307ba['getFields'](_0x479a2f);}})[_0x1de5('0x41')](function(_0x3b96b6){if(_0x3b96b6){_0x13ff74=_0x3b96b6[_0x1de5('0x38')];if(!_0x15b11f[_0x1de5('0x32')][_0x1de5('0x39')](_0x1de5('0x3a'))){_0x479a2f['limit']=qs[_0x1de5('0x20')](_0x15b11f[_0x1de5('0x32')][_0x1de5('0x20')]);_0x479a2f[_0x1de5('0x22')]=qs['offset'](_0x15b11f['query'][_0x1de5('0x22')]);}return _0x2307ba[_0x1de5('0x4b')](_0x479a2f);}})[_0x1de5('0x41')](function(_0x2d5378){if(_0x2d5378){return _0x2d5378?{'count':_0x13ff74,'rows':_0x2d5378}:null;}})['then'](respondWithResult(_0x1b790e,null))[_0x1de5('0x44')](handleError(_0x1b790e,null));};exports[_0x1de5('0x50')]=function(_0x36fd9f,_0x4a85fd,_0x155863){var _0xa68c3f={};var _0x22f36c={};var _0x7e9d34;var _0x3a4726;return db['DeskConfiguration'][_0x1de5('0x4c')]({'where':{'id':_0x36fd9f[_0x1de5('0x4a')]['id']}})[_0x1de5('0x41')](handleEntityNotFound(_0x4a85fd,null))[_0x1de5('0x41')](function(_0x208369){if(_0x208369){_0x7e9d34=_0x208369;_0x22f36c[_0x1de5('0x31')]=_[_0x1de5('0x33')](db[_0x1de5('0x4d')]['rawAttributes']);_0x22f36c[_0x1de5('0x32')]=_[_0x1de5('0x33')](_0x36fd9f[_0x1de5('0x32')]);_0x22f36c[_0x1de5('0x34')]=_[_0x1de5('0x36')](_0x22f36c['model'],_0x22f36c[_0x1de5('0x32')]);_0xa68c3f[_0x1de5('0x35')]=_[_0x1de5('0x36')](_0x22f36c[_0x1de5('0x31')],qs[_0x1de5('0x37')](_0x36fd9f['query'][_0x1de5('0x37')]));_0xa68c3f['attributes']=_0xa68c3f[_0x1de5('0x35')][_0x1de5('0x38')]?_0xa68c3f[_0x1de5('0x35')]:_0x22f36c[_0x1de5('0x31')];_0xa68c3f[_0x1de5('0x4e')]=qs['sort'](_0x36fd9f['query'][_0x1de5('0x3b')]);_0xa68c3f[_0x1de5('0x3c')]=qs['filters'](_[_0x1de5('0x4f')](_0x36fd9f[_0x1de5('0x32')],_0x22f36c['filters']));if(_0x36fd9f[_0x1de5('0x32')][_0x1de5('0x3f')]){_0xa68c3f[_0x1de5('0x3c')]=_['merge'](_0xa68c3f[_0x1de5('0x3c')],{'$or':_[_0x1de5('0x2b')](_0xa68c3f[_0x1de5('0x35')],function(_0x45e843){var _0x39e5d5={};_0x39e5d5[_0x45e843]={'$like':'%'+_0x36fd9f[_0x1de5('0x32')][_0x1de5('0x3f')]+'%'};return _0x39e5d5;})});}_0xa68c3f=_[_0x1de5('0x3d')]({},_0xa68c3f,_0x36fd9f[_0x1de5('0x40')]);return _0x7e9d34[_0x1de5('0x50')](_0xa68c3f);}})[_0x1de5('0x41')](function(_0x80a633){if(_0x80a633){_0x3a4726=_0x80a633['length'];if(!_0x36fd9f[_0x1de5('0x32')][_0x1de5('0x39')](_0x1de5('0x3a'))){_0xa68c3f[_0x1de5('0x20')]=qs[_0x1de5('0x20')](_0x36fd9f[_0x1de5('0x32')]['limit']);_0xa68c3f[_0x1de5('0x22')]=qs[_0x1de5('0x22')](_0x36fd9f[_0x1de5('0x32')]['offset']);}return _0x7e9d34[_0x1de5('0x50')](_0xa68c3f);}})[_0x1de5('0x41')](function(_0x50d3d0){if(_0x50d3d0){return _0x50d3d0?{'count':_0x3a4726,'rows':_0x50d3d0}:null;}})['then'](respondWithResult(_0x4a85fd,null))['catch'](handleError(_0x4a85fd,null));};exports[_0x1de5('0x51')]=function(_0x2a2799,_0x45dde4,_0xf160e8){var _0x42ebee={};var _0x50be63={};var _0x173a9e;var _0x17170e;return db['DeskConfiguration']['findOne']({'where':{'id':_0x2a2799[_0x1de5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45dde4,null))[_0x1de5('0x41')](function(_0x499590){if(_0x499590){_0x173a9e=_0x499590;_0x50be63['model']=_[_0x1de5('0x33')](db[_0x1de5('0x4d')][_0x1de5('0x2d')]);_0x50be63['query']=_[_0x1de5('0x33')](_0x2a2799[_0x1de5('0x32')]);_0x50be63[_0x1de5('0x34')]=_['intersection'](_0x50be63[_0x1de5('0x31')],_0x50be63[_0x1de5('0x32')]);_0x42ebee[_0x1de5('0x35')]=_['intersection'](_0x50be63['model'],qs[_0x1de5('0x37')](_0x2a2799[_0x1de5('0x32')][_0x1de5('0x37')]));_0x42ebee[_0x1de5('0x35')]=_0x42ebee['attributes'][_0x1de5('0x38')]?_0x42ebee['attributes']:_0x50be63[_0x1de5('0x31')];_0x42ebee['order']=qs[_0x1de5('0x3b')](_0x2a2799['query'][_0x1de5('0x3b')]);_0x42ebee[_0x1de5('0x3c')]=qs['filters'](_[_0x1de5('0x4f')](_0x2a2799[_0x1de5('0x32')],_0x50be63[_0x1de5('0x34')]));if(_0x2a2799[_0x1de5('0x32')][_0x1de5('0x3f')]){_0x42ebee['where']=_['merge'](_0x42ebee[_0x1de5('0x3c')],{'$or':_[_0x1de5('0x2b')](_0x42ebee['attributes'],function(_0x156b3b){var _0x3fd0a0={};_0x3fd0a0[_0x156b3b]={'$like':'%'+_0x2a2799['query'][_0x1de5('0x3f')]+'%'};return _0x3fd0a0;})});}_0x42ebee=_['merge']({},_0x42ebee,_0x2a2799[_0x1de5('0x40')]);return _0x173a9e['getDescriptions'](_0x42ebee);}})[_0x1de5('0x41')](function(_0x4c7cc4){if(_0x4c7cc4){_0x17170e=_0x4c7cc4[_0x1de5('0x38')];if(!_0x2a2799[_0x1de5('0x32')][_0x1de5('0x39')]('nolimit')){_0x42ebee['limit']=qs[_0x1de5('0x20')](_0x2a2799[_0x1de5('0x32')]['limit']);_0x42ebee[_0x1de5('0x22')]=qs[_0x1de5('0x22')](_0x2a2799[_0x1de5('0x32')][_0x1de5('0x22')]);}return _0x173a9e[_0x1de5('0x51')](_0x42ebee);}})[_0x1de5('0x41')](function(_0x342cf1){if(_0x342cf1){return _0x342cf1?{'count':_0x17170e,'rows':_0x342cf1}:null;}})[_0x1de5('0x41')](respondWithResult(_0x45dde4,null))['catch'](handleError(_0x45dde4,null));};exports['getTags']=function(_0x29a3b0,_0x2d45f3,_0x3f49f8){var _0x16a91b={};var _0x5edf61={};var _0xcdd5ca;var _0x50e76d;return db[_0x1de5('0x2c')][_0x1de5('0x4c')]({'where':{'id':_0x29a3b0[_0x1de5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2d45f3,null))[_0x1de5('0x41')](function(_0x55e58c){if(_0x55e58c){_0xcdd5ca=_0x55e58c;_0x5edf61[_0x1de5('0x31')]=_[_0x1de5('0x33')](db['Tag'][_0x1de5('0x2d')]);_0x5edf61[_0x1de5('0x32')]=_[_0x1de5('0x33')](_0x29a3b0[_0x1de5('0x32')]);_0x5edf61['filters']=_[_0x1de5('0x36')](_0x5edf61[_0x1de5('0x31')],_0x5edf61[_0x1de5('0x32')]);_0x16a91b[_0x1de5('0x35')]=_[_0x1de5('0x36')](_0x5edf61[_0x1de5('0x31')],qs[_0x1de5('0x37')](_0x29a3b0[_0x1de5('0x32')][_0x1de5('0x37')]));_0x16a91b[_0x1de5('0x35')]=_0x16a91b['attributes'][_0x1de5('0x38')]?_0x16a91b[_0x1de5('0x35')]:_0x5edf61[_0x1de5('0x31')];_0x16a91b[_0x1de5('0x4e')]=qs[_0x1de5('0x3b')](_0x29a3b0['query'][_0x1de5('0x3b')]);_0x16a91b[_0x1de5('0x3c')]=qs[_0x1de5('0x34')](_[_0x1de5('0x4f')](_0x29a3b0[_0x1de5('0x32')],_0x5edf61[_0x1de5('0x34')]));if(_0x29a3b0['query']['filter']){_0x16a91b[_0x1de5('0x3c')]=_[_0x1de5('0x3d')](_0x16a91b[_0x1de5('0x3c')],{'$or':_[_0x1de5('0x2b')](_0x16a91b[_0x1de5('0x35')],function(_0x5a7ca7){var _0x58c466={};_0x58c466[_0x5a7ca7]={'$like':'%'+_0x29a3b0['query']['filter']+'%'};return _0x58c466;})});}_0x16a91b=_['merge']({},_0x16a91b,_0x29a3b0[_0x1de5('0x40')]);return _0xcdd5ca['getTags'](_0x16a91b);}})[_0x1de5('0x41')](function(_0x343777){if(_0x343777){_0x50e76d=_0x343777[_0x1de5('0x38')];if(!_0x29a3b0[_0x1de5('0x32')][_0x1de5('0x39')]('nolimit')){_0x16a91b[_0x1de5('0x20')]=qs[_0x1de5('0x20')](_0x29a3b0[_0x1de5('0x32')][_0x1de5('0x20')]);_0x16a91b[_0x1de5('0x22')]=qs[_0x1de5('0x22')](_0x29a3b0['query'][_0x1de5('0x22')]);}return _0xcdd5ca[_0x1de5('0x52')](_0x16a91b);}})[_0x1de5('0x41')](function(_0x22a2b4){if(_0x22a2b4){return _0x22a2b4?{'count':_0x50e76d,'rows':_0x22a2b4}:null;}})[_0x1de5('0x41')](respondWithResult(_0x2d45f3,null))[_0x1de5('0x44')](handleError(_0x2d45f3,null));};exports[_0x1de5('0x53')]=function(_0x49f3e6,_0x47c7f1,_0x3aef71){if(_0x49f3e6[_0x1de5('0x49')]['id']){delete _0x49f3e6[_0x1de5('0x49')]['id'];}return db[_0x1de5('0x2c')][_0x1de5('0x4c')]({'where':{'id':_0x49f3e6['params']['id']}})[_0x1de5('0x41')](handleEntityNotFound(_0x47c7f1,null))[_0x1de5('0x41')](function(_0x5c5ad9){if(_0x5c5ad9){return _0x5c5ad9[_0x1de5('0x53')](_0x49f3e6[_0x1de5('0x49')]['ids']||[]);}return null;})['then'](respondWithResult(_0x47c7f1,null))[_0x1de5('0x44')](handleError(_0x47c7f1,null));}; \ No newline at end of file +var _0x74c3=['moment','mustache','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','then','rows','catch','params','includeAll','find','create','body','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir'];(function(_0x5379f2,_0x5e8877){var _0x47c456=function(_0x1d418b){while(--_0x1d418b){_0x5379f2['push'](_0x5379f2['shift']());}};_0x47c456(++_0x5e8877);}(_0x74c3,0x1e3));var _0x374c=function(_0x2113c9,_0x23d7c0){_0x2113c9=_0x2113c9-0x0;var _0x30c266=_0x74c3[_0x2113c9];return _0x30c266;};'use strict';var emlformat=require(_0x374c('0x0'));var rimraf=require(_0x374c('0x1'));var zipdir=require(_0x374c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x374c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x374c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x374c('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x374c('0x6'));var _=require(_0x374c('0x7'));var squel=require(_0x374c('0x8'));var crypto=require('crypto');var jsforce=require(_0x374c('0x9'));var deskjs=require(_0x374c('0xa'));var toCsv=require(_0x374c('0xb'));var querystring=require('querystring');var Papa=require(_0x374c('0xc'));var Redis=require(_0x374c('0xd'));var authService=require(_0x374c('0xe'));var qs=require(_0x374c('0xf'));var as=require(_0x374c('0x10'));var hardwareService=require(_0x374c('0x11'));var logger=require(_0x374c('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x374c('0x13'));var db=require(_0x374c('0x14'))['db'];function respondWithStatusCode(_0x5949fd,_0x196947){_0x196947=_0x196947||0xcc;return function(_0x56d544){if(_0x56d544){return _0x5949fd[_0x374c('0x15')](_0x196947);}return _0x5949fd[_0x374c('0x16')](_0x196947)['end']();};}function respondWithResult(_0x539bbe,_0x3d46cd){_0x3d46cd=_0x3d46cd||0xc8;return function(_0x483f1b){if(_0x483f1b){return _0x539bbe['status'](_0x3d46cd)[_0x374c('0x17')](_0x483f1b);}};}function respondWithFilteredResult(_0x3c8bb2,_0x5a144a){return function(_0x5ab8ab){if(_0x5ab8ab){var _0x51778b=typeof _0x5a144a[_0x374c('0x18')]===_0x374c('0x19')&&typeof _0x5a144a['limit']===_0x374c('0x19');var _0x43144d=_0x5ab8ab[_0x374c('0x1a')];var _0x59c16d=_0x51778b?0x0:_0x5a144a[_0x374c('0x18')];var _0x1d51e0=_0x51778b?_0x5ab8ab['count']:_0x5a144a[_0x374c('0x18')]+_0x5a144a['limit'];var _0x3acf14;if(_0x1d51e0>=_0x43144d){_0x1d51e0=_0x43144d;_0x3acf14=0xc8;}else{_0x3acf14=0xce;}_0x3c8bb2[_0x374c('0x16')](_0x3acf14);return _0x3c8bb2['set'](_0x374c('0x1b'),_0x59c16d+'-'+_0x1d51e0+'/'+_0x43144d)[_0x374c('0x17')](_0x5ab8ab);}return null;};}function patchUpdates(_0x1ee851){return function(_0x8fcbc5){try{jsonpatch[_0x374c('0x1c')](_0x8fcbc5,_0x1ee851,!![]);}catch(_0x39043b){return BPromise[_0x374c('0x1d')](_0x39043b);}return _0x8fcbc5['save']();};}function saveUpdates(_0x571d25,_0x3e7608){return function(_0x3aee56){if(_0x3aee56){return _0x3aee56[_0x374c('0x1e')](_0x571d25)['then'](function(_0x182c4c){return _0x182c4c;});}return null;};}function removeEntity(_0x22fab1,_0x41df60){return function(_0x3330c9){if(_0x3330c9){return _0x3330c9[_0x374c('0x1f')]()['then'](function(){_0x22fab1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27a03b,_0x1fa783){return function(_0x4db215){if(!_0x4db215){_0x27a03b[_0x374c('0x15')](0x194);}return _0x4db215;};}function handleError(_0x707bbf,_0x59aac6){_0x59aac6=_0x59aac6||0x1f4;return function(_0x169092){logger[_0x374c('0x20')](_0x169092[_0x374c('0x21')]);if(_0x169092[_0x374c('0x22')]){delete _0x169092['name'];}_0x707bbf[_0x374c('0x16')](_0x59aac6)[_0x374c('0x23')](_0x169092);};}exports[_0x374c('0x24')]=function(_0x46f509,_0x3c795e){var _0x35e71c={},_0x44e505={},_0x16b5b8={'count':0x0,'rows':[]};var _0x31536b=_['map'](db[_0x374c('0x25')][_0x374c('0x26')],function(_0x37db26){return{'name':_0x37db26[_0x374c('0x27')],'type':_0x37db26['type'][_0x374c('0x28')]};});_0x44e505[_0x374c('0x29')]=_[_0x374c('0x2a')](_0x31536b,'name');_0x44e505[_0x374c('0x2b')]=_[_0x374c('0x2c')](_0x46f509[_0x374c('0x2b')]);_0x44e505[_0x374c('0x2d')]=_['intersection'](_0x44e505['model'],_0x44e505[_0x374c('0x2b')]);_0x35e71c[_0x374c('0x2e')]=_[_0x374c('0x2f')](_0x44e505[_0x374c('0x29')],qs['fields'](_0x46f509[_0x374c('0x2b')][_0x374c('0x30')]));_0x35e71c[_0x374c('0x2e')]=_0x35e71c[_0x374c('0x2e')][_0x374c('0x31')]?_0x35e71c[_0x374c('0x2e')]:_0x44e505['model'];if(!_0x46f509['query'][_0x374c('0x32')](_0x374c('0x33'))){_0x35e71c[_0x374c('0x34')]=qs[_0x374c('0x34')](_0x46f509[_0x374c('0x2b')][_0x374c('0x34')]);_0x35e71c[_0x374c('0x18')]=qs[_0x374c('0x18')](_0x46f509[_0x374c('0x2b')]['offset']);}_0x35e71c[_0x374c('0x35')]=qs['sort'](_0x46f509[_0x374c('0x2b')][_0x374c('0x36')]);_0x35e71c[_0x374c('0x37')]=qs[_0x374c('0x2d')](_['pick'](_0x46f509['query'],_0x44e505[_0x374c('0x2d')]),_0x31536b);if(_0x46f509['query'][_0x374c('0x38')]){_0x35e71c[_0x374c('0x37')]=_[_0x374c('0x39')](_0x35e71c[_0x374c('0x37')],{'$or':_[_0x374c('0x2a')](_0x31536b,function(_0x2b109d){if(_0x2b109d[_0x374c('0x3a')]!==_0x374c('0x3b')){var _0x2f647c={};_0x2f647c[_0x2b109d['name']]={'$like':'%'+_0x46f509['query'][_0x374c('0x38')]+'%'};return _0x2f647c;}})});}_0x35e71c=_[_0x374c('0x39')]({},_0x35e71c,_0x46f509[_0x374c('0x3c')]);var _0x3495f6={'where':_0x35e71c[_0x374c('0x37')]};return db[_0x374c('0x25')][_0x374c('0x1a')](_0x3495f6)['then'](function(_0x5615b8){_0x16b5b8[_0x374c('0x1a')]=_0x5615b8;if(_0x46f509[_0x374c('0x2b')]['includeAll']){_0x35e71c[_0x374c('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x374c('0x3e')](_0x35e71c);})[_0x374c('0x3f')](function(_0x14b464){_0x16b5b8[_0x374c('0x40')]=_0x14b464;return _0x16b5b8;})[_0x374c('0x3f')](respondWithFilteredResult(_0x3c795e,_0x35e71c))[_0x374c('0x41')](handleError(_0x3c795e,null));};exports['show']=function(_0x4e1181,_0x1b0408){var _0x50b4cb={'raw':![],'where':{'id':_0x4e1181[_0x374c('0x42')]['id']}},_0x1d6725={};_0x1d6725[_0x374c('0x29')]=_[_0x374c('0x2c')](db['DeskConfiguration'][_0x374c('0x26')]);_0x1d6725[_0x374c('0x2b')]=_[_0x374c('0x2c')](_0x4e1181[_0x374c('0x2b')]);_0x1d6725[_0x374c('0x2d')]=_[_0x374c('0x2f')](_0x1d6725[_0x374c('0x29')],_0x1d6725[_0x374c('0x2b')]);_0x50b4cb[_0x374c('0x2e')]=_[_0x374c('0x2f')](_0x1d6725[_0x374c('0x29')],qs[_0x374c('0x30')](_0x4e1181[_0x374c('0x2b')]['fields']));_0x50b4cb[_0x374c('0x2e')]=_0x50b4cb['attributes'][_0x374c('0x31')]?_0x50b4cb[_0x374c('0x2e')]:_0x1d6725['model'];if(_0x4e1181['query'][_0x374c('0x43')]){_0x50b4cb[_0x374c('0x3d')]=[{'all':!![]}];}_0x50b4cb=_[_0x374c('0x39')]({},_0x50b4cb,_0x4e1181['options']);return db[_0x374c('0x25')][_0x374c('0x44')](_0x50b4cb)[_0x374c('0x3f')](handleEntityNotFound(_0x1b0408,null))[_0x374c('0x3f')](respondWithResult(_0x1b0408,null))[_0x374c('0x41')](handleError(_0x1b0408,null));};exports[_0x374c('0x45')]=function(_0x10bf1c,_0xe9308f){return db[_0x374c('0x25')][_0x374c('0x45')](_0x10bf1c[_0x374c('0x46')],{})[_0x374c('0x3f')](respondWithResult(_0xe9308f,0xc9))['catch'](handleError(_0xe9308f,null));};exports[_0x374c('0x1e')]=function(_0x5162a6,_0x44e038){if(_0x5162a6[_0x374c('0x46')]['id']){delete _0x5162a6[_0x374c('0x46')]['id'];}return db[_0x374c('0x25')][_0x374c('0x44')]({'where':{'id':_0x5162a6[_0x374c('0x42')]['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0x44e038,null))[_0x374c('0x3f')](saveUpdates(_0x5162a6['body'],null))['then'](respondWithResult(_0x44e038,null))['catch'](handleError(_0x44e038,null));};exports['destroy']=function(_0x4ee569,_0x1e879d){return db[_0x374c('0x25')][_0x374c('0x44')]({'where':{'id':_0x4ee569[_0x374c('0x42')]['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0x1e879d,null))['then'](removeEntity(_0x1e879d,null))[_0x374c('0x41')](handleError(_0x1e879d,null));};exports[_0x374c('0x47')]=function(_0x231d54,_0x5b30e3,_0x1a12f3){var _0x194e4c={};var _0x28b161={};var _0x16f35d;var _0x3c099a;return db[_0x374c('0x25')][_0x374c('0x48')]({'where':{'id':_0x231d54[_0x374c('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b30e3,null))[_0x374c('0x3f')](function(_0x2cace3){if(_0x2cace3){_0x16f35d=_0x2cace3;_0x28b161[_0x374c('0x29')]=_[_0x374c('0x2c')](db[_0x374c('0x49')][_0x374c('0x26')]);_0x28b161[_0x374c('0x2b')]=_['keys'](_0x231d54[_0x374c('0x2b')]);_0x28b161['filters']=_[_0x374c('0x2f')](_0x28b161['model'],_0x28b161[_0x374c('0x2b')]);_0x194e4c['attributes']=_[_0x374c('0x2f')](_0x28b161[_0x374c('0x29')],qs[_0x374c('0x30')](_0x231d54[_0x374c('0x2b')][_0x374c('0x30')]));_0x194e4c[_0x374c('0x2e')]=_0x194e4c['attributes'][_0x374c('0x31')]?_0x194e4c[_0x374c('0x2e')]:_0x28b161['model'];_0x194e4c['order']=qs[_0x374c('0x36')](_0x231d54['query']['sort']);_0x194e4c['where']=qs[_0x374c('0x2d')](_[_0x374c('0x4a')](_0x231d54[_0x374c('0x2b')],_0x28b161['filters']));if(_0x231d54['query'][_0x374c('0x38')]){_0x194e4c[_0x374c('0x37')]=_['merge'](_0x194e4c['where'],{'$or':_[_0x374c('0x2a')](_0x194e4c[_0x374c('0x2e')],function(_0x5b77e1){var _0x2e67a2={};_0x2e67a2[_0x5b77e1]={'$like':'%'+_0x231d54[_0x374c('0x2b')][_0x374c('0x38')]+'%'};return _0x2e67a2;})});}_0x194e4c=_['merge']({},_0x194e4c,_0x231d54[_0x374c('0x3c')]);return _0x16f35d[_0x374c('0x47')](_0x194e4c);}})[_0x374c('0x3f')](function(_0x24fabc){if(_0x24fabc){_0x3c099a=_0x24fabc['length'];if(!_0x231d54['query']['hasOwnProperty'](_0x374c('0x33'))){_0x194e4c[_0x374c('0x34')]=qs['limit'](_0x231d54[_0x374c('0x2b')][_0x374c('0x34')]);_0x194e4c['offset']=qs[_0x374c('0x18')](_0x231d54[_0x374c('0x2b')][_0x374c('0x18')]);}return _0x16f35d['getFields'](_0x194e4c);}})[_0x374c('0x3f')](function(_0x55b863){if(_0x55b863){return _0x55b863?{'count':_0x3c099a,'rows':_0x55b863}:null;}})[_0x374c('0x3f')](respondWithResult(_0x5b30e3,null))['catch'](handleError(_0x5b30e3,null));};exports[_0x374c('0x4b')]=function(_0x3fe274,_0x3daf7a,_0x1701c3){var _0x6595fd={};var _0x5b6103={};var _0x2bc687;var _0x43757f;return db[_0x374c('0x25')][_0x374c('0x48')]({'where':{'id':_0x3fe274[_0x374c('0x42')]['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0x3daf7a,null))[_0x374c('0x3f')](function(_0x441cd7){if(_0x441cd7){_0x2bc687=_0x441cd7;_0x5b6103['model']=_[_0x374c('0x2c')](db['DeskField']['rawAttributes']);_0x5b6103[_0x374c('0x2b')]=_[_0x374c('0x2c')](_0x3fe274['query']);_0x5b6103[_0x374c('0x2d')]=_[_0x374c('0x2f')](_0x5b6103[_0x374c('0x29')],_0x5b6103['query']);_0x6595fd[_0x374c('0x2e')]=_['intersection'](_0x5b6103[_0x374c('0x29')],qs['fields'](_0x3fe274[_0x374c('0x2b')][_0x374c('0x30')]));_0x6595fd[_0x374c('0x2e')]=_0x6595fd[_0x374c('0x2e')]['length']?_0x6595fd[_0x374c('0x2e')]:_0x5b6103[_0x374c('0x29')];_0x6595fd[_0x374c('0x35')]=qs[_0x374c('0x36')](_0x3fe274[_0x374c('0x2b')]['sort']);_0x6595fd[_0x374c('0x37')]=qs[_0x374c('0x2d')](_[_0x374c('0x4a')](_0x3fe274[_0x374c('0x2b')],_0x5b6103[_0x374c('0x2d')]));if(_0x3fe274[_0x374c('0x2b')][_0x374c('0x38')]){_0x6595fd[_0x374c('0x37')]=_[_0x374c('0x39')](_0x6595fd[_0x374c('0x37')],{'$or':_['map'](_0x6595fd['attributes'],function(_0x17e2e6){var _0x3594b3={};_0x3594b3[_0x17e2e6]={'$like':'%'+_0x3fe274[_0x374c('0x2b')]['filter']+'%'};return _0x3594b3;})});}_0x6595fd=_[_0x374c('0x39')]({},_0x6595fd,_0x3fe274[_0x374c('0x3c')]);return _0x2bc687[_0x374c('0x4b')](_0x6595fd);}})[_0x374c('0x3f')](function(_0x4fb326){if(_0x4fb326){_0x43757f=_0x4fb326['length'];if(!_0x3fe274[_0x374c('0x2b')]['hasOwnProperty'](_0x374c('0x33'))){_0x6595fd[_0x374c('0x34')]=qs[_0x374c('0x34')](_0x3fe274[_0x374c('0x2b')][_0x374c('0x34')]);_0x6595fd['offset']=qs[_0x374c('0x18')](_0x3fe274[_0x374c('0x2b')][_0x374c('0x18')]);}return _0x2bc687['getSubjects'](_0x6595fd);}})[_0x374c('0x3f')](function(_0x2c3114){if(_0x2c3114){return _0x2c3114?{'count':_0x43757f,'rows':_0x2c3114}:null;}})[_0x374c('0x3f')](respondWithResult(_0x3daf7a,null))['catch'](handleError(_0x3daf7a,null));};exports[_0x374c('0x4c')]=function(_0x3a6119,_0xab9c85,_0x534e93){var _0x492d32={};var _0x5f3266={};var _0x5074dd;var _0x39a329;return db[_0x374c('0x25')][_0x374c('0x48')]({'where':{'id':_0x3a6119[_0x374c('0x42')]['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0xab9c85,null))[_0x374c('0x3f')](function(_0x5c038c){if(_0x5c038c){_0x5074dd=_0x5c038c;_0x5f3266[_0x374c('0x29')]=_[_0x374c('0x2c')](db[_0x374c('0x49')]['rawAttributes']);_0x5f3266['query']=_[_0x374c('0x2c')](_0x3a6119[_0x374c('0x2b')]);_0x5f3266[_0x374c('0x2d')]=_[_0x374c('0x2f')](_0x5f3266[_0x374c('0x29')],_0x5f3266[_0x374c('0x2b')]);_0x492d32['attributes']=_['intersection'](_0x5f3266[_0x374c('0x29')],qs[_0x374c('0x30')](_0x3a6119['query'][_0x374c('0x30')]));_0x492d32[_0x374c('0x2e')]=_0x492d32[_0x374c('0x2e')][_0x374c('0x31')]?_0x492d32[_0x374c('0x2e')]:_0x5f3266[_0x374c('0x29')];_0x492d32[_0x374c('0x35')]=qs['sort'](_0x3a6119[_0x374c('0x2b')][_0x374c('0x36')]);_0x492d32[_0x374c('0x37')]=qs[_0x374c('0x2d')](_['pick'](_0x3a6119['query'],_0x5f3266[_0x374c('0x2d')]));if(_0x3a6119['query']['filter']){_0x492d32[_0x374c('0x37')]=_[_0x374c('0x39')](_0x492d32[_0x374c('0x37')],{'$or':_[_0x374c('0x2a')](_0x492d32['attributes'],function(_0x5a5369){var _0x2a0503={};_0x2a0503[_0x5a5369]={'$like':'%'+_0x3a6119['query'][_0x374c('0x38')]+'%'};return _0x2a0503;})});}_0x492d32=_[_0x374c('0x39')]({},_0x492d32,_0x3a6119['options']);return _0x5074dd[_0x374c('0x4c')](_0x492d32);}})[_0x374c('0x3f')](function(_0x43ade3){if(_0x43ade3){_0x39a329=_0x43ade3[_0x374c('0x31')];if(!_0x3a6119['query'][_0x374c('0x32')]('nolimit')){_0x492d32['limit']=qs[_0x374c('0x34')](_0x3a6119[_0x374c('0x2b')]['limit']);_0x492d32[_0x374c('0x18')]=qs[_0x374c('0x18')](_0x3a6119[_0x374c('0x2b')][_0x374c('0x18')]);}return _0x5074dd['getDescriptions'](_0x492d32);}})['then'](function(_0x4672b1){if(_0x4672b1){return _0x4672b1?{'count':_0x39a329,'rows':_0x4672b1}:null;}})[_0x374c('0x3f')](respondWithResult(_0xab9c85,null))[_0x374c('0x41')](handleError(_0xab9c85,null));};exports[_0x374c('0x4d')]=function(_0x43fbb2,_0x369d24,_0x480d01){var _0x8866e={};var _0x579cd5={};var _0x28171c;var _0x304606;return db[_0x374c('0x25')][_0x374c('0x48')]({'where':{'id':_0x43fbb2['params']['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0x369d24,null))['then'](function(_0x4790da){if(_0x4790da){_0x28171c=_0x4790da;_0x579cd5['model']=_['keys'](db[_0x374c('0x4e')]['rawAttributes']);_0x579cd5[_0x374c('0x2b')]=_[_0x374c('0x2c')](_0x43fbb2[_0x374c('0x2b')]);_0x579cd5['filters']=_['intersection'](_0x579cd5[_0x374c('0x29')],_0x579cd5[_0x374c('0x2b')]);_0x8866e[_0x374c('0x2e')]=_['intersection'](_0x579cd5['model'],qs[_0x374c('0x30')](_0x43fbb2[_0x374c('0x2b')][_0x374c('0x30')]));_0x8866e[_0x374c('0x2e')]=_0x8866e[_0x374c('0x2e')][_0x374c('0x31')]?_0x8866e['attributes']:_0x579cd5['model'];_0x8866e['order']=qs[_0x374c('0x36')](_0x43fbb2[_0x374c('0x2b')][_0x374c('0x36')]);_0x8866e[_0x374c('0x37')]=qs['filters'](_['pick'](_0x43fbb2[_0x374c('0x2b')],_0x579cd5[_0x374c('0x2d')]));if(_0x43fbb2['query'][_0x374c('0x38')]){_0x8866e[_0x374c('0x37')]=_[_0x374c('0x39')](_0x8866e[_0x374c('0x37')],{'$or':_['map'](_0x8866e['attributes'],function(_0x37f83a){var _0x1efaae={};_0x1efaae[_0x37f83a]={'$like':'%'+_0x43fbb2['query'][_0x374c('0x38')]+'%'};return _0x1efaae;})});}_0x8866e=_[_0x374c('0x39')]({},_0x8866e,_0x43fbb2[_0x374c('0x3c')]);return _0x28171c['getTags'](_0x8866e);}})[_0x374c('0x3f')](function(_0x253dfb){if(_0x253dfb){_0x304606=_0x253dfb[_0x374c('0x31')];if(!_0x43fbb2['query'][_0x374c('0x32')]('nolimit')){_0x8866e[_0x374c('0x34')]=qs[_0x374c('0x34')](_0x43fbb2[_0x374c('0x2b')]['limit']);_0x8866e[_0x374c('0x18')]=qs[_0x374c('0x18')](_0x43fbb2[_0x374c('0x2b')]['offset']);}return _0x28171c['getTags'](_0x8866e);}})[_0x374c('0x3f')](function(_0x4b2272){if(_0x4b2272){return _0x4b2272?{'count':_0x304606,'rows':_0x4b2272}:null;}})[_0x374c('0x3f')](respondWithResult(_0x369d24,null))[_0x374c('0x41')](handleError(_0x369d24,null));};exports[_0x374c('0x4f')]=function(_0x5218f4,_0x3f3014,_0x532b44){if(_0x5218f4[_0x374c('0x46')]['id']){delete _0x5218f4[_0x374c('0x46')]['id'];}return db[_0x374c('0x25')]['findOne']({'where':{'id':_0x5218f4[_0x374c('0x42')]['id']}})[_0x374c('0x3f')](handleEntityNotFound(_0x3f3014,null))[_0x374c('0x3f')](function(_0x25be36){if(_0x25be36){return _0x25be36[_0x374c('0x4f')](_0x5218f4['body'][_0x374c('0x50')]||[]);}return null;})[_0x374c('0x3f')](respondWithResult(_0x3f3014,null))[_0x374c('0x41')](handleError(_0x3f3014,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index a7ebb04..dac1ff7 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 _0x6df3=['rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x9ca932,_0x34c99e){var _0x4eb514=function(_0x8c44f5){while(--_0x8c44f5){_0x9ca932['push'](_0x9ca932['shift']());}};_0x4eb514(++_0x34c99e);}(_0x6df3,0x13a));var _0x36df=function(_0x524fba,_0x4b4f00){_0x524fba=_0x524fba-0x0;var _0x1059f4=_0x6df3[_0x524fba];return _0x1059f4;};'use strict';var _=require(_0x36df('0x0'));var util=require(_0x36df('0x1'));var logger=require(_0x36df('0x2'))('api');var moment=require('moment');var BPromise=require(_0x36df('0x3'));var rp=require(_0x36df('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36df('0x5'));var config=require('../../config/environment');var attributes=require(_0x36df('0x6'));module[_0x36df('0x7')]=function(_0x42a2b9,_0x4b14db){return _0x42a2b9[_0x36df('0x8')](_0x36df('0x9'),attributes,{'tableName':_0x36df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfde3=['bluebird','request-promise','path','../../config/environment','exports','define','int_desk_configurations','lodash','moment'];(function(_0x492813,_0x4fad44){var _0x1c30ab=function(_0x454c23){while(--_0x454c23){_0x492813['push'](_0x492813['shift']());}};_0x1c30ab(++_0x4fad44);}(_0xfde3,0xe8));var _0x3fde=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xfde3[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x3fde('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3fde('0x1'));var BPromise=require(_0x3fde('0x2'));var rp=require(_0x3fde('0x3'));var fs=require('fs');var path=require(_0x3fde('0x4'));var rimraf=require('rimraf');var config=require(_0x3fde('0x5'));var attributes=require('./intDeskConfiguration.attributes');module[_0x3fde('0x6')]=function(_0xb76889,_0x49ea96){return _0xb76889[_0x3fde('0x7')]('DeskConfiguration',attributes,{'tableName':_0x3fde('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 222f3b3..5b5e6aa 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 _0xe8b1=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','DeskConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0x57c248,_0x32de39){var _0x21ce47=function(_0x51d3bd){while(--_0x51d3bd){_0x57c248['push'](_0x57c248['shift']());}};_0x21ce47(++_0x32de39);}(_0xe8b1,0x104));var _0x1e8b=function(_0x1619c1,_0x21b9fd){_0x1619c1=_0x1619c1-0x0;var _0x424d3f=_0xe8b1[_0x1619c1];return _0x424d3f;};'use strict';var _=require(_0x1e8b('0x0'));var util=require(_0x1e8b('0x1'));var moment=require('moment');var BPromise=require(_0x1e8b('0x2'));var rs=require(_0x1e8b('0x3'));var fs=require('fs');var Redis=require(_0x1e8b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e8b('0x5'));var logger=require(_0x1e8b('0x6'))(_0x1e8b('0x7'));var config=require(_0x1e8b('0x8'));var jayson=require(_0x1e8b('0x9'));var client=jayson[_0x1e8b('0xa')][_0x1e8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56795d,_0x5d3564,_0x4f2033){return new BPromise(function(_0x32d045,_0x2face3){return client[_0x1e8b('0xc')](_0x56795d,_0x4f2033)['then'](function(_0x36cb9b){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x5d3564,_0x1e8b('0xd'));logger[_0x1e8b('0xe')](_0x1e8b('0xf'),_0x5d3564,_0x1e8b('0xd'),JSON['stringify'](_0x36cb9b));if(_0x36cb9b[_0x1e8b('0x10')]){if(_0x36cb9b[_0x1e8b('0x10')]['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5d3564,_0x36cb9b['error'][_0x1e8b('0x11')]);return _0x2face3(_0x36cb9b[_0x1e8b('0x10')][_0x1e8b('0x11')]);}logger['error'](_0x1e8b('0x12'),_0x5d3564,_0x36cb9b[_0x1e8b('0x10')][_0x1e8b('0x11')]);return _0x32d045(_0x36cb9b[_0x1e8b('0x10')][_0x1e8b('0x11')]);}else{logger[_0x1e8b('0x13')](_0x1e8b('0x12'),_0x5d3564,_0x1e8b('0xd'));_0x32d045(_0x36cb9b[_0x1e8b('0x14')][_0x1e8b('0x11')]);}})[_0x1e8b('0x15')](function(_0x959529){logger['error'](_0x1e8b('0x12'),_0x5d3564,_0x959529);_0x2face3(_0x959529);});});} \ No newline at end of file +var _0x534b=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0x4341e2,_0x17dfff){var _0x4d9dff=function(_0x5201d3){while(--_0x5201d3){_0x4341e2['push'](_0x4341e2['shift']());}};_0x4d9dff(++_0x17dfff);}(_0x534b,0xbd));var _0xb534=function(_0x28b54,_0x251993){_0x28b54=_0x28b54-0x0;var _0x40bbff=_0x534b[_0x28b54];return _0x40bbff;};'use strict';var _=require(_0xb534('0x0'));var util=require(_0xb534('0x1'));var moment=require('moment');var BPromise=require(_0xb534('0x2'));var rs=require(_0xb534('0x3'));var fs=require('fs');var Redis=require(_0xb534('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb534('0x5'));var logger=require('../../config/logger')(_0xb534('0x6'));var config=require(_0xb534('0x7'));var jayson=require(_0xb534('0x8'));var client=jayson[_0xb534('0x9')][_0xb534('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54ea55,_0x23383c,_0x2c0b7f){return new BPromise(function(_0x446a52,_0x4637f6){return client[_0xb534('0xb')](_0x54ea55,_0x2c0b7f)[_0xb534('0xc')](function(_0x43a29e){logger['info'](_0xb534('0xd'),_0x23383c,'request\x20sent');logger[_0xb534('0xe')](_0xb534('0xf'),_0x23383c,_0xb534('0x10'),JSON[_0xb534('0x11')](_0x43a29e));if(_0x43a29e['error']){if(_0x43a29e[_0xb534('0x12')][_0xb534('0x13')]===0x1f4){logger['error'](_0xb534('0xd'),_0x23383c,_0x43a29e[_0xb534('0x12')][_0xb534('0x14')]);return _0x4637f6(_0x43a29e['error'][_0xb534('0x14')]);}logger[_0xb534('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x23383c,_0x43a29e['error'][_0xb534('0x14')]);return _0x446a52(_0x43a29e[_0xb534('0x12')][_0xb534('0x14')]);}else{logger[_0xb534('0x15')](_0xb534('0xd'),_0x23383c,_0xb534('0x10'));_0x446a52(_0x43a29e[_0xb534('0x16')][_0xb534('0x14')]);}})[_0xb534('0x17')](function(_0x15d352){logger['error'](_0xb534('0xd'),_0x23383c,_0x15d352);_0x4637f6(_0x15d352);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 2bb4b1f..9d74454 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 _0x69bf=['../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x53cd9e,_0x392224){var _0xc51597=function(_0x1ba444){while(--_0x1ba444){_0x53cd9e['push'](_0x53cd9e['shift']());}};_0xc51597(++_0x392224);}(_0x69bf,0x188));var _0xf69b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x69bf[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf69b('0x0'));var util=require(_0xf69b('0x1'));var path=require('path');var timeout=require(_0xf69b('0x2'));var express=require(_0xf69b('0x3'));var router=express[_0xf69b('0x4')]();var fs_extra=require(_0xf69b('0x5'));var auth=require(_0xf69b('0x6'));var interaction=require(_0xf69b('0x7'));var config=require(_0xf69b('0x8'));var controller=require(_0xf69b('0x9'));router['get']('/',auth[_0xf69b('0xa')](),controller[_0xf69b('0xb')]);router[_0xf69b('0xc')](_0xf69b('0xd'),auth[_0xf69b('0xa')](),controller[_0xf69b('0xe')]);router[_0xf69b('0xf')]('/',auth[_0xf69b('0xa')](),controller[_0xf69b('0x10')]);router[_0xf69b('0x11')](_0xf69b('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xf69b('0x12')](_0xf69b('0xd'),auth['isAuthenticated'](),controller[_0xf69b('0x13')]);module[_0xf69b('0x14')]=router; \ No newline at end of file +var _0x6de2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x1f6ad9,_0x43dc2d){var _0x1b4d80=function(_0x5b0f2e){while(--_0x5b0f2e){_0x1f6ad9['push'](_0x1f6ad9['shift']());}};_0x1b4d80(++_0x43dc2d);}(_0x6de2,0x152));var _0x26de=function(_0x529323,_0x3f4a2e){_0x529323=_0x529323-0x0;var _0x57b4d2=_0x6de2[_0x529323];return _0x57b4d2;};'use strict';var multer=require(_0x26de('0x0'));var util=require(_0x26de('0x1'));var path=require(_0x26de('0x2'));var timeout=require(_0x26de('0x3'));var express=require(_0x26de('0x4'));var router=express['Router']();var fs_extra=require(_0x26de('0x5'));var auth=require(_0x26de('0x6'));var interaction=require(_0x26de('0x7'));var config=require(_0x26de('0x8'));var controller=require(_0x26de('0x9'));router['get']('/',auth[_0x26de('0xa')](),controller[_0x26de('0xb')]);router[_0x26de('0xc')](_0x26de('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x26de('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x26de('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x26de('0x10')]);router[_0x26de('0x11')](_0x26de('0xd'),auth[_0x26de('0xa')](),controller['destroy']);module[_0x26de('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 53c5f9e..e17eae7 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 _0x7f64=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x5d431c,_0x340df3){var _0x5453b4=function(_0xbd077d){while(--_0xbd077d){_0x5d431c['push'](_0x5d431c['shift']());}};_0x5453b4(++_0x340df3);}(_0x7f64,0x68));var _0x47f6=function(_0x3ad592,_0x1f624d){_0x3ad592=_0x3ad592-0x0;var _0x3909d7=_0x7f64[_0x3ad592];return _0x3909d7;};'use strict';var Sequelize=require(_0x47f6('0x0'));module[_0x47f6('0x1')]={'type':{'type':Sequelize['ENUM'](_0x47f6('0x2'),_0x47f6('0x3'),_0x47f6('0x4'),_0x47f6('0x5'),_0x47f6('0x6')),'defaultValue':_0x47f6('0x2')},'content':{'type':Sequelize[_0x47f6('0x7')]},'key':{'type':Sequelize[_0x47f6('0x7')]},'keyType':{'type':Sequelize[_0x47f6('0x8')]('string',_0x47f6('0x3'),_0x47f6('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x47f6('0x7')]},'nameField':{'type':Sequelize[_0x47f6('0x7')]},'customField':{'type':Sequelize[_0x47f6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0bef=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x0bef,0x173));var _0xf0be=function(_0x3b10f4,_0x59f4a7){_0x3b10f4=_0x3b10f4-0x0;var _0x9fa36f=_0x0bef[_0x3b10f4];return _0x9fa36f;};'use strict';var Sequelize=require(_0xf0be('0x0'));module['exports']={'type':{'type':Sequelize[_0xf0be('0x1')](_0xf0be('0x2'),_0xf0be('0x3'),_0xf0be('0x4'),_0xf0be('0x5'),_0xf0be('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf0be('0x7')]},'key':{'type':Sequelize[_0xf0be('0x7')]},'keyType':{'type':Sequelize[_0xf0be('0x1')](_0xf0be('0x2'),_0xf0be('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xf0be('0x7')]},'idField':{'type':Sequelize[_0xf0be('0x7')]},'nameField':{'type':Sequelize[_0xf0be('0x7')]},'customField':{'type':Sequelize[_0xf0be('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf0be('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 6dc7547..13f8962 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 _0xbd36=['DeskField','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','fields','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map'];(function(_0x5464af,_0x5bedc3){var _0x38626e=function(_0x164d8a){while(--_0x164d8a){_0x5464af['push'](_0x5464af['shift']());}};_0x38626e(++_0x5bedc3);}(_0xbd36,0x65));var _0x6bd3=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xbd36[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0x6bd3('0x0'));var rimraf=require(_0x6bd3('0x1'));var zipdir=require(_0x6bd3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6bd3('0x3'));var BPromise=require(_0x6bd3('0x4'));var Mustache=require('mustache');var util=require(_0x6bd3('0x5'));var path=require(_0x6bd3('0x6'));var sox=require(_0x6bd3('0x7'));var csv=require(_0x6bd3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bd3('0x9'));var _=require(_0x6bd3('0xa'));var squel=require(_0x6bd3('0xb'));var crypto=require(_0x6bd3('0xc'));var jsforce=require(_0x6bd3('0xd'));var deskjs=require(_0x6bd3('0xe'));var toCsv=require(_0x6bd3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6bd3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6bd3('0x10'));var as=require(_0x6bd3('0x11'));var hardwareService=require(_0x6bd3('0x12'));var logger=require(_0x6bd3('0x13'))(_0x6bd3('0x14'));var utils=require('../../config/utils');var config=require(_0x6bd3('0x15'));var licenseUtil=require(_0x6bd3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29c44d,_0x43bf5f){_0x43bf5f=_0x43bf5f||0xcc;return function(_0x2a047c){if(_0x2a047c){return _0x29c44d[_0x6bd3('0x17')](_0x43bf5f);}return _0x29c44d[_0x6bd3('0x18')](_0x43bf5f)[_0x6bd3('0x19')]();};}function respondWithResult(_0x4dd159,_0x141121){_0x141121=_0x141121||0xc8;return function(_0x4987f9){if(_0x4987f9){return _0x4dd159[_0x6bd3('0x18')](_0x141121)[_0x6bd3('0x1a')](_0x4987f9);}};}function respondWithFilteredResult(_0x5ad1f8,_0x583df8){return function(_0x47acc9){if(_0x47acc9){var _0x115ca9=typeof _0x583df8['offset']===_0x6bd3('0x1b')&&typeof _0x583df8[_0x6bd3('0x1c')]===_0x6bd3('0x1b');var _0x4732f3=_0x47acc9['count'];var _0x573656=_0x115ca9?0x0:_0x583df8[_0x6bd3('0x1d')];var _0x769de8=_0x115ca9?_0x47acc9[_0x6bd3('0x1e')]:_0x583df8[_0x6bd3('0x1d')]+_0x583df8[_0x6bd3('0x1c')];var _0xf96734;if(_0x769de8>=_0x4732f3){_0x769de8=_0x4732f3;_0xf96734=0xc8;}else{_0xf96734=0xce;}_0x5ad1f8[_0x6bd3('0x18')](_0xf96734);return _0x5ad1f8[_0x6bd3('0x1f')](_0x6bd3('0x20'),_0x573656+'-'+_0x769de8+'/'+_0x4732f3)[_0x6bd3('0x1a')](_0x47acc9);}return null;};}function patchUpdates(_0x256bca){return function(_0x175d46){try{jsonpatch[_0x6bd3('0x21')](_0x175d46,_0x256bca,!![]);}catch(_0x36618c){return BPromise[_0x6bd3('0x22')](_0x36618c);}return _0x175d46[_0x6bd3('0x23')]();};}function saveUpdates(_0x473b10,_0x1d09fd){return function(_0x9ffd4b){if(_0x9ffd4b){return _0x9ffd4b[_0x6bd3('0x24')](_0x473b10)['then'](function(_0x3365a4){return _0x3365a4;});}return null;};}function removeEntity(_0x3a9d0d,_0x28b9a9){return function(_0x52def3){if(_0x52def3){return _0x52def3[_0x6bd3('0x25')]()[_0x6bd3('0x26')](function(){_0x3a9d0d[_0x6bd3('0x18')](0xcc)[_0x6bd3('0x19')]();});}};}function handleEntityNotFound(_0xa8c894,_0x24230d){return function(_0x143055){if(!_0x143055){_0xa8c894[_0x6bd3('0x17')](0x194);}return _0x143055;};}function handleError(_0x49dc5c,_0xab162b){_0xab162b=_0xab162b||0x1f4;return function(_0x585f4e){logger[_0x6bd3('0x27')](_0x585f4e[_0x6bd3('0x28')]);if(_0x585f4e['name']){delete _0x585f4e[_0x6bd3('0x29')];}_0x49dc5c[_0x6bd3('0x18')](_0xab162b)[_0x6bd3('0x2a')](_0x585f4e);};}exports[_0x6bd3('0x2b')]=function(_0x4444bd,_0x1f45af){var _0x7f3385={},_0x552628={},_0xf12e0d={'count':0x0,'rows':[]};var _0xe2772a=_[_0x6bd3('0x2c')](db[_0x6bd3('0x2d')]['rawAttributes'],function(_0x5e1281){return{'name':_0x5e1281['fieldName'],'type':_0x5e1281[_0x6bd3('0x2e')][_0x6bd3('0x2f')]};});_0x552628[_0x6bd3('0x30')]=_[_0x6bd3('0x2c')](_0xe2772a,_0x6bd3('0x29'));_0x552628['query']=_[_0x6bd3('0x31')](_0x4444bd[_0x6bd3('0x32')]);_0x552628['filters']=_[_0x6bd3('0x33')](_0x552628[_0x6bd3('0x30')],_0x552628[_0x6bd3('0x32')]);_0x7f3385['attributes']=_[_0x6bd3('0x33')](_0x552628[_0x6bd3('0x30')],qs['fields'](_0x4444bd[_0x6bd3('0x32')]['fields']));_0x7f3385[_0x6bd3('0x34')]=_0x7f3385[_0x6bd3('0x34')][_0x6bd3('0x35')]?_0x7f3385[_0x6bd3('0x34')]:_0x552628[_0x6bd3('0x30')];if(!_0x4444bd[_0x6bd3('0x32')][_0x6bd3('0x36')]('nolimit')){_0x7f3385[_0x6bd3('0x1c')]=qs[_0x6bd3('0x1c')](_0x4444bd[_0x6bd3('0x32')][_0x6bd3('0x1c')]);_0x7f3385[_0x6bd3('0x1d')]=qs[_0x6bd3('0x1d')](_0x4444bd[_0x6bd3('0x32')][_0x6bd3('0x1d')]);}_0x7f3385[_0x6bd3('0x37')]=qs[_0x6bd3('0x38')](_0x4444bd[_0x6bd3('0x32')]['sort']);_0x7f3385['where']=qs[_0x6bd3('0x39')](_[_0x6bd3('0x3a')](_0x4444bd[_0x6bd3('0x32')],_0x552628[_0x6bd3('0x39')]),_0xe2772a);if(_0x4444bd['query'][_0x6bd3('0x3b')]){_0x7f3385['where']=_[_0x6bd3('0x3c')](_0x7f3385[_0x6bd3('0x3d')],{'$or':_['map'](_0xe2772a,function(_0x4b9031){if(_0x4b9031[_0x6bd3('0x2e')]!==_0x6bd3('0x3e')){var _0x18274d={};_0x18274d[_0x4b9031[_0x6bd3('0x29')]]={'$like':'%'+_0x4444bd['query'][_0x6bd3('0x3b')]+'%'};return _0x18274d;}})});}_0x7f3385=_[_0x6bd3('0x3c')]({},_0x7f3385,_0x4444bd[_0x6bd3('0x3f')]);var _0x581a22={'where':_0x7f3385[_0x6bd3('0x3d')]};return db['DeskField'][_0x6bd3('0x1e')](_0x581a22)[_0x6bd3('0x26')](function(_0x37019f){_0xf12e0d['count']=_0x37019f;if(_0x4444bd[_0x6bd3('0x32')][_0x6bd3('0x40')]){_0x7f3385[_0x6bd3('0x41')]=[{'all':!![]}];}return db[_0x6bd3('0x2d')]['findAll'](_0x7f3385);})[_0x6bd3('0x26')](function(_0x41199e){_0xf12e0d['rows']=_0x41199e;return _0xf12e0d;})[_0x6bd3('0x26')](respondWithFilteredResult(_0x1f45af,_0x7f3385))[_0x6bd3('0x42')](handleError(_0x1f45af,null));};exports['show']=function(_0x100015,_0x397dc8){var _0xe2ca49={'raw':!![],'where':{'id':_0x100015[_0x6bd3('0x43')]['id']}},_0x1dbd4c={};_0x1dbd4c[_0x6bd3('0x30')]=_[_0x6bd3('0x31')](db[_0x6bd3('0x2d')][_0x6bd3('0x44')]);_0x1dbd4c['query']=_[_0x6bd3('0x31')](_0x100015['query']);_0x1dbd4c[_0x6bd3('0x39')]=_[_0x6bd3('0x33')](_0x1dbd4c[_0x6bd3('0x30')],_0x1dbd4c[_0x6bd3('0x32')]);_0xe2ca49[_0x6bd3('0x34')]=_[_0x6bd3('0x33')](_0x1dbd4c[_0x6bd3('0x30')],qs[_0x6bd3('0x45')](_0x100015[_0x6bd3('0x32')][_0x6bd3('0x45')]));_0xe2ca49['attributes']=_0xe2ca49[_0x6bd3('0x34')]['length']?_0xe2ca49[_0x6bd3('0x34')]:_0x1dbd4c[_0x6bd3('0x30')];if(_0x100015['query'][_0x6bd3('0x40')]){_0xe2ca49['include']=[{'all':!![]}];}_0xe2ca49=_[_0x6bd3('0x3c')]({},_0xe2ca49,_0x100015[_0x6bd3('0x3f')]);return db[_0x6bd3('0x2d')]['find'](_0xe2ca49)[_0x6bd3('0x26')](handleEntityNotFound(_0x397dc8,null))[_0x6bd3('0x26')](respondWithResult(_0x397dc8,null))[_0x6bd3('0x42')](handleError(_0x397dc8,null));};exports[_0x6bd3('0x46')]=function(_0xfd7b2,_0xba735e){return db['DeskField'][_0x6bd3('0x46')](_0xfd7b2[_0x6bd3('0x47')],{})[_0x6bd3('0x26')](respondWithResult(_0xba735e,0xc9))['catch'](handleError(_0xba735e,null));};exports[_0x6bd3('0x24')]=function(_0x59cee9,_0x52dfb1){if(_0x59cee9[_0x6bd3('0x47')]['id']){delete _0x59cee9[_0x6bd3('0x47')]['id'];}return db['DeskField'][_0x6bd3('0x48')]({'where':{'id':_0x59cee9['params']['id']}})[_0x6bd3('0x26')](handleEntityNotFound(_0x52dfb1,null))[_0x6bd3('0x26')](saveUpdates(_0x59cee9[_0x6bd3('0x47')],null))[_0x6bd3('0x26')](respondWithResult(_0x52dfb1,null))[_0x6bd3('0x42')](handleError(_0x52dfb1,null));};exports['destroy']=function(_0x4e4b52,_0x417e4f){return db['DeskField'][_0x6bd3('0x48')]({'where':{'id':_0x4e4b52[_0x6bd3('0x43')]['id']}})[_0x6bd3('0x26')](handleEntityNotFound(_0x417e4f,null))[_0x6bd3('0x26')](removeEntity(_0x417e4f,null))['catch'](handleError(_0x417e4f,null));}; \ No newline at end of file +var _0xad68=['model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','rawAttributes','filters','length','includeAll','find','create','body','params','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','DeskField','fieldName','type'];(function(_0x4fba44,_0x10e53c){var _0x1b87ec=function(_0x20015c){while(--_0x20015c){_0x4fba44['push'](_0x4fba44['shift']());}};_0x1b87ec(++_0x10e53c);}(_0xad68,0x100));var _0x8ad6=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xad68[_0x1fd9e7];return _0x1781f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8ad6('0x0'));var jsonpatch=require(_0x8ad6('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8ad6('0x2'));var Mustache=require(_0x8ad6('0x3'));var util=require(_0x8ad6('0x4'));var path=require(_0x8ad6('0x5'));var sox=require(_0x8ad6('0x6'));var csv=require(_0x8ad6('0x7'));var ejs=require(_0x8ad6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ad6('0x9'));var squel=require(_0x8ad6('0xa'));var crypto=require(_0x8ad6('0xb'));var jsforce=require(_0x8ad6('0xc'));var deskjs=require(_0x8ad6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ad6('0xe'));var Redis=require(_0x8ad6('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8ad6('0x10'));var hardwareService=require(_0x8ad6('0x11'));var logger=require(_0x8ad6('0x12'))(_0x8ad6('0x13'));var utils=require(_0x8ad6('0x14'));var config=require(_0x8ad6('0x15'));var licenseUtil=require(_0x8ad6('0x16'));var db=require(_0x8ad6('0x17'))['db'];function respondWithStatusCode(_0x5ea9e2,_0x3d0252){_0x3d0252=_0x3d0252||0xcc;return function(_0x4b8041){if(_0x4b8041){return _0x5ea9e2['sendStatus'](_0x3d0252);}return _0x5ea9e2[_0x8ad6('0x18')](_0x3d0252)['end']();};}function respondWithResult(_0x329fca,_0x50179e){_0x50179e=_0x50179e||0xc8;return function(_0x307afc){if(_0x307afc){return _0x329fca[_0x8ad6('0x18')](_0x50179e)[_0x8ad6('0x19')](_0x307afc);}};}function respondWithFilteredResult(_0x5bbfb6,_0x45e709){return function(_0x1fed01){if(_0x1fed01){var _0x37a7f0=typeof _0x45e709[_0x8ad6('0x1a')]===_0x8ad6('0x1b')&&typeof _0x45e709[_0x8ad6('0x1c')]===_0x8ad6('0x1b');var _0x2e9a2e=_0x1fed01['count'];var _0x8ca3e3=_0x37a7f0?0x0:_0x45e709[_0x8ad6('0x1a')];var _0x29e6a6=_0x37a7f0?_0x1fed01[_0x8ad6('0x1d')]:_0x45e709[_0x8ad6('0x1a')]+_0x45e709[_0x8ad6('0x1c')];var _0x144b50;if(_0x29e6a6>=_0x2e9a2e){_0x29e6a6=_0x2e9a2e;_0x144b50=0xc8;}else{_0x144b50=0xce;}_0x5bbfb6['status'](_0x144b50);return _0x5bbfb6[_0x8ad6('0x1e')](_0x8ad6('0x1f'),_0x8ca3e3+'-'+_0x29e6a6+'/'+_0x2e9a2e)[_0x8ad6('0x19')](_0x1fed01);}return null;};}function patchUpdates(_0x52f4ab){return function(_0x47086a){try{jsonpatch[_0x8ad6('0x20')](_0x47086a,_0x52f4ab,!![]);}catch(_0x3074e7){return BPromise[_0x8ad6('0x21')](_0x3074e7);}return _0x47086a[_0x8ad6('0x22')]();};}function saveUpdates(_0x46f5bf,_0x42f18b){return function(_0x5edc1){if(_0x5edc1){return _0x5edc1[_0x8ad6('0x23')](_0x46f5bf)['then'](function(_0x47af23){return _0x47af23;});}return null;};}function removeEntity(_0x2762e7,_0x351267){return function(_0x558430){if(_0x558430){return _0x558430[_0x8ad6('0x24')]()[_0x8ad6('0x25')](function(){_0x2762e7[_0x8ad6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54adf7,_0x4795d8){return function(_0x850dc6){if(!_0x850dc6){_0x54adf7[_0x8ad6('0x26')](0x194);}return _0x850dc6;};}function handleError(_0xf0a55f,_0x2e4cf7){_0x2e4cf7=_0x2e4cf7||0x1f4;return function(_0x1c79c9){logger[_0x8ad6('0x27')](_0x1c79c9[_0x8ad6('0x28')]);if(_0x1c79c9[_0x8ad6('0x29')]){delete _0x1c79c9[_0x8ad6('0x29')];}_0xf0a55f[_0x8ad6('0x18')](_0x2e4cf7)[_0x8ad6('0x2a')](_0x1c79c9);};}exports[_0x8ad6('0x2b')]=function(_0x303f6a,_0x371f2b){var _0x34f567={},_0x24a2fa={},_0xaabe95={'count':0x0,'rows':[]};var _0x3c2092=_[_0x8ad6('0x2c')](db[_0x8ad6('0x2d')]['rawAttributes'],function(_0x3dfedd){return{'name':_0x3dfedd[_0x8ad6('0x2e')],'type':_0x3dfedd[_0x8ad6('0x2f')]['key']};});_0x24a2fa[_0x8ad6('0x30')]=_['map'](_0x3c2092,'name');_0x24a2fa['query']=_[_0x8ad6('0x31')](_0x303f6a[_0x8ad6('0x32')]);_0x24a2fa['filters']=_[_0x8ad6('0x33')](_0x24a2fa[_0x8ad6('0x30')],_0x24a2fa[_0x8ad6('0x32')]);_0x34f567[_0x8ad6('0x34')]=_[_0x8ad6('0x33')](_0x24a2fa['model'],qs[_0x8ad6('0x35')](_0x303f6a[_0x8ad6('0x32')]['fields']));_0x34f567[_0x8ad6('0x34')]=_0x34f567['attributes']['length']?_0x34f567[_0x8ad6('0x34')]:_0x24a2fa[_0x8ad6('0x30')];if(!_0x303f6a['query'][_0x8ad6('0x36')](_0x8ad6('0x37'))){_0x34f567[_0x8ad6('0x1c')]=qs[_0x8ad6('0x1c')](_0x303f6a['query'][_0x8ad6('0x1c')]);_0x34f567[_0x8ad6('0x1a')]=qs[_0x8ad6('0x1a')](_0x303f6a[_0x8ad6('0x32')]['offset']);}_0x34f567['order']=qs[_0x8ad6('0x38')](_0x303f6a[_0x8ad6('0x32')][_0x8ad6('0x38')]);_0x34f567['where']=qs['filters'](_[_0x8ad6('0x39')](_0x303f6a[_0x8ad6('0x32')],_0x24a2fa['filters']),_0x3c2092);if(_0x303f6a[_0x8ad6('0x32')][_0x8ad6('0x3a')]){_0x34f567['where']=_[_0x8ad6('0x3b')](_0x34f567['where'],{'$or':_[_0x8ad6('0x2c')](_0x3c2092,function(_0x552754){if(_0x552754[_0x8ad6('0x2f')]!==_0x8ad6('0x3c')){var _0x4dd3ec={};_0x4dd3ec[_0x552754[_0x8ad6('0x29')]]={'$like':'%'+_0x303f6a['query']['filter']+'%'};return _0x4dd3ec;}})});}_0x34f567=_[_0x8ad6('0x3b')]({},_0x34f567,_0x303f6a[_0x8ad6('0x3d')]);var _0x17da1c={'where':_0x34f567[_0x8ad6('0x3e')]};return db[_0x8ad6('0x2d')][_0x8ad6('0x1d')](_0x17da1c)[_0x8ad6('0x25')](function(_0x341c76){_0xaabe95['count']=_0x341c76;if(_0x303f6a[_0x8ad6('0x32')]['includeAll']){_0x34f567[_0x8ad6('0x3f')]=[{'all':!![]}];}return db['DeskField'][_0x8ad6('0x40')](_0x34f567);})[_0x8ad6('0x25')](function(_0x27fea){_0xaabe95[_0x8ad6('0x41')]=_0x27fea;return _0xaabe95;})['then'](respondWithFilteredResult(_0x371f2b,_0x34f567))[_0x8ad6('0x42')](handleError(_0x371f2b,null));};exports[_0x8ad6('0x43')]=function(_0x2eb7be,_0x233cac){var _0x2ccbed={'raw':!![],'where':{'id':_0x2eb7be['params']['id']}},_0x5deb79={};_0x5deb79[_0x8ad6('0x30')]=_[_0x8ad6('0x31')](db[_0x8ad6('0x2d')][_0x8ad6('0x44')]);_0x5deb79[_0x8ad6('0x32')]=_[_0x8ad6('0x31')](_0x2eb7be[_0x8ad6('0x32')]);_0x5deb79[_0x8ad6('0x45')]=_[_0x8ad6('0x33')](_0x5deb79[_0x8ad6('0x30')],_0x5deb79['query']);_0x2ccbed[_0x8ad6('0x34')]=_[_0x8ad6('0x33')](_0x5deb79[_0x8ad6('0x30')],qs[_0x8ad6('0x35')](_0x2eb7be[_0x8ad6('0x32')][_0x8ad6('0x35')]));_0x2ccbed[_0x8ad6('0x34')]=_0x2ccbed[_0x8ad6('0x34')][_0x8ad6('0x46')]?_0x2ccbed['attributes']:_0x5deb79[_0x8ad6('0x30')];if(_0x2eb7be[_0x8ad6('0x32')][_0x8ad6('0x47')]){_0x2ccbed['include']=[{'all':!![]}];}_0x2ccbed=_['merge']({},_0x2ccbed,_0x2eb7be[_0x8ad6('0x3d')]);return db[_0x8ad6('0x2d')][_0x8ad6('0x48')](_0x2ccbed)[_0x8ad6('0x25')](handleEntityNotFound(_0x233cac,null))[_0x8ad6('0x25')](respondWithResult(_0x233cac,null))[_0x8ad6('0x42')](handleError(_0x233cac,null));};exports[_0x8ad6('0x49')]=function(_0x50e7bc,_0x5ce092){return db[_0x8ad6('0x2d')][_0x8ad6('0x49')](_0x50e7bc[_0x8ad6('0x4a')],{})[_0x8ad6('0x25')](respondWithResult(_0x5ce092,0xc9))[_0x8ad6('0x42')](handleError(_0x5ce092,null));};exports[_0x8ad6('0x23')]=function(_0x438612,_0x52c1ca){if(_0x438612['body']['id']){delete _0x438612[_0x8ad6('0x4a')]['id'];}return db[_0x8ad6('0x2d')][_0x8ad6('0x48')]({'where':{'id':_0x438612['params']['id']}})['then'](handleEntityNotFound(_0x52c1ca,null))['then'](saveUpdates(_0x438612['body'],null))[_0x8ad6('0x25')](respondWithResult(_0x52c1ca,null))['catch'](handleError(_0x52c1ca,null));};exports[_0x8ad6('0x24')]=function(_0x72ce3b,_0x4acba7){return db[_0x8ad6('0x2d')][_0x8ad6('0x48')]({'where':{'id':_0x72ce3b[_0x8ad6('0x4b')]['id']}})[_0x8ad6('0x25')](handleEntityNotFound(_0x4acba7,null))['then'](removeEntity(_0x4acba7,null))[_0x8ad6('0x42')](handleError(_0x4acba7,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 578af8a..53e6ae0 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 _0x7aba=['api','moment','bluebird','path','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','FieldId','lodash','../../config/logger'];(function(_0x9fa2e6,_0x35562a){var _0x99f113=function(_0x5479ad){while(--_0x5479ad){_0x9fa2e6['push'](_0x9fa2e6['shift']());}};_0x99f113(++_0x35562a);}(_0x7aba,0xd6));var _0xa7ab=function(_0x41dd4e,_0x43804b){_0x41dd4e=_0x41dd4e-0x0;var _0x3ef3d3=_0x7aba[_0x41dd4e];return _0x3ef3d3;};'use strict';var _=require(_0xa7ab('0x0'));var util=require('util');var logger=require(_0xa7ab('0x1'))(_0xa7ab('0x2'));var moment=require(_0xa7ab('0x3'));var BPromise=require(_0xa7ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7ab('0x5'));var rimraf=require('rimraf');var config=require(_0xa7ab('0x6'));var attributes=require(_0xa7ab('0x7'));module['exports']=function(_0x49b778,_0x1eda61){return _0x49b778[_0xa7ab('0x8')](_0xa7ab('0x9'),attributes,{'tableName':_0xa7ab('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xa7ab('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5e4=['util','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','idField','FieldId','lodash'];(function(_0x2a08cd,_0x422897){var _0x596668=function(_0x2656d0){while(--_0x2656d0){_0x2a08cd['push'](_0x2a08cd['shift']());}};_0x596668(++_0x422897);}(_0xe5e4,0x1a1));var _0x4e5e=function(_0x5961ec,_0x442dc8){_0x5961ec=_0x5961ec-0x0;var _0x21acef=_0xe5e4[_0x5961ec];return _0x21acef;};'use strict';var _=require(_0x4e5e('0x0'));var util=require(_0x4e5e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4e5e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e5e('0x3'));var rimraf=require(_0x4e5e('0x4'));var config=require(_0x4e5e('0x5'));var attributes=require(_0x4e5e('0x6'));module[_0x4e5e('0x7')]=function(_0xc93184,_0x1f21cb){return _0xc93184[_0x4e5e('0x8')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x4e5e('0x9'),_0x4e5e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index e4de042..f6e240d 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 _0xffad=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird'];(function(_0x27b11c,_0x2a1f5f){var _0x42e696=function(_0x1b6836){while(--_0x1b6836){_0x27b11c['push'](_0x27b11c['shift']());}};_0x42e696(++_0x2a1f5f);}(_0xffad,0x131));var _0xdffa=function(_0x31ef4c,_0x3936b9){_0x31ef4c=_0x31ef4c-0x0;var _0x4a9fc9=_0xffad[_0x31ef4c];return _0x4a9fc9;};'use strict';var _=require('lodash');var util=require(_0xdffa('0x0'));var moment=require(_0xdffa('0x1'));var BPromise=require(_0xdffa('0x2'));var rs=require(_0xdffa('0x3'));var fs=require('fs');var Redis=require(_0xdffa('0x4'));var db=require(_0xdffa('0x5'))['db'];var utils=require(_0xdffa('0x6'));var logger=require('../../config/logger')(_0xdffa('0x7'));var config=require(_0xdffa('0x8'));var jayson=require(_0xdffa('0x9'));var client=jayson[_0xdffa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17bc64,_0x23686d,_0xb4629b){return new BPromise(function(_0x490178,_0x2ca8fb){return client[_0xdffa('0xb')](_0x17bc64,_0xb4629b)[_0xdffa('0xc')](function(_0x4b9742){logger[_0xdffa('0xd')](_0xdffa('0xe'),_0x23686d,_0xdffa('0xf'));logger[_0xdffa('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x23686d,_0xdffa('0xf'),JSON[_0xdffa('0x11')](_0x4b9742));if(_0x4b9742[_0xdffa('0x12')]){if(_0x4b9742[_0xdffa('0x12')]['code']===0x1f4){logger[_0xdffa('0x12')](_0xdffa('0xe'),_0x23686d,_0x4b9742[_0xdffa('0x12')][_0xdffa('0x13')]);return _0x2ca8fb(_0x4b9742[_0xdffa('0x12')]['message']);}logger[_0xdffa('0x12')]('DeskField,\x20%s,\x20%s',_0x23686d,_0x4b9742[_0xdffa('0x12')][_0xdffa('0x13')]);return _0x490178(_0x4b9742[_0xdffa('0x12')]['message']);}else{logger[_0xdffa('0xd')]('DeskField,\x20%s,\x20%s',_0x23686d,_0xdffa('0xf'));_0x490178(_0x4b9742[_0xdffa('0x14')][_0xdffa('0x13')]);}})[_0xdffa('0x15')](function(_0xa8e00a){logger[_0xdffa('0x12')](_0xdffa('0xe'),_0x23686d,_0xa8e00a);_0x2ca8fb(_0xa8e00a);});});} \ No newline at end of file +var _0x4653=['DeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','stringify','code','error'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0x4653,0x154));var _0x3465=function(_0x500ae9,_0x346b76){_0x500ae9=_0x500ae9-0x0;var _0x5a47b3=_0x4653[_0x500ae9];return _0x5a47b3;};'use strict';var _=require('lodash');var util=require(_0x3465('0x0'));var moment=require(_0x3465('0x1'));var BPromise=require(_0x3465('0x2'));var rs=require(_0x3465('0x3'));var fs=require('fs');var Redis=require(_0x3465('0x4'));var db=require(_0x3465('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3465('0x6'))(_0x3465('0x7'));var config=require('../../config/environment');var jayson=require(_0x3465('0x8'));var client=jayson[_0x3465('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42483b,_0x480335,_0x228ac9){return new BPromise(function(_0x23238a,_0x80e791){return client[_0x3465('0xa')](_0x42483b,_0x228ac9)['then'](function(_0xd0a961){logger[_0x3465('0xb')]('DeskField,\x20%s,\x20%s',_0x480335,_0x3465('0xc'));logger[_0x3465('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x480335,'request\x20sent',JSON[_0x3465('0xe')](_0xd0a961));if(_0xd0a961['error']){if(_0xd0a961['error'][_0x3465('0xf')]===0x1f4){logger[_0x3465('0x10')](_0x3465('0x11'),_0x480335,_0xd0a961[_0x3465('0x10')][_0x3465('0x12')]);return _0x80e791(_0xd0a961['error'][_0x3465('0x12')]);}logger[_0x3465('0x10')](_0x3465('0x11'),_0x480335,_0xd0a961['error'][_0x3465('0x12')]);return _0x23238a(_0xd0a961[_0x3465('0x10')][_0x3465('0x12')]);}else{logger[_0x3465('0xb')](_0x3465('0x11'),_0x480335,_0x3465('0xc'));_0x23238a(_0xd0a961[_0x3465('0x13')][_0x3465('0x12')]);}})[_0x3465('0x14')](function(_0x4d5042){logger[_0x3465('0x10')](_0x3465('0x11'),_0x480335,_0x4d5042);_0x80e791(_0x4d5042);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index f8abc24..397bbc0 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 _0x6e9f=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','exports'];(function(_0x14f30b,_0x4ac7ca){var _0x248b2e=function(_0x800f64){while(--_0x800f64){_0x14f30b['push'](_0x14f30b['shift']());}};_0x248b2e(++_0x4ac7ca);}(_0x6e9f,0xb8));var _0xf6e9=function(_0x404e06,_0x212445){_0x404e06=_0x404e06-0x0;var _0x4fadca=_0x6e9f[_0x404e06];return _0x4fadca;};'use strict';var multer=require(_0xf6e9('0x0'));var util=require(_0xf6e9('0x1'));var path=require(_0xf6e9('0x2'));var timeout=require(_0xf6e9('0x3'));var express=require(_0xf6e9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf6e9('0x5'));var interaction=require(_0xf6e9('0x6'));var config=require(_0xf6e9('0x7'));var controller=require('./intDynamics365Account.controller');router[_0xf6e9('0x8')]('/',auth[_0xf6e9('0x9')](),controller[_0xf6e9('0xa')]);router[_0xf6e9('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf6e9('0x8')](_0xf6e9('0xb'),auth[_0xf6e9('0x9')](),controller['getConfigurations']);router['get'](_0xf6e9('0xc'),auth[_0xf6e9('0x9')](),controller[_0xf6e9('0xd')]);router[_0xf6e9('0xe')]('/',auth[_0xf6e9('0x9')](),controller[_0xf6e9('0xf')]);router[_0xf6e9('0xe')](_0xf6e9('0xb'),auth['isAuthenticated'](),controller[_0xf6e9('0x10')]);router[_0xf6e9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf6e9('0x12')]);router[_0xf6e9('0x13')](_0xf6e9('0x14'),auth['isAuthenticated'](),controller[_0xf6e9('0x15')]);module[_0xf6e9('0x16')]=router; \ No newline at end of file +var _0x4822=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x4822,0xab));var _0x2482=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x4822[_0x485b5a];return _0xd2b34d;};'use strict';var multer=require(_0x2482('0x0'));var util=require(_0x2482('0x1'));var path=require(_0x2482('0x2'));var timeout=require(_0x2482('0x3'));var express=require(_0x2482('0x4'));var router=express[_0x2482('0x5')]();var fs_extra=require(_0x2482('0x6'));var auth=require(_0x2482('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2482('0x8'));var controller=require(_0x2482('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2482('0xa')](_0x2482('0xb'),auth[_0x2482('0xc')](),controller[_0x2482('0xd')]);router['get'](_0x2482('0xe'),auth[_0x2482('0xc')](),controller[_0x2482('0xf')]);router[_0x2482('0xa')]('/:id/fields',auth[_0x2482('0xc')](),controller[_0x2482('0x10')]);router[_0x2482('0x11')]('/',auth[_0x2482('0xc')](),controller[_0x2482('0x12')]);router[_0x2482('0x11')](_0x2482('0xe'),auth[_0x2482('0xc')](),controller[_0x2482('0x13')]);router[_0x2482('0x14')](_0x2482('0xb'),auth[_0x2482('0xc')](),controller[_0x2482('0x15')]);router[_0x2482('0x16')](_0x2482('0xb'),auth[_0x2482('0xc')](),controller[_0x2482('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 2f3219d..0ef8af3 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 _0x7fec=['STRING','sequelize','exports'];(function(_0x216cbc,_0x4b0a9e){var _0x1a3eaf=function(_0x225c72){while(--_0x225c72){_0x216cbc['push'](_0x216cbc['shift']());}};_0x1a3eaf(++_0x4b0a9e);}(_0x7fec,0x14b));var _0xc7fe=function(_0x3bba33,_0x137b4d){_0x3bba33=_0x3bba33-0x0;var _0x583298=_0x7fec[_0x3bba33];return _0x583298;};'use strict';var Sequelize=require(_0xc7fe('0x0'));module[_0xc7fe('0x1')]={'name':{'type':Sequelize[_0xc7fe('0x2')]},'username':{'type':Sequelize[_0xc7fe('0x2')]},'password':{'type':Sequelize[_0xc7fe('0x2')]},'remoteUri':{'type':Sequelize[_0xc7fe('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc7fe('0x2')]},'clientSecret':{'type':Sequelize[_0xc7fe('0x2')]},'serverUrl':{'type':Sequelize[_0xc7fe('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc7fe('0x2')]}}; \ No newline at end of file +var _0x2961=['exports','STRING'];(function(_0x1d1dbf,_0x496eec){var _0x5d048d=function(_0xe942f7){while(--_0xe942f7){_0x1d1dbf['push'](_0x1d1dbf['shift']());}};_0x5d048d(++_0x496eec);}(_0x2961,0x15a));var _0x1296=function(_0x3f3514,_0x4dbfea){_0x3f3514=_0x3f3514-0x0;var _0x1203de=_0x2961[_0x3f3514];return _0x1203de;};'use strict';var Sequelize=require('sequelize');module[_0x1296('0x0')]={'name':{'type':Sequelize[_0x1296('0x1')]},'username':{'type':Sequelize[_0x1296('0x1')]},'password':{'type':Sequelize[_0x1296('0x1')]},'remoteUri':{'type':Sequelize[_0x1296('0x1')]},'tenantId':{'type':Sequelize[_0x1296('0x1')]},'clientId':{'type':Sequelize[_0x1296('0x1')]},'clientSecret':{'type':Sequelize[_0x1296('0x1')]},'serverUrl':{'type':Sequelize[_0x1296('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1296('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index f212746..9bebbf9 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 _0x121d=['PicklistAttributeMetadata','push','isNil','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(','TrueOption','true','FalseOption','false','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','findAll','rows','catch','params','includeAll','merge','options','find','create','body','update','pick','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','phonenumber','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','subjectidname','transactioncurrencyidname','traversedpath','concat','username','password','remoteUri','tenantId','clientId','clientSecret','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_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'];(function(_0x170300,_0x5ea97b){var _0x5eb9f8=function(_0x815aa8){while(--_0x815aa8){_0x170300['push'](_0x170300['shift']());}};_0x5eb9f8(++_0x5ea97b);}(_0x121d,0xea));var _0xd121=function(_0x43e677,_0xc52301){_0x43e677=_0x43e677-0x0;var _0x582d21=_0x121d[_0x43e677];return _0x582d21;};'use strict';var emlformat=require(_0xd121('0x0'));var rimraf=require(_0xd121('0x1'));var zipdir=require(_0xd121('0x2'));var jsonpatch=require(_0xd121('0x3'));var rp=require(_0xd121('0x4'));var moment=require(_0xd121('0x5'));var BPromise=require(_0xd121('0x6'));var Mustache=require(_0xd121('0x7'));var util=require(_0xd121('0x8'));var path=require(_0xd121('0x9'));var sox=require(_0xd121('0xa'));var csv=require(_0xd121('0xb'));var ejs=require(_0xd121('0xc'));var fs=require('fs');var fs_extra=require(_0xd121('0xd'));var _=require('lodash');var squel=require(_0xd121('0xe'));var crypto=require('crypto');var jsforce=require(_0xd121('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd121('0xb'));var querystring=require(_0xd121('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd121('0x11'));var as=require(_0xd121('0x12'));var hardwareService=require(_0xd121('0x13'));var logger=require(_0xd121('0x14'))(_0xd121('0x15'));var utils=require(_0xd121('0x16'));var config=require(_0xd121('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd121('0x18'))['db'];var integrations=require(_0xd121('0x19'));function respondWithStatusCode(_0x5382ce,_0x20c21f){_0x20c21f=_0x20c21f||0xcc;return function(_0xffeaf5){if(_0xffeaf5){return _0x5382ce[_0xd121('0x1a')](_0x20c21f);}return _0x5382ce[_0xd121('0x1b')](_0x20c21f)['end']();};}function respondWithResult(_0x3fcbe6,_0x3577a2){_0x3577a2=_0x3577a2||0xc8;return function(_0x2bfac3){if(_0x2bfac3){return _0x3fcbe6['status'](_0x3577a2)[_0xd121('0x1c')](_0x2bfac3);}};}function respondWithFilteredResult(_0x27384d,_0x5bda79){return function(_0xc71a1b){if(_0xc71a1b){var _0x5e68e1=typeof _0x5bda79[_0xd121('0x1d')]===_0xd121('0x1e')&&typeof _0x5bda79[_0xd121('0x1f')]===_0xd121('0x1e');var _0x565e94=_0xc71a1b['count'];var _0x41f455=_0x5e68e1?0x0:_0x5bda79[_0xd121('0x1d')];var _0x49da6f=_0x5e68e1?_0xc71a1b[_0xd121('0x20')]:_0x5bda79['offset']+_0x5bda79['limit'];var _0x587302;if(_0x49da6f>=_0x565e94){_0x49da6f=_0x565e94;_0x587302=0xc8;}else{_0x587302=0xce;}_0x27384d[_0xd121('0x1b')](_0x587302);return _0x27384d[_0xd121('0x21')]('Content-Range',_0x41f455+'-'+_0x49da6f+'/'+_0x565e94)[_0xd121('0x1c')](_0xc71a1b);}return null;};}function patchUpdates(_0x34521a){return function(_0x9d8dfa){try{jsonpatch[_0xd121('0x22')](_0x9d8dfa,_0x34521a,!![]);}catch(_0x370efe){return BPromise['reject'](_0x370efe);}return _0x9d8dfa[_0xd121('0x23')]();};}function saveUpdates(_0x3bddb8,_0x504b26){return function(_0x3d60fe){if(_0x3d60fe){return _0x3d60fe['update'](_0x3bddb8)[_0xd121('0x24')](function(_0xe7f6b9){return _0xe7f6b9;});}return null;};}function removeEntity(_0x4703b4,_0x14272d){return function(_0x679fa6){if(_0x679fa6){return _0x679fa6[_0xd121('0x25')]()[_0xd121('0x24')](function(){_0x4703b4[_0xd121('0x1b')](0xcc)[_0xd121('0x26')]();});}};}function handleEntityNotFound(_0x1d99f1,_0x3a1aa2){return function(_0x4df06c){if(!_0x4df06c){_0x1d99f1[_0xd121('0x1a')](0x194);}return _0x4df06c;};}function handleError(_0x116276,_0xf5e97c){_0xf5e97c=_0xf5e97c||0x1f4;return function(_0x4eb4a3){logger[_0xd121('0x27')](_0x4eb4a3[_0xd121('0x28')]);if(_0x4eb4a3[_0xd121('0x29')]){delete _0x4eb4a3[_0xd121('0x29')];}_0x116276['status'](_0xf5e97c)[_0xd121('0x2a')](_0x4eb4a3);};}exports[_0xd121('0x2b')]=function(_0x53028b,_0x2878e8){var _0x15188e={},_0x5cc293={},_0x33fba0={'count':0x0,'rows':[]};var _0x10e8a1=_[_0xd121('0x2c')](db[_0xd121('0x2d')][_0xd121('0x2e')],function(_0x378935){return{'name':_0x378935[_0xd121('0x2f')],'type':_0x378935[_0xd121('0x30')][_0xd121('0x31')]};});_0x5cc293[_0xd121('0x32')]=_['map'](_0x10e8a1,_0xd121('0x29'));_0x5cc293['query']=_[_0xd121('0x33')](_0x53028b[_0xd121('0x34')]);_0x5cc293[_0xd121('0x35')]=_['intersection'](_0x5cc293[_0xd121('0x32')],_0x5cc293[_0xd121('0x34')]);_0x15188e[_0xd121('0x36')]=_[_0xd121('0x37')](_0x5cc293['model'],qs[_0xd121('0x38')](_0x53028b[_0xd121('0x34')]['fields']));_0x15188e[_0xd121('0x36')]=_0x15188e[_0xd121('0x36')][_0xd121('0x39')]?_0x15188e[_0xd121('0x36')]:_0x5cc293[_0xd121('0x32')];if(!_0x53028b[_0xd121('0x34')][_0xd121('0x3a')](_0xd121('0x3b'))){_0x15188e[_0xd121('0x1f')]=qs[_0xd121('0x1f')](_0x53028b[_0xd121('0x34')][_0xd121('0x1f')]);_0x15188e[_0xd121('0x1d')]=qs['offset'](_0x53028b[_0xd121('0x34')][_0xd121('0x1d')]);}_0x15188e['order']=qs[_0xd121('0x3c')](_0x53028b[_0xd121('0x34')][_0xd121('0x3c')]);_0x15188e[_0xd121('0x3d')]=qs['filters'](_['pick'](_0x53028b[_0xd121('0x34')],_0x5cc293['filters']),_0x10e8a1);if(_0x53028b[_0xd121('0x34')]['filter']){_0x15188e[_0xd121('0x3d')]=_['merge'](_0x15188e[_0xd121('0x3d')],{'$or':_[_0xd121('0x2c')](_0x10e8a1,function(_0x18ba44){if(_0x18ba44[_0xd121('0x30')]!=='VIRTUAL'){var _0x3d4c17={};_0x3d4c17[_0x18ba44[_0xd121('0x29')]]={'$like':'%'+_0x53028b[_0xd121('0x34')][_0xd121('0x3e')]+'%'};return _0x3d4c17;}})});}_0x15188e=_['merge']({},_0x15188e,_0x53028b['options']);var _0x261b71={'where':_0x15188e['where']};return db[_0xd121('0x2d')][_0xd121('0x20')](_0x261b71)[_0xd121('0x24')](function(_0x2c4f58){_0x33fba0['count']=_0x2c4f58;if(_0x53028b[_0xd121('0x34')]['includeAll']){_0x15188e['include']=[{'all':!![]}];}return db[_0xd121('0x2d')][_0xd121('0x3f')](_0x15188e);})[_0xd121('0x24')](function(_0x18693d){_0x33fba0[_0xd121('0x40')]=_0x18693d;return _0x33fba0;})['then'](respondWithFilteredResult(_0x2878e8,_0x15188e))[_0xd121('0x41')](handleError(_0x2878e8,null));};exports['show']=function(_0x2ced45,_0x32dd58){var _0x15da65={'raw':![],'where':{'id':_0x2ced45[_0xd121('0x42')]['id']}},_0x273fea={};_0x273fea[_0xd121('0x32')]=_['keys'](db[_0xd121('0x2d')][_0xd121('0x2e')]);_0x273fea[_0xd121('0x34')]=_[_0xd121('0x33')](_0x2ced45[_0xd121('0x34')]);_0x273fea[_0xd121('0x35')]=_[_0xd121('0x37')](_0x273fea['model'],_0x273fea[_0xd121('0x34')]);_0x15da65[_0xd121('0x36')]=_[_0xd121('0x37')](_0x273fea[_0xd121('0x32')],qs[_0xd121('0x38')](_0x2ced45[_0xd121('0x34')][_0xd121('0x38')]));_0x15da65[_0xd121('0x36')]=_0x15da65[_0xd121('0x36')][_0xd121('0x39')]?_0x15da65[_0xd121('0x36')]:_0x273fea[_0xd121('0x32')];if(_0x2ced45['query'][_0xd121('0x43')]){_0x15da65['include']=[{'all':!![]}];}_0x15da65=_[_0xd121('0x44')]({},_0x15da65,_0x2ced45[_0xd121('0x45')]);return db[_0xd121('0x2d')][_0xd121('0x46')](_0x15da65)[_0xd121('0x24')](handleEntityNotFound(_0x32dd58,null))[_0xd121('0x24')](respondWithResult(_0x32dd58,null))['catch'](handleError(_0x32dd58,null));};exports[_0xd121('0x47')]=function(_0x2d310e,_0x1a211f){return db[_0xd121('0x2d')][_0xd121('0x47')](_0x2d310e[_0xd121('0x48')],{})[_0xd121('0x24')](respondWithResult(_0x1a211f,0xc9))[_0xd121('0x41')](handleError(_0x1a211f,null));};exports[_0xd121('0x49')]=function(_0x37d665,_0x552ad6){if(_0x37d665[_0xd121('0x48')]['id']){delete _0x37d665[_0xd121('0x48')]['id'];}return db[_0xd121('0x2d')][_0xd121('0x46')]({'where':{'id':_0x37d665[_0xd121('0x42')]['id']}})[_0xd121('0x24')](handleEntityNotFound(_0x552ad6,null))[_0xd121('0x24')](saveUpdates(_0x37d665[_0xd121('0x48')],null))[_0xd121('0x24')](respondWithResult(_0x552ad6,null))['catch'](handleError(_0x552ad6,null));};exports[_0xd121('0x25')]=function(_0x38193d,_0x10d5e3){return db[_0xd121('0x2d')]['find']({'where':{'id':_0x38193d[_0xd121('0x42')]['id']}})[_0xd121('0x24')](handleEntityNotFound(_0x10d5e3,null))['then'](removeEntity(_0x10d5e3,null))[_0xd121('0x41')](handleError(_0x10d5e3,null));};exports['getConfigurations']=function(_0x1cd4f2,_0x3a9c13,_0x25bee6){var _0x1180ed={};var _0x409494={};var _0x33be45;var _0x26c38c;return db[_0xd121('0x2d')]['findOne']({'where':{'id':_0x1cd4f2['params']['id']}})[_0xd121('0x24')](handleEntityNotFound(_0x3a9c13,null))[_0xd121('0x24')](function(_0x36d733){if(_0x36d733){_0x33be45=_0x36d733;_0x409494['model']=_[_0xd121('0x33')](db['Dynamics365Configuration'][_0xd121('0x2e')]);_0x409494[_0xd121('0x34')]=_[_0xd121('0x33')](_0x1cd4f2[_0xd121('0x34')]);_0x409494[_0xd121('0x35')]=_['intersection'](_0x409494[_0xd121('0x32')],_0x409494['query']);_0x1180ed[_0xd121('0x36')]=_[_0xd121('0x37')](_0x409494[_0xd121('0x32')],qs[_0xd121('0x38')](_0x1cd4f2['query'][_0xd121('0x38')]));_0x1180ed['attributes']=_0x1180ed['attributes'][_0xd121('0x39')]?_0x1180ed[_0xd121('0x36')]:_0x409494['model'];_0x1180ed['order']=qs['sort'](_0x1cd4f2['query'][_0xd121('0x3c')]);_0x1180ed[_0xd121('0x3d')]=qs[_0xd121('0x35')](_[_0xd121('0x4a')](_0x1cd4f2['query'],_0x409494[_0xd121('0x35')]));if(_0x1cd4f2[_0xd121('0x34')]['filter']){_0x1180ed[_0xd121('0x3d')]=_[_0xd121('0x44')](_0x1180ed[_0xd121('0x3d')],{'$or':_[_0xd121('0x2c')](_0x1180ed[_0xd121('0x36')],function(_0x109cf0){var _0x387d10={};_0x387d10[_0x109cf0]={'$like':'%'+_0x1cd4f2[_0xd121('0x34')][_0xd121('0x3e')]+'%'};return _0x387d10;})});}_0x1180ed=_['merge']({},_0x1180ed,_0x1cd4f2[_0xd121('0x45')]);return _0x33be45[_0xd121('0x4b')](_0x1180ed);}})[_0xd121('0x24')](function(_0x1a6eab){if(_0x1a6eab){_0x26c38c=_0x1a6eab[_0xd121('0x39')];if(!_0x1cd4f2[_0xd121('0x34')]['hasOwnProperty']('nolimit')){_0x1180ed['limit']=qs['limit'](_0x1cd4f2[_0xd121('0x34')][_0xd121('0x1f')]);_0x1180ed[_0xd121('0x1d')]=qs[_0xd121('0x1d')](_0x1cd4f2[_0xd121('0x34')]['offset']);}return _0x33be45['getConfigurations'](_0x1180ed);}})[_0xd121('0x24')](function(_0x41ea01){if(_0x41ea01){return _0x41ea01?{'count':_0x26c38c,'rows':_0x41ea01}:null;}})[_0xd121('0x24')](respondWithResult(_0x3a9c13,null))[_0xd121('0x41')](handleError(_0x3a9c13,null));};exports[_0xd121('0x4c')]=function(_0x5c06b6,_0x5851e5,_0x5e6778){if(_0x5c06b6[_0xd121('0x48')]['id']){delete _0x5c06b6[_0xd121('0x48')]['id'];}return db['Dynamics365Account'][_0xd121('0x4d')]({'where':{'id':_0x5c06b6[_0xd121('0x42')]['id']}})['then'](handleEntityNotFound(_0x5851e5,null))[_0xd121('0x24')](function(_0x207697){if(_0x207697){_0x5c06b6[_0xd121('0x48')]['AccountId']=_0x207697['id'];_0x5c06b6[_0xd121('0x48')][_0xd121('0x4e')]=integrations[_0xd121('0x4f')](_0x5c06b6[_0xd121('0x48')][_0xd121('0x50')],_0x5c06b6[_0xd121('0x48')][_0xd121('0x30')]);_0x5c06b6[_0xd121('0x48')][_0xd121('0x51')]=integrations[_0xd121('0x52')](_0x5c06b6['body']['channel'],_0x5c06b6[_0xd121('0x48')]['type']);return db[_0xd121('0x53')]['create'](_0x5c06b6[_0xd121('0x48')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xd121('0x54')],'as':'Descriptions'}]});}return null;})[_0xd121('0x24')](respondWithResult(_0x5851e5,null))[_0xd121('0x41')](handleError(_0x5851e5,null));};exports[_0xd121('0x55')]=function(_0xb35b67,_0xc0afbf,_0x466071){var _0x33e163=_0xb35b67[_0xd121('0x34')][_0xd121('0x56')];var _0x264e24=_0x33e163===_0xd121('0x57')?_0xd121('0x58'):'PhoneCall';var _0x32aa37='';var _0x140e83='';var _0xe25631='';var _0x4a099a='';var _0x347ab4='';var _0x417738='';var _0x1148ee='';var _0x57ef83='';var _0x25d6f2=[_0xd121('0x59'),_0xd121('0x5a'),_0xd121('0x5b'),_0xd121('0x5c'),_0xd121('0x5d'),'subject',_0xd121('0x5e'),'regardingobjectid','directioncode',_0xd121('0x5f')];var _0x2a90cf=[_0xd121('0x60'),'accountidyominame',_0xd121('0x61'),_0xd121('0x62'),_0xd121('0x63'),_0xd121('0x64'),_0xd121('0x65'),_0xd121('0x66'),_0xd121('0x67'),'createdbyexternalpartyyominame',_0xd121('0x68'),_0xd121('0x69'),'createdon',_0xd121('0x6a'),_0xd121('0x6b'),_0xd121('0x6c'),_0xd121('0x6d'),_0xd121('0x6e'),_0xd121('0x6f'),'entitlementidname',_0xd121('0x70'),_0xd121('0x71'),_0xd121('0x72'),_0xd121('0x73'),_0xd121('0x74'),'followupby',_0xd121('0x75'),_0xd121('0x76'),_0xd121('0x77'),'lastonholdtime',_0xd121('0x78'),_0xd121('0x79'),_0xd121('0x7a'),'modifiedbyname',_0xd121('0x7b'),_0xd121('0x7c'),_0xd121('0x7d'),_0xd121('0x7e'),_0xd121('0x7f'),_0xd121('0x80'),_0xd121('0x81'),_0xd121('0x82'),_0xd121('0x83'),_0xd121('0x84'),_0xd121('0x85'),_0xd121('0x86'),_0xd121('0x87'),_0xd121('0x88'),_0xd121('0x89'),_0xd121('0x8a'),'productidname',_0xd121('0x8b'),_0xd121('0x8c'),_0xd121('0x8d'),_0xd121('0x8e'),_0xd121('0x8f'),_0xd121('0x90'),_0xd121('0x91'),'slainvokedidname','slaname',_0xd121('0x92'),_0xd121('0x93'),_0xd121('0x94'),_0xd121('0x95'),'ticketnumber','timezoneruleversionnumber',_0xd121('0x96'),_0xd121('0x97'),'utcconversiontimezonecode','versionnumber'];var _0x24fa55=_0x25d6f2[_0xd121('0x98')](_0x2a90cf);return db['Dynamics365Account']['findOne']({'where':{'id':_0xb35b67[_0xd121('0x42')]['id']},'attributes':['id',_0xd121('0x99'),_0xd121('0x9a'),_0xd121('0x9b'),_0xd121('0x9c'),_0xd121('0x9d'),_0xd121('0x9e')]})[_0xd121('0x24')](handleEntityNotFound(_0xc0afbf,null))[_0xd121('0x24')](function(_0x34299b){if(_0x34299b){_0x57ef83=_0x34299b[_0xd121('0x9b')];var _0x1c2157=_0x57ef83['slice'](-0x1);if(_0x1c2157==='/'){_0x57ef83=_0x57ef83[_0xd121('0x9f')](0x0,_0x57ef83[_0xd121('0xa0')](_0x1c2157));}_0x1148ee=util['format'](_0xd121('0xa1'),_0x57ef83);var _0x33ba22={'method':_0xd121('0xa2'),'uri':_0xd121('0xa3')+_0x34299b[_0xd121('0x9c')]+_0xd121('0xa4'),'form':{'client_id':_0x34299b[_0xd121('0x9d')],'resource':_0x57ef83,'username':_0x34299b[_0xd121('0x99')],'password':_0x34299b[_0xd121('0x9a')],'grant_type':'password','client_secret':_0x34299b['clientSecret']},'json':!![]};return rp(_0x33ba22);}})[_0xd121('0x24')](function(_0x3e60ca){_0x417738=_0x3e60ca[_0xd121('0xa5')];var _0x9c3c43={'method':_0xd121('0xa6'),'uri':encodeURI(_0x1148ee+_0xd121('0xa7')+_0x264e24+'\x27'),'headers':{'Authorization':_0xd121('0xa8')+_0x417738,'If-None-Match':null,'OData-Version':_0xd121('0xa9')},'json':!![]};return rp(_0x9c3c43);})[_0xd121('0x24')](function(_0x46f27d){var _0x2ceca1=_0x46f27d[_0xd121('0xaa')][0x0];var _0x223c17=_0x2ceca1[_0xd121('0xab')];var _0x16cf7e={'method':_0xd121('0xa6'),'uri':_0x1148ee+_0xd121('0xac')+_0x223c17+_0xd121('0xad'),'headers':{'Authorization':'Bearer\x20'+_0x417738,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x16cf7e);})[_0xd121('0x24')](function(_0xa8517f){_0x32aa37=_0xa8517f;_0x140e83=_0x32aa37[_0xd121('0xae')];_0x140e83=_[_0xd121('0xaf')](_0x140e83,function(_0x4a4e73){return!_0x24fa55[_0xd121('0xb0')](_0x4a4e73[_0xd121('0xb1')]);});var _0x4b8e20=[];var _0x4d2ac1=[];_0x140e83[_0xd121('0xb2')](function(_0x114737){if(_0x114737['@odata.type']){var _0x246bb3=_0x114737[_0xd121('0xb3')][_0xd121('0x9f')](_0x114737[_0xd121('0xb3')]['lastIndexOf']('.')+0x1);if(_0x246bb3===_0xd121('0xb4')){_0x4b8e20[_0xd121('0xb5')](getSelectList(_0x1148ee,_0x33e163,_0x4d2ac1,_0x32aa37[_0xd121('0xab')],_0x114737[_0xd121('0xab')],_0x417738));}}});return Promise['all'](_0x4b8e20);})[_0xd121('0x24')](function(_0x23f667){_0xe25631=_0x23f667[0x0];var _0x11f4a1=[];var _0x575331=[];_0x140e83['forEach'](function(_0x15a477){if(!_[_0xd121('0xb6')](_0x15a477[_0xd121('0xb3')])){var _0x55472a=_0x15a477[_0xd121('0xb3')][_0xd121('0x9f')](_0x15a477[_0xd121('0xb3')][_0xd121('0xa0')]('.')+0x1);if(_0x55472a==='BooleanAttributeMetadata'){_0x11f4a1[_0xd121('0xb5')](getBooleanList(_0x1148ee,_0x33e163,_0x575331,_0x32aa37[_0xd121('0xab')],_0x15a477[_0xd121('0xab')],_0x417738));}}});return Promise[_0xd121('0xb7')](_0x11f4a1);})[_0xd121('0x24')](function(_0x11fc56){_0x4a099a=_0x11fc56[0x0];var _0x36af80=[];var _0x2b2f46=[];_0x140e83[_0xd121('0xb2')](function(_0x5bd9f8){if(_0x5bd9f8['@odata.type']){var _0x1c2952=_0x5bd9f8[_0xd121('0xb3')][_0xd121('0x9f')](_0x5bd9f8[_0xd121('0xb3')][_0xd121('0xa0')]('.')+0x1);if(_0x1c2952===_0xd121('0xb8')||_0x1c2952===_0xd121('0xb9')||_0x1c2952===_0xd121('0xba')||_0x1c2952===_0xd121('0xbb')||_0x1c2952===_0xd121('0xbc')||_0x1c2952===_0xd121('0xbd')||_0x1c2952===_0xd121('0xbe')||_0x1c2952==='EntityNameAttributeMetadata'||_0x1c2952===_0xd121('0xbf')||_0x1c2952===_0xd121('0xc0')){_0x36af80[_0xd121('0xb5')](getInputList(_0x1148ee,_0x33e163,_0x1c2952,_0x2b2f46,_0x32aa37['MetadataId'],_0x5bd9f8[_0xd121('0xab')],_0x417738));}}});return Promise['all'](_0x36af80);})[_0xd121('0x24')](function(_0x35ae94){_0x347ab4=_0x35ae94[0x0];var _0x34fc2e=_0xe25631[_0xd121('0x98')](_0x4a099a)[_0xd121('0x98')](_0x347ab4);var _0x58eb96={'count':_0x34fc2e[_0xd121('0x39')],'rows':_0x34fc2e};return _0x58eb96;})[_0xd121('0x24')](respondWithResult(_0xc0afbf,null))[_0xd121('0x41')](function(_0x3a21a4){var _0x468b5e=_0xb35b67['query'][_0xd121('0xc1')]?0x1f4:_0x3a21a4[_0xd121('0xc2')]||0x1f4;logger[_0xd121('0x27')](_0x3a21a4[_0xd121('0x28')]);delete _0x3a21a4[_0xd121('0x29')];if(_0x468b5e===0x191){_0x468b5e=0x190;}_0xc0afbf[_0xd121('0x1b')](_0x468b5e)[_0xd121('0x2a')](_0xb35b67[_0xd121('0x34')][_0xd121('0xc1')]?{'message':'Wrong\x20credentials','statusCode':_0x3a21a4['statusCode']}:_0x3a21a4);});};function getSelectList(_0x57c34e,_0x314079,_0x43b5e3,_0x1e1d0c,_0x1e5dc1,_0x5ba7f0){var _0x10c1d5={'method':_0xd121('0xa6'),'uri':_0x57c34e+_0xd121('0xac')+_0x1e1d0c+')/Attributes('+_0x1e5dc1+_0xd121('0xc3')+_0xd121('0xc4'),'headers':{'Authorization':_0xd121('0xa8')+_0x5ba7f0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x10c1d5)[_0xd121('0x24')](function(_0xd61fd3){var _0xde7533=[];var _0x26863f=_0xd61fd3[_0xd121('0xc5')]['Options'];_0x26863f['forEach'](function(_0xf90faf){_0xde7533[_0xd121('0xb5')]({'name':_0xf90faf['Label'][_0xd121('0xc6')][_0xd121('0xc7')],'value':String(_0xf90faf[_0xd121('0xc8')])});});var _0x5e6638={'id':_0x314079+'_'+_0xd61fd3[_0xd121('0xb1')],'name':_0xd61fd3[_0xd121('0xc9')][_0xd121('0xc6')][_0xd121('0xc7')],'custom':![],'options':_0xde7533};_0x43b5e3['push'](_0x5e6638);return _0x43b5e3;});}function getBooleanList(_0x5cd6de,_0x20069e,_0x45103e,_0x557eec,_0x5d2d9b,_0x57a8ee){var _0x548c0c={'method':_0xd121('0xa6'),'uri':_0x5cd6de+_0xd121('0xac')+_0x557eec+_0xd121('0xca')+_0x5d2d9b+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xd121('0xa8')+_0x57a8ee,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x548c0c)[_0xd121('0x24')](function(_0xdf4beb){var _0x2f0b57=[];_0x2f0b57['push']({'name':_0xdf4beb[_0xd121('0xc5')][_0xd121('0xcb')][_0xd121('0xc7')][_0xd121('0xc6')][_0xd121('0xc7')],'value':_0xd121('0xcc')},{'name':_0xdf4beb['OptionSet'][_0xd121('0xcd')][_0xd121('0xc7')][_0xd121('0xc6')][_0xd121('0xc7')],'value':_0xd121('0xce')});var _0x511743={'id':_0x20069e+'_'+_0xdf4beb[_0xd121('0xb1')],'name':_0xdf4beb['DisplayName'][_0xd121('0xc6')][_0xd121('0xc7')],'custom':![],'options':_0x2f0b57};_0x45103e[_0xd121('0xb5')](_0x511743);return _0x45103e;});}function getInputList(_0x35d9f3,_0x3892fa,_0x9ede37,_0x34b0d9,_0x125130,_0x3d7479,_0x24d3b8){var _0x140981={'method':_0xd121('0xa6'),'uri':_0x35d9f3+'EntityDefinitions('+_0x125130+_0xd121('0xca')+_0x3d7479+')/Microsoft.Dynamics.CRM.'+_0x9ede37+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x24d3b8,'If-None-Match':null,'OData-Version':_0xd121('0xa9')},'json':!![]};return rp(_0x140981)[_0xd121('0x24')](function(_0xae775){var _0x5a8504={'id':_0x3892fa+'_'+_0xae775['LogicalName'],'name':_0xae775['DisplayName'][_0xd121('0xc6')]?_0xae775['DisplayName'][_0xd121('0xc6')][_0xd121('0xc7')]:_0xae775[_0xd121('0xb1')],'custom':![],'options':[]};_0x34b0d9[_0xd121('0xb5')](_0x5a8504);return _0x34b0d9;});} \ No newline at end of file +var _0xe57e=['EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','remove','@odata.type','substring','PicklistAttributeMetadata','MetadataId','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName','TrueOption','FalseOption','?$select=DisplayName,LogicalName','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','undefined','limit','count','offset','Content-Range','json','save','update','then','destroy','sendStatus','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','catch','show','params','includeAll','find','body','getConfigurations','findOne','Dynamics365Configuration','options','hasOwnProperty','AccountId','Subjects','channel','Descriptions','getDescriptions','create','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','username','password','remoteUri','tenantId','clientSecret','slice','lastIndexOf','format','POST','https://login.microsoftonline.com/','clientId','access_token'];(function(_0x7ba621,_0x545d23){var _0x49a136=function(_0x2cf60e){while(--_0x2cf60e){_0x7ba621['push'](_0x7ba621['shift']());}};_0x49a136(++_0x545d23);}(_0xe57e,0xf2));var _0xee57=function(_0x419015,_0x5dcac7){_0x419015=_0x419015-0x0;var _0x53837b=_0xe57e[_0x419015];return _0x53837b;};'use strict';var emlformat=require(_0xee57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee57('0x1'));var jsonpatch=require(_0xee57('0x2'));var rp=require(_0xee57('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xee57('0x4'));var util=require('util');var path=require(_0xee57('0x5'));var sox=require(_0xee57('0x6'));var csv=require(_0xee57('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee57('0x8'));var squel=require(_0xee57('0x9'));var crypto=require(_0xee57('0xa'));var jsforce=require(_0xee57('0xb'));var deskjs=require(_0xee57('0xc'));var toCsv=require(_0xee57('0x7'));var querystring=require(_0xee57('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee57('0xe'));var qs=require(_0xee57('0xf'));var as=require(_0xee57('0x10'));var hardwareService=require(_0xee57('0x11'));var logger=require(_0xee57('0x12'))(_0xee57('0x13'));var utils=require(_0xee57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee57('0x15'))['db'];var integrations=require(_0xee57('0x16'));function respondWithStatusCode(_0x298f51,_0x390305){_0x390305=_0x390305||0xcc;return function(_0xdc2ed){if(_0xdc2ed){return _0x298f51['sendStatus'](_0x390305);}return _0x298f51[_0xee57('0x17')](_0x390305)['end']();};}function respondWithResult(_0x2a807e,_0x4f37fb){_0x4f37fb=_0x4f37fb||0xc8;return function(_0x312fe3){if(_0x312fe3){return _0x2a807e['status'](_0x4f37fb)['json'](_0x312fe3);}};}function respondWithFilteredResult(_0x2141f0,_0x44d800){return function(_0x322120){if(_0x322120){var _0x17a05a=typeof _0x44d800['offset']===_0xee57('0x18')&&typeof _0x44d800[_0xee57('0x19')]==='undefined';var _0x5400a5=_0x322120['count'];var _0x41e018=_0x17a05a?0x0:_0x44d800['offset'];var _0x9a6461=_0x17a05a?_0x322120[_0xee57('0x1a')]:_0x44d800[_0xee57('0x1b')]+_0x44d800[_0xee57('0x19')];var _0x396318;if(_0x9a6461>=_0x5400a5){_0x9a6461=_0x5400a5;_0x396318=0xc8;}else{_0x396318=0xce;}_0x2141f0[_0xee57('0x17')](_0x396318);return _0x2141f0['set'](_0xee57('0x1c'),_0x41e018+'-'+_0x9a6461+'/'+_0x5400a5)[_0xee57('0x1d')](_0x322120);}return null;};}function patchUpdates(_0x10b83c){return function(_0x529e0f){try{jsonpatch['apply'](_0x529e0f,_0x10b83c,!![]);}catch(_0x102fa8){return BPromise['reject'](_0x102fa8);}return _0x529e0f[_0xee57('0x1e')]();};}function saveUpdates(_0xeffac8,_0x54486f){return function(_0x466869){if(_0x466869){return _0x466869[_0xee57('0x1f')](_0xeffac8)[_0xee57('0x20')](function(_0x306f1f){return _0x306f1f;});}return null;};}function removeEntity(_0x54a70b,_0x2b5747){return function(_0xb1fdf2){if(_0xb1fdf2){return _0xb1fdf2[_0xee57('0x21')]()[_0xee57('0x20')](function(){_0x54a70b[_0xee57('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d7236,_0x17fd20){return function(_0x4eedc9){if(!_0x4eedc9){_0x7d7236[_0xee57('0x22')](0x194);}return _0x4eedc9;};}function handleError(_0x5c7fc1,_0x5505c2){_0x5505c2=_0x5505c2||0x1f4;return function(_0x1f16fd){logger[_0xee57('0x23')](_0x1f16fd[_0xee57('0x24')]);if(_0x1f16fd[_0xee57('0x25')]){delete _0x1f16fd['name'];}_0x5c7fc1['status'](_0x5505c2)[_0xee57('0x26')](_0x1f16fd);};}exports['index']=function(_0x11f6fd,_0x2c4e0f){var _0x1c7079={},_0x19e4a6={},_0x13a8fe={'count':0x0,'rows':[]};var _0x5466bf=_[_0xee57('0x27')](db[_0xee57('0x28')][_0xee57('0x29')],function(_0x51ff51){return{'name':_0x51ff51[_0xee57('0x2a')],'type':_0x51ff51[_0xee57('0x2b')]['key']};});_0x19e4a6[_0xee57('0x2c')]=_[_0xee57('0x27')](_0x5466bf,_0xee57('0x25'));_0x19e4a6[_0xee57('0x2d')]=_[_0xee57('0x2e')](_0x11f6fd['query']);_0x19e4a6[_0xee57('0x2f')]=_[_0xee57('0x30')](_0x19e4a6['model'],_0x19e4a6[_0xee57('0x2d')]);_0x1c7079[_0xee57('0x31')]=_[_0xee57('0x30')](_0x19e4a6[_0xee57('0x2c')],qs[_0xee57('0x32')](_0x11f6fd['query'][_0xee57('0x32')]));_0x1c7079[_0xee57('0x31')]=_0x1c7079[_0xee57('0x31')][_0xee57('0x33')]?_0x1c7079[_0xee57('0x31')]:_0x19e4a6[_0xee57('0x2c')];if(!_0x11f6fd['query']['hasOwnProperty'](_0xee57('0x34'))){_0x1c7079[_0xee57('0x19')]=qs[_0xee57('0x19')](_0x11f6fd['query']['limit']);_0x1c7079[_0xee57('0x1b')]=qs[_0xee57('0x1b')](_0x11f6fd['query'][_0xee57('0x1b')]);}_0x1c7079[_0xee57('0x35')]=qs['sort'](_0x11f6fd[_0xee57('0x2d')][_0xee57('0x36')]);_0x1c7079[_0xee57('0x37')]=qs[_0xee57('0x2f')](_[_0xee57('0x38')](_0x11f6fd['query'],_0x19e4a6['filters']),_0x5466bf);if(_0x11f6fd[_0xee57('0x2d')][_0xee57('0x39')]){_0x1c7079[_0xee57('0x37')]=_[_0xee57('0x3a')](_0x1c7079[_0xee57('0x37')],{'$or':_[_0xee57('0x27')](_0x5466bf,function(_0x2cf137){if(_0x2cf137[_0xee57('0x2b')]!==_0xee57('0x3b')){var _0x368755={};_0x368755[_0x2cf137[_0xee57('0x25')]]={'$like':'%'+_0x11f6fd[_0xee57('0x2d')][_0xee57('0x39')]+'%'};return _0x368755;}})});}_0x1c7079=_['merge']({},_0x1c7079,_0x11f6fd['options']);var _0x581bfd={'where':_0x1c7079['where']};return db[_0xee57('0x28')][_0xee57('0x1a')](_0x581bfd)[_0xee57('0x20')](function(_0x48152d){_0x13a8fe['count']=_0x48152d;if(_0x11f6fd[_0xee57('0x2d')]['includeAll']){_0x1c7079[_0xee57('0x3c')]=[{'all':!![]}];}return db[_0xee57('0x28')]['findAll'](_0x1c7079);})[_0xee57('0x20')](function(_0x576898){_0x13a8fe['rows']=_0x576898;return _0x13a8fe;})[_0xee57('0x20')](respondWithFilteredResult(_0x2c4e0f,_0x1c7079))[_0xee57('0x3d')](handleError(_0x2c4e0f,null));};exports[_0xee57('0x3e')]=function(_0x3336a4,_0x3813b4){var _0x5c13e5={'raw':![],'where':{'id':_0x3336a4[_0xee57('0x3f')]['id']}},_0x41674a={};_0x41674a[_0xee57('0x2c')]=_[_0xee57('0x2e')](db[_0xee57('0x28')][_0xee57('0x29')]);_0x41674a['query']=_[_0xee57('0x2e')](_0x3336a4[_0xee57('0x2d')]);_0x41674a['filters']=_[_0xee57('0x30')](_0x41674a[_0xee57('0x2c')],_0x41674a[_0xee57('0x2d')]);_0x5c13e5[_0xee57('0x31')]=_[_0xee57('0x30')](_0x41674a[_0xee57('0x2c')],qs[_0xee57('0x32')](_0x3336a4[_0xee57('0x2d')][_0xee57('0x32')]));_0x5c13e5[_0xee57('0x31')]=_0x5c13e5['attributes'][_0xee57('0x33')]?_0x5c13e5[_0xee57('0x31')]:_0x41674a[_0xee57('0x2c')];if(_0x3336a4[_0xee57('0x2d')][_0xee57('0x40')]){_0x5c13e5[_0xee57('0x3c')]=[{'all':!![]}];}_0x5c13e5=_['merge']({},_0x5c13e5,_0x3336a4['options']);return db[_0xee57('0x28')][_0xee57('0x41')](_0x5c13e5)['then'](handleEntityNotFound(_0x3813b4,null))[_0xee57('0x20')](respondWithResult(_0x3813b4,null))[_0xee57('0x3d')](handleError(_0x3813b4,null));};exports['create']=function(_0xbff060,_0x336ed9){return db[_0xee57('0x28')]['create'](_0xbff060[_0xee57('0x42')],{})[_0xee57('0x20')](respondWithResult(_0x336ed9,0xc9))['catch'](handleError(_0x336ed9,null));};exports[_0xee57('0x1f')]=function(_0x33faf6,_0x2fd2b4){if(_0x33faf6[_0xee57('0x42')]['id']){delete _0x33faf6[_0xee57('0x42')]['id'];}return db[_0xee57('0x28')]['find']({'where':{'id':_0x33faf6['params']['id']}})[_0xee57('0x20')](handleEntityNotFound(_0x2fd2b4,null))[_0xee57('0x20')](saveUpdates(_0x33faf6[_0xee57('0x42')],null))[_0xee57('0x20')](respondWithResult(_0x2fd2b4,null))[_0xee57('0x3d')](handleError(_0x2fd2b4,null));};exports['destroy']=function(_0x3dc8b8,_0x2b8a81){return db[_0xee57('0x28')][_0xee57('0x41')]({'where':{'id':_0x3dc8b8[_0xee57('0x3f')]['id']}})[_0xee57('0x20')](handleEntityNotFound(_0x2b8a81,null))[_0xee57('0x20')](removeEntity(_0x2b8a81,null))[_0xee57('0x3d')](handleError(_0x2b8a81,null));};exports[_0xee57('0x43')]=function(_0xc3f41d,_0x4ae37e,_0x43e3a6){var _0x2b4acf={};var _0x37697c={};var _0x23fd8b;var _0x4031d4;return db[_0xee57('0x28')][_0xee57('0x44')]({'where':{'id':_0xc3f41d[_0xee57('0x3f')]['id']}})[_0xee57('0x20')](handleEntityNotFound(_0x4ae37e,null))[_0xee57('0x20')](function(_0x5cc7e3){if(_0x5cc7e3){_0x23fd8b=_0x5cc7e3;_0x37697c[_0xee57('0x2c')]=_[_0xee57('0x2e')](db[_0xee57('0x45')][_0xee57('0x29')]);_0x37697c[_0xee57('0x2d')]=_['keys'](_0xc3f41d[_0xee57('0x2d')]);_0x37697c['filters']=_[_0xee57('0x30')](_0x37697c[_0xee57('0x2c')],_0x37697c[_0xee57('0x2d')]);_0x2b4acf['attributes']=_[_0xee57('0x30')](_0x37697c['model'],qs[_0xee57('0x32')](_0xc3f41d[_0xee57('0x2d')][_0xee57('0x32')]));_0x2b4acf[_0xee57('0x31')]=_0x2b4acf[_0xee57('0x31')]['length']?_0x2b4acf['attributes']:_0x37697c['model'];_0x2b4acf[_0xee57('0x35')]=qs[_0xee57('0x36')](_0xc3f41d[_0xee57('0x2d')]['sort']);_0x2b4acf[_0xee57('0x37')]=qs[_0xee57('0x2f')](_[_0xee57('0x38')](_0xc3f41d[_0xee57('0x2d')],_0x37697c[_0xee57('0x2f')]));if(_0xc3f41d[_0xee57('0x2d')][_0xee57('0x39')]){_0x2b4acf[_0xee57('0x37')]=_[_0xee57('0x3a')](_0x2b4acf['where'],{'$or':_[_0xee57('0x27')](_0x2b4acf['attributes'],function(_0x1c957a){var _0x4de867={};_0x4de867[_0x1c957a]={'$like':'%'+_0xc3f41d[_0xee57('0x2d')][_0xee57('0x39')]+'%'};return _0x4de867;})});}_0x2b4acf=_[_0xee57('0x3a')]({},_0x2b4acf,_0xc3f41d[_0xee57('0x46')]);return _0x23fd8b[_0xee57('0x43')](_0x2b4acf);}})[_0xee57('0x20')](function(_0x567f64){if(_0x567f64){_0x4031d4=_0x567f64[_0xee57('0x33')];if(!_0xc3f41d[_0xee57('0x2d')][_0xee57('0x47')](_0xee57('0x34'))){_0x2b4acf['limit']=qs['limit'](_0xc3f41d[_0xee57('0x2d')][_0xee57('0x19')]);_0x2b4acf['offset']=qs[_0xee57('0x1b')](_0xc3f41d['query'][_0xee57('0x1b')]);}return _0x23fd8b[_0xee57('0x43')](_0x2b4acf);}})['then'](function(_0x146d91){if(_0x146d91){return _0x146d91?{'count':_0x4031d4,'rows':_0x146d91}:null;}})['then'](respondWithResult(_0x4ae37e,null))['catch'](handleError(_0x4ae37e,null));};exports['addConfiguration']=function(_0x43db41,_0x4db647,_0x4a7a42){if(_0x43db41[_0xee57('0x42')]['id']){delete _0x43db41['body']['id'];}return db[_0xee57('0x28')]['findOne']({'where':{'id':_0x43db41[_0xee57('0x3f')]['id']}})[_0xee57('0x20')](handleEntityNotFound(_0x4db647,null))[_0xee57('0x20')](function(_0x4a47ab){if(_0x4a47ab){_0x43db41[_0xee57('0x42')][_0xee57('0x48')]=_0x4a47ab['id'];_0x43db41[_0xee57('0x42')][_0xee57('0x49')]=integrations['getSubjects'](_0x43db41['body'][_0xee57('0x4a')],_0x43db41[_0xee57('0x42')][_0xee57('0x2b')]);_0x43db41['body'][_0xee57('0x4b')]=integrations[_0xee57('0x4c')](_0x43db41[_0xee57('0x42')][_0xee57('0x4a')],_0x43db41[_0xee57('0x42')][_0xee57('0x2b')]);return db[_0xee57('0x45')][_0xee57('0x4d')](_0x43db41[_0xee57('0x42')],{'include':[{'model':db[_0xee57('0x4e')],'as':'Subjects'},{'model':db[_0xee57('0x4e')],'as':_0xee57('0x4b')}]});}return null;})[_0xee57('0x20')](respondWithResult(_0x4db647,null))[_0xee57('0x3d')](handleError(_0x4db647,null));};exports[_0xee57('0x4f')]=function(_0x3264d4,_0xe25def,_0x10a93a){var _0x35ffae=_0x3264d4[_0xee57('0x2d')][_0xee57('0x50')];var _0x3c33af=_0x35ffae==='incident'?_0xee57('0x51'):_0xee57('0x52');var _0x3dd8da='';var _0x3e9491='';var _0x427a3e='';var _0x2b05d0='';var _0x5e02c3='';var _0x33974c='';var _0x56d44c='';var _0x39c3a1='';var _0x3ec3fa=[_0xee57('0x53'),'description',_0xee57('0x54'),_0xee57('0x55'),_0xee57('0x56'),_0xee57('0x57'),'phonenumber','regardingobjectid','directioncode',_0xee57('0x58')];var _0x371d21=[_0xee57('0x59'),_0xee57('0x5a'),_0xee57('0x5b'),_0xee57('0x5c'),_0xee57('0x5d'),_0xee57('0x5e'),_0xee57('0x5f'),'contractidname',_0xee57('0x60'),_0xee57('0x61'),_0xee57('0x62'),_0xee57('0x63'),_0xee57('0x64'),_0xee57('0x65'),'createdonbehalfbyyominame',_0xee57('0x66'),_0xee57('0x67'),_0xee57('0x68'),_0xee57('0x69'),_0xee57('0x6a'),_0xee57('0x6b'),_0xee57('0x6c'),'escalatedon',_0xee57('0x6d'),_0xee57('0x6e'),'followupby',_0xee57('0x6f'),_0xee57('0x70'),_0xee57('0x71'),'lastonholdtime',_0xee57('0x72'),_0xee57('0x73'),_0xee57('0x74'),_0xee57('0x75'),'modifiedbyyominame',_0xee57('0x76'),_0xee57('0x77'),_0xee57('0x78'),_0xee57('0x79'),_0xee57('0x7a'),_0xee57('0x7b'),_0xee57('0x7c'),_0xee57('0x7d'),'owneridname',_0xee57('0x7e'),_0xee57('0x7f'),_0xee57('0x80'),'primarycontactidname',_0xee57('0x81'),'prioritycodename',_0xee57('0x82'),_0xee57('0x83'),_0xee57('0x84'),_0xee57('0x85'),_0xee57('0x86'),_0xee57('0x87'),'responsiblecontactidyominame',_0xee57('0x88'),_0xee57('0x89'),_0xee57('0x8a'),_0xee57('0x8b'),'statecode','statuscode',_0xee57('0x8c'),_0xee57('0x8d'),_0xee57('0x8e'),_0xee57('0x8f'),_0xee57('0x90'),'utcconversiontimezonecode','versionnumber'];var _0x8f1d58=_0x3ec3fa[_0xee57('0x91')](_0x371d21);return db[_0xee57('0x28')][_0xee57('0x44')]({'where':{'id':_0x3264d4[_0xee57('0x3f')]['id']},'attributes':['id',_0xee57('0x92'),_0xee57('0x93'),_0xee57('0x94'),_0xee57('0x95'),'clientId',_0xee57('0x96')]})[_0xee57('0x20')](handleEntityNotFound(_0xe25def,null))[_0xee57('0x20')](function(_0x396a21){if(_0x396a21){_0x39c3a1=_0x396a21['remoteUri'];var _0x4d894a=_0x39c3a1[_0xee57('0x97')](-0x1);if(_0x4d894a==='/'){_0x39c3a1=_0x39c3a1['substring'](0x0,_0x39c3a1[_0xee57('0x98')](_0x4d894a));}_0x56d44c=util[_0xee57('0x99')]('%s/api/data/v9.0/',_0x39c3a1);var _0x1c149d={'method':_0xee57('0x9a'),'uri':_0xee57('0x9b')+_0x396a21[_0xee57('0x95')]+'/oauth2/token','form':{'client_id':_0x396a21[_0xee57('0x9c')],'resource':_0x39c3a1,'username':_0x396a21[_0xee57('0x92')],'password':_0x396a21['password'],'grant_type':_0xee57('0x93'),'client_secret':_0x396a21[_0xee57('0x96')]},'json':!![]};return rp(_0x1c149d);}})[_0xee57('0x20')](function(_0x1c1805){_0x33974c=_0x1c1805[_0xee57('0x9d')];var _0x22b20f={'method':'GET','uri':encodeURI(_0x56d44c+_0xee57('0x9e')+_0x3c33af+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x33974c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x22b20f);})['then'](function(_0x160aa0){var _0x605eae=_0x160aa0[_0xee57('0x9f')][0x0];var _0x181807=_0x605eae['MetadataId'];var _0x27ef4f={'method':_0xee57('0xa0'),'uri':_0x56d44c+'EntityDefinitions('+_0x181807+_0xee57('0xa1'),'headers':{'Authorization':_0xee57('0xa2')+_0x33974c,'If-None-Match':null,'OData-Version':_0xee57('0xa3')},'json':!![]};return rp(_0x27ef4f);})[_0xee57('0x20')](function(_0x29c6c8){_0x3dd8da=_0x29c6c8;_0x3e9491=_0x3dd8da[_0xee57('0xa4')];_0x3e9491=_[_0xee57('0xa5')](_0x3e9491,function(_0x1aaace){return!_0x8f1d58['includes'](_0x1aaace['LogicalName']);});var _0x2ec98d=[];var _0x24d46d=[];_0x3e9491['forEach'](function(_0x51a4b9){if(_0x51a4b9[_0xee57('0xa6')]){var _0x221ee1=_0x51a4b9[_0xee57('0xa6')][_0xee57('0xa7')](_0x51a4b9[_0xee57('0xa6')][_0xee57('0x98')]('.')+0x1);if(_0x221ee1===_0xee57('0xa8')){_0x2ec98d['push'](getSelectList(_0x56d44c,_0x35ffae,_0x24d46d,_0x3dd8da[_0xee57('0xa9')],_0x51a4b9[_0xee57('0xa9')],_0x33974c));}}});return Promise[_0xee57('0xaa')](_0x2ec98d);})['then'](function(_0xfdf330){_0x427a3e=_0xfdf330[0x0];var _0x1698d3=[];var _0x58f1cb=[];_0x3e9491[_0xee57('0xab')](function(_0x5d6e8e){if(!_[_0xee57('0xac')](_0x5d6e8e[_0xee57('0xa6')])){var _0x258b6c=_0x5d6e8e[_0xee57('0xa6')][_0xee57('0xa7')](_0x5d6e8e['@odata.type']['lastIndexOf']('.')+0x1);if(_0x258b6c===_0xee57('0xad')){_0x1698d3[_0xee57('0xae')](getBooleanList(_0x56d44c,_0x35ffae,_0x58f1cb,_0x3dd8da[_0xee57('0xa9')],_0x5d6e8e[_0xee57('0xa9')],_0x33974c));}}});return Promise[_0xee57('0xaa')](_0x1698d3);})[_0xee57('0x20')](function(_0x5557e1){_0x2b05d0=_0x5557e1[0x0];var _0xeb94bd=[];var _0x2f2027=[];_0x3e9491[_0xee57('0xab')](function(_0x31aa4e){if(_0x31aa4e['@odata.type']){var _0x254d9d=_0x31aa4e[_0xee57('0xa6')][_0xee57('0xa7')](_0x31aa4e[_0xee57('0xa6')][_0xee57('0x98')]('.')+0x1);if(_0x254d9d===_0xee57('0xaf')||_0x254d9d===_0xee57('0xb0')||_0x254d9d===_0xee57('0xb1')||_0x254d9d==='IntegerAttributeMetadata'||_0x254d9d===_0xee57('0xb2')||_0x254d9d===_0xee57('0xb3')||_0x254d9d==='StatusAttributeMetadata'||_0x254d9d===_0xee57('0xb4')||_0x254d9d===_0xee57('0xb5')||_0x254d9d===_0xee57('0xb6')){_0xeb94bd['push'](getInputList(_0x56d44c,_0x35ffae,_0x254d9d,_0x2f2027,_0x3dd8da[_0xee57('0xa9')],_0x31aa4e[_0xee57('0xa9')],_0x33974c));}}});return Promise['all'](_0xeb94bd);})[_0xee57('0x20')](function(_0x2a429d){_0x5e02c3=_0x2a429d[0x0];var _0x34b9e9=_0x427a3e[_0xee57('0x91')](_0x2b05d0)[_0xee57('0x91')](_0x5e02c3);var _0x1836ac={'count':_0x34b9e9['length'],'rows':_0x34b9e9};return _0x1836ac;})['then'](respondWithResult(_0xe25def,null))[_0xee57('0x3d')](function(_0x4d711a){var _0x4eb727=_0x3264d4[_0xee57('0x2d')][_0xee57('0xb7')]?0x1f4:_0x4d711a[_0xee57('0xb8')]||0x1f4;logger[_0xee57('0x23')](_0x4d711a['stack']);delete _0x4d711a[_0xee57('0x25')];if(_0x4eb727===0x191){_0x4eb727=0x190;}_0xe25def[_0xee57('0x17')](_0x4eb727)[_0xee57('0x26')](_0x3264d4[_0xee57('0x2d')][_0xee57('0xb7')]?{'message':_0xee57('0xb9'),'statusCode':_0x4d711a[_0xee57('0xb8')]}:_0x4d711a);});};function getSelectList(_0x465254,_0x1bd596,_0xb01d3a,_0x1de26b,_0x5666a2,_0x7ad523){var _0x356c9a={'method':'GET','uri':_0x465254+_0xee57('0xba')+_0x1de26b+_0xee57('0xbb')+_0x5666a2+_0xee57('0xbc')+_0xee57('0xbd'),'headers':{'Authorization':_0xee57('0xa2')+_0x7ad523,'If-None-Match':null,'OData-Version':_0xee57('0xa3')},'json':!![]};return rp(_0x356c9a)['then'](function(_0x4c3488){var _0x513490=[];var _0x2ddb9a=_0x4c3488[_0xee57('0xbe')][_0xee57('0xbf')];_0x2ddb9a[_0xee57('0xab')](function(_0x4da04b){_0x513490[_0xee57('0xae')]({'name':_0x4da04b[_0xee57('0xc0')][_0xee57('0xc1')][_0xee57('0xc0')],'value':String(_0x4da04b[_0xee57('0xc2')])});});var _0x2d4650={'id':_0x1bd596+'_'+_0x4c3488[_0xee57('0xc3')],'name':_0x4c3488[_0xee57('0xc4')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x513490};_0xb01d3a[_0xee57('0xae')](_0x2d4650);return _0xb01d3a;});}function getBooleanList(_0x17cbc7,_0x8fbd0,_0x3c55d5,_0x845bac,_0x53a369,_0x198ce3){var _0x2874a1={'method':'GET','uri':_0x17cbc7+_0xee57('0xba')+_0x845bac+')/Attributes('+_0x53a369+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xee57('0xa2')+_0x198ce3,'If-None-Match':null,'OData-Version':_0xee57('0xa3')},'json':!![]};return rp(_0x2874a1)[_0xee57('0x20')](function(_0x510c93){var _0x18fdf5=[];_0x18fdf5[_0xee57('0xae')]({'name':_0x510c93[_0xee57('0xbe')][_0xee57('0xc5')]['Label'][_0xee57('0xc1')][_0xee57('0xc0')],'value':'true'},{'name':_0x510c93[_0xee57('0xbe')][_0xee57('0xc6')]['Label'][_0xee57('0xc1')]['Label'],'value':'false'});var _0x47332d={'id':_0x8fbd0+'_'+_0x510c93[_0xee57('0xc3')],'name':_0x510c93[_0xee57('0xc4')][_0xee57('0xc1')][_0xee57('0xc0')],'custom':![],'options':_0x18fdf5};_0x3c55d5['push'](_0x47332d);return _0x3c55d5;});}function getInputList(_0x3949b3,_0x17a1ed,_0x3af863,_0x462199,_0x4cfe92,_0x3e4eac,_0xb12bc5){var _0x153b2f={'method':_0xee57('0xa0'),'uri':_0x3949b3+'EntityDefinitions('+_0x4cfe92+')/Attributes('+_0x3e4eac+')/Microsoft.Dynamics.CRM.'+_0x3af863+_0xee57('0xc7'),'headers':{'Authorization':_0xee57('0xa2')+_0xb12bc5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x153b2f)[_0xee57('0x20')](function(_0x13475e){var _0x22c904={'id':_0x17a1ed+'_'+_0x13475e['LogicalName'],'name':_0x13475e[_0xee57('0xc4')][_0xee57('0xc1')]?_0x13475e[_0xee57('0xc4')][_0xee57('0xc1')][_0xee57('0xc0')]:_0x13475e['LogicalName'],'custom':![],'options':[]};_0x462199[_0xee57('0xae')](_0x22c904);return _0x462199;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f540a00..7099ae9 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x764b94,_0x518144){var _0x10e4c5=function(_0x2e5767){while(--_0x2e5767){_0x764b94['push'](_0x764b94['shift']());}};_0x10e4c5(++_0x518144);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0xba412b,_0x1806d5){var _0x1f6661=function(_0x3ab0c0){while(--_0x3ab0c0){_0xba412b['push'](_0xba412b['shift']());}};_0x1f6661(++_0x1806d5);}(_0x757a,0xde));var _0xa757=function(_0x46348d,_0xdbe4be){_0x46348d=_0x46348d-0x0;var _0x5b507e=_0x757a[_0x46348d];return _0x5b507e;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 9aa0fc3..68b2310 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 _0xf78e=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','raw','where','options','attributes','include','model','map','find','ShowDynamics365Account','moment','bluebird'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xf78e,0xa8));var _0xef78=function(_0x160425,_0x2983aa){_0x160425=_0x160425-0x0;var _0x455b67=_0xf78e[_0x160425];return _0x455b67;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xef78('0x0'));var BPromise=require(_0xef78('0x1'));var rs=require(_0xef78('0x2'));var fs=require('fs');var Redis=require(_0xef78('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xef78('0x4'));var logger=require(_0xef78('0x5'))(_0xef78('0x6'));var config=require(_0xef78('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xef78('0x8')][_0xef78('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x311445,_0x494443,_0x3ee2e3){return new BPromise(function(_0xbfa4ff,_0x4d714c){return client[_0xef78('0xa')](_0x311445,_0x3ee2e3)[_0xef78('0xb')](function(_0x5a5b67){logger[_0xef78('0xc')](_0xef78('0xd'),_0x494443,'request\x20sent');logger[_0xef78('0xe')](_0xef78('0xf'),_0x494443,_0xef78('0x10'),JSON[_0xef78('0x11')](_0x5a5b67));if(_0x5a5b67[_0xef78('0x12')]){if(_0x5a5b67[_0xef78('0x12')][_0xef78('0x13')]===0x1f4){logger[_0xef78('0x12')](_0xef78('0xd'),_0x494443,_0x5a5b67[_0xef78('0x12')][_0xef78('0x14')]);return _0x4d714c(_0x5a5b67[_0xef78('0x12')][_0xef78('0x14')]);}logger[_0xef78('0x12')](_0xef78('0xd'),_0x494443,_0x5a5b67[_0xef78('0x12')]['message']);return _0xbfa4ff(_0x5a5b67[_0xef78('0x12')][_0xef78('0x14')]);}else{logger[_0xef78('0xc')](_0xef78('0xd'),_0x494443,_0xef78('0x10'));_0xbfa4ff(_0x5a5b67['result'][_0xef78('0x14')]);}})[_0xef78('0x15')](function(_0x4171dc){logger[_0xef78('0x12')](_0xef78('0xd'),_0x494443,_0x4171dc);_0x4d714c(_0x4171dc);});});}exports[_0xef78('0x16')]=function(_0x439e62){var _0x8ce087=this;return new Promise(function(_0x292c42,_0x2c0346){return db[_0xef78('0x17')][_0xef78('0x18')]({'raw':_0x439e62['options']?_0x439e62['options'][_0xef78('0x19')]===undefined?!![]:![]:!![],'where':_0x439e62['options']?_0x439e62['options'][_0xef78('0x1a')]||null:null,'attributes':_0x439e62[_0xef78('0x1b')]?_0x439e62[_0xef78('0x1b')][_0xef78('0x1c')]||null:null,'limit':_0x439e62[_0xef78('0x1b')]?_0x439e62[_0xef78('0x1b')]['limit']||null:null,'include':_0x439e62[_0xef78('0x1b')]?_0x439e62[_0xef78('0x1b')][_0xef78('0x1d')]?_['map'](_0x439e62[_0xef78('0x1b')][_0xef78('0x1d')],function(_0x44f77e){return{'model':db[_0x44f77e[_0xef78('0x1e')]],'as':_0x44f77e['as'],'attributes':_0x44f77e['attributes'],'include':_0x44f77e[_0xef78('0x1d')]?_[_0xef78('0x1f')](_0x44f77e[_0xef78('0x1d')],function(_0x4117db){return{'model':db[_0x4117db['model']],'as':_0x4117db['as'],'attributes':_0x4117db['attributes'],'include':_0x4117db['include']?_['map'](_0x4117db[_0xef78('0x1d')],function(_0x398301){return{'model':db[_0x398301[_0xef78('0x1e')]],'as':_0x398301['as'],'attributes':_0x398301[_0xef78('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f86fe){logger[_0xef78('0xc')]('GetDynamics365Account',_0x439e62);logger['debug']('GetDynamics365Account',_0x439e62,JSON[_0xef78('0x11')](_0x2f86fe));_0x292c42(_0x2f86fe);})[_0xef78('0x15')](function(_0xecb1c4){logger[_0xef78('0x12')](_0xef78('0x16'),_0xecb1c4['message'],_0x439e62);_0x2c0346(_0x8ce087[_0xef78('0x12')](0x1f4,_0xecb1c4['message']));});});};exports['ShowDynamics365Account']=function(_0x368382){var _0x3779a3=this;return new Promise(function(_0x1ac458,_0x1f9ac2){return db[_0xef78('0x17')][_0xef78('0x20')]({'raw':_0x368382[_0xef78('0x1b')]?_0x368382[_0xef78('0x1b')][_0xef78('0x19')]===undefined?!![]:![]:!![],'where':_0x368382[_0xef78('0x1b')]?_0x368382['options']['where']||null:null,'attributes':_0x368382['options']?_0x368382[_0xef78('0x1b')][_0xef78('0x1c')]||null:null,'include':_0x368382[_0xef78('0x1b')]?_0x368382[_0xef78('0x1b')]['include']?_[_0xef78('0x1f')](_0x368382['options'][_0xef78('0x1d')],function(_0x335f98){return{'model':db[_0x335f98[_0xef78('0x1e')]],'as':_0x335f98['as'],'attributes':_0x335f98['attributes'],'include':_0x335f98[_0xef78('0x1d')]?_['map'](_0x335f98[_0xef78('0x1d')],function(_0x836b21){return{'model':db[_0x836b21[_0xef78('0x1e')]],'as':_0x836b21['as'],'attributes':_0x836b21['attributes'],'include':_0x836b21['include']?_[_0xef78('0x1f')](_0x836b21[_0xef78('0x1d')],function(_0x1e4442){return{'model':db[_0x1e4442['model']],'as':_0x1e4442['as'],'attributes':_0x1e4442[_0xef78('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xef78('0xb')](function(_0x3601c3){logger[_0xef78('0xc')]('ShowDynamics365Account',_0x368382);logger['debug'](_0xef78('0x21'),_0x368382,JSON[_0xef78('0x11')](_0x3601c3));_0x1ac458(_0x3601c3);})[_0xef78('0x15')](function(_0x2f281f){logger[_0xef78('0x12')](_0xef78('0x21'),_0x2f281f[_0xef78('0x14')],_0x368382);_0x1f9ac2(_0x3779a3[_0xef78('0x12')](0x1f4,_0x2f281f[_0xef78('0x14')]));});});}; \ No newline at end of file +var _0xf97d=['limit','map','include','model','catch','ShowDynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','debug','request\x20sent','stringify','Dynamics365Account,\x20%s,\x20%s','error','message','info','result','GetDynamics365Account','Dynamics365Account','options','where','attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf97d,0x87));var _0xdf97=function(_0x3793a4,_0x18871a){_0x3793a4=_0x3793a4-0x0;var _0x2ab94f=_0xf97d[_0x3793a4];return _0x2ab94f;};'use strict';var _=require('lodash');var util=require(_0xdf97('0x0'));var moment=require(_0xdf97('0x1'));var BPromise=require(_0xdf97('0x2'));var rs=require(_0xdf97('0x3'));var fs=require('fs');var Redis=require(_0xdf97('0x4'));var db=require(_0xdf97('0x5'))['db'];var utils=require(_0xdf97('0x6'));var logger=require(_0xdf97('0x7'))(_0xdf97('0x8'));var config=require(_0xdf97('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x792d88,_0xeb0dec,_0x7ff8c6){return new BPromise(function(_0x2c6a32,_0x1c3c58){return client[_0xdf97('0xa')](_0x792d88,_0x7ff8c6)[_0xdf97('0xb')](function(_0x3cc2cf){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0xeb0dec,'request\x20sent');logger[_0xdf97('0xc')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xeb0dec,_0xdf97('0xd'),JSON[_0xdf97('0xe')](_0x3cc2cf));if(_0x3cc2cf['error']){if(_0x3cc2cf['error']['code']===0x1f4){logger['error'](_0xdf97('0xf'),_0xeb0dec,_0x3cc2cf[_0xdf97('0x10')][_0xdf97('0x11')]);return _0x1c3c58(_0x3cc2cf[_0xdf97('0x10')][_0xdf97('0x11')]);}logger[_0xdf97('0x10')](_0xdf97('0xf'),_0xeb0dec,_0x3cc2cf[_0xdf97('0x10')][_0xdf97('0x11')]);return _0x2c6a32(_0x3cc2cf[_0xdf97('0x10')][_0xdf97('0x11')]);}else{logger[_0xdf97('0x12')](_0xdf97('0xf'),_0xeb0dec,_0xdf97('0xd'));_0x2c6a32(_0x3cc2cf[_0xdf97('0x13')]['message']);}})['catch'](function(_0x33050f){logger['error'](_0xdf97('0xf'),_0xeb0dec,_0x33050f);_0x1c3c58(_0x33050f);});});}exports[_0xdf97('0x14')]=function(_0x5c5ca2){var _0x9d036=this;return new Promise(function(_0x22a8de,_0x25edae){return db[_0xdf97('0x15')]['findAll']({'raw':_0x5c5ca2[_0xdf97('0x16')]?_0x5c5ca2[_0xdf97('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5c5ca2[_0xdf97('0x16')]?_0x5c5ca2[_0xdf97('0x16')][_0xdf97('0x17')]||null:null,'attributes':_0x5c5ca2[_0xdf97('0x16')]?_0x5c5ca2[_0xdf97('0x16')][_0xdf97('0x18')]||null:null,'limit':_0x5c5ca2['options']?_0x5c5ca2[_0xdf97('0x16')][_0xdf97('0x19')]||null:null,'include':_0x5c5ca2[_0xdf97('0x16')]?_0x5c5ca2['options']['include']?_[_0xdf97('0x1a')](_0x5c5ca2[_0xdf97('0x16')][_0xdf97('0x1b')],function(_0x3f9769){return{'model':db[_0x3f9769[_0xdf97('0x1c')]],'as':_0x3f9769['as'],'attributes':_0x3f9769['attributes'],'include':_0x3f9769[_0xdf97('0x1b')]?_[_0xdf97('0x1a')](_0x3f9769[_0xdf97('0x1b')],function(_0x2f8f8e){return{'model':db[_0x2f8f8e[_0xdf97('0x1c')]],'as':_0x2f8f8e['as'],'attributes':_0x2f8f8e[_0xdf97('0x18')],'include':_0x2f8f8e['include']?_['map'](_0x2f8f8e[_0xdf97('0x1b')],function(_0x4cdab1){return{'model':db[_0x4cdab1[_0xdf97('0x1c')]],'as':_0x4cdab1['as'],'attributes':_0x4cdab1[_0xdf97('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdf97('0xb')](function(_0xccd319){logger[_0xdf97('0x12')](_0xdf97('0x14'),_0x5c5ca2);logger[_0xdf97('0xc')](_0xdf97('0x14'),_0x5c5ca2,JSON['stringify'](_0xccd319));_0x22a8de(_0xccd319);})[_0xdf97('0x1d')](function(_0x2b9a0b){logger[_0xdf97('0x10')](_0xdf97('0x14'),_0x2b9a0b[_0xdf97('0x11')],_0x5c5ca2);_0x25edae(_0x9d036[_0xdf97('0x10')](0x1f4,_0x2b9a0b['message']));});});};exports[_0xdf97('0x1e')]=function(_0x23067d){var _0x240ab5=this;return new Promise(function(_0x47d818,_0x13f44a){return db[_0xdf97('0x15')][_0xdf97('0x1f')]({'raw':_0x23067d[_0xdf97('0x16')]?_0x23067d[_0xdf97('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x23067d[_0xdf97('0x16')]?_0x23067d[_0xdf97('0x16')]['where']||null:null,'attributes':_0x23067d[_0xdf97('0x16')]?_0x23067d[_0xdf97('0x16')][_0xdf97('0x18')]||null:null,'include':_0x23067d[_0xdf97('0x16')]?_0x23067d[_0xdf97('0x16')][_0xdf97('0x1b')]?_[_0xdf97('0x1a')](_0x23067d[_0xdf97('0x16')]['include'],function(_0x43a517){return{'model':db[_0x43a517[_0xdf97('0x1c')]],'as':_0x43a517['as'],'attributes':_0x43a517['attributes'],'include':_0x43a517['include']?_['map'](_0x43a517[_0xdf97('0x1b')],function(_0x502f48){return{'model':db[_0x502f48[_0xdf97('0x1c')]],'as':_0x502f48['as'],'attributes':_0x502f48['attributes'],'include':_0x502f48[_0xdf97('0x1b')]?_[_0xdf97('0x1a')](_0x502f48['include'],function(_0x2ad765){return{'model':db[_0x2ad765[_0xdf97('0x1c')]],'as':_0x2ad765['as'],'attributes':_0x2ad765[_0xdf97('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdf97('0xb')](function(_0x3d1dbd){logger[_0xdf97('0x12')](_0xdf97('0x1e'),_0x23067d);logger['debug']('ShowDynamics365Account',_0x23067d,JSON['stringify'](_0x3d1dbd));_0x47d818(_0x3d1dbd);})['catch'](function(_0x2863d3){logger[_0xdf97('0x10')](_0xdf97('0x1e'),_0x2863d3[_0xdf97('0x11')],_0x23067d);_0x13f44a(_0x240ab5[_0xdf97('0x10')](0x1f4,_0x2863d3[_0xdf97('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 94e667e..7b2784e 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 _0xe3af=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x15a3af,_0x4a3b1d){var _0x4e4529=function(_0x28c22f){while(--_0x28c22f){_0x15a3af['push'](_0x15a3af['shift']());}};_0x4e4529(++_0x4a3b1d);}(_0xe3af,0x18f));var _0xfe3a=function(_0x1b40b5,_0x25e063){_0x1b40b5=_0x1b40b5-0x0;var _0x5f0a6e=_0xe3af[_0x1b40b5];return _0x5f0a6e;};'use strict';var multer=require(_0xfe3a('0x0'));var util=require(_0xfe3a('0x1'));var path=require(_0xfe3a('0x2'));var timeout=require(_0xfe3a('0x3'));var express=require('express');var router=express[_0xfe3a('0x4')]();var fs_extra=require(_0xfe3a('0x5'));var auth=require(_0xfe3a('0x6'));var interaction=require(_0xfe3a('0x7'));var config=require(_0xfe3a('0x8'));var controller=require(_0xfe3a('0x9'));router[_0xfe3a('0xa')]('/',auth[_0xfe3a('0xb')](),controller[_0xfe3a('0xc')]);router[_0xfe3a('0xa')](_0xfe3a('0xd'),auth[_0xfe3a('0xb')](),controller[_0xfe3a('0xe')]);router[_0xfe3a('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xfe3a('0xa')](_0xfe3a('0xf'),auth['isAuthenticated'](),controller[_0xfe3a('0x10')]);router[_0xfe3a('0xa')](_0xfe3a('0x11'),auth[_0xfe3a('0xb')](),controller[_0xfe3a('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfe3a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xfe3a('0x14')]);router[_0xfe3a('0x15')](_0xfe3a('0xd'),auth[_0xfe3a('0xb')](),controller[_0xfe3a('0x16')]);module[_0xfe3a('0x17')]=router; \ No newline at end of file +var _0xc013=['delete','destroy','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','update'];(function(_0x5f0889,_0x3b3212){var _0x441f8d=function(_0x255654){while(--_0x255654){_0x5f0889['push'](_0x5f0889['shift']());}};_0x441f8d(++_0x3b3212);}(_0xc013,0x1bc));var _0x3c01=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0xc013[_0x7cb10c];return _0x11df59;};'use strict';var multer=require(_0x3c01('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3c01('0x1'));var auth=require(_0x3c01('0x2'));var interaction=require(_0x3c01('0x3'));var config=require(_0x3c01('0x4'));var controller=require('./intDynamics365Configuration.controller');router[_0x3c01('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3c01('0x5')]('/:id',auth[_0x3c01('0x6')](),controller[_0x3c01('0x7')]);router['get'](_0x3c01('0x8'),auth[_0x3c01('0x6')](),controller[_0x3c01('0x9')]);router[_0x3c01('0x5')](_0x3c01('0xa'),auth[_0x3c01('0x6')](),controller[_0x3c01('0xb')]);router['get']('/:id/descriptions',auth[_0x3c01('0x6')](),controller[_0x3c01('0xc')]);router[_0x3c01('0xd')]('/',auth[_0x3c01('0x6')](),controller[_0x3c01('0xe')]);router[_0x3c01('0xf')](_0x3c01('0x10'),auth[_0x3c01('0x6')](),controller[_0x3c01('0x11')]);router[_0x3c01('0x12')](_0x3c01('0x10'),auth[_0x3c01('0x6')](),controller[_0x3c01('0x13')]);module[_0x3c01('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 7ae7263..d3d906a 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 _0x4e91=['STRING','ENUM','incident','sequelize','exports'];(function(_0x1e85f3,_0x287e2d){var _0x4ec941=function(_0x3fe6c2){while(--_0x3fe6c2){_0x1e85f3['push'](_0x1e85f3['shift']());}};_0x4ec941(++_0x287e2d);}(_0x4e91,0x102));var _0x14e9=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0x4e91[_0x413aac];return _0x569b11;};'use strict';var Sequelize=require(_0x14e9('0x0'));module[_0x14e9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x14e9('0x2')]},'ticketType':{'type':Sequelize[_0x14e9('0x3')](_0x14e9('0x4'),'phonecall'),'defaultValue':_0x14e9('0x4')}}; \ No newline at end of file +var _0x2727=['sequelize','STRING','ENUM','phonecall','incident'];(function(_0xca0166,_0x12b2ab){var _0x42210f=function(_0x2d4e89){while(--_0x2d4e89){_0xca0166['push'](_0xca0166['shift']());}};_0x42210f(++_0x12b2ab);}(_0x2727,0x1e5));var _0x7272=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x2727[_0x68ee8b];return _0x5148f7;};'use strict';var Sequelize=require(_0x7272('0x0'));module['exports']={'name':{'type':Sequelize[_0x7272('0x1')]},'description':{'type':Sequelize[_0x7272('0x1')]},'ticketType':{'type':Sequelize[_0x7272('0x2')]('incident',_0x7272('0x3')),'defaultValue':_0x7272('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index d46fb79..de00be2 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 _0x9628=['../../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','then','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs'];(function(_0x29631f,_0xdb767){var _0x486d87=function(_0x33a1bb){while(--_0x33a1bb){_0x29631f['push'](_0x29631f['shift']());}};_0x486d87(++_0xdb767);}(_0x9628,0xe5));var _0x8962=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x9628[_0x376b45];return _0x2341b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8962('0x0'));var zipdir=require(_0x8962('0x1'));var jsonpatch=require(_0x8962('0x2'));var rp=require(_0x8962('0x3'));var moment=require(_0x8962('0x4'));var BPromise=require(_0x8962('0x5'));var Mustache=require(_0x8962('0x6'));var util=require('util');var path=require(_0x8962('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8962('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8962('0x9'));var squel=require(_0x8962('0xa'));var crypto=require('crypto');var jsforce=require(_0x8962('0xb'));var deskjs=require(_0x8962('0xc'));var toCsv=require(_0x8962('0xd'));var querystring=require(_0x8962('0xe'));var Papa=require(_0x8962('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8962('0x10'));var as=require(_0x8962('0x11'));var hardwareService=require(_0x8962('0x12'));var logger=require(_0x8962('0x13'))(_0x8962('0x14'));var utils=require(_0x8962('0x15'));var config=require(_0x8962('0x16'));var licenseUtil=require(_0x8962('0x17'));var db=require(_0x8962('0x18'))['db'];function respondWithStatusCode(_0x2cc812,_0x5e8c6f){_0x5e8c6f=_0x5e8c6f||0xcc;return function(_0x248da0){if(_0x248da0){return _0x2cc812[_0x8962('0x19')](_0x5e8c6f);}return _0x2cc812[_0x8962('0x1a')](_0x5e8c6f)['end']();};}function respondWithResult(_0x464dd9,_0x2f5be0){_0x2f5be0=_0x2f5be0||0xc8;return function(_0xe47c71){if(_0xe47c71){return _0x464dd9['status'](_0x2f5be0)[_0x8962('0x1b')](_0xe47c71);}};}function respondWithFilteredResult(_0xc30478,_0x3f9f29){return function(_0x969b48){if(_0x969b48){var _0x2963e3=typeof _0x3f9f29['offset']===_0x8962('0x1c')&&typeof _0x3f9f29[_0x8962('0x1d')]===_0x8962('0x1c');var _0x19a3a4=_0x969b48[_0x8962('0x1e')];var _0xebd865=_0x2963e3?0x0:_0x3f9f29[_0x8962('0x1f')];var _0x5ede3d=_0x2963e3?_0x969b48['count']:_0x3f9f29[_0x8962('0x1f')]+_0x3f9f29[_0x8962('0x1d')];var _0x4c473c;if(_0x5ede3d>=_0x19a3a4){_0x5ede3d=_0x19a3a4;_0x4c473c=0xc8;}else{_0x4c473c=0xce;}_0xc30478['status'](_0x4c473c);return _0xc30478[_0x8962('0x20')](_0x8962('0x21'),_0xebd865+'-'+_0x5ede3d+'/'+_0x19a3a4)[_0x8962('0x1b')](_0x969b48);}return null;};}function patchUpdates(_0x2486aa){return function(_0xcdd9c3){try{jsonpatch[_0x8962('0x22')](_0xcdd9c3,_0x2486aa,!![]);}catch(_0x12e918){return BPromise[_0x8962('0x23')](_0x12e918);}return _0xcdd9c3[_0x8962('0x24')]();};}function saveUpdates(_0x4b9c07,_0x5aceb9){return function(_0x956b8){if(_0x956b8){return _0x956b8['update'](_0x4b9c07)[_0x8962('0x25')](function(_0xf3542f){return _0xf3542f;});}return null;};}function removeEntity(_0x11db29,_0x412eb3){return function(_0x4e2d93){if(_0x4e2d93){return _0x4e2d93[_0x8962('0x26')]()[_0x8962('0x25')](function(){_0x11db29[_0x8962('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb440,_0xc92488){return function(_0x46ff3c){if(!_0x46ff3c){_0x2bb440[_0x8962('0x19')](0x194);}return _0x46ff3c;};}function handleError(_0x1b71b9,_0x1d2b2e){_0x1d2b2e=_0x1d2b2e||0x1f4;return function(_0x4ded58){logger['error'](_0x4ded58[_0x8962('0x27')]);if(_0x4ded58[_0x8962('0x28')]){delete _0x4ded58[_0x8962('0x28')];}_0x1b71b9[_0x8962('0x1a')](_0x1d2b2e)[_0x8962('0x29')](_0x4ded58);};}exports[_0x8962('0x2a')]=function(_0x37d257,_0x1a6865){var _0x4f6937={},_0xb8c0e9={},_0x47156d={'count':0x0,'rows':[]};var _0xad364b=_[_0x8962('0x2b')](db[_0x8962('0x2c')][_0x8962('0x2d')],function(_0x3c4fa4){return{'name':_0x3c4fa4['fieldName'],'type':_0x3c4fa4[_0x8962('0x2e')][_0x8962('0x2f')]};});_0xb8c0e9['model']=_[_0x8962('0x2b')](_0xad364b,'name');_0xb8c0e9[_0x8962('0x30')]=_[_0x8962('0x31')](_0x37d257[_0x8962('0x30')]);_0xb8c0e9[_0x8962('0x32')]=_[_0x8962('0x33')](_0xb8c0e9[_0x8962('0x34')],_0xb8c0e9['query']);_0x4f6937['attributes']=_[_0x8962('0x33')](_0xb8c0e9[_0x8962('0x34')],qs['fields'](_0x37d257['query'][_0x8962('0x35')]));_0x4f6937[_0x8962('0x36')]=_0x4f6937[_0x8962('0x36')][_0x8962('0x37')]?_0x4f6937[_0x8962('0x36')]:_0xb8c0e9[_0x8962('0x34')];if(!_0x37d257['query'][_0x8962('0x38')](_0x8962('0x39'))){_0x4f6937[_0x8962('0x1d')]=qs[_0x8962('0x1d')](_0x37d257[_0x8962('0x30')][_0x8962('0x1d')]);_0x4f6937[_0x8962('0x1f')]=qs['offset'](_0x37d257['query'][_0x8962('0x1f')]);}_0x4f6937[_0x8962('0x3a')]=qs[_0x8962('0x3b')](_0x37d257['query'][_0x8962('0x3b')]);_0x4f6937['where']=qs['filters'](_[_0x8962('0x3c')](_0x37d257[_0x8962('0x30')],_0xb8c0e9['filters']),_0xad364b);if(_0x37d257[_0x8962('0x30')][_0x8962('0x3d')]){_0x4f6937[_0x8962('0x3e')]=_[_0x8962('0x3f')](_0x4f6937[_0x8962('0x3e')],{'$or':_[_0x8962('0x2b')](_0xad364b,function(_0x47bc94){if(_0x47bc94[_0x8962('0x2e')]!==_0x8962('0x40')){var _0x9df6c={};_0x9df6c[_0x47bc94[_0x8962('0x28')]]={'$like':'%'+_0x37d257['query']['filter']+'%'};return _0x9df6c;}})});}_0x4f6937=_[_0x8962('0x3f')]({},_0x4f6937,_0x37d257[_0x8962('0x41')]);var _0x990d8={'where':_0x4f6937[_0x8962('0x3e')]};return db[_0x8962('0x2c')][_0x8962('0x1e')](_0x990d8)['then'](function(_0x385e04){_0x47156d[_0x8962('0x1e')]=_0x385e04;if(_0x37d257[_0x8962('0x30')][_0x8962('0x42')]){_0x4f6937[_0x8962('0x43')]=[{'all':!![]}];}return db[_0x8962('0x2c')][_0x8962('0x44')](_0x4f6937);})['then'](function(_0x4674a7){_0x47156d[_0x8962('0x45')]=_0x4674a7;return _0x47156d;})[_0x8962('0x25')](respondWithFilteredResult(_0x1a6865,_0x4f6937))[_0x8962('0x46')](handleError(_0x1a6865,null));};exports[_0x8962('0x47')]=function(_0x702720,_0x47ea90){var _0xee2c88={'raw':![],'where':{'id':_0x702720[_0x8962('0x48')]['id']}},_0x2df1fe={};_0x2df1fe[_0x8962('0x34')]=_['keys'](db[_0x8962('0x2c')][_0x8962('0x2d')]);_0x2df1fe[_0x8962('0x30')]=_[_0x8962('0x31')](_0x702720[_0x8962('0x30')]);_0x2df1fe[_0x8962('0x32')]=_[_0x8962('0x33')](_0x2df1fe[_0x8962('0x34')],_0x2df1fe[_0x8962('0x30')]);_0xee2c88[_0x8962('0x36')]=_['intersection'](_0x2df1fe[_0x8962('0x34')],qs['fields'](_0x702720['query'][_0x8962('0x35')]));_0xee2c88[_0x8962('0x36')]=_0xee2c88['attributes'][_0x8962('0x37')]?_0xee2c88[_0x8962('0x36')]:_0x2df1fe[_0x8962('0x34')];if(_0x702720[_0x8962('0x30')][_0x8962('0x42')]){_0xee2c88[_0x8962('0x43')]=[{'all':!![]}];}_0xee2c88=_[_0x8962('0x3f')]({},_0xee2c88,_0x702720[_0x8962('0x41')]);return db[_0x8962('0x2c')]['find'](_0xee2c88)[_0x8962('0x25')](handleEntityNotFound(_0x47ea90,null))[_0x8962('0x25')](respondWithResult(_0x47ea90,null))['catch'](handleError(_0x47ea90,null));};exports[_0x8962('0x49')]=function(_0x2db788,_0x33280b){return db[_0x8962('0x2c')][_0x8962('0x49')](_0x2db788[_0x8962('0x4a')],{})[_0x8962('0x25')](respondWithResult(_0x33280b,0xc9))['catch'](handleError(_0x33280b,null));};exports[_0x8962('0x4b')]=function(_0xbfbbb6,_0xd71215){if(_0xbfbbb6[_0x8962('0x4a')]['id']){delete _0xbfbbb6[_0x8962('0x4a')]['id'];}return db[_0x8962('0x2c')][_0x8962('0x4c')]({'where':{'id':_0xbfbbb6[_0x8962('0x48')]['id']}})[_0x8962('0x25')](handleEntityNotFound(_0xd71215,null))['then'](saveUpdates(_0xbfbbb6[_0x8962('0x4a')],null))[_0x8962('0x25')](respondWithResult(_0xd71215,null))[_0x8962('0x46')](handleError(_0xd71215,null));};exports[_0x8962('0x26')]=function(_0x5a3528,_0x3a0af2){return db[_0x8962('0x2c')][_0x8962('0x4c')]({'where':{'id':_0x5a3528[_0x8962('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a0af2,null))[_0x8962('0x25')](removeEntity(_0x3a0af2,null))[_0x8962('0x46')](handleError(_0x3a0af2,null));};exports[_0x8962('0x4d')]=function(_0x2bed93,_0x303f2e,_0x595774){var _0x4e4311={};var _0x278cc1={};var _0x4026fb;var _0x338f92;return db[_0x8962('0x2c')][_0x8962('0x4e')]({'where':{'id':_0x2bed93[_0x8962('0x48')]['id']}})[_0x8962('0x25')](handleEntityNotFound(_0x303f2e,null))[_0x8962('0x25')](function(_0x343135){if(_0x343135){_0x4026fb=_0x343135;_0x278cc1[_0x8962('0x34')]=_[_0x8962('0x31')](db[_0x8962('0x4f')]['rawAttributes']);_0x278cc1[_0x8962('0x30')]=_['keys'](_0x2bed93[_0x8962('0x30')]);_0x278cc1['filters']=_[_0x8962('0x33')](_0x278cc1['model'],_0x278cc1[_0x8962('0x30')]);_0x4e4311[_0x8962('0x36')]=_['intersection'](_0x278cc1['model'],qs[_0x8962('0x35')](_0x2bed93['query'][_0x8962('0x35')]));_0x4e4311[_0x8962('0x36')]=_0x4e4311[_0x8962('0x36')]['length']?_0x4e4311['attributes']:_0x278cc1[_0x8962('0x34')];_0x4e4311[_0x8962('0x3a')]=qs['sort'](_0x2bed93['query']['sort']);_0x4e4311['where']=qs[_0x8962('0x32')](_[_0x8962('0x3c')](_0x2bed93[_0x8962('0x30')],_0x278cc1[_0x8962('0x32')]));if(_0x2bed93[_0x8962('0x30')][_0x8962('0x3d')]){_0x4e4311[_0x8962('0x3e')]=_[_0x8962('0x3f')](_0x4e4311['where'],{'$or':_['map'](_0x4e4311['attributes'],function(_0x312eeb){var _0x5bba5f={};_0x5bba5f[_0x312eeb]={'$like':'%'+_0x2bed93[_0x8962('0x30')]['filter']+'%'};return _0x5bba5f;})});}_0x4e4311=_[_0x8962('0x3f')]({},_0x4e4311,_0x2bed93[_0x8962('0x41')]);return _0x4026fb[_0x8962('0x4d')](_0x4e4311);}})[_0x8962('0x25')](function(_0x6eadcf){if(_0x6eadcf){_0x338f92=_0x6eadcf[_0x8962('0x37')];if(!_0x2bed93[_0x8962('0x30')][_0x8962('0x38')](_0x8962('0x39'))){_0x4e4311[_0x8962('0x1d')]=qs['limit'](_0x2bed93[_0x8962('0x30')][_0x8962('0x1d')]);_0x4e4311[_0x8962('0x1f')]=qs[_0x8962('0x1f')](_0x2bed93['query'][_0x8962('0x1f')]);}return _0x4026fb['getFields'](_0x4e4311);}})[_0x8962('0x25')](function(_0x1be45d){if(_0x1be45d){return _0x1be45d?{'count':_0x338f92,'rows':_0x1be45d}:null;}})[_0x8962('0x25')](respondWithResult(_0x303f2e,null))[_0x8962('0x46')](handleError(_0x303f2e,null));};exports[_0x8962('0x50')]=function(_0x57062f,_0x3bc8a3,_0x2fdaa4){var _0x371ebc={};var _0x18e956={};var _0x53bcec;var _0x279211;return db[_0x8962('0x2c')]['findOne']({'where':{'id':_0x57062f['params']['id']}})[_0x8962('0x25')](handleEntityNotFound(_0x3bc8a3,null))[_0x8962('0x25')](function(_0x57156c){if(_0x57156c){_0x53bcec=_0x57156c;_0x18e956['model']=_[_0x8962('0x31')](db['Dynamics365Field'][_0x8962('0x2d')]);_0x18e956[_0x8962('0x30')]=_[_0x8962('0x31')](_0x57062f[_0x8962('0x30')]);_0x18e956[_0x8962('0x32')]=_[_0x8962('0x33')](_0x18e956[_0x8962('0x34')],_0x18e956[_0x8962('0x30')]);_0x371ebc[_0x8962('0x36')]=_[_0x8962('0x33')](_0x18e956[_0x8962('0x34')],qs[_0x8962('0x35')](_0x57062f['query'][_0x8962('0x35')]));_0x371ebc[_0x8962('0x36')]=_0x371ebc[_0x8962('0x36')][_0x8962('0x37')]?_0x371ebc[_0x8962('0x36')]:_0x18e956['model'];_0x371ebc['order']=qs[_0x8962('0x3b')](_0x57062f[_0x8962('0x30')][_0x8962('0x3b')]);_0x371ebc[_0x8962('0x3e')]=qs[_0x8962('0x32')](_[_0x8962('0x3c')](_0x57062f['query'],_0x18e956['filters']));if(_0x57062f[_0x8962('0x30')][_0x8962('0x3d')]){_0x371ebc[_0x8962('0x3e')]=_[_0x8962('0x3f')](_0x371ebc[_0x8962('0x3e')],{'$or':_[_0x8962('0x2b')](_0x371ebc[_0x8962('0x36')],function(_0x3fdf2b){var _0x3e6419={};_0x3e6419[_0x3fdf2b]={'$like':'%'+_0x57062f[_0x8962('0x30')]['filter']+'%'};return _0x3e6419;})});}_0x371ebc=_[_0x8962('0x3f')]({},_0x371ebc,_0x57062f[_0x8962('0x41')]);return _0x53bcec['getSubjects'](_0x371ebc);}})['then'](function(_0x2375b7){if(_0x2375b7){_0x279211=_0x2375b7[_0x8962('0x37')];if(!_0x57062f['query'][_0x8962('0x38')](_0x8962('0x39'))){_0x371ebc[_0x8962('0x1d')]=qs[_0x8962('0x1d')](_0x57062f['query']['limit']);_0x371ebc[_0x8962('0x1f')]=qs['offset'](_0x57062f[_0x8962('0x30')][_0x8962('0x1f')]);}return _0x53bcec['getSubjects'](_0x371ebc);}})[_0x8962('0x25')](function(_0x51ab43){if(_0x51ab43){return _0x51ab43?{'count':_0x279211,'rows':_0x51ab43}:null;}})['then'](respondWithResult(_0x3bc8a3,null))['catch'](handleError(_0x3bc8a3,null));};exports['getDescriptions']=function(_0x27bf8a,_0x5db83f,_0x36c9a0){var _0x392eb9={};var _0xe1c5f2={};var _0x2ea9ce;var _0x3ef52a;return db[_0x8962('0x2c')]['findOne']({'where':{'id':_0x27bf8a['params']['id']}})[_0x8962('0x25')](handleEntityNotFound(_0x5db83f,null))[_0x8962('0x25')](function(_0x3aa895){if(_0x3aa895){_0x2ea9ce=_0x3aa895;_0xe1c5f2['model']=_[_0x8962('0x31')](db[_0x8962('0x4f')][_0x8962('0x2d')]);_0xe1c5f2[_0x8962('0x30')]=_[_0x8962('0x31')](_0x27bf8a[_0x8962('0x30')]);_0xe1c5f2[_0x8962('0x32')]=_[_0x8962('0x33')](_0xe1c5f2[_0x8962('0x34')],_0xe1c5f2['query']);_0x392eb9['attributes']=_['intersection'](_0xe1c5f2[_0x8962('0x34')],qs[_0x8962('0x35')](_0x27bf8a[_0x8962('0x30')]['fields']));_0x392eb9[_0x8962('0x36')]=_0x392eb9[_0x8962('0x36')][_0x8962('0x37')]?_0x392eb9[_0x8962('0x36')]:_0xe1c5f2[_0x8962('0x34')];_0x392eb9['order']=qs[_0x8962('0x3b')](_0x27bf8a['query'][_0x8962('0x3b')]);_0x392eb9[_0x8962('0x3e')]=qs[_0x8962('0x32')](_[_0x8962('0x3c')](_0x27bf8a[_0x8962('0x30')],_0xe1c5f2[_0x8962('0x32')]));if(_0x27bf8a[_0x8962('0x30')][_0x8962('0x3d')]){_0x392eb9[_0x8962('0x3e')]=_[_0x8962('0x3f')](_0x392eb9[_0x8962('0x3e')],{'$or':_[_0x8962('0x2b')](_0x392eb9[_0x8962('0x36')],function(_0xa7d09b){var _0x52f954={};_0x52f954[_0xa7d09b]={'$like':'%'+_0x27bf8a[_0x8962('0x30')][_0x8962('0x3d')]+'%'};return _0x52f954;})});}_0x392eb9=_[_0x8962('0x3f')]({},_0x392eb9,_0x27bf8a[_0x8962('0x41')]);return _0x2ea9ce['getDescriptions'](_0x392eb9);}})[_0x8962('0x25')](function(_0x227fc0){if(_0x227fc0){_0x3ef52a=_0x227fc0['length'];if(!_0x27bf8a[_0x8962('0x30')]['hasOwnProperty']('nolimit')){_0x392eb9['limit']=qs[_0x8962('0x1d')](_0x27bf8a['query']['limit']);_0x392eb9['offset']=qs['offset'](_0x27bf8a['query'][_0x8962('0x1f')]);}return _0x2ea9ce[_0x8962('0x51')](_0x392eb9);}})[_0x8962('0x25')](function(_0x117f04){if(_0x117f04){return _0x117f04?{'count':_0x3ef52a,'rows':_0x117f04}:null;}})[_0x8962('0x25')](respondWithResult(_0x5db83f,null))[_0x8962('0x46')](handleError(_0x5db83f,null));}; \ No newline at end of file +var _0xef15=['model','query','keys','intersection','attributes','fields','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','Dynamics365Field','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xef15,0x1d0));var _0x5ef1=function(_0x4d770d,_0x5af4ce){_0x4d770d=_0x4d770d-0x0;var _0x11dc7a=_0xef15[_0x4d770d];return _0x11dc7a;};'use strict';var emlformat=require(_0x5ef1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ef1('0x1'));var jsonpatch=require(_0x5ef1('0x2'));var rp=require(_0x5ef1('0x3'));var moment=require(_0x5ef1('0x4'));var BPromise=require(_0x5ef1('0x5'));var Mustache=require(_0x5ef1('0x6'));var util=require(_0x5ef1('0x7'));var path=require(_0x5ef1('0x8'));var sox=require(_0x5ef1('0x9'));var csv=require('to-csv');var ejs=require(_0x5ef1('0xa'));var fs=require('fs');var fs_extra=require(_0x5ef1('0xb'));var _=require(_0x5ef1('0xc'));var squel=require(_0x5ef1('0xd'));var crypto=require(_0x5ef1('0xe'));var jsforce=require(_0x5ef1('0xf'));var deskjs=require(_0x5ef1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5ef1('0x11'));var Papa=require('papaparse');var Redis=require(_0x5ef1('0x12'));var authService=require(_0x5ef1('0x13'));var qs=require(_0x5ef1('0x14'));var as=require(_0x5ef1('0x15'));var hardwareService=require(_0x5ef1('0x16'));var logger=require(_0x5ef1('0x17'))(_0x5ef1('0x18'));var utils=require('../../config/utils');var config=require(_0x5ef1('0x19'));var licenseUtil=require(_0x5ef1('0x1a'));var db=require(_0x5ef1('0x1b'))['db'];function respondWithStatusCode(_0x3888f9,_0x39873b){_0x39873b=_0x39873b||0xcc;return function(_0x257ec9){if(_0x257ec9){return _0x3888f9['sendStatus'](_0x39873b);}return _0x3888f9[_0x5ef1('0x1c')](_0x39873b)['end']();};}function respondWithResult(_0x2969ad,_0x4e570a){_0x4e570a=_0x4e570a||0xc8;return function(_0x19010e){if(_0x19010e){return _0x2969ad['status'](_0x4e570a)[_0x5ef1('0x1d')](_0x19010e);}};}function respondWithFilteredResult(_0x370885,_0x1f0d53){return function(_0x2a76d1){if(_0x2a76d1){var _0x4aca26=typeof _0x1f0d53[_0x5ef1('0x1e')]===_0x5ef1('0x1f')&&typeof _0x1f0d53[_0x5ef1('0x20')]===_0x5ef1('0x1f');var _0x39a04e=_0x2a76d1[_0x5ef1('0x21')];var _0x123a35=_0x4aca26?0x0:_0x1f0d53['offset'];var _0x3299a9=_0x4aca26?_0x2a76d1[_0x5ef1('0x21')]:_0x1f0d53['offset']+_0x1f0d53[_0x5ef1('0x20')];var _0x2c9122;if(_0x3299a9>=_0x39a04e){_0x3299a9=_0x39a04e;_0x2c9122=0xc8;}else{_0x2c9122=0xce;}_0x370885[_0x5ef1('0x1c')](_0x2c9122);return _0x370885[_0x5ef1('0x22')](_0x5ef1('0x23'),_0x123a35+'-'+_0x3299a9+'/'+_0x39a04e)[_0x5ef1('0x1d')](_0x2a76d1);}return null;};}function patchUpdates(_0x425d21){return function(_0x122e13){try{jsonpatch['apply'](_0x122e13,_0x425d21,!![]);}catch(_0x5eda4e){return BPromise[_0x5ef1('0x24')](_0x5eda4e);}return _0x122e13[_0x5ef1('0x25')]();};}function saveUpdates(_0x3af411,_0x2da5b0){return function(_0x440825){if(_0x440825){return _0x440825[_0x5ef1('0x26')](_0x3af411)[_0x5ef1('0x27')](function(_0x1ef6a2){return _0x1ef6a2;});}return null;};}function removeEntity(_0x4df1fc,_0x2ef64b){return function(_0x5145d3){if(_0x5145d3){return _0x5145d3[_0x5ef1('0x28')]()[_0x5ef1('0x27')](function(){_0x4df1fc[_0x5ef1('0x1c')](0xcc)[_0x5ef1('0x29')]();});}};}function handleEntityNotFound(_0x443417,_0x3b4082){return function(_0x2ef315){if(!_0x2ef315){_0x443417['sendStatus'](0x194);}return _0x2ef315;};}function handleError(_0x53cd87,_0x151a60){_0x151a60=_0x151a60||0x1f4;return function(_0x2b5c69){logger[_0x5ef1('0x2a')](_0x2b5c69[_0x5ef1('0x2b')]);if(_0x2b5c69[_0x5ef1('0x2c')]){delete _0x2b5c69[_0x5ef1('0x2c')];}_0x53cd87[_0x5ef1('0x1c')](_0x151a60)[_0x5ef1('0x2d')](_0x2b5c69);};}exports[_0x5ef1('0x2e')]=function(_0x310c6c,_0x85a703){var _0x30564e={},_0x456eb5={},_0x1b304b={'count':0x0,'rows':[]};var _0x2f0c2b=_[_0x5ef1('0x2f')](db['Dynamics365Configuration'][_0x5ef1('0x30')],function(_0x5ebddf){return{'name':_0x5ebddf[_0x5ef1('0x31')],'type':_0x5ebddf[_0x5ef1('0x32')][_0x5ef1('0x33')]};});_0x456eb5[_0x5ef1('0x34')]=_['map'](_0x2f0c2b,_0x5ef1('0x2c'));_0x456eb5[_0x5ef1('0x35')]=_[_0x5ef1('0x36')](_0x310c6c[_0x5ef1('0x35')]);_0x456eb5['filters']=_[_0x5ef1('0x37')](_0x456eb5[_0x5ef1('0x34')],_0x456eb5[_0x5ef1('0x35')]);_0x30564e[_0x5ef1('0x38')]=_[_0x5ef1('0x37')](_0x456eb5[_0x5ef1('0x34')],qs[_0x5ef1('0x39')](_0x310c6c[_0x5ef1('0x35')]['fields']));_0x30564e[_0x5ef1('0x38')]=_0x30564e[_0x5ef1('0x38')]['length']?_0x30564e['attributes']:_0x456eb5[_0x5ef1('0x34')];if(!_0x310c6c[_0x5ef1('0x35')]['hasOwnProperty']('nolimit')){_0x30564e[_0x5ef1('0x20')]=qs['limit'](_0x310c6c[_0x5ef1('0x35')][_0x5ef1('0x20')]);_0x30564e[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0x310c6c[_0x5ef1('0x35')][_0x5ef1('0x1e')]);}_0x30564e[_0x5ef1('0x3a')]=qs[_0x5ef1('0x3b')](_0x310c6c['query'][_0x5ef1('0x3b')]);_0x30564e['where']=qs[_0x5ef1('0x3c')](_[_0x5ef1('0x3d')](_0x310c6c[_0x5ef1('0x35')],_0x456eb5[_0x5ef1('0x3c')]),_0x2f0c2b);if(_0x310c6c[_0x5ef1('0x35')]['filter']){_0x30564e['where']=_[_0x5ef1('0x3e')](_0x30564e[_0x5ef1('0x3f')],{'$or':_['map'](_0x2f0c2b,function(_0x209138){if(_0x209138[_0x5ef1('0x32')]!==_0x5ef1('0x40')){var _0x432ce5={};_0x432ce5[_0x209138['name']]={'$like':'%'+_0x310c6c[_0x5ef1('0x35')][_0x5ef1('0x41')]+'%'};return _0x432ce5;}})});}_0x30564e=_[_0x5ef1('0x3e')]({},_0x30564e,_0x310c6c[_0x5ef1('0x42')]);var _0x385d03={'where':_0x30564e['where']};return db[_0x5ef1('0x43')]['count'](_0x385d03)[_0x5ef1('0x27')](function(_0x3ebab6){_0x1b304b['count']=_0x3ebab6;if(_0x310c6c[_0x5ef1('0x35')][_0x5ef1('0x44')]){_0x30564e[_0x5ef1('0x45')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x5ef1('0x46')](_0x30564e);})[_0x5ef1('0x27')](function(_0x1ec1fc){_0x1b304b[_0x5ef1('0x47')]=_0x1ec1fc;return _0x1b304b;})[_0x5ef1('0x27')](respondWithFilteredResult(_0x85a703,_0x30564e))[_0x5ef1('0x48')](handleError(_0x85a703,null));};exports[_0x5ef1('0x49')]=function(_0x350798,_0x2ed700){var _0x1c5367={'raw':![],'where':{'id':_0x350798[_0x5ef1('0x4a')]['id']}},_0x5ab0bf={};_0x5ab0bf['model']=_['keys'](db[_0x5ef1('0x43')][_0x5ef1('0x30')]);_0x5ab0bf['query']=_[_0x5ef1('0x36')](_0x350798['query']);_0x5ab0bf['filters']=_[_0x5ef1('0x37')](_0x5ab0bf[_0x5ef1('0x34')],_0x5ab0bf[_0x5ef1('0x35')]);_0x1c5367[_0x5ef1('0x38')]=_[_0x5ef1('0x37')](_0x5ab0bf[_0x5ef1('0x34')],qs[_0x5ef1('0x39')](_0x350798[_0x5ef1('0x35')][_0x5ef1('0x39')]));_0x1c5367[_0x5ef1('0x38')]=_0x1c5367[_0x5ef1('0x38')][_0x5ef1('0x4b')]?_0x1c5367[_0x5ef1('0x38')]:_0x5ab0bf[_0x5ef1('0x34')];if(_0x350798[_0x5ef1('0x35')][_0x5ef1('0x44')]){_0x1c5367[_0x5ef1('0x45')]=[{'all':!![]}];}_0x1c5367=_['merge']({},_0x1c5367,_0x350798[_0x5ef1('0x42')]);return db[_0x5ef1('0x43')][_0x5ef1('0x4c')](_0x1c5367)[_0x5ef1('0x27')](handleEntityNotFound(_0x2ed700,null))[_0x5ef1('0x27')](respondWithResult(_0x2ed700,null))[_0x5ef1('0x48')](handleError(_0x2ed700,null));};exports['create']=function(_0x3af1af,_0x5d6c66){return db[_0x5ef1('0x43')][_0x5ef1('0x4d')](_0x3af1af['body'],{})['then'](respondWithResult(_0x5d6c66,0xc9))[_0x5ef1('0x48')](handleError(_0x5d6c66,null));};exports[_0x5ef1('0x26')]=function(_0x2bb191,_0xa594f9){if(_0x2bb191[_0x5ef1('0x4e')]['id']){delete _0x2bb191[_0x5ef1('0x4e')]['id'];}return db[_0x5ef1('0x43')][_0x5ef1('0x4c')]({'where':{'id':_0x2bb191['params']['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0xa594f9,null))[_0x5ef1('0x27')](saveUpdates(_0x2bb191[_0x5ef1('0x4e')],null))[_0x5ef1('0x27')](respondWithResult(_0xa594f9,null))['catch'](handleError(_0xa594f9,null));};exports[_0x5ef1('0x28')]=function(_0x232fe8,_0x177f09){return db[_0x5ef1('0x43')][_0x5ef1('0x4c')]({'where':{'id':_0x232fe8[_0x5ef1('0x4a')]['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x177f09,null))[_0x5ef1('0x27')](removeEntity(_0x177f09,null))[_0x5ef1('0x48')](handleError(_0x177f09,null));};exports[_0x5ef1('0x4f')]=function(_0x2663af,_0x9963ec,_0x5449ab){var _0x5cda01={};var _0x272ce1={};var _0x4a7c88;var _0x2a9b30;return db[_0x5ef1('0x43')]['findOne']({'where':{'id':_0x2663af['params']['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x9963ec,null))[_0x5ef1('0x27')](function(_0x150183){if(_0x150183){_0x4a7c88=_0x150183;_0x272ce1[_0x5ef1('0x34')]=_[_0x5ef1('0x36')](db[_0x5ef1('0x50')][_0x5ef1('0x30')]);_0x272ce1[_0x5ef1('0x35')]=_['keys'](_0x2663af[_0x5ef1('0x35')]);_0x272ce1[_0x5ef1('0x3c')]=_[_0x5ef1('0x37')](_0x272ce1[_0x5ef1('0x34')],_0x272ce1[_0x5ef1('0x35')]);_0x5cda01[_0x5ef1('0x38')]=_['intersection'](_0x272ce1[_0x5ef1('0x34')],qs['fields'](_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x39')]));_0x5cda01[_0x5ef1('0x38')]=_0x5cda01[_0x5ef1('0x38')][_0x5ef1('0x4b')]?_0x5cda01[_0x5ef1('0x38')]:_0x272ce1[_0x5ef1('0x34')];_0x5cda01['order']=qs[_0x5ef1('0x3b')](_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x3b')]);_0x5cda01[_0x5ef1('0x3f')]=qs[_0x5ef1('0x3c')](_[_0x5ef1('0x3d')](_0x2663af['query'],_0x272ce1[_0x5ef1('0x3c')]));if(_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x41')]){_0x5cda01['where']=_[_0x5ef1('0x3e')](_0x5cda01[_0x5ef1('0x3f')],{'$or':_[_0x5ef1('0x2f')](_0x5cda01[_0x5ef1('0x38')],function(_0x18c5b8){var _0x18c012={};_0x18c012[_0x18c5b8]={'$like':'%'+_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x41')]+'%'};return _0x18c012;})});}_0x5cda01=_[_0x5ef1('0x3e')]({},_0x5cda01,_0x2663af[_0x5ef1('0x42')]);return _0x4a7c88[_0x5ef1('0x4f')](_0x5cda01);}})[_0x5ef1('0x27')](function(_0x1bbf6c){if(_0x1bbf6c){_0x2a9b30=_0x1bbf6c[_0x5ef1('0x4b')];if(!_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x51')](_0x5ef1('0x52'))){_0x5cda01[_0x5ef1('0x20')]=qs['limit'](_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x20')]);_0x5cda01[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0x2663af[_0x5ef1('0x35')][_0x5ef1('0x1e')]);}return _0x4a7c88['getFields'](_0x5cda01);}})[_0x5ef1('0x27')](function(_0x195403){if(_0x195403){return _0x195403?{'count':_0x2a9b30,'rows':_0x195403}:null;}})[_0x5ef1('0x27')](respondWithResult(_0x9963ec,null))[_0x5ef1('0x48')](handleError(_0x9963ec,null));};exports[_0x5ef1('0x53')]=function(_0xd3bddb,_0x5ab0a8,_0x275c63){var _0x2f5842={};var _0x1b3162={};var _0x2889c4;var _0x3bd68b;return db[_0x5ef1('0x43')][_0x5ef1('0x54')]({'where':{'id':_0xd3bddb[_0x5ef1('0x4a')]['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x5ab0a8,null))[_0x5ef1('0x27')](function(_0x57802b){if(_0x57802b){_0x2889c4=_0x57802b;_0x1b3162[_0x5ef1('0x34')]=_[_0x5ef1('0x36')](db['Dynamics365Field'][_0x5ef1('0x30')]);_0x1b3162[_0x5ef1('0x35')]=_[_0x5ef1('0x36')](_0xd3bddb['query']);_0x1b3162['filters']=_['intersection'](_0x1b3162['model'],_0x1b3162[_0x5ef1('0x35')]);_0x2f5842[_0x5ef1('0x38')]=_['intersection'](_0x1b3162[_0x5ef1('0x34')],qs[_0x5ef1('0x39')](_0xd3bddb[_0x5ef1('0x35')][_0x5ef1('0x39')]));_0x2f5842[_0x5ef1('0x38')]=_0x2f5842['attributes']['length']?_0x2f5842[_0x5ef1('0x38')]:_0x1b3162[_0x5ef1('0x34')];_0x2f5842[_0x5ef1('0x3a')]=qs[_0x5ef1('0x3b')](_0xd3bddb[_0x5ef1('0x35')][_0x5ef1('0x3b')]);_0x2f5842[_0x5ef1('0x3f')]=qs[_0x5ef1('0x3c')](_[_0x5ef1('0x3d')](_0xd3bddb[_0x5ef1('0x35')],_0x1b3162['filters']));if(_0xd3bddb[_0x5ef1('0x35')][_0x5ef1('0x41')]){_0x2f5842['where']=_['merge'](_0x2f5842[_0x5ef1('0x3f')],{'$or':_['map'](_0x2f5842['attributes'],function(_0x4d2b77){var _0x25686f={};_0x25686f[_0x4d2b77]={'$like':'%'+_0xd3bddb['query'][_0x5ef1('0x41')]+'%'};return _0x25686f;})});}_0x2f5842=_['merge']({},_0x2f5842,_0xd3bddb[_0x5ef1('0x42')]);return _0x2889c4[_0x5ef1('0x53')](_0x2f5842);}})[_0x5ef1('0x27')](function(_0x25433b){if(_0x25433b){_0x3bd68b=_0x25433b['length'];if(!_0xd3bddb[_0x5ef1('0x35')][_0x5ef1('0x51')](_0x5ef1('0x52'))){_0x2f5842[_0x5ef1('0x20')]=qs[_0x5ef1('0x20')](_0xd3bddb['query'][_0x5ef1('0x20')]);_0x2f5842[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0xd3bddb[_0x5ef1('0x35')][_0x5ef1('0x1e')]);}return _0x2889c4[_0x5ef1('0x53')](_0x2f5842);}})[_0x5ef1('0x27')](function(_0x2f52df){if(_0x2f52df){return _0x2f52df?{'count':_0x3bd68b,'rows':_0x2f52df}:null;}})[_0x5ef1('0x27')](respondWithResult(_0x5ab0a8,null))[_0x5ef1('0x48')](handleError(_0x5ab0a8,null));};exports[_0x5ef1('0x55')]=function(_0x5ed49e,_0x2dbdc1,_0x5d9ff5){var _0x269bf0={};var _0x4882b5={};var _0x5cc46c;var _0x117c3e;return db[_0x5ef1('0x43')][_0x5ef1('0x54')]({'where':{'id':_0x5ed49e[_0x5ef1('0x4a')]['id']}})[_0x5ef1('0x27')](handleEntityNotFound(_0x2dbdc1,null))['then'](function(_0x196bbe){if(_0x196bbe){_0x5cc46c=_0x196bbe;_0x4882b5['model']=_[_0x5ef1('0x36')](db['Dynamics365Field'][_0x5ef1('0x30')]);_0x4882b5[_0x5ef1('0x35')]=_[_0x5ef1('0x36')](_0x5ed49e[_0x5ef1('0x35')]);_0x4882b5['filters']=_[_0x5ef1('0x37')](_0x4882b5[_0x5ef1('0x34')],_0x4882b5['query']);_0x269bf0[_0x5ef1('0x38')]=_['intersection'](_0x4882b5[_0x5ef1('0x34')],qs[_0x5ef1('0x39')](_0x5ed49e[_0x5ef1('0x35')][_0x5ef1('0x39')]));_0x269bf0[_0x5ef1('0x38')]=_0x269bf0['attributes'][_0x5ef1('0x4b')]?_0x269bf0[_0x5ef1('0x38')]:_0x4882b5[_0x5ef1('0x34')];_0x269bf0['order']=qs[_0x5ef1('0x3b')](_0x5ed49e[_0x5ef1('0x35')][_0x5ef1('0x3b')]);_0x269bf0[_0x5ef1('0x3f')]=qs[_0x5ef1('0x3c')](_[_0x5ef1('0x3d')](_0x5ed49e[_0x5ef1('0x35')],_0x4882b5[_0x5ef1('0x3c')]));if(_0x5ed49e['query'][_0x5ef1('0x41')]){_0x269bf0['where']=_[_0x5ef1('0x3e')](_0x269bf0[_0x5ef1('0x3f')],{'$or':_[_0x5ef1('0x2f')](_0x269bf0[_0x5ef1('0x38')],function(_0x257ae6){var _0x2b62b4={};_0x2b62b4[_0x257ae6]={'$like':'%'+_0x5ed49e[_0x5ef1('0x35')][_0x5ef1('0x41')]+'%'};return _0x2b62b4;})});}_0x269bf0=_[_0x5ef1('0x3e')]({},_0x269bf0,_0x5ed49e[_0x5ef1('0x42')]);return _0x5cc46c[_0x5ef1('0x55')](_0x269bf0);}})[_0x5ef1('0x27')](function(_0xc78184){if(_0xc78184){_0x117c3e=_0xc78184[_0x5ef1('0x4b')];if(!_0x5ed49e['query']['hasOwnProperty'](_0x5ef1('0x52'))){_0x269bf0[_0x5ef1('0x20')]=qs['limit'](_0x5ed49e[_0x5ef1('0x35')]['limit']);_0x269bf0[_0x5ef1('0x1e')]=qs[_0x5ef1('0x1e')](_0x5ed49e[_0x5ef1('0x35')][_0x5ef1('0x1e')]);}return _0x5cc46c['getDescriptions'](_0x269bf0);}})[_0x5ef1('0x27')](function(_0x10ebae){if(_0x10ebae){return _0x10ebae?{'count':_0x117c3e,'rows':_0x10ebae}:null;}})[_0x5ef1('0x27')](respondWithResult(_0x2dbdc1,null))['catch'](handleError(_0x2dbdc1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0b2e6dd..9d9a583 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 _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0xb60c16,_0x1b66b0){var _0x1fc5ce=function(_0x103df8){while(--_0x103df8){_0xb60c16['push'](_0xb60c16['shift']());}};_0x1fc5ce(++_0x1b66b0);}(_0xa41a,0x6b));var _0xaa41=function(_0x1a74ee,_0x4cb5fe){_0x1a74ee=_0x1a74ee-0x0;var _0x166301=_0xa41a[_0x1a74ee];return _0x166301;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5e918d,_0x129f9e){var _0x4250f4=function(_0x13b980){while(--_0x13b980){_0x5e918d['push'](_0x5e918d['shift']());}};_0x4250f4(++_0x129f9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index ddb8616..01796dc 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 _0xacf1=['message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x451a1b,_0x4454c2){var _0xd6b180=function(_0x289556){while(--_0x289556){_0x451a1b['push'](_0x451a1b['shift']());}};_0xd6b180(++_0x4454c2);}(_0xacf1,0x80));var _0x1acf=function(_0x12022e,_0x116513){_0x12022e=_0x12022e-0x0;var _0x56752a=_0xacf1[_0x12022e];return _0x56752a;};'use strict';var _=require('lodash');var util=require(_0x1acf('0x0'));var moment=require(_0x1acf('0x1'));var BPromise=require(_0x1acf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1acf('0x3'));var db=require(_0x1acf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1acf('0x5'))('rpc');var config=require(_0x1acf('0x6'));var jayson=require(_0x1acf('0x7'));var client=jayson[_0x1acf('0x8')][_0x1acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10029a,_0x40ec49,_0x2159bb){return new BPromise(function(_0x1f34a7,_0x2396da){return client[_0x1acf('0xa')](_0x10029a,_0x2159bb)[_0x1acf('0xb')](function(_0x3d2df2){logger[_0x1acf('0xc')](_0x1acf('0xd'),_0x40ec49,'request\x20sent');logger[_0x1acf('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x40ec49,_0x1acf('0xf'),JSON[_0x1acf('0x10')](_0x3d2df2));if(_0x3d2df2[_0x1acf('0x11')]){if(_0x3d2df2['error'][_0x1acf('0x12')]===0x1f4){logger[_0x1acf('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x40ec49,_0x3d2df2[_0x1acf('0x11')][_0x1acf('0x13')]);return _0x2396da(_0x3d2df2['error'][_0x1acf('0x13')]);}logger[_0x1acf('0x11')](_0x1acf('0xd'),_0x40ec49,_0x3d2df2['error'][_0x1acf('0x13')]);return _0x1f34a7(_0x3d2df2[_0x1acf('0x11')]['message']);}else{logger['info'](_0x1acf('0xd'),_0x40ec49,_0x1acf('0xf'));_0x1f34a7(_0x3d2df2['result'][_0x1acf('0x13')]);}})[_0x1acf('0x14')](function(_0x5c092e){logger[_0x1acf('0x11')](_0x1acf('0xd'),_0x40ec49,_0x5c092e);_0x2396da(_0x5c092e);});});} \ No newline at end of file +var _0xa807=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../config/utils','rpc','http','request','then','info'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa807,0x1d2));var _0x7a80=function(_0x425f0c,_0x263b17){_0x425f0c=_0x425f0c-0x0;var _0x2b86c7=_0xa807[_0x425f0c];return _0x2b86c7;};'use strict';var _=require(_0x7a80('0x0'));var util=require(_0x7a80('0x1'));var moment=require(_0x7a80('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a80('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a80('0x4'));var logger=require('../../config/logger')(_0x7a80('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7a80('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3731b9,_0x11c262,_0x1e1411){return new BPromise(function(_0x574051,_0x206048){return client[_0x7a80('0x7')](_0x3731b9,_0x1e1411)[_0x7a80('0x8')](function(_0x37bedb){logger[_0x7a80('0x9')](_0x7a80('0xa'),_0x11c262,_0x7a80('0xb'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x11c262,_0x7a80('0xb'),JSON[_0x7a80('0xc')](_0x37bedb));if(_0x37bedb[_0x7a80('0xd')]){if(_0x37bedb['error'][_0x7a80('0xe')]===0x1f4){logger[_0x7a80('0xd')](_0x7a80('0xa'),_0x11c262,_0x37bedb[_0x7a80('0xd')][_0x7a80('0xf')]);return _0x206048(_0x37bedb[_0x7a80('0xd')][_0x7a80('0xf')]);}logger[_0x7a80('0xd')](_0x7a80('0xa'),_0x11c262,_0x37bedb[_0x7a80('0xd')]['message']);return _0x574051(_0x37bedb['error'][_0x7a80('0xf')]);}else{logger['info'](_0x7a80('0xa'),_0x11c262,'request\x20sent');_0x574051(_0x37bedb['result']['message']);}})[_0x7a80('0x10')](function(_0x2581fd){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x11c262,_0x2581fd);_0x206048(_0x2581fd);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3ad4749..ec5de4c 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 _0x3be4=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x1621dd,_0x172229){var _0x3b0046=function(_0x53ab32){while(--_0x53ab32){_0x1621dd['push'](_0x1621dd['shift']());}};_0x3b0046(++_0x172229);}(_0x3be4,0xff));var _0x43be=function(_0x1378d8,_0x70eabd){_0x1378d8=_0x1378d8-0x0;var _0x445476=_0x3be4[_0x1378d8];return _0x445476;};'use strict';var multer=require(_0x43be('0x0'));var util=require('util');var path=require(_0x43be('0x1'));var timeout=require(_0x43be('0x2'));var express=require(_0x43be('0x3'));var router=express[_0x43be('0x4')]();var fs_extra=require(_0x43be('0x5'));var auth=require(_0x43be('0x6'));var interaction=require(_0x43be('0x7'));var config=require(_0x43be('0x8'));var controller=require(_0x43be('0x9'));router[_0x43be('0xa')]('/',auth[_0x43be('0xb')](),controller['index']);router['get'](_0x43be('0xc'),auth[_0x43be('0xb')](),controller[_0x43be('0xd')]);router[_0x43be('0xe')]('/',auth['isAuthenticated'](),controller[_0x43be('0xf')]);router[_0x43be('0x10')](_0x43be('0xc'),auth[_0x43be('0xb')](),controller[_0x43be('0x11')]);router[_0x43be('0x12')]('/:id',auth[_0x43be('0xb')](),controller[_0x43be('0x13')]);module[_0x43be('0x14')]=router; \ No newline at end of file +var _0xcdf0=['show','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcdf0,0x112));var _0x0cdf=function(_0x4dd507,_0x18c725){_0x4dd507=_0x4dd507-0x0;var _0x1e774e=_0xcdf0[_0x4dd507];return _0x1e774e;};'use strict';var multer=require(_0x0cdf('0x0'));var util=require(_0x0cdf('0x1'));var path=require(_0x0cdf('0x2'));var timeout=require(_0x0cdf('0x3'));var express=require(_0x0cdf('0x4'));var router=express[_0x0cdf('0x5')]();var fs_extra=require(_0x0cdf('0x6'));var auth=require(_0x0cdf('0x7'));var interaction=require(_0x0cdf('0x8'));var config=require(_0x0cdf('0x9'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x0cdf('0xa')](),controller[_0x0cdf('0xb')]);router[_0x0cdf('0xc')](_0x0cdf('0xd'),auth[_0x0cdf('0xa')](),controller[_0x0cdf('0xe')]);router['post']('/',auth[_0x0cdf('0xa')](),controller['create']);router[_0x0cdf('0xf')](_0x0cdf('0xd'),auth[_0x0cdf('0xa')](),controller['update']);router[_0x0cdf('0x10')](_0x0cdf('0xd'),auth[_0x0cdf('0xa')](),controller['destroy']);module[_0x0cdf('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index baf8504..a09c2ed 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 _0xcf55=['customVariable','picklist','STRING','variable','BOOLEAN','exports','ENUM','string'];(function(_0x5cc8b9,_0xd5a591){var _0x1e7ec9=function(_0x3335af){while(--_0x3335af){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x1e7ec9(++_0xd5a591);}(_0xcf55,0x17d));var _0x5cf5=function(_0x1e65f8,_0x16bea1){_0x1e65f8=_0x1e65f8-0x0;var _0x252c63=_0xcf55[_0x1e65f8];return _0x252c63;};'use strict';var Sequelize=require('sequelize');module[_0x5cf5('0x0')]={'type':{'type':Sequelize[_0x5cf5('0x1')](_0x5cf5('0x2'),'variable',_0x5cf5('0x3'),'keyValue',_0x5cf5('0x4')),'defaultValue':_0x5cf5('0x2')},'content':{'type':Sequelize[_0x5cf5('0x5')]},'key':{'type':Sequelize[_0x5cf5('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x5cf5('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x5cf5('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5cf5('0x5')]},'customField':{'type':Sequelize[_0x5cf5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5cf5('0x5')]}}; \ No newline at end of file +var _0x72f7=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x5b9c9a,_0x1c1b96){var _0x58f5ae=function(_0x2bc336){while(--_0x2bc336){_0x5b9c9a['push'](_0x5b9c9a['shift']());}};_0x58f5ae(++_0x1c1b96);}(_0x72f7,0x10a));var _0x772f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x772f('0x0'));module[_0x772f('0x1')]={'type':{'type':Sequelize[_0x772f('0x2')](_0x772f('0x3'),_0x772f('0x4'),_0x772f('0x5'),_0x772f('0x6'),_0x772f('0x7')),'defaultValue':_0x772f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x772f('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x772f('0x3'),_0x772f('0x4'),_0x772f('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x772f('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x772f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index da21cae..bfd1519 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 _0x22d3=['fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','stack','name','index','map','Dynamics365Field'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x22d3,0x1cf));var _0x322d=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x22d3[_0x25662e];return _0x59b7bc;};'use strict';var emlformat=require(_0x322d('0x0'));var rimraf=require(_0x322d('0x1'));var zipdir=require(_0x322d('0x2'));var jsonpatch=require(_0x322d('0x3'));var rp=require('request-promise');var moment=require(_0x322d('0x4'));var BPromise=require(_0x322d('0x5'));var Mustache=require('mustache');var util=require(_0x322d('0x6'));var path=require('path');var sox=require(_0x322d('0x7'));var csv=require(_0x322d('0x8'));var ejs=require(_0x322d('0x9'));var fs=require('fs');var fs_extra=require(_0x322d('0xa'));var _=require(_0x322d('0xb'));var squel=require(_0x322d('0xc'));var crypto=require(_0x322d('0xd'));var jsforce=require(_0x322d('0xe'));var deskjs=require(_0x322d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x322d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x322d('0x11'));var qs=require(_0x322d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x322d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x322d('0x14'));var db=require(_0x322d('0x15'))['db'];function respondWithStatusCode(_0x5d4643,_0x1f4543){_0x1f4543=_0x1f4543||0xcc;return function(_0x3d07d6){if(_0x3d07d6){return _0x5d4643[_0x322d('0x16')](_0x1f4543);}return _0x5d4643[_0x322d('0x17')](_0x1f4543)['end']();};}function respondWithResult(_0x10f40e,_0x1d8000){_0x1d8000=_0x1d8000||0xc8;return function(_0x4899c2){if(_0x4899c2){return _0x10f40e[_0x322d('0x17')](_0x1d8000)['json'](_0x4899c2);}};}function respondWithFilteredResult(_0x584e76,_0xf25015){return function(_0x25ef2e){if(_0x25ef2e){var _0x365d84=typeof _0xf25015['offset']===_0x322d('0x18')&&typeof _0xf25015[_0x322d('0x19')]===_0x322d('0x18');var _0x412e37=_0x25ef2e[_0x322d('0x1a')];var _0x532ece=_0x365d84?0x0:_0xf25015['offset'];var _0x3ba6f6=_0x365d84?_0x25ef2e[_0x322d('0x1a')]:_0xf25015[_0x322d('0x1b')]+_0xf25015['limit'];var _0x4d69a6;if(_0x3ba6f6>=_0x412e37){_0x3ba6f6=_0x412e37;_0x4d69a6=0xc8;}else{_0x4d69a6=0xce;}_0x584e76[_0x322d('0x17')](_0x4d69a6);return _0x584e76[_0x322d('0x1c')](_0x322d('0x1d'),_0x532ece+'-'+_0x3ba6f6+'/'+_0x412e37)['json'](_0x25ef2e);}return null;};}function patchUpdates(_0x1e21d4){return function(_0x521e52){try{jsonpatch[_0x322d('0x1e')](_0x521e52,_0x1e21d4,!![]);}catch(_0x1a7322){return BPromise['reject'](_0x1a7322);}return _0x521e52['save']();};}function saveUpdates(_0x2f8d77,_0x2c6816){return function(_0x42ebc7){if(_0x42ebc7){return _0x42ebc7[_0x322d('0x1f')](_0x2f8d77)[_0x322d('0x20')](function(_0x388dee){return _0x388dee;});}return null;};}function removeEntity(_0x5641c1,_0x49703b){return function(_0x273d97){if(_0x273d97){return _0x273d97[_0x322d('0x21')]()['then'](function(){_0x5641c1['status'](0xcc)[_0x322d('0x22')]();});}};}function handleEntityNotFound(_0x29d80d,_0x4de7a0){return function(_0x4c117a){if(!_0x4c117a){_0x29d80d[_0x322d('0x16')](0x194);}return _0x4c117a;};}function handleError(_0x52c68b,_0x1bdecf){_0x1bdecf=_0x1bdecf||0x1f4;return function(_0x7d14b1){logger[_0x322d('0x23')](_0x7d14b1[_0x322d('0x24')]);if(_0x7d14b1[_0x322d('0x25')]){delete _0x7d14b1[_0x322d('0x25')];}_0x52c68b[_0x322d('0x17')](_0x1bdecf)['send'](_0x7d14b1);};}exports[_0x322d('0x26')]=function(_0x45006b,_0x1caa63){var _0x2079be={},_0x1a3de7={},_0x11d667={'count':0x0,'rows':[]};var _0x2a8d67=_[_0x322d('0x27')](db[_0x322d('0x28')]['rawAttributes'],function(_0x3f3560){return{'name':_0x3f3560[_0x322d('0x29')],'type':_0x3f3560[_0x322d('0x2a')][_0x322d('0x2b')]};});_0x1a3de7[_0x322d('0x2c')]=_[_0x322d('0x27')](_0x2a8d67,_0x322d('0x25'));_0x1a3de7['query']=_[_0x322d('0x2d')](_0x45006b['query']);_0x1a3de7['filters']=_[_0x322d('0x2e')](_0x1a3de7[_0x322d('0x2c')],_0x1a3de7[_0x322d('0x2f')]);_0x2079be[_0x322d('0x30')]=_[_0x322d('0x2e')](_0x1a3de7[_0x322d('0x2c')],qs[_0x322d('0x31')](_0x45006b['query'][_0x322d('0x31')]));_0x2079be[_0x322d('0x30')]=_0x2079be[_0x322d('0x30')][_0x322d('0x32')]?_0x2079be['attributes']:_0x1a3de7[_0x322d('0x2c')];if(!_0x45006b['query'][_0x322d('0x33')](_0x322d('0x34'))){_0x2079be['limit']=qs[_0x322d('0x19')](_0x45006b[_0x322d('0x2f')][_0x322d('0x19')]);_0x2079be[_0x322d('0x1b')]=qs[_0x322d('0x1b')](_0x45006b[_0x322d('0x2f')][_0x322d('0x1b')]);}_0x2079be[_0x322d('0x35')]=qs[_0x322d('0x36')](_0x45006b[_0x322d('0x2f')][_0x322d('0x36')]);_0x2079be[_0x322d('0x37')]=qs[_0x322d('0x38')](_[_0x322d('0x39')](_0x45006b[_0x322d('0x2f')],_0x1a3de7[_0x322d('0x38')]),_0x2a8d67);if(_0x45006b['query'][_0x322d('0x3a')]){_0x2079be[_0x322d('0x37')]=_[_0x322d('0x3b')](_0x2079be['where'],{'$or':_[_0x322d('0x27')](_0x2a8d67,function(_0xea874f){if(_0xea874f[_0x322d('0x2a')]!=='VIRTUAL'){var _0x805904={};_0x805904[_0xea874f[_0x322d('0x25')]]={'$like':'%'+_0x45006b[_0x322d('0x2f')]['filter']+'%'};return _0x805904;}})});}_0x2079be=_[_0x322d('0x3b')]({},_0x2079be,_0x45006b[_0x322d('0x3c')]);var _0x416614={'where':_0x2079be[_0x322d('0x37')]};return db[_0x322d('0x28')][_0x322d('0x1a')](_0x416614)[_0x322d('0x20')](function(_0x2556ee){_0x11d667['count']=_0x2556ee;if(_0x45006b[_0x322d('0x2f')][_0x322d('0x3d')]){_0x2079be['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x322d('0x3e')](_0x2079be);})[_0x322d('0x20')](function(_0x1ae763){_0x11d667[_0x322d('0x3f')]=_0x1ae763;return _0x11d667;})[_0x322d('0x20')](respondWithFilteredResult(_0x1caa63,_0x2079be))[_0x322d('0x40')](handleError(_0x1caa63,null));};exports[_0x322d('0x41')]=function(_0x38255e,_0x44ade7){var _0x28a30a={'raw':!![],'where':{'id':_0x38255e[_0x322d('0x42')]['id']}},_0x55a56a={};_0x55a56a[_0x322d('0x2c')]=_[_0x322d('0x2d')](db[_0x322d('0x28')][_0x322d('0x43')]);_0x55a56a['query']=_[_0x322d('0x2d')](_0x38255e['query']);_0x55a56a['filters']=_[_0x322d('0x2e')](_0x55a56a[_0x322d('0x2c')],_0x55a56a[_0x322d('0x2f')]);_0x28a30a['attributes']=_['intersection'](_0x55a56a[_0x322d('0x2c')],qs[_0x322d('0x31')](_0x38255e[_0x322d('0x2f')][_0x322d('0x31')]));_0x28a30a['attributes']=_0x28a30a[_0x322d('0x30')]['length']?_0x28a30a[_0x322d('0x30')]:_0x55a56a['model'];if(_0x38255e[_0x322d('0x2f')][_0x322d('0x3d')]){_0x28a30a[_0x322d('0x44')]=[{'all':!![]}];}_0x28a30a=_[_0x322d('0x3b')]({},_0x28a30a,_0x38255e[_0x322d('0x3c')]);return db[_0x322d('0x28')][_0x322d('0x45')](_0x28a30a)['then'](handleEntityNotFound(_0x44ade7,null))[_0x322d('0x20')](respondWithResult(_0x44ade7,null))[_0x322d('0x40')](handleError(_0x44ade7,null));};exports[_0x322d('0x46')]=function(_0x44a8d8,_0x2490ae){return db[_0x322d('0x28')]['create'](_0x44a8d8[_0x322d('0x47')],{})['then'](respondWithResult(_0x2490ae,0xc9))[_0x322d('0x40')](handleError(_0x2490ae,null));};exports[_0x322d('0x1f')]=function(_0x9088d3,_0x2a9d5b){if(_0x9088d3[_0x322d('0x47')]['id']){delete _0x9088d3['body']['id'];}return db[_0x322d('0x28')][_0x322d('0x45')]({'where':{'id':_0x9088d3[_0x322d('0x42')]['id']}})['then'](handleEntityNotFound(_0x2a9d5b,null))[_0x322d('0x20')](saveUpdates(_0x9088d3[_0x322d('0x47')],null))['then'](respondWithResult(_0x2a9d5b,null))[_0x322d('0x40')](handleError(_0x2a9d5b,null));};exports[_0x322d('0x21')]=function(_0x1e0b85,_0x5b37e0){return db[_0x322d('0x28')][_0x322d('0x45')]({'where':{'id':_0x1e0b85[_0x322d('0x42')]['id']}})[_0x322d('0x20')](handleEntityNotFound(_0x5b37e0,null))['then'](removeEntity(_0x5b37e0,null))['catch'](handleError(_0x5b37e0,null));}; \ No newline at end of file +var _0xd63f=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','keys','fields'];(function(_0x18e875,_0x54fff7){var _0x1643c6=function(_0x5f09ff){while(--_0x5f09ff){_0x18e875['push'](_0x18e875['shift']());}};_0x1643c6(++_0x54fff7);}(_0xd63f,0x1cd));var _0xfd63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd63f[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xfd63('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd63('0x1'));var jsonpatch=require(_0xfd63('0x2'));var rp=require(_0xfd63('0x3'));var moment=require('moment');var BPromise=require(_0xfd63('0x4'));var Mustache=require(_0xfd63('0x5'));var util=require(_0xfd63('0x6'));var path=require('path');var sox=require(_0xfd63('0x7'));var csv=require(_0xfd63('0x8'));var ejs=require(_0xfd63('0x9'));var fs=require('fs');var fs_extra=require(_0xfd63('0xa'));var _=require('lodash');var squel=require(_0xfd63('0xb'));var crypto=require(_0xfd63('0xc'));var jsforce=require(_0xfd63('0xd'));var deskjs=require(_0xfd63('0xe'));var toCsv=require(_0xfd63('0x8'));var querystring=require(_0xfd63('0xf'));var Papa=require(_0xfd63('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfd63('0x11'));var as=require(_0xfd63('0x12'));var hardwareService=require(_0xfd63('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfd63('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ca8e,_0x1488c0){_0x1488c0=_0x1488c0||0xcc;return function(_0x1efda8){if(_0x1efda8){return _0x40ca8e[_0xfd63('0x15')](_0x1488c0);}return _0x40ca8e[_0xfd63('0x16')](_0x1488c0)['end']();};}function respondWithResult(_0x386eb9,_0x192784){_0x192784=_0x192784||0xc8;return function(_0x568c8a){if(_0x568c8a){return _0x386eb9[_0xfd63('0x16')](_0x192784)['json'](_0x568c8a);}};}function respondWithFilteredResult(_0x17241c,_0x2a02fa){return function(_0xafa8ff){if(_0xafa8ff){var _0x4bd82f=typeof _0x2a02fa['offset']===_0xfd63('0x17')&&typeof _0x2a02fa[_0xfd63('0x18')]==='undefined';var _0x4b6202=_0xafa8ff[_0xfd63('0x19')];var _0x4145c9=_0x4bd82f?0x0:_0x2a02fa[_0xfd63('0x1a')];var _0x37b310=_0x4bd82f?_0xafa8ff[_0xfd63('0x19')]:_0x2a02fa[_0xfd63('0x1a')]+_0x2a02fa[_0xfd63('0x18')];var _0x18e065;if(_0x37b310>=_0x4b6202){_0x37b310=_0x4b6202;_0x18e065=0xc8;}else{_0x18e065=0xce;}_0x17241c[_0xfd63('0x16')](_0x18e065);return _0x17241c[_0xfd63('0x1b')](_0xfd63('0x1c'),_0x4145c9+'-'+_0x37b310+'/'+_0x4b6202)[_0xfd63('0x1d')](_0xafa8ff);}return null;};}function patchUpdates(_0x27360f){return function(_0x18dd5a){try{jsonpatch[_0xfd63('0x1e')](_0x18dd5a,_0x27360f,!![]);}catch(_0x1be043){return BPromise[_0xfd63('0x1f')](_0x1be043);}return _0x18dd5a[_0xfd63('0x20')]();};}function saveUpdates(_0x1fd4cf,_0x5ea409){return function(_0x12b67e){if(_0x12b67e){return _0x12b67e[_0xfd63('0x21')](_0x1fd4cf)[_0xfd63('0x22')](function(_0x353930){return _0x353930;});}return null;};}function removeEntity(_0xfb085a,_0x3828db){return function(_0x3a743a){if(_0x3a743a){return _0x3a743a[_0xfd63('0x23')]()[_0xfd63('0x22')](function(){_0xfb085a[_0xfd63('0x16')](0xcc)[_0xfd63('0x24')]();});}};}function handleEntityNotFound(_0x160c91,_0x268a7a){return function(_0x1bf0a4){if(!_0x1bf0a4){_0x160c91[_0xfd63('0x15')](0x194);}return _0x1bf0a4;};}function handleError(_0x3819b4,_0x50c28c){_0x50c28c=_0x50c28c||0x1f4;return function(_0x197bf5){logger['error'](_0x197bf5['stack']);if(_0x197bf5[_0xfd63('0x25')]){delete _0x197bf5['name'];}_0x3819b4[_0xfd63('0x16')](_0x50c28c)[_0xfd63('0x26')](_0x197bf5);};}exports[_0xfd63('0x27')]=function(_0x56263d,_0x3ed145){var _0x3865e7={},_0x3a91f7={},_0x18b1e8={'count':0x0,'rows':[]};var _0x1e0a32=_['map'](db[_0xfd63('0x28')][_0xfd63('0x29')],function(_0x13f297){return{'name':_0x13f297[_0xfd63('0x2a')],'type':_0x13f297[_0xfd63('0x2b')][_0xfd63('0x2c')]};});_0x3a91f7[_0xfd63('0x2d')]=_[_0xfd63('0x2e')](_0x1e0a32,_0xfd63('0x25'));_0x3a91f7[_0xfd63('0x2f')]=_[_0xfd63('0x30')](_0x56263d[_0xfd63('0x2f')]);_0x3a91f7['filters']=_['intersection'](_0x3a91f7[_0xfd63('0x2d')],_0x3a91f7['query']);_0x3865e7['attributes']=_['intersection'](_0x3a91f7[_0xfd63('0x2d')],qs[_0xfd63('0x31')](_0x56263d['query'][_0xfd63('0x31')]));_0x3865e7['attributes']=_0x3865e7[_0xfd63('0x32')][_0xfd63('0x33')]?_0x3865e7[_0xfd63('0x32')]:_0x3a91f7[_0xfd63('0x2d')];if(!_0x56263d[_0xfd63('0x2f')][_0xfd63('0x34')](_0xfd63('0x35'))){_0x3865e7[_0xfd63('0x18')]=qs['limit'](_0x56263d[_0xfd63('0x2f')][_0xfd63('0x18')]);_0x3865e7['offset']=qs[_0xfd63('0x1a')](_0x56263d[_0xfd63('0x2f')]['offset']);}_0x3865e7[_0xfd63('0x36')]=qs[_0xfd63('0x37')](_0x56263d[_0xfd63('0x2f')]['sort']);_0x3865e7[_0xfd63('0x38')]=qs['filters'](_[_0xfd63('0x39')](_0x56263d[_0xfd63('0x2f')],_0x3a91f7[_0xfd63('0x3a')]),_0x1e0a32);if(_0x56263d[_0xfd63('0x2f')][_0xfd63('0x3b')]){_0x3865e7[_0xfd63('0x38')]=_[_0xfd63('0x3c')](_0x3865e7[_0xfd63('0x38')],{'$or':_[_0xfd63('0x2e')](_0x1e0a32,function(_0x56c049){if(_0x56c049[_0xfd63('0x2b')]!=='VIRTUAL'){var _0x5b9c40={};_0x5b9c40[_0x56c049[_0xfd63('0x25')]]={'$like':'%'+_0x56263d['query'][_0xfd63('0x3b')]+'%'};return _0x5b9c40;}})});}_0x3865e7=_[_0xfd63('0x3c')]({},_0x3865e7,_0x56263d['options']);var _0x136f2b={'where':_0x3865e7[_0xfd63('0x38')]};return db[_0xfd63('0x28')][_0xfd63('0x19')](_0x136f2b)['then'](function(_0xaea07f){_0x18b1e8[_0xfd63('0x19')]=_0xaea07f;if(_0x56263d['query']['includeAll']){_0x3865e7[_0xfd63('0x3d')]=[{'all':!![]}];}return db[_0xfd63('0x28')][_0xfd63('0x3e')](_0x3865e7);})[_0xfd63('0x22')](function(_0xf8203c){_0x18b1e8[_0xfd63('0x3f')]=_0xf8203c;return _0x18b1e8;})[_0xfd63('0x22')](respondWithFilteredResult(_0x3ed145,_0x3865e7))[_0xfd63('0x40')](handleError(_0x3ed145,null));};exports[_0xfd63('0x41')]=function(_0x144877,_0x346e7d){var _0x1918ed={'raw':!![],'where':{'id':_0x144877[_0xfd63('0x42')]['id']}},_0x138dff={};_0x138dff['model']=_[_0xfd63('0x30')](db[_0xfd63('0x28')][_0xfd63('0x29')]);_0x138dff[_0xfd63('0x2f')]=_[_0xfd63('0x30')](_0x144877[_0xfd63('0x2f')]);_0x138dff['filters']=_[_0xfd63('0x43')](_0x138dff[_0xfd63('0x2d')],_0x138dff[_0xfd63('0x2f')]);_0x1918ed[_0xfd63('0x32')]=_[_0xfd63('0x43')](_0x138dff['model'],qs['fields'](_0x144877[_0xfd63('0x2f')]['fields']));_0x1918ed[_0xfd63('0x32')]=_0x1918ed['attributes'][_0xfd63('0x33')]?_0x1918ed[_0xfd63('0x32')]:_0x138dff[_0xfd63('0x2d')];if(_0x144877[_0xfd63('0x2f')][_0xfd63('0x44')]){_0x1918ed[_0xfd63('0x3d')]=[{'all':!![]}];}_0x1918ed=_[_0xfd63('0x3c')]({},_0x1918ed,_0x144877[_0xfd63('0x45')]);return db['Dynamics365Field'][_0xfd63('0x46')](_0x1918ed)[_0xfd63('0x22')](handleEntityNotFound(_0x346e7d,null))['then'](respondWithResult(_0x346e7d,null))[_0xfd63('0x40')](handleError(_0x346e7d,null));};exports[_0xfd63('0x47')]=function(_0x5cbea0,_0x1b3cd9){return db[_0xfd63('0x28')][_0xfd63('0x47')](_0x5cbea0[_0xfd63('0x48')],{})[_0xfd63('0x22')](respondWithResult(_0x1b3cd9,0xc9))['catch'](handleError(_0x1b3cd9,null));};exports['update']=function(_0x3b7da8,_0x4a7dad){if(_0x3b7da8[_0xfd63('0x48')]['id']){delete _0x3b7da8[_0xfd63('0x48')]['id'];}return db[_0xfd63('0x28')][_0xfd63('0x46')]({'where':{'id':_0x3b7da8[_0xfd63('0x42')]['id']}})[_0xfd63('0x22')](handleEntityNotFound(_0x4a7dad,null))[_0xfd63('0x22')](saveUpdates(_0x3b7da8[_0xfd63('0x48')],null))['then'](respondWithResult(_0x4a7dad,null))[_0xfd63('0x40')](handleError(_0x4a7dad,null));};exports[_0xfd63('0x23')]=function(_0x3534d5,_0x2c9275){return db[_0xfd63('0x28')][_0xfd63('0x46')]({'where':{'id':_0x3534d5[_0xfd63('0x42')]['id']}})[_0xfd63('0x22')](handleEntityNotFound(_0x2c9275,null))['then'](removeEntity(_0x2c9275,null))[_0xfd63('0x40')](handleError(_0x2c9275,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b01bf20..9b5ac0a 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 _0x7f77=['int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x7f77,0x184));var _0x77f7=function(_0x4cbf80,_0x39ec88){_0x4cbf80=_0x4cbf80-0x0;var _0x5f5b2d=_0x7f77[_0x4cbf80];return _0x5f5b2d;};'use strict';var _=require(_0x77f7('0x0'));var util=require(_0x77f7('0x1'));var logger=require(_0x77f7('0x2'))(_0x77f7('0x3'));var moment=require(_0x77f7('0x4'));var BPromise=require(_0x77f7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x77f7('0x6'));var rimraf=require(_0x77f7('0x7'));var config=require(_0x77f7('0x8'));var attributes=require(_0x77f7('0x9'));module['exports']=function(_0x3ea24d,_0x397644){return _0x3ea24d[_0x77f7('0xa')](_0x77f7('0xb'),attributes,{'tableName':_0x77f7('0xc'),'paranoid':![],'indexes':[{'name':_0x77f7('0xd'),'fields':[_0x77f7('0xe'),_0x77f7('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f10=['./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1b5f00,_0x29f4f0){var _0x388e51=function(_0x412423){while(--_0x412423){_0x1b5f00['push'](_0x1b5f00['shift']());}};_0x388e51(++_0x29f4f0);}(_0x2f10,0x75));var _0x02f1=function(_0x42f13d,_0x3491bf){_0x42f13d=_0x42f13d-0x0;var _0xcfc728=_0x2f10[_0x42f13d];return _0xcfc728;};'use strict';var _=require(_0x02f1('0x0'));var util=require(_0x02f1('0x1'));var logger=require(_0x02f1('0x2'))(_0x02f1('0x3'));var moment=require(_0x02f1('0x4'));var BPromise=require(_0x02f1('0x5'));var rp=require(_0x02f1('0x6'));var fs=require('fs');var path=require(_0x02f1('0x7'));var rimraf=require('rimraf');var config=require(_0x02f1('0x8'));var attributes=require(_0x02f1('0x9'));module['exports']=function(_0x565260,_0x4a6751){return _0x565260[_0x02f1('0xa')](_0x02f1('0xb'),attributes,{'tableName':_0x02f1('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x02f1('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 7b6f3fc..15e3eb5 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 _0xd04c=['jayson/promise','http','request','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment'];(function(_0x4155ad,_0x4c8505){var _0xea4564=function(_0x15487c){while(--_0x15487c){_0x4155ad['push'](_0x4155ad['shift']());}};_0xea4564(++_0x4c8505);}(_0xd04c,0xe0));var _0xcd04=function(_0x263a1e,_0x2f2b48){_0x263a1e=_0x263a1e-0x0;var _0x23efe0=_0xd04c[_0x263a1e];return _0x23efe0;};'use strict';var _=require(_0xcd04('0x0'));var util=require(_0xcd04('0x1'));var moment=require(_0xcd04('0x2'));var BPromise=require(_0xcd04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcd04('0x4'));var logger=require('../../config/logger')(_0xcd04('0x5'));var config=require(_0xcd04('0x6'));var jayson=require(_0xcd04('0x7'));var client=jayson['client'][_0xcd04('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5953d7,_0x43a73d,_0x171ab0){return new BPromise(function(_0xc43f23,_0x3856e0){return client[_0xcd04('0x9')](_0x5953d7,_0x171ab0)[_0xcd04('0xa')](function(_0x3d95c0){logger['info'](_0xcd04('0xb'),_0x43a73d,'request\x20sent');logger[_0xcd04('0xc')](_0xcd04('0xd'),_0x43a73d,_0xcd04('0xe'),JSON[_0xcd04('0xf')](_0x3d95c0));if(_0x3d95c0['error']){if(_0x3d95c0[_0xcd04('0x10')][_0xcd04('0x11')]===0x1f4){logger['error'](_0xcd04('0xb'),_0x43a73d,_0x3d95c0[_0xcd04('0x10')]['message']);return _0x3856e0(_0x3d95c0[_0xcd04('0x10')][_0xcd04('0x12')]);}logger[_0xcd04('0x10')](_0xcd04('0xb'),_0x43a73d,_0x3d95c0[_0xcd04('0x10')][_0xcd04('0x12')]);return _0xc43f23(_0x3d95c0['error'][_0xcd04('0x12')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x43a73d,'request\x20sent');_0xc43f23(_0x3d95c0[_0xcd04('0x13')][_0xcd04('0x12')]);}})[_0xcd04('0x14')](function(_0x163f66){logger[_0xcd04('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x43a73d,_0x163f66);_0x3856e0(_0x163f66);});});} \ No newline at end of file +var _0x9d50=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x410f37,_0x942067){var _0x28df57=function(_0x376a10){while(--_0x376a10){_0x410f37['push'](_0x410f37['shift']());}};_0x28df57(++_0x942067);}(_0x9d50,0x1e4));var _0x09d5=function(_0x3d7106,_0x476083){_0x3d7106=_0x3d7106-0x0;var _0x3c99e7=_0x9d50[_0x3d7106];return _0x3c99e7;};'use strict';var _=require(_0x09d5('0x0'));var util=require(_0x09d5('0x1'));var moment=require(_0x09d5('0x2'));var BPromise=require(_0x09d5('0x3'));var rs=require(_0x09d5('0x4'));var fs=require('fs');var Redis=require(_0x09d5('0x5'));var db=require(_0x09d5('0x6'))['db'];var utils=require(_0x09d5('0x7'));var logger=require(_0x09d5('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x09d5('0x9'));var client=jayson['client'][_0x09d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d1fa1,_0x4094db,_0x34ff55){return new BPromise(function(_0x4c36ea,_0x320f0f){return client[_0x09d5('0xb')](_0x5d1fa1,_0x34ff55)[_0x09d5('0xc')](function(_0x130aa7){logger[_0x09d5('0xd')](_0x09d5('0xe'),_0x4094db,_0x09d5('0xf'));logger[_0x09d5('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4094db,_0x09d5('0xf'),JSON['stringify'](_0x130aa7));if(_0x130aa7['error']){if(_0x130aa7[_0x09d5('0x11')][_0x09d5('0x12')]===0x1f4){logger[_0x09d5('0x11')](_0x09d5('0xe'),_0x4094db,_0x130aa7['error'][_0x09d5('0x13')]);return _0x320f0f(_0x130aa7['error'][_0x09d5('0x13')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4094db,_0x130aa7['error'][_0x09d5('0x13')]);return _0x4c36ea(_0x130aa7[_0x09d5('0x11')][_0x09d5('0x13')]);}else{logger[_0x09d5('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x4094db,_0x09d5('0xf'));_0x4c36ea(_0x130aa7[_0x09d5('0x14')][_0x09d5('0x13')]);}})[_0x09d5('0x15')](function(_0xcb3c8){logger['error'](_0x09d5('0xe'),_0x4094db,_0xcb3c8);_0x320f0f(_0xcb3c8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a8283a0..7855f3c 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 _0xf460=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete'];(function(_0x7e918f,_0x48cf10){var _0x5b35ab=function(_0x1455be){while(--_0x1455be){_0x7e918f['push'](_0x7e918f['shift']());}};_0x5b35ab(++_0x48cf10);}(_0xf460,0x135));var _0x0f46=function(_0x3cb45d,_0x4c73d1){_0x3cb45d=_0x3cb45d-0x0;var _0x18e8aa=_0xf460[_0x3cb45d];return _0x18e8aa;};'use strict';var multer=require(_0x0f46('0x0'));var util=require(_0x0f46('0x1'));var path=require(_0x0f46('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f46('0x3'));var router=express[_0x0f46('0x4')]();var fs_extra=require(_0x0f46('0x5'));var auth=require(_0x0f46('0x6'));var interaction=require(_0x0f46('0x7'));var config=require('../../config/environment');var controller=require(_0x0f46('0x8'));router[_0x0f46('0x9')]('/',auth[_0x0f46('0xa')](),controller[_0x0f46('0xb')]);router[_0x0f46('0x9')]('/:id',auth[_0x0f46('0xa')](),controller['show']);router[_0x0f46('0x9')](_0x0f46('0xc'),auth['isAuthenticated'](),controller[_0x0f46('0xd')]);router[_0x0f46('0x9')](_0x0f46('0xe'),auth['isAuthenticated'](),controller[_0x0f46('0xf')]);router['post']('/',auth[_0x0f46('0xa')](),controller[_0x0f46('0x10')]);router['post'](_0x0f46('0xc'),auth['isAuthenticated'](),controller[_0x0f46('0x11')]);router[_0x0f46('0x12')]('/:id',auth[_0x0f46('0xa')](),controller[_0x0f46('0x13')]);router[_0x0f46('0x14')]('/:id',auth[_0x0f46('0xa')](),controller['destroy']);module[_0x0f46('0x15')]=router; \ No newline at end of file +var _0x7a98=['getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x34217f,_0x4954d9){var _0x533721=function(_0x5ea689){while(--_0x5ea689){_0x34217f['push'](_0x34217f['shift']());}};_0x533721(++_0x4954d9);}(_0x7a98,0x135));var _0x87a9=function(_0x971d66,_0xb27281){_0x971d66=_0x971d66-0x0;var _0x33882e=_0x7a98[_0x971d66];return _0x33882e;};'use strict';var multer=require(_0x87a9('0x0'));var util=require(_0x87a9('0x1'));var path=require(_0x87a9('0x2'));var timeout=require(_0x87a9('0x3'));var express=require(_0x87a9('0x4'));var router=express[_0x87a9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x87a9('0x6'));var config=require(_0x87a9('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x87a9('0x8')]('/',auth['isAuthenticated'](),controller[_0x87a9('0x9')]);router['get'](_0x87a9('0xa'),auth[_0x87a9('0xb')](),controller[_0x87a9('0xc')]);router[_0x87a9('0x8')](_0x87a9('0xd'),auth[_0x87a9('0xb')](),controller[_0x87a9('0xe')]);router[_0x87a9('0x8')](_0x87a9('0xf'),auth[_0x87a9('0xb')](),controller[_0x87a9('0x10')]);router['post']('/',auth[_0x87a9('0xb')](),controller[_0x87a9('0x11')]);router[_0x87a9('0x12')]('/:id/configurations',auth[_0x87a9('0xb')](),controller[_0x87a9('0x13')]);router[_0x87a9('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x87a9('0x15')]);router[_0x87a9('0x16')](_0x87a9('0xa'),auth[_0x87a9('0xb')](),controller[_0x87a9('0x17')]);module[_0x87a9('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 71bfa17..e6c2228 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 _0x3423=['username','remoteUri','STRING'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3342('0x0')]},'description':{'type':Sequelize[_0x3342('0x0')]},'username':{'type':Sequelize[_0x3342('0x0')],'unique':_0x3342('0x1')},'apiKey':{'type':Sequelize[_0x3342('0x0')]},'remoteUri':{'type':Sequelize[_0x3342('0x0')],'unique':_0x3342('0x2')},'serverUrl':{'type':Sequelize[_0x3342('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xed3c=['STRING','username','sequelize','exports'];(function(_0x3d38a6,_0xa7bd3c){var _0x34ad7f=function(_0xe474fc){while(--_0xe474fc){_0x3d38a6['push'](_0x3d38a6['shift']());}};_0x34ad7f(++_0xa7bd3c);}(_0xed3c,0x1a6));var _0xced3=function(_0x122cc1,_0x5c956e){_0x122cc1=_0x122cc1-0x0;var _0x1e33af=_0xed3c[_0x122cc1];return _0x1e33af;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'name':{'type':Sequelize[_0xced3('0x2')]},'description':{'type':Sequelize[_0xced3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xced3('0x3')},'apiKey':{'type':Sequelize[_0xced3('0x2')]},'remoteUri':{'type':Sequelize[_0xced3('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index c614e49..0f57838 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 _0xd1f1=['subject','agent','description','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','pick','filter','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64','requester'];(function(_0x4f19ba,_0x2e73d2){var _0x1cf423=function(_0x1d1a3c){while(--_0x1d1a3c){_0x4f19ba['push'](_0x4f19ba['shift']());}};_0x1cf423(++_0x2e73d2);}(_0xd1f1,0x84));var _0x1d1f=function(_0x43af80,_0x1a300e){_0x43af80=_0x43af80-0x0;var _0x26c0ea=_0xd1f1[_0x43af80];return _0x26c0ea;};'use strict';var emlformat=require(_0x1d1f('0x0'));var rimraf=require(_0x1d1f('0x1'));var zipdir=require(_0x1d1f('0x2'));var jsonpatch=require(_0x1d1f('0x3'));var rp=require(_0x1d1f('0x4'));var moment=require('moment');var BPromise=require(_0x1d1f('0x5'));var Mustache=require(_0x1d1f('0x6'));var util=require(_0x1d1f('0x7'));var path=require('path');var sox=require(_0x1d1f('0x8'));var csv=require(_0x1d1f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d1f('0xa'));var _=require('lodash');var squel=require(_0x1d1f('0xb'));var crypto=require(_0x1d1f('0xc'));var jsforce=require(_0x1d1f('0xd'));var deskjs=require(_0x1d1f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1d1f('0xf'));var authService=require(_0x1d1f('0x10'));var qs=require(_0x1d1f('0x11'));var as=require(_0x1d1f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d1f('0x13'))(_0x1d1f('0x14'));var utils=require(_0x1d1f('0x15'));var config=require(_0x1d1f('0x16'));var licenseUtil=require(_0x1d1f('0x17'));var db=require(_0x1d1f('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4c92c1,_0x48e2c0){_0x48e2c0=_0x48e2c0||0xcc;return function(_0x3e6316){if(_0x3e6316){return _0x4c92c1[_0x1d1f('0x19')](_0x48e2c0);}return _0x4c92c1[_0x1d1f('0x1a')](_0x48e2c0)[_0x1d1f('0x1b')]();};}function respondWithResult(_0x43e323,_0x465f20){_0x465f20=_0x465f20||0xc8;return function(_0x2dbbe6){if(_0x2dbbe6){return _0x43e323[_0x1d1f('0x1a')](_0x465f20)[_0x1d1f('0x1c')](_0x2dbbe6);}};}function respondWithFilteredResult(_0x37af18,_0x2ec931){return function(_0x397f74){if(_0x397f74){var _0x1d4c4d=typeof _0x2ec931['offset']===_0x1d1f('0x1d')&&typeof _0x2ec931[_0x1d1f('0x1e')]===_0x1d1f('0x1d');var _0x184ef3=_0x397f74[_0x1d1f('0x1f')];var _0x37a8e8=_0x1d4c4d?0x0:_0x2ec931[_0x1d1f('0x20')];var _0x308fdb=_0x1d4c4d?_0x397f74[_0x1d1f('0x1f')]:_0x2ec931[_0x1d1f('0x20')]+_0x2ec931[_0x1d1f('0x1e')];var _0x22b68d;if(_0x308fdb>=_0x184ef3){_0x308fdb=_0x184ef3;_0x22b68d=0xc8;}else{_0x22b68d=0xce;}_0x37af18[_0x1d1f('0x1a')](_0x22b68d);return _0x37af18[_0x1d1f('0x21')](_0x1d1f('0x22'),_0x37a8e8+'-'+_0x308fdb+'/'+_0x184ef3)[_0x1d1f('0x1c')](_0x397f74);}return null;};}function patchUpdates(_0x2dac03){return function(_0x16d0bd){try{jsonpatch[_0x1d1f('0x23')](_0x16d0bd,_0x2dac03,!![]);}catch(_0x542821){return BPromise[_0x1d1f('0x24')](_0x542821);}return _0x16d0bd[_0x1d1f('0x25')]();};}function saveUpdates(_0x4f1947,_0x18f05b){return function(_0x450f32){if(_0x450f32){return _0x450f32[_0x1d1f('0x26')](_0x4f1947)[_0x1d1f('0x27')](function(_0xbd591a){return _0xbd591a;});}return null;};}function removeEntity(_0x45cd59,_0x5aae81){return function(_0xbaa0cd){if(_0xbaa0cd){return _0xbaa0cd[_0x1d1f('0x28')]()[_0x1d1f('0x27')](function(){_0x45cd59[_0x1d1f('0x1a')](0xcc)[_0x1d1f('0x1b')]();});}};}function handleEntityNotFound(_0x571ad3,_0x43a03a){return function(_0x293b54){if(!_0x293b54){_0x571ad3['sendStatus'](0x194);}return _0x293b54;};}function handleError(_0x4ec531,_0x4030b0){_0x4030b0=_0x4030b0||0x1f4;return function(_0x1af624){logger[_0x1d1f('0x29')](_0x1af624[_0x1d1f('0x2a')]);if(_0x1af624['name']){delete _0x1af624['name'];}_0x4ec531[_0x1d1f('0x1a')](_0x4030b0)[_0x1d1f('0x2b')](_0x1af624);};}exports[_0x1d1f('0x2c')]=function(_0x1dcac6,_0x285c98){var _0x44e3c1={},_0x5efc5c={},_0x559f20={'count':0x0,'rows':[]};var _0x4a2c75=_[_0x1d1f('0x2d')](db[_0x1d1f('0x2e')][_0x1d1f('0x2f')],function(_0x4dcdd2){return{'name':_0x4dcdd2[_0x1d1f('0x30')],'type':_0x4dcdd2[_0x1d1f('0x31')]['key']};});_0x5efc5c[_0x1d1f('0x32')]=_[_0x1d1f('0x2d')](_0x4a2c75,_0x1d1f('0x33'));_0x5efc5c[_0x1d1f('0x34')]=_[_0x1d1f('0x35')](_0x1dcac6[_0x1d1f('0x34')]);_0x5efc5c[_0x1d1f('0x36')]=_[_0x1d1f('0x37')](_0x5efc5c[_0x1d1f('0x32')],_0x5efc5c[_0x1d1f('0x34')]);_0x44e3c1[_0x1d1f('0x38')]=_[_0x1d1f('0x37')](_0x5efc5c[_0x1d1f('0x32')],qs[_0x1d1f('0x39')](_0x1dcac6[_0x1d1f('0x34')][_0x1d1f('0x39')]));_0x44e3c1[_0x1d1f('0x38')]=_0x44e3c1[_0x1d1f('0x38')][_0x1d1f('0x3a')]?_0x44e3c1[_0x1d1f('0x38')]:_0x5efc5c[_0x1d1f('0x32')];if(!_0x1dcac6[_0x1d1f('0x34')][_0x1d1f('0x3b')]('nolimit')){_0x44e3c1[_0x1d1f('0x1e')]=qs[_0x1d1f('0x1e')](_0x1dcac6[_0x1d1f('0x34')][_0x1d1f('0x1e')]);_0x44e3c1['offset']=qs['offset'](_0x1dcac6[_0x1d1f('0x34')][_0x1d1f('0x20')]);}_0x44e3c1[_0x1d1f('0x3c')]=qs[_0x1d1f('0x3d')](_0x1dcac6[_0x1d1f('0x34')][_0x1d1f('0x3d')]);_0x44e3c1['where']=qs[_0x1d1f('0x36')](_['pick'](_0x1dcac6['query'],_0x5efc5c[_0x1d1f('0x36')]),_0x4a2c75);if(_0x1dcac6[_0x1d1f('0x34')]['filter']){_0x44e3c1[_0x1d1f('0x3e')]=_[_0x1d1f('0x3f')](_0x44e3c1[_0x1d1f('0x3e')],{'$or':_['map'](_0x4a2c75,function(_0x114bf7){if(_0x114bf7['type']!==_0x1d1f('0x40')){var _0x55c16e={};_0x55c16e[_0x114bf7[_0x1d1f('0x33')]]={'$like':'%'+_0x1dcac6[_0x1d1f('0x34')]['filter']+'%'};return _0x55c16e;}})});}_0x44e3c1=_[_0x1d1f('0x3f')]({},_0x44e3c1,_0x1dcac6[_0x1d1f('0x41')]);var _0x46b3aa={'where':_0x44e3c1[_0x1d1f('0x3e')]};return db[_0x1d1f('0x2e')][_0x1d1f('0x1f')](_0x46b3aa)[_0x1d1f('0x27')](function(_0x4e9a2b){_0x559f20[_0x1d1f('0x1f')]=_0x4e9a2b;if(_0x1dcac6[_0x1d1f('0x34')][_0x1d1f('0x42')]){_0x44e3c1['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x1d1f('0x43')](_0x44e3c1);})[_0x1d1f('0x27')](function(_0x27b502){_0x559f20['rows']=_0x27b502;return _0x559f20;})[_0x1d1f('0x27')](respondWithFilteredResult(_0x285c98,_0x44e3c1))[_0x1d1f('0x44')](handleError(_0x285c98,null));};exports[_0x1d1f('0x45')]=function(_0x4a11a7,_0x366511){var _0x208c9c={'raw':![],'where':{'id':_0x4a11a7[_0x1d1f('0x46')]['id']}},_0xc64a={};_0xc64a[_0x1d1f('0x32')]=_[_0x1d1f('0x35')](db[_0x1d1f('0x2e')][_0x1d1f('0x2f')]);_0xc64a[_0x1d1f('0x34')]=_[_0x1d1f('0x35')](_0x4a11a7[_0x1d1f('0x34')]);_0xc64a[_0x1d1f('0x36')]=_[_0x1d1f('0x37')](_0xc64a[_0x1d1f('0x32')],_0xc64a[_0x1d1f('0x34')]);_0x208c9c['attributes']=_[_0x1d1f('0x37')](_0xc64a[_0x1d1f('0x32')],qs['fields'](_0x4a11a7[_0x1d1f('0x34')][_0x1d1f('0x39')]));_0x208c9c['attributes']=_0x208c9c[_0x1d1f('0x38')][_0x1d1f('0x3a')]?_0x208c9c[_0x1d1f('0x38')]:_0xc64a[_0x1d1f('0x32')];if(_0x4a11a7[_0x1d1f('0x34')][_0x1d1f('0x42')]){_0x208c9c[_0x1d1f('0x47')]=[{'all':!![]}];}_0x208c9c=_[_0x1d1f('0x3f')]({},_0x208c9c,_0x4a11a7[_0x1d1f('0x41')]);return db['FreshdeskAccount'][_0x1d1f('0x48')](_0x208c9c)['then'](handleEntityNotFound(_0x366511,null))['then'](respondWithResult(_0x366511,null))[_0x1d1f('0x44')](handleError(_0x366511,null));};exports['create']=function(_0x51ccee,_0x3bcb5d){return db[_0x1d1f('0x2e')][_0x1d1f('0x49')](_0x51ccee[_0x1d1f('0x4a')],{})['then'](respondWithResult(_0x3bcb5d,0xc9))[_0x1d1f('0x44')](handleError(_0x3bcb5d,null));};exports['update']=function(_0x44a2db,_0x2f8af1){if(_0x44a2db['body']['id']){delete _0x44a2db[_0x1d1f('0x4a')]['id'];}return db[_0x1d1f('0x2e')][_0x1d1f('0x48')]({'where':{'id':_0x44a2db[_0x1d1f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f8af1,null))[_0x1d1f('0x27')](saveUpdates(_0x44a2db[_0x1d1f('0x4a')],null))[_0x1d1f('0x27')](respondWithResult(_0x2f8af1,null))[_0x1d1f('0x44')](handleError(_0x2f8af1,null));};exports[_0x1d1f('0x28')]=function(_0x5cb6e2,_0x246068){return db[_0x1d1f('0x2e')][_0x1d1f('0x48')]({'where':{'id':_0x5cb6e2[_0x1d1f('0x46')]['id']}})[_0x1d1f('0x27')](handleEntityNotFound(_0x246068,null))['then'](removeEntity(_0x246068,null))[_0x1d1f('0x44')](handleError(_0x246068,null));};exports[_0x1d1f('0x4b')]=function(_0x8fff2d,_0x430ef4,_0x1ea0d1){var _0x39fd17={};var _0x24ad15={};var _0x454af6;var _0x53c86c;return db[_0x1d1f('0x2e')][_0x1d1f('0x4c')]({'where':{'id':_0x8fff2d['params']['id']}})[_0x1d1f('0x27')](handleEntityNotFound(_0x430ef4,null))[_0x1d1f('0x27')](function(_0x2199d2){if(_0x2199d2){_0x454af6=_0x2199d2;_0x24ad15[_0x1d1f('0x32')]=_[_0x1d1f('0x35')](db[_0x1d1f('0x4d')][_0x1d1f('0x2f')]);_0x24ad15[_0x1d1f('0x34')]=_[_0x1d1f('0x35')](_0x8fff2d['query']);_0x24ad15[_0x1d1f('0x36')]=_[_0x1d1f('0x37')](_0x24ad15[_0x1d1f('0x32')],_0x24ad15[_0x1d1f('0x34')]);_0x39fd17[_0x1d1f('0x38')]=_[_0x1d1f('0x37')](_0x24ad15[_0x1d1f('0x32')],qs[_0x1d1f('0x39')](_0x8fff2d[_0x1d1f('0x34')][_0x1d1f('0x39')]));_0x39fd17[_0x1d1f('0x38')]=_0x39fd17[_0x1d1f('0x38')][_0x1d1f('0x3a')]?_0x39fd17['attributes']:_0x24ad15[_0x1d1f('0x32')];_0x39fd17['order']=qs[_0x1d1f('0x3d')](_0x8fff2d['query'][_0x1d1f('0x3d')]);_0x39fd17[_0x1d1f('0x3e')]=qs[_0x1d1f('0x36')](_[_0x1d1f('0x4e')](_0x8fff2d['query'],_0x24ad15[_0x1d1f('0x36')]));if(_0x8fff2d[_0x1d1f('0x34')][_0x1d1f('0x4f')]){_0x39fd17[_0x1d1f('0x3e')]=_[_0x1d1f('0x3f')](_0x39fd17[_0x1d1f('0x3e')],{'$or':_[_0x1d1f('0x2d')](_0x39fd17[_0x1d1f('0x38')],function(_0x54f9cc){var _0x1ba309={};_0x1ba309[_0x54f9cc]={'$like':'%'+_0x8fff2d[_0x1d1f('0x34')][_0x1d1f('0x4f')]+'%'};return _0x1ba309;})});}_0x39fd17=_['merge']({},_0x39fd17,_0x8fff2d['options']);return _0x454af6[_0x1d1f('0x4b')](_0x39fd17);}})[_0x1d1f('0x27')](function(_0x1c5cdf){if(_0x1c5cdf){_0x53c86c=_0x1c5cdf[_0x1d1f('0x3a')];if(!_0x8fff2d[_0x1d1f('0x34')][_0x1d1f('0x3b')]('nolimit')){_0x39fd17[_0x1d1f('0x1e')]=qs[_0x1d1f('0x1e')](_0x8fff2d[_0x1d1f('0x34')]['limit']);_0x39fd17[_0x1d1f('0x20')]=qs['offset'](_0x8fff2d['query'][_0x1d1f('0x20')]);}return _0x454af6[_0x1d1f('0x4b')](_0x39fd17);}})[_0x1d1f('0x27')](function(_0x3d13c5){if(_0x3d13c5){return _0x3d13c5?{'count':_0x53c86c,'rows':_0x3d13c5}:null;}})['then'](respondWithResult(_0x430ef4,null))[_0x1d1f('0x44')](handleError(_0x430ef4,null));};exports[_0x1d1f('0x50')]=function(_0x5cfc5e,_0x431c8e,_0x4b3725){if(_0x5cfc5e[_0x1d1f('0x4a')]['id']){delete _0x5cfc5e[_0x1d1f('0x4a')]['id'];}return db[_0x1d1f('0x2e')][_0x1d1f('0x4c')]({'where':{'id':_0x5cfc5e[_0x1d1f('0x46')]['id']}})[_0x1d1f('0x27')](handleEntityNotFound(_0x431c8e,null))[_0x1d1f('0x27')](function(_0x2406f5){if(_0x2406f5){_0x5cfc5e[_0x1d1f('0x4a')][_0x1d1f('0x51')]=_0x2406f5['id'];_0x5cfc5e[_0x1d1f('0x4a')]['Subjects']=integrations['getSubjects'](_0x5cfc5e[_0x1d1f('0x4a')][_0x1d1f('0x52')],_0x5cfc5e['body'][_0x1d1f('0x31')]);_0x5cfc5e[_0x1d1f('0x4a')][_0x1d1f('0x53')]=integrations[_0x1d1f('0x54')](_0x5cfc5e['body'][_0x1d1f('0x52')],_0x5cfc5e[_0x1d1f('0x4a')][_0x1d1f('0x31')]);return db[_0x1d1f('0x4d')][_0x1d1f('0x49')](_0x5cfc5e[_0x1d1f('0x4a')],{'include':[{'model':db[_0x1d1f('0x55')],'as':'Subjects'},{'model':db[_0x1d1f('0x55')],'as':_0x1d1f('0x53')}]});}return null;})[_0x1d1f('0x27')](respondWithResult(_0x431c8e,null))[_0x1d1f('0x44')](handleError(_0x431c8e,null));};exports['getFields']=function(_0x5b400f,_0x94d836,_0x3a15d3){var _0xc79235='';return db[_0x1d1f('0x2e')][_0x1d1f('0x4c')]({'where':{'id':_0x5b400f[_0x1d1f('0x46')]['id']},'attributes':['id',_0x1d1f('0x56'),_0x1d1f('0x57')]})[_0x1d1f('0x27')](handleEntityNotFound(_0x94d836,null))[_0x1d1f('0x27')](function(_0x268daa){if(_0x268daa){_0xc79235=_0x268daa['remoteUri'];var _0x5a8fa3=_0xc79235[_0x1d1f('0x58')](-0x1);if(_0x5a8fa3==='/'){_0xc79235=_0xc79235[_0x1d1f('0x59')](0x0,_0xc79235[_0x1d1f('0x5a')](_0x5a8fa3));}return rp({'method':_0x1d1f('0x5b'),'uri':util['format'](_0x1d1f('0x5c'),_0xc79235,_0x1d1f('0x5d')),'headers':{'Authorization':util[_0x1d1f('0x5e')](_0x1d1f('0x5f'),new Buffer(util['format'](_0x1d1f('0x60'),_0x268daa[_0x1d1f('0x57')]))[_0x1d1f('0x61')](_0x1d1f('0x62')))},'json':!![]});}})[_0x1d1f('0x27')](function(_0x1d3483){if(_0x1d3483){var _0x416ce4=[_0x1d1f('0x63'),_0x1d1f('0x64'),_0x1d1f('0x65'),_0x1d1f('0x66'),_0x1d1f('0x1a'),'priority','group','source',_0x1d1f('0x67'),'group',_0x1d1f('0x68')];_['remove'](_0x1d3483,function(_0x4a0076){return _0x416ce4[_0x1d1f('0x69')](_0x4a0076[_0x1d1f('0x33')])||!_0x4a0076[_0x1d1f('0x6a')]&&_0x4a0076[_0x1d1f('0x31')]!==_0x1d1f('0x6b')&&_0x4a0076[_0x1d1f('0x31')]!==_0x1d1f('0x6c');});return{'count':_0x1d3483[_0x1d1f('0x3a')],'rows':_[_0x1d1f('0x2d')](_0x1d3483,function(_0x3c90e1){return{'id':_0x3c90e1['name'],'name':_0x3c90e1[_0x1d1f('0x6d')],'custom':!_0x3c90e1[_0x1d1f('0x6a')],'options':_0x3c90e1['choices']?_['map'](_0x3c90e1[_0x1d1f('0x6e')],function(_0xf546a7){return{'name':_[_0x1d1f('0x6f')](_0xf546a7),'value':_0xf546a7};}):[]};})};}})[_0x1d1f('0x27')](respondWithResult(_0x94d836,null))[_0x1d1f('0x44')](function(_0x2565db){var _0x3b0765=_0x5b400f[_0x1d1f('0x34')][_0x1d1f('0x70')]?0x1f4:_0x2565db[_0x1d1f('0x71')]||0x1f4;logger[_0x1d1f('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x1d1f('0x72'),_0x3b0765,JSON[_0x1d1f('0x73')](_0x2565db));delete _0x2565db['name'];if(_0x3b0765===0x191){_0x3b0765=0x190;}_0x94d836[_0x1d1f('0x1a')](_0x3b0765)[_0x1d1f('0x2b')](_0x5b400f['query'][_0x1d1f('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x2565db[_0x1d1f('0x71')]}:_0x2565db);});}; \ No newline at end of file +var _0x43c8=['hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','FreshdeskConfiguration','length','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','api/v2/ticket_fields','%s:X','toString','requester','subject','description','priority','group','ticket_type','remove','includes','custom_text','custom_dropdown','label','default','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x180464,_0x5a01ec){var _0x2715ea=function(_0x460267){while(--_0x460267){_0x180464['push'](_0x180464['shift']());}};_0x2715ea(++_0x5a01ec);}(_0x43c8,0xaf));var _0x843c=function(_0x29c975,_0x5c6fb1){_0x29c975=_0x29c975-0x0;var _0x1221f3=_0x43c8[_0x29c975];return _0x1221f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x843c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x843c('0x1'));var rp=require(_0x843c('0x2'));var moment=require(_0x843c('0x3'));var BPromise=require(_0x843c('0x4'));var Mustache=require(_0x843c('0x5'));var util=require(_0x843c('0x6'));var path=require(_0x843c('0x7'));var sox=require('sox');var csv=require(_0x843c('0x8'));var ejs=require(_0x843c('0x9'));var fs=require('fs');var fs_extra=require(_0x843c('0xa'));var _=require(_0x843c('0xb'));var squel=require(_0x843c('0xc'));var crypto=require('crypto');var jsforce=require(_0x843c('0xd'));var deskjs=require(_0x843c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x843c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x843c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x843c('0x11'));var hardwareService=require(_0x843c('0x12'));var logger=require(_0x843c('0x13'))(_0x843c('0x14'));var utils=require('../../config/utils');var config=require(_0x843c('0x15'));var licenseUtil=require(_0x843c('0x16'));var db=require(_0x843c('0x17'))['db'];var integrations=require(_0x843c('0x18'));function respondWithStatusCode(_0x231ce1,_0x34e297){_0x34e297=_0x34e297||0xcc;return function(_0x33ff2c){if(_0x33ff2c){return _0x231ce1[_0x843c('0x19')](_0x34e297);}return _0x231ce1[_0x843c('0x1a')](_0x34e297)[_0x843c('0x1b')]();};}function respondWithResult(_0x313947,_0x36e07f){_0x36e07f=_0x36e07f||0xc8;return function(_0x2ad766){if(_0x2ad766){return _0x313947[_0x843c('0x1a')](_0x36e07f)[_0x843c('0x1c')](_0x2ad766);}};}function respondWithFilteredResult(_0x5577ff,_0x3dc50d){return function(_0x2c013c){if(_0x2c013c){var _0x1d92cf=typeof _0x3dc50d[_0x843c('0x1d')]===_0x843c('0x1e')&&typeof _0x3dc50d['limit']===_0x843c('0x1e');var _0x807f83=_0x2c013c[_0x843c('0x1f')];var _0x2acf94=_0x1d92cf?0x0:_0x3dc50d['offset'];var _0xf53b50=_0x1d92cf?_0x2c013c[_0x843c('0x1f')]:_0x3dc50d[_0x843c('0x1d')]+_0x3dc50d[_0x843c('0x20')];var _0x1db871;if(_0xf53b50>=_0x807f83){_0xf53b50=_0x807f83;_0x1db871=0xc8;}else{_0x1db871=0xce;}_0x5577ff['status'](_0x1db871);return _0x5577ff[_0x843c('0x21')]('Content-Range',_0x2acf94+'-'+_0xf53b50+'/'+_0x807f83)[_0x843c('0x1c')](_0x2c013c);}return null;};}function patchUpdates(_0x5eb8ca){return function(_0x3422a3){try{jsonpatch[_0x843c('0x22')](_0x3422a3,_0x5eb8ca,!![]);}catch(_0x526946){return BPromise[_0x843c('0x23')](_0x526946);}return _0x3422a3[_0x843c('0x24')]();};}function saveUpdates(_0x2d1d43,_0x15513d){return function(_0x495927){if(_0x495927){return _0x495927['update'](_0x2d1d43)['then'](function(_0x3f914b){return _0x3f914b;});}return null;};}function removeEntity(_0x17e6ab,_0x2d90f9){return function(_0x408bf1){if(_0x408bf1){return _0x408bf1[_0x843c('0x25')]()[_0x843c('0x26')](function(){_0x17e6ab[_0x843c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4584be,_0x2a8c56){return function(_0x1a6a52){if(!_0x1a6a52){_0x4584be['sendStatus'](0x194);}return _0x1a6a52;};}function handleError(_0x2a34d2,_0x5caa13){_0x5caa13=_0x5caa13||0x1f4;return function(_0x15863a){logger[_0x843c('0x27')](_0x15863a[_0x843c('0x28')]);if(_0x15863a['name']){delete _0x15863a[_0x843c('0x29')];}_0x2a34d2[_0x843c('0x1a')](_0x5caa13)[_0x843c('0x2a')](_0x15863a);};}exports[_0x843c('0x2b')]=function(_0x8473bb,_0xb8b544){var _0x4e2a13={},_0xff406d={},_0x4d23bd={'count':0x0,'rows':[]};var _0x3855fb=_[_0x843c('0x2c')](db[_0x843c('0x2d')][_0x843c('0x2e')],function(_0x51aebb){return{'name':_0x51aebb[_0x843c('0x2f')],'type':_0x51aebb[_0x843c('0x30')][_0x843c('0x31')]};});_0xff406d[_0x843c('0x32')]=_[_0x843c('0x2c')](_0x3855fb,_0x843c('0x29'));_0xff406d[_0x843c('0x33')]=_[_0x843c('0x34')](_0x8473bb[_0x843c('0x33')]);_0xff406d[_0x843c('0x35')]=_[_0x843c('0x36')](_0xff406d[_0x843c('0x32')],_0xff406d['query']);_0x4e2a13[_0x843c('0x37')]=_['intersection'](_0xff406d[_0x843c('0x32')],qs[_0x843c('0x38')](_0x8473bb['query'][_0x843c('0x38')]));_0x4e2a13[_0x843c('0x37')]=_0x4e2a13[_0x843c('0x37')]['length']?_0x4e2a13[_0x843c('0x37')]:_0xff406d[_0x843c('0x32')];if(!_0x8473bb['query'][_0x843c('0x39')]('nolimit')){_0x4e2a13[_0x843c('0x20')]=qs[_0x843c('0x20')](_0x8473bb[_0x843c('0x33')]['limit']);_0x4e2a13[_0x843c('0x1d')]=qs[_0x843c('0x1d')](_0x8473bb[_0x843c('0x33')][_0x843c('0x1d')]);}_0x4e2a13[_0x843c('0x3a')]=qs['sort'](_0x8473bb[_0x843c('0x33')][_0x843c('0x3b')]);_0x4e2a13[_0x843c('0x3c')]=qs[_0x843c('0x35')](_[_0x843c('0x3d')](_0x8473bb[_0x843c('0x33')],_0xff406d['filters']),_0x3855fb);if(_0x8473bb[_0x843c('0x33')][_0x843c('0x3e')]){_0x4e2a13[_0x843c('0x3c')]=_[_0x843c('0x3f')](_0x4e2a13[_0x843c('0x3c')],{'$or':_[_0x843c('0x2c')](_0x3855fb,function(_0x2f36f7){if(_0x2f36f7['type']!=='VIRTUAL'){var _0xab253={};_0xab253[_0x2f36f7[_0x843c('0x29')]]={'$like':'%'+_0x8473bb[_0x843c('0x33')]['filter']+'%'};return _0xab253;}})});}_0x4e2a13=_[_0x843c('0x3f')]({},_0x4e2a13,_0x8473bb[_0x843c('0x40')]);var _0x1b29f7={'where':_0x4e2a13[_0x843c('0x3c')]};return db[_0x843c('0x2d')]['count'](_0x1b29f7)[_0x843c('0x26')](function(_0x1204ac){_0x4d23bd[_0x843c('0x1f')]=_0x1204ac;if(_0x8473bb[_0x843c('0x33')][_0x843c('0x41')]){_0x4e2a13[_0x843c('0x42')]=[{'all':!![]}];}return db[_0x843c('0x2d')][_0x843c('0x43')](_0x4e2a13);})[_0x843c('0x26')](function(_0x1c3600){_0x4d23bd[_0x843c('0x44')]=_0x1c3600;return _0x4d23bd;})[_0x843c('0x26')](respondWithFilteredResult(_0xb8b544,_0x4e2a13))[_0x843c('0x45')](handleError(_0xb8b544,null));};exports[_0x843c('0x46')]=function(_0x33243a,_0x4c8115){var _0x49de5c={'raw':![],'where':{'id':_0x33243a[_0x843c('0x47')]['id']}},_0x4c25a6={};_0x4c25a6['model']=_[_0x843c('0x34')](db[_0x843c('0x2d')]['rawAttributes']);_0x4c25a6[_0x843c('0x33')]=_['keys'](_0x33243a['query']);_0x4c25a6['filters']=_[_0x843c('0x36')](_0x4c25a6['model'],_0x4c25a6[_0x843c('0x33')]);_0x49de5c[_0x843c('0x37')]=_['intersection'](_0x4c25a6['model'],qs[_0x843c('0x38')](_0x33243a[_0x843c('0x33')][_0x843c('0x38')]));_0x49de5c[_0x843c('0x37')]=_0x49de5c[_0x843c('0x37')]['length']?_0x49de5c[_0x843c('0x37')]:_0x4c25a6['model'];if(_0x33243a[_0x843c('0x33')][_0x843c('0x41')]){_0x49de5c[_0x843c('0x42')]=[{'all':!![]}];}_0x49de5c=_[_0x843c('0x3f')]({},_0x49de5c,_0x33243a[_0x843c('0x40')]);return db[_0x843c('0x2d')][_0x843c('0x48')](_0x49de5c)[_0x843c('0x26')](handleEntityNotFound(_0x4c8115,null))[_0x843c('0x26')](respondWithResult(_0x4c8115,null))[_0x843c('0x45')](handleError(_0x4c8115,null));};exports[_0x843c('0x49')]=function(_0x41f9fa,_0x306394){return db[_0x843c('0x2d')][_0x843c('0x49')](_0x41f9fa[_0x843c('0x4a')],{})[_0x843c('0x26')](respondWithResult(_0x306394,0xc9))['catch'](handleError(_0x306394,null));};exports[_0x843c('0x4b')]=function(_0x189a9e,_0x11bb2d){if(_0x189a9e[_0x843c('0x4a')]['id']){delete _0x189a9e[_0x843c('0x4a')]['id'];}return db['FreshdeskAccount'][_0x843c('0x48')]({'where':{'id':_0x189a9e['params']['id']}})[_0x843c('0x26')](handleEntityNotFound(_0x11bb2d,null))['then'](saveUpdates(_0x189a9e[_0x843c('0x4a')],null))[_0x843c('0x26')](respondWithResult(_0x11bb2d,null))[_0x843c('0x45')](handleError(_0x11bb2d,null));};exports[_0x843c('0x25')]=function(_0x1603ea,_0x2236d1){return db[_0x843c('0x2d')][_0x843c('0x48')]({'where':{'id':_0x1603ea[_0x843c('0x47')]['id']}})[_0x843c('0x26')](handleEntityNotFound(_0x2236d1,null))['then'](removeEntity(_0x2236d1,null))[_0x843c('0x45')](handleError(_0x2236d1,null));};exports[_0x843c('0x4c')]=function(_0x1e6802,_0x28bbb7,_0x1628ae){var _0x1f7f5d={};var _0x3da0f7={};var _0x428884;var _0x29fe16;return db[_0x843c('0x2d')]['findOne']({'where':{'id':_0x1e6802[_0x843c('0x47')]['id']}})[_0x843c('0x26')](handleEntityNotFound(_0x28bbb7,null))[_0x843c('0x26')](function(_0x5b0e18){if(_0x5b0e18){_0x428884=_0x5b0e18;_0x3da0f7[_0x843c('0x32')]=_[_0x843c('0x34')](db[_0x843c('0x4d')][_0x843c('0x2e')]);_0x3da0f7[_0x843c('0x33')]=_[_0x843c('0x34')](_0x1e6802[_0x843c('0x33')]);_0x3da0f7[_0x843c('0x35')]=_['intersection'](_0x3da0f7['model'],_0x3da0f7[_0x843c('0x33')]);_0x1f7f5d[_0x843c('0x37')]=_[_0x843c('0x36')](_0x3da0f7['model'],qs[_0x843c('0x38')](_0x1e6802[_0x843c('0x33')][_0x843c('0x38')]));_0x1f7f5d[_0x843c('0x37')]=_0x1f7f5d[_0x843c('0x37')]['length']?_0x1f7f5d[_0x843c('0x37')]:_0x3da0f7['model'];_0x1f7f5d[_0x843c('0x3a')]=qs[_0x843c('0x3b')](_0x1e6802[_0x843c('0x33')][_0x843c('0x3b')]);_0x1f7f5d[_0x843c('0x3c')]=qs['filters'](_[_0x843c('0x3d')](_0x1e6802['query'],_0x3da0f7[_0x843c('0x35')]));if(_0x1e6802[_0x843c('0x33')]['filter']){_0x1f7f5d[_0x843c('0x3c')]=_[_0x843c('0x3f')](_0x1f7f5d[_0x843c('0x3c')],{'$or':_[_0x843c('0x2c')](_0x1f7f5d[_0x843c('0x37')],function(_0xcb8c8){var _0x1e4073={};_0x1e4073[_0xcb8c8]={'$like':'%'+_0x1e6802[_0x843c('0x33')][_0x843c('0x3e')]+'%'};return _0x1e4073;})});}_0x1f7f5d=_['merge']({},_0x1f7f5d,_0x1e6802[_0x843c('0x40')]);return _0x428884[_0x843c('0x4c')](_0x1f7f5d);}})['then'](function(_0x327032){if(_0x327032){_0x29fe16=_0x327032[_0x843c('0x4e')];if(!_0x1e6802['query'][_0x843c('0x39')](_0x843c('0x4f'))){_0x1f7f5d[_0x843c('0x20')]=qs['limit'](_0x1e6802['query'][_0x843c('0x20')]);_0x1f7f5d['offset']=qs[_0x843c('0x1d')](_0x1e6802[_0x843c('0x33')][_0x843c('0x1d')]);}return _0x428884[_0x843c('0x4c')](_0x1f7f5d);}})[_0x843c('0x26')](function(_0x31a4c5){if(_0x31a4c5){return _0x31a4c5?{'count':_0x29fe16,'rows':_0x31a4c5}:null;}})[_0x843c('0x26')](respondWithResult(_0x28bbb7,null))[_0x843c('0x45')](handleError(_0x28bbb7,null));};exports[_0x843c('0x50')]=function(_0x5e43bf,_0x1bd68f,_0x5e4880){if(_0x5e43bf[_0x843c('0x4a')]['id']){delete _0x5e43bf['body']['id'];}return db[_0x843c('0x2d')][_0x843c('0x51')]({'where':{'id':_0x5e43bf[_0x843c('0x47')]['id']}})[_0x843c('0x26')](handleEntityNotFound(_0x1bd68f,null))['then'](function(_0xbf1c81){if(_0xbf1c81){_0x5e43bf[_0x843c('0x4a')][_0x843c('0x52')]=_0xbf1c81['id'];_0x5e43bf['body'][_0x843c('0x53')]=integrations[_0x843c('0x54')](_0x5e43bf[_0x843c('0x4a')][_0x843c('0x55')],_0x5e43bf['body'][_0x843c('0x30')]);_0x5e43bf[_0x843c('0x4a')]['Descriptions']=integrations[_0x843c('0x56')](_0x5e43bf['body'][_0x843c('0x55')],_0x5e43bf[_0x843c('0x4a')][_0x843c('0x30')]);return db['FreshdeskConfiguration'][_0x843c('0x49')](_0x5e43bf['body'],{'include':[{'model':db[_0x843c('0x57')],'as':_0x843c('0x53')},{'model':db[_0x843c('0x57')],'as':_0x843c('0x58')}]});}return null;})[_0x843c('0x26')](respondWithResult(_0x1bd68f,null))[_0x843c('0x45')](handleError(_0x1bd68f,null));};exports[_0x843c('0x59')]=function(_0x3a8572,_0x42c84f,_0x6779d1){var _0xfc619a='';return db[_0x843c('0x2d')][_0x843c('0x51')]({'where':{'id':_0x3a8572[_0x843c('0x47')]['id']},'attributes':['id',_0x843c('0x5a'),_0x843c('0x5b')]})[_0x843c('0x26')](handleEntityNotFound(_0x42c84f,null))[_0x843c('0x26')](function(_0x10b90e){if(_0x10b90e){_0xfc619a=_0x10b90e[_0x843c('0x5a')];var _0x3add11=_0xfc619a[_0x843c('0x5c')](-0x1);if(_0x3add11==='/'){_0xfc619a=_0xfc619a[_0x843c('0x5d')](0x0,_0xfc619a['lastIndexOf'](_0x3add11));}return rp({'method':_0x843c('0x5e'),'uri':util['format'](_0x843c('0x5f'),_0xfc619a,_0x843c('0x60')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x843c('0x61'),_0x10b90e[_0x843c('0x5b')]))[_0x843c('0x62')]('base64'))},'json':!![]});}})[_0x843c('0x26')](function(_0x1e27b8){if(_0x1e27b8){var _0x55922=[_0x843c('0x63'),_0x843c('0x64'),'agent',_0x843c('0x65'),_0x843c('0x1a'),_0x843c('0x66'),_0x843c('0x67'),'source',_0x843c('0x68'),'group','company'];_[_0x843c('0x69')](_0x1e27b8,function(_0x124db5){return _0x55922[_0x843c('0x6a')](_0x124db5[_0x843c('0x29')])||!_0x124db5['default']&&_0x124db5['type']!==_0x843c('0x6b')&&_0x124db5[_0x843c('0x30')]!==_0x843c('0x6c');});return{'count':_0x1e27b8[_0x843c('0x4e')],'rows':_[_0x843c('0x2c')](_0x1e27b8,function(_0x17295a){return{'id':_0x17295a[_0x843c('0x29')],'name':_0x17295a[_0x843c('0x6d')],'custom':!_0x17295a[_0x843c('0x6e')],'options':_0x17295a[_0x843c('0x6f')]?_[_0x843c('0x2c')](_0x17295a[_0x843c('0x6f')],function(_0x3722a6){return{'name':_[_0x843c('0x70')](_0x3722a6),'value':_0x3722a6};}):[]};})};}})[_0x843c('0x26')](respondWithResult(_0x42c84f,null))[_0x843c('0x45')](function(_0x159b57){var _0x1c5177=_0x3a8572[_0x843c('0x33')]['test']?0x1f4:_0x159b57['statusCode']||0x1f4;logger[_0x843c('0x27')](_0x843c('0x71'),_0x843c('0x59'),_0x1c5177,JSON['stringify'](_0x159b57));delete _0x159b57['name'];if(_0x1c5177===0x191){_0x1c5177=0x190;}_0x42c84f['status'](_0x1c5177)[_0x843c('0x2a')](_0x3a8572[_0x843c('0x33')][_0x843c('0x72')]?{'message':_0x843c('0x73'),'statusCode':_0x159b57['statusCode']}:_0x159b57);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index a4efac9..14a0eb1 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 _0xc1c0=['api','bluebird','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xc1c0,0x19f));var _0x0c1c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1c0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0c1c('0x0'));var util=require(_0x0c1c('0x1'));var logger=require(_0x0c1c('0x2'))(_0x0c1c('0x3'));var moment=require('moment');var BPromise=require(_0x0c1c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0c1c('0x5'));var config=require(_0x0c1c('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x0c1c('0x7'));module['exports']=function(_0x380e6d,_0x3360cf){return _0x380e6d[_0x0c1c('0x8')](_0x0c1c('0x9'),attributes,{'tableName':_0x0c1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f7e=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','../../config/logger','api','moment'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x4f7e,0x99));var _0xe4f7=function(_0x468485,_0x3bcc02){_0x468485=_0x468485-0x0;var _0x1e4f9f=_0x4f7e[_0x468485];return _0x1e4f9f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe4f7('0x0'))(_0xe4f7('0x1'));var moment=require(_0xe4f7('0x2'));var BPromise=require(_0xe4f7('0x3'));var rp=require(_0xe4f7('0x4'));var fs=require('fs');var path=require(_0xe4f7('0x5'));var rimraf=require(_0xe4f7('0x6'));var config=require(_0xe4f7('0x7'));var attributes=require(_0xe4f7('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xe4f7('0x9')]=function(_0x448fc0,_0x2a1c25){return _0x448fc0[_0xe4f7('0xa')](_0xe4f7('0xb'),attributes,{'tableName':_0xe4f7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 88ec33c..33ded1c 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 _0x4351=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFreshdeskAccount','find','ShowFreshdeskAccount','lodash','moment'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0x4351,0xb2));var _0x1435=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x4351[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x1435('0x0'));var util=require('util');var moment=require(_0x1435('0x1'));var BPromise=require(_0x1435('0x2'));var rs=require(_0x1435('0x3'));var fs=require('fs');var Redis=require(_0x1435('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1435('0x5'));var logger=require(_0x1435('0x6'))(_0x1435('0x7'));var config=require('../../config/environment');var jayson=require(_0x1435('0x8'));var client=jayson['client'][_0x1435('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29c0ab,_0x3fb4a1,_0x1ab498){return new BPromise(function(_0x24059b,_0x13860a){return client[_0x1435('0xa')](_0x29c0ab,_0x1ab498)[_0x1435('0xb')](function(_0xf367d4){logger[_0x1435('0xc')](_0x1435('0xd'),_0x3fb4a1,_0x1435('0xe'));logger[_0x1435('0xf')](_0x1435('0x10'),_0x3fb4a1,_0x1435('0xe'),JSON[_0x1435('0x11')](_0xf367d4));if(_0xf367d4[_0x1435('0x12')]){if(_0xf367d4[_0x1435('0x12')][_0x1435('0x13')]===0x1f4){logger['error'](_0x1435('0xd'),_0x3fb4a1,_0xf367d4[_0x1435('0x12')]['message']);return _0x13860a(_0xf367d4[_0x1435('0x12')][_0x1435('0x14')]);}logger[_0x1435('0x12')](_0x1435('0xd'),_0x3fb4a1,_0xf367d4[_0x1435('0x12')][_0x1435('0x14')]);return _0x24059b(_0xf367d4['error'][_0x1435('0x14')]);}else{logger['info'](_0x1435('0xd'),_0x3fb4a1,'request\x20sent');_0x24059b(_0xf367d4[_0x1435('0x15')][_0x1435('0x14')]);}})[_0x1435('0x16')](function(_0x1e196b){logger[_0x1435('0x12')](_0x1435('0xd'),_0x3fb4a1,_0x1e196b);_0x13860a(_0x1e196b);});});}exports['GetFreshdeskAccount']=function(_0x78ab9d){var _0x5c1872=this;return new Promise(function(_0xe238a1,_0x36940b){return db[_0x1435('0x17')][_0x1435('0x18')]({'raw':_0x78ab9d[_0x1435('0x19')]?_0x78ab9d[_0x1435('0x19')][_0x1435('0x1a')]===undefined?!![]:![]:!![],'where':_0x78ab9d[_0x1435('0x19')]?_0x78ab9d[_0x1435('0x19')][_0x1435('0x1b')]||null:null,'attributes':_0x78ab9d[_0x1435('0x19')]?_0x78ab9d[_0x1435('0x19')][_0x1435('0x1c')]||null:null,'limit':_0x78ab9d[_0x1435('0x19')]?_0x78ab9d[_0x1435('0x19')][_0x1435('0x1d')]||null:null,'include':_0x78ab9d[_0x1435('0x19')]?_0x78ab9d[_0x1435('0x19')]['include']?_['map'](_0x78ab9d[_0x1435('0x19')]['include'],function(_0x7510d2){return{'model':db[_0x7510d2['model']],'as':_0x7510d2['as'],'attributes':_0x7510d2['attributes'],'include':_0x7510d2[_0x1435('0x1e')]?_['map'](_0x7510d2[_0x1435('0x1e')],function(_0x1f35aa){return{'model':db[_0x1f35aa[_0x1435('0x1f')]],'as':_0x1f35aa['as'],'attributes':_0x1f35aa['attributes'],'include':_0x1f35aa['include']?_[_0x1435('0x20')](_0x1f35aa[_0x1435('0x1e')],function(_0x49e287){return{'model':db[_0x49e287['model']],'as':_0x49e287['as'],'attributes':_0x49e287[_0x1435('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e6bff){logger[_0x1435('0xc')]('GetFreshdeskAccount',_0x78ab9d);logger[_0x1435('0xf')](_0x1435('0x21'),_0x78ab9d,JSON['stringify'](_0x5e6bff));_0xe238a1(_0x5e6bff);})[_0x1435('0x16')](function(_0x2b1c98){logger[_0x1435('0x12')]('GetFreshdeskAccount',_0x2b1c98[_0x1435('0x14')],_0x78ab9d);_0x36940b(_0x5c1872['error'](0x1f4,_0x2b1c98['message']));});});};exports['ShowFreshdeskAccount']=function(_0x535291){var _0x482fc8=this;return new Promise(function(_0x5b684d,_0x1927ef){return db['FreshdeskAccount'][_0x1435('0x22')]({'raw':_0x535291[_0x1435('0x19')]?_0x535291['options']['raw']===undefined?!![]:![]:!![],'where':_0x535291['options']?_0x535291['options'][_0x1435('0x1b')]||null:null,'attributes':_0x535291[_0x1435('0x19')]?_0x535291['options']['attributes']||null:null,'include':_0x535291[_0x1435('0x19')]?_0x535291[_0x1435('0x19')][_0x1435('0x1e')]?_[_0x1435('0x20')](_0x535291['options'][_0x1435('0x1e')],function(_0x3760c3){return{'model':db[_0x3760c3[_0x1435('0x1f')]],'as':_0x3760c3['as'],'attributes':_0x3760c3[_0x1435('0x1c')],'include':_0x3760c3[_0x1435('0x1e')]?_[_0x1435('0x20')](_0x3760c3['include'],function(_0x40428a){return{'model':db[_0x40428a['model']],'as':_0x40428a['as'],'attributes':_0x40428a[_0x1435('0x1c')],'include':_0x40428a['include']?_[_0x1435('0x20')](_0x40428a[_0x1435('0x1e')],function(_0x31d3c6){return{'model':db[_0x31d3c6['model']],'as':_0x31d3c6['as'],'attributes':_0x31d3c6[_0x1435('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ae735){logger['info'](_0x1435('0x23'),_0x535291);logger[_0x1435('0xf')](_0x1435('0x23'),_0x535291,JSON[_0x1435('0x11')](_0x5ae735));_0x5b684d(_0x5ae735);})[_0x1435('0x16')](function(_0x37ae35){logger[_0x1435('0x12')]('ShowFreshdeskAccount',_0x37ae35['message'],_0x535291);_0x1927ef(_0x482fc8[_0x1435('0x12')](0x1f4,_0x37ae35['message']));});});}; \ No newline at end of file +var _0x9494=['model','catch','ShowFreshdeskAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','raw','options','where','attributes','map','include'];(function(_0x1fe915,_0x50da25){var _0x36d429=function(_0x8a58e2){while(--_0x8a58e2){_0x1fe915['push'](_0x1fe915['shift']());}};_0x36d429(++_0x50da25);}(_0x9494,0x185));var _0x4949=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9494[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4949('0x0'));var util=require(_0x4949('0x1'));var moment=require('moment');var BPromise=require(_0x4949('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4949('0x3'));var db=require(_0x4949('0x4'))['db'];var utils=require(_0x4949('0x5'));var logger=require(_0x4949('0x6'))(_0x4949('0x7'));var config=require(_0x4949('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4949('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x172a90,_0x3ac70d,_0x1b0da2){return new BPromise(function(_0x4068f0,_0xf74760){return client[_0x4949('0xa')](_0x172a90,_0x1b0da2)[_0x4949('0xb')](function(_0x3b0484){logger[_0x4949('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x3ac70d,'request\x20sent');logger[_0x4949('0xd')](_0x4949('0xe'),_0x3ac70d,_0x4949('0xf'),JSON[_0x4949('0x10')](_0x3b0484));if(_0x3b0484[_0x4949('0x11')]){if(_0x3b0484[_0x4949('0x11')][_0x4949('0x12')]===0x1f4){logger[_0x4949('0x11')](_0x4949('0x13'),_0x3ac70d,_0x3b0484[_0x4949('0x11')][_0x4949('0x14')]);return _0xf74760(_0x3b0484['error'][_0x4949('0x14')]);}logger[_0x4949('0x11')](_0x4949('0x13'),_0x3ac70d,_0x3b0484[_0x4949('0x11')]['message']);return _0x4068f0(_0x3b0484[_0x4949('0x11')]['message']);}else{logger[_0x4949('0xc')](_0x4949('0x13'),_0x3ac70d,'request\x20sent');_0x4068f0(_0x3b0484[_0x4949('0x15')][_0x4949('0x14')]);}})['catch'](function(_0x5791c3){logger[_0x4949('0x11')](_0x4949('0x13'),_0x3ac70d,_0x5791c3);_0xf74760(_0x5791c3);});});}exports[_0x4949('0x16')]=function(_0x44ad32){var _0x5b188f=this;return new Promise(function(_0x2dd65a,_0x59da6c){return db[_0x4949('0x17')][_0x4949('0x18')]({'raw':_0x44ad32['options']?_0x44ad32['options'][_0x4949('0x19')]===undefined?!![]:![]:!![],'where':_0x44ad32[_0x4949('0x1a')]?_0x44ad32['options'][_0x4949('0x1b')]||null:null,'attributes':_0x44ad32[_0x4949('0x1a')]?_0x44ad32['options'][_0x4949('0x1c')]||null:null,'limit':_0x44ad32[_0x4949('0x1a')]?_0x44ad32[_0x4949('0x1a')]['limit']||null:null,'include':_0x44ad32[_0x4949('0x1a')]?_0x44ad32[_0x4949('0x1a')]['include']?_[_0x4949('0x1d')](_0x44ad32[_0x4949('0x1a')][_0x4949('0x1e')],function(_0x351d7b){return{'model':db[_0x351d7b[_0x4949('0x1f')]],'as':_0x351d7b['as'],'attributes':_0x351d7b[_0x4949('0x1c')],'include':_0x351d7b['include']?_[_0x4949('0x1d')](_0x351d7b[_0x4949('0x1e')],function(_0x27397f){return{'model':db[_0x27397f['model']],'as':_0x27397f['as'],'attributes':_0x27397f[_0x4949('0x1c')],'include':_0x27397f['include']?_['map'](_0x27397f['include'],function(_0x1c98c9){return{'model':db[_0x1c98c9['model']],'as':_0x1c98c9['as'],'attributes':_0x1c98c9[_0x4949('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4949('0xb')](function(_0x192374){logger[_0x4949('0xc')](_0x4949('0x16'),_0x44ad32);logger['debug'](_0x4949('0x16'),_0x44ad32,JSON[_0x4949('0x10')](_0x192374));_0x2dd65a(_0x192374);})[_0x4949('0x20')](function(_0x2d5100){logger['error'](_0x4949('0x16'),_0x2d5100[_0x4949('0x14')],_0x44ad32);_0x59da6c(_0x5b188f[_0x4949('0x11')](0x1f4,_0x2d5100[_0x4949('0x14')]));});});};exports[_0x4949('0x21')]=function(_0x3b51d3){var _0x363bca=this;return new Promise(function(_0x142798,_0x1dd93f){return db[_0x4949('0x17')][_0x4949('0x22')]({'raw':_0x3b51d3[_0x4949('0x1a')]?_0x3b51d3[_0x4949('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3b51d3[_0x4949('0x1a')]?_0x3b51d3[_0x4949('0x1a')][_0x4949('0x1b')]||null:null,'attributes':_0x3b51d3[_0x4949('0x1a')]?_0x3b51d3[_0x4949('0x1a')][_0x4949('0x1c')]||null:null,'include':_0x3b51d3[_0x4949('0x1a')]?_0x3b51d3['options'][_0x4949('0x1e')]?_[_0x4949('0x1d')](_0x3b51d3[_0x4949('0x1a')]['include'],function(_0x352fe2){return{'model':db[_0x352fe2[_0x4949('0x1f')]],'as':_0x352fe2['as'],'attributes':_0x352fe2[_0x4949('0x1c')],'include':_0x352fe2[_0x4949('0x1e')]?_[_0x4949('0x1d')](_0x352fe2[_0x4949('0x1e')],function(_0xb92425){return{'model':db[_0xb92425['model']],'as':_0xb92425['as'],'attributes':_0xb92425[_0x4949('0x1c')],'include':_0xb92425[_0x4949('0x1e')]?_[_0x4949('0x1d')](_0xb92425[_0x4949('0x1e')],function(_0x25faa4){return{'model':db[_0x25faa4[_0x4949('0x1f')]],'as':_0x25faa4['as'],'attributes':_0x25faa4[_0x4949('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4949('0xb')](function(_0x48f387){logger[_0x4949('0xc')]('ShowFreshdeskAccount',_0x3b51d3);logger['debug']('ShowFreshdeskAccount',_0x3b51d3,JSON[_0x4949('0x10')](_0x48f387));_0x142798(_0x48f387);})[_0x4949('0x20')](function(_0x2d1eec){logger['error']('ShowFreshdeskAccount',_0x2d1eec[_0x4949('0x14')],_0x3b51d3);_0x1dd93f(_0x363bca[_0x4949('0x11')](0x1f4,_0x2d1eec[_0x4949('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 01730e3..f7cc886 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 _0x2266=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','multer','util'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x2266,0xc9));var _0x6226=function(_0x69cbf8,_0x312d1e){_0x69cbf8=_0x69cbf8-0x0;var _0x481586=_0x2266[_0x69cbf8];return _0x481586;};'use strict';var multer=require(_0x6226('0x0'));var util=require(_0x6226('0x1'));var path=require('path');var timeout=require(_0x6226('0x2'));var express=require(_0x6226('0x3'));var router=express[_0x6226('0x4')]();var fs_extra=require(_0x6226('0x5'));var auth=require(_0x6226('0x6'));var interaction=require(_0x6226('0x7'));var config=require(_0x6226('0x8'));var controller=require(_0x6226('0x9'));router[_0x6226('0xa')]('/',auth['isAuthenticated'](),controller[_0x6226('0xb')]);router[_0x6226('0xa')](_0x6226('0xc'),auth[_0x6226('0xd')](),controller[_0x6226('0xe')]);router[_0x6226('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6226('0xf')]);router[_0x6226('0xa')](_0x6226('0x10'),auth[_0x6226('0xd')](),controller[_0x6226('0x11')]);router[_0x6226('0xa')](_0x6226('0x12'),auth[_0x6226('0xd')](),controller[_0x6226('0x13')]);router[_0x6226('0xa')](_0x6226('0x14'),auth['isAuthenticated'](),controller['getTags']);router[_0x6226('0x15')]('/',auth[_0x6226('0xd')](),controller[_0x6226('0x16')]);router[_0x6226('0x15')](_0x6226('0x14'),auth[_0x6226('0xd')](),controller[_0x6226('0x17')]);router[_0x6226('0x18')](_0x6226('0xc'),auth['isAuthenticated'](),controller[_0x6226('0x19')]);router[_0x6226('0x1a')](_0x6226('0xc'),auth[_0x6226('0xd')](),controller[_0x6226('0x1b')]);module[_0x6226('0x1c')]=router; \ No newline at end of file +var _0x43ff=['getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x43ff,0xbf));var _0xf43f=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x43ff[_0x506d2f];return _0x101255;};'use strict';var multer=require(_0xf43f('0x0'));var util=require(_0xf43f('0x1'));var path=require(_0xf43f('0x2'));var timeout=require(_0xf43f('0x3'));var express=require(_0xf43f('0x4'));var router=express[_0xf43f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf43f('0x6'));var interaction=require(_0xf43f('0x7'));var config=require(_0xf43f('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xf43f('0x9')]('/',auth[_0xf43f('0xa')](),controller[_0xf43f('0xb')]);router[_0xf43f('0x9')](_0xf43f('0xc'),auth[_0xf43f('0xa')](),controller['show']);router[_0xf43f('0x9')](_0xf43f('0xd'),auth['isAuthenticated'](),controller[_0xf43f('0xe')]);router[_0xf43f('0x9')](_0xf43f('0xf'),auth[_0xf43f('0xa')](),controller['getSubjects']);router['get'](_0xf43f('0x10'),auth[_0xf43f('0xa')](),controller[_0xf43f('0x11')]);router[_0xf43f('0x9')](_0xf43f('0x12'),auth[_0xf43f('0xa')](),controller[_0xf43f('0x13')]);router[_0xf43f('0x14')]('/',auth[_0xf43f('0xa')](),controller['create']);router[_0xf43f('0x14')](_0xf43f('0x12'),auth[_0xf43f('0xa')](),controller[_0xf43f('0x15')]);router[_0xf43f('0x16')](_0xf43f('0xc'),auth[_0xf43f('0xa')](),controller[_0xf43f('0x17')]);router[_0xf43f('0x18')](_0xf43f('0xc'),auth[_0xf43f('0xa')](),controller[_0xf43f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ca64acc..02a99e2 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 _0xd1a1=['exports','STRING','sequelize'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0xd1a1,0x155));var _0x1d1a=function(_0x56dea6,_0xaeb906){_0x56dea6=_0x56dea6-0x0;var _0x35baa8=_0xd1a1[_0x56dea6];return _0x35baa8;};'use strict';var Sequelize=require(_0x1d1a('0x0'));module[_0x1d1a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1d1a('0x2')]}}; \ No newline at end of file +var _0xd767=['sequelize','exports','STRING'];(function(_0x14eaff,_0x3ef509){var _0x5609b2=function(_0x589ac3){while(--_0x589ac3){_0x14eaff['push'](_0x14eaff['shift']());}};_0x5609b2(++_0x3ef509);}(_0xd767,0x10e));var _0x7d76=function(_0x3825f2,_0x33c9b1){_0x3825f2=_0x3825f2-0x0;var _0x6dab8a=_0xd767[_0x3825f2];return _0x6dab8a;};'use strict';var Sequelize=require(_0x7d76('0x0'));module[_0x7d76('0x1')]={'name':{'type':Sequelize[_0x7d76('0x2')]},'description':{'type':Sequelize[_0x7d76('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 23cb306..b01b194 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 _0x2242=['find','create','body','catch','getFields','findOne','FreshdeskField','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','index','map','FreshdeskConfiguration','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','params','keys'];(function(_0x4a68dd,_0x110bc5){var _0x266bf9=function(_0x369ce5){while(--_0x369ce5){_0x4a68dd['push'](_0x4a68dd['shift']());}};_0x266bf9(++_0x110bc5);}(_0x2242,0x1d6));var _0x2224=function(_0x5797df,_0x475922){_0x5797df=_0x5797df-0x0;var _0x549127=_0x2242[_0x5797df];return _0x549127;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2224('0x0'));var rp=require(_0x2224('0x1'));var moment=require(_0x2224('0x2'));var BPromise=require(_0x2224('0x3'));var Mustache=require('mustache');var util=require(_0x2224('0x4'));var path=require('path');var sox=require(_0x2224('0x5'));var csv=require(_0x2224('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2224('0x7'));var squel=require(_0x2224('0x8'));var crypto=require(_0x2224('0x9'));var jsforce=require(_0x2224('0xa'));var deskjs=require(_0x2224('0xb'));var toCsv=require(_0x2224('0x6'));var querystring=require(_0x2224('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2224('0xd'));var qs=require(_0x2224('0xe'));var as=require(_0x2224('0xf'));var hardwareService=require(_0x2224('0x10'));var logger=require(_0x2224('0x11'))(_0x2224('0x12'));var utils=require(_0x2224('0x13'));var config=require(_0x2224('0x14'));var licenseUtil=require(_0x2224('0x15'));var db=require(_0x2224('0x16'))['db'];function respondWithStatusCode(_0x33358c,_0x15c295){_0x15c295=_0x15c295||0xcc;return function(_0x68f688){if(_0x68f688){return _0x33358c['sendStatus'](_0x15c295);}return _0x33358c[_0x2224('0x17')](_0x15c295)[_0x2224('0x18')]();};}function respondWithResult(_0x36fc34,_0x65d001){_0x65d001=_0x65d001||0xc8;return function(_0x524999){if(_0x524999){return _0x36fc34[_0x2224('0x17')](_0x65d001)[_0x2224('0x19')](_0x524999);}};}function respondWithFilteredResult(_0xb7c3a0,_0x876ad5){return function(_0x5b8c6e){if(_0x5b8c6e){var _0x57314c=typeof _0x876ad5[_0x2224('0x1a')]===_0x2224('0x1b')&&typeof _0x876ad5[_0x2224('0x1c')]===_0x2224('0x1b');var _0x5e72d1=_0x5b8c6e['count'];var _0x25ea60=_0x57314c?0x0:_0x876ad5[_0x2224('0x1a')];var _0x38acce=_0x57314c?_0x5b8c6e[_0x2224('0x1d')]:_0x876ad5[_0x2224('0x1a')]+_0x876ad5['limit'];var _0x26bbff;if(_0x38acce>=_0x5e72d1){_0x38acce=_0x5e72d1;_0x26bbff=0xc8;}else{_0x26bbff=0xce;}_0xb7c3a0[_0x2224('0x17')](_0x26bbff);return _0xb7c3a0[_0x2224('0x1e')](_0x2224('0x1f'),_0x25ea60+'-'+_0x38acce+'/'+_0x5e72d1)[_0x2224('0x19')](_0x5b8c6e);}return null;};}function patchUpdates(_0x2ed882){return function(_0x99dd80){try{jsonpatch[_0x2224('0x20')](_0x99dd80,_0x2ed882,!![]);}catch(_0x55da96){return BPromise[_0x2224('0x21')](_0x55da96);}return _0x99dd80[_0x2224('0x22')]();};}function saveUpdates(_0x6af035,_0x1d3c77){return function(_0x3148a4){if(_0x3148a4){return _0x3148a4[_0x2224('0x23')](_0x6af035)[_0x2224('0x24')](function(_0x3d4c76){return _0x3d4c76;});}return null;};}function removeEntity(_0x2539f7,_0x2b9b7f){return function(_0x359c5a){if(_0x359c5a){return _0x359c5a['destroy']()['then'](function(){_0x2539f7[_0x2224('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30e514,_0x2e2375){return function(_0x4b0efd){if(!_0x4b0efd){_0x30e514['sendStatus'](0x194);}return _0x4b0efd;};}function handleError(_0x580a36,_0x114f00){_0x114f00=_0x114f00||0x1f4;return function(_0x4008d4){logger['error'](_0x4008d4['stack']);if(_0x4008d4[_0x2224('0x25')]){delete _0x4008d4['name'];}_0x580a36[_0x2224('0x17')](_0x114f00)['send'](_0x4008d4);};}exports[_0x2224('0x26')]=function(_0x511419,_0x5432a6){var _0x30add7={},_0x1a687a={},_0x263298={'count':0x0,'rows':[]};var _0x8bcaae=_[_0x2224('0x27')](db[_0x2224('0x28')][_0x2224('0x29')],function(_0x3ca3d8){return{'name':_0x3ca3d8['fieldName'],'type':_0x3ca3d8[_0x2224('0x2a')]['key']};});_0x1a687a[_0x2224('0x2b')]=_['map'](_0x8bcaae,_0x2224('0x25'));_0x1a687a[_0x2224('0x2c')]=_['keys'](_0x511419[_0x2224('0x2c')]);_0x1a687a[_0x2224('0x2d')]=_[_0x2224('0x2e')](_0x1a687a[_0x2224('0x2b')],_0x1a687a[_0x2224('0x2c')]);_0x30add7[_0x2224('0x2f')]=_[_0x2224('0x2e')](_0x1a687a[_0x2224('0x2b')],qs[_0x2224('0x30')](_0x511419[_0x2224('0x2c')]['fields']));_0x30add7[_0x2224('0x2f')]=_0x30add7['attributes'][_0x2224('0x31')]?_0x30add7[_0x2224('0x2f')]:_0x1a687a['model'];if(!_0x511419[_0x2224('0x2c')]['hasOwnProperty']('nolimit')){_0x30add7[_0x2224('0x1c')]=qs[_0x2224('0x1c')](_0x511419['query'][_0x2224('0x1c')]);_0x30add7[_0x2224('0x1a')]=qs[_0x2224('0x1a')](_0x511419[_0x2224('0x2c')][_0x2224('0x1a')]);}_0x30add7[_0x2224('0x32')]=qs[_0x2224('0x33')](_0x511419[_0x2224('0x2c')][_0x2224('0x33')]);_0x30add7['where']=qs[_0x2224('0x2d')](_[_0x2224('0x34')](_0x511419[_0x2224('0x2c')],_0x1a687a[_0x2224('0x2d')]),_0x8bcaae);if(_0x511419[_0x2224('0x2c')]['filter']){_0x30add7[_0x2224('0x35')]=_[_0x2224('0x36')](_0x30add7[_0x2224('0x35')],{'$or':_[_0x2224('0x27')](_0x8bcaae,function(_0x5bc6da){if(_0x5bc6da[_0x2224('0x2a')]!==_0x2224('0x37')){var _0x3e59d2={};_0x3e59d2[_0x5bc6da[_0x2224('0x25')]]={'$like':'%'+_0x511419['query'][_0x2224('0x38')]+'%'};return _0x3e59d2;}})});}_0x30add7=_[_0x2224('0x36')]({},_0x30add7,_0x511419[_0x2224('0x39')]);var _0x493f99={'where':_0x30add7[_0x2224('0x35')]};return db[_0x2224('0x28')][_0x2224('0x1d')](_0x493f99)['then'](function(_0x20fe12){_0x263298[_0x2224('0x1d')]=_0x20fe12;if(_0x511419[_0x2224('0x2c')][_0x2224('0x3a')]){_0x30add7[_0x2224('0x3b')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x30add7);})[_0x2224('0x24')](function(_0x2f84b6){_0x263298['rows']=_0x2f84b6;return _0x263298;})[_0x2224('0x24')](respondWithFilteredResult(_0x5432a6,_0x30add7))['catch'](handleError(_0x5432a6,null));};exports['show']=function(_0x40879f,_0x4cb364){var _0x271f1e={'raw':![],'where':{'id':_0x40879f[_0x2224('0x3c')]['id']}},_0xfc5161={};_0xfc5161[_0x2224('0x2b')]=_[_0x2224('0x3d')](db['FreshdeskConfiguration'][_0x2224('0x29')]);_0xfc5161[_0x2224('0x2c')]=_[_0x2224('0x3d')](_0x40879f['query']);_0xfc5161[_0x2224('0x2d')]=_[_0x2224('0x2e')](_0xfc5161[_0x2224('0x2b')],_0xfc5161[_0x2224('0x2c')]);_0x271f1e[_0x2224('0x2f')]=_[_0x2224('0x2e')](_0xfc5161[_0x2224('0x2b')],qs[_0x2224('0x30')](_0x40879f[_0x2224('0x2c')][_0x2224('0x30')]));_0x271f1e[_0x2224('0x2f')]=_0x271f1e['attributes']['length']?_0x271f1e[_0x2224('0x2f')]:_0xfc5161[_0x2224('0x2b')];if(_0x40879f[_0x2224('0x2c')][_0x2224('0x3a')]){_0x271f1e[_0x2224('0x3b')]=[{'all':!![]}];}_0x271f1e=_[_0x2224('0x36')]({},_0x271f1e,_0x40879f['options']);return db[_0x2224('0x28')][_0x2224('0x3e')](_0x271f1e)[_0x2224('0x24')](handleEntityNotFound(_0x4cb364,null))[_0x2224('0x24')](respondWithResult(_0x4cb364,null))['catch'](handleError(_0x4cb364,null));};exports[_0x2224('0x3f')]=function(_0x1386bd,_0x32fa73){return db[_0x2224('0x28')]['create'](_0x1386bd[_0x2224('0x40')],{})['then'](respondWithResult(_0x32fa73,0xc9))[_0x2224('0x41')](handleError(_0x32fa73,null));};exports[_0x2224('0x23')]=function(_0x463e7e,_0x2f3366){if(_0x463e7e[_0x2224('0x40')]['id']){delete _0x463e7e[_0x2224('0x40')]['id'];}return db[_0x2224('0x28')][_0x2224('0x3e')]({'where':{'id':_0x463e7e[_0x2224('0x3c')]['id']}})[_0x2224('0x24')](handleEntityNotFound(_0x2f3366,null))[_0x2224('0x24')](saveUpdates(_0x463e7e[_0x2224('0x40')],null))[_0x2224('0x24')](respondWithResult(_0x2f3366,null))[_0x2224('0x41')](handleError(_0x2f3366,null));};exports['destroy']=function(_0x29c052,_0x1c68c0){return db[_0x2224('0x28')][_0x2224('0x3e')]({'where':{'id':_0x29c052[_0x2224('0x3c')]['id']}})[_0x2224('0x24')](handleEntityNotFound(_0x1c68c0,null))[_0x2224('0x24')](removeEntity(_0x1c68c0,null))[_0x2224('0x41')](handleError(_0x1c68c0,null));};exports[_0x2224('0x42')]=function(_0x58854f,_0x4f4fb7,_0x1af6ba){var _0x3db49c={};var _0x1d35fc={};var _0x34caab;var _0x7163ed;return db[_0x2224('0x28')][_0x2224('0x43')]({'where':{'id':_0x58854f[_0x2224('0x3c')]['id']}})[_0x2224('0x24')](handleEntityNotFound(_0x4f4fb7,null))[_0x2224('0x24')](function(_0xa3daeb){if(_0xa3daeb){_0x34caab=_0xa3daeb;_0x1d35fc[_0x2224('0x2b')]=_[_0x2224('0x3d')](db[_0x2224('0x44')][_0x2224('0x29')]);_0x1d35fc[_0x2224('0x2c')]=_[_0x2224('0x3d')](_0x58854f[_0x2224('0x2c')]);_0x1d35fc[_0x2224('0x2d')]=_['intersection'](_0x1d35fc[_0x2224('0x2b')],_0x1d35fc[_0x2224('0x2c')]);_0x3db49c[_0x2224('0x2f')]=_[_0x2224('0x2e')](_0x1d35fc[_0x2224('0x2b')],qs[_0x2224('0x30')](_0x58854f[_0x2224('0x2c')][_0x2224('0x30')]));_0x3db49c[_0x2224('0x2f')]=_0x3db49c['attributes'][_0x2224('0x31')]?_0x3db49c[_0x2224('0x2f')]:_0x1d35fc[_0x2224('0x2b')];_0x3db49c['order']=qs[_0x2224('0x33')](_0x58854f[_0x2224('0x2c')][_0x2224('0x33')]);_0x3db49c['where']=qs['filters'](_[_0x2224('0x34')](_0x58854f[_0x2224('0x2c')],_0x1d35fc[_0x2224('0x2d')]));if(_0x58854f[_0x2224('0x2c')]['filter']){_0x3db49c[_0x2224('0x35')]=_[_0x2224('0x36')](_0x3db49c[_0x2224('0x35')],{'$or':_['map'](_0x3db49c['attributes'],function(_0x52c5a5){var _0x56a1cd={};_0x56a1cd[_0x52c5a5]={'$like':'%'+_0x58854f[_0x2224('0x2c')]['filter']+'%'};return _0x56a1cd;})});}_0x3db49c=_[_0x2224('0x36')]({},_0x3db49c,_0x58854f[_0x2224('0x39')]);return _0x34caab[_0x2224('0x42')](_0x3db49c);}})['then'](function(_0x1c0940){if(_0x1c0940){_0x7163ed=_0x1c0940[_0x2224('0x31')];if(!_0x58854f[_0x2224('0x2c')][_0x2224('0x45')](_0x2224('0x46'))){_0x3db49c['limit']=qs['limit'](_0x58854f[_0x2224('0x2c')][_0x2224('0x1c')]);_0x3db49c[_0x2224('0x1a')]=qs[_0x2224('0x1a')](_0x58854f[_0x2224('0x2c')]['offset']);}return _0x34caab[_0x2224('0x42')](_0x3db49c);}})[_0x2224('0x24')](function(_0x1b0143){if(_0x1b0143){return _0x1b0143?{'count':_0x7163ed,'rows':_0x1b0143}:null;}})['then'](respondWithResult(_0x4f4fb7,null))[_0x2224('0x41')](handleError(_0x4f4fb7,null));};exports[_0x2224('0x47')]=function(_0x1ac425,_0x4be921,_0x5ba432){var _0x5b05c5={};var _0xea701d={};var _0x2ce791;var _0x52f042;return db[_0x2224('0x28')][_0x2224('0x43')]({'where':{'id':_0x1ac425['params']['id']}})[_0x2224('0x24')](handleEntityNotFound(_0x4be921,null))[_0x2224('0x24')](function(_0x15cc4c){if(_0x15cc4c){_0x2ce791=_0x15cc4c;_0xea701d['model']=_[_0x2224('0x3d')](db[_0x2224('0x44')][_0x2224('0x29')]);_0xea701d['query']=_['keys'](_0x1ac425[_0x2224('0x2c')]);_0xea701d[_0x2224('0x2d')]=_[_0x2224('0x2e')](_0xea701d['model'],_0xea701d['query']);_0x5b05c5[_0x2224('0x2f')]=_[_0x2224('0x2e')](_0xea701d['model'],qs[_0x2224('0x30')](_0x1ac425[_0x2224('0x2c')][_0x2224('0x30')]));_0x5b05c5[_0x2224('0x2f')]=_0x5b05c5[_0x2224('0x2f')][_0x2224('0x31')]?_0x5b05c5[_0x2224('0x2f')]:_0xea701d[_0x2224('0x2b')];_0x5b05c5[_0x2224('0x32')]=qs[_0x2224('0x33')](_0x1ac425[_0x2224('0x2c')][_0x2224('0x33')]);_0x5b05c5[_0x2224('0x35')]=qs[_0x2224('0x2d')](_[_0x2224('0x34')](_0x1ac425[_0x2224('0x2c')],_0xea701d[_0x2224('0x2d')]));if(_0x1ac425['query'][_0x2224('0x38')]){_0x5b05c5[_0x2224('0x35')]=_[_0x2224('0x36')](_0x5b05c5['where'],{'$or':_[_0x2224('0x27')](_0x5b05c5[_0x2224('0x2f')],function(_0xc685ed){var _0x573753={};_0x573753[_0xc685ed]={'$like':'%'+_0x1ac425['query'][_0x2224('0x38')]+'%'};return _0x573753;})});}_0x5b05c5=_['merge']({},_0x5b05c5,_0x1ac425[_0x2224('0x39')]);return _0x2ce791[_0x2224('0x47')](_0x5b05c5);}})[_0x2224('0x24')](function(_0x1dd453){if(_0x1dd453){_0x52f042=_0x1dd453['length'];if(!_0x1ac425[_0x2224('0x2c')][_0x2224('0x45')](_0x2224('0x46'))){_0x5b05c5[_0x2224('0x1c')]=qs['limit'](_0x1ac425['query']['limit']);_0x5b05c5['offset']=qs['offset'](_0x1ac425[_0x2224('0x2c')]['offset']);}return _0x2ce791[_0x2224('0x47')](_0x5b05c5);}})[_0x2224('0x24')](function(_0x59f849){if(_0x59f849){return _0x59f849?{'count':_0x52f042,'rows':_0x59f849}:null;}})[_0x2224('0x24')](respondWithResult(_0x4be921,null))[_0x2224('0x41')](handleError(_0x4be921,null));};exports[_0x2224('0x48')]=function(_0x5b60a0,_0x50d0e0,_0x3e66d8){var _0x1f67b8={};var _0x360d48={};var _0x1247b4;var _0x2632ba;return db[_0x2224('0x28')]['findOne']({'where':{'id':_0x5b60a0['params']['id']}})[_0x2224('0x24')](handleEntityNotFound(_0x50d0e0,null))[_0x2224('0x24')](function(_0x318088){if(_0x318088){_0x1247b4=_0x318088;_0x360d48['model']=_['keys'](db[_0x2224('0x44')][_0x2224('0x29')]);_0x360d48[_0x2224('0x2c')]=_[_0x2224('0x3d')](_0x5b60a0['query']);_0x360d48['filters']=_[_0x2224('0x2e')](_0x360d48[_0x2224('0x2b')],_0x360d48[_0x2224('0x2c')]);_0x1f67b8[_0x2224('0x2f')]=_[_0x2224('0x2e')](_0x360d48[_0x2224('0x2b')],qs[_0x2224('0x30')](_0x5b60a0[_0x2224('0x2c')]['fields']));_0x1f67b8['attributes']=_0x1f67b8[_0x2224('0x2f')][_0x2224('0x31')]?_0x1f67b8[_0x2224('0x2f')]:_0x360d48[_0x2224('0x2b')];_0x1f67b8[_0x2224('0x32')]=qs[_0x2224('0x33')](_0x5b60a0[_0x2224('0x2c')][_0x2224('0x33')]);_0x1f67b8[_0x2224('0x35')]=qs['filters'](_['pick'](_0x5b60a0[_0x2224('0x2c')],_0x360d48[_0x2224('0x2d')]));if(_0x5b60a0[_0x2224('0x2c')][_0x2224('0x38')]){_0x1f67b8[_0x2224('0x35')]=_[_0x2224('0x36')](_0x1f67b8[_0x2224('0x35')],{'$or':_['map'](_0x1f67b8[_0x2224('0x2f')],function(_0x289d90){var _0x5405b8={};_0x5405b8[_0x289d90]={'$like':'%'+_0x5b60a0['query']['filter']+'%'};return _0x5405b8;})});}_0x1f67b8=_[_0x2224('0x36')]({},_0x1f67b8,_0x5b60a0['options']);return _0x1247b4[_0x2224('0x48')](_0x1f67b8);}})[_0x2224('0x24')](function(_0x49e769){if(_0x49e769){_0x2632ba=_0x49e769[_0x2224('0x31')];if(!_0x5b60a0[_0x2224('0x2c')]['hasOwnProperty'](_0x2224('0x46'))){_0x1f67b8[_0x2224('0x1c')]=qs[_0x2224('0x1c')](_0x5b60a0[_0x2224('0x2c')][_0x2224('0x1c')]);_0x1f67b8[_0x2224('0x1a')]=qs[_0x2224('0x1a')](_0x5b60a0[_0x2224('0x2c')][_0x2224('0x1a')]);}return _0x1247b4['getDescriptions'](_0x1f67b8);}})['then'](function(_0x25e24e){if(_0x25e24e){return _0x25e24e?{'count':_0x2632ba,'rows':_0x25e24e}:null;}})[_0x2224('0x24')](respondWithResult(_0x50d0e0,null))['catch'](handleError(_0x50d0e0,null));};exports[_0x2224('0x49')]=function(_0x46a1db,_0xbbf363,_0x3e082c){var _0x3f8253={};var _0x418841={};var _0x87ace3;var _0x1675a2;return db['FreshdeskConfiguration'][_0x2224('0x43')]({'where':{'id':_0x46a1db[_0x2224('0x3c')]['id']}})['then'](handleEntityNotFound(_0xbbf363,null))[_0x2224('0x24')](function(_0x4b8c22){if(_0x4b8c22){_0x87ace3=_0x4b8c22;_0x418841[_0x2224('0x2b')]=_[_0x2224('0x3d')](db['Tag'][_0x2224('0x29')]);_0x418841['query']=_[_0x2224('0x3d')](_0x46a1db[_0x2224('0x2c')]);_0x418841[_0x2224('0x2d')]=_[_0x2224('0x2e')](_0x418841['model'],_0x418841[_0x2224('0x2c')]);_0x3f8253['attributes']=_[_0x2224('0x2e')](_0x418841['model'],qs[_0x2224('0x30')](_0x46a1db[_0x2224('0x2c')][_0x2224('0x30')]));_0x3f8253[_0x2224('0x2f')]=_0x3f8253[_0x2224('0x2f')][_0x2224('0x31')]?_0x3f8253[_0x2224('0x2f')]:_0x418841[_0x2224('0x2b')];_0x3f8253[_0x2224('0x32')]=qs[_0x2224('0x33')](_0x46a1db[_0x2224('0x2c')][_0x2224('0x33')]);_0x3f8253[_0x2224('0x35')]=qs[_0x2224('0x2d')](_[_0x2224('0x34')](_0x46a1db[_0x2224('0x2c')],_0x418841[_0x2224('0x2d')]));if(_0x46a1db[_0x2224('0x2c')][_0x2224('0x38')]){_0x3f8253['where']=_['merge'](_0x3f8253[_0x2224('0x35')],{'$or':_[_0x2224('0x27')](_0x3f8253['attributes'],function(_0x27b4d3){var _0x2ec42b={};_0x2ec42b[_0x27b4d3]={'$like':'%'+_0x46a1db['query']['filter']+'%'};return _0x2ec42b;})});}_0x3f8253=_[_0x2224('0x36')]({},_0x3f8253,_0x46a1db[_0x2224('0x39')]);return _0x87ace3[_0x2224('0x49')](_0x3f8253);}})[_0x2224('0x24')](function(_0x34fdd8){if(_0x34fdd8){_0x1675a2=_0x34fdd8[_0x2224('0x31')];if(!_0x46a1db[_0x2224('0x2c')][_0x2224('0x45')](_0x2224('0x46'))){_0x3f8253[_0x2224('0x1c')]=qs[_0x2224('0x1c')](_0x46a1db[_0x2224('0x2c')][_0x2224('0x1c')]);_0x3f8253[_0x2224('0x1a')]=qs[_0x2224('0x1a')](_0x46a1db[_0x2224('0x2c')]['offset']);}return _0x87ace3['getTags'](_0x3f8253);}})[_0x2224('0x24')](function(_0x5720d5){if(_0x5720d5){return _0x5720d5?{'count':_0x1675a2,'rows':_0x5720d5}:null;}})[_0x2224('0x24')](respondWithResult(_0xbbf363,null))['catch'](handleError(_0xbbf363,null));};exports[_0x2224('0x4a')]=function(_0xe38f3b,_0x1edd40,_0x259047){if(_0xe38f3b[_0x2224('0x40')]['id']){delete _0xe38f3b['body']['id'];}return db[_0x2224('0x28')][_0x2224('0x43')]({'where':{'id':_0xe38f3b[_0x2224('0x3c')]['id']}})[_0x2224('0x24')](handleEntityNotFound(_0x1edd40,null))[_0x2224('0x24')](function(_0x5355a0){if(_0x5355a0){return _0x5355a0[_0x2224('0x4a')](_0xe38f3b[_0x2224('0x40')][_0x2224('0x4b')]||[]);}return null;})[_0x2224('0x24')](respondWithResult(_0x1edd40,null))[_0x2224('0x41')](handleError(_0x1edd40,null));}; \ No newline at end of file +var _0x1ed7=['path','sox','to-csv','fs-extra','lodash','desk.js','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','json','undefined','offset','count','set','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','create','body','find','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1492f7,_0x2ea065){var _0x1343a9=function(_0x1b7a9f){while(--_0x1b7a9f){_0x1492f7['push'](_0x1492f7['shift']());}};_0x1343a9(++_0x2ea065);}(_0x1ed7,0xed));var _0x71ed=function(_0xb3933d,_0x4ccb20){_0xb3933d=_0xb3933d-0x0;var _0x2fbd6d=_0x1ed7[_0xb3933d];return _0x2fbd6d;};'use strict';var emlformat=require(_0x71ed('0x0'));var rimraf=require(_0x71ed('0x1'));var zipdir=require(_0x71ed('0x2'));var jsonpatch=require(_0x71ed('0x3'));var rp=require(_0x71ed('0x4'));var moment=require(_0x71ed('0x5'));var BPromise=require(_0x71ed('0x6'));var Mustache=require(_0x71ed('0x7'));var util=require(_0x71ed('0x8'));var path=require(_0x71ed('0x9'));var sox=require(_0x71ed('0xa'));var csv=require(_0x71ed('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71ed('0xc'));var _=require(_0x71ed('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x71ed('0xe'));var toCsv=require(_0x71ed('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71ed('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71ed('0x10'));var logger=require(_0x71ed('0x11'))('api');var utils=require(_0x71ed('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x71ed('0x13'));var db=require(_0x71ed('0x14'))['db'];function respondWithStatusCode(_0x110376,_0x200d5e){_0x200d5e=_0x200d5e||0xcc;return function(_0xf67fcb){if(_0xf67fcb){return _0x110376['sendStatus'](_0x200d5e);}return _0x110376['status'](_0x200d5e)[_0x71ed('0x15')]();};}function respondWithResult(_0x307271,_0x230e51){_0x230e51=_0x230e51||0xc8;return function(_0x241f9c){if(_0x241f9c){return _0x307271['status'](_0x230e51)[_0x71ed('0x16')](_0x241f9c);}};}function respondWithFilteredResult(_0x5bf7b9,_0x2de85e){return function(_0x340d60){if(_0x340d60){var _0x36c212=typeof _0x2de85e['offset']===_0x71ed('0x17')&&typeof _0x2de85e['limit']===_0x71ed('0x17');var _0x5f370d=_0x340d60['count'];var _0x11fa75=_0x36c212?0x0:_0x2de85e[_0x71ed('0x18')];var _0x2f170=_0x36c212?_0x340d60[_0x71ed('0x19')]:_0x2de85e[_0x71ed('0x18')]+_0x2de85e['limit'];var _0x29d802;if(_0x2f170>=_0x5f370d){_0x2f170=_0x5f370d;_0x29d802=0xc8;}else{_0x29d802=0xce;}_0x5bf7b9['status'](_0x29d802);return _0x5bf7b9[_0x71ed('0x1a')]('Content-Range',_0x11fa75+'-'+_0x2f170+'/'+_0x5f370d)[_0x71ed('0x16')](_0x340d60);}return null;};}function patchUpdates(_0x4a190f){return function(_0x525c7d){try{jsonpatch[_0x71ed('0x1b')](_0x525c7d,_0x4a190f,!![]);}catch(_0x46755f){return BPromise[_0x71ed('0x1c')](_0x46755f);}return _0x525c7d[_0x71ed('0x1d')]();};}function saveUpdates(_0x1690a4,_0x72b0f7){return function(_0x48f86c){if(_0x48f86c){return _0x48f86c[_0x71ed('0x1e')](_0x1690a4)[_0x71ed('0x1f')](function(_0x23d767){return _0x23d767;});}return null;};}function removeEntity(_0x2a6442,_0x1cebb7){return function(_0xd3f3b7){if(_0xd3f3b7){return _0xd3f3b7[_0x71ed('0x20')]()[_0x71ed('0x1f')](function(){_0x2a6442[_0x71ed('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1615e7,_0x3d9f32){return function(_0x57539a){if(!_0x57539a){_0x1615e7[_0x71ed('0x22')](0x194);}return _0x57539a;};}function handleError(_0x1b76cb,_0x3ff4aa){_0x3ff4aa=_0x3ff4aa||0x1f4;return function(_0x5255ee){logger[_0x71ed('0x23')](_0x5255ee[_0x71ed('0x24')]);if(_0x5255ee[_0x71ed('0x25')]){delete _0x5255ee[_0x71ed('0x25')];}_0x1b76cb['status'](_0x3ff4aa)['send'](_0x5255ee);};}exports[_0x71ed('0x26')]=function(_0x126cd1,_0x6fee69){var _0x387f3e={},_0x17d1c2={},_0x522e98={'count':0x0,'rows':[]};var _0x524b13=_[_0x71ed('0x27')](db[_0x71ed('0x28')][_0x71ed('0x29')],function(_0x3429b1){return{'name':_0x3429b1[_0x71ed('0x2a')],'type':_0x3429b1[_0x71ed('0x2b')][_0x71ed('0x2c')]};});_0x17d1c2[_0x71ed('0x2d')]=_[_0x71ed('0x27')](_0x524b13,_0x71ed('0x25'));_0x17d1c2[_0x71ed('0x2e')]=_['keys'](_0x126cd1[_0x71ed('0x2e')]);_0x17d1c2[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0x17d1c2['model'],_0x17d1c2[_0x71ed('0x2e')]);_0x387f3e[_0x71ed('0x31')]=_['intersection'](_0x17d1c2[_0x71ed('0x2d')],qs['fields'](_0x126cd1['query']['fields']));_0x387f3e[_0x71ed('0x31')]=_0x387f3e[_0x71ed('0x31')][_0x71ed('0x32')]?_0x387f3e[_0x71ed('0x31')]:_0x17d1c2[_0x71ed('0x2d')];if(!_0x126cd1[_0x71ed('0x2e')][_0x71ed('0x33')]('nolimit')){_0x387f3e[_0x71ed('0x34')]=qs[_0x71ed('0x34')](_0x126cd1['query'][_0x71ed('0x34')]);_0x387f3e[_0x71ed('0x18')]=qs[_0x71ed('0x18')](_0x126cd1['query'][_0x71ed('0x18')]);}_0x387f3e[_0x71ed('0x35')]=qs[_0x71ed('0x36')](_0x126cd1[_0x71ed('0x2e')][_0x71ed('0x36')]);_0x387f3e[_0x71ed('0x37')]=qs[_0x71ed('0x2f')](_[_0x71ed('0x38')](_0x126cd1[_0x71ed('0x2e')],_0x17d1c2[_0x71ed('0x2f')]),_0x524b13);if(_0x126cd1[_0x71ed('0x2e')]['filter']){_0x387f3e[_0x71ed('0x37')]=_[_0x71ed('0x39')](_0x387f3e[_0x71ed('0x37')],{'$or':_[_0x71ed('0x27')](_0x524b13,function(_0x41307b){if(_0x41307b[_0x71ed('0x2b')]!==_0x71ed('0x3a')){var _0x120963={};_0x120963[_0x41307b[_0x71ed('0x25')]]={'$like':'%'+_0x126cd1['query'][_0x71ed('0x3b')]+'%'};return _0x120963;}})});}_0x387f3e=_[_0x71ed('0x39')]({},_0x387f3e,_0x126cd1['options']);var _0x4a6cff={'where':_0x387f3e[_0x71ed('0x37')]};return db[_0x71ed('0x28')][_0x71ed('0x19')](_0x4a6cff)[_0x71ed('0x1f')](function(_0x1032ec){_0x522e98[_0x71ed('0x19')]=_0x1032ec;if(_0x126cd1[_0x71ed('0x2e')][_0x71ed('0x3c')]){_0x387f3e[_0x71ed('0x3d')]=[{'all':!![]}];}return db[_0x71ed('0x28')][_0x71ed('0x3e')](_0x387f3e);})[_0x71ed('0x1f')](function(_0x128266){_0x522e98[_0x71ed('0x3f')]=_0x128266;return _0x522e98;})['then'](respondWithFilteredResult(_0x6fee69,_0x387f3e))[_0x71ed('0x40')](handleError(_0x6fee69,null));};exports[_0x71ed('0x41')]=function(_0x77c2be,_0x51cde2){var _0x11be5e={'raw':![],'where':{'id':_0x77c2be[_0x71ed('0x42')]['id']}},_0xabde45={};_0xabde45[_0x71ed('0x2d')]=_[_0x71ed('0x43')](db[_0x71ed('0x28')][_0x71ed('0x29')]);_0xabde45['query']=_['keys'](_0x77c2be[_0x71ed('0x2e')]);_0xabde45[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0xabde45['model'],_0xabde45[_0x71ed('0x2e')]);_0x11be5e[_0x71ed('0x31')]=_[_0x71ed('0x30')](_0xabde45['model'],qs['fields'](_0x77c2be[_0x71ed('0x2e')][_0x71ed('0x44')]));_0x11be5e[_0x71ed('0x31')]=_0x11be5e[_0x71ed('0x31')][_0x71ed('0x32')]?_0x11be5e[_0x71ed('0x31')]:_0xabde45[_0x71ed('0x2d')];if(_0x77c2be[_0x71ed('0x2e')][_0x71ed('0x3c')]){_0x11be5e['include']=[{'all':!![]}];}_0x11be5e=_[_0x71ed('0x39')]({},_0x11be5e,_0x77c2be[_0x71ed('0x45')]);return db['FreshdeskConfiguration']['find'](_0x11be5e)['then'](handleEntityNotFound(_0x51cde2,null))[_0x71ed('0x1f')](respondWithResult(_0x51cde2,null))[_0x71ed('0x40')](handleError(_0x51cde2,null));};exports[_0x71ed('0x46')]=function(_0x4b1868,_0x2e235f){return db[_0x71ed('0x28')][_0x71ed('0x46')](_0x4b1868[_0x71ed('0x47')],{})[_0x71ed('0x1f')](respondWithResult(_0x2e235f,0xc9))[_0x71ed('0x40')](handleError(_0x2e235f,null));};exports[_0x71ed('0x1e')]=function(_0x2612ac,_0x32ee5e){if(_0x2612ac[_0x71ed('0x47')]['id']){delete _0x2612ac[_0x71ed('0x47')]['id'];}return db['FreshdeskConfiguration'][_0x71ed('0x48')]({'where':{'id':_0x2612ac[_0x71ed('0x42')]['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0x32ee5e,null))['then'](saveUpdates(_0x2612ac[_0x71ed('0x47')],null))[_0x71ed('0x1f')](respondWithResult(_0x32ee5e,null))[_0x71ed('0x40')](handleError(_0x32ee5e,null));};exports['destroy']=function(_0x2ec812,_0x527f23){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x2ec812['params']['id']}})['then'](handleEntityNotFound(_0x527f23,null))[_0x71ed('0x1f')](removeEntity(_0x527f23,null))['catch'](handleError(_0x527f23,null));};exports[_0x71ed('0x49')]=function(_0x4a7b74,_0x466061,_0x52ca2d){var _0x154845={};var _0x25f10c={};var _0x82c95d;var _0x56c92a;return db[_0x71ed('0x28')][_0x71ed('0x4a')]({'where':{'id':_0x4a7b74[_0x71ed('0x42')]['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0x466061,null))[_0x71ed('0x1f')](function(_0x28dfbd){if(_0x28dfbd){_0x82c95d=_0x28dfbd;_0x25f10c[_0x71ed('0x2d')]=_[_0x71ed('0x43')](db[_0x71ed('0x4b')][_0x71ed('0x29')]);_0x25f10c[_0x71ed('0x2e')]=_['keys'](_0x4a7b74[_0x71ed('0x2e')]);_0x25f10c[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0x25f10c[_0x71ed('0x2d')],_0x25f10c[_0x71ed('0x2e')]);_0x154845['attributes']=_[_0x71ed('0x30')](_0x25f10c[_0x71ed('0x2d')],qs[_0x71ed('0x44')](_0x4a7b74[_0x71ed('0x2e')][_0x71ed('0x44')]));_0x154845[_0x71ed('0x31')]=_0x154845['attributes'][_0x71ed('0x32')]?_0x154845[_0x71ed('0x31')]:_0x25f10c[_0x71ed('0x2d')];_0x154845[_0x71ed('0x35')]=qs[_0x71ed('0x36')](_0x4a7b74[_0x71ed('0x2e')]['sort']);_0x154845['where']=qs['filters'](_['pick'](_0x4a7b74[_0x71ed('0x2e')],_0x25f10c[_0x71ed('0x2f')]));if(_0x4a7b74[_0x71ed('0x2e')][_0x71ed('0x3b')]){_0x154845[_0x71ed('0x37')]=_[_0x71ed('0x39')](_0x154845[_0x71ed('0x37')],{'$or':_[_0x71ed('0x27')](_0x154845[_0x71ed('0x31')],function(_0x36768a){var _0x279763={};_0x279763[_0x36768a]={'$like':'%'+_0x4a7b74[_0x71ed('0x2e')][_0x71ed('0x3b')]+'%'};return _0x279763;})});}_0x154845=_['merge']({},_0x154845,_0x4a7b74[_0x71ed('0x45')]);return _0x82c95d['getFields'](_0x154845);}})[_0x71ed('0x1f')](function(_0x52643f){if(_0x52643f){_0x56c92a=_0x52643f[_0x71ed('0x32')];if(!_0x4a7b74[_0x71ed('0x2e')][_0x71ed('0x33')](_0x71ed('0x4c'))){_0x154845[_0x71ed('0x34')]=qs[_0x71ed('0x34')](_0x4a7b74['query']['limit']);_0x154845[_0x71ed('0x18')]=qs[_0x71ed('0x18')](_0x4a7b74[_0x71ed('0x2e')][_0x71ed('0x18')]);}return _0x82c95d[_0x71ed('0x49')](_0x154845);}})[_0x71ed('0x1f')](function(_0x1c7cea){if(_0x1c7cea){return _0x1c7cea?{'count':_0x56c92a,'rows':_0x1c7cea}:null;}})[_0x71ed('0x1f')](respondWithResult(_0x466061,null))[_0x71ed('0x40')](handleError(_0x466061,null));};exports[_0x71ed('0x4d')]=function(_0x2f976d,_0x3b5f5f,_0x47e55b){var _0x4b0a13={};var _0x33c8bd={};var _0x256997;var _0x69e2f;return db[_0x71ed('0x28')]['findOne']({'where':{'id':_0x2f976d[_0x71ed('0x42')]['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0x3b5f5f,null))[_0x71ed('0x1f')](function(_0x1d00ad){if(_0x1d00ad){_0x256997=_0x1d00ad;_0x33c8bd[_0x71ed('0x2d')]=_['keys'](db[_0x71ed('0x4b')][_0x71ed('0x29')]);_0x33c8bd[_0x71ed('0x2e')]=_[_0x71ed('0x43')](_0x2f976d[_0x71ed('0x2e')]);_0x33c8bd[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0x33c8bd[_0x71ed('0x2d')],_0x33c8bd['query']);_0x4b0a13[_0x71ed('0x31')]=_['intersection'](_0x33c8bd['model'],qs['fields'](_0x2f976d[_0x71ed('0x2e')][_0x71ed('0x44')]));_0x4b0a13[_0x71ed('0x31')]=_0x4b0a13[_0x71ed('0x31')][_0x71ed('0x32')]?_0x4b0a13[_0x71ed('0x31')]:_0x33c8bd[_0x71ed('0x2d')];_0x4b0a13[_0x71ed('0x35')]=qs['sort'](_0x2f976d[_0x71ed('0x2e')][_0x71ed('0x36')]);_0x4b0a13[_0x71ed('0x37')]=qs['filters'](_[_0x71ed('0x38')](_0x2f976d[_0x71ed('0x2e')],_0x33c8bd[_0x71ed('0x2f')]));if(_0x2f976d[_0x71ed('0x2e')][_0x71ed('0x3b')]){_0x4b0a13[_0x71ed('0x37')]=_[_0x71ed('0x39')](_0x4b0a13['where'],{'$or':_['map'](_0x4b0a13[_0x71ed('0x31')],function(_0x119032){var _0x3472e4={};_0x3472e4[_0x119032]={'$like':'%'+_0x2f976d['query']['filter']+'%'};return _0x3472e4;})});}_0x4b0a13=_['merge']({},_0x4b0a13,_0x2f976d[_0x71ed('0x45')]);return _0x256997[_0x71ed('0x4d')](_0x4b0a13);}})['then'](function(_0x3c1e9f){if(_0x3c1e9f){_0x69e2f=_0x3c1e9f['length'];if(!_0x2f976d['query'][_0x71ed('0x33')](_0x71ed('0x4c'))){_0x4b0a13[_0x71ed('0x34')]=qs[_0x71ed('0x34')](_0x2f976d[_0x71ed('0x2e')][_0x71ed('0x34')]);_0x4b0a13[_0x71ed('0x18')]=qs[_0x71ed('0x18')](_0x2f976d['query'][_0x71ed('0x18')]);}return _0x256997['getSubjects'](_0x4b0a13);}})[_0x71ed('0x1f')](function(_0xbd30d4){if(_0xbd30d4){return _0xbd30d4?{'count':_0x69e2f,'rows':_0xbd30d4}:null;}})[_0x71ed('0x1f')](respondWithResult(_0x3b5f5f,null))['catch'](handleError(_0x3b5f5f,null));};exports[_0x71ed('0x4e')]=function(_0x5a8429,_0x31116c,_0x2f694a){var _0x23fa3b={};var _0x1f4693={};var _0x582b97;var _0x517deb;return db[_0x71ed('0x28')][_0x71ed('0x4a')]({'where':{'id':_0x5a8429['params']['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0x31116c,null))[_0x71ed('0x1f')](function(_0x382feb){if(_0x382feb){_0x582b97=_0x382feb;_0x1f4693[_0x71ed('0x2d')]=_[_0x71ed('0x43')](db[_0x71ed('0x4b')][_0x71ed('0x29')]);_0x1f4693[_0x71ed('0x2e')]=_[_0x71ed('0x43')](_0x5a8429['query']);_0x1f4693[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0x1f4693[_0x71ed('0x2d')],_0x1f4693['query']);_0x23fa3b[_0x71ed('0x31')]=_[_0x71ed('0x30')](_0x1f4693[_0x71ed('0x2d')],qs[_0x71ed('0x44')](_0x5a8429['query'][_0x71ed('0x44')]));_0x23fa3b[_0x71ed('0x31')]=_0x23fa3b[_0x71ed('0x31')]['length']?_0x23fa3b['attributes']:_0x1f4693[_0x71ed('0x2d')];_0x23fa3b[_0x71ed('0x35')]=qs[_0x71ed('0x36')](_0x5a8429['query'][_0x71ed('0x36')]);_0x23fa3b[_0x71ed('0x37')]=qs[_0x71ed('0x2f')](_[_0x71ed('0x38')](_0x5a8429[_0x71ed('0x2e')],_0x1f4693['filters']));if(_0x5a8429['query'][_0x71ed('0x3b')]){_0x23fa3b[_0x71ed('0x37')]=_[_0x71ed('0x39')](_0x23fa3b[_0x71ed('0x37')],{'$or':_[_0x71ed('0x27')](_0x23fa3b['attributes'],function(_0x5def54){var _0x16cde6={};_0x16cde6[_0x5def54]={'$like':'%'+_0x5a8429[_0x71ed('0x2e')]['filter']+'%'};return _0x16cde6;})});}_0x23fa3b=_[_0x71ed('0x39')]({},_0x23fa3b,_0x5a8429['options']);return _0x582b97[_0x71ed('0x4e')](_0x23fa3b);}})['then'](function(_0x38a252){if(_0x38a252){_0x517deb=_0x38a252['length'];if(!_0x5a8429['query'][_0x71ed('0x33')](_0x71ed('0x4c'))){_0x23fa3b[_0x71ed('0x34')]=qs['limit'](_0x5a8429[_0x71ed('0x2e')][_0x71ed('0x34')]);_0x23fa3b[_0x71ed('0x18')]=qs['offset'](_0x5a8429[_0x71ed('0x2e')]['offset']);}return _0x582b97[_0x71ed('0x4e')](_0x23fa3b);}})[_0x71ed('0x1f')](function(_0x253a31){if(_0x253a31){return _0x253a31?{'count':_0x517deb,'rows':_0x253a31}:null;}})[_0x71ed('0x1f')](respondWithResult(_0x31116c,null))[_0x71ed('0x40')](handleError(_0x31116c,null));};exports[_0x71ed('0x4f')]=function(_0x473415,_0x15fa74,_0x5c5870){var _0x25b26b={};var _0x2495e5={};var _0x3e563b;var _0x56573f;return db[_0x71ed('0x28')]['findOne']({'where':{'id':_0x473415['params']['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0x15fa74,null))[_0x71ed('0x1f')](function(_0x2ff0d6){if(_0x2ff0d6){_0x3e563b=_0x2ff0d6;_0x2495e5[_0x71ed('0x2d')]=_[_0x71ed('0x43')](db['Tag'][_0x71ed('0x29')]);_0x2495e5[_0x71ed('0x2e')]=_['keys'](_0x473415[_0x71ed('0x2e')]);_0x2495e5[_0x71ed('0x2f')]=_['intersection'](_0x2495e5['model'],_0x2495e5[_0x71ed('0x2e')]);_0x25b26b['attributes']=_[_0x71ed('0x30')](_0x2495e5['model'],qs[_0x71ed('0x44')](_0x473415[_0x71ed('0x2e')][_0x71ed('0x44')]));_0x25b26b['attributes']=_0x25b26b['attributes'][_0x71ed('0x32')]?_0x25b26b[_0x71ed('0x31')]:_0x2495e5[_0x71ed('0x2d')];_0x25b26b[_0x71ed('0x35')]=qs[_0x71ed('0x36')](_0x473415[_0x71ed('0x2e')][_0x71ed('0x36')]);_0x25b26b['where']=qs[_0x71ed('0x2f')](_[_0x71ed('0x38')](_0x473415[_0x71ed('0x2e')],_0x2495e5[_0x71ed('0x2f')]));if(_0x473415[_0x71ed('0x2e')]['filter']){_0x25b26b[_0x71ed('0x37')]=_[_0x71ed('0x39')](_0x25b26b[_0x71ed('0x37')],{'$or':_[_0x71ed('0x27')](_0x25b26b[_0x71ed('0x31')],function(_0xa378b2){var _0x316240={};_0x316240[_0xa378b2]={'$like':'%'+_0x473415[_0x71ed('0x2e')][_0x71ed('0x3b')]+'%'};return _0x316240;})});}_0x25b26b=_[_0x71ed('0x39')]({},_0x25b26b,_0x473415[_0x71ed('0x45')]);return _0x3e563b[_0x71ed('0x4f')](_0x25b26b);}})[_0x71ed('0x1f')](function(_0x257f60){if(_0x257f60){_0x56573f=_0x257f60[_0x71ed('0x32')];if(!_0x473415[_0x71ed('0x2e')][_0x71ed('0x33')](_0x71ed('0x4c'))){_0x25b26b[_0x71ed('0x34')]=qs[_0x71ed('0x34')](_0x473415['query'][_0x71ed('0x34')]);_0x25b26b[_0x71ed('0x18')]=qs[_0x71ed('0x18')](_0x473415[_0x71ed('0x2e')]['offset']);}return _0x3e563b['getTags'](_0x25b26b);}})[_0x71ed('0x1f')](function(_0x4b1259){if(_0x4b1259){return _0x4b1259?{'count':_0x56573f,'rows':_0x4b1259}:null;}})['then'](respondWithResult(_0x15fa74,null))[_0x71ed('0x40')](handleError(_0x15fa74,null));};exports[_0x71ed('0x50')]=function(_0x7a4586,_0xbb854e,_0x365a47){if(_0x7a4586['body']['id']){delete _0x7a4586[_0x71ed('0x47')]['id'];}return db['FreshdeskConfiguration'][_0x71ed('0x4a')]({'where':{'id':_0x7a4586[_0x71ed('0x42')]['id']}})[_0x71ed('0x1f')](handleEntityNotFound(_0xbb854e,null))['then'](function(_0x485a08){if(_0x485a08){return _0x485a08[_0x71ed('0x50')](_0x7a4586[_0x71ed('0x47')][_0x71ed('0x51')]||[]);}return null;})[_0x71ed('0x1f')](respondWithResult(_0xbb854e,null))['catch'](handleError(_0xbb854e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index d28eb55..d85b3a2 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 _0x0c17=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0c17,0x113));var _0x70c1=function(_0x1af61a,_0x2f6fce){_0x1af61a=_0x1af61a-0x0;var _0x4eed63=_0x0c17[_0x1af61a];return _0x4eed63;};'use strict';var _=require(_0x70c1('0x0'));var util=require(_0x70c1('0x1'));var logger=require(_0x70c1('0x2'))(_0x70c1('0x3'));var moment=require(_0x70c1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x70c1('0x5'));var rimraf=require('rimraf');var config=require(_0x70c1('0x6'));var attributes=require(_0x70c1('0x7'));module[_0x70c1('0x8')]=function(_0x49dc89,_0x501495){return _0x49dc89[_0x70c1('0x9')](_0x70c1('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb08c=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','bluebird','rimraf','exports','define'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0xb08c,0xc8));var _0xcb08=function(_0x2144ad,_0x1a860f){_0x2144ad=_0x2144ad-0x0;var _0x424ec2=_0xb08c[_0x2144ad];return _0x424ec2;};'use strict';var _=require(_0xcb08('0x0'));var util=require(_0xcb08('0x1'));var logger=require(_0xcb08('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcb08('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcb08('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xcb08('0x5')]=function(_0x316058,_0x5e4521){return _0x316058[_0xcb08('0x6')](_0xcb08('0x7'),attributes,{'tableName':_0xcb08('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 1f867cd..287223d 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 _0x8a4a=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util'];(function(_0x369580,_0x2c65e6){var _0x4c25ba=function(_0x5bb435){while(--_0x5bb435){_0x369580['push'](_0x369580['shift']());}};_0x4c25ba(++_0x2c65e6);}(_0x8a4a,0xcd));var _0xa8a4=function(_0xfadc1a,_0xc6a189){_0xfadc1a=_0xfadc1a-0x0;var _0x1be3a4=_0x8a4a[_0xfadc1a];return _0x1be3a4;};'use strict';var _=require(_0xa8a4('0x0'));var util=require(_0xa8a4('0x1'));var moment=require(_0xa8a4('0x2'));var BPromise=require(_0xa8a4('0x3'));var rs=require(_0xa8a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8a4('0x5'))['db'];var utils=require(_0xa8a4('0x6'));var logger=require(_0xa8a4('0x7'))(_0xa8a4('0x8'));var config=require('../../config/environment');var jayson=require(_0xa8a4('0x9'));var client=jayson[_0xa8a4('0xa')][_0xa8a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10f7,_0x832fe5,_0x4937c9){return new BPromise(function(_0x45141c,_0x474ec8){return client[_0xa8a4('0xc')](_0x1a10f7,_0x4937c9)[_0xa8a4('0xd')](function(_0x4fc226){logger[_0xa8a4('0xe')](_0xa8a4('0xf'),_0x832fe5,_0xa8a4('0x10'));logger[_0xa8a4('0x11')](_0xa8a4('0x12'),_0x832fe5,_0xa8a4('0x10'),JSON['stringify'](_0x4fc226));if(_0x4fc226[_0xa8a4('0x13')]){if(_0x4fc226[_0xa8a4('0x13')]['code']===0x1f4){logger[_0xa8a4('0x13')](_0xa8a4('0xf'),_0x832fe5,_0x4fc226[_0xa8a4('0x13')][_0xa8a4('0x14')]);return _0x474ec8(_0x4fc226['error'][_0xa8a4('0x14')]);}logger['error'](_0xa8a4('0xf'),_0x832fe5,_0x4fc226['error'][_0xa8a4('0x14')]);return _0x45141c(_0x4fc226['error'][_0xa8a4('0x14')]);}else{logger[_0xa8a4('0xe')](_0xa8a4('0xf'),_0x832fe5,_0xa8a4('0x10'));_0x45141c(_0x4fc226[_0xa8a4('0x15')]['message']);}})[_0xa8a4('0x16')](function(_0x4e46b3){logger[_0xa8a4('0x13')](_0xa8a4('0xf'),_0x832fe5,_0x4e46b3);_0x474ec8(_0x4e46b3);});});} \ No newline at end of file +var _0xe8e8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x2401fc,_0xbc7845){var _0x23bb42=function(_0x45a8e9){while(--_0x45a8e9){_0x2401fc['push'](_0x2401fc['shift']());}};_0x23bb42(++_0xbc7845);}(_0xe8e8,0x1e1));var _0x8e8e=function(_0x5b264c,_0x1c41f6){_0x5b264c=_0x5b264c-0x0;var _0x77946e=_0xe8e8[_0x5b264c];return _0x77946e;};'use strict';var _=require(_0x8e8e('0x0'));var util=require(_0x8e8e('0x1'));var moment=require(_0x8e8e('0x2'));var BPromise=require(_0x8e8e('0x3'));var rs=require(_0x8e8e('0x4'));var fs=require('fs');var Redis=require(_0x8e8e('0x5'));var db=require(_0x8e8e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e8e('0x7'))(_0x8e8e('0x8'));var config=require(_0x8e8e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e8e('0xa')][_0x8e8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10e4d5,_0x134045,_0x25b858){return new BPromise(function(_0x36f103,_0xf28aef){return client[_0x8e8e('0xc')](_0x10e4d5,_0x25b858)[_0x8e8e('0xd')](function(_0x2957f3){logger[_0x8e8e('0xe')](_0x8e8e('0xf'),_0x134045,_0x8e8e('0x10'));logger['debug'](_0x8e8e('0x11'),_0x134045,_0x8e8e('0x10'),JSON[_0x8e8e('0x12')](_0x2957f3));if(_0x2957f3[_0x8e8e('0x13')]){if(_0x2957f3[_0x8e8e('0x13')]['code']===0x1f4){logger[_0x8e8e('0x13')](_0x8e8e('0xf'),_0x134045,_0x2957f3[_0x8e8e('0x13')][_0x8e8e('0x14')]);return _0xf28aef(_0x2957f3[_0x8e8e('0x13')][_0x8e8e('0x14')]);}logger[_0x8e8e('0x13')](_0x8e8e('0xf'),_0x134045,_0x2957f3[_0x8e8e('0x13')][_0x8e8e('0x14')]);return _0x36f103(_0x2957f3[_0x8e8e('0x13')][_0x8e8e('0x14')]);}else{logger[_0x8e8e('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x134045,'request\x20sent');_0x36f103(_0x2957f3[_0x8e8e('0x15')]['message']);}})['catch'](function(_0x5492c5){logger[_0x8e8e('0x13')](_0x8e8e('0xf'),_0x134045,_0x5492c5);_0xf28aef(_0x5492c5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 091e62e..1d4605c 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 _0x7277=['multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','exports'];(function(_0x4f34ae,_0x13ed24){var _0x4f4576=function(_0x5e0e9d){while(--_0x5e0e9d){_0x4f34ae['push'](_0x4f34ae['shift']());}};_0x4f4576(++_0x13ed24);}(_0x7277,0xbb));var _0x7727=function(_0x169d5e,_0x19dcb8){_0x169d5e=_0x169d5e-0x0;var _0x5a2489=_0x7277[_0x169d5e];return _0x5a2489;};'use strict';var multer=require(_0x7727('0x0'));var util=require(_0x7727('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7727('0x2'));var auth=require(_0x7727('0x3'));var interaction=require(_0x7727('0x4'));var config=require(_0x7727('0x5'));var controller=require(_0x7727('0x6'));router[_0x7727('0x7')]('/',auth['isAuthenticated'](),controller[_0x7727('0x8')]);router['get'](_0x7727('0x9'),auth[_0x7727('0xa')](),controller['show']);router[_0x7727('0xb')]('/',auth['isAuthenticated'](),controller[_0x7727('0xc')]);router[_0x7727('0xd')](_0x7727('0x9'),auth[_0x7727('0xa')](),controller[_0x7727('0xe')]);router[_0x7727('0xf')](_0x7727('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x7727('0x10')]=router; \ No newline at end of file +var _0x051f=['index','/:id','show','post','isAuthenticated','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get'];(function(_0x55b946,_0x30bede){var _0x538666=function(_0x11bf06){while(--_0x11bf06){_0x55b946['push'](_0x55b946['shift']());}};_0x538666(++_0x30bede);}(_0x051f,0x10e));var _0xf051=function(_0x3b997a,_0x2f49ae){_0x3b997a=_0x3b997a-0x0;var _0x50b740=_0x051f[_0x3b997a];return _0x50b740;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf051('0x0'));var timeout=require(_0xf051('0x1'));var express=require(_0xf051('0x2'));var router=express[_0xf051('0x3')]();var fs_extra=require(_0xf051('0x4'));var auth=require(_0xf051('0x5'));var interaction=require(_0xf051('0x6'));var config=require(_0xf051('0x7'));var controller=require(_0xf051('0x8'));router[_0xf051('0x9')]('/',auth['isAuthenticated'](),controller[_0xf051('0xa')]);router[_0xf051('0x9')](_0xf051('0xb'),auth['isAuthenticated'](),controller[_0xf051('0xc')]);router[_0xf051('0xd')]('/',auth[_0xf051('0xe')](),controller[_0xf051('0xf')]);router[_0xf051('0x10')](_0xf051('0xb'),auth[_0xf051('0xe')](),controller[_0xf051('0x11')]);router[_0xf051('0x12')](_0xf051('0xb'),auth[_0xf051('0xe')](),controller['destroy']);module[_0xf051('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 5a2abfa..f17988d 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 _0xfc54=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0xa33d33,_0x36cd82){var _0x507553=function(_0x5d1de9){while(--_0x5d1de9){_0xa33d33['push'](_0xa33d33['shift']());}};_0x507553(++_0x36cd82);}(_0xfc54,0x70));var _0x4fc5=function(_0x4052c0,_0x4271ab){_0x4052c0=_0x4052c0-0x0;var _0x296f04=_0xfc54[_0x4052c0];return _0x296f04;};'use strict';var Sequelize=require('sequelize');module[_0x4fc5('0x0')]={'type':{'type':Sequelize[_0x4fc5('0x1')](_0x4fc5('0x2'),_0x4fc5('0x3'),_0x4fc5('0x4'),'keyValue',_0x4fc5('0x5')),'defaultValue':_0x4fc5('0x2')},'content':{'type':Sequelize[_0x4fc5('0x6')]},'key':{'type':Sequelize[_0x4fc5('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4fc5('0x2'),_0x4fc5('0x3'),_0x4fc5('0x4'))},'keyContent':{'type':Sequelize[_0x4fc5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4fc5('0x6')]},'customField':{'type':Sequelize[_0x4fc5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4fc5('0x6')]}}; \ No newline at end of file +var _0x0362=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x456766,_0x53c8eb){var _0xd39fa=function(_0x124824){while(--_0x124824){_0x456766['push'](_0x456766['shift']());}};_0xd39fa(++_0x53c8eb);}(_0x0362,0xe6));var _0x2036=function(_0x4a1fad,_0x24f3c5){_0x4a1fad=_0x4a1fad-0x0;var _0x33deda=_0x0362[_0x4a1fad];return _0x33deda;};'use strict';var Sequelize=require(_0x2036('0x0'));module[_0x2036('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2036('0x2'),_0x2036('0x3'),_0x2036('0x4'),_0x2036('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2036('0x6')]},'key':{'type':Sequelize[_0x2036('0x6')]},'keyType':{'type':Sequelize[_0x2036('0x7')](_0x2036('0x2'),'variable',_0x2036('0x4'))},'keyContent':{'type':Sequelize[_0x2036('0x6')]},'idField':{'type':Sequelize[_0x2036('0x6')]},'nameField':{'type':Sequelize[_0x2036('0x6')]},'customField':{'type':Sequelize[_0x2036('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2036('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f38547c..8dcbf46 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 _0x1339=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','end','sendStatus','error','name','send','index','map','FreshdeskField','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','update','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2e986d,_0x4b6b63){var _0x351c79=function(_0xf178c7){while(--_0xf178c7){_0x2e986d['push'](_0x2e986d['shift']());}};_0x351c79(++_0x4b6b63);}(_0x1339,0x1ed));var _0x9133=function(_0x3f9782,_0x5abada){_0x3f9782=_0x3f9782-0x0;var _0x4d60ca=_0x1339[_0x3f9782];return _0x4d60ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x22')]();});}};}function handleEntityNotFound(_0x3f278d,_0x14c1cb){return function(_0x4483ef){if(!_0x4483ef){_0x3f278d[_0x9133('0x23')](0x194);}return _0x4483ef;};}function handleError(_0x294332,_0x313d43){_0x313d43=_0x313d43||0x1f4;return function(_0x1b6b3e){logger[_0x9133('0x24')](_0x1b6b3e['stack']);if(_0x1b6b3e['name']){delete _0x1b6b3e[_0x9133('0x25')];}_0x294332[_0x9133('0x1a')](_0x313d43)[_0x9133('0x26')](_0x1b6b3e);};}exports[_0x9133('0x27')]=function(_0x4de894,_0x4ecd9e){var _0x3e2404={},_0x45966d={},_0x188c49={'count':0x0,'rows':[]};var _0x26d351=_[_0x9133('0x28')](db[_0x9133('0x29')]['rawAttributes'],function(_0x58afe0){return{'name':_0x58afe0['fieldName'],'type':_0x58afe0[_0x9133('0x2a')]['key']};});_0x45966d[_0x9133('0x2b')]=_[_0x9133('0x28')](_0x26d351,'name');_0x45966d[_0x9133('0x2c')]=_['keys'](_0x4de894[_0x9133('0x2c')]);_0x45966d[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x45966d['model'],_0x45966d[_0x9133('0x2c')]);_0x3e2404[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x45966d['model'],qs[_0x9133('0x30')](_0x4de894[_0x9133('0x2c')][_0x9133('0x30')]));_0x3e2404['attributes']=_0x3e2404[_0x9133('0x2f')][_0x9133('0x31')]?_0x3e2404[_0x9133('0x2f')]:_0x45966d[_0x9133('0x2b')];if(!_0x4de894['query'][_0x9133('0x32')](_0x9133('0x33'))){_0x3e2404['limit']=qs[_0x9133('0x1d')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1d')]);_0x3e2404[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1e')]);}_0x3e2404[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4de894[_0x9133('0x2c')][_0x9133('0x35')]);_0x3e2404['where']=qs[_0x9133('0x2d')](_[_0x9133('0x36')](_0x4de894['query'],_0x45966d[_0x9133('0x2d')]),_0x26d351);if(_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]){_0x3e2404[_0x9133('0x38')]=_[_0x9133('0x39')](_0x3e2404[_0x9133('0x38')],{'$or':_['map'](_0x26d351,function(_0x4e16d2){if(_0x4e16d2[_0x9133('0x2a')]!==_0x9133('0x3a')){var _0x156905={};_0x156905[_0x4e16d2[_0x9133('0x25')]]={'$like':'%'+_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]+'%'};return _0x156905;}})});}_0x3e2404=_[_0x9133('0x39')]({},_0x3e2404,_0x4de894[_0x9133('0x3b')]);var _0x720048={'where':_0x3e2404['where']};return db[_0x9133('0x29')][_0x9133('0x3c')](_0x720048)[_0x9133('0x20')](function(_0x199ae9){_0x188c49[_0x9133('0x3c')]=_0x199ae9;if(_0x4de894['query'][_0x9133('0x3d')]){_0x3e2404[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x29')][_0x9133('0x3f')](_0x3e2404);})['then'](function(_0x146734){_0x188c49[_0x9133('0x40')]=_0x146734;return _0x188c49;})[_0x9133('0x20')](respondWithFilteredResult(_0x4ecd9e,_0x3e2404))[_0x9133('0x41')](handleError(_0x4ecd9e,null));};exports[_0x9133('0x42')]=function(_0x338049,_0x3b2287){var _0x4ca1a3={'raw':!![],'where':{'id':_0x338049['params']['id']}},_0x7f6cd9={};_0x7f6cd9['model']=_[_0x9133('0x43')](db[_0x9133('0x29')][_0x9133('0x44')]);_0x7f6cd9[_0x9133('0x2c')]=_[_0x9133('0x43')](_0x338049[_0x9133('0x2c')]);_0x7f6cd9[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],_0x7f6cd9['query']);_0x4ca1a3[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],qs['fields'](_0x338049['query'][_0x9133('0x30')]));_0x4ca1a3[_0x9133('0x2f')]=_0x4ca1a3['attributes'][_0x9133('0x31')]?_0x4ca1a3[_0x9133('0x2f')]:_0x7f6cd9[_0x9133('0x2b')];if(_0x338049[_0x9133('0x2c')][_0x9133('0x3d')]){_0x4ca1a3['include']=[{'all':!![]}];}_0x4ca1a3=_[_0x9133('0x39')]({},_0x4ca1a3,_0x338049[_0x9133('0x3b')]);return db[_0x9133('0x29')]['find'](_0x4ca1a3)[_0x9133('0x20')](handleEntityNotFound(_0x3b2287,null))[_0x9133('0x20')](respondWithResult(_0x3b2287,null))['catch'](handleError(_0x3b2287,null));};exports['create']=function(_0x42c188,_0x2cd935){return db[_0x9133('0x29')][_0x9133('0x45')](_0x42c188[_0x9133('0x46')],{})[_0x9133('0x20')](respondWithResult(_0x2cd935,0xc9))[_0x9133('0x41')](handleError(_0x2cd935,null));};exports[_0x9133('0x47')]=function(_0x23f134,_0xf07fbb){if(_0x23f134[_0x9133('0x46')]['id']){delete _0x23f134[_0x9133('0x46')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x23f134[_0x9133('0x48')]['id']}})['then'](handleEntityNotFound(_0xf07fbb,null))[_0x9133('0x20')](saveUpdates(_0x23f134[_0x9133('0x46')],null))[_0x9133('0x20')](respondWithResult(_0xf07fbb,null))[_0x9133('0x41')](handleError(_0xf07fbb,null));};exports['destroy']=function(_0x2a3848,_0x25750f){return db[_0x9133('0x29')]['find']({'where':{'id':_0x2a3848[_0x9133('0x48')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x25750f,null))[_0x9133('0x20')](removeEntity(_0x25750f,null))['catch'](handleError(_0x25750f,null));}; \ No newline at end of file +var _0x422f=['update','destroy','then','error','stack','name','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','type','VIRTUAL','findAll','rows','show','params','rawAttributes','length','includeAll','include','merge','options','find','body','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x422f,0x1c7));var _0xf422=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0x422f[_0x1809c5];return _0x5254a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf422('0x1'));var rp=require(_0xf422('0x2'));var moment=require('moment');var BPromise=require(_0xf422('0x3'));var Mustache=require(_0xf422('0x4'));var util=require(_0xf422('0x5'));var path=require(_0xf422('0x6'));var sox=require(_0xf422('0x7'));var csv=require(_0xf422('0x8'));var ejs=require(_0xf422('0x9'));var fs=require('fs');var fs_extra=require(_0xf422('0xa'));var _=require(_0xf422('0xb'));var squel=require('squel');var crypto=require(_0xf422('0xc'));var jsforce=require(_0xf422('0xd'));var deskjs=require(_0xf422('0xe'));var toCsv=require(_0xf422('0x8'));var querystring=require(_0xf422('0xf'));var Papa=require('papaparse');var Redis=require(_0xf422('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf422('0x11'));var hardwareService=require(_0xf422('0x12'));var logger=require(_0xf422('0x13'))(_0xf422('0x14'));var utils=require(_0xf422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf422('0x16'));var db=require(_0xf422('0x17'))['db'];function respondWithStatusCode(_0x4d56d1,_0x133a6a){_0x133a6a=_0x133a6a||0xcc;return function(_0x8aa9cc){if(_0x8aa9cc){return _0x4d56d1[_0xf422('0x18')](_0x133a6a);}return _0x4d56d1[_0xf422('0x19')](_0x133a6a)[_0xf422('0x1a')]();};}function respondWithResult(_0x28a6a8,_0x223b21){_0x223b21=_0x223b21||0xc8;return function(_0x272430){if(_0x272430){return _0x28a6a8[_0xf422('0x19')](_0x223b21)['json'](_0x272430);}};}function respondWithFilteredResult(_0x54bb9c,_0x52f96b){return function(_0x1c81e1){if(_0x1c81e1){var _0x30b70a=typeof _0x52f96b[_0xf422('0x1b')]===_0xf422('0x1c')&&typeof _0x52f96b['limit']===_0xf422('0x1c');var _0x264964=_0x1c81e1[_0xf422('0x1d')];var _0x2ae133=_0x30b70a?0x0:_0x52f96b[_0xf422('0x1b')];var _0x29b0b1=_0x30b70a?_0x1c81e1['count']:_0x52f96b['offset']+_0x52f96b[_0xf422('0x1e')];var _0x4b657;if(_0x29b0b1>=_0x264964){_0x29b0b1=_0x264964;_0x4b657=0xc8;}else{_0x4b657=0xce;}_0x54bb9c[_0xf422('0x19')](_0x4b657);return _0x54bb9c['set'](_0xf422('0x1f'),_0x2ae133+'-'+_0x29b0b1+'/'+_0x264964)['json'](_0x1c81e1);}return null;};}function patchUpdates(_0x22afe7){return function(_0x15833b){try{jsonpatch[_0xf422('0x20')](_0x15833b,_0x22afe7,!![]);}catch(_0x4d6717){return BPromise[_0xf422('0x21')](_0x4d6717);}return _0x15833b[_0xf422('0x22')]();};}function saveUpdates(_0x511529,_0x4b80a0){return function(_0x268575){if(_0x268575){return _0x268575[_0xf422('0x23')](_0x511529)['then'](function(_0x25b6a5){return _0x25b6a5;});}return null;};}function removeEntity(_0x570ea2,_0x3b21a5){return function(_0x32ceee){if(_0x32ceee){return _0x32ceee[_0xf422('0x24')]()[_0xf422('0x25')](function(){_0x570ea2[_0xf422('0x19')](0xcc)[_0xf422('0x1a')]();});}};}function handleEntityNotFound(_0xd8d70f,_0x11d10b){return function(_0x5dcab4){if(!_0x5dcab4){_0xd8d70f[_0xf422('0x18')](0x194);}return _0x5dcab4;};}function handleError(_0x59d03d,_0x2f0f9f){_0x2f0f9f=_0x2f0f9f||0x1f4;return function(_0x7d36e7){logger[_0xf422('0x26')](_0x7d36e7[_0xf422('0x27')]);if(_0x7d36e7[_0xf422('0x28')]){delete _0x7d36e7[_0xf422('0x28')];}_0x59d03d[_0xf422('0x19')](_0x2f0f9f)['send'](_0x7d36e7);};}exports['index']=function(_0x35d1fa,_0x10d51b){var _0x266fb8={},_0x33ef63={},_0xefb99e={'count':0x0,'rows':[]};var _0x48e0c7=_[_0xf422('0x29')](db[_0xf422('0x2a')]['rawAttributes'],function(_0x5f0186){return{'name':_0x5f0186[_0xf422('0x2b')],'type':_0x5f0186['type']['key']};});_0x33ef63[_0xf422('0x2c')]=_[_0xf422('0x29')](_0x48e0c7,'name');_0x33ef63[_0xf422('0x2d')]=_[_0xf422('0x2e')](_0x35d1fa[_0xf422('0x2d')]);_0x33ef63[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x33ef63['model'],_0x33ef63[_0xf422('0x2d')]);_0x266fb8['attributes']=_[_0xf422('0x30')](_0x33ef63[_0xf422('0x2c')],qs[_0xf422('0x31')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x31')]));_0x266fb8[_0xf422('0x32')]=_0x266fb8[_0xf422('0x32')]['length']?_0x266fb8['attributes']:_0x33ef63[_0xf422('0x2c')];if(!_0x35d1fa[_0xf422('0x2d')]['hasOwnProperty'](_0xf422('0x33'))){_0x266fb8[_0xf422('0x1e')]=qs[_0xf422('0x1e')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1e')]);_0x266fb8[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1b')]);}_0x266fb8[_0xf422('0x34')]=qs[_0xf422('0x35')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x35')]);_0x266fb8[_0xf422('0x36')]=qs['filters'](_['pick'](_0x35d1fa['query'],_0x33ef63[_0xf422('0x2f')]),_0x48e0c7);if(_0x35d1fa[_0xf422('0x2d')]['filter']){_0x266fb8[_0xf422('0x36')]=_['merge'](_0x266fb8[_0xf422('0x36')],{'$or':_[_0xf422('0x29')](_0x48e0c7,function(_0x55ac68){if(_0x55ac68[_0xf422('0x37')]!==_0xf422('0x38')){var _0x174f6f={};_0x174f6f[_0x55ac68['name']]={'$like':'%'+_0x35d1fa[_0xf422('0x2d')]['filter']+'%'};return _0x174f6f;}})});}_0x266fb8=_['merge']({},_0x266fb8,_0x35d1fa['options']);var _0x112bce={'where':_0x266fb8[_0xf422('0x36')]};return db[_0xf422('0x2a')][_0xf422('0x1d')](_0x112bce)[_0xf422('0x25')](function(_0x2f82a0){_0xefb99e[_0xf422('0x1d')]=_0x2f82a0;if(_0x35d1fa[_0xf422('0x2d')]['includeAll']){_0x266fb8['include']=[{'all':!![]}];}return db[_0xf422('0x2a')][_0xf422('0x39')](_0x266fb8);})[_0xf422('0x25')](function(_0xb3955){_0xefb99e[_0xf422('0x3a')]=_0xb3955;return _0xefb99e;})[_0xf422('0x25')](respondWithFilteredResult(_0x10d51b,_0x266fb8))['catch'](handleError(_0x10d51b,null));};exports[_0xf422('0x3b')]=function(_0x4f453a,_0x17c1f2){var _0x391e3c={'raw':!![],'where':{'id':_0x4f453a[_0xf422('0x3c')]['id']}},_0x564041={};_0x564041[_0xf422('0x2c')]=_[_0xf422('0x2e')](db[_0xf422('0x2a')][_0xf422('0x3d')]);_0x564041['query']=_[_0xf422('0x2e')](_0x4f453a[_0xf422('0x2d')]);_0x564041[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x564041[_0xf422('0x2c')],_0x564041['query']);_0x391e3c[_0xf422('0x32')]=_[_0xf422('0x30')](_0x564041['model'],qs[_0xf422('0x31')](_0x4f453a['query'][_0xf422('0x31')]));_0x391e3c[_0xf422('0x32')]=_0x391e3c[_0xf422('0x32')][_0xf422('0x3e')]?_0x391e3c[_0xf422('0x32')]:_0x564041[_0xf422('0x2c')];if(_0x4f453a[_0xf422('0x2d')][_0xf422('0x3f')]){_0x391e3c[_0xf422('0x40')]=[{'all':!![]}];}_0x391e3c=_[_0xf422('0x41')]({},_0x391e3c,_0x4f453a[_0xf422('0x42')]);return db[_0xf422('0x2a')][_0xf422('0x43')](_0x391e3c)[_0xf422('0x25')](handleEntityNotFound(_0x17c1f2,null))[_0xf422('0x25')](respondWithResult(_0x17c1f2,null))['catch'](handleError(_0x17c1f2,null));};exports['create']=function(_0x3c59dd,_0x2c2ce9){return db[_0xf422('0x2a')]['create'](_0x3c59dd[_0xf422('0x44')],{})[_0xf422('0x25')](respondWithResult(_0x2c2ce9,0xc9))[_0xf422('0x45')](handleError(_0x2c2ce9,null));};exports[_0xf422('0x23')]=function(_0x1f3a30,_0x259e24){if(_0x1f3a30[_0xf422('0x44')]['id']){delete _0x1f3a30['body']['id'];}return db[_0xf422('0x2a')]['find']({'where':{'id':_0x1f3a30[_0xf422('0x3c')]['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x259e24,null))['then'](saveUpdates(_0x1f3a30[_0xf422('0x44')],null))[_0xf422('0x25')](respondWithResult(_0x259e24,null))[_0xf422('0x45')](handleError(_0x259e24,null));};exports[_0xf422('0x24')]=function(_0x2df71a,_0x5c3cb8){return db['FreshdeskField'][_0xf422('0x43')]({'where':{'id':_0x2df71a['params']['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x5c3cb8,null))[_0xf422('0x25')](removeEntity(_0x5c3cb8,null))[_0xf422('0x45')](handleError(_0x5c3cb8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index c469734..fb0084a 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 _0x6e67=['define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x8b7b6c,_0x320191){var _0xba5553=function(_0x32c41a){while(--_0x32c41a){_0x8b7b6c['push'](_0x8b7b6c['shift']());}};_0xba5553(++_0x320191);}(_0x6e67,0x1f3));var _0x76e6=function(_0x34022f,_0x21134c){_0x34022f=_0x34022f-0x0;var _0x1bebdf=_0x6e67[_0x34022f];return _0x1bebdf;};'use strict';var _=require(_0x76e6('0x0'));var util=require(_0x76e6('0x1'));var logger=require('../../config/logger')(_0x76e6('0x2'));var moment=require('moment');var BPromise=require(_0x76e6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76e6('0x4'));var rimraf=require(_0x76e6('0x5'));var config=require(_0x76e6('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x76e6('0x7')]=function(_0xe68711,_0x263177){return _0xe68711[_0x76e6('0x8')]('FreshdeskField',attributes,{'tableName':_0x76e6('0x9'),'paranoid':![],'indexes':[{'name':_0x76e6('0xa'),'fields':[_0x76e6('0xb'),_0x76e6('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11db=['exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0xcaf223,_0xd39f07){var _0x17e00d=function(_0xe2852e){while(--_0xe2852e){_0xcaf223['push'](_0xcaf223['shift']());}};_0x17e00d(++_0xd39f07);}(_0x11db,0x146));var _0xb11d=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0x11db[_0x27bcf5];return _0x4ce4cf;};'use strict';var _=require(_0xb11d('0x0'));var util=require(_0xb11d('0x1'));var logger=require(_0xb11d('0x2'))(_0xb11d('0x3'));var moment=require(_0xb11d('0x4'));var BPromise=require('bluebird');var rp=require(_0xb11d('0x5'));var fs=require('fs');var path=require(_0xb11d('0x6'));var rimraf=require(_0xb11d('0x7'));var config=require(_0xb11d('0x8'));var attributes=require(_0xb11d('0x9'));module[_0xb11d('0xa')]=function(_0x5f7a31,_0x300fcc){return _0x5f7a31[_0xb11d('0xb')](_0xb11d('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xb11d('0xd'),'fields':[_0xb11d('0xe'),_0xb11d('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index e17d20c..4f2ed78 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 _0x5999=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x5999,0x7f));var _0x9599=function(_0x364718,_0x2f94e9){_0x364718=_0x364718-0x0;var _0x5061fa=_0x5999[_0x364718];return _0x5061fa;};'use strict';var _=require(_0x9599('0x0'));var util=require(_0x9599('0x1'));var moment=require('moment');var BPromise=require(_0x9599('0x2'));var rs=require(_0x9599('0x3'));var fs=require('fs');var Redis=require(_0x9599('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9599('0x5'));var config=require('../../config/environment');var jayson=require(_0x9599('0x6'));var client=jayson[_0x9599('0x7')][_0x9599('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2175cd,_0x3f640d,_0x521c11){return new BPromise(function(_0x30235b,_0x2dd702){return client[_0x9599('0x9')](_0x2175cd,_0x521c11)[_0x9599('0xa')](function(_0x5adeda){logger['info'](_0x9599('0xb'),_0x3f640d,_0x9599('0xc'));logger[_0x9599('0xd')](_0x9599('0xe'),_0x3f640d,'request\x20sent',JSON['stringify'](_0x5adeda));if(_0x5adeda[_0x9599('0xf')]){if(_0x5adeda[_0x9599('0xf')][_0x9599('0x10')]===0x1f4){logger[_0x9599('0xf')](_0x9599('0xb'),_0x3f640d,_0x5adeda[_0x9599('0xf')][_0x9599('0x11')]);return _0x2dd702(_0x5adeda[_0x9599('0xf')]['message']);}logger[_0x9599('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x3f640d,_0x5adeda['error'][_0x9599('0x11')]);return _0x30235b(_0x5adeda[_0x9599('0xf')][_0x9599('0x11')]);}else{logger[_0x9599('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x3f640d,_0x9599('0xc'));_0x30235b(_0x5adeda[_0x9599('0x13')]['message']);}})['catch'](function(_0x555893){logger['error'](_0x9599('0xb'),_0x3f640d,_0x555893);_0x2dd702(_0x555893);});});} \ No newline at end of file +var _0x423a=['error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x317c71,_0x524498){var _0xbf3b06=function(_0x1ea3ea){while(--_0x1ea3ea){_0x317c71['push'](_0x317c71['shift']());}};_0xbf3b06(++_0x524498);}(_0x423a,0x14a));var _0xa423=function(_0x39b2f7,_0x1cc006){_0x39b2f7=_0x39b2f7-0x0;var _0xf7c96c=_0x423a[_0x39b2f7];return _0xf7c96c;};'use strict';var _=require(_0xa423('0x0'));var util=require(_0xa423('0x1'));var moment=require(_0xa423('0x2'));var BPromise=require(_0xa423('0x3'));var rs=require(_0xa423('0x4'));var fs=require('fs');var Redis=require(_0xa423('0x5'));var db=require(_0xa423('0x6'))['db'];var utils=require(_0xa423('0x7'));var logger=require(_0xa423('0x8'))(_0xa423('0x9'));var config=require(_0xa423('0xa'));var jayson=require(_0xa423('0xb'));var client=jayson[_0xa423('0xc')][_0xa423('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x13e7d6,_0x21ab9c,_0x211e85){return new BPromise(function(_0x3414c6,_0x38d223){return client[_0xa423('0xe')](_0x13e7d6,_0x211e85)[_0xa423('0xf')](function(_0x2c5998){logger['info'](_0xa423('0x10'),_0x21ab9c,_0xa423('0x11'));logger[_0xa423('0x12')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x21ab9c,_0xa423('0x11'),JSON[_0xa423('0x13')](_0x2c5998));if(_0x2c5998['error']){if(_0x2c5998[_0xa423('0x14')]['code']===0x1f4){logger[_0xa423('0x14')](_0xa423('0x10'),_0x21ab9c,_0x2c5998[_0xa423('0x14')]['message']);return _0x38d223(_0x2c5998[_0xa423('0x14')][_0xa423('0x15')]);}logger[_0xa423('0x14')](_0xa423('0x10'),_0x21ab9c,_0x2c5998[_0xa423('0x14')][_0xa423('0x15')]);return _0x3414c6(_0x2c5998[_0xa423('0x14')][_0xa423('0x15')]);}else{logger[_0xa423('0x16')](_0xa423('0x10'),_0x21ab9c,_0xa423('0x11'));_0x3414c6(_0x2c5998[_0xa423('0x17')][_0xa423('0x15')]);}})[_0xa423('0x18')](function(_0x3041f1){logger[_0xa423('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x21ab9c,_0x3041f1);_0x38d223(_0x3041f1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a148208..8987434 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 _0xb7e7=['put','update','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x2cdcf9,_0x8a09d1){var _0x39412d=function(_0x7b476e){while(--_0x7b476e){_0x2cdcf9['push'](_0x2cdcf9['shift']());}};_0x39412d(++_0x8a09d1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xb7e7[_0x75f869];return _0x10af8b;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x12')]);router[_0x7b7e('0x13')]('/:id',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['delete'](_0x7b7e('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b7e('0x15')]=router; \ No newline at end of file +var _0x16d2=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x16d2,0x123));var _0x216d=function(_0x34190e,_0x50ecc7){_0x34190e=_0x34190e-0x0;var _0x41a4e6=_0x16d2[_0x34190e];return _0x41a4e6;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['getFields']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),controller[_0x216d('0x13')]);router[_0x216d('0x12')](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x14')]);router[_0x216d('0x15')]('/:id',auth[_0x216d('0xb')](),controller['update']);router[_0x216d('0x16')](_0x216d('0xd'),auth['isAuthenticated'](),controller[_0x216d('0x17')]);module[_0x216d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b4d6a21..4c1c2aa 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 _0x4b17=['username','sequelize','STRING'];(function(_0x3ee6ae,_0x17339b){var _0xdd1459=function(_0x115cfd){while(--_0x115cfd){_0x3ee6ae['push'](_0x3ee6ae['shift']());}};_0xdd1459(++_0x17339b);}(_0x4b17,0x10f));var _0x74b1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4b17[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x74b1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x74b1('0x1')],'unique':_0x74b1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x74b1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x77e6=['STRING','username','sequelize','exports'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x77e6,0x1a6));var _0x677e=function(_0x153505,_0x128c26){_0x153505=_0x153505-0x0;var _0x2d970b=_0x77e6[_0x153505];return _0x2d970b;};'use strict';var Sequelize=require(_0x677e('0x0'));module[_0x677e('0x1')]={'name':{'type':Sequelize[_0x677e('0x2')]},'description':{'type':Sequelize[_0x677e('0x2')]},'username':{'type':Sequelize[_0x677e('0x2')],'unique':_0x677e('0x3')},'apiKey':{'type':Sequelize[_0x677e('0x2')]},'remoteUri':{'type':Sequelize[_0x677e('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x677e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 137c095..41042d9 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 _0xca67=['findOne','FreshsalesConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','slice','substring','GET','/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshsalesAccount','show','params','keys','rawAttributes','length','find','catch','create','body','update','getConfigurations'];(function(_0x253f61,_0x1ccb64){var _0x1c0c12=function(_0x2a01c8){while(--_0x2a01c8){_0x253f61['push'](_0x253f61['shift']());}};_0x1c0c12(++_0x1ccb64);}(_0xca67,0xed));var _0x7ca6=function(_0x3e90ff,_0x56e321){_0x3e90ff=_0x3e90ff-0x0;var _0x4d921a=_0xca67[_0x3e90ff];return _0x4d921a;};'use strict';var emlformat=require(_0x7ca6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7ca6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ca6('0x2'));var BPromise=require(_0x7ca6('0x3'));var Mustache=require(_0x7ca6('0x4'));var util=require(_0x7ca6('0x5'));var path=require(_0x7ca6('0x6'));var sox=require(_0x7ca6('0x7'));var csv=require(_0x7ca6('0x8'));var ejs=require(_0x7ca6('0x9'));var fs=require('fs');var fs_extra=require(_0x7ca6('0xa'));var _=require(_0x7ca6('0xb'));var squel=require(_0x7ca6('0xc'));var crypto=require(_0x7ca6('0xd'));var jsforce=require(_0x7ca6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7ca6('0x8'));var querystring=require(_0x7ca6('0xf'));var Papa=require('papaparse');var Redis=require(_0x7ca6('0x10'));var authService=require(_0x7ca6('0x11'));var qs=require(_0x7ca6('0x12'));var as=require(_0x7ca6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ca6('0x14'))(_0x7ca6('0x15'));var utils=require(_0x7ca6('0x16'));var config=require(_0x7ca6('0x17'));var licenseUtil=require(_0x7ca6('0x18'));var db=require(_0x7ca6('0x19'))['db'];var integrations=require(_0x7ca6('0x1a'));function respondWithStatusCode(_0x1d5459,_0x567ef6){_0x567ef6=_0x567ef6||0xcc;return function(_0x4e6171){if(_0x4e6171){return _0x1d5459[_0x7ca6('0x1b')](_0x567ef6);}return _0x1d5459[_0x7ca6('0x1c')](_0x567ef6)[_0x7ca6('0x1d')]();};}function respondWithResult(_0x4ba9a2,_0xdacd78){_0xdacd78=_0xdacd78||0xc8;return function(_0x19d848){if(_0x19d848){return _0x4ba9a2[_0x7ca6('0x1c')](_0xdacd78)['json'](_0x19d848);}};}function respondWithFilteredResult(_0x27de38,_0x4ffb71){return function(_0x6cae3c){if(_0x6cae3c){var _0x4fba5=typeof _0x4ffb71[_0x7ca6('0x1e')]===_0x7ca6('0x1f')&&typeof _0x4ffb71[_0x7ca6('0x20')]===_0x7ca6('0x1f');var _0x33b15e=_0x6cae3c[_0x7ca6('0x21')];var _0x466990=_0x4fba5?0x0:_0x4ffb71[_0x7ca6('0x1e')];var _0x9da2ba=_0x4fba5?_0x6cae3c['count']:_0x4ffb71[_0x7ca6('0x1e')]+_0x4ffb71[_0x7ca6('0x20')];var _0x5dea04;if(_0x9da2ba>=_0x33b15e){_0x9da2ba=_0x33b15e;_0x5dea04=0xc8;}else{_0x5dea04=0xce;}_0x27de38[_0x7ca6('0x1c')](_0x5dea04);return _0x27de38[_0x7ca6('0x22')]('Content-Range',_0x466990+'-'+_0x9da2ba+'/'+_0x33b15e)[_0x7ca6('0x23')](_0x6cae3c);}return null;};}function patchUpdates(_0x499f89){return function(_0x521eae){try{jsonpatch['apply'](_0x521eae,_0x499f89,!![]);}catch(_0x56652b){return BPromise[_0x7ca6('0x24')](_0x56652b);}return _0x521eae[_0x7ca6('0x25')]();};}function saveUpdates(_0x5ef527,_0x3b0bb3){return function(_0x5184dc){if(_0x5184dc){return _0x5184dc['update'](_0x5ef527)[_0x7ca6('0x26')](function(_0x3f415b){return _0x3f415b;});}return null;};}function removeEntity(_0x5a0329,_0x5a77a4){return function(_0x4632d4){if(_0x4632d4){return _0x4632d4[_0x7ca6('0x27')]()[_0x7ca6('0x26')](function(){_0x5a0329[_0x7ca6('0x1c')](0xcc)[_0x7ca6('0x1d')]();});}};}function handleEntityNotFound(_0x3e51c0,_0x120701){return function(_0x533897){if(!_0x533897){_0x3e51c0[_0x7ca6('0x1b')](0x194);}return _0x533897;};}function handleError(_0x2b1864,_0x57b143){_0x57b143=_0x57b143||0x1f4;return function(_0x44ba16){logger[_0x7ca6('0x28')](_0x44ba16[_0x7ca6('0x29')]);if(_0x44ba16['name']){delete _0x44ba16[_0x7ca6('0x2a')];}_0x2b1864[_0x7ca6('0x1c')](_0x57b143)[_0x7ca6('0x2b')](_0x44ba16);};}exports[_0x7ca6('0x2c')]=function(_0x10b175,_0x13b0ee){var _0x4759f2={},_0x3ae5b3={},_0x58c984={'count':0x0,'rows':[]};var _0xbf299d=_[_0x7ca6('0x2d')](db['FreshsalesAccount']['rawAttributes'],function(_0x112eb0){return{'name':_0x112eb0[_0x7ca6('0x2e')],'type':_0x112eb0[_0x7ca6('0x2f')][_0x7ca6('0x30')]};});_0x3ae5b3[_0x7ca6('0x31')]=_['map'](_0xbf299d,'name');_0x3ae5b3['query']=_['keys'](_0x10b175[_0x7ca6('0x32')]);_0x3ae5b3[_0x7ca6('0x33')]=_['intersection'](_0x3ae5b3['model'],_0x3ae5b3[_0x7ca6('0x32')]);_0x4759f2[_0x7ca6('0x34')]=_[_0x7ca6('0x35')](_0x3ae5b3[_0x7ca6('0x31')],qs[_0x7ca6('0x36')](_0x10b175[_0x7ca6('0x32')][_0x7ca6('0x36')]));_0x4759f2['attributes']=_0x4759f2[_0x7ca6('0x34')]['length']?_0x4759f2[_0x7ca6('0x34')]:_0x3ae5b3[_0x7ca6('0x31')];if(!_0x10b175[_0x7ca6('0x32')]['hasOwnProperty'](_0x7ca6('0x37'))){_0x4759f2[_0x7ca6('0x20')]=qs[_0x7ca6('0x20')](_0x10b175['query'][_0x7ca6('0x20')]);_0x4759f2[_0x7ca6('0x1e')]=qs[_0x7ca6('0x1e')](_0x10b175[_0x7ca6('0x32')][_0x7ca6('0x1e')]);}_0x4759f2[_0x7ca6('0x38')]=qs[_0x7ca6('0x39')](_0x10b175['query'][_0x7ca6('0x39')]);_0x4759f2[_0x7ca6('0x3a')]=qs[_0x7ca6('0x33')](_[_0x7ca6('0x3b')](_0x10b175['query'],_0x3ae5b3[_0x7ca6('0x33')]),_0xbf299d);if(_0x10b175[_0x7ca6('0x32')][_0x7ca6('0x3c')]){_0x4759f2[_0x7ca6('0x3a')]=_[_0x7ca6('0x3d')](_0x4759f2[_0x7ca6('0x3a')],{'$or':_[_0x7ca6('0x2d')](_0xbf299d,function(_0x41fb9b){if(_0x41fb9b[_0x7ca6('0x2f')]!==_0x7ca6('0x3e')){var _0x5b340b={};_0x5b340b[_0x41fb9b[_0x7ca6('0x2a')]]={'$like':'%'+_0x10b175['query'][_0x7ca6('0x3c')]+'%'};return _0x5b340b;}})});}_0x4759f2=_[_0x7ca6('0x3d')]({},_0x4759f2,_0x10b175[_0x7ca6('0x3f')]);var _0xdefb7d={'where':_0x4759f2[_0x7ca6('0x3a')]};return db['FreshsalesAccount'][_0x7ca6('0x21')](_0xdefb7d)[_0x7ca6('0x26')](function(_0x8c018a){_0x58c984[_0x7ca6('0x21')]=_0x8c018a;if(_0x10b175['query'][_0x7ca6('0x40')]){_0x4759f2[_0x7ca6('0x41')]=[{'all':!![]}];}return db[_0x7ca6('0x42')]['findAll'](_0x4759f2);})[_0x7ca6('0x26')](function(_0x5e25b2){_0x58c984['rows']=_0x5e25b2;return _0x58c984;})['then'](respondWithFilteredResult(_0x13b0ee,_0x4759f2))['catch'](handleError(_0x13b0ee,null));};exports[_0x7ca6('0x43')]=function(_0x4a36a5,_0x4c0234){var _0x44597a={'raw':![],'where':{'id':_0x4a36a5[_0x7ca6('0x44')]['id']}},_0x5efef3={};_0x5efef3[_0x7ca6('0x31')]=_[_0x7ca6('0x45')](db[_0x7ca6('0x42')][_0x7ca6('0x46')]);_0x5efef3[_0x7ca6('0x32')]=_[_0x7ca6('0x45')](_0x4a36a5[_0x7ca6('0x32')]);_0x5efef3['filters']=_[_0x7ca6('0x35')](_0x5efef3['model'],_0x5efef3[_0x7ca6('0x32')]);_0x44597a[_0x7ca6('0x34')]=_[_0x7ca6('0x35')](_0x5efef3[_0x7ca6('0x31')],qs[_0x7ca6('0x36')](_0x4a36a5[_0x7ca6('0x32')]['fields']));_0x44597a['attributes']=_0x44597a[_0x7ca6('0x34')][_0x7ca6('0x47')]?_0x44597a['attributes']:_0x5efef3[_0x7ca6('0x31')];if(_0x4a36a5['query'][_0x7ca6('0x40')]){_0x44597a[_0x7ca6('0x41')]=[{'all':!![]}];}_0x44597a=_['merge']({},_0x44597a,_0x4a36a5['options']);return db[_0x7ca6('0x42')][_0x7ca6('0x48')](_0x44597a)[_0x7ca6('0x26')](handleEntityNotFound(_0x4c0234,null))[_0x7ca6('0x26')](respondWithResult(_0x4c0234,null))[_0x7ca6('0x49')](handleError(_0x4c0234,null));};exports[_0x7ca6('0x4a')]=function(_0x41525c,_0x189b9e){return db[_0x7ca6('0x42')][_0x7ca6('0x4a')](_0x41525c[_0x7ca6('0x4b')],{})[_0x7ca6('0x26')](respondWithResult(_0x189b9e,0xc9))[_0x7ca6('0x49')](handleError(_0x189b9e,null));};exports[_0x7ca6('0x4c')]=function(_0x5f32a2,_0x1c7a68){if(_0x5f32a2[_0x7ca6('0x4b')]['id']){delete _0x5f32a2[_0x7ca6('0x4b')]['id'];}return db[_0x7ca6('0x42')][_0x7ca6('0x48')]({'where':{'id':_0x5f32a2['params']['id']}})['then'](handleEntityNotFound(_0x1c7a68,null))['then'](saveUpdates(_0x5f32a2[_0x7ca6('0x4b')],null))[_0x7ca6('0x26')](respondWithResult(_0x1c7a68,null))['catch'](handleError(_0x1c7a68,null));};exports[_0x7ca6('0x27')]=function(_0xca40e5,_0x591851){return db[_0x7ca6('0x42')][_0x7ca6('0x48')]({'where':{'id':_0xca40e5[_0x7ca6('0x44')]['id']}})[_0x7ca6('0x26')](handleEntityNotFound(_0x591851,null))[_0x7ca6('0x26')](removeEntity(_0x591851,null))[_0x7ca6('0x49')](handleError(_0x591851,null));};exports[_0x7ca6('0x4d')]=function(_0x1c6f70,_0x15bea1,_0xb9366c){var _0x39e502={};var _0x181c53={};var _0x154229;var _0x1e5e57;return db['FreshsalesAccount'][_0x7ca6('0x4e')]({'where':{'id':_0x1c6f70['params']['id']}})[_0x7ca6('0x26')](handleEntityNotFound(_0x15bea1,null))[_0x7ca6('0x26')](function(_0x568d2c){if(_0x568d2c){_0x154229=_0x568d2c;_0x181c53[_0x7ca6('0x31')]=_['keys'](db[_0x7ca6('0x4f')][_0x7ca6('0x46')]);_0x181c53[_0x7ca6('0x32')]=_[_0x7ca6('0x45')](_0x1c6f70[_0x7ca6('0x32')]);_0x181c53[_0x7ca6('0x33')]=_[_0x7ca6('0x35')](_0x181c53['model'],_0x181c53[_0x7ca6('0x32')]);_0x39e502[_0x7ca6('0x34')]=_[_0x7ca6('0x35')](_0x181c53[_0x7ca6('0x31')],qs['fields'](_0x1c6f70['query'][_0x7ca6('0x36')]));_0x39e502[_0x7ca6('0x34')]=_0x39e502[_0x7ca6('0x34')]['length']?_0x39e502[_0x7ca6('0x34')]:_0x181c53['model'];_0x39e502[_0x7ca6('0x38')]=qs[_0x7ca6('0x39')](_0x1c6f70[_0x7ca6('0x32')]['sort']);_0x39e502['where']=qs[_0x7ca6('0x33')](_[_0x7ca6('0x3b')](_0x1c6f70['query'],_0x181c53[_0x7ca6('0x33')]));if(_0x1c6f70['query'][_0x7ca6('0x3c')]){_0x39e502[_0x7ca6('0x3a')]=_['merge'](_0x39e502['where'],{'$or':_[_0x7ca6('0x2d')](_0x39e502['attributes'],function(_0xeac0dc){var _0x26063e={};_0x26063e[_0xeac0dc]={'$like':'%'+_0x1c6f70[_0x7ca6('0x32')]['filter']+'%'};return _0x26063e;})});}_0x39e502=_[_0x7ca6('0x3d')]({},_0x39e502,_0x1c6f70[_0x7ca6('0x3f')]);return _0x154229[_0x7ca6('0x4d')](_0x39e502);}})[_0x7ca6('0x26')](function(_0x6aadcf){if(_0x6aadcf){_0x1e5e57=_0x6aadcf[_0x7ca6('0x47')];if(!_0x1c6f70[_0x7ca6('0x32')][_0x7ca6('0x50')](_0x7ca6('0x37'))){_0x39e502[_0x7ca6('0x20')]=qs['limit'](_0x1c6f70[_0x7ca6('0x32')][_0x7ca6('0x20')]);_0x39e502[_0x7ca6('0x1e')]=qs['offset'](_0x1c6f70[_0x7ca6('0x32')]['offset']);}return _0x154229[_0x7ca6('0x4d')](_0x39e502);}})[_0x7ca6('0x26')](function(_0x378900){if(_0x378900){return _0x378900?{'count':_0x1e5e57,'rows':_0x378900}:null;}})[_0x7ca6('0x26')](respondWithResult(_0x15bea1,null))[_0x7ca6('0x49')](handleError(_0x15bea1,null));};exports[_0x7ca6('0x51')]=function(_0x19d605,_0x5cd2b3,_0x42f834){if(_0x19d605[_0x7ca6('0x4b')]['id']){delete _0x19d605['body']['id'];}return db[_0x7ca6('0x42')][_0x7ca6('0x4e')]({'where':{'id':_0x19d605[_0x7ca6('0x44')]['id']}})[_0x7ca6('0x26')](handleEntityNotFound(_0x5cd2b3,null))[_0x7ca6('0x26')](function(_0x183fb2){if(_0x183fb2){_0x19d605[_0x7ca6('0x4b')][_0x7ca6('0x52')]=_0x183fb2['id'];_0x19d605['body']['Subjects']=integrations[_0x7ca6('0x53')](_0x19d605[_0x7ca6('0x4b')][_0x7ca6('0x54')],_0x19d605[_0x7ca6('0x4b')][_0x7ca6('0x2f')]);_0x19d605[_0x7ca6('0x4b')][_0x7ca6('0x55')]=integrations[_0x7ca6('0x56')](_0x19d605[_0x7ca6('0x4b')][_0x7ca6('0x54')],_0x19d605[_0x7ca6('0x4b')][_0x7ca6('0x2f')]);return db[_0x7ca6('0x4f')]['create'](_0x19d605[_0x7ca6('0x4b')],{'include':[{'model':db[_0x7ca6('0x57')],'as':_0x7ca6('0x58')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x7ca6('0x26')](respondWithResult(_0x5cd2b3,null))[_0x7ca6('0x49')](handleError(_0x5cd2b3,null));};exports[_0x7ca6('0x59')]=function(_0x38d443,_0x17ce1a,_0x1163d3){var _0x9e0e45='';var _0x29c5dd='';return db[_0x7ca6('0x42')][_0x7ca6('0x4e')]({'where':{'id':_0x38d443[_0x7ca6('0x44')]['id']},'attributes':['id',_0x7ca6('0x5a'),_0x7ca6('0x5b'),'apiKey']})[_0x7ca6('0x26')](handleEntityNotFound(_0x17ce1a,null))['then'](function(_0x101c1b){if(_0x101c1b){_0x29c5dd=_0x101c1b[_0x7ca6('0x5a')];_0x9e0e45=_0x101c1b[_0x7ca6('0x5b')];var _0x2fc7a1=_0x101c1b[_0x7ca6('0x5b')][_0x7ca6('0x5c')](-0x1);if(_0x2fc7a1==='/'){_0x9e0e45=_0x9e0e45[_0x7ca6('0x5d')](0x0,_0x9e0e45['lastIndexOf'](_0x2fc7a1));}return rp({'method':_0x7ca6('0x5e'),'uri':util['format']('%s%s',_0x9e0e45,_0x7ca6('0x5f')),'headers':{'Authorization':_0x7ca6('0x60')+_0x101c1b[_0x7ca6('0x61')]},'json':!![]});}})['then'](function(_0x8e9546){if(_0x8e9546){var _0x423e50=_0x8e9546['users'];var _0x90ddec=![];var _0x19840d=null;for(_0x19840d=0x0;_0x19840d<_0x423e50['length'];_0x19840d++){if(_0x423e50[_0x19840d][_0x7ca6('0x62')]===_0x29c5dd){_0x90ddec=!![];}}if(_0x90ddec){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7ca6('0x63')});}}})[_0x7ca6('0x26')](respondWithResult(_0x17ce1a,null))[_0x7ca6('0x49')](function(_0x216cc5){var _0xee7817=_0x38d443['query'][_0x7ca6('0x64')]?0x1f4:_0x216cc5['statusCode']||0x1f4;logger[_0x7ca6('0x28')](_0x7ca6('0x65'),_0x7ca6('0x59'),_0xee7817,JSON[_0x7ca6('0x66')](_0x216cc5));delete _0x216cc5[_0x7ca6('0x2a')];if(_0xee7817===0x191){_0xee7817=0x190;}_0x17ce1a[_0x7ca6('0x1c')](_0xee7817)[_0x7ca6('0x2b')](_0x38d443['query'][_0x7ca6('0x64')]?{'message':_0x7ca6('0x67'),'statusCode':_0x216cc5[_0x7ca6('0x68')]}:_0x216cc5);});}; \ No newline at end of file +var _0xc977=['mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','rawAttributes','length','pick','addConfiguration','AccountId','Subjects','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','format','%s%s','/api/selector/owners','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc977,0x191));var _0x7c97=function(_0x357f0a,_0x37aa60){_0x357f0a=_0x357f0a-0x0;var _0x10d41b=_0xc977[_0x357f0a];return _0x10d41b;};'use strict';var emlformat=require(_0x7c97('0x0'));var rimraf=require(_0x7c97('0x1'));var zipdir=require(_0x7c97('0x2'));var jsonpatch=require(_0x7c97('0x3'));var rp=require(_0x7c97('0x4'));var moment=require(_0x7c97('0x5'));var BPromise=require(_0x7c97('0x6'));var Mustache=require(_0x7c97('0x7'));var util=require(_0x7c97('0x8'));var path=require(_0x7c97('0x9'));var sox=require('sox');var csv=require(_0x7c97('0xa'));var ejs=require(_0x7c97('0xb'));var fs=require('fs');var fs_extra=require(_0x7c97('0xc'));var _=require(_0x7c97('0xd'));var squel=require('squel');var crypto=require(_0x7c97('0xe'));var jsforce=require(_0x7c97('0xf'));var deskjs=require(_0x7c97('0x10'));var toCsv=require(_0x7c97('0xa'));var querystring=require(_0x7c97('0x11'));var Papa=require(_0x7c97('0x12'));var Redis=require(_0x7c97('0x13'));var authService=require(_0x7c97('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7c97('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c97('0x16'))(_0x7c97('0x17'));var utils=require(_0x7c97('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7c97('0x19'));var db=require(_0x7c97('0x1a'))['db'];var integrations=require(_0x7c97('0x1b'));function respondWithStatusCode(_0x45c645,_0x56ffad){_0x56ffad=_0x56ffad||0xcc;return function(_0x49e166){if(_0x49e166){return _0x45c645[_0x7c97('0x1c')](_0x56ffad);}return _0x45c645[_0x7c97('0x1d')](_0x56ffad)['end']();};}function respondWithResult(_0x40bcd5,_0x312f30){_0x312f30=_0x312f30||0xc8;return function(_0x884c6b){if(_0x884c6b){return _0x40bcd5['status'](_0x312f30)[_0x7c97('0x1e')](_0x884c6b);}};}function respondWithFilteredResult(_0x319dc5,_0x329fe7){return function(_0x31994b){if(_0x31994b){var _0x8b81a6=typeof _0x329fe7['offset']===_0x7c97('0x1f')&&typeof _0x329fe7[_0x7c97('0x20')]===_0x7c97('0x1f');var _0x22110b=_0x31994b[_0x7c97('0x21')];var _0x359b04=_0x8b81a6?0x0:_0x329fe7[_0x7c97('0x22')];var _0x1cf2ab=_0x8b81a6?_0x31994b[_0x7c97('0x21')]:_0x329fe7['offset']+_0x329fe7[_0x7c97('0x20')];var _0x1d58bc;if(_0x1cf2ab>=_0x22110b){_0x1cf2ab=_0x22110b;_0x1d58bc=0xc8;}else{_0x1d58bc=0xce;}_0x319dc5[_0x7c97('0x1d')](_0x1d58bc);return _0x319dc5[_0x7c97('0x23')](_0x7c97('0x24'),_0x359b04+'-'+_0x1cf2ab+'/'+_0x22110b)[_0x7c97('0x1e')](_0x31994b);}return null;};}function patchUpdates(_0x315c27){return function(_0x4cc69b){try{jsonpatch[_0x7c97('0x25')](_0x4cc69b,_0x315c27,!![]);}catch(_0x4ecfde){return BPromise[_0x7c97('0x26')](_0x4ecfde);}return _0x4cc69b[_0x7c97('0x27')]();};}function saveUpdates(_0x2e1a79,_0x5b4d7d){return function(_0x14be47){if(_0x14be47){return _0x14be47['update'](_0x2e1a79)[_0x7c97('0x28')](function(_0x2f3f45){return _0x2f3f45;});}return null;};}function removeEntity(_0x100fd1,_0x1569ed){return function(_0x164831){if(_0x164831){return _0x164831[_0x7c97('0x29')]()[_0x7c97('0x28')](function(){_0x100fd1[_0x7c97('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x101f8f,_0x2db7d4){return function(_0x3b9688){if(!_0x3b9688){_0x101f8f[_0x7c97('0x1c')](0x194);}return _0x3b9688;};}function handleError(_0x2aa488,_0x2d59b9){_0x2d59b9=_0x2d59b9||0x1f4;return function(_0x5d13e8){logger[_0x7c97('0x2a')](_0x5d13e8[_0x7c97('0x2b')]);if(_0x5d13e8['name']){delete _0x5d13e8[_0x7c97('0x2c')];}_0x2aa488['status'](_0x2d59b9)[_0x7c97('0x2d')](_0x5d13e8);};}exports[_0x7c97('0x2e')]=function(_0x20ec9a,_0x2fb664){var _0x3e1036={},_0x3df2da={},_0x37e25d={'count':0x0,'rows':[]};var _0x25cba5=_[_0x7c97('0x2f')](db[_0x7c97('0x30')]['rawAttributes'],function(_0xa4b48){return{'name':_0xa4b48[_0x7c97('0x31')],'type':_0xa4b48['type']['key']};});_0x3df2da[_0x7c97('0x32')]=_[_0x7c97('0x2f')](_0x25cba5,_0x7c97('0x2c'));_0x3df2da[_0x7c97('0x33')]=_[_0x7c97('0x34')](_0x20ec9a[_0x7c97('0x33')]);_0x3df2da[_0x7c97('0x35')]=_[_0x7c97('0x36')](_0x3df2da['model'],_0x3df2da[_0x7c97('0x33')]);_0x3e1036[_0x7c97('0x37')]=_[_0x7c97('0x36')](_0x3df2da['model'],qs['fields'](_0x20ec9a[_0x7c97('0x33')][_0x7c97('0x38')]));_0x3e1036['attributes']=_0x3e1036[_0x7c97('0x37')]['length']?_0x3e1036['attributes']:_0x3df2da[_0x7c97('0x32')];if(!_0x20ec9a['query'][_0x7c97('0x39')](_0x7c97('0x3a'))){_0x3e1036[_0x7c97('0x20')]=qs[_0x7c97('0x20')](_0x20ec9a[_0x7c97('0x33')][_0x7c97('0x20')]);_0x3e1036[_0x7c97('0x22')]=qs[_0x7c97('0x22')](_0x20ec9a[_0x7c97('0x33')][_0x7c97('0x22')]);}_0x3e1036[_0x7c97('0x3b')]=qs[_0x7c97('0x3c')](_0x20ec9a[_0x7c97('0x33')][_0x7c97('0x3c')]);_0x3e1036[_0x7c97('0x3d')]=qs[_0x7c97('0x35')](_['pick'](_0x20ec9a[_0x7c97('0x33')],_0x3df2da[_0x7c97('0x35')]),_0x25cba5);if(_0x20ec9a['query'][_0x7c97('0x3e')]){_0x3e1036[_0x7c97('0x3d')]=_[_0x7c97('0x3f')](_0x3e1036[_0x7c97('0x3d')],{'$or':_[_0x7c97('0x2f')](_0x25cba5,function(_0x523bfb){if(_0x523bfb[_0x7c97('0x40')]!==_0x7c97('0x41')){var _0x2612e5={};_0x2612e5[_0x523bfb[_0x7c97('0x2c')]]={'$like':'%'+_0x20ec9a['query']['filter']+'%'};return _0x2612e5;}})});}_0x3e1036=_[_0x7c97('0x3f')]({},_0x3e1036,_0x20ec9a[_0x7c97('0x42')]);var _0x35bdfc={'where':_0x3e1036[_0x7c97('0x3d')]};return db['FreshsalesAccount']['count'](_0x35bdfc)[_0x7c97('0x28')](function(_0x44b581){_0x37e25d['count']=_0x44b581;if(_0x20ec9a[_0x7c97('0x33')][_0x7c97('0x43')]){_0x3e1036[_0x7c97('0x44')]=[{'all':!![]}];}return db[_0x7c97('0x30')]['findAll'](_0x3e1036);})[_0x7c97('0x28')](function(_0x16cf1f){_0x37e25d[_0x7c97('0x45')]=_0x16cf1f;return _0x37e25d;})[_0x7c97('0x28')](respondWithFilteredResult(_0x2fb664,_0x3e1036))[_0x7c97('0x46')](handleError(_0x2fb664,null));};exports[_0x7c97('0x47')]=function(_0x51884d,_0x4a217e){var _0x44d8cd={'raw':![],'where':{'id':_0x51884d[_0x7c97('0x48')]['id']}},_0xeb45eb={};_0xeb45eb[_0x7c97('0x32')]=_[_0x7c97('0x34')](db[_0x7c97('0x30')]['rawAttributes']);_0xeb45eb[_0x7c97('0x33')]=_[_0x7c97('0x34')](_0x51884d['query']);_0xeb45eb[_0x7c97('0x35')]=_[_0x7c97('0x36')](_0xeb45eb[_0x7c97('0x32')],_0xeb45eb[_0x7c97('0x33')]);_0x44d8cd[_0x7c97('0x37')]=_['intersection'](_0xeb45eb[_0x7c97('0x32')],qs[_0x7c97('0x38')](_0x51884d['query']['fields']));_0x44d8cd['attributes']=_0x44d8cd[_0x7c97('0x37')]['length']?_0x44d8cd['attributes']:_0xeb45eb[_0x7c97('0x32')];if(_0x51884d[_0x7c97('0x33')][_0x7c97('0x43')]){_0x44d8cd[_0x7c97('0x44')]=[{'all':!![]}];}_0x44d8cd=_[_0x7c97('0x3f')]({},_0x44d8cd,_0x51884d[_0x7c97('0x42')]);return db['FreshsalesAccount'][_0x7c97('0x49')](_0x44d8cd)['then'](handleEntityNotFound(_0x4a217e,null))[_0x7c97('0x28')](respondWithResult(_0x4a217e,null))[_0x7c97('0x46')](handleError(_0x4a217e,null));};exports[_0x7c97('0x4a')]=function(_0x29c508,_0x45cd4e){return db[_0x7c97('0x30')]['create'](_0x29c508[_0x7c97('0x4b')],{})[_0x7c97('0x28')](respondWithResult(_0x45cd4e,0xc9))['catch'](handleError(_0x45cd4e,null));};exports['update']=function(_0x30696e,_0x4b7ce7){if(_0x30696e['body']['id']){delete _0x30696e[_0x7c97('0x4b')]['id'];}return db[_0x7c97('0x30')][_0x7c97('0x49')]({'where':{'id':_0x30696e[_0x7c97('0x48')]['id']}})[_0x7c97('0x28')](handleEntityNotFound(_0x4b7ce7,null))['then'](saveUpdates(_0x30696e['body'],null))[_0x7c97('0x28')](respondWithResult(_0x4b7ce7,null))['catch'](handleError(_0x4b7ce7,null));};exports['destroy']=function(_0x2407d9,_0x220214){return db[_0x7c97('0x30')][_0x7c97('0x49')]({'where':{'id':_0x2407d9[_0x7c97('0x48')]['id']}})['then'](handleEntityNotFound(_0x220214,null))['then'](removeEntity(_0x220214,null))['catch'](handleError(_0x220214,null));};exports[_0x7c97('0x4c')]=function(_0x5e522c,_0x295c2f,_0x4c7c9d){var _0x27ec72={};var _0x44546d={};var _0x31c3ff;var _0x30bd60;return db[_0x7c97('0x30')][_0x7c97('0x4d')]({'where':{'id':_0x5e522c[_0x7c97('0x48')]['id']}})[_0x7c97('0x28')](handleEntityNotFound(_0x295c2f,null))[_0x7c97('0x28')](function(_0x30feba){if(_0x30feba){_0x31c3ff=_0x30feba;_0x44546d[_0x7c97('0x32')]=_[_0x7c97('0x34')](db['FreshsalesConfiguration'][_0x7c97('0x4e')]);_0x44546d[_0x7c97('0x33')]=_[_0x7c97('0x34')](_0x5e522c[_0x7c97('0x33')]);_0x44546d['filters']=_[_0x7c97('0x36')](_0x44546d['model'],_0x44546d[_0x7c97('0x33')]);_0x27ec72['attributes']=_[_0x7c97('0x36')](_0x44546d[_0x7c97('0x32')],qs['fields'](_0x5e522c[_0x7c97('0x33')][_0x7c97('0x38')]));_0x27ec72[_0x7c97('0x37')]=_0x27ec72[_0x7c97('0x37')][_0x7c97('0x4f')]?_0x27ec72[_0x7c97('0x37')]:_0x44546d[_0x7c97('0x32')];_0x27ec72[_0x7c97('0x3b')]=qs[_0x7c97('0x3c')](_0x5e522c[_0x7c97('0x33')][_0x7c97('0x3c')]);_0x27ec72[_0x7c97('0x3d')]=qs[_0x7c97('0x35')](_[_0x7c97('0x50')](_0x5e522c['query'],_0x44546d[_0x7c97('0x35')]));if(_0x5e522c[_0x7c97('0x33')][_0x7c97('0x3e')]){_0x27ec72['where']=_[_0x7c97('0x3f')](_0x27ec72['where'],{'$or':_['map'](_0x27ec72[_0x7c97('0x37')],function(_0x11d19e){var _0x5855e0={};_0x5855e0[_0x11d19e]={'$like':'%'+_0x5e522c[_0x7c97('0x33')][_0x7c97('0x3e')]+'%'};return _0x5855e0;})});}_0x27ec72=_[_0x7c97('0x3f')]({},_0x27ec72,_0x5e522c[_0x7c97('0x42')]);return _0x31c3ff[_0x7c97('0x4c')](_0x27ec72);}})['then'](function(_0x4c49e5){if(_0x4c49e5){_0x30bd60=_0x4c49e5['length'];if(!_0x5e522c[_0x7c97('0x33')]['hasOwnProperty'](_0x7c97('0x3a'))){_0x27ec72['limit']=qs['limit'](_0x5e522c[_0x7c97('0x33')]['limit']);_0x27ec72[_0x7c97('0x22')]=qs['offset'](_0x5e522c[_0x7c97('0x33')][_0x7c97('0x22')]);}return _0x31c3ff[_0x7c97('0x4c')](_0x27ec72);}})[_0x7c97('0x28')](function(_0x2406fd){if(_0x2406fd){return _0x2406fd?{'count':_0x30bd60,'rows':_0x2406fd}:null;}})[_0x7c97('0x28')](respondWithResult(_0x295c2f,null))['catch'](handleError(_0x295c2f,null));};exports[_0x7c97('0x51')]=function(_0x5c6db6,_0x153e47,_0x4b727b){if(_0x5c6db6[_0x7c97('0x4b')]['id']){delete _0x5c6db6[_0x7c97('0x4b')]['id'];}return db[_0x7c97('0x30')][_0x7c97('0x4d')]({'where':{'id':_0x5c6db6[_0x7c97('0x48')]['id']}})['then'](handleEntityNotFound(_0x153e47,null))[_0x7c97('0x28')](function(_0xafb287){if(_0xafb287){_0x5c6db6[_0x7c97('0x4b')][_0x7c97('0x52')]=_0xafb287['id'];_0x5c6db6[_0x7c97('0x4b')][_0x7c97('0x53')]=integrations['getSubjects'](_0x5c6db6['body']['channel'],_0x5c6db6['body'][_0x7c97('0x40')]);_0x5c6db6['body'][_0x7c97('0x54')]=integrations['getDescriptions'](_0x5c6db6['body']['channel'],_0x5c6db6[_0x7c97('0x4b')][_0x7c97('0x40')]);return db[_0x7c97('0x55')][_0x7c97('0x4a')](_0x5c6db6[_0x7c97('0x4b')],{'include':[{'model':db[_0x7c97('0x56')],'as':'Subjects'},{'model':db[_0x7c97('0x56')],'as':_0x7c97('0x54')}]});}return null;})[_0x7c97('0x28')](respondWithResult(_0x153e47,null))[_0x7c97('0x46')](handleError(_0x153e47,null));};exports[_0x7c97('0x57')]=function(_0x294eec,_0x5f2816,_0x50eba1){var _0x5188fa='';var _0x567205='';return db[_0x7c97('0x30')]['findOne']({'where':{'id':_0x294eec[_0x7c97('0x48')]['id']},'attributes':['id',_0x7c97('0x58'),_0x7c97('0x59'),_0x7c97('0x5a')]})['then'](handleEntityNotFound(_0x5f2816,null))[_0x7c97('0x28')](function(_0x3a43f9){if(_0x3a43f9){_0x567205=_0x3a43f9[_0x7c97('0x58')];_0x5188fa=_0x3a43f9['remoteUri'];var _0x201a95=_0x3a43f9[_0x7c97('0x59')][_0x7c97('0x5b')](-0x1);if(_0x201a95==='/'){_0x5188fa=_0x5188fa[_0x7c97('0x5c')](0x0,_0x5188fa['lastIndexOf'](_0x201a95));}return rp({'method':_0x7c97('0x5d'),'uri':util[_0x7c97('0x5e')](_0x7c97('0x5f'),_0x5188fa,_0x7c97('0x60')),'headers':{'Authorization':'Token\x20token='+_0x3a43f9[_0x7c97('0x5a')]},'json':!![]});}})[_0x7c97('0x28')](function(_0x23b9a1){if(_0x23b9a1){var _0x6a3bef=_0x23b9a1['users'];var _0x45f0a5=![];var _0x2aae2c=null;for(_0x2aae2c=0x0;_0x2aae2c<_0x6a3bef[_0x7c97('0x4f')];_0x2aae2c++){if(_0x6a3bef[_0x2aae2c][_0x7c97('0x61')]===_0x567205){_0x45f0a5=!![];}}if(_0x45f0a5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7c97('0x62')});}}})[_0x7c97('0x28')](respondWithResult(_0x5f2816,null))[_0x7c97('0x46')](function(_0x2c3c13){var _0x1a3a24=_0x294eec[_0x7c97('0x33')][_0x7c97('0x63')]?0x1f4:_0x2c3c13[_0x7c97('0x64')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x7c97('0x57'),_0x1a3a24,JSON[_0x7c97('0x65')](_0x2c3c13));delete _0x2c3c13[_0x7c97('0x2c')];if(_0x1a3a24===0x191){_0x1a3a24=0x190;}_0x5f2816[_0x7c97('0x1d')](_0x1a3a24)[_0x7c97('0x2d')](_0x294eec['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2c3c13[_0x7c97('0x64')]}:_0x2c3c13);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index e0bb846..bae220f 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 _0x32f4=['define','FreshsalesAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x26c501,_0x4c4715){var _0x3a9e73=function(_0x1eceb7){while(--_0x1eceb7){_0x26c501['push'](_0x26c501['shift']());}};_0x3a9e73(++_0x4c4715);}(_0x32f4,0x154));var _0x432f=function(_0x10f747,_0x1c8136){_0x10f747=_0x10f747-0x0;var _0x3ae29f=_0x32f4[_0x10f747];return _0x3ae29f;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));var integrations=require(_0x432f('0x9'));module[_0x432f('0xa')]=function(_0x5d8cc0,_0x5b5f08){return _0x5d8cc0[_0x432f('0xb')](_0x432f('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9536=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x455344,_0x12bc4f){var _0x1859fa=function(_0xcf41d6){while(--_0xcf41d6){_0x455344['push'](_0x455344['shift']());}};_0x1859fa(++_0x12bc4f);}(_0x9536,0x179));var _0x6953=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0x9536[_0x3474ac];return _0x5345ec;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));var integrations=require(_0x6953('0x9'));module['exports']=function(_0x2b273e,_0x2bb026){return _0x2b273e[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 19dfa6c..bf5d6bd 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 _0xb016=['include','model','debug','ShowFreshsalesAccount','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xb016,0x159));var _0x6b01=function(_0x46b611,_0x3b7b03){_0x46b611=_0x46b611-0x0;var _0x3ad1d1=_0xb016[_0x46b611];return _0x3ad1d1;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')]({'raw':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x18')]===undefined?!![]:![]:!![],'where':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x9c6571['options']?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1b')]||null:null,'include':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')]['include']?_[_0x6b01('0x1c')](_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1d')],function(_0x51243c){return{'model':db[_0x51243c[_0x6b01('0x1e')]],'as':_0x51243c['as'],'attributes':_0x51243c[_0x6b01('0x1a')],'include':_0x51243c[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x51243c[_0x6b01('0x1d')],function(_0x2456e9){return{'model':db[_0x2456e9[_0x6b01('0x1e')]],'as':_0x2456e9['as'],'attributes':_0x2456e9[_0x6b01('0x1a')],'include':_0x2456e9[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2456e9[_0x6b01('0x1d')],function(_0xa846d8){return{'model':db[_0xa846d8[_0x6b01('0x1e')]],'as':_0xa846d8['as'],'attributes':_0xa846d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x220efb){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1f')]('GetFreshsalesAccount',_0x9c6571,JSON['stringify'](_0x220efb));_0x18f336(_0x220efb);})[_0x6b01('0x13')](function(_0x3df3d4){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x3df3d4[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x3df3d4['message']));});});};exports[_0x6b01('0x20')]=function(_0x5482a8){var _0x3942d7=this;return new Promise(function(_0x4e7e32,_0x6920cf){return db[_0x6b01('0x15')][_0x6b01('0x21')]({'raw':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x5482a8['options']?_0x5482a8['options'][_0x6b01('0x1a')]||null:null,'include':_0x5482a8['options']?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x5482a8['options'][_0x6b01('0x1d')],function(_0x42d5f7){return{'model':db[_0x42d5f7[_0x6b01('0x1e')]],'as':_0x42d5f7['as'],'attributes':_0x42d5f7['attributes'],'include':_0x42d5f7[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x42d5f7[_0x6b01('0x1d')],function(_0x2eb34f){return{'model':db[_0x2eb34f[_0x6b01('0x1e')]],'as':_0x2eb34f['as'],'attributes':_0x2eb34f['attributes'],'include':_0x2eb34f[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2eb34f[_0x6b01('0x1d')],function(_0x5269c7){return{'model':db[_0x5269c7[_0x6b01('0x1e')]],'as':_0x5269c7['as'],'attributes':_0x5269c7[_0x6b01('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x3154d7){logger['info'](_0x6b01('0x20'),_0x5482a8);logger['debug'](_0x6b01('0x20'),_0x5482a8,JSON[_0x6b01('0xe')](_0x3154d7));_0x4e7e32(_0x3154d7);})[_0x6b01('0x13')](function(_0x318b8b){logger[_0x6b01('0xf')](_0x6b01('0x20'),_0x318b8b[_0x6b01('0x11')],_0x5482a8);_0x6920cf(_0x3942d7['error'](0x1f4,_0x318b8b[_0x6b01('0x11')]));});});}; \ No newline at end of file +var _0x7046=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowFreshsalesAccount','FreshsalesAccount','find'];(function(_0x21eb04,_0x44d5fd){var _0x53a34c=function(_0x2f3dde){while(--_0x2f3dde){_0x21eb04['push'](_0x21eb04['shift']());}};_0x53a34c(++_0x44d5fd);}(_0x7046,0x144));var _0x6704=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7046[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});}exports[_0x6704('0x17')]=function(_0x31d732){var _0x135f4b=this;return new Promise(function(_0xe49450,_0x344ed9){return db['FreshsalesAccount'][_0x6704('0x18')]({'raw':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1a')]===undefined?!![]:![]:!![],'where':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1b')]||null:null,'attributes':_0x31d732['options']?_0x31d732[_0x6704('0x19')][_0x6704('0x1c')]||null:null,'limit':_0x31d732[_0x6704('0x19')]?_0x31d732['options']['limit']||null:null,'include':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x31d732[_0x6704('0x19')]['include'],function(_0xf2c459){return{'model':db[_0xf2c459[_0x6704('0x1f')]],'as':_0xf2c459['as'],'attributes':_0xf2c459[_0x6704('0x1c')],'include':_0xf2c459[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0xf2c459[_0x6704('0x1d')],function(_0x2acafd){return{'model':db[_0x2acafd[_0x6704('0x1f')]],'as':_0x2acafd['as'],'attributes':_0x2acafd[_0x6704('0x1c')],'include':_0x2acafd[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x2acafd[_0x6704('0x1d')],function(_0x118d93){return{'model':db[_0x118d93['model']],'as':_0x118d93['as'],'attributes':_0x118d93['attributes']};}):[]};}):[]};}):[]:[]})[_0x6704('0x20')](function(_0xf875dc){logger[_0x6704('0xc')](_0x6704('0x17'),_0x31d732);logger['debug'](_0x6704('0x17'),_0x31d732,JSON[_0x6704('0x11')](_0xf875dc));_0xe49450(_0xf875dc);})['catch'](function(_0x588814){logger[_0x6704('0x12')]('GetFreshsalesAccount',_0x588814[_0x6704('0x14')],_0x31d732);_0x344ed9(_0x135f4b['error'](0x1f4,_0x588814['message']));});});};exports[_0x6704('0x21')]=function(_0x115514){var _0x45a286=this;return new Promise(function(_0x4ffa53,_0x1c7132){return db[_0x6704('0x22')][_0x6704('0x23')]({'raw':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1a')]===undefined?!![]:![]:!![],'where':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1b')]||null:null,'attributes':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1c')]||null:null,'include':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x115514[_0x6704('0x19')][_0x6704('0x1d')],function(_0x219494){return{'model':db[_0x219494[_0x6704('0x1f')]],'as':_0x219494['as'],'attributes':_0x219494[_0x6704('0x1c')],'include':_0x219494[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x219494[_0x6704('0x1d')],function(_0x30b914){return{'model':db[_0x30b914['model']],'as':_0x30b914['as'],'attributes':_0x30b914['attributes'],'include':_0x30b914['include']?_[_0x6704('0x1e')](_0x30b914[_0x6704('0x1d')],function(_0x18222f){return{'model':db[_0x18222f['model']],'as':_0x18222f['as'],'attributes':_0x18222f[_0x6704('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15da25){logger[_0x6704('0xc')](_0x6704('0x21'),_0x115514);logger[_0x6704('0xf')](_0x6704('0x21'),_0x115514,JSON[_0x6704('0x11')](_0x15da25));_0x4ffa53(_0x15da25);})[_0x6704('0x16')](function(_0x2fba31){logger['error']('ShowFreshsalesAccount',_0x2fba31[_0x6704('0x14')],_0x115514);_0x1c7132(_0x45a286[_0x6704('0x12')](0x1f4,_0x2fba31['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 79cdc45..381fdf2 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 _0x0c1f=['/:id/descriptions','getDescriptions','getFields','post','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects'];(function(_0x471b87,_0x5c79b0){var _0x2866d5=function(_0x27e1cc){while(--_0x27e1cc){_0x471b87['push'](_0x471b87['shift']());}};_0x2866d5(++_0x5c79b0);}(_0x0c1f,0x168));var _0xf0c1=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x0c1f[_0x28d18d];return _0x470640;};'use strict';var multer=require(_0xf0c1('0x0'));var util=require(_0xf0c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf0c1('0x2'));var router=express[_0xf0c1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf0c1('0x4'));var interaction=require(_0xf0c1('0x5'));var config=require(_0xf0c1('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xf0c1('0x7')]('/',auth[_0xf0c1('0x8')](),controller[_0xf0c1('0x9')]);router[_0xf0c1('0x7')](_0xf0c1('0xa'),auth[_0xf0c1('0x8')](),controller[_0xf0c1('0xb')]);router[_0xf0c1('0x7')](_0xf0c1('0xc'),auth['isAuthenticated'](),controller[_0xf0c1('0xd')]);router[_0xf0c1('0x7')](_0xf0c1('0xe'),auth[_0xf0c1('0x8')](),controller[_0xf0c1('0xf')]);router[_0xf0c1('0x7')]('/:id/fields',auth[_0xf0c1('0x8')](),controller[_0xf0c1('0x10')]);router[_0xf0c1('0x11')]('/',auth[_0xf0c1('0x8')](),controller['create']);router[_0xf0c1('0x12')](_0xf0c1('0xa'),auth[_0xf0c1('0x8')](),controller[_0xf0c1('0x13')]);router[_0xf0c1('0x14')](_0xf0c1('0xa'),auth[_0xf0c1('0x8')](),controller['destroy']);module[_0xf0c1('0x15')]=router; \ No newline at end of file +var _0x78fe=['index','get','/:id','isAuthenticated','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x13f0c4,_0x1e682b){var _0x2af030=function(_0x2a1e4f){while(--_0x2a1e4f){_0x13f0c4['push'](_0x13f0c4['shift']());}};_0x2af030(++_0x1e682b);}(_0x78fe,0x109));var _0xe78f=function(_0x2d8251,_0xa4ba5a){_0x2d8251=_0x2d8251-0x0;var _0x24769e=_0x78fe[_0x2d8251];return _0x24769e;};'use strict';var multer=require(_0xe78f('0x0'));var util=require(_0xe78f('0x1'));var path=require(_0xe78f('0x2'));var timeout=require(_0xe78f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe78f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe78f('0x5'));var config=require(_0xe78f('0x6'));var controller=require(_0xe78f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe78f('0x8')]);router[_0xe78f('0x9')](_0xe78f('0xa'),auth[_0xe78f('0xb')](),controller[_0xe78f('0xc')]);router[_0xe78f('0x9')]('/:id/subjects',auth[_0xe78f('0xb')](),controller[_0xe78f('0xd')]);router[_0xe78f('0x9')](_0xe78f('0xe'),auth[_0xe78f('0xb')](),controller[_0xe78f('0xf')]);router['get'](_0xe78f('0x10'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xe78f('0xb')](),controller[_0xe78f('0x11')]);router[_0xe78f('0x12')](_0xe78f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe78f('0x13')](_0xe78f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xe78f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1427dce..de89c2c 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 _0x696c=['sequelize','exports','STRING'];(function(_0x213da2,_0x4194f2){var _0x3e6072=function(_0x12ee76){while(--_0x12ee76){_0x213da2['push'](_0x213da2['shift']());}};_0x3e6072(++_0x4194f2);}(_0x696c,0x1dd));var _0xc696=function(_0x3a07d4,_0xa80b88){_0x3a07d4=_0x3a07d4-0x0;var _0x2c352=_0x696c[_0x3a07d4];return _0x2c352;};'use strict';var Sequelize=require(_0xc696('0x0'));module[_0xc696('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc696('0x2')]}}; \ No newline at end of file +var _0x5ee9=['STRING'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5ee9,0x11c));var _0x95ee=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x5ee9[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x95ee('0x0')]},'description':{'type':Sequelize[_0x95ee('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a876afa..e8f1dbb 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 _0xc803=['find','create','body','params','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','length'];(function(_0x2dec34,_0x42e6e2){var _0x16c5cb=function(_0x3d7ba0){while(--_0x3d7ba0){_0x2dec34['push'](_0x2dec34['shift']());}};_0x16c5cb(++_0x42e6e2);}(_0xc803,0x1b9));var _0x3c80=function(_0x141108,_0x4abce1){_0x141108=_0x141108-0x0;var _0x297777=_0xc803[_0x141108];return _0x297777;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3c80('0x0'));var rp=require(_0x3c80('0x1'));var moment=require(_0x3c80('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3c80('0x3'));var util=require(_0x3c80('0x4'));var path=require(_0x3c80('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3c80('0x6'));var fs=require('fs');var fs_extra=require(_0x3c80('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3c80('0x8'));var jsforce=require(_0x3c80('0x9'));var deskjs=require(_0x3c80('0xa'));var toCsv=require(_0x3c80('0xb'));var querystring=require(_0x3c80('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3c80('0xd'));var qs=require(_0x3c80('0xe'));var as=require(_0x3c80('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3c80('0x10'));var utils=require(_0x3c80('0x11'));var config=require(_0x3c80('0x12'));var licenseUtil=require(_0x3c80('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dd1d4,_0x532ddb){_0x532ddb=_0x532ddb||0xcc;return function(_0x14c40e){if(_0x14c40e){return _0x1dd1d4[_0x3c80('0x14')](_0x532ddb);}return _0x1dd1d4[_0x3c80('0x15')](_0x532ddb)['end']();};}function respondWithResult(_0x4a88c9,_0x58457e){_0x58457e=_0x58457e||0xc8;return function(_0x1f739c){if(_0x1f739c){return _0x4a88c9[_0x3c80('0x15')](_0x58457e)[_0x3c80('0x16')](_0x1f739c);}};}function respondWithFilteredResult(_0x4dd751,_0x15a393){return function(_0x5f52e9){if(_0x5f52e9){var _0xa19b8a=typeof _0x15a393['offset']==='undefined'&&typeof _0x15a393['limit']==='undefined';var _0x3e298e=_0x5f52e9[_0x3c80('0x17')];var _0x58a825=_0xa19b8a?0x0:_0x15a393[_0x3c80('0x18')];var _0x581f40=_0xa19b8a?_0x5f52e9[_0x3c80('0x17')]:_0x15a393[_0x3c80('0x18')]+_0x15a393[_0x3c80('0x19')];var _0x2d7904;if(_0x581f40>=_0x3e298e){_0x581f40=_0x3e298e;_0x2d7904=0xc8;}else{_0x2d7904=0xce;}_0x4dd751[_0x3c80('0x15')](_0x2d7904);return _0x4dd751[_0x3c80('0x1a')](_0x3c80('0x1b'),_0x58a825+'-'+_0x581f40+'/'+_0x3e298e)[_0x3c80('0x16')](_0x5f52e9);}return null;};}function patchUpdates(_0x133988){return function(_0x1250e1){try{jsonpatch[_0x3c80('0x1c')](_0x1250e1,_0x133988,!![]);}catch(_0x2d0afc){return BPromise[_0x3c80('0x1d')](_0x2d0afc);}return _0x1250e1[_0x3c80('0x1e')]();};}function saveUpdates(_0x5c18a9,_0x5c908e){return function(_0x3a9d1a){if(_0x3a9d1a){return _0x3a9d1a[_0x3c80('0x1f')](_0x5c18a9)[_0x3c80('0x20')](function(_0x57d591){return _0x57d591;});}return null;};}function removeEntity(_0x3500cb,_0x1e1862){return function(_0x78f28){if(_0x78f28){return _0x78f28[_0x3c80('0x21')]()[_0x3c80('0x20')](function(){_0x3500cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb80d,_0x5f915e){return function(_0x405b35){if(!_0x405b35){_0x5cb80d[_0x3c80('0x14')](0x194);}return _0x405b35;};}function handleError(_0x2c1767,_0x4f3739){_0x4f3739=_0x4f3739||0x1f4;return function(_0x5b609e){logger['error'](_0x5b609e['stack']);if(_0x5b609e[_0x3c80('0x22')]){delete _0x5b609e[_0x3c80('0x22')];}_0x2c1767[_0x3c80('0x15')](_0x4f3739)['send'](_0x5b609e);};}exports[_0x3c80('0x23')]=function(_0x18664d,_0x4f83bc){var _0x42f188={},_0x1b9478={},_0x8e2b0c={'count':0x0,'rows':[]};var _0x1e2aa6=_[_0x3c80('0x24')](db[_0x3c80('0x25')][_0x3c80('0x26')],function(_0x906442){return{'name':_0x906442[_0x3c80('0x27')],'type':_0x906442[_0x3c80('0x28')]['key']};});_0x1b9478[_0x3c80('0x29')]=_['map'](_0x1e2aa6,'name');_0x1b9478[_0x3c80('0x2a')]=_[_0x3c80('0x2b')](_0x18664d[_0x3c80('0x2a')]);_0x1b9478['filters']=_[_0x3c80('0x2c')](_0x1b9478[_0x3c80('0x29')],_0x1b9478[_0x3c80('0x2a')]);_0x42f188[_0x3c80('0x2d')]=_[_0x3c80('0x2c')](_0x1b9478[_0x3c80('0x29')],qs[_0x3c80('0x2e')](_0x18664d[_0x3c80('0x2a')][_0x3c80('0x2e')]));_0x42f188[_0x3c80('0x2d')]=_0x42f188[_0x3c80('0x2d')]['length']?_0x42f188['attributes']:_0x1b9478[_0x3c80('0x29')];if(!_0x18664d['query'][_0x3c80('0x2f')](_0x3c80('0x30'))){_0x42f188[_0x3c80('0x19')]=qs[_0x3c80('0x19')](_0x18664d[_0x3c80('0x2a')]['limit']);_0x42f188[_0x3c80('0x18')]=qs[_0x3c80('0x18')](_0x18664d[_0x3c80('0x2a')][_0x3c80('0x18')]);}_0x42f188[_0x3c80('0x31')]=qs[_0x3c80('0x32')](_0x18664d[_0x3c80('0x2a')]['sort']);_0x42f188[_0x3c80('0x33')]=qs[_0x3c80('0x34')](_[_0x3c80('0x35')](_0x18664d[_0x3c80('0x2a')],_0x1b9478[_0x3c80('0x34')]),_0x1e2aa6);if(_0x18664d['query'][_0x3c80('0x36')]){_0x42f188['where']=_[_0x3c80('0x37')](_0x42f188[_0x3c80('0x33')],{'$or':_[_0x3c80('0x24')](_0x1e2aa6,function(_0x57d2ff){if(_0x57d2ff[_0x3c80('0x28')]!=='VIRTUAL'){var _0x4b0dcf={};_0x4b0dcf[_0x57d2ff['name']]={'$like':'%'+_0x18664d[_0x3c80('0x2a')][_0x3c80('0x36')]+'%'};return _0x4b0dcf;}})});}_0x42f188=_['merge']({},_0x42f188,_0x18664d[_0x3c80('0x38')]);var _0x47e3d7={'where':_0x42f188[_0x3c80('0x33')]};return db[_0x3c80('0x25')][_0x3c80('0x17')](_0x47e3d7)['then'](function(_0x52720c){_0x8e2b0c['count']=_0x52720c;if(_0x18664d[_0x3c80('0x2a')][_0x3c80('0x39')]){_0x42f188['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x3c80('0x3a')](_0x42f188);})[_0x3c80('0x20')](function(_0x21a45b){_0x8e2b0c[_0x3c80('0x3b')]=_0x21a45b;return _0x8e2b0c;})[_0x3c80('0x20')](respondWithFilteredResult(_0x4f83bc,_0x42f188))[_0x3c80('0x3c')](handleError(_0x4f83bc,null));};exports[_0x3c80('0x3d')]=function(_0x1ee56e,_0x2b6ecd){var _0x54da63={'raw':![],'where':{'id':_0x1ee56e['params']['id']}},_0x1e1bff={};_0x1e1bff[_0x3c80('0x29')]=_[_0x3c80('0x2b')](db['FreshsalesConfiguration'][_0x3c80('0x26')]);_0x1e1bff[_0x3c80('0x2a')]=_[_0x3c80('0x2b')](_0x1ee56e[_0x3c80('0x2a')]);_0x1e1bff['filters']=_[_0x3c80('0x2c')](_0x1e1bff[_0x3c80('0x29')],_0x1e1bff[_0x3c80('0x2a')]);_0x54da63[_0x3c80('0x2d')]=_[_0x3c80('0x2c')](_0x1e1bff[_0x3c80('0x29')],qs[_0x3c80('0x2e')](_0x1ee56e[_0x3c80('0x2a')]['fields']));_0x54da63[_0x3c80('0x2d')]=_0x54da63[_0x3c80('0x2d')][_0x3c80('0x3e')]?_0x54da63['attributes']:_0x1e1bff['model'];if(_0x1ee56e['query']['includeAll']){_0x54da63['include']=[{'all':!![]}];}_0x54da63=_[_0x3c80('0x37')]({},_0x54da63,_0x1ee56e[_0x3c80('0x38')]);return db[_0x3c80('0x25')][_0x3c80('0x3f')](_0x54da63)[_0x3c80('0x20')](handleEntityNotFound(_0x2b6ecd,null))[_0x3c80('0x20')](respondWithResult(_0x2b6ecd,null))['catch'](handleError(_0x2b6ecd,null));};exports['create']=function(_0x3d20a2,_0x1bc57a){return db['FreshsalesConfiguration'][_0x3c80('0x40')](_0x3d20a2[_0x3c80('0x41')],{})['then'](respondWithResult(_0x1bc57a,0xc9))['catch'](handleError(_0x1bc57a,null));};exports[_0x3c80('0x1f')]=function(_0x1bf838,_0xfdb758){if(_0x1bf838[_0x3c80('0x41')]['id']){delete _0x1bf838['body']['id'];}return db['FreshsalesConfiguration'][_0x3c80('0x3f')]({'where':{'id':_0x1bf838[_0x3c80('0x42')]['id']}})[_0x3c80('0x20')](handleEntityNotFound(_0xfdb758,null))[_0x3c80('0x20')](saveUpdates(_0x1bf838['body'],null))[_0x3c80('0x20')](respondWithResult(_0xfdb758,null))[_0x3c80('0x3c')](handleError(_0xfdb758,null));};exports[_0x3c80('0x21')]=function(_0x5b6dd5,_0x169452){return db[_0x3c80('0x25')][_0x3c80('0x3f')]({'where':{'id':_0x5b6dd5[_0x3c80('0x42')]['id']}})['then'](handleEntityNotFound(_0x169452,null))[_0x3c80('0x20')](removeEntity(_0x169452,null))[_0x3c80('0x3c')](handleError(_0x169452,null));};exports[_0x3c80('0x43')]=function(_0x335538,_0xbd219,_0x2e439){var _0x331bb7={};var _0x58d16e={};var _0x222ebf;var _0x4c26b1;return db[_0x3c80('0x25')]['findOne']({'where':{'id':_0x335538[_0x3c80('0x42')]['id']}})[_0x3c80('0x20')](handleEntityNotFound(_0xbd219,null))[_0x3c80('0x20')](function(_0x30ae8b){if(_0x30ae8b){_0x222ebf=_0x30ae8b;_0x58d16e[_0x3c80('0x29')]=_[_0x3c80('0x2b')](db[_0x3c80('0x44')]['rawAttributes']);_0x58d16e['query']=_['keys'](_0x335538['query']);_0x58d16e['filters']=_['intersection'](_0x58d16e['model'],_0x58d16e[_0x3c80('0x2a')]);_0x331bb7[_0x3c80('0x2d')]=_['intersection'](_0x58d16e[_0x3c80('0x29')],qs['fields'](_0x335538[_0x3c80('0x2a')][_0x3c80('0x2e')]));_0x331bb7[_0x3c80('0x2d')]=_0x331bb7[_0x3c80('0x2d')]['length']?_0x331bb7[_0x3c80('0x2d')]:_0x58d16e[_0x3c80('0x29')];_0x331bb7[_0x3c80('0x31')]=qs[_0x3c80('0x32')](_0x335538[_0x3c80('0x2a')][_0x3c80('0x32')]);_0x331bb7[_0x3c80('0x33')]=qs[_0x3c80('0x34')](_['pick'](_0x335538[_0x3c80('0x2a')],_0x58d16e[_0x3c80('0x34')]));if(_0x335538[_0x3c80('0x2a')][_0x3c80('0x36')]){_0x331bb7[_0x3c80('0x33')]=_[_0x3c80('0x37')](_0x331bb7[_0x3c80('0x33')],{'$or':_[_0x3c80('0x24')](_0x331bb7[_0x3c80('0x2d')],function(_0xb303b4){var _0xe3c0d4={};_0xe3c0d4[_0xb303b4]={'$like':'%'+_0x335538[_0x3c80('0x2a')][_0x3c80('0x36')]+'%'};return _0xe3c0d4;})});}_0x331bb7=_[_0x3c80('0x37')]({},_0x331bb7,_0x335538['options']);return _0x222ebf[_0x3c80('0x43')](_0x331bb7);}})[_0x3c80('0x20')](function(_0xd8d544){if(_0xd8d544){_0x4c26b1=_0xd8d544[_0x3c80('0x3e')];if(!_0x335538[_0x3c80('0x2a')][_0x3c80('0x2f')](_0x3c80('0x30'))){_0x331bb7['limit']=qs[_0x3c80('0x19')](_0x335538[_0x3c80('0x2a')]['limit']);_0x331bb7[_0x3c80('0x18')]=qs[_0x3c80('0x18')](_0x335538[_0x3c80('0x2a')]['offset']);}return _0x222ebf[_0x3c80('0x43')](_0x331bb7);}})[_0x3c80('0x20')](function(_0x55abe6){if(_0x55abe6){return _0x55abe6?{'count':_0x4c26b1,'rows':_0x55abe6}:null;}})['then'](respondWithResult(_0xbd219,null))[_0x3c80('0x3c')](handleError(_0xbd219,null));};exports[_0x3c80('0x45')]=function(_0x3df137,_0x65dde2,_0x447660){var _0x21583a={};var _0x13e723={};var _0x38aeb8;var _0x117f8a;return db[_0x3c80('0x25')][_0x3c80('0x46')]({'where':{'id':_0x3df137['params']['id']}})[_0x3c80('0x20')](handleEntityNotFound(_0x65dde2,null))[_0x3c80('0x20')](function(_0x3a376a){if(_0x3a376a){_0x38aeb8=_0x3a376a;_0x13e723[_0x3c80('0x29')]=_[_0x3c80('0x2b')](db[_0x3c80('0x44')]['rawAttributes']);_0x13e723[_0x3c80('0x2a')]=_['keys'](_0x3df137[_0x3c80('0x2a')]);_0x13e723[_0x3c80('0x34')]=_[_0x3c80('0x2c')](_0x13e723['model'],_0x13e723[_0x3c80('0x2a')]);_0x21583a[_0x3c80('0x2d')]=_[_0x3c80('0x2c')](_0x13e723['model'],qs[_0x3c80('0x2e')](_0x3df137[_0x3c80('0x2a')]['fields']));_0x21583a[_0x3c80('0x2d')]=_0x21583a[_0x3c80('0x2d')][_0x3c80('0x3e')]?_0x21583a['attributes']:_0x13e723[_0x3c80('0x29')];_0x21583a[_0x3c80('0x31')]=qs[_0x3c80('0x32')](_0x3df137[_0x3c80('0x2a')][_0x3c80('0x32')]);_0x21583a['where']=qs[_0x3c80('0x34')](_[_0x3c80('0x35')](_0x3df137['query'],_0x13e723['filters']));if(_0x3df137[_0x3c80('0x2a')][_0x3c80('0x36')]){_0x21583a[_0x3c80('0x33')]=_[_0x3c80('0x37')](_0x21583a['where'],{'$or':_[_0x3c80('0x24')](_0x21583a[_0x3c80('0x2d')],function(_0x5800bb){var _0x4a770a={};_0x4a770a[_0x5800bb]={'$like':'%'+_0x3df137[_0x3c80('0x2a')][_0x3c80('0x36')]+'%'};return _0x4a770a;})});}_0x21583a=_[_0x3c80('0x37')]({},_0x21583a,_0x3df137['options']);return _0x38aeb8['getDescriptions'](_0x21583a);}})['then'](function(_0x3b1acb){if(_0x3b1acb){_0x117f8a=_0x3b1acb[_0x3c80('0x3e')];if(!_0x3df137[_0x3c80('0x2a')][_0x3c80('0x2f')](_0x3c80('0x30'))){_0x21583a[_0x3c80('0x19')]=qs['limit'](_0x3df137[_0x3c80('0x2a')][_0x3c80('0x19')]);_0x21583a[_0x3c80('0x18')]=qs[_0x3c80('0x18')](_0x3df137['query'][_0x3c80('0x18')]);}return _0x38aeb8['getDescriptions'](_0x21583a);}})[_0x3c80('0x20')](function(_0x31fd65){if(_0x31fd65){return _0x31fd65?{'count':_0x117f8a,'rows':_0x31fd65}:null;}})[_0x3c80('0x20')](respondWithResult(_0x65dde2,null))[_0x3c80('0x3c')](handleError(_0x65dde2,null));};exports[_0x3c80('0x47')]=function(_0x25b294,_0x3fdc71,_0x258e52){var _0x5baf96={};var _0x466d0a={};var _0x3c205c;var _0x2c1580;return db[_0x3c80('0x25')][_0x3c80('0x46')]({'where':{'id':_0x25b294['params']['id']}})[_0x3c80('0x20')](handleEntityNotFound(_0x3fdc71,null))[_0x3c80('0x20')](function(_0x1e37c2){if(_0x1e37c2){_0x3c205c=_0x1e37c2;_0x466d0a[_0x3c80('0x29')]=_[_0x3c80('0x2b')](db[_0x3c80('0x44')][_0x3c80('0x26')]);_0x466d0a['query']=_['keys'](_0x25b294[_0x3c80('0x2a')]);_0x466d0a[_0x3c80('0x34')]=_[_0x3c80('0x2c')](_0x466d0a[_0x3c80('0x29')],_0x466d0a[_0x3c80('0x2a')]);_0x5baf96['attributes']=_[_0x3c80('0x2c')](_0x466d0a['model'],qs[_0x3c80('0x2e')](_0x25b294[_0x3c80('0x2a')]['fields']));_0x5baf96[_0x3c80('0x2d')]=_0x5baf96[_0x3c80('0x2d')][_0x3c80('0x3e')]?_0x5baf96[_0x3c80('0x2d')]:_0x466d0a[_0x3c80('0x29')];_0x5baf96[_0x3c80('0x31')]=qs['sort'](_0x25b294[_0x3c80('0x2a')][_0x3c80('0x32')]);_0x5baf96[_0x3c80('0x33')]=qs['filters'](_[_0x3c80('0x35')](_0x25b294[_0x3c80('0x2a')],_0x466d0a['filters']));if(_0x25b294[_0x3c80('0x2a')]['filter']){_0x5baf96[_0x3c80('0x33')]=_[_0x3c80('0x37')](_0x5baf96[_0x3c80('0x33')],{'$or':_['map'](_0x5baf96[_0x3c80('0x2d')],function(_0x32e5a8){var _0x5df889={};_0x5df889[_0x32e5a8]={'$like':'%'+_0x25b294['query']['filter']+'%'};return _0x5df889;})});}_0x5baf96=_[_0x3c80('0x37')]({},_0x5baf96,_0x25b294[_0x3c80('0x38')]);return _0x3c205c['getFields'](_0x5baf96);}})[_0x3c80('0x20')](function(_0x35fbdd){if(_0x35fbdd){_0x2c1580=_0x35fbdd[_0x3c80('0x3e')];if(!_0x25b294[_0x3c80('0x2a')][_0x3c80('0x2f')](_0x3c80('0x30'))){_0x5baf96['limit']=qs[_0x3c80('0x19')](_0x25b294[_0x3c80('0x2a')][_0x3c80('0x19')]);_0x5baf96['offset']=qs[_0x3c80('0x18')](_0x25b294[_0x3c80('0x2a')][_0x3c80('0x18')]);}return _0x3c205c['getFields'](_0x5baf96);}})[_0x3c80('0x20')](function(_0x40aaf6){if(_0x40aaf6){return _0x40aaf6?{'count':_0x2c1580,'rows':_0x40aaf6}:null;}})[_0x3c80('0x20')](respondWithResult(_0x3fdc71,null))[_0x3c80('0x3c')](handleError(_0x3fdc71,null));}; \ No newline at end of file +var _0xec39=['sort','where','filters','filter','type','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','params','fields','length','find','catch','create','body','getSubjects','findOne','FreshsalesField','pick','merge','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','undefined','count','offset','status','set','Content-Range','json','apply','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','intersection','attributes','model','hasOwnProperty','nolimit','limit','order'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xec39,0xb9));var _0x9ec3=function(_0x913fd2,_0x15113e){_0x913fd2=_0x913fd2-0x0;var _0x187c5b=_0xec39[_0x913fd2];return _0x187c5b;};'use strict';var emlformat=require(_0x9ec3('0x0'));var rimraf=require(_0x9ec3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ec3('0x2'));var rp=require('request-promise');var moment=require(_0x9ec3('0x3'));var BPromise=require(_0x9ec3('0x4'));var Mustache=require(_0x9ec3('0x5'));var util=require(_0x9ec3('0x6'));var path=require(_0x9ec3('0x7'));var sox=require('sox');var csv=require(_0x9ec3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ec3('0x9'));var _=require(_0x9ec3('0xa'));var squel=require(_0x9ec3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ec3('0xc'));var toCsv=require(_0x9ec3('0x8'));var querystring=require(_0x9ec3('0xd'));var Papa=require(_0x9ec3('0xe'));var Redis=require(_0x9ec3('0xf'));var authService=require(_0x9ec3('0x10'));var qs=require(_0x9ec3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ec3('0x12'));var logger=require(_0x9ec3('0x13'))(_0x9ec3('0x14'));var utils=require(_0x9ec3('0x15'));var config=require(_0x9ec3('0x16'));var licenseUtil=require(_0x9ec3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb57d35,_0x496292){_0x496292=_0x496292||0xcc;return function(_0x228b2e){if(_0x228b2e){return _0xb57d35['sendStatus'](_0x496292);}return _0xb57d35['status'](_0x496292)[_0x9ec3('0x18')]();};}function respondWithResult(_0xa894cc,_0xdc0c3){_0xdc0c3=_0xdc0c3||0xc8;return function(_0x25bd61){if(_0x25bd61){return _0xa894cc['status'](_0xdc0c3)['json'](_0x25bd61);}};}function respondWithFilteredResult(_0x1aed27,_0x22241d){return function(_0x53a736){if(_0x53a736){var _0x2ab6eb=typeof _0x22241d['offset']===_0x9ec3('0x19')&&typeof _0x22241d['limit']===_0x9ec3('0x19');var _0x19259a=_0x53a736[_0x9ec3('0x1a')];var _0x2ec966=_0x2ab6eb?0x0:_0x22241d[_0x9ec3('0x1b')];var _0x582385=_0x2ab6eb?_0x53a736[_0x9ec3('0x1a')]:_0x22241d[_0x9ec3('0x1b')]+_0x22241d['limit'];var _0x4c502b;if(_0x582385>=_0x19259a){_0x582385=_0x19259a;_0x4c502b=0xc8;}else{_0x4c502b=0xce;}_0x1aed27[_0x9ec3('0x1c')](_0x4c502b);return _0x1aed27[_0x9ec3('0x1d')](_0x9ec3('0x1e'),_0x2ec966+'-'+_0x582385+'/'+_0x19259a)[_0x9ec3('0x1f')](_0x53a736);}return null;};}function patchUpdates(_0x26b560){return function(_0x57bc88){try{jsonpatch[_0x9ec3('0x20')](_0x57bc88,_0x26b560,!![]);}catch(_0x454ac9){return BPromise['reject'](_0x454ac9);}return _0x57bc88['save']();};}function saveUpdates(_0x5015f5,_0x54d9b9){return function(_0xcf554d){if(_0xcf554d){return _0xcf554d[_0x9ec3('0x21')](_0x5015f5)[_0x9ec3('0x22')](function(_0x1111de){return _0x1111de;});}return null;};}function removeEntity(_0x3482d2,_0x45a937){return function(_0x2de901){if(_0x2de901){return _0x2de901[_0x9ec3('0x23')]()['then'](function(){_0x3482d2['status'](0xcc)[_0x9ec3('0x18')]();});}};}function handleEntityNotFound(_0x4b147d,_0x1ec13c){return function(_0x1a7a0b){if(!_0x1a7a0b){_0x4b147d[_0x9ec3('0x24')](0x194);}return _0x1a7a0b;};}function handleError(_0x1549e3,_0x494b6f){_0x494b6f=_0x494b6f||0x1f4;return function(_0xa7d20c){logger[_0x9ec3('0x25')](_0xa7d20c[_0x9ec3('0x26')]);if(_0xa7d20c[_0x9ec3('0x27')]){delete _0xa7d20c[_0x9ec3('0x27')];}_0x1549e3['status'](_0x494b6f)[_0x9ec3('0x28')](_0xa7d20c);};}exports[_0x9ec3('0x29')]=function(_0x24aa7b,_0x483740){var _0x442de8={},_0x2f9e9a={},_0x11a954={'count':0x0,'rows':[]};var _0x354941=_['map'](db['FreshsalesConfiguration'][_0x9ec3('0x2a')],function(_0x14410a){return{'name':_0x14410a[_0x9ec3('0x2b')],'type':_0x14410a['type'][_0x9ec3('0x2c')]};});_0x2f9e9a['model']=_[_0x9ec3('0x2d')](_0x354941,_0x9ec3('0x27'));_0x2f9e9a[_0x9ec3('0x2e')]=_[_0x9ec3('0x2f')](_0x24aa7b[_0x9ec3('0x2e')]);_0x2f9e9a['filters']=_[_0x9ec3('0x30')](_0x2f9e9a['model'],_0x2f9e9a[_0x9ec3('0x2e')]);_0x442de8[_0x9ec3('0x31')]=_[_0x9ec3('0x30')](_0x2f9e9a[_0x9ec3('0x32')],qs['fields'](_0x24aa7b['query']['fields']));_0x442de8[_0x9ec3('0x31')]=_0x442de8['attributes']['length']?_0x442de8[_0x9ec3('0x31')]:_0x2f9e9a[_0x9ec3('0x32')];if(!_0x24aa7b[_0x9ec3('0x2e')][_0x9ec3('0x33')](_0x9ec3('0x34'))){_0x442de8['limit']=qs[_0x9ec3('0x35')](_0x24aa7b[_0x9ec3('0x2e')][_0x9ec3('0x35')]);_0x442de8[_0x9ec3('0x1b')]=qs[_0x9ec3('0x1b')](_0x24aa7b[_0x9ec3('0x2e')]['offset']);}_0x442de8[_0x9ec3('0x36')]=qs[_0x9ec3('0x37')](_0x24aa7b[_0x9ec3('0x2e')][_0x9ec3('0x37')]);_0x442de8[_0x9ec3('0x38')]=qs[_0x9ec3('0x39')](_['pick'](_0x24aa7b['query'],_0x2f9e9a['filters']),_0x354941);if(_0x24aa7b['query'][_0x9ec3('0x3a')]){_0x442de8[_0x9ec3('0x38')]=_['merge'](_0x442de8['where'],{'$or':_[_0x9ec3('0x2d')](_0x354941,function(_0x54b8dd){if(_0x54b8dd[_0x9ec3('0x3b')]!==_0x9ec3('0x3c')){var _0x1e1936={};_0x1e1936[_0x54b8dd['name']]={'$like':'%'+_0x24aa7b[_0x9ec3('0x2e')][_0x9ec3('0x3a')]+'%'};return _0x1e1936;}})});}_0x442de8=_['merge']({},_0x442de8,_0x24aa7b[_0x9ec3('0x3d')]);var _0x197bf6={'where':_0x442de8['where']};return db[_0x9ec3('0x3e')][_0x9ec3('0x1a')](_0x197bf6)[_0x9ec3('0x22')](function(_0x423677){_0x11a954[_0x9ec3('0x1a')]=_0x423677;if(_0x24aa7b[_0x9ec3('0x2e')][_0x9ec3('0x3f')]){_0x442de8[_0x9ec3('0x40')]=[{'all':!![]}];}return db[_0x9ec3('0x3e')][_0x9ec3('0x41')](_0x442de8);})[_0x9ec3('0x22')](function(_0x152630){_0x11a954['rows']=_0x152630;return _0x11a954;})[_0x9ec3('0x22')](respondWithFilteredResult(_0x483740,_0x442de8))['catch'](handleError(_0x483740,null));};exports['show']=function(_0x191e39,_0x3898cc){var _0x3efac6={'raw':![],'where':{'id':_0x191e39[_0x9ec3('0x42')]['id']}},_0x1dfa5f={};_0x1dfa5f[_0x9ec3('0x32')]=_['keys'](db[_0x9ec3('0x3e')][_0x9ec3('0x2a')]);_0x1dfa5f[_0x9ec3('0x2e')]=_['keys'](_0x191e39[_0x9ec3('0x2e')]);_0x1dfa5f[_0x9ec3('0x39')]=_[_0x9ec3('0x30')](_0x1dfa5f[_0x9ec3('0x32')],_0x1dfa5f[_0x9ec3('0x2e')]);_0x3efac6[_0x9ec3('0x31')]=_[_0x9ec3('0x30')](_0x1dfa5f[_0x9ec3('0x32')],qs[_0x9ec3('0x43')](_0x191e39[_0x9ec3('0x2e')][_0x9ec3('0x43')]));_0x3efac6[_0x9ec3('0x31')]=_0x3efac6['attributes'][_0x9ec3('0x44')]?_0x3efac6['attributes']:_0x1dfa5f['model'];if(_0x191e39['query'][_0x9ec3('0x3f')]){_0x3efac6[_0x9ec3('0x40')]=[{'all':!![]}];}_0x3efac6=_['merge']({},_0x3efac6,_0x191e39['options']);return db['FreshsalesConfiguration'][_0x9ec3('0x45')](_0x3efac6)['then'](handleEntityNotFound(_0x3898cc,null))[_0x9ec3('0x22')](respondWithResult(_0x3898cc,null))[_0x9ec3('0x46')](handleError(_0x3898cc,null));};exports[_0x9ec3('0x47')]=function(_0x3f15f5,_0x2c3e99){return db['FreshsalesConfiguration'][_0x9ec3('0x47')](_0x3f15f5[_0x9ec3('0x48')],{})[_0x9ec3('0x22')](respondWithResult(_0x2c3e99,0xc9))[_0x9ec3('0x46')](handleError(_0x2c3e99,null));};exports[_0x9ec3('0x21')]=function(_0xf10454,_0x2a6092){if(_0xf10454[_0x9ec3('0x48')]['id']){delete _0xf10454['body']['id'];}return db['FreshsalesConfiguration'][_0x9ec3('0x45')]({'where':{'id':_0xf10454[_0x9ec3('0x42')]['id']}})[_0x9ec3('0x22')](handleEntityNotFound(_0x2a6092,null))['then'](saveUpdates(_0xf10454[_0x9ec3('0x48')],null))[_0x9ec3('0x22')](respondWithResult(_0x2a6092,null))[_0x9ec3('0x46')](handleError(_0x2a6092,null));};exports[_0x9ec3('0x23')]=function(_0x3b4896,_0x40beb9){return db[_0x9ec3('0x3e')][_0x9ec3('0x45')]({'where':{'id':_0x3b4896[_0x9ec3('0x42')]['id']}})['then'](handleEntityNotFound(_0x40beb9,null))['then'](removeEntity(_0x40beb9,null))[_0x9ec3('0x46')](handleError(_0x40beb9,null));};exports[_0x9ec3('0x49')]=function(_0x556b68,_0x378c70,_0x52f30b){var _0x5db4d6={};var _0x2326b0={};var _0x330320;var _0x30d95d;return db['FreshsalesConfiguration'][_0x9ec3('0x4a')]({'where':{'id':_0x556b68['params']['id']}})[_0x9ec3('0x22')](handleEntityNotFound(_0x378c70,null))[_0x9ec3('0x22')](function(_0x2769dd){if(_0x2769dd){_0x330320=_0x2769dd;_0x2326b0[_0x9ec3('0x32')]=_[_0x9ec3('0x2f')](db[_0x9ec3('0x4b')][_0x9ec3('0x2a')]);_0x2326b0[_0x9ec3('0x2e')]=_[_0x9ec3('0x2f')](_0x556b68['query']);_0x2326b0[_0x9ec3('0x39')]=_['intersection'](_0x2326b0[_0x9ec3('0x32')],_0x2326b0[_0x9ec3('0x2e')]);_0x5db4d6[_0x9ec3('0x31')]=_['intersection'](_0x2326b0[_0x9ec3('0x32')],qs['fields'](_0x556b68[_0x9ec3('0x2e')][_0x9ec3('0x43')]));_0x5db4d6[_0x9ec3('0x31')]=_0x5db4d6[_0x9ec3('0x31')]['length']?_0x5db4d6['attributes']:_0x2326b0[_0x9ec3('0x32')];_0x5db4d6['order']=qs['sort'](_0x556b68['query'][_0x9ec3('0x37')]);_0x5db4d6[_0x9ec3('0x38')]=qs[_0x9ec3('0x39')](_[_0x9ec3('0x4c')](_0x556b68[_0x9ec3('0x2e')],_0x2326b0[_0x9ec3('0x39')]));if(_0x556b68['query']['filter']){_0x5db4d6[_0x9ec3('0x38')]=_[_0x9ec3('0x4d')](_0x5db4d6[_0x9ec3('0x38')],{'$or':_[_0x9ec3('0x2d')](_0x5db4d6['attributes'],function(_0x4d5218){var _0x3360c6={};_0x3360c6[_0x4d5218]={'$like':'%'+_0x556b68['query'][_0x9ec3('0x3a')]+'%'};return _0x3360c6;})});}_0x5db4d6=_['merge']({},_0x5db4d6,_0x556b68[_0x9ec3('0x3d')]);return _0x330320[_0x9ec3('0x49')](_0x5db4d6);}})[_0x9ec3('0x22')](function(_0x364467){if(_0x364467){_0x30d95d=_0x364467[_0x9ec3('0x44')];if(!_0x556b68[_0x9ec3('0x2e')][_0x9ec3('0x33')](_0x9ec3('0x34'))){_0x5db4d6[_0x9ec3('0x35')]=qs['limit'](_0x556b68[_0x9ec3('0x2e')][_0x9ec3('0x35')]);_0x5db4d6[_0x9ec3('0x1b')]=qs[_0x9ec3('0x1b')](_0x556b68[_0x9ec3('0x2e')][_0x9ec3('0x1b')]);}return _0x330320[_0x9ec3('0x49')](_0x5db4d6);}})[_0x9ec3('0x22')](function(_0x6b36e0){if(_0x6b36e0){return _0x6b36e0?{'count':_0x30d95d,'rows':_0x6b36e0}:null;}})['then'](respondWithResult(_0x378c70,null))['catch'](handleError(_0x378c70,null));};exports[_0x9ec3('0x4e')]=function(_0x562253,_0x326e0b,_0x319d26){var _0x335a51={};var _0x4f9a3a={};var _0x4ef4a7;var _0x96a998;return db[_0x9ec3('0x3e')][_0x9ec3('0x4a')]({'where':{'id':_0x562253[_0x9ec3('0x42')]['id']}})[_0x9ec3('0x22')](handleEntityNotFound(_0x326e0b,null))[_0x9ec3('0x22')](function(_0x5ea218){if(_0x5ea218){_0x4ef4a7=_0x5ea218;_0x4f9a3a[_0x9ec3('0x32')]=_[_0x9ec3('0x2f')](db[_0x9ec3('0x4b')][_0x9ec3('0x2a')]);_0x4f9a3a['query']=_[_0x9ec3('0x2f')](_0x562253[_0x9ec3('0x2e')]);_0x4f9a3a['filters']=_[_0x9ec3('0x30')](_0x4f9a3a[_0x9ec3('0x32')],_0x4f9a3a['query']);_0x335a51[_0x9ec3('0x31')]=_['intersection'](_0x4f9a3a[_0x9ec3('0x32')],qs['fields'](_0x562253[_0x9ec3('0x2e')][_0x9ec3('0x43')]));_0x335a51[_0x9ec3('0x31')]=_0x335a51[_0x9ec3('0x31')][_0x9ec3('0x44')]?_0x335a51[_0x9ec3('0x31')]:_0x4f9a3a[_0x9ec3('0x32')];_0x335a51[_0x9ec3('0x36')]=qs[_0x9ec3('0x37')](_0x562253[_0x9ec3('0x2e')]['sort']);_0x335a51[_0x9ec3('0x38')]=qs['filters'](_[_0x9ec3('0x4c')](_0x562253[_0x9ec3('0x2e')],_0x4f9a3a[_0x9ec3('0x39')]));if(_0x562253['query']['filter']){_0x335a51[_0x9ec3('0x38')]=_[_0x9ec3('0x4d')](_0x335a51['where'],{'$or':_[_0x9ec3('0x2d')](_0x335a51[_0x9ec3('0x31')],function(_0x48f0a7){var _0x4a4e9b={};_0x4a4e9b[_0x48f0a7]={'$like':'%'+_0x562253[_0x9ec3('0x2e')]['filter']+'%'};return _0x4a4e9b;})});}_0x335a51=_[_0x9ec3('0x4d')]({},_0x335a51,_0x562253['options']);return _0x4ef4a7[_0x9ec3('0x4e')](_0x335a51);}})[_0x9ec3('0x22')](function(_0x4e2cc9){if(_0x4e2cc9){_0x96a998=_0x4e2cc9[_0x9ec3('0x44')];if(!_0x562253['query']['hasOwnProperty']('nolimit')){_0x335a51['limit']=qs[_0x9ec3('0x35')](_0x562253[_0x9ec3('0x2e')][_0x9ec3('0x35')]);_0x335a51[_0x9ec3('0x1b')]=qs[_0x9ec3('0x1b')](_0x562253[_0x9ec3('0x2e')][_0x9ec3('0x1b')]);}return _0x4ef4a7[_0x9ec3('0x4e')](_0x335a51);}})[_0x9ec3('0x22')](function(_0x508314){if(_0x508314){return _0x508314?{'count':_0x96a998,'rows':_0x508314}:null;}})[_0x9ec3('0x22')](respondWithResult(_0x326e0b,null))[_0x9ec3('0x46')](handleError(_0x326e0b,null));};exports['getFields']=function(_0x4072e1,_0x365758,_0x53f45c){var _0x221e2b={};var _0x223e77={};var _0x56c200;var _0x2fd273;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4072e1[_0x9ec3('0x42')]['id']}})[_0x9ec3('0x22')](handleEntityNotFound(_0x365758,null))[_0x9ec3('0x22')](function(_0x37dbd7){if(_0x37dbd7){_0x56c200=_0x37dbd7;_0x223e77[_0x9ec3('0x32')]=_[_0x9ec3('0x2f')](db['FreshsalesField']['rawAttributes']);_0x223e77[_0x9ec3('0x2e')]=_[_0x9ec3('0x2f')](_0x4072e1[_0x9ec3('0x2e')]);_0x223e77[_0x9ec3('0x39')]=_[_0x9ec3('0x30')](_0x223e77[_0x9ec3('0x32')],_0x223e77[_0x9ec3('0x2e')]);_0x221e2b[_0x9ec3('0x31')]=_[_0x9ec3('0x30')](_0x223e77[_0x9ec3('0x32')],qs[_0x9ec3('0x43')](_0x4072e1['query'][_0x9ec3('0x43')]));_0x221e2b['attributes']=_0x221e2b['attributes'][_0x9ec3('0x44')]?_0x221e2b[_0x9ec3('0x31')]:_0x223e77['model'];_0x221e2b[_0x9ec3('0x36')]=qs[_0x9ec3('0x37')](_0x4072e1[_0x9ec3('0x2e')][_0x9ec3('0x37')]);_0x221e2b[_0x9ec3('0x38')]=qs[_0x9ec3('0x39')](_['pick'](_0x4072e1['query'],_0x223e77['filters']));if(_0x4072e1[_0x9ec3('0x2e')][_0x9ec3('0x3a')]){_0x221e2b[_0x9ec3('0x38')]=_[_0x9ec3('0x4d')](_0x221e2b[_0x9ec3('0x38')],{'$or':_[_0x9ec3('0x2d')](_0x221e2b[_0x9ec3('0x31')],function(_0x3030a5){var _0x1098d3={};_0x1098d3[_0x3030a5]={'$like':'%'+_0x4072e1['query']['filter']+'%'};return _0x1098d3;})});}_0x221e2b=_['merge']({},_0x221e2b,_0x4072e1[_0x9ec3('0x3d')]);return _0x56c200[_0x9ec3('0x4f')](_0x221e2b);}})[_0x9ec3('0x22')](function(_0x390aa0){if(_0x390aa0){_0x2fd273=_0x390aa0[_0x9ec3('0x44')];if(!_0x4072e1[_0x9ec3('0x2e')][_0x9ec3('0x33')](_0x9ec3('0x34'))){_0x221e2b['limit']=qs[_0x9ec3('0x35')](_0x4072e1[_0x9ec3('0x2e')][_0x9ec3('0x35')]);_0x221e2b[_0x9ec3('0x1b')]=qs[_0x9ec3('0x1b')](_0x4072e1[_0x9ec3('0x2e')][_0x9ec3('0x1b')]);}return _0x56c200[_0x9ec3('0x4f')](_0x221e2b);}})['then'](function(_0x309a72){if(_0x309a72){return _0x309a72?{'count':_0x2fd273,'rows':_0x309a72}:null;}})[_0x9ec3('0x22')](respondWithResult(_0x365758,null))[_0x9ec3('0x46')](handleError(_0x365758,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1c536c8..be003ce 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 _0xc667=['FreshsalesConfiguration','int_freshsales_configurations','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc667,0x7b));var _0x7c66=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc667[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7c66('0x0'))(_0x7c66('0x1'));var moment=require('moment');var BPromise=require(_0x7c66('0x2'));var rp=require(_0x7c66('0x3'));var fs=require('fs');var path=require(_0x7c66('0x4'));var rimraf=require('rimraf');var config=require(_0x7c66('0x5'));var attributes=require(_0x7c66('0x6'));module[_0x7c66('0x7')]=function(_0x5d8969,_0x414065){return _0x5d8969[_0x7c66('0x8')](_0x7c66('0x9'),attributes,{'tableName':_0x7c66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d90=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x4109b5,_0x4e1012){var _0x2312f4=function(_0x87b850){while(--_0x87b850){_0x4109b5['push'](_0x4109b5['shift']());}};_0x2312f4(++_0x4e1012);}(_0x6d90,0x178));var _0x06d9=function(_0x39051f,_0x38ef3f){_0x39051f=_0x39051f-0x0;var _0x41ae14=_0x6d90[_0x39051f];return _0x41ae14;};'use strict';var _=require(_0x06d9('0x0'));var util=require('util');var logger=require(_0x06d9('0x1'))(_0x06d9('0x2'));var moment=require(_0x06d9('0x3'));var BPromise=require(_0x06d9('0x4'));var rp=require(_0x06d9('0x5'));var fs=require('fs');var path=require(_0x06d9('0x6'));var rimraf=require(_0x06d9('0x7'));var config=require(_0x06d9('0x8'));var attributes=require(_0x06d9('0x9'));module['exports']=function(_0x1fa79c,_0x18e065){return _0x1fa79c[_0x06d9('0xa')](_0x06d9('0xb'),attributes,{'tableName':_0x06d9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 0fa315d..4a147b5 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 _0x1396=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message'];(function(_0x2739b4,_0x5e7005){var _0x2364ce=function(_0x54ffc2){while(--_0x54ffc2){_0x2739b4['push'](_0x2739b4['shift']());}};_0x2364ce(++_0x5e7005);}(_0x1396,0xf4));var _0x6139=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0x1396[_0x4ca333];return _0x13b2e1;};'use strict';var _=require(_0x6139('0x0'));var util=require(_0x6139('0x1'));var moment=require('moment');var BPromise=require(_0x6139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6139('0x3'));var db=require(_0x6139('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6139('0x5'))(_0x6139('0x6'));var config=require(_0x6139('0x7'));var jayson=require(_0x6139('0x8'));var client=jayson[_0x6139('0x9')][_0x6139('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26ea4b,_0x2c7fa6,_0x266526){return new BPromise(function(_0x3860b4,_0x376707){return client[_0x6139('0xb')](_0x26ea4b,_0x266526)['then'](function(_0x3dbd1e){logger[_0x6139('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2c7fa6,'request\x20sent');logger[_0x6139('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2c7fa6,_0x6139('0xe'),JSON[_0x6139('0xf')](_0x3dbd1e));if(_0x3dbd1e[_0x6139('0x10')]){if(_0x3dbd1e[_0x6139('0x10')][_0x6139('0x11')]===0x1f4){logger[_0x6139('0x10')](_0x6139('0x12'),_0x2c7fa6,_0x3dbd1e['error']['message']);return _0x376707(_0x3dbd1e['error'][_0x6139('0x13')]);}logger['error'](_0x6139('0x12'),_0x2c7fa6,_0x3dbd1e[_0x6139('0x10')][_0x6139('0x13')]);return _0x3860b4(_0x3dbd1e[_0x6139('0x10')][_0x6139('0x13')]);}else{logger[_0x6139('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2c7fa6,'request\x20sent');_0x3860b4(_0x3dbd1e[_0x6139('0x14')][_0x6139('0x13')]);}})[_0x6139('0x15')](function(_0x2fac1e){logger['error'](_0x6139('0x12'),_0x2c7fa6,_0x2fac1e);_0x376707(_0x2fac1e);});});} \ No newline at end of file +var _0x003b=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0xfeaacb,_0x3b27cb){var _0x1ac128=function(_0x10ddb3){while(--_0x10ddb3){_0xfeaacb['push'](_0xfeaacb['shift']());}};_0x1ac128(++_0x3b27cb);}(_0x003b,0x11c));var _0xb003=function(_0x3353c9,_0x518888){_0x3353c9=_0x3353c9-0x0;var _0x20ea7c=_0x003b[_0x3353c9];return _0x20ea7c;};'use strict';var _=require(_0xb003('0x0'));var util=require(_0xb003('0x1'));var moment=require(_0xb003('0x2'));var BPromise=require(_0xb003('0x3'));var rs=require(_0xb003('0x4'));var fs=require('fs');var Redis=require(_0xb003('0x5'));var db=require(_0xb003('0x6'))['db'];var utils=require(_0xb003('0x7'));var logger=require(_0xb003('0x8'))(_0xb003('0x9'));var config=require(_0xb003('0xa'));var jayson=require(_0xb003('0xb'));var client=jayson['client'][_0xb003('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x167082,_0x4be82e,_0xce1f08){return new BPromise(function(_0xfd036e,_0x394b45){return client[_0xb003('0xd')](_0x167082,_0xce1f08)[_0xb003('0xe')](function(_0x2b2ebb){logger['info'](_0xb003('0xf'),_0x4be82e,'request\x20sent');logger[_0xb003('0x10')](_0xb003('0x11'),_0x4be82e,'request\x20sent',JSON['stringify'](_0x2b2ebb));if(_0x2b2ebb[_0xb003('0x12')]){if(_0x2b2ebb[_0xb003('0x12')][_0xb003('0x13')]===0x1f4){logger[_0xb003('0x12')](_0xb003('0xf'),_0x4be82e,_0x2b2ebb[_0xb003('0x12')]['message']);return _0x394b45(_0x2b2ebb[_0xb003('0x12')][_0xb003('0x14')]);}logger[_0xb003('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4be82e,_0x2b2ebb['error'][_0xb003('0x14')]);return _0xfd036e(_0x2b2ebb[_0xb003('0x12')][_0xb003('0x14')]);}else{logger[_0xb003('0x15')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4be82e,_0xb003('0x16'));_0xfd036e(_0x2b2ebb[_0xb003('0x17')][_0xb003('0x14')]);}})[_0xb003('0x18')](function(_0x48c449){logger[_0xb003('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4be82e,_0x48c449);_0x394b45(_0x48c449);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d9f4691..f495408 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 _0xed8a=['show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x355cbb,_0x354add){var _0xe6dd1d=function(_0x1bfe8e){while(--_0x1bfe8e){_0x355cbb['push'](_0x355cbb['shift']());}};_0xe6dd1d(++_0x354add);}(_0xed8a,0xc5));var _0xaed8=function(_0x5399b3,_0x35cc49){_0x5399b3=_0x5399b3-0x0;var _0x2931c9=_0xed8a[_0x5399b3];return _0x2931c9;};'use strict';var multer=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var path=require(_0xaed8('0x2'));var timeout=require(_0xaed8('0x3'));var express=require('express');var router=express[_0xaed8('0x4')]();var fs_extra=require(_0xaed8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaed8('0x6'));var config=require(_0xaed8('0x7'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xaed8('0x8')](),controller[_0xaed8('0x9')]);router[_0xaed8('0xa')](_0xaed8('0xb'),auth[_0xaed8('0x8')](),controller[_0xaed8('0xc')]);router[_0xaed8('0xd')]('/',auth['isAuthenticated'](),controller[_0xaed8('0xe')]);router[_0xaed8('0xf')](_0xaed8('0xb'),auth['isAuthenticated'](),controller[_0xaed8('0x10')]);router[_0xaed8('0x11')](_0xaed8('0xb'),auth[_0xaed8('0x8')](),controller[_0xaed8('0x12')]);module['exports']=router; \ No newline at end of file +var _0xcffe=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x3eebc3,_0x5a5470){var _0x211191=function(_0x1553de){while(--_0x1553de){_0x3eebc3['push'](_0x3eebc3['shift']());}};_0x211191(++_0x5a5470);}(_0xcffe,0x1a1));var _0xecff=function(_0x29c934,_0x3c30e2){_0x29c934=_0x29c934-0x0;var _0x4302de=_0xcffe[_0x29c934];return _0x4302de;};'use strict';var multer=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var path=require(_0xecff('0x2'));var timeout=require(_0xecff('0x3'));var express=require(_0xecff('0x4'));var router=express[_0xecff('0x5')]();var fs_extra=require(_0xecff('0x6'));var auth=require(_0xecff('0x7'));var interaction=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xecff('0xa')](),controller[_0xecff('0xb')]);router[_0xecff('0xc')](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0xe')]);router[_0xecff('0xf')]('/',auth['isAuthenticated'](),controller[_0xecff('0x10')]);router[_0xecff('0x11')](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0x12')]);router['delete'](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0x13')]);module[_0xecff('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 46baf4b..c365dbc 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 _0x882f=['customVariable','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x4af821,_0x547275){var _0x45101f=function(_0xaf3196){while(--_0xaf3196){_0x4af821['push'](_0x4af821['shift']());}};_0x45101f(++_0x547275);}(_0x882f,0x114));var _0xf882=function(_0x5b4d06,_0x3edc8d){_0x5b4d06=_0x5b4d06-0x0;var _0xad4053=_0x882f[_0x5b4d06];return _0xad4053;};'use strict';var Sequelize=require('sequelize');module[_0xf882('0x0')]={'type':{'type':Sequelize[_0xf882('0x1')](_0xf882('0x2'),_0xf882('0x3'),_0xf882('0x4'),'keyValue',_0xf882('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf882('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf882('0x2'),_0xf882('0x3'),_0xf882('0x4'))},'keyContent':{'type':Sequelize[_0xf882('0x6')]},'idField':{'type':Sequelize[_0xf882('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf882('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1a36=['customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM'];(function(_0x3dc927,_0x2b2192){var _0x11e332=function(_0x3eff0f){while(--_0x3eff0f){_0x3dc927['push'](_0x3dc927['shift']());}};_0x11e332(++_0x2b2192);}(_0x1a36,0x10d));var _0x61a3=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1a36[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x61a3('0x0'));module[_0x61a3('0x1')]={'type':{'type':Sequelize[_0x61a3('0x2')]('string','variable',_0x61a3('0x3'),_0x61a3('0x4'),_0x61a3('0x5')),'defaultValue':_0x61a3('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x61a3('0x7')]},'keyType':{'type':Sequelize[_0x61a3('0x2')](_0x61a3('0x6'),'variable',_0x61a3('0x3'))},'keyContent':{'type':Sequelize[_0x61a3('0x7')]},'idField':{'type':Sequelize[_0x61a3('0x7')]},'nameField':{'type':Sequelize[_0x61a3('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x61a3('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 2b95b95..2481fab 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 _0x37b1=['query','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','where','map','VIRTUAL','filter','merge','options','findAll','rows','catch','show','includeAll','include','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','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/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','FreshsalesField','fieldName','type','model','keys'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x37b1,0xf8));var _0x137b=function(_0x3f7308,_0x2607c5){_0x3f7308=_0x3f7308-0x0;var _0x33565e=_0x37b1[_0x3f7308];return _0x33565e;};'use strict';var emlformat=require(_0x137b('0x0'));var rimraf=require(_0x137b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x137b('0x2'));var rp=require(_0x137b('0x3'));var moment=require('moment');var BPromise=require(_0x137b('0x4'));var Mustache=require(_0x137b('0x5'));var util=require('util');var path=require(_0x137b('0x6'));var sox=require(_0x137b('0x7'));var csv=require('to-csv');var ejs=require(_0x137b('0x8'));var fs=require('fs');var fs_extra=require(_0x137b('0x9'));var _=require('lodash');var squel=require(_0x137b('0xa'));var crypto=require(_0x137b('0xb'));var jsforce=require(_0x137b('0xc'));var deskjs=require(_0x137b('0xd'));var toCsv=require(_0x137b('0xe'));var querystring=require('querystring');var Papa=require(_0x137b('0xf'));var Redis=require(_0x137b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x137b('0x11'));var as=require(_0x137b('0x12'));var hardwareService=require(_0x137b('0x13'));var logger=require(_0x137b('0x14'))(_0x137b('0x15'));var utils=require(_0x137b('0x16'));var config=require(_0x137b('0x17'));var licenseUtil=require(_0x137b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f0f58,_0x150d0){_0x150d0=_0x150d0||0xcc;return function(_0x3a98ed){if(_0x3a98ed){return _0x4f0f58[_0x137b('0x19')](_0x150d0);}return _0x4f0f58[_0x137b('0x1a')](_0x150d0)['end']();};}function respondWithResult(_0x25db9a,_0x1b785d){_0x1b785d=_0x1b785d||0xc8;return function(_0x10ffce){if(_0x10ffce){return _0x25db9a[_0x137b('0x1a')](_0x1b785d)[_0x137b('0x1b')](_0x10ffce);}};}function respondWithFilteredResult(_0x5daa46,_0x248abe){return function(_0x5b39f5){if(_0x5b39f5){var _0x328efa=typeof _0x248abe[_0x137b('0x1c')]===_0x137b('0x1d')&&typeof _0x248abe['limit']===_0x137b('0x1d');var _0x2cfb0a=_0x5b39f5[_0x137b('0x1e')];var _0xb43af0=_0x328efa?0x0:_0x248abe['offset'];var _0x2d6d81=_0x328efa?_0x5b39f5[_0x137b('0x1e')]:_0x248abe[_0x137b('0x1c')]+_0x248abe['limit'];var _0x387c21;if(_0x2d6d81>=_0x2cfb0a){_0x2d6d81=_0x2cfb0a;_0x387c21=0xc8;}else{_0x387c21=0xce;}_0x5daa46[_0x137b('0x1a')](_0x387c21);return _0x5daa46['set'](_0x137b('0x1f'),_0xb43af0+'-'+_0x2d6d81+'/'+_0x2cfb0a)[_0x137b('0x1b')](_0x5b39f5);}return null;};}function patchUpdates(_0x5cf818){return function(_0x14b43a){try{jsonpatch[_0x137b('0x20')](_0x14b43a,_0x5cf818,!![]);}catch(_0x3e9ada){return BPromise['reject'](_0x3e9ada);}return _0x14b43a[_0x137b('0x21')]();};}function saveUpdates(_0x402cc4,_0xe2c5e3){return function(_0x3b599c){if(_0x3b599c){return _0x3b599c[_0x137b('0x22')](_0x402cc4)[_0x137b('0x23')](function(_0x2146bc){return _0x2146bc;});}return null;};}function removeEntity(_0x29c28e,_0x18ff82){return function(_0x2f63d9){if(_0x2f63d9){return _0x2f63d9[_0x137b('0x24')]()['then'](function(){_0x29c28e[_0x137b('0x1a')](0xcc)[_0x137b('0x25')]();});}};}function handleEntityNotFound(_0x38c2fc,_0x2d355b){return function(_0x20f111){if(!_0x20f111){_0x38c2fc['sendStatus'](0x194);}return _0x20f111;};}function handleError(_0x2ff2dc,_0x4d1f5a){_0x4d1f5a=_0x4d1f5a||0x1f4;return function(_0x4d86f3){logger[_0x137b('0x26')](_0x4d86f3[_0x137b('0x27')]);if(_0x4d86f3[_0x137b('0x28')]){delete _0x4d86f3['name'];}_0x2ff2dc['status'](_0x4d1f5a)[_0x137b('0x29')](_0x4d86f3);};}exports[_0x137b('0x2a')]=function(_0x346688,_0x25da19){var _0x121d4a={},_0x411146={},_0x1e7b5a={'count':0x0,'rows':[]};var _0x3c78fa=_['map'](db[_0x137b('0x2b')]['rawAttributes'],function(_0x3da6e1){return{'name':_0x3da6e1[_0x137b('0x2c')],'type':_0x3da6e1[_0x137b('0x2d')]['key']};});_0x411146[_0x137b('0x2e')]=_['map'](_0x3c78fa,_0x137b('0x28'));_0x411146['query']=_[_0x137b('0x2f')](_0x346688[_0x137b('0x30')]);_0x411146['filters']=_[_0x137b('0x31')](_0x411146['model'],_0x411146[_0x137b('0x30')]);_0x121d4a[_0x137b('0x32')]=_[_0x137b('0x31')](_0x411146['model'],qs[_0x137b('0x33')](_0x346688[_0x137b('0x30')][_0x137b('0x33')]));_0x121d4a[_0x137b('0x32')]=_0x121d4a['attributes'][_0x137b('0x34')]?_0x121d4a[_0x137b('0x32')]:_0x411146['model'];if(!_0x346688[_0x137b('0x30')]['hasOwnProperty'](_0x137b('0x35'))){_0x121d4a[_0x137b('0x36')]=qs[_0x137b('0x36')](_0x346688[_0x137b('0x30')][_0x137b('0x36')]);_0x121d4a[_0x137b('0x1c')]=qs[_0x137b('0x1c')](_0x346688[_0x137b('0x30')][_0x137b('0x1c')]);}_0x121d4a[_0x137b('0x37')]=qs[_0x137b('0x38')](_0x346688[_0x137b('0x30')]['sort']);_0x121d4a['where']=qs[_0x137b('0x39')](_['pick'](_0x346688['query'],_0x411146[_0x137b('0x39')]),_0x3c78fa);if(_0x346688[_0x137b('0x30')]['filter']){_0x121d4a[_0x137b('0x3a')]=_['merge'](_0x121d4a[_0x137b('0x3a')],{'$or':_[_0x137b('0x3b')](_0x3c78fa,function(_0x535b46){if(_0x535b46['type']!==_0x137b('0x3c')){var _0x258689={};_0x258689[_0x535b46[_0x137b('0x28')]]={'$like':'%'+_0x346688[_0x137b('0x30')][_0x137b('0x3d')]+'%'};return _0x258689;}})});}_0x121d4a=_[_0x137b('0x3e')]({},_0x121d4a,_0x346688[_0x137b('0x3f')]);var _0x58918c={'where':_0x121d4a[_0x137b('0x3a')]};return db[_0x137b('0x2b')][_0x137b('0x1e')](_0x58918c)['then'](function(_0x5c016d){_0x1e7b5a[_0x137b('0x1e')]=_0x5c016d;if(_0x346688[_0x137b('0x30')]['includeAll']){_0x121d4a['include']=[{'all':!![]}];}return db[_0x137b('0x2b')][_0x137b('0x40')](_0x121d4a);})[_0x137b('0x23')](function(_0x4aa65c){_0x1e7b5a[_0x137b('0x41')]=_0x4aa65c;return _0x1e7b5a;})[_0x137b('0x23')](respondWithFilteredResult(_0x25da19,_0x121d4a))[_0x137b('0x42')](handleError(_0x25da19,null));};exports[_0x137b('0x43')]=function(_0x2b3c44,_0x579252){var _0x57dd10={'raw':!![],'where':{'id':_0x2b3c44['params']['id']}},_0x1be071={};_0x1be071[_0x137b('0x2e')]=_[_0x137b('0x2f')](db['FreshsalesField']['rawAttributes']);_0x1be071[_0x137b('0x30')]=_[_0x137b('0x2f')](_0x2b3c44[_0x137b('0x30')]);_0x1be071['filters']=_[_0x137b('0x31')](_0x1be071[_0x137b('0x2e')],_0x1be071[_0x137b('0x30')]);_0x57dd10[_0x137b('0x32')]=_[_0x137b('0x31')](_0x1be071['model'],qs['fields'](_0x2b3c44[_0x137b('0x30')][_0x137b('0x33')]));_0x57dd10[_0x137b('0x32')]=_0x57dd10['attributes']['length']?_0x57dd10[_0x137b('0x32')]:_0x1be071[_0x137b('0x2e')];if(_0x2b3c44[_0x137b('0x30')][_0x137b('0x44')]){_0x57dd10[_0x137b('0x45')]=[{'all':!![]}];}_0x57dd10=_[_0x137b('0x3e')]({},_0x57dd10,_0x2b3c44[_0x137b('0x3f')]);return db[_0x137b('0x2b')][_0x137b('0x46')](_0x57dd10)['then'](handleEntityNotFound(_0x579252,null))['then'](respondWithResult(_0x579252,null))[_0x137b('0x42')](handleError(_0x579252,null));};exports[_0x137b('0x47')]=function(_0x13cd5e,_0x4b3169){return db[_0x137b('0x2b')][_0x137b('0x47')](_0x13cd5e['body'],{})['then'](respondWithResult(_0x4b3169,0xc9))[_0x137b('0x42')](handleError(_0x4b3169,null));};exports[_0x137b('0x22')]=function(_0x58bfa6,_0x5a2b67){if(_0x58bfa6[_0x137b('0x48')]['id']){delete _0x58bfa6[_0x137b('0x48')]['id'];}return db[_0x137b('0x2b')][_0x137b('0x46')]({'where':{'id':_0x58bfa6[_0x137b('0x49')]['id']}})[_0x137b('0x23')](handleEntityNotFound(_0x5a2b67,null))[_0x137b('0x23')](saveUpdates(_0x58bfa6[_0x137b('0x48')],null))[_0x137b('0x23')](respondWithResult(_0x5a2b67,null))[_0x137b('0x42')](handleError(_0x5a2b67,null));};exports[_0x137b('0x24')]=function(_0x2c90c1,_0x399975){return db[_0x137b('0x2b')][_0x137b('0x46')]({'where':{'id':_0x2c90c1['params']['id']}})['then'](handleEntityNotFound(_0x399975,null))[_0x137b('0x23')](removeEntity(_0x399975,null))['catch'](handleError(_0x399975,null));}; \ No newline at end of file +var _0x49ab=['reject','update','then','destroy','stack','name','send','index','map','FreshsalesField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x28d0f7,_0x579973){var _0x45d26b=function(_0x37dea1){while(--_0x37dea1){_0x28d0f7['push'](_0x28d0f7['shift']());}};_0x45d26b(++_0x579973);}(_0x49ab,0x1dd));var _0xb49a=function(_0x24f4ce,_0x7d4b84){_0x24f4ce=_0x24f4ce-0x0;var _0x53b38c=_0x49ab[_0x24f4ce];return _0x53b38c;};'use strict';var emlformat=require(_0xb49a('0x0'));var rimraf=require(_0xb49a('0x1'));var zipdir=require(_0xb49a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb49a('0x3'));var moment=require(_0xb49a('0x4'));var BPromise=require(_0xb49a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb49a('0x6'));var sox=require(_0xb49a('0x7'));var csv=require('to-csv');var ejs=require(_0xb49a('0x8'));var fs=require('fs');var fs_extra=require(_0xb49a('0x9'));var _=require(_0xb49a('0xa'));var squel=require(_0xb49a('0xb'));var crypto=require(_0xb49a('0xc'));var jsforce=require(_0xb49a('0xd'));var deskjs=require(_0xb49a('0xe'));var toCsv=require(_0xb49a('0xf'));var querystring=require(_0xb49a('0x10'));var Papa=require(_0xb49a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb49a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb49a('0x13'))(_0xb49a('0x14'));var utils=require(_0xb49a('0x15'));var config=require(_0xb49a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb49a('0x17'))['db'];function respondWithStatusCode(_0x28c041,_0x29ca53){_0x29ca53=_0x29ca53||0xcc;return function(_0x261350){if(_0x261350){return _0x28c041[_0xb49a('0x18')](_0x29ca53);}return _0x28c041[_0xb49a('0x19')](_0x29ca53)[_0xb49a('0x1a')]();};}function respondWithResult(_0x51cc1b,_0x59b12e){_0x59b12e=_0x59b12e||0xc8;return function(_0x11c83f){if(_0x11c83f){return _0x51cc1b[_0xb49a('0x19')](_0x59b12e)[_0xb49a('0x1b')](_0x11c83f);}};}function respondWithFilteredResult(_0x351a9e,_0x26d2f9){return function(_0x412031){if(_0x412031){var _0x24294e=typeof _0x26d2f9[_0xb49a('0x1c')]===_0xb49a('0x1d')&&typeof _0x26d2f9[_0xb49a('0x1e')]===_0xb49a('0x1d');var _0x480a6a=_0x412031['count'];var _0x17bff7=_0x24294e?0x0:_0x26d2f9[_0xb49a('0x1c')];var _0x417d10=_0x24294e?_0x412031[_0xb49a('0x1f')]:_0x26d2f9[_0xb49a('0x1c')]+_0x26d2f9[_0xb49a('0x1e')];var _0x44c0a8;if(_0x417d10>=_0x480a6a){_0x417d10=_0x480a6a;_0x44c0a8=0xc8;}else{_0x44c0a8=0xce;}_0x351a9e[_0xb49a('0x19')](_0x44c0a8);return _0x351a9e['set'](_0xb49a('0x20'),_0x17bff7+'-'+_0x417d10+'/'+_0x480a6a)[_0xb49a('0x1b')](_0x412031);}return null;};}function patchUpdates(_0x448117){return function(_0xaae413){try{jsonpatch[_0xb49a('0x21')](_0xaae413,_0x448117,!![]);}catch(_0x17c53d){return BPromise[_0xb49a('0x22')](_0x17c53d);}return _0xaae413['save']();};}function saveUpdates(_0x2508a7,_0x5d776b){return function(_0x3cd130){if(_0x3cd130){return _0x3cd130[_0xb49a('0x23')](_0x2508a7)[_0xb49a('0x24')](function(_0x5af836){return _0x5af836;});}return null;};}function removeEntity(_0x28ae1d,_0x3b7034){return function(_0x39234d){if(_0x39234d){return _0x39234d[_0xb49a('0x25')]()[_0xb49a('0x24')](function(){_0x28ae1d['status'](0xcc)[_0xb49a('0x1a')]();});}};}function handleEntityNotFound(_0x3eeac1,_0x2edb1e){return function(_0x368560){if(!_0x368560){_0x3eeac1[_0xb49a('0x18')](0x194);}return _0x368560;};}function handleError(_0x24ad7,_0x2cceb5){_0x2cceb5=_0x2cceb5||0x1f4;return function(_0x34a10e){logger['error'](_0x34a10e[_0xb49a('0x26')]);if(_0x34a10e[_0xb49a('0x27')]){delete _0x34a10e[_0xb49a('0x27')];}_0x24ad7['status'](_0x2cceb5)[_0xb49a('0x28')](_0x34a10e);};}exports[_0xb49a('0x29')]=function(_0x4778af,_0x292d29){var _0x586e9a={},_0x347923={},_0x566918={'count':0x0,'rows':[]};var _0x40d655=_[_0xb49a('0x2a')](db[_0xb49a('0x2b')]['rawAttributes'],function(_0x55427f){return{'name':_0x55427f[_0xb49a('0x2c')],'type':_0x55427f[_0xb49a('0x2d')][_0xb49a('0x2e')]};});_0x347923[_0xb49a('0x2f')]=_['map'](_0x40d655,_0xb49a('0x27'));_0x347923[_0xb49a('0x30')]=_[_0xb49a('0x31')](_0x4778af['query']);_0x347923[_0xb49a('0x32')]=_[_0xb49a('0x33')](_0x347923[_0xb49a('0x2f')],_0x347923[_0xb49a('0x30')]);_0x586e9a[_0xb49a('0x34')]=_['intersection'](_0x347923[_0xb49a('0x2f')],qs[_0xb49a('0x35')](_0x4778af['query']['fields']));_0x586e9a[_0xb49a('0x34')]=_0x586e9a['attributes'][_0xb49a('0x36')]?_0x586e9a['attributes']:_0x347923['model'];if(!_0x4778af['query'][_0xb49a('0x37')]('nolimit')){_0x586e9a[_0xb49a('0x1e')]=qs['limit'](_0x4778af['query'][_0xb49a('0x1e')]);_0x586e9a[_0xb49a('0x1c')]=qs['offset'](_0x4778af['query'][_0xb49a('0x1c')]);}_0x586e9a[_0xb49a('0x38')]=qs[_0xb49a('0x39')](_0x4778af[_0xb49a('0x30')][_0xb49a('0x39')]);_0x586e9a['where']=qs[_0xb49a('0x32')](_[_0xb49a('0x3a')](_0x4778af[_0xb49a('0x30')],_0x347923[_0xb49a('0x32')]),_0x40d655);if(_0x4778af[_0xb49a('0x30')]['filter']){_0x586e9a[_0xb49a('0x3b')]=_[_0xb49a('0x3c')](_0x586e9a[_0xb49a('0x3b')],{'$or':_['map'](_0x40d655,function(_0x59fbff){if(_0x59fbff[_0xb49a('0x2d')]!==_0xb49a('0x3d')){var _0x29843c={};_0x29843c[_0x59fbff['name']]={'$like':'%'+_0x4778af[_0xb49a('0x30')][_0xb49a('0x3e')]+'%'};return _0x29843c;}})});}_0x586e9a=_[_0xb49a('0x3c')]({},_0x586e9a,_0x4778af[_0xb49a('0x3f')]);var _0x121d2={'where':_0x586e9a[_0xb49a('0x3b')]};return db[_0xb49a('0x2b')][_0xb49a('0x1f')](_0x121d2)[_0xb49a('0x24')](function(_0x1ec3f4){_0x566918[_0xb49a('0x1f')]=_0x1ec3f4;if(_0x4778af[_0xb49a('0x30')][_0xb49a('0x40')]){_0x586e9a['include']=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x586e9a);})['then'](function(_0xe135e9){_0x566918[_0xb49a('0x41')]=_0xe135e9;return _0x566918;})[_0xb49a('0x24')](respondWithFilteredResult(_0x292d29,_0x586e9a))[_0xb49a('0x42')](handleError(_0x292d29,null));};exports[_0xb49a('0x43')]=function(_0x105ec6,_0x5a282a){var _0x5ad6c5={'raw':!![],'where':{'id':_0x105ec6['params']['id']}},_0x2efb1c={};_0x2efb1c[_0xb49a('0x2f')]=_[_0xb49a('0x31')](db[_0xb49a('0x2b')]['rawAttributes']);_0x2efb1c[_0xb49a('0x30')]=_[_0xb49a('0x31')](_0x105ec6['query']);_0x2efb1c[_0xb49a('0x32')]=_[_0xb49a('0x33')](_0x2efb1c[_0xb49a('0x2f')],_0x2efb1c[_0xb49a('0x30')]);_0x5ad6c5[_0xb49a('0x34')]=_[_0xb49a('0x33')](_0x2efb1c[_0xb49a('0x2f')],qs[_0xb49a('0x35')](_0x105ec6[_0xb49a('0x30')]['fields']));_0x5ad6c5[_0xb49a('0x34')]=_0x5ad6c5[_0xb49a('0x34')]['length']?_0x5ad6c5[_0xb49a('0x34')]:_0x2efb1c[_0xb49a('0x2f')];if(_0x105ec6['query'][_0xb49a('0x40')]){_0x5ad6c5[_0xb49a('0x44')]=[{'all':!![]}];}_0x5ad6c5=_[_0xb49a('0x3c')]({},_0x5ad6c5,_0x105ec6['options']);return db[_0xb49a('0x2b')][_0xb49a('0x45')](_0x5ad6c5)[_0xb49a('0x24')](handleEntityNotFound(_0x5a282a,null))['then'](respondWithResult(_0x5a282a,null))[_0xb49a('0x42')](handleError(_0x5a282a,null));};exports[_0xb49a('0x46')]=function(_0x103816,_0x41d76d){return db[_0xb49a('0x2b')][_0xb49a('0x46')](_0x103816[_0xb49a('0x47')],{})['then'](respondWithResult(_0x41d76d,0xc9))['catch'](handleError(_0x41d76d,null));};exports['update']=function(_0x2af565,_0x1a2006){if(_0x2af565[_0xb49a('0x47')]['id']){delete _0x2af565[_0xb49a('0x47')]['id'];}return db[_0xb49a('0x2b')][_0xb49a('0x45')]({'where':{'id':_0x2af565[_0xb49a('0x48')]['id']}})[_0xb49a('0x24')](handleEntityNotFound(_0x1a2006,null))[_0xb49a('0x24')](saveUpdates(_0x2af565['body'],null))[_0xb49a('0x24')](respondWithResult(_0x1a2006,null))[_0xb49a('0x42')](handleError(_0x1a2006,null));};exports['destroy']=function(_0x3977a6,_0x484ed0){return db[_0xb49a('0x2b')][_0xb49a('0x45')]({'where':{'id':_0x3977a6[_0xb49a('0x48')]['id']}})[_0xb49a('0x24')](handleEntityNotFound(_0x484ed0,null))[_0xb49a('0x24')](removeEntity(_0x484ed0,null))[_0xb49a('0x42')](handleError(_0x484ed0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 98bc143..cd48e8e 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 _0x8a5c=['exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes'];(function(_0x2a02b9,_0x110c2c){var _0x578f84=function(_0x42ca80){while(--_0x42ca80){_0x2a02b9['push'](_0x2a02b9['shift']());}};_0x578f84(++_0x110c2c);}(_0x8a5c,0x136));var _0xc8a5=function(_0x42edc2,_0x405fec){_0x42edc2=_0x42edc2-0x0;var _0x9538a1=_0x8a5c[_0x42edc2];return _0x9538a1;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var logger=require(_0xc8a5('0x2'))(_0xc8a5('0x3'));var moment=require(_0xc8a5('0x4'));var BPromise=require(_0xc8a5('0x5'));var rp=require(_0xc8a5('0x6'));var fs=require('fs');var path=require(_0xc8a5('0x7'));var rimraf=require(_0xc8a5('0x8'));var config=require('../../config/environment');var attributes=require(_0xc8a5('0x9'));module[_0xc8a5('0xa')]=function(_0x5b6cc2,_0x1b4ed4){return _0x5b6cc2[_0xc8a5('0xb')](_0xc8a5('0xc'),attributes,{'tableName':_0xc8a5('0xd'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xc8a5('0xe'),_0xc8a5('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaebd=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','idField','FieldId','lodash'];(function(_0x58ad73,_0x495f5d){var _0x2ec776=function(_0x199d09){while(--_0x199d09){_0x58ad73['push'](_0x58ad73['shift']());}};_0x2ec776(++_0x495f5d);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x3c8df1,_0x5ccbdf){_0x3c8df1=_0x3c8df1-0x0;var _0xb37cce=_0xaebd[_0x3c8df1];return _0xb37cce;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var rp=require(_0xdaeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var attributes=require(_0xdaeb('0x8'));module[_0xdaeb('0x9')]=function(_0xee94f9,_0x4b7255){return _0xee94f9[_0xdaeb('0xa')](_0xdaeb('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xdaeb('0xc'),_0xdaeb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index f77716b..5a96c3f 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 _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5ee367,_0x5aff0b){var _0x145dde=function(_0x1a23d0){while(--_0x1a23d0){_0x5ee367['push'](_0x5ee367['shift']());}};_0x145dde(++_0x5aff0b);}(_0x5496,0x175));var _0x6549=function(_0x5980fe,_0x5240c6){_0x5980fe=_0x5980fe-0x0;var _0x528bc7=_0x5496[_0x5980fe];return _0x528bc7;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file +var _0x5d17=['request','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3efd24,_0x307e53){var _0x5df6f2=function(_0x52503d){while(--_0x52503d){_0x3efd24['push'](_0x3efd24['shift']());}};_0x5df6f2(++_0x307e53);}(_0x5d17,0x114));var _0x75d1=function(_0x2c84e5,_0x58a7c7){_0x2c84e5=_0x2c84e5-0x0;var _0x4990ec=_0x5d17[_0x2c84e5];return _0x4990ec;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 6f44750..0df096a 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x27a40f,_0x30664e){var _0x33bdde=function(_0x9bb44b){while(--_0x9bb44b){_0x27a40f['push'](_0x27a40f['shift']());}};_0x33bdde(++_0x30664e);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5e85e1,_0x4dedd6){var _0x272ce0=function(_0x2b3ae0){while(--_0x2b3ae0){_0x5e85e1['push'](_0x5e85e1['shift']());}};_0x272ce0(++_0x4dedd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e306b29..07b120f 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 _0x500c=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x2c9a31,_0x1bda71){var _0x2d9ad1=function(_0x4db493){while(--_0x4db493){_0x2c9a31['push'](_0x2c9a31['shift']());}};_0x2d9ad1(++_0x1bda71);}(_0x500c,0x188));var _0xc500=function(_0xa17aaf,_0x4c850e){_0xa17aaf=_0xa17aaf-0x0;var _0x18bb47=_0x500c[_0xa17aaf];return _0x18bb47;};'use strict';var Sequelize=require(_0xc500('0x0'));module[_0xc500('0x1')]={'name':{'type':Sequelize[_0xc500('0x2')]},'description':{'type':Sequelize[_0xc500('0x2')]},'username':{'type':Sequelize[_0xc500('0x2')],'unique':_0xc500('0x3')},'remoteUri':{'type':Sequelize[_0xc500('0x2')]},'password':{'type':Sequelize[_0xc500('0x2')]},'clientId':{'type':Sequelize[_0xc500('0x2')]},'clientSecret':{'type':Sequelize[_0xc500('0x2')]},'securityToken':{'type':Sequelize[_0xc500('0x2')]},'serverUrl':{'type':Sequelize[_0xc500('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc500('0x4')](_0xc500('0x5'),_0xc500('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x3134=['STRING','username','integrationTab','sequelize'];(function(_0x26bae6,_0x538703){var _0x22256e=function(_0x59a6ae){while(--_0x59a6ae){_0x26bae6['push'](_0x26bae6['shift']());}};_0x22256e(++_0x538703);}(_0x3134,0xdf));var _0x4313=function(_0x4112ed,_0x49564d){_0x4112ed=_0x4112ed-0x0;var _0x1ce7c2=_0x3134[_0x4112ed];return _0x1ce7c2;};'use strict';var Sequelize=require(_0x4313('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4313('0x1')]},'username':{'type':Sequelize[_0x4313('0x1')],'unique':_0x4313('0x2')},'remoteUri':{'type':Sequelize[_0x4313('0x1')]},'password':{'type':Sequelize[_0x4313('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x4313('0x1')]},'serverUrl':{'type':Sequelize[_0x4313('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4313('0x3'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 87a16ab..2228f3f 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 _0x446d=['includeAll','include','findAll','catch','params','keys','rawAttributes','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','Task','remoteUri','clientId','password','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','username','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','string','int','email','phone','includes','custom','picklistValues','label','value','boolean','True','false','test','error','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','SalesforceAccount'];(function(_0x2161d9,_0x265fd7){var _0x28f59b=function(_0x40930a){while(--_0x40930a){_0x2161d9['push'](_0x2161d9['shift']());}};_0x28f59b(++_0x265fd7);}(_0x446d,0x126));var _0xd446=function(_0xf18452,_0x1df28e){_0xf18452=_0xf18452-0x0;var _0x2d87c2=_0x446d[_0xf18452];return _0x2d87c2;};'use strict';var emlformat=require(_0xd446('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd446('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd446('0x2'));var moment=require(_0xd446('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd446('0x4'));var util=require('util');var path=require(_0xd446('0x5'));var sox=require(_0xd446('0x6'));var csv=require(_0xd446('0x7'));var ejs=require(_0xd446('0x8'));var fs=require('fs');var fs_extra=require(_0xd446('0x9'));var _=require(_0xd446('0xa'));var squel=require(_0xd446('0xb'));var crypto=require('crypto');var jsforce=require(_0xd446('0xc'));var deskjs=require(_0xd446('0xd'));var toCsv=require(_0xd446('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd446('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd446('0xf'));var hardwareService=require(_0xd446('0x10'));var logger=require('../../config/logger')(_0xd446('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd446('0x12'))['db'];var integrations=require(_0xd446('0x13'));function respondWithStatusCode(_0x5d5e74,_0x316bcd){_0x316bcd=_0x316bcd||0xcc;return function(_0x1cf84e){if(_0x1cf84e){return _0x5d5e74[_0xd446('0x14')](_0x316bcd);}return _0x5d5e74[_0xd446('0x15')](_0x316bcd)[_0xd446('0x16')]();};}function respondWithResult(_0x42b388,_0xe2f311){_0xe2f311=_0xe2f311||0xc8;return function(_0x46535b){if(_0x46535b){return _0x42b388[_0xd446('0x15')](_0xe2f311)[_0xd446('0x17')](_0x46535b);}};}function respondWithFilteredResult(_0x574e52,_0x56fbcb){return function(_0x2ffbfd){if(_0x2ffbfd){var _0x53a76f=typeof _0x56fbcb[_0xd446('0x18')]===_0xd446('0x19')&&typeof _0x56fbcb['limit']===_0xd446('0x19');var _0x1d2302=_0x2ffbfd[_0xd446('0x1a')];var _0x1ab252=_0x53a76f?0x0:_0x56fbcb['offset'];var _0x716aec=_0x53a76f?_0x2ffbfd[_0xd446('0x1a')]:_0x56fbcb[_0xd446('0x18')]+_0x56fbcb['limit'];var _0x563423;if(_0x716aec>=_0x1d2302){_0x716aec=_0x1d2302;_0x563423=0xc8;}else{_0x563423=0xce;}_0x574e52[_0xd446('0x15')](_0x563423);return _0x574e52['set'](_0xd446('0x1b'),_0x1ab252+'-'+_0x716aec+'/'+_0x1d2302)[_0xd446('0x17')](_0x2ffbfd);}return null;};}function patchUpdates(_0x494b20){return function(_0x46e71a){try{jsonpatch[_0xd446('0x1c')](_0x46e71a,_0x494b20,!![]);}catch(_0x5e0d1f){return BPromise[_0xd446('0x1d')](_0x5e0d1f);}return _0x46e71a[_0xd446('0x1e')]();};}function saveUpdates(_0x3e1243,_0xf53cd2){return function(_0x16cf30){if(_0x16cf30){return _0x16cf30[_0xd446('0x1f')](_0x3e1243)[_0xd446('0x20')](function(_0x3f96c8){return _0x3f96c8;});}return null;};}function removeEntity(_0x544e61,_0x610c93){return function(_0x2572b2){if(_0x2572b2){return _0x2572b2[_0xd446('0x21')]()[_0xd446('0x20')](function(){_0x544e61['status'](0xcc)[_0xd446('0x16')]();});}};}function handleEntityNotFound(_0x44d2ea,_0x4cbc6e){return function(_0x2ff326){if(!_0x2ff326){_0x44d2ea[_0xd446('0x14')](0x194);}return _0x2ff326;};}function handleError(_0xd4f9cc,_0x2d4a57){_0x2d4a57=_0x2d4a57||0x1f4;return function(_0x48e40d){logger['error'](_0x48e40d[_0xd446('0x22')]);if(_0x48e40d[_0xd446('0x23')]){delete _0x48e40d['name'];}_0xd4f9cc[_0xd446('0x15')](_0x2d4a57)[_0xd446('0x24')](_0x48e40d);};}exports[_0xd446('0x25')]=function(_0x424479,_0xec95cc){var _0x41230f={},_0x53f826={},_0x4288af={'count':0x0,'rows':[]};var _0x36fe61=_[_0xd446('0x26')](db['SalesforceAccount']['rawAttributes'],function(_0x32096b){return{'name':_0x32096b[_0xd446('0x27')],'type':_0x32096b['type'][_0xd446('0x28')]};});_0x53f826[_0xd446('0x29')]=_[_0xd446('0x26')](_0x36fe61,'name');_0x53f826[_0xd446('0x2a')]=_['keys'](_0x424479[_0xd446('0x2a')]);_0x53f826[_0xd446('0x2b')]=_[_0xd446('0x2c')](_0x53f826[_0xd446('0x29')],_0x53f826['query']);_0x41230f[_0xd446('0x2d')]=_[_0xd446('0x2c')](_0x53f826['model'],qs[_0xd446('0x2e')](_0x424479[_0xd446('0x2a')][_0xd446('0x2e')]));_0x41230f['attributes']=_0x41230f[_0xd446('0x2d')][_0xd446('0x2f')]?_0x41230f[_0xd446('0x2d')]:_0x53f826['model'];if(!_0x424479['query'][_0xd446('0x30')](_0xd446('0x31'))){_0x41230f[_0xd446('0x32')]=qs['limit'](_0x424479[_0xd446('0x2a')][_0xd446('0x32')]);_0x41230f[_0xd446('0x18')]=qs[_0xd446('0x18')](_0x424479[_0xd446('0x2a')][_0xd446('0x18')]);}_0x41230f[_0xd446('0x33')]=qs[_0xd446('0x34')](_0x424479[_0xd446('0x2a')][_0xd446('0x34')]);_0x41230f[_0xd446('0x35')]=qs[_0xd446('0x2b')](_[_0xd446('0x36')](_0x424479['query'],_0x53f826['filters']),_0x36fe61);if(_0x424479['query'][_0xd446('0x37')]){_0x41230f[_0xd446('0x35')]=_[_0xd446('0x38')](_0x41230f[_0xd446('0x35')],{'$or':_[_0xd446('0x26')](_0x36fe61,function(_0x28df39){if(_0x28df39[_0xd446('0x39')]!==_0xd446('0x3a')){var _0xc6fec7={};_0xc6fec7[_0x28df39[_0xd446('0x23')]]={'$like':'%'+_0x424479[_0xd446('0x2a')][_0xd446('0x37')]+'%'};return _0xc6fec7;}})});}_0x41230f=_['merge']({},_0x41230f,_0x424479['options']);var _0x1ce91a={'where':_0x41230f[_0xd446('0x35')]};return db[_0xd446('0x3b')][_0xd446('0x1a')](_0x1ce91a)['then'](function(_0x1ca411){_0x4288af['count']=_0x1ca411;if(_0x424479[_0xd446('0x2a')][_0xd446('0x3c')]){_0x41230f[_0xd446('0x3d')]=[{'all':!![]}];}return db[_0xd446('0x3b')][_0xd446('0x3e')](_0x41230f);})[_0xd446('0x20')](function(_0x280265){_0x4288af['rows']=_0x280265;return _0x4288af;})[_0xd446('0x20')](respondWithFilteredResult(_0xec95cc,_0x41230f))[_0xd446('0x3f')](handleError(_0xec95cc,null));};exports['show']=function(_0x574e07,_0x36f17b){var _0x901cd2={'raw':![],'where':{'id':_0x574e07[_0xd446('0x40')]['id']}},_0x357b90={};_0x357b90[_0xd446('0x29')]=_[_0xd446('0x41')](db[_0xd446('0x3b')][_0xd446('0x42')]);_0x357b90[_0xd446('0x2a')]=_[_0xd446('0x41')](_0x574e07['query']);_0x357b90[_0xd446('0x2b')]=_[_0xd446('0x2c')](_0x357b90['model'],_0x357b90[_0xd446('0x2a')]);_0x901cd2[_0xd446('0x2d')]=_[_0xd446('0x2c')](_0x357b90[_0xd446('0x29')],qs[_0xd446('0x2e')](_0x574e07[_0xd446('0x2a')][_0xd446('0x2e')]));_0x901cd2['attributes']=_0x901cd2[_0xd446('0x2d')]['length']?_0x901cd2[_0xd446('0x2d')]:_0x357b90[_0xd446('0x29')];if(_0x574e07[_0xd446('0x2a')]['includeAll']){_0x901cd2[_0xd446('0x3d')]=[{'all':!![]}];}_0x901cd2=_[_0xd446('0x38')]({},_0x901cd2,_0x574e07[_0xd446('0x43')]);return db[_0xd446('0x3b')][_0xd446('0x44')](_0x901cd2)[_0xd446('0x20')](handleEntityNotFound(_0x36f17b,null))[_0xd446('0x20')](respondWithResult(_0x36f17b,null))['catch'](handleError(_0x36f17b,null));};exports[_0xd446('0x45')]=function(_0x3976d0,_0x5ce6f2){return db['SalesforceAccount']['create'](_0x3976d0[_0xd446('0x46')],{})['then'](respondWithResult(_0x5ce6f2,0xc9))[_0xd446('0x3f')](handleError(_0x5ce6f2,null));};exports['update']=function(_0xeac165,_0x502777){if(_0xeac165[_0xd446('0x46')]['id']){delete _0xeac165[_0xd446('0x46')]['id'];}return db['SalesforceAccount'][_0xd446('0x44')]({'where':{'id':_0xeac165[_0xd446('0x40')]['id']}})[_0xd446('0x20')](handleEntityNotFound(_0x502777,null))[_0xd446('0x20')](saveUpdates(_0xeac165['body'],null))['then'](respondWithResult(_0x502777,null))['catch'](handleError(_0x502777,null));};exports[_0xd446('0x21')]=function(_0x5b0bf1,_0x1424c3){return db['SalesforceAccount']['find']({'where':{'id':_0x5b0bf1['params']['id']}})[_0xd446('0x20')](handleEntityNotFound(_0x1424c3,null))['then'](removeEntity(_0x1424c3,null))[_0xd446('0x3f')](handleError(_0x1424c3,null));};exports[_0xd446('0x47')]=function(_0x31b24d,_0x58e951,_0x123419){var _0x43f770={};var _0x212b3e={};var _0x24a110;var _0x298c48;return db[_0xd446('0x3b')][_0xd446('0x48')]({'where':{'id':_0x31b24d[_0xd446('0x40')]['id']}})['then'](handleEntityNotFound(_0x58e951,null))['then'](function(_0x5dc085){if(_0x5dc085){_0x24a110=_0x5dc085;_0x212b3e[_0xd446('0x29')]=_[_0xd446('0x41')](db[_0xd446('0x49')][_0xd446('0x42')]);_0x212b3e['query']=_[_0xd446('0x41')](_0x31b24d[_0xd446('0x2a')]);_0x212b3e[_0xd446('0x2b')]=_[_0xd446('0x2c')](_0x212b3e[_0xd446('0x29')],_0x212b3e[_0xd446('0x2a')]);_0x43f770[_0xd446('0x2d')]=_[_0xd446('0x2c')](_0x212b3e['model'],qs[_0xd446('0x2e')](_0x31b24d[_0xd446('0x2a')]['fields']));_0x43f770[_0xd446('0x2d')]=_0x43f770[_0xd446('0x2d')]['length']?_0x43f770[_0xd446('0x2d')]:_0x212b3e[_0xd446('0x29')];_0x43f770[_0xd446('0x33')]=qs[_0xd446('0x34')](_0x31b24d[_0xd446('0x2a')][_0xd446('0x34')]);_0x43f770[_0xd446('0x35')]=qs[_0xd446('0x2b')](_['pick'](_0x31b24d[_0xd446('0x2a')],_0x212b3e[_0xd446('0x2b')]));if(_0x31b24d['query'][_0xd446('0x37')]){_0x43f770[_0xd446('0x35')]=_[_0xd446('0x38')](_0x43f770[_0xd446('0x35')],{'$or':_[_0xd446('0x26')](_0x43f770['attributes'],function(_0x555489){var _0x4e3f27={};_0x4e3f27[_0x555489]={'$like':'%'+_0x31b24d['query'][_0xd446('0x37')]+'%'};return _0x4e3f27;})});}_0x43f770=_[_0xd446('0x38')]({},_0x43f770,_0x31b24d[_0xd446('0x43')]);return _0x24a110['getConfigurations'](_0x43f770);}})['then'](function(_0x3c0595){if(_0x3c0595){_0x298c48=_0x3c0595[_0xd446('0x2f')];if(!_0x31b24d[_0xd446('0x2a')][_0xd446('0x30')]('nolimit')){_0x43f770[_0xd446('0x32')]=qs[_0xd446('0x32')](_0x31b24d['query'][_0xd446('0x32')]);_0x43f770['offset']=qs[_0xd446('0x18')](_0x31b24d[_0xd446('0x2a')][_0xd446('0x18')]);}return _0x24a110[_0xd446('0x47')](_0x43f770);}})[_0xd446('0x20')](function(_0xced300){if(_0xced300){return _0xced300?{'count':_0x298c48,'rows':_0xced300}:null;}})[_0xd446('0x20')](respondWithResult(_0x58e951,null))['catch'](handleError(_0x58e951,null));};exports[_0xd446('0x4a')]=function(_0x4a0d3d,_0x1182a3,_0x350c1b){if(_0x4a0d3d[_0xd446('0x46')]['id']){delete _0x4a0d3d[_0xd446('0x46')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x4a0d3d[_0xd446('0x40')]['id']}})[_0xd446('0x20')](handleEntityNotFound(_0x1182a3,null))['then'](function(_0x1c3a63){if(_0x1c3a63){_0x4a0d3d[_0xd446('0x46')][_0xd446('0x4b')]=_0x1c3a63['id'];_0x4a0d3d[_0xd446('0x46')][_0xd446('0x4c')]=integrations[_0xd446('0x4d')](_0x4a0d3d[_0xd446('0x46')][_0xd446('0x4e')],_0x4a0d3d[_0xd446('0x46')][_0xd446('0x39')]);_0x4a0d3d[_0xd446('0x46')][_0xd446('0x4f')]=integrations['getDescriptions'](_0x4a0d3d['body']['channel'],_0x4a0d3d[_0xd446('0x46')][_0xd446('0x39')]);return db[_0xd446('0x49')][_0xd446('0x45')](_0x4a0d3d['body'],{'include':[{'model':db[_0xd446('0x50')],'as':_0xd446('0x4c')},{'model':db[_0xd446('0x50')],'as':_0xd446('0x4f')}]});}return null;})['then'](respondWithResult(_0x1182a3,null))[_0xd446('0x3f')](handleError(_0x1182a3,null));};exports['getFields']=function(_0x2bc503,_0x29002c,_0x3b2e55){var _0x5be7dc;var _0xfccedd='';var _0xadc5eb=_0xd446('0x51');return db[_0xd446('0x3b')][_0xd446('0x48')]({'where':{'id':_0x2bc503[_0xd446('0x40')]['id']},'attributes':['id',_0xd446('0x52'),_0xd446('0x53'),'clientSecret','username',_0xd446('0x54'),_0xd446('0x55')]})[_0xd446('0x20')](handleEntityNotFound(_0x29002c,null))['then'](function(_0x31150b){if(_0x31150b){_0xfccedd=_0x31150b[_0xd446('0x52')];var _0x2f921c=_0xfccedd[_0xd446('0x56')](-0x1);if(_0x2f921c==='/'){_0xfccedd=_0xfccedd[_0xd446('0x57')](0x0,_0xfccedd[_0xd446('0x58')](_0x2f921c));}_0x5be7dc=new jsforce[(_0xd446('0x59'))]({'oauth2':{'loginUrl':_0xfccedd,'clientId':_0x31150b[_0xd446('0x53')],'clientSecret':_0x31150b[_0xd446('0x5a')]}});return _0x5be7dc['login'](_0x31150b[_0xd446('0x5b')],_0x31150b[_0xd446('0x54')][_0xd446('0x5c')](_0x31150b[_0xd446('0x55')]));}})['then'](function(_0x44c513){if(_0x44c513){if(!_[_0xd446('0x5d')](_0x2bc503[_0xd446('0x2a')][_0xd446('0x5e')])){_0xadc5eb=_0x2bc503['query']['ticketType'];}return _0x5be7dc[_0xd446('0x5f')](_0xadc5eb)[_0xd446('0x60')]();}})[_0xd446('0x20')](function(_0x4738d5){var _0x125f12=[_0xd446('0x61'),'ActivityDate',_0xd446('0x62'),_0xd446('0x63'),_0xd446('0x64'),'Description'];var _0x196a6e=[_0xd446('0x65'),_0xd446('0x66'),'picklist','boolean',_0xd446('0x67'),'textarea',_0xd446('0x68')];if(_0x4738d5){_['remove'](_0x4738d5['fields'],function(_0x363d2a){return _0x125f12[_0xd446('0x69')](_0x363d2a[_0xd446('0x23')])||!_0x196a6e['includes'](_0x363d2a['type']);});return{'count':_0x4738d5[_0xd446('0x2e')]['length'],'rows':_[_0xd446('0x26')](_0x4738d5['fields'],function(_0x9df5ac){return{'id':_0x9df5ac[_0xd446('0x23')],'name':_0x9df5ac['label'],'custom':_0x9df5ac[_0xd446('0x6a')],'options':_0x9df5ac[_0xd446('0x6b')][_0xd446('0x2f')]>0x0?_[_0xd446('0x26')](_0x9df5ac[_0xd446('0x6b')],function(_0x1a17b9){return{'name':_0x1a17b9[_0xd446('0x6c')],'value':_0x1a17b9[_0xd446('0x6d')]};}):_0x9df5ac[_0xd446('0x39')]==_0xd446('0x6e')?[{'name':_0xd446('0x6f'),'value':'true'},{'name':'False','value':_0xd446('0x70')}]:[]};})};}})[_0xd446('0x20')](respondWithResult(_0x29002c,null))[_0xd446('0x3f')](function(_0x312d36){var _0x5b5fe6=_0x2bc503[_0xd446('0x2a')][_0xd446('0x71')]?0x1f4:_0x312d36['statusCode']||0x1f4;logger[_0xd446('0x72')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5b5fe6,JSON[_0xd446('0x73')](_0x312d36));delete _0x312d36['name'];if(_0x5b5fe6===0x191){_0x5b5fe6=0x190;}_0x29002c[_0xd446('0x15')](_0x5b5fe6)['send'](_0x2bc503['query'][_0xd446('0x71')]?{'message':_0xd446('0x74'),'statusCode':_0x312d36[_0xd446('0x75')]}:_0x312d36);});}; \ No newline at end of file +var _0x1305=['sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','boolean','email','textarea','phone','remove','includes','custom','picklistValues','value','True','true','False','false','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','then','destroy','end','name','send','index','map','SalesforceAccount','rawAttributes','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','rows','catch','show','include','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','securityToken','slice','Connection','clientId','login','password','isNil','ticketType'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1305,0x18e));var _0x5130=function(_0x2161a8,_0x374c19){_0x2161a8=_0x2161a8-0x0;var _0x3025b3=_0x1305[_0x2161a8];return _0x3025b3;};'use strict';var emlformat=require(_0x5130('0x0'));var rimraf=require(_0x5130('0x1'));var zipdir=require(_0x5130('0x2'));var jsonpatch=require(_0x5130('0x3'));var rp=require(_0x5130('0x4'));var moment=require(_0x5130('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5130('0x6'));var util=require(_0x5130('0x7'));var path=require(_0x5130('0x8'));var sox=require(_0x5130('0x9'));var csv=require(_0x5130('0xa'));var ejs=require(_0x5130('0xb'));var fs=require('fs');var fs_extra=require(_0x5130('0xc'));var _=require(_0x5130('0xd'));var squel=require(_0x5130('0xe'));var crypto=require(_0x5130('0xf'));var jsforce=require(_0x5130('0x10'));var deskjs=require(_0x5130('0x11'));var toCsv=require(_0x5130('0xa'));var querystring=require('querystring');var Papa=require(_0x5130('0x12'));var Redis=require(_0x5130('0x13'));var authService=require(_0x5130('0x14'));var qs=require(_0x5130('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5130('0x16'));var logger=require(_0x5130('0x17'))(_0x5130('0x18'));var utils=require(_0x5130('0x19'));var config=require(_0x5130('0x1a'));var licenseUtil=require(_0x5130('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5130('0x1c'));function respondWithStatusCode(_0x570bbb,_0x408e99){_0x408e99=_0x408e99||0xcc;return function(_0x25e6b3){if(_0x25e6b3){return _0x570bbb[_0x5130('0x1d')](_0x408e99);}return _0x570bbb['status'](_0x408e99)['end']();};}function respondWithResult(_0x55713e,_0x2dd3a4){_0x2dd3a4=_0x2dd3a4||0xc8;return function(_0x1a91fa){if(_0x1a91fa){return _0x55713e['status'](_0x2dd3a4)[_0x5130('0x1e')](_0x1a91fa);}};}function respondWithFilteredResult(_0x1b598a,_0x32121b){return function(_0x26a900){if(_0x26a900){var _0x4c5f33=typeof _0x32121b[_0x5130('0x1f')]===_0x5130('0x20')&&typeof _0x32121b[_0x5130('0x21')]==='undefined';var _0x48f0ba=_0x26a900[_0x5130('0x22')];var _0x5c7992=_0x4c5f33?0x0:_0x32121b['offset'];var _0x87ac2e=_0x4c5f33?_0x26a900['count']:_0x32121b[_0x5130('0x1f')]+_0x32121b['limit'];var _0x45405e;if(_0x87ac2e>=_0x48f0ba){_0x87ac2e=_0x48f0ba;_0x45405e=0xc8;}else{_0x45405e=0xce;}_0x1b598a[_0x5130('0x23')](_0x45405e);return _0x1b598a['set'](_0x5130('0x24'),_0x5c7992+'-'+_0x87ac2e+'/'+_0x48f0ba)['json'](_0x26a900);}return null;};}function patchUpdates(_0x1d568a){return function(_0x355b43){try{jsonpatch['apply'](_0x355b43,_0x1d568a,!![]);}catch(_0x345510){return BPromise[_0x5130('0x25')](_0x345510);}return _0x355b43[_0x5130('0x26')]();};}function saveUpdates(_0x120a7e,_0x4d74f3){return function(_0x530318){if(_0x530318){return _0x530318[_0x5130('0x27')](_0x120a7e)[_0x5130('0x28')](function(_0x431796){return _0x431796;});}return null;};}function removeEntity(_0x32e60d,_0x20a11d){return function(_0x3868d5){if(_0x3868d5){return _0x3868d5[_0x5130('0x29')]()[_0x5130('0x28')](function(){_0x32e60d[_0x5130('0x23')](0xcc)[_0x5130('0x2a')]();});}};}function handleEntityNotFound(_0x1131d3,_0x6ffa8d){return function(_0x1ed2a1){if(!_0x1ed2a1){_0x1131d3[_0x5130('0x1d')](0x194);}return _0x1ed2a1;};}function handleError(_0x44bde6,_0x30c3ae){_0x30c3ae=_0x30c3ae||0x1f4;return function(_0x2932ff){logger['error'](_0x2932ff['stack']);if(_0x2932ff[_0x5130('0x2b')]){delete _0x2932ff['name'];}_0x44bde6[_0x5130('0x23')](_0x30c3ae)[_0x5130('0x2c')](_0x2932ff);};}exports[_0x5130('0x2d')]=function(_0x83b53d,_0x4060d1){var _0x19c85b={},_0x3e66c5={},_0x49af46={'count':0x0,'rows':[]};var _0x23910d=_[_0x5130('0x2e')](db[_0x5130('0x2f')][_0x5130('0x30')],function(_0x5c10d3){return{'name':_0x5c10d3['fieldName'],'type':_0x5c10d3[_0x5130('0x31')]['key']};});_0x3e66c5['model']=_[_0x5130('0x2e')](_0x23910d,'name');_0x3e66c5[_0x5130('0x32')]=_[_0x5130('0x33')](_0x83b53d[_0x5130('0x32')]);_0x3e66c5['filters']=_[_0x5130('0x34')](_0x3e66c5['model'],_0x3e66c5['query']);_0x19c85b[_0x5130('0x35')]=_[_0x5130('0x34')](_0x3e66c5[_0x5130('0x36')],qs[_0x5130('0x37')](_0x83b53d['query'][_0x5130('0x37')]));_0x19c85b[_0x5130('0x35')]=_0x19c85b['attributes'][_0x5130('0x38')]?_0x19c85b[_0x5130('0x35')]:_0x3e66c5[_0x5130('0x36')];if(!_0x83b53d[_0x5130('0x32')][_0x5130('0x39')](_0x5130('0x3a'))){_0x19c85b[_0x5130('0x21')]=qs[_0x5130('0x21')](_0x83b53d[_0x5130('0x32')]['limit']);_0x19c85b['offset']=qs[_0x5130('0x1f')](_0x83b53d['query'][_0x5130('0x1f')]);}_0x19c85b[_0x5130('0x3b')]=qs[_0x5130('0x3c')](_0x83b53d['query'][_0x5130('0x3c')]);_0x19c85b[_0x5130('0x3d')]=qs[_0x5130('0x3e')](_['pick'](_0x83b53d['query'],_0x3e66c5[_0x5130('0x3e')]),_0x23910d);if(_0x83b53d[_0x5130('0x32')][_0x5130('0x3f')]){_0x19c85b[_0x5130('0x3d')]=_[_0x5130('0x40')](_0x19c85b['where'],{'$or':_[_0x5130('0x2e')](_0x23910d,function(_0x4c26fd){if(_0x4c26fd[_0x5130('0x31')]!=='VIRTUAL'){var _0x4b3473={};_0x4b3473[_0x4c26fd['name']]={'$like':'%'+_0x83b53d[_0x5130('0x32')]['filter']+'%'};return _0x4b3473;}})});}_0x19c85b=_[_0x5130('0x40')]({},_0x19c85b,_0x83b53d[_0x5130('0x41')]);var _0x36eb25={'where':_0x19c85b[_0x5130('0x3d')]};return db[_0x5130('0x2f')]['count'](_0x36eb25)['then'](function(_0xb7b8ca){_0x49af46['count']=_0xb7b8ca;if(_0x83b53d[_0x5130('0x32')][_0x5130('0x42')]){_0x19c85b['include']=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x19c85b);})[_0x5130('0x28')](function(_0x577f72){_0x49af46[_0x5130('0x43')]=_0x577f72;return _0x49af46;})[_0x5130('0x28')](respondWithFilteredResult(_0x4060d1,_0x19c85b))[_0x5130('0x44')](handleError(_0x4060d1,null));};exports[_0x5130('0x45')]=function(_0x2a56f4,_0x3e426a){var _0x3811f6={'raw':![],'where':{'id':_0x2a56f4['params']['id']}},_0x5d0878={};_0x5d0878['model']=_[_0x5130('0x33')](db['SalesforceAccount'][_0x5130('0x30')]);_0x5d0878[_0x5130('0x32')]=_['keys'](_0x2a56f4[_0x5130('0x32')]);_0x5d0878['filters']=_[_0x5130('0x34')](_0x5d0878[_0x5130('0x36')],_0x5d0878[_0x5130('0x32')]);_0x3811f6[_0x5130('0x35')]=_['intersection'](_0x5d0878[_0x5130('0x36')],qs['fields'](_0x2a56f4[_0x5130('0x32')][_0x5130('0x37')]));_0x3811f6[_0x5130('0x35')]=_0x3811f6['attributes'][_0x5130('0x38')]?_0x3811f6[_0x5130('0x35')]:_0x5d0878[_0x5130('0x36')];if(_0x2a56f4[_0x5130('0x32')]['includeAll']){_0x3811f6[_0x5130('0x46')]=[{'all':!![]}];}_0x3811f6=_['merge']({},_0x3811f6,_0x2a56f4[_0x5130('0x41')]);return db[_0x5130('0x2f')][_0x5130('0x47')](_0x3811f6)[_0x5130('0x28')](handleEntityNotFound(_0x3e426a,null))[_0x5130('0x28')](respondWithResult(_0x3e426a,null))[_0x5130('0x44')](handleError(_0x3e426a,null));};exports[_0x5130('0x48')]=function(_0x162a17,_0x560130){return db['SalesforceAccount'][_0x5130('0x48')](_0x162a17[_0x5130('0x49')],{})[_0x5130('0x28')](respondWithResult(_0x560130,0xc9))[_0x5130('0x44')](handleError(_0x560130,null));};exports[_0x5130('0x27')]=function(_0x106f19,_0x4d610f){if(_0x106f19[_0x5130('0x49')]['id']){delete _0x106f19[_0x5130('0x49')]['id'];}return db[_0x5130('0x2f')][_0x5130('0x47')]({'where':{'id':_0x106f19['params']['id']}})[_0x5130('0x28')](handleEntityNotFound(_0x4d610f,null))[_0x5130('0x28')](saveUpdates(_0x106f19[_0x5130('0x49')],null))['then'](respondWithResult(_0x4d610f,null))[_0x5130('0x44')](handleError(_0x4d610f,null));};exports[_0x5130('0x29')]=function(_0x568221,_0xbce742){return db[_0x5130('0x2f')][_0x5130('0x47')]({'where':{'id':_0x568221[_0x5130('0x4a')]['id']}})[_0x5130('0x28')](handleEntityNotFound(_0xbce742,null))[_0x5130('0x28')](removeEntity(_0xbce742,null))[_0x5130('0x44')](handleError(_0xbce742,null));};exports[_0x5130('0x4b')]=function(_0x1d6da6,_0x28b1cf,_0x460c46){var _0x51e44d={};var _0x428eae={};var _0x36a0a7;var _0x278ec8;return db[_0x5130('0x2f')][_0x5130('0x4c')]({'where':{'id':_0x1d6da6[_0x5130('0x4a')]['id']}})[_0x5130('0x28')](handleEntityNotFound(_0x28b1cf,null))[_0x5130('0x28')](function(_0x321dd6){if(_0x321dd6){_0x36a0a7=_0x321dd6;_0x428eae['model']=_[_0x5130('0x33')](db[_0x5130('0x4d')]['rawAttributes']);_0x428eae[_0x5130('0x32')]=_[_0x5130('0x33')](_0x1d6da6[_0x5130('0x32')]);_0x428eae['filters']=_[_0x5130('0x34')](_0x428eae[_0x5130('0x36')],_0x428eae[_0x5130('0x32')]);_0x51e44d[_0x5130('0x35')]=_['intersection'](_0x428eae[_0x5130('0x36')],qs[_0x5130('0x37')](_0x1d6da6[_0x5130('0x32')][_0x5130('0x37')]));_0x51e44d[_0x5130('0x35')]=_0x51e44d['attributes'][_0x5130('0x38')]?_0x51e44d['attributes']:_0x428eae[_0x5130('0x36')];_0x51e44d[_0x5130('0x3b')]=qs[_0x5130('0x3c')](_0x1d6da6[_0x5130('0x32')]['sort']);_0x51e44d['where']=qs[_0x5130('0x3e')](_['pick'](_0x1d6da6[_0x5130('0x32')],_0x428eae[_0x5130('0x3e')]));if(_0x1d6da6[_0x5130('0x32')]['filter']){_0x51e44d[_0x5130('0x3d')]=_[_0x5130('0x40')](_0x51e44d[_0x5130('0x3d')],{'$or':_[_0x5130('0x2e')](_0x51e44d[_0x5130('0x35')],function(_0x30bbc7){var _0x1e9e16={};_0x1e9e16[_0x30bbc7]={'$like':'%'+_0x1d6da6[_0x5130('0x32')]['filter']+'%'};return _0x1e9e16;})});}_0x51e44d=_[_0x5130('0x40')]({},_0x51e44d,_0x1d6da6['options']);return _0x36a0a7['getConfigurations'](_0x51e44d);}})[_0x5130('0x28')](function(_0x3e11a8){if(_0x3e11a8){_0x278ec8=_0x3e11a8[_0x5130('0x38')];if(!_0x1d6da6['query']['hasOwnProperty']('nolimit')){_0x51e44d[_0x5130('0x21')]=qs[_0x5130('0x21')](_0x1d6da6[_0x5130('0x32')]['limit']);_0x51e44d[_0x5130('0x1f')]=qs[_0x5130('0x1f')](_0x1d6da6[_0x5130('0x32')][_0x5130('0x1f')]);}return _0x36a0a7[_0x5130('0x4b')](_0x51e44d);}})['then'](function(_0x2c1e54){if(_0x2c1e54){return _0x2c1e54?{'count':_0x278ec8,'rows':_0x2c1e54}:null;}})[_0x5130('0x28')](respondWithResult(_0x28b1cf,null))[_0x5130('0x44')](handleError(_0x28b1cf,null));};exports[_0x5130('0x4e')]=function(_0x33625e,_0x2f1772,_0x276f8f){if(_0x33625e[_0x5130('0x49')]['id']){delete _0x33625e[_0x5130('0x49')]['id'];}return db[_0x5130('0x2f')][_0x5130('0x4c')]({'where':{'id':_0x33625e[_0x5130('0x4a')]['id']}})[_0x5130('0x28')](handleEntityNotFound(_0x2f1772,null))[_0x5130('0x28')](function(_0x3c05cc){if(_0x3c05cc){_0x33625e[_0x5130('0x49')][_0x5130('0x4f')]=_0x3c05cc['id'];_0x33625e[_0x5130('0x49')][_0x5130('0x50')]=integrations[_0x5130('0x51')](_0x33625e[_0x5130('0x49')][_0x5130('0x52')],_0x33625e[_0x5130('0x49')][_0x5130('0x31')]);_0x33625e[_0x5130('0x49')][_0x5130('0x53')]=integrations['getDescriptions'](_0x33625e[_0x5130('0x49')][_0x5130('0x52')],_0x33625e[_0x5130('0x49')][_0x5130('0x31')]);return db[_0x5130('0x4d')][_0x5130('0x48')](_0x33625e[_0x5130('0x49')],{'include':[{'model':db[_0x5130('0x54')],'as':_0x5130('0x50')},{'model':db[_0x5130('0x54')],'as':_0x5130('0x53')}]});}return null;})[_0x5130('0x28')](respondWithResult(_0x2f1772,null))[_0x5130('0x44')](handleError(_0x2f1772,null));};exports[_0x5130('0x55')]=function(_0x5c61a1,_0x1a2267,_0x556bc2){var _0x89b42;var _0xee96b4='';var _0x3bd083=_0x5130('0x56');return db[_0x5130('0x2f')][_0x5130('0x4c')]({'where':{'id':_0x5c61a1[_0x5130('0x4a')]['id']},'attributes':['id',_0x5130('0x57'),'clientId',_0x5130('0x58'),_0x5130('0x59'),'password',_0x5130('0x5a')]})['then'](handleEntityNotFound(_0x1a2267,null))[_0x5130('0x28')](function(_0x2068ba){if(_0x2068ba){_0xee96b4=_0x2068ba[_0x5130('0x57')];var _0x440921=_0xee96b4[_0x5130('0x5b')](-0x1);if(_0x440921==='/'){_0xee96b4=_0xee96b4['substring'](0x0,_0xee96b4['lastIndexOf'](_0x440921));}_0x89b42=new jsforce[(_0x5130('0x5c'))]({'oauth2':{'loginUrl':_0xee96b4,'clientId':_0x2068ba[_0x5130('0x5d')],'clientSecret':_0x2068ba[_0x5130('0x58')]}});return _0x89b42[_0x5130('0x5e')](_0x2068ba['username'],_0x2068ba[_0x5130('0x5f')]['concat'](_0x2068ba[_0x5130('0x5a')]));}})[_0x5130('0x28')](function(_0x4fdcf7){if(_0x4fdcf7){if(!_[_0x5130('0x60')](_0x5c61a1[_0x5130('0x32')]['ticketType'])){_0x3bd083=_0x5c61a1[_0x5130('0x32')][_0x5130('0x61')];}return _0x89b42[_0x5130('0x62')](_0x3bd083)[_0x5130('0x63')]();}})[_0x5130('0x28')](function(_0x4ea9c6){var _0x217d46=['OwnerId',_0x5130('0x64'),_0x5130('0x65'),_0x5130('0x66'),_0x5130('0x67'),_0x5130('0x68')];var _0xc8d7d2=[_0x5130('0x69'),'int','picklist',_0x5130('0x6a'),_0x5130('0x6b'),_0x5130('0x6c'),_0x5130('0x6d')];if(_0x4ea9c6){_[_0x5130('0x6e')](_0x4ea9c6[_0x5130('0x37')],function(_0x3d4fb2){return _0x217d46[_0x5130('0x6f')](_0x3d4fb2['name'])||!_0xc8d7d2[_0x5130('0x6f')](_0x3d4fb2[_0x5130('0x31')]);});return{'count':_0x4ea9c6[_0x5130('0x37')]['length'],'rows':_['map'](_0x4ea9c6['fields'],function(_0x3708ab){return{'id':_0x3708ab['name'],'name':_0x3708ab['label'],'custom':_0x3708ab[_0x5130('0x70')],'options':_0x3708ab[_0x5130('0x71')][_0x5130('0x38')]>0x0?_[_0x5130('0x2e')](_0x3708ab['picklistValues'],function(_0x4c5a59){return{'name':_0x4c5a59['label'],'value':_0x4c5a59[_0x5130('0x72')]};}):_0x3708ab[_0x5130('0x31')]==_0x5130('0x6a')?[{'name':_0x5130('0x73'),'value':_0x5130('0x74')},{'name':_0x5130('0x75'),'value':_0x5130('0x76')}]:[]};})};}})[_0x5130('0x28')](respondWithResult(_0x1a2267,null))[_0x5130('0x44')](function(_0x34a64c){var _0x43572c=_0x5c61a1[_0x5130('0x32')][_0x5130('0x77')]?0x1f4:_0x34a64c['statusCode']||0x1f4;logger[_0x5130('0x78')](_0x5130('0x79'),'getFields',_0x43572c,JSON[_0x5130('0x7a')](_0x34a64c));delete _0x34a64c[_0x5130('0x2b')];if(_0x43572c===0x191){_0x43572c=0x190;}_0x1a2267[_0x5130('0x23')](_0x43572c)['send'](_0x5c61a1[_0x5130('0x32')][_0x5130('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x34a64c[_0x5130('0x7b')]}:_0x34a64c);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 1299119..96004af 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 _0xd19f=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbb5a8e,_0xf9689d){var _0x38a8eb=function(_0x4fa60f){while(--_0x4fa60f){_0xbb5a8e['push'](_0xbb5a8e['shift']());}};_0x38a8eb(++_0xf9689d);}(_0xd19f,0x16e));var _0xfd19=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0xd19f[_0x152449];return _0x5b58b2;};'use strict';var _=require(_0xfd19('0x0'));var util=require(_0xfd19('0x1'));var logger=require(_0xfd19('0x2'))(_0xfd19('0x3'));var moment=require(_0xfd19('0x4'));var BPromise=require(_0xfd19('0x5'));var rp=require(_0xfd19('0x6'));var fs=require('fs');var path=require(_0xfd19('0x7'));var rimraf=require(_0xfd19('0x8'));var config=require(_0xfd19('0x9'));var attributes=require(_0xfd19('0xa'));var integrations=require(_0xfd19('0xb'));module['exports']=function(_0x6652e2,_0x37064c){return _0x6652e2[_0xfd19('0xc')](_0xfd19('0xd'),attributes,{'tableName':_0xfd19('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf712=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x31febd,_0x2137bf){var _0x3a1ac5=function(_0x468661){while(--_0x468661){_0x31febd['push'](_0x31febd['shift']());}};_0x3a1ac5(++_0x2137bf);}(_0xf712,0x19c));var _0x2f71=function(_0x3f6854,_0xdea659){_0x3f6854=_0x3f6854-0x0;var _0x305078=_0xf712[_0x3f6854];return _0x305078;};'use strict';var _=require(_0x2f71('0x0'));var util=require('util');var logger=require(_0x2f71('0x1'))(_0x2f71('0x2'));var moment=require(_0x2f71('0x3'));var BPromise=require(_0x2f71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f71('0x5'));var rimraf=require(_0x2f71('0x6'));var config=require(_0x2f71('0x7'));var attributes=require(_0x2f71('0x8'));var integrations=require(_0x2f71('0x9'));module['exports']=function(_0x3508a2,_0x50a153){return _0x3508a2['define'](_0x2f71('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 38d3027..12831dd 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 _0x6463=['ShowSalesforceAccount','SalesforceAccount','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch'];(function(_0x2a9c8e,_0x127547){var _0x56cf82=function(_0x5ebd93){while(--_0x5ebd93){_0x2a9c8e['push'](_0x2a9c8e['shift']());}};_0x56cf82(++_0x127547);}(_0x6463,0xb7));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3646('0x0'));var moment=require(_0x3646('0x1'));var BPromise=require(_0x3646('0x2'));var rs=require(_0x3646('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3646('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3646('0x5'))(_0x3646('0x6'));var config=require(_0x3646('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3646('0x8')][_0x3646('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x536da3,_0x58f183,_0x171d09){return new BPromise(function(_0x13e2ca,_0x4c365c){return client[_0x3646('0xa')](_0x536da3,_0x171d09)[_0x3646('0xb')](function(_0x2923cb){logger[_0x3646('0xc')](_0x3646('0xd'),_0x58f183,_0x3646('0xe'));logger[_0x3646('0xf')](_0x3646('0x10'),_0x58f183,_0x3646('0xe'),JSON['stringify'](_0x2923cb));if(_0x2923cb[_0x3646('0x11')]){if(_0x2923cb[_0x3646('0x11')][_0x3646('0x12')]===0x1f4){logger[_0x3646('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x58f183,_0x2923cb[_0x3646('0x11')][_0x3646('0x13')]);return _0x4c365c(_0x2923cb[_0x3646('0x11')]['message']);}logger['error'](_0x3646('0xd'),_0x58f183,_0x2923cb[_0x3646('0x11')][_0x3646('0x13')]);return _0x13e2ca(_0x2923cb[_0x3646('0x11')][_0x3646('0x13')]);}else{logger[_0x3646('0xc')](_0x3646('0xd'),_0x58f183,_0x3646('0xe'));_0x13e2ca(_0x2923cb[_0x3646('0x14')][_0x3646('0x13')]);}})['catch'](function(_0x54898c){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x58f183,_0x54898c);_0x4c365c(_0x54898c);});});}exports[_0x3646('0x15')]=function(_0x529bca){var _0x367881=this;return new Promise(function(_0xcb687,_0x266975){return db['SalesforceAccount'][_0x3646('0x16')]({'raw':_0x529bca[_0x3646('0x17')]?_0x529bca[_0x3646('0x17')][_0x3646('0x18')]===undefined?!![]:![]:!![],'where':_0x529bca['options']?_0x529bca[_0x3646('0x17')][_0x3646('0x19')]||null:null,'attributes':_0x529bca[_0x3646('0x17')]?_0x529bca[_0x3646('0x17')][_0x3646('0x1a')]||null:null,'limit':_0x529bca['options']?_0x529bca[_0x3646('0x17')][_0x3646('0x1b')]||null:null,'include':_0x529bca[_0x3646('0x17')]?_0x529bca[_0x3646('0x17')]['include']?_[_0x3646('0x1c')](_0x529bca[_0x3646('0x17')][_0x3646('0x1d')],function(_0x448570){return{'model':db[_0x448570['model']],'as':_0x448570['as'],'attributes':_0x448570[_0x3646('0x1a')],'include':_0x448570[_0x3646('0x1d')]?_[_0x3646('0x1c')](_0x448570[_0x3646('0x1d')],function(_0x5377d7){return{'model':db[_0x5377d7[_0x3646('0x1e')]],'as':_0x5377d7['as'],'attributes':_0x5377d7[_0x3646('0x1a')],'include':_0x5377d7[_0x3646('0x1d')]?_[_0x3646('0x1c')](_0x5377d7['include'],function(_0x3874eb){return{'model':db[_0x3874eb[_0x3646('0x1e')]],'as':_0x3874eb['as'],'attributes':_0x3874eb[_0x3646('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59327c){logger[_0x3646('0xc')](_0x3646('0x15'),_0x529bca);logger[_0x3646('0xf')]('GetSalesforceAccount',_0x529bca,JSON[_0x3646('0x1f')](_0x59327c));_0xcb687(_0x59327c);})[_0x3646('0x20')](function(_0xd54f48){logger[_0x3646('0x11')](_0x3646('0x15'),_0xd54f48[_0x3646('0x13')],_0x529bca);_0x266975(_0x367881[_0x3646('0x11')](0x1f4,_0xd54f48[_0x3646('0x13')]));});});};exports[_0x3646('0x21')]=function(_0x46d663){var _0x20c9bc=this;return new Promise(function(_0x584d98,_0x29f21e){return db[_0x3646('0x22')][_0x3646('0x23')]({'raw':_0x46d663[_0x3646('0x17')]?_0x46d663[_0x3646('0x17')][_0x3646('0x18')]===undefined?!![]:![]:!![],'where':_0x46d663[_0x3646('0x17')]?_0x46d663[_0x3646('0x17')][_0x3646('0x19')]||null:null,'attributes':_0x46d663[_0x3646('0x17')]?_0x46d663[_0x3646('0x17')][_0x3646('0x1a')]||null:null,'include':_0x46d663[_0x3646('0x17')]?_0x46d663[_0x3646('0x17')][_0x3646('0x1d')]?_[_0x3646('0x1c')](_0x46d663[_0x3646('0x17')][_0x3646('0x1d')],function(_0x518d6e){return{'model':db[_0x518d6e[_0x3646('0x1e')]],'as':_0x518d6e['as'],'attributes':_0x518d6e['attributes'],'include':_0x518d6e[_0x3646('0x1d')]?_['map'](_0x518d6e[_0x3646('0x1d')],function(_0xde7338){return{'model':db[_0xde7338[_0x3646('0x1e')]],'as':_0xde7338['as'],'attributes':_0xde7338[_0x3646('0x1a')],'include':_0xde7338['include']?_[_0x3646('0x1c')](_0xde7338[_0x3646('0x1d')],function(_0x5e2e47){return{'model':db[_0x5e2e47[_0x3646('0x1e')]],'as':_0x5e2e47['as'],'attributes':_0x5e2e47[_0x3646('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3646('0xb')](function(_0x162be2){logger['info']('ShowSalesforceAccount',_0x46d663);logger['debug']('ShowSalesforceAccount',_0x46d663,JSON[_0x3646('0x1f')](_0x162be2));_0x584d98(_0x162be2);})[_0x3646('0x20')](function(_0x55016f){logger['error'](_0x3646('0x21'),_0x55016f[_0x3646('0x13')],_0x46d663);_0x29f21e(_0x20c9bc[_0x3646('0x11')](0x1f4,_0x55016f[_0x3646('0x13')]));});});}; \ No newline at end of file +var _0xe88a=['message','info','request\x20sent','result','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowSalesforceAccount','find','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','SalesforceAccount,\x20%s,\x20%s'];(function(_0x1586db,_0x468da3){var _0x201012=function(_0x27d6e5){while(--_0x27d6e5){_0x1586db['push'](_0x1586db['shift']());}};_0x201012(++_0x468da3);}(_0xe88a,0xc6));var _0xae88=function(_0x270383,_0x3d9f4f){_0x270383=_0x270383-0x0;var _0x15f380=_0xe88a[_0x270383];return _0x15f380;};'use strict';var _=require(_0xae88('0x0'));var util=require(_0xae88('0x1'));var moment=require('moment');var BPromise=require(_0xae88('0x2'));var rs=require(_0xae88('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae88('0x4'))['db'];var utils=require(_0xae88('0x5'));var logger=require(_0xae88('0x6'))(_0xae88('0x7'));var config=require(_0xae88('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xae88('0x9')][_0xae88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x111bbc,_0x461bb7,_0x155ea1){return new BPromise(function(_0x541ce5,_0xe5e072){return client[_0xae88('0xb')](_0x111bbc,_0x155ea1)[_0xae88('0xc')](function(_0x1f902b){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x461bb7,'request\x20sent');logger[_0xae88('0xd')](_0xae88('0xe'),_0x461bb7,'request\x20sent',JSON['stringify'](_0x1f902b));if(_0x1f902b[_0xae88('0xf')]){if(_0x1f902b[_0xae88('0xf')][_0xae88('0x10')]===0x1f4){logger[_0xae88('0xf')](_0xae88('0x11'),_0x461bb7,_0x1f902b['error'][_0xae88('0x12')]);return _0xe5e072(_0x1f902b[_0xae88('0xf')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x461bb7,_0x1f902b[_0xae88('0xf')][_0xae88('0x12')]);return _0x541ce5(_0x1f902b['error']['message']);}else{logger[_0xae88('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x461bb7,_0xae88('0x14'));_0x541ce5(_0x1f902b[_0xae88('0x15')]['message']);}})['catch'](function(_0x44df6b){logger['error'](_0xae88('0x11'),_0x461bb7,_0x44df6b);_0xe5e072(_0x44df6b);});});}exports[_0xae88('0x16')]=function(_0xc1fe5f){var _0x194d8b=this;return new Promise(function(_0x5752d5,_0x31dee5){return db['SalesforceAccount'][_0xae88('0x17')]({'raw':_0xc1fe5f[_0xae88('0x18')]?_0xc1fe5f[_0xae88('0x18')][_0xae88('0x19')]===undefined?!![]:![]:!![],'where':_0xc1fe5f[_0xae88('0x18')]?_0xc1fe5f[_0xae88('0x18')][_0xae88('0x1a')]||null:null,'attributes':_0xc1fe5f[_0xae88('0x18')]?_0xc1fe5f[_0xae88('0x18')][_0xae88('0x1b')]||null:null,'limit':_0xc1fe5f[_0xae88('0x18')]?_0xc1fe5f[_0xae88('0x18')][_0xae88('0x1c')]||null:null,'include':_0xc1fe5f[_0xae88('0x18')]?_0xc1fe5f[_0xae88('0x18')][_0xae88('0x1d')]?_['map'](_0xc1fe5f['options']['include'],function(_0x49ce68){return{'model':db[_0x49ce68[_0xae88('0x1e')]],'as':_0x49ce68['as'],'attributes':_0x49ce68[_0xae88('0x1b')],'include':_0x49ce68[_0xae88('0x1d')]?_[_0xae88('0x1f')](_0x49ce68[_0xae88('0x1d')],function(_0x43426a){return{'model':db[_0x43426a[_0xae88('0x1e')]],'as':_0x43426a['as'],'attributes':_0x43426a[_0xae88('0x1b')],'include':_0x43426a['include']?_[_0xae88('0x1f')](_0x43426a[_0xae88('0x1d')],function(_0x418d1d){return{'model':db[_0x418d1d[_0xae88('0x1e')]],'as':_0x418d1d['as'],'attributes':_0x418d1d[_0xae88('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xae88('0xc')](function(_0x4b5c20){logger[_0xae88('0x13')](_0xae88('0x16'),_0xc1fe5f);logger[_0xae88('0xd')]('GetSalesforceAccount',_0xc1fe5f,JSON['stringify'](_0x4b5c20));_0x5752d5(_0x4b5c20);})[_0xae88('0x20')](function(_0x39cd36){logger[_0xae88('0xf')](_0xae88('0x16'),_0x39cd36[_0xae88('0x12')],_0xc1fe5f);_0x31dee5(_0x194d8b[_0xae88('0xf')](0x1f4,_0x39cd36['message']));});});};exports[_0xae88('0x21')]=function(_0x1aa629){var _0x148e22=this;return new Promise(function(_0x13a3a4,_0x2abc38){return db['SalesforceAccount'][_0xae88('0x22')]({'raw':_0x1aa629[_0xae88('0x18')]?_0x1aa629[_0xae88('0x18')][_0xae88('0x19')]===undefined?!![]:![]:!![],'where':_0x1aa629[_0xae88('0x18')]?_0x1aa629['options']['where']||null:null,'attributes':_0x1aa629['options']?_0x1aa629['options'][_0xae88('0x1b')]||null:null,'include':_0x1aa629['options']?_0x1aa629[_0xae88('0x18')]['include']?_['map'](_0x1aa629[_0xae88('0x18')][_0xae88('0x1d')],function(_0x5c287a){return{'model':db[_0x5c287a[_0xae88('0x1e')]],'as':_0x5c287a['as'],'attributes':_0x5c287a[_0xae88('0x1b')],'include':_0x5c287a['include']?_[_0xae88('0x1f')](_0x5c287a[_0xae88('0x1d')],function(_0x2f8e24){return{'model':db[_0x2f8e24['model']],'as':_0x2f8e24['as'],'attributes':_0x2f8e24[_0xae88('0x1b')],'include':_0x2f8e24['include']?_[_0xae88('0x1f')](_0x2f8e24['include'],function(_0x21931a){return{'model':db[_0x21931a[_0xae88('0x1e')]],'as':_0x21931a['as'],'attributes':_0x21931a[_0xae88('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xae88('0xc')](function(_0x3b22ae){logger['info'](_0xae88('0x21'),_0x1aa629);logger[_0xae88('0xd')](_0xae88('0x21'),_0x1aa629,JSON[_0xae88('0x23')](_0x3b22ae));_0x13a3a4(_0x3b22ae);})[_0xae88('0x20')](function(_0xa417d9){logger[_0xae88('0xf')](_0xae88('0x21'),_0xa417d9[_0xae88('0x12')],_0x1aa629);_0x2abc38(_0x148e22[_0xae88('0xf')](0x1f4,_0xa417d9[_0xae88('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index e7ca0f8..7fe9563 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x430b13,_0x2690df){var _0x510451=function(_0x1dcc2c){while(--_0x1dcc2c){_0x430b13['push'](_0x430b13['shift']());}};_0x510451(++_0x2690df);}(_0x7a54,0x106));var _0x47a5=function(_0x15d628,_0x4f4dff){_0x15d628=_0x15d628-0x0;var _0x450e9e=_0x7a54[_0x15d628];return _0x450e9e;};'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('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xdb28,0x106));var _0x8db2=function(_0x5b8449,_0x39409e){_0x5b8449=_0x5b8449-0x0;var _0x73cfcc=_0xdb28[_0x5b8449];return _0x73cfcc;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index e5f9912..aa512e8 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 _0xe71f=['ENUM','Task','Case','contact_lead','contact','account_contact_lead','lead','sequelize','exports','STRING'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xe71f,0x9d));var _0xfe71=function(_0x2edbeb,_0x369153){_0x2edbeb=_0x2edbeb-0x0;var _0x575e71=_0xe71f[_0x2edbeb];return _0x575e71;};'use strict';var Sequelize=require(_0xfe71('0x0'));module[_0xfe71('0x1')]={'name':{'type':Sequelize[_0xfe71('0x2')]},'description':{'type':Sequelize[_0xfe71('0x2')]},'ticketType':{'type':Sequelize[_0xfe71('0x3')](_0xfe71('0x4'),_0xfe71('0x5')),'defaultValue':_0xfe71('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xfe71('0x6'),_0xfe71('0x7'),'lead',_0xfe71('0x8'),'account'),'defaultValue':_0xfe71('0x6')},'moduleCreate':{'type':Sequelize[_0xfe71('0x3')]('nothing',_0xfe71('0x7'),_0xfe71('0x9'),'account'),'defaultValue':_0xfe71('0x9')},'leadId':{'type':Sequelize[_0xfe71('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xfe71('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4df2=['exports','STRING','ENUM','Task','Case','contact_lead','account_contact_lead','account','nothing','contact','lead','sequelize'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x4df2,0xbf));var _0x24df=function(_0x15e9d1,_0x2cde5f){_0x15e9d1=_0x15e9d1-0x0;var _0x10470b=_0x4df2[_0x15e9d1];return _0x10470b;};'use strict';var Sequelize=require(_0x24df('0x0'));module[_0x24df('0x1')]={'name':{'type':Sequelize[_0x24df('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x24df('0x3')](_0x24df('0x4'),_0x24df('0x5')),'defaultValue':_0x24df('0x4')},'moduleSearch':{'type':Sequelize[_0x24df('0x3')](_0x24df('0x6'),'contact','lead',_0x24df('0x7'),_0x24df('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x24df('0x3')](_0x24df('0x9'),_0x24df('0xa'),_0x24df('0xb'),'account'),'defaultValue':_0x24df('0xb')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x24df('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x24df('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x24df('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 20630c0..2c68415 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 _0x5f79=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x5f79,0x92));var _0x95f7=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x5f79[_0xe73080];return _0x12cbc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95f7('0x0'));var zipdir=require(_0x95f7('0x1'));var jsonpatch=require(_0x95f7('0x2'));var rp=require(_0x95f7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95f7('0x4'));var util=require(_0x95f7('0x5'));var path=require(_0x95f7('0x6'));var sox=require('sox');var csv=require(_0x95f7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95f7('0x8'));var _=require(_0x95f7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x95f7('0xa'));var deskjs=require(_0x95f7('0xb'));var toCsv=require(_0x95f7('0x7'));var querystring=require(_0x95f7('0xc'));var Papa=require(_0x95f7('0xd'));var Redis=require(_0x95f7('0xe'));var authService=require(_0x95f7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x95f7('0x10'));var hardwareService=require(_0x95f7('0x11'));var logger=require(_0x95f7('0x12'))(_0x95f7('0x13'));var utils=require(_0x95f7('0x14'));var config=require(_0x95f7('0x15'));var licenseUtil=require(_0x95f7('0x16'));var db=require(_0x95f7('0x17'))['db'];function respondWithStatusCode(_0x2e282c,_0x2d91f4){_0x2d91f4=_0x2d91f4||0xcc;return function(_0x54b160){if(_0x54b160){return _0x2e282c['sendStatus'](_0x2d91f4);}return _0x2e282c[_0x95f7('0x18')](_0x2d91f4)[_0x95f7('0x19')]();};}function respondWithResult(_0x14bb8b,_0x481b27){_0x481b27=_0x481b27||0xc8;return function(_0x5e08b4){if(_0x5e08b4){return _0x14bb8b['status'](_0x481b27)['json'](_0x5e08b4);}};}function respondWithFilteredResult(_0x22f374,_0x4bb8e5){return function(_0x1ccbf7){if(_0x1ccbf7){var _0x22e66d=typeof _0x4bb8e5[_0x95f7('0x1a')]===_0x95f7('0x1b')&&typeof _0x4bb8e5['limit']===_0x95f7('0x1b');var _0x3e6d43=_0x1ccbf7[_0x95f7('0x1c')];var _0x26cfd8=_0x22e66d?0x0:_0x4bb8e5[_0x95f7('0x1a')];var _0xf1534c=_0x22e66d?_0x1ccbf7['count']:_0x4bb8e5[_0x95f7('0x1a')]+_0x4bb8e5[_0x95f7('0x1d')];var _0x3da4d2;if(_0xf1534c>=_0x3e6d43){_0xf1534c=_0x3e6d43;_0x3da4d2=0xc8;}else{_0x3da4d2=0xce;}_0x22f374[_0x95f7('0x18')](_0x3da4d2);return _0x22f374['set']('Content-Range',_0x26cfd8+'-'+_0xf1534c+'/'+_0x3e6d43)['json'](_0x1ccbf7);}return null;};}function patchUpdates(_0x3b4708){return function(_0x3eace4){try{jsonpatch[_0x95f7('0x1e')](_0x3eace4,_0x3b4708,!![]);}catch(_0x5b03af){return BPromise[_0x95f7('0x1f')](_0x5b03af);}return _0x3eace4[_0x95f7('0x20')]();};}function saveUpdates(_0x365a43,_0x4aa9a9){return function(_0x5a129d){if(_0x5a129d){return _0x5a129d[_0x95f7('0x21')](_0x365a43)['then'](function(_0x53e90c){return _0x53e90c;});}return null;};}function removeEntity(_0xa22225,_0x554a1b){return function(_0x5b5d48){if(_0x5b5d48){return _0x5b5d48[_0x95f7('0x22')]()[_0x95f7('0x23')](function(){_0xa22225[_0x95f7('0x18')](0xcc)[_0x95f7('0x19')]();});}};}function handleEntityNotFound(_0x20385b,_0xf554f4){return function(_0xd58dc4){if(!_0xd58dc4){_0x20385b['sendStatus'](0x194);}return _0xd58dc4;};}function handleError(_0x1d2398,_0x4bcf47){_0x4bcf47=_0x4bcf47||0x1f4;return function(_0x57fd45){logger[_0x95f7('0x24')](_0x57fd45[_0x95f7('0x25')]);if(_0x57fd45[_0x95f7('0x26')]){delete _0x57fd45[_0x95f7('0x26')];}_0x1d2398[_0x95f7('0x18')](_0x4bcf47)[_0x95f7('0x27')](_0x57fd45);};}exports[_0x95f7('0x28')]=function(_0x397a39,_0x38aa10){var _0xeedf86={},_0x414132={},_0x27e35c={'count':0x0,'rows':[]};var _0x4d3975=_[_0x95f7('0x29')](db[_0x95f7('0x2a')]['rawAttributes'],function(_0xbb45a){return{'name':_0xbb45a[_0x95f7('0x2b')],'type':_0xbb45a[_0x95f7('0x2c')][_0x95f7('0x2d')]};});_0x414132[_0x95f7('0x2e')]=_[_0x95f7('0x29')](_0x4d3975,'name');_0x414132[_0x95f7('0x2f')]=_['keys'](_0x397a39[_0x95f7('0x2f')]);_0x414132[_0x95f7('0x30')]=_[_0x95f7('0x31')](_0x414132[_0x95f7('0x2e')],_0x414132[_0x95f7('0x2f')]);_0xeedf86[_0x95f7('0x32')]=_[_0x95f7('0x31')](_0x414132['model'],qs['fields'](_0x397a39['query'][_0x95f7('0x33')]));_0xeedf86[_0x95f7('0x32')]=_0xeedf86[_0x95f7('0x32')][_0x95f7('0x34')]?_0xeedf86['attributes']:_0x414132[_0x95f7('0x2e')];if(!_0x397a39[_0x95f7('0x2f')][_0x95f7('0x35')](_0x95f7('0x36'))){_0xeedf86['limit']=qs[_0x95f7('0x1d')](_0x397a39[_0x95f7('0x2f')]['limit']);_0xeedf86[_0x95f7('0x1a')]=qs[_0x95f7('0x1a')](_0x397a39[_0x95f7('0x2f')][_0x95f7('0x1a')]);}_0xeedf86[_0x95f7('0x37')]=qs[_0x95f7('0x38')](_0x397a39[_0x95f7('0x2f')][_0x95f7('0x38')]);_0xeedf86[_0x95f7('0x39')]=qs[_0x95f7('0x30')](_[_0x95f7('0x3a')](_0x397a39[_0x95f7('0x2f')],_0x414132[_0x95f7('0x30')]),_0x4d3975);if(_0x397a39[_0x95f7('0x2f')][_0x95f7('0x3b')]){_0xeedf86[_0x95f7('0x39')]=_[_0x95f7('0x3c')](_0xeedf86[_0x95f7('0x39')],{'$or':_[_0x95f7('0x29')](_0x4d3975,function(_0x391fd9){if(_0x391fd9[_0x95f7('0x2c')]!==_0x95f7('0x3d')){var _0x57a81e={};_0x57a81e[_0x391fd9[_0x95f7('0x26')]]={'$like':'%'+_0x397a39[_0x95f7('0x2f')][_0x95f7('0x3b')]+'%'};return _0x57a81e;}})});}_0xeedf86=_['merge']({},_0xeedf86,_0x397a39[_0x95f7('0x3e')]);var _0x24dad7={'where':_0xeedf86[_0x95f7('0x39')]};return db[_0x95f7('0x2a')][_0x95f7('0x1c')](_0x24dad7)[_0x95f7('0x23')](function(_0x9bf5d8){_0x27e35c[_0x95f7('0x1c')]=_0x9bf5d8;if(_0x397a39['query'][_0x95f7('0x3f')]){_0xeedf86[_0x95f7('0x40')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x95f7('0x41')](_0xeedf86);})[_0x95f7('0x23')](function(_0x94405b){_0x27e35c[_0x95f7('0x42')]=_0x94405b;return _0x27e35c;})[_0x95f7('0x23')](respondWithFilteredResult(_0x38aa10,_0xeedf86))[_0x95f7('0x43')](handleError(_0x38aa10,null));};exports[_0x95f7('0x44')]=function(_0x28f100,_0x4c13aa){var _0x3dee56={'raw':![],'where':{'id':_0x28f100[_0x95f7('0x45')]['id']}},_0x1f5315={};_0x1f5315[_0x95f7('0x2e')]=_[_0x95f7('0x46')](db['SalesforceConfiguration'][_0x95f7('0x47')]);_0x1f5315[_0x95f7('0x2f')]=_['keys'](_0x28f100[_0x95f7('0x2f')]);_0x1f5315[_0x95f7('0x30')]=_[_0x95f7('0x31')](_0x1f5315[_0x95f7('0x2e')],_0x1f5315[_0x95f7('0x2f')]);_0x3dee56[_0x95f7('0x32')]=_[_0x95f7('0x31')](_0x1f5315[_0x95f7('0x2e')],qs[_0x95f7('0x33')](_0x28f100[_0x95f7('0x2f')][_0x95f7('0x33')]));_0x3dee56['attributes']=_0x3dee56[_0x95f7('0x32')][_0x95f7('0x34')]?_0x3dee56[_0x95f7('0x32')]:_0x1f5315[_0x95f7('0x2e')];if(_0x28f100['query'][_0x95f7('0x3f')]){_0x3dee56[_0x95f7('0x40')]=[{'all':!![]}];}_0x3dee56=_['merge']({},_0x3dee56,_0x28f100[_0x95f7('0x3e')]);return db[_0x95f7('0x2a')][_0x95f7('0x48')](_0x3dee56)['then'](handleEntityNotFound(_0x4c13aa,null))[_0x95f7('0x23')](respondWithResult(_0x4c13aa,null))[_0x95f7('0x43')](handleError(_0x4c13aa,null));};exports[_0x95f7('0x49')]=function(_0x35c245,_0x560e43){return db[_0x95f7('0x2a')][_0x95f7('0x49')](_0x35c245['body'],{})[_0x95f7('0x23')](respondWithResult(_0x560e43,0xc9))[_0x95f7('0x43')](handleError(_0x560e43,null));};exports[_0x95f7('0x21')]=function(_0xac227c,_0x2627bb){if(_0xac227c[_0x95f7('0x4a')]['id']){delete _0xac227c[_0x95f7('0x4a')]['id'];}return db['SalesforceConfiguration'][_0x95f7('0x48')]({'where':{'id':_0xac227c[_0x95f7('0x45')]['id']}})[_0x95f7('0x23')](handleEntityNotFound(_0x2627bb,null))['then'](saveUpdates(_0xac227c[_0x95f7('0x4a')],null))[_0x95f7('0x23')](respondWithResult(_0x2627bb,null))['catch'](handleError(_0x2627bb,null));};exports[_0x95f7('0x22')]=function(_0x18d2e3,_0x14f48d){return db[_0x95f7('0x2a')][_0x95f7('0x48')]({'where':{'id':_0x18d2e3['params']['id']}})[_0x95f7('0x23')](handleEntityNotFound(_0x14f48d,null))[_0x95f7('0x23')](removeEntity(_0x14f48d,null))[_0x95f7('0x43')](handleError(_0x14f48d,null));};exports[_0x95f7('0x4b')]=function(_0x1d7dd6,_0x37724d,_0x5707a5){var _0x105866={};var _0x200980={};var _0x852c6f;var _0x3cd83a;return db['SalesforceConfiguration'][_0x95f7('0x4c')]({'where':{'id':_0x1d7dd6[_0x95f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x37724d,null))[_0x95f7('0x23')](function(_0xf4c279){if(_0xf4c279){_0x852c6f=_0xf4c279;_0x200980[_0x95f7('0x2e')]=_[_0x95f7('0x46')](db[_0x95f7('0x4d')]['rawAttributes']);_0x200980[_0x95f7('0x2f')]=_[_0x95f7('0x46')](_0x1d7dd6[_0x95f7('0x2f')]);_0x200980['filters']=_[_0x95f7('0x31')](_0x200980[_0x95f7('0x2e')],_0x200980['query']);_0x105866[_0x95f7('0x32')]=_[_0x95f7('0x31')](_0x200980['model'],qs['fields'](_0x1d7dd6[_0x95f7('0x2f')][_0x95f7('0x33')]));_0x105866['attributes']=_0x105866[_0x95f7('0x32')]['length']?_0x105866['attributes']:_0x200980[_0x95f7('0x2e')];_0x105866['order']=qs[_0x95f7('0x38')](_0x1d7dd6['query'][_0x95f7('0x38')]);_0x105866['where']=qs[_0x95f7('0x30')](_[_0x95f7('0x3a')](_0x1d7dd6['query'],_0x200980[_0x95f7('0x30')]));if(_0x1d7dd6[_0x95f7('0x2f')][_0x95f7('0x3b')]){_0x105866[_0x95f7('0x39')]=_[_0x95f7('0x3c')](_0x105866[_0x95f7('0x39')],{'$or':_[_0x95f7('0x29')](_0x105866[_0x95f7('0x32')],function(_0x36cb94){var _0x26b067={};_0x26b067[_0x36cb94]={'$like':'%'+_0x1d7dd6[_0x95f7('0x2f')][_0x95f7('0x3b')]+'%'};return _0x26b067;})});}_0x105866=_[_0x95f7('0x3c')]({},_0x105866,_0x1d7dd6[_0x95f7('0x3e')]);return _0x852c6f['getFields'](_0x105866);}})[_0x95f7('0x23')](function(_0x24e542){if(_0x24e542){_0x3cd83a=_0x24e542['length'];if(!_0x1d7dd6[_0x95f7('0x2f')][_0x95f7('0x35')](_0x95f7('0x36'))){_0x105866[_0x95f7('0x1d')]=qs['limit'](_0x1d7dd6[_0x95f7('0x2f')][_0x95f7('0x1d')]);_0x105866[_0x95f7('0x1a')]=qs[_0x95f7('0x1a')](_0x1d7dd6[_0x95f7('0x2f')][_0x95f7('0x1a')]);}return _0x852c6f[_0x95f7('0x4b')](_0x105866);}})[_0x95f7('0x23')](function(_0x296d91){if(_0x296d91){return _0x296d91?{'count':_0x3cd83a,'rows':_0x296d91}:null;}})[_0x95f7('0x23')](respondWithResult(_0x37724d,null))[_0x95f7('0x43')](handleError(_0x37724d,null));};exports[_0x95f7('0x4e')]=function(_0x33fef3,_0x30b0c7,_0x3d6dbc){var _0x53ce44={};var _0x22d60b={};var _0x57baa0;var _0x4086ac;return db['SalesforceConfiguration'][_0x95f7('0x4c')]({'where':{'id':_0x33fef3[_0x95f7('0x45')]['id']}})[_0x95f7('0x23')](handleEntityNotFound(_0x30b0c7,null))[_0x95f7('0x23')](function(_0x567c18){if(_0x567c18){_0x57baa0=_0x567c18;_0x22d60b[_0x95f7('0x2e')]=_[_0x95f7('0x46')](db[_0x95f7('0x4d')][_0x95f7('0x47')]);_0x22d60b[_0x95f7('0x2f')]=_[_0x95f7('0x46')](_0x33fef3[_0x95f7('0x2f')]);_0x22d60b[_0x95f7('0x30')]=_['intersection'](_0x22d60b['model'],_0x22d60b['query']);_0x53ce44['attributes']=_[_0x95f7('0x31')](_0x22d60b[_0x95f7('0x2e')],qs[_0x95f7('0x33')](_0x33fef3[_0x95f7('0x2f')]['fields']));_0x53ce44['attributes']=_0x53ce44['attributes'][_0x95f7('0x34')]?_0x53ce44[_0x95f7('0x32')]:_0x22d60b[_0x95f7('0x2e')];_0x53ce44[_0x95f7('0x37')]=qs[_0x95f7('0x38')](_0x33fef3['query'][_0x95f7('0x38')]);_0x53ce44[_0x95f7('0x39')]=qs[_0x95f7('0x30')](_['pick'](_0x33fef3[_0x95f7('0x2f')],_0x22d60b[_0x95f7('0x30')]));if(_0x33fef3[_0x95f7('0x2f')][_0x95f7('0x3b')]){_0x53ce44[_0x95f7('0x39')]=_['merge'](_0x53ce44[_0x95f7('0x39')],{'$or':_[_0x95f7('0x29')](_0x53ce44[_0x95f7('0x32')],function(_0xbf072){var _0x337866={};_0x337866[_0xbf072]={'$like':'%'+_0x33fef3[_0x95f7('0x2f')][_0x95f7('0x3b')]+'%'};return _0x337866;})});}_0x53ce44=_[_0x95f7('0x3c')]({},_0x53ce44,_0x33fef3[_0x95f7('0x3e')]);return _0x57baa0[_0x95f7('0x4e')](_0x53ce44);}})[_0x95f7('0x23')](function(_0x4341d8){if(_0x4341d8){_0x4086ac=_0x4341d8[_0x95f7('0x34')];if(!_0x33fef3['query']['hasOwnProperty'](_0x95f7('0x36'))){_0x53ce44[_0x95f7('0x1d')]=qs['limit'](_0x33fef3[_0x95f7('0x2f')][_0x95f7('0x1d')]);_0x53ce44['offset']=qs['offset'](_0x33fef3[_0x95f7('0x2f')]['offset']);}return _0x57baa0[_0x95f7('0x4e')](_0x53ce44);}})[_0x95f7('0x23')](function(_0x42f232){if(_0x42f232){return _0x42f232?{'count':_0x4086ac,'rows':_0x42f232}:null;}})[_0x95f7('0x23')](respondWithResult(_0x30b0c7,null))[_0x95f7('0x43')](handleError(_0x30b0c7,null));};exports[_0x95f7('0x4f')]=function(_0x5e50f6,_0x6ad208,_0x5b6140){var _0x448a2c={};var _0x1db41f={};var _0x4b955b;var _0x44305a;return db[_0x95f7('0x2a')][_0x95f7('0x4c')]({'where':{'id':_0x5e50f6[_0x95f7('0x45')]['id']}})[_0x95f7('0x23')](handleEntityNotFound(_0x6ad208,null))[_0x95f7('0x23')](function(_0x417a9f){if(_0x417a9f){_0x4b955b=_0x417a9f;_0x1db41f['model']=_[_0x95f7('0x46')](db[_0x95f7('0x4d')][_0x95f7('0x47')]);_0x1db41f[_0x95f7('0x2f')]=_[_0x95f7('0x46')](_0x5e50f6[_0x95f7('0x2f')]);_0x1db41f[_0x95f7('0x30')]=_[_0x95f7('0x31')](_0x1db41f[_0x95f7('0x2e')],_0x1db41f[_0x95f7('0x2f')]);_0x448a2c['attributes']=_[_0x95f7('0x31')](_0x1db41f[_0x95f7('0x2e')],qs[_0x95f7('0x33')](_0x5e50f6[_0x95f7('0x2f')][_0x95f7('0x33')]));_0x448a2c[_0x95f7('0x32')]=_0x448a2c[_0x95f7('0x32')][_0x95f7('0x34')]?_0x448a2c[_0x95f7('0x32')]:_0x1db41f[_0x95f7('0x2e')];_0x448a2c[_0x95f7('0x37')]=qs[_0x95f7('0x38')](_0x5e50f6[_0x95f7('0x2f')][_0x95f7('0x38')]);_0x448a2c[_0x95f7('0x39')]=qs['filters'](_[_0x95f7('0x3a')](_0x5e50f6[_0x95f7('0x2f')],_0x1db41f[_0x95f7('0x30')]));if(_0x5e50f6[_0x95f7('0x2f')][_0x95f7('0x3b')]){_0x448a2c['where']=_[_0x95f7('0x3c')](_0x448a2c['where'],{'$or':_[_0x95f7('0x29')](_0x448a2c[_0x95f7('0x32')],function(_0x54bd16){var _0x58452c={};_0x58452c[_0x54bd16]={'$like':'%'+_0x5e50f6[_0x95f7('0x2f')]['filter']+'%'};return _0x58452c;})});}_0x448a2c=_[_0x95f7('0x3c')]({},_0x448a2c,_0x5e50f6[_0x95f7('0x3e')]);return _0x4b955b[_0x95f7('0x4f')](_0x448a2c);}})[_0x95f7('0x23')](function(_0x236d45){if(_0x236d45){_0x44305a=_0x236d45[_0x95f7('0x34')];if(!_0x5e50f6[_0x95f7('0x2f')]['hasOwnProperty'](_0x95f7('0x36'))){_0x448a2c[_0x95f7('0x1d')]=qs[_0x95f7('0x1d')](_0x5e50f6['query'][_0x95f7('0x1d')]);_0x448a2c[_0x95f7('0x1a')]=qs[_0x95f7('0x1a')](_0x5e50f6['query'][_0x95f7('0x1a')]);}return _0x4b955b[_0x95f7('0x4f')](_0x448a2c);}})[_0x95f7('0x23')](function(_0x3bd5e7){if(_0x3bd5e7){return _0x3bd5e7?{'count':_0x44305a,'rows':_0x3bd5e7}:null;}})[_0x95f7('0x23')](respondWithResult(_0x6ad208,null))[_0x95f7('0x43')](handleError(_0x6ad208,null));}; \ No newline at end of file +var _0x0a7f=['sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','status','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','findAll','catch','params','keys','fields','find','create','body','findOne','getFields','getSubjects','order','getDescriptions','SalesforceField','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4222bf,_0x6631a6){var _0x134727=function(_0x153fe2){while(--_0x153fe2){_0x4222bf['push'](_0x4222bf['shift']());}};_0x134727(++_0x6631a6);}(_0x0a7f,0xdf));var _0xf0a7=function(_0x93bdde,_0x26ca52){_0x93bdde=_0x93bdde-0x0;var _0x19fb76=_0x0a7f[_0x93bdde];return _0x19fb76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf0a7('0x0'));var jsonpatch=require(_0xf0a7('0x1'));var rp=require(_0xf0a7('0x2'));var moment=require(_0xf0a7('0x3'));var BPromise=require(_0xf0a7('0x4'));var Mustache=require(_0xf0a7('0x5'));var util=require(_0xf0a7('0x6'));var path=require(_0xf0a7('0x7'));var sox=require(_0xf0a7('0x8'));var csv=require(_0xf0a7('0x9'));var ejs=require(_0xf0a7('0xa'));var fs=require('fs');var fs_extra=require(_0xf0a7('0xb'));var _=require(_0xf0a7('0xc'));var squel=require('squel');var crypto=require(_0xf0a7('0xd'));var jsforce=require(_0xf0a7('0xe'));var deskjs=require(_0xf0a7('0xf'));var toCsv=require(_0xf0a7('0x9'));var querystring=require(_0xf0a7('0x10'));var Papa=require(_0xf0a7('0x11'));var Redis=require(_0xf0a7('0x12'));var authService=require(_0xf0a7('0x13'));var qs=require(_0xf0a7('0x14'));var as=require(_0xf0a7('0x15'));var hardwareService=require(_0xf0a7('0x16'));var logger=require(_0xf0a7('0x17'))(_0xf0a7('0x18'));var utils=require(_0xf0a7('0x19'));var config=require(_0xf0a7('0x1a'));var licenseUtil=require(_0xf0a7('0x1b'));var db=require(_0xf0a7('0x1c'))['db'];function respondWithStatusCode(_0x42ecf0,_0x547730){_0x547730=_0x547730||0xcc;return function(_0x5acef1){if(_0x5acef1){return _0x42ecf0[_0xf0a7('0x1d')](_0x547730);}return _0x42ecf0['status'](_0x547730)[_0xf0a7('0x1e')]();};}function respondWithResult(_0x1dde1e,_0x591cd1){_0x591cd1=_0x591cd1||0xc8;return function(_0x22cde8){if(_0x22cde8){return _0x1dde1e['status'](_0x591cd1)[_0xf0a7('0x1f')](_0x22cde8);}};}function respondWithFilteredResult(_0x135c77,_0x395db2){return function(_0x5e4e0d){if(_0x5e4e0d){var _0x29e7aa=typeof _0x395db2[_0xf0a7('0x20')]===_0xf0a7('0x21')&&typeof _0x395db2[_0xf0a7('0x22')]==='undefined';var _0x4db72f=_0x5e4e0d[_0xf0a7('0x23')];var _0xc4ee05=_0x29e7aa?0x0:_0x395db2[_0xf0a7('0x20')];var _0x62c328=_0x29e7aa?_0x5e4e0d[_0xf0a7('0x23')]:_0x395db2[_0xf0a7('0x20')]+_0x395db2[_0xf0a7('0x22')];var _0x36af70;if(_0x62c328>=_0x4db72f){_0x62c328=_0x4db72f;_0x36af70=0xc8;}else{_0x36af70=0xce;}_0x135c77['status'](_0x36af70);return _0x135c77[_0xf0a7('0x24')]('Content-Range',_0xc4ee05+'-'+_0x62c328+'/'+_0x4db72f)[_0xf0a7('0x1f')](_0x5e4e0d);}return null;};}function patchUpdates(_0x475177){return function(_0x9a365a){try{jsonpatch[_0xf0a7('0x25')](_0x9a365a,_0x475177,!![]);}catch(_0x516da9){return BPromise[_0xf0a7('0x26')](_0x516da9);}return _0x9a365a[_0xf0a7('0x27')]();};}function saveUpdates(_0x39652c,_0x11150a){return function(_0x3deb88){if(_0x3deb88){return _0x3deb88[_0xf0a7('0x28')](_0x39652c)[_0xf0a7('0x29')](function(_0x2122b4){return _0x2122b4;});}return null;};}function removeEntity(_0x18bec8,_0xa1c207){return function(_0x434ee6){if(_0x434ee6){return _0x434ee6[_0xf0a7('0x2a')]()[_0xf0a7('0x29')](function(){_0x18bec8['status'](0xcc)[_0xf0a7('0x1e')]();});}};}function handleEntityNotFound(_0x1cd105,_0x428a93){return function(_0x37ebf5){if(!_0x37ebf5){_0x1cd105[_0xf0a7('0x1d')](0x194);}return _0x37ebf5;};}function handleError(_0x25312d,_0x4681d1){_0x4681d1=_0x4681d1||0x1f4;return function(_0x1fb7c3){logger[_0xf0a7('0x2b')](_0x1fb7c3['stack']);if(_0x1fb7c3['name']){delete _0x1fb7c3[_0xf0a7('0x2c')];}_0x25312d[_0xf0a7('0x2d')](_0x4681d1)[_0xf0a7('0x2e')](_0x1fb7c3);};}exports[_0xf0a7('0x2f')]=function(_0x5adbac,_0x20bbad){var _0x215f67={},_0x3e3ea3={},_0x46c7d0={'count':0x0,'rows':[]};var _0x453af1=_[_0xf0a7('0x30')](db['SalesforceConfiguration'][_0xf0a7('0x31')],function(_0x187294){return{'name':_0x187294[_0xf0a7('0x32')],'type':_0x187294[_0xf0a7('0x33')][_0xf0a7('0x34')]};});_0x3e3ea3[_0xf0a7('0x35')]=_[_0xf0a7('0x30')](_0x453af1,'name');_0x3e3ea3[_0xf0a7('0x36')]=_['keys'](_0x5adbac['query']);_0x3e3ea3['filters']=_['intersection'](_0x3e3ea3[_0xf0a7('0x35')],_0x3e3ea3[_0xf0a7('0x36')]);_0x215f67['attributes']=_[_0xf0a7('0x37')](_0x3e3ea3[_0xf0a7('0x35')],qs['fields'](_0x5adbac[_0xf0a7('0x36')]['fields']));_0x215f67[_0xf0a7('0x38')]=_0x215f67['attributes'][_0xf0a7('0x39')]?_0x215f67[_0xf0a7('0x38')]:_0x3e3ea3[_0xf0a7('0x35')];if(!_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x3a')](_0xf0a7('0x3b'))){_0x215f67[_0xf0a7('0x22')]=qs[_0xf0a7('0x22')](_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x22')]);_0x215f67[_0xf0a7('0x20')]=qs['offset'](_0x5adbac[_0xf0a7('0x36')]['offset']);}_0x215f67['order']=qs[_0xf0a7('0x3c')](_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x3c')]);_0x215f67[_0xf0a7('0x3d')]=qs[_0xf0a7('0x3e')](_[_0xf0a7('0x3f')](_0x5adbac[_0xf0a7('0x36')],_0x3e3ea3[_0xf0a7('0x3e')]),_0x453af1);if(_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x40')]){_0x215f67[_0xf0a7('0x3d')]=_['merge'](_0x215f67[_0xf0a7('0x3d')],{'$or':_[_0xf0a7('0x30')](_0x453af1,function(_0x11251e){if(_0x11251e[_0xf0a7('0x33')]!==_0xf0a7('0x41')){var _0x27fd16={};_0x27fd16[_0x11251e[_0xf0a7('0x2c')]]={'$like':'%'+_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x40')]+'%'};return _0x27fd16;}})});}_0x215f67=_[_0xf0a7('0x42')]({},_0x215f67,_0x5adbac[_0xf0a7('0x43')]);var _0x166530={'where':_0x215f67[_0xf0a7('0x3d')]};return db[_0xf0a7('0x44')]['count'](_0x166530)[_0xf0a7('0x29')](function(_0x52221b){_0x46c7d0['count']=_0x52221b;if(_0x5adbac[_0xf0a7('0x36')][_0xf0a7('0x45')]){_0x215f67['include']=[{'all':!![]}];}return db[_0xf0a7('0x44')][_0xf0a7('0x46')](_0x215f67);})[_0xf0a7('0x29')](function(_0x1f2031){_0x46c7d0['rows']=_0x1f2031;return _0x46c7d0;})[_0xf0a7('0x29')](respondWithFilteredResult(_0x20bbad,_0x215f67))[_0xf0a7('0x47')](handleError(_0x20bbad,null));};exports['show']=function(_0x30bafc,_0x183925){var _0x600aa={'raw':![],'where':{'id':_0x30bafc[_0xf0a7('0x48')]['id']}},_0x218496={};_0x218496[_0xf0a7('0x35')]=_[_0xf0a7('0x49')](db[_0xf0a7('0x44')]['rawAttributes']);_0x218496[_0xf0a7('0x36')]=_['keys'](_0x30bafc['query']);_0x218496[_0xf0a7('0x3e')]=_[_0xf0a7('0x37')](_0x218496['model'],_0x218496['query']);_0x600aa[_0xf0a7('0x38')]=_['intersection'](_0x218496[_0xf0a7('0x35')],qs[_0xf0a7('0x4a')](_0x30bafc[_0xf0a7('0x36')][_0xf0a7('0x4a')]));_0x600aa[_0xf0a7('0x38')]=_0x600aa[_0xf0a7('0x38')][_0xf0a7('0x39')]?_0x600aa[_0xf0a7('0x38')]:_0x218496[_0xf0a7('0x35')];if(_0x30bafc[_0xf0a7('0x36')][_0xf0a7('0x45')]){_0x600aa['include']=[{'all':!![]}];}_0x600aa=_[_0xf0a7('0x42')]({},_0x600aa,_0x30bafc['options']);return db[_0xf0a7('0x44')][_0xf0a7('0x4b')](_0x600aa)['then'](handleEntityNotFound(_0x183925,null))[_0xf0a7('0x29')](respondWithResult(_0x183925,null))[_0xf0a7('0x47')](handleError(_0x183925,null));};exports[_0xf0a7('0x4c')]=function(_0x365e69,_0x17191f){return db[_0xf0a7('0x44')][_0xf0a7('0x4c')](_0x365e69['body'],{})[_0xf0a7('0x29')](respondWithResult(_0x17191f,0xc9))[_0xf0a7('0x47')](handleError(_0x17191f,null));};exports[_0xf0a7('0x28')]=function(_0x2100d1,_0x206f79){if(_0x2100d1[_0xf0a7('0x4d')]['id']){delete _0x2100d1[_0xf0a7('0x4d')]['id'];}return db[_0xf0a7('0x44')]['find']({'where':{'id':_0x2100d1[_0xf0a7('0x48')]['id']}})[_0xf0a7('0x29')](handleEntityNotFound(_0x206f79,null))[_0xf0a7('0x29')](saveUpdates(_0x2100d1[_0xf0a7('0x4d')],null))[_0xf0a7('0x29')](respondWithResult(_0x206f79,null))[_0xf0a7('0x47')](handleError(_0x206f79,null));};exports[_0xf0a7('0x2a')]=function(_0x1619e1,_0xb2a1e7){return db['SalesforceConfiguration'][_0xf0a7('0x4b')]({'where':{'id':_0x1619e1[_0xf0a7('0x48')]['id']}})[_0xf0a7('0x29')](handleEntityNotFound(_0xb2a1e7,null))[_0xf0a7('0x29')](removeEntity(_0xb2a1e7,null))[_0xf0a7('0x47')](handleError(_0xb2a1e7,null));};exports['getFields']=function(_0x15266b,_0x3af944,_0x26f42c){var _0x4f1b95={};var _0xe19fcb={};var _0x1ec49a;var _0x3d5ba6;return db[_0xf0a7('0x44')][_0xf0a7('0x4e')]({'where':{'id':_0x15266b[_0xf0a7('0x48')]['id']}})[_0xf0a7('0x29')](handleEntityNotFound(_0x3af944,null))[_0xf0a7('0x29')](function(_0x284b45){if(_0x284b45){_0x1ec49a=_0x284b45;_0xe19fcb[_0xf0a7('0x35')]=_['keys'](db['SalesforceField'][_0xf0a7('0x31')]);_0xe19fcb['query']=_[_0xf0a7('0x49')](_0x15266b[_0xf0a7('0x36')]);_0xe19fcb[_0xf0a7('0x3e')]=_['intersection'](_0xe19fcb[_0xf0a7('0x35')],_0xe19fcb[_0xf0a7('0x36')]);_0x4f1b95[_0xf0a7('0x38')]=_['intersection'](_0xe19fcb[_0xf0a7('0x35')],qs['fields'](_0x15266b['query'][_0xf0a7('0x4a')]));_0x4f1b95[_0xf0a7('0x38')]=_0x4f1b95[_0xf0a7('0x38')][_0xf0a7('0x39')]?_0x4f1b95['attributes']:_0xe19fcb[_0xf0a7('0x35')];_0x4f1b95['order']=qs['sort'](_0x15266b[_0xf0a7('0x36')][_0xf0a7('0x3c')]);_0x4f1b95[_0xf0a7('0x3d')]=qs[_0xf0a7('0x3e')](_['pick'](_0x15266b[_0xf0a7('0x36')],_0xe19fcb[_0xf0a7('0x3e')]));if(_0x15266b[_0xf0a7('0x36')][_0xf0a7('0x40')]){_0x4f1b95[_0xf0a7('0x3d')]=_[_0xf0a7('0x42')](_0x4f1b95[_0xf0a7('0x3d')],{'$or':_[_0xf0a7('0x30')](_0x4f1b95[_0xf0a7('0x38')],function(_0x13c506){var _0x5848d8={};_0x5848d8[_0x13c506]={'$like':'%'+_0x15266b[_0xf0a7('0x36')]['filter']+'%'};return _0x5848d8;})});}_0x4f1b95=_[_0xf0a7('0x42')]({},_0x4f1b95,_0x15266b[_0xf0a7('0x43')]);return _0x1ec49a['getFields'](_0x4f1b95);}})[_0xf0a7('0x29')](function(_0x940421){if(_0x940421){_0x3d5ba6=_0x940421['length'];if(!_0x15266b[_0xf0a7('0x36')]['hasOwnProperty'](_0xf0a7('0x3b'))){_0x4f1b95[_0xf0a7('0x22')]=qs[_0xf0a7('0x22')](_0x15266b['query'][_0xf0a7('0x22')]);_0x4f1b95[_0xf0a7('0x20')]=qs[_0xf0a7('0x20')](_0x15266b['query'][_0xf0a7('0x20')]);}return _0x1ec49a[_0xf0a7('0x4f')](_0x4f1b95);}})[_0xf0a7('0x29')](function(_0x3d0bf0){if(_0x3d0bf0){return _0x3d0bf0?{'count':_0x3d5ba6,'rows':_0x3d0bf0}:null;}})[_0xf0a7('0x29')](respondWithResult(_0x3af944,null))['catch'](handleError(_0x3af944,null));};exports[_0xf0a7('0x50')]=function(_0xae7f84,_0x11ff3c,_0x3343c7){var _0x5cc846={};var _0x98c6e9={};var _0x3d7f6f;var _0x29de4f;return db['SalesforceConfiguration'][_0xf0a7('0x4e')]({'where':{'id':_0xae7f84['params']['id']}})[_0xf0a7('0x29')](handleEntityNotFound(_0x11ff3c,null))[_0xf0a7('0x29')](function(_0x5aca2b){if(_0x5aca2b){_0x3d7f6f=_0x5aca2b;_0x98c6e9['model']=_[_0xf0a7('0x49')](db['SalesforceField'][_0xf0a7('0x31')]);_0x98c6e9[_0xf0a7('0x36')]=_[_0xf0a7('0x49')](_0xae7f84[_0xf0a7('0x36')]);_0x98c6e9['filters']=_[_0xf0a7('0x37')](_0x98c6e9['model'],_0x98c6e9['query']);_0x5cc846[_0xf0a7('0x38')]=_['intersection'](_0x98c6e9[_0xf0a7('0x35')],qs[_0xf0a7('0x4a')](_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x4a')]));_0x5cc846[_0xf0a7('0x38')]=_0x5cc846[_0xf0a7('0x38')][_0xf0a7('0x39')]?_0x5cc846[_0xf0a7('0x38')]:_0x98c6e9['model'];_0x5cc846[_0xf0a7('0x51')]=qs['sort'](_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x3c')]);_0x5cc846[_0xf0a7('0x3d')]=qs['filters'](_[_0xf0a7('0x3f')](_0xae7f84[_0xf0a7('0x36')],_0x98c6e9[_0xf0a7('0x3e')]));if(_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x40')]){_0x5cc846['where']=_[_0xf0a7('0x42')](_0x5cc846['where'],{'$or':_[_0xf0a7('0x30')](_0x5cc846[_0xf0a7('0x38')],function(_0x7d7191){var _0x418ecc={};_0x418ecc[_0x7d7191]={'$like':'%'+_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x40')]+'%'};return _0x418ecc;})});}_0x5cc846=_[_0xf0a7('0x42')]({},_0x5cc846,_0xae7f84[_0xf0a7('0x43')]);return _0x3d7f6f[_0xf0a7('0x50')](_0x5cc846);}})[_0xf0a7('0x29')](function(_0x2cca39){if(_0x2cca39){_0x29de4f=_0x2cca39[_0xf0a7('0x39')];if(!_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x3a')](_0xf0a7('0x3b'))){_0x5cc846[_0xf0a7('0x22')]=qs['limit'](_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x22')]);_0x5cc846[_0xf0a7('0x20')]=qs[_0xf0a7('0x20')](_0xae7f84[_0xf0a7('0x36')][_0xf0a7('0x20')]);}return _0x3d7f6f[_0xf0a7('0x50')](_0x5cc846);}})['then'](function(_0x24a116){if(_0x24a116){return _0x24a116?{'count':_0x29de4f,'rows':_0x24a116}:null;}})[_0xf0a7('0x29')](respondWithResult(_0x11ff3c,null))[_0xf0a7('0x47')](handleError(_0x11ff3c,null));};exports[_0xf0a7('0x52')]=function(_0x1fa1d5,_0x12300c,_0x564fc3){var _0x2a6a64={};var _0x3eaa82={};var _0x15f687;var _0x3d3252;return db[_0xf0a7('0x44')][_0xf0a7('0x4e')]({'where':{'id':_0x1fa1d5[_0xf0a7('0x48')]['id']}})['then'](handleEntityNotFound(_0x12300c,null))['then'](function(_0x38c50f){if(_0x38c50f){_0x15f687=_0x38c50f;_0x3eaa82['model']=_[_0xf0a7('0x49')](db[_0xf0a7('0x53')]['rawAttributes']);_0x3eaa82[_0xf0a7('0x36')]=_[_0xf0a7('0x49')](_0x1fa1d5[_0xf0a7('0x36')]);_0x3eaa82[_0xf0a7('0x3e')]=_['intersection'](_0x3eaa82[_0xf0a7('0x35')],_0x3eaa82['query']);_0x2a6a64['attributes']=_[_0xf0a7('0x37')](_0x3eaa82[_0xf0a7('0x35')],qs[_0xf0a7('0x4a')](_0x1fa1d5[_0xf0a7('0x36')][_0xf0a7('0x4a')]));_0x2a6a64[_0xf0a7('0x38')]=_0x2a6a64['attributes'][_0xf0a7('0x39')]?_0x2a6a64[_0xf0a7('0x38')]:_0x3eaa82['model'];_0x2a6a64[_0xf0a7('0x51')]=qs['sort'](_0x1fa1d5['query'][_0xf0a7('0x3c')]);_0x2a6a64[_0xf0a7('0x3d')]=qs['filters'](_['pick'](_0x1fa1d5['query'],_0x3eaa82['filters']));if(_0x1fa1d5['query']['filter']){_0x2a6a64[_0xf0a7('0x3d')]=_[_0xf0a7('0x42')](_0x2a6a64[_0xf0a7('0x3d')],{'$or':_[_0xf0a7('0x30')](_0x2a6a64['attributes'],function(_0x352f6a){var _0x275740={};_0x275740[_0x352f6a]={'$like':'%'+_0x1fa1d5['query']['filter']+'%'};return _0x275740;})});}_0x2a6a64=_['merge']({},_0x2a6a64,_0x1fa1d5[_0xf0a7('0x43')]);return _0x15f687[_0xf0a7('0x52')](_0x2a6a64);}})[_0xf0a7('0x29')](function(_0x8ba933){if(_0x8ba933){_0x3d3252=_0x8ba933[_0xf0a7('0x39')];if(!_0x1fa1d5[_0xf0a7('0x36')][_0xf0a7('0x3a')](_0xf0a7('0x3b'))){_0x2a6a64[_0xf0a7('0x22')]=qs[_0xf0a7('0x22')](_0x1fa1d5['query'][_0xf0a7('0x22')]);_0x2a6a64[_0xf0a7('0x20')]=qs[_0xf0a7('0x20')](_0x1fa1d5[_0xf0a7('0x36')]['offset']);}return _0x15f687[_0xf0a7('0x52')](_0x2a6a64);}})['then'](function(_0x334051){if(_0x334051){return _0x334051?{'count':_0x3d3252,'rows':_0x334051}:null;}})['then'](respondWithResult(_0x12300c,null))[_0xf0a7('0x47')](handleError(_0x12300c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 8acdb47..41aa256 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 _0xf32a=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x58a182,_0x211720){var _0x511e47=function(_0x459f0e){while(--_0x459f0e){_0x58a182['push'](_0x58a182['shift']());}};_0x511e47(++_0x211720);}(_0xf32a,0x7e));var _0xaf32=function(_0x54a601,_0x4ff84a){_0x54a601=_0x54a601-0x0;var _0x404365=_0xf32a[_0x54a601];return _0x404365;};'use strict';var _=require(_0xaf32('0x0'));var util=require(_0xaf32('0x1'));var logger=require(_0xaf32('0x2'))('api');var moment=require(_0xaf32('0x3'));var BPromise=require('bluebird');var rp=require(_0xaf32('0x4'));var fs=require('fs');var path=require(_0xaf32('0x5'));var rimraf=require(_0xaf32('0x6'));var config=require(_0xaf32('0x7'));var attributes=require(_0xaf32('0x8'));module['exports']=function(_0x33b8df,_0x1f7abf){return _0x33b8df[_0xaf32('0x9')](_0xaf32('0xa'),attributes,{'tableName':_0xaf32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29ad=['path','rimraf','../../config/environment','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29ad,0xc9));var _0xd29a=function(_0x147820,_0x3f7f74){_0x147820=_0x147820-0x0;var _0xbea528=_0x29ad[_0x147820];return _0xbea528;};'use strict';var _=require(_0xd29a('0x0'));var util=require(_0xd29a('0x1'));var logger=require(_0xd29a('0x2'))(_0xd29a('0x3'));var moment=require(_0xd29a('0x4'));var BPromise=require(_0xd29a('0x5'));var rp=require(_0xd29a('0x6'));var fs=require('fs');var path=require(_0xd29a('0x7'));var rimraf=require(_0xd29a('0x8'));var config=require(_0xd29a('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd29a('0xa')]=function(_0x10542c,_0x1bddb2){return _0x10542c['define'](_0xd29a('0xb'),attributes,{'tableName':_0xd29a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 4927a11..dba93b4 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 _0xbb93=['then','request\x20sent','debug','stringify','error','message','SalesforceConfiguration,\x20%s,\x20%s','result','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbb93,0x170));var _0x3bb9=function(_0x5b283d,_0x4d3f97){_0x5b283d=_0x5b283d-0x0;var _0x3e7b30=_0xbb93[_0x5b283d];return _0x3e7b30;};'use strict';var _=require(_0x3bb9('0x0'));var util=require('util');var moment=require(_0x3bb9('0x1'));var BPromise=require('bluebird');var rs=require(_0x3bb9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bb9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3bb9('0x4'))(_0x3bb9('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bb9('0x6'));var client=jayson[_0x3bb9('0x7')][_0x3bb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e8af6,_0x48ae2d,_0x711eb7){return new BPromise(function(_0xa68e03,_0x1bbb8f){return client[_0x3bb9('0x9')](_0x2e8af6,_0x711eb7)[_0x3bb9('0xa')](function(_0x1dcb35){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x48ae2d,_0x3bb9('0xb'));logger[_0x3bb9('0xc')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x48ae2d,'request\x20sent',JSON[_0x3bb9('0xd')](_0x1dcb35));if(_0x1dcb35[_0x3bb9('0xe')]){if(_0x1dcb35[_0x3bb9('0xe')]['code']===0x1f4){logger[_0x3bb9('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x48ae2d,_0x1dcb35[_0x3bb9('0xe')][_0x3bb9('0xf')]);return _0x1bbb8f(_0x1dcb35['error'][_0x3bb9('0xf')]);}logger[_0x3bb9('0xe')](_0x3bb9('0x10'),_0x48ae2d,_0x1dcb35[_0x3bb9('0xe')]['message']);return _0xa68e03(_0x1dcb35['error'][_0x3bb9('0xf')]);}else{logger['info'](_0x3bb9('0x10'),_0x48ae2d,_0x3bb9('0xb'));_0xa68e03(_0x1dcb35[_0x3bb9('0x11')]['message']);}})['catch'](function(_0x2f7840){logger[_0x3bb9('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x48ae2d,_0x2f7840);_0x1bbb8f(_0x2f7840);});});} \ No newline at end of file +var _0xbd9f=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x16b07e,_0x26222b){var _0x3581a9=function(_0x13b2db){while(--_0x13b2db){_0x16b07e['push'](_0x16b07e['shift']());}};_0x3581a9(++_0x26222b);}(_0xbd9f,0x1eb));var _0xfbd9=function(_0x29cd9e,_0x5146e1){_0x29cd9e=_0x29cd9e-0x0;var _0x53a4d3=_0xbd9f[_0x29cd9e];return _0x53a4d3;};'use strict';var _=require('lodash');var util=require(_0xfbd9('0x0'));var moment=require(_0xfbd9('0x1'));var BPromise=require('bluebird');var rs=require(_0xfbd9('0x2'));var fs=require('fs');var Redis=require(_0xfbd9('0x3'));var db=require(_0xfbd9('0x4'))['db'];var utils=require(_0xfbd9('0x5'));var logger=require(_0xfbd9('0x6'))(_0xfbd9('0x7'));var config=require(_0xfbd9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfbd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f3ce5,_0x4556bb,_0x2aa057){return new BPromise(function(_0x3256a5,_0x2d31e6){return client[_0xfbd9('0xa')](_0x4f3ce5,_0x2aa057)[_0xfbd9('0xb')](function(_0x3dda14){logger[_0xfbd9('0xc')](_0xfbd9('0xd'),_0x4556bb,_0xfbd9('0xe'));logger[_0xfbd9('0xf')](_0xfbd9('0x10'),_0x4556bb,_0xfbd9('0xe'),JSON[_0xfbd9('0x11')](_0x3dda14));if(_0x3dda14[_0xfbd9('0x12')]){if(_0x3dda14[_0xfbd9('0x12')][_0xfbd9('0x13')]===0x1f4){logger[_0xfbd9('0x12')](_0xfbd9('0xd'),_0x4556bb,_0x3dda14[_0xfbd9('0x12')]['message']);return _0x2d31e6(_0x3dda14[_0xfbd9('0x12')][_0xfbd9('0x14')]);}logger[_0xfbd9('0x12')](_0xfbd9('0xd'),_0x4556bb,_0x3dda14[_0xfbd9('0x12')][_0xfbd9('0x14')]);return _0x3256a5(_0x3dda14[_0xfbd9('0x12')]['message']);}else{logger[_0xfbd9('0xc')](_0xfbd9('0xd'),_0x4556bb,'request\x20sent');_0x3256a5(_0x3dda14[_0xfbd9('0x15')][_0xfbd9('0x14')]);}})[_0xfbd9('0x16')](function(_0x19e8fe){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4556bb,_0x19e8fe);_0x2d31e6(_0x19e8fe);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 5fccd66..5bbefb1 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 _0xa71f=['isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0xa71f,0x87));var _0xfa71=function(_0x489878,_0x3acc78){_0x489878=_0x489878-0x0;var _0x524a9c=_0xa71f[_0x489878];return _0x524a9c;};'use strict';var multer=require(_0xfa71('0x0'));var util=require(_0xfa71('0x1'));var path=require(_0xfa71('0x2'));var timeout=require(_0xfa71('0x3'));var express=require(_0xfa71('0x4'));var router=express[_0xfa71('0x5')]();var fs_extra=require(_0xfa71('0x6'));var auth=require(_0xfa71('0x7'));var interaction=require(_0xfa71('0x8'));var config=require(_0xfa71('0x9'));var controller=require(_0xfa71('0xa'));router[_0xfa71('0xb')]('/',auth[_0xfa71('0xc')](),controller[_0xfa71('0xd')]);router['get'](_0xfa71('0xe'),auth['isAuthenticated'](),controller[_0xfa71('0xf')]);router[_0xfa71('0x10')]('/',auth[_0xfa71('0xc')](),controller[_0xfa71('0x11')]);router[_0xfa71('0x12')](_0xfa71('0xe'),auth[_0xfa71('0xc')](),controller['update']);router['delete'](_0xfa71('0xe'),auth[_0xfa71('0xc')](),controller[_0xfa71('0x13')]);module[_0xfa71('0x14')]=router; \ No newline at end of file +var _0x4f00=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4f00,0x1a3));var _0x04f0=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x4f00[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x04f0('0x0'));var util=require('util');var path=require(_0x04f0('0x1'));var timeout=require(_0x04f0('0x2'));var express=require(_0x04f0('0x3'));var router=express[_0x04f0('0x4')]();var fs_extra=require(_0x04f0('0x5'));var auth=require(_0x04f0('0x6'));var interaction=require(_0x04f0('0x7'));var config=require('../../config/environment');var controller=require(_0x04f0('0x8'));router[_0x04f0('0x9')]('/',auth['isAuthenticated'](),controller[_0x04f0('0xa')]);router[_0x04f0('0x9')](_0x04f0('0xb'),auth[_0x04f0('0xc')](),controller[_0x04f0('0xd')]);router[_0x04f0('0xe')]('/',auth[_0x04f0('0xc')](),controller[_0x04f0('0xf')]);router[_0x04f0('0x10')]('/:id',auth[_0x04f0('0xc')](),controller[_0x04f0('0x11')]);router[_0x04f0('0x12')](_0x04f0('0xb'),auth[_0x04f0('0xc')](),controller[_0x04f0('0x13')]);module[_0x04f0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 8816356..d401b73 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 _0xfc7b=['picklist','STRING','variable','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xfc7b,0xc0));var _0xbfc7=function(_0x208705,_0x1ee99d){_0x208705=_0x208705-0x0;var _0x101594=_0xfc7b[_0x208705];return _0x101594;};'use strict';var Sequelize=require(_0xbfc7('0x0'));module[_0xbfc7('0x1')]={'type':{'type':Sequelize[_0xbfc7('0x2')](_0xbfc7('0x3'),'variable',_0xbfc7('0x4'),_0xbfc7('0x5'),_0xbfc7('0x6')),'defaultValue':_0xbfc7('0x3')},'content':{'type':Sequelize[_0xbfc7('0x7')]},'key':{'type':Sequelize[_0xbfc7('0x7')]},'keyType':{'type':Sequelize[_0xbfc7('0x2')](_0xbfc7('0x3'),_0xbfc7('0x8'),_0xbfc7('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbfc7('0x7')]},'variableName':{'type':Sequelize[_0xbfc7('0x7')]}}; \ No newline at end of file +var _0xf044=['keyValue','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x32c3ee,_0x33c20a){var _0x3108d1=function(_0x11481c){while(--_0x11481c){_0x32c3ee['push'](_0x32c3ee['shift']());}};_0x3108d1(++_0x33c20a);}(_0xf044,0x1e3));var _0x4f04=function(_0x4c3b9f,_0xc9acc){_0x4c3b9f=_0x4c3b9f-0x0;var _0x4b6958=_0xf044[_0x4c3b9f];return _0x4b6958;};'use strict';var Sequelize=require(_0x4f04('0x0'));module[_0x4f04('0x1')]={'type':{'type':Sequelize[_0x4f04('0x2')]('string',_0x4f04('0x3'),_0x4f04('0x4'),_0x4f04('0x5'),'picklist'),'defaultValue':_0x4f04('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4f04('0x7')]},'keyType':{'type':Sequelize[_0x4f04('0x2')](_0x4f04('0x6'),_0x4f04('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4f04('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x4f04('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 94d6b55..22fab36 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 _0x4e3f=['then','error','stack','name','index','SalesforceField','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','length','include','options','find','create','body','catch','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x4e3f,0x10a));var _0xf4e3=function(_0x2f9746,_0x385dfb){_0x2f9746=_0x2f9746-0x0;var _0x6c4dcc=_0x4e3f[_0x2f9746];return _0x6c4dcc;};'use strict';var emlformat=require(_0xf4e3('0x0'));var rimraf=require(_0xf4e3('0x1'));var zipdir=require(_0xf4e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4e3('0x3'));var moment=require(_0xf4e3('0x4'));var BPromise=require(_0xf4e3('0x5'));var Mustache=require(_0xf4e3('0x6'));var util=require(_0xf4e3('0x7'));var path=require(_0xf4e3('0x8'));var sox=require(_0xf4e3('0x9'));var csv=require(_0xf4e3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4e3('0xb'));var _=require(_0xf4e3('0xc'));var squel=require('squel');var crypto=require(_0xf4e3('0xd'));var jsforce=require(_0xf4e3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf4e3('0xa'));var querystring=require('querystring');var Papa=require(_0xf4e3('0xf'));var Redis=require(_0xf4e3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf4e3('0x11'));var as=require(_0xf4e3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4e3('0x13'))('api');var utils=require(_0xf4e3('0x14'));var config=require(_0xf4e3('0x15'));var licenseUtil=require(_0xf4e3('0x16'));var db=require(_0xf4e3('0x17'))['db'];function respondWithStatusCode(_0x4bbe53,_0xbc48ae){_0xbc48ae=_0xbc48ae||0xcc;return function(_0x3af83d){if(_0x3af83d){return _0x4bbe53[_0xf4e3('0x18')](_0xbc48ae);}return _0x4bbe53['status'](_0xbc48ae)[_0xf4e3('0x19')]();};}function respondWithResult(_0xaff9f,_0x1385d7){_0x1385d7=_0x1385d7||0xc8;return function(_0x2faf37){if(_0x2faf37){return _0xaff9f[_0xf4e3('0x1a')](_0x1385d7)[_0xf4e3('0x1b')](_0x2faf37);}};}function respondWithFilteredResult(_0x14d5db,_0x21e030){return function(_0x2c4f9c){if(_0x2c4f9c){var _0x59eab0=typeof _0x21e030[_0xf4e3('0x1c')]===_0xf4e3('0x1d')&&typeof _0x21e030[_0xf4e3('0x1e')]==='undefined';var _0x566d70=_0x2c4f9c[_0xf4e3('0x1f')];var _0x1b171c=_0x59eab0?0x0:_0x21e030[_0xf4e3('0x1c')];var _0x412a4f=_0x59eab0?_0x2c4f9c[_0xf4e3('0x1f')]:_0x21e030['offset']+_0x21e030[_0xf4e3('0x1e')];var _0x5e709e;if(_0x412a4f>=_0x566d70){_0x412a4f=_0x566d70;_0x5e709e=0xc8;}else{_0x5e709e=0xce;}_0x14d5db[_0xf4e3('0x1a')](_0x5e709e);return _0x14d5db[_0xf4e3('0x20')](_0xf4e3('0x21'),_0x1b171c+'-'+_0x412a4f+'/'+_0x566d70)[_0xf4e3('0x1b')](_0x2c4f9c);}return null;};}function patchUpdates(_0x5240f6){return function(_0x4c611e){try{jsonpatch[_0xf4e3('0x22')](_0x4c611e,_0x5240f6,!![]);}catch(_0x5000d9){return BPromise[_0xf4e3('0x23')](_0x5000d9);}return _0x4c611e[_0xf4e3('0x24')]();};}function saveUpdates(_0x2fe06a,_0x89e90e){return function(_0x93c8e4){if(_0x93c8e4){return _0x93c8e4[_0xf4e3('0x25')](_0x2fe06a)[_0xf4e3('0x26')](function(_0x335bb9){return _0x335bb9;});}return null;};}function removeEntity(_0x258c52,_0xe17a6b){return function(_0x3a33de){if(_0x3a33de){return _0x3a33de['destroy']()[_0xf4e3('0x26')](function(){_0x258c52['status'](0xcc)[_0xf4e3('0x19')]();});}};}function handleEntityNotFound(_0x26c565,_0x309a14){return function(_0x479780){if(!_0x479780){_0x26c565[_0xf4e3('0x18')](0x194);}return _0x479780;};}function handleError(_0xf6ff34,_0xd9fb92){_0xd9fb92=_0xd9fb92||0x1f4;return function(_0x22ae75){logger[_0xf4e3('0x27')](_0x22ae75[_0xf4e3('0x28')]);if(_0x22ae75['name']){delete _0x22ae75[_0xf4e3('0x29')];}_0xf6ff34[_0xf4e3('0x1a')](_0xd9fb92)['send'](_0x22ae75);};}exports[_0xf4e3('0x2a')]=function(_0x2b753e,_0x1d74ad){var _0x5d526c={},_0x2d7d56={},_0x2bc829={'count':0x0,'rows':[]};var _0x437321=_['map'](db[_0xf4e3('0x2b')][_0xf4e3('0x2c')],function(_0x3198b6){return{'name':_0x3198b6[_0xf4e3('0x2d')],'type':_0x3198b6[_0xf4e3('0x2e')][_0xf4e3('0x2f')]};});_0x2d7d56[_0xf4e3('0x30')]=_[_0xf4e3('0x31')](_0x437321,_0xf4e3('0x29'));_0x2d7d56[_0xf4e3('0x32')]=_[_0xf4e3('0x33')](_0x2b753e['query']);_0x2d7d56['filters']=_['intersection'](_0x2d7d56['model'],_0x2d7d56[_0xf4e3('0x32')]);_0x5d526c[_0xf4e3('0x34')]=_[_0xf4e3('0x35')](_0x2d7d56[_0xf4e3('0x30')],qs['fields'](_0x2b753e['query'][_0xf4e3('0x36')]));_0x5d526c[_0xf4e3('0x34')]=_0x5d526c[_0xf4e3('0x34')]['length']?_0x5d526c[_0xf4e3('0x34')]:_0x2d7d56[_0xf4e3('0x30')];if(!_0x2b753e['query'][_0xf4e3('0x37')]('nolimit')){_0x5d526c['limit']=qs['limit'](_0x2b753e[_0xf4e3('0x32')][_0xf4e3('0x1e')]);_0x5d526c[_0xf4e3('0x1c')]=qs[_0xf4e3('0x1c')](_0x2b753e[_0xf4e3('0x32')][_0xf4e3('0x1c')]);}_0x5d526c[_0xf4e3('0x38')]=qs[_0xf4e3('0x39')](_0x2b753e[_0xf4e3('0x32')][_0xf4e3('0x39')]);_0x5d526c[_0xf4e3('0x3a')]=qs[_0xf4e3('0x3b')](_[_0xf4e3('0x3c')](_0x2b753e[_0xf4e3('0x32')],_0x2d7d56[_0xf4e3('0x3b')]),_0x437321);if(_0x2b753e['query'][_0xf4e3('0x3d')]){_0x5d526c['where']=_['merge'](_0x5d526c[_0xf4e3('0x3a')],{'$or':_['map'](_0x437321,function(_0x2e3147){if(_0x2e3147[_0xf4e3('0x2e')]!==_0xf4e3('0x3e')){var _0x3b6a3d={};_0x3b6a3d[_0x2e3147[_0xf4e3('0x29')]]={'$like':'%'+_0x2b753e[_0xf4e3('0x32')][_0xf4e3('0x3d')]+'%'};return _0x3b6a3d;}})});}_0x5d526c=_[_0xf4e3('0x3f')]({},_0x5d526c,_0x2b753e['options']);var _0x2e0c36={'where':_0x5d526c['where']};return db[_0xf4e3('0x2b')][_0xf4e3('0x1f')](_0x2e0c36)['then'](function(_0x435b23){_0x2bc829['count']=_0x435b23;if(_0x2b753e[_0xf4e3('0x32')][_0xf4e3('0x40')]){_0x5d526c['include']=[{'all':!![]}];}return db[_0xf4e3('0x2b')][_0xf4e3('0x41')](_0x5d526c);})[_0xf4e3('0x26')](function(_0x2a327f){_0x2bc829[_0xf4e3('0x42')]=_0x2a327f;return _0x2bc829;})[_0xf4e3('0x26')](respondWithFilteredResult(_0x1d74ad,_0x5d526c))['catch'](handleError(_0x1d74ad,null));};exports[_0xf4e3('0x43')]=function(_0x142705,_0x492f98){var _0x43b14c={'raw':!![],'where':{'id':_0x142705['params']['id']}},_0x5081d2={};_0x5081d2[_0xf4e3('0x30')]=_['keys'](db['SalesforceField'][_0xf4e3('0x2c')]);_0x5081d2[_0xf4e3('0x32')]=_['keys'](_0x142705[_0xf4e3('0x32')]);_0x5081d2[_0xf4e3('0x3b')]=_[_0xf4e3('0x35')](_0x5081d2[_0xf4e3('0x30')],_0x5081d2['query']);_0x43b14c['attributes']=_[_0xf4e3('0x35')](_0x5081d2['model'],qs[_0xf4e3('0x36')](_0x142705[_0xf4e3('0x32')][_0xf4e3('0x36')]));_0x43b14c[_0xf4e3('0x34')]=_0x43b14c['attributes'][_0xf4e3('0x44')]?_0x43b14c[_0xf4e3('0x34')]:_0x5081d2['model'];if(_0x142705[_0xf4e3('0x32')]['includeAll']){_0x43b14c[_0xf4e3('0x45')]=[{'all':!![]}];}_0x43b14c=_[_0xf4e3('0x3f')]({},_0x43b14c,_0x142705[_0xf4e3('0x46')]);return db['SalesforceField'][_0xf4e3('0x47')](_0x43b14c)[_0xf4e3('0x26')](handleEntityNotFound(_0x492f98,null))['then'](respondWithResult(_0x492f98,null))['catch'](handleError(_0x492f98,null));};exports[_0xf4e3('0x48')]=function(_0xd1bf7d,_0x4ce248){return db['SalesforceField'][_0xf4e3('0x48')](_0xd1bf7d[_0xf4e3('0x49')],{})[_0xf4e3('0x26')](respondWithResult(_0x4ce248,0xc9))[_0xf4e3('0x4a')](handleError(_0x4ce248,null));};exports['update']=function(_0x27af2a,_0x388df0){if(_0x27af2a[_0xf4e3('0x49')]['id']){delete _0x27af2a['body']['id'];}return db[_0xf4e3('0x2b')]['find']({'where':{'id':_0x27af2a[_0xf4e3('0x4b')]['id']}})[_0xf4e3('0x26')](handleEntityNotFound(_0x388df0,null))['then'](saveUpdates(_0x27af2a[_0xf4e3('0x49')],null))[_0xf4e3('0x26')](respondWithResult(_0x388df0,null))[_0xf4e3('0x4a')](handleError(_0x388df0,null));};exports['destroy']=function(_0x541701,_0x151842){return db[_0xf4e3('0x2b')][_0xf4e3('0x47')]({'where':{'id':_0x541701[_0xf4e3('0x4b')]['id']}})[_0xf4e3('0x26')](handleEntityNotFound(_0x151842,null))[_0xf4e3('0x26')](removeEntity(_0x151842,null))[_0xf4e3('0x4a')](handleError(_0x151842,null));}; \ No newline at end of file +var _0x0963=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','catch','show','include','find','create','body','params','eml-format','zip-dir','fast-json-patch','bluebird'];(function(_0x53b72f,_0x29ffb2){var _0x27d610=function(_0x56f739){while(--_0x56f739){_0x53b72f['push'](_0x53b72f['shift']());}};_0x27d610(++_0x29ffb2);}(_0x0963,0x1b8));var _0x3096=function(_0x4b1473,_0x570c61){_0x4b1473=_0x4b1473-0x0;var _0x4eb602=_0x0963[_0x4b1473];return _0x4eb602;};'use strict';var emlformat=require(_0x3096('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3096('0x1'));var jsonpatch=require(_0x3096('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3096('0x3'));var Mustache=require(_0x3096('0x4'));var util=require('util');var path=require(_0x3096('0x5'));var sox=require(_0x3096('0x6'));var csv=require(_0x3096('0x7'));var ejs=require(_0x3096('0x8'));var fs=require('fs');var fs_extra=require(_0x3096('0x9'));var _=require(_0x3096('0xa'));var squel=require(_0x3096('0xb'));var crypto=require(_0x3096('0xc'));var jsforce=require(_0x3096('0xd'));var deskjs=require(_0x3096('0xe'));var toCsv=require(_0x3096('0x7'));var querystring=require('querystring');var Papa=require(_0x3096('0xf'));var Redis=require(_0x3096('0x10'));var authService=require(_0x3096('0x11'));var qs=require(_0x3096('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3096('0x13'));var logger=require(_0x3096('0x14'))(_0x3096('0x15'));var utils=require(_0x3096('0x16'));var config=require(_0x3096('0x17'));var licenseUtil=require(_0x3096('0x18'));var db=require(_0x3096('0x19'))['db'];function respondWithStatusCode(_0x21a20c,_0x3519b0){_0x3519b0=_0x3519b0||0xcc;return function(_0x448a92){if(_0x448a92){return _0x21a20c['sendStatus'](_0x3519b0);}return _0x21a20c['status'](_0x3519b0)['end']();};}function respondWithResult(_0x3c0355,_0x536270){_0x536270=_0x536270||0xc8;return function(_0x4b6524){if(_0x4b6524){return _0x3c0355[_0x3096('0x1a')](_0x536270)['json'](_0x4b6524);}};}function respondWithFilteredResult(_0x330dc3,_0x3fae5c){return function(_0x771cf9){if(_0x771cf9){var _0x1f4083=typeof _0x3fae5c[_0x3096('0x1b')]==='undefined'&&typeof _0x3fae5c[_0x3096('0x1c')]===_0x3096('0x1d');var _0x2b7003=_0x771cf9['count'];var _0x5d0571=_0x1f4083?0x0:_0x3fae5c[_0x3096('0x1b')];var _0x2aed35=_0x1f4083?_0x771cf9[_0x3096('0x1e')]:_0x3fae5c[_0x3096('0x1b')]+_0x3fae5c['limit'];var _0x520226;if(_0x2aed35>=_0x2b7003){_0x2aed35=_0x2b7003;_0x520226=0xc8;}else{_0x520226=0xce;}_0x330dc3['status'](_0x520226);return _0x330dc3[_0x3096('0x1f')](_0x3096('0x20'),_0x5d0571+'-'+_0x2aed35+'/'+_0x2b7003)[_0x3096('0x21')](_0x771cf9);}return null;};}function patchUpdates(_0x31a508){return function(_0xfa48e6){try{jsonpatch[_0x3096('0x22')](_0xfa48e6,_0x31a508,!![]);}catch(_0x438c42){return BPromise[_0x3096('0x23')](_0x438c42);}return _0xfa48e6['save']();};}function saveUpdates(_0x18d560,_0x4765e3){return function(_0xb29ae0){if(_0xb29ae0){return _0xb29ae0[_0x3096('0x24')](_0x18d560)[_0x3096('0x25')](function(_0x4124cb){return _0x4124cb;});}return null;};}function removeEntity(_0x4d4aaf,_0x475785){return function(_0x4014bb){if(_0x4014bb){return _0x4014bb[_0x3096('0x26')]()[_0x3096('0x25')](function(){_0x4d4aaf[_0x3096('0x1a')](0xcc)[_0x3096('0x27')]();});}};}function handleEntityNotFound(_0x731483,_0x23331e){return function(_0x4c9447){if(!_0x4c9447){_0x731483[_0x3096('0x28')](0x194);}return _0x4c9447;};}function handleError(_0x4e97ee,_0x33c6dc){_0x33c6dc=_0x33c6dc||0x1f4;return function(_0x56a0db){logger[_0x3096('0x29')](_0x56a0db[_0x3096('0x2a')]);if(_0x56a0db[_0x3096('0x2b')]){delete _0x56a0db[_0x3096('0x2b')];}_0x4e97ee[_0x3096('0x1a')](_0x33c6dc)[_0x3096('0x2c')](_0x56a0db);};}exports[_0x3096('0x2d')]=function(_0x599c27,_0x460cbd){var _0x3a8bcd={},_0x2e4c67={},_0x2a92e1={'count':0x0,'rows':[]};var _0x181128=_[_0x3096('0x2e')](db[_0x3096('0x2f')][_0x3096('0x30')],function(_0x5e6ab9){return{'name':_0x5e6ab9[_0x3096('0x31')],'type':_0x5e6ab9[_0x3096('0x32')]['key']};});_0x2e4c67['model']=_[_0x3096('0x2e')](_0x181128,'name');_0x2e4c67[_0x3096('0x33')]=_[_0x3096('0x34')](_0x599c27[_0x3096('0x33')]);_0x2e4c67[_0x3096('0x35')]=_[_0x3096('0x36')](_0x2e4c67[_0x3096('0x37')],_0x2e4c67[_0x3096('0x33')]);_0x3a8bcd[_0x3096('0x38')]=_['intersection'](_0x2e4c67[_0x3096('0x37')],qs['fields'](_0x599c27[_0x3096('0x33')][_0x3096('0x39')]));_0x3a8bcd['attributes']=_0x3a8bcd[_0x3096('0x38')]['length']?_0x3a8bcd[_0x3096('0x38')]:_0x2e4c67[_0x3096('0x37')];if(!_0x599c27['query'][_0x3096('0x3a')](_0x3096('0x3b'))){_0x3a8bcd['limit']=qs[_0x3096('0x1c')](_0x599c27['query']['limit']);_0x3a8bcd[_0x3096('0x1b')]=qs[_0x3096('0x1b')](_0x599c27[_0x3096('0x33')][_0x3096('0x1b')]);}_0x3a8bcd['order']=qs[_0x3096('0x3c')](_0x599c27[_0x3096('0x33')][_0x3096('0x3c')]);_0x3a8bcd[_0x3096('0x3d')]=qs['filters'](_[_0x3096('0x3e')](_0x599c27[_0x3096('0x33')],_0x2e4c67[_0x3096('0x35')]),_0x181128);if(_0x599c27[_0x3096('0x33')]['filter']){_0x3a8bcd['where']=_[_0x3096('0x3f')](_0x3a8bcd[_0x3096('0x3d')],{'$or':_[_0x3096('0x2e')](_0x181128,function(_0x4f180b){if(_0x4f180b['type']!=='VIRTUAL'){var _0x4c373d={};_0x4c373d[_0x4f180b['name']]={'$like':'%'+_0x599c27[_0x3096('0x33')][_0x3096('0x40')]+'%'};return _0x4c373d;}})});}_0x3a8bcd=_[_0x3096('0x3f')]({},_0x3a8bcd,_0x599c27[_0x3096('0x41')]);var _0x17a8ee={'where':_0x3a8bcd[_0x3096('0x3d')]};return db[_0x3096('0x2f')][_0x3096('0x1e')](_0x17a8ee)[_0x3096('0x25')](function(_0x59d05d){_0x2a92e1[_0x3096('0x1e')]=_0x59d05d;if(_0x599c27['query'][_0x3096('0x42')]){_0x3a8bcd['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x3a8bcd);})[_0x3096('0x25')](function(_0xae34b1){_0x2a92e1['rows']=_0xae34b1;return _0x2a92e1;})[_0x3096('0x25')](respondWithFilteredResult(_0x460cbd,_0x3a8bcd))[_0x3096('0x43')](handleError(_0x460cbd,null));};exports[_0x3096('0x44')]=function(_0x4aa836,_0x2da6aa){var _0x588681={'raw':!![],'where':{'id':_0x4aa836['params']['id']}},_0x38d1d8={};_0x38d1d8[_0x3096('0x37')]=_[_0x3096('0x34')](db[_0x3096('0x2f')][_0x3096('0x30')]);_0x38d1d8['query']=_[_0x3096('0x34')](_0x4aa836['query']);_0x38d1d8['filters']=_[_0x3096('0x36')](_0x38d1d8[_0x3096('0x37')],_0x38d1d8[_0x3096('0x33')]);_0x588681[_0x3096('0x38')]=_[_0x3096('0x36')](_0x38d1d8[_0x3096('0x37')],qs[_0x3096('0x39')](_0x4aa836[_0x3096('0x33')]['fields']));_0x588681['attributes']=_0x588681['attributes']['length']?_0x588681[_0x3096('0x38')]:_0x38d1d8[_0x3096('0x37')];if(_0x4aa836[_0x3096('0x33')][_0x3096('0x42')]){_0x588681[_0x3096('0x45')]=[{'all':!![]}];}_0x588681=_[_0x3096('0x3f')]({},_0x588681,_0x4aa836[_0x3096('0x41')]);return db[_0x3096('0x2f')][_0x3096('0x46')](_0x588681)['then'](handleEntityNotFound(_0x2da6aa,null))['then'](respondWithResult(_0x2da6aa,null))[_0x3096('0x43')](handleError(_0x2da6aa,null));};exports[_0x3096('0x47')]=function(_0x1809cc,_0x313734){return db['SalesforceField'][_0x3096('0x47')](_0x1809cc[_0x3096('0x48')],{})['then'](respondWithResult(_0x313734,0xc9))[_0x3096('0x43')](handleError(_0x313734,null));};exports[_0x3096('0x24')]=function(_0x1902ce,_0x228fa6){if(_0x1902ce[_0x3096('0x48')]['id']){delete _0x1902ce[_0x3096('0x48')]['id'];}return db[_0x3096('0x2f')][_0x3096('0x46')]({'where':{'id':_0x1902ce[_0x3096('0x49')]['id']}})['then'](handleEntityNotFound(_0x228fa6,null))[_0x3096('0x25')](saveUpdates(_0x1902ce[_0x3096('0x48')],null))[_0x3096('0x25')](respondWithResult(_0x228fa6,null))[_0x3096('0x43')](handleError(_0x228fa6,null));};exports['destroy']=function(_0x3f3b17,_0x473bbe){return db['SalesforceField'][_0x3096('0x46')]({'where':{'id':_0x3f3b17['params']['id']}})[_0x3096('0x25')](handleEntityNotFound(_0x473bbe,null))[_0x3096('0x25')](removeEntity(_0x473bbe,null))[_0x3096('0x43')](handleError(_0x473bbe,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index cc1984f..d73c836 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 _0x9efb=['util','../../config/logger','api','moment','request-promise','path','rimraf','int_salesforce_fields','salesforce_unique_index','FieldId'];(function(_0x26cbf3,_0x8dd4d5){var _0x336a0d=function(_0x2b7af1){while(--_0x2b7af1){_0x26cbf3['push'](_0x26cbf3['shift']());}};_0x336a0d(++_0x8dd4d5);}(_0x9efb,0x1ea));var _0xb9ef=function(_0x53052e,_0x5bf5e2){_0x53052e=_0x53052e-0x0;var _0x44f22f=_0x9efb[_0x53052e];return _0x44f22f;};'use strict';var _=require('lodash');var util=require(_0xb9ef('0x0'));var logger=require(_0xb9ef('0x1'))(_0xb9ef('0x2'));var moment=require(_0xb9ef('0x3'));var BPromise=require('bluebird');var rp=require(_0xb9ef('0x4'));var fs=require('fs');var path=require(_0xb9ef('0x5'));var rimraf=require(_0xb9ef('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x1ee626,_0x1d1d1e){return _0x1ee626['define']('SalesforceField',attributes,{'tableName':_0xb9ef('0x7'),'paranoid':![],'indexes':[{'name':_0xb9ef('0x8'),'fields':['idField',_0xb9ef('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca0c=['SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','moment','request-promise','path','./intSalesforceField.attributes','define'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xca0c,0x184));var _0xcca0=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xca0c[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xcca0('0x0'));var util=require(_0xcca0('0x1'));var logger=require(_0xcca0('0x2'))('api');var moment=require(_0xcca0('0x3'));var BPromise=require('bluebird');var rp=require(_0xcca0('0x4'));var fs=require('fs');var path=require(_0xcca0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcca0('0x6'));module['exports']=function(_0x4ea017,_0x2c0f63){return _0x4ea017[_0xcca0('0x7')](_0xcca0('0x8'),attributes,{'tableName':_0xcca0('0x9'),'paranoid':![],'indexes':[{'name':_0xcca0('0xa'),'fields':['idField',_0xcca0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 603f047..697edd4 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 _0xf343=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch'];(function(_0x4797d9,_0x246f2b){var _0xb935b9=function(_0x939b5e){while(--_0x939b5e){_0x4797d9['push'](_0x4797d9['shift']());}};_0xb935b9(++_0x246f2b);}(_0xf343,0xd8));var _0x3f34=function(_0x6b57e2,_0x31d324){_0x6b57e2=_0x6b57e2-0x0;var _0x39e1c2=_0xf343[_0x6b57e2];return _0x39e1c2;};'use strict';var _=require(_0x3f34('0x0'));var util=require(_0x3f34('0x1'));var moment=require(_0x3f34('0x2'));var BPromise=require(_0x3f34('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f34('0x4'));var db=require(_0x3f34('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f34('0x6'))(_0x3f34('0x7'));var config=require(_0x3f34('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f34('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x100911,_0x2b84be,_0x52cfd5){return new BPromise(function(_0x184d1a,_0x4cdba7){return client['request'](_0x100911,_0x52cfd5)[_0x3f34('0xa')](function(_0x570aec){logger[_0x3f34('0xb')](_0x3f34('0xc'),_0x2b84be,_0x3f34('0xd'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2b84be,'request\x20sent',JSON[_0x3f34('0xe')](_0x570aec));if(_0x570aec[_0x3f34('0xf')]){if(_0x570aec['error']['code']===0x1f4){logger[_0x3f34('0xf')]('SalesforceField,\x20%s,\x20%s',_0x2b84be,_0x570aec['error'][_0x3f34('0x10')]);return _0x4cdba7(_0x570aec[_0x3f34('0xf')][_0x3f34('0x10')]);}logger[_0x3f34('0xf')](_0x3f34('0xc'),_0x2b84be,_0x570aec['error'][_0x3f34('0x10')]);return _0x184d1a(_0x570aec[_0x3f34('0xf')][_0x3f34('0x10')]);}else{logger[_0x3f34('0xb')](_0x3f34('0xc'),_0x2b84be,_0x3f34('0xd'));_0x184d1a(_0x570aec['result'][_0x3f34('0x10')]);}})[_0x3f34('0x11')](function(_0x42906d){logger[_0x3f34('0xf')]('SalesforceField,\x20%s,\x20%s',_0x2b84be,_0x42906d);_0x4cdba7(_0x42906d);});});} \ No newline at end of file +var _0xb4d9=['jayson/promise','http','request','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x275b16,_0xb0a60d){var _0x1f8ce0=function(_0x4004c5){while(--_0x4004c5){_0x275b16['push'](_0x275b16['shift']());}};_0x1f8ce0(++_0xb0a60d);}(_0xb4d9,0x1ad));var _0x9b4d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb4d9[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0x9b4d('0x0'));var moment=require(_0x9b4d('0x1'));var BPromise=require(_0x9b4d('0x2'));var rs=require(_0x9b4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b4d('0x4'))['db'];var utils=require(_0x9b4d('0x5'));var logger=require(_0x9b4d('0x6'))(_0x9b4d('0x7'));var config=require('../../config/environment');var jayson=require(_0x9b4d('0x8'));var client=jayson['client'][_0x9b4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2496a6,_0x55973b,_0x2e4865){return new BPromise(function(_0x2a10e8,_0x2d86a1){return client[_0x9b4d('0xa')](_0x2496a6,_0x2e4865)['then'](function(_0x499810){logger['info']('SalesforceField,\x20%s,\x20%s',_0x55973b,_0x9b4d('0xb'));logger[_0x9b4d('0xc')](_0x9b4d('0xd'),_0x55973b,_0x9b4d('0xb'),JSON[_0x9b4d('0xe')](_0x499810));if(_0x499810[_0x9b4d('0xf')]){if(_0x499810['error'][_0x9b4d('0x10')]===0x1f4){logger['error'](_0x9b4d('0x11'),_0x55973b,_0x499810[_0x9b4d('0xf')][_0x9b4d('0x12')]);return _0x2d86a1(_0x499810[_0x9b4d('0xf')]['message']);}logger[_0x9b4d('0xf')]('SalesforceField,\x20%s,\x20%s',_0x55973b,_0x499810['error'][_0x9b4d('0x12')]);return _0x2a10e8(_0x499810['error'][_0x9b4d('0x12')]);}else{logger['info'](_0x9b4d('0x11'),_0x55973b,_0x9b4d('0xb'));_0x2a10e8(_0x499810['result']['message']);}})['catch'](function(_0x4d44e0){logger[_0x9b4d('0xf')]('SalesforceField,\x20%s,\x20%s',_0x55973b,_0x4d44e0);_0x2d86a1(_0x4d44e0);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 4fdea87..6edb2f6 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 _0xf4eb=['getFields','create','put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x5585a9,_0x46b57e){var _0x106482=function(_0x3d5c7e){while(--_0x3d5c7e){_0x5585a9['push'](_0x5585a9['shift']());}};_0x106482(++_0x46b57e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2130db,_0x303eb0){_0x2130db=_0x2130db-0x0;var _0x4a6452=_0xf4eb[_0x2130db];return _0x4a6452;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xc')]);router['post'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['addConfiguration']);router[_0xbf4e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0x10'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x11')]);module[_0xbf4e('0x12')]=router; \ No newline at end of file +var _0x08ca=['show','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x08ca,0xb2));var _0xa08c=function(_0x310227,_0x25eb57){_0x310227=_0x310227-0x0;var _0x4a3da3=_0x08ca[_0x310227];return _0x4a3da3;};'use strict';var multer=require(_0xa08c('0x0'));var util=require('util');var path=require(_0xa08c('0x1'));var timeout=require(_0xa08c('0x2'));var express=require(_0xa08c('0x3'));var router=express[_0xa08c('0x4')]();var fs_extra=require(_0xa08c('0x5'));var auth=require(_0xa08c('0x6'));var interaction=require(_0xa08c('0x7'));var config=require(_0xa08c('0x8'));var controller=require(_0xa08c('0x9'));router[_0xa08c('0xa')]('/',auth[_0xa08c('0xb')](),controller[_0xa08c('0xc')]);router['get'](_0xa08c('0xd'),auth[_0xa08c('0xb')](),controller[_0xa08c('0xe')]);router[_0xa08c('0xa')]('/:id/configurations',auth[_0xa08c('0xb')](),controller['getConfigurations']);router[_0xa08c('0xa')](_0xa08c('0xf'),auth['isAuthenticated'](),controller[_0xa08c('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa08c('0x11')]);router[_0xa08c('0x12')]('/:id/configurations',auth[_0xa08c('0xb')](),controller[_0xa08c('0x13')]);router[_0xa08c('0x14')](_0xa08c('0xd'),auth[_0xa08c('0xb')](),controller[_0xa08c('0x15')]);router['delete'](_0xa08c('0xd'),auth[_0xa08c('0xb')](),controller[_0xa08c('0x16')]);module[_0xa08c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 1d94b70..2902619 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 _0x6da0=['username','remoteUri','sequelize','STRING'];(function(_0x413862,_0x457be0){var _0x3cb003=function(_0x2c649f){while(--_0x2c649f){_0x413862['push'](_0x413862['shift']());}};_0x3cb003(++_0x457be0);}(_0x6da0,0x162));var _0x06da=function(_0x526193,_0x441723){_0x526193=_0x526193-0x0;var _0x34ea38=_0x6da0[_0x526193];return _0x34ea38;};'use strict';var Sequelize=require(_0x06da('0x0'));module['exports']={'name':{'type':Sequelize[_0x06da('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x06da('0x2')},'password':{'type':Sequelize[_0x06da('0x1')]},'email':{'type':Sequelize[_0x06da('0x1')]},'remoteUri':{'type':Sequelize[_0x06da('0x1')],'unique':_0x06da('0x3')},'serverUrl':{'type':Sequelize[_0x06da('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4c59=['remoteUri','sequelize','STRING','username'];(function(_0x32f75b,_0x16cde7){var _0x26f5c7=function(_0x2f80b8){while(--_0x2f80b8){_0x32f75b['push'](_0x32f75b['shift']());}};_0x26f5c7(++_0x16cde7);}(_0x4c59,0x115));var _0x94c5=function(_0x2bc8e0,_0x38204a){_0x2bc8e0=_0x2bc8e0-0x0;var _0xca8f97=_0x4c59[_0x2bc8e0];return _0xca8f97;};'use strict';var Sequelize=require(_0x94c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x94c5('0x1')]},'description':{'type':Sequelize[_0x94c5('0x1')]},'username':{'type':Sequelize[_0x94c5('0x1')],'unique':_0x94c5('0x2')},'password':{'type':Sequelize[_0x94c5('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x94c5('0x1')],'unique':_0x94c5('0x3')},'serverUrl':{'type':Sequelize[_0x94c5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 2765500..5214c71 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 _0xd071=['caused_by','watch_list','upon_reject','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','order','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','resolved_at','approval_set','work_notes','correlation_display','assignment_group','business_stc','additional_assignee_list','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','assign','includes','forEach','internalType','label','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','False','inactive','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','ServicenowAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','include','catch','params','rawAttributes','length','options','find','create','body','destroy','getConfigurations','ServicenowConfiguration','pick','addConfiguration','findOne','getSubjects','Descriptions','getDescriptions','type','ServicenowField','Subjects','getFields','made_sla','knowledge','subcategory','close_code','incident_state','severity','parent'];(function(_0x336239,_0x1803c4){var _0x381dff=function(_0x44d9e2){while(--_0x44d9e2){_0x336239['push'](_0x336239['shift']());}};_0x381dff(++_0x1803c4);}(_0xd071,0x1c5));var _0x1d07=function(_0x2051d2,_0x551b1a){_0x2051d2=_0x2051d2-0x0;var _0x546bbc=_0xd071[_0x2051d2];return _0x546bbc;};'use strict';var emlformat=require(_0x1d07('0x0'));var rimraf=require(_0x1d07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d07('0x2'));var moment=require(_0x1d07('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1d07('0x4'));var path=require(_0x1d07('0x5'));var sox=require(_0x1d07('0x6'));var csv=require(_0x1d07('0x7'));var ejs=require(_0x1d07('0x8'));var fs=require('fs');var fs_extra=require(_0x1d07('0x9'));var _=require(_0x1d07('0xa'));var squel=require(_0x1d07('0xb'));var crypto=require(_0x1d07('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1d07('0xd'));var toCsv=require(_0x1d07('0x7'));var querystring=require('querystring');var Papa=require(_0x1d07('0xe'));var Redis=require('ioredis');var authService=require(_0x1d07('0xf'));var qs=require(_0x1d07('0x10'));var as=require(_0x1d07('0x11'));var hardwareService=require(_0x1d07('0x12'));var logger=require('../../config/logger')(_0x1d07('0x13'));var utils=require(_0x1d07('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1d07('0x15'));var db=require(_0x1d07('0x16'))['db'];var integrations=require(_0x1d07('0x17'));function respondWithStatusCode(_0x9a8c93,_0x1bddb9){_0x1bddb9=_0x1bddb9||0xcc;return function(_0x39358f){if(_0x39358f){return _0x9a8c93[_0x1d07('0x18')](_0x1bddb9);}return _0x9a8c93[_0x1d07('0x19')](_0x1bddb9)[_0x1d07('0x1a')]();};}function respondWithResult(_0x53ccf8,_0x18f6c4){_0x18f6c4=_0x18f6c4||0xc8;return function(_0x13384e){if(_0x13384e){return _0x53ccf8[_0x1d07('0x19')](_0x18f6c4)['json'](_0x13384e);}};}function respondWithFilteredResult(_0x1d0db6,_0x140116){return function(_0x56bffd){if(_0x56bffd){var _0x22da23=typeof _0x140116[_0x1d07('0x1b')]===_0x1d07('0x1c')&&typeof _0x140116[_0x1d07('0x1d')]===_0x1d07('0x1c');var _0x44d948=_0x56bffd['count'];var _0x439233=_0x22da23?0x0:_0x140116[_0x1d07('0x1b')];var _0x49f8e6=_0x22da23?_0x56bffd[_0x1d07('0x1e')]:_0x140116[_0x1d07('0x1b')]+_0x140116[_0x1d07('0x1d')];var _0x5f05ea;if(_0x49f8e6>=_0x44d948){_0x49f8e6=_0x44d948;_0x5f05ea=0xc8;}else{_0x5f05ea=0xce;}_0x1d0db6[_0x1d07('0x19')](_0x5f05ea);return _0x1d0db6[_0x1d07('0x1f')](_0x1d07('0x20'),_0x439233+'-'+_0x49f8e6+'/'+_0x44d948)[_0x1d07('0x21')](_0x56bffd);}return null;};}function patchUpdates(_0x230aba){return function(_0xa174bb){try{jsonpatch[_0x1d07('0x22')](_0xa174bb,_0x230aba,!![]);}catch(_0x2df087){return BPromise[_0x1d07('0x23')](_0x2df087);}return _0xa174bb['save']();};}function saveUpdates(_0x3ca9e2,_0x239747){return function(_0x5780ce){if(_0x5780ce){return _0x5780ce[_0x1d07('0x24')](_0x3ca9e2)[_0x1d07('0x25')](function(_0x15c8d8){return _0x15c8d8;});}return null;};}function removeEntity(_0xef1417,_0x40a5a0){return function(_0x47d2ab){if(_0x47d2ab){return _0x47d2ab['destroy']()[_0x1d07('0x25')](function(){_0xef1417[_0x1d07('0x19')](0xcc)[_0x1d07('0x1a')]();});}};}function handleEntityNotFound(_0x597489,_0x2cbec4){return function(_0x5a532d){if(!_0x5a532d){_0x597489[_0x1d07('0x18')](0x194);}return _0x5a532d;};}function handleError(_0xafdc0d,_0x513b53){_0x513b53=_0x513b53||0x1f4;return function(_0x469e0d){logger[_0x1d07('0x26')](_0x469e0d[_0x1d07('0x27')]);if(_0x469e0d[_0x1d07('0x28')]){delete _0x469e0d[_0x1d07('0x28')];}_0xafdc0d[_0x1d07('0x19')](_0x513b53)[_0x1d07('0x29')](_0x469e0d);};}exports[_0x1d07('0x2a')]=function(_0x359624,_0x4dea8a){var _0x1fac80={},_0x3c554f={},_0x4dda77={'count':0x0,'rows':[]};var _0x433cd1=_[_0x1d07('0x2b')](db[_0x1d07('0x2c')]['rawAttributes'],function(_0x4d1537){return{'name':_0x4d1537[_0x1d07('0x2d')],'type':_0x4d1537['type'][_0x1d07('0x2e')]};});_0x3c554f[_0x1d07('0x2f')]=_[_0x1d07('0x2b')](_0x433cd1,_0x1d07('0x28'));_0x3c554f[_0x1d07('0x30')]=_[_0x1d07('0x31')](_0x359624[_0x1d07('0x30')]);_0x3c554f[_0x1d07('0x32')]=_[_0x1d07('0x33')](_0x3c554f['model'],_0x3c554f['query']);_0x1fac80[_0x1d07('0x34')]=_[_0x1d07('0x33')](_0x3c554f[_0x1d07('0x2f')],qs[_0x1d07('0x35')](_0x359624['query'][_0x1d07('0x35')]));_0x1fac80[_0x1d07('0x34')]=_0x1fac80[_0x1d07('0x34')]['length']?_0x1fac80[_0x1d07('0x34')]:_0x3c554f[_0x1d07('0x2f')];if(!_0x359624[_0x1d07('0x30')][_0x1d07('0x36')](_0x1d07('0x37'))){_0x1fac80[_0x1d07('0x1d')]=qs[_0x1d07('0x1d')](_0x359624[_0x1d07('0x30')][_0x1d07('0x1d')]);_0x1fac80['offset']=qs[_0x1d07('0x1b')](_0x359624[_0x1d07('0x30')][_0x1d07('0x1b')]);}_0x1fac80['order']=qs[_0x1d07('0x38')](_0x359624[_0x1d07('0x30')][_0x1d07('0x38')]);_0x1fac80[_0x1d07('0x39')]=qs['filters'](_['pick'](_0x359624[_0x1d07('0x30')],_0x3c554f[_0x1d07('0x32')]),_0x433cd1);if(_0x359624[_0x1d07('0x30')][_0x1d07('0x3a')]){_0x1fac80['where']=_[_0x1d07('0x3b')](_0x1fac80[_0x1d07('0x39')],{'$or':_[_0x1d07('0x2b')](_0x433cd1,function(_0x249d83){if(_0x249d83['type']!==_0x1d07('0x3c')){var _0x25121a={};_0x25121a[_0x249d83[_0x1d07('0x28')]]={'$like':'%'+_0x359624[_0x1d07('0x30')][_0x1d07('0x3a')]+'%'};return _0x25121a;}})});}_0x1fac80=_[_0x1d07('0x3b')]({},_0x1fac80,_0x359624['options']);var _0x1ff23e={'where':_0x1fac80[_0x1d07('0x39')]};return db[_0x1d07('0x2c')][_0x1d07('0x1e')](_0x1ff23e)['then'](function(_0x1e88bb){_0x4dda77[_0x1d07('0x1e')]=_0x1e88bb;if(_0x359624[_0x1d07('0x30')]['includeAll']){_0x1fac80[_0x1d07('0x3d')]=[{'all':!![]}];}return db[_0x1d07('0x2c')]['findAll'](_0x1fac80);})[_0x1d07('0x25')](function(_0x5aaca2){_0x4dda77['rows']=_0x5aaca2;return _0x4dda77;})[_0x1d07('0x25')](respondWithFilteredResult(_0x4dea8a,_0x1fac80))[_0x1d07('0x3e')](handleError(_0x4dea8a,null));};exports['show']=function(_0x2bf9c3,_0x3157a5){var _0x590e1a={'raw':![],'where':{'id':_0x2bf9c3[_0x1d07('0x3f')]['id']}},_0x5a059d={};_0x5a059d[_0x1d07('0x2f')]=_[_0x1d07('0x31')](db[_0x1d07('0x2c')][_0x1d07('0x40')]);_0x5a059d[_0x1d07('0x30')]=_[_0x1d07('0x31')](_0x2bf9c3['query']);_0x5a059d[_0x1d07('0x32')]=_[_0x1d07('0x33')](_0x5a059d[_0x1d07('0x2f')],_0x5a059d['query']);_0x590e1a[_0x1d07('0x34')]=_[_0x1d07('0x33')](_0x5a059d[_0x1d07('0x2f')],qs['fields'](_0x2bf9c3[_0x1d07('0x30')][_0x1d07('0x35')]));_0x590e1a[_0x1d07('0x34')]=_0x590e1a['attributes'][_0x1d07('0x41')]?_0x590e1a[_0x1d07('0x34')]:_0x5a059d[_0x1d07('0x2f')];if(_0x2bf9c3['query']['includeAll']){_0x590e1a[_0x1d07('0x3d')]=[{'all':!![]}];}_0x590e1a=_[_0x1d07('0x3b')]({},_0x590e1a,_0x2bf9c3[_0x1d07('0x42')]);return db[_0x1d07('0x2c')][_0x1d07('0x43')](_0x590e1a)[_0x1d07('0x25')](handleEntityNotFound(_0x3157a5,null))[_0x1d07('0x25')](respondWithResult(_0x3157a5,null))[_0x1d07('0x3e')](handleError(_0x3157a5,null));};exports[_0x1d07('0x44')]=function(_0x26e6cc,_0x2869d4){return db[_0x1d07('0x2c')]['create'](_0x26e6cc['body'],{})[_0x1d07('0x25')](respondWithResult(_0x2869d4,0xc9))[_0x1d07('0x3e')](handleError(_0x2869d4,null));};exports[_0x1d07('0x24')]=function(_0x42e75e,_0x2c5c04){if(_0x42e75e[_0x1d07('0x45')]['id']){delete _0x42e75e[_0x1d07('0x45')]['id'];}return db[_0x1d07('0x2c')][_0x1d07('0x43')]({'where':{'id':_0x42e75e[_0x1d07('0x3f')]['id']}})[_0x1d07('0x25')](handleEntityNotFound(_0x2c5c04,null))[_0x1d07('0x25')](saveUpdates(_0x42e75e[_0x1d07('0x45')],null))[_0x1d07('0x25')](respondWithResult(_0x2c5c04,null))[_0x1d07('0x3e')](handleError(_0x2c5c04,null));};exports[_0x1d07('0x46')]=function(_0x45f8b7,_0x41af68){return db[_0x1d07('0x2c')][_0x1d07('0x43')]({'where':{'id':_0x45f8b7[_0x1d07('0x3f')]['id']}})[_0x1d07('0x25')](handleEntityNotFound(_0x41af68,null))[_0x1d07('0x25')](removeEntity(_0x41af68,null))['catch'](handleError(_0x41af68,null));};exports[_0x1d07('0x47')]=function(_0x13f386,_0x3b3181,_0x54669a){var _0x41460d={};var _0x5cb04e={};var _0x600dc9;var _0x5236df;return db[_0x1d07('0x2c')]['findOne']({'where':{'id':_0x13f386[_0x1d07('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3b3181,null))[_0x1d07('0x25')](function(_0x479569){if(_0x479569){_0x600dc9=_0x479569;_0x5cb04e[_0x1d07('0x2f')]=_['keys'](db[_0x1d07('0x48')]['rawAttributes']);_0x5cb04e[_0x1d07('0x30')]=_[_0x1d07('0x31')](_0x13f386[_0x1d07('0x30')]);_0x5cb04e[_0x1d07('0x32')]=_['intersection'](_0x5cb04e[_0x1d07('0x2f')],_0x5cb04e['query']);_0x41460d[_0x1d07('0x34')]=_['intersection'](_0x5cb04e[_0x1d07('0x2f')],qs[_0x1d07('0x35')](_0x13f386[_0x1d07('0x30')][_0x1d07('0x35')]));_0x41460d[_0x1d07('0x34')]=_0x41460d[_0x1d07('0x34')]['length']?_0x41460d[_0x1d07('0x34')]:_0x5cb04e[_0x1d07('0x2f')];_0x41460d['order']=qs[_0x1d07('0x38')](_0x13f386[_0x1d07('0x30')][_0x1d07('0x38')]);_0x41460d[_0x1d07('0x39')]=qs[_0x1d07('0x32')](_[_0x1d07('0x49')](_0x13f386['query'],_0x5cb04e['filters']));if(_0x13f386[_0x1d07('0x30')][_0x1d07('0x3a')]){_0x41460d[_0x1d07('0x39')]=_[_0x1d07('0x3b')](_0x41460d[_0x1d07('0x39')],{'$or':_[_0x1d07('0x2b')](_0x41460d[_0x1d07('0x34')],function(_0x3486da){var _0x5aea60={};_0x5aea60[_0x3486da]={'$like':'%'+_0x13f386[_0x1d07('0x30')][_0x1d07('0x3a')]+'%'};return _0x5aea60;})});}_0x41460d=_[_0x1d07('0x3b')]({},_0x41460d,_0x13f386[_0x1d07('0x42')]);return _0x600dc9[_0x1d07('0x47')](_0x41460d);}})[_0x1d07('0x25')](function(_0x301484){if(_0x301484){_0x5236df=_0x301484[_0x1d07('0x41')];if(!_0x13f386[_0x1d07('0x30')][_0x1d07('0x36')](_0x1d07('0x37'))){_0x41460d[_0x1d07('0x1d')]=qs[_0x1d07('0x1d')](_0x13f386[_0x1d07('0x30')][_0x1d07('0x1d')]);_0x41460d[_0x1d07('0x1b')]=qs[_0x1d07('0x1b')](_0x13f386[_0x1d07('0x30')][_0x1d07('0x1b')]);}return _0x600dc9[_0x1d07('0x47')](_0x41460d);}})[_0x1d07('0x25')](function(_0x16331f){if(_0x16331f){return _0x16331f?{'count':_0x5236df,'rows':_0x16331f}:null;}})[_0x1d07('0x25')](respondWithResult(_0x3b3181,null))[_0x1d07('0x3e')](handleError(_0x3b3181,null));};exports[_0x1d07('0x4a')]=function(_0x53e27d,_0x96e6da,_0x205135){if(_0x53e27d[_0x1d07('0x45')]['id']){delete _0x53e27d[_0x1d07('0x45')]['id'];}return db['ServicenowAccount'][_0x1d07('0x4b')]({'where':{'id':_0x53e27d['params']['id']}})[_0x1d07('0x25')](handleEntityNotFound(_0x96e6da,null))[_0x1d07('0x25')](function(_0x270341){if(_0x270341){_0x53e27d[_0x1d07('0x45')]['AccountId']=_0x270341['id'];_0x53e27d[_0x1d07('0x45')]['Subjects']=integrations[_0x1d07('0x4c')](_0x53e27d[_0x1d07('0x45')]['channel'],_0x53e27d[_0x1d07('0x45')]['type']);_0x53e27d['body'][_0x1d07('0x4d')]=integrations[_0x1d07('0x4e')](_0x53e27d[_0x1d07('0x45')]['channel'],_0x53e27d[_0x1d07('0x45')][_0x1d07('0x4f')]);return db[_0x1d07('0x48')]['create'](_0x53e27d[_0x1d07('0x45')],{'include':[{'model':db[_0x1d07('0x50')],'as':_0x1d07('0x51')},{'model':db[_0x1d07('0x50')],'as':_0x1d07('0x4d')}]});}return null;})[_0x1d07('0x25')](respondWithResult(_0x96e6da,null))['catch'](handleError(_0x96e6da,null));};exports[_0x1d07('0x52')]=function(_0x1a135e,_0x40e7e4,_0x4e63d6){var _0x329f49=[_0x1d07('0x53'),'hold_reason',_0x1d07('0x54'),_0x1d07('0x55'),_0x1d07('0x56'),'notify',_0x1d07('0x57'),_0x1d07('0x58'),'category'];var _0xb06861=[_0x1d07('0x59'),_0x1d07('0x53'),_0x1d07('0x5a'),_0x1d07('0x5b'),_0x1d07('0x5c'),'sys_updated_on','child_incidents','hold_reason',_0x1d07('0x5d'),_0x1d07('0x5e'),_0x1d07('0x5f'),_0x1d07('0x60'),_0x1d07('0x61'),_0x1d07('0x62'),'sys_created_on',_0x1d07('0x63'),_0x1d07('0x64'),_0x1d07('0x65'),_0x1d07('0x54'),_0x1d07('0x66'),'calendar_stc','closed_at',_0x1d07('0x67'),_0x1d07('0x68'),'impact',_0x1d07('0x69'),_0x1d07('0x6a'),_0x1d07('0x6b'),_0x1d07('0x6c'),_0x1d07('0x6d'),_0x1d07('0x6e'),_0x1d07('0x6f'),_0x1d07('0x70'),_0x1d07('0x71'),'business_duration',_0x1d07('0x72'),'work_end','reopened_time',_0x1d07('0x73'),'caller_id',_0x1d07('0x74'),_0x1d07('0x55'),_0x1d07('0x75'),'short_description',_0x1d07('0x56'),_0x1d07('0x76'),'delivery_task','work_start',_0x1d07('0x77'),_0x1d07('0x78'),_0x1d07('0x79'),'description',_0x1d07('0x7a'),_0x1d07('0x7b'),_0x1d07('0x7c'),_0x1d07('0x7d'),_0x1d07('0x7e'),_0x1d07('0x7f'),_0x1d07('0x80'),_0x1d07('0x81'),_0x1d07('0x82'),_0x1d07('0x83'),_0x1d07('0x57'),_0x1d07('0x84'),_0x1d07('0x85'),_0x1d07('0x86'),_0x1d07('0x87'),_0x1d07('0x88'),'assigned_to',_0x1d07('0x58'),_0x1d07('0x89'),_0x1d07('0x8a'),_0x1d07('0x8b'),_0x1d07('0x8c'),_0x1d07('0x8d'),_0x1d07('0x8e'),_0x1d07('0x8f'),_0x1d07('0x90'),_0x1d07('0x91'),_0x1d07('0x92'),_0x1d07('0x93'),_0x1d07('0x94'),_0x1d07('0x95')];var _0x34c96d='';var _0x3cc9b8='';var _0x196bd4=[];var _0x25e4b6='';var _0x31f268='';var _0x4fce37=[];var _0x527cf1='';var _0x226402='';var _0x35c1c7={};var _0x1d7ef5='';return db[_0x1d07('0x2c')][_0x1d07('0x4b')]({'where':{'id':_0x1a135e['params']['id']},'attributes':['id','username',_0x1d07('0x96'),_0x1d07('0x97'),_0x1d07('0x98'),_0x1d07('0x99')]})['then'](handleEntityNotFound(_0x40e7e4,null))[_0x1d07('0x25')](function(_0x575edd){if(_0x575edd){_0x1d7ef5=_0x575edd[_0x1d07('0x98')];var _0x3db7f4=_0x1d7ef5[_0x1d07('0x9a')](-0x1);if(_0x3db7f4==='/'){_0x1d7ef5=_0x1d7ef5[_0x1d07('0x9b')](0x0,_0x1d7ef5[_0x1d07('0x9c')](_0x3db7f4));}_0x226402=util[_0x1d07('0x9d')](_0x1d07('0x9e'),_0x1d7ef5);_0x527cf1=util[_0x1d07('0x9d')](_0x1d07('0x9f'),_0x1d7ef5);_0x35c1c7={'user':_0x575edd['username'],'pass':_0x575edd[_0x1d07('0x96')]};var _0x1517c1={'method':_0x1d07('0xa0'),'uri':_0x226402+'incident?sysparm_display_value=all','auth':_0x35c1c7,'json':!![]};return rp(_0x1517c1);}})['then'](function(_0x187f32){if(_0x187f32[_0x1d07('0xa1')][_0x1d07('0x41')]>0x0){_0x34c96d=_0x187f32['result'];}console[_0x1d07('0xa2')]('incident\x20table\x20objects',_0x34c96d);_0x4fce37=[];_0x3cc9b8=Object[_0x1d07('0xa3')]([],_0x34c96d);_['remove'](_0x3cc9b8,function(_0x451c94){return!_0x329f49[_0x1d07('0xa4')](_0x451c94[_0x1d07('0x28')]);});_0x3cc9b8[_0x1d07('0xa5')](function(_0x593764){var _0x39cb44=createFieldObject(_0x527cf1,_0x35c1c7,_0x593764[_0x1d07('0xa6')],_0x593764[_0x1d07('0x28')],_0x593764[_0x1d07('0xa7')],![]);_0x4fce37['push'](_0x39cb44);});return Promise[_0x1d07('0xa8')](_0x4fce37);})[_0x1d07('0x25')](function(_0xf90cb8){_0x196bd4=_0xf90cb8;_0x25e4b6=Object[_0x1d07('0xa3')]([],_0x34c96d);console['log'](_0x1d07('0xa9'),_0x34c96d);_[_0x1d07('0xaa')](_0x25e4b6,function(_0x25ac74){return _0xb06861['includes'](_0x25ac74[_0x1d07('0x28')]);});console[_0x1d07('0xa2')](_0x1d07('0xab'),_0x25e4b6);_0x4fce37=[];_0x25e4b6[_0x1d07('0xa5')](function(_0x4854ed){var _0x1933c7=createFieldObject(_0x527cf1,_0x35c1c7,_0x4854ed[_0x1d07('0xa6')],_0x4854ed[_0x1d07('0x28')],_0x4854ed[_0x1d07('0xa7')],!![]);_0x4fce37['push'](_0x1933c7);});return Promise['all'](_0x4fce37);})[_0x1d07('0x25')](function(_0x486346){_0x31f268=_0x486346;var _0x14bdb4=_0x196bd4[_0x1d07('0xac')](_0x31f268);return{'count':_0x14bdb4['length'],'rows':_0x14bdb4};})[_0x1d07('0x25')](respondWithResult(_0x40e7e4,null))[_0x1d07('0x3e')](function(_0x689da3){console[_0x1d07('0xa2')](_0x1d07('0xad')+_0x689da3);var _0x4f52a1=_0x1a135e['query']['test']?0x1f4:_0x689da3['statusCode']||0x1f4;logger[_0x1d07('0x26')](_0x689da3[_0x1d07('0x27')]);delete _0x689da3[_0x1d07('0x28')];if(_0x4f52a1===0x191){_0x4f52a1=0x190;}_0x40e7e4[_0x1d07('0x19')](_0x4f52a1)[_0x1d07('0x29')](_0x1a135e['query'][_0x1d07('0xae')]?{'message':_0x1d07('0xaf'),'statusCode':_0x689da3[_0x1d07('0xb0')]}:_0x689da3);});};function createFieldObject(_0x4b8207,_0x25f853,_0x439916,_0x5b2f73,_0x239299,_0x5c3ffe){return new Promise(function(_0x149804,_0x184087){var _0x56cc0b={'id':_0x5b2f73,'name':_0x239299,'custom':_0x5c3ffe};if(_0x439916===_0x1d07('0xb1')){_0x56cc0b['options']=[{'name':_0x1d07('0xb2'),'value':'true'},{'name':_0x1d07('0xb3'),'value':'false'}];_0x149804(_0x56cc0b);}else{var _0x3584f3={'method':'GET','uri':_0x4b8207+'sys_choice?sysparm_query=name=incident^element='+_0x5b2f73,'auth':_0x25f853,'json':!![]};return rp(_0x3584f3)[_0x1d07('0x25')](function(_0x57514d){var _0x535c8a=[];if(_0x57514d['result'][_0x1d07('0x41')]>0x0){_0x57514d[_0x1d07('0xa1')][_0x1d07('0xa5')](function(_0x2a3c42){if(_0x2a3c42[_0x1d07('0xb4')]==='false'){var _0x249209={'name':_0x2a3c42[_0x1d07('0xa7')],'value':_0x2a3c42['value']};_0x535c8a['push'](_0x249209);}});}_0x56cc0b[_0x1d07('0x42')]=_0x535c8a;if(_0x56cc0b[_0x1d07('0x42')][_0x1d07('0x41')]>0x0){_0x149804(_0x56cc0b);}else{if(_0x5c3ffe==![]){_0x149804();}else{_0x149804(_0x56cc0b);}}});}});} \ No newline at end of file +var _0xe472=['False','inactive','false','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','stack','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','params','intersection','find','create','body','catch','update','getConfigurations','findOne','ServicenowConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','delivery_plan','impact','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','GET','result','incident\x20table\x20objects','includes','name','internalType','label','push','all','assign','log','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','True','true'];(function(_0x36391b,_0x1961ec){var _0x2b1cec=function(_0x379623){while(--_0x379623){_0x36391b['push'](_0x36391b['shift']());}};_0x2b1cec(++_0x1961ec);}(_0xe472,0xc1));var _0x2e47=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe472[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x2e47('0x0'));var rimraf=require(_0x2e47('0x1'));var zipdir=require(_0x2e47('0x2'));var jsonpatch=require(_0x2e47('0x3'));var rp=require(_0x2e47('0x4'));var moment=require(_0x2e47('0x5'));var BPromise=require(_0x2e47('0x6'));var Mustache=require(_0x2e47('0x7'));var util=require(_0x2e47('0x8'));var path=require(_0x2e47('0x9'));var sox=require(_0x2e47('0xa'));var csv=require(_0x2e47('0xb'));var ejs=require(_0x2e47('0xc'));var fs=require('fs');var fs_extra=require(_0x2e47('0xd'));var _=require(_0x2e47('0xe'));var squel=require(_0x2e47('0xf'));var crypto=require(_0x2e47('0x10'));var jsforce=require(_0x2e47('0x11'));var deskjs=require(_0x2e47('0x12'));var toCsv=require('to-csv');var querystring=require(_0x2e47('0x13'));var Papa=require(_0x2e47('0x14'));var Redis=require('ioredis');var authService=require(_0x2e47('0x15'));var qs=require(_0x2e47('0x16'));var as=require(_0x2e47('0x17'));var hardwareService=require(_0x2e47('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x2e47('0x19'));var config=require(_0x2e47('0x1a'));var licenseUtil=require(_0x2e47('0x1b'));var db=require(_0x2e47('0x1c'))['db'];var integrations=require(_0x2e47('0x1d'));function respondWithStatusCode(_0x3375d7,_0x37c709){_0x37c709=_0x37c709||0xcc;return function(_0x5ee878){if(_0x5ee878){return _0x3375d7[_0x2e47('0x1e')](_0x37c709);}return _0x3375d7[_0x2e47('0x1f')](_0x37c709)[_0x2e47('0x20')]();};}function respondWithResult(_0x4a52f3,_0x63770e){_0x63770e=_0x63770e||0xc8;return function(_0x40db18){if(_0x40db18){return _0x4a52f3[_0x2e47('0x1f')](_0x63770e)[_0x2e47('0x21')](_0x40db18);}};}function respondWithFilteredResult(_0x3eb216,_0x217113){return function(_0x47dd32){if(_0x47dd32){var _0x3ec0aa=typeof _0x217113[_0x2e47('0x22')]==='undefined'&&typeof _0x217113['limit']===_0x2e47('0x23');var _0x50103f=_0x47dd32[_0x2e47('0x24')];var _0x594f6c=_0x3ec0aa?0x0:_0x217113[_0x2e47('0x22')];var _0x36da56=_0x3ec0aa?_0x47dd32['count']:_0x217113[_0x2e47('0x22')]+_0x217113[_0x2e47('0x25')];var _0x5aec61;if(_0x36da56>=_0x50103f){_0x36da56=_0x50103f;_0x5aec61=0xc8;}else{_0x5aec61=0xce;}_0x3eb216[_0x2e47('0x1f')](_0x5aec61);return _0x3eb216[_0x2e47('0x26')]('Content-Range',_0x594f6c+'-'+_0x36da56+'/'+_0x50103f)[_0x2e47('0x21')](_0x47dd32);}return null;};}function patchUpdates(_0x10cf44){return function(_0x199e50){try{jsonpatch[_0x2e47('0x27')](_0x199e50,_0x10cf44,!![]);}catch(_0x37c26e){return BPromise[_0x2e47('0x28')](_0x37c26e);}return _0x199e50[_0x2e47('0x29')]();};}function saveUpdates(_0x578efe,_0x2050d7){return function(_0x42653d){if(_0x42653d){return _0x42653d['update'](_0x578efe)[_0x2e47('0x2a')](function(_0x4ae24d){return _0x4ae24d;});}return null;};}function removeEntity(_0x3a3a4c,_0x82fc37){return function(_0x1f662f){if(_0x1f662f){return _0x1f662f[_0x2e47('0x2b')]()[_0x2e47('0x2a')](function(){_0x3a3a4c[_0x2e47('0x1f')](0xcc)[_0x2e47('0x20')]();});}};}function handleEntityNotFound(_0x2fa7ec,_0x1479e0){return function(_0x5b7959){if(!_0x5b7959){_0x2fa7ec[_0x2e47('0x1e')](0x194);}return _0x5b7959;};}function handleError(_0x5a6d33,_0x5e03ef){_0x5e03ef=_0x5e03ef||0x1f4;return function(_0x4539d5){logger[_0x2e47('0x2c')](_0x4539d5[_0x2e47('0x2d')]);if(_0x4539d5['name']){delete _0x4539d5['name'];}_0x5a6d33[_0x2e47('0x1f')](_0x5e03ef)[_0x2e47('0x2e')](_0x4539d5);};}exports[_0x2e47('0x2f')]=function(_0x9e4103,_0x11d2aa){var _0xc72e6d={},_0x4144a5={},_0x27c4cb={'count':0x0,'rows':[]};var _0x81eaee=_[_0x2e47('0x30')](db[_0x2e47('0x31')][_0x2e47('0x32')],function(_0x47e5e4){return{'name':_0x47e5e4[_0x2e47('0x33')],'type':_0x47e5e4[_0x2e47('0x34')]['key']};});_0x4144a5[_0x2e47('0x35')]=_[_0x2e47('0x30')](_0x81eaee,'name');_0x4144a5[_0x2e47('0x36')]=_[_0x2e47('0x37')](_0x9e4103[_0x2e47('0x36')]);_0x4144a5['filters']=_['intersection'](_0x4144a5[_0x2e47('0x35')],_0x4144a5['query']);_0xc72e6d[_0x2e47('0x38')]=_['intersection'](_0x4144a5[_0x2e47('0x35')],qs[_0x2e47('0x39')](_0x9e4103[_0x2e47('0x36')][_0x2e47('0x39')]));_0xc72e6d[_0x2e47('0x38')]=_0xc72e6d['attributes'][_0x2e47('0x3a')]?_0xc72e6d[_0x2e47('0x38')]:_0x4144a5[_0x2e47('0x35')];if(!_0x9e4103[_0x2e47('0x36')][_0x2e47('0x3b')](_0x2e47('0x3c'))){_0xc72e6d[_0x2e47('0x25')]=qs[_0x2e47('0x25')](_0x9e4103[_0x2e47('0x36')]['limit']);_0xc72e6d[_0x2e47('0x22')]=qs[_0x2e47('0x22')](_0x9e4103[_0x2e47('0x36')][_0x2e47('0x22')]);}_0xc72e6d[_0x2e47('0x3d')]=qs[_0x2e47('0x3e')](_0x9e4103['query']['sort']);_0xc72e6d[_0x2e47('0x3f')]=qs[_0x2e47('0x40')](_['pick'](_0x9e4103[_0x2e47('0x36')],_0x4144a5[_0x2e47('0x40')]),_0x81eaee);if(_0x9e4103[_0x2e47('0x36')][_0x2e47('0x41')]){_0xc72e6d[_0x2e47('0x3f')]=_['merge'](_0xc72e6d[_0x2e47('0x3f')],{'$or':_[_0x2e47('0x30')](_0x81eaee,function(_0x26db18){if(_0x26db18[_0x2e47('0x34')]!==_0x2e47('0x42')){var _0x3d2c99={};_0x3d2c99[_0x26db18['name']]={'$like':'%'+_0x9e4103[_0x2e47('0x36')][_0x2e47('0x41')]+'%'};return _0x3d2c99;}})});}_0xc72e6d=_[_0x2e47('0x43')]({},_0xc72e6d,_0x9e4103[_0x2e47('0x44')]);var _0x148b75={'where':_0xc72e6d['where']};return db[_0x2e47('0x31')][_0x2e47('0x24')](_0x148b75)[_0x2e47('0x2a')](function(_0x317cd2){_0x27c4cb[_0x2e47('0x24')]=_0x317cd2;if(_0x9e4103['query'][_0x2e47('0x45')]){_0xc72e6d[_0x2e47('0x46')]=[{'all':!![]}];}return db[_0x2e47('0x31')]['findAll'](_0xc72e6d);})[_0x2e47('0x2a')](function(_0x17398b){_0x27c4cb[_0x2e47('0x47')]=_0x17398b;return _0x27c4cb;})['then'](respondWithFilteredResult(_0x11d2aa,_0xc72e6d))['catch'](handleError(_0x11d2aa,null));};exports['show']=function(_0x3d1289,_0x156978){var _0x5e8795={'raw':![],'where':{'id':_0x3d1289[_0x2e47('0x48')]['id']}},_0x3a6133={};_0x3a6133[_0x2e47('0x35')]=_[_0x2e47('0x37')](db[_0x2e47('0x31')][_0x2e47('0x32')]);_0x3a6133[_0x2e47('0x36')]=_[_0x2e47('0x37')](_0x3d1289[_0x2e47('0x36')]);_0x3a6133[_0x2e47('0x40')]=_[_0x2e47('0x49')](_0x3a6133[_0x2e47('0x35')],_0x3a6133[_0x2e47('0x36')]);_0x5e8795[_0x2e47('0x38')]=_['intersection'](_0x3a6133[_0x2e47('0x35')],qs[_0x2e47('0x39')](_0x3d1289[_0x2e47('0x36')][_0x2e47('0x39')]));_0x5e8795[_0x2e47('0x38')]=_0x5e8795[_0x2e47('0x38')][_0x2e47('0x3a')]?_0x5e8795[_0x2e47('0x38')]:_0x3a6133['model'];if(_0x3d1289[_0x2e47('0x36')][_0x2e47('0x45')]){_0x5e8795['include']=[{'all':!![]}];}_0x5e8795=_[_0x2e47('0x43')]({},_0x5e8795,_0x3d1289[_0x2e47('0x44')]);return db[_0x2e47('0x31')][_0x2e47('0x4a')](_0x5e8795)[_0x2e47('0x2a')](handleEntityNotFound(_0x156978,null))['then'](respondWithResult(_0x156978,null))['catch'](handleError(_0x156978,null));};exports[_0x2e47('0x4b')]=function(_0x176af8,_0x51c60f){return db['ServicenowAccount'][_0x2e47('0x4b')](_0x176af8[_0x2e47('0x4c')],{})[_0x2e47('0x2a')](respondWithResult(_0x51c60f,0xc9))[_0x2e47('0x4d')](handleError(_0x51c60f,null));};exports[_0x2e47('0x4e')]=function(_0x23ecfd,_0x3c4101){if(_0x23ecfd['body']['id']){delete _0x23ecfd['body']['id'];}return db[_0x2e47('0x31')][_0x2e47('0x4a')]({'where':{'id':_0x23ecfd[_0x2e47('0x48')]['id']}})[_0x2e47('0x2a')](handleEntityNotFound(_0x3c4101,null))[_0x2e47('0x2a')](saveUpdates(_0x23ecfd['body'],null))[_0x2e47('0x2a')](respondWithResult(_0x3c4101,null))[_0x2e47('0x4d')](handleError(_0x3c4101,null));};exports[_0x2e47('0x2b')]=function(_0x368c04,_0x2aad68){return db[_0x2e47('0x31')][_0x2e47('0x4a')]({'where':{'id':_0x368c04[_0x2e47('0x48')]['id']}})[_0x2e47('0x2a')](handleEntityNotFound(_0x2aad68,null))['then'](removeEntity(_0x2aad68,null))['catch'](handleError(_0x2aad68,null));};exports[_0x2e47('0x4f')]=function(_0x19d018,_0x59a5a7,_0x60852e){var _0x1b8a1c={};var _0x393f2f={};var _0x2c9e09;var _0x2f3a14;return db['ServicenowAccount'][_0x2e47('0x50')]({'where':{'id':_0x19d018[_0x2e47('0x48')]['id']}})[_0x2e47('0x2a')](handleEntityNotFound(_0x59a5a7,null))[_0x2e47('0x2a')](function(_0x64a3fb){if(_0x64a3fb){_0x2c9e09=_0x64a3fb;_0x393f2f['model']=_[_0x2e47('0x37')](db[_0x2e47('0x51')][_0x2e47('0x32')]);_0x393f2f[_0x2e47('0x36')]=_[_0x2e47('0x37')](_0x19d018[_0x2e47('0x36')]);_0x393f2f['filters']=_[_0x2e47('0x49')](_0x393f2f[_0x2e47('0x35')],_0x393f2f[_0x2e47('0x36')]);_0x1b8a1c[_0x2e47('0x38')]=_[_0x2e47('0x49')](_0x393f2f[_0x2e47('0x35')],qs[_0x2e47('0x39')](_0x19d018[_0x2e47('0x36')][_0x2e47('0x39')]));_0x1b8a1c['attributes']=_0x1b8a1c[_0x2e47('0x38')]['length']?_0x1b8a1c[_0x2e47('0x38')]:_0x393f2f[_0x2e47('0x35')];_0x1b8a1c['order']=qs['sort'](_0x19d018[_0x2e47('0x36')][_0x2e47('0x3e')]);_0x1b8a1c[_0x2e47('0x3f')]=qs['filters'](_[_0x2e47('0x52')](_0x19d018[_0x2e47('0x36')],_0x393f2f['filters']));if(_0x19d018[_0x2e47('0x36')][_0x2e47('0x41')]){_0x1b8a1c['where']=_[_0x2e47('0x43')](_0x1b8a1c['where'],{'$or':_['map'](_0x1b8a1c[_0x2e47('0x38')],function(_0x3f513a){var _0x267faf={};_0x267faf[_0x3f513a]={'$like':'%'+_0x19d018[_0x2e47('0x36')][_0x2e47('0x41')]+'%'};return _0x267faf;})});}_0x1b8a1c=_[_0x2e47('0x43')]({},_0x1b8a1c,_0x19d018[_0x2e47('0x44')]);return _0x2c9e09['getConfigurations'](_0x1b8a1c);}})[_0x2e47('0x2a')](function(_0x5d1e19){if(_0x5d1e19){_0x2f3a14=_0x5d1e19[_0x2e47('0x3a')];if(!_0x19d018[_0x2e47('0x36')]['hasOwnProperty'](_0x2e47('0x3c'))){_0x1b8a1c[_0x2e47('0x25')]=qs[_0x2e47('0x25')](_0x19d018[_0x2e47('0x36')][_0x2e47('0x25')]);_0x1b8a1c[_0x2e47('0x22')]=qs[_0x2e47('0x22')](_0x19d018['query'][_0x2e47('0x22')]);}return _0x2c9e09['getConfigurations'](_0x1b8a1c);}})[_0x2e47('0x2a')](function(_0x26efa6){if(_0x26efa6){return _0x26efa6?{'count':_0x2f3a14,'rows':_0x26efa6}:null;}})[_0x2e47('0x2a')](respondWithResult(_0x59a5a7,null))[_0x2e47('0x4d')](handleError(_0x59a5a7,null));};exports[_0x2e47('0x53')]=function(_0x3db7fe,_0x45c7ce,_0x257264){if(_0x3db7fe[_0x2e47('0x4c')]['id']){delete _0x3db7fe['body']['id'];}return db[_0x2e47('0x31')][_0x2e47('0x50')]({'where':{'id':_0x3db7fe[_0x2e47('0x48')]['id']}})['then'](handleEntityNotFound(_0x45c7ce,null))['then'](function(_0x29fc08){if(_0x29fc08){_0x3db7fe[_0x2e47('0x4c')][_0x2e47('0x54')]=_0x29fc08['id'];_0x3db7fe[_0x2e47('0x4c')][_0x2e47('0x55')]=integrations[_0x2e47('0x56')](_0x3db7fe[_0x2e47('0x4c')][_0x2e47('0x57')],_0x3db7fe[_0x2e47('0x4c')][_0x2e47('0x34')]);_0x3db7fe['body'][_0x2e47('0x58')]=integrations[_0x2e47('0x59')](_0x3db7fe[_0x2e47('0x4c')]['channel'],_0x3db7fe['body'][_0x2e47('0x34')]);return db[_0x2e47('0x51')][_0x2e47('0x4b')](_0x3db7fe[_0x2e47('0x4c')],{'include':[{'model':db['ServicenowField'],'as':_0x2e47('0x55')},{'model':db['ServicenowField'],'as':_0x2e47('0x58')}]});}return null;})['then'](respondWithResult(_0x45c7ce,null))[_0x2e47('0x4d')](handleError(_0x45c7ce,null));};exports[_0x2e47('0x5a')]=function(_0x571280,_0x3eeb84,_0x4b15e1){var _0x16c9fa=[_0x2e47('0x5b'),_0x2e47('0x5c'),_0x2e47('0x5d'),_0x2e47('0x5e'),_0x2e47('0x5f'),_0x2e47('0x60'),'incident_state',_0x2e47('0x61'),_0x2e47('0x62')];var _0x4e66ba=['parent',_0x2e47('0x5b'),_0x2e47('0x63'),_0x2e47('0x64'),_0x2e47('0x65'),_0x2e47('0x66'),_0x2e47('0x67'),_0x2e47('0x5c'),'approval_history','number',_0x2e47('0x68'),_0x2e47('0x69'),_0x2e47('0x6a'),_0x2e47('0x6b'),_0x2e47('0x6c'),_0x2e47('0x6d'),_0x2e47('0x6e'),'sys_created_by','knowledge',_0x2e47('0x3d'),_0x2e47('0x6f'),_0x2e47('0x70'),'cmdb_ci',_0x2e47('0x71'),_0x2e47('0x72'),'active','work_notes_list',_0x2e47('0x73'),_0x2e47('0x74'),_0x2e47('0x75'),_0x2e47('0x76'),_0x2e47('0x77'),'expected_start',_0x2e47('0x78'),_0x2e47('0x79'),_0x2e47('0x7a'),_0x2e47('0x7b'),_0x2e47('0x7c'),_0x2e47('0x7d'),_0x2e47('0x7e'),_0x2e47('0x7f'),_0x2e47('0x5e'),_0x2e47('0x80'),_0x2e47('0x81'),'close_code',_0x2e47('0x82'),_0x2e47('0x83'),_0x2e47('0x84'),_0x2e47('0x85'),_0x2e47('0x86'),'additional_assignee_list',_0x2e47('0x87'),_0x2e47('0x88'),'notify',_0x2e47('0x89'),_0x2e47('0x8a'),'closed_by',_0x2e47('0x8b'),_0x2e47('0x8c'),_0x2e47('0x8d'),_0x2e47('0x8e'),'reopened_by',_0x2e47('0x8f'),_0x2e47('0x90'),_0x2e47('0x91'),_0x2e47('0x92'),_0x2e47('0x93'),_0x2e47('0x94'),_0x2e47('0x95'),_0x2e47('0x61'),_0x2e47('0x96'),_0x2e47('0x97'),_0x2e47('0x98'),_0x2e47('0x99'),_0x2e47('0x9a'),_0x2e47('0x9b'),'reopen_count',_0x2e47('0x9c'),'escalation',_0x2e47('0x9d'),_0x2e47('0x9e'),'location',_0x2e47('0x62')];var _0x2bc469='';var _0x127588='';var _0x39b68f=[];var _0x292f30='';var _0x58ebb5='';var _0x2b1c2c=[];var _0xb10409='';var _0x22917b='';var _0x3e8770={};var _0xf54e04='';return db['ServicenowAccount'][_0x2e47('0x50')]({'where':{'id':_0x571280[_0x2e47('0x48')]['id']},'attributes':['id',_0x2e47('0x9f'),'password',_0x2e47('0xa0'),_0x2e47('0xa1'),_0x2e47('0xa2')]})['then'](handleEntityNotFound(_0x3eeb84,null))[_0x2e47('0x2a')](function(_0x52545e){if(_0x52545e){_0xf54e04=_0x52545e[_0x2e47('0xa1')];var _0x359e12=_0xf54e04[_0x2e47('0xa3')](-0x1);if(_0x359e12==='/'){_0xf54e04=_0xf54e04[_0x2e47('0xa4')](0x0,_0xf54e04[_0x2e47('0xa5')](_0x359e12));}_0x22917b=util['format'](_0x2e47('0xa6'),_0xf54e04);_0xb10409=util['format']('%s/api/now/table/',_0xf54e04);_0x3e8770={'user':_0x52545e['username'],'pass':_0x52545e['password']};var _0x2b8cba={'method':_0x2e47('0xa7'),'uri':_0x22917b+'incident?sysparm_display_value=all','auth':_0x3e8770,'json':!![]};return rp(_0x2b8cba);}})[_0x2e47('0x2a')](function(_0x31e1cf){if(_0x31e1cf[_0x2e47('0xa8')][_0x2e47('0x3a')]>0x0){_0x2bc469=_0x31e1cf[_0x2e47('0xa8')];}console['log'](_0x2e47('0xa9'),_0x2bc469);_0x2b1c2c=[];_0x127588=Object['assign']([],_0x2bc469);_['remove'](_0x127588,function(_0xfb3bc5){return!_0x16c9fa[_0x2e47('0xaa')](_0xfb3bc5[_0x2e47('0xab')]);});_0x127588['forEach'](function(_0x23e507){var _0xe840f4=createFieldObject(_0xb10409,_0x3e8770,_0x23e507[_0x2e47('0xac')],_0x23e507[_0x2e47('0xab')],_0x23e507[_0x2e47('0xad')],![]);_0x2b1c2c[_0x2e47('0xae')](_0xe840f4);});return Promise[_0x2e47('0xaf')](_0x2b1c2c);})[_0x2e47('0x2a')](function(_0x209692){_0x39b68f=_0x209692;_0x292f30=Object[_0x2e47('0xb0')]([],_0x2bc469);console[_0x2e47('0xb1')]('TCL:\x20_object',_0x2bc469);_[_0x2e47('0xb2')](_0x292f30,function(_0x2d4f9e){return _0x4e66ba[_0x2e47('0xaa')](_0x2d4f9e[_0x2e47('0xab')]);});console[_0x2e47('0xb1')](_0x2e47('0xb3'),_0x292f30);_0x2b1c2c=[];_0x292f30[_0x2e47('0xb4')](function(_0x1480c1){var _0x515707=createFieldObject(_0xb10409,_0x3e8770,_0x1480c1[_0x2e47('0xac')],_0x1480c1[_0x2e47('0xab')],_0x1480c1['label'],!![]);_0x2b1c2c['push'](_0x515707);});return Promise[_0x2e47('0xaf')](_0x2b1c2c);})[_0x2e47('0x2a')](function(_0x17e766){_0x58ebb5=_0x17e766;var _0x1f8d35=_0x39b68f[_0x2e47('0xb5')](_0x58ebb5);return{'count':_0x1f8d35[_0x2e47('0x3a')],'rows':_0x1f8d35};})[_0x2e47('0x2a')](respondWithResult(_0x3eeb84,null))[_0x2e47('0x4d')](function(_0x239b1f){console[_0x2e47('0xb1')](_0x2e47('0xb6')+_0x239b1f);var _0x20c905=_0x571280['query'][_0x2e47('0xb7')]?0x1f4:_0x239b1f[_0x2e47('0xb8')]||0x1f4;logger['error'](_0x239b1f[_0x2e47('0x2d')]);delete _0x239b1f[_0x2e47('0xab')];if(_0x20c905===0x191){_0x20c905=0x190;}_0x3eeb84[_0x2e47('0x1f')](_0x20c905)[_0x2e47('0x2e')](_0x571280['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x239b1f['statusCode']}:_0x239b1f);});};function createFieldObject(_0xfb1e56,_0x14690c,_0x356304,_0x3d7a2e,_0x2a57cb,_0x32ec18){return new Promise(function(_0x5c9e4a,_0x681d93){var _0x48e68e={'id':_0x3d7a2e,'name':_0x2a57cb,'custom':_0x32ec18};if(_0x356304==='boolean'){_0x48e68e[_0x2e47('0x44')]=[{'name':_0x2e47('0xb9'),'value':_0x2e47('0xba')},{'name':_0x2e47('0xbb'),'value':'false'}];_0x5c9e4a(_0x48e68e);}else{var _0x5c5d2e={'method':_0x2e47('0xa7'),'uri':_0xfb1e56+'sys_choice?sysparm_query=name=incident^element='+_0x3d7a2e,'auth':_0x14690c,'json':!![]};return rp(_0x5c5d2e)['then'](function(_0x49c4f2){var _0x414300=[];if(_0x49c4f2[_0x2e47('0xa8')][_0x2e47('0x3a')]>0x0){_0x49c4f2[_0x2e47('0xa8')]['forEach'](function(_0x1381ae){if(_0x1381ae[_0x2e47('0xbc')]===_0x2e47('0xbd')){var _0x4b5ef1={'name':_0x1381ae[_0x2e47('0xad')],'value':_0x1381ae['value']};_0x414300[_0x2e47('0xae')](_0x4b5ef1);}});}_0x48e68e['options']=_0x414300;if(_0x48e68e[_0x2e47('0x44')][_0x2e47('0x3a')]>0x0){_0x5c9e4a(_0x48e68e);}else{if(_0x32ec18==![]){_0x5c9e4a();}else{_0x5c9e4a(_0x48e68e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9d0bc38..97df628 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 _0x7da7=['../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7da7,0x10d));var _0x77da=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x7da7[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x77da('0x7'));module[_0x77da('0x8')]=function(_0x47da81,_0x30afe0){return _0x47da81['define'](_0x77da('0x9'),attributes,{'tableName':_0x77da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment'];(function(_0x374293,_0x57d310){var _0xf72f1=function(_0x5ca0f7){while(--_0x5ca0f7){_0x374293['push'](_0x374293['shift']());}};_0xf72f1(++_0x57d310);}(_0x46ed,0x168));var _0xd46e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x46ed[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));var integrations=require(_0xd46e('0x8'));module[_0xd46e('0x9')]=function(_0x25cf78,_0x45e680){return _0x25cf78[_0xd46e('0xa')](_0xd46e('0xb'),attributes,{'tableName':_0xd46e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 697f975..a17bdda 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 _0x7265=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','include','map','model','attributes','ShowServicenowAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7265,0x64));var _0x5726=function(_0x239c04,_0x14d5f6){_0x239c04=_0x239c04-0x0;var _0x1f212a=_0x7265[_0x239c04];return _0x1f212a;};'use strict';var _=require(_0x5726('0x0'));var util=require(_0x5726('0x1'));var moment=require(_0x5726('0x2'));var BPromise=require(_0x5726('0x3'));var rs=require(_0x5726('0x4'));var fs=require('fs');var Redis=require(_0x5726('0x5'));var db=require(_0x5726('0x6'))['db'];var utils=require(_0x5726('0x7'));var logger=require(_0x5726('0x8'))(_0x5726('0x9'));var config=require(_0x5726('0xa'));var jayson=require(_0x5726('0xb'));var client=jayson[_0x5726('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9eb87c,_0x32c3eb,_0x40807d){return new BPromise(function(_0x35bb64,_0x290387){return client[_0x5726('0xd')](_0x9eb87c,_0x40807d)[_0x5726('0xe')](function(_0x3fcf13){logger[_0x5726('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x32c3eb,_0x5726('0x10'));logger['debug'](_0x5726('0x11'),_0x32c3eb,_0x5726('0x10'),JSON[_0x5726('0x12')](_0x3fcf13));if(_0x3fcf13[_0x5726('0x13')]){if(_0x3fcf13[_0x5726('0x13')][_0x5726('0x14')]===0x1f4){logger[_0x5726('0x13')](_0x5726('0x15'),_0x32c3eb,_0x3fcf13[_0x5726('0x13')][_0x5726('0x16')]);return _0x290387(_0x3fcf13[_0x5726('0x13')][_0x5726('0x16')]);}logger[_0x5726('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x32c3eb,_0x3fcf13[_0x5726('0x13')][_0x5726('0x16')]);return _0x35bb64(_0x3fcf13['error'][_0x5726('0x16')]);}else{logger[_0x5726('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x32c3eb,_0x5726('0x10'));_0x35bb64(_0x3fcf13['result'][_0x5726('0x16')]);}})[_0x5726('0x17')](function(_0x45ef03){logger[_0x5726('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x32c3eb,_0x45ef03);_0x290387(_0x45ef03);});});}exports[_0x5726('0x18')]=function(_0x2b6c0d){var _0x4424cf=this;return new Promise(function(_0xa4be09,_0x501f49){return db[_0x5726('0x19')][_0x5726('0x1a')]({'raw':_0x2b6c0d['options']?_0x2b6c0d[_0x5726('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2b6c0d[_0x5726('0x1b')]?_0x2b6c0d['options']['where']||null:null,'attributes':_0x2b6c0d[_0x5726('0x1b')]?_0x2b6c0d['options']['attributes']||null:null,'limit':_0x2b6c0d[_0x5726('0x1b')]?_0x2b6c0d[_0x5726('0x1b')]['limit']||null:null,'include':_0x2b6c0d[_0x5726('0x1b')]?_0x2b6c0d[_0x5726('0x1b')][_0x5726('0x1c')]?_['map'](_0x2b6c0d[_0x5726('0x1b')][_0x5726('0x1c')],function(_0x34916b){return{'model':db[_0x34916b['model']],'as':_0x34916b['as'],'attributes':_0x34916b['attributes'],'include':_0x34916b[_0x5726('0x1c')]?_[_0x5726('0x1d')](_0x34916b[_0x5726('0x1c')],function(_0x453fed){return{'model':db[_0x453fed[_0x5726('0x1e')]],'as':_0x453fed['as'],'attributes':_0x453fed[_0x5726('0x1f')],'include':_0x453fed[_0x5726('0x1c')]?_[_0x5726('0x1d')](_0x453fed['include'],function(_0x32df71){return{'model':db[_0x32df71[_0x5726('0x1e')]],'as':_0x32df71['as'],'attributes':_0x32df71[_0x5726('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5726('0xe')](function(_0x4cc924){logger[_0x5726('0xf')](_0x5726('0x18'),_0x2b6c0d);logger['debug'](_0x5726('0x18'),_0x2b6c0d,JSON[_0x5726('0x12')](_0x4cc924));_0xa4be09(_0x4cc924);})['catch'](function(_0x3c0de7){logger['error']('GetServicenowAccount',_0x3c0de7['message'],_0x2b6c0d);_0x501f49(_0x4424cf[_0x5726('0x13')](0x1f4,_0x3c0de7['message']));});});};exports[_0x5726('0x20')]=function(_0x380880){var _0x3cabd1=this;return new Promise(function(_0x2fd79f,_0x2c59f7){return db[_0x5726('0x19')][_0x5726('0x21')]({'raw':_0x380880[_0x5726('0x1b')]?_0x380880[_0x5726('0x1b')][_0x5726('0x22')]===undefined?!![]:![]:!![],'where':_0x380880[_0x5726('0x1b')]?_0x380880[_0x5726('0x1b')][_0x5726('0x23')]||null:null,'attributes':_0x380880['options']?_0x380880[_0x5726('0x1b')][_0x5726('0x1f')]||null:null,'include':_0x380880[_0x5726('0x1b')]?_0x380880['options'][_0x5726('0x1c')]?_['map'](_0x380880['options'][_0x5726('0x1c')],function(_0x63b2aa){return{'model':db[_0x63b2aa['model']],'as':_0x63b2aa['as'],'attributes':_0x63b2aa['attributes'],'include':_0x63b2aa['include']?_[_0x5726('0x1d')](_0x63b2aa[_0x5726('0x1c')],function(_0x37d30e){return{'model':db[_0x37d30e[_0x5726('0x1e')]],'as':_0x37d30e['as'],'attributes':_0x37d30e[_0x5726('0x1f')],'include':_0x37d30e['include']?_[_0x5726('0x1d')](_0x37d30e[_0x5726('0x1c')],function(_0x4401af){return{'model':db[_0x4401af[_0x5726('0x1e')]],'as':_0x4401af['as'],'attributes':_0x4401af[_0x5726('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cacb3){logger[_0x5726('0xf')](_0x5726('0x20'),_0x380880);logger['debug'](_0x5726('0x20'),_0x380880,JSON[_0x5726('0x12')](_0x2cacb3));_0x2fd79f(_0x2cacb3);})[_0x5726('0x17')](function(_0x246cbf){logger[_0x5726('0x13')]('ShowServicenowAccount',_0x246cbf[_0x5726('0x16')],_0x380880);_0x2c59f7(_0x3cabd1[_0x5726('0x13')](0x1f4,_0x246cbf[_0x5726('0x16')]));});});}; \ No newline at end of file +var _0xe35a=['http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','where','attributes','map','include','model','find','raw','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x698d88,_0x483ad0){var _0x2a4463=function(_0x56fc33){while(--_0x56fc33){_0x698d88['push'](_0x698d88['shift']());}};_0x2a4463(++_0x483ad0);}(_0xe35a,0xf6));var _0xae35=function(_0x2377db,_0x14ec14){_0x2377db=_0x2377db-0x0;var _0x1c6ea0=_0xe35a[_0x2377db];return _0x1c6ea0;};'use strict';var _=require(_0xae35('0x0'));var util=require(_0xae35('0x1'));var moment=require(_0xae35('0x2'));var BPromise=require(_0xae35('0x3'));var rs=require(_0xae35('0x4'));var fs=require('fs');var Redis=require(_0xae35('0x5'));var db=require(_0xae35('0x6'))['db'];var utils=require(_0xae35('0x7'));var logger=require(_0xae35('0x8'))(_0xae35('0x9'));var config=require(_0xae35('0xa'));var jayson=require(_0xae35('0xb'));var client=jayson[_0xae35('0xc')][_0xae35('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x47b3c3,_0x359cfe,_0x4083ff){return new BPromise(function(_0x282aa5,_0x43c2ae){return client[_0xae35('0xe')](_0x47b3c3,_0x4083ff)[_0xae35('0xf')](function(_0x38aa44){logger[_0xae35('0x10')](_0xae35('0x11'),_0x359cfe,_0xae35('0x12'));logger[_0xae35('0x13')](_0xae35('0x14'),_0x359cfe,'request\x20sent',JSON[_0xae35('0x15')](_0x38aa44));if(_0x38aa44[_0xae35('0x16')]){if(_0x38aa44[_0xae35('0x16')]['code']===0x1f4){logger['error'](_0xae35('0x11'),_0x359cfe,_0x38aa44[_0xae35('0x16')][_0xae35('0x17')]);return _0x43c2ae(_0x38aa44[_0xae35('0x16')][_0xae35('0x17')]);}logger[_0xae35('0x16')](_0xae35('0x11'),_0x359cfe,_0x38aa44[_0xae35('0x16')][_0xae35('0x17')]);return _0x282aa5(_0x38aa44[_0xae35('0x16')][_0xae35('0x17')]);}else{logger[_0xae35('0x10')](_0xae35('0x11'),_0x359cfe,'request\x20sent');_0x282aa5(_0x38aa44[_0xae35('0x18')][_0xae35('0x17')]);}})[_0xae35('0x19')](function(_0x5ae4ce){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x359cfe,_0x5ae4ce);_0x43c2ae(_0x5ae4ce);});});}exports[_0xae35('0x1a')]=function(_0x4974cd){var _0x15520c=this;return new Promise(function(_0x49ad0b,_0x53c7e7){return db[_0xae35('0x1b')]['findAll']({'raw':_0x4974cd[_0xae35('0x1c')]?_0x4974cd[_0xae35('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4974cd[_0xae35('0x1c')]?_0x4974cd[_0xae35('0x1c')][_0xae35('0x1d')]||null:null,'attributes':_0x4974cd[_0xae35('0x1c')]?_0x4974cd[_0xae35('0x1c')][_0xae35('0x1e')]||null:null,'limit':_0x4974cd[_0xae35('0x1c')]?_0x4974cd[_0xae35('0x1c')]['limit']||null:null,'include':_0x4974cd['options']?_0x4974cd['options']['include']?_[_0xae35('0x1f')](_0x4974cd[_0xae35('0x1c')][_0xae35('0x20')],function(_0x4acac2){return{'model':db[_0x4acac2[_0xae35('0x21')]],'as':_0x4acac2['as'],'attributes':_0x4acac2[_0xae35('0x1e')],'include':_0x4acac2['include']?_[_0xae35('0x1f')](_0x4acac2[_0xae35('0x20')],function(_0x13f43f){return{'model':db[_0x13f43f[_0xae35('0x21')]],'as':_0x13f43f['as'],'attributes':_0x13f43f['attributes'],'include':_0x13f43f['include']?_[_0xae35('0x1f')](_0x13f43f[_0xae35('0x20')],function(_0xe42e){return{'model':db[_0xe42e[_0xae35('0x21')]],'as':_0xe42e['as'],'attributes':_0xe42e[_0xae35('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f5522){logger['info']('GetServicenowAccount',_0x4974cd);logger[_0xae35('0x13')](_0xae35('0x1a'),_0x4974cd,JSON['stringify'](_0x2f5522));_0x49ad0b(_0x2f5522);})[_0xae35('0x19')](function(_0xd8e9ab){logger[_0xae35('0x16')](_0xae35('0x1a'),_0xd8e9ab['message'],_0x4974cd);_0x53c7e7(_0x15520c[_0xae35('0x16')](0x1f4,_0xd8e9ab[_0xae35('0x17')]));});});};exports['ShowServicenowAccount']=function(_0x21e382){var _0x23397a=this;return new Promise(function(_0x41b432,_0x4a639d){return db[_0xae35('0x1b')][_0xae35('0x22')]({'raw':_0x21e382['options']?_0x21e382[_0xae35('0x1c')][_0xae35('0x23')]===undefined?!![]:![]:!![],'where':_0x21e382['options']?_0x21e382[_0xae35('0x1c')]['where']||null:null,'attributes':_0x21e382[_0xae35('0x1c')]?_0x21e382[_0xae35('0x1c')][_0xae35('0x1e')]||null:null,'include':_0x21e382[_0xae35('0x1c')]?_0x21e382['options']['include']?_[_0xae35('0x1f')](_0x21e382['options'][_0xae35('0x20')],function(_0x24a908){return{'model':db[_0x24a908[_0xae35('0x21')]],'as':_0x24a908['as'],'attributes':_0x24a908[_0xae35('0x1e')],'include':_0x24a908['include']?_[_0xae35('0x1f')](_0x24a908[_0xae35('0x20')],function(_0x587a93){return{'model':db[_0x587a93[_0xae35('0x21')]],'as':_0x587a93['as'],'attributes':_0x587a93['attributes'],'include':_0x587a93[_0xae35('0x20')]?_[_0xae35('0x1f')](_0x587a93[_0xae35('0x20')],function(_0x504738){return{'model':db[_0x504738[_0xae35('0x21')]],'as':_0x504738['as'],'attributes':_0x504738[_0xae35('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xae35('0xf')](function(_0x5dc65d){logger[_0xae35('0x10')]('ShowServicenowAccount',_0x21e382);logger['debug'](_0xae35('0x24'),_0x21e382,JSON[_0xae35('0x15')](_0x5dc65d));_0x41b432(_0x5dc65d);})[_0xae35('0x19')](function(_0x49cff5){logger[_0xae35('0x16')](_0xae35('0x24'),_0x49cff5[_0xae35('0x17')],_0x21e382);_0x4a639d(_0x23397a[_0xae35('0x16')](0x1f4,_0x49cff5[_0xae35('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index c942fdb..5be6a3f 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 _0xd639=['isAuthenticated','/:id/fields','getFields','/:id/descriptions','getDescriptions','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xd639,0x105));var _0x9d63=function(_0x2f0ae2,_0x5699f8){_0x2f0ae2=_0x2f0ae2-0x0;var _0x16f1d3=_0xd639[_0x2f0ae2];return _0x16f1d3;};'use strict';var multer=require(_0x9d63('0x0'));var util=require(_0x9d63('0x1'));var path=require(_0x9d63('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d63('0x3'));var router=express[_0x9d63('0x4')]();var fs_extra=require(_0x9d63('0x5'));var auth=require(_0x9d63('0x6'));var interaction=require(_0x9d63('0x7'));var config=require(_0x9d63('0x8'));var controller=require(_0x9d63('0x9'));router[_0x9d63('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9d63('0xb'),auth[_0x9d63('0xc')](),controller['show']);router[_0x9d63('0xa')](_0x9d63('0xd'),auth[_0x9d63('0xc')](),controller[_0x9d63('0xe')]);router[_0x9d63('0xa')]('/:id/subjects',auth[_0x9d63('0xc')](),controller['getSubjects']);router[_0x9d63('0xa')](_0x9d63('0xf'),auth[_0x9d63('0xc')](),controller[_0x9d63('0x10')]);router['post']('/',auth[_0x9d63('0xc')](),controller['create']);router[_0x9d63('0x11')](_0x9d63('0xb'),auth[_0x9d63('0xc')](),controller[_0x9d63('0x12')]);router['delete'](_0x9d63('0xb'),auth['isAuthenticated'](),controller[_0x9d63('0x13')]);module[_0x9d63('0x14')]=router; \ No newline at end of file +var _0x82de=['post','create','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','get','/:id/descriptions','getDescriptions'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x82de,0xca));var _0xe82d=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x82de[_0x109371];return _0x4fd858;};'use strict';var multer=require(_0xe82d('0x0'));var util=require(_0xe82d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe82d('0x2'));var router=express[_0xe82d('0x3')]();var fs_extra=require(_0xe82d('0x4'));var auth=require(_0xe82d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe82d('0x6'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xe82d('0x7')](),controller[_0xe82d('0x8')]);router['get'](_0xe82d('0x9'),auth[_0xe82d('0x7')](),controller[_0xe82d('0xa')]);router['get'](_0xe82d('0xb'),auth[_0xe82d('0x7')](),controller[_0xe82d('0xc')]);router['get'](_0xe82d('0xd'),auth[_0xe82d('0x7')](),controller[_0xe82d('0xe')]);router[_0xe82d('0xf')](_0xe82d('0x10'),auth['isAuthenticated'](),controller[_0xe82d('0x11')]);router[_0xe82d('0x12')]('/',auth[_0xe82d('0x7')](),controller[_0xe82d('0x13')]);router['put'](_0xe82d('0x9'),auth[_0xe82d('0x7')](),controller[_0xe82d('0x14')]);router[_0xe82d('0x15')](_0xe82d('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 947272f..12cffeb 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 _0x37ea=['sequelize','exports','STRING'];(function(_0x43db2a,_0x738bd5){var _0x53f535=function(_0x39a148){while(--_0x39a148){_0x43db2a['push'](_0x43db2a['shift']());}};_0x53f535(++_0x738bd5);}(_0x37ea,0x1f2));var _0xa37e=function(_0x518c99,_0x9c9af0){_0x518c99=_0x518c99-0x0;var _0x4bbbe0=_0x37ea[_0x518c99];return _0x4bbbe0;};'use strict';var Sequelize=require(_0xa37e('0x0'));module[_0xa37e('0x1')]={'name':{'type':Sequelize[_0xa37e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6661=['exports','STRING'];(function(_0x56b886,_0x1ff474){var _0x164baf=function(_0x575d09){while(--_0x575d09){_0x56b886['push'](_0x56b886['shift']());}};_0x164baf(++_0x1ff474);}(_0x6661,0x1e6));var _0x1666=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x6661[_0x4e9d3c];return _0x2d0825;};'use strict';var Sequelize=require('sequelize');module[_0x1666('0x0')]={'name':{'type':Sequelize[_0x1666('0x1')]},'description':{'type':Sequelize[_0x1666('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8b920ef..3ed95ab 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 _0x6e8d=['includeAll','include','findAll','rows','catch','show','params','intersection','create','body','update','find','getFields','findOne','ServicenowField','sort','nolimit','getSubjects','getDescriptions','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','count','limit','set','Content-Range','json','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','pick','where','merge','VIRTUAL','filter','options','ServicenowConfiguration'];(function(_0x18c235,_0x52ba87){var _0x4fac59=function(_0x39f428){while(--_0x39f428){_0x18c235['push'](_0x18c235['shift']());}};_0x4fac59(++_0x52ba87);}(_0x6e8d,0x199));var _0xd6e8=function(_0x38c5c8,_0x240cd9){_0x38c5c8=_0x38c5c8-0x0;var _0x392ec1=_0x6e8d[_0x38c5c8];return _0x392ec1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd6e8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6e8('0x1'));var moment=require(_0xd6e8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd6e8('0x3'));var util=require(_0xd6e8('0x4'));var path=require(_0xd6e8('0x5'));var sox=require(_0xd6e8('0x6'));var csv=require(_0xd6e8('0x7'));var ejs=require(_0xd6e8('0x8'));var fs=require('fs');var fs_extra=require(_0xd6e8('0x9'));var _=require(_0xd6e8('0xa'));var squel=require(_0xd6e8('0xb'));var crypto=require('crypto');var jsforce=require(_0xd6e8('0xc'));var deskjs=require(_0xd6e8('0xd'));var toCsv=require(_0xd6e8('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd6e8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd6e8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6e8('0x10'))(_0xd6e8('0x11'));var utils=require(_0xd6e8('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd6e8('0x13'));var db=require(_0xd6e8('0x14'))['db'];function respondWithStatusCode(_0x503041,_0x27bcc3){_0x27bcc3=_0x27bcc3||0xcc;return function(_0x367af6){if(_0x367af6){return _0x503041['sendStatus'](_0x27bcc3);}return _0x503041['status'](_0x27bcc3)['end']();};}function respondWithResult(_0x2dc5ac,_0x5e5c76){_0x5e5c76=_0x5e5c76||0xc8;return function(_0x4eac9e){if(_0x4eac9e){return _0x2dc5ac[_0xd6e8('0x15')](_0x5e5c76)['json'](_0x4eac9e);}};}function respondWithFilteredResult(_0x3d5e62,_0x1173f2){return function(_0x36cf69){if(_0x36cf69){var _0xb7bae2=typeof _0x1173f2[_0xd6e8('0x16')]==='undefined'&&typeof _0x1173f2['limit']==='undefined';var _0x13ddbe=_0x36cf69[_0xd6e8('0x17')];var _0x51a713=_0xb7bae2?0x0:_0x1173f2[_0xd6e8('0x16')];var _0x14e6a1=_0xb7bae2?_0x36cf69['count']:_0x1173f2[_0xd6e8('0x16')]+_0x1173f2[_0xd6e8('0x18')];var _0x84c76d;if(_0x14e6a1>=_0x13ddbe){_0x14e6a1=_0x13ddbe;_0x84c76d=0xc8;}else{_0x84c76d=0xce;}_0x3d5e62['status'](_0x84c76d);return _0x3d5e62[_0xd6e8('0x19')](_0xd6e8('0x1a'),_0x51a713+'-'+_0x14e6a1+'/'+_0x13ddbe)[_0xd6e8('0x1b')](_0x36cf69);}return null;};}function patchUpdates(_0x1d3a17){return function(_0x3ee65c){try{jsonpatch['apply'](_0x3ee65c,_0x1d3a17,!![]);}catch(_0x45baa1){return BPromise['reject'](_0x45baa1);}return _0x3ee65c[_0xd6e8('0x1c')]();};}function saveUpdates(_0x119e51,_0x4f5bcf){return function(_0x55454b){if(_0x55454b){return _0x55454b['update'](_0x119e51)[_0xd6e8('0x1d')](function(_0x4edb6c){return _0x4edb6c;});}return null;};}function removeEntity(_0x558968,_0x517c39){return function(_0x2c0349){if(_0x2c0349){return _0x2c0349[_0xd6e8('0x1e')]()[_0xd6e8('0x1d')](function(){_0x558968[_0xd6e8('0x15')](0xcc)[_0xd6e8('0x1f')]();});}};}function handleEntityNotFound(_0x2bd3d9,_0x5336f4){return function(_0x48bb24){if(!_0x48bb24){_0x2bd3d9[_0xd6e8('0x20')](0x194);}return _0x48bb24;};}function handleError(_0x2cc6e0,_0x1e128c){_0x1e128c=_0x1e128c||0x1f4;return function(_0x34f717){logger[_0xd6e8('0x21')](_0x34f717[_0xd6e8('0x22')]);if(_0x34f717['name']){delete _0x34f717[_0xd6e8('0x23')];}_0x2cc6e0['status'](_0x1e128c)[_0xd6e8('0x24')](_0x34f717);};}exports[_0xd6e8('0x25')]=function(_0x5603ff,_0xee251f){var _0x24000d={},_0x20d1b3={},_0x1ec301={'count':0x0,'rows':[]};var _0x270db=_[_0xd6e8('0x26')](db['ServicenowConfiguration'][_0xd6e8('0x27')],function(_0x120067){return{'name':_0x120067[_0xd6e8('0x28')],'type':_0x120067[_0xd6e8('0x29')][_0xd6e8('0x2a')]};});_0x20d1b3[_0xd6e8('0x2b')]=_[_0xd6e8('0x26')](_0x270db,_0xd6e8('0x23'));_0x20d1b3['query']=_[_0xd6e8('0x2c')](_0x5603ff[_0xd6e8('0x2d')]);_0x20d1b3[_0xd6e8('0x2e')]=_['intersection'](_0x20d1b3[_0xd6e8('0x2b')],_0x20d1b3[_0xd6e8('0x2d')]);_0x24000d[_0xd6e8('0x2f')]=_['intersection'](_0x20d1b3['model'],qs['fields'](_0x5603ff[_0xd6e8('0x2d')][_0xd6e8('0x30')]));_0x24000d[_0xd6e8('0x2f')]=_0x24000d[_0xd6e8('0x2f')][_0xd6e8('0x31')]?_0x24000d[_0xd6e8('0x2f')]:_0x20d1b3[_0xd6e8('0x2b')];if(!_0x5603ff[_0xd6e8('0x2d')][_0xd6e8('0x32')]('nolimit')){_0x24000d[_0xd6e8('0x18')]=qs[_0xd6e8('0x18')](_0x5603ff[_0xd6e8('0x2d')]['limit']);_0x24000d[_0xd6e8('0x16')]=qs[_0xd6e8('0x16')](_0x5603ff['query'][_0xd6e8('0x16')]);}_0x24000d[_0xd6e8('0x33')]=qs['sort'](_0x5603ff['query']['sort']);_0x24000d['where']=qs[_0xd6e8('0x2e')](_[_0xd6e8('0x34')](_0x5603ff[_0xd6e8('0x2d')],_0x20d1b3[_0xd6e8('0x2e')]),_0x270db);if(_0x5603ff[_0xd6e8('0x2d')]['filter']){_0x24000d[_0xd6e8('0x35')]=_[_0xd6e8('0x36')](_0x24000d[_0xd6e8('0x35')],{'$or':_[_0xd6e8('0x26')](_0x270db,function(_0x50a398){if(_0x50a398[_0xd6e8('0x29')]!==_0xd6e8('0x37')){var _0x5bb14f={};_0x5bb14f[_0x50a398[_0xd6e8('0x23')]]={'$like':'%'+_0x5603ff['query'][_0xd6e8('0x38')]+'%'};return _0x5bb14f;}})});}_0x24000d=_[_0xd6e8('0x36')]({},_0x24000d,_0x5603ff[_0xd6e8('0x39')]);var _0x6509c0={'where':_0x24000d['where']};return db[_0xd6e8('0x3a')]['count'](_0x6509c0)['then'](function(_0x5980d8){_0x1ec301[_0xd6e8('0x17')]=_0x5980d8;if(_0x5603ff['query'][_0xd6e8('0x3b')]){_0x24000d[_0xd6e8('0x3c')]=[{'all':!![]}];}return db[_0xd6e8('0x3a')][_0xd6e8('0x3d')](_0x24000d);})[_0xd6e8('0x1d')](function(_0x40aa70){_0x1ec301[_0xd6e8('0x3e')]=_0x40aa70;return _0x1ec301;})[_0xd6e8('0x1d')](respondWithFilteredResult(_0xee251f,_0x24000d))[_0xd6e8('0x3f')](handleError(_0xee251f,null));};exports[_0xd6e8('0x40')]=function(_0x47d2a3,_0x23765e){var _0x5eca26={'raw':![],'where':{'id':_0x47d2a3[_0xd6e8('0x41')]['id']}},_0x458c95={};_0x458c95[_0xd6e8('0x2b')]=_[_0xd6e8('0x2c')](db[_0xd6e8('0x3a')][_0xd6e8('0x27')]);_0x458c95['query']=_[_0xd6e8('0x2c')](_0x47d2a3['query']);_0x458c95['filters']=_[_0xd6e8('0x42')](_0x458c95[_0xd6e8('0x2b')],_0x458c95[_0xd6e8('0x2d')]);_0x5eca26[_0xd6e8('0x2f')]=_[_0xd6e8('0x42')](_0x458c95['model'],qs[_0xd6e8('0x30')](_0x47d2a3[_0xd6e8('0x2d')][_0xd6e8('0x30')]));_0x5eca26[_0xd6e8('0x2f')]=_0x5eca26[_0xd6e8('0x2f')][_0xd6e8('0x31')]?_0x5eca26[_0xd6e8('0x2f')]:_0x458c95[_0xd6e8('0x2b')];if(_0x47d2a3[_0xd6e8('0x2d')]['includeAll']){_0x5eca26[_0xd6e8('0x3c')]=[{'all':!![]}];}_0x5eca26=_[_0xd6e8('0x36')]({},_0x5eca26,_0x47d2a3[_0xd6e8('0x39')]);return db[_0xd6e8('0x3a')]['find'](_0x5eca26)[_0xd6e8('0x1d')](handleEntityNotFound(_0x23765e,null))[_0xd6e8('0x1d')](respondWithResult(_0x23765e,null))[_0xd6e8('0x3f')](handleError(_0x23765e,null));};exports[_0xd6e8('0x43')]=function(_0x5cbfe0,_0x5b857f){return db[_0xd6e8('0x3a')][_0xd6e8('0x43')](_0x5cbfe0[_0xd6e8('0x44')],{})[_0xd6e8('0x1d')](respondWithResult(_0x5b857f,0xc9))[_0xd6e8('0x3f')](handleError(_0x5b857f,null));};exports[_0xd6e8('0x45')]=function(_0x2bcc3b,_0xbd9308){if(_0x2bcc3b[_0xd6e8('0x44')]['id']){delete _0x2bcc3b[_0xd6e8('0x44')]['id'];}return db['ServicenowConfiguration'][_0xd6e8('0x46')]({'where':{'id':_0x2bcc3b[_0xd6e8('0x41')]['id']}})[_0xd6e8('0x1d')](handleEntityNotFound(_0xbd9308,null))[_0xd6e8('0x1d')](saveUpdates(_0x2bcc3b[_0xd6e8('0x44')],null))[_0xd6e8('0x1d')](respondWithResult(_0xbd9308,null))[_0xd6e8('0x3f')](handleError(_0xbd9308,null));};exports[_0xd6e8('0x1e')]=function(_0x4974de,_0x2add59){return db[_0xd6e8('0x3a')]['find']({'where':{'id':_0x4974de['params']['id']}})[_0xd6e8('0x1d')](handleEntityNotFound(_0x2add59,null))['then'](removeEntity(_0x2add59,null))['catch'](handleError(_0x2add59,null));};exports[_0xd6e8('0x47')]=function(_0x331edb,_0x349cb2,_0x508f30){var _0x415795={};var _0x5db847={};var _0xad6da2;var _0x1001cb;return db[_0xd6e8('0x3a')][_0xd6e8('0x48')]({'where':{'id':_0x331edb[_0xd6e8('0x41')]['id']}})[_0xd6e8('0x1d')](handleEntityNotFound(_0x349cb2,null))[_0xd6e8('0x1d')](function(_0x254dd2){if(_0x254dd2){_0xad6da2=_0x254dd2;_0x5db847[_0xd6e8('0x2b')]=_[_0xd6e8('0x2c')](db[_0xd6e8('0x49')][_0xd6e8('0x27')]);_0x5db847[_0xd6e8('0x2d')]=_[_0xd6e8('0x2c')](_0x331edb[_0xd6e8('0x2d')]);_0x5db847['filters']=_['intersection'](_0x5db847['model'],_0x5db847[_0xd6e8('0x2d')]);_0x415795[_0xd6e8('0x2f')]=_['intersection'](_0x5db847[_0xd6e8('0x2b')],qs[_0xd6e8('0x30')](_0x331edb['query'][_0xd6e8('0x30')]));_0x415795[_0xd6e8('0x2f')]=_0x415795[_0xd6e8('0x2f')]['length']?_0x415795[_0xd6e8('0x2f')]:_0x5db847[_0xd6e8('0x2b')];_0x415795['order']=qs[_0xd6e8('0x4a')](_0x331edb[_0xd6e8('0x2d')][_0xd6e8('0x4a')]);_0x415795[_0xd6e8('0x35')]=qs[_0xd6e8('0x2e')](_[_0xd6e8('0x34')](_0x331edb[_0xd6e8('0x2d')],_0x5db847['filters']));if(_0x331edb[_0xd6e8('0x2d')]['filter']){_0x415795['where']=_[_0xd6e8('0x36')](_0x415795[_0xd6e8('0x35')],{'$or':_[_0xd6e8('0x26')](_0x415795[_0xd6e8('0x2f')],function(_0x18bc38){var _0x2459a7={};_0x2459a7[_0x18bc38]={'$like':'%'+_0x331edb[_0xd6e8('0x2d')][_0xd6e8('0x38')]+'%'};return _0x2459a7;})});}_0x415795=_[_0xd6e8('0x36')]({},_0x415795,_0x331edb[_0xd6e8('0x39')]);return _0xad6da2[_0xd6e8('0x47')](_0x415795);}})[_0xd6e8('0x1d')](function(_0x3560ff){if(_0x3560ff){_0x1001cb=_0x3560ff[_0xd6e8('0x31')];if(!_0x331edb[_0xd6e8('0x2d')]['hasOwnProperty'](_0xd6e8('0x4b'))){_0x415795[_0xd6e8('0x18')]=qs['limit'](_0x331edb['query'][_0xd6e8('0x18')]);_0x415795[_0xd6e8('0x16')]=qs[_0xd6e8('0x16')](_0x331edb[_0xd6e8('0x2d')][_0xd6e8('0x16')]);}return _0xad6da2[_0xd6e8('0x47')](_0x415795);}})[_0xd6e8('0x1d')](function(_0x4601ec){if(_0x4601ec){return _0x4601ec?{'count':_0x1001cb,'rows':_0x4601ec}:null;}})['then'](respondWithResult(_0x349cb2,null))[_0xd6e8('0x3f')](handleError(_0x349cb2,null));};exports['getSubjects']=function(_0x2bf20e,_0x4480aa,_0x29e83d){var _0x297ff8={};var _0x5312f0={};var _0x31cc08;var _0x124e56;return db[_0xd6e8('0x3a')][_0xd6e8('0x48')]({'where':{'id':_0x2bf20e[_0xd6e8('0x41')]['id']}})['then'](handleEntityNotFound(_0x4480aa,null))[_0xd6e8('0x1d')](function(_0x9bba64){if(_0x9bba64){_0x31cc08=_0x9bba64;_0x5312f0['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0x5312f0[_0xd6e8('0x2d')]=_['keys'](_0x2bf20e['query']);_0x5312f0[_0xd6e8('0x2e')]=_[_0xd6e8('0x42')](_0x5312f0[_0xd6e8('0x2b')],_0x5312f0[_0xd6e8('0x2d')]);_0x297ff8[_0xd6e8('0x2f')]=_[_0xd6e8('0x42')](_0x5312f0[_0xd6e8('0x2b')],qs[_0xd6e8('0x30')](_0x2bf20e[_0xd6e8('0x2d')]['fields']));_0x297ff8[_0xd6e8('0x2f')]=_0x297ff8[_0xd6e8('0x2f')]['length']?_0x297ff8[_0xd6e8('0x2f')]:_0x5312f0[_0xd6e8('0x2b')];_0x297ff8['order']=qs[_0xd6e8('0x4a')](_0x2bf20e[_0xd6e8('0x2d')][_0xd6e8('0x4a')]);_0x297ff8[_0xd6e8('0x35')]=qs[_0xd6e8('0x2e')](_[_0xd6e8('0x34')](_0x2bf20e[_0xd6e8('0x2d')],_0x5312f0['filters']));if(_0x2bf20e[_0xd6e8('0x2d')][_0xd6e8('0x38')]){_0x297ff8['where']=_[_0xd6e8('0x36')](_0x297ff8[_0xd6e8('0x35')],{'$or':_[_0xd6e8('0x26')](_0x297ff8[_0xd6e8('0x2f')],function(_0x56ff1a){var _0x483038={};_0x483038[_0x56ff1a]={'$like':'%'+_0x2bf20e[_0xd6e8('0x2d')][_0xd6e8('0x38')]+'%'};return _0x483038;})});}_0x297ff8=_[_0xd6e8('0x36')]({},_0x297ff8,_0x2bf20e[_0xd6e8('0x39')]);return _0x31cc08['getSubjects'](_0x297ff8);}})['then'](function(_0x2ff643){if(_0x2ff643){_0x124e56=_0x2ff643['length'];if(!_0x2bf20e[_0xd6e8('0x2d')]['hasOwnProperty'](_0xd6e8('0x4b'))){_0x297ff8[_0xd6e8('0x18')]=qs[_0xd6e8('0x18')](_0x2bf20e[_0xd6e8('0x2d')][_0xd6e8('0x18')]);_0x297ff8['offset']=qs[_0xd6e8('0x16')](_0x2bf20e[_0xd6e8('0x2d')][_0xd6e8('0x16')]);}return _0x31cc08[_0xd6e8('0x4c')](_0x297ff8);}})[_0xd6e8('0x1d')](function(_0x5f5168){if(_0x5f5168){return _0x5f5168?{'count':_0x124e56,'rows':_0x5f5168}:null;}})['then'](respondWithResult(_0x4480aa,null))['catch'](handleError(_0x4480aa,null));};exports['getDescriptions']=function(_0x5944f9,_0x5d0ccd,_0x52a562){var _0x5d0adb={};var _0x3273e3={};var _0x218873;var _0x5985ae;return db[_0xd6e8('0x3a')][_0xd6e8('0x48')]({'where':{'id':_0x5944f9['params']['id']}})['then'](handleEntityNotFound(_0x5d0ccd,null))[_0xd6e8('0x1d')](function(_0x2fcfd9){if(_0x2fcfd9){_0x218873=_0x2fcfd9;_0x3273e3[_0xd6e8('0x2b')]=_['keys'](db[_0xd6e8('0x49')][_0xd6e8('0x27')]);_0x3273e3[_0xd6e8('0x2d')]=_[_0xd6e8('0x2c')](_0x5944f9[_0xd6e8('0x2d')]);_0x3273e3[_0xd6e8('0x2e')]=_[_0xd6e8('0x42')](_0x3273e3[_0xd6e8('0x2b')],_0x3273e3[_0xd6e8('0x2d')]);_0x5d0adb[_0xd6e8('0x2f')]=_['intersection'](_0x3273e3[_0xd6e8('0x2b')],qs[_0xd6e8('0x30')](_0x5944f9[_0xd6e8('0x2d')][_0xd6e8('0x30')]));_0x5d0adb[_0xd6e8('0x2f')]=_0x5d0adb[_0xd6e8('0x2f')][_0xd6e8('0x31')]?_0x5d0adb[_0xd6e8('0x2f')]:_0x3273e3[_0xd6e8('0x2b')];_0x5d0adb[_0xd6e8('0x33')]=qs[_0xd6e8('0x4a')](_0x5944f9[_0xd6e8('0x2d')][_0xd6e8('0x4a')]);_0x5d0adb[_0xd6e8('0x35')]=qs[_0xd6e8('0x2e')](_[_0xd6e8('0x34')](_0x5944f9[_0xd6e8('0x2d')],_0x3273e3[_0xd6e8('0x2e')]));if(_0x5944f9[_0xd6e8('0x2d')][_0xd6e8('0x38')]){_0x5d0adb[_0xd6e8('0x35')]=_[_0xd6e8('0x36')](_0x5d0adb['where'],{'$or':_[_0xd6e8('0x26')](_0x5d0adb['attributes'],function(_0x348144){var _0x2808e4={};_0x2808e4[_0x348144]={'$like':'%'+_0x5944f9[_0xd6e8('0x2d')]['filter']+'%'};return _0x2808e4;})});}_0x5d0adb=_[_0xd6e8('0x36')]({},_0x5d0adb,_0x5944f9[_0xd6e8('0x39')]);return _0x218873[_0xd6e8('0x4d')](_0x5d0adb);}})[_0xd6e8('0x1d')](function(_0x28586c){if(_0x28586c){_0x5985ae=_0x28586c[_0xd6e8('0x31')];if(!_0x5944f9[_0xd6e8('0x2d')][_0xd6e8('0x32')](_0xd6e8('0x4b'))){_0x5d0adb[_0xd6e8('0x18')]=qs[_0xd6e8('0x18')](_0x5944f9['query']['limit']);_0x5d0adb[_0xd6e8('0x16')]=qs[_0xd6e8('0x16')](_0x5944f9['query']['offset']);}return _0x218873[_0xd6e8('0x4d')](_0x5d0adb);}})['then'](function(_0x38be89){if(_0x38be89){return _0x38be89?{'count':_0x5985ae,'rows':_0x38be89}:null;}})['then'](respondWithResult(_0x5d0ccd,null))[_0xd6e8('0x3f')](handleError(_0x5d0ccd,null));}; \ No newline at end of file +var _0x19b3=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','find','catch','create','body','params','destroy','getFields','ServicenowField','sort','findOne','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','update','then','end','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key'];(function(_0x50fe6d,_0x44f712){var _0x2a6968=function(_0x223a12){while(--_0x223a12){_0x50fe6d['push'](_0x50fe6d['shift']());}};_0x2a6968(++_0x44f712);}(_0x19b3,0x11a));var _0x319b=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x19b3[_0x57014b];return _0x2b258a;};'use strict';var emlformat=require(_0x319b('0x0'));var rimraf=require(_0x319b('0x1'));var zipdir=require(_0x319b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x319b('0x3'));var moment=require(_0x319b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x319b('0x5'));var path=require(_0x319b('0x6'));var sox=require(_0x319b('0x7'));var csv=require('to-csv');var ejs=require(_0x319b('0x8'));var fs=require('fs');var fs_extra=require(_0x319b('0x9'));var _=require(_0x319b('0xa'));var squel=require(_0x319b('0xb'));var crypto=require(_0x319b('0xc'));var jsforce=require(_0x319b('0xd'));var deskjs=require(_0x319b('0xe'));var toCsv=require(_0x319b('0xf'));var querystring=require(_0x319b('0x10'));var Papa=require(_0x319b('0x11'));var Redis=require(_0x319b('0x12'));var authService=require(_0x319b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x319b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x319b('0x15'))(_0x319b('0x16'));var utils=require(_0x319b('0x17'));var config=require(_0x319b('0x18'));var licenseUtil=require(_0x319b('0x19'));var db=require(_0x319b('0x1a'))['db'];function respondWithStatusCode(_0x59b674,_0x201c2f){_0x201c2f=_0x201c2f||0xcc;return function(_0x5979bc){if(_0x5979bc){return _0x59b674[_0x319b('0x1b')](_0x201c2f);}return _0x59b674['status'](_0x201c2f)['end']();};}function respondWithResult(_0x4fd42a,_0x31ee0e){_0x31ee0e=_0x31ee0e||0xc8;return function(_0x1a1a44){if(_0x1a1a44){return _0x4fd42a['status'](_0x31ee0e)[_0x319b('0x1c')](_0x1a1a44);}};}function respondWithFilteredResult(_0x54d601,_0xf748f7){return function(_0x2ab80d){if(_0x2ab80d){var _0xe866cd=typeof _0xf748f7['offset']===_0x319b('0x1d')&&typeof _0xf748f7['limit']===_0x319b('0x1d');var _0x3b199a=_0x2ab80d[_0x319b('0x1e')];var _0x902b72=_0xe866cd?0x0:_0xf748f7['offset'];var _0xc6b2ba=_0xe866cd?_0x2ab80d[_0x319b('0x1e')]:_0xf748f7[_0x319b('0x1f')]+_0xf748f7[_0x319b('0x20')];var _0x30082d;if(_0xc6b2ba>=_0x3b199a){_0xc6b2ba=_0x3b199a;_0x30082d=0xc8;}else{_0x30082d=0xce;}_0x54d601[_0x319b('0x21')](_0x30082d);return _0x54d601[_0x319b('0x22')](_0x319b('0x23'),_0x902b72+'-'+_0xc6b2ba+'/'+_0x3b199a)[_0x319b('0x1c')](_0x2ab80d);}return null;};}function patchUpdates(_0x277927){return function(_0x271f03){try{jsonpatch['apply'](_0x271f03,_0x277927,!![]);}catch(_0x44320c){return BPromise[_0x319b('0x24')](_0x44320c);}return _0x271f03[_0x319b('0x25')]();};}function saveUpdates(_0x5ee691,_0x4f166f){return function(_0x5f061e){if(_0x5f061e){return _0x5f061e[_0x319b('0x26')](_0x5ee691)[_0x319b('0x27')](function(_0x40556c){return _0x40556c;});}return null;};}function removeEntity(_0x507fcc,_0x50a19d){return function(_0x16b46c){if(_0x16b46c){return _0x16b46c['destroy']()['then'](function(){_0x507fcc[_0x319b('0x21')](0xcc)[_0x319b('0x28')]();});}};}function handleEntityNotFound(_0x30a287,_0x5cbdb6){return function(_0x4da7c2){if(!_0x4da7c2){_0x30a287['sendStatus'](0x194);}return _0x4da7c2;};}function handleError(_0x2f5cbb,_0x3ccffd){_0x3ccffd=_0x3ccffd||0x1f4;return function(_0xd43c64){logger[_0x319b('0x29')](_0xd43c64['stack']);if(_0xd43c64[_0x319b('0x2a')]){delete _0xd43c64[_0x319b('0x2a')];}_0x2f5cbb[_0x319b('0x21')](_0x3ccffd)[_0x319b('0x2b')](_0xd43c64);};}exports[_0x319b('0x2c')]=function(_0x217bca,_0x4033dd){var _0x3b9f38={},_0x2c1e11={},_0x4bb352={'count':0x0,'rows':[]};var _0x1d9b6b=_[_0x319b('0x2d')](db[_0x319b('0x2e')][_0x319b('0x2f')],function(_0x2d2258){return{'name':_0x2d2258[_0x319b('0x30')],'type':_0x2d2258['type'][_0x319b('0x31')]};});_0x2c1e11[_0x319b('0x32')]=_[_0x319b('0x2d')](_0x1d9b6b,_0x319b('0x2a'));_0x2c1e11[_0x319b('0x33')]=_[_0x319b('0x34')](_0x217bca['query']);_0x2c1e11[_0x319b('0x35')]=_[_0x319b('0x36')](_0x2c1e11[_0x319b('0x32')],_0x2c1e11[_0x319b('0x33')]);_0x3b9f38[_0x319b('0x37')]=_[_0x319b('0x36')](_0x2c1e11[_0x319b('0x32')],qs[_0x319b('0x38')](_0x217bca[_0x319b('0x33')][_0x319b('0x38')]));_0x3b9f38[_0x319b('0x37')]=_0x3b9f38[_0x319b('0x37')][_0x319b('0x39')]?_0x3b9f38[_0x319b('0x37')]:_0x2c1e11[_0x319b('0x32')];if(!_0x217bca[_0x319b('0x33')]['hasOwnProperty'](_0x319b('0x3a'))){_0x3b9f38[_0x319b('0x20')]=qs[_0x319b('0x20')](_0x217bca[_0x319b('0x33')]['limit']);_0x3b9f38[_0x319b('0x1f')]=qs[_0x319b('0x1f')](_0x217bca[_0x319b('0x33')][_0x319b('0x1f')]);}_0x3b9f38['order']=qs['sort'](_0x217bca[_0x319b('0x33')]['sort']);_0x3b9f38['where']=qs['filters'](_[_0x319b('0x3b')](_0x217bca[_0x319b('0x33')],_0x2c1e11[_0x319b('0x35')]),_0x1d9b6b);if(_0x217bca[_0x319b('0x33')][_0x319b('0x3c')]){_0x3b9f38[_0x319b('0x3d')]=_[_0x319b('0x3e')](_0x3b9f38[_0x319b('0x3d')],{'$or':_[_0x319b('0x2d')](_0x1d9b6b,function(_0x314782){if(_0x314782[_0x319b('0x3f')]!==_0x319b('0x40')){var _0x2334e5={};_0x2334e5[_0x314782[_0x319b('0x2a')]]={'$like':'%'+_0x217bca['query']['filter']+'%'};return _0x2334e5;}})});}_0x3b9f38=_[_0x319b('0x3e')]({},_0x3b9f38,_0x217bca[_0x319b('0x41')]);var _0x479714={'where':_0x3b9f38[_0x319b('0x3d')]};return db[_0x319b('0x2e')][_0x319b('0x1e')](_0x479714)['then'](function(_0x3856cf){_0x4bb352['count']=_0x3856cf;if(_0x217bca[_0x319b('0x33')][_0x319b('0x42')]){_0x3b9f38[_0x319b('0x43')]=[{'all':!![]}];}return db[_0x319b('0x2e')][_0x319b('0x44')](_0x3b9f38);})[_0x319b('0x27')](function(_0x11aa73){_0x4bb352['rows']=_0x11aa73;return _0x4bb352;})['then'](respondWithFilteredResult(_0x4033dd,_0x3b9f38))['catch'](handleError(_0x4033dd,null));};exports[_0x319b('0x45')]=function(_0x2d7d76,_0x173795){var _0x134d5b={'raw':![],'where':{'id':_0x2d7d76['params']['id']}},_0x3d1458={};_0x3d1458[_0x319b('0x32')]=_[_0x319b('0x34')](db[_0x319b('0x2e')][_0x319b('0x2f')]);_0x3d1458['query']=_[_0x319b('0x34')](_0x2d7d76[_0x319b('0x33')]);_0x3d1458[_0x319b('0x35')]=_[_0x319b('0x36')](_0x3d1458[_0x319b('0x32')],_0x3d1458['query']);_0x134d5b[_0x319b('0x37')]=_[_0x319b('0x36')](_0x3d1458[_0x319b('0x32')],qs[_0x319b('0x38')](_0x2d7d76[_0x319b('0x33')][_0x319b('0x38')]));_0x134d5b[_0x319b('0x37')]=_0x134d5b[_0x319b('0x37')]['length']?_0x134d5b['attributes']:_0x3d1458['model'];if(_0x2d7d76[_0x319b('0x33')][_0x319b('0x42')]){_0x134d5b[_0x319b('0x43')]=[{'all':!![]}];}_0x134d5b=_[_0x319b('0x3e')]({},_0x134d5b,_0x2d7d76[_0x319b('0x41')]);return db[_0x319b('0x2e')][_0x319b('0x46')](_0x134d5b)['then'](handleEntityNotFound(_0x173795,null))[_0x319b('0x27')](respondWithResult(_0x173795,null))[_0x319b('0x47')](handleError(_0x173795,null));};exports[_0x319b('0x48')]=function(_0x5bead0,_0x1006be){return db['ServicenowConfiguration'][_0x319b('0x48')](_0x5bead0[_0x319b('0x49')],{})['then'](respondWithResult(_0x1006be,0xc9))[_0x319b('0x47')](handleError(_0x1006be,null));};exports['update']=function(_0x5627cd,_0x3bdb60){if(_0x5627cd['body']['id']){delete _0x5627cd[_0x319b('0x49')]['id'];}return db[_0x319b('0x2e')][_0x319b('0x46')]({'where':{'id':_0x5627cd[_0x319b('0x4a')]['id']}})[_0x319b('0x27')](handleEntityNotFound(_0x3bdb60,null))[_0x319b('0x27')](saveUpdates(_0x5627cd[_0x319b('0x49')],null))[_0x319b('0x27')](respondWithResult(_0x3bdb60,null))[_0x319b('0x47')](handleError(_0x3bdb60,null));};exports[_0x319b('0x4b')]=function(_0x3c6253,_0x30fd60){return db['ServicenowConfiguration'][_0x319b('0x46')]({'where':{'id':_0x3c6253[_0x319b('0x4a')]['id']}})[_0x319b('0x27')](handleEntityNotFound(_0x30fd60,null))[_0x319b('0x27')](removeEntity(_0x30fd60,null))[_0x319b('0x47')](handleError(_0x30fd60,null));};exports[_0x319b('0x4c')]=function(_0x38f509,_0x3f19a4,_0x373f03){var _0x3bdb3a={};var _0x24f578={};var _0x634e6a;var _0x23b577;return db[_0x319b('0x2e')]['findOne']({'where':{'id':_0x38f509[_0x319b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f19a4,null))[_0x319b('0x27')](function(_0x21b096){if(_0x21b096){_0x634e6a=_0x21b096;_0x24f578[_0x319b('0x32')]=_['keys'](db[_0x319b('0x4d')]['rawAttributes']);_0x24f578[_0x319b('0x33')]=_[_0x319b('0x34')](_0x38f509[_0x319b('0x33')]);_0x24f578[_0x319b('0x35')]=_[_0x319b('0x36')](_0x24f578['model'],_0x24f578[_0x319b('0x33')]);_0x3bdb3a[_0x319b('0x37')]=_[_0x319b('0x36')](_0x24f578[_0x319b('0x32')],qs[_0x319b('0x38')](_0x38f509['query'][_0x319b('0x38')]));_0x3bdb3a[_0x319b('0x37')]=_0x3bdb3a[_0x319b('0x37')]['length']?_0x3bdb3a[_0x319b('0x37')]:_0x24f578[_0x319b('0x32')];_0x3bdb3a['order']=qs[_0x319b('0x4e')](_0x38f509['query'][_0x319b('0x4e')]);_0x3bdb3a['where']=qs[_0x319b('0x35')](_['pick'](_0x38f509[_0x319b('0x33')],_0x24f578[_0x319b('0x35')]));if(_0x38f509[_0x319b('0x33')][_0x319b('0x3c')]){_0x3bdb3a[_0x319b('0x3d')]=_[_0x319b('0x3e')](_0x3bdb3a['where'],{'$or':_[_0x319b('0x2d')](_0x3bdb3a['attributes'],function(_0x1a0f55){var _0x5168ed={};_0x5168ed[_0x1a0f55]={'$like':'%'+_0x38f509[_0x319b('0x33')][_0x319b('0x3c')]+'%'};return _0x5168ed;})});}_0x3bdb3a=_[_0x319b('0x3e')]({},_0x3bdb3a,_0x38f509[_0x319b('0x41')]);return _0x634e6a[_0x319b('0x4c')](_0x3bdb3a);}})[_0x319b('0x27')](function(_0x3ee910){if(_0x3ee910){_0x23b577=_0x3ee910[_0x319b('0x39')];if(!_0x38f509[_0x319b('0x33')]['hasOwnProperty'](_0x319b('0x3a'))){_0x3bdb3a['limit']=qs[_0x319b('0x20')](_0x38f509[_0x319b('0x33')][_0x319b('0x20')]);_0x3bdb3a[_0x319b('0x1f')]=qs[_0x319b('0x1f')](_0x38f509[_0x319b('0x33')][_0x319b('0x1f')]);}return _0x634e6a[_0x319b('0x4c')](_0x3bdb3a);}})[_0x319b('0x27')](function(_0x3a95e4){if(_0x3a95e4){return _0x3a95e4?{'count':_0x23b577,'rows':_0x3a95e4}:null;}})[_0x319b('0x27')](respondWithResult(_0x3f19a4,null))['catch'](handleError(_0x3f19a4,null));};exports['getSubjects']=function(_0x3c2957,_0x51c99e,_0x497c22){var _0x53f37e={};var _0x5852f9={};var _0x220a13;var _0x475c94;return db[_0x319b('0x2e')][_0x319b('0x4f')]({'where':{'id':_0x3c2957['params']['id']}})[_0x319b('0x27')](handleEntityNotFound(_0x51c99e,null))[_0x319b('0x27')](function(_0x1d25c4){if(_0x1d25c4){_0x220a13=_0x1d25c4;_0x5852f9['model']=_[_0x319b('0x34')](db[_0x319b('0x4d')]['rawAttributes']);_0x5852f9[_0x319b('0x33')]=_[_0x319b('0x34')](_0x3c2957[_0x319b('0x33')]);_0x5852f9['filters']=_[_0x319b('0x36')](_0x5852f9[_0x319b('0x32')],_0x5852f9['query']);_0x53f37e[_0x319b('0x37')]=_['intersection'](_0x5852f9[_0x319b('0x32')],qs[_0x319b('0x38')](_0x3c2957[_0x319b('0x33')][_0x319b('0x38')]));_0x53f37e[_0x319b('0x37')]=_0x53f37e['attributes']['length']?_0x53f37e['attributes']:_0x5852f9[_0x319b('0x32')];_0x53f37e['order']=qs['sort'](_0x3c2957[_0x319b('0x33')][_0x319b('0x4e')]);_0x53f37e[_0x319b('0x3d')]=qs['filters'](_[_0x319b('0x3b')](_0x3c2957[_0x319b('0x33')],_0x5852f9[_0x319b('0x35')]));if(_0x3c2957[_0x319b('0x33')][_0x319b('0x3c')]){_0x53f37e[_0x319b('0x3d')]=_[_0x319b('0x3e')](_0x53f37e['where'],{'$or':_['map'](_0x53f37e[_0x319b('0x37')],function(_0x1f58d6){var _0x309b41={};_0x309b41[_0x1f58d6]={'$like':'%'+_0x3c2957['query'][_0x319b('0x3c')]+'%'};return _0x309b41;})});}_0x53f37e=_[_0x319b('0x3e')]({},_0x53f37e,_0x3c2957[_0x319b('0x41')]);return _0x220a13[_0x319b('0x50')](_0x53f37e);}})[_0x319b('0x27')](function(_0x51252b){if(_0x51252b){_0x475c94=_0x51252b[_0x319b('0x39')];if(!_0x3c2957['query'][_0x319b('0x51')](_0x319b('0x3a'))){_0x53f37e[_0x319b('0x20')]=qs[_0x319b('0x20')](_0x3c2957[_0x319b('0x33')][_0x319b('0x20')]);_0x53f37e[_0x319b('0x1f')]=qs['offset'](_0x3c2957[_0x319b('0x33')][_0x319b('0x1f')]);}return _0x220a13[_0x319b('0x50')](_0x53f37e);}})[_0x319b('0x27')](function(_0x1e8706){if(_0x1e8706){return _0x1e8706?{'count':_0x475c94,'rows':_0x1e8706}:null;}})['then'](respondWithResult(_0x51c99e,null))[_0x319b('0x47')](handleError(_0x51c99e,null));};exports[_0x319b('0x52')]=function(_0x4d975c,_0x24cc64,_0x2a09cf){var _0xbe4543={};var _0x234510={};var _0x39cc7b;var _0xd61b2d;return db[_0x319b('0x2e')][_0x319b('0x4f')]({'where':{'id':_0x4d975c[_0x319b('0x4a')]['id']}})[_0x319b('0x27')](handleEntityNotFound(_0x24cc64,null))[_0x319b('0x27')](function(_0x3428af){if(_0x3428af){_0x39cc7b=_0x3428af;_0x234510[_0x319b('0x32')]=_[_0x319b('0x34')](db[_0x319b('0x4d')]['rawAttributes']);_0x234510[_0x319b('0x33')]=_['keys'](_0x4d975c[_0x319b('0x33')]);_0x234510['filters']=_[_0x319b('0x36')](_0x234510[_0x319b('0x32')],_0x234510[_0x319b('0x33')]);_0xbe4543[_0x319b('0x37')]=_['intersection'](_0x234510[_0x319b('0x32')],qs[_0x319b('0x38')](_0x4d975c[_0x319b('0x33')][_0x319b('0x38')]));_0xbe4543[_0x319b('0x37')]=_0xbe4543['attributes'][_0x319b('0x39')]?_0xbe4543['attributes']:_0x234510[_0x319b('0x32')];_0xbe4543['order']=qs[_0x319b('0x4e')](_0x4d975c[_0x319b('0x33')][_0x319b('0x4e')]);_0xbe4543[_0x319b('0x3d')]=qs[_0x319b('0x35')](_[_0x319b('0x3b')](_0x4d975c[_0x319b('0x33')],_0x234510[_0x319b('0x35')]));if(_0x4d975c[_0x319b('0x33')][_0x319b('0x3c')]){_0xbe4543[_0x319b('0x3d')]=_[_0x319b('0x3e')](_0xbe4543[_0x319b('0x3d')],{'$or':_[_0x319b('0x2d')](_0xbe4543[_0x319b('0x37')],function(_0xd9e43b){var _0x23cc65={};_0x23cc65[_0xd9e43b]={'$like':'%'+_0x4d975c[_0x319b('0x33')][_0x319b('0x3c')]+'%'};return _0x23cc65;})});}_0xbe4543=_['merge']({},_0xbe4543,_0x4d975c[_0x319b('0x41')]);return _0x39cc7b['getDescriptions'](_0xbe4543);}})[_0x319b('0x27')](function(_0xd8c312){if(_0xd8c312){_0xd61b2d=_0xd8c312[_0x319b('0x39')];if(!_0x4d975c[_0x319b('0x33')][_0x319b('0x51')]('nolimit')){_0xbe4543[_0x319b('0x20')]=qs['limit'](_0x4d975c['query'][_0x319b('0x20')]);_0xbe4543[_0x319b('0x1f')]=qs['offset'](_0x4d975c[_0x319b('0x33')][_0x319b('0x1f')]);}return _0x39cc7b[_0x319b('0x52')](_0xbe4543);}})[_0x319b('0x27')](function(_0x220002){if(_0x220002){return _0x220002?{'count':_0xd61b2d,'rows':_0x220002}:null;}})[_0x319b('0x27')](respondWithResult(_0x24cc64,null))[_0x319b('0x47')](handleError(_0x24cc64,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 89490fc..9fd7cee 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 _0x7334=['exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x295ea9,_0x19d658){var _0x59a3fe=function(_0x35be54){while(--_0x35be54){_0x295ea9['push'](_0x295ea9['shift']());}};_0x59a3fe(++_0x19d658);}(_0x7334,0x184));var _0x4733=function(_0x1746db,_0x2bdef5){_0x1746db=_0x1746db-0x0;var _0x5f3262=_0x7334[_0x1746db];return _0x5f3262;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var logger=require(_0x4733('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4733('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4733('0x4'));var rimraf=require(_0x4733('0x5'));var config=require(_0x4733('0x6'));var attributes=require(_0x4733('0x7'));module[_0x4733('0x8')]=function(_0x449ead,_0x16d7cc){return _0x449ead[_0x4733('0x9')](_0x4733('0xa'),attributes,{'tableName':_0x4733('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab23=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xab23,0x1bc));var _0x3ab2=function(_0x50d4ea,_0x1ef246){_0x50d4ea=_0x50d4ea-0x0;var _0x539f1b=_0xab23[_0x50d4ea];return _0x539f1b;};'use strict';var _=require(_0x3ab2('0x0'));var util=require(_0x3ab2('0x1'));var logger=require(_0x3ab2('0x2'))(_0x3ab2('0x3'));var moment=require(_0x3ab2('0x4'));var BPromise=require(_0x3ab2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ab2('0x6'));var rimraf=require(_0x3ab2('0x7'));var config=require(_0x3ab2('0x8'));var attributes=require(_0x3ab2('0x9'));module['exports']=function(_0x5222ba,_0x3445f2){return _0x5222ba['define']('ServicenowConfiguration',attributes,{'tableName':_0x3ab2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 680d37e..d55d023 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 _0x836c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x2bddf9,_0x22c873){var _0x3f3ae9=function(_0x2d91ac){while(--_0x2d91ac){_0x2bddf9['push'](_0x2bddf9['shift']());}};_0x3f3ae9(++_0x22c873);}(_0x836c,0x11f));var _0xc836=function(_0x1c40e7,_0x5df659){_0x1c40e7=_0x1c40e7-0x0;var _0x21d691=_0x836c[_0x1c40e7];return _0x21d691;};'use strict';var _=require(_0xc836('0x0'));var util=require(_0xc836('0x1'));var moment=require(_0xc836('0x2'));var BPromise=require(_0xc836('0x3'));var rs=require(_0xc836('0x4'));var fs=require('fs');var Redis=require(_0xc836('0x5'));var db=require(_0xc836('0x6'))['db'];var utils=require(_0xc836('0x7'));var logger=require(_0xc836('0x8'))(_0xc836('0x9'));var config=require(_0xc836('0xa'));var jayson=require(_0xc836('0xb'));var client=jayson[_0xc836('0xc')][_0xc836('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x10f5f4,_0x18515a,_0x516dea){return new BPromise(function(_0x3ef4e0,_0x1c5f87){return client[_0xc836('0xe')](_0x10f5f4,_0x516dea)['then'](function(_0x414211){logger[_0xc836('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x18515a,_0xc836('0x10'));logger[_0xc836('0x11')](_0xc836('0x12'),_0x18515a,_0xc836('0x10'),JSON['stringify'](_0x414211));if(_0x414211[_0xc836('0x13')]){if(_0x414211[_0xc836('0x13')]['code']===0x1f4){logger[_0xc836('0x13')](_0xc836('0x14'),_0x18515a,_0x414211[_0xc836('0x13')][_0xc836('0x15')]);return _0x1c5f87(_0x414211[_0xc836('0x13')][_0xc836('0x15')]);}logger[_0xc836('0x13')](_0xc836('0x14'),_0x18515a,_0x414211['error'][_0xc836('0x15')]);return _0x3ef4e0(_0x414211[_0xc836('0x13')][_0xc836('0x15')]);}else{logger[_0xc836('0xf')](_0xc836('0x14'),_0x18515a,_0xc836('0x10'));_0x3ef4e0(_0x414211[_0xc836('0x16')][_0xc836('0x15')]);}})[_0xc836('0x17')](function(_0x1dbfe9){logger[_0xc836('0x13')](_0xc836('0x14'),_0x18515a,_0x1dbfe9);_0x1c5f87(_0x1dbfe9);});});} \ No newline at end of file +var _0x0f25=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0f25,0xdf));var _0x50f2=function(_0x28e15d,_0x180107){_0x28e15d=_0x28e15d-0x0;var _0x9d2e35=_0x0f25[_0x28e15d];return _0x9d2e35;};'use strict';var _=require(_0x50f2('0x0'));var util=require(_0x50f2('0x1'));var moment=require('moment');var BPromise=require(_0x50f2('0x2'));var rs=require(_0x50f2('0x3'));var fs=require('fs');var Redis=require(_0x50f2('0x4'));var db=require(_0x50f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x50f2('0x6'));var config=require(_0x50f2('0x7'));var jayson=require(_0x50f2('0x8'));var client=jayson[_0x50f2('0x9')][_0x50f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x379d0b,_0x19e3ce,_0x1dd289){return new BPromise(function(_0x191e17,_0x429f8c){return client['request'](_0x379d0b,_0x1dd289)['then'](function(_0x18f8c9){logger[_0x50f2('0xb')](_0x50f2('0xc'),_0x19e3ce,_0x50f2('0xd'));logger[_0x50f2('0xe')](_0x50f2('0xf'),_0x19e3ce,_0x50f2('0xd'),JSON[_0x50f2('0x10')](_0x18f8c9));if(_0x18f8c9[_0x50f2('0x11')]){if(_0x18f8c9[_0x50f2('0x11')][_0x50f2('0x12')]===0x1f4){logger[_0x50f2('0x11')](_0x50f2('0xc'),_0x19e3ce,_0x18f8c9[_0x50f2('0x11')][_0x50f2('0x13')]);return _0x429f8c(_0x18f8c9['error'][_0x50f2('0x13')]);}logger[_0x50f2('0x11')](_0x50f2('0xc'),_0x19e3ce,_0x18f8c9['error'][_0x50f2('0x13')]);return _0x191e17(_0x18f8c9[_0x50f2('0x11')]['message']);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x19e3ce,_0x50f2('0xd'));_0x191e17(_0x18f8c9[_0x50f2('0x14')][_0x50f2('0x13')]);}})[_0x50f2('0x15')](function(_0x254f5f){logger[_0x50f2('0x11')](_0x50f2('0xc'),_0x19e3ce,_0x254f5f);_0x429f8c(_0x254f5f);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index fb5d225..5ff02cd 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 _0x4147=['exports','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x21a276,_0xd2ff4e){var _0x17a4cb=function(_0x3e161c){while(--_0x3e161c){_0x21a276['push'](_0x21a276['shift']());}};_0x17a4cb(++_0xd2ff4e);}(_0x4147,0x89));var _0x7414=function(_0x227109,_0x274feb){_0x227109=_0x227109-0x0;var _0x43698c=_0x4147[_0x227109];return _0x43698c;};'use strict';var multer=require(_0x7414('0x0'));var util=require(_0x7414('0x1'));var path=require(_0x7414('0x2'));var timeout=require(_0x7414('0x3'));var express=require('express');var router=express[_0x7414('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7414('0x5'));var controller=require('./intServicenowField.controller');router[_0x7414('0x6')]('/',auth[_0x7414('0x7')](),controller['index']);router['get'](_0x7414('0x8'),auth[_0x7414('0x7')](),controller[_0x7414('0x9')]);router[_0x7414('0xa')]('/',auth['isAuthenticated'](),controller[_0x7414('0xb')]);router[_0x7414('0xc')](_0x7414('0x8'),auth[_0x7414('0x7')](),controller[_0x7414('0xd')]);router[_0x7414('0xe')](_0x7414('0x8'),auth['isAuthenticated'](),controller[_0x7414('0xf')]);module[_0x7414('0x10')]=router; \ No newline at end of file +var _0xee69=['put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x404d8d,_0x5daf97){var _0x3281d5=function(_0x456ee8){while(--_0x456ee8){_0x404d8d['push'](_0x404d8d['shift']());}};_0x3281d5(++_0x5daf97);}(_0xee69,0x1ad));var _0x9ee6=function(_0x7161ee,_0x5dc9cd){_0x7161ee=_0x7161ee-0x0;var _0x297f09=_0xee69[_0x7161ee];return _0x297f09;};'use strict';var multer=require(_0x9ee6('0x0'));var util=require('util');var path=require(_0x9ee6('0x1'));var timeout=require(_0x9ee6('0x2'));var express=require(_0x9ee6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9ee6('0x4'));var config=require(_0x9ee6('0x5'));var controller=require('./intServicenowField.controller');router[_0x9ee6('0x6')]('/',auth['isAuthenticated'](),controller[_0x9ee6('0x7')]);router['get'](_0x9ee6('0x8'),auth[_0x9ee6('0x9')](),controller[_0x9ee6('0xa')]);router[_0x9ee6('0xb')]('/',auth[_0x9ee6('0x9')](),controller[_0x9ee6('0xc')]);router[_0x9ee6('0xd')]('/:id',auth[_0x9ee6('0x9')](),controller['update']);router[_0x9ee6('0xe')](_0x9ee6('0x8'),auth[_0x9ee6('0x9')](),controller[_0x9ee6('0xf')]);module[_0x9ee6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 31ee917..852d851 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 _0xe85c=['sequelize','exports','ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe85c,0x1a7));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xce85('0x0'));module[_0xce85('0x1')]={'type':{'type':Sequelize[_0xce85('0x2')]('string',_0xce85('0x3'),_0xce85('0x4'),'keyValue',_0xce85('0x5')),'defaultValue':_0xce85('0x6')},'content':{'type':Sequelize[_0xce85('0x7')]},'key':{'type':Sequelize[_0xce85('0x7')]},'keyType':{'type':Sequelize[_0xce85('0x2')](_0xce85('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xce85('0x7')]},'idField':{'type':Sequelize[_0xce85('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xce85('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce85('0x7')]}}; \ No newline at end of file +var _0x1fa6=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x47c902,_0x220fd2){var _0x1ad6a0=function(_0xf9fdb0){while(--_0xf9fdb0){_0x47c902['push'](_0x47c902['shift']());}};_0x1ad6a0(++_0x220fd2);}(_0x1fa6,0x197));var _0x61fa=function(_0x372ec9,_0x459793){_0x372ec9=_0x372ec9-0x0;var _0x276275=_0x1fa6[_0x372ec9];return _0x276275;};'use strict';var Sequelize=require(_0x61fa('0x0'));module[_0x61fa('0x1')]={'type':{'type':Sequelize['ENUM'](_0x61fa('0x2'),_0x61fa('0x3'),_0x61fa('0x4'),_0x61fa('0x5'),'picklist'),'defaultValue':_0x61fa('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x61fa('0x6')]},'keyType':{'type':Sequelize[_0x61fa('0x7')]('string',_0x61fa('0x3'),_0x61fa('0x4'))},'keyContent':{'type':Sequelize[_0x61fa('0x6')]},'idField':{'type':Sequelize[_0x61fa('0x6')]},'nameField':{'type':Sequelize[_0x61fa('0x6')]},'customField':{'type':Sequelize[_0x61fa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index ba6780d..879f3a9 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 _0xb095=['find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','ServicenowField','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params'];(function(_0x45ad23,_0x1b6f58){var _0x2b240b=function(_0x1e5566){while(--_0x1e5566){_0x45ad23['push'](_0x45ad23['shift']());}};_0x2b240b(++_0x1b6f58);}(_0xb095,0x170));var _0x5b09=function(_0x3c0d1f,_0x2f02db){_0x3c0d1f=_0x3c0d1f-0x0;var _0x3dde67=_0xb095[_0x3c0d1f];return _0x3dde67;};'use strict';var emlformat=require(_0x5b09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b09('0x1'));var jsonpatch=require(_0x5b09('0x2'));var rp=require(_0x5b09('0x3'));var moment=require(_0x5b09('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5b09('0x5'));var util=require(_0x5b09('0x6'));var path=require('path');var sox=require(_0x5b09('0x7'));var csv=require(_0x5b09('0x8'));var ejs=require(_0x5b09('0x9'));var fs=require('fs');var fs_extra=require(_0x5b09('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5b09('0xb'));var jsforce=require(_0x5b09('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b09('0xd'));var Papa=require(_0x5b09('0xe'));var Redis=require(_0x5b09('0xf'));var authService=require(_0x5b09('0x10'));var qs=require(_0x5b09('0x11'));var as=require(_0x5b09('0x12'));var hardwareService=require(_0x5b09('0x13'));var logger=require(_0x5b09('0x14'))(_0x5b09('0x15'));var utils=require(_0x5b09('0x16'));var config=require(_0x5b09('0x17'));var licenseUtil=require(_0x5b09('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x239eb2,_0x571a7d){_0x571a7d=_0x571a7d||0xcc;return function(_0x51094e){if(_0x51094e){return _0x239eb2[_0x5b09('0x19')](_0x571a7d);}return _0x239eb2[_0x5b09('0x1a')](_0x571a7d)[_0x5b09('0x1b')]();};}function respondWithResult(_0x475fe9,_0x360722){_0x360722=_0x360722||0xc8;return function(_0x266b2d){if(_0x266b2d){return _0x475fe9[_0x5b09('0x1a')](_0x360722)[_0x5b09('0x1c')](_0x266b2d);}};}function respondWithFilteredResult(_0x18f10a,_0x23a40d){return function(_0x24a130){if(_0x24a130){var _0x304223=typeof _0x23a40d['offset']===_0x5b09('0x1d')&&typeof _0x23a40d[_0x5b09('0x1e')]===_0x5b09('0x1d');var _0x261c4a=_0x24a130[_0x5b09('0x1f')];var _0x153b9a=_0x304223?0x0:_0x23a40d['offset'];var _0x30124f=_0x304223?_0x24a130['count']:_0x23a40d[_0x5b09('0x20')]+_0x23a40d[_0x5b09('0x1e')];var _0xcdd587;if(_0x30124f>=_0x261c4a){_0x30124f=_0x261c4a;_0xcdd587=0xc8;}else{_0xcdd587=0xce;}_0x18f10a[_0x5b09('0x1a')](_0xcdd587);return _0x18f10a[_0x5b09('0x21')](_0x5b09('0x22'),_0x153b9a+'-'+_0x30124f+'/'+_0x261c4a)[_0x5b09('0x1c')](_0x24a130);}return null;};}function patchUpdates(_0x13b8f4){return function(_0x6c7ddd){try{jsonpatch['apply'](_0x6c7ddd,_0x13b8f4,!![]);}catch(_0x40b2a9){return BPromise[_0x5b09('0x23')](_0x40b2a9);}return _0x6c7ddd[_0x5b09('0x24')]();};}function saveUpdates(_0x37c674,_0x2c49f0){return function(_0x3b1c30){if(_0x3b1c30){return _0x3b1c30['update'](_0x37c674)[_0x5b09('0x25')](function(_0x3f1f9d){return _0x3f1f9d;});}return null;};}function removeEntity(_0x4629f9,_0x2a0ac4){return function(_0x1540c2){if(_0x1540c2){return _0x1540c2[_0x5b09('0x26')]()['then'](function(){_0x4629f9[_0x5b09('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x363e35,_0x18221b){return function(_0x26080a){if(!_0x26080a){_0x363e35[_0x5b09('0x19')](0x194);}return _0x26080a;};}function handleError(_0x383344,_0xb641b1){_0xb641b1=_0xb641b1||0x1f4;return function(_0x242db0){logger[_0x5b09('0x27')](_0x242db0[_0x5b09('0x28')]);if(_0x242db0[_0x5b09('0x29')]){delete _0x242db0[_0x5b09('0x29')];}_0x383344[_0x5b09('0x1a')](_0xb641b1)[_0x5b09('0x2a')](_0x242db0);};}exports['index']=function(_0x527f1f,_0x4c2289){var _0xcd0380={},_0x53bd3d={},_0x5ec513={'count':0x0,'rows':[]};var _0xcf1709=_[_0x5b09('0x2b')](db[_0x5b09('0x2c')][_0x5b09('0x2d')],function(_0x3a3fcd){return{'name':_0x3a3fcd[_0x5b09('0x2e')],'type':_0x3a3fcd['type'][_0x5b09('0x2f')]};});_0x53bd3d['model']=_[_0x5b09('0x2b')](_0xcf1709,'name');_0x53bd3d[_0x5b09('0x30')]=_[_0x5b09('0x31')](_0x527f1f[_0x5b09('0x30')]);_0x53bd3d['filters']=_[_0x5b09('0x32')](_0x53bd3d[_0x5b09('0x33')],_0x53bd3d[_0x5b09('0x30')]);_0xcd0380[_0x5b09('0x34')]=_[_0x5b09('0x32')](_0x53bd3d[_0x5b09('0x33')],qs['fields'](_0x527f1f[_0x5b09('0x30')][_0x5b09('0x35')]));_0xcd0380[_0x5b09('0x34')]=_0xcd0380[_0x5b09('0x34')][_0x5b09('0x36')]?_0xcd0380[_0x5b09('0x34')]:_0x53bd3d[_0x5b09('0x33')];if(!_0x527f1f[_0x5b09('0x30')]['hasOwnProperty'](_0x5b09('0x37'))){_0xcd0380[_0x5b09('0x1e')]=qs[_0x5b09('0x1e')](_0x527f1f['query'][_0x5b09('0x1e')]);_0xcd0380['offset']=qs[_0x5b09('0x20')](_0x527f1f['query'][_0x5b09('0x20')]);}_0xcd0380['order']=qs[_0x5b09('0x38')](_0x527f1f[_0x5b09('0x30')][_0x5b09('0x38')]);_0xcd0380[_0x5b09('0x39')]=qs[_0x5b09('0x3a')](_['pick'](_0x527f1f[_0x5b09('0x30')],_0x53bd3d['filters']),_0xcf1709);if(_0x527f1f[_0x5b09('0x30')][_0x5b09('0x3b')]){_0xcd0380[_0x5b09('0x39')]=_[_0x5b09('0x3c')](_0xcd0380[_0x5b09('0x39')],{'$or':_[_0x5b09('0x2b')](_0xcf1709,function(_0x41897d){if(_0x41897d[_0x5b09('0x3d')]!==_0x5b09('0x3e')){var _0x29e5ae={};_0x29e5ae[_0x41897d[_0x5b09('0x29')]]={'$like':'%'+_0x527f1f[_0x5b09('0x30')][_0x5b09('0x3b')]+'%'};return _0x29e5ae;}})});}_0xcd0380=_['merge']({},_0xcd0380,_0x527f1f[_0x5b09('0x3f')]);var _0x41851a={'where':_0xcd0380[_0x5b09('0x39')]};return db[_0x5b09('0x2c')]['count'](_0x41851a)[_0x5b09('0x25')](function(_0x2ce99b){_0x5ec513[_0x5b09('0x1f')]=_0x2ce99b;if(_0x527f1f[_0x5b09('0x30')][_0x5b09('0x40')]){_0xcd0380[_0x5b09('0x41')]=[{'all':!![]}];}return db['ServicenowField'][_0x5b09('0x42')](_0xcd0380);})[_0x5b09('0x25')](function(_0x4e9244){_0x5ec513['rows']=_0x4e9244;return _0x5ec513;})[_0x5b09('0x25')](respondWithFilteredResult(_0x4c2289,_0xcd0380))[_0x5b09('0x43')](handleError(_0x4c2289,null));};exports[_0x5b09('0x44')]=function(_0x563ab1,_0x296e6e){var _0xb789e4={'raw':!![],'where':{'id':_0x563ab1[_0x5b09('0x45')]['id']}},_0x3a01a9={};_0x3a01a9[_0x5b09('0x33')]=_[_0x5b09('0x31')](db['ServicenowField']['rawAttributes']);_0x3a01a9[_0x5b09('0x30')]=_['keys'](_0x563ab1['query']);_0x3a01a9['filters']=_[_0x5b09('0x32')](_0x3a01a9[_0x5b09('0x33')],_0x3a01a9['query']);_0xb789e4[_0x5b09('0x34')]=_[_0x5b09('0x32')](_0x3a01a9[_0x5b09('0x33')],qs[_0x5b09('0x35')](_0x563ab1[_0x5b09('0x30')][_0x5b09('0x35')]));_0xb789e4[_0x5b09('0x34')]=_0xb789e4['attributes']['length']?_0xb789e4[_0x5b09('0x34')]:_0x3a01a9[_0x5b09('0x33')];if(_0x563ab1[_0x5b09('0x30')]['includeAll']){_0xb789e4[_0x5b09('0x41')]=[{'all':!![]}];}_0xb789e4=_[_0x5b09('0x3c')]({},_0xb789e4,_0x563ab1[_0x5b09('0x3f')]);return db['ServicenowField'][_0x5b09('0x46')](_0xb789e4)[_0x5b09('0x25')](handleEntityNotFound(_0x296e6e,null))[_0x5b09('0x25')](respondWithResult(_0x296e6e,null))[_0x5b09('0x43')](handleError(_0x296e6e,null));};exports[_0x5b09('0x47')]=function(_0x4c5d32,_0x353676){return db['ServicenowField'][_0x5b09('0x47')](_0x4c5d32['body'],{})[_0x5b09('0x25')](respondWithResult(_0x353676,0xc9))[_0x5b09('0x43')](handleError(_0x353676,null));};exports['update']=function(_0x4d02c4,_0x1b58d4){if(_0x4d02c4[_0x5b09('0x48')]['id']){delete _0x4d02c4[_0x5b09('0x48')]['id'];}return db[_0x5b09('0x2c')]['find']({'where':{'id':_0x4d02c4[_0x5b09('0x45')]['id']}})['then'](handleEntityNotFound(_0x1b58d4,null))[_0x5b09('0x25')](saveUpdates(_0x4d02c4[_0x5b09('0x48')],null))[_0x5b09('0x25')](respondWithResult(_0x1b58d4,null))[_0x5b09('0x43')](handleError(_0x1b58d4,null));};exports[_0x5b09('0x26')]=function(_0x5e4265,_0x1baefb){return db[_0x5b09('0x2c')][_0x5b09('0x46')]({'where':{'id':_0x5e4265[_0x5b09('0x45')]['id']}})[_0x5b09('0x25')](handleEntityNotFound(_0x1baefb,null))[_0x5b09('0x25')](removeEntity(_0x1baefb,null))[_0x5b09('0x43')](handleError(_0x1baefb,null));}; \ No newline at end of file +var _0x0982=['show','params','rawAttributes','include','find','body','destroy','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','error','name','send','index','ServicenowField','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x0982,0x1cf));var _0x2098=function(_0x78083,_0x4bdc4b){_0x78083=_0x78083-0x0;var _0x473eb3=_0x0982[_0x78083];return _0x473eb3;};'use strict';var emlformat=require(_0x2098('0x0'));var rimraf=require(_0x2098('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2098('0x2'));var moment=require(_0x2098('0x3'));var BPromise=require(_0x2098('0x4'));var Mustache=require('mustache');var util=require(_0x2098('0x5'));var path=require(_0x2098('0x6'));var sox=require(_0x2098('0x7'));var csv=require(_0x2098('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2098('0x9'));var _=require(_0x2098('0xa'));var squel=require(_0x2098('0xb'));var crypto=require(_0x2098('0xc'));var jsforce=require(_0x2098('0xd'));var deskjs=require(_0x2098('0xe'));var toCsv=require(_0x2098('0x8'));var querystring=require('querystring');var Papa=require(_0x2098('0xf'));var Redis=require(_0x2098('0x10'));var authService=require(_0x2098('0x11'));var qs=require(_0x2098('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2098('0x13'));var logger=require(_0x2098('0x14'))(_0x2098('0x15'));var utils=require(_0x2098('0x16'));var config=require(_0x2098('0x17'));var licenseUtil=require(_0x2098('0x18'));var db=require(_0x2098('0x19'))['db'];function respondWithStatusCode(_0x2e430d,_0x3076a0){_0x3076a0=_0x3076a0||0xcc;return function(_0x3eb708){if(_0x3eb708){return _0x2e430d['sendStatus'](_0x3076a0);}return _0x2e430d[_0x2098('0x1a')](_0x3076a0)[_0x2098('0x1b')]();};}function respondWithResult(_0x47bf7f,_0x3ed434){_0x3ed434=_0x3ed434||0xc8;return function(_0x5bf099){if(_0x5bf099){return _0x47bf7f[_0x2098('0x1a')](_0x3ed434)[_0x2098('0x1c')](_0x5bf099);}};}function respondWithFilteredResult(_0x2ff9e2,_0x1ff124){return function(_0x4ae8c9){if(_0x4ae8c9){var _0x1853d2=typeof _0x1ff124[_0x2098('0x1d')]===_0x2098('0x1e')&&typeof _0x1ff124[_0x2098('0x1f')]===_0x2098('0x1e');var _0x4facda=_0x4ae8c9[_0x2098('0x20')];var _0x46eea7=_0x1853d2?0x0:_0x1ff124['offset'];var _0x536ea5=_0x1853d2?_0x4ae8c9[_0x2098('0x20')]:_0x1ff124[_0x2098('0x1d')]+_0x1ff124[_0x2098('0x1f')];var _0x5b8a96;if(_0x536ea5>=_0x4facda){_0x536ea5=_0x4facda;_0x5b8a96=0xc8;}else{_0x5b8a96=0xce;}_0x2ff9e2[_0x2098('0x1a')](_0x5b8a96);return _0x2ff9e2[_0x2098('0x21')](_0x2098('0x22'),_0x46eea7+'-'+_0x536ea5+'/'+_0x4facda)[_0x2098('0x1c')](_0x4ae8c9);}return null;};}function patchUpdates(_0x3490f8){return function(_0x322309){try{jsonpatch['apply'](_0x322309,_0x3490f8,!![]);}catch(_0xa49d49){return BPromise['reject'](_0xa49d49);}return _0x322309[_0x2098('0x23')]();};}function saveUpdates(_0x397632,_0x4ba012){return function(_0x3d1fce){if(_0x3d1fce){return _0x3d1fce[_0x2098('0x24')](_0x397632)[_0x2098('0x25')](function(_0x50d8c4){return _0x50d8c4;});}return null;};}function removeEntity(_0x52f3d0,_0x179630){return function(_0x2e603b){if(_0x2e603b){return _0x2e603b['destroy']()[_0x2098('0x25')](function(){_0x52f3d0['status'](0xcc)[_0x2098('0x1b')]();});}};}function handleEntityNotFound(_0x17eaf5,_0x18c07d){return function(_0x578ef4){if(!_0x578ef4){_0x17eaf5[_0x2098('0x26')](0x194);}return _0x578ef4;};}function handleError(_0x2d29c1,_0x56686f){_0x56686f=_0x56686f||0x1f4;return function(_0x2c947f){logger[_0x2098('0x27')](_0x2c947f['stack']);if(_0x2c947f[_0x2098('0x28')]){delete _0x2c947f[_0x2098('0x28')];}_0x2d29c1[_0x2098('0x1a')](_0x56686f)[_0x2098('0x29')](_0x2c947f);};}exports[_0x2098('0x2a')]=function(_0x11dff2,_0x5d9168){var _0x1546b6={},_0x1a124c={},_0x46438e={'count':0x0,'rows':[]};var _0x3573f3=_['map'](db[_0x2098('0x2b')]['rawAttributes'],function(_0x42c5d0){return{'name':_0x42c5d0[_0x2098('0x2c')],'type':_0x42c5d0[_0x2098('0x2d')][_0x2098('0x2e')]};});_0x1a124c[_0x2098('0x2f')]=_[_0x2098('0x30')](_0x3573f3,_0x2098('0x28'));_0x1a124c['query']=_[_0x2098('0x31')](_0x11dff2[_0x2098('0x32')]);_0x1a124c['filters']=_[_0x2098('0x33')](_0x1a124c[_0x2098('0x2f')],_0x1a124c[_0x2098('0x32')]);_0x1546b6['attributes']=_[_0x2098('0x33')](_0x1a124c['model'],qs[_0x2098('0x34')](_0x11dff2['query']['fields']));_0x1546b6[_0x2098('0x35')]=_0x1546b6[_0x2098('0x35')][_0x2098('0x36')]?_0x1546b6[_0x2098('0x35')]:_0x1a124c[_0x2098('0x2f')];if(!_0x11dff2['query'][_0x2098('0x37')](_0x2098('0x38'))){_0x1546b6[_0x2098('0x1f')]=qs[_0x2098('0x1f')](_0x11dff2[_0x2098('0x32')][_0x2098('0x1f')]);_0x1546b6[_0x2098('0x1d')]=qs[_0x2098('0x1d')](_0x11dff2[_0x2098('0x32')][_0x2098('0x1d')]);}_0x1546b6[_0x2098('0x39')]=qs[_0x2098('0x3a')](_0x11dff2['query'][_0x2098('0x3a')]);_0x1546b6[_0x2098('0x3b')]=qs['filters'](_[_0x2098('0x3c')](_0x11dff2[_0x2098('0x32')],_0x1a124c[_0x2098('0x3d')]),_0x3573f3);if(_0x11dff2['query'][_0x2098('0x3e')]){_0x1546b6['where']=_[_0x2098('0x3f')](_0x1546b6[_0x2098('0x3b')],{'$or':_[_0x2098('0x30')](_0x3573f3,function(_0x30195a){if(_0x30195a[_0x2098('0x2d')]!==_0x2098('0x40')){var _0x35612f={};_0x35612f[_0x30195a['name']]={'$like':'%'+_0x11dff2[_0x2098('0x32')][_0x2098('0x3e')]+'%'};return _0x35612f;}})});}_0x1546b6=_[_0x2098('0x3f')]({},_0x1546b6,_0x11dff2[_0x2098('0x41')]);var _0x5b864c={'where':_0x1546b6[_0x2098('0x3b')]};return db[_0x2098('0x2b')]['count'](_0x5b864c)[_0x2098('0x25')](function(_0x116977){_0x46438e['count']=_0x116977;if(_0x11dff2[_0x2098('0x32')][_0x2098('0x42')]){_0x1546b6['include']=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x1546b6);})[_0x2098('0x25')](function(_0x4f3670){_0x46438e[_0x2098('0x43')]=_0x4f3670;return _0x46438e;})[_0x2098('0x25')](respondWithFilteredResult(_0x5d9168,_0x1546b6))[_0x2098('0x44')](handleError(_0x5d9168,null));};exports[_0x2098('0x45')]=function(_0x171d76,_0x16dfcb){var _0x47def5={'raw':!![],'where':{'id':_0x171d76[_0x2098('0x46')]['id']}},_0xbb3357={};_0xbb3357[_0x2098('0x2f')]=_[_0x2098('0x31')](db['ServicenowField'][_0x2098('0x47')]);_0xbb3357[_0x2098('0x32')]=_['keys'](_0x171d76['query']);_0xbb3357[_0x2098('0x3d')]=_['intersection'](_0xbb3357[_0x2098('0x2f')],_0xbb3357[_0x2098('0x32')]);_0x47def5[_0x2098('0x35')]=_[_0x2098('0x33')](_0xbb3357[_0x2098('0x2f')],qs[_0x2098('0x34')](_0x171d76[_0x2098('0x32')]['fields']));_0x47def5[_0x2098('0x35')]=_0x47def5[_0x2098('0x35')][_0x2098('0x36')]?_0x47def5[_0x2098('0x35')]:_0xbb3357[_0x2098('0x2f')];if(_0x171d76[_0x2098('0x32')][_0x2098('0x42')]){_0x47def5[_0x2098('0x48')]=[{'all':!![]}];}_0x47def5=_['merge']({},_0x47def5,_0x171d76[_0x2098('0x41')]);return db[_0x2098('0x2b')][_0x2098('0x49')](_0x47def5)[_0x2098('0x25')](handleEntityNotFound(_0x16dfcb,null))[_0x2098('0x25')](respondWithResult(_0x16dfcb,null))['catch'](handleError(_0x16dfcb,null));};exports['create']=function(_0x2bbda8,_0x1a93e9){return db[_0x2098('0x2b')]['create'](_0x2bbda8['body'],{})[_0x2098('0x25')](respondWithResult(_0x1a93e9,0xc9))[_0x2098('0x44')](handleError(_0x1a93e9,null));};exports['update']=function(_0x24b75d,_0x820020){if(_0x24b75d['body']['id']){delete _0x24b75d[_0x2098('0x4a')]['id'];}return db[_0x2098('0x2b')][_0x2098('0x49')]({'where':{'id':_0x24b75d[_0x2098('0x46')]['id']}})[_0x2098('0x25')](handleEntityNotFound(_0x820020,null))[_0x2098('0x25')](saveUpdates(_0x24b75d[_0x2098('0x4a')],null))[_0x2098('0x25')](respondWithResult(_0x820020,null))[_0x2098('0x44')](handleError(_0x820020,null));};exports[_0x2098('0x4b')]=function(_0x5da81c,_0x513d9f){return db[_0x2098('0x2b')][_0x2098('0x49')]({'where':{'id':_0x5da81c[_0x2098('0x46')]['id']}})['then'](handleEntityNotFound(_0x513d9f,null))['then'](removeEntity(_0x513d9f,null))['catch'](handleError(_0x513d9f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 586e99c..0760414 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 _0x9fe9=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x56168e,_0x5a51b4){var _0x26441d=function(_0x58d5ab){while(--_0x58d5ab){_0x56168e['push'](_0x56168e['shift']());}};_0x26441d(++_0x5a51b4);}(_0x9fe9,0x1c6));var _0x99fe=function(_0x4e750a,_0x4b9ce7){_0x4e750a=_0x4e750a-0x0;var _0xd7f6a2=_0x9fe9[_0x4e750a];return _0xd7f6a2;};'use strict';var _=require(_0x99fe('0x0'));var util=require(_0x99fe('0x1'));var logger=require(_0x99fe('0x2'))(_0x99fe('0x3'));var moment=require('moment');var BPromise=require(_0x99fe('0x4'));var rp=require(_0x99fe('0x5'));var fs=require('fs');var path=require(_0x99fe('0x6'));var rimraf=require(_0x99fe('0x7'));var config=require(_0x99fe('0x8'));var attributes=require(_0x99fe('0x9'));module[_0x99fe('0xa')]=function(_0x167368,_0x2df0c6){return _0x167368['define'](_0x99fe('0xb'),attributes,{'tableName':_0x99fe('0xc'),'paranoid':![],'indexes':[{'name':_0x99fe('0xd'),'fields':[_0x99fe('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9fc2=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x9fc2,0xec));var _0x29fc=function(_0xe12368,_0x5ec6e7){_0xe12368=_0xe12368-0x0;var _0x2f541c=_0x9fc2[_0xe12368];return _0x2f541c;};'use strict';var _=require(_0x29fc('0x0'));var util=require(_0x29fc('0x1'));var logger=require(_0x29fc('0x2'))(_0x29fc('0x3'));var moment=require(_0x29fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x29fc('0x5'));var fs=require('fs');var path=require(_0x29fc('0x6'));var rimraf=require(_0x29fc('0x7'));var config=require(_0x29fc('0x8'));var attributes=require(_0x29fc('0x9'));module[_0x29fc('0xa')]=function(_0x19e176,_0x341b03){return _0x19e176[_0x29fc('0xb')](_0x29fc('0xc'),attributes,{'tableName':_0x29fc('0xd'),'paranoid':![],'indexes':[{'name':_0x29fc('0xe'),'fields':[_0x29fc('0xf'),_0x29fc('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 1358964..4adfe47 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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x8a4cfe,_0x3d335d){var _0x4abe7b=function(_0x40a001){while(--_0x40a001){_0x8a4cfe['push'](_0x8a4cfe['shift']());}};_0x4abe7b(++_0x3d335d);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1f73de,_0x2dac7a){_0x1f73de=_0x1f73de-0x0;var _0xecf07=_0x9ffd[_0x1f73de];return _0xecf07;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x387caa,_0x48bb57){var _0x54c738=function(_0x295c8a){while(--_0x295c8a){_0x387caa['push'](_0x387caa['shift']());}};_0x54c738(++_0x48bb57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index f8f83eb..a4acc1e 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(_0x1a83a1,_0x153ecf){var _0xa2b282=function(_0x489f96){while(--_0x489f96){_0x1a83a1['push'](_0x1a83a1['shift']());}};_0xa2b282(++_0x153ecf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x35a5cd,_0x497d7b){var _0x5e1c9c=function(_0x438ebc){while(--_0x438ebc){_0x35a5cd['push'](_0x35a5cd['shift']());}};_0x5e1c9c(++_0x497d7b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index e8b277a..9e9ad4a 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(_0x349b1b,_0x3fb33a){var _0x17be9c=function(_0x5b0799){while(--_0x5b0799){_0x349b1b['push'](_0x349b1b['shift']());}};_0x17be9c(++_0x3fb33a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x2e22e5,_0x4c2356){var _0x20c4e5=function(_0x4b9999){while(--_0x4b9999){_0x2e22e5['push'](_0x2e22e5['shift']());}};_0x20c4e5(++_0x4c2356);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 7a6105e..d7df695 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 _0xcad9=['bluebird','mustache','util','path','sox','to-csv','fs-extra','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','findOne','SugarcrmConfiguration','hasOwnProperty','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','Calls','values','module_fields','remove','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xa21d4f,_0x29c71b){var _0x30e94d=function(_0x2c9484){while(--_0x2c9484){_0xa21d4f['push'](_0xa21d4f['shift']());}};_0x30e94d(++_0x29c71b);}(_0xcad9,0x7b));var _0x9cad=function(_0x14d85f,_0x1fe9ec){_0x14d85f=_0x14d85f-0x0;var _0x8b6fe0=_0xcad9[_0x14d85f];return _0x8b6fe0;};'use strict';var emlformat=require(_0x9cad('0x0'));var rimraf=require(_0x9cad('0x1'));var zipdir=require(_0x9cad('0x2'));var jsonpatch=require(_0x9cad('0x3'));var rp=require(_0x9cad('0x4'));var moment=require('moment');var BPromise=require(_0x9cad('0x5'));var Mustache=require(_0x9cad('0x6'));var util=require(_0x9cad('0x7'));var path=require(_0x9cad('0x8'));var sox=require(_0x9cad('0x9'));var csv=require(_0x9cad('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cad('0xb'));var _=require('lodash');var squel=require(_0x9cad('0xc'));var crypto=require(_0x9cad('0xd'));var jsforce=require(_0x9cad('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9cad('0xf'));var Papa=require(_0x9cad('0x10'));var Redis=require(_0x9cad('0x11'));var authService=require(_0x9cad('0x12'));var qs=require(_0x9cad('0x13'));var as=require(_0x9cad('0x14'));var hardwareService=require(_0x9cad('0x15'));var logger=require('../../config/logger')(_0x9cad('0x16'));var utils=require(_0x9cad('0x17'));var config=require(_0x9cad('0x18'));var licenseUtil=require(_0x9cad('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9cad('0x1a'));function respondWithStatusCode(_0x4c8b50,_0x4f7403){_0x4f7403=_0x4f7403||0xcc;return function(_0x2cb293){if(_0x2cb293){return _0x4c8b50[_0x9cad('0x1b')](_0x4f7403);}return _0x4c8b50[_0x9cad('0x1c')](_0x4f7403)[_0x9cad('0x1d')]();};}function respondWithResult(_0x171054,_0xa49d52){_0xa49d52=_0xa49d52||0xc8;return function(_0x3d33bb){if(_0x3d33bb){return _0x171054[_0x9cad('0x1c')](_0xa49d52)[_0x9cad('0x1e')](_0x3d33bb);}};}function respondWithFilteredResult(_0x556cf9,_0x3a1e22){return function(_0x36e1d1){if(_0x36e1d1){var _0x1937eb=typeof _0x3a1e22[_0x9cad('0x1f')]===_0x9cad('0x20')&&typeof _0x3a1e22[_0x9cad('0x21')]==='undefined';var _0x21c79b=_0x36e1d1[_0x9cad('0x22')];var _0x2d2afe=_0x1937eb?0x0:_0x3a1e22[_0x9cad('0x1f')];var _0x5f5434=_0x1937eb?_0x36e1d1['count']:_0x3a1e22[_0x9cad('0x1f')]+_0x3a1e22[_0x9cad('0x21')];var _0x1247ed;if(_0x5f5434>=_0x21c79b){_0x5f5434=_0x21c79b;_0x1247ed=0xc8;}else{_0x1247ed=0xce;}_0x556cf9['status'](_0x1247ed);return _0x556cf9['set'](_0x9cad('0x23'),_0x2d2afe+'-'+_0x5f5434+'/'+_0x21c79b)[_0x9cad('0x1e')](_0x36e1d1);}return null;};}function patchUpdates(_0x4f0150){return function(_0x1caad6){try{jsonpatch[_0x9cad('0x24')](_0x1caad6,_0x4f0150,!![]);}catch(_0x28a1f7){return BPromise['reject'](_0x28a1f7);}return _0x1caad6[_0x9cad('0x25')]();};}function saveUpdates(_0x52203b,_0x384b85){return function(_0xd34b22){if(_0xd34b22){return _0xd34b22[_0x9cad('0x26')](_0x52203b)[_0x9cad('0x27')](function(_0x4d3442){return _0x4d3442;});}return null;};}function removeEntity(_0x4e6e6d,_0x19f4c1){return function(_0x575df5){if(_0x575df5){return _0x575df5[_0x9cad('0x28')]()[_0x9cad('0x27')](function(){_0x4e6e6d['status'](0xcc)[_0x9cad('0x1d')]();});}};}function handleEntityNotFound(_0x5b3762,_0x1a3503){return function(_0x5c8bf3){if(!_0x5c8bf3){_0x5b3762[_0x9cad('0x1b')](0x194);}return _0x5c8bf3;};}function handleError(_0x567151,_0x2743b7){_0x2743b7=_0x2743b7||0x1f4;return function(_0x299d4a){logger[_0x9cad('0x29')](_0x299d4a[_0x9cad('0x2a')]);if(_0x299d4a['name']){delete _0x299d4a[_0x9cad('0x2b')];}_0x567151[_0x9cad('0x1c')](_0x2743b7)['send'](_0x299d4a);};}exports[_0x9cad('0x2c')]=function(_0x21fda0,_0x5c6c23){var _0x4a7446={},_0x282217={},_0x33ceb4={'count':0x0,'rows':[]};var _0x14b1fb=_[_0x9cad('0x2d')](db['SugarcrmAccount'][_0x9cad('0x2e')],function(_0x4c265e){return{'name':_0x4c265e[_0x9cad('0x2f')],'type':_0x4c265e[_0x9cad('0x30')][_0x9cad('0x31')]};});_0x282217[_0x9cad('0x32')]=_[_0x9cad('0x2d')](_0x14b1fb,_0x9cad('0x2b'));_0x282217[_0x9cad('0x33')]=_[_0x9cad('0x34')](_0x21fda0['query']);_0x282217[_0x9cad('0x35')]=_[_0x9cad('0x36')](_0x282217[_0x9cad('0x32')],_0x282217[_0x9cad('0x33')]);_0x4a7446[_0x9cad('0x37')]=_[_0x9cad('0x36')](_0x282217[_0x9cad('0x32')],qs[_0x9cad('0x38')](_0x21fda0[_0x9cad('0x33')][_0x9cad('0x38')]));_0x4a7446['attributes']=_0x4a7446['attributes'][_0x9cad('0x39')]?_0x4a7446[_0x9cad('0x37')]:_0x282217[_0x9cad('0x32')];if(!_0x21fda0[_0x9cad('0x33')]['hasOwnProperty'](_0x9cad('0x3a'))){_0x4a7446['limit']=qs['limit'](_0x21fda0[_0x9cad('0x33')]['limit']);_0x4a7446[_0x9cad('0x1f')]=qs[_0x9cad('0x1f')](_0x21fda0[_0x9cad('0x33')][_0x9cad('0x1f')]);}_0x4a7446[_0x9cad('0x3b')]=qs[_0x9cad('0x3c')](_0x21fda0[_0x9cad('0x33')][_0x9cad('0x3c')]);_0x4a7446['where']=qs['filters'](_[_0x9cad('0x3d')](_0x21fda0['query'],_0x282217[_0x9cad('0x35')]),_0x14b1fb);if(_0x21fda0[_0x9cad('0x33')][_0x9cad('0x3e')]){_0x4a7446['where']=_[_0x9cad('0x3f')](_0x4a7446[_0x9cad('0x40')],{'$or':_[_0x9cad('0x2d')](_0x14b1fb,function(_0x236655){if(_0x236655[_0x9cad('0x30')]!==_0x9cad('0x41')){var _0xf113f2={};_0xf113f2[_0x236655[_0x9cad('0x2b')]]={'$like':'%'+_0x21fda0[_0x9cad('0x33')][_0x9cad('0x3e')]+'%'};return _0xf113f2;}})});}_0x4a7446=_['merge']({},_0x4a7446,_0x21fda0['options']);var _0x10b4eb={'where':_0x4a7446[_0x9cad('0x40')]};return db[_0x9cad('0x42')]['count'](_0x10b4eb)[_0x9cad('0x27')](function(_0x5d5fa2){_0x33ceb4[_0x9cad('0x22')]=_0x5d5fa2;if(_0x21fda0[_0x9cad('0x33')][_0x9cad('0x43')]){_0x4a7446[_0x9cad('0x44')]=[{'all':!![]}];}return db[_0x9cad('0x42')][_0x9cad('0x45')](_0x4a7446);})[_0x9cad('0x27')](function(_0x18ce39){_0x33ceb4[_0x9cad('0x46')]=_0x18ce39;return _0x33ceb4;})[_0x9cad('0x27')](respondWithFilteredResult(_0x5c6c23,_0x4a7446))[_0x9cad('0x47')](handleError(_0x5c6c23,null));};exports[_0x9cad('0x48')]=function(_0x14361f,_0x243ea5){var _0x439216={'raw':![],'where':{'id':_0x14361f[_0x9cad('0x49')]['id']}},_0xbdad72={};_0xbdad72['model']=_[_0x9cad('0x34')](db[_0x9cad('0x42')][_0x9cad('0x2e')]);_0xbdad72[_0x9cad('0x33')]=_[_0x9cad('0x34')](_0x14361f['query']);_0xbdad72['filters']=_[_0x9cad('0x36')](_0xbdad72[_0x9cad('0x32')],_0xbdad72[_0x9cad('0x33')]);_0x439216[_0x9cad('0x37')]=_[_0x9cad('0x36')](_0xbdad72[_0x9cad('0x32')],qs[_0x9cad('0x38')](_0x14361f[_0x9cad('0x33')][_0x9cad('0x38')]));_0x439216[_0x9cad('0x37')]=_0x439216['attributes'][_0x9cad('0x39')]?_0x439216[_0x9cad('0x37')]:_0xbdad72[_0x9cad('0x32')];if(_0x14361f[_0x9cad('0x33')]['includeAll']){_0x439216[_0x9cad('0x44')]=[{'all':!![]}];}_0x439216=_[_0x9cad('0x3f')]({},_0x439216,_0x14361f[_0x9cad('0x4a')]);return db[_0x9cad('0x42')][_0x9cad('0x4b')](_0x439216)[_0x9cad('0x27')](handleEntityNotFound(_0x243ea5,null))[_0x9cad('0x27')](respondWithResult(_0x243ea5,null))['catch'](handleError(_0x243ea5,null));};exports['create']=function(_0x1cc8e5,_0x2166d4){return db[_0x9cad('0x42')][_0x9cad('0x4c')](_0x1cc8e5[_0x9cad('0x4d')],{})[_0x9cad('0x27')](respondWithResult(_0x2166d4,0xc9))['catch'](handleError(_0x2166d4,null));};exports[_0x9cad('0x26')]=function(_0x2084ba,_0x1e2eb9){if(_0x2084ba[_0x9cad('0x4d')]['id']){delete _0x2084ba[_0x9cad('0x4d')]['id'];}return db[_0x9cad('0x42')][_0x9cad('0x4b')]({'where':{'id':_0x2084ba['params']['id']}})[_0x9cad('0x27')](handleEntityNotFound(_0x1e2eb9,null))[_0x9cad('0x27')](saveUpdates(_0x2084ba[_0x9cad('0x4d')],null))[_0x9cad('0x27')](respondWithResult(_0x1e2eb9,null))[_0x9cad('0x47')](handleError(_0x1e2eb9,null));};exports['destroy']=function(_0x2e4bb0,_0x183091){return db[_0x9cad('0x42')][_0x9cad('0x4b')]({'where':{'id':_0x2e4bb0[_0x9cad('0x49')]['id']}})[_0x9cad('0x27')](handleEntityNotFound(_0x183091,null))[_0x9cad('0x27')](removeEntity(_0x183091,null))[_0x9cad('0x47')](handleError(_0x183091,null));};exports['getConfigurations']=function(_0x3a1fc0,_0x22e798,_0x56adb1){var _0x122e6e={};var _0x36d86f={};var _0x33bbc6;var _0x1172b2;return db['SugarcrmAccount'][_0x9cad('0x4e')]({'where':{'id':_0x3a1fc0['params']['id']}})[_0x9cad('0x27')](handleEntityNotFound(_0x22e798,null))[_0x9cad('0x27')](function(_0x1d72c6){if(_0x1d72c6){_0x33bbc6=_0x1d72c6;_0x36d86f[_0x9cad('0x32')]=_[_0x9cad('0x34')](db[_0x9cad('0x4f')]['rawAttributes']);_0x36d86f[_0x9cad('0x33')]=_[_0x9cad('0x34')](_0x3a1fc0[_0x9cad('0x33')]);_0x36d86f[_0x9cad('0x35')]=_[_0x9cad('0x36')](_0x36d86f[_0x9cad('0x32')],_0x36d86f[_0x9cad('0x33')]);_0x122e6e['attributes']=_[_0x9cad('0x36')](_0x36d86f[_0x9cad('0x32')],qs['fields'](_0x3a1fc0['query'][_0x9cad('0x38')]));_0x122e6e[_0x9cad('0x37')]=_0x122e6e[_0x9cad('0x37')][_0x9cad('0x39')]?_0x122e6e['attributes']:_0x36d86f['model'];_0x122e6e[_0x9cad('0x3b')]=qs[_0x9cad('0x3c')](_0x3a1fc0[_0x9cad('0x33')][_0x9cad('0x3c')]);_0x122e6e[_0x9cad('0x40')]=qs[_0x9cad('0x35')](_[_0x9cad('0x3d')](_0x3a1fc0[_0x9cad('0x33')],_0x36d86f[_0x9cad('0x35')]));if(_0x3a1fc0['query'][_0x9cad('0x3e')]){_0x122e6e[_0x9cad('0x40')]=_['merge'](_0x122e6e[_0x9cad('0x40')],{'$or':_[_0x9cad('0x2d')](_0x122e6e[_0x9cad('0x37')],function(_0xb32728){var _0xfdd977={};_0xfdd977[_0xb32728]={'$like':'%'+_0x3a1fc0[_0x9cad('0x33')][_0x9cad('0x3e')]+'%'};return _0xfdd977;})});}_0x122e6e=_[_0x9cad('0x3f')]({},_0x122e6e,_0x3a1fc0[_0x9cad('0x4a')]);return _0x33bbc6['getConfigurations'](_0x122e6e);}})[_0x9cad('0x27')](function(_0x5e1a69){if(_0x5e1a69){_0x1172b2=_0x5e1a69['length'];if(!_0x3a1fc0[_0x9cad('0x33')][_0x9cad('0x50')]('nolimit')){_0x122e6e[_0x9cad('0x21')]=qs['limit'](_0x3a1fc0[_0x9cad('0x33')][_0x9cad('0x21')]);_0x122e6e[_0x9cad('0x1f')]=qs[_0x9cad('0x1f')](_0x3a1fc0[_0x9cad('0x33')]['offset']);}return _0x33bbc6[_0x9cad('0x51')](_0x122e6e);}})[_0x9cad('0x27')](function(_0x4b7c21){if(_0x4b7c21){return _0x4b7c21?{'count':_0x1172b2,'rows':_0x4b7c21}:null;}})['then'](respondWithResult(_0x22e798,null))['catch'](handleError(_0x22e798,null));};exports['addConfiguration']=function(_0x2fd9d9,_0x9d879e,_0xbf3a12){if(_0x2fd9d9[_0x9cad('0x4d')]['id']){delete _0x2fd9d9[_0x9cad('0x4d')]['id'];}return db[_0x9cad('0x42')][_0x9cad('0x4e')]({'where':{'id':_0x2fd9d9[_0x9cad('0x49')]['id']}})[_0x9cad('0x27')](handleEntityNotFound(_0x9d879e,null))[_0x9cad('0x27')](function(_0x165b95){if(_0x165b95){_0x2fd9d9[_0x9cad('0x4d')][_0x9cad('0x52')]=_0x165b95['id'];_0x2fd9d9[_0x9cad('0x4d')][_0x9cad('0x53')]=integrations[_0x9cad('0x54')](_0x2fd9d9[_0x9cad('0x4d')]['channel'],_0x2fd9d9['body'][_0x9cad('0x30')]);_0x2fd9d9[_0x9cad('0x4d')][_0x9cad('0x55')]=integrations[_0x9cad('0x56')](_0x2fd9d9[_0x9cad('0x4d')][_0x9cad('0x57')],_0x2fd9d9[_0x9cad('0x4d')][_0x9cad('0x30')]);return db[_0x9cad('0x4f')][_0x9cad('0x4c')](_0x2fd9d9[_0x9cad('0x4d')],{'include':[{'model':db[_0x9cad('0x58')],'as':_0x9cad('0x53')},{'model':db[_0x9cad('0x58')],'as':_0x9cad('0x55')}]});}return null;})[_0x9cad('0x27')](respondWithResult(_0x9d879e,null))[_0x9cad('0x47')](handleError(_0x9d879e,null));};exports[_0x9cad('0x59')]=function(_0x17782d,_0x19e89c,_0x24998f){var _0x380922='';var _0xaae178=['id',_0x9cad('0x2b'),_0x9cad('0x5a'),_0x9cad('0x5b'),_0x9cad('0x5c'),_0x9cad('0x5d'),_0x9cad('0x5e'),_0x9cad('0x5f'),'parent_id',_0x9cad('0x60'),_0x9cad('0x61'),'direction'];return db['SugarcrmAccount'][_0x9cad('0x4e')]({'where':{'id':_0x17782d['params']['id']},'attributes':['id',_0x9cad('0x62'),'password','remoteUri']})[_0x9cad('0x27')](handleEntityNotFound(_0x19e89c,null))[_0x9cad('0x27')](function(_0x27d828){if(_0x27d828){_0x380922=_0x27d828[_0x9cad('0x63')];var _0x4adf01=_0x380922[_0x9cad('0x64')](-0x1);if(_0x4adf01==='/'){_0x380922=_0x380922[_0x9cad('0x65')](0x0,_0x380922[_0x9cad('0x66')](_0x4adf01));}return rp({'method':_0x9cad('0x67'),'uri':util[_0x9cad('0x68')](_0x9cad('0x69'),_0x380922,_0x9cad('0x6a')),'json':!![],'form':{'method':_0x9cad('0x6b'),'input_type':_0x9cad('0x6c'),'response_type':_0x9cad('0x6c'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x27d828[_0x9cad('0x62')],'password':_0x27d828[_0x9cad('0x6d')],'encryption':_0x9cad('0x6e')},'application':_0x9cad('0x6f')})}});}})['then'](function(_0x4dc6ab){if(_0x4dc6ab&&_0x4dc6ab[_0x9cad('0x2b')]!==_0x9cad('0x70')&&_0x4dc6ab[_0x9cad('0x2b')]!==_0x9cad('0x71')){return rp({'method':'POST','uri':util[_0x9cad('0x68')](_0x9cad('0x69'),_0x380922,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x9cad('0x72'),'input_type':'JSON','response_type':_0x9cad('0x6c'),'rest_data':JSON[_0x9cad('0x73')]({'session':_0x4dc6ab['id'],'module_name':_0x9cad('0x74')})}})[_0x9cad('0x27')](function(_0x510a60){if(_0x510a60){var _0x38dbfc=_[_0x9cad('0x75')](_0x510a60[_0x9cad('0x76')]);_[_0x9cad('0x77')](_0x38dbfc,function(_0xe75eb9){return _0xaae178[_0x9cad('0x78')](_0xe75eb9[_0x9cad('0x2b')]);});return{'count':_0x38dbfc[_0x9cad('0x39')],'rows':_['map'](_0x38dbfc,function(_0x2d2410){return{'id':_0x2d2410[_0x9cad('0x2b')],'name':_0x2d2410[_0x9cad('0x79')],'custom':_[_0x9cad('0x7a')](_0x2d2410[_0x9cad('0x2b')],'_c')?!![]:![],'options':_0x2d2410['options']?_['map'](_[_0x9cad('0x75')](_0x2d2410[_0x9cad('0x4a')]),function(_0x261ee9){return{'name':_0x261ee9['value'],'value':_0x261ee9[_0x9cad('0x2b')]};}):[]};})};}})['then'](respondWithResult(_0x19e89c,null))['catch'](function(_0x2870b8){var _0x4fe569=_0x17782d[_0x9cad('0x33')][_0x9cad('0x7b')]?0x1f4:_0x2870b8[_0x9cad('0x7c')]||0x1f4;logger[_0x9cad('0x29')](_0x9cad('0x7d'),_0x9cad('0x59'),_0x4fe569,JSON[_0x9cad('0x73')](_0x2870b8));delete _0x2870b8[_0x9cad('0x2b')];if(_0x4fe569===0x191){_0x4fe569=0x190;}_0x19e89c['status'](_0x4fe569)[_0x9cad('0x7e')](_0x17782d[_0x9cad('0x33')][_0x9cad('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x2870b8[_0x9cad('0x7c')]}:_0x2870b8);});}else{var _0xc4190b=0x1f4;_0x19e89c[_0x9cad('0x1c')](_0xc4190b)['send']({'message':_0x9cad('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x5df9=['key','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','module_fields','remove','includes','label','endsWith','values','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0x5df9,0x152));var _0x95df=function(_0x4da681,_0x3df36e){_0x4da681=_0x4da681-0x0;var _0x2e378d=_0x5df9[_0x4da681];return _0x2e378d;};'use strict';var emlformat=require(_0x95df('0x0'));var rimraf=require(_0x95df('0x1'));var zipdir=require(_0x95df('0x2'));var jsonpatch=require(_0x95df('0x3'));var rp=require(_0x95df('0x4'));var moment=require('moment');var BPromise=require(_0x95df('0x5'));var Mustache=require(_0x95df('0x6'));var util=require(_0x95df('0x7'));var path=require(_0x95df('0x8'));var sox=require(_0x95df('0x9'));var csv=require(_0x95df('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95df('0xb'));var _=require('lodash');var squel=require(_0x95df('0xc'));var crypto=require(_0x95df('0xd'));var jsforce=require(_0x95df('0xe'));var deskjs=require(_0x95df('0xf'));var toCsv=require(_0x95df('0xa'));var querystring=require(_0x95df('0x10'));var Papa=require('papaparse');var Redis=require(_0x95df('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x95df('0x12'));var as=require(_0x95df('0x13'));var hardwareService=require(_0x95df('0x14'));var logger=require(_0x95df('0x15'))(_0x95df('0x16'));var utils=require(_0x95df('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x95df('0x18'));var db=require(_0x95df('0x19'))['db'];var integrations=require(_0x95df('0x1a'));function respondWithStatusCode(_0x5750c6,_0x4e2486){_0x4e2486=_0x4e2486||0xcc;return function(_0x378da5){if(_0x378da5){return _0x5750c6[_0x95df('0x1b')](_0x4e2486);}return _0x5750c6[_0x95df('0x1c')](_0x4e2486)[_0x95df('0x1d')]();};}function respondWithResult(_0x23f1bb,_0x3710b7){_0x3710b7=_0x3710b7||0xc8;return function(_0x4ca51d){if(_0x4ca51d){return _0x23f1bb[_0x95df('0x1c')](_0x3710b7)[_0x95df('0x1e')](_0x4ca51d);}};}function respondWithFilteredResult(_0x291715,_0x57bbec){return function(_0x1783aa){if(_0x1783aa){var _0x503a4b=typeof _0x57bbec[_0x95df('0x1f')]===_0x95df('0x20')&&typeof _0x57bbec[_0x95df('0x21')]===_0x95df('0x20');var _0x753158=_0x1783aa[_0x95df('0x22')];var _0x12c543=_0x503a4b?0x0:_0x57bbec[_0x95df('0x1f')];var _0xfa0fe9=_0x503a4b?_0x1783aa['count']:_0x57bbec[_0x95df('0x1f')]+_0x57bbec[_0x95df('0x21')];var _0x443fd2;if(_0xfa0fe9>=_0x753158){_0xfa0fe9=_0x753158;_0x443fd2=0xc8;}else{_0x443fd2=0xce;}_0x291715['status'](_0x443fd2);return _0x291715['set'](_0x95df('0x23'),_0x12c543+'-'+_0xfa0fe9+'/'+_0x753158)[_0x95df('0x1e')](_0x1783aa);}return null;};}function patchUpdates(_0xd423c2){return function(_0x248d21){try{jsonpatch[_0x95df('0x24')](_0x248d21,_0xd423c2,!![]);}catch(_0x1e80c3){return BPromise[_0x95df('0x25')](_0x1e80c3);}return _0x248d21[_0x95df('0x26')]();};}function saveUpdates(_0x2493ad,_0x60000d){return function(_0xf86857){if(_0xf86857){return _0xf86857[_0x95df('0x27')](_0x2493ad)[_0x95df('0x28')](function(_0x47999a){return _0x47999a;});}return null;};}function removeEntity(_0x2bce93,_0x1aaf5c){return function(_0x386e29){if(_0x386e29){return _0x386e29[_0x95df('0x29')]()[_0x95df('0x28')](function(){_0x2bce93[_0x95df('0x1c')](0xcc)[_0x95df('0x1d')]();});}};}function handleEntityNotFound(_0x5b13ad,_0x4ce42f){return function(_0x464bab){if(!_0x464bab){_0x5b13ad['sendStatus'](0x194);}return _0x464bab;};}function handleError(_0x200428,_0x5f3357){_0x5f3357=_0x5f3357||0x1f4;return function(_0x1f9194){logger['error'](_0x1f9194[_0x95df('0x2a')]);if(_0x1f9194[_0x95df('0x2b')]){delete _0x1f9194[_0x95df('0x2b')];}_0x200428['status'](_0x5f3357)[_0x95df('0x2c')](_0x1f9194);};}exports['index']=function(_0x19c18b,_0x12d50f){var _0x283ec1={},_0x20fe65={},_0x34f4f2={'count':0x0,'rows':[]};var _0x35f8ab=_[_0x95df('0x2d')](db['SugarcrmAccount'][_0x95df('0x2e')],function(_0x105003){return{'name':_0x105003[_0x95df('0x2f')],'type':_0x105003[_0x95df('0x30')][_0x95df('0x31')]};});_0x20fe65[_0x95df('0x32')]=_['map'](_0x35f8ab,_0x95df('0x2b'));_0x20fe65['query']=_[_0x95df('0x33')](_0x19c18b[_0x95df('0x34')]);_0x20fe65['filters']=_[_0x95df('0x35')](_0x20fe65[_0x95df('0x32')],_0x20fe65[_0x95df('0x34')]);_0x283ec1['attributes']=_['intersection'](_0x20fe65[_0x95df('0x32')],qs[_0x95df('0x36')](_0x19c18b[_0x95df('0x34')][_0x95df('0x36')]));_0x283ec1['attributes']=_0x283ec1['attributes'][_0x95df('0x37')]?_0x283ec1[_0x95df('0x38')]:_0x20fe65[_0x95df('0x32')];if(!_0x19c18b[_0x95df('0x34')][_0x95df('0x39')](_0x95df('0x3a'))){_0x283ec1[_0x95df('0x21')]=qs[_0x95df('0x21')](_0x19c18b[_0x95df('0x34')][_0x95df('0x21')]);_0x283ec1[_0x95df('0x1f')]=qs[_0x95df('0x1f')](_0x19c18b['query'][_0x95df('0x1f')]);}_0x283ec1[_0x95df('0x3b')]=qs[_0x95df('0x3c')](_0x19c18b[_0x95df('0x34')][_0x95df('0x3c')]);_0x283ec1[_0x95df('0x3d')]=qs[_0x95df('0x3e')](_[_0x95df('0x3f')](_0x19c18b[_0x95df('0x34')],_0x20fe65['filters']),_0x35f8ab);if(_0x19c18b[_0x95df('0x34')][_0x95df('0x40')]){_0x283ec1[_0x95df('0x3d')]=_['merge'](_0x283ec1[_0x95df('0x3d')],{'$or':_[_0x95df('0x2d')](_0x35f8ab,function(_0x3c4142){if(_0x3c4142[_0x95df('0x30')]!==_0x95df('0x41')){var _0xaf06b={};_0xaf06b[_0x3c4142[_0x95df('0x2b')]]={'$like':'%'+_0x19c18b[_0x95df('0x34')]['filter']+'%'};return _0xaf06b;}})});}_0x283ec1=_[_0x95df('0x42')]({},_0x283ec1,_0x19c18b[_0x95df('0x43')]);var _0x165948={'where':_0x283ec1[_0x95df('0x3d')]};return db[_0x95df('0x44')][_0x95df('0x22')](_0x165948)[_0x95df('0x28')](function(_0x321303){_0x34f4f2[_0x95df('0x22')]=_0x321303;if(_0x19c18b[_0x95df('0x34')][_0x95df('0x45')]){_0x283ec1[_0x95df('0x46')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x95df('0x47')](_0x283ec1);})['then'](function(_0x311f3d){_0x34f4f2[_0x95df('0x48')]=_0x311f3d;return _0x34f4f2;})[_0x95df('0x28')](respondWithFilteredResult(_0x12d50f,_0x283ec1))[_0x95df('0x49')](handleError(_0x12d50f,null));};exports[_0x95df('0x4a')]=function(_0x226585,_0x1b28d8){var _0x1f78e7={'raw':![],'where':{'id':_0x226585[_0x95df('0x4b')]['id']}},_0x457d3f={};_0x457d3f['model']=_[_0x95df('0x33')](db[_0x95df('0x44')][_0x95df('0x2e')]);_0x457d3f[_0x95df('0x34')]=_[_0x95df('0x33')](_0x226585[_0x95df('0x34')]);_0x457d3f['filters']=_[_0x95df('0x35')](_0x457d3f[_0x95df('0x32')],_0x457d3f[_0x95df('0x34')]);_0x1f78e7[_0x95df('0x38')]=_[_0x95df('0x35')](_0x457d3f[_0x95df('0x32')],qs['fields'](_0x226585[_0x95df('0x34')]['fields']));_0x1f78e7[_0x95df('0x38')]=_0x1f78e7[_0x95df('0x38')]['length']?_0x1f78e7[_0x95df('0x38')]:_0x457d3f[_0x95df('0x32')];if(_0x226585[_0x95df('0x34')][_0x95df('0x45')]){_0x1f78e7[_0x95df('0x46')]=[{'all':!![]}];}_0x1f78e7=_[_0x95df('0x42')]({},_0x1f78e7,_0x226585[_0x95df('0x43')]);return db['SugarcrmAccount'][_0x95df('0x4c')](_0x1f78e7)[_0x95df('0x28')](handleEntityNotFound(_0x1b28d8,null))[_0x95df('0x28')](respondWithResult(_0x1b28d8,null))[_0x95df('0x49')](handleError(_0x1b28d8,null));};exports[_0x95df('0x4d')]=function(_0x6f53c2,_0x2e7951){return db['SugarcrmAccount'][_0x95df('0x4d')](_0x6f53c2[_0x95df('0x4e')],{})[_0x95df('0x28')](respondWithResult(_0x2e7951,0xc9))[_0x95df('0x49')](handleError(_0x2e7951,null));};exports[_0x95df('0x27')]=function(_0x49e87e,_0x41283f){if(_0x49e87e[_0x95df('0x4e')]['id']){delete _0x49e87e[_0x95df('0x4e')]['id'];}return db[_0x95df('0x44')][_0x95df('0x4c')]({'where':{'id':_0x49e87e[_0x95df('0x4b')]['id']}})[_0x95df('0x28')](handleEntityNotFound(_0x41283f,null))[_0x95df('0x28')](saveUpdates(_0x49e87e[_0x95df('0x4e')],null))['then'](respondWithResult(_0x41283f,null))[_0x95df('0x49')](handleError(_0x41283f,null));};exports[_0x95df('0x29')]=function(_0xcf400c,_0x4c2e3e){return db[_0x95df('0x44')]['find']({'where':{'id':_0xcf400c['params']['id']}})['then'](handleEntityNotFound(_0x4c2e3e,null))['then'](removeEntity(_0x4c2e3e,null))[_0x95df('0x49')](handleError(_0x4c2e3e,null));};exports[_0x95df('0x4f')]=function(_0x464866,_0xebf52b,_0xb4402b){var _0x365eff={};var _0x4c91d9={};var _0x4f92bf;var _0xaa10b1;return db[_0x95df('0x44')][_0x95df('0x50')]({'where':{'id':_0x464866[_0x95df('0x4b')]['id']}})[_0x95df('0x28')](handleEntityNotFound(_0xebf52b,null))[_0x95df('0x28')](function(_0xba3855){if(_0xba3855){_0x4f92bf=_0xba3855;_0x4c91d9[_0x95df('0x32')]=_[_0x95df('0x33')](db[_0x95df('0x51')][_0x95df('0x2e')]);_0x4c91d9[_0x95df('0x34')]=_[_0x95df('0x33')](_0x464866['query']);_0x4c91d9['filters']=_[_0x95df('0x35')](_0x4c91d9[_0x95df('0x32')],_0x4c91d9[_0x95df('0x34')]);_0x365eff[_0x95df('0x38')]=_[_0x95df('0x35')](_0x4c91d9['model'],qs[_0x95df('0x36')](_0x464866[_0x95df('0x34')]['fields']));_0x365eff['attributes']=_0x365eff[_0x95df('0x38')][_0x95df('0x37')]?_0x365eff[_0x95df('0x38')]:_0x4c91d9[_0x95df('0x32')];_0x365eff[_0x95df('0x3b')]=qs[_0x95df('0x3c')](_0x464866[_0x95df('0x34')]['sort']);_0x365eff[_0x95df('0x3d')]=qs[_0x95df('0x3e')](_['pick'](_0x464866[_0x95df('0x34')],_0x4c91d9[_0x95df('0x3e')]));if(_0x464866[_0x95df('0x34')][_0x95df('0x40')]){_0x365eff[_0x95df('0x3d')]=_[_0x95df('0x42')](_0x365eff['where'],{'$or':_[_0x95df('0x2d')](_0x365eff['attributes'],function(_0x1be7d6){var _0x3fc06b={};_0x3fc06b[_0x1be7d6]={'$like':'%'+_0x464866[_0x95df('0x34')][_0x95df('0x40')]+'%'};return _0x3fc06b;})});}_0x365eff=_['merge']({},_0x365eff,_0x464866[_0x95df('0x43')]);return _0x4f92bf[_0x95df('0x4f')](_0x365eff);}})[_0x95df('0x28')](function(_0x292d39){if(_0x292d39){_0xaa10b1=_0x292d39[_0x95df('0x37')];if(!_0x464866[_0x95df('0x34')][_0x95df('0x39')](_0x95df('0x3a'))){_0x365eff[_0x95df('0x21')]=qs['limit'](_0x464866['query'][_0x95df('0x21')]);_0x365eff[_0x95df('0x1f')]=qs[_0x95df('0x1f')](_0x464866[_0x95df('0x34')][_0x95df('0x1f')]);}return _0x4f92bf[_0x95df('0x4f')](_0x365eff);}})[_0x95df('0x28')](function(_0x5e6157){if(_0x5e6157){return _0x5e6157?{'count':_0xaa10b1,'rows':_0x5e6157}:null;}})[_0x95df('0x28')](respondWithResult(_0xebf52b,null))[_0x95df('0x49')](handleError(_0xebf52b,null));};exports[_0x95df('0x52')]=function(_0x306943,_0x54e693,_0x7eee8e){if(_0x306943[_0x95df('0x4e')]['id']){delete _0x306943[_0x95df('0x4e')]['id'];}return db[_0x95df('0x44')]['findOne']({'where':{'id':_0x306943[_0x95df('0x4b')]['id']}})['then'](handleEntityNotFound(_0x54e693,null))[_0x95df('0x28')](function(_0x485b0a){if(_0x485b0a){_0x306943['body'][_0x95df('0x53')]=_0x485b0a['id'];_0x306943[_0x95df('0x4e')][_0x95df('0x54')]=integrations[_0x95df('0x55')](_0x306943[_0x95df('0x4e')][_0x95df('0x56')],_0x306943[_0x95df('0x4e')]['type']);_0x306943[_0x95df('0x4e')][_0x95df('0x57')]=integrations[_0x95df('0x58')](_0x306943[_0x95df('0x4e')]['channel'],_0x306943[_0x95df('0x4e')]['type']);return db[_0x95df('0x51')][_0x95df('0x4d')](_0x306943[_0x95df('0x4e')],{'include':[{'model':db[_0x95df('0x59')],'as':_0x95df('0x54')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x95df('0x28')](respondWithResult(_0x54e693,null))[_0x95df('0x49')](handleError(_0x54e693,null));};exports[_0x95df('0x5a')]=function(_0x4f0edf,_0x3576b3,_0xd7507c){var _0x29c4c1='';var _0x388612=['id','name',_0x95df('0x5b'),_0x95df('0x5c'),_0x95df('0x5d'),_0x95df('0x5e'),_0x95df('0x5f'),'duration_minutes','parent_id',_0x95df('0x60'),_0x95df('0x61'),_0x95df('0x62')];return db[_0x95df('0x44')][_0x95df('0x50')]({'where':{'id':_0x4f0edf[_0x95df('0x4b')]['id']},'attributes':['id',_0x95df('0x63'),'password',_0x95df('0x64')]})[_0x95df('0x28')](handleEntityNotFound(_0x3576b3,null))[_0x95df('0x28')](function(_0x59be38){if(_0x59be38){_0x29c4c1=_0x59be38[_0x95df('0x64')];var _0x35282f=_0x29c4c1[_0x95df('0x65')](-0x1);if(_0x35282f==='/'){_0x29c4c1=_0x29c4c1[_0x95df('0x66')](0x0,_0x29c4c1[_0x95df('0x67')](_0x35282f));}return rp({'method':_0x95df('0x68'),'uri':util[_0x95df('0x69')](_0x95df('0x6a'),_0x29c4c1,_0x95df('0x6b')),'json':!![],'form':{'method':_0x95df('0x6c'),'input_type':_0x95df('0x6d'),'response_type':_0x95df('0x6d'),'rest_data':JSON[_0x95df('0x6e')]({'user_auth':{'user_name':_0x59be38[_0x95df('0x63')],'password':_0x59be38[_0x95df('0x6f')],'encryption':_0x95df('0x70')},'application':_0x95df('0x71')})}});}})[_0x95df('0x28')](function(_0x1513b5){if(_0x1513b5&&_0x1513b5['name']!==_0x95df('0x72')&&_0x1513b5[_0x95df('0x2b')]!==_0x95df('0x73')){return rp({'method':_0x95df('0x68'),'uri':util['format']('%s%s',_0x29c4c1,_0x95df('0x6b')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x95df('0x6d'),'response_type':_0x95df('0x6d'),'rest_data':JSON[_0x95df('0x6e')]({'session':_0x1513b5['id'],'module_name':_0x95df('0x74')})}})[_0x95df('0x28')](function(_0x247804){if(_0x247804){var _0x4a3116=_['values'](_0x247804[_0x95df('0x75')]);_[_0x95df('0x76')](_0x4a3116,function(_0xacd9cd){return _0x388612[_0x95df('0x77')](_0xacd9cd[_0x95df('0x2b')]);});return{'count':_0x4a3116[_0x95df('0x37')],'rows':_[_0x95df('0x2d')](_0x4a3116,function(_0x2bdae8){return{'id':_0x2bdae8['name'],'name':_0x2bdae8[_0x95df('0x78')],'custom':_[_0x95df('0x79')](_0x2bdae8[_0x95df('0x2b')],'_c')?!![]:![],'options':_0x2bdae8[_0x95df('0x43')]?_['map'](_[_0x95df('0x7a')](_0x2bdae8[_0x95df('0x43')]),function(_0x30bdf3){return{'name':_0x30bdf3[_0x95df('0x7b')],'value':_0x30bdf3['name']};}):[]};})};}})[_0x95df('0x28')](respondWithResult(_0x3576b3,null))[_0x95df('0x49')](function(_0x4757d9){var _0x39993f=_0x4f0edf[_0x95df('0x34')][_0x95df('0x7c')]?0x1f4:_0x4757d9[_0x95df('0x7d')]||0x1f4;logger[_0x95df('0x7e')](_0x95df('0x7f'),_0x95df('0x5a'),_0x39993f,JSON[_0x95df('0x6e')](_0x4757d9));delete _0x4757d9['name'];if(_0x39993f===0x191){_0x39993f=0x190;}_0x3576b3[_0x95df('0x1c')](_0x39993f)[_0x95df('0x2c')](_0x4f0edf[_0x95df('0x34')][_0x95df('0x7c')]?{'message':_0x95df('0x80'),'statusCode':_0x4757d9[_0x95df('0x7d')]}:_0x4757d9);});}else{var _0x451ec1=0x1f4;_0x3576b3[_0x95df('0x1c')](_0x451ec1)[_0x95df('0x2c')]({'message':_0x95df('0x80'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index b600319..0c42fb4 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 _0x2432=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x5af821,_0x2c4cba){var _0x269fa=function(_0x23fc59){while(--_0x23fc59){_0x5af821['push'](_0x5af821['shift']());}};_0x269fa(++_0x2c4cba);}(_0x2432,0x7a));var _0x2243=function(_0x46f85d,_0x26ca78){_0x46f85d=_0x46f85d-0x0;var _0x8589fd=_0x2432[_0x46f85d];return _0x8589fd;};'use strict';var _=require(_0x2243('0x0'));var util=require(_0x2243('0x1'));var logger=require(_0x2243('0x2'))(_0x2243('0x3'));var moment=require('moment');var BPromise=require(_0x2243('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2243('0x5'));var rimraf=require(_0x2243('0x6'));var config=require(_0x2243('0x7'));var attributes=require(_0x2243('0x8'));var integrations=require(_0x2243('0x9'));module[_0x2243('0xa')]=function(_0x4208ac,_0x28678a){return _0x4208ac[_0x2243('0xb')]('SugarcrmAccount',attributes,{'tableName':_0x2243('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a21=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x155c48,_0x5ac92d){var _0x4938fe=function(_0x3c62c1){while(--_0x3c62c1){_0x155c48['push'](_0x155c48['shift']());}};_0x4938fe(++_0x5ac92d);}(_0x7a21,0x1c8));var _0x17a2=function(_0x43d070,_0x5177d1){_0x43d070=_0x43d070-0x0;var _0x3c3285=_0x7a21[_0x43d070];return _0x3c3285;};'use strict';var _=require(_0x17a2('0x0'));var util=require(_0x17a2('0x1'));var logger=require(_0x17a2('0x2'))(_0x17a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x17a2('0x4'));var fs=require('fs');var path=require(_0x17a2('0x5'));var rimraf=require('rimraf');var config=require(_0x17a2('0x6'));var attributes=require(_0x17a2('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x17a2('0x8')]=function(_0x55fd41,_0x40235c){return _0x55fd41[_0x17a2('0x9')](_0x17a2('0xa'),attributes,{'tableName':_0x17a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 8133be1..e012f12 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 _0x2d08=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','raw','where','limit','include','model','attributes','map','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find'];(function(_0x41c868,_0x20b597){var _0x5101cf=function(_0x2f98ed){while(--_0x2f98ed){_0x41c868['push'](_0x41c868['shift']());}};_0x5101cf(++_0x20b597);}(_0x2d08,0x6f));var _0x82d0=function(_0xe37f58,_0x1a167b){_0xe37f58=_0xe37f58-0x0;var _0x4dfcef=_0x2d08[_0xe37f58];return _0x4dfcef;};'use strict';var _=require('lodash');var util=require(_0x82d0('0x0'));var moment=require(_0x82d0('0x1'));var BPromise=require(_0x82d0('0x2'));var rs=require(_0x82d0('0x3'));var fs=require('fs');var Redis=require(_0x82d0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82d0('0x5'));var logger=require(_0x82d0('0x6'))(_0x82d0('0x7'));var config=require(_0x82d0('0x8'));var jayson=require(_0x82d0('0x9'));var client=jayson['client'][_0x82d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x310d16,_0x39c49c,_0x136dd7){return new BPromise(function(_0x496f31,_0x51586f){return client[_0x82d0('0xb')](_0x310d16,_0x136dd7)[_0x82d0('0xc')](function(_0x1af80a){logger['info'](_0x82d0('0xd'),_0x39c49c,_0x82d0('0xe'));logger[_0x82d0('0xf')](_0x82d0('0x10'),_0x39c49c,_0x82d0('0xe'),JSON[_0x82d0('0x11')](_0x1af80a));if(_0x1af80a[_0x82d0('0x12')]){if(_0x1af80a['error'][_0x82d0('0x13')]===0x1f4){logger[_0x82d0('0x12')](_0x82d0('0xd'),_0x39c49c,_0x1af80a[_0x82d0('0x12')]['message']);return _0x51586f(_0x1af80a[_0x82d0('0x12')]['message']);}logger[_0x82d0('0x12')](_0x82d0('0xd'),_0x39c49c,_0x1af80a[_0x82d0('0x12')]['message']);return _0x496f31(_0x1af80a[_0x82d0('0x12')][_0x82d0('0x14')]);}else{logger[_0x82d0('0x15')](_0x82d0('0xd'),_0x39c49c,_0x82d0('0xe'));_0x496f31(_0x1af80a[_0x82d0('0x16')]['message']);}})[_0x82d0('0x17')](function(_0x2a9a28){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x39c49c,_0x2a9a28);_0x51586f(_0x2a9a28);});});}exports['GetSugarcrmAccount']=function(_0x119971){var _0x50a81b=this;return new Promise(function(_0x28d96b,_0x344818){return db['SugarcrmAccount'][_0x82d0('0x18')]({'raw':_0x119971[_0x82d0('0x19')]?_0x119971[_0x82d0('0x19')][_0x82d0('0x1a')]===undefined?!![]:![]:!![],'where':_0x119971[_0x82d0('0x19')]?_0x119971[_0x82d0('0x19')][_0x82d0('0x1b')]||null:null,'attributes':_0x119971['options']?_0x119971[_0x82d0('0x19')]['attributes']||null:null,'limit':_0x119971['options']?_0x119971[_0x82d0('0x19')][_0x82d0('0x1c')]||null:null,'include':_0x119971['options']?_0x119971[_0x82d0('0x19')][_0x82d0('0x1d')]?_['map'](_0x119971['options']['include'],function(_0x1b8767){return{'model':db[_0x1b8767[_0x82d0('0x1e')]],'as':_0x1b8767['as'],'attributes':_0x1b8767[_0x82d0('0x1f')],'include':_0x1b8767[_0x82d0('0x1d')]?_['map'](_0x1b8767['include'],function(_0x1e5143){return{'model':db[_0x1e5143[_0x82d0('0x1e')]],'as':_0x1e5143['as'],'attributes':_0x1e5143[_0x82d0('0x1f')],'include':_0x1e5143[_0x82d0('0x1d')]?_[_0x82d0('0x20')](_0x1e5143[_0x82d0('0x1d')],function(_0x2744cd){return{'model':db[_0x2744cd[_0x82d0('0x1e')]],'as':_0x2744cd['as'],'attributes':_0x2744cd[_0x82d0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x82d0('0xc')](function(_0x13f91a){logger[_0x82d0('0x15')](_0x82d0('0x21'),_0x119971);logger[_0x82d0('0xf')](_0x82d0('0x21'),_0x119971,JSON[_0x82d0('0x11')](_0x13f91a));_0x28d96b(_0x13f91a);})[_0x82d0('0x17')](function(_0x4d3a43){logger[_0x82d0('0x12')](_0x82d0('0x21'),_0x4d3a43[_0x82d0('0x14')],_0x119971);_0x344818(_0x50a81b[_0x82d0('0x12')](0x1f4,_0x4d3a43['message']));});});};exports[_0x82d0('0x22')]=function(_0x468338){var _0x4d3d0e=this;return new Promise(function(_0x50340b,_0x1bdde2){return db[_0x82d0('0x23')][_0x82d0('0x24')]({'raw':_0x468338['options']?_0x468338[_0x82d0('0x19')][_0x82d0('0x1a')]===undefined?!![]:![]:!![],'where':_0x468338[_0x82d0('0x19')]?_0x468338[_0x82d0('0x19')]['where']||null:null,'attributes':_0x468338[_0x82d0('0x19')]?_0x468338[_0x82d0('0x19')][_0x82d0('0x1f')]||null:null,'include':_0x468338['options']?_0x468338[_0x82d0('0x19')]['include']?_['map'](_0x468338[_0x82d0('0x19')]['include'],function(_0x538902){return{'model':db[_0x538902[_0x82d0('0x1e')]],'as':_0x538902['as'],'attributes':_0x538902[_0x82d0('0x1f')],'include':_0x538902['include']?_['map'](_0x538902[_0x82d0('0x1d')],function(_0x18a6f3){return{'model':db[_0x18a6f3[_0x82d0('0x1e')]],'as':_0x18a6f3['as'],'attributes':_0x18a6f3[_0x82d0('0x1f')],'include':_0x18a6f3[_0x82d0('0x1d')]?_['map'](_0x18a6f3[_0x82d0('0x1d')],function(_0x39aa11){return{'model':db[_0x39aa11['model']],'as':_0x39aa11['as'],'attributes':_0x39aa11[_0x82d0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x162ee7){logger[_0x82d0('0x15')]('ShowSugarcrmAccount',_0x468338);logger['debug'](_0x82d0('0x22'),_0x468338,JSON[_0x82d0('0x11')](_0x162ee7));_0x50340b(_0x162ee7);})[_0x82d0('0x17')](function(_0x150d65){logger['error'](_0x82d0('0x22'),_0x150d65[_0x82d0('0x14')],_0x468338);_0x1bdde2(_0x4d3d0e[_0x82d0('0x12')](0x1f4,_0x150d65['message']));});});}; \ No newline at end of file +var _0x247c=['ShowSugarcrmAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x38a6c6,_0x4062ca){var _0x142f0a=function(_0x1531ce){while(--_0x1531ce){_0x38a6c6['push'](_0x38a6c6['shift']());}};_0x142f0a(++_0x4062ca);}(_0x247c,0x78));var _0xc247=function(_0xb8135c,_0x46c002){_0xb8135c=_0xb8135c-0x0;var _0x4e54e5=_0x247c[_0xb8135c];return _0x4e54e5;};'use strict';var _=require(_0xc247('0x0'));var util=require(_0xc247('0x1'));var moment=require(_0xc247('0x2'));var BPromise=require('bluebird');var rs=require(_0xc247('0x3'));var fs=require('fs');var Redis=require(_0xc247('0x4'));var db=require(_0xc247('0x5'))['db'];var utils=require(_0xc247('0x6'));var logger=require(_0xc247('0x7'))(_0xc247('0x8'));var config=require(_0xc247('0x9'));var jayson=require(_0xc247('0xa'));var client=jayson[_0xc247('0xb')][_0xc247('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51dc89,_0x1d1c6c,_0x1e81f6){return new BPromise(function(_0x109aec,_0xdd53f){return client[_0xc247('0xd')](_0x51dc89,_0x1e81f6)[_0xc247('0xe')](function(_0x120b7a){logger[_0xc247('0xf')](_0xc247('0x10'),_0x1d1c6c,_0xc247('0x11'));logger[_0xc247('0x12')](_0xc247('0x13'),_0x1d1c6c,_0xc247('0x11'),JSON[_0xc247('0x14')](_0x120b7a));if(_0x120b7a[_0xc247('0x15')]){if(_0x120b7a[_0xc247('0x15')][_0xc247('0x16')]===0x1f4){logger[_0xc247('0x15')]('SugarcrmAccount,\x20%s,\x20%s',_0x1d1c6c,_0x120b7a[_0xc247('0x15')][_0xc247('0x17')]);return _0xdd53f(_0x120b7a[_0xc247('0x15')][_0xc247('0x17')]);}logger['error'](_0xc247('0x10'),_0x1d1c6c,_0x120b7a[_0xc247('0x15')][_0xc247('0x17')]);return _0x109aec(_0x120b7a[_0xc247('0x15')][_0xc247('0x17')]);}else{logger[_0xc247('0xf')](_0xc247('0x10'),_0x1d1c6c,_0xc247('0x11'));_0x109aec(_0x120b7a[_0xc247('0x18')][_0xc247('0x17')]);}})[_0xc247('0x19')](function(_0xb77984){logger[_0xc247('0x15')](_0xc247('0x10'),_0x1d1c6c,_0xb77984);_0xdd53f(_0xb77984);});});}exports[_0xc247('0x1a')]=function(_0x18b4d0){var _0x321722=this;return new Promise(function(_0x2495ae,_0x5a4971){return db[_0xc247('0x1b')][_0xc247('0x1c')]({'raw':_0x18b4d0['options']?_0x18b4d0[_0xc247('0x1d')][_0xc247('0x1e')]===undefined?!![]:![]:!![],'where':_0x18b4d0[_0xc247('0x1d')]?_0x18b4d0[_0xc247('0x1d')]['where']||null:null,'attributes':_0x18b4d0['options']?_0x18b4d0[_0xc247('0x1d')][_0xc247('0x1f')]||null:null,'limit':_0x18b4d0[_0xc247('0x1d')]?_0x18b4d0[_0xc247('0x1d')][_0xc247('0x20')]||null:null,'include':_0x18b4d0[_0xc247('0x1d')]?_0x18b4d0[_0xc247('0x1d')][_0xc247('0x21')]?_[_0xc247('0x22')](_0x18b4d0[_0xc247('0x1d')][_0xc247('0x21')],function(_0x49630f){return{'model':db[_0x49630f[_0xc247('0x23')]],'as':_0x49630f['as'],'attributes':_0x49630f[_0xc247('0x1f')],'include':_0x49630f[_0xc247('0x21')]?_[_0xc247('0x22')](_0x49630f[_0xc247('0x21')],function(_0x59625b){return{'model':db[_0x59625b['model']],'as':_0x59625b['as'],'attributes':_0x59625b[_0xc247('0x1f')],'include':_0x59625b[_0xc247('0x21')]?_['map'](_0x59625b[_0xc247('0x21')],function(_0x403ed1){return{'model':db[_0x403ed1[_0xc247('0x23')]],'as':_0x403ed1['as'],'attributes':_0x403ed1[_0xc247('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc247('0xe')](function(_0x4877a8){logger[_0xc247('0xf')](_0xc247('0x1a'),_0x18b4d0);logger[_0xc247('0x12')](_0xc247('0x1a'),_0x18b4d0,JSON[_0xc247('0x14')](_0x4877a8));_0x2495ae(_0x4877a8);})[_0xc247('0x19')](function(_0x1345f3){logger[_0xc247('0x15')]('GetSugarcrmAccount',_0x1345f3[_0xc247('0x17')],_0x18b4d0);_0x5a4971(_0x321722[_0xc247('0x15')](0x1f4,_0x1345f3[_0xc247('0x17')]));});});};exports[_0xc247('0x24')]=function(_0x2d962c){var _0x5a921f=this;return new Promise(function(_0x2096cc,_0x2cc756){return db[_0xc247('0x1b')][_0xc247('0x25')]({'raw':_0x2d962c[_0xc247('0x1d')]?_0x2d962c[_0xc247('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2d962c[_0xc247('0x1d')]?_0x2d962c['options'][_0xc247('0x26')]||null:null,'attributes':_0x2d962c[_0xc247('0x1d')]?_0x2d962c[_0xc247('0x1d')][_0xc247('0x1f')]||null:null,'include':_0x2d962c[_0xc247('0x1d')]?_0x2d962c[_0xc247('0x1d')]['include']?_[_0xc247('0x22')](_0x2d962c['options']['include'],function(_0x168bb5){return{'model':db[_0x168bb5[_0xc247('0x23')]],'as':_0x168bb5['as'],'attributes':_0x168bb5[_0xc247('0x1f')],'include':_0x168bb5[_0xc247('0x21')]?_[_0xc247('0x22')](_0x168bb5[_0xc247('0x21')],function(_0x536f38){return{'model':db[_0x536f38[_0xc247('0x23')]],'as':_0x536f38['as'],'attributes':_0x536f38['attributes'],'include':_0x536f38[_0xc247('0x21')]?_[_0xc247('0x22')](_0x536f38[_0xc247('0x21')],function(_0x3302bd){return{'model':db[_0x3302bd[_0xc247('0x23')]],'as':_0x3302bd['as'],'attributes':_0x3302bd['attributes']};}):[]};}):[]};}):[]:[]})[_0xc247('0xe')](function(_0x59f5cd){logger[_0xc247('0xf')]('ShowSugarcrmAccount',_0x2d962c);logger[_0xc247('0x12')](_0xc247('0x24'),_0x2d962c,JSON[_0xc247('0x14')](_0x59f5cd));_0x2096cc(_0x59f5cd);})[_0xc247('0x19')](function(_0x55be43){logger[_0xc247('0x15')](_0xc247('0x24'),_0x55be43[_0xc247('0x17')],_0x2d962c);_0x2cc756(_0x5a921f[_0xc247('0x15')](0x1f4,_0x55be43[_0xc247('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 2cd04f5..a9efb07 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 _0x5f9d=['getSubjects','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','getFields','get','/:id/subjects'];(function(_0x5b6d2a,_0x2a4e3b){var _0x536640=function(_0x38f760){while(--_0x38f760){_0x5b6d2a['push'](_0x5b6d2a['shift']());}};_0x536640(++_0x2a4e3b);}(_0x5f9d,0x149));var _0xd5f9=function(_0x6b47e2,_0x9a9230){_0x6b47e2=_0x6b47e2-0x0;var _0x494494=_0x5f9d[_0x6b47e2];return _0x494494;};'use strict';var multer=require(_0xd5f9('0x0'));var util=require(_0xd5f9('0x1'));var path=require(_0xd5f9('0x2'));var timeout=require(_0xd5f9('0x3'));var express=require(_0xd5f9('0x4'));var router=express[_0xd5f9('0x5')]();var fs_extra=require(_0xd5f9('0x6'));var auth=require(_0xd5f9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd5f9('0x8'));var controller=require(_0xd5f9('0x9'));router['get']('/',auth[_0xd5f9('0xa')](),controller[_0xd5f9('0xb')]);router['get'](_0xd5f9('0xc'),auth[_0xd5f9('0xa')](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xd5f9('0xd')]);router[_0xd5f9('0xe')](_0xd5f9('0xf'),auth[_0xd5f9('0xa')](),controller[_0xd5f9('0x10')]);router[_0xd5f9('0xe')]('/:id/descriptions',auth[_0xd5f9('0xa')](),controller['getDescriptions']);router[_0xd5f9('0x11')]('/',auth[_0xd5f9('0xa')](),controller[_0xd5f9('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd5f9('0x13')]);router[_0xd5f9('0x14')](_0xd5f9('0xc'),auth[_0xd5f9('0xa')](),controller[_0xd5f9('0x15')]);module[_0xd5f9('0x16')]=router; \ No newline at end of file +var _0x69c3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','exports','multer','util','express'];(function(_0x2866c7,_0x197fdd){var _0x3c5db2=function(_0x5f40db){while(--_0x5f40db){_0x2866c7['push'](_0x2866c7['shift']());}};_0x3c5db2(++_0x197fdd);}(_0x69c3,0xde));var _0x369c=function(_0x32de1c,_0x1b9e3b){_0x32de1c=_0x32de1c-0x0;var _0x34efc5=_0x69c3[_0x32de1c];return _0x34efc5;};'use strict';var multer=require(_0x369c('0x0'));var util=require(_0x369c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x369c('0x2'));var router=express[_0x369c('0x3')]();var fs_extra=require(_0x369c('0x4'));var auth=require(_0x369c('0x5'));var interaction=require(_0x369c('0x6'));var config=require(_0x369c('0x7'));var controller=require(_0x369c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x369c('0x9')]);router[_0x369c('0xa')](_0x369c('0xb'),auth[_0x369c('0xc')](),controller[_0x369c('0xd')]);router[_0x369c('0xa')](_0x369c('0xe'),auth['isAuthenticated'](),controller[_0x369c('0xf')]);router['get'](_0x369c('0x10'),auth[_0x369c('0xc')](),controller[_0x369c('0x11')]);router[_0x369c('0xa')]('/:id/descriptions',auth[_0x369c('0xc')](),controller[_0x369c('0x12')]);router[_0x369c('0x13')]('/',auth[_0x369c('0xc')](),controller[_0x369c('0x14')]);router[_0x369c('0x15')](_0x369c('0xb'),auth[_0x369c('0xc')](),controller[_0x369c('0x16')]);router[_0x369c('0x17')](_0x369c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x369c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index b4faa84..0bde319 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 _0x7aa6=['STRING'];(function(_0x35960d,_0x3a9eec){var _0x1a7da5=function(_0x563010){while(--_0x563010){_0x35960d['push'](_0x35960d['shift']());}};_0x1a7da5(++_0x3a9eec);}(_0x7aa6,0x1cf));var _0x67aa=function(_0x462d66,_0x204696){_0x462d66=_0x462d66-0x0;var _0x3da2b0=_0x7aa6[_0x462d66];return _0x3da2b0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x67aa('0x0')]}}; \ No newline at end of file +var _0x3806=['sequelize','exports','STRING'];(function(_0xf244e0,_0x20556c){var _0xe94095=function(_0x409d0a){while(--_0x409d0a){_0xf244e0['push'](_0xf244e0['shift']());}};_0xe94095(++_0x20556c);}(_0x3806,0x1e9));var _0x6380=function(_0x1dc63b,_0x5c7133){_0x1dc63b=_0x1dc63b-0x0;var _0x381bfb=_0x3806[_0x1dc63b];return _0x381bfb;};'use strict';var Sequelize=require(_0x6380('0x0'));module[_0x6380('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6380('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5f5f331..97a29e8 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 _0x3b56=['ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','name','send','index','map','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','SugarcrmConfiguration','include','findAll','rows','catch','params','length','includeAll','options','create','body','update','find','destroy','getFields','findOne','SugarcrmField','pick','getSubjects','getDescriptions','order','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv'];(function(_0x14628c,_0x53d931){var _0x4ac813=function(_0x439754){while(--_0x439754){_0x14628c['push'](_0x14628c['shift']());}};_0x4ac813(++_0x53d931);}(_0x3b56,0x179));var _0x63b5=function(_0x1b68dc,_0x52b48e){_0x1b68dc=_0x1b68dc-0x0;var _0x44f357=_0x3b56[_0x1b68dc];return _0x44f357;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x63b5('0x0'));var jsonpatch=require(_0x63b5('0x1'));var rp=require(_0x63b5('0x2'));var moment=require(_0x63b5('0x3'));var BPromise=require(_0x63b5('0x4'));var Mustache=require(_0x63b5('0x5'));var util=require('util');var path=require(_0x63b5('0x6'));var sox=require('sox');var csv=require(_0x63b5('0x7'));var ejs=require(_0x63b5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x63b5('0x9'));var squel=require('squel');var crypto=require(_0x63b5('0xa'));var jsforce=require(_0x63b5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x63b5('0x7'));var querystring=require(_0x63b5('0xc'));var Papa=require('papaparse');var Redis=require(_0x63b5('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x63b5('0xe'));var hardwareService=require(_0x63b5('0xf'));var logger=require(_0x63b5('0x10'))('api');var utils=require(_0x63b5('0x11'));var config=require(_0x63b5('0x12'));var licenseUtil=require(_0x63b5('0x13'));var db=require(_0x63b5('0x14'))['db'];function respondWithStatusCode(_0x26060e,_0x1a575a){_0x1a575a=_0x1a575a||0xcc;return function(_0x2a8204){if(_0x2a8204){return _0x26060e[_0x63b5('0x15')](_0x1a575a);}return _0x26060e[_0x63b5('0x16')](_0x1a575a)[_0x63b5('0x17')]();};}function respondWithResult(_0x6a828,_0x526177){_0x526177=_0x526177||0xc8;return function(_0x2810a3){if(_0x2810a3){return _0x6a828['status'](_0x526177)[_0x63b5('0x18')](_0x2810a3);}};}function respondWithFilteredResult(_0x55451a,_0x382ab7){return function(_0x33799f){if(_0x33799f){var _0x4bd184=typeof _0x382ab7['offset']===_0x63b5('0x19')&&typeof _0x382ab7['limit']===_0x63b5('0x19');var _0x2955c2=_0x33799f[_0x63b5('0x1a')];var _0x1c7a4e=_0x4bd184?0x0:_0x382ab7[_0x63b5('0x1b')];var _0x8fd87e=_0x4bd184?_0x33799f['count']:_0x382ab7[_0x63b5('0x1b')]+_0x382ab7[_0x63b5('0x1c')];var _0x1bf8d4;if(_0x8fd87e>=_0x2955c2){_0x8fd87e=_0x2955c2;_0x1bf8d4=0xc8;}else{_0x1bf8d4=0xce;}_0x55451a[_0x63b5('0x16')](_0x1bf8d4);return _0x55451a[_0x63b5('0x1d')](_0x63b5('0x1e'),_0x1c7a4e+'-'+_0x8fd87e+'/'+_0x2955c2)[_0x63b5('0x18')](_0x33799f);}return null;};}function patchUpdates(_0x2ff8b9){return function(_0x4e605a){try{jsonpatch['apply'](_0x4e605a,_0x2ff8b9,!![]);}catch(_0x43580f){return BPromise[_0x63b5('0x1f')](_0x43580f);}return _0x4e605a[_0x63b5('0x20')]();};}function saveUpdates(_0x1dff7a,_0x317070){return function(_0x5e78e6){if(_0x5e78e6){return _0x5e78e6['update'](_0x1dff7a)[_0x63b5('0x21')](function(_0x56c72d){return _0x56c72d;});}return null;};}function removeEntity(_0x5dd943,_0x447cea){return function(_0x3c66c7){if(_0x3c66c7){return _0x3c66c7['destroy']()[_0x63b5('0x21')](function(){_0x5dd943[_0x63b5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42252f,_0x201418){return function(_0x57c2cb){if(!_0x57c2cb){_0x42252f[_0x63b5('0x15')](0x194);}return _0x57c2cb;};}function handleError(_0x28b64e,_0x2e7b05){_0x2e7b05=_0x2e7b05||0x1f4;return function(_0x59e392){logger['error'](_0x59e392['stack']);if(_0x59e392[_0x63b5('0x22')]){delete _0x59e392['name'];}_0x28b64e[_0x63b5('0x16')](_0x2e7b05)[_0x63b5('0x23')](_0x59e392);};}exports[_0x63b5('0x24')]=function(_0x3a4855,_0x291ab1){var _0x15ba8b={},_0x21603b={},_0xe624b2={'count':0x0,'rows':[]};var _0x1fb8b8=_[_0x63b5('0x25')](db['SugarcrmConfiguration'][_0x63b5('0x26')],function(_0x5aa634){return{'name':_0x5aa634[_0x63b5('0x27')],'type':_0x5aa634[_0x63b5('0x28')][_0x63b5('0x29')]};});_0x21603b['model']=_['map'](_0x1fb8b8,_0x63b5('0x22'));_0x21603b['query']=_[_0x63b5('0x2a')](_0x3a4855['query']);_0x21603b['filters']=_[_0x63b5('0x2b')](_0x21603b[_0x63b5('0x2c')],_0x21603b[_0x63b5('0x2d')]);_0x15ba8b[_0x63b5('0x2e')]=_[_0x63b5('0x2b')](_0x21603b[_0x63b5('0x2c')],qs[_0x63b5('0x2f')](_0x3a4855[_0x63b5('0x2d')][_0x63b5('0x2f')]));_0x15ba8b['attributes']=_0x15ba8b['attributes']['length']?_0x15ba8b[_0x63b5('0x2e')]:_0x21603b['model'];if(!_0x3a4855[_0x63b5('0x2d')][_0x63b5('0x30')](_0x63b5('0x31'))){_0x15ba8b[_0x63b5('0x1c')]=qs[_0x63b5('0x1c')](_0x3a4855['query'][_0x63b5('0x1c')]);_0x15ba8b[_0x63b5('0x1b')]=qs['offset'](_0x3a4855[_0x63b5('0x2d')][_0x63b5('0x1b')]);}_0x15ba8b['order']=qs['sort'](_0x3a4855[_0x63b5('0x2d')][_0x63b5('0x32')]);_0x15ba8b[_0x63b5('0x33')]=qs[_0x63b5('0x34')](_['pick'](_0x3a4855[_0x63b5('0x2d')],_0x21603b[_0x63b5('0x34')]),_0x1fb8b8);if(_0x3a4855[_0x63b5('0x2d')][_0x63b5('0x35')]){_0x15ba8b[_0x63b5('0x33')]=_['merge'](_0x15ba8b[_0x63b5('0x33')],{'$or':_[_0x63b5('0x25')](_0x1fb8b8,function(_0x385509){if(_0x385509[_0x63b5('0x28')]!==_0x63b5('0x36')){var _0x2b2bfd={};_0x2b2bfd[_0x385509[_0x63b5('0x22')]]={'$like':'%'+_0x3a4855[_0x63b5('0x2d')]['filter']+'%'};return _0x2b2bfd;}})});}_0x15ba8b=_[_0x63b5('0x37')]({},_0x15ba8b,_0x3a4855['options']);var _0x12225f={'where':_0x15ba8b['where']};return db[_0x63b5('0x38')]['count'](_0x12225f)['then'](function(_0x19c84b){_0xe624b2[_0x63b5('0x1a')]=_0x19c84b;if(_0x3a4855[_0x63b5('0x2d')]['includeAll']){_0x15ba8b[_0x63b5('0x39')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x63b5('0x3a')](_0x15ba8b);})[_0x63b5('0x21')](function(_0x59ea7c){_0xe624b2[_0x63b5('0x3b')]=_0x59ea7c;return _0xe624b2;})[_0x63b5('0x21')](respondWithFilteredResult(_0x291ab1,_0x15ba8b))[_0x63b5('0x3c')](handleError(_0x291ab1,null));};exports['show']=function(_0x3c43a6,_0x44789d){var _0x3f1947={'raw':![],'where':{'id':_0x3c43a6[_0x63b5('0x3d')]['id']}},_0x93d2da={};_0x93d2da['model']=_[_0x63b5('0x2a')](db[_0x63b5('0x38')]['rawAttributes']);_0x93d2da[_0x63b5('0x2d')]=_[_0x63b5('0x2a')](_0x3c43a6[_0x63b5('0x2d')]);_0x93d2da[_0x63b5('0x34')]=_[_0x63b5('0x2b')](_0x93d2da[_0x63b5('0x2c')],_0x93d2da[_0x63b5('0x2d')]);_0x3f1947[_0x63b5('0x2e')]=_[_0x63b5('0x2b')](_0x93d2da[_0x63b5('0x2c')],qs[_0x63b5('0x2f')](_0x3c43a6[_0x63b5('0x2d')]['fields']));_0x3f1947[_0x63b5('0x2e')]=_0x3f1947[_0x63b5('0x2e')][_0x63b5('0x3e')]?_0x3f1947[_0x63b5('0x2e')]:_0x93d2da[_0x63b5('0x2c')];if(_0x3c43a6[_0x63b5('0x2d')][_0x63b5('0x3f')]){_0x3f1947['include']=[{'all':!![]}];}_0x3f1947=_[_0x63b5('0x37')]({},_0x3f1947,_0x3c43a6[_0x63b5('0x40')]);return db[_0x63b5('0x38')]['find'](_0x3f1947)[_0x63b5('0x21')](handleEntityNotFound(_0x44789d,null))[_0x63b5('0x21')](respondWithResult(_0x44789d,null))[_0x63b5('0x3c')](handleError(_0x44789d,null));};exports[_0x63b5('0x41')]=function(_0x3d57ef,_0x5e3dd9){return db[_0x63b5('0x38')][_0x63b5('0x41')](_0x3d57ef[_0x63b5('0x42')],{})[_0x63b5('0x21')](respondWithResult(_0x5e3dd9,0xc9))[_0x63b5('0x3c')](handleError(_0x5e3dd9,null));};exports[_0x63b5('0x43')]=function(_0x33e4ba,_0x344d84){if(_0x33e4ba[_0x63b5('0x42')]['id']){delete _0x33e4ba['body']['id'];}return db[_0x63b5('0x38')][_0x63b5('0x44')]({'where':{'id':_0x33e4ba['params']['id']}})['then'](handleEntityNotFound(_0x344d84,null))['then'](saveUpdates(_0x33e4ba['body'],null))[_0x63b5('0x21')](respondWithResult(_0x344d84,null))[_0x63b5('0x3c')](handleError(_0x344d84,null));};exports[_0x63b5('0x45')]=function(_0x282238,_0x29850f){return db[_0x63b5('0x38')][_0x63b5('0x44')]({'where':{'id':_0x282238[_0x63b5('0x3d')]['id']}})[_0x63b5('0x21')](handleEntityNotFound(_0x29850f,null))[_0x63b5('0x21')](removeEntity(_0x29850f,null))[_0x63b5('0x3c')](handleError(_0x29850f,null));};exports[_0x63b5('0x46')]=function(_0x2321b6,_0x5b1486,_0x1ed022){var _0x3c0dd2={};var _0x48b601={};var _0x490d0b;var _0x1554f2;return db[_0x63b5('0x38')][_0x63b5('0x47')]({'where':{'id':_0x2321b6[_0x63b5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5b1486,null))[_0x63b5('0x21')](function(_0x3c9d04){if(_0x3c9d04){_0x490d0b=_0x3c9d04;_0x48b601['model']=_['keys'](db[_0x63b5('0x48')][_0x63b5('0x26')]);_0x48b601[_0x63b5('0x2d')]=_[_0x63b5('0x2a')](_0x2321b6[_0x63b5('0x2d')]);_0x48b601[_0x63b5('0x34')]=_[_0x63b5('0x2b')](_0x48b601[_0x63b5('0x2c')],_0x48b601[_0x63b5('0x2d')]);_0x3c0dd2['attributes']=_['intersection'](_0x48b601[_0x63b5('0x2c')],qs['fields'](_0x2321b6[_0x63b5('0x2d')]['fields']));_0x3c0dd2[_0x63b5('0x2e')]=_0x3c0dd2[_0x63b5('0x2e')][_0x63b5('0x3e')]?_0x3c0dd2['attributes']:_0x48b601['model'];_0x3c0dd2['order']=qs[_0x63b5('0x32')](_0x2321b6['query'][_0x63b5('0x32')]);_0x3c0dd2['where']=qs[_0x63b5('0x34')](_['pick'](_0x2321b6[_0x63b5('0x2d')],_0x48b601[_0x63b5('0x34')]));if(_0x2321b6[_0x63b5('0x2d')][_0x63b5('0x35')]){_0x3c0dd2[_0x63b5('0x33')]=_[_0x63b5('0x37')](_0x3c0dd2[_0x63b5('0x33')],{'$or':_[_0x63b5('0x25')](_0x3c0dd2[_0x63b5('0x2e')],function(_0x5d57fd){var _0x5cdfec={};_0x5cdfec[_0x5d57fd]={'$like':'%'+_0x2321b6[_0x63b5('0x2d')][_0x63b5('0x35')]+'%'};return _0x5cdfec;})});}_0x3c0dd2=_[_0x63b5('0x37')]({},_0x3c0dd2,_0x2321b6[_0x63b5('0x40')]);return _0x490d0b[_0x63b5('0x46')](_0x3c0dd2);}})['then'](function(_0x1f61f9){if(_0x1f61f9){_0x1554f2=_0x1f61f9[_0x63b5('0x3e')];if(!_0x2321b6[_0x63b5('0x2d')][_0x63b5('0x30')](_0x63b5('0x31'))){_0x3c0dd2[_0x63b5('0x1c')]=qs[_0x63b5('0x1c')](_0x2321b6['query'][_0x63b5('0x1c')]);_0x3c0dd2[_0x63b5('0x1b')]=qs[_0x63b5('0x1b')](_0x2321b6[_0x63b5('0x2d')][_0x63b5('0x1b')]);}return _0x490d0b['getFields'](_0x3c0dd2);}})[_0x63b5('0x21')](function(_0x4b6d4c){if(_0x4b6d4c){return _0x4b6d4c?{'count':_0x1554f2,'rows':_0x4b6d4c}:null;}})[_0x63b5('0x21')](respondWithResult(_0x5b1486,null))[_0x63b5('0x3c')](handleError(_0x5b1486,null));};exports['getSubjects']=function(_0x4b0f10,_0x22af35,_0x2c561b){var _0x37afe1={};var _0x1d1f86={};var _0x3fd1af;var _0x4ddf47;return db[_0x63b5('0x38')][_0x63b5('0x47')]({'where':{'id':_0x4b0f10[_0x63b5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x22af35,null))[_0x63b5('0x21')](function(_0xbcf667){if(_0xbcf667){_0x3fd1af=_0xbcf667;_0x1d1f86[_0x63b5('0x2c')]=_[_0x63b5('0x2a')](db[_0x63b5('0x48')][_0x63b5('0x26')]);_0x1d1f86[_0x63b5('0x2d')]=_[_0x63b5('0x2a')](_0x4b0f10[_0x63b5('0x2d')]);_0x1d1f86[_0x63b5('0x34')]=_[_0x63b5('0x2b')](_0x1d1f86['model'],_0x1d1f86[_0x63b5('0x2d')]);_0x37afe1['attributes']=_[_0x63b5('0x2b')](_0x1d1f86[_0x63b5('0x2c')],qs['fields'](_0x4b0f10['query'][_0x63b5('0x2f')]));_0x37afe1[_0x63b5('0x2e')]=_0x37afe1[_0x63b5('0x2e')][_0x63b5('0x3e')]?_0x37afe1['attributes']:_0x1d1f86[_0x63b5('0x2c')];_0x37afe1['order']=qs[_0x63b5('0x32')](_0x4b0f10[_0x63b5('0x2d')][_0x63b5('0x32')]);_0x37afe1[_0x63b5('0x33')]=qs[_0x63b5('0x34')](_[_0x63b5('0x49')](_0x4b0f10[_0x63b5('0x2d')],_0x1d1f86[_0x63b5('0x34')]));if(_0x4b0f10[_0x63b5('0x2d')][_0x63b5('0x35')]){_0x37afe1[_0x63b5('0x33')]=_[_0x63b5('0x37')](_0x37afe1[_0x63b5('0x33')],{'$or':_['map'](_0x37afe1[_0x63b5('0x2e')],function(_0x465698){var _0x50b995={};_0x50b995[_0x465698]={'$like':'%'+_0x4b0f10[_0x63b5('0x2d')][_0x63b5('0x35')]+'%'};return _0x50b995;})});}_0x37afe1=_['merge']({},_0x37afe1,_0x4b0f10['options']);return _0x3fd1af[_0x63b5('0x4a')](_0x37afe1);}})[_0x63b5('0x21')](function(_0x1fd565){if(_0x1fd565){_0x4ddf47=_0x1fd565[_0x63b5('0x3e')];if(!_0x4b0f10[_0x63b5('0x2d')]['hasOwnProperty'](_0x63b5('0x31'))){_0x37afe1[_0x63b5('0x1c')]=qs[_0x63b5('0x1c')](_0x4b0f10['query'][_0x63b5('0x1c')]);_0x37afe1[_0x63b5('0x1b')]=qs[_0x63b5('0x1b')](_0x4b0f10[_0x63b5('0x2d')][_0x63b5('0x1b')]);}return _0x3fd1af[_0x63b5('0x4a')](_0x37afe1);}})['then'](function(_0x42b510){if(_0x42b510){return _0x42b510?{'count':_0x4ddf47,'rows':_0x42b510}:null;}})['then'](respondWithResult(_0x22af35,null))[_0x63b5('0x3c')](handleError(_0x22af35,null));};exports[_0x63b5('0x4b')]=function(_0x31ce9b,_0xea2991,_0x1a0b38){var _0x3457b5={};var _0x19c8ed={};var _0x8919ee;var _0x5bf769;return db[_0x63b5('0x38')][_0x63b5('0x47')]({'where':{'id':_0x31ce9b[_0x63b5('0x3d')]['id']}})[_0x63b5('0x21')](handleEntityNotFound(_0xea2991,null))[_0x63b5('0x21')](function(_0x2c090d){if(_0x2c090d){_0x8919ee=_0x2c090d;_0x19c8ed[_0x63b5('0x2c')]=_[_0x63b5('0x2a')](db[_0x63b5('0x48')]['rawAttributes']);_0x19c8ed['query']=_['keys'](_0x31ce9b[_0x63b5('0x2d')]);_0x19c8ed[_0x63b5('0x34')]=_['intersection'](_0x19c8ed[_0x63b5('0x2c')],_0x19c8ed[_0x63b5('0x2d')]);_0x3457b5['attributes']=_[_0x63b5('0x2b')](_0x19c8ed[_0x63b5('0x2c')],qs[_0x63b5('0x2f')](_0x31ce9b['query'][_0x63b5('0x2f')]));_0x3457b5['attributes']=_0x3457b5[_0x63b5('0x2e')][_0x63b5('0x3e')]?_0x3457b5[_0x63b5('0x2e')]:_0x19c8ed[_0x63b5('0x2c')];_0x3457b5[_0x63b5('0x4c')]=qs['sort'](_0x31ce9b[_0x63b5('0x2d')][_0x63b5('0x32')]);_0x3457b5[_0x63b5('0x33')]=qs[_0x63b5('0x34')](_[_0x63b5('0x49')](_0x31ce9b[_0x63b5('0x2d')],_0x19c8ed[_0x63b5('0x34')]));if(_0x31ce9b[_0x63b5('0x2d')][_0x63b5('0x35')]){_0x3457b5['where']=_[_0x63b5('0x37')](_0x3457b5[_0x63b5('0x33')],{'$or':_[_0x63b5('0x25')](_0x3457b5[_0x63b5('0x2e')],function(_0x16530e){var _0x593810={};_0x593810[_0x16530e]={'$like':'%'+_0x31ce9b[_0x63b5('0x2d')][_0x63b5('0x35')]+'%'};return _0x593810;})});}_0x3457b5=_['merge']({},_0x3457b5,_0x31ce9b['options']);return _0x8919ee[_0x63b5('0x4b')](_0x3457b5);}})[_0x63b5('0x21')](function(_0x28f35d){if(_0x28f35d){_0x5bf769=_0x28f35d[_0x63b5('0x3e')];if(!_0x31ce9b[_0x63b5('0x2d')][_0x63b5('0x30')](_0x63b5('0x31'))){_0x3457b5[_0x63b5('0x1c')]=qs[_0x63b5('0x1c')](_0x31ce9b['query'][_0x63b5('0x1c')]);_0x3457b5[_0x63b5('0x1b')]=qs[_0x63b5('0x1b')](_0x31ce9b[_0x63b5('0x2d')]['offset']);}return _0x8919ee[_0x63b5('0x4b')](_0x3457b5);}})['then'](function(_0x59a29a){if(_0x59a29a){return _0x59a29a?{'count':_0x5bf769,'rows':_0x59a29a}:null;}})[_0x63b5('0x21')](respondWithResult(_0xea2991,null))[_0x63b5('0x3c')](handleError(_0xea2991,null));}; \ No newline at end of file +var _0xd160=['path','sox','to-csv','ejs','fs-extra','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','getSubjects','findOne','SugarcrmField','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd160,0xe9));var _0x0d16=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0xd160[_0xea35d1];return _0x1d7a7c;};'use strict';var emlformat=require(_0x0d16('0x0'));var rimraf=require(_0x0d16('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d16('0x2'));var moment=require(_0x0d16('0x3'));var BPromise=require(_0x0d16('0x4'));var Mustache=require(_0x0d16('0x5'));var util=require(_0x0d16('0x6'));var path=require(_0x0d16('0x7'));var sox=require(_0x0d16('0x8'));var csv=require(_0x0d16('0x9'));var ejs=require(_0x0d16('0xa'));var fs=require('fs');var fs_extra=require(_0x0d16('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0d16('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d16('0x9'));var querystring=require('querystring');var Papa=require(_0x0d16('0xd'));var Redis=require(_0x0d16('0xe'));var authService=require(_0x0d16('0xf'));var qs=require(_0x0d16('0x10'));var as=require(_0x0d16('0x11'));var hardwareService=require(_0x0d16('0x12'));var logger=require(_0x0d16('0x13'))('api');var utils=require(_0x0d16('0x14'));var config=require(_0x0d16('0x15'));var licenseUtil=require(_0x0d16('0x16'));var db=require(_0x0d16('0x17'))['db'];function respondWithStatusCode(_0x4d9e23,_0x4fdf72){_0x4fdf72=_0x4fdf72||0xcc;return function(_0x13cb66){if(_0x13cb66){return _0x4d9e23[_0x0d16('0x18')](_0x4fdf72);}return _0x4d9e23[_0x0d16('0x19')](_0x4fdf72)[_0x0d16('0x1a')]();};}function respondWithResult(_0x355167,_0x5a0acb){_0x5a0acb=_0x5a0acb||0xc8;return function(_0x3163c1){if(_0x3163c1){return _0x355167[_0x0d16('0x19')](_0x5a0acb)[_0x0d16('0x1b')](_0x3163c1);}};}function respondWithFilteredResult(_0x3a9693,_0x1fb499){return function(_0x3eedae){if(_0x3eedae){var _0x435fe1=typeof _0x1fb499[_0x0d16('0x1c')]===_0x0d16('0x1d')&&typeof _0x1fb499[_0x0d16('0x1e')]==='undefined';var _0x5928ff=_0x3eedae[_0x0d16('0x1f')];var _0x1c9d79=_0x435fe1?0x0:_0x1fb499[_0x0d16('0x1c')];var _0x519819=_0x435fe1?_0x3eedae[_0x0d16('0x1f')]:_0x1fb499['offset']+_0x1fb499[_0x0d16('0x1e')];var _0x3ffd7b;if(_0x519819>=_0x5928ff){_0x519819=_0x5928ff;_0x3ffd7b=0xc8;}else{_0x3ffd7b=0xce;}_0x3a9693[_0x0d16('0x19')](_0x3ffd7b);return _0x3a9693[_0x0d16('0x20')](_0x0d16('0x21'),_0x1c9d79+'-'+_0x519819+'/'+_0x5928ff)[_0x0d16('0x1b')](_0x3eedae);}return null;};}function patchUpdates(_0x452bc4){return function(_0x3cf515){try{jsonpatch[_0x0d16('0x22')](_0x3cf515,_0x452bc4,!![]);}catch(_0x56bb41){return BPromise[_0x0d16('0x23')](_0x56bb41);}return _0x3cf515['save']();};}function saveUpdates(_0x56bdf7,_0x113a1b){return function(_0x188842){if(_0x188842){return _0x188842[_0x0d16('0x24')](_0x56bdf7)[_0x0d16('0x25')](function(_0x26d175){return _0x26d175;});}return null;};}function removeEntity(_0x3e0a3e,_0x4e732b){return function(_0x4eff7d){if(_0x4eff7d){return _0x4eff7d[_0x0d16('0x26')]()[_0x0d16('0x25')](function(){_0x3e0a3e[_0x0d16('0x19')](0xcc)[_0x0d16('0x1a')]();});}};}function handleEntityNotFound(_0x3afcbd,_0x150df4){return function(_0x25f517){if(!_0x25f517){_0x3afcbd['sendStatus'](0x194);}return _0x25f517;};}function handleError(_0x27f66e,_0x39691f){_0x39691f=_0x39691f||0x1f4;return function(_0x5f1244){logger[_0x0d16('0x27')](_0x5f1244['stack']);if(_0x5f1244['name']){delete _0x5f1244[_0x0d16('0x28')];}_0x27f66e[_0x0d16('0x19')](_0x39691f)[_0x0d16('0x29')](_0x5f1244);};}exports[_0x0d16('0x2a')]=function(_0x5fd3f1,_0x565014){var _0x1b7eb6={},_0x36259b={},_0xb2e5f8={'count':0x0,'rows':[]};var _0x57911f=_[_0x0d16('0x2b')](db[_0x0d16('0x2c')][_0x0d16('0x2d')],function(_0xcaa164){return{'name':_0xcaa164['fieldName'],'type':_0xcaa164[_0x0d16('0x2e')]['key']};});_0x36259b[_0x0d16('0x2f')]=_[_0x0d16('0x2b')](_0x57911f,_0x0d16('0x28'));_0x36259b['query']=_[_0x0d16('0x30')](_0x5fd3f1['query']);_0x36259b[_0x0d16('0x31')]=_['intersection'](_0x36259b[_0x0d16('0x2f')],_0x36259b[_0x0d16('0x32')]);_0x1b7eb6[_0x0d16('0x33')]=_[_0x0d16('0x34')](_0x36259b[_0x0d16('0x2f')],qs['fields'](_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x35')]));_0x1b7eb6['attributes']=_0x1b7eb6[_0x0d16('0x33')][_0x0d16('0x36')]?_0x1b7eb6[_0x0d16('0x33')]:_0x36259b[_0x0d16('0x2f')];if(!_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x37')](_0x0d16('0x38'))){_0x1b7eb6['limit']=qs[_0x0d16('0x1e')](_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x1e')]);_0x1b7eb6['offset']=qs[_0x0d16('0x1c')](_0x5fd3f1[_0x0d16('0x32')]['offset']);}_0x1b7eb6[_0x0d16('0x39')]=qs[_0x0d16('0x3a')](_0x5fd3f1[_0x0d16('0x32')]['sort']);_0x1b7eb6[_0x0d16('0x3b')]=qs['filters'](_[_0x0d16('0x3c')](_0x5fd3f1['query'],_0x36259b[_0x0d16('0x31')]),_0x57911f);if(_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x3d')]){_0x1b7eb6['where']=_['merge'](_0x1b7eb6[_0x0d16('0x3b')],{'$or':_[_0x0d16('0x2b')](_0x57911f,function(_0x443c7f){if(_0x443c7f[_0x0d16('0x2e')]!==_0x0d16('0x3e')){var _0x1a812d={};_0x1a812d[_0x443c7f[_0x0d16('0x28')]]={'$like':'%'+_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x3d')]+'%'};return _0x1a812d;}})});}_0x1b7eb6=_[_0x0d16('0x3f')]({},_0x1b7eb6,_0x5fd3f1[_0x0d16('0x40')]);var _0x24fd55={'where':_0x1b7eb6[_0x0d16('0x3b')]};return db[_0x0d16('0x2c')]['count'](_0x24fd55)['then'](function(_0x3f1ee1){_0xb2e5f8[_0x0d16('0x1f')]=_0x3f1ee1;if(_0x5fd3f1[_0x0d16('0x32')][_0x0d16('0x41')]){_0x1b7eb6[_0x0d16('0x42')]=[{'all':!![]}];}return db[_0x0d16('0x2c')][_0x0d16('0x43')](_0x1b7eb6);})[_0x0d16('0x25')](function(_0x5d24a0){_0xb2e5f8[_0x0d16('0x44')]=_0x5d24a0;return _0xb2e5f8;})[_0x0d16('0x25')](respondWithFilteredResult(_0x565014,_0x1b7eb6))[_0x0d16('0x45')](handleError(_0x565014,null));};exports[_0x0d16('0x46')]=function(_0x3e1281,_0x494e53){var _0x52c0eb={'raw':![],'where':{'id':_0x3e1281[_0x0d16('0x47')]['id']}},_0x321235={};_0x321235[_0x0d16('0x2f')]=_[_0x0d16('0x30')](db[_0x0d16('0x2c')]['rawAttributes']);_0x321235[_0x0d16('0x32')]=_[_0x0d16('0x30')](_0x3e1281[_0x0d16('0x32')]);_0x321235['filters']=_[_0x0d16('0x34')](_0x321235[_0x0d16('0x2f')],_0x321235[_0x0d16('0x32')]);_0x52c0eb[_0x0d16('0x33')]=_[_0x0d16('0x34')](_0x321235[_0x0d16('0x2f')],qs[_0x0d16('0x35')](_0x3e1281['query']['fields']));_0x52c0eb['attributes']=_0x52c0eb[_0x0d16('0x33')][_0x0d16('0x36')]?_0x52c0eb['attributes']:_0x321235[_0x0d16('0x2f')];if(_0x3e1281[_0x0d16('0x32')][_0x0d16('0x41')]){_0x52c0eb[_0x0d16('0x42')]=[{'all':!![]}];}_0x52c0eb=_[_0x0d16('0x3f')]({},_0x52c0eb,_0x3e1281[_0x0d16('0x40')]);return db[_0x0d16('0x2c')][_0x0d16('0x48')](_0x52c0eb)['then'](handleEntityNotFound(_0x494e53,null))[_0x0d16('0x25')](respondWithResult(_0x494e53,null))[_0x0d16('0x45')](handleError(_0x494e53,null));};exports[_0x0d16('0x49')]=function(_0x2d85be,_0x1e7eba){return db['SugarcrmConfiguration'][_0x0d16('0x49')](_0x2d85be[_0x0d16('0x4a')],{})[_0x0d16('0x25')](respondWithResult(_0x1e7eba,0xc9))[_0x0d16('0x45')](handleError(_0x1e7eba,null));};exports[_0x0d16('0x24')]=function(_0x48db4c,_0x1f9218){if(_0x48db4c[_0x0d16('0x4a')]['id']){delete _0x48db4c[_0x0d16('0x4a')]['id'];}return db[_0x0d16('0x2c')]['find']({'where':{'id':_0x48db4c[_0x0d16('0x47')]['id']}})[_0x0d16('0x25')](handleEntityNotFound(_0x1f9218,null))[_0x0d16('0x25')](saveUpdates(_0x48db4c[_0x0d16('0x4a')],null))[_0x0d16('0x25')](respondWithResult(_0x1f9218,null))[_0x0d16('0x45')](handleError(_0x1f9218,null));};exports[_0x0d16('0x26')]=function(_0x5dfb97,_0x55915b){return db['SugarcrmConfiguration'][_0x0d16('0x48')]({'where':{'id':_0x5dfb97['params']['id']}})[_0x0d16('0x25')](handleEntityNotFound(_0x55915b,null))['then'](removeEntity(_0x55915b,null))[_0x0d16('0x45')](handleError(_0x55915b,null));};exports[_0x0d16('0x4b')]=function(_0x3a28ba,_0x536f05,_0x230cbb){var _0x1e7fdf={};var _0x477d9c={};var _0x43241c;var _0x10c9e9;return db[_0x0d16('0x2c')]['findOne']({'where':{'id':_0x3a28ba[_0x0d16('0x47')]['id']}})[_0x0d16('0x25')](handleEntityNotFound(_0x536f05,null))[_0x0d16('0x25')](function(_0x4404eb){if(_0x4404eb){_0x43241c=_0x4404eb;_0x477d9c[_0x0d16('0x2f')]=_[_0x0d16('0x30')](db['SugarcrmField'][_0x0d16('0x2d')]);_0x477d9c[_0x0d16('0x32')]=_[_0x0d16('0x30')](_0x3a28ba['query']);_0x477d9c['filters']=_['intersection'](_0x477d9c[_0x0d16('0x2f')],_0x477d9c[_0x0d16('0x32')]);_0x1e7fdf[_0x0d16('0x33')]=_[_0x0d16('0x34')](_0x477d9c[_0x0d16('0x2f')],qs['fields'](_0x3a28ba[_0x0d16('0x32')][_0x0d16('0x35')]));_0x1e7fdf['attributes']=_0x1e7fdf[_0x0d16('0x33')]['length']?_0x1e7fdf[_0x0d16('0x33')]:_0x477d9c[_0x0d16('0x2f')];_0x1e7fdf['order']=qs[_0x0d16('0x3a')](_0x3a28ba[_0x0d16('0x32')][_0x0d16('0x3a')]);_0x1e7fdf['where']=qs[_0x0d16('0x31')](_[_0x0d16('0x3c')](_0x3a28ba[_0x0d16('0x32')],_0x477d9c[_0x0d16('0x31')]));if(_0x3a28ba['query'][_0x0d16('0x3d')]){_0x1e7fdf[_0x0d16('0x3b')]=_[_0x0d16('0x3f')](_0x1e7fdf['where'],{'$or':_['map'](_0x1e7fdf['attributes'],function(_0x471f9e){var _0x56ecfa={};_0x56ecfa[_0x471f9e]={'$like':'%'+_0x3a28ba[_0x0d16('0x32')]['filter']+'%'};return _0x56ecfa;})});}_0x1e7fdf=_[_0x0d16('0x3f')]({},_0x1e7fdf,_0x3a28ba[_0x0d16('0x40')]);return _0x43241c[_0x0d16('0x4b')](_0x1e7fdf);}})[_0x0d16('0x25')](function(_0x35cd4a){if(_0x35cd4a){_0x10c9e9=_0x35cd4a[_0x0d16('0x36')];if(!_0x3a28ba[_0x0d16('0x32')][_0x0d16('0x37')]('nolimit')){_0x1e7fdf[_0x0d16('0x1e')]=qs[_0x0d16('0x1e')](_0x3a28ba[_0x0d16('0x32')][_0x0d16('0x1e')]);_0x1e7fdf[_0x0d16('0x1c')]=qs[_0x0d16('0x1c')](_0x3a28ba[_0x0d16('0x32')][_0x0d16('0x1c')]);}return _0x43241c['getFields'](_0x1e7fdf);}})[_0x0d16('0x25')](function(_0x201b05){if(_0x201b05){return _0x201b05?{'count':_0x10c9e9,'rows':_0x201b05}:null;}})[_0x0d16('0x25')](respondWithResult(_0x536f05,null))[_0x0d16('0x45')](handleError(_0x536f05,null));};exports[_0x0d16('0x4c')]=function(_0x1aa635,_0x32c607,_0x1b5867){var _0x319ee4={};var _0x2a8a85={};var _0x2a68b4;var _0x5a3aa7;return db['SugarcrmConfiguration'][_0x0d16('0x4d')]({'where':{'id':_0x1aa635['params']['id']}})[_0x0d16('0x25')](handleEntityNotFound(_0x32c607,null))[_0x0d16('0x25')](function(_0x1e36ba){if(_0x1e36ba){_0x2a68b4=_0x1e36ba;_0x2a8a85[_0x0d16('0x2f')]=_[_0x0d16('0x30')](db[_0x0d16('0x4e')][_0x0d16('0x2d')]);_0x2a8a85[_0x0d16('0x32')]=_[_0x0d16('0x30')](_0x1aa635['query']);_0x2a8a85['filters']=_[_0x0d16('0x34')](_0x2a8a85[_0x0d16('0x2f')],_0x2a8a85[_0x0d16('0x32')]);_0x319ee4[_0x0d16('0x33')]=_[_0x0d16('0x34')](_0x2a8a85[_0x0d16('0x2f')],qs[_0x0d16('0x35')](_0x1aa635[_0x0d16('0x32')]['fields']));_0x319ee4['attributes']=_0x319ee4['attributes'][_0x0d16('0x36')]?_0x319ee4[_0x0d16('0x33')]:_0x2a8a85[_0x0d16('0x2f')];_0x319ee4[_0x0d16('0x39')]=qs[_0x0d16('0x3a')](_0x1aa635['query'][_0x0d16('0x3a')]);_0x319ee4['where']=qs[_0x0d16('0x31')](_[_0x0d16('0x3c')](_0x1aa635[_0x0d16('0x32')],_0x2a8a85[_0x0d16('0x31')]));if(_0x1aa635[_0x0d16('0x32')][_0x0d16('0x3d')]){_0x319ee4[_0x0d16('0x3b')]=_[_0x0d16('0x3f')](_0x319ee4[_0x0d16('0x3b')],{'$or':_[_0x0d16('0x2b')](_0x319ee4[_0x0d16('0x33')],function(_0x584ba7){var _0x1fe7be={};_0x1fe7be[_0x584ba7]={'$like':'%'+_0x1aa635[_0x0d16('0x32')][_0x0d16('0x3d')]+'%'};return _0x1fe7be;})});}_0x319ee4=_[_0x0d16('0x3f')]({},_0x319ee4,_0x1aa635[_0x0d16('0x40')]);return _0x2a68b4[_0x0d16('0x4c')](_0x319ee4);}})[_0x0d16('0x25')](function(_0x4e2a52){if(_0x4e2a52){_0x5a3aa7=_0x4e2a52[_0x0d16('0x36')];if(!_0x1aa635[_0x0d16('0x32')][_0x0d16('0x37')](_0x0d16('0x38'))){_0x319ee4[_0x0d16('0x1e')]=qs[_0x0d16('0x1e')](_0x1aa635[_0x0d16('0x32')][_0x0d16('0x1e')]);_0x319ee4['offset']=qs[_0x0d16('0x1c')](_0x1aa635[_0x0d16('0x32')][_0x0d16('0x1c')]);}return _0x2a68b4['getSubjects'](_0x319ee4);}})[_0x0d16('0x25')](function(_0x3b7986){if(_0x3b7986){return _0x3b7986?{'count':_0x5a3aa7,'rows':_0x3b7986}:null;}})[_0x0d16('0x25')](respondWithResult(_0x32c607,null))[_0x0d16('0x45')](handleError(_0x32c607,null));};exports[_0x0d16('0x4f')]=function(_0x34b0eb,_0x345cf4,_0xaf4fee){var _0x379389={};var _0x1a0dcd={};var _0x30172a;var _0x4fbe72;return db[_0x0d16('0x2c')][_0x0d16('0x4d')]({'where':{'id':_0x34b0eb[_0x0d16('0x47')]['id']}})['then'](handleEntityNotFound(_0x345cf4,null))[_0x0d16('0x25')](function(_0x325534){if(_0x325534){_0x30172a=_0x325534;_0x1a0dcd[_0x0d16('0x2f')]=_[_0x0d16('0x30')](db[_0x0d16('0x4e')][_0x0d16('0x2d')]);_0x1a0dcd['query']=_[_0x0d16('0x30')](_0x34b0eb[_0x0d16('0x32')]);_0x1a0dcd[_0x0d16('0x31')]=_[_0x0d16('0x34')](_0x1a0dcd[_0x0d16('0x2f')],_0x1a0dcd['query']);_0x379389['attributes']=_['intersection'](_0x1a0dcd[_0x0d16('0x2f')],qs[_0x0d16('0x35')](_0x34b0eb['query'][_0x0d16('0x35')]));_0x379389[_0x0d16('0x33')]=_0x379389[_0x0d16('0x33')][_0x0d16('0x36')]?_0x379389[_0x0d16('0x33')]:_0x1a0dcd[_0x0d16('0x2f')];_0x379389[_0x0d16('0x39')]=qs['sort'](_0x34b0eb[_0x0d16('0x32')][_0x0d16('0x3a')]);_0x379389[_0x0d16('0x3b')]=qs[_0x0d16('0x31')](_['pick'](_0x34b0eb['query'],_0x1a0dcd[_0x0d16('0x31')]));if(_0x34b0eb[_0x0d16('0x32')]['filter']){_0x379389['where']=_[_0x0d16('0x3f')](_0x379389[_0x0d16('0x3b')],{'$or':_[_0x0d16('0x2b')](_0x379389[_0x0d16('0x33')],function(_0x4d4eb9){var _0x532b31={};_0x532b31[_0x4d4eb9]={'$like':'%'+_0x34b0eb['query'][_0x0d16('0x3d')]+'%'};return _0x532b31;})});}_0x379389=_[_0x0d16('0x3f')]({},_0x379389,_0x34b0eb[_0x0d16('0x40')]);return _0x30172a[_0x0d16('0x4f')](_0x379389);}})[_0x0d16('0x25')](function(_0x519ef9){if(_0x519ef9){_0x4fbe72=_0x519ef9['length'];if(!_0x34b0eb[_0x0d16('0x32')][_0x0d16('0x37')](_0x0d16('0x38'))){_0x379389[_0x0d16('0x1e')]=qs[_0x0d16('0x1e')](_0x34b0eb[_0x0d16('0x32')][_0x0d16('0x1e')]);_0x379389[_0x0d16('0x1c')]=qs[_0x0d16('0x1c')](_0x34b0eb[_0x0d16('0x32')][_0x0d16('0x1c')]);}return _0x30172a[_0x0d16('0x4f')](_0x379389);}})[_0x0d16('0x25')](function(_0x1adb26){if(_0x1adb26){return _0x1adb26?{'count':_0x4fbe72,'rows':_0x1adb26}:null;}})[_0x0d16('0x25')](respondWithResult(_0x345cf4,null))[_0x0d16('0x45')](handleError(_0x345cf4,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 8b6cf82..88954d6 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 _0xeb44=['exports','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xeb44,0x17c));var _0x4eb4=function(_0xe52b57,_0x255d6c){_0xe52b57=_0xe52b57-0x0;var _0x567039=_0xeb44[_0xe52b57];return _0x567039;};'use strict';var _=require(_0x4eb4('0x0'));var util=require(_0x4eb4('0x1'));var logger=require(_0x4eb4('0x2'))('api');var moment=require(_0x4eb4('0x3'));var BPromise=require('bluebird');var rp=require(_0x4eb4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4eb4('0x5'));var config=require(_0x4eb4('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x4eb4('0x7')]=function(_0x1ad9e2,_0x473273){return _0x1ad9e2['define']('SugarcrmConfiguration',attributes,{'tableName':_0x4eb4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2643=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x3de154,_0x31b94a){var _0x1caf73=function(_0x509b53){while(--_0x509b53){_0x3de154['push'](_0x3de154['shift']());}};_0x1caf73(++_0x31b94a);}(_0x2643,0x155));var _0x3264=function(_0x198c45,_0x11150a){_0x198c45=_0x198c45-0x0;var _0x1fa9de=_0x2643[_0x198c45];return _0x1fa9de;};'use strict';var _=require(_0x3264('0x0'));var util=require(_0x3264('0x1'));var logger=require(_0x3264('0x2'))('api');var moment=require(_0x3264('0x3'));var BPromise=require(_0x3264('0x4'));var rp=require(_0x3264('0x5'));var fs=require('fs');var path=require(_0x3264('0x6'));var rimraf=require(_0x3264('0x7'));var config=require(_0x3264('0x8'));var attributes=require(_0x3264('0x9'));module[_0x3264('0xa')]=function(_0x30d538,_0x5525d2){return _0x30d538['define'](_0x3264('0xb'),attributes,{'tableName':_0x3264('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 57daa84..179772f 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 _0x806e=['rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x529f36,_0x6b4496){var _0x64d301=function(_0x5a1399){while(--_0x5a1399){_0x529f36['push'](_0x529f36['shift']());}};_0x64d301(++_0x6b4496);}(_0x806e,0x16f));var _0xe806=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x806e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe806('0x0'));var moment=require(_0xe806('0x1'));var BPromise=require(_0xe806('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe806('0x3'));var db=require(_0xe806('0x4'))['db'];var utils=require(_0xe806('0x5'));var logger=require(_0xe806('0x6'))(_0xe806('0x7'));var config=require(_0xe806('0x8'));var jayson=require(_0xe806('0x9'));var client=jayson[_0xe806('0xa')][_0xe806('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ebfd9,_0x2fecd8,_0x4da457){return new BPromise(function(_0x22670b,_0x3534fe){return client['request'](_0x1ebfd9,_0x4da457)[_0xe806('0xc')](function(_0x5d6561){logger[_0xe806('0xd')](_0xe806('0xe'),_0x2fecd8,_0xe806('0xf'));logger[_0xe806('0x10')](_0xe806('0x11'),_0x2fecd8,_0xe806('0xf'),JSON[_0xe806('0x12')](_0x5d6561));if(_0x5d6561[_0xe806('0x13')]){if(_0x5d6561[_0xe806('0x13')]['code']===0x1f4){logger[_0xe806('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2fecd8,_0x5d6561['error'][_0xe806('0x14')]);return _0x3534fe(_0x5d6561[_0xe806('0x13')]['message']);}logger[_0xe806('0x13')](_0xe806('0xe'),_0x2fecd8,_0x5d6561['error'][_0xe806('0x14')]);return _0x22670b(_0x5d6561['error']['message']);}else{logger[_0xe806('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2fecd8,_0xe806('0xf'));_0x22670b(_0x5d6561['result']['message']);}})[_0xe806('0x15')](function(_0x23a29e){logger[_0xe806('0x13')](_0xe806('0xe'),_0x2fecd8,_0x23a29e);_0x3534fe(_0x23a29e);});});} \ No newline at end of file +var _0xadc6=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x796aab,_0xb79b5c){var _0x93ba32=function(_0x56e55e){while(--_0x56e55e){_0x796aab['push'](_0x796aab['shift']());}};_0x93ba32(++_0xb79b5c);}(_0xadc6,0x170));var _0x6adc=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xadc6[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x6adc('0x0'));var util=require(_0x6adc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6adc('0x2'));var fs=require('fs');var Redis=require(_0x6adc('0x3'));var db=require(_0x6adc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6adc('0x5'))(_0x6adc('0x6'));var config=require('../../config/environment');var jayson=require(_0x6adc('0x7'));var client=jayson[_0x6adc('0x8')][_0x6adc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b584e,_0x22b379,_0x45125d){return new BPromise(function(_0x3e39b4,_0xcbd2a0){return client['request'](_0x3b584e,_0x45125d)[_0x6adc('0xa')](function(_0x2d6c6e){logger[_0x6adc('0xb')](_0x6adc('0xc'),_0x22b379,_0x6adc('0xd'));logger['debug'](_0x6adc('0xe'),_0x22b379,_0x6adc('0xd'),JSON[_0x6adc('0xf')](_0x2d6c6e));if(_0x2d6c6e['error']){if(_0x2d6c6e[_0x6adc('0x10')][_0x6adc('0x11')]===0x1f4){logger[_0x6adc('0x10')](_0x6adc('0xc'),_0x22b379,_0x2d6c6e['error']['message']);return _0xcbd2a0(_0x2d6c6e[_0x6adc('0x10')][_0x6adc('0x12')]);}logger['error'](_0x6adc('0xc'),_0x22b379,_0x2d6c6e['error'][_0x6adc('0x12')]);return _0x3e39b4(_0x2d6c6e[_0x6adc('0x10')][_0x6adc('0x12')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x22b379,_0x6adc('0xd'));_0x3e39b4(_0x2d6c6e[_0x6adc('0x13')]['message']);}})[_0x6adc('0x14')](function(_0x21b4b3){logger[_0x6adc('0x10')](_0x6adc('0xc'),_0x22b379,_0x21b4b3);_0xcbd2a0(_0x21b4b3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1f2a6f3..61833a7 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 _0xf31a=['../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xf31a,0x150));var _0xaf31=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xf31a[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0xaf31('0x0'));var util=require(_0xaf31('0x1'));var path=require('path');var timeout=require(_0xaf31('0x2'));var express=require(_0xaf31('0x3'));var router=express[_0xaf31('0x4')]();var fs_extra=require(_0xaf31('0x5'));var auth=require(_0xaf31('0x6'));var interaction=require(_0xaf31('0x7'));var config=require(_0xaf31('0x8'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaf31('0x9'),auth[_0xaf31('0xa')](),controller[_0xaf31('0xb')]);router[_0xaf31('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf31('0xd')]);router[_0xaf31('0xe')](_0xaf31('0x9'),auth[_0xaf31('0xa')](),controller[_0xaf31('0xf')]);router['delete'](_0xaf31('0x9'),auth['isAuthenticated'](),controller[_0xaf31('0x10')]);module[_0xaf31('0x11')]=router; \ No newline at end of file +var _0xf709=['isAuthenticated','index','get','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf709,0x1ae));var _0x9f70=function(_0x586180,_0x67c06){_0x586180=_0x586180-0x0;var _0x4e47ae=_0xf709[_0x586180];return _0x4e47ae;};'use strict';var multer=require(_0x9f70('0x0'));var util=require(_0x9f70('0x1'));var path=require('path');var timeout=require(_0x9f70('0x2'));var express=require(_0x9f70('0x3'));var router=express[_0x9f70('0x4')]();var fs_extra=require(_0x9f70('0x5'));var auth=require(_0x9f70('0x6'));var interaction=require(_0x9f70('0x7'));var config=require(_0x9f70('0x8'));var controller=require(_0x9f70('0x9'));router['get']('/',auth[_0x9f70('0xa')](),controller[_0x9f70('0xb')]);router[_0x9f70('0xc')](_0x9f70('0xd'),auth['isAuthenticated'](),controller[_0x9f70('0xe')]);router[_0x9f70('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9f70('0x10')](_0x9f70('0xd'),auth['isAuthenticated'](),controller[_0x9f70('0x11')]);router[_0x9f70('0x12')](_0x9f70('0xd'),auth[_0x9f70('0xa')](),controller['destroy']);module[_0x9f70('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 10fcc1e..4f99f23 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 _0x84e2=['ENUM','string','customVariable','keyValue','STRING','variable','exports'];(function(_0x5d6280,_0x3f72ab){var _0x77b738=function(_0x1b8208){while(--_0x1b8208){_0x5d6280['push'](_0x5d6280['shift']());}};_0x77b738(++_0x3f72ab);}(_0x84e2,0x1b1));var _0x284e=function(_0x50af9c,_0xf03b1e){_0x50af9c=_0x50af9c-0x0;var _0x5b5e5a=_0x84e2[_0x50af9c];return _0x5b5e5a;};'use strict';var Sequelize=require('sequelize');module[_0x284e('0x0')]={'type':{'type':Sequelize[_0x284e('0x1')](_0x284e('0x2'),'variable',_0x284e('0x3'),_0x284e('0x4'),'picklist'),'defaultValue':_0x284e('0x2')},'content':{'type':Sequelize[_0x284e('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x284e('0x1')](_0x284e('0x2'),_0x284e('0x6'),_0x284e('0x3'))},'keyContent':{'type':Sequelize[_0x284e('0x5')]},'idField':{'type':Sequelize[_0x284e('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x284e('0x5')]}}; \ No newline at end of file +var _0xc253=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3037ae,_0x4f5dd6){var _0x233075=function(_0x4dcfb2){while(--_0x4dcfb2){_0x3037ae['push'](_0x3037ae['shift']());}};_0x233075(++_0x4f5dd6);}(_0xc253,0x1e7));var _0x3c25=function(_0x252ef1,_0x2e0041){_0x252ef1=_0x252ef1-0x0;var _0x25817c=_0xc253[_0x252ef1];return _0x25817c;};'use strict';var Sequelize=require(_0x3c25('0x0'));module[_0x3c25('0x1')]={'type':{'type':Sequelize[_0x3c25('0x2')](_0x3c25('0x3'),_0x3c25('0x4'),_0x3c25('0x5'),_0x3c25('0x6'),_0x3c25('0x7')),'defaultValue':_0x3c25('0x3')},'content':{'type':Sequelize[_0x3c25('0x8')]},'key':{'type':Sequelize[_0x3c25('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3c25('0x4'),_0x3c25('0x5'))},'keyContent':{'type':Sequelize[_0x3c25('0x8')]},'idField':{'type':Sequelize[_0x3c25('0x8')]},'nameField':{'type':Sequelize[_0x3c25('0x8')]},'customField':{'type':Sequelize[_0x3c25('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3c25('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5989267..b0a1580 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 _0x4dc8=['limit','count','set','Content-Range','reject','update','then','error','name','send','map','SugarcrmField','type','key','model','keys','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x41476c,_0x325c44){var _0xfa07bc=function(_0x20090d){while(--_0x20090d){_0x41476c['push'](_0x41476c['shift']());}};_0xfa07bc(++_0x325c44);}(_0x4dc8,0xb8));var _0x84dc=function(_0x52c84a,_0x39ae1b){_0x52c84a=_0x52c84a-0x0;var _0x11db0b=_0x4dc8[_0x52c84a];return _0x11db0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x84dc('0x0'));var jsonpatch=require(_0x84dc('0x1'));var rp=require(_0x84dc('0x2'));var moment=require(_0x84dc('0x3'));var BPromise=require(_0x84dc('0x4'));var Mustache=require(_0x84dc('0x5'));var util=require('util');var path=require(_0x84dc('0x6'));var sox=require(_0x84dc('0x7'));var csv=require(_0x84dc('0x8'));var ejs=require(_0x84dc('0x9'));var fs=require('fs');var fs_extra=require(_0x84dc('0xa'));var _=require('lodash');var squel=require(_0x84dc('0xb'));var crypto=require(_0x84dc('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x84dc('0x8'));var querystring=require(_0x84dc('0xd'));var Papa=require('papaparse');var Redis=require(_0x84dc('0xe'));var authService=require(_0x84dc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x84dc('0x10'));var hardwareService=require(_0x84dc('0x11'));var logger=require(_0x84dc('0x12'))(_0x84dc('0x13'));var utils=require(_0x84dc('0x14'));var config=require(_0x84dc('0x15'));var licenseUtil=require(_0x84dc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41c84c,_0x35d306){_0x35d306=_0x35d306||0xcc;return function(_0x5389bc){if(_0x5389bc){return _0x41c84c[_0x84dc('0x17')](_0x35d306);}return _0x41c84c[_0x84dc('0x18')](_0x35d306)[_0x84dc('0x19')]();};}function respondWithResult(_0x15ee88,_0x3c5597){_0x3c5597=_0x3c5597||0xc8;return function(_0x4d6784){if(_0x4d6784){return _0x15ee88[_0x84dc('0x18')](_0x3c5597)[_0x84dc('0x1a')](_0x4d6784);}};}function respondWithFilteredResult(_0x4bcaab,_0x55bcf6){return function(_0x43a561){if(_0x43a561){var _0x4185e9=typeof _0x55bcf6[_0x84dc('0x1b')]===_0x84dc('0x1c')&&typeof _0x55bcf6[_0x84dc('0x1d')]===_0x84dc('0x1c');var _0x395c6e=_0x43a561[_0x84dc('0x1e')];var _0x2f1ae4=_0x4185e9?0x0:_0x55bcf6[_0x84dc('0x1b')];var _0x5ed0ae=_0x4185e9?_0x43a561[_0x84dc('0x1e')]:_0x55bcf6['offset']+_0x55bcf6['limit'];var _0xfaac8f;if(_0x5ed0ae>=_0x395c6e){_0x5ed0ae=_0x395c6e;_0xfaac8f=0xc8;}else{_0xfaac8f=0xce;}_0x4bcaab['status'](_0xfaac8f);return _0x4bcaab[_0x84dc('0x1f')](_0x84dc('0x20'),_0x2f1ae4+'-'+_0x5ed0ae+'/'+_0x395c6e)[_0x84dc('0x1a')](_0x43a561);}return null;};}function patchUpdates(_0x2fa1e1){return function(_0x4a69fb){try{jsonpatch['apply'](_0x4a69fb,_0x2fa1e1,!![]);}catch(_0x2812df){return BPromise[_0x84dc('0x21')](_0x2812df);}return _0x4a69fb['save']();};}function saveUpdates(_0x4918c1,_0x5f1c6d){return function(_0x5de5c4){if(_0x5de5c4){return _0x5de5c4[_0x84dc('0x22')](_0x4918c1)[_0x84dc('0x23')](function(_0x39c747){return _0x39c747;});}return null;};}function removeEntity(_0x8b9e8d,_0x25d10d){return function(_0x22cea2){if(_0x22cea2){return _0x22cea2['destroy']()[_0x84dc('0x23')](function(){_0x8b9e8d[_0x84dc('0x18')](0xcc)[_0x84dc('0x19')]();});}};}function handleEntityNotFound(_0x212a67,_0x6817d){return function(_0x4a9972){if(!_0x4a9972){_0x212a67[_0x84dc('0x17')](0x194);}return _0x4a9972;};}function handleError(_0x14e024,_0x1d0eb1){_0x1d0eb1=_0x1d0eb1||0x1f4;return function(_0x40f503){logger[_0x84dc('0x24')](_0x40f503['stack']);if(_0x40f503[_0x84dc('0x25')]){delete _0x40f503[_0x84dc('0x25')];}_0x14e024[_0x84dc('0x18')](_0x1d0eb1)[_0x84dc('0x26')](_0x40f503);};}exports['index']=function(_0x1bab08,_0x19deaa){var _0x190f18={},_0x14000a={},_0x269f4e={'count':0x0,'rows':[]};var _0x209347=_[_0x84dc('0x27')](db[_0x84dc('0x28')]['rawAttributes'],function(_0x2f3406){return{'name':_0x2f3406['fieldName'],'type':_0x2f3406[_0x84dc('0x29')][_0x84dc('0x2a')]};});_0x14000a[_0x84dc('0x2b')]=_[_0x84dc('0x27')](_0x209347,_0x84dc('0x25'));_0x14000a['query']=_[_0x84dc('0x2c')](_0x1bab08['query']);_0x14000a['filters']=_[_0x84dc('0x2d')](_0x14000a['model'],_0x14000a['query']);_0x190f18['attributes']=_[_0x84dc('0x2d')](_0x14000a[_0x84dc('0x2b')],qs[_0x84dc('0x2e')](_0x1bab08[_0x84dc('0x2f')][_0x84dc('0x2e')]));_0x190f18[_0x84dc('0x30')]=_0x190f18[_0x84dc('0x30')][_0x84dc('0x31')]?_0x190f18[_0x84dc('0x30')]:_0x14000a[_0x84dc('0x2b')];if(!_0x1bab08[_0x84dc('0x2f')][_0x84dc('0x32')](_0x84dc('0x33'))){_0x190f18['limit']=qs['limit'](_0x1bab08[_0x84dc('0x2f')]['limit']);_0x190f18[_0x84dc('0x1b')]=qs[_0x84dc('0x1b')](_0x1bab08['query'][_0x84dc('0x1b')]);}_0x190f18[_0x84dc('0x34')]=qs[_0x84dc('0x35')](_0x1bab08['query'][_0x84dc('0x35')]);_0x190f18['where']=qs[_0x84dc('0x36')](_['pick'](_0x1bab08[_0x84dc('0x2f')],_0x14000a[_0x84dc('0x36')]),_0x209347);if(_0x1bab08[_0x84dc('0x2f')]['filter']){_0x190f18[_0x84dc('0x37')]=_[_0x84dc('0x38')](_0x190f18[_0x84dc('0x37')],{'$or':_[_0x84dc('0x27')](_0x209347,function(_0x1b0c0b){if(_0x1b0c0b['type']!=='VIRTUAL'){var _0x5a4e46={};_0x5a4e46[_0x1b0c0b[_0x84dc('0x25')]]={'$like':'%'+_0x1bab08[_0x84dc('0x2f')][_0x84dc('0x39')]+'%'};return _0x5a4e46;}})});}_0x190f18=_[_0x84dc('0x38')]({},_0x190f18,_0x1bab08['options']);var _0x3750be={'where':_0x190f18[_0x84dc('0x37')]};return db[_0x84dc('0x28')][_0x84dc('0x1e')](_0x3750be)['then'](function(_0x57223e){_0x269f4e[_0x84dc('0x1e')]=_0x57223e;if(_0x1bab08[_0x84dc('0x2f')][_0x84dc('0x3a')]){_0x190f18[_0x84dc('0x3b')]=[{'all':!![]}];}return db['SugarcrmField'][_0x84dc('0x3c')](_0x190f18);})['then'](function(_0x42de06){_0x269f4e[_0x84dc('0x3d')]=_0x42de06;return _0x269f4e;})[_0x84dc('0x23')](respondWithFilteredResult(_0x19deaa,_0x190f18))[_0x84dc('0x3e')](handleError(_0x19deaa,null));};exports[_0x84dc('0x3f')]=function(_0x769c41,_0x4ec14a){var _0x468bca={'raw':!![],'where':{'id':_0x769c41[_0x84dc('0x40')]['id']}},_0x53cd56={};_0x53cd56[_0x84dc('0x2b')]=_[_0x84dc('0x2c')](db[_0x84dc('0x28')][_0x84dc('0x41')]);_0x53cd56['query']=_['keys'](_0x769c41['query']);_0x53cd56[_0x84dc('0x36')]=_[_0x84dc('0x2d')](_0x53cd56['model'],_0x53cd56['query']);_0x468bca[_0x84dc('0x30')]=_[_0x84dc('0x2d')](_0x53cd56[_0x84dc('0x2b')],qs[_0x84dc('0x2e')](_0x769c41[_0x84dc('0x2f')][_0x84dc('0x2e')]));_0x468bca['attributes']=_0x468bca[_0x84dc('0x30')][_0x84dc('0x31')]?_0x468bca[_0x84dc('0x30')]:_0x53cd56[_0x84dc('0x2b')];if(_0x769c41['query']['includeAll']){_0x468bca['include']=[{'all':!![]}];}_0x468bca=_[_0x84dc('0x38')]({},_0x468bca,_0x769c41[_0x84dc('0x42')]);return db[_0x84dc('0x28')][_0x84dc('0x43')](_0x468bca)[_0x84dc('0x23')](handleEntityNotFound(_0x4ec14a,null))[_0x84dc('0x23')](respondWithResult(_0x4ec14a,null))[_0x84dc('0x3e')](handleError(_0x4ec14a,null));};exports[_0x84dc('0x44')]=function(_0xa76293,_0x1c250b){return db['SugarcrmField'][_0x84dc('0x44')](_0xa76293['body'],{})[_0x84dc('0x23')](respondWithResult(_0x1c250b,0xc9))['catch'](handleError(_0x1c250b,null));};exports[_0x84dc('0x22')]=function(_0x59ab62,_0x7ec643){if(_0x59ab62[_0x84dc('0x45')]['id']){delete _0x59ab62[_0x84dc('0x45')]['id'];}return db[_0x84dc('0x28')]['find']({'where':{'id':_0x59ab62[_0x84dc('0x40')]['id']}})[_0x84dc('0x23')](handleEntityNotFound(_0x7ec643,null))['then'](saveUpdates(_0x59ab62['body'],null))[_0x84dc('0x23')](respondWithResult(_0x7ec643,null))['catch'](handleError(_0x7ec643,null));};exports[_0x84dc('0x46')]=function(_0x1f0f0f,_0x4a732c){return db['SugarcrmField']['find']({'where':{'id':_0x1f0f0f[_0x84dc('0x40')]['id']}})[_0x84dc('0x23')](handleEntityNotFound(_0x4a732c,null))[_0x84dc('0x23')](removeEntity(_0x4a732c,null))[_0x84dc('0x3e')](handleError(_0x4a732c,null));}; \ No newline at end of file +var _0x891a=['key','model','query','keys','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','count','findAll','rows','catch','show','params','intersection','includeAll','include','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','limit','offset','set','Content-Range','apply','reject','update','then','status','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type'];(function(_0x4b48d8,_0x3a5bf2){var _0xfa124=function(_0x46c9ac){while(--_0x46c9ac){_0x4b48d8['push'](_0x4b48d8['shift']());}};_0xfa124(++_0x3a5bf2);}(_0x891a,0xb6));var _0xa891=function(_0xe38e1a,_0x1888a8){_0xe38e1a=_0xe38e1a-0x0;var _0x1dbc9=_0x891a[_0xe38e1a];return _0x1dbc9;};'use strict';var emlformat=require(_0xa891('0x0'));var rimraf=require(_0xa891('0x1'));var zipdir=require(_0xa891('0x2'));var jsonpatch=require(_0xa891('0x3'));var rp=require(_0xa891('0x4'));var moment=require(_0xa891('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa891('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa891('0x7'));var _=require(_0xa891('0x8'));var squel=require(_0xa891('0x9'));var crypto=require(_0xa891('0xa'));var jsforce=require(_0xa891('0xb'));var deskjs=require(_0xa891('0xc'));var toCsv=require(_0xa891('0xd'));var querystring=require(_0xa891('0xe'));var Papa=require(_0xa891('0xf'));var Redis=require(_0xa891('0x10'));var authService=require(_0xa891('0x11'));var qs=require(_0xa891('0x12'));var as=require(_0xa891('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa891('0x14'));var utils=require(_0xa891('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa891('0x16'))['db'];function respondWithStatusCode(_0x959008,_0x4d69e2){_0x4d69e2=_0x4d69e2||0xcc;return function(_0x441614){if(_0x441614){return _0x959008[_0xa891('0x17')](_0x4d69e2);}return _0x959008['status'](_0x4d69e2)[_0xa891('0x18')]();};}function respondWithResult(_0x3b83eb,_0x2b776f){_0x2b776f=_0x2b776f||0xc8;return function(_0x2a1867){if(_0x2a1867){return _0x3b83eb['status'](_0x2b776f)[_0xa891('0x19')](_0x2a1867);}};}function respondWithFilteredResult(_0x40f681,_0x3e9175){return function(_0x42a47c){if(_0x42a47c){var _0x1eb68f=typeof _0x3e9175['offset']===_0xa891('0x1a')&&typeof _0x3e9175[_0xa891('0x1b')]===_0xa891('0x1a');var _0x470eaa=_0x42a47c['count'];var _0x215c26=_0x1eb68f?0x0:_0x3e9175[_0xa891('0x1c')];var _0x5a2c58=_0x1eb68f?_0x42a47c['count']:_0x3e9175['offset']+_0x3e9175['limit'];var _0x417929;if(_0x5a2c58>=_0x470eaa){_0x5a2c58=_0x470eaa;_0x417929=0xc8;}else{_0x417929=0xce;}_0x40f681['status'](_0x417929);return _0x40f681[_0xa891('0x1d')](_0xa891('0x1e'),_0x215c26+'-'+_0x5a2c58+'/'+_0x470eaa)[_0xa891('0x19')](_0x42a47c);}return null;};}function patchUpdates(_0x1bc56c){return function(_0x4f18f5){try{jsonpatch[_0xa891('0x1f')](_0x4f18f5,_0x1bc56c,!![]);}catch(_0x3f4f5b){return BPromise[_0xa891('0x20')](_0x3f4f5b);}return _0x4f18f5['save']();};}function saveUpdates(_0x128fbe,_0x463338){return function(_0x174f31){if(_0x174f31){return _0x174f31[_0xa891('0x21')](_0x128fbe)[_0xa891('0x22')](function(_0x1c90a1){return _0x1c90a1;});}return null;};}function removeEntity(_0x416013,_0x2beb77){return function(_0x4dbcd9){if(_0x4dbcd9){return _0x4dbcd9['destroy']()[_0xa891('0x22')](function(){_0x416013[_0xa891('0x23')](0xcc)[_0xa891('0x18')]();});}};}function handleEntityNotFound(_0x57a907,_0x1c862b){return function(_0x4b0e4e){if(!_0x4b0e4e){_0x57a907['sendStatus'](0x194);}return _0x4b0e4e;};}function handleError(_0x1039ca,_0x8172a0){_0x8172a0=_0x8172a0||0x1f4;return function(_0x106083){logger[_0xa891('0x24')](_0x106083[_0xa891('0x25')]);if(_0x106083[_0xa891('0x26')]){delete _0x106083['name'];}_0x1039ca['status'](_0x8172a0)[_0xa891('0x27')](_0x106083);};}exports[_0xa891('0x28')]=function(_0x2d1660,_0x58658a){var _0x22bc72={},_0x3edcd0={},_0x548d65={'count':0x0,'rows':[]};var _0x55b67d=_[_0xa891('0x29')](db[_0xa891('0x2a')][_0xa891('0x2b')],function(_0x10be6d){return{'name':_0x10be6d[_0xa891('0x2c')],'type':_0x10be6d[_0xa891('0x2d')][_0xa891('0x2e')]};});_0x3edcd0[_0xa891('0x2f')]=_[_0xa891('0x29')](_0x55b67d,_0xa891('0x26'));_0x3edcd0[_0xa891('0x30')]=_[_0xa891('0x31')](_0x2d1660['query']);_0x3edcd0['filters']=_['intersection'](_0x3edcd0[_0xa891('0x2f')],_0x3edcd0[_0xa891('0x30')]);_0x22bc72[_0xa891('0x32')]=_['intersection'](_0x3edcd0[_0xa891('0x2f')],qs[_0xa891('0x33')](_0x2d1660[_0xa891('0x30')][_0xa891('0x33')]));_0x22bc72['attributes']=_0x22bc72[_0xa891('0x32')][_0xa891('0x34')]?_0x22bc72['attributes']:_0x3edcd0[_0xa891('0x2f')];if(!_0x2d1660[_0xa891('0x30')]['hasOwnProperty'](_0xa891('0x35'))){_0x22bc72[_0xa891('0x1b')]=qs[_0xa891('0x1b')](_0x2d1660[_0xa891('0x30')][_0xa891('0x1b')]);_0x22bc72[_0xa891('0x1c')]=qs[_0xa891('0x1c')](_0x2d1660[_0xa891('0x30')][_0xa891('0x1c')]);}_0x22bc72[_0xa891('0x36')]=qs[_0xa891('0x37')](_0x2d1660[_0xa891('0x30')][_0xa891('0x37')]);_0x22bc72['where']=qs[_0xa891('0x38')](_[_0xa891('0x39')](_0x2d1660[_0xa891('0x30')],_0x3edcd0['filters']),_0x55b67d);if(_0x2d1660[_0xa891('0x30')][_0xa891('0x3a')]){_0x22bc72['where']=_[_0xa891('0x3b')](_0x22bc72[_0xa891('0x3c')],{'$or':_[_0xa891('0x29')](_0x55b67d,function(_0x450f8a){if(_0x450f8a['type']!==_0xa891('0x3d')){var _0x41d1eb={};_0x41d1eb[_0x450f8a['name']]={'$like':'%'+_0x2d1660[_0xa891('0x30')][_0xa891('0x3a')]+'%'};return _0x41d1eb;}})});}_0x22bc72=_['merge']({},_0x22bc72,_0x2d1660['options']);var _0x5ca4c1={'where':_0x22bc72[_0xa891('0x3c')]};return db[_0xa891('0x2a')][_0xa891('0x3e')](_0x5ca4c1)[_0xa891('0x22')](function(_0x37008e){_0x548d65[_0xa891('0x3e')]=_0x37008e;if(_0x2d1660[_0xa891('0x30')]['includeAll']){_0x22bc72['include']=[{'all':!![]}];}return db[_0xa891('0x2a')][_0xa891('0x3f')](_0x22bc72);})['then'](function(_0x3e189b){_0x548d65[_0xa891('0x40')]=_0x3e189b;return _0x548d65;})[_0xa891('0x22')](respondWithFilteredResult(_0x58658a,_0x22bc72))[_0xa891('0x41')](handleError(_0x58658a,null));};exports[_0xa891('0x42')]=function(_0x145873,_0x729ca5){var _0x165209={'raw':!![],'where':{'id':_0x145873[_0xa891('0x43')]['id']}},_0x3b47e0={};_0x3b47e0[_0xa891('0x2f')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x3b47e0[_0xa891('0x30')]=_[_0xa891('0x31')](_0x145873['query']);_0x3b47e0[_0xa891('0x38')]=_['intersection'](_0x3b47e0[_0xa891('0x2f')],_0x3b47e0[_0xa891('0x30')]);_0x165209[_0xa891('0x32')]=_[_0xa891('0x44')](_0x3b47e0['model'],qs[_0xa891('0x33')](_0x145873[_0xa891('0x30')][_0xa891('0x33')]));_0x165209[_0xa891('0x32')]=_0x165209[_0xa891('0x32')]['length']?_0x165209[_0xa891('0x32')]:_0x3b47e0[_0xa891('0x2f')];if(_0x145873[_0xa891('0x30')][_0xa891('0x45')]){_0x165209[_0xa891('0x46')]=[{'all':!![]}];}_0x165209=_[_0xa891('0x3b')]({},_0x165209,_0x145873[_0xa891('0x47')]);return db[_0xa891('0x2a')]['find'](_0x165209)['then'](handleEntityNotFound(_0x729ca5,null))[_0xa891('0x22')](respondWithResult(_0x729ca5,null))[_0xa891('0x41')](handleError(_0x729ca5,null));};exports[_0xa891('0x48')]=function(_0x36fa91,_0x22d677){return db[_0xa891('0x2a')][_0xa891('0x48')](_0x36fa91[_0xa891('0x49')],{})[_0xa891('0x22')](respondWithResult(_0x22d677,0xc9))[_0xa891('0x41')](handleError(_0x22d677,null));};exports[_0xa891('0x21')]=function(_0x103806,_0xaf021d){if(_0x103806[_0xa891('0x49')]['id']){delete _0x103806['body']['id'];}return db[_0xa891('0x2a')][_0xa891('0x4a')]({'where':{'id':_0x103806[_0xa891('0x43')]['id']}})['then'](handleEntityNotFound(_0xaf021d,null))[_0xa891('0x22')](saveUpdates(_0x103806[_0xa891('0x49')],null))[_0xa891('0x22')](respondWithResult(_0xaf021d,null))[_0xa891('0x41')](handleError(_0xaf021d,null));};exports[_0xa891('0x4b')]=function(_0x30804c,_0xdf1a3){return db[_0xa891('0x2a')]['find']({'where':{'id':_0x30804c[_0xa891('0x43')]['id']}})['then'](handleEntityNotFound(_0xdf1a3,null))[_0xa891('0x22')](removeEntity(_0xdf1a3,null))[_0xa891('0x41')](handleError(_0xdf1a3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 72c673e..24cf4d1 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 _0x466c=['request-promise','path','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x466c,0x1bd));var _0xc466=function(_0x1ccb1a,_0x3e787e){_0x1ccb1a=_0x1ccb1a-0x0;var _0x8956da=_0x466c[_0x1ccb1a];return _0x8956da;};'use strict';var _=require(_0xc466('0x0'));var util=require(_0xc466('0x1'));var logger=require(_0xc466('0x2'))('api');var moment=require(_0xc466('0x3'));var BPromise=require(_0xc466('0x4'));var rp=require(_0xc466('0x5'));var fs=require('fs');var path=require(_0xc466('0x6'));var rimraf=require('rimraf');var config=require(_0xc466('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0xc466('0x8')]=function(_0xfdc78b,_0x2ad494){return _0xfdc78b[_0xc466('0x9')](_0xc466('0xa'),attributes,{'tableName':_0xc466('0xb'),'paranoid':![],'indexes':[{'name':_0xc466('0xc'),'fields':[_0xc466('0xd'),_0xc466('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb9f=['./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0xcb9f,0x69));var _0xfcb9=function(_0x242fca,_0x20a7f9){_0x242fca=_0x242fca-0x0;var _0x556943=_0xcb9f[_0x242fca];return _0x556943;};'use strict';var _=require('lodash');var util=require(_0xfcb9('0x0'));var logger=require('../../config/logger')(_0xfcb9('0x1'));var moment=require(_0xfcb9('0x2'));var BPromise=require(_0xfcb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcb9('0x4'));var rimraf=require(_0xfcb9('0x5'));var config=require(_0xfcb9('0x6'));var attributes=require(_0xfcb9('0x7'));module[_0xfcb9('0x8')]=function(_0x2c60bb,_0x2d33f3){return _0x2c60bb[_0xfcb9('0x9')](_0xfcb9('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xfcb9('0xb'),'fields':[_0xfcb9('0xc'),_0xfcb9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 05459fb..e340920 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 _0xb3fd=['SugarcrmField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3bb4f4,_0x3bedbd){var _0x198b10=function(_0x3fcad4){while(--_0x3fcad4){_0x3bb4f4['push'](_0x3bb4f4['shift']());}};_0x198b10(++_0x3bedbd);}(_0xb3fd,0x116));var _0xdb3f=function(_0x4d7589,_0x38ce8c){_0x4d7589=_0x4d7589-0x0;var _0x324f93=_0xb3fd[_0x4d7589];return _0x324f93;};'use strict';var _=require(_0xdb3f('0x0'));var util=require(_0xdb3f('0x1'));var moment=require(_0xdb3f('0x2'));var BPromise=require(_0xdb3f('0x3'));var rs=require(_0xdb3f('0x4'));var fs=require('fs');var Redis=require(_0xdb3f('0x5'));var db=require(_0xdb3f('0x6'))['db'];var utils=require(_0xdb3f('0x7'));var logger=require(_0xdb3f('0x8'))(_0xdb3f('0x9'));var config=require(_0xdb3f('0xa'));var jayson=require(_0xdb3f('0xb'));var client=jayson[_0xdb3f('0xc')][_0xdb3f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1c6ce4,_0x19eb09,_0x5398ea){return new BPromise(function(_0x5cb329,_0x270998){return client[_0xdb3f('0xe')](_0x1c6ce4,_0x5398ea)[_0xdb3f('0xf')](function(_0x82346a){logger[_0xdb3f('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x19eb09,_0xdb3f('0x11'));logger[_0xdb3f('0x12')](_0xdb3f('0x13'),_0x19eb09,'request\x20sent',JSON['stringify'](_0x82346a));if(_0x82346a[_0xdb3f('0x14')]){if(_0x82346a[_0xdb3f('0x14')][_0xdb3f('0x15')]===0x1f4){logger[_0xdb3f('0x14')](_0xdb3f('0x16'),_0x19eb09,_0x82346a[_0xdb3f('0x14')]['message']);return _0x270998(_0x82346a[_0xdb3f('0x14')][_0xdb3f('0x17')]);}logger[_0xdb3f('0x14')](_0xdb3f('0x16'),_0x19eb09,_0x82346a[_0xdb3f('0x14')]['message']);return _0x5cb329(_0x82346a[_0xdb3f('0x14')][_0xdb3f('0x17')]);}else{logger[_0xdb3f('0x10')](_0xdb3f('0x16'),_0x19eb09,_0xdb3f('0x11'));_0x5cb329(_0x82346a[_0xdb3f('0x18')]['message']);}})['catch'](function(_0x216c71){logger[_0xdb3f('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x19eb09,_0x216c71);_0x270998(_0x216c71);});});} \ No newline at end of file +var _0xae0c=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','jayson/promise','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x339e61,_0x67ff0e){var _0x9ebc34=function(_0x37e7cc){while(--_0x37e7cc){_0x339e61['push'](_0x339e61['shift']());}};_0x9ebc34(++_0x67ff0e);}(_0xae0c,0x1a4));var _0xcae0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xae0c[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xcae0('0x0'));var util=require(_0xcae0('0x1'));var moment=require(_0xcae0('0x2'));var BPromise=require(_0xcae0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcae0('0x4'));var logger=require(_0xcae0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcae0('0x6'));var client=jayson[_0xcae0('0x7')][_0xcae0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3db152,_0x137177,_0x5811f4){return new BPromise(function(_0x8d598b,_0xf28abe){return client[_0xcae0('0x9')](_0x3db152,_0x5811f4)['then'](function(_0x5b507a){logger['info'](_0xcae0('0xa'),_0x137177,_0xcae0('0xb'));logger['debug'](_0xcae0('0xc'),_0x137177,'request\x20sent',JSON[_0xcae0('0xd')](_0x5b507a));if(_0x5b507a['error']){if(_0x5b507a['error']['code']===0x1f4){logger[_0xcae0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x137177,_0x5b507a[_0xcae0('0xe')]['message']);return _0xf28abe(_0x5b507a['error'][_0xcae0('0xf')]);}logger[_0xcae0('0xe')](_0xcae0('0xa'),_0x137177,_0x5b507a[_0xcae0('0xe')][_0xcae0('0xf')]);return _0x8d598b(_0x5b507a[_0xcae0('0xe')]['message']);}else{logger['info'](_0xcae0('0xa'),_0x137177,_0xcae0('0xb'));_0x8d598b(_0x5b507a[_0xcae0('0x10')][_0xcae0('0xf')]);}})[_0xcae0('0x11')](function(_0x44126a){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x137177,_0x44126a);_0xf28abe(_0x44126a);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 05da4fa..ae2126f 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 _0x032e=['./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd94572,_0x54c63a){var _0x33f4dd=function(_0x47ef5f){while(--_0x47ef5f){_0xd94572['push'](_0xd94572['shift']());}};_0x33f4dd(++_0x54c63a);}(_0x032e,0x124));var _0xe032=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x032e[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xa')]);router[_0xe032('0x8')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller[_0xe032('0xc')]);router[_0xe032('0x8')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller[_0xe032('0xe')]);router[_0xe032('0x8')](_0xe032('0xf'),auth['isAuthenticated'](),controller[_0xe032('0x10')]);router[_0xe032('0x11')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0x12')]);router[_0xe032('0x11')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller['addConfiguration']);router[_0xe032('0x13')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller[_0xe032('0x14')]);router['delete'](_0xe032('0xb'),auth[_0xe032('0x9')](),controller[_0xe032('0x15')]);module[_0xe032('0x16')]=router; \ No newline at end of file +var _0x07b9=['show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x07b9,0x143));var _0x907b=function(_0x13e724,_0x296739){_0x13e724=_0x13e724-0x0;var _0x334a44=_0x07b9[_0x13e724];return _0x334a44;};'use strict';var multer=require(_0x907b('0x0'));var util=require(_0x907b('0x1'));var path=require(_0x907b('0x2'));var timeout=require(_0x907b('0x3'));var express=require('express');var router=express[_0x907b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x907b('0x5'));var interaction=require(_0x907b('0x6'));var config=require(_0x907b('0x7'));var controller=require(_0x907b('0x8'));router[_0x907b('0x9')]('/',auth[_0x907b('0xa')](),controller[_0x907b('0xb')]);router['get'](_0x907b('0xc'),auth[_0x907b('0xa')](),controller[_0x907b('0xd')]);router[_0x907b('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x907b('0xe')]);router[_0x907b('0x9')](_0x907b('0xf'),auth[_0x907b('0xa')](),controller[_0x907b('0x10')]);router[_0x907b('0x11')]('/',auth[_0x907b('0xa')](),controller[_0x907b('0x12')]);router[_0x907b('0x11')](_0x907b('0x13'),auth['isAuthenticated'](),controller[_0x907b('0x14')]);router['put']('/:id',auth[_0x907b('0xa')](),controller[_0x907b('0x15')]);router[_0x907b('0x16')](_0x907b('0xc'),auth[_0x907b('0xa')](),controller[_0x907b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 82128e6..1c17085 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 _0x5b01=['HelpDesk','exports','STRING'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x5b01,0x130));var _0x15b0=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5b01[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require('sequelize');module[_0x15b0('0x0')]={'name':{'type':Sequelize[_0x15b0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15b0('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x15b0('0x1')],'allowNull':![],'defaultValue':_0x15b0('0x2')},'remoteUri':{'type':Sequelize[_0x15b0('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x15b0('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7757=['HelpDesk','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7757,0x18a));var _0x7775=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7757[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require('sequelize');module[_0x7775('0x0')]={'name':{'type':Sequelize[_0x7775('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7775('0x1')]},'username':{'type':Sequelize[_0x7775('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7775('0x2')},'remoteUri':{'type':Sequelize[_0x7775('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 54fc6b1..2cb7404 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 _0x75a6=['picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','length','includeAll','options','create','body','params','destroy','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','description','remoteUri','serverUrl','username','accessKey','moduleName','slice','substring','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','cf_'];(function(_0x29d75d,_0x5acde3){var _0x5b61ab=function(_0x44c40c){while(--_0x44c40c){_0x29d75d['push'](_0x29d75d['shift']());}};_0x5b61ab(++_0x5acde3);}(_0x75a6,0x1e6));var _0x675a=function(_0x247123,_0x4a7339){_0x247123=_0x247123-0x0;var _0x13a7b9=_0x75a6[_0x247123];return _0x13a7b9;};'use strict';var emlformat=require(_0x675a('0x0'));var rimraf=require(_0x675a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x675a('0x2'));var rp=require(_0x675a('0x3'));var moment=require(_0x675a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x675a('0x5'));var util=require(_0x675a('0x6'));var path=require('path');var sox=require(_0x675a('0x7'));var csv=require(_0x675a('0x8'));var ejs=require(_0x675a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x675a('0xa'));var squel=require('squel');var crypto=require(_0x675a('0xb'));var jsforce=require(_0x675a('0xc'));var deskjs=require(_0x675a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x675a('0xe'));var authService=require(_0x675a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x675a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x675a('0x11'))(_0x675a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x675a('0x13'));var db=require(_0x675a('0x14'))['db'];var integrations=require(_0x675a('0x15'));function respondWithStatusCode(_0x34729e,_0x3a1799){_0x3a1799=_0x3a1799||0xcc;return function(_0x5c771d){if(_0x5c771d){return _0x34729e[_0x675a('0x16')](_0x3a1799);}return _0x34729e['status'](_0x3a1799)[_0x675a('0x17')]();};}function respondWithResult(_0x127acd,_0x48c681){_0x48c681=_0x48c681||0xc8;return function(_0x4383df){if(_0x4383df){return _0x127acd[_0x675a('0x18')](_0x48c681)[_0x675a('0x19')](_0x4383df);}};}function respondWithFilteredResult(_0x4df79a,_0x14a023){return function(_0x578889){if(_0x578889){var _0x5030cf=typeof _0x14a023['offset']===_0x675a('0x1a')&&typeof _0x14a023[_0x675a('0x1b')]===_0x675a('0x1a');var _0x6c78b2=_0x578889['count'];var _0xf37b5d=_0x5030cf?0x0:_0x14a023[_0x675a('0x1c')];var _0x4dc80d=_0x5030cf?_0x578889[_0x675a('0x1d')]:_0x14a023[_0x675a('0x1c')]+_0x14a023[_0x675a('0x1b')];var _0xe1d1f2;if(_0x4dc80d>=_0x6c78b2){_0x4dc80d=_0x6c78b2;_0xe1d1f2=0xc8;}else{_0xe1d1f2=0xce;}_0x4df79a['status'](_0xe1d1f2);return _0x4df79a[_0x675a('0x1e')](_0x675a('0x1f'),_0xf37b5d+'-'+_0x4dc80d+'/'+_0x6c78b2)[_0x675a('0x19')](_0x578889);}return null;};}function patchUpdates(_0x8c3ba3){return function(_0x188a76){try{jsonpatch['apply'](_0x188a76,_0x8c3ba3,!![]);}catch(_0x1a1185){return BPromise[_0x675a('0x20')](_0x1a1185);}return _0x188a76[_0x675a('0x21')]();};}function saveUpdates(_0x38aee1,_0x43162d){return function(_0x12b5ce){if(_0x12b5ce){return _0x12b5ce[_0x675a('0x22')](_0x38aee1)[_0x675a('0x23')](function(_0xbc5321){return _0xbc5321;});}return null;};}function removeEntity(_0x2107a4,_0x5aeefb){return function(_0x4042f7){if(_0x4042f7){return _0x4042f7['destroy']()['then'](function(){_0x2107a4[_0x675a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x442ce7,_0x35195b){return function(_0x45cac3){if(!_0x45cac3){_0x442ce7[_0x675a('0x16')](0x194);}return _0x45cac3;};}function handleError(_0x37d8a1,_0x1233f3){_0x1233f3=_0x1233f3||0x1f4;return function(_0x1b392d){logger[_0x675a('0x24')](_0x1b392d[_0x675a('0x25')]);if(_0x1b392d[_0x675a('0x26')]){delete _0x1b392d[_0x675a('0x26')];}_0x37d8a1[_0x675a('0x18')](_0x1233f3)[_0x675a('0x27')](_0x1b392d);};}exports[_0x675a('0x28')]=function(_0x1fad0c,_0x3a8fc1){var _0x5cee44={},_0x1372ed={},_0x14abb9={'count':0x0,'rows':[]};var _0x3d7417=_[_0x675a('0x29')](db[_0x675a('0x2a')][_0x675a('0x2b')],function(_0x422682){return{'name':_0x422682[_0x675a('0x2c')],'type':_0x422682[_0x675a('0x2d')][_0x675a('0x2e')]};});_0x1372ed[_0x675a('0x2f')]=_[_0x675a('0x29')](_0x3d7417,_0x675a('0x26'));_0x1372ed[_0x675a('0x30')]=_[_0x675a('0x31')](_0x1fad0c[_0x675a('0x30')]);_0x1372ed[_0x675a('0x32')]=_[_0x675a('0x33')](_0x1372ed[_0x675a('0x2f')],_0x1372ed[_0x675a('0x30')]);_0x5cee44[_0x675a('0x34')]=_[_0x675a('0x33')](_0x1372ed[_0x675a('0x2f')],qs[_0x675a('0x35')](_0x1fad0c[_0x675a('0x30')]['fields']));_0x5cee44['attributes']=_0x5cee44[_0x675a('0x34')]['length']?_0x5cee44[_0x675a('0x34')]:_0x1372ed[_0x675a('0x2f')];if(!_0x1fad0c['query']['hasOwnProperty'](_0x675a('0x36'))){_0x5cee44[_0x675a('0x1b')]=qs[_0x675a('0x1b')](_0x1fad0c[_0x675a('0x30')][_0x675a('0x1b')]);_0x5cee44['offset']=qs[_0x675a('0x1c')](_0x1fad0c['query'][_0x675a('0x1c')]);}_0x5cee44[_0x675a('0x37')]=qs[_0x675a('0x38')](_0x1fad0c['query']['sort']);_0x5cee44[_0x675a('0x39')]=qs[_0x675a('0x32')](_[_0x675a('0x3a')](_0x1fad0c['query'],_0x1372ed[_0x675a('0x32')]),_0x3d7417);if(_0x1fad0c[_0x675a('0x30')][_0x675a('0x3b')]){_0x5cee44[_0x675a('0x39')]=_[_0x675a('0x3c')](_0x5cee44[_0x675a('0x39')],{'$or':_[_0x675a('0x29')](_0x3d7417,function(_0x3a24c1){if(_0x3a24c1[_0x675a('0x2d')]!==_0x675a('0x3d')){var _0x4ab5e0={};_0x4ab5e0[_0x3a24c1[_0x675a('0x26')]]={'$like':'%'+_0x1fad0c[_0x675a('0x30')][_0x675a('0x3b')]+'%'};return _0x4ab5e0;}})});}_0x5cee44=_[_0x675a('0x3c')]({},_0x5cee44,_0x1fad0c['options']);var _0x13cb6c={'where':_0x5cee44[_0x675a('0x39')]};return db[_0x675a('0x2a')][_0x675a('0x1d')](_0x13cb6c)[_0x675a('0x23')](function(_0x47f206){_0x14abb9[_0x675a('0x1d')]=_0x47f206;if(_0x1fad0c[_0x675a('0x30')]['includeAll']){_0x5cee44[_0x675a('0x3e')]=[{'all':!![]}];}return db['VtigerAccount'][_0x675a('0x3f')](_0x5cee44);})[_0x675a('0x23')](function(_0x184c05){_0x14abb9[_0x675a('0x40')]=_0x184c05;return _0x14abb9;})['then'](respondWithFilteredResult(_0x3a8fc1,_0x5cee44))[_0x675a('0x41')](handleError(_0x3a8fc1,null));};exports['show']=function(_0x218c42,_0x539a69){var _0xa7f0bd={'raw':![],'where':{'id':_0x218c42['params']['id']}},_0x2e0fd2={};_0x2e0fd2['model']=_['keys'](db['VtigerAccount'][_0x675a('0x2b')]);_0x2e0fd2[_0x675a('0x30')]=_[_0x675a('0x31')](_0x218c42[_0x675a('0x30')]);_0x2e0fd2[_0x675a('0x32')]=_['intersection'](_0x2e0fd2['model'],_0x2e0fd2[_0x675a('0x30')]);_0xa7f0bd[_0x675a('0x34')]=_[_0x675a('0x33')](_0x2e0fd2['model'],qs[_0x675a('0x35')](_0x218c42[_0x675a('0x30')]['fields']));_0xa7f0bd[_0x675a('0x34')]=_0xa7f0bd['attributes'][_0x675a('0x42')]?_0xa7f0bd[_0x675a('0x34')]:_0x2e0fd2[_0x675a('0x2f')];if(_0x218c42[_0x675a('0x30')][_0x675a('0x43')]){_0xa7f0bd[_0x675a('0x3e')]=[{'all':!![]}];}_0xa7f0bd=_[_0x675a('0x3c')]({},_0xa7f0bd,_0x218c42[_0x675a('0x44')]);return db['VtigerAccount']['find'](_0xa7f0bd)['then'](handleEntityNotFound(_0x539a69,null))['then'](respondWithResult(_0x539a69,null))[_0x675a('0x41')](handleError(_0x539a69,null));};exports[_0x675a('0x45')]=function(_0x4f5082,_0x336d3f){return db[_0x675a('0x2a')][_0x675a('0x45')](_0x4f5082[_0x675a('0x46')],{})[_0x675a('0x23')](respondWithResult(_0x336d3f,0xc9))[_0x675a('0x41')](handleError(_0x336d3f,null));};exports['update']=function(_0x46413c,_0x37faf2){if(_0x46413c[_0x675a('0x46')]['id']){delete _0x46413c[_0x675a('0x46')]['id'];}return db[_0x675a('0x2a')]['find']({'where':{'id':_0x46413c[_0x675a('0x47')]['id']}})['then'](handleEntityNotFound(_0x37faf2,null))[_0x675a('0x23')](saveUpdates(_0x46413c[_0x675a('0x46')],null))['then'](respondWithResult(_0x37faf2,null))['catch'](handleError(_0x37faf2,null));};exports[_0x675a('0x48')]=function(_0x5e3984,_0x15a68d){return db[_0x675a('0x2a')]['find']({'where':{'id':_0x5e3984[_0x675a('0x47')]['id']}})[_0x675a('0x23')](handleEntityNotFound(_0x15a68d,null))[_0x675a('0x23')](removeEntity(_0x15a68d,null))[_0x675a('0x41')](handleError(_0x15a68d,null));};exports[_0x675a('0x49')]=function(_0x5a4cfe,_0x3ad429,_0x30a3a0){var _0x3b8233={};var _0x144fb5={};var _0xac3a09;var _0x1a8fe8;return db[_0x675a('0x2a')][_0x675a('0x4a')]({'where':{'id':_0x5a4cfe[_0x675a('0x47')]['id']}})[_0x675a('0x23')](handleEntityNotFound(_0x3ad429,null))[_0x675a('0x23')](function(_0x8f49f4){if(_0x8f49f4){_0xac3a09=_0x8f49f4;_0x144fb5[_0x675a('0x2f')]=_[_0x675a('0x31')](db[_0x675a('0x4b')][_0x675a('0x2b')]);_0x144fb5[_0x675a('0x30')]=_[_0x675a('0x31')](_0x5a4cfe['query']);_0x144fb5[_0x675a('0x32')]=_[_0x675a('0x33')](_0x144fb5['model'],_0x144fb5[_0x675a('0x30')]);_0x3b8233[_0x675a('0x34')]=_[_0x675a('0x33')](_0x144fb5[_0x675a('0x2f')],qs[_0x675a('0x35')](_0x5a4cfe['query'][_0x675a('0x35')]));_0x3b8233[_0x675a('0x34')]=_0x3b8233[_0x675a('0x34')][_0x675a('0x42')]?_0x3b8233['attributes']:_0x144fb5[_0x675a('0x2f')];_0x3b8233[_0x675a('0x37')]=qs[_0x675a('0x38')](_0x5a4cfe[_0x675a('0x30')][_0x675a('0x38')]);_0x3b8233[_0x675a('0x39')]=qs[_0x675a('0x32')](_['pick'](_0x5a4cfe[_0x675a('0x30')],_0x144fb5[_0x675a('0x32')]));if(_0x5a4cfe['query'][_0x675a('0x3b')]){_0x3b8233[_0x675a('0x39')]=_[_0x675a('0x3c')](_0x3b8233[_0x675a('0x39')],{'$or':_[_0x675a('0x29')](_0x3b8233[_0x675a('0x34')],function(_0x477e3a){var _0x1c7ccf={};_0x1c7ccf[_0x477e3a]={'$like':'%'+_0x5a4cfe[_0x675a('0x30')][_0x675a('0x3b')]+'%'};return _0x1c7ccf;})});}_0x3b8233=_[_0x675a('0x3c')]({},_0x3b8233,_0x5a4cfe[_0x675a('0x44')]);return _0xac3a09[_0x675a('0x49')](_0x3b8233);}})[_0x675a('0x23')](function(_0x313c5c){if(_0x313c5c){_0x1a8fe8=_0x313c5c[_0x675a('0x42')];if(!_0x5a4cfe[_0x675a('0x30')][_0x675a('0x4c')](_0x675a('0x36'))){_0x3b8233[_0x675a('0x1b')]=qs[_0x675a('0x1b')](_0x5a4cfe['query'][_0x675a('0x1b')]);_0x3b8233[_0x675a('0x1c')]=qs[_0x675a('0x1c')](_0x5a4cfe[_0x675a('0x30')][_0x675a('0x1c')]);}return _0xac3a09['getConfigurations'](_0x3b8233);}})[_0x675a('0x23')](function(_0x6d0a0f){if(_0x6d0a0f){return _0x6d0a0f?{'count':_0x1a8fe8,'rows':_0x6d0a0f}:null;}})[_0x675a('0x23')](respondWithResult(_0x3ad429,null))[_0x675a('0x41')](handleError(_0x3ad429,null));};exports[_0x675a('0x4d')]=function(_0x4072a1,_0x3ddf5c,_0x92f9e1){if(_0x4072a1['body']['id']){delete _0x4072a1[_0x675a('0x46')]['id'];}return db['VtigerAccount'][_0x675a('0x4a')]({'where':{'id':_0x4072a1[_0x675a('0x47')]['id']}})[_0x675a('0x23')](handleEntityNotFound(_0x3ddf5c,null))[_0x675a('0x23')](function(_0x2dfa61){if(_0x2dfa61){_0x4072a1[_0x675a('0x46')][_0x675a('0x4e')]=_0x2dfa61['id'];_0x4072a1[_0x675a('0x46')][_0x675a('0x4f')]=integrations[_0x675a('0x50')](_0x4072a1[_0x675a('0x46')][_0x675a('0x51')],_0x4072a1['body']['type']);_0x4072a1[_0x675a('0x46')][_0x675a('0x52')]=integrations['getDescriptions'](_0x4072a1[_0x675a('0x46')][_0x675a('0x51')],_0x4072a1['body'][_0x675a('0x2d')]);return db[_0x675a('0x4b')]['create'](_0x4072a1['body'],{'include':[{'model':db[_0x675a('0x53')],'as':_0x675a('0x4f')},{'model':db[_0x675a('0x53')],'as':_0x675a('0x52')}]});}return null;})[_0x675a('0x23')](respondWithResult(_0x3ddf5c,null))['catch'](handleError(_0x3ddf5c,null));};var md5=require(_0x675a('0x54'));exports[_0x675a('0x55')]=function(_0x2af489,_0x4bcb04,_0x51c68){var _0x20a365=null;var _0x4f88ba=null;var _0x5f11fb=null;var _0x1e5b17=null;var _0x31e83d='';return db[_0x675a('0x2a')][_0x675a('0x4a')]({'where':{'id':_0x2af489['params']['id']},'attributes':['id',_0x675a('0x26'),'username',_0x675a('0x56'),'moduleName',_0x675a('0x57'),_0x675a('0x58'),'accessKey']})[_0x675a('0x23')](handleEntityNotFound(_0x4bcb04,null))[_0x675a('0x23')](function(_0x485c43){if(_0x485c43){_0x20a365=_0x485c43[_0x675a('0x59')];_0x4f88ba=_0x485c43[_0x675a('0x5a')];_0x5f11fb=_0x485c43[_0x675a('0x5b')];_0x31e83d=_0x485c43[_0x675a('0x57')];var _0x69171d=_0x31e83d[_0x675a('0x5c')](-0x1);if(_0x69171d==='/'){_0x31e83d=_0x31e83d[_0x675a('0x5d')](0x0,_0x31e83d['lastIndexOf'](_0x69171d));}_0x1e5b17=util[_0x675a('0x5e')](_0x675a('0x5f'),_0x31e83d);var _0x3299a6={'method':_0x675a('0x60'),'uri':_0x1e5b17,'qs':{'operation':_0x675a('0x61'),'username':_0x485c43['username']},'json':!![]};return rp(_0x3299a6);}})[_0x675a('0x23')](function(_0x4b544a){if(_0x4b544a[_0x675a('0x62')]){var _0x548475={'method':_0x675a('0x63'),'uri':_0x1e5b17,'form':{'operation':_0x675a('0x64'),'username':_0x20a365,'accessKey':md5(_0x4b544a[_0x675a('0x65')][_0x675a('0x66')]+_0x4f88ba)},'json':!![]};return rp(_0x548475);}})[_0x675a('0x23')](function(_0x18c251){if(_0x18c251['success']){var _0x2957e2={'method':_0x675a('0x60'),'uri':_0x1e5b17,'qs':{'operation':_0x675a('0x67'),'username':_0x20a365,'sessionName':_0x18c251[_0x675a('0x65')][_0x675a('0x68')],'elementType':_0x5f11fb},'json':!![]};return rp(_0x2957e2);}})[_0x675a('0x23')](function(_0x3c846e){if(_0x3c846e[_0x675a('0x62')]){var _0x457853=[_0x675a('0x69'),_0x675a('0x6a'),_0x675a('0x6b')];_[_0x675a('0x6c')](_0x3c846e[_0x675a('0x65')][_0x675a('0x35')],function(_0x555883){return _0x457853[_0x675a('0x6d')](_0x555883[_0x675a('0x2d')]['name']);});_[_0x675a('0x6c')](_0x3c846e[_0x675a('0x65')][_0x675a('0x35')],function(_0x37967b){return _0x37967b[_0x675a('0x6e')]===_0x675a('0x6f');});return{'count':_0x3c846e[_0x675a('0x65')][_0x675a('0x35')][_0x675a('0x42')],'rows':_[_0x675a('0x29')](_0x3c846e[_0x675a('0x65')][_0x675a('0x35')],function(_0x1c25dc){return{'id':_0x1c25dc['name'],'name':_0x1c25dc[_0x675a('0x70')],'custom':_['startsWith'](_0x1c25dc[_0x675a('0x26')],_0x675a('0x71'))?!![]:![],'options':_0x1c25dc[_0x675a('0x2d')]['name']==='picklist'&&_0x1c25dc['type'][_0x675a('0x72')]['length']>0x0?_[_0x675a('0x29')](_0x1c25dc[_0x675a('0x2d')][_0x675a('0x72')],function(_0x1c8b06){return{'name':_0x1c8b06[_0x675a('0x70')],'value':_0x1c8b06[_0x675a('0x73')]};}):[]};})};}})['then'](respondWithResult(_0x4bcb04,null))[_0x675a('0x41')](function(_0x5deaf7){console['log'](_0x675a('0x74')+_0x5deaf7);var _0x23679a=_0x2af489['query'][_0x675a('0x75')]?0x1f4:_0x5deaf7[_0x675a('0x76')]||0x1f4;logger[_0x675a('0x24')](_0x675a('0x77'),_0x675a('0x55'),_0x23679a,JSON['stringify'](_0x5deaf7));delete _0x5deaf7['name'];if(_0x23679a===0x191){_0x23679a=0x190;}_0x4bcb04['status'](_0x23679a)[_0x675a('0x27')](_0x2af489[_0x675a('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5deaf7['statusCode']}:_0x5deaf7);});}; \ No newline at end of file +var _0xfd51=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','fields','options','create','body','find','params','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getDescriptions','channel','VtigerConfiguration','VtigerField','Descriptions','md5','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','token','describe','result','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0xfd51,0x1d5));var _0x1fd5=function(_0x1ade24,_0x1bb417){_0x1ade24=_0x1ade24-0x0;var _0x31d807=_0xfd51[_0x1ade24];return _0x31d807;};'use strict';var emlformat=require(_0x1fd5('0x0'));var rimraf=require(_0x1fd5('0x1'));var zipdir=require(_0x1fd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fd5('0x3'));var moment=require(_0x1fd5('0x4'));var BPromise=require(_0x1fd5('0x5'));var Mustache=require(_0x1fd5('0x6'));var util=require(_0x1fd5('0x7'));var path=require('path');var sox=require(_0x1fd5('0x8'));var csv=require(_0x1fd5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fd5('0xa'));var _=require(_0x1fd5('0xb'));var squel=require(_0x1fd5('0xc'));var crypto=require(_0x1fd5('0xd'));var jsforce=require(_0x1fd5('0xe'));var deskjs=require(_0x1fd5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1fd5('0x10'));var Papa=require(_0x1fd5('0x11'));var Redis=require(_0x1fd5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1fd5('0x13'));var as=require(_0x1fd5('0x14'));var hardwareService=require(_0x1fd5('0x15'));var logger=require(_0x1fd5('0x16'))('api');var utils=require(_0x1fd5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1fd5('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x47b131,_0x260fed){_0x260fed=_0x260fed||0xcc;return function(_0x32ee6d){if(_0x32ee6d){return _0x47b131[_0x1fd5('0x19')](_0x260fed);}return _0x47b131[_0x1fd5('0x1a')](_0x260fed)[_0x1fd5('0x1b')]();};}function respondWithResult(_0x316290,_0x267db3){_0x267db3=_0x267db3||0xc8;return function(_0x487183){if(_0x487183){return _0x316290[_0x1fd5('0x1a')](_0x267db3)[_0x1fd5('0x1c')](_0x487183);}};}function respondWithFilteredResult(_0x331e85,_0x5b8443){return function(_0x5e1cb2){if(_0x5e1cb2){var _0x4978a1=typeof _0x5b8443[_0x1fd5('0x1d')]===_0x1fd5('0x1e')&&typeof _0x5b8443['limit']===_0x1fd5('0x1e');var _0x405854=_0x5e1cb2[_0x1fd5('0x1f')];var _0x36349d=_0x4978a1?0x0:_0x5b8443[_0x1fd5('0x1d')];var _0x4dad16=_0x4978a1?_0x5e1cb2[_0x1fd5('0x1f')]:_0x5b8443[_0x1fd5('0x1d')]+_0x5b8443[_0x1fd5('0x20')];var _0x13f27c;if(_0x4dad16>=_0x405854){_0x4dad16=_0x405854;_0x13f27c=0xc8;}else{_0x13f27c=0xce;}_0x331e85[_0x1fd5('0x1a')](_0x13f27c);return _0x331e85[_0x1fd5('0x21')]('Content-Range',_0x36349d+'-'+_0x4dad16+'/'+_0x405854)['json'](_0x5e1cb2);}return null;};}function patchUpdates(_0x14a4f9){return function(_0x334ab5){try{jsonpatch[_0x1fd5('0x22')](_0x334ab5,_0x14a4f9,!![]);}catch(_0x3a24be){return BPromise['reject'](_0x3a24be);}return _0x334ab5[_0x1fd5('0x23')]();};}function saveUpdates(_0x4a874e,_0x5b3936){return function(_0xb004f){if(_0xb004f){return _0xb004f[_0x1fd5('0x24')](_0x4a874e)[_0x1fd5('0x25')](function(_0x3104e2){return _0x3104e2;});}return null;};}function removeEntity(_0x2cac34,_0x4bcd6b){return function(_0x17526c){if(_0x17526c){return _0x17526c[_0x1fd5('0x26')]()[_0x1fd5('0x25')](function(){_0x2cac34[_0x1fd5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35611c,_0x3d7ded){return function(_0x3cfa82){if(!_0x3cfa82){_0x35611c['sendStatus'](0x194);}return _0x3cfa82;};}function handleError(_0x18a9d9,_0x397c26){_0x397c26=_0x397c26||0x1f4;return function(_0x5c676f){logger[_0x1fd5('0x27')](_0x5c676f[_0x1fd5('0x28')]);if(_0x5c676f[_0x1fd5('0x29')]){delete _0x5c676f[_0x1fd5('0x29')];}_0x18a9d9[_0x1fd5('0x1a')](_0x397c26)[_0x1fd5('0x2a')](_0x5c676f);};}exports[_0x1fd5('0x2b')]=function(_0x53e5be,_0x5e69e2){var _0x39baee={},_0x552397={},_0x3ab6d9={'count':0x0,'rows':[]};var _0x2f8b4f=_[_0x1fd5('0x2c')](db[_0x1fd5('0x2d')][_0x1fd5('0x2e')],function(_0x23bb25){return{'name':_0x23bb25['fieldName'],'type':_0x23bb25[_0x1fd5('0x2f')][_0x1fd5('0x30')]};});_0x552397[_0x1fd5('0x31')]=_['map'](_0x2f8b4f,_0x1fd5('0x29'));_0x552397['query']=_[_0x1fd5('0x32')](_0x53e5be[_0x1fd5('0x33')]);_0x552397[_0x1fd5('0x34')]=_[_0x1fd5('0x35')](_0x552397[_0x1fd5('0x31')],_0x552397[_0x1fd5('0x33')]);_0x39baee[_0x1fd5('0x36')]=_[_0x1fd5('0x35')](_0x552397['model'],qs['fields'](_0x53e5be[_0x1fd5('0x33')]['fields']));_0x39baee['attributes']=_0x39baee[_0x1fd5('0x36')][_0x1fd5('0x37')]?_0x39baee['attributes']:_0x552397['model'];if(!_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x38')]('nolimit')){_0x39baee[_0x1fd5('0x20')]=qs['limit'](_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x20')]);_0x39baee[_0x1fd5('0x1d')]=qs[_0x1fd5('0x1d')](_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x1d')]);}_0x39baee['order']=qs[_0x1fd5('0x39')](_0x53e5be[_0x1fd5('0x33')]['sort']);_0x39baee['where']=qs['filters'](_[_0x1fd5('0x3a')](_0x53e5be[_0x1fd5('0x33')],_0x552397[_0x1fd5('0x34')]),_0x2f8b4f);if(_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x3b')]){_0x39baee[_0x1fd5('0x3c')]=_['merge'](_0x39baee[_0x1fd5('0x3c')],{'$or':_[_0x1fd5('0x2c')](_0x2f8b4f,function(_0x57fd62){if(_0x57fd62[_0x1fd5('0x2f')]!==_0x1fd5('0x3d')){var _0x2b3d1e={};_0x2b3d1e[_0x57fd62[_0x1fd5('0x29')]]={'$like':'%'+_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x3b')]+'%'};return _0x2b3d1e;}})});}_0x39baee=_[_0x1fd5('0x3e')]({},_0x39baee,_0x53e5be['options']);var _0x5eb196={'where':_0x39baee[_0x1fd5('0x3c')]};return db[_0x1fd5('0x2d')]['count'](_0x5eb196)[_0x1fd5('0x25')](function(_0xa0c177){_0x3ab6d9[_0x1fd5('0x1f')]=_0xa0c177;if(_0x53e5be[_0x1fd5('0x33')][_0x1fd5('0x3f')]){_0x39baee[_0x1fd5('0x40')]=[{'all':!![]}];}return db['VtigerAccount'][_0x1fd5('0x41')](_0x39baee);})[_0x1fd5('0x25')](function(_0x3d61fb){_0x3ab6d9[_0x1fd5('0x42')]=_0x3d61fb;return _0x3ab6d9;})[_0x1fd5('0x25')](respondWithFilteredResult(_0x5e69e2,_0x39baee))[_0x1fd5('0x43')](handleError(_0x5e69e2,null));};exports[_0x1fd5('0x44')]=function(_0x3e6895,_0x148492){var _0x6ee35={'raw':![],'where':{'id':_0x3e6895['params']['id']}},_0x5cdefe={};_0x5cdefe[_0x1fd5('0x31')]=_[_0x1fd5('0x32')](db['VtigerAccount'][_0x1fd5('0x2e')]);_0x5cdefe[_0x1fd5('0x33')]=_['keys'](_0x3e6895[_0x1fd5('0x33')]);_0x5cdefe['filters']=_[_0x1fd5('0x35')](_0x5cdefe[_0x1fd5('0x31')],_0x5cdefe['query']);_0x6ee35[_0x1fd5('0x36')]=_['intersection'](_0x5cdefe['model'],qs[_0x1fd5('0x45')](_0x3e6895[_0x1fd5('0x33')][_0x1fd5('0x45')]));_0x6ee35['attributes']=_0x6ee35[_0x1fd5('0x36')][_0x1fd5('0x37')]?_0x6ee35['attributes']:_0x5cdefe[_0x1fd5('0x31')];if(_0x3e6895[_0x1fd5('0x33')][_0x1fd5('0x3f')]){_0x6ee35['include']=[{'all':!![]}];}_0x6ee35=_['merge']({},_0x6ee35,_0x3e6895[_0x1fd5('0x46')]);return db[_0x1fd5('0x2d')]['find'](_0x6ee35)['then'](handleEntityNotFound(_0x148492,null))['then'](respondWithResult(_0x148492,null))[_0x1fd5('0x43')](handleError(_0x148492,null));};exports[_0x1fd5('0x47')]=function(_0xa1ec8e,_0x37c98f){return db[_0x1fd5('0x2d')][_0x1fd5('0x47')](_0xa1ec8e['body'],{})[_0x1fd5('0x25')](respondWithResult(_0x37c98f,0xc9))['catch'](handleError(_0x37c98f,null));};exports[_0x1fd5('0x24')]=function(_0x3ca1ec,_0x12087a){if(_0x3ca1ec[_0x1fd5('0x48')]['id']){delete _0x3ca1ec[_0x1fd5('0x48')]['id'];}return db[_0x1fd5('0x2d')][_0x1fd5('0x49')]({'where':{'id':_0x3ca1ec[_0x1fd5('0x4a')]['id']}})[_0x1fd5('0x25')](handleEntityNotFound(_0x12087a,null))[_0x1fd5('0x25')](saveUpdates(_0x3ca1ec[_0x1fd5('0x48')],null))['then'](respondWithResult(_0x12087a,null))[_0x1fd5('0x43')](handleError(_0x12087a,null));};exports[_0x1fd5('0x26')]=function(_0x322b0,_0x12ebdf){return db['VtigerAccount'][_0x1fd5('0x49')]({'where':{'id':_0x322b0[_0x1fd5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ebdf,null))[_0x1fd5('0x25')](removeEntity(_0x12ebdf,null))[_0x1fd5('0x43')](handleError(_0x12ebdf,null));};exports[_0x1fd5('0x4b')]=function(_0x685134,_0xc936b8,_0x478e24){var _0x1631a5={};var _0x50a8e9={};var _0x5f2a30;var _0x238d15;return db[_0x1fd5('0x2d')]['findOne']({'where':{'id':_0x685134['params']['id']}})[_0x1fd5('0x25')](handleEntityNotFound(_0xc936b8,null))[_0x1fd5('0x25')](function(_0x2782a0){if(_0x2782a0){_0x5f2a30=_0x2782a0;_0x50a8e9[_0x1fd5('0x31')]=_[_0x1fd5('0x32')](db['VtigerConfiguration']['rawAttributes']);_0x50a8e9[_0x1fd5('0x33')]=_[_0x1fd5('0x32')](_0x685134['query']);_0x50a8e9['filters']=_[_0x1fd5('0x35')](_0x50a8e9[_0x1fd5('0x31')],_0x50a8e9[_0x1fd5('0x33')]);_0x1631a5['attributes']=_[_0x1fd5('0x35')](_0x50a8e9[_0x1fd5('0x31')],qs[_0x1fd5('0x45')](_0x685134[_0x1fd5('0x33')][_0x1fd5('0x45')]));_0x1631a5[_0x1fd5('0x36')]=_0x1631a5[_0x1fd5('0x36')][_0x1fd5('0x37')]?_0x1631a5['attributes']:_0x50a8e9[_0x1fd5('0x31')];_0x1631a5['order']=qs[_0x1fd5('0x39')](_0x685134[_0x1fd5('0x33')]['sort']);_0x1631a5['where']=qs[_0x1fd5('0x34')](_[_0x1fd5('0x3a')](_0x685134[_0x1fd5('0x33')],_0x50a8e9[_0x1fd5('0x34')]));if(_0x685134[_0x1fd5('0x33')][_0x1fd5('0x3b')]){_0x1631a5['where']=_['merge'](_0x1631a5[_0x1fd5('0x3c')],{'$or':_[_0x1fd5('0x2c')](_0x1631a5[_0x1fd5('0x36')],function(_0x2460b9){var _0x149271={};_0x149271[_0x2460b9]={'$like':'%'+_0x685134['query'][_0x1fd5('0x3b')]+'%'};return _0x149271;})});}_0x1631a5=_[_0x1fd5('0x3e')]({},_0x1631a5,_0x685134[_0x1fd5('0x46')]);return _0x5f2a30['getConfigurations'](_0x1631a5);}})[_0x1fd5('0x25')](function(_0x4160d4){if(_0x4160d4){_0x238d15=_0x4160d4['length'];if(!_0x685134[_0x1fd5('0x33')][_0x1fd5('0x38')](_0x1fd5('0x4c'))){_0x1631a5[_0x1fd5('0x20')]=qs[_0x1fd5('0x20')](_0x685134[_0x1fd5('0x33')][_0x1fd5('0x20')]);_0x1631a5[_0x1fd5('0x1d')]=qs[_0x1fd5('0x1d')](_0x685134[_0x1fd5('0x33')][_0x1fd5('0x1d')]);}return _0x5f2a30[_0x1fd5('0x4b')](_0x1631a5);}})[_0x1fd5('0x25')](function(_0x289114){if(_0x289114){return _0x289114?{'count':_0x238d15,'rows':_0x289114}:null;}})['then'](respondWithResult(_0xc936b8,null))[_0x1fd5('0x43')](handleError(_0xc936b8,null));};exports[_0x1fd5('0x4d')]=function(_0x266a80,_0x351a5c,_0x35858c){if(_0x266a80[_0x1fd5('0x48')]['id']){delete _0x266a80[_0x1fd5('0x48')]['id'];}return db['VtigerAccount'][_0x1fd5('0x4e')]({'where':{'id':_0x266a80[_0x1fd5('0x4a')]['id']}})[_0x1fd5('0x25')](handleEntityNotFound(_0x351a5c,null))[_0x1fd5('0x25')](function(_0x377ad4){if(_0x377ad4){_0x266a80['body'][_0x1fd5('0x4f')]=_0x377ad4['id'];_0x266a80[_0x1fd5('0x48')][_0x1fd5('0x50')]=integrations['getSubjects'](_0x266a80[_0x1fd5('0x48')]['channel'],_0x266a80[_0x1fd5('0x48')][_0x1fd5('0x2f')]);_0x266a80[_0x1fd5('0x48')]['Descriptions']=integrations[_0x1fd5('0x51')](_0x266a80[_0x1fd5('0x48')][_0x1fd5('0x52')],_0x266a80[_0x1fd5('0x48')][_0x1fd5('0x2f')]);return db[_0x1fd5('0x53')][_0x1fd5('0x47')](_0x266a80[_0x1fd5('0x48')],{'include':[{'model':db['VtigerField'],'as':_0x1fd5('0x50')},{'model':db[_0x1fd5('0x54')],'as':_0x1fd5('0x55')}]});}return null;})[_0x1fd5('0x25')](respondWithResult(_0x351a5c,null))[_0x1fd5('0x43')](handleError(_0x351a5c,null));};var md5=require(_0x1fd5('0x56'));exports['getFields']=function(_0x38ae75,_0x1fb235,_0x47cbc8){var _0x411cfd=null;var _0x965f02=null;var _0x322bcd=null;var _0x29e016=null;var _0x2f1979='';return db[_0x1fd5('0x2d')][_0x1fd5('0x4e')]({'where':{'id':_0x38ae75['params']['id']},'attributes':['id',_0x1fd5('0x29'),_0x1fd5('0x57'),'description',_0x1fd5('0x58'),_0x1fd5('0x59'),_0x1fd5('0x5a'),_0x1fd5('0x5b')]})[_0x1fd5('0x25')](handleEntityNotFound(_0x1fb235,null))[_0x1fd5('0x25')](function(_0x430fb5){if(_0x430fb5){_0x411cfd=_0x430fb5[_0x1fd5('0x57')];_0x965f02=_0x430fb5[_0x1fd5('0x5b')];_0x322bcd=_0x430fb5[_0x1fd5('0x58')];_0x2f1979=_0x430fb5[_0x1fd5('0x59')];var _0x1ba14d=_0x2f1979[_0x1fd5('0x5c')](-0x1);if(_0x1ba14d==='/'){_0x2f1979=_0x2f1979[_0x1fd5('0x5d')](0x0,_0x2f1979[_0x1fd5('0x5e')](_0x1ba14d));}_0x29e016=util[_0x1fd5('0x5f')](_0x1fd5('0x60'),_0x2f1979);var _0x481349={'method':'GET','uri':_0x29e016,'qs':{'operation':_0x1fd5('0x61'),'username':_0x430fb5['username']},'json':!![]};return rp(_0x481349);}})[_0x1fd5('0x25')](function(_0x42f310){if(_0x42f310[_0x1fd5('0x62')]){var _0x46b1b1={'method':_0x1fd5('0x63'),'uri':_0x29e016,'form':{'operation':'login','username':_0x411cfd,'accessKey':md5(_0x42f310['result'][_0x1fd5('0x64')]+_0x965f02)},'json':!![]};return rp(_0x46b1b1);}})[_0x1fd5('0x25')](function(_0x5e8a2c){if(_0x5e8a2c['success']){var _0x52e879={'method':'GET','uri':_0x29e016,'qs':{'operation':_0x1fd5('0x65'),'username':_0x411cfd,'sessionName':_0x5e8a2c[_0x1fd5('0x66')][_0x1fd5('0x67')],'elementType':_0x322bcd},'json':!![]};return rp(_0x52e879);}})['then'](function(_0x4bcea1){if(_0x4bcea1[_0x1fd5('0x62')]){var _0x670a01=[_0x1fd5('0x68'),_0x1fd5('0x69'),_0x1fd5('0x6a')];_[_0x1fd5('0x6b')](_0x4bcea1['result']['fields'],function(_0x2b32fc){return _0x670a01[_0x1fd5('0x6c')](_0x2b32fc['type']['name']);});_[_0x1fd5('0x6b')](_0x4bcea1[_0x1fd5('0x66')][_0x1fd5('0x45')],function(_0x7f3e3c){return _0x7f3e3c[_0x1fd5('0x6d')]===_0x1fd5('0x6e');});return{'count':_0x4bcea1['result'][_0x1fd5('0x45')][_0x1fd5('0x37')],'rows':_[_0x1fd5('0x2c')](_0x4bcea1['result'][_0x1fd5('0x45')],function(_0x114fe2){return{'id':_0x114fe2[_0x1fd5('0x29')],'name':_0x114fe2[_0x1fd5('0x6f')],'custom':_['startsWith'](_0x114fe2[_0x1fd5('0x29')],_0x1fd5('0x70'))?!![]:![],'options':_0x114fe2[_0x1fd5('0x2f')]['name']===_0x1fd5('0x71')&&_0x114fe2[_0x1fd5('0x2f')][_0x1fd5('0x72')][_0x1fd5('0x37')]>0x0?_['map'](_0x114fe2[_0x1fd5('0x2f')][_0x1fd5('0x72')],function(_0x40b341){return{'name':_0x40b341[_0x1fd5('0x6f')],'value':_0x40b341[_0x1fd5('0x73')]};}):[]};})};}})[_0x1fd5('0x25')](respondWithResult(_0x1fb235,null))['catch'](function(_0x1b8702){console[_0x1fd5('0x74')]('vTiger\x20error:\x20'+_0x1b8702);var _0x432942=_0x38ae75[_0x1fd5('0x33')][_0x1fd5('0x75')]?0x1f4:_0x1b8702[_0x1fd5('0x76')]||0x1f4;logger['error'](_0x1fd5('0x77'),_0x1fd5('0x78'),_0x432942,JSON[_0x1fd5('0x79')](_0x1b8702));delete _0x1b8702[_0x1fd5('0x29')];if(_0x432942===0x191){_0x432942=0x190;}_0x1fb235[_0x1fd5('0x1a')](_0x432942)[_0x1fd5('0x2a')](_0x38ae75['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x1b8702[_0x1fd5('0x76')]}:_0x1b8702);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 59e0f9a..e381415 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 _0xb778=['../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x108df0,_0x153440){var _0x33f10a=function(_0x65fa03){while(--_0x65fa03){_0x108df0['push'](_0x108df0['shift']());}};_0x33f10a(++_0x153440);}(_0xb778,0x1c8));var _0x8b77=function(_0x4ef8bc,_0x5eb00d){_0x4ef8bc=_0x4ef8bc-0x0;var _0x5d4d56=_0xb778[_0x4ef8bc];return _0x5d4d56;};'use strict';var _=require(_0x8b77('0x0'));var util=require('util');var logger=require(_0x8b77('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8b77('0x2'));var rp=require(_0x8b77('0x3'));var fs=require('fs');var path=require(_0x8b77('0x4'));var rimraf=require(_0x8b77('0x5'));var config=require(_0x8b77('0x6'));var attributes=require(_0x8b77('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x8b77('0x8')]=function(_0x43012d,_0x527afa){return _0x43012d[_0x8b77('0x9')](_0x8b77('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4db1=['util','../../config/logger','moment','bluebird','rimraf','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x2564f9,_0x27c62f){var _0x1f2581=function(_0x1a43aa){while(--_0x1a43aa){_0x2564f9['push'](_0x2564f9['shift']());}};_0x1f2581(++_0x27c62f);}(_0x4db1,0x1a1));var _0x14db=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0x4db1[_0x102881];return _0x5c63d0;};'use strict';var _=require(_0x14db('0x0'));var util=require(_0x14db('0x1'));var logger=require(_0x14db('0x2'))('api');var moment=require(_0x14db('0x3'));var BPromise=require(_0x14db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14db('0x5'));var config=require('../../config/environment');var attributes=require(_0x14db('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x14db('0x7')]=function(_0x37d818,_0x53d325){return _0x37d818[_0x14db('0x8')](_0x14db('0x9'),attributes,{'tableName':_0x14db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 086544b..2213d2b 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 _0xea28=['code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','ShowVtigerAccount','find','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x25fe11,_0xd1edf6){var _0x95a7eb=function(_0xe44691){while(--_0xe44691){_0x25fe11['push'](_0x25fe11['shift']());}};_0x95a7eb(++_0xd1edf6);}(_0xea28,0x13a));var _0x8ea2=function(_0x307911,_0x322018){_0x307911=_0x307911-0x0;var _0x467ee0=_0xea28[_0x307911];return _0x467ee0;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});}exports[_0x8ea2('0x17')]=function(_0x1b64cf){var _0x174ef2=this;return new Promise(function(_0x467045,_0x2a0329){return db[_0x8ea2('0x18')][_0x8ea2('0x19')]({'raw':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf[_0x8ea2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1b64cf['options']?_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1b')]||null:null,'attributes':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf['options'][_0x8ea2('0x1c')]||null:null,'limit':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf['options'][_0x8ea2('0x1d')]||null:null,'include':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1e')]?_[_0x8ea2('0x1f')](_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1e')],function(_0x1e4cc9){return{'model':db[_0x1e4cc9[_0x8ea2('0x20')]],'as':_0x1e4cc9['as'],'attributes':_0x1e4cc9['attributes'],'include':_0x1e4cc9[_0x8ea2('0x1e')]?_['map'](_0x1e4cc9[_0x8ea2('0x1e')],function(_0x42bec8){return{'model':db[_0x42bec8[_0x8ea2('0x20')]],'as':_0x42bec8['as'],'attributes':_0x42bec8['attributes'],'include':_0x42bec8['include']?_[_0x8ea2('0x1f')](_0x42bec8['include'],function(_0x200a49){return{'model':db[_0x200a49['model']],'as':_0x200a49['as'],'attributes':_0x200a49[_0x8ea2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8ea2('0xd')](function(_0x21c526){logger[_0x8ea2('0xe')]('GetVtigerAccount',_0x1b64cf);logger['debug'](_0x8ea2('0x17'),_0x1b64cf,JSON['stringify'](_0x21c526));_0x467045(_0x21c526);})[_0x8ea2('0x16')](function(_0x287078){logger[_0x8ea2('0x12')](_0x8ea2('0x17'),_0x287078[_0x8ea2('0x14')],_0x1b64cf);_0x2a0329(_0x174ef2[_0x8ea2('0x12')](0x1f4,_0x287078[_0x8ea2('0x14')]));});});};exports[_0x8ea2('0x21')]=function(_0x19e868){var _0x9c5fac=this;return new Promise(function(_0x56d914,_0x5b7ff9){return db[_0x8ea2('0x18')][_0x8ea2('0x22')]({'raw':_0x19e868['options']?_0x19e868['options'][_0x8ea2('0x23')]===undefined?!![]:![]:!![],'where':_0x19e868['options']?_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1b')]||null:null,'attributes':_0x19e868['options']?_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1c')]||null:null,'include':_0x19e868[_0x8ea2('0x1a')]?_0x19e868['options']['include']?_['map'](_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1e')],function(_0x3fc785){return{'model':db[_0x3fc785['model']],'as':_0x3fc785['as'],'attributes':_0x3fc785[_0x8ea2('0x1c')],'include':_0x3fc785[_0x8ea2('0x1e')]?_[_0x8ea2('0x1f')](_0x3fc785[_0x8ea2('0x1e')],function(_0x253031){return{'model':db[_0x253031[_0x8ea2('0x20')]],'as':_0x253031['as'],'attributes':_0x253031[_0x8ea2('0x1c')],'include':_0x253031[_0x8ea2('0x1e')]?_['map'](_0x253031[_0x8ea2('0x1e')],function(_0x29e3f5){return{'model':db[_0x29e3f5[_0x8ea2('0x20')]],'as':_0x29e3f5['as'],'attributes':_0x29e3f5[_0x8ea2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a1f14){logger['info'](_0x8ea2('0x21'),_0x19e868);logger[_0x8ea2('0x24')](_0x8ea2('0x21'),_0x19e868,JSON[_0x8ea2('0x11')](_0x2a1f14));_0x56d914(_0x2a1f14);})['catch'](function(_0x2bed24){logger['error']('ShowVtigerAccount',_0x2bed24[_0x8ea2('0x14')],_0x19e868);_0x5b7ff9(_0x9c5fac['error'](0x1f4,_0x2bed24[_0x8ea2('0x14')]));});});}; \ No newline at end of file +var _0x6cb4=['where','attributes','limit','include','map','model','then','GetVtigerAccount','find','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw'];(function(_0x464d60,_0x35a8ff){var _0x1b9545=function(_0x168b8b){while(--_0x168b8b){_0x464d60['push'](_0x464d60['shift']());}};_0x1b9545(++_0x35a8ff);}(_0x6cb4,0xff));var _0x46cb=function(_0x4bc03b,_0x752b41){_0x4bc03b=_0x4bc03b-0x0;var _0x51d743=_0x6cb4[_0x4bc03b];return _0x51d743;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['GetVtigerAccount']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')]({'raw':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x18')]===undefined?!![]:![]:!![],'where':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x19')]||null:null,'attributes':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1a')]||null:null,'limit':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1b')]||null:null,'include':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1c')]?_[_0x46cb('0x1d')](_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1c')],function(_0xadcad6){return{'model':db[_0xadcad6[_0x46cb('0x1e')]],'as':_0xadcad6['as'],'attributes':_0xadcad6['attributes'],'include':_0xadcad6['include']?_[_0x46cb('0x1d')](_0xadcad6[_0x46cb('0x1c')],function(_0x2711ac){return{'model':db[_0x2711ac[_0x46cb('0x1e')]],'as':_0x2711ac['as'],'attributes':_0x2711ac[_0x46cb('0x1a')],'include':_0x2711ac['include']?_[_0x46cb('0x1d')](_0x2711ac['include'],function(_0x495886){return{'model':db[_0x495886['model']],'as':_0x495886['as'],'attributes':_0x495886[_0x46cb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x46cb('0x1f')](function(_0x2242e7){logger[_0x46cb('0xc')](_0x46cb('0x20'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x20'),_0x4e3454,JSON[_0x46cb('0xf')](_0x2242e7));_0x1f2891(_0x2242e7);})[_0x46cb('0x14')](function(_0x12e01e){logger[_0x46cb('0x10')]('GetVtigerAccount',_0x12e01e[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x12e01e['message']));});});};exports['ShowVtigerAccount']=function(_0x15f5cf){var _0x5cbb22=this;return new Promise(function(_0x27c22d,_0x6f7953){return db[_0x46cb('0x15')][_0x46cb('0x21')]({'raw':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf[_0x46cb('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf['options'][_0x46cb('0x19')]||null:null,'attributes':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf['options'][_0x46cb('0x1a')]||null:null,'include':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf[_0x46cb('0x17')][_0x46cb('0x1c')]?_[_0x46cb('0x1d')](_0x15f5cf['options'][_0x46cb('0x1c')],function(_0x49f80a){return{'model':db[_0x49f80a[_0x46cb('0x1e')]],'as':_0x49f80a['as'],'attributes':_0x49f80a[_0x46cb('0x1a')],'include':_0x49f80a[_0x46cb('0x1c')]?_['map'](_0x49f80a[_0x46cb('0x1c')],function(_0x4290c){return{'model':db[_0x4290c['model']],'as':_0x4290c['as'],'attributes':_0x4290c[_0x46cb('0x1a')],'include':_0x4290c[_0x46cb('0x1c')]?_[_0x46cb('0x1d')](_0x4290c[_0x46cb('0x1c')],function(_0x25be2d){return{'model':db[_0x25be2d[_0x46cb('0x1e')]],'as':_0x25be2d['as'],'attributes':_0x25be2d[_0x46cb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x46cb('0x1f')](function(_0x19e0ad){logger[_0x46cb('0xc')](_0x46cb('0x22'),_0x15f5cf);logger['debug']('ShowVtigerAccount',_0x15f5cf,JSON['stringify'](_0x19e0ad));_0x27c22d(_0x19e0ad);})[_0x46cb('0x14')](function(_0xf8aaec){logger[_0x46cb('0x10')](_0x46cb('0x22'),_0xf8aaec[_0x46cb('0x12')],_0x15f5cf);_0x6f7953(_0x5cbb22[_0x46cb('0x10')](0x1f4,_0xf8aaec['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 2cf46dc..6756c85 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 _0x56a8=['../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3031e7,_0x4a3f62){var _0x2a67c4=function(_0x84826){while(--_0x84826){_0x3031e7['push'](_0x3031e7['shift']());}};_0x2a67c4(++_0x4a3f62);}(_0x56a8,0xf7));var _0x856a=function(_0x4d6d91,_0x343f5d){_0x4d6d91=_0x4d6d91-0x0;var _0x132078=_0x56a8[_0x4d6d91];return _0x132078;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x856a('0x0'));var timeout=require(_0x856a('0x1'));var express=require(_0x856a('0x2'));var router=express[_0x856a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x856a('0x4'));var config=require(_0x856a('0x5'));var controller=require(_0x856a('0x6'));router[_0x856a('0x7')]('/',auth[_0x856a('0x8')](),controller[_0x856a('0x9')]);router[_0x856a('0x7')](_0x856a('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x856a('0xb'),auth['isAuthenticated'](),controller[_0x856a('0xc')]);router[_0x856a('0x7')](_0x856a('0xd'),auth[_0x856a('0x8')](),controller['getSubjects']);router[_0x856a('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x856a('0xe')]('/',auth[_0x856a('0x8')](),controller[_0x856a('0xf')]);router[_0x856a('0x10')](_0x856a('0xa'),auth['isAuthenticated'](),controller[_0x856a('0x11')]);router[_0x856a('0x12')](_0x856a('0xa'),auth[_0x856a('0x8')](),controller[_0x856a('0x13')]);module[_0x856a('0x14')]=router; \ No newline at end of file +var _0x90f1=['get','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x13f0a2,_0x1b3623){var _0x4cd0b4=function(_0x28f044){while(--_0x28f044){_0x13f0a2['push'](_0x13f0a2['shift']());}};_0x4cd0b4(++_0x1b3623);}(_0x90f1,0xcd));var _0x190f=function(_0x186f8d,_0x45091c){_0x186f8d=_0x186f8d-0x0;var _0x38d63c=_0x90f1[_0x186f8d];return _0x38d63c;};'use strict';var multer=require('multer');var util=require(_0x190f('0x0'));var path=require(_0x190f('0x1'));var timeout=require(_0x190f('0x2'));var express=require(_0x190f('0x3'));var router=express[_0x190f('0x4')]();var fs_extra=require(_0x190f('0x5'));var auth=require(_0x190f('0x6'));var interaction=require(_0x190f('0x7'));var config=require(_0x190f('0x8'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x190f('0x9')](),controller[_0x190f('0xa')]);router[_0x190f('0xb')]('/:id',auth[_0x190f('0x9')](),controller[_0x190f('0xc')]);router[_0x190f('0xb')]('/:id/fields',auth[_0x190f('0x9')](),controller['getFields']);router[_0x190f('0xb')](_0x190f('0xd'),auth['isAuthenticated'](),controller[_0x190f('0xe')]);router['get'](_0x190f('0xf'),auth[_0x190f('0x9')](),controller[_0x190f('0x10')]);router[_0x190f('0x11')]('/',auth[_0x190f('0x9')](),controller[_0x190f('0x12')]);router[_0x190f('0x13')](_0x190f('0x14'),auth[_0x190f('0x9')](),controller['update']);router[_0x190f('0x15')](_0x190f('0x14'),auth[_0x190f('0x9')](),controller[_0x190f('0x16')]);module[_0x190f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 2bc9919..6ddda56 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 _0x5366=['STRING','exports'];(function(_0x484bf4,_0x2b975c){var _0x31c683=function(_0x1cdda2){while(--_0x1cdda2){_0x484bf4['push'](_0x484bf4['shift']());}};_0x31c683(++_0x2b975c);}(_0x5366,0x181));var _0x6536=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0x5366[_0x3b4b1d];return _0x488c36;};'use strict';var Sequelize=require('sequelize');module[_0x6536('0x0')]={'name':{'type':Sequelize[_0x6536('0x1')]},'description':{'type':Sequelize[_0x6536('0x1')]}}; \ No newline at end of file +var _0x3dea=['sequelize','STRING'];(function(_0xdeacf1,_0x489de7){var _0x37cfc2=function(_0x2ae966){while(--_0x2ae966){_0xdeacf1['push'](_0xdeacf1['shift']());}};_0x37cfc2(++_0x489de7);}(_0x3dea,0x1b6));var _0xa3de=function(_0x3f52f6,_0x13ff60){_0x3f52f6=_0x3f52f6-0x0;var _0x4e90e7=_0x3dea[_0x3f52f6];return _0x4e90e7;};'use strict';var Sequelize=require(_0xa3de('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3de('0x1')]},'description':{'type':Sequelize[_0xa3de('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 1a4fe65..79eb218 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 _0xc14d=['intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','findAll','rows','show','includeAll','catch','create','body','params','find','findOne','order','getFields','getSubjects','VtigerField','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','apply','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','attributes'];(function(_0x531cb3,_0x2ccd1d){var _0x4461bd=function(_0x19a25c){while(--_0x19a25c){_0x531cb3['push'](_0x531cb3['shift']());}};_0x4461bd(++_0x2ccd1d);}(_0xc14d,0x1ea));var _0xdc14=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc14d[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdc14('0x0'));var jsonpatch=require(_0xdc14('0x1'));var rp=require(_0xdc14('0x2'));var moment=require(_0xdc14('0x3'));var BPromise=require(_0xdc14('0x4'));var Mustache=require(_0xdc14('0x5'));var util=require(_0xdc14('0x6'));var path=require(_0xdc14('0x7'));var sox=require(_0xdc14('0x8'));var csv=require(_0xdc14('0x9'));var ejs=require(_0xdc14('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc14('0xb'));var squel=require('squel');var crypto=require(_0xdc14('0xc'));var jsforce=require(_0xdc14('0xd'));var deskjs=require(_0xdc14('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdc14('0xf'));var Papa=require(_0xdc14('0x10'));var Redis=require(_0xdc14('0x11'));var authService=require(_0xdc14('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc14('0x13'))(_0xdc14('0x14'));var utils=require(_0xdc14('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdc14('0x16'));var db=require(_0xdc14('0x17'))['db'];function respondWithStatusCode(_0x18ca3d,_0x4abc0a){_0x4abc0a=_0x4abc0a||0xcc;return function(_0x2d503b){if(_0x2d503b){return _0x18ca3d[_0xdc14('0x18')](_0x4abc0a);}return _0x18ca3d['status'](_0x4abc0a)['end']();};}function respondWithResult(_0x3450b5,_0x5b1387){_0x5b1387=_0x5b1387||0xc8;return function(_0x512571){if(_0x512571){return _0x3450b5[_0xdc14('0x19')](_0x5b1387)['json'](_0x512571);}};}function respondWithFilteredResult(_0x1782fe,_0x13f392){return function(_0x57de8f){if(_0x57de8f){var _0xc0bf6b=typeof _0x13f392[_0xdc14('0x1a')]==='undefined'&&typeof _0x13f392[_0xdc14('0x1b')]===_0xdc14('0x1c');var _0x187557=_0x57de8f['count'];var _0x3ad9dd=_0xc0bf6b?0x0:_0x13f392[_0xdc14('0x1a')];var _0x17f2a0=_0xc0bf6b?_0x57de8f[_0xdc14('0x1d')]:_0x13f392[_0xdc14('0x1a')]+_0x13f392[_0xdc14('0x1b')];var _0x20fe42;if(_0x17f2a0>=_0x187557){_0x17f2a0=_0x187557;_0x20fe42=0xc8;}else{_0x20fe42=0xce;}_0x1782fe[_0xdc14('0x19')](_0x20fe42);return _0x1782fe['set']('Content-Range',_0x3ad9dd+'-'+_0x17f2a0+'/'+_0x187557)['json'](_0x57de8f);}return null;};}function patchUpdates(_0x2cebd1){return function(_0x2b99d9){try{jsonpatch[_0xdc14('0x1e')](_0x2b99d9,_0x2cebd1,!![]);}catch(_0x549341){return BPromise['reject'](_0x549341);}return _0x2b99d9[_0xdc14('0x1f')]();};}function saveUpdates(_0x38a811,_0x4755fa){return function(_0x36d914){if(_0x36d914){return _0x36d914[_0xdc14('0x20')](_0x38a811)[_0xdc14('0x21')](function(_0x1dab5d){return _0x1dab5d;});}return null;};}function removeEntity(_0x1f5a17,_0x41c75e){return function(_0x2dddc1){if(_0x2dddc1){return _0x2dddc1[_0xdc14('0x22')]()[_0xdc14('0x21')](function(){_0x1f5a17[_0xdc14('0x19')](0xcc)[_0xdc14('0x23')]();});}};}function handleEntityNotFound(_0x30a8a9,_0x8c01bf){return function(_0x289d0a){if(!_0x289d0a){_0x30a8a9['sendStatus'](0x194);}return _0x289d0a;};}function handleError(_0x412079,_0x21b257){_0x21b257=_0x21b257||0x1f4;return function(_0x80ee62){logger['error'](_0x80ee62[_0xdc14('0x24')]);if(_0x80ee62[_0xdc14('0x25')]){delete _0x80ee62[_0xdc14('0x25')];}_0x412079[_0xdc14('0x19')](_0x21b257)[_0xdc14('0x26')](_0x80ee62);};}exports[_0xdc14('0x27')]=function(_0x311564,_0x53a2ba){var _0x166e32={},_0xed4e46={},_0x411b7c={'count':0x0,'rows':[]};var _0x2df8e2=_[_0xdc14('0x28')](db['VtigerConfiguration'][_0xdc14('0x29')],function(_0x29f08b){return{'name':_0x29f08b['fieldName'],'type':_0x29f08b[_0xdc14('0x2a')][_0xdc14('0x2b')]};});_0xed4e46['model']=_[_0xdc14('0x28')](_0x2df8e2,_0xdc14('0x25'));_0xed4e46[_0xdc14('0x2c')]=_[_0xdc14('0x2d')](_0x311564[_0xdc14('0x2c')]);_0xed4e46[_0xdc14('0x2e')]=_['intersection'](_0xed4e46[_0xdc14('0x2f')],_0xed4e46[_0xdc14('0x2c')]);_0x166e32[_0xdc14('0x30')]=_[_0xdc14('0x31')](_0xed4e46[_0xdc14('0x2f')],qs[_0xdc14('0x32')](_0x311564[_0xdc14('0x2c')]['fields']));_0x166e32[_0xdc14('0x30')]=_0x166e32[_0xdc14('0x30')][_0xdc14('0x33')]?_0x166e32['attributes']:_0xed4e46['model'];if(!_0x311564[_0xdc14('0x2c')][_0xdc14('0x34')](_0xdc14('0x35'))){_0x166e32['limit']=qs[_0xdc14('0x1b')](_0x311564['query'][_0xdc14('0x1b')]);_0x166e32[_0xdc14('0x1a')]=qs[_0xdc14('0x1a')](_0x311564[_0xdc14('0x2c')]['offset']);}_0x166e32['order']=qs[_0xdc14('0x36')](_0x311564[_0xdc14('0x2c')][_0xdc14('0x36')]);_0x166e32[_0xdc14('0x37')]=qs[_0xdc14('0x2e')](_[_0xdc14('0x38')](_0x311564[_0xdc14('0x2c')],_0xed4e46[_0xdc14('0x2e')]),_0x2df8e2);if(_0x311564[_0xdc14('0x2c')][_0xdc14('0x39')]){_0x166e32[_0xdc14('0x37')]=_[_0xdc14('0x3a')](_0x166e32[_0xdc14('0x37')],{'$or':_[_0xdc14('0x28')](_0x2df8e2,function(_0x16f0a1){if(_0x16f0a1['type']!==_0xdc14('0x3b')){var _0x45097a={};_0x45097a[_0x16f0a1[_0xdc14('0x25')]]={'$like':'%'+_0x311564[_0xdc14('0x2c')][_0xdc14('0x39')]+'%'};return _0x45097a;}})});}_0x166e32=_[_0xdc14('0x3a')]({},_0x166e32,_0x311564[_0xdc14('0x3c')]);var _0x5a4795={'where':_0x166e32[_0xdc14('0x37')]};return db[_0xdc14('0x3d')][_0xdc14('0x1d')](_0x5a4795)['then'](function(_0x11bbc1){_0x411b7c['count']=_0x11bbc1;if(_0x311564[_0xdc14('0x2c')]['includeAll']){_0x166e32['include']=[{'all':!![]}];}return db[_0xdc14('0x3d')][_0xdc14('0x3e')](_0x166e32);})[_0xdc14('0x21')](function(_0x11f4d4){_0x411b7c[_0xdc14('0x3f')]=_0x11f4d4;return _0x411b7c;})['then'](respondWithFilteredResult(_0x53a2ba,_0x166e32))['catch'](handleError(_0x53a2ba,null));};exports[_0xdc14('0x40')]=function(_0x341260,_0x497603){var _0x5636dd={'raw':![],'where':{'id':_0x341260['params']['id']}},_0x32e5d9={};_0x32e5d9[_0xdc14('0x2f')]=_[_0xdc14('0x2d')](db['VtigerConfiguration'][_0xdc14('0x29')]);_0x32e5d9[_0xdc14('0x2c')]=_[_0xdc14('0x2d')](_0x341260[_0xdc14('0x2c')]);_0x32e5d9['filters']=_[_0xdc14('0x31')](_0x32e5d9[_0xdc14('0x2f')],_0x32e5d9['query']);_0x5636dd[_0xdc14('0x30')]=_[_0xdc14('0x31')](_0x32e5d9[_0xdc14('0x2f')],qs[_0xdc14('0x32')](_0x341260['query'][_0xdc14('0x32')]));_0x5636dd[_0xdc14('0x30')]=_0x5636dd[_0xdc14('0x30')][_0xdc14('0x33')]?_0x5636dd[_0xdc14('0x30')]:_0x32e5d9[_0xdc14('0x2f')];if(_0x341260['query'][_0xdc14('0x41')]){_0x5636dd['include']=[{'all':!![]}];}_0x5636dd=_[_0xdc14('0x3a')]({},_0x5636dd,_0x341260[_0xdc14('0x3c')]);return db[_0xdc14('0x3d')]['find'](_0x5636dd)[_0xdc14('0x21')](handleEntityNotFound(_0x497603,null))[_0xdc14('0x21')](respondWithResult(_0x497603,null))[_0xdc14('0x42')](handleError(_0x497603,null));};exports['create']=function(_0x21f7d8,_0x4c3320){return db['VtigerConfiguration'][_0xdc14('0x43')](_0x21f7d8['body'],{})[_0xdc14('0x21')](respondWithResult(_0x4c3320,0xc9))[_0xdc14('0x42')](handleError(_0x4c3320,null));};exports['update']=function(_0x56761c,_0x5d00f3){if(_0x56761c[_0xdc14('0x44')]['id']){delete _0x56761c[_0xdc14('0x44')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x56761c[_0xdc14('0x45')]['id']}})[_0xdc14('0x21')](handleEntityNotFound(_0x5d00f3,null))[_0xdc14('0x21')](saveUpdates(_0x56761c[_0xdc14('0x44')],null))[_0xdc14('0x21')](respondWithResult(_0x5d00f3,null))[_0xdc14('0x42')](handleError(_0x5d00f3,null));};exports[_0xdc14('0x22')]=function(_0x1a09c8,_0xfb5298){return db[_0xdc14('0x3d')][_0xdc14('0x46')]({'where':{'id':_0x1a09c8[_0xdc14('0x45')]['id']}})['then'](handleEntityNotFound(_0xfb5298,null))['then'](removeEntity(_0xfb5298,null))[_0xdc14('0x42')](handleError(_0xfb5298,null));};exports['getFields']=function(_0x1a4a72,_0x38ac85,_0x494b0c){var _0x48809c={};var _0x1249fd={};var _0xe581c1;var _0x23d30e;return db[_0xdc14('0x3d')][_0xdc14('0x47')]({'where':{'id':_0x1a4a72[_0xdc14('0x45')]['id']}})[_0xdc14('0x21')](handleEntityNotFound(_0x38ac85,null))['then'](function(_0xb38357){if(_0xb38357){_0xe581c1=_0xb38357;_0x1249fd['model']=_['keys'](db['VtigerField'][_0xdc14('0x29')]);_0x1249fd[_0xdc14('0x2c')]=_[_0xdc14('0x2d')](_0x1a4a72[_0xdc14('0x2c')]);_0x1249fd['filters']=_[_0xdc14('0x31')](_0x1249fd[_0xdc14('0x2f')],_0x1249fd['query']);_0x48809c[_0xdc14('0x30')]=_[_0xdc14('0x31')](_0x1249fd['model'],qs['fields'](_0x1a4a72[_0xdc14('0x2c')][_0xdc14('0x32')]));_0x48809c['attributes']=_0x48809c[_0xdc14('0x30')][_0xdc14('0x33')]?_0x48809c[_0xdc14('0x30')]:_0x1249fd[_0xdc14('0x2f')];_0x48809c[_0xdc14('0x48')]=qs[_0xdc14('0x36')](_0x1a4a72['query'][_0xdc14('0x36')]);_0x48809c[_0xdc14('0x37')]=qs['filters'](_[_0xdc14('0x38')](_0x1a4a72[_0xdc14('0x2c')],_0x1249fd[_0xdc14('0x2e')]));if(_0x1a4a72[_0xdc14('0x2c')][_0xdc14('0x39')]){_0x48809c[_0xdc14('0x37')]=_[_0xdc14('0x3a')](_0x48809c[_0xdc14('0x37')],{'$or':_['map'](_0x48809c[_0xdc14('0x30')],function(_0x4198a7){var _0x42ef89={};_0x42ef89[_0x4198a7]={'$like':'%'+_0x1a4a72[_0xdc14('0x2c')][_0xdc14('0x39')]+'%'};return _0x42ef89;})});}_0x48809c=_[_0xdc14('0x3a')]({},_0x48809c,_0x1a4a72[_0xdc14('0x3c')]);return _0xe581c1[_0xdc14('0x49')](_0x48809c);}})[_0xdc14('0x21')](function(_0x2c6473){if(_0x2c6473){_0x23d30e=_0x2c6473['length'];if(!_0x1a4a72[_0xdc14('0x2c')][_0xdc14('0x34')](_0xdc14('0x35'))){_0x48809c[_0xdc14('0x1b')]=qs[_0xdc14('0x1b')](_0x1a4a72['query'][_0xdc14('0x1b')]);_0x48809c[_0xdc14('0x1a')]=qs[_0xdc14('0x1a')](_0x1a4a72[_0xdc14('0x2c')][_0xdc14('0x1a')]);}return _0xe581c1[_0xdc14('0x49')](_0x48809c);}})[_0xdc14('0x21')](function(_0x537b42){if(_0x537b42){return _0x537b42?{'count':_0x23d30e,'rows':_0x537b42}:null;}})['then'](respondWithResult(_0x38ac85,null))[_0xdc14('0x42')](handleError(_0x38ac85,null));};exports[_0xdc14('0x4a')]=function(_0x4f76ca,_0x3d8b65,_0x2befe8){var _0x230999={};var _0x2b2e52={};var _0x162563;var _0x4fe01a;return db['VtigerConfiguration'][_0xdc14('0x47')]({'where':{'id':_0x4f76ca[_0xdc14('0x45')]['id']}})[_0xdc14('0x21')](handleEntityNotFound(_0x3d8b65,null))[_0xdc14('0x21')](function(_0x56311b){if(_0x56311b){_0x162563=_0x56311b;_0x2b2e52[_0xdc14('0x2f')]=_[_0xdc14('0x2d')](db[_0xdc14('0x4b')][_0xdc14('0x29')]);_0x2b2e52['query']=_['keys'](_0x4f76ca[_0xdc14('0x2c')]);_0x2b2e52[_0xdc14('0x2e')]=_[_0xdc14('0x31')](_0x2b2e52[_0xdc14('0x2f')],_0x2b2e52[_0xdc14('0x2c')]);_0x230999['attributes']=_['intersection'](_0x2b2e52[_0xdc14('0x2f')],qs[_0xdc14('0x32')](_0x4f76ca['query'][_0xdc14('0x32')]));_0x230999[_0xdc14('0x30')]=_0x230999[_0xdc14('0x30')][_0xdc14('0x33')]?_0x230999['attributes']:_0x2b2e52[_0xdc14('0x2f')];_0x230999['order']=qs['sort'](_0x4f76ca[_0xdc14('0x2c')][_0xdc14('0x36')]);_0x230999['where']=qs[_0xdc14('0x2e')](_[_0xdc14('0x38')](_0x4f76ca[_0xdc14('0x2c')],_0x2b2e52['filters']));if(_0x4f76ca['query'][_0xdc14('0x39')]){_0x230999['where']=_[_0xdc14('0x3a')](_0x230999[_0xdc14('0x37')],{'$or':_['map'](_0x230999[_0xdc14('0x30')],function(_0x2ad45e){var _0x26b4cc={};_0x26b4cc[_0x2ad45e]={'$like':'%'+_0x4f76ca[_0xdc14('0x2c')][_0xdc14('0x39')]+'%'};return _0x26b4cc;})});}_0x230999=_[_0xdc14('0x3a')]({},_0x230999,_0x4f76ca[_0xdc14('0x3c')]);return _0x162563[_0xdc14('0x4a')](_0x230999);}})[_0xdc14('0x21')](function(_0x4bd3a6){if(_0x4bd3a6){_0x4fe01a=_0x4bd3a6[_0xdc14('0x33')];if(!_0x4f76ca[_0xdc14('0x2c')][_0xdc14('0x34')]('nolimit')){_0x230999[_0xdc14('0x1b')]=qs['limit'](_0x4f76ca[_0xdc14('0x2c')]['limit']);_0x230999[_0xdc14('0x1a')]=qs[_0xdc14('0x1a')](_0x4f76ca[_0xdc14('0x2c')][_0xdc14('0x1a')]);}return _0x162563['getSubjects'](_0x230999);}})[_0xdc14('0x21')](function(_0x668351){if(_0x668351){return _0x668351?{'count':_0x4fe01a,'rows':_0x668351}:null;}})[_0xdc14('0x21')](respondWithResult(_0x3d8b65,null))[_0xdc14('0x42')](handleError(_0x3d8b65,null));};exports[_0xdc14('0x4c')]=function(_0xf904ae,_0x3f2c58,_0x3ee7da){var _0x417ed8={};var _0xa55178={};var _0x24c581;var _0x47f394;return db['VtigerConfiguration'][_0xdc14('0x47')]({'where':{'id':_0xf904ae[_0xdc14('0x45')]['id']}})[_0xdc14('0x21')](handleEntityNotFound(_0x3f2c58,null))[_0xdc14('0x21')](function(_0x5ee13e){if(_0x5ee13e){_0x24c581=_0x5ee13e;_0xa55178[_0xdc14('0x2f')]=_['keys'](db[_0xdc14('0x4b')][_0xdc14('0x29')]);_0xa55178['query']=_[_0xdc14('0x2d')](_0xf904ae[_0xdc14('0x2c')]);_0xa55178[_0xdc14('0x2e')]=_[_0xdc14('0x31')](_0xa55178[_0xdc14('0x2f')],_0xa55178[_0xdc14('0x2c')]);_0x417ed8['attributes']=_[_0xdc14('0x31')](_0xa55178[_0xdc14('0x2f')],qs[_0xdc14('0x32')](_0xf904ae['query']['fields']));_0x417ed8[_0xdc14('0x30')]=_0x417ed8[_0xdc14('0x30')][_0xdc14('0x33')]?_0x417ed8[_0xdc14('0x30')]:_0xa55178[_0xdc14('0x2f')];_0x417ed8[_0xdc14('0x48')]=qs[_0xdc14('0x36')](_0xf904ae[_0xdc14('0x2c')]['sort']);_0x417ed8['where']=qs[_0xdc14('0x2e')](_[_0xdc14('0x38')](_0xf904ae['query'],_0xa55178[_0xdc14('0x2e')]));if(_0xf904ae['query'][_0xdc14('0x39')]){_0x417ed8['where']=_[_0xdc14('0x3a')](_0x417ed8[_0xdc14('0x37')],{'$or':_[_0xdc14('0x28')](_0x417ed8[_0xdc14('0x30')],function(_0xf302ba){var _0x186245={};_0x186245[_0xf302ba]={'$like':'%'+_0xf904ae[_0xdc14('0x2c')]['filter']+'%'};return _0x186245;})});}_0x417ed8=_['merge']({},_0x417ed8,_0xf904ae[_0xdc14('0x3c')]);return _0x24c581['getDescriptions'](_0x417ed8);}})[_0xdc14('0x21')](function(_0x40c3){if(_0x40c3){_0x47f394=_0x40c3[_0xdc14('0x33')];if(!_0xf904ae[_0xdc14('0x2c')][_0xdc14('0x34')](_0xdc14('0x35'))){_0x417ed8[_0xdc14('0x1b')]=qs['limit'](_0xf904ae[_0xdc14('0x2c')][_0xdc14('0x1b')]);_0x417ed8[_0xdc14('0x1a')]=qs[_0xdc14('0x1a')](_0xf904ae[_0xdc14('0x2c')][_0xdc14('0x1a')]);}return _0x24c581[_0xdc14('0x4c')](_0x417ed8);}})[_0xdc14('0x21')](function(_0x2cf668){if(_0x2cf668){return _0x2cf668?{'count':_0x47f394,'rows':_0x2cf668}:null;}})[_0xdc14('0x21')](respondWithResult(_0x3f2c58,null))[_0xdc14('0x42')](handleError(_0x3f2c58,null));}; \ No newline at end of file +var _0x34b2=['nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','VtigerConfiguration','findAll','rows','catch','show','keys','rawAttributes','create','body','find','params','getFields','VtigerField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','filters','intersection','attributes','fields','query','length'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x34b2,0x11c));var _0x234b=function(_0xeaa3bd,_0x166691){_0xeaa3bd=_0xeaa3bd-0x0;var _0x2e1174=_0x34b2[_0xeaa3bd];return _0x2e1174;};'use strict';var emlformat=require(_0x234b('0x0'));var rimraf=require(_0x234b('0x1'));var zipdir=require(_0x234b('0x2'));var jsonpatch=require(_0x234b('0x3'));var rp=require(_0x234b('0x4'));var moment=require(_0x234b('0x5'));var BPromise=require(_0x234b('0x6'));var Mustache=require(_0x234b('0x7'));var util=require(_0x234b('0x8'));var path=require(_0x234b('0x9'));var sox=require(_0x234b('0xa'));var csv=require(_0x234b('0xb'));var ejs=require(_0x234b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x234b('0xd'));var jsforce=require(_0x234b('0xe'));var deskjs=require(_0x234b('0xf'));var toCsv=require(_0x234b('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x234b('0x10'));var authService=require(_0x234b('0x11'));var qs=require(_0x234b('0x12'));var as=require(_0x234b('0x13'));var hardwareService=require(_0x234b('0x14'));var logger=require(_0x234b('0x15'))(_0x234b('0x16'));var utils=require(_0x234b('0x17'));var config=require(_0x234b('0x18'));var licenseUtil=require(_0x234b('0x19'));var db=require(_0x234b('0x1a'))['db'];function respondWithStatusCode(_0x30b61d,_0x2eb390){_0x2eb390=_0x2eb390||0xcc;return function(_0x527c27){if(_0x527c27){return _0x30b61d[_0x234b('0x1b')](_0x2eb390);}return _0x30b61d[_0x234b('0x1c')](_0x2eb390)['end']();};}function respondWithResult(_0x2eb01c,_0x836f55){_0x836f55=_0x836f55||0xc8;return function(_0x580836){if(_0x580836){return _0x2eb01c[_0x234b('0x1c')](_0x836f55)[_0x234b('0x1d')](_0x580836);}};}function respondWithFilteredResult(_0x3ad95a,_0x9d98dd){return function(_0x2c3b6b){if(_0x2c3b6b){var _0x20d6cb=typeof _0x9d98dd[_0x234b('0x1e')]===_0x234b('0x1f')&&typeof _0x9d98dd[_0x234b('0x20')]==='undefined';var _0x107820=_0x2c3b6b[_0x234b('0x21')];var _0x18153a=_0x20d6cb?0x0:_0x9d98dd[_0x234b('0x1e')];var _0x4424a1=_0x20d6cb?_0x2c3b6b[_0x234b('0x21')]:_0x9d98dd[_0x234b('0x1e')]+_0x9d98dd[_0x234b('0x20')];var _0x30c5f4;if(_0x4424a1>=_0x107820){_0x4424a1=_0x107820;_0x30c5f4=0xc8;}else{_0x30c5f4=0xce;}_0x3ad95a[_0x234b('0x1c')](_0x30c5f4);return _0x3ad95a['set'](_0x234b('0x22'),_0x18153a+'-'+_0x4424a1+'/'+_0x107820)[_0x234b('0x1d')](_0x2c3b6b);}return null;};}function patchUpdates(_0x2a47e1){return function(_0x44d8d3){try{jsonpatch[_0x234b('0x23')](_0x44d8d3,_0x2a47e1,!![]);}catch(_0x5e5e2b){return BPromise[_0x234b('0x24')](_0x5e5e2b);}return _0x44d8d3[_0x234b('0x25')]();};}function saveUpdates(_0x50dfec,_0x184e98){return function(_0x115d47){if(_0x115d47){return _0x115d47[_0x234b('0x26')](_0x50dfec)[_0x234b('0x27')](function(_0x1f9e3f){return _0x1f9e3f;});}return null;};}function removeEntity(_0x18569b,_0x3daafa){return function(_0x1b8ead){if(_0x1b8ead){return _0x1b8ead[_0x234b('0x28')]()[_0x234b('0x27')](function(){_0x18569b[_0x234b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaaa218,_0x540e6b){return function(_0x1f64d9){if(!_0x1f64d9){_0xaaa218[_0x234b('0x1b')](0x194);}return _0x1f64d9;};}function handleError(_0x42c42e,_0x273b10){_0x273b10=_0x273b10||0x1f4;return function(_0x493108){logger[_0x234b('0x29')](_0x493108[_0x234b('0x2a')]);if(_0x493108['name']){delete _0x493108[_0x234b('0x2b')];}_0x42c42e[_0x234b('0x1c')](_0x273b10)[_0x234b('0x2c')](_0x493108);};}exports[_0x234b('0x2d')]=function(_0x1de1dc,_0x5bf3c3){var _0x17c0f5={},_0x5d211b={},_0x439577={'count':0x0,'rows':[]};var _0x3b698f=_[_0x234b('0x2e')](db['VtigerConfiguration']['rawAttributes'],function(_0x4c8cde){return{'name':_0x4c8cde[_0x234b('0x2f')],'type':_0x4c8cde['type'][_0x234b('0x30')]};});_0x5d211b[_0x234b('0x31')]=_[_0x234b('0x2e')](_0x3b698f,_0x234b('0x2b'));_0x5d211b['query']=_['keys'](_0x1de1dc['query']);_0x5d211b[_0x234b('0x32')]=_[_0x234b('0x33')](_0x5d211b[_0x234b('0x31')],_0x5d211b['query']);_0x17c0f5[_0x234b('0x34')]=_[_0x234b('0x33')](_0x5d211b[_0x234b('0x31')],qs[_0x234b('0x35')](_0x1de1dc[_0x234b('0x36')][_0x234b('0x35')]));_0x17c0f5[_0x234b('0x34')]=_0x17c0f5[_0x234b('0x34')][_0x234b('0x37')]?_0x17c0f5['attributes']:_0x5d211b[_0x234b('0x31')];if(!_0x1de1dc[_0x234b('0x36')]['hasOwnProperty'](_0x234b('0x38'))){_0x17c0f5[_0x234b('0x20')]=qs['limit'](_0x1de1dc[_0x234b('0x36')][_0x234b('0x20')]);_0x17c0f5['offset']=qs[_0x234b('0x1e')](_0x1de1dc[_0x234b('0x36')][_0x234b('0x1e')]);}_0x17c0f5['order']=qs[_0x234b('0x39')](_0x1de1dc[_0x234b('0x36')]['sort']);_0x17c0f5[_0x234b('0x3a')]=qs['filters'](_[_0x234b('0x3b')](_0x1de1dc['query'],_0x5d211b['filters']),_0x3b698f);if(_0x1de1dc['query'][_0x234b('0x3c')]){_0x17c0f5[_0x234b('0x3a')]=_[_0x234b('0x3d')](_0x17c0f5[_0x234b('0x3a')],{'$or':_[_0x234b('0x2e')](_0x3b698f,function(_0x1013f2){if(_0x1013f2[_0x234b('0x3e')]!==_0x234b('0x3f')){var _0x2a15d2={};_0x2a15d2[_0x1013f2[_0x234b('0x2b')]]={'$like':'%'+_0x1de1dc['query'][_0x234b('0x3c')]+'%'};return _0x2a15d2;}})});}_0x17c0f5=_[_0x234b('0x3d')]({},_0x17c0f5,_0x1de1dc[_0x234b('0x40')]);var _0x515246={'where':_0x17c0f5[_0x234b('0x3a')]};return db['VtigerConfiguration']['count'](_0x515246)[_0x234b('0x27')](function(_0x6490cd){_0x439577['count']=_0x6490cd;if(_0x1de1dc[_0x234b('0x36')][_0x234b('0x41')]){_0x17c0f5[_0x234b('0x42')]=[{'all':!![]}];}return db[_0x234b('0x43')][_0x234b('0x44')](_0x17c0f5);})[_0x234b('0x27')](function(_0x3ee603){_0x439577[_0x234b('0x45')]=_0x3ee603;return _0x439577;})['then'](respondWithFilteredResult(_0x5bf3c3,_0x17c0f5))[_0x234b('0x46')](handleError(_0x5bf3c3,null));};exports[_0x234b('0x47')]=function(_0x6c89c5,_0x170bc4){var _0xbaaf03={'raw':![],'where':{'id':_0x6c89c5['params']['id']}},_0xa57fd9={};_0xa57fd9[_0x234b('0x31')]=_[_0x234b('0x48')](db[_0x234b('0x43')][_0x234b('0x49')]);_0xa57fd9[_0x234b('0x36')]=_[_0x234b('0x48')](_0x6c89c5['query']);_0xa57fd9[_0x234b('0x32')]=_['intersection'](_0xa57fd9['model'],_0xa57fd9[_0x234b('0x36')]);_0xbaaf03[_0x234b('0x34')]=_[_0x234b('0x33')](_0xa57fd9[_0x234b('0x31')],qs['fields'](_0x6c89c5['query'][_0x234b('0x35')]));_0xbaaf03['attributes']=_0xbaaf03[_0x234b('0x34')][_0x234b('0x37')]?_0xbaaf03[_0x234b('0x34')]:_0xa57fd9['model'];if(_0x6c89c5[_0x234b('0x36')]['includeAll']){_0xbaaf03[_0x234b('0x42')]=[{'all':!![]}];}_0xbaaf03=_[_0x234b('0x3d')]({},_0xbaaf03,_0x6c89c5[_0x234b('0x40')]);return db[_0x234b('0x43')]['find'](_0xbaaf03)[_0x234b('0x27')](handleEntityNotFound(_0x170bc4,null))[_0x234b('0x27')](respondWithResult(_0x170bc4,null))[_0x234b('0x46')](handleError(_0x170bc4,null));};exports[_0x234b('0x4a')]=function(_0x4b72ac,_0x47cc0e){return db['VtigerConfiguration']['create'](_0x4b72ac[_0x234b('0x4b')],{})[_0x234b('0x27')](respondWithResult(_0x47cc0e,0xc9))[_0x234b('0x46')](handleError(_0x47cc0e,null));};exports['update']=function(_0x538738,_0x5a0bef){if(_0x538738[_0x234b('0x4b')]['id']){delete _0x538738[_0x234b('0x4b')]['id'];}return db[_0x234b('0x43')][_0x234b('0x4c')]({'where':{'id':_0x538738[_0x234b('0x4d')]['id']}})[_0x234b('0x27')](handleEntityNotFound(_0x5a0bef,null))[_0x234b('0x27')](saveUpdates(_0x538738['body'],null))[_0x234b('0x27')](respondWithResult(_0x5a0bef,null))['catch'](handleError(_0x5a0bef,null));};exports[_0x234b('0x28')]=function(_0x391e31,_0x4df6f5){return db['VtigerConfiguration'][_0x234b('0x4c')]({'where':{'id':_0x391e31[_0x234b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4df6f5,null))[_0x234b('0x27')](removeEntity(_0x4df6f5,null))['catch'](handleError(_0x4df6f5,null));};exports[_0x234b('0x4e')]=function(_0x39e15c,_0x31d969,_0x57b591){var _0x54dd00={};var _0x18732c={};var _0x2fdae6;var _0x54449b;return db[_0x234b('0x43')]['findOne']({'where':{'id':_0x39e15c['params']['id']}})[_0x234b('0x27')](handleEntityNotFound(_0x31d969,null))[_0x234b('0x27')](function(_0x198877){if(_0x198877){_0x2fdae6=_0x198877;_0x18732c[_0x234b('0x31')]=_['keys'](db[_0x234b('0x4f')]['rawAttributes']);_0x18732c['query']=_[_0x234b('0x48')](_0x39e15c[_0x234b('0x36')]);_0x18732c[_0x234b('0x32')]=_[_0x234b('0x33')](_0x18732c[_0x234b('0x31')],_0x18732c[_0x234b('0x36')]);_0x54dd00['attributes']=_[_0x234b('0x33')](_0x18732c[_0x234b('0x31')],qs[_0x234b('0x35')](_0x39e15c[_0x234b('0x36')]['fields']));_0x54dd00[_0x234b('0x34')]=_0x54dd00[_0x234b('0x34')][_0x234b('0x37')]?_0x54dd00['attributes']:_0x18732c[_0x234b('0x31')];_0x54dd00[_0x234b('0x50')]=qs[_0x234b('0x39')](_0x39e15c[_0x234b('0x36')][_0x234b('0x39')]);_0x54dd00[_0x234b('0x3a')]=qs['filters'](_[_0x234b('0x3b')](_0x39e15c[_0x234b('0x36')],_0x18732c[_0x234b('0x32')]));if(_0x39e15c[_0x234b('0x36')]['filter']){_0x54dd00['where']=_[_0x234b('0x3d')](_0x54dd00[_0x234b('0x3a')],{'$or':_[_0x234b('0x2e')](_0x54dd00[_0x234b('0x34')],function(_0x55fd9c){var _0x5e1207={};_0x5e1207[_0x55fd9c]={'$like':'%'+_0x39e15c[_0x234b('0x36')]['filter']+'%'};return _0x5e1207;})});}_0x54dd00=_[_0x234b('0x3d')]({},_0x54dd00,_0x39e15c['options']);return _0x2fdae6[_0x234b('0x4e')](_0x54dd00);}})[_0x234b('0x27')](function(_0x222bd1){if(_0x222bd1){_0x54449b=_0x222bd1[_0x234b('0x37')];if(!_0x39e15c[_0x234b('0x36')][_0x234b('0x51')](_0x234b('0x38'))){_0x54dd00[_0x234b('0x20')]=qs[_0x234b('0x20')](_0x39e15c['query'][_0x234b('0x20')]);_0x54dd00[_0x234b('0x1e')]=qs['offset'](_0x39e15c[_0x234b('0x36')][_0x234b('0x1e')]);}return _0x2fdae6[_0x234b('0x4e')](_0x54dd00);}})[_0x234b('0x27')](function(_0x1e5008){if(_0x1e5008){return _0x1e5008?{'count':_0x54449b,'rows':_0x1e5008}:null;}})[_0x234b('0x27')](respondWithResult(_0x31d969,null))[_0x234b('0x46')](handleError(_0x31d969,null));};exports[_0x234b('0x52')]=function(_0x124220,_0x1d7116,_0x3f6f48){var _0x13c437={};var _0x2aab30={};var _0x471f47;var _0x458548;return db['VtigerConfiguration'][_0x234b('0x53')]({'where':{'id':_0x124220[_0x234b('0x4d')]['id']}})[_0x234b('0x27')](handleEntityNotFound(_0x1d7116,null))['then'](function(_0x38f082){if(_0x38f082){_0x471f47=_0x38f082;_0x2aab30['model']=_[_0x234b('0x48')](db[_0x234b('0x4f')][_0x234b('0x49')]);_0x2aab30[_0x234b('0x36')]=_[_0x234b('0x48')](_0x124220[_0x234b('0x36')]);_0x2aab30[_0x234b('0x32')]=_['intersection'](_0x2aab30['model'],_0x2aab30[_0x234b('0x36')]);_0x13c437['attributes']=_[_0x234b('0x33')](_0x2aab30[_0x234b('0x31')],qs['fields'](_0x124220[_0x234b('0x36')]['fields']));_0x13c437['attributes']=_0x13c437['attributes'][_0x234b('0x37')]?_0x13c437[_0x234b('0x34')]:_0x2aab30['model'];_0x13c437['order']=qs['sort'](_0x124220[_0x234b('0x36')][_0x234b('0x39')]);_0x13c437[_0x234b('0x3a')]=qs[_0x234b('0x32')](_['pick'](_0x124220[_0x234b('0x36')],_0x2aab30[_0x234b('0x32')]));if(_0x124220[_0x234b('0x36')][_0x234b('0x3c')]){_0x13c437['where']=_[_0x234b('0x3d')](_0x13c437['where'],{'$or':_[_0x234b('0x2e')](_0x13c437[_0x234b('0x34')],function(_0x2f2b0f){var _0x1f7c8c={};_0x1f7c8c[_0x2f2b0f]={'$like':'%'+_0x124220[_0x234b('0x36')][_0x234b('0x3c')]+'%'};return _0x1f7c8c;})});}_0x13c437=_['merge']({},_0x13c437,_0x124220[_0x234b('0x40')]);return _0x471f47[_0x234b('0x52')](_0x13c437);}})[_0x234b('0x27')](function(_0x236899){if(_0x236899){_0x458548=_0x236899[_0x234b('0x37')];if(!_0x124220[_0x234b('0x36')][_0x234b('0x51')](_0x234b('0x38'))){_0x13c437[_0x234b('0x20')]=qs[_0x234b('0x20')](_0x124220[_0x234b('0x36')][_0x234b('0x20')]);_0x13c437[_0x234b('0x1e')]=qs[_0x234b('0x1e')](_0x124220[_0x234b('0x36')][_0x234b('0x1e')]);}return _0x471f47[_0x234b('0x52')](_0x13c437);}})[_0x234b('0x27')](function(_0xf1637b){if(_0xf1637b){return _0xf1637b?{'count':_0x458548,'rows':_0xf1637b}:null;}})[_0x234b('0x27')](respondWithResult(_0x1d7116,null))['catch'](handleError(_0x1d7116,null));};exports[_0x234b('0x54')]=function(_0x15caa0,_0x34b13e,_0xf03698){var _0x5580f7={};var _0x22e5b8={};var _0x444c8f;var _0x21ae7d;return db[_0x234b('0x43')][_0x234b('0x53')]({'where':{'id':_0x15caa0[_0x234b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34b13e,null))['then'](function(_0x19ad09){if(_0x19ad09){_0x444c8f=_0x19ad09;_0x22e5b8[_0x234b('0x31')]=_[_0x234b('0x48')](db['VtigerField'][_0x234b('0x49')]);_0x22e5b8[_0x234b('0x36')]=_[_0x234b('0x48')](_0x15caa0[_0x234b('0x36')]);_0x22e5b8[_0x234b('0x32')]=_['intersection'](_0x22e5b8[_0x234b('0x31')],_0x22e5b8[_0x234b('0x36')]);_0x5580f7[_0x234b('0x34')]=_[_0x234b('0x33')](_0x22e5b8[_0x234b('0x31')],qs[_0x234b('0x35')](_0x15caa0[_0x234b('0x36')]['fields']));_0x5580f7[_0x234b('0x34')]=_0x5580f7['attributes'][_0x234b('0x37')]?_0x5580f7[_0x234b('0x34')]:_0x22e5b8[_0x234b('0x31')];_0x5580f7[_0x234b('0x50')]=qs[_0x234b('0x39')](_0x15caa0[_0x234b('0x36')][_0x234b('0x39')]);_0x5580f7['where']=qs[_0x234b('0x32')](_['pick'](_0x15caa0[_0x234b('0x36')],_0x22e5b8[_0x234b('0x32')]));if(_0x15caa0[_0x234b('0x36')]['filter']){_0x5580f7[_0x234b('0x3a')]=_['merge'](_0x5580f7['where'],{'$or':_[_0x234b('0x2e')](_0x5580f7[_0x234b('0x34')],function(_0x364e73){var _0x1cedc0={};_0x1cedc0[_0x364e73]={'$like':'%'+_0x15caa0['query'][_0x234b('0x3c')]+'%'};return _0x1cedc0;})});}_0x5580f7=_[_0x234b('0x3d')]({},_0x5580f7,_0x15caa0[_0x234b('0x40')]);return _0x444c8f[_0x234b('0x54')](_0x5580f7);}})[_0x234b('0x27')](function(_0x5afa8e){if(_0x5afa8e){_0x21ae7d=_0x5afa8e['length'];if(!_0x15caa0['query'][_0x234b('0x51')](_0x234b('0x38'))){_0x5580f7[_0x234b('0x20')]=qs[_0x234b('0x20')](_0x15caa0[_0x234b('0x36')][_0x234b('0x20')]);_0x5580f7[_0x234b('0x1e')]=qs['offset'](_0x15caa0[_0x234b('0x36')][_0x234b('0x1e')]);}return _0x444c8f[_0x234b('0x54')](_0x5580f7);}})[_0x234b('0x27')](function(_0x2240a2){if(_0x2240a2){return _0x2240a2?{'count':_0x21ae7d,'rows':_0x2240a2}:null;}})[_0x234b('0x27')](respondWithResult(_0x34b13e,null))[_0x234b('0x46')](handleError(_0x34b13e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index be844f7..652b2a9 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 _0x1f45=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','./intVtigerConfiguration.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f45,0x85));var _0x51f4=function(_0x52f5b7,_0x143e5d){_0x52f5b7=_0x52f5b7-0x0;var _0x32b232=_0x1f45[_0x52f5b7];return _0x32b232;};'use strict';var _=require(_0x51f4('0x0'));var util=require(_0x51f4('0x1'));var logger=require(_0x51f4('0x2'))(_0x51f4('0x3'));var moment=require(_0x51f4('0x4'));var BPromise=require('bluebird');var rp=require(_0x51f4('0x5'));var fs=require('fs');var path=require(_0x51f4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x51f4('0x7'));module[_0x51f4('0x8')]=function(_0x3b7c10,_0x43d644){return _0x3b7c10[_0x51f4('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x51f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88ec=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x2d4080,_0x340d7a){var _0x474afe=function(_0x11bf4d){while(--_0x11bf4d){_0x2d4080['push'](_0x2d4080['shift']());}};_0x474afe(++_0x340d7a);}(_0x88ec,0x1c6));var _0xc88e=function(_0x2f1c82,_0x549d2e){_0x2f1c82=_0x2f1c82-0x0;var _0x2ffa52=_0x88ec[_0x2f1c82];return _0x2ffa52;};'use strict';var _=require(_0xc88e('0x0'));var util=require(_0xc88e('0x1'));var logger=require(_0xc88e('0x2'))(_0xc88e('0x3'));var moment=require(_0xc88e('0x4'));var BPromise=require(_0xc88e('0x5'));var rp=require(_0xc88e('0x6'));var fs=require('fs');var path=require(_0xc88e('0x7'));var rimraf=require(_0xc88e('0x8'));var config=require(_0xc88e('0x9'));var attributes=require(_0xc88e('0xa'));module['exports']=function(_0x13e4a4,_0x9ccd56){return _0x13e4a4['define'](_0xc88e('0xb'),attributes,{'tableName':_0xc88e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index af13ef8..155a25d 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 _0xe018=['VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','client','http','request','then','info'];(function(_0x2325ea,_0x6f5a67){var _0x4ec224=function(_0x336258){while(--_0x336258){_0x2325ea['push'](_0x2325ea['shift']());}};_0x4ec224(++_0x6f5a67);}(_0xe018,0xe6));var _0x8e01=function(_0x186b9a,_0x9032a7){_0x186b9a=_0x186b9a-0x0;var _0xc9f1b2=_0xe018[_0x186b9a];return _0xc9f1b2;};'use strict';var _=require(_0x8e01('0x0'));var util=require(_0x8e01('0x1'));var moment=require(_0x8e01('0x2'));var BPromise=require(_0x8e01('0x3'));var rs=require(_0x8e01('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8e01('0x5'))(_0x8e01('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e01('0x7')][_0x8e01('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x344624,_0x1f9859,_0x1a0547){return new BPromise(function(_0x37be1d,_0x57f93f){return client[_0x8e01('0x9')](_0x344624,_0x1a0547)[_0x8e01('0xa')](function(_0x332565){logger[_0x8e01('0xb')](_0x8e01('0xc'),_0x1f9859,'request\x20sent');logger[_0x8e01('0xd')](_0x8e01('0xe'),_0x1f9859,'request\x20sent',JSON[_0x8e01('0xf')](_0x332565));if(_0x332565[_0x8e01('0x10')]){if(_0x332565['error'][_0x8e01('0x11')]===0x1f4){logger[_0x8e01('0x10')](_0x8e01('0xc'),_0x1f9859,_0x332565[_0x8e01('0x10')][_0x8e01('0x12')]);return _0x57f93f(_0x332565[_0x8e01('0x10')][_0x8e01('0x12')]);}logger[_0x8e01('0x10')](_0x8e01('0xc'),_0x1f9859,_0x332565['error'][_0x8e01('0x12')]);return _0x37be1d(_0x332565[_0x8e01('0x10')][_0x8e01('0x12')]);}else{logger[_0x8e01('0xb')](_0x8e01('0xc'),_0x1f9859,_0x8e01('0x13'));_0x37be1d(_0x332565[_0x8e01('0x14')][_0x8e01('0x12')]);}})[_0x8e01('0x15')](function(_0x486168){logger[_0x8e01('0x10')](_0x8e01('0xc'),_0x1f9859,_0x486168);_0x57f93f(_0x486168);});});} \ No newline at end of file +var _0xdcce=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x78a7f8,_0x55bafd){var _0x132e7c=function(_0x57d9d8){while(--_0x57d9d8){_0x78a7f8['push'](_0x78a7f8['shift']());}};_0x132e7c(++_0x55bafd);}(_0xdcce,0x140));var _0xedcc=function(_0x9eaf72,_0x4455b0){_0x9eaf72=_0x9eaf72-0x0;var _0x115600=_0xdcce[_0x9eaf72];return _0x115600;};'use strict';var _=require(_0xedcc('0x0'));var util=require(_0xedcc('0x1'));var moment=require(_0xedcc('0x2'));var BPromise=require(_0xedcc('0x3'));var rs=require(_0xedcc('0x4'));var fs=require('fs');var Redis=require(_0xedcc('0x5'));var db=require(_0xedcc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xedcc('0x7'))(_0xedcc('0x8'));var config=require(_0xedcc('0x9'));var jayson=require(_0xedcc('0xa'));var client=jayson[_0xedcc('0xb')][_0xedcc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b5a74,_0x1ebefc,_0x140372){return new BPromise(function(_0x36b860,_0x2b4539){return client[_0xedcc('0xd')](_0x1b5a74,_0x140372)['then'](function(_0x3e45cb){logger[_0xedcc('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x1ebefc,_0xedcc('0xf'));logger['debug'](_0xedcc('0x10'),_0x1ebefc,_0xedcc('0xf'),JSON[_0xedcc('0x11')](_0x3e45cb));if(_0x3e45cb[_0xedcc('0x12')]){if(_0x3e45cb['error'][_0xedcc('0x13')]===0x1f4){logger[_0xedcc('0x12')](_0xedcc('0x14'),_0x1ebefc,_0x3e45cb[_0xedcc('0x12')][_0xedcc('0x15')]);return _0x2b4539(_0x3e45cb[_0xedcc('0x12')][_0xedcc('0x15')]);}logger[_0xedcc('0x12')](_0xedcc('0x14'),_0x1ebefc,_0x3e45cb[_0xedcc('0x12')][_0xedcc('0x15')]);return _0x36b860(_0x3e45cb[_0xedcc('0x12')][_0xedcc('0x15')]);}else{logger[_0xedcc('0xe')](_0xedcc('0x14'),_0x1ebefc,_0xedcc('0xf'));_0x36b860(_0x3e45cb[_0xedcc('0x16')][_0xedcc('0x15')]);}})[_0xedcc('0x17')](function(_0x5e88ff){logger[_0xedcc('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1ebefc,_0x5e88ff);_0x2b4539(_0x5e88ff);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 98a3adf..775ee25 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 _0x14ba=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x14ba,0x155));var _0xa14b=function(_0x55feef,_0x4ba37b){_0x55feef=_0x55feef-0x0;var _0x3613f5=_0x14ba[_0x55feef];return _0x3613f5;};'use strict';var multer=require(_0xa14b('0x0'));var util=require(_0xa14b('0x1'));var path=require(_0xa14b('0x2'));var timeout=require(_0xa14b('0x3'));var express=require(_0xa14b('0x4'));var router=express[_0xa14b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa14b('0x6'));var interaction=require(_0xa14b('0x7'));var config=require(_0xa14b('0x8'));var controller=require('./intVtigerField.controller');router[_0xa14b('0x9')]('/',auth[_0xa14b('0xa')](),controller[_0xa14b('0xb')]);router['get']('/:id',auth[_0xa14b('0xa')](),controller[_0xa14b('0xc')]);router[_0xa14b('0xd')]('/',auth[_0xa14b('0xa')](),controller[_0xa14b('0xe')]);router[_0xa14b('0xf')](_0xa14b('0x10'),auth[_0xa14b('0xa')](),controller['update']);router[_0xa14b('0x11')](_0xa14b('0x10'),auth[_0xa14b('0xa')](),controller[_0xa14b('0x12')]);module[_0xa14b('0x13')]=router; \ No newline at end of file +var _0x900e=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x900e,0x151));var _0xe900=function(_0x236470,_0x752a84){_0x236470=_0x236470-0x0;var _0x2b858d=_0x900e[_0x236470];return _0x2b858d;};'use strict';var multer=require(_0xe900('0x0'));var util=require(_0xe900('0x1'));var path=require(_0xe900('0x2'));var timeout=require(_0xe900('0x3'));var express=require('express');var router=express[_0xe900('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe900('0x5'));var interaction=require(_0xe900('0x6'));var config=require(_0xe900('0x7'));var controller=require('./intVtigerField.controller');router[_0xe900('0x8')]('/',auth['isAuthenticated'](),controller[_0xe900('0x9')]);router['get']('/:id',auth[_0xe900('0xa')](),controller[_0xe900('0xb')]);router[_0xe900('0xc')]('/',auth[_0xe900('0xa')](),controller[_0xe900('0xd')]);router[_0xe900('0xe')](_0xe900('0xf'),auth[_0xe900('0xa')](),controller[_0xe900('0x10')]);router[_0xe900('0x11')](_0xe900('0xf'),auth[_0xe900('0xa')](),controller[_0xe900('0x12')]);module[_0xe900('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c0e6d2d..6c7fb81 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 _0xa73c=['string','STRING','ENUM','variable','customVariable','picklist'];(function(_0x3346ab,_0x510953){var _0x5583fb=function(_0x4b96d4){while(--_0x4b96d4){_0x3346ab['push'](_0x3346ab['shift']());}};_0x5583fb(++_0x510953);}(_0xa73c,0x1ac));var _0xca73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa73c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xca73('0x0')]('string',_0xca73('0x1'),_0xca73('0x2'),'keyValue',_0xca73('0x3')),'defaultValue':_0xca73('0x4')},'content':{'type':Sequelize[_0xca73('0x5')]},'key':{'type':Sequelize[_0xca73('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xca73('0x4'),_0xca73('0x1'),_0xca73('0x2'))},'keyContent':{'type':Sequelize[_0xca73('0x5')]},'idField':{'type':Sequelize[_0xca73('0x5')]},'nameField':{'type':Sequelize[_0xca73('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdf2e=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string'];(function(_0x3ede55,_0x5cdf58){var _0xd1894b=function(_0x3ebb9c){while(--_0x3ebb9c){_0x3ede55['push'](_0x3ede55['shift']());}};_0xd1894b(++_0x5cdf58);}(_0xdf2e,0xbd));var _0xedf2=function(_0x3311ae,_0x362cee){_0x3311ae=_0x3311ae-0x0;var _0x107949=_0xdf2e[_0x3311ae];return _0x107949;};'use strict';var Sequelize=require(_0xedf2('0x0'));module[_0xedf2('0x1')]={'type':{'type':Sequelize[_0xedf2('0x2')]('string',_0xedf2('0x3'),_0xedf2('0x4'),_0xedf2('0x5'),_0xedf2('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xedf2('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xedf2('0x2')](_0xedf2('0x8'),'variable',_0xedf2('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xedf2('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xedf2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f29aab3..f685cf6 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 _0xf581=['order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerField','include','findAll','catch','params','intersection','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty'];(function(_0x4ab676,_0x4dcc2e){var _0x132883=function(_0x360fb9){while(--_0x360fb9){_0x4ab676['push'](_0x4ab676['shift']());}};_0x132883(++_0x4dcc2e);}(_0xf581,0xf0));var _0x1f58=function(_0x45b155,_0x5c82b3){_0x45b155=_0x45b155-0x0;var _0xe6b8f5=_0xf581[_0x45b155];return _0xe6b8f5;};'use strict';var emlformat=require(_0x1f58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f58('0x1'));var jsonpatch=require(_0x1f58('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f58('0x3'));var Mustache=require(_0x1f58('0x4'));var util=require(_0x1f58('0x5'));var path=require(_0x1f58('0x6'));var sox=require(_0x1f58('0x7'));var csv=require(_0x1f58('0x8'));var ejs=require(_0x1f58('0x9'));var fs=require('fs');var fs_extra=require(_0x1f58('0xa'));var _=require('lodash');var squel=require(_0x1f58('0xb'));var crypto=require(_0x1f58('0xc'));var jsforce=require(_0x1f58('0xd'));var deskjs=require(_0x1f58('0xe'));var toCsv=require(_0x1f58('0x8'));var querystring=require(_0x1f58('0xf'));var Papa=require(_0x1f58('0x10'));var Redis=require('ioredis');var authService=require(_0x1f58('0x11'));var qs=require(_0x1f58('0x12'));var as=require(_0x1f58('0x13'));var hardwareService=require(_0x1f58('0x14'));var logger=require(_0x1f58('0x15'))('api');var utils=require(_0x1f58('0x16'));var config=require(_0x1f58('0x17'));var licenseUtil=require(_0x1f58('0x18'));var db=require(_0x1f58('0x19'))['db'];function respondWithStatusCode(_0x44323b,_0x147a20){_0x147a20=_0x147a20||0xcc;return function(_0x59d5a8){if(_0x59d5a8){return _0x44323b[_0x1f58('0x1a')](_0x147a20);}return _0x44323b[_0x1f58('0x1b')](_0x147a20)[_0x1f58('0x1c')]();};}function respondWithResult(_0x46e51c,_0x441237){_0x441237=_0x441237||0xc8;return function(_0xa9c5cd){if(_0xa9c5cd){return _0x46e51c[_0x1f58('0x1b')](_0x441237)['json'](_0xa9c5cd);}};}function respondWithFilteredResult(_0x2fd8b3,_0x5d90d9){return function(_0x27fdba){if(_0x27fdba){var _0x5a7b47=typeof _0x5d90d9[_0x1f58('0x1d')]===_0x1f58('0x1e')&&typeof _0x5d90d9[_0x1f58('0x1f')]===_0x1f58('0x1e');var _0x56df5c=_0x27fdba[_0x1f58('0x20')];var _0x59a886=_0x5a7b47?0x0:_0x5d90d9['offset'];var _0x5621f2=_0x5a7b47?_0x27fdba[_0x1f58('0x20')]:_0x5d90d9['offset']+_0x5d90d9[_0x1f58('0x1f')];var _0x12d42c;if(_0x5621f2>=_0x56df5c){_0x5621f2=_0x56df5c;_0x12d42c=0xc8;}else{_0x12d42c=0xce;}_0x2fd8b3[_0x1f58('0x1b')](_0x12d42c);return _0x2fd8b3[_0x1f58('0x21')]('Content-Range',_0x59a886+'-'+_0x5621f2+'/'+_0x56df5c)[_0x1f58('0x22')](_0x27fdba);}return null;};}function patchUpdates(_0x2a4bb4){return function(_0x57be44){try{jsonpatch['apply'](_0x57be44,_0x2a4bb4,!![]);}catch(_0x5a1326){return BPromise[_0x1f58('0x23')](_0x5a1326);}return _0x57be44[_0x1f58('0x24')]();};}function saveUpdates(_0x3efd48,_0x3627f3){return function(_0x369913){if(_0x369913){return _0x369913[_0x1f58('0x25')](_0x3efd48)[_0x1f58('0x26')](function(_0x4ffa22){return _0x4ffa22;});}return null;};}function removeEntity(_0x16491b,_0x21621e){return function(_0x31740f){if(_0x31740f){return _0x31740f[_0x1f58('0x27')]()[_0x1f58('0x26')](function(){_0x16491b[_0x1f58('0x1b')](0xcc)[_0x1f58('0x1c')]();});}};}function handleEntityNotFound(_0x445a4c,_0x2d87ef){return function(_0x4206a5){if(!_0x4206a5){_0x445a4c[_0x1f58('0x1a')](0x194);}return _0x4206a5;};}function handleError(_0x3fecb6,_0x3e0d93){_0x3e0d93=_0x3e0d93||0x1f4;return function(_0x2a99e9){logger[_0x1f58('0x28')](_0x2a99e9[_0x1f58('0x29')]);if(_0x2a99e9['name']){delete _0x2a99e9[_0x1f58('0x2a')];}_0x3fecb6[_0x1f58('0x1b')](_0x3e0d93)[_0x1f58('0x2b')](_0x2a99e9);};}exports['index']=function(_0xafd496,_0x1603e3){var _0x4695cf={},_0xde3d5b={},_0x277d63={'count':0x0,'rows':[]};var _0x3c3bc3=_[_0x1f58('0x2c')](db['VtigerField'][_0x1f58('0x2d')],function(_0x4c76a8){return{'name':_0x4c76a8['fieldName'],'type':_0x4c76a8[_0x1f58('0x2e')][_0x1f58('0x2f')]};});_0xde3d5b[_0x1f58('0x30')]=_[_0x1f58('0x2c')](_0x3c3bc3,_0x1f58('0x2a'));_0xde3d5b[_0x1f58('0x31')]=_[_0x1f58('0x32')](_0xafd496[_0x1f58('0x31')]);_0xde3d5b[_0x1f58('0x33')]=_['intersection'](_0xde3d5b[_0x1f58('0x30')],_0xde3d5b[_0x1f58('0x31')]);_0x4695cf[_0x1f58('0x34')]=_['intersection'](_0xde3d5b['model'],qs[_0x1f58('0x35')](_0xafd496['query'][_0x1f58('0x35')]));_0x4695cf[_0x1f58('0x34')]=_0x4695cf[_0x1f58('0x34')][_0x1f58('0x36')]?_0x4695cf[_0x1f58('0x34')]:_0xde3d5b[_0x1f58('0x30')];if(!_0xafd496[_0x1f58('0x31')][_0x1f58('0x37')]('nolimit')){_0x4695cf[_0x1f58('0x1f')]=qs[_0x1f58('0x1f')](_0xafd496[_0x1f58('0x31')][_0x1f58('0x1f')]);_0x4695cf['offset']=qs[_0x1f58('0x1d')](_0xafd496[_0x1f58('0x31')][_0x1f58('0x1d')]);}_0x4695cf[_0x1f58('0x38')]=qs[_0x1f58('0x39')](_0xafd496[_0x1f58('0x31')]['sort']);_0x4695cf[_0x1f58('0x3a')]=qs['filters'](_[_0x1f58('0x3b')](_0xafd496['query'],_0xde3d5b[_0x1f58('0x33')]),_0x3c3bc3);if(_0xafd496[_0x1f58('0x31')][_0x1f58('0x3c')]){_0x4695cf[_0x1f58('0x3a')]=_[_0x1f58('0x3d')](_0x4695cf[_0x1f58('0x3a')],{'$or':_[_0x1f58('0x2c')](_0x3c3bc3,function(_0x32eba2){if(_0x32eba2[_0x1f58('0x2e')]!==_0x1f58('0x3e')){var _0x22a513={};_0x22a513[_0x32eba2[_0x1f58('0x2a')]]={'$like':'%'+_0xafd496[_0x1f58('0x31')][_0x1f58('0x3c')]+'%'};return _0x22a513;}})});}_0x4695cf=_['merge']({},_0x4695cf,_0xafd496[_0x1f58('0x3f')]);var _0x817d81={'where':_0x4695cf[_0x1f58('0x3a')]};return db[_0x1f58('0x40')]['count'](_0x817d81)['then'](function(_0x40e58d){_0x277d63['count']=_0x40e58d;if(_0xafd496[_0x1f58('0x31')]['includeAll']){_0x4695cf[_0x1f58('0x41')]=[{'all':!![]}];}return db[_0x1f58('0x40')][_0x1f58('0x42')](_0x4695cf);})[_0x1f58('0x26')](function(_0x2c03a5){_0x277d63['rows']=_0x2c03a5;return _0x277d63;})['then'](respondWithFilteredResult(_0x1603e3,_0x4695cf))[_0x1f58('0x43')](handleError(_0x1603e3,null));};exports['show']=function(_0x50be50,_0x584463){var _0x584a4d={'raw':!![],'where':{'id':_0x50be50[_0x1f58('0x44')]['id']}},_0x402276={};_0x402276['model']=_[_0x1f58('0x32')](db[_0x1f58('0x40')]['rawAttributes']);_0x402276[_0x1f58('0x31')]=_[_0x1f58('0x32')](_0x50be50[_0x1f58('0x31')]);_0x402276[_0x1f58('0x33')]=_[_0x1f58('0x45')](_0x402276[_0x1f58('0x30')],_0x402276[_0x1f58('0x31')]);_0x584a4d[_0x1f58('0x34')]=_[_0x1f58('0x45')](_0x402276[_0x1f58('0x30')],qs[_0x1f58('0x35')](_0x50be50[_0x1f58('0x31')][_0x1f58('0x35')]));_0x584a4d[_0x1f58('0x34')]=_0x584a4d[_0x1f58('0x34')][_0x1f58('0x36')]?_0x584a4d['attributes']:_0x402276['model'];if(_0x50be50[_0x1f58('0x31')][_0x1f58('0x46')]){_0x584a4d[_0x1f58('0x41')]=[{'all':!![]}];}_0x584a4d=_[_0x1f58('0x3d')]({},_0x584a4d,_0x50be50[_0x1f58('0x3f')]);return db['VtigerField']['find'](_0x584a4d)[_0x1f58('0x26')](handleEntityNotFound(_0x584463,null))[_0x1f58('0x26')](respondWithResult(_0x584463,null))[_0x1f58('0x43')](handleError(_0x584463,null));};exports[_0x1f58('0x47')]=function(_0x4903b4,_0x5c9fc7){return db[_0x1f58('0x40')][_0x1f58('0x47')](_0x4903b4['body'],{})['then'](respondWithResult(_0x5c9fc7,0xc9))['catch'](handleError(_0x5c9fc7,null));};exports[_0x1f58('0x25')]=function(_0x273c54,_0x5df04c){if(_0x273c54[_0x1f58('0x48')]['id']){delete _0x273c54[_0x1f58('0x48')]['id'];}return db[_0x1f58('0x40')][_0x1f58('0x49')]({'where':{'id':_0x273c54['params']['id']}})[_0x1f58('0x26')](handleEntityNotFound(_0x5df04c,null))[_0x1f58('0x26')](saveUpdates(_0x273c54['body'],null))[_0x1f58('0x26')](respondWithResult(_0x5df04c,null))['catch'](handleError(_0x5df04c,null));};exports[_0x1f58('0x27')]=function(_0x1f2497,_0x688b4b){return db[_0x1f58('0x40')][_0x1f58('0x49')]({'where':{'id':_0x1f2497[_0x1f58('0x44')]['id']}})['then'](handleEntityNotFound(_0x688b4b,null))['then'](removeEntity(_0x688b4b,null))[_0x1f58('0x43')](handleError(_0x688b4b,null));}; \ No newline at end of file +var _0x1e62=['index','map','VtigerField','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','name'];(function(_0xbd458f,_0x2bc521){var _0x215db0=function(_0x41d4db){while(--_0x41d4db){_0xbd458f['push'](_0xbd458f['shift']());}};_0x215db0(++_0x2bc521);}(_0x1e62,0xba));var _0x21e6=function(_0x5aa181,_0x12b4ca){_0x5aa181=_0x5aa181-0x0;var _0x5a6b54=_0x1e62[_0x5aa181];return _0x5a6b54;};'use strict';var emlformat=require(_0x21e6('0x0'));var rimraf=require(_0x21e6('0x1'));var zipdir=require(_0x21e6('0x2'));var jsonpatch=require(_0x21e6('0x3'));var rp=require(_0x21e6('0x4'));var moment=require(_0x21e6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x21e6('0x6'));var util=require(_0x21e6('0x7'));var path=require(_0x21e6('0x8'));var sox=require(_0x21e6('0x9'));var csv=require(_0x21e6('0xa'));var ejs=require(_0x21e6('0xb'));var fs=require('fs');var fs_extra=require(_0x21e6('0xc'));var _=require(_0x21e6('0xd'));var squel=require(_0x21e6('0xe'));var crypto=require(_0x21e6('0xf'));var jsforce=require(_0x21e6('0x10'));var deskjs=require(_0x21e6('0x11'));var toCsv=require(_0x21e6('0xa'));var querystring=require('querystring');var Papa=require(_0x21e6('0x12'));var Redis=require(_0x21e6('0x13'));var authService=require(_0x21e6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x21e6('0x15'));var hardwareService=require(_0x21e6('0x16'));var logger=require('../../config/logger')(_0x21e6('0x17'));var utils=require(_0x21e6('0x18'));var config=require(_0x21e6('0x19'));var licenseUtil=require(_0x21e6('0x1a'));var db=require(_0x21e6('0x1b'))['db'];function respondWithStatusCode(_0x2066e1,_0x1f31da){_0x1f31da=_0x1f31da||0xcc;return function(_0x300916){if(_0x300916){return _0x2066e1[_0x21e6('0x1c')](_0x1f31da);}return _0x2066e1[_0x21e6('0x1d')](_0x1f31da)['end']();};}function respondWithResult(_0x148e80,_0x58192a){_0x58192a=_0x58192a||0xc8;return function(_0x2aeac1){if(_0x2aeac1){return _0x148e80[_0x21e6('0x1d')](_0x58192a)[_0x21e6('0x1e')](_0x2aeac1);}};}function respondWithFilteredResult(_0x27510e,_0x5ad25a){return function(_0x26fafa){if(_0x26fafa){var _0xb4e3ea=typeof _0x5ad25a[_0x21e6('0x1f')]===_0x21e6('0x20')&&typeof _0x5ad25a[_0x21e6('0x21')]==='undefined';var _0x111d62=_0x26fafa[_0x21e6('0x22')];var _0x53460e=_0xb4e3ea?0x0:_0x5ad25a['offset'];var _0x57920d=_0xb4e3ea?_0x26fafa['count']:_0x5ad25a[_0x21e6('0x1f')]+_0x5ad25a['limit'];var _0xd52c9c;if(_0x57920d>=_0x111d62){_0x57920d=_0x111d62;_0xd52c9c=0xc8;}else{_0xd52c9c=0xce;}_0x27510e[_0x21e6('0x1d')](_0xd52c9c);return _0x27510e[_0x21e6('0x23')]('Content-Range',_0x53460e+'-'+_0x57920d+'/'+_0x111d62)['json'](_0x26fafa);}return null;};}function patchUpdates(_0x3f8a50){return function(_0x6afdf1){try{jsonpatch[_0x21e6('0x24')](_0x6afdf1,_0x3f8a50,!![]);}catch(_0x577047){return BPromise[_0x21e6('0x25')](_0x577047);}return _0x6afdf1[_0x21e6('0x26')]();};}function saveUpdates(_0x1475a9,_0x3275b9){return function(_0xbdf74d){if(_0xbdf74d){return _0xbdf74d['update'](_0x1475a9)[_0x21e6('0x27')](function(_0x32fd08){return _0x32fd08;});}return null;};}function removeEntity(_0x187c33,_0x40b3f3){return function(_0x1326a6){if(_0x1326a6){return _0x1326a6[_0x21e6('0x28')]()[_0x21e6('0x27')](function(){_0x187c33[_0x21e6('0x1d')](0xcc)[_0x21e6('0x29')]();});}};}function handleEntityNotFound(_0x473639,_0x2814f0){return function(_0x43f668){if(!_0x43f668){_0x473639[_0x21e6('0x1c')](0x194);}return _0x43f668;};}function handleError(_0x4dfa09,_0x33004d){_0x33004d=_0x33004d||0x1f4;return function(_0x4e46a6){logger[_0x21e6('0x2a')](_0x4e46a6[_0x21e6('0x2b')]);if(_0x4e46a6[_0x21e6('0x2c')]){delete _0x4e46a6[_0x21e6('0x2c')];}_0x4dfa09[_0x21e6('0x1d')](_0x33004d)['send'](_0x4e46a6);};}exports[_0x21e6('0x2d')]=function(_0x1b02df,_0x3b419a){var _0x351e1c={},_0x20532c={},_0x987604={'count':0x0,'rows':[]};var _0x5732e4=_[_0x21e6('0x2e')](db[_0x21e6('0x2f')][_0x21e6('0x30')],function(_0x187e34){return{'name':_0x187e34['fieldName'],'type':_0x187e34[_0x21e6('0x31')]['key']};});_0x20532c[_0x21e6('0x32')]=_[_0x21e6('0x2e')](_0x5732e4,'name');_0x20532c[_0x21e6('0x33')]=_[_0x21e6('0x34')](_0x1b02df[_0x21e6('0x33')]);_0x20532c[_0x21e6('0x35')]=_[_0x21e6('0x36')](_0x20532c[_0x21e6('0x32')],_0x20532c[_0x21e6('0x33')]);_0x351e1c[_0x21e6('0x37')]=_[_0x21e6('0x36')](_0x20532c[_0x21e6('0x32')],qs[_0x21e6('0x38')](_0x1b02df['query'][_0x21e6('0x38')]));_0x351e1c[_0x21e6('0x37')]=_0x351e1c[_0x21e6('0x37')][_0x21e6('0x39')]?_0x351e1c[_0x21e6('0x37')]:_0x20532c[_0x21e6('0x32')];if(!_0x1b02df[_0x21e6('0x33')][_0x21e6('0x3a')](_0x21e6('0x3b'))){_0x351e1c[_0x21e6('0x21')]=qs[_0x21e6('0x21')](_0x1b02df['query'][_0x21e6('0x21')]);_0x351e1c[_0x21e6('0x1f')]=qs['offset'](_0x1b02df[_0x21e6('0x33')][_0x21e6('0x1f')]);}_0x351e1c[_0x21e6('0x3c')]=qs[_0x21e6('0x3d')](_0x1b02df[_0x21e6('0x33')][_0x21e6('0x3d')]);_0x351e1c[_0x21e6('0x3e')]=qs[_0x21e6('0x35')](_[_0x21e6('0x3f')](_0x1b02df[_0x21e6('0x33')],_0x20532c[_0x21e6('0x35')]),_0x5732e4);if(_0x1b02df[_0x21e6('0x33')][_0x21e6('0x40')]){_0x351e1c[_0x21e6('0x3e')]=_[_0x21e6('0x41')](_0x351e1c[_0x21e6('0x3e')],{'$or':_[_0x21e6('0x2e')](_0x5732e4,function(_0x2c7b6a){if(_0x2c7b6a[_0x21e6('0x31')]!==_0x21e6('0x42')){var _0x565c20={};_0x565c20[_0x2c7b6a[_0x21e6('0x2c')]]={'$like':'%'+_0x1b02df['query'][_0x21e6('0x40')]+'%'};return _0x565c20;}})});}_0x351e1c=_['merge']({},_0x351e1c,_0x1b02df[_0x21e6('0x43')]);var _0xbb2d4e={'where':_0x351e1c[_0x21e6('0x3e')]};return db['VtigerField']['count'](_0xbb2d4e)[_0x21e6('0x27')](function(_0x99ddc){_0x987604[_0x21e6('0x22')]=_0x99ddc;if(_0x1b02df['query']['includeAll']){_0x351e1c[_0x21e6('0x44')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x351e1c);})[_0x21e6('0x27')](function(_0x138820){_0x987604['rows']=_0x138820;return _0x987604;})[_0x21e6('0x27')](respondWithFilteredResult(_0x3b419a,_0x351e1c))[_0x21e6('0x45')](handleError(_0x3b419a,null));};exports[_0x21e6('0x46')]=function(_0x4d7112,_0x4a41ee){var _0xb682de={'raw':!![],'where':{'id':_0x4d7112[_0x21e6('0x47')]['id']}},_0x473471={};_0x473471[_0x21e6('0x32')]=_['keys'](db['VtigerField']['rawAttributes']);_0x473471[_0x21e6('0x33')]=_[_0x21e6('0x34')](_0x4d7112[_0x21e6('0x33')]);_0x473471[_0x21e6('0x35')]=_[_0x21e6('0x36')](_0x473471[_0x21e6('0x32')],_0x473471[_0x21e6('0x33')]);_0xb682de['attributes']=_[_0x21e6('0x36')](_0x473471[_0x21e6('0x32')],qs['fields'](_0x4d7112[_0x21e6('0x33')][_0x21e6('0x38')]));_0xb682de[_0x21e6('0x37')]=_0xb682de[_0x21e6('0x37')][_0x21e6('0x39')]?_0xb682de['attributes']:_0x473471[_0x21e6('0x32')];if(_0x4d7112[_0x21e6('0x33')][_0x21e6('0x48')]){_0xb682de[_0x21e6('0x44')]=[{'all':!![]}];}_0xb682de=_[_0x21e6('0x41')]({},_0xb682de,_0x4d7112[_0x21e6('0x43')]);return db[_0x21e6('0x2f')]['find'](_0xb682de)['then'](handleEntityNotFound(_0x4a41ee,null))['then'](respondWithResult(_0x4a41ee,null))[_0x21e6('0x45')](handleError(_0x4a41ee,null));};exports[_0x21e6('0x49')]=function(_0x3d2ca5,_0x1cd10b){return db[_0x21e6('0x2f')][_0x21e6('0x49')](_0x3d2ca5[_0x21e6('0x4a')],{})['then'](respondWithResult(_0x1cd10b,0xc9))[_0x21e6('0x45')](handleError(_0x1cd10b,null));};exports[_0x21e6('0x4b')]=function(_0x3ee5cc,_0x269f29){if(_0x3ee5cc[_0x21e6('0x4a')]['id']){delete _0x3ee5cc[_0x21e6('0x4a')]['id'];}return db['VtigerField'][_0x21e6('0x4c')]({'where':{'id':_0x3ee5cc[_0x21e6('0x47')]['id']}})['then'](handleEntityNotFound(_0x269f29,null))[_0x21e6('0x27')](saveUpdates(_0x3ee5cc[_0x21e6('0x4a')],null))[_0x21e6('0x27')](respondWithResult(_0x269f29,null))[_0x21e6('0x45')](handleError(_0x269f29,null));};exports[_0x21e6('0x28')]=function(_0x2ea43c,_0x5caf79){return db[_0x21e6('0x2f')]['find']({'where':{'id':_0x2ea43c[_0x21e6('0x47')]['id']}})[_0x21e6('0x27')](handleEntityNotFound(_0x5caf79,null))[_0x21e6('0x27')](removeEntity(_0x5caf79,null))[_0x21e6('0x45')](handleError(_0x5caf79,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 4088710..884f29a 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 _0x3f13=['FieldId','util','../../config/logger','moment','bluebird','rimraf','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x315fdb,_0x52e0c2){var _0x51c22c=function(_0x3ff26f){while(--_0x3ff26f){_0x315fdb['push'](_0x315fdb['shift']());}};_0x51c22c(++_0x52e0c2);}(_0x3f13,0x12d));var _0x33f1=function(_0x172315,_0x42abfc){_0x172315=_0x172315-0x0;var _0x20550c=_0x3f13[_0x172315];return _0x20550c;};'use strict';var _=require('lodash');var util=require(_0x33f1('0x0'));var logger=require(_0x33f1('0x1'))('api');var moment=require(_0x33f1('0x2'));var BPromise=require(_0x33f1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x33f1('0x4'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x33f1('0x5')]=function(_0x2498d9,_0x2224fc){return _0x2498d9[_0x33f1('0x6')](_0x33f1('0x7'),attributes,{'tableName':_0x33f1('0x8'),'paranoid':![],'indexes':[{'name':_0x33f1('0x9'),'fields':[_0x33f1('0xa'),_0x33f1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9919=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0x7880d2,_0x32e7d6){var _0x35ebbe=function(_0x5c27fa){while(--_0x5c27fa){_0x7880d2['push'](_0x7880d2['shift']());}};_0x35ebbe(++_0x32e7d6);}(_0x9919,0x114));var _0x9991=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x9919[_0x28edda];return _0x21f4a4;};'use strict';var _=require(_0x9991('0x0'));var util=require('util');var logger=require(_0x9991('0x1'))(_0x9991('0x2'));var moment=require(_0x9991('0x3'));var BPromise=require(_0x9991('0x4'));var rp=require(_0x9991('0x5'));var fs=require('fs');var path=require(_0x9991('0x6'));var rimraf=require(_0x9991('0x7'));var config=require('../../config/environment');var attributes=require(_0x9991('0x8'));module[_0x9991('0x9')]=function(_0xb35c68,_0x3f2251){return _0xb35c68[_0x9991('0xa')](_0x9991('0xb'),attributes,{'tableName':_0x9991('0xc'),'paranoid':![],'indexes':[{'name':_0x9991('0xd'),'fields':[_0x9991('0xe'),_0x9991('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 82a0743..fdcd247 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 _0xfd01=['then','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2f0211,_0x4f7b4e){var _0x4f5cf8=function(_0xb1bbf5){while(--_0xb1bbf5){_0x2f0211['push'](_0x2f0211['shift']());}};_0x4f5cf8(++_0x4f7b4e);}(_0xfd01,0x86));var _0x1fd0=function(_0x3e870b,_0x31c02e){_0x3e870b=_0x3e870b-0x0;var _0x5bfcaa=_0xfd01[_0x3e870b];return _0x5bfcaa;};'use strict';var _=require(_0x1fd0('0x0'));var util=require('util');var moment=require(_0x1fd0('0x1'));var BPromise=require(_0x1fd0('0x2'));var rs=require(_0x1fd0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1fd0('0x4'));var logger=require('../../config/logger')(_0x1fd0('0x5'));var config=require(_0x1fd0('0x6'));var jayson=require(_0x1fd0('0x7'));var client=jayson['client'][_0x1fd0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b6e6f,_0x29d435,_0x3e4be7){return new BPromise(function(_0x1d147c,_0x428716){return client[_0x1fd0('0x9')](_0x2b6e6f,_0x3e4be7)[_0x1fd0('0xa')](function(_0x29068a){logger['info'](_0x1fd0('0xb'),_0x29d435,'request\x20sent');logger[_0x1fd0('0xc')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x29d435,_0x1fd0('0xd'),JSON[_0x1fd0('0xe')](_0x29068a));if(_0x29068a[_0x1fd0('0xf')]){if(_0x29068a['error']['code']===0x1f4){logger[_0x1fd0('0xf')]('VtigerField,\x20%s,\x20%s',_0x29d435,_0x29068a['error'][_0x1fd0('0x10')]);return _0x428716(_0x29068a[_0x1fd0('0xf')][_0x1fd0('0x10')]);}logger[_0x1fd0('0xf')](_0x1fd0('0xb'),_0x29d435,_0x29068a[_0x1fd0('0xf')][_0x1fd0('0x10')]);return _0x1d147c(_0x29068a[_0x1fd0('0xf')][_0x1fd0('0x10')]);}else{logger['info'](_0x1fd0('0xb'),_0x29d435,'request\x20sent');_0x1d147c(_0x29068a[_0x1fd0('0x11')][_0x1fd0('0x10')]);}})['catch'](function(_0x28dff9){logger[_0x1fd0('0xf')](_0x1fd0('0xb'),_0x29d435,_0x28dff9);_0x428716(_0x28dff9);});});} \ No newline at end of file +var _0xb252=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x9eb245,_0x36224f){var _0x34435b=function(_0x17ad48){while(--_0x17ad48){_0x9eb245['push'](_0x9eb245['shift']());}};_0x34435b(++_0x36224f);}(_0xb252,0x13d));var _0x2b25=function(_0x52200f,_0x5abfef){_0x52200f=_0x52200f-0x0;var _0x39a245=_0xb252[_0x52200f];return _0x39a245;};'use strict';var _=require(_0x2b25('0x0'));var util=require(_0x2b25('0x1'));var moment=require(_0x2b25('0x2'));var BPromise=require(_0x2b25('0x3'));var rs=require(_0x2b25('0x4'));var fs=require('fs');var Redis=require(_0x2b25('0x5'));var db=require(_0x2b25('0x6'))['db'];var utils=require(_0x2b25('0x7'));var logger=require('../../config/logger')(_0x2b25('0x8'));var config=require('../../config/environment');var jayson=require(_0x2b25('0x9'));var client=jayson['client'][_0x2b25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265bb3,_0x2ac9d3,_0xb3999){return new BPromise(function(_0x232140,_0x2a60ef){return client['request'](_0x265bb3,_0xb3999)[_0x2b25('0xb')](function(_0x28a198){logger['info']('VtigerField,\x20%s,\x20%s',_0x2ac9d3,_0x2b25('0xc'));logger[_0x2b25('0xd')](_0x2b25('0xe'),_0x2ac9d3,_0x2b25('0xc'),JSON[_0x2b25('0xf')](_0x28a198));if(_0x28a198['error']){if(_0x28a198[_0x2b25('0x10')][_0x2b25('0x11')]===0x1f4){logger['error'](_0x2b25('0x12'),_0x2ac9d3,_0x28a198[_0x2b25('0x10')][_0x2b25('0x13')]);return _0x2a60ef(_0x28a198[_0x2b25('0x10')][_0x2b25('0x13')]);}logger[_0x2b25('0x10')](_0x2b25('0x12'),_0x2ac9d3,_0x28a198['error'][_0x2b25('0x13')]);return _0x232140(_0x28a198[_0x2b25('0x10')][_0x2b25('0x13')]);}else{logger[_0x2b25('0x14')](_0x2b25('0x12'),_0x2ac9d3,_0x2b25('0xc'));_0x232140(_0x28a198[_0x2b25('0x15')][_0x2b25('0x13')]);}})[_0x2b25('0x16')](function(_0x422bc4){logger[_0x2b25('0x10')](_0x2b25('0x12'),_0x2ac9d3,_0x422bc4);_0x2a60ef(_0x422bc4);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 42e960c..8ad9f8f 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 _0x202a=['get','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','exports','util','path','connect-timeout','Router','../../config/environment','./intZendeskAccount.controller','index','show'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xa202('0x0'));var path=require(_0xa202('0x1'));var timeout=require(_0xa202('0x2'));var express=require('express');var router=express[_0xa202('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa202('0x4'));var controller=require(_0xa202('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xa202('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa202('0x7')]);router[_0xa202('0x8')](_0xa202('0x9'),auth[_0xa202('0xa')](),controller['getConfigurations']);router['get'](_0xa202('0xb'),auth[_0xa202('0xa')](),controller[_0xa202('0xc')]);router[_0xa202('0xd')]('/',auth['isAuthenticated'](),controller[_0xa202('0xe')]);router['post'](_0xa202('0x9'),auth[_0xa202('0xa')](),controller[_0xa202('0xf')]);router['put'](_0xa202('0x10'),auth[_0xa202('0xa')](),controller[_0xa202('0x11')]);router[_0xa202('0x12')](_0xa202('0x10'),auth[_0xa202('0xa')](),controller['destroy']);module[_0xa202('0x13')]=router; \ No newline at end of file +var _0x7697=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','create','post','addConfiguration','/:id','update','delete','destroy','exports','multer'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7697,0x186));var _0x7769=function(_0x470b0a,_0x2889d6){_0x470b0a=_0x470b0a-0x0;var _0x4463f6=_0x7697[_0x470b0a];return _0x4463f6;};'use strict';var multer=require(_0x7769('0x0'));var util=require(_0x7769('0x1'));var path=require(_0x7769('0x2'));var timeout=require(_0x7769('0x3'));var express=require(_0x7769('0x4'));var router=express['Router']();var fs_extra=require(_0x7769('0x5'));var auth=require(_0x7769('0x6'));var interaction=require(_0x7769('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7769('0x8')]);router[_0x7769('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7769('0xa')]);router[_0x7769('0x9')](_0x7769('0xb'),auth[_0x7769('0xc')](),controller[_0x7769('0xd')]);router['get'](_0x7769('0xe'),auth[_0x7769('0xc')](),controller['getFields']);router['post']('/',auth[_0x7769('0xc')](),controller[_0x7769('0xf')]);router[_0x7769('0x10')](_0x7769('0xb'),auth[_0x7769('0xc')](),controller[_0x7769('0x11')]);router['put'](_0x7769('0x12'),auth[_0x7769('0xc')](),controller[_0x7769('0x13')]);router[_0x7769('0x14')](_0x7769('0x12'),auth['isAuthenticated'](),controller[_0x7769('0x15')]);module[_0x7769('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index fca6e7f..948b882 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 _0xeda7=['remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xeda7,0x196));var _0x7eda=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xeda7[_0x5ac84c];return _0x3c53d2;};'use strict';var Sequelize=require(_0x7eda('0x0'));module[_0x7eda('0x1')]={'name':{'type':Sequelize[_0x7eda('0x2')]},'description':{'type':Sequelize[_0x7eda('0x2')]},'username':{'type':Sequelize[_0x7eda('0x2')],'unique':_0x7eda('0x3')},'password':{'type':Sequelize[_0x7eda('0x2')]},'token':{'type':Sequelize[_0x7eda('0x2')]},'remoteUri':{'type':Sequelize[_0x7eda('0x2')],'unique':_0x7eda('0x4')},'authType':{'type':Sequelize[_0x7eda('0x5')](_0x7eda('0x6'),_0x7eda('0x7')),'defaultValue':_0x7eda('0x6')},'serverUrl':{'type':Sequelize[_0x7eda('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7eda('0x5')](_0x7eda('0x8'),_0x7eda('0x9')),'defaultValue':_0x7eda('0x8')}}; \ No newline at end of file +var _0xbd10=['token','newTab','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x4cffd0,_0x43de82){var _0x12ac47=function(_0x1e264f){while(--_0x1e264f){_0x4cffd0['push'](_0x4cffd0['shift']());}};_0x12ac47(++_0x43de82);}(_0xbd10,0x85));var _0x0bd1=function(_0x460b2f,_0x54242a){_0x460b2f=_0x460b2f-0x0;var _0x516d8c=_0xbd10[_0x460b2f];return _0x516d8c;};'use strict';var Sequelize=require(_0x0bd1('0x0'));module[_0x0bd1('0x1')]={'name':{'type':Sequelize[_0x0bd1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0bd1('0x2')],'unique':_0x0bd1('0x3')},'password':{'type':Sequelize[_0x0bd1('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0bd1('0x2')],'unique':_0x0bd1('0x4')},'authType':{'type':Sequelize[_0x0bd1('0x5')](_0x0bd1('0x6'),_0x0bd1('0x7')),'defaultValue':_0x0bd1('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0bd1('0x5')]('integrationTab',_0x0bd1('0x8')),'defaultValue':_0x0bd1('0x9')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6b5d8ca..d49e340 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 _0x5ec6=['Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','findOne','ZendeskConfiguration','length','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers'];(function(_0x5dac1c,_0x1dbb4e){var _0x32d0ac=function(_0x1f6d92){while(--_0x1f6d92){_0x5dac1c['push'](_0x5dac1c['shift']());}};_0x32d0ac(++_0x1dbb4e);}(_0x5ec6,0x7f));var _0x65ec=function(_0x5e5ea1,_0x487a9a){_0x5e5ea1=_0x5e5ea1-0x0;var _0x9589cc=_0x5ec6[_0x5e5ea1];return _0x9589cc;};'use strict';var emlformat=require(_0x65ec('0x0'));var rimraf=require(_0x65ec('0x1'));var zipdir=require(_0x65ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65ec('0x3'));var moment=require('moment');var BPromise=require(_0x65ec('0x4'));var Mustache=require('mustache');var util=require(_0x65ec('0x5'));var path=require('path');var sox=require(_0x65ec('0x6'));var csv=require('to-csv');var ejs=require(_0x65ec('0x7'));var fs=require('fs');var fs_extra=require(_0x65ec('0x8'));var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0xc'));var querystring=require(_0x65ec('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xf'));var hardwareService=require(_0x65ec('0x10'));var logger=require('../../config/logger')(_0x65ec('0x11'));var utils=require(_0x65ec('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x65ec('0x13'));var db=require(_0x65ec('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e52c8,_0x2af7d6){_0x2af7d6=_0x2af7d6||0xcc;return function(_0x411a7b){if(_0x411a7b){return _0x3e52c8[_0x65ec('0x15')](_0x2af7d6);}return _0x3e52c8[_0x65ec('0x16')](_0x2af7d6)[_0x65ec('0x17')]();};}function respondWithResult(_0x344724,_0x3edbfd){_0x3edbfd=_0x3edbfd||0xc8;return function(_0x58c81f){if(_0x58c81f){return _0x344724[_0x65ec('0x16')](_0x3edbfd)[_0x65ec('0x18')](_0x58c81f);}};}function respondWithFilteredResult(_0x35d06b,_0x4bbe88){return function(_0x5a0442){if(_0x5a0442){var _0x25cdd4=typeof _0x4bbe88[_0x65ec('0x19')]===_0x65ec('0x1a')&&typeof _0x4bbe88['limit']===_0x65ec('0x1a');var _0x286eac=_0x5a0442[_0x65ec('0x1b')];var _0xb4ed90=_0x25cdd4?0x0:_0x4bbe88[_0x65ec('0x19')];var _0xd81ed3=_0x25cdd4?_0x5a0442[_0x65ec('0x1b')]:_0x4bbe88[_0x65ec('0x19')]+_0x4bbe88[_0x65ec('0x1c')];var _0x441ad0;if(_0xd81ed3>=_0x286eac){_0xd81ed3=_0x286eac;_0x441ad0=0xc8;}else{_0x441ad0=0xce;}_0x35d06b[_0x65ec('0x16')](_0x441ad0);return _0x35d06b[_0x65ec('0x1d')](_0x65ec('0x1e'),_0xb4ed90+'-'+_0xd81ed3+'/'+_0x286eac)[_0x65ec('0x18')](_0x5a0442);}return null;};}function patchUpdates(_0x3804a4){return function(_0x1d538c){try{jsonpatch[_0x65ec('0x1f')](_0x1d538c,_0x3804a4,!![]);}catch(_0x130d4e){return BPromise[_0x65ec('0x20')](_0x130d4e);}return _0x1d538c['save']();};}function saveUpdates(_0x170703,_0x297fba){return function(_0x89e640){if(_0x89e640){return _0x89e640[_0x65ec('0x21')](_0x170703)[_0x65ec('0x22')](function(_0x163e55){return _0x163e55;});}return null;};}function removeEntity(_0x47288d,_0x58239f){return function(_0xf1ff97){if(_0xf1ff97){return _0xf1ff97[_0x65ec('0x23')]()[_0x65ec('0x22')](function(){_0x47288d[_0x65ec('0x16')](0xcc)[_0x65ec('0x17')]();});}};}function handleEntityNotFound(_0x156793,_0x21426b){return function(_0xf5adc7){if(!_0xf5adc7){_0x156793[_0x65ec('0x15')](0x194);}return _0xf5adc7;};}function handleError(_0x4c846b,_0x10baef){_0x10baef=_0x10baef||0x1f4;return function(_0x30f0cf){logger[_0x65ec('0x24')](_0x30f0cf[_0x65ec('0x25')]);if(_0x30f0cf['name']){delete _0x30f0cf[_0x65ec('0x26')];}_0x4c846b['status'](_0x10baef)[_0x65ec('0x27')](_0x30f0cf);};}exports[_0x65ec('0x28')]=function(_0x1d0b5c,_0x30366c){var _0x14431d={},_0x46d4c1={},_0x46bf66={'count':0x0,'rows':[]};var _0x39410f=_[_0x65ec('0x29')](db[_0x65ec('0x2a')][_0x65ec('0x2b')],function(_0x4b435c){return{'name':_0x4b435c['fieldName'],'type':_0x4b435c[_0x65ec('0x2c')]['key']};});_0x46d4c1[_0x65ec('0x2d')]=_[_0x65ec('0x29')](_0x39410f,'name');_0x46d4c1[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x1d0b5c[_0x65ec('0x2e')]);_0x46d4c1[_0x65ec('0x30')]=_['intersection'](_0x46d4c1[_0x65ec('0x2d')],_0x46d4c1[_0x65ec('0x2e')]);_0x14431d[_0x65ec('0x31')]=_[_0x65ec('0x32')](_0x46d4c1[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x14431d[_0x65ec('0x31')]=_0x14431d[_0x65ec('0x31')]['length']?_0x14431d[_0x65ec('0x31')]:_0x46d4c1[_0x65ec('0x2d')];if(!_0x1d0b5c['query'][_0x65ec('0x34')](_0x65ec('0x35'))){_0x14431d[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x14431d[_0x65ec('0x19')]=qs['offset'](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x19')]);}_0x14431d[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x1d0b5c['query'][_0x65ec('0x37')]);_0x14431d[_0x65ec('0x38')]=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x1d0b5c['query'],_0x46d4c1['filters']),_0x39410f);if(_0x1d0b5c[_0x65ec('0x2e')]['filter']){_0x14431d[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x14431d['where'],{'$or':_[_0x65ec('0x29')](_0x39410f,function(_0x1fbc2b){if(_0x1fbc2b[_0x65ec('0x2c')]!==_0x65ec('0x3b')){var _0x3cffbf={};_0x3cffbf[_0x1fbc2b[_0x65ec('0x26')]]={'$like':'%'+_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x3cffbf;}})});}_0x14431d=_[_0x65ec('0x3a')]({},_0x14431d,_0x1d0b5c[_0x65ec('0x3d')]);var _0x3561ef={'where':_0x14431d['where']};return db[_0x65ec('0x2a')]['count'](_0x3561ef)[_0x65ec('0x22')](function(_0x278d43){_0x46bf66[_0x65ec('0x1b')]=_0x278d43;if(_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x14431d[_0x65ec('0x3f')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x65ec('0x40')](_0x14431d);})['then'](function(_0x5d8d57){_0x46bf66[_0x65ec('0x41')]=_0x5d8d57;return _0x46bf66;})[_0x65ec('0x22')](respondWithFilteredResult(_0x30366c,_0x14431d))[_0x65ec('0x42')](handleError(_0x30366c,null));};exports[_0x65ec('0x43')]=function(_0x1d475e,_0x524235){var _0x4843ca={'raw':![],'where':{'id':_0x1d475e[_0x65ec('0x44')]['id']}},_0x1aef6d={};_0x1aef6d[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x2a')]['rawAttributes']);_0x1aef6d['query']=_[_0x65ec('0x2f')](_0x1d475e[_0x65ec('0x2e')]);_0x1aef6d[_0x65ec('0x30')]=_[_0x65ec('0x32')](_0x1aef6d[_0x65ec('0x2d')],_0x1aef6d[_0x65ec('0x2e')]);_0x4843ca[_0x65ec('0x31')]=_['intersection'](_0x1aef6d[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d475e[_0x65ec('0x2e')]['fields']));_0x4843ca[_0x65ec('0x31')]=_0x4843ca[_0x65ec('0x31')]['length']?_0x4843ca[_0x65ec('0x31')]:_0x1aef6d[_0x65ec('0x2d')];if(_0x1d475e[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x4843ca[_0x65ec('0x3f')]=[{'all':!![]}];}_0x4843ca=_['merge']({},_0x4843ca,_0x1d475e[_0x65ec('0x3d')]);return db[_0x65ec('0x2a')][_0x65ec('0x45')](_0x4843ca)[_0x65ec('0x22')](handleEntityNotFound(_0x524235,null))['then'](respondWithResult(_0x524235,null))[_0x65ec('0x42')](handleError(_0x524235,null));};exports['create']=function(_0x1ed0f9,_0x169890){return db[_0x65ec('0x2a')]['create'](_0x1ed0f9['body'],{})[_0x65ec('0x22')](respondWithResult(_0x169890,0xc9))[_0x65ec('0x42')](handleError(_0x169890,null));};exports[_0x65ec('0x21')]=function(_0x2111af,_0x1b3732){if(_0x2111af[_0x65ec('0x46')]['id']){delete _0x2111af[_0x65ec('0x46')]['id'];}return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x2111af[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x1b3732,null))[_0x65ec('0x22')](saveUpdates(_0x2111af[_0x65ec('0x46')],null))[_0x65ec('0x22')](respondWithResult(_0x1b3732,null))[_0x65ec('0x42')](handleError(_0x1b3732,null));};exports[_0x65ec('0x23')]=function(_0x22c28c,_0x5eb6d3){return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x22c28c['params']['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x5eb6d3,null))[_0x65ec('0x22')](removeEntity(_0x5eb6d3,null))[_0x65ec('0x42')](handleError(_0x5eb6d3,null));};exports['getConfigurations']=function(_0x3eee1e,_0x2b2756,_0x27843b){var _0x50f1c3={};var _0xabb4e3={};var _0x5e5e48;var _0x4c9905;return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x3eee1e[_0x65ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b2756,null))[_0x65ec('0x22')](function(_0x28a686){if(_0x28a686){_0x5e5e48=_0x28a686;_0xabb4e3[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x48')][_0x65ec('0x2b')]);_0xabb4e3[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x3eee1e[_0x65ec('0x2e')]);_0xabb4e3['filters']=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],_0xabb4e3['query']);_0x50f1c3[_0x65ec('0x31')]=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x50f1c3[_0x65ec('0x31')]=_0x50f1c3[_0x65ec('0x31')][_0x65ec('0x49')]?_0x50f1c3['attributes']:_0xabb4e3[_0x65ec('0x2d')];_0x50f1c3[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x37')]);_0x50f1c3['where']=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x3eee1e[_0x65ec('0x2e')],_0xabb4e3[_0x65ec('0x30')]));if(_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]){_0x50f1c3[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x50f1c3['where'],{'$or':_[_0x65ec('0x29')](_0x50f1c3[_0x65ec('0x31')],function(_0x12bb9b){var _0x233b9b={};_0x233b9b[_0x12bb9b]={'$like':'%'+_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x233b9b;})});}_0x50f1c3=_[_0x65ec('0x3a')]({},_0x50f1c3,_0x3eee1e['options']);return _0x5e5e48['getConfigurations'](_0x50f1c3);}})[_0x65ec('0x22')](function(_0x56dd47){if(_0x56dd47){_0x4c9905=_0x56dd47[_0x65ec('0x49')];if(!_0x3eee1e[_0x65ec('0x2e')]['hasOwnProperty'](_0x65ec('0x35'))){_0x50f1c3[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x50f1c3[_0x65ec('0x19')]=qs[_0x65ec('0x19')](_0x3eee1e['query']['offset']);}return _0x5e5e48[_0x65ec('0x4a')](_0x50f1c3);}})[_0x65ec('0x22')](function(_0xd14e5){if(_0xd14e5){return _0xd14e5?{'count':_0x4c9905,'rows':_0xd14e5}:null;}})['then'](respondWithResult(_0x2b2756,null))[_0x65ec('0x42')](handleError(_0x2b2756,null));};exports[_0x65ec('0x4b')]=function(_0x17059d,_0x3d761f,_0x21096d){if(_0x17059d[_0x65ec('0x46')]['id']){delete _0x17059d[_0x65ec('0x46')]['id'];}return db['ZendeskAccount'][_0x65ec('0x47')]({'where':{'id':_0x17059d[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x3d761f,null))[_0x65ec('0x22')](function(_0x3da824){if(_0x3da824){_0x17059d[_0x65ec('0x46')][_0x65ec('0x4c')]=_0x3da824['id'];_0x17059d[_0x65ec('0x46')][_0x65ec('0x4d')]=integrations['getSubjects'](_0x17059d['body'][_0x65ec('0x4e')],_0x17059d['body']['type']);_0x17059d[_0x65ec('0x46')][_0x65ec('0x4f')]=integrations[_0x65ec('0x50')](_0x17059d['body']['channel'],_0x17059d[_0x65ec('0x46')]['type']);return db['ZendeskConfiguration']['create'](_0x17059d[_0x65ec('0x46')],{'include':[{'model':db['ZendeskField'],'as':_0x65ec('0x4d')},{'model':db[_0x65ec('0x51')],'as':_0x65ec('0x4f')}]});}return null;})['then'](respondWithResult(_0x3d761f,null))['catch'](handleError(_0x3d761f,null));};exports[_0x65ec('0x52')]=function(_0x54f1cb,_0x244d12,_0x1c2972){var _0xf78f6a='';return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x54f1cb[_0x65ec('0x44')]['id']},'attributes':['id',_0x65ec('0x53'),_0x65ec('0x54'),_0x65ec('0x55'),_0x65ec('0x56'),'remoteUri']})[_0x65ec('0x22')](handleEntityNotFound(_0x244d12,null))['then'](function(_0x46e454){if(_0x46e454){_0xf78f6a=_0x46e454[_0x65ec('0x57')];var _0x292f81=_0xf78f6a[_0x65ec('0x58')](-0x1);if(_0x292f81==='/'){_0xf78f6a=_0xf78f6a['substring'](0x0,_0xf78f6a[_0x65ec('0x59')](_0x292f81));}var _0x556c5e={'method':_0x65ec('0x5a'),'uri':util[_0x65ec('0x5b')](_0x65ec('0x5c'),_0xf78f6a,_0x65ec('0x5d')),'json':!![]};switch(_0x46e454['authType']){case'password':_0x556c5e['headers']={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')](_0x65ec('0x5f'),_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x54')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;case _0x65ec('0x55'):_0x556c5e[_0x65ec('0x62')]={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')]('%s/token:%s',_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x55')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;default:throw new db[(_0x65ec('0x63'))][(_0x65ec('0x64'))](_0x65ec('0x65'));}return rp(_0x556c5e);}})[_0x65ec('0x22')](function(_0x3b5640){if(_0x3b5640){var _0x26ac0e=['subject',_0x65ec('0x66'),'group','assignee'];_[_0x65ec('0x67')](_0x3b5640[_0x65ec('0x5d')],function(_0x272432){return _0x26ac0e[_0x65ec('0x68')](_0x272432[_0x65ec('0x2c')]);});return{'count':_0x3b5640[_0x65ec('0x5d')][_0x65ec('0x49')],'rows':_[_0x65ec('0x29')](_0x3b5640['ticket_fields'],function(_0x1f5fe7){return{'id':_0x1f5fe7['id'],'name':_0x1f5fe7['position']>0x7?_0x1f5fe7[_0x65ec('0x69')]:_0x1f5fe7[_0x65ec('0x2c')],'custom':_0x1f5fe7[_0x65ec('0x6a')]>0x7?!![]:![],'options':_0x1f5fe7['system_field_options']?_0x1f5fe7[_0x65ec('0x6b')]:_0x1f5fe7[_0x65ec('0x6c')]?_0x1f5fe7[_0x65ec('0x6c')]:[]};})};}})[_0x65ec('0x22')](respondWithResult(_0x244d12,null))[_0x65ec('0x42')](function(_0x77ebd2){var _0x1172f3=_0x54f1cb['query'][_0x65ec('0x6d')]?0x1f4:_0x77ebd2[_0x65ec('0x6e')]||0x1f4;logger[_0x65ec('0x24')](_0x65ec('0x6f'),'getFields',_0x1172f3,JSON['stringify'](_0x77ebd2));delete _0x77ebd2[_0x65ec('0x26')];if(_0x1172f3===0x191){_0x1172f3=0x190;}_0x244d12[_0x65ec('0x16')](_0x1172f3)[_0x65ec('0x27')](_0x54f1cb[_0x65ec('0x2e')][_0x65ec('0x6d')]?{'message':_0x65ec('0x70'),'statusCode':_0x77ebd2['statusCode']}:_0x77ebd2);});}; \ No newline at end of file +var _0x58a4=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZendeskAccount','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','map','type'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x58a4,0xbf));var _0x458a=function(_0x3db750,_0x5d66c2){_0x3db750=_0x3db750-0x0;var _0x5427a=_0x58a4[_0x3db750];return _0x5427a;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];var integrations=require(_0x458a('0x1a'));function respondWithStatusCode(_0x2a4934,_0x2e788b){_0x2e788b=_0x2e788b||0xcc;return function(_0x5bd09e){if(_0x5bd09e){return _0x2a4934['sendStatus'](_0x2e788b);}return _0x2a4934[_0x458a('0x1b')](_0x2e788b)['end']();};}function respondWithResult(_0x2c7528,_0x44f683){_0x44f683=_0x44f683||0xc8;return function(_0x10133b){if(_0x10133b){return _0x2c7528[_0x458a('0x1b')](_0x44f683)[_0x458a('0x1c')](_0x10133b);}};}function respondWithFilteredResult(_0x29acee,_0x507b0f){return function(_0x4b26be){if(_0x4b26be){var _0x5c7993=typeof _0x507b0f[_0x458a('0x1d')]===_0x458a('0x1e')&&typeof _0x507b0f[_0x458a('0x1f')]==='undefined';var _0x310569=_0x4b26be[_0x458a('0x20')];var _0x18504d=_0x5c7993?0x0:_0x507b0f[_0x458a('0x1d')];var _0xa91473=_0x5c7993?_0x4b26be['count']:_0x507b0f['offset']+_0x507b0f[_0x458a('0x1f')];var _0x4d07a7;if(_0xa91473>=_0x310569){_0xa91473=_0x310569;_0x4d07a7=0xc8;}else{_0x4d07a7=0xce;}_0x29acee[_0x458a('0x1b')](_0x4d07a7);return _0x29acee[_0x458a('0x21')]('Content-Range',_0x18504d+'-'+_0xa91473+'/'+_0x310569)[_0x458a('0x1c')](_0x4b26be);}return null;};}function patchUpdates(_0x55a588){return function(_0x200213){try{jsonpatch[_0x458a('0x22')](_0x200213,_0x55a588,!![]);}catch(_0x59f44c){return BPromise[_0x458a('0x23')](_0x59f44c);}return _0x200213[_0x458a('0x24')]();};}function saveUpdates(_0x5a2bcb,_0xa6b8ff){return function(_0x5ad95a){if(_0x5ad95a){return _0x5ad95a[_0x458a('0x25')](_0x5a2bcb)['then'](function(_0x4080fc){return _0x4080fc;});}return null;};}function removeEntity(_0x5dfc6c,_0x36b08e){return function(_0x911eaf){if(_0x911eaf){return _0x911eaf[_0x458a('0x26')]()[_0x458a('0x27')](function(){_0x5dfc6c[_0x458a('0x1b')](0xcc)[_0x458a('0x28')]();});}};}function handleEntityNotFound(_0x340375,_0x3012c7){return function(_0x1f2d0){if(!_0x1f2d0){_0x340375[_0x458a('0x29')](0x194);}return _0x1f2d0;};}function handleError(_0x52efed,_0x327fcb){_0x327fcb=_0x327fcb||0x1f4;return function(_0x21ec38){logger['error'](_0x21ec38[_0x458a('0x2a')]);if(_0x21ec38[_0x458a('0x2b')]){delete _0x21ec38['name'];}_0x52efed['status'](_0x327fcb)[_0x458a('0x2c')](_0x21ec38);};}exports['index']=function(_0x33c5d8,_0x29f9b5){var _0x223f73={},_0x4a49e4={},_0xa6fdf={'count':0x0,'rows':[]};var _0x2531f7=_[_0x458a('0x2d')](db['ZendeskAccount']['rawAttributes'],function(_0x18c890){return{'name':_0x18c890['fieldName'],'type':_0x18c890[_0x458a('0x2e')]['key']};});_0x4a49e4[_0x458a('0x2f')]=_[_0x458a('0x2d')](_0x2531f7,'name');_0x4a49e4[_0x458a('0x30')]=_[_0x458a('0x31')](_0x33c5d8[_0x458a('0x30')]);_0x4a49e4['filters']=_[_0x458a('0x32')](_0x4a49e4[_0x458a('0x2f')],_0x4a49e4[_0x458a('0x30')]);_0x223f73[_0x458a('0x33')]=_[_0x458a('0x32')](_0x4a49e4['model'],qs[_0x458a('0x34')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x34')]));_0x223f73[_0x458a('0x33')]=_0x223f73[_0x458a('0x33')][_0x458a('0x35')]?_0x223f73['attributes']:_0x4a49e4[_0x458a('0x2f')];if(!_0x33c5d8[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x223f73[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1f')]);_0x223f73[_0x458a('0x1d')]=qs['offset'](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1d')]);}_0x223f73[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x39')]);_0x223f73[_0x458a('0x3a')]=qs[_0x458a('0x3b')](_[_0x458a('0x3c')](_0x33c5d8[_0x458a('0x30')],_0x4a49e4[_0x458a('0x3b')]),_0x2531f7);if(_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]){_0x223f73[_0x458a('0x3a')]=_[_0x458a('0x3e')](_0x223f73['where'],{'$or':_[_0x458a('0x2d')](_0x2531f7,function(_0x397a41){if(_0x397a41[_0x458a('0x2e')]!==_0x458a('0x3f')){var _0x3c5840={};_0x3c5840[_0x397a41[_0x458a('0x2b')]]={'$like':'%'+_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x3c5840;}})});}_0x223f73=_[_0x458a('0x3e')]({},_0x223f73,_0x33c5d8[_0x458a('0x40')]);var _0x20cf10={'where':_0x223f73['where']};return db[_0x458a('0x41')][_0x458a('0x20')](_0x20cf10)['then'](function(_0x430bda){_0xa6fdf[_0x458a('0x20')]=_0x430bda;if(_0x33c5d8[_0x458a('0x30')]['includeAll']){_0x223f73[_0x458a('0x42')]=[{'all':!![]}];}return db[_0x458a('0x41')][_0x458a('0x43')](_0x223f73);})[_0x458a('0x27')](function(_0xbcd632){_0xa6fdf[_0x458a('0x44')]=_0xbcd632;return _0xa6fdf;})[_0x458a('0x27')](respondWithFilteredResult(_0x29f9b5,_0x223f73))[_0x458a('0x45')](handleError(_0x29f9b5,null));};exports['show']=function(_0x296385,_0x145e3c){var _0x2b9030={'raw':![],'where':{'id':_0x296385[_0x458a('0x46')]['id']}},_0x5180ae={};_0x5180ae[_0x458a('0x2f')]=_['keys'](db[_0x458a('0x41')][_0x458a('0x47')]);_0x5180ae[_0x458a('0x30')]=_[_0x458a('0x31')](_0x296385[_0x458a('0x30')]);_0x5180ae['filters']=_['intersection'](_0x5180ae[_0x458a('0x2f')],_0x5180ae[_0x458a('0x30')]);_0x2b9030[_0x458a('0x33')]=_[_0x458a('0x32')](_0x5180ae['model'],qs[_0x458a('0x34')](_0x296385[_0x458a('0x30')]['fields']));_0x2b9030[_0x458a('0x33')]=_0x2b9030['attributes'][_0x458a('0x35')]?_0x2b9030[_0x458a('0x33')]:_0x5180ae[_0x458a('0x2f')];if(_0x296385['query'][_0x458a('0x48')]){_0x2b9030[_0x458a('0x42')]=[{'all':!![]}];}_0x2b9030=_[_0x458a('0x3e')]({},_0x2b9030,_0x296385['options']);return db['ZendeskAccount'][_0x458a('0x49')](_0x2b9030)[_0x458a('0x27')](handleEntityNotFound(_0x145e3c,null))[_0x458a('0x27')](respondWithResult(_0x145e3c,null))['catch'](handleError(_0x145e3c,null));};exports['create']=function(_0x3a7005,_0xf362b5){return db[_0x458a('0x41')][_0x458a('0x4a')](_0x3a7005[_0x458a('0x4b')],{})[_0x458a('0x27')](respondWithResult(_0xf362b5,0xc9))[_0x458a('0x45')](handleError(_0xf362b5,null));};exports[_0x458a('0x25')]=function(_0xb22232,_0x213f86){if(_0xb22232[_0x458a('0x4b')]['id']){delete _0xb22232[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x49')]({'where':{'id':_0xb22232[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x213f86,null))['then'](saveUpdates(_0xb22232[_0x458a('0x4b')],null))[_0x458a('0x27')](respondWithResult(_0x213f86,null))[_0x458a('0x45')](handleError(_0x213f86,null));};exports[_0x458a('0x26')]=function(_0x44670a,_0x5630cf){return db['ZendeskAccount']['find']({'where':{'id':_0x44670a[_0x458a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5630cf,null))[_0x458a('0x27')](removeEntity(_0x5630cf,null))[_0x458a('0x45')](handleError(_0x5630cf,null));};exports[_0x458a('0x4c')]=function(_0x649553,_0xfa6e65,_0x5f0151){var _0x48f68e={};var _0x3d7616={};var _0x2d8b77;var _0x2587a1;return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x649553['params']['id']}})[_0x458a('0x27')](handleEntityNotFound(_0xfa6e65,null))['then'](function(_0xa51e28){if(_0xa51e28){_0x2d8b77=_0xa51e28;_0x3d7616['model']=_[_0x458a('0x31')](db['ZendeskConfiguration']['rawAttributes']);_0x3d7616['query']=_[_0x458a('0x31')](_0x649553[_0x458a('0x30')]);_0x3d7616['filters']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],_0x3d7616[_0x458a('0x30')]);_0x48f68e['attributes']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],qs[_0x458a('0x34')](_0x649553[_0x458a('0x30')][_0x458a('0x34')]));_0x48f68e[_0x458a('0x33')]=_0x48f68e['attributes'][_0x458a('0x35')]?_0x48f68e[_0x458a('0x33')]:_0x3d7616[_0x458a('0x2f')];_0x48f68e[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x649553[_0x458a('0x30')][_0x458a('0x39')]);_0x48f68e[_0x458a('0x3a')]=qs['filters'](_[_0x458a('0x3c')](_0x649553['query'],_0x3d7616[_0x458a('0x3b')]));if(_0x649553[_0x458a('0x30')][_0x458a('0x3d')]){_0x48f68e[_0x458a('0x3a')]=_['merge'](_0x48f68e['where'],{'$or':_[_0x458a('0x2d')](_0x48f68e[_0x458a('0x33')],function(_0x2b9aac){var _0x156a22={};_0x156a22[_0x2b9aac]={'$like':'%'+_0x649553[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x156a22;})});}_0x48f68e=_['merge']({},_0x48f68e,_0x649553[_0x458a('0x40')]);return _0x2d8b77[_0x458a('0x4c')](_0x48f68e);}})['then'](function(_0x18d83a){if(_0x18d83a){_0x2587a1=_0x18d83a['length'];if(!_0x649553[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x48f68e[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x649553[_0x458a('0x30')][_0x458a('0x1f')]);_0x48f68e[_0x458a('0x1d')]=qs['offset'](_0x649553[_0x458a('0x30')][_0x458a('0x1d')]);}return _0x2d8b77['getConfigurations'](_0x48f68e);}})[_0x458a('0x27')](function(_0x3da617){if(_0x3da617){return _0x3da617?{'count':_0x2587a1,'rows':_0x3da617}:null;}})['then'](respondWithResult(_0xfa6e65,null))[_0x458a('0x45')](handleError(_0xfa6e65,null));};exports[_0x458a('0x4e')]=function(_0x47cbcf,_0x17b611,_0x180df0){if(_0x47cbcf['body']['id']){delete _0x47cbcf[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x47cbcf[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x17b611,null))[_0x458a('0x27')](function(_0x4199a7){if(_0x4199a7){_0x47cbcf[_0x458a('0x4b')]['AccountId']=_0x4199a7['id'];_0x47cbcf[_0x458a('0x4b')][_0x458a('0x4f')]=integrations[_0x458a('0x50')](_0x47cbcf[_0x458a('0x4b')][_0x458a('0x51')],_0x47cbcf[_0x458a('0x4b')][_0x458a('0x2e')]);_0x47cbcf[_0x458a('0x4b')][_0x458a('0x52')]=integrations[_0x458a('0x53')](_0x47cbcf['body'][_0x458a('0x51')],_0x47cbcf['body'][_0x458a('0x2e')]);return db[_0x458a('0x54')][_0x458a('0x4a')](_0x47cbcf[_0x458a('0x4b')],{'include':[{'model':db[_0x458a('0x55')],'as':_0x458a('0x4f')},{'model':db[_0x458a('0x55')],'as':_0x458a('0x52')}]});}return null;})[_0x458a('0x27')](respondWithResult(_0x17b611,null))[_0x458a('0x45')](handleError(_0x17b611,null));};exports[_0x458a('0x56')]=function(_0x448cbc,_0x11bbba,_0x435884){var _0x3948aa='';return db[_0x458a('0x41')]['findOne']({'where':{'id':_0x448cbc[_0x458a('0x46')]['id']},'attributes':['id','username',_0x458a('0x57'),_0x458a('0x58'),'authType',_0x458a('0x59')]})[_0x458a('0x27')](handleEntityNotFound(_0x11bbba,null))[_0x458a('0x27')](function(_0x494710){if(_0x494710){_0x3948aa=_0x494710[_0x458a('0x59')];var _0xed002=_0x3948aa[_0x458a('0x5a')](-0x1);if(_0xed002==='/'){_0x3948aa=_0x3948aa[_0x458a('0x5b')](0x0,_0x3948aa[_0x458a('0x5c')](_0xed002));}var _0x42f213={'method':'GET','uri':util[_0x458a('0x5d')]('%s/%s',_0x3948aa,'ticket_fields'),'json':!![]};switch(_0x494710[_0x458a('0x5e')]){case _0x458a('0x57'):_0x42f213[_0x458a('0x5f')]={'Authorization':util[_0x458a('0x5d')](_0x458a('0x60'),new Buffer(util[_0x458a('0x5d')](_0x458a('0x61'),_0x494710[_0x458a('0x62')],_0x494710[_0x458a('0x57')]))[_0x458a('0x63')](_0x458a('0x64')))};break;case _0x458a('0x58'):_0x42f213[_0x458a('0x5f')]={'Authorization':util[_0x458a('0x5d')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x494710[_0x458a('0x62')],_0x494710['token']))[_0x458a('0x63')](_0x458a('0x64')))};break;default:throw new db[(_0x458a('0x65'))][(_0x458a('0x66'))](_0x458a('0x67'));}return rp(_0x42f213);}})[_0x458a('0x27')](function(_0x46df7c){if(_0x46df7c){var _0x49f3ee=[_0x458a('0x68'),_0x458a('0x69'),'group',_0x458a('0x6a')];_['remove'](_0x46df7c[_0x458a('0x6b')],function(_0x58d29d){return _0x49f3ee[_0x458a('0x6c')](_0x58d29d[_0x458a('0x2e')]);});return{'count':_0x46df7c[_0x458a('0x6b')][_0x458a('0x35')],'rows':_['map'](_0x46df7c[_0x458a('0x6b')],function(_0x14b95e){return{'id':_0x14b95e['id'],'name':_0x14b95e[_0x458a('0x6d')]>0x7?_0x14b95e[_0x458a('0x6e')]:_0x14b95e[_0x458a('0x2e')],'custom':_0x14b95e[_0x458a('0x6d')]>0x7?!![]:![],'options':_0x14b95e[_0x458a('0x6f')]?_0x14b95e[_0x458a('0x6f')]:_0x14b95e['custom_field_options']?_0x14b95e[_0x458a('0x70')]:[]};})};}})[_0x458a('0x27')](respondWithResult(_0x11bbba,null))[_0x458a('0x45')](function(_0x4212af){var _0x591dbb=_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?0x1f4:_0x4212af['statusCode']||0x1f4;logger[_0x458a('0x72')](_0x458a('0x73'),_0x458a('0x56'),_0x591dbb,JSON[_0x458a('0x74')](_0x4212af));delete _0x4212af[_0x458a('0x2b')];if(_0x591dbb===0x191){_0x591dbb=0x190;}_0x11bbba['status'](_0x591dbb)[_0x458a('0x2c')](_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?{'message':_0x458a('0x75'),'statusCode':_0x4212af[_0x458a('0x76')]}:_0x4212af);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 777d3e7..a61d438 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 _0xc6e6=['int_zendesk_accounts','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x2e875e,_0x17112f){var _0x4d2260=function(_0x3adca3){while(--_0x3adca3){_0x2e875e['push'](_0x2e875e['shift']());}};_0x4d2260(++_0x17112f);}(_0xc6e6,0x1c4));var _0x6c6e=function(_0x5997f5,_0x523d75){_0x5997f5=_0x5997f5-0x0;var _0x4066a4=_0xc6e6[_0x5997f5];return _0x4066a4;};'use strict';var _=require(_0x6c6e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6c6e('0x1'));var rp=require(_0x6c6e('0x2'));var fs=require('fs');var path=require(_0x6c6e('0x3'));var rimraf=require(_0x6c6e('0x4'));var config=require(_0x6c6e('0x5'));var attributes=require(_0x6c6e('0x6'));var integrations=require(_0x6c6e('0x7'));module[_0x6c6e('0x8')]=function(_0xf1bd78,_0x45f402){return _0xf1bd78[_0x6c6e('0x9')]('ZendeskAccount',attributes,{'tableName':_0x6c6e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0043=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird'];(function(_0x36a6d5,_0x22746c){var _0x530c37=function(_0x4b24dc){while(--_0x4b24dc){_0x36a6d5['push'](_0x36a6d5['shift']());}};_0x530c37(++_0x22746c);}(_0x0043,0x1e5));var _0x3004=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0043[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x3004('0x0'));var util=require(_0x3004('0x1'));var logger=require('../../config/logger')(_0x3004('0x2'));var moment=require(_0x3004('0x3'));var BPromise=require(_0x3004('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3004('0x5'));var attributes=require(_0x3004('0x6'));var integrations=require(_0x3004('0x7'));module['exports']=function(_0x50e045,_0xf776bb){return _0x50e045['define'](_0x3004('0x8'),attributes,{'tableName':_0x3004('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 9c38329..0bbd161 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 _0xb777=['error','code','message','catch','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','GetZendeskAccount','ShowZendeskAccount','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c8350,_0x32a1c3){var _0xf8d317=function(_0x441f89){while(--_0x441f89){_0x4c8350['push'](_0x4c8350['shift']());}};_0xf8d317(++_0x32a1c3);}(_0xb777,0x107));var _0x7b77=function(_0x526d6c,_0x1cc58a){_0x526d6c=_0x526d6c-0x0;var _0x43b854=_0xb777[_0x526d6c];return _0x43b854;};'use strict';var _=require('lodash');var util=require(_0x7b77('0x0'));var moment=require(_0x7b77('0x1'));var BPromise=require(_0x7b77('0x2'));var rs=require(_0x7b77('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b77('0x4'))['db'];var utils=require(_0x7b77('0x5'));var logger=require(_0x7b77('0x6'))(_0x7b77('0x7'));var config=require(_0x7b77('0x8'));var jayson=require(_0x7b77('0x9'));var client=jayson[_0x7b77('0xa')][_0x7b77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53c9e0,_0x2e159f,_0x13118f){return new BPromise(function(_0x44773b,_0xd9bf4e){return client['request'](_0x53c9e0,_0x13118f)[_0x7b77('0xc')](function(_0xa989d6){logger[_0x7b77('0xd')](_0x7b77('0xe'),_0x2e159f,_0x7b77('0xf'));logger[_0x7b77('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2e159f,'request\x20sent',JSON['stringify'](_0xa989d6));if(_0xa989d6[_0x7b77('0x11')]){if(_0xa989d6['error'][_0x7b77('0x12')]===0x1f4){logger[_0x7b77('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x2e159f,_0xa989d6[_0x7b77('0x11')][_0x7b77('0x13')]);return _0xd9bf4e(_0xa989d6[_0x7b77('0x11')][_0x7b77('0x13')]);}logger['error'](_0x7b77('0xe'),_0x2e159f,_0xa989d6[_0x7b77('0x11')][_0x7b77('0x13')]);return _0x44773b(_0xa989d6[_0x7b77('0x11')][_0x7b77('0x13')]);}else{logger['info'](_0x7b77('0xe'),_0x2e159f,'request\x20sent');_0x44773b(_0xa989d6['result'][_0x7b77('0x13')]);}})[_0x7b77('0x14')](function(_0x281950){logger[_0x7b77('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x2e159f,_0x281950);_0xd9bf4e(_0x281950);});});}exports['GetZendeskAccount']=function(_0x2bca29){var _0x5dc5cd=this;return new Promise(function(_0x3248fd,_0x16e02f){return db[_0x7b77('0x15')][_0x7b77('0x16')]({'raw':_0x2bca29[_0x7b77('0x17')]?_0x2bca29[_0x7b77('0x17')][_0x7b77('0x18')]===undefined?!![]:![]:!![],'where':_0x2bca29[_0x7b77('0x17')]?_0x2bca29[_0x7b77('0x17')][_0x7b77('0x19')]||null:null,'attributes':_0x2bca29[_0x7b77('0x17')]?_0x2bca29['options'][_0x7b77('0x1a')]||null:null,'limit':_0x2bca29['options']?_0x2bca29[_0x7b77('0x17')][_0x7b77('0x1b')]||null:null,'include':_0x2bca29['options']?_0x2bca29[_0x7b77('0x17')][_0x7b77('0x1c')]?_[_0x7b77('0x1d')](_0x2bca29[_0x7b77('0x17')]['include'],function(_0x2ad96e){return{'model':db[_0x2ad96e[_0x7b77('0x1e')]],'as':_0x2ad96e['as'],'attributes':_0x2ad96e[_0x7b77('0x1a')],'include':_0x2ad96e[_0x7b77('0x1c')]?_[_0x7b77('0x1d')](_0x2ad96e[_0x7b77('0x1c')],function(_0x3aaaf1){return{'model':db[_0x3aaaf1[_0x7b77('0x1e')]],'as':_0x3aaaf1['as'],'attributes':_0x3aaaf1['attributes'],'include':_0x3aaaf1[_0x7b77('0x1c')]?_[_0x7b77('0x1d')](_0x3aaaf1[_0x7b77('0x1c')],function(_0x1ee099){return{'model':db[_0x1ee099[_0x7b77('0x1e')]],'as':_0x1ee099['as'],'attributes':_0x1ee099['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x311f49){logger[_0x7b77('0xd')]('GetZendeskAccount',_0x2bca29);logger[_0x7b77('0x10')]('GetZendeskAccount',_0x2bca29,JSON[_0x7b77('0x1f')](_0x311f49));_0x3248fd(_0x311f49);})['catch'](function(_0x22ec8d){logger['error'](_0x7b77('0x20'),_0x22ec8d[_0x7b77('0x13')],_0x2bca29);_0x16e02f(_0x5dc5cd[_0x7b77('0x11')](0x1f4,_0x22ec8d[_0x7b77('0x13')]));});});};exports[_0x7b77('0x21')]=function(_0x5cbe06){var _0x2e5674=this;return new Promise(function(_0x6291e7,_0xd0add){return db['ZendeskAccount'][_0x7b77('0x22')]({'raw':_0x5cbe06[_0x7b77('0x17')]?_0x5cbe06['options'][_0x7b77('0x18')]===undefined?!![]:![]:!![],'where':_0x5cbe06[_0x7b77('0x17')]?_0x5cbe06['options'][_0x7b77('0x19')]||null:null,'attributes':_0x5cbe06[_0x7b77('0x17')]?_0x5cbe06['options']['attributes']||null:null,'include':_0x5cbe06[_0x7b77('0x17')]?_0x5cbe06[_0x7b77('0x17')][_0x7b77('0x1c')]?_['map'](_0x5cbe06['options'][_0x7b77('0x1c')],function(_0x209225){return{'model':db[_0x209225[_0x7b77('0x1e')]],'as':_0x209225['as'],'attributes':_0x209225[_0x7b77('0x1a')],'include':_0x209225[_0x7b77('0x1c')]?_[_0x7b77('0x1d')](_0x209225[_0x7b77('0x1c')],function(_0x19f903){return{'model':db[_0x19f903[_0x7b77('0x1e')]],'as':_0x19f903['as'],'attributes':_0x19f903[_0x7b77('0x1a')],'include':_0x19f903['include']?_[_0x7b77('0x1d')](_0x19f903[_0x7b77('0x1c')],function(_0x1f4144){return{'model':db[_0x1f4144[_0x7b77('0x1e')]],'as':_0x1f4144['as'],'attributes':_0x1f4144['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b77('0xc')](function(_0x2fcf2f){logger[_0x7b77('0xd')](_0x7b77('0x21'),_0x5cbe06);logger['debug'](_0x7b77('0x21'),_0x5cbe06,JSON[_0x7b77('0x1f')](_0x2fcf2f));_0x6291e7(_0x2fcf2f);})[_0x7b77('0x14')](function(_0x1b3c9c){logger['error']('ShowZendeskAccount',_0x1b3c9c[_0x7b77('0x13')],_0x5cbe06);_0xd0add(_0x2e5674[_0x7b77('0x11')](0x1f4,_0x1b3c9c[_0x7b77('0x13')]));});});}; \ No newline at end of file +var _0x93da=['code','message','info','result','catch','GetZendeskAccount','findAll','options','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','where','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xaced19,_0x4fa58f){var _0x352cda=function(_0x26e45f){while(--_0x26e45f){_0xaced19['push'](_0xaced19['shift']());}};_0x352cda(++_0x4fa58f);}(_0x93da,0x7d));var _0xa93d=function(_0x46a003,_0x12d65e){_0x46a003=_0x46a003-0x0;var _0x11c836=_0x93da[_0x46a003];return _0x11c836;};'use strict';var _=require(_0xa93d('0x0'));var util=require(_0xa93d('0x1'));var moment=require(_0xa93d('0x2'));var BPromise=require(_0xa93d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa93d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa93d('0x5'))(_0xa93d('0x6'));var config=require(_0xa93d('0x7'));var jayson=require(_0xa93d('0x8'));var client=jayson[_0xa93d('0x9')][_0xa93d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f3d9b,_0x4d6f8d,_0x364aaf){return new BPromise(function(_0x40ca80,_0x1436fa){return client[_0xa93d('0xb')](_0x5f3d9b,_0x364aaf)[_0xa93d('0xc')](function(_0x1cfc44){logger['info'](_0xa93d('0xd'),_0x4d6f8d,_0xa93d('0xe'));logger[_0xa93d('0xf')](_0xa93d('0x10'),_0x4d6f8d,'request\x20sent',JSON[_0xa93d('0x11')](_0x1cfc44));if(_0x1cfc44[_0xa93d('0x12')]){if(_0x1cfc44[_0xa93d('0x12')][_0xa93d('0x13')]===0x1f4){logger[_0xa93d('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x4d6f8d,_0x1cfc44[_0xa93d('0x12')][_0xa93d('0x14')]);return _0x1436fa(_0x1cfc44[_0xa93d('0x12')][_0xa93d('0x14')]);}logger['error'](_0xa93d('0xd'),_0x4d6f8d,_0x1cfc44['error'][_0xa93d('0x14')]);return _0x40ca80(_0x1cfc44[_0xa93d('0x12')][_0xa93d('0x14')]);}else{logger[_0xa93d('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x4d6f8d,_0xa93d('0xe'));_0x40ca80(_0x1cfc44[_0xa93d('0x16')][_0xa93d('0x14')]);}})[_0xa93d('0x17')](function(_0x5ea4e9){logger[_0xa93d('0x12')](_0xa93d('0xd'),_0x4d6f8d,_0x5ea4e9);_0x1436fa(_0x5ea4e9);});});}exports[_0xa93d('0x18')]=function(_0x2e4f62){var _0x1bb5f4=this;return new Promise(function(_0x3ee4e7,_0x47828d){return db['ZendeskAccount'][_0xa93d('0x19')]({'raw':_0x2e4f62[_0xa93d('0x1a')]?_0x2e4f62[_0xa93d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2e4f62[_0xa93d('0x1a')]?_0x2e4f62[_0xa93d('0x1a')]['where']||null:null,'attributes':_0x2e4f62[_0xa93d('0x1a')]?_0x2e4f62['options'][_0xa93d('0x1b')]||null:null,'limit':_0x2e4f62[_0xa93d('0x1a')]?_0x2e4f62[_0xa93d('0x1a')][_0xa93d('0x1c')]||null:null,'include':_0x2e4f62[_0xa93d('0x1a')]?_0x2e4f62[_0xa93d('0x1a')][_0xa93d('0x1d')]?_['map'](_0x2e4f62[_0xa93d('0x1a')][_0xa93d('0x1d')],function(_0x32bb76){return{'model':db[_0x32bb76[_0xa93d('0x1e')]],'as':_0x32bb76['as'],'attributes':_0x32bb76[_0xa93d('0x1b')],'include':_0x32bb76['include']?_[_0xa93d('0x1f')](_0x32bb76['include'],function(_0x1c6dbd){return{'model':db[_0x1c6dbd[_0xa93d('0x1e')]],'as':_0x1c6dbd['as'],'attributes':_0x1c6dbd[_0xa93d('0x1b')],'include':_0x1c6dbd['include']?_[_0xa93d('0x1f')](_0x1c6dbd[_0xa93d('0x1d')],function(_0x125f36){return{'model':db[_0x125f36[_0xa93d('0x1e')]],'as':_0x125f36['as'],'attributes':_0x125f36[_0xa93d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa93d('0xc')](function(_0x56f9e4){logger[_0xa93d('0x15')](_0xa93d('0x18'),_0x2e4f62);logger[_0xa93d('0xf')]('GetZendeskAccount',_0x2e4f62,JSON[_0xa93d('0x11')](_0x56f9e4));_0x3ee4e7(_0x56f9e4);})[_0xa93d('0x17')](function(_0x11eced){logger[_0xa93d('0x12')]('GetZendeskAccount',_0x11eced[_0xa93d('0x14')],_0x2e4f62);_0x47828d(_0x1bb5f4[_0xa93d('0x12')](0x1f4,_0x11eced[_0xa93d('0x14')]));});});};exports[_0xa93d('0x20')]=function(_0x1b3e4e){var _0x57a445=this;return new Promise(function(_0x4dd4dc,_0x4ecdaa){return db['ZendeskAccount'][_0xa93d('0x21')]({'raw':_0x1b3e4e[_0xa93d('0x1a')]?_0x1b3e4e['options'][_0xa93d('0x22')]===undefined?!![]:![]:!![],'where':_0x1b3e4e[_0xa93d('0x1a')]?_0x1b3e4e[_0xa93d('0x1a')][_0xa93d('0x23')]||null:null,'attributes':_0x1b3e4e[_0xa93d('0x1a')]?_0x1b3e4e[_0xa93d('0x1a')][_0xa93d('0x1b')]||null:null,'include':_0x1b3e4e['options']?_0x1b3e4e[_0xa93d('0x1a')]['include']?_[_0xa93d('0x1f')](_0x1b3e4e['options'][_0xa93d('0x1d')],function(_0xe5a589){return{'model':db[_0xe5a589[_0xa93d('0x1e')]],'as':_0xe5a589['as'],'attributes':_0xe5a589[_0xa93d('0x1b')],'include':_0xe5a589[_0xa93d('0x1d')]?_[_0xa93d('0x1f')](_0xe5a589[_0xa93d('0x1d')],function(_0x1fc53b){return{'model':db[_0x1fc53b[_0xa93d('0x1e')]],'as':_0x1fc53b['as'],'attributes':_0x1fc53b[_0xa93d('0x1b')],'include':_0x1fc53b[_0xa93d('0x1d')]?_[_0xa93d('0x1f')](_0x1fc53b[_0xa93d('0x1d')],function(_0x280f8c){return{'model':db[_0x280f8c[_0xa93d('0x1e')]],'as':_0x280f8c['as'],'attributes':_0x280f8c['attributes']};}):[]};}):[]};}):[]:[]})[_0xa93d('0xc')](function(_0x54cd0b){logger[_0xa93d('0x15')]('ShowZendeskAccount',_0x1b3e4e);logger[_0xa93d('0xf')](_0xa93d('0x20'),_0x1b3e4e,JSON[_0xa93d('0x11')](_0x54cd0b));_0x4dd4dc(_0x54cd0b);})[_0xa93d('0x17')](function(_0x56ba54){logger[_0xa93d('0x12')](_0xa93d('0x20'),_0x56ba54[_0xa93d('0x14')],_0x1b3e4e);_0x4ecdaa(_0x57a445['error'](0x1f4,_0x56ba54['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index fda2e8a..f8f98ec 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 _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x31140b,_0x3f970d){var _0x103876=function(_0x21fa1e){while(--_0x21fa1e){_0x31140b['push'](_0x31140b['shift']());}};_0x103876(++_0x3f970d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file +var _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x51f974,_0x4bf60b){var _0x494481=function(_0x525044){while(--_0x525044){_0x51f974['push'](_0x51f974['shift']());}};_0x494481(++_0x4bf60b);}(_0x4fc2,0x111));var _0x24fc=function(_0x41b5ca,_0x3dbf55){_0x41b5ca=_0x41b5ca-0x0;var _0x8fa6e6=_0x4fc2[_0x41b5ca];return _0x8fa6e6;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3105114..d46acee 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 _0x2a98=['STRING','sequelize','exports'];(function(_0x4ea977,_0x1cd48c){var _0x3aeec8=function(_0x15c7c8){while(--_0x15c7c8){_0x4ea977['push'](_0x4ea977['shift']());}};_0x3aeec8(++_0x1cd48c);}(_0x2a98,0x1cf));var _0x82a9=function(_0x540cdf,_0x4b7707){_0x540cdf=_0x540cdf-0x0;var _0x896746=_0x2a98[_0x540cdf];return _0x896746;};'use strict';var Sequelize=require(_0x82a9('0x0'));module[_0x82a9('0x1')]={'name':{'type':Sequelize[_0x82a9('0x2')]},'description':{'type':Sequelize[_0x82a9('0x2')]}}; \ No newline at end of file +var _0x036a=['STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x036a,0x9c));var _0xa036=function(_0x4069bb,_0x26c30b){_0x4069bb=_0x4069bb-0x0;var _0x28ae6e=_0x036a[_0x4069bb];return _0x28ae6e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa036('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index c72376e..217924a 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 _0x126e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','save','then','end','stack','name','send','map','ZendeskConfiguration','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','catch','create','body','findOne','sort','getFields','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','getTags','setTags','ids','eml-format'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x126e,0x9b));var _0xe126=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x126e[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xe126('0x0'));var rimraf=require(_0xe126('0x1'));var zipdir=require(_0xe126('0x2'));var jsonpatch=require(_0xe126('0x3'));var rp=require(_0xe126('0x4'));var moment=require(_0xe126('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe126('0x6'));var util=require(_0xe126('0x7'));var path=require(_0xe126('0x8'));var sox=require(_0xe126('0x9'));var csv=require(_0xe126('0xa'));var ejs=require(_0xe126('0xb'));var fs=require('fs');var fs_extra=require(_0xe126('0xc'));var _=require(_0xe126('0xd'));var squel=require(_0xe126('0xe'));var crypto=require(_0xe126('0xf'));var jsforce=require(_0xe126('0x10'));var deskjs=require(_0xe126('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe126('0x12'));var Papa=require('papaparse');var Redis=require(_0xe126('0x13'));var authService=require(_0xe126('0x14'));var qs=require(_0xe126('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe126('0x16'));var logger=require(_0xe126('0x17'))(_0xe126('0x18'));var utils=require('../../config/utils');var config=require(_0xe126('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe126('0x1a'))['db'];function respondWithStatusCode(_0x413f5e,_0x233ae8){_0x233ae8=_0x233ae8||0xcc;return function(_0x3ef2fa){if(_0x3ef2fa){return _0x413f5e['sendStatus'](_0x233ae8);}return _0x413f5e[_0xe126('0x1b')](_0x233ae8)['end']();};}function respondWithResult(_0x4a1229,_0x2ab21b){_0x2ab21b=_0x2ab21b||0xc8;return function(_0x4bc866){if(_0x4bc866){return _0x4a1229[_0xe126('0x1b')](_0x2ab21b)[_0xe126('0x1c')](_0x4bc866);}};}function respondWithFilteredResult(_0x37a277,_0x227bdd){return function(_0x1a0d12){if(_0x1a0d12){var _0x5cf5e5=typeof _0x227bdd['offset']===_0xe126('0x1d')&&typeof _0x227bdd[_0xe126('0x1e')]===_0xe126('0x1d');var _0x48ae67=_0x1a0d12['count'];var _0x5c0c4c=_0x5cf5e5?0x0:_0x227bdd[_0xe126('0x1f')];var _0x585ecd=_0x5cf5e5?_0x1a0d12['count']:_0x227bdd[_0xe126('0x1f')]+_0x227bdd[_0xe126('0x1e')];var _0x1f3a5c;if(_0x585ecd>=_0x48ae67){_0x585ecd=_0x48ae67;_0x1f3a5c=0xc8;}else{_0x1f3a5c=0xce;}_0x37a277[_0xe126('0x1b')](_0x1f3a5c);return _0x37a277['set']('Content-Range',_0x5c0c4c+'-'+_0x585ecd+'/'+_0x48ae67)[_0xe126('0x1c')](_0x1a0d12);}return null;};}function patchUpdates(_0x3f7cd9){return function(_0x241375){try{jsonpatch['apply'](_0x241375,_0x3f7cd9,!![]);}catch(_0x2737be){return BPromise['reject'](_0x2737be);}return _0x241375[_0xe126('0x20')]();};}function saveUpdates(_0x1f9fff,_0x49eea5){return function(_0x4bca17){if(_0x4bca17){return _0x4bca17['update'](_0x1f9fff)[_0xe126('0x21')](function(_0x1501e9){return _0x1501e9;});}return null;};}function removeEntity(_0x4192a3,_0x1f5905){return function(_0xb9850c){if(_0xb9850c){return _0xb9850c['destroy']()[_0xe126('0x21')](function(){_0x4192a3[_0xe126('0x1b')](0xcc)[_0xe126('0x22')]();});}};}function handleEntityNotFound(_0x4eb4f5,_0x2417fa){return function(_0x12dde2){if(!_0x12dde2){_0x4eb4f5['sendStatus'](0x194);}return _0x12dde2;};}function handleError(_0x1d1802,_0x246551){_0x246551=_0x246551||0x1f4;return function(_0x193679){logger['error'](_0x193679[_0xe126('0x23')]);if(_0x193679['name']){delete _0x193679[_0xe126('0x24')];}_0x1d1802[_0xe126('0x1b')](_0x246551)[_0xe126('0x25')](_0x193679);};}exports['index']=function(_0x2b7c99,_0x4d57d3){var _0x37a612={},_0x1897f6={},_0x9c2c70={'count':0x0,'rows':[]};var _0x39c613=_[_0xe126('0x26')](db[_0xe126('0x27')][_0xe126('0x28')],function(_0x1903c3){return{'name':_0x1903c3['fieldName'],'type':_0x1903c3['type'][_0xe126('0x29')]};});_0x1897f6[_0xe126('0x2a')]=_['map'](_0x39c613,_0xe126('0x24'));_0x1897f6['query']=_[_0xe126('0x2b')](_0x2b7c99['query']);_0x1897f6[_0xe126('0x2c')]=_[_0xe126('0x2d')](_0x1897f6['model'],_0x1897f6['query']);_0x37a612[_0xe126('0x2e')]=_[_0xe126('0x2d')](_0x1897f6[_0xe126('0x2a')],qs[_0xe126('0x2f')](_0x2b7c99[_0xe126('0x30')]['fields']));_0x37a612[_0xe126('0x2e')]=_0x37a612[_0xe126('0x2e')][_0xe126('0x31')]?_0x37a612[_0xe126('0x2e')]:_0x1897f6['model'];if(!_0x2b7c99[_0xe126('0x30')]['hasOwnProperty'](_0xe126('0x32'))){_0x37a612[_0xe126('0x1e')]=qs[_0xe126('0x1e')](_0x2b7c99['query'][_0xe126('0x1e')]);_0x37a612[_0xe126('0x1f')]=qs[_0xe126('0x1f')](_0x2b7c99['query'][_0xe126('0x1f')]);}_0x37a612[_0xe126('0x33')]=qs['sort'](_0x2b7c99[_0xe126('0x30')]['sort']);_0x37a612[_0xe126('0x34')]=qs[_0xe126('0x2c')](_[_0xe126('0x35')](_0x2b7c99['query'],_0x1897f6['filters']),_0x39c613);if(_0x2b7c99[_0xe126('0x30')][_0xe126('0x36')]){_0x37a612[_0xe126('0x34')]=_[_0xe126('0x37')](_0x37a612[_0xe126('0x34')],{'$or':_[_0xe126('0x26')](_0x39c613,function(_0x2e0278){if(_0x2e0278['type']!==_0xe126('0x38')){var _0x2afbbd={};_0x2afbbd[_0x2e0278[_0xe126('0x24')]]={'$like':'%'+_0x2b7c99[_0xe126('0x30')][_0xe126('0x36')]+'%'};return _0x2afbbd;}})});}_0x37a612=_[_0xe126('0x37')]({},_0x37a612,_0x2b7c99[_0xe126('0x39')]);var _0x132328={'where':_0x37a612[_0xe126('0x34')]};return db[_0xe126('0x27')][_0xe126('0x3a')](_0x132328)['then'](function(_0x1db324){_0x9c2c70[_0xe126('0x3a')]=_0x1db324;if(_0x2b7c99[_0xe126('0x30')][_0xe126('0x3b')]){_0x37a612[_0xe126('0x3c')]=[{'all':!![]}];}return db[_0xe126('0x27')][_0xe126('0x3d')](_0x37a612);})[_0xe126('0x21')](function(_0x59379b){_0x9c2c70['rows']=_0x59379b;return _0x9c2c70;})[_0xe126('0x21')](respondWithFilteredResult(_0x4d57d3,_0x37a612))['catch'](handleError(_0x4d57d3,null));};exports[_0xe126('0x3e')]=function(_0x284dc3,_0x423fb4){var _0x15a983={'raw':![],'where':{'id':_0x284dc3[_0xe126('0x3f')]['id']}},_0x2c6cb9={};_0x2c6cb9['model']=_['keys'](db[_0xe126('0x27')][_0xe126('0x28')]);_0x2c6cb9[_0xe126('0x30')]=_['keys'](_0x284dc3['query']);_0x2c6cb9['filters']=_[_0xe126('0x2d')](_0x2c6cb9[_0xe126('0x2a')],_0x2c6cb9['query']);_0x15a983[_0xe126('0x2e')]=_[_0xe126('0x2d')](_0x2c6cb9['model'],qs['fields'](_0x284dc3[_0xe126('0x30')][_0xe126('0x2f')]));_0x15a983[_0xe126('0x2e')]=_0x15a983['attributes'][_0xe126('0x31')]?_0x15a983[_0xe126('0x2e')]:_0x2c6cb9[_0xe126('0x2a')];if(_0x284dc3['query'][_0xe126('0x3b')]){_0x15a983['include']=[{'all':!![]}];}_0x15a983=_[_0xe126('0x37')]({},_0x15a983,_0x284dc3['options']);return db[_0xe126('0x27')][_0xe126('0x40')](_0x15a983)[_0xe126('0x21')](handleEntityNotFound(_0x423fb4,null))['then'](respondWithResult(_0x423fb4,null))[_0xe126('0x41')](handleError(_0x423fb4,null));};exports[_0xe126('0x42')]=function(_0x365a8f,_0x4d7b26){return db[_0xe126('0x27')][_0xe126('0x42')](_0x365a8f[_0xe126('0x43')],{})[_0xe126('0x21')](respondWithResult(_0x4d7b26,0xc9))[_0xe126('0x41')](handleError(_0x4d7b26,null));};exports['update']=function(_0x5109af,_0x5e26a4){if(_0x5109af[_0xe126('0x43')]['id']){delete _0x5109af[_0xe126('0x43')]['id'];}return db[_0xe126('0x27')][_0xe126('0x40')]({'where':{'id':_0x5109af[_0xe126('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5e26a4,null))[_0xe126('0x21')](saveUpdates(_0x5109af[_0xe126('0x43')],null))[_0xe126('0x21')](respondWithResult(_0x5e26a4,null))[_0xe126('0x41')](handleError(_0x5e26a4,null));};exports['destroy']=function(_0x193674,_0x4af519){return db['ZendeskConfiguration'][_0xe126('0x40')]({'where':{'id':_0x193674['params']['id']}})[_0xe126('0x21')](handleEntityNotFound(_0x4af519,null))[_0xe126('0x21')](removeEntity(_0x4af519,null))['catch'](handleError(_0x4af519,null));};exports['getFields']=function(_0x3914af,_0x289369,_0xb63b46){var _0x1affe2={};var _0x375990={};var _0x56f9a7;var _0x14edf8;return db[_0xe126('0x27')][_0xe126('0x44')]({'where':{'id':_0x3914af[_0xe126('0x3f')]['id']}})[_0xe126('0x21')](handleEntityNotFound(_0x289369,null))['then'](function(_0x34181b){if(_0x34181b){_0x56f9a7=_0x34181b;_0x375990[_0xe126('0x2a')]=_[_0xe126('0x2b')](db['ZendeskField'][_0xe126('0x28')]);_0x375990[_0xe126('0x30')]=_['keys'](_0x3914af[_0xe126('0x30')]);_0x375990[_0xe126('0x2c')]=_[_0xe126('0x2d')](_0x375990[_0xe126('0x2a')],_0x375990[_0xe126('0x30')]);_0x1affe2[_0xe126('0x2e')]=_[_0xe126('0x2d')](_0x375990['model'],qs[_0xe126('0x2f')](_0x3914af[_0xe126('0x30')][_0xe126('0x2f')]));_0x1affe2[_0xe126('0x2e')]=_0x1affe2['attributes']['length']?_0x1affe2[_0xe126('0x2e')]:_0x375990[_0xe126('0x2a')];_0x1affe2[_0xe126('0x33')]=qs[_0xe126('0x45')](_0x3914af[_0xe126('0x30')][_0xe126('0x45')]);_0x1affe2['where']=qs[_0xe126('0x2c')](_[_0xe126('0x35')](_0x3914af[_0xe126('0x30')],_0x375990[_0xe126('0x2c')]));if(_0x3914af['query']['filter']){_0x1affe2[_0xe126('0x34')]=_[_0xe126('0x37')](_0x1affe2[_0xe126('0x34')],{'$or':_[_0xe126('0x26')](_0x1affe2[_0xe126('0x2e')],function(_0x2335a1){var _0x20231b={};_0x20231b[_0x2335a1]={'$like':'%'+_0x3914af[_0xe126('0x30')][_0xe126('0x36')]+'%'};return _0x20231b;})});}_0x1affe2=_[_0xe126('0x37')]({},_0x1affe2,_0x3914af[_0xe126('0x39')]);return _0x56f9a7[_0xe126('0x46')](_0x1affe2);}})[_0xe126('0x21')](function(_0x2a899b){if(_0x2a899b){_0x14edf8=_0x2a899b['length'];if(!_0x3914af[_0xe126('0x30')][_0xe126('0x47')]('nolimit')){_0x1affe2[_0xe126('0x1e')]=qs['limit'](_0x3914af[_0xe126('0x30')][_0xe126('0x1e')]);_0x1affe2[_0xe126('0x1f')]=qs['offset'](_0x3914af[_0xe126('0x30')][_0xe126('0x1f')]);}return _0x56f9a7['getFields'](_0x1affe2);}})[_0xe126('0x21')](function(_0x20449c){if(_0x20449c){return _0x20449c?{'count':_0x14edf8,'rows':_0x20449c}:null;}})[_0xe126('0x21')](respondWithResult(_0x289369,null))[_0xe126('0x41')](handleError(_0x289369,null));};exports[_0xe126('0x48')]=function(_0x98d411,_0x2f9f46,_0x54e2c3){var _0x1412b5={};var _0x1cb175={};var _0x2a2b8d;var _0x216000;return db[_0xe126('0x27')][_0xe126('0x44')]({'where':{'id':_0x98d411[_0xe126('0x3f')]['id']}})[_0xe126('0x21')](handleEntityNotFound(_0x2f9f46,null))['then'](function(_0x33134e){if(_0x33134e){_0x2a2b8d=_0x33134e;_0x1cb175[_0xe126('0x2a')]=_[_0xe126('0x2b')](db[_0xe126('0x49')][_0xe126('0x28')]);_0x1cb175[_0xe126('0x30')]=_[_0xe126('0x2b')](_0x98d411[_0xe126('0x30')]);_0x1cb175['filters']=_['intersection'](_0x1cb175[_0xe126('0x2a')],_0x1cb175[_0xe126('0x30')]);_0x1412b5[_0xe126('0x2e')]=_[_0xe126('0x2d')](_0x1cb175[_0xe126('0x2a')],qs[_0xe126('0x2f')](_0x98d411[_0xe126('0x30')]['fields']));_0x1412b5[_0xe126('0x2e')]=_0x1412b5[_0xe126('0x2e')][_0xe126('0x31')]?_0x1412b5[_0xe126('0x2e')]:_0x1cb175[_0xe126('0x2a')];_0x1412b5[_0xe126('0x33')]=qs['sort'](_0x98d411[_0xe126('0x30')][_0xe126('0x45')]);_0x1412b5[_0xe126('0x34')]=qs['filters'](_[_0xe126('0x35')](_0x98d411[_0xe126('0x30')],_0x1cb175[_0xe126('0x2c')]));if(_0x98d411[_0xe126('0x30')][_0xe126('0x36')]){_0x1412b5['where']=_[_0xe126('0x37')](_0x1412b5['where'],{'$or':_['map'](_0x1412b5[_0xe126('0x2e')],function(_0x1a93bc){var _0x2bff30={};_0x2bff30[_0x1a93bc]={'$like':'%'+_0x98d411[_0xe126('0x30')][_0xe126('0x36')]+'%'};return _0x2bff30;})});}_0x1412b5=_[_0xe126('0x37')]({},_0x1412b5,_0x98d411[_0xe126('0x39')]);return _0x2a2b8d[_0xe126('0x48')](_0x1412b5);}})['then'](function(_0x5d8a45){if(_0x5d8a45){_0x216000=_0x5d8a45[_0xe126('0x31')];if(!_0x98d411[_0xe126('0x30')][_0xe126('0x47')](_0xe126('0x32'))){_0x1412b5['limit']=qs[_0xe126('0x1e')](_0x98d411[_0xe126('0x30')][_0xe126('0x1e')]);_0x1412b5[_0xe126('0x1f')]=qs[_0xe126('0x1f')](_0x98d411[_0xe126('0x30')][_0xe126('0x1f')]);}return _0x2a2b8d[_0xe126('0x48')](_0x1412b5);}})[_0xe126('0x21')](function(_0x107892){if(_0x107892){return _0x107892?{'count':_0x216000,'rows':_0x107892}:null;}})[_0xe126('0x21')](respondWithResult(_0x2f9f46,null))[_0xe126('0x41')](handleError(_0x2f9f46,null));};exports[_0xe126('0x4a')]=function(_0x3d629d,_0x23f275,_0x2faa04){var _0x4d3aa3={};var _0x1ff35e={};var _0x143499;var _0x513ecc;return db[_0xe126('0x27')]['findOne']({'where':{'id':_0x3d629d['params']['id']}})[_0xe126('0x21')](handleEntityNotFound(_0x23f275,null))[_0xe126('0x21')](function(_0x334c69){if(_0x334c69){_0x143499=_0x334c69;_0x1ff35e[_0xe126('0x2a')]=_[_0xe126('0x2b')](db[_0xe126('0x49')][_0xe126('0x28')]);_0x1ff35e[_0xe126('0x30')]=_[_0xe126('0x2b')](_0x3d629d['query']);_0x1ff35e[_0xe126('0x2c')]=_[_0xe126('0x2d')](_0x1ff35e['model'],_0x1ff35e[_0xe126('0x30')]);_0x4d3aa3[_0xe126('0x2e')]=_['intersection'](_0x1ff35e[_0xe126('0x2a')],qs['fields'](_0x3d629d[_0xe126('0x30')][_0xe126('0x2f')]));_0x4d3aa3[_0xe126('0x2e')]=_0x4d3aa3['attributes'][_0xe126('0x31')]?_0x4d3aa3[_0xe126('0x2e')]:_0x1ff35e['model'];_0x4d3aa3[_0xe126('0x33')]=qs[_0xe126('0x45')](_0x3d629d[_0xe126('0x30')][_0xe126('0x45')]);_0x4d3aa3[_0xe126('0x34')]=qs[_0xe126('0x2c')](_[_0xe126('0x35')](_0x3d629d[_0xe126('0x30')],_0x1ff35e[_0xe126('0x2c')]));if(_0x3d629d[_0xe126('0x30')]['filter']){_0x4d3aa3[_0xe126('0x34')]=_[_0xe126('0x37')](_0x4d3aa3[_0xe126('0x34')],{'$or':_[_0xe126('0x26')](_0x4d3aa3[_0xe126('0x2e')],function(_0x32fbf1){var _0x19b277={};_0x19b277[_0x32fbf1]={'$like':'%'+_0x3d629d[_0xe126('0x30')][_0xe126('0x36')]+'%'};return _0x19b277;})});}_0x4d3aa3=_[_0xe126('0x37')]({},_0x4d3aa3,_0x3d629d[_0xe126('0x39')]);return _0x143499[_0xe126('0x4a')](_0x4d3aa3);}})[_0xe126('0x21')](function(_0x8494ac){if(_0x8494ac){_0x513ecc=_0x8494ac[_0xe126('0x31')];if(!_0x3d629d['query']['hasOwnProperty']('nolimit')){_0x4d3aa3[_0xe126('0x1e')]=qs[_0xe126('0x1e')](_0x3d629d['query'][_0xe126('0x1e')]);_0x4d3aa3[_0xe126('0x1f')]=qs[_0xe126('0x1f')](_0x3d629d['query']['offset']);}return _0x143499[_0xe126('0x4a')](_0x4d3aa3);}})['then'](function(_0x5f590a){if(_0x5f590a){return _0x5f590a?{'count':_0x513ecc,'rows':_0x5f590a}:null;}})[_0xe126('0x21')](respondWithResult(_0x23f275,null))[_0xe126('0x41')](handleError(_0x23f275,null));};exports[_0xe126('0x4b')]=function(_0x2c0a1b,_0x4e0110,_0x4b8410){var _0x24666a={};var _0x5073ff={};var _0x562e84;var _0x4b0bd9;return db[_0xe126('0x27')][_0xe126('0x44')]({'where':{'id':_0x2c0a1b[_0xe126('0x3f')]['id']}})[_0xe126('0x21')](handleEntityNotFound(_0x4e0110,null))[_0xe126('0x21')](function(_0xc38df4){if(_0xc38df4){_0x562e84=_0xc38df4;_0x5073ff[_0xe126('0x2a')]=_['keys'](db['Tag']['rawAttributes']);_0x5073ff['query']=_['keys'](_0x2c0a1b['query']);_0x5073ff[_0xe126('0x2c')]=_[_0xe126('0x2d')](_0x5073ff[_0xe126('0x2a')],_0x5073ff['query']);_0x24666a[_0xe126('0x2e')]=_['intersection'](_0x5073ff[_0xe126('0x2a')],qs[_0xe126('0x2f')](_0x2c0a1b[_0xe126('0x30')]['fields']));_0x24666a[_0xe126('0x2e')]=_0x24666a[_0xe126('0x2e')][_0xe126('0x31')]?_0x24666a[_0xe126('0x2e')]:_0x5073ff[_0xe126('0x2a')];_0x24666a[_0xe126('0x33')]=qs[_0xe126('0x45')](_0x2c0a1b[_0xe126('0x30')][_0xe126('0x45')]);_0x24666a[_0xe126('0x34')]=qs[_0xe126('0x2c')](_[_0xe126('0x35')](_0x2c0a1b['query'],_0x5073ff[_0xe126('0x2c')]));if(_0x2c0a1b[_0xe126('0x30')]['filter']){_0x24666a[_0xe126('0x34')]=_[_0xe126('0x37')](_0x24666a[_0xe126('0x34')],{'$or':_['map'](_0x24666a[_0xe126('0x2e')],function(_0x563b55){var _0x591bb9={};_0x591bb9[_0x563b55]={'$like':'%'+_0x2c0a1b[_0xe126('0x30')][_0xe126('0x36')]+'%'};return _0x591bb9;})});}_0x24666a=_[_0xe126('0x37')]({},_0x24666a,_0x2c0a1b[_0xe126('0x39')]);return _0x562e84['getTags'](_0x24666a);}})[_0xe126('0x21')](function(_0x4f83c7){if(_0x4f83c7){_0x4b0bd9=_0x4f83c7[_0xe126('0x31')];if(!_0x2c0a1b[_0xe126('0x30')][_0xe126('0x47')]('nolimit')){_0x24666a[_0xe126('0x1e')]=qs[_0xe126('0x1e')](_0x2c0a1b[_0xe126('0x30')]['limit']);_0x24666a[_0xe126('0x1f')]=qs[_0xe126('0x1f')](_0x2c0a1b[_0xe126('0x30')]['offset']);}return _0x562e84[_0xe126('0x4b')](_0x24666a);}})[_0xe126('0x21')](function(_0x263c90){if(_0x263c90){return _0x263c90?{'count':_0x4b0bd9,'rows':_0x263c90}:null;}})['then'](respondWithResult(_0x4e0110,null))[_0xe126('0x41')](handleError(_0x4e0110,null));};exports[_0xe126('0x4c')]=function(_0x17283b,_0x23af89,_0x3a509e){if(_0x17283b[_0xe126('0x43')]['id']){delete _0x17283b['body']['id'];}return db[_0xe126('0x27')][_0xe126('0x44')]({'where':{'id':_0x17283b[_0xe126('0x3f')]['id']}})[_0xe126('0x21')](handleEntityNotFound(_0x23af89,null))[_0xe126('0x21')](function(_0xc1b58b){if(_0xc1b58b){return _0xc1b58b[_0xe126('0x4c')](_0x17283b[_0xe126('0x43')][_0xe126('0x4d')]||[]);}return null;})[_0xe126('0x21')](respondWithResult(_0x23af89,null))[_0xe126('0x41')](handleError(_0x23af89,null));}; \ No newline at end of file +var _0x4d0e=['getSubjects','getDescriptions','findOne','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','merge','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','destroy','getFields','ZendeskField','pick'];(function(_0x53b133,_0x176261){var _0x5647e0=function(_0x4c62b0){while(--_0x4c62b0){_0x53b133['push'](_0x53b133['shift']());}};_0x5647e0(++_0x176261);}(_0x4d0e,0x1e6));var _0xe4d0=function(_0x2ded3e,_0x49d938){_0x2ded3e=_0x2ded3e-0x0;var _0x1e3312=_0x4d0e[_0x2ded3e];return _0x1e3312;};'use strict';var emlformat=require(_0xe4d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4d0('0x1'));var jsonpatch=require(_0xe4d0('0x2'));var rp=require(_0xe4d0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe4d0('0x4'));var util=require(_0xe4d0('0x5'));var path=require('path');var sox=require(_0xe4d0('0x6'));var csv=require(_0xe4d0('0x7'));var ejs=require(_0xe4d0('0x8'));var fs=require('fs');var fs_extra=require(_0xe4d0('0x9'));var _=require('lodash');var squel=require(_0xe4d0('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe4d0('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe4d0('0xc'));var Papa=require(_0xe4d0('0xd'));var Redis=require('ioredis');var authService=require(_0xe4d0('0xe'));var qs=require(_0xe4d0('0xf'));var as=require(_0xe4d0('0x10'));var hardwareService=require(_0xe4d0('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xe4d0('0x12'));var config=require(_0xe4d0('0x13'));var licenseUtil=require(_0xe4d0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3466a1,_0x2e4684){_0x2e4684=_0x2e4684||0xcc;return function(_0x35d07d){if(_0x35d07d){return _0x3466a1['sendStatus'](_0x2e4684);}return _0x3466a1[_0xe4d0('0x15')](_0x2e4684)[_0xe4d0('0x16')]();};}function respondWithResult(_0x3b5b26,_0x481e80){_0x481e80=_0x481e80||0xc8;return function(_0x3de2a3){if(_0x3de2a3){return _0x3b5b26[_0xe4d0('0x15')](_0x481e80)[_0xe4d0('0x17')](_0x3de2a3);}};}function respondWithFilteredResult(_0x56917e,_0x26e913){return function(_0x41305d){if(_0x41305d){var _0x440d0e=typeof _0x26e913['offset']==='undefined'&&typeof _0x26e913[_0xe4d0('0x18')]===_0xe4d0('0x19');var _0x1c8842=_0x41305d[_0xe4d0('0x1a')];var _0x2dff59=_0x440d0e?0x0:_0x26e913['offset'];var _0x3a4b19=_0x440d0e?_0x41305d[_0xe4d0('0x1a')]:_0x26e913['offset']+_0x26e913[_0xe4d0('0x18')];var _0xc54b4c;if(_0x3a4b19>=_0x1c8842){_0x3a4b19=_0x1c8842;_0xc54b4c=0xc8;}else{_0xc54b4c=0xce;}_0x56917e['status'](_0xc54b4c);return _0x56917e[_0xe4d0('0x1b')](_0xe4d0('0x1c'),_0x2dff59+'-'+_0x3a4b19+'/'+_0x1c8842)[_0xe4d0('0x17')](_0x41305d);}return null;};}function patchUpdates(_0x5d15bf){return function(_0x5ea9e8){try{jsonpatch[_0xe4d0('0x1d')](_0x5ea9e8,_0x5d15bf,!![]);}catch(_0x1ce8ee){return BPromise[_0xe4d0('0x1e')](_0x1ce8ee);}return _0x5ea9e8[_0xe4d0('0x1f')]();};}function saveUpdates(_0x4ecb2c,_0x236f67){return function(_0x56be56){if(_0x56be56){return _0x56be56[_0xe4d0('0x20')](_0x4ecb2c)[_0xe4d0('0x21')](function(_0x3cc1a5){return _0x3cc1a5;});}return null;};}function removeEntity(_0x223670,_0x49798b){return function(_0x3326d6){if(_0x3326d6){return _0x3326d6['destroy']()[_0xe4d0('0x21')](function(){_0x223670[_0xe4d0('0x15')](0xcc)[_0xe4d0('0x16')]();});}};}function handleEntityNotFound(_0x2201a6,_0x12ce6d){return function(_0x3ac41f){if(!_0x3ac41f){_0x2201a6['sendStatus'](0x194);}return _0x3ac41f;};}function handleError(_0x221f8b,_0x5dde81){_0x5dde81=_0x5dde81||0x1f4;return function(_0x402286){logger[_0xe4d0('0x22')](_0x402286['stack']);if(_0x402286['name']){delete _0x402286[_0xe4d0('0x23')];}_0x221f8b['status'](_0x5dde81)[_0xe4d0('0x24')](_0x402286);};}exports[_0xe4d0('0x25')]=function(_0x2313ad,_0x52b096){var _0x4acdfd={},_0x575b51={},_0x128b52={'count':0x0,'rows':[]};var _0x48f284=_[_0xe4d0('0x26')](db[_0xe4d0('0x27')][_0xe4d0('0x28')],function(_0x5d0c67){return{'name':_0x5d0c67[_0xe4d0('0x29')],'type':_0x5d0c67[_0xe4d0('0x2a')]['key']};});_0x575b51[_0xe4d0('0x2b')]=_['map'](_0x48f284,_0xe4d0('0x23'));_0x575b51['query']=_[_0xe4d0('0x2c')](_0x2313ad[_0xe4d0('0x2d')]);_0x575b51[_0xe4d0('0x2e')]=_['intersection'](_0x575b51[_0xe4d0('0x2b')],_0x575b51['query']);_0x4acdfd[_0xe4d0('0x2f')]=_[_0xe4d0('0x30')](_0x575b51['model'],qs['fields'](_0x2313ad[_0xe4d0('0x2d')][_0xe4d0('0x31')]));_0x4acdfd['attributes']=_0x4acdfd[_0xe4d0('0x2f')]['length']?_0x4acdfd[_0xe4d0('0x2f')]:_0x575b51[_0xe4d0('0x2b')];if(!_0x2313ad[_0xe4d0('0x2d')][_0xe4d0('0x32')](_0xe4d0('0x33'))){_0x4acdfd[_0xe4d0('0x18')]=qs['limit'](_0x2313ad[_0xe4d0('0x2d')]['limit']);_0x4acdfd[_0xe4d0('0x34')]=qs[_0xe4d0('0x34')](_0x2313ad[_0xe4d0('0x2d')][_0xe4d0('0x34')]);}_0x4acdfd[_0xe4d0('0x35')]=qs[_0xe4d0('0x36')](_0x2313ad[_0xe4d0('0x2d')][_0xe4d0('0x36')]);_0x4acdfd[_0xe4d0('0x37')]=qs[_0xe4d0('0x2e')](_['pick'](_0x2313ad[_0xe4d0('0x2d')],_0x575b51[_0xe4d0('0x2e')]),_0x48f284);if(_0x2313ad[_0xe4d0('0x2d')]['filter']){_0x4acdfd['where']=_[_0xe4d0('0x38')](_0x4acdfd['where'],{'$or':_[_0xe4d0('0x26')](_0x48f284,function(_0x3c53cc){if(_0x3c53cc[_0xe4d0('0x2a')]!=='VIRTUAL'){var _0x37a904={};_0x37a904[_0x3c53cc[_0xe4d0('0x23')]]={'$like':'%'+_0x2313ad[_0xe4d0('0x2d')][_0xe4d0('0x39')]+'%'};return _0x37a904;}})});}_0x4acdfd=_[_0xe4d0('0x38')]({},_0x4acdfd,_0x2313ad[_0xe4d0('0x3a')]);var _0x27f0d1={'where':_0x4acdfd['where']};return db[_0xe4d0('0x27')]['count'](_0x27f0d1)[_0xe4d0('0x21')](function(_0x4b2f3f){_0x128b52[_0xe4d0('0x1a')]=_0x4b2f3f;if(_0x2313ad[_0xe4d0('0x2d')]['includeAll']){_0x4acdfd[_0xe4d0('0x3b')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xe4d0('0x3c')](_0x4acdfd);})[_0xe4d0('0x21')](function(_0x14318a){_0x128b52[_0xe4d0('0x3d')]=_0x14318a;return _0x128b52;})['then'](respondWithFilteredResult(_0x52b096,_0x4acdfd))[_0xe4d0('0x3e')](handleError(_0x52b096,null));};exports[_0xe4d0('0x3f')]=function(_0x279337,_0xeefcab){var _0x4d0246={'raw':![],'where':{'id':_0x279337[_0xe4d0('0x40')]['id']}},_0x2ae1b5={};_0x2ae1b5[_0xe4d0('0x2b')]=_[_0xe4d0('0x2c')](db[_0xe4d0('0x27')][_0xe4d0('0x28')]);_0x2ae1b5[_0xe4d0('0x2d')]=_[_0xe4d0('0x2c')](_0x279337['query']);_0x2ae1b5[_0xe4d0('0x2e')]=_['intersection'](_0x2ae1b5[_0xe4d0('0x2b')],_0x2ae1b5[_0xe4d0('0x2d')]);_0x4d0246['attributes']=_['intersection'](_0x2ae1b5[_0xe4d0('0x2b')],qs[_0xe4d0('0x31')](_0x279337[_0xe4d0('0x2d')][_0xe4d0('0x31')]));_0x4d0246[_0xe4d0('0x2f')]=_0x4d0246[_0xe4d0('0x2f')][_0xe4d0('0x41')]?_0x4d0246[_0xe4d0('0x2f')]:_0x2ae1b5[_0xe4d0('0x2b')];if(_0x279337[_0xe4d0('0x2d')][_0xe4d0('0x42')]){_0x4d0246['include']=[{'all':!![]}];}_0x4d0246=_['merge']({},_0x4d0246,_0x279337[_0xe4d0('0x3a')]);return db['ZendeskConfiguration'][_0xe4d0('0x43')](_0x4d0246)[_0xe4d0('0x21')](handleEntityNotFound(_0xeefcab,null))['then'](respondWithResult(_0xeefcab,null))['catch'](handleError(_0xeefcab,null));};exports['create']=function(_0x567ecb,_0x42e15c){return db[_0xe4d0('0x27')][_0xe4d0('0x44')](_0x567ecb['body'],{})['then'](respondWithResult(_0x42e15c,0xc9))[_0xe4d0('0x3e')](handleError(_0x42e15c,null));};exports[_0xe4d0('0x20')]=function(_0x4dae32,_0x113e9f){if(_0x4dae32[_0xe4d0('0x45')]['id']){delete _0x4dae32[_0xe4d0('0x45')]['id'];}return db[_0xe4d0('0x27')][_0xe4d0('0x43')]({'where':{'id':_0x4dae32[_0xe4d0('0x40')]['id']}})['then'](handleEntityNotFound(_0x113e9f,null))['then'](saveUpdates(_0x4dae32['body'],null))['then'](respondWithResult(_0x113e9f,null))[_0xe4d0('0x3e')](handleError(_0x113e9f,null));};exports[_0xe4d0('0x46')]=function(_0x11609,_0x25f928){return db[_0xe4d0('0x27')][_0xe4d0('0x43')]({'where':{'id':_0x11609[_0xe4d0('0x40')]['id']}})[_0xe4d0('0x21')](handleEntityNotFound(_0x25f928,null))[_0xe4d0('0x21')](removeEntity(_0x25f928,null))[_0xe4d0('0x3e')](handleError(_0x25f928,null));};exports[_0xe4d0('0x47')]=function(_0x5cf204,_0x53bda0,_0x14fccb){var _0x20fa36={};var _0x549727={};var _0x4be078;var _0x226892;return db[_0xe4d0('0x27')]['findOne']({'where':{'id':_0x5cf204['params']['id']}})['then'](handleEntityNotFound(_0x53bda0,null))[_0xe4d0('0x21')](function(_0x8f5e90){if(_0x8f5e90){_0x4be078=_0x8f5e90;_0x549727[_0xe4d0('0x2b')]=_[_0xe4d0('0x2c')](db[_0xe4d0('0x48')][_0xe4d0('0x28')]);_0x549727[_0xe4d0('0x2d')]=_[_0xe4d0('0x2c')](_0x5cf204['query']);_0x549727[_0xe4d0('0x2e')]=_[_0xe4d0('0x30')](_0x549727[_0xe4d0('0x2b')],_0x549727[_0xe4d0('0x2d')]);_0x20fa36[_0xe4d0('0x2f')]=_['intersection'](_0x549727['model'],qs['fields'](_0x5cf204['query'][_0xe4d0('0x31')]));_0x20fa36['attributes']=_0x20fa36['attributes'][_0xe4d0('0x41')]?_0x20fa36[_0xe4d0('0x2f')]:_0x549727[_0xe4d0('0x2b')];_0x20fa36[_0xe4d0('0x35')]=qs['sort'](_0x5cf204[_0xe4d0('0x2d')][_0xe4d0('0x36')]);_0x20fa36['where']=qs[_0xe4d0('0x2e')](_[_0xe4d0('0x49')](_0x5cf204['query'],_0x549727[_0xe4d0('0x2e')]));if(_0x5cf204[_0xe4d0('0x2d')][_0xe4d0('0x39')]){_0x20fa36[_0xe4d0('0x37')]=_[_0xe4d0('0x38')](_0x20fa36[_0xe4d0('0x37')],{'$or':_[_0xe4d0('0x26')](_0x20fa36['attributes'],function(_0x14573d){var _0x1ee651={};_0x1ee651[_0x14573d]={'$like':'%'+_0x5cf204[_0xe4d0('0x2d')]['filter']+'%'};return _0x1ee651;})});}_0x20fa36=_[_0xe4d0('0x38')]({},_0x20fa36,_0x5cf204[_0xe4d0('0x3a')]);return _0x4be078[_0xe4d0('0x47')](_0x20fa36);}})[_0xe4d0('0x21')](function(_0x3be8b4){if(_0x3be8b4){_0x226892=_0x3be8b4['length'];if(!_0x5cf204['query'][_0xe4d0('0x32')](_0xe4d0('0x33'))){_0x20fa36[_0xe4d0('0x18')]=qs[_0xe4d0('0x18')](_0x5cf204[_0xe4d0('0x2d')][_0xe4d0('0x18')]);_0x20fa36[_0xe4d0('0x34')]=qs[_0xe4d0('0x34')](_0x5cf204[_0xe4d0('0x2d')]['offset']);}return _0x4be078[_0xe4d0('0x47')](_0x20fa36);}})[_0xe4d0('0x21')](function(_0x265b6a){if(_0x265b6a){return _0x265b6a?{'count':_0x226892,'rows':_0x265b6a}:null;}})[_0xe4d0('0x21')](respondWithResult(_0x53bda0,null))['catch'](handleError(_0x53bda0,null));};exports[_0xe4d0('0x4a')]=function(_0x565799,_0x548795,_0x1bb153){var _0x818f71={};var _0xa86504={};var _0x4298b9;var _0x434f8f;return db[_0xe4d0('0x27')]['findOne']({'where':{'id':_0x565799[_0xe4d0('0x40')]['id']}})[_0xe4d0('0x21')](handleEntityNotFound(_0x548795,null))[_0xe4d0('0x21')](function(_0xd31e05){if(_0xd31e05){_0x4298b9=_0xd31e05;_0xa86504['model']=_[_0xe4d0('0x2c')](db['ZendeskField'][_0xe4d0('0x28')]);_0xa86504[_0xe4d0('0x2d')]=_[_0xe4d0('0x2c')](_0x565799['query']);_0xa86504[_0xe4d0('0x2e')]=_[_0xe4d0('0x30')](_0xa86504[_0xe4d0('0x2b')],_0xa86504['query']);_0x818f71['attributes']=_[_0xe4d0('0x30')](_0xa86504[_0xe4d0('0x2b')],qs[_0xe4d0('0x31')](_0x565799['query'][_0xe4d0('0x31')]));_0x818f71[_0xe4d0('0x2f')]=_0x818f71[_0xe4d0('0x2f')]['length']?_0x818f71[_0xe4d0('0x2f')]:_0xa86504[_0xe4d0('0x2b')];_0x818f71['order']=qs[_0xe4d0('0x36')](_0x565799[_0xe4d0('0x2d')]['sort']);_0x818f71['where']=qs[_0xe4d0('0x2e')](_[_0xe4d0('0x49')](_0x565799[_0xe4d0('0x2d')],_0xa86504['filters']));if(_0x565799['query'][_0xe4d0('0x39')]){_0x818f71[_0xe4d0('0x37')]=_[_0xe4d0('0x38')](_0x818f71['where'],{'$or':_[_0xe4d0('0x26')](_0x818f71[_0xe4d0('0x2f')],function(_0x5e70b2){var _0xf1847={};_0xf1847[_0x5e70b2]={'$like':'%'+_0x565799[_0xe4d0('0x2d')]['filter']+'%'};return _0xf1847;})});}_0x818f71=_[_0xe4d0('0x38')]({},_0x818f71,_0x565799[_0xe4d0('0x3a')]);return _0x4298b9['getSubjects'](_0x818f71);}})[_0xe4d0('0x21')](function(_0x3567d6){if(_0x3567d6){_0x434f8f=_0x3567d6['length'];if(!_0x565799[_0xe4d0('0x2d')]['hasOwnProperty'](_0xe4d0('0x33'))){_0x818f71[_0xe4d0('0x18')]=qs[_0xe4d0('0x18')](_0x565799[_0xe4d0('0x2d')][_0xe4d0('0x18')]);_0x818f71[_0xe4d0('0x34')]=qs[_0xe4d0('0x34')](_0x565799[_0xe4d0('0x2d')][_0xe4d0('0x34')]);}return _0x4298b9[_0xe4d0('0x4a')](_0x818f71);}})[_0xe4d0('0x21')](function(_0x3a1024){if(_0x3a1024){return _0x3a1024?{'count':_0x434f8f,'rows':_0x3a1024}:null;}})[_0xe4d0('0x21')](respondWithResult(_0x548795,null))[_0xe4d0('0x3e')](handleError(_0x548795,null));};exports[_0xe4d0('0x4b')]=function(_0x52f40c,_0x3e3347,_0x363b93){var _0x42aab7={};var _0x2ecb3f={};var _0x2b5638;var _0x4f42f3;return db[_0xe4d0('0x27')][_0xe4d0('0x4c')]({'where':{'id':_0x52f40c[_0xe4d0('0x40')]['id']}})[_0xe4d0('0x21')](handleEntityNotFound(_0x3e3347,null))[_0xe4d0('0x21')](function(_0x510852){if(_0x510852){_0x2b5638=_0x510852;_0x2ecb3f[_0xe4d0('0x2b')]=_[_0xe4d0('0x2c')](db[_0xe4d0('0x48')][_0xe4d0('0x28')]);_0x2ecb3f[_0xe4d0('0x2d')]=_['keys'](_0x52f40c[_0xe4d0('0x2d')]);_0x2ecb3f['filters']=_[_0xe4d0('0x30')](_0x2ecb3f[_0xe4d0('0x2b')],_0x2ecb3f[_0xe4d0('0x2d')]);_0x42aab7['attributes']=_[_0xe4d0('0x30')](_0x2ecb3f[_0xe4d0('0x2b')],qs['fields'](_0x52f40c['query'][_0xe4d0('0x31')]));_0x42aab7[_0xe4d0('0x2f')]=_0x42aab7[_0xe4d0('0x2f')][_0xe4d0('0x41')]?_0x42aab7[_0xe4d0('0x2f')]:_0x2ecb3f[_0xe4d0('0x2b')];_0x42aab7['order']=qs[_0xe4d0('0x36')](_0x52f40c[_0xe4d0('0x2d')][_0xe4d0('0x36')]);_0x42aab7[_0xe4d0('0x37')]=qs[_0xe4d0('0x2e')](_[_0xe4d0('0x49')](_0x52f40c[_0xe4d0('0x2d')],_0x2ecb3f[_0xe4d0('0x2e')]));if(_0x52f40c['query'][_0xe4d0('0x39')]){_0x42aab7[_0xe4d0('0x37')]=_[_0xe4d0('0x38')](_0x42aab7[_0xe4d0('0x37')],{'$or':_[_0xe4d0('0x26')](_0x42aab7[_0xe4d0('0x2f')],function(_0x1f4086){var _0x2e0d83={};_0x2e0d83[_0x1f4086]={'$like':'%'+_0x52f40c['query'][_0xe4d0('0x39')]+'%'};return _0x2e0d83;})});}_0x42aab7=_['merge']({},_0x42aab7,_0x52f40c[_0xe4d0('0x3a')]);return _0x2b5638[_0xe4d0('0x4b')](_0x42aab7);}})['then'](function(_0x15bef0){if(_0x15bef0){_0x4f42f3=_0x15bef0[_0xe4d0('0x41')];if(!_0x52f40c[_0xe4d0('0x2d')][_0xe4d0('0x32')](_0xe4d0('0x33'))){_0x42aab7[_0xe4d0('0x18')]=qs[_0xe4d0('0x18')](_0x52f40c[_0xe4d0('0x2d')][_0xe4d0('0x18')]);_0x42aab7['offset']=qs[_0xe4d0('0x34')](_0x52f40c[_0xe4d0('0x2d')]['offset']);}return _0x2b5638[_0xe4d0('0x4b')](_0x42aab7);}})[_0xe4d0('0x21')](function(_0x296dca){if(_0x296dca){return _0x296dca?{'count':_0x4f42f3,'rows':_0x296dca}:null;}})['then'](respondWithResult(_0x3e3347,null))[_0xe4d0('0x3e')](handleError(_0x3e3347,null));};exports[_0xe4d0('0x4d')]=function(_0x547d0d,_0x1bf6ac,_0x49fd6f){var _0x51faaf={};var _0x564afb={};var _0x214070;var _0x245f24;return db[_0xe4d0('0x27')][_0xe4d0('0x4c')]({'where':{'id':_0x547d0d[_0xe4d0('0x40')]['id']}})[_0xe4d0('0x21')](handleEntityNotFound(_0x1bf6ac,null))[_0xe4d0('0x21')](function(_0x24c825){if(_0x24c825){_0x214070=_0x24c825;_0x564afb[_0xe4d0('0x2b')]=_[_0xe4d0('0x2c')](db[_0xe4d0('0x4e')][_0xe4d0('0x28')]);_0x564afb[_0xe4d0('0x2d')]=_[_0xe4d0('0x2c')](_0x547d0d[_0xe4d0('0x2d')]);_0x564afb[_0xe4d0('0x2e')]=_['intersection'](_0x564afb[_0xe4d0('0x2b')],_0x564afb['query']);_0x51faaf[_0xe4d0('0x2f')]=_[_0xe4d0('0x30')](_0x564afb[_0xe4d0('0x2b')],qs[_0xe4d0('0x31')](_0x547d0d[_0xe4d0('0x2d')][_0xe4d0('0x31')]));_0x51faaf[_0xe4d0('0x2f')]=_0x51faaf[_0xe4d0('0x2f')][_0xe4d0('0x41')]?_0x51faaf['attributes']:_0x564afb[_0xe4d0('0x2b')];_0x51faaf[_0xe4d0('0x35')]=qs[_0xe4d0('0x36')](_0x547d0d['query'][_0xe4d0('0x36')]);_0x51faaf[_0xe4d0('0x37')]=qs[_0xe4d0('0x2e')](_[_0xe4d0('0x49')](_0x547d0d[_0xe4d0('0x2d')],_0x564afb[_0xe4d0('0x2e')]));if(_0x547d0d[_0xe4d0('0x2d')][_0xe4d0('0x39')]){_0x51faaf['where']=_['merge'](_0x51faaf[_0xe4d0('0x37')],{'$or':_[_0xe4d0('0x26')](_0x51faaf[_0xe4d0('0x2f')],function(_0xf5d23f){var _0xe1b7={};_0xe1b7[_0xf5d23f]={'$like':'%'+_0x547d0d[_0xe4d0('0x2d')][_0xe4d0('0x39')]+'%'};return _0xe1b7;})});}_0x51faaf=_['merge']({},_0x51faaf,_0x547d0d[_0xe4d0('0x3a')]);return _0x214070[_0xe4d0('0x4d')](_0x51faaf);}})['then'](function(_0x3b5868){if(_0x3b5868){_0x245f24=_0x3b5868[_0xe4d0('0x41')];if(!_0x547d0d['query'][_0xe4d0('0x32')](_0xe4d0('0x33'))){_0x51faaf[_0xe4d0('0x18')]=qs[_0xe4d0('0x18')](_0x547d0d[_0xe4d0('0x2d')][_0xe4d0('0x18')]);_0x51faaf[_0xe4d0('0x34')]=qs[_0xe4d0('0x34')](_0x547d0d[_0xe4d0('0x2d')][_0xe4d0('0x34')]);}return _0x214070['getTags'](_0x51faaf);}})[_0xe4d0('0x21')](function(_0x528a50){if(_0x528a50){return _0x528a50?{'count':_0x245f24,'rows':_0x528a50}:null;}})['then'](respondWithResult(_0x1bf6ac,null))['catch'](handleError(_0x1bf6ac,null));};exports[_0xe4d0('0x4f')]=function(_0x24c4c7,_0xf9e0ce,_0x234dad){if(_0x24c4c7[_0xe4d0('0x45')]['id']){delete _0x24c4c7['body']['id'];}return db['ZendeskConfiguration'][_0xe4d0('0x4c')]({'where':{'id':_0x24c4c7[_0xe4d0('0x40')]['id']}})['then'](handleEntityNotFound(_0xf9e0ce,null))['then'](function(_0x4763ac){if(_0x4763ac){return _0x4763ac['setTags'](_0x24c4c7[_0xe4d0('0x45')]['ids']||[]);}return null;})[_0xe4d0('0x21')](respondWithResult(_0xf9e0ce,null))[_0xe4d0('0x3e')](handleError(_0xf9e0ce,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index cb0757f..ea70e35 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 _0xdb94=['lodash','util','../../config/logger','api','moment','request-promise','path','./intZendeskConfiguration.attributes','ZendeskConfiguration'];(function(_0x580a9f,_0x2fde4c){var _0x7bac9f=function(_0x3d59e2){while(--_0x3d59e2){_0x580a9f['push'](_0x580a9f['shift']());}};_0x7bac9f(++_0x2fde4c);}(_0xdb94,0xab));var _0x4db9=function(_0x8c7ccf,_0xe3f870){_0x8c7ccf=_0x8c7ccf-0x0;var _0x54f922=_0xdb94[_0x8c7ccf];return _0x54f922;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var logger=require(_0x4db9('0x2'))(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require('bluebird');var rp=require(_0x4db9('0x5'));var fs=require('fs');var path=require(_0x4db9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x47a3f5,_0x31dd9f){return _0x47a3f5['define'](_0x4db9('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e3f=['request-promise','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5c8879,_0x2b73cc){var _0x34bf6b=function(_0x506896){while(--_0x506896){_0x5c8879['push'](_0x5c8879['shift']());}};_0x34bf6b(++_0x2b73cc);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0xf8e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index d3b8826..65216e1 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 _0x7fe7=['message','info','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0xcf1a0c,_0x4784d8){var _0x53e435=function(_0x51762c){while(--_0x51762c){_0xcf1a0c['push'](_0xcf1a0c['shift']());}};_0x53e435(++_0x4784d8);}(_0x7fe7,0x1b7));var _0x77fe=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x7fe7[_0x575057];return _0x49dbc8;};'use strict';var _=require(_0x77fe('0x0'));var util=require(_0x77fe('0x1'));var moment=require(_0x77fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x77fe('0x3'));var fs=require('fs');var Redis=require(_0x77fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x77fe('0x5'))(_0x77fe('0x6'));var config=require(_0x77fe('0x7'));var jayson=require(_0x77fe('0x8'));var client=jayson[_0x77fe('0x9')][_0x77fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbfcc43,_0x40f4a4,_0x45d6cb){return new BPromise(function(_0x2e0e93,_0x9ae382){return client[_0x77fe('0xb')](_0xbfcc43,_0x45d6cb)[_0x77fe('0xc')](function(_0x15e430){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x40f4a4,'request\x20sent');logger['debug'](_0x77fe('0xd'),_0x40f4a4,'request\x20sent',JSON['stringify'](_0x15e430));if(_0x15e430['error']){if(_0x15e430[_0x77fe('0xe')][_0x77fe('0xf')]===0x1f4){logger['error'](_0x77fe('0x10'),_0x40f4a4,_0x15e430[_0x77fe('0xe')][_0x77fe('0x11')]);return _0x9ae382(_0x15e430[_0x77fe('0xe')][_0x77fe('0x11')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x40f4a4,_0x15e430['error'][_0x77fe('0x11')]);return _0x2e0e93(_0x15e430[_0x77fe('0xe')]['message']);}else{logger[_0x77fe('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x40f4a4,'request\x20sent');_0x2e0e93(_0x15e430['result']['message']);}})['catch'](function(_0x210dba){logger[_0x77fe('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x40f4a4,_0x210dba);_0x9ae382(_0x210dba);});});} \ No newline at end of file +var _0x27e2=['rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20ae13,_0x2a0c8e){var _0x533fd5=function(_0x3bb746){while(--_0x3bb746){_0x20ae13['push'](_0x20ae13['shift']());}};_0x533fd5(++_0x2a0c8e);}(_0x27e2,0x1f2));var _0x227e=function(_0x4a706f,_0x3018f0){_0x4a706f=_0x4a706f-0x0;var _0x5458f4=_0x27e2[_0x4a706f];return _0x5458f4;};'use strict';var _=require(_0x227e('0x0'));var util=require(_0x227e('0x1'));var moment=require(_0x227e('0x2'));var BPromise=require(_0x227e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x227e('0x4'));var db=require(_0x227e('0x5'))['db'];var utils=require(_0x227e('0x6'));var logger=require(_0x227e('0x7'))(_0x227e('0x8'));var config=require(_0x227e('0x9'));var jayson=require(_0x227e('0xa'));var client=jayson[_0x227e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2da55d,_0x44e18d,_0x3a6d31){return new BPromise(function(_0x66e9e6,_0x592d76){return client[_0x227e('0xc')](_0x2da55d,_0x3a6d31)['then'](function(_0x4f2519){logger[_0x227e('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x44e18d,_0x227e('0xe'));logger['debug'](_0x227e('0xf'),_0x44e18d,_0x227e('0xe'),JSON[_0x227e('0x10')](_0x4f2519));if(_0x4f2519['error']){if(_0x4f2519[_0x227e('0x11')][_0x227e('0x12')]===0x1f4){logger['error'](_0x227e('0x13'),_0x44e18d,_0x4f2519[_0x227e('0x11')][_0x227e('0x14')]);return _0x592d76(_0x4f2519[_0x227e('0x11')]['message']);}logger[_0x227e('0x11')](_0x227e('0x13'),_0x44e18d,_0x4f2519[_0x227e('0x11')][_0x227e('0x14')]);return _0x66e9e6(_0x4f2519[_0x227e('0x11')][_0x227e('0x14')]);}else{logger[_0x227e('0xd')](_0x227e('0x13'),_0x44e18d,_0x227e('0xe'));_0x66e9e6(_0x4f2519[_0x227e('0x15')][_0x227e('0x14')]);}})[_0x227e('0x16')](function(_0x40b593){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x44e18d,_0x40b593);_0x592d76(_0x40b593);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index fa723ab..b293fe9 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 _0x1f62=['show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0x1f62,0x1aa));var _0x21f6=function(_0x198d2a,_0x510eb7){_0x198d2a=_0x198d2a-0x0;var _0xfda34d=_0x1f62[_0x198d2a];return _0xfda34d;};'use strict';var multer=require(_0x21f6('0x0'));var util=require(_0x21f6('0x1'));var path=require(_0x21f6('0x2'));var timeout=require(_0x21f6('0x3'));var express=require(_0x21f6('0x4'));var router=express[_0x21f6('0x5')]();var fs_extra=require(_0x21f6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x21f6('0x7'));var config=require(_0x21f6('0x8'));var controller=require(_0x21f6('0x9'));router[_0x21f6('0xa')]('/',auth['isAuthenticated'](),controller[_0x21f6('0xb')]);router[_0x21f6('0xa')](_0x21f6('0xc'),auth[_0x21f6('0xd')](),controller[_0x21f6('0xe')]);router[_0x21f6('0xf')]('/',auth[_0x21f6('0xd')](),controller['create']);router['put'](_0x21f6('0xc'),auth[_0x21f6('0xd')](),controller[_0x21f6('0x10')]);router[_0x21f6('0x11')](_0x21f6('0xc'),auth[_0x21f6('0xd')](),controller[_0x21f6('0x12')]);module[_0x21f6('0x13')]=router; \ No newline at end of file +var _0x7376=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','index','get','show','post','isAuthenticated','create','put','/:id'];(function(_0x4e1fa5,_0x2af818){var _0x58685e=function(_0x1dc109){while(--_0x1dc109){_0x4e1fa5['push'](_0x4e1fa5['shift']());}};_0x58685e(++_0x2af818);}(_0x7376,0x142));var _0x6737=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7376[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x6737('0x0'));var util=require(_0x6737('0x1'));var path=require(_0x6737('0x2'));var timeout=require(_0x6737('0x3'));var express=require('express');var router=express[_0x6737('0x4')]();var fs_extra=require(_0x6737('0x5'));var auth=require(_0x6737('0x6'));var interaction=require(_0x6737('0x7'));var config=require(_0x6737('0x8'));var controller=require(_0x6737('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6737('0xa')]);router[_0x6737('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x6737('0xc')]);router[_0x6737('0xd')]('/',auth[_0x6737('0xe')](),controller[_0x6737('0xf')]);router[_0x6737('0x10')](_0x6737('0x11'),auth[_0x6737('0xe')](),controller['update']);router['delete'](_0x6737('0x11'),auth[_0x6737('0xe')](),controller[_0x6737('0x12')]);module[_0x6737('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 578dde8..3316d97 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 _0x9af8=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0xa1e030,_0x579969){var _0x1619bb=function(_0x108f53){while(--_0x108f53){_0xa1e030['push'](_0xa1e030['shift']());}};_0x1619bb(++_0x579969);}(_0x9af8,0x181));var _0x89af=function(_0x11fbda,_0x4c206f){_0x11fbda=_0x11fbda-0x0;var _0x56cc2f=_0x9af8[_0x11fbda];return _0x56cc2f;};'use strict';var Sequelize=require(_0x89af('0x0'));module[_0x89af('0x1')]={'type':{'type':Sequelize[_0x89af('0x2')](_0x89af('0x3'),_0x89af('0x4'),_0x89af('0x5'),_0x89af('0x6'),_0x89af('0x7')),'defaultValue':_0x89af('0x3')},'content':{'type':Sequelize[_0x89af('0x8')]},'key':{'type':Sequelize[_0x89af('0x8')]},'keyType':{'type':Sequelize[_0x89af('0x2')]('string','variable',_0x89af('0x5'))},'keyContent':{'type':Sequelize[_0x89af('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x89af('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x89af('0x8')]}}; \ No newline at end of file +var _0x9f5b=['ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN','exports'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x9f5b,0x147));var _0xb9f5=function(_0x29caf2,_0x21e2fb){_0x29caf2=_0x29caf2-0x0;var _0x31d5f4=_0x9f5b[_0x29caf2];return _0x31d5f4;};'use strict';var Sequelize=require('sequelize');module[_0xb9f5('0x0')]={'type':{'type':Sequelize[_0xb9f5('0x1')]('string',_0xb9f5('0x2'),_0xb9f5('0x3'),'keyValue',_0xb9f5('0x4')),'defaultValue':_0xb9f5('0x5')},'content':{'type':Sequelize[_0xb9f5('0x6')]},'key':{'type':Sequelize[_0xb9f5('0x6')]},'keyType':{'type':Sequelize[_0xb9f5('0x1')](_0xb9f5('0x5'),_0xb9f5('0x2'),_0xb9f5('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb9f5('0x6')]},'nameField':{'type':Sequelize[_0xb9f5('0x6')]},'customField':{'type':Sequelize[_0xb9f5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb9f5('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a30c280..b88a7ac 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 _0x95d3=['body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','error','stack','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','catch','show','params','keys','length','options','create'];(function(_0x477255,_0x59fd64){var _0x219c92=function(_0x4aaabe){while(--_0x4aaabe){_0x477255['push'](_0x477255['shift']());}};_0x219c92(++_0x59fd64);}(_0x95d3,0x126));var _0x395d=function(_0x1a450a,_0x4dcb72){_0x1a450a=_0x1a450a-0x0;var _0x4f8ef4=_0x95d3[_0x1a450a];return _0x4f8ef4;};'use strict';var emlformat=require(_0x395d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x395d('0x1'));var jsonpatch=require(_0x395d('0x2'));var rp=require(_0x395d('0x3'));var moment=require(_0x395d('0x4'));var BPromise=require(_0x395d('0x5'));var Mustache=require(_0x395d('0x6'));var util=require(_0x395d('0x7'));var path=require(_0x395d('0x8'));var sox=require(_0x395d('0x9'));var csv=require(_0x395d('0xa'));var ejs=require(_0x395d('0xb'));var fs=require('fs');var fs_extra=require(_0x395d('0xc'));var _=require(_0x395d('0xd'));var squel=require(_0x395d('0xe'));var crypto=require('crypto');var jsforce=require(_0x395d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x395d('0xa'));var querystring=require('querystring');var Papa=require(_0x395d('0x10'));var Redis=require(_0x395d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x395d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x395d('0x13'));var logger=require(_0x395d('0x14'))(_0x395d('0x15'));var utils=require('../../config/utils');var config=require(_0x395d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39489e,_0x2b079e){_0x2b079e=_0x2b079e||0xcc;return function(_0x455225){if(_0x455225){return _0x39489e[_0x395d('0x17')](_0x2b079e);}return _0x39489e['status'](_0x2b079e)[_0x395d('0x18')]();};}function respondWithResult(_0x312e96,_0x11c2cd){_0x11c2cd=_0x11c2cd||0xc8;return function(_0xd7e614){if(_0xd7e614){return _0x312e96[_0x395d('0x19')](_0x11c2cd)['json'](_0xd7e614);}};}function respondWithFilteredResult(_0xfea2dd,_0x36a0ed){return function(_0x384733){if(_0x384733){var _0x259bd4=typeof _0x36a0ed[_0x395d('0x1a')]===_0x395d('0x1b')&&typeof _0x36a0ed[_0x395d('0x1c')]===_0x395d('0x1b');var _0x294c57=_0x384733[_0x395d('0x1d')];var _0x182f02=_0x259bd4?0x0:_0x36a0ed[_0x395d('0x1a')];var _0x4fd399=_0x259bd4?_0x384733[_0x395d('0x1d')]:_0x36a0ed['offset']+_0x36a0ed[_0x395d('0x1c')];var _0x2979dd;if(_0x4fd399>=_0x294c57){_0x4fd399=_0x294c57;_0x2979dd=0xc8;}else{_0x2979dd=0xce;}_0xfea2dd[_0x395d('0x19')](_0x2979dd);return _0xfea2dd[_0x395d('0x1e')](_0x395d('0x1f'),_0x182f02+'-'+_0x4fd399+'/'+_0x294c57)[_0x395d('0x20')](_0x384733);}return null;};}function patchUpdates(_0x922d5b){return function(_0x1b5277){try{jsonpatch[_0x395d('0x21')](_0x1b5277,_0x922d5b,!![]);}catch(_0x22de4e){return BPromise['reject'](_0x22de4e);}return _0x1b5277[_0x395d('0x22')]();};}function saveUpdates(_0x4c2aac,_0x67d894){return function(_0x438a83){if(_0x438a83){return _0x438a83[_0x395d('0x23')](_0x4c2aac)['then'](function(_0x2f0d29){return _0x2f0d29;});}return null;};}function removeEntity(_0x1af3f3,_0x2279f1){return function(_0x3aa363){if(_0x3aa363){return _0x3aa363[_0x395d('0x24')]()[_0x395d('0x25')](function(){_0x1af3f3[_0x395d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c0ab,_0x2f3982){return function(_0x17059d){if(!_0x17059d){_0x52c0ab[_0x395d('0x17')](0x194);}return _0x17059d;};}function handleError(_0x47acae,_0x45b7e1){_0x45b7e1=_0x45b7e1||0x1f4;return function(_0x21fd75){logger[_0x395d('0x26')](_0x21fd75[_0x395d('0x27')]);if(_0x21fd75['name']){delete _0x21fd75['name'];}_0x47acae[_0x395d('0x19')](_0x45b7e1)[_0x395d('0x28')](_0x21fd75);};}exports[_0x395d('0x29')]=function(_0x26f7b8,_0x86720b){var _0x35c872={},_0x29e642={},_0x45b960={'count':0x0,'rows':[]};var _0x84505=_[_0x395d('0x2a')](db[_0x395d('0x2b')][_0x395d('0x2c')],function(_0x18dfda){return{'name':_0x18dfda[_0x395d('0x2d')],'type':_0x18dfda[_0x395d('0x2e')][_0x395d('0x2f')]};});_0x29e642['model']=_[_0x395d('0x2a')](_0x84505,'name');_0x29e642[_0x395d('0x30')]=_['keys'](_0x26f7b8[_0x395d('0x30')]);_0x29e642[_0x395d('0x31')]=_['intersection'](_0x29e642[_0x395d('0x32')],_0x29e642[_0x395d('0x30')]);_0x35c872[_0x395d('0x33')]=_[_0x395d('0x34')](_0x29e642[_0x395d('0x32')],qs[_0x395d('0x35')](_0x26f7b8[_0x395d('0x30')][_0x395d('0x35')]));_0x35c872['attributes']=_0x35c872['attributes']['length']?_0x35c872[_0x395d('0x33')]:_0x29e642[_0x395d('0x32')];if(!_0x26f7b8[_0x395d('0x30')]['hasOwnProperty'](_0x395d('0x36'))){_0x35c872['limit']=qs[_0x395d('0x1c')](_0x26f7b8[_0x395d('0x30')][_0x395d('0x1c')]);_0x35c872[_0x395d('0x1a')]=qs['offset'](_0x26f7b8[_0x395d('0x30')][_0x395d('0x1a')]);}_0x35c872['order']=qs['sort'](_0x26f7b8['query'][_0x395d('0x37')]);_0x35c872[_0x395d('0x38')]=qs[_0x395d('0x31')](_[_0x395d('0x39')](_0x26f7b8[_0x395d('0x30')],_0x29e642[_0x395d('0x31')]),_0x84505);if(_0x26f7b8[_0x395d('0x30')][_0x395d('0x3a')]){_0x35c872[_0x395d('0x38')]=_[_0x395d('0x3b')](_0x35c872[_0x395d('0x38')],{'$or':_[_0x395d('0x2a')](_0x84505,function(_0x5281f9){if(_0x5281f9[_0x395d('0x2e')]!==_0x395d('0x3c')){var _0x353493={};_0x353493[_0x5281f9[_0x395d('0x3d')]]={'$like':'%'+_0x26f7b8[_0x395d('0x30')][_0x395d('0x3a')]+'%'};return _0x353493;}})});}_0x35c872=_[_0x395d('0x3b')]({},_0x35c872,_0x26f7b8['options']);var _0x3800ac={'where':_0x35c872[_0x395d('0x38')]};return db['ZendeskField'][_0x395d('0x1d')](_0x3800ac)[_0x395d('0x25')](function(_0x498c9e){_0x45b960['count']=_0x498c9e;if(_0x26f7b8['query'][_0x395d('0x3e')]){_0x35c872[_0x395d('0x3f')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x35c872);})[_0x395d('0x25')](function(_0x57fd70){_0x45b960['rows']=_0x57fd70;return _0x45b960;})['then'](respondWithFilteredResult(_0x86720b,_0x35c872))[_0x395d('0x40')](handleError(_0x86720b,null));};exports[_0x395d('0x41')]=function(_0x551ea3,_0x20e5c8){var _0x183524={'raw':!![],'where':{'id':_0x551ea3[_0x395d('0x42')]['id']}},_0x58867b={};_0x58867b[_0x395d('0x32')]=_[_0x395d('0x43')](db[_0x395d('0x2b')][_0x395d('0x2c')]);_0x58867b[_0x395d('0x30')]=_['keys'](_0x551ea3[_0x395d('0x30')]);_0x58867b['filters']=_[_0x395d('0x34')](_0x58867b['model'],_0x58867b[_0x395d('0x30')]);_0x183524[_0x395d('0x33')]=_[_0x395d('0x34')](_0x58867b[_0x395d('0x32')],qs['fields'](_0x551ea3[_0x395d('0x30')]['fields']));_0x183524[_0x395d('0x33')]=_0x183524['attributes'][_0x395d('0x44')]?_0x183524['attributes']:_0x58867b['model'];if(_0x551ea3[_0x395d('0x30')][_0x395d('0x3e')]){_0x183524[_0x395d('0x3f')]=[{'all':!![]}];}_0x183524=_[_0x395d('0x3b')]({},_0x183524,_0x551ea3[_0x395d('0x45')]);return db[_0x395d('0x2b')]['find'](_0x183524)[_0x395d('0x25')](handleEntityNotFound(_0x20e5c8,null))[_0x395d('0x25')](respondWithResult(_0x20e5c8,null))[_0x395d('0x40')](handleError(_0x20e5c8,null));};exports[_0x395d('0x46')]=function(_0x59e786,_0x5e5bb6){return db[_0x395d('0x2b')][_0x395d('0x46')](_0x59e786[_0x395d('0x47')],{})[_0x395d('0x25')](respondWithResult(_0x5e5bb6,0xc9))[_0x395d('0x40')](handleError(_0x5e5bb6,null));};exports[_0x395d('0x23')]=function(_0x223977,_0x2f0556){if(_0x223977['body']['id']){delete _0x223977['body']['id'];}return db['ZendeskField'][_0x395d('0x48')]({'where':{'id':_0x223977[_0x395d('0x42')]['id']}})[_0x395d('0x25')](handleEntityNotFound(_0x2f0556,null))[_0x395d('0x25')](saveUpdates(_0x223977[_0x395d('0x47')],null))[_0x395d('0x25')](respondWithResult(_0x2f0556,null))[_0x395d('0x40')](handleError(_0x2f0556,null));};exports[_0x395d('0x24')]=function(_0x45a75c,_0x4cbf4b){return db[_0x395d('0x2b')][_0x395d('0x48')]({'where':{'id':_0x45a75c[_0x395d('0x42')]['id']}})[_0x395d('0x25')](handleEntityNotFound(_0x4cbf4b,null))[_0x395d('0x25')](removeEntity(_0x4cbf4b,null))['catch'](handleError(_0x4cbf4b,null));}; \ No newline at end of file +var _0x7866=['set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','model','map','keys','filters','intersection','attributes','query','fields','length','nolimit','order','sort','where','pick','merge','filter','count','includeAll','include','findAll','catch','show','params','options','find','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined'];(function(_0x24fb6d,_0x410ca2){var _0x44bc10=function(_0x5df0fd){while(--_0x5df0fd){_0x24fb6d['push'](_0x24fb6d['shift']());}};_0x44bc10(++_0x410ca2);}(_0x7866,0x114));var _0x6786=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x7866[_0x5ddaac];return _0x2a9c58;};'use strict';var emlformat=require(_0x6786('0x0'));var rimraf=require(_0x6786('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6786('0x2'));var rp=require(_0x6786('0x3'));var moment=require(_0x6786('0x4'));var BPromise=require(_0x6786('0x5'));var Mustache=require(_0x6786('0x6'));var util=require(_0x6786('0x7'));var path=require(_0x6786('0x8'));var sox=require(_0x6786('0x9'));var csv=require(_0x6786('0xa'));var ejs=require(_0x6786('0xb'));var fs=require('fs');var fs_extra=require(_0x6786('0xc'));var _=require(_0x6786('0xd'));var squel=require(_0x6786('0xe'));var crypto=require(_0x6786('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6786('0x10'));var toCsv=require(_0x6786('0xa'));var querystring=require(_0x6786('0x11'));var Papa=require(_0x6786('0x12'));var Redis=require(_0x6786('0x13'));var authService=require(_0x6786('0x14'));var qs=require(_0x6786('0x15'));var as=require(_0x6786('0x16'));var hardwareService=require(_0x6786('0x17'));var logger=require(_0x6786('0x18'))(_0x6786('0x19'));var utils=require('../../config/utils');var config=require(_0x6786('0x1a'));var licenseUtil=require(_0x6786('0x1b'));var db=require(_0x6786('0x1c'))['db'];function respondWithStatusCode(_0x2f7cbb,_0x47f87b){_0x47f87b=_0x47f87b||0xcc;return function(_0x291863){if(_0x291863){return _0x2f7cbb[_0x6786('0x1d')](_0x47f87b);}return _0x2f7cbb['status'](_0x47f87b)[_0x6786('0x1e')]();};}function respondWithResult(_0x3f9940,_0x2f04af){_0x2f04af=_0x2f04af||0xc8;return function(_0x15d843){if(_0x15d843){return _0x3f9940[_0x6786('0x1f')](_0x2f04af)[_0x6786('0x20')](_0x15d843);}};}function respondWithFilteredResult(_0x1bfa1a,_0x45a70f){return function(_0x34243a){if(_0x34243a){var _0x7fbef6=typeof _0x45a70f[_0x6786('0x21')]==='undefined'&&typeof _0x45a70f[_0x6786('0x22')]===_0x6786('0x23');var _0x467d68=_0x34243a['count'];var _0xbbee86=_0x7fbef6?0x0:_0x45a70f['offset'];var _0x4b017a=_0x7fbef6?_0x34243a['count']:_0x45a70f['offset']+_0x45a70f[_0x6786('0x22')];var _0x3cd17e;if(_0x4b017a>=_0x467d68){_0x4b017a=_0x467d68;_0x3cd17e=0xc8;}else{_0x3cd17e=0xce;}_0x1bfa1a['status'](_0x3cd17e);return _0x1bfa1a[_0x6786('0x24')](_0x6786('0x25'),_0xbbee86+'-'+_0x4b017a+'/'+_0x467d68)[_0x6786('0x20')](_0x34243a);}return null;};}function patchUpdates(_0x5a245b){return function(_0x2bd6cb){try{jsonpatch[_0x6786('0x26')](_0x2bd6cb,_0x5a245b,!![]);}catch(_0x4a57cb){return BPromise[_0x6786('0x27')](_0x4a57cb);}return _0x2bd6cb['save']();};}function saveUpdates(_0x18398a,_0x5c1d70){return function(_0x215f98){if(_0x215f98){return _0x215f98[_0x6786('0x28')](_0x18398a)[_0x6786('0x29')](function(_0x406bbc){return _0x406bbc;});}return null;};}function removeEntity(_0x1ebec8,_0x15e156){return function(_0x1ba9bc){if(_0x1ba9bc){return _0x1ba9bc[_0x6786('0x2a')]()[_0x6786('0x29')](function(){_0x1ebec8['status'](0xcc)[_0x6786('0x1e')]();});}};}function handleEntityNotFound(_0x37e026,_0x594333){return function(_0x3af734){if(!_0x3af734){_0x37e026[_0x6786('0x1d')](0x194);}return _0x3af734;};}function handleError(_0x2256fe,_0xfa2576){_0xfa2576=_0xfa2576||0x1f4;return function(_0x53a8d9){logger[_0x6786('0x2b')](_0x53a8d9[_0x6786('0x2c')]);if(_0x53a8d9['name']){delete _0x53a8d9[_0x6786('0x2d')];}_0x2256fe[_0x6786('0x1f')](_0xfa2576)[_0x6786('0x2e')](_0x53a8d9);};}exports[_0x6786('0x2f')]=function(_0x17ef39,_0x119eaf){var _0x4f3850={},_0x4b7fe8={},_0x33d431={'count':0x0,'rows':[]};var _0x2bf8b7=_['map'](db[_0x6786('0x30')][_0x6786('0x31')],function(_0x53fd1f){return{'name':_0x53fd1f[_0x6786('0x32')],'type':_0x53fd1f[_0x6786('0x33')]['key']};});_0x4b7fe8[_0x6786('0x34')]=_[_0x6786('0x35')](_0x2bf8b7,_0x6786('0x2d'));_0x4b7fe8['query']=_[_0x6786('0x36')](_0x17ef39['query']);_0x4b7fe8[_0x6786('0x37')]=_[_0x6786('0x38')](_0x4b7fe8[_0x6786('0x34')],_0x4b7fe8['query']);_0x4f3850[_0x6786('0x39')]=_[_0x6786('0x38')](_0x4b7fe8[_0x6786('0x34')],qs['fields'](_0x17ef39[_0x6786('0x3a')][_0x6786('0x3b')]));_0x4f3850[_0x6786('0x39')]=_0x4f3850['attributes'][_0x6786('0x3c')]?_0x4f3850[_0x6786('0x39')]:_0x4b7fe8['model'];if(!_0x17ef39[_0x6786('0x3a')]['hasOwnProperty'](_0x6786('0x3d'))){_0x4f3850['limit']=qs['limit'](_0x17ef39[_0x6786('0x3a')]['limit']);_0x4f3850[_0x6786('0x21')]=qs[_0x6786('0x21')](_0x17ef39['query'][_0x6786('0x21')]);}_0x4f3850[_0x6786('0x3e')]=qs[_0x6786('0x3f')](_0x17ef39['query'][_0x6786('0x3f')]);_0x4f3850[_0x6786('0x40')]=qs[_0x6786('0x37')](_[_0x6786('0x41')](_0x17ef39[_0x6786('0x3a')],_0x4b7fe8[_0x6786('0x37')]),_0x2bf8b7);if(_0x17ef39[_0x6786('0x3a')]['filter']){_0x4f3850[_0x6786('0x40')]=_[_0x6786('0x42')](_0x4f3850[_0x6786('0x40')],{'$or':_[_0x6786('0x35')](_0x2bf8b7,function(_0x20af6e){if(_0x20af6e[_0x6786('0x33')]!=='VIRTUAL'){var _0x3c700f={};_0x3c700f[_0x20af6e['name']]={'$like':'%'+_0x17ef39[_0x6786('0x3a')][_0x6786('0x43')]+'%'};return _0x3c700f;}})});}_0x4f3850=_[_0x6786('0x42')]({},_0x4f3850,_0x17ef39['options']);var _0x3afcad={'where':_0x4f3850['where']};return db['ZendeskField'][_0x6786('0x44')](_0x3afcad)['then'](function(_0x34b5dc){_0x33d431[_0x6786('0x44')]=_0x34b5dc;if(_0x17ef39[_0x6786('0x3a')][_0x6786('0x45')]){_0x4f3850[_0x6786('0x46')]=[{'all':!![]}];}return db['ZendeskField'][_0x6786('0x47')](_0x4f3850);})[_0x6786('0x29')](function(_0x34ff2a){_0x33d431['rows']=_0x34ff2a;return _0x33d431;})[_0x6786('0x29')](respondWithFilteredResult(_0x119eaf,_0x4f3850))[_0x6786('0x48')](handleError(_0x119eaf,null));};exports[_0x6786('0x49')]=function(_0x564b25,_0x51d0bb){var _0x161c0b={'raw':!![],'where':{'id':_0x564b25[_0x6786('0x4a')]['id']}},_0x2e93ff={};_0x2e93ff[_0x6786('0x34')]=_[_0x6786('0x36')](db[_0x6786('0x30')]['rawAttributes']);_0x2e93ff['query']=_[_0x6786('0x36')](_0x564b25[_0x6786('0x3a')]);_0x2e93ff[_0x6786('0x37')]=_[_0x6786('0x38')](_0x2e93ff[_0x6786('0x34')],_0x2e93ff[_0x6786('0x3a')]);_0x161c0b['attributes']=_[_0x6786('0x38')](_0x2e93ff[_0x6786('0x34')],qs[_0x6786('0x3b')](_0x564b25[_0x6786('0x3a')][_0x6786('0x3b')]));_0x161c0b[_0x6786('0x39')]=_0x161c0b[_0x6786('0x39')][_0x6786('0x3c')]?_0x161c0b[_0x6786('0x39')]:_0x2e93ff[_0x6786('0x34')];if(_0x564b25['query']['includeAll']){_0x161c0b[_0x6786('0x46')]=[{'all':!![]}];}_0x161c0b=_[_0x6786('0x42')]({},_0x161c0b,_0x564b25[_0x6786('0x4b')]);return db[_0x6786('0x30')][_0x6786('0x4c')](_0x161c0b)[_0x6786('0x29')](handleEntityNotFound(_0x51d0bb,null))[_0x6786('0x29')](respondWithResult(_0x51d0bb,null))[_0x6786('0x48')](handleError(_0x51d0bb,null));};exports['create']=function(_0x1177dc,_0xb51fd7){return db[_0x6786('0x30')]['create'](_0x1177dc['body'],{})['then'](respondWithResult(_0xb51fd7,0xc9))[_0x6786('0x48')](handleError(_0xb51fd7,null));};exports[_0x6786('0x28')]=function(_0x189bb3,_0x444fed){if(_0x189bb3[_0x6786('0x4d')]['id']){delete _0x189bb3[_0x6786('0x4d')]['id'];}return db[_0x6786('0x30')]['find']({'where':{'id':_0x189bb3[_0x6786('0x4a')]['id']}})[_0x6786('0x29')](handleEntityNotFound(_0x444fed,null))[_0x6786('0x29')](saveUpdates(_0x189bb3[_0x6786('0x4d')],null))[_0x6786('0x29')](respondWithResult(_0x444fed,null))[_0x6786('0x48')](handleError(_0x444fed,null));};exports[_0x6786('0x2a')]=function(_0x3f8c4b,_0x3e1a8e){return db['ZendeskField'][_0x6786('0x4c')]({'where':{'id':_0x3f8c4b[_0x6786('0x4a')]['id']}})[_0x6786('0x29')](handleEntityNotFound(_0x3e1a8e,null))['then'](removeEntity(_0x3e1a8e,null))[_0x6786('0x48')](handleError(_0x3e1a8e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e931563..e588ee1 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 _0xf60b=['int_zendesk_fields','idField','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf60b,0x17b));var _0xbf60=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0xf60b[_0x401676];return _0x4f13fe;};'use strict';var _=require(_0xbf60('0x0'));var util=require(_0xbf60('0x1'));var logger=require('../../config/logger')(_0xbf60('0x2'));var moment=require('moment');var BPromise=require(_0xbf60('0x3'));var rp=require(_0xbf60('0x4'));var fs=require('fs');var path=require(_0xbf60('0x5'));var rimraf=require(_0xbf60('0x6'));var config=require(_0xbf60('0x7'));var attributes=require(_0xbf60('0x8'));module[_0xbf60('0x9')]=function(_0x181854,_0x3aacc7){return _0x181854['define'](_0xbf60('0xa'),attributes,{'tableName':_0xbf60('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xbf60('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd73a=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xd73a,0x1d4));var _0xad73=function(_0x43c89f,_0x32a64f){_0x43c89f=_0x43c89f-0x0;var _0x56a4fb=_0xd73a[_0x43c89f];return _0x56a4fb;};'use strict';var _=require(_0xad73('0x0'));var util=require('util');var logger=require(_0xad73('0x1'))(_0xad73('0x2'));var moment=require(_0xad73('0x3'));var BPromise=require(_0xad73('0x4'));var rp=require(_0xad73('0x5'));var fs=require('fs');var path=require(_0xad73('0x6'));var rimraf=require('rimraf');var config=require(_0xad73('0x7'));var attributes=require(_0xad73('0x8'));module[_0xad73('0x9')]=function(_0x3eec30,_0x2dc28f){return _0x3eec30['define'](_0xad73('0xa'),attributes,{'tableName':_0xad73('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xad73('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 71ad6b8..fbca884 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 _0xfebf=['request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x559b4f,_0x5bfb4b){var _0x2806e=function(_0x5c7a5f){while(--_0x5c7a5f){_0x559b4f['push'](_0x559b4f['shift']());}};_0x2806e(++_0x5bfb4b);}(_0xfebf,0x10b));var _0xffeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xffeb('0x0'));var rs=require(_0xffeb('0x1'));var fs=require('fs');var Redis=require(_0xffeb('0x2'));var db=require(_0xffeb('0x3'))['db'];var utils=require(_0xffeb('0x4'));var logger=require(_0xffeb('0x5'))(_0xffeb('0x6'));var config=require(_0xffeb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xffeb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23d023,_0x298437,_0x2c6697){return new BPromise(function(_0xc84e9d,_0x38c9a8){return client[_0xffeb('0x9')](_0x23d023,_0x2c6697)[_0xffeb('0xa')](function(_0x394360){logger[_0xffeb('0xb')](_0xffeb('0xc'),_0x298437,_0xffeb('0xd'));logger['debug'](_0xffeb('0xe'),_0x298437,_0xffeb('0xd'),JSON[_0xffeb('0xf')](_0x394360));if(_0x394360[_0xffeb('0x10')]){if(_0x394360[_0xffeb('0x10')][_0xffeb('0x11')]===0x1f4){logger[_0xffeb('0x10')]('ZendeskField,\x20%s,\x20%s',_0x298437,_0x394360[_0xffeb('0x10')][_0xffeb('0x12')]);return _0x38c9a8(_0x394360[_0xffeb('0x10')][_0xffeb('0x12')]);}logger[_0xffeb('0x10')](_0xffeb('0xc'),_0x298437,_0x394360[_0xffeb('0x10')][_0xffeb('0x12')]);return _0xc84e9d(_0x394360['error'][_0xffeb('0x12')]);}else{logger[_0xffeb('0xb')](_0xffeb('0xc'),_0x298437,_0xffeb('0xd'));_0xc84e9d(_0x394360['result']['message']);}})[_0xffeb('0x13')](function(_0x348a49){logger['error'](_0xffeb('0xc'),_0x298437,_0x348a49);_0x38c9a8(_0x348a49);});});} \ No newline at end of file +var _0x013f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x013f,0x8a));var _0xf013=function(_0x328ed1,_0x4dd43a){_0x328ed1=_0x328ed1-0x0;var _0x5a1256=_0x013f[_0x328ed1];return _0x5a1256;};'use strict';var _=require(_0xf013('0x0'));var util=require(_0xf013('0x1'));var moment=require(_0xf013('0x2'));var BPromise=require(_0xf013('0x3'));var rs=require(_0xf013('0x4'));var fs=require('fs');var Redis=require(_0xf013('0x5'));var db=require(_0xf013('0x6'))['db'];var utils=require(_0xf013('0x7'));var logger=require(_0xf013('0x8'))(_0xf013('0x9'));var config=require(_0xf013('0xa'));var jayson=require(_0xf013('0xb'));var client=jayson[_0xf013('0xc')][_0xf013('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24c72d,_0x17b100,_0xd32fa6){return new BPromise(function(_0x28d5f0,_0xc6283e){return client['request'](_0x24c72d,_0xd32fa6)[_0xf013('0xe')](function(_0x5f1475){logger[_0xf013('0xf')](_0xf013('0x10'),_0x17b100,_0xf013('0x11'));logger[_0xf013('0x12')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x17b100,'request\x20sent',JSON[_0xf013('0x13')](_0x5f1475));if(_0x5f1475[_0xf013('0x14')]){if(_0x5f1475[_0xf013('0x14')][_0xf013('0x15')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x17b100,_0x5f1475[_0xf013('0x14')][_0xf013('0x16')]);return _0xc6283e(_0x5f1475[_0xf013('0x14')][_0xf013('0x16')]);}logger[_0xf013('0x14')](_0xf013('0x10'),_0x17b100,_0x5f1475[_0xf013('0x14')][_0xf013('0x16')]);return _0x28d5f0(_0x5f1475[_0xf013('0x14')][_0xf013('0x16')]);}else{logger['info'](_0xf013('0x10'),_0x17b100,_0xf013('0x11'));_0x28d5f0(_0x5f1475[_0xf013('0x17')][_0xf013('0x16')]);}})['catch'](function(_0x3297b2){logger[_0xf013('0x14')](_0xf013('0x10'),_0x17b100,_0x3297b2);_0xc6283e(_0x3297b2);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 787d30d..66193db 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 _0x54ff=['/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations'];(function(_0x3cada8,_0x201533){var _0x2a50bc=function(_0x352047){while(--_0x352047){_0x3cada8['push'](_0x3cada8['shift']());}};_0x2a50bc(++_0x201533);}(_0x54ff,0x159));var _0xf54f=function(_0x3743d0,_0x4a322e){_0x3743d0=_0x3743d0-0x0;var _0x37e7b5=_0x54ff[_0x3743d0];return _0x37e7b5;};'use strict';var multer=require('multer');var util=require(_0xf54f('0x0'));var path=require(_0xf54f('0x1'));var timeout=require(_0xf54f('0x2'));var express=require(_0xf54f('0x3'));var router=express['Router']();var fs_extra=require(_0xf54f('0x4'));var auth=require(_0xf54f('0x5'));var interaction=require(_0xf54f('0x6'));var config=require(_0xf54f('0x7'));var controller=require(_0xf54f('0x8'));router[_0xf54f('0x9')]('/',auth[_0xf54f('0xa')](),controller[_0xf54f('0xb')]);router[_0xf54f('0x9')](_0xf54f('0xc'),auth[_0xf54f('0xa')](),controller['show']);router[_0xf54f('0x9')](_0xf54f('0xd'),auth[_0xf54f('0xa')](),controller[_0xf54f('0xe')]);router[_0xf54f('0x9')](_0xf54f('0xf'),auth['isAuthenticated'](),controller[_0xf54f('0x10')]);router[_0xf54f('0x11')]('/',auth[_0xf54f('0xa')](),controller[_0xf54f('0x12')]);router[_0xf54f('0x11')](_0xf54f('0xd'),auth[_0xf54f('0xa')](),controller[_0xf54f('0x13')]);router[_0xf54f('0x14')](_0xf54f('0xc'),auth[_0xf54f('0xa')](),controller['update']);router[_0xf54f('0x15')](_0xf54f('0xc'),auth[_0xf54f('0xa')](),controller[_0xf54f('0x16')]);module[_0xf54f('0x17')]=router; \ No newline at end of file +var _0x80b3=['get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e76d1,_0x43f147){var _0xaa4393=function(_0x42fd3d){while(--_0x42fd3d){_0x4e76d1['push'](_0x4e76d1['shift']());}};_0xaa4393(++_0x43f147);}(_0x80b3,0x1b8));var _0x380b=function(_0x558696,_0x2a0e37){_0x558696=_0x558696-0x0;var _0x1f2f6e=_0x80b3[_0x558696];return _0x1f2f6e;};'use strict';var multer=require(_0x380b('0x0'));var util=require(_0x380b('0x1'));var path=require(_0x380b('0x2'));var timeout=require(_0x380b('0x3'));var express=require(_0x380b('0x4'));var router=express[_0x380b('0x5')]();var fs_extra=require(_0x380b('0x6'));var auth=require(_0x380b('0x7'));var interaction=require(_0x380b('0x8'));var config=require(_0x380b('0x9'));var controller=require('./intZohoAccount.controller');router[_0x380b('0xa')]('/',auth[_0x380b('0xb')](),controller[_0x380b('0xc')]);router['get']('/:id',auth[_0x380b('0xb')](),controller[_0x380b('0xd')]);router[_0x380b('0xa')](_0x380b('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x380b('0xa')](_0x380b('0xf'),auth[_0x380b('0xb')](),controller[_0x380b('0x10')]);router[_0x380b('0x11')]('/',auth[_0x380b('0xb')](),controller[_0x380b('0x12')]);router['post'](_0x380b('0xe'),auth[_0x380b('0xb')](),controller[_0x380b('0x13')]);router[_0x380b('0x14')](_0x380b('0x15'),auth[_0x380b('0xb')](),controller[_0x380b('0x16')]);router[_0x380b('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x380b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ce2dcbf..0d9e534 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 _0xd0bb=['exports','STRING','sequelize'];(function(_0x43148e,_0xa81910){var _0x4880a7=function(_0x1299da){while(--_0x1299da){_0x43148e['push'](_0x43148e['shift']());}};_0x4880a7(++_0xa81910);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x354e7a,_0x4e4dc0){_0x354e7a=_0x354e7a-0x0;var _0x17b550=_0xd0bb[_0x354e7a];return _0x17b550;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'name':{'type':Sequelize[_0xbd0b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd0b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbd0b('0x2')]},'clientSecret':{'type':Sequelize[_0xbd0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xbd0b('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x54ef=['STRING','sequelize','exports'];(function(_0x3891de,_0x55cfe5){var _0x521696=function(_0x1a8b8e){while(--_0x1a8b8e){_0x3891de['push'](_0x3891de['shift']());}};_0x521696(++_0x55cfe5);}(_0x54ef,0x112));var _0xf54e=function(_0x4e8cbb,_0x4b89ed){_0x4e8cbb=_0x4e8cbb-0x0;var _0x45ccb8=_0x54ef[_0x4e8cbb];return _0x45ccb8;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'name':{'type':Sequelize[_0xf54e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf54e('0x2')]},'zone':{'type':Sequelize[_0xf54e('0x2')]},'clientId':{'type':Sequelize[_0xf54e('0x2')]},'clientSecret':{'type':Sequelize[_0xf54e('0x2')]},'serverUrl':{'type':Sequelize[_0xf54e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf54e('0x2')]},'refreshToken':{'type':Sequelize[_0xf54e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 446ad83..f631e25 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 _0xf0b0=['limit','count','set','apply','reject','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','nolimit','order','sort','filter','where','merge','VIRTUAL','options','ZohoAccount','includeAll','include','findAll','rows','catch','length','find','create','body','update','params','getConfigurations','ZohoConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','findOne','host','clientId','clientSecret','serverUrl','refreshToken','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Description','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset'];(function(_0x6ae964,_0x171360){var _0x1945d4=function(_0x71375b){while(--_0x71375b){_0x6ae964['push'](_0x6ae964['shift']());}};_0x1945d4(++_0x171360);}(_0xf0b0,0x16c));var _0x0f0b=function(_0x42c3b8,_0x2a76ac){_0x42c3b8=_0x42c3b8-0x0;var _0x82276f=_0xf0b0[_0x42c3b8];return _0x82276f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f0b('0x0'));var zipdir=require(_0x0f0b('0x1'));var jsonpatch=require(_0x0f0b('0x2'));var rp=require(_0x0f0b('0x3'));var moment=require(_0x0f0b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0f0b('0x5'));var util=require(_0x0f0b('0x6'));var path=require(_0x0f0b('0x7'));var sox=require(_0x0f0b('0x8'));var csv=require('to-csv');var ejs=require(_0x0f0b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f0b('0xa'));var squel=require(_0x0f0b('0xb'));var crypto=require(_0x0f0b('0xc'));var jsforce=require(_0x0f0b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0f0b('0xe'));var querystring=require(_0x0f0b('0xf'));var Papa=require(_0x0f0b('0x10'));var Redis=require(_0x0f0b('0x11'));var authService=require(_0x0f0b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0f0b('0x13'));var hardwareService=require(_0x0f0b('0x14'));var logger=require('../../config/logger')(_0x0f0b('0x15'));var utils=require(_0x0f0b('0x16'));var config=require(_0x0f0b('0x17'));var licenseUtil=require(_0x0f0b('0x18'));var db=require(_0x0f0b('0x19'))['db'];var integrations=require(_0x0f0b('0x1a'));function respondWithStatusCode(_0x4dc1fb,_0x89521d){_0x89521d=_0x89521d||0xcc;return function(_0x58276a){if(_0x58276a){return _0x4dc1fb[_0x0f0b('0x1b')](_0x89521d);}return _0x4dc1fb[_0x0f0b('0x1c')](_0x89521d)[_0x0f0b('0x1d')]();};}function respondWithResult(_0x45b1a6,_0x296260){_0x296260=_0x296260||0xc8;return function(_0x410787){if(_0x410787){return _0x45b1a6[_0x0f0b('0x1c')](_0x296260)[_0x0f0b('0x1e')](_0x410787);}};}function respondWithFilteredResult(_0x4537f6,_0x508673){return function(_0x5bf509){if(_0x5bf509){var _0x41690c=typeof _0x508673[_0x0f0b('0x1f')]==='undefined'&&typeof _0x508673[_0x0f0b('0x20')]==='undefined';var _0x3e91be=_0x5bf509[_0x0f0b('0x21')];var _0x5d8fa1=_0x41690c?0x0:_0x508673[_0x0f0b('0x1f')];var _0x2f52a5=_0x41690c?_0x5bf509['count']:_0x508673[_0x0f0b('0x1f')]+_0x508673[_0x0f0b('0x20')];var _0x246b27;if(_0x2f52a5>=_0x3e91be){_0x2f52a5=_0x3e91be;_0x246b27=0xc8;}else{_0x246b27=0xce;}_0x4537f6[_0x0f0b('0x1c')](_0x246b27);return _0x4537f6[_0x0f0b('0x22')]('Content-Range',_0x5d8fa1+'-'+_0x2f52a5+'/'+_0x3e91be)[_0x0f0b('0x1e')](_0x5bf509);}return null;};}function patchUpdates(_0x1d5d86){return function(_0x5724f2){try{jsonpatch[_0x0f0b('0x23')](_0x5724f2,_0x1d5d86,!![]);}catch(_0x243440){return BPromise[_0x0f0b('0x24')](_0x243440);}return _0x5724f2['save']();};}function saveUpdates(_0x3b5a54,_0x349184){return function(_0x4a45da){if(_0x4a45da){return _0x4a45da['update'](_0x3b5a54)['then'](function(_0x2066a2){return _0x2066a2;});}return null;};}function removeEntity(_0x5110d4,_0x69d616){return function(_0x1fdbb4){if(_0x1fdbb4){return _0x1fdbb4[_0x0f0b('0x25')]()[_0x0f0b('0x26')](function(){_0x5110d4[_0x0f0b('0x1c')](0xcc)[_0x0f0b('0x1d')]();});}};}function handleEntityNotFound(_0x261834,_0x5f00c0){return function(_0x41ae2f){if(!_0x41ae2f){_0x261834['sendStatus'](0x194);}return _0x41ae2f;};}function handleError(_0x1c71a7,_0x5c4ba3){_0x5c4ba3=_0x5c4ba3||0x1f4;return function(_0x14a576){logger[_0x0f0b('0x27')](_0x14a576[_0x0f0b('0x28')]);if(_0x14a576[_0x0f0b('0x29')]){delete _0x14a576[_0x0f0b('0x29')];}_0x1c71a7[_0x0f0b('0x1c')](_0x5c4ba3)[_0x0f0b('0x2a')](_0x14a576);};}exports['index']=function(_0xa62c01,_0x27a3a7){var _0x4260b0={},_0x218fdb={},_0x553504={'count':0x0,'rows':[]};var _0x4df158=_[_0x0f0b('0x2b')](db['ZohoAccount'][_0x0f0b('0x2c')],function(_0x567ee8){return{'name':_0x567ee8[_0x0f0b('0x2d')],'type':_0x567ee8[_0x0f0b('0x2e')][_0x0f0b('0x2f')]};});_0x218fdb[_0x0f0b('0x30')]=_['map'](_0x4df158,_0x0f0b('0x29'));_0x218fdb['query']=_[_0x0f0b('0x31')](_0xa62c01['query']);_0x218fdb[_0x0f0b('0x32')]=_['intersection'](_0x218fdb['model'],_0x218fdb[_0x0f0b('0x33')]);_0x4260b0['attributes']=_[_0x0f0b('0x34')](_0x218fdb[_0x0f0b('0x30')],qs[_0x0f0b('0x35')](_0xa62c01[_0x0f0b('0x33')][_0x0f0b('0x35')]));_0x4260b0[_0x0f0b('0x36')]=_0x4260b0[_0x0f0b('0x36')]['length']?_0x4260b0[_0x0f0b('0x36')]:_0x218fdb[_0x0f0b('0x30')];if(!_0xa62c01['query']['hasOwnProperty'](_0x0f0b('0x37'))){_0x4260b0[_0x0f0b('0x20')]=qs[_0x0f0b('0x20')](_0xa62c01[_0x0f0b('0x33')][_0x0f0b('0x20')]);_0x4260b0[_0x0f0b('0x1f')]=qs[_0x0f0b('0x1f')](_0xa62c01[_0x0f0b('0x33')][_0x0f0b('0x1f')]);}_0x4260b0[_0x0f0b('0x38')]=qs['sort'](_0xa62c01['query'][_0x0f0b('0x39')]);_0x4260b0['where']=qs['filters'](_['pick'](_0xa62c01[_0x0f0b('0x33')],_0x218fdb[_0x0f0b('0x32')]),_0x4df158);if(_0xa62c01['query'][_0x0f0b('0x3a')]){_0x4260b0[_0x0f0b('0x3b')]=_[_0x0f0b('0x3c')](_0x4260b0['where'],{'$or':_['map'](_0x4df158,function(_0x39f68c){if(_0x39f68c[_0x0f0b('0x2e')]!==_0x0f0b('0x3d')){var _0x1deddd={};_0x1deddd[_0x39f68c['name']]={'$like':'%'+_0xa62c01['query']['filter']+'%'};return _0x1deddd;}})});}_0x4260b0=_[_0x0f0b('0x3c')]({},_0x4260b0,_0xa62c01[_0x0f0b('0x3e')]);var _0x1d7297={'where':_0x4260b0[_0x0f0b('0x3b')]};return db[_0x0f0b('0x3f')][_0x0f0b('0x21')](_0x1d7297)[_0x0f0b('0x26')](function(_0x1aa54c){_0x553504[_0x0f0b('0x21')]=_0x1aa54c;if(_0xa62c01[_0x0f0b('0x33')][_0x0f0b('0x40')]){_0x4260b0[_0x0f0b('0x41')]=[{'all':!![]}];}return db[_0x0f0b('0x3f')][_0x0f0b('0x42')](_0x4260b0);})[_0x0f0b('0x26')](function(_0x408bb1){_0x553504[_0x0f0b('0x43')]=_0x408bb1;return _0x553504;})[_0x0f0b('0x26')](respondWithFilteredResult(_0x27a3a7,_0x4260b0))[_0x0f0b('0x44')](handleError(_0x27a3a7,null));};exports['show']=function(_0x384799,_0x56533b){var _0x546571={'raw':![],'where':{'id':_0x384799['params']['id']}},_0x56ae45={};_0x56ae45[_0x0f0b('0x30')]=_[_0x0f0b('0x31')](db['ZohoAccount'][_0x0f0b('0x2c')]);_0x56ae45['query']=_[_0x0f0b('0x31')](_0x384799[_0x0f0b('0x33')]);_0x56ae45[_0x0f0b('0x32')]=_[_0x0f0b('0x34')](_0x56ae45[_0x0f0b('0x30')],_0x56ae45[_0x0f0b('0x33')]);_0x546571['attributes']=_[_0x0f0b('0x34')](_0x56ae45[_0x0f0b('0x30')],qs[_0x0f0b('0x35')](_0x384799[_0x0f0b('0x33')]['fields']));_0x546571[_0x0f0b('0x36')]=_0x546571[_0x0f0b('0x36')][_0x0f0b('0x45')]?_0x546571[_0x0f0b('0x36')]:_0x56ae45['model'];if(_0x384799[_0x0f0b('0x33')][_0x0f0b('0x40')]){_0x546571[_0x0f0b('0x41')]=[{'all':!![]}];}_0x546571=_[_0x0f0b('0x3c')]({},_0x546571,_0x384799[_0x0f0b('0x3e')]);return db['ZohoAccount'][_0x0f0b('0x46')](_0x546571)[_0x0f0b('0x26')](handleEntityNotFound(_0x56533b,null))[_0x0f0b('0x26')](respondWithResult(_0x56533b,null))['catch'](handleError(_0x56533b,null));};exports[_0x0f0b('0x47')]=function(_0x27e741,_0x2c97fe){return db[_0x0f0b('0x3f')][_0x0f0b('0x47')](_0x27e741[_0x0f0b('0x48')],{})['then'](respondWithResult(_0x2c97fe,0xc9))[_0x0f0b('0x44')](handleError(_0x2c97fe,null));};exports[_0x0f0b('0x49')]=function(_0x126477,_0x4bb838){if(_0x126477[_0x0f0b('0x48')]['id']){delete _0x126477['body']['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x126477[_0x0f0b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4bb838,null))['then'](saveUpdates(_0x126477[_0x0f0b('0x48')],null))[_0x0f0b('0x26')](respondWithResult(_0x4bb838,null))[_0x0f0b('0x44')](handleError(_0x4bb838,null));};exports[_0x0f0b('0x25')]=function(_0x95a831,_0x563092){return db[_0x0f0b('0x3f')][_0x0f0b('0x46')]({'where':{'id':_0x95a831[_0x0f0b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x563092,null))['then'](removeEntity(_0x563092,null))[_0x0f0b('0x44')](handleError(_0x563092,null));};exports[_0x0f0b('0x4b')]=function(_0x8c165a,_0x1c6336,_0x25bed3){var _0x3ee382={};var _0x418357={};var _0x54804b;var _0x13a2ff;return db['ZohoAccount']['findOne']({'where':{'id':_0x8c165a['params']['id']}})[_0x0f0b('0x26')](handleEntityNotFound(_0x1c6336,null))[_0x0f0b('0x26')](function(_0xace1ea){if(_0xace1ea){_0x54804b=_0xace1ea;_0x418357['model']=_[_0x0f0b('0x31')](db[_0x0f0b('0x4c')]['rawAttributes']);_0x418357[_0x0f0b('0x33')]=_['keys'](_0x8c165a[_0x0f0b('0x33')]);_0x418357[_0x0f0b('0x32')]=_[_0x0f0b('0x34')](_0x418357[_0x0f0b('0x30')],_0x418357[_0x0f0b('0x33')]);_0x3ee382[_0x0f0b('0x36')]=_['intersection'](_0x418357[_0x0f0b('0x30')],qs[_0x0f0b('0x35')](_0x8c165a[_0x0f0b('0x33')][_0x0f0b('0x35')]));_0x3ee382[_0x0f0b('0x36')]=_0x3ee382[_0x0f0b('0x36')][_0x0f0b('0x45')]?_0x3ee382['attributes']:_0x418357[_0x0f0b('0x30')];_0x3ee382['order']=qs[_0x0f0b('0x39')](_0x8c165a[_0x0f0b('0x33')][_0x0f0b('0x39')]);_0x3ee382[_0x0f0b('0x3b')]=qs[_0x0f0b('0x32')](_['pick'](_0x8c165a[_0x0f0b('0x33')],_0x418357['filters']));if(_0x8c165a[_0x0f0b('0x33')][_0x0f0b('0x3a')]){_0x3ee382[_0x0f0b('0x3b')]=_['merge'](_0x3ee382[_0x0f0b('0x3b')],{'$or':_[_0x0f0b('0x2b')](_0x3ee382['attributes'],function(_0x417f8d){var _0x2c4ce6={};_0x2c4ce6[_0x417f8d]={'$like':'%'+_0x8c165a[_0x0f0b('0x33')][_0x0f0b('0x3a')]+'%'};return _0x2c4ce6;})});}_0x3ee382=_[_0x0f0b('0x3c')]({},_0x3ee382,_0x8c165a['options']);return _0x54804b[_0x0f0b('0x4b')](_0x3ee382);}})[_0x0f0b('0x26')](function(_0x3d486c){if(_0x3d486c){_0x13a2ff=_0x3d486c['length'];if(!_0x8c165a['query'][_0x0f0b('0x4d')](_0x0f0b('0x37'))){_0x3ee382[_0x0f0b('0x20')]=qs['limit'](_0x8c165a[_0x0f0b('0x33')][_0x0f0b('0x20')]);_0x3ee382[_0x0f0b('0x1f')]=qs[_0x0f0b('0x1f')](_0x8c165a[_0x0f0b('0x33')][_0x0f0b('0x1f')]);}return _0x54804b['getConfigurations'](_0x3ee382);}})[_0x0f0b('0x26')](function(_0x4ebf13){if(_0x4ebf13){return _0x4ebf13?{'count':_0x13a2ff,'rows':_0x4ebf13}:null;}})['then'](respondWithResult(_0x1c6336,null))['catch'](handleError(_0x1c6336,null));};exports[_0x0f0b('0x4e')]=function(_0x4cd763,_0x6d4ada,_0x44c581){if(_0x4cd763[_0x0f0b('0x48')]['id']){delete _0x4cd763['body']['id'];}return db[_0x0f0b('0x3f')]['findOne']({'where':{'id':_0x4cd763[_0x0f0b('0x4a')]['id']}})[_0x0f0b('0x26')](handleEntityNotFound(_0x6d4ada,null))[_0x0f0b('0x26')](function(_0x34e041){if(_0x34e041){_0x4cd763[_0x0f0b('0x48')][_0x0f0b('0x4f')]=_0x34e041['id'];_0x4cd763[_0x0f0b('0x48')][_0x0f0b('0x50')]=integrations[_0x0f0b('0x51')](_0x4cd763[_0x0f0b('0x48')][_0x0f0b('0x52')],_0x4cd763[_0x0f0b('0x48')][_0x0f0b('0x2e')]);_0x4cd763['body'][_0x0f0b('0x53')]=integrations[_0x0f0b('0x54')](_0x4cd763[_0x0f0b('0x48')][_0x0f0b('0x52')],_0x4cd763[_0x0f0b('0x48')][_0x0f0b('0x2e')]);return db['ZohoConfiguration'][_0x0f0b('0x47')](_0x4cd763[_0x0f0b('0x48')],{'include':[{'model':db['ZohoField'],'as':_0x0f0b('0x50')},{'model':db[_0x0f0b('0x55')],'as':_0x0f0b('0x53')}]});}return null;})[_0x0f0b('0x26')](respondWithResult(_0x6d4ada,null))[_0x0f0b('0x44')](handleError(_0x6d4ada,null));};function getAccessToken(_0x37b646){return new Promise(function(_0x2bdbc5,_0x46fb51){var _0x4dfe1b;switch(_0x37b646[_0x0f0b('0x56')]){case'US':_0x4dfe1b='https://accounts.zoho.com';break;case'AU':_0x4dfe1b=_0x0f0b('0x57');break;case'EU':_0x4dfe1b=_0x0f0b('0x58');break;case'IN':_0x4dfe1b=_0x0f0b('0x59');break;case'CN':_0x4dfe1b=_0x0f0b('0x5a');break;default:_0x4dfe1b='https://accounts.zoho.eu';break;}var _0x3fa501={'method':_0x0f0b('0x5b'),'uri':_0x4dfe1b+_0x0f0b('0x5c'),'qs':{'refresh_token':_0x37b646['refreshToken'],'client_id':_0x37b646['clientId'],'client_secret':_0x37b646['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3fa501)[_0x0f0b('0x26')](function(_0x5f53d3){if(_0x5f53d3[_0x0f0b('0x5d')]){_0x2bdbc5(_0x5f53d3[_0x0f0b('0x5d')]);}else{_0x46fb51(_0x0f0b('0x5e'));}})['catch'](function(_0x484b51){_0x46fb51(_0x484b51);});});}exports[_0x0f0b('0x5f')]=function(_0x4c0f9d,_0x4b5188,_0xf3ccfe){var _0x3a94c6,_0x50ff56,_0x3bc1f2,_0x420e79,_0x55d065;return db['ZohoAccount'][_0x0f0b('0x60')]({'where':{'id':_0x4c0f9d[_0x0f0b('0x4a')]['id']},'attributes':['id',_0x0f0b('0x61'),_0x0f0b('0x56'),_0x0f0b('0x62'),_0x0f0b('0x63'),_0x0f0b('0x64'),'code',_0x0f0b('0x65')]})[_0x0f0b('0x26')](handleEntityNotFound(_0x4b5188,null))['then'](function(_0x215cae){_0x55d065=_0x215cae;_0x3a94c6=_0x55d065[_0x0f0b('0x61')];_0x50ff56=_0x3a94c6===_0x0f0b('0x66')?'eu':_0x0f0b('0x67');_0x3bc1f2=_0x55d065[_0x0f0b('0x64')];var _0x5d1c0d=_0x3bc1f2['slice'](-0x1);if(_0x5d1c0d==='/'||_0x5d1c0d==='\x5c'||_0x5d1c0d===':'){_0x3bc1f2=_0x3bc1f2[_0x0f0b('0x68')](0x0,_0x3bc1f2[_0x0f0b('0x69')](_0x5d1c0d));}if(!_0x55d065[_0x0f0b('0x65')]){throw new Error(_0x0f0b('0x6a'));}return getAccessToken(_0x55d065);})[_0x0f0b('0x26')](function(_0x806ee0){if(_0x806ee0){return rp({'method':_0x0f0b('0x6b'),'uri':util[_0x0f0b('0x6c')](_0x0f0b('0x6d'),_0x50ff56),'qs':{'module':_0x0f0b('0x6e')},'headers':{'Authorization':_0x0f0b('0x6f')+_0x806ee0},'json':!![]});}})[_0x0f0b('0x26')](function(_0x58c919){if(_0x58c919){if(_0x58c919['response']&&_0x58c919[_0x0f0b('0x70')][_0x0f0b('0x27')]){throw new Error(_0x58c919[_0x0f0b('0x70')]['error'][_0x0f0b('0x71')]);}var _0x33047e=[];var _0x2e4644=[];var _0x2fe06d=['Owner','Subject',_0x0f0b('0x72'),'WhoId','Call_Duration',_0x0f0b('0x73'),_0x0f0b('0x74'),_0x0f0b('0x75')];_0x2e4644=_[_0x0f0b('0x76')](_0x58c919['fields'],function(_0x2e9ff4){return _0x2fe06d[_0x0f0b('0x77')](_0x2e9ff4['api_name']);});for(var _0x4bcd2b=0x0;_0x4bcd2b<_0x2e4644['length'];_0x4bcd2b++){if(_0x2e4644[_0x4bcd2b][_0x0f0b('0x78')]===![]){_0x33047e[_0x0f0b('0x79')]({'id':_0x2e4644[_0x4bcd2b]['id'],'name':_0x2e4644[_0x4bcd2b][_0x0f0b('0x7a')],'custom':_0x2e4644[_0x4bcd2b][_0x0f0b('0x7b')],'options':_0x2e4644[_0x4bcd2b][_0x0f0b('0x7c')]===_0x0f0b('0x7d')&&_0x2e4644[_0x4bcd2b][_0x0f0b('0x7e')][_0x0f0b('0x45')]>-0x1?_['map'](_0x2e4644[_0x4bcd2b][_0x0f0b('0x7e')],function(_0x2de812){return{'name':_0x2de812,'value':_0x2de812};}):[]});}}return{'count':_0x33047e[_0x0f0b('0x45')],'rows':_0x33047e};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4b5188,null))[_0x0f0b('0x44')](function(_0x1dc533){var _0x1a2b9d=_0x4c0f9d[_0x0f0b('0x33')]['test']?0x1f4:_0x1dc533[_0x0f0b('0x7f')]||0x1f4;logger[_0x0f0b('0x27')](_0x0f0b('0x80'),_0x0f0b('0x5f'),_0x1a2b9d,JSON[_0x0f0b('0x81')](_0x1dc533));delete _0x1dc533['name'];if(_0x1a2b9d===0x191){_0x1a2b9d=0x190;}_0x4b5188[_0x0f0b('0x1c')](_0x1a2b9d)['send'](_0x4c0f9d[_0x0f0b('0x33')][_0x0f0b('0x82')]?{'message':_0x0f0b('0x83'),'statusCode':_0x1dc533[_0x0f0b('0x7f')]}:_0x1dc533);});}; \ No newline at end of file +var _0x90aa=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','code','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','response','error','message','Owner','Subject','Description','Call_Duration','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','stack','name','index','map','ZohoAccount','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x2b40e7,_0x391bbf){var _0x43202a=function(_0x28755e){while(--_0x28755e){_0x2b40e7['push'](_0x2b40e7['shift']());}};_0x43202a(++_0x391bbf);}(_0x90aa,0x155));var _0xa90a=function(_0x1d2926,_0x320f30){_0x1d2926=_0x1d2926-0x0;var _0x13f138=_0x90aa[_0x1d2926];return _0x13f138;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa90a('0x0'));var zipdir=require(_0xa90a('0x1'));var jsonpatch=require(_0xa90a('0x2'));var rp=require('request-promise');var moment=require(_0xa90a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa90a('0x4'));var util=require(_0xa90a('0x5'));var path=require(_0xa90a('0x6'));var sox=require('sox');var csv=require(_0xa90a('0x7'));var ejs=require(_0xa90a('0x8'));var fs=require('fs');var fs_extra=require(_0xa90a('0x9'));var _=require(_0xa90a('0xa'));var squel=require(_0xa90a('0xb'));var crypto=require(_0xa90a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa90a('0xd'));var toCsv=require(_0xa90a('0x7'));var querystring=require('querystring');var Papa=require(_0xa90a('0xe'));var Redis=require(_0xa90a('0xf'));var authService=require(_0xa90a('0x10'));var qs=require(_0xa90a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa90a('0x12'));var logger=require(_0xa90a('0x13'))(_0xa90a('0x14'));var utils=require(_0xa90a('0x15'));var config=require(_0xa90a('0x16'));var licenseUtil=require(_0xa90a('0x17'));var db=require(_0xa90a('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x23202e,_0x33d8aa){_0x33d8aa=_0x33d8aa||0xcc;return function(_0x382b99){if(_0x382b99){return _0x23202e[_0xa90a('0x19')](_0x33d8aa);}return _0x23202e[_0xa90a('0x1a')](_0x33d8aa)[_0xa90a('0x1b')]();};}function respondWithResult(_0x25e648,_0xc4cb0b){_0xc4cb0b=_0xc4cb0b||0xc8;return function(_0x1be430){if(_0x1be430){return _0x25e648[_0xa90a('0x1a')](_0xc4cb0b)[_0xa90a('0x1c')](_0x1be430);}};}function respondWithFilteredResult(_0x51523a,_0x3a7fe9){return function(_0x4717b5){if(_0x4717b5){var _0x15ac17=typeof _0x3a7fe9[_0xa90a('0x1d')]==='undefined'&&typeof _0x3a7fe9['limit']===_0xa90a('0x1e');var _0x4a1c90=_0x4717b5[_0xa90a('0x1f')];var _0x414de9=_0x15ac17?0x0:_0x3a7fe9[_0xa90a('0x1d')];var _0x149395=_0x15ac17?_0x4717b5[_0xa90a('0x1f')]:_0x3a7fe9[_0xa90a('0x1d')]+_0x3a7fe9[_0xa90a('0x20')];var _0x4b782b;if(_0x149395>=_0x4a1c90){_0x149395=_0x4a1c90;_0x4b782b=0xc8;}else{_0x4b782b=0xce;}_0x51523a[_0xa90a('0x1a')](_0x4b782b);return _0x51523a[_0xa90a('0x21')](_0xa90a('0x22'),_0x414de9+'-'+_0x149395+'/'+_0x4a1c90)['json'](_0x4717b5);}return null;};}function patchUpdates(_0x17a640){return function(_0x587884){try{jsonpatch['apply'](_0x587884,_0x17a640,!![]);}catch(_0x47d040){return BPromise[_0xa90a('0x23')](_0x47d040);}return _0x587884[_0xa90a('0x24')]();};}function saveUpdates(_0x490a64,_0x4a6f3a){return function(_0x347661){if(_0x347661){return _0x347661['update'](_0x490a64)[_0xa90a('0x25')](function(_0x371477){return _0x371477;});}return null;};}function removeEntity(_0x12339f,_0x43ddc8){return function(_0xb717bd){if(_0xb717bd){return _0xb717bd[_0xa90a('0x26')]()[_0xa90a('0x25')](function(){_0x12339f[_0xa90a('0x1a')](0xcc)[_0xa90a('0x1b')]();});}};}function handleEntityNotFound(_0x53c894,_0xf2c07){return function(_0x393106){if(!_0x393106){_0x53c894['sendStatus'](0x194);}return _0x393106;};}function handleError(_0x4c5a51,_0x51035f){_0x51035f=_0x51035f||0x1f4;return function(_0x34ddb3){logger['error'](_0x34ddb3[_0xa90a('0x27')]);if(_0x34ddb3[_0xa90a('0x28')]){delete _0x34ddb3['name'];}_0x4c5a51['status'](_0x51035f)['send'](_0x34ddb3);};}exports[_0xa90a('0x29')]=function(_0x129b62,_0x1c35b6){var _0x272685={},_0x1a1c7b={},_0x2d37e3={'count':0x0,'rows':[]};var _0x5b2582=_[_0xa90a('0x2a')](db[_0xa90a('0x2b')]['rawAttributes'],function(_0x333704){return{'name':_0x333704['fieldName'],'type':_0x333704[_0xa90a('0x2c')][_0xa90a('0x2d')]};});_0x1a1c7b[_0xa90a('0x2e')]=_[_0xa90a('0x2a')](_0x5b2582,_0xa90a('0x28'));_0x1a1c7b[_0xa90a('0x2f')]=_[_0xa90a('0x30')](_0x129b62[_0xa90a('0x2f')]);_0x1a1c7b[_0xa90a('0x31')]=_[_0xa90a('0x32')](_0x1a1c7b[_0xa90a('0x2e')],_0x1a1c7b[_0xa90a('0x2f')]);_0x272685[_0xa90a('0x33')]=_[_0xa90a('0x32')](_0x1a1c7b[_0xa90a('0x2e')],qs[_0xa90a('0x34')](_0x129b62[_0xa90a('0x2f')][_0xa90a('0x34')]));_0x272685[_0xa90a('0x33')]=_0x272685[_0xa90a('0x33')][_0xa90a('0x35')]?_0x272685[_0xa90a('0x33')]:_0x1a1c7b[_0xa90a('0x2e')];if(!_0x129b62[_0xa90a('0x2f')][_0xa90a('0x36')](_0xa90a('0x37'))){_0x272685[_0xa90a('0x20')]=qs[_0xa90a('0x20')](_0x129b62[_0xa90a('0x2f')][_0xa90a('0x20')]);_0x272685[_0xa90a('0x1d')]=qs[_0xa90a('0x1d')](_0x129b62[_0xa90a('0x2f')][_0xa90a('0x1d')]);}_0x272685[_0xa90a('0x38')]=qs[_0xa90a('0x39')](_0x129b62[_0xa90a('0x2f')][_0xa90a('0x39')]);_0x272685[_0xa90a('0x3a')]=qs['filters'](_[_0xa90a('0x3b')](_0x129b62[_0xa90a('0x2f')],_0x1a1c7b['filters']),_0x5b2582);if(_0x129b62[_0xa90a('0x2f')][_0xa90a('0x3c')]){_0x272685[_0xa90a('0x3a')]=_[_0xa90a('0x3d')](_0x272685['where'],{'$or':_[_0xa90a('0x2a')](_0x5b2582,function(_0x5f49ac){if(_0x5f49ac[_0xa90a('0x2c')]!=='VIRTUAL'){var _0x4e6648={};_0x4e6648[_0x5f49ac[_0xa90a('0x28')]]={'$like':'%'+_0x129b62[_0xa90a('0x2f')][_0xa90a('0x3c')]+'%'};return _0x4e6648;}})});}_0x272685=_[_0xa90a('0x3d')]({},_0x272685,_0x129b62[_0xa90a('0x3e')]);var _0x316c41={'where':_0x272685[_0xa90a('0x3a')]};return db[_0xa90a('0x2b')][_0xa90a('0x1f')](_0x316c41)[_0xa90a('0x25')](function(_0x7779da){_0x2d37e3[_0xa90a('0x1f')]=_0x7779da;if(_0x129b62[_0xa90a('0x2f')][_0xa90a('0x3f')]){_0x272685[_0xa90a('0x40')]=[{'all':!![]}];}return db[_0xa90a('0x2b')][_0xa90a('0x41')](_0x272685);})[_0xa90a('0x25')](function(_0x47adb7){_0x2d37e3[_0xa90a('0x42')]=_0x47adb7;return _0x2d37e3;})['then'](respondWithFilteredResult(_0x1c35b6,_0x272685))[_0xa90a('0x43')](handleError(_0x1c35b6,null));};exports['show']=function(_0xdba151,_0x283b45){var _0x5edc1d={'raw':![],'where':{'id':_0xdba151['params']['id']}},_0x27f5f2={};_0x27f5f2[_0xa90a('0x2e')]=_[_0xa90a('0x30')](db['ZohoAccount'][_0xa90a('0x44')]);_0x27f5f2[_0xa90a('0x2f')]=_['keys'](_0xdba151['query']);_0x27f5f2['filters']=_[_0xa90a('0x32')](_0x27f5f2[_0xa90a('0x2e')],_0x27f5f2[_0xa90a('0x2f')]);_0x5edc1d[_0xa90a('0x33')]=_[_0xa90a('0x32')](_0x27f5f2['model'],qs[_0xa90a('0x34')](_0xdba151['query'][_0xa90a('0x34')]));_0x5edc1d[_0xa90a('0x33')]=_0x5edc1d['attributes'][_0xa90a('0x35')]?_0x5edc1d[_0xa90a('0x33')]:_0x27f5f2['model'];if(_0xdba151[_0xa90a('0x2f')]['includeAll']){_0x5edc1d[_0xa90a('0x40')]=[{'all':!![]}];}_0x5edc1d=_[_0xa90a('0x3d')]({},_0x5edc1d,_0xdba151[_0xa90a('0x3e')]);return db[_0xa90a('0x2b')][_0xa90a('0x45')](_0x5edc1d)[_0xa90a('0x25')](handleEntityNotFound(_0x283b45,null))[_0xa90a('0x25')](respondWithResult(_0x283b45,null))[_0xa90a('0x43')](handleError(_0x283b45,null));};exports[_0xa90a('0x46')]=function(_0x38a523,_0x15212d){return db['ZohoAccount']['create'](_0x38a523[_0xa90a('0x47')],{})['then'](respondWithResult(_0x15212d,0xc9))[_0xa90a('0x43')](handleError(_0x15212d,null));};exports['update']=function(_0x1c77bd,_0x4dba28){if(_0x1c77bd[_0xa90a('0x47')]['id']){delete _0x1c77bd['body']['id'];}return db[_0xa90a('0x2b')]['find']({'where':{'id':_0x1c77bd[_0xa90a('0x48')]['id']}})[_0xa90a('0x25')](handleEntityNotFound(_0x4dba28,null))[_0xa90a('0x25')](saveUpdates(_0x1c77bd[_0xa90a('0x47')],null))[_0xa90a('0x25')](respondWithResult(_0x4dba28,null))[_0xa90a('0x43')](handleError(_0x4dba28,null));};exports['destroy']=function(_0x14fa5c,_0x1e3e89){return db['ZohoAccount']['find']({'where':{'id':_0x14fa5c[_0xa90a('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e3e89,null))['then'](removeEntity(_0x1e3e89,null))[_0xa90a('0x43')](handleError(_0x1e3e89,null));};exports['getConfigurations']=function(_0x2b0e23,_0x4e5805,_0x392730){var _0x2f2949={};var _0x503419={};var _0x2d22f1;var _0x165163;return db['ZohoAccount'][_0xa90a('0x49')]({'where':{'id':_0x2b0e23[_0xa90a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e5805,null))[_0xa90a('0x25')](function(_0x396456){if(_0x396456){_0x2d22f1=_0x396456;_0x503419[_0xa90a('0x2e')]=_[_0xa90a('0x30')](db[_0xa90a('0x4a')][_0xa90a('0x44')]);_0x503419[_0xa90a('0x2f')]=_[_0xa90a('0x30')](_0x2b0e23[_0xa90a('0x2f')]);_0x503419[_0xa90a('0x31')]=_[_0xa90a('0x32')](_0x503419[_0xa90a('0x2e')],_0x503419[_0xa90a('0x2f')]);_0x2f2949[_0xa90a('0x33')]=_[_0xa90a('0x32')](_0x503419[_0xa90a('0x2e')],qs[_0xa90a('0x34')](_0x2b0e23[_0xa90a('0x2f')][_0xa90a('0x34')]));_0x2f2949[_0xa90a('0x33')]=_0x2f2949[_0xa90a('0x33')][_0xa90a('0x35')]?_0x2f2949[_0xa90a('0x33')]:_0x503419[_0xa90a('0x2e')];_0x2f2949[_0xa90a('0x38')]=qs[_0xa90a('0x39')](_0x2b0e23[_0xa90a('0x2f')][_0xa90a('0x39')]);_0x2f2949[_0xa90a('0x3a')]=qs[_0xa90a('0x31')](_[_0xa90a('0x3b')](_0x2b0e23[_0xa90a('0x2f')],_0x503419[_0xa90a('0x31')]));if(_0x2b0e23[_0xa90a('0x2f')]['filter']){_0x2f2949[_0xa90a('0x3a')]=_[_0xa90a('0x3d')](_0x2f2949[_0xa90a('0x3a')],{'$or':_[_0xa90a('0x2a')](_0x2f2949[_0xa90a('0x33')],function(_0x10380e){var _0x3d01ba={};_0x3d01ba[_0x10380e]={'$like':'%'+_0x2b0e23['query']['filter']+'%'};return _0x3d01ba;})});}_0x2f2949=_[_0xa90a('0x3d')]({},_0x2f2949,_0x2b0e23['options']);return _0x2d22f1[_0xa90a('0x4b')](_0x2f2949);}})[_0xa90a('0x25')](function(_0x5e1701){if(_0x5e1701){_0x165163=_0x5e1701['length'];if(!_0x2b0e23['query'][_0xa90a('0x36')](_0xa90a('0x37'))){_0x2f2949['limit']=qs['limit'](_0x2b0e23[_0xa90a('0x2f')][_0xa90a('0x20')]);_0x2f2949[_0xa90a('0x1d')]=qs[_0xa90a('0x1d')](_0x2b0e23[_0xa90a('0x2f')][_0xa90a('0x1d')]);}return _0x2d22f1[_0xa90a('0x4b')](_0x2f2949);}})[_0xa90a('0x25')](function(_0x15a137){if(_0x15a137){return _0x15a137?{'count':_0x165163,'rows':_0x15a137}:null;}})[_0xa90a('0x25')](respondWithResult(_0x4e5805,null))[_0xa90a('0x43')](handleError(_0x4e5805,null));};exports[_0xa90a('0x4c')]=function(_0x33fdc0,_0x33769b,_0x1b36b6){if(_0x33fdc0[_0xa90a('0x47')]['id']){delete _0x33fdc0[_0xa90a('0x47')]['id'];}return db[_0xa90a('0x2b')]['findOne']({'where':{'id':_0x33fdc0[_0xa90a('0x48')]['id']}})[_0xa90a('0x25')](handleEntityNotFound(_0x33769b,null))[_0xa90a('0x25')](function(_0x1f01b8){if(_0x1f01b8){_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x4d')]=_0x1f01b8['id'];_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x4e')]=integrations[_0xa90a('0x4f')](_0x33fdc0['body']['channel'],_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x2c')]);_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x50')]=integrations[_0xa90a('0x51')](_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x52')],_0x33fdc0[_0xa90a('0x47')][_0xa90a('0x2c')]);return db['ZohoConfiguration'][_0xa90a('0x46')](_0x33fdc0['body'],{'include':[{'model':db[_0xa90a('0x53')],'as':'Subjects'},{'model':db[_0xa90a('0x53')],'as':_0xa90a('0x50')}]});}return null;})[_0xa90a('0x25')](respondWithResult(_0x33769b,null))[_0xa90a('0x43')](handleError(_0x33769b,null));};function getAccessToken(_0x284de9){return new Promise(function(_0x5e216b,_0x487de){var _0x18fac9;switch(_0x284de9[_0xa90a('0x54')]){case'US':_0x18fac9=_0xa90a('0x55');break;case'AU':_0x18fac9='https://accounts.zoho.com.au';break;case'EU':_0x18fac9=_0xa90a('0x56');break;case'IN':_0x18fac9=_0xa90a('0x57');break;case'CN':_0x18fac9=_0xa90a('0x58');break;default:_0x18fac9=_0xa90a('0x56');break;}var _0x43c3ff={'method':_0xa90a('0x59'),'uri':_0x18fac9+'/oauth/v2/token','qs':{'refresh_token':_0x284de9['refreshToken'],'client_id':_0x284de9[_0xa90a('0x5a')],'client_secret':_0x284de9[_0xa90a('0x5b')],'grant_type':_0xa90a('0x5c')},'json':!![]};return rp(_0x43c3ff)[_0xa90a('0x25')](function(_0x48054e){if(_0x48054e[_0xa90a('0x5d')]){_0x5e216b(_0x48054e['access_token']);}else{_0x487de('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xa90a('0x43')](function(_0x3a8c7e){_0x487de(_0x3a8c7e);});});}exports[_0xa90a('0x5e')]=function(_0x167b1f,_0x15bc2a,_0x1280a9){var _0x342b7e,_0x21e159,_0x594797,_0x528d33,_0x1e60d5;return db[_0xa90a('0x2b')][_0xa90a('0x49')]({'where':{'id':_0x167b1f['params']['id']},'attributes':['id',_0xa90a('0x5f'),_0xa90a('0x54'),'clientId','clientSecret',_0xa90a('0x60'),_0xa90a('0x61'),_0xa90a('0x62')]})['then'](handleEntityNotFound(_0x15bc2a,null))[_0xa90a('0x25')](function(_0xa94bde){_0x1e60d5=_0xa94bde;_0x342b7e=_0x1e60d5['host'];_0x21e159=_0x342b7e===_0xa90a('0x63')?'eu':_0xa90a('0x64');_0x594797=_0x1e60d5['serverUrl'];var _0x5b1716=_0x594797[_0xa90a('0x65')](-0x1);if(_0x5b1716==='/'||_0x5b1716==='\x5c'||_0x5b1716===':'){_0x594797=_0x594797[_0xa90a('0x66')](0x0,_0x594797[_0xa90a('0x67')](_0x5b1716));}if(!_0x1e60d5[_0xa90a('0x62')]){throw new Error(_0xa90a('0x68'));}return getAccessToken(_0x1e60d5);})[_0xa90a('0x25')](function(_0x30638d){if(_0x30638d){return rp({'method':_0xa90a('0x69'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x21e159),'qs':{'module':_0xa90a('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x30638d},'json':!![]});}})[_0xa90a('0x25')](function(_0x2c0de0){if(_0x2c0de0){if(_0x2c0de0[_0xa90a('0x6b')]&&_0x2c0de0[_0xa90a('0x6b')][_0xa90a('0x6c')]){throw new Error(_0x2c0de0[_0xa90a('0x6b')][_0xa90a('0x6c')][_0xa90a('0x6d')]);}var _0x2372b1=[];var _0x324e42=[];var _0x57c342=[_0xa90a('0x6e'),_0xa90a('0x6f'),_0xa90a('0x70'),'WhoId',_0xa90a('0x71'),'Call_Result',_0xa90a('0x72'),_0xa90a('0x73')];_0x324e42=_[_0xa90a('0x74')](_0x2c0de0['fields'],function(_0x49db6e){return _0x57c342[_0xa90a('0x75')](_0x49db6e['api_name']);});for(var _0x2fe353=0x0;_0x2fe353<_0x324e42[_0xa90a('0x35')];_0x2fe353++){if(_0x324e42[_0x2fe353][_0xa90a('0x76')]===![]){_0x2372b1[_0xa90a('0x77')]({'id':_0x324e42[_0x2fe353]['id'],'name':_0x324e42[_0x2fe353][_0xa90a('0x78')],'custom':_0x324e42[_0x2fe353][_0xa90a('0x79')],'options':_0x324e42[_0x2fe353][_0xa90a('0x7a')]===_0xa90a('0x7b')&&_0x324e42[_0x2fe353][_0xa90a('0x7c')][_0xa90a('0x35')]>-0x1?_['map'](_0x324e42[_0x2fe353][_0xa90a('0x7c')],function(_0x1ebb93){return{'name':_0x1ebb93,'value':_0x1ebb93};}):[]});}}return{'count':_0x2372b1['length'],'rows':_0x2372b1};}else{return{'count':0x0,'rows':[]};}})[_0xa90a('0x25')](respondWithResult(_0x15bc2a,null))['catch'](function(_0xf46c5a){var _0xcd711b=_0x167b1f[_0xa90a('0x2f')][_0xa90a('0x7d')]?0x1f4:_0xf46c5a[_0xa90a('0x7e')]||0x1f4;logger[_0xa90a('0x6c')](_0xa90a('0x7f'),_0xa90a('0x5e'),_0xcd711b,JSON[_0xa90a('0x80')](_0xf46c5a));delete _0xf46c5a[_0xa90a('0x28')];if(_0xcd711b===0x191){_0xcd711b=0x190;}_0x15bc2a[_0xa90a('0x1a')](_0xcd711b)[_0xa90a('0x81')](_0x167b1f[_0xa90a('0x2f')][_0xa90a('0x7d')]?{'message':_0xa90a('0x82'),'statusCode':_0xf46c5a['statusCode']}:_0xf46c5a);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 99c1c44..04f2d0d 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 _0x1386=['serverUrl','clientId','clientSecret','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','refreshToken','error','util','../../config/logger','moment','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone'];(function(_0x39780c,_0x5782c9){var _0x53c19b=function(_0x594f01){while(--_0x594f01){_0x39780c['push'](_0x39780c['shift']());}};_0x53c19b(++_0x5782c9);}(_0x1386,0x143));var _0x6138=function(_0x33ba78,_0xbcaa2d){_0x33ba78=_0x33ba78-0x0;var _0x24a8a8=_0x1386[_0x33ba78];return _0x24a8a8;};'use strict';var _=require('lodash');var util=require(_0x6138('0x0'));var logger=require(_0x6138('0x1'))('api');var moment=require(_0x6138('0x2'));var BPromise=require('bluebird');var rp=require(_0x6138('0x3'));var fs=require('fs');var path=require(_0x6138('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6138('0x5'));var integrations=require(_0x6138('0x6'));module[_0x6138('0x7')]=function(_0x3a523a,_0x5589b3){return _0x3a523a[_0x6138('0x8')](_0x6138('0x9'),attributes,{'tableName':_0x6138('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x293829,_0x58f51b,_0x2efcf2){if(_0x293829[_0x6138('0xb')](_0x6138('0xc'))||_0x293829['changed'](_0x6138('0xd'))||_0x293829[_0x6138('0xb')](_0x6138('0xe'))||_0x293829[_0x6138('0xb')](_0x6138('0xf'))||_0x293829[_0x6138('0xb')]('code')||_0x293829[_0x6138('0xb')](_0x6138('0x10'))){var _0x3e7dd7,_0x46cb77;_0x3e7dd7=_0x293829[_0x6138('0xd')];var _0x2522b8=_0x3e7dd7['slice'](-0x1);if(_0x2522b8==='/'||_0x2522b8==='\x5c'||_0x2522b8===':'){_0x3e7dd7=_0x3e7dd7[_0x6138('0x11')](0x0,_0x3e7dd7[_0x6138('0x12')](_0x2522b8));}switch(_0x293829['zone']){case'US':_0x46cb77='https://accounts.zoho.com';break;case'AU':_0x46cb77=_0x6138('0x13');break;case'IN':_0x46cb77=_0x6138('0x14');break;case'CN':_0x46cb77=_0x6138('0x15');break;default:_0x46cb77='https://accounts.zoho.eu';break;}var _0x54e3f8={'method':_0x6138('0x16'),'uri':_0x46cb77+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x293829[_0x6138('0xe')],'client_secret':_0x293829[_0x6138('0xf')],'redirect_uri':_0x293829[_0x6138('0xd')],'code':_0x293829[_0x6138('0x17')]},'headers':{'Content-Type':_0x6138('0x18')}};return rp(_0x54e3f8)[_0x6138('0x19')](function(_0x4d8d30){var _0x18cf37=JSON[_0x6138('0x1a')](_0x4d8d30);if(_0x18cf37[_0x6138('0x1b')]){_0x293829['refreshToken']=_0x18cf37[_0x6138('0x1b')];logger[_0x6138('0x1c')](util[_0x6138('0x1d')](_0x6138('0x1e'),_0x293829[_0x6138('0x1f')],_0x293829['id']));}else{logger['error'](util[_0x6138('0x1d')](_0x6138('0x20'),_0x293829[_0x6138('0x1f')],_0x293829['id']),util[_0x6138('0x21')](_0x18cf37,{'showHidden':![],'depth':null}));}return _0x2efcf2(null,_0x58f51b);})[_0x6138('0x22')](function(_0x58c161){logger['error'](util[_0x6138('0x1d')](_0x6138('0x20'),_0x293829[_0x6138('0x1f')],_0x293829['id']),util[_0x6138('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x2efcf2(_0x58c161);});}else{return _0x2efcf2(null,_0x58f51b);}},'beforeUpdate':function(_0x3e1eb2,_0x1a6c80,_0x3c03ca){if(_0x3e1eb2[_0x6138('0xb')](_0x6138('0xc'))||_0x3e1eb2['changed'](_0x6138('0xd'))||_0x3e1eb2['changed'](_0x6138('0xe'))||_0x3e1eb2[_0x6138('0xb')](_0x6138('0xf'))||_0x3e1eb2[_0x6138('0xb')](_0x6138('0x17'))||_0x3e1eb2[_0x6138('0xb')](_0x6138('0x10'))){var _0x3435da,_0x2a390e;_0x3435da=_0x3e1eb2[_0x6138('0xd')];var _0x477132=_0x3435da[_0x6138('0x23')](-0x1);if(_0x477132==='/'||_0x477132==='\x5c'||_0x477132===':'){_0x3435da=_0x3435da[_0x6138('0x11')](0x0,_0x3435da['lastIndexOf'](_0x477132));}switch(_0x3e1eb2[_0x6138('0xc')]){case'US':_0x2a390e=_0x6138('0x24');break;case'AU':_0x2a390e=_0x6138('0x13');break;case'IN':_0x2a390e=_0x6138('0x14');break;case'CN':_0x2a390e=_0x6138('0x15');break;default:_0x2a390e=_0x6138('0x25');break;}var _0x30e98e={'method':'POST','uri':_0x2a390e+_0x6138('0x26'),'form':{'grant_type':_0x6138('0x27'),'client_id':_0x3e1eb2[_0x6138('0xe')],'client_secret':_0x3e1eb2[_0x6138('0xf')],'redirect_uri':_0x3e1eb2['serverUrl'],'code':_0x3e1eb2[_0x6138('0x17')]},'headers':{'Content-Type':_0x6138('0x18')}};return rp(_0x30e98e)[_0x6138('0x19')](function(_0x2c9787){var _0x37a5ff=JSON[_0x6138('0x1a')](_0x2c9787);if(_0x37a5ff[_0x6138('0x1b')]){_0x3e1eb2[_0x6138('0x28')]=_0x37a5ff['refresh_token'];logger['info'](util[_0x6138('0x1d')](_0x6138('0x1e'),_0x3e1eb2['name'],_0x3e1eb2['id']));}else{logger[_0x6138('0x29')](util[_0x6138('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3e1eb2[_0x6138('0x1f')],_0x3e1eb2['id']),util[_0x6138('0x21')](_0x37a5ff,{'showHidden':![],'depth':null}));}return _0x3c03ca(null,_0x1a6c80);})[_0x6138('0x22')](function(_0x4c9167){logger[_0x6138('0x29')](util[_0x6138('0x1d')](_0x6138('0x20'),_0x3e1eb2[_0x6138('0x1f')],_0x3e1eb2['id']),util[_0x6138('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x3c03ca(_0x4c9167);});}else{return _0x3c03ca(null,_0x1a6c80);}}}});}; \ No newline at end of file +var _0x0ab8=['https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','inspect','https://accounts.zoho.eu','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','moment','bluebird','rimraf','../../config/environment','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x23b0b4,_0x3552f7){var _0x52b4a6=function(_0x2c9db8){while(--_0x2c9db8){_0x23b0b4['push'](_0x23b0b4['shift']());}};_0x52b4a6(++_0x3552f7);}(_0x0ab8,0x197));var _0x80ab=function(_0x2b62e9,_0x5353a7){_0x2b62e9=_0x2b62e9-0x0;var _0x428428=_0x0ab8[_0x2b62e9];return _0x428428;};'use strict';var _=require(_0x80ab('0x0'));var util=require(_0x80ab('0x1'));var logger=require('../../config/logger')(_0x80ab('0x2'));var moment=require(_0x80ab('0x3'));var BPromise=require(_0x80ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80ab('0x5'));var config=require(_0x80ab('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1d0214,_0x395ed3){return _0x1d0214[_0x80ab('0x7')]('ZohoAccount',attributes,{'tableName':_0x80ab('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47285d,_0x3d9ab9,_0x5bd5ee){if(_0x47285d[_0x80ab('0x9')](_0x80ab('0xa'))||_0x47285d[_0x80ab('0x9')](_0x80ab('0xb'))||_0x47285d[_0x80ab('0x9')](_0x80ab('0xc'))||_0x47285d[_0x80ab('0x9')](_0x80ab('0xd'))||_0x47285d[_0x80ab('0x9')](_0x80ab('0xe'))||_0x47285d[_0x80ab('0x9')](_0x80ab('0xf'))){var _0x5f3a60,_0x2747dc;_0x5f3a60=_0x47285d[_0x80ab('0xb')];var _0x327f16=_0x5f3a60[_0x80ab('0x10')](-0x1);if(_0x327f16==='/'||_0x327f16==='\x5c'||_0x327f16===':'){_0x5f3a60=_0x5f3a60[_0x80ab('0x11')](0x0,_0x5f3a60[_0x80ab('0x12')](_0x327f16));}switch(_0x47285d[_0x80ab('0xa')]){case'US':_0x2747dc=_0x80ab('0x13');break;case'AU':_0x2747dc=_0x80ab('0x14');break;case'IN':_0x2747dc=_0x80ab('0x15');break;case'CN':_0x2747dc=_0x80ab('0x16');break;default:_0x2747dc='https://accounts.zoho.eu';break;}var _0x31e0d1={'method':_0x80ab('0x17'),'uri':_0x2747dc+_0x80ab('0x18'),'form':{'grant_type':_0x80ab('0x19'),'client_id':_0x47285d['clientId'],'client_secret':_0x47285d[_0x80ab('0xd')],'redirect_uri':_0x47285d[_0x80ab('0xb')],'code':_0x47285d['code']},'headers':{'Content-Type':_0x80ab('0x1a')}};return rp(_0x31e0d1)['then'](function(_0x3d26d1){var _0x427376=JSON[_0x80ab('0x1b')](_0x3d26d1);if(_0x427376[_0x80ab('0x1c')]){_0x47285d[_0x80ab('0x1d')]=_0x427376['refresh_token'];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x47285d['name'],_0x47285d['id']));}else{logger[_0x80ab('0x1e')](util[_0x80ab('0x1f')](_0x80ab('0x20'),_0x47285d[_0x80ab('0x21')],_0x47285d['id']),util['inspect'](_0x427376,{'showHidden':![],'depth':null}));}return _0x5bd5ee(null,_0x3d9ab9);})[_0x80ab('0x22')](function(_0x403271){logger['error'](util[_0x80ab('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x47285d[_0x80ab('0x21')],_0x47285d['id']),util[_0x80ab('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5bd5ee(_0x403271);});}else{return _0x5bd5ee(null,_0x3d9ab9);}},'beforeUpdate':function(_0x18d6f6,_0x1465c6,_0x43ec90){if(_0x18d6f6[_0x80ab('0x9')]('zone')||_0x18d6f6[_0x80ab('0x9')]('serverUrl')||_0x18d6f6[_0x80ab('0x9')](_0x80ab('0xc'))||_0x18d6f6[_0x80ab('0x9')](_0x80ab('0xd'))||_0x18d6f6[_0x80ab('0x9')](_0x80ab('0xe'))||_0x18d6f6[_0x80ab('0x9')](_0x80ab('0xf'))){var _0x2a3719,_0x1379dc;_0x2a3719=_0x18d6f6[_0x80ab('0xb')];var _0x18e9c2=_0x2a3719['slice'](-0x1);if(_0x18e9c2==='/'||_0x18e9c2==='\x5c'||_0x18e9c2===':'){_0x2a3719=_0x2a3719[_0x80ab('0x11')](0x0,_0x2a3719[_0x80ab('0x12')](_0x18e9c2));}switch(_0x18d6f6[_0x80ab('0xa')]){case'US':_0x1379dc=_0x80ab('0x13');break;case'AU':_0x1379dc=_0x80ab('0x14');break;case'IN':_0x1379dc=_0x80ab('0x15');break;case'CN':_0x1379dc=_0x80ab('0x16');break;default:_0x1379dc=_0x80ab('0x24');break;}var _0x2a15b8={'method':_0x80ab('0x17'),'uri':_0x1379dc+_0x80ab('0x18'),'form':{'grant_type':_0x80ab('0x19'),'client_id':_0x18d6f6[_0x80ab('0xc')],'client_secret':_0x18d6f6[_0x80ab('0xd')],'redirect_uri':_0x18d6f6[_0x80ab('0xb')],'code':_0x18d6f6[_0x80ab('0xe')]},'headers':{'Content-Type':_0x80ab('0x1a')}};return rp(_0x2a15b8)['then'](function(_0x572ad0){var _0x121f18=JSON[_0x80ab('0x1b')](_0x572ad0);if(_0x121f18[_0x80ab('0x1c')]){_0x18d6f6[_0x80ab('0x1d')]=_0x121f18[_0x80ab('0x1c')];logger[_0x80ab('0x25')](util['format'](_0x80ab('0x26'),_0x18d6f6['name'],_0x18d6f6['id']));}else{logger[_0x80ab('0x1e')](util[_0x80ab('0x1f')](_0x80ab('0x20'),_0x18d6f6['name'],_0x18d6f6['id']),util[_0x80ab('0x23')](_0x121f18,{'showHidden':![],'depth':null}));}return _0x43ec90(null,_0x1465c6);})[_0x80ab('0x22')](function(_0x31cb43){logger[_0x80ab('0x1e')](util[_0x80ab('0x1f')](_0x80ab('0x20'),_0x18d6f6[_0x80ab('0x21')],_0x18d6f6['id']),util[_0x80ab('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x43ec90(_0x31cb43);});}else{return _0x43ec90(null,_0x1465c6);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 897b28b..c52c61c 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 _0xeda7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','info','GetZohoAccount','findAll','options','raw','attributes','include','map','model','then','stringify','catch','ShowZohoAccount','ZohoAccount','find','lodash'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xeda7,0x196));var _0x7eda=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xeda7[_0x57add2];return _0x4e3670;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var moment=require(_0x7eda('0x2'));var BPromise=require(_0x7eda('0x3'));var rs=require(_0x7eda('0x4'));var fs=require('fs');var Redis=require(_0x7eda('0x5'));var db=require(_0x7eda('0x6'))['db'];var utils=require(_0x7eda('0x7'));var logger=require(_0x7eda('0x8'))(_0x7eda('0x9'));var config=require(_0x7eda('0xa'));var jayson=require(_0x7eda('0xb'));var client=jayson[_0x7eda('0xc')][_0x7eda('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x314602,_0x839e38,_0x163427){return new BPromise(function(_0x2bc200,_0x11576a){return client[_0x7eda('0xe')](_0x314602,_0x163427)['then'](function(_0x29bce2){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x839e38,_0x7eda('0xf'));logger[_0x7eda('0x10')](_0x7eda('0x11'),_0x839e38,_0x7eda('0xf'),JSON['stringify'](_0x29bce2));if(_0x29bce2['error']){if(_0x29bce2[_0x7eda('0x12')][_0x7eda('0x13')]===0x1f4){logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x29bce2['error'][_0x7eda('0x15')]);return _0x11576a(_0x29bce2['error'][_0x7eda('0x15')]);}logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x29bce2[_0x7eda('0x12')][_0x7eda('0x15')]);return _0x2bc200(_0x29bce2[_0x7eda('0x12')][_0x7eda('0x15')]);}else{logger[_0x7eda('0x16')](_0x7eda('0x14'),_0x839e38,'request\x20sent');_0x2bc200(_0x29bce2['result'][_0x7eda('0x15')]);}})['catch'](function(_0x597ce9){logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x597ce9);_0x11576a(_0x597ce9);});});}exports[_0x7eda('0x17')]=function(_0x8a1a07){var _0x586344=this;return new Promise(function(_0x4c8420,_0x494c83){return db['ZohoAccount'][_0x7eda('0x18')]({'raw':_0x8a1a07['options']?_0x8a1a07[_0x7eda('0x19')][_0x7eda('0x1a')]===undefined?!![]:![]:!![],'where':_0x8a1a07[_0x7eda('0x19')]?_0x8a1a07[_0x7eda('0x19')]['where']||null:null,'attributes':_0x8a1a07[_0x7eda('0x19')]?_0x8a1a07[_0x7eda('0x19')][_0x7eda('0x1b')]||null:null,'limit':_0x8a1a07[_0x7eda('0x19')]?_0x8a1a07['options']['limit']||null:null,'include':_0x8a1a07[_0x7eda('0x19')]?_0x8a1a07['options'][_0x7eda('0x1c')]?_[_0x7eda('0x1d')](_0x8a1a07[_0x7eda('0x19')][_0x7eda('0x1c')],function(_0x1519ee){return{'model':db[_0x1519ee[_0x7eda('0x1e')]],'as':_0x1519ee['as'],'attributes':_0x1519ee[_0x7eda('0x1b')],'include':_0x1519ee[_0x7eda('0x1c')]?_['map'](_0x1519ee[_0x7eda('0x1c')],function(_0x2ca61d){return{'model':db[_0x2ca61d[_0x7eda('0x1e')]],'as':_0x2ca61d['as'],'attributes':_0x2ca61d['attributes'],'include':_0x2ca61d[_0x7eda('0x1c')]?_[_0x7eda('0x1d')](_0x2ca61d[_0x7eda('0x1c')],function(_0x76f1b2){return{'model':db[_0x76f1b2[_0x7eda('0x1e')]],'as':_0x76f1b2['as'],'attributes':_0x76f1b2[_0x7eda('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7eda('0x1f')](function(_0x241b6f){logger[_0x7eda('0x16')](_0x7eda('0x17'),_0x8a1a07);logger['debug'](_0x7eda('0x17'),_0x8a1a07,JSON[_0x7eda('0x20')](_0x241b6f));_0x4c8420(_0x241b6f);})[_0x7eda('0x21')](function(_0x2c5af0){logger['error'](_0x7eda('0x17'),_0x2c5af0[_0x7eda('0x15')],_0x8a1a07);_0x494c83(_0x586344['error'](0x1f4,_0x2c5af0[_0x7eda('0x15')]));});});};exports[_0x7eda('0x22')]=function(_0x4adb03){var _0x38b3fa=this;return new Promise(function(_0x24db5a,_0x4206d6){return db[_0x7eda('0x23')][_0x7eda('0x24')]({'raw':_0x4adb03[_0x7eda('0x19')]?_0x4adb03[_0x7eda('0x19')][_0x7eda('0x1a')]===undefined?!![]:![]:!![],'where':_0x4adb03[_0x7eda('0x19')]?_0x4adb03[_0x7eda('0x19')]['where']||null:null,'attributes':_0x4adb03[_0x7eda('0x19')]?_0x4adb03['options'][_0x7eda('0x1b')]||null:null,'include':_0x4adb03[_0x7eda('0x19')]?_0x4adb03[_0x7eda('0x19')][_0x7eda('0x1c')]?_['map'](_0x4adb03[_0x7eda('0x19')][_0x7eda('0x1c')],function(_0xc81856){return{'model':db[_0xc81856['model']],'as':_0xc81856['as'],'attributes':_0xc81856[_0x7eda('0x1b')],'include':_0xc81856[_0x7eda('0x1c')]?_[_0x7eda('0x1d')](_0xc81856['include'],function(_0x339b41){return{'model':db[_0x339b41[_0x7eda('0x1e')]],'as':_0x339b41['as'],'attributes':_0x339b41[_0x7eda('0x1b')],'include':_0x339b41[_0x7eda('0x1c')]?_['map'](_0x339b41[_0x7eda('0x1c')],function(_0x321873){return{'model':db[_0x321873['model']],'as':_0x321873['as'],'attributes':_0x321873[_0x7eda('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7eda('0x1f')](function(_0x34681e){logger[_0x7eda('0x16')]('ShowZohoAccount',_0x4adb03);logger[_0x7eda('0x10')](_0x7eda('0x22'),_0x4adb03,JSON['stringify'](_0x34681e));_0x24db5a(_0x34681e);})['catch'](function(_0x3259c0){logger[_0x7eda('0x12')]('ShowZohoAccount',_0x3259c0[_0x7eda('0x15')],_0x4adb03);_0x4206d6(_0x38b3fa[_0x7eda('0x12')](0x1f4,_0x3259c0[_0x7eda('0x15')]));});});}; \ No newline at end of file +var _0x9536=['code','message','info','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9536,0x179));var _0x6953=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x9536[_0xbe40ad];return _0x50fac9;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')]({'raw':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1b')]===undefined?!![]:![]:!![],'where':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1c')]||null:null,'attributes':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1d')]||null:null,'limit':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1e')]||null:null,'include':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')],function(_0x2a7f6a){return{'model':db[_0x2a7f6a['model']],'as':_0x2a7f6a['as'],'attributes':_0x2a7f6a['attributes'],'include':_0x2a7f6a['include']?_[_0x6953('0x20')](_0x2a7f6a[_0x6953('0x1f')],function(_0x550be4){return{'model':db[_0x550be4[_0x6953('0x21')]],'as':_0x550be4['as'],'attributes':_0x550be4['attributes'],'include':_0x550be4[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x550be4[_0x6953('0x1f')],function(_0x2cc01e){return{'model':db[_0x2cc01e[_0x6953('0x21')]],'as':_0x2cc01e['as'],'attributes':_0x2cc01e[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd890){logger[_0x6953('0x15')]('GetZohoAccount',_0x2da771);logger[_0x6953('0xf')]('GetZohoAccount',_0x2da771,JSON[_0x6953('0x11')](_0x3dd890));_0x10858a(_0x3dd890);})[_0x6953('0x16')](function(_0x426c7c){logger['error'](_0x6953('0x17'),_0x426c7c[_0x6953('0x14')],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x426c7c['message']));});});};exports[_0x6953('0x22')]=function(_0x132a71){var _0x481c6a=this;return new Promise(function(_0x4d856d,_0xd80e42){return db[_0x6953('0x18')][_0x6953('0x23')]({'raw':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x132a71[_0x6953('0x1a')]?_0x132a71['options'][_0x6953('0x1c')]||null:null,'attributes':_0x132a71[_0x6953('0x1a')]?_0x132a71['options']['attributes']||null:null,'include':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x132a71[_0x6953('0x1a')]['include'],function(_0x4e95f1){return{'model':db[_0x4e95f1['model']],'as':_0x4e95f1['as'],'attributes':_0x4e95f1['attributes'],'include':_0x4e95f1[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x4e95f1[_0x6953('0x1f')],function(_0x11f316){return{'model':db[_0x11f316[_0x6953('0x21')]],'as':_0x11f316['as'],'attributes':_0x11f316[_0x6953('0x1d')],'include':_0x11f316['include']?_[_0x6953('0x20')](_0x11f316['include'],function(_0x199c67){return{'model':db[_0x199c67['model']],'as':_0x199c67['as'],'attributes':_0x199c67[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6953('0xc')](function(_0xd81149){logger[_0x6953('0x15')]('ShowZohoAccount',_0x132a71);logger[_0x6953('0xf')](_0x6953('0x22'),_0x132a71,JSON[_0x6953('0x11')](_0xd81149));_0x4d856d(_0xd81149);})[_0x6953('0x16')](function(_0x40b6ea){logger[_0x6953('0x12')](_0x6953('0x22'),_0x40b6ea[_0x6953('0x14')],_0x132a71);_0xd80e42(_0x481c6a[_0x6953('0x12')](0x1f4,_0x40b6ea[_0x6953('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index c2c735a..376b099 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 _0xa529=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa529,0x124));var _0x9a52=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa529[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x9a52('0x0'));var util=require(_0x9a52('0x1'));var path=require(_0x9a52('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9a52('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9a52('0x4'));var interaction=require(_0x9a52('0x5'));var config=require(_0x9a52('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x9a52('0x7')]('/',auth[_0x9a52('0x8')](),controller[_0x9a52('0x9')]);router['get'](_0x9a52('0xa'),auth[_0x9a52('0x8')](),controller['show']);router['get'](_0x9a52('0xb'),auth[_0x9a52('0x8')](),controller['getFields']);router['get'](_0x9a52('0xc'),auth[_0x9a52('0x8')](),controller[_0x9a52('0xd')]);router[_0x9a52('0x7')](_0x9a52('0xe'),auth[_0x9a52('0x8')](),controller['getDescriptions']);router[_0x9a52('0xf')]('/',auth[_0x9a52('0x8')](),controller[_0x9a52('0x10')]);router[_0x9a52('0x11')]('/:id',auth[_0x9a52('0x8')](),controller[_0x9a52('0x12')]);router[_0x9a52('0x13')]('/:id',auth[_0x9a52('0x8')](),controller['destroy']);module[_0x9a52('0x14')]=router; \ No newline at end of file +var _0x85f6=['update','delete','/:id','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getSubjects','/:id/descriptions','post','put'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0x85f6,0x108));var _0x685f=function(_0x37dc31,_0xe7197b){_0x37dc31=_0x37dc31-0x0;var _0x28292c=_0x85f6[_0x37dc31];return _0x28292c;};'use strict';var multer=require('multer');var util=require(_0x685f('0x0'));var path=require(_0x685f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x685f('0x2')]();var fs_extra=require(_0x685f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x685f('0x4'));var config=require(_0x685f('0x5'));var controller=require(_0x685f('0x6'));router[_0x685f('0x7')]('/',auth[_0x685f('0x8')](),controller[_0x685f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x685f('0xa')]);router[_0x685f('0x7')](_0x685f('0xb'),auth[_0x685f('0x8')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x685f('0x8')](),controller[_0x685f('0xc')]);router[_0x685f('0x7')](_0x685f('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x685f('0xe')]('/',auth[_0x685f('0x8')](),controller['create']);router[_0x685f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x685f('0x10')]);router[_0x685f('0x11')](_0x685f('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x685f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 18fa021..31223de 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 _0x3954=['contact_lead','sequelize','exports','ENUM','contact','nothing','lead'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x3954,0x16d));var _0x4395=function(_0x14542f,_0x33206b){_0x14542f=_0x14542f-0x0;var _0x27d56e=_0x3954[_0x14542f];return _0x27d56e;};'use strict';var Sequelize=require(_0x4395('0x0'));module[_0x4395('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x4395('0x2')]('lead',_0x4395('0x3'),_0x4395('0x4')),'defaultValue':_0x4395('0x5')},'moduleSearch':{'type':Sequelize[_0x4395('0x2')](_0x4395('0x6'),_0x4395('0x3'),_0x4395('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3b2a=['exports','ENUM','lead','contact','contact_lead','STRING'];(function(_0x25c82e,_0x2bb68f){var _0x601d2c=function(_0x2eee18){while(--_0x2eee18){_0x25c82e['push'](_0x25c82e['shift']());}};_0x601d2c(++_0x2bb68f);}(_0x3b2a,0x90));var _0xa3b2=function(_0x3a8d7d,_0x47a83c){_0x3a8d7d=_0x3a8d7d-0x0;var _0xd9fd54=_0x3b2a[_0x3a8d7d];return _0xd9fd54;};'use strict';var Sequelize=require('sequelize');module[_0xa3b2('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xa3b2('0x1')](_0xa3b2('0x2'),_0xa3b2('0x3'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa3b2('0x1')](_0xa3b2('0x4'),_0xa3b2('0x3'),'lead'),'defaultValue':_0xa3b2('0x4')},'description':{'type':Sequelize[_0xa3b2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 6cdcca0..4b7b33f 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 _0x4d94=['getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','type','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','ZohoField','order','pick'];(function(_0xcee512,_0x687e2b){var _0x222da6=function(_0x65ce4d){while(--_0x65ce4d){_0xcee512['push'](_0xcee512['shift']());}};_0x222da6(++_0x687e2b);}(_0x4d94,0x15e));var _0x44d9=function(_0x5033e6,_0x5c8958){_0x5033e6=_0x5033e6-0x0;var _0x516812=_0x4d94[_0x5033e6];return _0x516812;};'use strict';var emlformat=require(_0x44d9('0x0'));var rimraf=require(_0x44d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44d9('0x2'));var rp=require(_0x44d9('0x3'));var moment=require(_0x44d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x44d9('0x5'));var util=require(_0x44d9('0x6'));var path=require(_0x44d9('0x7'));var sox=require(_0x44d9('0x8'));var csv=require('to-csv');var ejs=require(_0x44d9('0x9'));var fs=require('fs');var fs_extra=require(_0x44d9('0xa'));var _=require(_0x44d9('0xb'));var squel=require(_0x44d9('0xc'));var crypto=require(_0x44d9('0xd'));var jsforce=require(_0x44d9('0xe'));var deskjs=require(_0x44d9('0xf'));var toCsv=require(_0x44d9('0x10'));var querystring=require(_0x44d9('0x11'));var Papa=require(_0x44d9('0x12'));var Redis=require(_0x44d9('0x13'));var authService=require(_0x44d9('0x14'));var qs=require(_0x44d9('0x15'));var as=require(_0x44d9('0x16'));var hardwareService=require(_0x44d9('0x17'));var logger=require(_0x44d9('0x18'))(_0x44d9('0x19'));var utils=require(_0x44d9('0x1a'));var config=require(_0x44d9('0x1b'));var licenseUtil=require(_0x44d9('0x1c'));var db=require(_0x44d9('0x1d'))['db'];function respondWithStatusCode(_0x502f54,_0x44c240){_0x44c240=_0x44c240||0xcc;return function(_0x448d78){if(_0x448d78){return _0x502f54['sendStatus'](_0x44c240);}return _0x502f54[_0x44d9('0x1e')](_0x44c240)[_0x44d9('0x1f')]();};}function respondWithResult(_0x3c4d0c,_0x3001d1){_0x3001d1=_0x3001d1||0xc8;return function(_0x29957d){if(_0x29957d){return _0x3c4d0c[_0x44d9('0x1e')](_0x3001d1)[_0x44d9('0x20')](_0x29957d);}};}function respondWithFilteredResult(_0x542453,_0x3e90d8){return function(_0x260fbd){if(_0x260fbd){var _0x3b8519=typeof _0x3e90d8[_0x44d9('0x21')]==='undefined'&&typeof _0x3e90d8['limit']===_0x44d9('0x22');var _0x297a31=_0x260fbd['count'];var _0x48a5cf=_0x3b8519?0x0:_0x3e90d8[_0x44d9('0x21')];var _0x3acc27=_0x3b8519?_0x260fbd[_0x44d9('0x23')]:_0x3e90d8[_0x44d9('0x21')]+_0x3e90d8[_0x44d9('0x24')];var _0xda8184;if(_0x3acc27>=_0x297a31){_0x3acc27=_0x297a31;_0xda8184=0xc8;}else{_0xda8184=0xce;}_0x542453[_0x44d9('0x1e')](_0xda8184);return _0x542453[_0x44d9('0x25')]('Content-Range',_0x48a5cf+'-'+_0x3acc27+'/'+_0x297a31)[_0x44d9('0x20')](_0x260fbd);}return null;};}function patchUpdates(_0x9ef49f){return function(_0x4ffa3e){try{jsonpatch[_0x44d9('0x26')](_0x4ffa3e,_0x9ef49f,!![]);}catch(_0x26508b){return BPromise[_0x44d9('0x27')](_0x26508b);}return _0x4ffa3e[_0x44d9('0x28')]();};}function saveUpdates(_0x1d5650,_0x563427){return function(_0x308599){if(_0x308599){return _0x308599[_0x44d9('0x29')](_0x1d5650)[_0x44d9('0x2a')](function(_0x342945){return _0x342945;});}return null;};}function removeEntity(_0x178ad7,_0x131d64){return function(_0x5d52cb){if(_0x5d52cb){return _0x5d52cb[_0x44d9('0x2b')]()[_0x44d9('0x2a')](function(){_0x178ad7[_0x44d9('0x1e')](0xcc)[_0x44d9('0x1f')]();});}};}function handleEntityNotFound(_0x2b84a4,_0x3fffed){return function(_0x1ba0ae){if(!_0x1ba0ae){_0x2b84a4[_0x44d9('0x2c')](0x194);}return _0x1ba0ae;};}function handleError(_0x409f33,_0x4be3bd){_0x4be3bd=_0x4be3bd||0x1f4;return function(_0x196e61){logger['error'](_0x196e61[_0x44d9('0x2d')]);if(_0x196e61[_0x44d9('0x2e')]){delete _0x196e61['name'];}_0x409f33[_0x44d9('0x1e')](_0x4be3bd)[_0x44d9('0x2f')](_0x196e61);};}exports[_0x44d9('0x30')]=function(_0x52acde,_0x57c2b7){var _0x540cc6={},_0x2435cb={},_0x1544ab={'count':0x0,'rows':[]};var _0x48bb36=_[_0x44d9('0x31')](db[_0x44d9('0x32')][_0x44d9('0x33')],function(_0x35f511){return{'name':_0x35f511[_0x44d9('0x34')],'type':_0x35f511['type'][_0x44d9('0x35')]};});_0x2435cb[_0x44d9('0x36')]=_[_0x44d9('0x31')](_0x48bb36,_0x44d9('0x2e'));_0x2435cb[_0x44d9('0x37')]=_[_0x44d9('0x38')](_0x52acde[_0x44d9('0x37')]);_0x2435cb['filters']=_[_0x44d9('0x39')](_0x2435cb[_0x44d9('0x36')],_0x2435cb[_0x44d9('0x37')]);_0x540cc6[_0x44d9('0x3a')]=_[_0x44d9('0x39')](_0x2435cb[_0x44d9('0x36')],qs[_0x44d9('0x3b')](_0x52acde[_0x44d9('0x37')][_0x44d9('0x3b')]));_0x540cc6[_0x44d9('0x3a')]=_0x540cc6[_0x44d9('0x3a')][_0x44d9('0x3c')]?_0x540cc6['attributes']:_0x2435cb[_0x44d9('0x36')];if(!_0x52acde[_0x44d9('0x37')][_0x44d9('0x3d')](_0x44d9('0x3e'))){_0x540cc6[_0x44d9('0x24')]=qs[_0x44d9('0x24')](_0x52acde[_0x44d9('0x37')]['limit']);_0x540cc6['offset']=qs[_0x44d9('0x21')](_0x52acde[_0x44d9('0x37')]['offset']);}_0x540cc6['order']=qs[_0x44d9('0x3f')](_0x52acde['query'][_0x44d9('0x3f')]);_0x540cc6[_0x44d9('0x40')]=qs['filters'](_['pick'](_0x52acde[_0x44d9('0x37')],_0x2435cb[_0x44d9('0x41')]),_0x48bb36);if(_0x52acde[_0x44d9('0x37')]['filter']){_0x540cc6[_0x44d9('0x40')]=_['merge'](_0x540cc6[_0x44d9('0x40')],{'$or':_[_0x44d9('0x31')](_0x48bb36,function(_0x36e4b6){if(_0x36e4b6[_0x44d9('0x42')]!==_0x44d9('0x43')){var _0xb2c07e={};_0xb2c07e[_0x36e4b6[_0x44d9('0x2e')]]={'$like':'%'+_0x52acde[_0x44d9('0x37')][_0x44d9('0x44')]+'%'};return _0xb2c07e;}})});}_0x540cc6=_[_0x44d9('0x45')]({},_0x540cc6,_0x52acde[_0x44d9('0x46')]);var _0x1d0938={'where':_0x540cc6[_0x44d9('0x40')]};return db['ZohoConfiguration']['count'](_0x1d0938)[_0x44d9('0x2a')](function(_0x11276){_0x1544ab[_0x44d9('0x23')]=_0x11276;if(_0x52acde['query'][_0x44d9('0x47')]){_0x540cc6[_0x44d9('0x48')]=[{'all':!![]}];}return db[_0x44d9('0x32')]['findAll'](_0x540cc6);})['then'](function(_0x1d05f7){_0x1544ab[_0x44d9('0x49')]=_0x1d05f7;return _0x1544ab;})[_0x44d9('0x2a')](respondWithFilteredResult(_0x57c2b7,_0x540cc6))[_0x44d9('0x4a')](handleError(_0x57c2b7,null));};exports[_0x44d9('0x4b')]=function(_0x15ad26,_0x16d0ee){var _0x7589ab={'raw':![],'where':{'id':_0x15ad26[_0x44d9('0x4c')]['id']}},_0x657ae5={};_0x657ae5[_0x44d9('0x36')]=_[_0x44d9('0x38')](db[_0x44d9('0x32')][_0x44d9('0x33')]);_0x657ae5['query']=_['keys'](_0x15ad26[_0x44d9('0x37')]);_0x657ae5[_0x44d9('0x41')]=_['intersection'](_0x657ae5['model'],_0x657ae5['query']);_0x7589ab[_0x44d9('0x3a')]=_[_0x44d9('0x39')](_0x657ae5['model'],qs[_0x44d9('0x3b')](_0x15ad26['query'][_0x44d9('0x3b')]));_0x7589ab[_0x44d9('0x3a')]=_0x7589ab[_0x44d9('0x3a')]['length']?_0x7589ab[_0x44d9('0x3a')]:_0x657ae5[_0x44d9('0x36')];if(_0x15ad26['query'][_0x44d9('0x47')]){_0x7589ab[_0x44d9('0x48')]=[{'all':!![]}];}_0x7589ab=_[_0x44d9('0x45')]({},_0x7589ab,_0x15ad26[_0x44d9('0x46')]);return db[_0x44d9('0x32')][_0x44d9('0x4d')](_0x7589ab)[_0x44d9('0x2a')](handleEntityNotFound(_0x16d0ee,null))[_0x44d9('0x2a')](respondWithResult(_0x16d0ee,null))['catch'](handleError(_0x16d0ee,null));};exports[_0x44d9('0x4e')]=function(_0x4f8a1b,_0x21f075){return db['ZohoConfiguration']['create'](_0x4f8a1b[_0x44d9('0x4f')],{})[_0x44d9('0x2a')](respondWithResult(_0x21f075,0xc9))['catch'](handleError(_0x21f075,null));};exports[_0x44d9('0x29')]=function(_0x301573,_0x887273){if(_0x301573[_0x44d9('0x4f')]['id']){delete _0x301573[_0x44d9('0x4f')]['id'];}return db[_0x44d9('0x32')][_0x44d9('0x4d')]({'where':{'id':_0x301573[_0x44d9('0x4c')]['id']}})[_0x44d9('0x2a')](handleEntityNotFound(_0x887273,null))[_0x44d9('0x2a')](saveUpdates(_0x301573[_0x44d9('0x4f')],null))[_0x44d9('0x2a')](respondWithResult(_0x887273,null))[_0x44d9('0x4a')](handleError(_0x887273,null));};exports['destroy']=function(_0x376c3b,_0x531873){return db[_0x44d9('0x32')][_0x44d9('0x4d')]({'where':{'id':_0x376c3b[_0x44d9('0x4c')]['id']}})[_0x44d9('0x2a')](handleEntityNotFound(_0x531873,null))['then'](removeEntity(_0x531873,null))[_0x44d9('0x4a')](handleError(_0x531873,null));};exports[_0x44d9('0x50')]=function(_0x49fb26,_0x192c6f,_0x167b1f){var _0x303b40={};var _0x2e8027={};var _0x1a85af;var _0x3860dc;return db[_0x44d9('0x32')][_0x44d9('0x51')]({'where':{'id':_0x49fb26[_0x44d9('0x4c')]['id']}})[_0x44d9('0x2a')](handleEntityNotFound(_0x192c6f,null))[_0x44d9('0x2a')](function(_0x585f6a){if(_0x585f6a){_0x1a85af=_0x585f6a;_0x2e8027[_0x44d9('0x36')]=_[_0x44d9('0x38')](db[_0x44d9('0x52')][_0x44d9('0x33')]);_0x2e8027[_0x44d9('0x37')]=_['keys'](_0x49fb26['query']);_0x2e8027[_0x44d9('0x41')]=_['intersection'](_0x2e8027[_0x44d9('0x36')],_0x2e8027[_0x44d9('0x37')]);_0x303b40[_0x44d9('0x3a')]=_[_0x44d9('0x39')](_0x2e8027[_0x44d9('0x36')],qs[_0x44d9('0x3b')](_0x49fb26[_0x44d9('0x37')][_0x44d9('0x3b')]));_0x303b40['attributes']=_0x303b40[_0x44d9('0x3a')]['length']?_0x303b40[_0x44d9('0x3a')]:_0x2e8027[_0x44d9('0x36')];_0x303b40[_0x44d9('0x53')]=qs[_0x44d9('0x3f')](_0x49fb26[_0x44d9('0x37')]['sort']);_0x303b40[_0x44d9('0x40')]=qs['filters'](_[_0x44d9('0x54')](_0x49fb26[_0x44d9('0x37')],_0x2e8027['filters']));if(_0x49fb26['query'][_0x44d9('0x44')]){_0x303b40[_0x44d9('0x40')]=_[_0x44d9('0x45')](_0x303b40[_0x44d9('0x40')],{'$or':_[_0x44d9('0x31')](_0x303b40[_0x44d9('0x3a')],function(_0x46c60c){var _0x4be186={};_0x4be186[_0x46c60c]={'$like':'%'+_0x49fb26[_0x44d9('0x37')]['filter']+'%'};return _0x4be186;})});}_0x303b40=_['merge']({},_0x303b40,_0x49fb26[_0x44d9('0x46')]);return _0x1a85af[_0x44d9('0x50')](_0x303b40);}})['then'](function(_0x529eac){if(_0x529eac){_0x3860dc=_0x529eac[_0x44d9('0x3c')];if(!_0x49fb26[_0x44d9('0x37')]['hasOwnProperty']('nolimit')){_0x303b40['limit']=qs[_0x44d9('0x24')](_0x49fb26[_0x44d9('0x37')]['limit']);_0x303b40[_0x44d9('0x21')]=qs[_0x44d9('0x21')](_0x49fb26[_0x44d9('0x37')][_0x44d9('0x21')]);}return _0x1a85af['getFields'](_0x303b40);}})['then'](function(_0x33ea9f){if(_0x33ea9f){return _0x33ea9f?{'count':_0x3860dc,'rows':_0x33ea9f}:null;}})[_0x44d9('0x2a')](respondWithResult(_0x192c6f,null))[_0x44d9('0x4a')](handleError(_0x192c6f,null));};exports[_0x44d9('0x55')]=function(_0x3c7cff,_0xe7d676,_0x13bf7f){var _0xcdbc33={};var _0x3b4a12={};var _0x2bb662;var _0x197323;return db[_0x44d9('0x32')][_0x44d9('0x51')]({'where':{'id':_0x3c7cff[_0x44d9('0x4c')]['id']}})[_0x44d9('0x2a')](handleEntityNotFound(_0xe7d676,null))[_0x44d9('0x2a')](function(_0x4d22cc){if(_0x4d22cc){_0x2bb662=_0x4d22cc;_0x3b4a12['model']=_[_0x44d9('0x38')](db['ZohoField'][_0x44d9('0x33')]);_0x3b4a12[_0x44d9('0x37')]=_['keys'](_0x3c7cff[_0x44d9('0x37')]);_0x3b4a12[_0x44d9('0x41')]=_['intersection'](_0x3b4a12[_0x44d9('0x36')],_0x3b4a12['query']);_0xcdbc33[_0x44d9('0x3a')]=_['intersection'](_0x3b4a12[_0x44d9('0x36')],qs[_0x44d9('0x3b')](_0x3c7cff['query'][_0x44d9('0x3b')]));_0xcdbc33['attributes']=_0xcdbc33[_0x44d9('0x3a')][_0x44d9('0x3c')]?_0xcdbc33[_0x44d9('0x3a')]:_0x3b4a12[_0x44d9('0x36')];_0xcdbc33[_0x44d9('0x53')]=qs['sort'](_0x3c7cff[_0x44d9('0x37')][_0x44d9('0x3f')]);_0xcdbc33['where']=qs['filters'](_[_0x44d9('0x54')](_0x3c7cff[_0x44d9('0x37')],_0x3b4a12[_0x44d9('0x41')]));if(_0x3c7cff[_0x44d9('0x37')][_0x44d9('0x44')]){_0xcdbc33['where']=_['merge'](_0xcdbc33[_0x44d9('0x40')],{'$or':_[_0x44d9('0x31')](_0xcdbc33[_0x44d9('0x3a')],function(_0x46282c){var _0x1cc3ea={};_0x1cc3ea[_0x46282c]={'$like':'%'+_0x3c7cff['query'][_0x44d9('0x44')]+'%'};return _0x1cc3ea;})});}_0xcdbc33=_['merge']({},_0xcdbc33,_0x3c7cff[_0x44d9('0x46')]);return _0x2bb662[_0x44d9('0x55')](_0xcdbc33);}})['then'](function(_0x52e9c8){if(_0x52e9c8){_0x197323=_0x52e9c8[_0x44d9('0x3c')];if(!_0x3c7cff[_0x44d9('0x37')][_0x44d9('0x3d')](_0x44d9('0x3e'))){_0xcdbc33[_0x44d9('0x24')]=qs[_0x44d9('0x24')](_0x3c7cff['query'][_0x44d9('0x24')]);_0xcdbc33[_0x44d9('0x21')]=qs[_0x44d9('0x21')](_0x3c7cff[_0x44d9('0x37')][_0x44d9('0x21')]);}return _0x2bb662[_0x44d9('0x55')](_0xcdbc33);}})[_0x44d9('0x2a')](function(_0x11c210){if(_0x11c210){return _0x11c210?{'count':_0x197323,'rows':_0x11c210}:null;}})['then'](respondWithResult(_0xe7d676,null))[_0x44d9('0x4a')](handleError(_0xe7d676,null));};exports['getDescriptions']=function(_0x54a1f9,_0x13b760,_0x8520a8){var _0xdbf6b0={};var _0x1bcb66={};var _0x3b767c;var _0x20069c;return db[_0x44d9('0x32')][_0x44d9('0x51')]({'where':{'id':_0x54a1f9[_0x44d9('0x4c')]['id']}})[_0x44d9('0x2a')](handleEntityNotFound(_0x13b760,null))[_0x44d9('0x2a')](function(_0x1d9acc){if(_0x1d9acc){_0x3b767c=_0x1d9acc;_0x1bcb66[_0x44d9('0x36')]=_[_0x44d9('0x38')](db[_0x44d9('0x52')][_0x44d9('0x33')]);_0x1bcb66[_0x44d9('0x37')]=_['keys'](_0x54a1f9['query']);_0x1bcb66[_0x44d9('0x41')]=_[_0x44d9('0x39')](_0x1bcb66[_0x44d9('0x36')],_0x1bcb66[_0x44d9('0x37')]);_0xdbf6b0[_0x44d9('0x3a')]=_[_0x44d9('0x39')](_0x1bcb66[_0x44d9('0x36')],qs[_0x44d9('0x3b')](_0x54a1f9[_0x44d9('0x37')][_0x44d9('0x3b')]));_0xdbf6b0[_0x44d9('0x3a')]=_0xdbf6b0['attributes'][_0x44d9('0x3c')]?_0xdbf6b0[_0x44d9('0x3a')]:_0x1bcb66[_0x44d9('0x36')];_0xdbf6b0[_0x44d9('0x53')]=qs[_0x44d9('0x3f')](_0x54a1f9['query'][_0x44d9('0x3f')]);_0xdbf6b0[_0x44d9('0x40')]=qs['filters'](_[_0x44d9('0x54')](_0x54a1f9['query'],_0x1bcb66[_0x44d9('0x41')]));if(_0x54a1f9[_0x44d9('0x37')][_0x44d9('0x44')]){_0xdbf6b0[_0x44d9('0x40')]=_[_0x44d9('0x45')](_0xdbf6b0[_0x44d9('0x40')],{'$or':_['map'](_0xdbf6b0['attributes'],function(_0x4ee9ec){var _0x1c2621={};_0x1c2621[_0x4ee9ec]={'$like':'%'+_0x54a1f9[_0x44d9('0x37')][_0x44d9('0x44')]+'%'};return _0x1c2621;})});}_0xdbf6b0=_[_0x44d9('0x45')]({},_0xdbf6b0,_0x54a1f9['options']);return _0x3b767c[_0x44d9('0x56')](_0xdbf6b0);}})[_0x44d9('0x2a')](function(_0x5a42ba){if(_0x5a42ba){_0x20069c=_0x5a42ba[_0x44d9('0x3c')];if(!_0x54a1f9[_0x44d9('0x37')][_0x44d9('0x3d')]('nolimit')){_0xdbf6b0['limit']=qs[_0x44d9('0x24')](_0x54a1f9[_0x44d9('0x37')]['limit']);_0xdbf6b0[_0x44d9('0x21')]=qs[_0x44d9('0x21')](_0x54a1f9['query'][_0x44d9('0x21')]);}return _0x3b767c[_0x44d9('0x56')](_0xdbf6b0);}})[_0x44d9('0x2a')](function(_0x39ba35){if(_0x39ba35){return _0x39ba35?{'count':_0x20069c,'rows':_0x39ba35}:null;}})[_0x44d9('0x2a')](respondWithResult(_0x13b760,null))[_0x44d9('0x4a')](handleError(_0x13b760,null));}; \ No newline at end of file +var _0x8ff8=['include','findAll','rows','catch','show','params','keys','find','create','body','findOne','ZohoField','getFields','getSubjects','pick','nolimit','getDescriptions','eml-format','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x2e5011,_0x2ed248){var _0x4fed64=function(_0x5c3e84){while(--_0x5c3e84){_0x2e5011['push'](_0x2e5011['shift']());}};_0x4fed64(++_0x2ed248);}(_0x8ff8,0x65));var _0x88ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ff8[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x88ff('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x88ff('0x1'));var moment=require(_0x88ff('0x2'));var BPromise=require(_0x88ff('0x3'));var Mustache=require(_0x88ff('0x4'));var util=require('util');var path=require(_0x88ff('0x5'));var sox=require('sox');var csv=require(_0x88ff('0x6'));var ejs=require(_0x88ff('0x7'));var fs=require('fs');var fs_extra=require(_0x88ff('0x8'));var _=require(_0x88ff('0x9'));var squel=require(_0x88ff('0xa'));var crypto=require(_0x88ff('0xb'));var jsforce=require(_0x88ff('0xc'));var deskjs=require(_0x88ff('0xd'));var toCsv=require(_0x88ff('0x6'));var querystring=require(_0x88ff('0xe'));var Papa=require(_0x88ff('0xf'));var Redis=require(_0x88ff('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x88ff('0x11'));var as=require(_0x88ff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88ff('0x13'))(_0x88ff('0x14'));var utils=require(_0x88ff('0x15'));var config=require(_0x88ff('0x16'));var licenseUtil=require(_0x88ff('0x17'));var db=require(_0x88ff('0x18'))['db'];function respondWithStatusCode(_0x9e17cd,_0x32b4c0){_0x32b4c0=_0x32b4c0||0xcc;return function(_0x5b44f2){if(_0x5b44f2){return _0x9e17cd[_0x88ff('0x19')](_0x32b4c0);}return _0x9e17cd[_0x88ff('0x1a')](_0x32b4c0)[_0x88ff('0x1b')]();};}function respondWithResult(_0x519260,_0x57860d){_0x57860d=_0x57860d||0xc8;return function(_0x5f2d3c){if(_0x5f2d3c){return _0x519260[_0x88ff('0x1a')](_0x57860d)[_0x88ff('0x1c')](_0x5f2d3c);}};}function respondWithFilteredResult(_0x5e82e1,_0x369b1c){return function(_0x394050){if(_0x394050){var _0x5d36be=typeof _0x369b1c[_0x88ff('0x1d')]===_0x88ff('0x1e')&&typeof _0x369b1c[_0x88ff('0x1f')]==='undefined';var _0x38c6d5=_0x394050[_0x88ff('0x20')];var _0x45b7e3=_0x5d36be?0x0:_0x369b1c[_0x88ff('0x1d')];var _0x451585=_0x5d36be?_0x394050['count']:_0x369b1c[_0x88ff('0x1d')]+_0x369b1c['limit'];var _0x40c47f;if(_0x451585>=_0x38c6d5){_0x451585=_0x38c6d5;_0x40c47f=0xc8;}else{_0x40c47f=0xce;}_0x5e82e1[_0x88ff('0x1a')](_0x40c47f);return _0x5e82e1[_0x88ff('0x21')](_0x88ff('0x22'),_0x45b7e3+'-'+_0x451585+'/'+_0x38c6d5)[_0x88ff('0x1c')](_0x394050);}return null;};}function patchUpdates(_0x360021){return function(_0x10e1f6){try{jsonpatch[_0x88ff('0x23')](_0x10e1f6,_0x360021,!![]);}catch(_0x59cbc9){return BPromise['reject'](_0x59cbc9);}return _0x10e1f6[_0x88ff('0x24')]();};}function saveUpdates(_0x3f62c2,_0x3ff2d0){return function(_0x39d64d){if(_0x39d64d){return _0x39d64d[_0x88ff('0x25')](_0x3f62c2)[_0x88ff('0x26')](function(_0x5a1443){return _0x5a1443;});}return null;};}function removeEntity(_0x156456,_0x1e3530){return function(_0xae38d7){if(_0xae38d7){return _0xae38d7[_0x88ff('0x27')]()[_0x88ff('0x26')](function(){_0x156456[_0x88ff('0x1a')](0xcc)[_0x88ff('0x1b')]();});}};}function handleEntityNotFound(_0x492363,_0x59b277){return function(_0x461600){if(!_0x461600){_0x492363[_0x88ff('0x19')](0x194);}return _0x461600;};}function handleError(_0x2a1276,_0x2df86c){_0x2df86c=_0x2df86c||0x1f4;return function(_0x4a0cea){logger[_0x88ff('0x28')](_0x4a0cea[_0x88ff('0x29')]);if(_0x4a0cea[_0x88ff('0x2a')]){delete _0x4a0cea['name'];}_0x2a1276[_0x88ff('0x1a')](_0x2df86c)[_0x88ff('0x2b')](_0x4a0cea);};}exports[_0x88ff('0x2c')]=function(_0x53f6f9,_0x303540){var _0x4704a9={},_0x18c7cc={},_0xb20c0a={'count':0x0,'rows':[]};var _0x4a0f11=_[_0x88ff('0x2d')](db[_0x88ff('0x2e')][_0x88ff('0x2f')],function(_0xaf0fbd){return{'name':_0xaf0fbd[_0x88ff('0x30')],'type':_0xaf0fbd[_0x88ff('0x31')][_0x88ff('0x32')]};});_0x18c7cc[_0x88ff('0x33')]=_[_0x88ff('0x2d')](_0x4a0f11,_0x88ff('0x2a'));_0x18c7cc[_0x88ff('0x34')]=_['keys'](_0x53f6f9[_0x88ff('0x34')]);_0x18c7cc[_0x88ff('0x35')]=_[_0x88ff('0x36')](_0x18c7cc[_0x88ff('0x33')],_0x18c7cc[_0x88ff('0x34')]);_0x4704a9[_0x88ff('0x37')]=_[_0x88ff('0x36')](_0x18c7cc[_0x88ff('0x33')],qs[_0x88ff('0x38')](_0x53f6f9[_0x88ff('0x34')][_0x88ff('0x38')]));_0x4704a9[_0x88ff('0x37')]=_0x4704a9[_0x88ff('0x37')][_0x88ff('0x39')]?_0x4704a9['attributes']:_0x18c7cc[_0x88ff('0x33')];if(!_0x53f6f9[_0x88ff('0x34')][_0x88ff('0x3a')]('nolimit')){_0x4704a9[_0x88ff('0x1f')]=qs[_0x88ff('0x1f')](_0x53f6f9['query'][_0x88ff('0x1f')]);_0x4704a9[_0x88ff('0x1d')]=qs[_0x88ff('0x1d')](_0x53f6f9[_0x88ff('0x34')][_0x88ff('0x1d')]);}_0x4704a9[_0x88ff('0x3b')]=qs[_0x88ff('0x3c')](_0x53f6f9[_0x88ff('0x34')]['sort']);_0x4704a9[_0x88ff('0x3d')]=qs['filters'](_['pick'](_0x53f6f9[_0x88ff('0x34')],_0x18c7cc[_0x88ff('0x35')]),_0x4a0f11);if(_0x53f6f9[_0x88ff('0x34')]['filter']){_0x4704a9['where']=_[_0x88ff('0x3e')](_0x4704a9[_0x88ff('0x3d')],{'$or':_[_0x88ff('0x2d')](_0x4a0f11,function(_0x37f0fd){if(_0x37f0fd[_0x88ff('0x31')]!==_0x88ff('0x3f')){var _0x15f921={};_0x15f921[_0x37f0fd[_0x88ff('0x2a')]]={'$like':'%'+_0x53f6f9[_0x88ff('0x34')][_0x88ff('0x40')]+'%'};return _0x15f921;}})});}_0x4704a9=_[_0x88ff('0x3e')]({},_0x4704a9,_0x53f6f9[_0x88ff('0x41')]);var _0x58a1bf={'where':_0x4704a9[_0x88ff('0x3d')]};return db[_0x88ff('0x2e')]['count'](_0x58a1bf)[_0x88ff('0x26')](function(_0x508301){_0xb20c0a[_0x88ff('0x20')]=_0x508301;if(_0x53f6f9[_0x88ff('0x34')][_0x88ff('0x42')]){_0x4704a9[_0x88ff('0x43')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x88ff('0x44')](_0x4704a9);})[_0x88ff('0x26')](function(_0x19fc9a){_0xb20c0a[_0x88ff('0x45')]=_0x19fc9a;return _0xb20c0a;})[_0x88ff('0x26')](respondWithFilteredResult(_0x303540,_0x4704a9))[_0x88ff('0x46')](handleError(_0x303540,null));};exports[_0x88ff('0x47')]=function(_0x2a54d8,_0x477b73){var _0x57ea77={'raw':![],'where':{'id':_0x2a54d8[_0x88ff('0x48')]['id']}},_0x53ef05={};_0x53ef05[_0x88ff('0x33')]=_[_0x88ff('0x49')](db[_0x88ff('0x2e')][_0x88ff('0x2f')]);_0x53ef05[_0x88ff('0x34')]=_['keys'](_0x2a54d8[_0x88ff('0x34')]);_0x53ef05['filters']=_[_0x88ff('0x36')](_0x53ef05[_0x88ff('0x33')],_0x53ef05[_0x88ff('0x34')]);_0x57ea77['attributes']=_[_0x88ff('0x36')](_0x53ef05[_0x88ff('0x33')],qs[_0x88ff('0x38')](_0x2a54d8['query']['fields']));_0x57ea77[_0x88ff('0x37')]=_0x57ea77[_0x88ff('0x37')][_0x88ff('0x39')]?_0x57ea77[_0x88ff('0x37')]:_0x53ef05[_0x88ff('0x33')];if(_0x2a54d8['query'][_0x88ff('0x42')]){_0x57ea77[_0x88ff('0x43')]=[{'all':!![]}];}_0x57ea77=_['merge']({},_0x57ea77,_0x2a54d8['options']);return db[_0x88ff('0x2e')][_0x88ff('0x4a')](_0x57ea77)[_0x88ff('0x26')](handleEntityNotFound(_0x477b73,null))['then'](respondWithResult(_0x477b73,null))['catch'](handleError(_0x477b73,null));};exports[_0x88ff('0x4b')]=function(_0x5a3367,_0x1e5a83){return db[_0x88ff('0x2e')]['create'](_0x5a3367[_0x88ff('0x4c')],{})[_0x88ff('0x26')](respondWithResult(_0x1e5a83,0xc9))['catch'](handleError(_0x1e5a83,null));};exports[_0x88ff('0x25')]=function(_0x54ef8e,_0x24455a){if(_0x54ef8e[_0x88ff('0x4c')]['id']){delete _0x54ef8e[_0x88ff('0x4c')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x54ef8e[_0x88ff('0x48')]['id']}})[_0x88ff('0x26')](handleEntityNotFound(_0x24455a,null))[_0x88ff('0x26')](saveUpdates(_0x54ef8e[_0x88ff('0x4c')],null))[_0x88ff('0x26')](respondWithResult(_0x24455a,null))[_0x88ff('0x46')](handleError(_0x24455a,null));};exports[_0x88ff('0x27')]=function(_0x2d0d47,_0x3e8a47){return db[_0x88ff('0x2e')][_0x88ff('0x4a')]({'where':{'id':_0x2d0d47[_0x88ff('0x48')]['id']}})[_0x88ff('0x26')](handleEntityNotFound(_0x3e8a47,null))[_0x88ff('0x26')](removeEntity(_0x3e8a47,null))[_0x88ff('0x46')](handleError(_0x3e8a47,null));};exports['getFields']=function(_0x32329,_0x5edb02,_0x3f3e89){var _0x106855={};var _0x268573={};var _0xcc0cf3;var _0x4b0cb1;return db[_0x88ff('0x2e')][_0x88ff('0x4d')]({'where':{'id':_0x32329[_0x88ff('0x48')]['id']}})[_0x88ff('0x26')](handleEntityNotFound(_0x5edb02,null))[_0x88ff('0x26')](function(_0x34927f){if(_0x34927f){_0xcc0cf3=_0x34927f;_0x268573[_0x88ff('0x33')]=_[_0x88ff('0x49')](db[_0x88ff('0x4e')][_0x88ff('0x2f')]);_0x268573[_0x88ff('0x34')]=_[_0x88ff('0x49')](_0x32329[_0x88ff('0x34')]);_0x268573[_0x88ff('0x35')]=_[_0x88ff('0x36')](_0x268573['model'],_0x268573[_0x88ff('0x34')]);_0x106855[_0x88ff('0x37')]=_[_0x88ff('0x36')](_0x268573[_0x88ff('0x33')],qs[_0x88ff('0x38')](_0x32329[_0x88ff('0x34')][_0x88ff('0x38')]));_0x106855[_0x88ff('0x37')]=_0x106855[_0x88ff('0x37')][_0x88ff('0x39')]?_0x106855['attributes']:_0x268573[_0x88ff('0x33')];_0x106855[_0x88ff('0x3b')]=qs[_0x88ff('0x3c')](_0x32329[_0x88ff('0x34')][_0x88ff('0x3c')]);_0x106855['where']=qs[_0x88ff('0x35')](_['pick'](_0x32329[_0x88ff('0x34')],_0x268573[_0x88ff('0x35')]));if(_0x32329[_0x88ff('0x34')][_0x88ff('0x40')]){_0x106855[_0x88ff('0x3d')]=_[_0x88ff('0x3e')](_0x106855[_0x88ff('0x3d')],{'$or':_['map'](_0x106855[_0x88ff('0x37')],function(_0x4160c6){var _0x332e57={};_0x332e57[_0x4160c6]={'$like':'%'+_0x32329[_0x88ff('0x34')][_0x88ff('0x40')]+'%'};return _0x332e57;})});}_0x106855=_[_0x88ff('0x3e')]({},_0x106855,_0x32329[_0x88ff('0x41')]);return _0xcc0cf3[_0x88ff('0x4f')](_0x106855);}})[_0x88ff('0x26')](function(_0x328913){if(_0x328913){_0x4b0cb1=_0x328913[_0x88ff('0x39')];if(!_0x32329[_0x88ff('0x34')][_0x88ff('0x3a')]('nolimit')){_0x106855[_0x88ff('0x1f')]=qs[_0x88ff('0x1f')](_0x32329['query'][_0x88ff('0x1f')]);_0x106855[_0x88ff('0x1d')]=qs['offset'](_0x32329['query'][_0x88ff('0x1d')]);}return _0xcc0cf3[_0x88ff('0x4f')](_0x106855);}})[_0x88ff('0x26')](function(_0x18f1cf){if(_0x18f1cf){return _0x18f1cf?{'count':_0x4b0cb1,'rows':_0x18f1cf}:null;}})[_0x88ff('0x26')](respondWithResult(_0x5edb02,null))[_0x88ff('0x46')](handleError(_0x5edb02,null));};exports[_0x88ff('0x50')]=function(_0x715ed4,_0x4b17dd,_0x3d25e1){var _0x57d4d6={};var _0x3ec9c0={};var _0x990775;var _0x174f01;return db[_0x88ff('0x2e')]['findOne']({'where':{'id':_0x715ed4[_0x88ff('0x48')]['id']}})[_0x88ff('0x26')](handleEntityNotFound(_0x4b17dd,null))['then'](function(_0x17287e){if(_0x17287e){_0x990775=_0x17287e;_0x3ec9c0['model']=_[_0x88ff('0x49')](db['ZohoField'][_0x88ff('0x2f')]);_0x3ec9c0[_0x88ff('0x34')]=_['keys'](_0x715ed4[_0x88ff('0x34')]);_0x3ec9c0['filters']=_[_0x88ff('0x36')](_0x3ec9c0[_0x88ff('0x33')],_0x3ec9c0['query']);_0x57d4d6[_0x88ff('0x37')]=_['intersection'](_0x3ec9c0['model'],qs[_0x88ff('0x38')](_0x715ed4['query'][_0x88ff('0x38')]));_0x57d4d6[_0x88ff('0x37')]=_0x57d4d6[_0x88ff('0x37')][_0x88ff('0x39')]?_0x57d4d6[_0x88ff('0x37')]:_0x3ec9c0[_0x88ff('0x33')];_0x57d4d6[_0x88ff('0x3b')]=qs[_0x88ff('0x3c')](_0x715ed4['query'][_0x88ff('0x3c')]);_0x57d4d6['where']=qs[_0x88ff('0x35')](_[_0x88ff('0x51')](_0x715ed4['query'],_0x3ec9c0[_0x88ff('0x35')]));if(_0x715ed4['query'][_0x88ff('0x40')]){_0x57d4d6['where']=_['merge'](_0x57d4d6[_0x88ff('0x3d')],{'$or':_[_0x88ff('0x2d')](_0x57d4d6[_0x88ff('0x37')],function(_0x1a287e){var _0xd958e0={};_0xd958e0[_0x1a287e]={'$like':'%'+_0x715ed4[_0x88ff('0x34')][_0x88ff('0x40')]+'%'};return _0xd958e0;})});}_0x57d4d6=_[_0x88ff('0x3e')]({},_0x57d4d6,_0x715ed4['options']);return _0x990775[_0x88ff('0x50')](_0x57d4d6);}})[_0x88ff('0x26')](function(_0x1ba736){if(_0x1ba736){_0x174f01=_0x1ba736[_0x88ff('0x39')];if(!_0x715ed4[_0x88ff('0x34')][_0x88ff('0x3a')](_0x88ff('0x52'))){_0x57d4d6[_0x88ff('0x1f')]=qs[_0x88ff('0x1f')](_0x715ed4[_0x88ff('0x34')][_0x88ff('0x1f')]);_0x57d4d6[_0x88ff('0x1d')]=qs[_0x88ff('0x1d')](_0x715ed4['query'][_0x88ff('0x1d')]);}return _0x990775['getSubjects'](_0x57d4d6);}})[_0x88ff('0x26')](function(_0x2264fb){if(_0x2264fb){return _0x2264fb?{'count':_0x174f01,'rows':_0x2264fb}:null;}})[_0x88ff('0x26')](respondWithResult(_0x4b17dd,null))[_0x88ff('0x46')](handleError(_0x4b17dd,null));};exports[_0x88ff('0x53')]=function(_0x5197ed,_0x1f9baa,_0x98f530){var _0x11b268={};var _0x5ac93e={};var _0x2ca1e6;var _0x4c63da;return db['ZohoConfiguration'][_0x88ff('0x4d')]({'where':{'id':_0x5197ed['params']['id']}})[_0x88ff('0x26')](handleEntityNotFound(_0x1f9baa,null))['then'](function(_0x1ccef5){if(_0x1ccef5){_0x2ca1e6=_0x1ccef5;_0x5ac93e[_0x88ff('0x33')]=_['keys'](db['ZohoField'][_0x88ff('0x2f')]);_0x5ac93e[_0x88ff('0x34')]=_[_0x88ff('0x49')](_0x5197ed[_0x88ff('0x34')]);_0x5ac93e[_0x88ff('0x35')]=_[_0x88ff('0x36')](_0x5ac93e[_0x88ff('0x33')],_0x5ac93e['query']);_0x11b268['attributes']=_[_0x88ff('0x36')](_0x5ac93e[_0x88ff('0x33')],qs[_0x88ff('0x38')](_0x5197ed[_0x88ff('0x34')]['fields']));_0x11b268[_0x88ff('0x37')]=_0x11b268['attributes']['length']?_0x11b268[_0x88ff('0x37')]:_0x5ac93e['model'];_0x11b268[_0x88ff('0x3b')]=qs['sort'](_0x5197ed['query'][_0x88ff('0x3c')]);_0x11b268[_0x88ff('0x3d')]=qs[_0x88ff('0x35')](_['pick'](_0x5197ed['query'],_0x5ac93e['filters']));if(_0x5197ed[_0x88ff('0x34')]['filter']){_0x11b268[_0x88ff('0x3d')]=_[_0x88ff('0x3e')](_0x11b268[_0x88ff('0x3d')],{'$or':_['map'](_0x11b268[_0x88ff('0x37')],function(_0x37d4b4){var _0x40d769={};_0x40d769[_0x37d4b4]={'$like':'%'+_0x5197ed[_0x88ff('0x34')][_0x88ff('0x40')]+'%'};return _0x40d769;})});}_0x11b268=_[_0x88ff('0x3e')]({},_0x11b268,_0x5197ed[_0x88ff('0x41')]);return _0x2ca1e6['getDescriptions'](_0x11b268);}})[_0x88ff('0x26')](function(_0x34b1f4){if(_0x34b1f4){_0x4c63da=_0x34b1f4[_0x88ff('0x39')];if(!_0x5197ed[_0x88ff('0x34')][_0x88ff('0x3a')]('nolimit')){_0x11b268[_0x88ff('0x1f')]=qs[_0x88ff('0x1f')](_0x5197ed['query']['limit']);_0x11b268[_0x88ff('0x1d')]=qs[_0x88ff('0x1d')](_0x5197ed[_0x88ff('0x34')][_0x88ff('0x1d')]);}return _0x2ca1e6['getDescriptions'](_0x11b268);}})[_0x88ff('0x26')](function(_0x92023a){if(_0x92023a){return _0x92023a?{'count':_0x4c63da,'rows':_0x92023a}:null;}})[_0x88ff('0x26')](respondWithResult(_0x1f9baa,null))[_0x88ff('0x46')](handleError(_0x1f9baa,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 9d36e23..5a1dc4c 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 _0x4711=['define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x10b790,_0x242d00){var _0x2eb9b1=function(_0x1de5e5){while(--_0x1de5e5){_0x10b790['push'](_0x10b790['shift']());}};_0x2eb9b1(++_0x242d00);}(_0x4711,0x162));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1471('0x0'));var util=require('util');var logger=require(_0x1471('0x1'))(_0x1471('0x2'));var moment=require(_0x1471('0x3'));var BPromise=require(_0x1471('0x4'));var rp=require(_0x1471('0x5'));var fs=require('fs');var path=require(_0x1471('0x6'));var rimraf=require('rimraf');var config=require(_0x1471('0x7'));var attributes=require(_0x1471('0x8'));module[_0x1471('0x9')]=function(_0x53e64f,_0x3cb939){return _0x53e64f[_0x1471('0xa')](_0x1471('0xb'),attributes,{'tableName':_0x1471('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d88=['request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x6d88,0x19e));var _0x86d8=function(_0x4e76b4,_0x18fc25){_0x4e76b4=_0x4e76b4-0x0;var _0x1d04c4=_0x6d88[_0x4e76b4];return _0x1d04c4;};'use strict';var _=require(_0x86d8('0x0'));var util=require('util');var logger=require(_0x86d8('0x1'))(_0x86d8('0x2'));var moment=require(_0x86d8('0x3'));var BPromise=require('bluebird');var rp=require(_0x86d8('0x4'));var fs=require('fs');var path=require(_0x86d8('0x5'));var rimraf=require(_0x86d8('0x6'));var config=require('../../config/environment');var attributes=require(_0x86d8('0x7'));module[_0x86d8('0x8')]=function(_0x387972,_0x1e974a){return _0x387972['define'](_0x86d8('0x9'),attributes,{'tableName':_0x86d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 58b2ecb..32c3914 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 _0xc22d=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x10dddd,_0x564498){var _0x527dbe=function(_0x323ffc){while(--_0x323ffc){_0x10dddd['push'](_0x10dddd['shift']());}};_0x527dbe(++_0x564498);}(_0xc22d,0x133));var _0xdc22=function(_0x226e13,_0x51db0d){_0x226e13=_0x226e13-0x0;var _0xffa47=_0xc22d[_0x226e13];return _0xffa47;};'use strict';var _=require('lodash');var util=require(_0xdc22('0x0'));var moment=require(_0xdc22('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc22('0x2'))['db'];var utils=require(_0xdc22('0x3'));var logger=require('../../config/logger')(_0xdc22('0x4'));var config=require(_0xdc22('0x5'));var jayson=require(_0xdc22('0x6'));var client=jayson[_0xdc22('0x7')][_0xdc22('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e89bc,_0x3c1f51,_0x41ee3a){return new BPromise(function(_0x409cdf,_0x39d25b){return client[_0xdc22('0x9')](_0x3e89bc,_0x41ee3a)[_0xdc22('0xa')](function(_0x4eecf3){logger[_0xdc22('0xb')](_0xdc22('0xc'),_0x3c1f51,_0xdc22('0xd'));logger[_0xdc22('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3c1f51,'request\x20sent',JSON[_0xdc22('0xf')](_0x4eecf3));if(_0x4eecf3[_0xdc22('0x10')]){if(_0x4eecf3[_0xdc22('0x10')][_0xdc22('0x11')]===0x1f4){logger['error'](_0xdc22('0xc'),_0x3c1f51,_0x4eecf3['error'][_0xdc22('0x12')]);return _0x39d25b(_0x4eecf3[_0xdc22('0x10')]['message']);}logger[_0xdc22('0x10')](_0xdc22('0xc'),_0x3c1f51,_0x4eecf3[_0xdc22('0x10')][_0xdc22('0x12')]);return _0x409cdf(_0x4eecf3['error']['message']);}else{logger[_0xdc22('0xb')](_0xdc22('0xc'),_0x3c1f51,_0xdc22('0xd'));_0x409cdf(_0x4eecf3[_0xdc22('0x13')][_0xdc22('0x12')]);}})[_0xdc22('0x14')](function(_0x5c0813){logger['error'](_0xdc22('0xc'),_0x3c1f51,_0x5c0813);_0x39d25b(_0x5c0813);});});} \ No newline at end of file +var _0x5cd0=['request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x842225,_0x1ac2ef){var _0x4543fc=function(_0x236dd9){while(--_0x236dd9){_0x842225['push'](_0x842225['shift']());}};_0x4543fc(++_0x1ac2ef);}(_0x5cd0,0xe7));var _0x05cd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5cd0[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x05cd('0x0'));var util=require(_0x05cd('0x1'));var moment=require(_0x05cd('0x2'));var BPromise=require(_0x05cd('0x3'));var rs=require(_0x05cd('0x4'));var fs=require('fs');var Redis=require(_0x05cd('0x5'));var db=require(_0x05cd('0x6'))['db'];var utils=require(_0x05cd('0x7'));var logger=require(_0x05cd('0x8'))(_0x05cd('0x9'));var config=require(_0x05cd('0xa'));var jayson=require(_0x05cd('0xb'));var client=jayson[_0x05cd('0xc')][_0x05cd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x55abda,_0x55e96f,_0x448223){return new BPromise(function(_0x291f22,_0xba1b8d){return client[_0x05cd('0xe')](_0x55abda,_0x448223)[_0x05cd('0xf')](function(_0x5066b4){logger[_0x05cd('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x55e96f,'request\x20sent');logger[_0x05cd('0x11')](_0x05cd('0x12'),_0x55e96f,'request\x20sent',JSON['stringify'](_0x5066b4));if(_0x5066b4[_0x05cd('0x13')]){if(_0x5066b4['error']['code']===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x55e96f,_0x5066b4[_0x05cd('0x13')][_0x05cd('0x14')]);return _0xba1b8d(_0x5066b4[_0x05cd('0x13')][_0x05cd('0x14')]);}logger['error'](_0x05cd('0x15'),_0x55e96f,_0x5066b4[_0x05cd('0x13')][_0x05cd('0x14')]);return _0x291f22(_0x5066b4[_0x05cd('0x13')]['message']);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x55e96f,_0x05cd('0x16'));_0x291f22(_0x5066b4['result'][_0x05cd('0x14')]);}})['catch'](function(_0x23fdb8){logger[_0x05cd('0x13')](_0x05cd('0x15'),_0x55e96f,_0x23fdb8);_0xba1b8d(_0x23fdb8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5769b36..d17ef76 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 _0x364a=['/:id','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','post','create','put'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x364a,0x1ad));var _0xa364=function(_0x5308f1,_0x5a5187){_0x5308f1=_0x5308f1-0x0;var _0x62ba1=_0x364a[_0x5308f1];return _0x62ba1;};'use strict';var multer=require('multer');var util=require(_0xa364('0x0'));var path=require(_0xa364('0x1'));var timeout=require(_0xa364('0x2'));var express=require('express');var router=express[_0xa364('0x3')]();var fs_extra=require(_0xa364('0x4'));var auth=require(_0xa364('0x5'));var interaction=require(_0xa364('0x6'));var config=require(_0xa364('0x7'));var controller=require(_0xa364('0x8'));router['get']('/',auth[_0xa364('0x9')](),controller['index']);router['get']('/:id',auth[_0xa364('0x9')](),controller['show']);router[_0xa364('0xa')]('/',auth['isAuthenticated'](),controller[_0xa364('0xb')]);router[_0xa364('0xc')](_0xa364('0xd'),auth[_0xa364('0x9')](),controller[_0xa364('0xe')]);router[_0xa364('0xf')]('/:id',auth[_0xa364('0x9')](),controller[_0xa364('0x10')]);module['exports']=router; \ No newline at end of file +var _0x301b=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x301b,0xf9));var _0xb301=function(_0x458fa5,_0x389fdf){_0x458fa5=_0x458fa5-0x0;var _0x406452=_0x301b[_0x458fa5];return _0x406452;};'use strict';var multer=require(_0xb301('0x0'));var util=require(_0xb301('0x1'));var path=require(_0xb301('0x2'));var timeout=require(_0xb301('0x3'));var express=require(_0xb301('0x4'));var router=express[_0xb301('0x5')]();var fs_extra=require(_0xb301('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb301('0x7'));var config=require('../../config/environment');var controller=require(_0xb301('0x8'));router[_0xb301('0x9')]('/',auth[_0xb301('0xa')](),controller[_0xb301('0xb')]);router['get'](_0xb301('0xc'),auth[_0xb301('0xa')](),controller['show']);router[_0xb301('0xd')]('/',auth[_0xb301('0xa')](),controller[_0xb301('0xe')]);router[_0xb301('0xf')](_0xb301('0xc'),auth['isAuthenticated'](),controller[_0xb301('0x10')]);router[_0xb301('0x11')](_0xb301('0xc'),auth[_0xb301('0xa')](),controller[_0xb301('0x12')]);module[_0xb301('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 70bfc99..3d67cb7 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 _0x36a8=['ENUM','BOOLEAN','sequelize','string','variable','customVariable','picklist','STRING'];(function(_0xf67a9,_0x186808){var _0x2122f8=function(_0x2aeaff){while(--_0x2aeaff){_0xf67a9['push'](_0xf67a9['shift']());}};_0x2122f8(++_0x186808);}(_0x36a8,0x92));var _0x836a=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x36a8[_0x1895b7];return _0x1aecdc;};'use strict';var Sequelize=require(_0x836a('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x836a('0x1'),_0x836a('0x2'),_0x836a('0x3'),'keyValue',_0x836a('0x4')),'defaultValue':_0x836a('0x1')},'content':{'type':Sequelize[_0x836a('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x836a('0x6')](_0x836a('0x1'),_0x836a('0x2'),_0x836a('0x3'))},'keyContent':{'type':Sequelize[_0x836a('0x5')]},'idField':{'type':Sequelize[_0x836a('0x5')]},'nameField':{'type':Sequelize[_0x836a('0x5')]},'customField':{'type':Sequelize[_0x836a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x836a('0x5')]}}; \ No newline at end of file +var _0x095f=['variable','customVariable','keyValue','STRING','exports','ENUM','string'];(function(_0x41f6d3,_0x41594d){var _0x425e9b=function(_0x2163f5){while(--_0x2163f5){_0x41f6d3['push'](_0x41f6d3['shift']());}};_0x425e9b(++_0x41594d);}(_0x095f,0x154));var _0xf095=function(_0x846a8b,_0x1b34ca){_0x846a8b=_0x846a8b-0x0;var _0x393701=_0x095f[_0x846a8b];return _0x393701;};'use strict';var Sequelize=require('sequelize');module[_0xf095('0x0')]={'type':{'type':Sequelize[_0xf095('0x1')](_0xf095('0x2'),_0xf095('0x3'),_0xf095('0x4'),_0xf095('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xf095('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf095('0x1')](_0xf095('0x2'),_0xf095('0x3'),_0xf095('0x4'))},'keyContent':{'type':Sequelize[_0xf095('0x6')]},'idField':{'type':Sequelize[_0xf095('0x6')]},'nameField':{'type':Sequelize[_0xf095('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf095('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b018eb5..8aba905 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 _0x0664=['find','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ZohoField','includeAll','findAll','rows','catch','show','params','fields','include','create','body'];(function(_0x5806c3,_0x5105d8){var _0x48ac77=function(_0x4826ec){while(--_0x4826ec){_0x5806c3['push'](_0x5806c3['shift']());}};_0x48ac77(++_0x5105d8);}(_0x0664,0x93));var _0x4066=function(_0x379f76,_0x4e700c){_0x379f76=_0x379f76-0x0;var _0x3f5c40=_0x0664[_0x379f76];return _0x3f5c40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4066('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4066('0x1'));var rp=require(_0x4066('0x2'));var moment=require('moment');var BPromise=require(_0x4066('0x3'));var Mustache=require(_0x4066('0x4'));var util=require(_0x4066('0x5'));var path=require(_0x4066('0x6'));var sox=require(_0x4066('0x7'));var csv=require(_0x4066('0x8'));var ejs=require(_0x4066('0x9'));var fs=require('fs');var fs_extra=require(_0x4066('0xa'));var _=require(_0x4066('0xb'));var squel=require(_0x4066('0xc'));var crypto=require('crypto');var jsforce=require(_0x4066('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4066('0x8'));var querystring=require(_0x4066('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4066('0xf'));var qs=require(_0x4066('0x10'));var as=require(_0x4066('0x11'));var hardwareService=require(_0x4066('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4066('0x13'));var db=require(_0x4066('0x14'))['db'];function respondWithStatusCode(_0x10c353,_0x12d36c){_0x12d36c=_0x12d36c||0xcc;return function(_0x425456){if(_0x425456){return _0x10c353[_0x4066('0x15')](_0x12d36c);}return _0x10c353[_0x4066('0x16')](_0x12d36c)[_0x4066('0x17')]();};}function respondWithResult(_0x5b4f38,_0x42a09c){_0x42a09c=_0x42a09c||0xc8;return function(_0x152404){if(_0x152404){return _0x5b4f38['status'](_0x42a09c)[_0x4066('0x18')](_0x152404);}};}function respondWithFilteredResult(_0x5095d6,_0x252e1c){return function(_0x5f37ea){if(_0x5f37ea){var _0x50f71d=typeof _0x252e1c[_0x4066('0x19')]===_0x4066('0x1a')&&typeof _0x252e1c[_0x4066('0x1b')]===_0x4066('0x1a');var _0x296e40=_0x5f37ea[_0x4066('0x1c')];var _0x3a73de=_0x50f71d?0x0:_0x252e1c[_0x4066('0x19')];var _0x23de64=_0x50f71d?_0x5f37ea[_0x4066('0x1c')]:_0x252e1c['offset']+_0x252e1c['limit'];var _0x2e85ee;if(_0x23de64>=_0x296e40){_0x23de64=_0x296e40;_0x2e85ee=0xc8;}else{_0x2e85ee=0xce;}_0x5095d6[_0x4066('0x16')](_0x2e85ee);return _0x5095d6['set'](_0x4066('0x1d'),_0x3a73de+'-'+_0x23de64+'/'+_0x296e40)[_0x4066('0x18')](_0x5f37ea);}return null;};}function patchUpdates(_0x382950){return function(_0x35ae6b){try{jsonpatch[_0x4066('0x1e')](_0x35ae6b,_0x382950,!![]);}catch(_0x3e3366){return BPromise['reject'](_0x3e3366);}return _0x35ae6b['save']();};}function saveUpdates(_0x541306,_0x549504){return function(_0x3b2b7f){if(_0x3b2b7f){return _0x3b2b7f[_0x4066('0x1f')](_0x541306)[_0x4066('0x20')](function(_0x263314){return _0x263314;});}return null;};}function removeEntity(_0x213dc0,_0x5afa04){return function(_0x21a1f7){if(_0x21a1f7){return _0x21a1f7[_0x4066('0x21')]()[_0x4066('0x20')](function(){_0x213dc0[_0x4066('0x16')](0xcc)[_0x4066('0x17')]();});}};}function handleEntityNotFound(_0x59abe2,_0x4b6c52){return function(_0x2984ef){if(!_0x2984ef){_0x59abe2[_0x4066('0x15')](0x194);}return _0x2984ef;};}function handleError(_0x720f4a,_0xac8304){_0xac8304=_0xac8304||0x1f4;return function(_0x4b3b31){logger[_0x4066('0x22')](_0x4b3b31[_0x4066('0x23')]);if(_0x4b3b31[_0x4066('0x24')]){delete _0x4b3b31[_0x4066('0x24')];}_0x720f4a[_0x4066('0x16')](_0xac8304)[_0x4066('0x25')](_0x4b3b31);};}exports[_0x4066('0x26')]=function(_0x540a9,_0x30a4e0){var _0x2e3daf={},_0x496c35={},_0x80e095={'count':0x0,'rows':[]};var _0x4ffc7a=_['map'](db['ZohoField'][_0x4066('0x27')],function(_0x47cba8){return{'name':_0x47cba8[_0x4066('0x28')],'type':_0x47cba8[_0x4066('0x29')][_0x4066('0x2a')]};});_0x496c35['model']=_[_0x4066('0x2b')](_0x4ffc7a,'name');_0x496c35[_0x4066('0x2c')]=_[_0x4066('0x2d')](_0x540a9['query']);_0x496c35['filters']=_[_0x4066('0x2e')](_0x496c35[_0x4066('0x2f')],_0x496c35['query']);_0x2e3daf[_0x4066('0x30')]=_[_0x4066('0x2e')](_0x496c35[_0x4066('0x2f')],qs['fields'](_0x540a9[_0x4066('0x2c')]['fields']));_0x2e3daf[_0x4066('0x30')]=_0x2e3daf[_0x4066('0x30')][_0x4066('0x31')]?_0x2e3daf[_0x4066('0x30')]:_0x496c35[_0x4066('0x2f')];if(!_0x540a9[_0x4066('0x2c')][_0x4066('0x32')](_0x4066('0x33'))){_0x2e3daf[_0x4066('0x1b')]=qs[_0x4066('0x1b')](_0x540a9[_0x4066('0x2c')][_0x4066('0x1b')]);_0x2e3daf['offset']=qs[_0x4066('0x19')](_0x540a9[_0x4066('0x2c')]['offset']);}_0x2e3daf[_0x4066('0x34')]=qs[_0x4066('0x35')](_0x540a9['query'][_0x4066('0x35')]);_0x2e3daf[_0x4066('0x36')]=qs[_0x4066('0x37')](_[_0x4066('0x38')](_0x540a9[_0x4066('0x2c')],_0x496c35[_0x4066('0x37')]),_0x4ffc7a);if(_0x540a9[_0x4066('0x2c')][_0x4066('0x39')]){_0x2e3daf[_0x4066('0x36')]=_['merge'](_0x2e3daf[_0x4066('0x36')],{'$or':_[_0x4066('0x2b')](_0x4ffc7a,function(_0x4cf25d){if(_0x4cf25d[_0x4066('0x29')]!==_0x4066('0x3a')){var _0x35017a={};_0x35017a[_0x4cf25d['name']]={'$like':'%'+_0x540a9[_0x4066('0x2c')][_0x4066('0x39')]+'%'};return _0x35017a;}})});}_0x2e3daf=_[_0x4066('0x3b')]({},_0x2e3daf,_0x540a9[_0x4066('0x3c')]);var _0x3f40a2={'where':_0x2e3daf[_0x4066('0x36')]};return db[_0x4066('0x3d')]['count'](_0x3f40a2)[_0x4066('0x20')](function(_0x5c26a9){_0x80e095[_0x4066('0x1c')]=_0x5c26a9;if(_0x540a9[_0x4066('0x2c')][_0x4066('0x3e')]){_0x2e3daf['include']=[{'all':!![]}];}return db[_0x4066('0x3d')][_0x4066('0x3f')](_0x2e3daf);})['then'](function(_0x1f0c82){_0x80e095[_0x4066('0x40')]=_0x1f0c82;return _0x80e095;})[_0x4066('0x20')](respondWithFilteredResult(_0x30a4e0,_0x2e3daf))[_0x4066('0x41')](handleError(_0x30a4e0,null));};exports[_0x4066('0x42')]=function(_0x5998d5,_0x20c7f3){var _0x44548e={'raw':!![],'where':{'id':_0x5998d5[_0x4066('0x43')]['id']}},_0x4ee422={};_0x4ee422[_0x4066('0x2f')]=_[_0x4066('0x2d')](db[_0x4066('0x3d')][_0x4066('0x27')]);_0x4ee422[_0x4066('0x2c')]=_[_0x4066('0x2d')](_0x5998d5['query']);_0x4ee422[_0x4066('0x37')]=_[_0x4066('0x2e')](_0x4ee422[_0x4066('0x2f')],_0x4ee422[_0x4066('0x2c')]);_0x44548e[_0x4066('0x30')]=_[_0x4066('0x2e')](_0x4ee422['model'],qs[_0x4066('0x44')](_0x5998d5['query'][_0x4066('0x44')]));_0x44548e['attributes']=_0x44548e[_0x4066('0x30')][_0x4066('0x31')]?_0x44548e[_0x4066('0x30')]:_0x4ee422[_0x4066('0x2f')];if(_0x5998d5['query'][_0x4066('0x3e')]){_0x44548e[_0x4066('0x45')]=[{'all':!![]}];}_0x44548e=_['merge']({},_0x44548e,_0x5998d5[_0x4066('0x3c')]);return db['ZohoField']['find'](_0x44548e)['then'](handleEntityNotFound(_0x20c7f3,null))[_0x4066('0x20')](respondWithResult(_0x20c7f3,null))[_0x4066('0x41')](handleError(_0x20c7f3,null));};exports[_0x4066('0x46')]=function(_0x24b252,_0x24c557){return db['ZohoField'][_0x4066('0x46')](_0x24b252[_0x4066('0x47')],{})[_0x4066('0x20')](respondWithResult(_0x24c557,0xc9))[_0x4066('0x41')](handleError(_0x24c557,null));};exports[_0x4066('0x1f')]=function(_0x523396,_0x36f0fd){if(_0x523396[_0x4066('0x47')]['id']){delete _0x523396[_0x4066('0x47')]['id'];}return db[_0x4066('0x3d')][_0x4066('0x48')]({'where':{'id':_0x523396[_0x4066('0x43')]['id']}})[_0x4066('0x20')](handleEntityNotFound(_0x36f0fd,null))['then'](saveUpdates(_0x523396[_0x4066('0x47')],null))[_0x4066('0x20')](respondWithResult(_0x36f0fd,null))[_0x4066('0x41')](handleError(_0x36f0fd,null));};exports[_0x4066('0x21')]=function(_0x3bfea2,_0x4c0155){return db[_0x4066('0x3d')][_0x4066('0x48')]({'where':{'id':_0x3bfea2['params']['id']}})[_0x4066('0x20')](handleEntityNotFound(_0x4c0155,null))[_0x4066('0x20')](removeEntity(_0x4c0155,null))[_0x4066('0x41')](handleError(_0x4c0155,null));}; \ No newline at end of file +var _0xf0dc=['fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','stack','name','send','index','map','key','model','query','keys','filters','fields','length','attributes','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','ZohoField','findAll','rows','catch','rawAttributes','intersection','find','create','body','update','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs'];(function(_0x4041ef,_0x2e36ff){var _0x37f0a9=function(_0x41f2ae){while(--_0x41f2ae){_0x4041ef['push'](_0x4041ef['shift']());}};_0x37f0a9(++_0x2e36ff);}(_0xf0dc,0x117));var _0xcf0d=function(_0x3239f8,_0x4b77a5){_0x3239f8=_0x3239f8-0x0;var _0x49923a=_0xf0dc[_0x3239f8];return _0x49923a;};'use strict';var emlformat=require(_0xcf0d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf0d('0x1'));var rp=require(_0xcf0d('0x2'));var moment=require(_0xcf0d('0x3'));var BPromise=require(_0xcf0d('0x4'));var Mustache=require(_0xcf0d('0x5'));var util=require(_0xcf0d('0x6'));var path=require('path');var sox=require(_0xcf0d('0x7'));var csv=require('to-csv');var ejs=require(_0xcf0d('0x8'));var fs=require('fs');var fs_extra=require(_0xcf0d('0x9'));var _=require(_0xcf0d('0xa'));var squel=require(_0xcf0d('0xb'));var crypto=require(_0xcf0d('0xc'));var jsforce=require(_0xcf0d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcf0d('0xe'));var Redis=require(_0xcf0d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcf0d('0x10'));var hardwareService=require(_0xcf0d('0x11'));var logger=require(_0xcf0d('0x12'))('api');var utils=require(_0xcf0d('0x13'));var config=require(_0xcf0d('0x14'));var licenseUtil=require(_0xcf0d('0x15'));var db=require(_0xcf0d('0x16'))['db'];function respondWithStatusCode(_0x530dd6,_0x56ecf3){_0x56ecf3=_0x56ecf3||0xcc;return function(_0x381d4c){if(_0x381d4c){return _0x530dd6[_0xcf0d('0x17')](_0x56ecf3);}return _0x530dd6[_0xcf0d('0x18')](_0x56ecf3)[_0xcf0d('0x19')]();};}function respondWithResult(_0x46368a,_0x275093){_0x275093=_0x275093||0xc8;return function(_0xd41b6){if(_0xd41b6){return _0x46368a['status'](_0x275093)[_0xcf0d('0x1a')](_0xd41b6);}};}function respondWithFilteredResult(_0x14ba34,_0x1c8166){return function(_0xcf319b){if(_0xcf319b){var _0x5def2d=typeof _0x1c8166[_0xcf0d('0x1b')]==='undefined'&&typeof _0x1c8166['limit']===_0xcf0d('0x1c');var _0xb7a0a3=_0xcf319b[_0xcf0d('0x1d')];var _0x1331f9=_0x5def2d?0x0:_0x1c8166[_0xcf0d('0x1b')];var _0x2b080e=_0x5def2d?_0xcf319b['count']:_0x1c8166['offset']+_0x1c8166[_0xcf0d('0x1e')];var _0x4a844b;if(_0x2b080e>=_0xb7a0a3){_0x2b080e=_0xb7a0a3;_0x4a844b=0xc8;}else{_0x4a844b=0xce;}_0x14ba34[_0xcf0d('0x18')](_0x4a844b);return _0x14ba34[_0xcf0d('0x1f')](_0xcf0d('0x20'),_0x1331f9+'-'+_0x2b080e+'/'+_0xb7a0a3)['json'](_0xcf319b);}return null;};}function patchUpdates(_0xd73f25){return function(_0x3a6b0b){try{jsonpatch[_0xcf0d('0x21')](_0x3a6b0b,_0xd73f25,!![]);}catch(_0x559421){return BPromise[_0xcf0d('0x22')](_0x559421);}return _0x3a6b0b['save']();};}function saveUpdates(_0x5b847a,_0x5ebbf9){return function(_0x10d918){if(_0x10d918){return _0x10d918['update'](_0x5b847a)[_0xcf0d('0x23')](function(_0x137f38){return _0x137f38;});}return null;};}function removeEntity(_0x4000bd,_0x232531){return function(_0xe4070c){if(_0xe4070c){return _0xe4070c['destroy']()[_0xcf0d('0x23')](function(){_0x4000bd[_0xcf0d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a633c,_0x3c30a4){return function(_0x143801){if(!_0x143801){_0x5a633c['sendStatus'](0x194);}return _0x143801;};}function handleError(_0x487a32,_0x22fc3d){_0x22fc3d=_0x22fc3d||0x1f4;return function(_0x57ebb8){logger['error'](_0x57ebb8[_0xcf0d('0x24')]);if(_0x57ebb8[_0xcf0d('0x25')]){delete _0x57ebb8[_0xcf0d('0x25')];}_0x487a32[_0xcf0d('0x18')](_0x22fc3d)[_0xcf0d('0x26')](_0x57ebb8);};}exports[_0xcf0d('0x27')]=function(_0x2dc144,_0x18871d){var _0x103511={},_0x13baed={},_0x1f20ea={'count':0x0,'rows':[]};var _0x437f3e=_[_0xcf0d('0x28')](db['ZohoField']['rawAttributes'],function(_0x1da1fa){return{'name':_0x1da1fa['fieldName'],'type':_0x1da1fa['type'][_0xcf0d('0x29')]};});_0x13baed[_0xcf0d('0x2a')]=_['map'](_0x437f3e,'name');_0x13baed[_0xcf0d('0x2b')]=_[_0xcf0d('0x2c')](_0x2dc144[_0xcf0d('0x2b')]);_0x13baed[_0xcf0d('0x2d')]=_['intersection'](_0x13baed[_0xcf0d('0x2a')],_0x13baed[_0xcf0d('0x2b')]);_0x103511['attributes']=_['intersection'](_0x13baed[_0xcf0d('0x2a')],qs['fields'](_0x2dc144['query'][_0xcf0d('0x2e')]));_0x103511['attributes']=_0x103511['attributes'][_0xcf0d('0x2f')]?_0x103511[_0xcf0d('0x30')]:_0x13baed[_0xcf0d('0x2a')];if(!_0x2dc144[_0xcf0d('0x2b')][_0xcf0d('0x31')]('nolimit')){_0x103511[_0xcf0d('0x1e')]=qs[_0xcf0d('0x1e')](_0x2dc144['query'][_0xcf0d('0x1e')]);_0x103511[_0xcf0d('0x1b')]=qs[_0xcf0d('0x1b')](_0x2dc144[_0xcf0d('0x2b')]['offset']);}_0x103511[_0xcf0d('0x32')]=qs['sort'](_0x2dc144[_0xcf0d('0x2b')][_0xcf0d('0x33')]);_0x103511[_0xcf0d('0x34')]=qs[_0xcf0d('0x2d')](_['pick'](_0x2dc144[_0xcf0d('0x2b')],_0x13baed[_0xcf0d('0x2d')]),_0x437f3e);if(_0x2dc144[_0xcf0d('0x2b')][_0xcf0d('0x35')]){_0x103511['where']=_[_0xcf0d('0x36')](_0x103511[_0xcf0d('0x34')],{'$or':_[_0xcf0d('0x28')](_0x437f3e,function(_0x2b15f4){if(_0x2b15f4[_0xcf0d('0x37')]!==_0xcf0d('0x38')){var _0x30b686={};_0x30b686[_0x2b15f4[_0xcf0d('0x25')]]={'$like':'%'+_0x2dc144['query'][_0xcf0d('0x35')]+'%'};return _0x30b686;}})});}_0x103511=_[_0xcf0d('0x36')]({},_0x103511,_0x2dc144[_0xcf0d('0x39')]);var _0x3d28e7={'where':_0x103511[_0xcf0d('0x34')]};return db['ZohoField'][_0xcf0d('0x1d')](_0x3d28e7)['then'](function(_0x3aa716){_0x1f20ea[_0xcf0d('0x1d')]=_0x3aa716;if(_0x2dc144['query'][_0xcf0d('0x3a')]){_0x103511[_0xcf0d('0x3b')]=[{'all':!![]}];}return db[_0xcf0d('0x3c')][_0xcf0d('0x3d')](_0x103511);})[_0xcf0d('0x23')](function(_0x49d04c){_0x1f20ea[_0xcf0d('0x3e')]=_0x49d04c;return _0x1f20ea;})[_0xcf0d('0x23')](respondWithFilteredResult(_0x18871d,_0x103511))[_0xcf0d('0x3f')](handleError(_0x18871d,null));};exports['show']=function(_0x2ada40,_0x483f66){var _0x57eab2={'raw':!![],'where':{'id':_0x2ada40['params']['id']}},_0x33977a={};_0x33977a[_0xcf0d('0x2a')]=_[_0xcf0d('0x2c')](db[_0xcf0d('0x3c')][_0xcf0d('0x40')]);_0x33977a[_0xcf0d('0x2b')]=_[_0xcf0d('0x2c')](_0x2ada40[_0xcf0d('0x2b')]);_0x33977a[_0xcf0d('0x2d')]=_[_0xcf0d('0x41')](_0x33977a['model'],_0x33977a[_0xcf0d('0x2b')]);_0x57eab2['attributes']=_[_0xcf0d('0x41')](_0x33977a['model'],qs[_0xcf0d('0x2e')](_0x2ada40[_0xcf0d('0x2b')]['fields']));_0x57eab2[_0xcf0d('0x30')]=_0x57eab2[_0xcf0d('0x30')][_0xcf0d('0x2f')]?_0x57eab2[_0xcf0d('0x30')]:_0x33977a[_0xcf0d('0x2a')];if(_0x2ada40[_0xcf0d('0x2b')][_0xcf0d('0x3a')]){_0x57eab2[_0xcf0d('0x3b')]=[{'all':!![]}];}_0x57eab2=_[_0xcf0d('0x36')]({},_0x57eab2,_0x2ada40[_0xcf0d('0x39')]);return db[_0xcf0d('0x3c')][_0xcf0d('0x42')](_0x57eab2)['then'](handleEntityNotFound(_0x483f66,null))[_0xcf0d('0x23')](respondWithResult(_0x483f66,null))[_0xcf0d('0x3f')](handleError(_0x483f66,null));};exports[_0xcf0d('0x43')]=function(_0x22144a,_0x32fd3a){return db['ZohoField'][_0xcf0d('0x43')](_0x22144a[_0xcf0d('0x44')],{})['then'](respondWithResult(_0x32fd3a,0xc9))[_0xcf0d('0x3f')](handleError(_0x32fd3a,null));};exports[_0xcf0d('0x45')]=function(_0x3fb2be,_0x342d77){if(_0x3fb2be[_0xcf0d('0x44')]['id']){delete _0x3fb2be[_0xcf0d('0x44')]['id'];}return db[_0xcf0d('0x3c')][_0xcf0d('0x42')]({'where':{'id':_0x3fb2be[_0xcf0d('0x46')]['id']}})[_0xcf0d('0x23')](handleEntityNotFound(_0x342d77,null))['then'](saveUpdates(_0x3fb2be['body'],null))['then'](respondWithResult(_0x342d77,null))[_0xcf0d('0x3f')](handleError(_0x342d77,null));};exports[_0xcf0d('0x47')]=function(_0x178b88,_0x22fce9){return db['ZohoField']['find']({'where':{'id':_0x178b88[_0xcf0d('0x46')]['id']}})[_0xcf0d('0x23')](handleEntityNotFound(_0x22fce9,null))[_0xcf0d('0x23')](removeEntity(_0x22fce9,null))[_0xcf0d('0x3f')](handleError(_0x22fce9,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 90e57e3..9e1c122 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 _0x430c=['api','moment','bluebird','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash'];(function(_0x242a44,_0x454f7b){var _0xde0b6=function(_0x854ca7){while(--_0x854ca7){_0x242a44['push'](_0x242a44['shift']());}};_0xde0b6(++_0x454f7b);}(_0x430c,0x1a1));var _0xc430=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x430c[_0x264d4d];return _0xc917e2;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[{'name':_0xc430('0x8'),'fields':[_0xc430('0x9'),_0xc430('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6343=['../../config/logger','api','rimraf','../../config/environment','exports','define','ZohoField','idField','FieldId'];(function(_0xe15975,_0x10c483){var _0x5443ba=function(_0xafb9ed){while(--_0xafb9ed){_0xe15975['push'](_0xe15975['shift']());}};_0x5443ba(++_0x10c483);}(_0x6343,0x168));var _0x3634=function(_0x2bb75e,_0x3d55a4){_0x2bb75e=_0x2bb75e-0x0;var _0x2ff7d9=_0x6343[_0x2bb75e];return _0x2ff7d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3634('0x0'))(_0x3634('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var attributes=require('./intZohoField.attributes');module[_0x3634('0x4')]=function(_0x388c18,_0x4bb496){return _0x388c18[_0x3634('0x5')](_0x3634('0x6'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x3634('0x7'),_0x3634('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 6dfe798..330c23a 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 _0x1b75=['request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x16b792,_0x904437){var _0x4986b5=function(_0xbfd9c8){while(--_0xbfd9c8){_0x16b792['push'](_0x16b792['shift']());}};_0x4986b5(++_0x904437);}(_0x1b75,0x6f));var _0x51b7=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x1b75[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0x51b7('0x0'));var util=require(_0x51b7('0x1'));var moment=require(_0x51b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x51b7('0x3'));var fs=require('fs');var Redis=require(_0x51b7('0x4'));var db=require(_0x51b7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x51b7('0x6'));var config=require('../../config/environment');var jayson=require(_0x51b7('0x7'));var client=jayson[_0x51b7('0x8')][_0x51b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x287eac,_0x2772de,_0x3465ad){return new BPromise(function(_0x45b44f,_0x58c8f8){return client['request'](_0x287eac,_0x3465ad)[_0x51b7('0xa')](function(_0x8bbc8b){logger[_0x51b7('0xb')](_0x51b7('0xc'),_0x2772de,'request\x20sent');logger[_0x51b7('0xd')](_0x51b7('0xe'),_0x2772de,_0x51b7('0xf'),JSON[_0x51b7('0x10')](_0x8bbc8b));if(_0x8bbc8b['error']){if(_0x8bbc8b[_0x51b7('0x11')][_0x51b7('0x12')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x2772de,_0x8bbc8b[_0x51b7('0x11')]['message']);return _0x58c8f8(_0x8bbc8b[_0x51b7('0x11')][_0x51b7('0x13')]);}logger[_0x51b7('0x11')](_0x51b7('0xc'),_0x2772de,_0x8bbc8b[_0x51b7('0x11')][_0x51b7('0x13')]);return _0x45b44f(_0x8bbc8b['error'][_0x51b7('0x13')]);}else{logger[_0x51b7('0xb')](_0x51b7('0xc'),_0x2772de,_0x51b7('0xf'));_0x45b44f(_0x8bbc8b['result'][_0x51b7('0x13')]);}})[_0x51b7('0x14')](function(_0x4a89fa){logger['error'](_0x51b7('0xc'),_0x2772de,_0x4a89fa);_0x58c8f8(_0x4a89fa);});});} \ No newline at end of file +var _0x6b13=['jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ZohoField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x15372f,_0x467b0c){var _0x52e750=function(_0x1dc03c){while(--_0x1dc03c){_0x15372f['push'](_0x15372f['shift']());}};_0x52e750(++_0x467b0c);}(_0x6b13,0x185));var _0x36b1=function(_0x526d6c,_0x1cc58a){_0x526d6c=_0x526d6c-0x0;var _0x43b854=_0x6b13[_0x526d6c];return _0x43b854;};'use strict';var _=require(_0x36b1('0x0'));var util=require(_0x36b1('0x1'));var moment=require(_0x36b1('0x2'));var BPromise=require(_0x36b1('0x3'));var rs=require(_0x36b1('0x4'));var fs=require('fs');var Redis=require(_0x36b1('0x5'));var db=require(_0x36b1('0x6'))['db'];var utils=require(_0x36b1('0x7'));var logger=require(_0x36b1('0x8'))(_0x36b1('0x9'));var config=require(_0x36b1('0xa'));var jayson=require(_0x36b1('0xb'));var client=jayson[_0x36b1('0xc')][_0x36b1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x21f18f,_0x545823,_0x14f7a5){return new BPromise(function(_0x5c0e92,_0x4b43e4){return client[_0x36b1('0xe')](_0x21f18f,_0x14f7a5)[_0x36b1('0xf')](function(_0x157456){logger[_0x36b1('0x10')]('ZohoField,\x20%s,\x20%s',_0x545823,'request\x20sent');logger['debug'](_0x36b1('0x11'),_0x545823,_0x36b1('0x12'),JSON[_0x36b1('0x13')](_0x157456));if(_0x157456['error']){if(_0x157456['error']['code']===0x1f4){logger[_0x36b1('0x14')]('ZohoField,\x20%s,\x20%s',_0x545823,_0x157456[_0x36b1('0x14')]['message']);return _0x4b43e4(_0x157456[_0x36b1('0x14')][_0x36b1('0x15')]);}logger[_0x36b1('0x14')](_0x36b1('0x16'),_0x545823,_0x157456[_0x36b1('0x14')][_0x36b1('0x15')]);return _0x5c0e92(_0x157456[_0x36b1('0x14')][_0x36b1('0x15')]);}else{logger['info'](_0x36b1('0x16'),_0x545823,_0x36b1('0x12'));_0x5c0e92(_0x157456[_0x36b1('0x17')][_0x36b1('0x15')]);}})[_0x36b1('0x18')](function(_0x5c0b60){logger['error']('ZohoField,\x20%s,\x20%s',_0x545823,_0x5c0b60);_0x4b43e4(_0x5c0b60);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index edc583c..02bb384 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xe89606,_0x3d1ae6){var _0x206f95=function(_0x22d4b6){while(--_0x22d4b6){_0xe89606['push'](_0xe89606['shift']());}};_0x206f95(++_0x3d1ae6);}(_0xedd9,0xfc));var _0x9edd=function(_0xe9c770,_0x4f76c4){_0xe9c770=_0xe9c770-0x0;var _0x48f174=_0xedd9[_0xe9c770];return _0x48f174;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b2a90,_0x27f5ea){var _0x30bee3=function(_0x30fd3e){while(--_0x30fd3e){_0x4b2a90['push'](_0x4b2a90['shift']());}};_0x30bee3(++_0x27f5ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 7eeae85..d3794f5 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 _0xf403=['app.js','BOOLEAN','sequelize','STRING','unique_name_and_version'];(function(_0x1ad460,_0x452543){var _0x43f851=function(_0x3fbf2){while(--_0x3fbf2){_0x1ad460['push'](_0x1ad460['shift']());}};_0x43f851(++_0x452543);}(_0xf403,0x1d3));var _0x3f40=function(_0x5aade8,_0x1869a8){_0x5aade8=_0x5aade8-0x0;var _0x44a991=_0xf403[_0x5aade8];return _0x44a991;};'use strict';var Sequelize=require(_0x3f40('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f40('0x1')],'allowNull':![],'unique':_0x3f40('0x2')},'version':{'type':Sequelize[_0x3f40('0x1')],'allowNull':![],'unique':_0x3f40('0x2')},'main':{'type':Sequelize[_0x3f40('0x1')],'defaultValue':_0x3f40('0x3')},'filename':{'type':Sequelize[_0x3f40('0x1')]},'path':{'type':Sequelize[_0x3f40('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x3f40('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x3f40('0x1')]},'logo':{'type':Sequelize[_0x3f40('0x1')]},'state':{'type':Sequelize[_0x3f40('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x3f40('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x3f40('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9d53=['state','sequelize','STRING','INTEGER','BOOLEAN'];(function(_0xe129b8,_0x1eb668){var _0x44a9b0=function(_0x41c495){while(--_0x41c495){_0xe129b8['push'](_0xe129b8['shift']());}};_0x44a9b0(++_0x1eb668);}(_0x9d53,0xf1));var _0x39d5=function(_0x3f2833,_0x24dfad){_0x3f2833=_0x3f2833-0x0;var _0x236ab8=_0x9d53[_0x3f2833];return _0x236ab8;};'use strict';var Sequelize=require(_0x39d5('0x0'));module['exports']={'name':{'type':Sequelize[_0x39d5('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x39d5('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x39d5('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x39d5('0x1')]},'path':{'type':Sequelize[_0x39d5('0x1')]},'type':{'type':Sequelize[_0x39d5('0x1')]},'size':{'type':Sequelize[_0x39d5('0x2')]},'active':{'type':Sequelize[_0x39d5('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x39d5('0x1')]},'logo':{'type':Sequelize[_0x39d5('0x1')]},'state':{'type':Sequelize[_0x39d5('0x1')],'unique':_0x39d5('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x39d5('0x1')]},'remoteUri':{'type':Sequelize[_0x39d5('0x1')]},'link':{'type':Sequelize[_0x39d5('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 0d54302..6ee446e 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 _0x47c5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','Integration'];(function(_0x37bdc0,_0xf3e407){var _0x40ddac=function(_0x3f34be){while(--_0x3f34be){_0x37bdc0['push'](_0x37bdc0['shift']());}};_0x40ddac(++_0xf3e407);}(_0x47c5,0x165));var _0x547c=function(_0x5914a3,_0x22e240){_0x5914a3=_0x5914a3-0x0;var _0x25af13=_0x47c5[_0x5914a3];return _0x25af13;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['Integration'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['Integration']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['Integration'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['Integration'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));}; \ No newline at end of file +var _0x5d58=['../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','Integration','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','create','update','find','catch','destroy','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xb1496a,_0x190543){var _0x301916=function(_0x4e17ab){while(--_0x4e17ab){_0xb1496a['push'](_0xb1496a['shift']());}};_0x301916(++_0x190543);}(_0x5d58,0x187));var _0x85d5=function(_0x498c1f,_0x3a0851){_0x498c1f=_0x498c1f-0x0;var _0xe362db=_0x5d58[_0x498c1f];return _0xe362db;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['Integration']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['Integration'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')](_0x13ab32['body'],{})[_0x85d5('0x1c')](respondWithResult(_0x12a03,0xc9))['catch'](handleError(_0x12a03,null));};exports[_0x85d5('0x40')]=function(_0xd8db57,_0x219154){if(_0xd8db57['body']['id']){delete _0xd8db57['body']['id'];}return db['Integration'][_0x85d5('0x41')]({'where':{'id':_0xd8db57[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x219154,null))['then'](saveUpdates(_0xd8db57['body'],null))[_0x85d5('0x1c')](respondWithResult(_0x219154,null))[_0x85d5('0x42')](handleError(_0x219154,null));};exports[_0x85d5('0x43')]=function(_0x288b56,_0x4b2dce){return db[_0x85d5('0x34')][_0x85d5('0x41')]({'where':{'id':_0x288b56[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x4b2dce,null))[_0x85d5('0x1c')](removeEntity(_0x4b2dce,null))[_0x85d5('0x42')](handleError(_0x4b2dce,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 594f854..5c20f5a 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 _0xda60=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash'];(function(_0x1f94e8,_0x367275){var _0x45c521=function(_0x5774d8){while(--_0x5774d8){_0x1f94e8['push'](_0x1f94e8['shift']());}};_0x45c521(++_0x367275);}(_0xda60,0x12b));var _0x0da6=function(_0x588dd2,_0x5c8152){_0x588dd2=_0x588dd2-0x0;var _0x4f208e=_0xda60[_0x588dd2];return _0x4f208e;};'use strict';var _=require(_0x0da6('0x0'));var util=require(_0x0da6('0x1'));var logger=require(_0x0da6('0x2'))(_0x0da6('0x3'));var moment=require('moment');var BPromise=require(_0x0da6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0da6('0x5'));var rimraf=require(_0x0da6('0x6'));var config=require(_0x0da6('0x7'));var attributes=require(_0x0da6('0x8'));module[_0x0da6('0x9')]=function(_0xce58d2,_0x1152be){return _0xce58d2['define'](_0x0da6('0xa'),attributes,{'tableName':_0x0da6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ae7=['request-promise','path','../../config/environment','exports','define','Integration','integrations','lodash','../../config/logger','bluebird'];(function(_0x461884,_0x454653){var _0x12663a=function(_0x5b7823){while(--_0x5b7823){_0x461884['push'](_0x461884['shift']());}};_0x12663a(++_0x454653);}(_0x8ae7,0x1ab));var _0x78ae=function(_0x2b71ba,_0x151013){_0x2b71ba=_0x2b71ba-0x0;var _0x389bb7=_0x8ae7[_0x2b71ba];return _0x389bb7;};'use strict';var _=require(_0x78ae('0x0'));var util=require('util');var logger=require(_0x78ae('0x1'))('api');var moment=require('moment');var BPromise=require(_0x78ae('0x2'));var rp=require(_0x78ae('0x3'));var fs=require('fs');var path=require(_0x78ae('0x4'));var rimraf=require('rimraf');var config=require(_0x78ae('0x5'));var attributes=require('./integration.attributes');module[_0x78ae('0x6')]=function(_0x2a66cc,_0x125917){return _0x2a66cc[_0x78ae('0x7')](_0x78ae('0x8'),attributes,{'tableName':_0x78ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 469985c..a1c6224 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5261a8,_0x482ee4){var _0x48c7de=function(_0x5392eb){while(--_0x5392eb){_0x5261a8['push'](_0x5261a8['shift']());}};_0x48c7de(++_0x482ee4);}(_0x896e,0x1e9));var _0xe896=function(_0x5104dc,_0x27b85e){_0x5104dc=_0x5104dc-0x0;var _0xe25f4e=_0x896e[_0x5104dc];return _0xe25f4e;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index d375932..dc117ea 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 _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x3cafb8,_0x32860e){var _0x4b7f85=function(_0x31b11d){while(--_0x31b11d){_0x3cafb8['push'](_0x3cafb8['shift']());}};_0x4b7f85(++_0x32860e);}(_0xadb5,0xad));var _0x5adb=function(_0x2a580a,_0x114f8f){_0x2a580a=_0x2a580a-0x0;var _0x2c6107=_0xadb5[_0x2a580a];return _0x2c6107;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./integrationReport.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=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(_0x5b8409,_0x2ff872){var _0x19b176=function(_0x357bff){while(--_0x357bff){_0x5b8409['push'](_0x5b8409['shift']());}};_0x19b176(++_0x2ff872);}(_0x7a54,0x106));var _0x47a5=function(_0x45009d,_0xbbd59c){_0x45009d=_0x45009d-0x0;var _0x184117=_0x7a54[_0x45009d];return _0x184117;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index eae1a57..c42d3b6 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 _0x771f=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x4667b2,_0x135b67){var _0x1070f2=function(_0xa72ca5){while(--_0xa72ca5){_0x4667b2['push'](_0x4667b2['shift']());}};_0x1070f2(++_0x135b67);}(_0x771f,0xb8));var _0xf771=function(_0x2ffcb1,_0x559b0d){_0x2ffcb1=_0x2ffcb1-0x0;var _0x333da2=_0x771f[_0x2ffcb1];return _0x333da2;};'use strict';var Sequelize=require(_0xf771('0x0'));module[_0xf771('0x1')]={'integration':{'type':Sequelize[_0xf771('0x2')]},'eventChannel':{'type':Sequelize[_0xf771('0x2')]},'exitStatus':{'type':Sequelize[_0xf771('0x2')]},'ticketId':{'type':Sequelize[_0xf771('0x2')]},'integrationId':{'type':Sequelize[_0xf771('0x3')]},'contacts':{'type':Sequelize[_0xf771('0x2')]},'uniqueid':{'type':Sequelize[_0xf771('0x2')]},'calleridnum':{'type':Sequelize[_0xf771('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf771('0x2')]},'interface':{'type':Sequelize[_0xf771('0x2')]},'membername':{'type':Sequelize[_0xf771('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf771('0x4')]},'agentconnectAt':{'type':Sequelize[_0xf771('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf771('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf771('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xf771('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf771('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xf771('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf771('0x4')]},'lastevent':{'type':Sequelize[_0xf771('0x2')]},'channel':{'type':Sequelize[_0xf771('0x2')]},'channelstate':{'type':Sequelize[_0xf771('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf771('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf771('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf771('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf771('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf771('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf771('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xf771('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf771('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf771('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf771('0x2')]},'destlanguage':{'type':Sequelize[_0xf771('0x2')]},'destaccountcode':{'type':Sequelize[_0xf771('0x2')]},'destcontext':{'type':Sequelize[_0xf771('0x2')]},'destexten':{'type':Sequelize[_0xf771('0x2')]},'destpriority':{'type':Sequelize[_0xf771('0x2')]},'destuniqueid':{'type':Sequelize[_0xf771('0x2')]},'messageId':{'type':Sequelize[_0xf771('0x2')]},'inReplyTo':{'type':Sequelize[_0xf771('0x2')]},'subject':{'type':Sequelize[_0xf771('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xf771('0x2')]},'attachment':{'type':Sequelize[_0xf771('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xf771('0x7')]('SENT',_0xf771('0x8'),_0xf771('0x9'),_0xf771('0xa'))},'url':{'type':Sequelize[_0xf771('0x2')]},'app':{'type':Sequelize[_0xf771('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xf771('0x3')]}}; \ No newline at end of file +var _0xf543=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf543,0x1e2));var _0x3f54=function(_0x4da578,_0x1d4a5d){_0x4da578=_0x4da578-0x0;var _0x22a6f2=_0xf543[_0x4da578];return _0x22a6f2;};'use strict';var Sequelize=require(_0x3f54('0x0'));module[_0x3f54('0x1')]={'integration':{'type':Sequelize[_0x3f54('0x2')]},'eventChannel':{'type':Sequelize[_0x3f54('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3f54('0x2')]},'integrationId':{'type':Sequelize[_0x3f54('0x3')]},'contacts':{'type':Sequelize[_0x3f54('0x2')]},'uniqueid':{'type':Sequelize[_0x3f54('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3f54('0x2')]},'queue':{'type':Sequelize[_0x3f54('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x3f54('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x3f54('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x3f54('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3f54('0x3')]},'reason':{'type':Sequelize[_0x3f54('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x3f54('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3f54('0x4')]},'lastevent':{'type':Sequelize[_0x3f54('0x2')]},'channel':{'type':Sequelize[_0x3f54('0x2')]},'channelstate':{'type':Sequelize[_0x3f54('0x3')]},'channelstatedesc':{'type':Sequelize[_0x3f54('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3f54('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3f54('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x3f54('0x2')]},'destchannelstate':{'type':Sequelize[_0x3f54('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3f54('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3f54('0x2')]},'destcalleridname':{'type':Sequelize[_0x3f54('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3f54('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3f54('0x2')]},'destlanguage':{'type':Sequelize[_0x3f54('0x2')]},'destaccountcode':{'type':Sequelize[_0x3f54('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3f54('0x2')]},'destpriority':{'type':Sequelize[_0x3f54('0x2')]},'destuniqueid':{'type':Sequelize[_0x3f54('0x2')]},'messageId':{'type':Sequelize[_0x3f54('0x2')]},'inReplyTo':{'type':Sequelize[_0x3f54('0x2')]},'subject':{'type':Sequelize[_0x3f54('0x2')]},'from':{'type':Sequelize[_0x3f54('0x2')]},'to':{'type':Sequelize[_0x3f54('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x3f54('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x3f54('0x6')]},'status':{'type':Sequelize[_0x3f54('0x7')](_0x3f54('0x8'),'SENDING',_0x3f54('0x9'),_0x3f54('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x3f54('0x2')]},'appdata':{'type':Sequelize[_0x3f54('0x2')]},'projectId':{'type':Sequelize[_0x3f54('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b7ad2f4..95347e7 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 _0xd78a=['error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','IntegrationReport','include','rows','catch','params','keys','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','destroy'];(function(_0x154fd2,_0x285635){var _0x1c20be=function(_0x418d06){while(--_0x418d06){_0x154fd2['push'](_0x154fd2['shift']());}};_0x1c20be(++_0x285635);}(_0xd78a,0x1e3));var _0xad78=function(_0x29d88b,_0x3480b8){_0x29d88b=_0x29d88b-0x0;var _0x8c0bde=_0xd78a[_0x29d88b];return _0x8c0bde;};'use strict';var emlformat=require(_0xad78('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad78('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad78('0x2'));var moment=require(_0xad78('0x3'));var BPromise=require(_0xad78('0x4'));var Mustache=require(_0xad78('0x5'));var util=require(_0xad78('0x6'));var path=require(_0xad78('0x7'));var sox=require(_0xad78('0x8'));var csv=require(_0xad78('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad78('0xa'));var _=require(_0xad78('0xb'));var squel=require(_0xad78('0xc'));var crypto=require(_0xad78('0xd'));var jsforce=require(_0xad78('0xe'));var deskjs=require(_0xad78('0xf'));var toCsv=require(_0xad78('0x9'));var querystring=require('querystring');var Papa=require(_0xad78('0x10'));var Redis=require(_0xad78('0x11'));var authService=require(_0xad78('0x12'));var qs=require(_0xad78('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad78('0x14'));var logger=require(_0xad78('0x15'))(_0xad78('0x16'));var utils=require(_0xad78('0x17'));var config=require(_0xad78('0x18'));var licenseUtil=require(_0xad78('0x19'));var db=require(_0xad78('0x1a'))['db'];function respondWithStatusCode(_0xa1c9a2,_0x204e8e){_0x204e8e=_0x204e8e||0xcc;return function(_0x5d53b6){if(_0x5d53b6){return _0xa1c9a2[_0xad78('0x1b')](_0x204e8e);}return _0xa1c9a2[_0xad78('0x1c')](_0x204e8e)[_0xad78('0x1d')]();};}function respondWithResult(_0x4f7c78,_0x4c1f25){_0x4c1f25=_0x4c1f25||0xc8;return function(_0x24d40b){if(_0x24d40b){return _0x4f7c78[_0xad78('0x1c')](_0x4c1f25)[_0xad78('0x1e')](_0x24d40b);}};}function respondWithFilteredResult(_0xe59d05,_0xfc1a3d){return function(_0x4b804f){if(_0x4b804f){var _0x21d69a=typeof _0xfc1a3d[_0xad78('0x1f')]===_0xad78('0x20')&&typeof _0xfc1a3d[_0xad78('0x21')]==='undefined';var _0x54c583=_0x4b804f['count'];var _0x307c54=_0x21d69a?0x0:_0xfc1a3d[_0xad78('0x1f')];var _0x16ad36=_0x21d69a?_0x4b804f[_0xad78('0x22')]:_0xfc1a3d[_0xad78('0x1f')]+_0xfc1a3d[_0xad78('0x21')];var _0x197b9d;if(_0x16ad36>=_0x54c583){_0x16ad36=_0x54c583;_0x197b9d=0xc8;}else{_0x197b9d=0xce;}_0xe59d05[_0xad78('0x1c')](_0x197b9d);return _0xe59d05[_0xad78('0x23')]('Content-Range',_0x307c54+'-'+_0x16ad36+'/'+_0x54c583)[_0xad78('0x1e')](_0x4b804f);}return null;};}function patchUpdates(_0x493fbc){return function(_0x452001){try{jsonpatch[_0xad78('0x24')](_0x452001,_0x493fbc,!![]);}catch(_0x3a4c63){return BPromise[_0xad78('0x25')](_0x3a4c63);}return _0x452001[_0xad78('0x26')]();};}function saveUpdates(_0xfb7b5d,_0x26d3e2){return function(_0x478ce1){if(_0x478ce1){return _0x478ce1[_0xad78('0x27')](_0xfb7b5d)[_0xad78('0x28')](function(_0x204a7a){return _0x204a7a;});}return null;};}function removeEntity(_0x2c2088,_0x26a5ca){return function(_0x25dde9){if(_0x25dde9){return _0x25dde9[_0xad78('0x29')]()[_0xad78('0x28')](function(){_0x2c2088[_0xad78('0x1c')](0xcc)[_0xad78('0x1d')]();});}};}function handleEntityNotFound(_0xb05d04,_0x4e74dc){return function(_0x402149){if(!_0x402149){_0xb05d04[_0xad78('0x1b')](0x194);}return _0x402149;};}function handleError(_0x5b9124,_0x4bcffd){_0x4bcffd=_0x4bcffd||0x1f4;return function(_0x5eba6e){logger[_0xad78('0x2a')](_0x5eba6e[_0xad78('0x2b')]);if(_0x5eba6e[_0xad78('0x2c')]){delete _0x5eba6e[_0xad78('0x2c')];}_0x5b9124[_0xad78('0x1c')](_0x4bcffd)[_0xad78('0x2d')](_0x5eba6e);};}exports[_0xad78('0x2e')]=function(_0x478e62,_0x4be23f){var _0x5eac6e={},_0x116e65={},_0x81fea2={'count':0x0,'rows':[]};var _0x803e05=_[_0xad78('0x2f')](db['IntegrationReport']['rawAttributes'],function(_0x1f9f4b){return{'name':_0x1f9f4b[_0xad78('0x30')],'type':_0x1f9f4b[_0xad78('0x31')][_0xad78('0x32')]};});_0x116e65[_0xad78('0x33')]=_['map'](_0x803e05,_0xad78('0x2c'));_0x116e65['query']=_['keys'](_0x478e62[_0xad78('0x34')]);_0x116e65[_0xad78('0x35')]=_[_0xad78('0x36')](_0x116e65[_0xad78('0x33')],_0x116e65[_0xad78('0x34')]);_0x5eac6e['attributes']=_[_0xad78('0x36')](_0x116e65['model'],qs[_0xad78('0x37')](_0x478e62['query']['fields']));_0x5eac6e[_0xad78('0x38')]=_0x5eac6e['attributes'][_0xad78('0x39')]?_0x5eac6e[_0xad78('0x38')]:_0x116e65[_0xad78('0x33')];if(!_0x478e62['query'][_0xad78('0x3a')]('nolimit')){_0x5eac6e[_0xad78('0x21')]=qs[_0xad78('0x21')](_0x478e62['query'][_0xad78('0x21')]);_0x5eac6e['offset']=qs[_0xad78('0x1f')](_0x478e62[_0xad78('0x34')][_0xad78('0x1f')]);}_0x5eac6e['order']=qs[_0xad78('0x3b')](_0x478e62[_0xad78('0x34')][_0xad78('0x3b')]);_0x5eac6e['where']=qs[_0xad78('0x35')](_[_0xad78('0x3c')](_0x478e62['query'],_0x116e65[_0xad78('0x35')]),_0x803e05);if(_0x478e62[_0xad78('0x34')][_0xad78('0x3d')]){_0x5eac6e[_0xad78('0x3e')]=_['merge'](_0x5eac6e[_0xad78('0x3e')],{'$or':_[_0xad78('0x2f')](_0x803e05,function(_0x5e9ccd){if(_0x5e9ccd[_0xad78('0x31')]!==_0xad78('0x3f')){var _0x31631e={};_0x31631e[_0x5e9ccd[_0xad78('0x2c')]]={'$like':'%'+_0x478e62[_0xad78('0x34')][_0xad78('0x3d')]+'%'};return _0x31631e;}})});}_0x5eac6e=_[_0xad78('0x40')]({},_0x5eac6e,_0x478e62[_0xad78('0x41')]);var _0x57f716={'where':_0x5eac6e[_0xad78('0x3e')]};return db[_0xad78('0x42')][_0xad78('0x22')](_0x57f716)[_0xad78('0x28')](function(_0x26f7d7){_0x81fea2[_0xad78('0x22')]=_0x26f7d7;if(_0x478e62['query']['includeAll']){_0x5eac6e[_0xad78('0x43')]=[{'all':!![]}];}return db[_0xad78('0x42')]['findAll'](_0x5eac6e);})[_0xad78('0x28')](function(_0xd72d98){_0x81fea2[_0xad78('0x44')]=_0xd72d98;return _0x81fea2;})[_0xad78('0x28')](respondWithFilteredResult(_0x4be23f,_0x5eac6e))[_0xad78('0x45')](handleError(_0x4be23f,null));};exports['show']=function(_0x51a251,_0x9ec25b){var _0x599d59={'raw':![],'where':{'id':_0x51a251[_0xad78('0x46')]['id']}},_0x1ac2bc={};_0x1ac2bc[_0xad78('0x33')]=_['keys'](db[_0xad78('0x42')]['rawAttributes']);_0x1ac2bc[_0xad78('0x34')]=_[_0xad78('0x47')](_0x51a251[_0xad78('0x34')]);_0x1ac2bc[_0xad78('0x35')]=_[_0xad78('0x36')](_0x1ac2bc[_0xad78('0x33')],_0x1ac2bc[_0xad78('0x34')]);_0x599d59[_0xad78('0x38')]=_['intersection'](_0x1ac2bc[_0xad78('0x33')],qs['fields'](_0x51a251[_0xad78('0x34')][_0xad78('0x37')]));_0x599d59[_0xad78('0x38')]=_0x599d59[_0xad78('0x38')][_0xad78('0x39')]?_0x599d59['attributes']:_0x1ac2bc[_0xad78('0x33')];if(_0x51a251['query']['includeAll']){_0x599d59[_0xad78('0x43')]=[{'all':!![]}];}_0x599d59=_['merge']({},_0x599d59,_0x51a251[_0xad78('0x41')]);return db['IntegrationReport'][_0xad78('0x48')](_0x599d59)[_0xad78('0x28')](handleEntityNotFound(_0x9ec25b,null))['then'](respondWithResult(_0x9ec25b,null))[_0xad78('0x45')](handleError(_0x9ec25b,null));};exports['create']=function(_0x543fdd,_0x1c72db){return db[_0xad78('0x42')][_0xad78('0x49')](_0x543fdd['body'],{})[_0xad78('0x28')](respondWithResult(_0x1c72db,0xc9))[_0xad78('0x45')](handleError(_0x1c72db,null));};exports[_0xad78('0x27')]=function(_0x84f066,_0x1565ec){if(_0x84f066['body']['id']){delete _0x84f066[_0xad78('0x4a')]['id'];}return db[_0xad78('0x42')][_0xad78('0x48')]({'where':{'id':_0x84f066['params']['id']}})[_0xad78('0x28')](handleEntityNotFound(_0x1565ec,null))['then'](saveUpdates(_0x84f066[_0xad78('0x4a')],null))[_0xad78('0x28')](respondWithResult(_0x1565ec,null))['catch'](handleError(_0x1565ec,null));};exports[_0xad78('0x29')]=function(_0x551fad,_0x5d4a14){return db['IntegrationReport'][_0xad78('0x48')]({'where':{'id':_0x551fad[_0xad78('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d4a14,null))[_0xad78('0x28')](removeEntity(_0x5d4a14,null))[_0xad78('0x45')](handleError(_0x5d4a14,null));};exports['describe']=function(_0x3fd38c,_0x2d61ed){return db[_0xad78('0x42')]['describe']()[_0xad78('0x28')](respondWithResult(_0x2d61ed,null))[_0xad78('0x45')](handleError(_0x2d61ed,null));}; \ No newline at end of file +var _0x7c2f=['sort','where','pick','filter','type','VIRTUAL','merge','include','findAll','rows','show','params','length','options','find','catch','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','IntegrationReport','rawAttributes','fieldName','key','model','map','filters','query','attributes','intersection','fields','nolimit','order'];(function(_0x53c535,_0x2a5688){var _0x427321=function(_0x3454f1){while(--_0x3454f1){_0x53c535['push'](_0x53c535['shift']());}};_0x427321(++_0x2a5688);}(_0x7c2f,0x18f));var _0xf7c2=function(_0x871b3f,_0x44c34a){_0x871b3f=_0x871b3f-0x0;var _0x3f4165=_0x7c2f[_0x871b3f];return _0x3f4165;};'use strict';var emlformat=require(_0xf7c2('0x0'));var rimraf=require(_0xf7c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf7c2('0x2'));var BPromise=require(_0xf7c2('0x3'));var Mustache=require(_0xf7c2('0x4'));var util=require('util');var path=require(_0xf7c2('0x5'));var sox=require(_0xf7c2('0x6'));var csv=require(_0xf7c2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7c2('0x8'));var squel=require(_0xf7c2('0x9'));var crypto=require(_0xf7c2('0xa'));var jsforce=require(_0xf7c2('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf7c2('0xc'));var Papa=require(_0xf7c2('0xd'));var Redis=require(_0xf7c2('0xe'));var authService=require(_0xf7c2('0xf'));var qs=require(_0xf7c2('0x10'));var as=require(_0xf7c2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7c2('0x12'))(_0xf7c2('0x13'));var utils=require(_0xf7c2('0x14'));var config=require(_0xf7c2('0x15'));var licenseUtil=require(_0xf7c2('0x16'));var db=require(_0xf7c2('0x17'))['db'];function respondWithStatusCode(_0x307263,_0x2bf64f){_0x2bf64f=_0x2bf64f||0xcc;return function(_0x129635){if(_0x129635){return _0x307263['sendStatus'](_0x2bf64f);}return _0x307263[_0xf7c2('0x18')](_0x2bf64f)[_0xf7c2('0x19')]();};}function respondWithResult(_0x182c76,_0x3ac9b2){_0x3ac9b2=_0x3ac9b2||0xc8;return function(_0x4fced1){if(_0x4fced1){return _0x182c76[_0xf7c2('0x18')](_0x3ac9b2)['json'](_0x4fced1);}};}function respondWithFilteredResult(_0x2be39b,_0x5d9815){return function(_0x5054a1){if(_0x5054a1){var _0x482441=typeof _0x5d9815['offset']==='undefined'&&typeof _0x5d9815[_0xf7c2('0x1a')]===_0xf7c2('0x1b');var _0x5d781a=_0x5054a1[_0xf7c2('0x1c')];var _0x34b893=_0x482441?0x0:_0x5d9815[_0xf7c2('0x1d')];var _0x4b5c6d=_0x482441?_0x5054a1[_0xf7c2('0x1c')]:_0x5d9815[_0xf7c2('0x1d')]+_0x5d9815[_0xf7c2('0x1a')];var _0x2414b8;if(_0x4b5c6d>=_0x5d781a){_0x4b5c6d=_0x5d781a;_0x2414b8=0xc8;}else{_0x2414b8=0xce;}_0x2be39b[_0xf7c2('0x18')](_0x2414b8);return _0x2be39b[_0xf7c2('0x1e')](_0xf7c2('0x1f'),_0x34b893+'-'+_0x4b5c6d+'/'+_0x5d781a)[_0xf7c2('0x20')](_0x5054a1);}return null;};}function patchUpdates(_0x592d66){return function(_0x23c5d6){try{jsonpatch[_0xf7c2('0x21')](_0x23c5d6,_0x592d66,!![]);}catch(_0x1f27aa){return BPromise[_0xf7c2('0x22')](_0x1f27aa);}return _0x23c5d6[_0xf7c2('0x23')]();};}function saveUpdates(_0x1055a1,_0x3a8843){return function(_0x58a2b3){if(_0x58a2b3){return _0x58a2b3[_0xf7c2('0x24')](_0x1055a1)[_0xf7c2('0x25')](function(_0x3c15b3){return _0x3c15b3;});}return null;};}function removeEntity(_0x28bca0,_0x9ada54){return function(_0x2de9a5){if(_0x2de9a5){return _0x2de9a5[_0xf7c2('0x26')]()['then'](function(){_0x28bca0[_0xf7c2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dbe75,_0x2ea3bd){return function(_0x1841cc){if(!_0x1841cc){_0x2dbe75[_0xf7c2('0x27')](0x194);}return _0x1841cc;};}function handleError(_0x4bf52c,_0xe07462){_0xe07462=_0xe07462||0x1f4;return function(_0x3df890){logger[_0xf7c2('0x28')](_0x3df890[_0xf7c2('0x29')]);if(_0x3df890[_0xf7c2('0x2a')]){delete _0x3df890[_0xf7c2('0x2a')];}_0x4bf52c['status'](_0xe07462)[_0xf7c2('0x2b')](_0x3df890);};}exports['index']=function(_0x5ed8a0,_0x241c1c){var _0x467215={},_0x3dba5f={},_0x367198={'count':0x0,'rows':[]};var _0x116778=_['map'](db[_0xf7c2('0x2c')][_0xf7c2('0x2d')],function(_0x2e8908){return{'name':_0x2e8908[_0xf7c2('0x2e')],'type':_0x2e8908['type'][_0xf7c2('0x2f')]};});_0x3dba5f[_0xf7c2('0x30')]=_[_0xf7c2('0x31')](_0x116778,_0xf7c2('0x2a'));_0x3dba5f['query']=_['keys'](_0x5ed8a0['query']);_0x3dba5f[_0xf7c2('0x32')]=_['intersection'](_0x3dba5f[_0xf7c2('0x30')],_0x3dba5f[_0xf7c2('0x33')]);_0x467215[_0xf7c2('0x34')]=_[_0xf7c2('0x35')](_0x3dba5f[_0xf7c2('0x30')],qs['fields'](_0x5ed8a0[_0xf7c2('0x33')][_0xf7c2('0x36')]));_0x467215['attributes']=_0x467215[_0xf7c2('0x34')]['length']?_0x467215['attributes']:_0x3dba5f['model'];if(!_0x5ed8a0['query']['hasOwnProperty'](_0xf7c2('0x37'))){_0x467215['limit']=qs[_0xf7c2('0x1a')](_0x5ed8a0[_0xf7c2('0x33')]['limit']);_0x467215['offset']=qs[_0xf7c2('0x1d')](_0x5ed8a0[_0xf7c2('0x33')]['offset']);}_0x467215[_0xf7c2('0x38')]=qs[_0xf7c2('0x39')](_0x5ed8a0[_0xf7c2('0x33')][_0xf7c2('0x39')]);_0x467215[_0xf7c2('0x3a')]=qs[_0xf7c2('0x32')](_[_0xf7c2('0x3b')](_0x5ed8a0[_0xf7c2('0x33')],_0x3dba5f[_0xf7c2('0x32')]),_0x116778);if(_0x5ed8a0[_0xf7c2('0x33')][_0xf7c2('0x3c')]){_0x467215[_0xf7c2('0x3a')]=_['merge'](_0x467215[_0xf7c2('0x3a')],{'$or':_['map'](_0x116778,function(_0x1308dd){if(_0x1308dd[_0xf7c2('0x3d')]!==_0xf7c2('0x3e')){var _0x5b551a={};_0x5b551a[_0x1308dd[_0xf7c2('0x2a')]]={'$like':'%'+_0x5ed8a0[_0xf7c2('0x33')][_0xf7c2('0x3c')]+'%'};return _0x5b551a;}})});}_0x467215=_[_0xf7c2('0x3f')]({},_0x467215,_0x5ed8a0['options']);var _0x601456={'where':_0x467215['where']};return db['IntegrationReport'][_0xf7c2('0x1c')](_0x601456)[_0xf7c2('0x25')](function(_0x4a1411){_0x367198[_0xf7c2('0x1c')]=_0x4a1411;if(_0x5ed8a0['query']['includeAll']){_0x467215[_0xf7c2('0x40')]=[{'all':!![]}];}return db[_0xf7c2('0x2c')][_0xf7c2('0x41')](_0x467215);})[_0xf7c2('0x25')](function(_0x2fc326){_0x367198[_0xf7c2('0x42')]=_0x2fc326;return _0x367198;})[_0xf7c2('0x25')](respondWithFilteredResult(_0x241c1c,_0x467215))['catch'](handleError(_0x241c1c,null));};exports[_0xf7c2('0x43')]=function(_0x346acd,_0x4df1b6){var _0x1726cd={'raw':![],'where':{'id':_0x346acd[_0xf7c2('0x44')]['id']}},_0x245f5f={};_0x245f5f[_0xf7c2('0x30')]=_['keys'](db[_0xf7c2('0x2c')][_0xf7c2('0x2d')]);_0x245f5f[_0xf7c2('0x33')]=_['keys'](_0x346acd[_0xf7c2('0x33')]);_0x245f5f['filters']=_[_0xf7c2('0x35')](_0x245f5f[_0xf7c2('0x30')],_0x245f5f['query']);_0x1726cd['attributes']=_[_0xf7c2('0x35')](_0x245f5f[_0xf7c2('0x30')],qs[_0xf7c2('0x36')](_0x346acd[_0xf7c2('0x33')]['fields']));_0x1726cd[_0xf7c2('0x34')]=_0x1726cd[_0xf7c2('0x34')][_0xf7c2('0x45')]?_0x1726cd[_0xf7c2('0x34')]:_0x245f5f[_0xf7c2('0x30')];if(_0x346acd['query']['includeAll']){_0x1726cd[_0xf7c2('0x40')]=[{'all':!![]}];}_0x1726cd=_['merge']({},_0x1726cd,_0x346acd[_0xf7c2('0x46')]);return db[_0xf7c2('0x2c')][_0xf7c2('0x47')](_0x1726cd)['then'](handleEntityNotFound(_0x4df1b6,null))['then'](respondWithResult(_0x4df1b6,null))[_0xf7c2('0x48')](handleError(_0x4df1b6,null));};exports[_0xf7c2('0x49')]=function(_0x431b0d,_0xffff10){return db['IntegrationReport']['create'](_0x431b0d['body'],{})[_0xf7c2('0x25')](respondWithResult(_0xffff10,0xc9))[_0xf7c2('0x48')](handleError(_0xffff10,null));};exports[_0xf7c2('0x24')]=function(_0x1c8962,_0x3f18de){if(_0x1c8962[_0xf7c2('0x4a')]['id']){delete _0x1c8962['body']['id'];}return db[_0xf7c2('0x2c')][_0xf7c2('0x47')]({'where':{'id':_0x1c8962[_0xf7c2('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f18de,null))[_0xf7c2('0x25')](saveUpdates(_0x1c8962[_0xf7c2('0x4a')],null))['then'](respondWithResult(_0x3f18de,null))[_0xf7c2('0x48')](handleError(_0x3f18de,null));};exports[_0xf7c2('0x26')]=function(_0x4f2ab0,_0x14fd1e){return db[_0xf7c2('0x2c')][_0xf7c2('0x47')]({'where':{'id':_0x4f2ab0[_0xf7c2('0x44')]['id']}})[_0xf7c2('0x25')](handleEntityNotFound(_0x14fd1e,null))['then'](removeEntity(_0x14fd1e,null))[_0xf7c2('0x48')](handleError(_0x14fd1e,null));};exports[_0xf7c2('0x4b')]=function(_0x2e201a,_0x3558fe){return db['IntegrationReport'][_0xf7c2('0x4b')]()[_0xf7c2('0x25')](respondWithResult(_0x3558fe,null))[_0xf7c2('0x48')](handleError(_0x3558fe,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c0238d4..082e1ce 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 _0xed73=['path','../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash','util','../../config/logger','api','request-promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xed73,0x150));var _0x3ed7=function(_0x1b4781,_0xdad8a3){_0x1b4781=_0x1b4781-0x0;var _0x5f4fd6=_0xed73[_0x1b4781];return _0x5f4fd6;};'use strict';var _=require(_0x3ed7('0x0'));var util=require(_0x3ed7('0x1'));var logger=require(_0x3ed7('0x2'))(_0x3ed7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3ed7('0x4'));var fs=require('fs');var path=require(_0x3ed7('0x5'));var rimraf=require('rimraf');var config=require(_0x3ed7('0x6'));var attributes=require(_0x3ed7('0x7'));module[_0x3ed7('0x8')]=function(_0x1ab27e,_0x4fd2b7){return _0x1ab27e[_0x3ed7('0x9')]('IntegrationReport',attributes,{'tableName':_0x3ed7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x018b=['request-promise','path','rimraf','exports','IntegrationReport','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x018b,0xfd));var _0xb018=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x018b[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require(_0xb018('0x0'));var logger=require(_0xb018('0x1'))(_0xb018('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb018('0x3'));var fs=require('fs');var path=require(_0xb018('0x4'));var rimraf=require(_0xb018('0x5'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xb018('0x6')]=function(_0x24af3a,_0x18c8cc){return _0x24af3a['define'](_0xb018('0x7'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 9df1399..3ebfca0 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 _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3da927,_0x33f620){var _0x11ba78=function(_0x1c06d0){while(--_0x1c06d0){_0x3da927['push'](_0x3da927['shift']());}};_0x11ba78(++_0x33f620);}(_0x57ca,0x108));var _0xa57c=function(_0x1183ec,_0x13f182){_0x1183ec=_0x1183ec-0x0;var _0x42b864=_0x57ca[_0x1183ec];return _0x42b864;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x37a620,_0x3c2d0b){var _0x491310=function(_0x96e427){while(--_0x96e427){_0x37a620['push'](_0x37a620['shift']());}};_0x491310(++_0x3c2d0b);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index e1d236a..8c630bb 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 _0x3dc1=['../../config/environment','get','isAuthenticated','/:id','show','getIntervals','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x33773c,_0x8f6a04){var _0x277a46=function(_0x528d94){while(--_0x528d94){_0x33773c['push'](_0x33773c['shift']());}};_0x277a46(++_0x8f6a04);}(_0x3dc1,0x127));var _0x13dc=function(_0xc623f1,_0x1d9e77){_0xc623f1=_0xc623f1-0x0;var _0x532037=_0x3dc1[_0xc623f1];return _0x532037;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x13dc('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13dc('0x1')]();var fs_extra=require(_0x13dc('0x2'));var auth=require(_0x13dc('0x3'));var interaction=require(_0x13dc('0x4'));var config=require(_0x13dc('0x5'));var controller=require('./interval.controller');router[_0x13dc('0x6')]('/',auth[_0x13dc('0x7')](),controller['index']);router['get'](_0x13dc('0x8'),auth['isAuthenticated'](),controller[_0x13dc('0x9')]);router[_0x13dc('0x6')]('/:id/sub_intervals',auth[_0x13dc('0x7')](),controller[_0x13dc('0xa')]);router[_0x13dc('0xb')]('/',auth[_0x13dc('0x7')](),controller['create']);router[_0x13dc('0xb')](_0x13dc('0xc'),auth['isAuthenticated'](),controller[_0x13dc('0xd')]);router[_0x13dc('0xb')](_0x13dc('0xe'),auth['isAuthenticated'](),controller[_0x13dc('0xf')]);router[_0x13dc('0x10')]('/:id',auth[_0x13dc('0x7')](),controller['update']);router[_0x13dc('0x11')](_0x13dc('0x8'),auth[_0x13dc('0x7')](),controller[_0x13dc('0x12')]);module[_0x13dc('0x13')]=router; \ No newline at end of file +var _0x16cc=['show','/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','put','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0x16cc,0x120));var _0xc16c=function(_0x2e693b,_0x5de5ea){_0x2e693b=_0x2e693b-0x0;var _0x5afa88=_0x16cc[_0x2e693b];return _0x5afa88;};'use strict';var multer=require('multer');var util=require(_0xc16c('0x0'));var path=require(_0xc16c('0x1'));var timeout=require(_0xc16c('0x2'));var express=require(_0xc16c('0x3'));var router=express[_0xc16c('0x4')]();var fs_extra=require(_0xc16c('0x5'));var auth=require(_0xc16c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc16c('0x7'));var controller=require(_0xc16c('0x8'));router[_0xc16c('0x9')]('/',auth[_0xc16c('0xa')](),controller['index']);router[_0xc16c('0x9')]('/:id',auth[_0xc16c('0xa')](),controller[_0xc16c('0xb')]);router[_0xc16c('0x9')](_0xc16c('0xc'),auth['isAuthenticated'](),controller[_0xc16c('0xd')]);router[_0xc16c('0xe')]('/',auth[_0xc16c('0xa')](),controller[_0xc16c('0xf')]);router['post'](_0xc16c('0xc'),auth[_0xc16c('0xa')](),controller[_0xc16c('0x10')]);router['post']('/:id/sub_intervals/create_many',auth[_0xc16c('0xa')](),controller[_0xc16c('0x11')]);router[_0xc16c('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc16c('0x13')](_0xc16c('0x14'),auth[_0xc16c('0xa')](),controller[_0xc16c('0x15')]);module[_0xc16c('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 9de37ee..fdfb56d 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 _0x0f2f=['sequelize','exports','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0f2f,0xab));var _0xf0f2=function(_0x45fa71,_0x47243f){_0x45fa71=_0x45fa71-0x0;var _0x2d2288=_0x0f2f[_0x45fa71];return _0x2d2288;};'use strict';var Sequelize=require(_0xf0f2('0x0'));module[_0xf0f2('0x1')]={'name':{'type':Sequelize[_0xf0f2('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf0f2('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x1882=['STRING','sequelize','exports'];(function(_0x235905,_0x2d8036){var _0x4f7209=function(_0xb6011c){while(--_0xb6011c){_0x235905['push'](_0x235905['shift']());}};_0x4f7209(++_0x2d8036);}(_0x1882,0xa9));var _0x2188=function(_0x490cb4,_0x16c206){_0x490cb4=_0x490cb4-0x0;var _0x1271e5=_0x1882[_0x490cb4];return _0x1271e5;};'use strict';var Sequelize=require(_0x2188('0x0'));module[_0x2188('0x1')]={'name':{'type':Sequelize[_0x2188('0x2')]},'description':{'type':Sequelize[_0x2188('0x2')]},'interval':{'type':Sequelize[_0x2188('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index b708a70..e093503 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 _0x74fe=['addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','undefined','count','limit','set','Content-Range','apply','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','map','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','merge','where','VIRTUAL','filter','options','Interval','includeAll','findAll','catch','params','keys','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','addInterval','IntervalId','getIntervals','findOne','rawAttributes','intersection'];(function(_0x21874a,_0x26f3f7){var _0x10b825=function(_0x314059){while(--_0x314059){_0x21874a['push'](_0x21874a['shift']());}};_0x10b825(++_0x26f3f7);}(_0x74fe,0xbc));var _0xe74f=function(_0x88a9f2,_0x1a182f){_0x88a9f2=_0x88a9f2-0x0;var _0x63527b=_0x74fe[_0x88a9f2];return _0x63527b;};'use strict';var emlformat=require(_0xe74f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe74f('0x1'));var jsonpatch=require(_0xe74f('0x2'));var rp=require('request-promise');var moment=require(_0xe74f('0x3'));var BPromise=require(_0xe74f('0x4'));var Mustache=require(_0xe74f('0x5'));var util=require(_0xe74f('0x6'));var path=require(_0xe74f('0x7'));var sox=require(_0xe74f('0x8'));var csv=require(_0xe74f('0x9'));var ejs=require(_0xe74f('0xa'));var fs=require('fs');var fs_extra=require(_0xe74f('0xb'));var _=require('lodash');var squel=require(_0xe74f('0xc'));var crypto=require(_0xe74f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe74f('0xe'));var toCsv=require(_0xe74f('0x9'));var querystring=require(_0xe74f('0xf'));var Papa=require(_0xe74f('0x10'));var Redis=require(_0xe74f('0x11'));var authService=require(_0xe74f('0x12'));var qs=require(_0xe74f('0x13'));var as=require(_0xe74f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe74f('0x15'))(_0xe74f('0x16'));var utils=require(_0xe74f('0x17'));var config=require(_0xe74f('0x18'));var licenseUtil=require(_0xe74f('0x19'));var db=require(_0xe74f('0x1a'))['db'];var extensions=require(_0xe74f('0x1b'));function respondWithStatusCode(_0x5a4e0a,_0x1da64f){_0x1da64f=_0x1da64f||0xcc;return function(_0x1297b8){if(_0x1297b8){return _0x5a4e0a[_0xe74f('0x1c')](_0x1da64f);}return _0x5a4e0a[_0xe74f('0x1d')](_0x1da64f)['end']();};}function respondWithResult(_0x524230,_0xff44e1){_0xff44e1=_0xff44e1||0xc8;return function(_0x12b1f4){if(_0x12b1f4){return _0x524230[_0xe74f('0x1d')](_0xff44e1)['json'](_0x12b1f4);}};}function respondWithFilteredResult(_0xc454e4,_0x2c46aa){return function(_0x3691d9){if(_0x3691d9){var _0x42a140=typeof _0x2c46aa['offset']===_0xe74f('0x1e')&&typeof _0x2c46aa['limit']==='undefined';var _0x219fcc=_0x3691d9[_0xe74f('0x1f')];var _0x5807ca=_0x42a140?0x0:_0x2c46aa['offset'];var _0x23263a=_0x42a140?_0x3691d9[_0xe74f('0x1f')]:_0x2c46aa['offset']+_0x2c46aa[_0xe74f('0x20')];var _0x22a292;if(_0x23263a>=_0x219fcc){_0x23263a=_0x219fcc;_0x22a292=0xc8;}else{_0x22a292=0xce;}_0xc454e4['status'](_0x22a292);return _0xc454e4[_0xe74f('0x21')](_0xe74f('0x22'),_0x5807ca+'-'+_0x23263a+'/'+_0x219fcc)['json'](_0x3691d9);}return null;};}function patchUpdates(_0x365aee){return function(_0x20096f){try{jsonpatch[_0xe74f('0x23')](_0x20096f,_0x365aee,!![]);}catch(_0x3ee670){return BPromise['reject'](_0x3ee670);}return _0x20096f['save']();};}function saveUpdates(_0x4b9434,_0x2c45d5){return function(_0x3d8371){if(_0x3d8371){return _0x3d8371[_0xe74f('0x24')](_0x4b9434)[_0xe74f('0x25')](function(_0x499f1c){return _0x499f1c;});}return null;};}function removeEntity(_0xe2a35,_0x2404f0){return function(_0x283d74){if(_0x283d74){return _0x283d74[_0xe74f('0x26')]()[_0xe74f('0x25')](function(){var _0x1b4fb3=_0x283d74[_0xe74f('0x27')]({'plain':!![]});var _0x30af42=_0xe74f('0x28');return db[_0xe74f('0x29')]['destroy']({'where':{'type':_0x30af42,'resourceId':_0x1b4fb3['id']}})[_0xe74f('0x25')](function(){return _0x283d74;});})[_0xe74f('0x25')](function(){_0xe2a35[_0xe74f('0x1d')](0xcc)[_0xe74f('0x2a')]();});}};}function handleEntityNotFound(_0x92cd14,_0x4313cd){return function(_0x513d52){if(!_0x513d52){_0x92cd14[_0xe74f('0x1c')](0x194);}return _0x513d52;};}function handleError(_0x3558a9,_0x798e3d){_0x798e3d=_0x798e3d||0x1f4;return function(_0x11e625){logger[_0xe74f('0x2b')](_0x11e625[_0xe74f('0x2c')]);if(_0x11e625['name']){delete _0x11e625[_0xe74f('0x2d')];}_0x3558a9['status'](_0x798e3d)[_0xe74f('0x2e')](_0x11e625);};}exports['index']=function(_0x55ad54,_0x4b78bd){var _0x44143d={},_0x5a31dd={},_0x522365={'count':0x0,'rows':[]};var _0x3721fe=_[_0xe74f('0x2f')](db['Interval']['rawAttributes'],function(_0xe735b2){return{'name':_0xe735b2[_0xe74f('0x30')],'type':_0xe735b2[_0xe74f('0x31')][_0xe74f('0x32')]};});_0x5a31dd[_0xe74f('0x33')]=_['map'](_0x3721fe,_0xe74f('0x2d'));_0x5a31dd[_0xe74f('0x34')]=_['keys'](_0x55ad54[_0xe74f('0x34')]);_0x5a31dd[_0xe74f('0x35')]=_['intersection'](_0x5a31dd[_0xe74f('0x33')],_0x5a31dd[_0xe74f('0x34')]);_0x44143d[_0xe74f('0x36')]=_['intersection'](_0x5a31dd[_0xe74f('0x33')],qs[_0xe74f('0x37')](_0x55ad54[_0xe74f('0x34')][_0xe74f('0x37')]));_0x44143d[_0xe74f('0x36')]=_0x44143d[_0xe74f('0x36')]['length']?_0x44143d[_0xe74f('0x36')]:_0x5a31dd['model'];if(!_0x55ad54[_0xe74f('0x34')][_0xe74f('0x38')](_0xe74f('0x39'))){_0x44143d[_0xe74f('0x20')]=qs[_0xe74f('0x20')](_0x55ad54[_0xe74f('0x34')][_0xe74f('0x20')]);_0x44143d['offset']=qs['offset'](_0x55ad54['query'][_0xe74f('0x3a')]);}_0x44143d[_0xe74f('0x3b')]=qs[_0xe74f('0x3c')](_0x55ad54[_0xe74f('0x34')][_0xe74f('0x3c')]);_0x44143d['where']=qs[_0xe74f('0x35')](_[_0xe74f('0x3d')](_0x55ad54[_0xe74f('0x34')],_0x5a31dd[_0xe74f('0x35')]),_0x3721fe);if(_0x55ad54[_0xe74f('0x34')]['filter']){_0x44143d['where']=_[_0xe74f('0x3e')](_0x44143d[_0xe74f('0x3f')],{'$or':_[_0xe74f('0x2f')](_0x3721fe,function(_0x16a114){if(_0x16a114[_0xe74f('0x31')]!==_0xe74f('0x40')){var _0x1aa9ae={};_0x1aa9ae[_0x16a114[_0xe74f('0x2d')]]={'$like':'%'+_0x55ad54['query'][_0xe74f('0x41')]+'%'};return _0x1aa9ae;}})});}_0x44143d=_[_0xe74f('0x3e')]({},_0x44143d,_0x55ad54[_0xe74f('0x42')]);var _0x2fd28b={'where':_0x44143d[_0xe74f('0x3f')]};return db[_0xe74f('0x43')][_0xe74f('0x1f')](_0x2fd28b)[_0xe74f('0x25')](function(_0x1cc569){_0x522365[_0xe74f('0x1f')]=_0x1cc569;if(_0x55ad54[_0xe74f('0x34')][_0xe74f('0x44')]){_0x44143d['include']=[{'all':!![]}];}return db['Interval'][_0xe74f('0x45')](_0x44143d);})[_0xe74f('0x25')](function(_0x44e5f5){_0x522365['rows']=_0x44e5f5;return _0x522365;})[_0xe74f('0x25')](respondWithFilteredResult(_0x4b78bd,_0x44143d))[_0xe74f('0x46')](handleError(_0x4b78bd,null));};exports['show']=function(_0x83b510,_0x3710c){var _0x18f34e={'raw':!![],'where':{'id':_0x83b510[_0xe74f('0x47')]['id']}},_0x1d952d={};_0x1d952d[_0xe74f('0x33')]=_[_0xe74f('0x48')](db[_0xe74f('0x43')]['rawAttributes']);_0x1d952d[_0xe74f('0x34')]=_[_0xe74f('0x48')](_0x83b510[_0xe74f('0x34')]);_0x1d952d['filters']=_['intersection'](_0x1d952d[_0xe74f('0x33')],_0x1d952d['query']);_0x18f34e[_0xe74f('0x36')]=_['intersection'](_0x1d952d[_0xe74f('0x33')],qs[_0xe74f('0x37')](_0x83b510[_0xe74f('0x34')][_0xe74f('0x37')]));_0x18f34e['attributes']=_0x18f34e[_0xe74f('0x36')][_0xe74f('0x49')]?_0x18f34e['attributes']:_0x1d952d[_0xe74f('0x33')];if(_0x83b510['query'][_0xe74f('0x44')]){_0x18f34e[_0xe74f('0x4a')]=[{'all':!![]}];}_0x18f34e=_['merge']({},_0x18f34e,_0x83b510[_0xe74f('0x42')]);return db[_0xe74f('0x43')][_0xe74f('0x4b')](_0x18f34e)[_0xe74f('0x25')](handleEntityNotFound(_0x3710c,null))[_0xe74f('0x25')](respondWithResult(_0x3710c,null))[_0xe74f('0x46')](handleError(_0x3710c,null));};exports[_0xe74f('0x4c')]=function(_0x1fcb4f,_0x5486e5){return db[_0xe74f('0x43')]['create'](_0x1fcb4f[_0xe74f('0x4d')],{})['then'](function(_0x47896c){var _0x5a6249=_0x1fcb4f[_0xe74f('0x4e')][_0xe74f('0x27')]({'plain':!![]});if(!_0x5a6249)throw new Error(_0xe74f('0x4f'));if(_0x5a6249['role']===_0xe74f('0x4e')){var _0x44c381=_0x47896c[_0xe74f('0x27')]({'plain':!![]});var _0x190c98='Intervals';return db[_0xe74f('0x50')][_0xe74f('0x4b')]({'where':{'name':_0x190c98,'userProfileId':_0x5a6249['userProfileId']},'raw':!![]})['then'](function(_0x58a431){if(_0x58a431&&_0x58a431[_0xe74f('0x51')]===0x0){return db[_0xe74f('0x29')][_0xe74f('0x4c')]({'name':_0x44c381[_0xe74f('0x2d')],'resourceId':_0x44c381['id'],'type':_0x58a431[_0xe74f('0x2d')],'sectionId':_0x58a431['id']},{})[_0xe74f('0x25')](function(){return _0x47896c;});}else{return _0x47896c;}})[_0xe74f('0x46')](function(_0x596296){logger[_0xe74f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x596296);throw _0x596296;});}return _0x47896c;})[_0xe74f('0x25')](respondWithResult(_0x5486e5,0xc9))['catch'](handleError(_0x5486e5,null));};exports[_0xe74f('0x24')]=function(_0x486018,_0x147364){if(_0x486018[_0xe74f('0x4d')]['id']){delete _0x486018[_0xe74f('0x4d')]['id'];}return db[_0xe74f('0x43')][_0xe74f('0x4b')]({'where':{'id':_0x486018[_0xe74f('0x47')]['id']}})[_0xe74f('0x25')](handleEntityNotFound(_0x147364,null))['then'](saveUpdates(_0x486018[_0xe74f('0x4d')],null))[_0xe74f('0x25')](respondWithResult(_0x147364,null))[_0xe74f('0x46')](handleError(_0x147364,null));};exports[_0xe74f('0x26')]=function(_0x52378f,_0xd4db17){return db['Interval']['find']({'where':{'id':_0x52378f[_0xe74f('0x47')]['id']}})[_0xe74f('0x25')](handleEntityNotFound(_0xd4db17,null))[_0xe74f('0x25')](removeEntity(_0xd4db17,null))['catch'](handleError(_0xd4db17,null));};exports[_0xe74f('0x52')]=function(_0xf1bfa3,_0x4f840b,_0x5e7c3a){if(_0xf1bfa3['body']['id']){delete _0xf1bfa3[_0xe74f('0x4d')]['id'];}return db[_0xe74f('0x43')]['find']({'where':{'id':_0xf1bfa3[_0xe74f('0x47')]['id']}})[_0xe74f('0x25')](handleEntityNotFound(_0x4f840b,null))[_0xe74f('0x25')](function(_0x4d0613){if(_0x4d0613){_0xf1bfa3[_0xe74f('0x4d')][_0xe74f('0x53')]=_0x4d0613['id'];return db[_0xe74f('0x43')][_0xe74f('0x4c')](_0xf1bfa3[_0xe74f('0x4d')]);}})[_0xe74f('0x25')](respondWithResult(_0x4f840b,null))[_0xe74f('0x46')](handleError(_0x4f840b,null));};exports[_0xe74f('0x54')]=function(_0xb0bcff,_0x3b404d,_0x8ca56){var _0x38ea19={};var _0x1c332d={};var _0xe6ddf;var _0x5a5357;return db['Interval'][_0xe74f('0x55')]({'where':{'id':_0xb0bcff[_0xe74f('0x47')]['id']}})[_0xe74f('0x25')](handleEntityNotFound(_0x3b404d,null))['then'](function(_0x2dc405){if(_0x2dc405){_0xe6ddf=_0x2dc405;_0x1c332d[_0xe74f('0x33')]=_[_0xe74f('0x48')](db[_0xe74f('0x43')][_0xe74f('0x56')]);_0x1c332d[_0xe74f('0x34')]=_['keys'](_0xb0bcff[_0xe74f('0x34')]);_0x1c332d[_0xe74f('0x35')]=_[_0xe74f('0x57')](_0x1c332d[_0xe74f('0x33')],_0x1c332d[_0xe74f('0x34')]);_0x38ea19[_0xe74f('0x36')]=_[_0xe74f('0x57')](_0x1c332d[_0xe74f('0x33')],qs['fields'](_0xb0bcff[_0xe74f('0x34')]['fields']));_0x38ea19[_0xe74f('0x36')]=_0x38ea19['attributes'][_0xe74f('0x49')]?_0x38ea19['attributes']:_0x1c332d[_0xe74f('0x33')];_0x38ea19[_0xe74f('0x3b')]=qs[_0xe74f('0x3c')](_0xb0bcff[_0xe74f('0x34')][_0xe74f('0x3c')]);_0x38ea19[_0xe74f('0x3f')]=qs[_0xe74f('0x35')](_['pick'](_0xb0bcff[_0xe74f('0x34')],_0x1c332d['filters']));if(_0xb0bcff[_0xe74f('0x34')]['filter']){_0x38ea19['where']=_[_0xe74f('0x3e')](_0x38ea19[_0xe74f('0x3f')],{'$or':_[_0xe74f('0x2f')](_0x38ea19[_0xe74f('0x36')],function(_0xb07036){var _0x4cbcd6={};_0x4cbcd6[_0xb07036]={'$like':'%'+_0xb0bcff[_0xe74f('0x34')][_0xe74f('0x41')]+'%'};return _0x4cbcd6;})});}_0x38ea19=_[_0xe74f('0x3e')]({},_0x38ea19,_0xb0bcff[_0xe74f('0x42')]);return _0xe6ddf[_0xe74f('0x54')](_0x38ea19);}})['then'](function(_0x4f61b0){if(_0x4f61b0){_0x5a5357=_0x4f61b0[_0xe74f('0x49')];if(!_0xb0bcff[_0xe74f('0x34')]['hasOwnProperty']('nolimit')){_0x38ea19[_0xe74f('0x20')]=qs[_0xe74f('0x20')](_0xb0bcff[_0xe74f('0x34')]['limit']);_0x38ea19[_0xe74f('0x3a')]=qs[_0xe74f('0x3a')](_0xb0bcff['query'][_0xe74f('0x3a')]);}return _0xe6ddf['getIntervals'](_0x38ea19);}})['then'](function(_0x1daba2){if(_0x1daba2){return _0x1daba2?{'count':_0x5a5357,'rows':_0x1daba2}:null;}})[_0xe74f('0x25')](respondWithResult(_0x3b404d,null))[_0xe74f('0x46')](handleError(_0x3b404d,null));};exports[_0xe74f('0x58')]=function(_0x595cb2,_0xbcc9b3,_0x5f2e76){return db[_0xe74f('0x43')][_0xe74f('0x55')]({'where':{'id':_0x595cb2[_0xe74f('0x47')]['id']}})[_0xe74f('0x25')](handleEntityNotFound(_0xbcc9b3,null))[_0xe74f('0x25')](function(_0x639c4d){if(_0x639c4d){return db[_0xe74f('0x59')][_0xe74f('0x5a')](function(_0x53fee1){return db[_0xe74f('0x43')][_0xe74f('0x26')]({'where':{'IntervalId':_0x595cb2[_0xe74f('0x47')]['id']},'transaction':_0x53fee1})[_0xe74f('0x25')](function(_0xae572d){var _0x50cf50=_[_0xe74f('0x2f')](_0x595cb2[_0xe74f('0x4d')],function(_0x61f08e){delete _0x61f08e['id'];_0x61f08e[_0xe74f('0x53')]=_0x595cb2[_0xe74f('0x47')]['id'];return _0x61f08e;});return db[_0xe74f('0x43')][_0xe74f('0x5b')](_0x50cf50,{'transaction':_0x53fee1});});})[_0xe74f('0x25')](function(){return db[_0xe74f('0x43')][_0xe74f('0x45')]({'where':{'IntervalId':_0x595cb2[_0xe74f('0x47')]['id']}});});}})[_0xe74f('0x25')](respondWithResult(_0xbcc9b3,null))[_0xe74f('0x46')](handleError(_0xbcc9b3,null));}; \ No newline at end of file +var _0x9997=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','merge','addIntervals','sequelize','transaction','IntervalId','bulkCreate','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','then','destroy','get','stack','name','send','index','Interval','type','model','map','query'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0x9997,0xd9));var _0x7999=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0x9997[_0x2442b9];return _0x31b571;};'use strict';var emlformat=require(_0x7999('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7999('0x1'));var jsonpatch=require(_0x7999('0x2'));var rp=require(_0x7999('0x3'));var moment=require(_0x7999('0x4'));var BPromise=require(_0x7999('0x5'));var Mustache=require(_0x7999('0x6'));var util=require('util');var path=require(_0x7999('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7999('0x8'));var crypto=require(_0x7999('0x9'));var jsforce=require(_0x7999('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7999('0xb'));var querystring=require(_0x7999('0xc'));var Papa=require(_0x7999('0xd'));var Redis=require(_0x7999('0xe'));var authService=require(_0x7999('0xf'));var qs=require(_0x7999('0x10'));var as=require(_0x7999('0x11'));var hardwareService=require(_0x7999('0x12'));var logger=require('../../config/logger')(_0x7999('0x13'));var utils=require(_0x7999('0x14'));var config=require(_0x7999('0x15'));var licenseUtil=require(_0x7999('0x16'));var db=require(_0x7999('0x17'))['db'];var extensions=require(_0x7999('0x18'));function respondWithStatusCode(_0x318c63,_0x139d82){_0x139d82=_0x139d82||0xcc;return function(_0x196a25){if(_0x196a25){return _0x318c63[_0x7999('0x19')](_0x139d82);}return _0x318c63[_0x7999('0x1a')](_0x139d82)[_0x7999('0x1b')]();};}function respondWithResult(_0x24ea99,_0x3801d4){_0x3801d4=_0x3801d4||0xc8;return function(_0x147d64){if(_0x147d64){return _0x24ea99['status'](_0x3801d4)[_0x7999('0x1c')](_0x147d64);}};}function respondWithFilteredResult(_0x35168e,_0x2c1669){return function(_0x4ab1fb){if(_0x4ab1fb){var _0x400a44=typeof _0x2c1669[_0x7999('0x1d')]===_0x7999('0x1e')&&typeof _0x2c1669[_0x7999('0x1f')]===_0x7999('0x1e');var _0x115cdb=_0x4ab1fb[_0x7999('0x20')];var _0x76f6c9=_0x400a44?0x0:_0x2c1669[_0x7999('0x1d')];var _0x489ba4=_0x400a44?_0x4ab1fb['count']:_0x2c1669[_0x7999('0x1d')]+_0x2c1669['limit'];var _0x44d93d;if(_0x489ba4>=_0x115cdb){_0x489ba4=_0x115cdb;_0x44d93d=0xc8;}else{_0x44d93d=0xce;}_0x35168e[_0x7999('0x1a')](_0x44d93d);return _0x35168e['set']('Content-Range',_0x76f6c9+'-'+_0x489ba4+'/'+_0x115cdb)[_0x7999('0x1c')](_0x4ab1fb);}return null;};}function patchUpdates(_0xded015){return function(_0x5d96af){try{jsonpatch['apply'](_0x5d96af,_0xded015,!![]);}catch(_0x2ceaa9){return BPromise[_0x7999('0x21')](_0x2ceaa9);}return _0x5d96af['save']();};}function saveUpdates(_0x3c7cbc,_0x49ef10){return function(_0xc86bcf){if(_0xc86bcf){return _0xc86bcf[_0x7999('0x22')](_0x3c7cbc)[_0x7999('0x23')](function(_0xc21b97){return _0xc21b97;});}return null;};}function removeEntity(_0x3ff8c1,_0x50c6a0){return function(_0xee5ef){if(_0xee5ef){return _0xee5ef[_0x7999('0x24')]()[_0x7999('0x23')](function(){var _0x1986be=_0xee5ef[_0x7999('0x25')]({'plain':!![]});var _0x346701='Intervals';return db['UserProfileResource'][_0x7999('0x24')]({'where':{'type':_0x346701,'resourceId':_0x1986be['id']}})[_0x7999('0x23')](function(){return _0xee5ef;});})[_0x7999('0x23')](function(){_0x3ff8c1[_0x7999('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1608ea,_0x2d3124){return function(_0x169595){if(!_0x169595){_0x1608ea[_0x7999('0x19')](0x194);}return _0x169595;};}function handleError(_0x1cc391,_0x214687){_0x214687=_0x214687||0x1f4;return function(_0x1ee8b5){logger['error'](_0x1ee8b5[_0x7999('0x26')]);if(_0x1ee8b5[_0x7999('0x27')]){delete _0x1ee8b5[_0x7999('0x27')];}_0x1cc391[_0x7999('0x1a')](_0x214687)[_0x7999('0x28')](_0x1ee8b5);};}exports[_0x7999('0x29')]=function(_0x3dc7ac,_0x5a6e14){var _0x582b59={},_0x4414af={},_0x3185ab={'count':0x0,'rows':[]};var _0x2bddd2=_['map'](db[_0x7999('0x2a')]['rawAttributes'],function(_0x344d26){return{'name':_0x344d26['fieldName'],'type':_0x344d26[_0x7999('0x2b')]['key']};});_0x4414af[_0x7999('0x2c')]=_[_0x7999('0x2d')](_0x2bddd2,_0x7999('0x27'));_0x4414af[_0x7999('0x2e')]=_[_0x7999('0x2f')](_0x3dc7ac['query']);_0x4414af[_0x7999('0x30')]=_[_0x7999('0x31')](_0x4414af[_0x7999('0x2c')],_0x4414af[_0x7999('0x2e')]);_0x582b59[_0x7999('0x32')]=_[_0x7999('0x31')](_0x4414af[_0x7999('0x2c')],qs[_0x7999('0x33')](_0x3dc7ac[_0x7999('0x2e')]['fields']));_0x582b59[_0x7999('0x32')]=_0x582b59['attributes'][_0x7999('0x34')]?_0x582b59[_0x7999('0x32')]:_0x4414af[_0x7999('0x2c')];if(!_0x3dc7ac['query']['hasOwnProperty'](_0x7999('0x35'))){_0x582b59[_0x7999('0x1f')]=qs['limit'](_0x3dc7ac['query'][_0x7999('0x1f')]);_0x582b59['offset']=qs['offset'](_0x3dc7ac[_0x7999('0x2e')][_0x7999('0x1d')]);}_0x582b59[_0x7999('0x36')]=qs[_0x7999('0x37')](_0x3dc7ac['query'][_0x7999('0x37')]);_0x582b59[_0x7999('0x38')]=qs[_0x7999('0x30')](_[_0x7999('0x39')](_0x3dc7ac[_0x7999('0x2e')],_0x4414af['filters']),_0x2bddd2);if(_0x3dc7ac['query'][_0x7999('0x3a')]){_0x582b59['where']=_['merge'](_0x582b59[_0x7999('0x38')],{'$or':_[_0x7999('0x2d')](_0x2bddd2,function(_0x1c4ee1){if(_0x1c4ee1[_0x7999('0x2b')]!==_0x7999('0x3b')){var _0x3e9486={};_0x3e9486[_0x1c4ee1[_0x7999('0x27')]]={'$like':'%'+_0x3dc7ac[_0x7999('0x2e')][_0x7999('0x3a')]+'%'};return _0x3e9486;}})});}_0x582b59=_['merge']({},_0x582b59,_0x3dc7ac[_0x7999('0x3c')]);var _0x432012={'where':_0x582b59[_0x7999('0x38')]};return db[_0x7999('0x2a')][_0x7999('0x20')](_0x432012)[_0x7999('0x23')](function(_0x206fbe){_0x3185ab[_0x7999('0x20')]=_0x206fbe;if(_0x3dc7ac[_0x7999('0x2e')][_0x7999('0x3d')]){_0x582b59[_0x7999('0x3e')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x582b59);})[_0x7999('0x23')](function(_0x4c06d5){_0x3185ab[_0x7999('0x3f')]=_0x4c06d5;return _0x3185ab;})[_0x7999('0x23')](respondWithFilteredResult(_0x5a6e14,_0x582b59))[_0x7999('0x40')](handleError(_0x5a6e14,null));};exports[_0x7999('0x41')]=function(_0x1cfb0f,_0x22a613){var _0x12afa9={'raw':!![],'where':{'id':_0x1cfb0f[_0x7999('0x42')]['id']}},_0x5c2338={};_0x5c2338[_0x7999('0x2c')]=_[_0x7999('0x2f')](db[_0x7999('0x2a')][_0x7999('0x43')]);_0x5c2338['query']=_[_0x7999('0x2f')](_0x1cfb0f[_0x7999('0x2e')]);_0x5c2338[_0x7999('0x30')]=_[_0x7999('0x31')](_0x5c2338[_0x7999('0x2c')],_0x5c2338[_0x7999('0x2e')]);_0x12afa9[_0x7999('0x32')]=_[_0x7999('0x31')](_0x5c2338[_0x7999('0x2c')],qs[_0x7999('0x33')](_0x1cfb0f[_0x7999('0x2e')]['fields']));_0x12afa9['attributes']=_0x12afa9[_0x7999('0x32')][_0x7999('0x34')]?_0x12afa9[_0x7999('0x32')]:_0x5c2338[_0x7999('0x2c')];if(_0x1cfb0f['query'][_0x7999('0x3d')]){_0x12afa9[_0x7999('0x3e')]=[{'all':!![]}];}_0x12afa9=_['merge']({},_0x12afa9,_0x1cfb0f[_0x7999('0x3c')]);return db[_0x7999('0x2a')][_0x7999('0x44')](_0x12afa9)[_0x7999('0x23')](handleEntityNotFound(_0x22a613,null))[_0x7999('0x23')](respondWithResult(_0x22a613,null))['catch'](handleError(_0x22a613,null));};exports[_0x7999('0x45')]=function(_0x3f2470,_0x1d1e3d){return db[_0x7999('0x2a')]['create'](_0x3f2470[_0x7999('0x46')],{})[_0x7999('0x23')](function(_0x5301b4){var _0x3c16e4=_0x3f2470[_0x7999('0x47')]['get']({'plain':!![]});if(!_0x3c16e4)throw new Error(_0x7999('0x48'));if(_0x3c16e4[_0x7999('0x49')]===_0x7999('0x47')){var _0x738c97=_0x5301b4['get']({'plain':!![]});var _0x4b53db=_0x7999('0x4a');return db[_0x7999('0x4b')][_0x7999('0x44')]({'where':{'name':_0x4b53db,'userProfileId':_0x3c16e4['userProfileId']},'raw':!![]})[_0x7999('0x23')](function(_0x56dd20){if(_0x56dd20&&_0x56dd20['autoAssociation']===0x0){return db[_0x7999('0x4c')]['create']({'name':_0x738c97[_0x7999('0x27')],'resourceId':_0x738c97['id'],'type':_0x56dd20[_0x7999('0x27')],'sectionId':_0x56dd20['id']},{})['then'](function(){return _0x5301b4;});}else{return _0x5301b4;}})['catch'](function(_0x249119){logger[_0x7999('0x4d')](_0x7999('0x4e'),_0x249119);throw _0x249119;});}return _0x5301b4;})[_0x7999('0x23')](respondWithResult(_0x1d1e3d,0xc9))[_0x7999('0x40')](handleError(_0x1d1e3d,null));};exports[_0x7999('0x22')]=function(_0xd0aef6,_0x23e238){if(_0xd0aef6[_0x7999('0x46')]['id']){delete _0xd0aef6[_0x7999('0x46')]['id'];}return db[_0x7999('0x2a')][_0x7999('0x44')]({'where':{'id':_0xd0aef6[_0x7999('0x42')]['id']}})[_0x7999('0x23')](handleEntityNotFound(_0x23e238,null))[_0x7999('0x23')](saveUpdates(_0xd0aef6[_0x7999('0x46')],null))[_0x7999('0x23')](respondWithResult(_0x23e238,null))[_0x7999('0x40')](handleError(_0x23e238,null));};exports[_0x7999('0x24')]=function(_0x3e4cbb,_0x4c9d08){return db[_0x7999('0x2a')][_0x7999('0x44')]({'where':{'id':_0x3e4cbb[_0x7999('0x42')]['id']}})[_0x7999('0x23')](handleEntityNotFound(_0x4c9d08,null))[_0x7999('0x23')](removeEntity(_0x4c9d08,null))[_0x7999('0x40')](handleError(_0x4c9d08,null));};exports[_0x7999('0x4f')]=function(_0x43151f,_0x3dd366,_0x145cd8){if(_0x43151f['body']['id']){delete _0x43151f[_0x7999('0x46')]['id'];}return db['Interval'][_0x7999('0x44')]({'where':{'id':_0x43151f[_0x7999('0x42')]['id']}})[_0x7999('0x23')](handleEntityNotFound(_0x3dd366,null))[_0x7999('0x23')](function(_0x2fd0bd){if(_0x2fd0bd){_0x43151f[_0x7999('0x46')]['IntervalId']=_0x2fd0bd['id'];return db[_0x7999('0x2a')][_0x7999('0x45')](_0x43151f[_0x7999('0x46')]);}})['then'](respondWithResult(_0x3dd366,null))[_0x7999('0x40')](handleError(_0x3dd366,null));};exports[_0x7999('0x50')]=function(_0xf72e4e,_0x48b4a9,_0x35a053){var _0x457898={};var _0x4c64f2={};var _0x2fb7f5;var _0x33692e;return db[_0x7999('0x2a')]['findOne']({'where':{'id':_0xf72e4e['params']['id']}})[_0x7999('0x23')](handleEntityNotFound(_0x48b4a9,null))[_0x7999('0x23')](function(_0x43a9ca){if(_0x43a9ca){_0x2fb7f5=_0x43a9ca;_0x4c64f2['model']=_[_0x7999('0x2f')](db[_0x7999('0x2a')][_0x7999('0x43')]);_0x4c64f2[_0x7999('0x2e')]=_[_0x7999('0x2f')](_0xf72e4e[_0x7999('0x2e')]);_0x4c64f2['filters']=_[_0x7999('0x31')](_0x4c64f2['model'],_0x4c64f2[_0x7999('0x2e')]);_0x457898[_0x7999('0x32')]=_[_0x7999('0x31')](_0x4c64f2[_0x7999('0x2c')],qs['fields'](_0xf72e4e['query'][_0x7999('0x33')]));_0x457898[_0x7999('0x32')]=_0x457898[_0x7999('0x32')]['length']?_0x457898[_0x7999('0x32')]:_0x4c64f2[_0x7999('0x2c')];_0x457898[_0x7999('0x36')]=qs[_0x7999('0x37')](_0xf72e4e['query']['sort']);_0x457898[_0x7999('0x38')]=qs[_0x7999('0x30')](_[_0x7999('0x39')](_0xf72e4e[_0x7999('0x2e')],_0x4c64f2['filters']));if(_0xf72e4e['query']['filter']){_0x457898[_0x7999('0x38')]=_['merge'](_0x457898['where'],{'$or':_[_0x7999('0x2d')](_0x457898[_0x7999('0x32')],function(_0x425b5b){var _0x6ec5a3={};_0x6ec5a3[_0x425b5b]={'$like':'%'+_0xf72e4e[_0x7999('0x2e')][_0x7999('0x3a')]+'%'};return _0x6ec5a3;})});}_0x457898=_[_0x7999('0x51')]({},_0x457898,_0xf72e4e['options']);return _0x2fb7f5[_0x7999('0x50')](_0x457898);}})[_0x7999('0x23')](function(_0x277b5c){if(_0x277b5c){_0x33692e=_0x277b5c[_0x7999('0x34')];if(!_0xf72e4e[_0x7999('0x2e')]['hasOwnProperty'](_0x7999('0x35'))){_0x457898[_0x7999('0x1f')]=qs[_0x7999('0x1f')](_0xf72e4e[_0x7999('0x2e')][_0x7999('0x1f')]);_0x457898['offset']=qs[_0x7999('0x1d')](_0xf72e4e[_0x7999('0x2e')][_0x7999('0x1d')]);}return _0x2fb7f5[_0x7999('0x50')](_0x457898);}})[_0x7999('0x23')](function(_0x236124){if(_0x236124){return _0x236124?{'count':_0x33692e,'rows':_0x236124}:null;}})[_0x7999('0x23')](respondWithResult(_0x48b4a9,null))[_0x7999('0x40')](handleError(_0x48b4a9,null));};exports[_0x7999('0x52')]=function(_0x188d42,_0x366dc1,_0x47a769){return db[_0x7999('0x2a')]['findOne']({'where':{'id':_0x188d42[_0x7999('0x42')]['id']}})['then'](handleEntityNotFound(_0x366dc1,null))[_0x7999('0x23')](function(_0x275e01){if(_0x275e01){return db[_0x7999('0x53')][_0x7999('0x54')](function(_0x22d3d8){return db[_0x7999('0x2a')]['destroy']({'where':{'IntervalId':_0x188d42[_0x7999('0x42')]['id']},'transaction':_0x22d3d8})[_0x7999('0x23')](function(_0x133028){var _0x202ac3=_[_0x7999('0x2d')](_0x188d42[_0x7999('0x46')],function(_0x505402){delete _0x505402['id'];_0x505402[_0x7999('0x55')]=_0x188d42[_0x7999('0x42')]['id'];return _0x505402;});return db[_0x7999('0x2a')][_0x7999('0x56')](_0x202ac3,{'transaction':_0x22d3d8});});})[_0x7999('0x23')](function(){return db['Interval'][_0x7999('0x57')]({'where':{'IntervalId':_0x188d42[_0x7999('0x42')]['id']}});});}})[_0x7999('0x23')](respondWithResult(_0x366dc1,null))['catch'](handleError(_0x366dc1,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 5d57343..1bce098 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 _0x4ea0=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./interval.attributes','exports','Interval','tools_intervals','rewrite','lodash'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x4ea0,0x1c7));var _0x04ea=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x4ea0[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x04ea('0x0'));var util=require(_0x04ea('0x1'));var logger=require(_0x04ea('0x2'))('api');var moment=require(_0x04ea('0x3'));var BPromise=require(_0x04ea('0x4'));var rp=require(_0x04ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04ea('0x6'));var config=require('../../config/environment');var attributes=require(_0x04ea('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x04ea('0x8')]=function(_0x552886,_0x55acad){return _0x552886['define'](_0x04ea('0x9'),attributes,{'tableName':_0x04ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x57c90e,_0x18f79e){extensions[_0x04ea('0xb')](_0x552886,_0x57c90e);},'afterBulkCreate':function(_0x172671,_0x3a0d8c,_0x1f6e09){_0x1f6e09();extensions[_0x04ea('0xb')](_0x552886,_0x172671[0x0]);},'afterUpdate':function(_0x5a7ef3,_0x253535){extensions[_0x04ea('0xb')](_0x552886,_0x5a7ef3);},'afterDestroy':function(_0x33acb3,_0x2ff725){extensions[_0x04ea('0xb')](_0x552886,_0x33acb3);}}});}; \ No newline at end of file +var _0xd2fa=['define','Interval','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite'];(function(_0x39e728,_0x165c55){var _0x5484dc=function(_0x10ef5f){while(--_0x10ef5f){_0x39e728['push'](_0x39e728['shift']());}};_0x5484dc(++_0x165c55);}(_0xd2fa,0x161));var _0xad2f=function(_0x564ceb,_0x147ef4){_0x564ceb=_0x564ceb-0x0;var _0x570c27=_0xd2fa[_0x564ceb];return _0x570c27;};'use strict';var _=require(_0xad2f('0x0'));var util=require(_0xad2f('0x1'));var logger=require(_0xad2f('0x2'))(_0xad2f('0x3'));var moment=require(_0xad2f('0x4'));var BPromise=require(_0xad2f('0x5'));var rp=require(_0xad2f('0x6'));var fs=require('fs');var path=require(_0xad2f('0x7'));var rimraf=require(_0xad2f('0x8'));var config=require(_0xad2f('0x9'));var attributes=require('./interval.attributes');var extensions=require(_0xad2f('0xa'));module['exports']=function(_0xc7701d,_0x52f63c){return _0xc7701d[_0xad2f('0xb')](_0xad2f('0xc'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x13e54f,_0x434d98){extensions[_0xad2f('0xd')](_0xc7701d,_0x13e54f);},'afterBulkCreate':function(_0x2640c0,_0x9ce45,_0x48753d){_0x48753d();extensions['rewrite'](_0xc7701d,_0x2640c0[0x0]);},'afterUpdate':function(_0x4ab794,_0x1f7eae){extensions[_0xad2f('0xd')](_0xc7701d,_0x4ab794);},'afterDestroy':function(_0x100f4a,_0x264b96){extensions[_0xad2f('0xd')](_0xc7701d,_0x100f4a);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 6a9523d..48f4d51 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(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_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);});});}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(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index cd14984..a68f0d1 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x561a31,_0x455015){var _0x292b6d=function(_0x2af15b){while(--_0x2af15b){_0x561a31['push'](_0x561a31['shift']());}};_0x292b6d(++_0x455015);}(_0x2032,0xd9));var _0x2203=function(_0xaad130,_0xdfdfd){_0xaad130=_0xaad130-0x0;var _0x46d94a=_0x2032[_0xaad130];return _0x46d94a;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x13c3c7,_0x5279b2){var _0x5260f5=function(_0x33f564){while(--_0x33f564){_0x13c3c7['push'](_0x13c3c7['shift']());}};_0x5260f5(++_0x5279b2);}(_0x2032,0xd9));var _0x2203=function(_0x3af687,_0x1635c7){_0x3af687=_0x3af687-0x0;var _0x404d93=_0x2032[_0x3af687];return _0x404d93;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 5ac5f00..40615a5 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 _0x96e5=['base64','request','utf8','end','status','statusCode','parse','json','api.jira','write','openIssue','body','x-forwarded-for','socket','remoteAddress','connection','bluebird','../../config/logger','support','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x96e5,0x8e));var _0x596e=function(_0x56290c,_0x2725d5){_0x56290c=_0x56290c-0x0;var _0x35d6ac=_0x96e5[_0x56290c];return _0x35d6ac;};'use strict';var BPromise=require(_0x596e('0x0'));var https=require('https');var logger=require(_0x596e('0x1'))('api');var USERNAME=_0x596e('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4e0eb2,_0x55ea67){var _0x86c841={'fields':{'project':{'key':_0x4e0eb2[_0x596e('0x3')]||'MOTGUI'},'summary':(_0x4e0eb2[_0x596e('0x4')]||_0x596e('0x5'))+_0x596e('0x6')+_0x4e0eb2['ip'],'description':_0x4e0eb2[_0x596e('0x7')]||JSON[_0x596e('0x8')](_0x4e0eb2),'issuetype':{'name':_0x4e0eb2[_0x596e('0x9')]||_0x596e('0xa')}}};_0x86c841[_0x596e('0xb')][_0x596e('0xc')]=_0x4e0eb2[_0x596e('0xd')];_0x86c841[_0x596e('0xb')][_0x596e('0xe')]=_0x4e0eb2['oldToken'];_0x86c841[_0x596e('0xb')][_0x596e('0xf')]=_0x4e0eb2[_0x596e('0x10')];_0x86c841['fields'][_0x596e('0x11')]=_0x4e0eb2[_0x596e('0x12')];_0x86c841[_0x596e('0xb')][_0x596e('0x13')]=_0x4e0eb2['reason'];_0x86c841['fields']['customfield_10102']=_0x4e0eb2['ip'];var _0x40beb8={'host':_0x596e('0x14'),'port':0x1bb,'path':_0x596e('0x15'),'method':_0x596e('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x596e('0x17'),'Authorization':_0x596e('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x596e('0x19')](_0x596e('0x1a'))}};var _0x5b8589=JSON[_0x596e('0x8')](_0x86c841);var _0x3b2c0c=https[_0x596e('0x1b')](_0x40beb8,function(_0xc87ae6){_0xc87ae6['setEncoding'](_0x596e('0x1c'));var _0x266289='';_0xc87ae6['on']('data',function(_0x265141){_0x266289+=_0x265141;});_0xc87ae6['on'](_0x596e('0x1d'),function(){if(_0x55ea67){return _0x55ea67[_0x596e('0x1e')](_0xc87ae6[_0x596e('0x1f')])['json'](JSON[_0x596e('0x20')](_0x266289));}});});_0x3b2c0c['on']('error',function(_0x3a29ad){if(_0x55ea67){return _0x55ea67[_0x596e('0x1e')](0x1f4)[_0x596e('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x596e('0x22')}]});}});_0x3b2c0c[_0x596e('0x23')](_0x5b8589);_0x3b2c0c[_0x596e('0x1d')]();}exports[_0x596e('0x24')]=openIssue;exports['send']=function(_0x50c282,_0x3f036c){_0x50c282[_0x596e('0x25')]['ip']=_0x50c282['headers'][_0x596e('0x26')]||_0x50c282['connection']['remoteAddress']||_0x50c282[_0x596e('0x27')][_0x596e('0x28')]||_0x50c282[_0x596e('0x29')]['socket'][_0x596e('0x28')];return openIssue(_0x50c282[_0x596e('0x25')],_0x3f036c);}; \ No newline at end of file +var _0x91b6=['utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','MOTGUI','summary','Report','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','base64','request','setEncoding'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x91b6,0xcd));var _0x691b=function(_0x2a22b9,_0x1641f2){_0x2a22b9=_0x2a22b9-0x0;var _0x19a2e9=_0x91b6[_0x2a22b9];return _0x19a2e9;};'use strict';var BPromise=require(_0x691b('0x0'));var https=require(_0x691b('0x1'));var logger=require(_0x691b('0x2'))('api');var USERNAME=_0x691b('0x3');var PASSWORD=_0x691b('0x4');function openIssue(_0x328efd,_0x19cffb){var _0x59e204={'fields':{'project':{'key':_0x328efd['key']||_0x691b('0x5')},'summary':(_0x328efd[_0x691b('0x6')]||_0x691b('0x7'))+'\x20from\x20'+_0x328efd['ip'],'description':_0x328efd[_0x691b('0x8')]||JSON[_0x691b('0x9')](_0x328efd),'issuetype':{'name':_0x328efd[_0x691b('0xa')]||_0x691b('0xb')}}};_0x59e204['fields'][_0x691b('0xc')]=_0x328efd[_0x691b('0xd')];_0x59e204[_0x691b('0xe')][_0x691b('0xf')]=_0x328efd[_0x691b('0x10')];_0x59e204[_0x691b('0xe')]['customfield_11502']=_0x328efd[_0x691b('0x11')];_0x59e204['fields'][_0x691b('0x12')]=_0x328efd[_0x691b('0x13')];_0x59e204[_0x691b('0xe')][_0x691b('0x14')]=_0x328efd[_0x691b('0x15')];_0x59e204[_0x691b('0xe')][_0x691b('0x16')]=_0x328efd['ip'];var _0x3b881d={'host':_0x691b('0x17'),'port':0x1bb,'path':_0x691b('0x18'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x691b('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x691b('0x1a')](_0x691b('0x1b'))}};var _0x7d8d2b=JSON[_0x691b('0x9')](_0x59e204);var _0x19aba0=https[_0x691b('0x1c')](_0x3b881d,function(_0x188f73){_0x188f73[_0x691b('0x1d')](_0x691b('0x1e'));var _0x174abd='';_0x188f73['on'](_0x691b('0x1f'),function(_0x4db557){_0x174abd+=_0x4db557;});_0x188f73['on'](_0x691b('0x20'),function(){if(_0x19cffb){return _0x19cffb[_0x691b('0x21')](_0x188f73['statusCode'])[_0x691b('0x22')](JSON[_0x691b('0x23')](_0x174abd));}});});_0x19aba0['on'](_0x691b('0x24'),function(_0x520bfd){if(_0x19cffb){return _0x19cffb[_0x691b('0x21')](0x1f4)[_0x691b('0x22')]({'errors':[{'message':_0x691b('0x25'),'type':_0x691b('0x26')}]});}});_0x19aba0[_0x691b('0x27')](_0x7d8d2b);_0x19aba0[_0x691b('0x20')]();}exports[_0x691b('0x28')]=openIssue;exports['send']=function(_0x536679,_0x53eaf7){_0x536679[_0x691b('0x29')]['ip']=_0x536679[_0x691b('0x2a')][_0x691b('0x2b')]||_0x536679[_0x691b('0x2c')][_0x691b('0x2d')]||_0x536679[_0x691b('0x2e')]['remoteAddress']||_0x536679[_0x691b('0x2c')]['socket'][_0x691b('0x2d')];return openIssue(_0x536679[_0x691b('0x29')],_0x53eaf7);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a27d33f..ac84741 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 _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x17ba,0xab));var _0xa17b=function(_0x3a8559,_0xce5e7e){_0x3a8559=_0x3a8559-0x0;var _0x24d0b6=_0x17ba[_0x3a8559];return _0x24d0b6;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file +var _0xb821=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','Router','../../components/interaction/service'];(function(_0x2ce5fe,_0x38feed){var _0x32ab52=function(_0x434666){while(--_0x434666){_0x2ce5fe['push'](_0x2ce5fe['shift']());}};_0x32ab52(++_0x38feed);}(_0xb821,0xa7));var _0x1b82=function(_0x27459c,_0x59a578){_0x27459c=_0x27459c-0x0;var _0x358a23=_0xb821[_0x27459c];return _0x358a23;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x6')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router['post']('/',auth[_0x1b82('0x9')](),controller[_0x1b82('0xd')]);router[_0x1b82('0xe')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xf')]);router[_0x1b82('0x10')](_0x1b82('0xb'),auth['isAuthenticated'](),controller[_0x1b82('0x11')]);module[_0x1b82('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 0d74820..fae2659 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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x2fbfe5,_0x4762cf){_0x2fbfe5=_0x2fbfe5-0x0;var _0x7ccc1e=_0x7a54[_0x2fbfe5];return _0x7ccc1e;};'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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x187f9c,_0x237814){_0x187f9c=_0x187f9c-0x0;var _0x57ad08=_0x7a54[_0x187f9c];return _0x57ad08;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index e0c10bf..2fca1e1 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 _0x31c2=['then','destroy','error','name','send','index','map','JscriptyAnswerReport','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update'];(function(_0x58c053,_0x51c43f){var _0xe1079=function(_0x172345){while(--_0x172345){_0x58c053['push'](_0x58c053['shift']());}};_0xe1079(++_0x51c43f);}(_0x31c2,0x1e1));var _0x231c=function(_0x256d50,_0x2bbab7){_0x256d50=_0x256d50-0x0;var _0x142cff=_0x31c2[_0x256d50];return _0x142cff;};'use strict';var emlformat=require(_0x231c('0x0'));var rimraf=require(_0x231c('0x1'));var zipdir=require(_0x231c('0x2'));var jsonpatch=require(_0x231c('0x3'));var rp=require(_0x231c('0x4'));var moment=require(_0x231c('0x5'));var BPromise=require(_0x231c('0x6'));var Mustache=require(_0x231c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x231c('0x8'));var csv=require(_0x231c('0x9'));var ejs=require(_0x231c('0xa'));var fs=require('fs');var fs_extra=require(_0x231c('0xb'));var _=require('lodash');var squel=require(_0x231c('0xc'));var crypto=require('crypto');var jsforce=require(_0x231c('0xd'));var deskjs=require(_0x231c('0xe'));var toCsv=require(_0x231c('0x9'));var querystring=require('querystring');var Papa=require(_0x231c('0xf'));var Redis=require(_0x231c('0x10'));var authService=require(_0x231c('0x11'));var qs=require(_0x231c('0x12'));var as=require(_0x231c('0x13'));var hardwareService=require(_0x231c('0x14'));var logger=require(_0x231c('0x15'))('api');var utils=require(_0x231c('0x16'));var config=require(_0x231c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x231c('0x18'))['db'];function respondWithStatusCode(_0x43c270,_0x871ed1){_0x871ed1=_0x871ed1||0xcc;return function(_0x1aa3fe){if(_0x1aa3fe){return _0x43c270[_0x231c('0x19')](_0x871ed1);}return _0x43c270[_0x231c('0x1a')](_0x871ed1)[_0x231c('0x1b')]();};}function respondWithResult(_0x3355f6,_0xc09de5){_0xc09de5=_0xc09de5||0xc8;return function(_0x311218){if(_0x311218){return _0x3355f6[_0x231c('0x1a')](_0xc09de5)[_0x231c('0x1c')](_0x311218);}};}function respondWithFilteredResult(_0xe37de8,_0x1f7764){return function(_0x12a6ad){if(_0x12a6ad){var _0x210f2e=typeof _0x1f7764[_0x231c('0x1d')]===_0x231c('0x1e')&&typeof _0x1f7764[_0x231c('0x1f')]===_0x231c('0x1e');var _0x51b8ca=_0x12a6ad[_0x231c('0x20')];var _0x341645=_0x210f2e?0x0:_0x1f7764[_0x231c('0x1d')];var _0xadea80=_0x210f2e?_0x12a6ad[_0x231c('0x20')]:_0x1f7764[_0x231c('0x1d')]+_0x1f7764[_0x231c('0x1f')];var _0x172d50;if(_0xadea80>=_0x51b8ca){_0xadea80=_0x51b8ca;_0x172d50=0xc8;}else{_0x172d50=0xce;}_0xe37de8[_0x231c('0x1a')](_0x172d50);return _0xe37de8[_0x231c('0x21')]('Content-Range',_0x341645+'-'+_0xadea80+'/'+_0x51b8ca)[_0x231c('0x1c')](_0x12a6ad);}return null;};}function patchUpdates(_0x5e8a53){return function(_0x872034){try{jsonpatch['apply'](_0x872034,_0x5e8a53,!![]);}catch(_0x42cca3){return BPromise[_0x231c('0x22')](_0x42cca3);}return _0x872034[_0x231c('0x23')]();};}function saveUpdates(_0x3267f9,_0x255671){return function(_0x309393){if(_0x309393){return _0x309393[_0x231c('0x24')](_0x3267f9)[_0x231c('0x25')](function(_0x54566f){return _0x54566f;});}return null;};}function removeEntity(_0x128112,_0x3336d8){return function(_0x4af49b){if(_0x4af49b){return _0x4af49b[_0x231c('0x26')]()[_0x231c('0x25')](function(){_0x128112['status'](0xcc)[_0x231c('0x1b')]();});}};}function handleEntityNotFound(_0x564939,_0x3ea0cd){return function(_0x454f70){if(!_0x454f70){_0x564939[_0x231c('0x19')](0x194);}return _0x454f70;};}function handleError(_0x2a673c,_0x449d74){_0x449d74=_0x449d74||0x1f4;return function(_0x131cfd){logger[_0x231c('0x27')](_0x131cfd['stack']);if(_0x131cfd[_0x231c('0x28')]){delete _0x131cfd[_0x231c('0x28')];}_0x2a673c['status'](_0x449d74)[_0x231c('0x29')](_0x131cfd);};}exports[_0x231c('0x2a')]=function(_0x45ced8,_0xeeddfc){var _0x271635={},_0x15a9bb={},_0x40f76e={'count':0x0,'rows':[]};var _0x4dfaa3=_[_0x231c('0x2b')](db[_0x231c('0x2c')]['rawAttributes'],function(_0x4be2e2){return{'name':_0x4be2e2['fieldName'],'type':_0x4be2e2[_0x231c('0x2d')]['key']};});_0x15a9bb[_0x231c('0x2e')]=_['map'](_0x4dfaa3,_0x231c('0x28'));_0x15a9bb[_0x231c('0x2f')]=_[_0x231c('0x30')](_0x45ced8[_0x231c('0x2f')]);_0x15a9bb['filters']=_[_0x231c('0x31')](_0x15a9bb[_0x231c('0x2e')],_0x15a9bb[_0x231c('0x2f')]);_0x271635[_0x231c('0x32')]=_[_0x231c('0x31')](_0x15a9bb[_0x231c('0x2e')],qs[_0x231c('0x33')](_0x45ced8[_0x231c('0x2f')]['fields']));_0x271635['attributes']=_0x271635[_0x231c('0x32')][_0x231c('0x34')]?_0x271635[_0x231c('0x32')]:_0x15a9bb[_0x231c('0x2e')];if(!_0x45ced8[_0x231c('0x2f')][_0x231c('0x35')]('nolimit')){_0x271635[_0x231c('0x1f')]=qs[_0x231c('0x1f')](_0x45ced8['query']['limit']);_0x271635[_0x231c('0x1d')]=qs['offset'](_0x45ced8[_0x231c('0x2f')]['offset']);}_0x271635[_0x231c('0x36')]=qs[_0x231c('0x37')](_0x45ced8['query'][_0x231c('0x37')]);_0x271635[_0x231c('0x38')]=qs[_0x231c('0x39')](_['pick'](_0x45ced8[_0x231c('0x2f')],_0x15a9bb[_0x231c('0x39')]),_0x4dfaa3);if(_0x45ced8[_0x231c('0x2f')][_0x231c('0x3a')]){_0x271635[_0x231c('0x38')]=_[_0x231c('0x3b')](_0x271635[_0x231c('0x38')],{'$or':_[_0x231c('0x2b')](_0x4dfaa3,function(_0x409b01){if(_0x409b01[_0x231c('0x2d')]!==_0x231c('0x3c')){var _0x2c8033={};_0x2c8033[_0x409b01[_0x231c('0x28')]]={'$like':'%'+_0x45ced8['query'][_0x231c('0x3a')]+'%'};return _0x2c8033;}})});}_0x271635=_[_0x231c('0x3b')]({},_0x271635,_0x45ced8[_0x231c('0x3d')]);var _0x2f763d={'where':_0x271635[_0x231c('0x38')]};return db['JscriptyAnswerReport'][_0x231c('0x20')](_0x2f763d)[_0x231c('0x25')](function(_0x229953){_0x40f76e['count']=_0x229953;if(_0x45ced8[_0x231c('0x2f')][_0x231c('0x3e')]){_0x271635[_0x231c('0x3f')]=[{'all':!![]}];}return db[_0x231c('0x2c')][_0x231c('0x40')](_0x271635);})[_0x231c('0x25')](function(_0x5d46eb){_0x40f76e[_0x231c('0x41')]=_0x5d46eb;return _0x40f76e;})[_0x231c('0x25')](respondWithFilteredResult(_0xeeddfc,_0x271635))[_0x231c('0x42')](handleError(_0xeeddfc,null));};exports[_0x231c('0x43')]=function(_0x518011,_0x33396b){var _0x523339={'raw':!![],'where':{'id':_0x518011['params']['id']}},_0x26bfd2={};_0x26bfd2[_0x231c('0x2e')]=_[_0x231c('0x30')](db[_0x231c('0x2c')][_0x231c('0x44')]);_0x26bfd2[_0x231c('0x2f')]=_[_0x231c('0x30')](_0x518011['query']);_0x26bfd2[_0x231c('0x39')]=_[_0x231c('0x31')](_0x26bfd2[_0x231c('0x2e')],_0x26bfd2['query']);_0x523339[_0x231c('0x32')]=_[_0x231c('0x31')](_0x26bfd2[_0x231c('0x2e')],qs[_0x231c('0x33')](_0x518011['query'][_0x231c('0x33')]));_0x523339['attributes']=_0x523339[_0x231c('0x32')][_0x231c('0x34')]?_0x523339[_0x231c('0x32')]:_0x26bfd2[_0x231c('0x2e')];if(_0x518011[_0x231c('0x2f')][_0x231c('0x3e')]){_0x523339[_0x231c('0x3f')]=[{'all':!![]}];}_0x523339=_[_0x231c('0x3b')]({},_0x523339,_0x518011[_0x231c('0x3d')]);return db[_0x231c('0x2c')][_0x231c('0x45')](_0x523339)[_0x231c('0x25')](handleEntityNotFound(_0x33396b,null))[_0x231c('0x25')](respondWithResult(_0x33396b,null))[_0x231c('0x42')](handleError(_0x33396b,null));};exports['create']=function(_0x18aaca,_0x293de2){return db[_0x231c('0x2c')][_0x231c('0x46')](_0x18aaca[_0x231c('0x47')],{})['then'](respondWithResult(_0x293de2,0xc9))['catch'](handleError(_0x293de2,null));};exports[_0x231c('0x24')]=function(_0x56a885,_0x419f63){if(_0x56a885[_0x231c('0x47')]['id']){delete _0x56a885[_0x231c('0x47')]['id'];}return db['JscriptyAnswerReport'][_0x231c('0x45')]({'where':{'id':_0x56a885['params']['id']}})[_0x231c('0x25')](handleEntityNotFound(_0x419f63,null))[_0x231c('0x25')](saveUpdates(_0x56a885['body'],null))[_0x231c('0x25')](respondWithResult(_0x419f63,null))[_0x231c('0x42')](handleError(_0x419f63,null));};exports[_0x231c('0x26')]=function(_0x5d2d20,_0x49baac){return db['JscriptyAnswerReport'][_0x231c('0x45')]({'where':{'id':_0x5d2d20[_0x231c('0x48')]['id']}})[_0x231c('0x25')](handleEntityNotFound(_0x49baac,null))['then'](removeEntity(_0x49baac,null))[_0x231c('0x42')](handleError(_0x49baac,null));};exports[_0x231c('0x49')]=function(_0x4fd60b,_0xf225d0){return db[_0x231c('0x2c')][_0x231c('0x49')]()[_0x231c('0x25')](respondWithResult(_0xf225d0,null))[_0x231c('0x42')](handleError(_0xf225d0,null));}; \ No newline at end of file +var _0x4813=['offset','limit','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','show','params','keys','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x4813,0x14e));var _0x3481=function(_0x5f04e9,_0x1ddbf6){_0x5f04e9=_0x5f04e9-0x0;var _0x362b59=_0x4813[_0x5f04e9];return _0x362b59;};'use strict';var emlformat=require(_0x3481('0x0'));var rimraf=require(_0x3481('0x1'));var zipdir=require(_0x3481('0x2'));var jsonpatch=require(_0x3481('0x3'));var rp=require(_0x3481('0x4'));var moment=require(_0x3481('0x5'));var BPromise=require(_0x3481('0x6'));var Mustache=require('mustache');var util=require(_0x3481('0x7'));var path=require(_0x3481('0x8'));var sox=require(_0x3481('0x9'));var csv=require(_0x3481('0xa'));var ejs=require(_0x3481('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3481('0xc'));var crypto=require('crypto');var jsforce=require(_0x3481('0xd'));var deskjs=require(_0x3481('0xe'));var toCsv=require(_0x3481('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3481('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3481('0x10'));var logger=require(_0x3481('0x11'))(_0x3481('0x12'));var utils=require(_0x3481('0x13'));var config=require(_0x3481('0x14'));var licenseUtil=require(_0x3481('0x15'));var db=require(_0x3481('0x16'))['db'];function respondWithStatusCode(_0x3f1376,_0x37cc2b){_0x37cc2b=_0x37cc2b||0xcc;return function(_0x22b89b){if(_0x22b89b){return _0x3f1376[_0x3481('0x17')](_0x37cc2b);}return _0x3f1376[_0x3481('0x18')](_0x37cc2b)['end']();};}function respondWithResult(_0x16358e,_0xb77c75){_0xb77c75=_0xb77c75||0xc8;return function(_0x1bcfad){if(_0x1bcfad){return _0x16358e[_0x3481('0x18')](_0xb77c75)[_0x3481('0x19')](_0x1bcfad);}};}function respondWithFilteredResult(_0x39e581,_0x4a1d09){return function(_0x1bb126){if(_0x1bb126){var _0x41c2aa=typeof _0x4a1d09['offset']==='undefined'&&typeof _0x4a1d09['limit']==='undefined';var _0x4f5d1b=_0x1bb126['count'];var _0x32a315=_0x41c2aa?0x0:_0x4a1d09[_0x3481('0x1a')];var _0x5a8e65=_0x41c2aa?_0x1bb126['count']:_0x4a1d09[_0x3481('0x1a')]+_0x4a1d09[_0x3481('0x1b')];var _0x3b43dc;if(_0x5a8e65>=_0x4f5d1b){_0x5a8e65=_0x4f5d1b;_0x3b43dc=0xc8;}else{_0x3b43dc=0xce;}_0x39e581['status'](_0x3b43dc);return _0x39e581['set'](_0x3481('0x1c'),_0x32a315+'-'+_0x5a8e65+'/'+_0x4f5d1b)[_0x3481('0x19')](_0x1bb126);}return null;};}function patchUpdates(_0x1e0aa0){return function(_0x1ba743){try{jsonpatch[_0x3481('0x1d')](_0x1ba743,_0x1e0aa0,!![]);}catch(_0x4469d4){return BPromise['reject'](_0x4469d4);}return _0x1ba743[_0x3481('0x1e')]();};}function saveUpdates(_0x3cdb98,_0x162305){return function(_0xea1072){if(_0xea1072){return _0xea1072['update'](_0x3cdb98)[_0x3481('0x1f')](function(_0x48eb64){return _0x48eb64;});}return null;};}function removeEntity(_0x2185ba,_0x33c6fa){return function(_0x418a7d){if(_0x418a7d){return _0x418a7d[_0x3481('0x20')]()['then'](function(){_0x2185ba['status'](0xcc)[_0x3481('0x21')]();});}};}function handleEntityNotFound(_0x3e5963,_0x249754){return function(_0x405816){if(!_0x405816){_0x3e5963['sendStatus'](0x194);}return _0x405816;};}function handleError(_0x2e837a,_0x6ce3f3){_0x6ce3f3=_0x6ce3f3||0x1f4;return function(_0x1181e1){logger[_0x3481('0x22')](_0x1181e1[_0x3481('0x23')]);if(_0x1181e1[_0x3481('0x24')]){delete _0x1181e1[_0x3481('0x24')];}_0x2e837a[_0x3481('0x18')](_0x6ce3f3)[_0x3481('0x25')](_0x1181e1);};}exports[_0x3481('0x26')]=function(_0x4a20d5,_0x131363){var _0x4a8492={},_0xdcacba={},_0x1f079a={'count':0x0,'rows':[]};var _0x2864f1=_['map'](db[_0x3481('0x27')][_0x3481('0x28')],function(_0x2df894){return{'name':_0x2df894[_0x3481('0x29')],'type':_0x2df894[_0x3481('0x2a')]['key']};});_0xdcacba[_0x3481('0x2b')]=_[_0x3481('0x2c')](_0x2864f1,_0x3481('0x24'));_0xdcacba[_0x3481('0x2d')]=_['keys'](_0x4a20d5[_0x3481('0x2d')]);_0xdcacba[_0x3481('0x2e')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],_0xdcacba[_0x3481('0x2d')]);_0x4a8492[_0x3481('0x30')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],qs['fields'](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x31')]));_0x4a8492[_0x3481('0x30')]=_0x4a8492['attributes'][_0x3481('0x32')]?_0x4a8492['attributes']:_0xdcacba[_0x3481('0x2b')];if(!_0x4a20d5['query'][_0x3481('0x33')]('nolimit')){_0x4a8492[_0x3481('0x1b')]=qs[_0x3481('0x1b')](_0x4a20d5[_0x3481('0x2d')]['limit']);_0x4a8492[_0x3481('0x1a')]=qs['offset'](_0x4a20d5[_0x3481('0x2d')]['offset']);}_0x4a8492[_0x3481('0x34')]=qs[_0x3481('0x35')](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x35')]);_0x4a8492[_0x3481('0x36')]=qs[_0x3481('0x2e')](_[_0x3481('0x37')](_0x4a20d5[_0x3481('0x2d')],_0xdcacba[_0x3481('0x2e')]),_0x2864f1);if(_0x4a20d5['query'][_0x3481('0x38')]){_0x4a8492['where']=_[_0x3481('0x39')](_0x4a8492[_0x3481('0x36')],{'$or':_[_0x3481('0x2c')](_0x2864f1,function(_0x40fd6f){if(_0x40fd6f['type']!=='VIRTUAL'){var _0x2207fb={};_0x2207fb[_0x40fd6f[_0x3481('0x24')]]={'$like':'%'+_0x4a20d5[_0x3481('0x2d')][_0x3481('0x38')]+'%'};return _0x2207fb;}})});}_0x4a8492=_['merge']({},_0x4a8492,_0x4a20d5[_0x3481('0x3a')]);var _0x3c7874={'where':_0x4a8492[_0x3481('0x36')]};return db[_0x3481('0x27')][_0x3481('0x3b')](_0x3c7874)[_0x3481('0x1f')](function(_0x33c33f){_0x1f079a['count']=_0x33c33f;if(_0x4a20d5[_0x3481('0x2d')][_0x3481('0x3c')]){_0x4a8492[_0x3481('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4a8492);})[_0x3481('0x1f')](function(_0x420b8c){_0x1f079a[_0x3481('0x3e')]=_0x420b8c;return _0x1f079a;})['then'](respondWithFilteredResult(_0x131363,_0x4a8492))['catch'](handleError(_0x131363,null));};exports[_0x3481('0x3f')]=function(_0x335292,_0x3fc0e7){var _0xbccc9e={'raw':!![],'where':{'id':_0x335292[_0x3481('0x40')]['id']}},_0x5c4928={};_0x5c4928['model']=_[_0x3481('0x41')](db[_0x3481('0x27')][_0x3481('0x28')]);_0x5c4928[_0x3481('0x2d')]=_['keys'](_0x335292['query']);_0x5c4928['filters']=_['intersection'](_0x5c4928[_0x3481('0x2b')],_0x5c4928[_0x3481('0x2d')]);_0xbccc9e[_0x3481('0x30')]=_[_0x3481('0x2f')](_0x5c4928[_0x3481('0x2b')],qs[_0x3481('0x31')](_0x335292[_0x3481('0x2d')][_0x3481('0x31')]));_0xbccc9e[_0x3481('0x30')]=_0xbccc9e[_0x3481('0x30')][_0x3481('0x32')]?_0xbccc9e['attributes']:_0x5c4928['model'];if(_0x335292[_0x3481('0x2d')][_0x3481('0x3c')]){_0xbccc9e[_0x3481('0x3d')]=[{'all':!![]}];}_0xbccc9e=_[_0x3481('0x39')]({},_0xbccc9e,_0x335292['options']);return db[_0x3481('0x27')]['find'](_0xbccc9e)[_0x3481('0x1f')](handleEntityNotFound(_0x3fc0e7,null))[_0x3481('0x1f')](respondWithResult(_0x3fc0e7,null))[_0x3481('0x42')](handleError(_0x3fc0e7,null));};exports[_0x3481('0x43')]=function(_0x30f54e,_0x50dd72){return db[_0x3481('0x27')]['create'](_0x30f54e[_0x3481('0x44')],{})[_0x3481('0x1f')](respondWithResult(_0x50dd72,0xc9))['catch'](handleError(_0x50dd72,null));};exports[_0x3481('0x45')]=function(_0x54ec34,_0x27e106){if(_0x54ec34[_0x3481('0x44')]['id']){delete _0x54ec34[_0x3481('0x44')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x54ec34[_0x3481('0x40')]['id']}})[_0x3481('0x1f')](handleEntityNotFound(_0x27e106,null))[_0x3481('0x1f')](saveUpdates(_0x54ec34[_0x3481('0x44')],null))['then'](respondWithResult(_0x27e106,null))[_0x3481('0x42')](handleError(_0x27e106,null));};exports[_0x3481('0x20')]=function(_0xdd5422,_0x4b7598){return db['JscriptyAnswerReport'][_0x3481('0x46')]({'where':{'id':_0xdd5422[_0x3481('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b7598,null))[_0x3481('0x1f')](removeEntity(_0x4b7598,null))[_0x3481('0x42')](handleError(_0x4b7598,null));};exports[_0x3481('0x47')]=function(_0x222b83,_0x403ba9){return db['JscriptyAnswerReport'][_0x3481('0x47')]()[_0x3481('0x1f')](respondWithResult(_0x403ba9,null))[_0x3481('0x42')](handleError(_0x403ba9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ae4018d..1c5b9da 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 _0x1db1=['JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x3b71ba,_0x2688b1){var _0x3d1dcd=function(_0x5abc39){while(--_0x5abc39){_0x3b71ba['push'](_0x3b71ba['shift']());}};_0x3d1dcd(++_0x2688b1);}(_0x1db1,0xb7));var _0x11db=function(_0x382054,_0x1e8303){_0x382054=_0x382054-0x0;var _0x46a268=_0x1db1[_0x382054];return _0x46a268;};'use strict';var _=require(_0x11db('0x0'));var util=require(_0x11db('0x1'));var logger=require(_0x11db('0x2'))(_0x11db('0x3'));var moment=require(_0x11db('0x4'));var BPromise=require(_0x11db('0x5'));var rp=require(_0x11db('0x6'));var fs=require('fs');var path=require(_0x11db('0x7'));var rimraf=require('rimraf');var config=require(_0x11db('0x8'));var attributes=require(_0x11db('0x9'));module[_0x11db('0xa')]=function(_0x5033c0,_0x234b61){return _0x5033c0[_0x11db('0xb')](_0x11db('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b7d=['request-promise','path','rimraf','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment'];(function(_0x56d1b7,_0x1d88f5){var _0x184d91=function(_0x123bdb){while(--_0x123bdb){_0x56d1b7['push'](_0x56d1b7['shift']());}};_0x184d91(++_0x1d88f5);}(_0x3b7d,0x92));var _0xd3b7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3b7d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd3b7('0x0'));var util=require(_0xd3b7('0x1'));var logger=require('../../config/logger')(_0xd3b7('0x2'));var moment=require(_0xd3b7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd3b7('0x4'));var fs=require('fs');var path=require(_0xd3b7('0x5'));var rimraf=require(_0xd3b7('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x4a92db,_0x56b10b){return _0x4a92db[_0xd3b7('0x7')](_0xd3b7('0x8'),attributes,{'tableName':_0xd3b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index b76c3ac..6fdd4f9 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 _0x28fc=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x370672,_0x40c185){var _0x30df5a=function(_0x4d01be){while(--_0x4d01be){_0x370672['push'](_0x370672['shift']());}};_0x30df5a(++_0x40c185);}(_0x28fc,0x19e));var _0xc28f=function(_0x21a2b2,_0x22ba1e){_0x21a2b2=_0x21a2b2-0x0;var _0x2060b4=_0x28fc[_0x21a2b2];return _0x2060b4;};'use strict';var _=require(_0xc28f('0x0'));var util=require(_0xc28f('0x1'));var moment=require(_0xc28f('0x2'));var BPromise=require('bluebird');var rs=require(_0xc28f('0x3'));var fs=require('fs');var Redis=require(_0xc28f('0x4'));var db=require(_0xc28f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc28f('0x6'))(_0xc28f('0x7'));var config=require(_0xc28f('0x8'));var jayson=require(_0xc28f('0x9'));var client=jayson[_0xc28f('0xa')][_0xc28f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x461519,_0x1441fd,_0x15a33e){return new BPromise(function(_0x479f84,_0x55de25){return client[_0xc28f('0xc')](_0x461519,_0x15a33e)[_0xc28f('0xd')](function(_0x46f22e){logger[_0xc28f('0xe')](_0xc28f('0xf'),_0x1441fd,_0xc28f('0x10'));logger[_0xc28f('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x1441fd,'request\x20sent',JSON[_0xc28f('0x12')](_0x46f22e));if(_0x46f22e['error']){if(_0x46f22e[_0xc28f('0x13')]['code']===0x1f4){logger[_0xc28f('0x13')](_0xc28f('0xf'),_0x1441fd,_0x46f22e['error'][_0xc28f('0x14')]);return _0x55de25(_0x46f22e[_0xc28f('0x13')][_0xc28f('0x14')]);}logger[_0xc28f('0x13')](_0xc28f('0xf'),_0x1441fd,_0x46f22e[_0xc28f('0x13')]['message']);return _0x479f84(_0x46f22e[_0xc28f('0x13')][_0xc28f('0x14')]);}else{logger[_0xc28f('0xe')](_0xc28f('0xf'),_0x1441fd,_0xc28f('0x10'));_0x479f84(_0x46f22e[_0xc28f('0x15')][_0xc28f('0x14')]);}})[_0xc28f('0x16')](function(_0x46801d){logger[_0xc28f('0x13')](_0xc28f('0xf'),_0x1441fd,_0x46801d);_0x55de25(_0x46801d);});});} \ No newline at end of file +var _0x25f0=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message'];(function(_0x4911ed,_0x476941){var _0x230288=function(_0xcaa9c0){while(--_0xcaa9c0){_0x4911ed['push'](_0x4911ed['shift']());}};_0x230288(++_0x476941);}(_0x25f0,0xc8));var _0x025f=function(_0x1f7f0a,_0x3cd7fe){_0x1f7f0a=_0x1f7f0a-0x0;var _0x2dc727=_0x25f0[_0x1f7f0a];return _0x2dc727;};'use strict';var _=require(_0x025f('0x0'));var util=require(_0x025f('0x1'));var moment=require('moment');var BPromise=require(_0x025f('0x2'));var rs=require(_0x025f('0x3'));var fs=require('fs');var Redis=require(_0x025f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x025f('0x5'));var logger=require(_0x025f('0x6'))(_0x025f('0x7'));var config=require('../../config/environment');var jayson=require(_0x025f('0x8'));var client=jayson[_0x025f('0x9')][_0x025f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dc0cb,_0x4d1a27,_0x41a3b3){return new BPromise(function(_0x65b2e2,_0x241e79){return client[_0x025f('0xb')](_0x5dc0cb,_0x41a3b3)[_0x025f('0xc')](function(_0x4046e1){logger[_0x025f('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4d1a27,_0x025f('0xe'));logger[_0x025f('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4d1a27,_0x025f('0xe'),JSON['stringify'](_0x4046e1));if(_0x4046e1[_0x025f('0x10')]){if(_0x4046e1['error'][_0x025f('0x11')]===0x1f4){logger[_0x025f('0x10')](_0x025f('0x12'),_0x4d1a27,_0x4046e1[_0x025f('0x10')][_0x025f('0x13')]);return _0x241e79(_0x4046e1['error'][_0x025f('0x13')]);}logger[_0x025f('0x10')](_0x025f('0x12'),_0x4d1a27,_0x4046e1['error'][_0x025f('0x13')]);return _0x65b2e2(_0x4046e1[_0x025f('0x10')][_0x025f('0x13')]);}else{logger[_0x025f('0xd')](_0x025f('0x12'),_0x4d1a27,_0x025f('0xe'));_0x65b2e2(_0x4046e1[_0x025f('0x14')]['message']);}})[_0x025f('0x15')](function(_0x4ef2b1){logger[_0x025f('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4d1a27,_0x4ef2b1);_0x241e79(_0x4ef2b1);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ca63be8..75d98e4 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 _0xdf61=['/:id/answers','/:id/summary','getSummary','post','clone','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/sessions','getSessions'];(function(_0x8313b1,_0x474f2c){var _0x499819=function(_0x5c3219){while(--_0x5c3219){_0x8313b1['push'](_0x8313b1['shift']());}};_0x499819(++_0x474f2c);}(_0xdf61,0x6a));var _0x1df6=function(_0x17a93e,_0x210741){_0x17a93e=_0x17a93e-0x0;var _0x2cf187=_0xdf61[_0x17a93e];return _0x2cf187;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1df6('0x0'));var timeout=require(_0x1df6('0x1'));var express=require(_0x1df6('0x2'));var router=express[_0x1df6('0x3')]();var fs_extra=require(_0x1df6('0x4'));var auth=require(_0x1df6('0x5'));var interaction=require(_0x1df6('0x6'));var config=require(_0x1df6('0x7'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x1df6('0x8')](),controller[_0x1df6('0x9')]);router[_0x1df6('0xa')](_0x1df6('0xb'),auth[_0x1df6('0x8')](),controller['show']);router[_0x1df6('0xa')](_0x1df6('0xc'),auth[_0x1df6('0x8')](),controller[_0x1df6('0xd')]);router[_0x1df6('0xa')](_0x1df6('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x1df6('0xf'),auth[_0x1df6('0x8')](),timeout('30s'),controller[_0x1df6('0x10')]);router[_0x1df6('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1df6('0x11')]('/:id/clone',auth[_0x1df6('0x8')](),controller[_0x1df6('0x12')]);router[_0x1df6('0x13')](_0x1df6('0xb'),auth[_0x1df6('0x8')](),controller[_0x1df6('0x14')]);router[_0x1df6('0x15')](_0x1df6('0xb'),auth[_0x1df6('0x8')](),controller[_0x1df6('0x16')]);module[_0x1df6('0x17')]=router; \ No newline at end of file +var _0x6fb9=['clone','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6fb9,0x100));var _0x96fb=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0x6fb9[_0x4e4519];return _0x340044;};'use strict';var multer=require(_0x96fb('0x0'));var util=require(_0x96fb('0x1'));var path=require(_0x96fb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x96fb('0x3')]();var fs_extra=require(_0x96fb('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96fb('0x5'));var controller=require(_0x96fb('0x6'));router[_0x96fb('0x7')]('/',auth[_0x96fb('0x8')](),controller[_0x96fb('0x9')]);router[_0x96fb('0x7')](_0x96fb('0xa'),auth[_0x96fb('0x8')](),controller[_0x96fb('0xb')]);router[_0x96fb('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x96fb('0xc')]);router['get'](_0x96fb('0xd'),auth[_0x96fb('0x8')](),controller[_0x96fb('0xe')]);router['get'](_0x96fb('0xf'),auth['isAuthenticated'](),timeout('30s'),controller[_0x96fb('0x10')]);router[_0x96fb('0x11')]('/',auth['isAuthenticated'](),controller[_0x96fb('0x12')]);router[_0x96fb('0x11')]('/:id/clone',auth['isAuthenticated'](),controller[_0x96fb('0x13')]);router[_0x96fb('0x14')](_0x96fb('0xa'),auth[_0x96fb('0x8')](),controller[_0x96fb('0x15')]);router[_0x96fb('0x16')](_0x96fb('0xa'),auth[_0x96fb('0x8')](),controller[_0x96fb('0x17')]);module[_0x96fb('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9877a85..bf5fa1b 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 _0xf394=['util','exports','name','STRING','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash'];(function(_0x6472d3,_0x1106a9){var _0x3126b9=function(_0x13dbd4){while(--_0x13dbd4){_0x6472d3['push'](_0x6472d3['shift']());}};_0x3126b9(++_0x1106a9);}(_0xf394,0xa3));var _0x4f39=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf394[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x4f39('0x0'));var _=require(_0x4f39('0x1'));var util=require(_0x4f39('0x2'));module[_0x4f39('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x4f39('0x4')},'description':{'type':Sequelize[_0x4f39('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x4f39('0x6')),'set':function(_0x99dbff){if(_[_0x4f39('0x7')](_0x99dbff)){this[_0x4f39('0x8')](_0x4f39('0x9'),JSON[_0x4f39('0xa')](_0x99dbff));}else if(_[_0x4f39('0xb')](_0x99dbff)){this[_0x4f39('0x8')]('formData',_0x99dbff);}else{this[_0x4f39('0x8')](_0x4f39('0x9'),util['format'](_0x4f39('0xc'),this[_0x4f39('0xd')](_0x4f39('0x4'))||'',this[_0x4f39('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4f39('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xda45=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData'];(function(_0x1ebd5f,_0x26d83d){var _0xefd5eb=function(_0x2a6b87){while(--_0x2a6b87){_0x1ebd5f['push'](_0x1ebd5f['shift']());}};_0xefd5eb(++_0x26d83d);}(_0xda45,0x6b));var _0x5da4=function(_0x16ed61,_0xb77b1e){_0x16ed61=_0x16ed61-0x0;var _0x1120e1=_0xda45[_0x16ed61];return _0x1120e1;};'use strict';var Sequelize=require(_0x5da4('0x0'));var _=require(_0x5da4('0x1'));var util=require(_0x5da4('0x2'));module['exports']={'name':{'type':Sequelize[_0x5da4('0x3')],'unique':_0x5da4('0x4')},'description':{'type':Sequelize[_0x5da4('0x3')]},'formData':{'type':Sequelize[_0x5da4('0x5')](_0x5da4('0x6')),'set':function(_0x289e66){if(_[_0x5da4('0x7')](_0x289e66)){this[_0x5da4('0x8')]('formData',JSON[_0x5da4('0x9')](_0x289e66));}else if(_[_0x5da4('0xa')](_0x289e66)){this[_0x5da4('0x8')](_0x5da4('0xb'),_0x289e66);}else{this['setDataValue'](_0x5da4('0xb'),util[_0x5da4('0xc')](_0x5da4('0xd'),this[_0x5da4('0xe')](_0x5da4('0x4'))||'',this['getDataValue'](_0x5da4('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5da4('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5da4('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 8309cf4..188096c 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 _0xfbb2=['VIRTUAL','merge','options','JscriptyProject','findAll','catch','show','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','userProfileId','params','getSessions','findOne','JscriptySessionReport','ProjectId','rows','getAnswers','JscriptyAnswerReport','pick','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','format','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type'];(function(_0x3ba6c6,_0x5e2d32){var _0x5c7802=function(_0x5a571d){while(--_0x5a571d){_0x3ba6c6['push'](_0x3ba6c6['shift']());}};_0x5c7802(++_0x5e2d32);}(_0xfbb2,0xae));var _0x2fbb=function(_0x417485,_0xdfeb87){_0x417485=_0x417485-0x0;var _0x528683=_0xfbb2[_0x417485];return _0x528683;};'use strict';var emlformat=require(_0x2fbb('0x0'));var rimraf=require(_0x2fbb('0x1'));var zipdir=require(_0x2fbb('0x2'));var jsonpatch=require(_0x2fbb('0x3'));var rp=require('request-promise');var moment=require(_0x2fbb('0x4'));var BPromise=require(_0x2fbb('0x5'));var Mustache=require(_0x2fbb('0x6'));var util=require(_0x2fbb('0x7'));var path=require(_0x2fbb('0x8'));var sox=require(_0x2fbb('0x9'));var csv=require(_0x2fbb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fbb('0xb'));var _=require(_0x2fbb('0xc'));var squel=require(_0x2fbb('0xd'));var crypto=require('crypto');var jsforce=require(_0x2fbb('0xe'));var deskjs=require(_0x2fbb('0xf'));var toCsv=require(_0x2fbb('0xa'));var querystring=require(_0x2fbb('0x10'));var Papa=require(_0x2fbb('0x11'));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(_0x2fbb('0x12'));var logger=require(_0x2fbb('0x13'))(_0x2fbb('0x14'));var utils=require('../../config/utils');var config=require(_0x2fbb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fbb('0x16'))['db'];function respondWithStatusCode(_0x22175a,_0xdacf50){_0xdacf50=_0xdacf50||0xcc;return function(_0x2eea84){if(_0x2eea84){return _0x22175a[_0x2fbb('0x17')](_0xdacf50);}return _0x22175a['status'](_0xdacf50)[_0x2fbb('0x18')]();};}function respondWithResult(_0x1c7acf,_0x54ddc1){_0x54ddc1=_0x54ddc1||0xc8;return function(_0x1e1264){if(_0x1e1264){return _0x1c7acf['status'](_0x54ddc1)[_0x2fbb('0x19')](_0x1e1264);}};}function respondWithFilteredResult(_0x8053b3,_0x22f2e8){return function(_0x5bfe53){if(_0x5bfe53){var _0x3e5c21=typeof _0x22f2e8[_0x2fbb('0x1a')]===_0x2fbb('0x1b')&&typeof _0x22f2e8[_0x2fbb('0x1c')]===_0x2fbb('0x1b');var _0x235ee2=_0x5bfe53['count'];var _0x2092c4=_0x3e5c21?0x0:_0x22f2e8['offset'];var _0x3ca2a1=_0x3e5c21?_0x5bfe53[_0x2fbb('0x1d')]:_0x22f2e8['offset']+_0x22f2e8['limit'];var _0x233dd3;if(_0x3ca2a1>=_0x235ee2){_0x3ca2a1=_0x235ee2;_0x233dd3=0xc8;}else{_0x233dd3=0xce;}_0x8053b3[_0x2fbb('0x1e')](_0x233dd3);return _0x8053b3[_0x2fbb('0x1f')](_0x2fbb('0x20'),_0x2092c4+'-'+_0x3ca2a1+'/'+_0x235ee2)['json'](_0x5bfe53);}return null;};}function patchUpdates(_0xcdec3d){return function(_0x48b1c5){try{jsonpatch['apply'](_0x48b1c5,_0xcdec3d,!![]);}catch(_0x39eaa8){return BPromise[_0x2fbb('0x21')](_0x39eaa8);}return _0x48b1c5[_0x2fbb('0x22')]();};}function saveUpdates(_0x170765,_0x4afd23){return function(_0x188061){if(_0x188061){return _0x188061[_0x2fbb('0x23')](_0x170765)[_0x2fbb('0x24')](function(_0x4eb2f9){return _0x4eb2f9;});}return null;};}function removeEntity(_0x509fb7,_0x407f86){return function(_0x54961a){if(_0x54961a){return _0x54961a[_0x2fbb('0x25')]()[_0x2fbb('0x24')](function(){var _0x44c423=_0x54961a[_0x2fbb('0x26')]({'plain':!![]});var _0x52c750=_0x2fbb('0x27');return db[_0x2fbb('0x28')][_0x2fbb('0x25')]({'where':{'type':_0x52c750,'resourceId':_0x44c423['id']}})[_0x2fbb('0x24')](function(){return _0x54961a;});})['then'](function(){_0x509fb7[_0x2fbb('0x1e')](0xcc)[_0x2fbb('0x18')]();});}};}function handleEntityNotFound(_0x1ddb64,_0x1c2635){return function(_0x509da8){if(!_0x509da8){_0x1ddb64[_0x2fbb('0x17')](0x194);}return _0x509da8;};}function handleError(_0x4b93ba,_0x4c8e88){_0x4c8e88=_0x4c8e88||0x1f4;return function(_0x33b493){logger[_0x2fbb('0x29')](_0x33b493['stack']);if(_0x33b493['name']){delete _0x33b493[_0x2fbb('0x2a')];}_0x4b93ba[_0x2fbb('0x1e')](_0x4c8e88)[_0x2fbb('0x2b')](_0x33b493);};}exports[_0x2fbb('0x2c')]=function(_0x249619,_0x3e8323){var _0x4984b1={},_0x1bad55={},_0xd06a78={'count':0x0,'rows':[]};var _0x448498=_[_0x2fbb('0x2d')](db['JscriptyProject'][_0x2fbb('0x2e')],function(_0x49dee9){return{'name':_0x49dee9[_0x2fbb('0x2f')],'type':_0x49dee9['type'][_0x2fbb('0x30')]};});_0x1bad55[_0x2fbb('0x31')]=_['map'](_0x448498,_0x2fbb('0x2a'));_0x1bad55[_0x2fbb('0x32')]=_[_0x2fbb('0x33')](_0x249619['query']);_0x1bad55[_0x2fbb('0x34')]=_[_0x2fbb('0x35')](_0x1bad55[_0x2fbb('0x31')],_0x1bad55[_0x2fbb('0x32')]);_0x4984b1[_0x2fbb('0x36')]=_[_0x2fbb('0x35')](_0x1bad55['model'],qs[_0x2fbb('0x37')](_0x249619[_0x2fbb('0x32')][_0x2fbb('0x37')]));_0x4984b1['attributes']=_0x4984b1[_0x2fbb('0x36')][_0x2fbb('0x38')]?_0x4984b1['attributes']:_0x1bad55['model'];if(!_0x249619[_0x2fbb('0x32')][_0x2fbb('0x39')](_0x2fbb('0x3a'))){_0x4984b1['limit']=qs['limit'](_0x249619[_0x2fbb('0x32')][_0x2fbb('0x1c')]);_0x4984b1['offset']=qs[_0x2fbb('0x1a')](_0x249619['query'][_0x2fbb('0x1a')]);}_0x4984b1[_0x2fbb('0x3b')]=qs[_0x2fbb('0x3c')](_0x249619[_0x2fbb('0x32')][_0x2fbb('0x3c')]);_0x4984b1[_0x2fbb('0x3d')]=qs[_0x2fbb('0x34')](_['pick'](_0x249619['query'],_0x1bad55['filters']),_0x448498);if(_0x249619[_0x2fbb('0x32')][_0x2fbb('0x3e')]){_0x4984b1[_0x2fbb('0x3d')]=_['merge'](_0x4984b1[_0x2fbb('0x3d')],{'$or':_[_0x2fbb('0x2d')](_0x448498,function(_0x5de180){if(_0x5de180[_0x2fbb('0x3f')]!==_0x2fbb('0x40')){var _0xc7a11e={};_0xc7a11e[_0x5de180['name']]={'$like':'%'+_0x249619['query']['filter']+'%'};return _0xc7a11e;}})});}_0x4984b1=_[_0x2fbb('0x41')]({},_0x4984b1,_0x249619[_0x2fbb('0x42')]);var _0x38ea69={'where':_0x4984b1[_0x2fbb('0x3d')]};return db[_0x2fbb('0x43')][_0x2fbb('0x1d')](_0x38ea69)['then'](function(_0x6b20fb){_0xd06a78[_0x2fbb('0x1d')]=_0x6b20fb;if(_0x249619[_0x2fbb('0x32')]['includeAll']){_0x4984b1['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x2fbb('0x44')](_0x4984b1);})[_0x2fbb('0x24')](function(_0x5aa238){_0xd06a78['rows']=_0x5aa238;return _0xd06a78;})[_0x2fbb('0x24')](respondWithFilteredResult(_0x3e8323,_0x4984b1))[_0x2fbb('0x45')](handleError(_0x3e8323,null));};exports[_0x2fbb('0x46')]=function(_0x51dcc4,_0x5e4880){var _0x4917d1={'raw':![],'where':{'id':_0x51dcc4['params']['id']}},_0x26d44b={};_0x26d44b[_0x2fbb('0x31')]=_[_0x2fbb('0x33')](db[_0x2fbb('0x43')][_0x2fbb('0x2e')]);_0x26d44b[_0x2fbb('0x32')]=_[_0x2fbb('0x33')](_0x51dcc4['query']);_0x26d44b[_0x2fbb('0x34')]=_[_0x2fbb('0x35')](_0x26d44b[_0x2fbb('0x31')],_0x26d44b[_0x2fbb('0x32')]);_0x4917d1[_0x2fbb('0x36')]=_['intersection'](_0x26d44b[_0x2fbb('0x31')],qs['fields'](_0x51dcc4[_0x2fbb('0x32')]['fields']));_0x4917d1['attributes']=_0x4917d1[_0x2fbb('0x36')]['length']?_0x4917d1[_0x2fbb('0x36')]:_0x26d44b[_0x2fbb('0x31')];if(_0x51dcc4[_0x2fbb('0x32')][_0x2fbb('0x47')]){_0x4917d1[_0x2fbb('0x48')]=[{'all':!![]}];}_0x4917d1=_[_0x2fbb('0x41')]({},_0x4917d1,_0x51dcc4['options']);return db['JscriptyProject'][_0x2fbb('0x49')](_0x4917d1)[_0x2fbb('0x24')](handleEntityNotFound(_0x5e4880,null))[_0x2fbb('0x24')](respondWithResult(_0x5e4880,null))['catch'](handleError(_0x5e4880,null));};exports[_0x2fbb('0x4a')]=function(_0x426f44,_0x361f68){return db['JscriptyProject'][_0x2fbb('0x4a')](_0x426f44['body'],{})[_0x2fbb('0x24')](function(_0x2e4e1c){var _0x2efbe5=_0x426f44[_0x2fbb('0x4b')][_0x2fbb('0x26')]({'plain':!![]});if(!_0x2efbe5)throw new Error(_0x2fbb('0x4c'));if(_0x2efbe5[_0x2fbb('0x4d')]===_0x2fbb('0x4b')){var _0x2a9dd8=_0x2e4e1c['get']({'plain':!![]});var _0x480025='Projects';return db[_0x2fbb('0x4e')][_0x2fbb('0x49')]({'where':{'name':_0x480025,'userProfileId':_0x2efbe5['userProfileId']},'raw':!![]})['then'](function(_0x424d35){if(_0x424d35&&_0x424d35[_0x2fbb('0x4f')]===0x0){return db[_0x2fbb('0x28')][_0x2fbb('0x4a')]({'name':_0x2a9dd8['name'],'resourceId':_0x2a9dd8['id'],'type':_0x424d35[_0x2fbb('0x2a')],'sectionId':_0x424d35['id']},{})[_0x2fbb('0x24')](function(){return _0x2e4e1c;});}else{return _0x2e4e1c;}})[_0x2fbb('0x45')](function(_0xc03859){logger[_0x2fbb('0x29')](_0x2fbb('0x50'),_0xc03859);throw _0xc03859;});}return _0x2e4e1c;})[_0x2fbb('0x24')](respondWithResult(_0x361f68,0xc9))[_0x2fbb('0x45')](handleError(_0x361f68,null));};exports[_0x2fbb('0x51')]=function(_0x59a4c7,_0x254a45){var _0x4d4e91={'where':{'id':_0x59a4c7['params']['id']}},_0x22e35a={};_0x22e35a[_0x2fbb('0x31')]=_[_0x2fbb('0x33')](db[_0x2fbb('0x43')][_0x2fbb('0x2e')]);_0x4d4e91['attributes']=_[_0x2fbb('0x35')](_0x22e35a['model'],qs['fields'](_0x59a4c7['query']['fields']));_0x4d4e91[_0x2fbb('0x36')]=_0x4d4e91[_0x2fbb('0x36')][_0x2fbb('0x38')]?_0x4d4e91['attributes']:_0x22e35a['model'];if(_0x59a4c7[_0x2fbb('0x32')][_0x2fbb('0x47')]){_0x4d4e91[_0x2fbb('0x48')]=[{'all':!![]}];}_0x4d4e91=_[_0x2fbb('0x41')]({},_0x4d4e91,_0x59a4c7[_0x2fbb('0x42')]);return db[_0x2fbb('0x43')]['find'](_0x4d4e91)['then'](handleEntityNotFound(_0x254a45,null))[_0x2fbb('0x24')](function(_0x392beb){if(_0x392beb){var _0x5d2582=_0x392beb[_0x2fbb('0x26')]({'plain':!![]});_0x5d2582=qs[_0x2fbb('0x52')](_0x5d2582,['id',_0x2fbb('0x53'),_0x2fbb('0x54')]);_0x59a4c7[_0x2fbb('0x55')]=_[_0x2fbb('0x52')](_0x59a4c7[_0x2fbb('0x55')],['id',_0x2fbb('0x53'),_0x2fbb('0x54')]);return db[_0x2fbb('0x43')][_0x2fbb('0x4a')](_[_0x2fbb('0x41')](_0x5d2582,_0x59a4c7['body']),{'include':_0x59a4c7[_0x2fbb('0x32')][_0x2fbb('0x47')]?[{'all':!![]}]:undefined})[_0x2fbb('0x24')](function(_0x4b9fa6){var _0x4becec=_0x59a4c7[_0x2fbb('0x4b')][_0x2fbb('0x26')]({'plain':!![]});if(!_0x4becec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4becec[_0x2fbb('0x4d')]===_0x2fbb('0x4b')){var _0x552c87=_0x4b9fa6[_0x2fbb('0x26')]({'plain':!![]});var _0x41786a='Projects';return db[_0x2fbb('0x4e')][_0x2fbb('0x49')]({'where':{'name':_0x41786a,'userProfileId':_0x4becec[_0x2fbb('0x56')]},'raw':!![]})[_0x2fbb('0x24')](function(_0x587416){if(_0x587416&&_0x587416[_0x2fbb('0x4f')]===0x0){return db[_0x2fbb('0x28')][_0x2fbb('0x4a')]({'name':_0x552c87[_0x2fbb('0x2a')],'resourceId':_0x552c87['id'],'type':_0x587416[_0x2fbb('0x2a')],'sectionId':_0x587416['id']},{})[_0x2fbb('0x24')](function(){return _0x4b9fa6;});}else{return _0x4b9fa6;}})['catch'](function(_0x33de46){logger['error'](_0x2fbb('0x50'),_0x33de46);throw _0x33de46;});}return _0x4b9fa6;});}})[_0x2fbb('0x24')](respondWithResult(_0x254a45,0xc9))['catch'](handleError(_0x254a45,null));};exports[_0x2fbb('0x23')]=function(_0x1ef0fa,_0x5b3f17){if(_0x1ef0fa[_0x2fbb('0x55')]['id']){delete _0x1ef0fa[_0x2fbb('0x55')]['id'];}return db[_0x2fbb('0x43')][_0x2fbb('0x49')]({'where':{'id':_0x1ef0fa[_0x2fbb('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b3f17,null))['then'](saveUpdates(_0x1ef0fa['body'],null))['then'](respondWithResult(_0x5b3f17,null))['catch'](handleError(_0x5b3f17,null));};exports[_0x2fbb('0x25')]=function(_0x12163e,_0x27e910){return db['JscriptyProject'][_0x2fbb('0x49')]({'where':{'id':_0x12163e['params']['id']}})[_0x2fbb('0x24')](handleEntityNotFound(_0x27e910,null))[_0x2fbb('0x24')](removeEntity(_0x27e910,null))[_0x2fbb('0x45')](handleError(_0x27e910,null));};exports[_0x2fbb('0x58')]=function(_0x4c1cb0,_0x138a8f,_0x484ce3){var _0x5e52be={'raw':!![],'where':{}};var _0x232bce={};var _0x39ae90={'count':0x0,'rows':[]};return db[_0x2fbb('0x43')][_0x2fbb('0x59')]({'where':{'id':_0x4c1cb0['params']['id']}})[_0x2fbb('0x24')](handleEntityNotFound(_0x138a8f,null))[_0x2fbb('0x24')](function(_0xfe3d12){if(_0xfe3d12){_0x232bce[_0x2fbb('0x31')]=_[_0x2fbb('0x33')](db[_0x2fbb('0x5a')]['rawAttributes']);_0x232bce[_0x2fbb('0x32')]=_[_0x2fbb('0x33')](_0x4c1cb0[_0x2fbb('0x32')]);_0x232bce[_0x2fbb('0x34')]=_[_0x2fbb('0x35')](_0x232bce[_0x2fbb('0x31')],_0x232bce[_0x2fbb('0x32')]);_0x5e52be[_0x2fbb('0x36')]=_[_0x2fbb('0x35')](_0x232bce[_0x2fbb('0x31')],qs[_0x2fbb('0x37')](_0x4c1cb0[_0x2fbb('0x32')]['fields']));_0x5e52be[_0x2fbb('0x36')]=_0x5e52be['attributes'][_0x2fbb('0x38')]?_0x5e52be['attributes']:_0x232bce[_0x2fbb('0x31')];if(!_0x4c1cb0[_0x2fbb('0x32')][_0x2fbb('0x39')]('nolimit')){_0x5e52be[_0x2fbb('0x1c')]=qs['limit'](_0x4c1cb0['query'][_0x2fbb('0x1c')]);_0x5e52be[_0x2fbb('0x1a')]=qs[_0x2fbb('0x1a')](_0x4c1cb0[_0x2fbb('0x32')][_0x2fbb('0x1a')]);}_0x5e52be[_0x2fbb('0x3b')]=qs[_0x2fbb('0x3c')](_0x4c1cb0[_0x2fbb('0x32')][_0x2fbb('0x3c')]);_0x5e52be[_0x2fbb('0x3d')]=qs[_0x2fbb('0x34')](_['pick'](_0x4c1cb0['query'],_0x232bce[_0x2fbb('0x34')]));_0x5e52be[_0x2fbb('0x3d')][_0x2fbb('0x5b')]=_0xfe3d12['id'];if(_0x4c1cb0[_0x2fbb('0x32')][_0x2fbb('0x3e')]){_0x5e52be[_0x2fbb('0x3d')]=_['merge'](_0x5e52be['where'],{'$or':_[_0x2fbb('0x2d')](_0x5e52be['attributes'],function(_0x1095c9){var _0x34141e={};_0x34141e[_0x1095c9]={'$like':'%'+_0x4c1cb0[_0x2fbb('0x32')][_0x2fbb('0x3e')]+'%'};return _0x34141e;})});}_0x5e52be=_[_0x2fbb('0x41')]({},_0x5e52be,_0x4c1cb0[_0x2fbb('0x42')]);return db[_0x2fbb('0x5a')][_0x2fbb('0x1d')]({'where':_0x5e52be['where']})[_0x2fbb('0x24')](function(_0x4bd52d){_0x39ae90[_0x2fbb('0x1d')]=_0x4bd52d;if(_0x4c1cb0[_0x2fbb('0x32')][_0x2fbb('0x47')]){_0x5e52be['include']=[{'all':!![]}];}return db[_0x2fbb('0x5a')][_0x2fbb('0x44')](_0x5e52be);})[_0x2fbb('0x24')](function(_0xea6b5){_0x39ae90[_0x2fbb('0x5c')]=_0xea6b5;return _0x39ae90;});}})['then'](respondWithFilteredResult(_0x138a8f,_0x5e52be))['catch'](handleError(_0x138a8f,null));};exports[_0x2fbb('0x5d')]=function(_0x332017,_0x386865,_0x1c905){var _0x6de3dd={'raw':!![],'where':{}};var _0x38bcd8={};var _0x11aa5e={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x2fbb('0x59')]({'where':{'id':_0x332017[_0x2fbb('0x57')]['id']}})[_0x2fbb('0x24')](handleEntityNotFound(_0x386865,null))['then'](function(_0x1e2589){if(_0x1e2589){_0x38bcd8[_0x2fbb('0x31')]=_[_0x2fbb('0x33')](db[_0x2fbb('0x5e')][_0x2fbb('0x2e')]);_0x38bcd8['query']=_[_0x2fbb('0x33')](_0x332017['query']);_0x38bcd8[_0x2fbb('0x34')]=_[_0x2fbb('0x35')](_0x38bcd8['model'],_0x38bcd8[_0x2fbb('0x32')]);_0x6de3dd['attributes']=_[_0x2fbb('0x35')](_0x38bcd8[_0x2fbb('0x31')],qs[_0x2fbb('0x37')](_0x332017['query']['fields']));_0x6de3dd[_0x2fbb('0x36')]=_0x6de3dd[_0x2fbb('0x36')][_0x2fbb('0x38')]?_0x6de3dd[_0x2fbb('0x36')]:_0x38bcd8[_0x2fbb('0x31')];if(!_0x332017[_0x2fbb('0x32')][_0x2fbb('0x39')]('nolimit')){_0x6de3dd[_0x2fbb('0x1c')]=qs[_0x2fbb('0x1c')](_0x332017[_0x2fbb('0x32')][_0x2fbb('0x1c')]);_0x6de3dd['offset']=qs['offset'](_0x332017['query']['offset']);}_0x6de3dd[_0x2fbb('0x3b')]=qs[_0x2fbb('0x3c')](_0x332017['query'][_0x2fbb('0x3c')]);_0x6de3dd[_0x2fbb('0x3d')]=qs[_0x2fbb('0x34')](_[_0x2fbb('0x5f')](_0x332017[_0x2fbb('0x32')],_0x38bcd8[_0x2fbb('0x34')]));_0x6de3dd[_0x2fbb('0x3d')]['ProjectId']=_0x1e2589['id'];if(_0x332017[_0x2fbb('0x32')]['filter']){_0x6de3dd[_0x2fbb('0x3d')]=_[_0x2fbb('0x41')](_0x6de3dd[_0x2fbb('0x3d')],{'$or':_[_0x2fbb('0x2d')](_0x6de3dd[_0x2fbb('0x36')],function(_0x48b341){var _0x1c2418={};_0x1c2418[_0x48b341]={'$like':'%'+_0x332017[_0x2fbb('0x32')][_0x2fbb('0x3e')]+'%'};return _0x1c2418;})});}_0x6de3dd=_[_0x2fbb('0x41')]({},_0x6de3dd,_0x332017[_0x2fbb('0x42')]);return db[_0x2fbb('0x5e')][_0x2fbb('0x1d')]({'where':_0x6de3dd[_0x2fbb('0x3d')]})[_0x2fbb('0x24')](function(_0x1ae578){_0x11aa5e[_0x2fbb('0x1d')]=_0x1ae578;if(_0x332017[_0x2fbb('0x32')]['includeAll']){_0x6de3dd[_0x2fbb('0x48')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x2fbb('0x44')](_0x6de3dd);})[_0x2fbb('0x24')](function(_0x15585b){_0x11aa5e['rows']=_0x15585b;return _0x11aa5e;});}})[_0x2fbb('0x24')](respondWithFilteredResult(_0x386865,_0x6de3dd))[_0x2fbb('0x45')](handleError(_0x386865,null));};function char(_0x4b9aee){return _0x2fbb('0x60')===typeof _0x4b9aee?String[_0x2fbb('0x61')]['apply'](null,arguments):_0x4b9aee;}function needsEncapsulation(_0x37532b){return!!_0x37532b&&(_0x37532b[_0x2fbb('0x62')]()[_0x2fbb('0x63')](char(0xd))>=0x0||_0x37532b[_0x2fbb('0x62')]()['indexOf'](char(0xa))>=0x0||_0x37532b[_0x2fbb('0x62')]()[_0x2fbb('0x63')](char(0x2c))>=0x0||_0x37532b[_0x2fbb('0x62')]()[_0x2fbb('0x63')](char(0x22))>=0x0);}function encapsulate(_0x3f43f5){var _0x3bf4d4=char(0x22),_0x59b618='\x5c'+char(0x22),_0x27ae43=_0x3f43f5[_0x2fbb('0x62')]()['replace'](new RegExp(_0x3bf4d4,'g'),_0x59b618);return _0x3bf4d4+_0x27ae43+_0x3bf4d4;}exports[_0x2fbb('0x64')]=function(_0x11d2d6,_0x554401,_0x3242d6){var _0xbc25e5,_0xd72780;var _0x16be49={'where':{'ProjectId':_0x11d2d6[_0x2fbb('0x57')]['id']}};if(_0x11d2d6[_0x2fbb('0x32')][_0x2fbb('0x65')]){_0x16be49[_0x2fbb('0x3d')][_0x2fbb('0x66')]=JSON[_0x2fbb('0x67')](_0x11d2d6[_0x2fbb('0x32')][_0x2fbb('0x65')]);}return db['JscriptySessionReport'][_0x2fbb('0x44')](_0x16be49)[_0x2fbb('0x24')](handleEntityNotFound(_0x554401,null))[_0x2fbb('0x24')](function(_0x2fa41d){if(_0x2fa41d){_0xbc25e5=_0x2fa41d;return db[_0x2fbb('0x68')]['findAll']({'where':{'SessionId':{'$in':_[_0x2fbb('0x2d')](_0xbc25e5,'id')},'ProjectId':_0x11d2d6[_0x2fbb('0x57')]['id']},'order':_0x2fbb('0x69')});}})['then'](handleEntityNotFound(_0x554401,null))['then'](function(_0x1ae2d4){if(_0x1ae2d4){_0xd72780=_0x1ae2d4;var _0x23560c={};for(var _0xe2ab35=0x0,_0x59f437=_0xd72780[_0x2fbb('0x38')];_0xe2ab35<_0x59f437;_0xe2ab35++){if(!_0x23560c[_0x2fbb('0x39')](_0xd72780[_0xe2ab35][_0x2fbb('0x6a')])){_0x23560c[_0xd72780[_0xe2ab35][_0x2fbb('0x6a')]]=needsEncapsulation(_0xd72780[_0xe2ab35][_0x2fbb('0x6b')])?encapsulate(_0xd72780[_0xe2ab35][_0x2fbb('0x6b')]):_0xd72780[_0xe2ab35][_0x2fbb('0x6b')];}}var _0x15e67b=[],_0x3c83f7={};for(var _0x21e66a=0x0,_0x2fa961=_0xbc25e5[_0x2fbb('0x38')];_0x21e66a<_0x2fa961;_0x21e66a++){_0x3c83f7={'ProjectId':_0x11d2d6[_0x2fbb('0x57')]['id'],'SessionId':_0xbc25e5[_0x21e66a]['id'],'StartTime':moment(_0xbc25e5[_0x21e66a][_0x2fbb('0x66')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x121916=0x0,_0x8f17bb=_0xd72780['length'];_0x121916<_0x8f17bb;_0x121916++){if(_0xd72780[_0x121916]['SessionId']==_0xbc25e5[_0x21e66a]['id']&&_0x23560c[_0x2fbb('0x39')](_0xd72780[_0x121916][_0x2fbb('0x6a')])){_0x3c83f7[_0x23560c[_0xd72780[_0x121916]['questionId']]]=_0xd72780[_0x121916][_0x2fbb('0x6c')];}}for(var _0x32a620 in _0x23560c){if(!_0x3c83f7[_0x2fbb('0x39')](_0x23560c[_0x32a620])){_0x3c83f7[_0x23560c[_0x32a620]]=null;}}_0x15e67b[_0x2fbb('0x6d')](_0x3c83f7);}return _0x15e67b;}})['then'](function(_0x3a36a7){if(!_[_0x2fbb('0x6e')](_0x3a36a7)){var _0x40d5f0=toCsv(_0x3a36a7);var _0x3ed755=Date[_0x2fbb('0x6f')]();fs[_0x2fbb('0x70')](util['format'](_0x2fbb('0x71'),_0x11d2d6[_0x2fbb('0x57')]['id'],_0x3ed755),_0x40d5f0);_0x554401[_0x2fbb('0x72')]('Content-disposition',_0x2fbb('0x73')+util[_0x2fbb('0x74')]('Jscripty_Project_%d_Summary_%s.csv',_0x11d2d6['params']['id'],_0x3ed755));_0x554401[_0x2fbb('0x72')](_0x2fbb('0x75'),'text/csv');return _0x554401[_0x2fbb('0x76')](util[_0x2fbb('0x74')](_0x2fbb('0x71'),_0x11d2d6['params']['id'],_0x3ed755));}else{return _0x554401['sendStatus'](0xcc);}})['catch'](handleError(_0x554401,null));}; \ No newline at end of file +var _0x3940=['include','find','create','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','rows','getAnswers','findAll','toString','indexOf','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','catch','show','params','keys','includeAll'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x3940,0xa6));var _0x0394=function(_0x1c02fe,_0xcc2f73){_0x1c02fe=_0x1c02fe-0x0;var _0x35b578=_0x3940[_0x1c02fe];return _0x35b578;};'use strict';var emlformat=require(_0x0394('0x0'));var rimraf=require(_0x0394('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0394('0x2'));var rp=require('request-promise');var moment=require(_0x0394('0x3'));var BPromise=require(_0x0394('0x4'));var Mustache=require('mustache');var util=require(_0x0394('0x5'));var path=require('path');var sox=require(_0x0394('0x6'));var csv=require(_0x0394('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0394('0x8'));var _=require(_0x0394('0x9'));var squel=require('squel');var crypto=require(_0x0394('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0394('0xb'));var toCsv=require(_0x0394('0x7'));var querystring=require(_0x0394('0xc'));var Papa=require(_0x0394('0xd'));var Redis=require(_0x0394('0xe'));var authService=require(_0x0394('0xf'));var qs=require(_0x0394('0x10'));var as=require(_0x0394('0x11'));var hardwareService=require(_0x0394('0x12'));var logger=require(_0x0394('0x13'))('api');var utils=require(_0x0394('0x14'));var config=require(_0x0394('0x15'));var licenseUtil=require(_0x0394('0x16'));var db=require(_0x0394('0x17'))['db'];function respondWithStatusCode(_0x56fe9a,_0x10e241){_0x10e241=_0x10e241||0xcc;return function(_0x7c3d40){if(_0x7c3d40){return _0x56fe9a[_0x0394('0x18')](_0x10e241);}return _0x56fe9a['status'](_0x10e241)[_0x0394('0x19')]();};}function respondWithResult(_0x53cc66,_0x461257){_0x461257=_0x461257||0xc8;return function(_0x2ec0b5){if(_0x2ec0b5){return _0x53cc66[_0x0394('0x1a')](_0x461257)[_0x0394('0x1b')](_0x2ec0b5);}};}function respondWithFilteredResult(_0x401ed0,_0x283f98){return function(_0x2d3caf){if(_0x2d3caf){var _0x512fb1=typeof _0x283f98[_0x0394('0x1c')]===_0x0394('0x1d')&&typeof _0x283f98[_0x0394('0x1e')]===_0x0394('0x1d');var _0x3d28d1=_0x2d3caf[_0x0394('0x1f')];var _0x208aa3=_0x512fb1?0x0:_0x283f98['offset'];var _0x51c1b2=_0x512fb1?_0x2d3caf[_0x0394('0x1f')]:_0x283f98['offset']+_0x283f98[_0x0394('0x1e')];var _0x2b0342;if(_0x51c1b2>=_0x3d28d1){_0x51c1b2=_0x3d28d1;_0x2b0342=0xc8;}else{_0x2b0342=0xce;}_0x401ed0[_0x0394('0x1a')](_0x2b0342);return _0x401ed0[_0x0394('0x20')](_0x0394('0x21'),_0x208aa3+'-'+_0x51c1b2+'/'+_0x3d28d1)[_0x0394('0x1b')](_0x2d3caf);}return null;};}function patchUpdates(_0x5d805c){return function(_0x3039f3){try{jsonpatch[_0x0394('0x22')](_0x3039f3,_0x5d805c,!![]);}catch(_0xf9a971){return BPromise[_0x0394('0x23')](_0xf9a971);}return _0x3039f3[_0x0394('0x24')]();};}function saveUpdates(_0x3d8985,_0x798a55){return function(_0x5c8129){if(_0x5c8129){return _0x5c8129[_0x0394('0x25')](_0x3d8985)[_0x0394('0x26')](function(_0x39d784){return _0x39d784;});}return null;};}function removeEntity(_0xdfe68b,_0x5bb7c0){return function(_0x2a96fa){if(_0x2a96fa){return _0x2a96fa[_0x0394('0x27')]()[_0x0394('0x26')](function(){var _0x2f2a86=_0x2a96fa[_0x0394('0x28')]({'plain':!![]});var _0x48f574=_0x0394('0x29');return db['UserProfileResource'][_0x0394('0x27')]({'where':{'type':_0x48f574,'resourceId':_0x2f2a86['id']}})[_0x0394('0x26')](function(){return _0x2a96fa;});})[_0x0394('0x26')](function(){_0xdfe68b[_0x0394('0x1a')](0xcc)[_0x0394('0x19')]();});}};}function handleEntityNotFound(_0x3ecdde,_0x22dadc){return function(_0x46e329){if(!_0x46e329){_0x3ecdde[_0x0394('0x18')](0x194);}return _0x46e329;};}function handleError(_0x5dc568,_0x1d39d1){_0x1d39d1=_0x1d39d1||0x1f4;return function(_0x3bf593){logger[_0x0394('0x2a')](_0x3bf593[_0x0394('0x2b')]);if(_0x3bf593[_0x0394('0x2c')]){delete _0x3bf593[_0x0394('0x2c')];}_0x5dc568[_0x0394('0x1a')](_0x1d39d1)[_0x0394('0x2d')](_0x3bf593);};}exports[_0x0394('0x2e')]=function(_0x537fb8,_0x1060b0){var _0x284dfd={},_0x10a363={},_0x4c2df3={'count':0x0,'rows':[]};var _0x24e2e9=_['map'](db[_0x0394('0x2f')][_0x0394('0x30')],function(_0xdce1dc){return{'name':_0xdce1dc[_0x0394('0x31')],'type':_0xdce1dc[_0x0394('0x32')][_0x0394('0x33')]};});_0x10a363[_0x0394('0x34')]=_[_0x0394('0x35')](_0x24e2e9,_0x0394('0x2c'));_0x10a363[_0x0394('0x36')]=_['keys'](_0x537fb8[_0x0394('0x36')]);_0x10a363[_0x0394('0x37')]=_[_0x0394('0x38')](_0x10a363[_0x0394('0x34')],_0x10a363[_0x0394('0x36')]);_0x284dfd[_0x0394('0x39')]=_['intersection'](_0x10a363[_0x0394('0x34')],qs['fields'](_0x537fb8[_0x0394('0x36')][_0x0394('0x3a')]));_0x284dfd['attributes']=_0x284dfd[_0x0394('0x39')][_0x0394('0x3b')]?_0x284dfd[_0x0394('0x39')]:_0x10a363[_0x0394('0x34')];if(!_0x537fb8[_0x0394('0x36')]['hasOwnProperty'](_0x0394('0x3c'))){_0x284dfd['limit']=qs[_0x0394('0x1e')](_0x537fb8[_0x0394('0x36')][_0x0394('0x1e')]);_0x284dfd[_0x0394('0x1c')]=qs['offset'](_0x537fb8[_0x0394('0x36')][_0x0394('0x1c')]);}_0x284dfd[_0x0394('0x3d')]=qs[_0x0394('0x3e')](_0x537fb8[_0x0394('0x36')]['sort']);_0x284dfd[_0x0394('0x3f')]=qs[_0x0394('0x37')](_[_0x0394('0x40')](_0x537fb8[_0x0394('0x36')],_0x10a363[_0x0394('0x37')]),_0x24e2e9);if(_0x537fb8[_0x0394('0x36')][_0x0394('0x41')]){_0x284dfd[_0x0394('0x3f')]=_[_0x0394('0x42')](_0x284dfd[_0x0394('0x3f')],{'$or':_[_0x0394('0x35')](_0x24e2e9,function(_0xcce804){if(_0xcce804[_0x0394('0x32')]!==_0x0394('0x43')){var _0x4d2fa6={};_0x4d2fa6[_0xcce804[_0x0394('0x2c')]]={'$like':'%'+_0x537fb8[_0x0394('0x36')][_0x0394('0x41')]+'%'};return _0x4d2fa6;}})});}_0x284dfd=_[_0x0394('0x42')]({},_0x284dfd,_0x537fb8[_0x0394('0x44')]);var _0x46913b={'where':_0x284dfd[_0x0394('0x3f')]};return db[_0x0394('0x2f')][_0x0394('0x1f')](_0x46913b)[_0x0394('0x26')](function(_0x2d218f){_0x4c2df3[_0x0394('0x1f')]=_0x2d218f;if(_0x537fb8[_0x0394('0x36')]['includeAll']){_0x284dfd['include']=[{'all':!![]}];}return db[_0x0394('0x2f')]['findAll'](_0x284dfd);})['then'](function(_0x3e97bd){_0x4c2df3['rows']=_0x3e97bd;return _0x4c2df3;})[_0x0394('0x26')](respondWithFilteredResult(_0x1060b0,_0x284dfd))[_0x0394('0x45')](handleError(_0x1060b0,null));};exports[_0x0394('0x46')]=function(_0x30be71,_0x487593){var _0x14eb57={'raw':![],'where':{'id':_0x30be71[_0x0394('0x47')]['id']}},_0x39804a={};_0x39804a[_0x0394('0x34')]=_[_0x0394('0x48')](db[_0x0394('0x2f')][_0x0394('0x30')]);_0x39804a[_0x0394('0x36')]=_[_0x0394('0x48')](_0x30be71[_0x0394('0x36')]);_0x39804a['filters']=_[_0x0394('0x38')](_0x39804a[_0x0394('0x34')],_0x39804a[_0x0394('0x36')]);_0x14eb57[_0x0394('0x39')]=_['intersection'](_0x39804a[_0x0394('0x34')],qs['fields'](_0x30be71[_0x0394('0x36')][_0x0394('0x3a')]));_0x14eb57[_0x0394('0x39')]=_0x14eb57[_0x0394('0x39')]['length']?_0x14eb57[_0x0394('0x39')]:_0x39804a['model'];if(_0x30be71['query'][_0x0394('0x49')]){_0x14eb57[_0x0394('0x4a')]=[{'all':!![]}];}_0x14eb57=_['merge']({},_0x14eb57,_0x30be71[_0x0394('0x44')]);return db[_0x0394('0x2f')][_0x0394('0x4b')](_0x14eb57)[_0x0394('0x26')](handleEntityNotFound(_0x487593,null))['then'](respondWithResult(_0x487593,null))[_0x0394('0x45')](handleError(_0x487593,null));};exports['create']=function(_0x172c3c,_0x57a8ce){return db[_0x0394('0x2f')][_0x0394('0x4c')](_0x172c3c['body'],{})[_0x0394('0x26')](function(_0x44969b){var _0x134047=_0x172c3c[_0x0394('0x4d')][_0x0394('0x28')]({'plain':!![]});if(!_0x134047)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x134047['role']===_0x0394('0x4d')){var _0x1d3dd0=_0x44969b[_0x0394('0x28')]({'plain':!![]});var _0x204365=_0x0394('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x204365,'userProfileId':_0x134047[_0x0394('0x4e')]},'raw':!![]})[_0x0394('0x26')](function(_0x44c883){if(_0x44c883&&_0x44c883[_0x0394('0x4f')]===0x0){return db[_0x0394('0x50')]['create']({'name':_0x1d3dd0[_0x0394('0x2c')],'resourceId':_0x1d3dd0['id'],'type':_0x44c883[_0x0394('0x2c')],'sectionId':_0x44c883['id']},{})[_0x0394('0x26')](function(){return _0x44969b;});}else{return _0x44969b;}})[_0x0394('0x45')](function(_0x1664bc){logger['error'](_0x0394('0x51'),_0x1664bc);throw _0x1664bc;});}return _0x44969b;})[_0x0394('0x26')](respondWithResult(_0x57a8ce,0xc9))['catch'](handleError(_0x57a8ce,null));};exports[_0x0394('0x52')]=function(_0xa22f9a,_0x208875){var _0x360b2d={'where':{'id':_0xa22f9a[_0x0394('0x47')]['id']}},_0x202d41={};_0x202d41[_0x0394('0x34')]=_[_0x0394('0x48')](db['JscriptyProject']['rawAttributes']);_0x360b2d[_0x0394('0x39')]=_[_0x0394('0x38')](_0x202d41[_0x0394('0x34')],qs[_0x0394('0x3a')](_0xa22f9a[_0x0394('0x36')][_0x0394('0x3a')]));_0x360b2d[_0x0394('0x39')]=_0x360b2d[_0x0394('0x39')][_0x0394('0x3b')]?_0x360b2d[_0x0394('0x39')]:_0x202d41[_0x0394('0x34')];if(_0xa22f9a[_0x0394('0x36')]['includeAll']){_0x360b2d[_0x0394('0x4a')]=[{'all':!![]}];}_0x360b2d=_[_0x0394('0x42')]({},_0x360b2d,_0xa22f9a[_0x0394('0x44')]);return db[_0x0394('0x2f')][_0x0394('0x4b')](_0x360b2d)[_0x0394('0x26')](handleEntityNotFound(_0x208875,null))[_0x0394('0x26')](function(_0x31120d){if(_0x31120d){var _0x279dd7=_0x31120d[_0x0394('0x28')]({'plain':!![]});_0x279dd7=qs['omit'](_0x279dd7,['id',_0x0394('0x53'),_0x0394('0x54')]);_0xa22f9a[_0x0394('0x55')]=_[_0x0394('0x56')](_0xa22f9a['body'],['id',_0x0394('0x53'),'updatedAt']);return db[_0x0394('0x2f')]['create'](_[_0x0394('0x42')](_0x279dd7,_0xa22f9a[_0x0394('0x55')]),{'include':_0xa22f9a['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x48dc5e){var _0x350b7f=_0xa22f9a['user'][_0x0394('0x28')]({'plain':!![]});if(!_0x350b7f)throw new Error(_0x0394('0x57'));if(_0x350b7f['role']==='user'){var _0x43e131=_0x48dc5e[_0x0394('0x28')]({'plain':!![]});var _0x3c360b=_0x0394('0x29');return db[_0x0394('0x58')][_0x0394('0x4b')]({'where':{'name':_0x3c360b,'userProfileId':_0x350b7f[_0x0394('0x4e')]},'raw':!![]})['then'](function(_0x59fb62){if(_0x59fb62&&_0x59fb62['autoAssociation']===0x0){return db[_0x0394('0x50')]['create']({'name':_0x43e131[_0x0394('0x2c')],'resourceId':_0x43e131['id'],'type':_0x59fb62[_0x0394('0x2c')],'sectionId':_0x59fb62['id']},{})[_0x0394('0x26')](function(){return _0x48dc5e;});}else{return _0x48dc5e;}})[_0x0394('0x45')](function(_0x5cbcbe){logger[_0x0394('0x2a')](_0x0394('0x51'),_0x5cbcbe);throw _0x5cbcbe;});}return _0x48dc5e;});}})['then'](respondWithResult(_0x208875,0xc9))['catch'](handleError(_0x208875,null));};exports[_0x0394('0x25')]=function(_0x34154a,_0x3bce00){if(_0x34154a[_0x0394('0x55')]['id']){delete _0x34154a['body']['id'];}return db[_0x0394('0x2f')][_0x0394('0x4b')]({'where':{'id':_0x34154a['params']['id']}})[_0x0394('0x26')](handleEntityNotFound(_0x3bce00,null))[_0x0394('0x26')](saveUpdates(_0x34154a['body'],null))['then'](respondWithResult(_0x3bce00,null))['catch'](handleError(_0x3bce00,null));};exports[_0x0394('0x27')]=function(_0x8ad569,_0x4e062d){return db['JscriptyProject'][_0x0394('0x4b')]({'where':{'id':_0x8ad569['params']['id']}})['then'](handleEntityNotFound(_0x4e062d,null))['then'](removeEntity(_0x4e062d,null))[_0x0394('0x45')](handleError(_0x4e062d,null));};exports[_0x0394('0x59')]=function(_0x323742,_0x21bb4d,_0x42cb6a){var _0x2a7ea5={'raw':!![],'where':{}};var _0x4aa1d1={};var _0x2dba0d={'count':0x0,'rows':[]};return db[_0x0394('0x2f')][_0x0394('0x5a')]({'where':{'id':_0x323742[_0x0394('0x47')]['id']}})['then'](handleEntityNotFound(_0x21bb4d,null))[_0x0394('0x26')](function(_0x1140b0){if(_0x1140b0){_0x4aa1d1[_0x0394('0x34')]=_[_0x0394('0x48')](db[_0x0394('0x5b')][_0x0394('0x30')]);_0x4aa1d1[_0x0394('0x36')]=_[_0x0394('0x48')](_0x323742[_0x0394('0x36')]);_0x4aa1d1['filters']=_[_0x0394('0x38')](_0x4aa1d1[_0x0394('0x34')],_0x4aa1d1[_0x0394('0x36')]);_0x2a7ea5[_0x0394('0x39')]=_[_0x0394('0x38')](_0x4aa1d1[_0x0394('0x34')],qs[_0x0394('0x3a')](_0x323742[_0x0394('0x36')]['fields']));_0x2a7ea5[_0x0394('0x39')]=_0x2a7ea5[_0x0394('0x39')]['length']?_0x2a7ea5[_0x0394('0x39')]:_0x4aa1d1['model'];if(!_0x323742[_0x0394('0x36')][_0x0394('0x5c')](_0x0394('0x3c'))){_0x2a7ea5[_0x0394('0x1e')]=qs[_0x0394('0x1e')](_0x323742[_0x0394('0x36')][_0x0394('0x1e')]);_0x2a7ea5[_0x0394('0x1c')]=qs[_0x0394('0x1c')](_0x323742[_0x0394('0x36')][_0x0394('0x1c')]);}_0x2a7ea5[_0x0394('0x3d')]=qs[_0x0394('0x3e')](_0x323742[_0x0394('0x36')]['sort']);_0x2a7ea5[_0x0394('0x3f')]=qs[_0x0394('0x37')](_[_0x0394('0x40')](_0x323742['query'],_0x4aa1d1[_0x0394('0x37')]));_0x2a7ea5[_0x0394('0x3f')][_0x0394('0x5d')]=_0x1140b0['id'];if(_0x323742[_0x0394('0x36')][_0x0394('0x41')]){_0x2a7ea5[_0x0394('0x3f')]=_[_0x0394('0x42')](_0x2a7ea5['where'],{'$or':_[_0x0394('0x35')](_0x2a7ea5[_0x0394('0x39')],function(_0xb3513b){var _0x17e1d8={};_0x17e1d8[_0xb3513b]={'$like':'%'+_0x323742['query'][_0x0394('0x41')]+'%'};return _0x17e1d8;})});}_0x2a7ea5=_['merge']({},_0x2a7ea5,_0x323742[_0x0394('0x44')]);return db[_0x0394('0x5b')][_0x0394('0x1f')]({'where':_0x2a7ea5[_0x0394('0x3f')]})[_0x0394('0x26')](function(_0x43c4b9){_0x2dba0d['count']=_0x43c4b9;if(_0x323742[_0x0394('0x36')][_0x0394('0x49')]){_0x2a7ea5[_0x0394('0x4a')]=[{'all':!![]}];}return db[_0x0394('0x5b')]['findAll'](_0x2a7ea5);})[_0x0394('0x26')](function(_0x588abd){_0x2dba0d[_0x0394('0x5e')]=_0x588abd;return _0x2dba0d;});}})['then'](respondWithFilteredResult(_0x21bb4d,_0x2a7ea5))[_0x0394('0x45')](handleError(_0x21bb4d,null));};exports[_0x0394('0x5f')]=function(_0x57d148,_0x5e51dc,_0x446057){var _0x518662={'raw':!![],'where':{}};var _0x3f1cb6={};var _0x462b04={'count':0x0,'rows':[]};return db[_0x0394('0x2f')][_0x0394('0x5a')]({'where':{'id':_0x57d148['params']['id']}})['then'](handleEntityNotFound(_0x5e51dc,null))[_0x0394('0x26')](function(_0x82e170){if(_0x82e170){_0x3f1cb6['model']=_[_0x0394('0x48')](db['JscriptyAnswerReport'][_0x0394('0x30')]);_0x3f1cb6[_0x0394('0x36')]=_[_0x0394('0x48')](_0x57d148[_0x0394('0x36')]);_0x3f1cb6['filters']=_[_0x0394('0x38')](_0x3f1cb6[_0x0394('0x34')],_0x3f1cb6[_0x0394('0x36')]);_0x518662[_0x0394('0x39')]=_[_0x0394('0x38')](_0x3f1cb6[_0x0394('0x34')],qs[_0x0394('0x3a')](_0x57d148['query'][_0x0394('0x3a')]));_0x518662[_0x0394('0x39')]=_0x518662['attributes'][_0x0394('0x3b')]?_0x518662[_0x0394('0x39')]:_0x3f1cb6[_0x0394('0x34')];if(!_0x57d148['query']['hasOwnProperty'](_0x0394('0x3c'))){_0x518662[_0x0394('0x1e')]=qs[_0x0394('0x1e')](_0x57d148[_0x0394('0x36')][_0x0394('0x1e')]);_0x518662[_0x0394('0x1c')]=qs[_0x0394('0x1c')](_0x57d148[_0x0394('0x36')][_0x0394('0x1c')]);}_0x518662[_0x0394('0x3d')]=qs[_0x0394('0x3e')](_0x57d148[_0x0394('0x36')]['sort']);_0x518662[_0x0394('0x3f')]=qs[_0x0394('0x37')](_[_0x0394('0x40')](_0x57d148['query'],_0x3f1cb6['filters']));_0x518662[_0x0394('0x3f')][_0x0394('0x5d')]=_0x82e170['id'];if(_0x57d148['query'][_0x0394('0x41')]){_0x518662['where']=_[_0x0394('0x42')](_0x518662[_0x0394('0x3f')],{'$or':_[_0x0394('0x35')](_0x518662['attributes'],function(_0x9ebfa1){var _0x3f73c3={};_0x3f73c3[_0x9ebfa1]={'$like':'%'+_0x57d148[_0x0394('0x36')]['filter']+'%'};return _0x3f73c3;})});}_0x518662=_['merge']({},_0x518662,_0x57d148['options']);return db['JscriptyAnswerReport'][_0x0394('0x1f')]({'where':_0x518662[_0x0394('0x3f')]})[_0x0394('0x26')](function(_0x463658){_0x462b04[_0x0394('0x1f')]=_0x463658;if(_0x57d148[_0x0394('0x36')][_0x0394('0x49')]){_0x518662[_0x0394('0x4a')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x0394('0x60')](_0x518662);})[_0x0394('0x26')](function(_0x29bdee){_0x462b04[_0x0394('0x5e')]=_0x29bdee;return _0x462b04;});}})[_0x0394('0x26')](respondWithFilteredResult(_0x5e51dc,_0x518662))['catch'](handleError(_0x5e51dc,null));};function char(_0x550ce1){return'number'===typeof _0x550ce1?String['fromCharCode']['apply'](null,arguments):_0x550ce1;}function needsEncapsulation(_0x306fec){return!!_0x306fec&&(_0x306fec['toString']()['indexOf'](char(0xd))>=0x0||_0x306fec[_0x0394('0x61')]()[_0x0394('0x62')](char(0xa))>=0x0||_0x306fec[_0x0394('0x61')]()['indexOf'](char(0x2c))>=0x0||_0x306fec[_0x0394('0x61')]()[_0x0394('0x62')](char(0x22))>=0x0);}function encapsulate(_0x38f46f){var _0x575528=char(0x22),_0x2eb0a5='\x5c'+char(0x22),_0x30810e=_0x38f46f['toString']()['replace'](new RegExp(_0x575528,'g'),_0x2eb0a5);return _0x575528+_0x30810e+_0x575528;}exports[_0x0394('0x63')]=function(_0x51a22b,_0x4d9a37,_0x1296a2){var _0x171215,_0x570c2c;var _0x493703={'where':{'ProjectId':_0x51a22b[_0x0394('0x47')]['id']}};if(_0x51a22b['query']['startTime']){_0x493703[_0x0394('0x3f')][_0x0394('0x64')]=JSON[_0x0394('0x65')](_0x51a22b[_0x0394('0x36')][_0x0394('0x66')]);}return db[_0x0394('0x5b')]['findAll'](_0x493703)[_0x0394('0x26')](handleEntityNotFound(_0x4d9a37,null))[_0x0394('0x26')](function(_0xdc0ab2){if(_0xdc0ab2){_0x171215=_0xdc0ab2;return db[_0x0394('0x67')][_0x0394('0x60')]({'where':{'SessionId':{'$in':_['map'](_0x171215,'id')},'ProjectId':_0x51a22b[_0x0394('0x47')]['id']},'order':_0x0394('0x68')});}})[_0x0394('0x26')](handleEntityNotFound(_0x4d9a37,null))['then'](function(_0x120213){if(_0x120213){_0x570c2c=_0x120213;var _0x48dd85={};for(var _0x2726ec=0x0,_0x310161=_0x570c2c[_0x0394('0x3b')];_0x2726ec<_0x310161;_0x2726ec++){if(!_0x48dd85[_0x0394('0x5c')](_0x570c2c[_0x2726ec]['questionId'])){_0x48dd85[_0x570c2c[_0x2726ec][_0x0394('0x69')]]=needsEncapsulation(_0x570c2c[_0x2726ec]['question'])?encapsulate(_0x570c2c[_0x2726ec]['question']):_0x570c2c[_0x2726ec][_0x0394('0x6a')];}}var _0x13c180=[],_0x5b53dc={};for(var _0x432868=0x0,_0x48443f=_0x171215['length'];_0x432868<_0x48443f;_0x432868++){_0x5b53dc={'ProjectId':_0x51a22b['params']['id'],'SessionId':_0x171215[_0x432868]['id'],'StartTime':moment(_0x171215[_0x432868][_0x0394('0x64')])[_0x0394('0x6b')](_0x0394('0x6c'))};for(var _0x21cec4=0x0,_0x188562=_0x570c2c['length'];_0x21cec4<_0x188562;_0x21cec4++){if(_0x570c2c[_0x21cec4]['SessionId']==_0x171215[_0x432868]['id']&&_0x48dd85[_0x0394('0x5c')](_0x570c2c[_0x21cec4][_0x0394('0x69')])){_0x5b53dc[_0x48dd85[_0x570c2c[_0x21cec4][_0x0394('0x69')]]]=_0x570c2c[_0x21cec4][_0x0394('0x6d')];}}for(var _0x36c44e in _0x48dd85){if(!_0x5b53dc['hasOwnProperty'](_0x48dd85[_0x36c44e])){_0x5b53dc[_0x48dd85[_0x36c44e]]=null;}}_0x13c180['push'](_0x5b53dc);}return _0x13c180;}})[_0x0394('0x26')](function(_0x3a2fc4){if(!_[_0x0394('0x6e')](_0x3a2fc4)){var _0x13eec8=toCsv(_0x3a2fc4);var _0x50bdf7=Date[_0x0394('0x6f')]();fs[_0x0394('0x70')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x51a22b[_0x0394('0x47')]['id'],_0x50bdf7),_0x13eec8);_0x4d9a37[_0x0394('0x71')](_0x0394('0x72'),_0x0394('0x73')+util[_0x0394('0x6b')](_0x0394('0x74'),_0x51a22b[_0x0394('0x47')]['id'],_0x50bdf7));_0x4d9a37[_0x0394('0x71')](_0x0394('0x75'),'text/csv');return _0x4d9a37[_0x0394('0x76')](util[_0x0394('0x6b')](_0x0394('0x77'),_0x51a22b['params']['id'],_0x50bdf7));}else{return _0x4d9a37[_0x0394('0x18')](0xcc);}})[_0x0394('0x45')](handleError(_0x4d9a37,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 24181df..f89515d 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 _0x3c94=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment'];(function(_0x306a99,_0x334882){var _0x4b41f8=function(_0x222064){while(--_0x222064){_0x306a99['push'](_0x306a99['shift']());}};_0x4b41f8(++_0x334882);}(_0x3c94,0xcd));var _0x43c9=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x3c94[_0x3b594b];return _0x1ea5f8;};'use strict';var _=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var logger=require(_0x43c9('0x2'))(_0x43c9('0x3'));var moment=require(_0x43c9('0x4'));var BPromise=require(_0x43c9('0x5'));var rp=require(_0x43c9('0x6'));var fs=require('fs');var path=require(_0x43c9('0x7'));var rimraf=require(_0x43c9('0x8'));var config=require(_0x43c9('0x9'));var attributes=require(_0x43c9('0xa'));module[_0x43c9('0xb')]=function(_0x4fdfc2,_0x39c220){return _0x4fdfc2[_0x43c9('0xc')](_0x43c9('0xd'),attributes,{'tableName':_0x43c9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29d4=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','../../config/logger','api'];(function(_0x3d19ab,_0x22831a){var _0x14db41=function(_0x5021cf){while(--_0x5021cf){_0x3d19ab['push'](_0x3d19ab['shift']());}};_0x14db41(++_0x22831a);}(_0x29d4,0x1a1));var _0x429d=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x29d4[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var moment=require(_0x429d('0x3'));var BPromise=require(_0x429d('0x4'));var rp=require(_0x429d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var attributes=require(_0x429d('0x8'));module[_0x429d('0x9')]=function(_0x1c55aa,_0xa71445){return _0x1c55aa[_0x429d('0xa')](_0x429d('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 5aa947c..99bb0cd 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x245dc0,_0x555f94){var _0x22f2a2=function(_0x5811a1){while(--_0x5811a1){_0x245dc0['push'](_0x245dc0['shift']());}};_0x22f2a2(++_0x555f94);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29bf80,_0x4af855){_0x29bf80=_0x29bf80-0x0;var _0x932096=_0xcb91[_0x29bf80];return _0x932096;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5481a9,_0x59fe7d){var _0x1d8fe6=function(_0x3278a0){while(--_0x3278a0){_0x5481a9['push'](_0x5481a9['shift']());}};_0x1d8fe6(++_0x59fe7d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3d5019,_0x29a32b){_0x3d5019=_0x3d5019-0x0;var _0x5670a6=_0xb43b[_0x3d5019];return _0x5670a6;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 598dc5d..7c436d6 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 _0x6f84=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0xf5c5ce,_0x1125d4){var _0x4e9c5c=function(_0x118fa2){while(--_0x118fa2){_0xf5c5ce['push'](_0xf5c5ce['shift']());}};_0x4e9c5c(++_0x1125d4);}(_0x6f84,0x155));var _0x46f8=function(_0x5832e1,_0x588e7e){_0x5832e1=_0x5832e1-0x0;var _0xc55d21=_0x6f84[_0x5832e1];return _0xc55d21;};'use strict';var multer=require('multer');var util=require(_0x46f8('0x0'));var path=require(_0x46f8('0x1'));var timeout=require(_0x46f8('0x2'));var express=require(_0x46f8('0x3'));var router=express[_0x46f8('0x4')]();var fs_extra=require(_0x46f8('0x5'));var auth=require(_0x46f8('0x6'));var interaction=require(_0x46f8('0x7'));var config=require(_0x46f8('0x8'));var controller=require(_0x46f8('0x9'));router[_0x46f8('0xa')]('/',auth[_0x46f8('0xb')](),controller[_0x46f8('0xc')]);router[_0x46f8('0xa')](_0x46f8('0xd'),auth[_0x46f8('0xb')](),controller[_0x46f8('0xe')]);router[_0x46f8('0xa')](_0x46f8('0xf'),auth[_0x46f8('0xb')](),controller[_0x46f8('0x10')]);router[_0x46f8('0x11')]('/',auth[_0x46f8('0xb')](),controller[_0x46f8('0x12')]);router[_0x46f8('0x13')](_0x46f8('0xf'),auth['isAuthenticated'](),controller[_0x46f8('0x14')]);router[_0x46f8('0x15')](_0x46f8('0xf'),auth['isAuthenticated'](),controller[_0x46f8('0x16')]);module[_0x46f8('0x17')]=router; \ No newline at end of file +var _0x660e=['describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3271c7,_0x52d9c3){var _0x36e21e=function(_0x34337d){while(--_0x34337d){_0x3271c7['push'](_0x3271c7['shift']());}};_0x36e21e(++_0x52d9c3);}(_0x660e,0xa9));var _0xe660=function(_0x49920d,_0x2a06da){_0x49920d=_0x49920d-0x0;var _0x543df5=_0x660e[_0x49920d];return _0x543df5;};'use strict';var multer=require(_0xe660('0x0'));var util=require(_0xe660('0x1'));var path=require(_0xe660('0x2'));var timeout=require(_0xe660('0x3'));var express=require(_0xe660('0x4'));var router=express[_0xe660('0x5')]();var fs_extra=require(_0xe660('0x6'));var auth=require(_0xe660('0x7'));var interaction=require(_0xe660('0x8'));var config=require(_0xe660('0x9'));var controller=require(_0xe660('0xa'));router[_0xe660('0xb')]('/',auth[_0xe660('0xc')](),controller[_0xe660('0xd')]);router[_0xe660('0xb')](_0xe660('0xe'),auth['isAuthenticated'](),controller[_0xe660('0xf')]);router[_0xe660('0xb')](_0xe660('0x10'),auth[_0xe660('0xc')](),controller[_0xe660('0x11')]);router[_0xe660('0x12')]('/',auth[_0xe660('0xc')](),controller[_0xe660('0x13')]);router[_0xe660('0x14')](_0xe660('0x10'),auth[_0xe660('0xc')](),controller['update']);router[_0xe660('0x15')]('/:id',auth[_0xe660('0xc')](),controller[_0xe660('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 1123d13..874b33b 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x2bb84d,_0x581a4c){_0x2bb84d=_0x2bb84d-0x0;var _0x37036e=_0x7a54[_0x2bb84d];return _0x37036e;};'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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x584074,_0x54f08a){_0x584074=_0x584074-0x0;var _0x35e325=_0x7a54[_0x584074];return _0x35e325;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 730108b..d999529 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 _0x6e3f=['VIRTUAL','options','includeAll','include','then','rows','catch','params','keys','rawAttributes','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','error','stack','name','index','map','JscriptyQuestionReport','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e3f,0x12f));var _0xf6e3=function(_0x5b52a9,_0x4bad9d){_0x5b52a9=_0x5b52a9-0x0;var _0x399dbb=_0x6e3f[_0x5b52a9];return _0x399dbb;};'use strict';var emlformat=require(_0xf6e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6e3('0x1'));var jsonpatch=require(_0xf6e3('0x2'));var rp=require(_0xf6e3('0x3'));var moment=require(_0xf6e3('0x4'));var BPromise=require(_0xf6e3('0x5'));var Mustache=require(_0xf6e3('0x6'));var util=require('util');var path=require(_0xf6e3('0x7'));var sox=require('sox');var csv=require(_0xf6e3('0x8'));var ejs=require(_0xf6e3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6e3('0xa'));var squel=require('squel');var crypto=require(_0xf6e3('0xb'));var jsforce=require(_0xf6e3('0xc'));var deskjs=require(_0xf6e3('0xd'));var toCsv=require(_0xf6e3('0x8'));var querystring=require(_0xf6e3('0xe'));var Papa=require(_0xf6e3('0xf'));var Redis=require(_0xf6e3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6e3('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf6e3('0x12'));var config=require(_0xf6e3('0x13'));var licenseUtil=require(_0xf6e3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x576bd7,_0x16d8b9){_0x16d8b9=_0x16d8b9||0xcc;return function(_0x30ab07){if(_0x30ab07){return _0x576bd7[_0xf6e3('0x15')](_0x16d8b9);}return _0x576bd7[_0xf6e3('0x16')](_0x16d8b9)[_0xf6e3('0x17')]();};}function respondWithResult(_0x2d7dcf,_0x3f9e9e){_0x3f9e9e=_0x3f9e9e||0xc8;return function(_0x13550c){if(_0x13550c){return _0x2d7dcf[_0xf6e3('0x16')](_0x3f9e9e)[_0xf6e3('0x18')](_0x13550c);}};}function respondWithFilteredResult(_0x5c0512,_0x3594df){return function(_0x4e2e03){if(_0x4e2e03){var _0x2c9731=typeof _0x3594df[_0xf6e3('0x19')]==='undefined'&&typeof _0x3594df[_0xf6e3('0x1a')]===_0xf6e3('0x1b');var _0x339d50=_0x4e2e03[_0xf6e3('0x1c')];var _0x1e65f9=_0x2c9731?0x0:_0x3594df[_0xf6e3('0x19')];var _0x173e4c=_0x2c9731?_0x4e2e03['count']:_0x3594df[_0xf6e3('0x19')]+_0x3594df[_0xf6e3('0x1a')];var _0x6c58a6;if(_0x173e4c>=_0x339d50){_0x173e4c=_0x339d50;_0x6c58a6=0xc8;}else{_0x6c58a6=0xce;}_0x5c0512[_0xf6e3('0x16')](_0x6c58a6);return _0x5c0512[_0xf6e3('0x1d')](_0xf6e3('0x1e'),_0x1e65f9+'-'+_0x173e4c+'/'+_0x339d50)['json'](_0x4e2e03);}return null;};}function patchUpdates(_0x111173){return function(_0x2d7493){try{jsonpatch[_0xf6e3('0x1f')](_0x2d7493,_0x111173,!![]);}catch(_0x55902f){return BPromise[_0xf6e3('0x20')](_0x55902f);}return _0x2d7493[_0xf6e3('0x21')]();};}function saveUpdates(_0xc09394,_0xff1db8){return function(_0x13efb8){if(_0x13efb8){return _0x13efb8[_0xf6e3('0x22')](_0xc09394)['then'](function(_0x26dd6c){return _0x26dd6c;});}return null;};}function removeEntity(_0x322f6c,_0x45c555){return function(_0x2143a5){if(_0x2143a5){return _0x2143a5['destroy']()['then'](function(){_0x322f6c[_0xf6e3('0x16')](0xcc)[_0xf6e3('0x17')]();});}};}function handleEntityNotFound(_0x5a35df,_0xe07956){return function(_0x721e80){if(!_0x721e80){_0x5a35df['sendStatus'](0x194);}return _0x721e80;};}function handleError(_0x1f4451,_0x543826){_0x543826=_0x543826||0x1f4;return function(_0x50560c){logger[_0xf6e3('0x23')](_0x50560c[_0xf6e3('0x24')]);if(_0x50560c['name']){delete _0x50560c[_0xf6e3('0x25')];}_0x1f4451['status'](_0x543826)['send'](_0x50560c);};}exports[_0xf6e3('0x26')]=function(_0x58f78b,_0x403049){var _0x3313f8={},_0x405cfe={},_0x4b1ee2={'count':0x0,'rows':[]};var _0xfbfbc1=_[_0xf6e3('0x27')](db[_0xf6e3('0x28')]['rawAttributes'],function(_0x56c25c){return{'name':_0x56c25c['fieldName'],'type':_0x56c25c[_0xf6e3('0x29')][_0xf6e3('0x2a')]};});_0x405cfe[_0xf6e3('0x2b')]=_['map'](_0xfbfbc1,'name');_0x405cfe['query']=_['keys'](_0x58f78b[_0xf6e3('0x2c')]);_0x405cfe[_0xf6e3('0x2d')]=_[_0xf6e3('0x2e')](_0x405cfe[_0xf6e3('0x2b')],_0x405cfe[_0xf6e3('0x2c')]);_0x3313f8[_0xf6e3('0x2f')]=_[_0xf6e3('0x2e')](_0x405cfe[_0xf6e3('0x2b')],qs[_0xf6e3('0x30')](_0x58f78b[_0xf6e3('0x2c')][_0xf6e3('0x30')]));_0x3313f8[_0xf6e3('0x2f')]=_0x3313f8[_0xf6e3('0x2f')][_0xf6e3('0x31')]?_0x3313f8[_0xf6e3('0x2f')]:_0x405cfe[_0xf6e3('0x2b')];if(!_0x58f78b['query'][_0xf6e3('0x32')](_0xf6e3('0x33'))){_0x3313f8['limit']=qs[_0xf6e3('0x1a')](_0x58f78b[_0xf6e3('0x2c')][_0xf6e3('0x1a')]);_0x3313f8['offset']=qs['offset'](_0x58f78b[_0xf6e3('0x2c')][_0xf6e3('0x19')]);}_0x3313f8[_0xf6e3('0x34')]=qs[_0xf6e3('0x35')](_0x58f78b[_0xf6e3('0x2c')][_0xf6e3('0x35')]);_0x3313f8[_0xf6e3('0x36')]=qs[_0xf6e3('0x2d')](_[_0xf6e3('0x37')](_0x58f78b['query'],_0x405cfe[_0xf6e3('0x2d')]),_0xfbfbc1);if(_0x58f78b[_0xf6e3('0x2c')]['filter']){_0x3313f8[_0xf6e3('0x36')]=_[_0xf6e3('0x38')](_0x3313f8['where'],{'$or':_['map'](_0xfbfbc1,function(_0x75f9b8){if(_0x75f9b8[_0xf6e3('0x29')]!==_0xf6e3('0x39')){var _0x2b1414={};_0x2b1414[_0x75f9b8[_0xf6e3('0x25')]]={'$like':'%'+_0x58f78b[_0xf6e3('0x2c')]['filter']+'%'};return _0x2b1414;}})});}_0x3313f8=_[_0xf6e3('0x38')]({},_0x3313f8,_0x58f78b[_0xf6e3('0x3a')]);var _0xd85393={'where':_0x3313f8[_0xf6e3('0x36')]};return db[_0xf6e3('0x28')]['count'](_0xd85393)['then'](function(_0x34f38f){_0x4b1ee2['count']=_0x34f38f;if(_0x58f78b[_0xf6e3('0x2c')][_0xf6e3('0x3b')]){_0x3313f8[_0xf6e3('0x3c')]=[{'all':!![]}];}return db[_0xf6e3('0x28')]['findAll'](_0x3313f8);})[_0xf6e3('0x3d')](function(_0x3eeb0a){_0x4b1ee2[_0xf6e3('0x3e')]=_0x3eeb0a;return _0x4b1ee2;})[_0xf6e3('0x3d')](respondWithFilteredResult(_0x403049,_0x3313f8))[_0xf6e3('0x3f')](handleError(_0x403049,null));};exports['show']=function(_0x1ab3ef,_0x392f2f){var _0xa26ce8={'raw':!![],'where':{'id':_0x1ab3ef[_0xf6e3('0x40')]['id']}},_0xcd9987={};_0xcd9987[_0xf6e3('0x2b')]=_[_0xf6e3('0x41')](db[_0xf6e3('0x28')][_0xf6e3('0x42')]);_0xcd9987['query']=_[_0xf6e3('0x41')](_0x1ab3ef[_0xf6e3('0x2c')]);_0xcd9987[_0xf6e3('0x2d')]=_[_0xf6e3('0x2e')](_0xcd9987[_0xf6e3('0x2b')],_0xcd9987[_0xf6e3('0x2c')]);_0xa26ce8[_0xf6e3('0x2f')]=_['intersection'](_0xcd9987[_0xf6e3('0x2b')],qs[_0xf6e3('0x30')](_0x1ab3ef['query'][_0xf6e3('0x30')]));_0xa26ce8[_0xf6e3('0x2f')]=_0xa26ce8[_0xf6e3('0x2f')][_0xf6e3('0x31')]?_0xa26ce8['attributes']:_0xcd9987[_0xf6e3('0x2b')];if(_0x1ab3ef[_0xf6e3('0x2c')][_0xf6e3('0x3b')]){_0xa26ce8[_0xf6e3('0x3c')]=[{'all':!![]}];}_0xa26ce8=_['merge']({},_0xa26ce8,_0x1ab3ef[_0xf6e3('0x3a')]);return db[_0xf6e3('0x28')][_0xf6e3('0x43')](_0xa26ce8)[_0xf6e3('0x3d')](handleEntityNotFound(_0x392f2f,null))['then'](respondWithResult(_0x392f2f,null))[_0xf6e3('0x3f')](handleError(_0x392f2f,null));};exports['create']=function(_0x18f0e8,_0x2039b4){return db[_0xf6e3('0x28')][_0xf6e3('0x44')](_0x18f0e8[_0xf6e3('0x45')],{})['then'](respondWithResult(_0x2039b4,0xc9))['catch'](handleError(_0x2039b4,null));};exports['update']=function(_0xbe573,_0x20931b){if(_0xbe573['body']['id']){delete _0xbe573[_0xf6e3('0x45')]['id'];}return db[_0xf6e3('0x28')][_0xf6e3('0x43')]({'where':{'id':_0xbe573[_0xf6e3('0x40')]['id']}})['then'](handleEntityNotFound(_0x20931b,null))[_0xf6e3('0x3d')](saveUpdates(_0xbe573['body'],null))[_0xf6e3('0x3d')](respondWithResult(_0x20931b,null))[_0xf6e3('0x3f')](handleError(_0x20931b,null));};exports[_0xf6e3('0x46')]=function(_0x2028bf,_0x1bb4da){return db[_0xf6e3('0x28')]['find']({'where':{'id':_0x2028bf[_0xf6e3('0x40')]['id']}})[_0xf6e3('0x3d')](handleEntityNotFound(_0x1bb4da,null))[_0xf6e3('0x3d')](removeEntity(_0x1bb4da,null))[_0xf6e3('0x3f')](handleError(_0x1bb4da,null));};exports[_0xf6e3('0x47')]=function(_0xb1fce6,_0x2db190){return db['JscriptyQuestionReport'][_0xf6e3('0x47')]()[_0xf6e3('0x3d')](respondWithResult(_0x2db190,null))[_0xf6e3('0x3f')](handleError(_0x2db190,null));}; \ No newline at end of file +var _0x0558=['catch','show','params','find','create','body','describe','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','findAll'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x0558,0x18d));var _0x8055=function(_0x52d231,_0x37bc71){_0x52d231=_0x52d231-0x0;var _0x550ac5=_0x0558[_0x52d231];return _0x550ac5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8055('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8055('0x1'));var moment=require('moment');var BPromise=require(_0x8055('0x2'));var Mustache=require(_0x8055('0x3'));var util=require(_0x8055('0x4'));var path=require(_0x8055('0x5'));var sox=require(_0x8055('0x6'));var csv=require(_0x8055('0x7'));var ejs=require(_0x8055('0x8'));var fs=require('fs');var fs_extra=require(_0x8055('0x9'));var _=require('lodash');var squel=require(_0x8055('0xa'));var crypto=require(_0x8055('0xb'));var jsforce=require(_0x8055('0xc'));var deskjs=require(_0x8055('0xd'));var toCsv=require(_0x8055('0x7'));var querystring=require(_0x8055('0xe'));var Papa=require(_0x8055('0xf'));var Redis=require('ioredis');var authService=require(_0x8055('0x10'));var qs=require(_0x8055('0x11'));var as=require(_0x8055('0x12'));var hardwareService=require(_0x8055('0x13'));var logger=require(_0x8055('0x14'))(_0x8055('0x15'));var utils=require(_0x8055('0x16'));var config=require(_0x8055('0x17'));var licenseUtil=require(_0x8055('0x18'));var db=require(_0x8055('0x19'))['db'];function respondWithStatusCode(_0x5f3f21,_0x44a801){_0x44a801=_0x44a801||0xcc;return function(_0x3f687b){if(_0x3f687b){return _0x5f3f21[_0x8055('0x1a')](_0x44a801);}return _0x5f3f21[_0x8055('0x1b')](_0x44a801)[_0x8055('0x1c')]();};}function respondWithResult(_0x3447fa,_0x4a53ef){_0x4a53ef=_0x4a53ef||0xc8;return function(_0x38369a){if(_0x38369a){return _0x3447fa['status'](_0x4a53ef)['json'](_0x38369a);}};}function respondWithFilteredResult(_0x5760fb,_0x5e51f5){return function(_0xc87bd3){if(_0xc87bd3){var _0x3eda58=typeof _0x5e51f5['offset']===_0x8055('0x1d')&&typeof _0x5e51f5[_0x8055('0x1e')]===_0x8055('0x1d');var _0x2acb9e=_0xc87bd3[_0x8055('0x1f')];var _0x5edacf=_0x3eda58?0x0:_0x5e51f5[_0x8055('0x20')];var _0x1eb235=_0x3eda58?_0xc87bd3[_0x8055('0x1f')]:_0x5e51f5[_0x8055('0x20')]+_0x5e51f5[_0x8055('0x1e')];var _0x518195;if(_0x1eb235>=_0x2acb9e){_0x1eb235=_0x2acb9e;_0x518195=0xc8;}else{_0x518195=0xce;}_0x5760fb[_0x8055('0x1b')](_0x518195);return _0x5760fb[_0x8055('0x21')]('Content-Range',_0x5edacf+'-'+_0x1eb235+'/'+_0x2acb9e)[_0x8055('0x22')](_0xc87bd3);}return null;};}function patchUpdates(_0x1a8b74){return function(_0x304e04){try{jsonpatch[_0x8055('0x23')](_0x304e04,_0x1a8b74,!![]);}catch(_0x1bc4f1){return BPromise[_0x8055('0x24')](_0x1bc4f1);}return _0x304e04[_0x8055('0x25')]();};}function saveUpdates(_0x9b3e08,_0x50d8db){return function(_0x2ae6f9){if(_0x2ae6f9){return _0x2ae6f9[_0x8055('0x26')](_0x9b3e08)[_0x8055('0x27')](function(_0x1df6b4){return _0x1df6b4;});}return null;};}function removeEntity(_0x4995d4,_0x3b5db1){return function(_0x4170c9){if(_0x4170c9){return _0x4170c9[_0x8055('0x28')]()[_0x8055('0x27')](function(){_0x4995d4[_0x8055('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33ffe1,_0x205397){return function(_0x44b2c5){if(!_0x44b2c5){_0x33ffe1[_0x8055('0x1a')](0x194);}return _0x44b2c5;};}function handleError(_0x431c79,_0x31d248){_0x31d248=_0x31d248||0x1f4;return function(_0x2cb163){logger[_0x8055('0x29')](_0x2cb163[_0x8055('0x2a')]);if(_0x2cb163[_0x8055('0x2b')]){delete _0x2cb163['name'];}_0x431c79[_0x8055('0x1b')](_0x31d248)[_0x8055('0x2c')](_0x2cb163);};}exports[_0x8055('0x2d')]=function(_0x3d48e5,_0x41e639){var _0x246a0d={},_0x1aad6b={},_0x387398={'count':0x0,'rows':[]};var _0x58b418=_[_0x8055('0x2e')](db['JscriptyQuestionReport'][_0x8055('0x2f')],function(_0x19950c){return{'name':_0x19950c['fieldName'],'type':_0x19950c[_0x8055('0x30')][_0x8055('0x31')]};});_0x1aad6b[_0x8055('0x32')]=_['map'](_0x58b418,_0x8055('0x2b'));_0x1aad6b[_0x8055('0x33')]=_[_0x8055('0x34')](_0x3d48e5['query']);_0x1aad6b['filters']=_[_0x8055('0x35')](_0x1aad6b[_0x8055('0x32')],_0x1aad6b[_0x8055('0x33')]);_0x246a0d[_0x8055('0x36')]=_[_0x8055('0x35')](_0x1aad6b[_0x8055('0x32')],qs[_0x8055('0x37')](_0x3d48e5[_0x8055('0x33')][_0x8055('0x37')]));_0x246a0d[_0x8055('0x36')]=_0x246a0d[_0x8055('0x36')][_0x8055('0x38')]?_0x246a0d['attributes']:_0x1aad6b[_0x8055('0x32')];if(!_0x3d48e5[_0x8055('0x33')][_0x8055('0x39')](_0x8055('0x3a'))){_0x246a0d['limit']=qs[_0x8055('0x1e')](_0x3d48e5[_0x8055('0x33')]['limit']);_0x246a0d['offset']=qs[_0x8055('0x20')](_0x3d48e5[_0x8055('0x33')][_0x8055('0x20')]);}_0x246a0d['order']=qs[_0x8055('0x3b')](_0x3d48e5[_0x8055('0x33')]['sort']);_0x246a0d[_0x8055('0x3c')]=qs[_0x8055('0x3d')](_[_0x8055('0x3e')](_0x3d48e5[_0x8055('0x33')],_0x1aad6b['filters']),_0x58b418);if(_0x3d48e5[_0x8055('0x33')][_0x8055('0x3f')]){_0x246a0d[_0x8055('0x3c')]=_[_0x8055('0x40')](_0x246a0d['where'],{'$or':_[_0x8055('0x2e')](_0x58b418,function(_0x183ad5){if(_0x183ad5['type']!==_0x8055('0x41')){var _0x160be8={};_0x160be8[_0x183ad5[_0x8055('0x2b')]]={'$like':'%'+_0x3d48e5[_0x8055('0x33')][_0x8055('0x3f')]+'%'};return _0x160be8;}})});}_0x246a0d=_[_0x8055('0x40')]({},_0x246a0d,_0x3d48e5[_0x8055('0x42')]);var _0x4467bd={'where':_0x246a0d[_0x8055('0x3c')]};return db[_0x8055('0x43')][_0x8055('0x1f')](_0x4467bd)['then'](function(_0x23b9e8){_0x387398[_0x8055('0x1f')]=_0x23b9e8;if(_0x3d48e5[_0x8055('0x33')][_0x8055('0x44')]){_0x246a0d[_0x8055('0x45')]=[{'all':!![]}];}return db[_0x8055('0x43')][_0x8055('0x46')](_0x246a0d);})['then'](function(_0x351726){_0x387398['rows']=_0x351726;return _0x387398;})['then'](respondWithFilteredResult(_0x41e639,_0x246a0d))[_0x8055('0x47')](handleError(_0x41e639,null));};exports[_0x8055('0x48')]=function(_0x8d28b1,_0x335f57){var _0x25397a={'raw':!![],'where':{'id':_0x8d28b1[_0x8055('0x49')]['id']}},_0x562326={};_0x562326[_0x8055('0x32')]=_[_0x8055('0x34')](db[_0x8055('0x43')][_0x8055('0x2f')]);_0x562326['query']=_[_0x8055('0x34')](_0x8d28b1[_0x8055('0x33')]);_0x562326[_0x8055('0x3d')]=_['intersection'](_0x562326[_0x8055('0x32')],_0x562326[_0x8055('0x33')]);_0x25397a['attributes']=_['intersection'](_0x562326[_0x8055('0x32')],qs['fields'](_0x8d28b1[_0x8055('0x33')][_0x8055('0x37')]));_0x25397a[_0x8055('0x36')]=_0x25397a['attributes'][_0x8055('0x38')]?_0x25397a[_0x8055('0x36')]:_0x562326[_0x8055('0x32')];if(_0x8d28b1[_0x8055('0x33')][_0x8055('0x44')]){_0x25397a[_0x8055('0x45')]=[{'all':!![]}];}_0x25397a=_[_0x8055('0x40')]({},_0x25397a,_0x8d28b1['options']);return db[_0x8055('0x43')][_0x8055('0x4a')](_0x25397a)[_0x8055('0x27')](handleEntityNotFound(_0x335f57,null))[_0x8055('0x27')](respondWithResult(_0x335f57,null))[_0x8055('0x47')](handleError(_0x335f57,null));};exports[_0x8055('0x4b')]=function(_0x59f86b,_0x1e7385){return db['JscriptyQuestionReport'][_0x8055('0x4b')](_0x59f86b[_0x8055('0x4c')],{})['then'](respondWithResult(_0x1e7385,0xc9))[_0x8055('0x47')](handleError(_0x1e7385,null));};exports[_0x8055('0x26')]=function(_0x4a15a1,_0x237147){if(_0x4a15a1[_0x8055('0x4c')]['id']){delete _0x4a15a1[_0x8055('0x4c')]['id'];}return db[_0x8055('0x43')][_0x8055('0x4a')]({'where':{'id':_0x4a15a1[_0x8055('0x49')]['id']}})['then'](handleEntityNotFound(_0x237147,null))['then'](saveUpdates(_0x4a15a1[_0x8055('0x4c')],null))[_0x8055('0x27')](respondWithResult(_0x237147,null))[_0x8055('0x47')](handleError(_0x237147,null));};exports[_0x8055('0x28')]=function(_0x3cb125,_0xdaf7e0){return db[_0x8055('0x43')][_0x8055('0x4a')]({'where':{'id':_0x3cb125[_0x8055('0x49')]['id']}})[_0x8055('0x27')](handleEntityNotFound(_0xdaf7e0,null))[_0x8055('0x27')](removeEntity(_0xdaf7e0,null))[_0x8055('0x47')](handleError(_0xdaf7e0,null));};exports[_0x8055('0x4d')]=function(_0x597841,_0x11ef9f){return db[_0x8055('0x43')][_0x8055('0x4d')]()[_0x8055('0x27')](respondWithResult(_0x11ef9f,null))[_0x8055('0x47')](handleError(_0x11ef9f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 0f98d5f..5de6fef 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 _0xec18=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','util','api'];(function(_0xa6b5a8,_0x2b4a7d){var _0x4efb4c=function(_0xa1ddea){while(--_0xa1ddea){_0xa6b5a8['push'](_0xa6b5a8['shift']());}};_0x4efb4c(++_0x2b4a7d);}(_0xec18,0x8c));var _0x8ec1=function(_0x44c229,_0x23f406){_0x44c229=_0x44c229-0x0;var _0x27b4d9=_0xec18[_0x44c229];return _0x27b4d9;};'use strict';var _=require(_0x8ec1('0x0'));var util=require(_0x8ec1('0x1'));var logger=require('../../config/logger')(_0x8ec1('0x2'));var moment=require(_0x8ec1('0x3'));var BPromise=require(_0x8ec1('0x4'));var rp=require(_0x8ec1('0x5'));var fs=require('fs');var path=require(_0x8ec1('0x6'));var rimraf=require(_0x8ec1('0x7'));var config=require(_0x8ec1('0x8'));var attributes=require(_0x8ec1('0x9'));module[_0x8ec1('0xa')]=function(_0x34ed87,_0x1aa316){return _0x34ed87[_0x8ec1('0xb')]('JscriptyQuestionReport',attributes,{'tableName':_0x8ec1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7e7=['moment','bluebird','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','util','../../config/logger','api'];(function(_0x4b0acb,_0x11e5d9){var _0x17fd28=function(_0xed485d){while(--_0xed485d){_0x4b0acb['push'](_0x4b0acb['shift']());}};_0x17fd28(++_0x11e5d9);}(_0xc7e7,0xc3));var _0x7c7e=function(_0x33078b,_0xf5b1d0){_0x33078b=_0x33078b-0x0;var _0x54bd8e=_0xc7e7[_0x33078b];return _0x54bd8e;};'use strict';var _=require('lodash');var util=require(_0x7c7e('0x0'));var logger=require(_0x7c7e('0x1'))(_0x7c7e('0x2'));var moment=require(_0x7c7e('0x3'));var BPromise=require(_0x7c7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c7e('0x5'));var rimraf=require('rimraf');var config=require(_0x7c7e('0x6'));var attributes=require(_0x7c7e('0x7'));module[_0x7c7e('0x8')]=function(_0x3bd02d,_0x287a7c){return _0x3bd02d[_0x7c7e('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x7c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index ef9bfae..85a74c8 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 _0x8ee9=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x8ee9,0x1e3));var _0x98ee=function(_0x2156be,_0x126813){_0x2156be=_0x2156be-0x0;var _0x474ee9=_0x8ee9[_0x2156be];return _0x474ee9;};'use strict';var _=require('lodash');var util=require(_0x98ee('0x0'));var moment=require(_0x98ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x98ee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98ee('0x3'))['db'];var utils=require(_0x98ee('0x4'));var logger=require(_0x98ee('0x5'))(_0x98ee('0x6'));var config=require(_0x98ee('0x7'));var jayson=require(_0x98ee('0x8'));var client=jayson[_0x98ee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x403199,_0x4e15e3,_0x26e893){return new BPromise(function(_0x1cc472,_0x1326a1){return client['request'](_0x403199,_0x26e893)[_0x98ee('0xa')](function(_0x112234){logger[_0x98ee('0xb')](_0x98ee('0xc'),_0x4e15e3,_0x98ee('0xd'));logger[_0x98ee('0xe')](_0x98ee('0xf'),_0x4e15e3,_0x98ee('0xd'),JSON[_0x98ee('0x10')](_0x112234));if(_0x112234[_0x98ee('0x11')]){if(_0x112234['error'][_0x98ee('0x12')]===0x1f4){logger[_0x98ee('0x11')](_0x98ee('0xc'),_0x4e15e3,_0x112234[_0x98ee('0x11')][_0x98ee('0x13')]);return _0x1326a1(_0x112234[_0x98ee('0x11')][_0x98ee('0x13')]);}logger[_0x98ee('0x11')](_0x98ee('0xc'),_0x4e15e3,_0x112234['error'][_0x98ee('0x13')]);return _0x1cc472(_0x112234[_0x98ee('0x11')][_0x98ee('0x13')]);}else{logger[_0x98ee('0xb')](_0x98ee('0xc'),_0x4e15e3,'request\x20sent');_0x1cc472(_0x112234[_0x98ee('0x14')][_0x98ee('0x13')]);}})[_0x98ee('0x15')](function(_0x124d5e){logger[_0x98ee('0x11')](_0x98ee('0xc'),_0x4e15e3,_0x124d5e);_0x1326a1(_0x124d5e);});});} \ No newline at end of file +var _0x17d2=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','ioredis'];(function(_0x10c8b6,_0x1dd53e){var _0x129dbf=function(_0x22bd4b){while(--_0x22bd4b){_0x10c8b6['push'](_0x10c8b6['shift']());}};_0x129dbf(++_0x1dd53e);}(_0x17d2,0xce));var _0x217d=function(_0x3569c4,_0x272a40){_0x3569c4=_0x3569c4-0x0;var _0x15d359=_0x17d2[_0x3569c4];return _0x15d359;};'use strict';var _=require(_0x217d('0x0'));var util=require(_0x217d('0x1'));var moment=require(_0x217d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x217d('0x3'));var db=require(_0x217d('0x4'))['db'];var utils=require(_0x217d('0x5'));var logger=require(_0x217d('0x6'))(_0x217d('0x7'));var config=require('../../config/environment');var jayson=require(_0x217d('0x8'));var client=jayson['client'][_0x217d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e220b,_0x2bb955,_0x4be38b){return new BPromise(function(_0x3b5555,_0x20632a){return client['request'](_0x3e220b,_0x4be38b)[_0x217d('0xa')](function(_0x1ad796){logger[_0x217d('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2bb955,'request\x20sent');logger[_0x217d('0xc')](_0x217d('0xd'),_0x2bb955,'request\x20sent',JSON['stringify'](_0x1ad796));if(_0x1ad796['error']){if(_0x1ad796[_0x217d('0xe')][_0x217d('0xf')]===0x1f4){logger['error'](_0x217d('0x10'),_0x2bb955,_0x1ad796[_0x217d('0xe')][_0x217d('0x11')]);return _0x20632a(_0x1ad796[_0x217d('0xe')][_0x217d('0x11')]);}logger[_0x217d('0xe')](_0x217d('0x10'),_0x2bb955,_0x1ad796[_0x217d('0xe')][_0x217d('0x11')]);return _0x3b5555(_0x1ad796[_0x217d('0xe')]['message']);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2bb955,_0x217d('0x12'));_0x3b5555(_0x1ad796[_0x217d('0x13')]['message']);}})[_0x217d('0x14')](function(_0x179cc4){logger[_0x217d('0xe')](_0x217d('0x10'),_0x2bb955,_0x179cc4);_0x20632a(_0x179cc4);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 952b8db..6f17951 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 _0xe07d=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','describe','/:id','show','get','getQuestions','post','create','put','delete','destroy','exports','multer'];(function(_0x343dea,_0x26f221){var _0x5c5692=function(_0x19439e){while(--_0x19439e){_0x343dea['push'](_0x343dea['shift']());}};_0x5c5692(++_0x26f221);}(_0xe07d,0x175));var _0xde07=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe07d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xde07('0x0'));var util=require(_0xde07('0x1'));var path=require(_0xde07('0x2'));var timeout=require(_0xde07('0x3'));var express=require('express');var router=express[_0xde07('0x4')]();var fs_extra=require(_0xde07('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde07('0x6'));var config=require(_0xde07('0x7'));var controller=require(_0xde07('0x8'));router['get']('/',auth[_0xde07('0x9')](),controller[_0xde07('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xde07('0xb')]);router['get'](_0xde07('0xc'),auth['isAuthenticated'](),controller[_0xde07('0xd')]);router[_0xde07('0xe')]('/:id/questions',auth['isAuthenticated'](),controller[_0xde07('0xf')]);router[_0xde07('0x10')]('/',auth[_0xde07('0x9')](),controller[_0xde07('0x11')]);router[_0xde07('0x12')]('/:id',auth[_0xde07('0x9')](),controller['update']);router[_0xde07('0x13')](_0xde07('0xc'),auth[_0xde07('0x9')](),controller[_0xde07('0x14')]);module[_0xde07('0x15')]=router; \ No newline at end of file +var _0xbe4c=['update','delete','exports','util','path','express','fs-extra','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','/:id','getQuestions','create'];(function(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0xbe4c,0x120));var _0xcbe4=function(_0x1e62a1,_0x129a2f){_0x1e62a1=_0x1e62a1-0x0;var _0xfea8eb=_0xbe4c[_0x1e62a1];return _0xfea8eb;};'use strict';var multer=require('multer');var util=require(_0xcbe4('0x0'));var path=require(_0xcbe4('0x1'));var timeout=require('connect-timeout');var express=require(_0xcbe4('0x2'));var router=express['Router']();var fs_extra=require(_0xcbe4('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcbe4('0x4'));var controller=require(_0xcbe4('0x5'));router[_0xcbe4('0x6')]('/',auth[_0xcbe4('0x7')](),controller['index']);router['get'](_0xcbe4('0x8'),auth[_0xcbe4('0x7')](),controller['describe']);router[_0xcbe4('0x6')](_0xcbe4('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xcbe4('0x6')]('/:id/questions',auth['isAuthenticated'](),controller[_0xcbe4('0xa')]);router['post']('/',auth[_0xcbe4('0x7')](),controller[_0xcbe4('0xb')]);router['put'](_0xcbe4('0x9'),auth[_0xcbe4('0x7')](),controller[_0xcbe4('0xc')]);router[_0xcbe4('0xd')](_0xcbe4('0x9'),auth[_0xcbe4('0x7')](),controller['destroy']);module[_0xcbe4('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index a277ab9..5589e87 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 _0x6658=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize'];(function(_0x4504a7,_0x563a15){var _0x1b3b76=function(_0xb0f30d){while(--_0xb0f30d){_0x4504a7['push'](_0x4504a7['shift']());}};_0x1b3b76(++_0x563a15);}(_0x6658,0xf2));var _0x8665=function(_0x417041,_0x168240){_0x417041=_0x417041-0x0;var _0x10518f=_0x6658[_0x417041];return _0x10518f;};'use strict';var moment=require('moment');var Sequelize=require(_0x8665('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x8665('0x1')],'set':function(_0x22437a){this[_0x8665('0x2')](_0x8665('0x3'),_0x22437a);this[_0x8665('0x2')](_0x8665('0x4'),moment()[_0x8665('0x5')](_0x8665('0x6')));}},'endtime':{'type':Sequelize[_0x8665('0x1')]},'membername':{'type':Sequelize[_0x8665('0x7')]},'projectname':{'type':Sequelize[_0x8665('0x7')]},'queue':{'type':Sequelize[_0x8665('0x7')]},'uniqueid':{'type':Sequelize[_0x8665('0x7')]},'calleridname':{'type':Sequelize[_0x8665('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x8665('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x2cdc=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','DATE'];(function(_0x3a6bde,_0x23eefb){var _0x4d6bc8=function(_0x9b6891){while(--_0x9b6891){_0x3a6bde['push'](_0x3a6bde['shift']());}};_0x4d6bc8(++_0x23eefb);}(_0x2cdc,0xbd));var _0xc2cd=function(_0x374f60,_0x551010){_0x374f60=_0x374f60-0x0;var _0x454eda=_0x2cdc[_0x374f60];return _0x454eda;};'use strict';var moment=require(_0xc2cd('0x0'));var Sequelize=require(_0xc2cd('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xc2cd('0x2')],'set':function(_0x194f20){this[_0xc2cd('0x3')]('starttime',_0x194f20);this[_0xc2cd('0x3')](_0xc2cd('0x4'),moment()[_0xc2cd('0x5')](_0xc2cd('0x6')));}},'endtime':{'type':Sequelize[_0xc2cd('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc2cd('0x7')]},'uniqueid':{'type':Sequelize[_0xc2cd('0x7')]},'calleridname':{'type':Sequelize[_0xc2cd('0x7')]},'calleridnum':{'type':Sequelize[_0xc2cd('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 82a8746..19ddabb 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 _0x35fa=['then','destroy','error','name','send','index','map','JscriptySessionReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','getQuestions','order','SessionId','JscriptyQuestionReport','rows','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','Content-Range','json','apply','reject','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35fa,0x175));var _0xa35f=function(_0x31d7e8,_0x3d4f67){_0x31d7e8=_0x31d7e8-0x0;var _0x1eae7a=_0x35fa[_0x31d7e8];return _0x1eae7a;};'use strict';var emlformat=require(_0xa35f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa35f('0x1'));var jsonpatch=require(_0xa35f('0x2'));var rp=require('request-promise');var moment=require(_0xa35f('0x3'));var BPromise=require(_0xa35f('0x4'));var Mustache=require(_0xa35f('0x5'));var util=require(_0xa35f('0x6'));var path=require(_0xa35f('0x7'));var sox=require(_0xa35f('0x8'));var csv=require(_0xa35f('0x9'));var ejs=require(_0xa35f('0xa'));var fs=require('fs');var fs_extra=require(_0xa35f('0xb'));var _=require(_0xa35f('0xc'));var squel=require('squel');var crypto=require(_0xa35f('0xd'));var jsforce=require(_0xa35f('0xe'));var deskjs=require(_0xa35f('0xf'));var toCsv=require(_0xa35f('0x9'));var querystring=require(_0xa35f('0x10'));var Papa=require('papaparse');var Redis=require(_0xa35f('0x11'));var authService=require(_0xa35f('0x12'));var qs=require(_0xa35f('0x13'));var as=require(_0xa35f('0x14'));var hardwareService=require(_0xa35f('0x15'));var logger=require(_0xa35f('0x16'))('api');var utils=require(_0xa35f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa35f('0x18'));var db=require(_0xa35f('0x19'))['db'];function respondWithStatusCode(_0x4c88b6,_0x189ba5){_0x189ba5=_0x189ba5||0xcc;return function(_0x5ef966){if(_0x5ef966){return _0x4c88b6[_0xa35f('0x1a')](_0x189ba5);}return _0x4c88b6[_0xa35f('0x1b')](_0x189ba5)['end']();};}function respondWithResult(_0x50d4d2,_0x163805){_0x163805=_0x163805||0xc8;return function(_0x3c8215){if(_0x3c8215){return _0x50d4d2[_0xa35f('0x1b')](_0x163805)['json'](_0x3c8215);}};}function respondWithFilteredResult(_0x4ade19,_0x4930fc){return function(_0x57cc54){if(_0x57cc54){var _0x23f0ac=typeof _0x4930fc[_0xa35f('0x1c')]===_0xa35f('0x1d')&&typeof _0x4930fc['limit']===_0xa35f('0x1d');var _0x1900d1=_0x57cc54['count'];var _0x4189aa=_0x23f0ac?0x0:_0x4930fc[_0xa35f('0x1c')];var _0x5ca495=_0x23f0ac?_0x57cc54['count']:_0x4930fc[_0xa35f('0x1c')]+_0x4930fc[_0xa35f('0x1e')];var _0x10c76e;if(_0x5ca495>=_0x1900d1){_0x5ca495=_0x1900d1;_0x10c76e=0xc8;}else{_0x10c76e=0xce;}_0x4ade19[_0xa35f('0x1b')](_0x10c76e);return _0x4ade19['set'](_0xa35f('0x1f'),_0x4189aa+'-'+_0x5ca495+'/'+_0x1900d1)[_0xa35f('0x20')](_0x57cc54);}return null;};}function patchUpdates(_0x16a8a6){return function(_0x5a6acf){try{jsonpatch[_0xa35f('0x21')](_0x5a6acf,_0x16a8a6,!![]);}catch(_0x9a88e){return BPromise[_0xa35f('0x22')](_0x9a88e);}return _0x5a6acf[_0xa35f('0x23')]();};}function saveUpdates(_0x2c7365,_0x15c5ac){return function(_0x38ddfc){if(_0x38ddfc){return _0x38ddfc[_0xa35f('0x24')](_0x2c7365)[_0xa35f('0x25')](function(_0x2afcf5){return _0x2afcf5;});}return null;};}function removeEntity(_0x5a8bdf,_0x51b419){return function(_0x3a88b4){if(_0x3a88b4){return _0x3a88b4[_0xa35f('0x26')]()[_0xa35f('0x25')](function(){_0x5a8bdf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fd96a,_0x5ac882){return function(_0x278594){if(!_0x278594){_0x3fd96a[_0xa35f('0x1a')](0x194);}return _0x278594;};}function handleError(_0x30c243,_0x1e4121){_0x1e4121=_0x1e4121||0x1f4;return function(_0x2f1743){logger[_0xa35f('0x27')](_0x2f1743['stack']);if(_0x2f1743[_0xa35f('0x28')]){delete _0x2f1743[_0xa35f('0x28')];}_0x30c243['status'](_0x1e4121)[_0xa35f('0x29')](_0x2f1743);};}exports[_0xa35f('0x2a')]=function(_0x469fc1,_0x591299){var _0x440378={},_0x3f60b5={},_0x566225={'count':0x0,'rows':[]};var _0x6119e6=_[_0xa35f('0x2b')](db[_0xa35f('0x2c')]['rawAttributes'],function(_0x4923b8){return{'name':_0x4923b8[_0xa35f('0x2d')],'type':_0x4923b8[_0xa35f('0x2e')][_0xa35f('0x2f')]};});_0x3f60b5[_0xa35f('0x30')]=_[_0xa35f('0x2b')](_0x6119e6,'name');_0x3f60b5[_0xa35f('0x31')]=_[_0xa35f('0x32')](_0x469fc1[_0xa35f('0x31')]);_0x3f60b5[_0xa35f('0x33')]=_[_0xa35f('0x34')](_0x3f60b5[_0xa35f('0x30')],_0x3f60b5[_0xa35f('0x31')]);_0x440378['attributes']=_[_0xa35f('0x34')](_0x3f60b5[_0xa35f('0x30')],qs[_0xa35f('0x35')](_0x469fc1['query']['fields']));_0x440378[_0xa35f('0x36')]=_0x440378['attributes'][_0xa35f('0x37')]?_0x440378[_0xa35f('0x36')]:_0x3f60b5[_0xa35f('0x30')];if(!_0x469fc1[_0xa35f('0x31')][_0xa35f('0x38')](_0xa35f('0x39'))){_0x440378['limit']=qs[_0xa35f('0x1e')](_0x469fc1['query'][_0xa35f('0x1e')]);_0x440378[_0xa35f('0x1c')]=qs[_0xa35f('0x1c')](_0x469fc1['query'][_0xa35f('0x1c')]);}_0x440378['order']=qs[_0xa35f('0x3a')](_0x469fc1[_0xa35f('0x31')][_0xa35f('0x3a')]);_0x440378[_0xa35f('0x3b')]=qs[_0xa35f('0x33')](_[_0xa35f('0x3c')](_0x469fc1[_0xa35f('0x31')],_0x3f60b5[_0xa35f('0x33')]),_0x6119e6);if(_0x469fc1[_0xa35f('0x31')]['filter']){_0x440378['where']=_[_0xa35f('0x3d')](_0x440378[_0xa35f('0x3b')],{'$or':_['map'](_0x6119e6,function(_0x35e81b){if(_0x35e81b[_0xa35f('0x2e')]!==_0xa35f('0x3e')){var _0x539cf7={};_0x539cf7[_0x35e81b[_0xa35f('0x28')]]={'$like':'%'+_0x469fc1['query'][_0xa35f('0x3f')]+'%'};return _0x539cf7;}})});}_0x440378=_['merge']({},_0x440378,_0x469fc1[_0xa35f('0x40')]);var _0x5e07cf={'where':_0x440378[_0xa35f('0x3b')]};return db[_0xa35f('0x2c')][_0xa35f('0x41')](_0x5e07cf)[_0xa35f('0x25')](function(_0x2b6ebf){_0x566225['count']=_0x2b6ebf;if(_0x469fc1['query'][_0xa35f('0x42')]){_0x440378[_0xa35f('0x43')]=[{'all':!![]}];}return db[_0xa35f('0x2c')][_0xa35f('0x44')](_0x440378);})[_0xa35f('0x25')](function(_0x14eb7a){_0x566225['rows']=_0x14eb7a;return _0x566225;})[_0xa35f('0x25')](respondWithFilteredResult(_0x591299,_0x440378))[_0xa35f('0x45')](handleError(_0x591299,null));};exports[_0xa35f('0x46')]=function(_0x430f7a,_0xd152){var _0x2e47e7={'raw':!![],'where':{'id':_0x430f7a[_0xa35f('0x47')]['id']}},_0x55d16a={};_0x55d16a[_0xa35f('0x30')]=_[_0xa35f('0x32')](db[_0xa35f('0x2c')][_0xa35f('0x48')]);_0x55d16a[_0xa35f('0x31')]=_[_0xa35f('0x32')](_0x430f7a[_0xa35f('0x31')]);_0x55d16a[_0xa35f('0x33')]=_[_0xa35f('0x34')](_0x55d16a[_0xa35f('0x30')],_0x55d16a[_0xa35f('0x31')]);_0x2e47e7['attributes']=_[_0xa35f('0x34')](_0x55d16a['model'],qs[_0xa35f('0x35')](_0x430f7a['query']['fields']));_0x2e47e7['attributes']=_0x2e47e7[_0xa35f('0x36')][_0xa35f('0x37')]?_0x2e47e7[_0xa35f('0x36')]:_0x55d16a[_0xa35f('0x30')];if(_0x430f7a[_0xa35f('0x31')][_0xa35f('0x42')]){_0x2e47e7['include']=[{'all':!![]}];}_0x2e47e7=_[_0xa35f('0x3d')]({},_0x2e47e7,_0x430f7a[_0xa35f('0x40')]);return db[_0xa35f('0x2c')][_0xa35f('0x49')](_0x2e47e7)[_0xa35f('0x25')](handleEntityNotFound(_0xd152,null))[_0xa35f('0x25')](respondWithResult(_0xd152,null))[_0xa35f('0x45')](handleError(_0xd152,null));};exports[_0xa35f('0x4a')]=function(_0x3e1bec,_0x5f52a4){return db[_0xa35f('0x2c')][_0xa35f('0x4a')](_0x3e1bec[_0xa35f('0x4b')],{})['then'](respondWithResult(_0x5f52a4,0xc9))[_0xa35f('0x45')](handleError(_0x5f52a4,null));};exports[_0xa35f('0x24')]=function(_0x23d165,_0x33a921){if(_0x23d165[_0xa35f('0x4b')]['id']){delete _0x23d165[_0xa35f('0x4b')]['id'];}return db[_0xa35f('0x2c')][_0xa35f('0x49')]({'where':{'id':_0x23d165[_0xa35f('0x47')]['id']}})[_0xa35f('0x25')](handleEntityNotFound(_0x33a921,null))[_0xa35f('0x25')](saveUpdates(_0x23d165[_0xa35f('0x4b')],null))['then'](respondWithResult(_0x33a921,null))[_0xa35f('0x45')](handleError(_0x33a921,null));};exports[_0xa35f('0x26')]=function(_0x1aa8d8,_0x256610){return db[_0xa35f('0x2c')]['find']({'where':{'id':_0x1aa8d8[_0xa35f('0x47')]['id']}})[_0xa35f('0x25')](handleEntityNotFound(_0x256610,null))[_0xa35f('0x25')](removeEntity(_0x256610,null))['catch'](handleError(_0x256610,null));};exports[_0xa35f('0x4c')]=function(_0x51db28,_0x55f175){return db[_0xa35f('0x2c')]['describe']()[_0xa35f('0x25')](respondWithResult(_0x55f175,null))[_0xa35f('0x45')](handleError(_0x55f175,null));};exports[_0xa35f('0x4d')]=function(_0x2404d0,_0x111c7b,_0x45655e){var _0x4727fd={'raw':!![],'where':{}};var _0x3ec9b4={};var _0x2fb8ae={'count':0x0,'rows':[]};return db[_0xa35f('0x2c')]['findOne']({'where':{'id':_0x2404d0[_0xa35f('0x47')]['id']}})[_0xa35f('0x25')](handleEntityNotFound(_0x111c7b,null))[_0xa35f('0x25')](function(_0xb291d6){if(_0xb291d6){_0x3ec9b4[_0xa35f('0x30')]=_[_0xa35f('0x32')](db['JscriptyQuestionReport']['rawAttributes']);_0x3ec9b4[_0xa35f('0x31')]=_[_0xa35f('0x32')](_0x2404d0[_0xa35f('0x31')]);_0x3ec9b4[_0xa35f('0x33')]=_[_0xa35f('0x34')](_0x3ec9b4[_0xa35f('0x30')],_0x3ec9b4[_0xa35f('0x31')]);_0x4727fd[_0xa35f('0x36')]=_[_0xa35f('0x34')](_0x3ec9b4[_0xa35f('0x30')],qs[_0xa35f('0x35')](_0x2404d0[_0xa35f('0x31')]['fields']));_0x4727fd[_0xa35f('0x36')]=_0x4727fd['attributes'][_0xa35f('0x37')]?_0x4727fd['attributes']:_0x3ec9b4[_0xa35f('0x30')];if(!_0x2404d0[_0xa35f('0x31')][_0xa35f('0x38')](_0xa35f('0x39'))){_0x4727fd[_0xa35f('0x1e')]=qs[_0xa35f('0x1e')](_0x2404d0[_0xa35f('0x31')][_0xa35f('0x1e')]);_0x4727fd[_0xa35f('0x1c')]=qs['offset'](_0x2404d0[_0xa35f('0x31')][_0xa35f('0x1c')]);}_0x4727fd[_0xa35f('0x4e')]=qs[_0xa35f('0x3a')](_0x2404d0[_0xa35f('0x31')]['sort']);_0x4727fd[_0xa35f('0x3b')]=qs[_0xa35f('0x33')](_[_0xa35f('0x3c')](_0x2404d0[_0xa35f('0x31')],_0x3ec9b4[_0xa35f('0x33')]));_0x4727fd[_0xa35f('0x3b')][_0xa35f('0x4f')]=_0xb291d6['id'];if(_0x2404d0[_0xa35f('0x31')][_0xa35f('0x3f')]){_0x4727fd[_0xa35f('0x3b')]=_[_0xa35f('0x3d')](_0x4727fd[_0xa35f('0x3b')],{'$or':_[_0xa35f('0x2b')](_0x4727fd['attributes'],function(_0x460bd4){var _0x118bfa={};_0x118bfa[_0x460bd4]={'$like':'%'+_0x2404d0['query'][_0xa35f('0x3f')]+'%'};return _0x118bfa;})});}_0x4727fd=_[_0xa35f('0x3d')]({},_0x4727fd,_0x2404d0[_0xa35f('0x40')]);return db[_0xa35f('0x50')][_0xa35f('0x41')]({'where':_0x4727fd[_0xa35f('0x3b')]})[_0xa35f('0x25')](function(_0xf4c4c3){_0x2fb8ae[_0xa35f('0x41')]=_0xf4c4c3;if(_0x2404d0[_0xa35f('0x31')][_0xa35f('0x42')]){_0x4727fd['include']=[{'all':!![]}];}return db[_0xa35f('0x50')]['findAll'](_0x4727fd);})['then'](function(_0x34efbc){_0x2fb8ae[_0xa35f('0x51')]=_0x34efbc;return _0x2fb8ae;});}})['then'](respondWithFilteredResult(_0x111c7b,_0x4727fd))[_0xa35f('0x45')](handleError(_0x111c7b,null));}; \ No newline at end of file +var _0xbea3=['length','includeAll','include','catch','body','find','describe','getQuestions','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','error','stack','name','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','params'];(function(_0x561a73,_0x5a7801){var _0x21a09e=function(_0x41bea6){while(--_0x41bea6){_0x561a73['push'](_0x561a73['shift']());}};_0x21a09e(++_0x5a7801);}(_0xbea3,0x19a));var _0x3bea=function(_0x5422f4,_0x1deab9){_0x5422f4=_0x5422f4-0x0;var _0x5e3913=_0xbea3[_0x5422f4];return _0x5e3913;};'use strict';var emlformat=require(_0x3bea('0x0'));var rimraf=require(_0x3bea('0x1'));var zipdir=require(_0x3bea('0x2'));var jsonpatch=require(_0x3bea('0x3'));var rp=require(_0x3bea('0x4'));var moment=require(_0x3bea('0x5'));var BPromise=require(_0x3bea('0x6'));var Mustache=require(_0x3bea('0x7'));var util=require(_0x3bea('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3bea('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bea('0xa'));var _=require(_0x3bea('0xb'));var squel=require(_0x3bea('0xc'));var crypto=require('crypto');var jsforce=require(_0x3bea('0xd'));var deskjs=require(_0x3bea('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3bea('0xf'));var Papa=require(_0x3bea('0x10'));var Redis=require(_0x3bea('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3bea('0x12'));var as=require(_0x3bea('0x13'));var hardwareService=require(_0x3bea('0x14'));var logger=require(_0x3bea('0x15'))(_0x3bea('0x16'));var utils=require(_0x3bea('0x17'));var config=require(_0x3bea('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bea('0x19'))['db'];function respondWithStatusCode(_0x3b91e5,_0x212cd9){_0x212cd9=_0x212cd9||0xcc;return function(_0x5323d8){if(_0x5323d8){return _0x3b91e5[_0x3bea('0x1a')](_0x212cd9);}return _0x3b91e5[_0x3bea('0x1b')](_0x212cd9)['end']();};}function respondWithResult(_0x40ffb0,_0x45f1d5){_0x45f1d5=_0x45f1d5||0xc8;return function(_0xd8c932){if(_0xd8c932){return _0x40ffb0[_0x3bea('0x1b')](_0x45f1d5)[_0x3bea('0x1c')](_0xd8c932);}};}function respondWithFilteredResult(_0x16f828,_0x533603){return function(_0x160cc6){if(_0x160cc6){var _0x463680=typeof _0x533603[_0x3bea('0x1d')]==='undefined'&&typeof _0x533603['limit']===_0x3bea('0x1e');var _0x17b045=_0x160cc6[_0x3bea('0x1f')];var _0x1b9a4b=_0x463680?0x0:_0x533603[_0x3bea('0x1d')];var _0x47bf94=_0x463680?_0x160cc6[_0x3bea('0x1f')]:_0x533603[_0x3bea('0x1d')]+_0x533603[_0x3bea('0x20')];var _0x4c530e;if(_0x47bf94>=_0x17b045){_0x47bf94=_0x17b045;_0x4c530e=0xc8;}else{_0x4c530e=0xce;}_0x16f828[_0x3bea('0x1b')](_0x4c530e);return _0x16f828[_0x3bea('0x21')]('Content-Range',_0x1b9a4b+'-'+_0x47bf94+'/'+_0x17b045)[_0x3bea('0x1c')](_0x160cc6);}return null;};}function patchUpdates(_0x49e0a8){return function(_0x17e396){try{jsonpatch[_0x3bea('0x22')](_0x17e396,_0x49e0a8,!![]);}catch(_0x91d5b9){return BPromise[_0x3bea('0x23')](_0x91d5b9);}return _0x17e396[_0x3bea('0x24')]();};}function saveUpdates(_0x4dd7a7,_0x194a7b){return function(_0x5e3954){if(_0x5e3954){return _0x5e3954[_0x3bea('0x25')](_0x4dd7a7)['then'](function(_0x220772){return _0x220772;});}return null;};}function removeEntity(_0x5eb4c9,_0x8583c8){return function(_0x1d9902){if(_0x1d9902){return _0x1d9902['destroy']()[_0x3bea('0x26')](function(){_0x5eb4c9[_0x3bea('0x1b')](0xcc)[_0x3bea('0x27')]();});}};}function handleEntityNotFound(_0x5233d0,_0x12e091){return function(_0x38fa34){if(!_0x38fa34){_0x5233d0[_0x3bea('0x1a')](0x194);}return _0x38fa34;};}function handleError(_0x34584d,_0x5d6aa0){_0x5d6aa0=_0x5d6aa0||0x1f4;return function(_0x24b4ec){logger[_0x3bea('0x28')](_0x24b4ec[_0x3bea('0x29')]);if(_0x24b4ec[_0x3bea('0x2a')]){delete _0x24b4ec[_0x3bea('0x2a')];}_0x34584d[_0x3bea('0x1b')](_0x5d6aa0)['send'](_0x24b4ec);};}exports[_0x3bea('0x2b')]=function(_0x3e31dd,_0x4c4f41){var _0x693fc7={},_0x21f5ea={},_0x19d45b={'count':0x0,'rows':[]};var _0x4566d5=_['map'](db[_0x3bea('0x2c')][_0x3bea('0x2d')],function(_0x4b1126){return{'name':_0x4b1126[_0x3bea('0x2e')],'type':_0x4b1126[_0x3bea('0x2f')][_0x3bea('0x30')]};});_0x21f5ea[_0x3bea('0x31')]=_[_0x3bea('0x32')](_0x4566d5,_0x3bea('0x2a'));_0x21f5ea[_0x3bea('0x33')]=_[_0x3bea('0x34')](_0x3e31dd['query']);_0x21f5ea[_0x3bea('0x35')]=_['intersection'](_0x21f5ea[_0x3bea('0x31')],_0x21f5ea[_0x3bea('0x33')]);_0x693fc7[_0x3bea('0x36')]=_[_0x3bea('0x37')](_0x21f5ea[_0x3bea('0x31')],qs[_0x3bea('0x38')](_0x3e31dd[_0x3bea('0x33')]['fields']));_0x693fc7[_0x3bea('0x36')]=_0x693fc7[_0x3bea('0x36')]['length']?_0x693fc7[_0x3bea('0x36')]:_0x21f5ea['model'];if(!_0x3e31dd[_0x3bea('0x33')][_0x3bea('0x39')](_0x3bea('0x3a'))){_0x693fc7[_0x3bea('0x20')]=qs[_0x3bea('0x20')](_0x3e31dd[_0x3bea('0x33')][_0x3bea('0x20')]);_0x693fc7[_0x3bea('0x1d')]=qs[_0x3bea('0x1d')](_0x3e31dd[_0x3bea('0x33')][_0x3bea('0x1d')]);}_0x693fc7[_0x3bea('0x3b')]=qs[_0x3bea('0x3c')](_0x3e31dd['query'][_0x3bea('0x3c')]);_0x693fc7[_0x3bea('0x3d')]=qs[_0x3bea('0x35')](_[_0x3bea('0x3e')](_0x3e31dd[_0x3bea('0x33')],_0x21f5ea[_0x3bea('0x35')]),_0x4566d5);if(_0x3e31dd['query'][_0x3bea('0x3f')]){_0x693fc7[_0x3bea('0x3d')]=_[_0x3bea('0x40')](_0x693fc7[_0x3bea('0x3d')],{'$or':_['map'](_0x4566d5,function(_0x192ee8){if(_0x192ee8[_0x3bea('0x2f')]!==_0x3bea('0x41')){var _0x41c445={};_0x41c445[_0x192ee8[_0x3bea('0x2a')]]={'$like':'%'+_0x3e31dd[_0x3bea('0x33')][_0x3bea('0x3f')]+'%'};return _0x41c445;}})});}_0x693fc7=_[_0x3bea('0x40')]({},_0x693fc7,_0x3e31dd[_0x3bea('0x42')]);var _0x4d4ab8={'where':_0x693fc7[_0x3bea('0x3d')]};return db[_0x3bea('0x2c')][_0x3bea('0x1f')](_0x4d4ab8)[_0x3bea('0x26')](function(_0x15a032){_0x19d45b['count']=_0x15a032;if(_0x3e31dd[_0x3bea('0x33')]['includeAll']){_0x693fc7['include']=[{'all':!![]}];}return db[_0x3bea('0x2c')][_0x3bea('0x43')](_0x693fc7);})[_0x3bea('0x26')](function(_0x2d6e62){_0x19d45b[_0x3bea('0x44')]=_0x2d6e62;return _0x19d45b;})[_0x3bea('0x26')](respondWithFilteredResult(_0x4c4f41,_0x693fc7))['catch'](handleError(_0x4c4f41,null));};exports['show']=function(_0x41fd83,_0x3a08b0){var _0x14f783={'raw':!![],'where':{'id':_0x41fd83[_0x3bea('0x45')]['id']}},_0x17718b={};_0x17718b[_0x3bea('0x31')]=_[_0x3bea('0x34')](db[_0x3bea('0x2c')][_0x3bea('0x2d')]);_0x17718b['query']=_[_0x3bea('0x34')](_0x41fd83['query']);_0x17718b[_0x3bea('0x35')]=_[_0x3bea('0x37')](_0x17718b[_0x3bea('0x31')],_0x17718b[_0x3bea('0x33')]);_0x14f783[_0x3bea('0x36')]=_[_0x3bea('0x37')](_0x17718b[_0x3bea('0x31')],qs['fields'](_0x41fd83[_0x3bea('0x33')][_0x3bea('0x38')]));_0x14f783['attributes']=_0x14f783[_0x3bea('0x36')][_0x3bea('0x46')]?_0x14f783[_0x3bea('0x36')]:_0x17718b[_0x3bea('0x31')];if(_0x41fd83[_0x3bea('0x33')][_0x3bea('0x47')]){_0x14f783[_0x3bea('0x48')]=[{'all':!![]}];}_0x14f783=_[_0x3bea('0x40')]({},_0x14f783,_0x41fd83[_0x3bea('0x42')]);return db['JscriptySessionReport']['find'](_0x14f783)[_0x3bea('0x26')](handleEntityNotFound(_0x3a08b0,null))[_0x3bea('0x26')](respondWithResult(_0x3a08b0,null))[_0x3bea('0x49')](handleError(_0x3a08b0,null));};exports['create']=function(_0x4e4991,_0x5d6b2a){return db['JscriptySessionReport']['create'](_0x4e4991[_0x3bea('0x4a')],{})[_0x3bea('0x26')](respondWithResult(_0x5d6b2a,0xc9))['catch'](handleError(_0x5d6b2a,null));};exports['update']=function(_0x2325a1,_0x47d827){if(_0x2325a1['body']['id']){delete _0x2325a1[_0x3bea('0x4a')]['id'];}return db[_0x3bea('0x2c')][_0x3bea('0x4b')]({'where':{'id':_0x2325a1[_0x3bea('0x45')]['id']}})['then'](handleEntityNotFound(_0x47d827,null))[_0x3bea('0x26')](saveUpdates(_0x2325a1['body'],null))['then'](respondWithResult(_0x47d827,null))['catch'](handleError(_0x47d827,null));};exports['destroy']=function(_0x18737c,_0x4c03dc){return db[_0x3bea('0x2c')][_0x3bea('0x4b')]({'where':{'id':_0x18737c['params']['id']}})[_0x3bea('0x26')](handleEntityNotFound(_0x4c03dc,null))['then'](removeEntity(_0x4c03dc,null))[_0x3bea('0x49')](handleError(_0x4c03dc,null));};exports[_0x3bea('0x4c')]=function(_0x4f9e4b,_0x4809df){return db[_0x3bea('0x2c')][_0x3bea('0x4c')]()[_0x3bea('0x26')](respondWithResult(_0x4809df,null))[_0x3bea('0x49')](handleError(_0x4809df,null));};exports[_0x3bea('0x4d')]=function(_0x4c8936,_0x5f2338,_0x46d4af){var _0x3d2b69={'raw':!![],'where':{}};var _0x30c4f8={};var _0x356f2e={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x4c8936[_0x3bea('0x45')]['id']}})[_0x3bea('0x26')](handleEntityNotFound(_0x5f2338,null))[_0x3bea('0x26')](function(_0x23a2b5){if(_0x23a2b5){_0x30c4f8[_0x3bea('0x31')]=_[_0x3bea('0x34')](db[_0x3bea('0x4e')][_0x3bea('0x2d')]);_0x30c4f8[_0x3bea('0x33')]=_[_0x3bea('0x34')](_0x4c8936[_0x3bea('0x33')]);_0x30c4f8[_0x3bea('0x35')]=_['intersection'](_0x30c4f8['model'],_0x30c4f8[_0x3bea('0x33')]);_0x3d2b69['attributes']=_[_0x3bea('0x37')](_0x30c4f8['model'],qs[_0x3bea('0x38')](_0x4c8936[_0x3bea('0x33')][_0x3bea('0x38')]));_0x3d2b69[_0x3bea('0x36')]=_0x3d2b69['attributes'][_0x3bea('0x46')]?_0x3d2b69[_0x3bea('0x36')]:_0x30c4f8[_0x3bea('0x31')];if(!_0x4c8936[_0x3bea('0x33')][_0x3bea('0x39')](_0x3bea('0x3a'))){_0x3d2b69[_0x3bea('0x20')]=qs['limit'](_0x4c8936[_0x3bea('0x33')][_0x3bea('0x20')]);_0x3d2b69[_0x3bea('0x1d')]=qs[_0x3bea('0x1d')](_0x4c8936['query'][_0x3bea('0x1d')]);}_0x3d2b69['order']=qs[_0x3bea('0x3c')](_0x4c8936[_0x3bea('0x33')]['sort']);_0x3d2b69[_0x3bea('0x3d')]=qs['filters'](_[_0x3bea('0x3e')](_0x4c8936[_0x3bea('0x33')],_0x30c4f8[_0x3bea('0x35')]));_0x3d2b69[_0x3bea('0x3d')][_0x3bea('0x4f')]=_0x23a2b5['id'];if(_0x4c8936[_0x3bea('0x33')][_0x3bea('0x3f')]){_0x3d2b69['where']=_[_0x3bea('0x40')](_0x3d2b69[_0x3bea('0x3d')],{'$or':_[_0x3bea('0x32')](_0x3d2b69[_0x3bea('0x36')],function(_0x312ff9){var _0x391fc1={};_0x391fc1[_0x312ff9]={'$like':'%'+_0x4c8936['query'][_0x3bea('0x3f')]+'%'};return _0x391fc1;})});}_0x3d2b69=_['merge']({},_0x3d2b69,_0x4c8936['options']);return db[_0x3bea('0x4e')]['count']({'where':_0x3d2b69[_0x3bea('0x3d')]})[_0x3bea('0x26')](function(_0x16b320){_0x356f2e[_0x3bea('0x1f')]=_0x16b320;if(_0x4c8936[_0x3bea('0x33')][_0x3bea('0x47')]){_0x3d2b69[_0x3bea('0x48')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3bea('0x43')](_0x3d2b69);})[_0x3bea('0x26')](function(_0xfd37b4){_0x356f2e[_0x3bea('0x44')]=_0xfd37b4;return _0x356f2e;});}})[_0x3bea('0x26')](respondWithFilteredResult(_0x5f2338,_0x3d2b69))['catch'](handleError(_0x5f2338,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a61ea6f..16ee9d1 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 _0x7046=['path','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3e377c,_0x50d780){var _0x412396=function(_0x26f894){while(--_0x26f894){_0x3e377c['push'](_0x3e377c['shift']());}};_0x412396(++_0x50d780);}(_0x7046,0x144));var _0x6704=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7046[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c7b=['path','rimraf','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','moment','request-promise'];(function(_0x3f3613,_0x482e34){var _0x2119b3=function(_0x4e98a8){while(--_0x4e98a8){_0x3f3613['push'](_0x3f3613['shift']());}};_0x2119b3(++_0x482e34);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x3e6432,_0x38edf1){_0x3e6432=_0x3e6432-0x0;var _0x33956e=_0x6c7b[_0x3e6432];return _0x33956e;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('JscriptySessionReport',attributes,{'tableName':_0xb6c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index e7cde50..2077b41 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 _0xb145=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message'];(function(_0x57a760,_0x52152){var _0x2ded80=function(_0x2b56fd){while(--_0x2b56fd){_0x57a760['push'](_0x57a760['shift']());}};_0x2ded80(++_0x52152);}(_0xb145,0xa3));var _0x5b14=function(_0x527e44,_0x3a0d88){_0x527e44=_0x527e44-0x0;var _0x3c9b9c=_0xb145[_0x527e44];return _0x3c9b9c;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});} \ No newline at end of file +var _0x1967=['then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x1967,0x173));var _0x7196=function(_0x341d98,_0x44a818){_0x341d98=_0x341d98-0x0;var _0x4a71af=_0x1967[_0x341d98];return _0x4a71af;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 07782c7..d790b8a 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 _0xa400=['index','put','/:id','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x1991c9,_0x3d0f3c){var _0x4329c6=function(_0x2b782d){while(--_0x2b782d){_0x1991c9['push'](_0x1991c9['shift']());}};_0x4329c6(++_0x3d0f3c);}(_0xa400,0xc1));var _0x0a40=function(_0x41872b,_0x38dcc7){_0x41872b=_0x41872b-0x0;var _0x4997fd=_0xa400[_0x41872b];return _0x4997fd;};'use strict';var multer=require(_0x0a40('0x0'));var util=require(_0x0a40('0x1'));var path=require(_0x0a40('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0a40('0x3'));var auth=require(_0x0a40('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0a40('0x5'));var controller=require('./license.controller');router[_0x0a40('0x6')]('/',controller[_0x0a40('0x7')]);router[_0x0a40('0x8')](_0x0a40('0x9'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x7a2d=['./license.controller','get','index','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x4509e,_0xd7e17){var _0x254bb2=function(_0x3dcbbf){while(--_0x3dcbbf){_0x4509e['push'](_0x4509e['shift']());}};_0x254bb2(++_0xd7e17);}(_0x7a2d,0x142));var _0xd7a2=function(_0x3ad279,_0x226683){_0x3ad279=_0x3ad279-0x0;var _0x1019f6=_0x7a2d[_0x3ad279];return _0x1019f6;};'use strict';var multer=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var path=require(_0xd7a2('0x2'));var timeout=require(_0xd7a2('0x3'));var express=require(_0xd7a2('0x4'));var router=express[_0xd7a2('0x5')]();var fs_extra=require(_0xd7a2('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd7a2('0x7'));var controller=require(_0xd7a2('0x8'));router[_0xd7a2('0x9')]('/',controller[_0xd7a2('0xa')]);router['put'](_0xd7a2('0xb'),auth[_0xd7a2('0xc')](),controller[_0xd7a2('0xd')]);module[_0xd7a2('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 7da2a4f..4aed647 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 _0x349d=['exports','STRING','sequelize'];(function(_0x1ac53b,_0x31c1f1){var _0x6dcc75=function(_0x3a2a35){while(--_0x3a2a35){_0x1ac53b['push'](_0x1ac53b['shift']());}};_0x6dcc75(++_0x31c1f1);}(_0x349d,0xb0));var _0xd349=function(_0x4bddba,_0xf1dcdd){_0x4bddba=_0x4bddba-0x0;var _0x26eb93=_0x349d[_0x4bddba];return _0x26eb93;};'use strict';var Sequelize=require(_0xd349('0x0'));module[_0xd349('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd349('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa339=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x5de701,_0x42e5b2){var _0x1c9155=function(_0x4da2d3){while(--_0x4da2d3){_0x5de701['push'](_0x5de701['shift']());}};_0x1c9155(++_0x42e5b2);}(_0xa339,0x11b));var _0x9a33=function(_0x44750e,_0x3f0095){_0x44750e=_0x44750e-0x0;var _0x52ee36=_0xa339[_0x44750e];return _0x52ee36;};'use strict';var Sequelize=require(_0x9a33('0x0'));module[_0x9a33('0x1')]={'license':{'type':Sequelize[_0x9a33('0x2')]},'data1':{'type':Sequelize[_0x9a33('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x9a33('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index cb28fb3..0938693 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 _0x326f=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','getLicense','catch','body','License','find','checkLicense','key','demo','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x326f,0xd1));var _0xf326=function(_0x341832,_0xada222){_0x341832=_0x341832-0x0;var _0x5f5dd0=_0x326f[_0x341832];return _0x5f5dd0;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x6a8e89,_0x1ae23a){var _0x2fa28e={'raw':!![],'where':{'id':0x1}},_0x5dbe63={};_0x5dbe63[_0xf326('0x28')]=_[_0xf326('0x29')](db['License'][_0xf326('0x2a')]);_0x5dbe63[_0xf326('0x2b')]=_[_0xf326('0x29')](_0x6a8e89[_0xf326('0x2b')]);_0x5dbe63[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x5dbe63[_0xf326('0x28')],_0x5dbe63[_0xf326('0x2b')]);_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2d')](_0x5dbe63['model'],qs[_0xf326('0x2f')](_0x6a8e89[_0xf326('0x2b')][_0xf326('0x2f')]));_0x2fa28e['attributes']=_0x2fa28e[_0xf326('0x2e')][_0xf326('0x30')]?_0x2fa28e[_0xf326('0x2e')]:_0x5dbe63['model'];_0x2fa28e=_['merge']({},_0x2fa28e,_0x6a8e89[_0xf326('0x31')]);return utilLicense[_0xf326('0x32')](_0x2fa28e)[_0xf326('0x24')](respondWithResult(_0x1ae23a,null))[_0xf326('0x33')](handleError(_0x1ae23a,null));};exports[_0xf326('0x22')]=function(_0x2e8a64,_0x62585a){if(_0x2e8a64[_0xf326('0x34')]['id']){delete _0x2e8a64['body']['id'];}return db[_0xf326('0x35')][_0xf326('0x36')]({'where':{'id':_0x2e8a64['params']['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x62585a,null))['then'](function(_0xce1cbb){var _0x481b64=_0xce1cbb['get']({'plain':!![]});return utilLicense[_0xf326('0x37')](_0x481b64,_0x2e8a64['body'][_0xf326('0x38')]);})['then'](function(_0x310dbb){if(!_0x310dbb[_0xf326('0x39')]){return saveUpdates(_0x2e8a64[_0xf326('0x34')],null);}return _0x310dbb;})['then'](respondWithResult(_0x62585a,null))[_0xf326('0x33')](handleError(_0x62585a,null));}; \ No newline at end of file +var _0x2ef3=['length','options','then','catch','body','params','get','checkLicense','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x148bd2,_0x3338c6){var _0x38c56f=function(_0x237939){while(--_0x237939){_0x148bd2['push'](_0x148bd2['shift']());}};_0x38c56f(++_0x3338c6);}(_0x2ef3,0xba));var _0x32ef=function(_0x49cc59,_0x205bfa){_0x49cc59=_0x49cc59-0x0;var _0x55616e=_0x2ef3[_0x49cc59];return _0x55616e;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}var utilLicense=require('../../config/license/util');exports[_0x32ef('0x29')]=function(_0x2f5d06,_0x5a04cd){var _0x12de1a={'raw':!![],'where':{'id':0x1}},_0x3c569d={};_0x3c569d[_0x32ef('0x2a')]=_[_0x32ef('0x2b')](db['License'][_0x32ef('0x2c')]);_0x3c569d[_0x32ef('0x2d')]=_[_0x32ef('0x2b')](_0x2f5d06[_0x32ef('0x2d')]);_0x3c569d[_0x32ef('0x2e')]=_[_0x32ef('0x2f')](_0x3c569d[_0x32ef('0x2a')],_0x3c569d['query']);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x3c569d[_0x32ef('0x2a')],qs[_0x32ef('0x31')](_0x2f5d06['query'][_0x32ef('0x31')]));_0x12de1a[_0x32ef('0x30')]=_0x12de1a[_0x32ef('0x30')][_0x32ef('0x32')]?_0x12de1a[_0x32ef('0x30')]:_0x3c569d['model'];_0x12de1a=_['merge']({},_0x12de1a,_0x2f5d06[_0x32ef('0x33')]);return utilLicense['getLicense'](_0x12de1a)[_0x32ef('0x34')](respondWithResult(_0x5a04cd,null))[_0x32ef('0x35')](handleError(_0x5a04cd,null));};exports[_0x32ef('0x24')]=function(_0x390670,_0x389583){if(_0x390670[_0x32ef('0x36')]['id']){delete _0x390670['body']['id'];}return db['License']['find']({'where':{'id':_0x390670[_0x32ef('0x37')]['id']}})[_0x32ef('0x34')](handleEntityNotFound(_0x389583,null))[_0x32ef('0x34')](function(_0x5f2443){var _0x4fb402=_0x5f2443[_0x32ef('0x38')]({'plain':!![]});return utilLicense[_0x32ef('0x39')](_0x4fb402,_0x390670[_0x32ef('0x36')]['key']);})['then'](function(_0xcbdec8){if(!_0xcbdec8[_0x32ef('0x3a')]){return saveUpdates(_0x390670[_0x32ef('0x36')],null);}return _0xcbdec8;})[_0x32ef('0x34')](respondWithResult(_0x389583,null))[_0x32ef('0x35')](handleError(_0x389583,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 344ec49..6eec448 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 _0xd5aa=['../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x3d68ad,_0x1a32bd){var _0x34eade=function(_0x3645f1){while(--_0x3645f1){_0x3d68ad['push'](_0x3d68ad['shift']());}};_0x34eade(++_0x1a32bd);}(_0xd5aa,0x162));var _0xad5a=function(_0x359a63,_0x45b6a1){_0x359a63=_0x359a63-0x0;var _0x5869af=_0xd5aa[_0x359a63];return _0x5869af;};'use strict';var _=require(_0xad5a('0x0'));var util=require(_0xad5a('0x1'));var logger=require(_0xad5a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xad5a('0x3'));var rp=require(_0xad5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad5a('0x5'));var config=require(_0xad5a('0x6'));var attributes=require(_0xad5a('0x7'));module[_0xad5a('0x8')]=function(_0x28666d,_0x259477){return _0x28666d[_0xad5a('0x9')](_0xad5a('0xa'),attributes,{'tableName':_0xad5a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3752=['rimraf','../../config/environment','./license.attributes','exports','define','License','license','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x41127b,_0x27dacb){var _0x1cc300=function(_0x3fd3ff){while(--_0x3fd3ff){_0x41127b['push'](_0x41127b['shift']());}};_0x1cc300(++_0x27dacb);}(_0x3752,0x165));var _0x2375=function(_0x416d75,_0x2c8e81){_0x416d75=_0x416d75-0x0;var _0x10af66=_0x3752[_0x416d75];return _0x10af66;};'use strict';var _=require('lodash');var util=require(_0x2375('0x0'));var logger=require(_0x2375('0x1'))(_0x2375('0x2'));var moment=require(_0x2375('0x3'));var BPromise=require(_0x2375('0x4'));var rp=require(_0x2375('0x5'));var fs=require('fs');var path=require(_0x2375('0x6'));var rimraf=require(_0x2375('0x7'));var config=require(_0x2375('0x8'));var attributes=require(_0x2375('0x9'));module[_0x2375('0xa')]=function(_0x25b8d8,_0x3bdfcd){return _0x25b8d8[_0x2375('0xb')](_0x2375('0xc'),attributes,{'tableName':_0x2375('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 4975b54..1589dde 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 _0xc2ab=['jayson/promise','client','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x42b5d6,_0x444d17){var _0x26f3cc=function(_0x21da2d){while(--_0x21da2d){_0x42b5d6['push'](_0x42b5d6['shift']());}};_0x26f3cc(++_0x444d17);}(_0xc2ab,0xce));var _0xbc2a=function(_0xf4f985,_0x21a7f4){_0xf4f985=_0xf4f985-0x0;var _0x56d65a=_0xc2ab[_0xf4f985];return _0x56d65a;};'use strict';var _=require(_0xbc2a('0x0'));var util=require(_0xbc2a('0x1'));var moment=require(_0xbc2a('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc2a('0x3'));var fs=require('fs');var Redis=require(_0xbc2a('0x4'));var db=require(_0xbc2a('0x5'))['db'];var utils=require(_0xbc2a('0x6'));var logger=require(_0xbc2a('0x7'))(_0xbc2a('0x8'));var config=require(_0xbc2a('0x9'));var jayson=require(_0xbc2a('0xa'));var client=jayson[_0xbc2a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf16df,_0x115ab4,_0x3ae8d3){return new BPromise(function(_0x27a094,_0x3c13cd){return client['request'](_0xf16df,_0x3ae8d3)[_0xbc2a('0xc')](function(_0x2a95af){logger[_0xbc2a('0xd')](_0xbc2a('0xe'),_0x115ab4,_0xbc2a('0xf'));logger[_0xbc2a('0x10')](_0xbc2a('0x11'),_0x115ab4,_0xbc2a('0xf'),JSON[_0xbc2a('0x12')](_0x2a95af));if(_0x2a95af[_0xbc2a('0x13')]){if(_0x2a95af[_0xbc2a('0x13')][_0xbc2a('0x14')]===0x1f4){logger[_0xbc2a('0x13')](_0xbc2a('0xe'),_0x115ab4,_0x2a95af[_0xbc2a('0x13')]['message']);return _0x3c13cd(_0x2a95af[_0xbc2a('0x13')][_0xbc2a('0x15')]);}logger[_0xbc2a('0x13')]('License,\x20%s,\x20%s',_0x115ab4,_0x2a95af[_0xbc2a('0x13')][_0xbc2a('0x15')]);return _0x27a094(_0x2a95af[_0xbc2a('0x13')]['message']);}else{logger[_0xbc2a('0xd')](_0xbc2a('0xe'),_0x115ab4,_0xbc2a('0xf'));_0x27a094(_0x2a95af[_0xbc2a('0x16')]['message']);}})[_0xbc2a('0x17')](function(_0x1a0122){logger['error'](_0xbc2a('0xe'),_0x115ab4,_0x1a0122);_0x3c13cd(_0x1a0122);});});} \ No newline at end of file +var _0x2eec=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4c1d68,_0x34204d){var _0x4ae0a2=function(_0xb04bff){while(--_0xb04bff){_0x4c1d68['push'](_0x4c1d68['shift']());}};_0x4ae0a2(++_0x34204d);}(_0x2eec,0x1e5));var _0xc2ee=function(_0x1b9f88,_0x1b0f15){_0x1b9f88=_0x1b9f88-0x0;var _0x52c213=_0x2eec[_0x1b9f88];return _0x52c213;};'use strict';var _=require(_0xc2ee('0x0'));var util=require(_0xc2ee('0x1'));var moment=require(_0xc2ee('0x2'));var BPromise=require(_0xc2ee('0x3'));var rs=require(_0xc2ee('0x4'));var fs=require('fs');var Redis=require(_0xc2ee('0x5'));var db=require(_0xc2ee('0x6'))['db'];var utils=require(_0xc2ee('0x7'));var logger=require(_0xc2ee('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc2ee('0x9'));var client=jayson[_0xc2ee('0xa')][_0xc2ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e1b6f,_0x3c1786,_0x730fb0){return new BPromise(function(_0xcf3f03,_0x30c9f5){return client['request'](_0x5e1b6f,_0x730fb0)[_0xc2ee('0xc')](function(_0x4f51f3){logger[_0xc2ee('0xd')](_0xc2ee('0xe'),_0x3c1786,_0xc2ee('0xf'));logger[_0xc2ee('0x10')]('License,\x20%s,\x20%s,\x20%s',_0x3c1786,_0xc2ee('0xf'),JSON[_0xc2ee('0x11')](_0x4f51f3));if(_0x4f51f3[_0xc2ee('0x12')]){if(_0x4f51f3[_0xc2ee('0x12')][_0xc2ee('0x13')]===0x1f4){logger[_0xc2ee('0x12')](_0xc2ee('0xe'),_0x3c1786,_0x4f51f3[_0xc2ee('0x12')][_0xc2ee('0x14')]);return _0x30c9f5(_0x4f51f3[_0xc2ee('0x12')][_0xc2ee('0x14')]);}logger[_0xc2ee('0x12')](_0xc2ee('0xe'),_0x3c1786,_0x4f51f3['error']['message']);return _0xcf3f03(_0x4f51f3[_0xc2ee('0x12')]['message']);}else{logger[_0xc2ee('0xd')](_0xc2ee('0xe'),_0x3c1786,'request\x20sent');_0xcf3f03(_0x4f51f3[_0xc2ee('0x15')][_0xc2ee('0x14')]);}})[_0xc2ee('0x16')](function(_0x3fd0e0){logger[_0xc2ee('0x12')](_0xc2ee('0xe'),_0x3c1786,_0x3fd0e0);_0x30c9f5(_0x3fd0e0);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 0ae4135..401c329 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 _0x2914=['index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','/:id/users','getAgents','post','/:id/canned_answers','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated'];(function(_0x2351b7,_0x669c2c){var _0x2d0032=function(_0x54a6d2){while(--_0x54a6d2){_0x2351b7['push'](_0x2351b7['shift']());}};_0x2d0032(++_0x669c2c);}(_0x2914,0xdf));var _0x4291=function(_0x560e55,_0x1dfd2a){_0x560e55=_0x560e55-0x0;var _0x386a00=_0x2914[_0x560e55];return _0x386a00;};'use strict';var multer=require(_0x4291('0x0'));var util=require(_0x4291('0x1'));var path=require('path');var timeout=require(_0x4291('0x2'));var express=require(_0x4291('0x3'));var router=express[_0x4291('0x4')]();var fs_extra=require(_0x4291('0x5'));var auth=require(_0x4291('0x6'));var interaction=require(_0x4291('0x7'));var config=require(_0x4291('0x8'));var controller=require(_0x4291('0x9'));router[_0x4291('0xa')]('/',auth[_0x4291('0xb')](),controller[_0x4291('0xc')]);router[_0x4291('0xa')](_0x4291('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4291('0xe'),auth[_0x4291('0xb')](),controller[_0x4291('0xf')]);router[_0x4291('0xa')](_0x4291('0x10'),auth[_0x4291('0xb')](),controller[_0x4291('0x11')]);router[_0x4291('0xa')]('/:id/canned_answers',auth[_0x4291('0xb')](),controller[_0x4291('0x12')]);router[_0x4291('0xa')](_0x4291('0x13'),auth[_0x4291('0xb')](),controller[_0x4291('0x14')]);router['get'](_0x4291('0x15'),auth[_0x4291('0xb')](),controller['getSmtp']);router[_0x4291('0xa')]('/:id/interactions',auth[_0x4291('0xb')](),controller[_0x4291('0x16')]);router[_0x4291('0xa')](_0x4291('0x17'),auth[_0x4291('0xb')](),controller[_0x4291('0x18')]);router[_0x4291('0xa')]('/:id/messages',auth[_0x4291('0xb')](),controller[_0x4291('0x19')]);router['get'](_0x4291('0x1a'),auth[_0x4291('0xb')](),controller['verifySmtp']);router['get'](_0x4291('0x1b'),auth['isAuthenticated'](),controller[_0x4291('0x1c')]);router[_0x4291('0x1d')](_0x4291('0x10'),auth[_0x4291('0xb')](),controller['addDisposition']);router[_0x4291('0x1d')](_0x4291('0x1e'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x4291('0x1d')]('/',auth[_0x4291('0xb')](),controller['create']);router[_0x4291('0x1d')]('/:id/in_servers',auth[_0x4291('0xb')](),controller[_0x4291('0x1f')]);router[_0x4291('0x1d')](_0x4291('0x15'),auth[_0x4291('0xb')](),controller[_0x4291('0x20')]);router['post'](_0x4291('0x21'),auth[_0x4291('0xb')](),controller[_0x4291('0x22')]);router[_0x4291('0x1d')](_0x4291('0x17'),auth['isAuthenticated'](),controller[_0x4291('0x23')]);router['post'](_0x4291('0x24'),auth[_0x4291('0xb')](),controller[_0x4291('0x25')]);router[_0x4291('0x1d')](_0x4291('0x1b'),auth[_0x4291('0xb')](),controller[_0x4291('0x26')]);router[_0x4291('0x27')](_0x4291('0xe'),auth['isAuthenticated'](),controller[_0x4291('0x28')]);router[_0x4291('0x29')](_0x4291('0x10'),auth[_0x4291('0xb')](),controller[_0x4291('0x2a')]);router[_0x4291('0x29')](_0x4291('0x1e'),auth[_0x4291('0xb')](),controller[_0x4291('0x2b')]);router[_0x4291('0x29')](_0x4291('0x13'),auth['isAuthenticated'](),controller[_0x4291('0x2c')]);router['delete'](_0x4291('0x15'),auth['isAuthenticated'](),controller[_0x4291('0x2d')]);router['delete'](_0x4291('0xe'),auth[_0x4291('0xb')](),controller['destroy']);router['delete'](_0x4291('0x1b'),auth['isAuthenticated'](),controller[_0x4291('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x3c82=['/:id/users','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','/:id/out_servers','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp'];(function(_0x514b3b,_0x4973b1){var _0x336648=function(_0x417336){while(--_0x417336){_0x514b3b['push'](_0x514b3b['shift']());}};_0x336648(++_0x4973b1);}(_0x3c82,0x7b));var _0x23c8=function(_0x127215,_0x57c99b){_0x127215=_0x127215-0x0;var _0x4fd80d=_0x3c82[_0x127215];return _0x4fd80d;};'use strict';var multer=require(_0x23c8('0x0'));var util=require(_0x23c8('0x1'));var path=require(_0x23c8('0x2'));var timeout=require(_0x23c8('0x3'));var express=require(_0x23c8('0x4'));var router=express[_0x23c8('0x5')]();var fs_extra=require(_0x23c8('0x6'));var auth=require(_0x23c8('0x7'));var interaction=require(_0x23c8('0x8'));var config=require(_0x23c8('0x9'));var controller=require(_0x23c8('0xa'));router[_0x23c8('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x23c8('0xc'),auth[_0x23c8('0xd')](),controller['describe']);router[_0x23c8('0xb')](_0x23c8('0xe'),auth[_0x23c8('0xd')](),controller[_0x23c8('0xf')]);router[_0x23c8('0xb')](_0x23c8('0x10'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x11')]);router[_0x23c8('0xb')](_0x23c8('0x12'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x13')]);router[_0x23c8('0xb')](_0x23c8('0x14'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x15')]);router[_0x23c8('0xb')]('/:id/out_servers',auth[_0x23c8('0xd')](),controller[_0x23c8('0x16')]);router[_0x23c8('0xb')](_0x23c8('0x17'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x18')]);router['get'](_0x23c8('0x19'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x1a')]);router['get'](_0x23c8('0x1b'),auth[_0x23c8('0xd')](),controller['getMessages']);router[_0x23c8('0xb')](_0x23c8('0x1c'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x1d')]);router['get'](_0x23c8('0x1e'),auth[_0x23c8('0xd')](),controller['getAgents']);router[_0x23c8('0x1f')](_0x23c8('0x10'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x20')]);router[_0x23c8('0x1f')](_0x23c8('0x12'),auth['isAuthenticated'](),controller[_0x23c8('0x21')]);router[_0x23c8('0x1f')]('/',auth[_0x23c8('0xd')](),controller[_0x23c8('0x22')]);router['post'](_0x23c8('0x14'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x23')]);router['post']('/:id/out_servers',auth[_0x23c8('0xd')](),controller[_0x23c8('0x24')]);router[_0x23c8('0x1f')](_0x23c8('0x17'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x25')]);router[_0x23c8('0x1f')]('/:id/applications',auth[_0x23c8('0xd')](),controller[_0x23c8('0x26')]);router[_0x23c8('0x1f')](_0x23c8('0x27'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x28')]);router[_0x23c8('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x23c8('0x29')]);router[_0x23c8('0x2a')](_0x23c8('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x23c8('0x2b')](_0x23c8('0x10'),auth['isAuthenticated'](),controller[_0x23c8('0x2c')]);router[_0x23c8('0x2b')]('/:id/canned_answers',auth[_0x23c8('0xd')](),controller[_0x23c8('0x2d')]);router['delete'](_0x23c8('0x14'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x2e')]);router[_0x23c8('0x2b')](_0x23c8('0x2f'),auth[_0x23c8('0xd')](),controller[_0x23c8('0x30')]);router['delete'](_0x23c8('0xe'),auth['isAuthenticated'](),controller[_0x23c8('0x31')]);router['delete'](_0x23c8('0x1e'),auth[_0x23c8('0xd')](),controller['removeAgents']);module[_0x23c8('0x32')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d74743f..48dd91d 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 _0x2209=['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','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0x2209,0x95));var _0x9220=function(_0x13d1fc,_0x503f21){_0x13d1fc=_0x13d1fc-0x0;var _0x3a9d6a=_0x2209[_0x13d1fc];return _0x3a9d6a;};'use strict';var Sequelize=require(_0x9220('0x0'));module[_0x9220('0x1')]={'description':{'type':Sequelize[_0x9220('0x2')]},'name':{'type':Sequelize[_0x9220('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x9220('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9220('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x9220('0x4')]},'markAsUnread':{'type':Sequelize[_0x9220('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9220('0x2')],'allowNull':![],'defaultValue':_0x9220('0x5')},'fontSize':{'type':Sequelize[_0x9220('0x6')](0x2)[_0x9220('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9220('0x4')],'defaultValue':function(){return _0x9220('0x8');}},'notificationSound':{'type':Sequelize[_0x9220('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9220('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9220('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9220('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9220('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9220('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x9220('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9220('0xa'),'set':function(_0x1cafe6){if(!_0x1cafe6)this[_0x9220('0xb')](_0x9220('0xc'),null);this[_0x9220('0xb')](_0x9220('0xd'),_0x1cafe6);}}}; \ No newline at end of file +var _0x202c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0xb77dd4,_0x371dd8){var _0x29db3c=function(_0x37f493){while(--_0x37f493){_0xb77dd4['push'](_0xb77dd4['shift']());}};_0x29db3c(++_0x371dd8);}(_0x202c,0x178));var _0xc202=function(_0x684d5f,_0x4c5aa9){_0x684d5f=_0x684d5f-0x0;var _0x197a09=_0x202c[_0x684d5f];return _0x197a09;};'use strict';var Sequelize=require(_0xc202('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xc202('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xc202('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xc202('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xc202('0x3')]},'markAsUnread':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc202('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xc202('0x4')](0x2)[_0xc202('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc202('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc202('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc202('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc202('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc202('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xc202('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![],'comment':_0xc202('0x8'),'set':function(_0x630e57){if(!_0x630e57)this[_0xc202('0x9')](_0xc202('0xa'),null);this['setDataValue'](_0xc202('0xb'),_0x630e57);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 144704f..0988a3d 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 _0xfb5f=['include','findAll','show','params','Smtp','mandatoryDispositionPause','merge','find','body','describe','addDisposition','create','getDispositions','findOne','Disposition','order','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','rows','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','pass','cpassword','authentication','host','port','service','cuser','password','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','send','CmList','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','auth','secure','SendMail','sendMail','List\x20not\x20found','attach','out','format','messageId','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','juice','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','localhost','socket.io-emitter','redis','./mailAccount.socket','register','client','http','request','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','MailAccounts','UserProfileResource','destroy','end','name','index','MailServerIn','Imap','MailServerOut','Pause','map','MailAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll'];(function(_0x1291c1,_0x1d4506){var _0x11dc13=function(_0xdea51b){while(--_0xdea51b){_0x1291c1['push'](_0x1291c1['shift']());}};_0x11dc13(++_0x1d4506);}(_0xfb5f,0x6c));var _0xffb5=function(_0x3b4cf3,_0x46686f){_0x3b4cf3=_0x3b4cf3-0x0;var _0x53e7c6=_0xfb5f[_0x3b4cf3];return _0x53e7c6;};'use strict';var emlformat=require(_0xffb5('0x0'));var rimraf=require(_0xffb5('0x1'));var zipdir=require(_0xffb5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffb5('0x3'));var moment=require(_0xffb5('0x4'));var BPromise=require(_0xffb5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xffb5('0x6'));var sox=require(_0xffb5('0x7'));var csv=require(_0xffb5('0x8'));var ejs=require(_0xffb5('0x9'));var fs=require('fs');var fs_extra=require(_0xffb5('0xa'));var _=require(_0xffb5('0xb'));var squel=require(_0xffb5('0xc'));var crypto=require(_0xffb5('0xd'));var jsforce=require(_0xffb5('0xe'));var deskjs=require(_0xffb5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xffb5('0x10'));var Papa=require('papaparse');var htmlToText=require(_0xffb5('0x11'));var juice=require(_0xffb5('0x12'));var Redis=require('ioredis');var authService=require(_0xffb5('0x13'));var qs=require(_0xffb5('0x14'));var as=require(_0xffb5('0x15'));var hardwareService=require(_0xffb5('0x16'));var logger=require(_0xffb5('0x17'))(_0xffb5('0x18'));var utils=require(_0xffb5('0x19'));var config=require(_0xffb5('0x1a'));var licenseUtil=require(_0xffb5('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xffb5('0x1c'),'port':0x18eb});var socket=require(_0xffb5('0x1d'))(new Redis(config[_0xffb5('0x1e')]));require(_0xffb5('0x1f'))[_0xffb5('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xffb5('0x21')][_0xffb5('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x5a2d62,_0x53b51b,_0x2bff35,_0x17df79){return new BPromise(function(_0x4c7541,_0x3109d8){var _0x1567db=_0x17df79||client;return _0x1567db[_0xffb5('0x23')](_0x5a2d62,_0x2bff35)['then'](function(_0x1011aa){logger[_0xffb5('0x24')](_0xffb5('0x25'),_0x53b51b,'request\x20sent');logger[_0xffb5('0x26')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x53b51b,_0xffb5('0x27'),JSON[_0xffb5('0x28')](_0x1011aa));if(_0x1011aa[_0xffb5('0x29')]){if(_0x1011aa[_0xffb5('0x29')][_0xffb5('0x2a')]===0x1f4){logger[_0xffb5('0x29')](_0xffb5('0x25'),_0x53b51b,_0x1011aa['error'][_0xffb5('0x2b')]);return _0x3109d8(_0x1011aa[_0xffb5('0x29')][_0xffb5('0x2b')]);}logger['error'](_0xffb5('0x25'),_0x53b51b,_0x1011aa[_0xffb5('0x29')][_0xffb5('0x2b')]);return _0x4c7541(_0x1011aa[_0xffb5('0x29')]['message']);}else{logger[_0xffb5('0x24')]('MailAccount,\x20%s,\x20%s',_0x53b51b,_0xffb5('0x27'));_0x4c7541(_0x1011aa['result'][_0xffb5('0x2b')]);}})[_0xffb5('0x2c')](function(_0x2f2758){logger[_0xffb5('0x29')](_0xffb5('0x25'),_0x53b51b,_0x2f2758);_0x3109d8(_0x2f2758);});});}function respondWithStatusCode(_0x34ce28,_0x95279){_0x95279=_0x95279||0xcc;return function(_0x2a0828){if(_0x2a0828){return _0x34ce28[_0xffb5('0x2d')](_0x95279);}return _0x34ce28[_0xffb5('0x2e')](_0x95279)['end']();};}function respondWithResult(_0x5a1b90,_0x222669){_0x222669=_0x222669||0xc8;return function(_0x3af532){if(_0x3af532){return _0x5a1b90[_0xffb5('0x2e')](_0x222669)[_0xffb5('0x2f')](_0x3af532);}};}function respondWithFilteredResult(_0x2fbacb,_0x3ce4ea){return function(_0x261a35){if(_0x261a35){var _0x39b50e=typeof _0x3ce4ea[_0xffb5('0x30')]==='undefined'&&typeof _0x3ce4ea[_0xffb5('0x31')]==='undefined';var _0x53b4b4=_0x261a35[_0xffb5('0x32')];var _0x3ade28=_0x39b50e?0x0:_0x3ce4ea[_0xffb5('0x30')];var _0x5bf8fd=_0x39b50e?_0x261a35[_0xffb5('0x32')]:_0x3ce4ea[_0xffb5('0x30')]+_0x3ce4ea[_0xffb5('0x31')];var _0x2005f0;if(_0x5bf8fd>=_0x53b4b4){_0x5bf8fd=_0x53b4b4;_0x2005f0=0xc8;}else{_0x2005f0=0xce;}_0x2fbacb['status'](_0x2005f0);return _0x2fbacb[_0xffb5('0x33')](_0xffb5('0x34'),_0x3ade28+'-'+_0x5bf8fd+'/'+_0x53b4b4)[_0xffb5('0x2f')](_0x261a35);}return null;};}function patchUpdates(_0x16ae83){return function(_0x499448){try{jsonpatch[_0xffb5('0x35')](_0x499448,_0x16ae83,!![]);}catch(_0x5d28c0){return BPromise[_0xffb5('0x36')](_0x5d28c0);}return _0x499448[_0xffb5('0x37')]();};}function saveUpdates(_0x55fb19,_0x572039){return function(_0x222bf9){if(_0x222bf9){return _0x222bf9[_0xffb5('0x38')](_0x55fb19)['then'](function(_0x56e24e){return _0x56e24e;});}return null;};}function removeEntity(_0x2ff513,_0x2cb62b){return function(_0x463a17){if(_0x463a17){return _0x463a17['destroy']()[_0xffb5('0x39')](function(){var _0x141dab=_0x463a17[_0xffb5('0x3a')]({'plain':!![]});var _0x3736e6=_0xffb5('0x3b');return db[_0xffb5('0x3c')][_0xffb5('0x3d')]({'where':{'type':_0x3736e6,'resourceId':_0x141dab['id']}})[_0xffb5('0x39')](function(){return _0x463a17;});})[_0xffb5('0x39')](function(){_0x2ff513[_0xffb5('0x2e')](0xcc)[_0xffb5('0x3e')]();});}};}function handleEntityNotFound(_0x27bbd7,_0xf8200e){return function(_0x143ecc){if(!_0x143ecc){_0x27bbd7[_0xffb5('0x2d')](0x194);}return _0x143ecc;};}function handleError(_0x510045,_0x2d2e47){_0x2d2e47=_0x2d2e47||0x1f4;return function(_0x5715df){logger[_0xffb5('0x29')](_0x5715df['stack']);if(_0x5715df[_0xffb5('0x3f')]){delete _0x5715df[_0xffb5('0x3f')];}_0x510045[_0xffb5('0x2e')](_0x2d2e47)['send'](_0x5715df);};}exports[_0xffb5('0x40')]=function(_0x593dd6,_0x1a8004){var _0x3f1209={'include':[{'model':db[_0xffb5('0x41')],'as':_0xffb5('0x42')},{'model':db[_0xffb5('0x43')],'as':'Smtp'},{'model':db[_0xffb5('0x44')],'as':'mandatoryDispositionPause'}]},_0x10a230={},_0x539afb={'count':0x0,'rows':[]};var _0x29c35a=_[_0xffb5('0x45')](db[_0xffb5('0x46')][_0xffb5('0x47')],function(_0x46c02b){return{'name':_0x46c02b['fieldName'],'type':_0x46c02b[_0xffb5('0x48')][_0xffb5('0x49')]};});_0x10a230[_0xffb5('0x4a')]=_[_0xffb5('0x45')](_0x29c35a,'name');_0x10a230[_0xffb5('0x4b')]=_[_0xffb5('0x4c')](_0x593dd6[_0xffb5('0x4b')]);_0x10a230[_0xffb5('0x4d')]=_['intersection'](_0x10a230[_0xffb5('0x4a')],_0x10a230[_0xffb5('0x4b')]);_0x3f1209[_0xffb5('0x4e')]=_[_0xffb5('0x4f')](_0x10a230['model'],qs[_0xffb5('0x50')](_0x593dd6['query'][_0xffb5('0x50')]));_0x3f1209[_0xffb5('0x4e')]=_0x3f1209[_0xffb5('0x4e')][_0xffb5('0x51')]?_0x3f1209['attributes']:_0x10a230[_0xffb5('0x4a')];if(!_0x593dd6[_0xffb5('0x4b')][_0xffb5('0x52')](_0xffb5('0x53'))){_0x3f1209[_0xffb5('0x31')]=qs[_0xffb5('0x31')](_0x593dd6[_0xffb5('0x4b')][_0xffb5('0x31')]);_0x3f1209[_0xffb5('0x30')]=qs['offset'](_0x593dd6[_0xffb5('0x4b')][_0xffb5('0x30')]);}_0x3f1209['order']=qs[_0xffb5('0x54')](_0x593dd6[_0xffb5('0x4b')]['sort']);_0x3f1209[_0xffb5('0x55')]=qs[_0xffb5('0x4d')](_[_0xffb5('0x56')](_0x593dd6[_0xffb5('0x4b')],_0x10a230[_0xffb5('0x4d')]),_0x29c35a);if(_0x593dd6['query'][_0xffb5('0x57')]){_0x3f1209[_0xffb5('0x55')]=_['merge'](_0x3f1209[_0xffb5('0x55')],{'$or':_['map'](_0x29c35a,function(_0x19d2c5){if(_0x19d2c5[_0xffb5('0x48')]!=='VIRTUAL'){var _0x5c08ee={};_0x5c08ee[_0x19d2c5['name']]={'$like':'%'+_0x593dd6[_0xffb5('0x4b')][_0xffb5('0x57')]+'%'};return _0x5c08ee;}})});}_0x3f1209=_['merge']({},_0x3f1209,_0x593dd6[_0xffb5('0x58')]);var _0x42a538={'where':_0x3f1209['where']};return db[_0xffb5('0x46')][_0xffb5('0x32')](_0x42a538)[_0xffb5('0x39')](function(_0x214a25){_0x539afb['count']=_0x214a25;if(_0x593dd6[_0xffb5('0x4b')][_0xffb5('0x59')]){_0x3f1209[_0xffb5('0x5a')]=[{'all':!![]}];}return db[_0xffb5('0x46')][_0xffb5('0x5b')](_0x3f1209);})[_0xffb5('0x39')](function(_0x58301e){_0x539afb['rows']=_0x58301e;return _0x539afb;})[_0xffb5('0x39')](respondWithFilteredResult(_0x1a8004,_0x3f1209))['catch'](handleError(_0x1a8004,null));};exports[_0xffb5('0x5c')]=function(_0x8e3b32,_0x4cf76b){var _0x311247={'raw':![],'where':{'id':_0x8e3b32[_0xffb5('0x5d')]['id']},'include':[{'model':db[_0xffb5('0x41')],'as':_0xffb5('0x42')},{'model':db[_0xffb5('0x43')],'as':_0xffb5('0x5e')},{'model':db[_0xffb5('0x44')],'as':_0xffb5('0x5f')}]},_0x409af5={};_0x409af5[_0xffb5('0x4a')]=_[_0xffb5('0x4c')](db[_0xffb5('0x46')][_0xffb5('0x47')]);_0x409af5[_0xffb5('0x4b')]=_['keys'](_0x8e3b32['query']);_0x409af5['filters']=_[_0xffb5('0x4f')](_0x409af5[_0xffb5('0x4a')],_0x409af5[_0xffb5('0x4b')]);_0x311247[_0xffb5('0x4e')]=_[_0xffb5('0x4f')](_0x409af5['model'],qs[_0xffb5('0x50')](_0x8e3b32[_0xffb5('0x4b')][_0xffb5('0x50')]));_0x311247['attributes']=_0x311247[_0xffb5('0x4e')][_0xffb5('0x51')]?_0x311247[_0xffb5('0x4e')]:_0x409af5[_0xffb5('0x4a')];if(_0x8e3b32[_0xffb5('0x4b')][_0xffb5('0x59')]){_0x311247[_0xffb5('0x5a')]=[{'all':!![]}];}_0x311247=_[_0xffb5('0x60')]({},_0x311247,_0x8e3b32[_0xffb5('0x58')]);return db[_0xffb5('0x46')][_0xffb5('0x61')](_0x311247)[_0xffb5('0x39')](handleEntityNotFound(_0x4cf76b,null))['then'](respondWithResult(_0x4cf76b,null))[_0xffb5('0x2c')](handleError(_0x4cf76b,null));};exports[_0xffb5('0x38')]=function(_0x44d148,_0x49af04){if(_0x44d148[_0xffb5('0x62')]['id']){delete _0x44d148['body']['id'];}return db[_0xffb5('0x46')][_0xffb5('0x61')]({'where':{'id':_0x44d148[_0xffb5('0x5d')]['id']},'include':[{'model':db[_0xffb5('0x41')],'as':'Imap'},{'model':db[_0xffb5('0x43')],'as':_0xffb5('0x5e')},{'model':db[_0xffb5('0x44')],'as':_0xffb5('0x5f')}]})['then'](handleEntityNotFound(_0x49af04,null))[_0xffb5('0x39')](saveUpdates(_0x44d148[_0xffb5('0x62')],null))[_0xffb5('0x39')](function(_0xe3b0ff){if(_0xe3b0ff&&_0x44d148[_0xffb5('0x62')][_0xffb5('0x42')]){return db[_0xffb5('0x41')]['update'](_0x44d148['body'][_0xffb5('0x42')],{'where':{'MailAccountId':_0xe3b0ff['id']}})[_0xffb5('0x39')](function(){return _0xe3b0ff;});}return _0xe3b0ff;})[_0xffb5('0x39')](function(_0xbcc46f){if(_0xbcc46f&&_0x44d148[_0xffb5('0x62')]['Smtp']){return db[_0xffb5('0x43')]['update'](_0x44d148['body'][_0xffb5('0x5e')],{'where':{'MailAccountId':_0xbcc46f['id']}})['then'](function(){return _0xbcc46f;});}return _0xbcc46f;})[_0xffb5('0x39')](respondWithResult(_0x49af04,null))[_0xffb5('0x2c')](handleError(_0x49af04,null));};exports[_0xffb5('0x63')]=function(_0x159f35,_0x242edc){return db[_0xffb5('0x46')][_0xffb5('0x63')]()[_0xffb5('0x39')](respondWithResult(_0x242edc,null))[_0xffb5('0x2c')](handleError(_0x242edc,null));};exports[_0xffb5('0x64')]=function(_0x2d3882,_0x2c8ed6,_0x41fa54){if(_0x2d3882[_0xffb5('0x62')]['id']){delete _0x2d3882['body']['id'];}return db[_0xffb5('0x46')][_0xffb5('0x61')]({'where':{'id':_0x2d3882['params']['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x2c8ed6,null))['then'](function(_0x57bb80){if(_0x57bb80){_0x2d3882[_0xffb5('0x62')]['MailAccountId']=_0x57bb80['id'];return db['Disposition'][_0xffb5('0x65')](_0x2d3882[_0xffb5('0x62')]);}})[_0xffb5('0x39')](respondWithResult(_0x2c8ed6,null))[_0xffb5('0x2c')](handleError(_0x2c8ed6,null));};exports[_0xffb5('0x66')]=function(_0x1f597a,_0x5d7842,_0x19911d){var _0x3fd642={'raw':![],'where':{}};var _0xeb6bd8={};var _0x4dde13={'count':0x0,'rows':[]};return db[_0xffb5('0x46')][_0xffb5('0x67')]({'where':{'id':_0x1f597a[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x5d7842,null))['then'](function(_0x14c458){if(_0x14c458){_0xeb6bd8['model']=_[_0xffb5('0x4c')](db[_0xffb5('0x68')][_0xffb5('0x47')]);_0xeb6bd8[_0xffb5('0x4b')]=_[_0xffb5('0x4c')](_0x1f597a[_0xffb5('0x4b')]);_0xeb6bd8['filters']=_[_0xffb5('0x4f')](_0xeb6bd8[_0xffb5('0x4a')],_0xeb6bd8[_0xffb5('0x4b')]);_0x3fd642[_0xffb5('0x4e')]=_[_0xffb5('0x4f')](_0xeb6bd8[_0xffb5('0x4a')],qs[_0xffb5('0x50')](_0x1f597a[_0xffb5('0x4b')][_0xffb5('0x50')]));_0x3fd642[_0xffb5('0x4e')]=_0x3fd642['attributes'][_0xffb5('0x51')]?_0x3fd642['attributes']:_0xeb6bd8[_0xffb5('0x4a')];if(!_0x1f597a['query'][_0xffb5('0x52')]('nolimit')){_0x3fd642[_0xffb5('0x31')]=qs[_0xffb5('0x31')](_0x1f597a[_0xffb5('0x4b')][_0xffb5('0x31')]);_0x3fd642[_0xffb5('0x30')]=qs[_0xffb5('0x30')](_0x1f597a[_0xffb5('0x4b')]['offset']);}_0x3fd642[_0xffb5('0x69')]=qs[_0xffb5('0x54')](_0x1f597a[_0xffb5('0x4b')][_0xffb5('0x54')]);_0x3fd642[_0xffb5('0x55')]=qs['filters'](_['pick'](_0x1f597a[_0xffb5('0x4b')],_0xeb6bd8['filters']));_0x3fd642[_0xffb5('0x55')][_0xffb5('0x6a')]=_0x14c458['id'];if(_0x1f597a['query']['filter']){_0x3fd642[_0xffb5('0x55')]=_[_0xffb5('0x60')](_0x3fd642['where'],{'$or':_['map'](_0x3fd642['attributes'],function(_0x4499bb){var _0x41a49f={};_0x41a49f[_0x4499bb]={'$like':'%'+_0x1f597a[_0xffb5('0x4b')]['filter']+'%'};return _0x41a49f;})});}_0x3fd642=_[_0xffb5('0x60')]({},_0x3fd642,_0x1f597a[_0xffb5('0x58')]);return db[_0xffb5('0x68')][_0xffb5('0x32')]({'where':_0x3fd642[_0xffb5('0x55')]})[_0xffb5('0x39')](function(_0x53cbd3){_0x4dde13['count']=_0x53cbd3;if(_0x1f597a[_0xffb5('0x4b')]['includeAll']){_0x3fd642[_0xffb5('0x5a')]=[{'all':!![]}];}return db[_0xffb5('0x68')][_0xffb5('0x5b')](_0x3fd642);})[_0xffb5('0x39')](function(_0x524d8d){_0x4dde13['rows']=_0x524d8d;return _0x4dde13;});}})[_0xffb5('0x39')](respondWithFilteredResult(_0x5d7842,_0x3fd642))[_0xffb5('0x2c')](handleError(_0x5d7842,null));};exports[_0xffb5('0x6b')]=function(_0x323f1e,_0x2fadec,_0x1262d7){return db['MailAccount'][_0xffb5('0x61')]({'where':{'id':_0x323f1e['params']['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x2fadec,null))[_0xffb5('0x39')](function(_0x1ed32b){if(_0x1ed32b){return _0x1ed32b[_0xffb5('0x6b')](_0x323f1e[_0xffb5('0x4b')][_0xffb5('0x6c')]);}})[_0xffb5('0x39')](respondWithStatusCode(_0x2fadec,null))[_0xffb5('0x2c')](handleError(_0x2fadec,null));};exports[_0xffb5('0x6d')]=function(_0x33c877,_0x26702f,_0x4c5639){if(_0x33c877['body']['id']){delete _0x33c877[_0xffb5('0x62')]['id'];}return db['MailAccount'][_0xffb5('0x61')]({'where':{'id':_0x33c877[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x26702f,null))[_0xffb5('0x39')](function(_0x339256){if(_0x339256){_0x33c877[_0xffb5('0x62')]['MailAccountId']=_0x339256['id'];return db['CannedAnswer']['create'](_0x33c877[_0xffb5('0x62')]);}})[_0xffb5('0x39')](respondWithResult(_0x26702f,null))['catch'](handleError(_0x26702f,null));};exports['getAnswers']=function(_0x1cf77d,_0x4bc633,_0xf2ebe5){var _0x4e2eab={'raw':![],'where':{}};var _0x4af1a4={};var _0x2c85ec={'count':0x0,'rows':[]};return db['MailAccount'][_0xffb5('0x67')]({'where':{'id':_0x1cf77d[_0xffb5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4bc633,null))['then'](function(_0x20e297){if(_0x20e297){_0x4af1a4['model']=_[_0xffb5('0x4c')](db['CannedAnswer']['rawAttributes']);_0x4af1a4[_0xffb5('0x4b')]=_[_0xffb5('0x4c')](_0x1cf77d[_0xffb5('0x4b')]);_0x4af1a4[_0xffb5('0x4d')]=_[_0xffb5('0x4f')](_0x4af1a4[_0xffb5('0x4a')],_0x4af1a4[_0xffb5('0x4b')]);_0x4e2eab['attributes']=_[_0xffb5('0x4f')](_0x4af1a4['model'],qs[_0xffb5('0x50')](_0x1cf77d[_0xffb5('0x4b')][_0xffb5('0x50')]));_0x4e2eab['attributes']=_0x4e2eab[_0xffb5('0x4e')][_0xffb5('0x51')]?_0x4e2eab[_0xffb5('0x4e')]:_0x4af1a4[_0xffb5('0x4a')];if(!_0x1cf77d[_0xffb5('0x4b')][_0xffb5('0x52')](_0xffb5('0x53'))){_0x4e2eab[_0xffb5('0x31')]=qs[_0xffb5('0x31')](_0x1cf77d['query'][_0xffb5('0x31')]);_0x4e2eab[_0xffb5('0x30')]=qs[_0xffb5('0x30')](_0x1cf77d[_0xffb5('0x4b')][_0xffb5('0x30')]);}_0x4e2eab[_0xffb5('0x69')]=qs['sort'](_0x1cf77d[_0xffb5('0x4b')][_0xffb5('0x54')]);_0x4e2eab[_0xffb5('0x55')]=qs['filters'](_[_0xffb5('0x56')](_0x1cf77d[_0xffb5('0x4b')],_0x4af1a4[_0xffb5('0x4d')]));_0x4e2eab[_0xffb5('0x55')]['MailAccountId']=_0x20e297['id'];if(_0x1cf77d['query'][_0xffb5('0x57')]){_0x4e2eab['where']=_[_0xffb5('0x60')](_0x4e2eab[_0xffb5('0x55')],{'$or':_['map'](_0x4e2eab[_0xffb5('0x4e')],function(_0x2d29a1){var _0x3cd36={};_0x3cd36[_0x2d29a1]={'$like':'%'+_0x1cf77d[_0xffb5('0x4b')][_0xffb5('0x57')]+'%'};return _0x3cd36;})});}_0x4e2eab=_['merge']({},_0x4e2eab,_0x1cf77d[_0xffb5('0x58')]);return db[_0xffb5('0x6e')][_0xffb5('0x32')]({'where':_0x4e2eab[_0xffb5('0x55')]})['then'](function(_0xa5b9de){_0x2c85ec[_0xffb5('0x32')]=_0xa5b9de;if(_0x1cf77d[_0xffb5('0x4b')][_0xffb5('0x59')]){_0x4e2eab['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xffb5('0x5b')](_0x4e2eab);})[_0xffb5('0x39')](function(_0x1a4c8c){_0x2c85ec[_0xffb5('0x6f')]=_0x1a4c8c;return _0x2c85ec;});}})[_0xffb5('0x39')](respondWithFilteredResult(_0x4bc633,_0x4e2eab))[_0xffb5('0x2c')](handleError(_0x4bc633,null));};exports[_0xffb5('0x70')]=function(_0xcd93ed,_0x10a12f,_0x1f5cc5){return db['MailAccount'][_0xffb5('0x61')]({'where':{'id':_0xcd93ed[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x10a12f,null))[_0xffb5('0x39')](function(_0x17c089){if(_0x17c089){return _0x17c089[_0xffb5('0x70')](_0xcd93ed[_0xffb5('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x10a12f,null))[_0xffb5('0x2c')](handleError(_0x10a12f,null));};exports[_0xffb5('0x65')]=function(_0x205e69,_0x28e1fe){var _0x45ba20={'name':_0x205e69['body'][_0xffb5('0x3f')],'key':_0x205e69['body'][_0xffb5('0x49')],'email':_0x205e69[_0xffb5('0x62')][_0xffb5('0x71')],'ListId':_0x205e69[_0xffb5('0x62')][_0xffb5('0x72')],'active':!_[_0xffb5('0x73')](_0x205e69[_0xffb5('0x62')][_0xffb5('0x74')])?_0x205e69['body'][_0xffb5('0x74')]:!![],'description':_0x205e69[_0xffb5('0x62')][_0xffb5('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0xffb5('0x73')](_0x205e69['body'][_0xffb5('0x76')])){if(_0x205e69['body'][_0xffb5('0x77')]){_0x45ba20[_0xffb5('0x42')][_0xffb5('0x78')]=_0x45ba20[_0xffb5('0x5e')][_0xffb5('0x78')]=_0x205e69['body']['cuser'];_0x45ba20[_0xffb5('0x42')]['password']=_0x45ba20[_0xffb5('0x5e')][_0xffb5('0x79')]=_0x205e69[_0xffb5('0x62')][_0xffb5('0x7a')];}else{_0x45ba20[_0xffb5('0x42')]['authentication']=_0x45ba20[_0xffb5('0x5e')][_0xffb5('0x7b')]=![];}_0x45ba20[_0xffb5('0x42')][_0xffb5('0x7c')]=_0x205e69[_0xffb5('0x62')][_0xffb5('0x42')][_0xffb5('0x7c')];_0x45ba20[_0xffb5('0x42')][_0xffb5('0x7d')]=_0x205e69[_0xffb5('0x62')][_0xffb5('0x42')][_0xffb5('0x7d')];_0x45ba20[_0xffb5('0x5e')][_0xffb5('0x7c')]=_0x205e69[_0xffb5('0x62')]['Smtp']['host'];_0x45ba20[_0xffb5('0x5e')][_0xffb5('0x7d')]=_0x205e69[_0xffb5('0x62')][_0xffb5('0x5e')][_0xffb5('0x7d')];}else{_0x45ba20[_0xffb5('0x42')][_0xffb5('0x7e')]=_0x45ba20[_0xffb5('0x5e')][_0xffb5('0x7e')]=_0x205e69[_0xffb5('0x62')][_0xffb5('0x76')];_0x45ba20['Imap'][_0xffb5('0x78')]=_0x45ba20[_0xffb5('0x5e')][_0xffb5('0x78')]=_0x205e69[_0xffb5('0x62')][_0xffb5('0x7f')];_0x45ba20[_0xffb5('0x42')][_0xffb5('0x80')]=_0x45ba20['Smtp']['pass']=_0x205e69[_0xffb5('0x62')][_0xffb5('0x7a')];}return db['MailAccount'][_0xffb5('0x65')](_0x45ba20,{'include':[{'model':db[_0xffb5('0x43')],'as':'Smtp'},{'model':db[_0xffb5('0x41')],'as':_0xffb5('0x42')}]})[_0xffb5('0x39')](function(_0x552260){var _0x1525b6=_0x205e69[_0xffb5('0x78')][_0xffb5('0x3a')]({'plain':!![]});if(!_0x1525b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1525b6[_0xffb5('0x81')]===_0xffb5('0x78')){var _0x1ef624=_0x552260[_0xffb5('0x3a')]({'plain':!![]});return db[_0xffb5('0x82')][_0xffb5('0x61')]({'where':{'name':_0xffb5('0x3b'),'userProfileId':_0x1525b6[_0xffb5('0x83')]},'raw':!![]})[_0xffb5('0x39')](function(_0x8dace9){if(_0x8dace9&&_0x8dace9[_0xffb5('0x84')]===0x0){return db[_0xffb5('0x3c')]['create']({'name':_0x1ef624[_0xffb5('0x3f')],'resourceId':_0x1ef624['id'],'type':_0x8dace9['name'],'sectionId':_0x8dace9['id']},{})[_0xffb5('0x39')](function(){return _0x552260;});}else{return _0x552260;}})['catch'](function(_0x44783f){logger[_0xffb5('0x29')](_0xffb5('0x85'),_0x44783f);throw _0x44783f;});}return _0x552260;})[_0xffb5('0x39')](respondWithResult(_0x28e1fe,0xc9))[_0xffb5('0x2c')](handleError(_0x28e1fe,null));};exports[_0xffb5('0x86')]=function(_0x3eeb2a,_0x8fe6fe,_0x50b1b8){return db['MailAccount']['findOne']({'where':{'id':_0x3eeb2a[_0xffb5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x8fe6fe,null))['then'](function(_0x21900e){if(_0x21900e){return _0x21900e[_0xffb5('0x86')]();}return null;})[_0xffb5('0x39')](respondWithResult(_0x8fe6fe,null))['catch'](handleError(_0x8fe6fe,null));};exports[_0xffb5('0x87')]=function(_0x120ff2,_0x2bc439,_0x5455be){if(_0x120ff2['body']['id']){delete _0x120ff2[_0xffb5('0x62')]['id'];}return db[_0xffb5('0x46')][_0xffb5('0x61')]({'where':{'id':_0x120ff2[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x2bc439,null))[_0xffb5('0x39')](function(_0x1dcd3d){if(_0x1dcd3d){_0x120ff2['body']['MailAccountId']=_0x1dcd3d['id'];return db[_0xffb5('0x41')][_0xffb5('0x65')](_0x120ff2[_0xffb5('0x62')]);}})[_0xffb5('0x39')](respondWithResult(_0x2bc439,null))['catch'](handleError(_0x2bc439,null));};exports[_0xffb5('0x88')]=function(_0x552c18,_0x2c2bc9,_0x5164da){return db[_0xffb5('0x46')][_0xffb5('0x67')]({'where':{'id':_0x552c18[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x2c2bc9,null))[_0xffb5('0x39')](function(_0x1a613f){if(_0x1a613f){return _0x1a613f[_0xffb5('0x89')](null);}return null;})['then'](respondWithStatusCode(_0x2c2bc9,null))[_0xffb5('0x2c')](handleError(_0x2c2bc9,null));};exports[_0xffb5('0x8a')]=function(_0x482bf4,_0x410837,_0x35ade3){return db['MailAccount'][_0xffb5('0x67')]({'where':{'id':_0x482bf4[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x410837,null))[_0xffb5('0x39')](function(_0x31e1c9){if(_0x31e1c9){return _0x31e1c9[_0xffb5('0x8a')]();}return null;})[_0xffb5('0x39')](respondWithResult(_0x410837,null))[_0xffb5('0x2c')](handleError(_0x410837,null));};exports[_0xffb5('0x8b')]=function(_0x3246ab,_0x224f0c,_0x4d778f){if(_0x3246ab[_0xffb5('0x62')]['id']){delete _0x3246ab['body']['id'];}return db[_0xffb5('0x46')][_0xffb5('0x61')]({'where':{'id':_0x3246ab[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x224f0c,null))['then'](function(_0x560c08){if(_0x560c08){_0x3246ab[_0xffb5('0x62')][_0xffb5('0x6a')]=_0x560c08['id'];return db['MailServerOut'][_0xffb5('0x65')](_0x3246ab[_0xffb5('0x62')]);}})[_0xffb5('0x39')](respondWithResult(_0x224f0c,null))[_0xffb5('0x2c')](handleError(_0x224f0c,null));};exports['removeSmtp']=function(_0x279977,_0x5d1418,_0x2d24cd){return db[_0xffb5('0x46')][_0xffb5('0x67')]({'where':{'id':_0x279977[_0xffb5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5d1418,null))[_0xffb5('0x39')](function(_0x5c07bd){if(_0x5c07bd){return _0x5c07bd['setSmtp'](null);}return null;})[_0xffb5('0x39')](respondWithStatusCode(_0x5d1418,null))[_0xffb5('0x2c')](handleError(_0x5d1418,null));};exports[_0xffb5('0x8c')]=function(_0x1d8cb1,_0x561ec1,_0x454eb8){return db['MailInteraction'][_0xffb5('0x61')]({'where':{'id':_0x1d8cb1[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x561ec1,null))[_0xffb5('0x39')](function(_0x396828){if(_0x396828){return _0x396828[_0xffb5('0x8c')](_0x1d8cb1[_0xffb5('0x62')][_0xffb5('0x6c')],_[_0xffb5('0x8d')](_0x1d8cb1['body'],[_0xffb5('0x6c'),'id'])||{});}})[_0xffb5('0x39')](respondWithResult(_0x561ec1,null))['catch'](handleError(_0x561ec1,null));};exports['getInteractions']=function(_0xdbed04,_0x19532,_0x8029c3){var _0x1d85ed={'raw':![],'where':{}};var _0x45fb5c={};var _0x393672={'count':0x0,'rows':[]};return db[_0xffb5('0x46')][_0xffb5('0x67')]({'where':{'id':_0xdbed04[_0xffb5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x19532,null))[_0xffb5('0x39')](function(_0x2814b8){if(_0x2814b8){_0x45fb5c[_0xffb5('0x4a')]=_[_0xffb5('0x4c')](db[_0xffb5('0x8e')]['rawAttributes']);_0x45fb5c[_0xffb5('0x4b')]=_[_0xffb5('0x4c')](_0xdbed04[_0xffb5('0x4b')]);_0x45fb5c[_0xffb5('0x4d')]=_[_0xffb5('0x4f')](_0x45fb5c['model'],_0x45fb5c['query']);_0x1d85ed[_0xffb5('0x4e')]=_['intersection'](_0x45fb5c[_0xffb5('0x4a')],qs[_0xffb5('0x50')](_0xdbed04[_0xffb5('0x4b')][_0xffb5('0x50')]));_0x1d85ed['attributes']=_0x1d85ed[_0xffb5('0x4e')][_0xffb5('0x51')]?_0x1d85ed[_0xffb5('0x4e')]:_0x45fb5c[_0xffb5('0x4a')];if(!_0xdbed04[_0xffb5('0x4b')][_0xffb5('0x52')]('nolimit')){_0x1d85ed[_0xffb5('0x31')]=qs['limit'](_0xdbed04[_0xffb5('0x4b')][_0xffb5('0x31')]);_0x1d85ed['offset']=qs['offset'](_0xdbed04['query']['offset']);}_0x1d85ed[_0xffb5('0x69')]=qs[_0xffb5('0x54')](_0xdbed04[_0xffb5('0x4b')][_0xffb5('0x54')]);_0x1d85ed['where']=qs[_0xffb5('0x4d')](_[_0xffb5('0x56')](_0xdbed04[_0xffb5('0x4b')],_0x45fb5c[_0xffb5('0x4d')]));_0x1d85ed[_0xffb5('0x55')]['MailAccountId']=_0x2814b8['id'];if(_0xdbed04[_0xffb5('0x4b')]['filter']){_0x1d85ed[_0xffb5('0x55')]=_[_0xffb5('0x60')](_0x1d85ed[_0xffb5('0x55')],{'$or':_['map'](_0x1d85ed[_0xffb5('0x4e')],function(_0x211a98){var _0x189123={};_0x189123[_0x211a98]={'$like':'%'+_0xdbed04[_0xffb5('0x4b')][_0xffb5('0x57')]+'%'};return _0x189123;})});}_0x1d85ed=_[_0xffb5('0x60')]({},_0x1d85ed,_0xdbed04[_0xffb5('0x58')]);return db[_0xffb5('0x8e')][_0xffb5('0x32')]({'where':_0x1d85ed['where']})[_0xffb5('0x39')](function(_0x6c4b00){_0x393672[_0xffb5('0x32')]=_0x6c4b00;if(_0xdbed04[_0xffb5('0x4b')]['includeAll']){_0x1d85ed[_0xffb5('0x5a')]=[{'model':db[_0xffb5('0x8f')],'as':_0xffb5('0x90'),'required':![]},{'model':db['User'],'as':_0xffb5('0x91'),'attributes':[_0xffb5('0x3f'),'fullname',_0xffb5('0x92')],'required':![]},{'model':db[_0xffb5('0x93')],'as':_0xffb5('0x94'),'attributes':['id',_0xffb5('0x3f'),_0xffb5('0x95')],'where':_0xdbed04[_0xffb5('0x4b')]['tag']?{'id':_0xdbed04['query']['tag']}:undefined,'required':_0xdbed04['query'][_0xffb5('0x96')]?!![]:![]}];}return db[_0xffb5('0x8e')][_0xffb5('0x5b')](_0x1d85ed);})[_0xffb5('0x39')](function(_0x5a5aa3){_0x393672['rows']=_0x5a5aa3;return _0x393672;});}})[_0xffb5('0x39')](respondWithFilteredResult(_0x19532,_0x1d85ed))[_0xffb5('0x2c')](handleError(_0x19532,null));};exports[_0xffb5('0x97')]=function(_0x30a684,_0xed2a23,_0x35e4e7){return db['MailAccount']['findOne']({'where':{'id':_0x30a684[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0xed2a23,null))[_0xffb5('0x39')](function(_0x307a23){if(_0x307a23){return db[_0xffb5('0x98')][_0xffb5('0x99')](function(_0x315cb2){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x30a684[_0xffb5('0x5d')]['id']},'transaction':_0x315cb2})[_0xffb5('0x39')](function(_0x563fe6){var _0x2e9ab8=_[_0xffb5('0x45')](_0x30a684[_0xffb5('0x62')],function(_0x314b24){_0x314b24[_0xffb5('0x6a')]=_0x30a684[_0xffb5('0x5d')]['id'];return _0x314b24;});return db[_0xffb5('0x9a')][_0xffb5('0x9b')](_0x2e9ab8,{'transaction':_0x315cb2});});})[_0xffb5('0x39')](function(){return db[_0xffb5('0x9a')][_0xffb5('0x9c')]({'where':{'MailAccountId':_0x30a684[_0xffb5('0x5d')]['id']},'order':_0xffb5('0x9d')});});}})[_0xffb5('0x39')](respondWithResult(_0xed2a23,null))['catch'](handleError(_0xed2a23,null));};exports[_0xffb5('0x9e')]=function(_0x28bc60,_0x1e7326,_0x282a6d){var _0x21df13={};var _0x3f1461={};var _0x12c78f;var _0x546d5b;return db['MailAccount'][_0xffb5('0x67')]({'where':{'id':_0x28bc60[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x1e7326,null))['then'](function(_0x352eb5){if(_0x352eb5){_0x12c78f=_0x352eb5;_0x3f1461['model']=_['keys'](db[_0xffb5('0x9a')][_0xffb5('0x47')]);_0x3f1461[_0xffb5('0x4b')]=_['keys'](_0x28bc60['query']);_0x3f1461['filters']=_['intersection'](_0x3f1461['model'],_0x3f1461['query']);_0x21df13[_0xffb5('0x4e')]=_[_0xffb5('0x4f')](_0x3f1461[_0xffb5('0x4a')],qs[_0xffb5('0x50')](_0x28bc60[_0xffb5('0x4b')][_0xffb5('0x50')]));_0x21df13[_0xffb5('0x4e')]=_0x21df13[_0xffb5('0x4e')][_0xffb5('0x51')]?_0x21df13[_0xffb5('0x4e')]:_0x3f1461[_0xffb5('0x4a')];_0x21df13['order']=qs['sort'](_0x28bc60[_0xffb5('0x4b')][_0xffb5('0x54')]);_0x21df13[_0xffb5('0x55')]=qs[_0xffb5('0x4d')](_[_0xffb5('0x56')](_0x28bc60[_0xffb5('0x4b')],_0x3f1461[_0xffb5('0x4d')]));if(_0x28bc60[_0xffb5('0x4b')][_0xffb5('0x57')]){_0x21df13[_0xffb5('0x55')]=_[_0xffb5('0x60')](_0x21df13[_0xffb5('0x55')],{'$or':_['map'](_0x21df13[_0xffb5('0x4e')],function(_0x156e0d){var _0x50b9f5={};_0x50b9f5[_0x156e0d]={'$like':'%'+_0x28bc60['query'][_0xffb5('0x57')]+'%'};return _0x50b9f5;})});}_0x21df13=_[_0xffb5('0x60')]({},_0x21df13,_0x28bc60['options']);return _0x12c78f[_0xffb5('0x9e')](_0x21df13);}})[_0xffb5('0x39')](function(_0x323ac7){if(_0x323ac7){_0x546d5b=_0x323ac7[_0xffb5('0x51')];if(!_0x28bc60[_0xffb5('0x4b')][_0xffb5('0x52')](_0xffb5('0x53'))){_0x21df13[_0xffb5('0x31')]=qs['limit'](_0x28bc60['query'][_0xffb5('0x31')]);_0x21df13[_0xffb5('0x30')]=qs[_0xffb5('0x30')](_0x28bc60[_0xffb5('0x4b')][_0xffb5('0x30')]);}return _0x12c78f[_0xffb5('0x9e')](_0x21df13);}})['then'](function(_0x161a95){if(_0x161a95){return _0x161a95?{'count':_0x546d5b,'rows':_0x161a95}:null;}})[_0xffb5('0x39')](respondWithResult(_0x1e7326,null))[_0xffb5('0x2c')](handleError(_0x1e7326,null));};exports[_0xffb5('0x9f')]=function(_0x544acc,_0x3d4a57,_0x448ecb){var _0x50c6fe={'raw':!![],'where':{}};var _0x3d004d={};var _0x25f6af={'count':0x0,'rows':[]};return db[_0xffb5('0x46')][_0xffb5('0x67')]({'where':{'id':_0x544acc[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x3d4a57,null))[_0xffb5('0x39')](function(_0x5b5060){if(_0x5b5060){_0x3d004d[_0xffb5('0x4a')]=_[_0xffb5('0x4c')](db[_0xffb5('0xa0')]['rawAttributes']);_0x3d004d[_0xffb5('0x4b')]=_['keys'](_0x544acc['query']);_0x3d004d[_0xffb5('0x4d')]=_[_0xffb5('0x4f')](_0x3d004d['model'],_0x3d004d[_0xffb5('0x4b')]);_0x50c6fe['attributes']=_[_0xffb5('0x4f')](_0x3d004d[_0xffb5('0x4a')],qs[_0xffb5('0x50')](_0x544acc[_0xffb5('0x4b')][_0xffb5('0x50')]));_0x50c6fe[_0xffb5('0x4e')]=_0x50c6fe[_0xffb5('0x4e')]['length']?_0x50c6fe['attributes']:_0x3d004d['model'];if(!_0x544acc[_0xffb5('0x4b')][_0xffb5('0x52')](_0xffb5('0x53'))){_0x50c6fe['limit']=qs['limit'](_0x544acc[_0xffb5('0x4b')]['limit']);_0x50c6fe[_0xffb5('0x30')]=qs['offset'](_0x544acc[_0xffb5('0x4b')][_0xffb5('0x30')]);}_0x50c6fe[_0xffb5('0x69')]=qs[_0xffb5('0x54')](_0x544acc[_0xffb5('0x4b')][_0xffb5('0x54')]);_0x50c6fe[_0xffb5('0x55')]=qs['filters'](_['pick'](_0x544acc[_0xffb5('0x4b')],_0x3d004d[_0xffb5('0x4d')]));_0x50c6fe[_0xffb5('0x55')]['MailAccountId']=_0x5b5060['id'];if(_0x544acc['query'][_0xffb5('0x57')]){_0x50c6fe[_0xffb5('0x55')]=_[_0xffb5('0x60')](_0x50c6fe[_0xffb5('0x55')],{'$or':_[_0xffb5('0x45')](_0x50c6fe['attributes'],function(_0x21fc44){var _0x1d94b0={};_0x1d94b0[_0x21fc44]={'$like':'%'+_0x544acc[_0xffb5('0x4b')][_0xffb5('0x57')]+'%'};return _0x1d94b0;})});}if(_0x544acc[_0xffb5('0x4b')][_0xffb5('0xa1')]){var _0x2bc8d8=_0x544acc[_0xffb5('0x4b')][_0xffb5('0xa1')]['split'](',');var _0x1a6a16={};_0x1a6a16[_0x2bc8d8[0x0]]={'$gte':moment(_0x2bc8d8[0x1])['format'](_0xffb5('0xa2'))};_0x50c6fe[_0xffb5('0x55')]=_[_0xffb5('0x60')](_0x50c6fe[_0xffb5('0x55')],_0x1a6a16);}_0x50c6fe=_[_0xffb5('0x60')]({},_0x50c6fe,_0x544acc['options']);return db[_0xffb5('0xa0')][_0xffb5('0x32')]({'where':_0x50c6fe[_0xffb5('0x55')]})[_0xffb5('0x39')](function(_0x32cc89){_0x25f6af[_0xffb5('0x32')]=_0x32cc89;if(_0x544acc[_0xffb5('0x4b')][_0xffb5('0x59')]){_0x50c6fe[_0xffb5('0x5a')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x50c6fe);})['then'](function(_0x3e6c2e){if(_0x544acc[_0xffb5('0x4b')][_0xffb5('0xa3')]===_0xffb5('0xa4')){for(var _0x45e1e2=0x0;_0x45e1e2<_0x3e6c2e[_0xffb5('0x51')];_0x45e1e2++){_0x3e6c2e[_0x45e1e2]['body']=juice(_0x3e6c2e[_0x45e1e2][_0xffb5('0x62')]);}}_0x25f6af['rows']=_0x3e6c2e;return _0x25f6af;});}})['then'](respondWithFilteredResult(_0x3d4a57,_0x50c6fe))[_0xffb5('0x2c')](handleError(_0x3d4a57,null));};exports[_0xffb5('0xa5')]=function(_0x331f3a,_0x55cf3e,_0x262cad){var _0x191763,_0x2b6a8d={},_0x5ea222;if(_0x331f3a[_0xffb5('0x62')]['to']){_0x5ea222=_0x331f3a['body']['to']['split'](',')[0x0];}return db[_0xffb5('0x46')][_0xffb5('0x61')]({'where':{'id':_0x331f3a[_0xffb5('0x5d')]['id']},'include':[{'model':db[_0xffb5('0xa6')],'as':_0xffb5('0xa7'),'include':[{'model':db['CmContact'],'as':_0xffb5('0xa8'),'where':{'email':_0x5ea222},'limit':0x1,'order':[[_0xffb5('0xa9'),'DESC']]}]},{'model':db[_0xffb5('0x43')],'as':_0xffb5('0x5e'),'raw':!![]}]})[_0xffb5('0x39')](handleEntityNotFound(_0x55cf3e,null))[_0xffb5('0x39')](function(_0x4ebb90){if(_0x4ebb90){_0x191763=_0x4ebb90;if(_0x4ebb90[_0xffb5('0x5e')]){if(_[_0xffb5('0x73')](_0x331f3a[_0xffb5('0x62')][_0xffb5('0xaa')])){_0x331f3a[_0xffb5('0x62')][_0xffb5('0xaa')]=util['format'](_0xffb5('0xab'),_0x4ebb90[_0xffb5('0x3f')],_0x4ebb90[_0xffb5('0x71')]||_0x4ebb90[_0xffb5('0x5e')][_0xffb5('0x78')]);}if(_0x331f3a['body'][_0xffb5('0xac')]&&_0x331f3a[_0xffb5('0x62')]['attachments'][_0xffb5('0x51')]){for(var _0x364eff=0x0;_0x364eff<_0x331f3a[_0xffb5('0x62')][_0xffb5('0xac')][_0xffb5('0x51')];_0x364eff+=0x1){_0x331f3a[_0xffb5('0x62')][_0xffb5('0xac')][_0x364eff]={'filename':_0x331f3a[_0xffb5('0x62')]['attachments'][_0x364eff][_0xffb5('0x3f')],'path':path[_0xffb5('0xad')](config[_0xffb5('0xae')],_0xffb5('0xaf'),_0x331f3a[_0xffb5('0x62')][_0xffb5('0xac')][_0x364eff]['basename'])};}}var _0x17ebd6={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x4ebb90[_0xffb5('0x5e')][_0xffb5('0x7e')])){if(_0x4ebb90['Smtp']['authentication']){_0x17ebd6[_0xffb5('0xb0')]={'user':_0x4ebb90[_0xffb5('0x5e')]['user'],'pass':_0x4ebb90[_0xffb5('0x5e')][_0xffb5('0x79')]};}_0x17ebd6['host']=_0x4ebb90[_0xffb5('0x5e')][_0xffb5('0x7c')];_0x17ebd6[_0xffb5('0x7d')]=_0x4ebb90[_0xffb5('0x5e')][_0xffb5('0x7d')];_0x17ebd6[_0xffb5('0xb1')]=_0x4ebb90['Smtp'][_0xffb5('0xb1')];}else{_0x17ebd6[_0xffb5('0x7e')]=_0x4ebb90[_0xffb5('0x5e')][_0xffb5('0x7e')];_0x17ebd6[_0xffb5('0xb0')]={'user':_0x4ebb90[_0xffb5('0x5e')][_0xffb5('0x78')],'pass':_0x4ebb90[_0xffb5('0x5e')][_0xffb5('0x79')]};}return respondWithRpcPromise(_0xffb5('0xb2'),_0xffb5('0xb3'),{'account':_0x17ebd6,'message':_0x331f3a[_0xffb5('0x62')]});}else{throw new Error(_0xffb5('0xb4'));}}})[_0xffb5('0x39')](function(_0xdf0f11){if(_0xdf0f11){_0x2b6a8d=_0xdf0f11;if(_0x191763[_0xffb5('0xa7')]){if(_0x191763[_0xffb5('0xa7')][_0xffb5('0xa8')][_0xffb5('0x51')]){return _0x191763[_0xffb5('0xa7')][_0xffb5('0xa8')][0x0];}else{return db['CmContact'][_0xffb5('0x65')](_['defaults'](_0x331f3a[_0xffb5('0x62')],{'firstName':_0x331f3a['body']['to'],'email':_0x331f3a['body']['to'],'phone':_0x331f3a['body']['to'],'ListId':_0x191763['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0xffb5('0x39')](function(_0x36384c){if(_0x36384c){var _0x21ccb5={'UserId':_0x331f3a[_0xffb5('0x78')]['id'],'ContactId':_0x36384c['id'],'MailAccountId':_0x191763['id'],'inReplyTo':_0x2b6a8d['messageId'],'to':_0x331f3a[_0xffb5('0x62')][_0xffb5('0xaa')],'cc':_0x331f3a[_0xffb5('0x62')]['cc'],'subject':_0x331f3a[_0xffb5('0x62')]['subject'],'attach':_0x331f3a[_0xffb5('0x62')][_0xffb5('0xb5')],'firstMsgDirection':_0xffb5('0xb6'),'lastMsgAt':moment()[_0xffb5('0xb7')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0xffb5('0x60')](_0x331f3a['body'],{'messageId':_0x2b6a8d[_0xffb5('0xb8')],'sentAt':moment()['format'](_0xffb5('0xa2')),'read':!![],'MailAccountId':_0x191763['id'],'UserId':_0x331f3a[_0xffb5('0x78')]['id'],'ContactId':_0x36384c['id']})]};if(_0x331f3a[_0xffb5('0x62')][_0xffb5('0xb9')]){_0x21ccb5=_['merge'](_0x21ccb5,_0x331f3a[_0xffb5('0x62')][_0xffb5('0xb9')]);}return db[_0xffb5('0x8e')]['create'](_0x21ccb5,{'include':[{'model':db['MailMessage'],'as':_0xffb5('0xba')}]});}})['then'](respondWithResult(_0x55cf3e,null))[_0xffb5('0x2c')](handleError(_0x55cf3e,null));};exports[_0xffb5('0xbb')]=function(_0x325ac1,_0x26d99e,_0x17f665){return db[_0xffb5('0x46')][_0xffb5('0x61')]({'where':{'id':_0x325ac1[_0xffb5('0x5d')]['id']},'include':[{'model':db[_0xffb5('0x43')],'as':_0xffb5('0x5e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x26d99e,null))[_0xffb5('0x39')](function(_0x703ca3){if(_0x703ca3&&_0x703ca3[_0xffb5('0x5e')]){var _0xd2a996={'id':_0x703ca3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x703ca3[_0xffb5('0x5e')][_0xffb5('0x7e')]){_0xd2a996[_0xffb5('0x7e')]=_0x703ca3[_0xffb5('0x5e')][_0xffb5('0x7e')];}else{_0xd2a996[_0xffb5('0x7c')]=_0x703ca3[_0xffb5('0x5e')][_0xffb5('0x7c')];_0xd2a996[_0xffb5('0x7d')]=_0x703ca3[_0xffb5('0x5e')][_0xffb5('0x7d')];_0xd2a996[_0xffb5('0xb1')]=_0x703ca3[_0xffb5('0x5e')][_0xffb5('0xb1')];}if(_0x703ca3[_0xffb5('0x5e')]['authentication']){_0xd2a996[_0xffb5('0xb0')]={'user':_0x703ca3[_0xffb5('0x5e')][_0xffb5('0x78')],'pass':_0x703ca3['Smtp'][_0xffb5('0x79')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0xd2a996});}})[_0xffb5('0x39')](respondWithResult(_0x26d99e,null))[_0xffb5('0x2c')](handleError(_0x26d99e,null));};exports[_0xffb5('0x3d')]=function(_0x42577b,_0x45565b){return db[_0xffb5('0x46')][_0xffb5('0x61')]({'where':{'id':_0x42577b['params']['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x45565b,null))[_0xffb5('0x39')](function(_0x462cc6){if(_0x462cc6&&_0x462cc6[_0xffb5('0x7e')]){throw new db['Sequelize'][(_0xffb5('0xbc'))](_0xffb5('0xbd'));}return _0x462cc6;})[_0xffb5('0x39')](removeEntity(_0x45565b,null))[_0xffb5('0x2c')](handleError(_0x45565b,null));};exports['addAgents']=function(_0x180586,_0x4f4c6a,_0x4f487a){return db[_0xffb5('0x46')][_0xffb5('0x61')]({'where':{'id':_0x180586['params']['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x4f4c6a,null))[_0xffb5('0x39')](function(_0x4d0ae){if(_0x4d0ae){return _0x4d0ae[_0xffb5('0xbe')](_0x180586[_0xffb5('0x62')]['ids'],_['omit'](_0x180586[_0xffb5('0x62')],[_0xffb5('0x6c'),'id'])||{})[_0xffb5('0xbf')](function(_0x30e061){for(var _0x2ec9e6=0x0;_0x2ec9e6<_0x180586[_0xffb5('0x62')][_0xffb5('0x6c')][_0xffb5('0x51')];_0x2ec9e6+=0x1){socket[_0xffb5('0xc0')]('userMailAccount:save',{'UserId':Number(_0x180586[_0xffb5('0x62')][_0xffb5('0x6c')][_0x2ec9e6]),'MailAccountId':Number(_0x180586[_0xffb5('0x5d')]['id'])});}return _0x30e061;});}})[_0xffb5('0x39')](respondWithResult(_0x4f4c6a,null))[_0xffb5('0x2c')](handleError(_0x4f4c6a,null));};exports[_0xffb5('0xc1')]=function(_0x1c303f,_0x353a49,_0x340927){return db[_0xffb5('0x46')]['find']({'where':{'id':_0x1c303f[_0xffb5('0x5d')]['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x353a49,null))[_0xffb5('0x39')](function(_0x2b09e6){if(_0x2b09e6){return _0x2b09e6[_0xffb5('0xc1')](_0x1c303f[_0xffb5('0x4b')]['ids'])[_0xffb5('0x39')](function(){if(_[_0xffb5('0xc2')](_0x1c303f[_0xffb5('0x4b')][_0xffb5('0x6c')])){for(var _0x236bc5=0x0;_0x236bc5<_0x1c303f[_0xffb5('0x4b')][_0xffb5('0x6c')][_0xffb5('0x51')];_0x236bc5+=0x1){socket[_0xffb5('0xc0')](_0xffb5('0xc3'),{'UserId':Number(_0x1c303f[_0xffb5('0x4b')][_0xffb5('0x6c')][_0x236bc5]),'MailAccountId':Number(_0x1c303f[_0xffb5('0x5d')]['id'])});}}else{socket[_0xffb5('0xc0')](_0xffb5('0xc3'),{'UserId':Number(_0x1c303f[_0xffb5('0x4b')][_0xffb5('0x6c')]),'MailAccountId':Number(_0x1c303f[_0xffb5('0x5d')]['id'])});}});}})[_0xffb5('0x39')](respondWithStatusCode(_0x353a49,null))[_0xffb5('0x2c')](handleError(_0x353a49,null));};exports['getAgents']=function(_0x12a15e,_0x233e0d,_0xa8d7c9){var _0x50d8a5={};var _0x6a6072={};var _0x11f185;var _0x3c16ad;return db[_0xffb5('0x46')][_0xffb5('0x67')]({'where':{'id':_0x12a15e['params']['id']}})[_0xffb5('0x39')](handleEntityNotFound(_0x233e0d,null))[_0xffb5('0x39')](function(_0x272b6e){if(_0x272b6e){_0x11f185=_0x272b6e;_0x6a6072[_0xffb5('0x4a')]=_['keys'](db[_0xffb5('0xc4')][_0xffb5('0x47')]);_0x6a6072['query']=_[_0xffb5('0x4c')](_0x12a15e[_0xffb5('0x4b')]);_0x6a6072[_0xffb5('0x4d')]=_['intersection'](_0x6a6072[_0xffb5('0x4a')],_0x6a6072[_0xffb5('0x4b')]);_0x50d8a5[_0xffb5('0x4e')]=_[_0xffb5('0x4f')](_0x6a6072[_0xffb5('0x4a')],qs[_0xffb5('0x50')](_0x12a15e[_0xffb5('0x4b')][_0xffb5('0x50')]));_0x50d8a5[_0xffb5('0x4e')]=_0x50d8a5[_0xffb5('0x4e')][_0xffb5('0x51')]?_0x50d8a5['attributes']:_0x6a6072[_0xffb5('0x4a')];_0x50d8a5['order']=qs['sort'](_0x12a15e['query'][_0xffb5('0x54')]);_0x50d8a5[_0xffb5('0x55')]=qs[_0xffb5('0x4d')](_[_0xffb5('0x56')](_0x12a15e[_0xffb5('0x4b')],_0x6a6072[_0xffb5('0x4d')]));if(_0x12a15e[_0xffb5('0x4b')][_0xffb5('0x57')]){_0x50d8a5[_0xffb5('0x55')]=_[_0xffb5('0x60')](_0x50d8a5[_0xffb5('0x55')],{'$or':_[_0xffb5('0x45')](_0x50d8a5[_0xffb5('0x4e')],function(_0x5bd731){var _0x2b07a6={};_0x2b07a6[_0x5bd731]={'$like':'%'+_0x12a15e['query'][_0xffb5('0x57')]+'%'};return _0x2b07a6;})});}_0x50d8a5=_[_0xffb5('0x60')]({},_0x50d8a5,_0x12a15e['options']);return _0x11f185[_0xffb5('0xc5')](_0x50d8a5);}})['then'](function(_0x1908ca){if(_0x1908ca){_0x3c16ad=_0x1908ca[_0xffb5('0x51')];if(!_0x12a15e[_0xffb5('0x4b')][_0xffb5('0x52')](_0xffb5('0x53'))){_0x50d8a5[_0xffb5('0x31')]=qs[_0xffb5('0x31')](_0x12a15e[_0xffb5('0x4b')]['limit']);_0x50d8a5[_0xffb5('0x30')]=qs['offset'](_0x12a15e['query'][_0xffb5('0x30')]);}return _0x11f185[_0xffb5('0xc5')](_0x50d8a5);}})[_0xffb5('0x39')](function(_0x2a3023){if(_0x2a3023){return _0x2a3023?{'count':_0x3c16ad,'rows':_0x2a3023}:null;}})[_0xffb5('0x39')](respondWithResult(_0x233e0d,null))[_0xffb5('0x2c')](handleError(_0x233e0d,null));}; \ No newline at end of file +var _0x02b5=['merge','options','include','findAll','show','keys','includeAll','body','find','params','describe','addDisposition','MailAccountId','getDispositions','Disposition','rows','ids','addAnswer','CannedAnswer','create','findOne','nolimit','removeAnswers','isNil','active','description','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','password','pass','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','addSmtp','removeSmtp','MailInteraction','addInteraction','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','updatedAt','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','ListId','messageId','attach','out','Interaction','Messages','VerifySmtp','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL'];(function(_0xb54705,_0x554359){var _0x1f4ecd=function(_0x168a30){while(--_0x168a30){_0xb54705['push'](_0xb54705['shift']());}};_0x1f4ecd(++_0x554359);}(_0x02b5,0x12c));var _0x502b=function(_0x59bcc6,_0xdc27e6){_0x59bcc6=_0x59bcc6-0x0;var _0x12c375=_0x02b5[_0x59bcc6];return _0x12c375;};'use strict';var emlformat=require(_0x502b('0x0'));var rimraf=require(_0x502b('0x1'));var zipdir=require(_0x502b('0x2'));var jsonpatch=require(_0x502b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x502b('0x4'));var Mustache=require(_0x502b('0x5'));var util=require(_0x502b('0x6'));var path=require(_0x502b('0x7'));var sox=require(_0x502b('0x8'));var csv=require(_0x502b('0x9'));var ejs=require(_0x502b('0xa'));var fs=require('fs');var fs_extra=require(_0x502b('0xb'));var _=require(_0x502b('0xc'));var squel=require(_0x502b('0xd'));var crypto=require(_0x502b('0xe'));var jsforce=require(_0x502b('0xf'));var deskjs=require(_0x502b('0x10'));var toCsv=require(_0x502b('0x9'));var querystring=require(_0x502b('0x11'));var Papa=require('papaparse');var htmlToText=require(_0x502b('0x12'));var juice=require(_0x502b('0x13'));var Redis=require(_0x502b('0x14'));var authService=require(_0x502b('0x15'));var qs=require(_0x502b('0x16'));var as=require(_0x502b('0x17'));var hardwareService=require(_0x502b('0x18'));var logger=require(_0x502b('0x19'))(_0x502b('0x1a'));var utils=require(_0x502b('0x1b'));var config=require(_0x502b('0x1c'));var licenseUtil=require(_0x502b('0x1d'));var db=require(_0x502b('0x1e'))['db'];config[_0x502b('0x1f')]=_[_0x502b('0x20')](config[_0x502b('0x1f')],{'host':_0x502b('0x21'),'port':0x18eb});var socket=require(_0x502b('0x22'))(new Redis(config[_0x502b('0x1f')]));require(_0x502b('0x23'))[_0x502b('0x24')](socket);var jayson=require(_0x502b('0x25'));var client=jayson['client'][_0x502b('0x26')]({'port':0x232b});function respondWithRpcPromise(_0x5c4ac0,_0x5613d6,_0x21bcae,_0x16a1c7){return new BPromise(function(_0xc0028e,_0x1b26e7){var _0x18ad60=_0x16a1c7||client;return _0x18ad60[_0x502b('0x27')](_0x5c4ac0,_0x21bcae)['then'](function(_0x4e744c){logger[_0x502b('0x28')](_0x502b('0x29'),_0x5613d6,_0x502b('0x2a'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x5613d6,_0x502b('0x2a'),JSON['stringify'](_0x4e744c));if(_0x4e744c[_0x502b('0x2b')]){if(_0x4e744c[_0x502b('0x2b')][_0x502b('0x2c')]===0x1f4){logger[_0x502b('0x2b')](_0x502b('0x29'),_0x5613d6,_0x4e744c[_0x502b('0x2b')][_0x502b('0x2d')]);return _0x1b26e7(_0x4e744c['error'][_0x502b('0x2d')]);}logger[_0x502b('0x2b')](_0x502b('0x29'),_0x5613d6,_0x4e744c[_0x502b('0x2b')][_0x502b('0x2d')]);return _0xc0028e(_0x4e744c[_0x502b('0x2b')][_0x502b('0x2d')]);}else{logger[_0x502b('0x28')](_0x502b('0x29'),_0x5613d6,_0x502b('0x2a'));_0xc0028e(_0x4e744c[_0x502b('0x2e')][_0x502b('0x2d')]);}})[_0x502b('0x2f')](function(_0x5842e8){logger['error'](_0x502b('0x29'),_0x5613d6,_0x5842e8);_0x1b26e7(_0x5842e8);});});}function respondWithStatusCode(_0x5732f3,_0x4eaf6a){_0x4eaf6a=_0x4eaf6a||0xcc;return function(_0x5e7038){if(_0x5e7038){return _0x5732f3[_0x502b('0x30')](_0x4eaf6a);}return _0x5732f3[_0x502b('0x31')](_0x4eaf6a)[_0x502b('0x32')]();};}function respondWithResult(_0x4c378e,_0x3920b4){_0x3920b4=_0x3920b4||0xc8;return function(_0x2b2d04){if(_0x2b2d04){return _0x4c378e['status'](_0x3920b4)['json'](_0x2b2d04);}};}function respondWithFilteredResult(_0x54b40c,_0x342455){return function(_0x4851a6){if(_0x4851a6){var _0x2692f3=typeof _0x342455[_0x502b('0x33')]===_0x502b('0x34')&&typeof _0x342455['limit']===_0x502b('0x34');var _0x4fff59=_0x4851a6[_0x502b('0x35')];var _0x1af899=_0x2692f3?0x0:_0x342455['offset'];var _0x4915b0=_0x2692f3?_0x4851a6['count']:_0x342455['offset']+_0x342455[_0x502b('0x36')];var _0x45785e;if(_0x4915b0>=_0x4fff59){_0x4915b0=_0x4fff59;_0x45785e=0xc8;}else{_0x45785e=0xce;}_0x54b40c[_0x502b('0x31')](_0x45785e);return _0x54b40c['set']('Content-Range',_0x1af899+'-'+_0x4915b0+'/'+_0x4fff59)[_0x502b('0x37')](_0x4851a6);}return null;};}function patchUpdates(_0x4601cc){return function(_0x3d33b1){try{jsonpatch[_0x502b('0x38')](_0x3d33b1,_0x4601cc,!![]);}catch(_0x25e08b){return BPromise[_0x502b('0x39')](_0x25e08b);}return _0x3d33b1[_0x502b('0x3a')]();};}function saveUpdates(_0x3dcb84,_0x4adac1){return function(_0x4d8eec){if(_0x4d8eec){return _0x4d8eec[_0x502b('0x3b')](_0x3dcb84)[_0x502b('0x3c')](function(_0x4100f2){return _0x4100f2;});}return null;};}function removeEntity(_0x1b4931,_0x28a41f){return function(_0x3a2a7f){if(_0x3a2a7f){return _0x3a2a7f[_0x502b('0x3d')]()[_0x502b('0x3c')](function(){var _0x3d0bb7=_0x3a2a7f[_0x502b('0x3e')]({'plain':!![]});var _0x5abfd1='MailAccounts';return db[_0x502b('0x3f')][_0x502b('0x3d')]({'where':{'type':_0x5abfd1,'resourceId':_0x3d0bb7['id']}})[_0x502b('0x3c')](function(){return _0x3a2a7f;});})[_0x502b('0x3c')](function(){_0x1b4931[_0x502b('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x474b68,_0x26333d){return function(_0x2b5cea){if(!_0x2b5cea){_0x474b68[_0x502b('0x30')](0x194);}return _0x2b5cea;};}function handleError(_0x50a2b0,_0x1f8b9c){_0x1f8b9c=_0x1f8b9c||0x1f4;return function(_0x1b7c53){logger['error'](_0x1b7c53[_0x502b('0x40')]);if(_0x1b7c53[_0x502b('0x41')]){delete _0x1b7c53['name'];}_0x50a2b0['status'](_0x1f8b9c)[_0x502b('0x42')](_0x1b7c53);};}exports[_0x502b('0x43')]=function(_0x442ccd,_0x5db8d0){var _0x35e3a1={'include':[{'model':db[_0x502b('0x44')],'as':_0x502b('0x45')},{'model':db[_0x502b('0x46')],'as':_0x502b('0x47')},{'model':db[_0x502b('0x48')],'as':_0x502b('0x49')}]},_0x2a785e={},_0x52a978={'count':0x0,'rows':[]};var _0x20d183=_[_0x502b('0x4a')](db[_0x502b('0x4b')][_0x502b('0x4c')],function(_0x11bff8){return{'name':_0x11bff8[_0x502b('0x4d')],'type':_0x11bff8[_0x502b('0x4e')][_0x502b('0x4f')]};});_0x2a785e[_0x502b('0x50')]=_[_0x502b('0x4a')](_0x20d183,_0x502b('0x41'));_0x2a785e[_0x502b('0x51')]=_['keys'](_0x442ccd[_0x502b('0x51')]);_0x2a785e['filters']=_[_0x502b('0x52')](_0x2a785e['model'],_0x2a785e[_0x502b('0x51')]);_0x35e3a1['attributes']=_[_0x502b('0x52')](_0x2a785e['model'],qs[_0x502b('0x53')](_0x442ccd[_0x502b('0x51')][_0x502b('0x53')]));_0x35e3a1[_0x502b('0x54')]=_0x35e3a1['attributes'][_0x502b('0x55')]?_0x35e3a1['attributes']:_0x2a785e['model'];if(!_0x442ccd[_0x502b('0x51')][_0x502b('0x56')]('nolimit')){_0x35e3a1[_0x502b('0x36')]=qs[_0x502b('0x36')](_0x442ccd['query']['limit']);_0x35e3a1[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x442ccd[_0x502b('0x51')][_0x502b('0x33')]);}_0x35e3a1[_0x502b('0x57')]=qs[_0x502b('0x58')](_0x442ccd[_0x502b('0x51')][_0x502b('0x58')]);_0x35e3a1[_0x502b('0x59')]=qs[_0x502b('0x5a')](_[_0x502b('0x5b')](_0x442ccd['query'],_0x2a785e[_0x502b('0x5a')]),_0x20d183);if(_0x442ccd[_0x502b('0x51')][_0x502b('0x5c')]){_0x35e3a1['where']=_['merge'](_0x35e3a1['where'],{'$or':_[_0x502b('0x4a')](_0x20d183,function(_0x5cf7d1){if(_0x5cf7d1[_0x502b('0x4e')]!==_0x502b('0x5d')){var _0x1364e8={};_0x1364e8[_0x5cf7d1[_0x502b('0x41')]]={'$like':'%'+_0x442ccd[_0x502b('0x51')]['filter']+'%'};return _0x1364e8;}})});}_0x35e3a1=_[_0x502b('0x5e')]({},_0x35e3a1,_0x442ccd[_0x502b('0x5f')]);var _0x184ab1={'where':_0x35e3a1[_0x502b('0x59')]};return db[_0x502b('0x4b')][_0x502b('0x35')](_0x184ab1)[_0x502b('0x3c')](function(_0x50e526){_0x52a978['count']=_0x50e526;if(_0x442ccd[_0x502b('0x51')]['includeAll']){_0x35e3a1[_0x502b('0x60')]=[{'all':!![]}];}return db[_0x502b('0x4b')][_0x502b('0x61')](_0x35e3a1);})['then'](function(_0x4fe777){_0x52a978['rows']=_0x4fe777;return _0x52a978;})[_0x502b('0x3c')](respondWithFilteredResult(_0x5db8d0,_0x35e3a1))[_0x502b('0x2f')](handleError(_0x5db8d0,null));};exports[_0x502b('0x62')]=function(_0xd31163,_0xc896f2){var _0x723a4e={'raw':![],'where':{'id':_0xd31163['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x502b('0x45')},{'model':db[_0x502b('0x46')],'as':_0x502b('0x47')},{'model':db[_0x502b('0x48')],'as':_0x502b('0x49')}]},_0x54b837={};_0x54b837[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x4b')][_0x502b('0x4c')]);_0x54b837['query']=_['keys'](_0xd31163[_0x502b('0x51')]);_0x54b837[_0x502b('0x5a')]=_['intersection'](_0x54b837[_0x502b('0x50')],_0x54b837[_0x502b('0x51')]);_0x723a4e['attributes']=_[_0x502b('0x52')](_0x54b837['model'],qs[_0x502b('0x53')](_0xd31163[_0x502b('0x51')][_0x502b('0x53')]));_0x723a4e[_0x502b('0x54')]=_0x723a4e[_0x502b('0x54')][_0x502b('0x55')]?_0x723a4e[_0x502b('0x54')]:_0x54b837[_0x502b('0x50')];if(_0xd31163[_0x502b('0x51')][_0x502b('0x64')]){_0x723a4e['include']=[{'all':!![]}];}_0x723a4e=_['merge']({},_0x723a4e,_0xd31163['options']);return db[_0x502b('0x4b')]['find'](_0x723a4e)[_0x502b('0x3c')](handleEntityNotFound(_0xc896f2,null))[_0x502b('0x3c')](respondWithResult(_0xc896f2,null))[_0x502b('0x2f')](handleError(_0xc896f2,null));};exports[_0x502b('0x3b')]=function(_0x1d5208,_0xbccf3b){if(_0x1d5208['body']['id']){delete _0x1d5208[_0x502b('0x65')]['id'];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x1d5208[_0x502b('0x67')]['id']},'include':[{'model':db[_0x502b('0x44')],'as':_0x502b('0x45')},{'model':db[_0x502b('0x46')],'as':_0x502b('0x47')},{'model':db[_0x502b('0x48')],'as':_0x502b('0x49')}]})[_0x502b('0x3c')](handleEntityNotFound(_0xbccf3b,null))[_0x502b('0x3c')](saveUpdates(_0x1d5208['body'],null))['then'](function(_0x41704a){if(_0x41704a&&_0x1d5208[_0x502b('0x65')][_0x502b('0x45')]){return db['MailServerIn'][_0x502b('0x3b')](_0x1d5208['body'][_0x502b('0x45')],{'where':{'MailAccountId':_0x41704a['id']}})[_0x502b('0x3c')](function(){return _0x41704a;});}return _0x41704a;})[_0x502b('0x3c')](function(_0x70a34d){if(_0x70a34d&&_0x1d5208['body'][_0x502b('0x47')]){return db[_0x502b('0x46')][_0x502b('0x3b')](_0x1d5208[_0x502b('0x65')][_0x502b('0x47')],{'where':{'MailAccountId':_0x70a34d['id']}})[_0x502b('0x3c')](function(){return _0x70a34d;});}return _0x70a34d;})['then'](respondWithResult(_0xbccf3b,null))[_0x502b('0x2f')](handleError(_0xbccf3b,null));};exports[_0x502b('0x68')]=function(_0x3eb795,_0x49e45c){return db[_0x502b('0x4b')]['describe']()['then'](respondWithResult(_0x49e45c,null))['catch'](handleError(_0x49e45c,null));};exports[_0x502b('0x69')]=function(_0x59dfd9,_0x20b1ae,_0x500237){if(_0x59dfd9[_0x502b('0x65')]['id']){delete _0x59dfd9[_0x502b('0x65')]['id'];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x59dfd9[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x20b1ae,null))[_0x502b('0x3c')](function(_0x28c875){if(_0x28c875){_0x59dfd9[_0x502b('0x65')][_0x502b('0x6a')]=_0x28c875['id'];return db['Disposition']['create'](_0x59dfd9['body']);}})['then'](respondWithResult(_0x20b1ae,null))[_0x502b('0x2f')](handleError(_0x20b1ae,null));};exports[_0x502b('0x6b')]=function(_0x2aad2c,_0x1d65e7,_0x1ce92d){var _0x2f0474={'raw':![],'where':{}};var _0x3ceb99={};var _0x3a080f={'count':0x0,'rows':[]};return db[_0x502b('0x4b')]['findOne']({'where':{'id':_0x2aad2c[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x1d65e7,null))[_0x502b('0x3c')](function(_0x491843){if(_0x491843){_0x3ceb99[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x6c')][_0x502b('0x4c')]);_0x3ceb99[_0x502b('0x51')]=_['keys'](_0x2aad2c[_0x502b('0x51')]);_0x3ceb99['filters']=_[_0x502b('0x52')](_0x3ceb99[_0x502b('0x50')],_0x3ceb99['query']);_0x2f0474['attributes']=_[_0x502b('0x52')](_0x3ceb99['model'],qs[_0x502b('0x53')](_0x2aad2c[_0x502b('0x51')][_0x502b('0x53')]));_0x2f0474[_0x502b('0x54')]=_0x2f0474[_0x502b('0x54')][_0x502b('0x55')]?_0x2f0474[_0x502b('0x54')]:_0x3ceb99['model'];if(!_0x2aad2c[_0x502b('0x51')][_0x502b('0x56')]('nolimit')){_0x2f0474[_0x502b('0x36')]=qs[_0x502b('0x36')](_0x2aad2c[_0x502b('0x51')][_0x502b('0x36')]);_0x2f0474[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x2aad2c['query'][_0x502b('0x33')]);}_0x2f0474['order']=qs[_0x502b('0x58')](_0x2aad2c['query']['sort']);_0x2f0474[_0x502b('0x59')]=qs[_0x502b('0x5a')](_[_0x502b('0x5b')](_0x2aad2c['query'],_0x3ceb99['filters']));_0x2f0474['where']['MailAccountId']=_0x491843['id'];if(_0x2aad2c[_0x502b('0x51')][_0x502b('0x5c')]){_0x2f0474['where']=_['merge'](_0x2f0474['where'],{'$or':_[_0x502b('0x4a')](_0x2f0474[_0x502b('0x54')],function(_0x4f168a){var _0x37065a={};_0x37065a[_0x4f168a]={'$like':'%'+_0x2aad2c[_0x502b('0x51')][_0x502b('0x5c')]+'%'};return _0x37065a;})});}_0x2f0474=_['merge']({},_0x2f0474,_0x2aad2c[_0x502b('0x5f')]);return db[_0x502b('0x6c')][_0x502b('0x35')]({'where':_0x2f0474[_0x502b('0x59')]})['then'](function(_0x3d7b11){_0x3a080f[_0x502b('0x35')]=_0x3d7b11;if(_0x2aad2c[_0x502b('0x51')][_0x502b('0x64')]){_0x2f0474[_0x502b('0x60')]=[{'all':!![]}];}return db[_0x502b('0x6c')]['findAll'](_0x2f0474);})[_0x502b('0x3c')](function(_0x10c31e){_0x3a080f[_0x502b('0x6d')]=_0x10c31e;return _0x3a080f;});}})[_0x502b('0x3c')](respondWithFilteredResult(_0x1d65e7,_0x2f0474))[_0x502b('0x2f')](handleError(_0x1d65e7,null));};exports['removeDispositions']=function(_0x5db8cd,_0x4e961d,_0xf9cf69){return db[_0x502b('0x4b')]['find']({'where':{'id':_0x5db8cd[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x4e961d,null))[_0x502b('0x3c')](function(_0x2ff71e){if(_0x2ff71e){return _0x2ff71e['removeDispositions'](_0x5db8cd['query'][_0x502b('0x6e')]);}})[_0x502b('0x3c')](respondWithStatusCode(_0x4e961d,null))[_0x502b('0x2f')](handleError(_0x4e961d,null));};exports[_0x502b('0x6f')]=function(_0x363504,_0x1e25d7,_0x3ed9c4){if(_0x363504[_0x502b('0x65')]['id']){delete _0x363504['body']['id'];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x363504[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x1e25d7,null))[_0x502b('0x3c')](function(_0x479166){if(_0x479166){_0x363504['body'][_0x502b('0x6a')]=_0x479166['id'];return db[_0x502b('0x70')][_0x502b('0x71')](_0x363504[_0x502b('0x65')]);}})['then'](respondWithResult(_0x1e25d7,null))[_0x502b('0x2f')](handleError(_0x1e25d7,null));};exports['getAnswers']=function(_0x25bf81,_0x5b5a05,_0x2e9ef5){var _0xd92360={'raw':![],'where':{}};var _0x2714ac={};var _0x3b667c={'count':0x0,'rows':[]};return db[_0x502b('0x4b')][_0x502b('0x72')]({'where':{'id':_0x25bf81[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x5b5a05,null))[_0x502b('0x3c')](function(_0x9764de){if(_0x9764de){_0x2714ac['model']=_['keys'](db[_0x502b('0x70')]['rawAttributes']);_0x2714ac[_0x502b('0x51')]=_[_0x502b('0x63')](_0x25bf81[_0x502b('0x51')]);_0x2714ac['filters']=_[_0x502b('0x52')](_0x2714ac[_0x502b('0x50')],_0x2714ac[_0x502b('0x51')]);_0xd92360[_0x502b('0x54')]=_[_0x502b('0x52')](_0x2714ac[_0x502b('0x50')],qs[_0x502b('0x53')](_0x25bf81[_0x502b('0x51')][_0x502b('0x53')]));_0xd92360[_0x502b('0x54')]=_0xd92360[_0x502b('0x54')][_0x502b('0x55')]?_0xd92360[_0x502b('0x54')]:_0x2714ac[_0x502b('0x50')];if(!_0x25bf81[_0x502b('0x51')]['hasOwnProperty'](_0x502b('0x73'))){_0xd92360[_0x502b('0x36')]=qs['limit'](_0x25bf81[_0x502b('0x51')][_0x502b('0x36')]);_0xd92360[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x25bf81[_0x502b('0x51')][_0x502b('0x33')]);}_0xd92360[_0x502b('0x57')]=qs[_0x502b('0x58')](_0x25bf81[_0x502b('0x51')][_0x502b('0x58')]);_0xd92360['where']=qs['filters'](_[_0x502b('0x5b')](_0x25bf81[_0x502b('0x51')],_0x2714ac[_0x502b('0x5a')]));_0xd92360[_0x502b('0x59')][_0x502b('0x6a')]=_0x9764de['id'];if(_0x25bf81[_0x502b('0x51')][_0x502b('0x5c')]){_0xd92360[_0x502b('0x59')]=_['merge'](_0xd92360[_0x502b('0x59')],{'$or':_['map'](_0xd92360['attributes'],function(_0x1deb72){var _0x8f5455={};_0x8f5455[_0x1deb72]={'$like':'%'+_0x25bf81[_0x502b('0x51')]['filter']+'%'};return _0x8f5455;})});}_0xd92360=_[_0x502b('0x5e')]({},_0xd92360,_0x25bf81['options']);return db[_0x502b('0x70')][_0x502b('0x35')]({'where':_0xd92360[_0x502b('0x59')]})[_0x502b('0x3c')](function(_0x2b6aab){_0x3b667c[_0x502b('0x35')]=_0x2b6aab;if(_0x25bf81[_0x502b('0x51')]['includeAll']){_0xd92360['include']=[{'all':!![]}];}return db[_0x502b('0x70')][_0x502b('0x61')](_0xd92360);})[_0x502b('0x3c')](function(_0x5ed6d9){_0x3b667c[_0x502b('0x6d')]=_0x5ed6d9;return _0x3b667c;});}})[_0x502b('0x3c')](respondWithFilteredResult(_0x5b5a05,_0xd92360))[_0x502b('0x2f')](handleError(_0x5b5a05,null));};exports[_0x502b('0x74')]=function(_0x542e71,_0x42d501,_0x57dd24){return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x542e71[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x42d501,null))[_0x502b('0x3c')](function(_0x38621c){if(_0x38621c){return _0x38621c[_0x502b('0x74')](_0x542e71[_0x502b('0x51')][_0x502b('0x6e')]);}})[_0x502b('0x3c')](respondWithStatusCode(_0x42d501,null))[_0x502b('0x2f')](handleError(_0x42d501,null));};exports[_0x502b('0x71')]=function(_0x474316,_0x1477dd){var _0x58dbb4={'name':_0x474316[_0x502b('0x65')]['name'],'key':_0x474316[_0x502b('0x65')][_0x502b('0x4f')],'email':_0x474316[_0x502b('0x65')]['email'],'ListId':_0x474316[_0x502b('0x65')]['ListId'],'active':!_[_0x502b('0x75')](_0x474316[_0x502b('0x65')][_0x502b('0x76')])?_0x474316[_0x502b('0x65')]['active']:!![],'description':_0x474316['body'][_0x502b('0x77')]||null,'Imap':{},'Smtp':{}};if(_[_0x502b('0x75')](_0x474316[_0x502b('0x65')][_0x502b('0x78')])){if(_0x474316[_0x502b('0x65')][_0x502b('0x79')]){_0x58dbb4[_0x502b('0x45')]['user']=_0x58dbb4[_0x502b('0x47')][_0x502b('0x7a')]=_0x474316[_0x502b('0x65')][_0x502b('0x7b')];_0x58dbb4[_0x502b('0x45')]['password']=_0x58dbb4[_0x502b('0x47')]['pass']=_0x474316[_0x502b('0x65')][_0x502b('0x7c')];}else{_0x58dbb4[_0x502b('0x45')][_0x502b('0x7d')]=_0x58dbb4['Smtp'][_0x502b('0x7d')]=![];}_0x58dbb4[_0x502b('0x45')][_0x502b('0x7e')]=_0x474316[_0x502b('0x65')][_0x502b('0x45')][_0x502b('0x7e')];_0x58dbb4[_0x502b('0x45')][_0x502b('0x7f')]=_0x474316[_0x502b('0x65')][_0x502b('0x45')][_0x502b('0x7f')];_0x58dbb4[_0x502b('0x47')]['host']=_0x474316[_0x502b('0x65')][_0x502b('0x47')][_0x502b('0x7e')];_0x58dbb4['Smtp']['port']=_0x474316[_0x502b('0x65')]['Smtp'][_0x502b('0x7f')];}else{_0x58dbb4[_0x502b('0x45')][_0x502b('0x80')]=_0x58dbb4[_0x502b('0x47')][_0x502b('0x80')]=_0x474316[_0x502b('0x65')][_0x502b('0x78')];_0x58dbb4[_0x502b('0x45')][_0x502b('0x7a')]=_0x58dbb4[_0x502b('0x47')][_0x502b('0x7a')]=_0x474316['body']['cuser'];_0x58dbb4[_0x502b('0x45')][_0x502b('0x81')]=_0x58dbb4[_0x502b('0x47')][_0x502b('0x82')]=_0x474316[_0x502b('0x65')]['cpassword'];}return db[_0x502b('0x4b')][_0x502b('0x71')](_0x58dbb4,{'include':[{'model':db['MailServerOut'],'as':_0x502b('0x47')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x502b('0x3c')](function(_0x7b005b){var _0x3d3356=_0x474316[_0x502b('0x7a')][_0x502b('0x3e')]({'plain':!![]});if(!_0x3d3356)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d3356[_0x502b('0x83')]===_0x502b('0x7a')){var _0x1ebe38=_0x7b005b[_0x502b('0x3e')]({'plain':!![]});return db[_0x502b('0x84')][_0x502b('0x66')]({'where':{'name':_0x502b('0x85'),'userProfileId':_0x3d3356[_0x502b('0x86')]},'raw':!![]})[_0x502b('0x3c')](function(_0x312072){if(_0x312072&&_0x312072[_0x502b('0x87')]===0x0){return db[_0x502b('0x3f')][_0x502b('0x71')]({'name':_0x1ebe38['name'],'resourceId':_0x1ebe38['id'],'type':_0x312072[_0x502b('0x41')],'sectionId':_0x312072['id']},{})['then'](function(){return _0x7b005b;});}else{return _0x7b005b;}})[_0x502b('0x2f')](function(_0x297aa3){logger[_0x502b('0x2b')](_0x502b('0x88'),_0x297aa3);throw _0x297aa3;});}return _0x7b005b;})['then'](respondWithResult(_0x1477dd,0xc9))[_0x502b('0x2f')](handleError(_0x1477dd,null));};exports[_0x502b('0x89')]=function(_0x10f320,_0x2ae1e5,_0x573bba){return db['MailAccount'][_0x502b('0x72')]({'where':{'id':_0x10f320[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x2ae1e5,null))[_0x502b('0x3c')](function(_0x41bc2b){if(_0x41bc2b){return _0x41bc2b['getImap']();}return null;})[_0x502b('0x3c')](respondWithResult(_0x2ae1e5,null))['catch'](handleError(_0x2ae1e5,null));};exports[_0x502b('0x8a')]=function(_0x3d63b1,_0x4f32ec,_0x5be160){if(_0x3d63b1[_0x502b('0x65')]['id']){delete _0x3d63b1[_0x502b('0x65')]['id'];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x3d63b1[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x4f32ec,null))[_0x502b('0x3c')](function(_0x5a2219){if(_0x5a2219){_0x3d63b1[_0x502b('0x65')]['MailAccountId']=_0x5a2219['id'];return db[_0x502b('0x44')][_0x502b('0x71')](_0x3d63b1[_0x502b('0x65')]);}})['then'](respondWithResult(_0x4f32ec,null))['catch'](handleError(_0x4f32ec,null));};exports[_0x502b('0x8b')]=function(_0x1d5b53,_0x29b9a8,_0x4cde92){return db[_0x502b('0x4b')][_0x502b('0x72')]({'where':{'id':_0x1d5b53[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x29b9a8,null))[_0x502b('0x3c')](function(_0xa6a895){if(_0xa6a895){return _0xa6a895['setImap'](null);}return null;})[_0x502b('0x3c')](respondWithStatusCode(_0x29b9a8,null))[_0x502b('0x2f')](handleError(_0x29b9a8,null));};exports['getSmtp']=function(_0xda0367,_0x493c91,_0x233f9a){return db[_0x502b('0x4b')][_0x502b('0x72')]({'where':{'id':_0xda0367[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x493c91,null))[_0x502b('0x3c')](function(_0x49cc68){if(_0x49cc68){return _0x49cc68['getSmtp']();}return null;})['then'](respondWithResult(_0x493c91,null))[_0x502b('0x2f')](handleError(_0x493c91,null));};exports[_0x502b('0x8c')]=function(_0x19e619,_0x156aa8,_0x126e20){if(_0x19e619[_0x502b('0x65')]['id']){delete _0x19e619['body']['id'];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x19e619[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x156aa8,null))['then'](function(_0x289389){if(_0x289389){_0x19e619[_0x502b('0x65')][_0x502b('0x6a')]=_0x289389['id'];return db[_0x502b('0x46')][_0x502b('0x71')](_0x19e619[_0x502b('0x65')]);}})['then'](respondWithResult(_0x156aa8,null))[_0x502b('0x2f')](handleError(_0x156aa8,null));};exports[_0x502b('0x8d')]=function(_0x1ac719,_0x1f087a,_0x13124a){return db['MailAccount'][_0x502b('0x72')]({'where':{'id':_0x1ac719['params']['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x1f087a,null))[_0x502b('0x3c')](function(_0xb61b2b){if(_0xb61b2b){return _0xb61b2b['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x1f087a,null))[_0x502b('0x2f')](handleError(_0x1f087a,null));};exports['addInteraction']=function(_0x5ada36,_0x4b5af5,_0x40fbc4){return db[_0x502b('0x8e')][_0x502b('0x66')]({'where':{'id':_0x5ada36[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x4b5af5,null))['then'](function(_0x512966){if(_0x512966){return _0x512966[_0x502b('0x8f')](_0x5ada36[_0x502b('0x65')]['ids'],_['omit'](_0x5ada36[_0x502b('0x65')],[_0x502b('0x6e'),'id'])||{});}})[_0x502b('0x3c')](respondWithResult(_0x4b5af5,null))['catch'](handleError(_0x4b5af5,null));};exports['getInteractions']=function(_0x220986,_0x32b70d,_0x89dd8d){var _0x311903={'raw':![],'where':{}};var _0x261836={};var _0x5a700c={'count':0x0,'rows':[]};return db['MailAccount'][_0x502b('0x72')]({'where':{'id':_0x220986[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x32b70d,null))[_0x502b('0x3c')](function(_0x1e2f24){if(_0x1e2f24){_0x261836[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x8e')]['rawAttributes']);_0x261836['query']=_[_0x502b('0x63')](_0x220986[_0x502b('0x51')]);_0x261836[_0x502b('0x5a')]=_[_0x502b('0x52')](_0x261836[_0x502b('0x50')],_0x261836['query']);_0x311903[_0x502b('0x54')]=_[_0x502b('0x52')](_0x261836[_0x502b('0x50')],qs[_0x502b('0x53')](_0x220986['query']['fields']));_0x311903[_0x502b('0x54')]=_0x311903['attributes']['length']?_0x311903[_0x502b('0x54')]:_0x261836[_0x502b('0x50')];if(!_0x220986[_0x502b('0x51')][_0x502b('0x56')](_0x502b('0x73'))){_0x311903[_0x502b('0x36')]=qs['limit'](_0x220986[_0x502b('0x51')][_0x502b('0x36')]);_0x311903[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x220986[_0x502b('0x51')][_0x502b('0x33')]);}_0x311903[_0x502b('0x57')]=qs[_0x502b('0x58')](_0x220986['query'][_0x502b('0x58')]);_0x311903['where']=qs[_0x502b('0x5a')](_[_0x502b('0x5b')](_0x220986['query'],_0x261836[_0x502b('0x5a')]));_0x311903[_0x502b('0x59')][_0x502b('0x6a')]=_0x1e2f24['id'];if(_0x220986[_0x502b('0x51')][_0x502b('0x5c')]){_0x311903[_0x502b('0x59')]=_['merge'](_0x311903[_0x502b('0x59')],{'$or':_[_0x502b('0x4a')](_0x311903[_0x502b('0x54')],function(_0x5b4c83){var _0x1f7118={};_0x1f7118[_0x5b4c83]={'$like':'%'+_0x220986[_0x502b('0x51')][_0x502b('0x5c')]+'%'};return _0x1f7118;})});}_0x311903=_['merge']({},_0x311903,_0x220986[_0x502b('0x5f')]);return db[_0x502b('0x8e')]['count']({'where':_0x311903[_0x502b('0x59')]})[_0x502b('0x3c')](function(_0x45299e){_0x5a700c['count']=_0x45299e;if(_0x220986[_0x502b('0x51')]['includeAll']){_0x311903[_0x502b('0x60')]=[{'model':db[_0x502b('0x90')],'as':_0x502b('0x91'),'required':![]},{'model':db[_0x502b('0x92')],'as':_0x502b('0x93'),'attributes':[_0x502b('0x41'),'fullname',_0x502b('0x94')],'required':![]},{'model':db[_0x502b('0x95')],'as':_0x502b('0x96'),'attributes':['id',_0x502b('0x41'),_0x502b('0x97')],'where':_0x220986[_0x502b('0x51')][_0x502b('0x98')]?{'id':_0x220986[_0x502b('0x51')][_0x502b('0x98')]}:undefined,'required':_0x220986[_0x502b('0x51')][_0x502b('0x98')]?!![]:![]}];}return db['MailInteraction'][_0x502b('0x61')](_0x311903);})['then'](function(_0x285cef){_0x5a700c[_0x502b('0x6d')]=_0x285cef;return _0x5a700c;});}})[_0x502b('0x3c')](respondWithFilteredResult(_0x32b70d,_0x311903))[_0x502b('0x2f')](handleError(_0x32b70d,null));};exports['addApplications']=function(_0xd252c2,_0x15b7cf,_0x5eb6d5){return db[_0x502b('0x4b')][_0x502b('0x72')]({'where':{'id':_0xd252c2[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x15b7cf,null))[_0x502b('0x3c')](function(_0x24e45d){if(_0x24e45d){return db['sequelize']['transaction'](function(_0x584c06){return db[_0x502b('0x99')][_0x502b('0x3d')]({'where':{'MailAccountId':_0xd252c2[_0x502b('0x67')]['id']},'transaction':_0x584c06})[_0x502b('0x3c')](function(_0x4fef05){var _0x2a05d2=_['map'](_0xd252c2['body'],function(_0x1aa79a){_0x1aa79a['MailAccountId']=_0xd252c2['params']['id'];return _0x1aa79a;});return db[_0x502b('0x99')]['bulkCreate'](_0x2a05d2,{'transaction':_0x584c06});});})['then'](function(){return db['MailApplication'][_0x502b('0x9a')]({'where':{'MailAccountId':_0xd252c2[_0x502b('0x67')]['id']},'order':_0x502b('0x9b')});});}})[_0x502b('0x3c')](respondWithResult(_0x15b7cf,null))[_0x502b('0x2f')](handleError(_0x15b7cf,null));};exports[_0x502b('0x9c')]=function(_0x38b09b,_0x307945,_0x17d666){var _0x4717c1={};var _0x2ba2ca={};var _0x344868;var _0x1f8594;return db[_0x502b('0x4b')][_0x502b('0x72')]({'where':{'id':_0x38b09b[_0x502b('0x67')]['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x307945,null))[_0x502b('0x3c')](function(_0x33e25e){if(_0x33e25e){_0x344868=_0x33e25e;_0x2ba2ca[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x99')][_0x502b('0x4c')]);_0x2ba2ca[_0x502b('0x51')]=_[_0x502b('0x63')](_0x38b09b['query']);_0x2ba2ca[_0x502b('0x5a')]=_['intersection'](_0x2ba2ca[_0x502b('0x50')],_0x2ba2ca[_0x502b('0x51')]);_0x4717c1[_0x502b('0x54')]=_['intersection'](_0x2ba2ca['model'],qs['fields'](_0x38b09b['query'][_0x502b('0x53')]));_0x4717c1[_0x502b('0x54')]=_0x4717c1[_0x502b('0x54')][_0x502b('0x55')]?_0x4717c1[_0x502b('0x54')]:_0x2ba2ca[_0x502b('0x50')];_0x4717c1['order']=qs['sort'](_0x38b09b[_0x502b('0x51')][_0x502b('0x58')]);_0x4717c1[_0x502b('0x59')]=qs[_0x502b('0x5a')](_[_0x502b('0x5b')](_0x38b09b[_0x502b('0x51')],_0x2ba2ca['filters']));if(_0x38b09b[_0x502b('0x51')][_0x502b('0x5c')]){_0x4717c1[_0x502b('0x59')]=_[_0x502b('0x5e')](_0x4717c1[_0x502b('0x59')],{'$or':_[_0x502b('0x4a')](_0x4717c1['attributes'],function(_0x5cd5f1){var _0xb06090={};_0xb06090[_0x5cd5f1]={'$like':'%'+_0x38b09b[_0x502b('0x51')][_0x502b('0x5c')]+'%'};return _0xb06090;})});}_0x4717c1=_[_0x502b('0x5e')]({},_0x4717c1,_0x38b09b['options']);return _0x344868[_0x502b('0x9c')](_0x4717c1);}})[_0x502b('0x3c')](function(_0x3664bd){if(_0x3664bd){_0x1f8594=_0x3664bd[_0x502b('0x55')];if(!_0x38b09b[_0x502b('0x51')][_0x502b('0x56')](_0x502b('0x73'))){_0x4717c1[_0x502b('0x36')]=qs[_0x502b('0x36')](_0x38b09b[_0x502b('0x51')][_0x502b('0x36')]);_0x4717c1[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x38b09b['query']['offset']);}return _0x344868['getApplications'](_0x4717c1);}})[_0x502b('0x3c')](function(_0x53fec9){if(_0x53fec9){return _0x53fec9?{'count':_0x1f8594,'rows':_0x53fec9}:null;}})[_0x502b('0x3c')](respondWithResult(_0x307945,null))[_0x502b('0x2f')](handleError(_0x307945,null));};exports[_0x502b('0x9d')]=function(_0x39d15c,_0x2c60a1,_0x1d1926){var _0x203800={'raw':!![],'where':{}};var _0xa7fdc6={};var _0x340ce4={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x39d15c[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x2c60a1,null))[_0x502b('0x3c')](function(_0x238583){if(_0x238583){_0xa7fdc6[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x9e')][_0x502b('0x4c')]);_0xa7fdc6[_0x502b('0x51')]=_[_0x502b('0x63')](_0x39d15c[_0x502b('0x51')]);_0xa7fdc6[_0x502b('0x5a')]=_['intersection'](_0xa7fdc6['model'],_0xa7fdc6[_0x502b('0x51')]);_0x203800[_0x502b('0x54')]=_[_0x502b('0x52')](_0xa7fdc6['model'],qs[_0x502b('0x53')](_0x39d15c['query'][_0x502b('0x53')]));_0x203800[_0x502b('0x54')]=_0x203800['attributes'][_0x502b('0x55')]?_0x203800['attributes']:_0xa7fdc6[_0x502b('0x50')];if(!_0x39d15c['query'][_0x502b('0x56')](_0x502b('0x73'))){_0x203800[_0x502b('0x36')]=qs[_0x502b('0x36')](_0x39d15c[_0x502b('0x51')][_0x502b('0x36')]);_0x203800[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x39d15c[_0x502b('0x51')][_0x502b('0x33')]);}_0x203800[_0x502b('0x57')]=qs[_0x502b('0x58')](_0x39d15c[_0x502b('0x51')][_0x502b('0x58')]);_0x203800['where']=qs['filters'](_[_0x502b('0x5b')](_0x39d15c[_0x502b('0x51')],_0xa7fdc6['filters']));_0x203800[_0x502b('0x59')][_0x502b('0x6a')]=_0x238583['id'];if(_0x39d15c[_0x502b('0x51')][_0x502b('0x5c')]){_0x203800['where']=_[_0x502b('0x5e')](_0x203800[_0x502b('0x59')],{'$or':_['map'](_0x203800['attributes'],function(_0xe77ac7){var _0x16f0b4={};_0x16f0b4[_0xe77ac7]={'$like':'%'+_0x39d15c['query'][_0x502b('0x5c')]+'%'};return _0x16f0b4;})});}if(_0x39d15c[_0x502b('0x51')]['$gte']){var _0x61466f=_0x39d15c[_0x502b('0x51')][_0x502b('0x9f')][_0x502b('0xa0')](',');var _0x39e7c8={};_0x39e7c8[_0x61466f[0x0]]={'$gte':moment(_0x61466f[0x1])[_0x502b('0xa1')](_0x502b('0xa2'))};_0x203800['where']=_[_0x502b('0x5e')](_0x203800[_0x502b('0x59')],_0x39e7c8);}_0x203800=_[_0x502b('0x5e')]({},_0x203800,_0x39d15c['options']);return db[_0x502b('0x9e')][_0x502b('0x35')]({'where':_0x203800[_0x502b('0x59')]})[_0x502b('0x3c')](function(_0x2900e1){_0x340ce4[_0x502b('0x35')]=_0x2900e1;if(_0x39d15c[_0x502b('0x51')]['includeAll']){_0x203800['include']=[{'all':!![]}];}return db[_0x502b('0x9e')][_0x502b('0x61')](_0x203800);})[_0x502b('0x3c')](function(_0x587c94){if(_0x39d15c['query'][_0x502b('0xa3')]===_0x502b('0xa4')){for(var _0x2e2158=0x0;_0x2e2158<_0x587c94[_0x502b('0x55')];_0x2e2158++){_0x587c94[_0x2e2158]['body']=juice(_0x587c94[_0x2e2158][_0x502b('0x65')]);}}_0x340ce4[_0x502b('0x6d')]=_0x587c94;return _0x340ce4;});}})[_0x502b('0x3c')](respondWithFilteredResult(_0x2c60a1,_0x203800))[_0x502b('0x2f')](handleError(_0x2c60a1,null));};exports[_0x502b('0x42')]=function(_0x120ef6,_0x47bc91,_0x2aa31c){var _0x2b0eda,_0x3eba94={},_0x399a19;if(_0x120ef6[_0x502b('0x65')]['to']){_0x399a19=_0x120ef6['body']['to'][_0x502b('0xa0')](',')[0x0];}return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x120ef6[_0x502b('0x67')]['id']},'include':[{'model':db[_0x502b('0xa5')],'as':_0x502b('0xa6'),'include':[{'model':db[_0x502b('0x90')],'as':'Contacts','where':{'email':_0x399a19},'limit':0x1,'order':[[_0x502b('0xa7'),'DESC']]}]},{'model':db[_0x502b('0x46')],'as':_0x502b('0x47'),'raw':!![]}]})['then'](handleEntityNotFound(_0x47bc91,null))[_0x502b('0x3c')](function(_0xe0054e){if(_0xe0054e){_0x2b0eda=_0xe0054e;if(_0xe0054e['Smtp']){if(_[_0x502b('0x75')](_0x120ef6[_0x502b('0x65')][_0x502b('0xa8')])){_0x120ef6[_0x502b('0x65')][_0x502b('0xa8')]=util[_0x502b('0xa1')](_0x502b('0xa9'),_0xe0054e[_0x502b('0x41')],_0xe0054e[_0x502b('0xaa')]||_0xe0054e[_0x502b('0x47')][_0x502b('0x7a')]);}if(_0x120ef6[_0x502b('0x65')][_0x502b('0xab')]&&_0x120ef6[_0x502b('0x65')]['attachments']['length']){for(var _0x5363b2=0x0;_0x5363b2<_0x120ef6[_0x502b('0x65')][_0x502b('0xab')][_0x502b('0x55')];_0x5363b2+=0x1){_0x120ef6[_0x502b('0x65')][_0x502b('0xab')][_0x5363b2]={'filename':_0x120ef6[_0x502b('0x65')][_0x502b('0xab')][_0x5363b2][_0x502b('0x41')],'path':path[_0x502b('0xac')](config[_0x502b('0xad')],_0x502b('0xae'),_0x120ef6[_0x502b('0x65')][_0x502b('0xab')][_0x5363b2][_0x502b('0xaf')])};}}var _0x3c86fc={'tls':{'rejectUnauthorized':![]}};if(_[_0x502b('0x75')](_0xe0054e['Smtp'][_0x502b('0x80')])){if(_0xe0054e[_0x502b('0x47')]['authentication']){_0x3c86fc[_0x502b('0xb0')]={'user':_0xe0054e[_0x502b('0x47')][_0x502b('0x7a')],'pass':_0xe0054e[_0x502b('0x47')][_0x502b('0x82')]};}_0x3c86fc['host']=_0xe0054e[_0x502b('0x47')][_0x502b('0x7e')];_0x3c86fc[_0x502b('0x7f')]=_0xe0054e['Smtp'][_0x502b('0x7f')];_0x3c86fc[_0x502b('0xb1')]=_0xe0054e[_0x502b('0x47')][_0x502b('0xb1')];}else{_0x3c86fc[_0x502b('0x80')]=_0xe0054e[_0x502b('0x47')][_0x502b('0x80')];_0x3c86fc['auth']={'user':_0xe0054e[_0x502b('0x47')][_0x502b('0x7a')],'pass':_0xe0054e[_0x502b('0x47')]['pass']};}return respondWithRpcPromise(_0x502b('0xb2'),_0x502b('0xb3'),{'account':_0x3c86fc,'message':_0x120ef6['body']});}else{throw new Error(_0x502b('0xb4'));}}})[_0x502b('0x3c')](function(_0x5e989a){if(_0x5e989a){_0x3eba94=_0x5e989a;if(_0x2b0eda[_0x502b('0xa6')]){if(_0x2b0eda['List']['Contacts'][_0x502b('0x55')]){return _0x2b0eda[_0x502b('0xa6')][_0x502b('0xb5')][0x0];}else{return db[_0x502b('0x90')]['create'](_['defaults'](_0x120ef6[_0x502b('0x65')],{'firstName':_0x120ef6[_0x502b('0x65')]['to'],'email':_0x120ef6['body']['to'],'phone':_0x120ef6['body']['to'],'ListId':_0x2b0eda[_0x502b('0xb6')]}));}}else{throw new Error(_0x502b('0xb4'));}}})[_0x502b('0x3c')](function(_0x5359c4){if(_0x5359c4){var _0x587804={'UserId':_0x120ef6[_0x502b('0x7a')]['id'],'ContactId':_0x5359c4['id'],'MailAccountId':_0x2b0eda['id'],'inReplyTo':_0x3eba94[_0x502b('0xb7')],'to':_0x120ef6[_0x502b('0x65')][_0x502b('0xa8')],'cc':_0x120ef6['body']['cc'],'subject':_0x120ef6['body']['subject'],'attach':_0x120ef6[_0x502b('0x65')][_0x502b('0xb8')],'firstMsgDirection':_0x502b('0xb9'),'lastMsgAt':moment()['format'](_0x502b('0xa2')),'lastMsgDirection':_0x502b('0xb9'),'Messages':[_['merge'](_0x120ef6[_0x502b('0x65')],{'messageId':_0x3eba94[_0x502b('0xb7')],'sentAt':moment()[_0x502b('0xa1')](_0x502b('0xa2')),'read':!![],'MailAccountId':_0x2b0eda['id'],'UserId':_0x120ef6[_0x502b('0x7a')]['id'],'ContactId':_0x5359c4['id']})]};if(_0x120ef6[_0x502b('0x65')][_0x502b('0xba')]){_0x587804=_['merge'](_0x587804,_0x120ef6[_0x502b('0x65')][_0x502b('0xba')]);}return db[_0x502b('0x8e')]['create'](_0x587804,{'include':[{'model':db['MailMessage'],'as':_0x502b('0xbb')}]});}})['then'](respondWithResult(_0x47bc91,null))[_0x502b('0x2f')](handleError(_0x47bc91,null));};exports['verifySmtp']=function(_0x1770d0,_0x195d98,_0x54e7dc){return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x1770d0[_0x502b('0x67')]['id']},'include':[{'model':db[_0x502b('0x46')],'as':_0x502b('0x47'),'raw':!![]}]})[_0x502b('0x3c')](handleEntityNotFound(_0x195d98,null))[_0x502b('0x3c')](function(_0x4197e9){if(_0x4197e9&&_0x4197e9[_0x502b('0x47')]){var _0x333698={'id':_0x4197e9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4197e9[_0x502b('0x47')][_0x502b('0x80')]){_0x333698[_0x502b('0x80')]=_0x4197e9[_0x502b('0x47')][_0x502b('0x80')];}else{_0x333698[_0x502b('0x7e')]=_0x4197e9['Smtp'][_0x502b('0x7e')];_0x333698[_0x502b('0x7f')]=_0x4197e9[_0x502b('0x47')][_0x502b('0x7f')];_0x333698['secure']=_0x4197e9['Smtp'][_0x502b('0xb1')];}if(_0x4197e9['Smtp'][_0x502b('0x7d')]){_0x333698['auth']={'user':_0x4197e9[_0x502b('0x47')][_0x502b('0x7a')],'pass':_0x4197e9[_0x502b('0x47')][_0x502b('0x82')]};}return respondWithRpcPromise(_0x502b('0xbc'),'verifySmtp',{'account':_0x333698});}})[_0x502b('0x3c')](respondWithResult(_0x195d98,null))['catch'](handleError(_0x195d98,null));};exports['destroy']=function(_0x2d8307,_0x8d05ff){return db['MailAccount']['find']({'where':{'id':_0x2d8307['params']['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x8d05ff,null))[_0x502b('0x3c')](function(_0x5ca297){if(_0x5ca297&&_0x5ca297[_0x502b('0x80')]){throw new db['Sequelize']['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x5ca297;})[_0x502b('0x3c')](removeEntity(_0x8d05ff,null))['catch'](handleError(_0x8d05ff,null));};exports[_0x502b('0xbd')]=function(_0x176b2a,_0x98aa54,_0x4212ee){return db[_0x502b('0x4b')][_0x502b('0x66')]({'where':{'id':_0x176b2a[_0x502b('0x67')]['id']}})['then'](handleEntityNotFound(_0x98aa54,null))['then'](function(_0x98c49f){if(_0x98c49f){return _0x98c49f[_0x502b('0xbd')](_0x176b2a[_0x502b('0x65')][_0x502b('0x6e')],_['omit'](_0x176b2a[_0x502b('0x65')],[_0x502b('0x6e'),'id'])||{})[_0x502b('0xbe')](function(_0x2aee6f){for(var _0x28da70=0x0;_0x28da70<_0x176b2a[_0x502b('0x65')][_0x502b('0x6e')][_0x502b('0x55')];_0x28da70+=0x1){socket['emit'](_0x502b('0xbf'),{'UserId':Number(_0x176b2a[_0x502b('0x65')][_0x502b('0x6e')][_0x28da70]),'MailAccountId':Number(_0x176b2a[_0x502b('0x67')]['id'])});}return _0x2aee6f;});}})[_0x502b('0x3c')](respondWithResult(_0x98aa54,null))[_0x502b('0x2f')](handleError(_0x98aa54,null));};exports['removeAgents']=function(_0x3cc884,_0x161cf2,_0x22d9c4){return db['MailAccount'][_0x502b('0x66')]({'where':{'id':_0x3cc884['params']['id']}})[_0x502b('0x3c')](handleEntityNotFound(_0x161cf2,null))[_0x502b('0x3c')](function(_0x5caa57){if(_0x5caa57){return _0x5caa57[_0x502b('0xc0')](_0x3cc884['query'][_0x502b('0x6e')])[_0x502b('0x3c')](function(){if(_[_0x502b('0xc1')](_0x3cc884[_0x502b('0x51')]['ids'])){for(var _0x4b3b21=0x0;_0x4b3b21<_0x3cc884[_0x502b('0x51')][_0x502b('0x6e')][_0x502b('0x55')];_0x4b3b21+=0x1){socket[_0x502b('0xc2')](_0x502b('0xc3'),{'UserId':Number(_0x3cc884['query'][_0x502b('0x6e')][_0x4b3b21]),'MailAccountId':Number(_0x3cc884[_0x502b('0x67')]['id'])});}}else{socket[_0x502b('0xc2')](_0x502b('0xc3'),{'UserId':Number(_0x3cc884[_0x502b('0x51')][_0x502b('0x6e')]),'MailAccountId':Number(_0x3cc884[_0x502b('0x67')]['id'])});}});}})[_0x502b('0x3c')](respondWithStatusCode(_0x161cf2,null))['catch'](handleError(_0x161cf2,null));};exports[_0x502b('0xc4')]=function(_0x15fb28,_0x5ecb6f,_0x1dcf24){var _0x170c1d={};var _0x40755f={};var _0x270fbd;var _0x1675bc;return db['MailAccount'][_0x502b('0x72')]({'where':{'id':_0x15fb28['params']['id']}})['then'](handleEntityNotFound(_0x5ecb6f,null))[_0x502b('0x3c')](function(_0x48f5ee){if(_0x48f5ee){_0x270fbd=_0x48f5ee;_0x40755f[_0x502b('0x50')]=_[_0x502b('0x63')](db[_0x502b('0x92')][_0x502b('0x4c')]);_0x40755f['query']=_['keys'](_0x15fb28['query']);_0x40755f[_0x502b('0x5a')]=_[_0x502b('0x52')](_0x40755f[_0x502b('0x50')],_0x40755f[_0x502b('0x51')]);_0x170c1d[_0x502b('0x54')]=_[_0x502b('0x52')](_0x40755f['model'],qs['fields'](_0x15fb28[_0x502b('0x51')][_0x502b('0x53')]));_0x170c1d['attributes']=_0x170c1d['attributes'][_0x502b('0x55')]?_0x170c1d[_0x502b('0x54')]:_0x40755f['model'];_0x170c1d['order']=qs[_0x502b('0x58')](_0x15fb28['query']['sort']);_0x170c1d[_0x502b('0x59')]=qs[_0x502b('0x5a')](_[_0x502b('0x5b')](_0x15fb28['query'],_0x40755f[_0x502b('0x5a')]));if(_0x15fb28['query'][_0x502b('0x5c')]){_0x170c1d['where']=_[_0x502b('0x5e')](_0x170c1d[_0x502b('0x59')],{'$or':_[_0x502b('0x4a')](_0x170c1d[_0x502b('0x54')],function(_0xf5243a){var _0xe33319={};_0xe33319[_0xf5243a]={'$like':'%'+_0x15fb28[_0x502b('0x51')][_0x502b('0x5c')]+'%'};return _0xe33319;})});}_0x170c1d=_['merge']({},_0x170c1d,_0x15fb28[_0x502b('0x5f')]);return _0x270fbd[_0x502b('0xc4')](_0x170c1d);}})['then'](function(_0x665fe4){if(_0x665fe4){_0x1675bc=_0x665fe4[_0x502b('0x55')];if(!_0x15fb28['query'][_0x502b('0x56')](_0x502b('0x73'))){_0x170c1d[_0x502b('0x36')]=qs[_0x502b('0x36')](_0x15fb28[_0x502b('0x51')][_0x502b('0x36')]);_0x170c1d[_0x502b('0x33')]=qs[_0x502b('0x33')](_0x15fb28[_0x502b('0x51')][_0x502b('0x33')]);}return _0x270fbd[_0x502b('0xc4')](_0x170c1d);}})[_0x502b('0x3c')](function(_0xeee49d){if(_0xeee49d){return _0xeee49d?{'count':_0x1675bc,'rows':_0xeee49d}:null;}})['then'](respondWithResult(_0x5ecb6f,null))[_0x502b('0x2f')](handleError(_0x5ecb6f,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index a6061d9..b79cf3d 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 _0xa647=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x387a0c,_0x9fb0a2){var _0xce7213=function(_0x4ada5a){while(--_0x4ada5a){_0x387a0c['push'](_0x387a0c['shift']());}};_0xce7213(++_0x9fb0a2);}(_0xa647,0x81));var _0x7a64=function(_0x49ed38,_0x4fcd2a){_0x49ed38=_0x49ed38-0x0;var _0x1f76cb=_0xa647[_0x49ed38];return _0x1f76cb;};'use strict';var EventEmitter=require(_0x7a64('0x0'));var MailAccount=require(_0x7a64('0x1'))['db'][_0x7a64('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7a64('0x3')](0x0);var events={'afterCreate':_0x7a64('0x4'),'afterUpdate':_0x7a64('0x5'),'afterDestroy':_0x7a64('0x6')};function emitEvent(_0x30b8b7){return function(_0x1c7a04,_0x2e1029,_0x46b8b0){MailAccountEvents[_0x7a64('0x7')](_0x30b8b7+':'+_0x1c7a04['id'],_0x1c7a04);MailAccountEvents['emit'](_0x30b8b7,_0x1c7a04);_0x46b8b0(null);};}for(var e in events){if(events[_0x7a64('0x8')](e)){var event=events[e];MailAccount[_0x7a64('0x9')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x6b4c=['events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x29a862,_0x23b978){var _0x298be9=function(_0x23d07c){while(--_0x23d07c){_0x29a862['push'](_0x29a862['shift']());}};_0x298be9(++_0x23b978);}(_0x6b4c,0x8c));var _0xc6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc6b4('0x0'));var MailAccount=require(_0xc6b4('0x1'))['db'][_0xc6b4('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc6b4('0x3')](0x0);var events={'afterCreate':_0xc6b4('0x4'),'afterUpdate':_0xc6b4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4875fc){return function(_0x3a89a0,_0x211954,_0x3c631f){MailAccountEvents['emit'](_0x4875fc+':'+_0x3a89a0['id'],_0x3a89a0);MailAccountEvents[_0xc6b4('0x6')](_0x4875fc,_0x3a89a0);_0x3c631f(null);};}for(var e in events){if(events[_0xc6b4('0x7')](e)){var event=events[e];MailAccount[_0xc6b4('0x8')](e,emitEvent(event));}}module[_0xc6b4('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f1d4c38..d4290ff 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 _0x2036=['mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2036,0x173));var _0x6203=function(_0x4c4eb2,_0x51ef8e){_0x4c4eb2=_0x4c4eb2-0x0;var _0x34838d=_0x2036[_0x4c4eb2];return _0x34838d;};'use strict';var _=require(_0x6203('0x0'));var util=require('util');var logger=require(_0x6203('0x1'))(_0x6203('0x2'));var moment=require(_0x6203('0x3'));var BPromise=require(_0x6203('0x4'));var rp=require(_0x6203('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6203('0x6'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0x6203('0x7')]=function(_0x37e42b,_0x2b10bb){return _0x37e42b[_0x6203('0x8')]('MailAccount',attributes,{'tableName':_0x6203('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb91e=['../../config/environment','./mailAccount.attributes','exports','define','mail_accounts','api','moment','bluebird','request-promise','path'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb91e,0x127));var _0xeb91=function(_0x234a63,_0x5e6f8d){_0x234a63=_0x234a63-0x0;var _0x34b269=_0xb91e[_0x234a63];return _0x34b269;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xeb91('0x0'));var moment=require(_0xeb91('0x1'));var BPromise=require(_0xeb91('0x2'));var rp=require(_0xeb91('0x3'));var fs=require('fs');var path=require(_0xeb91('0x4'));var rimraf=require('rimraf');var config=require(_0xeb91('0x5'));var attributes=require(_0xeb91('0x6'));module[_0xeb91('0x7')]=function(_0x4851a1,_0x48a1e9){return _0x4851a1[_0xeb91('0x8')]('MailAccount',attributes,{'tableName':_0xeb91('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 2880263..e7861f5 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 _0xd9de=['MailServerOut','Smtp','get','account','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','messageId','subject','attach','format','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','created','contact','attachments','originCc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','name','unshift','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','then','find','info','ShowMailAccount','NotifyMailAccount','body','difference','CmContact','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','updatedAt','DESC','MailApplication','Applications'];(function(_0x484797,_0x5147ba){var _0x426bd7=function(_0x49c79e){while(--_0x49c79e){_0x484797['push'](_0x484797['shift']());}};_0x426bd7(++_0x5147ba);}(_0xd9de,0x90));var _0xed9d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd9de[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xed9d('0x0'));var util=require(_0xed9d('0x1'));var moment=require(_0xed9d('0x2'));var BPromise=require(_0xed9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed9d('0x4'));var db=require(_0xed9d('0x5'))['db'];var utils=require(_0xed9d('0x6'));var logger=require(_0xed9d('0x7'))(_0xed9d('0x8'));var config=require(_0xed9d('0x9'));var jayson=require(_0xed9d('0xa'));var client=jayson[_0xed9d('0xb')][_0xed9d('0xc')]({'port':0x232c});config[_0xed9d('0xd')]=_[_0xed9d('0xe')](config[_0xed9d('0xd')],{'host':_0xed9d('0xf'),'port':0x18eb});var socket=require(_0xed9d('0x10'))(new Redis(config[_0xed9d('0xd')]));require(_0xed9d('0x11'))['register'](socket);function respondWithRpcPromise(_0x27a506,_0x2491f7,_0x51ccd2){return new BPromise(function(_0x109e0a,_0x4da104){return client[_0xed9d('0x12')](_0x27a506,_0x51ccd2)['then'](function(_0x3945a8){logger['info'](_0xed9d('0x13'),_0x2491f7,'request\x20sent');logger[_0xed9d('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2491f7,_0xed9d('0x15'),JSON[_0xed9d('0x16')](_0x3945a8));if(_0x3945a8[_0xed9d('0x17')]){if(_0x3945a8[_0xed9d('0x17')][_0xed9d('0x18')]===0x1f4){logger[_0xed9d('0x17')]('MailAccount,\x20%s,\x20%s',_0x2491f7,_0x3945a8[_0xed9d('0x17')]['message']);return _0x4da104(_0x3945a8[_0xed9d('0x17')][_0xed9d('0x19')]);}logger[_0xed9d('0x17')](_0xed9d('0x13'),_0x2491f7,_0x3945a8[_0xed9d('0x17')][_0xed9d('0x19')]);return _0x109e0a(_0x3945a8[_0xed9d('0x17')][_0xed9d('0x19')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x2491f7,_0xed9d('0x15'));_0x109e0a(_0x3945a8[_0xed9d('0x1a')][_0xed9d('0x19')]);}})[_0xed9d('0x1b')](function(_0x2c45bf){logger[_0xed9d('0x17')](_0xed9d('0x13'),_0x2491f7,_0x2c45bf);_0x4da104(_0x2c45bf);});});}exports[_0xed9d('0x1c')]=function(_0x5d3177){var _0x162b0e=this;return new Promise(function(_0x28d840,_0x21d0a5){return db[_0xed9d('0x1d')][_0xed9d('0x1e')]({'raw':_0x5d3177['options']?_0x5d3177[_0xed9d('0x1f')][_0xed9d('0x20')]===undefined?!![]:![]:!![],'where':_0x5d3177[_0xed9d('0x1f')]?_0x5d3177[_0xed9d('0x1f')][_0xed9d('0x21')]||null:null,'attributes':_0x5d3177['options']?_0x5d3177[_0xed9d('0x1f')][_0xed9d('0x22')]||null:null,'limit':_0x5d3177[_0xed9d('0x1f')]?_0x5d3177['options']['limit']||null:null,'include':_0x5d3177[_0xed9d('0x1f')]?_0x5d3177['options'][_0xed9d('0x23')]?_[_0xed9d('0x24')](_0x5d3177[_0xed9d('0x1f')]['include'],function(_0x23a7ec){return{'model':db[_0x23a7ec[_0xed9d('0x25')]],'as':_0x23a7ec['as'],'attributes':_0x23a7ec[_0xed9d('0x22')],'include':_0x23a7ec[_0xed9d('0x23')]?_[_0xed9d('0x24')](_0x23a7ec['include'],function(_0x53d013){return{'model':db[_0x53d013[_0xed9d('0x25')]],'as':_0x53d013['as'],'attributes':_0x53d013['attributes'],'include':_0x53d013[_0xed9d('0x23')]?_[_0xed9d('0x24')](_0x53d013['include'],function(_0x5a85e9){return{'model':db[_0x5a85e9[_0xed9d('0x25')]],'as':_0x5a85e9['as'],'attributes':_0x5a85e9['attributes']};}):[]};}):[]};}):[]:[]})[_0xed9d('0x26')](function(_0x556dcb){logger['info'](_0xed9d('0x1c'),_0x5d3177);logger[_0xed9d('0x14')]('GetMailAccount',_0x5d3177,JSON['stringify'](_0x556dcb));_0x28d840(_0x556dcb);})['catch'](function(_0x3a8f9c){logger[_0xed9d('0x17')](_0xed9d('0x1c'),_0x3a8f9c[_0xed9d('0x19')],_0x5d3177);_0x21d0a5(_0x162b0e['error'](0x1f4,_0x3a8f9c[_0xed9d('0x19')]));});});};exports['ShowMailAccount']=function(_0x52b2d5){var _0x4cc49a=this;return new Promise(function(_0x3336cd,_0x26a88f){return db[_0xed9d('0x1d')][_0xed9d('0x27')]({'raw':_0x52b2d5['options']?_0x52b2d5[_0xed9d('0x1f')][_0xed9d('0x20')]===undefined?!![]:![]:!![],'where':_0x52b2d5[_0xed9d('0x1f')]?_0x52b2d5['options'][_0xed9d('0x21')]||null:null,'attributes':_0x52b2d5[_0xed9d('0x1f')]?_0x52b2d5[_0xed9d('0x1f')][_0xed9d('0x22')]||null:null,'include':_0x52b2d5['options']?_0x52b2d5['options'][_0xed9d('0x23')]?_[_0xed9d('0x24')](_0x52b2d5[_0xed9d('0x1f')]['include'],function(_0x20ad01){return{'model':db[_0x20ad01['model']],'as':_0x20ad01['as'],'attributes':_0x20ad01['attributes'],'include':_0x20ad01[_0xed9d('0x23')]?_['map'](_0x20ad01[_0xed9d('0x23')],function(_0x4788bc){return{'model':db[_0x4788bc['model']],'as':_0x4788bc['as'],'attributes':_0x4788bc[_0xed9d('0x22')],'include':_0x4788bc[_0xed9d('0x23')]?_['map'](_0x4788bc['include'],function(_0x1e1992){return{'model':db[_0x1e1992[_0xed9d('0x25')]],'as':_0x1e1992['as'],'attributes':_0x1e1992[_0xed9d('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x353167){logger[_0xed9d('0x28')](_0xed9d('0x29'),_0x52b2d5);logger['debug'](_0xed9d('0x29'),_0x52b2d5,JSON[_0xed9d('0x16')](_0x353167));_0x3336cd(_0x353167);})[_0xed9d('0x1b')](function(_0x184ae2){logger[_0xed9d('0x17')](_0xed9d('0x29'),_0x184ae2[_0xed9d('0x19')],_0x52b2d5);_0x26a88f(_0x4cc49a[_0xed9d('0x17')](0x1f4,_0x184ae2[_0xed9d('0x19')]));});});};exports[_0xed9d('0x2a')]=function(_0x432cca){var _0x1e36f5=this;return new Promise(function(_0x332335,_0x39234b){var _0x544e87={'body':_0x432cca[_0xed9d('0x2b')],'channel':'mail'};var _0x2f6d08=_[_0xed9d('0x2c')](_['keys'](db[_0xed9d('0x2d')]['rawAttributes']),['createdAt','updatedAt',_0xed9d('0x2e'),_0xed9d('0x2f')]);var _0x55dad5=![];if(_0x432cca['body']['id']){delete _0x432cca[_0xed9d('0x2b')]['id'];}if(_[_0xed9d('0x30')](_0x432cca[_0xed9d('0x2b')][_0xed9d('0x31')])){return _0x39234b(_0x1e36f5[_0xed9d('0x17')](0x1f4,_0xed9d('0x32')));}if(_['isNil'](_0x432cca[_0xed9d('0x2b')]['body'])||_0x432cca[_0xed9d('0x2b')][_0xed9d('0x2b')]===''){return _0x39234b(_0x1e36f5[_0xed9d('0x17')](0x1f4,_0xed9d('0x33')));}if(_['isNil'](_0x432cca['body'][_0xed9d('0x34')])){return _0x39234b(_0x1e36f5['error'](0x1f4,_0xed9d('0x35')+_0x2f6d08));}if(!_[_0xed9d('0x36')](_0x2f6d08,_0x432cca[_0xed9d('0x2b')][_0xed9d('0x34')])){return _0x39234b(_0x1e36f5[_0xed9d('0x17')](0x1f4,_0xed9d('0x37')+_0x2f6d08));}var _0x3f8fd1={};_0x3f8fd1[_0x432cca[_0xed9d('0x2b')][_0xed9d('0x34')]]=_0x432cca[_0xed9d('0x2b')]['from'];return db[_0xed9d('0x1d')][_0xed9d('0x27')]({'where':{'id':_0x432cca['account']['id']},'include':[{'model':db['CmList'],'as':_0xed9d('0x38'),'include':[{'model':db['CmContact'],'as':_0xed9d('0x39'),'where':_0x3f8fd1,'limit':0x1,'order':[[_0xed9d('0x3a'),_0xed9d('0x3b')]]}]},{'model':db[_0xed9d('0x3c')],'as':_0xed9d('0x3d')},{'model':db[_0xed9d('0x3e')],'as':_0xed9d('0x3f')}]})[_0xed9d('0x26')](function(_0x50724f){if(_0x50724f&&_0x50724f[_0xed9d('0x38')]){var _0x2b0e15=_0x50724f[_0xed9d('0x40')]({'plain':!![]});_0x544e87[_0xed9d('0x41')]=_[_0xed9d('0x42')](_0x2b0e15,[_0xed9d('0x3d'),_0xed9d('0x38')]);_0x544e87[_0xed9d('0x43')]=_0x2b0e15[_0xed9d('0x3d')];_0x544e87[_0xed9d('0x44')]=_0x2b0e15[_0xed9d('0x38')];_0x544e87['applications']=_[_0xed9d('0x45')](_0x544e87[_0xed9d('0x43')],[_0xed9d('0x46')],[_0xed9d('0x47')]);if(_0x544e87[_0xed9d('0x41')]&&_0x544e87[_0xed9d('0x41')][_0xed9d('0x48')]){_0x544e87[_0xed9d('0x43')][_0xed9d('0x49')]({'id':0x0,'priority':_0x544e87[_0xed9d('0x43')][_0xed9d('0x4a')]+0x1,'app':_0xed9d('0x4b'),'appdata':_0xed9d('0x48'),'interval':_0xed9d('0x4c')});}if(_0x544e87[_0xed9d('0x41')][_0xed9d('0x3d')]){delete _0x544e87[_0xed9d('0x41')]['Applications'];}if(_0x544e87[_0xed9d('0x41')][_0xed9d('0x38')]){delete _0x544e87[_0xed9d('0x41')][_0xed9d('0x38')];}if(_0x2b0e15[_0xed9d('0x38')][_0xed9d('0x39')][_0xed9d('0x4a')]){return _0x2b0e15[_0xed9d('0x38')][_0xed9d('0x39')][0x0];}var _0x12b7d0=_['defaults'](_0x432cca[_0xed9d('0x2b')],{'firstName':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x31')],'ListId':_0x2b0e15['ListId']});_0x12b7d0[_0x432cca[_0xed9d('0x2b')][_0xed9d('0x34')]]=_0x432cca[_0xed9d('0x2b')]['from'];return db[_0xed9d('0x2d')][_0xed9d('0x4d')](_0x12b7d0);}else{throw new Error(_0xed9d('0x4e'));}})['then'](function(_0x25394f){_0x544e87['contact']=_0x25394f;if(_0x25394f){if(!_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')][_0xed9d('0x4f')]){_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')][_0xed9d('0x4f')]=rs['generate']()+'\x20'+_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')][_0xed9d('0x31')];}var _0x328e94={'ContactId':_0x25394f['id'],'MailAccountId':_0x432cca[_0xed9d('0x41')]['id'],'inReplyTo':_0x432cca[_0xed9d('0x2b')]['message'][_0xed9d('0x4f')],'to':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')]['from'],'cc':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')]['cc'],'subject':_0x432cca['body'][_0xed9d('0x19')][_0xed9d('0x50')],'attach':_0x432cca['body'][_0xed9d('0x19')][_0xed9d('0x51')],'lastMsgAt':moment()[_0xed9d('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xed9d('0x53')]['find']({'where':{'closed':![],'MailAccountId':_0x432cca[_0xed9d('0x41')]['id']},'include':[{'model':db[_0xed9d('0x54')],'as':'Messages','attributes':[_0xed9d('0x4f')],'where':{'messageId':_0x432cca[_0xed9d('0x2b')]['message'][_0xed9d('0x55')]}}]})[_0xed9d('0x26')](function(_0x271e35){if(_0x271e35){return[_0x271e35,![]];}return db[_0xed9d('0x53')]['create'](_0x328e94)[_0xed9d('0x26')](function(_0x25b7cc){return[_0x25b7cc,!![]];});});}else{throw new Error(_0xed9d('0x56'));}})[_0xed9d('0x57')](function(_0x351adc,_0x29f31f){if(_0x351adc){_0x55dad5=_0x29f31f;if(!_0x29f31f){return _0x351adc['update']({'inReplyTo':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')][_0xed9d('0x4f')],'to':_0x432cca['body'][_0xed9d('0x19')][_0xed9d('0x31')],'cc':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')]['cc'],'subject':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')][_0xed9d('0x50')],'attach':_0x351adc[_0xed9d('0x51')]?_0x351adc[_0xed9d('0x51')]:_0x432cca[_0xed9d('0x2b')]['message'][_0xed9d('0x51')],'substatus':null,'substatusAt':moment()[_0xed9d('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xed9d('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x351adc;}}})[_0xed9d('0x26')](function(_0x2a0902){_0x544e87['interaction']=_0x2a0902[_0xed9d('0x40')]({'plain':!![]});_0x544e87['interaction'][_0xed9d('0x58')]=_0x55dad5;return db[_0xed9d('0x54')][_0xed9d('0x4d')]({'body':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x2b')],'MailAccountId':_0x432cca[_0xed9d('0x41')]['id'],'MailInteractionId':_0x2a0902['id'],'direction':'in','ContactId':_0x544e87[_0xed9d('0x59')]['id'],'messageId':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')][_0xed9d('0x4f')],'from':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')][_0xed9d('0x31')],'to':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')]['to'],'cc':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')]['cc'],'subject':_0x432cca[_0xed9d('0x2b')]['message'][_0xed9d('0x50')],'attach':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')][_0xed9d('0x51')],'Attachments':_0x432cca[_0xed9d('0x2b')]['message'][_0xed9d('0x5a')],'originTo':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')]['originTo'],'originCc':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')][_0xed9d('0x5b')],'bcc':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')]['bcc'],'ChatWebsiteId':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')]['ChatWebsiteId']||null,'originChannel':_0x432cca[_0xed9d('0x2b')][_0xed9d('0x19')][_0xed9d('0x5c')]||_0xed9d('0x5d'),'ChatOfflineMessageId':_0x432cca['body'][_0xed9d('0x19')][_0xed9d('0x5e')]||null},{'include':[{'model':db[_0xed9d('0x5f')],'as':_0xed9d('0x60')}]});})[_0xed9d('0x26')](function(_0x6369b7){_0x544e87[_0xed9d('0x19')]=_0x6369b7;if(_0x544e87[_0xed9d('0x61')][_0xed9d('0x62')]){return db['User'][_0xed9d('0x27')]({'attributes':['id',_0xed9d('0x63')],'where':{'id':_0x544e87[_0xed9d('0x61')][_0xed9d('0x62')]}})[_0xed9d('0x26')](function(_0x334eb2){if(_0x334eb2){_0x544e87[_0xed9d('0x43')][_0xed9d('0x64')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x334eb2[_0xed9d('0x63')]+','+(_0x544e87['account']['waitForTheAssignedAgent']||0xa),'interval':_0xed9d('0x4c')});}return respondWithRpcPromise(_0xed9d('0x65'),'startRouting',_0x544e87);});}return respondWithRpcPromise(_0xed9d('0x65'),_0xed9d('0x66'),_0x544e87);})[_0xed9d('0x26')](function(_0x4d4703){_0x332335(_0x4d4703);})['catch'](function(_0x208206){_0x39234b(_0x1e36f5[_0xed9d('0x17')](0x1f4,_0x208206[_0xed9d('0x19')]));});});}; \ No newline at end of file +var _0x73cd=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','then','List','get','account','omit','applications','list','orderBy','priority','asc','autoclose','close','*,*,*,*','create','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','MailInteraction','Contact\x20not\x20found','spread','update','subject','attach','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','User','agent','name','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','find','ShowMailAccount','mail','difference','keys','createdAt','updatedAt','CompanyId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey'];(function(_0x592c14,_0x34cf86){var _0x1cc2eb=function(_0x28b4ec){while(--_0x28b4ec){_0x592c14['push'](_0x592c14['shift']());}};_0x1cc2eb(++_0x34cf86);}(_0x73cd,0x1d2));var _0xd73c=function(_0x29f730,_0x23d7ed){_0x29f730=_0x29f730-0x0;var _0x189806=_0x73cd[_0x29f730];return _0x189806;};'use strict';var _=require(_0xd73c('0x0'));var util=require(_0xd73c('0x1'));var moment=require(_0xd73c('0x2'));var BPromise=require(_0xd73c('0x3'));var rs=require(_0xd73c('0x4'));var fs=require('fs');var Redis=require(_0xd73c('0x5'));var db=require(_0xd73c('0x6'))['db'];var utils=require(_0xd73c('0x7'));var logger=require(_0xd73c('0x8'))(_0xd73c('0x9'));var config=require('../../config/environment');var jayson=require(_0xd73c('0xa'));var client=jayson[_0xd73c('0xb')][_0xd73c('0xc')]({'port':0x232c});config[_0xd73c('0xd')]=_[_0xd73c('0xe')](config['redis'],{'host':_0xd73c('0xf'),'port':0x18eb});var socket=require(_0xd73c('0x10'))(new Redis(config[_0xd73c('0xd')]));require(_0xd73c('0x11'))['register'](socket);function respondWithRpcPromise(_0xa6b042,_0x29f40a,_0x1df5a8){return new BPromise(function(_0x31cb19,_0x25b461){return client[_0xd73c('0x12')](_0xa6b042,_0x1df5a8)['then'](function(_0xc4c9a7){logger['info'](_0xd73c('0x13'),_0x29f40a,_0xd73c('0x14'));logger[_0xd73c('0x15')](_0xd73c('0x16'),_0x29f40a,_0xd73c('0x14'),JSON['stringify'](_0xc4c9a7));if(_0xc4c9a7['error']){if(_0xc4c9a7[_0xd73c('0x17')][_0xd73c('0x18')]===0x1f4){logger['error'](_0xd73c('0x13'),_0x29f40a,_0xc4c9a7[_0xd73c('0x17')][_0xd73c('0x19')]);return _0x25b461(_0xc4c9a7[_0xd73c('0x17')][_0xd73c('0x19')]);}logger[_0xd73c('0x17')](_0xd73c('0x13'),_0x29f40a,_0xc4c9a7[_0xd73c('0x17')][_0xd73c('0x19')]);return _0x31cb19(_0xc4c9a7[_0xd73c('0x17')]['message']);}else{logger[_0xd73c('0x1a')](_0xd73c('0x13'),_0x29f40a,'request\x20sent');_0x31cb19(_0xc4c9a7[_0xd73c('0x1b')][_0xd73c('0x19')]);}})['catch'](function(_0x11510f){logger[_0xd73c('0x17')](_0xd73c('0x13'),_0x29f40a,_0x11510f);_0x25b461(_0x11510f);});});}exports[_0xd73c('0x1c')]=function(_0x22350b){var _0x59c7b0=this;return new Promise(function(_0x1e4062,_0x5e0288){return db[_0xd73c('0x1d')]['findAll']({'raw':_0x22350b['options']?_0x22350b[_0xd73c('0x1e')][_0xd73c('0x1f')]===undefined?!![]:![]:!![],'where':_0x22350b[_0xd73c('0x1e')]?_0x22350b[_0xd73c('0x1e')][_0xd73c('0x20')]||null:null,'attributes':_0x22350b[_0xd73c('0x1e')]?_0x22350b[_0xd73c('0x1e')][_0xd73c('0x21')]||null:null,'limit':_0x22350b[_0xd73c('0x1e')]?_0x22350b[_0xd73c('0x1e')][_0xd73c('0x22')]||null:null,'include':_0x22350b['options']?_0x22350b['options'][_0xd73c('0x23')]?_[_0xd73c('0x24')](_0x22350b['options'][_0xd73c('0x23')],function(_0x8469f8){return{'model':db[_0x8469f8[_0xd73c('0x25')]],'as':_0x8469f8['as'],'attributes':_0x8469f8[_0xd73c('0x21')],'include':_0x8469f8['include']?_[_0xd73c('0x24')](_0x8469f8[_0xd73c('0x23')],function(_0x54874f){return{'model':db[_0x54874f[_0xd73c('0x25')]],'as':_0x54874f['as'],'attributes':_0x54874f['attributes'],'include':_0x54874f[_0xd73c('0x23')]?_[_0xd73c('0x24')](_0x54874f[_0xd73c('0x23')],function(_0x97ff11){return{'model':db[_0x97ff11['model']],'as':_0x97ff11['as'],'attributes':_0x97ff11[_0xd73c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19f222){logger[_0xd73c('0x1a')](_0xd73c('0x1c'),_0x22350b);logger['debug']('GetMailAccount',_0x22350b,JSON[_0xd73c('0x26')](_0x19f222));_0x1e4062(_0x19f222);})[_0xd73c('0x27')](function(_0x2cd6a2){logger[_0xd73c('0x17')]('GetMailAccount',_0x2cd6a2[_0xd73c('0x19')],_0x22350b);_0x5e0288(_0x59c7b0[_0xd73c('0x17')](0x1f4,_0x2cd6a2[_0xd73c('0x19')]));});});};exports['ShowMailAccount']=function(_0x3c60cf){var _0x4ab15a=this;return new Promise(function(_0x3a7634,_0x52ad11){return db[_0xd73c('0x1d')][_0xd73c('0x28')]({'raw':_0x3c60cf[_0xd73c('0x1e')]?_0x3c60cf[_0xd73c('0x1e')][_0xd73c('0x1f')]===undefined?!![]:![]:!![],'where':_0x3c60cf[_0xd73c('0x1e')]?_0x3c60cf[_0xd73c('0x1e')][_0xd73c('0x20')]||null:null,'attributes':_0x3c60cf['options']?_0x3c60cf[_0xd73c('0x1e')]['attributes']||null:null,'include':_0x3c60cf[_0xd73c('0x1e')]?_0x3c60cf[_0xd73c('0x1e')]['include']?_[_0xd73c('0x24')](_0x3c60cf[_0xd73c('0x1e')]['include'],function(_0x5c2452){return{'model':db[_0x5c2452[_0xd73c('0x25')]],'as':_0x5c2452['as'],'attributes':_0x5c2452[_0xd73c('0x21')],'include':_0x5c2452[_0xd73c('0x23')]?_['map'](_0x5c2452[_0xd73c('0x23')],function(_0x513e2e){return{'model':db[_0x513e2e[_0xd73c('0x25')]],'as':_0x513e2e['as'],'attributes':_0x513e2e[_0xd73c('0x21')],'include':_0x513e2e[_0xd73c('0x23')]?_[_0xd73c('0x24')](_0x513e2e[_0xd73c('0x23')],function(_0x225a8a){return{'model':db[_0x225a8a[_0xd73c('0x25')]],'as':_0x225a8a['as'],'attributes':_0x225a8a[_0xd73c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x583ec8){logger[_0xd73c('0x1a')](_0xd73c('0x29'),_0x3c60cf);logger[_0xd73c('0x15')](_0xd73c('0x29'),_0x3c60cf,JSON[_0xd73c('0x26')](_0x583ec8));_0x3a7634(_0x583ec8);})['catch'](function(_0x12306b){logger[_0xd73c('0x17')]('ShowMailAccount',_0x12306b[_0xd73c('0x19')],_0x3c60cf);_0x52ad11(_0x4ab15a[_0xd73c('0x17')](0x1f4,_0x12306b[_0xd73c('0x19')]));});});};exports['NotifyMailAccount']=function(_0x1692d9){var _0xd8d972=this;return new Promise(function(_0x24dd65,_0x22800c){var _0x3b24e5={'body':_0x1692d9['body'],'channel':_0xd73c('0x2a')};var _0x41ae7c=_[_0xd73c('0x2b')](_[_0xd73c('0x2c')](db['CmContact']['rawAttributes']),[_0xd73c('0x2d'),_0xd73c('0x2e'),_0xd73c('0x2f'),'ListId']);var _0x7ba30f=![];if(_0x1692d9[_0xd73c('0x30')]['id']){delete _0x1692d9[_0xd73c('0x30')]['id'];}if(_[_0xd73c('0x31')](_0x1692d9[_0xd73c('0x30')][_0xd73c('0x32')])){return _0x22800c(_0xd8d972[_0xd73c('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x1692d9[_0xd73c('0x30')][_0xd73c('0x30')])||_0x1692d9[_0xd73c('0x30')][_0xd73c('0x30')]===''){return _0x22800c(_0xd8d972[_0xd73c('0x17')](0x1f4,_0xd73c('0x33')));}if(_[_0xd73c('0x31')](_0x1692d9[_0xd73c('0x30')]['mapKey'])){return _0x22800c(_0xd8d972[_0xd73c('0x17')](0x1f4,_0xd73c('0x34')+_0x41ae7c));}if(!_['includes'](_0x41ae7c,_0x1692d9['body'][_0xd73c('0x35')])){return _0x22800c(_0xd8d972[_0xd73c('0x17')](0x1f4,_0xd73c('0x36')+_0x41ae7c));}var _0x26e2ca={};_0x26e2ca[_0x1692d9['body'][_0xd73c('0x35')]]=_0x1692d9[_0xd73c('0x30')][_0xd73c('0x32')];return db[_0xd73c('0x1d')][_0xd73c('0x28')]({'where':{'id':_0x1692d9['account']['id']},'include':[{'model':db[_0xd73c('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':_0xd73c('0x38'),'where':_0x26e2ca,'limit':0x1,'order':[[_0xd73c('0x2e'),_0xd73c('0x39')]]}]},{'model':db[_0xd73c('0x3a')],'as':_0xd73c('0x3b')},{'model':db[_0xd73c('0x3c')],'as':_0xd73c('0x3d')}]})[_0xd73c('0x3e')](function(_0x290dcf){if(_0x290dcf&&_0x290dcf[_0xd73c('0x3f')]){var _0x397d9e=_0x290dcf[_0xd73c('0x40')]({'plain':!![]});_0x3b24e5[_0xd73c('0x41')]=_[_0xd73c('0x42')](_0x397d9e,['Applications',_0xd73c('0x3f')]);_0x3b24e5[_0xd73c('0x43')]=_0x397d9e[_0xd73c('0x3b')];_0x3b24e5[_0xd73c('0x44')]=_0x397d9e['List'];_0x3b24e5['applications']=_[_0xd73c('0x45')](_0x3b24e5[_0xd73c('0x43')],[_0xd73c('0x46')],[_0xd73c('0x47')]);if(_0x3b24e5[_0xd73c('0x41')]&&_0x3b24e5[_0xd73c('0x41')][_0xd73c('0x48')]){_0x3b24e5[_0xd73c('0x43')]['push']({'id':0x0,'priority':_0x3b24e5['applications']['length']+0x1,'app':_0xd73c('0x49'),'appdata':_0xd73c('0x48'),'interval':_0xd73c('0x4a')});}if(_0x3b24e5[_0xd73c('0x41')]['Applications']){delete _0x3b24e5[_0xd73c('0x41')]['Applications'];}if(_0x3b24e5[_0xd73c('0x41')][_0xd73c('0x3f')]){delete _0x3b24e5[_0xd73c('0x41')][_0xd73c('0x3f')];}if(_0x397d9e['List'][_0xd73c('0x38')]['length']){return _0x397d9e[_0xd73c('0x3f')][_0xd73c('0x38')][0x0];}var _0xcb2965=_[_0xd73c('0xe')](_0x1692d9[_0xd73c('0x30')],{'firstName':_0x1692d9[_0xd73c('0x30')]['from'],'ListId':_0x397d9e['ListId']});_0xcb2965[_0x1692d9[_0xd73c('0x30')][_0xd73c('0x35')]]=_0x1692d9['body'][_0xd73c('0x32')];return db['CmContact'][_0xd73c('0x4b')](_0xcb2965);}else{throw new Error('List\x20not\x20found');}})[_0xd73c('0x3e')](function(_0x4f7200){_0x3b24e5['contact']=_0x4f7200;if(_0x4f7200){if(!_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x4c')]){_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x4c')]=rs[_0xd73c('0x4d')]()+'\x20'+_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x32')];}var _0xcf128a={'ContactId':_0x4f7200['id'],'MailAccountId':_0x1692d9[_0xd73c('0x41')]['id'],'inReplyTo':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x4c')],'to':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x32')],'cc':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['cc'],'subject':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['subject'],'attach':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['attach'],'lastMsgAt':moment()[_0xd73c('0x4e')](_0xd73c('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd73c('0x28')]({'where':{'closed':![],'MailAccountId':_0x1692d9[_0xd73c('0x41')]['id']},'include':[{'model':db[_0xd73c('0x50')],'as':'Messages','attributes':[_0xd73c('0x4c')],'where':{'messageId':_0x1692d9['body'][_0xd73c('0x19')]['inReplyTo']}}]})[_0xd73c('0x3e')](function(_0x41a744){if(_0x41a744){return[_0x41a744,![]];}return db[_0xd73c('0x51')]['create'](_0xcf128a)['then'](function(_0x5bf293){return[_0x5bf293,!![]];});});}else{throw new Error(_0xd73c('0x52'));}})[_0xd73c('0x53')](function(_0x37efc0,_0x57dfd2){if(_0x37efc0){_0x7ba30f=_0x57dfd2;if(!_0x57dfd2){return _0x37efc0[_0xd73c('0x54')]({'inReplyTo':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x4c')],'to':_0x1692d9['body'][_0xd73c('0x19')][_0xd73c('0x32')],'cc':_0x1692d9['body'][_0xd73c('0x19')]['cc'],'subject':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x55')],'attach':_0x37efc0[_0xd73c('0x56')]?_0x37efc0[_0xd73c('0x56')]:_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x56')],'substatus':null,'substatusAt':moment()[_0xd73c('0x4e')](_0xd73c('0x4f')),'lastMsgAt':moment()[_0xd73c('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x37efc0;}}})[_0xd73c('0x3e')](function(_0x348c31){_0x3b24e5[_0xd73c('0x57')]=_0x348c31[_0xd73c('0x40')]({'plain':!![]});_0x3b24e5[_0xd73c('0x57')][_0xd73c('0x58')]=_0x7ba30f;return db[_0xd73c('0x50')][_0xd73c('0x4b')]({'body':_0x1692d9[_0xd73c('0x30')]['body'],'MailAccountId':_0x1692d9['account']['id'],'MailInteractionId':_0x348c31['id'],'direction':'in','ContactId':_0x3b24e5['contact']['id'],'messageId':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x4c')],'from':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x32')],'to':_0x1692d9['body'][_0xd73c('0x19')]['to'],'cc':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['cc'],'subject':_0x1692d9['body'][_0xd73c('0x19')][_0xd73c('0x55')],'attach':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['attach'],'Attachments':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x59')],'originTo':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x5a')],'originCc':_0x1692d9['body']['message'][_0xd73c('0x5b')],'bcc':_0x1692d9[_0xd73c('0x30')]['message']['bcc'],'ChatWebsiteId':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x5c')]||null,'originChannel':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')][_0xd73c('0x5d')]||_0xd73c('0x5e'),'ChatOfflineMessageId':_0x1692d9[_0xd73c('0x30')][_0xd73c('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xd73c('0x5f')],'as':_0xd73c('0x60')}]});})[_0xd73c('0x3e')](function(_0xcffa05){_0x3b24e5['message']=_0xcffa05;if(_0x3b24e5[_0xd73c('0x57')][_0xd73c('0x61')]){return db[_0xd73c('0x62')][_0xd73c('0x28')]({'attributes':['id','name'],'where':{'id':_0x3b24e5[_0xd73c('0x57')][_0xd73c('0x61')]}})[_0xd73c('0x3e')](function(_0x975fc){if(_0x975fc){_0x3b24e5[_0xd73c('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd73c('0x63'),'appdata':_0x975fc[_0xd73c('0x64')]+','+(_0x3b24e5['account'][_0xd73c('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd73c('0x66'),_0x3b24e5);});}return respondWithRpcPromise(_0xd73c('0x67'),'startRouting',_0x3b24e5);})[_0xd73c('0x3e')](function(_0xc73614){_0x24dd65(_0xc73614);})[_0xd73c('0x27')](function(_0x41ac75){_0x22800c(_0xd8d972[_0xd73c('0x17')](0x1f4,_0x41ac75[_0xd73c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 48b4982..0eab508 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 _0xd60e=['mailAccount:','./mailAccount.events','save','remove','emit','register','length'];(function(_0x279c9a,_0x2095ce){var _0x4b712b=function(_0x391c9b){while(--_0x391c9b){_0x279c9a['push'](_0x279c9a['shift']());}};_0x4b712b(++_0x2095ce);}(_0xd60e,0x1d6));var _0xed60=function(_0x154543,_0x1d919a){_0x154543=_0x154543-0x0;var _0x49b294=_0xd60e[_0x154543];return _0x49b294;};'use strict';var MailAccountEvents=require(_0xed60('0x0'));var events=[_0xed60('0x1'),_0xed60('0x2'),'update'];function createListener(_0x3e2dfa,_0x4666fb){return function(_0x38bc9c){_0x4666fb[_0xed60('0x3')](_0x3e2dfa,_0x38bc9c);};}function removeListener(_0x319155,_0x3c3100){return function(){MailAccountEvents['removeListener'](_0x319155,_0x3c3100);};}exports[_0xed60('0x4')]=function(_0x4df4f2){for(var _0x9a7a55=0x0,_0x37a5cb=events[_0xed60('0x5')];_0x9a7a55<_0x37a5cb;_0x9a7a55++){var _0x962cf1=events[_0x9a7a55];var _0x1b0401=createListener(_0xed60('0x6')+_0x962cf1,_0x4df4f2);MailAccountEvents['on'](_0x962cf1,_0x1b0401);}}; \ No newline at end of file +var _0x72f6=['remove','emit','removeListener','register','length','./mailAccount.events','save'];(function(_0x9b7f1c,_0xec93c3){var _0xa10e38=function(_0x4e3f8a){while(--_0x4e3f8a){_0x9b7f1c['push'](_0x9b7f1c['shift']());}};_0xa10e38(++_0xec93c3);}(_0x72f6,0x1a9));var _0x672f=function(_0x5888ea,_0x363875){_0x5888ea=_0x5888ea-0x0;var _0x13a7f0=_0x72f6[_0x5888ea];return _0x13a7f0;};'use strict';var MailAccountEvents=require(_0x672f('0x0'));var events=[_0x672f('0x1'),_0x672f('0x2'),'update'];function createListener(_0x2628a9,_0x3c453b){return function(_0x17ae6c){_0x3c453b[_0x672f('0x3')](_0x2628a9,_0x17ae6c);};}function removeListener(_0x4c4261,_0x403bf0){return function(){MailAccountEvents[_0x672f('0x4')](_0x4c4261,_0x403bf0);};}exports[_0x672f('0x5')]=function(_0x56d5c8){for(var _0x5cdec=0x0,_0x2b7630=events[_0x672f('0x6')];_0x5cdec<_0x2b7630;_0x5cdec++){var _0xdea452=events[_0x5cdec];var _0x19c0d2=createListener('mailAccount:'+_0xdea452,_0x56d5c8);MailAccountEvents['on'](_0xdea452,_0x19c0d2);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 60cf5a6..19f8bf7 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 _0x081b=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','multer'];(function(_0x3086d0,_0x5ad3a0){var _0xb4cde=function(_0x393c0e){while(--_0x393c0e){_0x3086d0['push'](_0x3086d0['shift']());}};_0xb4cde(++_0x5ad3a0);}(_0x081b,0x179));var _0xb081=function(_0x391adf,_0x1a3ebc){_0x391adf=_0x391adf-0x0;var _0x2feea9=_0x081b[_0x391adf];return _0x2feea9;};'use strict';var multer=require(_0xb081('0x0'));var util=require(_0xb081('0x1'));var path=require(_0xb081('0x2'));var timeout=require(_0xb081('0x3'));var express=require(_0xb081('0x4'));var router=express[_0xb081('0x5')]();var fs_extra=require(_0xb081('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb081('0x7'));var config=require(_0xb081('0x8'));var controller=require(_0xb081('0x9'));router[_0xb081('0xa')](_0xb081('0xb'),auth[_0xb081('0xc')](),controller[_0xb081('0xd')]);router['put'](_0xb081('0xb'),auth[_0xb081('0xc')](),controller[_0xb081('0xe')]);router[_0xb081('0xf')]('/:id',auth[_0xb081('0xc')](),controller[_0xb081('0x10')]);module[_0xb081('0x11')]=router; \ No newline at end of file +var _0xc74a=['put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x40cf33,_0x106e35){var _0x563278=function(_0x1b8f1f){while(--_0x1b8f1f){_0x40cf33['push'](_0x40cf33['shift']());}};_0x563278(++_0x106e35);}(_0xc74a,0x17a));var _0xac74=function(_0x4335f2,_0xd35860){_0x4335f2=_0x4335f2-0x0;var _0x320328=_0xc74a[_0x4335f2];return _0x320328;};'use strict';var multer=require(_0xac74('0x0'));var util=require('util');var path=require(_0xac74('0x1'));var timeout=require(_0xac74('0x2'));var express=require('express');var router=express[_0xac74('0x3')]();var fs_extra=require(_0xac74('0x4'));var auth=require(_0xac74('0x5'));var interaction=require(_0xac74('0x6'));var config=require(_0xac74('0x7'));var controller=require(_0xac74('0x8'));router[_0xac74('0x9')](_0xac74('0xa'),auth[_0xac74('0xb')](),controller[_0xac74('0xc')]);router[_0xac74('0xd')](_0xac74('0xa'),auth[_0xac74('0xb')](),controller[_0xac74('0xe')]);router[_0xac74('0xf')](_0xac74('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xac74('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 1bc88fd..0d31c27 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 _0x4b44=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x59b8d7,_0x57e229){var _0xc2703d=function(_0x4d26fc){while(--_0x4d26fc){_0x59b8d7['push'](_0x59b8d7['shift']());}};_0xc2703d(++_0x57e229);}(_0x4b44,0x74));var _0x44b4=function(_0x182e6c,_0x2a77b0){_0x182e6c=_0x182e6c-0x0;var _0x58b8e2=_0x4b44[_0x182e6c];return _0x58b8e2;};'use strict';var Sequelize=require(_0x44b4('0x0'));module[_0x44b4('0x1')]={'priority':{'type':Sequelize[_0x44b4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x44b4('0x3')],'allowNull':![],'defaultValue':_0x44b4('0x4')},'appdata':{'type':Sequelize[_0x44b4('0x5')]()},'description':{'type':Sequelize[_0x44b4('0x3')]},'interval':{'type':Sequelize[_0x44b4('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x59b0=['noop','TEXT','exports','STRING'];(function(_0x137967,_0x36151f){var _0x597e5f=function(_0x530135){while(--_0x530135){_0x137967['push'](_0x137967['shift']());}};_0x597e5f(++_0x36151f);}(_0x59b0,0x12a));var _0x059b=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0x59b0[_0x4fa0ea];return _0x51d027;};'use strict';var Sequelize=require('sequelize');module[_0x059b('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x059b('0x1')],'allowNull':![],'defaultValue':_0x059b('0x2')},'appdata':{'type':Sequelize[_0x059b('0x3')]()},'description':{'type':Sequelize[_0x059b('0x1')]},'interval':{'type':Sequelize[_0x059b('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e3259cf..9bd8ab2 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 _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x52be03,_0x5bf5f6){var _0xc64bda=function(_0x4ea1a7){while(--_0x4ea1a7){_0x52be03['push'](_0x52be03['shift']());}};_0xc64bda(++_0x5bf5f6);}(_0x70e0,0x17b));var _0x070e=function(_0x94f78d,_0x2a0822){_0x94f78d=_0x94f78d-0x0;var _0x4f0d4b=_0x70e0[_0x94f78d];return _0x4f0d4b;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file +var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x5c6464,_0x3a3b59){var _0x19b8ec=function(_0x2a3765){while(--_0x2a3765){_0x5c6464['push'](_0x5c6464['shift']());}};_0x19b8ec(++_0x3a3b59);}(_0xac4a,0x13f));var _0xaac4=function(_0x3c3cf7,_0x39a00f){_0x3c3cf7=_0x3c3cf7-0x0;var _0xf05967=_0xac4a[_0x3c3cf7];return _0xf05967;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index bee8df4..52f57d4 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 _0x5e3a=['define','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e3a,0xa0));var _0xa5e3=function(_0x4175c0,_0x29bc56){_0x4175c0=_0x4175c0-0x0;var _0x2b35a1=_0x5e3a[_0x4175c0];return _0x2b35a1;};'use strict';var _=require('lodash');var util=require(_0xa5e3('0x0'));var logger=require(_0xa5e3('0x1'))(_0xa5e3('0x2'));var moment=require(_0xa5e3('0x3'));var BPromise=require(_0xa5e3('0x4'));var rp=require(_0xa5e3('0x5'));var fs=require('fs');var path=require(_0xa5e3('0x6'));var rimraf=require('rimraf');var config=require(_0xa5e3('0x7'));var attributes=require('./mailApplication.attributes');module[_0xa5e3('0x8')]=function(_0x3c0ce8,_0x20e287){return _0x3c0ce8[_0xa5e3('0x9')]('MailApplication',attributes,{'tableName':_0xa5e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa5e3('0xb'),'collate':_0xa5e3('0xc')});}; \ No newline at end of file +var _0x1eb6=['lodash','api','request-promise','path','../../config/environment','./mailApplication.attributes','define','mail_applications','utf8mb4'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0x1eb6,0xf3));var _0x61eb=function(_0x824db8,_0x56729a){_0x824db8=_0x824db8-0x0;var _0x4cb62d=_0x1eb6[_0x824db8];return _0x4cb62d;};'use strict';var _=require(_0x61eb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x61eb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x61eb('0x2'));var fs=require('fs');var path=require(_0x61eb('0x3'));var rimraf=require('rimraf');var config=require(_0x61eb('0x4'));var attributes=require(_0x61eb('0x5'));module['exports']=function(_0x3a3c98,_0x290909){return _0x3a3c98[_0x61eb('0x6')]('MailApplication',attributes,{'tableName':_0x61eb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x61eb('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 18c8f56..91c1055 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 _0x3c86=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','update','body','options','where','attributes','limit','UpdateMailApplication','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info'];(function(_0x398481,_0x3de964){var _0x3a4d22=function(_0x359ad4){while(--_0x359ad4){_0x398481['push'](_0x398481['shift']());}};_0x3a4d22(++_0x3de964);}(_0x3c86,0x139));var _0x63c8=function(_0x5c13b0,_0x19dc1a){_0x5c13b0=_0x5c13b0-0x0;var _0x93444=_0x3c86[_0x5c13b0];return _0x93444;};'use strict';var _=require(_0x63c8('0x0'));var util=require(_0x63c8('0x1'));var moment=require(_0x63c8('0x2'));var BPromise=require('bluebird');var rs=require(_0x63c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63c8('0x4'))['db'];var utils=require(_0x63c8('0x5'));var logger=require('../../config/logger')(_0x63c8('0x6'));var config=require('../../config/environment');var jayson=require(_0x63c8('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x64ddd,_0x45e4d0,_0x5ca266){return new BPromise(function(_0x46301c,_0x158668){return client[_0x63c8('0x8')](_0x64ddd,_0x5ca266)[_0x63c8('0x9')](function(_0x4703a){logger[_0x63c8('0xa')]('MailApplication,\x20%s,\x20%s',_0x45e4d0,_0x63c8('0xb'));logger[_0x63c8('0xc')](_0x63c8('0xd'),_0x45e4d0,'request\x20sent',JSON[_0x63c8('0xe')](_0x4703a));if(_0x4703a[_0x63c8('0xf')]){if(_0x4703a[_0x63c8('0xf')][_0x63c8('0x10')]===0x1f4){logger['error'](_0x63c8('0x11'),_0x45e4d0,_0x4703a[_0x63c8('0xf')][_0x63c8('0x12')]);return _0x158668(_0x4703a[_0x63c8('0xf')][_0x63c8('0x12')]);}logger[_0x63c8('0xf')](_0x63c8('0x11'),_0x45e4d0,_0x4703a['error'][_0x63c8('0x12')]);return _0x46301c(_0x4703a[_0x63c8('0xf')]['message']);}else{logger[_0x63c8('0xa')](_0x63c8('0x11'),_0x45e4d0,'request\x20sent');_0x46301c(_0x4703a['result'][_0x63c8('0x12')]);}})[_0x63c8('0x13')](function(_0x3de473){logger[_0x63c8('0xf')](_0x63c8('0x11'),_0x45e4d0,_0x3de473);_0x158668(_0x3de473);});});}exports['UpdateMailApplication']=function(_0x34fc8f){var _0x5cad6b=this;return new Promise(function(_0x1d191a,_0x4e3377){return db['MailApplication'][_0x63c8('0x14')](_0x34fc8f[_0x63c8('0x15')],{'raw':_0x34fc8f[_0x63c8('0x16')]?_0x34fc8f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34fc8f['options']?_0x34fc8f[_0x63c8('0x16')][_0x63c8('0x17')]||null:null,'attributes':_0x34fc8f[_0x63c8('0x16')]?_0x34fc8f[_0x63c8('0x16')][_0x63c8('0x18')]||null:null,'limit':_0x34fc8f[_0x63c8('0x16')]?_0x34fc8f[_0x63c8('0x16')][_0x63c8('0x19')]||null:null})[_0x63c8('0x9')](function(_0x37dc32){logger[_0x63c8('0xa')]('UpdateMailApplication',_0x34fc8f);logger[_0x63c8('0xc')](_0x63c8('0x1a'),_0x34fc8f,JSON[_0x63c8('0xe')](_0x37dc32));_0x1d191a(_0x37dc32);})[_0x63c8('0x13')](function(_0xff2b7b){logger[_0x63c8('0xf')](_0x63c8('0x1a'),_0xff2b7b[_0x63c8('0x12')],_0x34fc8f);_0x4e3377(_0x5cad6b[_0x63c8('0xf')](0x1f4,_0xff2b7b[_0x63c8('0x12')]));});});}; \ No newline at end of file +var _0x0d9d=['info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','options','raw','attributes','limit','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x2c5ca3,_0x4e31fe){var _0x2499c6=function(_0x5e3aa0){while(--_0x5e3aa0){_0x2c5ca3['push'](_0x2c5ca3['shift']());}};_0x2499c6(++_0x4e31fe);}(_0x0d9d,0x1a6));var _0xd0d9=function(_0x299c9a,_0xcab813){_0x299c9a=_0x299c9a-0x0;var _0x5dcd93=_0x0d9d[_0x299c9a];return _0x5dcd93;};'use strict';var _=require(_0xd0d9('0x0'));var util=require(_0xd0d9('0x1'));var moment=require('moment');var BPromise=require(_0xd0d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0d9('0x3'));var db=require(_0xd0d9('0x4'))['db'];var utils=require(_0xd0d9('0x5'));var logger=require(_0xd0d9('0x6'))(_0xd0d9('0x7'));var config=require(_0xd0d9('0x8'));var jayson=require(_0xd0d9('0x9'));var client=jayson[_0xd0d9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28528c,_0x3ca4bd,_0x4f04aa){return new BPromise(function(_0x3bd264,_0x2674d7){return client[_0xd0d9('0xb')](_0x28528c,_0x4f04aa)[_0xd0d9('0xc')](function(_0x584617){logger[_0xd0d9('0xd')](_0xd0d9('0xe'),_0x3ca4bd,_0xd0d9('0xf'));logger[_0xd0d9('0x10')](_0xd0d9('0x11'),_0x3ca4bd,'request\x20sent',JSON['stringify'](_0x584617));if(_0x584617[_0xd0d9('0x12')]){if(_0x584617[_0xd0d9('0x12')][_0xd0d9('0x13')]===0x1f4){logger[_0xd0d9('0x12')](_0xd0d9('0xe'),_0x3ca4bd,_0x584617[_0xd0d9('0x12')][_0xd0d9('0x14')]);return _0x2674d7(_0x584617['error']['message']);}logger[_0xd0d9('0x12')](_0xd0d9('0xe'),_0x3ca4bd,_0x584617['error']['message']);return _0x3bd264(_0x584617[_0xd0d9('0x12')][_0xd0d9('0x14')]);}else{logger[_0xd0d9('0xd')]('MailApplication,\x20%s,\x20%s',_0x3ca4bd,_0xd0d9('0xf'));_0x3bd264(_0x584617[_0xd0d9('0x15')][_0xd0d9('0x14')]);}})[_0xd0d9('0x16')](function(_0x470383){logger['error'](_0xd0d9('0xe'),_0x3ca4bd,_0x470383);_0x2674d7(_0x470383);});});}exports[_0xd0d9('0x17')]=function(_0x28218a){var _0x26d548=this;return new Promise(function(_0x1672a9,_0x4f991){return db['MailApplication']['update'](_0x28218a['body'],{'raw':_0x28218a[_0xd0d9('0x18')]?_0x28218a[_0xd0d9('0x18')][_0xd0d9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28218a[_0xd0d9('0x18')]?_0x28218a[_0xd0d9('0x18')]['where']||null:null,'attributes':_0x28218a[_0xd0d9('0x18')]?_0x28218a[_0xd0d9('0x18')][_0xd0d9('0x1a')]||null:null,'limit':_0x28218a[_0xd0d9('0x18')]?_0x28218a[_0xd0d9('0x18')][_0xd0d9('0x1b')]||null:null})['then'](function(_0x2bff23){logger[_0xd0d9('0xd')]('UpdateMailApplication',_0x28218a);logger[_0xd0d9('0x10')](_0xd0d9('0x17'),_0x28218a,JSON[_0xd0d9('0x1c')](_0x2bff23));_0x1672a9(_0x2bff23);})[_0xd0d9('0x16')](function(_0x2ed3bb){logger[_0xd0d9('0x12')](_0xd0d9('0x17'),_0x2ed3bb[_0xd0d9('0x14')],_0x28218a);_0x4f991(_0x26d548[_0xd0d9('0x12')](0x1f4,_0x2ed3bb[_0xd0d9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 66b3bd2..261333b 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 _0x5878=['destroy','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','getMessages','post','create','/:id/messages','mail','mailinteraction:addtags','addTags','/:id','tracked','mailinteraction:update','update','delete','mailinteraction:destroy'];(function(_0x2de955,_0x470653){var _0x197a7a=function(_0x1cb6aa){while(--_0x1cb6aa){_0x2de955['push'](_0x2de955['shift']());}};_0x197a7a(++_0x470653);}(_0x5878,0x163));var _0x8587=function(_0x44d50f,_0x332062){_0x44d50f=_0x44d50f-0x0;var _0x5c4cfd=_0x5878[_0x44d50f];return _0x5c4cfd;};'use strict';var express=require(_0x8587('0x0'));var router=express[_0x8587('0x1')]();var auth=require(_0x8587('0x2'));var interaction=require(_0x8587('0x3'));var controller=require('./mailInteraction.controller');router[_0x8587('0x4')]('/',auth['isAuthenticated'](),controller[_0x8587('0x5')]);router[_0x8587('0x4')](_0x8587('0x6'),auth[_0x8587('0x7')](),controller[_0x8587('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8587('0x9')]);router[_0x8587('0x4')]('/:id/messages',auth[_0x8587('0x7')](),controller[_0x8587('0xa')]);router[_0x8587('0x4')]('/:id/download',auth[_0x8587('0x7')](),controller['download']);router[_0x8587('0xb')]('/',auth[_0x8587('0x7')](),controller[_0x8587('0xc')]);router[_0x8587('0xb')](_0x8587('0xd'),auth[_0x8587('0x7')](),controller['addMessage']);router[_0x8587('0xb')]('/:id/tags',auth[_0x8587('0x7')](),interaction['tracked'](_0x8587('0xe'),_0x8587('0xf')),controller[_0x8587('0x10')]);router['put'](_0x8587('0x11'),auth['isAuthenticated'](),interaction[_0x8587('0x12')](_0x8587('0xe'),_0x8587('0x13')),controller[_0x8587('0x14')]);router[_0x8587('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x8587('0x12')](_0x8587('0xe'),_0x8587('0x16')),controller[_0x8587('0x17')]);router[_0x8587('0x15')](_0x8587('0x18'),auth[_0x8587('0x7')](),controller[_0x8587('0x19')]);module[_0x8587('0x1a')]=router; \ No newline at end of file +var _0xc7fe=['getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','update','delete','destroy','removeTags','exports','express','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show'];(function(_0x546cb3,_0x19094d){var _0x9fef30=function(_0x404c9f){while(--_0x404c9f){_0x546cb3['push'](_0x546cb3['shift']());}};_0x9fef30(++_0x19094d);}(_0xc7fe,0x9a));var _0xec7f=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0xc7fe[_0x355ce8];return _0x1db8b8;};'use strict';var express=require(_0xec7f('0x0'));var router=express['Router']();var auth=require(_0xec7f('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0xec7f('0x2'));router[_0xec7f('0x3')]('/',auth[_0xec7f('0x4')](),controller['index']);router['get'](_0xec7f('0x5'),auth[_0xec7f('0x4')](),controller[_0xec7f('0x6')]);router['get']('/:id',auth[_0xec7f('0x4')](),controller[_0xec7f('0x7')]);router[_0xec7f('0x3')]('/:id/messages',auth[_0xec7f('0x4')](),controller[_0xec7f('0x8')]);router[_0xec7f('0x3')](_0xec7f('0x9'),auth[_0xec7f('0x4')](),controller[_0xec7f('0xa')]);router[_0xec7f('0xb')]('/',auth['isAuthenticated'](),controller[_0xec7f('0xc')]);router['post'](_0xec7f('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0xec7f('0xb')](_0xec7f('0xe'),auth[_0xec7f('0x4')](),interaction[_0xec7f('0xf')](_0xec7f('0x10'),_0xec7f('0x11')),controller[_0xec7f('0x12')]);router[_0xec7f('0x13')](_0xec7f('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0xec7f('0x10'),_0xec7f('0x15')),controller[_0xec7f('0x16')]);router[_0xec7f('0x17')](_0xec7f('0x14'),auth[_0xec7f('0x4')](),interaction[_0xec7f('0xf')](_0xec7f('0x10'),'mailinteraction:destroy'),controller[_0xec7f('0x18')]);router['delete'](_0xec7f('0xe'),auth['isAuthenticated'](),controller[_0xec7f('0x19')]);module[_0xec7f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index bc457d6..7111397 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 _0x01d4=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x01d4,0x6e));var _0x401d=function(_0x36303b,_0x213168){_0x36303b=_0x36303b-0x0;var _0x395d37=_0x01d4[_0x36303b];return _0x395d37;};'use strict';var Sequelize=require(_0x401d('0x0'));var iconv=require(_0x401d('0x1'));module[_0x401d('0x2')]={'closed':{'type':Sequelize[_0x401d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x401d('0x4')]},'disposition':{'type':Sequelize[_0x401d('0x5')]},'secondDisposition':{'type':Sequelize[_0x401d('0x5')]},'thirdDisposition':{'type':Sequelize[_0x401d('0x5')]},'note':{'type':Sequelize[_0x401d('0x5')]},'inReplyTo':{'type':Sequelize[_0x401d('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x401d('0x6'))},'subject':{'type':Sequelize[_0x401d('0x7')]()},'attach':{'type':Sequelize[_0x401d('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x401d('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x401d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x401d('0x8')]('in',_0x401d('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x401d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x401d('0x8')]('in',_0x401d('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x401d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa6fa=['iconv','exports','BOOLEAN','STRING','long','DATE','ENUM','out'];(function(_0x5188ab,_0x4c2109){var _0x4597e7=function(_0x437336){while(--_0x437336){_0x5188ab['push'](_0x5188ab['shift']());}};_0x4597e7(++_0x4c2109);}(_0xa6fa,0x130));var _0xaa6f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa6fa[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xaa6f('0x0'));module[_0xaa6f('0x1')]={'closed':{'type':Sequelize[_0xaa6f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaa6f('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xaa6f('0x3')]},'inReplyTo':{'type':Sequelize[_0xaa6f('0x3')](0x1fe)},'to':{'type':Sequelize[_0xaa6f('0x3')]},'cc':{'type':Sequelize['TEXT'](_0xaa6f('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xaa6f('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xaa6f('0x5')]},'substatus':{'type':Sequelize[_0xaa6f('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xaa6f('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xaa6f('0x6')]('in',_0xaa6f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaa6f('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaa6f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaa6f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ff13bb6..5ecc99b 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xb10b,0x12a));var _0xbb10=function(_0x4649c4,_0x4c8c1a){_0x4649c4=_0x4649c4-0x0;var _0x4166e2=_0xb10b[_0x4649c4];return _0x4166e2;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file +var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x78601a,_0x83dd){var _0x4ed023=function(_0x4cd33c){while(--_0x4cd33c){_0x78601a['push'](_0x78601a['shift']());}};_0x4ed023(++_0x83dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 9b72137..ee7eec9 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 _0xf0a4=['setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','save','update','remove','then'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xf0a4,0xa3));var _0x4f0a=function(_0x3df627,_0xdd8b6f){_0x3df627=_0x3df627-0x0;var _0x187691=_0xf0a4[_0x3df627];return _0x187691;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x4f0a('0x0'))['db'][_0x4f0a('0x1')];var MailMessage=require(_0x4f0a('0x0'))['db'][_0x4f0a('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4f0a('0x3'),'afterUpdate':_0x4f0a('0x4'),'afterDestroy':_0x4f0a('0x5')};function emitEvent(_0x5a36b2){return function(_0x45c239,_0x326254,_0x52e8e1){_0x45c239['getUsers']({'attributes':['id'],'raw':!![]})[_0x4f0a('0x6')](function(_0x4117ca){_0x45c239[_0x4f0a('0x7')](_0x4f0a('0x8'),_0x4117ca[_0x4f0a('0x9')](function(_0x3abeb6){return{'id':_0x3abeb6['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x45c239['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4f0a('0x6')](function(_0x23ef9a){_0x45c239[_0x4f0a('0x7')](_0x4f0a('0xa'),_0x23ef9a[_0x4f0a('0xb')]);MailInteractionEvents['emit'](_0x5a36b2+':'+_0x45c239['id'],_0x45c239);MailInteractionEvents[_0x4f0a('0xc')](_0x5a36b2,_0x45c239);_0x52e8e1(null);})[_0x4f0a('0xd')](_0x52e8e1(null));};}for(var e in events){if(events[_0x4f0a('0xe')](e)){var event=events[e];MailInteraction[_0x4f0a('0xf')](e,emitEvent(event));}}module[_0x4f0a('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x22ac=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','emit','hasOwnProperty','events'];(function(_0x278611,_0x30486d){var _0x151676=function(_0x3dfe18){while(--_0x3dfe18){_0x278611['push'](_0x278611['shift']());}};_0x151676(++_0x30486d);}(_0x22ac,0x1bf));var _0xc22a=function(_0x180271,_0x2a7b1e){_0x180271=_0x180271-0x0;var _0x1cf12f=_0x22ac[_0x180271];return _0x1cf12f;};'use strict';var EventEmitter=require(_0xc22a('0x0'));var MailInteraction=require(_0xc22a('0x1'))['db'][_0xc22a('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xc22a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc22a('0x4')](0x0);var events={'afterCreate':_0xc22a('0x5'),'afterUpdate':_0xc22a('0x6'),'afterDestroy':_0xc22a('0x7')};function emitEvent(_0x5bac41){return function(_0x2965d8,_0x66c644,_0x5475ec){_0x2965d8[_0xc22a('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1089bc){_0x2965d8[_0xc22a('0x9')](_0xc22a('0xa'),_0x1089bc[_0xc22a('0xb')](function(_0x164a2f){return{'id':_0x164a2f['id']};}));return MailMessage[_0xc22a('0xc')]({'where':{'MailInteractionId':_0x2965d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc22a('0xd')](function(_0x23d272){_0x2965d8[_0xc22a('0x9')]('unreadMessages',_0x23d272['length']);MailInteractionEvents[_0xc22a('0xe')](_0x5bac41+':'+_0x2965d8['id'],_0x2965d8);MailInteractionEvents[_0xc22a('0xe')](_0x5bac41,_0x2965d8);_0x5475ec(null);})['catch'](_0x5475ec(null));};}for(var e in events){if(events[_0xc22a('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index eda33a7..65dcd93 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 _0x8446=['exports','define','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','MailMessage','update','then','catch','utf8mb4','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x5e8ff6,_0x588540){var _0x47b02e=function(_0x43fdd8){while(--_0x43fdd8){_0x5e8ff6['push'](_0x5e8ff6['shift']());}};_0x47b02e(++_0x588540);}(_0x8446,0x1dd));var _0x6844=function(_0x1ee99d,_0x25aba5){_0x1ee99d=_0x1ee99d-0x0;var _0x2cee6b=_0x8446[_0x1ee99d];return _0x2cee6b;};'use strict';var _=require(_0x6844('0x0'));var util=require('util');var logger=require(_0x6844('0x1'))(_0x6844('0x2'));var moment=require(_0x6844('0x3'));var BPromise=require('bluebird');var rp=require(_0x6844('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6844('0x5'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x6844('0x6')]=function(_0x57b1ba,_0x142e92){return _0x57b1ba[_0x6844('0x7')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x6844('0x8'),'to'],'type':_0x6844('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b90c2,_0x18aa2b,_0x3d04ed){if(_0x3b90c2[_0x6844('0xa')]){_0x3b90c2[_0x6844('0xb')]=moment()[_0x6844('0xc')](_0x6844('0xd'));}if(_0x3b90c2[_0x6844('0xe')]){_0x3b90c2[_0x6844('0xf')]=moment()[_0x6844('0xc')](_0x6844('0xd'));}_0x3d04ed(null,_0x18aa2b);},'beforeUpdate':function(_0x4ce21e,_0x49cff7,_0x41765d){if(_0x4ce21e[_0x6844('0x10')](_0x6844('0xa'))){_0x4ce21e[_0x6844('0xb')]=_0x4ce21e['substatus']?moment()['format'](_0x6844('0xd')):null;}if(_0x4ce21e[_0x6844('0x10')](_0x6844('0xe'))){_0x4ce21e[_0x6844('0xf')]=moment()[_0x6844('0xc')](_0x6844('0xd'));_0x4ce21e['substatus']=null;_0x4ce21e[_0x6844('0xb')]=null;}_0x41765d(null,_0x4ce21e);},'afterUpdate':function(_0x203e97,_0xf588c5,_0x27e353){var _0x3ff8c0=_0x57b1ba['models'];var _0x47185f=_0x203e97[_0x6844('0x11')]({'plain':!![]});if(_0x47185f[_0x6844('0xe')]){return _0x3ff8c0[_0x6844('0x12')][_0x6844('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x47185f['id']}})[_0x6844('0x14')](function(){_0x27e353();})[_0x6844('0x15')](function(_0x1d9b7c){_0x27e353(_0x1d9b7c);});}else{_0x27e353();}}},'charset':_0x6844('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf46c=['request-promise','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf46c,0xf7));var _0xcf46=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf46c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf46('0x0'));var util=require(_0xcf46('0x1'));var logger=require(_0xcf46('0x2'))(_0xcf46('0x3'));var moment=require('moment');var BPromise=require(_0xcf46('0x4'));var rp=require(_0xcf46('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf46('0x6'));var config=require(_0xcf46('0x7'));var attributes=require(_0xcf46('0x8'));module['exports']=function(_0xd4cf62,_0x53853c){return _0xd4cf62[_0xcf46('0x9')](_0xcf46('0xa'),attributes,{'tableName':_0xcf46('0xb'),'paranoid':![],'indexes':[{'name':_0xcf46('0xc'),'fields':[_0xcf46('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x36a97f,_0x1fa208,_0x1d15b7){if(_0x36a97f[_0xcf46('0xe')]){_0x36a97f['substatusAt']=moment()[_0xcf46('0xf')](_0xcf46('0x10'));}if(_0x36a97f[_0xcf46('0x11')]){_0x36a97f[_0xcf46('0x12')]=moment()[_0xcf46('0xf')](_0xcf46('0x10'));}_0x1d15b7(null,_0x1fa208);},'beforeUpdate':function(_0x1395b9,_0x460bb8,_0x56a618){if(_0x1395b9[_0xcf46('0x13')](_0xcf46('0xe'))){_0x1395b9[_0xcf46('0x14')]=_0x1395b9[_0xcf46('0xe')]?moment()['format'](_0xcf46('0x10')):null;}if(_0x1395b9['changed'](_0xcf46('0x11'))){_0x1395b9['closedAt']=moment()[_0xcf46('0xf')](_0xcf46('0x10'));_0x1395b9[_0xcf46('0xe')]=null;_0x1395b9[_0xcf46('0x14')]=null;}_0x56a618(null,_0x1395b9);},'afterUpdate':function(_0x238333,_0x4becbd,_0x13c245){var _0x181c9f=_0xd4cf62[_0xcf46('0x15')];var _0x2b4440=_0x238333[_0xcf46('0x16')]({'plain':!![]});if(_0x2b4440[_0xcf46('0x11')]){return _0x181c9f[_0xcf46('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x2b4440['id']}})[_0xcf46('0x18')](function(){_0x13c245();})[_0xcf46('0x19')](function(_0x5856ac){_0x13c245(_0x5856ac);});}else{_0x13c245();}}},'charset':_0xcf46('0x1a'),'collate':_0xcf46('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 09257e6..acf8b4a 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 _0x49df=['stringify','AddTagsToMailInteraction','find','where','then','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','request\x20sent','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','attributes','limit','debug'];(function(_0x1fe72a,_0x2defa9){var _0x2caa10=function(_0x2621bf){while(--_0x2621bf){_0x1fe72a['push'](_0x1fe72a['shift']());}};_0x2caa10(++_0x2defa9);}(_0x49df,0xad));var _0xf49d=function(_0x5721c4,_0x2ffbd4){_0x5721c4=_0x5721c4-0x0;var _0x597a5f=_0x49df[_0x5721c4];return _0x597a5f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf49d('0x0'));var BPromise=require(_0xf49d('0x1'));var rs=require(_0xf49d('0x2'));var fs=require('fs');var Redis=require(_0xf49d('0x3'));var db=require(_0xf49d('0x4'))['db'];var utils=require(_0xf49d('0x5'));var logger=require(_0xf49d('0x6'))('rpc');var config=require(_0xf49d('0x7'));var jayson=require(_0xf49d('0x8'));var client=jayson[_0xf49d('0x9')][_0xf49d('0xa')]({'port':0x232a});config[_0xf49d('0xb')]=_[_0xf49d('0xc')](config['redis'],{'host':_0xf49d('0xd'),'port':0x18eb});var socket=require(_0xf49d('0xe'))(new Redis(config[_0xf49d('0xb')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x295d15,_0x4a8ad3,_0x49d438){return new BPromise(function(_0x41ca72,_0xb82700){return client[_0xf49d('0xf')](_0x295d15,_0x49d438)['then'](function(_0x1d07b9){logger[_0xf49d('0x10')]('MailInteraction,\x20%s,\x20%s',_0x4a8ad3,_0xf49d('0x11'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4a8ad3,_0xf49d('0x11'),JSON['stringify'](_0x1d07b9));if(_0x1d07b9[_0xf49d('0x12')]){if(_0x1d07b9[_0xf49d('0x12')][_0xf49d('0x13')]===0x1f4){logger['error'](_0xf49d('0x14'),_0x4a8ad3,_0x1d07b9[_0xf49d('0x12')][_0xf49d('0x15')]);return _0xb82700(_0x1d07b9['error'][_0xf49d('0x15')]);}logger[_0xf49d('0x12')](_0xf49d('0x14'),_0x4a8ad3,_0x1d07b9[_0xf49d('0x12')]['message']);return _0x41ca72(_0x1d07b9[_0xf49d('0x12')][_0xf49d('0x15')]);}else{logger[_0xf49d('0x10')](_0xf49d('0x14'),_0x4a8ad3,_0xf49d('0x11'));_0x41ca72(_0x1d07b9[_0xf49d('0x16')][_0xf49d('0x15')]);}})[_0xf49d('0x17')](function(_0x57ee98){logger[_0xf49d('0x12')](_0xf49d('0x14'),_0x4a8ad3,_0x57ee98);_0xb82700(_0x57ee98);});});}exports[_0xf49d('0x18')]=function(_0x416a9f){var _0x67d3af=this;return new Promise(function(_0x45c16e,_0x199f35){return db[_0xf49d('0x19')][_0xf49d('0x1a')](_0x416a9f[_0xf49d('0x1b')],{'raw':_0x416a9f[_0xf49d('0x1c')]?_0x416a9f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x416a9f[_0xf49d('0x1c')]?_0x416a9f[_0xf49d('0x1c')]['where']||null:null,'attributes':_0x416a9f['options']?_0x416a9f[_0xf49d('0x1c')][_0xf49d('0x1d')]||null:null,'limit':_0x416a9f['options']?_0x416a9f['options'][_0xf49d('0x1e')]||null:null})['then'](function(_0x402097){logger[_0xf49d('0x10')](_0xf49d('0x18'),_0x416a9f);logger[_0xf49d('0x1f')]('UpdateMailInteraction',_0x416a9f,JSON[_0xf49d('0x20')](_0x402097));_0x45c16e(_0x402097);})[_0xf49d('0x17')](function(_0x394fc0){logger[_0xf49d('0x12')](_0xf49d('0x18'),_0x394fc0[_0xf49d('0x15')],_0x416a9f);_0x199f35(_0x67d3af[_0xf49d('0x12')](0x1f4,_0x394fc0[_0xf49d('0x15')]));});});};exports[_0xf49d('0x21')]=function(_0x42e01f){return new Promise(function(_0x5dab7b,_0x516d70){return db[_0xf49d('0x19')][_0xf49d('0x22')]({'where':_0x42e01f[_0xf49d('0x1c')]?_0x42e01f[_0xf49d('0x1c')][_0xf49d('0x23')]||null:null})[_0xf49d('0x24')](function(_0xfe0382){if(_0xfe0382){return _0xfe0382['addTags'](_0x42e01f[_0xf49d('0x1b')][_0xf49d('0x25')],_[_0xf49d('0x26')](_0x42e01f[_0xf49d('0x1b')],[_0xf49d('0x25'),'id'])||{});}})[_0xf49d('0x27')](function(_0xf34b95){logger[_0xf49d('0x10')](_0xf49d('0x28'),_0x42e01f);logger[_0xf49d('0x1f')]('AddTags',_0x42e01f,JSON['stringify'](_0xf34b95));_0x5dab7b(_0xf34b95);})[_0xf49d('0x17')](function(_0x1e03c9){logger['error'](_0xf49d('0x28'),_0x1e03c9[_0xf49d('0x15')],_0x42e01f);_0x516d70(_this[_0xf49d('0x12')](0x1f4,_0x1e03c9['message']));});});}; \ No newline at end of file +var _0x8239=['find','addTags','ids','omit','AddTags','stringify','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailInteraction.socket','register','request','then','info','request\x20sent','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction'];(function(_0x2bdb47,_0xb4f3dc){var _0x57d58c=function(_0x14ad9c){while(--_0x14ad9c){_0x2bdb47['push'](_0x2bdb47['shift']());}};_0x57d58c(++_0xb4f3dc);}(_0x8239,0x177));var _0x9823=function(_0x4737c4,_0x2a3ae5){_0x4737c4=_0x4737c4-0x0;var _0x23a7c7=_0x8239[_0x4737c4];return _0x23a7c7;};'use strict';var _=require(_0x9823('0x0'));var util=require(_0x9823('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9823('0x2'));var fs=require('fs');var Redis=require(_0x9823('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9823('0x4'))(_0x9823('0x5'));var config=require(_0x9823('0x6'));var jayson=require(_0x9823('0x7'));var client=jayson[_0x9823('0x8')][_0x9823('0x9')]({'port':0x232a});config['redis']=_[_0x9823('0xa')](config[_0x9823('0xb')],{'host':_0x9823('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9823('0xb')]));require(_0x9823('0xd'))[_0x9823('0xe')](socket);function respondWithRpcPromise(_0x569d07,_0x559d1b,_0x47d181){return new BPromise(function(_0x1d33de,_0x19151e){return client[_0x9823('0xf')](_0x569d07,_0x47d181)[_0x9823('0x10')](function(_0x3c405d){logger[_0x9823('0x11')]('MailInteraction,\x20%s,\x20%s',_0x559d1b,'request\x20sent');logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x559d1b,_0x9823('0x12'),JSON['stringify'](_0x3c405d));if(_0x3c405d[_0x9823('0x13')]){if(_0x3c405d[_0x9823('0x13')][_0x9823('0x14')]===0x1f4){logger[_0x9823('0x13')](_0x9823('0x15'),_0x559d1b,_0x3c405d[_0x9823('0x13')][_0x9823('0x16')]);return _0x19151e(_0x3c405d[_0x9823('0x13')][_0x9823('0x16')]);}logger[_0x9823('0x13')]('MailInteraction,\x20%s,\x20%s',_0x559d1b,_0x3c405d[_0x9823('0x13')]['message']);return _0x1d33de(_0x3c405d[_0x9823('0x13')][_0x9823('0x16')]);}else{logger[_0x9823('0x11')](_0x9823('0x15'),_0x559d1b,'request\x20sent');_0x1d33de(_0x3c405d[_0x9823('0x17')][_0x9823('0x16')]);}})[_0x9823('0x18')](function(_0x45c9dd){logger[_0x9823('0x13')](_0x9823('0x15'),_0x559d1b,_0x45c9dd);_0x19151e(_0x45c9dd);});});}exports[_0x9823('0x19')]=function(_0x390d39){var _0x28d372=this;return new Promise(function(_0x324e24,_0x117f0d){return db[_0x9823('0x1a')][_0x9823('0x1b')](_0x390d39[_0x9823('0x1c')],{'raw':_0x390d39[_0x9823('0x1d')]?_0x390d39[_0x9823('0x1d')][_0x9823('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x390d39[_0x9823('0x1d')]?_0x390d39[_0x9823('0x1d')][_0x9823('0x1f')]||null:null,'attributes':_0x390d39['options']?_0x390d39['options'][_0x9823('0x20')]||null:null,'limit':_0x390d39[_0x9823('0x1d')]?_0x390d39[_0x9823('0x1d')][_0x9823('0x21')]||null:null})['then'](function(_0xf06fa0){logger[_0x9823('0x11')](_0x9823('0x19'),_0x390d39);logger['debug'](_0x9823('0x19'),_0x390d39,JSON['stringify'](_0xf06fa0));_0x324e24(_0xf06fa0);})[_0x9823('0x18')](function(_0xdcb026){logger[_0x9823('0x13')](_0x9823('0x19'),_0xdcb026['message'],_0x390d39);_0x117f0d(_0x28d372[_0x9823('0x13')](0x1f4,_0xdcb026['message']));});});};exports[_0x9823('0x22')]=function(_0x598420){return new Promise(function(_0x3df67b,_0x35acfb){return db[_0x9823('0x1a')][_0x9823('0x23')]({'where':_0x598420[_0x9823('0x1d')]?_0x598420[_0x9823('0x1d')][_0x9823('0x1f')]||null:null})[_0x9823('0x10')](function(_0x15db4b){if(_0x15db4b){return _0x15db4b[_0x9823('0x24')](_0x598420[_0x9823('0x1c')][_0x9823('0x25')],_[_0x9823('0x26')](_0x598420[_0x9823('0x1c')],['ids','id'])||{});}})['spread'](function(_0xb82de3){logger[_0x9823('0x11')](_0x9823('0x27'),_0x598420);logger['debug']('AddTags',_0x598420,JSON[_0x9823('0x28')](_0xb82de3));_0x3df67b(_0xb82de3);})[_0x9823('0x18')](function(_0x37e596){logger[_0x9823('0x13')](_0x9823('0x27'),_0x37e596[_0x9823('0x16')],_0x598420);_0x35acfb(_this['error'](0x1f4,_0x37e596[_0x9823('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a886d55..a746cb8 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 _0x15b5=['emit','removeListener','register','mailInteraction:','./mailInteraction.events','remove'];(function(_0x481af3,_0x483fac){var _0x3354ea=function(_0x2e3de5){while(--_0x2e3de5){_0x481af3['push'](_0x481af3['shift']());}};_0x3354ea(++_0x483fac);}(_0x15b5,0x1d8));var _0x515b=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x15b5[_0x4b7b69];return _0x173b4c;};'use strict';var MailInteractionEvents=require(_0x515b('0x0'));var events=['save',_0x515b('0x1'),'update'];function createListener(_0x4c01a1,_0x4563c7){return function(_0x34c591){_0x4563c7[_0x515b('0x2')](_0x4c01a1,_0x34c591);};}function removeListener(_0x24904e,_0x318562){return function(){MailInteractionEvents[_0x515b('0x3')](_0x24904e,_0x318562);};}exports[_0x515b('0x4')]=function(_0x1aee47){for(var _0x33ff97=0x0,_0x5e47a6=events['length'];_0x33ff97<_0x5e47a6;_0x33ff97++){var _0x5a6738=events[_0x33ff97];var _0x4d3e04=createListener(_0x515b('0x5')+_0x5a6738,_0x1aee47);MailInteractionEvents['on'](_0x5a6738,_0x4d3e04);}}; \ No newline at end of file +var _0x94b8=['register','save','remove','update','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x94b8,0xc1));var _0x894b=function(_0x34e6a0,_0x15826c){_0x34e6a0=_0x34e6a0-0x0;var _0x4f5e76=_0x94b8[_0x34e6a0];return _0x4f5e76;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x894b('0x0'),_0x894b('0x1'),_0x894b('0x2')];function createListener(_0x5c2fe3,_0x4fc1b9){return function(_0x3ffdb6){_0x4fc1b9[_0x894b('0x3')](_0x5c2fe3,_0x3ffdb6);};}function removeListener(_0x403dc5,_0x1dc7c3){return function(){MailInteractionEvents[_0x894b('0x4')](_0x403dc5,_0x1dc7c3);};}exports[_0x894b('0x5')]=function(_0x5ecc47){for(var _0xb1e776=0x0,_0x3d1cf6=events['length'];_0xb1e776<_0x3d1cf6;_0xb1e776++){var _0x2141fc=events[_0xb1e776];var _0x1c55ad=createListener('mailInteraction:'+_0x2141fc,_0x5ecc47);MailInteractionEvents['on'](_0x2141fc,_0x1c55ad);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5474067..e3a7e08 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 _0xa581=['isAuthenticated','describe','show','/:id/download','download','post','tracked','create','put','/:id','update','/:id/accept','accept','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','/describe'];(function(_0xefb4e,_0xe56689){var _0x36c78c=function(_0x158fe3){while(--_0x158fe3){_0xefb4e['push'](_0xefb4e['shift']());}};_0x36c78c(++_0xe56689);}(_0xa581,0x90));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1a58('0x0'));var util=require(_0x1a58('0x1'));var path=require(_0x1a58('0x2'));var timeout=require(_0x1a58('0x3'));var express=require(_0x1a58('0x4'));var router=express[_0x1a58('0x5')]();var fs_extra=require(_0x1a58('0x6'));var auth=require(_0x1a58('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1a58('0x8'));var controller=require(_0x1a58('0x9'));router[_0x1a58('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1a58('0xa')](_0x1a58('0xb'),auth[_0x1a58('0xc')](),controller[_0x1a58('0xd')]);router[_0x1a58('0xa')]('/:id',auth[_0x1a58('0xc')](),controller[_0x1a58('0xe')]);router[_0x1a58('0xa')](_0x1a58('0xf'),auth[_0x1a58('0xc')](),controller[_0x1a58('0x10')]);router[_0x1a58('0x11')]('/',auth[_0x1a58('0xc')](),interaction[_0x1a58('0x12')]('mail','mailmessage:create'),controller[_0x1a58('0x13')]);router[_0x1a58('0x14')](_0x1a58('0x15'),auth[_0x1a58('0xc')](),controller[_0x1a58('0x16')]);router[_0x1a58('0x14')](_0x1a58('0x17'),auth[_0x1a58('0xc')](),controller[_0x1a58('0x18')]);router[_0x1a58('0x14')]('/:id/reject',auth[_0x1a58('0xc')](),controller['reject']);router[_0x1a58('0x19')](_0x1a58('0x15'),auth[_0x1a58('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8e44=['/:id/download','download','post','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x8e44,0x1ac));var _0x48e4=function(_0x3d5df9,_0x5b3623){_0x3d5df9=_0x3d5df9-0x0;var _0x50ba39=_0x8e44[_0x3d5df9];return _0x50ba39;};'use strict';var multer=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));var path=require(_0x48e4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x48e4('0x3')]();var fs_extra=require(_0x48e4('0x4'));var auth=require(_0x48e4('0x5'));var interaction=require(_0x48e4('0x6'));var config=require('../../config/environment');var controller=require(_0x48e4('0x7'));router[_0x48e4('0x8')]('/',auth[_0x48e4('0x9')](),controller['index']);router['get'](_0x48e4('0xa'),auth[_0x48e4('0x9')](),controller[_0x48e4('0xb')]);router[_0x48e4('0x8')](_0x48e4('0xc'),auth[_0x48e4('0x9')](),controller[_0x48e4('0xd')]);router[_0x48e4('0x8')](_0x48e4('0xe'),auth['isAuthenticated'](),controller[_0x48e4('0xf')]);router[_0x48e4('0x10')]('/',auth[_0x48e4('0x9')](),interaction['tracked']('mail',_0x48e4('0x11')),controller[_0x48e4('0x12')]);router[_0x48e4('0x13')](_0x48e4('0xc'),auth['isAuthenticated'](),controller[_0x48e4('0x14')]);router['put'](_0x48e4('0x15'),auth[_0x48e4('0x9')](),controller[_0x48e4('0x16')]);router[_0x48e4('0x13')](_0x48e4('0x17'),auth[_0x48e4('0x9')](),controller[_0x48e4('0x18')]);router['delete'](_0x48e4('0xc'),auth[_0x48e4('0x9')](),controller['destroy']);module[_0x48e4('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 0415e93..39620cb 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 _0xd943=['lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email'];(function(_0x22f7e7,_0x55c7cb){var _0xdc7790=function(_0x5a483a){while(--_0x5a483a){_0x22f7e7['push'](_0x22f7e7['shift']());}};_0xdc7790(++_0x55c7cb);}(_0xd943,0xa8));var _0x3d94=function(_0x5aff28,_0x38b760){_0x5aff28=_0x5aff28-0x0;var _0x3561d4=_0xd943[_0x5aff28];return _0x3561d4;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'body':{'type':Sequelize[_0x3d94('0x2')](_0x3d94('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x3d94('0x4'))},'read':{'type':Sequelize[_0x3d94('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3d94('0x6')]('in',_0x3d94('0x7')),'defaultValue':_0x3d94('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3d94('0x8')](0x1fe)},'from':{'type':Sequelize[_0x3d94('0x8')]},'to':{'type':Sequelize[_0x3d94('0x2')](_0x3d94('0x3'))},'cc':{'type':Sequelize[_0x3d94('0x2')](_0x3d94('0x3'))},'bcc':{'type':Sequelize[_0x3d94('0x2')](_0x3d94('0x3'))},'subject':{'type':Sequelize[_0x3d94('0x2')]},'sentAt':{'type':Sequelize[_0x3d94('0x9')]},'attach':{'type':Sequelize[_0x3d94('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3d94('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3d94('0x9')]},'originTo':{'type':Sequelize[_0x3d94('0x2')](_0x3d94('0x3'))},'originCc':{'type':Sequelize[_0x3d94('0x2')]('long')},'originChannel':{'type':Sequelize[_0x3d94('0x6')](_0x3d94('0xb'),'Chat'),'defaultValue':_0x3d94('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xa456=['INTEGER','Email','Chat','sequelize','lodash','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa456,0x1d7));var _0x6a45=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xa456[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require(_0x6a45('0x0'));var _=require(_0x6a45('0x1'));module['exports']={'body':{'type':Sequelize[_0x6a45('0x2')](_0x6a45('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6a45('0x2')]('medium')},'read':{'type':Sequelize[_0x6a45('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6a45('0x5')]('in',_0x6a45('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x6a45('0x7')](0x1fe)},'from':{'type':Sequelize[_0x6a45('0x7')]},'to':{'type':Sequelize[_0x6a45('0x2')]('long')},'cc':{'type':Sequelize[_0x6a45('0x2')](_0x6a45('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0x6a45('0x3'))},'subject':{'type':Sequelize[_0x6a45('0x2')]},'sentAt':{'type':Sequelize[_0x6a45('0x8')]},'attach':{'type':Sequelize[_0x6a45('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x6a45('0x2')]('long')},'originCc':{'type':Sequelize[_0x6a45('0x2')](_0x6a45('0x3'))},'originChannel':{'type':Sequelize[_0x6a45('0x5')](_0x6a45('0xa'),_0x6a45('0xb')),'defaultValue':_0x6a45('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e8e4781..a293a4b 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 _0x5764=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','end','stack','name','send','index','map','MailMessage','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','findAll','show','length','include','options','find','body','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','Smtp','isNil','host','port','secure','authentication','auth','pass','service','user','attachments','join','basename','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','get','MailInteraction','read1stAt','interaction','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','agent','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','SELECT','User','fullname','internal','fromString','download','toString','root','server','files','tmp','from','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x5764,0x90));var _0x4576=function(_0x58c74e,_0x2b8753){_0x58c74e=_0x58c74e-0x0;var _0x249d9f=_0x5764[_0x58c74e];return _0x249d9f;};'use strict';var emlformat=require(_0x4576('0x0'));var moment=require(_0x4576('0x1'));var BPromise=require(_0x4576('0x2'));var util=require(_0x4576('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x4576('0x4'));var Redis=require(_0x4576('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x4576('0x6'));var logger=require(_0x4576('0x7'))(_0x4576('0x8'));var interaction_log=require(_0x4576('0x7'))('mail-interactions');var config=require(_0x4576('0x9'));var db=require(_0x4576('0xa'))['db'];config[_0x4576('0xb')]=_[_0x4576('0xc')](config[_0x4576('0xb')],{'host':_0x4576('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4576('0xb')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x4576('0xe'));var client=jayson[_0x4576('0xf')][_0x4576('0x10')]({'port':0x232c});var client9003=jayson[_0x4576('0xf')][_0x4576('0x10')]({'port':0x232b});var client9002=jayson[_0x4576('0xf')][_0x4576('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x59e6f8,_0x3af5a0,_0x33567c,_0x2dff85){return new BPromise(function(_0x29e999,_0x2eb808){var _0xb23980=_0x2dff85||client;return _0xb23980[_0x4576('0x11')](_0x59e6f8,_0x33567c)[_0x4576('0x12')](function(_0x3f412a){logger['info'](_0x4576('0x13'),_0x3af5a0,_0x4576('0x14'));logger[_0x4576('0x15')](_0x4576('0x16'),_0x3af5a0,'request\x20sent',JSON[_0x4576('0x17')](_0x3f412a));if(_0x3f412a[_0x4576('0x18')]){if(_0x3f412a[_0x4576('0x18')][_0x4576('0x19')]===0x1f4){logger[_0x4576('0x18')](_0x4576('0x13'),_0x3af5a0,_0x3f412a[_0x4576('0x18')][_0x4576('0x1a')]);return _0x2eb808(_0x3f412a['error'][_0x4576('0x1a')]);}logger[_0x4576('0x18')](_0x4576('0x13'),_0x3af5a0,_0x3f412a['error']['message']);return _0x29e999(_0x3f412a[_0x4576('0x18')][_0x4576('0x1a')]);}else{logger[_0x4576('0x1b')](_0x4576('0x13'),_0x3af5a0,_0x4576('0x14'));_0x29e999(_0x3f412a[_0x4576('0x1c')][_0x4576('0x1a')]);}})[_0x4576('0x1d')](function(_0x1728ef){logger[_0x4576('0x18')](_0x4576('0x13'),_0x3af5a0,_0x1728ef);_0x2eb808(_0x1728ef);});});}function respondWithResult(_0x2da1f4,_0x346a1f){_0x346a1f=_0x346a1f||0xc8;return function(_0x4b93c1){if(_0x4b93c1){return _0x2da1f4[_0x4576('0x1e')](_0x346a1f)['json'](_0x4b93c1);}};}function respondWithFilteredResult(_0x43f87d,_0x2d10e4){return function(_0x32308d){if(_0x32308d){var _0x1e2c5d=typeof _0x2d10e4[_0x4576('0x1f')]===_0x4576('0x20')&&typeof _0x2d10e4[_0x4576('0x21')]===_0x4576('0x20');var _0x3c83b2=_0x32308d['count'];var _0x3aa66a=_0x1e2c5d?0x0:_0x2d10e4[_0x4576('0x1f')];var _0x549a02=_0x1e2c5d?_0x32308d[_0x4576('0x22')]:_0x2d10e4['offset']+_0x2d10e4['limit'];var _0x559c92;if(_0x549a02>=_0x3c83b2){_0x549a02=_0x3c83b2;_0x559c92=0xc8;}else{_0x559c92=0xce;}_0x43f87d[_0x4576('0x1e')](_0x559c92);return _0x43f87d[_0x4576('0x23')](_0x4576('0x24'),_0x3aa66a+'-'+_0x549a02+'/'+_0x3c83b2)[_0x4576('0x25')](_0x32308d);}return null;};}function saveUpdates(_0x2270d6){return function(_0xe20f0b){if(_0xe20f0b){return _0xe20f0b[_0x4576('0x26')](_0x2270d6)[_0x4576('0x12')](function(_0x4a846d){return _0x4a846d;});}return null;};}function removeEntity(_0x2557f5){return function(_0x41d71e){if(_0x41d71e){return _0x41d71e[_0x4576('0x27')]()[_0x4576('0x12')](function(){_0x2557f5[_0x4576('0x1e')](0xcc)[_0x4576('0x28')]();});}};}function handleEntityNotFound(_0x48efb8){return function(_0x5c3458){if(!_0x5c3458){_0x48efb8['sendStatus'](0x194);}return _0x5c3458;};}function handleError(_0x595a2a,_0x9640ed){_0x9640ed=_0x9640ed||0x1f4;return function(_0x4d1ff8){logger[_0x4576('0x18')](_0x4d1ff8[_0x4576('0x29')]);if(_0x4d1ff8[_0x4576('0x2a')]){delete _0x4d1ff8[_0x4576('0x2a')];}_0x595a2a[_0x4576('0x1e')](_0x9640ed)[_0x4576('0x2b')](_0x4d1ff8);};}exports[_0x4576('0x2c')]=function(_0x59c633,_0x1b670b){var _0x479017={},_0x4ed74e={},_0x25621a={'count':0x0,'rows':[]};var _0x1ad6f5=_[_0x4576('0x2d')](db[_0x4576('0x2e')][_0x4576('0x2f')],function(_0x485aee){return{'name':_0x485aee['fieldName'],'type':_0x485aee['type']['key']};});_0x4ed74e[_0x4576('0x30')]=_[_0x4576('0x2d')](_0x1ad6f5,_0x4576('0x2a'));_0x4ed74e[_0x4576('0x31')]=_[_0x4576('0x32')](_0x59c633['query']);_0x4ed74e[_0x4576('0x33')]=_[_0x4576('0x34')](_0x4ed74e[_0x4576('0x30')],_0x4ed74e[_0x4576('0x31')]);_0x479017[_0x4576('0x35')]=_['intersection'](_0x4ed74e['model'],qs[_0x4576('0x36')](_0x59c633['query'][_0x4576('0x36')]));_0x479017[_0x4576('0x35')]=_0x479017[_0x4576('0x35')]['length']?_0x479017['attributes']:_0x4ed74e[_0x4576('0x30')];if(!_0x59c633['query'][_0x4576('0x37')]('nolimit')){_0x479017[_0x4576('0x21')]=qs[_0x4576('0x21')](_0x59c633[_0x4576('0x31')][_0x4576('0x21')]);_0x479017[_0x4576('0x1f')]=qs[_0x4576('0x1f')](_0x59c633[_0x4576('0x31')][_0x4576('0x1f')]);}_0x479017[_0x4576('0x38')]=qs['sort'](_0x59c633[_0x4576('0x31')][_0x4576('0x39')]);_0x479017[_0x4576('0x3a')]=qs[_0x4576('0x33')](_[_0x4576('0x3b')](_0x59c633[_0x4576('0x31')],_0x4ed74e[_0x4576('0x33')]),_0x1ad6f5);if(_0x59c633['query'][_0x4576('0x3c')]){_0x479017[_0x4576('0x3a')]=_[_0x4576('0x3d')](_0x479017['where'],{'$or':_['map'](_0x1ad6f5,function(_0x14037a){if(_0x14037a[_0x4576('0x3e')]!=='VIRTUAL'){var _0x55aef0={};_0x55aef0[_0x14037a[_0x4576('0x2a')]]={'$like':'%'+_0x59c633['query'][_0x4576('0x3c')]+'%'};return _0x55aef0;}})});}_0x479017=_[_0x4576('0x3d')]({},_0x479017,_0x59c633['options']);var _0x17f71c={'where':_0x479017[_0x4576('0x3a')]};return db[_0x4576('0x2e')][_0x4576('0x22')](_0x17f71c)['then'](function(_0x98016e){_0x25621a[_0x4576('0x22')]=_0x98016e;if(_0x59c633[_0x4576('0x31')][_0x4576('0x3f')]){_0x479017['include']=[{'all':!![]}];}return db[_0x4576('0x2e')][_0x4576('0x40')](_0x479017);})['then'](function(_0x577865){_0x25621a['rows']=_0x577865;return _0x25621a;})['then'](respondWithFilteredResult(_0x1b670b,_0x479017))[_0x4576('0x1d')](handleError(_0x1b670b,null));};exports[_0x4576('0x41')]=function(_0x40a2b4,_0x3171f7){var _0x319cc7={'raw':!![],'where':{'id':_0x40a2b4['params']['id']}},_0x1043dd={};_0x1043dd[_0x4576('0x30')]=_[_0x4576('0x32')](db[_0x4576('0x2e')][_0x4576('0x2f')]);_0x1043dd['query']=_[_0x4576('0x32')](_0x40a2b4[_0x4576('0x31')]);_0x1043dd[_0x4576('0x33')]=_[_0x4576('0x34')](_0x1043dd[_0x4576('0x30')],_0x1043dd[_0x4576('0x31')]);_0x319cc7[_0x4576('0x35')]=_['intersection'](_0x1043dd['model'],qs[_0x4576('0x36')](_0x40a2b4['query'][_0x4576('0x36')]));_0x319cc7['attributes']=_0x319cc7[_0x4576('0x35')][_0x4576('0x42')]?_0x319cc7[_0x4576('0x35')]:_0x1043dd[_0x4576('0x30')];if(_0x40a2b4[_0x4576('0x31')]['includeAll']){_0x319cc7[_0x4576('0x43')]=[{'all':!![]}];}_0x319cc7=_[_0x4576('0x3d')]({},_0x319cc7,_0x40a2b4[_0x4576('0x44')]);return db[_0x4576('0x2e')][_0x4576('0x45')](_0x319cc7)['then'](handleEntityNotFound(_0x3171f7,null))['then'](respondWithResult(_0x3171f7,null))[_0x4576('0x1d')](handleError(_0x3171f7,null));};exports[_0x4576('0x26')]=function(_0x576ead,_0x11a045){if(_0x576ead[_0x4576('0x46')]['id']){delete _0x576ead[_0x4576('0x46')]['id'];}return db['MailMessage'][_0x4576('0x45')]({'where':{'id':_0x576ead['params']['id']}})['then'](handleEntityNotFound(_0x11a045,null))[_0x4576('0x12')](saveUpdates(_0x576ead[_0x4576('0x46')],null))[_0x4576('0x12')](respondWithResult(_0x11a045,null))[_0x4576('0x1d')](handleError(_0x11a045,null));};exports[_0x4576('0x27')]=function(_0x1a24c4,_0x11ad32){return db[_0x4576('0x2e')]['find']({'where':{'id':_0x1a24c4[_0x4576('0x47')]['id']}})[_0x4576('0x12')](handleEntityNotFound(_0x11ad32,null))['then'](removeEntity(_0x11ad32,null))[_0x4576('0x1d')](handleError(_0x11ad32,null));};exports[_0x4576('0x48')]=function(_0x575b25,_0x434c1d){return db['MailMessage'][_0x4576('0x48')]()[_0x4576('0x12')](respondWithResult(_0x434c1d,null))[_0x4576('0x1d')](handleError(_0x434c1d,null));};exports[_0x4576('0x49')]=function(_0x4bb516,_0x115bbf){return db[_0x4576('0x2e')][_0x4576('0x49')](_0x4bb516['body'])['then'](function(_0x3b29d1){if(_0x3b29d1){if(_0x3b29d1[_0x4576('0x4a')]===_0x4576('0x4b')&&!_0x3b29d1[_0x4576('0x4c')]){var _0x52d0fc,_0x305574,_0x1e4425;if(_0x4bb516[_0x4576('0x46')]['to']){_0x305574=_0x4bb516['body']['to'][_0x4576('0x4d')](',')[0x0];}return db[_0x4576('0x4e')][_0x4576('0x4f')]({'where':{'id':_0x3b29d1[_0x4576('0x50')]},'include':[{'model':db[_0x4576('0x51')],'as':_0x4576('0x52'),'include':[{'model':db[_0x4576('0x53')],'as':_0x4576('0x54'),'where':{'email':_0x305574},'limit':0x1,'order':[[_0x4576('0x55'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x4576('0x12')](function(_0x10bc5c){_0x52d0fc=_0x10bc5c;if(_0x52d0fc&&_0x52d0fc[_0x4576('0x56')]){var _0x47273c={'tls':{'rejectUnauthorized':![]}};if(_[_0x4576('0x57')](_0x52d0fc['Smtp']['service'])){_0x47273c[_0x4576('0x58')]=_0x52d0fc[_0x4576('0x56')][_0x4576('0x58')];_0x47273c[_0x4576('0x59')]=_0x52d0fc[_0x4576('0x56')][_0x4576('0x59')];_0x47273c[_0x4576('0x5a')]=_0x52d0fc[_0x4576('0x56')][_0x4576('0x5a')];if(_0x52d0fc[_0x4576('0x56')][_0x4576('0x5b')]){_0x47273c[_0x4576('0x5c')]={'user':_0x52d0fc[_0x4576('0x56')]['user'],'pass':_0x52d0fc[_0x4576('0x56')][_0x4576('0x5d')]};}}else{_0x47273c[_0x4576('0x5e')]=_0x52d0fc['Smtp'][_0x4576('0x5e')];_0x47273c[_0x4576('0x5c')]={'user':_0x52d0fc[_0x4576('0x56')][_0x4576('0x5f')],'pass':_0x52d0fc[_0x4576('0x56')]['pass']};_0x47273c['secure']=_0x52d0fc[_0x4576('0x56')][_0x4576('0x5a')];}if(_0x4bb516[_0x4576('0x46')][_0x4576('0x60')]&&_0x4bb516[_0x4576('0x46')][_0x4576('0x60')][_0x4576('0x42')]){for(var _0x3ec64d=0x0;_0x3ec64d<_0x4bb516['body'][_0x4576('0x60')][_0x4576('0x42')];_0x3ec64d+=0x1){_0x4bb516[_0x4576('0x46')][_0x4576('0x60')][_0x3ec64d]={'filename':_0x4bb516[_0x4576('0x46')][_0x4576('0x60')][_0x3ec64d]['name'],'path':path[_0x4576('0x61')](config['root'],'server/files/attachments',_0x4bb516[_0x4576('0x46')][_0x4576('0x60')][_0x3ec64d][_0x4576('0x62')])};}}_0x1e4425={'account':_0x47273c,'message':_0x4bb516[_0x4576('0x46')]};return;}})[_0x4576('0x12')](function(){if(_0x52d0fc[_0x4576('0x52')]){if(_0x52d0fc[_0x4576('0x52')][_0x4576('0x54')][_0x4576('0x42')]){return _0x52d0fc['List']['Contacts'][0x0];}else{return db[_0x4576('0x53')][_0x4576('0x49')](_[_0x4576('0xc')](_0x4bb516[_0x4576('0x46')],{'firstName':_0x4bb516[_0x4576('0x46')]['to'],'email':_0x4bb516[_0x4576('0x46')]['to'],'phone':_0x4bb516[_0x4576('0x46')]['to'],'ListId':_0x52d0fc[_0x4576('0x63')]}));}}else{throw new Error(_0x4576('0x64'));}})['then'](function(){if(_0x1e4425){return respondWithRpcPromise(_0x4576('0x65'),'sendMail',_0x1e4425,client9003)[_0x4576('0x12')](function(_0xf86877){return _0x3b29d1['update']({'read':!![],'messageId':_0xf86877[_0x4576('0x66')],'sentAt':moment()[_0x4576('0x67')](_0x4576('0x68'))});})[_0x4576('0x1d')](function(_0x2db0dc){logger[_0x4576('0x18')]('%s',JSON[_0x4576('0x17')](_0x2db0dc));return _0x3b29d1;});}return _0x3b29d1;});}return _0x3b29d1;}})[_0x4576('0x12')](respondWithResult(_0x115bbf,0xc9))['catch'](handleError(_0x115bbf,null));};exports[_0x4576('0x69')]=function(_0x597017,_0x5f3a28){var _0x374287={'agent':{},'channel':_0x4576('0x6a')};if(_0x597017[_0x4576('0x46')]['id']){delete _0x597017[_0x4576('0x46')]['id'];}_0x597017[_0x4576('0x46')][_0x4576('0x6b')]=!![];_0x597017[_0x4576('0x46')][_0x4576('0x6c')]=moment()[_0x4576('0x67')](_0x4576('0x68'));_0x597017[_0x4576('0x46')][_0x4576('0x6d')]=_0x597017[_0x4576('0x46')][_0x4576('0x6d')]||_0x597017[_0x4576('0x5f')]['id'];_0x374287['agent']['id']=_0x597017['body'][_0x4576('0x6d')];return db['MailMessage'][_0x4576('0x45')]({'where':{'id':_0x597017['params']['id'],'UserId':null}})[_0x4576('0x12')](handleEntityNotFound(_0x5f3a28,null))['then'](saveUpdates(_0x597017[_0x4576('0x46')],null))[_0x4576('0x12')](function(_0x55f7c1){if(_0x55f7c1){_0x374287[_0x4576('0x1a')]=_0x55f7c1[_0x4576('0x6e')]({'plain':!![]});return db[_0x4576('0x6f')][_0x4576('0x45')]({'where':{'id':_0x55f7c1['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5f3a28,null))['then'](function(_0x3c38f4){if(_0x3c38f4){return _0x3c38f4[_0x4576('0x26')]({'UserId':_0x597017[_0x4576('0x46')][_0x4576('0x6d')],'read1stAt':_[_0x4576('0x57')](_0x3c38f4[_0x4576('0x70')])?moment()[_0x4576('0x67')](_0x4576('0x68')):undefined});}return null;})['then'](function(_0x5b6b14){if(_0x5b6b14){_0x374287[_0x4576('0x71')]=_0x5b6b14['get']({'plain':!![]});interaction_log[_0x4576('0x1b')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x597017[_0x4576('0x5f')]['id'],_0x597017[_0x4576('0x5f')]['name'],_0x597017[_0x4576('0x5f')][_0x4576('0x72')],_0x374287[_0x4576('0x71')]['id'],_0x597017[_0x4576('0x46')]?JSON[_0x4576('0x17')](_0x597017[_0x4576('0x46')]):'null');return respondWithRpcPromise('AcceptMessage',_0x4576('0x73'),_0x374287);}return null;})[_0x4576('0x12')](function(_0x59205f){var _0x4951d6=_0x4576('0x74')+_0x59205f['message'][_0x4576('0x75')];return db['sequelize'][_0x4576('0x31')](_0x4951d6,{'type':db[_0x4576('0x76')][_0x4576('0x77')]['SELECT'],'raw':!![]})[_0x4576('0x12')](function(_0x62da51){return _0x62da51;});})[_0x4576('0x12')](function(_0x2712f8){if(_0x2712f8){_0x374287[_0x4576('0x1a')][_0x4576('0x78')]=_0x2712f8[0x0];if(!_0x597017[_0x4576('0x46')]['UserId'])return;return db['User'][_0x4576('0x45')]({'where':{'id':_0x597017[_0x4576('0x46')]['UserId'],'role':'agent'},'attributes':['id','name','fullname',_0x4576('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x162385){if(!_0x162385)return null;_0x374287[_0x4576('0x1a')]['agent']=_0x162385;return _0x374287;})[_0x4576('0x12')](function(_0x49fad4){if(_0x49fad4){if(_0x597017['body'][_0x4576('0x7a')]){_0x374287[_0x4576('0x1a')][_0x4576('0x7b')]=util[_0x4576('0x67')](_0x4576('0x7c'),_0x597017[_0x4576('0x5f')]['name']);_0x374287['message'][_0x4576('0x7d')]=_0x374287[_0x4576('0x7d')];_0x374287['message'][_0x4576('0x7e')]=_0x374287[_0x4576('0x7d')];_0x374287[_0x4576('0x1a')][_0x4576('0x7f')]='accept';_0x374287[_0x4576('0x1a')][_0x4576('0x46')]=htmlToText['fromString'](_0x374287['message'][_0x4576('0x46')]);return respondWithRpcPromise(_0x4576('0x80'),'EventManager',{'event':'acceptmessage','message':_0x374287[_0x4576('0x1a')]},client9002)[_0x4576('0x12')](function(){return _0x374287;});}return _0x374287;}return null;})[_0x4576('0x12')](respondWithResult(_0x5f3a28,null))[_0x4576('0x1d')](handleError(_0x5f3a28,null));};exports[_0x4576('0x81')]=function(_0x21491b,_0x539a8b){var _0x26232f={'agent':{},'channel':_0x4576('0x6a')};if(_0x21491b['body']['id']){delete _0x21491b[_0x4576('0x46')]['id'];}_0x21491b[_0x4576('0x46')][_0x4576('0x6d')]=_0x21491b[_0x4576('0x46')]['UserId']||_0x21491b[_0x4576('0x5f')]['id'];_0x26232f[_0x4576('0x82')]['id']=_0x21491b['body'][_0x4576('0x6d')];return db['MailMessage']['find']({'where':{'id':_0x21491b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x539a8b,null))[_0x4576('0x12')](function(_0xc7f0b2){if(_0xc7f0b2){_0x26232f['message']=_0xc7f0b2[_0x4576('0x6e')]({'plain':!![]});return db[_0x4576('0x6f')]['find']({'where':{'id':_0xc7f0b2[_0x4576('0x83')]}});}return null;})['then'](handleEntityNotFound(_0x539a8b,null))[_0x4576('0x12')](function(_0x138b29){if(_0x138b29){_0x26232f[_0x4576('0x71')]=_0x138b29[_0x4576('0x6e')]({'plain':!![]});interaction_log[_0x4576('0x1b')](_0x4576('0x84'),_0x21491b[_0x4576('0x5f')]['id'],_0x21491b[_0x4576('0x5f')][_0x4576('0x2a')],_0x21491b[_0x4576('0x5f')][_0x4576('0x72')],_0x26232f[_0x4576('0x71')]['id'],_0x21491b['body']?JSON[_0x4576('0x17')](_0x21491b[_0x4576('0x46')]):_0x4576('0x85'));return respondWithRpcPromise(_0x4576('0x86'),_0x4576('0x87'),_0x26232f);}return null;})['then'](function(_0x34733b){var _0x4df5f5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x34733b[_0x4576('0x1a')][_0x4576('0x75')];return db[_0x4576('0x88')][_0x4576('0x31')](_0x4df5f5,{'type':db[_0x4576('0x76')][_0x4576('0x77')][_0x4576('0x89')],'raw':!![]})[_0x4576('0x12')](function(_0x35127f){return _0x35127f;});})['then'](function(_0x5d70fb){if(_0x5d70fb){_0x26232f[_0x4576('0x1a')]['contact']=_0x5d70fb[0x0];if(!_0x21491b[_0x4576('0x46')][_0x4576('0x6d')])return;return db[_0x4576('0x8a')]['find']({'where':{'id':_0x21491b[_0x4576('0x46')][_0x4576('0x6d')],'role':'agent'},'attributes':['id','name',_0x4576('0x8b'),'email',_0x4576('0x8c')],'raw':!![]});}return null;})[_0x4576('0x12')](function(_0x52a7a0){if(!_0x52a7a0)return null;_0x26232f['message'][_0x4576('0x82')]=_0x52a7a0;return _0x26232f;})['then'](function(_0x14eca0){if(_0x14eca0){_0x14eca0[_0x4576('0x1a')][_0x4576('0x7b')]=util[_0x4576('0x67')]('SIP/%s',_0x21491b[_0x4576('0x5f')][_0x4576('0x2a')]);_0x14eca0['message']['channel']=_0x26232f['channel'];_0x14eca0['message'][_0x4576('0x7e')]=_0x26232f['channel'];_0x14eca0[_0x4576('0x1a')]['event']=_0x4576('0x81');_0x14eca0[_0x4576('0x1a')][_0x4576('0x46')]=htmlToText[_0x4576('0x8d')](_0x26232f[_0x4576('0x1a')][_0x4576('0x46')]);respondWithRpcPromise(_0x4576('0x80'),'EventManager',{'event':'rejectmessage','message':_0x14eca0[_0x4576('0x1a')]},client9002);return _0x26232f;}return null;})[_0x4576('0x12')](respondWithResult(_0x539a8b,null))['catch'](handleError(_0x539a8b,null));};exports[_0x4576('0x8e')]=function(_0x3cc361,_0xafab7c){var _0x5c33b8=moment()['unix']()[_0x4576('0x8f')]();var _0x1f8c77=path['join'](config[_0x4576('0x90')],_0x4576('0x91'),_0x4576('0x92'),_0x4576('0x93'));var _0x3d906f=path[_0x4576('0x61')](config['root'],_0x4576('0x91'),_0x4576('0x92'),'attachments');var _0x4617ea=util['format']('message-%s.eml',_0x5c33b8);return db[_0x4576('0x2e')][_0x4576('0x45')]({'where':{'id':_0x3cc361[_0x4576('0x47')]['id']},'attributes':['id',_0x4576('0x46'),_0x4576('0x94'),'to','cc','bcc',_0x4576('0x95'),_0x4576('0x96')],'include':_0x3cc361[_0x4576('0x31')][_0x4576('0x60')]?[{'model':db[_0x4576('0x97')],'as':_0x4576('0x98')}]:undefined})[_0x4576('0x12')](handleEntityNotFound(_0xafab7c,null))['then'](function(_0x13e387){if(_0x13e387){var _0x531731=_0x13e387;var _0xb4a035={'from':_0x531731[_0x4576('0x94')],'to':_0x531731['to'],'subject':_0x531731[_0x4576('0x95')],'html':_0x531731[_0x4576('0x46')],'headers':{'Date':moment(_0x531731[_0x4576('0x96')])['format'](_0x4576('0x99'))},'attachments':[]};if(_0x13e387['cc']){_0xb4a035[_0x4576('0x9a')]['Cc']=_0x13e387['cc'];}if(_0x13e387[_0x4576('0x9b')]){_0xb4a035[_0x4576('0x9a')]['Bcc']=_0x13e387[_0x4576('0x9b')];}return new BPromise(function(_0x35ff49,_0x1e1af1){if(_0x13e387[_0x4576('0x98')]){for(var _0x1eaa0e=0x0;_0x1eaa0e<_0x13e387[_0x4576('0x98')]['length'];_0x1eaa0e++){var _0x33bb06=_0x13e387[_0x4576('0x98')][_0x1eaa0e];var _0x5efc30=path[_0x4576('0x61')](_0x3d906f,_0x33bb06['basename']);if(fs[_0x4576('0x9c')](_0x5efc30)){_0xb4a035[_0x4576('0x60')][_0x4576('0x9d')]({'name':_0x33bb06[_0x4576('0x2a')],'contentType':_0x33bb06[_0x4576('0x3e')],'data':fs['readFileSync'](_0x5efc30)});}}}emlformat[_0x4576('0x9e')](_0xb4a035,function(_0x518a90,_0x355f02){if(_0x518a90)return _0x1e1af1(_0x518a90);fs[_0x4576('0x9f')](path[_0x4576('0x61')](_0x1f8c77,_0x4617ea),_0x355f02);return _0x35ff49(_0x355f02);});});}})[_0x4576('0x12')](function(_0x422386){if(_0x422386){return _0xafab7c['download'](path['join'](_0x1f8c77,_0x4617ea),_0x4617ea,function(_0x17c184){if(!_0x17c184)fs[_0x4576('0xa0')](path[_0x4576('0x61')](_0x1f8c77,_0x4617ea));});}})[_0x4576('0x1d')](handleError(_0xafab7c,null));}; \ No newline at end of file +var _0x1bce=['type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','include','find','update','body','describe','create','direction','secret','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','DESC','Smtp','isNil','service','host','secure','authentication','user','pass','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','MailInteraction','MailInteractionId','read1stAt','interaction','get','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','internal','manual','SIP/%s','channel','fromString','EventManager','acceptmessage','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','ContactId','Sequelize','contact','fullname','interface','motionChannel','event','reject','rejectmessage','unix','files','server','message-%s.eml','bcc','createdAt','Attachments','from','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','writeFileSync','download','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','json','offset','undefined','limit','count','set','destroy','then','status','end','stack','name','send','MailMessage','rawAttributes','fieldName'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x1bce,0x73));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xe1bc('0x0'));var moment=require(_0xe1bc('0x1'));var BPromise=require('bluebird');var util=require(_0xe1bc('0x2'));var path=require(_0xe1bc('0x3'));var fs=require('fs');var _=require(_0xe1bc('0x4'));var Redis=require(_0xe1bc('0x5'));var htmlToText=require(_0xe1bc('0x6'));var qs=require(_0xe1bc('0x7'));var logger=require(_0xe1bc('0x8'))(_0xe1bc('0x9'));var interaction_log=require(_0xe1bc('0x8'))('mail-interactions');var config=require('../../config/environment');var db=require(_0xe1bc('0xa'))['db'];config[_0xe1bc('0xb')]=_[_0xe1bc('0xc')](config[_0xe1bc('0xb')],{'host':_0xe1bc('0xd'),'port':0x18eb});var socket=require(_0xe1bc('0xe'))(new Redis(config['redis']));require(_0xe1bc('0xf'))['register'](socket);var jayson=require(_0xe1bc('0x10'));var client=jayson[_0xe1bc('0x11')][_0xe1bc('0x12')]({'port':0x232c});var client9003=jayson['client'][_0xe1bc('0x12')]({'port':0x232b});var client9002=jayson[_0xe1bc('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44a556,_0x10ebf6,_0x52d945,_0x5c8b9f){return new BPromise(function(_0xdb61b,_0xc89560){var _0x280679=_0x5c8b9f||client;return _0x280679['request'](_0x44a556,_0x52d945)['then'](function(_0x161955){logger[_0xe1bc('0x13')](_0xe1bc('0x14'),_0x10ebf6,'request\x20sent');logger[_0xe1bc('0x15')](_0xe1bc('0x16'),_0x10ebf6,_0xe1bc('0x17'),JSON[_0xe1bc('0x18')](_0x161955));if(_0x161955['error']){if(_0x161955[_0xe1bc('0x19')]['code']===0x1f4){logger[_0xe1bc('0x19')](_0xe1bc('0x14'),_0x10ebf6,_0x161955['error'][_0xe1bc('0x1a')]);return _0xc89560(_0x161955[_0xe1bc('0x19')][_0xe1bc('0x1a')]);}logger[_0xe1bc('0x19')](_0xe1bc('0x14'),_0x10ebf6,_0x161955[_0xe1bc('0x19')]['message']);return _0xdb61b(_0x161955[_0xe1bc('0x19')]['message']);}else{logger[_0xe1bc('0x13')](_0xe1bc('0x14'),_0x10ebf6,_0xe1bc('0x17'));_0xdb61b(_0x161955[_0xe1bc('0x1b')][_0xe1bc('0x1a')]);}})['catch'](function(_0x313b16){logger['error']('MailMessage,\x20%s,\x20%s',_0x10ebf6,_0x313b16);_0xc89560(_0x313b16);});});}function respondWithResult(_0x3a5f82,_0x2a999c){_0x2a999c=_0x2a999c||0xc8;return function(_0x5cc42d){if(_0x5cc42d){return _0x3a5f82['status'](_0x2a999c)[_0xe1bc('0x1c')](_0x5cc42d);}};}function respondWithFilteredResult(_0x7a8e22,_0x26582e){return function(_0x126ae3){if(_0x126ae3){var _0x229b43=typeof _0x26582e[_0xe1bc('0x1d')]===_0xe1bc('0x1e')&&typeof _0x26582e[_0xe1bc('0x1f')]===_0xe1bc('0x1e');var _0x16631e=_0x126ae3[_0xe1bc('0x20')];var _0x3d1946=_0x229b43?0x0:_0x26582e[_0xe1bc('0x1d')];var _0x584622=_0x229b43?_0x126ae3['count']:_0x26582e[_0xe1bc('0x1d')]+_0x26582e['limit'];var _0x43527d;if(_0x584622>=_0x16631e){_0x584622=_0x16631e;_0x43527d=0xc8;}else{_0x43527d=0xce;}_0x7a8e22['status'](_0x43527d);return _0x7a8e22[_0xe1bc('0x21')]('Content-Range',_0x3d1946+'-'+_0x584622+'/'+_0x16631e)['json'](_0x126ae3);}return null;};}function saveUpdates(_0x2fdb27){return function(_0x3958a4){if(_0x3958a4){return _0x3958a4['update'](_0x2fdb27)['then'](function(_0x39017e){return _0x39017e;});}return null;};}function removeEntity(_0x23caa1){return function(_0x345da1){if(_0x345da1){return _0x345da1[_0xe1bc('0x22')]()[_0xe1bc('0x23')](function(){_0x23caa1[_0xe1bc('0x24')](0xcc)[_0xe1bc('0x25')]();});}};}function handleEntityNotFound(_0x32194a){return function(_0x32bedb){if(!_0x32bedb){_0x32194a['sendStatus'](0x194);}return _0x32bedb;};}function handleError(_0x3bfd38,_0x1eaa77){_0x1eaa77=_0x1eaa77||0x1f4;return function(_0x2033b7){logger['error'](_0x2033b7[_0xe1bc('0x26')]);if(_0x2033b7[_0xe1bc('0x27')]){delete _0x2033b7[_0xe1bc('0x27')];}_0x3bfd38[_0xe1bc('0x24')](_0x1eaa77)[_0xe1bc('0x28')](_0x2033b7);};}exports['index']=function(_0x31c738,_0x479830){var _0x5bf7b9={},_0x1e909e={},_0x40a602={'count':0x0,'rows':[]};var _0xe9c711=_['map'](db[_0xe1bc('0x29')][_0xe1bc('0x2a')],function(_0x4e6d8d){return{'name':_0x4e6d8d[_0xe1bc('0x2b')],'type':_0x4e6d8d[_0xe1bc('0x2c')][_0xe1bc('0x2d')]};});_0x1e909e[_0xe1bc('0x2e')]=_[_0xe1bc('0x2f')](_0xe9c711,_0xe1bc('0x27'));_0x1e909e['query']=_[_0xe1bc('0x30')](_0x31c738[_0xe1bc('0x31')]);_0x1e909e['filters']=_[_0xe1bc('0x32')](_0x1e909e['model'],_0x1e909e[_0xe1bc('0x31')]);_0x5bf7b9[_0xe1bc('0x33')]=_[_0xe1bc('0x32')](_0x1e909e[_0xe1bc('0x2e')],qs['fields'](_0x31c738[_0xe1bc('0x31')][_0xe1bc('0x34')]));_0x5bf7b9[_0xe1bc('0x33')]=_0x5bf7b9[_0xe1bc('0x33')][_0xe1bc('0x35')]?_0x5bf7b9[_0xe1bc('0x33')]:_0x1e909e[_0xe1bc('0x2e')];if(!_0x31c738[_0xe1bc('0x31')][_0xe1bc('0x36')](_0xe1bc('0x37'))){_0x5bf7b9[_0xe1bc('0x1f')]=qs[_0xe1bc('0x1f')](_0x31c738[_0xe1bc('0x31')][_0xe1bc('0x1f')]);_0x5bf7b9['offset']=qs[_0xe1bc('0x1d')](_0x31c738[_0xe1bc('0x31')]['offset']);}_0x5bf7b9[_0xe1bc('0x38')]=qs['sort'](_0x31c738[_0xe1bc('0x31')][_0xe1bc('0x39')]);_0x5bf7b9[_0xe1bc('0x3a')]=qs[_0xe1bc('0x3b')](_[_0xe1bc('0x3c')](_0x31c738['query'],_0x1e909e['filters']),_0xe9c711);if(_0x31c738[_0xe1bc('0x31')][_0xe1bc('0x3d')]){_0x5bf7b9[_0xe1bc('0x3a')]=_[_0xe1bc('0x3e')](_0x5bf7b9[_0xe1bc('0x3a')],{'$or':_[_0xe1bc('0x2f')](_0xe9c711,function(_0x4e1479){if(_0x4e1479[_0xe1bc('0x2c')]!==_0xe1bc('0x3f')){var _0x195664={};_0x195664[_0x4e1479['name']]={'$like':'%'+_0x31c738[_0xe1bc('0x31')]['filter']+'%'};return _0x195664;}})});}_0x5bf7b9=_[_0xe1bc('0x3e')]({},_0x5bf7b9,_0x31c738[_0xe1bc('0x40')]);var _0x42b55f={'where':_0x5bf7b9['where']};return db[_0xe1bc('0x29')][_0xe1bc('0x20')](_0x42b55f)[_0xe1bc('0x23')](function(_0x59be59){_0x40a602[_0xe1bc('0x20')]=_0x59be59;if(_0x31c738['query']['includeAll']){_0x5bf7b9['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x5bf7b9);})['then'](function(_0x1a51bc){_0x40a602[_0xe1bc('0x41')]=_0x1a51bc;return _0x40a602;})[_0xe1bc('0x23')](respondWithFilteredResult(_0x479830,_0x5bf7b9))[_0xe1bc('0x42')](handleError(_0x479830,null));};exports[_0xe1bc('0x43')]=function(_0x243277,_0x47b1b8){var _0x15c01a={'raw':!![],'where':{'id':_0x243277[_0xe1bc('0x44')]['id']}},_0x35aa23={};_0x35aa23[_0xe1bc('0x2e')]=_[_0xe1bc('0x30')](db['MailMessage'][_0xe1bc('0x2a')]);_0x35aa23[_0xe1bc('0x31')]=_['keys'](_0x243277[_0xe1bc('0x31')]);_0x35aa23[_0xe1bc('0x3b')]=_['intersection'](_0x35aa23[_0xe1bc('0x2e')],_0x35aa23['query']);_0x15c01a[_0xe1bc('0x33')]=_['intersection'](_0x35aa23['model'],qs[_0xe1bc('0x34')](_0x243277[_0xe1bc('0x31')][_0xe1bc('0x34')]));_0x15c01a[_0xe1bc('0x33')]=_0x15c01a[_0xe1bc('0x33')][_0xe1bc('0x35')]?_0x15c01a['attributes']:_0x35aa23[_0xe1bc('0x2e')];if(_0x243277[_0xe1bc('0x31')]['includeAll']){_0x15c01a[_0xe1bc('0x45')]=[{'all':!![]}];}_0x15c01a=_['merge']({},_0x15c01a,_0x243277[_0xe1bc('0x40')]);return db['MailMessage'][_0xe1bc('0x46')](_0x15c01a)[_0xe1bc('0x23')](handleEntityNotFound(_0x47b1b8,null))[_0xe1bc('0x23')](respondWithResult(_0x47b1b8,null))['catch'](handleError(_0x47b1b8,null));};exports[_0xe1bc('0x47')]=function(_0x5161c5,_0x12a2f8){if(_0x5161c5[_0xe1bc('0x48')]['id']){delete _0x5161c5[_0xe1bc('0x48')]['id'];}return db['MailMessage'][_0xe1bc('0x46')]({'where':{'id':_0x5161c5['params']['id']}})[_0xe1bc('0x23')](handleEntityNotFound(_0x12a2f8,null))[_0xe1bc('0x23')](saveUpdates(_0x5161c5['body'],null))[_0xe1bc('0x23')](respondWithResult(_0x12a2f8,null))['catch'](handleError(_0x12a2f8,null));};exports[_0xe1bc('0x22')]=function(_0x1c3b9c,_0x486299){return db[_0xe1bc('0x29')][_0xe1bc('0x46')]({'where':{'id':_0x1c3b9c[_0xe1bc('0x44')]['id']}})[_0xe1bc('0x23')](handleEntityNotFound(_0x486299,null))[_0xe1bc('0x23')](removeEntity(_0x486299,null))[_0xe1bc('0x42')](handleError(_0x486299,null));};exports[_0xe1bc('0x49')]=function(_0x1ce3ed,_0x3edfb0){return db['MailMessage']['describe']()[_0xe1bc('0x23')](respondWithResult(_0x3edfb0,null))[_0xe1bc('0x42')](handleError(_0x3edfb0,null));};exports[_0xe1bc('0x4a')]=function(_0x3ed3ef,_0x29e09b){return db[_0xe1bc('0x29')]['create'](_0x3ed3ef[_0xe1bc('0x48')])[_0xe1bc('0x23')](function(_0x2f5fbe){if(_0x2f5fbe){if(_0x2f5fbe[_0xe1bc('0x4b')]==='out'&&!_0x2f5fbe[_0xe1bc('0x4c')]){var _0x262947,_0x23fc1a,_0x84c493;if(_0x3ed3ef['body']['to']){_0x23fc1a=_0x3ed3ef[_0xe1bc('0x48')]['to']['split'](',')[0x0];}return db[_0xe1bc('0x4d')]['findOne']({'where':{'id':_0x2f5fbe[_0xe1bc('0x4e')]},'include':[{'model':db[_0xe1bc('0x4f')],'as':_0xe1bc('0x50'),'include':[{'model':db[_0xe1bc('0x51')],'as':_0xe1bc('0x52'),'where':{'email':_0x23fc1a},'limit':0x1,'order':[['updatedAt',_0xe1bc('0x53')]]}]},{'model':db['MailServerOut'],'as':_0xe1bc('0x54'),'raw':!![]}]})[_0xe1bc('0x23')](function(_0x37ac07){_0x262947=_0x37ac07;if(_0x262947&&_0x262947[_0xe1bc('0x54')]){var _0x417d1f={'tls':{'rejectUnauthorized':![]}};if(_[_0xe1bc('0x55')](_0x262947[_0xe1bc('0x54')][_0xe1bc('0x56')])){_0x417d1f[_0xe1bc('0x57')]=_0x262947[_0xe1bc('0x54')][_0xe1bc('0x57')];_0x417d1f['port']=_0x262947[_0xe1bc('0x54')]['port'];_0x417d1f[_0xe1bc('0x58')]=_0x262947[_0xe1bc('0x54')][_0xe1bc('0x58')];if(_0x262947[_0xe1bc('0x54')][_0xe1bc('0x59')]){_0x417d1f['auth']={'user':_0x262947[_0xe1bc('0x54')][_0xe1bc('0x5a')],'pass':_0x262947[_0xe1bc('0x54')][_0xe1bc('0x5b')]};}}else{_0x417d1f[_0xe1bc('0x56')]=_0x262947[_0xe1bc('0x54')][_0xe1bc('0x56')];_0x417d1f['auth']={'user':_0x262947[_0xe1bc('0x54')][_0xe1bc('0x5a')],'pass':_0x262947['Smtp'][_0xe1bc('0x5b')]};_0x417d1f[_0xe1bc('0x58')]=_0x262947['Smtp']['secure'];}if(_0x3ed3ef[_0xe1bc('0x48')][_0xe1bc('0x5c')]&&_0x3ed3ef[_0xe1bc('0x48')][_0xe1bc('0x5c')]['length']){for(var _0xb4e7ad=0x0;_0xb4e7ad<_0x3ed3ef[_0xe1bc('0x48')][_0xe1bc('0x5c')][_0xe1bc('0x35')];_0xb4e7ad+=0x1){_0x3ed3ef[_0xe1bc('0x48')][_0xe1bc('0x5c')][_0xb4e7ad]={'filename':_0x3ed3ef['body'][_0xe1bc('0x5c')][_0xb4e7ad][_0xe1bc('0x27')],'path':path[_0xe1bc('0x5d')](config[_0xe1bc('0x5e')],_0xe1bc('0x5f'),_0x3ed3ef[_0xe1bc('0x48')][_0xe1bc('0x5c')][_0xb4e7ad][_0xe1bc('0x60')])};}}_0x84c493={'account':_0x417d1f,'message':_0x3ed3ef[_0xe1bc('0x48')]};return;}})['then'](function(){if(_0x262947[_0xe1bc('0x50')]){if(_0x262947[_0xe1bc('0x50')]['Contacts']['length']){return _0x262947[_0xe1bc('0x50')][_0xe1bc('0x52')][0x0];}else{return db[_0xe1bc('0x51')]['create'](_['defaults'](_0x3ed3ef[_0xe1bc('0x48')],{'firstName':_0x3ed3ef[_0xe1bc('0x48')]['to'],'email':_0x3ed3ef[_0xe1bc('0x48')]['to'],'phone':_0x3ed3ef['body']['to'],'ListId':_0x262947[_0xe1bc('0x61')]}));}}else{throw new Error(_0xe1bc('0x62'));}})[_0xe1bc('0x23')](function(){if(_0x84c493){return respondWithRpcPromise(_0xe1bc('0x63'),_0xe1bc('0x64'),_0x84c493,client9003)['then'](function(_0x3102f3){return _0x2f5fbe[_0xe1bc('0x47')]({'read':!![],'messageId':_0x3102f3[_0xe1bc('0x65')],'sentAt':moment()[_0xe1bc('0x66')](_0xe1bc('0x67'))});})[_0xe1bc('0x42')](function(_0x54c3f8){logger[_0xe1bc('0x19')]('%s',JSON[_0xe1bc('0x18')](_0x54c3f8));return _0x2f5fbe;});}return _0x2f5fbe;});}return _0x2f5fbe;}})['then'](respondWithResult(_0x29e09b,0xc9))[_0xe1bc('0x42')](handleError(_0x29e09b,null));};exports[_0xe1bc('0x68')]=function(_0x362eed,_0x5be095){var _0x3c4ef0={'agent':{},'channel':'mail'};if(_0x362eed[_0xe1bc('0x48')]['id']){delete _0x362eed[_0xe1bc('0x48')]['id'];}_0x362eed[_0xe1bc('0x48')][_0xe1bc('0x69')]=!![];_0x362eed[_0xe1bc('0x48')][_0xe1bc('0x6a')]=moment()[_0xe1bc('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x362eed[_0xe1bc('0x48')]['UserId']=_0x362eed['body'][_0xe1bc('0x6b')]||_0x362eed[_0xe1bc('0x5a')]['id'];_0x3c4ef0[_0xe1bc('0x6c')]['id']=_0x362eed[_0xe1bc('0x48')][_0xe1bc('0x6b')];return db['MailMessage'][_0xe1bc('0x46')]({'where':{'id':_0x362eed['params']['id'],'UserId':null}})[_0xe1bc('0x23')](handleEntityNotFound(_0x5be095,null))[_0xe1bc('0x23')](saveUpdates(_0x362eed[_0xe1bc('0x48')],null))[_0xe1bc('0x23')](function(_0x5ddc8f){if(_0x5ddc8f){_0x3c4ef0[_0xe1bc('0x1a')]=_0x5ddc8f['get']({'plain':!![]});return db[_0xe1bc('0x6d')][_0xe1bc('0x46')]({'where':{'id':_0x5ddc8f[_0xe1bc('0x6e')]}});}return null;})[_0xe1bc('0x23')](handleEntityNotFound(_0x5be095,null))[_0xe1bc('0x23')](function(_0x2a17ed){if(_0x2a17ed){return _0x2a17ed['update']({'UserId':_0x362eed[_0xe1bc('0x48')][_0xe1bc('0x6b')],'read1stAt':_['isNil'](_0x2a17ed[_0xe1bc('0x6f')])?moment()[_0xe1bc('0x66')](_0xe1bc('0x67')):undefined});}return null;})[_0xe1bc('0x23')](function(_0x3b5182){if(_0x3b5182){_0x3c4ef0[_0xe1bc('0x70')]=_0x3b5182[_0xe1bc('0x71')]({'plain':!![]});interaction_log[_0xe1bc('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x362eed[_0xe1bc('0x5a')]['id'],_0x362eed[_0xe1bc('0x5a')][_0xe1bc('0x27')],_0x362eed[_0xe1bc('0x5a')]['role'],_0x3c4ef0[_0xe1bc('0x70')]['id'],_0x362eed['body']?JSON['stringify'](_0x362eed[_0xe1bc('0x48')]):'null');return respondWithRpcPromise(_0xe1bc('0x72'),_0xe1bc('0x73'),_0x3c4ef0);}return null;})[_0xe1bc('0x23')](function(_0x5ca520){var _0xb88d5d=_0xe1bc('0x74')+_0x5ca520[_0xe1bc('0x1a')]['ContactId'];return db[_0xe1bc('0x75')]['query'](_0xb88d5d,{'type':db['Sequelize'][_0xe1bc('0x76')][_0xe1bc('0x77')],'raw':!![]})['then'](function(_0x3014fb){return _0x3014fb;});})[_0xe1bc('0x23')](function(_0x5b5dd5){if(_0x5b5dd5){_0x3c4ef0['message']['contact']=_0x5b5dd5[0x0];if(!_0x362eed['body'][_0xe1bc('0x6b')])return;return db[_0xe1bc('0x78')][_0xe1bc('0x46')]({'where':{'id':_0x362eed['body'][_0xe1bc('0x6b')],'role':_0xe1bc('0x6c')},'attributes':['id',_0xe1bc('0x27'),'fullname','email',_0xe1bc('0x79')],'raw':!![]});}return null;})[_0xe1bc('0x23')](function(_0xa34b2c){if(!_0xa34b2c)return null;_0x3c4ef0[_0xe1bc('0x1a')]['agent']=_0xa34b2c;return _0x3c4ef0;})[_0xe1bc('0x23')](function(_0x183257){if(_0x183257){if(_0x362eed['body'][_0xe1bc('0x7a')]){_0x3c4ef0[_0xe1bc('0x1a')]['interface']=util[_0xe1bc('0x66')](_0xe1bc('0x7b'),_0x362eed[_0xe1bc('0x5a')][_0xe1bc('0x27')]);_0x3c4ef0['message'][_0xe1bc('0x7c')]=_0x3c4ef0[_0xe1bc('0x7c')];_0x3c4ef0['message']['motionChannel']=_0x3c4ef0[_0xe1bc('0x7c')];_0x3c4ef0[_0xe1bc('0x1a')]['event']=_0xe1bc('0x68');_0x3c4ef0[_0xe1bc('0x1a')][_0xe1bc('0x48')]=htmlToText[_0xe1bc('0x7d')](_0x3c4ef0[_0xe1bc('0x1a')][_0xe1bc('0x48')]);return respondWithRpcPromise(_0xe1bc('0x7e'),_0xe1bc('0x7e'),{'event':_0xe1bc('0x7f'),'message':_0x3c4ef0[_0xe1bc('0x1a')]},client9002)[_0xe1bc('0x23')](function(){return _0x3c4ef0;});}return _0x3c4ef0;}return null;})['then'](respondWithResult(_0x5be095,null))[_0xe1bc('0x42')](handleError(_0x5be095,null));};exports['reject']=function(_0x4e9496,_0x5e654e){var _0xf7cb22={'agent':{},'channel':_0xe1bc('0x80')};if(_0x4e9496[_0xe1bc('0x48')]['id']){delete _0x4e9496[_0xe1bc('0x48')]['id'];}_0x4e9496[_0xe1bc('0x48')]['UserId']=_0x4e9496[_0xe1bc('0x48')]['UserId']||_0x4e9496[_0xe1bc('0x5a')]['id'];_0xf7cb22[_0xe1bc('0x6c')]['id']=_0x4e9496[_0xe1bc('0x48')]['UserId'];return db[_0xe1bc('0x29')]['find']({'where':{'id':_0x4e9496[_0xe1bc('0x44')]['id'],'UserId':null}})[_0xe1bc('0x23')](handleEntityNotFound(_0x5e654e,null))[_0xe1bc('0x23')](function(_0x2475ef){if(_0x2475ef){_0xf7cb22[_0xe1bc('0x1a')]=_0x2475ef[_0xe1bc('0x71')]({'plain':!![]});return db['MailInteraction'][_0xe1bc('0x46')]({'where':{'id':_0x2475ef[_0xe1bc('0x6e')]}});}return null;})[_0xe1bc('0x23')](handleEntityNotFound(_0x5e654e,null))[_0xe1bc('0x23')](function(_0x3c864f){if(_0x3c864f){_0xf7cb22['interaction']=_0x3c864f['get']({'plain':!![]});interaction_log[_0xe1bc('0x13')](_0xe1bc('0x81'),_0x4e9496['user']['id'],_0x4e9496[_0xe1bc('0x5a')][_0xe1bc('0x27')],_0x4e9496[_0xe1bc('0x5a')][_0xe1bc('0x82')],_0xf7cb22[_0xe1bc('0x70')]['id'],_0x4e9496[_0xe1bc('0x48')]?JSON[_0xe1bc('0x18')](_0x4e9496[_0xe1bc('0x48')]):_0xe1bc('0x83'));return respondWithRpcPromise(_0xe1bc('0x84'),'rejectMessage',_0xf7cb22);}return null;})[_0xe1bc('0x23')](function(_0x522908){var _0x1876d6=_0xe1bc('0x74')+_0x522908['message'][_0xe1bc('0x85')];return db[_0xe1bc('0x75')]['query'](_0x1876d6,{'type':db[_0xe1bc('0x86')][_0xe1bc('0x76')]['SELECT'],'raw':!![]})['then'](function(_0x4b60c1){return _0x4b60c1;});})[_0xe1bc('0x23')](function(_0x12cfe8){if(_0x12cfe8){_0xf7cb22[_0xe1bc('0x1a')][_0xe1bc('0x87')]=_0x12cfe8[0x0];if(!_0x4e9496[_0xe1bc('0x48')][_0xe1bc('0x6b')])return;return db[_0xe1bc('0x78')][_0xe1bc('0x46')]({'where':{'id':_0x4e9496[_0xe1bc('0x48')][_0xe1bc('0x6b')],'role':_0xe1bc('0x6c')},'attributes':['id',_0xe1bc('0x27'),_0xe1bc('0x88'),'email',_0xe1bc('0x79')],'raw':!![]});}return null;})['then'](function(_0x30888a){if(!_0x30888a)return null;_0xf7cb22['message'][_0xe1bc('0x6c')]=_0x30888a;return _0xf7cb22;})[_0xe1bc('0x23')](function(_0x3a643f){if(_0x3a643f){_0x3a643f[_0xe1bc('0x1a')][_0xe1bc('0x89')]=util[_0xe1bc('0x66')]('SIP/%s',_0x4e9496[_0xe1bc('0x5a')][_0xe1bc('0x27')]);_0x3a643f[_0xe1bc('0x1a')][_0xe1bc('0x7c')]=_0xf7cb22[_0xe1bc('0x7c')];_0x3a643f[_0xe1bc('0x1a')][_0xe1bc('0x8a')]=_0xf7cb22[_0xe1bc('0x7c')];_0x3a643f['message'][_0xe1bc('0x8b')]=_0xe1bc('0x8c');_0x3a643f[_0xe1bc('0x1a')]['body']=htmlToText[_0xe1bc('0x7d')](_0xf7cb22[_0xe1bc('0x1a')][_0xe1bc('0x48')]);respondWithRpcPromise(_0xe1bc('0x7e'),'EventManager',{'event':_0xe1bc('0x8d'),'message':_0x3a643f[_0xe1bc('0x1a')]},client9002);return _0xf7cb22;}return null;})[_0xe1bc('0x23')](respondWithResult(_0x5e654e,null))[_0xe1bc('0x42')](handleError(_0x5e654e,null));};exports['download']=function(_0x4f9e1e,_0x17c94d){var _0x1ef810=moment()[_0xe1bc('0x8e')]()['toString']();var _0x3357f8=path['join'](config[_0xe1bc('0x5e')],'server',_0xe1bc('0x8f'),'tmp');var _0x175f78=path[_0xe1bc('0x5d')](config[_0xe1bc('0x5e')],_0xe1bc('0x90'),'files','attachments');var _0xbb406f=util[_0xe1bc('0x66')](_0xe1bc('0x91'),_0x1ef810);return db[_0xe1bc('0x29')][_0xe1bc('0x46')]({'where':{'id':_0x4f9e1e[_0xe1bc('0x44')]['id']},'attributes':['id',_0xe1bc('0x48'),'from','to','cc',_0xe1bc('0x92'),'subject',_0xe1bc('0x93')],'include':_0x4f9e1e[_0xe1bc('0x31')]['attachments']?[{'model':db['Attachment'],'as':_0xe1bc('0x94')}]:undefined})[_0xe1bc('0x23')](handleEntityNotFound(_0x17c94d,null))[_0xe1bc('0x23')](function(_0x565534){if(_0x565534){var _0x581816=_0x565534;var _0x114afa={'from':_0x581816[_0xe1bc('0x95')],'to':_0x581816['to'],'subject':_0x581816[_0xe1bc('0x96')],'html':_0x581816[_0xe1bc('0x48')],'headers':{'Date':moment(_0x581816[_0xe1bc('0x93')])[_0xe1bc('0x66')](_0xe1bc('0x97'))},'attachments':[]};if(_0x565534['cc']){_0x114afa[_0xe1bc('0x98')]['Cc']=_0x565534['cc'];}if(_0x565534[_0xe1bc('0x92')]){_0x114afa[_0xe1bc('0x98')][_0xe1bc('0x99')]=_0x565534[_0xe1bc('0x92')];}return new BPromise(function(_0x4b83f8,_0x4aab09){if(_0x565534[_0xe1bc('0x94')]){for(var _0x489a22=0x0;_0x489a22<_0x565534[_0xe1bc('0x94')]['length'];_0x489a22++){var _0x5f03bc=_0x565534[_0xe1bc('0x94')][_0x489a22];var _0x212e3d=path['join'](_0x175f78,_0x5f03bc[_0xe1bc('0x60')]);if(fs[_0xe1bc('0x9a')](_0x212e3d)){_0x114afa[_0xe1bc('0x5c')]['push']({'name':_0x5f03bc['name'],'contentType':_0x5f03bc[_0xe1bc('0x2c')],'data':fs['readFileSync'](_0x212e3d)});}}}emlformat[_0xe1bc('0x9b')](_0x114afa,function(_0x3a11f3,_0x3b2c92){if(_0x3a11f3)return _0x4aab09(_0x3a11f3);fs[_0xe1bc('0x9c')](path[_0xe1bc('0x5d')](_0x3357f8,_0xbb406f),_0x3b2c92);return _0x4b83f8(_0x3b2c92);});});}})['then'](function(_0x20eb78){if(_0x20eb78){return _0x17c94d[_0xe1bc('0x9d')](path[_0xe1bc('0x5d')](_0x3357f8,_0xbb406f),_0xbb406f,function(_0x4ac7ca){if(!_0x4ac7ca)fs[_0xe1bc('0x9e')](path['join'](_0x3357f8,_0xbb406f));});}})[_0xe1bc('0x42')](handleError(_0x17c94d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 401a22a..4a3eb97 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 _0xf0ff=['hook','exports','../../mysqldb','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x133eb2,_0x400170){var _0x56e4d3=function(_0x10498e){while(--_0x10498e){_0x133eb2['push'](_0x133eb2['shift']());}};_0x56e4d3(++_0x400170);}(_0xf0ff,0x1e8));var _0xff0f=function(_0x1ccf33,_0x51cec9){_0x1ccf33=_0x1ccf33-0x0;var _0x2698ce=_0xf0ff[_0x1ccf33];return _0x2698ce;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xff0f('0x0'))['db'][_0xff0f('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xff0f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xff0f('0x3'),'afterDestroy':_0xff0f('0x4')};function emitEvent(_0x15dd9d){return function(_0xf8895f,_0x5d8c1d,_0x2af773){MailMessageEvents[_0xff0f('0x5')](_0x15dd9d+':'+_0xf8895f['id'],_0xf8895f);MailMessageEvents[_0xff0f('0x5')](_0x15dd9d,_0xf8895f);_0x2af773(null);};}for(var e in events){if(events[_0xff0f('0x6')](e)){var event=events[e];MailMessage[_0xff0f('0x7')](e,emitEvent(event));}}module[_0xff0f('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xaca0=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hook'];(function(_0x5b5f81,_0xb86687){var _0x1e0e32=function(_0x1acba4){while(--_0x1acba4){_0x5b5f81['push'](_0x5b5f81['shift']());}};_0x1e0e32(++_0xb86687);}(_0xaca0,0x19f));var _0x0aca=function(_0x91b128,_0x412ea5){_0x91b128=_0x91b128-0x0;var _0x23a1f3=_0xaca0[_0x91b128];return _0x23a1f3;};'use strict';var EventEmitter=require(_0x0aca('0x0'));var MailMessage=require(_0x0aca('0x1'))['db'][_0x0aca('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0aca('0x3')](0x0);var events={'afterCreate':_0x0aca('0x4'),'afterUpdate':'update','afterDestroy':_0x0aca('0x5')};function emitEvent(_0x3b6154){return function(_0x2d5ae9,_0x480562,_0x43b89e){MailMessageEvents['emit'](_0x3b6154+':'+_0x2d5ae9['id'],_0x2d5ae9);MailMessageEvents[_0x0aca('0x6')](_0x3b6154,_0x2d5ae9);_0x43b89e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x0aca('0x7')](e,emitEvent(event));}}module[_0x0aca('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 7b186c3..7b0987f 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 _0x0586=['rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','messageId','fti_mail_messages','plainBody','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','html-to-text','path'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0x0586,0x1b3));var _0x6058=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0586[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6058('0x0'));var util=require('util');var logger=require(_0x6058('0x1'))(_0x6058('0x2'));var moment=require(_0x6058('0x3'));var BPromise=require('bluebird');var rp=require(_0x6058('0x4'));var htmlToText=require(_0x6058('0x5'));var fs=require('fs');var path=require(_0x6058('0x6'));var rimraf=require(_0x6058('0x7'));var config=require(_0x6058('0x8'));var attributes=require(_0x6058('0x9'));module[_0x6058('0xa')]=function(_0x4ddd68,_0x400e38){return _0x4ddd68['define'](_0x6058('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x6058('0xc'),'fields':[_0x6058('0xc')]},{'name':_0x6058('0xd'),'fields':[_0x6058('0xe'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a6e3f,_0x1ec0f5,_0x4a7c78){if(_0x3a6e3f[_0x6058('0xf')]){_0x3a6e3f[_0x6058('0xe')]=htmlToText[_0x6058('0x10')](_0x3a6e3f[_0x6058('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4a7c78(null,_0x1ec0f5);},'afterCreate':function(_0x97c4c7,_0x173aaf,_0x3485a2){var _0x53feb5=_0x4ddd68[_0x6058('0x11')];var _0x354df9=_0x97c4c7[_0x6058('0x12')]({'plain':!![]});if(_0x354df9[_0x6058('0x13')][_0x6058('0x14')]()==='in'||_0x354df9['direction'][_0x6058('0x14')]()===_0x6058('0x15')&&!_0x354df9[_0x6058('0x16')]&&!_[_0x6058('0x17')](_0x354df9[_0x6058('0x18')])){_0x53feb5[_0x6058('0x19')][_0x6058('0x1a')]({'where':{'id':_0x354df9[_0x6058('0x1b')]}})['then'](function(_0x235e81){if(_0x235e81){_0x235e81[_0x6058('0x1c')]({'lastMsgAt':_0x354df9[_0x6058('0x1d')],'lastMsgDirection':_0x354df9['direction']['toLowerCase']()});}})[_0x6058('0x1e')](function(_0x3d7bac){console[_0x6058('0x1f')](_0x3d7bac);});}_0x3485a2();}},'charset':_0x6058('0x20'),'collate':_0x6058('0x21')});}; \ No newline at end of file +var _0xf9eb=['findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','isNil','UserId'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0xf9eb,0x118));var _0xbf9e=function(_0x4b703b,_0x2a02cb){_0x4b703b=_0x4b703b-0x0;var _0x4d75a7=_0xf9eb[_0x4b703b];return _0x4d75a7;};'use strict';var _=require(_0xbf9e('0x0'));var util=require(_0xbf9e('0x1'));var logger=require('../../config/logger')(_0xbf9e('0x2'));var moment=require(_0xbf9e('0x3'));var BPromise=require(_0xbf9e('0x4'));var rp=require(_0xbf9e('0x5'));var htmlToText=require(_0xbf9e('0x6'));var fs=require('fs');var path=require(_0xbf9e('0x7'));var rimraf=require(_0xbf9e('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf9e('0x9'));module['exports']=function(_0x13b83f,_0x4eb6e7){return _0x13b83f[_0xbf9e('0xa')](_0xbf9e('0xb'),attributes,{'tableName':_0xbf9e('0xc'),'paranoid':![],'indexes':[{'name':_0xbf9e('0xd'),'fields':['messageId']},{'name':_0xbf9e('0xe'),'fields':[_0xbf9e('0xf'),'subject'],'type':_0xbf9e('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1faf24,_0x582914,_0x3622e4){if(_0x1faf24[_0xbf9e('0x11')]){_0x1faf24[_0xbf9e('0xf')]=htmlToText[_0xbf9e('0x12')](_0x1faf24[_0xbf9e('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3622e4(null,_0x582914);},'afterCreate':function(_0x55fd02,_0x335dff,_0x350c11){var _0x8dc531=_0x13b83f[_0xbf9e('0x13')];var _0x20f602=_0x55fd02[_0xbf9e('0x14')]({'plain':!![]});if(_0x20f602[_0xbf9e('0x15')][_0xbf9e('0x16')]()==='in'||_0x20f602[_0xbf9e('0x15')][_0xbf9e('0x16')]()===_0xbf9e('0x17')&&!_0x20f602['secret']&&!_[_0xbf9e('0x18')](_0x20f602[_0xbf9e('0x19')])){_0x8dc531['MailInteraction'][_0xbf9e('0x1a')]({'where':{'id':_0x20f602[_0xbf9e('0x1b')]}})[_0xbf9e('0x1c')](function(_0x2c2f77){if(_0x2c2f77){_0x2c2f77[_0xbf9e('0x1d')]({'lastMsgAt':_0x20f602['createdAt'],'lastMsgDirection':_0x20f602['direction']['toLowerCase']()});}})[_0xbf9e('0x1e')](function(_0x4db023){console[_0xbf9e('0x1f')](_0x4db023);});}_0x350c11();}},'charset':_0xbf9e('0x20'),'collate':_0xbf9e('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 112d7d3..9a9e0ca 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 _0x63a5=['error','message','result','catch','body','options','raw','CreateMailMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5ca698,_0x466e48){var _0x5eaadb=function(_0x1f1754){while(--_0x1f1754){_0x5ca698['push'](_0x5ca698['shift']());}};_0x5eaadb(++_0x466e48);}(_0x63a5,0x18e));var _0x563a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x63a5[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});config[_0x563a('0x9')]=_[_0x563a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x563a('0xb'))(new Redis(config[_0x563a('0x9')]));require(_0x563a('0xc'))[_0x563a('0xd')](socket);function respondWithRpcPromise(_0x255922,_0xa61ffa,_0xd1b480){return new BPromise(function(_0x381fab,_0x3e97a8){return client[_0x563a('0xe')](_0x255922,_0xd1b480)[_0x563a('0xf')](function(_0x2361dd){logger[_0x563a('0x10')](_0x563a('0x11'),_0xa61ffa,'request\x20sent');logger[_0x563a('0x12')](_0x563a('0x13'),_0xa61ffa,_0x563a('0x14'),JSON[_0x563a('0x15')](_0x2361dd));if(_0x2361dd[_0x563a('0x16')]){if(_0x2361dd[_0x563a('0x16')]['code']===0x1f4){logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);return _0x3e97a8(_0x2361dd['error']['message']);}logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd['error'][_0x563a('0x17')]);return _0x381fab(_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);}else{logger[_0x563a('0x10')]('MailMessage,\x20%s,\x20%s',_0xa61ffa,'request\x20sent');_0x381fab(_0x2361dd[_0x563a('0x18')][_0x563a('0x17')]);}})[_0x563a('0x19')](function(_0x526a51){logger['error']('MailMessage,\x20%s,\x20%s',_0xa61ffa,_0x526a51);_0x3e97a8(_0x526a51);});});}exports['CreateMailMessage']=function(_0x40916a){var _0x300956=this;return new Promise(function(_0x26061f,_0x43b7a8){return db['MailMessage']['create'](_0x40916a[_0x563a('0x1a')],{'raw':_0x40916a[_0x563a('0x1b')]?_0x40916a[_0x563a('0x1b')][_0x563a('0x1c')]===undefined?!![]:![]:!![]})[_0x563a('0xf')](function(_0x2dc7e2){logger[_0x563a('0x10')](_0x563a('0x1d'),_0x40916a);logger['debug'](_0x563a('0x1d'),_0x40916a,JSON['stringify'](_0x2dc7e2));_0x26061f(_0x2dc7e2);})[_0x563a('0x19')](function(_0xd3e0ae){logger[_0x563a('0x16')](_0x563a('0x1d'),_0xd3e0ae[_0x563a('0x17')],_0x40916a);_0x43b7a8(_0x300956[_0x563a('0x16')](0x1f4,_0xd3e0ae[_0x563a('0x17')]));});});}; \ No newline at end of file +var _0x4213=['request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4213,0x77));var _0x3421=function(_0x33813c,_0x1fa834){_0x33813c=_0x33813c-0x0;var _0x4e37cf=_0x4213[_0x33813c];return _0x4e37cf;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var moment=require(_0x3421('0x2'));var BPromise=require(_0x3421('0x3'));var rs=require(_0x3421('0x4'));var fs=require('fs');var Redis=require(_0x3421('0x5'));var db=require(_0x3421('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3421('0x7'))('rpc');var config=require(_0x3421('0x8'));var jayson=require(_0x3421('0x9'));var client=jayson[_0x3421('0xa')][_0x3421('0xb')]({'port':0x232a});config['redis']=_[_0x3421('0xc')](config[_0x3421('0xd')],{'host':_0x3421('0xe'),'port':0x18eb});var socket=require(_0x3421('0xf'))(new Redis(config[_0x3421('0xd')]));require('./mailMessage.socket')[_0x3421('0x10')](socket);function respondWithRpcPromise(_0x58d511,_0x4ff986,_0x12eee0){return new BPromise(function(_0x4b9d24,_0x2d8676){return client[_0x3421('0x11')](_0x58d511,_0x12eee0)[_0x3421('0x12')](function(_0x38b521){logger[_0x3421('0x13')](_0x3421('0x14'),_0x4ff986,_0x3421('0x15'));logger['debug'](_0x3421('0x16'),_0x4ff986,_0x3421('0x15'),JSON[_0x3421('0x17')](_0x38b521));if(_0x38b521[_0x3421('0x18')]){if(_0x38b521[_0x3421('0x18')][_0x3421('0x19')]===0x1f4){logger[_0x3421('0x18')]('MailMessage,\x20%s,\x20%s',_0x4ff986,_0x38b521[_0x3421('0x18')]['message']);return _0x2d8676(_0x38b521[_0x3421('0x18')][_0x3421('0x1a')]);}logger['error'](_0x3421('0x14'),_0x4ff986,_0x38b521['error'][_0x3421('0x1a')]);return _0x4b9d24(_0x38b521[_0x3421('0x18')]['message']);}else{logger[_0x3421('0x13')](_0x3421('0x14'),_0x4ff986,_0x3421('0x15'));_0x4b9d24(_0x38b521[_0x3421('0x1b')][_0x3421('0x1a')]);}})[_0x3421('0x1c')](function(_0x3f1b1d){logger[_0x3421('0x18')](_0x3421('0x14'),_0x4ff986,_0x3f1b1d);_0x2d8676(_0x3f1b1d);});});}exports[_0x3421('0x1d')]=function(_0x538a8b){var _0x50d9a5=this;return new Promise(function(_0x420114,_0x4b59a5){return db['MailMessage']['create'](_0x538a8b[_0x3421('0x1e')],{'raw':_0x538a8b[_0x3421('0x1f')]?_0x538a8b[_0x3421('0x1f')][_0x3421('0x20')]===undefined?!![]:![]:!![]})[_0x3421('0x12')](function(_0x39bed4){logger[_0x3421('0x13')](_0x3421('0x1d'),_0x538a8b);logger[_0x3421('0x21')](_0x3421('0x1d'),_0x538a8b,JSON['stringify'](_0x39bed4));_0x420114(_0x39bed4);})['catch'](function(_0x494423){logger[_0x3421('0x18')](_0x3421('0x1d'),_0x494423[_0x3421('0x1a')],_0x538a8b);_0x4b59a5(_0x50d9a5['error'](0x1f4,_0x494423['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 3ea4f8b..68c2827 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 _0xb268=['removeListener','register','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x11692f,_0x1937c1){var _0x2b901a=function(_0x5c3672){while(--_0x5c3672){_0x11692f['push'](_0x11692f['shift']());}};_0x2b901a(++_0x1937c1);}(_0xb268,0x114));var _0x8b26=function(_0x4724e4,_0x36376d){_0x4724e4=_0x4724e4-0x0;var _0x24ca8c=_0xb268[_0x4724e4];return _0x24ca8c;};'use strict';var MailMessageEvents=require(_0x8b26('0x0'));var events=[_0x8b26('0x1'),_0x8b26('0x2'),_0x8b26('0x3')];function createListener(_0x26abf3,_0x30064c){return function(_0x48b88c){_0x30064c['emit'](_0x26abf3,_0x48b88c);};}function removeListener(_0x2fdc64,_0x1667f7){return function(){MailMessageEvents[_0x8b26('0x4')](_0x2fdc64,_0x1667f7);};}exports[_0x8b26('0x5')]=function(_0x2b0249){for(var _0x4fb7d6=0x0,_0x3b7c98=events['length'];_0x4fb7d6<_0x3b7c98;_0x4fb7d6++){var _0x4cca57=events[_0x4fb7d6];var _0x321391=createListener(_0x8b26('0x6')+_0x4cca57,_0x2b0249);MailMessageEvents['on'](_0x4cca57,_0x321391);}}; \ No newline at end of file +var _0xc5b1=['register','length','./mailMessage.events','save','remove'];(function(_0x52b661,_0x4cb8d1){var _0x550a19=function(_0xed32eb){while(--_0xed32eb){_0x52b661['push'](_0x52b661['shift']());}};_0x550a19(++_0x4cb8d1);}(_0xc5b1,0x106));var _0x1c5b=function(_0x5f3dcd,_0x2282c6){_0x5f3dcd=_0x5f3dcd-0x0;var _0x3e7b64=_0xc5b1[_0x5f3dcd];return _0x3e7b64;};'use strict';var MailMessageEvents=require(_0x1c5b('0x0'));var events=[_0x1c5b('0x1'),_0x1c5b('0x2'),'update'];function createListener(_0x50a847,_0x3f74c9){return function(_0x5eb32a){_0x3f74c9['emit'](_0x50a847,_0x5eb32a);};}function removeListener(_0x42d03a,_0x4f4765){return function(){MailMessageEvents['removeListener'](_0x42d03a,_0x4f4765);};}exports[_0x1c5b('0x3')]=function(_0x5501b9){for(var _0x18f991=0x0,_0x39422a=events[_0x1c5b('0x4')];_0x18f991<_0x39422a;_0x18f991++){var _0x3b8538=events[_0x18f991];var _0x41382b=createListener('mailMessage:'+_0x3b8538,_0x5501b9);MailMessageEvents['on'](_0x3b8538,_0x41382b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 83ba046..9291d22 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 _0x62f8=['delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put'];(function(_0x2eee1b,_0x3c7f54){var _0x14a161=function(_0x350047){while(--_0x350047){_0x2eee1b['push'](_0x2eee1b['shift']());}};_0x14a161(++_0x3c7f54);}(_0x62f8,0x18b));var _0x862f=function(_0x98ee00,_0x24a7e1){_0x98ee00=_0x98ee00-0x0;var _0x5e769f=_0x62f8[_0x98ee00];return _0x5e769f;};'use strict';var multer=require(_0x862f('0x0'));var util=require(_0x862f('0x1'));var path=require(_0x862f('0x2'));var timeout=require('connect-timeout');var express=require(_0x862f('0x3'));var router=express[_0x862f('0x4')]();var fs_extra=require(_0x862f('0x5'));var auth=require(_0x862f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x862f('0x7'));var controller=require(_0x862f('0x8'));router[_0x862f('0x9')]('/',auth[_0x862f('0xa')](),controller[_0x862f('0xb')]);router[_0x862f('0x9')](_0x862f('0xc'),auth[_0x862f('0xa')](),controller[_0x862f('0xd')]);router['get'](_0x862f('0xe'),auth[_0x862f('0xa')](),controller[_0x862f('0xf')]);router['get']('/:id/members',auth[_0x862f('0xa')](),controller[_0x862f('0x10')]);router[_0x862f('0x9')]('/:id/teams',auth[_0x862f('0xa')](),controller['getTeams']);router[_0x862f('0x9')](_0x862f('0x11'),auth[_0x862f('0xa')](),controller[_0x862f('0x12')]);router[_0x862f('0x13')]('/',auth['isAuthenticated'](),controller[_0x862f('0x14')]);router[_0x862f('0x13')](_0x862f('0x15'),auth[_0x862f('0xa')](),controller[_0x862f('0x16')]);router[_0x862f('0x13')](_0x862f('0x11'),auth[_0x862f('0xa')](),controller[_0x862f('0x17')]);router[_0x862f('0x18')](_0x862f('0xe'),auth[_0x862f('0xa')](),controller['update']);router[_0x862f('0x19')](_0x862f('0xe'),auth['isAuthenticated'](),controller[_0x862f('0x1a')]);router[_0x862f('0x19')](_0x862f('0x15'),auth[_0x862f('0xa')](),controller[_0x862f('0x1b')]);router[_0x862f('0x19')]('/:id/users',auth[_0x862f('0xa')](),controller[_0x862f('0x1c')]);module[_0x862f('0x1d')]=router; \ No newline at end of file +var _0x82f2=['multer','path','connect-timeout','express','fs-extra','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x82f2,0x129));var _0x282f=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x82f2[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0x282f('0x0'));var util=require('util');var path=require(_0x282f('0x1'));var timeout=require(_0x282f('0x2'));var express=require(_0x282f('0x3'));var router=express['Router']();var fs_extra=require(_0x282f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x282f('0x5'));var controller=require(_0x282f('0x6'));router[_0x282f('0x7')]('/',auth[_0x282f('0x8')](),controller[_0x282f('0x9')]);router['get'](_0x282f('0xa'),auth[_0x282f('0x8')](),controller[_0x282f('0xb')]);router[_0x282f('0x7')](_0x282f('0xc'),auth['isAuthenticated'](),controller[_0x282f('0xd')]);router[_0x282f('0x7')](_0x282f('0xe'),auth[_0x282f('0x8')](),controller[_0x282f('0xf')]);router[_0x282f('0x7')](_0x282f('0x10'),auth['isAuthenticated'](),controller[_0x282f('0x11')]);router[_0x282f('0x7')](_0x282f('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x282f('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x282f('0x13')]('/:id/teams',auth[_0x282f('0x8')](),controller[_0x282f('0x14')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x282f('0x15')]);router[_0x282f('0x16')](_0x282f('0xc'),auth[_0x282f('0x8')](),controller['update']);router[_0x282f('0x17')](_0x282f('0xc'),auth['isAuthenticated'](),controller[_0x282f('0x18')]);router[_0x282f('0x17')](_0x282f('0x10'),auth['isAuthenticated'](),controller[_0x282f('0x19')]);router[_0x282f('0x17')](_0x282f('0x12'),auth[_0x282f('0x8')](),controller[_0x282f('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index de6b7c7..c4f3bc4 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 _0x2222=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x425c0d,_0x35b845){var _0x5e3ab9=function(_0x50e00f){while(--_0x50e00f){_0x425c0d['push'](_0x425c0d['shift']());}};_0x5e3ab9(++_0x35b845);}(_0x2222,0x155));var _0x2222=function(_0x1968e5,_0x105e8f){_0x1968e5=_0x1968e5-0x0;var _0x258c4e=_0x2222[_0x1968e5];return _0x258c4e;};'use strict';var Sequelize=require(_0x2222('0x0'));module[_0x2222('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2222('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2222('0x3')]},'timeout':{'type':Sequelize[_0x2222('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2222('0x5')](_0x2222('0x6'),_0x2222('0x7'),_0x2222('0x8'))}}; \ No newline at end of file +var _0xe440=['rrmemory','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x3e8cd1,_0x4b5aa8){var _0x2aeb1b=function(_0x39b86b){while(--_0x39b86b){_0x3e8cd1['push'](_0x3e8cd1['shift']());}};_0x2aeb1b(++_0x4b5aa8);}(_0xe440,0x14b));var _0x0e44=function(_0x456406,_0x17a3c1){_0x456406=_0x456406-0x0;var _0x681a69=_0xe440[_0x456406];return _0x681a69;};'use strict';var Sequelize=require('sequelize');module[_0x0e44('0x0')]={'name':{'type':Sequelize[_0x0e44('0x1')],'unique':_0x0e44('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0e44('0x1')]},'timeout':{'type':Sequelize[_0x0e44('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0e44('0x4')](_0x0e44('0x5'),'beepall',_0x0e44('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 34739a5..6843acc 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 _0x074f=['QueryTypes','TeamId','all','union','value','transaction','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','get','MailQueues','UserProfileResource','destroy','error','name','send','index','map','MailQueue','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options','find','body','user','UserProfileSection','userProfileId','autoAssociation','describe','findOne','keys','UserMailQueue','order','MailQueueId','User','findAndCountAll','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','mailPause','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','addTeams','each','forEach','emit','userMailQueue:save','select','field','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString'];(function(_0x31adc5,_0x4a65e5){var _0x1a48de=function(_0x2525c5){while(--_0x2525c5){_0x31adc5['push'](_0x31adc5['shift']());}};_0x1a48de(++_0x4a65e5);}(_0x074f,0x97));var _0xf074=function(_0x3b1b1e,_0x298617){_0x3b1b1e=_0x3b1b1e-0x0;var _0x5d2686=_0x074f[_0x3b1b1e];return _0x5d2686;};'use strict';var emlformat=require(_0xf074('0x0'));var rimraf=require(_0xf074('0x1'));var zipdir=require(_0xf074('0x2'));var jsonpatch=require(_0xf074('0x3'));var rp=require('request-promise');var moment=require(_0xf074('0x4'));var BPromise=require(_0xf074('0x5'));var Mustache=require(_0xf074('0x6'));var util=require('util');var path=require(_0xf074('0x7'));var sox=require(_0xf074('0x8'));var csv=require(_0xf074('0x9'));var ejs=require(_0xf074('0xa'));var fs=require('fs');var fs_extra=require(_0xf074('0xb'));var _=require(_0xf074('0xc'));var squel=require(_0xf074('0xd'));var crypto=require(_0xf074('0xe'));var jsforce=require(_0xf074('0xf'));var deskjs=require(_0xf074('0x10'));var toCsv=require(_0xf074('0x9'));var querystring=require('querystring');var Papa=require(_0xf074('0x11'));var Redis=require(_0xf074('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf074('0x13'));var as=require(_0xf074('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf074('0x15'))(_0xf074('0x16'));var utils=require(_0xf074('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf074('0x18'));var db=require(_0xf074('0x19'))['db'];config[_0xf074('0x1a')]=_[_0xf074('0x1b')](config[_0xf074('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf074('0x1c'))(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x5bcd7c,_0x321fbb){_0x321fbb=_0x321fbb||0xcc;return function(_0x542e95){if(_0x542e95){return _0x5bcd7c[_0xf074('0x1d')](_0x321fbb);}return _0x5bcd7c[_0xf074('0x1e')](_0x321fbb)[_0xf074('0x1f')]();};}function respondWithResult(_0x5b06a9,_0x377295){_0x377295=_0x377295||0xc8;return function(_0x5529fb){if(_0x5529fb){return _0x5b06a9[_0xf074('0x1e')](_0x377295)[_0xf074('0x20')](_0x5529fb);}};}function respondWithFilteredResult(_0x450084,_0x253316){return function(_0x275d6b){if(_0x275d6b){var _0x269dd8=typeof _0x253316[_0xf074('0x21')]==='undefined'&&typeof _0x253316[_0xf074('0x22')]==='undefined';var _0x5d706c=_0x275d6b[_0xf074('0x23')];var _0x3f063c=_0x269dd8?0x0:_0x253316[_0xf074('0x21')];var _0x186a09=_0x269dd8?_0x275d6b['count']:_0x253316[_0xf074('0x21')]+_0x253316[_0xf074('0x22')];var _0x1c67ce;if(_0x186a09>=_0x5d706c){_0x186a09=_0x5d706c;_0x1c67ce=0xc8;}else{_0x1c67ce=0xce;}_0x450084['status'](_0x1c67ce);return _0x450084['set'](_0xf074('0x24'),_0x3f063c+'-'+_0x186a09+'/'+_0x5d706c)[_0xf074('0x20')](_0x275d6b);}return null;};}function patchUpdates(_0x26002c){return function(_0x3ae7d8){try{jsonpatch[_0xf074('0x25')](_0x3ae7d8,_0x26002c,!![]);}catch(_0x4ba516){return BPromise[_0xf074('0x26')](_0x4ba516);}return _0x3ae7d8[_0xf074('0x27')]();};}function saveUpdates(_0x435523,_0x17873a){return function(_0x1c4225){if(_0x1c4225){return _0x1c4225['update'](_0x435523)[_0xf074('0x28')](function(_0x4702bb){return _0x4702bb;});}return null;};}function removeEntity(_0x2cef91,_0x40ad59){return function(_0x2617ed){if(_0x2617ed){return _0x2617ed['destroy']()[_0xf074('0x28')](function(){var _0x54a2d7=_0x2617ed[_0xf074('0x29')]({'plain':!![]});var _0xda502e=_0xf074('0x2a');return db[_0xf074('0x2b')][_0xf074('0x2c')]({'where':{'type':_0xda502e,'resourceId':_0x54a2d7['id']}})[_0xf074('0x28')](function(){return _0x2617ed;});})[_0xf074('0x28')](function(){_0x2cef91[_0xf074('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x965dbe,_0xa11049){return function(_0xdd71e0){if(!_0xdd71e0){_0x965dbe[_0xf074('0x1d')](0x194);}return _0xdd71e0;};}function handleError(_0x43e69f,_0x198138){_0x198138=_0x198138||0x1f4;return function(_0x4384db){logger[_0xf074('0x2d')](_0x4384db['stack']);if(_0x4384db[_0xf074('0x2e')]){delete _0x4384db[_0xf074('0x2e')];}_0x43e69f['status'](_0x198138)[_0xf074('0x2f')](_0x4384db);};}exports[_0xf074('0x30')]=function(_0x5b6923,_0x115492){var _0xe8d85b={},_0x1443c9={},_0x35a3={'count':0x0,'rows':[]};var _0x29bea0=_[_0xf074('0x31')](db[_0xf074('0x32')][_0xf074('0x33')],function(_0x24f66c){return{'name':_0x24f66c['fieldName'],'type':_0x24f66c[_0xf074('0x34')]['key']};});_0x1443c9[_0xf074('0x35')]=_['map'](_0x29bea0,_0xf074('0x2e'));_0x1443c9[_0xf074('0x36')]=_['keys'](_0x5b6923[_0xf074('0x36')]);_0x1443c9[_0xf074('0x37')]=_[_0xf074('0x38')](_0x1443c9[_0xf074('0x35')],_0x1443c9['query']);_0xe8d85b[_0xf074('0x39')]=_['intersection'](_0x1443c9[_0xf074('0x35')],qs[_0xf074('0x3a')](_0x5b6923[_0xf074('0x36')][_0xf074('0x3a')]));_0xe8d85b[_0xf074('0x39')]=_0xe8d85b[_0xf074('0x39')][_0xf074('0x3b')]?_0xe8d85b[_0xf074('0x39')]:_0x1443c9[_0xf074('0x35')];if(!_0x5b6923[_0xf074('0x36')][_0xf074('0x3c')](_0xf074('0x3d'))){_0xe8d85b[_0xf074('0x22')]=qs[_0xf074('0x22')](_0x5b6923[_0xf074('0x36')][_0xf074('0x22')]);_0xe8d85b[_0xf074('0x21')]=qs[_0xf074('0x21')](_0x5b6923[_0xf074('0x36')]['offset']);}_0xe8d85b['order']=qs[_0xf074('0x3e')](_0x5b6923['query'][_0xf074('0x3e')]);_0xe8d85b[_0xf074('0x3f')]=qs[_0xf074('0x37')](_[_0xf074('0x40')](_0x5b6923[_0xf074('0x36')],_0x1443c9[_0xf074('0x37')]),_0x29bea0);if(_0x5b6923[_0xf074('0x36')]['filter']){_0xe8d85b[_0xf074('0x3f')]=_[_0xf074('0x41')](_0xe8d85b[_0xf074('0x3f')],{'$or':_['map'](_0x29bea0,function(_0x4d069b){if(_0x4d069b[_0xf074('0x34')]!==_0xf074('0x42')){var _0x57e48d={};_0x57e48d[_0x4d069b[_0xf074('0x2e')]]={'$like':'%'+_0x5b6923[_0xf074('0x36')][_0xf074('0x43')]+'%'};return _0x57e48d;}})});}_0xe8d85b=_[_0xf074('0x41')]({},_0xe8d85b,_0x5b6923['options']);var _0x2569b6={'where':_0xe8d85b['where']};return db['MailQueue']['count'](_0x2569b6)[_0xf074('0x28')](function(_0x56d1d5){_0x35a3[_0xf074('0x23')]=_0x56d1d5;if(_0x5b6923[_0xf074('0x36')][_0xf074('0x44')]){_0xe8d85b[_0xf074('0x45')]=[{'all':!![]}];}return db['MailQueue'][_0xf074('0x46')](_0xe8d85b);})['then'](function(_0x1786a0){_0x35a3['rows']=_0x1786a0;return _0x35a3;})[_0xf074('0x28')](respondWithFilteredResult(_0x115492,_0xe8d85b))[_0xf074('0x47')](handleError(_0x115492,null));};exports[_0xf074('0x48')]=function(_0x4c929c,_0x508b5e){var _0x284524={'raw':!![],'where':{'id':_0x4c929c[_0xf074('0x49')]['id']}},_0x4f93be={};_0x4f93be[_0xf074('0x35')]=_['keys'](db['MailQueue']['rawAttributes']);_0x4f93be[_0xf074('0x36')]=_['keys'](_0x4c929c[_0xf074('0x36')]);_0x4f93be[_0xf074('0x37')]=_[_0xf074('0x38')](_0x4f93be['model'],_0x4f93be[_0xf074('0x36')]);_0x284524[_0xf074('0x39')]=_['intersection'](_0x4f93be['model'],qs[_0xf074('0x3a')](_0x4c929c[_0xf074('0x36')][_0xf074('0x3a')]));_0x284524[_0xf074('0x39')]=_0x284524[_0xf074('0x39')][_0xf074('0x3b')]?_0x284524[_0xf074('0x39')]:_0x4f93be[_0xf074('0x35')];if(_0x4c929c[_0xf074('0x36')]['includeAll']){_0x284524[_0xf074('0x45')]=[{'all':!![]}];}_0x284524=_[_0xf074('0x41')]({},_0x284524,_0x4c929c[_0xf074('0x4a')]);return db[_0xf074('0x32')][_0xf074('0x4b')](_0x284524)[_0xf074('0x28')](handleEntityNotFound(_0x508b5e,null))['then'](respondWithResult(_0x508b5e,null))['catch'](handleError(_0x508b5e,null));};exports['create']=function(_0x2e1a74,_0x1ae4c6){return db[_0xf074('0x32')]['create'](_0x2e1a74[_0xf074('0x4c')],{})[_0xf074('0x28')](function(_0x6ffc40){var _0x36eb87=_0x2e1a74[_0xf074('0x4d')][_0xf074('0x29')]({'plain':!![]});if(!_0x36eb87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36eb87['role']===_0xf074('0x4d')){var _0x4d0f6d=_0x6ffc40[_0xf074('0x29')]({'plain':!![]});var _0x1e28cf=_0xf074('0x2a');return db[_0xf074('0x4e')][_0xf074('0x4b')]({'where':{'name':_0x1e28cf,'userProfileId':_0x36eb87[_0xf074('0x4f')]},'raw':!![]})[_0xf074('0x28')](function(_0x4f930e){if(_0x4f930e&&_0x4f930e[_0xf074('0x50')]===0x0){return db[_0xf074('0x2b')]['create']({'name':_0x4d0f6d['name'],'resourceId':_0x4d0f6d['id'],'type':_0x4f930e[_0xf074('0x2e')],'sectionId':_0x4f930e['id']},{})[_0xf074('0x28')](function(){return _0x6ffc40;});}else{return _0x6ffc40;}})['catch'](function(_0x2c19f5){logger[_0xf074('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c19f5);throw _0x2c19f5;});}return _0x6ffc40;})['then'](respondWithResult(_0x1ae4c6,0xc9))[_0xf074('0x47')](handleError(_0x1ae4c6,null));};exports['update']=function(_0x273dc7,_0x3f0089){if(_0x273dc7[_0xf074('0x4c')]['id']){delete _0x273dc7[_0xf074('0x4c')]['id'];}return db['MailQueue'][_0xf074('0x4b')]({'where':{'id':_0x273dc7[_0xf074('0x49')]['id']}})[_0xf074('0x28')](handleEntityNotFound(_0x3f0089,null))[_0xf074('0x28')](saveUpdates(_0x273dc7[_0xf074('0x4c')],null))['then'](respondWithResult(_0x3f0089,null))[_0xf074('0x47')](handleError(_0x3f0089,null));};exports[_0xf074('0x2c')]=function(_0x1c37d8,_0xafdf3d){return db[_0xf074('0x32')][_0xf074('0x4b')]({'where':{'id':_0x1c37d8[_0xf074('0x49')]['id']}})[_0xf074('0x28')](handleEntityNotFound(_0xafdf3d,null))['then'](removeEntity(_0xafdf3d,null))[_0xf074('0x47')](handleError(_0xafdf3d,null));};exports[_0xf074('0x51')]=function(_0xb09542,_0x383165){return db[_0xf074('0x32')]['describe']()['then'](respondWithResult(_0x383165,null))[_0xf074('0x47')](handleError(_0x383165,null));};exports['getMembers']=function(_0x3540fa,_0x48ceb8,_0x34f59e){var _0x54c898={'raw':!![],'where':{}},_0x33ff22={},_0x2100f5;return db[_0xf074('0x32')][_0xf074('0x52')]({'where':{'id':_0x3540fa['params']['id']}})[_0xf074('0x28')](handleEntityNotFound(_0x48ceb8,null))[_0xf074('0x28')](function(_0x429212){if(_0x429212){_0x2100f5=_0x429212['get']({'plain':!![]});_0x33ff22[_0xf074('0x35')]=_[_0xf074('0x53')](db[_0xf074('0x54')]['rawAttributes']);_0x33ff22[_0xf074('0x36')]=_[_0xf074('0x53')](_0x3540fa[_0xf074('0x36')]);_0x33ff22[_0xf074('0x37')]=_['intersection'](_0x33ff22[_0xf074('0x35')],_0x33ff22[_0xf074('0x36')]);_0x54c898[_0xf074('0x39')]=_[_0xf074('0x38')](_0x33ff22[_0xf074('0x35')],qs[_0xf074('0x3a')](_0x3540fa[_0xf074('0x36')]['fields']));_0x54c898['attributes']=_0x54c898['attributes']['length']?_0x54c898[_0xf074('0x39')]:_0x33ff22['model'];if(!_0x3540fa[_0xf074('0x36')][_0xf074('0x3c')](_0xf074('0x3d'))){_0x54c898[_0xf074('0x22')]=qs[_0xf074('0x22')](_0x3540fa['query'][_0xf074('0x22')]);_0x54c898[_0xf074('0x21')]=qs['offset'](_0x3540fa[_0xf074('0x36')][_0xf074('0x21')]);}_0x54c898[_0xf074('0x55')]=qs[_0xf074('0x3e')](_0x3540fa[_0xf074('0x36')]['sort']);_0x54c898[_0xf074('0x3f')]=qs[_0xf074('0x37')](_[_0xf074('0x40')](_0x3540fa['query'],_0x33ff22[_0xf074('0x37')]));_0x54c898[_0xf074('0x3f')][_0xf074('0x56')]=_0x429212['id'];if(_0x3540fa[_0xf074('0x36')][_0xf074('0x43')]){_0x54c898['where']=_[_0xf074('0x41')](_0x54c898[_0xf074('0x3f')],{'$or':_[_0xf074('0x31')](_0x54c898[_0xf074('0x39')],function(_0x33bc58){var _0xc9c99b={};_0xc9c99b[_0x33bc58]={'$like':'%'+_0x3540fa[_0xf074('0x36')]['filter']+'%'};return _0xc9c99b;})});}_0x54c898=_[_0xf074('0x41')]({},_0x54c898,_0x3540fa[_0xf074('0x4a')]);return db[_0xf074('0x54')][_0xf074('0x46')](_0x54c898);}})[_0xf074('0x28')](function(_0x58d8fd){if(_0x58d8fd){return db[_0xf074('0x57')][_0xf074('0x58')]({'where':{'id':_[_0xf074('0x31')](_0x58d8fd,'UserId'),'role':_0xf074('0x59')},'attributes':['id',_0xf074('0x2e'),'mailPause',_0xf074('0x5a'),_0xf074('0x5b')]});}})['then'](function(_0x1d729e){if(_0x1d729e){return{'count':_0x1d729e[_0xf074('0x23')],'rows':_[_0xf074('0x31')](_0x1d729e[_0xf074('0x5c')],function(_0x16975b){return{'membername':_0x16975b[_0xf074('0x2e')],'UserId':_0x16975b['id'],'queue_name':_0x2100f5[_0xf074('0x2e')],'MailQueueId':_0x2100f5['id'],'interface':util[_0xf074('0x5d')](_0xf074('0x5e'),_0xf074('0x5f'),_0x16975b[_0xf074('0x2e')]),'penalty':0x0,'paused':_0x16975b[_0xf074('0x60')],'createdAt':_0x16975b[_0xf074('0x5b')],'updatedAt':_0x16975b[_0xf074('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf074('0x28')](respondWithFilteredResult(_0x48ceb8,_0x54c898))[_0xf074('0x47')](handleError(_0x48ceb8,null));};exports[_0xf074('0x61')]=function(_0x2dc784,_0x3294e7,_0x574ed9){var _0xd7dff8={};var _0x4235ae={};var _0x16fc3a;var _0x36657c;return db['MailQueue']['findOne']({'where':{'id':_0x2dc784[_0xf074('0x49')]['id']}})[_0xf074('0x28')](handleEntityNotFound(_0x3294e7,null))[_0xf074('0x28')](function(_0x318e71){if(_0x318e71){_0x16fc3a=_0x318e71;_0x4235ae[_0xf074('0x35')]=_[_0xf074('0x53')](db[_0xf074('0x62')]['rawAttributes']);_0x4235ae[_0xf074('0x36')]=_[_0xf074('0x53')](_0x2dc784[_0xf074('0x36')]);_0x4235ae['filters']=_[_0xf074('0x38')](_0x4235ae[_0xf074('0x35')],_0x4235ae[_0xf074('0x36')]);_0xd7dff8['attributes']=_[_0xf074('0x38')](_0x4235ae[_0xf074('0x35')],qs[_0xf074('0x3a')](_0x2dc784[_0xf074('0x36')][_0xf074('0x3a')]));_0xd7dff8['attributes']=_0xd7dff8[_0xf074('0x39')]['length']?_0xd7dff8[_0xf074('0x39')]:_0x4235ae[_0xf074('0x35')];_0xd7dff8[_0xf074('0x55')]=qs[_0xf074('0x3e')](_0x2dc784[_0xf074('0x36')][_0xf074('0x3e')]);_0xd7dff8[_0xf074('0x3f')]=qs[_0xf074('0x37')](_[_0xf074('0x40')](_0x2dc784[_0xf074('0x36')],_0x4235ae['filters']));if(_0x2dc784[_0xf074('0x36')][_0xf074('0x43')]){_0xd7dff8[_0xf074('0x3f')]=_[_0xf074('0x41')](_0xd7dff8[_0xf074('0x3f')],{'$or':_[_0xf074('0x31')](_0xd7dff8[_0xf074('0x39')],function(_0x58a756){var _0x39c689={};_0x39c689[_0x58a756]={'$like':'%'+_0x2dc784[_0xf074('0x36')][_0xf074('0x43')]+'%'};return _0x39c689;})});}_0xd7dff8=_[_0xf074('0x41')]({},_0xd7dff8,_0x2dc784['options']);return _0x16fc3a['getTeams'](_0xd7dff8);}})[_0xf074('0x28')](function(_0x2a9c5c){if(_0x2a9c5c){_0x36657c=_0x2a9c5c[_0xf074('0x3b')];if(!_0x2dc784['query'][_0xf074('0x3c')](_0xf074('0x3d'))){_0xd7dff8['limit']=qs[_0xf074('0x22')](_0x2dc784[_0xf074('0x36')][_0xf074('0x22')]);_0xd7dff8[_0xf074('0x21')]=qs[_0xf074('0x21')](_0x2dc784[_0xf074('0x36')][_0xf074('0x21')]);}return _0x16fc3a[_0xf074('0x61')](_0xd7dff8);}})[_0xf074('0x28')](function(_0x4df317){if(_0x4df317){return _0x4df317?{'count':_0x36657c,'rows':_0x4df317}:null;}})[_0xf074('0x28')](respondWithResult(_0x3294e7,null))[_0xf074('0x47')](handleError(_0x3294e7,null));};exports['addTeams']=function(_0x8af094,_0x3c99a9,_0x496282){var _0x4948ce=_0x8af094['body'][_0xf074('0x63')];return db[_0xf074('0x62')][_0xf074('0x46')]({'where':{'id':_0x4948ce},'attributes':['id'],'include':[{'model':db[_0xf074('0x57')],'as':_0xf074('0x64'),'attributes':['id',_0xf074('0x2e'),_0xf074('0x65'),_0xf074('0x66'),_0xf074('0x67')],'raw':!![]}]})[_0xf074('0x28')](function(_0x1672fe){if(_0x1672fe){var _0x58368=_[_0xf074('0x68')](_0x1672fe,function(_0x2003c4){var _0x2aa627=_0x2003c4[_0xf074('0x29')]({'plain':!![]});return _0x2aa627[_0xf074('0x64')];});return db[_0xf074('0x32')][_0xf074('0x4b')]({'where':{'id':_0x8af094['params']['id']}})['then'](function(_0x240dc0){return db['sequelize']['transaction'](function(_0x31a1db){return _0x240dc0[_0xf074('0x69')](_0x4948ce,{'transaction':_0x31a1db})[_0xf074('0x28')](function(){return BPromise[_0xf074('0x6a')](_0x58368,function(_0x4106ee){return db[_0xf074('0x54')]['findOrCreate']({'where':{'UserId':_0x4106ee['id'],'MailQueueId':_0x8af094[_0xf074('0x49')]['id']},'transaction':_0x31a1db});});})[_0xf074('0x28')](function(){_0x58368[_0xf074('0x6b')](function(_0x4543c2){socket[_0xf074('0x6c')](_0xf074('0x6d'),{'UserId':_0x4543c2['id'],'MailQueueId':_0x240dc0['id']});});});});});}})[_0xf074('0x28')](respondWithStatusCode(_0x3c99a9,null))[_0xf074('0x47')](handleError(_0x3c99a9,null));};exports['removeTeams']=function(_0x2147b2,_0x39378b,_0x47408b){return db[_0xf074('0x62')][_0xf074('0x46')]({'where':{'id':_0x2147b2[_0xf074('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf074('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf074('0x28')](handleEntityNotFound(_0x39378b,null))[_0xf074('0x28')](function(_0x4abfd8){var _0x4e3d31=_[_0xf074('0x31')](_0x4abfd8,'id');var _0x170c51=[];var _0x2b2faa=[];var _0x4b787e=squel[_0xf074('0x6e')]();_0x4b787e[_0xf074('0x6f')]('tq.TeamId')[_0xf074('0x70')](_0xf074('0x71'),'tq')['join'](_0xf074('0x72'),'ut',_0xf074('0x73'))['where'](_0xf074('0x74'),_0x2147b2[_0xf074('0x49')]['id']);for(var _0x180833=0x0;_0x180833<_0x4abfd8[_0xf074('0x3b')];_0x180833+=0x1){let _0x4724c4=_0x4abfd8[_0x180833];for(var _0x4fe2c6=0x0;_0x4fe2c6<_0x4724c4['Agents'][_0xf074('0x3b')];_0x4fe2c6+=0x1){let _0x26b2d5=_0x4724c4[_0xf074('0x64')][_0x4fe2c6];var _0x7a145f=_0x4b787e[_0xf074('0x75')]();_0x7a145f['where'](_0xf074('0x76'),_0x26b2d5['id']);_0x2b2faa['push'](db[_0xf074('0x77')]['query'](_0x7a145f[_0xf074('0x78')](),{'type':db[_0xf074('0x77')][_0xf074('0x79')]['SELECT']})[_0xf074('0x28')](function(_0x593c60){if(_0x593c60[_0xf074('0x3b')]===0x1){return _0x26b2d5['id'];}else{var _0x32a21a=_['every'](_[_0xf074('0x31')](_0x593c60,_0xf074('0x7a')),function(_0x475c3f){return _['includes'](_0x4e3d31,_0x475c3f);});if(_0x32a21a){return _0x26b2d5['id'];}}}));}}return BPromise[_0xf074('0x7b')](_0x2b2faa)[_0xf074('0x28')](function(_0x103202){_0x170c51=_(_0x170c51)[_0xf074('0x7c')](_0x103202)['compact']()[_0xf074('0x7d')]();return db[_0xf074('0x32')]['find']({'where':{'id':_0x2147b2[_0xf074('0x49')]['id']}})[_0xf074('0x28')](function(_0x3e0d25){return db['sequelize'][_0xf074('0x7e')](function(_0x4149f5){return _0x3e0d25[_0xf074('0x7f')](_0x2147b2['query'][_0xf074('0x63')],{'transaction':_0x4149f5})[_0xf074('0x28')](function(){if(!_[_0xf074('0x80')](_0x170c51)){return _0x3e0d25[_0xf074('0x81')](_0x170c51,{'transaction':_0x4149f5});}})['then'](function(){_0x170c51['forEach'](function(_0x2912a8){socket[_0xf074('0x6c')](_0xf074('0x82'),{'UserId':_0x2912a8,'MailQueueId':_0x3e0d25['id']});});});});});});})[_0xf074('0x28')](respondWithStatusCode(_0x39378b,null))['catch'](handleError(_0x39378b,null));};exports[_0xf074('0x83')]=function(_0x27672b,_0x48d654,_0xa006cd){return db[_0xf074('0x32')][_0xf074('0x4b')]({'where':{'id':_0x27672b['params']['id']}})['then'](handleEntityNotFound(_0x48d654,null))[_0xf074('0x28')](function(_0x3c1846){if(_0x3c1846){return _0x3c1846[_0xf074('0x83')](_0x27672b[_0xf074('0x4c')]['ids'],_[_0xf074('0x84')](_0x27672b[_0xf074('0x4c')],[_0xf074('0x63'),'id'])||{})[_0xf074('0x85')](function(_0xc6358b){for(var _0x8c04bf=0x0;_0x8c04bf<_0x27672b[_0xf074('0x4c')]['ids'][_0xf074('0x3b')];_0x8c04bf+=0x1){socket[_0xf074('0x6c')](_0xf074('0x6d'),{'UserId':Number(_0x27672b['body'][_0xf074('0x63')][_0x8c04bf]),'MailQueueId':Number(_0x27672b[_0xf074('0x49')]['id'])});}return _0xc6358b;});}})[_0xf074('0x28')](respondWithResult(_0x48d654,null))['catch'](handleError(_0x48d654,null));};exports[_0xf074('0x81')]=function(_0x3a73b8,_0x32b7eb,_0x179eae){return db[_0xf074('0x32')][_0xf074('0x4b')]({'where':{'id':_0x3a73b8[_0xf074('0x49')]['id']}})[_0xf074('0x28')](handleEntityNotFound(_0x32b7eb,null))[_0xf074('0x28')](function(_0x3979d9){if(_0x3979d9){return _0x3979d9['removeAgents'](_0x3a73b8[_0xf074('0x36')][_0xf074('0x63')])[_0xf074('0x28')](function(){if(_[_0xf074('0x86')](_0x3a73b8[_0xf074('0x36')]['ids'])){for(var _0x53508c=0x0;_0x53508c<_0x3a73b8[_0xf074('0x36')][_0xf074('0x63')][_0xf074('0x3b')];_0x53508c+=0x1){socket[_0xf074('0x6c')](_0xf074('0x82'),{'UserId':Number(_0x3a73b8[_0xf074('0x36')][_0xf074('0x63')][_0x53508c]),'MailQueueId':Number(_0x3a73b8['params']['id'])});}}else{socket[_0xf074('0x6c')](_0xf074('0x82'),{'UserId':Number(_0x3a73b8[_0xf074('0x36')][_0xf074('0x63')]),'MailQueueId':Number(_0x3a73b8['params']['id'])});}});}})['then'](respondWithStatusCode(_0x32b7eb,null))[_0xf074('0x47')](handleError(_0x32b7eb,null));};exports[_0xf074('0x87')]=function(_0x4d969d,_0x3e7c14,_0x8b4c4a){var _0x54da54={};var _0x3d97e6={};var _0x5d9662;var _0x5ceb47;return db['MailQueue'][_0xf074('0x52')]({'where':{'id':_0x4d969d[_0xf074('0x49')]['id']}})[_0xf074('0x28')](handleEntityNotFound(_0x3e7c14,null))[_0xf074('0x28')](function(_0x4c2a42){if(_0x4c2a42){_0x5d9662=_0x4c2a42;_0x3d97e6[_0xf074('0x35')]=_[_0xf074('0x53')](db[_0xf074('0x57')]['rawAttributes']);_0x3d97e6[_0xf074('0x36')]=_[_0xf074('0x53')](_0x4d969d[_0xf074('0x36')]);_0x3d97e6[_0xf074('0x37')]=_[_0xf074('0x38')](_0x3d97e6[_0xf074('0x35')],_0x3d97e6[_0xf074('0x36')]);_0x54da54[_0xf074('0x39')]=_[_0xf074('0x38')](_0x3d97e6[_0xf074('0x35')],qs[_0xf074('0x3a')](_0x4d969d['query']['fields']));_0x54da54['attributes']=_0x54da54[_0xf074('0x39')][_0xf074('0x3b')]?_0x54da54['attributes']:_0x3d97e6[_0xf074('0x35')];_0x54da54[_0xf074('0x55')]=qs[_0xf074('0x3e')](_0x4d969d['query'][_0xf074('0x3e')]);_0x54da54['where']=qs[_0xf074('0x37')](_[_0xf074('0x40')](_0x4d969d['query'],_0x3d97e6[_0xf074('0x37')]));if(_0x4d969d[_0xf074('0x36')][_0xf074('0x43')]){_0x54da54[_0xf074('0x3f')]=_[_0xf074('0x41')](_0x54da54[_0xf074('0x3f')],{'$or':_['map'](_0x54da54[_0xf074('0x39')],function(_0x57bc5e){var _0x436c61={};_0x436c61[_0x57bc5e]={'$like':'%'+_0x4d969d[_0xf074('0x36')][_0xf074('0x43')]+'%'};return _0x436c61;})});}_0x54da54=_[_0xf074('0x41')]({},_0x54da54,_0x4d969d[_0xf074('0x4a')]);return _0x5d9662[_0xf074('0x87')](_0x54da54);}})[_0xf074('0x28')](function(_0xf92085){if(_0xf92085){_0x5ceb47=_0xf92085[_0xf074('0x3b')];if(!_0x4d969d[_0xf074('0x36')][_0xf074('0x3c')](_0xf074('0x3d'))){_0x54da54[_0xf074('0x22')]=qs[_0xf074('0x22')](_0x4d969d['query'][_0xf074('0x22')]);_0x54da54[_0xf074('0x21')]=qs['offset'](_0x4d969d[_0xf074('0x36')][_0xf074('0x21')]);}return _0x5d9662[_0xf074('0x87')](_0x54da54);}})[_0xf074('0x28')](function(_0x416afa){if(_0x416afa){return _0x416afa?{'count':_0x5ceb47,'rows':_0x416afa}:null;}})[_0xf074('0x28')](respondWithResult(_0x3e7c14,null))[_0xf074('0x47')](handleError(_0x3e7c14,null));}; \ No newline at end of file +var _0xa47d=['map','MailQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','include','rows','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findAll','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserMailQueue','findOrCreate','forEach','emit','userMailQueue:save','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','error','name','send'];(function(_0x308095,_0x1fa756){var _0x11b198=function(_0x1bf6ee){while(--_0x1bf6ee){_0x308095['push'](_0x308095['shift']());}};_0x11b198(++_0x1fa756);}(_0xa47d,0xe7));var _0xda47=function(_0x3301df,_0x1a604c){_0x3301df=_0x3301df-0x0;var _0x219679=_0xa47d[_0x3301df];return _0x219679;};'use strict';var emlformat=require(_0xda47('0x0'));var rimraf=require(_0xda47('0x1'));var zipdir=require(_0xda47('0x2'));var jsonpatch=require(_0xda47('0x3'));var rp=require('request-promise');var moment=require(_0xda47('0x4'));var BPromise=require(_0xda47('0x5'));var Mustache=require(_0xda47('0x6'));var util=require(_0xda47('0x7'));var path=require(_0xda47('0x8'));var sox=require('sox');var csv=require(_0xda47('0x9'));var ejs=require(_0xda47('0xa'));var fs=require('fs');var fs_extra=require(_0xda47('0xb'));var _=require(_0xda47('0xc'));var squel=require(_0xda47('0xd'));var crypto=require('crypto');var jsforce=require(_0xda47('0xe'));var deskjs=require(_0xda47('0xf'));var toCsv=require(_0xda47('0x9'));var querystring=require(_0xda47('0x10'));var Papa=require(_0xda47('0x11'));var Redis=require('ioredis');var authService=require(_0xda47('0x12'));var qs=require(_0xda47('0x13'));var as=require(_0xda47('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda47('0x15'))(_0xda47('0x16'));var utils=require(_0xda47('0x17'));var config=require(_0xda47('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xda47('0x19'))['db'];config[_0xda47('0x1a')]=_[_0xda47('0x1b')](config[_0xda47('0x1a')],{'host':_0xda47('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0xda47('0x1d')](socket);function respondWithStatusCode(_0x5bce05,_0x2d9396){_0x2d9396=_0x2d9396||0xcc;return function(_0x312756){if(_0x312756){return _0x5bce05[_0xda47('0x1e')](_0x2d9396);}return _0x5bce05['status'](_0x2d9396)[_0xda47('0x1f')]();};}function respondWithResult(_0x3438e2,_0x2eb4b5){_0x2eb4b5=_0x2eb4b5||0xc8;return function(_0x5c31fa){if(_0x5c31fa){return _0x3438e2[_0xda47('0x20')](_0x2eb4b5)[_0xda47('0x21')](_0x5c31fa);}};}function respondWithFilteredResult(_0x500d15,_0x37c2b0){return function(_0x5da4d7){if(_0x5da4d7){var _0x298550=typeof _0x37c2b0[_0xda47('0x22')]==='undefined'&&typeof _0x37c2b0[_0xda47('0x23')]===_0xda47('0x24');var _0x4ab860=_0x5da4d7[_0xda47('0x25')];var _0x406a62=_0x298550?0x0:_0x37c2b0[_0xda47('0x22')];var _0x59d7c0=_0x298550?_0x5da4d7[_0xda47('0x25')]:_0x37c2b0[_0xda47('0x22')]+_0x37c2b0[_0xda47('0x23')];var _0x5c6b63;if(_0x59d7c0>=_0x4ab860){_0x59d7c0=_0x4ab860;_0x5c6b63=0xc8;}else{_0x5c6b63=0xce;}_0x500d15[_0xda47('0x20')](_0x5c6b63);return _0x500d15['set'](_0xda47('0x26'),_0x406a62+'-'+_0x59d7c0+'/'+_0x4ab860)[_0xda47('0x21')](_0x5da4d7);}return null;};}function patchUpdates(_0x2bfb7f){return function(_0x43963b){try{jsonpatch[_0xda47('0x27')](_0x43963b,_0x2bfb7f,!![]);}catch(_0x1959ca){return BPromise[_0xda47('0x28')](_0x1959ca);}return _0x43963b[_0xda47('0x29')]();};}function saveUpdates(_0xa4d46f,_0x33e33d){return function(_0x39e67a){if(_0x39e67a){return _0x39e67a[_0xda47('0x2a')](_0xa4d46f)['then'](function(_0x15cd19){return _0x15cd19;});}return null;};}function removeEntity(_0x352ddc,_0x13106b){return function(_0xb6bddb){if(_0xb6bddb){return _0xb6bddb[_0xda47('0x2b')]()['then'](function(){var _0x358608=_0xb6bddb['get']({'plain':!![]});var _0x4f0299='MailQueues';return db[_0xda47('0x2c')][_0xda47('0x2b')]({'where':{'type':_0x4f0299,'resourceId':_0x358608['id']}})['then'](function(){return _0xb6bddb;});})[_0xda47('0x2d')](function(){_0x352ddc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d1885,_0x7f1f70){return function(_0x2f760e){if(!_0x2f760e){_0x8d1885[_0xda47('0x1e')](0x194);}return _0x2f760e;};}function handleError(_0x2c6edc,_0x30c759){_0x30c759=_0x30c759||0x1f4;return function(_0x2750d5){logger[_0xda47('0x2e')](_0x2750d5['stack']);if(_0x2750d5[_0xda47('0x2f')]){delete _0x2750d5[_0xda47('0x2f')];}_0x2c6edc[_0xda47('0x20')](_0x30c759)[_0xda47('0x30')](_0x2750d5);};}exports['index']=function(_0x567d30,_0xeec800){var _0x5eea02={},_0x16d7ba={},_0x42840b={'count':0x0,'rows':[]};var _0x34ef37=_[_0xda47('0x31')](db[_0xda47('0x32')][_0xda47('0x33')],function(_0x1a79a9){return{'name':_0x1a79a9[_0xda47('0x34')],'type':_0x1a79a9['type'][_0xda47('0x35')]};});_0x16d7ba['model']=_[_0xda47('0x31')](_0x34ef37,'name');_0x16d7ba[_0xda47('0x36')]=_[_0xda47('0x37')](_0x567d30['query']);_0x16d7ba[_0xda47('0x38')]=_[_0xda47('0x39')](_0x16d7ba[_0xda47('0x3a')],_0x16d7ba['query']);_0x5eea02[_0xda47('0x3b')]=_[_0xda47('0x39')](_0x16d7ba[_0xda47('0x3a')],qs['fields'](_0x567d30[_0xda47('0x36')][_0xda47('0x3c')]));_0x5eea02[_0xda47('0x3b')]=_0x5eea02['attributes'][_0xda47('0x3d')]?_0x5eea02['attributes']:_0x16d7ba[_0xda47('0x3a')];if(!_0x567d30['query'][_0xda47('0x3e')](_0xda47('0x3f'))){_0x5eea02[_0xda47('0x23')]=qs[_0xda47('0x23')](_0x567d30[_0xda47('0x36')]['limit']);_0x5eea02[_0xda47('0x22')]=qs[_0xda47('0x22')](_0x567d30[_0xda47('0x36')][_0xda47('0x22')]);}_0x5eea02[_0xda47('0x40')]=qs[_0xda47('0x41')](_0x567d30[_0xda47('0x36')]['sort']);_0x5eea02['where']=qs[_0xda47('0x38')](_[_0xda47('0x42')](_0x567d30[_0xda47('0x36')],_0x16d7ba[_0xda47('0x38')]),_0x34ef37);if(_0x567d30[_0xda47('0x36')][_0xda47('0x43')]){_0x5eea02[_0xda47('0x44')]=_[_0xda47('0x45')](_0x5eea02[_0xda47('0x44')],{'$or':_[_0xda47('0x31')](_0x34ef37,function(_0x3bdc9d){if(_0x3bdc9d[_0xda47('0x46')]!=='VIRTUAL'){var _0x39fce1={};_0x39fce1[_0x3bdc9d[_0xda47('0x2f')]]={'$like':'%'+_0x567d30['query'][_0xda47('0x43')]+'%'};return _0x39fce1;}})});}_0x5eea02=_[_0xda47('0x45')]({},_0x5eea02,_0x567d30[_0xda47('0x47')]);var _0x39ee54={'where':_0x5eea02[_0xda47('0x44')]};return db[_0xda47('0x32')]['count'](_0x39ee54)[_0xda47('0x2d')](function(_0x4d7f6f){_0x42840b[_0xda47('0x25')]=_0x4d7f6f;if(_0x567d30[_0xda47('0x36')]['includeAll']){_0x5eea02[_0xda47('0x48')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x5eea02);})[_0xda47('0x2d')](function(_0x5b16b1){_0x42840b[_0xda47('0x49')]=_0x5b16b1;return _0x42840b;})[_0xda47('0x2d')](respondWithFilteredResult(_0xeec800,_0x5eea02))['catch'](handleError(_0xeec800,null));};exports[_0xda47('0x4a')]=function(_0x273dba,_0x1333c3){var _0x1bb0a3={'raw':!![],'where':{'id':_0x273dba[_0xda47('0x4b')]['id']}},_0xf48916={};_0xf48916[_0xda47('0x3a')]=_[_0xda47('0x37')](db['MailQueue'][_0xda47('0x33')]);_0xf48916[_0xda47('0x36')]=_[_0xda47('0x37')](_0x273dba[_0xda47('0x36')]);_0xf48916['filters']=_['intersection'](_0xf48916['model'],_0xf48916['query']);_0x1bb0a3['attributes']=_[_0xda47('0x39')](_0xf48916[_0xda47('0x3a')],qs[_0xda47('0x3c')](_0x273dba[_0xda47('0x36')][_0xda47('0x3c')]));_0x1bb0a3[_0xda47('0x3b')]=_0x1bb0a3['attributes']['length']?_0x1bb0a3['attributes']:_0xf48916[_0xda47('0x3a')];if(_0x273dba[_0xda47('0x36')][_0xda47('0x4c')]){_0x1bb0a3[_0xda47('0x48')]=[{'all':!![]}];}_0x1bb0a3=_['merge']({},_0x1bb0a3,_0x273dba[_0xda47('0x47')]);return db[_0xda47('0x32')][_0xda47('0x4d')](_0x1bb0a3)[_0xda47('0x2d')](handleEntityNotFound(_0x1333c3,null))['then'](respondWithResult(_0x1333c3,null))['catch'](handleError(_0x1333c3,null));};exports[_0xda47('0x4e')]=function(_0x157155,_0x3cdb3f){return db['MailQueue'][_0xda47('0x4e')](_0x157155[_0xda47('0x4f')],{})[_0xda47('0x2d')](function(_0x2ee7d9){var _0x2b5569=_0x157155[_0xda47('0x50')][_0xda47('0x51')]({'plain':!![]});if(!_0x2b5569)throw new Error(_0xda47('0x52'));if(_0x2b5569[_0xda47('0x53')]==='user'){var _0xdcdb62=_0x2ee7d9['get']({'plain':!![]});var _0x4a7ffe=_0xda47('0x54');return db[_0xda47('0x55')][_0xda47('0x4d')]({'where':{'name':_0x4a7ffe,'userProfileId':_0x2b5569['userProfileId']},'raw':!![]})[_0xda47('0x2d')](function(_0x34f54a){if(_0x34f54a&&_0x34f54a[_0xda47('0x56')]===0x0){return db[_0xda47('0x2c')][_0xda47('0x4e')]({'name':_0xdcdb62[_0xda47('0x2f')],'resourceId':_0xdcdb62['id'],'type':_0x34f54a[_0xda47('0x2f')],'sectionId':_0x34f54a['id']},{})[_0xda47('0x2d')](function(){return _0x2ee7d9;});}else{return _0x2ee7d9;}})[_0xda47('0x57')](function(_0x9f8105){logger['error'](_0xda47('0x58'),_0x9f8105);throw _0x9f8105;});}return _0x2ee7d9;})['then'](respondWithResult(_0x3cdb3f,0xc9))['catch'](handleError(_0x3cdb3f,null));};exports[_0xda47('0x2a')]=function(_0x68188,_0x215e0e){if(_0x68188[_0xda47('0x4f')]['id']){delete _0x68188[_0xda47('0x4f')]['id'];}return db[_0xda47('0x32')][_0xda47('0x4d')]({'where':{'id':_0x68188[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x215e0e,null))[_0xda47('0x2d')](saveUpdates(_0x68188['body'],null))[_0xda47('0x2d')](respondWithResult(_0x215e0e,null))['catch'](handleError(_0x215e0e,null));};exports['destroy']=function(_0x1a148f,_0x44fc86){return db[_0xda47('0x32')][_0xda47('0x4d')]({'where':{'id':_0x1a148f[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x44fc86,null))[_0xda47('0x2d')](removeEntity(_0x44fc86,null))[_0xda47('0x57')](handleError(_0x44fc86,null));};exports['describe']=function(_0x222b01,_0x115d4d){return db[_0xda47('0x32')][_0xda47('0x59')]()[_0xda47('0x2d')](respondWithResult(_0x115d4d,null))[_0xda47('0x57')](handleError(_0x115d4d,null));};exports[_0xda47('0x5a')]=function(_0x5316d1,_0x2bdfda,_0x236437){var _0x43d98b={'raw':!![],'where':{}},_0x3da70f={},_0x4654ca;return db[_0xda47('0x32')]['findOne']({'where':{'id':_0x5316d1[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x2bdfda,null))[_0xda47('0x2d')](function(_0x111d85){if(_0x111d85){_0x4654ca=_0x111d85['get']({'plain':!![]});_0x3da70f['model']=_[_0xda47('0x37')](db['UserMailQueue'][_0xda47('0x33')]);_0x3da70f['query']=_[_0xda47('0x37')](_0x5316d1[_0xda47('0x36')]);_0x3da70f[_0xda47('0x38')]=_[_0xda47('0x39')](_0x3da70f[_0xda47('0x3a')],_0x3da70f['query']);_0x43d98b['attributes']=_[_0xda47('0x39')](_0x3da70f['model'],qs[_0xda47('0x3c')](_0x5316d1['query'][_0xda47('0x3c')]));_0x43d98b[_0xda47('0x3b')]=_0x43d98b[_0xda47('0x3b')][_0xda47('0x3d')]?_0x43d98b[_0xda47('0x3b')]:_0x3da70f[_0xda47('0x3a')];if(!_0x5316d1[_0xda47('0x36')][_0xda47('0x3e')](_0xda47('0x3f'))){_0x43d98b['limit']=qs[_0xda47('0x23')](_0x5316d1[_0xda47('0x36')][_0xda47('0x23')]);_0x43d98b[_0xda47('0x22')]=qs[_0xda47('0x22')](_0x5316d1[_0xda47('0x36')]['offset']);}_0x43d98b[_0xda47('0x40')]=qs[_0xda47('0x41')](_0x5316d1['query'][_0xda47('0x41')]);_0x43d98b['where']=qs[_0xda47('0x38')](_[_0xda47('0x42')](_0x5316d1[_0xda47('0x36')],_0x3da70f['filters']));_0x43d98b[_0xda47('0x44')]['MailQueueId']=_0x111d85['id'];if(_0x5316d1[_0xda47('0x36')][_0xda47('0x43')]){_0x43d98b['where']=_[_0xda47('0x45')](_0x43d98b[_0xda47('0x44')],{'$or':_[_0xda47('0x31')](_0x43d98b['attributes'],function(_0x35738a){var _0x247872={};_0x247872[_0x35738a]={'$like':'%'+_0x5316d1[_0xda47('0x36')]['filter']+'%'};return _0x247872;})});}_0x43d98b=_[_0xda47('0x45')]({},_0x43d98b,_0x5316d1[_0xda47('0x47')]);return db['UserMailQueue'][_0xda47('0x5b')](_0x43d98b);}})['then'](function(_0x13ecd8){if(_0x13ecd8){return db['User']['findAndCountAll']({'where':{'id':_[_0xda47('0x31')](_0x13ecd8,_0xda47('0x5c')),'role':_0xda47('0x5d')},'attributes':['id',_0xda47('0x2f'),_0xda47('0x5e'),_0xda47('0x5f'),_0xda47('0x60')]});}})['then'](function(_0x2a6e1f){if(_0x2a6e1f){return{'count':_0x2a6e1f[_0xda47('0x25')],'rows':_['map'](_0x2a6e1f[_0xda47('0x49')],function(_0x42ab72){return{'membername':_0x42ab72['name'],'UserId':_0x42ab72['id'],'queue_name':_0x4654ca[_0xda47('0x2f')],'MailQueueId':_0x4654ca['id'],'interface':util[_0xda47('0x61')]('%s/%s',_0xda47('0x62'),_0x42ab72[_0xda47('0x2f')]),'penalty':0x0,'paused':_0x42ab72[_0xda47('0x5e')],'createdAt':_0x42ab72[_0xda47('0x60')],'updatedAt':_0x42ab72[_0xda47('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xda47('0x2d')](respondWithFilteredResult(_0x2bdfda,_0x43d98b))[_0xda47('0x57')](handleError(_0x2bdfda,null));};exports[_0xda47('0x63')]=function(_0x512a19,_0x47b891,_0x3fee8f){var _0x403819={};var _0x2f702c={};var _0x1b76d9;var _0x24d413;return db[_0xda47('0x32')][_0xda47('0x64')]({'where':{'id':_0x512a19[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x47b891,null))[_0xda47('0x2d')](function(_0x3892c6){if(_0x3892c6){_0x1b76d9=_0x3892c6;_0x2f702c[_0xda47('0x3a')]=_[_0xda47('0x37')](db[_0xda47('0x65')][_0xda47('0x33')]);_0x2f702c[_0xda47('0x36')]=_['keys'](_0x512a19[_0xda47('0x36')]);_0x2f702c[_0xda47('0x38')]=_[_0xda47('0x39')](_0x2f702c['model'],_0x2f702c[_0xda47('0x36')]);_0x403819[_0xda47('0x3b')]=_[_0xda47('0x39')](_0x2f702c[_0xda47('0x3a')],qs['fields'](_0x512a19[_0xda47('0x36')][_0xda47('0x3c')]));_0x403819[_0xda47('0x3b')]=_0x403819[_0xda47('0x3b')]['length']?_0x403819[_0xda47('0x3b')]:_0x2f702c[_0xda47('0x3a')];_0x403819[_0xda47('0x40')]=qs[_0xda47('0x41')](_0x512a19[_0xda47('0x36')][_0xda47('0x41')]);_0x403819[_0xda47('0x44')]=qs[_0xda47('0x38')](_[_0xda47('0x42')](_0x512a19[_0xda47('0x36')],_0x2f702c[_0xda47('0x38')]));if(_0x512a19[_0xda47('0x36')]['filter']){_0x403819[_0xda47('0x44')]=_[_0xda47('0x45')](_0x403819[_0xda47('0x44')],{'$or':_[_0xda47('0x31')](_0x403819['attributes'],function(_0x58b5c7){var _0x162786={};_0x162786[_0x58b5c7]={'$like':'%'+_0x512a19[_0xda47('0x36')][_0xda47('0x43')]+'%'};return _0x162786;})});}_0x403819=_[_0xda47('0x45')]({},_0x403819,_0x512a19[_0xda47('0x47')]);return _0x1b76d9[_0xda47('0x63')](_0x403819);}})['then'](function(_0x105642){if(_0x105642){_0x24d413=_0x105642[_0xda47('0x3d')];if(!_0x512a19['query']['hasOwnProperty'](_0xda47('0x3f'))){_0x403819['limit']=qs[_0xda47('0x23')](_0x512a19['query']['limit']);_0x403819['offset']=qs[_0xda47('0x22')](_0x512a19[_0xda47('0x36')][_0xda47('0x22')]);}return _0x1b76d9[_0xda47('0x63')](_0x403819);}})['then'](function(_0x55722f){if(_0x55722f){return _0x55722f?{'count':_0x24d413,'rows':_0x55722f}:null;}})[_0xda47('0x2d')](respondWithResult(_0x47b891,null))[_0xda47('0x57')](handleError(_0x47b891,null));};exports[_0xda47('0x66')]=function(_0x548fa2,_0x450a41,_0x1d7f36){var _0x38fc37=_0x548fa2[_0xda47('0x4f')]['ids'];return db['Team'][_0xda47('0x5b')]({'where':{'id':_0x38fc37},'attributes':['id'],'include':[{'model':db[_0xda47('0x67')],'as':_0xda47('0x68'),'attributes':['id',_0xda47('0x2f'),'online',_0xda47('0x69'),_0xda47('0x6a')],'raw':!![]}]})['then'](function(_0x324030){if(_0x324030){var _0x316dc2=_[_0xda47('0x6b')](_0x324030,function(_0x1b22af){var _0x4a5864=_0x1b22af[_0xda47('0x51')]({'plain':!![]});return _0x4a5864['Agents'];});return db[_0xda47('0x32')]['find']({'where':{'id':_0x548fa2['params']['id']}})[_0xda47('0x2d')](function(_0x257591){return db[_0xda47('0x6c')][_0xda47('0x6d')](function(_0x562a03){return _0x257591[_0xda47('0x66')](_0x38fc37,{'transaction':_0x562a03})[_0xda47('0x2d')](function(){return BPromise[_0xda47('0x6e')](_0x316dc2,function(_0x32f306){return db[_0xda47('0x6f')][_0xda47('0x70')]({'where':{'UserId':_0x32f306['id'],'MailQueueId':_0x548fa2['params']['id']},'transaction':_0x562a03});});})[_0xda47('0x2d')](function(){_0x316dc2[_0xda47('0x71')](function(_0x52ee14){socket[_0xda47('0x72')](_0xda47('0x73'),{'UserId':_0x52ee14['id'],'MailQueueId':_0x257591['id']});});});});});}})['then'](respondWithStatusCode(_0x450a41,null))[_0xda47('0x57')](handleError(_0x450a41,null));};exports['removeTeams']=function(_0xaf64b0,_0x453466,_0x9dd2d6){return db[_0xda47('0x65')][_0xda47('0x5b')]({'where':{'id':_0xaf64b0[_0xda47('0x36')][_0xda47('0x74')]},'attributes':['id'],'include':[{'model':db[_0xda47('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xda47('0x2d')](handleEntityNotFound(_0x453466,null))[_0xda47('0x2d')](function(_0xfac715){var _0x1b25af=_[_0xda47('0x31')](_0xfac715,'id');var _0x28de88=[];var _0x3af656=[];var _0x32a0ae=squel['select']();_0x32a0ae[_0xda47('0x75')](_0xda47('0x76'))[_0xda47('0x77')]('team_has_mail_queues','tq')[_0xda47('0x78')](_0xda47('0x79'),'ut',_0xda47('0x7a'))[_0xda47('0x44')](_0xda47('0x7b'),_0xaf64b0[_0xda47('0x4b')]['id']);for(var _0x51cf69=0x0;_0x51cf69<_0xfac715[_0xda47('0x3d')];_0x51cf69+=0x1){let _0x57fba8=_0xfac715[_0x51cf69];for(var _0x107f60=0x0;_0x107f60<_0x57fba8[_0xda47('0x68')][_0xda47('0x3d')];_0x107f60+=0x1){let _0x4136a4=_0x57fba8['Agents'][_0x107f60];var _0x48d31c=_0x32a0ae[_0xda47('0x7c')]();_0x48d31c[_0xda47('0x44')](_0xda47('0x7d'),_0x4136a4['id']);_0x3af656[_0xda47('0x7e')](db[_0xda47('0x6c')]['query'](_0x48d31c['toString'](),{'type':db[_0xda47('0x6c')][_0xda47('0x7f')][_0xda47('0x80')]})['then'](function(_0x81c5d5){if(_0x81c5d5[_0xda47('0x3d')]===0x1){return _0x4136a4['id'];}else{var _0x1f5c62=_[_0xda47('0x81')](_['map'](_0x81c5d5,_0xda47('0x82')),function(_0x240f6d){return _[_0xda47('0x83')](_0x1b25af,_0x240f6d);});if(_0x1f5c62){return _0x4136a4['id'];}}}));}}return BPromise['all'](_0x3af656)[_0xda47('0x2d')](function(_0x4b777d){_0x28de88=_(_0x28de88)[_0xda47('0x84')](_0x4b777d)[_0xda47('0x85')]()['value']();return db['MailQueue'][_0xda47('0x4d')]({'where':{'id':_0xaf64b0[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](function(_0x1b6588){return db[_0xda47('0x6c')]['transaction'](function(_0x2dd64a){return _0x1b6588['removeTeams'](_0xaf64b0[_0xda47('0x36')][_0xda47('0x74')],{'transaction':_0x2dd64a})['then'](function(){if(!_['isEmpty'](_0x28de88)){return _0x1b6588[_0xda47('0x86')](_0x28de88,{'transaction':_0x2dd64a});}})[_0xda47('0x2d')](function(){_0x28de88[_0xda47('0x71')](function(_0x4f6606){socket[_0xda47('0x72')](_0xda47('0x87'),{'UserId':_0x4f6606,'MailQueueId':_0x1b6588['id']});});});});});});})['then'](respondWithStatusCode(_0x453466,null))[_0xda47('0x57')](handleError(_0x453466,null));};exports['addAgents']=function(_0x4aa7b7,_0x571f2c,_0x2fb4c9){return db['MailQueue']['find']({'where':{'id':_0x4aa7b7['params']['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x571f2c,null))['then'](function(_0x719a72){if(_0x719a72){return _0x719a72[_0xda47('0x88')](_0x4aa7b7['body'][_0xda47('0x74')],_[_0xda47('0x89')](_0x4aa7b7['body'],[_0xda47('0x74'),'id'])||{})['spread'](function(_0x462949){for(var _0x4d5870=0x0;_0x4d5870<_0x4aa7b7['body'][_0xda47('0x74')]['length'];_0x4d5870+=0x1){socket['emit'](_0xda47('0x73'),{'UserId':Number(_0x4aa7b7['body'][_0xda47('0x74')][_0x4d5870]),'MailQueueId':Number(_0x4aa7b7['params']['id'])});}return _0x462949;});}})[_0xda47('0x2d')](respondWithResult(_0x571f2c,null))[_0xda47('0x57')](handleError(_0x571f2c,null));};exports[_0xda47('0x86')]=function(_0x1ae71b,_0x2fd56b,_0x510630){return db[_0xda47('0x32')]['find']({'where':{'id':_0x1ae71b[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x2fd56b,null))[_0xda47('0x2d')](function(_0x275e4a){if(_0x275e4a){return _0x275e4a[_0xda47('0x86')](_0x1ae71b[_0xda47('0x36')][_0xda47('0x74')])[_0xda47('0x2d')](function(){if(_[_0xda47('0x8a')](_0x1ae71b[_0xda47('0x36')][_0xda47('0x74')])){for(var _0x2ec6ed=0x0;_0x2ec6ed<_0x1ae71b['query']['ids']['length'];_0x2ec6ed+=0x1){socket[_0xda47('0x72')](_0xda47('0x87'),{'UserId':Number(_0x1ae71b[_0xda47('0x36')]['ids'][_0x2ec6ed]),'MailQueueId':Number(_0x1ae71b[_0xda47('0x4b')]['id'])});}}else{socket[_0xda47('0x72')](_0xda47('0x87'),{'UserId':Number(_0x1ae71b['query'][_0xda47('0x74')]),'MailQueueId':Number(_0x1ae71b[_0xda47('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x2fd56b,null))['catch'](handleError(_0x2fd56b,null));};exports['getAgents']=function(_0x25279d,_0x28c6c9,_0x6bde1){var _0x452b96={};var _0x83406f={};var _0x5eedfb;var _0x2d90da;return db[_0xda47('0x32')][_0xda47('0x64')]({'where':{'id':_0x25279d[_0xda47('0x4b')]['id']}})[_0xda47('0x2d')](handleEntityNotFound(_0x28c6c9,null))[_0xda47('0x2d')](function(_0x2e2af5){if(_0x2e2af5){_0x5eedfb=_0x2e2af5;_0x83406f['model']=_[_0xda47('0x37')](db[_0xda47('0x67')][_0xda47('0x33')]);_0x83406f[_0xda47('0x36')]=_[_0xda47('0x37')](_0x25279d[_0xda47('0x36')]);_0x83406f[_0xda47('0x38')]=_[_0xda47('0x39')](_0x83406f[_0xda47('0x3a')],_0x83406f[_0xda47('0x36')]);_0x452b96[_0xda47('0x3b')]=_[_0xda47('0x39')](_0x83406f[_0xda47('0x3a')],qs[_0xda47('0x3c')](_0x25279d[_0xda47('0x36')]['fields']));_0x452b96[_0xda47('0x3b')]=_0x452b96[_0xda47('0x3b')][_0xda47('0x3d')]?_0x452b96[_0xda47('0x3b')]:_0x83406f['model'];_0x452b96[_0xda47('0x40')]=qs[_0xda47('0x41')](_0x25279d[_0xda47('0x36')][_0xda47('0x41')]);_0x452b96[_0xda47('0x44')]=qs['filters'](_['pick'](_0x25279d[_0xda47('0x36')],_0x83406f[_0xda47('0x38')]));if(_0x25279d[_0xda47('0x36')][_0xda47('0x43')]){_0x452b96[_0xda47('0x44')]=_[_0xda47('0x45')](_0x452b96['where'],{'$or':_[_0xda47('0x31')](_0x452b96[_0xda47('0x3b')],function(_0x28c40c){var _0x2ee889={};_0x2ee889[_0x28c40c]={'$like':'%'+_0x25279d[_0xda47('0x36')]['filter']+'%'};return _0x2ee889;})});}_0x452b96=_[_0xda47('0x45')]({},_0x452b96,_0x25279d[_0xda47('0x47')]);return _0x5eedfb[_0xda47('0x8b')](_0x452b96);}})[_0xda47('0x2d')](function(_0x50fd41){if(_0x50fd41){_0x2d90da=_0x50fd41[_0xda47('0x3d')];if(!_0x25279d[_0xda47('0x36')][_0xda47('0x3e')](_0xda47('0x3f'))){_0x452b96['limit']=qs[_0xda47('0x23')](_0x25279d[_0xda47('0x36')][_0xda47('0x23')]);_0x452b96[_0xda47('0x22')]=qs['offset'](_0x25279d['query'][_0xda47('0x22')]);}return _0x5eedfb[_0xda47('0x8b')](_0x452b96);}})[_0xda47('0x2d')](function(_0x414b01){if(_0x414b01){return _0x414b01?{'count':_0x2d90da,'rows':_0x414b01}:null;}})[_0xda47('0x2d')](respondWithResult(_0x28c6c9,null))['catch'](handleError(_0x28c6c9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 660d5ce..44de0cf 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 _0xacc2=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x395f8c,_0x3a56d8){var _0x18a682=function(_0xa882f3){while(--_0xa882f3){_0x395f8c['push'](_0x395f8c['shift']());}};_0x18a682(++_0x3a56d8);}(_0xacc2,0x173));var _0x2acc=function(_0x439e52,_0x82473){_0x439e52=_0x439e52-0x0;var _0x4bc6f0=_0xacc2[_0x439e52];return _0x4bc6f0;};'use strict';var EventEmitter=require(_0x2acc('0x0'));var MailQueue=require(_0x2acc('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x2acc('0x2')](0x0);var events={'afterCreate':_0x2acc('0x3'),'afterUpdate':_0x2acc('0x4'),'afterDestroy':_0x2acc('0x5')};function emitEvent(_0x59e091){return function(_0x2a032f,_0x564982,_0x5dca45){MailQueueEvents[_0x2acc('0x6')](_0x59e091+':'+_0x2a032f['id'],_0x2a032f);MailQueueEvents['emit'](_0x59e091,_0x2a032f);_0x5dca45(null);};}for(var e in events){if(events[_0x2acc('0x7')](e)){var event=events[e];MailQueue[_0x2acc('0x8')](e,emitEvent(event));}}module[_0x2acc('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xbdd3=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x1a7714,_0x25715a){var _0x5f2757=function(_0x56c404){while(--_0x56c404){_0x1a7714['push'](_0x1a7714['shift']());}};_0x5f2757(++_0x25715a);}(_0xbdd3,0x82));var _0x3bdd=function(_0x2b3b51,_0x3244ba){_0x2b3b51=_0x2b3b51-0x0;var _0x2b8395=_0xbdd3[_0x2b3b51];return _0x2b8395;};'use strict';var EventEmitter=require(_0x3bdd('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3bdd('0x1')](0x0);var events={'afterCreate':_0x3bdd('0x2'),'afterUpdate':_0x3bdd('0x3'),'afterDestroy':_0x3bdd('0x4')};function emitEvent(_0x67482d){return function(_0x56505b,_0x17750f,_0x3d8b20){MailQueueEvents['emit'](_0x67482d+':'+_0x56505b['id'],_0x56505b);MailQueueEvents[_0x3bdd('0x5')](_0x67482d,_0x56505b);_0x3d8b20(null);};}for(var e in events){if(events[_0x3bdd('0x6')](e)){var event=events[e];MailQueue[_0x3bdd('0x7')](e,emitEvent(event));}}module[_0x3bdd('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 68b68c2..b0e314e 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 _0x0b8e=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','../../config/logger','moment','bluebird','rimraf'];(function(_0xbb146,_0x1b3260){var _0x5094d0=function(_0x3bd1c0){while(--_0x3bd1c0){_0xbb146['push'](_0xbb146['shift']());}};_0x5094d0(++_0x1b3260);}(_0x0b8e,0x12f));var _0xe0b8=function(_0x35ad21,_0x3ea4c5){_0x35ad21=_0x35ad21-0x0;var _0x24dc5e=_0x0b8e[_0x35ad21];return _0x24dc5e;};'use strict';var _=require(_0xe0b8('0x0'));var util=require('util');var logger=require(_0xe0b8('0x1'))('api');var moment=require(_0xe0b8('0x2'));var BPromise=require(_0xe0b8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe0b8('0x4'));var config=require(_0xe0b8('0x5'));var attributes=require(_0xe0b8('0x6'));module[_0xe0b8('0x7')]=function(_0x64d724,_0x33e9cd){return _0x64d724[_0xe0b8('0x8')](_0xe0b8('0x9'),attributes,{'tableName':_0xe0b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcef4=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','lodash','util','../../config/logger','api','moment'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0xcef4,0xcb));var _0x4cef=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0xcef4[_0x430459];return _0x3a2439;};'use strict';var _=require(_0x4cef('0x0'));var util=require(_0x4cef('0x1'));var logger=require(_0x4cef('0x2'))(_0x4cef('0x3'));var moment=require(_0x4cef('0x4'));var BPromise=require(_0x4cef('0x5'));var rp=require(_0x4cef('0x6'));var fs=require('fs');var path=require(_0x4cef('0x7'));var rimraf=require(_0x4cef('0x8'));var config=require(_0x4cef('0x9'));var attributes=require(_0x4cef('0xa'));module['exports']=function(_0x15746a,_0x4625ca){return _0x15746a[_0x4cef('0xb')](_0x4cef('0xc'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index ef82c11..9a9baab 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 _0x1455=['../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailQueue','options','raw','where','limit','map','include','attributes','model','GetMailQueue','ShowMailQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x1455,0x97));var _0x5145=function(_0x1ec3cc,_0x5b0578){_0x1ec3cc=_0x1ec3cc-0x0;var _0x1a4fd5=_0x1455[_0x1ec3cc];return _0x1a4fd5;};'use strict';var _=require(_0x5145('0x0'));var util=require(_0x5145('0x1'));var moment=require(_0x5145('0x2'));var BPromise=require('bluebird');var rs=require(_0x5145('0x3'));var fs=require('fs');var Redis=require(_0x5145('0x4'));var db=require(_0x5145('0x5'))['db'];var utils=require(_0x5145('0x6'));var logger=require(_0x5145('0x7'))(_0x5145('0x8'));var config=require(_0x5145('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5145('0xa')][_0x5145('0xb')]({'port':0x232a});config[_0x5145('0xc')]=_['defaults'](config[_0x5145('0xc')],{'host':_0x5145('0xd'),'port':0x18eb});var socket=require(_0x5145('0xe'))(new Redis(config[_0x5145('0xc')]));require('./mailQueue.socket')[_0x5145('0xf')](socket);function respondWithRpcPromise(_0x440586,_0x3c2087,_0x127969){return new BPromise(function(_0x5693d8,_0x208784){return client[_0x5145('0x10')](_0x440586,_0x127969)[_0x5145('0x11')](function(_0x21e2e8){logger[_0x5145('0x12')](_0x5145('0x13'),_0x3c2087,_0x5145('0x14'));logger[_0x5145('0x15')](_0x5145('0x16'),_0x3c2087,'request\x20sent',JSON[_0x5145('0x17')](_0x21e2e8));if(_0x21e2e8['error']){if(_0x21e2e8[_0x5145('0x18')]['code']===0x1f4){logger[_0x5145('0x18')](_0x5145('0x13'),_0x3c2087,_0x21e2e8[_0x5145('0x18')]['message']);return _0x208784(_0x21e2e8[_0x5145('0x18')][_0x5145('0x19')]);}logger[_0x5145('0x18')](_0x5145('0x13'),_0x3c2087,_0x21e2e8[_0x5145('0x18')][_0x5145('0x19')]);return _0x5693d8(_0x21e2e8['error']['message']);}else{logger[_0x5145('0x12')](_0x5145('0x13'),_0x3c2087,'request\x20sent');_0x5693d8(_0x21e2e8[_0x5145('0x1a')]['message']);}})[_0x5145('0x1b')](function(_0x2d051e){logger['error'](_0x5145('0x13'),_0x3c2087,_0x2d051e);_0x208784(_0x2d051e);});});}exports['GetMailQueue']=function(_0x1c319f){var _0x3d5b12=this;return new Promise(function(_0xb6039f,_0x292d10){return db[_0x5145('0x1c')]['findAll']({'raw':_0x1c319f[_0x5145('0x1d')]?_0x1c319f['options'][_0x5145('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c319f['options']?_0x1c319f[_0x5145('0x1d')][_0x5145('0x1f')]||null:null,'attributes':_0x1c319f[_0x5145('0x1d')]?_0x1c319f[_0x5145('0x1d')]['attributes']||null:null,'limit':_0x1c319f['options']?_0x1c319f['options'][_0x5145('0x20')]||null:null,'include':_0x1c319f[_0x5145('0x1d')]?_0x1c319f[_0x5145('0x1d')]['include']?_[_0x5145('0x21')](_0x1c319f[_0x5145('0x1d')][_0x5145('0x22')],function(_0x49fdd2){return{'model':db[_0x49fdd2['model']],'as':_0x49fdd2['as'],'attributes':_0x49fdd2[_0x5145('0x23')],'include':_0x49fdd2[_0x5145('0x22')]?_[_0x5145('0x21')](_0x49fdd2[_0x5145('0x22')],function(_0x53769a){return{'model':db[_0x53769a['model']],'as':_0x53769a['as'],'attributes':_0x53769a['attributes'],'include':_0x53769a[_0x5145('0x22')]?_[_0x5145('0x21')](_0x53769a[_0x5145('0x22')],function(_0x3e9707){return{'model':db[_0x3e9707[_0x5145('0x24')]],'as':_0x3e9707['as'],'attributes':_0x3e9707[_0x5145('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5145('0x11')](function(_0x19360c){logger[_0x5145('0x12')](_0x5145('0x25'),_0x1c319f);logger[_0x5145('0x15')](_0x5145('0x25'),_0x1c319f,JSON[_0x5145('0x17')](_0x19360c));_0xb6039f(_0x19360c);})[_0x5145('0x1b')](function(_0x255cdc){logger['error']('GetMailQueue',_0x255cdc[_0x5145('0x19')],_0x1c319f);_0x292d10(_0x3d5b12[_0x5145('0x18')](0x1f4,_0x255cdc[_0x5145('0x19')]));});});};exports[_0x5145('0x26')]=function(_0x5c70ed){var _0x90444f=this;return new Promise(function(_0x2e1d96,_0xd73e98){return db[_0x5145('0x1c')][_0x5145('0x27')]({'raw':_0x5c70ed[_0x5145('0x1d')]?_0x5c70ed[_0x5145('0x1d')][_0x5145('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c70ed[_0x5145('0x1d')]?_0x5c70ed[_0x5145('0x1d')]['where']||null:null,'attributes':_0x5c70ed[_0x5145('0x1d')]?_0x5c70ed[_0x5145('0x1d')][_0x5145('0x23')]||null:null,'include':_0x5c70ed[_0x5145('0x1d')]?_0x5c70ed['options'][_0x5145('0x22')]?_[_0x5145('0x21')](_0x5c70ed['options']['include'],function(_0x3277d4){return{'model':db[_0x3277d4[_0x5145('0x24')]],'as':_0x3277d4['as'],'attributes':_0x3277d4[_0x5145('0x23')],'include':_0x3277d4[_0x5145('0x22')]?_[_0x5145('0x21')](_0x3277d4[_0x5145('0x22')],function(_0x4607e6){return{'model':db[_0x4607e6[_0x5145('0x24')]],'as':_0x4607e6['as'],'attributes':_0x4607e6[_0x5145('0x23')],'include':_0x4607e6[_0x5145('0x22')]?_[_0x5145('0x21')](_0x4607e6[_0x5145('0x22')],function(_0x585aa4){return{'model':db[_0x585aa4['model']],'as':_0x585aa4['as'],'attributes':_0x585aa4[_0x5145('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5145('0x11')](function(_0x5cd60a){logger[_0x5145('0x12')](_0x5145('0x26'),_0x5c70ed);logger[_0x5145('0x15')](_0x5145('0x26'),_0x5c70ed,JSON[_0x5145('0x17')](_0x5cd60a));_0x2e1d96(_0x5cd60a);})[_0x5145('0x1b')](function(_0x507340){logger[_0x5145('0x18')](_0x5145('0x26'),_0x507340[_0x5145('0x19')],_0x5c70ed);_0xd73e98(_0x90444f[_0x5145('0x18')](0x1f4,_0x507340[_0x5145('0x19')]));});});}; \ No newline at end of file +var _0x8440=['http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','where','attributes','limit','map','include','model','GetMailQueue','debug','ShowMailQueue','raw','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b8df0,_0x5c59f1){var _0x2ad3fe=function(_0x2244ae){while(--_0x2244ae){_0x4b8df0['push'](_0x4b8df0['shift']());}};_0x2ad3fe(++_0x5c59f1);}(_0x8440,0x122));var _0x0844=function(_0x3a1109,_0x41156d){_0x3a1109=_0x3a1109-0x0;var _0x3c1cea=_0x8440[_0x3a1109];return _0x3c1cea;};'use strict';var _=require(_0x0844('0x0'));var util=require(_0x0844('0x1'));var moment=require('moment');var BPromise=require(_0x0844('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0844('0x3'));var db=require(_0x0844('0x4'))['db'];var utils=require(_0x0844('0x5'));var logger=require(_0x0844('0x6'))(_0x0844('0x7'));var config=require(_0x0844('0x8'));var jayson=require(_0x0844('0x9'));var client=jayson[_0x0844('0xa')][_0x0844('0xb')]({'port':0x232a});config['redis']=_[_0x0844('0xc')](config[_0x0844('0xd')],{'host':_0x0844('0xe'),'port':0x18eb});var socket=require(_0x0844('0xf'))(new Redis(config[_0x0844('0xd')]));require(_0x0844('0x10'))[_0x0844('0x11')](socket);function respondWithRpcPromise(_0x279687,_0x59a88e,_0x13b4ce){return new BPromise(function(_0x3b24cd,_0x509580){return client[_0x0844('0x12')](_0x279687,_0x13b4ce)['then'](function(_0x41cf2e){logger[_0x0844('0x13')](_0x0844('0x14'),_0x59a88e,_0x0844('0x15'));logger['debug'](_0x0844('0x16'),_0x59a88e,'request\x20sent',JSON[_0x0844('0x17')](_0x41cf2e));if(_0x41cf2e[_0x0844('0x18')]){if(_0x41cf2e[_0x0844('0x18')][_0x0844('0x19')]===0x1f4){logger[_0x0844('0x18')](_0x0844('0x14'),_0x59a88e,_0x41cf2e[_0x0844('0x18')][_0x0844('0x1a')]);return _0x509580(_0x41cf2e['error'][_0x0844('0x1a')]);}logger[_0x0844('0x18')](_0x0844('0x14'),_0x59a88e,_0x41cf2e[_0x0844('0x18')][_0x0844('0x1a')]);return _0x3b24cd(_0x41cf2e[_0x0844('0x18')][_0x0844('0x1a')]);}else{logger[_0x0844('0x13')]('MailQueue,\x20%s,\x20%s',_0x59a88e,'request\x20sent');_0x3b24cd(_0x41cf2e[_0x0844('0x1b')][_0x0844('0x1a')]);}})[_0x0844('0x1c')](function(_0x1e3656){logger[_0x0844('0x18')](_0x0844('0x14'),_0x59a88e,_0x1e3656);_0x509580(_0x1e3656);});});}exports['GetMailQueue']=function(_0x525470){var _0x43d025=this;return new Promise(function(_0x479609,_0x544e67){return db[_0x0844('0x1d')][_0x0844('0x1e')]({'raw':_0x525470['options']?_0x525470[_0x0844('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x525470['options']?_0x525470[_0x0844('0x1f')][_0x0844('0x20')]||null:null,'attributes':_0x525470[_0x0844('0x1f')]?_0x525470[_0x0844('0x1f')][_0x0844('0x21')]||null:null,'limit':_0x525470[_0x0844('0x1f')]?_0x525470['options'][_0x0844('0x22')]||null:null,'include':_0x525470[_0x0844('0x1f')]?_0x525470[_0x0844('0x1f')]['include']?_[_0x0844('0x23')](_0x525470[_0x0844('0x1f')][_0x0844('0x24')],function(_0x2b9c15){return{'model':db[_0x2b9c15[_0x0844('0x25')]],'as':_0x2b9c15['as'],'attributes':_0x2b9c15[_0x0844('0x21')],'include':_0x2b9c15[_0x0844('0x24')]?_[_0x0844('0x23')](_0x2b9c15[_0x0844('0x24')],function(_0x1aa05e){return{'model':db[_0x1aa05e['model']],'as':_0x1aa05e['as'],'attributes':_0x1aa05e[_0x0844('0x21')],'include':_0x1aa05e['include']?_[_0x0844('0x23')](_0x1aa05e[_0x0844('0x24')],function(_0x17f97a){return{'model':db[_0x17f97a['model']],'as':_0x17f97a['as'],'attributes':_0x17f97a[_0x0844('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x699b45){logger[_0x0844('0x13')](_0x0844('0x26'),_0x525470);logger[_0x0844('0x27')](_0x0844('0x26'),_0x525470,JSON[_0x0844('0x17')](_0x699b45));_0x479609(_0x699b45);})[_0x0844('0x1c')](function(_0x1cc64d){logger['error'](_0x0844('0x26'),_0x1cc64d[_0x0844('0x1a')],_0x525470);_0x544e67(_0x43d025['error'](0x1f4,_0x1cc64d['message']));});});};exports[_0x0844('0x28')]=function(_0x2d0180){var _0x552b69=this;return new Promise(function(_0x270e29,_0x815bbd){return db[_0x0844('0x1d')]['find']({'raw':_0x2d0180[_0x0844('0x1f')]?_0x2d0180[_0x0844('0x1f')][_0x0844('0x29')]===undefined?!![]:![]:!![],'where':_0x2d0180[_0x0844('0x1f')]?_0x2d0180[_0x0844('0x1f')]['where']||null:null,'attributes':_0x2d0180[_0x0844('0x1f')]?_0x2d0180[_0x0844('0x1f')]['attributes']||null:null,'include':_0x2d0180['options']?_0x2d0180[_0x0844('0x1f')][_0x0844('0x24')]?_[_0x0844('0x23')](_0x2d0180[_0x0844('0x1f')][_0x0844('0x24')],function(_0x2b6ed7){return{'model':db[_0x2b6ed7['model']],'as':_0x2b6ed7['as'],'attributes':_0x2b6ed7[_0x0844('0x21')],'include':_0x2b6ed7[_0x0844('0x24')]?_['map'](_0x2b6ed7['include'],function(_0x221bad){return{'model':db[_0x221bad[_0x0844('0x25')]],'as':_0x221bad['as'],'attributes':_0x221bad[_0x0844('0x21')],'include':_0x221bad[_0x0844('0x24')]?_[_0x0844('0x23')](_0x221bad[_0x0844('0x24')],function(_0x11691e){return{'model':db[_0x11691e[_0x0844('0x25')]],'as':_0x11691e['as'],'attributes':_0x11691e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0844('0x2a')](function(_0xea2ad5){logger[_0x0844('0x13')]('ShowMailQueue',_0x2d0180);logger[_0x0844('0x27')](_0x0844('0x28'),_0x2d0180,JSON[_0x0844('0x17')](_0xea2ad5));_0x270e29(_0xea2ad5);})[_0x0844('0x1c')](function(_0x557862){logger[_0x0844('0x18')](_0x0844('0x28'),_0x557862[_0x0844('0x1a')],_0x2d0180);_0x815bbd(_0x552b69[_0x0844('0x18')](0x1f4,_0x557862[_0x0844('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index bfbdfb4..8bbdf5e 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 _0x9649=['update','emit','removeListener','mailQueue:','./mailQueue.events','save'];(function(_0x51539c,_0x25f587){var _0x4f7914=function(_0x4c666e){while(--_0x4c666e){_0x51539c['push'](_0x51539c['shift']());}};_0x4f7914(++_0x25f587);}(_0x9649,0x118));var _0x9964=function(_0x41e64d,_0x432d19){_0x41e64d=_0x41e64d-0x0;var _0x1b35a9=_0x9649[_0x41e64d];return _0x1b35a9;};'use strict';var MailQueueEvents=require(_0x9964('0x0'));var events=[_0x9964('0x1'),'remove',_0x9964('0x2')];function createListener(_0xeadca,_0x1c659a){return function(_0x4e5e2e){_0x1c659a[_0x9964('0x3')](_0xeadca,_0x4e5e2e);};}function removeListener(_0x2bdfaa,_0x363931){return function(){MailQueueEvents[_0x9964('0x4')](_0x2bdfaa,_0x363931);};}exports['register']=function(_0x5a5ca1){for(var _0xa14fe1=0x0,_0x4c3262=events['length'];_0xa14fe1<_0x4c3262;_0xa14fe1++){var _0x5a6790=events[_0xa14fe1];var _0x258f72=createListener(_0x9964('0x5')+_0x5a6790,_0x5a5ca1);MailQueueEvents['on'](_0x5a6790,_0x258f72);}}; \ No newline at end of file +var _0xb8c1=['length','save','remove','update','removeListener','register'];(function(_0x58c458,_0x445e5e){var _0x52a613=function(_0x1a59ba){while(--_0x1a59ba){_0x58c458['push'](_0x58c458['shift']());}};_0x52a613(++_0x445e5e);}(_0xb8c1,0x91));var _0x1b8c=function(_0x234156,_0xef15eb){_0x234156=_0x234156-0x0;var _0xff365c=_0xb8c1[_0x234156];return _0xff365c;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x1b8c('0x0'),_0x1b8c('0x1'),_0x1b8c('0x2')];function createListener(_0x38154f,_0x366b7b){return function(_0x128e34){_0x366b7b['emit'](_0x38154f,_0x128e34);};}function removeListener(_0x565f9e,_0x4e7ad2){return function(){MailQueueEvents[_0x1b8c('0x3')](_0x565f9e,_0x4e7ad2);};}exports[_0x1b8c('0x4')]=function(_0x44804c){for(var _0x460b86=0x0,_0x1710e1=events[_0x1b8c('0x5')];_0x460b86<_0x1710e1;_0x460b86++){var _0x23191c=events[_0x460b86];var _0xd96ed1=createListener('mailQueue:'+_0x23191c,_0x44804c);MailQueueEvents['on'](_0x23191c,_0xd96ed1);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index af47e6f..cc5788e 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 _0x256e=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x1fd171,_0x52f618){var _0x236a23=function(_0x373b23){while(--_0x373b23){_0x1fd171['push'](_0x1fd171['shift']());}};_0x236a23(++_0x52f618);}(_0x256e,0x1e1));var _0xe256=function(_0x43281a,_0x38b2db){_0x43281a=_0x43281a-0x0;var _0x1be8f0=_0x256e[_0x43281a];return _0x1be8f0;};'use strict';var multer=require(_0xe256('0x0'));var util=require(_0xe256('0x1'));var path=require(_0xe256('0x2'));var timeout=require('connect-timeout');var express=require(_0xe256('0x3'));var router=express['Router']();var fs_extra=require(_0xe256('0x4'));var auth=require(_0xe256('0x5'));var interaction=require(_0xe256('0x6'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0xe256('0x7')]('/',auth[_0xe256('0x8')](),controller[_0xe256('0x9')]);router[_0xe256('0x7')](_0xe256('0xa'),auth[_0xe256('0x8')](),controller[_0xe256('0xb')]);router[_0xe256('0x7')](_0xe256('0xc'),auth[_0xe256('0x8')](),controller['show']);router[_0xe256('0xd')]('/',auth['isAuthenticated'](),controller[_0xe256('0xe')]);router[_0xe256('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe256('0x10')]);router[_0xe256('0x11')]('/:id',auth[_0xe256('0x8')](),controller[_0xe256('0x12')]);module[_0xe256('0x13')]=router; \ No newline at end of file +var _0x8181=['Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','destroy','exports','util','path','express'];(function(_0x95ad05,_0x3cadb6){var _0x2d79f4=function(_0x9868f2){while(--_0x9868f2){_0x95ad05['push'](_0x95ad05['shift']());}};_0x2d79f4(++_0x3cadb6);}(_0x8181,0x1c9));var _0x1818=function(_0x4a077d,_0x3c8a03){_0x4a077d=_0x4a077d-0x0;var _0x1afebb=_0x8181[_0x4a077d];return _0x1afebb;};'use strict';var multer=require('multer');var util=require(_0x1818('0x0'));var path=require(_0x1818('0x1'));var timeout=require('connect-timeout');var express=require(_0x1818('0x2'));var router=express[_0x1818('0x3')]();var fs_extra=require(_0x1818('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1818('0x5'));var config=require(_0x1818('0x6'));var controller=require(_0x1818('0x7'));router['get']('/',auth[_0x1818('0x8')](),controller[_0x1818('0x9')]);router[_0x1818('0xa')]('/describe',auth[_0x1818('0x8')](),controller[_0x1818('0xb')]);router[_0x1818('0xa')](_0x1818('0xc'),auth['isAuthenticated'](),controller[_0x1818('0xd')]);router[_0x1818('0xe')]('/',auth[_0x1818('0x8')](),controller[_0x1818('0xf')]);router[_0x1818('0x10')](_0x1818('0xc'),auth[_0x1818('0x8')](),controller[_0x1818('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1818('0x12')]);module[_0x1818('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 26687c0..c034172 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 _0x990b=['exports','STRING','DATE','sequelize'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x990b,0x1df));var _0xb990=function(_0x1a7b94,_0x48dc03){_0x1a7b94=_0x1a7b94-0x0;var _0x1bebe0=_0x990b[_0x1a7b94];return _0x1bebe0;};'use strict';var moment=require('moment');var Sequelize=require(_0xb990('0x0'));module[_0xb990('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb990('0x2')]},'joinAt':{'type':Sequelize[_0xb990('0x3')]},'leaveAt':{'type':Sequelize[_0xb990('0x3')]},'acceptAt':{'type':Sequelize[_0xb990('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb990('0x2')]}}; \ No newline at end of file +var _0xd7a0=['moment','exports','STRING','DATE'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xd7a0,0xa0));var _0x0d7a=function(_0x4d1cf8,_0x4aa563){_0x4d1cf8=_0x4d1cf8-0x0;var _0x1b60dd=_0xd7a0[_0x4d1cf8];return _0x1b60dd;};'use strict';var moment=require(_0x0d7a('0x0'));var Sequelize=require('sequelize');module[_0x0d7a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0d7a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0d7a('0x3')]},'acceptAt':{'type':Sequelize[_0x0d7a('0x3')]},'exitAt':{'type':Sequelize[_0x0d7a('0x3')]},'reason':{'type':Sequelize[_0x0d7a('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 74b1ed6..e14436d 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 _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0xacf4,0xe7));var _0x4acf=function(_0x1a6a25,_0x2394f6){_0x1a6a25=_0x1a6a25-0x0;var _0x592ccb=_0xacf4[_0x1a6a25];return _0x592ccb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['MailQueueReport'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['MailQueueReport']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file +var _0xf2e3=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','error','stack','name','send','index','MailQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','then','includeAll','include','rows','catch','show','params','create','body','update','destroy','find','describe','eml-format'];(function(_0x523e45,_0xe413f1){var _0x2fbd50=function(_0x207d3f){while(--_0x207d3f){_0x523e45['push'](_0x523e45['shift']());}};_0x2fbd50(++_0xe413f1);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xf2e3[_0x2adbeb];return _0x5e18a6;};'use strict';var emlformat=require(_0x3f2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f2e('0x1'));var jsonpatch=require(_0x3f2e('0x2'));var rp=require(_0x3f2e('0x3'));var moment=require(_0x3f2e('0x4'));var BPromise=require(_0x3f2e('0x5'));var Mustache=require(_0x3f2e('0x6'));var util=require(_0x3f2e('0x7'));var path=require(_0x3f2e('0x8'));var sox=require(_0x3f2e('0x9'));var csv=require('to-csv');var ejs=require(_0x3f2e('0xa'));var fs=require('fs');var fs_extra=require(_0x3f2e('0xb'));var _=require(_0x3f2e('0xc'));var squel=require(_0x3f2e('0xd'));var crypto=require(_0x3f2e('0xe'));var jsforce=require(_0x3f2e('0xf'));var deskjs=require(_0x3f2e('0x10'));var toCsv=require(_0x3f2e('0x11'));var querystring=require(_0x3f2e('0x12'));var Papa=require(_0x3f2e('0x13'));var Redis=require(_0x3f2e('0x14'));var authService=require(_0x3f2e('0x15'));var qs=require(_0x3f2e('0x16'));var as=require(_0x3f2e('0x17'));var hardwareService=require(_0x3f2e('0x18'));var logger=require(_0x3f2e('0x19'))(_0x3f2e('0x1a'));var utils=require(_0x3f2e('0x1b'));var config=require(_0x3f2e('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f2e('0x1d'))['db'];function respondWithStatusCode(_0xaa6ef5,_0x5471f9){_0x5471f9=_0x5471f9||0xcc;return function(_0xe83663){if(_0xe83663){return _0xaa6ef5[_0x3f2e('0x1e')](_0x5471f9);}return _0xaa6ef5[_0x3f2e('0x1f')](_0x5471f9)[_0x3f2e('0x20')]();};}function respondWithResult(_0x3d20d1,_0x57cba7){_0x57cba7=_0x57cba7||0xc8;return function(_0x298080){if(_0x298080){return _0x3d20d1[_0x3f2e('0x1f')](_0x57cba7)[_0x3f2e('0x21')](_0x298080);}};}function respondWithFilteredResult(_0x4f2e38,_0x43f69e){return function(_0x218b44){if(_0x218b44){var _0x17ef58=typeof _0x43f69e[_0x3f2e('0x22')]===_0x3f2e('0x23')&&typeof _0x43f69e[_0x3f2e('0x24')]===_0x3f2e('0x23');var _0x155411=_0x218b44[_0x3f2e('0x25')];var _0xc00add=_0x17ef58?0x0:_0x43f69e[_0x3f2e('0x22')];var _0x5b9989=_0x17ef58?_0x218b44[_0x3f2e('0x25')]:_0x43f69e[_0x3f2e('0x22')]+_0x43f69e[_0x3f2e('0x24')];var _0xbe899c;if(_0x5b9989>=_0x155411){_0x5b9989=_0x155411;_0xbe899c=0xc8;}else{_0xbe899c=0xce;}_0x4f2e38[_0x3f2e('0x1f')](_0xbe899c);return _0x4f2e38['set']('Content-Range',_0xc00add+'-'+_0x5b9989+'/'+_0x155411)[_0x3f2e('0x21')](_0x218b44);}return null;};}function patchUpdates(_0x11f84c){return function(_0x38bbae){try{jsonpatch[_0x3f2e('0x26')](_0x38bbae,_0x11f84c,!![]);}catch(_0x4381e5){return BPromise[_0x3f2e('0x27')](_0x4381e5);}return _0x38bbae['save']();};}function saveUpdates(_0x5a7047,_0xf81165){return function(_0x37dab2){if(_0x37dab2){return _0x37dab2['update'](_0x5a7047)['then'](function(_0x46bb1c){return _0x46bb1c;});}return null;};}function removeEntity(_0x5646f5,_0x1b8c67){return function(_0x401ed9){if(_0x401ed9){return _0x401ed9['destroy']()['then'](function(){_0x5646f5['status'](0xcc)[_0x3f2e('0x20')]();});}};}function handleEntityNotFound(_0x3d7631,_0x4c61d9){return function(_0x11a7cc){if(!_0x11a7cc){_0x3d7631['sendStatus'](0x194);}return _0x11a7cc;};}function handleError(_0x1ad875,_0x598541){_0x598541=_0x598541||0x1f4;return function(_0x2806d0){logger[_0x3f2e('0x28')](_0x2806d0[_0x3f2e('0x29')]);if(_0x2806d0[_0x3f2e('0x2a')]){delete _0x2806d0[_0x3f2e('0x2a')];}_0x1ad875['status'](_0x598541)[_0x3f2e('0x2b')](_0x2806d0);};}exports[_0x3f2e('0x2c')]=function(_0x5eab38,_0x528063){var _0x2b9fda={},_0x1e5db4={},_0x35f421={'count':0x0,'rows':[]};var _0x22e6ad=_['map'](db[_0x3f2e('0x2d')][_0x3f2e('0x2e')],function(_0x37ddfe){return{'name':_0x37ddfe['fieldName'],'type':_0x37ddfe[_0x3f2e('0x2f')][_0x3f2e('0x30')]};});_0x1e5db4[_0x3f2e('0x31')]=_['map'](_0x22e6ad,_0x3f2e('0x2a'));_0x1e5db4[_0x3f2e('0x32')]=_[_0x3f2e('0x33')](_0x5eab38[_0x3f2e('0x32')]);_0x1e5db4[_0x3f2e('0x34')]=_[_0x3f2e('0x35')](_0x1e5db4['model'],_0x1e5db4[_0x3f2e('0x32')]);_0x2b9fda[_0x3f2e('0x36')]=_[_0x3f2e('0x35')](_0x1e5db4[_0x3f2e('0x31')],qs[_0x3f2e('0x37')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x37')]));_0x2b9fda['attributes']=_0x2b9fda[_0x3f2e('0x36')][_0x3f2e('0x38')]?_0x2b9fda[_0x3f2e('0x36')]:_0x1e5db4[_0x3f2e('0x31')];if(!_0x5eab38['query']['hasOwnProperty'](_0x3f2e('0x39'))){_0x2b9fda[_0x3f2e('0x24')]=qs[_0x3f2e('0x24')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x24')]);_0x2b9fda[_0x3f2e('0x22')]=qs[_0x3f2e('0x22')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x22')]);}_0x2b9fda[_0x3f2e('0x3a')]=qs['sort'](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x3b')]);_0x2b9fda[_0x3f2e('0x3c')]=qs[_0x3f2e('0x34')](_['pick'](_0x5eab38[_0x3f2e('0x32')],_0x1e5db4[_0x3f2e('0x34')]),_0x22e6ad);if(_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x3d')]){_0x2b9fda[_0x3f2e('0x3c')]=_[_0x3f2e('0x3e')](_0x2b9fda[_0x3f2e('0x3c')],{'$or':_[_0x3f2e('0x3f')](_0x22e6ad,function(_0x4c5ac2){if(_0x4c5ac2[_0x3f2e('0x2f')]!==_0x3f2e('0x40')){var _0x238b6b={};_0x238b6b[_0x4c5ac2[_0x3f2e('0x2a')]]={'$like':'%'+_0x5eab38['query'][_0x3f2e('0x3d')]+'%'};return _0x238b6b;}})});}_0x2b9fda=_[_0x3f2e('0x3e')]({},_0x2b9fda,_0x5eab38['options']);var _0x3fc694={'where':_0x2b9fda[_0x3f2e('0x3c')]};return db['MailQueueReport'][_0x3f2e('0x25')](_0x3fc694)[_0x3f2e('0x41')](function(_0x849236){_0x35f421[_0x3f2e('0x25')]=_0x849236;if(_0x5eab38['query'][_0x3f2e('0x42')]){_0x2b9fda[_0x3f2e('0x43')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x2b9fda);})[_0x3f2e('0x41')](function(_0x23de01){_0x35f421[_0x3f2e('0x44')]=_0x23de01;return _0x35f421;})['then'](respondWithFilteredResult(_0x528063,_0x2b9fda))[_0x3f2e('0x45')](handleError(_0x528063,null));};exports[_0x3f2e('0x46')]=function(_0x43b35a,_0xe9000a){var _0x24df56={'raw':!![],'where':{'id':_0x43b35a[_0x3f2e('0x47')]['id']}},_0x3668dc={};_0x3668dc[_0x3f2e('0x31')]=_[_0x3f2e('0x33')](db[_0x3f2e('0x2d')]['rawAttributes']);_0x3668dc['query']=_[_0x3f2e('0x33')](_0x43b35a[_0x3f2e('0x32')]);_0x3668dc['filters']=_['intersection'](_0x3668dc[_0x3f2e('0x31')],_0x3668dc[_0x3f2e('0x32')]);_0x24df56[_0x3f2e('0x36')]=_['intersection'](_0x3668dc[_0x3f2e('0x31')],qs[_0x3f2e('0x37')](_0x43b35a[_0x3f2e('0x32')]['fields']));_0x24df56[_0x3f2e('0x36')]=_0x24df56[_0x3f2e('0x36')][_0x3f2e('0x38')]?_0x24df56['attributes']:_0x3668dc[_0x3f2e('0x31')];if(_0x43b35a[_0x3f2e('0x32')][_0x3f2e('0x42')]){_0x24df56['include']=[{'all':!![]}];}_0x24df56=_[_0x3f2e('0x3e')]({},_0x24df56,_0x43b35a['options']);return db[_0x3f2e('0x2d')]['find'](_0x24df56)['then'](handleEntityNotFound(_0xe9000a,null))[_0x3f2e('0x41')](respondWithResult(_0xe9000a,null))[_0x3f2e('0x45')](handleError(_0xe9000a,null));};exports[_0x3f2e('0x48')]=function(_0x3d6fd2,_0x3e7fac){return db['MailQueueReport']['create'](_0x3d6fd2[_0x3f2e('0x49')],{})[_0x3f2e('0x41')](respondWithResult(_0x3e7fac,0xc9))[_0x3f2e('0x45')](handleError(_0x3e7fac,null));};exports[_0x3f2e('0x4a')]=function(_0x39dbd1,_0xb891b2){if(_0x39dbd1[_0x3f2e('0x49')]['id']){delete _0x39dbd1[_0x3f2e('0x49')]['id'];}return db[_0x3f2e('0x2d')]['find']({'where':{'id':_0x39dbd1['params']['id']}})[_0x3f2e('0x41')](handleEntityNotFound(_0xb891b2,null))['then'](saveUpdates(_0x39dbd1[_0x3f2e('0x49')],null))[_0x3f2e('0x41')](respondWithResult(_0xb891b2,null))[_0x3f2e('0x45')](handleError(_0xb891b2,null));};exports[_0x3f2e('0x4b')]=function(_0x4b6950,_0xd871da){return db['MailQueueReport'][_0x3f2e('0x4c')]({'where':{'id':_0x4b6950[_0x3f2e('0x47')]['id']}})['then'](handleEntityNotFound(_0xd871da,null))[_0x3f2e('0x41')](removeEntity(_0xd871da,null))['catch'](handleError(_0xd871da,null));};exports[_0x3f2e('0x4d')]=function(_0x336003,_0x9ccf3b){return db['MailQueueReport'][_0x3f2e('0x4d')]()[_0x3f2e('0x41')](respondWithResult(_0x9ccf3b,null))[_0x3f2e('0x45')](handleError(_0x9ccf3b,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8a2506d..d10323a 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 _0xda2b=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x39aba0,_0x5a5cf6){var _0x56dc38=function(_0x5f23a9){while(--_0x5f23a9){_0x39aba0['push'](_0x39aba0['shift']());}};_0x56dc38(++_0x5a5cf6);}(_0xda2b,0xa4));var _0xbda2=function(_0x2ccc71,_0x1c458a){_0x2ccc71=_0x2ccc71-0x0;var _0x20fa15=_0xda2b[_0x2ccc71];return _0x20fa15;};'use strict';var _=require(_0xbda2('0x0'));var util=require(_0xbda2('0x1'));var logger=require(_0xbda2('0x2'))(_0xbda2('0x3'));var moment=require(_0xbda2('0x4'));var BPromise=require('bluebird');var rp=require(_0xbda2('0x5'));var fs=require('fs');var path=require(_0xbda2('0x6'));var rimraf=require(_0xbda2('0x7'));var config=require(_0xbda2('0x8'));var attributes=require(_0xbda2('0x9'));module[_0xbda2('0xa')]=function(_0x410b50,_0x3c844c){return _0x410b50[_0xbda2('0xb')](_0xbda2('0xc'),attributes,{'tableName':_0xbda2('0xd'),'paranoid':![],'indexes':[{'name':_0xbda2('0xe'),'fields':[_0xbda2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2568=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2568,0x148));var _0x8256=function(_0x5177b9,_0x598b77){_0x5177b9=_0x5177b9-0x0;var _0x3f9640=_0x2568[_0x5177b9];return _0x3f9640;};'use strict';var _=require('lodash');var util=require(_0x8256('0x0'));var logger=require(_0x8256('0x1'))(_0x8256('0x2'));var moment=require(_0x8256('0x3'));var BPromise=require(_0x8256('0x4'));var rp=require(_0x8256('0x5'));var fs=require('fs');var path=require(_0x8256('0x6'));var rimraf=require('rimraf');var config=require(_0x8256('0x7'));var attributes=require(_0x8256('0x8'));module[_0x8256('0x9')]=function(_0x13ecbd,_0x3832c0){return _0x13ecbd[_0x8256('0xa')](_0x8256('0xb'),attributes,{'tableName':_0x8256('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8256('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 17391e6..9123541 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x274f7b,_0x600507){var _0x2469ee=function(_0x17a073){while(--_0x17a073){_0x274f7b['push'](_0x274f7b['shift']());}};_0x2469ee(++_0x600507);}(_0x1261,0x144));var _0x1126=function(_0x595b9b,_0xa58ff){_0x595b9b=_0x595b9b-0x0;var _0x3be4c6=_0x1261[_0x595b9b];return _0x3be4c6;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x37d7b5,_0x10bcd3){var _0x2b6669=function(_0x388f04){while(--_0x388f04){_0x37d7b5['push'](_0x37d7b5['shift']());}};_0x2b6669(++_0x10bcd3);}(_0x326f,0xd1));var _0xf326=function(_0x4ebed4,_0xc9760d){_0x4ebed4=_0x4ebed4-0x0;var _0x5613b8=_0x326f[_0x4ebed4];return _0x5613b8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 11b1aac..cb864e7 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(_0x100b81,_0x29a544){var _0x110c0c=function(_0xbe1749){while(--_0xbe1749){_0x100b81['push'](_0x100b81['shift']());}};_0x110c0c(++_0x29a544);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xcb91[_0x209941];return _0x1e8729;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1165cc,_0x40c602){var _0x1658f5=function(_0x375cff){while(--_0x375cff){_0x1165cc['push'](_0x1165cc['shift']());}};_0x1658f5(++_0x40c602);}(_0xe706,0xa3));var _0x6e70=function(_0x157ce5,_0xfa6b87){_0x157ce5=_0x157ce5-0x0;var _0x359c0c=_0xe706[_0x157ce5];return _0x359c0c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 8d2a93b..3a51295 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 _0xc36d=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x260077,_0x584090){var _0x26aea8=function(_0x5efcd5){while(--_0x5efcd5){_0x260077['push'](_0x260077['shift']());}};_0x26aea8(++_0x584090);}(_0xc36d,0x7d));var _0xdc36=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0xc36d[_0x10bcc4];return _0x2da988;};'use strict';var Sequelize=require(_0xdc36('0x0'));module[_0xdc36('0x1')]={'description':{'type':Sequelize[_0xdc36('0x2')]},'host':{'type':Sequelize[_0xdc36('0x2')]},'authentication':{'type':Sequelize[_0xdc36('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xdc36('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xdc36('0x4')]},'tls':{'type':Sequelize[_0xdc36('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xdc36('0x5')},'connTimeout':{'type':Sequelize[_0xdc36('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xdc36('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xdc36('0x2')]}}; \ No newline at end of file +var _0x7fce=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3527f2,_0x258224){var _0x5e1cdf=function(_0x48f452){while(--_0x48f452){_0x3527f2['push'](_0x3527f2['shift']());}};_0x5e1cdf(++_0x258224);}(_0x7fce,0xdc));var _0xe7fc=function(_0x176e2c,_0x2d0754){_0x176e2c=_0x176e2c-0x0;var _0x13b82a=_0x7fce[_0x176e2c];return _0x13b82a;};'use strict';var Sequelize=require(_0xe7fc('0x0'));module[_0xe7fc('0x1')]={'description':{'type':Sequelize[_0xe7fc('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe7fc('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe7fc('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xe7fc('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe7fc('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe7fc('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 547d80f..78f018c 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 _0xa004=['mail_servers_in','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x4a698b,_0x3c8ee2){var _0x62d55f=function(_0x48b492){while(--_0x48b492){_0x4a698b['push'](_0x4a698b['shift']());}};_0x62d55f(++_0x3c8ee2);}(_0xa004,0xcd));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4a00('0x0'));var util=require(_0x4a00('0x1'));var logger=require(_0x4a00('0x2'))(_0x4a00('0x3'));var moment=require(_0x4a00('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a00('0x5'));var rimraf=require(_0x4a00('0x6'));var config=require(_0x4a00('0x7'));var attributes=require(_0x4a00('0x8'));module[_0x4a00('0x9')]=function(_0x18abcd,_0x33b6c7){return _0x18abcd[_0x4a00('0xa')]('MailServerIn',attributes,{'tableName':_0x4a00('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf22d=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','bluebird','path','rimraf'];(function(_0x374574,_0x5e4e39){var _0x5d28f5=function(_0xc1ab76){while(--_0xc1ab76){_0x374574['push'](_0x374574['shift']());}};_0x5d28f5(++_0x5e4e39);}(_0xf22d,0x1d4));var _0xdf22=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0xf22d[_0x2459fd];return _0x364cd2;};'use strict';var _=require(_0xdf22('0x0'));var util=require('util');var logger=require(_0xdf22('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdf22('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf22('0x3'));var rimraf=require(_0xdf22('0x4'));var config=require(_0xdf22('0x5'));var attributes=require(_0xdf22('0x6'));module[_0xdf22('0x7')]=function(_0x12b824,_0xf9259){return _0x12b824[_0xdf22('0x8')](_0xdf22('0x9'),attributes,{'tableName':_0xdf22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index a438278..98ffae2 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 _0x80db=['MailServerIn','options','where','attributes','map','include','model','info','GetMailServerIn','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x80db,0x174));var _0xb80d=function(_0x54a728,_0x1ff930){_0x54a728=_0x54a728-0x0;var _0x56a3e6=_0x80db[_0x54a728];return _0x56a3e6;};'use strict';var _=require(_0xb80d('0x0'));var util=require(_0xb80d('0x1'));var moment=require('moment');var BPromise=require(_0xb80d('0x2'));var rs=require(_0xb80d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb80d('0x4'))['db'];var utils=require(_0xb80d('0x5'));var logger=require(_0xb80d('0x6'))(_0xb80d('0x7'));var config=require(_0xb80d('0x8'));var jayson=require(_0xb80d('0x9'));var client=jayson[_0xb80d('0xa')][_0xb80d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40bd8a,_0x50bb0d,_0x6d08f8){return new BPromise(function(_0x26a38a,_0x189662){return client[_0xb80d('0xc')](_0x40bd8a,_0x6d08f8)[_0xb80d('0xd')](function(_0x3a9952){logger['info'](_0xb80d('0xe'),_0x50bb0d,'request\x20sent');logger[_0xb80d('0xf')](_0xb80d('0x10'),_0x50bb0d,_0xb80d('0x11'),JSON[_0xb80d('0x12')](_0x3a9952));if(_0x3a9952['error']){if(_0x3a9952[_0xb80d('0x13')][_0xb80d('0x14')]===0x1f4){logger[_0xb80d('0x13')](_0xb80d('0xe'),_0x50bb0d,_0x3a9952['error'][_0xb80d('0x15')]);return _0x189662(_0x3a9952[_0xb80d('0x13')][_0xb80d('0x15')]);}logger[_0xb80d('0x13')](_0xb80d('0xe'),_0x50bb0d,_0x3a9952[_0xb80d('0x13')]['message']);return _0x26a38a(_0x3a9952[_0xb80d('0x13')][_0xb80d('0x15')]);}else{logger['info'](_0xb80d('0xe'),_0x50bb0d,_0xb80d('0x11'));_0x26a38a(_0x3a9952[_0xb80d('0x16')][_0xb80d('0x15')]);}})[_0xb80d('0x17')](function(_0x1673ee){logger[_0xb80d('0x13')]('MailServerIn,\x20%s,\x20%s',_0x50bb0d,_0x1673ee);_0x189662(_0x1673ee);});});}exports['GetMailServerIn']=function(_0x335237){var _0x26e1a9=this;return new Promise(function(_0x5a628a,_0x3f9d51){return db[_0xb80d('0x18')]['findAll']({'raw':_0x335237[_0xb80d('0x19')]?_0x335237[_0xb80d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x335237[_0xb80d('0x19')]?_0x335237[_0xb80d('0x19')][_0xb80d('0x1a')]||null:null,'attributes':_0x335237[_0xb80d('0x19')]?_0x335237['options'][_0xb80d('0x1b')]||null:null,'limit':_0x335237[_0xb80d('0x19')]?_0x335237['options']['limit']||null:null,'include':_0x335237['options']?_0x335237[_0xb80d('0x19')]['include']?_[_0xb80d('0x1c')](_0x335237['options'][_0xb80d('0x1d')],function(_0x593954){return{'model':db[_0x593954[_0xb80d('0x1e')]],'as':_0x593954['as'],'attributes':_0x593954[_0xb80d('0x1b')],'include':_0x593954[_0xb80d('0x1d')]?_[_0xb80d('0x1c')](_0x593954[_0xb80d('0x1d')],function(_0x1cce1b){return{'model':db[_0x1cce1b['model']],'as':_0x1cce1b['as'],'attributes':_0x1cce1b[_0xb80d('0x1b')],'include':_0x1cce1b[_0xb80d('0x1d')]?_[_0xb80d('0x1c')](_0x1cce1b[_0xb80d('0x1d')],function(_0x46dcb3){return{'model':db[_0x46dcb3[_0xb80d('0x1e')]],'as':_0x46dcb3['as'],'attributes':_0x46dcb3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x7cfff7){logger[_0xb80d('0x1f')](_0xb80d('0x20'),_0x335237);logger[_0xb80d('0xf')]('GetMailServerIn',_0x335237,JSON['stringify'](_0x7cfff7));_0x5a628a(_0x7cfff7);})[_0xb80d('0x17')](function(_0x17d982){logger[_0xb80d('0x13')](_0xb80d('0x20'),_0x17d982[_0xb80d('0x15')],_0x335237);_0x3f9d51(_0x26e1a9[_0xb80d('0x13')](0x1f4,_0x17d982['message']));});});}; \ No newline at end of file +var _0xb5ca=['jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetMailServerIn','MailServerIn','options','attributes','limit','include','map','model','stringify','lodash','util','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x3a7db0,_0xe93c50){var _0x17cbba=function(_0x577f4c){while(--_0x577f4c){_0x3a7db0['push'](_0x3a7db0['shift']());}};_0x17cbba(++_0xe93c50);}(_0xb5ca,0xa2));var _0xab5c=function(_0x4e7d2f,_0x2c67b0){_0x4e7d2f=_0x4e7d2f-0x0;var _0x34c7bd=_0xb5ca[_0x4e7d2f];return _0x34c7bd;};'use strict';var _=require(_0xab5c('0x0'));var util=require(_0xab5c('0x1'));var moment=require('moment');var BPromise=require(_0xab5c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab5c('0x3'));var logger=require(_0xab5c('0x4'))(_0xab5c('0x5'));var config=require('../../config/environment');var jayson=require(_0xab5c('0x6'));var client=jayson[_0xab5c('0x7')][_0xab5c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x275a13,_0x707d6f,_0x69e598){return new BPromise(function(_0x8a6648,_0x351471){return client[_0xab5c('0x9')](_0x275a13,_0x69e598)[_0xab5c('0xa')](function(_0x3638c4){logger[_0xab5c('0xb')](_0xab5c('0xc'),_0x707d6f,_0xab5c('0xd'));logger[_0xab5c('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x707d6f,_0xab5c('0xd'),JSON['stringify'](_0x3638c4));if(_0x3638c4['error']){if(_0x3638c4[_0xab5c('0xf')]['code']===0x1f4){logger[_0xab5c('0xf')](_0xab5c('0xc'),_0x707d6f,_0x3638c4['error']['message']);return _0x351471(_0x3638c4[_0xab5c('0xf')][_0xab5c('0x10')]);}logger[_0xab5c('0xf')](_0xab5c('0xc'),_0x707d6f,_0x3638c4[_0xab5c('0xf')][_0xab5c('0x10')]);return _0x8a6648(_0x3638c4[_0xab5c('0xf')][_0xab5c('0x10')]);}else{logger['info'](_0xab5c('0xc'),_0x707d6f,_0xab5c('0xd'));_0x8a6648(_0x3638c4[_0xab5c('0x11')][_0xab5c('0x10')]);}})[_0xab5c('0x12')](function(_0x3f4b05){logger[_0xab5c('0xf')](_0xab5c('0xc'),_0x707d6f,_0x3f4b05);_0x351471(_0x3f4b05);});});}exports[_0xab5c('0x13')]=function(_0x4fa163){var _0x4e9691=this;return new Promise(function(_0x4c37e5,_0x177567){return db[_0xab5c('0x14')]['findAll']({'raw':_0x4fa163[_0xab5c('0x15')]?_0x4fa163[_0xab5c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4fa163[_0xab5c('0x15')]?_0x4fa163['options']['where']||null:null,'attributes':_0x4fa163[_0xab5c('0x15')]?_0x4fa163[_0xab5c('0x15')][_0xab5c('0x16')]||null:null,'limit':_0x4fa163[_0xab5c('0x15')]?_0x4fa163[_0xab5c('0x15')][_0xab5c('0x17')]||null:null,'include':_0x4fa163[_0xab5c('0x15')]?_0x4fa163[_0xab5c('0x15')][_0xab5c('0x18')]?_[_0xab5c('0x19')](_0x4fa163[_0xab5c('0x15')][_0xab5c('0x18')],function(_0x4fdfa6){return{'model':db[_0x4fdfa6[_0xab5c('0x1a')]],'as':_0x4fdfa6['as'],'attributes':_0x4fdfa6['attributes'],'include':_0x4fdfa6[_0xab5c('0x18')]?_[_0xab5c('0x19')](_0x4fdfa6[_0xab5c('0x18')],function(_0x35d125){return{'model':db[_0x35d125['model']],'as':_0x35d125['as'],'attributes':_0x35d125['attributes'],'include':_0x35d125[_0xab5c('0x18')]?_[_0xab5c('0x19')](_0x35d125['include'],function(_0x10de04){return{'model':db[_0x10de04[_0xab5c('0x1a')]],'as':_0x10de04['as'],'attributes':_0x10de04[_0xab5c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab5c('0xa')](function(_0x2016a0){logger[_0xab5c('0xb')]('GetMailServerIn',_0x4fa163);logger[_0xab5c('0xe')](_0xab5c('0x13'),_0x4fa163,JSON[_0xab5c('0x1b')](_0x2016a0));_0x4c37e5(_0x2016a0);})[_0xab5c('0x12')](function(_0x43aaf3){logger[_0xab5c('0xf')](_0xab5c('0x13'),_0x43aaf3['message'],_0x4fa163);_0x177567(_0x4e9691[_0xab5c('0xf')](0x1f4,_0x43aaf3['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index e5a31a9..3442bac 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(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7a54,0x106));var _0x47a5=function(_0x595329,_0x5d999d){_0x595329=_0x595329-0x0;var _0x3f6f56=_0x7a54[_0x595329];return _0x3f6f56;};'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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7a54,0x106));var _0x47a5=function(_0xedb3c2,_0x5fe695){_0xedb3c2=_0xedb3c2-0x0;var _0x178c6b=_0x7a54[_0xedb3c2];return _0x178c6b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index b546740..0a0c77e 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 _0xa1cc=['exports','STRING','INTEGER','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa1cc,0x10f));var _0xca1c=function(_0x362f6b,_0x1836ec){_0x362f6b=_0x362f6b-0x0;var _0x423571=_0xa1cc[_0x362f6b];return _0x423571;};'use strict';var Sequelize=require(_0xca1c('0x0'));module[_0xca1c('0x1')]={'description':{'type':Sequelize[_0xca1c('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xca1c('0x2')]},'pass':{'type':Sequelize[_0xca1c('0x2')]},'port':{'type':Sequelize[_0xca1c('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xca1c('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x53a5=['STRING','BOOLEAN','exports'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x53a5,0x188));var _0x553a=function(_0x267266,_0x239c2e){_0x267266=_0x267266-0x0;var _0x2246d6=_0x53a5[_0x267266];return _0x2246d6;};'use strict';var Sequelize=require('sequelize');module[_0x553a('0x0')]={'description':{'type':Sequelize[_0x553a('0x1')]},'host':{'type':Sequelize[_0x553a('0x1')]},'user':{'type':Sequelize[_0x553a('0x1')]},'pass':{'type':Sequelize[_0x553a('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x553a('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x553a('0x1')]},'authentication':{'type':Sequelize[_0x553a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 9d0e8d1..4eb78fb 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 _0x643f=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','MailServerOut','rawAttributes','fieldName','type','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3771d9,_0x2e1308){var _0x369c9c=function(_0x57e52e){while(--_0x57e52e){_0x3771d9['push'](_0x3771d9['shift']());}};_0x369c9c(++_0x2e1308);}(_0x643f,0x123));var _0xf643=function(_0x5c6210,_0x1310b7){_0x5c6210=_0x5c6210-0x0;var _0xe4c7a1=_0x643f[_0x5c6210];return _0xe4c7a1;};'use strict';var emlformat=require(_0xf643('0x0'));var rimraf=require(_0xf643('0x1'));var zipdir=require(_0xf643('0x2'));var jsonpatch=require(_0xf643('0x3'));var rp=require(_0xf643('0x4'));var moment=require(_0xf643('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf643('0x6'));var util=require(_0xf643('0x7'));var path=require(_0xf643('0x8'));var sox=require(_0xf643('0x9'));var csv=require(_0xf643('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf643('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf643('0xc'));var jsforce=require(_0xf643('0xd'));var deskjs=require(_0xf643('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf643('0xf'));var Papa=require(_0xf643('0x10'));var Redis=require(_0xf643('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf643('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf643('0x13'))(_0xf643('0x14'));var utils=require(_0xf643('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf643('0x16'));var db=require(_0xf643('0x17'))['db'];function respondWithStatusCode(_0x1e3415,_0x58f570){_0x58f570=_0x58f570||0xcc;return function(_0x4f1f99){if(_0x4f1f99){return _0x1e3415[_0xf643('0x18')](_0x58f570);}return _0x1e3415[_0xf643('0x19')](_0x58f570)['end']();};}function respondWithResult(_0xb45fb2,_0x53845c){_0x53845c=_0x53845c||0xc8;return function(_0x2ec618){if(_0x2ec618){return _0xb45fb2[_0xf643('0x19')](_0x53845c)[_0xf643('0x1a')](_0x2ec618);}};}function respondWithFilteredResult(_0x28629c,_0x5eb55a){return function(_0x2222ed){if(_0x2222ed){var _0x3cea17=typeof _0x5eb55a['offset']===_0xf643('0x1b')&&typeof _0x5eb55a[_0xf643('0x1c')]==='undefined';var _0x479420=_0x2222ed['count'];var _0x5cbfe7=_0x3cea17?0x0:_0x5eb55a[_0xf643('0x1d')];var _0x9c9c07=_0x3cea17?_0x2222ed[_0xf643('0x1e')]:_0x5eb55a[_0xf643('0x1d')]+_0x5eb55a[_0xf643('0x1c')];var _0x3f758f;if(_0x9c9c07>=_0x479420){_0x9c9c07=_0x479420;_0x3f758f=0xc8;}else{_0x3f758f=0xce;}_0x28629c[_0xf643('0x19')](_0x3f758f);return _0x28629c[_0xf643('0x1f')](_0xf643('0x20'),_0x5cbfe7+'-'+_0x9c9c07+'/'+_0x479420)['json'](_0x2222ed);}return null;};}function patchUpdates(_0x15c40c){return function(_0x571b5c){try{jsonpatch[_0xf643('0x21')](_0x571b5c,_0x15c40c,!![]);}catch(_0x4a13f5){return BPromise[_0xf643('0x22')](_0x4a13f5);}return _0x571b5c[_0xf643('0x23')]();};}function saveUpdates(_0x118a71,_0x11ae7a){return function(_0x503568){if(_0x503568){return _0x503568[_0xf643('0x24')](_0x118a71)[_0xf643('0x25')](function(_0x4c03ff){return _0x4c03ff;});}return null;};}function removeEntity(_0x8a1a1e,_0x452d88){return function(_0x26b6ec){if(_0x26b6ec){return _0x26b6ec[_0xf643('0x26')]()[_0xf643('0x25')](function(){_0x8a1a1e[_0xf643('0x19')](0xcc)[_0xf643('0x27')]();});}};}function handleEntityNotFound(_0x32fa8d,_0xb3a30){return function(_0x377f1e){if(!_0x377f1e){_0x32fa8d[_0xf643('0x18')](0x194);}return _0x377f1e;};}function handleError(_0x1002ac,_0x2f7038){_0x2f7038=_0x2f7038||0x1f4;return function(_0x25bb1b){logger[_0xf643('0x28')](_0x25bb1b[_0xf643('0x29')]);if(_0x25bb1b['name']){delete _0x25bb1b['name'];}_0x1002ac[_0xf643('0x19')](_0x2f7038)[_0xf643('0x2a')](_0x25bb1b);};}exports[_0xf643('0x2b')]=function(_0x2ff118,_0x2c3410){var _0x4fa18a={},_0x2181e1={},_0x5b0062={'count':0x0,'rows':[]};var _0x30f567=_[_0xf643('0x2c')](db[_0xf643('0x2d')][_0xf643('0x2e')],function(_0x29ad50){return{'name':_0x29ad50[_0xf643('0x2f')],'type':_0x29ad50[_0xf643('0x30')]['key']};});_0x2181e1['model']=_[_0xf643('0x2c')](_0x30f567,_0xf643('0x31'));_0x2181e1[_0xf643('0x32')]=_[_0xf643('0x33')](_0x2ff118[_0xf643('0x32')]);_0x2181e1['filters']=_[_0xf643('0x34')](_0x2181e1[_0xf643('0x35')],_0x2181e1[_0xf643('0x32')]);_0x4fa18a[_0xf643('0x36')]=_[_0xf643('0x34')](_0x2181e1['model'],qs[_0xf643('0x37')](_0x2ff118[_0xf643('0x32')]['fields']));_0x4fa18a['attributes']=_0x4fa18a[_0xf643('0x36')][_0xf643('0x38')]?_0x4fa18a[_0xf643('0x36')]:_0x2181e1[_0xf643('0x35')];if(!_0x2ff118[_0xf643('0x32')][_0xf643('0x39')](_0xf643('0x3a'))){_0x4fa18a['limit']=qs[_0xf643('0x1c')](_0x2ff118[_0xf643('0x32')]['limit']);_0x4fa18a[_0xf643('0x1d')]=qs[_0xf643('0x1d')](_0x2ff118[_0xf643('0x32')][_0xf643('0x1d')]);}_0x4fa18a['order']=qs['sort'](_0x2ff118[_0xf643('0x32')][_0xf643('0x3b')]);_0x4fa18a[_0xf643('0x3c')]=qs[_0xf643('0x3d')](_[_0xf643('0x3e')](_0x2ff118[_0xf643('0x32')],_0x2181e1[_0xf643('0x3d')]),_0x30f567);if(_0x2ff118[_0xf643('0x32')]['filter']){_0x4fa18a[_0xf643('0x3c')]=_['merge'](_0x4fa18a[_0xf643('0x3c')],{'$or':_[_0xf643('0x2c')](_0x30f567,function(_0x401472){if(_0x401472[_0xf643('0x30')]!==_0xf643('0x3f')){var _0x3418ba={};_0x3418ba[_0x401472[_0xf643('0x31')]]={'$like':'%'+_0x2ff118[_0xf643('0x32')][_0xf643('0x40')]+'%'};return _0x3418ba;}})});}_0x4fa18a=_[_0xf643('0x41')]({},_0x4fa18a,_0x2ff118['options']);var _0x5e7e36={'where':_0x4fa18a[_0xf643('0x3c')]};return db['MailServerOut']['count'](_0x5e7e36)[_0xf643('0x25')](function(_0x1081a3){_0x5b0062[_0xf643('0x1e')]=_0x1081a3;if(_0x2ff118[_0xf643('0x32')]['includeAll']){_0x4fa18a[_0xf643('0x42')]=[{'all':!![]}];}return db['MailServerOut'][_0xf643('0x43')](_0x4fa18a);})['then'](function(_0x484404){_0x5b0062[_0xf643('0x44')]=_0x484404;return _0x5b0062;})[_0xf643('0x25')](respondWithFilteredResult(_0x2c3410,_0x4fa18a))[_0xf643('0x45')](handleError(_0x2c3410,null));};exports[_0xf643('0x46')]=function(_0x5dc8fe,_0x226044){var _0x431c8b={'raw':!![],'where':{'id':_0x5dc8fe[_0xf643('0x47')]['id']}},_0x29659c={};_0x29659c[_0xf643('0x35')]=_[_0xf643('0x33')](db[_0xf643('0x2d')][_0xf643('0x2e')]);_0x29659c[_0xf643('0x32')]=_[_0xf643('0x33')](_0x5dc8fe[_0xf643('0x32')]);_0x29659c[_0xf643('0x3d')]=_[_0xf643('0x34')](_0x29659c[_0xf643('0x35')],_0x29659c['query']);_0x431c8b[_0xf643('0x36')]=_['intersection'](_0x29659c[_0xf643('0x35')],qs[_0xf643('0x37')](_0x5dc8fe[_0xf643('0x32')][_0xf643('0x37')]));_0x431c8b[_0xf643('0x36')]=_0x431c8b[_0xf643('0x36')][_0xf643('0x38')]?_0x431c8b[_0xf643('0x36')]:_0x29659c[_0xf643('0x35')];if(_0x5dc8fe[_0xf643('0x32')][_0xf643('0x48')]){_0x431c8b[_0xf643('0x42')]=[{'all':!![]}];}_0x431c8b=_[_0xf643('0x41')]({},_0x431c8b,_0x5dc8fe[_0xf643('0x49')]);return db[_0xf643('0x2d')][_0xf643('0x4a')](_0x431c8b)['then'](handleEntityNotFound(_0x226044,null))[_0xf643('0x25')](respondWithResult(_0x226044,null))[_0xf643('0x45')](handleError(_0x226044,null));};exports[_0xf643('0x4b')]=function(_0x5d4538,_0x1e6f2c){return db['MailServerOut'][_0xf643('0x4b')](_0x5d4538['body'],{})[_0xf643('0x25')](respondWithResult(_0x1e6f2c,0xc9))[_0xf643('0x45')](handleError(_0x1e6f2c,null));};exports[_0xf643('0x24')]=function(_0x376aaf,_0x38be89){if(_0x376aaf['body']['id']){delete _0x376aaf[_0xf643('0x4c')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x376aaf[_0xf643('0x47')]['id']}})[_0xf643('0x25')](handleEntityNotFound(_0x38be89,null))['then'](saveUpdates(_0x376aaf[_0xf643('0x4c')],null))['then'](respondWithResult(_0x38be89,null))[_0xf643('0x45')](handleError(_0x38be89,null));};exports[_0xf643('0x26')]=function(_0x494622,_0x368786){return db['MailServerOut'][_0xf643('0x4a')]({'where':{'id':_0x494622[_0xf643('0x47')]['id']}})[_0xf643('0x25')](handleEntityNotFound(_0x368786,null))[_0xf643('0x25')](removeEntity(_0x368786,null))[_0xf643('0x45')](handleError(_0x368786,null));}; \ No newline at end of file +var _0xefee=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','apply','reject','save','update','then','destroy','end','error','name','index','MailServerOut','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xefee,0x19c));var _0xeefe=function(_0x2abbd4,_0x4c0048){_0x2abbd4=_0x2abbd4-0x0;var _0xd859c4=_0xefee[_0x2abbd4];return _0xd859c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeefe('0x0'));var BPromise=require(_0xeefe('0x1'));var Mustache=require('mustache');var util=require(_0xeefe('0x2'));var path=require('path');var sox=require(_0xeefe('0x3'));var csv=require(_0xeefe('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeefe('0x5'));var _=require(_0xeefe('0x6'));var squel=require(_0xeefe('0x7'));var crypto=require('crypto');var jsforce=require(_0xeefe('0x8'));var deskjs=require(_0xeefe('0x9'));var toCsv=require(_0xeefe('0x4'));var querystring=require(_0xeefe('0xa'));var Papa=require(_0xeefe('0xb'));var Redis=require('ioredis');var authService=require(_0xeefe('0xc'));var qs=require(_0xeefe('0xd'));var as=require(_0xeefe('0xe'));var hardwareService=require(_0xeefe('0xf'));var logger=require(_0xeefe('0x10'))(_0xeefe('0x11'));var utils=require('../../config/utils');var config=require(_0xeefe('0x12'));var licenseUtil=require(_0xeefe('0x13'));var db=require(_0xeefe('0x14'))['db'];function respondWithStatusCode(_0x1bdd2f,_0x4fa0eb){_0x4fa0eb=_0x4fa0eb||0xcc;return function(_0x29f3fd){if(_0x29f3fd){return _0x1bdd2f[_0xeefe('0x15')](_0x4fa0eb);}return _0x1bdd2f[_0xeefe('0x16')](_0x4fa0eb)['end']();};}function respondWithResult(_0x217937,_0x5c212d){_0x5c212d=_0x5c212d||0xc8;return function(_0x2f5fee){if(_0x2f5fee){return _0x217937[_0xeefe('0x16')](_0x5c212d)[_0xeefe('0x17')](_0x2f5fee);}};}function respondWithFilteredResult(_0x4df7e7,_0xf8008a){return function(_0x31fe3b){if(_0x31fe3b){var _0x211eb2=typeof _0xf8008a[_0xeefe('0x18')]===_0xeefe('0x19')&&typeof _0xf8008a['limit']===_0xeefe('0x19');var _0x335c6e=_0x31fe3b[_0xeefe('0x1a')];var _0x457263=_0x211eb2?0x0:_0xf8008a[_0xeefe('0x18')];var _0x37a1a8=_0x211eb2?_0x31fe3b[_0xeefe('0x1a')]:_0xf8008a['offset']+_0xf8008a['limit'];var _0x12b66c;if(_0x37a1a8>=_0x335c6e){_0x37a1a8=_0x335c6e;_0x12b66c=0xc8;}else{_0x12b66c=0xce;}_0x4df7e7[_0xeefe('0x16')](_0x12b66c);return _0x4df7e7['set']('Content-Range',_0x457263+'-'+_0x37a1a8+'/'+_0x335c6e)['json'](_0x31fe3b);}return null;};}function patchUpdates(_0x498926){return function(_0x141f52){try{jsonpatch[_0xeefe('0x1b')](_0x141f52,_0x498926,!![]);}catch(_0x304f81){return BPromise[_0xeefe('0x1c')](_0x304f81);}return _0x141f52[_0xeefe('0x1d')]();};}function saveUpdates(_0x308460,_0x4d6592){return function(_0x1859a6){if(_0x1859a6){return _0x1859a6[_0xeefe('0x1e')](_0x308460)[_0xeefe('0x1f')](function(_0x6ce0b3){return _0x6ce0b3;});}return null;};}function removeEntity(_0x46de4d,_0x2a855a){return function(_0x519da0){if(_0x519da0){return _0x519da0[_0xeefe('0x20')]()[_0xeefe('0x1f')](function(){_0x46de4d['status'](0xcc)[_0xeefe('0x21')]();});}};}function handleEntityNotFound(_0x268276,_0x6a9526){return function(_0x48a1d8){if(!_0x48a1d8){_0x268276[_0xeefe('0x15')](0x194);}return _0x48a1d8;};}function handleError(_0x313064,_0x547717){_0x547717=_0x547717||0x1f4;return function(_0x16e7bd){logger[_0xeefe('0x22')](_0x16e7bd['stack']);if(_0x16e7bd[_0xeefe('0x23')]){delete _0x16e7bd[_0xeefe('0x23')];}_0x313064[_0xeefe('0x16')](_0x547717)['send'](_0x16e7bd);};}exports[_0xeefe('0x24')]=function(_0x52babb,_0x1ab491){var _0x4883cd={},_0x3980d1={},_0x348245={'count':0x0,'rows':[]};var _0x4a7cc1=_['map'](db[_0xeefe('0x25')][_0xeefe('0x26')],function(_0x3f4aab){return{'name':_0x3f4aab[_0xeefe('0x27')],'type':_0x3f4aab['type'][_0xeefe('0x28')]};});_0x3980d1[_0xeefe('0x29')]=_[_0xeefe('0x2a')](_0x4a7cc1,'name');_0x3980d1['query']=_[_0xeefe('0x2b')](_0x52babb[_0xeefe('0x2c')]);_0x3980d1[_0xeefe('0x2d')]=_['intersection'](_0x3980d1[_0xeefe('0x29')],_0x3980d1['query']);_0x4883cd['attributes']=_[_0xeefe('0x2e')](_0x3980d1['model'],qs[_0xeefe('0x2f')](_0x52babb['query']['fields']));_0x4883cd['attributes']=_0x4883cd[_0xeefe('0x30')][_0xeefe('0x31')]?_0x4883cd[_0xeefe('0x30')]:_0x3980d1[_0xeefe('0x29')];if(!_0x52babb[_0xeefe('0x2c')][_0xeefe('0x32')](_0xeefe('0x33'))){_0x4883cd[_0xeefe('0x34')]=qs['limit'](_0x52babb[_0xeefe('0x2c')][_0xeefe('0x34')]);_0x4883cd[_0xeefe('0x18')]=qs[_0xeefe('0x18')](_0x52babb['query'][_0xeefe('0x18')]);}_0x4883cd[_0xeefe('0x35')]=qs[_0xeefe('0x36')](_0x52babb[_0xeefe('0x2c')][_0xeefe('0x36')]);_0x4883cd[_0xeefe('0x37')]=qs[_0xeefe('0x2d')](_[_0xeefe('0x38')](_0x52babb[_0xeefe('0x2c')],_0x3980d1['filters']),_0x4a7cc1);if(_0x52babb[_0xeefe('0x2c')][_0xeefe('0x39')]){_0x4883cd['where']=_[_0xeefe('0x3a')](_0x4883cd[_0xeefe('0x37')],{'$or':_[_0xeefe('0x2a')](_0x4a7cc1,function(_0x116dc2){if(_0x116dc2[_0xeefe('0x3b')]!==_0xeefe('0x3c')){var _0xeb1279={};_0xeb1279[_0x116dc2[_0xeefe('0x23')]]={'$like':'%'+_0x52babb[_0xeefe('0x2c')]['filter']+'%'};return _0xeb1279;}})});}_0x4883cd=_[_0xeefe('0x3a')]({},_0x4883cd,_0x52babb[_0xeefe('0x3d')]);var _0x742efa={'where':_0x4883cd[_0xeefe('0x37')]};return db['MailServerOut'][_0xeefe('0x1a')](_0x742efa)[_0xeefe('0x1f')](function(_0x5b8b3f){_0x348245[_0xeefe('0x1a')]=_0x5b8b3f;if(_0x52babb[_0xeefe('0x2c')][_0xeefe('0x3e')]){_0x4883cd[_0xeefe('0x3f')]=[{'all':!![]}];}return db[_0xeefe('0x25')][_0xeefe('0x40')](_0x4883cd);})[_0xeefe('0x1f')](function(_0x26cb1b){_0x348245[_0xeefe('0x41')]=_0x26cb1b;return _0x348245;})[_0xeefe('0x1f')](respondWithFilteredResult(_0x1ab491,_0x4883cd))['catch'](handleError(_0x1ab491,null));};exports['show']=function(_0x455b1e,_0x2a3a73){var _0x336f6b={'raw':!![],'where':{'id':_0x455b1e[_0xeefe('0x42')]['id']}},_0x573125={};_0x573125[_0xeefe('0x29')]=_[_0xeefe('0x2b')](db[_0xeefe('0x25')][_0xeefe('0x26')]);_0x573125[_0xeefe('0x2c')]=_[_0xeefe('0x2b')](_0x455b1e[_0xeefe('0x2c')]);_0x573125['filters']=_[_0xeefe('0x2e')](_0x573125[_0xeefe('0x29')],_0x573125[_0xeefe('0x2c')]);_0x336f6b['attributes']=_[_0xeefe('0x2e')](_0x573125[_0xeefe('0x29')],qs['fields'](_0x455b1e[_0xeefe('0x2c')]['fields']));_0x336f6b[_0xeefe('0x30')]=_0x336f6b[_0xeefe('0x30')][_0xeefe('0x31')]?_0x336f6b[_0xeefe('0x30')]:_0x573125['model'];if(_0x455b1e[_0xeefe('0x2c')][_0xeefe('0x3e')]){_0x336f6b[_0xeefe('0x3f')]=[{'all':!![]}];}_0x336f6b=_[_0xeefe('0x3a')]({},_0x336f6b,_0x455b1e['options']);return db[_0xeefe('0x25')][_0xeefe('0x43')](_0x336f6b)['then'](handleEntityNotFound(_0x2a3a73,null))[_0xeefe('0x1f')](respondWithResult(_0x2a3a73,null))[_0xeefe('0x44')](handleError(_0x2a3a73,null));};exports[_0xeefe('0x45')]=function(_0x3c04e0,_0x6c3518){return db[_0xeefe('0x25')][_0xeefe('0x45')](_0x3c04e0[_0xeefe('0x46')],{})[_0xeefe('0x1f')](respondWithResult(_0x6c3518,0xc9))['catch'](handleError(_0x6c3518,null));};exports['update']=function(_0x4d2355,_0x5408f7){if(_0x4d2355[_0xeefe('0x46')]['id']){delete _0x4d2355[_0xeefe('0x46')]['id'];}return db['MailServerOut'][_0xeefe('0x43')]({'where':{'id':_0x4d2355[_0xeefe('0x42')]['id']}})[_0xeefe('0x1f')](handleEntityNotFound(_0x5408f7,null))[_0xeefe('0x1f')](saveUpdates(_0x4d2355['body'],null))[_0xeefe('0x1f')](respondWithResult(_0x5408f7,null))['catch'](handleError(_0x5408f7,null));};exports[_0xeefe('0x20')]=function(_0x472931,_0x16c4a6){return db['MailServerOut'][_0xeefe('0x43')]({'where':{'id':_0x472931[_0xeefe('0x42')]['id']}})['then'](handleEntityNotFound(_0x16c4a6,null))[_0xeefe('0x1f')](removeEntity(_0x16c4a6,null))[_0xeefe('0x44')](handleError(_0x16c4a6,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9519484..4c67f0d 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 _0x21a5=['exports','define','MailServerOut','lodash','moment','bluebird','path','./mailServerOut.attributes'];(function(_0x475ef0,_0x398551){var _0x27391e=function(_0x4ae8c4){while(--_0x4ae8c4){_0x475ef0['push'](_0x475ef0['shift']());}};_0x27391e(++_0x398551);}(_0x21a5,0x113));var _0x521a=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x21a5[_0x1562a2];return _0x39a636;};'use strict';var _=require(_0x521a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x521a('0x1'));var BPromise=require(_0x521a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x521a('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x521a('0x4'));module[_0x521a('0x5')]=function(_0x539581,_0x27f459){return _0x539581[_0x521a('0x6')](_0x521a('0x7'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80d9=['define','MailServerOut','mail_servers_out','lodash','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x80d9,0xdf));var _0x980d=function(_0x4ad5f8,_0x123b12){_0x4ad5f8=_0x4ad5f8-0x0;var _0x3876d9=_0x80d9[_0x4ad5f8];return _0x3876d9;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x980d('0x1'));var moment=require(_0x980d('0x2'));var BPromise=require('bluebird');var rp=require(_0x980d('0x3'));var fs=require('fs');var path=require(_0x980d('0x4'));var rimraf=require('rimraf');var config=require(_0x980d('0x5'));var attributes=require('./mailServerOut.attributes');module[_0x980d('0x6')]=function(_0x4e9599,_0xb74021){return _0x4e9599[_0x980d('0x7')](_0x980d('0x8'),attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 3462766..be2ebcf 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x4499db,_0x195af5){_0x4499db=_0x4499db-0x0;var _0xe49bc6=_0x7a54[_0x4499db];return _0xe49bc6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2cd534,_0x2c5209){var _0x4498f8=function(_0x1d960e){while(--_0x1d960e){_0x2cd534['push'](_0x2cd534['shift']());}};_0x4498f8(++_0x2c5209);}(_0x5f2f,0x73));var _0xf5f2=function(_0x18f77c,_0x42b4ed){_0x18f77c=_0x18f77c-0x0;var _0x5bc329=_0x5f2f[_0x18f77c];return _0x5bc329;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 00d346e..0184513 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 _0x8daa=['show','post','create','put','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5598e1,_0x353e50){var _0x2f938f=function(_0x592b4f){while(--_0x592b4f){_0x5598e1['push'](_0x5598e1['shift']());}};_0x2f938f(++_0x353e50);}(_0x8daa,0x124));var _0xa8da=function(_0x3d5f84,_0x569548){_0x3d5f84=_0x3d5f84-0x0;var _0x1981b8=_0x8daa[_0x3d5f84];return _0x1981b8;};'use strict';var multer=require(_0xa8da('0x0'));var util=require(_0xa8da('0x1'));var path=require(_0xa8da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa8da('0x3'));var auth=require(_0xa8da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa8da('0x5'));var controller=require('./mailSubstatus.controller');router[_0xa8da('0x6')]('/',auth[_0xa8da('0x7')](),controller[_0xa8da('0x8')]);router[_0xa8da('0x6')](_0xa8da('0x9'),auth[_0xa8da('0x7')](),controller[_0xa8da('0xa')]);router[_0xa8da('0x6')](_0xa8da('0xb'),auth[_0xa8da('0x7')](),controller[_0xa8da('0xc')]);router[_0xa8da('0xd')]('/',auth[_0xa8da('0x7')](),controller[_0xa8da('0xe')]);router[_0xa8da('0xf')](_0xa8da('0xb'),auth[_0xa8da('0x7')](),controller[_0xa8da('0x10')]);router[_0xa8da('0x11')](_0xa8da('0xb'),auth[_0xa8da('0x7')](),controller['destroy']);module[_0xa8da('0x12')]=router; \ No newline at end of file +var _0x0439=['../../config/environment','./mailSubstatus.controller','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x100a3e,_0x4f56e5){var _0x11d9e6=function(_0x3b130d){while(--_0x3b130d){_0x100a3e['push'](_0x100a3e['shift']());}};_0x11d9e6(++_0x4f56e5);}(_0x0439,0xde));var _0x9043=function(_0x2aef9c,_0x2b4983){_0x2aef9c=_0x2aef9c-0x0;var _0x5a0d3d=_0x0439[_0x2aef9c];return _0x5a0d3d;};'use strict';var multer=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var path=require(_0x9043('0x2'));var timeout=require(_0x9043('0x3'));var express=require(_0x9043('0x4'));var router=express[_0x9043('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9043('0x6'));var interaction=require(_0x9043('0x7'));var config=require(_0x9043('0x8'));var controller=require(_0x9043('0x9'));router[_0x9043('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9043('0xb'),auth[_0x9043('0xc')](),controller[_0x9043('0xd')]);router[_0x9043('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9043('0xe')]);router[_0x9043('0xf')]('/',auth[_0x9043('0xc')](),controller[_0x9043('0x10')]);router[_0x9043('0x11')](_0x9043('0x12'),auth['isAuthenticated'](),controller[_0x9043('0x13')]);router[_0x9043('0x14')](_0x9043('0x12'),auth[_0x9043('0xc')](),controller[_0x9043('0x15')]);module[_0x9043('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index efe5541..7ef4662 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 _0xc492=['exports','STRING','sequelize'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xc492,0xd7));var _0x2c49=function(_0x38a693,_0x2466c1){_0x38a693=_0x38a693-0x0;var _0x4bc635=_0xc492[_0x38a693];return _0x4bc635;};'use strict';var Sequelize=require(_0x2c49('0x0'));module[_0x2c49('0x1')]={'name':{'type':Sequelize[_0x2c49('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8506=['exports','name'];(function(_0x37f09b,_0x59293b){var _0x490e60=function(_0x5c12a2){while(--_0x5c12a2){_0x37f09b['push'](_0x37f09b['shift']());}};_0x490e60(++_0x59293b);}(_0x8506,0xe8));var _0x6850=function(_0x51e6d2,_0x4fcca4){_0x51e6d2=_0x51e6d2-0x0;var _0x52b0e2=_0x8506[_0x51e6d2];return _0x52b0e2;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6850('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 558f0a8..66abb08 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 _0xde0d=['jsforce','desk.js','querystring','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','then','includeAll','include','MailSubstatus','findAll','catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xde0d,0x15b));var _0xdde0=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xde0d[_0x43d11d];return _0x38cd08;};'use strict';var emlformat=require(_0xdde0('0x0'));var rimraf=require(_0xdde0('0x1'));var zipdir=require(_0xdde0('0x2'));var jsonpatch=require(_0xdde0('0x3'));var rp=require(_0xdde0('0x4'));var moment=require(_0xdde0('0x5'));var BPromise=require(_0xdde0('0x6'));var Mustache=require('mustache');var util=require(_0xdde0('0x7'));var path=require(_0xdde0('0x8'));var sox=require(_0xdde0('0x9'));var csv=require(_0xdde0('0xa'));var ejs=require(_0xdde0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdde0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdde0('0xd'));var deskjs=require(_0xdde0('0xe'));var toCsv=require(_0xdde0('0xa'));var querystring=require(_0xdde0('0xf'));var Papa=require('papaparse');var Redis=require(_0xdde0('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdde0('0x11'));var logger=require('../../config/logger')(_0xdde0('0x12'));var utils=require(_0xdde0('0x13'));var config=require(_0xdde0('0x14'));var licenseUtil=require(_0xdde0('0x15'));var db=require(_0xdde0('0x16'))['db'];function respondWithStatusCode(_0x107254,_0x94a79f){_0x94a79f=_0x94a79f||0xcc;return function(_0x573b2f){if(_0x573b2f){return _0x107254[_0xdde0('0x17')](_0x94a79f);}return _0x107254[_0xdde0('0x18')](_0x94a79f)[_0xdde0('0x19')]();};}function respondWithResult(_0x432da9,_0xee7b15){_0xee7b15=_0xee7b15||0xc8;return function(_0x5936ea){if(_0x5936ea){return _0x432da9[_0xdde0('0x18')](_0xee7b15)['json'](_0x5936ea);}};}function respondWithFilteredResult(_0xfb67e,_0x50e773){return function(_0x4120c5){if(_0x4120c5){var _0x31005a=typeof _0x50e773['offset']===_0xdde0('0x1a')&&typeof _0x50e773[_0xdde0('0x1b')]==='undefined';var _0x3cec9f=_0x4120c5[_0xdde0('0x1c')];var _0x215f1b=_0x31005a?0x0:_0x50e773[_0xdde0('0x1d')];var _0x3d7673=_0x31005a?_0x4120c5[_0xdde0('0x1c')]:_0x50e773[_0xdde0('0x1d')]+_0x50e773['limit'];var _0x49bdce;if(_0x3d7673>=_0x3cec9f){_0x3d7673=_0x3cec9f;_0x49bdce=0xc8;}else{_0x49bdce=0xce;}_0xfb67e[_0xdde0('0x18')](_0x49bdce);return _0xfb67e[_0xdde0('0x1e')](_0xdde0('0x1f'),_0x215f1b+'-'+_0x3d7673+'/'+_0x3cec9f)[_0xdde0('0x20')](_0x4120c5);}return null;};}function patchUpdates(_0x1a6cf8){return function(_0x55990a){try{jsonpatch[_0xdde0('0x21')](_0x55990a,_0x1a6cf8,!![]);}catch(_0x2ebc0d){return BPromise['reject'](_0x2ebc0d);}return _0x55990a[_0xdde0('0x22')]();};}function saveUpdates(_0x24327c,_0x2eee47){return function(_0x203e2e){if(_0x203e2e){return _0x203e2e['update'](_0x24327c)['then'](function(_0x4e3040){return _0x4e3040;});}return null;};}function removeEntity(_0x43aee0,_0x93b413){return function(_0x7f8227){if(_0x7f8227){return _0x7f8227[_0xdde0('0x23')]()['then'](function(){_0x43aee0['status'](0xcc)[_0xdde0('0x19')]();});}};}function handleEntityNotFound(_0x129c73,_0x30ffcd){return function(_0xf4ed3e){if(!_0xf4ed3e){_0x129c73[_0xdde0('0x17')](0x194);}return _0xf4ed3e;};}function handleError(_0x28cbc8,_0x56df83){_0x56df83=_0x56df83||0x1f4;return function(_0x2e4c3d){logger['error'](_0x2e4c3d[_0xdde0('0x24')]);if(_0x2e4c3d[_0xdde0('0x25')]){delete _0x2e4c3d[_0xdde0('0x25')];}_0x28cbc8['status'](_0x56df83)[_0xdde0('0x26')](_0x2e4c3d);};}exports[_0xdde0('0x27')]=function(_0xe0015e,_0x1c9e6d){var _0x797b6a={},_0x2434f5={},_0x44c2b8={'count':0x0,'rows':[]};var _0x1d8aba=_[_0xdde0('0x28')](db['MailSubstatus'][_0xdde0('0x29')],function(_0x429ee4){return{'name':_0x429ee4[_0xdde0('0x2a')],'type':_0x429ee4[_0xdde0('0x2b')]['key']};});_0x2434f5[_0xdde0('0x2c')]=_['map'](_0x1d8aba,'name');_0x2434f5[_0xdde0('0x2d')]=_[_0xdde0('0x2e')](_0xe0015e[_0xdde0('0x2d')]);_0x2434f5[_0xdde0('0x2f')]=_[_0xdde0('0x30')](_0x2434f5[_0xdde0('0x2c')],_0x2434f5[_0xdde0('0x2d')]);_0x797b6a[_0xdde0('0x31')]=_[_0xdde0('0x30')](_0x2434f5[_0xdde0('0x2c')],qs[_0xdde0('0x32')](_0xe0015e[_0xdde0('0x2d')][_0xdde0('0x32')]));_0x797b6a[_0xdde0('0x31')]=_0x797b6a['attributes'][_0xdde0('0x33')]?_0x797b6a[_0xdde0('0x31')]:_0x2434f5[_0xdde0('0x2c')];if(!_0xe0015e[_0xdde0('0x2d')][_0xdde0('0x34')]('nolimit')){_0x797b6a[_0xdde0('0x1b')]=qs[_0xdde0('0x1b')](_0xe0015e[_0xdde0('0x2d')][_0xdde0('0x1b')]);_0x797b6a[_0xdde0('0x1d')]=qs[_0xdde0('0x1d')](_0xe0015e['query'][_0xdde0('0x1d')]);}_0x797b6a[_0xdde0('0x35')]=qs['sort'](_0xe0015e[_0xdde0('0x2d')][_0xdde0('0x36')]);_0x797b6a[_0xdde0('0x37')]=qs['filters'](_[_0xdde0('0x38')](_0xe0015e[_0xdde0('0x2d')],_0x2434f5[_0xdde0('0x2f')]),_0x1d8aba);if(_0xe0015e['query'][_0xdde0('0x39')]){_0x797b6a[_0xdde0('0x37')]=_[_0xdde0('0x3a')](_0x797b6a['where'],{'$or':_['map'](_0x1d8aba,function(_0x497469){if(_0x497469[_0xdde0('0x2b')]!=='VIRTUAL'){var _0xd1720e={};_0xd1720e[_0x497469[_0xdde0('0x25')]]={'$like':'%'+_0xe0015e[_0xdde0('0x2d')][_0xdde0('0x39')]+'%'};return _0xd1720e;}})});}_0x797b6a=_[_0xdde0('0x3a')]({},_0x797b6a,_0xe0015e[_0xdde0('0x3b')]);var _0x275e3f={'where':_0x797b6a[_0xdde0('0x37')]};return db['MailSubstatus']['count'](_0x275e3f)[_0xdde0('0x3c')](function(_0x123e38){_0x44c2b8[_0xdde0('0x1c')]=_0x123e38;if(_0xe0015e[_0xdde0('0x2d')][_0xdde0('0x3d')]){_0x797b6a[_0xdde0('0x3e')]=[{'all':!![]}];}return db[_0xdde0('0x3f')][_0xdde0('0x40')](_0x797b6a);})['then'](function(_0x4f9c90){_0x44c2b8['rows']=_0x4f9c90;return _0x44c2b8;})[_0xdde0('0x3c')](respondWithFilteredResult(_0x1c9e6d,_0x797b6a))[_0xdde0('0x41')](handleError(_0x1c9e6d,null));};exports['show']=function(_0x50c020,_0x205217){var _0x4ed657={'raw':!![],'where':{'id':_0x50c020[_0xdde0('0x42')]['id']}},_0xb05d66={};_0xb05d66['model']=_['keys'](db['MailSubstatus'][_0xdde0('0x29')]);_0xb05d66[_0xdde0('0x2d')]=_[_0xdde0('0x2e')](_0x50c020[_0xdde0('0x2d')]);_0xb05d66[_0xdde0('0x2f')]=_[_0xdde0('0x30')](_0xb05d66[_0xdde0('0x2c')],_0xb05d66[_0xdde0('0x2d')]);_0x4ed657[_0xdde0('0x31')]=_[_0xdde0('0x30')](_0xb05d66[_0xdde0('0x2c')],qs[_0xdde0('0x32')](_0x50c020[_0xdde0('0x2d')][_0xdde0('0x32')]));_0x4ed657[_0xdde0('0x31')]=_0x4ed657[_0xdde0('0x31')][_0xdde0('0x33')]?_0x4ed657[_0xdde0('0x31')]:_0xb05d66[_0xdde0('0x2c')];if(_0x50c020[_0xdde0('0x2d')][_0xdde0('0x3d')]){_0x4ed657[_0xdde0('0x3e')]=[{'all':!![]}];}_0x4ed657=_[_0xdde0('0x3a')]({},_0x4ed657,_0x50c020[_0xdde0('0x3b')]);return db[_0xdde0('0x3f')][_0xdde0('0x43')](_0x4ed657)[_0xdde0('0x3c')](handleEntityNotFound(_0x205217,null))['then'](respondWithResult(_0x205217,null))[_0xdde0('0x41')](handleError(_0x205217,null));};exports['create']=function(_0x2cd1d1,_0x2f9d7){return db[_0xdde0('0x3f')][_0xdde0('0x44')](_0x2cd1d1[_0xdde0('0x45')],{})[_0xdde0('0x3c')](respondWithResult(_0x2f9d7,0xc9))[_0xdde0('0x41')](handleError(_0x2f9d7,null));};exports[_0xdde0('0x46')]=function(_0x12e4fe,_0x2c3e1a){if(_0x12e4fe[_0xdde0('0x45')]['id']){delete _0x12e4fe[_0xdde0('0x45')]['id'];}return db[_0xdde0('0x3f')][_0xdde0('0x43')]({'where':{'id':_0x12e4fe[_0xdde0('0x42')]['id']}})[_0xdde0('0x3c')](handleEntityNotFound(_0x2c3e1a,null))[_0xdde0('0x3c')](saveUpdates(_0x12e4fe[_0xdde0('0x45')],null))['then'](respondWithResult(_0x2c3e1a,null))['catch'](handleError(_0x2c3e1a,null));};exports['destroy']=function(_0x4a0bdd,_0x67b0fb){return db[_0xdde0('0x3f')][_0xdde0('0x43')]({'where':{'id':_0x4a0bdd[_0xdde0('0x42')]['id']}})[_0xdde0('0x3c')](handleEntityNotFound(_0x67b0fb,null))['then'](removeEntity(_0x67b0fb,null))[_0xdde0('0x41')](handleError(_0x67b0fb,null));};exports[_0xdde0('0x47')]=function(_0x219836,_0x5a13c0){return db['MailSubstatus'][_0xdde0('0x47')]()['then'](respondWithResult(_0x5a13c0,null))['catch'](handleError(_0x5a13c0,null));}; \ No newline at end of file +var _0x7db3=['include','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x1eafb4,_0x18a461){var _0x1465ce=function(_0x413c82){while(--_0x413c82){_0x1eafb4['push'](_0x1eafb4['shift']());}};_0x1465ce(++_0x18a461);}(_0x7db3,0x1d1));var _0x37db=function(_0xf3db90,_0x389ddb){_0xf3db90=_0xf3db90-0x0;var _0x15f156=_0x7db3[_0xf3db90];return _0x15f156;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37db('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37db('0x1'));var rp=require(_0x37db('0x2'));var moment=require(_0x37db('0x3'));var BPromise=require(_0x37db('0x4'));var Mustache=require(_0x37db('0x5'));var util=require(_0x37db('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x37db('0x7'));var ejs=require(_0x37db('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37db('0x9'));var squel=require(_0x37db('0xa'));var crypto=require(_0x37db('0xb'));var jsforce=require(_0x37db('0xc'));var deskjs=require(_0x37db('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x37db('0xe'));var Redis=require(_0x37db('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x37db('0x10'));var as=require(_0x37db('0x11'));var hardwareService=require(_0x37db('0x12'));var logger=require(_0x37db('0x13'))(_0x37db('0x14'));var utils=require('../../config/utils');var config=require(_0x37db('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x37db('0x16'))['db'];function respondWithStatusCode(_0x1dfbdd,_0x47d7d6){_0x47d7d6=_0x47d7d6||0xcc;return function(_0x4be6e8){if(_0x4be6e8){return _0x1dfbdd[_0x37db('0x17')](_0x47d7d6);}return _0x1dfbdd['status'](_0x47d7d6)[_0x37db('0x18')]();};}function respondWithResult(_0x41ba01,_0x2e5534){_0x2e5534=_0x2e5534||0xc8;return function(_0x39c7ea){if(_0x39c7ea){return _0x41ba01['status'](_0x2e5534)[_0x37db('0x19')](_0x39c7ea);}};}function respondWithFilteredResult(_0x10dd73,_0x3e3a60){return function(_0x52a023){if(_0x52a023){var _0x2f34b1=typeof _0x3e3a60[_0x37db('0x1a')]===_0x37db('0x1b')&&typeof _0x3e3a60['limit']==='undefined';var _0x4fe681=_0x52a023[_0x37db('0x1c')];var _0x45bc8a=_0x2f34b1?0x0:_0x3e3a60['offset'];var _0x12e0b4=_0x2f34b1?_0x52a023[_0x37db('0x1c')]:_0x3e3a60['offset']+_0x3e3a60[_0x37db('0x1d')];var _0x43fa52;if(_0x12e0b4>=_0x4fe681){_0x12e0b4=_0x4fe681;_0x43fa52=0xc8;}else{_0x43fa52=0xce;}_0x10dd73['status'](_0x43fa52);return _0x10dd73[_0x37db('0x1e')]('Content-Range',_0x45bc8a+'-'+_0x12e0b4+'/'+_0x4fe681)['json'](_0x52a023);}return null;};}function patchUpdates(_0x194afe){return function(_0x241a17){try{jsonpatch[_0x37db('0x1f')](_0x241a17,_0x194afe,!![]);}catch(_0x27834f){return BPromise[_0x37db('0x20')](_0x27834f);}return _0x241a17[_0x37db('0x21')]();};}function saveUpdates(_0x308f27,_0x42d9a8){return function(_0x59345b){if(_0x59345b){return _0x59345b[_0x37db('0x22')](_0x308f27)[_0x37db('0x23')](function(_0x328492){return _0x328492;});}return null;};}function removeEntity(_0x516db0,_0x112508){return function(_0x4e001a){if(_0x4e001a){return _0x4e001a[_0x37db('0x24')]()['then'](function(){_0x516db0[_0x37db('0x25')](0xcc)[_0x37db('0x18')]();});}};}function handleEntityNotFound(_0xd3d38d,_0x3cc356){return function(_0x576cdd){if(!_0x576cdd){_0xd3d38d[_0x37db('0x17')](0x194);}return _0x576cdd;};}function handleError(_0x516b51,_0x430e7f){_0x430e7f=_0x430e7f||0x1f4;return function(_0xea79c5){logger[_0x37db('0x26')](_0xea79c5[_0x37db('0x27')]);if(_0xea79c5[_0x37db('0x28')]){delete _0xea79c5[_0x37db('0x28')];}_0x516b51[_0x37db('0x25')](_0x430e7f)[_0x37db('0x29')](_0xea79c5);};}exports[_0x37db('0x2a')]=function(_0x2dbaaf,_0x17d23e){var _0x3fca7d={},_0x38bd6e={},_0x3d0cf8={'count':0x0,'rows':[]};var _0xce6512=_[_0x37db('0x2b')](db[_0x37db('0x2c')][_0x37db('0x2d')],function(_0x35f860){return{'name':_0x35f860[_0x37db('0x2e')],'type':_0x35f860['type'][_0x37db('0x2f')]};});_0x38bd6e[_0x37db('0x30')]=_[_0x37db('0x2b')](_0xce6512,'name');_0x38bd6e[_0x37db('0x31')]=_[_0x37db('0x32')](_0x2dbaaf[_0x37db('0x31')]);_0x38bd6e[_0x37db('0x33')]=_['intersection'](_0x38bd6e[_0x37db('0x30')],_0x38bd6e[_0x37db('0x31')]);_0x3fca7d[_0x37db('0x34')]=_[_0x37db('0x35')](_0x38bd6e[_0x37db('0x30')],qs[_0x37db('0x36')](_0x2dbaaf[_0x37db('0x31')]['fields']));_0x3fca7d['attributes']=_0x3fca7d[_0x37db('0x34')][_0x37db('0x37')]?_0x3fca7d[_0x37db('0x34')]:_0x38bd6e['model'];if(!_0x2dbaaf[_0x37db('0x31')][_0x37db('0x38')](_0x37db('0x39'))){_0x3fca7d['limit']=qs['limit'](_0x2dbaaf[_0x37db('0x31')]['limit']);_0x3fca7d[_0x37db('0x1a')]=qs[_0x37db('0x1a')](_0x2dbaaf[_0x37db('0x31')][_0x37db('0x1a')]);}_0x3fca7d['order']=qs[_0x37db('0x3a')](_0x2dbaaf[_0x37db('0x31')]['sort']);_0x3fca7d[_0x37db('0x3b')]=qs[_0x37db('0x33')](_[_0x37db('0x3c')](_0x2dbaaf['query'],_0x38bd6e['filters']),_0xce6512);if(_0x2dbaaf[_0x37db('0x31')][_0x37db('0x3d')]){_0x3fca7d[_0x37db('0x3b')]=_[_0x37db('0x3e')](_0x3fca7d[_0x37db('0x3b')],{'$or':_[_0x37db('0x2b')](_0xce6512,function(_0x38f55e){if(_0x38f55e[_0x37db('0x3f')]!==_0x37db('0x40')){var _0x595586={};_0x595586[_0x38f55e[_0x37db('0x28')]]={'$like':'%'+_0x2dbaaf[_0x37db('0x31')][_0x37db('0x3d')]+'%'};return _0x595586;}})});}_0x3fca7d=_[_0x37db('0x3e')]({},_0x3fca7d,_0x2dbaaf[_0x37db('0x41')]);var _0x70a450={'where':_0x3fca7d[_0x37db('0x3b')]};return db['MailSubstatus'][_0x37db('0x1c')](_0x70a450)[_0x37db('0x23')](function(_0x1471b6){_0x3d0cf8['count']=_0x1471b6;if(_0x2dbaaf[_0x37db('0x31')][_0x37db('0x42')]){_0x3fca7d[_0x37db('0x43')]=[{'all':!![]}];}return db[_0x37db('0x2c')]['findAll'](_0x3fca7d);})[_0x37db('0x23')](function(_0x5eda2f){_0x3d0cf8[_0x37db('0x44')]=_0x5eda2f;return _0x3d0cf8;})[_0x37db('0x23')](respondWithFilteredResult(_0x17d23e,_0x3fca7d))[_0x37db('0x45')](handleError(_0x17d23e,null));};exports[_0x37db('0x46')]=function(_0x5cd85d,_0x5648e7){var _0x1e19ae={'raw':!![],'where':{'id':_0x5cd85d[_0x37db('0x47')]['id']}},_0x13f367={};_0x13f367['model']=_[_0x37db('0x32')](db['MailSubstatus'][_0x37db('0x2d')]);_0x13f367[_0x37db('0x31')]=_[_0x37db('0x32')](_0x5cd85d[_0x37db('0x31')]);_0x13f367[_0x37db('0x33')]=_[_0x37db('0x35')](_0x13f367[_0x37db('0x30')],_0x13f367[_0x37db('0x31')]);_0x1e19ae[_0x37db('0x34')]=_[_0x37db('0x35')](_0x13f367['model'],qs[_0x37db('0x36')](_0x5cd85d[_0x37db('0x31')][_0x37db('0x36')]));_0x1e19ae[_0x37db('0x34')]=_0x1e19ae[_0x37db('0x34')][_0x37db('0x37')]?_0x1e19ae[_0x37db('0x34')]:_0x13f367[_0x37db('0x30')];if(_0x5cd85d[_0x37db('0x31')][_0x37db('0x42')]){_0x1e19ae[_0x37db('0x43')]=[{'all':!![]}];}_0x1e19ae=_[_0x37db('0x3e')]({},_0x1e19ae,_0x5cd85d[_0x37db('0x41')]);return db[_0x37db('0x2c')][_0x37db('0x48')](_0x1e19ae)['then'](handleEntityNotFound(_0x5648e7,null))['then'](respondWithResult(_0x5648e7,null))[_0x37db('0x45')](handleError(_0x5648e7,null));};exports['create']=function(_0x449445,_0x3f5dfd){return db[_0x37db('0x2c')][_0x37db('0x49')](_0x449445[_0x37db('0x4a')],{})[_0x37db('0x23')](respondWithResult(_0x3f5dfd,0xc9))[_0x37db('0x45')](handleError(_0x3f5dfd,null));};exports[_0x37db('0x22')]=function(_0xc564b,_0x47f280){if(_0xc564b[_0x37db('0x4a')]['id']){delete _0xc564b['body']['id'];}return db[_0x37db('0x2c')][_0x37db('0x48')]({'where':{'id':_0xc564b[_0x37db('0x47')]['id']}})[_0x37db('0x23')](handleEntityNotFound(_0x47f280,null))[_0x37db('0x23')](saveUpdates(_0xc564b[_0x37db('0x4a')],null))[_0x37db('0x23')](respondWithResult(_0x47f280,null))[_0x37db('0x45')](handleError(_0x47f280,null));};exports[_0x37db('0x24')]=function(_0x5853e5,_0xb098a2){return db['MailSubstatus'][_0x37db('0x48')]({'where':{'id':_0x5853e5['params']['id']}})[_0x37db('0x23')](handleEntityNotFound(_0xb098a2,null))['then'](removeEntity(_0xb098a2,null))[_0x37db('0x45')](handleError(_0xb098a2,null));};exports[_0x37db('0x4b')]=function(_0x39be8b,_0x2b6e7d){return db[_0x37db('0x2c')][_0x37db('0x4b')]()[_0x37db('0x23')](respondWithResult(_0x2b6e7d,null))[_0x37db('0x45')](handleError(_0x2b6e7d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f206029..fb89eb1 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 _0x4fdb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','MailSubstatus','mail_substatuses'];(function(_0x1fb809,_0x553411){var _0x51da6d=function(_0xb910cd){while(--_0xb910cd){_0x1fb809['push'](_0x1fb809['shift']());}};_0x51da6d(++_0x553411);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x7e55a4,_0x10ff38){_0x7e55a4=_0x7e55a4-0x0;var _0x1e152b=_0x4fdb[_0x7e55a4];return _0x1e152b;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));module['exports']=function(_0x14052b,_0x5d8b39){return _0x14052b['define'](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa06c=['exports','MailSubstatus','mail_substatuses','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes'];(function(_0x3c228f,_0x3f4627){var _0x447a2f=function(_0x5ed3d4){while(--_0x5ed3d4){_0x3c228f['push'](_0x3c228f['shift']());}};_0x447a2f(++_0x3f4627);}(_0xa06c,0xd3));var _0xca06=function(_0x3eb8a2,_0x36ce26){_0x3eb8a2=_0x3eb8a2-0x0;var _0x1abd24=_0xa06c[_0x3eb8a2];return _0x1abd24;};'use strict';var _=require('lodash');var util=require(_0xca06('0x0'));var logger=require(_0xca06('0x1'))(_0xca06('0x2'));var moment=require(_0xca06('0x3'));var BPromise=require(_0xca06('0x4'));var rp=require(_0xca06('0x5'));var fs=require('fs');var path=require(_0xca06('0x6'));var rimraf=require(_0xca06('0x7'));var config=require(_0xca06('0x8'));var attributes=require(_0xca06('0x9'));module[_0xca06('0xa')]=function(_0x44e0db,_0x3aba71){return _0x44e0db['define'](_0xca06('0xb'),attributes,{'tableName':_0xca06('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4cfee4e..8ed920d 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 _0x82e4=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis'];(function(_0x53f122,_0x4a625e){var _0x585642=function(_0x5211c2){while(--_0x5211c2){_0x53f122['push'](_0x53f122['shift']());}};_0x585642(++_0x4a625e);}(_0x82e4,0x104));var _0x482e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x82e4[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x482e('0x0'));var util=require(_0x482e('0x1'));var moment=require(_0x482e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x482e('0x3'));var db=require(_0x482e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x482e('0x5'))('rpc');var config=require(_0x482e('0x6'));var jayson=require(_0x482e('0x7'));var client=jayson[_0x482e('0x8')][_0x482e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b73ce,_0xf8b69a,_0x1c8043){return new BPromise(function(_0x34d273,_0xbda034){return client[_0x482e('0xa')](_0x3b73ce,_0x1c8043)[_0x482e('0xb')](function(_0x5717d6){logger[_0x482e('0xc')]('MailSubstatus,\x20%s,\x20%s',_0xf8b69a,_0x482e('0xd'));logger[_0x482e('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0xf8b69a,'request\x20sent',JSON[_0x482e('0xf')](_0x5717d6));if(_0x5717d6[_0x482e('0x10')]){if(_0x5717d6[_0x482e('0x10')][_0x482e('0x11')]===0x1f4){logger[_0x482e('0x10')](_0x482e('0x12'),_0xf8b69a,_0x5717d6[_0x482e('0x10')][_0x482e('0x13')]);return _0xbda034(_0x5717d6['error'][_0x482e('0x13')]);}logger[_0x482e('0x10')](_0x482e('0x12'),_0xf8b69a,_0x5717d6[_0x482e('0x10')]['message']);return _0x34d273(_0x5717d6[_0x482e('0x10')][_0x482e('0x13')]);}else{logger[_0x482e('0xc')](_0x482e('0x12'),_0xf8b69a,_0x482e('0xd'));_0x34d273(_0x5717d6[_0x482e('0x14')][_0x482e('0x13')]);}})[_0x482e('0x15')](function(_0x3434b0){logger[_0x482e('0x10')]('MailSubstatus,\x20%s,\x20%s',_0xf8b69a,_0x3434b0);_0xbda034(_0x3434b0);});});} \ No newline at end of file +var _0xb3bf=['client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb3bf,0xb5));var _0xfb3b=function(_0x227427,_0x3159c8){_0x227427=_0x227427-0x0;var _0x51d536=_0xb3bf[_0x227427];return _0x51d536;};'use strict';var _=require(_0xfb3b('0x0'));var util=require(_0xfb3b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfb3b('0x2'));var fs=require('fs');var Redis=require(_0xfb3b('0x3'));var db=require(_0xfb3b('0x4'))['db'];var utils=require(_0xfb3b('0x5'));var logger=require('../../config/logger')(_0xfb3b('0x6'));var config=require('../../config/environment');var jayson=require(_0xfb3b('0x7'));var client=jayson[_0xfb3b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x217ce4,_0x1adb7b,_0x37b906){return new BPromise(function(_0x52bed2,_0x546cdc){return client[_0xfb3b('0x9')](_0x217ce4,_0x37b906)[_0xfb3b('0xa')](function(_0x4fc64f){logger[_0xfb3b('0xb')](_0xfb3b('0xc'),_0x1adb7b,_0xfb3b('0xd'));logger[_0xfb3b('0xe')](_0xfb3b('0xf'),_0x1adb7b,_0xfb3b('0xd'),JSON[_0xfb3b('0x10')](_0x4fc64f));if(_0x4fc64f[_0xfb3b('0x11')]){if(_0x4fc64f['error'][_0xfb3b('0x12')]===0x1f4){logger['error'](_0xfb3b('0xc'),_0x1adb7b,_0x4fc64f[_0xfb3b('0x11')]['message']);return _0x546cdc(_0x4fc64f['error'][_0xfb3b('0x13')]);}logger['error'](_0xfb3b('0xc'),_0x1adb7b,_0x4fc64f[_0xfb3b('0x11')][_0xfb3b('0x13')]);return _0x52bed2(_0x4fc64f[_0xfb3b('0x11')][_0xfb3b('0x13')]);}else{logger[_0xfb3b('0xb')](_0xfb3b('0xc'),_0x1adb7b,_0xfb3b('0xd'));_0x52bed2(_0x4fc64f[_0xfb3b('0x14')][_0xfb3b('0x13')]);}})['catch'](function(_0x230d3a){logger[_0xfb3b('0x11')](_0xfb3b('0xc'),_0x1adb7b,_0x230d3a);_0x546cdc(_0x230d3a);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8b4a3f4..ace3ed0 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 _0x37c0=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x4ce188,_0x4d5899){var _0x43ce3a=function(_0x4db233){while(--_0x4db233){_0x4ce188['push'](_0x4ce188['shift']());}};_0x43ce3a(++_0x4d5899);}(_0x37c0,0x11f));var _0x037c=function(_0x28238d,_0x588aaa){_0x28238d=_0x28238d-0x0;var _0x2f9399=_0x37c0[_0x28238d];return _0x2f9399;};'use strict';var multer=require(_0x037c('0x0'));var util=require(_0x037c('0x1'));var path=require(_0x037c('0x2'));var timeout=require(_0x037c('0x3'));var express=require(_0x037c('0x4'));var router=express[_0x037c('0x5')]();var fs_extra=require(_0x037c('0x6'));var auth=require(_0x037c('0x7'));var interaction=require(_0x037c('0x8'));var config=require(_0x037c('0x9'));var controller=require(_0x037c('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x037c('0xb')]);router[_0x037c('0xc')](_0x037c('0xd'),auth[_0x037c('0xe')](),controller[_0x037c('0xf')]);router[_0x037c('0xc')](_0x037c('0x10'),auth[_0x037c('0xe')](),controller['show']);router[_0x037c('0x11')]('/',auth[_0x037c('0xe')](),controller[_0x037c('0x12')]);router[_0x037c('0x13')](_0x037c('0x10'),auth[_0x037c('0xe')](),controller[_0x037c('0x14')]);router[_0x037c('0x15')]('/:id',auth[_0x037c('0xe')](),controller[_0x037c('0x16')]);module[_0x037c('0x17')]=router; \ No newline at end of file +var _0xdf9b=['../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x2df44e,_0x2e7616){var _0x45c589=function(_0x550e5e){while(--_0x550e5e){_0x2df44e['push'](_0x2df44e['shift']());}};_0x45c589(++_0x2e7616);}(_0xdf9b,0x12d));var _0xbdf9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdf9b[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xbdf9('0x0'));var util=require(_0xbdf9('0x1'));var path=require('path');var timeout=require(_0xbdf9('0x2'));var express=require('express');var router=express[_0xbdf9('0x3')]();var fs_extra=require(_0xbdf9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbdf9('0x5'));var controller=require('./mailTransferReport.controller');router[_0xbdf9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbdf9('0x7'),auth[_0xbdf9('0x8')](),controller[_0xbdf9('0x9')]);router[_0xbdf9('0x6')](_0xbdf9('0xa'),auth[_0xbdf9('0x8')](),controller[_0xbdf9('0xb')]);router[_0xbdf9('0xc')]('/',auth[_0xbdf9('0x8')](),controller[_0xbdf9('0xd')]);router['put'](_0xbdf9('0xa'),auth[_0xbdf9('0x8')](),controller[_0xbdf9('0xe')]);router['delete'](_0xbdf9('0xa'),auth[_0xbdf9('0x8')](),controller[_0xbdf9('0xf')]);module[_0xbdf9('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f97acec..b36f5f6 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1e0cc2,_0x590419){var _0x23712c=function(_0x6975d7){while(--_0x6975d7){_0x1e0cc2['push'](_0x1e0cc2['shift']());}};_0x23712c(++_0x590419);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 222b15d..6f1875d 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 _0xf537=['rawAttributes','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','MailTransferReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf537,0x15f));var _0x7f53=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf537[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x7f53('0x0'));var rimraf=require(_0x7f53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f53('0x2'));var rp=require(_0x7f53('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7f53('0x4'));var util=require('util');var path=require(_0x7f53('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7f53('0x6'));var fs=require('fs');var fs_extra=require(_0x7f53('0x7'));var _=require(_0x7f53('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7f53('0x9'));var deskjs=require(_0x7f53('0xa'));var toCsv=require(_0x7f53('0xb'));var querystring=require(_0x7f53('0xc'));var Papa=require(_0x7f53('0xd'));var Redis=require(_0x7f53('0xe'));var authService=require(_0x7f53('0xf'));var qs=require(_0x7f53('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f53('0x11'))(_0x7f53('0x12'));var utils=require('../../config/utils');var config=require(_0x7f53('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45e243,_0x1b66d6){_0x1b66d6=_0x1b66d6||0xcc;return function(_0x3d63ec){if(_0x3d63ec){return _0x45e243['sendStatus'](_0x1b66d6);}return _0x45e243[_0x7f53('0x14')](_0x1b66d6)[_0x7f53('0x15')]();};}function respondWithResult(_0x56ff41,_0x158bc6){_0x158bc6=_0x158bc6||0xc8;return function(_0x489a70){if(_0x489a70){return _0x56ff41['status'](_0x158bc6)['json'](_0x489a70);}};}function respondWithFilteredResult(_0x1354e9,_0x382c40){return function(_0xa9b63d){if(_0xa9b63d){var _0x2f9fd9=typeof _0x382c40[_0x7f53('0x16')]===_0x7f53('0x17')&&typeof _0x382c40[_0x7f53('0x18')]===_0x7f53('0x17');var _0x50efd9=_0xa9b63d[_0x7f53('0x19')];var _0x5af681=_0x2f9fd9?0x0:_0x382c40[_0x7f53('0x16')];var _0x47e7c1=_0x2f9fd9?_0xa9b63d[_0x7f53('0x19')]:_0x382c40[_0x7f53('0x16')]+_0x382c40[_0x7f53('0x18')];var _0x34890d;if(_0x47e7c1>=_0x50efd9){_0x47e7c1=_0x50efd9;_0x34890d=0xc8;}else{_0x34890d=0xce;}_0x1354e9[_0x7f53('0x14')](_0x34890d);return _0x1354e9[_0x7f53('0x1a')](_0x7f53('0x1b'),_0x5af681+'-'+_0x47e7c1+'/'+_0x50efd9)['json'](_0xa9b63d);}return null;};}function patchUpdates(_0x5552cb){return function(_0x248479){try{jsonpatch[_0x7f53('0x1c')](_0x248479,_0x5552cb,!![]);}catch(_0x438ede){return BPromise[_0x7f53('0x1d')](_0x438ede);}return _0x248479[_0x7f53('0x1e')]();};}function saveUpdates(_0x30eef2,_0x33a767){return function(_0x5e6f61){if(_0x5e6f61){return _0x5e6f61[_0x7f53('0x1f')](_0x30eef2)['then'](function(_0x36127f){return _0x36127f;});}return null;};}function removeEntity(_0x597549,_0x47ba00){return function(_0x57865a){if(_0x57865a){return _0x57865a[_0x7f53('0x20')]()[_0x7f53('0x21')](function(){_0x597549['status'](0xcc)[_0x7f53('0x15')]();});}};}function handleEntityNotFound(_0x54384d,_0x199012){return function(_0x481f6d){if(!_0x481f6d){_0x54384d['sendStatus'](0x194);}return _0x481f6d;};}function handleError(_0x47258e,_0x3f0512){_0x3f0512=_0x3f0512||0x1f4;return function(_0x5e24d9){logger[_0x7f53('0x22')](_0x5e24d9['stack']);if(_0x5e24d9[_0x7f53('0x23')]){delete _0x5e24d9['name'];}_0x47258e[_0x7f53('0x14')](_0x3f0512)[_0x7f53('0x24')](_0x5e24d9);};}exports['index']=function(_0x420d72,_0x54f1c6){var _0x370c42={},_0x5c3068={},_0x4a3688={'count':0x0,'rows':[]};var _0x54eb1e=_[_0x7f53('0x25')](db[_0x7f53('0x26')]['rawAttributes'],function(_0x5560fe){return{'name':_0x5560fe['fieldName'],'type':_0x5560fe[_0x7f53('0x27')][_0x7f53('0x28')]};});_0x5c3068[_0x7f53('0x29')]=_[_0x7f53('0x25')](_0x54eb1e,_0x7f53('0x23'));_0x5c3068[_0x7f53('0x2a')]=_[_0x7f53('0x2b')](_0x420d72['query']);_0x5c3068[_0x7f53('0x2c')]=_[_0x7f53('0x2d')](_0x5c3068[_0x7f53('0x29')],_0x5c3068['query']);_0x370c42[_0x7f53('0x2e')]=_[_0x7f53('0x2d')](_0x5c3068[_0x7f53('0x29')],qs[_0x7f53('0x2f')](_0x420d72[_0x7f53('0x2a')]['fields']));_0x370c42[_0x7f53('0x2e')]=_0x370c42[_0x7f53('0x2e')][_0x7f53('0x30')]?_0x370c42[_0x7f53('0x2e')]:_0x5c3068['model'];if(!_0x420d72[_0x7f53('0x2a')][_0x7f53('0x31')](_0x7f53('0x32'))){_0x370c42[_0x7f53('0x18')]=qs[_0x7f53('0x18')](_0x420d72[_0x7f53('0x2a')][_0x7f53('0x18')]);_0x370c42[_0x7f53('0x16')]=qs['offset'](_0x420d72[_0x7f53('0x2a')][_0x7f53('0x16')]);}_0x370c42[_0x7f53('0x33')]=qs[_0x7f53('0x34')](_0x420d72[_0x7f53('0x2a')][_0x7f53('0x34')]);_0x370c42[_0x7f53('0x35')]=qs[_0x7f53('0x2c')](_[_0x7f53('0x36')](_0x420d72[_0x7f53('0x2a')],_0x5c3068[_0x7f53('0x2c')]),_0x54eb1e);if(_0x420d72[_0x7f53('0x2a')]['filter']){_0x370c42[_0x7f53('0x35')]=_[_0x7f53('0x37')](_0x370c42[_0x7f53('0x35')],{'$or':_[_0x7f53('0x25')](_0x54eb1e,function(_0x2ad6f3){if(_0x2ad6f3[_0x7f53('0x27')]!==_0x7f53('0x38')){var _0x59fe8c={};_0x59fe8c[_0x2ad6f3['name']]={'$like':'%'+_0x420d72[_0x7f53('0x2a')]['filter']+'%'};return _0x59fe8c;}})});}_0x370c42=_[_0x7f53('0x37')]({},_0x370c42,_0x420d72[_0x7f53('0x39')]);var _0x1f00e6={'where':_0x370c42['where']};return db['MailTransferReport']['count'](_0x1f00e6)[_0x7f53('0x21')](function(_0x419463){_0x4a3688[_0x7f53('0x19')]=_0x419463;if(_0x420d72['query'][_0x7f53('0x3a')]){_0x370c42[_0x7f53('0x3b')]=[{'all':!![]}];}return db[_0x7f53('0x26')][_0x7f53('0x3c')](_0x370c42);})[_0x7f53('0x21')](function(_0x292238){_0x4a3688['rows']=_0x292238;return _0x4a3688;})[_0x7f53('0x21')](respondWithFilteredResult(_0x54f1c6,_0x370c42))['catch'](handleError(_0x54f1c6,null));};exports[_0x7f53('0x3d')]=function(_0x288c3c,_0x40519c){var _0x43e04c={'raw':!![],'where':{'id':_0x288c3c[_0x7f53('0x3e')]['id']}},_0x1c4e24={};_0x1c4e24[_0x7f53('0x29')]=_[_0x7f53('0x2b')](db[_0x7f53('0x26')][_0x7f53('0x3f')]);_0x1c4e24[_0x7f53('0x2a')]=_[_0x7f53('0x2b')](_0x288c3c['query']);_0x1c4e24[_0x7f53('0x2c')]=_['intersection'](_0x1c4e24[_0x7f53('0x29')],_0x1c4e24['query']);_0x43e04c[_0x7f53('0x2e')]=_[_0x7f53('0x2d')](_0x1c4e24[_0x7f53('0x29')],qs[_0x7f53('0x2f')](_0x288c3c[_0x7f53('0x2a')][_0x7f53('0x2f')]));_0x43e04c[_0x7f53('0x2e')]=_0x43e04c[_0x7f53('0x2e')][_0x7f53('0x30')]?_0x43e04c[_0x7f53('0x2e')]:_0x1c4e24[_0x7f53('0x29')];if(_0x288c3c[_0x7f53('0x2a')][_0x7f53('0x3a')]){_0x43e04c[_0x7f53('0x3b')]=[{'all':!![]}];}_0x43e04c=_['merge']({},_0x43e04c,_0x288c3c[_0x7f53('0x39')]);return db[_0x7f53('0x26')][_0x7f53('0x40')](_0x43e04c)[_0x7f53('0x21')](handleEntityNotFound(_0x40519c,null))[_0x7f53('0x21')](respondWithResult(_0x40519c,null))[_0x7f53('0x41')](handleError(_0x40519c,null));};exports[_0x7f53('0x42')]=function(_0x22644e,_0x448cb1){return db[_0x7f53('0x26')]['create'](_0x22644e['body'],{})[_0x7f53('0x21')](respondWithResult(_0x448cb1,0xc9))['catch'](handleError(_0x448cb1,null));};exports[_0x7f53('0x1f')]=function(_0xb2cb0d,_0x36456e){if(_0xb2cb0d[_0x7f53('0x43')]['id']){delete _0xb2cb0d[_0x7f53('0x43')]['id'];}return db['MailTransferReport'][_0x7f53('0x40')]({'where':{'id':_0xb2cb0d['params']['id']}})[_0x7f53('0x21')](handleEntityNotFound(_0x36456e,null))[_0x7f53('0x21')](saveUpdates(_0xb2cb0d[_0x7f53('0x43')],null))['then'](respondWithResult(_0x36456e,null))[_0x7f53('0x41')](handleError(_0x36456e,null));};exports[_0x7f53('0x20')]=function(_0x413e05,_0x30bcb4){return db['MailTransferReport'][_0x7f53('0x40')]({'where':{'id':_0x413e05[_0x7f53('0x3e')]['id']}})['then'](handleEntityNotFound(_0x30bcb4,null))['then'](removeEntity(_0x30bcb4,null))[_0x7f53('0x41')](handleError(_0x30bcb4,null));};exports[_0x7f53('0x44')]=function(_0x2716e8,_0x4ce244){return db['MailTransferReport'][_0x7f53('0x44')]()[_0x7f53('0x21')](respondWithResult(_0x4ce244,null))['catch'](handleError(_0x4ce244,null));}; \ No newline at end of file +var _0xb149=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','index','map','MailTransferReport','rawAttributes','type','key','name','keys','query','filters','model','attributes','intersection','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','describe','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2c4c33,_0x2d0c25){var _0x386c04=function(_0x46da5d){while(--_0x46da5d){_0x2c4c33['push'](_0x2c4c33['shift']());}};_0x386c04(++_0x2d0c25);}(_0xb149,0x87));var _0x9b14=function(_0x45cbcf,_0xfbdbc2){_0x45cbcf=_0x45cbcf-0x0;var _0x52ece8=_0xb149[_0x45cbcf];return _0x52ece8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b14('0x0'));var zipdir=require(_0x9b14('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b14('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9b14('0x3'));var util=require(_0x9b14('0x4'));var path=require(_0x9b14('0x5'));var sox=require(_0x9b14('0x6'));var csv=require(_0x9b14('0x7'));var ejs=require(_0x9b14('0x8'));var fs=require('fs');var fs_extra=require(_0x9b14('0x9'));var _=require(_0x9b14('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b14('0xb'));var deskjs=require(_0x9b14('0xc'));var toCsv=require(_0x9b14('0x7'));var querystring=require('querystring');var Papa=require(_0x9b14('0xd'));var Redis=require(_0x9b14('0xe'));var authService=require(_0x9b14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b14('0x10'));var logger=require('../../config/logger')(_0x9b14('0x11'));var utils=require(_0x9b14('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9b14('0x13'));var db=require(_0x9b14('0x14'))['db'];function respondWithStatusCode(_0x8cd697,_0x548210){_0x548210=_0x548210||0xcc;return function(_0x152eb6){if(_0x152eb6){return _0x8cd697[_0x9b14('0x15')](_0x548210);}return _0x8cd697[_0x9b14('0x16')](_0x548210)[_0x9b14('0x17')]();};}function respondWithResult(_0x3d29b7,_0x4e4cbe){_0x4e4cbe=_0x4e4cbe||0xc8;return function(_0x19b10c){if(_0x19b10c){return _0x3d29b7[_0x9b14('0x16')](_0x4e4cbe)['json'](_0x19b10c);}};}function respondWithFilteredResult(_0x5c13c8,_0x20415a){return function(_0x45cede){if(_0x45cede){var _0x3f976c=typeof _0x20415a[_0x9b14('0x18')]===_0x9b14('0x19')&&typeof _0x20415a[_0x9b14('0x1a')]===_0x9b14('0x19');var _0xb5c4a5=_0x45cede[_0x9b14('0x1b')];var _0x157c59=_0x3f976c?0x0:_0x20415a[_0x9b14('0x18')];var _0x4a833e=_0x3f976c?_0x45cede[_0x9b14('0x1b')]:_0x20415a[_0x9b14('0x18')]+_0x20415a['limit'];var _0x3eebca;if(_0x4a833e>=_0xb5c4a5){_0x4a833e=_0xb5c4a5;_0x3eebca=0xc8;}else{_0x3eebca=0xce;}_0x5c13c8[_0x9b14('0x16')](_0x3eebca);return _0x5c13c8[_0x9b14('0x1c')](_0x9b14('0x1d'),_0x157c59+'-'+_0x4a833e+'/'+_0xb5c4a5)[_0x9b14('0x1e')](_0x45cede);}return null;};}function patchUpdates(_0x34c852){return function(_0x44992b){try{jsonpatch[_0x9b14('0x1f')](_0x44992b,_0x34c852,!![]);}catch(_0x4f81ac){return BPromise[_0x9b14('0x20')](_0x4f81ac);}return _0x44992b[_0x9b14('0x21')]();};}function saveUpdates(_0x4a2d3a,_0x22a8cf){return function(_0x2a44d4){if(_0x2a44d4){return _0x2a44d4[_0x9b14('0x22')](_0x4a2d3a)[_0x9b14('0x23')](function(_0x48aa05){return _0x48aa05;});}return null;};}function removeEntity(_0x84f939,_0x4ec193){return function(_0x1dd1bb){if(_0x1dd1bb){return _0x1dd1bb[_0x9b14('0x24')]()[_0x9b14('0x23')](function(){_0x84f939[_0x9b14('0x16')](0xcc)[_0x9b14('0x17')]();});}};}function handleEntityNotFound(_0xb08217,_0x5361a1){return function(_0xca1b4){if(!_0xca1b4){_0xb08217['sendStatus'](0x194);}return _0xca1b4;};}function handleError(_0x53fdcf,_0x2a20e3){_0x2a20e3=_0x2a20e3||0x1f4;return function(_0x5c2136){logger[_0x9b14('0x25')](_0x5c2136[_0x9b14('0x26')]);if(_0x5c2136['name']){delete _0x5c2136['name'];}_0x53fdcf[_0x9b14('0x16')](_0x2a20e3)[_0x9b14('0x27')](_0x5c2136);};}exports[_0x9b14('0x28')]=function(_0xfcd1c3,_0x58a549){var _0xd8301b={},_0xc97188={},_0x5c5af1={'count':0x0,'rows':[]};var _0x2124b2=_[_0x9b14('0x29')](db[_0x9b14('0x2a')][_0x9b14('0x2b')],function(_0x53e06b){return{'name':_0x53e06b['fieldName'],'type':_0x53e06b[_0x9b14('0x2c')][_0x9b14('0x2d')]};});_0xc97188['model']=_[_0x9b14('0x29')](_0x2124b2,_0x9b14('0x2e'));_0xc97188['query']=_[_0x9b14('0x2f')](_0xfcd1c3[_0x9b14('0x30')]);_0xc97188[_0x9b14('0x31')]=_['intersection'](_0xc97188[_0x9b14('0x32')],_0xc97188[_0x9b14('0x30')]);_0xd8301b[_0x9b14('0x33')]=_[_0x9b14('0x34')](_0xc97188[_0x9b14('0x32')],qs[_0x9b14('0x35')](_0xfcd1c3['query'][_0x9b14('0x35')]));_0xd8301b['attributes']=_0xd8301b[_0x9b14('0x33')]['length']?_0xd8301b[_0x9b14('0x33')]:_0xc97188[_0x9b14('0x32')];if(!_0xfcd1c3[_0x9b14('0x30')]['hasOwnProperty']('nolimit')){_0xd8301b[_0x9b14('0x1a')]=qs['limit'](_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x1a')]);_0xd8301b['offset']=qs['offset'](_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x18')]);}_0xd8301b[_0x9b14('0x36')]=qs[_0x9b14('0x37')](_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x37')]);_0xd8301b[_0x9b14('0x38')]=qs[_0x9b14('0x31')](_[_0x9b14('0x39')](_0xfcd1c3['query'],_0xc97188[_0x9b14('0x31')]),_0x2124b2);if(_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x3a')]){_0xd8301b['where']=_[_0x9b14('0x3b')](_0xd8301b[_0x9b14('0x38')],{'$or':_['map'](_0x2124b2,function(_0x394a67){if(_0x394a67[_0x9b14('0x2c')]!==_0x9b14('0x3c')){var _0x5a15f7={};_0x5a15f7[_0x394a67['name']]={'$like':'%'+_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x3a')]+'%'};return _0x5a15f7;}})});}_0xd8301b=_[_0x9b14('0x3b')]({},_0xd8301b,_0xfcd1c3[_0x9b14('0x3d')]);var _0x1fd215={'where':_0xd8301b[_0x9b14('0x38')]};return db['MailTransferReport'][_0x9b14('0x1b')](_0x1fd215)[_0x9b14('0x23')](function(_0x45e6bd){_0x5c5af1['count']=_0x45e6bd;if(_0xfcd1c3[_0x9b14('0x30')][_0x9b14('0x3e')]){_0xd8301b['include']=[{'all':!![]}];}return db[_0x9b14('0x2a')]['findAll'](_0xd8301b);})[_0x9b14('0x23')](function(_0x11e6d0){_0x5c5af1[_0x9b14('0x3f')]=_0x11e6d0;return _0x5c5af1;})[_0x9b14('0x23')](respondWithFilteredResult(_0x58a549,_0xd8301b))[_0x9b14('0x40')](handleError(_0x58a549,null));};exports[_0x9b14('0x41')]=function(_0x282bd6,_0x6a9410){var _0x6255ee={'raw':!![],'where':{'id':_0x282bd6[_0x9b14('0x42')]['id']}},_0x38c941={};_0x38c941[_0x9b14('0x32')]=_[_0x9b14('0x2f')](db[_0x9b14('0x2a')][_0x9b14('0x2b')]);_0x38c941[_0x9b14('0x30')]=_[_0x9b14('0x2f')](_0x282bd6['query']);_0x38c941[_0x9b14('0x31')]=_[_0x9b14('0x34')](_0x38c941['model'],_0x38c941[_0x9b14('0x30')]);_0x6255ee['attributes']=_['intersection'](_0x38c941[_0x9b14('0x32')],qs[_0x9b14('0x35')](_0x282bd6[_0x9b14('0x30')][_0x9b14('0x35')]));_0x6255ee[_0x9b14('0x33')]=_0x6255ee[_0x9b14('0x33')][_0x9b14('0x43')]?_0x6255ee[_0x9b14('0x33')]:_0x38c941[_0x9b14('0x32')];if(_0x282bd6['query'][_0x9b14('0x3e')]){_0x6255ee[_0x9b14('0x44')]=[{'all':!![]}];}_0x6255ee=_['merge']({},_0x6255ee,_0x282bd6['options']);return db[_0x9b14('0x2a')][_0x9b14('0x45')](_0x6255ee)[_0x9b14('0x23')](handleEntityNotFound(_0x6a9410,null))['then'](respondWithResult(_0x6a9410,null))['catch'](handleError(_0x6a9410,null));};exports[_0x9b14('0x46')]=function(_0x2b2af9,_0x330ec7){return db['MailTransferReport'][_0x9b14('0x46')](_0x2b2af9[_0x9b14('0x47')],{})['then'](respondWithResult(_0x330ec7,0xc9))[_0x9b14('0x40')](handleError(_0x330ec7,null));};exports['update']=function(_0x3b5cca,_0xbe9348){if(_0x3b5cca[_0x9b14('0x47')]['id']){delete _0x3b5cca[_0x9b14('0x47')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x3b5cca['params']['id']}})[_0x9b14('0x23')](handleEntityNotFound(_0xbe9348,null))[_0x9b14('0x23')](saveUpdates(_0x3b5cca[_0x9b14('0x47')],null))[_0x9b14('0x23')](respondWithResult(_0xbe9348,null))[_0x9b14('0x40')](handleError(_0xbe9348,null));};exports[_0x9b14('0x24')]=function(_0x2c0d90,_0x561254){return db[_0x9b14('0x2a')][_0x9b14('0x45')]({'where':{'id':_0x2c0d90[_0x9b14('0x42')]['id']}})[_0x9b14('0x23')](handleEntityNotFound(_0x561254,null))[_0x9b14('0x23')](removeEntity(_0x561254,null))[_0x9b14('0x40')](handleError(_0x561254,null));};exports[_0x9b14('0x48')]=function(_0x36a874,_0x5c643d){return db[_0x9b14('0x2a')]['describe']()[_0x9b14('0x23')](respondWithResult(_0x5c643d,null))[_0x9b14('0x40')](handleError(_0x5c643d,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b6192fb..06ad0b6 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 _0x3c17=['bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x5add3e,_0x223908){var _0x18b2fd=function(_0x2048a1){while(--_0x2048a1){_0x5add3e['push'](_0x5add3e['shift']());}};_0x18b2fd(++_0x223908);}(_0x3c17,0x1a1));var _0x73c1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3c17[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x73c1('0x0'));var util=require('util');var logger=require(_0x73c1('0x1'))('api');var moment=require(_0x73c1('0x2'));var BPromise=require(_0x73c1('0x3'));var rp=require(_0x73c1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73c1('0x5'));var config=require(_0x73c1('0x6'));var attributes=require(_0x73c1('0x7'));module[_0x73c1('0x8')]=function(_0x48c943,_0x382f82){return _0x48c943['define'](_0x73c1('0x9'),attributes,{'tableName':_0x73c1('0xa'),'paranoid':![],'indexes':[{'name':_0x73c1('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b1=['api','moment','request-promise','path','../../config/environment','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd8b1,0x105));var _0x1d8b=function(_0x4a6d67,_0x4ce7db){_0x4a6d67=_0x4a6d67-0x0;var _0x3152e3=_0xd8b1[_0x4a6d67];return _0x3152e3;};'use strict';var _=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var logger=require(_0x1d8b('0x2'))(_0x1d8b('0x3'));var moment=require(_0x1d8b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d8b('0x5'));var fs=require('fs');var path=require(_0x1d8b('0x6'));var rimraf=require('rimraf');var config=require(_0x1d8b('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x4d5ba0,_0x27534c){return _0x4d5ba0['define'](_0x1d8b('0x8'),attributes,{'tableName':_0x1d8b('0x9'),'paranoid':![],'indexes':[{'name':_0x1d8b('0xa'),'fields':[_0x1d8b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 84bbe5a..8927d2c 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 _0xb306=['http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x18d82a,_0x48fbd1){var _0x7343de=function(_0x5f0a51){while(--_0x5f0a51){_0x18d82a['push'](_0x18d82a['shift']());}};_0x7343de(++_0x48fbd1);}(_0xb306,0x174));var _0x6b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb306[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6b30('0x0'));var util=require(_0x6b30('0x1'));var moment=require('moment');var BPromise=require(_0x6b30('0x2'));var rs=require(_0x6b30('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b30('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b30('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6b30('0x6'));var client=jayson[_0x6b30('0x7')][_0x6b30('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b432f,_0x359e5d,_0x38638c){return new BPromise(function(_0x431fd5,_0x53fbcb){return client[_0x6b30('0x9')](_0x2b432f,_0x38638c)[_0x6b30('0xa')](function(_0x4207d9){logger[_0x6b30('0xb')](_0x6b30('0xc'),_0x359e5d,_0x6b30('0xd'));logger['debug'](_0x6b30('0xe'),_0x359e5d,_0x6b30('0xd'),JSON[_0x6b30('0xf')](_0x4207d9));if(_0x4207d9['error']){if(_0x4207d9[_0x6b30('0x10')][_0x6b30('0x11')]===0x1f4){logger['error'](_0x6b30('0xc'),_0x359e5d,_0x4207d9[_0x6b30('0x10')][_0x6b30('0x12')]);return _0x53fbcb(_0x4207d9[_0x6b30('0x10')][_0x6b30('0x12')]);}logger[_0x6b30('0x10')](_0x6b30('0xc'),_0x359e5d,_0x4207d9[_0x6b30('0x10')][_0x6b30('0x12')]);return _0x431fd5(_0x4207d9[_0x6b30('0x10')][_0x6b30('0x12')]);}else{logger['info'](_0x6b30('0xc'),_0x359e5d,_0x6b30('0xd'));_0x431fd5(_0x4207d9['result'][_0x6b30('0x12')]);}})[_0x6b30('0x13')](function(_0x534e85){logger[_0x6b30('0x10')](_0x6b30('0xc'),_0x359e5d,_0x534e85);_0x53fbcb(_0x534e85);});});} \ No newline at end of file +var _0xa6d1=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x375f15,_0x8ed8ba){var _0x124a1c=function(_0x51757b){while(--_0x51757b){_0x375f15['push'](_0x375f15['shift']());}};_0x124a1c(++_0x8ed8ba);}(_0xa6d1,0x17c));var _0x1a6d=function(_0x22e16d,_0x1838a7){_0x22e16d=_0x22e16d-0x0;var _0x5e513c=_0xa6d1[_0x22e16d];return _0x5e513c;};'use strict';var _=require(_0x1a6d('0x0'));var util=require(_0x1a6d('0x1'));var moment=require(_0x1a6d('0x2'));var BPromise=require(_0x1a6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a6d('0x4'));var db=require(_0x1a6d('0x5'))['db'];var utils=require(_0x1a6d('0x6'));var logger=require(_0x1a6d('0x7'))(_0x1a6d('0x8'));var config=require('../../config/environment');var jayson=require(_0x1a6d('0x9'));var client=jayson[_0x1a6d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x397736,_0x5dc566,_0x58c5bc){return new BPromise(function(_0x1f0b0a,_0x279762){return client[_0x1a6d('0xb')](_0x397736,_0x58c5bc)[_0x1a6d('0xc')](function(_0x49266b){logger[_0x1a6d('0xd')](_0x1a6d('0xe'),_0x5dc566,_0x1a6d('0xf'));logger[_0x1a6d('0x10')](_0x1a6d('0x11'),_0x5dc566,_0x1a6d('0xf'),JSON[_0x1a6d('0x12')](_0x49266b));if(_0x49266b[_0x1a6d('0x13')]){if(_0x49266b[_0x1a6d('0x13')][_0x1a6d('0x14')]===0x1f4){logger['error'](_0x1a6d('0xe'),_0x5dc566,_0x49266b[_0x1a6d('0x13')][_0x1a6d('0x15')]);return _0x279762(_0x49266b[_0x1a6d('0x13')][_0x1a6d('0x15')]);}logger[_0x1a6d('0x13')](_0x1a6d('0xe'),_0x5dc566,_0x49266b[_0x1a6d('0x13')]['message']);return _0x1f0b0a(_0x49266b[_0x1a6d('0x13')][_0x1a6d('0x15')]);}else{logger[_0x1a6d('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x5dc566,_0x1a6d('0xf'));_0x1f0b0a(_0x49266b['result'][_0x1a6d('0x15')]);}})[_0x1a6d('0x16')](function(_0x2bffed){logger[_0x1a6d('0x13')](_0x1a6d('0xe'),_0x5dc566,_0x2bffed);_0x279762(_0x2bffed);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 6a059d6..0e48ca7 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 _0x40d5=['isAuthenticated','index','/describe','describe','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get'];(function(_0xf5565,_0x5b5fca){var _0x18d58a=function(_0x2c8531){while(--_0x2c8531){_0xf5565['push'](_0xf5565['shift']());}};_0x18d58a(++_0x5b5fca);}(_0x40d5,0x1c4));var _0x540d=function(_0x216327,_0x5482e3){_0x216327=_0x216327-0x0;var _0x4f152b=_0x40d5[_0x216327];return _0x4f152b;};'use strict';var multer=require(_0x540d('0x0'));var util=require(_0x540d('0x1'));var path=require(_0x540d('0x2'));var timeout=require(_0x540d('0x3'));var express=require(_0x540d('0x4'));var router=express[_0x540d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x540d('0x6'));var interaction=require(_0x540d('0x7'));var config=require('../../config/environment');var controller=require(_0x540d('0x8'));router[_0x540d('0x9')]('/',auth[_0x540d('0xa')](),controller[_0x540d('0xb')]);router[_0x540d('0x9')](_0x540d('0xc'),auth[_0x540d('0xa')](),controller[_0x540d('0xd')]);router['get']('/:id',auth[_0x540d('0xa')](),controller[_0x540d('0xe')]);router[_0x540d('0xf')]('/',auth['isAuthenticated'](),controller[_0x540d('0x10')]);router[_0x540d('0x11')]('/:id',auth[_0x540d('0xa')](),controller[_0x540d('0x12')]);router['delete']('/:id',auth[_0x540d('0xa')](),controller[_0x540d('0x13')]);module[_0x540d('0x14')]=router; \ No newline at end of file +var _0x1384=['multer','util','express','../../components/interaction/service','./memberReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x131f2f,_0x5158e1){var _0x8b2a79=function(_0x325316){while(--_0x325316){_0x131f2f['push'](_0x131f2f['shift']());}};_0x8b2a79(++_0x5158e1);}(_0x1384,0x1b0));var _0x4138=function(_0xcde562,_0x1b1cd4){_0xcde562=_0xcde562-0x0;var _0x57aca5=_0x1384[_0xcde562];return _0x57aca5;};'use strict';var multer=require(_0x4138('0x0'));var util=require(_0x4138('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4138('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4138('0x3'));var config=require('../../config/environment');var controller=require(_0x4138('0x4'));router['get']('/',auth[_0x4138('0x5')](),controller[_0x4138('0x6')]);router[_0x4138('0x7')]('/describe',auth[_0x4138('0x5')](),controller[_0x4138('0x8')]);router[_0x4138('0x7')](_0x4138('0x9'),auth['isAuthenticated'](),controller[_0x4138('0xa')]);router[_0x4138('0xb')]('/',auth[_0x4138('0x5')](),controller[_0x4138('0xc')]);router[_0x4138('0xd')](_0x4138('0x9'),auth[_0x4138('0x5')](),controller[_0x4138('0xe')]);router[_0x4138('0xf')](_0x4138('0x9'),auth[_0x4138('0x5')](),controller[_0x4138('0x10')]);module[_0x4138('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0781da9..653eff7 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 _0x4517=['talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x13641b,_0x2fca6b){var _0x290054=function(_0x205367){while(--_0x205367){_0x13641b['push'](_0x13641b['shift']());}};_0x290054(++_0x2fca6b);}(_0x4517,0x112));var _0x7451=function(_0x530c66,_0x304d42){_0x530c66=_0x530c66-0x0;var _0x3837f6=_0x4517[_0x530c66];return _0x3837f6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7451('0x0'));module[_0x7451('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7451('0x2')]},'interface':{'type':Sequelize[_0x7451('0x2')]},'type':{'type':Sequelize[_0x7451('0x2')],'defaultValue':_0x7451('0x3'),'comment':_0x7451('0x4')},'duration':{'type':Sequelize[_0x7451('0x5')]},'enterAt':{'type':Sequelize[_0x7451('0x6')]},'exitAt':{'type':Sequelize[_0x7451('0x6')],'set':function(_0x451332){var _0x3489f9=moment(_0x451332);var _0x3ac271=moment(this[_0x7451('0x7')](_0x7451('0x8')));var _0x443b80=_0x3489f9[_0x7451('0x9')](_0x3ac271,_0x7451('0xa'));this[_0x7451('0xb')]('exitAt',_0x451332);this[_0x7451('0xb')](_0x7451('0xc'),_0x443b80||null);}},'data1':{'type':Sequelize[_0x7451('0x2')],'comment':_0x7451('0xd')},'data2':{'type':Sequelize[_0x7451('0x2')],'comment':_0x7451('0xe')},'data3':{'type':Sequelize[_0x7451('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x7451('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0x7451('0x10')},'role':{'type':Sequelize[_0x7451('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x7451('0x2')]}}; \ No newline at end of file +var _0x7eb9=['exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','seconds','setDataValue'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7eb9,0xd9));var _0x97eb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7eb9[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x97eb('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x97eb('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x97eb('0x1')]},'type':{'type':Sequelize[_0x97eb('0x1')],'defaultValue':_0x97eb('0x2'),'comment':_0x97eb('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x97eb('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x5f78f4){var _0x5327d4=moment(_0x5f78f4);var _0x44595e=moment(this['getDataValue']('enterAt'));var _0x429ed6=_0x5327d4['diff'](_0x44595e,_0x97eb('0x5'));this[_0x97eb('0x6')](_0x97eb('0x7'),_0x5f78f4);this[_0x97eb('0x6')](_0x97eb('0x8'),_0x429ed6||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x97eb('0x1')],'comment':_0x97eb('0x9')},'data3':{'type':Sequelize[_0x97eb('0x1')],'comment':_0x97eb('0xa')},'data4':{'type':Sequelize[_0x97eb('0x1')],'comment':_0x97eb('0xb')},'data5':{'type':Sequelize[_0x97eb('0x1')],'comment':_0x97eb('0xc')},'role':{'type':Sequelize[_0x97eb('0x1')]},'internal':{'type':Sequelize[_0x97eb('0xd')]},'uniqueid':{'type':Sequelize[_0x97eb('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 15aa7df..570cc60 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x55ca,0x126));var _0xa55c=function(_0x1bc445,_0x2d6fe0){_0x1bc445=_0x1bc445-0x0;var _0x589e6b=_0x55ca[_0x1bc445];return _0x589e6b;};'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 _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x287b6a,_0x3b181d){var _0x4c070e=function(_0x5700ba){while(--_0x5700ba){_0x287b6a['push'](_0x287b6a['shift']());}};_0x4c070e(++_0x3b181d);}(_0x008c,0x188));var _0xc008=function(_0x4645bd,_0x1ad4c){_0x4645bd=_0x4645bd-0x0;var _0x59ebbb=_0x008c[_0x4645bd];return _0x59ebbb;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 42f0514..77abce2 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 _0x0ae1=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','lodash'];(function(_0x446eff,_0x4e88e2){var _0x178fcf=function(_0x3c45ed){while(--_0x3c45ed){_0x446eff['push'](_0x446eff['shift']());}};_0x178fcf(++_0x4e88e2);}(_0x0ae1,0x167));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x10ae('0x0'));var util=require(_0x10ae('0x1'));var logger=require(_0x10ae('0x2'))(_0x10ae('0x3'));var moment=require('moment');var BPromise=require(_0x10ae('0x4'));var rp=require(_0x10ae('0x5'));var fs=require('fs');var path=require(_0x10ae('0x6'));var rimraf=require(_0x10ae('0x7'));var config=require(_0x10ae('0x8'));var attributes=require(_0x10ae('0x9'));module[_0x10ae('0xa')]=function(_0x4fda2f,_0x202602){return _0x4fda2f[_0x10ae('0xb')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9525=['report_member','membername','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','MemberReport'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x9525,0x12e));var _0x5952=function(_0x4518e2,_0xdfa81a){_0x4518e2=_0x4518e2-0x0;var _0x565409=_0x9525[_0x4518e2];return _0x565409;};'use strict';var _=require(_0x5952('0x0'));var util=require('util');var logger=require(_0x5952('0x1'))(_0x5952('0x2'));var moment=require(_0x5952('0x3'));var BPromise=require(_0x5952('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5952('0x5'));var config=require(_0x5952('0x6'));var attributes=require('./memberReport.attributes');module[_0x5952('0x7')]=function(_0x46aba5,_0x4c6368){return _0x46aba5[_0x5952('0x8')](_0x5952('0x9'),attributes,{'tableName':_0x5952('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x5952('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7d986f9..b02fe88 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 _0x81c6=['GetMemberReport','MemberReport','findAll','options','where','limit','include','map','model','attributes','CreateMemberReport','body','raw','UpdateMemberReport','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch'];(function(_0x21d818,_0x2e63f2){var _0x220a69=function(_0x220ae4){while(--_0x220ae4){_0x21d818['push'](_0x21d818['shift']());}};_0x220a69(++_0x2e63f2);}(_0x81c6,0x1d5));var _0x681c=function(_0x194b25,_0x4bedc4){_0x194b25=_0x194b25-0x0;var _0x107ac5=_0x81c6[_0x194b25];return _0x107ac5;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('MemberReport,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('MemberReport,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});}exports[_0x681c('0x15')]=function(_0x42f506){var _0x4a9192=this;return new Promise(function(_0x42304f,_0x5b03fd){return db[_0x681c('0x16')][_0x681c('0x17')]({'raw':_0x42f506['options']?_0x42f506[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')]['attributes']||null:null,'limit':_0x42f506['options']?_0x42f506['options'][_0x681c('0x1a')]||null:null,'include':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x42f506[_0x681c('0x18')][_0x681c('0x1b')],function(_0x3d0297){return{'model':db[_0x3d0297[_0x681c('0x1d')]],'as':_0x3d0297['as'],'attributes':_0x3d0297[_0x681c('0x1e')],'include':_0x3d0297[_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x3d0297[_0x681c('0x1b')],function(_0x218410){return{'model':db[_0x218410[_0x681c('0x1d')]],'as':_0x218410['as'],'attributes':_0x218410[_0x681c('0x1e')],'include':_0x218410['include']?_[_0x681c('0x1c')](_0x218410['include'],function(_0x5f8d64){return{'model':db[_0x5f8d64['model']],'as':_0x5f8d64['as'],'attributes':_0x5f8d64['attributes']};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x17ea7c){logger[_0x681c('0x12')](_0x681c('0x15'),_0x42f506);logger['debug'](_0x681c('0x15'),_0x42f506,JSON[_0x681c('0xe')](_0x17ea7c));_0x42304f(_0x17ea7c);})[_0x681c('0x14')](function(_0x936fce){logger[_0x681c('0x10')](_0x681c('0x15'),_0x936fce[_0x681c('0x11')],_0x42f506);_0x5b03fd(_0x4a9192['error'](0x1f4,_0x936fce[_0x681c('0x11')]));});});};exports[_0x681c('0x1f')]=function(_0x2e783d){var _0x4af6aa=this;return new Promise(function(_0x385b14,_0x2179cd){return db[_0x681c('0x16')]['create'](_0x2e783d[_0x681c('0x20')],{'raw':_0x2e783d['options']?_0x2e783d['options'][_0x681c('0x21')]===undefined?!![]:![]:!![]})[_0x681c('0x9')](function(_0x16277f){logger['info'](_0x681c('0x1f'),_0x2e783d);logger['debug'](_0x681c('0x1f'),_0x2e783d,JSON['stringify'](_0x16277f));_0x385b14(_0x16277f);})['catch'](function(_0x4ea825){logger[_0x681c('0x10')](_0x681c('0x1f'),_0x4ea825['message'],_0x2e783d);_0x2179cd(_0x4af6aa[_0x681c('0x10')](0x1f4,_0x4ea825['message']));});});};exports['UpdateMemberReport']=function(_0x3286e1){var _0x52261f=this;return new Promise(function(_0x35991d,_0x4e22f8){return db[_0x681c('0x16')]['update'](_0x3286e1['body'],{'raw':_0x3286e1[_0x681c('0x18')]?_0x3286e1[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3286e1[_0x681c('0x18')]?_0x3286e1[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x3286e1['options']?_0x3286e1[_0x681c('0x18')][_0x681c('0x1e')]||null:null,'limit':_0x3286e1['options']?_0x3286e1[_0x681c('0x18')][_0x681c('0x1a')]||null:null})[_0x681c('0x9')](function(_0x435188){logger[_0x681c('0x12')]('UpdateMemberReport',_0x3286e1);logger['debug'](_0x681c('0x22'),_0x3286e1,JSON[_0x681c('0xe')](_0x435188));_0x35991d(_0x435188);})['catch'](function(_0x3f8618){logger[_0x681c('0x10')]('UpdateMemberReport',_0x3f8618[_0x681c('0x11')],_0x3286e1);_0x4e22f8(_0x52261f[_0x681c('0x10')](0x1f4,_0x3f8618[_0x681c('0x11')]));});});}; \ No newline at end of file +var _0x6bfc=['body','raw','CreateMemberReport','catch','UpdateMemberReport','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetMemberReport','findAll','options','attributes','limit','map','include','model','MemberReport','create'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x6bfc,0x159));var _0xc6bf=function(_0x2db910,_0x2e9bb0){_0x2db910=_0x2db910-0x0;var _0x56129a=_0x6bfc[_0x2db910];return _0x56129a;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var moment=require(_0xc6bf('0x1'));var BPromise=require(_0xc6bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6bf('0x4'));var logger=require('../../config/logger')(_0xc6bf('0x5'));var config=require(_0xc6bf('0x6'));var jayson=require(_0xc6bf('0x7'));var client=jayson['client'][_0xc6bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c9049,_0x47039a,_0x28d218){return new BPromise(function(_0x250311,_0x3b2815){return client[_0xc6bf('0x9')](_0x2c9049,_0x28d218)[_0xc6bf('0xa')](function(_0x52dac0){logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));logger[_0xc6bf('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x47039a,'request\x20sent',JSON[_0xc6bf('0xf')](_0x52dac0));if(_0x52dac0[_0xc6bf('0x10')]){if(_0x52dac0['error']['code']===0x1f4){logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error'][_0xc6bf('0x11')]);return _0x3b2815(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error']['message']);return _0x250311(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}else{logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));_0x250311(_0x52dac0[_0xc6bf('0x12')][_0xc6bf('0x11')]);}})['catch'](function(_0x23498a){logger['error']('MemberReport,\x20%s,\x20%s',_0x47039a,_0x23498a);_0x3b2815(_0x23498a);});});}exports[_0xc6bf('0x13')]=function(_0x23a9e9){var _0x5bdc69=this;return new Promise(function(_0x370150,_0x1079db){return db['MemberReport'][_0xc6bf('0x14')]({'raw':_0x23a9e9['options']?_0x23a9e9['options']['raw']===undefined?!![]:![]:!![],'where':_0x23a9e9[_0xc6bf('0x15')]?_0x23a9e9[_0xc6bf('0x15')]['where']||null:null,'attributes':_0x23a9e9['options']?_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x16')]||null:null,'limit':_0x23a9e9['options']?_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x17')]||null:null,'include':_0x23a9e9[_0xc6bf('0x15')]?_0x23a9e9[_0xc6bf('0x15')]['include']?_[_0xc6bf('0x18')](_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x19')],function(_0x1a0a50){return{'model':db[_0x1a0a50[_0xc6bf('0x1a')]],'as':_0x1a0a50['as'],'attributes':_0x1a0a50[_0xc6bf('0x16')],'include':_0x1a0a50[_0xc6bf('0x19')]?_[_0xc6bf('0x18')](_0x1a0a50['include'],function(_0x312138){return{'model':db[_0x312138[_0xc6bf('0x1a')]],'as':_0x312138['as'],'attributes':_0x312138[_0xc6bf('0x16')],'include':_0x312138['include']?_[_0xc6bf('0x18')](_0x312138[_0xc6bf('0x19')],function(_0x412e61){return{'model':db[_0x412e61[_0xc6bf('0x1a')]],'as':_0x412e61['as'],'attributes':_0x412e61[_0xc6bf('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc6bf('0xa')](function(_0x5abf52){logger['info'](_0xc6bf('0x13'),_0x23a9e9);logger['debug'](_0xc6bf('0x13'),_0x23a9e9,JSON['stringify'](_0x5abf52));_0x370150(_0x5abf52);})['catch'](function(_0x2806e6){logger[_0xc6bf('0x10')](_0xc6bf('0x13'),_0x2806e6[_0xc6bf('0x11')],_0x23a9e9);_0x1079db(_0x5bdc69['error'](0x1f4,_0x2806e6['message']));});});};exports['CreateMemberReport']=function(_0x4f0234){var _0x32407b=this;return new Promise(function(_0xf49ed7,_0x1d46bd){return db[_0xc6bf('0x1b')][_0xc6bf('0x1c')](_0x4f0234[_0xc6bf('0x1d')],{'raw':_0x4f0234[_0xc6bf('0x15')]?_0x4f0234[_0xc6bf('0x15')][_0xc6bf('0x1e')]===undefined?!![]:![]:!![]})[_0xc6bf('0xa')](function(_0x2ec79e){logger[_0xc6bf('0xb')](_0xc6bf('0x1f'),_0x4f0234);logger[_0xc6bf('0xe')](_0xc6bf('0x1f'),_0x4f0234,JSON['stringify'](_0x2ec79e));_0xf49ed7(_0x2ec79e);})[_0xc6bf('0x20')](function(_0x1245d7){logger[_0xc6bf('0x10')](_0xc6bf('0x1f'),_0x1245d7['message'],_0x4f0234);_0x1d46bd(_0x32407b['error'](0x1f4,_0x1245d7[_0xc6bf('0x11')]));});});};exports[_0xc6bf('0x21')]=function(_0x11de46){var _0x3e3d15=this;return new Promise(function(_0x2e8363,_0x5ec7ce){return db[_0xc6bf('0x1b')]['update'](_0x11de46['body'],{'raw':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')][_0xc6bf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')]['where']||null:null,'attributes':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')]['attributes']||null:null,'limit':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')][_0xc6bf('0x17')]||null:null})['then'](function(_0x5d1dbd){logger['info'](_0xc6bf('0x21'),_0x11de46);logger[_0xc6bf('0xe')](_0xc6bf('0x21'),_0x11de46,JSON['stringify'](_0x5d1dbd));_0x2e8363(_0x5d1dbd);})[_0xc6bf('0x20')](function(_0x559eb3){logger['error'](_0xc6bf('0x21'),_0x559eb3[_0xc6bf('0x11')],_0x11de46);_0x5ec7ce(_0x3e3d15[_0xc6bf('0x10')](0x1f4,_0x559eb3['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 17f2b09..f38633d 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 _0x8be6=['index','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x4f49fe,_0x5f535f){var _0x356fc1=function(_0x2e2f9b){while(--_0x2e2f9b){_0x4f49fe['push'](_0x4f49fe['shift']());}};_0x356fc1(++_0x5f535f);}(_0x8be6,0xa4));var _0x68be=function(_0x27c86a,_0x4d6910){_0x27c86a=_0x27c86a-0x0;var _0x60bd5c=_0x8be6[_0x27c86a];return _0x60bd5c;};'use strict';var multer=require(_0x68be('0x0'));var util=require('util');var path=require(_0x68be('0x1'));var timeout=require('connect-timeout');var express=require(_0x68be('0x2'));var router=express['Router']();var fs_extra=require(_0x68be('0x3'));var auth=require(_0x68be('0x4'));var interaction=require(_0x68be('0x5'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x68be('0x6')]('/',controller[_0x68be('0x7')]);module[_0x68be('0x8')]=router; \ No newline at end of file +var _0xadd2=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xc5c376,_0x58f0d5){var _0x1facfe=function(_0x505792){while(--_0x505792){_0xc5c376['push'](_0xc5c376['shift']());}};_0x1facfe(++_0x58f0d5);}(_0xadd2,0xa5));var _0x2add=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xadd2[_0x178e48];return _0x440d7e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2add('0x0'));var timeout=require('connect-timeout');var express=require(_0x2add('0x1'));var router=express[_0x2add('0x2')]();var fs_extra=require(_0x2add('0x3'));var auth=require(_0x2add('0x4'));var interaction=require(_0x2add('0x5'));var config=require(_0x2add('0x6'));var controller=require(_0x2add('0x7'));router[_0x2add('0x8')]('/',controller[_0x2add('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index a09fe5e..26c8a6b 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 _0x6070=['exports','STRING'];(function(_0x44e03,_0x495e50){var _0x328afc=function(_0x11f2b3){while(--_0x11f2b3){_0x44e03['push'](_0x44e03['shift']());}};_0x328afc(++_0x495e50);}(_0x6070,0x1f0));var _0x0607=function(_0x4dcac4,_0x10e48a){_0x4dcac4=_0x4dcac4-0x0;var _0x2a238d=_0x6070[_0x4dcac4];return _0x2a238d;};'use strict';var Sequelize=require('sequelize');module[_0x0607('0x0')]={'version':{'type':Sequelize[_0x0607('0x1')],'unique':'version'}}; \ No newline at end of file +var _0x085c=['exports','version'];(function(_0x2eb1f,_0x6b7803){var _0xc359c9=function(_0xe1148){while(--_0xe1148){_0x2eb1f['push'](_0x2eb1f['shift']());}};_0xc359c9(++_0x6b7803);}(_0x085c,0x88));var _0xc085=function(_0x3f7830,_0x2ef515){_0x3f7830=_0x3f7830-0x0;var _0x392bcf=_0x085c[_0x3f7830];return _0x392bcf;};'use strict';var Sequelize=require('sequelize');module[_0xc085('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xc085('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 978e92d..bf51585 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 _0x9059=['attributes','fields','length','query','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','Migration','rawAttributes','fieldName','type','key','model','filters','intersection'];(function(_0x1870be,_0x20af98){var _0x4d816c=function(_0x15e8d1){while(--_0x15e8d1){_0x1870be['push'](_0x1870be['shift']());}};_0x4d816c(++_0x20af98);}(_0x9059,0x9b));var _0x9905=function(_0x5ef0e0,_0x2555be){_0x5ef0e0=_0x5ef0e0-0x0;var _0x2fabde=_0x9059[_0x5ef0e0];return _0x2fabde;};'use strict';var emlformat=require(_0x9905('0x0'));var rimraf=require(_0x9905('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9905('0x2'));var rp=require(_0x9905('0x3'));var moment=require(_0x9905('0x4'));var BPromise=require(_0x9905('0x5'));var Mustache=require('mustache');var util=require(_0x9905('0x6'));var path=require(_0x9905('0x7'));var sox=require(_0x9905('0x8'));var csv=require(_0x9905('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9905('0xa'));var _=require(_0x9905('0xb'));var squel=require(_0x9905('0xc'));var crypto=require(_0x9905('0xd'));var jsforce=require(_0x9905('0xe'));var deskjs=require(_0x9905('0xf'));var toCsv=require(_0x9905('0x9'));var querystring=require('querystring');var Papa=require(_0x9905('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9905('0x11'));var as=require(_0x9905('0x12'));var hardwareService=require(_0x9905('0x13'));var logger=require(_0x9905('0x14'))(_0x9905('0x15'));var utils=require(_0x9905('0x16'));var config=require(_0x9905('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dc8a9,_0x5e8e8a){_0x5e8e8a=_0x5e8e8a||0xcc;return function(_0x3c729a){if(_0x3c729a){return _0x1dc8a9[_0x9905('0x18')](_0x5e8e8a);}return _0x1dc8a9[_0x9905('0x19')](_0x5e8e8a)[_0x9905('0x1a')]();};}function respondWithResult(_0x56401b,_0x5c06a9){_0x5c06a9=_0x5c06a9||0xc8;return function(_0x4acfc3){if(_0x4acfc3){return _0x56401b[_0x9905('0x19')](_0x5c06a9)[_0x9905('0x1b')](_0x4acfc3);}};}function respondWithFilteredResult(_0x14b937,_0x5895a5){return function(_0x527d19){if(_0x527d19){var _0x4ea68b=typeof _0x5895a5[_0x9905('0x1c')]===_0x9905('0x1d')&&typeof _0x5895a5['limit']==='undefined';var _0x321f65=_0x527d19[_0x9905('0x1e')];var _0x2b4863=_0x4ea68b?0x0:_0x5895a5[_0x9905('0x1c')];var _0x39de4e=_0x4ea68b?_0x527d19[_0x9905('0x1e')]:_0x5895a5['offset']+_0x5895a5['limit'];var _0x421529;if(_0x39de4e>=_0x321f65){_0x39de4e=_0x321f65;_0x421529=0xc8;}else{_0x421529=0xce;}_0x14b937[_0x9905('0x19')](_0x421529);return _0x14b937[_0x9905('0x1f')](_0x9905('0x20'),_0x2b4863+'-'+_0x39de4e+'/'+_0x321f65)[_0x9905('0x1b')](_0x527d19);}return null;};}function patchUpdates(_0x229142){return function(_0x1dfe44){try{jsonpatch[_0x9905('0x21')](_0x1dfe44,_0x229142,!![]);}catch(_0xbf4b14){return BPromise['reject'](_0xbf4b14);}return _0x1dfe44[_0x9905('0x22')]();};}function saveUpdates(_0x886a,_0xdce571){return function(_0x2cfdb4){if(_0x2cfdb4){return _0x2cfdb4[_0x9905('0x23')](_0x886a)[_0x9905('0x24')](function(_0x1be875){return _0x1be875;});}return null;};}function removeEntity(_0xaa5b53,_0x2493f7){return function(_0x1b5324){if(_0x1b5324){return _0x1b5324[_0x9905('0x25')]()['then'](function(){_0xaa5b53[_0x9905('0x19')](0xcc)[_0x9905('0x1a')]();});}};}function handleEntityNotFound(_0x41fd73,_0x22016a){return function(_0x4ccb7d){if(!_0x4ccb7d){_0x41fd73['sendStatus'](0x194);}return _0x4ccb7d;};}function handleError(_0xecd69f,_0x482756){_0x482756=_0x482756||0x1f4;return function(_0x27666b){logger[_0x9905('0x26')](_0x27666b[_0x9905('0x27')]);if(_0x27666b['name']){delete _0x27666b[_0x9905('0x28')];}_0xecd69f[_0x9905('0x19')](_0x482756)['send'](_0x27666b);};}exports['index']=function(_0x466f02,_0x286c96){var _0x2c27af={},_0x14f877={},_0x49821d={'count':0x0,'rows':[]};var _0x4c8458=_['map'](db[_0x9905('0x29')][_0x9905('0x2a')],function(_0x2011d4){return{'name':_0x2011d4[_0x9905('0x2b')],'type':_0x2011d4[_0x9905('0x2c')][_0x9905('0x2d')]};});_0x14f877[_0x9905('0x2e')]=_['map'](_0x4c8458,'name');_0x14f877['query']=_['keys'](_0x466f02['query']);_0x14f877[_0x9905('0x2f')]=_[_0x9905('0x30')](_0x14f877['model'],_0x14f877['query']);_0x2c27af[_0x9905('0x31')]=_['intersection'](_0x14f877[_0x9905('0x2e')],qs['fields'](_0x466f02['query'][_0x9905('0x32')]));_0x2c27af[_0x9905('0x31')]=_0x2c27af[_0x9905('0x31')][_0x9905('0x33')]?_0x2c27af[_0x9905('0x31')]:_0x14f877['model'];if(!_0x466f02[_0x9905('0x34')][_0x9905('0x35')](_0x9905('0x36'))){_0x2c27af[_0x9905('0x37')]=qs['limit'](_0x466f02['query'][_0x9905('0x37')]);_0x2c27af[_0x9905('0x1c')]=qs[_0x9905('0x1c')](_0x466f02['query'][_0x9905('0x1c')]);}_0x2c27af['order']=qs[_0x9905('0x38')](_0x466f02[_0x9905('0x34')]['sort']);_0x2c27af[_0x9905('0x39')]=qs[_0x9905('0x2f')](_[_0x9905('0x3a')](_0x466f02[_0x9905('0x34')],_0x14f877[_0x9905('0x2f')]),_0x4c8458);if(_0x466f02[_0x9905('0x34')][_0x9905('0x3b')]){_0x2c27af[_0x9905('0x39')]=_[_0x9905('0x3c')](_0x2c27af[_0x9905('0x39')],{'$or':_[_0x9905('0x3d')](_0x4c8458,function(_0x33e685){if(_0x33e685[_0x9905('0x2c')]!==_0x9905('0x3e')){var _0x1b748c={};_0x1b748c[_0x33e685[_0x9905('0x28')]]={'$like':'%'+_0x466f02[_0x9905('0x34')]['filter']+'%'};return _0x1b748c;}})});}_0x2c27af=_['merge']({},_0x2c27af,_0x466f02[_0x9905('0x3f')]);var _0x145c62={'where':_0x2c27af[_0x9905('0x39')]};return db[_0x9905('0x29')][_0x9905('0x1e')](_0x145c62)[_0x9905('0x24')](function(_0x2dc0c8){_0x49821d[_0x9905('0x1e')]=_0x2dc0c8;if(_0x466f02['query'][_0x9905('0x40')]){_0x2c27af[_0x9905('0x41')]=[{'all':!![]}];}return db[_0x9905('0x29')]['findAll'](_0x2c27af);})[_0x9905('0x24')](function(_0x27a5d2){_0x49821d[_0x9905('0x42')]=_0x27a5d2;return _0x49821d;})[_0x9905('0x24')](respondWithFilteredResult(_0x286c96,_0x2c27af))[_0x9905('0x43')](handleError(_0x286c96,null));}; \ No newline at end of file +var _0x0142=['options','include','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x248f3b,_0x42fba9){var _0x3368f8=function(_0x15158b){while(--_0x15158b){_0x248f3b['push'](_0x248f3b['shift']());}};_0x3368f8(++_0x42fba9);}(_0x0142,0x158));var _0x2014=function(_0x5c6bc9,_0x4276f7){_0x5c6bc9=_0x5c6bc9-0x0;var _0x5b1fa5=_0x0142[_0x5c6bc9];return _0x5b1fa5;};'use strict';var emlformat=require(_0x2014('0x0'));var rimraf=require(_0x2014('0x1'));var zipdir=require(_0x2014('0x2'));var jsonpatch=require(_0x2014('0x3'));var rp=require('request-promise');var moment=require(_0x2014('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2014('0x5'));var path=require('path');var sox=require(_0x2014('0x6'));var csv=require('to-csv');var ejs=require(_0x2014('0x7'));var fs=require('fs');var fs_extra=require(_0x2014('0x8'));var _=require(_0x2014('0x9'));var squel=require(_0x2014('0xa'));var crypto=require(_0x2014('0xb'));var jsforce=require(_0x2014('0xc'));var deskjs=require(_0x2014('0xd'));var toCsv=require(_0x2014('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2014('0xf'));var qs=require(_0x2014('0x10'));var as=require(_0x2014('0x11'));var hardwareService=require(_0x2014('0x12'));var logger=require('../../config/logger')(_0x2014('0x13'));var utils=require(_0x2014('0x14'));var config=require(_0x2014('0x15'));var licenseUtil=require(_0x2014('0x16'));var db=require(_0x2014('0x17'))['db'];function respondWithStatusCode(_0x19a1d1,_0x45ef86){_0x45ef86=_0x45ef86||0xcc;return function(_0x1ad337){if(_0x1ad337){return _0x19a1d1[_0x2014('0x18')](_0x45ef86);}return _0x19a1d1[_0x2014('0x19')](_0x45ef86)[_0x2014('0x1a')]();};}function respondWithResult(_0x581671,_0x4f593d){_0x4f593d=_0x4f593d||0xc8;return function(_0x4e7b79){if(_0x4e7b79){return _0x581671[_0x2014('0x19')](_0x4f593d)['json'](_0x4e7b79);}};}function respondWithFilteredResult(_0x2fadba,_0x1c45dd){return function(_0x4f4e62){if(_0x4f4e62){var _0x39ecf6=typeof _0x1c45dd[_0x2014('0x1b')]===_0x2014('0x1c')&&typeof _0x1c45dd['limit']==='undefined';var _0x241ce6=_0x4f4e62[_0x2014('0x1d')];var _0x1f86de=_0x39ecf6?0x0:_0x1c45dd[_0x2014('0x1b')];var _0x48c0cc=_0x39ecf6?_0x4f4e62[_0x2014('0x1d')]:_0x1c45dd[_0x2014('0x1b')]+_0x1c45dd[_0x2014('0x1e')];var _0x6efd51;if(_0x48c0cc>=_0x241ce6){_0x48c0cc=_0x241ce6;_0x6efd51=0xc8;}else{_0x6efd51=0xce;}_0x2fadba['status'](_0x6efd51);return _0x2fadba[_0x2014('0x1f')](_0x2014('0x20'),_0x1f86de+'-'+_0x48c0cc+'/'+_0x241ce6)[_0x2014('0x21')](_0x4f4e62);}return null;};}function patchUpdates(_0x453e65){return function(_0x10066a){try{jsonpatch[_0x2014('0x22')](_0x10066a,_0x453e65,!![]);}catch(_0xcab29d){return BPromise['reject'](_0xcab29d);}return _0x10066a[_0x2014('0x23')]();};}function saveUpdates(_0x447567,_0xeaacae){return function(_0x5b88df){if(_0x5b88df){return _0x5b88df['update'](_0x447567)[_0x2014('0x24')](function(_0x40e4f8){return _0x40e4f8;});}return null;};}function removeEntity(_0x4907c5,_0x473085){return function(_0x170f8f){if(_0x170f8f){return _0x170f8f[_0x2014('0x25')]()[_0x2014('0x24')](function(){_0x4907c5['status'](0xcc)[_0x2014('0x1a')]();});}};}function handleEntityNotFound(_0x53d1ab,_0x3b182f){return function(_0x2f6162){if(!_0x2f6162){_0x53d1ab[_0x2014('0x18')](0x194);}return _0x2f6162;};}function handleError(_0x5d49a8,_0x5d3d63){_0x5d3d63=_0x5d3d63||0x1f4;return function(_0x3c96ff){logger['error'](_0x3c96ff[_0x2014('0x26')]);if(_0x3c96ff[_0x2014('0x27')]){delete _0x3c96ff[_0x2014('0x27')];}_0x5d49a8[_0x2014('0x19')](_0x5d3d63)[_0x2014('0x28')](_0x3c96ff);};}exports[_0x2014('0x29')]=function(_0x28c3f7,_0x2d4a9a){var _0x2b9cf2={},_0x56924e={},_0x407457={'count':0x0,'rows':[]};var _0x41ce5a=_[_0x2014('0x2a')](db[_0x2014('0x2b')][_0x2014('0x2c')],function(_0x39823c){return{'name':_0x39823c[_0x2014('0x2d')],'type':_0x39823c[_0x2014('0x2e')]['key']};});_0x56924e['model']=_['map'](_0x41ce5a,'name');_0x56924e[_0x2014('0x2f')]=_[_0x2014('0x30')](_0x28c3f7[_0x2014('0x2f')]);_0x56924e[_0x2014('0x31')]=_['intersection'](_0x56924e['model'],_0x56924e[_0x2014('0x2f')]);_0x2b9cf2[_0x2014('0x32')]=_[_0x2014('0x33')](_0x56924e[_0x2014('0x34')],qs[_0x2014('0x35')](_0x28c3f7['query']['fields']));_0x2b9cf2[_0x2014('0x32')]=_0x2b9cf2['attributes'][_0x2014('0x36')]?_0x2b9cf2[_0x2014('0x32')]:_0x56924e['model'];if(!_0x28c3f7[_0x2014('0x2f')][_0x2014('0x37')](_0x2014('0x38'))){_0x2b9cf2[_0x2014('0x1e')]=qs['limit'](_0x28c3f7[_0x2014('0x2f')][_0x2014('0x1e')]);_0x2b9cf2[_0x2014('0x1b')]=qs[_0x2014('0x1b')](_0x28c3f7[_0x2014('0x2f')][_0x2014('0x1b')]);}_0x2b9cf2[_0x2014('0x39')]=qs[_0x2014('0x3a')](_0x28c3f7[_0x2014('0x2f')][_0x2014('0x3a')]);_0x2b9cf2[_0x2014('0x3b')]=qs[_0x2014('0x31')](_[_0x2014('0x3c')](_0x28c3f7[_0x2014('0x2f')],_0x56924e[_0x2014('0x31')]),_0x41ce5a);if(_0x28c3f7[_0x2014('0x2f')][_0x2014('0x3d')]){_0x2b9cf2['where']=_[_0x2014('0x3e')](_0x2b9cf2[_0x2014('0x3b')],{'$or':_[_0x2014('0x2a')](_0x41ce5a,function(_0x517509){if(_0x517509[_0x2014('0x2e')]!==_0x2014('0x3f')){var _0x36e446={};_0x36e446[_0x517509[_0x2014('0x27')]]={'$like':'%'+_0x28c3f7[_0x2014('0x2f')][_0x2014('0x3d')]+'%'};return _0x36e446;}})});}_0x2b9cf2=_[_0x2014('0x3e')]({},_0x2b9cf2,_0x28c3f7[_0x2014('0x40')]);var _0x3bf653={'where':_0x2b9cf2[_0x2014('0x3b')]};return db[_0x2014('0x2b')][_0x2014('0x1d')](_0x3bf653)['then'](function(_0x5696aa){_0x407457['count']=_0x5696aa;if(_0x28c3f7[_0x2014('0x2f')]['includeAll']){_0x2b9cf2[_0x2014('0x41')]=[{'all':!![]}];}return db[_0x2014('0x2b')][_0x2014('0x42')](_0x2b9cf2);})['then'](function(_0x548b71){_0x407457[_0x2014('0x43')]=_0x548b71;return _0x407457;})[_0x2014('0x24')](respondWithFilteredResult(_0x2d4a9a,_0x2b9cf2))['catch'](handleError(_0x2d4a9a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b1bbb6a..43d18f2 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 _0x72cc=['exports','define','Migration','migrations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes'];(function(_0xf74f86,_0x15c144){var _0xcc5a97=function(_0x1d5832){while(--_0x1d5832){_0xf74f86['push'](_0xf74f86['shift']());}};_0xcc5a97(++_0x15c144);}(_0x72cc,0x18a));var _0xc72c=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x72cc[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xc72c('0x0'));var util=require(_0xc72c('0x1'));var logger=require(_0xc72c('0x2'))('api');var moment=require(_0xc72c('0x3'));var BPromise=require(_0xc72c('0x4'));var rp=require(_0xc72c('0x5'));var fs=require('fs');var path=require(_0xc72c('0x6'));var rimraf=require('rimraf');var config=require(_0xc72c('0x7'));var attributes=require(_0xc72c('0x8'));module[_0xc72c('0x9')]=function(_0x1c2a43,_0x303273){return _0x1c2a43[_0xc72c('0xa')](_0xc72c('0xb'),attributes,{'tableName':_0xc72c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x210d=['Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./migration.attributes','exports','define'];(function(_0x10364c,_0x3859a8){var _0xceda=function(_0x2e9b1f){while(--_0x2e9b1f){_0x10364c['push'](_0x10364c['shift']());}};_0xceda(++_0x3859a8);}(_0x210d,0x72));var _0xd210=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0x210d[_0x3a99f4];return _0xea0b42;};'use strict';var _=require(_0xd210('0x0'));var util=require(_0xd210('0x1'));var logger=require(_0xd210('0x2'))(_0xd210('0x3'));var moment=require(_0xd210('0x4'));var BPromise=require(_0xd210('0x5'));var rp=require(_0xd210('0x6'));var fs=require('fs');var path=require(_0xd210('0x7'));var rimraf=require(_0xd210('0x8'));var config=require('../../config/environment');var attributes=require(_0xd210('0x9'));module[_0xd210('0xa')]=function(_0x59f54f,_0x33c448){return _0x59f54f[_0xd210('0xb')](_0xd210('0xc'),attributes,{'tableName':_0xd210('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 0ceed69..bb4c938 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 _0x9e0d=['stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x4c2043,_0x1ff7c9){_0x4c2043=_0x4c2043-0x0;var _0x55eb00=_0x9e0d[_0x4c2043];return _0x55eb00;};'use strict';var _=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var moment=require(_0xd9e0('0x2'));var BPromise=require(_0xd9e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9e0('0x4'));var db=require(_0xd9e0('0x5'))['db'];var utils=require(_0xd9e0('0x6'));var logger=require(_0xd9e0('0x7'))(_0xd9e0('0x8'));var config=require(_0xd9e0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd9e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28ce1e,_0x36d1c7,_0x3f8bb2){return new BPromise(function(_0x256df0,_0x3315d8){return client['request'](_0x28ce1e,_0x3f8bb2)[_0xd9e0('0xb')](function(_0x36e6e7){logger[_0xd9e0('0xc')](_0xd9e0('0xd'),_0x36d1c7,_0xd9e0('0xe'));logger[_0xd9e0('0xf')](_0xd9e0('0x10'),_0x36d1c7,'request\x20sent',JSON[_0xd9e0('0x11')](_0x36e6e7));if(_0x36e6e7[_0xd9e0('0x12')]){if(_0x36e6e7['error'][_0xd9e0('0x13')]===0x1f4){logger[_0xd9e0('0x12')](_0xd9e0('0xd'),_0x36d1c7,_0x36e6e7[_0xd9e0('0x12')][_0xd9e0('0x14')]);return _0x3315d8(_0x36e6e7['error'][_0xd9e0('0x14')]);}logger['error'](_0xd9e0('0xd'),_0x36d1c7,_0x36e6e7['error'][_0xd9e0('0x14')]);return _0x256df0(_0x36e6e7[_0xd9e0('0x12')][_0xd9e0('0x14')]);}else{logger[_0xd9e0('0xc')](_0xd9e0('0xd'),_0x36d1c7,'request\x20sent');_0x256df0(_0x36e6e7['result']['message']);}})[_0xd9e0('0x15')](function(_0x386816){logger[_0xd9e0('0x12')](_0xd9e0('0xd'),_0x36d1c7,_0x386816);_0x3315d8(_0x386816);});});} \ No newline at end of file +var _0x0aaf=['rpc','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4c9508,_0x101a7c){var _0x172479=function(_0x39c7b5){while(--_0x39c7b5){_0x4c9508['push'](_0x4c9508['shift']());}};_0x172479(++_0x101a7c);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x49b076,_0x4fb74e){_0x49b076=_0x49b076-0x0;var _0xa3609=_0x0aaf[_0x49b076];return _0xa3609;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf0aa('0x0'));var BPromise=require(_0xf0aa('0x1'));var rs=require(_0xf0aa('0x2'));var fs=require('fs');var Redis=require(_0xf0aa('0x3'));var db=require(_0xf0aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0aa('0x5'))(_0xf0aa('0x6'));var config=require('../../config/environment');var jayson=require(_0xf0aa('0x7'));var client=jayson['client'][_0xf0aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c2d11,_0xe4a744,_0x244745){return new BPromise(function(_0x38bf88,_0x579674){return client[_0xf0aa('0x9')](_0x4c2d11,_0x244745)[_0xf0aa('0xa')](function(_0x5b7efc){logger[_0xf0aa('0xb')](_0xf0aa('0xc'),_0xe4a744,_0xf0aa('0xd'));logger[_0xf0aa('0xe')](_0xf0aa('0xf'),_0xe4a744,_0xf0aa('0xd'),JSON[_0xf0aa('0x10')](_0x5b7efc));if(_0x5b7efc[_0xf0aa('0x11')]){if(_0x5b7efc[_0xf0aa('0x11')][_0xf0aa('0x12')]===0x1f4){logger[_0xf0aa('0x11')](_0xf0aa('0xc'),_0xe4a744,_0x5b7efc['error']['message']);return _0x579674(_0x5b7efc[_0xf0aa('0x11')][_0xf0aa('0x13')]);}logger['error']('Migration,\x20%s,\x20%s',_0xe4a744,_0x5b7efc[_0xf0aa('0x11')]['message']);return _0x38bf88(_0x5b7efc[_0xf0aa('0x11')]['message']);}else{logger[_0xf0aa('0xb')]('Migration,\x20%s,\x20%s',_0xe4a744,_0xf0aa('0xd'));_0x38bf88(_0x5b7efc[_0xf0aa('0x14')][_0xf0aa('0x13')]);}})[_0xf0aa('0x15')](function(_0x322ae0){logger[_0xf0aa('0x11')](_0xf0aa('0xc'),_0xe4a744,_0x322ae0);_0x579674(_0x322ae0);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8abf069..7ae4ed8 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 _0x78f4=['isAuthenticated','index','/:id','post','create','put','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x2ab324,_0x49fbac){var _0x427c10=function(_0x4674c2){while(--_0x4674c2){_0x2ab324['push'](_0x2ab324['shift']());}};_0x427c10(++_0x49fbac);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x478f('0x0'));var path=require(_0x478f('0x1'));var timeout=require(_0x478f('0x2'));var express=require(_0x478f('0x3'));var router=express['Router']();var fs_extra=require(_0x478f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x478f('0x5'));var config=require(_0x478f('0x6'));var controller=require(_0x478f('0x7'));router['get']('/',auth[_0x478f('0x8')](),controller[_0x478f('0x9')]);router['get'](_0x478f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x478f('0xb')]('/',auth['isAuthenticated'](),controller[_0x478f('0xc')]);router[_0x478f('0xd')](_0x478f('0xa'),auth[_0x478f('0x8')](),controller['update']);router['delete'](_0x478f('0xa'),auth[_0x478f('0x8')](),controller[_0x478f('0xe')]);module[_0x478f('0xf')]=router; \ No newline at end of file +var _0xf426=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xf426,0x168));var _0x6f42=function(_0x30b159,_0x3fbb50){_0x30b159=_0x30b159-0x0;var _0x23c3f9=_0xf426[_0x30b159];return _0x23c3f9;};'use strict';var multer=require(_0x6f42('0x0'));var util=require(_0x6f42('0x1'));var path=require('path');var timeout=require(_0x6f42('0x2'));var express=require(_0x6f42('0x3'));var router=express['Router']();var fs_extra=require(_0x6f42('0x4'));var auth=require(_0x6f42('0x5'));var interaction=require(_0x6f42('0x6'));var config=require(_0x6f42('0x7'));var controller=require(_0x6f42('0x8'));router[_0x6f42('0x9')]('/',auth[_0x6f42('0xa')](),controller[_0x6f42('0xb')]);router[_0x6f42('0x9')]('/:id',auth[_0x6f42('0xa')](),controller[_0x6f42('0xc')]);router['post']('/',auth[_0x6f42('0xa')](),controller[_0x6f42('0xd')]);router[_0x6f42('0xe')](_0x6f42('0xf'),auth['isAuthenticated'](),controller[_0x6f42('0x10')]);router[_0x6f42('0x11')](_0x6f42('0xf'),auth[_0x6f42('0xa')](),controller[_0x6f42('0x12')]);module[_0x6f42('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d44670c..502aeb4 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 _0xca65=['localnet','turn','STRING','sequelize','ENUM'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xca65,0xb7));var _0x5ca6=function(_0xa8919e,_0x5d70b1){_0xa8919e=_0xa8919e-0x0;var _0x4c3ed8=_0xca65[_0xa8919e];return _0x4c3ed8;};'use strict';var Sequelize=require(_0x5ca6('0x0'));module['exports']={'type':{'type':Sequelize[_0x5ca6('0x1')](_0x5ca6('0x2'),'externip','stun',_0x5ca6('0x3'))},'value':{'type':Sequelize[_0x5ca6('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5ca6('0x4')]}}; \ No newline at end of file +var _0x30f2=['stun','STRING','exports','ENUM','externip'];(function(_0x228da4,_0x27cca9){var _0x26f6dc=function(_0x44d747){while(--_0x44d747){_0x228da4['push'](_0x228da4['shift']());}};_0x26f6dc(++_0x27cca9);}(_0x30f2,0x11f));var _0x230f=function(_0x4ef101,_0x33be6c){_0x4ef101=_0x4ef101-0x0;var _0x4c61a9=_0x30f2[_0x4ef101];return _0x4c61a9;};'use strict';var Sequelize=require('sequelize');module[_0x230f('0x0')]={'type':{'type':Sequelize[_0x230f('0x1')]('localnet',_0x230f('0x2'),_0x230f('0x3'),'turn')},'value':{'type':Sequelize[_0x230f('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 9f7c318..37d8e18 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 _0x882b=['hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','filters','find','create','sequelize','transaction','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','update','STUN','server/files/templates/turn_multiple.ejs','toLowerCase','chan_sip.so','server/files/templates/network.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','stack','name','send','Network','rawAttributes','fieldName','type','key','map','keys','query','intersection','attributes','model','fields','length'];(function(_0x3c5c30,_0x573f45){var _0x415f2e=function(_0x290fac){while(--_0x290fac){_0x3c5c30['push'](_0x3c5c30['shift']());}};_0x415f2e(++_0x573f45);}(_0x882b,0x1e7));var _0xb882=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x882b[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0xb882('0x0'));var rimraf=require(_0xb882('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb882('0x2'));var rp=require(_0xb882('0x3'));var moment=require(_0xb882('0x4'));var BPromise=require(_0xb882('0x5'));var Mustache=require('mustache');var util=require(_0xb882('0x6'));var path=require(_0xb882('0x7'));var sox=require(_0xb882('0x8'));var csv=require(_0xb882('0x9'));var ejs=require(_0xb882('0xa'));var fs=require('fs');var fs_extra=require(_0xb882('0xb'));var _=require(_0xb882('0xc'));var squel=require(_0xb882('0xd'));var crypto=require(_0xb882('0xe'));var jsforce=require(_0xb882('0xf'));var deskjs=require(_0xb882('0x10'));var toCsv=require(_0xb882('0x9'));var querystring=require(_0xb882('0x11'));var Papa=require(_0xb882('0x12'));var Redis=require('ioredis');var authService=require(_0xb882('0x13'));var qs=require(_0xb882('0x14'));var as=require(_0xb882('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb882('0x16'))(_0xb882('0x17'));var utils=require('../../config/utils');var config=require(_0xb882('0x18'));var licenseUtil=require(_0xb882('0x19'));var db=require(_0xb882('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9f7967,_0x277114,_0x4e6fa0,_0x287c00){return new BPromise(function(_0x48c75b,_0x32e43f){var _0x48bff1=_0x287c00||client;return _0x48bff1[_0xb882('0x1b')](_0x9f7967,_0x4e6fa0)[_0xb882('0x1c')](function(_0x20cd8c){logger[_0xb882('0x1d')](_0xb882('0x1e'),_0x277114,_0xb882('0x1f'));logger[_0xb882('0x20')]('Network,\x20%s,\x20%s,\x20%s',_0x277114,_0xb882('0x1f'),JSON[_0xb882('0x21')](_0x20cd8c));if(_0x20cd8c[_0xb882('0x22')]){if(_0x20cd8c[_0xb882('0x22')][_0xb882('0x23')]===0x1f4){logger[_0xb882('0x22')](_0xb882('0x1e'),_0x277114,_0x20cd8c[_0xb882('0x22')][_0xb882('0x24')]);return _0x32e43f(_0x20cd8c[_0xb882('0x22')]['message']);}logger['error']('Network,\x20%s,\x20%s',_0x277114,_0x20cd8c[_0xb882('0x22')][_0xb882('0x24')]);return _0x48c75b(_0x20cd8c[_0xb882('0x22')][_0xb882('0x24')]);}else{logger[_0xb882('0x1d')](_0xb882('0x1e'),_0x277114,_0xb882('0x1f'));_0x48c75b(_0x20cd8c[_0xb882('0x25')][_0xb882('0x24')]);}})[_0xb882('0x26')](function(_0x5295c9){logger[_0xb882('0x22')](_0xb882('0x1e'),_0x277114,_0x5295c9);_0x32e43f(_0x5295c9);});});}function respondWithStatusCode(_0x2c2f39,_0x581369){_0x581369=_0x581369||0xcc;return function(_0xc0f157){if(_0xc0f157){return _0x2c2f39[_0xb882('0x27')](_0x581369);}return _0x2c2f39['status'](_0x581369)[_0xb882('0x28')]();};}function respondWithResult(_0x5283a3,_0x56537f){_0x56537f=_0x56537f||0xc8;return function(_0x16ff76){if(_0x16ff76){return _0x5283a3[_0xb882('0x29')](_0x56537f)[_0xb882('0x2a')](_0x16ff76);}};}function respondWithFilteredResult(_0x11fc37,_0x18659a){return function(_0x14c7a8){if(_0x14c7a8){var _0x3dbffa=typeof _0x18659a[_0xb882('0x2b')]===_0xb882('0x2c')&&typeof _0x18659a['limit']===_0xb882('0x2c');var _0x5492a6=_0x14c7a8['count'];var _0x32f1f4=_0x3dbffa?0x0:_0x18659a[_0xb882('0x2b')];var _0xbf0f3f=_0x3dbffa?_0x14c7a8[_0xb882('0x2d')]:_0x18659a['offset']+_0x18659a[_0xb882('0x2e')];var _0x1a8815;if(_0xbf0f3f>=_0x5492a6){_0xbf0f3f=_0x5492a6;_0x1a8815=0xc8;}else{_0x1a8815=0xce;}_0x11fc37[_0xb882('0x29')](_0x1a8815);return _0x11fc37[_0xb882('0x2f')](_0xb882('0x30'),_0x32f1f4+'-'+_0xbf0f3f+'/'+_0x5492a6)['json'](_0x14c7a8);}return null;};}function patchUpdates(_0x4632ec){return function(_0x590ecc){try{jsonpatch[_0xb882('0x31')](_0x590ecc,_0x4632ec,!![]);}catch(_0x469915){return BPromise['reject'](_0x469915);}return _0x590ecc[_0xb882('0x32')]();};}function saveUpdates(_0xc785bd,_0x483e5f){return function(_0x5316ae){if(_0x5316ae){return _0x5316ae['update'](_0xc785bd)[_0xb882('0x1c')](function(_0x328653){return _0x328653;});}return null;};}function removeEntity(_0x2b2671,_0x359871){return function(_0x2617a2){if(_0x2617a2){return _0x2617a2[_0xb882('0x33')]()['then'](function(){_0x2b2671[_0xb882('0x29')](0xcc)[_0xb882('0x28')]();});}};}function handleEntityNotFound(_0x208a4f,_0x3b2172){return function(_0x50073b){if(!_0x50073b){_0x208a4f[_0xb882('0x27')](0x194);}return _0x50073b;};}function handleError(_0x4c7cb0,_0x4b1c91){_0x4b1c91=_0x4b1c91||0x1f4;return function(_0x288ab7){logger[_0xb882('0x22')](_0x288ab7[_0xb882('0x34')]);if(_0x288ab7[_0xb882('0x35')]){delete _0x288ab7['name'];}_0x4c7cb0[_0xb882('0x29')](_0x4b1c91)[_0xb882('0x36')](_0x288ab7);};}exports['index']=function(_0x4cb868,_0x1fb97e){var _0x13bc4e={},_0x2b9eb6={},_0x1aa790={'count':0x0,'rows':[]};var _0x22ed31=_['map'](db[_0xb882('0x37')][_0xb882('0x38')],function(_0x50b2a8){return{'name':_0x50b2a8[_0xb882('0x39')],'type':_0x50b2a8[_0xb882('0x3a')][_0xb882('0x3b')]};});_0x2b9eb6['model']=_[_0xb882('0x3c')](_0x22ed31,_0xb882('0x35'));_0x2b9eb6['query']=_[_0xb882('0x3d')](_0x4cb868[_0xb882('0x3e')]);_0x2b9eb6['filters']=_[_0xb882('0x3f')](_0x2b9eb6['model'],_0x2b9eb6['query']);_0x13bc4e[_0xb882('0x40')]=_[_0xb882('0x3f')](_0x2b9eb6[_0xb882('0x41')],qs[_0xb882('0x42')](_0x4cb868[_0xb882('0x3e')][_0xb882('0x42')]));_0x13bc4e[_0xb882('0x40')]=_0x13bc4e[_0xb882('0x40')][_0xb882('0x43')]?_0x13bc4e[_0xb882('0x40')]:_0x2b9eb6[_0xb882('0x41')];if(!_0x4cb868['query'][_0xb882('0x44')](_0xb882('0x45'))){_0x13bc4e[_0xb882('0x2e')]=qs['limit'](_0x4cb868[_0xb882('0x3e')][_0xb882('0x2e')]);_0x13bc4e[_0xb882('0x2b')]=qs[_0xb882('0x2b')](_0x4cb868['query'][_0xb882('0x2b')]);}_0x13bc4e[_0xb882('0x46')]=qs[_0xb882('0x47')](_0x4cb868[_0xb882('0x3e')][_0xb882('0x47')]);_0x13bc4e[_0xb882('0x48')]=qs['filters'](_[_0xb882('0x49')](_0x4cb868['query'],_0x2b9eb6['filters']),_0x22ed31);if(_0x4cb868['query'][_0xb882('0x4a')]){_0x13bc4e['where']=_['merge'](_0x13bc4e[_0xb882('0x48')],{'$or':_['map'](_0x22ed31,function(_0x1f69b7){if(_0x1f69b7[_0xb882('0x3a')]!==_0xb882('0x4b')){var _0x24b8d4={};_0x24b8d4[_0x1f69b7[_0xb882('0x35')]]={'$like':'%'+_0x4cb868['query'][_0xb882('0x4a')]+'%'};return _0x24b8d4;}})});}_0x13bc4e=_[_0xb882('0x4c')]({},_0x13bc4e,_0x4cb868[_0xb882('0x4d')]);var _0x2e74f5={'where':_0x13bc4e[_0xb882('0x48')]};return db[_0xb882('0x37')][_0xb882('0x2d')](_0x2e74f5)['then'](function(_0x207dea){_0x1aa790[_0xb882('0x2d')]=_0x207dea;if(_0x4cb868[_0xb882('0x3e')][_0xb882('0x4e')]){_0x13bc4e[_0xb882('0x4f')]=[{'all':!![]}];}return db[_0xb882('0x37')][_0xb882('0x50')](_0x13bc4e);})['then'](function(_0x279678){_0x1aa790[_0xb882('0x51')]=_0x279678;return _0x1aa790;})[_0xb882('0x1c')](respondWithFilteredResult(_0x1fb97e,_0x13bc4e))['catch'](handleError(_0x1fb97e,null));};exports[_0xb882('0x52')]=function(_0x9fc058,_0x69bc71){var _0xca461={'raw':!![],'where':{'id':_0x9fc058[_0xb882('0x53')]['id']}},_0x11e890={};_0x11e890['model']=_[_0xb882('0x3d')](db['Network'][_0xb882('0x38')]);_0x11e890[_0xb882('0x3e')]=_[_0xb882('0x3d')](_0x9fc058[_0xb882('0x3e')]);_0x11e890[_0xb882('0x54')]=_[_0xb882('0x3f')](_0x11e890[_0xb882('0x41')],_0x11e890[_0xb882('0x3e')]);_0xca461['attributes']=_[_0xb882('0x3f')](_0x11e890[_0xb882('0x41')],qs[_0xb882('0x42')](_0x9fc058[_0xb882('0x3e')][_0xb882('0x42')]));_0xca461['attributes']=_0xca461[_0xb882('0x40')][_0xb882('0x43')]?_0xca461[_0xb882('0x40')]:_0x11e890[_0xb882('0x41')];if(_0x9fc058[_0xb882('0x3e')][_0xb882('0x4e')]){_0xca461[_0xb882('0x4f')]=[{'all':!![]}];}_0xca461=_[_0xb882('0x4c')]({},_0xca461,_0x9fc058[_0xb882('0x4d')]);return db[_0xb882('0x37')][_0xb882('0x55')](_0xca461)[_0xb882('0x1c')](handleEntityNotFound(_0x69bc71,null))[_0xb882('0x1c')](respondWithResult(_0x69bc71,null))['catch'](handleError(_0x69bc71,null));};exports[_0xb882('0x56')]=function(_0x599e49,_0x2e3a91,_0x4f8acc){var _0x307ca7;return db[_0xb882('0x57')][_0xb882('0x58')](function(_0x352948){return db[_0xb882('0x37')][_0xb882('0x56')](_0x599e49['body'],{'raw':!![]})['then'](function(_0x4b199a){_0x307ca7=_0x4b199a;return db[_0xb882('0x37')][_0xb882('0x50')]({'where':{'type':_0x599e49[_0xb882('0x59')]['type']},'raw':!![]});})[_0xb882('0x1c')](function(_0x53535e){if(_0x307ca7[_0xb882('0x3a')][_0xb882('0x5a')]()=='STUN'){var _0x308098=fs[_0xb882('0x5b')](path[_0xb882('0x5c')](config[_0xb882('0x5d')],_0xb882('0x5e')),_0xb882('0x5f'));var _0x120266=ejs[_0xb882('0x60')](_0x308098,{'networks':_0x53535e||[]});fs[_0xb882('0x61')](_0xb882('0x62'),_0x120266);return respondWithRpcPromise(_0xb882('0x63'),_0xb882('0x56'),{'module':_0xb882('0x64')});}else if(_0x307ca7[_0xb882('0x3a')][_0xb882('0x5a')]()==_0xb882('0x65')){var _0x272be4=fs['readFileSync'](path[_0xb882('0x5c')](config[_0xb882('0x5d')],'server/files/templates/turn_multiple.ejs'),_0xb882('0x5f'));var _0x5db361=ejs[_0xb882('0x60')](_0x272be4,{'networks':_0x53535e||[]});fs[_0xb882('0x61')](_0xb882('0x66'),_0x5db361);return respondWithRpcPromise('Reload','create',{'module':_0xb882('0x64')});}else{var _0x1d7c77=fs[_0xb882('0x5b')](path[_0xb882('0x5c')](config[_0xb882('0x5d')],'server/files/templates/network.ejs'),'utf8');var _0x50edce=ejs[_0xb882('0x60')](_0x1d7c77,{'networks':_0x53535e||[]});fs['writeFileSync'](util[_0xb882('0x67')](_0xb882('0x68'),_0x599e49['body']['type']['toLowerCase']()),_0x50edce);return respondWithRpcPromise('Reload',_0xb882('0x56'),{'module':'chan_sip.so'});}return null;})[_0xb882('0x1c')](function(){return _0x307ca7;});})['then'](respondWithResult(_0x2e3a91,0xc9))[_0xb882('0x26')](handleError(_0x2e3a91,null));};exports[_0xb882('0x69')]=function(_0x2cf9a7,_0x476ef6,_0x59180d){var _0x55d642;return db['sequelize'][_0xb882('0x58')](function(_0x4623d1){return db[_0xb882('0x37')][_0xb882('0x55')]({'where':{'id':_0x2cf9a7[_0xb882('0x53')]['id']}})[_0xb882('0x1c')](handleEntityNotFound(_0x476ef6,null))[_0xb882('0x1c')](saveUpdates(_0x2cf9a7[_0xb882('0x59')],null))[_0xb882('0x1c')](function(_0x31a479){if(_0x31a479){_0x55d642=_0x31a479;return db['Network'][_0xb882('0x50')]({'where':{'type':_0x55d642[_0xb882('0x3a')]},'raw':!![]});}return null;})[_0xb882('0x1c')](function(_0x505ec7){if(_0x55d642[_0xb882('0x3a')][_0xb882('0x5a')]()==_0xb882('0x6a')){var _0x348fc1=fs['readFileSync'](path[_0xb882('0x5c')](config[_0xb882('0x5d')],_0xb882('0x5e')),_0xb882('0x5f'));var _0x11d259=ejs[_0xb882('0x60')](_0x348fc1,{'networks':_0x505ec7||[]});fs[_0xb882('0x61')](_0xb882('0x62'),_0x11d259);return respondWithRpcPromise(_0xb882('0x63'),'update',{'module':_0xb882('0x64')});}else if(_0x55d642[_0xb882('0x3a')][_0xb882('0x5a')]()==_0xb882('0x65')){var _0x8b3b4a=fs[_0xb882('0x5b')](path[_0xb882('0x5c')](config[_0xb882('0x5d')],_0xb882('0x6b')),_0xb882('0x5f'));var _0x48dcf4=ejs[_0xb882('0x60')](_0x8b3b4a,{'networks':_0x505ec7||[]});fs[_0xb882('0x61')](_0xb882('0x66'),_0x48dcf4);return respondWithRpcPromise('Reload',_0xb882('0x69'),{'module':'res_stun_monitor.so'});}else{var _0x18ca77=fs[_0xb882('0x5b')](path[_0xb882('0x5c')](config[_0xb882('0x5d')],'server/files/templates/network.ejs'),_0xb882('0x5f'));var _0x1e6722=ejs[_0xb882('0x60')](_0x18ca77,{'networks':_0x505ec7||[]});fs[_0xb882('0x61')](util[_0xb882('0x67')](_0xb882('0x68'),_0x2cf9a7[_0xb882('0x59')]['type'][_0xb882('0x6c')]()),_0x1e6722);return respondWithRpcPromise(_0xb882('0x63'),_0xb882('0x69'),{'module':_0xb882('0x6d')});}return null;})[_0xb882('0x1c')](function(_0x3d0fc0){if(_0x3d0fc0){return _0x55d642;}return null;});})[_0xb882('0x1c')](respondWithResult(_0x476ef6,null))[_0xb882('0x26')](handleError(_0x476ef6,null));};exports[_0xb882('0x33')]=function(_0xb59ae2,_0x566bfd,_0x4cb2c7){var _0x196a04;return db[_0xb882('0x37')]['find']({'where':{'id':_0xb59ae2[_0xb882('0x53')]['id']}})[_0xb882('0x1c')](function(_0x537a1b){_0x196a04=_0x537a1b;return _0x537a1b;})['then'](handleEntityNotFound(_0x566bfd,null))[_0xb882('0x1c')](removeEntity(_0x566bfd,null))['then'](function(){if(_0x196a04){return db[_0xb882('0x37')][_0xb882('0x50')]({'where':{'type':_0x196a04[_0xb882('0x3a')]},'raw':!![]});}})['then'](function(_0x193477){if(_0x196a04[_0xb882('0x3a')][_0xb882('0x5a')]()==_0xb882('0x6a')){var _0x30fcdf=fs[_0xb882('0x5b')](path[_0xb882('0x5c')](config[_0xb882('0x5d')],_0xb882('0x5e')),_0xb882('0x5f'));var _0xbbc12a=ejs[_0xb882('0x60')](_0x30fcdf,{'networks':_0x193477||[]});fs['writeFileSync'](_0xb882('0x62'),_0xbbc12a);return respondWithRpcPromise(_0xb882('0x63'),_0xb882('0x33'),{'module':'res_stun_monitor.so'});}else if(_0x196a04[_0xb882('0x3a')][_0xb882('0x5a')]()==_0xb882('0x65')){var _0x45490f=fs[_0xb882('0x5b')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0xb882('0x5f'));var _0x2e229f=ejs['render'](_0x45490f,{'networks':_0x193477||[]});fs[_0xb882('0x61')]('/etc/asterisk/turn_xcally.conf',_0x2e229f);return respondWithRpcPromise('Reload',_0xb882('0x33'),{'module':_0xb882('0x64')});}else{var _0x27ae27=fs[_0xb882('0x5b')](path[_0xb882('0x5c')](config[_0xb882('0x5d')],_0xb882('0x6e')),_0xb882('0x5f'));var _0x2eade8=ejs[_0xb882('0x60')](_0x27ae27,{'networks':_0x193477||[]});fs['writeFileSync'](util[_0xb882('0x67')](_0xb882('0x68'),_0xb59ae2['body'][_0xb882('0x3a')][_0xb882('0x6c')]()),_0x2eade8);return respondWithRpcPromise(_0xb882('0x63'),_0xb882('0x33'),{'module':_0xb882('0x6d')});}return null;})[_0xb882('0x26')](handleError(_0x566bfd,null));}; \ No newline at end of file +var _0x427f=['../../config/license/util','../../mysqldb','jayson/promise','client','request','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','index','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','Network','rows','show','params','rawAttributes','include','find','create','sequelize','transaction','body','STUN','readFileSync','writeFileSync','toUpperCase','join','server/files/templates/turn_multiple.ejs','utf8','render','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','root','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','findAll','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/stun_multiple.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2b2279,_0x5bbec2){var _0x2a8251=function(_0x23ce30){while(--_0x23ce30){_0x2b2279['push'](_0x2b2279['shift']());}};_0x2a8251(++_0x5bbec2);}(_0x427f,0xc4));var _0xf427=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x427f[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xf427('0x0'));var rimraf=require(_0xf427('0x1'));var zipdir=require(_0xf427('0x2'));var jsonpatch=require(_0xf427('0x3'));var rp=require(_0xf427('0x4'));var moment=require(_0xf427('0x5'));var BPromise=require(_0xf427('0x6'));var Mustache=require(_0xf427('0x7'));var util=require('util');var path=require(_0xf427('0x8'));var sox=require(_0xf427('0x9'));var csv=require(_0xf427('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf427('0xb'));var squel=require(_0xf427('0xc'));var crypto=require(_0xf427('0xd'));var jsforce=require(_0xf427('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf427('0xf'));var Papa=require(_0xf427('0x10'));var Redis=require(_0xf427('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf427('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf427('0x13'));var logger=require(_0xf427('0x14'))(_0xf427('0x15'));var utils=require(_0xf427('0x16'));var config=require(_0xf427('0x17'));var licenseUtil=require(_0xf427('0x18'));var db=require(_0xf427('0x19'))['db'];var jayson=require(_0xf427('0x1a'));var client=jayson[_0xf427('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46657e,_0x4ea2e1,_0x1ba0f1,_0x30cbf0){return new BPromise(function(_0x6963e2,_0xc98ddf){var _0x5719fc=_0x30cbf0||client;return _0x5719fc[_0xf427('0x1c')](_0x46657e,_0x1ba0f1)[_0xf427('0x1d')](function(_0x2f0c5b){logger['info']('Network,\x20%s,\x20%s',_0x4ea2e1,_0xf427('0x1e'));logger['debug'](_0xf427('0x1f'),_0x4ea2e1,_0xf427('0x1e'),JSON[_0xf427('0x20')](_0x2f0c5b));if(_0x2f0c5b[_0xf427('0x21')]){if(_0x2f0c5b[_0xf427('0x21')]['code']===0x1f4){logger['error'](_0xf427('0x22'),_0x4ea2e1,_0x2f0c5b[_0xf427('0x21')][_0xf427('0x23')]);return _0xc98ddf(_0x2f0c5b[_0xf427('0x21')][_0xf427('0x23')]);}logger['error'](_0xf427('0x22'),_0x4ea2e1,_0x2f0c5b['error'][_0xf427('0x23')]);return _0x6963e2(_0x2f0c5b[_0xf427('0x21')]['message']);}else{logger[_0xf427('0x24')](_0xf427('0x22'),_0x4ea2e1,_0xf427('0x1e'));_0x6963e2(_0x2f0c5b[_0xf427('0x25')]['message']);}})[_0xf427('0x26')](function(_0x1bb886){logger[_0xf427('0x21')](_0xf427('0x22'),_0x4ea2e1,_0x1bb886);_0xc98ddf(_0x1bb886);});});}function respondWithStatusCode(_0x4033ec,_0x4603e1){_0x4603e1=_0x4603e1||0xcc;return function(_0x2928f1){if(_0x2928f1){return _0x4033ec[_0xf427('0x27')](_0x4603e1);}return _0x4033ec['status'](_0x4603e1)[_0xf427('0x28')]();};}function respondWithResult(_0x2eb746,_0x305325){_0x305325=_0x305325||0xc8;return function(_0x12ee6d){if(_0x12ee6d){return _0x2eb746[_0xf427('0x29')](_0x305325)[_0xf427('0x2a')](_0x12ee6d);}};}function respondWithFilteredResult(_0xa7c44f,_0x75df5a){return function(_0x17975e){if(_0x17975e){var _0x1bc62d=typeof _0x75df5a[_0xf427('0x2b')]===_0xf427('0x2c')&&typeof _0x75df5a[_0xf427('0x2d')]===_0xf427('0x2c');var _0x1edfb4=_0x17975e[_0xf427('0x2e')];var _0x28c012=_0x1bc62d?0x0:_0x75df5a['offset'];var _0x3eabde=_0x1bc62d?_0x17975e[_0xf427('0x2e')]:_0x75df5a[_0xf427('0x2b')]+_0x75df5a['limit'];var _0x9df334;if(_0x3eabde>=_0x1edfb4){_0x3eabde=_0x1edfb4;_0x9df334=0xc8;}else{_0x9df334=0xce;}_0xa7c44f[_0xf427('0x29')](_0x9df334);return _0xa7c44f[_0xf427('0x2f')](_0xf427('0x30'),_0x28c012+'-'+_0x3eabde+'/'+_0x1edfb4)[_0xf427('0x2a')](_0x17975e);}return null;};}function patchUpdates(_0x48de70){return function(_0x339331){try{jsonpatch[_0xf427('0x31')](_0x339331,_0x48de70,!![]);}catch(_0x51a0f4){return BPromise[_0xf427('0x32')](_0x51a0f4);}return _0x339331['save']();};}function saveUpdates(_0x1187ec,_0x35b344){return function(_0x2c2345){if(_0x2c2345){return _0x2c2345[_0xf427('0x33')](_0x1187ec)[_0xf427('0x1d')](function(_0x2ceded){return _0x2ceded;});}return null;};}function removeEntity(_0x23327e,_0x5f458a){return function(_0x59a89d){if(_0x59a89d){return _0x59a89d[_0xf427('0x34')]()['then'](function(){_0x23327e[_0xf427('0x29')](0xcc)[_0xf427('0x28')]();});}};}function handleEntityNotFound(_0x174071,_0x14571a){return function(_0x196976){if(!_0x196976){_0x174071[_0xf427('0x27')](0x194);}return _0x196976;};}function handleError(_0x1d44de,_0x2b1cef){_0x2b1cef=_0x2b1cef||0x1f4;return function(_0x3f733a){logger['error'](_0x3f733a[_0xf427('0x35')]);if(_0x3f733a[_0xf427('0x36')]){delete _0x3f733a['name'];}_0x1d44de[_0xf427('0x29')](_0x2b1cef)['send'](_0x3f733a);};}exports[_0xf427('0x37')]=function(_0x39159e,_0x26f029){var _0x293c96={},_0x356085={},_0x32cf36={'count':0x0,'rows':[]};var _0x1f26fc=_['map'](db['Network']['rawAttributes'],function(_0x61588f){return{'name':_0x61588f['fieldName'],'type':_0x61588f[_0xf427('0x38')][_0xf427('0x39')]};});_0x356085[_0xf427('0x3a')]=_[_0xf427('0x3b')](_0x1f26fc,_0xf427('0x36'));_0x356085['query']=_[_0xf427('0x3c')](_0x39159e[_0xf427('0x3d')]);_0x356085[_0xf427('0x3e')]=_[_0xf427('0x3f')](_0x356085['model'],_0x356085[_0xf427('0x3d')]);_0x293c96[_0xf427('0x40')]=_['intersection'](_0x356085['model'],qs[_0xf427('0x41')](_0x39159e[_0xf427('0x3d')][_0xf427('0x41')]));_0x293c96['attributes']=_0x293c96[_0xf427('0x40')][_0xf427('0x42')]?_0x293c96['attributes']:_0x356085['model'];if(!_0x39159e['query'][_0xf427('0x43')](_0xf427('0x44'))){_0x293c96[_0xf427('0x2d')]=qs[_0xf427('0x2d')](_0x39159e[_0xf427('0x3d')]['limit']);_0x293c96[_0xf427('0x2b')]=qs[_0xf427('0x2b')](_0x39159e[_0xf427('0x3d')][_0xf427('0x2b')]);}_0x293c96[_0xf427('0x45')]=qs[_0xf427('0x46')](_0x39159e[_0xf427('0x3d')][_0xf427('0x46')]);_0x293c96[_0xf427('0x47')]=qs['filters'](_[_0xf427('0x48')](_0x39159e[_0xf427('0x3d')],_0x356085[_0xf427('0x3e')]),_0x1f26fc);if(_0x39159e[_0xf427('0x3d')][_0xf427('0x49')]){_0x293c96[_0xf427('0x47')]=_[_0xf427('0x4a')](_0x293c96[_0xf427('0x47')],{'$or':_[_0xf427('0x3b')](_0x1f26fc,function(_0x3e95af){if(_0x3e95af[_0xf427('0x38')]!==_0xf427('0x4b')){var _0xe150da={};_0xe150da[_0x3e95af[_0xf427('0x36')]]={'$like':'%'+_0x39159e['query'][_0xf427('0x49')]+'%'};return _0xe150da;}})});}_0x293c96=_[_0xf427('0x4a')]({},_0x293c96,_0x39159e[_0xf427('0x4c')]);var _0x5d0f4a={'where':_0x293c96['where']};return db['Network']['count'](_0x5d0f4a)[_0xf427('0x1d')](function(_0x30de54){_0x32cf36[_0xf427('0x2e')]=_0x30de54;if(_0x39159e['query'][_0xf427('0x4d')]){_0x293c96['include']=[{'all':!![]}];}return db[_0xf427('0x4e')]['findAll'](_0x293c96);})[_0xf427('0x1d')](function(_0xd48b37){_0x32cf36[_0xf427('0x4f')]=_0xd48b37;return _0x32cf36;})[_0xf427('0x1d')](respondWithFilteredResult(_0x26f029,_0x293c96))[_0xf427('0x26')](handleError(_0x26f029,null));};exports[_0xf427('0x50')]=function(_0x3a75b3,_0x5c2cce){var _0x2ca267={'raw':!![],'where':{'id':_0x3a75b3[_0xf427('0x51')]['id']}},_0x197856={};_0x197856[_0xf427('0x3a')]=_[_0xf427('0x3c')](db[_0xf427('0x4e')][_0xf427('0x52')]);_0x197856[_0xf427('0x3d')]=_[_0xf427('0x3c')](_0x3a75b3['query']);_0x197856[_0xf427('0x3e')]=_['intersection'](_0x197856[_0xf427('0x3a')],_0x197856[_0xf427('0x3d')]);_0x2ca267['attributes']=_['intersection'](_0x197856[_0xf427('0x3a')],qs[_0xf427('0x41')](_0x3a75b3[_0xf427('0x3d')]['fields']));_0x2ca267[_0xf427('0x40')]=_0x2ca267[_0xf427('0x40')][_0xf427('0x42')]?_0x2ca267[_0xf427('0x40')]:_0x197856[_0xf427('0x3a')];if(_0x3a75b3[_0xf427('0x3d')][_0xf427('0x4d')]){_0x2ca267[_0xf427('0x53')]=[{'all':!![]}];}_0x2ca267=_[_0xf427('0x4a')]({},_0x2ca267,_0x3a75b3[_0xf427('0x4c')]);return db[_0xf427('0x4e')][_0xf427('0x54')](_0x2ca267)[_0xf427('0x1d')](handleEntityNotFound(_0x5c2cce,null))['then'](respondWithResult(_0x5c2cce,null))['catch'](handleError(_0x5c2cce,null));};exports[_0xf427('0x55')]=function(_0x4e26bf,_0x2d9cfb,_0x4a2835){var _0x2af7fa;return db[_0xf427('0x56')][_0xf427('0x57')](function(_0x558c96){return db[_0xf427('0x4e')]['create'](_0x4e26bf[_0xf427('0x58')],{'raw':!![]})[_0xf427('0x1d')](function(_0x49b9ec){_0x2af7fa=_0x49b9ec;return db['Network']['findAll']({'where':{'type':_0x4e26bf[_0xf427('0x58')][_0xf427('0x38')]},'raw':!![]});})[_0xf427('0x1d')](function(_0x359a7f){if(_0x2af7fa[_0xf427('0x38')]['toUpperCase']()==_0xf427('0x59')){var _0x91da05=fs[_0xf427('0x5a')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x28fc7b=ejs['render'](_0x91da05,{'networks':_0x359a7f||[]});fs[_0xf427('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x28fc7b);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0x2af7fa[_0xf427('0x38')][_0xf427('0x5c')]()=='TURN'){var _0x38a19e=fs[_0xf427('0x5a')](path[_0xf427('0x5d')](config['root'],_0xf427('0x5e')),_0xf427('0x5f'));var _0x3b0b5b=ejs[_0xf427('0x60')](_0x38a19e,{'networks':_0x359a7f||[]});fs[_0xf427('0x5b')](_0xf427('0x61'),_0x3b0b5b);return respondWithRpcPromise(_0xf427('0x62'),_0xf427('0x55'),{'module':_0xf427('0x63')});}else{var _0x25caa9=fs['readFileSync'](path[_0xf427('0x5d')](config[_0xf427('0x64')],_0xf427('0x65')),'utf8');var _0x1e405b=ejs[_0xf427('0x60')](_0x25caa9,{'networks':_0x359a7f||[]});fs[_0xf427('0x5b')](util[_0xf427('0x66')](_0xf427('0x67'),_0x4e26bf[_0xf427('0x58')]['type'][_0xf427('0x68')]()),_0x1e405b);return respondWithRpcPromise(_0xf427('0x62'),'create',{'module':_0xf427('0x69')});}return null;})[_0xf427('0x1d')](function(){return _0x2af7fa;});})[_0xf427('0x1d')](respondWithResult(_0x2d9cfb,0xc9))['catch'](handleError(_0x2d9cfb,null));};exports[_0xf427('0x33')]=function(_0x435812,_0x331a3e,_0x3c1b4f){var _0x3973aa;return db[_0xf427('0x56')][_0xf427('0x57')](function(_0x529a29){return db[_0xf427('0x4e')]['find']({'where':{'id':_0x435812[_0xf427('0x51')]['id']}})['then'](handleEntityNotFound(_0x331a3e,null))[_0xf427('0x1d')](saveUpdates(_0x435812[_0xf427('0x58')],null))[_0xf427('0x1d')](function(_0x36dae8){if(_0x36dae8){_0x3973aa=_0x36dae8;return db['Network'][_0xf427('0x6a')]({'where':{'type':_0x3973aa[_0xf427('0x38')]},'raw':!![]});}return null;})[_0xf427('0x1d')](function(_0x7ba714){if(_0x3973aa[_0xf427('0x38')]['toUpperCase']()==_0xf427('0x59')){var _0x84e8c6=fs[_0xf427('0x5a')](path[_0xf427('0x5d')](config[_0xf427('0x64')],'server/files/templates/stun_multiple.ejs'),_0xf427('0x5f'));var _0xfe42eb=ejs[_0xf427('0x60')](_0x84e8c6,{'networks':_0x7ba714||[]});fs[_0xf427('0x5b')](_0xf427('0x6b'),_0xfe42eb);return respondWithRpcPromise('Reload',_0xf427('0x33'),{'module':_0xf427('0x63')});}else if(_0x3973aa[_0xf427('0x38')][_0xf427('0x5c')]()==_0xf427('0x6c')){var _0x542159=fs['readFileSync'](path[_0xf427('0x5d')](config['root'],_0xf427('0x5e')),_0xf427('0x5f'));var _0x2ab309=ejs['render'](_0x542159,{'networks':_0x7ba714||[]});fs[_0xf427('0x5b')](_0xf427('0x61'),_0x2ab309);return respondWithRpcPromise(_0xf427('0x62'),'update',{'module':_0xf427('0x63')});}else{var _0x49d623=fs[_0xf427('0x5a')](path[_0xf427('0x5d')](config['root'],_0xf427('0x65')),_0xf427('0x5f'));var _0x173e9f=ejs[_0xf427('0x60')](_0x49d623,{'networks':_0x7ba714||[]});fs['writeFileSync'](util[_0xf427('0x66')](_0xf427('0x67'),_0x435812[_0xf427('0x58')]['type'][_0xf427('0x68')]()),_0x173e9f);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0xf427('0x1d')](function(_0x42fa9c){if(_0x42fa9c){return _0x3973aa;}return null;});})[_0xf427('0x1d')](respondWithResult(_0x331a3e,null))[_0xf427('0x26')](handleError(_0x331a3e,null));};exports[_0xf427('0x34')]=function(_0xff25bc,_0x4e8f2b,_0x4ed2a9){var _0xd1559a;return db[_0xf427('0x4e')][_0xf427('0x54')]({'where':{'id':_0xff25bc[_0xf427('0x51')]['id']}})[_0xf427('0x1d')](function(_0x4d3dff){_0xd1559a=_0x4d3dff;return _0x4d3dff;})['then'](handleEntityNotFound(_0x4e8f2b,null))[_0xf427('0x1d')](removeEntity(_0x4e8f2b,null))[_0xf427('0x1d')](function(){if(_0xd1559a){return db[_0xf427('0x4e')][_0xf427('0x6a')]({'where':{'type':_0xd1559a[_0xf427('0x38')]},'raw':!![]});}})[_0xf427('0x1d')](function(_0x54645c){if(_0xd1559a[_0xf427('0x38')]['toUpperCase']()==_0xf427('0x59')){var _0x3c1157=fs[_0xf427('0x5a')](path[_0xf427('0x5d')](config[_0xf427('0x64')],_0xf427('0x6d')),_0xf427('0x5f'));var _0x290997=ejs[_0xf427('0x60')](_0x3c1157,{'networks':_0x54645c||[]});fs[_0xf427('0x5b')](_0xf427('0x6b'),_0x290997);return respondWithRpcPromise(_0xf427('0x62'),_0xf427('0x34'),{'module':_0xf427('0x63')});}else if(_0xd1559a['type'][_0xf427('0x5c')]()==_0xf427('0x6c')){var _0x1f32cc=fs[_0xf427('0x5a')](path['join'](config[_0xf427('0x64')],_0xf427('0x5e')),'utf8');var _0x1fad94=ejs[_0xf427('0x60')](_0x1f32cc,{'networks':_0x54645c||[]});fs[_0xf427('0x5b')]('/etc/asterisk/turn_xcally.conf',_0x1fad94);return respondWithRpcPromise('Reload',_0xf427('0x34'),{'module':_0xf427('0x63')});}else{var _0x50bd6a=fs[_0xf427('0x5a')](path['join'](config[_0xf427('0x64')],_0xf427('0x65')),_0xf427('0x5f'));var _0x38a4cb=ejs[_0xf427('0x60')](_0x50bd6a,{'networks':_0x54645c||[]});fs['writeFileSync'](util['format'](_0xf427('0x67'),_0xff25bc[_0xf427('0x58')][_0xf427('0x38')]['toLowerCase']()),_0x38a4cb);return respondWithRpcPromise(_0xf427('0x62'),_0xf427('0x34'),{'module':'chan_sip.so'});}return null;})[_0xf427('0x26')](handleError(_0x4e8f2b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index bbcb0f2..1bf97c7 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 _0xad95=['../../config/environment','define','Network','network','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x33b1ff,_0x119f1e){var _0x4a1e05=function(_0x532964){while(--_0x532964){_0x33b1ff['push'](_0x33b1ff['shift']());}};_0x4a1e05(++_0x119f1e);}(_0xad95,0x70));var _0x5ad9=function(_0x46fd9a,_0x551e5e){_0x46fd9a=_0x46fd9a-0x0;var _0x5da271=_0xad95[_0x46fd9a];return _0x5da271;};'use strict';var _=require(_0x5ad9('0x0'));var util=require(_0x5ad9('0x1'));var logger=require(_0x5ad9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5ad9('0x3'));var rp=require(_0x5ad9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ad9('0x5'));var attributes=require('./network.attributes');module['exports']=function(_0x5e4279,_0x5b81f9){return _0x5e4279[_0x5ad9('0x6')](_0x5ad9('0x7'),attributes,{'tableName':_0x5ad9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe644=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x108b16,_0x40d753){var _0x4958e6=function(_0x11bb08){while(--_0x11bb08){_0x108b16['push'](_0x108b16['shift']());}};_0x4958e6(++_0x40d753);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x13fa90,_0x55c23b){return _0x13fa90[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 5541a84..2efe06c 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(_0x3f3e89,_0x1d06cf){_0x3f3e89=_0x3f3e89-0x0;var _0x4fb196=_0x7a54[_0x3f3e89];return _0x4fb196;};'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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3c0a28,_0xb0de5b){var _0x5aab47=function(_0x41783f){while(--_0x41783f){_0x3c0a28['push'](_0x3c0a28['shift']());}};_0x5aab47(++_0xb0de5b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c1c5b16..f9dfa7c 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 _0xe6fd=['../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','send','put','delete','destroy','removeAnswers','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x2ff803,_0xf4f514){var _0x3b980a=function(_0x2b21ca){while(--_0x2b21ca){_0x2ff803['push'](_0x2ff803['shift']());}};_0x3b980a(++_0xf4f514);}(_0xe6fd,0x1ca));var _0xde6f=function(_0x3bf13f,_0x4bba94){_0x3bf13f=_0x3bf13f-0x0;var _0x41935f=_0xe6fd[_0x3bf13f];return _0x41935f;};'use strict';var multer=require('multer');var util=require(_0xde6f('0x0'));var path=require('path');var timeout=require(_0xde6f('0x1'));var express=require('express');var router=express[_0xde6f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xde6f('0x3'));var interaction=require(_0xde6f('0x4'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xde6f('0x5')](),controller[_0xde6f('0x6')]);router[_0xde6f('0x7')](_0xde6f('0x8'),auth[_0xde6f('0x5')](),controller['describe']);router[_0xde6f('0x7')](_0xde6f('0x9'),auth[_0xde6f('0x5')](),controller[_0xde6f('0xa')]);router[_0xde6f('0x7')](_0xde6f('0xb'),auth[_0xde6f('0x5')](),controller[_0xde6f('0xc')]);router[_0xde6f('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xde6f('0xd')]);router['get'](_0xde6f('0xe'),auth['isAuthenticated'](),controller[_0xde6f('0xf')]);router[_0xde6f('0x7')](_0xde6f('0x10'),auth['isAuthenticated'](),controller[_0xde6f('0x11')]);router[_0xde6f('0x7')](_0xde6f('0x12'),auth[_0xde6f('0x5')](),controller[_0xde6f('0x13')]);router['post']('/',auth[_0xde6f('0x5')](),controller[_0xde6f('0x14')]);router[_0xde6f('0x15')](_0xde6f('0xb'),auth[_0xde6f('0x5')](),controller[_0xde6f('0x16')]);router[_0xde6f('0x15')](_0xde6f('0x17'),auth[_0xde6f('0x5')](),controller[_0xde6f('0x18')]);router[_0xde6f('0x15')](_0xde6f('0x19'),controller['notify']);router['post']('/:id/applications',auth[_0xde6f('0x5')](),controller['addApplications']);router['post']('/:id/users',auth[_0xde6f('0x5')](),controller['addAgents']);router[_0xde6f('0x15')]('/:id/send',auth['isAuthenticated'](),controller[_0xde6f('0x1a')]);router[_0xde6f('0x1b')](_0xde6f('0x9'),auth[_0xde6f('0x5')](),controller['update']);router[_0xde6f('0x1c')](_0xde6f('0x9'),auth[_0xde6f('0x5')](),controller[_0xde6f('0x1d')]);router[_0xde6f('0x1c')]('/:id/dispositions',auth[_0xde6f('0x5')](),controller['removeDispositions']);router[_0xde6f('0x1c')](_0xde6f('0x17'),auth[_0xde6f('0x5')](),controller[_0xde6f('0x1e')]);router[_0xde6f('0x1c')](_0xde6f('0x12'),auth[_0xde6f('0x5')](),controller[_0xde6f('0x1f')]);module[_0xde6f('0x20')]=router; \ No newline at end of file +var _0xe1a1=['getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','notify','addApplications','/:id/users','addAgents','send','/:id','update','delete','removeAgents','exports','multer','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','get','index','isAuthenticated'];(function(_0x5f1f29,_0x43efe9){var _0x325b70=function(_0x36105a){while(--_0x36105a){_0x5f1f29['push'](_0x5f1f29['shift']());}};_0x325b70(++_0x43efe9);}(_0xe1a1,0x1b7));var _0x1e1a=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xe1a1[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0x1e1a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e1a('0x1'));var router=express[_0x1e1a('0x2')]();var fs_extra=require(_0x1e1a('0x3'));var auth=require(_0x1e1a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e1a('0x5'));router[_0x1e1a('0x6')]('/',auth['isAuthenticated'](),controller[_0x1e1a('0x7')]);router[_0x1e1a('0x6')]('/describe',auth[_0x1e1a('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1e1a('0x6')]('/:id/dispositions',auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x9')]);router[_0x1e1a('0x6')](_0x1e1a('0xa'),auth['isAuthenticated'](),controller[_0x1e1a('0xb')]);router['get'](_0x1e1a('0xc'),auth[_0x1e1a('0x8')](),controller[_0x1e1a('0xd')]);router['get'](_0x1e1a('0xe'),auth['isAuthenticated'](),controller[_0x1e1a('0xf')]);router[_0x1e1a('0x6')]('/:id/users',auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x10')]);router[_0x1e1a('0x11')]('/',auth['isAuthenticated'](),controller[_0x1e1a('0x12')]);router['post'](_0x1e1a('0x13'),auth['isAuthenticated'](),controller[_0x1e1a('0x14')]);router[_0x1e1a('0x11')](_0x1e1a('0xa'),auth['isAuthenticated'](),controller[_0x1e1a('0x15')]);router[_0x1e1a('0x11')]('/:id/notify',controller[_0x1e1a('0x16')]);router[_0x1e1a('0x11')](_0x1e1a('0xc'),auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x17')]);router[_0x1e1a('0x11')](_0x1e1a('0x18'),auth['isAuthenticated'](),controller[_0x1e1a('0x19')]);router[_0x1e1a('0x11')]('/:id/send',auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x1a')]);router['put'](_0x1e1a('0x1b'),auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x1c')]);router['delete'](_0x1e1a('0x1b'),auth[_0x1e1a('0x8')](),controller['destroy']);router[_0x1e1a('0x1d')](_0x1e1a('0x13'),auth[_0x1e1a('0x8')](),controller['removeDispositions']);router[_0x1e1a('0x1d')](_0x1e1a('0xa'),auth[_0x1e1a('0x8')](),controller['removeAnswers']);router[_0x1e1a('0x1d')](_0x1e1a('0x18'),auth[_0x1e1a('0x8')](),controller[_0x1e1a('0x1e')]);module[_0x1e1a('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a2128b8..2d17c50 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 _0xa517=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x4a9cb6,_0x669eef){var _0x23350f=function(_0x512b90){while(--_0x512b90){_0x4a9cb6['push'](_0x4a9cb6['shift']());}};_0x23350f(++_0x669eef);}(_0xa517,0x1cb));var _0x7a51=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0xa517[_0xabbd2f];return _0x34a040;};'use strict';var Sequelize=require(_0x7a51('0x0'));var rs=require('randomstring');module[_0x7a51('0x1')]={'name':{'type':Sequelize[_0x7a51('0x2')],'unique':_0x7a51('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x7a51('0x2')],'defaultValue':function(){return rs[_0x7a51('0x4')]();}},'replyUri':{'type':Sequelize[_0x7a51('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7a51('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7a51('0x5')],'defaultValue':function(){return _0x7a51('0x6');}},'notificationSound':{'type':Sequelize[_0x7a51('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7a51('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7a51('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7a51('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7a51('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7a51('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x7a51('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7a51('0x7')],'defaultValue':![],'comment':_0x7a51('0xa'),'set':function(_0x5eefe7){if(!_0x5eefe7)this[_0x7a51('0xb')]('mandatoryDispositionPauseId',null);this[_0x7a51('0xb')](_0x7a51('0xc'),_0x5eefe7);}}}; \ No newline at end of file +var _0x34ad=['INTEGER','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name','generate','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x21c6b2,_0x397bf0){var _0x4ea468=function(_0xb8814e){while(--_0xb8814e){_0x21c6b2['push'](_0x21c6b2['shift']());}};_0x4ea468(++_0x397bf0);}(_0x34ad,0x1a7));var _0xd34a=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0x34ad[_0x147c96];return _0x4ec711;};'use strict';var Sequelize=require(_0xd34a('0x0'));var rs=require(_0xd34a('0x1'));module[_0xd34a('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xd34a('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd34a('0x4')]();}},'replyUri':{'type':Sequelize[_0xd34a('0x5')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd34a('0x5')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd34a('0x6')],'defaultValue':function(){return _0xd34a('0x7');}},'notificationSound':{'type':Sequelize[_0xd34a('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd34a('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd34a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd34a('0x5')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd34a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd34a('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd34a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd34a('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x428b42){if(!_0x428b42)this[_0xd34a('0xa')](_0xd34a('0xb'),null);this[_0xd34a('0xa')]('mandatoryDisposition',_0x428b42);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index baeef7a..11d3d54 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 _0x7de3=['offset','count','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','list','applications','orderBy','priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','OpenchannelApplication','findAndCountAll','getInteractions','Contact','User','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','send','out','Messages','dataValues','push','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','limit'];(function(_0x3ec0e8,_0x485a9d){var _0x26fd54=function(_0x4df6a5){while(--_0x4df6a5){_0x3ec0e8['push'](_0x3ec0e8['shift']());}};_0x26fd54(++_0x485a9d);}(_0x7de3,0x8a));var _0x37de=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7de3[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require(_0x37de('0x0'));var rimraf=require(_0x37de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x37de('0x2'));var moment=require(_0x37de('0x3'));var BPromise=require(_0x37de('0x4'));var Mustache=require(_0x37de('0x5'));var util=require(_0x37de('0x6'));var path=require(_0x37de('0x7'));var sox=require(_0x37de('0x8'));var csv=require(_0x37de('0x9'));var ejs=require(_0x37de('0xa'));var fs=require('fs');var fs_extra=require(_0x37de('0xb'));var _=require(_0x37de('0xc'));var squel=require(_0x37de('0xd'));var crypto=require('crypto');var jsforce=require(_0x37de('0xe'));var deskjs=require(_0x37de('0xf'));var toCsv=require(_0x37de('0x9'));var querystring=require(_0x37de('0x10'));var Papa=require(_0x37de('0x11'));var Redis=require(_0x37de('0x12'));var authService=require(_0x37de('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x37de('0x14'));var hardwareService=require(_0x37de('0x15'));var logger=require('../../config/logger')(_0x37de('0x16'));var utils=require('../../config/utils');var config=require(_0x37de('0x17'));var licenseUtil=require(_0x37de('0x18'));var db=require(_0x37de('0x19'))['db'];config[_0x37de('0x1a')]=_[_0x37de('0x1b')](config['redis'],{'host':_0x37de('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37de('0x1a')]));require(_0x37de('0x1d'))['register'](socket);var jayson=require(_0x37de('0x1e'));var client=jayson[_0x37de('0x1f')][_0x37de('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x37de('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x421d30,_0x21486d,_0x2348da,_0x27e0be){return new BPromise(function(_0x56529c,_0x41f033){var _0x3d7dd8=_0x27e0be||client;return _0x3d7dd8[_0x37de('0x21')](_0x421d30,_0x2348da)[_0x37de('0x22')](function(_0x3fcb1a){logger[_0x37de('0x23')](_0x37de('0x24'),_0x21486d,_0x37de('0x25'));logger[_0x37de('0x26')](_0x37de('0x27'),_0x21486d,_0x37de('0x25'),JSON['stringify'](_0x3fcb1a));if(_0x3fcb1a[_0x37de('0x28')]){if(_0x3fcb1a['error'][_0x37de('0x29')]===0x1f4){logger[_0x37de('0x28')](_0x37de('0x24'),_0x21486d,_0x3fcb1a['error'][_0x37de('0x2a')]);return _0x41f033(_0x3fcb1a[_0x37de('0x28')][_0x37de('0x2a')]);}logger[_0x37de('0x28')](_0x37de('0x24'),_0x21486d,_0x3fcb1a[_0x37de('0x28')][_0x37de('0x2a')]);return _0x56529c(_0x3fcb1a[_0x37de('0x28')][_0x37de('0x2a')]);}else{logger[_0x37de('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x21486d,_0x37de('0x25'));_0x56529c(_0x3fcb1a['result'][_0x37de('0x2a')]);}})[_0x37de('0x2b')](function(_0x49969f){logger[_0x37de('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x21486d,_0x49969f);_0x41f033(_0x49969f);});});}function respondWithStatusCode(_0x3717a0,_0x3ff745){_0x3ff745=_0x3ff745||0xcc;return function(_0x31006a){if(_0x31006a){return _0x3717a0[_0x37de('0x2c')](_0x3ff745);}return _0x3717a0[_0x37de('0x2d')](_0x3ff745)[_0x37de('0x2e')]();};}function respondWithResult(_0x5026ef,_0x524bff){_0x524bff=_0x524bff||0xc8;return function(_0x5e7d3b){if(_0x5e7d3b){return _0x5026ef['status'](_0x524bff)[_0x37de('0x2f')](_0x5e7d3b);}};}function respondWithFilteredResult(_0x506543,_0x164377){return function(_0x18da8e){if(_0x18da8e){var _0x79424f=typeof _0x164377['offset']===_0x37de('0x30')&&typeof _0x164377[_0x37de('0x31')]===_0x37de('0x30');var _0x4f2066=_0x18da8e['count'];var _0x1d2387=_0x79424f?0x0:_0x164377[_0x37de('0x32')];var _0x196ed5=_0x79424f?_0x18da8e[_0x37de('0x33')]:_0x164377['offset']+_0x164377[_0x37de('0x31')];var _0x4d96ce;if(_0x196ed5>=_0x4f2066){_0x196ed5=_0x4f2066;_0x4d96ce=0xc8;}else{_0x4d96ce=0xce;}_0x506543[_0x37de('0x2d')](_0x4d96ce);return _0x506543['set']('Content-Range',_0x1d2387+'-'+_0x196ed5+'/'+_0x4f2066)['json'](_0x18da8e);}return null;};}function patchUpdates(_0x2411c7){return function(_0x181188){try{jsonpatch[_0x37de('0x34')](_0x181188,_0x2411c7,!![]);}catch(_0x5600c5){return BPromise[_0x37de('0x35')](_0x5600c5);}return _0x181188[_0x37de('0x36')]();};}function saveUpdates(_0x158a68,_0x46adfc){return function(_0x107eaf){if(_0x107eaf){return _0x107eaf[_0x37de('0x37')](_0x158a68)['then'](function(_0x3964ac){return _0x3964ac;});}return null;};}function removeEntity(_0x1dfbea,_0x21aff0){return function(_0x323eaa){if(_0x323eaa){return _0x323eaa[_0x37de('0x38')]()['then'](function(){var _0x14547a=_0x323eaa[_0x37de('0x39')]({'plain':!![]});var _0x1f7c16=_0x37de('0x3a');return db[_0x37de('0x3b')][_0x37de('0x38')]({'where':{'type':_0x1f7c16,'resourceId':_0x14547a['id']}})[_0x37de('0x22')](function(){return _0x323eaa;});})[_0x37de('0x22')](function(){_0x1dfbea[_0x37de('0x2d')](0xcc)[_0x37de('0x2e')]();});}};}function handleEntityNotFound(_0x3da821,_0x5e62ae){return function(_0x482805){if(!_0x482805){_0x3da821[_0x37de('0x2c')](0x194);}return _0x482805;};}function handleError(_0x230b0f,_0x1b4e43){_0x1b4e43=_0x1b4e43||0x1f4;return function(_0x5e6612){logger[_0x37de('0x28')](_0x5e6612[_0x37de('0x3c')]);if(_0x5e6612[_0x37de('0x3d')]){delete _0x5e6612[_0x37de('0x3d')];}_0x230b0f[_0x37de('0x2d')](_0x1b4e43)['send'](_0x5e6612);};}exports[_0x37de('0x3e')]=function(_0x5d12fc,_0x12bc90){var _0x31f813={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2fddd6={},_0x6b5c73={'count':0x0,'rows':[]};var _0x10b478=_[_0x37de('0x3f')](db[_0x37de('0x40')][_0x37de('0x41')],function(_0xdea551){return{'name':_0xdea551[_0x37de('0x42')],'type':_0xdea551[_0x37de('0x43')][_0x37de('0x44')]};});_0x2fddd6[_0x37de('0x45')]=_[_0x37de('0x3f')](_0x10b478,'name');_0x2fddd6[_0x37de('0x46')]=_['keys'](_0x5d12fc['query']);_0x2fddd6[_0x37de('0x47')]=_[_0x37de('0x48')](_0x2fddd6['model'],_0x2fddd6['query']);_0x31f813[_0x37de('0x49')]=_[_0x37de('0x48')](_0x2fddd6['model'],qs[_0x37de('0x4a')](_0x5d12fc[_0x37de('0x46')][_0x37de('0x4a')]));_0x31f813[_0x37de('0x49')]=_0x31f813['attributes']['length']?_0x31f813[_0x37de('0x49')]:_0x2fddd6[_0x37de('0x45')];if(!_0x5d12fc[_0x37de('0x46')][_0x37de('0x4b')](_0x37de('0x4c'))){_0x31f813[_0x37de('0x31')]=qs[_0x37de('0x31')](_0x5d12fc[_0x37de('0x46')]['limit']);_0x31f813[_0x37de('0x32')]=qs[_0x37de('0x32')](_0x5d12fc[_0x37de('0x46')][_0x37de('0x32')]);}_0x31f813[_0x37de('0x4d')]=qs['sort'](_0x5d12fc['query'][_0x37de('0x4e')]);_0x31f813[_0x37de('0x4f')]=qs[_0x37de('0x47')](_[_0x37de('0x50')](_0x5d12fc['query'],_0x2fddd6[_0x37de('0x47')]),_0x10b478);if(_0x5d12fc[_0x37de('0x46')][_0x37de('0x51')]){_0x31f813[_0x37de('0x4f')]=_[_0x37de('0x52')](_0x31f813[_0x37de('0x4f')],{'$or':_[_0x37de('0x3f')](_0x10b478,function(_0x465520){if(_0x465520[_0x37de('0x43')]!==_0x37de('0x53')){var _0x229ff8={};_0x229ff8[_0x465520['name']]={'$like':'%'+_0x5d12fc[_0x37de('0x46')][_0x37de('0x51')]+'%'};return _0x229ff8;}})});}_0x31f813=_[_0x37de('0x52')]({},_0x31f813,_0x5d12fc[_0x37de('0x54')]);var _0x18f08e={'where':_0x31f813[_0x37de('0x4f')]};return db[_0x37de('0x40')][_0x37de('0x33')](_0x18f08e)[_0x37de('0x22')](function(_0x951abf){_0x6b5c73[_0x37de('0x33')]=_0x951abf;if(_0x5d12fc[_0x37de('0x46')][_0x37de('0x55')]){_0x31f813['include']=[{'all':!![]}];}return db[_0x37de('0x40')]['findAll'](_0x31f813);})[_0x37de('0x22')](function(_0x56bf61){_0x6b5c73[_0x37de('0x56')]=_0x56bf61;return _0x6b5c73;})[_0x37de('0x22')](respondWithFilteredResult(_0x12bc90,_0x31f813))[_0x37de('0x2b')](handleError(_0x12bc90,null));};exports[_0x37de('0x57')]=function(_0xa58a94,_0x4f5647){var _0x49b221={'raw':![],'where':{'id':_0xa58a94[_0x37de('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1f35ee={};_0x1f35ee[_0x37de('0x45')]=_[_0x37de('0x59')](db[_0x37de('0x40')][_0x37de('0x41')]);_0x1f35ee['query']=_[_0x37de('0x59')](_0xa58a94[_0x37de('0x46')]);_0x1f35ee[_0x37de('0x47')]=_['intersection'](_0x1f35ee[_0x37de('0x45')],_0x1f35ee[_0x37de('0x46')]);_0x49b221['attributes']=_[_0x37de('0x48')](_0x1f35ee[_0x37de('0x45')],qs[_0x37de('0x4a')](_0xa58a94[_0x37de('0x46')][_0x37de('0x4a')]));_0x49b221[_0x37de('0x49')]=_0x49b221[_0x37de('0x49')][_0x37de('0x5a')]?_0x49b221['attributes']:_0x1f35ee['model'];if(_0xa58a94[_0x37de('0x46')][_0x37de('0x55')]){_0x49b221[_0x37de('0x5b')]=[{'all':!![]}];}_0x49b221=_[_0x37de('0x52')]({},_0x49b221,_0xa58a94[_0x37de('0x54')]);return db[_0x37de('0x40')][_0x37de('0x5c')](_0x49b221)[_0x37de('0x22')](handleEntityNotFound(_0x4f5647,null))[_0x37de('0x22')](respondWithResult(_0x4f5647,null))[_0x37de('0x2b')](handleError(_0x4f5647,null));};exports[_0x37de('0x5d')]=function(_0x53276d,_0x576e74){return db[_0x37de('0x40')][_0x37de('0x5d')](_0x53276d[_0x37de('0x5e')],{})[_0x37de('0x22')](function(_0x54752f){var _0x1ef3ad=_0x53276d['user'][_0x37de('0x39')]({'plain':!![]});if(!_0x1ef3ad)throw new Error(_0x37de('0x5f'));if(_0x1ef3ad[_0x37de('0x60')]===_0x37de('0x61')){var _0x412769=_0x54752f['get']({'plain':!![]});var _0x4fa97d=_0x37de('0x3a');return db[_0x37de('0x62')][_0x37de('0x5c')]({'where':{'name':_0x4fa97d,'userProfileId':_0x1ef3ad[_0x37de('0x63')]},'raw':!![]})[_0x37de('0x22')](function(_0x526624){if(_0x526624&&_0x526624[_0x37de('0x64')]===0x0){return db[_0x37de('0x3b')][_0x37de('0x5d')]({'name':_0x412769[_0x37de('0x3d')],'resourceId':_0x412769['id'],'type':_0x526624['name'],'sectionId':_0x526624['id']},{})[_0x37de('0x22')](function(){return _0x54752f;});}else{return _0x54752f;}})[_0x37de('0x2b')](function(_0x23985c){logger[_0x37de('0x28')](_0x37de('0x65'),_0x23985c);throw _0x23985c;});}return _0x54752f;})['then'](respondWithResult(_0x576e74,0xc9))[_0x37de('0x2b')](handleError(_0x576e74,null));};exports['update']=function(_0x369594,_0x5c751c){if(_0x369594[_0x37de('0x5e')]['id']){delete _0x369594['body']['id'];}return db['OpenchannelAccount'][_0x37de('0x5c')]({'where':{'id':_0x369594[_0x37de('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x5c751c,null))[_0x37de('0x22')](saveUpdates(_0x369594[_0x37de('0x5e')],null))[_0x37de('0x22')](respondWithResult(_0x5c751c,null))[_0x37de('0x2b')](handleError(_0x5c751c,null));};exports[_0x37de('0x38')]=function(_0x7544b8,_0x35de83){return db['OpenchannelAccount'][_0x37de('0x5c')]({'where':{'id':_0x7544b8[_0x37de('0x58')]['id']}})['then'](handleEntityNotFound(_0x35de83,null))['then'](removeEntity(_0x35de83,null))[_0x37de('0x2b')](handleError(_0x35de83,null));};exports[_0x37de('0x66')]=function(_0x109229,_0x250605){return db[_0x37de('0x40')][_0x37de('0x66')]()[_0x37de('0x22')](respondWithResult(_0x250605,null))[_0x37de('0x2b')](handleError(_0x250605,null));};exports[_0x37de('0x67')]=function(_0x125303,_0x400266,_0x1c76eb){if(_0x125303[_0x37de('0x5e')]['id']){delete _0x125303[_0x37de('0x5e')]['id'];}return db[_0x37de('0x40')][_0x37de('0x5c')]({'where':{'id':_0x125303['params']['id']}})[_0x37de('0x22')](handleEntityNotFound(_0x400266,null))[_0x37de('0x22')](function(_0x2315da){if(_0x2315da){_0x125303[_0x37de('0x5e')][_0x37de('0x68')]=_0x2315da['id'];return db[_0x37de('0x69')][_0x37de('0x5d')](_0x125303[_0x37de('0x5e')]);}})['then'](respondWithResult(_0x400266,null))[_0x37de('0x2b')](handleError(_0x400266,null));};exports[_0x37de('0x6a')]=function(_0x1089f6,_0x7e6581,_0x338aee){var _0x217ed7={'raw':![],'where':{}};var _0x53f754={};var _0x501296={'count':0x0,'rows':[]};return db[_0x37de('0x40')][_0x37de('0x6b')]({'where':{'id':_0x1089f6[_0x37de('0x58')]['id']}})[_0x37de('0x22')](handleEntityNotFound(_0x7e6581,null))['then'](function(_0x4b01b0){if(_0x4b01b0){_0x53f754[_0x37de('0x45')]=_[_0x37de('0x59')](db[_0x37de('0x69')][_0x37de('0x41')]);_0x53f754[_0x37de('0x46')]=_['keys'](_0x1089f6['query']);_0x53f754[_0x37de('0x47')]=_[_0x37de('0x48')](_0x53f754[_0x37de('0x45')],_0x53f754['query']);_0x217ed7[_0x37de('0x49')]=_[_0x37de('0x48')](_0x53f754['model'],qs[_0x37de('0x4a')](_0x1089f6['query'][_0x37de('0x4a')]));_0x217ed7[_0x37de('0x49')]=_0x217ed7[_0x37de('0x49')]['length']?_0x217ed7[_0x37de('0x49')]:_0x53f754[_0x37de('0x45')];if(!_0x1089f6[_0x37de('0x46')][_0x37de('0x4b')](_0x37de('0x4c'))){_0x217ed7['limit']=qs[_0x37de('0x31')](_0x1089f6[_0x37de('0x46')][_0x37de('0x31')]);_0x217ed7[_0x37de('0x32')]=qs['offset'](_0x1089f6[_0x37de('0x46')][_0x37de('0x32')]);}_0x217ed7['order']=qs[_0x37de('0x4e')](_0x1089f6[_0x37de('0x46')][_0x37de('0x4e')]);_0x217ed7['where']=qs[_0x37de('0x47')](_[_0x37de('0x50')](_0x1089f6[_0x37de('0x46')],_0x53f754['filters']));_0x217ed7[_0x37de('0x4f')]['OpenchannelAccountId']=_0x4b01b0['id'];if(_0x1089f6['query'][_0x37de('0x51')]){_0x217ed7['where']=_['merge'](_0x217ed7['where'],{'$or':_[_0x37de('0x3f')](_0x217ed7[_0x37de('0x49')],function(_0x4f8e58){var _0x2185b4={};_0x2185b4[_0x4f8e58]={'$like':'%'+_0x1089f6[_0x37de('0x46')][_0x37de('0x51')]+'%'};return _0x2185b4;})});}_0x217ed7=_[_0x37de('0x52')]({},_0x217ed7,_0x1089f6[_0x37de('0x54')]);return db[_0x37de('0x69')]['count']({'where':_0x217ed7['where']})[_0x37de('0x22')](function(_0x32f856){_0x501296[_0x37de('0x33')]=_0x32f856;if(_0x1089f6[_0x37de('0x46')]['includeAll']){_0x217ed7[_0x37de('0x5b')]=[{'all':!![]}];}return db[_0x37de('0x69')][_0x37de('0x6c')](_0x217ed7);})[_0x37de('0x22')](function(_0x137d03){_0x501296[_0x37de('0x56')]=_0x137d03;return _0x501296;});}})[_0x37de('0x22')](respondWithFilteredResult(_0x7e6581,_0x217ed7))[_0x37de('0x2b')](handleError(_0x7e6581,null));};exports[_0x37de('0x6d')]=function(_0x16dfbc,_0x819641,_0x3f0f91){return db[_0x37de('0x40')][_0x37de('0x5c')]({'where':{'id':_0x16dfbc[_0x37de('0x58')]['id']}})[_0x37de('0x22')](handleEntityNotFound(_0x819641,null))[_0x37de('0x22')](function(_0x4efdf6){if(_0x4efdf6){return _0x4efdf6[_0x37de('0x6d')](_0x16dfbc[_0x37de('0x46')][_0x37de('0x6e')]);}})['then'](respondWithStatusCode(_0x819641,null))[_0x37de('0x2b')](handleError(_0x819641,null));};exports['addAnswer']=function(_0x52f951,_0x339ee5,_0x8cd4fc){if(_0x52f951[_0x37de('0x5e')]['id']){delete _0x52f951[_0x37de('0x5e')]['id'];}return db[_0x37de('0x40')]['find']({'where':{'id':_0x52f951[_0x37de('0x58')]['id']}})[_0x37de('0x22')](handleEntityNotFound(_0x339ee5,null))['then'](function(_0x5f6cf4){if(_0x5f6cf4){_0x52f951[_0x37de('0x5e')]['OpenchannelAccountId']=_0x5f6cf4['id'];return db['CannedAnswer'][_0x37de('0x5d')](_0x52f951[_0x37de('0x5e')]);}})[_0x37de('0x22')](respondWithResult(_0x339ee5,null))[_0x37de('0x2b')](handleError(_0x339ee5,null));};exports[_0x37de('0x6f')]=function(_0x528737,_0x2acd70,_0x49d8c7){var _0x19cad3={'raw':![],'where':{}};var _0x593198={};var _0x42a8bf={'count':0x0,'rows':[]};return db[_0x37de('0x40')]['findOne']({'where':{'id':_0x528737[_0x37de('0x58')]['id']}})['then'](handleEntityNotFound(_0x2acd70,null))[_0x37de('0x22')](function(_0x3b67ca){if(_0x3b67ca){_0x593198[_0x37de('0x45')]=_[_0x37de('0x59')](db[_0x37de('0x70')][_0x37de('0x41')]);_0x593198['query']=_[_0x37de('0x59')](_0x528737[_0x37de('0x46')]);_0x593198['filters']=_[_0x37de('0x48')](_0x593198[_0x37de('0x45')],_0x593198[_0x37de('0x46')]);_0x19cad3[_0x37de('0x49')]=_[_0x37de('0x48')](_0x593198[_0x37de('0x45')],qs[_0x37de('0x4a')](_0x528737[_0x37de('0x46')][_0x37de('0x4a')]));_0x19cad3[_0x37de('0x49')]=_0x19cad3[_0x37de('0x49')][_0x37de('0x5a')]?_0x19cad3['attributes']:_0x593198[_0x37de('0x45')];if(!_0x528737['query'][_0x37de('0x4b')](_0x37de('0x4c'))){_0x19cad3[_0x37de('0x31')]=qs[_0x37de('0x31')](_0x528737['query']['limit']);_0x19cad3[_0x37de('0x32')]=qs['offset'](_0x528737['query'][_0x37de('0x32')]);}_0x19cad3['order']=qs[_0x37de('0x4e')](_0x528737[_0x37de('0x46')][_0x37de('0x4e')]);_0x19cad3['where']=qs['filters'](_['pick'](_0x528737['query'],_0x593198[_0x37de('0x47')]));_0x19cad3[_0x37de('0x4f')][_0x37de('0x68')]=_0x3b67ca['id'];if(_0x528737[_0x37de('0x46')][_0x37de('0x51')]){_0x19cad3[_0x37de('0x4f')]=_[_0x37de('0x52')](_0x19cad3['where'],{'$or':_[_0x37de('0x3f')](_0x19cad3[_0x37de('0x49')],function(_0x195061){var _0x49ae73={};_0x49ae73[_0x195061]={'$like':'%'+_0x528737[_0x37de('0x46')][_0x37de('0x51')]+'%'};return _0x49ae73;})});}_0x19cad3=_[_0x37de('0x52')]({},_0x19cad3,_0x528737[_0x37de('0x54')]);return db[_0x37de('0x70')][_0x37de('0x33')]({'where':_0x19cad3[_0x37de('0x4f')]})[_0x37de('0x22')](function(_0x4ec46b){_0x42a8bf[_0x37de('0x33')]=_0x4ec46b;if(_0x528737[_0x37de('0x46')][_0x37de('0x55')]){_0x19cad3[_0x37de('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x37de('0x6c')](_0x19cad3);})[_0x37de('0x22')](function(_0x28ae34){_0x42a8bf[_0x37de('0x56')]=_0x28ae34;return _0x42a8bf;});}})[_0x37de('0x22')](respondWithFilteredResult(_0x2acd70,_0x19cad3))[_0x37de('0x2b')](handleError(_0x2acd70,null));};exports[_0x37de('0x71')]=function(_0x4a9415,_0x2dbc8a,_0x4b95d7){return db['OpenchannelAccount']['find']({'where':{'id':_0x4a9415[_0x37de('0x58')]['id']}})[_0x37de('0x22')](handleEntityNotFound(_0x2dbc8a,null))[_0x37de('0x22')](function(_0x2b95a5){if(_0x2b95a5){return _0x2b95a5[_0x37de('0x71')](_0x4a9415[_0x37de('0x46')]['ids']);}})[_0x37de('0x22')](respondWithStatusCode(_0x2dbc8a,null))['catch'](handleError(_0x2dbc8a,null));};exports[_0x37de('0x72')]=function(_0x3c2e42,_0x14f6a5,_0xa5f7e8){var _0x34e75d={'body':_0x3c2e42[_0x37de('0x5e')],'channel':_0x37de('0x73')};var _0x2574c2=[];var _0x1d7df7=[];var _0x36ecd7={};var _0x41c5f0=![];return db[_0x37de('0x74')][_0x37de('0x66')]()[_0x37de('0x22')](function(_0x114b0a){if(!_0x114b0a){throw new db[(_0x37de('0x75'))][(_0x37de('0x76'))](_0x37de('0x77'));}_0x2574c2=_['difference'](_['keys'](_0x114b0a),[_0x37de('0x78'),'updatedAt']);_0x1d7df7=_['difference'](_[_0x37de('0x59')](_0x114b0a),['createdAt',_0x37de('0x79'),_0x37de('0x7a'),_0x37de('0x7b')]);if(_0x3c2e42[_0x37de('0x5e')]['id']){delete _0x3c2e42['body']['id'];}if(_[_0x37de('0x7c')](_0x3c2e42[_0x37de('0x5e')][_0x37de('0x7d')])){throw new db[(_0x37de('0x75'))][(_0x37de('0x76'))](_0x37de('0x7e'));}if(_[_0x37de('0x7c')](_0x3c2e42[_0x37de('0x5e')]['body'])||_0x3c2e42[_0x37de('0x5e')][_0x37de('0x5e')]===''){throw new db[(_0x37de('0x75'))][(_0x37de('0x76'))](_0x37de('0x7f'));}if(_[_0x37de('0x7c')](_0x3c2e42[_0x37de('0x5e')][_0x37de('0x80')])){throw new db[(_0x37de('0x75'))][(_0x37de('0x76'))](_0x37de('0x81')+_0x1d7df7);}if(!_[_0x37de('0x82')](_0x1d7df7,_0x3c2e42[_0x37de('0x5e')][_0x37de('0x80')])){throw new db[(_0x37de('0x75'))]['ValidationError'](_0x37de('0x83')+_0x1d7df7);}_0x36ecd7[_0x3c2e42[_0x37de('0x5e')][_0x37de('0x80')]]=_0x3c2e42[_0x37de('0x5e')][_0x37de('0x7d')];})['then'](function(){return db['OpenchannelAccount'][_0x37de('0x5c')]({'where':{'id':_0x3c2e42['params']['id']},'include':[{'model':db[_0x37de('0x84')],'as':_0x37de('0x85'),'include':[{'model':db[_0x37de('0x74')],'as':_0x37de('0x86'),'where':_0x36ecd7,'limit':0x1,'order':[[_0x37de('0x79'),_0x37de('0x87')]]}]},{'model':db['OpenchannelApplication'],'as':_0x37de('0x88')}]});})['then'](handleEntityNotFound(_0x14f6a5,null))[_0x37de('0x22')](function(_0x465594){if(_0x465594&&_0x465594[_0x37de('0x85')]){_0x34e75d[_0x37de('0x89')]=_0x465594;_0x34e75d['applications']=_0x465594['Applications'];_0x34e75d[_0x37de('0x8a')]=_0x465594[_0x37de('0x85')];_0x34e75d[_0x37de('0x8b')]=_[_0x37de('0x8c')](_0x34e75d['applications'],[_0x37de('0x8d')],[_0x37de('0x8e')]);if(_0x34e75d[_0x37de('0x89')]['Applications']){delete _0x34e75d['account'][_0x37de('0x88')];}if(_0x34e75d[_0x37de('0x89')][_0x37de('0x85')]&&_0x34e75d['account'][_0x37de('0x85')][_0x37de('0x86')][_0x37de('0x5a')]){return _0x34e75d['account'][_0x37de('0x85')]['Contacts'][0x0];}var _0x3ac77f=_['defaults'](_0x3c2e42['body'],{'firstName':_0x3c2e42['body'][_0x37de('0x7d')],'ListId':_0x465594[_0x37de('0x7b')]});_0x3ac77f[_0x3c2e42[_0x37de('0x5e')][_0x37de('0x80')]]=_0x3c2e42['body'][_0x37de('0x7d')];return db[_0x37de('0x74')][_0x37de('0x5d')](_0x3ac77f,{'fields':_0x2574c2,'raw':!![]});}})['then'](handleEntityNotFound(_0x14f6a5,null))[_0x37de('0x22')](function(_0x427ecc){_0x34e75d[_0x37de('0x8f')]=_0x427ecc;if(_0x427ecc){var _0x405c6f={'ContactId':_0x427ecc['id'],'OpenchannelAccountId':_0x3c2e42[_0x37de('0x58')]['id'],'from':(_0x427ecc[_0x37de('0x90')]||'')+'\x20'+(_0x427ecc[_0x37de('0x91')]||'')};var _0x4356dd={'OpenchannelAccountId':_0x3c2e42[_0x37de('0x58')]['id'],'closed':![]};if(_0x3c2e42[_0x37de('0x5e')][_0x37de('0x92')]){_0x4356dd[_0x37de('0x92')]=_0x3c2e42['body'][_0x37de('0x92')];return db['OpenchannelInteraction'][_0x37de('0x5c')]({'where':_0x4356dd})[_0x37de('0x22')](function(_0x1c2706){if(_0x1c2706){return[_0x1c2706,![]];}_0x405c6f[_0x37de('0x92')]=_0x3c2e42['body'][_0x37de('0x92')];_0x405c6f[_0x37de('0x93')]=_0x3c2e42[_0x37de('0x5e')][_0x37de('0x93')];return db[_0x37de('0x94')]['create'](_0x405c6f)['then'](function(_0x7a325f){return[_0x7a325f,!![]];});});}else{_0x4356dd[_0x37de('0x92')]=null;}_0x4356dd[_0x37de('0x95')]=_0x427ecc['id'];return db[_0x37de('0x94')]['find']({'where':_0x4356dd})['then'](function(_0x360c51){if(_0x360c51){return[_0x360c51,![]];}return db['OpenchannelInteraction'][_0x37de('0x5d')](_0x405c6f)[_0x37de('0x22')](function(_0x20d8c0){return[_0x20d8c0,!![]];});});}})[_0x37de('0x96')](function(_0x3fc550,_0x10a21){if(_0x3fc550){_0x41c5f0=_0x10a21;if(!_0x10a21){var _0x405c82={'from':(_0x34e75d[_0x37de('0x8f')][_0x37de('0x90')]||'')+'\x20'+(_0x34e75d['contact'][_0x37de('0x91')]||'')};if(_0x3c2e42[_0x37de('0x5e')][_0x37de('0x92')]&&_0x3c2e42['body']['messageId']&&_0x3c2e42[_0x37de('0x5e')]['threadId']!=_0x3c2e42['body']['messageId']){_0x405c82[_0x37de('0x92')]=_0x3c2e42[_0x37de('0x5e')][_0x37de('0x97')];}return _0x3fc550[_0x37de('0x37')](_0x405c82);}else{return _0x3fc550;}}})['then'](function(_0xef2509){_0x34e75d[_0x37de('0x98')]=_0xef2509[_0x37de('0x39')]({'plain':!![]});_0x34e75d['interaction'][_0x37de('0x99')]=_0x41c5f0;if(_0x34e75d[_0x37de('0x98')][_0x37de('0x99')]){if(_0x34e75d[_0x37de('0x89')][_0x37de('0x9a')]){_0x34e75d[_0x37de('0x8b')]['push']({'id':0x0,'priority':_0x34e75d['applications'][_0x37de('0x5a')]+0x1,'app':_0x37de('0x9b'),'appdata':'unmanaged','interval':_0x37de('0x9c')});}}return db[_0x37de('0x9d')]['create']({'body':_0x3c2e42[_0x37de('0x5e')][_0x37de('0x5e')],'OpenchannelAccountId':_0x3c2e42[_0x37de('0x58')]['id'],'OpenchannelInteractionId':_0xef2509['id'],'direction':'in','ContactId':_0x34e75d['contact']['id'],'AttachmentId':_0x3c2e42[_0x37de('0x5e')][_0x37de('0x9e')]});})[_0x37de('0x22')](function(_0x2f3e73){_0x34e75d['message']=_0x2f3e73;if(_0x34e75d['interaction'][_0x37de('0x9f')]){return db['User']['find']({'attributes':['id',_0x37de('0x3d')],'where':{'id':_0x34e75d['interaction'][_0x37de('0x9f')]}})['then'](function(_0x3bfda7){if(_0x3bfda7){_0x34e75d[_0x37de('0x8b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x37de('0xa0'),'appdata':_0x3bfda7[_0x37de('0x3d')]+','+(_0x34e75d[_0x37de('0x89')][_0x37de('0xa1')]||0xa),'interval':'*,*,*,*'});_0x34e75d[_0x37de('0xa2')]=![];}return respondWithRpcPromise(_0x37de('0xa3'),_0x37de('0xa4'),_0x34e75d);});}return respondWithRpcPromise('Start',_0x37de('0xa4'),_0x34e75d);})[_0x37de('0x22')](function(_0x16a6a7){respondWithRpcPromise(_0x37de('0xa5'),'EventManager',{'event':_0x37de('0x72'),'message':_0x16a6a7},client9002);return _0x16a6a7;})['then'](respondWithResult(_0x14f6a5,null))[_0x37de('0x2b')](handleError(_0x14f6a5,null));};exports[_0x37de('0xa6')]=function(_0x13746b,_0x1c72b5,_0x178b83){return db[_0x37de('0x40')][_0x37de('0x6b')]({'where':{'id':_0x13746b['params']['id']}})[_0x37de('0x22')](handleEntityNotFound(_0x1c72b5,null))['then'](function(_0x4cf24d){if(_0x4cf24d){return db[_0x37de('0xa7')]['transaction'](function(_0x58df4d){return db['OpenchannelApplication'][_0x37de('0x38')]({'where':{'OpenchannelAccountId':_0x13746b[_0x37de('0x58')]['id']},'transaction':_0x58df4d})['then'](function(_0x3b758f){var _0x70e301=_[_0x37de('0x3f')](_0x13746b['body'],function(_0x4c18f4){_0x4c18f4[_0x37de('0x68')]=_0x13746b[_0x37de('0x58')]['id'];return _0x4c18f4;});return db[_0x37de('0xa8')]['bulkCreate'](_0x70e301,{'transaction':_0x58df4d});});})[_0x37de('0x22')](function(){return db[_0x37de('0xa8')][_0x37de('0xa9')]({'where':{'OpenchannelAccountId':_0x13746b['params']['id']},'order':_0x37de('0x8d')});});}})[_0x37de('0x22')](respondWithResult(_0x1c72b5,null))[_0x37de('0x2b')](handleError(_0x1c72b5,null));};exports['getApplications']=function(_0x1f3f2e,_0xc2eb97,_0x5cf03f){var _0x11959c={};var _0x3e4da5={};var _0x53c39c;var _0x5cb7bc;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1f3f2e[_0x37de('0x58')]['id']}})[_0x37de('0x22')](handleEntityNotFound(_0xc2eb97,null))[_0x37de('0x22')](function(_0x3fdc35){if(_0x3fdc35){_0x53c39c=_0x3fdc35;_0x3e4da5[_0x37de('0x45')]=_[_0x37de('0x59')](db[_0x37de('0xa8')][_0x37de('0x41')]);_0x3e4da5[_0x37de('0x46')]=_['keys'](_0x1f3f2e[_0x37de('0x46')]);_0x3e4da5[_0x37de('0x47')]=_['intersection'](_0x3e4da5[_0x37de('0x45')],_0x3e4da5[_0x37de('0x46')]);_0x11959c[_0x37de('0x49')]=_[_0x37de('0x48')](_0x3e4da5[_0x37de('0x45')],qs['fields'](_0x1f3f2e[_0x37de('0x46')]['fields']));_0x11959c['attributes']=_0x11959c[_0x37de('0x49')][_0x37de('0x5a')]?_0x11959c['attributes']:_0x3e4da5[_0x37de('0x45')];_0x11959c[_0x37de('0x4d')]=qs[_0x37de('0x4e')](_0x1f3f2e[_0x37de('0x46')]['sort']);_0x11959c[_0x37de('0x4f')]=qs[_0x37de('0x47')](_['pick'](_0x1f3f2e['query'],_0x3e4da5[_0x37de('0x47')]));if(_0x1f3f2e['query'][_0x37de('0x51')]){_0x11959c[_0x37de('0x4f')]=_[_0x37de('0x52')](_0x11959c['where'],{'$or':_['map'](_0x11959c[_0x37de('0x49')],function(_0x7e06ef){var _0x3b99de={};_0x3b99de[_0x7e06ef]={'$like':'%'+_0x1f3f2e[_0x37de('0x46')]['filter']+'%'};return _0x3b99de;})});}_0x11959c=_[_0x37de('0x52')]({},_0x11959c,_0x1f3f2e[_0x37de('0x54')]);return _0x53c39c['getApplications'](_0x11959c);}})[_0x37de('0x22')](function(_0x34f3a9){if(_0x34f3a9){_0x5cb7bc=_0x34f3a9['length'];if(!_0x1f3f2e['query'][_0x37de('0x4b')](_0x37de('0x4c'))){_0x11959c[_0x37de('0x31')]=qs[_0x37de('0x31')](_0x1f3f2e[_0x37de('0x46')][_0x37de('0x31')]);_0x11959c[_0x37de('0x32')]=qs[_0x37de('0x32')](_0x1f3f2e[_0x37de('0x46')]['offset']);}return _0x53c39c['getApplications'](_0x11959c);}})['then'](function(_0x1acc06){if(_0x1acc06){return _0x1acc06?{'count':_0x5cb7bc,'rows':_0x1acc06}:null;}})[_0x37de('0x22')](respondWithResult(_0xc2eb97,null))[_0x37de('0x2b')](handleError(_0xc2eb97,null));};exports[_0x37de('0xaa')]=function(_0x33cce4,_0xcb422a,_0xd67939){var _0x5cce9c={'raw':![],'where':{}};var _0x2ec11d={};var _0x27ddbc={'count':0x0,'rows':[]};return db[_0x37de('0x40')][_0x37de('0x6b')]({'where':{'id':_0x33cce4['params']['id']}})['then'](handleEntityNotFound(_0xcb422a,null))[_0x37de('0x22')](function(_0x4e5214){if(_0x4e5214){_0x2ec11d[_0x37de('0x45')]=_[_0x37de('0x59')](db['OpenchannelInteraction'][_0x37de('0x41')]);_0x2ec11d['query']=_[_0x37de('0x59')](_0x33cce4[_0x37de('0x46')]);_0x2ec11d[_0x37de('0x47')]=_['intersection'](_0x2ec11d[_0x37de('0x45')],_0x2ec11d[_0x37de('0x46')]);_0x5cce9c['attributes']=_['intersection'](_0x2ec11d[_0x37de('0x45')],qs[_0x37de('0x4a')](_0x33cce4['query']['fields']));_0x5cce9c[_0x37de('0x49')]=_0x5cce9c[_0x37de('0x49')]['length']?_0x5cce9c[_0x37de('0x49')]:_0x2ec11d[_0x37de('0x45')];if(!_0x33cce4[_0x37de('0x46')][_0x37de('0x4b')](_0x37de('0x4c'))){_0x5cce9c[_0x37de('0x31')]=qs[_0x37de('0x31')](_0x33cce4[_0x37de('0x46')][_0x37de('0x31')]);_0x5cce9c[_0x37de('0x32')]=qs[_0x37de('0x32')](_0x33cce4[_0x37de('0x46')][_0x37de('0x32')]);}_0x5cce9c[_0x37de('0x4d')]=qs['sort'](_0x33cce4['query']['sort']);_0x5cce9c['where']=qs[_0x37de('0x47')](_[_0x37de('0x50')](_0x33cce4['query'],_0x2ec11d[_0x37de('0x47')]));_0x5cce9c[_0x37de('0x4f')][_0x37de('0x68')]=_0x4e5214['id'];if(_0x33cce4[_0x37de('0x46')]['filter']){_0x5cce9c['where']=_[_0x37de('0x52')](_0x5cce9c[_0x37de('0x4f')],{'$or':_[_0x37de('0x3f')](_0x5cce9c['attributes'],function(_0x59e909){var _0x37e1bb={};_0x37e1bb[_0x59e909]={'$like':'%'+_0x33cce4[_0x37de('0x46')]['filter']+'%'};return _0x37e1bb;})});}_0x5cce9c=_[_0x37de('0x52')]({},_0x5cce9c,_0x33cce4[_0x37de('0x54')]);return db[_0x37de('0x94')][_0x37de('0x33')]({'where':_0x5cce9c[_0x37de('0x4f')]})['then'](function(_0xd755fc){_0x27ddbc[_0x37de('0x33')]=_0xd755fc;if(_0x33cce4[_0x37de('0x46')][_0x37de('0x55')]){_0x5cce9c['include']=[{'model':db[_0x37de('0x74')],'as':_0x37de('0xab'),'required':![]},{'model':db[_0x37de('0xac')],'as':'Owner','attributes':[_0x37de('0x3d'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x37de('0xad'),'attributes':['id','name',_0x37de('0xae')],'where':_0x33cce4['query'][_0x37de('0xaf')]?{'id':_0x33cce4[_0x37de('0x46')]['tag']}:undefined,'required':_0x33cce4[_0x37de('0x46')][_0x37de('0xaf')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x37de('0x6c')](_0x5cce9c);})[_0x37de('0x22')](function(_0x2f872d){_0x27ddbc[_0x37de('0x56')]=_0x2f872d;return _0x27ddbc;});}})[_0x37de('0x22')](respondWithFilteredResult(_0xcb422a,_0x5cce9c))[_0x37de('0x2b')](handleError(_0xcb422a,null));};exports[_0x37de('0xb0')]=function(_0x3604a0,_0x26a8b6,_0x34cc55){return db[_0x37de('0x40')][_0x37de('0x5c')]({'where':{'id':_0x3604a0['params']['id']}})[_0x37de('0x22')](handleEntityNotFound(_0x26a8b6,null))[_0x37de('0x22')](function(_0x3c72ea){if(_0x3c72ea){return _0x3c72ea[_0x37de('0xb0')](_0x3604a0[_0x37de('0x5e')][_0x37de('0x6e')],_[_0x37de('0xb1')](_0x3604a0[_0x37de('0x5e')],['ids','id'])||{})[_0x37de('0x96')](function(_0x412f6a){for(var _0x66b83f=0x0;_0x66b83f<_0x3604a0[_0x37de('0x5e')][_0x37de('0x6e')][_0x37de('0x5a')];_0x66b83f+=0x1){socket[_0x37de('0xb2')](_0x37de('0xb3'),{'UserId':Number(_0x3604a0[_0x37de('0x5e')][_0x37de('0x6e')][_0x66b83f]),'OpenchannelAccountId':Number(_0x3604a0[_0x37de('0x58')]['id'])});}return _0x412f6a;});}})[_0x37de('0x22')](respondWithResult(_0x26a8b6,null))[_0x37de('0x2b')](handleError(_0x26a8b6,null));};exports[_0x37de('0xb4')]=function(_0x1e8f1c,_0x1a4766,_0x1ef04e){return db[_0x37de('0x40')]['find']({'where':{'id':_0x1e8f1c['params']['id']}})[_0x37de('0x22')](handleEntityNotFound(_0x1a4766,null))[_0x37de('0x22')](function(_0x2eb210){if(_0x2eb210){return _0x2eb210['removeAgents'](_0x1e8f1c[_0x37de('0x46')][_0x37de('0x6e')])[_0x37de('0x22')](function(){if(_[_0x37de('0xb5')](_0x1e8f1c[_0x37de('0x46')][_0x37de('0x6e')])){for(var _0x42509b=0x0;_0x42509b<_0x1e8f1c[_0x37de('0x46')][_0x37de('0x6e')][_0x37de('0x5a')];_0x42509b+=0x1){socket[_0x37de('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x1e8f1c[_0x37de('0x46')][_0x37de('0x6e')][_0x42509b]),'OpenchannelAccountId':Number(_0x1e8f1c[_0x37de('0x58')]['id'])});}}else{socket[_0x37de('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x1e8f1c[_0x37de('0x46')][_0x37de('0x6e')]),'OpenchannelAccountId':Number(_0x1e8f1c['params']['id'])});}});}})[_0x37de('0x22')](respondWithStatusCode(_0x1a4766,null))[_0x37de('0x2b')](handleError(_0x1a4766,null));};exports[_0x37de('0xb6')]=function(_0x3137b5,_0x187457,_0x546875){var _0x3f9576={};var _0x27d2e6={};var _0x494f9f;var _0x22f594;return db[_0x37de('0x40')][_0x37de('0x6b')]({'where':{'id':_0x3137b5[_0x37de('0x58')]['id']}})['then'](handleEntityNotFound(_0x187457,null))[_0x37de('0x22')](function(_0x1f051e){if(_0x1f051e){_0x494f9f=_0x1f051e;_0x27d2e6[_0x37de('0x45')]=_['keys'](db[_0x37de('0xac')]['rawAttributes']);_0x27d2e6[_0x37de('0x46')]=_[_0x37de('0x59')](_0x3137b5[_0x37de('0x46')]);_0x27d2e6[_0x37de('0x47')]=_[_0x37de('0x48')](_0x27d2e6[_0x37de('0x45')],_0x27d2e6[_0x37de('0x46')]);_0x3f9576[_0x37de('0x49')]=_[_0x37de('0x48')](_0x27d2e6[_0x37de('0x45')],qs[_0x37de('0x4a')](_0x3137b5[_0x37de('0x46')][_0x37de('0x4a')]));_0x3f9576[_0x37de('0x49')]=_0x3f9576[_0x37de('0x49')][_0x37de('0x5a')]?_0x3f9576['attributes']:_0x27d2e6['model'];_0x3f9576['order']=qs[_0x37de('0x4e')](_0x3137b5['query'][_0x37de('0x4e')]);_0x3f9576[_0x37de('0x4f')]=qs[_0x37de('0x47')](_[_0x37de('0x50')](_0x3137b5[_0x37de('0x46')],_0x27d2e6[_0x37de('0x47')]));if(_0x3137b5[_0x37de('0x46')][_0x37de('0x51')]){_0x3f9576['where']=_[_0x37de('0x52')](_0x3f9576[_0x37de('0x4f')],{'$or':_[_0x37de('0x3f')](_0x3f9576[_0x37de('0x49')],function(_0x433c62){var _0x482bed={};_0x482bed[_0x433c62]={'$like':'%'+_0x3137b5[_0x37de('0x46')][_0x37de('0x51')]+'%'};return _0x482bed;})});}_0x3f9576=_[_0x37de('0x52')]({},_0x3f9576,_0x3137b5[_0x37de('0x54')]);return _0x494f9f['getAgents'](_0x3f9576);}})['then'](function(_0x196579){if(_0x196579){_0x22f594=_0x196579[_0x37de('0x5a')];if(!_0x3137b5[_0x37de('0x46')]['hasOwnProperty'](_0x37de('0x4c'))){_0x3f9576[_0x37de('0x31')]=qs[_0x37de('0x31')](_0x3137b5[_0x37de('0x46')][_0x37de('0x31')]);_0x3f9576[_0x37de('0x32')]=qs[_0x37de('0x32')](_0x3137b5[_0x37de('0x46')]['offset']);}return _0x494f9f[_0x37de('0xb6')](_0x3f9576);}})[_0x37de('0x22')](function(_0x482529){if(_0x482529){return _0x482529?{'count':_0x22f594,'rows':_0x482529}:null;}})[_0x37de('0x22')](respondWithResult(_0x187457,null))[_0x37de('0x2b')](handleError(_0x187457,null));};exports[_0x37de('0xb7')]=function(_0x404dbc,_0x7a1365,_0x15cc31){var _0x51f3ad,_0x518c80,_0x1192a5;if(_[_0x37de('0x7c')](_0x404dbc['body'][_0x37de('0x5e')])||_0x404dbc[_0x37de('0x5e')][_0x37de('0x5e')]===''){throw new db[(_0x37de('0x75'))][(_0x37de('0x76'))](_0x37de('0x7f'));}if(_[_0x37de('0x7c')](_0x404dbc[_0x37de('0x5e')]['to'])){}_0x51f3ad=_0x404dbc[_0x37de('0x5e')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x404dbc[_0x37de('0x58')]['id']}})[_0x37de('0x22')](handleEntityNotFound(_0x7a1365,null))[_0x37de('0x22')](function(_0x3f59c5){if(_0x3f59c5){return db['OpenchannelAccount'][_0x37de('0x5c')]({'where':{'id':_0x3f59c5['id']},'include':[{'model':db[_0x37de('0x84')],'as':_0x37de('0x85'),'include':[{'model':db[_0x37de('0x74')],'as':_0x37de('0x86'),'where':{[_0x3f59c5['mapKey']]:_0x51f3ad},'limit':0x1,'order':[[_0x37de('0x79'),_0x37de('0x87')]]}]}]})[_0x37de('0x22')](handleEntityNotFound(_0x7a1365,null))['then'](function(_0x537850){if(_0x537850&&_0x537850[_0x37de('0x85')]){_0x518c80=_0x537850['get']({'plain':!![]});if(_0x518c80['List']&&_0x518c80[_0x37de('0x85')]['Contacts'][_0x37de('0x5a')]){return _0x518c80[_0x37de('0x85')][_0x37de('0x86')][0x0];}return db[_0x37de('0x74')][_0x37de('0x5d')](_[_0x37de('0x1b')](_0x404dbc[_0x37de('0x5e')],{'firstName':_0x51f3ad,[_0x537850[_0x37de('0x80')]]:_0x51f3ad,'phone':_0x51f3ad,'ListId':_0x518c80[_0x37de('0x7b')]}));}})[_0x37de('0x22')](handleEntityNotFound(_0x7a1365,null))['then'](function(_0x3b3546){if(_0x3b3546){_0x1192a5=_0x3b3546;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x1192a5['id'],'closed':![],'OpenchannelAccountId':_0x518c80['id']}})[_0x37de('0x22')](function(_0x57726b){if(_0x57726b){return[_0x57726b,![]];}return db[_0x37de('0x94')][_0x37de('0x5d')]({'UserId':_0x404dbc[_0x37de('0x61')]['id'],'ContactId':_0x1192a5['id'],'OpenchannelAccountId':_0x518c80['id'],'lastMsgDirection':_0x37de('0xb8'),'Messages':[_[_0x37de('0x52')](_0x404dbc[_0x37de('0x5e')],{'read':![],'body':_0x404dbc['body'][_0x37de('0x5e')],'OpenchannelAccountId':_0x518c80['id'],'UserId':_0x404dbc[_0x37de('0x61')]['id'],'ContactId':_0x1192a5['id']})]},{'include':[{'model':db[_0x37de('0x9d')],'as':_0x37de('0xb9')}]})[_0x37de('0x22')](function(_0x31cd57){return[_0x31cd57,!![]];});});}})[_0x37de('0x96')](function(_0x501df2,_0x4842b0){if(_0x4842b0){return _0x501df2;}return db[_0x37de('0x9d')]['create'](_[_0x37de('0x52')](_0x404dbc[_0x37de('0x5e')],{'read':![],'body':_0x404dbc[_0x37de('0x5e')][_0x37de('0x5e')],'OpenchannelAccountId':_0x518c80['id'],'OpenchannelInteractionId':_0x501df2['id'],'UserId':_0x404dbc[_0x37de('0x61')]['id'],'ContactId':_0x1192a5['id']}))[_0x37de('0x22')](function(_0x180320){_0x501df2['dataValues']['Messages']=[];_0x501df2[_0x37de('0xba')][_0x37de('0xb9')][_0x37de('0xbb')](_0x180320[_0x37de('0xba')]);return _0x501df2;});});}})['then'](respondWithResult(_0x7a1365,null))[_0x37de('0x2b')](handleError(_0x7a1365,null));}; \ No newline at end of file +var _0xd8f0=['result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','OpenchannelAccount','type','key','model','map','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','findAll','rows','show','params','mandatoryDispositionPause','keys','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','account','applications','list','orderBy','priority','asc','Applications','mapKey','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','transaction','bulkCreate','findAndCountAll','getApplications','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x3da12c,_0x477951){var _0xd10648=function(_0x227e67){while(--_0x227e67){_0x3da12c['push'](_0x3da12c['shift']());}};_0xd10648(++_0x477951);}(_0xd8f0,0x14e));var _0x0d8f=function(_0x10e2c9,_0x489aab){_0x10e2c9=_0x10e2c9-0x0;var _0x426947=_0xd8f0[_0x10e2c9];return _0x426947;};'use strict';var emlformat=require(_0x0d8f('0x0'));var rimraf=require(_0x0d8f('0x1'));var zipdir=require(_0x0d8f('0x2'));var jsonpatch=require(_0x0d8f('0x3'));var rp=require(_0x0d8f('0x4'));var moment=require(_0x0d8f('0x5'));var BPromise=require(_0x0d8f('0x6'));var Mustache=require(_0x0d8f('0x7'));var util=require(_0x0d8f('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8f('0x9'));var fs=require('fs');var fs_extra=require(_0x0d8f('0xa'));var _=require(_0x0d8f('0xb'));var squel=require(_0x0d8f('0xc'));var crypto=require(_0x0d8f('0xd'));var jsforce=require(_0x0d8f('0xe'));var deskjs=require(_0x0d8f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0d8f('0x10'));var Papa=require(_0x0d8f('0x11'));var Redis=require(_0x0d8f('0x12'));var authService=require(_0x0d8f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d8f('0x14'));var logger=require(_0x0d8f('0x15'))(_0x0d8f('0x16'));var utils=require(_0x0d8f('0x17'));var config=require(_0x0d8f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d8f('0x19'))['db'];config[_0x0d8f('0x1a')]=_[_0x0d8f('0x1b')](config['redis'],{'host':_0x0d8f('0x1c'),'port':0x18eb});var socket=require(_0x0d8f('0x1d'))(new Redis(config['redis']));require(_0x0d8f('0x1e'))['register'](socket);var jayson=require(_0x0d8f('0x1f'));var client=jayson['client'][_0x0d8f('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x0d8f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xa46e31,_0x4dbee1,_0x563152,_0x21eaf4){return new BPromise(function(_0x6b9b22,_0x43300a){var _0x17f84b=_0x21eaf4||client;return _0x17f84b[_0x0d8f('0x21')](_0xa46e31,_0x563152)[_0x0d8f('0x22')](function(_0x41bd84){logger['info'](_0x0d8f('0x23'),_0x4dbee1,_0x0d8f('0x24'));logger['debug'](_0x0d8f('0x25'),_0x4dbee1,'request\x20sent',JSON[_0x0d8f('0x26')](_0x41bd84));if(_0x41bd84['error']){if(_0x41bd84[_0x0d8f('0x27')]['code']===0x1f4){logger[_0x0d8f('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x4dbee1,_0x41bd84[_0x0d8f('0x27')][_0x0d8f('0x28')]);return _0x43300a(_0x41bd84[_0x0d8f('0x27')][_0x0d8f('0x28')]);}logger['error'](_0x0d8f('0x23'),_0x4dbee1,_0x41bd84[_0x0d8f('0x27')][_0x0d8f('0x28')]);return _0x6b9b22(_0x41bd84[_0x0d8f('0x27')][_0x0d8f('0x28')]);}else{logger[_0x0d8f('0x29')](_0x0d8f('0x23'),_0x4dbee1,_0x0d8f('0x24'));_0x6b9b22(_0x41bd84[_0x0d8f('0x2a')][_0x0d8f('0x28')]);}})[_0x0d8f('0x2b')](function(_0x19206c){logger[_0x0d8f('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x4dbee1,_0x19206c);_0x43300a(_0x19206c);});});}function respondWithStatusCode(_0xdfed3d,_0x10d0ea){_0x10d0ea=_0x10d0ea||0xcc;return function(_0x401c3e){if(_0x401c3e){return _0xdfed3d[_0x0d8f('0x2c')](_0x10d0ea);}return _0xdfed3d[_0x0d8f('0x2d')](_0x10d0ea)[_0x0d8f('0x2e')]();};}function respondWithResult(_0x332b58,_0x6478b){_0x6478b=_0x6478b||0xc8;return function(_0x248f91){if(_0x248f91){return _0x332b58['status'](_0x6478b)[_0x0d8f('0x2f')](_0x248f91);}};}function respondWithFilteredResult(_0x213a01,_0x122bc5){return function(_0x22f484){if(_0x22f484){var _0x1c21e4=typeof _0x122bc5[_0x0d8f('0x30')]===_0x0d8f('0x31')&&typeof _0x122bc5[_0x0d8f('0x32')]===_0x0d8f('0x31');var _0x26ad43=_0x22f484['count'];var _0xa294b=_0x1c21e4?0x0:_0x122bc5['offset'];var _0x225219=_0x1c21e4?_0x22f484[_0x0d8f('0x33')]:_0x122bc5['offset']+_0x122bc5[_0x0d8f('0x32')];var _0x547bf8;if(_0x225219>=_0x26ad43){_0x225219=_0x26ad43;_0x547bf8=0xc8;}else{_0x547bf8=0xce;}_0x213a01[_0x0d8f('0x2d')](_0x547bf8);return _0x213a01[_0x0d8f('0x34')](_0x0d8f('0x35'),_0xa294b+'-'+_0x225219+'/'+_0x26ad43)[_0x0d8f('0x2f')](_0x22f484);}return null;};}function patchUpdates(_0x4fc0cc){return function(_0x618d20){try{jsonpatch[_0x0d8f('0x36')](_0x618d20,_0x4fc0cc,!![]);}catch(_0x2b43fe){return BPromise[_0x0d8f('0x37')](_0x2b43fe);}return _0x618d20[_0x0d8f('0x38')]();};}function saveUpdates(_0x418fcb,_0x37e109){return function(_0x54c3aa){if(_0x54c3aa){return _0x54c3aa[_0x0d8f('0x39')](_0x418fcb)['then'](function(_0x1f6f60){return _0x1f6f60;});}return null;};}function removeEntity(_0x15609b,_0x2a9bc4){return function(_0x290a3b){if(_0x290a3b){return _0x290a3b[_0x0d8f('0x3a')]()[_0x0d8f('0x22')](function(){var _0x5156a7=_0x290a3b[_0x0d8f('0x3b')]({'plain':!![]});var _0xf08031=_0x0d8f('0x3c');return db[_0x0d8f('0x3d')][_0x0d8f('0x3a')]({'where':{'type':_0xf08031,'resourceId':_0x5156a7['id']}})[_0x0d8f('0x22')](function(){return _0x290a3b;});})[_0x0d8f('0x22')](function(){_0x15609b[_0x0d8f('0x2d')](0xcc)[_0x0d8f('0x2e')]();});}};}function handleEntityNotFound(_0x49b609,_0x28038b){return function(_0x1f03c0){if(!_0x1f03c0){_0x49b609[_0x0d8f('0x2c')](0x194);}return _0x1f03c0;};}function handleError(_0x3dd106,_0x3becb5){_0x3becb5=_0x3becb5||0x1f4;return function(_0x5703fa){logger[_0x0d8f('0x27')](_0x5703fa['stack']);if(_0x5703fa[_0x0d8f('0x3e')]){delete _0x5703fa[_0x0d8f('0x3e')];}_0x3dd106[_0x0d8f('0x2d')](_0x3becb5)[_0x0d8f('0x3f')](_0x5703fa);};}exports[_0x0d8f('0x40')]=function(_0x2414e9,_0x538fe8){var _0x4a7258={'include':[{'model':db[_0x0d8f('0x41')],'as':'mandatoryDispositionPause'}]},_0x29da6c={},_0x279d12={'count':0x0,'rows':[]};var _0x454441=_['map'](db[_0x0d8f('0x42')]['rawAttributes'],function(_0x4b565e){return{'name':_0x4b565e['fieldName'],'type':_0x4b565e[_0x0d8f('0x43')][_0x0d8f('0x44')]};});_0x29da6c[_0x0d8f('0x45')]=_[_0x0d8f('0x46')](_0x454441,_0x0d8f('0x3e'));_0x29da6c['query']=_['keys'](_0x2414e9['query']);_0x29da6c['filters']=_[_0x0d8f('0x47')](_0x29da6c[_0x0d8f('0x45')],_0x29da6c[_0x0d8f('0x48')]);_0x4a7258['attributes']=_['intersection'](_0x29da6c[_0x0d8f('0x45')],qs[_0x0d8f('0x49')](_0x2414e9[_0x0d8f('0x48')]['fields']));_0x4a7258['attributes']=_0x4a7258[_0x0d8f('0x4a')][_0x0d8f('0x4b')]?_0x4a7258['attributes']:_0x29da6c[_0x0d8f('0x45')];if(!_0x2414e9[_0x0d8f('0x48')][_0x0d8f('0x4c')](_0x0d8f('0x4d'))){_0x4a7258[_0x0d8f('0x32')]=qs[_0x0d8f('0x32')](_0x2414e9[_0x0d8f('0x48')][_0x0d8f('0x32')]);_0x4a7258[_0x0d8f('0x30')]=qs[_0x0d8f('0x30')](_0x2414e9['query'][_0x0d8f('0x30')]);}_0x4a7258[_0x0d8f('0x4e')]=qs[_0x0d8f('0x4f')](_0x2414e9[_0x0d8f('0x48')][_0x0d8f('0x4f')]);_0x4a7258[_0x0d8f('0x50')]=qs[_0x0d8f('0x51')](_['pick'](_0x2414e9[_0x0d8f('0x48')],_0x29da6c[_0x0d8f('0x51')]),_0x454441);if(_0x2414e9[_0x0d8f('0x48')][_0x0d8f('0x52')]){_0x4a7258[_0x0d8f('0x50')]=_[_0x0d8f('0x53')](_0x4a7258[_0x0d8f('0x50')],{'$or':_['map'](_0x454441,function(_0x3e4b00){if(_0x3e4b00['type']!==_0x0d8f('0x54')){var _0x16acb3={};_0x16acb3[_0x3e4b00['name']]={'$like':'%'+_0x2414e9[_0x0d8f('0x48')][_0x0d8f('0x52')]+'%'};return _0x16acb3;}})});}_0x4a7258=_['merge']({},_0x4a7258,_0x2414e9['options']);var _0x92e4e0={'where':_0x4a7258['where']};return db[_0x0d8f('0x42')][_0x0d8f('0x33')](_0x92e4e0)['then'](function(_0x1c218d){_0x279d12[_0x0d8f('0x33')]=_0x1c218d;if(_0x2414e9['query']['includeAll']){_0x4a7258['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x0d8f('0x55')](_0x4a7258);})[_0x0d8f('0x22')](function(_0x2d7be1){_0x279d12[_0x0d8f('0x56')]=_0x2d7be1;return _0x279d12;})['then'](respondWithFilteredResult(_0x538fe8,_0x4a7258))['catch'](handleError(_0x538fe8,null));};exports[_0x0d8f('0x57')]=function(_0x4fa8d7,_0x238e4e){var _0x210cfd={'raw':![],'where':{'id':_0x4fa8d7[_0x0d8f('0x58')]['id']},'include':[{'model':db[_0x0d8f('0x41')],'as':_0x0d8f('0x59')}]},_0x1c776e={};_0x1c776e['model']=_[_0x0d8f('0x5a')](db[_0x0d8f('0x42')]['rawAttributes']);_0x1c776e[_0x0d8f('0x48')]=_[_0x0d8f('0x5a')](_0x4fa8d7[_0x0d8f('0x48')]);_0x1c776e['filters']=_[_0x0d8f('0x47')](_0x1c776e[_0x0d8f('0x45')],_0x1c776e[_0x0d8f('0x48')]);_0x210cfd['attributes']=_['intersection'](_0x1c776e['model'],qs[_0x0d8f('0x49')](_0x4fa8d7['query'][_0x0d8f('0x49')]));_0x210cfd[_0x0d8f('0x4a')]=_0x210cfd[_0x0d8f('0x4a')][_0x0d8f('0x4b')]?_0x210cfd[_0x0d8f('0x4a')]:_0x1c776e[_0x0d8f('0x45')];if(_0x4fa8d7[_0x0d8f('0x48')][_0x0d8f('0x5b')]){_0x210cfd[_0x0d8f('0x5c')]=[{'all':!![]}];}_0x210cfd=_[_0x0d8f('0x53')]({},_0x210cfd,_0x4fa8d7[_0x0d8f('0x5d')]);return db[_0x0d8f('0x42')][_0x0d8f('0x5e')](_0x210cfd)[_0x0d8f('0x22')](handleEntityNotFound(_0x238e4e,null))[_0x0d8f('0x22')](respondWithResult(_0x238e4e,null))[_0x0d8f('0x2b')](handleError(_0x238e4e,null));};exports[_0x0d8f('0x5f')]=function(_0x3e8e0e,_0x33c49d){return db['OpenchannelAccount'][_0x0d8f('0x5f')](_0x3e8e0e[_0x0d8f('0x60')],{})['then'](function(_0x5133bc){var _0x36c496=_0x3e8e0e[_0x0d8f('0x61')]['get']({'plain':!![]});if(!_0x36c496)throw new Error(_0x0d8f('0x62'));if(_0x36c496['role']==='user'){var _0x18c377=_0x5133bc['get']({'plain':!![]});var _0x1ce7dd=_0x0d8f('0x3c');return db[_0x0d8f('0x63')][_0x0d8f('0x5e')]({'where':{'name':_0x1ce7dd,'userProfileId':_0x36c496['userProfileId']},'raw':!![]})[_0x0d8f('0x22')](function(_0x7b8844){if(_0x7b8844&&_0x7b8844[_0x0d8f('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x18c377[_0x0d8f('0x3e')],'resourceId':_0x18c377['id'],'type':_0x7b8844['name'],'sectionId':_0x7b8844['id']},{})['then'](function(){return _0x5133bc;});}else{return _0x5133bc;}})['catch'](function(_0x5df457){logger[_0x0d8f('0x27')](_0x0d8f('0x65'),_0x5df457);throw _0x5df457;});}return _0x5133bc;})[_0x0d8f('0x22')](respondWithResult(_0x33c49d,0xc9))[_0x0d8f('0x2b')](handleError(_0x33c49d,null));};exports[_0x0d8f('0x39')]=function(_0x3cac6e,_0x5e7055){if(_0x3cac6e[_0x0d8f('0x60')]['id']){delete _0x3cac6e[_0x0d8f('0x60')]['id'];}return db['OpenchannelAccount'][_0x0d8f('0x5e')]({'where':{'id':_0x3cac6e['params']['id']},'include':[{'model':db[_0x0d8f('0x41')],'as':_0x0d8f('0x59')}]})[_0x0d8f('0x22')](handleEntityNotFound(_0x5e7055,null))['then'](saveUpdates(_0x3cac6e[_0x0d8f('0x60')],null))[_0x0d8f('0x22')](respondWithResult(_0x5e7055,null))[_0x0d8f('0x2b')](handleError(_0x5e7055,null));};exports[_0x0d8f('0x3a')]=function(_0x3a14bb,_0xb7b59c){return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x3a14bb[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0xb7b59c,null))[_0x0d8f('0x22')](removeEntity(_0xb7b59c,null))[_0x0d8f('0x2b')](handleError(_0xb7b59c,null));};exports['describe']=function(_0x5d6370,_0x2dace2){return db['OpenchannelAccount'][_0x0d8f('0x66')]()[_0x0d8f('0x22')](respondWithResult(_0x2dace2,null))[_0x0d8f('0x2b')](handleError(_0x2dace2,null));};exports['addDisposition']=function(_0x334d0b,_0x535dd9,_0x16fc97){if(_0x334d0b['body']['id']){delete _0x334d0b['body']['id'];}return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x334d0b[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x535dd9,null))['then'](function(_0x44b2e3){if(_0x44b2e3){_0x334d0b[_0x0d8f('0x60')][_0x0d8f('0x67')]=_0x44b2e3['id'];return db[_0x0d8f('0x68')][_0x0d8f('0x5f')](_0x334d0b[_0x0d8f('0x60')]);}})['then'](respondWithResult(_0x535dd9,null))[_0x0d8f('0x2b')](handleError(_0x535dd9,null));};exports[_0x0d8f('0x69')]=function(_0x2634df,_0x253da8,_0x11d6c6){var _0x554c04={'raw':![],'where':{}};var _0x2068dc={};var _0x1939e3={'count':0x0,'rows':[]};return db[_0x0d8f('0x42')][_0x0d8f('0x6a')]({'where':{'id':_0x2634df[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x253da8,null))[_0x0d8f('0x22')](function(_0x55947d){if(_0x55947d){_0x2068dc[_0x0d8f('0x45')]=_[_0x0d8f('0x5a')](db[_0x0d8f('0x68')][_0x0d8f('0x6b')]);_0x2068dc[_0x0d8f('0x48')]=_[_0x0d8f('0x5a')](_0x2634df[_0x0d8f('0x48')]);_0x2068dc['filters']=_[_0x0d8f('0x47')](_0x2068dc[_0x0d8f('0x45')],_0x2068dc['query']);_0x554c04[_0x0d8f('0x4a')]=_['intersection'](_0x2068dc[_0x0d8f('0x45')],qs[_0x0d8f('0x49')](_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x49')]));_0x554c04[_0x0d8f('0x4a')]=_0x554c04[_0x0d8f('0x4a')]['length']?_0x554c04['attributes']:_0x2068dc['model'];if(!_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x4c')](_0x0d8f('0x4d'))){_0x554c04[_0x0d8f('0x32')]=qs[_0x0d8f('0x32')](_0x2634df[_0x0d8f('0x48')]['limit']);_0x554c04[_0x0d8f('0x30')]=qs['offset'](_0x2634df[_0x0d8f('0x48')]['offset']);}_0x554c04[_0x0d8f('0x4e')]=qs['sort'](_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x4f')]);_0x554c04[_0x0d8f('0x50')]=qs['filters'](_[_0x0d8f('0x6c')](_0x2634df['query'],_0x2068dc[_0x0d8f('0x51')]));_0x554c04[_0x0d8f('0x50')][_0x0d8f('0x67')]=_0x55947d['id'];if(_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x52')]){_0x554c04[_0x0d8f('0x50')]=_['merge'](_0x554c04['where'],{'$or':_[_0x0d8f('0x46')](_0x554c04['attributes'],function(_0x1e613b){var _0x418595={};_0x418595[_0x1e613b]={'$like':'%'+_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x52')]+'%'};return _0x418595;})});}_0x554c04=_['merge']({},_0x554c04,_0x2634df[_0x0d8f('0x5d')]);return db['Disposition'][_0x0d8f('0x33')]({'where':_0x554c04[_0x0d8f('0x50')]})[_0x0d8f('0x22')](function(_0xd9cbb1){_0x1939e3[_0x0d8f('0x33')]=_0xd9cbb1;if(_0x2634df[_0x0d8f('0x48')][_0x0d8f('0x5b')]){_0x554c04[_0x0d8f('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x0d8f('0x55')](_0x554c04);})[_0x0d8f('0x22')](function(_0x4781c8){_0x1939e3['rows']=_0x4781c8;return _0x1939e3;});}})[_0x0d8f('0x22')](respondWithFilteredResult(_0x253da8,_0x554c04))[_0x0d8f('0x2b')](handleError(_0x253da8,null));};exports[_0x0d8f('0x6d')]=function(_0x86e18a,_0x4bd4af,_0x1007a3){return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x86e18a[_0x0d8f('0x58')]['id']}})['then'](handleEntityNotFound(_0x4bd4af,null))[_0x0d8f('0x22')](function(_0x1d6d0d){if(_0x1d6d0d){return _0x1d6d0d[_0x0d8f('0x6d')](_0x86e18a['query'][_0x0d8f('0x6e')]);}})[_0x0d8f('0x22')](respondWithStatusCode(_0x4bd4af,null))['catch'](handleError(_0x4bd4af,null));};exports[_0x0d8f('0x6f')]=function(_0x235e55,_0x4f3bd1,_0xb437f5){if(_0x235e55['body']['id']){delete _0x235e55[_0x0d8f('0x60')]['id'];}return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x235e55['params']['id']}})['then'](handleEntityNotFound(_0x4f3bd1,null))[_0x0d8f('0x22')](function(_0x4da3e6){if(_0x4da3e6){_0x235e55[_0x0d8f('0x60')][_0x0d8f('0x67')]=_0x4da3e6['id'];return db[_0x0d8f('0x70')][_0x0d8f('0x5f')](_0x235e55[_0x0d8f('0x60')]);}})[_0x0d8f('0x22')](respondWithResult(_0x4f3bd1,null))[_0x0d8f('0x2b')](handleError(_0x4f3bd1,null));};exports[_0x0d8f('0x71')]=function(_0x1870f3,_0x441556,_0x38aaeb){var _0x193409={'raw':![],'where':{}};var _0x1e3a66={};var _0x1a7f18={'count':0x0,'rows':[]};return db[_0x0d8f('0x42')][_0x0d8f('0x6a')]({'where':{'id':_0x1870f3[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x441556,null))[_0x0d8f('0x22')](function(_0x43224c){if(_0x43224c){_0x1e3a66[_0x0d8f('0x45')]=_[_0x0d8f('0x5a')](db[_0x0d8f('0x70')]['rawAttributes']);_0x1e3a66[_0x0d8f('0x48')]=_['keys'](_0x1870f3[_0x0d8f('0x48')]);_0x1e3a66[_0x0d8f('0x51')]=_['intersection'](_0x1e3a66[_0x0d8f('0x45')],_0x1e3a66[_0x0d8f('0x48')]);_0x193409[_0x0d8f('0x4a')]=_[_0x0d8f('0x47')](_0x1e3a66[_0x0d8f('0x45')],qs[_0x0d8f('0x49')](_0x1870f3[_0x0d8f('0x48')][_0x0d8f('0x49')]));_0x193409[_0x0d8f('0x4a')]=_0x193409[_0x0d8f('0x4a')][_0x0d8f('0x4b')]?_0x193409['attributes']:_0x1e3a66[_0x0d8f('0x45')];if(!_0x1870f3[_0x0d8f('0x48')]['hasOwnProperty'](_0x0d8f('0x4d'))){_0x193409['limit']=qs['limit'](_0x1870f3[_0x0d8f('0x48')][_0x0d8f('0x32')]);_0x193409['offset']=qs[_0x0d8f('0x30')](_0x1870f3[_0x0d8f('0x48')]['offset']);}_0x193409[_0x0d8f('0x4e')]=qs['sort'](_0x1870f3[_0x0d8f('0x48')][_0x0d8f('0x4f')]);_0x193409[_0x0d8f('0x50')]=qs['filters'](_['pick'](_0x1870f3['query'],_0x1e3a66['filters']));_0x193409[_0x0d8f('0x50')][_0x0d8f('0x67')]=_0x43224c['id'];if(_0x1870f3['query'][_0x0d8f('0x52')]){_0x193409[_0x0d8f('0x50')]=_['merge'](_0x193409[_0x0d8f('0x50')],{'$or':_[_0x0d8f('0x46')](_0x193409['attributes'],function(_0x5e48ee){var _0xa8a6f6={};_0xa8a6f6[_0x5e48ee]={'$like':'%'+_0x1870f3[_0x0d8f('0x48')][_0x0d8f('0x52')]+'%'};return _0xa8a6f6;})});}_0x193409=_[_0x0d8f('0x53')]({},_0x193409,_0x1870f3[_0x0d8f('0x5d')]);return db['CannedAnswer'][_0x0d8f('0x33')]({'where':_0x193409[_0x0d8f('0x50')]})[_0x0d8f('0x22')](function(_0x41135e){_0x1a7f18['count']=_0x41135e;if(_0x1870f3['query'][_0x0d8f('0x5b')]){_0x193409[_0x0d8f('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0d8f('0x55')](_0x193409);})[_0x0d8f('0x22')](function(_0x336928){_0x1a7f18[_0x0d8f('0x56')]=_0x336928;return _0x1a7f18;});}})['then'](respondWithFilteredResult(_0x441556,_0x193409))[_0x0d8f('0x2b')](handleError(_0x441556,null));};exports['removeAnswers']=function(_0x53dee4,_0x87149c,_0x361e21){return db[_0x0d8f('0x42')]['find']({'where':{'id':_0x53dee4[_0x0d8f('0x58')]['id']}})['then'](handleEntityNotFound(_0x87149c,null))[_0x0d8f('0x22')](function(_0x113945){if(_0x113945){return _0x113945['removeAnswers'](_0x53dee4[_0x0d8f('0x48')][_0x0d8f('0x6e')]);}})[_0x0d8f('0x22')](respondWithStatusCode(_0x87149c,null))['catch'](handleError(_0x87149c,null));};exports[_0x0d8f('0x72')]=function(_0x481d25,_0x10a732,_0x313e33){var _0x3680a3={'body':_0x481d25[_0x0d8f('0x60')],'channel':_0x0d8f('0x73')};var _0x1cde19=[];var _0x279a7d=[];var _0x5e577f={};var _0x5e4b8f=![];return db[_0x0d8f('0x74')]['describe']()[_0x0d8f('0x22')](function(_0x5dd4b4){if(!_0x5dd4b4){throw new db[(_0x0d8f('0x75'))][(_0x0d8f('0x76'))](_0x0d8f('0x77'));}_0x1cde19=_[_0x0d8f('0x78')](_[_0x0d8f('0x5a')](_0x5dd4b4),['createdAt','updatedAt']);_0x279a7d=_[_0x0d8f('0x78')](_[_0x0d8f('0x5a')](_0x5dd4b4),['createdAt',_0x0d8f('0x79'),_0x0d8f('0x7a'),_0x0d8f('0x7b')]);if(_0x481d25['body']['id']){delete _0x481d25[_0x0d8f('0x60')]['id'];}if(_[_0x0d8f('0x7c')](_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x7d')])){throw new db[(_0x0d8f('0x75'))]['ValidationError'](_0x0d8f('0x7e'));}if(_[_0x0d8f('0x7c')](_0x481d25[_0x0d8f('0x60')]['body'])||_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x60')]===''){throw new db[(_0x0d8f('0x75'))][(_0x0d8f('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x481d25['body']['mapKey'])){throw new db['Sequelize'][(_0x0d8f('0x76'))](_0x0d8f('0x7f')+_0x279a7d);}if(!_[_0x0d8f('0x80')](_0x279a7d,_0x481d25[_0x0d8f('0x60')]['mapKey'])){throw new db['Sequelize'][(_0x0d8f('0x76'))](_0x0d8f('0x81')+_0x279a7d);}_0x5e577f[_0x481d25[_0x0d8f('0x60')]['mapKey']]=_0x481d25['body'][_0x0d8f('0x7d')];})['then'](function(){return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x481d25['params']['id']},'include':[{'model':db[_0x0d8f('0x82')],'as':_0x0d8f('0x83'),'include':[{'model':db[_0x0d8f('0x74')],'as':_0x0d8f('0x84'),'where':_0x5e577f,'limit':0x1,'order':[[_0x0d8f('0x79'),_0x0d8f('0x85')]]}]},{'model':db[_0x0d8f('0x86')],'as':'Applications'}]});})[_0x0d8f('0x22')](handleEntityNotFound(_0x10a732,null))[_0x0d8f('0x22')](function(_0x2333e5){if(_0x2333e5&&_0x2333e5['List']){_0x3680a3[_0x0d8f('0x87')]=_0x2333e5;_0x3680a3[_0x0d8f('0x88')]=_0x2333e5['Applications'];_0x3680a3[_0x0d8f('0x89')]=_0x2333e5[_0x0d8f('0x83')];_0x3680a3['applications']=_[_0x0d8f('0x8a')](_0x3680a3['applications'],[_0x0d8f('0x8b')],[_0x0d8f('0x8c')]);if(_0x3680a3['account']['Applications']){delete _0x3680a3[_0x0d8f('0x87')][_0x0d8f('0x8d')];}if(_0x3680a3[_0x0d8f('0x87')][_0x0d8f('0x83')]&&_0x3680a3[_0x0d8f('0x87')][_0x0d8f('0x83')][_0x0d8f('0x84')][_0x0d8f('0x4b')]){return _0x3680a3[_0x0d8f('0x87')]['List'][_0x0d8f('0x84')][0x0];}var _0x26b9dc=_[_0x0d8f('0x1b')](_0x481d25[_0x0d8f('0x60')],{'firstName':_0x481d25['body'][_0x0d8f('0x7d')],'ListId':_0x2333e5['ListId']});_0x26b9dc[_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x8e')]]=_0x481d25['body'][_0x0d8f('0x7d')];return db[_0x0d8f('0x74')]['create'](_0x26b9dc,{'fields':_0x1cde19,'raw':!![]});}})[_0x0d8f('0x22')](handleEntityNotFound(_0x10a732,null))['then'](function(_0xa714f9){_0x3680a3[_0x0d8f('0x8f')]=_0xa714f9;if(_0xa714f9){var _0x897e61={'ContactId':_0xa714f9['id'],'OpenchannelAccountId':_0x481d25['params']['id'],'from':(_0xa714f9['firstName']||'')+'\x20'+(_0xa714f9[_0x0d8f('0x90')]||'')};var _0x289561={'OpenchannelAccountId':_0x481d25[_0x0d8f('0x58')]['id'],'closed':![]};if(_0x481d25['body'][_0x0d8f('0x91')]){_0x289561['threadId']=_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x91')];return db[_0x0d8f('0x92')][_0x0d8f('0x5e')]({'where':_0x289561})[_0x0d8f('0x22')](function(_0x1b05be){if(_0x1b05be){return[_0x1b05be,![]];}_0x897e61['threadId']=_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x91')];_0x897e61[_0x0d8f('0x93')]=_0x481d25['body']['externalUrl'];return db['OpenchannelInteraction']['create'](_0x897e61)['then'](function(_0x6b68a8){return[_0x6b68a8,!![]];});});}else{_0x289561[_0x0d8f('0x91')]=null;}_0x289561[_0x0d8f('0x94')]=_0xa714f9['id'];return db[_0x0d8f('0x92')]['find']({'where':_0x289561})[_0x0d8f('0x22')](function(_0x51bc61){if(_0x51bc61){return[_0x51bc61,![]];}return db[_0x0d8f('0x92')][_0x0d8f('0x5f')](_0x897e61)[_0x0d8f('0x22')](function(_0x2d7d4c){return[_0x2d7d4c,!![]];});});}})[_0x0d8f('0x95')](function(_0xeeeb3b,_0x584916){if(_0xeeeb3b){_0x5e4b8f=_0x584916;if(!_0x584916){var _0x496e52={'from':(_0x3680a3['contact']['firstName']||'')+'\x20'+(_0x3680a3[_0x0d8f('0x8f')][_0x0d8f('0x90')]||'')};if(_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x91')]&&_0x481d25[_0x0d8f('0x60')]['messageId']&&_0x481d25[_0x0d8f('0x60')]['threadId']!=_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x96')]){_0x496e52[_0x0d8f('0x91')]=_0x481d25[_0x0d8f('0x60')]['messageId'];}return _0xeeeb3b[_0x0d8f('0x39')](_0x496e52);}else{return _0xeeeb3b;}}})[_0x0d8f('0x22')](function(_0x4783f1){_0x3680a3[_0x0d8f('0x97')]=_0x4783f1[_0x0d8f('0x3b')]({'plain':!![]});_0x3680a3[_0x0d8f('0x97')]['created']=_0x5e4b8f;if(_0x3680a3[_0x0d8f('0x97')][_0x0d8f('0x98')]){if(_0x3680a3[_0x0d8f('0x87')][_0x0d8f('0x99')]){_0x3680a3[_0x0d8f('0x88')][_0x0d8f('0x9a')]({'id':0x0,'priority':_0x3680a3[_0x0d8f('0x88')][_0x0d8f('0x4b')]+0x1,'app':_0x0d8f('0x9b'),'appdata':_0x0d8f('0x9c'),'interval':_0x0d8f('0x9d')});}}return db[_0x0d8f('0x9e')][_0x0d8f('0x5f')]({'body':_0x481d25[_0x0d8f('0x60')][_0x0d8f('0x60')],'OpenchannelAccountId':_0x481d25[_0x0d8f('0x58')]['id'],'OpenchannelInteractionId':_0x4783f1['id'],'direction':'in','ContactId':_0x3680a3[_0x0d8f('0x8f')]['id'],'AttachmentId':_0x481d25[_0x0d8f('0x60')]['AttachmentId']});})['then'](function(_0x390809){_0x3680a3[_0x0d8f('0x28')]=_0x390809;if(_0x3680a3[_0x0d8f('0x97')][_0x0d8f('0x9f')]){return db[_0x0d8f('0xa0')]['find']({'attributes':['id','name'],'where':{'id':_0x3680a3['interaction']['UserId']}})[_0x0d8f('0x22')](function(_0x3b52ce){if(_0x3b52ce){_0x3680a3[_0x0d8f('0x88')][_0x0d8f('0xa1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3b52ce[_0x0d8f('0x3e')]+','+(_0x3680a3[_0x0d8f('0x87')][_0x0d8f('0xa2')]||0xa),'interval':_0x0d8f('0x9d')});_0x3680a3[_0x0d8f('0xa3')]=![];}return respondWithRpcPromise('Start',_0x0d8f('0xa4'),_0x3680a3);});}return respondWithRpcPromise(_0x0d8f('0xa5'),'startRouting',_0x3680a3);})['then'](function(_0x5e7060){respondWithRpcPromise('EventManager',_0x0d8f('0xa6'),{'event':_0x0d8f('0x72'),'message':_0x5e7060},client9002);return _0x5e7060;})['then'](respondWithResult(_0x10a732,null))[_0x0d8f('0x2b')](handleError(_0x10a732,null));};exports['addApplications']=function(_0x33832e,_0x1659d2,_0x1558cd){return db[_0x0d8f('0x42')][_0x0d8f('0x6a')]({'where':{'id':_0x33832e['params']['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x1659d2,null))[_0x0d8f('0x22')](function(_0x1f2bac){if(_0x1f2bac){return db['sequelize'][_0x0d8f('0xa7')](function(_0x4bdb81){return db['OpenchannelApplication'][_0x0d8f('0x3a')]({'where':{'OpenchannelAccountId':_0x33832e[_0x0d8f('0x58')]['id']},'transaction':_0x4bdb81})[_0x0d8f('0x22')](function(_0x4b2cb4){var _0x4f2c40=_[_0x0d8f('0x46')](_0x33832e[_0x0d8f('0x60')],function(_0x2ecbb0){_0x2ecbb0[_0x0d8f('0x67')]=_0x33832e[_0x0d8f('0x58')]['id'];return _0x2ecbb0;});return db['OpenchannelApplication'][_0x0d8f('0xa8')](_0x4f2c40,{'transaction':_0x4bdb81});});})[_0x0d8f('0x22')](function(){return db[_0x0d8f('0x86')][_0x0d8f('0xa9')]({'where':{'OpenchannelAccountId':_0x33832e['params']['id']},'order':_0x0d8f('0x8b')});});}})[_0x0d8f('0x22')](respondWithResult(_0x1659d2,null))[_0x0d8f('0x2b')](handleError(_0x1659d2,null));};exports[_0x0d8f('0xaa')]=function(_0x2999f0,_0x1bece5,_0x5b9ca9){var _0x5405b1={};var _0x4666b7={};var _0x44c2a2;var _0x549c9b;return db['OpenchannelAccount'][_0x0d8f('0x6a')]({'where':{'id':_0x2999f0[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x1bece5,null))['then'](function(_0xffad3c){if(_0xffad3c){_0x44c2a2=_0xffad3c;_0x4666b7['model']=_[_0x0d8f('0x5a')](db[_0x0d8f('0x86')]['rawAttributes']);_0x4666b7[_0x0d8f('0x48')]=_[_0x0d8f('0x5a')](_0x2999f0[_0x0d8f('0x48')]);_0x4666b7[_0x0d8f('0x51')]=_[_0x0d8f('0x47')](_0x4666b7['model'],_0x4666b7[_0x0d8f('0x48')]);_0x5405b1['attributes']=_[_0x0d8f('0x47')](_0x4666b7['model'],qs['fields'](_0x2999f0[_0x0d8f('0x48')][_0x0d8f('0x49')]));_0x5405b1['attributes']=_0x5405b1[_0x0d8f('0x4a')][_0x0d8f('0x4b')]?_0x5405b1[_0x0d8f('0x4a')]:_0x4666b7[_0x0d8f('0x45')];_0x5405b1['order']=qs[_0x0d8f('0x4f')](_0x2999f0['query'][_0x0d8f('0x4f')]);_0x5405b1['where']=qs['filters'](_['pick'](_0x2999f0['query'],_0x4666b7[_0x0d8f('0x51')]));if(_0x2999f0[_0x0d8f('0x48')]['filter']){_0x5405b1[_0x0d8f('0x50')]=_[_0x0d8f('0x53')](_0x5405b1['where'],{'$or':_[_0x0d8f('0x46')](_0x5405b1[_0x0d8f('0x4a')],function(_0x18c3a5){var _0x51518e={};_0x51518e[_0x18c3a5]={'$like':'%'+_0x2999f0['query'][_0x0d8f('0x52')]+'%'};return _0x51518e;})});}_0x5405b1=_['merge']({},_0x5405b1,_0x2999f0[_0x0d8f('0x5d')]);return _0x44c2a2[_0x0d8f('0xaa')](_0x5405b1);}})[_0x0d8f('0x22')](function(_0x1a396e){if(_0x1a396e){_0x549c9b=_0x1a396e[_0x0d8f('0x4b')];if(!_0x2999f0['query']['hasOwnProperty']('nolimit')){_0x5405b1[_0x0d8f('0x32')]=qs[_0x0d8f('0x32')](_0x2999f0['query'][_0x0d8f('0x32')]);_0x5405b1[_0x0d8f('0x30')]=qs[_0x0d8f('0x30')](_0x2999f0[_0x0d8f('0x48')]['offset']);}return _0x44c2a2[_0x0d8f('0xaa')](_0x5405b1);}})[_0x0d8f('0x22')](function(_0x5bfcb7){if(_0x5bfcb7){return _0x5bfcb7?{'count':_0x549c9b,'rows':_0x5bfcb7}:null;}})['then'](respondWithResult(_0x1bece5,null))[_0x0d8f('0x2b')](handleError(_0x1bece5,null));};exports['getInteractions']=function(_0x48fa40,_0x3b1826,_0x1d5f9d){var _0x1a0ada={'raw':![],'where':{}};var _0x41e339={};var _0x5a860b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0d8f('0x6a')]({'where':{'id':_0x48fa40[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x3b1826,null))[_0x0d8f('0x22')](function(_0x4092c0){if(_0x4092c0){_0x41e339['model']=_[_0x0d8f('0x5a')](db[_0x0d8f('0x92')][_0x0d8f('0x6b')]);_0x41e339[_0x0d8f('0x48')]=_[_0x0d8f('0x5a')](_0x48fa40[_0x0d8f('0x48')]);_0x41e339[_0x0d8f('0x51')]=_[_0x0d8f('0x47')](_0x41e339[_0x0d8f('0x45')],_0x41e339[_0x0d8f('0x48')]);_0x1a0ada[_0x0d8f('0x4a')]=_[_0x0d8f('0x47')](_0x41e339[_0x0d8f('0x45')],qs[_0x0d8f('0x49')](_0x48fa40['query'][_0x0d8f('0x49')]));_0x1a0ada[_0x0d8f('0x4a')]=_0x1a0ada[_0x0d8f('0x4a')]['length']?_0x1a0ada['attributes']:_0x41e339[_0x0d8f('0x45')];if(!_0x48fa40[_0x0d8f('0x48')][_0x0d8f('0x4c')]('nolimit')){_0x1a0ada[_0x0d8f('0x32')]=qs[_0x0d8f('0x32')](_0x48fa40[_0x0d8f('0x48')][_0x0d8f('0x32')]);_0x1a0ada['offset']=qs[_0x0d8f('0x30')](_0x48fa40[_0x0d8f('0x48')][_0x0d8f('0x30')]);}_0x1a0ada[_0x0d8f('0x4e')]=qs[_0x0d8f('0x4f')](_0x48fa40[_0x0d8f('0x48')]['sort']);_0x1a0ada[_0x0d8f('0x50')]=qs['filters'](_[_0x0d8f('0x6c')](_0x48fa40[_0x0d8f('0x48')],_0x41e339[_0x0d8f('0x51')]));_0x1a0ada[_0x0d8f('0x50')]['OpenchannelAccountId']=_0x4092c0['id'];if(_0x48fa40[_0x0d8f('0x48')]['filter']){_0x1a0ada[_0x0d8f('0x50')]=_[_0x0d8f('0x53')](_0x1a0ada[_0x0d8f('0x50')],{'$or':_[_0x0d8f('0x46')](_0x1a0ada[_0x0d8f('0x4a')],function(_0x22cb49){var _0x596cde={};_0x596cde[_0x22cb49]={'$like':'%'+_0x48fa40['query'][_0x0d8f('0x52')]+'%'};return _0x596cde;})});}_0x1a0ada=_[_0x0d8f('0x53')]({},_0x1a0ada,_0x48fa40[_0x0d8f('0x5d')]);return db[_0x0d8f('0x92')]['count']({'where':_0x1a0ada[_0x0d8f('0x50')]})[_0x0d8f('0x22')](function(_0x5ed580){_0x5a860b[_0x0d8f('0x33')]=_0x5ed580;if(_0x48fa40[_0x0d8f('0x48')]['includeAll']){_0x1a0ada[_0x0d8f('0x5c')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x0d8f('0xab'),'attributes':[_0x0d8f('0x3e'),_0x0d8f('0xac'),_0x0d8f('0xad')],'required':![]},{'model':db[_0x0d8f('0xae')],'as':_0x0d8f('0xaf'),'attributes':['id',_0x0d8f('0x3e'),_0x0d8f('0xb0')],'where':_0x48fa40[_0x0d8f('0x48')][_0x0d8f('0xb1')]?{'id':_0x48fa40[_0x0d8f('0x48')][_0x0d8f('0xb1')]}:undefined,'required':_0x48fa40[_0x0d8f('0x48')]['tag']?!![]:![]}];}return db[_0x0d8f('0x92')][_0x0d8f('0x55')](_0x1a0ada);})[_0x0d8f('0x22')](function(_0x32974e){_0x5a860b[_0x0d8f('0x56')]=_0x32974e;return _0x5a860b;});}})[_0x0d8f('0x22')](respondWithFilteredResult(_0x3b1826,_0x1a0ada))['catch'](handleError(_0x3b1826,null));};exports[_0x0d8f('0xb2')]=function(_0x190840,_0x20d025,_0x251b99){return db['OpenchannelAccount'][_0x0d8f('0x5e')]({'where':{'id':_0x190840[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x20d025,null))['then'](function(_0x4d2910){if(_0x4d2910){return _0x4d2910[_0x0d8f('0xb2')](_0x190840[_0x0d8f('0x60')][_0x0d8f('0x6e')],_[_0x0d8f('0xb3')](_0x190840[_0x0d8f('0x60')],[_0x0d8f('0x6e'),'id'])||{})['spread'](function(_0x3b3358){for(var _0x35396e=0x0;_0x35396e<_0x190840[_0x0d8f('0x60')][_0x0d8f('0x6e')][_0x0d8f('0x4b')];_0x35396e+=0x1){socket[_0x0d8f('0xb4')]('userOpenchannelAccount:save',{'UserId':Number(_0x190840[_0x0d8f('0x60')]['ids'][_0x35396e]),'OpenchannelAccountId':Number(_0x190840['params']['id'])});}return _0x3b3358;});}})[_0x0d8f('0x22')](respondWithResult(_0x20d025,null))[_0x0d8f('0x2b')](handleError(_0x20d025,null));};exports[_0x0d8f('0xb5')]=function(_0x19a6f8,_0x1dce40,_0x317251){return db[_0x0d8f('0x42')][_0x0d8f('0x5e')]({'where':{'id':_0x19a6f8[_0x0d8f('0x58')]['id']}})['then'](handleEntityNotFound(_0x1dce40,null))[_0x0d8f('0x22')](function(_0x522375){if(_0x522375){return _0x522375[_0x0d8f('0xb5')](_0x19a6f8[_0x0d8f('0x48')]['ids'])[_0x0d8f('0x22')](function(){if(_[_0x0d8f('0xb6')](_0x19a6f8[_0x0d8f('0x48')]['ids'])){for(var _0x3789fe=0x0;_0x3789fe<_0x19a6f8[_0x0d8f('0x48')]['ids'][_0x0d8f('0x4b')];_0x3789fe+=0x1){socket[_0x0d8f('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x19a6f8[_0x0d8f('0x48')][_0x0d8f('0x6e')][_0x3789fe]),'OpenchannelAccountId':Number(_0x19a6f8[_0x0d8f('0x58')]['id'])});}}else{socket[_0x0d8f('0xb4')](_0x0d8f('0xb7'),{'UserId':Number(_0x19a6f8[_0x0d8f('0x48')][_0x0d8f('0x6e')]),'OpenchannelAccountId':Number(_0x19a6f8['params']['id'])});}});}})[_0x0d8f('0x22')](respondWithStatusCode(_0x1dce40,null))[_0x0d8f('0x2b')](handleError(_0x1dce40,null));};exports['getAgents']=function(_0x2caa28,_0x31e181,_0x560530){var _0x20a6a4={};var _0x37af16={};var _0x5acd10;var _0x47a3c2;return db[_0x0d8f('0x42')][_0x0d8f('0x6a')]({'where':{'id':_0x2caa28[_0x0d8f('0x58')]['id']}})[_0x0d8f('0x22')](handleEntityNotFound(_0x31e181,null))[_0x0d8f('0x22')](function(_0x417430){if(_0x417430){_0x5acd10=_0x417430;_0x37af16[_0x0d8f('0x45')]=_['keys'](db['User'][_0x0d8f('0x6b')]);_0x37af16[_0x0d8f('0x48')]=_[_0x0d8f('0x5a')](_0x2caa28[_0x0d8f('0x48')]);_0x37af16[_0x0d8f('0x51')]=_[_0x0d8f('0x47')](_0x37af16[_0x0d8f('0x45')],_0x37af16[_0x0d8f('0x48')]);_0x20a6a4[_0x0d8f('0x4a')]=_[_0x0d8f('0x47')](_0x37af16[_0x0d8f('0x45')],qs['fields'](_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x49')]));_0x20a6a4[_0x0d8f('0x4a')]=_0x20a6a4[_0x0d8f('0x4a')][_0x0d8f('0x4b')]?_0x20a6a4[_0x0d8f('0x4a')]:_0x37af16[_0x0d8f('0x45')];_0x20a6a4[_0x0d8f('0x4e')]=qs[_0x0d8f('0x4f')](_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x4f')]);_0x20a6a4['where']=qs[_0x0d8f('0x51')](_['pick'](_0x2caa28[_0x0d8f('0x48')],_0x37af16[_0x0d8f('0x51')]));if(_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x52')]){_0x20a6a4[_0x0d8f('0x50')]=_['merge'](_0x20a6a4[_0x0d8f('0x50')],{'$or':_[_0x0d8f('0x46')](_0x20a6a4[_0x0d8f('0x4a')],function(_0x3299a3){var _0x41b2e8={};_0x41b2e8[_0x3299a3]={'$like':'%'+_0x2caa28['query'][_0x0d8f('0x52')]+'%'};return _0x41b2e8;})});}_0x20a6a4=_[_0x0d8f('0x53')]({},_0x20a6a4,_0x2caa28[_0x0d8f('0x5d')]);return _0x5acd10['getAgents'](_0x20a6a4);}})['then'](function(_0xc8dc2f){if(_0xc8dc2f){_0x47a3c2=_0xc8dc2f[_0x0d8f('0x4b')];if(!_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x4c')](_0x0d8f('0x4d'))){_0x20a6a4['limit']=qs['limit'](_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x32')]);_0x20a6a4['offset']=qs[_0x0d8f('0x30')](_0x2caa28[_0x0d8f('0x48')][_0x0d8f('0x30')]);}return _0x5acd10[_0x0d8f('0xb8')](_0x20a6a4);}})['then'](function(_0x369a9e){if(_0x369a9e){return _0x369a9e?{'count':_0x47a3c2,'rows':_0x369a9e}:null;}})[_0x0d8f('0x22')](respondWithResult(_0x31e181,null))[_0x0d8f('0x2b')](handleError(_0x31e181,null));};exports[_0x0d8f('0x3f')]=function(_0x46be32,_0x742667,_0x5b008e){var _0x1170b3,_0x230401,_0x56d9c8;if(_[_0x0d8f('0x7c')](_0x46be32[_0x0d8f('0x60')]['body'])||_0x46be32['body'][_0x0d8f('0x60')]===''){throw new db['Sequelize']['ValidationError'](_0x0d8f('0xb9'));}if(_['isNil'](_0x46be32[_0x0d8f('0x60')]['to'])){}_0x1170b3=_0x46be32[_0x0d8f('0x60')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x46be32[_0x0d8f('0x58')]['id']}})['then'](handleEntityNotFound(_0x742667,null))[_0x0d8f('0x22')](function(_0x119e33){if(_0x119e33){return db[_0x0d8f('0x42')]['find']({'where':{'id':_0x119e33['id']},'include':[{'model':db[_0x0d8f('0x82')],'as':_0x0d8f('0x83'),'include':[{'model':db[_0x0d8f('0x74')],'as':_0x0d8f('0x84'),'where':{[_0x119e33[_0x0d8f('0x8e')]]:_0x1170b3},'limit':0x1,'order':[[_0x0d8f('0x79'),'DESC']]}]}]})[_0x0d8f('0x22')](handleEntityNotFound(_0x742667,null))[_0x0d8f('0x22')](function(_0x3d198e){if(_0x3d198e&&_0x3d198e[_0x0d8f('0x83')]){_0x230401=_0x3d198e['get']({'plain':!![]});if(_0x230401['List']&&_0x230401[_0x0d8f('0x83')]['Contacts']['length']){return _0x230401[_0x0d8f('0x83')][_0x0d8f('0x84')][0x0];}return db[_0x0d8f('0x74')][_0x0d8f('0x5f')](_[_0x0d8f('0x1b')](_0x46be32['body'],{'firstName':_0x1170b3,[_0x3d198e[_0x0d8f('0x8e')]]:_0x1170b3,'phone':_0x1170b3,'ListId':_0x230401[_0x0d8f('0x7b')]}));}})['then'](handleEntityNotFound(_0x742667,null))[_0x0d8f('0x22')](function(_0x1bc1ec){if(_0x1bc1ec){_0x56d9c8=_0x1bc1ec;return db[_0x0d8f('0x92')][_0x0d8f('0x5e')]({'where':{'ContactId':_0x56d9c8['id'],'closed':![],'OpenchannelAccountId':_0x230401['id']}})['then'](function(_0x232d3b){if(_0x232d3b){return[_0x232d3b,![]];}return db[_0x0d8f('0x92')][_0x0d8f('0x5f')]({'UserId':_0x46be32[_0x0d8f('0x61')]['id'],'ContactId':_0x56d9c8['id'],'OpenchannelAccountId':_0x230401['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x46be32[_0x0d8f('0x60')],{'read':![],'body':_0x46be32['body']['body'],'OpenchannelAccountId':_0x230401['id'],'UserId':_0x46be32[_0x0d8f('0x61')]['id'],'ContactId':_0x56d9c8['id']})]},{'include':[{'model':db[_0x0d8f('0x9e')],'as':_0x0d8f('0xba')}]})[_0x0d8f('0x22')](function(_0x41363b){return[_0x41363b,!![]];});});}})[_0x0d8f('0x95')](function(_0x1d9048,_0x4de229){if(_0x4de229){return _0x1d9048;}return db[_0x0d8f('0x9e')][_0x0d8f('0x5f')](_[_0x0d8f('0x53')](_0x46be32[_0x0d8f('0x60')],{'read':![],'body':_0x46be32[_0x0d8f('0x60')][_0x0d8f('0x60')],'OpenchannelAccountId':_0x230401['id'],'OpenchannelInteractionId':_0x1d9048['id'],'UserId':_0x46be32['user']['id'],'ContactId':_0x56d9c8['id']}))[_0x0d8f('0x22')](function(_0x1d0148){_0x1d9048['dataValues'][_0x0d8f('0xba')]=[];_0x1d9048['dataValues']['Messages'][_0x0d8f('0x9a')](_0x1d0148[_0x0d8f('0xbb')]);return _0x1d9048;});});}})[_0x0d8f('0x22')](respondWithResult(_0x742667,null))['catch'](handleError(_0x742667,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 79024f0..99908f9 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 _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x29bef7,_0x5127f0){var _0x1ba0c1=function(_0x90b156){while(--_0x90b156){_0x29bef7['push'](_0x29bef7['shift']());}};_0x1ba0c1(++_0x5127f0);}(_0xb688,0xcf));var _0x8b68=function(_0x17c3c9,_0x5d70b5){_0x17c3c9=_0x17c3c9-0x0;var _0x2cc030=_0xb688[_0x17c3c9];return _0x2cc030;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','OpenchannelAccount','update','remove'];(function(_0x1dea2d,_0x1b8aa8){var _0x19e652=function(_0x402750){while(--_0x402750){_0x1dea2d['push'](_0x1dea2d['shift']());}};_0x19e652(++_0x1b8aa8);}(_0x70e0,0x17b));var _0x070e=function(_0x16115d,_0x4decdb){_0x16115d=_0x16115d-0x0;var _0x17e34a=_0x70e0[_0x16115d];return _0x17e34a;};'use strict';var EventEmitter=require(_0x070e('0x0'));var OpenchannelAccount=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){OpenchannelAccountEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);OpenchannelAccountEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3b0f408..9781bd5 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(_0x25683c,_0x51a514){var _0x3caced=function(_0x3bafea){while(--_0x3bafea){_0x25683c['push'](_0x25683c['shift']());}};_0x3caced(++_0x51a514);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x1189eb,_0xa46fd5){var _0xef80b7=function(_0x61af7f){while(--_0x61af7f){_0x1189eb['push'](_0x1189eb['shift']());}};_0xef80b7(++_0xa46fd5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index f908d75..cf213ac 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(_0x4144e2,_0x5d726a){var _0x547889=function(_0x45be33){while(--_0x45be33){_0x4144e2['push'](_0x4144e2['shift']());}};_0x547889(++_0x5d726a);}(_0x073e,0x181));var _0xe073=function(_0x228c67,_0x3ef29){_0x228c67=_0x228c67-0x0;var _0x2b7013=_0x073e[_0x228c67];return _0x2b7013;};'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 _0x1be1=['./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter'];(function(_0x126aff,_0x46ce21){var _0x203813=function(_0x658967){while(--_0x658967){_0x126aff['push'](_0x126aff['shift']());}};_0x203813(++_0x46ce21);}(_0x1be1,0x192));var _0x11be=function(_0x43378b,_0x1958df){_0x43378b=_0x43378b-0x0;var _0x11ad8c=_0x1be1[_0x43378b];return _0x11ad8c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});config[_0x11be('0x9')]=_['defaults'](config[_0x11be('0x9')],{'host':_0x11be('0xa'),'port':0x18eb});var socket=require(_0x11be('0xb'))(new Redis(config[_0x11be('0x9')]));require(_0x11be('0xc'))['register'](socket);function respondWithRpcPromise(_0x2bf6db,_0x2754b8,_0x578588){return new BPromise(function(_0x2e4114,_0x2cd786){return client[_0x11be('0xd')](_0x2bf6db,_0x578588)[_0x11be('0xe')](function(_0x4e013c){logger[_0x11be('0xf')](_0x11be('0x10'),_0x2754b8,_0x11be('0x11'));logger['debug'](_0x11be('0x12'),_0x2754b8,_0x11be('0x11'),JSON['stringify'](_0x4e013c));if(_0x4e013c[_0x11be('0x13')]){if(_0x4e013c['error']['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2754b8,_0x4e013c['error']['message']);return _0x2cd786(_0x4e013c['error'][_0x11be('0x14')]);}logger['error'](_0x11be('0x10'),_0x2754b8,_0x4e013c[_0x11be('0x13')][_0x11be('0x14')]);return _0x2e4114(_0x4e013c[_0x11be('0x13')]['message']);}else{logger[_0x11be('0xf')](_0x11be('0x10'),_0x2754b8,'request\x20sent');_0x2e4114(_0x4e013c[_0x11be('0x15')][_0x11be('0x14')]);}})[_0x11be('0x16')](function(_0x4cad80){logger['error'](_0x11be('0x10'),_0x2754b8,_0x4cad80);_0x2cd786(_0x4cad80);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 3b31b73..4090213 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 _0x8696=['openchannelAccount:','./openchannelAccount.events','save','update','emit','register','length'];(function(_0x5391ef,_0x3c8788){var _0x136499=function(_0x4d80a5){while(--_0x4d80a5){_0x5391ef['push'](_0x5391ef['shift']());}};_0x136499(++_0x3c8788);}(_0x8696,0x143));var _0x6869=function(_0xb4babc,_0x2c9070){_0xb4babc=_0xb4babc-0x0;var _0x1e56c0=_0x8696[_0xb4babc];return _0x1e56c0;};'use strict';var OpenchannelAccountEvents=require(_0x6869('0x0'));var events=[_0x6869('0x1'),'remove',_0x6869('0x2')];function createListener(_0x596fbb,_0x3d6bc2){return function(_0x5befa3){_0x3d6bc2[_0x6869('0x3')](_0x596fbb,_0x5befa3);};}function removeListener(_0x4dadb5,_0x46c26d){return function(){OpenchannelAccountEvents['removeListener'](_0x4dadb5,_0x46c26d);};}exports[_0x6869('0x4')]=function(_0x45542c){for(var _0x54d39b=0x0,_0x4c8ad5=events[_0x6869('0x5')];_0x54d39b<_0x4c8ad5;_0x54d39b++){var _0x1e667d=events[_0x54d39b];var _0xa343ab=createListener(_0x6869('0x6')+_0x1e667d,_0x45542c);OpenchannelAccountEvents['on'](_0x1e667d,_0xa343ab);}}; \ No newline at end of file +var _0x65d2=['length','openchannelAccount:','./openchannelAccount.events','save','update','emit','register'];(function(_0x25f8e8,_0x519d8e){var _0x1df02c=function(_0x1bee7b){while(--_0x1bee7b){_0x25f8e8['push'](_0x25f8e8['shift']());}};_0x1df02c(++_0x519d8e);}(_0x65d2,0xb8));var _0x265d=function(_0xb9e60a,_0x1ecf29){_0xb9e60a=_0xb9e60a-0x0;var _0x272cec=_0x65d2[_0xb9e60a];return _0x272cec;};'use strict';var OpenchannelAccountEvents=require(_0x265d('0x0'));var events=[_0x265d('0x1'),'remove',_0x265d('0x2')];function createListener(_0x12fc9b,_0x3a315b){return function(_0x59c81e){_0x3a315b[_0x265d('0x3')](_0x12fc9b,_0x59c81e);};}function removeListener(_0x233dd9,_0x2f91bf){return function(){OpenchannelAccountEvents['removeListener'](_0x233dd9,_0x2f91bf);};}exports[_0x265d('0x4')]=function(_0xd49e24){for(var _0x27dc2d=0x0,_0x1020fa=events[_0x265d('0x5')];_0x27dc2d<_0x1020fa;_0x27dc2d++){var _0x5ca577=events[_0x27dc2d];var _0x36bf91=createListener(_0x265d('0x6')+_0x5ca577,_0xd49e24);OpenchannelAccountEvents['on'](_0x5ca577,_0x36bf91);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c3f2f97..589123f 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 _0xda0b=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','put','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0xda0b,0x1d7));var _0xbda0=function(_0x5b117c,_0x3f933c){_0x5b117c=_0x5b117c-0x0;var _0x7332e6=_0xda0b[_0x5b117c];return _0x7332e6;};'use strict';var multer=require(_0xbda0('0x0'));var util=require('util');var path=require(_0xbda0('0x1'));var timeout=require(_0xbda0('0x2'));var express=require(_0xbda0('0x3'));var router=express['Router']();var fs_extra=require(_0xbda0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbda0('0x5'));var config=require(_0xbda0('0x6'));var controller=require(_0xbda0('0x7'));router[_0xbda0('0x8')]('/',auth[_0xbda0('0x9')](),controller[_0xbda0('0xa')]);router[_0xbda0('0x8')]('/:id',auth[_0xbda0('0x9')](),controller[_0xbda0('0xb')]);router[_0xbda0('0xc')]('/',auth[_0xbda0('0x9')](),controller['create']);router[_0xbda0('0xd')](_0xbda0('0xe'),auth[_0xbda0('0x9')](),controller['update']);router['delete'](_0xbda0('0xe'),auth[_0xbda0('0x9')](),controller[_0xbda0('0xf')]);module[_0xbda0('0x10')]=router; \ No newline at end of file +var _0x93fc=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelApplication.controller','index','/:id','show','post','put','update','isAuthenticated','exports'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x93fc,0x1b0));var _0xc93f=function(_0x29bd3c,_0x4af685){_0x29bd3c=_0x29bd3c-0x0;var _0x902c3b=_0x93fc[_0x29bd3c];return _0x902c3b;};'use strict';var multer=require(_0xc93f('0x0'));var util=require(_0xc93f('0x1'));var path=require(_0xc93f('0x2'));var timeout=require(_0xc93f('0x3'));var express=require(_0xc93f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc93f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc93f('0x6'));var controller=require(_0xc93f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc93f('0x8')]);router['get'](_0xc93f('0x9'),auth['isAuthenticated'](),controller[_0xc93f('0xa')]);router[_0xc93f('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc93f('0xc')](_0xc93f('0x9'),auth['isAuthenticated'](),controller[_0xc93f('0xd')]);router['delete'](_0xc93f('0x9'),auth[_0xc93f('0xe')](),controller['destroy']);module[_0xc93f('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 72af817..fa73e14 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 _0x83ff=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1057e9,_0x550b9b){var _0x21d64d=function(_0x40db69){while(--_0x40db69){_0x1057e9['push'](_0x1057e9['shift']());}};_0x21d64d(++_0x550b9b);}(_0x83ff,0x16a));var _0xf83f=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x83ff[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0xf83f('0x0'));module[_0xf83f('0x1')]={'priority':{'type':Sequelize[_0xf83f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf83f('0x3')],'allowNull':![],'defaultValue':_0xf83f('0x4')},'appdata':{'type':Sequelize[_0xf83f('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf83f('0x3')],'defaultValue':_0xf83f('0x6')}}; \ No newline at end of file +var _0xf37e=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x10499e,_0x56fd86){var _0x3fef98=function(_0x55daeb){while(--_0x55daeb){_0x10499e['push'](_0x10499e['shift']());}};_0x3fef98(++_0x56fd86);}(_0xf37e,0x7e));var _0xef37=function(_0x41e81a,_0x19f817){_0x41e81a=_0x41e81a-0x0;var _0x285dc1=_0xf37e[_0x41e81a];return _0x285dc1;};'use strict';var Sequelize=require(_0xef37('0x0'));module[_0xef37('0x1')]={'priority':{'type':Sequelize[_0xef37('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xef37('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xef37('0x4')]()},'description':{'type':Sequelize[_0xef37('0x3')]},'interval':{'type':Sequelize[_0xef37('0x3')],'defaultValue':_0xef37('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 4ad8db3..fbb88be 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 _0x5b92=['squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../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','save','update','then','end','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','length','includeAll','find','create','body','destroy','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x5b92,0x116));var _0x25b9=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x5b92[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25b9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25b9('0x1'));var rp=require(_0x25b9('0x2'));var moment=require('moment');var BPromise=require(_0x25b9('0x3'));var Mustache=require(_0x25b9('0x4'));var util=require(_0x25b9('0x5'));var path=require(_0x25b9('0x6'));var sox=require(_0x25b9('0x7'));var csv=require('to-csv');var ejs=require(_0x25b9('0x8'));var fs=require('fs');var fs_extra=require(_0x25b9('0x9'));var _=require('lodash');var squel=require(_0x25b9('0xa'));var crypto=require(_0x25b9('0xb'));var jsforce=require(_0x25b9('0xc'));var deskjs=require(_0x25b9('0xd'));var toCsv=require(_0x25b9('0xe'));var querystring=require('querystring');var Papa=require(_0x25b9('0xf'));var Redis=require('ioredis');var authService=require(_0x25b9('0x10'));var qs=require(_0x25b9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25b9('0x12'));var logger=require(_0x25b9('0x13'))('api');var utils=require(_0x25b9('0x14'));var config=require(_0x25b9('0x15'));var licenseUtil=require(_0x25b9('0x16'));var db=require(_0x25b9('0x17'))['db'];function respondWithStatusCode(_0x32bcf5,_0x3476de){_0x3476de=_0x3476de||0xcc;return function(_0x3e8f5c){if(_0x3e8f5c){return _0x32bcf5[_0x25b9('0x18')](_0x3476de);}return _0x32bcf5[_0x25b9('0x19')](_0x3476de)['end']();};}function respondWithResult(_0x4af181,_0x6829ad){_0x6829ad=_0x6829ad||0xc8;return function(_0x5062f9){if(_0x5062f9){return _0x4af181['status'](_0x6829ad)[_0x25b9('0x1a')](_0x5062f9);}};}function respondWithFilteredResult(_0x550b1d,_0x154766){return function(_0x5c0300){if(_0x5c0300){var _0x3a85d2=typeof _0x154766[_0x25b9('0x1b')]===_0x25b9('0x1c')&&typeof _0x154766[_0x25b9('0x1d')]==='undefined';var _0x1f1068=_0x5c0300[_0x25b9('0x1e')];var _0x51ccba=_0x3a85d2?0x0:_0x154766[_0x25b9('0x1b')];var _0x4dbb9b=_0x3a85d2?_0x5c0300[_0x25b9('0x1e')]:_0x154766[_0x25b9('0x1b')]+_0x154766[_0x25b9('0x1d')];var _0x297b26;if(_0x4dbb9b>=_0x1f1068){_0x4dbb9b=_0x1f1068;_0x297b26=0xc8;}else{_0x297b26=0xce;}_0x550b1d['status'](_0x297b26);return _0x550b1d[_0x25b9('0x1f')](_0x25b9('0x20'),_0x51ccba+'-'+_0x4dbb9b+'/'+_0x1f1068)['json'](_0x5c0300);}return null;};}function patchUpdates(_0x46d3ea){return function(_0xfe085c){try{jsonpatch['apply'](_0xfe085c,_0x46d3ea,!![]);}catch(_0x4f9286){return BPromise['reject'](_0x4f9286);}return _0xfe085c[_0x25b9('0x21')]();};}function saveUpdates(_0x1e3edc,_0x1f54d9){return function(_0x368390){if(_0x368390){return _0x368390[_0x25b9('0x22')](_0x1e3edc)[_0x25b9('0x23')](function(_0x5267af){return _0x5267af;});}return null;};}function removeEntity(_0x7d669c,_0x10a59e){return function(_0x5f01d6){if(_0x5f01d6){return _0x5f01d6['destroy']()[_0x25b9('0x23')](function(){_0x7d669c[_0x25b9('0x19')](0xcc)[_0x25b9('0x24')]();});}};}function handleEntityNotFound(_0x3bb864,_0x599009){return function(_0x21118d){if(!_0x21118d){_0x3bb864[_0x25b9('0x18')](0x194);}return _0x21118d;};}function handleError(_0x81e40b,_0x57342f){_0x57342f=_0x57342f||0x1f4;return function(_0x2d87c7){logger['error'](_0x2d87c7[_0x25b9('0x25')]);if(_0x2d87c7[_0x25b9('0x26')]){delete _0x2d87c7['name'];}_0x81e40b[_0x25b9('0x19')](_0x57342f)[_0x25b9('0x27')](_0x2d87c7);};}exports[_0x25b9('0x28')]=function(_0x5b2153,_0x450d2f){var _0x43af5a={},_0x11507f={},_0x100335={'count':0x0,'rows':[]};var _0x501aeb=_[_0x25b9('0x29')](db[_0x25b9('0x2a')][_0x25b9('0x2b')],function(_0x443807){return{'name':_0x443807['fieldName'],'type':_0x443807[_0x25b9('0x2c')]['key']};});_0x11507f['model']=_['map'](_0x501aeb,_0x25b9('0x26'));_0x11507f[_0x25b9('0x2d')]=_[_0x25b9('0x2e')](_0x5b2153[_0x25b9('0x2d')]);_0x11507f[_0x25b9('0x2f')]=_[_0x25b9('0x30')](_0x11507f['model'],_0x11507f[_0x25b9('0x2d')]);_0x43af5a['attributes']=_[_0x25b9('0x30')](_0x11507f[_0x25b9('0x31')],qs[_0x25b9('0x32')](_0x5b2153[_0x25b9('0x2d')][_0x25b9('0x32')]));_0x43af5a[_0x25b9('0x33')]=_0x43af5a[_0x25b9('0x33')]['length']?_0x43af5a['attributes']:_0x11507f[_0x25b9('0x31')];if(!_0x5b2153['query'][_0x25b9('0x34')](_0x25b9('0x35'))){_0x43af5a[_0x25b9('0x1d')]=qs[_0x25b9('0x1d')](_0x5b2153[_0x25b9('0x2d')][_0x25b9('0x1d')]);_0x43af5a[_0x25b9('0x1b')]=qs['offset'](_0x5b2153[_0x25b9('0x2d')][_0x25b9('0x1b')]);}_0x43af5a[_0x25b9('0x36')]=qs[_0x25b9('0x37')](_0x5b2153[_0x25b9('0x2d')]['sort']);_0x43af5a[_0x25b9('0x38')]=qs[_0x25b9('0x2f')](_[_0x25b9('0x39')](_0x5b2153[_0x25b9('0x2d')],_0x11507f[_0x25b9('0x2f')]),_0x501aeb);if(_0x5b2153[_0x25b9('0x2d')][_0x25b9('0x3a')]){_0x43af5a[_0x25b9('0x38')]=_[_0x25b9('0x3b')](_0x43af5a[_0x25b9('0x38')],{'$or':_[_0x25b9('0x29')](_0x501aeb,function(_0x4e6298){if(_0x4e6298[_0x25b9('0x2c')]!==_0x25b9('0x3c')){var _0x52e986={};_0x52e986[_0x4e6298['name']]={'$like':'%'+_0x5b2153[_0x25b9('0x2d')][_0x25b9('0x3a')]+'%'};return _0x52e986;}})});}_0x43af5a=_[_0x25b9('0x3b')]({},_0x43af5a,_0x5b2153[_0x25b9('0x3d')]);var _0xba7a22={'where':_0x43af5a[_0x25b9('0x38')]};return db['OpenchannelApplication'][_0x25b9('0x1e')](_0xba7a22)[_0x25b9('0x23')](function(_0x382d12){_0x100335[_0x25b9('0x1e')]=_0x382d12;if(_0x5b2153[_0x25b9('0x2d')]['includeAll']){_0x43af5a['include']=[{'all':!![]}];}return db[_0x25b9('0x2a')][_0x25b9('0x3e')](_0x43af5a);})[_0x25b9('0x23')](function(_0x1b37d0){_0x100335['rows']=_0x1b37d0;return _0x100335;})[_0x25b9('0x23')](respondWithFilteredResult(_0x450d2f,_0x43af5a))[_0x25b9('0x3f')](handleError(_0x450d2f,null));};exports[_0x25b9('0x40')]=function(_0x298535,_0x4ea82e){var _0x49dff4={'raw':!![],'where':{'id':_0x298535[_0x25b9('0x41')]['id']}},_0x11d445={};_0x11d445['model']=_[_0x25b9('0x2e')](db[_0x25b9('0x2a')]['rawAttributes']);_0x11d445[_0x25b9('0x2d')]=_[_0x25b9('0x2e')](_0x298535[_0x25b9('0x2d')]);_0x11d445[_0x25b9('0x2f')]=_[_0x25b9('0x30')](_0x11d445[_0x25b9('0x31')],_0x11d445['query']);_0x49dff4[_0x25b9('0x33')]=_[_0x25b9('0x30')](_0x11d445[_0x25b9('0x31')],qs[_0x25b9('0x32')](_0x298535[_0x25b9('0x2d')][_0x25b9('0x32')]));_0x49dff4[_0x25b9('0x33')]=_0x49dff4[_0x25b9('0x33')][_0x25b9('0x42')]?_0x49dff4[_0x25b9('0x33')]:_0x11d445[_0x25b9('0x31')];if(_0x298535['query'][_0x25b9('0x43')]){_0x49dff4['include']=[{'all':!![]}];}_0x49dff4=_['merge']({},_0x49dff4,_0x298535[_0x25b9('0x3d')]);return db[_0x25b9('0x2a')][_0x25b9('0x44')](_0x49dff4)[_0x25b9('0x23')](handleEntityNotFound(_0x4ea82e,null))['then'](respondWithResult(_0x4ea82e,null))['catch'](handleError(_0x4ea82e,null));};exports[_0x25b9('0x45')]=function(_0x420819,_0x4cd297){return db[_0x25b9('0x2a')][_0x25b9('0x45')](_0x420819[_0x25b9('0x46')],{})['then'](respondWithResult(_0x4cd297,0xc9))[_0x25b9('0x3f')](handleError(_0x4cd297,null));};exports[_0x25b9('0x22')]=function(_0x446b93,_0x5ead6e){if(_0x446b93[_0x25b9('0x46')]['id']){delete _0x446b93[_0x25b9('0x46')]['id'];}return db[_0x25b9('0x2a')][_0x25b9('0x44')]({'where':{'id':_0x446b93[_0x25b9('0x41')]['id']}})[_0x25b9('0x23')](handleEntityNotFound(_0x5ead6e,null))[_0x25b9('0x23')](saveUpdates(_0x446b93[_0x25b9('0x46')],null))[_0x25b9('0x23')](respondWithResult(_0x5ead6e,null))[_0x25b9('0x3f')](handleError(_0x5ead6e,null));};exports[_0x25b9('0x47')]=function(_0x3302f8,_0x5864df){return db[_0x25b9('0x2a')][_0x25b9('0x44')]({'where':{'id':_0x3302f8[_0x25b9('0x41')]['id']}})[_0x25b9('0x23')](handleEntityNotFound(_0x5864df,null))[_0x25b9('0x23')](removeEntity(_0x5864df,null))[_0x25b9('0x3f')](handleError(_0x5864df,null));}; \ No newline at end of file +var _0x15c3=['update','then','end','error','stack','name','send','OpenchannelApplication','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x70404,_0x507113){var _0x2da0b9=function(_0x3fa2a9){while(--_0x3fa2a9){_0x70404['push'](_0x70404['shift']());}};_0x2da0b9(++_0x507113);}(_0x15c3,0xbb));var _0x315c=function(_0x4e5569,_0x35d0d3){_0x4e5569=_0x4e5569-0x0;var _0x3f34c1=_0x15c3[_0x4e5569];return _0x3f34c1;};'use strict';var emlformat=require(_0x315c('0x0'));var rimraf=require(_0x315c('0x1'));var zipdir=require(_0x315c('0x2'));var jsonpatch=require(_0x315c('0x3'));var rp=require(_0x315c('0x4'));var moment=require(_0x315c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x315c('0x6'));var util=require(_0x315c('0x7'));var path=require(_0x315c('0x8'));var sox=require(_0x315c('0x9'));var csv=require(_0x315c('0xa'));var ejs=require(_0x315c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x315c('0xc'));var squel=require('squel');var crypto=require(_0x315c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x315c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x315c('0xf'));var Papa=require(_0x315c('0x10'));var Redis=require(_0x315c('0x11'));var authService=require(_0x315c('0x12'));var qs=require(_0x315c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x315c('0x14'));var logger=require('../../config/logger')(_0x315c('0x15'));var utils=require(_0x315c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x315c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c61ba,_0x51eec8){_0x51eec8=_0x51eec8||0xcc;return function(_0x1339f8){if(_0x1339f8){return _0x1c61ba[_0x315c('0x18')](_0x51eec8);}return _0x1c61ba['status'](_0x51eec8)['end']();};}function respondWithResult(_0x5668c4,_0x4a766a){_0x4a766a=_0x4a766a||0xc8;return function(_0x31fc98){if(_0x31fc98){return _0x5668c4[_0x315c('0x19')](_0x4a766a)[_0x315c('0x1a')](_0x31fc98);}};}function respondWithFilteredResult(_0x49fd16,_0x19e4d6){return function(_0x19ed63){if(_0x19ed63){var _0x3fbc11=typeof _0x19e4d6[_0x315c('0x1b')]===_0x315c('0x1c')&&typeof _0x19e4d6['limit']===_0x315c('0x1c');var _0x3a57bd=_0x19ed63[_0x315c('0x1d')];var _0x4972d7=_0x3fbc11?0x0:_0x19e4d6[_0x315c('0x1b')];var _0xf3377c=_0x3fbc11?_0x19ed63['count']:_0x19e4d6['offset']+_0x19e4d6[_0x315c('0x1e')];var _0x1d7aab;if(_0xf3377c>=_0x3a57bd){_0xf3377c=_0x3a57bd;_0x1d7aab=0xc8;}else{_0x1d7aab=0xce;}_0x49fd16[_0x315c('0x19')](_0x1d7aab);return _0x49fd16['set'](_0x315c('0x1f'),_0x4972d7+'-'+_0xf3377c+'/'+_0x3a57bd)[_0x315c('0x1a')](_0x19ed63);}return null;};}function patchUpdates(_0x3bf760){return function(_0x4aad11){try{jsonpatch[_0x315c('0x20')](_0x4aad11,_0x3bf760,!![]);}catch(_0x49f01d){return BPromise[_0x315c('0x21')](_0x49f01d);}return _0x4aad11[_0x315c('0x22')]();};}function saveUpdates(_0x542d56,_0x3ec81b){return function(_0x131794){if(_0x131794){return _0x131794[_0x315c('0x23')](_0x542d56)[_0x315c('0x24')](function(_0x591438){return _0x591438;});}return null;};}function removeEntity(_0x45a39f,_0x1ca317){return function(_0x4e619c){if(_0x4e619c){return _0x4e619c['destroy']()[_0x315c('0x24')](function(){_0x45a39f[_0x315c('0x19')](0xcc)[_0x315c('0x25')]();});}};}function handleEntityNotFound(_0xa59211,_0x3efc6f){return function(_0x21b732){if(!_0x21b732){_0xa59211['sendStatus'](0x194);}return _0x21b732;};}function handleError(_0x5af01d,_0x2e5a39){_0x2e5a39=_0x2e5a39||0x1f4;return function(_0x504533){logger[_0x315c('0x26')](_0x504533[_0x315c('0x27')]);if(_0x504533[_0x315c('0x28')]){delete _0x504533[_0x315c('0x28')];}_0x5af01d[_0x315c('0x19')](_0x2e5a39)[_0x315c('0x29')](_0x504533);};}exports['index']=function(_0x3249e0,_0x37de50){var _0x363956={},_0x1133a5={},_0x28dd2d={'count':0x0,'rows':[]};var _0x4aa390=_['map'](db[_0x315c('0x2a')][_0x315c('0x2b')],function(_0x4faf57){return{'name':_0x4faf57[_0x315c('0x2c')],'type':_0x4faf57[_0x315c('0x2d')][_0x315c('0x2e')]};});_0x1133a5['model']=_[_0x315c('0x2f')](_0x4aa390,_0x315c('0x28'));_0x1133a5[_0x315c('0x30')]=_[_0x315c('0x31')](_0x3249e0[_0x315c('0x30')]);_0x1133a5['filters']=_[_0x315c('0x32')](_0x1133a5['model'],_0x1133a5[_0x315c('0x30')]);_0x363956['attributes']=_[_0x315c('0x32')](_0x1133a5[_0x315c('0x33')],qs['fields'](_0x3249e0[_0x315c('0x30')][_0x315c('0x34')]));_0x363956[_0x315c('0x35')]=_0x363956[_0x315c('0x35')][_0x315c('0x36')]?_0x363956[_0x315c('0x35')]:_0x1133a5[_0x315c('0x33')];if(!_0x3249e0[_0x315c('0x30')][_0x315c('0x37')](_0x315c('0x38'))){_0x363956[_0x315c('0x1e')]=qs[_0x315c('0x1e')](_0x3249e0['query'][_0x315c('0x1e')]);_0x363956[_0x315c('0x1b')]=qs[_0x315c('0x1b')](_0x3249e0[_0x315c('0x30')]['offset']);}_0x363956[_0x315c('0x39')]=qs[_0x315c('0x3a')](_0x3249e0[_0x315c('0x30')][_0x315c('0x3a')]);_0x363956[_0x315c('0x3b')]=qs[_0x315c('0x3c')](_[_0x315c('0x3d')](_0x3249e0[_0x315c('0x30')],_0x1133a5[_0x315c('0x3c')]),_0x4aa390);if(_0x3249e0[_0x315c('0x30')][_0x315c('0x3e')]){_0x363956[_0x315c('0x3b')]=_[_0x315c('0x3f')](_0x363956['where'],{'$or':_[_0x315c('0x2f')](_0x4aa390,function(_0x3cae54){if(_0x3cae54['type']!=='VIRTUAL'){var _0x28a199={};_0x28a199[_0x3cae54[_0x315c('0x28')]]={'$like':'%'+_0x3249e0['query'][_0x315c('0x3e')]+'%'};return _0x28a199;}})});}_0x363956=_['merge']({},_0x363956,_0x3249e0[_0x315c('0x40')]);var _0x4a44cb={'where':_0x363956[_0x315c('0x3b')]};return db[_0x315c('0x2a')][_0x315c('0x1d')](_0x4a44cb)[_0x315c('0x24')](function(_0x1c3433){_0x28dd2d[_0x315c('0x1d')]=_0x1c3433;if(_0x3249e0['query'][_0x315c('0x41')]){_0x363956[_0x315c('0x42')]=[{'all':!![]}];}return db[_0x315c('0x2a')][_0x315c('0x43')](_0x363956);})[_0x315c('0x24')](function(_0x780968){_0x28dd2d['rows']=_0x780968;return _0x28dd2d;})[_0x315c('0x24')](respondWithFilteredResult(_0x37de50,_0x363956))[_0x315c('0x44')](handleError(_0x37de50,null));};exports['show']=function(_0x5285a6,_0x4f17ba){var _0x47b4aa={'raw':!![],'where':{'id':_0x5285a6[_0x315c('0x45')]['id']}},_0x2cbabe={};_0x2cbabe[_0x315c('0x33')]=_['keys'](db['OpenchannelApplication'][_0x315c('0x2b')]);_0x2cbabe['query']=_[_0x315c('0x31')](_0x5285a6[_0x315c('0x30')]);_0x2cbabe['filters']=_['intersection'](_0x2cbabe[_0x315c('0x33')],_0x2cbabe[_0x315c('0x30')]);_0x47b4aa[_0x315c('0x35')]=_[_0x315c('0x32')](_0x2cbabe['model'],qs[_0x315c('0x34')](_0x5285a6[_0x315c('0x30')][_0x315c('0x34')]));_0x47b4aa['attributes']=_0x47b4aa[_0x315c('0x35')][_0x315c('0x36')]?_0x47b4aa[_0x315c('0x35')]:_0x2cbabe[_0x315c('0x33')];if(_0x5285a6['query'][_0x315c('0x41')]){_0x47b4aa[_0x315c('0x42')]=[{'all':!![]}];}_0x47b4aa=_[_0x315c('0x3f')]({},_0x47b4aa,_0x5285a6[_0x315c('0x40')]);return db['OpenchannelApplication'][_0x315c('0x46')](_0x47b4aa)[_0x315c('0x24')](handleEntityNotFound(_0x4f17ba,null))[_0x315c('0x24')](respondWithResult(_0x4f17ba,null))[_0x315c('0x44')](handleError(_0x4f17ba,null));};exports[_0x315c('0x47')]=function(_0x38ac28,_0x56461e){return db['OpenchannelApplication']['create'](_0x38ac28['body'],{})[_0x315c('0x24')](respondWithResult(_0x56461e,0xc9))[_0x315c('0x44')](handleError(_0x56461e,null));};exports['update']=function(_0x3136a6,_0x3810c5){if(_0x3136a6['body']['id']){delete _0x3136a6['body']['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x3136a6[_0x315c('0x45')]['id']}})[_0x315c('0x24')](handleEntityNotFound(_0x3810c5,null))[_0x315c('0x24')](saveUpdates(_0x3136a6[_0x315c('0x48')],null))[_0x315c('0x24')](respondWithResult(_0x3810c5,null))[_0x315c('0x44')](handleError(_0x3810c5,null));};exports[_0x315c('0x49')]=function(_0x29037c,_0x4fa412){return db[_0x315c('0x2a')][_0x315c('0x46')]({'where':{'id':_0x29037c[_0x315c('0x45')]['id']}})[_0x315c('0x24')](handleEntityNotFound(_0x4fa412,null))['then'](removeEntity(_0x4fa412,null))[_0x315c('0x44')](handleError(_0x4fa412,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4a3ce71..fe8b9bb 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 _0x81df=['path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x53a8d3,_0x1a0799){var _0x15e434=function(_0x21f7ac){while(--_0x21f7ac){_0x53a8d3['push'](_0x53a8d3['shift']());}};_0x15e434(++_0x1a0799);}(_0x81df,0xdb));var _0xf81d=function(_0x36ae1d,_0x1b54e0){_0x36ae1d=_0x36ae1d-0x0;var _0x5cfc7b=_0x81df[_0x36ae1d];return _0x5cfc7b;};'use strict';var _=require(_0xf81d('0x0'));var util=require(_0xf81d('0x1'));var logger=require(_0xf81d('0x2'))(_0xf81d('0x3'));var moment=require(_0xf81d('0x4'));var BPromise=require(_0xf81d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf81d('0x6'));var rimraf=require(_0xf81d('0x7'));var config=require(_0xf81d('0x8'));var attributes=require(_0xf81d('0x9'));module[_0xf81d('0xa')]=function(_0x14f892,_0x2979d8){return _0x14f892['define'](_0xf81d('0xb'),attributes,{'tableName':_0xf81d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf81d('0xd'),'collate':_0xf81d('0xe')});}; \ No newline at end of file +var _0x2baf=['path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment'];(function(_0x25997b,_0xeddec4){var _0x43f8e1=function(_0x3a1005){while(--_0x3a1005){_0x25997b['push'](_0x25997b['shift']());}};_0x43f8e1(++_0xeddec4);}(_0x2baf,0x7f));var _0xf2ba=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x2baf[_0x378b4];return _0x11d07b;};'use strict';var _=require('lodash');var util=require(_0xf2ba('0x0'));var logger=require('../../config/logger')(_0xf2ba('0x1'));var moment=require(_0xf2ba('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2ba('0x3'));var rimraf=require(_0xf2ba('0x4'));var config=require(_0xf2ba('0x5'));var attributes=require(_0xf2ba('0x6'));module[_0xf2ba('0x7')]=function(_0x14ee5a,_0x7848dd){return _0x14ee5a[_0xf2ba('0x8')](_0xf2ba('0x9'),attributes,{'tableName':_0xf2ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2ba('0xb'),'collate':_0xf2ba('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ecf99bf..0faba10 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 _0xcdb7=['../../mysqldb','rpc','../../config/environment','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','then','util','moment','randomstring','ioredis'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xcdb7,0xd4));var _0x7cdb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcdb7[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x7cdb('0x0'));var moment=require(_0x7cdb('0x1'));var BPromise=require('bluebird');var rs=require(_0x7cdb('0x2'));var fs=require('fs');var Redis=require(_0x7cdb('0x3'));var db=require(_0x7cdb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7cdb('0x5'));var config=require(_0x7cdb('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7cdb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xbdd3b3,_0x42346b,_0x1ae256){return new BPromise(function(_0x3f1348,_0x101fa1){return client[_0x7cdb('0x8')](_0xbdd3b3,_0x1ae256)['then'](function(_0x11287d){logger[_0x7cdb('0x9')](_0x7cdb('0xa'),_0x42346b,'request\x20sent');logger[_0x7cdb('0xb')](_0x7cdb('0xc'),_0x42346b,_0x7cdb('0xd'),JSON[_0x7cdb('0xe')](_0x11287d));if(_0x11287d[_0x7cdb('0xf')]){if(_0x11287d[_0x7cdb('0xf')][_0x7cdb('0x10')]===0x1f4){logger[_0x7cdb('0xf')](_0x7cdb('0xa'),_0x42346b,_0x11287d[_0x7cdb('0xf')][_0x7cdb('0x11')]);return _0x101fa1(_0x11287d['error']['message']);}logger['error'](_0x7cdb('0xa'),_0x42346b,_0x11287d[_0x7cdb('0xf')][_0x7cdb('0x11')]);return _0x3f1348(_0x11287d['error']['message']);}else{logger[_0x7cdb('0x9')]('OpenchannelApplication,\x20%s,\x20%s',_0x42346b,_0x7cdb('0xd'));_0x3f1348(_0x11287d['result'][_0x7cdb('0x11')]);}})['catch'](function(_0x3dc69e){logger[_0x7cdb('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x42346b,_0x3dc69e);_0x101fa1(_0x3dc69e);});});}exports[_0x7cdb('0x12')]=function(_0x17b49c){var _0x3d998b=this;return new Promise(function(_0x3b6d2c,_0x6dfe94){return db[_0x7cdb('0x13')][_0x7cdb('0x14')](_0x17b49c[_0x7cdb('0x15')],{'raw':_0x17b49c[_0x7cdb('0x16')]?_0x17b49c[_0x7cdb('0x16')][_0x7cdb('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17b49c[_0x7cdb('0x16')]?_0x17b49c[_0x7cdb('0x16')]['where']||null:null,'attributes':_0x17b49c['options']?_0x17b49c[_0x7cdb('0x16')][_0x7cdb('0x18')]||null:null,'limit':_0x17b49c[_0x7cdb('0x16')]?_0x17b49c['options'][_0x7cdb('0x19')]||null:null})[_0x7cdb('0x1a')](function(_0x2eec73){logger['info'](_0x7cdb('0x12'),_0x17b49c);logger[_0x7cdb('0xb')](_0x7cdb('0x12'),_0x17b49c,JSON['stringify'](_0x2eec73));_0x3b6d2c(_0x2eec73);})['catch'](function(_0x5b9b7a){logger[_0x7cdb('0xf')](_0x7cdb('0x12'),_0x5b9b7a['message'],_0x17b49c);_0x6dfe94(_0x3d998b[_0x7cdb('0xf')](0x1f4,_0x5b9b7a[_0x7cdb('0x11')]));});});}; \ No newline at end of file +var _0xcc44=['info','result','catch','UpdateOpenchannelApplication','options','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x395b36,_0x4003da){var _0x5863a1=function(_0x494094){while(--_0x494094){_0x395b36['push'](_0x395b36['shift']());}};_0x5863a1(++_0x4003da);}(_0xcc44,0xcb));var _0x4cc4=function(_0xf26e77,_0x429091){_0xf26e77=_0xf26e77-0x0;var _0x3256fe=_0xcc44[_0xf26e77];return _0x3256fe;};'use strict';var _=require(_0x4cc4('0x0'));var util=require(_0x4cc4('0x1'));var moment=require(_0x4cc4('0x2'));var BPromise=require(_0x4cc4('0x3'));var rs=require(_0x4cc4('0x4'));var fs=require('fs');var Redis=require(_0x4cc4('0x5'));var db=require(_0x4cc4('0x6'))['db'];var utils=require(_0x4cc4('0x7'));var logger=require(_0x4cc4('0x8'))(_0x4cc4('0x9'));var config=require(_0x4cc4('0xa'));var jayson=require(_0x4cc4('0xb'));var client=jayson[_0x4cc4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a2aea,_0x286533,_0x4cced7){return new BPromise(function(_0x5e9629,_0x34b543){return client[_0x4cc4('0xd')](_0x2a2aea,_0x4cced7)[_0x4cc4('0xe')](function(_0x3784db){logger['info'](_0x4cc4('0xf'),_0x286533,_0x4cc4('0x10'));logger[_0x4cc4('0x11')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x286533,_0x4cc4('0x10'),JSON['stringify'](_0x3784db));if(_0x3784db[_0x4cc4('0x12')]){if(_0x3784db['error'][_0x4cc4('0x13')]===0x1f4){logger[_0x4cc4('0x12')](_0x4cc4('0xf'),_0x286533,_0x3784db[_0x4cc4('0x12')][_0x4cc4('0x14')]);return _0x34b543(_0x3784db[_0x4cc4('0x12')][_0x4cc4('0x14')]);}logger[_0x4cc4('0x12')](_0x4cc4('0xf'),_0x286533,_0x3784db[_0x4cc4('0x12')]['message']);return _0x5e9629(_0x3784db[_0x4cc4('0x12')][_0x4cc4('0x14')]);}else{logger[_0x4cc4('0x15')](_0x4cc4('0xf'),_0x286533,_0x4cc4('0x10'));_0x5e9629(_0x3784db[_0x4cc4('0x16')][_0x4cc4('0x14')]);}})[_0x4cc4('0x17')](function(_0x1a00c9){logger[_0x4cc4('0x12')](_0x4cc4('0xf'),_0x286533,_0x1a00c9);_0x34b543(_0x1a00c9);});});}exports[_0x4cc4('0x18')]=function(_0x4377a8){var _0x192983=this;return new Promise(function(_0x2952e2,_0x4b412c){return db['OpenchannelApplication']['update'](_0x4377a8['body'],{'raw':_0x4377a8['options']?_0x4377a8[_0x4cc4('0x19')][_0x4cc4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4377a8['options']?_0x4377a8[_0x4cc4('0x19')]['where']||null:null,'attributes':_0x4377a8[_0x4cc4('0x19')]?_0x4377a8['options'][_0x4cc4('0x1b')]||null:null,'limit':_0x4377a8['options']?_0x4377a8[_0x4cc4('0x19')]['limit']||null:null})[_0x4cc4('0xe')](function(_0x6009df){logger[_0x4cc4('0x15')](_0x4cc4('0x18'),_0x4377a8);logger['debug']('UpdateOpenchannelApplication',_0x4377a8,JSON['stringify'](_0x6009df));_0x2952e2(_0x6009df);})[_0x4cc4('0x17')](function(_0x3163c9){logger[_0x4cc4('0x12')](_0x4cc4('0x18'),_0x3163c9[_0x4cc4('0x14')],_0x4377a8);_0x4b412c(_0x192983[_0x4cc4('0x12')](0x1f4,_0x3163c9[_0x4cc4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index d710cef..74e29fd 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 _0xedc5=['index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get'];(function(_0x37b833,_0x520bae){var _0x2ed986=function(_0x3fb9b9){while(--_0x3fb9b9){_0x37b833['push'](_0x37b833['shift']());}};_0x2ed986(++_0x520bae);}(_0xedc5,0x1d6));var _0x5edc=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0xedc5[_0x420f2a];return _0x28f802;};'use strict';var multer=require(_0x5edc('0x0'));var util=require(_0x5edc('0x1'));var path=require(_0x5edc('0x2'));var timeout=require(_0x5edc('0x3'));var express=require(_0x5edc('0x4'));var router=express['Router']();var fs_extra=require(_0x5edc('0x5'));var auth=require(_0x5edc('0x6'));var interaction=require(_0x5edc('0x7'));var config=require('../../config/environment');var controller=require(_0x5edc('0x8'));router[_0x5edc('0x9')]('/',auth['isAuthenticated'](),controller[_0x5edc('0xa')]);router[_0x5edc('0x9')](_0x5edc('0xb'),auth[_0x5edc('0xc')](),controller['describe']);router['get'](_0x5edc('0xd'),auth[_0x5edc('0xc')](),controller[_0x5edc('0xe')]);router['get'](_0x5edc('0xf'),auth[_0x5edc('0xc')](),controller[_0x5edc('0x10')]);router[_0x5edc('0x9')]('/:id/download',auth[_0x5edc('0xc')](),controller['download']);router[_0x5edc('0x11')]('/',auth['isAuthenticated'](),controller[_0x5edc('0x12')]);router[_0x5edc('0x11')](_0x5edc('0xf'),auth[_0x5edc('0xc')](),controller['addMessage']);router[_0x5edc('0x11')](_0x5edc('0x13'),auth['isAuthenticated'](),interaction[_0x5edc('0x14')](_0x5edc('0x15'),_0x5edc('0x16')),controller['addTags']);router[_0x5edc('0x17')](_0x5edc('0xd'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0x5edc('0x18')),controller[_0x5edc('0x19')]);router[_0x5edc('0x1a')](_0x5edc('0xd'),auth[_0x5edc('0xc')](),interaction[_0x5edc('0x14')]('openchannel','openchannelinteraction:destroy'),controller[_0x5edc('0x1b')]);router[_0x5edc('0x1a')](_0x5edc('0x13'),auth[_0x5edc('0xc')](),controller[_0x5edc('0x1c')]);module[_0x5edc('0x1d')]=router; \ No newline at end of file +var _0x451a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','delete','openchannelinteraction:destroy','destroy','exports'];(function(_0x28d1cd,_0x192371){var _0xdcb892=function(_0x145f6e){while(--_0x145f6e){_0x28d1cd['push'](_0x28d1cd['shift']());}};_0xdcb892(++_0x192371);}(_0x451a,0x96));var _0xa451=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x451a[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa451('0x0'));var timeout=require(_0xa451('0x1'));var express=require(_0xa451('0x2'));var router=express[_0xa451('0x3')]();var fs_extra=require(_0xa451('0x4'));var auth=require(_0xa451('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa451('0x6'));var controller=require(_0xa451('0x7'));router['get']('/',auth[_0xa451('0x8')](),controller[_0xa451('0x9')]);router[_0xa451('0xa')](_0xa451('0xb'),auth[_0xa451('0x8')](),controller[_0xa451('0xc')]);router[_0xa451('0xa')](_0xa451('0xd'),auth[_0xa451('0x8')](),controller[_0xa451('0xe')]);router[_0xa451('0xa')](_0xa451('0xf'),auth[_0xa451('0x8')](),controller[_0xa451('0x10')]);router['get']('/:id/download',auth[_0xa451('0x8')](),controller[_0xa451('0x11')]);router[_0xa451('0x12')]('/',auth[_0xa451('0x8')](),controller[_0xa451('0x13')]);router[_0xa451('0x12')](_0xa451('0xf'),auth[_0xa451('0x8')](),controller[_0xa451('0x14')]);router[_0xa451('0x12')](_0xa451('0x15'),auth[_0xa451('0x8')](),interaction[_0xa451('0x16')](_0xa451('0x17'),_0xa451('0x18')),controller[_0xa451('0x19')]);router['put'](_0xa451('0xd'),auth[_0xa451('0x8')](),interaction[_0xa451('0x16')](_0xa451('0x17'),'openchannelinteraction:update'),controller['update']);router[_0xa451('0x1a')](_0xa451('0xd'),auth[_0xa451('0x8')](),interaction[_0xa451('0x16')]('openchannel',_0xa451('0x1b')),controller[_0xa451('0x1c')]);router[_0xa451('0x1a')](_0xa451('0x15'),auth[_0xa451('0x8')](),controller['removeTags']);module[_0xa451('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index e1d6dd5..6ddce0b 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 _0x4fde=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x1da448,_0x565a9f){var _0xdb7a13=function(_0x48bfc7){while(--_0x48bfc7){_0x1da448['push'](_0x1da448['shift']());}};_0xdb7a13(++_0x565a9f);}(_0x4fde,0x19f));var _0xe4fd=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x4fde[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0xe4fd('0x0'));module[_0xe4fd('0x1')]={'closed':{'type':Sequelize[_0xe4fd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe4fd('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe4fd('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe4fd('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xe4fd('0x3')]},'threadId':{'type':Sequelize[_0xe4fd('0x4')]},'externalUrl':{'type':Sequelize[_0xe4fd('0x4')]},'lastMsgAt':{'type':Sequelize[_0xe4fd('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe4fd('0x5')]('in',_0xe4fd('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe4fd('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xe4fd('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x34e7=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x58bfed,_0x5596f0){var _0x98abea=function(_0x386463){while(--_0x386463){_0x58bfed['push'](_0x58bfed['shift']());}};_0x98abea(++_0x5596f0);}(_0x34e7,0x164));var _0x734e=function(_0x52e9a1,_0x5ea77e){_0x52e9a1=_0x52e9a1-0x0;var _0x2d41aa=_0x34e7[_0x52e9a1];return _0x2d41aa;};'use strict';var Sequelize=require(_0x734e('0x0'));module[_0x734e('0x1')]={'closed':{'type':Sequelize[_0x734e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x734e('0x3')]},'disposition':{'type':Sequelize[_0x734e('0x4')]},'secondDisposition':{'type':Sequelize[_0x734e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x734e('0x4')]},'note':{'type':Sequelize[_0x734e('0x4')]},'read1stAt':{'type':Sequelize[_0x734e('0x3')]},'threadId':{'type':Sequelize[_0x734e('0x4')]},'externalUrl':{'type':Sequelize[_0x734e('0x4')]},'lastMsgAt':{'type':Sequelize[_0x734e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x734e('0x5')]('in',_0x734e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x734e('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d695272..6d1e8fb 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 _0x1302=['`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','toString','groupBy','OpenchannelInteractionId','rows','catch','params','includeAll','include','merge','options','create','describe','addMessage','OpenchannelMessage','ids','omit','findOne','format','findAll','addTags','setTags','openchannelInteractionTags:save','removeTags','unix','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','User','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','threadId','Private','basename','createReadStream','pipe','createWriteStream','System','renderFile','views','downloadInteraction.ejs','.pdf','log','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','from','tools_tags','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','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','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200'];(function(_0x5a3d49,_0x24b21a){var _0x4d5c23=function(_0x4f62b0){while(--_0x4f62b0){_0x5a3d49['push'](_0x5a3d49['shift']());}};_0x4d5c23(++_0x24b21a);}(_0x1302,0x152));var _0x2130=function(_0x519927,_0x20921e){_0x519927=_0x519927-0x0;var _0x3e603d=_0x1302[_0x519927];return _0x3e603d;};'use strict';var emlformat=require(_0x2130('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2130('0x1'));var jsonpatch=require(_0x2130('0x2'));var rp=require(_0x2130('0x3'));var moment=require(_0x2130('0x4'));var BPromise=require(_0x2130('0x5'));var Mustache=require(_0x2130('0x6'));var util=require('util');var path=require(_0x2130('0x7'));var sox=require(_0x2130('0x8'));var csv=require(_0x2130('0x9'));var ejs=require(_0x2130('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2130('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2130('0xc'));var deskjs=require(_0x2130('0xd'));var toCsv=require(_0x2130('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2130('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2130('0xf'));var as=require(_0x2130('0x10'));var pdf=require(_0x2130('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2130('0x12'))(_0x2130('0x13'));var utils=require(_0x2130('0x14'));var config=require(_0x2130('0x15'));var licenseUtil=require(_0x2130('0x16'));var db=require(_0x2130('0x17'))['db'];config[_0x2130('0x18')]=_['defaults'](config['redis'],{'host':_0x2130('0x19'),'port':0x18eb});var socket=require(_0x2130('0x1a'))(new Redis(config['redis']));require(_0x2130('0x1b'))[_0x2130('0x1c')](socket);function respondWithStatusCode(_0xe6da2,_0x536579){_0x536579=_0x536579||0xcc;return function(_0x40036f){if(_0x40036f){return _0xe6da2[_0x2130('0x1d')](_0x536579);}return _0xe6da2[_0x2130('0x1e')](_0x536579)[_0x2130('0x1f')]();};}function respondWithResult(_0x5e11f2,_0x5e235d){_0x5e235d=_0x5e235d||0xc8;return function(_0x50d1a5){if(_0x50d1a5){return _0x5e11f2['status'](_0x5e235d)[_0x2130('0x20')](_0x50d1a5);}};}function respondWithFilteredResult(_0x1a7540,_0x399c94){return function(_0x30e542){if(_0x30e542){var _0x14c7c9=typeof _0x399c94['offset']==='undefined'&&typeof _0x399c94[_0x2130('0x21')]===_0x2130('0x22');var _0x4c7d8b=_0x30e542[_0x2130('0x23')];var _0x15c845=_0x14c7c9?0x0:_0x399c94['offset'];var _0x3fbeef=_0x14c7c9?_0x30e542[_0x2130('0x23')]:_0x399c94[_0x2130('0x24')]+_0x399c94[_0x2130('0x21')];var _0x467794;if(_0x3fbeef>=_0x4c7d8b){_0x3fbeef=_0x4c7d8b;_0x467794=0xc8;}else{_0x467794=0xce;}_0x1a7540[_0x2130('0x1e')](_0x467794);return _0x1a7540[_0x2130('0x25')](_0x2130('0x26'),_0x15c845+'-'+_0x3fbeef+'/'+_0x4c7d8b)[_0x2130('0x20')](_0x30e542);}return null;};}function patchUpdates(_0x580878){return function(_0x539800){try{jsonpatch[_0x2130('0x27')](_0x539800,_0x580878,!![]);}catch(_0x11267a){return BPromise[_0x2130('0x28')](_0x11267a);}return _0x539800['save']();};}function saveUpdates(_0x2d0d09,_0x25d4b5){return function(_0x1fa2bb){if(_0x1fa2bb){return _0x1fa2bb[_0x2130('0x29')](_0x2d0d09)['then'](function(_0x500679){return _0x500679;});}return null;};}function removeEntity(_0xe99057,_0x2b2c2c){return function(_0x3641d4){if(_0x3641d4){return _0x3641d4[_0x2130('0x2a')]()[_0x2130('0x2b')](function(){_0xe99057[_0x2130('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16396e,_0x2e7718){return function(_0xc6dfe3){if(!_0xc6dfe3){_0x16396e[_0x2130('0x1d')](0x194);}return _0xc6dfe3;};}function handleError(_0x4ac991,_0x148668){_0x148668=_0x148668||0x1f4;return function(_0x4148ba){logger['error'](_0x4148ba[_0x2130('0x2c')]);if(_0x4148ba['name']){delete _0x4148ba[_0x2130('0x2d')];}_0x4ac991[_0x2130('0x1e')](_0x148668)[_0x2130('0x2e')](_0x4148ba);};}function getInteractionUsers(_0x3bb080,_0x27d988){return new BPromise(function(_0x39d362,_0x2c2b1f){try{if(_0x27d988[_0x3bb080['id']]){_0x3bb080[_0x2130('0x2f')]=_[_0x2130('0x30')](_0x27d988[_0x3bb080['id']],function(_0x3827c3){return{'id':_0x3827c3['id'],'fullname':_0x3827c3[_0x2130('0x31')]};});}}catch(_0x17fec5){_0x2c2b1f(_0x17fec5);}_0x39d362(_0x3bb080);});}function getInteractionTags(_0x494317,_0xd8c89b){return new BPromise(function(_0x158418,_0x39730f){try{if(_0x494317[_0x2130('0x32')]){_0x494317['Tags']=[];_0x494317['TagIds'][_0x2130('0x33')](',')[_0x2130('0x34')](function(_0x1d02d0){_0x494317[_0x2130('0x35')][_0x2130('0x36')](_0xd8c89b[_0x1d02d0]);});}delete _0x494317[_0x2130('0x32')];}catch(_0x5d85ac){_0x39730f(_0x5d85ac);}_0x158418(_0x494317);});}function updateOpenchannelInteraction(_0x2dec18,_0x18c914,_0x1b6fbe){return new BPromise(function(_0x2224bc,_0x2e72ea){return getInteractionUsers(_0x2dec18,_0x1b6fbe)[_0x2130('0x2b')](function(_0x2f86d9){return getInteractionTags(_0x2f86d9,_0x18c914);})[_0x2130('0x2b')](function(_0x5f9796){_0x2224bc(_0x5f9796);})['catch'](function(_0x375efc){_0x2e72ea(_0x375efc);});});}exports[_0x2130('0x37')]=function(_0x322788,_0x2c7540){var _0x39174={},_0x51f08d={},_0x4d30a7={'count':0x0,'rows':[]};var _0x22e26c=_[_0x2130('0x30')](db[_0x2130('0x38')][_0x2130('0x39')],function(_0x90145e){return{'name':_0x90145e[_0x2130('0x3a')],'type':_0x90145e[_0x2130('0x3b')][_0x2130('0x3c')]};});_0x51f08d[_0x2130('0x3d')]=_[_0x2130('0x30')](_0x22e26c,_0x2130('0x2d'));_0x51f08d[_0x2130('0x3e')]=_[_0x2130('0x3f')](_0x322788[_0x2130('0x3e')]);_0x51f08d['filters']=_[_0x2130('0x40')](_0x51f08d[_0x2130('0x3d')],_0x51f08d['query']);_0x39174[_0x2130('0x41')]=_['intersection'](_0x51f08d[_0x2130('0x3d')],qs['fields'](_0x322788['query'][_0x2130('0x42')]));_0x39174['attributes']=_0x39174[_0x2130('0x41')][_0x2130('0x43')]?_0x39174[_0x2130('0x41')]:_0x51f08d[_0x2130('0x3d')];if(!_0x322788[_0x2130('0x3e')][_0x2130('0x44')](_0x2130('0x45'))){_0x39174[_0x2130('0x21')]=qs['limit'](_0x322788[_0x2130('0x3e')][_0x2130('0x21')]);_0x39174['offset']=qs[_0x2130('0x24')](_0x322788[_0x2130('0x3e')][_0x2130('0x24')]);}_0x39174['order']=qs['sort'](_0x322788[_0x2130('0x3e')][_0x2130('0x46')]);_0x39174[_0x2130('0x47')]=qs[_0x2130('0x48')](_[_0x2130('0x49')](_0x322788[_0x2130('0x3e')],_0x51f08d['filters']),_0x22e26c);var _0x2e9109=[];var _0x4409dc=squel[_0x2130('0x4a')]()[_0x2130('0x4b')]('id')[_0x2130('0x4b')](_0x2130('0x2d'))[_0x2130('0x4b')](_0x2130('0x4c'))[_0x2130('0x4d')](_0x2130('0x4e'));var _0x234d0b=squel['select']()['field']('u.id')[_0x2130('0x4b')]('u.fullname')[_0x2130('0x4b')](_0x2130('0x4f'))[_0x2130('0x4d')](_0x2130('0x50'),'ui')['left_join'](_0x2130('0x51'),'u',_0x2130('0x52'));var _0x153032=squel[_0x2130('0x4a')]()['from'](_0x2130('0x53'),'i')[_0x2130('0x54')](_0x2130('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x2130('0x51'),'o','o.id\x20=\x20i.UserId')[_0x2130('0x54')]('openchannel_accounts','a',_0x2130('0x56'))[_0x2130('0x54')](_0x2130('0x57'),'me',_0x2130('0x58'))['left_join'](_0x2130('0x59'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x2130('0x4e'),'t',_0x2130('0x5a'));var _0x39bff7=squel[_0x2130('0x5b')]();var _0x2b3d58=[];var _0xf0791b=squel[_0x2130('0x5b')]();var _0x336535;if(_0x322788['query'][_0x2130('0x5c')]){_0x336535=as[_0x2130('0x5d')](_0x322788[_0x2130('0x3e')]['search']);var _0x3501c0=_0x336535[_0x2130('0x5e')];for(var _0x48b629=0x0;_0x48b629<_0x336535[_0x2130('0x5f')]['length'];_0x48b629++){var _0x2c0999=_0x336535[_0x2130('0x5f')][_0x48b629];var _0x2d499b='i';var _0x242909=_[_0x2130('0x60')](_0x22e26c,[_0x2130('0x2d'),_0x2c0999['field']]);if(!_0x242909){switch(_0x2c0999[_0x2130('0x4b')]){case _0x2130('0x61'):if(_0x2c0999[_0x2130('0x62')]==0x1){_0x153032[_0x2130('0x63')]('`'+_0x2c0999[_0x2130('0x4b')]+_0x2130('0x64'));}else{_0x153032[_0x2130('0x63')]('`'+_0x2c0999[_0x2130('0x4b')]+_0x2130('0x65'));}break;case'Contact':if(_0x2c0999[_0x2130('0x66')]===_0x2130('0x67')){if(_0x2c0999[_0x2130('0x62')][_0x2130('0x33')]('\x20')[_0x2130('0x43')]>0x1){_0x39bff7[_0x3501c0](_0x2130('0x68'),qs[_0x2130('0x69')](_0x2c0999[_0x2130('0x62')]),null);}else{var _0x19970d='%'+_0x2c0999[_0x2130('0x62')]+'%';_0x39bff7[_0x3501c0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x19970d,_0x19970d,_0x19970d);}}else{_0x242909=_[_0x2130('0x60')](_0x22e26c,[_0x2130('0x2d'),'ContactId']);_0x2c0999[_0x2130('0x4b')]=_0x2130('0x6a');_0x594aa9=as['buildExpression'](_0x2d499b,_0x242909[_0x2130('0x3b')],_0x2c0999);_0x39bff7[_0x3501c0](_0x594aa9[_0x2130('0x6b')],_0x594aa9['value']['start'],_0x594aa9[_0x2130('0x62')]['end']);}break;case _0x2130('0x6c'):var _0x367c80=_0x2c0999['value'][_0x2130('0x33')](',')['map'](function(_0x2ee912){return Number(_0x2ee912);});_0x367c80[_0x2130('0x34')](function(_0x81e685){_0xf0791b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x81e685+',%');});_0x2b3d58=_[_0x2130('0x6d')](_0x2b3d58,_0x367c80);break;case'User':if(_0x2c0999[_0x2130('0x66')]===_0x2130('0x67')){_0x39bff7[_0x3501c0](_0x2130('0x6e'),'%'+_0x2c0999[_0x2130('0x62')]+'%',null);}else{_0x242909=_[_0x2130('0x60')](_0x22e26c,['name',_0x2130('0x6f')]);_0x2c0999[_0x2130('0x4b')]='UserId';_0x594aa9=as[_0x2130('0x70')](_0x2d499b,_0x242909[_0x2130('0x3b')],_0x2c0999);_0x39bff7[_0x3501c0](_0x594aa9[_0x2130('0x6b')],_0x594aa9[_0x2130('0x62')][_0x2130('0x71')],_0x594aa9[_0x2130('0x62')]['end']);}break;case _0x2130('0x72'):_0x594aa9=as['buildExpression']('me',null,_0x2c0999);_0x39bff7[_0x3501c0](_0x594aa9[_0x2130('0x6b')],_0x594aa9[_0x2130('0x62')][_0x2130('0x71')],_0x594aa9['value'][_0x2130('0x1f')]);break;}}else{var _0x594aa9=as['buildExpression'](_0x2d499b,_0x242909['type'],_0x2c0999);_0x39bff7[_0x3501c0](_0x594aa9[_0x2130('0x6b')],_0x594aa9[_0x2130('0x62')][_0x2130('0x71')],_0x594aa9[_0x2130('0x62')]['end']);}}}else{var _0x109f1b=_(_0x322788['query'])[_0x2130('0x3f')]()[_0x2130('0x30')](function(_0x2853b7){return _[_0x2130('0x73')](_0x22e26c,[_0x2130('0x2d'),_0x2853b7])?_0x2853b7:undefined;})['compact']()[_0x2130('0x62')]();if(!_[_0x2130('0x74')](_0x109f1b)){_0x109f1b[_0x2130('0x34')](function(_0x6fe887){if(_0x6fe887===_0x2130('0x75')){_0x153032[_0x2130('0x47')](_0x2130('0x76'),[][_0x2130('0x77')](_0x322788['query'][_0x6fe887]));}else if(_0x6fe887===_0x2130('0x78')){var _0x7a4612=JSON[_0x2130('0x79')](_0x322788[_0x2130('0x3e')][_0x6fe887])[_0x2130('0x7a')];var _0xeb03d2=JSON['parse'](_0x322788[_0x2130('0x3e')][_0x6fe887])[_0x2130('0x7b')];_0x153032[_0x2130('0x47')](_0x2130('0x7c'),_0x7a4612,_0xeb03d2);}else{if(_0x322788['query'][_0x6fe887]===_0x2130('0x7d')){_0x153032[_0x2130('0x47')]('i.'+_0x6fe887+_0x2130('0x7e'));}else{_0x153032['where']('i.'+_0x6fe887+_0x2130('0x7f'),_0x322788[_0x2130('0x3e')][_0x6fe887]);}}});}if(_0x322788['query'][_0x2130('0x80')]){if(_0x322788['query'][_0x2130('0x80')]==0x1){_0x153032[_0x2130('0x63')](_0x2130('0x81'));}else{_0x153032['having'](_0x2130('0x82'));}}if(_0x322788['query'][_0x2130('0x83')]){_0x2b3d58=_[_0x2130('0x84')](_0x322788[_0x2130('0x3e')][_0x2130('0x83')])?_0x322788[_0x2130('0x3e')][_0x2130('0x83')]:new Array(_0x322788[_0x2130('0x3e')][_0x2130('0x83')]);_0x2b3d58['forEach'](function(_0x4e584b){_0xf0791b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e584b+',%');});}if(_0x322788['query'][_0x2130('0x85')]){var _0x4ba6b1=_0x322788[_0x2130('0x3e')][_0x2130('0x85')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x2130('0x86')](_0x4ba6b1)){_0x39bff7['or'](_0x2130('0x87'),_0x4ba6b1+'%');}else{_0x39bff7['or'](_0x2130('0x88'),qs[_0x2130('0x69')](_0x4ba6b1))['or'](_0x2130('0x89'),_0x4ba6b1+'%')['or'](_0x2130('0x8a'),_0x4ba6b1+'%');}}}_0x153032[_0x2130('0x47')](_0x39bff7);_0x153032['group'](_0x2130('0x8b'));var _0x5860fd={'type':db[_0x2130('0x8c')]['QueryTypes']['SELECT'],'raw':!![]};var _0x56cdc7=_0x153032[_0x2130('0x8d')]();_0x56cdc7[_0x2130('0x4b')](_0x2130('0x8b'));_0x56cdc7[_0x2130('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2130('0x61'));if(_0x39174[_0x2130('0x8e')]){_0x39174[_0x2130('0x8e')][_0x2130('0x34')](function(_0x5c7000){var _0x57d969=_0x5c7000[0x0]===_0x2130('0x8f')?_0x5c7000[0x0]:'i.'+_0x5c7000[0x0];_0x153032[_0x2130('0x8e')](_0x57d969,_0x5c7000[0x1]===_0x2130('0x90')?![]:!![]);});}if(!_[_0x2130('0x74')](_0x2b3d58)){_0x153032[_0x2130('0x63')](_0xf0791b);_0x56cdc7[_0x2130('0x47')](_0x2130('0x91'),_0x2b3d58);}BPromise[_0x2130('0x92')]()[_0x2130('0x2b')](function(){if(!_0x336535){if(_0x322788['query'][_0x2130('0x75')])return;_0x56cdc7[_0x2130('0x47')](_0x2130('0x93'));_0x153032[_0x2130('0x47')](_0x2130('0x93'));return;}if(_0x322788[_0x2130('0x94')][_0x2130('0x95')]!==_0x2130('0x96'))return;return _0x322788[_0x2130('0x94')][_0x2130('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5d9102){if(_['isEmpty'](_0x5d9102)){_0x56cdc7[_0x2130('0x47')](_0x2130('0x98'));_0x153032[_0x2130('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x56cdc7[_0x2130('0x47')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x2130('0x30')](_0x5d9102,'id'));_0x153032[_0x2130('0x47')](_0x2130('0x76'),_[_0x2130('0x30')](_0x5d9102,'id'));}});})[_0x2130('0x2b')](function(){if(_0x322788[_0x2130('0x94')][_0x2130('0x95')]==='agent'&&!_0x336535&&!_0x322788['query'][_0x2130('0x75')])return[];return db[_0x2130('0x99')][_0x2130('0x3e')](_0x56cdc7['toString'](),_0x5860fd);})[_0x2130('0x2b')](function(_0x8d297b){_0x4d30a7[_0x2130('0x23')]=_0x8d297b['length'];if(_0x4d30a7['count']===0x0)return[];return db[_0x2130('0x99')][_0x2130('0x3e')](_0x4409dc['toString'](),_0x5860fd)[_0x2130('0x2b')](function(_0x4ae4c0){_0x2e9109=_[_0x2130('0x9a')](_0x4ae4c0,'id');_0x5860fd=_['merge'](_0x5860fd,{'model':db[_0x2130('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x322788[_0x2130('0x3e')][_0x2130('0x42')]){_0x39174[_0x2130('0x41')][_0x2130('0x34')](function(_0x3edea1){_0x153032[_0x2130('0x4b')]('i.'+_0x3edea1);});}else{_0x153032[_0x2130('0x4b')](_0x2130('0x9b'),_0x2130('0x61'));_0x153032[_0x2130('0x4b')]('a.key',_0x2130('0x9c'));_0x153032['field'](_0x2130('0x9d'),_0x2130('0x9e'));_0x153032['field']('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x153032[_0x2130('0x4b')]('i.*');_0x153032[_0x2130('0x4b')]('c.firstName',_0x2130('0x9f'));_0x153032['field'](_0x2130('0xa0'),_0x2130('0xa1'));_0x153032[_0x2130('0x4b')]('c.email',_0x2130('0xa2'));_0x153032[_0x2130('0x4b')](_0x2130('0xa3'),_0x2130('0xa4'));_0x153032[_0x2130('0x4b')](_0x2130('0xa5'),_0x2130('0xa6'));_0x153032[_0x2130('0x4b')](_0x2130('0xa7'),_0x2130('0xa8'));_0x153032['field'](_0x2130('0xa9'),_0x2130('0xaa'));_0x153032[_0x2130('0x4b')](_0x2130('0xab'),_0x2130('0xac'));_0x153032[_0x2130('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x39174[_0x2130('0x21')])_0x153032[_0x2130('0x21')](_0x39174[_0x2130('0x21')]);if(_0x39174[_0x2130('0x24')])_0x153032[_0x2130('0x24')](_0x39174[_0x2130('0x24')]);return db[_0x2130('0x99')][_0x2130('0x3e')](_0x153032[_0x2130('0xad')](),_0x5860fd);})[_0x2130('0x2b')](function(_0x4cf008){if(_0x4cf008[_0x2130('0x43')]>0x0)_0x234d0b[_0x2130('0x47')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x4cf008,'id'));return db[_0x2130('0x99')]['query'](_0x234d0b['toString'](),_0x5860fd)[_0x2130('0x2b')](function(_0x567b28){var _0x21238f=_[_0x2130('0xae')](_0x567b28,_0x2130('0xaf'));var _0xaa08a1=[];_0x4cf008[_0x2130('0x34')](function(_0x364ae4){_0xaa08a1[_0x2130('0x36')](updateOpenchannelInteraction(_0x364ae4,_0x2e9109,_0x21238f));});return BPromise['all'](_0xaa08a1);});});})['then'](function(_0x150206){_0x4d30a7[_0x2130('0xb0')]=_0x150206;return _0x4d30a7;})[_0x2130('0x2b')](respondWithFilteredResult(_0x2c7540,_0x39174))[_0x2130('0xb1')](handleError(_0x2c7540,null));};exports['show']=function(_0x4971fc,_0x40714e){var _0x593a99={};if(_0x4971fc[_0x2130('0x3e')][_0x2130('0x3b')]&&_0x4971fc[_0x2130('0x3e')][_0x2130('0x3b')]==='from'){_0x593a99[_0x2130('0x4d')]=_0x4971fc[_0x2130('0xb2')]['id'];}else{_0x593a99['id']=_0x4971fc['params']['id'];}var _0x59cc50={'raw':![],'where':_0x593a99},_0x234681={};_0x234681[_0x2130('0x3d')]=_['keys'](db[_0x2130('0x38')][_0x2130('0x39')]);_0x234681[_0x2130('0x3e')]=_[_0x2130('0x3f')](_0x4971fc[_0x2130('0x3e')]);_0x234681[_0x2130('0x48')]=_['intersection'](_0x234681[_0x2130('0x3d')],_0x234681[_0x2130('0x3e')]);_0x59cc50[_0x2130('0x41')]=_['intersection'](_0x234681['model'],qs['fields'](_0x4971fc[_0x2130('0x3e')][_0x2130('0x42')]));_0x59cc50[_0x2130('0x41')]=_0x59cc50[_0x2130('0x41')][_0x2130('0x43')]?_0x59cc50['attributes']:_0x234681[_0x2130('0x3d')];if(_0x4971fc[_0x2130('0x3e')][_0x2130('0xb3')]){_0x59cc50[_0x2130('0xb4')]=[{'all':!![]}];}_0x59cc50=_[_0x2130('0xb5')]({},_0x59cc50,_0x4971fc[_0x2130('0xb6')]);return db[_0x2130('0x38')][_0x2130('0x60')](_0x59cc50)[_0x2130('0x2b')](handleEntityNotFound(_0x40714e,null))[_0x2130('0x2b')](respondWithResult(_0x40714e,null))[_0x2130('0xb1')](handleError(_0x40714e,null));};exports[_0x2130('0xb7')]=function(_0x403e39,_0x3c880a){return db[_0x2130('0x38')][_0x2130('0xb7')](_0x403e39[_0x2130('0x72')],{})['then'](respondWithResult(_0x3c880a,0xc9))[_0x2130('0xb1')](handleError(_0x3c880a,null));};exports['update']=function(_0x502f41,_0x48a557){if(_0x502f41['body']['id']){delete _0x502f41['body']['id'];}return db[_0x2130('0x38')][_0x2130('0x60')]({'where':{'id':_0x502f41[_0x2130('0xb2')]['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0x48a557,null))[_0x2130('0x2b')](saveUpdates(_0x502f41[_0x2130('0x72')],null))[_0x2130('0x2b')](respondWithResult(_0x48a557,null))[_0x2130('0xb1')](handleError(_0x48a557,null));};exports['destroy']=function(_0x145894,_0x3e6898){return db[_0x2130('0x38')][_0x2130('0x60')]({'where':{'id':_0x145894[_0x2130('0xb2')]['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0x3e6898,null))['then'](removeEntity(_0x3e6898,null))[_0x2130('0xb1')](handleError(_0x3e6898,null));};exports[_0x2130('0xb8')]=function(_0x27a502,_0x458eca){return db['OpenchannelInteraction'][_0x2130('0xb8')]()[_0x2130('0x2b')](respondWithResult(_0x458eca,null))[_0x2130('0xb1')](handleError(_0x458eca,null));};exports[_0x2130('0xb9')]=function(_0x2cd5a4,_0x136fa0,_0x5da679){return db[_0x2130('0xba')][_0x2130('0x60')]({'where':{'id':_0x2cd5a4[_0x2130('0xb2')]['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0x136fa0,null))[_0x2130('0x2b')](function(_0x25f92f){if(_0x25f92f){return _0x25f92f[_0x2130('0xb9')](_0x2cd5a4['body'][_0x2130('0xbb')],_[_0x2130('0xbc')](_0x2cd5a4[_0x2130('0x72')],[_0x2130('0xbb'),'id'])||{});}})[_0x2130('0x2b')](respondWithResult(_0x136fa0,null))['catch'](handleError(_0x136fa0,null));};exports['getMessages']=function(_0x22c76e,_0xe89b52,_0x4f3bb3){var _0x18795e={'raw':![],'where':{}};var _0x1f1e63={};var _0x2e19e6={'count':0x0,'rows':[]};return db[_0x2130('0x38')][_0x2130('0xbd')]({'where':{'id':_0x22c76e['params']['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0xe89b52,null))[_0x2130('0x2b')](function(_0x1bde2c){if(_0x1bde2c){_0x1f1e63[_0x2130('0x3d')]=_[_0x2130('0x3f')](db[_0x2130('0xba')][_0x2130('0x39')]);_0x1f1e63[_0x2130('0x3e')]=_[_0x2130('0x3f')](_0x22c76e[_0x2130('0x3e')]);_0x1f1e63[_0x2130('0x48')]=_[_0x2130('0x40')](_0x1f1e63[_0x2130('0x3d')],_0x1f1e63[_0x2130('0x3e')]);_0x18795e['attributes']=_[_0x2130('0x40')](_0x1f1e63[_0x2130('0x3d')],qs[_0x2130('0x42')](_0x22c76e[_0x2130('0x3e')][_0x2130('0x42')]));_0x18795e[_0x2130('0x41')]=_0x18795e[_0x2130('0x41')]['length']?_0x18795e[_0x2130('0x41')]:_0x1f1e63[_0x2130('0x3d')];if(!_0x22c76e[_0x2130('0x3e')][_0x2130('0x44')]('nolimit')){_0x18795e[_0x2130('0x21')]=qs[_0x2130('0x21')](_0x22c76e[_0x2130('0x3e')][_0x2130('0x21')]);_0x18795e[_0x2130('0x24')]=qs[_0x2130('0x24')](_0x22c76e[_0x2130('0x3e')][_0x2130('0x24')]);}_0x18795e[_0x2130('0x8e')]=qs[_0x2130('0x46')](_0x22c76e[_0x2130('0x3e')][_0x2130('0x46')]);_0x18795e[_0x2130('0x47')]=qs[_0x2130('0x48')](_[_0x2130('0x49')](_0x22c76e[_0x2130('0x3e')],_0x1f1e63['filters']));_0x18795e[_0x2130('0x47')]['OpenchannelInteractionId']=_0x1bde2c['id'];if(_0x22c76e[_0x2130('0x3e')]['filter']){_0x18795e['where']=_['merge'](_0x18795e['where'],{'$or':_[_0x2130('0x30')](_0x18795e[_0x2130('0x41')],function(_0x53f4c0){var _0x154975={};_0x154975[_0x53f4c0]={'$like':'%'+_0x22c76e[_0x2130('0x3e')][_0x2130('0x85')]+'%'};return _0x154975;})});}if(_0x22c76e[_0x2130('0x3e')][_0x2130('0x7a')]){var _0x55a69d=_0x22c76e[_0x2130('0x3e')][_0x2130('0x7a')][_0x2130('0x33')](',');var _0x551ae7={};_0x551ae7[_0x55a69d[0x0]]={'$gte':moment(_0x55a69d[0x1])[_0x2130('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x18795e[_0x2130('0x47')]=_[_0x2130('0xb5')](_0x18795e['where'],_0x551ae7);}_0x18795e=_['merge']({},_0x18795e,_0x22c76e[_0x2130('0xb6')]);return db[_0x2130('0xba')][_0x2130('0x23')]({'where':_0x18795e[_0x2130('0x47')]})[_0x2130('0x2b')](function(_0x1532b9){_0x2e19e6[_0x2130('0x23')]=_0x1532b9;if(_0x22c76e[_0x2130('0x3e')][_0x2130('0xb3')]){_0x18795e[_0x2130('0xb4')]=[{'all':!![]}];}return db[_0x2130('0xba')][_0x2130('0xbf')](_0x18795e);})[_0x2130('0x2b')](function(_0x5f1238){_0x2e19e6['rows']=_0x5f1238;return _0x2e19e6;});}})[_0x2130('0x2b')](respondWithFilteredResult(_0xe89b52,_0x18795e))[_0x2130('0xb1')](handleError(_0xe89b52,null));};exports[_0x2130('0xc0')]=function(_0x16831a,_0x12c553,_0x25892b){return db['OpenchannelInteraction'][_0x2130('0x60')]({'where':{'id':_0x16831a[_0x2130('0xb2')]['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0x12c553,null))[_0x2130('0x2b')](function(_0x351057){if(_0x351057){return _0x351057[_0x2130('0xc1')](_0x16831a['body']['ids'],_[_0x2130('0xbc')](_0x16831a[_0x2130('0x72')],[_0x2130('0xbb'),'id'])||{})['spread'](function(){return db[_0x2130('0x6c')][_0x2130('0xbf')]({'attributes':['id',_0x2130('0x2d'),_0x2130('0x4c')],'where':{'id':_0x16831a[_0x2130('0x72')][_0x2130('0xbb')]}});})[_0x2130('0x2b')](function(_0x52d4bc){socket['emit'](_0x2130('0xc2'),{'id':Number(_0x16831a[_0x2130('0xb2')]['id']),'tags':_0x52d4bc||[]});return{'id':Number(_0x16831a['params']['id']),'tags':_0x52d4bc||[]};});}})[_0x2130('0x2b')](respondWithResult(_0x12c553,null))['catch'](handleError(_0x12c553,null));};exports['removeTags']=function(_0xfacc6f,_0x23b744,_0x230960){return db[_0x2130('0x38')][_0x2130('0x60')]({'where':{'id':_0xfacc6f[_0x2130('0xb2')]['id']}})['then'](handleEntityNotFound(_0x23b744,null))[_0x2130('0x2b')](function(_0x3d053a){if(_0x3d053a){return _0x3d053a[_0x2130('0xc3')](_0xfacc6f[_0x2130('0x3e')][_0x2130('0xbb')]);}})[_0x2130('0x2b')](respondWithStatusCode(_0x23b744,null))['catch'](handleError(_0x23b744,null));};exports['download']=function(_0x4e0c00,_0x5c1af0){var _0x266bc4=moment()[_0x2130('0xc4')]()[_0x2130('0xad')]();var _0x471ca0=path['join'](config[_0x2130('0xc5')],_0x2130('0xc6'),_0x2130('0xc7'),_0x2130('0xc8'));var _0x3d163c=path['join'](config[_0x2130('0xc5')],_0x2130('0xc6'),_0x2130('0xc7'),_0x2130('0xc9'));var _0x443694=path[_0x2130('0xca')](_0x471ca0,_0x266bc4);var _0xe164d6=util['format'](_0x2130('0xcb'),_0x4e0c00['params']['id'],_0x266bc4);var _0x32b6e4=path[_0x2130('0xca')](_0x471ca0,_0xe164d6);var _0x1ca4cd=[];_0x1ca4cd[_0x2130('0x36')]({'model':db[_0x2130('0xcc')],'as':_0x2130('0xcc'),'attributes':['id','fullname'],'raw':!![]});_0x1ca4cd['push']({'model':db[_0x2130('0xcd')],'as':_0x2130('0xce'),'attributes':['id',_0x2130('0xcf'),_0x2130('0xd0')],'raw':!![]});if(_0x4e0c00[_0x2130('0x3e')][_0x2130('0xc9')]){_0x1ca4cd[_0x2130('0x36')]({'model':db[_0x2130('0xd1')],'as':_0x2130('0xd1'),'raw':!![]});}var _0x1a54a5=[{'model':db['OpenchannelMessage'],'as':_0x2130('0xd2'),'attributes':['id',_0x2130('0x72'),_0x2130('0x78'),_0x2130('0xd3'),_0x2130('0xd4'),_0x2130('0x80')],'include':_0x1ca4cd}];_0x1a54a5['push']({'model':db['OpenchannelAccount'],'as':_0x2130('0xd5'),'attributes':['id',_0x2130('0x2d')]});_0x1a54a5[_0x2130('0x36')]({'model':db[_0x2130('0xcc')],'as':_0x2130('0xd6'),'attributes':['id',_0x2130('0x31')]});return db[_0x2130('0x38')]['find']({'where':{'id':_0x4e0c00[_0x2130('0xb2')]['id']},'include':_0x1a54a5})[_0x2130('0x2b')](handleEntityNotFound(_0x5c1af0,null))[_0x2130('0x2b')](function(_0x29fdcc){if(_0x29fdcc){var _0x51aef2=_0x29fdcc['get']({'plain':!![]});fs[_0x2130('0xd7')](_0x443694);var _0x25a3fc={'channel':_0x2130('0xd8'),'account':_0x51aef2['Account']['name'],'agent':_0x51aef2[_0x2130('0xd6')]?_0x51aef2['Owner']['fullname']:_0x2130('0xd9'),'createdAt':moment(_0x51aef2[_0x2130('0x78')])['format'](_0x2130('0xda'))[_0x2130('0xad')](),'closedAt':_0x51aef2[_0x2130('0xdb')]?moment(_0x51aef2['closedAt'])[_0x2130('0xbe')](_0x2130('0xda'))['toString']():'','disposition':_0x51aef2[_0x2130('0xdc')],'visibility':_0x51aef2[_0x2130('0xdd')]?'Public':_0x2130('0xde'),'messages':_(_0x51aef2[_0x2130('0xd2')])[_0x2130('0x85')]({'secret':![]})[_0x2130('0x30')](function(_0x42e2ca){if(_0x42e2ca['Attachment']){var _0x4d7cd6=path[_0x2130('0xca')](_0x3d163c,_0x42e2ca['Attachment'][_0x2130('0xdf')]);if(fs['existsSync'](_0x4d7cd6)){fs[_0x2130('0xe0')](_0x4d7cd6)[_0x2130('0xe1')](fs[_0x2130('0xe2')](path[_0x2130('0xca')](_0x443694,_0x42e2ca[_0x2130('0xd1')][_0x2130('0xdf')])));}}return{'date':moment(_0x42e2ca[_0x2130('0x78')])[_0x2130('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2130('0xad')](),'sender':_0x42e2ca[_0x2130('0xd3')]==='out'?_0x42e2ca[_0x2130('0xcc')]?_0x42e2ca[_0x2130('0xcc')][_0x2130('0x31')]:_0x2130('0xe3'):_0x42e2ca[_0x2130('0xce')][_0x2130('0xcf')]+(_0x42e2ca[_0x2130('0xce')][_0x2130('0xd0')]?'\x20'+_0x42e2ca[_0x2130('0xce')]['lastName']:''),'body':_0x42e2ca[_0x2130('0xd1')]?_0x42e2ca[_0x2130('0xd1')][_0x2130('0xdf')]:_0x42e2ca[_0x2130('0x72')],'direction':_0x42e2ca[_0x2130('0xd3')]==='out'?'A':'C','secret':_0x42e2ca[_0x2130('0xd4')],'read':_0x42e2ca['read'],'attachment':_0x42e2ca[_0x2130('0xd1')]};})[_0x2130('0x62')]()};return ejs[_0x2130('0xe4')](path[_0x2130('0xca')](config[_0x2130('0xc5')],_0x2130('0xc6'),_0x2130('0xe5'),_0x2130('0xe6')),{'interaction':_0x25a3fc})[_0x2130('0x2b')](function(_0x27cfff){var _0x1c13ab=path['join'](_0x443694,'transcript-'+_0x51aef2['id']+'-'+_0x266bc4+_0x2130('0xe7'));var _0x5a7522={'path':_0x1c13ab,'channel':_0x2130('0xd8'),'interactionId':_0x51aef2['id']};return pdf['createPdfFromHTML'](_0x27cfff,_0x5a7522);})[_0x2130('0x2b')](function(){return new BPromise(function(_0x4b5433,_0x35d77a){zipdir(_0x443694,{'saveTo':_0x32b6e4},function(_0x545a78,_0x4c77a6){if(_0x545a78)return _0x35d77a(_0x545a78);return _0x4b5433(_0x4c77a6);});})[_0x2130('0x2b')](function(){return new BPromise(function(_0x2c641e,_0x1d3ea9){rimraf(_0x443694,function(_0x3a913e){if(_0x3a913e)_0x1d3ea9(_0x3a913e);return _0x2c641e();});});})[_0x2130('0x2b')](function(){return _0x5c1af0['download'](_0x32b6e4,_0xe164d6,function(_0x519eaf){if(_0x519eaf){console[_0x2130('0xe8')]('err',_0x519eaf);}else{fs[_0x2130('0xe9')](_0x32b6e4);}});});});}else{return _0x5c1af0[_0x2130('0x1d')](0xc8);}})[_0x2130('0xb1')](handleError(_0x5c1af0,null));}; \ No newline at end of file +var _0xfd06=['Content-Range','apply','reject','save','update','then','end','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','field','color','from','select','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','agent','toString','sequelize','keyBy','merge','OpenchannelInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','params','includeAll','include','options','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','pick','findAll','addTags','setTags','spread','emit','removeTags','download','unix','join','root','server','files','attachments','format','transcript-%d-%s.zip','User','fullname','CmContact','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','Openchannel','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','firstName','renderFile','views','transcript-','createPdfFromHTML','err','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x51a85c,_0x2660a3){var _0x55001f=function(_0x39ec46){while(--_0x39ec46){_0x51a85c['push'](_0x51a85c['shift']());}};_0x55001f(++_0x2660a3);}(_0xfd06,0xc8));var _0x6fd0=function(_0x51c39f,_0x5bfb0b){_0x51c39f=_0x51c39f-0x0;var _0x274221=_0xfd06[_0x51c39f];return _0x274221;};'use strict';var emlformat=require(_0x6fd0('0x0'));var rimraf=require(_0x6fd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fd0('0x2'));var rp=require('request-promise');var moment=require(_0x6fd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6fd0('0x4'));var util=require(_0x6fd0('0x5'));var path=require(_0x6fd0('0x6'));var sox=require('sox');var csv=require(_0x6fd0('0x7'));var ejs=require(_0x6fd0('0x8'));var fs=require('fs');var fs_extra=require(_0x6fd0('0x9'));var _=require(_0x6fd0('0xa'));var squel=require(_0x6fd0('0xb'));var crypto=require(_0x6fd0('0xc'));var jsforce=require(_0x6fd0('0xd'));var deskjs=require(_0x6fd0('0xe'));var toCsv=require(_0x6fd0('0x7'));var querystring=require(_0x6fd0('0xf'));var Papa=require(_0x6fd0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6fd0('0x11'));var pdf=require(_0x6fd0('0x12'));var hardwareService=require(_0x6fd0('0x13'));var logger=require(_0x6fd0('0x14'))(_0x6fd0('0x15'));var utils=require(_0x6fd0('0x16'));var config=require(_0x6fd0('0x17'));var licenseUtil=require(_0x6fd0('0x18'));var db=require('../../mysqldb')['db'];config[_0x6fd0('0x19')]=_[_0x6fd0('0x1a')](config[_0x6fd0('0x19')],{'host':_0x6fd0('0x1b'),'port':0x18eb});var socket=require(_0x6fd0('0x1c'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x6fd0('0x1d')](socket);function respondWithStatusCode(_0x422522,_0x38f47b){_0x38f47b=_0x38f47b||0xcc;return function(_0x3ed838){if(_0x3ed838){return _0x422522[_0x6fd0('0x1e')](_0x38f47b);}return _0x422522[_0x6fd0('0x1f')](_0x38f47b)['end']();};}function respondWithResult(_0x1d33c6,_0x27d8aa){_0x27d8aa=_0x27d8aa||0xc8;return function(_0x14655d){if(_0x14655d){return _0x1d33c6['status'](_0x27d8aa)[_0x6fd0('0x20')](_0x14655d);}};}function respondWithFilteredResult(_0x2a56dd,_0x1d6699){return function(_0x1b5190){if(_0x1b5190){var _0x1be395=typeof _0x1d6699[_0x6fd0('0x21')]===_0x6fd0('0x22')&&typeof _0x1d6699[_0x6fd0('0x23')]==='undefined';var _0x315d68=_0x1b5190[_0x6fd0('0x24')];var _0x19eba3=_0x1be395?0x0:_0x1d6699['offset'];var _0x71377=_0x1be395?_0x1b5190[_0x6fd0('0x24')]:_0x1d6699[_0x6fd0('0x21')]+_0x1d6699['limit'];var _0x1ae9b5;if(_0x71377>=_0x315d68){_0x71377=_0x315d68;_0x1ae9b5=0xc8;}else{_0x1ae9b5=0xce;}_0x2a56dd['status'](_0x1ae9b5);return _0x2a56dd[_0x6fd0('0x25')](_0x6fd0('0x26'),_0x19eba3+'-'+_0x71377+'/'+_0x315d68)[_0x6fd0('0x20')](_0x1b5190);}return null;};}function patchUpdates(_0x33b397){return function(_0x3b8f48){try{jsonpatch[_0x6fd0('0x27')](_0x3b8f48,_0x33b397,!![]);}catch(_0x487100){return BPromise[_0x6fd0('0x28')](_0x487100);}return _0x3b8f48[_0x6fd0('0x29')]();};}function saveUpdates(_0x2e2fd5,_0x1b1a79){return function(_0x285e42){if(_0x285e42){return _0x285e42[_0x6fd0('0x2a')](_0x2e2fd5)[_0x6fd0('0x2b')](function(_0x823aa3){return _0x823aa3;});}return null;};}function removeEntity(_0x4eff49,_0x2bcb0e){return function(_0x3bcde8){if(_0x3bcde8){return _0x3bcde8['destroy']()[_0x6fd0('0x2b')](function(){_0x4eff49['status'](0xcc)[_0x6fd0('0x2c')]();});}};}function handleEntityNotFound(_0x59bb16,_0x2fc1e6){return function(_0x5b5b73){if(!_0x5b5b73){_0x59bb16[_0x6fd0('0x1e')](0x194);}return _0x5b5b73;};}function handleError(_0x59a6bf,_0x3fbbd4){_0x3fbbd4=_0x3fbbd4||0x1f4;return function(_0x423f44){logger[_0x6fd0('0x2d')](_0x423f44[_0x6fd0('0x2e')]);if(_0x423f44[_0x6fd0('0x2f')]){delete _0x423f44[_0x6fd0('0x2f')];}_0x59a6bf[_0x6fd0('0x1f')](_0x3fbbd4)[_0x6fd0('0x30')](_0x423f44);};}function getInteractionUsers(_0x1fc933,_0x7d93e3){return new BPromise(function(_0x18e730,_0x266385){try{if(_0x7d93e3[_0x1fc933['id']]){_0x1fc933[_0x6fd0('0x31')]=_[_0x6fd0('0x32')](_0x7d93e3[_0x1fc933['id']],function(_0x13c310){return{'id':_0x13c310['id'],'fullname':_0x13c310['fullname']};});}}catch(_0x4f4639){_0x266385(_0x4f4639);}_0x18e730(_0x1fc933);});}function getInteractionTags(_0x233394,_0x3d52ab){return new BPromise(function(_0x5d1e49,_0x5b2be0){try{if(_0x233394[_0x6fd0('0x33')]){_0x233394[_0x6fd0('0x34')]=[];_0x233394[_0x6fd0('0x33')][_0x6fd0('0x35')](',')[_0x6fd0('0x36')](function(_0x55caf2){_0x233394[_0x6fd0('0x34')][_0x6fd0('0x37')](_0x3d52ab[_0x55caf2]);});}delete _0x233394[_0x6fd0('0x33')];}catch(_0x4351bd){_0x5b2be0(_0x4351bd);}_0x5d1e49(_0x233394);});}function updateOpenchannelInteraction(_0x50245b,_0xa0470a,_0x229079){return new BPromise(function(_0x1e5a58,_0x52a179){return getInteractionUsers(_0x50245b,_0x229079)['then'](function(_0x22c544){return getInteractionTags(_0x22c544,_0xa0470a);})[_0x6fd0('0x2b')](function(_0x1b11d7){_0x1e5a58(_0x1b11d7);})[_0x6fd0('0x38')](function(_0x341612){_0x52a179(_0x341612);});});}exports[_0x6fd0('0x39')]=function(_0x2d8d1d,_0x172492){var _0x5d23b7={},_0x2e9ef3={},_0x5b212f={'count':0x0,'rows':[]};var _0x502f1f=_['map'](db['OpenchannelInteraction'][_0x6fd0('0x3a')],function(_0x51e666){return{'name':_0x51e666['fieldName'],'type':_0x51e666[_0x6fd0('0x3b')][_0x6fd0('0x3c')]};});_0x2e9ef3[_0x6fd0('0x3d')]=_['map'](_0x502f1f,_0x6fd0('0x2f'));_0x2e9ef3['query']=_[_0x6fd0('0x3e')](_0x2d8d1d[_0x6fd0('0x3f')]);_0x2e9ef3[_0x6fd0('0x40')]=_[_0x6fd0('0x41')](_0x2e9ef3[_0x6fd0('0x3d')],_0x2e9ef3[_0x6fd0('0x3f')]);_0x5d23b7[_0x6fd0('0x42')]=_[_0x6fd0('0x41')](_0x2e9ef3[_0x6fd0('0x3d')],qs['fields'](_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x43')]));_0x5d23b7[_0x6fd0('0x42')]=_0x5d23b7[_0x6fd0('0x42')][_0x6fd0('0x44')]?_0x5d23b7[_0x6fd0('0x42')]:_0x2e9ef3['model'];if(!_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x45')](_0x6fd0('0x46'))){_0x5d23b7[_0x6fd0('0x23')]=qs[_0x6fd0('0x23')](_0x2d8d1d[_0x6fd0('0x3f')]['limit']);_0x5d23b7[_0x6fd0('0x21')]=qs[_0x6fd0('0x21')](_0x2d8d1d[_0x6fd0('0x3f')]['offset']);}_0x5d23b7['order']=qs['sort'](_0x2d8d1d['query'][_0x6fd0('0x47')]);_0x5d23b7[_0x6fd0('0x48')]=qs[_0x6fd0('0x40')](_['pick'](_0x2d8d1d[_0x6fd0('0x3f')],_0x2e9ef3[_0x6fd0('0x40')]),_0x502f1f);var _0x1df0c9=[];var _0x229ee5=squel['select']()['field']('id')['field']('name')[_0x6fd0('0x49')](_0x6fd0('0x4a'))[_0x6fd0('0x4b')]('tools_tags');var _0x307eee=squel[_0x6fd0('0x4c')]()[_0x6fd0('0x49')]('u.id')[_0x6fd0('0x49')](_0x6fd0('0x4d'))[_0x6fd0('0x49')](_0x6fd0('0x4e'))['from'](_0x6fd0('0x4f'),'ui')[_0x6fd0('0x50')](_0x6fd0('0x51'),'u',_0x6fd0('0x52'));var _0x583ee9=squel[_0x6fd0('0x4c')]()[_0x6fd0('0x4b')]('openchannel_interactions','i')[_0x6fd0('0x50')](_0x6fd0('0x53'),'c',_0x6fd0('0x54'))[_0x6fd0('0x50')](_0x6fd0('0x51'),'o',_0x6fd0('0x55'))['left_join']('openchannel_accounts','a',_0x6fd0('0x56'))[_0x6fd0('0x50')](_0x6fd0('0x57'),'me',_0x6fd0('0x58'))['left_join'](_0x6fd0('0x59'),'it',_0x6fd0('0x5a'))[_0x6fd0('0x50')](_0x6fd0('0x5b'),'t','t.id\x20=\x20it.TagId');var _0x3ed7d6=squel[_0x6fd0('0x5c')]();var _0x598ffa=[];var _0x401b5b=squel[_0x6fd0('0x5c')]();var _0x58475b;if(_0x2d8d1d['query']['search']){_0x58475b=as[_0x6fd0('0x5d')](_0x2d8d1d['query']['search']);var _0x34235e=_0x58475b[_0x6fd0('0x5e')];for(var _0xdb686f=0x0;_0xdb686f<_0x58475b[_0x6fd0('0x5f')]['length'];_0xdb686f++){var _0x2bfcc9=_0x58475b[_0x6fd0('0x5f')][_0xdb686f];var _0x2e4bf5='i';var _0x5e59be=_[_0x6fd0('0x60')](_0x502f1f,[_0x6fd0('0x2f'),_0x2bfcc9[_0x6fd0('0x49')]]);if(!_0x5e59be){switch(_0x2bfcc9[_0x6fd0('0x49')]){case _0x6fd0('0x61'):if(_0x2bfcc9[_0x6fd0('0x62')]==0x1){_0x583ee9[_0x6fd0('0x63')]('`'+_0x2bfcc9[_0x6fd0('0x49')]+_0x6fd0('0x64'));}else{_0x583ee9[_0x6fd0('0x63')]('`'+_0x2bfcc9[_0x6fd0('0x49')]+'`\x20>\x200');}break;case _0x6fd0('0x65'):if(_0x2bfcc9['operator']===_0x6fd0('0x66')){if(_0x2bfcc9[_0x6fd0('0x62')][_0x6fd0('0x35')]('\x20')[_0x6fd0('0x44')]>0x1){_0x3ed7d6[_0x34235e](_0x6fd0('0x67'),qs[_0x6fd0('0x68')](_0x2bfcc9[_0x6fd0('0x62')]),null);}else{var _0xf8b8a4='%'+_0x2bfcc9[_0x6fd0('0x62')]+'%';_0x3ed7d6[_0x34235e](_0x6fd0('0x69'),_0xf8b8a4,_0xf8b8a4,_0xf8b8a4);}}else{_0x5e59be=_[_0x6fd0('0x60')](_0x502f1f,[_0x6fd0('0x2f'),_0x6fd0('0x6a')]);_0x2bfcc9['field']=_0x6fd0('0x6a');_0x50a6b2=as[_0x6fd0('0x6b')](_0x2e4bf5,_0x5e59be[_0x6fd0('0x3b')],_0x2bfcc9);_0x3ed7d6[_0x34235e](_0x50a6b2[_0x6fd0('0x6c')],_0x50a6b2[_0x6fd0('0x62')][_0x6fd0('0x6d')],_0x50a6b2['value']['end']);}break;case _0x6fd0('0x6e'):var _0x6dc93f=_0x2bfcc9[_0x6fd0('0x62')][_0x6fd0('0x35')](',')[_0x6fd0('0x32')](function(_0x18ae98){return Number(_0x18ae98);});_0x6dc93f[_0x6fd0('0x36')](function(_0x14c3c9){_0x401b5b['or'](_0x6fd0('0x6f'),'%,'+_0x14c3c9+',%');});_0x598ffa=_[_0x6fd0('0x70')](_0x598ffa,_0x6dc93f);break;case'User':if(_0x2bfcc9[_0x6fd0('0x71')]===_0x6fd0('0x66')){_0x3ed7d6[_0x34235e](_0x6fd0('0x72'),'%'+_0x2bfcc9['value']+'%',null);}else{_0x5e59be=_[_0x6fd0('0x60')](_0x502f1f,['name',_0x6fd0('0x73')]);_0x2bfcc9[_0x6fd0('0x49')]='UserId';_0x50a6b2=as[_0x6fd0('0x6b')](_0x2e4bf5,_0x5e59be[_0x6fd0('0x3b')],_0x2bfcc9);_0x3ed7d6[_0x34235e](_0x50a6b2[_0x6fd0('0x6c')],_0x50a6b2[_0x6fd0('0x62')][_0x6fd0('0x6d')],_0x50a6b2[_0x6fd0('0x62')][_0x6fd0('0x2c')]);}break;case'body':_0x50a6b2=as[_0x6fd0('0x6b')]('me',null,_0x2bfcc9);_0x3ed7d6[_0x34235e](_0x50a6b2[_0x6fd0('0x6c')],_0x50a6b2['value'][_0x6fd0('0x6d')],_0x50a6b2[_0x6fd0('0x62')][_0x6fd0('0x2c')]);break;}}else{var _0x50a6b2=as[_0x6fd0('0x6b')](_0x2e4bf5,_0x5e59be[_0x6fd0('0x3b')],_0x2bfcc9);_0x3ed7d6[_0x34235e](_0x50a6b2[_0x6fd0('0x6c')],_0x50a6b2[_0x6fd0('0x62')]['start'],_0x50a6b2[_0x6fd0('0x62')][_0x6fd0('0x2c')]);}}}else{var _0x2c10ac=_(_0x2d8d1d[_0x6fd0('0x3f')])[_0x6fd0('0x3e')]()[_0x6fd0('0x32')](function(_0x1a27ef){return _[_0x6fd0('0x74')](_0x502f1f,[_0x6fd0('0x2f'),_0x1a27ef])?_0x1a27ef:undefined;})['compact']()[_0x6fd0('0x62')]();if(!_[_0x6fd0('0x75')](_0x2c10ac)){_0x2c10ac[_0x6fd0('0x36')](function(_0x561b3d){if(_0x561b3d===_0x6fd0('0x76')){_0x583ee9[_0x6fd0('0x48')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x6fd0('0x77')](_0x2d8d1d[_0x6fd0('0x3f')][_0x561b3d]));}else if(_0x561b3d===_0x6fd0('0x78')){var _0x23bfed=JSON[_0x6fd0('0x79')](_0x2d8d1d['query'][_0x561b3d])[_0x6fd0('0x7a')];var _0x2cf51a=JSON[_0x6fd0('0x79')](_0x2d8d1d[_0x6fd0('0x3f')][_0x561b3d])[_0x6fd0('0x7b')];_0x583ee9[_0x6fd0('0x48')](_0x6fd0('0x7c'),_0x23bfed,_0x2cf51a);}else{if(_0x2d8d1d['query'][_0x561b3d]===_0x6fd0('0x7d')){_0x583ee9[_0x6fd0('0x48')]('i.'+_0x561b3d+_0x6fd0('0x7e'));}else{_0x583ee9[_0x6fd0('0x48')]('i.'+_0x561b3d+'\x20=\x20?',_0x2d8d1d['query'][_0x561b3d]);}}});}if(_0x2d8d1d[_0x6fd0('0x3f')]['read']){if(_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x7f')]==0x1){_0x583ee9[_0x6fd0('0x63')](_0x6fd0('0x80'));}else{_0x583ee9[_0x6fd0('0x63')]('`unreadMessages`\x20>\x200');}}if(_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x81')]){_0x598ffa=_[_0x6fd0('0x82')](_0x2d8d1d[_0x6fd0('0x3f')]['tag'])?_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x81')]:new Array(_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x81')]);_0x598ffa[_0x6fd0('0x36')](function(_0x78cd9b){_0x401b5b['or'](_0x6fd0('0x6f'),'%,'+_0x78cd9b+',%');});}if(_0x2d8d1d['query'][_0x6fd0('0x83')]){var _0x4503bc=_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x83')][_0x6fd0('0x84')]('\x5c','\x5c\x5c')[_0x6fd0('0x84')](/'/g,'\x27\x27');if(qs[_0x6fd0('0x85')](_0x4503bc)){_0x3ed7d6['or'](_0x6fd0('0x86'),_0x4503bc+'%');}else{_0x3ed7d6['or'](_0x6fd0('0x87'),qs[_0x6fd0('0x68')](_0x4503bc))['or'](_0x6fd0('0x88'),_0x4503bc+'%')['or'](_0x6fd0('0x89'),_0x4503bc+'%');}}}_0x583ee9['where'](_0x3ed7d6);_0x583ee9[_0x6fd0('0x8a')](_0x6fd0('0x8b'));var _0x5de00e={'type':db['Sequelize'][_0x6fd0('0x8c')][_0x6fd0('0x8d')],'raw':!![]};var _0x4fba16=_0x583ee9['clone']();_0x4fba16[_0x6fd0('0x49')](_0x6fd0('0x8b'));_0x4fba16[_0x6fd0('0x49')](_0x6fd0('0x8e'),_0x6fd0('0x61'));if(_0x5d23b7[_0x6fd0('0x8f')]){_0x5d23b7[_0x6fd0('0x8f')][_0x6fd0('0x36')](function(_0xe5a1d0){var _0x276fd6=_0xe5a1d0[0x0]===_0x6fd0('0x90')?_0xe5a1d0[0x0]:'i.'+_0xe5a1d0[0x0];_0x583ee9[_0x6fd0('0x8f')](_0x276fd6,_0xe5a1d0[0x1]===_0x6fd0('0x91')?![]:!![]);});}if(!_[_0x6fd0('0x75')](_0x598ffa)){_0x583ee9[_0x6fd0('0x63')](_0x401b5b);_0x4fba16[_0x6fd0('0x48')]('t.id\x20IN\x20?',_0x598ffa);}BPromise[_0x6fd0('0x92')]()[_0x6fd0('0x2b')](function(){if(!_0x58475b){if(_0x2d8d1d[_0x6fd0('0x3f')]['OpenchannelAccountId'])return;_0x4fba16['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x583ee9[_0x6fd0('0x48')](_0x6fd0('0x93'));return;}if(_0x2d8d1d['user'][_0x6fd0('0x94')]!=='agent')return;return _0x2d8d1d[_0x6fd0('0x95')][_0x6fd0('0x96')]({'attributes':['id'],'raw':!![]})[_0x6fd0('0x2b')](function(_0x1c3cbd){if(_['isEmpty'](_0x1c3cbd)){_0x4fba16[_0x6fd0('0x48')](_0x6fd0('0x97'));_0x583ee9[_0x6fd0('0x48')](_0x6fd0('0x97'));}else{_0x4fba16[_0x6fd0('0x48')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x6fd0('0x32')](_0x1c3cbd,'id'));_0x583ee9[_0x6fd0('0x48')](_0x6fd0('0x98'),_['map'](_0x1c3cbd,'id'));}});})[_0x6fd0('0x2b')](function(){if(_0x2d8d1d[_0x6fd0('0x95')]['role']===_0x6fd0('0x99')&&!_0x58475b&&!_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x76')])return[];return db['sequelize']['query'](_0x4fba16[_0x6fd0('0x9a')](),_0x5de00e);})[_0x6fd0('0x2b')](function(_0x2db76d){_0x5b212f['count']=_0x2db76d[_0x6fd0('0x44')];if(_0x5b212f['count']===0x0)return[];return db[_0x6fd0('0x9b')][_0x6fd0('0x3f')](_0x229ee5['toString'](),_0x5de00e)[_0x6fd0('0x2b')](function(_0x264baa){_0x1df0c9=_[_0x6fd0('0x9c')](_0x264baa,'id');_0x5de00e=_[_0x6fd0('0x9d')](_0x5de00e,{'model':db[_0x6fd0('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d8d1d[_0x6fd0('0x3f')][_0x6fd0('0x43')]){_0x5d23b7[_0x6fd0('0x42')]['forEach'](function(_0x5b0e98){_0x583ee9['field']('i.'+_0x5b0e98);});}else{_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0x8e'),_0x6fd0('0x61'));_0x583ee9[_0x6fd0('0x49')]('a.key',_0x6fd0('0x9f'));_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0xa0'),_0x6fd0('0xa1'));_0x583ee9['field'](_0x6fd0('0xa2'),_0x6fd0('0x90'));_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0xa3'));_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0xa4'),'Contact.firstName');_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0xa5'),'Contact.lastName');_0x583ee9['field'](_0x6fd0('0xa6'),'Contact.email');_0x583ee9[_0x6fd0('0x49')]('c.phone',_0x6fd0('0xa7'));_0x583ee9['field']('c.mobile',_0x6fd0('0xa8'));_0x583ee9['field'](_0x6fd0('0xa9'),_0x6fd0('0xaa'));_0x583ee9[_0x6fd0('0x49')](_0x6fd0('0xab'),_0x6fd0('0xac'));_0x583ee9[_0x6fd0('0x49')]('o.internal',_0x6fd0('0xad'));_0x583ee9['field'](_0x6fd0('0xae'),'TagIds');}if(_0x5d23b7['limit'])_0x583ee9['limit'](_0x5d23b7['limit']);if(_0x5d23b7[_0x6fd0('0x21')])_0x583ee9[_0x6fd0('0x21')](_0x5d23b7[_0x6fd0('0x21')]);return db['sequelize']['query'](_0x583ee9[_0x6fd0('0x9a')](),_0x5de00e);})['then'](function(_0x586779){if(_0x586779[_0x6fd0('0x44')]>0x0)_0x307eee[_0x6fd0('0x48')](_0x6fd0('0xaf'),_[_0x6fd0('0x32')](_0x586779,'id'));return db[_0x6fd0('0x9b')][_0x6fd0('0x3f')](_0x307eee[_0x6fd0('0x9a')](),_0x5de00e)[_0x6fd0('0x2b')](function(_0x2349f7){var _0x13a5bd=_[_0x6fd0('0xb0')](_0x2349f7,_0x6fd0('0xb1'));var _0x3f30c7=[];_0x586779[_0x6fd0('0x36')](function(_0x3afc96){_0x3f30c7['push'](updateOpenchannelInteraction(_0x3afc96,_0x1df0c9,_0x13a5bd));});return BPromise['all'](_0x3f30c7);});});})['then'](function(_0x200d6e){_0x5b212f[_0x6fd0('0xb2')]=_0x200d6e;return _0x5b212f;})[_0x6fd0('0x2b')](respondWithFilteredResult(_0x172492,_0x5d23b7))['catch'](handleError(_0x172492,null));};exports[_0x6fd0('0xb3')]=function(_0x9e50f,_0x2732f7){var _0x4ec999={};if(_0x9e50f[_0x6fd0('0x3f')]['type']&&_0x9e50f[_0x6fd0('0x3f')]['type']===_0x6fd0('0x4b')){_0x4ec999[_0x6fd0('0x4b')]=_0x9e50f[_0x6fd0('0xb4')]['id'];}else{_0x4ec999['id']=_0x9e50f[_0x6fd0('0xb4')]['id'];}var _0x4f7f34={'raw':![],'where':_0x4ec999},_0x5e4198={};_0x5e4198[_0x6fd0('0x3d')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x5e4198['query']=_[_0x6fd0('0x3e')](_0x9e50f['query']);_0x5e4198[_0x6fd0('0x40')]=_[_0x6fd0('0x41')](_0x5e4198[_0x6fd0('0x3d')],_0x5e4198[_0x6fd0('0x3f')]);_0x4f7f34[_0x6fd0('0x42')]=_['intersection'](_0x5e4198['model'],qs['fields'](_0x9e50f[_0x6fd0('0x3f')][_0x6fd0('0x43')]));_0x4f7f34['attributes']=_0x4f7f34[_0x6fd0('0x42')][_0x6fd0('0x44')]?_0x4f7f34['attributes']:_0x5e4198['model'];if(_0x9e50f[_0x6fd0('0x3f')][_0x6fd0('0xb5')]){_0x4f7f34[_0x6fd0('0xb6')]=[{'all':!![]}];}_0x4f7f34=_['merge']({},_0x4f7f34,_0x9e50f[_0x6fd0('0xb7')]);return db['OpenchannelInteraction'][_0x6fd0('0x60')](_0x4f7f34)[_0x6fd0('0x2b')](handleEntityNotFound(_0x2732f7,null))['then'](respondWithResult(_0x2732f7,null))[_0x6fd0('0x38')](handleError(_0x2732f7,null));};exports['create']=function(_0x3a3ba5,_0x19fcc2){return db[_0x6fd0('0x9e')]['create'](_0x3a3ba5[_0x6fd0('0xb8')],{})['then'](respondWithResult(_0x19fcc2,0xc9))[_0x6fd0('0x38')](handleError(_0x19fcc2,null));};exports[_0x6fd0('0x2a')]=function(_0x14409e,_0xb2c4c9){if(_0x14409e['body']['id']){delete _0x14409e[_0x6fd0('0xb8')]['id'];}return db[_0x6fd0('0x9e')][_0x6fd0('0x60')]({'where':{'id':_0x14409e[_0x6fd0('0xb4')]['id']}})[_0x6fd0('0x2b')](handleEntityNotFound(_0xb2c4c9,null))['then'](saveUpdates(_0x14409e[_0x6fd0('0xb8')],null))[_0x6fd0('0x2b')](respondWithResult(_0xb2c4c9,null))[_0x6fd0('0x38')](handleError(_0xb2c4c9,null));};exports['destroy']=function(_0x5f9ac,_0x2a4604){return db[_0x6fd0('0x9e')]['find']({'where':{'id':_0x5f9ac[_0x6fd0('0xb4')]['id']}})[_0x6fd0('0x2b')](handleEntityNotFound(_0x2a4604,null))['then'](removeEntity(_0x2a4604,null))['catch'](handleError(_0x2a4604,null));};exports['describe']=function(_0x350ba4,_0x52a7a){return db['OpenchannelInteraction'][_0x6fd0('0xb9')]()[_0x6fd0('0x2b')](respondWithResult(_0x52a7a,null))[_0x6fd0('0x38')](handleError(_0x52a7a,null));};exports[_0x6fd0('0xba')]=function(_0x14a1a0,_0x53409e,_0x31a83e){return db[_0x6fd0('0xbb')]['find']({'where':{'id':_0x14a1a0[_0x6fd0('0xb4')]['id']}})['then'](handleEntityNotFound(_0x53409e,null))['then'](function(_0x2c4520){if(_0x2c4520){return _0x2c4520['addMessage'](_0x14a1a0['body'][_0x6fd0('0xbc')],_[_0x6fd0('0xbd')](_0x14a1a0[_0x6fd0('0xb8')],[_0x6fd0('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x53409e,null))[_0x6fd0('0x38')](handleError(_0x53409e,null));};exports[_0x6fd0('0xbe')]=function(_0x4cc0fc,_0x5a75aa,_0x3eb423){var _0xf7d691={'raw':![],'where':{}};var _0x4b191e={};var _0x32663f={'count':0x0,'rows':[]};return db[_0x6fd0('0x9e')][_0x6fd0('0xbf')]({'where':{'id':_0x4cc0fc[_0x6fd0('0xb4')]['id']}})[_0x6fd0('0x2b')](handleEntityNotFound(_0x5a75aa,null))[_0x6fd0('0x2b')](function(_0x44cfc1){if(_0x44cfc1){_0x4b191e[_0x6fd0('0x3d')]=_[_0x6fd0('0x3e')](db[_0x6fd0('0xbb')]['rawAttributes']);_0x4b191e['query']=_[_0x6fd0('0x3e')](_0x4cc0fc[_0x6fd0('0x3f')]);_0x4b191e['filters']=_[_0x6fd0('0x41')](_0x4b191e[_0x6fd0('0x3d')],_0x4b191e[_0x6fd0('0x3f')]);_0xf7d691[_0x6fd0('0x42')]=_[_0x6fd0('0x41')](_0x4b191e[_0x6fd0('0x3d')],qs[_0x6fd0('0x43')](_0x4cc0fc['query']['fields']));_0xf7d691[_0x6fd0('0x42')]=_0xf7d691[_0x6fd0('0x42')][_0x6fd0('0x44')]?_0xf7d691[_0x6fd0('0x42')]:_0x4b191e[_0x6fd0('0x3d')];if(!_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x45')](_0x6fd0('0x46'))){_0xf7d691[_0x6fd0('0x23')]=qs[_0x6fd0('0x23')](_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x23')]);_0xf7d691['offset']=qs[_0x6fd0('0x21')](_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x21')]);}_0xf7d691[_0x6fd0('0x8f')]=qs[_0x6fd0('0x47')](_0x4cc0fc['query'][_0x6fd0('0x47')]);_0xf7d691[_0x6fd0('0x48')]=qs[_0x6fd0('0x40')](_[_0x6fd0('0xc0')](_0x4cc0fc[_0x6fd0('0x3f')],_0x4b191e[_0x6fd0('0x40')]));_0xf7d691[_0x6fd0('0x48')]['OpenchannelInteractionId']=_0x44cfc1['id'];if(_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x83')]){_0xf7d691[_0x6fd0('0x48')]=_[_0x6fd0('0x9d')](_0xf7d691[_0x6fd0('0x48')],{'$or':_[_0x6fd0('0x32')](_0xf7d691[_0x6fd0('0x42')],function(_0x1da565){var _0x5b60dc={};_0x5b60dc[_0x1da565]={'$like':'%'+_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x83')]+'%'};return _0x5b60dc;})});}if(_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x7a')]){var _0x48adf1=_0x4cc0fc[_0x6fd0('0x3f')][_0x6fd0('0x7a')][_0x6fd0('0x35')](',');var _0x59b9fb={};_0x59b9fb[_0x48adf1[0x0]]={'$gte':moment(_0x48adf1[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xf7d691[_0x6fd0('0x48')]=_[_0x6fd0('0x9d')](_0xf7d691[_0x6fd0('0x48')],_0x59b9fb);}_0xf7d691=_[_0x6fd0('0x9d')]({},_0xf7d691,_0x4cc0fc[_0x6fd0('0xb7')]);return db[_0x6fd0('0xbb')][_0x6fd0('0x24')]({'where':_0xf7d691['where']})[_0x6fd0('0x2b')](function(_0x5bd4ce){_0x32663f['count']=_0x5bd4ce;if(_0x4cc0fc[_0x6fd0('0x3f')]['includeAll']){_0xf7d691[_0x6fd0('0xb6')]=[{'all':!![]}];}return db[_0x6fd0('0xbb')][_0x6fd0('0xc1')](_0xf7d691);})[_0x6fd0('0x2b')](function(_0x356b83){_0x32663f[_0x6fd0('0xb2')]=_0x356b83;return _0x32663f;});}})[_0x6fd0('0x2b')](respondWithFilteredResult(_0x5a75aa,_0xf7d691))[_0x6fd0('0x38')](handleError(_0x5a75aa,null));};exports[_0x6fd0('0xc2')]=function(_0x3e0d9e,_0x4063a1,_0x574a20){return db[_0x6fd0('0x9e')]['find']({'where':{'id':_0x3e0d9e['params']['id']}})[_0x6fd0('0x2b')](handleEntityNotFound(_0x4063a1,null))[_0x6fd0('0x2b')](function(_0x1293da){if(_0x1293da){return _0x1293da[_0x6fd0('0xc3')](_0x3e0d9e[_0x6fd0('0xb8')][_0x6fd0('0xbc')],_['omit'](_0x3e0d9e['body'],[_0x6fd0('0xbc'),'id'])||{})[_0x6fd0('0xc4')](function(){return db[_0x6fd0('0x6e')][_0x6fd0('0xc1')]({'attributes':['id',_0x6fd0('0x2f'),'color'],'where':{'id':_0x3e0d9e[_0x6fd0('0xb8')][_0x6fd0('0xbc')]}});})[_0x6fd0('0x2b')](function(_0x55830f){socket[_0x6fd0('0xc5')]('openchannelInteractionTags:save',{'id':Number(_0x3e0d9e[_0x6fd0('0xb4')]['id']),'tags':_0x55830f||[]});return{'id':Number(_0x3e0d9e[_0x6fd0('0xb4')]['id']),'tags':_0x55830f||[]};});}})[_0x6fd0('0x2b')](respondWithResult(_0x4063a1,null))['catch'](handleError(_0x4063a1,null));};exports[_0x6fd0('0xc6')]=function(_0x440b71,_0x28f495,_0x21cbab){return db[_0x6fd0('0x9e')]['find']({'where':{'id':_0x440b71[_0x6fd0('0xb4')]['id']}})[_0x6fd0('0x2b')](handleEntityNotFound(_0x28f495,null))[_0x6fd0('0x2b')](function(_0x4d0d13){if(_0x4d0d13){return _0x4d0d13['removeTags'](_0x440b71[_0x6fd0('0x3f')]['ids']);}})[_0x6fd0('0x2b')](respondWithStatusCode(_0x28f495,null))[_0x6fd0('0x38')](handleError(_0x28f495,null));};exports[_0x6fd0('0xc7')]=function(_0xe584db,_0x2b8ea7){var _0x56f0d4=moment()[_0x6fd0('0xc8')]()[_0x6fd0('0x9a')]();var _0x29f58c=path[_0x6fd0('0xc9')](config[_0x6fd0('0xca')],_0x6fd0('0xcb'),_0x6fd0('0xcc'),'tmp');var _0x2e5732=path['join'](config[_0x6fd0('0xca')],_0x6fd0('0xcb'),_0x6fd0('0xcc'),_0x6fd0('0xcd'));var _0x1a9378=path['join'](_0x29f58c,_0x56f0d4);var _0x2912a4=util[_0x6fd0('0xce')](_0x6fd0('0xcf'),_0xe584db[_0x6fd0('0xb4')]['id'],_0x56f0d4);var _0x1b46d3=path[_0x6fd0('0xc9')](_0x29f58c,_0x2912a4);var _0x3e1b43=[];_0x3e1b43[_0x6fd0('0x37')]({'model':db['User'],'as':_0x6fd0('0xd0'),'attributes':['id',_0x6fd0('0xd1')],'raw':!![]});_0x3e1b43[_0x6fd0('0x37')]({'model':db[_0x6fd0('0xd2')],'as':'Contact','attributes':['id','firstName',_0x6fd0('0xd3')],'raw':!![]});if(_0xe584db[_0x6fd0('0x3f')][_0x6fd0('0xcd')]){_0x3e1b43['push']({'model':db[_0x6fd0('0xd4')],'as':'Attachment','raw':!![]});}var _0x131631=[{'model':db[_0x6fd0('0xbb')],'as':_0x6fd0('0xd5'),'attributes':['id',_0x6fd0('0xb8'),_0x6fd0('0x78'),'direction',_0x6fd0('0xd6'),_0x6fd0('0x7f')],'include':_0x3e1b43}];_0x131631['push']({'model':db[_0x6fd0('0xd7')],'as':_0x6fd0('0xd8'),'attributes':['id',_0x6fd0('0x2f')]});_0x131631['push']({'model':db[_0x6fd0('0xd0')],'as':'Owner','attributes':['id','fullname']});return db[_0x6fd0('0x9e')][_0x6fd0('0x60')]({'where':{'id':_0xe584db[_0x6fd0('0xb4')]['id']},'include':_0x131631})[_0x6fd0('0x2b')](handleEntityNotFound(_0x2b8ea7,null))['then'](function(_0x330a2f){if(_0x330a2f){var _0xe392bb=_0x330a2f['get']({'plain':!![]});fs['mkdirSync'](_0x1a9378);var _0x12e546={'channel':_0x6fd0('0xd9'),'account':_0xe392bb[_0x6fd0('0xd8')]['name'],'agent':_0xe392bb['Owner']?_0xe392bb[_0x6fd0('0xda')][_0x6fd0('0xd1')]:_0x6fd0('0xdb'),'createdAt':moment(_0xe392bb[_0x6fd0('0x78')])[_0x6fd0('0xce')](_0x6fd0('0xdc'))[_0x6fd0('0x9a')](),'closedAt':_0xe392bb[_0x6fd0('0xdd')]?moment(_0xe392bb[_0x6fd0('0xde')])[_0x6fd0('0xce')](_0x6fd0('0xdc'))['toString']():'','disposition':_0xe392bb['disposition'],'visibility':_0xe392bb[_0x6fd0('0xdf')]?'Public':'Private','messages':_(_0xe392bb[_0x6fd0('0xd5')])[_0x6fd0('0x83')]({'secret':![]})[_0x6fd0('0x32')](function(_0x179c02){if(_0x179c02[_0x6fd0('0xd4')]){var _0x23bc0d=path['join'](_0x2e5732,_0x179c02[_0x6fd0('0xd4')][_0x6fd0('0xe0')]);if(fs[_0x6fd0('0xe1')](_0x23bc0d)){fs[_0x6fd0('0xe2')](_0x23bc0d)[_0x6fd0('0xe3')](fs[_0x6fd0('0xe4')](path['join'](_0x1a9378,_0x179c02[_0x6fd0('0xd4')][_0x6fd0('0xe0')])));}}return{'date':moment(_0x179c02[_0x6fd0('0x78')])[_0x6fd0('0xce')](_0x6fd0('0xdc'))['toString'](),'sender':_0x179c02[_0x6fd0('0xe5')]===_0x6fd0('0xe6')?_0x179c02[_0x6fd0('0xd0')]?_0x179c02[_0x6fd0('0xd0')][_0x6fd0('0xd1')]:_0x6fd0('0xe7'):_0x179c02[_0x6fd0('0x65')][_0x6fd0('0xe8')]+(_0x179c02['Contact'][_0x6fd0('0xd3')]?'\x20'+_0x179c02[_0x6fd0('0x65')][_0x6fd0('0xd3')]:''),'body':_0x179c02[_0x6fd0('0xd4')]?_0x179c02[_0x6fd0('0xd4')][_0x6fd0('0xe0')]:_0x179c02[_0x6fd0('0xb8')],'direction':_0x179c02[_0x6fd0('0xe5')]==='out'?'A':'C','secret':_0x179c02[_0x6fd0('0xd6')],'read':_0x179c02[_0x6fd0('0x7f')],'attachment':_0x179c02[_0x6fd0('0xd4')]};})['value']()};return ejs[_0x6fd0('0xe9')](path[_0x6fd0('0xc9')](config[_0x6fd0('0xca')],_0x6fd0('0xcb'),_0x6fd0('0xea'),'downloadInteraction.ejs'),{'interaction':_0x12e546})[_0x6fd0('0x2b')](function(_0x39adf1){var _0x1adfcf=path[_0x6fd0('0xc9')](_0x1a9378,_0x6fd0('0xeb')+_0xe392bb['id']+'-'+_0x56f0d4+'.pdf');var _0x3043c1={'path':_0x1adfcf,'channel':'Openchannel','interactionId':_0xe392bb['id']};return pdf[_0x6fd0('0xec')](_0x39adf1,_0x3043c1);})[_0x6fd0('0x2b')](function(){return new BPromise(function(_0x5632b9,_0x136a2e){zipdir(_0x1a9378,{'saveTo':_0x1b46d3},function(_0x3c1340,_0x2bf13a){if(_0x3c1340)return _0x136a2e(_0x3c1340);return _0x5632b9(_0x2bf13a);});})[_0x6fd0('0x2b')](function(){return new BPromise(function(_0x9dfe29,_0x547835){rimraf(_0x1a9378,function(_0x4ed3fe){if(_0x4ed3fe)_0x547835(_0x4ed3fe);return _0x9dfe29();});});})[_0x6fd0('0x2b')](function(){return _0x2b8ea7[_0x6fd0('0xc7')](_0x1b46d3,_0x2912a4,function(_0x1f3248){if(_0x1f3248){console['log'](_0x6fd0('0xed'),_0x1f3248);}else{fs['unlinkSync'](_0x1b46d3);}});});});}else{return _0x2b8ea7['sendStatus'](0xc8);}})[_0x6fd0('0x38')](handleError(_0x2b8ea7,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 0e2c7f1..e472de0 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 _0x39ab=['map','findAll','unreadMessages','length','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users'];(function(_0x54564e,_0x3ff8cc){var _0x2668d1=function(_0x3052af){while(--_0x3052af){_0x54564e['push'](_0x54564e['shift']());}};_0x2668d1(++_0x3ff8cc);}(_0x39ab,0xf1));var _0xb39a=function(_0x2c6fd3,_0x4ad940){_0x2c6fd3=_0x2c6fd3-0x0;var _0x57d735=_0x39ab[_0x2c6fd3];return _0x57d735;};'use strict';var EventEmitter=require(_0xb39a('0x0'));var OpenchannelInteraction=require(_0xb39a('0x1'))['db'][_0xb39a('0x2')];var OpenchannelMessage=require(_0xb39a('0x1'))['db'][_0xb39a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb39a('0x4')](0x0);var events={'afterCreate':_0xb39a('0x5'),'afterUpdate':_0xb39a('0x6'),'afterDestroy':_0xb39a('0x7')};function emitEvent(_0x1dc529){return function(_0x29e9e0,_0x3ec770,_0x24e8be){_0x29e9e0[_0xb39a('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x176e25){_0x29e9e0[_0xb39a('0x9')](_0xb39a('0xa'),_0x176e25[_0xb39a('0xb')](function(_0x1c6ed9){return{'id':_0x1c6ed9['id']};}));return OpenchannelMessage[_0xb39a('0xc')]({'where':{'OpenchannelInteractionId':_0x29e9e0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2551f6){_0x29e9e0['setDataValue'](_0xb39a('0xd'),_0x2551f6[_0xb39a('0xe')]);OpenchannelInteractionEvents['emit'](_0x1dc529+':'+_0x29e9e0['id'],_0x29e9e0);OpenchannelInteractionEvents['emit'](_0x1dc529,_0x29e9e0);_0x24e8be(null);})[_0xb39a('0xf')](_0x24e8be(null));};}for(var e in events){if(events[_0xb39a('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xb39a('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x50bf=['exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0x50bf,0x188));var _0xf50b=function(_0x540ae7,_0x436620){_0x540ae7=_0x540ae7-0x0;var _0x53615c=_0x50bf[_0x540ae7];return _0x53615c;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xf50b('0x0'))['db'][_0xf50b('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xf50b('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf50b('0x3')](0x0);var events={'afterCreate':_0xf50b('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5baeb6){return function(_0xa24feb,_0x3d4ddb,_0x3e3be1){_0xa24feb[_0xf50b('0x5')]({'attributes':['id'],'raw':!![]})[_0xf50b('0x6')](function(_0x209554){_0xa24feb['setDataValue'](_0xf50b('0x7'),_0x209554[_0xf50b('0x8')](function(_0x3bf30a){return{'id':_0x3bf30a['id']};}));return OpenchannelMessage[_0xf50b('0x9')]({'where':{'OpenchannelInteractionId':_0xa24feb['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf50b('0x6')](function(_0xfe4d99){_0xa24feb[_0xf50b('0xa')](_0xf50b('0xb'),_0xfe4d99[_0xf50b('0xc')]);OpenchannelInteractionEvents[_0xf50b('0xd')](_0x5baeb6+':'+_0xa24feb['id'],_0xa24feb);OpenchannelInteractionEvents[_0xf50b('0xd')](_0x5baeb6,_0xa24feb);_0x3e3be1(null);})['catch'](_0x3e3be1(null));};}for(var e in events){if(events[_0xf50b('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xf50b('0xf')](e,emitEvent(event));}}module[_0xf50b('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index e662fc1..65f1799 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 _0xbe46=['../../config/environment','./openchannelInteraction.attributes','exports','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xcd53f,_0x32a220){var _0x4964d5=function(_0x19189e){while(--_0x19189e){_0xcd53f['push'](_0xcd53f['shift']());}};_0x4964d5(++_0x32a220);}(_0xbe46,0x1e6));var _0x6be4=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xbe46[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x6be4('0x0'));var util=require('util');var logger=require(_0x6be4('0x1'))(_0x6be4('0x2'));var moment=require(_0x6be4('0x3'));var BPromise=require(_0x6be4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6be4('0x5'));var rimraf=require(_0x6be4('0x6'));var config=require(_0x6be4('0x7'));var attributes=require(_0x6be4('0x8'));module[_0x6be4('0x9')]=function(_0x4f7f6e,_0x4aec19){return _0x4f7f6e['define']('OpenchannelInteraction',attributes,{'tableName':_0x6be4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6be4('0xb'),'collate':_0x6be4('0xc'),'hooks':{'beforeUpdate':function(_0x187124,_0x3413fa,_0x26d92a){if(_0x187124['changed'](_0x6be4('0xd'))){_0x187124[_0x6be4('0xe')]=moment()[_0x6be4('0xf')](_0x6be4('0x10'));}_0x26d92a(null,_0x187124);}}});}; \ No newline at end of file +var _0xe178=['../../config/environment','define','OpenchannelInteraction','utf8mb4_unicode_ci','closed','closedAt','format','lodash','util','moment','bluebird','path','rimraf'];(function(_0x54ce82,_0x1df7f9){var _0x4aab4e=function(_0x7fae6b){while(--_0x7fae6b){_0x54ce82['push'](_0x54ce82['shift']());}};_0x4aab4e(++_0x1df7f9);}(_0xe178,0xb0));var _0x8e17=function(_0x5300d5,_0x3627f5){_0x5300d5=_0x5300d5-0x0;var _0x10047e=_0xe178[_0x5300d5];return _0x10047e;};'use strict';var _=require(_0x8e17('0x0'));var util=require(_0x8e17('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e17('0x2'));var BPromise=require(_0x8e17('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e17('0x4'));var rimraf=require(_0x8e17('0x5'));var config=require(_0x8e17('0x6'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x5b637b,_0x3e85ad){return _0x5b637b[_0x8e17('0x7')](_0x8e17('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8e17('0x9'),'hooks':{'beforeUpdate':function(_0x4a3772,_0xc5f3cd,_0x3262c1){if(_0x4a3772['changed'](_0x8e17('0xa'))){_0x4a3772[_0x8e17('0xb')]=moment()[_0x8e17('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3262c1(null,_0x4a3772);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e0eb1bb..0aa6b74 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 _0x4186=['../../config/logger','../../config/environment','http','redis','defaults','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','body','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x410598,_0x37ce9a){var _0x59e57c=function(_0x469eda){while(--_0x469eda){_0x410598['push'](_0x410598['shift']());}};_0x59e57c(++_0x37ce9a);}(_0x4186,0x6e));var _0x6418=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x4186[_0x2fee96];return _0x2e6ad1;};'use strict';var _=require('lodash');var util=require(_0x6418('0x0'));var moment=require(_0x6418('0x1'));var BPromise=require(_0x6418('0x2'));var rs=require(_0x6418('0x3'));var fs=require('fs');var Redis=require(_0x6418('0x4'));var db=require(_0x6418('0x5'))['db'];var utils=require(_0x6418('0x6'));var logger=require(_0x6418('0x7'))('rpc');var config=require(_0x6418('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6418('0x9')]({'port':0x232a});config[_0x6418('0xa')]=_[_0x6418('0xb')](config[_0x6418('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6418('0xa')]));require(_0x6418('0xc'))['register'](socket);function respondWithRpcPromise(_0x188a0f,_0x2ea58b,_0x4a9368){return new BPromise(function(_0x33b47b,_0x114ac7){return client[_0x6418('0xd')](_0x188a0f,_0x4a9368)[_0x6418('0xe')](function(_0x5736cc){logger['info'](_0x6418('0xf'),_0x2ea58b,_0x6418('0x10'));logger[_0x6418('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2ea58b,_0x6418('0x10'),JSON[_0x6418('0x12')](_0x5736cc));if(_0x5736cc['error']){if(_0x5736cc[_0x6418('0x13')][_0x6418('0x14')]===0x1f4){logger[_0x6418('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2ea58b,_0x5736cc[_0x6418('0x13')]['message']);return _0x114ac7(_0x5736cc[_0x6418('0x13')][_0x6418('0x15')]);}logger[_0x6418('0x13')](_0x6418('0xf'),_0x2ea58b,_0x5736cc[_0x6418('0x13')][_0x6418('0x15')]);return _0x33b47b(_0x5736cc[_0x6418('0x13')]['message']);}else{logger[_0x6418('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2ea58b,_0x6418('0x10'));_0x33b47b(_0x5736cc['result'][_0x6418('0x15')]);}})[_0x6418('0x17')](function(_0x5b9d9e){logger[_0x6418('0x13')](_0x6418('0xf'),_0x2ea58b,_0x5b9d9e);_0x114ac7(_0x5b9d9e);});});}exports[_0x6418('0x18')]=function(_0x55ec50){var _0x5696b3=this;return new Promise(function(_0x5a3b16,_0x34c50a){return db[_0x6418('0x19')][_0x6418('0x1a')](_0x55ec50['body'],{'raw':_0x55ec50[_0x6418('0x1b')]?_0x55ec50[_0x6418('0x1b')][_0x6418('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55ec50[_0x6418('0x1b')]?_0x55ec50[_0x6418('0x1b')][_0x6418('0x1d')]||null:null,'attributes':_0x55ec50['options']?_0x55ec50[_0x6418('0x1b')][_0x6418('0x1e')]||null:null,'limit':_0x55ec50[_0x6418('0x1b')]?_0x55ec50['options'][_0x6418('0x1f')]||null:null})[_0x6418('0xe')](function(_0x43d4f0){logger[_0x6418('0x16')](_0x6418('0x18'),_0x55ec50);logger['debug']('UpdateOpenchannelInteraction',_0x55ec50,JSON[_0x6418('0x12')](_0x43d4f0));_0x5a3b16(_0x43d4f0);})[_0x6418('0x17')](function(_0xff1709){logger['error']('UpdateOpenchannelInteraction',_0xff1709[_0x6418('0x15')],_0x55ec50);_0x34c50a(_0x5696b3[_0x6418('0x13')](0x1f4,_0xff1709['message']));});});};exports[_0x6418('0x20')]=function(_0x59acc9){return new Promise(function(_0x2b09cf,_0x106e36){return db[_0x6418('0x19')][_0x6418('0x21')]({'where':_0x59acc9['options']?_0x59acc9[_0x6418('0x1b')][_0x6418('0x1d')]||null:null})['then'](function(_0x168154){if(_0x168154){return _0x168154[_0x6418('0x22')](_0x59acc9['body'][_0x6418('0x23')],_['omit'](_0x59acc9[_0x6418('0x24')],[_0x6418('0x23'),'id'])||{});}})[_0x6418('0x25')](function(_0x4d7a6d){logger['info'](_0x6418('0x26'),_0x59acc9);logger['debug'](_0x6418('0x26'),_0x59acc9,JSON[_0x6418('0x12')](_0x4d7a6d));_0x2b09cf(_0x4d7a6d);})[_0x6418('0x17')](function(_0x23f773){logger['error'](_0x6418('0x26'),_0x23f773[_0x6418('0x15')],_0x59acc9);_0x106e36(_this['error'](0x1f4,_0x23f773[_0x6418('0x15')]));});});}; \ No newline at end of file +var _0x1e2e=['message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','addTags','body','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5ada23,_0x20c073){var _0x20d5cd=function(_0xb64b94){while(--_0xb64b94){_0x5ada23['push'](_0x5ada23['shift']());}};_0x20d5cd(++_0x20c073);}(_0x1e2e,0xd2));var _0xe1e2=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0x1e2e[_0x419550];return _0x55f9ef;};'use strict';var _=require('lodash');var util=require(_0xe1e2('0x0'));var moment=require(_0xe1e2('0x1'));var BPromise=require(_0xe1e2('0x2'));var rs=require(_0xe1e2('0x3'));var fs=require('fs');var Redis=require(_0xe1e2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1e2('0x5'));var logger=require('../../config/logger')(_0xe1e2('0x6'));var config=require('../../config/environment');var jayson=require(_0xe1e2('0x7'));var client=jayson[_0xe1e2('0x8')][_0xe1e2('0x9')]({'port':0x232a});config[_0xe1e2('0xa')]=_[_0xe1e2('0xb')](config[_0xe1e2('0xa')],{'host':_0xe1e2('0xc'),'port':0x18eb});var socket=require(_0xe1e2('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xe1e2('0xe')](socket);function respondWithRpcPromise(_0x4097db,_0x2e9104,_0x3744fb){return new BPromise(function(_0x37a5da,_0x3cc4ed){return client['request'](_0x4097db,_0x3744fb)[_0xe1e2('0xf')](function(_0x2ba994){logger[_0xe1e2('0x10')](_0xe1e2('0x11'),_0x2e9104,_0xe1e2('0x12'));logger[_0xe1e2('0x13')](_0xe1e2('0x14'),_0x2e9104,_0xe1e2('0x12'),JSON[_0xe1e2('0x15')](_0x2ba994));if(_0x2ba994[_0xe1e2('0x16')]){if(_0x2ba994[_0xe1e2('0x16')][_0xe1e2('0x17')]===0x1f4){logger[_0xe1e2('0x16')](_0xe1e2('0x11'),_0x2e9104,_0x2ba994[_0xe1e2('0x16')][_0xe1e2('0x18')]);return _0x3cc4ed(_0x2ba994[_0xe1e2('0x16')][_0xe1e2('0x18')]);}logger['error'](_0xe1e2('0x11'),_0x2e9104,_0x2ba994[_0xe1e2('0x16')]['message']);return _0x37a5da(_0x2ba994[_0xe1e2('0x16')][_0xe1e2('0x18')]);}else{logger[_0xe1e2('0x10')](_0xe1e2('0x11'),_0x2e9104,_0xe1e2('0x12'));_0x37a5da(_0x2ba994[_0xe1e2('0x19')][_0xe1e2('0x18')]);}})[_0xe1e2('0x1a')](function(_0x5bc12a){logger[_0xe1e2('0x16')](_0xe1e2('0x11'),_0x2e9104,_0x5bc12a);_0x3cc4ed(_0x5bc12a);});});}exports[_0xe1e2('0x1b')]=function(_0x1c7f1b){var _0x14687d=this;return new Promise(function(_0x4b42c6,_0xc2a7b1){return db[_0xe1e2('0x1c')]['update'](_0x1c7f1b['body'],{'raw':_0x1c7f1b[_0xe1e2('0x1d')]?_0x1c7f1b[_0xe1e2('0x1d')][_0xe1e2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c7f1b['options']?_0x1c7f1b[_0xe1e2('0x1d')][_0xe1e2('0x1f')]||null:null,'attributes':_0x1c7f1b[_0xe1e2('0x1d')]?_0x1c7f1b[_0xe1e2('0x1d')][_0xe1e2('0x20')]||null:null,'limit':_0x1c7f1b[_0xe1e2('0x1d')]?_0x1c7f1b[_0xe1e2('0x1d')][_0xe1e2('0x21')]||null:null})[_0xe1e2('0xf')](function(_0x1392fd){logger[_0xe1e2('0x10')](_0xe1e2('0x1b'),_0x1c7f1b);logger[_0xe1e2('0x13')](_0xe1e2('0x1b'),_0x1c7f1b,JSON[_0xe1e2('0x15')](_0x1392fd));_0x4b42c6(_0x1392fd);})[_0xe1e2('0x1a')](function(_0x347228){logger['error'](_0xe1e2('0x1b'),_0x347228[_0xe1e2('0x18')],_0x1c7f1b);_0xc2a7b1(_0x14687d[_0xe1e2('0x16')](0x1f4,_0x347228[_0xe1e2('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x9ca17a){return new Promise(function(_0x6a3ba5,_0x5a375d){return db[_0xe1e2('0x1c')]['find']({'where':_0x9ca17a[_0xe1e2('0x1d')]?_0x9ca17a[_0xe1e2('0x1d')][_0xe1e2('0x1f')]||null:null})[_0xe1e2('0xf')](function(_0x1c48ef){if(_0x1c48ef){return _0x1c48ef[_0xe1e2('0x22')](_0x9ca17a[_0xe1e2('0x23')][_0xe1e2('0x24')],_['omit'](_0x9ca17a[_0xe1e2('0x23')],[_0xe1e2('0x24'),'id'])||{});}})[_0xe1e2('0x25')](function(_0x133565){logger[_0xe1e2('0x10')](_0xe1e2('0x26'),_0x9ca17a);logger[_0xe1e2('0x13')]('AddTags',_0x9ca17a,JSON[_0xe1e2('0x15')](_0x133565));_0x6a3ba5(_0x133565);})[_0xe1e2('0x1a')](function(_0x5285b2){logger['error'](_0xe1e2('0x26'),_0x5285b2[_0xe1e2('0x18')],_0x9ca17a);_0x5a375d(_this['error'](0x1f4,_0x5285b2['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 8e1a24a..7ed4788 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 _0xe6e0=['emit','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x3051d6,_0xf8c7ea){var _0x390fbb=function(_0x4ecfc5){while(--_0x4ecfc5){_0x3051d6['push'](_0x3051d6['shift']());}};_0x390fbb(++_0xf8c7ea);}(_0xe6e0,0xf4));var _0x0e6e=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xe6e0[_0x166742];return _0xb7814a;};'use strict';var OpenchannelInteractionEvents=require(_0x0e6e('0x0'));var events=[_0x0e6e('0x1'),_0x0e6e('0x2'),_0x0e6e('0x3')];function createListener(_0x431e61,_0x2d2f41){return function(_0x1c8bd3){_0x2d2f41[_0x0e6e('0x4')](_0x431e61,_0x1c8bd3);};}function removeListener(_0xd77c15,_0x3340ba){return function(){OpenchannelInteractionEvents[_0x0e6e('0x5')](_0xd77c15,_0x3340ba);};}exports[_0x0e6e('0x6')]=function(_0x4b588e){for(var _0x38c12b=0x0,_0x1338a7=events['length'];_0x38c12b<_0x1338a7;_0x38c12b++){var _0x59c9b1=events[_0x38c12b];var _0x3e08f1=createListener(_0x0e6e('0x7')+_0x59c9b1,_0x4b588e);OpenchannelInteractionEvents['on'](_0x59c9b1,_0x3e08f1);}}; \ No newline at end of file +var _0x7d4f=['register','openchannelInteraction:','save','update','emit'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7d4f,0x12e));var _0xf7d4=function(_0x237836,_0x5c9545){_0x237836=_0x237836-0x0;var _0x57806b=_0x7d4f[_0x237836];return _0x57806b;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xf7d4('0x0'),'remove',_0xf7d4('0x1')];function createListener(_0x335917,_0x19f800){return function(_0x3786f9){_0x19f800[_0xf7d4('0x2')](_0x335917,_0x3786f9);};}function removeListener(_0x4556d2,_0x93582){return function(){OpenchannelInteractionEvents['removeListener'](_0x4556d2,_0x93582);};}exports[_0xf7d4('0x3')]=function(_0x711d0a){for(var _0x4552b9=0x0,_0x19acd7=events['length'];_0x4552b9<_0x19acd7;_0x4552b9++){var _0x2a5618=events[_0x4552b9];var _0x23dd5f=createListener(_0xf7d4('0x4')+_0x2a5618,_0x711d0a);OpenchannelInteractionEvents['on'](_0x2a5618,_0x23dd5f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 15ea629..f301a8f 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x3319e,_0x8d04e9){var _0x49ec20=function(_0x499829){while(--_0x499829){_0x3319e['push'](_0x3319e['shift']());}};_0x49ec20(++_0x8d04e9);}(_0xe706,0xa3));var _0x6e70=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0xe706[_0x1406ae];return _0x23a076;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c154cfa..c2a899f 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 _0x5d86=['exports','BOOLEAN','ENUM','out','DATE','TEXT','sequelize'];(function(_0x42eb9e,_0x2be5a3){var _0x247bc6=function(_0x1afaf1){while(--_0x1afaf1){_0x42eb9e['push'](_0x42eb9e['shift']());}};_0x247bc6(++_0x2be5a3);}(_0x5d86,0x76));var _0x65d8=function(_0x115683,_0x4a1c36){_0x115683=_0x115683-0x0;var _0x5715b0=_0x5d86[_0x115683];return _0x5715b0;};'use strict';var Sequelize=require(_0x65d8('0x0'));module[_0x65d8('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x65d8('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x65d8('0x3')]('in',_0x65d8('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x65d8('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x65d8('0x6')]}}; \ No newline at end of file +var _0x15b8=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x15b8,0xcd));var _0x815b=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x15b8[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require('sequelize');module[_0x815b('0x0')]={'body':{'type':Sequelize[_0x815b('0x1')](_0x815b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x815b('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x815b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x815b('0x4')),'defaultValue':_0x815b('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x815b('0x5')]},'providerName':{'type':Sequelize[_0x815b('0x6')]},'providerResponse':{'type':Sequelize[_0x815b('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 3fba90d..13166b5 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 _0xfd2e=['../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','keys','find','create','body','params','describe','openchannel-interactions','accept','openchannel','read','format','UserId','user','get','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE: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','QueryTypes','SELECT','User','agent','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','internal','rejectmessage','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xfd2e,0x6e));var _0xefd2=function(_0x559dd7,_0x1f6f79){_0x559dd7=_0x559dd7-0x0;var _0x2d8f95=_0xfd2e[_0x559dd7];return _0x2d8f95;};'use strict';var emlformat=require(_0xefd2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefd2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefd2('0x2'));var moment=require('moment');var BPromise=require(_0xefd2('0x3'));var Mustache=require(_0xefd2('0x4'));var util=require(_0xefd2('0x5'));var path=require(_0xefd2('0x6'));var sox=require(_0xefd2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefd2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xefd2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xefd2('0xa'));var toCsv=require(_0xefd2('0xb'));var querystring=require(_0xefd2('0xc'));var Papa=require(_0xefd2('0xd'));var Redis=require(_0xefd2('0xe'));var authService=require(_0xefd2('0xf'));var qs=require(_0xefd2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefd2('0x11'));var logger=require(_0xefd2('0x12'))(_0xefd2('0x13'));var utils=require(_0xefd2('0x14'));var config=require(_0xefd2('0x15'));var licenseUtil=require(_0xefd2('0x16'));var db=require(_0xefd2('0x17'))['db'];config[_0xefd2('0x18')]=_['defaults'](config['redis'],{'host':_0xefd2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xefd2('0x1a'))[_0xefd2('0x1b')](socket);var jayson=require(_0xefd2('0x1c'));var client=jayson[_0xefd2('0x1d')][_0xefd2('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xefd2('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x20192b,_0x2e706a,_0x1823f0,_0x293c78){return new BPromise(function(_0x471e3b,_0x58eed0){var _0x48ef07=_0x293c78||client;return _0x48ef07[_0xefd2('0x1f')](_0x20192b,_0x1823f0)[_0xefd2('0x20')](function(_0x1d7240){logger[_0xefd2('0x21')](_0xefd2('0x22'),_0x2e706a,'request\x20sent');logger[_0xefd2('0x23')](_0xefd2('0x24'),_0x2e706a,_0xefd2('0x25'),JSON[_0xefd2('0x26')](_0x1d7240));if(_0x1d7240['error']){if(_0x1d7240[_0xefd2('0x27')][_0xefd2('0x28')]===0x1f4){logger[_0xefd2('0x27')](_0xefd2('0x22'),_0x2e706a,_0x1d7240['error'][_0xefd2('0x29')]);return _0x58eed0(_0x1d7240[_0xefd2('0x27')][_0xefd2('0x29')]);}logger[_0xefd2('0x27')](_0xefd2('0x22'),_0x2e706a,_0x1d7240[_0xefd2('0x27')][_0xefd2('0x29')]);return _0x471e3b(_0x1d7240['error']['message']);}else{logger[_0xefd2('0x21')](_0xefd2('0x22'),_0x2e706a,_0xefd2('0x25'));_0x471e3b(_0x1d7240[_0xefd2('0x2a')][_0xefd2('0x29')]);}})[_0xefd2('0x2b')](function(_0x42e4e6){logger[_0xefd2('0x27')](_0xefd2('0x22'),_0x2e706a,_0x42e4e6);_0x58eed0(_0x42e4e6);});});}function respondWithStatusCode(_0x519d9,_0x3f9663){_0x3f9663=_0x3f9663||0xcc;return function(_0x50dc75){if(_0x50dc75){return _0x519d9[_0xefd2('0x2c')](_0x3f9663);}return _0x519d9[_0xefd2('0x2d')](_0x3f9663)[_0xefd2('0x2e')]();};}function respondWithResult(_0x398ce2,_0x10ec88){_0x10ec88=_0x10ec88||0xc8;return function(_0x22629a){if(_0x22629a){return _0x398ce2[_0xefd2('0x2d')](_0x10ec88)['json'](_0x22629a);}};}function respondWithFilteredResult(_0x386ee1,_0x12a0f5){return function(_0x25f25a){if(_0x25f25a){var _0x46e68d=typeof _0x12a0f5[_0xefd2('0x2f')]==='undefined'&&typeof _0x12a0f5[_0xefd2('0x30')]===_0xefd2('0x31');var _0x573197=_0x25f25a[_0xefd2('0x32')];var _0xaccd28=_0x46e68d?0x0:_0x12a0f5[_0xefd2('0x2f')];var _0x22326f=_0x46e68d?_0x25f25a[_0xefd2('0x32')]:_0x12a0f5[_0xefd2('0x2f')]+_0x12a0f5[_0xefd2('0x30')];var _0x1202a2;if(_0x22326f>=_0x573197){_0x22326f=_0x573197;_0x1202a2=0xc8;}else{_0x1202a2=0xce;}_0x386ee1[_0xefd2('0x2d')](_0x1202a2);return _0x386ee1[_0xefd2('0x33')](_0xefd2('0x34'),_0xaccd28+'-'+_0x22326f+'/'+_0x573197)['json'](_0x25f25a);}return null;};}function patchUpdates(_0x25644c){return function(_0x329737){try{jsonpatch[_0xefd2('0x35')](_0x329737,_0x25644c,!![]);}catch(_0x25d94d){return BPromise[_0xefd2('0x36')](_0x25d94d);}return _0x329737[_0xefd2('0x37')]();};}function saveUpdates(_0x2712cc,_0x3ce0c6){return function(_0x1d5fad){if(_0x1d5fad){return _0x1d5fad[_0xefd2('0x38')](_0x2712cc)[_0xefd2('0x20')](function(_0x59edc7){return _0x59edc7;});}return null;};}function removeEntity(_0x20b1dd,_0x1df05c){return function(_0x4fdba9){if(_0x4fdba9){return _0x4fdba9[_0xefd2('0x39')]()[_0xefd2('0x20')](function(){_0x20b1dd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40eb49,_0x4ba00e){return function(_0x269d4e){if(!_0x269d4e){_0x40eb49[_0xefd2('0x2c')](0x194);}return _0x269d4e;};}function handleError(_0x37e30f,_0x3fc77f){_0x3fc77f=_0x3fc77f||0x1f4;return function(_0x19ea27){logger['error'](_0x19ea27[_0xefd2('0x3a')]);if(_0x19ea27[_0xefd2('0x3b')]){delete _0x19ea27[_0xefd2('0x3b')];}_0x37e30f[_0xefd2('0x2d')](_0x3fc77f)[_0xefd2('0x3c')](_0x19ea27);};}exports[_0xefd2('0x3d')]=function(_0x175aac,_0x284594){var _0x304437={},_0x128d4c={},_0x470d7f={'count':0x0,'rows':[]};var _0x3e832a=_[_0xefd2('0x3e')](db[_0xefd2('0x3f')][_0xefd2('0x40')],function(_0x40f773){return{'name':_0x40f773[_0xefd2('0x41')],'type':_0x40f773[_0xefd2('0x42')][_0xefd2('0x43')]};});_0x128d4c[_0xefd2('0x44')]=_[_0xefd2('0x3e')](_0x3e832a,'name');_0x128d4c[_0xefd2('0x45')]=_['keys'](_0x175aac[_0xefd2('0x45')]);_0x128d4c['filters']=_['intersection'](_0x128d4c[_0xefd2('0x44')],_0x128d4c[_0xefd2('0x45')]);_0x304437[_0xefd2('0x46')]=_[_0xefd2('0x47')](_0x128d4c[_0xefd2('0x44')],qs['fields'](_0x175aac['query'][_0xefd2('0x48')]));_0x304437['attributes']=_0x304437[_0xefd2('0x46')][_0xefd2('0x49')]?_0x304437['attributes']:_0x128d4c[_0xefd2('0x44')];if(!_0x175aac[_0xefd2('0x45')][_0xefd2('0x4a')](_0xefd2('0x4b'))){_0x304437['limit']=qs[_0xefd2('0x30')](_0x175aac[_0xefd2('0x45')]['limit']);_0x304437[_0xefd2('0x2f')]=qs['offset'](_0x175aac[_0xefd2('0x45')]['offset']);}_0x304437['order']=qs[_0xefd2('0x4c')](_0x175aac[_0xefd2('0x45')]['sort']);_0x304437[_0xefd2('0x4d')]=qs['filters'](_[_0xefd2('0x4e')](_0x175aac['query'],_0x128d4c[_0xefd2('0x4f')]),_0x3e832a);if(_0x175aac[_0xefd2('0x45')][_0xefd2('0x50')]){_0x304437['where']=_[_0xefd2('0x51')](_0x304437[_0xefd2('0x4d')],{'$or':_['map'](_0x3e832a,function(_0x4d76c5){if(_0x4d76c5[_0xefd2('0x42')]!==_0xefd2('0x52')){var _0x4fad61={};_0x4fad61[_0x4d76c5[_0xefd2('0x3b')]]={'$like':'%'+_0x175aac[_0xefd2('0x45')][_0xefd2('0x50')]+'%'};return _0x4fad61;}})});}_0x304437=_[_0xefd2('0x51')]({},_0x304437,_0x175aac['options']);var _0x29ba3f={'where':_0x304437[_0xefd2('0x4d')]};return db[_0xefd2('0x3f')]['count'](_0x29ba3f)[_0xefd2('0x20')](function(_0x4c268f){_0x470d7f[_0xefd2('0x32')]=_0x4c268f;if(_0x175aac['query'][_0xefd2('0x53')]){_0x304437[_0xefd2('0x54')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xefd2('0x55')](_0x304437);})[_0xefd2('0x20')](function(_0xada2a0){_0x470d7f['rows']=_0xada2a0;return _0x470d7f;})['then'](respondWithFilteredResult(_0x284594,_0x304437))[_0xefd2('0x2b')](handleError(_0x284594,null));};exports['show']=function(_0x938d7a,_0x334eb5){var _0x723f65={'raw':!![],'where':{'id':_0x938d7a['params']['id']}},_0x5a78ec={};_0x5a78ec['model']=_[_0xefd2('0x56')](db[_0xefd2('0x3f')][_0xefd2('0x40')]);_0x5a78ec[_0xefd2('0x45')]=_[_0xefd2('0x56')](_0x938d7a['query']);_0x5a78ec[_0xefd2('0x4f')]=_[_0xefd2('0x47')](_0x5a78ec[_0xefd2('0x44')],_0x5a78ec[_0xefd2('0x45')]);_0x723f65[_0xefd2('0x46')]=_[_0xefd2('0x47')](_0x5a78ec[_0xefd2('0x44')],qs[_0xefd2('0x48')](_0x938d7a[_0xefd2('0x45')][_0xefd2('0x48')]));_0x723f65[_0xefd2('0x46')]=_0x723f65[_0xefd2('0x46')][_0xefd2('0x49')]?_0x723f65[_0xefd2('0x46')]:_0x5a78ec[_0xefd2('0x44')];if(_0x938d7a[_0xefd2('0x45')][_0xefd2('0x53')]){_0x723f65[_0xefd2('0x54')]=[{'all':!![]}];}_0x723f65=_[_0xefd2('0x51')]({},_0x723f65,_0x938d7a['options']);return db[_0xefd2('0x3f')][_0xefd2('0x57')](_0x723f65)[_0xefd2('0x20')](handleEntityNotFound(_0x334eb5,null))[_0xefd2('0x20')](respondWithResult(_0x334eb5,null))['catch'](handleError(_0x334eb5,null));};exports[_0xefd2('0x58')]=function(_0x3a7211,_0x1037c4){return db[_0xefd2('0x3f')][_0xefd2('0x58')](_0x3a7211[_0xefd2('0x59')],{})[_0xefd2('0x20')](respondWithResult(_0x1037c4,0xc9))[_0xefd2('0x2b')](handleError(_0x1037c4,null));};exports[_0xefd2('0x38')]=function(_0x80b817,_0x12a36b){if(_0x80b817['body']['id']){delete _0x80b817[_0xefd2('0x59')]['id'];}return db[_0xefd2('0x3f')][_0xefd2('0x57')]({'where':{'id':_0x80b817[_0xefd2('0x5a')]['id']}})[_0xefd2('0x20')](handleEntityNotFound(_0x12a36b,null))[_0xefd2('0x20')](saveUpdates(_0x80b817[_0xefd2('0x59')],null))[_0xefd2('0x20')](respondWithResult(_0x12a36b,null))[_0xefd2('0x2b')](handleError(_0x12a36b,null));};exports[_0xefd2('0x39')]=function(_0x35325d,_0x8759fb){return db[_0xefd2('0x3f')][_0xefd2('0x57')]({'where':{'id':_0x35325d['params']['id']}})[_0xefd2('0x20')](handleEntityNotFound(_0x8759fb,null))[_0xefd2('0x20')](removeEntity(_0x8759fb,null))['catch'](handleError(_0x8759fb,null));};exports[_0xefd2('0x5b')]=function(_0x2ccbc2,_0x2aebd8){return db['OpenchannelMessage']['describe']()[_0xefd2('0x20')](respondWithResult(_0x2aebd8,null))[_0xefd2('0x2b')](handleError(_0x2aebd8,null));};var interaction_log=require('../../config/logger')(_0xefd2('0x5c'));exports[_0xefd2('0x5d')]=function(_0x395501,_0x5cb14c,_0x4c02a8){var _0x468670={'agent':{},'channel':_0xefd2('0x5e')};if(_0x395501['body']['id']){delete _0x395501[_0xefd2('0x59')]['id'];}_0x395501[_0xefd2('0x59')][_0xefd2('0x5f')]=!![];_0x395501[_0xefd2('0x59')]['readAt']=moment()[_0xefd2('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x395501['body']['UserId']=_0x395501[_0xefd2('0x59')][_0xefd2('0x61')]||_0x395501[_0xefd2('0x62')]['id'];_0x468670['agent']['id']=_0x395501['body']['UserId'];return db['OpenchannelMessage'][_0xefd2('0x57')]({'where':{'id':_0x395501[_0xefd2('0x5a')]['id'],'UserId':null}})[_0xefd2('0x20')](handleEntityNotFound(_0x5cb14c,null))[_0xefd2('0x20')](saveUpdates(_0x395501[_0xefd2('0x59')],null))[_0xefd2('0x20')](function(_0x5e1e31){if(_0x5e1e31){_0x468670[_0xefd2('0x29')]=_0x5e1e31[_0xefd2('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0xefd2('0x57')]({'where':{'id':_0x5e1e31['OpenchannelInteractionId']}});}return null;})[_0xefd2('0x20')](handleEntityNotFound(_0x5cb14c,null))[_0xefd2('0x20')](function(_0x29bfce){if(_0x29bfce){return _0x29bfce['update']({'UserId':_0x395501['body']['UserId'],'read1stAt':_['isNil'](_0x29bfce[_0xefd2('0x64')])?moment()[_0xefd2('0x60')](_0xefd2('0x65')):undefined});}return null;})[_0xefd2('0x20')](function(_0x18f4c0){if(_0x18f4c0){_0x468670[_0xefd2('0x66')]=_0x18f4c0['get']({'plain':!![]});interaction_log[_0xefd2('0x21')](_0xefd2('0x67'),_0x395501['user']['id'],_0x395501[_0xefd2('0x62')][_0xefd2('0x3b')],_0x395501[_0xefd2('0x62')][_0xefd2('0x68')],_0x468670[_0xefd2('0x66')]['id'],_0x395501[_0xefd2('0x59')]?JSON[_0xefd2('0x26')](_0x395501[_0xefd2('0x59')]):_0xefd2('0x69'));return respondWithRpcPromise(_0xefd2('0x6a'),_0xefd2('0x6b'),_0x468670);}return null;})[_0xefd2('0x20')](function(_0xc636a1){var _0x4d90ce=_0xefd2('0x6c')+_0xc636a1[_0xefd2('0x29')][_0xefd2('0x6d')];return db['sequelize'][_0xefd2('0x45')](_0x4d90ce,{'type':db[_0xefd2('0x6e')][_0xefd2('0x6f')][_0xefd2('0x70')],'raw':!![]})[_0xefd2('0x20')](function(_0x425522){return _0x425522;});})[_0xefd2('0x20')](function(_0x21e23c){if(_0x21e23c){_0x468670[_0xefd2('0x29')]['contact']=_0x21e23c[0x0];if(!_0x395501[_0xefd2('0x59')][_0xefd2('0x61')])return;return db[_0xefd2('0x71')]['find']({'where':{'id':_0x395501[_0xefd2('0x59')][_0xefd2('0x61')],'role':_0xefd2('0x72')},'attributes':['id','name',_0xefd2('0x73'),_0xefd2('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3b28c9){if(!_0x3b28c9)return null;_0x468670['message'][_0xefd2('0x72')]=_0x3b28c9;return _0x468670;})['then'](function(_0x426849){if(_0x426849){if(_0x395501[_0xefd2('0x59')][_0xefd2('0x75')]){_0x468670[_0xefd2('0x29')][_0xefd2('0x76')]=util['format'](_0xefd2('0x77'),_0x395501[_0xefd2('0x62')]['name']);_0x468670[_0xefd2('0x29')][_0xefd2('0x78')]=_0x468670[_0xefd2('0x78')];_0x468670['message']['motionChannel']=_0x468670[_0xefd2('0x78')];_0x468670[_0xefd2('0x29')][_0xefd2('0x79')]=_0xefd2('0x5d');return respondWithRpcPromise('EventManager',_0xefd2('0x7a'),{'event':_0xefd2('0x7b'),'message':_0x468670[_0xefd2('0x29')]},client9002)['then'](function(){return _0x468670;});}return _0x468670;}return null;})[_0xefd2('0x20')](respondWithResult(_0x5cb14c,null))[_0xefd2('0x2b')](handleError(_0x5cb14c,null));};var interaction_log=require(_0xefd2('0x12'))('openchannel-interactions');exports[_0xefd2('0x36')]=function(_0x2d76d9,_0x5ae6ad,_0x470050){var _0x262759={'agent':{},'channel':_0xefd2('0x5e')};if(_0x2d76d9[_0xefd2('0x59')]['id']){delete _0x2d76d9['body']['id'];}_0x2d76d9[_0xefd2('0x59')][_0xefd2('0x61')]=_0x2d76d9[_0xefd2('0x59')]['UserId']||_0x2d76d9[_0xefd2('0x62')]['id'];_0x262759[_0xefd2('0x72')]['id']=_0x2d76d9[_0xefd2('0x59')][_0xefd2('0x61')];return db['OpenchannelMessage'][_0xefd2('0x57')]({'where':{'id':_0x2d76d9['params']['id'],'UserId':null}})[_0xefd2('0x20')](handleEntityNotFound(_0x5ae6ad,null))['then'](function(_0xfca923){if(_0xfca923){_0x262759[_0xefd2('0x29')]=_0xfca923[_0xefd2('0x63')]({'plain':!![]});return db[_0xefd2('0x7c')][_0xefd2('0x57')]({'where':{'id':_0xfca923[_0xefd2('0x7d')]}});}return null;})[_0xefd2('0x20')](handleEntityNotFound(_0x5ae6ad,null))['then'](function(_0x45338e){if(_0x45338e){_0x262759[_0xefd2('0x66')]=_0x45338e['get']({'plain':!![]});interaction_log['info'](_0xefd2('0x7e'),_0x2d76d9['user']['id'],_0x2d76d9[_0xefd2('0x62')]['name'],_0x2d76d9[_0xefd2('0x62')][_0xefd2('0x68')],_0x262759[_0xefd2('0x66')]['id'],_0x2d76d9[_0xefd2('0x59')]?JSON[_0xefd2('0x26')](_0x2d76d9[_0xefd2('0x59')]):_0xefd2('0x69'));return respondWithRpcPromise(_0xefd2('0x7f'),'rejectMessage',_0x262759);}return null;})['then'](function(_0x3b4825){var _0x2efa6d=_0xefd2('0x6c')+_0x3b4825[_0xefd2('0x29')][_0xefd2('0x6d')];return db['sequelize'][_0xefd2('0x45')](_0x2efa6d,{'type':db['Sequelize'][_0xefd2('0x6f')][_0xefd2('0x70')],'raw':!![]})[_0xefd2('0x20')](function(_0xfecfb2){return _0xfecfb2;});})[_0xefd2('0x20')](function(_0x319475){if(_0x319475){_0x262759[_0xefd2('0x29')][_0xefd2('0x80')]=_0x319475[0x0];if(!_0x2d76d9[_0xefd2('0x59')][_0xefd2('0x61')])return;return db[_0xefd2('0x71')]['find']({'where':{'id':_0x2d76d9[_0xefd2('0x59')][_0xefd2('0x61')],'role':'agent'},'attributes':['id',_0xefd2('0x3b'),_0xefd2('0x73'),'email',_0xefd2('0x81')],'raw':!![]});}return null;})[_0xefd2('0x20')](function(_0x31241f){if(!_0x31241f)return null;_0x262759['message'][_0xefd2('0x72')]=_0x31241f;return _0x262759;})[_0xefd2('0x20')](function(_0x31fc2c){if(_0x31fc2c){_0x31fc2c[_0xefd2('0x29')][_0xefd2('0x76')]=util[_0xefd2('0x60')](_0xefd2('0x77'),_0x2d76d9[_0xefd2('0x62')][_0xefd2('0x3b')]);_0x31fc2c['message'][_0xefd2('0x78')]=_0x262759[_0xefd2('0x78')];_0x31fc2c[_0xefd2('0x29')]['motionChannel']=_0x262759[_0xefd2('0x78')];_0x31fc2c['message'][_0xefd2('0x79')]=_0xefd2('0x36');respondWithRpcPromise('EventManager',_0xefd2('0x7a'),{'event':_0xefd2('0x82'),'message':_0x31fc2c['message']},client9002);return _0x262759;}return null;})[_0xefd2('0x20')](respondWithResult(_0x5ae6ad,null))[_0xefd2('0x2b')](handleError(_0x5ae6ad,null));}; \ No newline at end of file +var _0x4c35=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','filter','options','include','rows','show','params','find','create','body','update','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','Sequelize','SELECT','fullname','internal','interface','rejectmessage','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status'];(function(_0x25e670,_0x53f0ce){var _0x5ad754=function(_0x583828){while(--_0x583828){_0x25e670['push'](_0x25e670['shift']());}};_0x5ad754(++_0x53f0ce);}(_0x4c35,0xd4));var _0x54c3=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x4c35[_0x2ff4bd];return _0x28edc6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54c3('0x1'));var rp=require('request-promise');var moment=require(_0x54c3('0x2'));var BPromise=require(_0x54c3('0x3'));var Mustache=require(_0x54c3('0x4'));var util=require('util');var path=require('path');var sox=require(_0x54c3('0x5'));var csv=require(_0x54c3('0x6'));var ejs=require(_0x54c3('0x7'));var fs=require('fs');var fs_extra=require(_0x54c3('0x8'));var _=require(_0x54c3('0x9'));var squel=require(_0x54c3('0xa'));var crypto=require('crypto');var jsforce=require(_0x54c3('0xb'));var deskjs=require(_0x54c3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x54c3('0xd'));var Papa=require(_0x54c3('0xe'));var Redis=require(_0x54c3('0xf'));var authService=require(_0x54c3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x54c3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x54c3('0x12'));var utils=require(_0x54c3('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x54c3('0x14'))['db'];config[_0x54c3('0x15')]=_[_0x54c3('0x16')](config[_0x54c3('0x15')],{'host':_0x54c3('0x17'),'port':0x18eb});var socket=require(_0x54c3('0x18'))(new Redis(config[_0x54c3('0x15')]));require(_0x54c3('0x19'))['register'](socket);var jayson=require(_0x54c3('0x1a'));var client=jayson[_0x54c3('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x54c3('0x1b')][_0x54c3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xfdc370,_0x34bddd,_0x3db812,_0x2e422d){return new BPromise(function(_0x549bb7,_0x4c9217){var _0x307b37=_0x2e422d||client;return _0x307b37['request'](_0xfdc370,_0x3db812)['then'](function(_0x15683e){logger['info'](_0x54c3('0x1d'),_0x34bddd,_0x54c3('0x1e'));logger[_0x54c3('0x1f')](_0x54c3('0x20'),_0x34bddd,_0x54c3('0x1e'),JSON[_0x54c3('0x21')](_0x15683e));if(_0x15683e['error']){if(_0x15683e['error'][_0x54c3('0x22')]===0x1f4){logger[_0x54c3('0x23')](_0x54c3('0x1d'),_0x34bddd,_0x15683e[_0x54c3('0x23')]['message']);return _0x4c9217(_0x15683e[_0x54c3('0x23')]['message']);}logger[_0x54c3('0x23')](_0x54c3('0x1d'),_0x34bddd,_0x15683e['error'][_0x54c3('0x24')]);return _0x549bb7(_0x15683e[_0x54c3('0x23')][_0x54c3('0x24')]);}else{logger[_0x54c3('0x25')](_0x54c3('0x1d'),_0x34bddd,_0x54c3('0x1e'));_0x549bb7(_0x15683e[_0x54c3('0x26')]['message']);}})[_0x54c3('0x27')](function(_0x3d9873){logger[_0x54c3('0x23')](_0x54c3('0x1d'),_0x34bddd,_0x3d9873);_0x4c9217(_0x3d9873);});});}function respondWithStatusCode(_0x2e12c4,_0x13c6c9){_0x13c6c9=_0x13c6c9||0xcc;return function(_0x46a6c9){if(_0x46a6c9){return _0x2e12c4[_0x54c3('0x28')](_0x13c6c9);}return _0x2e12c4[_0x54c3('0x29')](_0x13c6c9)[_0x54c3('0x2a')]();};}function respondWithResult(_0x3da9f1,_0x33c5ea){_0x33c5ea=_0x33c5ea||0xc8;return function(_0x2b1b48){if(_0x2b1b48){return _0x3da9f1[_0x54c3('0x29')](_0x33c5ea)[_0x54c3('0x2b')](_0x2b1b48);}};}function respondWithFilteredResult(_0x4508ad,_0xc7dc0d){return function(_0x2f2bb2){if(_0x2f2bb2){var _0x522d4a=typeof _0xc7dc0d[_0x54c3('0x2c')]===_0x54c3('0x2d')&&typeof _0xc7dc0d[_0x54c3('0x2e')]===_0x54c3('0x2d');var _0x2f2ca3=_0x2f2bb2[_0x54c3('0x2f')];var _0x564f05=_0x522d4a?0x0:_0xc7dc0d[_0x54c3('0x2c')];var _0x3c20fa=_0x522d4a?_0x2f2bb2[_0x54c3('0x2f')]:_0xc7dc0d[_0x54c3('0x2c')]+_0xc7dc0d[_0x54c3('0x2e')];var _0x3351b0;if(_0x3c20fa>=_0x2f2ca3){_0x3c20fa=_0x2f2ca3;_0x3351b0=0xc8;}else{_0x3351b0=0xce;}_0x4508ad[_0x54c3('0x29')](_0x3351b0);return _0x4508ad[_0x54c3('0x30')](_0x54c3('0x31'),_0x564f05+'-'+_0x3c20fa+'/'+_0x2f2ca3)[_0x54c3('0x2b')](_0x2f2bb2);}return null;};}function patchUpdates(_0x41b0c8){return function(_0x48c1ef){try{jsonpatch[_0x54c3('0x32')](_0x48c1ef,_0x41b0c8,!![]);}catch(_0x292a83){return BPromise['reject'](_0x292a83);}return _0x48c1ef[_0x54c3('0x33')]();};}function saveUpdates(_0xa38366,_0x12a2a0){return function(_0x296e36){if(_0x296e36){return _0x296e36['update'](_0xa38366)[_0x54c3('0x34')](function(_0x119532){return _0x119532;});}return null;};}function removeEntity(_0x35a4cc,_0x218893){return function(_0x581f82){if(_0x581f82){return _0x581f82[_0x54c3('0x35')]()[_0x54c3('0x34')](function(){_0x35a4cc[_0x54c3('0x29')](0xcc)[_0x54c3('0x2a')]();});}};}function handleEntityNotFound(_0x2f05cc,_0x70624){return function(_0x5ef2f3){if(!_0x5ef2f3){_0x2f05cc[_0x54c3('0x28')](0x194);}return _0x5ef2f3;};}function handleError(_0x3ddd30,_0x2033f6){_0x2033f6=_0x2033f6||0x1f4;return function(_0x3204a5){logger['error'](_0x3204a5['stack']);if(_0x3204a5[_0x54c3('0x36')]){delete _0x3204a5['name'];}_0x3ddd30[_0x54c3('0x29')](_0x2033f6)[_0x54c3('0x37')](_0x3204a5);};}exports[_0x54c3('0x38')]=function(_0x4f71a7,_0xf6a369){var _0xa052cb={},_0x501d6b={},_0x489e15={'count':0x0,'rows':[]};var _0x179adc=_[_0x54c3('0x39')](db[_0x54c3('0x3a')][_0x54c3('0x3b')],function(_0x4779dc){return{'name':_0x4779dc[_0x54c3('0x3c')],'type':_0x4779dc[_0x54c3('0x3d')]['key']};});_0x501d6b[_0x54c3('0x3e')]=_['map'](_0x179adc,'name');_0x501d6b[_0x54c3('0x3f')]=_['keys'](_0x4f71a7[_0x54c3('0x3f')]);_0x501d6b['filters']=_['intersection'](_0x501d6b[_0x54c3('0x3e')],_0x501d6b['query']);_0xa052cb[_0x54c3('0x40')]=_['intersection'](_0x501d6b[_0x54c3('0x3e')],qs[_0x54c3('0x41')](_0x4f71a7[_0x54c3('0x3f')][_0x54c3('0x41')]));_0xa052cb[_0x54c3('0x40')]=_0xa052cb[_0x54c3('0x40')][_0x54c3('0x42')]?_0xa052cb['attributes']:_0x501d6b[_0x54c3('0x3e')];if(!_0x4f71a7[_0x54c3('0x3f')][_0x54c3('0x43')](_0x54c3('0x44'))){_0xa052cb[_0x54c3('0x2e')]=qs['limit'](_0x4f71a7[_0x54c3('0x3f')][_0x54c3('0x2e')]);_0xa052cb[_0x54c3('0x2c')]=qs[_0x54c3('0x2c')](_0x4f71a7[_0x54c3('0x3f')][_0x54c3('0x2c')]);}_0xa052cb['order']=qs[_0x54c3('0x45')](_0x4f71a7[_0x54c3('0x3f')]['sort']);_0xa052cb['where']=qs[_0x54c3('0x46')](_[_0x54c3('0x47')](_0x4f71a7[_0x54c3('0x3f')],_0x501d6b[_0x54c3('0x46')]),_0x179adc);if(_0x4f71a7[_0x54c3('0x3f')]['filter']){_0xa052cb[_0x54c3('0x48')]=_[_0x54c3('0x49')](_0xa052cb[_0x54c3('0x48')],{'$or':_[_0x54c3('0x39')](_0x179adc,function(_0x53e3d1){if(_0x53e3d1[_0x54c3('0x3d')]!=='VIRTUAL'){var _0x51aedd={};_0x51aedd[_0x53e3d1[_0x54c3('0x36')]]={'$like':'%'+_0x4f71a7[_0x54c3('0x3f')][_0x54c3('0x4a')]+'%'};return _0x51aedd;}})});}_0xa052cb=_[_0x54c3('0x49')]({},_0xa052cb,_0x4f71a7[_0x54c3('0x4b')]);var _0x4c3024={'where':_0xa052cb[_0x54c3('0x48')]};return db[_0x54c3('0x3a')][_0x54c3('0x2f')](_0x4c3024)['then'](function(_0x52ba86){_0x489e15[_0x54c3('0x2f')]=_0x52ba86;if(_0x4f71a7[_0x54c3('0x3f')]['includeAll']){_0xa052cb[_0x54c3('0x4c')]=[{'all':!![]}];}return db[_0x54c3('0x3a')]['findAll'](_0xa052cb);})[_0x54c3('0x34')](function(_0x23f57){_0x489e15[_0x54c3('0x4d')]=_0x23f57;return _0x489e15;})[_0x54c3('0x34')](respondWithFilteredResult(_0xf6a369,_0xa052cb))[_0x54c3('0x27')](handleError(_0xf6a369,null));};exports[_0x54c3('0x4e')]=function(_0x1ec60e,_0x24935c){var _0x1f075b={'raw':!![],'where':{'id':_0x1ec60e[_0x54c3('0x4f')]['id']}},_0x4806c8={};_0x4806c8['model']=_['keys'](db['OpenchannelMessage'][_0x54c3('0x3b')]);_0x4806c8[_0x54c3('0x3f')]=_['keys'](_0x1ec60e[_0x54c3('0x3f')]);_0x4806c8['filters']=_['intersection'](_0x4806c8[_0x54c3('0x3e')],_0x4806c8[_0x54c3('0x3f')]);_0x1f075b[_0x54c3('0x40')]=_['intersection'](_0x4806c8['model'],qs[_0x54c3('0x41')](_0x1ec60e['query'][_0x54c3('0x41')]));_0x1f075b[_0x54c3('0x40')]=_0x1f075b[_0x54c3('0x40')][_0x54c3('0x42')]?_0x1f075b['attributes']:_0x4806c8[_0x54c3('0x3e')];if(_0x1ec60e[_0x54c3('0x3f')]['includeAll']){_0x1f075b[_0x54c3('0x4c')]=[{'all':!![]}];}_0x1f075b=_['merge']({},_0x1f075b,_0x1ec60e[_0x54c3('0x4b')]);return db[_0x54c3('0x3a')][_0x54c3('0x50')](_0x1f075b)[_0x54c3('0x34')](handleEntityNotFound(_0x24935c,null))[_0x54c3('0x34')](respondWithResult(_0x24935c,null))[_0x54c3('0x27')](handleError(_0x24935c,null));};exports[_0x54c3('0x51')]=function(_0x1e2f0d,_0x1559b1){return db['OpenchannelMessage'][_0x54c3('0x51')](_0x1e2f0d[_0x54c3('0x52')],{})[_0x54c3('0x34')](respondWithResult(_0x1559b1,0xc9))[_0x54c3('0x27')](handleError(_0x1559b1,null));};exports[_0x54c3('0x53')]=function(_0x1f7586,_0x5816dc){if(_0x1f7586[_0x54c3('0x52')]['id']){delete _0x1f7586[_0x54c3('0x52')]['id'];}return db[_0x54c3('0x3a')]['find']({'where':{'id':_0x1f7586[_0x54c3('0x4f')]['id']}})[_0x54c3('0x34')](handleEntityNotFound(_0x5816dc,null))[_0x54c3('0x34')](saveUpdates(_0x1f7586[_0x54c3('0x52')],null))[_0x54c3('0x34')](respondWithResult(_0x5816dc,null))[_0x54c3('0x27')](handleError(_0x5816dc,null));};exports[_0x54c3('0x35')]=function(_0x1872e2,_0x4e1b4b){return db[_0x54c3('0x3a')][_0x54c3('0x50')]({'where':{'id':_0x1872e2[_0x54c3('0x4f')]['id']}})[_0x54c3('0x34')](handleEntityNotFound(_0x4e1b4b,null))['then'](removeEntity(_0x4e1b4b,null))[_0x54c3('0x27')](handleError(_0x4e1b4b,null));};exports[_0x54c3('0x54')]=function(_0x47d1dd,_0x1f9957){return db['OpenchannelMessage'][_0x54c3('0x54')]()[_0x54c3('0x34')](respondWithResult(_0x1f9957,null))[_0x54c3('0x27')](handleError(_0x1f9957,null));};var interaction_log=require(_0x54c3('0x55'))(_0x54c3('0x56'));exports[_0x54c3('0x57')]=function(_0x5ba3c0,_0xb8e0ca,_0x2295ca){var _0x548e09={'agent':{},'channel':_0x54c3('0x58')};if(_0x5ba3c0[_0x54c3('0x52')]['id']){delete _0x5ba3c0[_0x54c3('0x52')]['id'];}_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x59')]=!![];_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5a')]=moment()[_0x54c3('0x5b')](_0x54c3('0x5c'));_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5d')]=_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5d')]||_0x5ba3c0[_0x54c3('0x5e')]['id'];_0x548e09[_0x54c3('0x5f')]['id']=_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5d')];return db['OpenchannelMessage'][_0x54c3('0x50')]({'where':{'id':_0x5ba3c0['params']['id'],'UserId':null}})[_0x54c3('0x34')](handleEntityNotFound(_0xb8e0ca,null))[_0x54c3('0x34')](saveUpdates(_0x5ba3c0[_0x54c3('0x52')],null))['then'](function(_0x1e78c7){if(_0x1e78c7){_0x548e09[_0x54c3('0x24')]=_0x1e78c7[_0x54c3('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0x54c3('0x50')]({'where':{'id':_0x1e78c7[_0x54c3('0x61')]}});}return null;})[_0x54c3('0x34')](handleEntityNotFound(_0xb8e0ca,null))[_0x54c3('0x34')](function(_0x592f41){if(_0x592f41){return _0x592f41['update']({'UserId':_0x5ba3c0[_0x54c3('0x52')]['UserId'],'read1stAt':_[_0x54c3('0x62')](_0x592f41[_0x54c3('0x63')])?moment()[_0x54c3('0x5b')](_0x54c3('0x5c')):undefined});}return null;})[_0x54c3('0x34')](function(_0xbf2910){if(_0xbf2910){_0x548e09[_0x54c3('0x64')]=_0xbf2910[_0x54c3('0x60')]({'plain':!![]});interaction_log['info'](_0x54c3('0x65'),_0x5ba3c0[_0x54c3('0x5e')]['id'],_0x5ba3c0[_0x54c3('0x5e')]['name'],_0x5ba3c0[_0x54c3('0x5e')]['role'],_0x548e09['interaction']['id'],_0x5ba3c0[_0x54c3('0x52')]?JSON[_0x54c3('0x21')](_0x5ba3c0['body']):_0x54c3('0x66'));return respondWithRpcPromise(_0x54c3('0x67'),_0x54c3('0x68'),_0x548e09);}return null;})[_0x54c3('0x34')](function(_0x393d61){var _0x1702af=_0x54c3('0x69')+_0x393d61['message']['ContactId'];return db[_0x54c3('0x6a')][_0x54c3('0x3f')](_0x1702af,{'type':db['Sequelize'][_0x54c3('0x6b')]['SELECT'],'raw':!![]})[_0x54c3('0x34')](function(_0x1030f2){return _0x1030f2;});})[_0x54c3('0x34')](function(_0x478d6f){if(_0x478d6f){_0x548e09[_0x54c3('0x24')][_0x54c3('0x6c')]=_0x478d6f[0x0];if(!_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5d')])return;return db[_0x54c3('0x6d')][_0x54c3('0x50')]({'where':{'id':_0x5ba3c0[_0x54c3('0x52')][_0x54c3('0x5d')],'role':_0x54c3('0x5f')},'attributes':['id',_0x54c3('0x36'),'fullname',_0x54c3('0x6e'),'internal'],'raw':!![]});}return null;})[_0x54c3('0x34')](function(_0x2ab43d){if(!_0x2ab43d)return null;_0x548e09[_0x54c3('0x24')][_0x54c3('0x5f')]=_0x2ab43d;return _0x548e09;})['then'](function(_0x38884e){if(_0x38884e){if(_0x5ba3c0['body'][_0x54c3('0x6f')]){_0x548e09['message']['interface']=util[_0x54c3('0x5b')](_0x54c3('0x70'),_0x5ba3c0[_0x54c3('0x5e')]['name']);_0x548e09[_0x54c3('0x24')][_0x54c3('0x71')]=_0x548e09[_0x54c3('0x71')];_0x548e09['message'][_0x54c3('0x72')]=_0x548e09[_0x54c3('0x71')];_0x548e09['message'][_0x54c3('0x73')]=_0x54c3('0x57');return respondWithRpcPromise(_0x54c3('0x74'),'EventManager',{'event':_0x54c3('0x75'),'message':_0x548e09['message']},client9002)[_0x54c3('0x34')](function(){return _0x548e09;});}return _0x548e09;}return null;})['then'](respondWithResult(_0xb8e0ca,null))[_0x54c3('0x27')](handleError(_0xb8e0ca,null));};var interaction_log=require(_0x54c3('0x55'))(_0x54c3('0x56'));exports[_0x54c3('0x76')]=function(_0x11e80d,_0x4a01b0,_0x3c6be1){var _0xbd7940={'agent':{},'channel':_0x54c3('0x58')};if(_0x11e80d[_0x54c3('0x52')]['id']){delete _0x11e80d[_0x54c3('0x52')]['id'];}_0x11e80d['body'][_0x54c3('0x5d')]=_0x11e80d['body']['UserId']||_0x11e80d[_0x54c3('0x5e')]['id'];_0xbd7940[_0x54c3('0x5f')]['id']=_0x11e80d[_0x54c3('0x52')][_0x54c3('0x5d')];return db[_0x54c3('0x3a')][_0x54c3('0x50')]({'where':{'id':_0x11e80d[_0x54c3('0x4f')]['id'],'UserId':null}})[_0x54c3('0x34')](handleEntityNotFound(_0x4a01b0,null))[_0x54c3('0x34')](function(_0x4110db){if(_0x4110db){_0xbd7940['message']=_0x4110db['get']({'plain':!![]});return db[_0x54c3('0x77')][_0x54c3('0x50')]({'where':{'id':_0x4110db['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4a01b0,null))[_0x54c3('0x34')](function(_0x4bc401){if(_0x4bc401){_0xbd7940[_0x54c3('0x64')]=_0x4bc401['get']({'plain':!![]});interaction_log[_0x54c3('0x25')](_0x54c3('0x78'),_0x11e80d['user']['id'],_0x11e80d[_0x54c3('0x5e')][_0x54c3('0x36')],_0x11e80d[_0x54c3('0x5e')]['role'],_0xbd7940[_0x54c3('0x64')]['id'],_0x11e80d[_0x54c3('0x52')]?JSON[_0x54c3('0x21')](_0x11e80d[_0x54c3('0x52')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0xbd7940);}return null;})[_0x54c3('0x34')](function(_0x546688){var _0x31fe38='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x546688[_0x54c3('0x24')]['ContactId'];return db[_0x54c3('0x6a')][_0x54c3('0x3f')](_0x31fe38,{'type':db[_0x54c3('0x79')][_0x54c3('0x6b')][_0x54c3('0x7a')],'raw':!![]})[_0x54c3('0x34')](function(_0x5322f2){return _0x5322f2;});})['then'](function(_0x37ec4e){if(_0x37ec4e){_0xbd7940[_0x54c3('0x24')][_0x54c3('0x6c')]=_0x37ec4e[0x0];if(!_0x11e80d[_0x54c3('0x52')]['UserId'])return;return db[_0x54c3('0x6d')][_0x54c3('0x50')]({'where':{'id':_0x11e80d[_0x54c3('0x52')][_0x54c3('0x5d')],'role':_0x54c3('0x5f')},'attributes':['id',_0x54c3('0x36'),_0x54c3('0x7b'),_0x54c3('0x6e'),_0x54c3('0x7c')],'raw':!![]});}return null;})[_0x54c3('0x34')](function(_0x57bff2){if(!_0x57bff2)return null;_0xbd7940[_0x54c3('0x24')][_0x54c3('0x5f')]=_0x57bff2;return _0xbd7940;})['then'](function(_0x5f5159){if(_0x5f5159){_0x5f5159[_0x54c3('0x24')][_0x54c3('0x7d')]=util[_0x54c3('0x5b')]('SIP/%s',_0x11e80d['user']['name']);_0x5f5159[_0x54c3('0x24')][_0x54c3('0x71')]=_0xbd7940['channel'];_0x5f5159[_0x54c3('0x24')]['motionChannel']=_0xbd7940[_0x54c3('0x71')];_0x5f5159['message']['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x54c3('0x7e'),'message':_0x5f5159['message']},client9002);return _0xbd7940;}return null;})['then'](respondWithResult(_0x4a01b0,null))[_0x54c3('0x27')](handleError(_0x4a01b0,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 3371c24..55659ff 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 _0xfcea=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcea,0x188));var _0xafce=function(_0x224274,_0x44091d){_0x224274=_0x224274-0x0;var _0x11ee3d=_0xfcea[_0x224274];return _0x11ee3d;};'use strict';var EventEmitter=require(_0xafce('0x0'));var OpenchannelMessage=require(_0xafce('0x1'))['db'][_0xafce('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xafce('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xafce('0x4'),'afterDestroy':_0xafce('0x5')};function emitEvent(_0x4a202b){return function(_0x1257b4,_0x24dd63,_0x385ebf){OpenchannelMessageEvents[_0xafce('0x6')](_0x4a202b+':'+_0x1257b4['id'],_0x1257b4);OpenchannelMessageEvents[_0xafce('0x6')](_0x4a202b,_0x1257b4);_0x385ebf(null);};}for(var e in events){if(events[_0xafce('0x7')](e)){var event=events[e];OpenchannelMessage[_0xafce('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x0058=['OpenchannelMessage','setMaxListeners','save','remove','emit','hook','../../mysqldb'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x0058,0x1e9));var _0x8005=function(_0x82754b,_0x419d29){_0x82754b=_0x82754b-0x0;var _0x4e0027=_0x0058[_0x82754b];return _0x4e0027;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x8005('0x0'))['db'][_0x8005('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8005('0x2')](0x0);var events={'afterCreate':_0x8005('0x3'),'afterUpdate':'update','afterDestroy':_0x8005('0x4')};function emitEvent(_0x31af9f){return function(_0x1fa35f,_0x586ef2,_0x1e2655){OpenchannelMessageEvents[_0x8005('0x5')](_0x31af9f+':'+_0x1fa35f['id'],_0x1fa35f);OpenchannelMessageEvents[_0x8005('0x5')](_0x31af9f,_0x1fa35f);_0x1e2655(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x8005('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 96783cf..68188dd 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 _0x0b0e=['get','toLowerCase','direction','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x0b0e[_0x1ebe90];return _0x447c82;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xe0b0('0xb'),'fields':[_0xe0b0('0xc')],'type':_0xe0b0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ac27e,_0x4c24f9,_0x338e7c){var _0x1dd3b8=_0x30e20d['models'];var _0x1fef28=_0x2ac27e[_0xe0b0('0xe')]({'plain':!![]});if(_0x1fef28['direction'][_0xe0b0('0xf')]()==='in'||_0x1fef28[_0xe0b0('0x10')][_0xe0b0('0xf')]()==='out'&&!_0x1fef28[_0xe0b0('0x11')]&&!_[_0xe0b0('0x12')](_0x1fef28[_0xe0b0('0x13')])){_0x1dd3b8[_0xe0b0('0x14')][_0xe0b0('0x15')]({'where':{'id':_0x1fef28['OpenchannelInteractionId']}})[_0xe0b0('0x16')](function(_0x154de6){if(_0x154de6){_0x154de6[_0xe0b0('0x17')]({'lastMsgAt':_0x1fef28[_0xe0b0('0x18')],'lastMsgDirection':_0x1fef28[_0xe0b0('0x10')]['toLowerCase']()});}})[_0xe0b0('0x19')](function(_0x5adb01){console[_0xe0b0('0x1a')](_0x5adb01);});}if(_0x1fef28[_0xe0b0('0x10')]==='out'&&!_0x1fef28[_0xe0b0('0x11')]){var _0x4a4cc0;_0x1dd3b8[_0xe0b0('0x1b')][_0xe0b0('0x1c')]()['then'](function(_0x54a3eb){return _0x1dd3b8[_0xe0b0('0x1d')]['find']({'where':{'id':_0x1fef28['OpenchannelAccountId']},'include':[{'model':_0x1dd3b8['OpenchannelInteraction'],'as':_0xe0b0('0x1e'),'where':{'id':_0x1fef28['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x1dd3b8['CmContact'],'as':_0xe0b0('0x1f'),'attributes':_['keys'](_0x54a3eb)}]}]});})[_0xe0b0('0x16')](function(_0x5dba2f){_0x4a4cc0=_0x5dba2f[_0xe0b0('0xe')]({'plain':!![]});if(_0x4a4cc0&&_0x4a4cc0[_0xe0b0('0x20')]){logger[_0xe0b0('0x21')](_0xe0b0('0x22'),_0xe0b0('0x23'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x1fef28['id'],_0x4a4cc0[_0xe0b0('0x20')]));if(_0x4a4cc0['Interactions']&&_0x4a4cc0[_0xe0b0('0x1e')][_0xe0b0('0x24')]){_0x1fef28['Interaction']=_[_0xe0b0('0x25')](_0x4a4cc0['Interactions'][0x0],_0xe0b0('0x1f'));_0x1fef28['Contact']=_0x4a4cc0[_0xe0b0('0x1e')][0x0]['Contact'];}var _0x4c24f9={'method':'POST','uri':encodeURI(_0x4a4cc0[_0xe0b0('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4c24f9['method']){case _0xe0b0('0x26'):_0x4c24f9['qs']=_0x1fef28;break;case'POST':_0x4c24f9[_0xe0b0('0xc')]=_0x1fef28;break;}return rp(_0x4c24f9)[_0xe0b0('0x16')](function(_0x1f1ebd){logger[_0xe0b0('0x21')](_0xe0b0('0x22'),_0xe0b0('0x23'),util['format'](_0xe0b0('0x27'),_0x1fef28['id'],_0x4a4cc0[_0xe0b0('0x20')]));if(_0x1f1ebd['body'][_0xe0b0('0x28')]&&_0x1f1ebd[_0xe0b0('0xc')][_0xe0b0('0x28')]!=_0x1fef28[_0xe0b0('0x29')][_0xe0b0('0x28')]){return _0x1dd3b8[_0xe0b0('0x14')][_0xe0b0('0x17')]({'threadId':_0x1f1ebd['body'][_0xe0b0('0x28')]},{'logging':!![],'where':{'id':_0x1fef28[_0xe0b0('0x29')]['id']}});}else{return;}})['then'](function(){return _0x2ac27e['update']({'read':!![]});})[_0xe0b0('0x19')](function(_0x33e672){logger[_0xe0b0('0x1a')](_0xe0b0('0x22'),_0xe0b0('0x23'),util['inspect'](_0x33e672,{'showHidden':![],'depth':null}));_0x338e7c();});}else{_0x338e7c();}})[_0xe0b0('0x2a')](function(){_0x338e7c();});}else{_0x338e7c();}}},'charset':_0xe0b0('0x2b'),'collate':_0xe0b0('0x2c')});}; \ No newline at end of file +var _0xea28=['moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Contact','POST','GET','afterCreate','threadId','finally','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x444cbd,_0x1cf41c){var _0xfc72fa=function(_0x42e371){while(--_0x42e371){_0x444cbd['push'](_0x444cbd['shift']());}};_0xfc72fa(++_0x1cf41c);}(_0xea28,0x13a));var _0x8ea2=function(_0x46d282,_0x259f89){_0x46d282=_0x46d282-0x0;var _0x2f91ac=_0xea28[_0x46d282];return _0x2f91ac;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'paranoid':![],'indexes':[{'name':_0x8ea2('0xe'),'fields':[_0x8ea2('0xf')],'type':_0x8ea2('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x320750,_0x3de4a1,_0x3000f9){var _0x3d0b35=_0x513a0d[_0x8ea2('0x11')];var _0x500b82=_0x320750['get']({'plain':!![]});if(_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()==='in'||_0x500b82[_0x8ea2('0x12')]['toLowerCase']()===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]&&!_[_0x8ea2('0x16')](_0x500b82[_0x8ea2('0x17')])){_0x3d0b35[_0x8ea2('0x18')]['findOne']({'where':{'id':_0x500b82[_0x8ea2('0x19')]}})['then'](function(_0x4b2192){if(_0x4b2192){_0x4b2192[_0x8ea2('0x1a')]({'lastMsgAt':_0x500b82[_0x8ea2('0x1b')],'lastMsgDirection':_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()});}})[_0x8ea2('0x1c')](function(_0xbb9bd1){console[_0x8ea2('0x1d')](_0xbb9bd1);});}if(_0x500b82[_0x8ea2('0x12')]===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]){var _0x2dfa7c;_0x3d0b35[_0x8ea2('0x1e')][_0x8ea2('0x1f')]()[_0x8ea2('0x20')](function(_0x1b64cf){return _0x3d0b35[_0x8ea2('0x21')][_0x8ea2('0x22')]({'where':{'id':_0x500b82[_0x8ea2('0x23')]},'include':[{'model':_0x3d0b35[_0x8ea2('0x18')],'as':_0x8ea2('0x24'),'where':{'id':_0x500b82[_0x8ea2('0x19')]},'limit':0x1,'include':[{'model':_0x3d0b35[_0x8ea2('0x1e')],'as':'Contact','attributes':_['keys'](_0x1b64cf)}]}]});})[_0x8ea2('0x20')](function(_0x248c18){_0x2dfa7c=_0x248c18[_0x8ea2('0x25')]({'plain':!![]});if(_0x2dfa7c&&_0x2dfa7c['replyUri']){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),'afterCreate',util[_0x8ea2('0x28')](_0x8ea2('0x29'),_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x2dfa7c[_0x8ea2('0x24')]&&_0x2dfa7c[_0x8ea2('0x24')][_0x8ea2('0x2b')]){_0x500b82[_0x8ea2('0x2c')]=_[_0x8ea2('0x2d')](_0x2dfa7c[_0x8ea2('0x24')][0x0],'Contact');_0x500b82[_0x8ea2('0x2e')]=_0x2dfa7c['Interactions'][0x0][_0x8ea2('0x2e')];}var _0x3de4a1={'method':_0x8ea2('0x2f'),'uri':encodeURI(_0x2dfa7c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3de4a1['method']){case _0x8ea2('0x30'):_0x3de4a1['qs']=_0x500b82;break;case'POST':_0x3de4a1[_0x8ea2('0xf')]=_0x500b82;break;}return rp(_0x3de4a1)['then'](function(_0x3be291){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x8ea2('0x31'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x3be291['body'][_0x8ea2('0x32')]&&_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]!=_0x500b82[_0x8ea2('0x2c')][_0x8ea2('0x32')]){return _0x3d0b35[_0x8ea2('0x18')][_0x8ea2('0x1a')]({'threadId':_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]},{'logging':!![],'where':{'id':_0x500b82[_0x8ea2('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x320750['update']({'read':!![]});})[_0x8ea2('0x1c')](function(_0x188553){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x8ea2('0x31'),util['inspect'](_0x188553,{'showHidden':![],'depth':null}));_0x3000f9();});}else{_0x3000f9();}})[_0x8ea2('0x33')](function(){_0x3000f9();});}else{_0x3000f9();}}},'charset':_0x8ea2('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index a10920a..c1d0f68 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x376e78,_0xd6f853){var _0x219ae0=function(_0x1054a2){while(--_0x1054a2){_0x376e78['push'](_0x376e78['shift']());}};_0x219ae0(++_0xd6f853);}(_0xadb5,0xad));var _0x5adb=function(_0x27fe1f,_0x1680b7){_0x27fe1f=_0x27fe1f-0x0;var _0x26b421=_0xadb5[_0x27fe1f];return _0x26b421;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x36b3f8,_0x559f42){var _0x1a9456=function(_0x47380d){while(--_0x47380d){_0x36b3f8['push'](_0x36b3f8['shift']());}};_0x1a9456(++_0x559f42);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3f91af,_0x48325b){_0x3f91af=_0x3f91af-0x0;var _0xa47cd4=_0x5f2f[_0x3f91af];return _0xa47cd4;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3b3a93b..fca19fa 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 _0xb401=['./openchannelMessage.events','emit','removeListener','register','length','openchannelMessage:'];(function(_0x19cb1a,_0x4ce1b2){var _0x399650=function(_0x3bfcde){while(--_0x3bfcde){_0x19cb1a['push'](_0x19cb1a['shift']());}};_0x399650(++_0x4ce1b2);}(_0xb401,0x1e0));var _0x1b40=function(_0x4aace4,_0x2c2119){_0x4aace4=_0x4aace4-0x0;var _0x15b47c=_0xb401[_0x4aace4];return _0x15b47c;};'use strict';var OpenchannelMessageEvents=require(_0x1b40('0x0'));var events=['save','remove','update'];function createListener(_0xc9041a,_0x18e6c3){return function(_0x53a184){_0x18e6c3[_0x1b40('0x1')](_0xc9041a,_0x53a184);};}function removeListener(_0x511022,_0x1dda04){return function(){OpenchannelMessageEvents[_0x1b40('0x2')](_0x511022,_0x1dda04);};}exports[_0x1b40('0x3')]=function(_0x412442){for(var _0xa9433a=0x0,_0x7ad50=events[_0x1b40('0x4')];_0xa9433a<_0x7ad50;_0xa9433a++){var _0x3af61a=events[_0xa9433a];var _0xa8efb=createListener(_0x1b40('0x5')+_0x3af61a,_0x412442);OpenchannelMessageEvents['on'](_0x3af61a,_0xa8efb);}}; \ No newline at end of file +var _0xb8a1=['update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x270032,_0x22d83c){var _0xe49008=function(_0x52649f){while(--_0x52649f){_0x270032['push'](_0x270032['shift']());}};_0xe49008(++_0x22d83c);}(_0xb8a1,0x1bd));var _0x1b8a=function(_0x1b7a85,_0x632bf0){_0x1b7a85=_0x1b7a85-0x0;var _0x3a3029=_0xb8a1[_0x1b7a85];return _0x3a3029;};'use strict';var OpenchannelMessageEvents=require(_0x1b8a('0x0'));var events=[_0x1b8a('0x1'),_0x1b8a('0x2'),_0x1b8a('0x3')];function createListener(_0x50b43f,_0x3c5fcb){return function(_0x4e7d2a){_0x3c5fcb[_0x1b8a('0x4')](_0x50b43f,_0x4e7d2a);};}function removeListener(_0x531610,_0xd532e2){return function(){OpenchannelMessageEvents[_0x1b8a('0x5')](_0x531610,_0xd532e2);};}exports['register']=function(_0x3bc4f2){for(var _0x5c3092=0x0,_0x4ddd71=events[_0x1b8a('0x6')];_0x5c3092<_0x4ddd71;_0x5c3092++){var _0x13f884=events[_0x5c3092];var _0x220bdd=createListener(_0x1b8a('0x7')+_0x13f884,_0x3bc4f2);OpenchannelMessageEvents['on'](_0x13f884,_0x220bdd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4023390..65b18d4 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 _0x4d7a=['addTeams','/:id/users','addAgents','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','post','create'];(function(_0x56cd23,_0x4bef11){var _0x5dfb99=function(_0x522930){while(--_0x522930){_0x56cd23['push'](_0x56cd23['shift']());}};_0x5dfb99(++_0x4bef11);}(_0x4d7a,0x1b7));var _0xa4d7=function(_0x465639,_0x1f9ae7){_0x465639=_0x465639-0x0;var _0x484b9d=_0x4d7a[_0x465639];return _0x484b9d;};'use strict';var multer=require(_0xa4d7('0x0'));var util=require(_0xa4d7('0x1'));var path=require('path');var timeout=require(_0xa4d7('0x2'));var express=require(_0xa4d7('0x3'));var router=express[_0xa4d7('0x4')]();var fs_extra=require(_0xa4d7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa4d7('0x6'));var config=require(_0xa4d7('0x7'));var controller=require(_0xa4d7('0x8'));router[_0xa4d7('0x9')]('/',auth[_0xa4d7('0xa')](),controller[_0xa4d7('0xb')]);router[_0xa4d7('0x9')](_0xa4d7('0xc'),auth[_0xa4d7('0xa')](),controller[_0xa4d7('0xd')]);router[_0xa4d7('0x9')](_0xa4d7('0xe'),auth[_0xa4d7('0xa')](),controller['show']);router['get'](_0xa4d7('0xf'),auth[_0xa4d7('0xa')](),controller[_0xa4d7('0x10')]);router['get'](_0xa4d7('0x11'),auth[_0xa4d7('0xa')](),controller['getTeams']);router[_0xa4d7('0x9')]('/:id/users',auth[_0xa4d7('0xa')](),controller['getAgents']);router[_0xa4d7('0x12')]('/',auth[_0xa4d7('0xa')](),controller[_0xa4d7('0x13')]);router[_0xa4d7('0x12')]('/:id/teams',auth[_0xa4d7('0xa')](),controller[_0xa4d7('0x14')]);router['post'](_0xa4d7('0x15'),auth[_0xa4d7('0xa')](),controller[_0xa4d7('0x16')]);router['put'](_0xa4d7('0xe'),auth[_0xa4d7('0xa')](),controller['update']);router[_0xa4d7('0x17')](_0xa4d7('0xe'),auth['isAuthenticated'](),controller[_0xa4d7('0x18')]);router[_0xa4d7('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xa4d7('0x19')]);router['delete'](_0xa4d7('0x15'),auth[_0xa4d7('0xa')](),controller[_0xa4d7('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xc11d=['index','/describe','/:id','show','/:id/teams','getTeams','/:id/users','create','post','addTeams','update','delete','destroy','removeTeams','removeAgents','util','connect-timeout','express','Router','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x5520a0,_0x143ac0){var _0x4ed976=function(_0x5ae266){while(--_0x5ae266){_0x5520a0['push'](_0x5520a0['shift']());}};_0x4ed976(++_0x143ac0);}(_0xc11d,0x1f3));var _0xdc11=function(_0x44770c,_0x2546c7){_0x44770c=_0x44770c-0x0;var _0x1ed083=_0xc11d[_0x44770c];return _0x1ed083;};'use strict';var multer=require('multer');var util=require(_0xdc11('0x0'));var path=require('path');var timeout=require(_0xdc11('0x1'));var express=require(_0xdc11('0x2'));var router=express[_0xdc11('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdc11('0x4'));router[_0xdc11('0x5')]('/',auth[_0xdc11('0x6')](),controller[_0xdc11('0x7')]);router[_0xdc11('0x5')](_0xdc11('0x8'),auth[_0xdc11('0x6')](),controller['describe']);router[_0xdc11('0x5')](_0xdc11('0x9'),auth[_0xdc11('0x6')](),controller[_0xdc11('0xa')]);router[_0xdc11('0x5')]('/:id/members',auth[_0xdc11('0x6')](),controller['getMembers']);router[_0xdc11('0x5')](_0xdc11('0xb'),auth[_0xdc11('0x6')](),controller[_0xdc11('0xc')]);router[_0xdc11('0x5')](_0xdc11('0xd'),auth[_0xdc11('0x6')](),controller['getAgents']);router['post']('/',auth[_0xdc11('0x6')](),controller[_0xdc11('0xe')]);router[_0xdc11('0xf')](_0xdc11('0xb'),auth['isAuthenticated'](),controller[_0xdc11('0x10')]);router[_0xdc11('0xf')](_0xdc11('0xd'),auth[_0xdc11('0x6')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdc11('0x11')]);router[_0xdc11('0x12')](_0xdc11('0x9'),auth[_0xdc11('0x6')](),controller[_0xdc11('0x13')]);router['delete'](_0xdc11('0xb'),auth[_0xdc11('0x6')](),controller[_0xdc11('0x14')]);router[_0xdc11('0x12')](_0xdc11('0xd'),auth['isAuthenticated'](),controller[_0xdc11('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ee4547c..ffe3800 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 _0x6deb=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6deb,0x12d));var _0xb6de=function(_0x24496d,_0x4d4ac0){_0x24496d=_0x24496d-0x0;var _0x323a6a=_0x6deb[_0x24496d];return _0x323a6a;};'use strict';var Sequelize=require(_0xb6de('0x0'));module[_0xb6de('0x1')]={'name':{'type':Sequelize[_0xb6de('0x2')],'unique':_0xb6de('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb6de('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb6de('0x4')](_0xb6de('0x5'),_0xb6de('0x6'),_0xb6de('0x7'))}}; \ No newline at end of file +var _0xb50e=['rrmemory','sequelize','exports','STRING','INTEGER'];(function(_0x29646d,_0x19f0d7){var _0x327cfa=function(_0x29c296){while(--_0x29c296){_0x29646d['push'](_0x29646d['shift']());}};_0x327cfa(++_0x19f0d7);}(_0xb50e,0xfb));var _0xeb50=function(_0x5ee58f,_0x3ad41f){_0x5ee58f=_0x5ee58f-0x0;var _0x330129=_0xb50e[_0x5ee58f];return _0x330129;};'use strict';var Sequelize=require(_0xeb50('0x0'));module[_0xeb50('0x1')]={'name':{'type':Sequelize[_0xeb50('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeb50('0x2')]},'timeout':{'type':Sequelize[_0xeb50('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xeb50('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 29a9e92..afbce6a 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 _0x99ab=['removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/license/util','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','apply','save','update','get','OpenchannelQueues','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','OpenchannelQueue','include','rows','catch','params','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','UserOpenchannelQueue','pick','OpenchannelQueueId','findAll','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','%s/%s','findOne','getTeams','addTeams','ids','Agents','online','sequelize','transaction','each','findOrCreate','userOpenchannelQueue:save','removeTeams','Team','User','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','value','isEmpty'];(function(_0x3c2166,_0x41fc16){var _0x30ccc3=function(_0x689bc3){while(--_0x689bc3){_0x3c2166['push'](_0x3c2166['shift']());}};_0x30ccc3(++_0x41fc16);}(_0x99ab,0x1aa));var _0xb99a=function(_0x3e0a1b,_0x119ef5){_0x3e0a1b=_0x3e0a1b-0x0;var _0x23cd93=_0x99ab[_0x3e0a1b];return _0x23cd93;};'use strict';var emlformat=require(_0xb99a('0x0'));var rimraf=require(_0xb99a('0x1'));var zipdir=require(_0xb99a('0x2'));var jsonpatch=require(_0xb99a('0x3'));var rp=require(_0xb99a('0x4'));var moment=require('moment');var BPromise=require(_0xb99a('0x5'));var Mustache=require(_0xb99a('0x6'));var util=require('util');var path=require(_0xb99a('0x7'));var sox=require(_0xb99a('0x8'));var csv=require(_0xb99a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb99a('0xa'));var _=require(_0xb99a('0xb'));var squel=require(_0xb99a('0xc'));var crypto=require(_0xb99a('0xd'));var jsforce=require(_0xb99a('0xe'));var deskjs=require(_0xb99a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb99a('0x10'));var Papa=require('papaparse');var Redis=require(_0xb99a('0x11'));var authService=require(_0xb99a('0x12'));var qs=require(_0xb99a('0x13'));var as=require(_0xb99a('0x14'));var hardwareService=require(_0xb99a('0x15'));var logger=require(_0xb99a('0x16'))(_0xb99a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb99a('0x18'));var db=require('../../mysqldb')['db'];config[_0xb99a('0x19')]=_[_0xb99a('0x1a')](config[_0xb99a('0x19')],{'host':_0xb99a('0x1b'),'port':0x18eb});var socket=require(_0xb99a('0x1c'))(new Redis(config[_0xb99a('0x19')]));require('./openchannelQueue.socket')[_0xb99a('0x1d')](socket);function respondWithStatusCode(_0x5900e9,_0x36c17d){_0x36c17d=_0x36c17d||0xcc;return function(_0x35b8a4){if(_0x35b8a4){return _0x5900e9['sendStatus'](_0x36c17d);}return _0x5900e9[_0xb99a('0x1e')](_0x36c17d)[_0xb99a('0x1f')]();};}function respondWithResult(_0x46ba80,_0x4a2382){_0x4a2382=_0x4a2382||0xc8;return function(_0x3730ad){if(_0x3730ad){return _0x46ba80[_0xb99a('0x1e')](_0x4a2382)[_0xb99a('0x20')](_0x3730ad);}};}function respondWithFilteredResult(_0x1093b2,_0xf97556){return function(_0x271911){if(_0x271911){var _0x5e31a3=typeof _0xf97556[_0xb99a('0x21')]==='undefined'&&typeof _0xf97556[_0xb99a('0x22')]===_0xb99a('0x23');var _0x5b2884=_0x271911[_0xb99a('0x24')];var _0x6e06e=_0x5e31a3?0x0:_0xf97556[_0xb99a('0x21')];var _0x5b2f03=_0x5e31a3?_0x271911[_0xb99a('0x24')]:_0xf97556[_0xb99a('0x21')]+_0xf97556['limit'];var _0xefaea8;if(_0x5b2f03>=_0x5b2884){_0x5b2f03=_0x5b2884;_0xefaea8=0xc8;}else{_0xefaea8=0xce;}_0x1093b2[_0xb99a('0x1e')](_0xefaea8);return _0x1093b2[_0xb99a('0x25')]('Content-Range',_0x6e06e+'-'+_0x5b2f03+'/'+_0x5b2884)[_0xb99a('0x20')](_0x271911);}return null;};}function patchUpdates(_0x5302bc){return function(_0x2e744a){try{jsonpatch[_0xb99a('0x26')](_0x2e744a,_0x5302bc,!![]);}catch(_0x108da3){return BPromise['reject'](_0x108da3);}return _0x2e744a[_0xb99a('0x27')]();};}function saveUpdates(_0x2dedc3,_0x3d0827){return function(_0x304901){if(_0x304901){return _0x304901[_0xb99a('0x28')](_0x2dedc3)['then'](function(_0x341c77){return _0x341c77;});}return null;};}function removeEntity(_0x4d960e,_0x337d5d){return function(_0x23444e){if(_0x23444e){return _0x23444e['destroy']()['then'](function(){var _0x52390b=_0x23444e[_0xb99a('0x29')]({'plain':!![]});var _0x330b8a=_0xb99a('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x330b8a,'resourceId':_0x52390b['id']}})[_0xb99a('0x2b')](function(){return _0x23444e;});})[_0xb99a('0x2b')](function(){_0x4d960e['status'](0xcc)[_0xb99a('0x1f')]();});}};}function handleEntityNotFound(_0x3b2e24,_0x450b2b){return function(_0x1d4134){if(!_0x1d4134){_0x3b2e24[_0xb99a('0x2c')](0x194);}return _0x1d4134;};}function handleError(_0x571bc3,_0xb9ff0b){_0xb9ff0b=_0xb9ff0b||0x1f4;return function(_0x29e9fd){logger[_0xb99a('0x2d')](_0x29e9fd[_0xb99a('0x2e')]);if(_0x29e9fd['name']){delete _0x29e9fd[_0xb99a('0x2f')];}_0x571bc3[_0xb99a('0x1e')](_0xb9ff0b)[_0xb99a('0x30')](_0x29e9fd);};}exports[_0xb99a('0x31')]=function(_0x5dd73a,_0x15c2d9){var _0x271e5c={},_0x4b7f1b={},_0x4428c8={'count':0x0,'rows':[]};var _0x20b8e5=_[_0xb99a('0x32')](db['OpenchannelQueue'][_0xb99a('0x33')],function(_0xa34ed2){return{'name':_0xa34ed2[_0xb99a('0x34')],'type':_0xa34ed2['type']['key']};});_0x4b7f1b[_0xb99a('0x35')]=_[_0xb99a('0x32')](_0x20b8e5,_0xb99a('0x2f'));_0x4b7f1b[_0xb99a('0x36')]=_[_0xb99a('0x37')](_0x5dd73a[_0xb99a('0x36')]);_0x4b7f1b['filters']=_[_0xb99a('0x38')](_0x4b7f1b['model'],_0x4b7f1b[_0xb99a('0x36')]);_0x271e5c[_0xb99a('0x39')]=_['intersection'](_0x4b7f1b[_0xb99a('0x35')],qs['fields'](_0x5dd73a[_0xb99a('0x36')][_0xb99a('0x3a')]));_0x271e5c[_0xb99a('0x39')]=_0x271e5c[_0xb99a('0x39')][_0xb99a('0x3b')]?_0x271e5c[_0xb99a('0x39')]:_0x4b7f1b[_0xb99a('0x35')];if(!_0x5dd73a[_0xb99a('0x36')][_0xb99a('0x3c')](_0xb99a('0x3d'))){_0x271e5c[_0xb99a('0x22')]=qs[_0xb99a('0x22')](_0x5dd73a[_0xb99a('0x36')][_0xb99a('0x22')]);_0x271e5c['offset']=qs[_0xb99a('0x21')](_0x5dd73a[_0xb99a('0x36')][_0xb99a('0x21')]);}_0x271e5c[_0xb99a('0x3e')]=qs['sort'](_0x5dd73a[_0xb99a('0x36')][_0xb99a('0x3f')]);_0x271e5c[_0xb99a('0x40')]=qs[_0xb99a('0x41')](_['pick'](_0x5dd73a[_0xb99a('0x36')],_0x4b7f1b[_0xb99a('0x41')]),_0x20b8e5);if(_0x5dd73a[_0xb99a('0x36')][_0xb99a('0x42')]){_0x271e5c['where']=_['merge'](_0x271e5c[_0xb99a('0x40')],{'$or':_[_0xb99a('0x32')](_0x20b8e5,function(_0x39fe99){if(_0x39fe99[_0xb99a('0x43')]!==_0xb99a('0x44')){var _0x439d45={};_0x439d45[_0x39fe99[_0xb99a('0x2f')]]={'$like':'%'+_0x5dd73a[_0xb99a('0x36')][_0xb99a('0x42')]+'%'};return _0x439d45;}})});}_0x271e5c=_[_0xb99a('0x45')]({},_0x271e5c,_0x5dd73a['options']);var _0x48b197={'where':_0x271e5c[_0xb99a('0x40')]};return db[_0xb99a('0x46')][_0xb99a('0x24')](_0x48b197)['then'](function(_0x239bd7){_0x4428c8[_0xb99a('0x24')]=_0x239bd7;if(_0x5dd73a[_0xb99a('0x36')]['includeAll']){_0x271e5c[_0xb99a('0x47')]=[{'all':!![]}];}return db[_0xb99a('0x46')]['findAll'](_0x271e5c);})[_0xb99a('0x2b')](function(_0x38959a){_0x4428c8[_0xb99a('0x48')]=_0x38959a;return _0x4428c8;})[_0xb99a('0x2b')](respondWithFilteredResult(_0x15c2d9,_0x271e5c))[_0xb99a('0x49')](handleError(_0x15c2d9,null));};exports['show']=function(_0x5f463f,_0x29ad3e){var _0x51c60c={'raw':!![],'where':{'id':_0x5f463f[_0xb99a('0x4a')]['id']}},_0x2ba8a8={};_0x2ba8a8['model']=_[_0xb99a('0x37')](db[_0xb99a('0x46')]['rawAttributes']);_0x2ba8a8[_0xb99a('0x36')]=_[_0xb99a('0x37')](_0x5f463f['query']);_0x2ba8a8[_0xb99a('0x41')]=_['intersection'](_0x2ba8a8['model'],_0x2ba8a8[_0xb99a('0x36')]);_0x51c60c[_0xb99a('0x39')]=_[_0xb99a('0x38')](_0x2ba8a8[_0xb99a('0x35')],qs['fields'](_0x5f463f[_0xb99a('0x36')]['fields']));_0x51c60c[_0xb99a('0x39')]=_0x51c60c['attributes']['length']?_0x51c60c['attributes']:_0x2ba8a8[_0xb99a('0x35')];if(_0x5f463f[_0xb99a('0x36')][_0xb99a('0x4b')]){_0x51c60c['include']=[{'all':!![]}];}_0x51c60c=_[_0xb99a('0x45')]({},_0x51c60c,_0x5f463f[_0xb99a('0x4c')]);return db[_0xb99a('0x46')]['find'](_0x51c60c)[_0xb99a('0x2b')](handleEntityNotFound(_0x29ad3e,null))[_0xb99a('0x2b')](respondWithResult(_0x29ad3e,null))['catch'](handleError(_0x29ad3e,null));};exports[_0xb99a('0x4d')]=function(_0x2dd83f,_0x387949){return db['OpenchannelQueue'][_0xb99a('0x4d')](_0x2dd83f['body'],{})[_0xb99a('0x2b')](function(_0xf3c245){var _0x3f3120=_0x2dd83f[_0xb99a('0x4e')][_0xb99a('0x29')]({'plain':!![]});if(!_0x3f3120)throw new Error(_0xb99a('0x4f'));if(_0x3f3120[_0xb99a('0x50')]===_0xb99a('0x4e')){var _0x58e02a=_0xf3c245[_0xb99a('0x29')]({'plain':!![]});var _0x3f47ae='OpenchannelQueues';return db[_0xb99a('0x51')][_0xb99a('0x52')]({'where':{'name':_0x3f47ae,'userProfileId':_0x3f3120[_0xb99a('0x53')]},'raw':!![]})['then'](function(_0x239f02){if(_0x239f02&&_0x239f02[_0xb99a('0x54')]===0x0){return db[_0xb99a('0x55')][_0xb99a('0x4d')]({'name':_0x58e02a[_0xb99a('0x2f')],'resourceId':_0x58e02a['id'],'type':_0x239f02[_0xb99a('0x2f')],'sectionId':_0x239f02['id']},{})['then'](function(){return _0xf3c245;});}else{return _0xf3c245;}})[_0xb99a('0x49')](function(_0x544b55){logger[_0xb99a('0x2d')](_0xb99a('0x56'),_0x544b55);throw _0x544b55;});}return _0xf3c245;})[_0xb99a('0x2b')](respondWithResult(_0x387949,0xc9))['catch'](handleError(_0x387949,null));};exports[_0xb99a('0x28')]=function(_0x121258,_0x38f392){if(_0x121258[_0xb99a('0x57')]['id']){delete _0x121258[_0xb99a('0x57')]['id'];}return db[_0xb99a('0x46')][_0xb99a('0x52')]({'where':{'id':_0x121258[_0xb99a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38f392,null))[_0xb99a('0x2b')](saveUpdates(_0x121258[_0xb99a('0x57')],null))[_0xb99a('0x2b')](respondWithResult(_0x38f392,null))[_0xb99a('0x49')](handleError(_0x38f392,null));};exports[_0xb99a('0x58')]=function(_0x2055b1,_0x5ddb14){return db[_0xb99a('0x46')][_0xb99a('0x52')]({'where':{'id':_0x2055b1[_0xb99a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ddb14,null))['then'](removeEntity(_0x5ddb14,null))[_0xb99a('0x49')](handleError(_0x5ddb14,null));};exports[_0xb99a('0x59')]=function(_0x205a38,_0x1a2e0c){return db[_0xb99a('0x46')][_0xb99a('0x59')]()[_0xb99a('0x2b')](respondWithResult(_0x1a2e0c,null))[_0xb99a('0x49')](handleError(_0x1a2e0c,null));};exports['getMembers']=function(_0x608da7,_0xfb64b5,_0x55fcfd){var _0x5e3c61={'raw':!![],'where':{}},_0x514b5e={},_0x1fce08;return db[_0xb99a('0x46')]['findOne']({'where':{'id':_0x608da7[_0xb99a('0x4a')]['id']}})[_0xb99a('0x2b')](handleEntityNotFound(_0xfb64b5,null))[_0xb99a('0x2b')](function(_0x27b1a2){if(_0x27b1a2){_0x1fce08=_0x27b1a2[_0xb99a('0x29')]({'plain':!![]});_0x514b5e[_0xb99a('0x35')]=_['keys'](db[_0xb99a('0x5a')][_0xb99a('0x33')]);_0x514b5e[_0xb99a('0x36')]=_[_0xb99a('0x37')](_0x608da7[_0xb99a('0x36')]);_0x514b5e[_0xb99a('0x41')]=_[_0xb99a('0x38')](_0x514b5e[_0xb99a('0x35')],_0x514b5e[_0xb99a('0x36')]);_0x5e3c61[_0xb99a('0x39')]=_[_0xb99a('0x38')](_0x514b5e[_0xb99a('0x35')],qs[_0xb99a('0x3a')](_0x608da7[_0xb99a('0x36')][_0xb99a('0x3a')]));_0x5e3c61['attributes']=_0x5e3c61[_0xb99a('0x39')][_0xb99a('0x3b')]?_0x5e3c61[_0xb99a('0x39')]:_0x514b5e[_0xb99a('0x35')];if(!_0x608da7[_0xb99a('0x36')][_0xb99a('0x3c')](_0xb99a('0x3d'))){_0x5e3c61['limit']=qs[_0xb99a('0x22')](_0x608da7[_0xb99a('0x36')][_0xb99a('0x22')]);_0x5e3c61[_0xb99a('0x21')]=qs['offset'](_0x608da7[_0xb99a('0x36')][_0xb99a('0x21')]);}_0x5e3c61[_0xb99a('0x3e')]=qs[_0xb99a('0x3f')](_0x608da7[_0xb99a('0x36')][_0xb99a('0x3f')]);_0x5e3c61[_0xb99a('0x40')]=qs[_0xb99a('0x41')](_[_0xb99a('0x5b')](_0x608da7[_0xb99a('0x36')],_0x514b5e[_0xb99a('0x41')]));_0x5e3c61[_0xb99a('0x40')][_0xb99a('0x5c')]=_0x27b1a2['id'];if(_0x608da7[_0xb99a('0x36')][_0xb99a('0x42')]){_0x5e3c61['where']=_[_0xb99a('0x45')](_0x5e3c61[_0xb99a('0x40')],{'$or':_[_0xb99a('0x32')](_0x5e3c61[_0xb99a('0x39')],function(_0x3453b2){var _0x42cf76={};_0x42cf76[_0x3453b2]={'$like':'%'+_0x608da7['query'][_0xb99a('0x42')]+'%'};return _0x42cf76;})});}_0x5e3c61=_['merge']({},_0x5e3c61,_0x608da7['options']);return db['UserOpenchannelQueue'][_0xb99a('0x5d')](_0x5e3c61);}})[_0xb99a('0x2b')](function(_0x3e26f7){if(_0x3e26f7){return db['User'][_0xb99a('0x5e')]({'where':{'id':_[_0xb99a('0x32')](_0x3e26f7,'UserId'),'role':_0xb99a('0x5f')},'attributes':['id','name',_0xb99a('0x60'),_0xb99a('0x61'),_0xb99a('0x62')]});}})[_0xb99a('0x2b')](function(_0x3387a9){if(_0x3387a9){return{'count':_0x3387a9[_0xb99a('0x24')],'rows':_['map'](_0x3387a9['rows'],function(_0x13687a){return{'membername':_0x13687a[_0xb99a('0x2f')],'UserId':_0x13687a['id'],'queue_name':_0x1fce08[_0xb99a('0x2f')],'OpenchannelQueueId':_0x1fce08['id'],'interface':util['format'](_0xb99a('0x63'),'SIP',_0x13687a['name']),'penalty':0x0,'paused':_0x13687a[_0xb99a('0x60')],'createdAt':_0x13687a['createdAt'],'updatedAt':_0x13687a[_0xb99a('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb99a('0x2b')](respondWithFilteredResult(_0xfb64b5,_0x5e3c61))[_0xb99a('0x49')](handleError(_0xfb64b5,null));};exports['getTeams']=function(_0x23fcd8,_0x38ee64,_0x486205){var _0x3d87e4={};var _0x577bc1={};var _0x707c80;var _0x38747f;return db[_0xb99a('0x46')][_0xb99a('0x64')]({'where':{'id':_0x23fcd8[_0xb99a('0x4a')]['id']}})[_0xb99a('0x2b')](handleEntityNotFound(_0x38ee64,null))[_0xb99a('0x2b')](function(_0x27a9d5){if(_0x27a9d5){_0x707c80=_0x27a9d5;_0x577bc1[_0xb99a('0x35')]=_[_0xb99a('0x37')](db['Team'][_0xb99a('0x33')]);_0x577bc1[_0xb99a('0x36')]=_[_0xb99a('0x37')](_0x23fcd8[_0xb99a('0x36')]);_0x577bc1['filters']=_[_0xb99a('0x38')](_0x577bc1[_0xb99a('0x35')],_0x577bc1[_0xb99a('0x36')]);_0x3d87e4[_0xb99a('0x39')]=_[_0xb99a('0x38')](_0x577bc1[_0xb99a('0x35')],qs[_0xb99a('0x3a')](_0x23fcd8[_0xb99a('0x36')][_0xb99a('0x3a')]));_0x3d87e4[_0xb99a('0x39')]=_0x3d87e4['attributes'][_0xb99a('0x3b')]?_0x3d87e4[_0xb99a('0x39')]:_0x577bc1[_0xb99a('0x35')];_0x3d87e4[_0xb99a('0x3e')]=qs['sort'](_0x23fcd8[_0xb99a('0x36')]['sort']);_0x3d87e4['where']=qs['filters'](_[_0xb99a('0x5b')](_0x23fcd8[_0xb99a('0x36')],_0x577bc1[_0xb99a('0x41')]));if(_0x23fcd8[_0xb99a('0x36')][_0xb99a('0x42')]){_0x3d87e4[_0xb99a('0x40')]=_[_0xb99a('0x45')](_0x3d87e4[_0xb99a('0x40')],{'$or':_[_0xb99a('0x32')](_0x3d87e4[_0xb99a('0x39')],function(_0x269130){var _0x2ba1c4={};_0x2ba1c4[_0x269130]={'$like':'%'+_0x23fcd8['query'][_0xb99a('0x42')]+'%'};return _0x2ba1c4;})});}_0x3d87e4=_[_0xb99a('0x45')]({},_0x3d87e4,_0x23fcd8['options']);return _0x707c80[_0xb99a('0x65')](_0x3d87e4);}})[_0xb99a('0x2b')](function(_0x12b215){if(_0x12b215){_0x38747f=_0x12b215['length'];if(!_0x23fcd8[_0xb99a('0x36')]['hasOwnProperty']('nolimit')){_0x3d87e4[_0xb99a('0x22')]=qs['limit'](_0x23fcd8[_0xb99a('0x36')]['limit']);_0x3d87e4[_0xb99a('0x21')]=qs['offset'](_0x23fcd8['query'][_0xb99a('0x21')]);}return _0x707c80[_0xb99a('0x65')](_0x3d87e4);}})[_0xb99a('0x2b')](function(_0xa8dacd){if(_0xa8dacd){return _0xa8dacd?{'count':_0x38747f,'rows':_0xa8dacd}:null;}})['then'](respondWithResult(_0x38ee64,null))[_0xb99a('0x49')](handleError(_0x38ee64,null));};exports[_0xb99a('0x66')]=function(_0x4cac9a,_0xba335c,_0x7ddd2b){var _0x2d21d3=_0x4cac9a[_0xb99a('0x57')][_0xb99a('0x67')];return db['Team'][_0xb99a('0x5d')]({'where':{'id':_0x2d21d3},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb99a('0x68'),'attributes':['id','name',_0xb99a('0x69'),'voicePause','interface'],'raw':!![]}]})[_0xb99a('0x2b')](function(_0x5a7f2b){if(_0x5a7f2b){var _0x49e55d=_['flatMap'](_0x5a7f2b,function(_0x1fddfd){var _0x1fe733=_0x1fddfd[_0xb99a('0x29')]({'plain':!![]});return _0x1fe733[_0xb99a('0x68')];});return db[_0xb99a('0x46')][_0xb99a('0x52')]({'where':{'id':_0x4cac9a[_0xb99a('0x4a')]['id']}})[_0xb99a('0x2b')](function(_0x1d6901){return db[_0xb99a('0x6a')][_0xb99a('0x6b')](function(_0x3f6331){return _0x1d6901[_0xb99a('0x66')](_0x2d21d3,{'transaction':_0x3f6331})['then'](function(){return BPromise[_0xb99a('0x6c')](_0x49e55d,function(_0x466605){return db[_0xb99a('0x5a')][_0xb99a('0x6d')]({'where':{'UserId':_0x466605['id'],'OpenchannelQueueId':_0x4cac9a[_0xb99a('0x4a')]['id']},'transaction':_0x3f6331});});})[_0xb99a('0x2b')](function(){_0x49e55d['forEach'](function(_0x2d4972){socket['emit'](_0xb99a('0x6e'),{'UserId':_0x2d4972['id'],'OpenchannelQueueId':_0x1d6901['id']});});});});});}})[_0xb99a('0x2b')](respondWithStatusCode(_0xba335c,null))['catch'](handleError(_0xba335c,null));};exports[_0xb99a('0x6f')]=function(_0x463b8a,_0xf5961c,_0x5357f0){return db[_0xb99a('0x70')][_0xb99a('0x5d')]({'where':{'id':_0x463b8a[_0xb99a('0x36')][_0xb99a('0x67')]},'attributes':['id'],'include':[{'model':db[_0xb99a('0x71')],'as':_0xb99a('0x68'),'attributes':['id'],'raw':!![]}]})[_0xb99a('0x2b')](handleEntityNotFound(_0xf5961c,null))[_0xb99a('0x2b')](function(_0x134b6c){var _0x48eade=_[_0xb99a('0x32')](_0x134b6c,'id');var _0x519902=[];var _0x2fbca6=[];var _0x11a219=squel['select']();_0x11a219[_0xb99a('0x72')]('tq.TeamId')[_0xb99a('0x73')]('team_has_openchannel_queues','tq')[_0xb99a('0x74')](_0xb99a('0x75'),'ut',_0xb99a('0x76'))[_0xb99a('0x40')](_0xb99a('0x77'),_0x463b8a[_0xb99a('0x4a')]['id']);for(var _0x181387=0x0;_0x181387<_0x134b6c['length'];_0x181387+=0x1){let _0x2ab24f=_0x134b6c[_0x181387];for(var _0x5b7372=0x0;_0x5b7372<_0x2ab24f[_0xb99a('0x68')][_0xb99a('0x3b')];_0x5b7372+=0x1){let _0x50eaad=_0x2ab24f[_0xb99a('0x68')][_0x5b7372];var _0xdbb884=_0x11a219['clone']();_0xdbb884[_0xb99a('0x40')](_0xb99a('0x78'),_0x50eaad['id']);_0x2fbca6[_0xb99a('0x79')](db['sequelize'][_0xb99a('0x36')](_0xdbb884[_0xb99a('0x7a')](),{'type':db['sequelize'][_0xb99a('0x7b')][_0xb99a('0x7c')]})[_0xb99a('0x2b')](function(_0x3ed53e){if(_0x3ed53e['length']===0x1){return _0x50eaad['id'];}else{var _0x7127a9=_[_0xb99a('0x7d')](_[_0xb99a('0x32')](_0x3ed53e,'TeamId'),function(_0x37662e){return _['includes'](_0x48eade,_0x37662e);});if(_0x7127a9){return _0x50eaad['id'];}}}));}}return BPromise[_0xb99a('0x7e')](_0x2fbca6)[_0xb99a('0x2b')](function(_0x305310){_0x519902=_(_0x519902)[_0xb99a('0x7f')](_0x305310)['compact']()[_0xb99a('0x80')]();return db[_0xb99a('0x46')][_0xb99a('0x52')]({'where':{'id':_0x463b8a[_0xb99a('0x4a')]['id']}})['then'](function(_0x404543){return db[_0xb99a('0x6a')][_0xb99a('0x6b')](function(_0x1dee20){return _0x404543[_0xb99a('0x6f')](_0x463b8a[_0xb99a('0x36')]['ids'],{'transaction':_0x1dee20})[_0xb99a('0x2b')](function(){if(!_[_0xb99a('0x81')](_0x519902)){return _0x404543[_0xb99a('0x82')](_0x519902,{'transaction':_0x1dee20});}})[_0xb99a('0x2b')](function(){_0x519902[_0xb99a('0x83')](function(_0x14838e){socket['emit'](_0xb99a('0x84'),{'UserId':_0x14838e,'OpenchannelQueueId':_0x404543['id']});});});});});});})['then'](respondWithStatusCode(_0xf5961c,null))[_0xb99a('0x49')](handleError(_0xf5961c,null));};exports[_0xb99a('0x85')]=function(_0xfc1d63,_0x179ddb,_0x5c105c){return db['OpenchannelQueue'][_0xb99a('0x52')]({'where':{'id':_0xfc1d63[_0xb99a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x179ddb,null))[_0xb99a('0x2b')](function(_0x2b066d){if(_0x2b066d){return _0x2b066d['addAgents'](_0xfc1d63[_0xb99a('0x57')][_0xb99a('0x67')],_[_0xb99a('0x86')](_0xfc1d63[_0xb99a('0x57')],[_0xb99a('0x67'),'id'])||{})[_0xb99a('0x87')](function(_0x1b64ca){for(var _0x3056d7=0x0;_0x3056d7<_0xfc1d63[_0xb99a('0x57')]['ids'][_0xb99a('0x3b')];_0x3056d7+=0x1){socket[_0xb99a('0x88')](_0xb99a('0x6e'),{'UserId':Number(_0xfc1d63['body'][_0xb99a('0x67')][_0x3056d7]),'OpenchannelQueueId':Number(_0xfc1d63[_0xb99a('0x4a')]['id'])});}return _0x1b64ca;});}})[_0xb99a('0x2b')](respondWithResult(_0x179ddb,null))[_0xb99a('0x49')](handleError(_0x179ddb,null));};exports[_0xb99a('0x82')]=function(_0x5124f0,_0x2fa767,_0x550eba){return db[_0xb99a('0x46')][_0xb99a('0x52')]({'where':{'id':_0x5124f0[_0xb99a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2fa767,null))[_0xb99a('0x2b')](function(_0x45e696){if(_0x45e696){return _0x45e696[_0xb99a('0x82')](_0x5124f0['query']['ids'])[_0xb99a('0x2b')](function(){if(_[_0xb99a('0x89')](_0x5124f0[_0xb99a('0x36')][_0xb99a('0x67')])){for(var _0x304d8c=0x0;_0x304d8c<_0x5124f0['query'][_0xb99a('0x67')][_0xb99a('0x3b')];_0x304d8c+=0x1){socket[_0xb99a('0x88')](_0xb99a('0x84'),{'UserId':Number(_0x5124f0[_0xb99a('0x36')][_0xb99a('0x67')][_0x304d8c]),'OpenchannelQueueId':Number(_0x5124f0[_0xb99a('0x4a')]['id'])});}}else{socket[_0xb99a('0x88')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5124f0[_0xb99a('0x36')][_0xb99a('0x67')]),'OpenchannelQueueId':Number(_0x5124f0['params']['id'])});}});}})[_0xb99a('0x2b')](respondWithStatusCode(_0x2fa767,null))[_0xb99a('0x49')](handleError(_0x2fa767,null));};exports[_0xb99a('0x8a')]=function(_0x13d90e,_0x281834,_0x1c4083){var _0x11d5a9={};var _0x3c6644={};var _0x410dea;var _0x20b740;return db[_0xb99a('0x46')][_0xb99a('0x64')]({'where':{'id':_0x13d90e[_0xb99a('0x4a')]['id']}})[_0xb99a('0x2b')](handleEntityNotFound(_0x281834,null))[_0xb99a('0x2b')](function(_0x451746){if(_0x451746){_0x410dea=_0x451746;_0x3c6644[_0xb99a('0x35')]=_[_0xb99a('0x37')](db[_0xb99a('0x71')][_0xb99a('0x33')]);_0x3c6644[_0xb99a('0x36')]=_[_0xb99a('0x37')](_0x13d90e[_0xb99a('0x36')]);_0x3c6644[_0xb99a('0x41')]=_[_0xb99a('0x38')](_0x3c6644[_0xb99a('0x35')],_0x3c6644['query']);_0x11d5a9[_0xb99a('0x39')]=_[_0xb99a('0x38')](_0x3c6644['model'],qs[_0xb99a('0x3a')](_0x13d90e['query'][_0xb99a('0x3a')]));_0x11d5a9[_0xb99a('0x39')]=_0x11d5a9['attributes'][_0xb99a('0x3b')]?_0x11d5a9['attributes']:_0x3c6644[_0xb99a('0x35')];_0x11d5a9[_0xb99a('0x3e')]=qs[_0xb99a('0x3f')](_0x13d90e[_0xb99a('0x36')][_0xb99a('0x3f')]);_0x11d5a9[_0xb99a('0x40')]=qs[_0xb99a('0x41')](_[_0xb99a('0x5b')](_0x13d90e['query'],_0x3c6644['filters']));if(_0x13d90e[_0xb99a('0x36')][_0xb99a('0x42')]){_0x11d5a9[_0xb99a('0x40')]=_[_0xb99a('0x45')](_0x11d5a9['where'],{'$or':_[_0xb99a('0x32')](_0x11d5a9[_0xb99a('0x39')],function(_0xc6df19){var _0x834247={};_0x834247[_0xc6df19]={'$like':'%'+_0x13d90e[_0xb99a('0x36')]['filter']+'%'};return _0x834247;})});}_0x11d5a9=_[_0xb99a('0x45')]({},_0x11d5a9,_0x13d90e[_0xb99a('0x4c')]);return _0x410dea[_0xb99a('0x8a')](_0x11d5a9);}})[_0xb99a('0x2b')](function(_0x47e8c3){if(_0x47e8c3){_0x20b740=_0x47e8c3[_0xb99a('0x3b')];if(!_0x13d90e[_0xb99a('0x36')]['hasOwnProperty'](_0xb99a('0x3d'))){_0x11d5a9['limit']=qs['limit'](_0x13d90e[_0xb99a('0x36')]['limit']);_0x11d5a9[_0xb99a('0x21')]=qs[_0xb99a('0x21')](_0x13d90e[_0xb99a('0x36')][_0xb99a('0x21')]);}return _0x410dea[_0xb99a('0x8a')](_0x11d5a9);}})['then'](function(_0x8589fe){if(_0x8589fe){return _0x8589fe?{'count':_0x20b740,'rows':_0x8589fe}:null;}})[_0xb99a('0x2b')](respondWithResult(_0x281834,null))[_0xb99a('0x49')](handleError(_0x281834,null));}; \ No newline at end of file +var _0xd1b5=['sequelize','transaction','addTeams','each','emit','userOpenchannelQueue:save','removeTeams','select','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','forEach','addAgents','omit','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','OpenchannelQueues','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','findAndCountAll','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team','ids','User','Agents','online','voicePause','interface','flatMap'];(function(_0x2963f2,_0x485525){var _0x126e94=function(_0xa5f12d){while(--_0xa5f12d){_0x2963f2['push'](_0x2963f2['shift']());}};_0x126e94(++_0x485525);}(_0xd1b5,0x1c0));var _0x5d1b=function(_0x540292,_0x30a2cd){_0x540292=_0x540292-0x0;var _0x1820bd=_0xd1b5[_0x540292];return _0x1820bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d1b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d1b('0x1'));var rp=require(_0x5d1b('0x2'));var moment=require(_0x5d1b('0x3'));var BPromise=require(_0x5d1b('0x4'));var Mustache=require(_0x5d1b('0x5'));var util=require(_0x5d1b('0x6'));var path=require('path');var sox=require(_0x5d1b('0x7'));var csv=require(_0x5d1b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d1b('0x9'));var _=require(_0x5d1b('0xa'));var squel=require('squel');var crypto=require(_0x5d1b('0xb'));var jsforce=require(_0x5d1b('0xc'));var deskjs=require(_0x5d1b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5d1b('0xe'));var Papa=require(_0x5d1b('0xf'));var Redis=require('ioredis');var authService=require(_0x5d1b('0x10'));var qs=require(_0x5d1b('0x11'));var as=require(_0x5d1b('0x12'));var hardwareService=require(_0x5d1b('0x13'));var logger=require(_0x5d1b('0x14'))(_0x5d1b('0x15'));var utils=require('../../config/utils');var config=require(_0x5d1b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d1b('0x17'))['db'];config[_0x5d1b('0x18')]=_[_0x5d1b('0x19')](config[_0x5d1b('0x18')],{'host':_0x5d1b('0x1a'),'port':0x18eb});var socket=require(_0x5d1b('0x1b'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x5d1b('0x1c')](socket);function respondWithStatusCode(_0x104b94,_0x46b938){_0x46b938=_0x46b938||0xcc;return function(_0x3de685){if(_0x3de685){return _0x104b94[_0x5d1b('0x1d')](_0x46b938);}return _0x104b94[_0x5d1b('0x1e')](_0x46b938)[_0x5d1b('0x1f')]();};}function respondWithResult(_0x526a81,_0x1dba14){_0x1dba14=_0x1dba14||0xc8;return function(_0x1b06ff){if(_0x1b06ff){return _0x526a81[_0x5d1b('0x1e')](_0x1dba14)[_0x5d1b('0x20')](_0x1b06ff);}};}function respondWithFilteredResult(_0x17ccdf,_0x4475d){return function(_0x5583ab){if(_0x5583ab){var _0x32640e=typeof _0x4475d[_0x5d1b('0x21')]===_0x5d1b('0x22')&&typeof _0x4475d[_0x5d1b('0x23')]===_0x5d1b('0x22');var _0x311549=_0x5583ab[_0x5d1b('0x24')];var _0x3565bb=_0x32640e?0x0:_0x4475d[_0x5d1b('0x21')];var _0x6fabb5=_0x32640e?_0x5583ab[_0x5d1b('0x24')]:_0x4475d[_0x5d1b('0x21')]+_0x4475d[_0x5d1b('0x23')];var _0x4e59c6;if(_0x6fabb5>=_0x311549){_0x6fabb5=_0x311549;_0x4e59c6=0xc8;}else{_0x4e59c6=0xce;}_0x17ccdf['status'](_0x4e59c6);return _0x17ccdf[_0x5d1b('0x25')]('Content-Range',_0x3565bb+'-'+_0x6fabb5+'/'+_0x311549)['json'](_0x5583ab);}return null;};}function patchUpdates(_0x303545){return function(_0x95739a){try{jsonpatch[_0x5d1b('0x26')](_0x95739a,_0x303545,!![]);}catch(_0xaf95d5){return BPromise[_0x5d1b('0x27')](_0xaf95d5);}return _0x95739a[_0x5d1b('0x28')]();};}function saveUpdates(_0x4dca51,_0x75dcde){return function(_0xac617b){if(_0xac617b){return _0xac617b[_0x5d1b('0x29')](_0x4dca51)['then'](function(_0x4d146a){return _0x4d146a;});}return null;};}function removeEntity(_0x119def,_0xaea5e8){return function(_0x5e558b){if(_0x5e558b){return _0x5e558b[_0x5d1b('0x2a')]()[_0x5d1b('0x2b')](function(){var _0x328f08=_0x5e558b[_0x5d1b('0x2c')]({'plain':!![]});var _0x4b32c2=_0x5d1b('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x4b32c2,'resourceId':_0x328f08['id']}})['then'](function(){return _0x5e558b;});})[_0x5d1b('0x2b')](function(){_0x119def[_0x5d1b('0x1e')](0xcc)[_0x5d1b('0x1f')]();});}};}function handleEntityNotFound(_0x5da17c,_0x3c76f8){return function(_0x36ee93){if(!_0x36ee93){_0x5da17c[_0x5d1b('0x1d')](0x194);}return _0x36ee93;};}function handleError(_0x13b5d7,_0x5daaf2){_0x5daaf2=_0x5daaf2||0x1f4;return function(_0x48064a){logger[_0x5d1b('0x2e')](_0x48064a['stack']);if(_0x48064a[_0x5d1b('0x2f')]){delete _0x48064a['name'];}_0x13b5d7['status'](_0x5daaf2)[_0x5d1b('0x30')](_0x48064a);};}exports[_0x5d1b('0x31')]=function(_0x552864,_0x5a1df8){var _0x4b995e={},_0x44f326={},_0x32cf8d={'count':0x0,'rows':[]};var _0x4ad652=_[_0x5d1b('0x32')](db[_0x5d1b('0x33')][_0x5d1b('0x34')],function(_0x5751a6){return{'name':_0x5751a6[_0x5d1b('0x35')],'type':_0x5751a6[_0x5d1b('0x36')][_0x5d1b('0x37')]};});_0x44f326[_0x5d1b('0x38')]=_['map'](_0x4ad652,_0x5d1b('0x2f'));_0x44f326[_0x5d1b('0x39')]=_['keys'](_0x552864[_0x5d1b('0x39')]);_0x44f326[_0x5d1b('0x3a')]=_[_0x5d1b('0x3b')](_0x44f326[_0x5d1b('0x38')],_0x44f326[_0x5d1b('0x39')]);_0x4b995e[_0x5d1b('0x3c')]=_[_0x5d1b('0x3b')](_0x44f326[_0x5d1b('0x38')],qs[_0x5d1b('0x3d')](_0x552864[_0x5d1b('0x39')]['fields']));_0x4b995e[_0x5d1b('0x3c')]=_0x4b995e[_0x5d1b('0x3c')][_0x5d1b('0x3e')]?_0x4b995e[_0x5d1b('0x3c')]:_0x44f326[_0x5d1b('0x38')];if(!_0x552864['query'][_0x5d1b('0x3f')](_0x5d1b('0x40'))){_0x4b995e[_0x5d1b('0x23')]=qs[_0x5d1b('0x23')](_0x552864[_0x5d1b('0x39')][_0x5d1b('0x23')]);_0x4b995e[_0x5d1b('0x21')]=qs[_0x5d1b('0x21')](_0x552864[_0x5d1b('0x39')][_0x5d1b('0x21')]);}_0x4b995e[_0x5d1b('0x41')]=qs[_0x5d1b('0x42')](_0x552864['query']['sort']);_0x4b995e['where']=qs[_0x5d1b('0x3a')](_['pick'](_0x552864[_0x5d1b('0x39')],_0x44f326[_0x5d1b('0x3a')]),_0x4ad652);if(_0x552864['query'][_0x5d1b('0x43')]){_0x4b995e[_0x5d1b('0x44')]=_[_0x5d1b('0x45')](_0x4b995e[_0x5d1b('0x44')],{'$or':_['map'](_0x4ad652,function(_0x46354e){if(_0x46354e[_0x5d1b('0x36')]!=='VIRTUAL'){var _0x105893={};_0x105893[_0x46354e['name']]={'$like':'%'+_0x552864['query']['filter']+'%'};return _0x105893;}})});}_0x4b995e=_[_0x5d1b('0x45')]({},_0x4b995e,_0x552864[_0x5d1b('0x46')]);var _0x3b16a6={'where':_0x4b995e[_0x5d1b('0x44')]};return db['OpenchannelQueue'][_0x5d1b('0x24')](_0x3b16a6)['then'](function(_0x245029){_0x32cf8d[_0x5d1b('0x24')]=_0x245029;if(_0x552864[_0x5d1b('0x39')][_0x5d1b('0x47')]){_0x4b995e['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x5d1b('0x48')](_0x4b995e);})[_0x5d1b('0x2b')](function(_0x231881){_0x32cf8d[_0x5d1b('0x49')]=_0x231881;return _0x32cf8d;})[_0x5d1b('0x2b')](respondWithFilteredResult(_0x5a1df8,_0x4b995e))[_0x5d1b('0x4a')](handleError(_0x5a1df8,null));};exports['show']=function(_0x552ec4,_0x590a03){var _0x9b42d2={'raw':!![],'where':{'id':_0x552ec4[_0x5d1b('0x4b')]['id']}},_0x7e82dd={};_0x7e82dd[_0x5d1b('0x38')]=_['keys'](db[_0x5d1b('0x33')][_0x5d1b('0x34')]);_0x7e82dd[_0x5d1b('0x39')]=_[_0x5d1b('0x4c')](_0x552ec4[_0x5d1b('0x39')]);_0x7e82dd[_0x5d1b('0x3a')]=_['intersection'](_0x7e82dd[_0x5d1b('0x38')],_0x7e82dd[_0x5d1b('0x39')]);_0x9b42d2['attributes']=_[_0x5d1b('0x3b')](_0x7e82dd['model'],qs[_0x5d1b('0x3d')](_0x552ec4[_0x5d1b('0x39')][_0x5d1b('0x3d')]));_0x9b42d2[_0x5d1b('0x3c')]=_0x9b42d2[_0x5d1b('0x3c')]['length']?_0x9b42d2[_0x5d1b('0x3c')]:_0x7e82dd[_0x5d1b('0x38')];if(_0x552ec4[_0x5d1b('0x39')]['includeAll']){_0x9b42d2['include']=[{'all':!![]}];}_0x9b42d2=_[_0x5d1b('0x45')]({},_0x9b42d2,_0x552ec4[_0x5d1b('0x46')]);return db[_0x5d1b('0x33')][_0x5d1b('0x4d')](_0x9b42d2)[_0x5d1b('0x2b')](handleEntityNotFound(_0x590a03,null))[_0x5d1b('0x2b')](respondWithResult(_0x590a03,null))['catch'](handleError(_0x590a03,null));};exports[_0x5d1b('0x4e')]=function(_0x36d75b,_0x29ac12){return db[_0x5d1b('0x33')][_0x5d1b('0x4e')](_0x36d75b[_0x5d1b('0x4f')],{})[_0x5d1b('0x2b')](function(_0x421526){var _0x12968e=_0x36d75b['user']['get']({'plain':!![]});if(!_0x12968e)throw new Error(_0x5d1b('0x50'));if(_0x12968e[_0x5d1b('0x51')]===_0x5d1b('0x52')){var _0x553847=_0x421526[_0x5d1b('0x2c')]({'plain':!![]});var _0x11f7d3='OpenchannelQueues';return db[_0x5d1b('0x53')]['find']({'where':{'name':_0x11f7d3,'userProfileId':_0x12968e['userProfileId']},'raw':!![]})[_0x5d1b('0x2b')](function(_0x278ebe){if(_0x278ebe&&_0x278ebe[_0x5d1b('0x54')]===0x0){return db[_0x5d1b('0x55')][_0x5d1b('0x4e')]({'name':_0x553847[_0x5d1b('0x2f')],'resourceId':_0x553847['id'],'type':_0x278ebe[_0x5d1b('0x2f')],'sectionId':_0x278ebe['id']},{})[_0x5d1b('0x2b')](function(){return _0x421526;});}else{return _0x421526;}})['catch'](function(_0x340d57){logger['error'](_0x5d1b('0x56'),_0x340d57);throw _0x340d57;});}return _0x421526;})[_0x5d1b('0x2b')](respondWithResult(_0x29ac12,0xc9))['catch'](handleError(_0x29ac12,null));};exports[_0x5d1b('0x29')]=function(_0x9cb39c,_0x1b831f){if(_0x9cb39c[_0x5d1b('0x4f')]['id']){delete _0x9cb39c[_0x5d1b('0x4f')]['id'];}return db[_0x5d1b('0x33')]['find']({'where':{'id':_0x9cb39c[_0x5d1b('0x4b')]['id']}})[_0x5d1b('0x2b')](handleEntityNotFound(_0x1b831f,null))[_0x5d1b('0x2b')](saveUpdates(_0x9cb39c['body'],null))[_0x5d1b('0x2b')](respondWithResult(_0x1b831f,null))[_0x5d1b('0x4a')](handleError(_0x1b831f,null));};exports[_0x5d1b('0x2a')]=function(_0x1470d0,_0x49b0e3){return db[_0x5d1b('0x33')][_0x5d1b('0x4d')]({'where':{'id':_0x1470d0[_0x5d1b('0x4b')]['id']}})[_0x5d1b('0x2b')](handleEntityNotFound(_0x49b0e3,null))['then'](removeEntity(_0x49b0e3,null))['catch'](handleError(_0x49b0e3,null));};exports['describe']=function(_0x4ad37b,_0x3eff23){return db[_0x5d1b('0x33')][_0x5d1b('0x57')]()['then'](respondWithResult(_0x3eff23,null))[_0x5d1b('0x4a')](handleError(_0x3eff23,null));};exports[_0x5d1b('0x58')]=function(_0x47d1f4,_0x473f34,_0x573b27){var _0x1641ba={'raw':!![],'where':{}},_0x403b99={},_0x3fe4a7;return db[_0x5d1b('0x33')][_0x5d1b('0x59')]({'where':{'id':_0x47d1f4[_0x5d1b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x473f34,null))[_0x5d1b('0x2b')](function(_0x140b41){if(_0x140b41){_0x3fe4a7=_0x140b41[_0x5d1b('0x2c')]({'plain':!![]});_0x403b99['model']=_[_0x5d1b('0x4c')](db[_0x5d1b('0x5a')]['rawAttributes']);_0x403b99[_0x5d1b('0x39')]=_['keys'](_0x47d1f4['query']);_0x403b99[_0x5d1b('0x3a')]=_[_0x5d1b('0x3b')](_0x403b99[_0x5d1b('0x38')],_0x403b99[_0x5d1b('0x39')]);_0x1641ba[_0x5d1b('0x3c')]=_[_0x5d1b('0x3b')](_0x403b99['model'],qs[_0x5d1b('0x3d')](_0x47d1f4['query'][_0x5d1b('0x3d')]));_0x1641ba[_0x5d1b('0x3c')]=_0x1641ba['attributes'][_0x5d1b('0x3e')]?_0x1641ba[_0x5d1b('0x3c')]:_0x403b99[_0x5d1b('0x38')];if(!_0x47d1f4[_0x5d1b('0x39')]['hasOwnProperty'](_0x5d1b('0x40'))){_0x1641ba[_0x5d1b('0x23')]=qs[_0x5d1b('0x23')](_0x47d1f4[_0x5d1b('0x39')][_0x5d1b('0x23')]);_0x1641ba[_0x5d1b('0x21')]=qs[_0x5d1b('0x21')](_0x47d1f4[_0x5d1b('0x39')][_0x5d1b('0x21')]);}_0x1641ba['order']=qs[_0x5d1b('0x42')](_0x47d1f4[_0x5d1b('0x39')]['sort']);_0x1641ba[_0x5d1b('0x44')]=qs[_0x5d1b('0x3a')](_[_0x5d1b('0x5b')](_0x47d1f4[_0x5d1b('0x39')],_0x403b99[_0x5d1b('0x3a')]));_0x1641ba[_0x5d1b('0x44')][_0x5d1b('0x5c')]=_0x140b41['id'];if(_0x47d1f4[_0x5d1b('0x39')][_0x5d1b('0x43')]){_0x1641ba['where']=_[_0x5d1b('0x45')](_0x1641ba[_0x5d1b('0x44')],{'$or':_['map'](_0x1641ba[_0x5d1b('0x3c')],function(_0x1841cf){var _0x13fd0f={};_0x13fd0f[_0x1841cf]={'$like':'%'+_0x47d1f4[_0x5d1b('0x39')][_0x5d1b('0x43')]+'%'};return _0x13fd0f;})});}_0x1641ba=_[_0x5d1b('0x45')]({},_0x1641ba,_0x47d1f4[_0x5d1b('0x46')]);return db[_0x5d1b('0x5a')][_0x5d1b('0x48')](_0x1641ba);}})[_0x5d1b('0x2b')](function(_0x540a4b){if(_0x540a4b){return db['User'][_0x5d1b('0x5d')]({'where':{'id':_[_0x5d1b('0x32')](_0x540a4b,'UserId'),'role':'agent'},'attributes':['id',_0x5d1b('0x2f'),_0x5d1b('0x5e'),_0x5d1b('0x5f'),_0x5d1b('0x60')]});}})[_0x5d1b('0x2b')](function(_0x124323){if(_0x124323){return{'count':_0x124323[_0x5d1b('0x24')],'rows':_['map'](_0x124323['rows'],function(_0x449700){return{'membername':_0x449700[_0x5d1b('0x2f')],'UserId':_0x449700['id'],'queue_name':_0x3fe4a7[_0x5d1b('0x2f')],'OpenchannelQueueId':_0x3fe4a7['id'],'interface':util[_0x5d1b('0x61')](_0x5d1b('0x62'),_0x5d1b('0x63'),_0x449700[_0x5d1b('0x2f')]),'penalty':0x0,'paused':_0x449700[_0x5d1b('0x5e')],'createdAt':_0x449700[_0x5d1b('0x60')],'updatedAt':_0x449700['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5d1b('0x2b')](respondWithFilteredResult(_0x473f34,_0x1641ba))[_0x5d1b('0x4a')](handleError(_0x473f34,null));};exports['getTeams']=function(_0x5b1a77,_0x28bcac,_0x462a32){var _0x36d3bf={};var _0x5b9b4={};var _0x1b401c;var _0x50e5be;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5b1a77[_0x5d1b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x28bcac,null))[_0x5d1b('0x2b')](function(_0x2f8090){if(_0x2f8090){_0x1b401c=_0x2f8090;_0x5b9b4[_0x5d1b('0x38')]=_[_0x5d1b('0x4c')](db[_0x5d1b('0x64')]['rawAttributes']);_0x5b9b4[_0x5d1b('0x39')]=_[_0x5d1b('0x4c')](_0x5b1a77['query']);_0x5b9b4[_0x5d1b('0x3a')]=_['intersection'](_0x5b9b4[_0x5d1b('0x38')],_0x5b9b4['query']);_0x36d3bf['attributes']=_['intersection'](_0x5b9b4[_0x5d1b('0x38')],qs[_0x5d1b('0x3d')](_0x5b1a77[_0x5d1b('0x39')][_0x5d1b('0x3d')]));_0x36d3bf['attributes']=_0x36d3bf[_0x5d1b('0x3c')][_0x5d1b('0x3e')]?_0x36d3bf['attributes']:_0x5b9b4[_0x5d1b('0x38')];_0x36d3bf[_0x5d1b('0x41')]=qs['sort'](_0x5b1a77[_0x5d1b('0x39')][_0x5d1b('0x42')]);_0x36d3bf[_0x5d1b('0x44')]=qs[_0x5d1b('0x3a')](_[_0x5d1b('0x5b')](_0x5b1a77[_0x5d1b('0x39')],_0x5b9b4[_0x5d1b('0x3a')]));if(_0x5b1a77['query'][_0x5d1b('0x43')]){_0x36d3bf[_0x5d1b('0x44')]=_['merge'](_0x36d3bf[_0x5d1b('0x44')],{'$or':_['map'](_0x36d3bf['attributes'],function(_0x6a2a8d){var _0x31c590={};_0x31c590[_0x6a2a8d]={'$like':'%'+_0x5b1a77['query'][_0x5d1b('0x43')]+'%'};return _0x31c590;})});}_0x36d3bf=_[_0x5d1b('0x45')]({},_0x36d3bf,_0x5b1a77[_0x5d1b('0x46')]);return _0x1b401c['getTeams'](_0x36d3bf);}})[_0x5d1b('0x2b')](function(_0x2f53b9){if(_0x2f53b9){_0x50e5be=_0x2f53b9['length'];if(!_0x5b1a77[_0x5d1b('0x39')]['hasOwnProperty'](_0x5d1b('0x40'))){_0x36d3bf[_0x5d1b('0x23')]=qs[_0x5d1b('0x23')](_0x5b1a77['query'][_0x5d1b('0x23')]);_0x36d3bf['offset']=qs['offset'](_0x5b1a77['query'][_0x5d1b('0x21')]);}return _0x1b401c['getTeams'](_0x36d3bf);}})[_0x5d1b('0x2b')](function(_0xce3ea8){if(_0xce3ea8){return _0xce3ea8?{'count':_0x50e5be,'rows':_0xce3ea8}:null;}})[_0x5d1b('0x2b')](respondWithResult(_0x28bcac,null))[_0x5d1b('0x4a')](handleError(_0x28bcac,null));};exports['addTeams']=function(_0x1c85ac,_0x27e3a6,_0x7d18f0){var _0x321ef0=_0x1c85ac[_0x5d1b('0x4f')][_0x5d1b('0x65')];return db[_0x5d1b('0x64')]['findAll']({'where':{'id':_0x321ef0},'attributes':['id'],'include':[{'model':db[_0x5d1b('0x66')],'as':_0x5d1b('0x67'),'attributes':['id',_0x5d1b('0x2f'),_0x5d1b('0x68'),_0x5d1b('0x69'),_0x5d1b('0x6a')],'raw':!![]}]})[_0x5d1b('0x2b')](function(_0xd08226){if(_0xd08226){var _0x2b2cf7=_[_0x5d1b('0x6b')](_0xd08226,function(_0x38fff3){var _0x2a851d=_0x38fff3['get']({'plain':!![]});return _0x2a851d[_0x5d1b('0x67')];});return db['OpenchannelQueue'][_0x5d1b('0x4d')]({'where':{'id':_0x1c85ac[_0x5d1b('0x4b')]['id']}})[_0x5d1b('0x2b')](function(_0x43d280){return db[_0x5d1b('0x6c')][_0x5d1b('0x6d')](function(_0x372766){return _0x43d280[_0x5d1b('0x6e')](_0x321ef0,{'transaction':_0x372766})[_0x5d1b('0x2b')](function(){return BPromise[_0x5d1b('0x6f')](_0x2b2cf7,function(_0xc97d6a){return db[_0x5d1b('0x5a')]['findOrCreate']({'where':{'UserId':_0xc97d6a['id'],'OpenchannelQueueId':_0x1c85ac[_0x5d1b('0x4b')]['id']},'transaction':_0x372766});});})[_0x5d1b('0x2b')](function(){_0x2b2cf7['forEach'](function(_0x1ffb66){socket[_0x5d1b('0x70')](_0x5d1b('0x71'),{'UserId':_0x1ffb66['id'],'OpenchannelQueueId':_0x43d280['id']});});});});});}})[_0x5d1b('0x2b')](respondWithStatusCode(_0x27e3a6,null))[_0x5d1b('0x4a')](handleError(_0x27e3a6,null));};exports[_0x5d1b('0x72')]=function(_0x11d204,_0x338fef,_0x90be69){return db[_0x5d1b('0x64')][_0x5d1b('0x48')]({'where':{'id':_0x11d204['query'][_0x5d1b('0x65')]},'attributes':['id'],'include':[{'model':db[_0x5d1b('0x66')],'as':_0x5d1b('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x338fef,null))[_0x5d1b('0x2b')](function(_0xf37b0a){var _0x39983=_['map'](_0xf37b0a,'id');var _0x1914cd=[];var _0x4decbd=[];var _0x4024e0=squel[_0x5d1b('0x73')]();_0x4024e0['field']('tq.TeamId')['from'](_0x5d1b('0x74'),'tq')['join'](_0x5d1b('0x75'),'ut',_0x5d1b('0x76'))['where'](_0x5d1b('0x77'),_0x11d204[_0x5d1b('0x4b')]['id']);for(var _0x151c17=0x0;_0x151c17<_0xf37b0a['length'];_0x151c17+=0x1){let _0x330617=_0xf37b0a[_0x151c17];for(var _0x3b2ccc=0x0;_0x3b2ccc<_0x330617[_0x5d1b('0x67')][_0x5d1b('0x3e')];_0x3b2ccc+=0x1){let _0x1823f5=_0x330617[_0x5d1b('0x67')][_0x3b2ccc];var _0x5002c8=_0x4024e0[_0x5d1b('0x78')]();_0x5002c8['where'](_0x5d1b('0x79'),_0x1823f5['id']);_0x4decbd['push'](db[_0x5d1b('0x6c')][_0x5d1b('0x39')](_0x5002c8[_0x5d1b('0x7a')](),{'type':db['sequelize'][_0x5d1b('0x7b')][_0x5d1b('0x7c')]})[_0x5d1b('0x2b')](function(_0x5c4bc7){if(_0x5c4bc7[_0x5d1b('0x3e')]===0x1){return _0x1823f5['id'];}else{var _0x36e63c=_[_0x5d1b('0x7d')](_['map'](_0x5c4bc7,_0x5d1b('0x7e')),function(_0x3cf857){return _[_0x5d1b('0x7f')](_0x39983,_0x3cf857);});if(_0x36e63c){return _0x1823f5['id'];}}}));}}return BPromise[_0x5d1b('0x80')](_0x4decbd)[_0x5d1b('0x2b')](function(_0x20730c){_0x1914cd=_(_0x1914cd)[_0x5d1b('0x81')](_0x20730c)['compact']()[_0x5d1b('0x82')]();return db['OpenchannelQueue'][_0x5d1b('0x4d')]({'where':{'id':_0x11d204[_0x5d1b('0x4b')]['id']}})[_0x5d1b('0x2b')](function(_0x482494){return db[_0x5d1b('0x6c')][_0x5d1b('0x6d')](function(_0x4bfab5){return _0x482494[_0x5d1b('0x72')](_0x11d204['query']['ids'],{'transaction':_0x4bfab5})['then'](function(){if(!_['isEmpty'](_0x1914cd)){return _0x482494['removeAgents'](_0x1914cd,{'transaction':_0x4bfab5});}})[_0x5d1b('0x2b')](function(){_0x1914cd[_0x5d1b('0x83')](function(_0xba8fdf){socket[_0x5d1b('0x70')]('userOpenchannelQueue:remove',{'UserId':_0xba8fdf,'OpenchannelQueueId':_0x482494['id']});});});});});});})['then'](respondWithStatusCode(_0x338fef,null))[_0x5d1b('0x4a')](handleError(_0x338fef,null));};exports[_0x5d1b('0x84')]=function(_0x5eba27,_0x3becc0,_0x148b6d){return db[_0x5d1b('0x33')][_0x5d1b('0x4d')]({'where':{'id':_0x5eba27['params']['id']}})[_0x5d1b('0x2b')](handleEntityNotFound(_0x3becc0,null))[_0x5d1b('0x2b')](function(_0x55f921){if(_0x55f921){return _0x55f921[_0x5d1b('0x84')](_0x5eba27[_0x5d1b('0x4f')]['ids'],_[_0x5d1b('0x85')](_0x5eba27['body'],[_0x5d1b('0x65'),'id'])||{})[_0x5d1b('0x86')](function(_0x52014c){for(var _0x3a9579=0x0;_0x3a9579<_0x5eba27[_0x5d1b('0x4f')][_0x5d1b('0x65')][_0x5d1b('0x3e')];_0x3a9579+=0x1){socket[_0x5d1b('0x70')](_0x5d1b('0x71'),{'UserId':Number(_0x5eba27[_0x5d1b('0x4f')][_0x5d1b('0x65')][_0x3a9579]),'OpenchannelQueueId':Number(_0x5eba27[_0x5d1b('0x4b')]['id'])});}return _0x52014c;});}})['then'](respondWithResult(_0x3becc0,null))[_0x5d1b('0x4a')](handleError(_0x3becc0,null));};exports[_0x5d1b('0x87')]=function(_0x1c26ca,_0x723cff,_0x359a98){return db['OpenchannelQueue']['find']({'where':{'id':_0x1c26ca[_0x5d1b('0x4b')]['id']}})[_0x5d1b('0x2b')](handleEntityNotFound(_0x723cff,null))[_0x5d1b('0x2b')](function(_0x116dbe){if(_0x116dbe){return _0x116dbe[_0x5d1b('0x87')](_0x1c26ca['query'][_0x5d1b('0x65')])[_0x5d1b('0x2b')](function(){if(_[_0x5d1b('0x88')](_0x1c26ca[_0x5d1b('0x39')]['ids'])){for(var _0x713a75=0x0;_0x713a75<_0x1c26ca[_0x5d1b('0x39')][_0x5d1b('0x65')][_0x5d1b('0x3e')];_0x713a75+=0x1){socket[_0x5d1b('0x70')](_0x5d1b('0x89'),{'UserId':Number(_0x1c26ca[_0x5d1b('0x39')][_0x5d1b('0x65')][_0x713a75]),'OpenchannelQueueId':Number(_0x1c26ca[_0x5d1b('0x4b')]['id'])});}}else{socket['emit'](_0x5d1b('0x89'),{'UserId':Number(_0x1c26ca[_0x5d1b('0x39')][_0x5d1b('0x65')]),'OpenchannelQueueId':Number(_0x1c26ca[_0x5d1b('0x4b')]['id'])});}});}})[_0x5d1b('0x2b')](respondWithStatusCode(_0x723cff,null))[_0x5d1b('0x4a')](handleError(_0x723cff,null));};exports['getAgents']=function(_0x871e2,_0x45cab8,_0x190d00){var _0x8ceb1e={};var _0x1a2013={};var _0x17029e;var _0x4b8f0a;return db[_0x5d1b('0x33')]['findOne']({'where':{'id':_0x871e2['params']['id']}})[_0x5d1b('0x2b')](handleEntityNotFound(_0x45cab8,null))['then'](function(_0x64e046){if(_0x64e046){_0x17029e=_0x64e046;_0x1a2013[_0x5d1b('0x38')]=_[_0x5d1b('0x4c')](db['User'][_0x5d1b('0x34')]);_0x1a2013[_0x5d1b('0x39')]=_[_0x5d1b('0x4c')](_0x871e2[_0x5d1b('0x39')]);_0x1a2013[_0x5d1b('0x3a')]=_[_0x5d1b('0x3b')](_0x1a2013['model'],_0x1a2013[_0x5d1b('0x39')]);_0x8ceb1e[_0x5d1b('0x3c')]=_['intersection'](_0x1a2013[_0x5d1b('0x38')],qs[_0x5d1b('0x3d')](_0x871e2[_0x5d1b('0x39')]['fields']));_0x8ceb1e[_0x5d1b('0x3c')]=_0x8ceb1e[_0x5d1b('0x3c')][_0x5d1b('0x3e')]?_0x8ceb1e[_0x5d1b('0x3c')]:_0x1a2013[_0x5d1b('0x38')];_0x8ceb1e['order']=qs['sort'](_0x871e2[_0x5d1b('0x39')]['sort']);_0x8ceb1e[_0x5d1b('0x44')]=qs[_0x5d1b('0x3a')](_[_0x5d1b('0x5b')](_0x871e2['query'],_0x1a2013[_0x5d1b('0x3a')]));if(_0x871e2[_0x5d1b('0x39')][_0x5d1b('0x43')]){_0x8ceb1e[_0x5d1b('0x44')]=_[_0x5d1b('0x45')](_0x8ceb1e['where'],{'$or':_[_0x5d1b('0x32')](_0x8ceb1e[_0x5d1b('0x3c')],function(_0x3b5085){var _0x367b28={};_0x367b28[_0x3b5085]={'$like':'%'+_0x871e2[_0x5d1b('0x39')]['filter']+'%'};return _0x367b28;})});}_0x8ceb1e=_[_0x5d1b('0x45')]({},_0x8ceb1e,_0x871e2[_0x5d1b('0x46')]);return _0x17029e[_0x5d1b('0x8a')](_0x8ceb1e);}})[_0x5d1b('0x2b')](function(_0x1a72f3){if(_0x1a72f3){_0x4b8f0a=_0x1a72f3[_0x5d1b('0x3e')];if(!_0x871e2[_0x5d1b('0x39')]['hasOwnProperty'](_0x5d1b('0x40'))){_0x8ceb1e['limit']=qs[_0x5d1b('0x23')](_0x871e2[_0x5d1b('0x39')][_0x5d1b('0x23')]);_0x8ceb1e[_0x5d1b('0x21')]=qs['offset'](_0x871e2[_0x5d1b('0x39')][_0x5d1b('0x21')]);}return _0x17029e[_0x5d1b('0x8a')](_0x8ceb1e);}})['then'](function(_0x269cf7){if(_0x269cf7){return _0x269cf7?{'count':_0x4b8f0a,'rows':_0x269cf7}:null;}})[_0x5d1b('0x2b')](respondWithResult(_0x45cab8,null))[_0x5d1b('0x4a')](handleError(_0x45cab8,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index aa8099c..11b50c6 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 _0x41a0=['save','remove','emit','hasOwnProperty','exports','events','OpenchannelQueue','setMaxListeners'];(function(_0x3cac61,_0x62fed0){var _0x570b82=function(_0x2d5bef){while(--_0x2d5bef){_0x3cac61['push'](_0x3cac61['shift']());}};_0x570b82(++_0x62fed0);}(_0x41a0,0xd5));var _0x041a=function(_0x1abb6b,_0x236915){_0x1abb6b=_0x1abb6b-0x0;var _0x14c509=_0x41a0[_0x1abb6b];return _0x14c509;};'use strict';var EventEmitter=require(_0x041a('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x041a('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x041a('0x2')](0x0);var events={'afterCreate':_0x041a('0x3'),'afterUpdate':'update','afterDestroy':_0x041a('0x4')};function emitEvent(_0x166ebe){return function(_0x1840d6,_0x4cbe51,_0x4eb15c){OpenchannelQueueEvents[_0x041a('0x5')](_0x166ebe+':'+_0x1840d6['id'],_0x1840d6);OpenchannelQueueEvents[_0x041a('0x5')](_0x166ebe,_0x1840d6);_0x4eb15c(null);};}for(var e in events){if(events[_0x041a('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x041a('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x3bc0=['../../mysqldb','OpenchannelQueue','save','update','remove','emit','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bc0,0x1b8));var _0x03bc=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x3bc0[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x03bc('0x0'))['db'][_0x03bc('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x03bc('0x2'),'afterUpdate':_0x03bc('0x3'),'afterDestroy':_0x03bc('0x4')};function emitEvent(_0x11feb6){return function(_0x116c48,_0x7fb53d,_0x2b7017){OpenchannelQueueEvents[_0x03bc('0x5')](_0x11feb6+':'+_0x116c48['id'],_0x116c48);OpenchannelQueueEvents[_0x03bc('0x5')](_0x11feb6,_0x116c48);_0x2b7017(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x03bc('0x6')](e,emitEvent(event));}}module[_0x03bc('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 6a531b5..04ae42e 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 _0x6698=['api','bluebird','path','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','../../config/logger'];(function(_0x4ef7bc,_0x1e8207){var _0x30a74f=function(_0x5c728e){while(--_0x5c728e){_0x4ef7bc['push'](_0x4ef7bc['shift']());}};_0x30a74f(++_0x1e8207);}(_0x6698,0xa1));var _0x8669=function(_0x27552b,_0x4a028e){_0x27552b=_0x27552b-0x0;var _0x48d1dc=_0x6698[_0x27552b];return _0x48d1dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8669('0x0'))(_0x8669('0x1'));var moment=require('moment');var BPromise=require(_0x8669('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8669('0x3'));var rimraf=require(_0x8669('0x4'));var config=require('../../config/environment');var attributes=require(_0x8669('0x5'));module[_0x8669('0x6')]=function(_0x38519f,_0x3aceda){return _0x38519f[_0x8669('0x7')](_0x8669('0x8'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd9=['OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','path','rimraf','exports','define'];(function(_0x2229f3,_0x2f4a11){var _0x3f3d28=function(_0x776613){while(--_0x776613){_0x2229f3['push'](_0x2229f3['shift']());}};_0x3f3d28(++_0x2f4a11);}(_0x2bd9,0xf4));var _0x92bd=function(_0x3baf60,_0x5b498b){_0x3baf60=_0x3baf60-0x0;var _0x48b546=_0x2bd9[_0x3baf60];return _0x48b546;};'use strict';var _=require(_0x92bd('0x0'));var util=require(_0x92bd('0x1'));var logger=require(_0x92bd('0x2'))(_0x92bd('0x3'));var moment=require(_0x92bd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x92bd('0x5'));var rimraf=require(_0x92bd('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x92bd('0x7')]=function(_0x354fe1,_0x31f552){return _0x354fe1[_0x92bd('0x8')](_0x92bd('0x9'),attributes,{'tableName':_0x92bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 68ef06c..ac70548 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 _0xbe25=['catch','OpenchannelQueue','ShowOpenchannelQueue','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','info','request\x20sent','debug','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','result','findAll','options','where','attributes','limit','include','map','model','then','GetOpenchannelQueue'];(function(_0x2b78fd,_0x26878f){var _0x55409a=function(_0x50d9e8){while(--_0x50d9e8){_0x2b78fd['push'](_0x2b78fd['shift']());}};_0x55409a(++_0x26878f);}(_0xbe25,0x106));var _0x5be2=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xbe25[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5be2('0x0'));var BPromise=require(_0x5be2('0x1'));var rs=require(_0x5be2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5be2('0x3'))['db'];var utils=require(_0x5be2('0x4'));var logger=require(_0x5be2('0x5'))(_0x5be2('0x6'));var config=require('../../config/environment');var jayson=require(_0x5be2('0x7'));var client=jayson[_0x5be2('0x8')][_0x5be2('0x9')]({'port':0x232a});config[_0x5be2('0xa')]=_[_0x5be2('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5be2('0xc'))(new Redis(config['redis']));require(_0x5be2('0xd'))[_0x5be2('0xe')](socket);function respondWithRpcPromise(_0x55bd65,_0x3dbc94,_0x88e34c){return new BPromise(function(_0x3318e3,_0x4278c9){return client[_0x5be2('0xf')](_0x55bd65,_0x88e34c)['then'](function(_0x4181f0){logger[_0x5be2('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x3dbc94,_0x5be2('0x11'));logger[_0x5be2('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3dbc94,_0x5be2('0x11'),JSON[_0x5be2('0x13')](_0x4181f0));if(_0x4181f0['error']){if(_0x4181f0[_0x5be2('0x14')]['code']===0x1f4){logger[_0x5be2('0x14')](_0x5be2('0x15'),_0x3dbc94,_0x4181f0[_0x5be2('0x14')][_0x5be2('0x16')]);return _0x4278c9(_0x4181f0[_0x5be2('0x14')]['message']);}logger[_0x5be2('0x14')](_0x5be2('0x15'),_0x3dbc94,_0x4181f0[_0x5be2('0x14')][_0x5be2('0x16')]);return _0x3318e3(_0x4181f0[_0x5be2('0x14')][_0x5be2('0x16')]);}else{logger[_0x5be2('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x3dbc94,_0x5be2('0x11'));_0x3318e3(_0x4181f0[_0x5be2('0x17')][_0x5be2('0x16')]);}})['catch'](function(_0x1ed6cf){logger['error'](_0x5be2('0x15'),_0x3dbc94,_0x1ed6cf);_0x4278c9(_0x1ed6cf);});});}exports['GetOpenchannelQueue']=function(_0x3cba20){var _0x3bd656=this;return new Promise(function(_0x48e74a,_0x108483){return db['OpenchannelQueue'][_0x5be2('0x18')]({'raw':_0x3cba20[_0x5be2('0x19')]?_0x3cba20[_0x5be2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3cba20[_0x5be2('0x19')]?_0x3cba20['options'][_0x5be2('0x1a')]||null:null,'attributes':_0x3cba20[_0x5be2('0x19')]?_0x3cba20[_0x5be2('0x19')][_0x5be2('0x1b')]||null:null,'limit':_0x3cba20[_0x5be2('0x19')]?_0x3cba20[_0x5be2('0x19')][_0x5be2('0x1c')]||null:null,'include':_0x3cba20[_0x5be2('0x19')]?_0x3cba20[_0x5be2('0x19')][_0x5be2('0x1d')]?_[_0x5be2('0x1e')](_0x3cba20[_0x5be2('0x19')][_0x5be2('0x1d')],function(_0x2aa4c6){return{'model':db[_0x2aa4c6[_0x5be2('0x1f')]],'as':_0x2aa4c6['as'],'attributes':_0x2aa4c6[_0x5be2('0x1b')],'include':_0x2aa4c6['include']?_['map'](_0x2aa4c6['include'],function(_0x2580dd){return{'model':db[_0x2580dd[_0x5be2('0x1f')]],'as':_0x2580dd['as'],'attributes':_0x2580dd[_0x5be2('0x1b')],'include':_0x2580dd[_0x5be2('0x1d')]?_[_0x5be2('0x1e')](_0x2580dd['include'],function(_0x29d2bd){return{'model':db[_0x29d2bd[_0x5be2('0x1f')]],'as':_0x29d2bd['as'],'attributes':_0x29d2bd[_0x5be2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5be2('0x20')](function(_0x1cad97){logger['info'](_0x5be2('0x21'),_0x3cba20);logger[_0x5be2('0x12')](_0x5be2('0x21'),_0x3cba20,JSON[_0x5be2('0x13')](_0x1cad97));_0x48e74a(_0x1cad97);})[_0x5be2('0x22')](function(_0x307263){logger[_0x5be2('0x14')](_0x5be2('0x21'),_0x307263[_0x5be2('0x16')],_0x3cba20);_0x108483(_0x3bd656[_0x5be2('0x14')](0x1f4,_0x307263[_0x5be2('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x5ab62c){var _0x382c75=this;return new Promise(function(_0x33e47a,_0xbaf094){return db[_0x5be2('0x23')]['find']({'raw':_0x5ab62c['options']?_0x5ab62c['options']['raw']===undefined?!![]:![]:!![],'where':_0x5ab62c[_0x5be2('0x19')]?_0x5ab62c[_0x5be2('0x19')][_0x5be2('0x1a')]||null:null,'attributes':_0x5ab62c[_0x5be2('0x19')]?_0x5ab62c[_0x5be2('0x19')][_0x5be2('0x1b')]||null:null,'include':_0x5ab62c[_0x5be2('0x19')]?_0x5ab62c[_0x5be2('0x19')][_0x5be2('0x1d')]?_[_0x5be2('0x1e')](_0x5ab62c[_0x5be2('0x19')]['include'],function(_0xb8ea2){return{'model':db[_0xb8ea2[_0x5be2('0x1f')]],'as':_0xb8ea2['as'],'attributes':_0xb8ea2['attributes'],'include':_0xb8ea2[_0x5be2('0x1d')]?_[_0x5be2('0x1e')](_0xb8ea2['include'],function(_0x5f1dfa){return{'model':db[_0x5f1dfa['model']],'as':_0x5f1dfa['as'],'attributes':_0x5f1dfa[_0x5be2('0x1b')],'include':_0x5f1dfa[_0x5be2('0x1d')]?_[_0x5be2('0x1e')](_0x5f1dfa[_0x5be2('0x1d')],function(_0x197e0e){return{'model':db[_0x197e0e[_0x5be2('0x1f')]],'as':_0x197e0e['as'],'attributes':_0x197e0e[_0x5be2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5be2('0x20')](function(_0x569d38){logger[_0x5be2('0x10')](_0x5be2('0x24'),_0x5ab62c);logger[_0x5be2('0x12')]('ShowOpenchannelQueue',_0x5ab62c,JSON[_0x5be2('0x13')](_0x569d38));_0x33e47a(_0x569d38);})[_0x5be2('0x22')](function(_0x2f0c25){logger[_0x5be2('0x14')](_0x5be2('0x24'),_0x2f0c25['message'],_0x5ab62c);_0xbaf094(_0x382c75[_0x5be2('0x14')](0x1f4,_0x2f0c25[_0x5be2('0x16')]));});});}; \ No newline at end of file +var _0xaedf=['../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetOpenchannelQueue','findAll','options','attributes','include','model','ShowOpenchannelQueue','OpenchannelQueue','find','raw','map','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaedf,0x11a));var _0xfaed=function(_0x1fb954,_0x2cec46){_0x1fb954=_0x1fb954-0x0;var _0x34f40=_0xaedf[_0x1fb954];return _0x34f40;};'use strict';var _=require(_0xfaed('0x0'));var util=require(_0xfaed('0x1'));var moment=require(_0xfaed('0x2'));var BPromise=require(_0xfaed('0x3'));var rs=require(_0xfaed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfaed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaed('0x6'))(_0xfaed('0x7'));var config=require(_0xfaed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfaed('0x9')]['http']({'port':0x232a});config[_0xfaed('0xa')]=_['defaults'](config[_0xfaed('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfaed('0xb'))(new Redis(config[_0xfaed('0xa')]));require(_0xfaed('0xc'))[_0xfaed('0xd')](socket);function respondWithRpcPromise(_0x1df102,_0x2fccd5,_0x3bdcb1){return new BPromise(function(_0x2ed9b0,_0x4ef175){return client[_0xfaed('0xe')](_0x1df102,_0x3bdcb1)[_0xfaed('0xf')](function(_0xba990f){logger[_0xfaed('0x10')](_0xfaed('0x11'),_0x2fccd5,_0xfaed('0x12'));logger[_0xfaed('0x13')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2fccd5,'request\x20sent',JSON[_0xfaed('0x14')](_0xba990f));if(_0xba990f[_0xfaed('0x15')]){if(_0xba990f[_0xfaed('0x15')][_0xfaed('0x16')]===0x1f4){logger['error'](_0xfaed('0x11'),_0x2fccd5,_0xba990f['error'][_0xfaed('0x17')]);return _0x4ef175(_0xba990f[_0xfaed('0x15')][_0xfaed('0x17')]);}logger[_0xfaed('0x15')](_0xfaed('0x11'),_0x2fccd5,_0xba990f[_0xfaed('0x15')]['message']);return _0x2ed9b0(_0xba990f[_0xfaed('0x15')][_0xfaed('0x17')]);}else{logger[_0xfaed('0x10')](_0xfaed('0x11'),_0x2fccd5,_0xfaed('0x12'));_0x2ed9b0(_0xba990f['result']['message']);}})[_0xfaed('0x18')](function(_0x619986){logger[_0xfaed('0x15')](_0xfaed('0x11'),_0x2fccd5,_0x619986);_0x4ef175(_0x619986);});});}exports[_0xfaed('0x19')]=function(_0x34e12a){var _0x2a739f=this;return new Promise(function(_0x252043,_0xb6f21a){return db['OpenchannelQueue'][_0xfaed('0x1a')]({'raw':_0x34e12a['options']?_0x34e12a[_0xfaed('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x34e12a[_0xfaed('0x1b')]?_0x34e12a[_0xfaed('0x1b')]['where']||null:null,'attributes':_0x34e12a[_0xfaed('0x1b')]?_0x34e12a[_0xfaed('0x1b')][_0xfaed('0x1c')]||null:null,'limit':_0x34e12a['options']?_0x34e12a[_0xfaed('0x1b')]['limit']||null:null,'include':_0x34e12a[_0xfaed('0x1b')]?_0x34e12a[_0xfaed('0x1b')][_0xfaed('0x1d')]?_['map'](_0x34e12a[_0xfaed('0x1b')][_0xfaed('0x1d')],function(_0x5c0ba2){return{'model':db[_0x5c0ba2[_0xfaed('0x1e')]],'as':_0x5c0ba2['as'],'attributes':_0x5c0ba2[_0xfaed('0x1c')],'include':_0x5c0ba2[_0xfaed('0x1d')]?_['map'](_0x5c0ba2[_0xfaed('0x1d')],function(_0x396a44){return{'model':db[_0x396a44['model']],'as':_0x396a44['as'],'attributes':_0x396a44[_0xfaed('0x1c')],'include':_0x396a44[_0xfaed('0x1d')]?_['map'](_0x396a44[_0xfaed('0x1d')],function(_0x4fe5b9){return{'model':db[_0x4fe5b9[_0xfaed('0x1e')]],'as':_0x4fe5b9['as'],'attributes':_0x4fe5b9[_0xfaed('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x556470){logger[_0xfaed('0x10')](_0xfaed('0x19'),_0x34e12a);logger['debug']('GetOpenchannelQueue',_0x34e12a,JSON['stringify'](_0x556470));_0x252043(_0x556470);})[_0xfaed('0x18')](function(_0x5c89ab){logger['error'](_0xfaed('0x19'),_0x5c89ab[_0xfaed('0x17')],_0x34e12a);_0xb6f21a(_0x2a739f[_0xfaed('0x15')](0x1f4,_0x5c89ab[_0xfaed('0x17')]));});});};exports[_0xfaed('0x1f')]=function(_0xa45e6c){var _0x3a7b4a=this;return new Promise(function(_0x443daa,_0x491fcd){return db[_0xfaed('0x20')][_0xfaed('0x21')]({'raw':_0xa45e6c[_0xfaed('0x1b')]?_0xa45e6c[_0xfaed('0x1b')][_0xfaed('0x22')]===undefined?!![]:![]:!![],'where':_0xa45e6c[_0xfaed('0x1b')]?_0xa45e6c[_0xfaed('0x1b')]['where']||null:null,'attributes':_0xa45e6c['options']?_0xa45e6c[_0xfaed('0x1b')][_0xfaed('0x1c')]||null:null,'include':_0xa45e6c[_0xfaed('0x1b')]?_0xa45e6c[_0xfaed('0x1b')][_0xfaed('0x1d')]?_[_0xfaed('0x23')](_0xa45e6c['options'][_0xfaed('0x1d')],function(_0x577c4f){return{'model':db[_0x577c4f[_0xfaed('0x1e')]],'as':_0x577c4f['as'],'attributes':_0x577c4f[_0xfaed('0x1c')],'include':_0x577c4f[_0xfaed('0x1d')]?_['map'](_0x577c4f[_0xfaed('0x1d')],function(_0x17d786){return{'model':db[_0x17d786[_0xfaed('0x1e')]],'as':_0x17d786['as'],'attributes':_0x17d786[_0xfaed('0x1c')],'include':_0x17d786[_0xfaed('0x1d')]?_[_0xfaed('0x23')](_0x17d786[_0xfaed('0x1d')],function(_0xe43ae1){return{'model':db[_0xe43ae1[_0xfaed('0x1e')]],'as':_0xe43ae1['as'],'attributes':_0xe43ae1[_0xfaed('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfaed('0xf')](function(_0x15bc2e){logger[_0xfaed('0x10')](_0xfaed('0x1f'),_0xa45e6c);logger['debug'](_0xfaed('0x1f'),_0xa45e6c,JSON[_0xfaed('0x14')](_0x15bc2e));_0x443daa(_0x15bc2e);})['catch'](function(_0x6a9e8b){logger[_0xfaed('0x15')](_0xfaed('0x1f'),_0x6a9e8b[_0xfaed('0x17')],_0xa45e6c);_0x491fcd(_0x3a7b4a['error'](0x1f4,_0x6a9e8b[_0xfaed('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c5b54ed..2b0ea04 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 _0xf0d7=['update','emit','removeListener','register','length','openchannelQueue:','save','remove'];(function(_0x3fa3e6,_0x1858d4){var _0x2fb3e0=function(_0x15991e){while(--_0x15991e){_0x3fa3e6['push'](_0x3fa3e6['shift']());}};_0x2fb3e0(++_0x1858d4);}(_0xf0d7,0x156));var _0x7f0d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf0d7[_0x618414];return _0x21c19a;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x7f0d('0x0'),_0x7f0d('0x1'),_0x7f0d('0x2')];function createListener(_0x3efd8d,_0x213703){return function(_0xccadc1){_0x213703[_0x7f0d('0x3')](_0x3efd8d,_0xccadc1);};}function removeListener(_0x8d0d5d,_0x157e68){return function(){OpenchannelQueueEvents[_0x7f0d('0x4')](_0x8d0d5d,_0x157e68);};}exports[_0x7f0d('0x5')]=function(_0x1d6835){for(var _0x582814=0x0,_0x262898=events[_0x7f0d('0x6')];_0x582814<_0x262898;_0x582814++){var _0x40891e=events[_0x582814];var _0x5240b4=createListener(_0x7f0d('0x7')+_0x40891e,_0x1d6835);OpenchannelQueueEvents['on'](_0x40891e,_0x5240b4);}}; \ No newline at end of file +var _0xe5eb=['update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x23427b,_0x4b3a02){var _0x5f374d=function(_0x1cb9b3){while(--_0x1cb9b3){_0x23427b['push'](_0x23427b['shift']());}};_0x5f374d(++_0x4b3a02);}(_0xe5eb,0x16d));var _0xbe5e=function(_0x31d506,_0x9a80e9){_0x31d506=_0x31d506-0x0;var _0x498ac6=_0xe5eb[_0x31d506];return _0x498ac6;};'use strict';var OpenchannelQueueEvents=require(_0xbe5e('0x0'));var events=[_0xbe5e('0x1'),_0xbe5e('0x2'),_0xbe5e('0x3')];function createListener(_0x170aa6,_0x58ace4){return function(_0x37b9bd){_0x58ace4[_0xbe5e('0x4')](_0x170aa6,_0x37b9bd);};}function removeListener(_0x226a49,_0x2cbd5){return function(){OpenchannelQueueEvents[_0xbe5e('0x5')](_0x226a49,_0x2cbd5);};}exports['register']=function(_0x3435bd){for(var _0x3154e5=0x0,_0x3e2fb7=events[_0xbe5e('0x6')];_0x3154e5<_0x3e2fb7;_0x3154e5++){var _0x8f5e6e=events[_0x3154e5];var _0x29a9cc=createListener(_0xbe5e('0x7')+_0x8f5e6e,_0x3435bd);OpenchannelQueueEvents['on'](_0x8f5e6e,_0x29a9cc);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 16ca56f..2f07ee2 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 _0x65ee=['/describe','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index'];(function(_0x4f7744,_0x31b1e7){var _0x328c48=function(_0x307e16){while(--_0x307e16){_0x4f7744['push'](_0x4f7744['shift']());}};_0x328c48(++_0x31b1e7);}(_0x65ee,0x9b));var _0xe65e=function(_0x107fec,_0x503877){_0x107fec=_0x107fec-0x0;var _0x220c1e=_0x65ee[_0x107fec];return _0x220c1e;};'use strict';var multer=require(_0xe65e('0x0'));var util=require(_0xe65e('0x1'));var path=require(_0xe65e('0x2'));var timeout=require(_0xe65e('0x3'));var express=require('express');var router=express[_0xe65e('0x4')]();var fs_extra=require(_0xe65e('0x5'));var auth=require(_0xe65e('0x6'));var interaction=require(_0xe65e('0x7'));var config=require(_0xe65e('0x8'));var controller=require(_0xe65e('0x9'));router[_0xe65e('0xa')]('/',auth[_0xe65e('0xb')](),controller[_0xe65e('0xc')]);router[_0xe65e('0xa')](_0xe65e('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xe65e('0xa')](_0xe65e('0xe'),auth['isAuthenticated'](),controller[_0xe65e('0xf')]);router[_0xe65e('0x10')]('/',auth[_0xe65e('0xb')](),controller['create']);router[_0xe65e('0x11')](_0xe65e('0xe'),auth[_0xe65e('0xb')](),controller[_0xe65e('0x12')]);router[_0xe65e('0x13')](_0xe65e('0xe'),auth[_0xe65e('0xb')](),controller['destroy']);module[_0xe65e('0x14')]=router; \ No newline at end of file +var _0x1d55=['create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x11b844,_0x11f86e){var _0x35ca4a=function(_0x5f08a0){while(--_0x5f08a0){_0x11b844['push'](_0x11b844['shift']());}};_0x35ca4a(++_0x11f86e);}(_0x1d55,0x1e7));var _0x51d5=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x1d55[_0x56fe98];return _0x212f4f;};'use strict';var multer=require(_0x51d5('0x0'));var util=require(_0x51d5('0x1'));var path=require(_0x51d5('0x2'));var timeout=require(_0x51d5('0x3'));var express=require(_0x51d5('0x4'));var router=express['Router']();var fs_extra=require(_0x51d5('0x5'));var auth=require(_0x51d5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x51d5('0x7'));var controller=require(_0x51d5('0x8'));router[_0x51d5('0x9')]('/',auth[_0x51d5('0xa')](),controller[_0x51d5('0xb')]);router[_0x51d5('0x9')](_0x51d5('0xc'),auth['isAuthenticated'](),controller[_0x51d5('0xd')]);router['get'](_0x51d5('0xe'),auth[_0x51d5('0xa')](),controller[_0x51d5('0xf')]);router[_0x51d5('0x10')]('/',auth[_0x51d5('0xa')](),controller[_0x51d5('0x11')]);router[_0x51d5('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x51d5('0x13')]);router[_0x51d5('0x14')](_0x51d5('0xe'),auth[_0x51d5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 8f253ce..e9e2cb1 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 _0xc4b7=['STRING','DATE','moment','sequelize','exports'];(function(_0x130049,_0x420398){var _0x35adeb=function(_0x42c42d){while(--_0x42c42d){_0x130049['push'](_0x130049['shift']());}};_0x35adeb(++_0x420398);}(_0xc4b7,0x129));var _0x7c4b=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xc4b7[_0x500419];return _0x241c1a;};'use strict';var moment=require(_0x7c4b('0x0'));var Sequelize=require(_0x7c4b('0x1'));module[_0x7c4b('0x2')]={'uniqueid':{'type':Sequelize[_0x7c4b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7c4b('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7c4b('0x4')]},'acceptAt':{'type':Sequelize[_0x7c4b('0x4')]},'exitAt':{'type':Sequelize[_0x7c4b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x950d=['moment','sequelize','exports','STRING','DATE'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0x950d,0x96));var _0xd950=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x950d[_0x4baae2];return _0x1a2285;};'use strict';var moment=require(_0xd950('0x0'));var Sequelize=require(_0xd950('0x1'));module[_0xd950('0x2')]={'uniqueid':{'type':Sequelize[_0xd950('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd950('0x3')]},'joinAt':{'type':Sequelize[_0xd950('0x4')]},'leaveAt':{'type':Sequelize[_0xd950('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd950('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index b119dfd..70f0dce 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 _0xf9cd=['Content-Range','reject','save','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','create','body','update','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x89a1f4,_0xee787f){var _0x377d2d=function(_0x423e5e){while(--_0x423e5e){_0x89a1f4['push'](_0x89a1f4['shift']());}};_0x377d2d(++_0xee787f);}(_0xf9cd,0x118));var _0xdf9c=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xf9cd[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require(_0xdf9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf9c('0x1'));var jsonpatch=require(_0xdf9c('0x2'));var rp=require(_0xdf9c('0x3'));var moment=require(_0xdf9c('0x4'));var BPromise=require(_0xdf9c('0x5'));var Mustache=require(_0xdf9c('0x6'));var util=require(_0xdf9c('0x7'));var path=require(_0xdf9c('0x8'));var sox=require(_0xdf9c('0x9'));var csv=require(_0xdf9c('0xa'));var ejs=require(_0xdf9c('0xb'));var fs=require('fs');var fs_extra=require(_0xdf9c('0xc'));var _=require(_0xdf9c('0xd'));var squel=require(_0xdf9c('0xe'));var crypto=require(_0xdf9c('0xf'));var jsforce=require(_0xdf9c('0x10'));var deskjs=require(_0xdf9c('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdf9c('0x12'));var Papa=require(_0xdf9c('0x13'));var Redis=require('ioredis');var authService=require(_0xdf9c('0x14'));var qs=require(_0xdf9c('0x15'));var as=require(_0xdf9c('0x16'));var hardwareService=require(_0xdf9c('0x17'));var logger=require(_0xdf9c('0x18'))('api');var utils=require(_0xdf9c('0x19'));var config=require(_0xdf9c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf9c('0x1b'))['db'];function respondWithStatusCode(_0x2e7aec,_0x43ca8e){_0x43ca8e=_0x43ca8e||0xcc;return function(_0x631368){if(_0x631368){return _0x2e7aec[_0xdf9c('0x1c')](_0x43ca8e);}return _0x2e7aec[_0xdf9c('0x1d')](_0x43ca8e)[_0xdf9c('0x1e')]();};}function respondWithResult(_0x896071,_0x3bb977){_0x3bb977=_0x3bb977||0xc8;return function(_0x2df1a8){if(_0x2df1a8){return _0x896071[_0xdf9c('0x1d')](_0x3bb977)['json'](_0x2df1a8);}};}function respondWithFilteredResult(_0x111072,_0x32c8d5){return function(_0x30813c){if(_0x30813c){var _0x50768e=typeof _0x32c8d5[_0xdf9c('0x1f')]===_0xdf9c('0x20')&&typeof _0x32c8d5[_0xdf9c('0x21')]===_0xdf9c('0x20');var _0x43d552=_0x30813c[_0xdf9c('0x22')];var _0x5e581b=_0x50768e?0x0:_0x32c8d5['offset'];var _0x4457ad=_0x50768e?_0x30813c[_0xdf9c('0x22')]:_0x32c8d5['offset']+_0x32c8d5[_0xdf9c('0x21')];var _0x586ba0;if(_0x4457ad>=_0x43d552){_0x4457ad=_0x43d552;_0x586ba0=0xc8;}else{_0x586ba0=0xce;}_0x111072[_0xdf9c('0x1d')](_0x586ba0);return _0x111072[_0xdf9c('0x23')](_0xdf9c('0x24'),_0x5e581b+'-'+_0x4457ad+'/'+_0x43d552)['json'](_0x30813c);}return null;};}function patchUpdates(_0x7944d4){return function(_0x5a1004){try{jsonpatch['apply'](_0x5a1004,_0x7944d4,!![]);}catch(_0x3fdb3f){return BPromise[_0xdf9c('0x25')](_0x3fdb3f);}return _0x5a1004[_0xdf9c('0x26')]();};}function saveUpdates(_0x5f1351,_0x4e619b){return function(_0x5b6c33){if(_0x5b6c33){return _0x5b6c33['update'](_0x5f1351)[_0xdf9c('0x27')](function(_0x8e1d68){return _0x8e1d68;});}return null;};}function removeEntity(_0x50143b,_0x4e7e8a){return function(_0x493d66){if(_0x493d66){return _0x493d66[_0xdf9c('0x28')]()[_0xdf9c('0x27')](function(){_0x50143b[_0xdf9c('0x1d')](0xcc)[_0xdf9c('0x1e')]();});}};}function handleEntityNotFound(_0x5eed1f,_0x1dd774){return function(_0x3d0bc3){if(!_0x3d0bc3){_0x5eed1f['sendStatus'](0x194);}return _0x3d0bc3;};}function handleError(_0x1308fd,_0x4a6e65){_0x4a6e65=_0x4a6e65||0x1f4;return function(_0x3dd858){logger['error'](_0x3dd858[_0xdf9c('0x29')]);if(_0x3dd858[_0xdf9c('0x2a')]){delete _0x3dd858[_0xdf9c('0x2a')];}_0x1308fd[_0xdf9c('0x1d')](_0x4a6e65)[_0xdf9c('0x2b')](_0x3dd858);};}exports[_0xdf9c('0x2c')]=function(_0x2027c9,_0x54fe93){var _0x281062={},_0x15b12f={},_0x32567b={'count':0x0,'rows':[]};var _0xeda942=_[_0xdf9c('0x2d')](db[_0xdf9c('0x2e')]['rawAttributes'],function(_0x251bf2){return{'name':_0x251bf2['fieldName'],'type':_0x251bf2[_0xdf9c('0x2f')][_0xdf9c('0x30')]};});_0x15b12f[_0xdf9c('0x31')]=_[_0xdf9c('0x2d')](_0xeda942,'name');_0x15b12f[_0xdf9c('0x32')]=_[_0xdf9c('0x33')](_0x2027c9[_0xdf9c('0x32')]);_0x15b12f[_0xdf9c('0x34')]=_[_0xdf9c('0x35')](_0x15b12f['model'],_0x15b12f[_0xdf9c('0x32')]);_0x281062['attributes']=_[_0xdf9c('0x35')](_0x15b12f['model'],qs['fields'](_0x2027c9[_0xdf9c('0x32')]['fields']));_0x281062[_0xdf9c('0x36')]=_0x281062[_0xdf9c('0x36')][_0xdf9c('0x37')]?_0x281062[_0xdf9c('0x36')]:_0x15b12f[_0xdf9c('0x31')];if(!_0x2027c9[_0xdf9c('0x32')][_0xdf9c('0x38')](_0xdf9c('0x39'))){_0x281062['limit']=qs[_0xdf9c('0x21')](_0x2027c9['query'][_0xdf9c('0x21')]);_0x281062[_0xdf9c('0x1f')]=qs[_0xdf9c('0x1f')](_0x2027c9[_0xdf9c('0x32')][_0xdf9c('0x1f')]);}_0x281062[_0xdf9c('0x3a')]=qs[_0xdf9c('0x3b')](_0x2027c9['query'][_0xdf9c('0x3b')]);_0x281062['where']=qs['filters'](_[_0xdf9c('0x3c')](_0x2027c9[_0xdf9c('0x32')],_0x15b12f['filters']),_0xeda942);if(_0x2027c9[_0xdf9c('0x32')][_0xdf9c('0x3d')]){_0x281062[_0xdf9c('0x3e')]=_[_0xdf9c('0x3f')](_0x281062[_0xdf9c('0x3e')],{'$or':_[_0xdf9c('0x2d')](_0xeda942,function(_0x26f928){if(_0x26f928['type']!==_0xdf9c('0x40')){var _0x312cab={};_0x312cab[_0x26f928[_0xdf9c('0x2a')]]={'$like':'%'+_0x2027c9[_0xdf9c('0x32')][_0xdf9c('0x3d')]+'%'};return _0x312cab;}})});}_0x281062=_[_0xdf9c('0x3f')]({},_0x281062,_0x2027c9[_0xdf9c('0x41')]);var _0x25affd={'where':_0x281062[_0xdf9c('0x3e')]};return db[_0xdf9c('0x2e')][_0xdf9c('0x22')](_0x25affd)['then'](function(_0x4e4269){_0x32567b['count']=_0x4e4269;if(_0x2027c9[_0xdf9c('0x32')][_0xdf9c('0x42')]){_0x281062[_0xdf9c('0x43')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xdf9c('0x44')](_0x281062);})[_0xdf9c('0x27')](function(_0x1a6ee5){_0x32567b[_0xdf9c('0x45')]=_0x1a6ee5;return _0x32567b;})[_0xdf9c('0x27')](respondWithFilteredResult(_0x54fe93,_0x281062))[_0xdf9c('0x46')](handleError(_0x54fe93,null));};exports[_0xdf9c('0x47')]=function(_0x20e5ea,_0xc962a9){var _0x18dc2a={'raw':!![],'where':{'id':_0x20e5ea['params']['id']}},_0x470d2c={};_0x470d2c[_0xdf9c('0x31')]=_[_0xdf9c('0x33')](db[_0xdf9c('0x2e')]['rawAttributes']);_0x470d2c[_0xdf9c('0x32')]=_[_0xdf9c('0x33')](_0x20e5ea[_0xdf9c('0x32')]);_0x470d2c[_0xdf9c('0x34')]=_[_0xdf9c('0x35')](_0x470d2c[_0xdf9c('0x31')],_0x470d2c[_0xdf9c('0x32')]);_0x18dc2a['attributes']=_[_0xdf9c('0x35')](_0x470d2c['model'],qs[_0xdf9c('0x48')](_0x20e5ea[_0xdf9c('0x32')][_0xdf9c('0x48')]));_0x18dc2a[_0xdf9c('0x36')]=_0x18dc2a['attributes'][_0xdf9c('0x37')]?_0x18dc2a['attributes']:_0x470d2c['model'];if(_0x20e5ea['query'][_0xdf9c('0x42')]){_0x18dc2a[_0xdf9c('0x43')]=[{'all':!![]}];}_0x18dc2a=_[_0xdf9c('0x3f')]({},_0x18dc2a,_0x20e5ea[_0xdf9c('0x41')]);return db[_0xdf9c('0x2e')]['find'](_0x18dc2a)[_0xdf9c('0x27')](handleEntityNotFound(_0xc962a9,null))['then'](respondWithResult(_0xc962a9,null))[_0xdf9c('0x46')](handleError(_0xc962a9,null));};exports[_0xdf9c('0x49')]=function(_0x3c5044,_0x218f51){return db[_0xdf9c('0x2e')]['create'](_0x3c5044[_0xdf9c('0x4a')],{})[_0xdf9c('0x27')](respondWithResult(_0x218f51,0xc9))[_0xdf9c('0x46')](handleError(_0x218f51,null));};exports[_0xdf9c('0x4b')]=function(_0xe3ac45,_0x412ea6){if(_0xe3ac45[_0xdf9c('0x4a')]['id']){delete _0xe3ac45[_0xdf9c('0x4a')]['id'];}return db['OpenchannelQueueReport'][_0xdf9c('0x4c')]({'where':{'id':_0xe3ac45[_0xdf9c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x412ea6,null))['then'](saveUpdates(_0xe3ac45[_0xdf9c('0x4a')],null))[_0xdf9c('0x27')](respondWithResult(_0x412ea6,null))['catch'](handleError(_0x412ea6,null));};exports['destroy']=function(_0x501ca4,_0x4d44ad){return db[_0xdf9c('0x2e')]['find']({'where':{'id':_0x501ca4[_0xdf9c('0x4d')]['id']}})[_0xdf9c('0x27')](handleEntityNotFound(_0x4d44ad,null))[_0xdf9c('0x27')](removeEntity(_0x4d44ad,null))[_0xdf9c('0x46')](handleError(_0x4d44ad,null));};exports[_0xdf9c('0x4e')]=function(_0x392e14,_0x4405c9){return db[_0xdf9c('0x2e')][_0xdf9c('0x4e')]()[_0xdf9c('0x27')](respondWithResult(_0x4405c9,null))[_0xdf9c('0x46')](handleError(_0x4405c9,null));}; \ No newline at end of file +var _0x500b=['rawAttributes','length','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','pick','filter','where','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x196086,_0x4c9912){var _0x4980a4=function(_0x45af52){while(--_0x45af52){_0x196086['push'](_0x196086['shift']());}};_0x4980a4(++_0x4c9912);}(_0x500b,0x136));var _0xb500=function(_0xa1de8d,_0x1399a8){_0xa1de8d=_0xa1de8d-0x0;var _0x478b44=_0x500b[_0xa1de8d];return _0x478b44;};'use strict';var emlformat=require(_0xb500('0x0'));var rimraf=require(_0xb500('0x1'));var zipdir=require(_0xb500('0x2'));var jsonpatch=require(_0xb500('0x3'));var rp=require('request-promise');var moment=require(_0xb500('0x4'));var BPromise=require(_0xb500('0x5'));var Mustache=require(_0xb500('0x6'));var util=require('util');var path=require(_0xb500('0x7'));var sox=require(_0xb500('0x8'));var csv=require(_0xb500('0x9'));var ejs=require(_0xb500('0xa'));var fs=require('fs');var fs_extra=require(_0xb500('0xb'));var _=require(_0xb500('0xc'));var squel=require('squel');var crypto=require(_0xb500('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb500('0xe'));var toCsv=require(_0xb500('0x9'));var querystring=require('querystring');var Papa=require(_0xb500('0xf'));var Redis=require(_0xb500('0x10'));var authService=require(_0xb500('0x11'));var qs=require(_0xb500('0x12'));var as=require(_0xb500('0x13'));var hardwareService=require(_0xb500('0x14'));var logger=require(_0xb500('0x15'))(_0xb500('0x16'));var utils=require('../../config/utils');var config=require(_0xb500('0x17'));var licenseUtil=require(_0xb500('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ac59b,_0x2f7f2f){_0x2f7f2f=_0x2f7f2f||0xcc;return function(_0x16309f){if(_0x16309f){return _0x2ac59b[_0xb500('0x19')](_0x2f7f2f);}return _0x2ac59b['status'](_0x2f7f2f)[_0xb500('0x1a')]();};}function respondWithResult(_0x502512,_0x1b3cef){_0x1b3cef=_0x1b3cef||0xc8;return function(_0x286872){if(_0x286872){return _0x502512[_0xb500('0x1b')](_0x1b3cef)['json'](_0x286872);}};}function respondWithFilteredResult(_0x48fb7f,_0x1277f4){return function(_0x53bece){if(_0x53bece){var _0x51d474=typeof _0x1277f4[_0xb500('0x1c')]===_0xb500('0x1d')&&typeof _0x1277f4[_0xb500('0x1e')]==='undefined';var _0x39046a=_0x53bece[_0xb500('0x1f')];var _0x30f93c=_0x51d474?0x0:_0x1277f4[_0xb500('0x1c')];var _0x5c35bb=_0x51d474?_0x53bece[_0xb500('0x1f')]:_0x1277f4['offset']+_0x1277f4[_0xb500('0x1e')];var _0x3677d7;if(_0x5c35bb>=_0x39046a){_0x5c35bb=_0x39046a;_0x3677d7=0xc8;}else{_0x3677d7=0xce;}_0x48fb7f[_0xb500('0x1b')](_0x3677d7);return _0x48fb7f[_0xb500('0x20')](_0xb500('0x21'),_0x30f93c+'-'+_0x5c35bb+'/'+_0x39046a)[_0xb500('0x22')](_0x53bece);}return null;};}function patchUpdates(_0x1c81d4){return function(_0x41b871){try{jsonpatch[_0xb500('0x23')](_0x41b871,_0x1c81d4,!![]);}catch(_0x16498c){return BPromise[_0xb500('0x24')](_0x16498c);}return _0x41b871['save']();};}function saveUpdates(_0x30fc85,_0x50fbc6){return function(_0x492d59){if(_0x492d59){return _0x492d59[_0xb500('0x25')](_0x30fc85)[_0xb500('0x26')](function(_0x137681){return _0x137681;});}return null;};}function removeEntity(_0x39c112,_0x5515ae){return function(_0x43f992){if(_0x43f992){return _0x43f992[_0xb500('0x27')]()[_0xb500('0x26')](function(){_0x39c112[_0xb500('0x1b')](0xcc)[_0xb500('0x1a')]();});}};}function handleEntityNotFound(_0x484690,_0x6e52e){return function(_0x56103c){if(!_0x56103c){_0x484690[_0xb500('0x19')](0x194);}return _0x56103c;};}function handleError(_0x51c968,_0x47bee7){_0x47bee7=_0x47bee7||0x1f4;return function(_0x19d46c){logger['error'](_0x19d46c[_0xb500('0x28')]);if(_0x19d46c[_0xb500('0x29')]){delete _0x19d46c[_0xb500('0x29')];}_0x51c968['status'](_0x47bee7)[_0xb500('0x2a')](_0x19d46c);};}exports[_0xb500('0x2b')]=function(_0x5c923d,_0x3bc4a6){var _0x1ad9c0={},_0x4f4d05={},_0x20473d={'count':0x0,'rows':[]};var _0x8968b3=_['map'](db[_0xb500('0x2c')]['rawAttributes'],function(_0x441242){return{'name':_0x441242[_0xb500('0x2d')],'type':_0x441242[_0xb500('0x2e')][_0xb500('0x2f')]};});_0x4f4d05[_0xb500('0x30')]=_['map'](_0x8968b3,_0xb500('0x29'));_0x4f4d05[_0xb500('0x31')]=_[_0xb500('0x32')](_0x5c923d['query']);_0x4f4d05[_0xb500('0x33')]=_[_0xb500('0x34')](_0x4f4d05[_0xb500('0x30')],_0x4f4d05[_0xb500('0x31')]);_0x1ad9c0['attributes']=_[_0xb500('0x34')](_0x4f4d05[_0xb500('0x30')],qs[_0xb500('0x35')](_0x5c923d[_0xb500('0x31')]['fields']));_0x1ad9c0[_0xb500('0x36')]=_0x1ad9c0[_0xb500('0x36')]['length']?_0x1ad9c0[_0xb500('0x36')]:_0x4f4d05[_0xb500('0x30')];if(!_0x5c923d[_0xb500('0x31')][_0xb500('0x37')](_0xb500('0x38'))){_0x1ad9c0[_0xb500('0x1e')]=qs['limit'](_0x5c923d[_0xb500('0x31')][_0xb500('0x1e')]);_0x1ad9c0[_0xb500('0x1c')]=qs['offset'](_0x5c923d[_0xb500('0x31')][_0xb500('0x1c')]);}_0x1ad9c0['order']=qs['sort'](_0x5c923d[_0xb500('0x31')]['sort']);_0x1ad9c0['where']=qs[_0xb500('0x33')](_[_0xb500('0x39')](_0x5c923d['query'],_0x4f4d05['filters']),_0x8968b3);if(_0x5c923d[_0xb500('0x31')][_0xb500('0x3a')]){_0x1ad9c0[_0xb500('0x3b')]=_['merge'](_0x1ad9c0['where'],{'$or':_[_0xb500('0x3c')](_0x8968b3,function(_0x1ab570){if(_0x1ab570[_0xb500('0x2e')]!==_0xb500('0x3d')){var _0x25c3f6={};_0x25c3f6[_0x1ab570[_0xb500('0x29')]]={'$like':'%'+_0x5c923d['query'][_0xb500('0x3a')]+'%'};return _0x25c3f6;}})});}_0x1ad9c0=_[_0xb500('0x3e')]({},_0x1ad9c0,_0x5c923d[_0xb500('0x3f')]);var _0x313125={'where':_0x1ad9c0[_0xb500('0x3b')]};return db[_0xb500('0x2c')][_0xb500('0x1f')](_0x313125)['then'](function(_0x41be09){_0x20473d['count']=_0x41be09;if(_0x5c923d['query'][_0xb500('0x40')]){_0x1ad9c0[_0xb500('0x41')]=[{'all':!![]}];}return db[_0xb500('0x2c')][_0xb500('0x42')](_0x1ad9c0);})['then'](function(_0x1bd736){_0x20473d[_0xb500('0x43')]=_0x1bd736;return _0x20473d;})[_0xb500('0x26')](respondWithFilteredResult(_0x3bc4a6,_0x1ad9c0))[_0xb500('0x44')](handleError(_0x3bc4a6,null));};exports[_0xb500('0x45')]=function(_0x503709,_0x252448){var _0x131a24={'raw':!![],'where':{'id':_0x503709['params']['id']}},_0x394a27={};_0x394a27[_0xb500('0x30')]=_[_0xb500('0x32')](db['OpenchannelQueueReport'][_0xb500('0x46')]);_0x394a27[_0xb500('0x31')]=_['keys'](_0x503709[_0xb500('0x31')]);_0x394a27['filters']=_[_0xb500('0x34')](_0x394a27[_0xb500('0x30')],_0x394a27[_0xb500('0x31')]);_0x131a24[_0xb500('0x36')]=_[_0xb500('0x34')](_0x394a27[_0xb500('0x30')],qs[_0xb500('0x35')](_0x503709[_0xb500('0x31')][_0xb500('0x35')]));_0x131a24[_0xb500('0x36')]=_0x131a24[_0xb500('0x36')][_0xb500('0x47')]?_0x131a24[_0xb500('0x36')]:_0x394a27[_0xb500('0x30')];if(_0x503709['query']['includeAll']){_0x131a24['include']=[{'all':!![]}];}_0x131a24=_['merge']({},_0x131a24,_0x503709['options']);return db['OpenchannelQueueReport'][_0xb500('0x48')](_0x131a24)[_0xb500('0x26')](handleEntityNotFound(_0x252448,null))[_0xb500('0x26')](respondWithResult(_0x252448,null))[_0xb500('0x44')](handleError(_0x252448,null));};exports['create']=function(_0x18c4d4,_0x54abf1){return db[_0xb500('0x2c')]['create'](_0x18c4d4[_0xb500('0x49')],{})[_0xb500('0x26')](respondWithResult(_0x54abf1,0xc9))['catch'](handleError(_0x54abf1,null));};exports['update']=function(_0x45c9d6,_0x548e39){if(_0x45c9d6[_0xb500('0x49')]['id']){delete _0x45c9d6['body']['id'];}return db[_0xb500('0x2c')][_0xb500('0x48')]({'where':{'id':_0x45c9d6['params']['id']}})[_0xb500('0x26')](handleEntityNotFound(_0x548e39,null))[_0xb500('0x26')](saveUpdates(_0x45c9d6[_0xb500('0x49')],null))[_0xb500('0x26')](respondWithResult(_0x548e39,null))[_0xb500('0x44')](handleError(_0x548e39,null));};exports[_0xb500('0x27')]=function(_0x390c48,_0x29307c){return db['OpenchannelQueueReport'][_0xb500('0x48')]({'where':{'id':_0x390c48[_0xb500('0x4a')]['id']}})[_0xb500('0x26')](handleEntityNotFound(_0x29307c,null))['then'](removeEntity(_0x29307c,null))[_0xb500('0x44')](handleError(_0x29307c,null));};exports[_0xb500('0x4b')]=function(_0x59bbee,_0x51b6cc){return db['OpenchannelQueueReport'][_0xb500('0x4b')]()[_0xb500('0x26')](respondWithResult(_0x51b6cc,null))[_0xb500('0x44')](handleError(_0x51b6cc,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 65079a0..01c4569 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x814b,0x1a2));var _0xb814=function(_0x2fdee1,_0x466858){_0x2fdee1=_0x2fdee1-0x0;var _0x2c5533=_0x814b[_0x2fdee1];return _0x2c5533;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x1251a6,_0x5c0bea){var _0x2a324a=function(_0x5689f4){while(--_0x5689f4){_0x1251a6['push'](_0x1251a6['shift']());}};_0x2a324a(++_0x5c0bea);}(_0x1261,0x144));var _0x1126=function(_0x2f1ac4,_0x236a72){_0x2f1ac4=_0x2f1ac4-0x0;var _0x18e1a5=_0x1261[_0x2f1ac4];return _0x18e1a5;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d508bd3..6f598ea 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 _0x68a5=['UpdateOpenchannelQueueReport','update','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','request\x20sent','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','catch'];(function(_0x44780a,_0x5c61ab){var _0x30b2df=function(_0x13f733){while(--_0x13f733){_0x44780a['push'](_0x44780a['shift']());}};_0x30b2df(++_0x5c61ab);}(_0x68a5,0xfc));var _0x568a=function(_0x2bd4a9,_0xc95236){_0x2bd4a9=_0x2bd4a9-0x0;var _0x3a8f2d=_0x68a5[_0x2bd4a9];return _0x3a8f2d;};'use strict';var _=require(_0x568a('0x0'));var util=require('util');var moment=require(_0x568a('0x1'));var BPromise=require(_0x568a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x568a('0x3'));var db=require(_0x568a('0x4'))['db'];var utils=require(_0x568a('0x5'));var logger=require(_0x568a('0x6'))('rpc');var config=require(_0x568a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x568a('0x8')][_0x568a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d36ec,_0x3a7a9c,_0x4cda9a){return new BPromise(function(_0x172efd,_0x56deb6){return client[_0x568a('0xa')](_0x2d36ec,_0x4cda9a)[_0x568a('0xb')](function(_0x335ecd){logger[_0x568a('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a7a9c,'request\x20sent');logger[_0x568a('0xd')](_0x568a('0xe'),_0x3a7a9c,'request\x20sent',JSON[_0x568a('0xf')](_0x335ecd));if(_0x335ecd['error']){if(_0x335ecd[_0x568a('0x10')][_0x568a('0x11')]===0x1f4){logger[_0x568a('0x10')](_0x568a('0x12'),_0x3a7a9c,_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);return _0x56deb6(_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);}logger[_0x568a('0x10')](_0x568a('0x12'),_0x3a7a9c,_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);return _0x172efd(_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);}else{logger[_0x568a('0xc')](_0x568a('0x12'),_0x3a7a9c,_0x568a('0x14'));_0x172efd(_0x335ecd['result'][_0x568a('0x13')]);}})['catch'](function(_0xa77de8){logger[_0x568a('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a7a9c,_0xa77de8);_0x56deb6(_0xa77de8);});});}exports[_0x568a('0x15')]=function(_0x561ae1){var _0x40d4a1=this;return new Promise(function(_0x1c8e3a,_0x9b4670){return db[_0x568a('0x16')]['create'](_0x561ae1[_0x568a('0x17')],{'raw':_0x561ae1['options']?_0x561ae1[_0x568a('0x18')][_0x568a('0x19')]===undefined?!![]:![]:!![]})[_0x568a('0xb')](function(_0x3b9968){logger[_0x568a('0xc')](_0x568a('0x15'),_0x561ae1);logger[_0x568a('0xd')](_0x568a('0x15'),_0x561ae1,JSON['stringify'](_0x3b9968));_0x1c8e3a(_0x3b9968);})[_0x568a('0x1a')](function(_0x1f12b5){logger['error'](_0x568a('0x15'),_0x1f12b5[_0x568a('0x13')],_0x561ae1);_0x9b4670(_0x40d4a1[_0x568a('0x10')](0x1f4,_0x1f12b5['message']));});});};exports[_0x568a('0x1b')]=function(_0x378f0e){var _0x1d5329=this;return new Promise(function(_0x1df7ab,_0xdb83a1){return db[_0x568a('0x16')][_0x568a('0x1c')](_0x378f0e[_0x568a('0x17')],{'raw':_0x378f0e[_0x568a('0x18')]?_0x378f0e['options'][_0x568a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378f0e[_0x568a('0x18')]?_0x378f0e[_0x568a('0x18')][_0x568a('0x1d')]||null:null,'attributes':_0x378f0e[_0x568a('0x18')]?_0x378f0e[_0x568a('0x18')]['attributes']||null:null,'limit':_0x378f0e[_0x568a('0x18')]?_0x378f0e[_0x568a('0x18')][_0x568a('0x1e')]||null:null})[_0x568a('0xb')](function(_0x20498b){logger['info'](_0x568a('0x1b'),_0x378f0e);logger[_0x568a('0xd')](_0x568a('0x1b'),_0x378f0e,JSON[_0x568a('0xf')](_0x20498b));_0x1df7ab(_0x20498b);})[_0x568a('0x1a')](function(_0x153e1a){logger[_0x568a('0x10')](_0x568a('0x1b'),_0x153e1a[_0x568a('0x13')],_0x378f0e);_0xdb83a1(_0x1d5329[_0x568a('0x10')](0x1f4,_0x153e1a['message']));});});}; \ No newline at end of file +var _0x793b=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x793b,0x189));var _0xb793=function(_0xca811f,_0x3531ad){_0xca811f=_0xca811f-0x0;var _0x4939b8=_0x793b[_0xca811f];return _0x4939b8;};'use strict';var _=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var moment=require(_0xb793('0x2'));var BPromise=require(_0xb793('0x3'));var rs=require(_0xb793('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb793('0x5'))['db'];var utils=require(_0xb793('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb793('0x7'));var jayson=require(_0xb793('0x8'));var client=jayson[_0xb793('0x9')][_0xb793('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f110,_0x42d0c7,_0x134ac4){return new BPromise(function(_0x23a718,_0x149720){return client[_0xb793('0xb')](_0x39f110,_0x134ac4)[_0xb793('0xc')](function(_0x22c9ea){logger[_0xb793('0xd')](_0xb793('0xe'),_0x42d0c7,'request\x20sent');logger[_0xb793('0xf')](_0xb793('0x10'),_0x42d0c7,'request\x20sent',JSON['stringify'](_0x22c9ea));if(_0x22c9ea[_0xb793('0x11')]){if(_0x22c9ea[_0xb793('0x11')]['code']===0x1f4){logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x22c9ea['error'][_0xb793('0x12')]);return _0x149720(_0x22c9ea[_0xb793('0x11')][_0xb793('0x12')]);}logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x22c9ea[_0xb793('0x11')][_0xb793('0x12')]);return _0x23a718(_0x22c9ea['error'][_0xb793('0x12')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x42d0c7,_0xb793('0x13'));_0x23a718(_0x22c9ea[_0xb793('0x14')][_0xb793('0x12')]);}})[_0xb793('0x15')](function(_0x38d9f2){logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x38d9f2);_0x149720(_0x38d9f2);});});}exports[_0xb793('0x16')]=function(_0x977026){var _0x2914a2=this;return new Promise(function(_0x2c9e87,_0x101162){return db[_0xb793('0x17')][_0xb793('0x18')](_0x977026[_0xb793('0x19')],{'raw':_0x977026[_0xb793('0x1a')]?_0x977026['options'][_0xb793('0x1b')]===undefined?!![]:![]:!![]})[_0xb793('0xc')](function(_0x54bfd4){logger[_0xb793('0xd')](_0xb793('0x16'),_0x977026);logger[_0xb793('0xf')](_0xb793('0x16'),_0x977026,JSON[_0xb793('0x1c')](_0x54bfd4));_0x2c9e87(_0x54bfd4);})['catch'](function(_0x5ecf9c){logger[_0xb793('0x11')](_0xb793('0x16'),_0x5ecf9c[_0xb793('0x12')],_0x977026);_0x101162(_0x2914a2[_0xb793('0x11')](0x1f4,_0x5ecf9c[_0xb793('0x12')]));});});};exports[_0xb793('0x1d')]=function(_0x4d4544){var _0x1e470c=this;return new Promise(function(_0x503d69,_0x10947e){return db[_0xb793('0x17')][_0xb793('0x1e')](_0x4d4544[_0xb793('0x19')],{'raw':_0x4d4544[_0xb793('0x1a')]?_0x4d4544[_0xb793('0x1a')][_0xb793('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d4544['options']?_0x4d4544[_0xb793('0x1a')][_0xb793('0x1f')]||null:null,'attributes':_0x4d4544[_0xb793('0x1a')]?_0x4d4544[_0xb793('0x1a')][_0xb793('0x20')]||null:null,'limit':_0x4d4544[_0xb793('0x1a')]?_0x4d4544['options'][_0xb793('0x21')]||null:null})[_0xb793('0xc')](function(_0x107d78){logger['info'](_0xb793('0x1d'),_0x4d4544);logger[_0xb793('0xf')](_0xb793('0x1d'),_0x4d4544,JSON[_0xb793('0x1c')](_0x107d78));_0x503d69(_0x107d78);})['catch'](function(_0x493a8c){logger[_0xb793('0x11')]('UpdateOpenchannelQueueReport',_0x493a8c['message'],_0x4d4544);_0x10947e(_0x1e470c[_0xb793('0x11')](0x1f4,_0x493a8c[_0xb793('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7a00e0c..af758d2 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 _0x36b6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x360c9c,_0x30bf24){var _0x50b2df=function(_0x4f6648){while(--_0x4f6648){_0x360c9c['push'](_0x360c9c['shift']());}};_0x50b2df(++_0x30bf24);}(_0x36b6,0xba));var _0x636b=function(_0x244b88,_0x576cf2){_0x244b88=_0x244b88-0x0;var _0x962d84=_0x36b6[_0x244b88];return _0x962d84;};'use strict';var multer=require(_0x636b('0x0'));var util=require(_0x636b('0x1'));var path=require(_0x636b('0x2'));var timeout=require(_0x636b('0x3'));var express=require(_0x636b('0x4'));var router=express[_0x636b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x636b('0x6'));var interaction=require(_0x636b('0x7'));var config=require(_0x636b('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x636b('0x9')]('/',auth[_0x636b('0xa')](),controller[_0x636b('0xb')]);router['get']('/describe',auth[_0x636b('0xa')](),controller[_0x636b('0xc')]);router[_0x636b('0x9')](_0x636b('0xd'),auth[_0x636b('0xa')](),controller[_0x636b('0xe')]);router[_0x636b('0xf')]('/',auth['isAuthenticated'](),controller[_0x636b('0x10')]);router[_0x636b('0x11')]('/:id',auth[_0x636b('0xa')](),controller[_0x636b('0x12')]);router['delete'](_0x636b('0xd'),auth[_0x636b('0xa')](),controller[_0x636b('0x13')]);module[_0x636b('0x14')]=router; \ No newline at end of file +var _0xf138=['../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','/describe','describe','get','/:id','create','put','destroy','exports','util','Router','fs-extra'];(function(_0x39398f,_0x147c1c){var _0x130f31=function(_0x121e89){while(--_0x121e89){_0x39398f['push'](_0x39398f['shift']());}};_0x130f31(++_0x147c1c);}(_0xf138,0x1cd));var _0x8f13=function(_0x201270,_0x473c0d){_0x201270=_0x201270-0x0;var _0x7981c8=_0xf138[_0x201270];return _0x7981c8;};'use strict';var multer=require('multer');var util=require(_0x8f13('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8f13('0x1')]();var fs_extra=require(_0x8f13('0x2'));var auth=require(_0x8f13('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8f13('0x4'));var controller=require(_0x8f13('0x5'));router['get']('/',auth[_0x8f13('0x6')](),controller[_0x8f13('0x7')]);router['get'](_0x8f13('0x8'),auth['isAuthenticated'](),controller[_0x8f13('0x9')]);router[_0x8f13('0xa')](_0x8f13('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x8f13('0xc')]);router[_0x8f13('0xd')](_0x8f13('0xb'),auth[_0x8f13('0x6')](),controller['update']);router['delete']('/:id',auth[_0x8f13('0x6')](),controller[_0x8f13('0xe')]);module[_0x8f13('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d0768fe..b6a18f9 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x315d32,_0x33485b){var _0x3ea98d=function(_0x4111ee){while(--_0x4111ee){_0x315d32['push'](_0x315d32['shift']());}};_0x3ea98d(++_0x33485b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x3563ec,_0x4df6c1){var _0x290a97=function(_0x44b1ec){while(--_0x44b1ec){_0x3563ec['push'](_0x3563ec['shift']());}};_0x290a97(++_0x4df6c1);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0xf3cd[_0x2fff83];return _0xa2a722;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 21a99bb..c7ea0ec 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 _0xdd54=['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','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdd54,0xe1));var _0x4dd5=function(_0x21fdce,_0x3b4c0e){_0x21fdce=_0x21fdce-0x0;var _0xcdf7d6=_0xdd54[_0x21fdce];return _0xcdf7d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4dd5('0x0'));var jsonpatch=require(_0x4dd5('0x1'));var rp=require(_0x4dd5('0x2'));var moment=require(_0x4dd5('0x3'));var BPromise=require(_0x4dd5('0x4'));var Mustache=require(_0x4dd5('0x5'));var util=require(_0x4dd5('0x6'));var path=require('path');var sox=require(_0x4dd5('0x7'));var csv=require('to-csv');var ejs=require(_0x4dd5('0x8'));var fs=require('fs');var fs_extra=require(_0x4dd5('0x9'));var _=require('lodash');var squel=require(_0x4dd5('0xa'));var crypto=require('crypto');var jsforce=require(_0x4dd5('0xb'));var deskjs=require(_0x4dd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4dd5('0xd'));var Papa=require(_0x4dd5('0xe'));var Redis=require(_0x4dd5('0xf'));var authService=require(_0x4dd5('0x10'));var qs=require(_0x4dd5('0x11'));var as=require(_0x4dd5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4dd5('0x13'))(_0x4dd5('0x14'));var utils=require(_0x4dd5('0x15'));var config=require(_0x4dd5('0x16'));var licenseUtil=require(_0x4dd5('0x17'));var db=require(_0x4dd5('0x18'))['db'];function respondWithStatusCode(_0x22649c,_0x7de472){_0x7de472=_0x7de472||0xcc;return function(_0x3c4ecc){if(_0x3c4ecc){return _0x22649c[_0x4dd5('0x19')](_0x7de472);}return _0x22649c[_0x4dd5('0x1a')](_0x7de472)['end']();};}function respondWithResult(_0x564810,_0x1b006f){_0x1b006f=_0x1b006f||0xc8;return function(_0x2b7a52){if(_0x2b7a52){return _0x564810['status'](_0x1b006f)['json'](_0x2b7a52);}};}function respondWithFilteredResult(_0xa609eb,_0x2ea3df){return function(_0x19a656){if(_0x19a656){var _0x5ceb64=typeof _0x2ea3df[_0x4dd5('0x1b')]===_0x4dd5('0x1c')&&typeof _0x2ea3df[_0x4dd5('0x1d')]===_0x4dd5('0x1c');var _0x3a9fc5=_0x19a656[_0x4dd5('0x1e')];var _0xdb80f1=_0x5ceb64?0x0:_0x2ea3df['offset'];var _0x2da84a=_0x5ceb64?_0x19a656['count']:_0x2ea3df[_0x4dd5('0x1b')]+_0x2ea3df['limit'];var _0x503cd2;if(_0x2da84a>=_0x3a9fc5){_0x2da84a=_0x3a9fc5;_0x503cd2=0xc8;}else{_0x503cd2=0xce;}_0xa609eb[_0x4dd5('0x1a')](_0x503cd2);return _0xa609eb['set'](_0x4dd5('0x1f'),_0xdb80f1+'-'+_0x2da84a+'/'+_0x3a9fc5)[_0x4dd5('0x20')](_0x19a656);}return null;};}function patchUpdates(_0x254941){return function(_0x33e58f){try{jsonpatch[_0x4dd5('0x21')](_0x33e58f,_0x254941,!![]);}catch(_0x10332d){return BPromise[_0x4dd5('0x22')](_0x10332d);}return _0x33e58f[_0x4dd5('0x23')]();};}function saveUpdates(_0x3a49ad,_0x2a4811){return function(_0x478479){if(_0x478479){return _0x478479[_0x4dd5('0x24')](_0x3a49ad)[_0x4dd5('0x25')](function(_0x1ed359){return _0x1ed359;});}return null;};}function removeEntity(_0x588cd6,_0x49f0a3){return function(_0x34b93d){if(_0x34b93d){return _0x34b93d['destroy']()[_0x4dd5('0x25')](function(){_0x588cd6[_0x4dd5('0x1a')](0xcc)[_0x4dd5('0x26')]();});}};}function handleEntityNotFound(_0x76a3a8,_0x327ac6){return function(_0x49e1db){if(!_0x49e1db){_0x76a3a8[_0x4dd5('0x19')](0x194);}return _0x49e1db;};}function handleError(_0x2652f2,_0x305261){_0x305261=_0x305261||0x1f4;return function(_0x280fad){logger[_0x4dd5('0x27')](_0x280fad[_0x4dd5('0x28')]);if(_0x280fad[_0x4dd5('0x29')]){delete _0x280fad[_0x4dd5('0x29')];}_0x2652f2[_0x4dd5('0x1a')](_0x305261)[_0x4dd5('0x2a')](_0x280fad);};}exports[_0x4dd5('0x2b')]=function(_0xdfe3c5,_0x195961){var _0x12570a={},_0xe11e4d={},_0x390e5a={'count':0x0,'rows':[]};var _0x29c453=_[_0x4dd5('0x2c')](db[_0x4dd5('0x2d')][_0x4dd5('0x2e')],function(_0x106ed3){return{'name':_0x106ed3[_0x4dd5('0x2f')],'type':_0x106ed3[_0x4dd5('0x30')]['key']};});_0xe11e4d[_0x4dd5('0x31')]=_[_0x4dd5('0x2c')](_0x29c453,_0x4dd5('0x29'));_0xe11e4d[_0x4dd5('0x32')]=_[_0x4dd5('0x33')](_0xdfe3c5['query']);_0xe11e4d[_0x4dd5('0x34')]=_[_0x4dd5('0x35')](_0xe11e4d[_0x4dd5('0x31')],_0xe11e4d['query']);_0x12570a['attributes']=_['intersection'](_0xe11e4d[_0x4dd5('0x31')],qs[_0x4dd5('0x36')](_0xdfe3c5[_0x4dd5('0x32')][_0x4dd5('0x36')]));_0x12570a['attributes']=_0x12570a['attributes'][_0x4dd5('0x37')]?_0x12570a[_0x4dd5('0x38')]:_0xe11e4d[_0x4dd5('0x31')];if(!_0xdfe3c5['query'][_0x4dd5('0x39')](_0x4dd5('0x3a'))){_0x12570a[_0x4dd5('0x1d')]=qs[_0x4dd5('0x1d')](_0xdfe3c5['query'][_0x4dd5('0x1d')]);_0x12570a[_0x4dd5('0x1b')]=qs[_0x4dd5('0x1b')](_0xdfe3c5[_0x4dd5('0x32')][_0x4dd5('0x1b')]);}_0x12570a[_0x4dd5('0x3b')]=qs[_0x4dd5('0x3c')](_0xdfe3c5[_0x4dd5('0x32')][_0x4dd5('0x3c')]);_0x12570a[_0x4dd5('0x3d')]=qs['filters'](_[_0x4dd5('0x3e')](_0xdfe3c5[_0x4dd5('0x32')],_0xe11e4d['filters']),_0x29c453);if(_0xdfe3c5[_0x4dd5('0x32')][_0x4dd5('0x3f')]){_0x12570a[_0x4dd5('0x3d')]=_['merge'](_0x12570a['where'],{'$or':_[_0x4dd5('0x2c')](_0x29c453,function(_0x3cd186){if(_0x3cd186[_0x4dd5('0x30')]!==_0x4dd5('0x40')){var _0x3f8fa5={};_0x3f8fa5[_0x3cd186[_0x4dd5('0x29')]]={'$like':'%'+_0xdfe3c5[_0x4dd5('0x32')][_0x4dd5('0x3f')]+'%'};return _0x3f8fa5;}})});}_0x12570a=_['merge']({},_0x12570a,_0xdfe3c5[_0x4dd5('0x41')]);var _0x4f5285={'where':_0x12570a[_0x4dd5('0x3d')]};return db[_0x4dd5('0x2d')][_0x4dd5('0x1e')](_0x4f5285)['then'](function(_0x5c30db){_0x390e5a['count']=_0x5c30db;if(_0xdfe3c5[_0x4dd5('0x32')][_0x4dd5('0x42')]){_0x12570a[_0x4dd5('0x43')]=[{'all':!![]}];}return db[_0x4dd5('0x2d')][_0x4dd5('0x44')](_0x12570a);})[_0x4dd5('0x25')](function(_0x287d5f){_0x390e5a[_0x4dd5('0x45')]=_0x287d5f;return _0x390e5a;})[_0x4dd5('0x25')](respondWithFilteredResult(_0x195961,_0x12570a))[_0x4dd5('0x46')](handleError(_0x195961,null));};exports[_0x4dd5('0x47')]=function(_0x257e6a,_0x33c4c4){var _0x5403ff={'raw':!![],'where':{'id':_0x257e6a[_0x4dd5('0x48')]['id']}},_0xf33ce1={};_0xf33ce1[_0x4dd5('0x31')]=_[_0x4dd5('0x33')](db[_0x4dd5('0x2d')][_0x4dd5('0x2e')]);_0xf33ce1['query']=_[_0x4dd5('0x33')](_0x257e6a[_0x4dd5('0x32')]);_0xf33ce1[_0x4dd5('0x34')]=_[_0x4dd5('0x35')](_0xf33ce1['model'],_0xf33ce1['query']);_0x5403ff[_0x4dd5('0x38')]=_[_0x4dd5('0x35')](_0xf33ce1[_0x4dd5('0x31')],qs[_0x4dd5('0x36')](_0x257e6a[_0x4dd5('0x32')][_0x4dd5('0x36')]));_0x5403ff['attributes']=_0x5403ff[_0x4dd5('0x38')][_0x4dd5('0x37')]?_0x5403ff['attributes']:_0xf33ce1[_0x4dd5('0x31')];if(_0x257e6a[_0x4dd5('0x32')][_0x4dd5('0x42')]){_0x5403ff['include']=[{'all':!![]}];}_0x5403ff=_[_0x4dd5('0x49')]({},_0x5403ff,_0x257e6a[_0x4dd5('0x41')]);return db[_0x4dd5('0x2d')][_0x4dd5('0x4a')](_0x5403ff)[_0x4dd5('0x25')](handleEntityNotFound(_0x33c4c4,null))[_0x4dd5('0x25')](respondWithResult(_0x33c4c4,null))[_0x4dd5('0x46')](handleError(_0x33c4c4,null));};exports['create']=function(_0x4ee6b7,_0x180c0d){return db[_0x4dd5('0x2d')][_0x4dd5('0x4b')](_0x4ee6b7[_0x4dd5('0x4c')],{})[_0x4dd5('0x25')](respondWithResult(_0x180c0d,0xc9))['catch'](handleError(_0x180c0d,null));};exports[_0x4dd5('0x24')]=function(_0x3663fb,_0x38e394){if(_0x3663fb[_0x4dd5('0x4c')]['id']){delete _0x3663fb[_0x4dd5('0x4c')]['id'];}return db['OpenchannelTransferReport'][_0x4dd5('0x4a')]({'where':{'id':_0x3663fb[_0x4dd5('0x48')]['id']}})['then'](handleEntityNotFound(_0x38e394,null))['then'](saveUpdates(_0x3663fb['body'],null))[_0x4dd5('0x25')](respondWithResult(_0x38e394,null))[_0x4dd5('0x46')](handleError(_0x38e394,null));};exports[_0x4dd5('0x4d')]=function(_0x1e4005,_0x5a6cfe){return db[_0x4dd5('0x2d')][_0x4dd5('0x4a')]({'where':{'id':_0x1e4005[_0x4dd5('0x48')]['id']}})[_0x4dd5('0x25')](handleEntityNotFound(_0x5a6cfe,null))[_0x4dd5('0x25')](removeEntity(_0x5a6cfe,null))[_0x4dd5('0x46')](handleError(_0x5a6cfe,null));};exports[_0x4dd5('0x4e')]=function(_0x226e20,_0x4280b3){return db[_0x4dd5('0x2d')][_0x4dd5('0x4e')]()['then'](respondWithResult(_0x4280b3,null))[_0x4dd5('0x46')](handleError(_0x4280b3,null));}; \ No newline at end of file +var _0xf503=['to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf503,0xce));var _0x3f50=function(_0x58e2a5,_0x4e822c){_0x58e2a5=_0x58e2a5-0x0;var _0x440ba0=_0xf503[_0x58e2a5];return _0x440ba0;};'use strict';var emlformat=require(_0x3f50('0x0'));var rimraf=require(_0x3f50('0x1'));var zipdir=require(_0x3f50('0x2'));var jsonpatch=require(_0x3f50('0x3'));var rp=require(_0x3f50('0x4'));var moment=require(_0x3f50('0x5'));var BPromise=require(_0x3f50('0x6'));var Mustache=require(_0x3f50('0x7'));var util=require(_0x3f50('0x8'));var path=require(_0x3f50('0x9'));var sox=require('sox');var csv=require(_0x3f50('0xa'));var ejs=require(_0x3f50('0xb'));var fs=require('fs');var fs_extra=require(_0x3f50('0xc'));var _=require(_0x3f50('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3f50('0xa'));var querystring=require(_0x3f50('0xe'));var Papa=require(_0x3f50('0xf'));var Redis=require('ioredis');var authService=require(_0x3f50('0x10'));var qs=require(_0x3f50('0x11'));var as=require(_0x3f50('0x12'));var hardwareService=require(_0x3f50('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3f50('0x14'));var config=require(_0x3f50('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f50('0x16'))['db'];function respondWithStatusCode(_0x1c24b5,_0x514251){_0x514251=_0x514251||0xcc;return function(_0x1290a9){if(_0x1290a9){return _0x1c24b5[_0x3f50('0x17')](_0x514251);}return _0x1c24b5[_0x3f50('0x18')](_0x514251)[_0x3f50('0x19')]();};}function respondWithResult(_0x5a6553,_0x133a22){_0x133a22=_0x133a22||0xc8;return function(_0x492ac4){if(_0x492ac4){return _0x5a6553[_0x3f50('0x18')](_0x133a22)[_0x3f50('0x1a')](_0x492ac4);}};}function respondWithFilteredResult(_0x5c1557,_0x28afec){return function(_0x4e01f6){if(_0x4e01f6){var _0x312126=typeof _0x28afec[_0x3f50('0x1b')]===_0x3f50('0x1c')&&typeof _0x28afec['limit']===_0x3f50('0x1c');var _0x3d4a2c=_0x4e01f6['count'];var _0x282368=_0x312126?0x0:_0x28afec[_0x3f50('0x1b')];var _0x1b7a37=_0x312126?_0x4e01f6[_0x3f50('0x1d')]:_0x28afec[_0x3f50('0x1b')]+_0x28afec[_0x3f50('0x1e')];var _0x469ef5;if(_0x1b7a37>=_0x3d4a2c){_0x1b7a37=_0x3d4a2c;_0x469ef5=0xc8;}else{_0x469ef5=0xce;}_0x5c1557[_0x3f50('0x18')](_0x469ef5);return _0x5c1557[_0x3f50('0x1f')]('Content-Range',_0x282368+'-'+_0x1b7a37+'/'+_0x3d4a2c)[_0x3f50('0x1a')](_0x4e01f6);}return null;};}function patchUpdates(_0x245458){return function(_0x5e5eaf){try{jsonpatch[_0x3f50('0x20')](_0x5e5eaf,_0x245458,!![]);}catch(_0x22d1c6){return BPromise[_0x3f50('0x21')](_0x22d1c6);}return _0x5e5eaf[_0x3f50('0x22')]();};}function saveUpdates(_0x3a26d6,_0x3a1263){return function(_0x199774){if(_0x199774){return _0x199774[_0x3f50('0x23')](_0x3a26d6)[_0x3f50('0x24')](function(_0x2c8d42){return _0x2c8d42;});}return null;};}function removeEntity(_0x17431b,_0x53e001){return function(_0x12233e){if(_0x12233e){return _0x12233e[_0x3f50('0x25')]()[_0x3f50('0x24')](function(){_0x17431b['status'](0xcc)[_0x3f50('0x19')]();});}};}function handleEntityNotFound(_0x52f2c0,_0x1cc25e){return function(_0x5000d6){if(!_0x5000d6){_0x52f2c0[_0x3f50('0x17')](0x194);}return _0x5000d6;};}function handleError(_0x101858,_0x4e75ad){_0x4e75ad=_0x4e75ad||0x1f4;return function(_0x1f1369){logger[_0x3f50('0x26')](_0x1f1369['stack']);if(_0x1f1369['name']){delete _0x1f1369[_0x3f50('0x27')];}_0x101858[_0x3f50('0x18')](_0x4e75ad)['send'](_0x1f1369);};}exports[_0x3f50('0x28')]=function(_0x20dce1,_0x31672b){var _0x78783d={},_0x57dbfb={},_0x126736={'count':0x0,'rows':[]};var _0x163f0a=_[_0x3f50('0x29')](db[_0x3f50('0x2a')][_0x3f50('0x2b')],function(_0x3f1727){return{'name':_0x3f1727[_0x3f50('0x2c')],'type':_0x3f1727[_0x3f50('0x2d')]['key']};});_0x57dbfb[_0x3f50('0x2e')]=_['map'](_0x163f0a,_0x3f50('0x27'));_0x57dbfb[_0x3f50('0x2f')]=_[_0x3f50('0x30')](_0x20dce1[_0x3f50('0x2f')]);_0x57dbfb[_0x3f50('0x31')]=_[_0x3f50('0x32')](_0x57dbfb[_0x3f50('0x2e')],_0x57dbfb['query']);_0x78783d[_0x3f50('0x33')]=_['intersection'](_0x57dbfb['model'],qs['fields'](_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x34')]));_0x78783d[_0x3f50('0x33')]=_0x78783d[_0x3f50('0x33')][_0x3f50('0x35')]?_0x78783d['attributes']:_0x57dbfb[_0x3f50('0x2e')];if(!_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x36')]('nolimit')){_0x78783d['limit']=qs[_0x3f50('0x1e')](_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x1e')]);_0x78783d['offset']=qs[_0x3f50('0x1b')](_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x1b')]);}_0x78783d['order']=qs[_0x3f50('0x37')](_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x37')]);_0x78783d['where']=qs['filters'](_[_0x3f50('0x38')](_0x20dce1[_0x3f50('0x2f')],_0x57dbfb[_0x3f50('0x31')]),_0x163f0a);if(_0x20dce1[_0x3f50('0x2f')]['filter']){_0x78783d[_0x3f50('0x39')]=_[_0x3f50('0x3a')](_0x78783d[_0x3f50('0x39')],{'$or':_[_0x3f50('0x29')](_0x163f0a,function(_0x435d43){if(_0x435d43[_0x3f50('0x2d')]!=='VIRTUAL'){var _0x5a1bd8={};_0x5a1bd8[_0x435d43[_0x3f50('0x27')]]={'$like':'%'+_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x3b')]+'%'};return _0x5a1bd8;}})});}_0x78783d=_[_0x3f50('0x3a')]({},_0x78783d,_0x20dce1[_0x3f50('0x3c')]);var _0x21ec62={'where':_0x78783d['where']};return db[_0x3f50('0x2a')][_0x3f50('0x1d')](_0x21ec62)[_0x3f50('0x24')](function(_0x54981e){_0x126736[_0x3f50('0x1d')]=_0x54981e;if(_0x20dce1[_0x3f50('0x2f')][_0x3f50('0x3d')]){_0x78783d['include']=[{'all':!![]}];}return db[_0x3f50('0x2a')][_0x3f50('0x3e')](_0x78783d);})['then'](function(_0x126216){_0x126736[_0x3f50('0x3f')]=_0x126216;return _0x126736;})[_0x3f50('0x24')](respondWithFilteredResult(_0x31672b,_0x78783d))[_0x3f50('0x40')](handleError(_0x31672b,null));};exports[_0x3f50('0x41')]=function(_0x3dd466,_0x3171fb){var _0x491cf7={'raw':!![],'where':{'id':_0x3dd466[_0x3f50('0x42')]['id']}},_0x41f2f0={};_0x41f2f0[_0x3f50('0x2e')]=_[_0x3f50('0x30')](db[_0x3f50('0x2a')][_0x3f50('0x2b')]);_0x41f2f0[_0x3f50('0x2f')]=_['keys'](_0x3dd466[_0x3f50('0x2f')]);_0x41f2f0[_0x3f50('0x31')]=_[_0x3f50('0x32')](_0x41f2f0[_0x3f50('0x2e')],_0x41f2f0[_0x3f50('0x2f')]);_0x491cf7[_0x3f50('0x33')]=_['intersection'](_0x41f2f0[_0x3f50('0x2e')],qs[_0x3f50('0x34')](_0x3dd466[_0x3f50('0x2f')][_0x3f50('0x34')]));_0x491cf7[_0x3f50('0x33')]=_0x491cf7[_0x3f50('0x33')][_0x3f50('0x35')]?_0x491cf7[_0x3f50('0x33')]:_0x41f2f0['model'];if(_0x3dd466[_0x3f50('0x2f')][_0x3f50('0x3d')]){_0x491cf7[_0x3f50('0x43')]=[{'all':!![]}];}_0x491cf7=_[_0x3f50('0x3a')]({},_0x491cf7,_0x3dd466[_0x3f50('0x3c')]);return db['OpenchannelTransferReport']['find'](_0x491cf7)[_0x3f50('0x24')](handleEntityNotFound(_0x3171fb,null))['then'](respondWithResult(_0x3171fb,null))['catch'](handleError(_0x3171fb,null));};exports[_0x3f50('0x44')]=function(_0x476b98,_0xd8de37){return db[_0x3f50('0x2a')]['create'](_0x476b98[_0x3f50('0x45')],{})[_0x3f50('0x24')](respondWithResult(_0xd8de37,0xc9))[_0x3f50('0x40')](handleError(_0xd8de37,null));};exports[_0x3f50('0x23')]=function(_0x33cdcd,_0x52d34e){if(_0x33cdcd[_0x3f50('0x45')]['id']){delete _0x33cdcd[_0x3f50('0x45')]['id'];}return db[_0x3f50('0x2a')]['find']({'where':{'id':_0x33cdcd[_0x3f50('0x42')]['id']}})[_0x3f50('0x24')](handleEntityNotFound(_0x52d34e,null))[_0x3f50('0x24')](saveUpdates(_0x33cdcd['body'],null))[_0x3f50('0x24')](respondWithResult(_0x52d34e,null))['catch'](handleError(_0x52d34e,null));};exports[_0x3f50('0x25')]=function(_0x11f0b6,_0x1005fe){return db[_0x3f50('0x2a')][_0x3f50('0x46')]({'where':{'id':_0x11f0b6[_0x3f50('0x42')]['id']}})[_0x3f50('0x24')](handleEntityNotFound(_0x1005fe,null))['then'](removeEntity(_0x1005fe,null))[_0x3f50('0x40')](handleError(_0x1005fe,null));};exports[_0x3f50('0x47')]=function(_0x2d7b92,_0x55bfe6){return db[_0x3f50('0x2a')][_0x3f50('0x47')]()[_0x3f50('0x24')](respondWithResult(_0x55bfe6,null))[_0x3f50('0x40')](handleError(_0x55bfe6,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4dedb04..1f4b844 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 _0x3124=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0xa71e3,_0x1303c8){var _0x326e49=function(_0x20051a){while(--_0x20051a){_0xa71e3['push'](_0xa71e3['shift']());}};_0x326e49(++_0x1303c8);}(_0x3124,0x111));var _0x4312=function(_0x136fba,_0x306f9f){_0x136fba=_0x136fba-0x0;var _0x1cf2ad=_0x3124[_0x136fba];return _0x1cf2ad;};'use strict';var _=require(_0x4312('0x0'));var util=require(_0x4312('0x1'));var logger=require(_0x4312('0x2'))(_0x4312('0x3'));var moment=require(_0x4312('0x4'));var BPromise=require(_0x4312('0x5'));var rp=require(_0x4312('0x6'));var fs=require('fs');var path=require(_0x4312('0x7'));var rimraf=require(_0x4312('0x8'));var config=require(_0x4312('0x9'));var attributes=require(_0x4312('0xa'));module[_0x4312('0xb')]=function(_0x5b1986,_0x3fb042){return _0x5b1986[_0x4312('0xc')](_0x4312('0xd'),attributes,{'tableName':_0x4312('0xe'),'paranoid':![],'indexes':[{'name':_0x4312('0xf'),'fields':[_0x4312('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe380=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe380,0x158));var _0x0e38=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xe380[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0x0e38('0x0'));var logger=require(_0x0e38('0x1'))(_0x0e38('0x2'));var moment=require(_0x0e38('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e38('0x4'));var fs=require('fs');var path=require(_0x0e38('0x5'));var rimraf=require(_0x0e38('0x6'));var config=require(_0x0e38('0x7'));var attributes=require(_0x0e38('0x8'));module['exports']=function(_0x5e9d11,_0x5e4cce){return _0x5e9d11[_0x0e38('0x9')](_0x0e38('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x0e38('0xb'),'fields':[_0x0e38('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index b25a58d..a7a2cc9 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 _0xf2ca=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xa16401,_0x9a9949){var _0x3d5676=function(_0x2e639f){while(--_0x2e639f){_0xa16401['push'](_0xa16401['shift']());}};_0x3d5676(++_0x9a9949);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1fc7b5,_0x5d4779){_0x1fc7b5=_0x1fc7b5-0x0;var _0x3ef5db=_0xf2ca[_0x1fc7b5];return _0x3ef5db;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){return client[_0xaf2c('0xc')](_0x1f9531,_0x37fedd)['then'](function(_0x439ca3){logger['info'](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x58351f,'request\x20sent',JSON['stringify'](_0x439ca3));if(_0x439ca3[_0xaf2c('0x11')]){if(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x12')]===0x1f4){logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3['error']['message']);return _0x4a7397(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);return _0x3c0421(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}else{logger[_0xaf2c('0x14')](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));_0x3c0421(_0x439ca3[_0xaf2c('0x15')][_0xaf2c('0x13')]);}})[_0xaf2c('0x16')](function(_0x705d09){logger['error'](_0xaf2c('0xd'),_0x58351f,_0x705d09);_0x4a7397(_0x705d09);});});} \ No newline at end of file +var _0x9f7a=['../../config/environment','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','rpc'];(function(_0x2c7d87,_0x22b956){var _0x591bbb=function(_0x4e2270){while(--_0x4e2270){_0x2c7d87['push'](_0x2c7d87['shift']());}};_0x591bbb(++_0x22b956);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x9f7a[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var moment=require(_0xa9f7('0x2'));var BPromise=require(_0xa9f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9f7('0x5'));var config=require(_0xa9f7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa9f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5497c8,_0x48e791,_0x5bf7ca){return new BPromise(function(_0x21010f,_0x58a3f3){return client[_0xa9f7('0x8')](_0x5497c8,_0x5bf7ca)[_0xa9f7('0x9')](function(_0x287478){logger['info'](_0xa9f7('0xa'),_0x48e791,_0xa9f7('0xb'));logger['debug'](_0xa9f7('0xc'),_0x48e791,_0xa9f7('0xb'),JSON[_0xa9f7('0xd')](_0x287478));if(_0x287478[_0xa9f7('0xe')]){if(_0x287478[_0xa9f7('0xe')][_0xa9f7('0xf')]===0x1f4){logger[_0xa9f7('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x48e791,_0x287478[_0xa9f7('0xe')]['message']);return _0x58a3f3(_0x287478[_0xa9f7('0xe')][_0xa9f7('0x10')]);}logger[_0xa9f7('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x48e791,_0x287478['error'][_0xa9f7('0x10')]);return _0x21010f(_0x287478['error']['message']);}else{logger[_0xa9f7('0x11')](_0xa9f7('0xa'),_0x48e791,_0xa9f7('0xb'));_0x21010f(_0x287478['result'][_0xa9f7('0x10')]);}})[_0xa9f7('0x12')](function(_0x2aeadd){logger['error'](_0xa9f7('0xa'),_0x48e791,_0x2aeadd);_0x58a3f3(_0x2aeadd);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9ff6716..f3c2e22 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 _0xd237=['post','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x3b4d0f,_0x4fef23){var _0x379a93=function(_0x5b7db6){while(--_0x5b7db6){_0x3b4d0f['push'](_0x3b4d0f['shift']());}};_0x379a93(++_0x4fef23);}(_0xd237,0x136));var _0x7d23=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0xd237[_0x119629];return _0x49a771;};'use strict';var multer=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var path=require(_0x7d23('0x2'));var timeout=require('connect-timeout');var express=require(_0x7d23('0x3'));var router=express[_0x7d23('0x4')]();var fs_extra=require(_0x7d23('0x5'));var auth=require(_0x7d23('0x6'));var interaction=require(_0x7d23('0x7'));var config=require(_0x7d23('0x8'));var controller=require('./pause.controller');router[_0x7d23('0x9')]('/',auth[_0x7d23('0xa')](),controller[_0x7d23('0xb')]);router['get'](_0x7d23('0xc'),auth[_0x7d23('0xa')](),controller[_0x7d23('0xd')]);router[_0x7d23('0xe')]('/',auth[_0x7d23('0xa')](),controller['create']);router['put'](_0x7d23('0xc'),auth[_0x7d23('0xa')](),controller[_0x7d23('0xf')]);router[_0x7d23('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x7d23('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe173=['post','put','/:id','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','show'];(function(_0x19373c,_0x3784cb){var _0x2732f7=function(_0x25a47b){while(--_0x25a47b){_0x19373c['push'](_0x19373c['shift']());}};_0x2732f7(++_0x3784cb);}(_0xe173,0x1a5));var _0x3e17=function(_0x4545cb,_0x4f904a){_0x4545cb=_0x4545cb-0x0;var _0x17b453=_0xe173[_0x4545cb];return _0x17b453;};'use strict';var multer=require(_0x3e17('0x0'));var util=require(_0x3e17('0x1'));var path=require(_0x3e17('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3e17('0x3')]();var fs_extra=require(_0x3e17('0x4'));var auth=require(_0x3e17('0x5'));var interaction=require(_0x3e17('0x6'));var config=require('../../config/environment');var controller=require(_0x3e17('0x7'));router[_0x3e17('0x8')]('/',auth[_0x3e17('0x9')](),controller['index']);router[_0x3e17('0x8')]('/:id',auth[_0x3e17('0x9')](),controller[_0x3e17('0xa')]);router[_0x3e17('0xb')]('/',auth[_0x3e17('0x9')](),controller['create']);router[_0x3e17('0xc')](_0x3e17('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x3e17('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3e17('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index acc5006..0877e97 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 _0x7abe=['STRING','sequelize','exports'];(function(_0x4a00e4,_0x202466){var _0x2c878f=function(_0x44fe39){while(--_0x44fe39){_0x4a00e4['push'](_0x4a00e4['shift']());}};_0x2c878f(++_0x202466);}(_0x7abe,0x1b7));var _0xe7ab=function(_0x18cea7,_0x544f22){_0x18cea7=_0x18cea7-0x0;var _0x30eedf=_0x7abe[_0x18cea7];return _0x30eedf;};'use strict';var Sequelize=require(_0xe7ab('0x0'));module[_0xe7ab('0x1')]={'name':{'type':Sequelize[_0xe7ab('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe7ab('0x2')]}}; \ No newline at end of file +var _0x784f=['name','STRING'];(function(_0x579baf,_0x4aaafa){var _0x4c601a=function(_0x462b53){while(--_0x462b53){_0x579baf['push'](_0x579baf['shift']());}};_0x4c601a(++_0x4aaafa);}(_0x784f,0x1bb));var _0xf784=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x784f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf784('0x0')],'unique':_0xf784('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xf784('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 471700d..5489341 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 _0x77aa=['../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','get','Pauses','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Pause','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x77aa,0x95));var _0xa77a=function(_0x51ce2a,_0x4e9a66){_0x51ce2a=_0x51ce2a-0x0;var _0x24d80c=_0x77aa[_0x51ce2a];return _0x24d80c;};'use strict';var emlformat=require(_0xa77a('0x0'));var rimraf=require(_0xa77a('0x1'));var zipdir=require(_0xa77a('0x2'));var jsonpatch=require(_0xa77a('0x3'));var rp=require(_0xa77a('0x4'));var moment=require(_0xa77a('0x5'));var BPromise=require(_0xa77a('0x6'));var Mustache=require(_0xa77a('0x7'));var util=require(_0xa77a('0x8'));var path=require(_0xa77a('0x9'));var sox=require(_0xa77a('0xa'));var csv=require(_0xa77a('0xb'));var ejs=require(_0xa77a('0xc'));var fs=require('fs');var fs_extra=require(_0xa77a('0xd'));var _=require(_0xa77a('0xe'));var squel=require(_0xa77a('0xf'));var crypto=require(_0xa77a('0x10'));var jsforce=require(_0xa77a('0x11'));var deskjs=require(_0xa77a('0x12'));var toCsv=require(_0xa77a('0xb'));var querystring=require('querystring');var Papa=require(_0xa77a('0x13'));var Redis=require('ioredis');var authService=require(_0xa77a('0x14'));var qs=require(_0xa77a('0x15'));var as=require(_0xa77a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa77a('0x17'))(_0xa77a('0x18'));var utils=require(_0xa77a('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa77a('0x1a'))['db'];function respondWithStatusCode(_0x406761,_0x47d63a){_0x47d63a=_0x47d63a||0xcc;return function(_0x558589){if(_0x558589){return _0x406761[_0xa77a('0x1b')](_0x47d63a);}return _0x406761[_0xa77a('0x1c')](_0x47d63a)[_0xa77a('0x1d')]();};}function respondWithResult(_0x1a58c1,_0x3f6f66){_0x3f6f66=_0x3f6f66||0xc8;return function(_0x4de3dc){if(_0x4de3dc){return _0x1a58c1['status'](_0x3f6f66)['json'](_0x4de3dc);}};}function respondWithFilteredResult(_0x5b504f,_0x39020e){return function(_0x29c869){if(_0x29c869){var _0x3cd68c=typeof _0x39020e[_0xa77a('0x1e')]===_0xa77a('0x1f')&&typeof _0x39020e['limit']===_0xa77a('0x1f');var _0x31911f=_0x29c869['count'];var _0x45b8e3=_0x3cd68c?0x0:_0x39020e[_0xa77a('0x1e')];var _0xdfde33=_0x3cd68c?_0x29c869[_0xa77a('0x20')]:_0x39020e[_0xa77a('0x1e')]+_0x39020e[_0xa77a('0x21')];var _0x542041;if(_0xdfde33>=_0x31911f){_0xdfde33=_0x31911f;_0x542041=0xc8;}else{_0x542041=0xce;}_0x5b504f[_0xa77a('0x1c')](_0x542041);return _0x5b504f[_0xa77a('0x22')](_0xa77a('0x23'),_0x45b8e3+'-'+_0xdfde33+'/'+_0x31911f)['json'](_0x29c869);}return null;};}function patchUpdates(_0x2ec626){return function(_0x21127f){try{jsonpatch[_0xa77a('0x24')](_0x21127f,_0x2ec626,!![]);}catch(_0xa72d9e){return BPromise[_0xa77a('0x25')](_0xa72d9e);}return _0x21127f['save']();};}function saveUpdates(_0x34fa93,_0x2d528b){return function(_0xa865ef){if(_0xa865ef){return _0xa865ef[_0xa77a('0x26')](_0x34fa93)['then'](function(_0x2be90a){return _0x2be90a;});}return null;};}function removeEntity(_0x338bf7,_0x2bb962){return function(_0x3bf7eb){if(_0x3bf7eb){return _0x3bf7eb[_0xa77a('0x27')]()[_0xa77a('0x28')](function(){var _0x387d33=_0x3bf7eb[_0xa77a('0x29')]({'plain':!![]});var _0x1a63c0=_0xa77a('0x2a');return db[_0xa77a('0x2b')][_0xa77a('0x27')]({'where':{'type':_0x1a63c0,'resourceId':_0x387d33['id']}})[_0xa77a('0x28')](function(){return _0x3bf7eb;});})[_0xa77a('0x28')](function(){_0x338bf7['status'](0xcc)[_0xa77a('0x1d')]();});}};}function handleEntityNotFound(_0x4a701d,_0x1d5771){return function(_0x558080){if(!_0x558080){_0x4a701d[_0xa77a('0x1b')](0x194);}return _0x558080;};}function handleError(_0x440b0b,_0x5460b4){_0x5460b4=_0x5460b4||0x1f4;return function(_0xfb41c9){logger[_0xa77a('0x2c')](_0xfb41c9[_0xa77a('0x2d')]);if(_0xfb41c9[_0xa77a('0x2e')]){delete _0xfb41c9[_0xa77a('0x2e')];}_0x440b0b['status'](_0x5460b4)[_0xa77a('0x2f')](_0xfb41c9);};}exports['index']=function(_0x3dba39,_0x223b9f){var _0x4ad2b4={},_0x41656b={},_0x3ba103={'count':0x0,'rows':[]};var _0x8fa895=_[_0xa77a('0x30')](db['Pause'][_0xa77a('0x31')],function(_0x26ea28){return{'name':_0x26ea28[_0xa77a('0x32')],'type':_0x26ea28[_0xa77a('0x33')][_0xa77a('0x34')]};});_0x41656b[_0xa77a('0x35')]=_[_0xa77a('0x30')](_0x8fa895,'name');_0x41656b[_0xa77a('0x36')]=_['keys'](_0x3dba39[_0xa77a('0x36')]);_0x41656b[_0xa77a('0x37')]=_[_0xa77a('0x38')](_0x41656b[_0xa77a('0x35')],_0x41656b['query']);_0x4ad2b4[_0xa77a('0x39')]=_[_0xa77a('0x38')](_0x41656b['model'],qs[_0xa77a('0x3a')](_0x3dba39[_0xa77a('0x36')][_0xa77a('0x3a')]));_0x4ad2b4[_0xa77a('0x39')]=_0x4ad2b4[_0xa77a('0x39')][_0xa77a('0x3b')]?_0x4ad2b4[_0xa77a('0x39')]:_0x41656b['model'];if(!_0x3dba39[_0xa77a('0x36')][_0xa77a('0x3c')](_0xa77a('0x3d'))){_0x4ad2b4[_0xa77a('0x21')]=qs[_0xa77a('0x21')](_0x3dba39[_0xa77a('0x36')][_0xa77a('0x21')]);_0x4ad2b4[_0xa77a('0x1e')]=qs[_0xa77a('0x1e')](_0x3dba39[_0xa77a('0x36')]['offset']);}_0x4ad2b4[_0xa77a('0x3e')]=qs[_0xa77a('0x3f')](_0x3dba39[_0xa77a('0x36')][_0xa77a('0x3f')]);_0x4ad2b4[_0xa77a('0x40')]=qs[_0xa77a('0x37')](_[_0xa77a('0x41')](_0x3dba39[_0xa77a('0x36')],_0x41656b[_0xa77a('0x37')]),_0x8fa895);if(_0x3dba39[_0xa77a('0x36')][_0xa77a('0x42')]){_0x4ad2b4[_0xa77a('0x40')]=_[_0xa77a('0x43')](_0x4ad2b4[_0xa77a('0x40')],{'$or':_[_0xa77a('0x30')](_0x8fa895,function(_0x3f387d){if(_0x3f387d[_0xa77a('0x33')]!==_0xa77a('0x44')){var _0x1b4f5a={};_0x1b4f5a[_0x3f387d[_0xa77a('0x2e')]]={'$like':'%'+_0x3dba39['query'][_0xa77a('0x42')]+'%'};return _0x1b4f5a;}})});}_0x4ad2b4=_[_0xa77a('0x43')]({},_0x4ad2b4,_0x3dba39[_0xa77a('0x45')]);var _0x5ba917={'where':_0x4ad2b4[_0xa77a('0x40')]};return db['Pause']['count'](_0x5ba917)[_0xa77a('0x28')](function(_0x2746f7){_0x3ba103[_0xa77a('0x20')]=_0x2746f7;if(_0x3dba39[_0xa77a('0x36')][_0xa77a('0x46')]){_0x4ad2b4[_0xa77a('0x47')]=[{'all':!![]}];}return db[_0xa77a('0x48')]['findAll'](_0x4ad2b4);})[_0xa77a('0x28')](function(_0x39c3c1){_0x3ba103[_0xa77a('0x49')]=_0x39c3c1;return _0x3ba103;})[_0xa77a('0x28')](respondWithFilteredResult(_0x223b9f,_0x4ad2b4))[_0xa77a('0x4a')](handleError(_0x223b9f,null));};exports[_0xa77a('0x4b')]=function(_0x5be70e,_0x1d9d42){var _0x3835a7={'raw':!![],'where':{'id':_0x5be70e[_0xa77a('0x4c')]['id']}},_0x7c95ae={};_0x7c95ae['model']=_['keys'](db['Pause'][_0xa77a('0x31')]);_0x7c95ae[_0xa77a('0x36')]=_[_0xa77a('0x4d')](_0x5be70e[_0xa77a('0x36')]);_0x7c95ae[_0xa77a('0x37')]=_[_0xa77a('0x38')](_0x7c95ae[_0xa77a('0x35')],_0x7c95ae['query']);_0x3835a7['attributes']=_['intersection'](_0x7c95ae['model'],qs[_0xa77a('0x3a')](_0x5be70e['query'][_0xa77a('0x3a')]));_0x3835a7[_0xa77a('0x39')]=_0x3835a7[_0xa77a('0x39')][_0xa77a('0x3b')]?_0x3835a7[_0xa77a('0x39')]:_0x7c95ae[_0xa77a('0x35')];if(_0x5be70e['query']['includeAll']){_0x3835a7[_0xa77a('0x47')]=[{'all':!![]}];}_0x3835a7=_[_0xa77a('0x43')]({},_0x3835a7,_0x5be70e[_0xa77a('0x45')]);return db[_0xa77a('0x48')][_0xa77a('0x4e')](_0x3835a7)['then'](handleEntityNotFound(_0x1d9d42,null))[_0xa77a('0x28')](respondWithResult(_0x1d9d42,null))[_0xa77a('0x4a')](handleError(_0x1d9d42,null));};exports[_0xa77a('0x4f')]=function(_0x23bb5d,_0x6de2a8){return db[_0xa77a('0x48')][_0xa77a('0x4f')](_0x23bb5d[_0xa77a('0x50')],{})[_0xa77a('0x28')](function(_0x140f2b){var _0x3a4551=_0x23bb5d[_0xa77a('0x51')][_0xa77a('0x29')]({'plain':!![]});if(!_0x3a4551)throw new Error(_0xa77a('0x52'));if(_0x3a4551['role']==='user'){var _0x5b63=_0x140f2b[_0xa77a('0x29')]({'plain':!![]});var _0x566509=_0xa77a('0x2a');return db[_0xa77a('0x53')][_0xa77a('0x4e')]({'where':{'name':_0x566509,'userProfileId':_0x3a4551[_0xa77a('0x54')]},'raw':!![]})['then'](function(_0x25dd36){if(_0x25dd36&&_0x25dd36['autoAssociation']===0x0){return db[_0xa77a('0x2b')]['create']({'name':_0x5b63[_0xa77a('0x2e')],'resourceId':_0x5b63['id'],'type':_0x25dd36[_0xa77a('0x2e')],'sectionId':_0x25dd36['id']},{})[_0xa77a('0x28')](function(){return _0x140f2b;});}else{return _0x140f2b;}})[_0xa77a('0x4a')](function(_0x5f2679){logger[_0xa77a('0x2c')](_0xa77a('0x55'),_0x5f2679);throw _0x5f2679;});}return _0x140f2b;})[_0xa77a('0x28')](respondWithResult(_0x6de2a8,0xc9))['catch'](handleError(_0x6de2a8,null));};exports['update']=function(_0x33eb9e,_0x158eef){if(_0x33eb9e[_0xa77a('0x50')]['id']){delete _0x33eb9e[_0xa77a('0x50')]['id'];}return db['Pause']['find']({'where':{'id':_0x33eb9e[_0xa77a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x158eef,null))['then'](saveUpdates(_0x33eb9e['body'],null))['then'](respondWithResult(_0x158eef,null))[_0xa77a('0x4a')](handleError(_0x158eef,null));};exports[_0xa77a('0x27')]=function(_0x56dc16,_0x52709e){return db['Pause'][_0xa77a('0x4e')]({'where':{'id':_0x56dc16[_0xa77a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x52709e,null))[_0xa77a('0x28')](removeEntity(_0x52709e,null))[_0xa77a('0x4a')](handleError(_0x52709e,null));}; \ No newline at end of file +var _0x2cba=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','update','then','get','Pauses','destroy','error','name','send','Pause','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0x2cba,0xa8));var _0xa2cb=function(_0x3bd62b,_0x648996){_0x3bd62b=_0x3bd62b-0x0;var _0xd03a31=_0x2cba[_0x3bd62b];return _0xd03a31;};'use strict';var emlformat=require(_0xa2cb('0x0'));var rimraf=require(_0xa2cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa2cb('0x2'));var rp=require(_0xa2cb('0x3'));var moment=require(_0xa2cb('0x4'));var BPromise=require(_0xa2cb('0x5'));var Mustache=require(_0xa2cb('0x6'));var util=require(_0xa2cb('0x7'));var path=require('path');var sox=require(_0xa2cb('0x8'));var csv=require('to-csv');var ejs=require(_0xa2cb('0x9'));var fs=require('fs');var fs_extra=require(_0xa2cb('0xa'));var _=require(_0xa2cb('0xb'));var squel=require('squel');var crypto=require(_0xa2cb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa2cb('0xd'));var toCsv=require(_0xa2cb('0xe'));var querystring=require('querystring');var Papa=require(_0xa2cb('0xf'));var Redis=require('ioredis');var authService=require(_0xa2cb('0x10'));var qs=require(_0xa2cb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa2cb('0x12'));var logger=require(_0xa2cb('0x13'))(_0xa2cb('0x14'));var utils=require(_0xa2cb('0x15'));var config=require(_0xa2cb('0x16'));var licenseUtil=require(_0xa2cb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321ed5,_0x2fb70b){_0x2fb70b=_0x2fb70b||0xcc;return function(_0xce4c14){if(_0xce4c14){return _0x321ed5[_0xa2cb('0x18')](_0x2fb70b);}return _0x321ed5[_0xa2cb('0x19')](_0x2fb70b)[_0xa2cb('0x1a')]();};}function respondWithResult(_0xeddc67,_0x2a80bb){_0x2a80bb=_0x2a80bb||0xc8;return function(_0x18b7bf){if(_0x18b7bf){return _0xeddc67['status'](_0x2a80bb)['json'](_0x18b7bf);}};}function respondWithFilteredResult(_0x5261b3,_0x4d3076){return function(_0x35282a){if(_0x35282a){var _0x2c00c0=typeof _0x4d3076[_0xa2cb('0x1b')]==='undefined'&&typeof _0x4d3076[_0xa2cb('0x1c')]==='undefined';var _0x44e9e9=_0x35282a[_0xa2cb('0x1d')];var _0x955967=_0x2c00c0?0x0:_0x4d3076[_0xa2cb('0x1b')];var _0x4e67e7=_0x2c00c0?_0x35282a[_0xa2cb('0x1d')]:_0x4d3076['offset']+_0x4d3076[_0xa2cb('0x1c')];var _0x4a8982;if(_0x4e67e7>=_0x44e9e9){_0x4e67e7=_0x44e9e9;_0x4a8982=0xc8;}else{_0x4a8982=0xce;}_0x5261b3[_0xa2cb('0x19')](_0x4a8982);return _0x5261b3[_0xa2cb('0x1e')](_0xa2cb('0x1f'),_0x955967+'-'+_0x4e67e7+'/'+_0x44e9e9)['json'](_0x35282a);}return null;};}function patchUpdates(_0x5db8af){return function(_0x427728){try{jsonpatch[_0xa2cb('0x20')](_0x427728,_0x5db8af,!![]);}catch(_0x5d3027){return BPromise['reject'](_0x5d3027);}return _0x427728['save']();};}function saveUpdates(_0x379a68,_0x2af959){return function(_0x3d3762){if(_0x3d3762){return _0x3d3762[_0xa2cb('0x21')](_0x379a68)[_0xa2cb('0x22')](function(_0x2a1c48){return _0x2a1c48;});}return null;};}function removeEntity(_0x2241c6,_0x4eb883){return function(_0x2295c9){if(_0x2295c9){return _0x2295c9['destroy']()[_0xa2cb('0x22')](function(){var _0x4282bd=_0x2295c9[_0xa2cb('0x23')]({'plain':!![]});var _0x3cfd7d=_0xa2cb('0x24');return db['UserProfileResource'][_0xa2cb('0x25')]({'where':{'type':_0x3cfd7d,'resourceId':_0x4282bd['id']}})[_0xa2cb('0x22')](function(){return _0x2295c9;});})['then'](function(){_0x2241c6[_0xa2cb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c56b9,_0x4bb93f){return function(_0x2cc707){if(!_0x2cc707){_0x1c56b9[_0xa2cb('0x18')](0x194);}return _0x2cc707;};}function handleError(_0x57cc64,_0x36f3cf){_0x36f3cf=_0x36f3cf||0x1f4;return function(_0x17c378){logger[_0xa2cb('0x26')](_0x17c378['stack']);if(_0x17c378['name']){delete _0x17c378[_0xa2cb('0x27')];}_0x57cc64[_0xa2cb('0x19')](_0x36f3cf)[_0xa2cb('0x28')](_0x17c378);};}exports['index']=function(_0x17830a,_0x2b2750){var _0x40afd3={},_0x126dfd={},_0x430dbd={'count':0x0,'rows':[]};var _0x1730be=_['map'](db[_0xa2cb('0x29')][_0xa2cb('0x2a')],function(_0x30fcc4){return{'name':_0x30fcc4[_0xa2cb('0x2b')],'type':_0x30fcc4[_0xa2cb('0x2c')]['key']};});_0x126dfd[_0xa2cb('0x2d')]=_[_0xa2cb('0x2e')](_0x1730be,_0xa2cb('0x27'));_0x126dfd[_0xa2cb('0x2f')]=_[_0xa2cb('0x30')](_0x17830a['query']);_0x126dfd[_0xa2cb('0x31')]=_['intersection'](_0x126dfd[_0xa2cb('0x2d')],_0x126dfd[_0xa2cb('0x2f')]);_0x40afd3['attributes']=_[_0xa2cb('0x32')](_0x126dfd[_0xa2cb('0x2d')],qs[_0xa2cb('0x33')](_0x17830a[_0xa2cb('0x2f')]['fields']));_0x40afd3[_0xa2cb('0x34')]=_0x40afd3[_0xa2cb('0x34')][_0xa2cb('0x35')]?_0x40afd3['attributes']:_0x126dfd[_0xa2cb('0x2d')];if(!_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x36')]('nolimit')){_0x40afd3[_0xa2cb('0x1c')]=qs['limit'](_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x1c')]);_0x40afd3['offset']=qs[_0xa2cb('0x1b')](_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x1b')]);}_0x40afd3[_0xa2cb('0x37')]=qs['sort'](_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x38')]);_0x40afd3['where']=qs[_0xa2cb('0x31')](_[_0xa2cb('0x39')](_0x17830a[_0xa2cb('0x2f')],_0x126dfd['filters']),_0x1730be);if(_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x3a')]){_0x40afd3[_0xa2cb('0x3b')]=_[_0xa2cb('0x3c')](_0x40afd3[_0xa2cb('0x3b')],{'$or':_[_0xa2cb('0x2e')](_0x1730be,function(_0x5de203){if(_0x5de203['type']!=='VIRTUAL'){var _0x17c69a={};_0x17c69a[_0x5de203['name']]={'$like':'%'+_0x17830a[_0xa2cb('0x2f')]['filter']+'%'};return _0x17c69a;}})});}_0x40afd3=_[_0xa2cb('0x3c')]({},_0x40afd3,_0x17830a[_0xa2cb('0x3d')]);var _0x1640e3={'where':_0x40afd3[_0xa2cb('0x3b')]};return db[_0xa2cb('0x29')][_0xa2cb('0x1d')](_0x1640e3)[_0xa2cb('0x22')](function(_0x254ba2){_0x430dbd[_0xa2cb('0x1d')]=_0x254ba2;if(_0x17830a[_0xa2cb('0x2f')][_0xa2cb('0x3e')]){_0x40afd3[_0xa2cb('0x3f')]=[{'all':!![]}];}return db[_0xa2cb('0x29')][_0xa2cb('0x40')](_0x40afd3);})['then'](function(_0x4f1f94){_0x430dbd[_0xa2cb('0x41')]=_0x4f1f94;return _0x430dbd;})[_0xa2cb('0x22')](respondWithFilteredResult(_0x2b2750,_0x40afd3))[_0xa2cb('0x42')](handleError(_0x2b2750,null));};exports[_0xa2cb('0x43')]=function(_0x59139c,_0x1dec29){var _0x28f0cf={'raw':!![],'where':{'id':_0x59139c[_0xa2cb('0x44')]['id']}},_0x23ca30={};_0x23ca30[_0xa2cb('0x2d')]=_[_0xa2cb('0x30')](db[_0xa2cb('0x29')][_0xa2cb('0x2a')]);_0x23ca30['query']=_[_0xa2cb('0x30')](_0x59139c['query']);_0x23ca30[_0xa2cb('0x31')]=_[_0xa2cb('0x32')](_0x23ca30['model'],_0x23ca30['query']);_0x28f0cf[_0xa2cb('0x34')]=_['intersection'](_0x23ca30[_0xa2cb('0x2d')],qs[_0xa2cb('0x33')](_0x59139c[_0xa2cb('0x2f')][_0xa2cb('0x33')]));_0x28f0cf[_0xa2cb('0x34')]=_0x28f0cf[_0xa2cb('0x34')][_0xa2cb('0x35')]?_0x28f0cf[_0xa2cb('0x34')]:_0x23ca30[_0xa2cb('0x2d')];if(_0x59139c[_0xa2cb('0x2f')][_0xa2cb('0x3e')]){_0x28f0cf[_0xa2cb('0x3f')]=[{'all':!![]}];}_0x28f0cf=_[_0xa2cb('0x3c')]({},_0x28f0cf,_0x59139c['options']);return db[_0xa2cb('0x29')][_0xa2cb('0x45')](_0x28f0cf)[_0xa2cb('0x22')](handleEntityNotFound(_0x1dec29,null))[_0xa2cb('0x22')](respondWithResult(_0x1dec29,null))[_0xa2cb('0x42')](handleError(_0x1dec29,null));};exports[_0xa2cb('0x46')]=function(_0x23f0e8,_0x276cd2){return db['Pause'][_0xa2cb('0x46')](_0x23f0e8[_0xa2cb('0x47')],{})[_0xa2cb('0x22')](function(_0x26f7f0){var _0x5cadc3=_0x23f0e8['user'][_0xa2cb('0x23')]({'plain':!![]});if(!_0x5cadc3)throw new Error(_0xa2cb('0x48'));if(_0x5cadc3[_0xa2cb('0x49')]===_0xa2cb('0x4a')){var _0x6ddc42=_0x26f7f0[_0xa2cb('0x23')]({'plain':!![]});var _0x42d8c8=_0xa2cb('0x24');return db[_0xa2cb('0x4b')]['find']({'where':{'name':_0x42d8c8,'userProfileId':_0x5cadc3[_0xa2cb('0x4c')]},'raw':!![]})[_0xa2cb('0x22')](function(_0x425bd4){if(_0x425bd4&&_0x425bd4[_0xa2cb('0x4d')]===0x0){return db[_0xa2cb('0x4e')]['create']({'name':_0x6ddc42['name'],'resourceId':_0x6ddc42['id'],'type':_0x425bd4[_0xa2cb('0x27')],'sectionId':_0x425bd4['id']},{})[_0xa2cb('0x22')](function(){return _0x26f7f0;});}else{return _0x26f7f0;}})[_0xa2cb('0x42')](function(_0x27e003){logger['error'](_0xa2cb('0x4f'),_0x27e003);throw _0x27e003;});}return _0x26f7f0;})[_0xa2cb('0x22')](respondWithResult(_0x276cd2,0xc9))[_0xa2cb('0x42')](handleError(_0x276cd2,null));};exports['update']=function(_0x9f5a26,_0x417322){if(_0x9f5a26[_0xa2cb('0x47')]['id']){delete _0x9f5a26['body']['id'];}return db[_0xa2cb('0x29')][_0xa2cb('0x45')]({'where':{'id':_0x9f5a26[_0xa2cb('0x44')]['id']}})[_0xa2cb('0x22')](handleEntityNotFound(_0x417322,null))[_0xa2cb('0x22')](saveUpdates(_0x9f5a26[_0xa2cb('0x47')],null))[_0xa2cb('0x22')](respondWithResult(_0x417322,null))[_0xa2cb('0x42')](handleError(_0x417322,null));};exports[_0xa2cb('0x25')]=function(_0x56a744,_0xa9a19b){return db[_0xa2cb('0x29')][_0xa2cb('0x45')]({'where':{'id':_0x56a744['params']['id']}})[_0xa2cb('0x22')](handleEntityNotFound(_0xa9a19b,null))['then'](removeEntity(_0xa9a19b,null))['catch'](handleError(_0xa9a19b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 14c1c8a..6ce5dee 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 _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x799b24,_0x35c956){var _0x573c10=function(_0x50c21c){while(--_0x50c21c){_0x799b24['push'](_0x799b24['shift']());}};_0x573c10(++_0x35c956);}(_0x814b,0x1a2));var _0xb814=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x814b[_0x14490c];return _0x2f6825;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index b0a06a3..f30b74d 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(_0x5d68b9,_0x10b29a){var _0x54dcff=function(_0x534a71){while(--_0x534a71){_0x5d68b9['push'](_0x5d68b9['shift']());}};_0x54dcff(++_0x10b29a);}(_0xb10b,0x12a));var _0xbb10=function(_0x309251,_0x59a3d3){_0x309251=_0x309251-0x0;var _0x3c6e84=_0xb10b[_0x309251];return _0x3c6e84;};'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(_0x29bf96,_0xd75d49){var _0x373574=function(_0x3467f7){while(--_0x3467f7){_0x29bf96['push'](_0x29bf96['shift']());}};_0x373574(++_0xd75d49);}(_0x7a54,0x106));var _0x47a5=function(_0x240412,_0x48ed81){_0x240412=_0x240412-0x0;var _0x4829b2=_0x7a54[_0x240412];return _0x4829b2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d78bd7f..4ffd736 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 _0x4bc3=['single','file','webhookPost','put','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','/:id','show','/:id/download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post'];(function(_0x53fcaa,_0x27e601){var _0x4d925b=function(_0x161eb7){while(--_0x161eb7){_0x53fcaa['push'](_0x53fcaa['shift']());}};_0x4d925b(++_0x27e601);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x4bc3[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/webhook',controller['webhookGet']);router[_0x34bc('0x9')](_0x34bc('0xb'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xc')]);router[_0x34bc('0x9')](_0x34bc('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x34bc('0xe')]({'destination':function(_0x33025c,_0x2a35f3,_0x5a608a){_0x5a608a(null,path[_0x34bc('0xf')](config['root'],_0x34bc('0x10')));},'filename':function(_0x124b87,_0x164fb2,_0x536ebd){_0x164fb2[_0x34bc('0x11')]=_0x164fb2['originalname'][_0x34bc('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x536ebd(null,util[_0x34bc('0x13')](_0x34bc('0x14'),path['basename'](_0x164fb2['originalname'],path[_0x34bc('0x15')](_0x164fb2['originalname'])),Date[_0x34bc('0x16')](),path[_0x34bc('0x15')](_0x164fb2[_0x34bc('0x11')])));}})});router[_0x34bc('0x17')]('/',upload[_0x34bc('0x18')](_0x34bc('0x19')),controller['upload']);router['post']('/webhook',controller[_0x34bc('0x1a')]);router[_0x34bc('0x1b')](_0x34bc('0xb'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x1c')](_0x34bc('0xb'),auth['isAuthenticated'](),controller[_0x34bc('0x1c')]);module[_0x34bc('0x1d')]=router; \ No newline at end of file +var _0x2dae=['put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','post','file','upload'];(function(_0x548334,_0x5c6a9b){var _0x374147=function(_0xc19150){while(--_0xc19150){_0x548334['push'](_0x548334['shift']());}};_0x374147(++_0x5c6a9b);}(_0x2dae,0xc3));var _0xe2da=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x2dae[_0x3d9176];return _0x12adc5;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),controller[_0xe2da('0xc')]);router[_0xe2da('0x9')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0xf')]);router[_0xe2da('0x9')]('/:id/download',auth[_0xe2da('0xe')](),controller[_0xe2da('0x10')]);var upload=multer({'storage':multer[_0xe2da('0x11')]({'destination':function(_0x17086c,_0x3c1309,_0x44ec3e){_0x44ec3e(null,path[_0xe2da('0x12')](config[_0xe2da('0x13')],'server/files/plugins'));},'filename':function(_0xb98909,_0x5200b1,_0x4377c6){_0x5200b1[_0xe2da('0x14')]=_0x5200b1[_0xe2da('0x14')][_0xe2da('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4377c6(null,util[_0xe2da('0x16')](_0xe2da('0x17'),path[_0xe2da('0x18')](_0x5200b1['originalname'],path[_0xe2da('0x19')](_0x5200b1['originalname'])),Date['now'](),path[_0xe2da('0x19')](_0x5200b1[_0xe2da('0x14')])));}})});router[_0xe2da('0x1a')]('/',upload['single'](_0xe2da('0x1b')),controller[_0xe2da('0x1c')]);router[_0xe2da('0x1a')](_0xe2da('0xb'),controller['webhookPost']);router[_0xe2da('0x1d')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0x1e')]);router[_0xe2da('0x1f')]('/:id',auth[_0xe2da('0xe')](),controller[_0xe2da('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 756d9b5..93f43bb 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 _0x0f56=['sequelize','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f56,0xd1));var _0x60f5=function(_0x2343c8,_0xf47636){_0x2343c8=_0x2343c8-0x0;var _0x29aa63=_0x0f56[_0x2343c8];return _0x29aa63;};'use strict';var Sequelize=require(_0x60f5('0x0'));module['exports']={'name':{'type':Sequelize[_0x60f5('0x1')]},'type':{'type':Sequelize[_0x60f5('0x2')](_0x60f5('0x3'),'script')},'description':{'type':Sequelize[_0x60f5('0x4')]},'version':{'type':Sequelize[_0x60f5('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x60f5('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x60f5('0x6')},'sidebar':{'type':Sequelize[_0x60f5('0x2')](_0x60f5('0x7'),_0x60f5('0x8'),_0x60f5('0x9'),'never'),'defaultValue':_0x60f5('0x9'),'comment':_0x60f5('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x60f5('0x1')]},'agentUrl':{'type':Sequelize[_0x60f5('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x60f5('0x1')]}}; \ No newline at end of file +var _0x8ed6=['adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x8ed6,0x1f3));var _0x68ed=function(_0x3a6bff,_0x1f4cfb){_0x3a6bff=_0x3a6bff-0x0;var _0x8aa90=_0x8ed6[_0x3a6bff];return _0x8aa90;};'use strict';var Sequelize=require('sequelize');module[_0x68ed('0x0')]={'name':{'type':Sequelize[_0x68ed('0x1')]},'type':{'type':Sequelize['ENUM'](_0x68ed('0x2'),'script')},'description':{'type':Sequelize[_0x68ed('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x68ed('0x1')],'comment':_0x68ed('0x4')},'active':{'type':Sequelize[_0x68ed('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x68ed('0x6')](_0x68ed('0x7'),_0x68ed('0x8'),_0x68ed('0x9'),'never'),'defaultValue':_0x68ed('0x9'),'comment':_0x68ed('0xa')},'icon':{'type':Sequelize[_0x68ed('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x68ed('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 0223f1f..293d4e8 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 _0x4099=['info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','root','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','http://localhost:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','querystring','papaparse','extract-zip','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','includeAll','catch','show','params','length','include','find','download','join','server/files/plugins','%s.zip','createWriteStream','zip','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','format','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','upload','file','filename'];(function(_0x3f975a,_0xf22b0b){var _0x512370=function(_0x3d3ddd){while(--_0x3d3ddd){_0x3f975a['push'](_0x3f975a['shift']());}};_0x512370(++_0xf22b0b);}(_0x4099,0x1a5));var _0x9409=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x4099[_0x2984d0];return _0x2885f2;};'use strict';var emlformat=require(_0x9409('0x0'));var rimraf=require(_0x9409('0x1'));var zipdir=require(_0x9409('0x2'));var jsonpatch=require(_0x9409('0x3'));var rp=require(_0x9409('0x4'));var moment=require(_0x9409('0x5'));var BPromise=require(_0x9409('0x6'));var Mustache=require(_0x9409('0x7'));var util=require('util');var path=require(_0x9409('0x8'));var sox=require(_0x9409('0x9'));var csv=require('to-csv');var ejs=require(_0x9409('0xa'));var fs=require('fs');var fs_extra=require(_0x9409('0xb'));var _=require(_0x9409('0xc'));var squel=require(_0x9409('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9409('0xe'));var Papa=require(_0x9409('0xf'));var extract=require(_0x9409('0x10'));var rimraf=require(_0x9409('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x9409('0x11'));var qs=require(_0x9409('0x12'));var as=require(_0x9409('0x13'));var hardwareService=require(_0x9409('0x14'));var logger=require(_0x9409('0x15'))(_0x9409('0x16'));var utils=require(_0x9409('0x17'));var config=require(_0x9409('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9409('0x19'))['db'];config[_0x9409('0x1a')]=_[_0x9409('0x1b')](config['redis'],{'host':_0x9409('0x1c'),'port':0x18eb});var socket=require(_0x9409('0x1d'))(new Redis(config['redis']));require('./plugin.socket')[_0x9409('0x1e')](socket);function respondWithStatusCode(_0x4ccd10,_0x22f4d8){_0x22f4d8=_0x22f4d8||0xcc;return function(_0x4633ba){if(_0x4633ba){return _0x4ccd10[_0x9409('0x1f')](_0x22f4d8);}return _0x4ccd10[_0x9409('0x20')](_0x22f4d8)[_0x9409('0x21')]();};}function respondWithResult(_0x19bf82,_0x4a1b05){_0x4a1b05=_0x4a1b05||0xc8;return function(_0x3e0a42){if(_0x3e0a42){return _0x19bf82[_0x9409('0x20')](_0x4a1b05)[_0x9409('0x22')](_0x3e0a42);}};}function respondWithFilteredResult(_0x2c251,_0x525baa){return function(_0x5e16fe){if(_0x5e16fe){var _0x33e17d=typeof _0x525baa[_0x9409('0x23')]===_0x9409('0x24')&&typeof _0x525baa[_0x9409('0x25')]==='undefined';var _0xcc3ec6=_0x5e16fe[_0x9409('0x26')];var _0x2490f1=_0x33e17d?0x0:_0x525baa[_0x9409('0x23')];var _0x1730fe=_0x33e17d?_0x5e16fe[_0x9409('0x26')]:_0x525baa[_0x9409('0x23')]+_0x525baa[_0x9409('0x25')];var _0x24fd71;if(_0x1730fe>=_0xcc3ec6){_0x1730fe=_0xcc3ec6;_0x24fd71=0xc8;}else{_0x24fd71=0xce;}_0x2c251[_0x9409('0x20')](_0x24fd71);return _0x2c251[_0x9409('0x27')](_0x9409('0x28'),_0x2490f1+'-'+_0x1730fe+'/'+_0xcc3ec6)[_0x9409('0x22')](_0x5e16fe);}return null;};}function patchUpdates(_0x50e958){return function(_0x1017b7){try{jsonpatch[_0x9409('0x29')](_0x1017b7,_0x50e958,!![]);}catch(_0x2f723a){return BPromise[_0x9409('0x2a')](_0x2f723a);}return _0x1017b7[_0x9409('0x2b')]();};}function saveUpdates(_0x246828,_0x2545b0){return function(_0x3cae40){if(_0x3cae40){return _0x3cae40['update'](_0x246828)['then'](function(_0x4f07b9){return _0x4f07b9;});}return null;};}function removeEntity(_0x549595,_0x331a19){return function(_0x4ba306){if(_0x4ba306){return _0x4ba306['destroy']()[_0x9409('0x2c')](function(){var _0x2f2dfa=_0x4ba306['get']({'plain':!![]});var _0x354e8e='Plugins';return db['UserProfileResource'][_0x9409('0x2d')]({'where':{'type':_0x354e8e,'resourceId':_0x2f2dfa['id']}})['then'](function(){return _0x4ba306;});})['then'](function(){_0x549595[_0x9409('0x20')](0xcc)[_0x9409('0x21')]();});}};}function handleEntityNotFound(_0x2a8a0a,_0x41e075){return function(_0x3c22f5){if(!_0x3c22f5){_0x2a8a0a[_0x9409('0x1f')](0x194);}return _0x3c22f5;};}function handleError(_0xfcd73,_0x3356e5){_0x3356e5=_0x3356e5||0x1f4;return function(_0x300052){logger['error'](_0x300052['stack']);if(_0x300052['name']){delete _0x300052[_0x9409('0x2e')];}_0xfcd73[_0x9409('0x20')](_0x3356e5)[_0x9409('0x2f')](_0x300052);};}exports[_0x9409('0x30')]=function(_0x2c3721,_0x419499){var _0x36a1a7={},_0x1f3064={},_0x17e2a6={'count':0x0,'rows':[]};var _0xd252ac=_['map'](db['Plugin'][_0x9409('0x31')],function(_0xefb571){return{'name':_0xefb571['fieldName'],'type':_0xefb571[_0x9409('0x32')][_0x9409('0x33')]};});_0x1f3064[_0x9409('0x34')]=_[_0x9409('0x35')](_0xd252ac,_0x9409('0x2e'));_0x1f3064['query']=_[_0x9409('0x36')](_0x2c3721[_0x9409('0x37')]);_0x1f3064[_0x9409('0x38')]=_[_0x9409('0x39')](_0x1f3064['model'],_0x1f3064['query']);_0x36a1a7[_0x9409('0x3a')]=_[_0x9409('0x39')](_0x1f3064['model'],qs[_0x9409('0x3b')](_0x2c3721['query'][_0x9409('0x3b')]));_0x36a1a7[_0x9409('0x3a')]=_0x36a1a7['attributes']['length']?_0x36a1a7[_0x9409('0x3a')]:_0x1f3064[_0x9409('0x34')];if(!_0x2c3721[_0x9409('0x37')][_0x9409('0x3c')](_0x9409('0x3d'))){_0x36a1a7[_0x9409('0x25')]=qs[_0x9409('0x25')](_0x2c3721['query'][_0x9409('0x25')]);_0x36a1a7[_0x9409('0x23')]=qs[_0x9409('0x23')](_0x2c3721[_0x9409('0x37')][_0x9409('0x23')]);}_0x36a1a7['order']=qs[_0x9409('0x3e')](_0x2c3721[_0x9409('0x37')][_0x9409('0x3e')]);_0x36a1a7[_0x9409('0x3f')]=qs[_0x9409('0x38')](_[_0x9409('0x40')](_0x2c3721[_0x9409('0x37')],_0x1f3064[_0x9409('0x38')]),_0xd252ac);if(_0x2c3721[_0x9409('0x37')][_0x9409('0x41')]){_0x36a1a7['where']=_[_0x9409('0x42')](_0x36a1a7['where'],{'$or':_['map'](_0xd252ac,function(_0x1f2404){if(_0x1f2404[_0x9409('0x32')]!==_0x9409('0x43')){var _0x585ac9={};_0x585ac9[_0x1f2404[_0x9409('0x2e')]]={'$like':'%'+_0x2c3721[_0x9409('0x37')][_0x9409('0x41')]+'%'};return _0x585ac9;}})});}_0x36a1a7=_[_0x9409('0x42')]({},_0x36a1a7,_0x2c3721[_0x9409('0x44')]);var _0x4005f9={'where':_0x36a1a7[_0x9409('0x3f')]};return db[_0x9409('0x45')][_0x9409('0x26')](_0x4005f9)['then'](function(_0x3c450b){_0x17e2a6[_0x9409('0x26')]=_0x3c450b;if(_0x2c3721[_0x9409('0x37')][_0x9409('0x46')]){_0x36a1a7['include']=[{'all':!![]}];}return db[_0x9409('0x45')]['findAll'](_0x36a1a7);})['then'](function(_0x261476){_0x17e2a6['rows']=_0x261476;return _0x17e2a6;})['then'](respondWithFilteredResult(_0x419499,_0x36a1a7))[_0x9409('0x47')](handleError(_0x419499,null));};exports[_0x9409('0x48')]=function(_0x593319,_0x151d6d){var _0x15d859={'raw':!![],'where':{'id':_0x593319[_0x9409('0x49')]['id']}},_0x12669e={};_0x12669e[_0x9409('0x34')]=_[_0x9409('0x36')](db[_0x9409('0x45')][_0x9409('0x31')]);_0x12669e[_0x9409('0x37')]=_[_0x9409('0x36')](_0x593319['query']);_0x12669e['filters']=_[_0x9409('0x39')](_0x12669e[_0x9409('0x34')],_0x12669e[_0x9409('0x37')]);_0x15d859['attributes']=_[_0x9409('0x39')](_0x12669e['model'],qs[_0x9409('0x3b')](_0x593319['query'][_0x9409('0x3b')]));_0x15d859[_0x9409('0x3a')]=_0x15d859['attributes'][_0x9409('0x4a')]?_0x15d859[_0x9409('0x3a')]:_0x12669e[_0x9409('0x34')];if(_0x593319[_0x9409('0x37')][_0x9409('0x46')]){_0x15d859[_0x9409('0x4b')]=[{'all':!![]}];}_0x15d859=_['merge']({},_0x15d859,_0x593319[_0x9409('0x44')]);return db['Plugin'][_0x9409('0x4c')](_0x15d859)[_0x9409('0x2c')](handleEntityNotFound(_0x151d6d,null))[_0x9409('0x2c')](respondWithResult(_0x151d6d,null))['catch'](handleError(_0x151d6d,null));};exports[_0x9409('0x4d')]=function(_0x1e5b49,_0x587352,_0xf3fbba){return db[_0x9409('0x45')][_0x9409('0x4c')]({'where':{'id':_0x1e5b49[_0x9409('0x49')]['id']},'attributes':[_0x9409('0x2e'),_0x9409('0x8')],'raw':!![]})[_0x9409('0x2c')](handleEntityNotFound(_0x587352,null))[_0x9409('0x2c')](function(_0x4598a5){if(_0x4598a5){var _0x2b1956=path[_0x9409('0x4e')](config['root'],_0x9409('0x4f'),util['format'](_0x9409('0x50'),path['basename'](_0x4598a5[_0x9409('0x8')])));var _0x364232=fs[_0x9409('0x51')](_0x2b1956);var _0x4077e4=archiver(_0x9409('0x52'),{'zlib':{'level':0x9}});_0x4077e4['on']('warning',function(_0x424960){if(_0x424960[_0x9409('0x53')]===_0x9409('0x54')){logger[_0x9409('0x55')](_0x424960);}else{throw new db[(_0x9409('0x56'))][(_0x9409('0x57'))](_0x9409('0x58'));}});_0x4077e4['on'](_0x9409('0x55'),function(_0xf693b8){throw new db[(_0x9409('0x56'))]['Error'](_0x9409('0x58'));});_0x4077e4[_0x9409('0x59')](_0x364232);_0x4077e4[_0x9409('0x5a')](_0x9409('0x5b'),{'cwd':path[_0x9409('0x4e')](config['root'],_0x9409('0x4f'),path[_0x9409('0x5c')](_0x4598a5[_0x9409('0x8')])),'ignore':[path[_0x9409('0x4e')](path[_0x9409('0x5d')](_0x4598a5[_0x9409('0x8')]),_0x9409('0x5e')),path[_0x9409('0x4e')](path[_0x9409('0x5d')](_0x4598a5[_0x9409('0x8')]),_0x9409('0x5f'))],'nodir':!![]})[_0x9409('0x60')]();_0x364232['on'](_0x9409('0x61'),function(){if(!fs['existsSync'](_0x2b1956)){throw new db[(_0x9409('0x56'))][(_0x9409('0x57'))]('Plugin\x20not\x20found');}return _0x587352[_0x9409('0x4d')](_0x2b1956,util[_0x9409('0x62')](_0x9409('0x50'),path[_0x9409('0x5d')](_0x4598a5[_0x9409('0x8')])),function(_0x42252c){if(_0x42252c){throw new db['Sequelize'][(_0x9409('0x57'))](_0x9409('0x63'));}fs['unlinkSync'](_0x2b1956);logger['info'](_0x9409('0x64'));logger['info']('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x587352,null));};exports[_0x9409('0x65')]=function(_0x520d6b,_0x371af8,_0x37b87e){var _0xe29d5=path['basename'](_0x520d6b['file']['filename'],path['extname'](_0x520d6b[_0x9409('0x66')][_0x9409('0x67')]));var _0x464536=path['join'](config['root'],_0x9409('0x4f'),_0x520d6b['file'][_0x9409('0x67')]);var _0x1c8870=path[_0x9409('0x4e')](config['root'],_0x9409('0x4f'),_0xe29d5);logger[_0x9409('0x68')](_0x9409('0x69'),_0x464536);logger[_0x9409('0x68')](_0x9409('0x6a'),_0x1c8870);try{fs[_0x9409('0x6b')](_0x464536,parseInt(_0x9409('0x6c'),0x8));extract(_0x464536,{'dir':_0x1c8870},function(_0x5b5d71){if(_0x5b5d71){logger[_0x9409('0x55')](_0x5b5d71);handleError(_0x5b5d71,!![]);};var _0x4a45fc=fs[_0x9409('0x6d')](_0x1c8870);if(_0x4a45fc[_0x9409('0x4a')]>0x1){removeReferences(_0x464536,_0x1c8870);logger[_0x9409('0x55')](_0x9409('0x6e'));return _0x37b87e(new Error(_0x9409('0x6e')));}var _0x374882=fs[_0x9409('0x6f')](path[_0x9409('0x4e')](_0x1c8870,_0x4a45fc[0x0]));if(_0x374882[_0x9409('0x70')]()){removeReferences(_0x464536,_0x1c8870);logger['error'](_0x9409('0x6e'));return _0x37b87e(new Error(_0x9409('0x6e')));}if(_0x374882[_0x9409('0x71')]()){var _0x444b21=fs[_0x9409('0x6d')](path[_0x9409('0x4e')](_0x1c8870,_0x4a45fc[0x0]));if(_0x444b21['length']===0x0){removeReferences(_0x464536,_0x1c8870);logger[_0x9409('0x55')](_0x9409('0x6e'));return _0x37b87e(new Error(_0x9409('0x6e')));}var _0xad3f65=_0x444b21[_0x9409('0x72')](function(_0x381ce7){return _0x381ce7==='manifest.json';});if(!_0xad3f65){return _0x37b87e(new Error(_0x9409('0x73')));}var _0x10a66c=fs[_0x9409('0x74')](path['join'](_0x1c8870,_0x4a45fc[0x0],_0x9409('0x75')));var _0x386a6a=JSON[_0x9409('0x76')](_0x10a66c);if(_0x9409('0x24')==typeof _0x386a6a['name']){return _0x37b87e(new Error(_0x9409('0x77')));}if(_0x9409('0x24')==typeof _0x386a6a[_0x9409('0x32')]){return _0x37b87e(new Error(_0x9409('0x78')));}if(_0x9409('0x24')==typeof _0x386a6a[_0x9409('0x79')]){return _0x37b87e(new Error(_0x9409('0x7a')));}if(_0x9409('0x24')==typeof _0x386a6a['parameters']){return _0x37b87e(new Error(_0x9409('0x7b')));}if(_0x386a6a[_0x9409('0x32')]===_0x9409('0x7c')){if(_0x9409('0x24')==typeof _0x386a6a[_0x9409('0x7d')][_0x9409('0x7e')]){return _0x37b87e(new Error(_0x9409('0x7f')));}if('undefined'==typeof _0x386a6a['parameters'][_0x9409('0x7e')][_0x9409('0x80')]&&_0x9409('0x24')==typeof _0x386a6a['parameters'][_0x9409('0x7e')][_0x9409('0x81')]){return _0x37b87e(new Error(_0x9409('0x82')));}}else if(_0x386a6a[_0x9409('0x32')]===_0x9409('0x83')){if(_0x9409('0x24')==typeof _0x386a6a['parameters'][_0x9409('0x84')]){return _0x37b87e(new Error(_0x9409('0x85')));}if(_0x9409('0x24')==typeof _0x386a6a['parameters'][_0x9409('0x86')]){return _0x37b87e(new Error(_0x9409('0x87')));}}else{return _0x37b87e(new Error(_0x9409('0x88')));}var _0xfa4876=_0x386a6a['name'];var _0x280ce2=_0x386a6a[_0x9409('0x89')];var _0x4c8d9c=_0x386a6a[_0x9409('0x32')];var _0x37d380=_0x386a6a[_0x9409('0x8a')]?_0x386a6a[_0x9409('0x8a')]:_0x9409('0x8b');var _0x2a4440=_0x386a6a['icon']?_0x386a6a[_0x9409('0x8c')]:_0x9409('0x8d');var _0x44f7ef='';var _0x592b12='';var _0x574539='';var _0x5acc3f='';var _0x1b8f58=_0x386a6a[_0x9409('0x79')];if(_0x4c8d9c===_0x9409('0x7c')){if('undefined'!=typeof _0x386a6a[_0x9409('0x7d')][_0x9409('0x7e')]['admin']){var _0x370a96=_0x386a6a['parameters'][_0x9409('0x7e')][_0x9409('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x9409('0x8e')](_0x370a96)){_0x44f7ef=path[_0x9409('0x4e')](_0x9409('0x8f'),_0xe29d5,_0x4a45fc[0x0],_0x370a96);}else{_0x44f7ef=_0x370a96;}}else{logger[_0x9409('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x9409('0x24')!=typeof _0x386a6a[_0x9409('0x7d')][_0x9409('0x7e')]['agent']){var _0x2b9d16=_0x386a6a[_0x9409('0x7d')][_0x9409('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2b9d16)){_0x592b12=path[_0x9409('0x4e')](_0x9409('0x8f'),_0xe29d5,_0x4a45fc[0x0],_0x2b9d16);}else{_0x592b12=_0x2b9d16;}}else{logger[_0x9409('0x68')](_0x9409('0x90'));}}else if(_0x4c8d9c==='script'){_0x574539=_0x386a6a['parameters'][_0x9409('0x84')];_0x5acc3f=_0x386a6a['parameters'][_0x9409('0x86')];if('undefined'!=typeof _0x386a6a[_0x9409('0x7d')][_0x9409('0x7e')]){if(_0x9409('0x24')!=typeof _0x386a6a[_0x9409('0x7d')][_0x9409('0x7e')][_0x9409('0x80')]){var _0x370a96=_0x386a6a[_0x9409('0x7d')][_0x9409('0x7e')][_0x9409('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x9409('0x8e')](_0x370a96)){_0x44f7ef=path[_0x9409('0x4e')](_0x9409('0x8f'),_0xe29d5,_0x4a45fc[0x0],_0x370a96);}else{_0x44f7ef=_0x370a96;}}if('undefined'!=typeof _0x386a6a[_0x9409('0x7d')]['views'][_0x9409('0x81')]){var _0x2b9d16=_0x386a6a[_0x9409('0x7d')][_0x9409('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9409('0x8e')](_0x2b9d16)){_0x592b12=path['join'](_0x9409('0x8f'),_0xe29d5,_0x4a45fc[0x0],_0x2b9d16);}else{_0x592b12=_0x2b9d16;}}}}var _0x57c9eb={'name':_0xfa4876,'description':_0x280ce2,'path':path[_0x9409('0x4e')](_0xe29d5,_0x4a45fc[0x0]),'type':_0x4c8d9c,'sidebar':_0x37d380,'icon':_0x2a4440,'adminUrl':_0x44f7ef,'agentUrl':_0x592b12,'scriptName':_0x574539,'scriptPath':_0x5acc3f,'version':_0x1b8f58};removeReferences(_0x464536,null);return db[_0x9409('0x45')][_0x9409('0x91')](_0x57c9eb)[_0x9409('0x2c')](function(_0xc61aae){var _0x5a801e={'role':_0x520d6b['body'][_0x9409('0x92')],'userProfileId':_0x520d6b[_0x9409('0x93')][_0x9409('0x94')]};if(!_0x5a801e)throw new Error(_0x9409('0x95'));if(_0x5a801e['role']==='user'){var _0x4b91f5=_0xc61aae['get']({'plain':!![]});return db[_0x9409('0x96')][_0x9409('0x4c')]({'where':{'name':_0x9409('0x97'),'userProfileId':_0x5a801e[_0x9409('0x94')]},'raw':!![]})['then'](function(_0x49c2b4){if(_0x49c2b4&&_0x49c2b4['autoAssociation']===0x0){return db['UserProfileResource'][_0x9409('0x91')]({'name':_0x4b91f5[_0x9409('0x2e')],'resourceId':_0x4b91f5['id'],'type':_0x49c2b4[_0x9409('0x2e')],'sectionId':_0x49c2b4['id']},{})[_0x9409('0x2c')](function(){return _0xc61aae;});}else{return _0xc61aae;}})[_0x9409('0x47')](function(_0x17417b){logger[_0x9409('0x55')](_0x9409('0x98'),_0x17417b);throw _0x17417b;});}return _0xc61aae;})[_0x9409('0x2c')](respondWithResult(_0x371af8,null))['catch'](handleError(_0x371af8,null));}});}catch(_0x36b2c3){_0x371af8[_0x9409('0x20')](0x1f4)[_0x9409('0x2f')](_0x36b2c3);}};function removeReferences(_0x1f1e04,_0x25e70e){try{if(_0x1f1e04){fs[_0x9409('0x99')](_0x1f1e04);logger[_0x9409('0x68')](_0x9409('0x9a'));}if(_0x25e70e){rimraf(_0x25e70e,function(){});logger[_0x9409('0x68')](_0x9409('0x9b'));}}catch(_0x4deb22){logger[_0x9409('0x55')](_0x4deb22);}}exports[_0x9409('0x9c')]=function(_0x1adf28,_0xcb18f7,_0x412192){return db[_0x9409('0x45')]['find']({'where':{'id':_0x1adf28[_0x9409('0x49')]['id']}})[_0x9409('0x2c')](handleEntityNotFound(_0xcb18f7,null))[_0x9409('0x2c')](saveUpdates(_0x1adf28[_0x9409('0x93')],null))[_0x9409('0x2c')](respondWithResult(_0xcb18f7,null))[_0x9409('0x47')](handleError(_0xcb18f7,null));};exports[_0x9409('0x9d')]=function(_0x2321df,_0x28157b,_0x3f5685){return db['Plugin']['find']({'where':{'id':_0x2321df['params']['id']}})['then'](function(_0x350f29){if(_0x350f29){return _0x350f29[_0x9409('0x2d')]();}})[_0x9409('0x2c')](function(_0x42f9ba){rimraf(path[_0x9409('0x4e')](config[_0x9409('0x9e')],'server/files/plugins',path[_0x9409('0x5c')](_0x42f9ba[_0x9409('0x8')])),function(){});return _0x42f9ba;})['then'](handleEntityNotFound(_0x28157b,null))[_0x9409('0x2c')](respondWithStatusCode(_0x28157b,null))[_0x9409('0x47')](handleError(_0x28157b,null));};exports[_0x9409('0x9f')]=function(_0x38c645,_0x3be5dc,_0x29cd1c){return BPromise['resolve']()[_0x9409('0x2c')](function(){if(!_0x38c645[_0x9409('0x37')][_0x9409('0x8')]){throw new Error(_0x9409('0xa0'));}if(!_0x38c645[_0x9409('0x37')][_0x9409('0xa1')]){throw new Error(_0x9409('0xa2'));}var _0x19ffdf=_0x38c645['query'][_0x9409('0xa3')]?_0x38c645[_0x9409('0x37')][_0x9409('0xa3')]+':'+_0x38c645[_0x9409('0x37')][_0x9409('0xa1')]:'http://localhost:'+_0x38c645[_0x9409('0x37')][_0x9409('0xa1')];var _0x14e8ae=_0x38c645[_0x9409('0x37')][_0x9409('0x22')]?_0x38c645[_0x9409('0x37')][_0x9409('0x22')]:!![];var _0x1b2df9=_0x38c645[_0x9409('0x37')]['encoding']?_0x38c645['query'][_0x9409('0xa4')]:null;var _0x55539d={'method':_0x38c645[_0x9409('0xa5')],'uri':util[_0x9409('0x62')](_0x9409('0xa6'),_0x19ffdf,_0x38c645['query'][_0x9409('0x8')]),'json':_0x14e8ae,'resolveWithFullResponse':!![],'encoding':_0x1b2df9,'qs':_0x38c645['query']};if(_0x38c645['headers']){_0x55539d['headers']=_0x38c645['headers'];if(_0x55539d[_0x9409('0xa7')][_0x9409('0xa8')]){delete _0x55539d[_0x9409('0xa7')][_0x9409('0xa8')];}}if(_0x55539d[_0x9409('0xa7')][_0x9409('0xa9')]){delete _0x55539d['headers'][_0x9409('0xa9')];}return rp(_0x55539d);})[_0x9409('0x2c')](function(_0x3cd135){if(_0x3cd135){_0x3be5dc[_0x9409('0x27')](_0x3cd135[_0x9409('0xa7')]);logger['info'](_0x3cd135[_0x9409('0x93')]);if(_[_0x9409('0xaa')](_0x38c645[_0x9409('0x37')][_0x9409('0x8')],_0x9409('0x4d'))&&_0x3cd135[_0x9409('0xab')]==0x1f4){return _0x3be5dc['sendStatus'](_0x3cd135['statusCode']);}else{return _0x3be5dc[_0x9409('0x20')](_0x3cd135[_0x9409('0xab')])[_0x9409('0x2f')](_0x3cd135[_0x9409('0x93')]);}}else{return _0x3be5dc[_0x9409('0x1f')](0xc8);}})[_0x9409('0x47')](handleError(_0x3be5dc,null));};exports[_0x9409('0xac')]=function(_0x49a315,_0x490f6b,_0x4a37cb){return BPromise[_0x9409('0xad')]()[_0x9409('0x2c')](function(){if(!_0x49a315[_0x9409('0x37')]['path']){throw new Error(_0x9409('0xa0'));}if(!_0x49a315[_0x9409('0x37')]['port']){throw new Error(_0x9409('0xa2'));}var _0xa0394e=_0x49a315[_0x9409('0x37')][_0x9409('0xa3')]?_0x49a315[_0x9409('0x37')][_0x9409('0xa3')]+':'+_0x49a315[_0x9409('0x37')][_0x9409('0xa1')]:_0x9409('0xae')+_0x49a315[_0x9409('0x37')][_0x9409('0xa1')];var _0x5e2994=_0x49a315[_0x9409('0x37')]['json']?_0x49a315[_0x9409('0x37')]['json']:!![];var _0x131b25=_0x49a315[_0x9409('0x37')][_0x9409('0xa4')]?_0x49a315[_0x9409('0x37')][_0x9409('0xa4')]:null;var _0x33f663={'method':_0x49a315[_0x9409('0xa5')],'uri':util['format']('%s%s',_0xa0394e,_0x49a315[_0x9409('0x37')][_0x9409('0x8')]),'json':_0x5e2994,'resolveWithFullResponse':!![],'encoding':_0x131b25,'body':_0x49a315[_0x9409('0x93')]};if(_0x49a315['headers']){_0x33f663[_0x9409('0xa7')]=_0x49a315['headers'];if(_0x33f663[_0x9409('0xa7')][_0x9409('0xa8')]){delete _0x33f663[_0x9409('0xa7')][_0x9409('0xa8')];}}if(_0x33f663['headers'][_0x9409('0xa9')]){delete _0x33f663[_0x9409('0xa7')][_0x9409('0xa9')];}return rp(_0x33f663);})[_0x9409('0x2c')](function(_0x57a8eb){if(_0x57a8eb){_0x490f6b[_0x9409('0x27')](_0x57a8eb[_0x9409('0xa7')]);logger['info'](_0x57a8eb[_0x9409('0x93')]);return _0x490f6b[_0x9409('0x20')](_0x57a8eb[_0x9409('0xab')])[_0x9409('0x2f')](_0x57a8eb[_0x9409('0x93')]);}else{return _0x490f6b[_0x9409('0x1f')](0xc8);}})[_0x9409('0x47')](handleError(_0x490f6b,null));}; \ No newline at end of file +var _0x43f2=['order','sort','where','filter','merge','type','options','Plugin','include','findAll','params','find','catch','download','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','join','server/files/plugins','node_modules/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x46340f,_0x154fdc){var _0x4b6d32=function(_0x1a8d28){while(--_0x1a8d28){_0x46340f['push'](_0x46340f['shift']());}};_0x4b6d32(++_0x154fdc);}(_0x43f2,0x10e));var _0x243f=function(_0x5a9c06,_0x9f9141){_0x5a9c06=_0x5a9c06-0x0;var _0x57a33f=_0x43f2[_0x5a9c06];return _0x57a33f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x243f('0x0'));var rp=require(_0x243f('0x1'));var moment=require(_0x243f('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x243f('0x3'));var path=require(_0x243f('0x4'));var sox=require(_0x243f('0x5'));var csv=require(_0x243f('0x6'));var ejs=require(_0x243f('0x7'));var fs=require('fs');var fs_extra=require(_0x243f('0x8'));var _=require(_0x243f('0x9'));var squel=require(_0x243f('0xa'));var crypto=require('crypto');var jsforce=require(_0x243f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x243f('0x6'));var querystring=require(_0x243f('0xc'));var Papa=require(_0x243f('0xd'));var extract=require('extract-zip');var rimraf=require(_0x243f('0xe'));var archiver=require(_0x243f('0xf'));var Redis=require(_0x243f('0x10'));var authService=require(_0x243f('0x11'));var qs=require(_0x243f('0x12'));var as=require(_0x243f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x243f('0x14'));var utils=require(_0x243f('0x15'));var config=require(_0x243f('0x16'));var licenseUtil=require(_0x243f('0x17'));var db=require(_0x243f('0x18'))['db'];config[_0x243f('0x19')]=_[_0x243f('0x1a')](config[_0x243f('0x19')],{'host':_0x243f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x243f('0x19')]));require('./plugin.socket')[_0x243f('0x1c')](socket);function respondWithStatusCode(_0x3cad9d,_0x5582dc){_0x5582dc=_0x5582dc||0xcc;return function(_0x45fa9c){if(_0x45fa9c){return _0x3cad9d['sendStatus'](_0x5582dc);}return _0x3cad9d['status'](_0x5582dc)[_0x243f('0x1d')]();};}function respondWithResult(_0x5e9951,_0x597240){_0x597240=_0x597240||0xc8;return function(_0x477010){if(_0x477010){return _0x5e9951[_0x243f('0x1e')](_0x597240)[_0x243f('0x1f')](_0x477010);}};}function respondWithFilteredResult(_0xb134f4,_0x323d3a){return function(_0x5e6567){if(_0x5e6567){var _0x43465a=typeof _0x323d3a[_0x243f('0x20')]===_0x243f('0x21')&&typeof _0x323d3a[_0x243f('0x22')]==='undefined';var _0x15f67d=_0x5e6567[_0x243f('0x23')];var _0x58230a=_0x43465a?0x0:_0x323d3a[_0x243f('0x20')];var _0x2fa3c=_0x43465a?_0x5e6567[_0x243f('0x23')]:_0x323d3a['offset']+_0x323d3a[_0x243f('0x22')];var _0x40b342;if(_0x2fa3c>=_0x15f67d){_0x2fa3c=_0x15f67d;_0x40b342=0xc8;}else{_0x40b342=0xce;}_0xb134f4['status'](_0x40b342);return _0xb134f4['set'](_0x243f('0x24'),_0x58230a+'-'+_0x2fa3c+'/'+_0x15f67d)[_0x243f('0x1f')](_0x5e6567);}return null;};}function patchUpdates(_0x80649b){return function(_0x3746a9){try{jsonpatch[_0x243f('0x25')](_0x3746a9,_0x80649b,!![]);}catch(_0x1f1e86){return BPromise[_0x243f('0x26')](_0x1f1e86);}return _0x3746a9[_0x243f('0x27')]();};}function saveUpdates(_0x3da920,_0xc5d3f0){return function(_0x25e547){if(_0x25e547){return _0x25e547[_0x243f('0x28')](_0x3da920)[_0x243f('0x29')](function(_0x594a2e){return _0x594a2e;});}return null;};}function removeEntity(_0x5d007a,_0x5c97f3){return function(_0x448c88){if(_0x448c88){return _0x448c88[_0x243f('0x2a')]()[_0x243f('0x29')](function(){var _0x56a51b=_0x448c88[_0x243f('0x2b')]({'plain':!![]});var _0x57bf67=_0x243f('0x2c');return db[_0x243f('0x2d')][_0x243f('0x2a')]({'where':{'type':_0x57bf67,'resourceId':_0x56a51b['id']}})['then'](function(){return _0x448c88;});})[_0x243f('0x29')](function(){_0x5d007a['status'](0xcc)[_0x243f('0x1d')]();});}};}function handleEntityNotFound(_0x2a0d0d,_0x3fcba4){return function(_0x4837f2){if(!_0x4837f2){_0x2a0d0d[_0x243f('0x2e')](0x194);}return _0x4837f2;};}function handleError(_0x5244c4,_0x3a707a){_0x3a707a=_0x3a707a||0x1f4;return function(_0x500573){logger[_0x243f('0x2f')](_0x500573[_0x243f('0x30')]);if(_0x500573[_0x243f('0x31')]){delete _0x500573['name'];}_0x5244c4[_0x243f('0x1e')](_0x3a707a)[_0x243f('0x32')](_0x500573);};}exports[_0x243f('0x33')]=function(_0x40467f,_0x55c204){var _0x43140f={},_0x230762={},_0x2f0444={'count':0x0,'rows':[]};var _0x532e28=_[_0x243f('0x34')](db['Plugin'][_0x243f('0x35')],function(_0x2163d8){return{'name':_0x2163d8['fieldName'],'type':_0x2163d8['type']['key']};});_0x230762['model']=_[_0x243f('0x34')](_0x532e28,_0x243f('0x31'));_0x230762['query']=_[_0x243f('0x36')](_0x40467f[_0x243f('0x37')]);_0x230762[_0x243f('0x38')]=_[_0x243f('0x39')](_0x230762[_0x243f('0x3a')],_0x230762[_0x243f('0x37')]);_0x43140f[_0x243f('0x3b')]=_[_0x243f('0x39')](_0x230762['model'],qs[_0x243f('0x3c')](_0x40467f[_0x243f('0x37')][_0x243f('0x3c')]));_0x43140f[_0x243f('0x3b')]=_0x43140f['attributes'][_0x243f('0x3d')]?_0x43140f[_0x243f('0x3b')]:_0x230762[_0x243f('0x3a')];if(!_0x40467f['query'][_0x243f('0x3e')](_0x243f('0x3f'))){_0x43140f['limit']=qs['limit'](_0x40467f[_0x243f('0x37')][_0x243f('0x22')]);_0x43140f[_0x243f('0x20')]=qs[_0x243f('0x20')](_0x40467f[_0x243f('0x37')][_0x243f('0x20')]);}_0x43140f[_0x243f('0x40')]=qs['sort'](_0x40467f[_0x243f('0x37')][_0x243f('0x41')]);_0x43140f[_0x243f('0x42')]=qs[_0x243f('0x38')](_['pick'](_0x40467f[_0x243f('0x37')],_0x230762[_0x243f('0x38')]),_0x532e28);if(_0x40467f[_0x243f('0x37')][_0x243f('0x43')]){_0x43140f['where']=_[_0x243f('0x44')](_0x43140f[_0x243f('0x42')],{'$or':_[_0x243f('0x34')](_0x532e28,function(_0x1abf37){if(_0x1abf37[_0x243f('0x45')]!=='VIRTUAL'){var _0x50b342={};_0x50b342[_0x1abf37[_0x243f('0x31')]]={'$like':'%'+_0x40467f[_0x243f('0x37')][_0x243f('0x43')]+'%'};return _0x50b342;}})});}_0x43140f=_[_0x243f('0x44')]({},_0x43140f,_0x40467f[_0x243f('0x46')]);var _0x1ef838={'where':_0x43140f['where']};return db[_0x243f('0x47')][_0x243f('0x23')](_0x1ef838)['then'](function(_0x1fbf04){_0x2f0444[_0x243f('0x23')]=_0x1fbf04;if(_0x40467f[_0x243f('0x37')]['includeAll']){_0x43140f[_0x243f('0x48')]=[{'all':!![]}];}return db['Plugin'][_0x243f('0x49')](_0x43140f);})['then'](function(_0xbd446d){_0x2f0444['rows']=_0xbd446d;return _0x2f0444;})[_0x243f('0x29')](respondWithFilteredResult(_0x55c204,_0x43140f))['catch'](handleError(_0x55c204,null));};exports['show']=function(_0x57697c,_0x4199ba){var _0x4b543c={'raw':!![],'where':{'id':_0x57697c[_0x243f('0x4a')]['id']}},_0x20918d={};_0x20918d[_0x243f('0x3a')]=_[_0x243f('0x36')](db[_0x243f('0x47')][_0x243f('0x35')]);_0x20918d['query']=_['keys'](_0x57697c[_0x243f('0x37')]);_0x20918d['filters']=_[_0x243f('0x39')](_0x20918d[_0x243f('0x3a')],_0x20918d[_0x243f('0x37')]);_0x4b543c[_0x243f('0x3b')]=_[_0x243f('0x39')](_0x20918d[_0x243f('0x3a')],qs[_0x243f('0x3c')](_0x57697c[_0x243f('0x37')][_0x243f('0x3c')]));_0x4b543c[_0x243f('0x3b')]=_0x4b543c[_0x243f('0x3b')][_0x243f('0x3d')]?_0x4b543c[_0x243f('0x3b')]:_0x20918d[_0x243f('0x3a')];if(_0x57697c[_0x243f('0x37')]['includeAll']){_0x4b543c[_0x243f('0x48')]=[{'all':!![]}];}_0x4b543c=_[_0x243f('0x44')]({},_0x4b543c,_0x57697c[_0x243f('0x46')]);return db[_0x243f('0x47')][_0x243f('0x4b')](_0x4b543c)[_0x243f('0x29')](handleEntityNotFound(_0x4199ba,null))[_0x243f('0x29')](respondWithResult(_0x4199ba,null))[_0x243f('0x4c')](handleError(_0x4199ba,null));};exports[_0x243f('0x4d')]=function(_0x4ffe70,_0x8b1335,_0x272ac1){return db[_0x243f('0x47')][_0x243f('0x4b')]({'where':{'id':_0x4ffe70[_0x243f('0x4a')]['id']},'attributes':[_0x243f('0x31'),_0x243f('0x4')],'raw':!![]})['then'](handleEntityNotFound(_0x8b1335,null))[_0x243f('0x29')](function(_0x622193){if(_0x622193){var _0x5bf101=path['join'](config[_0x243f('0x4e')],'server/files/plugins',util[_0x243f('0x4f')](_0x243f('0x50'),path[_0x243f('0x51')](_0x622193[_0x243f('0x4')])));var _0x27169b=fs[_0x243f('0x52')](_0x5bf101);var _0x12e014=archiver(_0x243f('0x53'),{'zlib':{'level':0x9}});_0x12e014['on'](_0x243f('0x54'),function(_0x588429){if(_0x588429[_0x243f('0x55')]===_0x243f('0x56')){logger['error'](_0x588429);}else{throw new db['Sequelize'][(_0x243f('0x57'))](_0x243f('0x58'));}});_0x12e014['on'](_0x243f('0x2f'),function(_0x13dc8e){throw new db[(_0x243f('0x59'))][(_0x243f('0x57'))](_0x243f('0x58'));});_0x12e014[_0x243f('0x5a')](_0x27169b);_0x12e014[_0x243f('0x5b')](_0x243f('0x5c'),{'cwd':path[_0x243f('0x5d')](config[_0x243f('0x4e')],_0x243f('0x5e'),path['dirname'](_0x622193[_0x243f('0x4')])),'ignore':[path[_0x243f('0x5d')](path[_0x243f('0x51')](_0x622193[_0x243f('0x4')]),_0x243f('0x5f')),path[_0x243f('0x5d')](path[_0x243f('0x51')](_0x622193[_0x243f('0x4')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x27169b['on'](_0x243f('0x60'),function(){if(!fs[_0x243f('0x61')](_0x5bf101)){throw new db[(_0x243f('0x59'))]['Error']('Plugin\x20not\x20found');}return _0x8b1335['download'](_0x5bf101,util[_0x243f('0x4f')]('%s.zip',path[_0x243f('0x51')](_0x622193['path'])),function(_0x4f395c){if(_0x4f395c){throw new db[(_0x243f('0x59'))][(_0x243f('0x57'))](_0x243f('0x62'));}fs[_0x243f('0x63')](_0x5bf101);logger[_0x243f('0x64')](_0x243f('0x65'));logger[_0x243f('0x64')](_0x243f('0x66'));});});}return null;})[_0x243f('0x4c')](handleError(_0x8b1335,null));};exports[_0x243f('0x67')]=function(_0x442b56,_0x2a358c,_0xe70e29){var _0x590b48=path[_0x243f('0x51')](_0x442b56[_0x243f('0x68')][_0x243f('0x69')],path[_0x243f('0x6a')](_0x442b56[_0x243f('0x68')]['filename']));var _0x461da3=path[_0x243f('0x5d')](config[_0x243f('0x4e')],_0x243f('0x5e'),_0x442b56[_0x243f('0x68')][_0x243f('0x69')]);var _0x3a5f5d=path[_0x243f('0x5d')](config[_0x243f('0x4e')],_0x243f('0x5e'),_0x590b48);logger[_0x243f('0x64')](_0x243f('0x6b'),_0x461da3);logger[_0x243f('0x64')](_0x243f('0x6c'),_0x3a5f5d);try{fs[_0x243f('0x6d')](_0x461da3,parseInt('0777',0x8));extract(_0x461da3,{'dir':_0x3a5f5d},function(_0x5046cb){if(_0x5046cb){logger['error'](_0x5046cb);handleError(_0x5046cb,!![]);};var _0x5f5d5d=fs[_0x243f('0x6e')](_0x3a5f5d);if(_0x5f5d5d[_0x243f('0x3d')]>0x1){removeReferences(_0x461da3,_0x3a5f5d);logger[_0x243f('0x2f')](_0x243f('0x6f'));return _0xe70e29(new Error(_0x243f('0x6f')));}var _0x54bec0=fs[_0x243f('0x70')](path['join'](_0x3a5f5d,_0x5f5d5d[0x0]));if(_0x54bec0['isFile']()){removeReferences(_0x461da3,_0x3a5f5d);logger[_0x243f('0x2f')](_0x243f('0x6f'));return _0xe70e29(new Error('Invalid\x20plugin\x20structure'));}if(_0x54bec0[_0x243f('0x71')]()){var _0x14e3cc=fs[_0x243f('0x6e')](path[_0x243f('0x5d')](_0x3a5f5d,_0x5f5d5d[0x0]));if(_0x14e3cc[_0x243f('0x3d')]===0x0){removeReferences(_0x461da3,_0x3a5f5d);logger[_0x243f('0x2f')](_0x243f('0x6f'));return _0xe70e29(new Error('Invalid\x20plugin\x20structure'));}var _0x544f3f=_0x14e3cc[_0x243f('0x72')](function(_0x152fea){return _0x152fea===_0x243f('0x73');});if(!_0x544f3f){return _0xe70e29(new Error('Plugin\x20manifest\x20missing'));}var _0x421814=fs['readFileSync'](path[_0x243f('0x5d')](_0x3a5f5d,_0x5f5d5d[0x0],_0x243f('0x73')));var _0x54c8ca=JSON[_0x243f('0x74')](_0x421814);if('undefined'==typeof _0x54c8ca[_0x243f('0x31')]){return _0xe70e29(new Error(_0x243f('0x75')));}if(_0x243f('0x21')==typeof _0x54c8ca[_0x243f('0x45')]){return _0xe70e29(new Error(_0x243f('0x76')));}if(_0x243f('0x21')==typeof _0x54c8ca[_0x243f('0x77')]){return _0xe70e29(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x54c8ca['parameters']){return _0xe70e29(new Error(_0x243f('0x78')));}if(_0x54c8ca['type']===_0x243f('0x79')){if(_0x243f('0x21')==typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')]){return _0xe70e29(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')]['admin']&&_0x243f('0x21')==typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')][_0x243f('0x7c')]){return _0xe70e29(new Error(_0x243f('0x7d')));}}else if(_0x54c8ca['type']===_0x243f('0x7e')){if('undefined'==typeof _0x54c8ca[_0x243f('0x7a')]['scriptName']){return _0xe70e29(new Error(_0x243f('0x7f')));}if(_0x243f('0x21')==typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x80')]){return _0xe70e29(new Error(_0x243f('0x81')));}}else{return _0xe70e29(new Error(_0x243f('0x82')));}var _0x489251=_0x54c8ca[_0x243f('0x31')];var _0x5e8d40=_0x54c8ca[_0x243f('0x83')];var _0x4ed6cb=_0x54c8ca['type'];var _0x2849a3=_0x54c8ca['sidebar']?_0x54c8ca[_0x243f('0x84')]:_0x243f('0x85');var _0x2e1905=_0x54c8ca[_0x243f('0x86')]?_0x54c8ca['icon']:'icon-apps';var _0x495f30='';var _0x289d3b='';var _0x56034b='';var _0x13ccc8='';var _0x4361fb=_0x54c8ca[_0x243f('0x77')];if(_0x4ed6cb===_0x243f('0x79')){if(_0x243f('0x21')!=typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')]['admin']){var _0x418f5d=_0x54c8ca['parameters']['views'][_0x243f('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x243f('0x88')](_0x418f5d)){_0x495f30=path[_0x243f('0x5d')](_0x243f('0x89'),_0x590b48,_0x5f5d5d[0x0],_0x418f5d);}else{_0x495f30=_0x418f5d;}}else{logger[_0x243f('0x64')](_0x243f('0x8a'));}if('undefined'!=typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')][_0x243f('0x7c')]){var _0x54839e=_0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')][_0x243f('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x243f('0x88')](_0x54839e)){_0x289d3b=path['join'](_0x243f('0x89'),_0x590b48,_0x5f5d5d[0x0],_0x54839e);}else{_0x289d3b=_0x54839e;}}else{logger[_0x243f('0x64')](_0x243f('0x8b'));}}else if(_0x4ed6cb==='script'){_0x56034b=_0x54c8ca[_0x243f('0x7a')][_0x243f('0x8c')];_0x13ccc8=_0x54c8ca[_0x243f('0x7a')][_0x243f('0x80')];if(_0x243f('0x21')!=typeof _0x54c8ca[_0x243f('0x7a')]['views']){if('undefined'!=typeof _0x54c8ca[_0x243f('0x7a')][_0x243f('0x7b')][_0x243f('0x87')]){var _0x418f5d=_0x54c8ca['parameters']['views'][_0x243f('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x243f('0x88')](_0x418f5d)){_0x495f30=path[_0x243f('0x5d')](_0x243f('0x89'),_0x590b48,_0x5f5d5d[0x0],_0x418f5d);}else{_0x495f30=_0x418f5d;}}if('undefined'!=typeof _0x54c8ca['parameters']['views'][_0x243f('0x7c')]){var _0x54839e=_0x54c8ca[_0x243f('0x7a')]['views'][_0x243f('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x243f('0x88')](_0x54839e)){_0x289d3b=path[_0x243f('0x5d')](_0x243f('0x89'),_0x590b48,_0x5f5d5d[0x0],_0x54839e);}else{_0x289d3b=_0x54839e;}}}}var _0x170ca8={'name':_0x489251,'description':_0x5e8d40,'path':path['join'](_0x590b48,_0x5f5d5d[0x0]),'type':_0x4ed6cb,'sidebar':_0x2849a3,'icon':_0x2e1905,'adminUrl':_0x495f30,'agentUrl':_0x289d3b,'scriptName':_0x56034b,'scriptPath':_0x13ccc8,'version':_0x4361fb};removeReferences(_0x461da3,null);return db['Plugin'][_0x243f('0x8d')](_0x170ca8)[_0x243f('0x29')](function(_0x5ce71b){var _0x406bfa={'role':_0x442b56[_0x243f('0x8e')][_0x243f('0x8f')],'userProfileId':_0x442b56[_0x243f('0x8e')][_0x243f('0x90')]};if(!_0x406bfa)throw new Error(_0x243f('0x91'));if(_0x406bfa[_0x243f('0x8f')]===_0x243f('0x92')){var _0x3c6103=_0x5ce71b[_0x243f('0x2b')]({'plain':!![]});return db[_0x243f('0x93')][_0x243f('0x4b')]({'where':{'name':_0x243f('0x2c'),'userProfileId':_0x406bfa[_0x243f('0x90')]},'raw':!![]})[_0x243f('0x29')](function(_0x4e2fca){if(_0x4e2fca&&_0x4e2fca['autoAssociation']===0x0){return db[_0x243f('0x2d')][_0x243f('0x8d')]({'name':_0x3c6103[_0x243f('0x31')],'resourceId':_0x3c6103['id'],'type':_0x4e2fca[_0x243f('0x31')],'sectionId':_0x4e2fca['id']},{})['then'](function(){return _0x5ce71b;});}else{return _0x5ce71b;}})['catch'](function(_0x2f1766){logger[_0x243f('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f1766);throw _0x2f1766;});}return _0x5ce71b;})[_0x243f('0x29')](respondWithResult(_0x2a358c,null))['catch'](handleError(_0x2a358c,null));}});}catch(_0x3a4203){_0x2a358c[_0x243f('0x1e')](0x1f4)[_0x243f('0x32')](_0x3a4203);}};function removeReferences(_0x2df9c7,_0x19cf03){try{if(_0x2df9c7){fs[_0x243f('0x63')](_0x2df9c7);logger[_0x243f('0x64')]('Zip\x20archive\x20removed');}if(_0x19cf03){rimraf(_0x19cf03,function(){});logger[_0x243f('0x64')](_0x243f('0x94'));}}catch(_0x116f7e){logger['error'](_0x116f7e);}}exports[_0x243f('0x28')]=function(_0x574c93,_0x96db42,_0x3afa70){return db[_0x243f('0x47')]['find']({'where':{'id':_0x574c93['params']['id']}})[_0x243f('0x29')](handleEntityNotFound(_0x96db42,null))[_0x243f('0x29')](saveUpdates(_0x574c93[_0x243f('0x8e')],null))[_0x243f('0x29')](respondWithResult(_0x96db42,null))[_0x243f('0x4c')](handleError(_0x96db42,null));};exports[_0x243f('0x95')]=function(_0x591b84,_0xd8fc8c,_0x43689b){return db[_0x243f('0x47')][_0x243f('0x4b')]({'where':{'id':_0x591b84[_0x243f('0x4a')]['id']}})[_0x243f('0x29')](function(_0x55ca9d){if(_0x55ca9d){return _0x55ca9d[_0x243f('0x2a')]();}})[_0x243f('0x29')](function(_0xc62adb){rimraf(path['join'](config[_0x243f('0x4e')],'server/files/plugins',path['dirname'](_0xc62adb[_0x243f('0x4')])),function(){});return _0xc62adb;})[_0x243f('0x29')](handleEntityNotFound(_0xd8fc8c,null))[_0x243f('0x29')](respondWithStatusCode(_0xd8fc8c,null))[_0x243f('0x4c')](handleError(_0xd8fc8c,null));};exports[_0x243f('0x96')]=function(_0x2e3a1b,_0x10ebde,_0x322440){return BPromise[_0x243f('0x97')]()[_0x243f('0x29')](function(){if(!_0x2e3a1b[_0x243f('0x37')]['path']){throw new Error(_0x243f('0x98'));}if(!_0x2e3a1b['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3600fd=_0x2e3a1b[_0x243f('0x37')][_0x243f('0x99')]?_0x2e3a1b[_0x243f('0x37')][_0x243f('0x99')]+':'+_0x2e3a1b[_0x243f('0x37')][_0x243f('0x9a')]:_0x243f('0x9b')+_0x2e3a1b['query']['port'];var _0x34a017=_0x2e3a1b['query'][_0x243f('0x1f')]?_0x2e3a1b[_0x243f('0x37')][_0x243f('0x1f')]:!![];var _0x1f710a=_0x2e3a1b[_0x243f('0x37')][_0x243f('0x9c')]?_0x2e3a1b[_0x243f('0x37')][_0x243f('0x9c')]:null;var _0x4a65d0={'method':_0x2e3a1b[_0x243f('0x9d')],'uri':util['format'](_0x243f('0x9e'),_0x3600fd,_0x2e3a1b[_0x243f('0x37')][_0x243f('0x4')]),'json':_0x34a017,'resolveWithFullResponse':!![],'encoding':_0x1f710a,'qs':_0x2e3a1b[_0x243f('0x37')]};if(_0x2e3a1b[_0x243f('0x9f')]){_0x4a65d0[_0x243f('0x9f')]=_0x2e3a1b[_0x243f('0x9f')];if(_0x4a65d0[_0x243f('0x9f')][_0x243f('0xa0')]){delete _0x4a65d0[_0x243f('0x9f')]['content-length'];}}if(_0x4a65d0[_0x243f('0x9f')][_0x243f('0xa1')]){delete _0x4a65d0[_0x243f('0x9f')][_0x243f('0xa1')];}return rp(_0x4a65d0);})[_0x243f('0x29')](function(_0x52e105){if(_0x52e105){_0x10ebde[_0x243f('0xa2')](_0x52e105[_0x243f('0x9f')]);logger[_0x243f('0x64')](_0x52e105[_0x243f('0x8e')]);if(_[_0x243f('0xa3')](_0x2e3a1b[_0x243f('0x37')][_0x243f('0x4')],_0x243f('0x4d'))&&_0x52e105[_0x243f('0xa4')]==0x1f4){return _0x10ebde[_0x243f('0x2e')](_0x52e105[_0x243f('0xa4')]);}else{return _0x10ebde[_0x243f('0x1e')](_0x52e105[_0x243f('0xa4')])[_0x243f('0x32')](_0x52e105[_0x243f('0x8e')]);}}else{return _0x10ebde[_0x243f('0x2e')](0xc8);}})['catch'](handleError(_0x10ebde,null));};exports[_0x243f('0xa5')]=function(_0x5cdf88,_0x3f1ada,_0x2f83b1){return BPromise[_0x243f('0x97')]()[_0x243f('0x29')](function(){if(!_0x5cdf88['query'][_0x243f('0x4')]){throw new Error(_0x243f('0x98'));}if(!_0x5cdf88[_0x243f('0x37')][_0x243f('0x9a')]){throw new Error(_0x243f('0xa6'));}var _0x320cbd=_0x5cdf88[_0x243f('0x37')][_0x243f('0x99')]?_0x5cdf88[_0x243f('0x37')][_0x243f('0x99')]+':'+_0x5cdf88['query'][_0x243f('0x9a')]:_0x243f('0x9b')+_0x5cdf88[_0x243f('0x37')][_0x243f('0x9a')];var _0x503c00=_0x5cdf88[_0x243f('0x37')][_0x243f('0x1f')]?_0x5cdf88[_0x243f('0x37')][_0x243f('0x1f')]:!![];var _0x227126=_0x5cdf88[_0x243f('0x37')][_0x243f('0x9c')]?_0x5cdf88['query'][_0x243f('0x9c')]:null;var _0x4fd34e={'method':_0x5cdf88['method'],'uri':util['format'](_0x243f('0x9e'),_0x320cbd,_0x5cdf88[_0x243f('0x37')][_0x243f('0x4')]),'json':_0x503c00,'resolveWithFullResponse':!![],'encoding':_0x227126,'body':_0x5cdf88[_0x243f('0x8e')]};if(_0x5cdf88['headers']){_0x4fd34e[_0x243f('0x9f')]=_0x5cdf88['headers'];if(_0x4fd34e['headers'][_0x243f('0xa0')]){delete _0x4fd34e['headers']['content-length'];}}if(_0x4fd34e[_0x243f('0x9f')][_0x243f('0xa1')]){delete _0x4fd34e[_0x243f('0x9f')][_0x243f('0xa1')];}return rp(_0x4fd34e);})['then'](function(_0x4d92d8){if(_0x4d92d8){_0x3f1ada[_0x243f('0xa2')](_0x4d92d8[_0x243f('0x9f')]);logger[_0x243f('0x64')](_0x4d92d8[_0x243f('0x8e')]);return _0x3f1ada['status'](_0x4d92d8['statusCode'])['send'](_0x4d92d8[_0x243f('0x8e')]);}else{return _0x3f1ada['sendStatus'](0xc8);}})[_0x243f('0x4c')](handleError(_0x3f1ada,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b448762..18d246d 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 _0xa4dc=['save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x1c665f,_0x267b7a){var _0x56d198=function(_0xbdcb6d){while(--_0xbdcb6d){_0x1c665f['push'](_0x1c665f['shift']());}};_0x56d198(++_0x267b7a);}(_0xa4dc,0x16a));var _0xca4d=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xa4dc[_0x4b7895];return _0x264180;};'use strict';var EventEmitter=require(_0xca4d('0x0'));var Plugin=require(_0xca4d('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xca4d('0x2'),'afterUpdate':_0xca4d('0x3'),'afterDestroy':_0xca4d('0x4')};function emitEvent(_0x286a57){return function(_0x22d0cf,_0x504f4a,_0x132d29){PluginEvents[_0xca4d('0x5')](_0x286a57+':'+_0x22d0cf['id'],_0x22d0cf);PluginEvents[_0xca4d('0x5')](_0x286a57,_0x22d0cf);_0x132d29(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xca4d('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xf69d=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xf69d,0xd3));var _0xdf69=function(_0x4c9dc6,_0x2e350e){_0x4c9dc6=_0x4c9dc6-0x0;var _0x37efa1=_0xf69d[_0x4c9dc6];return _0x37efa1;};'use strict';var EventEmitter=require(_0xdf69('0x0'));var Plugin=require(_0xdf69('0x1'))['db'][_0xdf69('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xdf69('0x3')](0x0);var events={'afterCreate':_0xdf69('0x4'),'afterUpdate':'update','afterDestroy':_0xdf69('0x5')};function emitEvent(_0x342114){return function(_0x5b5eec,_0x13ecb6,_0x177ff7){PluginEvents[_0xdf69('0x6')](_0x342114+':'+_0x5b5eec['id'],_0x5b5eec);PluginEvents[_0xdf69('0x6')](_0x342114,_0x5b5eec);_0x177ff7(null);};}for(var e in events){if(events[_0xdf69('0x7')](e)){var event=events[e];Plugin[_0xdf69('0x8')](e,emitEvent(event));}}module[_0xdf69('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 5ce68d7..f3dd184 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 _0x112a=['rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger','api','bluebird'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x112a,0x1a8));var _0xa112=function(_0xa36d6,_0x1e3306){_0xa36d6=_0xa36d6-0x0;var _0x4b7ea0=_0x112a[_0xa36d6];return _0x4b7ea0;};'use strict';var _=require(_0xa112('0x0'));var util=require(_0xa112('0x1'));var logger=require(_0xa112('0x2'))(_0xa112('0x3'));var moment=require('moment');var BPromise=require(_0xa112('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa112('0x5'));var config=require(_0xa112('0x6'));var attributes=require(_0xa112('0x7'));module['exports']=function(_0x4fe48f,_0x38fefc){return _0x4fe48f[_0xa112('0x8')](_0xa112('0x9'),attributes,{'tableName':_0xa112('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8440=['path','rimraf','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','moment','request-promise'];(function(_0x21e7ea,_0x2e2b6f){var _0x314225=function(_0x56dba1){while(--_0x56dba1){_0x21e7ea['push'](_0x21e7ea['shift']());}};_0x314225(++_0x2e2b6f);}(_0x8440,0x187));var _0x0844=function(_0x17e53a,_0x39c228){_0x17e53a=_0x17e53a-0x0;var _0x3565da=_0x8440[_0x17e53a];return _0x3565da;};'use strict';var _=require(_0x0844('0x0'));var util=require(_0x0844('0x1'));var logger=require(_0x0844('0x2'))('api');var moment=require(_0x0844('0x3'));var BPromise=require('bluebird');var rp=require(_0x0844('0x4'));var fs=require('fs');var path=require(_0x0844('0x5'));var rimraf=require(_0x0844('0x6'));var config=require(_0x0844('0x7'));var attributes=require('./plugin.attributes');module[_0x0844('0x8')]=function(_0x28659f,_0x29c5fc){return _0x28659f[_0x0844('0x9')](_0x0844('0xa'),attributes,{'tableName':_0x0844('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 0b2c4e4..9d77ea8 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 _0xfbaf=['create','body','options','raw','then','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','result','CreatePlugin'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfbaf,0x17c));var _0xffba=function(_0x5739c9,_0x83a4ae){_0x5739c9=_0x5739c9-0x0;var _0x6c57cc=_0xfbaf[_0x5739c9];return _0x6c57cc;};'use strict';var _=require('lodash');var util=require(_0xffba('0x0'));var moment=require(_0xffba('0x1'));var BPromise=require('bluebird');var rs=require(_0xffba('0x2'));var fs=require('fs');var Redis=require(_0xffba('0x3'));var db=require(_0xffba('0x4'))['db'];var utils=require(_0xffba('0x5'));var logger=require('../../config/logger')(_0xffba('0x6'));var config=require(_0xffba('0x7'));var jayson=require(_0xffba('0x8'));var client=jayson[_0xffba('0x9')][_0xffba('0xa')]({'port':0x232a});config[_0xffba('0xb')]=_[_0xffba('0xc')](config[_0xffba('0xb')],{'host':_0xffba('0xd'),'port':0x18eb});var socket=require(_0xffba('0xe'))(new Redis(config[_0xffba('0xb')]));require(_0xffba('0xf'))[_0xffba('0x10')](socket);function respondWithRpcPromise(_0x16c8e5,_0x577051,_0x4e6d3a){return new BPromise(function(_0xa1a4a1,_0x32d6ff){return client[_0xffba('0x11')](_0x16c8e5,_0x4e6d3a)['then'](function(_0x48a944){logger[_0xffba('0x12')]('Plugin,\x20%s,\x20%s',_0x577051,_0xffba('0x13'));logger[_0xffba('0x14')](_0xffba('0x15'),_0x577051,_0xffba('0x13'),JSON[_0xffba('0x16')](_0x48a944));if(_0x48a944[_0xffba('0x17')]){if(_0x48a944['error']['code']===0x1f4){logger[_0xffba('0x17')](_0xffba('0x18'),_0x577051,_0x48a944[_0xffba('0x17')][_0xffba('0x19')]);return _0x32d6ff(_0x48a944[_0xffba('0x17')][_0xffba('0x19')]);}logger['error'](_0xffba('0x18'),_0x577051,_0x48a944['error'][_0xffba('0x19')]);return _0xa1a4a1(_0x48a944[_0xffba('0x17')][_0xffba('0x19')]);}else{logger[_0xffba('0x12')](_0xffba('0x18'),_0x577051,_0xffba('0x13'));_0xa1a4a1(_0x48a944[_0xffba('0x1a')][_0xffba('0x19')]);}})['catch'](function(_0x2a27b1){logger[_0xffba('0x17')](_0xffba('0x18'),_0x577051,_0x2a27b1);_0x32d6ff(_0x2a27b1);});});}exports[_0xffba('0x1b')]=function(_0x337598){var _0x1750b0=this;return new Promise(function(_0x529cbc,_0x3187e2){return db['Plugin'][_0xffba('0x1c')](_0x337598[_0xffba('0x1d')],{'raw':_0x337598[_0xffba('0x1e')]?_0x337598[_0xffba('0x1e')][_0xffba('0x1f')]===undefined?!![]:![]:!![]})[_0xffba('0x20')](function(_0x29ca47){logger[_0xffba('0x12')](_0xffba('0x1b'),_0x337598);logger[_0xffba('0x14')](_0xffba('0x1b'),_0x337598,JSON['stringify'](_0x29ca47));_0x529cbc(_0x29ca47);})[_0xffba('0x21')](function(_0x8cb740){logger[_0xffba('0x17')](_0xffba('0x1b'),_0x8cb740[_0xffba('0x19')],_0x337598);_0x3187e2(_0x1750b0['error'](0x1f4,_0x8cb740[_0xffba('0x19')]));});});}; \ No newline at end of file +var _0x57e4=['redis','defaults','localhost','socket.io-emitter','then','debug','request\x20sent','stringify','error','code','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','Plugin','create','body','options','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x57e4,0x1e5));var _0x457e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x57e4[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x457e('0x0'));var util=require('util');var moment=require(_0x457e('0x1'));var BPromise=require(_0x457e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x457e('0x3'));var db=require(_0x457e('0x4'))['db'];var utils=require(_0x457e('0x5'));var logger=require('../../config/logger')(_0x457e('0x6'));var config=require(_0x457e('0x7'));var jayson=require(_0x457e('0x8'));var client=jayson[_0x457e('0x9')][_0x457e('0xa')]({'port':0x232a});config[_0x457e('0xb')]=_[_0x457e('0xc')](config[_0x457e('0xb')],{'host':_0x457e('0xd'),'port':0x18eb});var socket=require(_0x457e('0xe'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0xdc95c4,_0x101425,_0xd08dbe){return new BPromise(function(_0x54fe0f,_0x33f158){return client['request'](_0xdc95c4,_0xd08dbe)[_0x457e('0xf')](function(_0x4388d5){logger['info']('Plugin,\x20%s,\x20%s',_0x101425,'request\x20sent');logger[_0x457e('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x101425,_0x457e('0x11'),JSON[_0x457e('0x12')](_0x4388d5));if(_0x4388d5[_0x457e('0x13')]){if(_0x4388d5[_0x457e('0x13')][_0x457e('0x14')]===0x1f4){logger[_0x457e('0x13')](_0x457e('0x15'),_0x101425,_0x4388d5[_0x457e('0x13')]['message']);return _0x33f158(_0x4388d5[_0x457e('0x13')][_0x457e('0x16')]);}logger[_0x457e('0x13')]('Plugin,\x20%s,\x20%s',_0x101425,_0x4388d5['error'][_0x457e('0x16')]);return _0x54fe0f(_0x4388d5['error'][_0x457e('0x16')]);}else{logger[_0x457e('0x17')](_0x457e('0x15'),_0x101425,_0x457e('0x11'));_0x54fe0f(_0x4388d5[_0x457e('0x18')][_0x457e('0x16')]);}})[_0x457e('0x19')](function(_0x2bd03c){logger[_0x457e('0x13')](_0x457e('0x15'),_0x101425,_0x2bd03c);_0x33f158(_0x2bd03c);});});}exports[_0x457e('0x1a')]=function(_0x2bc89f){var _0x596ec1=this;return new Promise(function(_0x3a844e,_0x591ab8){return db[_0x457e('0x1b')][_0x457e('0x1c')](_0x2bc89f[_0x457e('0x1d')],{'raw':_0x2bc89f[_0x457e('0x1e')]?_0x2bc89f[_0x457e('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x457e('0xf')](function(_0xbabd0){logger[_0x457e('0x17')](_0x457e('0x1a'),_0x2bc89f);logger[_0x457e('0x10')](_0x457e('0x1a'),_0x2bc89f,JSON['stringify'](_0xbabd0));_0x3a844e(_0xbabd0);})['catch'](function(_0x55360e){logger[_0x457e('0x13')](_0x457e('0x1a'),_0x55360e[_0x457e('0x16')],_0x2bc89f);_0x591ab8(_0x596ec1[_0x457e('0x13')](0x1f4,_0x55360e[_0x457e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 16f7a08..235b854 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 _0x23d1=['length','plugin:','./plugin.events','save','update','removeListener','register'];(function(_0x1c86c3,_0x216472){var _0x27a72b=function(_0x1722d6){while(--_0x1722d6){_0x1c86c3['push'](_0x1c86c3['shift']());}};_0x27a72b(++_0x216472);}(_0x23d1,0x95));var _0x123d=function(_0x172855,_0x5d1557){_0x172855=_0x172855-0x0;var _0x1145b7=_0x23d1[_0x172855];return _0x1145b7;};'use strict';var PluginEvents=require(_0x123d('0x0'));var events=[_0x123d('0x1'),'remove',_0x123d('0x2')];function createListener(_0x3f97fa,_0x4f7c7c){return function(_0x1518d0){_0x4f7c7c['emit'](_0x3f97fa,_0x1518d0);};}function removeListener(_0xb17a9c,_0x260a5b){return function(){PluginEvents[_0x123d('0x3')](_0xb17a9c,_0x260a5b);};}exports[_0x123d('0x4')]=function(_0x690b0f){for(var _0x29a7e2=0x0,_0x17db17=events[_0x123d('0x5')];_0x29a7e2<_0x17db17;_0x29a7e2++){var _0x414b7c=events[_0x29a7e2];var _0x788a62=createListener(_0x123d('0x6')+_0x414b7c,_0x690b0f);PluginEvents['on'](_0x414b7c,_0x788a62);}}; \ No newline at end of file +var _0x2b82=['save','remove','emit','removeListener','register','length','plugin:','./plugin.events'];(function(_0x3d34ae,_0x12498b){var _0x4de56f=function(_0x5f0da1){while(--_0x5f0da1){_0x3d34ae['push'](_0x3d34ae['shift']());}};_0x4de56f(++_0x12498b);}(_0x2b82,0x1af));var _0x22b8=function(_0x4ca3b4,_0x12b782){_0x4ca3b4=_0x4ca3b4-0x0;var _0xa61962=_0x2b82[_0x4ca3b4];return _0xa61962;};'use strict';var PluginEvents=require(_0x22b8('0x0'));var events=[_0x22b8('0x1'),_0x22b8('0x2'),'update'];function createListener(_0x53161f,_0x3aa1ef){return function(_0x20c598){_0x3aa1ef[_0x22b8('0x3')](_0x53161f,_0x20c598);};}function removeListener(_0x1d1c97,_0x4f5596){return function(){PluginEvents[_0x22b8('0x4')](_0x1d1c97,_0x4f5596);};}exports[_0x22b8('0x5')]=function(_0x46dcfb){for(var _0x4f9cb1=0x0,_0x46e93d=events[_0x22b8('0x6')];_0x4f9cb1<_0x46e93d;_0x4f9cb1++){var _0x4f667f=events[_0x4f9cb1];var _0x2cf01b=createListener(_0x22b8('0x7')+_0x4f667f,_0x46dcfb);PluginEvents['on'](_0x4f667f,_0x2cf01b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b6cb832..b03ece4 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(_0x3d565e,_0x19bea7){var _0x3dd6f4=function(_0x3d9334){while(--_0x3d9334){_0x3d565e['push'](_0x3d565e['shift']());}};_0x3dd6f4(++_0x19bea7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x4e5cd3,_0x21571e){var _0x556a16=function(_0xee3860){while(--_0xee3860){_0x4e5cd3['push'](_0x4e5cd3['shift']());}};_0x556a16(++_0x21571e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 562c17c..9559adc 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 _0x99e9=['../../config/pm2','../../config/logger','api','path','exec','bluebird','status','error','stack','name','send','npm\x20install','info','index','list','then','motion2','length','catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id'];(function(_0x2b53bf,_0x2bb0f5){var _0x395878=function(_0x4a8958){while(--_0x4a8958){_0x2b53bf['push'](_0x2b53bf['shift']());}};_0x395878(++_0x2bb0f5);}(_0x99e9,0xb4));var _0x999e=function(_0x2cd8d0,_0x5ddefb){_0x2cd8d0=_0x2cd8d0-0x0;var _0x49a221=_0x99e9[_0x2cd8d0];return _0x49a221;};'use strict';var _=require('lodash');var pm2=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var path=require(_0x999e('0x3'));var exec=require('child_process')[_0x999e('0x4')];var BPromise=require(_0x999e('0x5'));function handleEntityNotFound(_0x3aac27,_0x4e2112){return function(_0x296411){if(!_0x296411){_0x3aac27['sendStatus'](0x194);;}return _0x296411;};}function respondWithResult(_0x25421f,_0x1bda0a){_0x1bda0a=_0x1bda0a||0xc8;return function(_0x100330){if(_0x100330){return _0x25421f[_0x999e('0x6')](_0x1bda0a)['json'](_0x100330);}return null;};}function handleError(_0x46aeae,_0x38a692){_0x38a692=_0x38a692||0x1f4;return function(_0x343a12){logger[_0x999e('0x7')](_0x343a12[_0x999e('0x8')]);if(_0x343a12[_0x999e('0x9')]){delete _0x343a12[_0x999e('0x9')];}_0x46aeae[_0x999e('0x6')](_0x38a692)[_0x999e('0xa')](_0x343a12);};}function execChildProcess(){return new BPromise(function(_0xf40130,_0x9368cf){exec(_0x999e('0xb'),function(_0x4246b1,_0x188d02,_0x3dfe2d){logger[_0x999e('0xc')](_0x188d02);logger[_0x999e('0xc')](_0x3dfe2d);if(_0x4246b1){logger['error'](_0x4246b1);return _0x9368cf(_0x4246b1);}return _0xf40130(_0x188d02);});});}exports[_0x999e('0xd')]=function(_0x54afad,_0x3e6f5a){return pm2[_0x999e('0xe')]()[_0x999e('0xf')](function(_0x538a92){if(_0x538a92){var _0x28bdd1=_['reject'](_0x538a92,function(_0xa44e4c){return _0xa44e4c['name']==='express'||_0xa44e4c[_0x999e('0x9')]===_0x999e('0x10');});return{'rows':_0x28bdd1,'count':_0x28bdd1[_0x999e('0x11')]};}return null;})[_0x999e('0xf')](respondWithResult(_0x3e6f5a,null))[_0x999e('0x12')](handleError(_0x3e6f5a,null));};exports[_0x999e('0x13')]=function(_0x4aac66,_0x5bb27e){return pm2['describe'](_0x4aac66[_0x999e('0x14')]['id'])[_0x999e('0xf')](respondWithResult(_0x5bb27e,null))[_0x999e('0xf')](handleEntityNotFound(_0x5bb27e,null))[_0x999e('0x12')](handleError(_0x5bb27e,null));};exports[_0x999e('0x15')]=function(_0x3ece5e,_0x5af4c3){if(_0x3ece5e['body'][_0x999e('0x9')]&&_0x3ece5e[_0x999e('0x16')][_0x999e('0x17')]){var _0x510fa2=path[_0x999e('0x18')](__dirname,_0x999e('0x19'),_0x3ece5e[_0x999e('0x16')][_0x999e('0x17')]);var _0x373b80=process[_0x999e('0x1a')]();process[_0x999e('0x1b')](path['dirname'](_0x510fa2));return execChildProcess()['then'](function(_0x11a6bf){process[_0x999e('0x1b')](_0x373b80);return pm2['start']({'name':_0x3ece5e[_0x999e('0x16')][_0x999e('0x9')],'script':_0x510fa2});})[_0x999e('0xf')](function(_0x13027c){pm2[_0x999e('0x1c')]();return _0x13027c[0x0];})[_0x999e('0xf')](respondWithResult(_0x5af4c3,0xc9))['catch'](handleError(_0x5af4c3,null));}else{return _0x5af4c3[_0x999e('0x6')](0x1f4)[_0x999e('0xa')]({'message':_0x999e('0x1d')});}};exports[_0x999e('0x1e')]=function(_0x1b7adb,_0x1d2dc6){if(_0x1b7adb[_0x999e('0x16')]['id']){delete _0x1b7adb['body']['id'];}var _0x28f803={'online':'restart','stopped':'stop'};if(_0x28f803[_0x999e('0x1f')](_0x1b7adb[_0x999e('0x16')][_0x999e('0x6')])){return pm2[_0x28f803[_0x1b7adb['body'][_0x999e('0x6')]]](_0x1b7adb[_0x999e('0x14')]['id'])[_0x999e('0xf')](respondWithResult(_0x1d2dc6,0xc8))[_0x999e('0x12')](handleError(_0x1d2dc6,null));}else{return _0x1d2dc6[_0x999e('0x6')](0x1f4)[_0x999e('0xa')]({'message':_0x999e('0x20')});}};exports[_0x999e('0x21')]=function(_0x27102b,_0x3ddacb){if(_0x27102b['body']['id']){delete _0x27102b[_0x999e('0x16')]['id'];}if(_0x27102b[_0x999e('0x14')]['id']){return pm2[_0x999e('0x22')](_0x27102b['params']['id'])[_0x999e('0xf')](function(_0x5af72c){pm2['dump']();return _0x5af72c[0x0];})[_0x999e('0xf')](respondWithResult(_0x3ddacb,null))[_0x999e('0x12')](handleError(_0x3ddacb,null));}else{return _0x3ddacb['status'](0x1f4)['send']({'message':_0x999e('0x23')});}}; \ No newline at end of file +var _0x4fdb=['lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','then','reject','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dump','restart','stop','hasOwnProperty','Unknown\x20status','destroy','Unknown\x20id'];(function(_0x53751f,_0x1ceffb){var _0xd85348=function(_0x241804){while(--_0x241804){_0x53751f['push'](_0x53751f['shift']());}};_0xd85348(++_0x1ceffb);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x5511b0,_0xd17819){_0x5511b0=_0x5511b0-0x0;var _0x4b766a=_0x4fdb[_0x5511b0];return _0x4b766a;};'use strict';var _=require(_0xb4fd('0x0'));var pm2=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var path=require(_0xb4fd('0x4'));var exec=require(_0xb4fd('0x5'))[_0xb4fd('0x6')];var BPromise=require(_0xb4fd('0x7'));function handleEntityNotFound(_0x1c0b08,_0x5b73bb){return function(_0x308de6){if(!_0x308de6){_0x1c0b08['sendStatus'](0x194);;}return _0x308de6;};}function respondWithResult(_0x14052b,_0x5d8b39){_0x5d8b39=_0x5d8b39||0xc8;return function(_0x53273f){if(_0x53273f){return _0x14052b[_0xb4fd('0x8')](_0x5d8b39)[_0xb4fd('0x9')](_0x53273f);}return null;};}function handleError(_0x1151b5,_0x52dca2){_0x52dca2=_0x52dca2||0x1f4;return function(_0x526d3b){logger[_0xb4fd('0xa')](_0x526d3b[_0xb4fd('0xb')]);if(_0x526d3b[_0xb4fd('0xc')]){delete _0x526d3b['name'];}_0x1151b5[_0xb4fd('0x8')](_0x52dca2)[_0xb4fd('0xd')](_0x526d3b);};}function execChildProcess(){return new BPromise(function(_0x2148db,_0x23b08f){exec(_0xb4fd('0xe'),function(_0x502379,_0xd05458,_0x1f3e30){logger[_0xb4fd('0xf')](_0xd05458);logger[_0xb4fd('0xf')](_0x1f3e30);if(_0x502379){logger['error'](_0x502379);return _0x23b08f(_0x502379);}return _0x2148db(_0xd05458);});});}exports[_0xb4fd('0x10')]=function(_0x65f08a,_0x345d35){return pm2['list']()[_0xb4fd('0x11')](function(_0x1234d7){if(_0x1234d7){var _0xc35d8d=_[_0xb4fd('0x12')](_0x1234d7,function(_0x36e88f){return _0x36e88f[_0xb4fd('0xc')]===_0xb4fd('0x13')||_0x36e88f['name']===_0xb4fd('0x14');});return{'rows':_0xc35d8d,'count':_0xc35d8d[_0xb4fd('0x15')]};}return null;})[_0xb4fd('0x11')](respondWithResult(_0x345d35,null))[_0xb4fd('0x16')](handleError(_0x345d35,null));};exports[_0xb4fd('0x17')]=function(_0x137e51,_0x1d0812){return pm2[_0xb4fd('0x18')](_0x137e51[_0xb4fd('0x19')]['id'])[_0xb4fd('0x11')](respondWithResult(_0x1d0812,null))[_0xb4fd('0x11')](handleEntityNotFound(_0x1d0812,null))['catch'](handleError(_0x1d0812,null));};exports['create']=function(_0x504e80,_0x5c14c0){if(_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0xc')]&&_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0x1b')]){var _0x458133=path[_0xb4fd('0x1c')](__dirname,_0xb4fd('0x1d'),_0x504e80['body']['script']);var _0x216307=process[_0xb4fd('0x1e')]();process[_0xb4fd('0x1f')](path['dirname'](_0x458133));return execChildProcess()[_0xb4fd('0x11')](function(_0x49d42c){process[_0xb4fd('0x1f')](_0x216307);return pm2['start']({'name':_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0xc')],'script':_0x458133});})[_0xb4fd('0x11')](function(_0x261eda){pm2[_0xb4fd('0x20')]();return _0x261eda[0x0];})[_0xb4fd('0x11')](respondWithResult(_0x5c14c0,0xc9))[_0xb4fd('0x16')](handleError(_0x5c14c0,null));}else{return _0x5c14c0[_0xb4fd('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x453982,_0x4bad85){if(_0x453982[_0xb4fd('0x1a')]['id']){delete _0x453982['body']['id'];}var _0x5738c2={'online':_0xb4fd('0x21'),'stopped':_0xb4fd('0x22')};if(_0x5738c2[_0xb4fd('0x23')](_0x453982['body'][_0xb4fd('0x8')])){return pm2[_0x5738c2[_0x453982[_0xb4fd('0x1a')][_0xb4fd('0x8')]]](_0x453982[_0xb4fd('0x19')]['id'])['then'](respondWithResult(_0x4bad85,0xc8))[_0xb4fd('0x16')](handleError(_0x4bad85,null));}else{return _0x4bad85[_0xb4fd('0x8')](0x1f4)['send']({'message':_0xb4fd('0x24')});}};exports[_0xb4fd('0x25')]=function(_0xbe7d2c,_0x597874){if(_0xbe7d2c[_0xb4fd('0x1a')]['id']){delete _0xbe7d2c[_0xb4fd('0x1a')]['id'];}if(_0xbe7d2c[_0xb4fd('0x19')]['id']){return pm2['delete'](_0xbe7d2c['params']['id'])['then'](function(_0x5f36e4){pm2[_0xb4fd('0x20')]();return _0x5f36e4[0x0];})[_0xb4fd('0x11')](respondWithResult(_0x597874,null))[_0xb4fd('0x16')](handleError(_0x597874,null));}else{return _0x597874[_0xb4fd('0x8')](0x1f4)[_0xb4fd('0xd')]({'message':_0xb4fd('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3e2818c..073f353 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 _0x9df6=['get','/queues','isAuthenticated','getQueues','Router','../../components/auth/service'];(function(_0xbb5a1b,_0x5572e8){var _0x27f22e=function(_0x12ac9c){while(--_0x12ac9c){_0xbb5a1b['push'](_0xbb5a1b['shift']());}};_0x27f22e(++_0x5572e8);}(_0x9df6,0xe2));var _0x69df=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x9df6[_0x2763f2];return _0x3ef471;};'use strict';var express=require('express');var router=express[_0x69df('0x0')]();var auth=require(_0x69df('0x1'));var controller=require('./realtime.controller');router[_0x69df('0x2')](_0x69df('0x3'),auth[_0x69df('0x4')](),controller[_0x69df('0x5')]);module['exports']=router; \ No newline at end of file +var _0xe9ef=['express','../../components/auth/service','./realtime.controller','/queues','getQueues','exports'];(function(_0x19a5dc,_0x3ff5d2){var _0x366514=function(_0x378f38){while(--_0x378f38){_0x19a5dc['push'](_0x19a5dc['shift']());}};_0x366514(++_0x3ff5d2);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0xe9ef[_0x22dac7];return _0x3e6cfa;};'use strict';var express=require(_0xfe9e('0x0'));var router=express['Router']();var auth=require(_0xfe9e('0x1'));var controller=require(_0xfe9e('0x2'));router['get'](_0xfe9e('0x3'),auth['isAuthenticated'](),controller[_0xfe9e('0x4')]);module[_0xfe9e('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index b66febf..57b3cf1 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['push','User','findAll','agent','length','loggedInDb','catch','util','lodash','jayson/promise','../../config/logger','api','client','http','offset','undefined','status','set','Content-Range','json','stack','name','send','getQueues','mail','chat','sms','openchannel','fax','resolve','then','query','channel','includes','toLowerCase','Invalid\x20channel','startCase','Queue','rawAttributes','fieldName','type','getOptions','user','userProfileId','voice','outbound','filter','UserProfile','getResources','findAndCountAll','count','request','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','available','waiting','pTalking','originated','dialMethod','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','map','get','paused','loggedIn','talking','merge','pick','getAgents','online','getMembers','find','UserId'];(function(_0x3c5889,_0x13175b){var _0x1d1feb=function(_0x5ed711){while(--_0x5ed711){_0x3c5889['push'](_0x3c5889['shift']());}};_0x1d1feb(++_0x13175b);}(_0x7a54,0x106));var _0x47a5=function(_0x2067e9,_0x2a866b){_0x2067e9=_0x2067e9-0x0;var _0x329a7e=_0x7a54[_0x2067e9];return _0x329a7e;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var client=jayson[_0x47a5('0x5')][_0x47a5('0x6')]({'port':0x232a});var routingClient=jayson[_0x47a5('0x5')][_0x47a5('0x6')]({'port':0x232c});function respondWithFilteredResult(_0xfdf934,_0x545a97){return function(_0x3d5629){if(_0x3d5629){var _0x59199c=typeof _0x545a97[_0x47a5('0x7')]===_0x47a5('0x8')&&typeof _0x545a97['limit']===_0x47a5('0x8');var _0x5077f3=_0x3d5629['count'];var _0x582352=_0x59199c?0x0:_0x545a97[_0x47a5('0x7')];var _0x2baee7=_0x59199c?_0x3d5629['count']:_0x545a97[_0x47a5('0x7')]+_0x545a97['limit'];var _0x5de6d7;if(_0x2baee7>=_0x5077f3){_0x2baee7=_0x5077f3;_0x5de6d7=0xc8;}else{_0x5de6d7=0xce;}_0xfdf934[_0x47a5('0x9')](_0x5de6d7);return _0xfdf934[_0x47a5('0xa')](_0x47a5('0xb'),_0x582352+'-'+_0x2baee7+'/'+_0x5077f3)[_0x47a5('0xc')](_0x3d5629);}return null;};}function handleError(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0x1f4;return function(_0x1eae59){logger['error'](_0x1eae59[_0x47a5('0xd')]);if(_0x1eae59[_0x47a5('0xe')]){delete _0x1eae59[_0x47a5('0xe')];}_0xd612dd[_0x47a5('0x9')](_0xd308b8)[_0x47a5('0xf')](_0x1eae59);};}exports[_0x47a5('0x10')]=function(_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),'whatsapp','voice'];var _0x138bc0={'count':0x0,'rows':[]},_0x4b966e={},_0x5247fd;Promise[_0x47a5('0x16')]()[_0x47a5('0x17')](function(){if(_0x3c6c46[_0x47a5('0x18')][_0x47a5('0x19')]){if(!_[_0x47a5('0x1a')](_0x4e99a8,_0x3c6c46[_0x47a5('0x18')][_0x47a5('0x19')][_0x47a5('0x1b')]()))throw new Error(_0x47a5('0x1c'));_0x5247fd=_0x3c6c46['query'][_0x47a5('0x19')][_0x47a5('0x1b')]();}var _0x47cf3c=_[_0x47a5('0x1d')](_0x5247fd)+_0x47a5('0x1e');var _0x36874d=_['map'](db[_0x47cf3c][_0x47a5('0x1f')],function(_0x2f142b){return{'name':_0x2f142b[_0x47a5('0x20')],'type':_0x2f142b[_0x47a5('0x21')]['key']};});_0x4b966e=qs[_0x47a5('0x22')](_0x36874d,_0x3c6c46);if(_0x3c6c46[_0x47a5('0x23')]['role']===_0x47a5('0x23')){var _0xc4cd63={'params':{'id':_0x3c6c46[_0x47a5('0x23')][_0x47a5('0x24')]},'query':{'section':_0x5247fd===_0x47a5('0x25')&&_0x3c6c46['query']['type']===_0x47a5('0x26')?'QueueCampaigns':_[_0x47a5('0x1d')](_0x5247fd)+'Queues','type':_0x3c6c46[_0x47a5('0x18')][_0x47a5('0x21')],'nolimit':!![],'sort':_0x47a5('0xe'),'filter':_0x3c6c46[_0x47a5('0x18')][_0x47a5('0x27')]}};return db[_0x47a5('0x28')][_0x47a5('0x29')](_0xc4cd63);}return db[_0x47cf3c][_0x47a5('0x2a')](_0x4b966e);})[_0x47a5('0x17')](function(_0x361bfa){_0x138bc0[_0x47a5('0x2b')]=_0x361bfa[_0x47a5('0x2b')];var _0x3ad507=_0x5247fd==='voice'?client:routingClient;return _0x3ad507[_0x47a5('0x2c')](_['startCase'](_0x5247fd)+_0x47a5('0x2d'),_0x3c6c46)[_0x47a5('0x17')](function(_0x16901f){if(_0x16901f['error'])throw new Error(util[_0x47a5('0x2e')](_0x47a5('0x2f'),_0x5247fd));var _0x39b50b=_0x16901f[_0x47a5('0x30')];var _0x51cc81=['loggedIn',_0x47a5('0x31'),_0x47a5('0x32'),'talking','paused'];if(_0x5247fd===_0x47a5('0x25')&&_0x3c6c46[_0x47a5('0x18')]['type']===_0x47a5('0x26')){_0x51cc81['push'](_0x47a5('0x33'),_0x47a5('0x34'),'message','dialActive',_0x47a5('0x35'),'Trunk',_0x47a5('0x36'),_0x47a5('0x37'),_0x47a5('0x38'),'erlangCallToSecond',_0x47a5('0x39'),'erlangBusyFactor','dialPredictiveInterval',_0x47a5('0x3a'),'dialPredictiveIntervalMinThreshold',_0x47a5('0x3b'),'predictiveIntervalTotalCalls',_0x47a5('0x3c'),_0x47a5('0x3d'),_0x47a5('0x3e'),_0x47a5('0x3f'),_0x47a5('0x40'));}var _0xed6320=_0x361bfa[_0x47a5('0x41')][_0x47a5('0x42')](function(_0x1a0d23){var _0x4caed5=_0x1a0d23[_0x47a5('0x43')]({'plain':!![]});_0x4caed5[_0x47a5('0x44')]=0x0;_0x4caed5['loggedInDb']=0x0;_0x4caed5[_0x47a5('0x45')]=0x0;_0x4caed5[_0x47a5('0x31')]=0x0;_0x4caed5[_0x47a5('0x44')]=0x0;_0x4caed5['waiting']=0x0;if(_0x5247fd===_0x47a5('0x25')){_0x4caed5[_0x47a5('0x46')]=0x0;if(_0x3c6c46['query'][_0x47a5('0x21')]===_0x47a5('0x26')){_0x4caed5['pTalking']=0x0;_0x4caed5['originated']=0x0;}}_0x4caed5['agents']=[];var _0x12d9f2=_['find'](_0x39b50b[_0x47a5('0x41')],['id',_0x4caed5['id']]);if(_0x12d9f2)_[_0x47a5('0x47')](_0x4caed5,_[_0x47a5('0x48')](_0x12d9f2,_0x51cc81));if(_0x5247fd===_0x47a5('0x25')){return _0x1a0d23[_0x47a5('0x49')]({'attributes':['id',_0x47a5('0xe'),_0x47a5('0x4a')],'joinTableAttributes':[],'raw':!![]})[_0x47a5('0x17')](function(_0x3fa2a8){return _0x1a0d23[_0x47a5('0x4b')]({'raw':!![]})[_0x47a5('0x17')](function(_0x1658e8){for(var _0x23d6d8=0x0;_0x23d6d8<_0x3fa2a8['length'];_0x23d6d8++){var _0x1fbece=_[_0x47a5('0x4c')](_0x1658e8,[_0x47a5('0x4d'),_0x3fa2a8[_0x23d6d8]['id']]);var _0x23bd8d={'id':_0x3fa2a8[_0x23d6d8]['id'],'name':_0x3fa2a8[_0x23d6d8]['name'],'online':Boolean(_0x3fa2a8[_0x23d6d8][_0x47a5('0x4a')]),'paused':_0x1fbece?Boolean(_0x1fbece['paused']):![]};if(_0x23bd8d['online'])_0x4caed5['loggedInDb']++;if(_0x23bd8d['paused'])_0x4caed5[_0x47a5('0x44')]++;_0x4caed5['agents'][_0x47a5('0x4e')](_0x23bd8d);}return _0x4caed5;});});}else{var _0x3a740b=_0x47a5('0x4f')+_['startCase'](_0x5247fd)+_0x47a5('0x1e');var _0x20c5bc=_0x5247fd+'Pause';return db[_0x3a740b]['findAll']({'where':{[_[_0x47a5('0x1d')](_0x5247fd)+'QueueId']:_0x1a0d23['id']},'raw':!![]})[_0x47a5('0x17')](function(_0x4703b2){return db[_0x47a5('0x4f')][_0x47a5('0x50')]({'attributes':['id',_0x47a5('0xe'),_0x47a5('0x4a'),_0x20c5bc],'where':{'id':_[_0x47a5('0x42')](_0x4703b2,_0x47a5('0x4d')),'role':_0x47a5('0x51')},'raw':!![]});})[_0x47a5('0x17')](function(_0x24ecb1){for(var _0x3c3ebf=0x0;_0x3c3ebf<_0x24ecb1[_0x47a5('0x52')];_0x3c3ebf++){var _0x3574d4={'id':_0x24ecb1[_0x3c3ebf]['id'],'name':_0x24ecb1[_0x3c3ebf][_0x47a5('0xe')],'online':Boolean(_0x24ecb1[_0x3c3ebf][_0x47a5('0x4a')]),'paused':Boolean(_0x24ecb1[_0x3c3ebf][_0x20c5bc])};if(_0x3574d4['online'])_0x4caed5[_0x47a5('0x53')]++;if(_0x3574d4[_0x47a5('0x44')])_0x4caed5['paused']++;_0x4caed5['agents'][_0x47a5('0x4e')](_0x3574d4);}return _0x4caed5;});}});return Promise['all'](_0xed6320);});})[_0x47a5('0x17')](function(_0xd93e37){_0x138bc0['rows']=_0xd93e37;return _0x138bc0;})['then'](respondWithFilteredResult(_0x190faa,_0x4b966e))[_0x47a5('0x54')](handleError(_0x190faa,null));}; \ No newline at end of file +var _0x71ab=['getMembers','length','find','UserId','User','Pause','QueueId','findAll','agent','all','catch','lodash','../../components/parsers/qs','api','../../mysqldb','client','http','offset','undefined','limit','count','status','Content-Range','error','stack','name','mail','chat','sms','openchannel','fax','whatsapp','resolve','then','query','channel','includes','toLowerCase','Queue','map','rawAttributes','fieldName','type','key','getOptions','user','userProfileId','voice','outbound','QueueCampaigns','startCase','Queues','filter','UserProfile','getResources','findAndCountAll','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','talking','paused','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','loggedInDb','waiting','agents','pick','getAgents','online'];(function(_0x4a0e8a,_0x5b4957){var _0x2eb49c=function(_0xccc30e){while(--_0xccc30e){_0x4a0e8a['push'](_0x4a0e8a['shift']());}};_0x2eb49c(++_0x5b4957);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var util=require('util');var _=require(_0xb71a('0x0'));var jayson=require('jayson/promise');var qs=require(_0xb71a('0x1'));var logger=require('../../config/logger')(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var client=jayson[_0xb71a('0x4')][_0xb71a('0x5')]({'port':0x232a});var routingClient=jayson[_0xb71a('0x4')][_0xb71a('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x2192e8,_0x38d931){return function(_0x22c072){if(_0x22c072){var _0x35a84e=typeof _0x38d931[_0xb71a('0x6')]===_0xb71a('0x7')&&typeof _0x38d931[_0xb71a('0x8')]===_0xb71a('0x7');var _0x18c7a6=_0x22c072[_0xb71a('0x9')];var _0x378c96=_0x35a84e?0x0:_0x38d931[_0xb71a('0x6')];var _0x517eed=_0x35a84e?_0x22c072[_0xb71a('0x9')]:_0x38d931['offset']+_0x38d931[_0xb71a('0x8')];var _0x343d2f;if(_0x517eed>=_0x18c7a6){_0x517eed=_0x18c7a6;_0x343d2f=0xc8;}else{_0x343d2f=0xce;}_0x2192e8[_0xb71a('0xa')](_0x343d2f);return _0x2192e8['set'](_0xb71a('0xb'),_0x378c96+'-'+_0x517eed+'/'+_0x18c7a6)['json'](_0x22c072);}return null;};}function handleError(_0x2a2d75,_0x50030d){_0x50030d=_0x50030d||0x1f4;return function(_0x50b43b){logger[_0xb71a('0xc')](_0x50b43b[_0xb71a('0xd')]);if(_0x50b43b[_0xb71a('0xe')]){delete _0x50b43b[_0xb71a('0xe')];}_0x2a2d75['status'](_0x50030d)['send'](_0x50b43b);};}exports['getQueues']=function(_0x12900a,_0xc189cd){var _0x15252a=[_0xb71a('0xf'),_0xb71a('0x10'),_0xb71a('0x11'),_0xb71a('0x12'),_0xb71a('0x13'),_0xb71a('0x14'),'voice'];var _0x1ca65e={'count':0x0,'rows':[]},_0x2d6369={},_0x374c8c;Promise[_0xb71a('0x15')]()[_0xb71a('0x16')](function(){if(_0x12900a[_0xb71a('0x17')][_0xb71a('0x18')]){if(!_[_0xb71a('0x19')](_0x15252a,_0x12900a[_0xb71a('0x17')][_0xb71a('0x18')][_0xb71a('0x1a')]()))throw new Error('Invalid\x20channel');_0x374c8c=_0x12900a['query'][_0xb71a('0x18')][_0xb71a('0x1a')]();}var _0x4a4f4e=_['startCase'](_0x374c8c)+_0xb71a('0x1b');var _0x4fe4fb=_[_0xb71a('0x1c')](db[_0x4a4f4e][_0xb71a('0x1d')],function(_0x3ac77b){return{'name':_0x3ac77b[_0xb71a('0x1e')],'type':_0x3ac77b[_0xb71a('0x1f')][_0xb71a('0x20')]};});_0x2d6369=qs[_0xb71a('0x21')](_0x4fe4fb,_0x12900a);if(_0x12900a[_0xb71a('0x22')]['role']===_0xb71a('0x22')){var _0x2c15bc={'params':{'id':_0x12900a[_0xb71a('0x22')][_0xb71a('0x23')]},'query':{'section':_0x374c8c===_0xb71a('0x24')&&_0x12900a[_0xb71a('0x17')][_0xb71a('0x1f')]===_0xb71a('0x25')?_0xb71a('0x26'):_[_0xb71a('0x27')](_0x374c8c)+_0xb71a('0x28'),'type':_0x12900a[_0xb71a('0x17')][_0xb71a('0x1f')],'nolimit':!![],'sort':'name','filter':_0x12900a[_0xb71a('0x17')][_0xb71a('0x29')]}};return db[_0xb71a('0x2a')][_0xb71a('0x2b')](_0x2c15bc);}return db[_0x4a4f4e][_0xb71a('0x2c')](_0x2d6369);})[_0xb71a('0x16')](function(_0x44826e){_0x1ca65e[_0xb71a('0x9')]=_0x44826e[_0xb71a('0x9')];var _0x421fcf=_0x374c8c===_0xb71a('0x24')?client:routingClient;return _0x421fcf['request'](_['startCase'](_0x374c8c)+_0xb71a('0x28'),_0x12900a)['then'](function(_0x70299a){if(_0x70299a[_0xb71a('0xc')])throw new Error(util['format'](_0xb71a('0x2d'),_0x374c8c));var _0xa42f25=_0x70299a[_0xb71a('0x2e')];var _0x251d82=[_0xb71a('0x2f'),_0xb71a('0x30'),'waiting',_0xb71a('0x31'),_0xb71a('0x32')];if(_0x374c8c===_0xb71a('0x24')&&_0x12900a[_0xb71a('0x17')]['type']===_0xb71a('0x25')){_0x251d82[_0xb71a('0x33')](_0xb71a('0x34'),_0xb71a('0x35'),_0xb71a('0x36'),_0xb71a('0x37'),_0xb71a('0x38'),_0xb71a('0x39'),_0xb71a('0x3a'),_0xb71a('0x3b'),'erlangCalls','erlangCallToSecond',_0xb71a('0x3c'),_0xb71a('0x3d'),_0xb71a('0x3e'),_0xb71a('0x3f'),_0xb71a('0x40'),_0xb71a('0x41'),_0xb71a('0x42'),'predictiveIntervalAnsweredCalls',_0xb71a('0x43'),'predictiveIntervalDroppedCallsCallersExit',_0xb71a('0x44'),_0xb71a('0x45'));}var _0x147002=_0x44826e[_0xb71a('0x46')]['map'](function(_0x39d12c){var _0x3ff4ed=_0x39d12c[_0xb71a('0x47')]({'plain':!![]});_0x3ff4ed[_0xb71a('0x32')]=0x0;_0x3ff4ed[_0xb71a('0x48')]=0x0;_0x3ff4ed[_0xb71a('0x2f')]=0x0;_0x3ff4ed[_0xb71a('0x30')]=0x0;_0x3ff4ed[_0xb71a('0x32')]=0x0;_0x3ff4ed[_0xb71a('0x49')]=0x0;if(_0x374c8c==='voice'){_0x3ff4ed[_0xb71a('0x31')]=0x0;if(_0x12900a['query'][_0xb71a('0x1f')]===_0xb71a('0x25')){_0x3ff4ed[_0xb71a('0x34')]=0x0;_0x3ff4ed[_0xb71a('0x35')]=0x0;}}_0x3ff4ed[_0xb71a('0x4a')]=[];var _0x18872b=_['find'](_0xa42f25['rows'],['id',_0x3ff4ed['id']]);if(_0x18872b)_['merge'](_0x3ff4ed,_[_0xb71a('0x4b')](_0x18872b,_0x251d82));if(_0x374c8c==='voice'){return _0x39d12c[_0xb71a('0x4c')]({'attributes':['id',_0xb71a('0xe'),_0xb71a('0x4d')],'joinTableAttributes':[],'raw':!![]})[_0xb71a('0x16')](function(_0x1cb355){return _0x39d12c[_0xb71a('0x4e')]({'raw':!![]})['then'](function(_0x29985a){for(var _0x7b5cc4=0x0;_0x7b5cc4<_0x1cb355[_0xb71a('0x4f')];_0x7b5cc4++){var _0x8bf582=_[_0xb71a('0x50')](_0x29985a,[_0xb71a('0x51'),_0x1cb355[_0x7b5cc4]['id']]);var _0x55cbca={'id':_0x1cb355[_0x7b5cc4]['id'],'name':_0x1cb355[_0x7b5cc4][_0xb71a('0xe')],'online':Boolean(_0x1cb355[_0x7b5cc4][_0xb71a('0x4d')]),'paused':_0x8bf582?Boolean(_0x8bf582[_0xb71a('0x32')]):![]};if(_0x55cbca[_0xb71a('0x4d')])_0x3ff4ed[_0xb71a('0x48')]++;if(_0x55cbca[_0xb71a('0x32')])_0x3ff4ed[_0xb71a('0x32')]++;_0x3ff4ed['agents']['push'](_0x55cbca);}return _0x3ff4ed;});});}else{var _0x2442f5=_0xb71a('0x52')+_[_0xb71a('0x27')](_0x374c8c)+_0xb71a('0x1b');var _0x4a763c=_0x374c8c+_0xb71a('0x53');return db[_0x2442f5]['findAll']({'where':{[_[_0xb71a('0x27')](_0x374c8c)+_0xb71a('0x54')]:_0x39d12c['id']},'raw':!![]})['then'](function(_0x437287){return db[_0xb71a('0x52')][_0xb71a('0x55')]({'attributes':['id',_0xb71a('0xe'),'online',_0x4a763c],'where':{'id':_[_0xb71a('0x1c')](_0x437287,_0xb71a('0x51')),'role':_0xb71a('0x56')},'raw':!![]});})['then'](function(_0x350c89){for(var _0x1cd434=0x0;_0x1cd434<_0x350c89[_0xb71a('0x4f')];_0x1cd434++){var _0x5e9eea={'id':_0x350c89[_0x1cd434]['id'],'name':_0x350c89[_0x1cd434][_0xb71a('0xe')],'online':Boolean(_0x350c89[_0x1cd434][_0xb71a('0x4d')]),'paused':Boolean(_0x350c89[_0x1cd434][_0x4a763c])};if(_0x5e9eea[_0xb71a('0x4d')])_0x3ff4ed[_0xb71a('0x48')]++;if(_0x5e9eea[_0xb71a('0x32')])_0x3ff4ed['paused']++;_0x3ff4ed[_0xb71a('0x4a')][_0xb71a('0x33')](_0x5e9eea);}return _0x3ff4ed;});}});return Promise[_0xb71a('0x57')](_0x147002);});})[_0xb71a('0x16')](function(_0x489c1f){_0x1ca65e['rows']=_0x489c1f;return _0x1ca65e;})[_0xb71a('0x16')](respondWithFilteredResult(_0xc189cd,_0x2d6369))[_0xb71a('0x58')](handleError(_0xc189cd,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f799aaf..4d4e4b9 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1726ca,_0xdbf199){var _0x23e63b=function(_0x61629){while(--_0x61629){_0x1726ca['push'](_0x1726ca['shift']());}};_0x23e63b(++_0xdbf199);}(_0x70e0,0x17b));var _0x070e=function(_0x2460ee,_0x5cb5e1){_0x2460ee=_0x2460ee-0x0;var _0x397dc3=_0x70e0[_0x2460ee];return _0x397dc3;};'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(_0x28fde4,_0x4fbc40){var _0xdc3f1b=function(_0x58f4be){while(--_0x58f4be){_0x28fde4['push'](_0x28fde4['shift']());}};_0xdc3f1b(++_0x4fbc40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e566f16..e80c98b 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 _0xba34=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x1de503,_0xf2d53e){var _0x5405d0=function(_0x119365){while(--_0x119365){_0x1de503['push'](_0x1de503['shift']());}};_0x5405d0(++_0xf2d53e);}(_0xba34,0x119));var _0x4ba3=function(_0x3e6f66,_0x5da419){_0x3e6f66=_0x3e6f66-0x0;var _0x5187f6=_0xba34[_0x3e6f66];return _0x5187f6;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'state':{'type':Sequelize[_0x4ba3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4ba3('0x3')]},'scheduledat':{'type':Sequelize[_0x4ba3('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4ba3('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4ba3('0x3')]},'campaigntype':{'type':Sequelize[_0x4ba3('0x3')]},'membername':{'type':Sequelize[_0x4ba3('0x3')]}}; \ No newline at end of file +var _0xc99e=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x7a568e,_0x274e62){var _0x3b5a1f=function(_0x50f97a){while(--_0x50f97a){_0x7a568e['push'](_0x7a568e['shift']());}};_0x3b5a1f(++_0x274e62);}(_0xc99e,0x6e));var _0xec99=function(_0x46c831,_0x1e8675){_0x46c831=_0x46c831-0x0;var _0x528b30=_0xc99e[_0x46c831];return _0x528b30;};'use strict';var Sequelize=require(_0xec99('0x0'));module[_0xec99('0x1')]={'state':{'type':Sequelize[_0xec99('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xec99('0x3')]},'scheduledat':{'type':Sequelize[_0xec99('0x4')]},'uniqueid':{'type':Sequelize[_0xec99('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xec99('0x4')]},'ringtime':{'type':Sequelize[_0xec99('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xec99('0x3')]},'campaigntype':{'type':Sequelize[_0xec99('0x3')]},'membername':{'type':Sequelize[_0xec99('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index d8e0ec8..19bb158 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 _0xc0e9=['request-promise','path','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','lodash','util','../../config/logger','api','bluebird'];(function(_0x5fd016,_0x2d9cf4){var _0x92e1be=function(_0x35df9f){while(--_0x35df9f){_0x5fd016['push'](_0x5fd016['shift']());}};_0x92e1be(++_0x2d9cf4);}(_0xc0e9,0x159));var _0x9c0e=function(_0x2c59a1,_0x5182ed){_0x2c59a1=_0x2c59a1-0x0;var _0x4819ac=_0xc0e9[_0x2c59a1];return _0x4819ac;};'use strict';var _=require(_0x9c0e('0x0'));var util=require(_0x9c0e('0x1'));var logger=require(_0x9c0e('0x2'))(_0x9c0e('0x3'));var moment=require('moment');var BPromise=require(_0x9c0e('0x4'));var rp=require(_0x9c0e('0x5'));var fs=require('fs');var path=require(_0x9c0e('0x6'));var rimraf=require('rimraf');var config=require(_0x9c0e('0x7'));var attributes=require(_0x9c0e('0x8'));module['exports']=function(_0x1c9fe9,_0x50cd5c){return _0x1c9fe9['define'](_0x9c0e('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0b=['path','rimraf','../../config/environment','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x31052a,_0x2f2221){var _0x2f9ca0=function(_0xb138ce){while(--_0xb138ce){_0x31052a['push'](_0x31052a['shift']());}};_0x2f9ca0(++_0x2f2221);}(_0x0b0b,0x6e));var _0xb0b0=function(_0x3e8a65,_0x51abf6){_0x3e8a65=_0x3e8a65-0x0;var _0xde9345=_0x0b0b[_0x3e8a65];return _0xde9345;};'use strict';var _=require(_0xb0b0('0x0'));var util=require(_0xb0b0('0x1'));var logger=require(_0xb0b0('0x2'))(_0xb0b0('0x3'));var moment=require(_0xb0b0('0x4'));var BPromise=require(_0xb0b0('0x5'));var rp=require(_0xb0b0('0x6'));var fs=require('fs');var path=require(_0xb0b0('0x7'));var rimraf=require(_0xb0b0('0x8'));var config=require(_0xb0b0('0x9'));var attributes=require('./reportAgentPreview.attributes');module[_0xb0b0('0xa')]=function(_0x1c6046,_0x241714){return _0x1c6046[_0xb0b0('0xb')](_0xb0b0('0xc'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index c26c722..fe348ed 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 _0xccd6=['CreateReportAgentPreview','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x39167c,_0x409a66){var _0x26e511=function(_0x52cecc){while(--_0x52cecc){_0x39167c['push'](_0x39167c['shift']());}};_0x26e511(++_0x409a66);}(_0xccd6,0x8c));var _0x6ccd=function(_0x280dd8,_0x5c8eb8){_0x280dd8=_0x280dd8-0x0;var _0x2a6aa6=_0xccd6[_0x280dd8];return _0x2a6aa6;};'use strict';var _=require(_0x6ccd('0x0'));var util=require(_0x6ccd('0x1'));var moment=require('moment');var BPromise=require(_0x6ccd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ccd('0x3'));var db=require(_0x6ccd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ccd('0x5'))(_0x6ccd('0x6'));var config=require(_0x6ccd('0x7'));var jayson=require(_0x6ccd('0x8'));var client=jayson[_0x6ccd('0x9')][_0x6ccd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eea55,_0x37fbc3,_0x16585c){return new BPromise(function(_0x2751d8,_0x193e7b){return client[_0x6ccd('0xb')](_0x3eea55,_0x16585c)[_0x6ccd('0xc')](function(_0x443036){logger['info'](_0x6ccd('0xd'),_0x37fbc3,_0x6ccd('0xe'));logger[_0x6ccd('0xf')](_0x6ccd('0x10'),_0x37fbc3,'request\x20sent',JSON[_0x6ccd('0x11')](_0x443036));if(_0x443036[_0x6ccd('0x12')]){if(_0x443036[_0x6ccd('0x12')]['code']===0x1f4){logger['error'](_0x6ccd('0xd'),_0x37fbc3,_0x443036[_0x6ccd('0x12')][_0x6ccd('0x13')]);return _0x193e7b(_0x443036[_0x6ccd('0x12')][_0x6ccd('0x13')]);}logger[_0x6ccd('0x12')](_0x6ccd('0xd'),_0x37fbc3,_0x443036[_0x6ccd('0x12')][_0x6ccd('0x13')]);return _0x2751d8(_0x443036[_0x6ccd('0x12')][_0x6ccd('0x13')]);}else{logger[_0x6ccd('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x37fbc3,_0x6ccd('0xe'));_0x2751d8(_0x443036['result']['message']);}})[_0x6ccd('0x15')](function(_0x235b32){logger[_0x6ccd('0x12')](_0x6ccd('0xd'),_0x37fbc3,_0x235b32);_0x193e7b(_0x235b32);});});}exports[_0x6ccd('0x16')]=function(_0x5cc1b6){var _0x45568b=this;return new Promise(function(_0x5c9395,_0x3921b8){return db['ReportAgentPreview'][_0x6ccd('0x17')](_0x5cc1b6[_0x6ccd('0x18')],{'raw':_0x5cc1b6[_0x6ccd('0x19')]?_0x5cc1b6[_0x6ccd('0x19')][_0x6ccd('0x1a')]===undefined?!![]:![]:!![]})[_0x6ccd('0xc')](function(_0x3faa9d){logger[_0x6ccd('0x14')](_0x6ccd('0x16'),_0x5cc1b6);logger['debug'](_0x6ccd('0x16'),_0x5cc1b6,JSON[_0x6ccd('0x11')](_0x3faa9d));_0x5c9395(_0x3faa9d);})[_0x6ccd('0x15')](function(_0x34a055){logger['error'](_0x6ccd('0x16'),_0x34a055[_0x6ccd('0x13')],_0x5cc1b6);_0x3921b8(_0x45568b['error'](0x1f4,_0x34a055['message']));});});}; \ No newline at end of file +var _0x8720=['options','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','body'];(function(_0x33f3f8,_0x51b47a){var _0x2122db=function(_0x52fa7e){while(--_0x52fa7e){_0x33f3f8['push'](_0x33f3f8['shift']());}};_0x2122db(++_0x51b47a);}(_0x8720,0x11a));var _0x0872=function(_0x12fbd0,_0xf14427){_0x12fbd0=_0x12fbd0-0x0;var _0x56ab1d=_0x8720[_0x12fbd0];return _0x56ab1d;};'use strict';var _=require(_0x0872('0x0'));var util=require(_0x0872('0x1'));var moment=require(_0x0872('0x2'));var BPromise=require('bluebird');var rs=require(_0x0872('0x3'));var fs=require('fs');var Redis=require(_0x0872('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0872('0x5'));var logger=require('../../config/logger')(_0x0872('0x6'));var config=require(_0x0872('0x7'));var jayson=require(_0x0872('0x8'));var client=jayson[_0x0872('0x9')][_0x0872('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25f97d,_0x2a106b,_0x28374a){return new BPromise(function(_0x521aa5,_0x4b8c0b){return client[_0x0872('0xb')](_0x25f97d,_0x28374a)[_0x0872('0xc')](function(_0x4cd2ac){logger[_0x0872('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x2a106b,_0x0872('0xe'));logger[_0x0872('0xf')](_0x0872('0x10'),_0x2a106b,_0x0872('0xe'),JSON[_0x0872('0x11')](_0x4cd2ac));if(_0x4cd2ac[_0x0872('0x12')]){if(_0x4cd2ac[_0x0872('0x12')][_0x0872('0x13')]===0x1f4){logger['error'](_0x0872('0x14'),_0x2a106b,_0x4cd2ac[_0x0872('0x12')][_0x0872('0x15')]);return _0x4b8c0b(_0x4cd2ac[_0x0872('0x12')]['message']);}logger[_0x0872('0x12')](_0x0872('0x14'),_0x2a106b,_0x4cd2ac[_0x0872('0x12')]['message']);return _0x521aa5(_0x4cd2ac[_0x0872('0x12')][_0x0872('0x15')]);}else{logger['info'](_0x0872('0x14'),_0x2a106b,'request\x20sent');_0x521aa5(_0x4cd2ac['result']['message']);}})[_0x0872('0x16')](function(_0x1384a0){logger[_0x0872('0x12')](_0x0872('0x14'),_0x2a106b,_0x1384a0);_0x4b8c0b(_0x1384a0);});});}exports[_0x0872('0x17')]=function(_0x170112){var _0xd5be10=this;return new Promise(function(_0x2eeb43,_0x4b3bc9){return db[_0x0872('0x18')]['create'](_0x170112[_0x0872('0x19')],{'raw':_0x170112[_0x0872('0x1a')]?_0x170112['options'][_0x0872('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5130a3){logger[_0x0872('0xd')](_0x0872('0x17'),_0x170112);logger[_0x0872('0xf')](_0x0872('0x17'),_0x170112,JSON[_0x0872('0x11')](_0x5130a3));_0x2eeb43(_0x5130a3);})[_0x0872('0x16')](function(_0x1383d1){logger[_0x0872('0x12')](_0x0872('0x17'),_0x1383d1[_0x0872('0x15')],_0x170112);_0x4b3bc9(_0xd5be10[_0x0872('0x12')](0x1f4,_0x1383d1[_0x0872('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 0a61a42..6997990 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 _0xd0ee=['util','path','express','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','exports','multer'];(function(_0x2089b2,_0x1e8f40){var _0x4bb094=function(_0x3d1f6e){while(--_0x3d1f6e){_0x2089b2['push'](_0x2089b2['shift']());}};_0x4bb094(++_0x1e8f40);}(_0xd0ee,0x12f));var _0xed0e=function(_0x295b8a,_0x43ba6a){_0x295b8a=_0x295b8a-0x0;var _0x11a17=_0xd0ee[_0x295b8a];return _0x11a17;};'use strict';var multer=require(_0xed0e('0x0'));var util=require(_0xed0e('0x1'));var path=require(_0xed0e('0x2'));var express=require(_0xed0e('0x3'));var router=express['Router']();var auth=require(_0xed0e('0x4'));var controller=require(_0xed0e('0x5'));router['get']('/voice/channels',auth[_0xed0e('0x6')](),controller[_0xed0e('0x7')]);router[_0xed0e('0x8')](_0xed0e('0x9'),auth[_0xed0e('0x6')](),controller['voiceChannelMixMonitor']);router[_0xed0e('0x8')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xed0e('0x6')](),controller[_0xed0e('0xa')]);router[_0xed0e('0x8')]('/voice/queues',auth['isAuthenticated'](),controller['voiceQueues']);router['get'](_0xed0e('0xb'),auth[_0xed0e('0x6')](),controller[_0xed0e('0xc')]);router[_0xed0e('0x8')](_0xed0e('0xd'),auth[_0xed0e('0x6')](),controller[_0xed0e('0xe')]);router[_0xed0e('0x8')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xed0e('0xf')]);router['get'](_0xed0e('0x10'),auth[_0xed0e('0x6')](),controller['openchannelQueues']);router[_0xed0e('0x8')](_0xed0e('0x11'),auth[_0xed0e('0x6')](),controller['smsQueues']);router[_0xed0e('0x8')](_0xed0e('0x12'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get'](_0xed0e('0x13'),auth['isAuthenticated'](),controller[_0xed0e('0x14')]);router[_0xed0e('0x8')](_0xed0e('0x15'),auth[_0xed0e('0x6')](),controller['voiceQueuesPreview']);router[_0xed0e('0x8')](_0xed0e('0x16'),auth['isAuthenticated'](),controller[_0xed0e('0x17')]);router[_0xed0e('0x8')]('/voice/queues/channels/:uniqueid',auth[_0xed0e('0x6')](),controller[_0xed0e('0x18')]);router[_0xed0e('0x8')](_0xed0e('0x19'),auth[_0xed0e('0x6')](),controller['voiceQueuesChannelHangup']);router['get'](_0xed0e('0x1a'),auth['isAuthenticated'](),controller[_0xed0e('0x1b')]);router['get'](_0xed0e('0x1c'),auth[_0xed0e('0x6')](),controller['showVoiceQueues']);router['put'](_0xed0e('0x1c'),auth['isAuthenticated'](),controller[_0xed0e('0x1d')]);router['get'](_0xed0e('0x1e'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x1f')]);router['get']('/outbound/channels',auth[_0xed0e('0x6')](),controller[_0xed0e('0x20')]);router['get'](_0xed0e('0x21'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x22')]);router[_0xed0e('0x23')](_0xed0e('0x24'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x25')]);router[_0xed0e('0x8')](_0xed0e('0x26'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x27')]);router['get'](_0xed0e('0x28'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x29')]);router[_0xed0e('0x8')](_0xed0e('0x2a'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x2b')]);router[_0xed0e('0x8')](_0xed0e('0x2c'),auth[_0xed0e('0x6')](),controller['faxAccounts']);router[_0xed0e('0x8')](_0xed0e('0x2d'),auth[_0xed0e('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0xed0e('0x8')](_0xed0e('0x2e'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x2f')]);router[_0xed0e('0x8')](_0xed0e('0x30'),auth[_0xed0e('0x6')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xed0e('0x31'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x32')]);router['get'](_0xed0e('0x33'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x34')]);router[_0xed0e('0x8')](_0xed0e('0x35'),auth['isAuthenticated'](),controller[_0xed0e('0x36')]);router[_0xed0e('0x8')]('/fax/queues/waitinginteractions',auth[_0xed0e('0x6')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xed0e('0x37'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x38')](_0xed0e('0x39')));router[_0xed0e('0x8')](_0xed0e('0x3a'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x3b')]);router[_0xed0e('0x3c')](_0xed0e('0x3d'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x38')]('chat'));router[_0xed0e('0x8')](_0xed0e('0x3e'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x3f')]);router[_0xed0e('0x3c')]('/fax/queues/:id/notify',auth[_0xed0e('0x6')](),controller[_0xed0e('0x38')](_0xed0e('0x40')));router[_0xed0e('0x8')](_0xed0e('0x41'),auth['isAuthenticated'](),controller[_0xed0e('0x42')]);router['post'](_0xed0e('0x43'),auth['isAuthenticated'](),controller[_0xed0e('0x38')]('openchannel'));router[_0xed0e('0x8')]('/openchannel/queues/:id',auth[_0xed0e('0x6')](),controller[_0xed0e('0x44')]);router[_0xed0e('0x3c')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xed0e('0x45')));router['post'](_0xed0e('0x46'),auth[_0xed0e('0x6')](),controller[_0xed0e('0x38')](_0xed0e('0x47')));router[_0xed0e('0x8')]('/sms/queues/:id',auth[_0xed0e('0x6')](),controller[_0xed0e('0x48')]);router[_0xed0e('0x8')]('/whatsapp/queues/:id',auth[_0xed0e('0x6')](),controller[_0xed0e('0x49')]);router[_0xed0e('0x3c')](_0xed0e('0x4a'),auth['isAuthenticated'](),controller['agentNotify']);module[_0xed0e('0x4b')]=router; \ No newline at end of file +var _0xb1ba=['/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','queueNotify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','path','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','mailQueues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','mail','showMailQueues','/chat/queues/:id/notify','chat'];(function(_0xcd98ac,_0x301dc5){var _0x24402b=function(_0x32dd4c){while(--_0x32dd4c){_0xcd98ac['push'](_0xcd98ac['shift']());}};_0x24402b(++_0x301dc5);}(_0xb1ba,0x152));var _0xab1b=function(_0x388e58,_0x37b956){_0x388e58=_0x388e58-0x0;var _0x404de4=_0xb1ba[_0x388e58];return _0x404de4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab1b('0x0'));var express=require(_0xab1b('0x1'));var router=express[_0xab1b('0x2')]();var auth=require(_0xab1b('0x3'));var controller=require(_0xab1b('0x4'));router[_0xab1b('0x5')]('/voice/channels',auth['isAuthenticated'](),controller[_0xab1b('0x6')]);router['get'](_0xab1b('0x7'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x9')]);router[_0xab1b('0x5')](_0xab1b('0xa'),auth[_0xab1b('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0xab1b('0x5')](_0xab1b('0xb'),auth['isAuthenticated'](),controller[_0xab1b('0xc')]);router[_0xab1b('0x5')](_0xab1b('0xd'),auth[_0xab1b('0x8')](),controller['chatQueues']);router[_0xab1b('0x5')]('/mail/queues',auth[_0xab1b('0x8')](),controller[_0xab1b('0xe')]);router[_0xab1b('0x5')](_0xab1b('0xf'),auth[_0xab1b('0x8')](),controller['mailAccounts']);router[_0xab1b('0x5')]('/openchannel/queues',auth[_0xab1b('0x8')](),controller[_0xab1b('0x10')]);router['get'](_0xab1b('0x11'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x12')]);router[_0xab1b('0x5')](_0xab1b('0x13'),auth['isAuthenticated'](),controller[_0xab1b('0x14')]);router[_0xab1b('0x5')](_0xab1b('0x15'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x16')]);router[_0xab1b('0x5')]('/voice/queues/preview/:id',auth[_0xab1b('0x8')](),controller['voiceQueuesPreview']);router[_0xab1b('0x5')]('/voice/queues/channels',auth[_0xab1b('0x8')](),controller['voiceQueuesChannels']);router[_0xab1b('0x5')]('/voice/queues/channels/:uniqueid',auth[_0xab1b('0x8')](),controller['voiceQueuesChannel']);router[_0xab1b('0x5')](_0xab1b('0x17'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x18')]);router[_0xab1b('0x5')](_0xab1b('0x19'),auth[_0xab1b('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0xab1b('0x5')](_0xab1b('0x1a'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x1b')]);router[_0xab1b('0x1c')](_0xab1b('0x1a'),auth['isAuthenticated'](),controller[_0xab1b('0x1d')]);router[_0xab1b('0x5')](_0xab1b('0x1e'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x1f')]);router[_0xab1b('0x5')]('/outbound/channels',auth[_0xab1b('0x8')](),controller[_0xab1b('0x20')]);router[_0xab1b('0x5')](_0xab1b('0x21'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x22')]);router['put'](_0xab1b('0x23'),auth['isAuthenticated'](),controller[_0xab1b('0x24')]);router[_0xab1b('0x5')](_0xab1b('0x25'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x26')]);router[_0xab1b('0x5')](_0xab1b('0x27'),auth['isAuthenticated'](),controller[_0xab1b('0x28')]);router[_0xab1b('0x5')](_0xab1b('0x29'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x2a')]);router['get'](_0xab1b('0x2b'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x2c')]);router[_0xab1b('0x5')](_0xab1b('0x2d'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x2e')]);router[_0xab1b('0x5')](_0xab1b('0x2f'),auth['isAuthenticated'](),controller[_0xab1b('0x30')]);router[_0xab1b('0x5')](_0xab1b('0x31'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x32')]);router[_0xab1b('0x5')](_0xab1b('0x33'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x34')]);router[_0xab1b('0x5')](_0xab1b('0x35'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x36')]);router['get']('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xab1b('0x37')]);router[_0xab1b('0x5')](_0xab1b('0x38'),auth['isAuthenticated'](),controller[_0xab1b('0x39')]);router['post']('/mail/queues/:id/notify',auth[_0xab1b('0x8')](),controller['queueNotify'](_0xab1b('0x3a')));router[_0xab1b('0x5')]('/mail/queues/:id',auth[_0xab1b('0x8')](),controller[_0xab1b('0x3b')]);router['post'](_0xab1b('0x3c'),auth['isAuthenticated'](),controller['queueNotify'](_0xab1b('0x3d')));router[_0xab1b('0x5')](_0xab1b('0x3e'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x3f')]);router[_0xab1b('0x40')](_0xab1b('0x41'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x42')](_0xab1b('0x43')));router[_0xab1b('0x5')](_0xab1b('0x44'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x45')]);router[_0xab1b('0x40')](_0xab1b('0x46'),auth['isAuthenticated'](),controller[_0xab1b('0x42')]('openchannel'));router[_0xab1b('0x5')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0xab1b('0x47')]);router['post']('/sms/queues/:id/notify',auth[_0xab1b('0x8')](),controller[_0xab1b('0x42')](_0xab1b('0x48')));router[_0xab1b('0x40')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0xab1b('0x42')](_0xab1b('0x49')));router[_0xab1b('0x5')](_0xab1b('0x4a'),auth['isAuthenticated'](),controller[_0xab1b('0x4b')]);router[_0xab1b('0x5')](_0xab1b('0x4c'),auth[_0xab1b('0x8')](),controller[_0xab1b('0x4d')]);router['post']('/agents/:id/notify',auth[_0xab1b('0x8')](),controller[_0xab1b('0x4e')]);module[_0xab1b('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5b5bdcb..e5a1b25 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 _0xb138=['telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','create','Start','queueTransferTimeout','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','agent','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','error','code','message','result','catch','json','sendStatus','stack','name','status','isNil','rows','find','VoiceChannels','query','then','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','INTERACTION','SIP/%s','interface','internal','AgentCapacity','capacity'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xb138,0x1dd));var _0x8b13=function(_0x12ceb5,_0x38f2f1){_0x12ceb5=_0x12ceb5-0x0;var _0x350b52=_0xb138[_0x12ceb5];return _0x350b52;};'use strict';var BPromise=require(_0x8b13('0x0'));var moment=require(_0x8b13('0x1'));var _=require(_0x8b13('0x2'));var util=require(_0x8b13('0x3'));var db=require(_0x8b13('0x4'))['db'];var logger=require(_0x8b13('0x5'))(_0x8b13('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8b13('0x7')][_0x8b13('0x8')]({'port':0x232a});var mailClient=jayson[_0x8b13('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x8b13('0x7')][_0x8b13('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x5d51b1,_0x3fdf4d,_0x33d1a7){return new BPromise(function(_0x22e157,_0x498832){var _0x8570b0=_0x33d1a7?_0x33d1a7:amiClient;return _0x8570b0[_0x8b13('0x9')](_0x5d51b1,_0x3fdf4d)['then'](function(_0x53ae50){if(_0x53ae50[_0x8b13('0xa')]){if(_0x53ae50[_0x8b13('0xa')][_0x8b13('0xb')]===0x1f4){return _0x498832(_0x53ae50[_0x8b13('0xa')][_0x8b13('0xc')]);}return _0x22e157(_0x53ae50['error'][_0x8b13('0xc')]);}else{_0x22e157(_0x53ae50[_0x8b13('0xd')]);}})[_0x8b13('0xe')](function(_0x3f79d5){_0x498832(_0x3f79d5);});});}function respondWithResult(_0xb227e0,_0x1893b1){_0x1893b1=_0x1893b1||0xc8;return function(_0x58f97e){if(_0x58f97e){return _0xb227e0['status'](_0x1893b1)[_0x8b13('0xf')](_0x58f97e);}return _0xb227e0[_0x8b13('0x10')](0x194);};}function handleError(_0x5f12b5,_0x51a935){_0x51a935=_0x51a935||0x1f4;return function(_0x479773){logger[_0x8b13('0xa')](_0x479773[_0x8b13('0x11')]);if(_0x479773[_0x8b13('0x12')]){delete _0x479773[_0x8b13('0x12')];}_0x5f12b5[_0x8b13('0x13')](_0x51a935)['send'](_0x479773);};}function findById(_0x1c6c99){return function(_0xea7881){if(!_[_0x8b13('0x14')](_0x1c6c99)&&!_[_0x8b13('0x14')](_0xea7881)&&!_[_0x8b13('0x14')](_0xea7881[_0x8b13('0x15')])){return _[_0x8b13('0x16')](_0xea7881[_0x8b13('0x15')],function(_0x4989d3){return _0x4989d3['id']==_0x1c6c99;});}return null;};}exports['voiceChannels']=function(_0xae4966,_0x335709){return respondWithRpcPromise(_0x8b13('0x17'),_0xae4966[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x335709,null))[_0x8b13('0xe')](handleError(_0x335709,null));};exports['voiceChannelMixMonitor']=function(_0x1e8a48,_0x3c4d4f){return respondWithRpcPromise(_0x8b13('0x1a'),_['merge'](_0x1e8a48['query'],_0x1e8a48[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x3c4d4f,null))['catch'](handleError(_0x3c4d4f,null));};exports[_0x8b13('0x1c')]=function(_0x2c3afb,_0x37ca5f){return respondWithRpcPromise(_0x8b13('0x1d'),_[_0x8b13('0x1e')](_0x2c3afb['query'],_0x2c3afb[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x37ca5f,null))['catch'](handleError(_0x37ca5f,null));};exports[_0x8b13('0x1f')]=function(_0x4fdd1c,_0x420772){return respondWithRpcPromise(_0x8b13('0x20'),_0x4fdd1c['query'])[_0x8b13('0x19')](respondWithResult(_0x420772,null))[_0x8b13('0xe')](handleError(_0x420772,null));};exports['showVoiceQueues']=function(_0x134c5e,_0x14a739){return respondWithRpcPromise(_0x8b13('0x20'),_0x134c5e[_0x8b13('0x18')])[_0x8b13('0x19')](findById(_0x134c5e['params']['id']))[_0x8b13('0x19')](respondWithResult(_0x14a739,null))[_0x8b13('0xe')](handleError(_0x14a739,null));};exports[_0x8b13('0x21')]=function(_0x1511bf,_0x114b01){return respondWithRpcPromise(_0x8b13('0x22'),_['merge'](_0x1511bf[_0x8b13('0x23')],_0x1511bf[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x114b01,null))[_0x8b13('0xe')](handleError(_0x114b01,null));};exports[_0x8b13('0x24')]=function(_0x29946e,_0x3304bd){return respondWithRpcPromise(_0x8b13('0x25'),_[_0x8b13('0x1e')](_0x29946e['query'],_0x29946e[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x3304bd,null))[_0x8b13('0xe')](handleError(_0x3304bd,null));};exports[_0x8b13('0x26')]=function(_0x51a334,_0x4f7d91){return respondWithRpcPromise(_0x8b13('0x27'),_0x51a334['query'])['then'](respondWithResult(_0x4f7d91,null))[_0x8b13('0xe')](handleError(_0x4f7d91,null));};exports['voiceQueuesChannel']=function(_0x2ec1ab,_0x408626){return respondWithRpcPromise(_0x8b13('0x28'),_[_0x8b13('0x1e')](_0x2ec1ab[_0x8b13('0x18')],_0x2ec1ab[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x408626,null))[_0x8b13('0xe')](handleError(_0x408626,null));};exports[_0x8b13('0x29')]=function(_0x1b313d,_0x4d45bc){return respondWithRpcPromise(_0x8b13('0x2a'),_[_0x8b13('0x1e')](_0x1b313d[_0x8b13('0x18')],_0x1b313d[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x4d45bc,null))[_0x8b13('0xe')](handleError(_0x4d45bc,null));};exports[_0x8b13('0x2b')]=function(_0x241687,_0x5c67b1){return respondWithRpcPromise(_0x8b13('0x2c'),_['merge'](_0x241687[_0x8b13('0x18')],_0x241687[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x5c67b1,null))[_0x8b13('0xe')](handleError(_0x5c67b1,null));};exports[_0x8b13('0x2d')]=function(_0x327eb1,_0x4ec1a5){return respondWithRpcPromise('Outbound',_0x327eb1[_0x8b13('0x18')])['then'](respondWithResult(_0x4ec1a5,null))[_0x8b13('0xe')](handleError(_0x4ec1a5,null));};exports['outboundChannels']=function(_0x590a23,_0x3a8e06){return respondWithRpcPromise(_0x8b13('0x2e'),_0x590a23[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x3a8e06,null))['catch'](handleError(_0x3a8e06,null));};exports['agents']=function(_0x230a8c,_0x595d8d){var _0x6ba2f3;return respondWithRpcPromise(_0x8b13('0x2f'),_0x230a8c['query'])[_0x8b13('0x19')](function(_0x41d710){_0x6ba2f3=_0x41d710;return respondWithRpcPromise(_0x8b13('0x2f'),_0x230a8c[_0x8b13('0x18')],routingClient);})[_0x8b13('0x19')](function(_0x38ec75){return _[_0x8b13('0x1e')]({},_0x38ec75,_0x6ba2f3);})['then'](respondWithResult(_0x595d8d,null))['catch'](handleError(_0x595d8d,null));};exports['agentCapacity']=function(_0x3eb3c5,_0x16ec3){if(_0x3eb3c5[_0x8b13('0x23')]&&_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')]&&_0x3eb3c5[_0x8b13('0x31')]&&_0x3eb3c5['user'][_0x8b13('0x12')]){for(var _0x50e535 in _0x3eb3c5[_0x8b13('0x23')]['interaction']){if(_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x8b13('0x32')](_0x50e535)){db[_0x8b13('0x33')][_0x8b13('0x34')]({'where':{'channel':_0x50e535,'membername':_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3eb3c5['body']['interaction'][_0x50e535]&&_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x50e535][_0x8b13('0x35')]?{'$notIn':_0x3eb3c5[_0x8b13('0x23')]['interaction'][_0x50e535]}:{'$ne':null}}})['then'](function(_0x3f420d){var _0x54d19d=moment()[_0x8b13('0x36')](_0x8b13('0x37'));for(var _0x20c363=0x0,_0x28ae75=_0x3f420d[_0x8b13('0x35')];_0x20c363<_0x28ae75;_0x20c363+=0x1){_0x3f420d[_0x20c363]['updateAttributes']({'exitAt':_0x54d19d});}});for(var _0x2df766=0x0;_0x2df766<_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x50e535][_0x8b13('0x35')];_0x2df766+=0x1){db[_0x8b13('0x33')][_0x8b13('0x38')]({'where':{'channel':_0x50e535,'membername':_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x12')],'type':_0x8b13('0x39'),'uniqueid':_0x3eb3c5['body'][_0x8b13('0x30')][_0x50e535][_0x2df766],'exitAt':null},'defaults':{'channel':_0x50e535,'membername':_0x3eb3c5['user'][_0x8b13('0x12')],'interface':_[_0x8b13('0x14')](_0x3eb3c5[_0x8b13('0x31')]['interface'])?util[_0x8b13('0x36')](_0x8b13('0x3a'),_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x12')]):_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x3b')],'type':_0x8b13('0x39'),'enterAt':moment()['format'](_0x8b13('0x37')),'role':'agent','internal':_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x3c')],'uniqueid':_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x50e535][_0x2df766]}});}}}}return respondWithRpcPromise(_0x8b13('0x3d'),{'id':_0x3eb3c5[_0x8b13('0x1b')]['id'],'capacity':_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x3e')]},routingClient)[_0x8b13('0x19')](respondWithResult(_0x16ec3,null))[_0x8b13('0xe')](handleError(_0x16ec3,null));};exports[_0x8b13('0x3f')]=function(_0xddac8e,_0xd55f3b){return respondWithRpcPromise(_0x8b13('0x40'),_0xddac8e[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0xd55f3b,null))[_0x8b13('0xe')](handleError(_0xd55f3b,null));};exports['trunks']=function(_0x1699c6,_0x20e89c){return respondWithRpcPromise('Trunks',_0x1699c6[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x20e89c,null))[_0x8b13('0xe')](handleError(_0x20e89c,null));};exports[_0x8b13('0x41')]=function(_0x25cb45,_0x12549b){return respondWithRpcPromise(_0x8b13('0x42'),_0x25cb45[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x12549b,null))[_0x8b13('0xe')](handleError(_0x12549b,null));};exports[_0x8b13('0x43')]=function(_0x450b47,_0x137e8c){return respondWithRpcPromise(_0x8b13('0x44'),_0x450b47[_0x8b13('0x18')],routingClient)['then'](respondWithResult(_0x137e8c,null))[_0x8b13('0xe')](handleError(_0x137e8c,null));};exports[_0x8b13('0x45')]=function(_0x47a3fa,_0x11e8af){return respondWithRpcPromise(_0x8b13('0x44'),_0x47a3fa[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](findById(_0x47a3fa[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x11e8af,null))[_0x8b13('0xe')](handleError(_0x11e8af,null));};exports[_0x8b13('0x46')]=function(_0x46850a,_0x52e2a6){return respondWithRpcPromise(_0x8b13('0x47'),_0x46850a[_0x8b13('0x18')],routingClient)['then'](respondWithResult(_0x52e2a6,null))[_0x8b13('0xe')](handleError(_0x52e2a6,null));};exports[_0x8b13('0x48')]=function(_0x475c8d,_0xd29067){return respondWithRpcPromise('MailQueues',_0x475c8d[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](findById(_0x475c8d['params']['id']))[_0x8b13('0x19')](respondWithResult(_0xd29067,null))[_0x8b13('0xe')](handleError(_0xd29067,null));};exports[_0x8b13('0x49')]=function(_0x23a63c,_0x5d05cb){return respondWithRpcPromise(_0x8b13('0x4a'),_0x23a63c[_0x8b13('0x18')],mailClient)[_0x8b13('0x19')](respondWithResult(_0x5d05cb,null))[_0x8b13('0xe')](handleError(_0x5d05cb,null));};exports[_0x8b13('0x4b')]=function(_0x2fff4e,_0x571e89){return respondWithRpcPromise(_0x8b13('0x4c'),_0x2fff4e[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x571e89,null))['catch'](handleError(_0x571e89,null));};exports[_0x8b13('0x4d')]=function(_0x576c91,_0x122ea2){return respondWithRpcPromise(_0x8b13('0x4c'),_0x576c91['query'],routingClient)['then'](findById(_0x576c91['params']['id']))['then'](respondWithResult(_0x122ea2,null))['catch'](handleError(_0x122ea2,null));};exports[_0x8b13('0x4e')]=function(_0x1bc936,_0x574f98){return respondWithRpcPromise(_0x8b13('0x4f'),_0x1bc936['query'],routingClient)[_0x8b13('0x19')](respondWithResult(_0x574f98,null))[_0x8b13('0xe')](handleError(_0x574f98,null));};exports[_0x8b13('0x50')]=function(_0x22c4d4,_0x43f12a){return respondWithRpcPromise(_0x8b13('0x4f'),_0x22c4d4[_0x8b13('0x18')],routingClient)['then'](findById(_0x22c4d4[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x43f12a,null))[_0x8b13('0xe')](handleError(_0x43f12a,null));};exports[_0x8b13('0x51')]=function(_0x207a54,_0x11a4ba){return respondWithRpcPromise(_0x8b13('0x52'),_0x207a54[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x11a4ba,null))['catch'](handleError(_0x11a4ba,null));};exports[_0x8b13('0x53')]=function(_0x5d1174,_0x2b109c){return respondWithRpcPromise(_0x8b13('0x52'),_0x5d1174[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](findById(_0x5d1174[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x2b109c,null))['catch'](handleError(_0x2b109c,null));};exports[_0x8b13('0x54')]=function(_0x37a243,_0x5ccf4e){return respondWithRpcPromise(_0x8b13('0x55'),_0x37a243[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x5ccf4e,null))['catch'](handleError(_0x5ccf4e,null));};exports[_0x8b13('0x56')]=function(_0x215a8a,_0x15ce51){return respondWithRpcPromise(_0x8b13('0x55'),_0x215a8a['query'],routingClient)[_0x8b13('0x19')](findById(_0x215a8a[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x15ce51,null))[_0x8b13('0xe')](handleError(_0x15ce51,null));};exports[_0x8b13('0x57')]=function(_0x69e237,_0x3734e7){return respondWithRpcPromise(_0x8b13('0x58'),_0x69e237[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x3734e7,null))[_0x8b13('0xe')](handleError(_0x3734e7,null));};exports[_0x8b13('0x59')]=function(_0x2cace0,_0x2f2bc5){return respondWithRpcPromise(_0x8b13('0x5a'),_0x2cace0[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x2f2bc5,null))['catch'](handleError(_0x2f2bc5,null));};exports[_0x8b13('0x5b')]=function(_0x578469,_0x14dee4){return respondWithRpcPromise(_0x8b13('0x5c'),_0x578469[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x14dee4,null))['catch'](handleError(_0x14dee4,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x27ad64,_0x2236b5){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x27ad64[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x2236b5,null))[_0x8b13('0xe')](handleError(_0x2236b5,null));};exports[_0x8b13('0x5d')]=function(_0x7499cb,_0x12aa48){return respondWithRpcPromise(_0x8b13('0x5e'),_0x7499cb[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](function(_0x24211c){if(_0x7499cb['query'][_0x8b13('0x5f')]!==undefined){var _0x2e7477=_(_0x24211c['rows'])[_0x8b13('0x60')]([_0x7499cb[_0x8b13('0x18')]['type'],_0x7499cb[_0x8b13('0x1b')]['id']])[_0x8b13('0x61')](_0x8b13('0x62'))[_0x8b13('0x63')]()[_0x8b13('0x64')]();return _0x24211c[_0x8b13('0x15')][_0x8b13('0x60')](function(_0x1fde8b){return _0x2e7477['indexOf'](_0x1fde8b[_0x8b13('0x62')])>-0x1;});}else{return _0x24211c[_0x8b13('0x15')][_0x8b13('0x60')](function(_0x5e2b4c){return _0x5e2b4c[_0x8b13('0x62')]===parseInt(_0x7499cb['params']['id']);});}})[_0x8b13('0x19')](respondWithResult(_0x12aa48,null))[_0x8b13('0xe')](handleError(_0x12aa48,null));};exports[_0x8b13('0x65')]=function(_0x40fefa,_0xc74525){return respondWithRpcPromise(_0x8b13('0x66'),_0x40fefa[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0xc74525,null))[_0x8b13('0xe')](handleError(_0xc74525,null));};exports[_0x8b13('0x67')]=function(_0x595f45,_0x3dc732){return respondWithRpcPromise(_0x8b13('0x68'),_0x595f45[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x3dc732,null))[_0x8b13('0xe')](handleError(_0x3dc732,null));};exports[_0x8b13('0x69')]=function(_0x2c69f5,_0x9173d){return respondWithRpcPromise(_0x8b13('0x6a'),_0x2c69f5[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x9173d,null))[_0x8b13('0xe')](handleError(_0x9173d,null));};exports[_0x8b13('0x6b')]=function(_0x4bb71a){return function(_0x491bf8,_0x3870a9){var _0x512f30,_0x22e10a;var _0x38a1de=_['capitalize'](_0x4bb71a);var _0x5319a1=_0x4bb71a===_0x8b13('0x6c')?_0x8b13('0x6d'):_0x8b13('0x6e');return db[_0x38a1de+_0x8b13('0x6f')][_0x8b13('0x70')]({'raw':!![],'where':{'id':_0x491bf8['params']['id']}})[_0x8b13('0x19')](function(_0x5152d0){if(_[_0x8b13('0x14')](_0x5152d0)){throw new Error(_0x38a1de+_0x8b13('0x71'));}_0x512f30=_0x5152d0;return db[_0x38a1de+'Message'][_0x8b13('0x70')]({'where':{'id':_0x491bf8[_0x8b13('0x23')][_0x8b13('0x72')]},'include':[{'model':db[_0x38a1de+_0x8b13('0x73')],'as':_0x8b13('0x73')},{'model':db[_0x38a1de+_0x5319a1],'as':'Account'}]});})[_0x8b13('0x19')](function(_0x202c12){if(_[_0x8b13('0x14')](_0x202c12)){throw new Error(_0x38a1de+'\x20Message\x20not\x20found');}_0x22e10a=_0x202c12;return _0x202c12[_0x8b13('0x74')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3bfb06={'uniqueid':_0x4bb71a+'.'+_0x22e10a['id']+'.'+_0x22e10a[_0x8b13('0x73')]['id'],'FromUserId':_0x491bf8[_0x8b13('0x31')]['id'],'type':_0x8b13('0x75')};_0x3bfb06[_0x38a1de+_0x8b13('0x76')]=_0x22e10a['id'];_0x3bfb06[_0x38a1de+_0x8b13('0x77')]=_0x22e10a[_0x8b13('0x73')]['id'];_0x3bfb06[_0x8b13('0x78')+_0x38a1de+_0x5319a1+'Id']=_0x22e10a[_0x8b13('0x6e')]['id'];_0x3bfb06['To'+_0x38a1de+_0x8b13('0x79')]=_0x512f30['id'];return db[_0x38a1de+'TransferReport'][_0x8b13('0x7a')](_0x3bfb06);})[_0x8b13('0x19')](function(){return respondWithRpcPromise(_0x8b13('0x7b'),{'channel':_0x4bb71a,'interaction':_0x22e10a[_0x8b13('0x73')],'message':_0x22e10a,'account':_0x22e10a[_0x8b13('0x6e')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x512f30[_0x8b13('0x12')]+','+(_0x22e10a[_0x8b13('0x6e')][_0x8b13('0x7c')]||0x12c),'interval':_0x8b13('0x7d')}]},routingClient);})[_0x8b13('0x19')](respondWithResult(_0x3870a9,null))[_0x8b13('0xe')](handleError(_0x3870a9,null));};};exports['agentNotify']=function(_0x24005e,_0xd2b08b){var _0x556a92,_0x1b3a1b;if(_['isNil'](_0x24005e[_0x8b13('0x23')]['channel'])){throw new Error(_0x8b13('0x7e'));}var _0x291a30=_0x24005e[_0x8b13('0x23')][_0x8b13('0x7f')];var _0x13a7ea=_[_0x8b13('0x80')](_0x291a30);var _0x165813=_0x291a30===_0x8b13('0x6c')?'Website':_0x8b13('0x6e');return db[_0x8b13('0x81')]['findOne']({'raw':!![],'where':{'id':_0x24005e[_0x8b13('0x1b')]['id'],'role':_0x8b13('0x82')}})['then'](function(_0xa97f27){if(_[_0x8b13('0x14')](_0xa97f27)){throw new Error(_0x8b13('0x83'));}_0x556a92=_0xa97f27;return db[_0x13a7ea+_0x8b13('0x84')][_0x8b13('0x70')]({'where':{'id':_0x24005e['body']['messageId']},'include':[{'model':db[_0x13a7ea+_0x8b13('0x73')],'as':_0x8b13('0x73')},{'model':db[_0x13a7ea+_0x165813],'as':_0x8b13('0x6e')}]});})[_0x8b13('0x19')](function(_0xcafeff){if(_[_0x8b13('0x14')](_0xcafeff)){throw new Error(_0x13a7ea+_0x8b13('0x85'));}_0x1b3a1b=_0xcafeff;return _0xcafeff[_0x8b13('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8b13('0x19')](function(){var _0xfac180={'uniqueid':_0x291a30+'.'+_0x1b3a1b['id']+'.'+_0x1b3a1b[_0x8b13('0x73')]['id'],'FromUserId':_0x24005e[_0x8b13('0x31')]['id'],'type':_0x8b13('0x75'),'ToUserId':_0x556a92['id']};_0xfac180[_0x13a7ea+_0x8b13('0x76')]=_0x1b3a1b['id'];_0xfac180[_0x13a7ea+_0x8b13('0x77')]=_0x1b3a1b[_0x8b13('0x73')]['id'];_0xfac180['From'+_0x13a7ea+_0x165813+'Id']=_0x1b3a1b[_0x8b13('0x6e')]['id'];return db[_0x13a7ea+'TransferReport'][_0x8b13('0x7a')](_0xfac180);})[_0x8b13('0x19')](function(){return respondWithRpcPromise(_0x8b13('0x7b'),{'channel':_0x291a30,'interaction':_0x1b3a1b[_0x8b13('0x73')],'message':_0x1b3a1b,'account':_0x1b3a1b[_0x8b13('0x6e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8b13('0x82'),'appdata':_0x556a92[_0x8b13('0x12')]+','+(_0x1b3a1b['Account'][_0x8b13('0x86')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x8b13('0x19')](respondWithResult(_0xd2b08b,null))[_0x8b13('0xe')](handleError(_0xd2b08b,null));}; \ No newline at end of file +var _0xb4c7=['query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','user','interaction','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','format','SIP/%s','interface','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','MessageId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','messageId','queue','InteractionId','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels'];(function(_0x44ec46,_0x1a702c){var _0x1a1b2a=function(_0x2b4dbe){while(--_0x2b4dbe){_0x44ec46['push'](_0x44ec46['shift']());}};_0x1a1b2a(++_0x1a702c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2d406c,_0x3f4bc3){_0x2d406c=_0x2d406c-0x0;var _0x3fcec8=_0xb4c7[_0x2d406c];return _0x3fcec8;};'use strict';var BPromise=require(_0x7b4c('0x0'));var moment=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));var util=require(_0x7b4c('0x3'));var db=require(_0x7b4c('0x4'))['db'];var logger=require('../../config/logger')(_0x7b4c('0x5'));var jayson=require(_0x7b4c('0x6'));var amiClient=jayson[_0x7b4c('0x7')][_0x7b4c('0x8')]({'port':0x232a});var mailClient=jayson[_0x7b4c('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x7b4c('0x7')][_0x7b4c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){var _0x433aa2=_0x2d7b7e?_0x2d7b7e:amiClient;return _0x433aa2[_0x7b4c('0x9')](_0x2dd5c7,_0x4bf85d)[_0x7b4c('0xa')](function(_0x237e28){if(_0x237e28[_0x7b4c('0xb')]){if(_0x237e28[_0x7b4c('0xb')][_0x7b4c('0xc')]===0x1f4){return _0x570daa(_0x237e28[_0x7b4c('0xb')][_0x7b4c('0xd')]);}return _0x21687f(_0x237e28[_0x7b4c('0xb')]['message']);}else{_0x21687f(_0x237e28['result']);}})[_0x7b4c('0xe')](function(_0x18342b){_0x570daa(_0x18342b);});});}function respondWithResult(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xc8;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0xf')](_0x1722ad)[_0x7b4c('0x10')](_0x3e1558);}return _0x38656b[_0x7b4c('0x11')](0x194);};}function handleError(_0x25b90b,_0x387488){_0x387488=_0x387488||0x1f4;return function(_0x593a19){logger[_0x7b4c('0xb')](_0x593a19[_0x7b4c('0x12')]);if(_0x593a19[_0x7b4c('0x13')]){delete _0x593a19[_0x7b4c('0x13')];}_0x25b90b[_0x7b4c('0xf')](_0x387488)[_0x7b4c('0x14')](_0x593a19);};}function findById(_0x1642e1){return function(_0x22c409){if(!_['isNil'](_0x1642e1)&&!_[_0x7b4c('0x15')](_0x22c409)&&!_[_0x7b4c('0x15')](_0x22c409[_0x7b4c('0x16')])){return _[_0x7b4c('0x17')](_0x22c409['rows'],function(_0x3ce10c){return _0x3ce10c['id']==_0x1642e1;});}return null;};}exports[_0x7b4c('0x18')]=function(_0x32110e,_0x380b79){return respondWithRpcPromise(_0x7b4c('0x19'),_0x32110e[_0x7b4c('0x1a')])[_0x7b4c('0xa')](respondWithResult(_0x380b79,null))[_0x7b4c('0xe')](handleError(_0x380b79,null));};exports[_0x7b4c('0x1b')]=function(_0x55e3df,_0x1f06ec){return respondWithRpcPromise(_0x7b4c('0x1c'),_[_0x7b4c('0x1d')](_0x55e3df[_0x7b4c('0x1a')],_0x55e3df[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x1f06ec,null))[_0x7b4c('0xe')](handleError(_0x1f06ec,null));};exports[_0x7b4c('0x1f')]=function(_0x2ab9e1,_0x2c267c){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x7b4c('0x1d')](_0x2ab9e1[_0x7b4c('0x1a')],_0x2ab9e1[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x2c267c,null))[_0x7b4c('0xe')](handleError(_0x2c267c,null));};exports[_0x7b4c('0x20')]=function(_0x37c059,_0x459eb4){return respondWithRpcPromise(_0x7b4c('0x21'),_0x37c059[_0x7b4c('0x1a')])[_0x7b4c('0xa')](respondWithResult(_0x459eb4,null))[_0x7b4c('0xe')](handleError(_0x459eb4,null));};exports[_0x7b4c('0x22')]=function(_0x501f75,_0x27f361){return respondWithRpcPromise(_0x7b4c('0x21'),_0x501f75[_0x7b4c('0x1a')])[_0x7b4c('0xa')](findById(_0x501f75[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x27f361,null))[_0x7b4c('0xe')](handleError(_0x27f361,null));};exports[_0x7b4c('0x23')]=function(_0x3e4a46,_0x9a799b){return respondWithRpcPromise(_0x7b4c('0x24'),_[_0x7b4c('0x1d')](_0x3e4a46[_0x7b4c('0x25')],_0x3e4a46[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x9a799b,null))[_0x7b4c('0xe')](handleError(_0x9a799b,null));};exports[_0x7b4c('0x26')]=function(_0xce5781,_0x9d3d31){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0xce5781['query'],_0xce5781[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x9d3d31,null))[_0x7b4c('0xe')](handleError(_0x9d3d31,null));};exports[_0x7b4c('0x27')]=function(_0x498391,_0x6e66e3){return respondWithRpcPromise(_0x7b4c('0x28'),_0x498391['query'])[_0x7b4c('0xa')](respondWithResult(_0x6e66e3,null))['catch'](handleError(_0x6e66e3,null));};exports[_0x7b4c('0x29')]=function(_0x3b9149,_0x159001){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x7b4c('0x1d')](_0x3b9149[_0x7b4c('0x1a')],_0x3b9149['params']))[_0x7b4c('0xa')](respondWithResult(_0x159001,null))[_0x7b4c('0xe')](handleError(_0x159001,null));};exports[_0x7b4c('0x2a')]=function(_0x2e0835,_0x56ff38){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x7b4c('0x1d')](_0x2e0835[_0x7b4c('0x1a')],_0x2e0835['params']))[_0x7b4c('0xa')](respondWithResult(_0x56ff38,null))['catch'](handleError(_0x56ff38,null));};exports['voiceQueuesChannelRedirect']=function(_0x11ca38,_0x16ae89){return respondWithRpcPromise(_0x7b4c('0x2b'),_[_0x7b4c('0x1d')](_0x11ca38['query'],_0x11ca38[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x16ae89,null))[_0x7b4c('0xe')](handleError(_0x16ae89,null));};exports[_0x7b4c('0x2c')]=function(_0x346e0c,_0xddd16){return respondWithRpcPromise(_0x7b4c('0x2d'),_0x346e0c['query'])['then'](respondWithResult(_0xddd16,null))[_0x7b4c('0xe')](handleError(_0xddd16,null));};exports[_0x7b4c('0x2e')]=function(_0x31ef1e,_0x123a3a){return respondWithRpcPromise(_0x7b4c('0x2f'),_0x31ef1e['query'])[_0x7b4c('0xa')](respondWithResult(_0x123a3a,null))[_0x7b4c('0xe')](handleError(_0x123a3a,null));};exports[_0x7b4c('0x30')]=function(_0x26346a,_0x22f71b){var _0x25659d;return respondWithRpcPromise(_0x7b4c('0x31'),_0x26346a[_0x7b4c('0x1a')])[_0x7b4c('0xa')](function(_0x54cd10){_0x25659d=_0x54cd10;return respondWithRpcPromise(_0x7b4c('0x31'),_0x26346a['query'],routingClient);})[_0x7b4c('0xa')](function(_0x4dc71f){return _[_0x7b4c('0x1d')]({},_0x4dc71f,_0x25659d);})[_0x7b4c('0xa')](respondWithResult(_0x22f71b,null))['catch'](handleError(_0x22f71b,null));};exports['agentCapacity']=function(_0x354578,_0x4314b6){if(_0x354578[_0x7b4c('0x25')]&&_0x354578[_0x7b4c('0x25')]['interaction']&&_0x354578[_0x7b4c('0x32')]&&_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')]){for(var _0x5d4ed8 in _0x354578[_0x7b4c('0x25')]['interaction']){if(_0x354578['body'][_0x7b4c('0x33')]['hasOwnProperty'](_0x5d4ed8)){db[_0x7b4c('0x34')][_0x7b4c('0x35')]({'where':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'type':_0x7b4c('0x36'),'exitAt':null,'uniqueid':_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8]&&_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8]['length']?{'$notIn':_0x354578[_0x7b4c('0x25')]['interaction'][_0x5d4ed8]}:{'$ne':null}}})['then'](function(_0x23372c){var _0x1f1653=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x255cca=0x0,_0x2ce694=_0x23372c[_0x7b4c('0x37')];_0x255cca<_0x2ce694;_0x255cca+=0x1){_0x23372c[_0x255cca][_0x7b4c('0x38')]({'exitAt':_0x1f1653});}});for(var _0x8ebf9b=0x0;_0x8ebf9b<_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8][_0x7b4c('0x37')];_0x8ebf9b+=0x1){db['MemberReport'][_0x7b4c('0x39')]({'where':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'type':_0x7b4c('0x36'),'uniqueid':_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8][_0x8ebf9b],'exitAt':null},'defaults':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'interface':_[_0x7b4c('0x15')](_0x354578['user']['interface'])?util[_0x7b4c('0x3a')](_0x7b4c('0x3b'),_0x354578[_0x7b4c('0x32')]['name']):_0x354578[_0x7b4c('0x32')][_0x7b4c('0x3c')],'type':'INTERACTION','enterAt':moment()[_0x7b4c('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x7b4c('0x3d'),'internal':_0x354578['user'][_0x7b4c('0x3e')],'uniqueid':_0x354578['body'][_0x7b4c('0x33')][_0x5d4ed8][_0x8ebf9b]}});}}}}return respondWithRpcPromise(_0x7b4c('0x3f'),{'id':_0x354578['params']['id'],'capacity':_0x354578['body'][_0x7b4c('0x40')]},routingClient)[_0x7b4c('0xa')](respondWithResult(_0x4314b6,null))[_0x7b4c('0xe')](handleError(_0x4314b6,null));};exports['telephones']=function(_0x56233b,_0x2fc5b5){return respondWithRpcPromise(_0x7b4c('0x41'),_0x56233b['query'])['then'](respondWithResult(_0x2fc5b5,null))[_0x7b4c('0xe')](handleError(_0x2fc5b5,null));};exports[_0x7b4c('0x42')]=function(_0x166fd1,_0x4b2207){return respondWithRpcPromise(_0x7b4c('0x43'),_0x166fd1[_0x7b4c('0x1a')])['then'](respondWithResult(_0x4b2207,null))['catch'](handleError(_0x4b2207,null));};exports[_0x7b4c('0x44')]=function(_0x4d8491,_0x59db20){return respondWithRpcPromise(_0x7b4c('0x45'),_0x4d8491['query'])['then'](respondWithResult(_0x59db20,null))[_0x7b4c('0xe')](handleError(_0x59db20,null));};exports[_0x7b4c('0x46')]=function(_0xde9f5,_0x17af17){return respondWithRpcPromise('ChatQueues',_0xde9f5['query'],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x17af17,null))[_0x7b4c('0xe')](handleError(_0x17af17,null));};exports[_0x7b4c('0x47')]=function(_0x59b358,_0x255262){return respondWithRpcPromise(_0x7b4c('0x48'),_0x59b358[_0x7b4c('0x1a')],routingClient)['then'](findById(_0x59b358[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x255262,null))['catch'](handleError(_0x255262,null));};exports[_0x7b4c('0x49')]=function(_0x186e7d,_0x30de26){return respondWithRpcPromise(_0x7b4c('0x4a'),_0x186e7d[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x30de26,null))[_0x7b4c('0xe')](handleError(_0x30de26,null));};exports['showMailQueues']=function(_0x4443d0,_0x2dc79a){return respondWithRpcPromise('MailQueues',_0x4443d0[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x4443d0[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x2dc79a,null))['catch'](handleError(_0x2dc79a,null));};exports[_0x7b4c('0x4b')]=function(_0x4e84a3,_0x542b85){return respondWithRpcPromise(_0x7b4c('0x4c'),_0x4e84a3[_0x7b4c('0x1a')],mailClient)[_0x7b4c('0xa')](respondWithResult(_0x542b85,null))[_0x7b4c('0xe')](handleError(_0x542b85,null));};exports[_0x7b4c('0x4d')]=function(_0x5b24f6,_0x4fcc9d){return respondWithRpcPromise(_0x7b4c('0x4e'),_0x5b24f6[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x4fcc9d,null))['catch'](handleError(_0x4fcc9d,null));};exports[_0x7b4c('0x4f')]=function(_0xc4dae0,_0x36fc5d){return respondWithRpcPromise('OpenchannelQueues',_0xc4dae0[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0xc4dae0[_0x7b4c('0x1e')]['id']))['then'](respondWithResult(_0x36fc5d,null))[_0x7b4c('0xe')](handleError(_0x36fc5d,null));};exports[_0x7b4c('0x50')]=function(_0x4ac03e,_0x1c64d5){return respondWithRpcPromise('SmsQueues',_0x4ac03e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x1c64d5,null))[_0x7b4c('0xe')](handleError(_0x1c64d5,null));};exports['showSmsQueues']=function(_0x5af2af,_0x237921){return respondWithRpcPromise(_0x7b4c('0x51'),_0x5af2af[_0x7b4c('0x1a')],routingClient)['then'](findById(_0x5af2af[_0x7b4c('0x1e')]['id']))['then'](respondWithResult(_0x237921,null))[_0x7b4c('0xe')](handleError(_0x237921,null));};exports[_0x7b4c('0x52')]=function(_0x1315bd,_0x5f3ed5){return respondWithRpcPromise(_0x7b4c('0x53'),_0x1315bd['query'],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x5f3ed5,null))[_0x7b4c('0xe')](handleError(_0x5f3ed5,null));};exports['showWhatsappQueues']=function(_0x7a38e,_0x13a882){return respondWithRpcPromise(_0x7b4c('0x53'),_0x7a38e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x7a38e[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x13a882,null))[_0x7b4c('0xe')](handleError(_0x13a882,null));};exports['faxQueues']=function(_0x10d5b3,_0x2dc9a4){return respondWithRpcPromise(_0x7b4c('0x54'),_0x10d5b3[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x2dc9a4,null))[_0x7b4c('0xe')](handleError(_0x2dc9a4,null));};exports[_0x7b4c('0x55')]=function(_0x2a5f6e,_0x34fce4){return respondWithRpcPromise(_0x7b4c('0x54'),_0x2a5f6e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x2a5f6e[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x34fce4,null))[_0x7b4c('0xe')](handleError(_0x34fce4,null));};exports[_0x7b4c('0x56')]=function(_0x168aa1,_0x36c7d9){return respondWithRpcPromise(_0x7b4c('0x57'),_0x168aa1[_0x7b4c('0x1a')])['then'](respondWithResult(_0x36c7d9,null))['catch'](handleError(_0x36c7d9,null));};exports[_0x7b4c('0x58')]=function(_0x15033e,_0x50069b){return respondWithRpcPromise(_0x7b4c('0x59'),_0x15033e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x50069b,null))[_0x7b4c('0xe')](handleError(_0x50069b,null));};exports[_0x7b4c('0x5a')]=function(_0x15df66,_0x22a254){return respondWithRpcPromise(_0x7b4c('0x5b'),_0x15df66[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x22a254,null))[_0x7b4c('0xe')](handleError(_0x22a254,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x35067f,_0x5477e3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x35067f[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x5477e3,null))['catch'](handleError(_0x5477e3,null));};exports[_0x7b4c('0x5c')]=function(_0x2d17ed,_0x328948){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2d17ed[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](function(_0x10e789){if(_0x2d17ed[_0x7b4c('0x1a')][_0x7b4c('0x5d')]!==undefined){var _0x2837aa=_(_0x10e789[_0x7b4c('0x16')])[_0x7b4c('0x5e')]([_0x2d17ed[_0x7b4c('0x1a')][_0x7b4c('0x5d')],_0x2d17ed[_0x7b4c('0x1e')]['id']])[_0x7b4c('0x5f')](_0x7b4c('0x60'))[_0x7b4c('0x61')]()['value']();return _0x10e789[_0x7b4c('0x16')][_0x7b4c('0x5e')](function(_0x35e94a){return _0x2837aa[_0x7b4c('0x62')](_0x35e94a['queue_id'])>-0x1;});}else{return _0x10e789[_0x7b4c('0x16')][_0x7b4c('0x5e')](function(_0x149d53){return _0x149d53[_0x7b4c('0x60')]===parseInt(_0x2d17ed[_0x7b4c('0x1e')]['id']);});}})[_0x7b4c('0xa')](respondWithResult(_0x328948,null))[_0x7b4c('0xe')](handleError(_0x328948,null));};exports['smsQueuesWaitingInteractions']=function(_0x11c809,_0x108c99){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x11c809['query'],routingClient)['then'](respondWithResult(_0x108c99,null))[_0x7b4c('0xe')](handleError(_0x108c99,null));};exports[_0x7b4c('0x63')]=function(_0x24d4f9,_0x19804d){return respondWithRpcPromise(_0x7b4c('0x64'),_0x24d4f9[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x19804d,null))[_0x7b4c('0xe')](handleError(_0x19804d,null));};exports[_0x7b4c('0x65')]=function(_0x2bc889,_0x83e8bb){return respondWithRpcPromise(_0x7b4c('0x66'),_0x2bc889[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x83e8bb,null))[_0x7b4c('0xe')](handleError(_0x83e8bb,null));};exports[_0x7b4c('0x67')]=function(_0x2afaa0){return function(_0x5dc6e6,_0x39c01d){var _0x392656,_0x1faa6f;var _0x3999bf=_[_0x7b4c('0x68')](_0x2afaa0);var _0x57f1a0=_0x2afaa0===_0x7b4c('0x69')?_0x7b4c('0x6a'):_0x7b4c('0x6b');return db[_0x3999bf+_0x7b4c('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x5dc6e6[_0x7b4c('0x1e')]['id']}})[_0x7b4c('0xa')](function(_0xdfa0bc){if(_['isNil'](_0xdfa0bc)){throw new Error(_0x3999bf+_0x7b4c('0x6d'));}_0x392656=_0xdfa0bc;return db[_0x3999bf+_0x7b4c('0x6e')][_0x7b4c('0x6f')]({'where':{'id':_0x5dc6e6[_0x7b4c('0x25')]['messageId']},'include':[{'model':db[_0x3999bf+_0x7b4c('0x70')],'as':_0x7b4c('0x70')},{'model':db[_0x3999bf+_0x57f1a0],'as':_0x7b4c('0x6b')}]});})[_0x7b4c('0xa')](function(_0x50c382){if(_[_0x7b4c('0x15')](_0x50c382)){throw new Error(_0x3999bf+'\x20Message\x20not\x20found');}_0x1faa6f=_0x50c382;return _0x50c382[_0x7b4c('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x24690a={'uniqueid':_0x2afaa0+'.'+_0x1faa6f['id']+'.'+_0x1faa6f[_0x7b4c('0x70')]['id'],'FromUserId':_0x5dc6e6[_0x7b4c('0x32')]['id'],'type':'queue'};_0x24690a[_0x3999bf+_0x7b4c('0x72')]=_0x1faa6f['id'];_0x24690a[_0x3999bf+'InteractionId']=_0x1faa6f[_0x7b4c('0x70')]['id'];_0x24690a[_0x7b4c('0x73')+_0x3999bf+_0x57f1a0+'Id']=_0x1faa6f['Account']['id'];_0x24690a['To'+_0x3999bf+_0x7b4c('0x74')]=_0x392656['id'];return db[_0x3999bf+_0x7b4c('0x75')][_0x7b4c('0x76')](_0x24690a);})[_0x7b4c('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x2afaa0,'interaction':_0x1faa6f[_0x7b4c('0x70')],'message':_0x1faa6f,'account':_0x1faa6f[_0x7b4c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x392656[_0x7b4c('0x13')]+','+(_0x1faa6f[_0x7b4c('0x6b')][_0x7b4c('0x77')]||0x12c),'interval':_0x7b4c('0x78')}]},routingClient);})[_0x7b4c('0xa')](respondWithResult(_0x39c01d,null))[_0x7b4c('0xe')](handleError(_0x39c01d,null));};};exports[_0x7b4c('0x79')]=function(_0x4e9781,_0x5ec399){var _0xdb202,_0x433d74;if(_[_0x7b4c('0x15')](_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x228b2b=_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7a')];var _0x331db1=_['capitalize'](_0x228b2b);var _0x56ba6f=_0x228b2b===_0x7b4c('0x69')?_0x7b4c('0x6a'):_0x7b4c('0x6b');return db[_0x7b4c('0x7b')][_0x7b4c('0x6f')]({'raw':!![],'where':{'id':_0x4e9781['params']['id'],'role':_0x7b4c('0x3d')}})[_0x7b4c('0xa')](function(_0x450eca){if(_[_0x7b4c('0x15')](_0x450eca)){throw new Error('Agent\x20not\x20found');}_0xdb202=_0x450eca;return db[_0x331db1+'Message']['findOne']({'where':{'id':_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7c')]},'include':[{'model':db[_0x331db1+_0x7b4c('0x70')],'as':'Interaction'},{'model':db[_0x331db1+_0x56ba6f],'as':_0x7b4c('0x6b')}]});})['then'](function(_0x530030){if(_[_0x7b4c('0x15')](_0x530030)){throw new Error(_0x331db1+'\x20Message\x20not\x20found');}_0x433d74=_0x530030;return _0x530030[_0x7b4c('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7b4c('0xa')](function(){var _0x5e444a={'uniqueid':_0x228b2b+'.'+_0x433d74['id']+'.'+_0x433d74['Interaction']['id'],'FromUserId':_0x4e9781[_0x7b4c('0x32')]['id'],'type':_0x7b4c('0x7d'),'ToUserId':_0xdb202['id']};_0x5e444a[_0x331db1+_0x7b4c('0x72')]=_0x433d74['id'];_0x5e444a[_0x331db1+_0x7b4c('0x7e')]=_0x433d74['Interaction']['id'];_0x5e444a['From'+_0x331db1+_0x56ba6f+'Id']=_0x433d74[_0x7b4c('0x6b')]['id'];return db[_0x331db1+_0x7b4c('0x75')][_0x7b4c('0x76')](_0x5e444a);})[_0x7b4c('0xa')](function(){return respondWithRpcPromise(_0x7b4c('0x7f'),{'channel':_0x228b2b,'interaction':_0x433d74[_0x7b4c('0x70')],'message':_0x433d74,'account':_0x433d74[_0x7b4c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0xdb202[_0x7b4c('0x13')]+','+(_0x433d74[_0x7b4c('0x6b')][_0x7b4c('0x80')]||0x12c),'interval':_0x7b4c('0x78')}]},routingClient);})[_0x7b4c('0xa')](respondWithResult(_0x5ec399,null))[_0x7b4c('0xe')](handleError(_0x5ec399,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8aff14d..2aad9c4 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 _0x796f=['get','isAuthenticated','show','/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller'];(function(_0x38b8c6,_0x541f91){var _0x3104d6=function(_0x4215ee){while(--_0x4215ee){_0x38b8c6['push'](_0x38b8c6['shift']());}};_0x3104d6(++_0x541f91);}(_0x796f,0x1f1));var _0xf796=function(_0x5193cd,_0xcd459f){_0x5193cd=_0x5193cd-0x0;var _0x264954=_0x796f[_0x5193cd];return _0x264954;};'use strict';var multer=require(_0xf796('0x0'));var util=require(_0xf796('0x1'));var path=require('path');var timeout=require(_0xf796('0x2'));var express=require(_0xf796('0x3'));var router=express[_0xf796('0x4')]();var fs_extra=require(_0xf796('0x5'));var auth=require(_0xf796('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf796('0x7'));var controller=require(_0xf796('0x8'));router[_0xf796('0x9')]('/',auth[_0xf796('0xa')](),controller['index']);router[_0xf796('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf796('0xb')]);router['get'](_0xf796('0xc'),auth[_0xf796('0xa')](),controller[_0xf796('0xd')]);router[_0xf796('0xe')]('/',auth[_0xf796('0xa')](),controller[_0xf796('0xf')]);router[_0xf796('0x10')](_0xf796('0x11'),auth[_0xf796('0xa')](),controller[_0xf796('0x12')]);router[_0xf796('0x13')](_0xf796('0x11'),auth[_0xf796('0xa')](),controller[_0xf796('0x14')]);module[_0xf796('0x15')]=router; \ No newline at end of file +var _0x8816=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./schedule.controller','isAuthenticated','get','/:id','/:id/run','run','post','put','update','destroy','exports','multer','util','path'];(function(_0x34b27c,_0x21a430){var _0x1fc94a=function(_0x6a5da6){while(--_0x6a5da6){_0x34b27c['push'](_0x34b27c['shift']());}};_0x1fc94a(++_0x21a430);}(_0x8816,0x11a));var _0x6881=function(_0x59a017,_0x473279){_0x59a017=_0x59a017-0x0;var _0x324ed4=_0x8816[_0x59a017];return _0x324ed4;};'use strict';var multer=require(_0x6881('0x0'));var util=require(_0x6881('0x1'));var path=require(_0x6881('0x2'));var timeout=require(_0x6881('0x3'));var express=require(_0x6881('0x4'));var router=express[_0x6881('0x5')]();var fs_extra=require(_0x6881('0x6'));var auth=require(_0x6881('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6881('0x8'));router['get']('/',auth[_0x6881('0x9')](),controller['index']);router[_0x6881('0xa')](_0x6881('0xb'),auth[_0x6881('0x9')](),controller['show']);router[_0x6881('0xa')](_0x6881('0xc'),auth[_0x6881('0x9')](),controller[_0x6881('0xd')]);router[_0x6881('0xe')]('/',auth[_0x6881('0x9')](),controller['create']);router[_0x6881('0xf')](_0x6881('0xb'),auth[_0x6881('0x9')](),controller[_0x6881('0x10')]);router['delete'](_0x6881('0xb'),auth['isAuthenticated'](),controller[_0x6881('0x11')]);module[_0x6881('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 531ac06..fddcef4 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 _0xdad9=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','days','hours','minutes','pdf','xlsx','csv','custom','default','TEXT','exports'];(function(_0x2bc2a2,_0x51e95f){var _0x20de67=function(_0x27f2d2){while(--_0x27f2d2){_0x2bc2a2['push'](_0x2bc2a2['shift']());}};_0x20de67(++_0x51e95f);}(_0xdad9,0xc5));var _0x9dad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdad9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x9dad('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9dad('0x1')]},'active':{'type':Sequelize[_0x9dad('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9dad('0x1')],'allowNull':![],'defaultValue':_0x9dad('0x3')},'startAt':{'type':Sequelize[_0x9dad('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9dad('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9dad('0x6')](_0x9dad('0x7'),'quarters',_0x9dad('0x8'),'weeks',_0x9dad('0x9'),_0x9dad('0xa'),_0x9dad('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x9dad('0x6')]('csv',_0x9dad('0xc'),_0x9dad('0xd')),'allowNull':![],'defaultValue':_0x9dad('0xe')},'type':{'type':Sequelize[_0x9dad('0x6')](_0x9dad('0xf'),_0x9dad('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x9dad('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9dad('0x1')]},'cc':{'type':Sequelize[_0x9dad('0x11')]},'bcc':{'type':Sequelize[_0x9dad('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x9dad('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe9df=['days','hours','xlsx','csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0x202f5c,_0x5da5d7){var _0x45ad06=function(_0x29059b){while(--_0x29059b){_0x202f5c['push'](_0x202f5c['shift']());}};_0x45ad06(++_0x5da5d7);}(_0xe9df,0x72));var _0xfe9d=function(_0x1b2bc4,_0x3d0435){_0x1b2bc4=_0x1b2bc4-0x0;var _0x5c527d=_0xe9df[_0x1b2bc4];return _0x5c527d;};'use strict';var Sequelize=require(_0xfe9d('0x0'));module[_0xfe9d('0x1')]={'name':{'type':Sequelize[_0xfe9d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xfe9d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xfe9d('0x2')],'allowNull':![],'defaultValue':_0xfe9d('0x4')},'startAt':{'type':Sequelize[_0xfe9d('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfe9d('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xfe9d('0x7')](_0xfe9d('0x8'),_0xfe9d('0x9'),_0xfe9d('0xa'),_0xfe9d('0xb'),_0xfe9d('0xc'),_0xfe9d('0xd'),'minutes'),'allowNull':![],'defaultValue':_0xfe9d('0xc')},'output':{'type':Sequelize[_0xfe9d('0x7')]('csv','pdf',_0xfe9d('0xe')),'allowNull':![],'defaultValue':_0xfe9d('0xf')},'type':{'type':Sequelize[_0xfe9d('0x7')](_0xfe9d('0x10'),'default'),'allowNull':![],'defaultValue':_0xfe9d('0x10')},'sendMail':{'type':Sequelize[_0xfe9d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xfe9d('0x2')]},'cc':{'type':Sequelize[_0xfe9d('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xfe9d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 95dc457..23743f9 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 _0x59ae=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','end','sendStatus','error','stack','name','send','index','Schedule','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','../../config/schedule','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0x59ae,0xf4));var _0xe59a=function(_0x4569c5,_0x3ff542){_0x4569c5=_0x4569c5-0x0;var _0x55865f=_0x59ae[_0x4569c5];return _0x55865f;};'use strict';var emlformat=require(_0xe59a('0x0'));var rimraf=require(_0xe59a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe59a('0x2'));var rp=require('request-promise');var moment=require(_0xe59a('0x3'));var BPromise=require(_0xe59a('0x4'));var Mustache=require(_0xe59a('0x5'));var util=require(_0xe59a('0x6'));var path=require('path');var sox=require(_0xe59a('0x7'));var csv=require(_0xe59a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe59a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe59a('0xa'));var jsforce=require(_0xe59a('0xb'));var deskjs=require(_0xe59a('0xc'));var toCsv=require(_0xe59a('0x8'));var querystring=require(_0xe59a('0xd'));var Papa=require(_0xe59a('0xe'));var Redis=require(_0xe59a('0xf'));var authService=require(_0xe59a('0x10'));var qs=require(_0xe59a('0x11'));var as=require(_0xe59a('0x12'));var hardwareService=require(_0xe59a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe59a('0x14'));var config=require(_0xe59a('0x15'));var licenseUtil=require(_0xe59a('0x16'));var db=require(_0xe59a('0x17'))['db'];function respondWithStatusCode(_0x2a4230,_0x48271c){_0x48271c=_0x48271c||0xcc;return function(_0x56e583){if(_0x56e583){return _0x2a4230['sendStatus'](_0x48271c);}return _0x2a4230[_0xe59a('0x18')](_0x48271c)['end']();};}function respondWithResult(_0x1dff98,_0x2bf5f9){_0x2bf5f9=_0x2bf5f9||0xc8;return function(_0x2f3f76){if(_0x2f3f76){return _0x1dff98[_0xe59a('0x18')](_0x2bf5f9)[_0xe59a('0x19')](_0x2f3f76);}};}function respondWithFilteredResult(_0x464dd1,_0x23af8a){return function(_0x4e1e60){if(_0x4e1e60){var _0x420a2c=typeof _0x23af8a[_0xe59a('0x1a')]==='undefined'&&typeof _0x23af8a[_0xe59a('0x1b')]===_0xe59a('0x1c');var _0x3cca31=_0x4e1e60[_0xe59a('0x1d')];var _0x1d11b8=_0x420a2c?0x0:_0x23af8a[_0xe59a('0x1a')];var _0x14072b=_0x420a2c?_0x4e1e60[_0xe59a('0x1d')]:_0x23af8a['offset']+_0x23af8a[_0xe59a('0x1b')];var _0x47625d;if(_0x14072b>=_0x3cca31){_0x14072b=_0x3cca31;_0x47625d=0xc8;}else{_0x47625d=0xce;}_0x464dd1[_0xe59a('0x18')](_0x47625d);return _0x464dd1['set'](_0xe59a('0x1e'),_0x1d11b8+'-'+_0x14072b+'/'+_0x3cca31)['json'](_0x4e1e60);}return null;};}function patchUpdates(_0xe42d93){return function(_0x37e218){try{jsonpatch[_0xe59a('0x1f')](_0x37e218,_0xe42d93,!![]);}catch(_0x3e23cc){return BPromise[_0xe59a('0x20')](_0x3e23cc);}return _0x37e218[_0xe59a('0x21')]();};}function saveUpdates(_0x5c28fe,_0x47fbba){return function(_0x1225be){if(_0x1225be){return _0x1225be['update'](_0x5c28fe)[_0xe59a('0x22')](function(_0x244a46){return _0x244a46;});}return null;};}function removeEntity(_0x1f0028,_0x5b4a3d){return function(_0x110009){if(_0x110009){return _0x110009[_0xe59a('0x23')]()[_0xe59a('0x22')](function(){var _0x2354bf=_0x110009[_0xe59a('0x24')]({'plain':!![]});var _0x8a826=_0xe59a('0x25');return db[_0xe59a('0x26')]['destroy']({'where':{'type':_0x8a826,'resourceId':_0x2354bf['id']}})['then'](function(){return _0x110009;});})['then'](function(){_0x1f0028[_0xe59a('0x18')](0xcc)[_0xe59a('0x27')]();});}};}function handleEntityNotFound(_0x32d016,_0x68d38d){return function(_0x7ff7c2){if(!_0x7ff7c2){_0x32d016[_0xe59a('0x28')](0x194);}return _0x7ff7c2;};}function handleError(_0xd04213,_0x3991eb){_0x3991eb=_0x3991eb||0x1f4;return function(_0x16ea49){logger[_0xe59a('0x29')](_0x16ea49[_0xe59a('0x2a')]);if(_0x16ea49[_0xe59a('0x2b')]){delete _0x16ea49[_0xe59a('0x2b')];}_0xd04213[_0xe59a('0x18')](_0x3991eb)[_0xe59a('0x2c')](_0x16ea49);};}exports[_0xe59a('0x2d')]=function(_0x5b581c,_0x295a67){var _0x3cfd7a={},_0x94e52a={},_0x148d2f={'count':0x0,'rows':[]};var _0x92c8a6=_['map'](db[_0xe59a('0x2e')]['rawAttributes'],function(_0x37eddd){return{'name':_0x37eddd[_0xe59a('0x2f')],'type':_0x37eddd[_0xe59a('0x30')][_0xe59a('0x31')]};});_0x94e52a[_0xe59a('0x32')]=_[_0xe59a('0x33')](_0x92c8a6,_0xe59a('0x2b'));_0x94e52a[_0xe59a('0x34')]=_[_0xe59a('0x35')](_0x5b581c[_0xe59a('0x34')]);_0x94e52a[_0xe59a('0x36')]=_[_0xe59a('0x37')](_0x94e52a['model'],_0x94e52a[_0xe59a('0x34')]);_0x3cfd7a[_0xe59a('0x38')]=_[_0xe59a('0x37')](_0x94e52a[_0xe59a('0x32')],qs[_0xe59a('0x39')](_0x5b581c[_0xe59a('0x34')][_0xe59a('0x39')]));_0x3cfd7a[_0xe59a('0x38')]=_0x3cfd7a[_0xe59a('0x38')][_0xe59a('0x3a')]?_0x3cfd7a[_0xe59a('0x38')]:_0x94e52a['model'];if(!_0x5b581c[_0xe59a('0x34')]['hasOwnProperty'](_0xe59a('0x3b'))){_0x3cfd7a['limit']=qs[_0xe59a('0x1b')](_0x5b581c[_0xe59a('0x34')][_0xe59a('0x1b')]);_0x3cfd7a[_0xe59a('0x1a')]=qs[_0xe59a('0x1a')](_0x5b581c[_0xe59a('0x34')][_0xe59a('0x1a')]);}_0x3cfd7a[_0xe59a('0x3c')]=qs[_0xe59a('0x3d')](_0x5b581c[_0xe59a('0x34')]['sort']);_0x3cfd7a[_0xe59a('0x3e')]=qs[_0xe59a('0x36')](_[_0xe59a('0x3f')](_0x5b581c[_0xe59a('0x34')],_0x94e52a[_0xe59a('0x36')]),_0x92c8a6);if(_0x5b581c[_0xe59a('0x34')][_0xe59a('0x40')]){_0x3cfd7a[_0xe59a('0x3e')]=_['merge'](_0x3cfd7a[_0xe59a('0x3e')],{'$or':_[_0xe59a('0x33')](_0x92c8a6,function(_0x1b3205){if(_0x1b3205['type']!==_0xe59a('0x41')){var _0x294510={};_0x294510[_0x1b3205[_0xe59a('0x2b')]]={'$like':'%'+_0x5b581c[_0xe59a('0x34')]['filter']+'%'};return _0x294510;}})});}_0x3cfd7a=_['merge']({},_0x3cfd7a,_0x5b581c[_0xe59a('0x42')]);var _0x4e7f75={'where':_0x3cfd7a[_0xe59a('0x3e')]};return db['Schedule'][_0xe59a('0x1d')](_0x4e7f75)[_0xe59a('0x22')](function(_0x51c710){_0x148d2f[_0xe59a('0x1d')]=_0x51c710;if(_0x5b581c[_0xe59a('0x34')][_0xe59a('0x43')]){_0x3cfd7a[_0xe59a('0x44')]=[{'all':!![]}];}return db[_0xe59a('0x2e')]['findAll'](_0x3cfd7a);})['then'](function(_0x281b19){_0x148d2f[_0xe59a('0x45')]=_0x281b19;return _0x148d2f;})[_0xe59a('0x22')](respondWithFilteredResult(_0x295a67,_0x3cfd7a))['catch'](handleError(_0x295a67,null));};exports[_0xe59a('0x46')]=function(_0xc9bb9,_0x52d2df){var _0x27d1cc={'raw':![],'where':{'id':_0xc9bb9[_0xe59a('0x47')]['id']}},_0x5a774d={};_0x5a774d['model']=_[_0xe59a('0x35')](db[_0xe59a('0x2e')][_0xe59a('0x48')]);_0x5a774d[_0xe59a('0x34')]=_[_0xe59a('0x35')](_0xc9bb9[_0xe59a('0x34')]);_0x5a774d[_0xe59a('0x36')]=_[_0xe59a('0x37')](_0x5a774d[_0xe59a('0x32')],_0x5a774d['query']);_0x27d1cc[_0xe59a('0x38')]=_[_0xe59a('0x37')](_0x5a774d[_0xe59a('0x32')],qs[_0xe59a('0x39')](_0xc9bb9[_0xe59a('0x34')][_0xe59a('0x39')]));_0x27d1cc[_0xe59a('0x38')]=_0x27d1cc[_0xe59a('0x38')][_0xe59a('0x3a')]?_0x27d1cc['attributes']:_0x5a774d[_0xe59a('0x32')];if(_0xc9bb9[_0xe59a('0x34')]['includeAll']){_0x27d1cc[_0xe59a('0x44')]=[{'all':!![]}];}_0x27d1cc=_[_0xe59a('0x49')]({},_0x27d1cc,_0xc9bb9['options']);return db[_0xe59a('0x2e')][_0xe59a('0x4a')](_0x27d1cc)['then'](handleEntityNotFound(_0x52d2df,null))[_0xe59a('0x22')](respondWithResult(_0x52d2df,null))['catch'](handleError(_0x52d2df,null));};exports[_0xe59a('0x4b')]=function(_0x4ee4a2,_0x5a671b){return db[_0xe59a('0x2e')][_0xe59a('0x4b')](_0x4ee4a2[_0xe59a('0x4c')],{})[_0xe59a('0x22')](function(_0x397614){var _0x38461a=_0x4ee4a2[_0xe59a('0x4d')][_0xe59a('0x24')]({'plain':!![]});if(!_0x38461a)throw new Error(_0xe59a('0x4e'));if(_0x38461a[_0xe59a('0x4f')]==='user'){var _0x50ff46=_0x397614[_0xe59a('0x24')]({'plain':!![]});var _0x380908='Scheduler';return db[_0xe59a('0x50')][_0xe59a('0x4a')]({'where':{'name':_0x380908,'userProfileId':_0x38461a['userProfileId']},'raw':!![]})[_0xe59a('0x22')](function(_0x1f3264){if(_0x1f3264&&_0x1f3264[_0xe59a('0x51')]===0x0){return db[_0xe59a('0x26')][_0xe59a('0x4b')]({'name':_0x50ff46[_0xe59a('0x2b')],'resourceId':_0x50ff46['id'],'type':_0x1f3264['name'],'sectionId':_0x1f3264['id']},{})[_0xe59a('0x22')](function(){return _0x397614;});}else{return _0x397614;}})[_0xe59a('0x52')](function(_0x379a0d){logger[_0xe59a('0x29')](_0xe59a('0x53'),_0x379a0d);throw _0x379a0d;});}return _0x397614;})[_0xe59a('0x22')](respondWithResult(_0x5a671b,0xc9))[_0xe59a('0x52')](handleError(_0x5a671b,null));};exports[_0xe59a('0x54')]=function(_0x44db59,_0x1a2727){if(_0x44db59[_0xe59a('0x4c')]['id']){delete _0x44db59[_0xe59a('0x4c')]['id'];}return db[_0xe59a('0x2e')][_0xe59a('0x4a')]({'where':{'id':_0x44db59['params']['id']}})[_0xe59a('0x22')](handleEntityNotFound(_0x1a2727,null))[_0xe59a('0x22')](saveUpdates(_0x44db59[_0xe59a('0x4c')],null))[_0xe59a('0x22')](respondWithResult(_0x1a2727,null))['catch'](handleError(_0x1a2727,null));};exports[_0xe59a('0x23')]=function(_0x44c741,_0x27e6db){return db[_0xe59a('0x2e')]['find']({'where':{'id':_0x44c741['params']['id']}})[_0xe59a('0x22')](handleEntityNotFound(_0x27e6db,null))[_0xe59a('0x22')](removeEntity(_0x27e6db,null))[_0xe59a('0x52')](handleError(_0x27e6db,null));};exports['run']=function(_0xd6f602,_0x1f2da8,_0x110aa0){var _0x328fe9=require(_0xe59a('0x55'));return db[_0xe59a('0x2e')][_0xe59a('0x4a')]({'where':{'id':_0xd6f602[_0xe59a('0x47')]['id']},'raw':!![]})[_0xe59a('0x22')](handleEntityNotFound(_0x1f2da8,null))[_0xe59a('0x22')](function(){_0x328fe9['run'](_0xd6f602[_0xe59a('0x47')]['id']);})[_0xe59a('0x22')](respondWithStatusCode(_0x1f2da8,null))[_0xe59a('0x52')](handleError(_0x1f2da8,null));}; \ No newline at end of file +var _0xb81e=['crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Schedule','includeAll','include','findAll','catch','show','params','options','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x34cac5,_0x5a89ef){var _0x4a6172=function(_0x31b52c){while(--_0x31b52c){_0x34cac5['push'](_0x34cac5['shift']());}};_0x4a6172(++_0x5a89ef);}(_0xb81e,0xa0));var _0xeb81=function(_0x2ba7ed,_0x98b3ce){_0x2ba7ed=_0x2ba7ed-0x0;var _0x56c2b3=_0xb81e[_0x2ba7ed];return _0x56c2b3;};'use strict';var emlformat=require(_0xeb81('0x0'));var rimraf=require(_0xeb81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb81('0x2'));var rp=require(_0xeb81('0x3'));var moment=require(_0xeb81('0x4'));var BPromise=require(_0xeb81('0x5'));var Mustache=require(_0xeb81('0x6'));var util=require('util');var path=require(_0xeb81('0x7'));var sox=require(_0xeb81('0x8'));var csv=require(_0xeb81('0x9'));var ejs=require(_0xeb81('0xa'));var fs=require('fs');var fs_extra=require(_0xeb81('0xb'));var _=require(_0xeb81('0xc'));var squel=require(_0xeb81('0xd'));var crypto=require(_0xeb81('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xeb81('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb81('0x10'));var Papa=require(_0xeb81('0x11'));var Redis=require(_0xeb81('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xeb81('0x13'));var as=require(_0xeb81('0x14'));var hardwareService=require(_0xeb81('0x15'));var logger=require('../../config/logger')(_0xeb81('0x16'));var utils=require(_0xeb81('0x17'));var config=require(_0xeb81('0x18'));var licenseUtil=require(_0xeb81('0x19'));var db=require(_0xeb81('0x1a'))['db'];function respondWithStatusCode(_0x2fd904,_0x332e32){_0x332e32=_0x332e32||0xcc;return function(_0x52c54f){if(_0x52c54f){return _0x2fd904[_0xeb81('0x1b')](_0x332e32);}return _0x2fd904[_0xeb81('0x1c')](_0x332e32)[_0xeb81('0x1d')]();};}function respondWithResult(_0x23ee0b,_0x124006){_0x124006=_0x124006||0xc8;return function(_0x46a1ba){if(_0x46a1ba){return _0x23ee0b['status'](_0x124006)[_0xeb81('0x1e')](_0x46a1ba);}};}function respondWithFilteredResult(_0x4950ed,_0x5ed189){return function(_0x300c90){if(_0x300c90){var _0x11e76d=typeof _0x5ed189[_0xeb81('0x1f')]===_0xeb81('0x20')&&typeof _0x5ed189[_0xeb81('0x21')]===_0xeb81('0x20');var _0x2b0a11=_0x300c90[_0xeb81('0x22')];var _0x545eae=_0x11e76d?0x0:_0x5ed189['offset'];var _0x3999ab=_0x11e76d?_0x300c90[_0xeb81('0x22')]:_0x5ed189[_0xeb81('0x1f')]+_0x5ed189[_0xeb81('0x21')];var _0x48a6fe;if(_0x3999ab>=_0x2b0a11){_0x3999ab=_0x2b0a11;_0x48a6fe=0xc8;}else{_0x48a6fe=0xce;}_0x4950ed[_0xeb81('0x1c')](_0x48a6fe);return _0x4950ed[_0xeb81('0x23')](_0xeb81('0x24'),_0x545eae+'-'+_0x3999ab+'/'+_0x2b0a11)['json'](_0x300c90);}return null;};}function patchUpdates(_0xf2399e){return function(_0xf7f661){try{jsonpatch['apply'](_0xf7f661,_0xf2399e,!![]);}catch(_0x224bad){return BPromise[_0xeb81('0x25')](_0x224bad);}return _0xf7f661[_0xeb81('0x26')]();};}function saveUpdates(_0x702d88,_0x50a611){return function(_0x127fbd){if(_0x127fbd){return _0x127fbd[_0xeb81('0x27')](_0x702d88)[_0xeb81('0x28')](function(_0x3a2da8){return _0x3a2da8;});}return null;};}function removeEntity(_0xa490b3,_0x565626){return function(_0xbe7007){if(_0xbe7007){return _0xbe7007[_0xeb81('0x29')]()[_0xeb81('0x28')](function(){var _0x31dc58=_0xbe7007[_0xeb81('0x2a')]({'plain':!![]});var _0x1ef096=_0xeb81('0x2b');return db[_0xeb81('0x2c')]['destroy']({'where':{'type':_0x1ef096,'resourceId':_0x31dc58['id']}})['then'](function(){return _0xbe7007;});})[_0xeb81('0x28')](function(){_0xa490b3[_0xeb81('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x376f73,_0x4251dd){return function(_0x431be9){if(!_0x431be9){_0x376f73[_0xeb81('0x1b')](0x194);}return _0x431be9;};}function handleError(_0x451c8b,_0x52186f){_0x52186f=_0x52186f||0x1f4;return function(_0x3de977){logger[_0xeb81('0x2d')](_0x3de977[_0xeb81('0x2e')]);if(_0x3de977[_0xeb81('0x2f')]){delete _0x3de977[_0xeb81('0x2f')];}_0x451c8b[_0xeb81('0x1c')](_0x52186f)[_0xeb81('0x30')](_0x3de977);};}exports['index']=function(_0x5cb552,_0x5de06e){var _0x4248a8={},_0x5b4704={},_0x35bfe5={'count':0x0,'rows':[]};var _0xd425bc=_[_0xeb81('0x31')](db['Schedule'][_0xeb81('0x32')],function(_0x30241b){return{'name':_0x30241b['fieldName'],'type':_0x30241b[_0xeb81('0x33')][_0xeb81('0x34')]};});_0x5b4704['model']=_[_0xeb81('0x31')](_0xd425bc,'name');_0x5b4704['query']=_[_0xeb81('0x35')](_0x5cb552[_0xeb81('0x36')]);_0x5b4704[_0xeb81('0x37')]=_[_0xeb81('0x38')](_0x5b4704[_0xeb81('0x39')],_0x5b4704[_0xeb81('0x36')]);_0x4248a8[_0xeb81('0x3a')]=_[_0xeb81('0x38')](_0x5b4704[_0xeb81('0x39')],qs[_0xeb81('0x3b')](_0x5cb552[_0xeb81('0x36')][_0xeb81('0x3b')]));_0x4248a8['attributes']=_0x4248a8[_0xeb81('0x3a')][_0xeb81('0x3c')]?_0x4248a8[_0xeb81('0x3a')]:_0x5b4704['model'];if(!_0x5cb552[_0xeb81('0x36')]['hasOwnProperty'](_0xeb81('0x3d'))){_0x4248a8['limit']=qs[_0xeb81('0x21')](_0x5cb552[_0xeb81('0x36')][_0xeb81('0x21')]);_0x4248a8['offset']=qs['offset'](_0x5cb552['query'][_0xeb81('0x1f')]);}_0x4248a8[_0xeb81('0x3e')]=qs['sort'](_0x5cb552[_0xeb81('0x36')][_0xeb81('0x3f')]);_0x4248a8[_0xeb81('0x40')]=qs[_0xeb81('0x37')](_[_0xeb81('0x41')](_0x5cb552[_0xeb81('0x36')],_0x5b4704[_0xeb81('0x37')]),_0xd425bc);if(_0x5cb552[_0xeb81('0x36')][_0xeb81('0x42')]){_0x4248a8[_0xeb81('0x40')]=_[_0xeb81('0x43')](_0x4248a8[_0xeb81('0x40')],{'$or':_[_0xeb81('0x31')](_0xd425bc,function(_0x5f5af9){if(_0x5f5af9[_0xeb81('0x33')]!==_0xeb81('0x44')){var _0x2d66bd={};_0x2d66bd[_0x5f5af9[_0xeb81('0x2f')]]={'$like':'%'+_0x5cb552[_0xeb81('0x36')][_0xeb81('0x42')]+'%'};return _0x2d66bd;}})});}_0x4248a8=_[_0xeb81('0x43')]({},_0x4248a8,_0x5cb552['options']);var _0x1ad910={'where':_0x4248a8[_0xeb81('0x40')]};return db[_0xeb81('0x45')][_0xeb81('0x22')](_0x1ad910)[_0xeb81('0x28')](function(_0x2db85b){_0x35bfe5[_0xeb81('0x22')]=_0x2db85b;if(_0x5cb552['query'][_0xeb81('0x46')]){_0x4248a8[_0xeb81('0x47')]=[{'all':!![]}];}return db[_0xeb81('0x45')][_0xeb81('0x48')](_0x4248a8);})['then'](function(_0x431cd7){_0x35bfe5['rows']=_0x431cd7;return _0x35bfe5;})['then'](respondWithFilteredResult(_0x5de06e,_0x4248a8))[_0xeb81('0x49')](handleError(_0x5de06e,null));};exports[_0xeb81('0x4a')]=function(_0x43ae26,_0xf751ff){var _0x519381={'raw':![],'where':{'id':_0x43ae26[_0xeb81('0x4b')]['id']}},_0x43d7a0={};_0x43d7a0['model']=_['keys'](db[_0xeb81('0x45')][_0xeb81('0x32')]);_0x43d7a0[_0xeb81('0x36')]=_[_0xeb81('0x35')](_0x43ae26['query']);_0x43d7a0['filters']=_['intersection'](_0x43d7a0[_0xeb81('0x39')],_0x43d7a0[_0xeb81('0x36')]);_0x519381[_0xeb81('0x3a')]=_[_0xeb81('0x38')](_0x43d7a0[_0xeb81('0x39')],qs[_0xeb81('0x3b')](_0x43ae26['query'][_0xeb81('0x3b')]));_0x519381[_0xeb81('0x3a')]=_0x519381['attributes'][_0xeb81('0x3c')]?_0x519381[_0xeb81('0x3a')]:_0x43d7a0[_0xeb81('0x39')];if(_0x43ae26[_0xeb81('0x36')][_0xeb81('0x46')]){_0x519381[_0xeb81('0x47')]=[{'all':!![]}];}_0x519381=_[_0xeb81('0x43')]({},_0x519381,_0x43ae26[_0xeb81('0x4c')]);return db['Schedule'][_0xeb81('0x4d')](_0x519381)['then'](handleEntityNotFound(_0xf751ff,null))[_0xeb81('0x28')](respondWithResult(_0xf751ff,null))[_0xeb81('0x49')](handleError(_0xf751ff,null));};exports[_0xeb81('0x4e')]=function(_0xc539a8,_0x532c5b){return db[_0xeb81('0x45')][_0xeb81('0x4e')](_0xc539a8[_0xeb81('0x4f')],{})[_0xeb81('0x28')](function(_0x275453){var _0x2219ac=_0xc539a8[_0xeb81('0x50')][_0xeb81('0x2a')]({'plain':!![]});if(!_0x2219ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2219ac[_0xeb81('0x51')]==='user'){var _0x3855f9=_0x275453[_0xeb81('0x2a')]({'plain':!![]});var _0x3099f2='Scheduler';return db[_0xeb81('0x52')][_0xeb81('0x4d')]({'where':{'name':_0x3099f2,'userProfileId':_0x2219ac['userProfileId']},'raw':!![]})[_0xeb81('0x28')](function(_0x6e7a65){if(_0x6e7a65&&_0x6e7a65[_0xeb81('0x53')]===0x0){return db[_0xeb81('0x2c')][_0xeb81('0x4e')]({'name':_0x3855f9[_0xeb81('0x2f')],'resourceId':_0x3855f9['id'],'type':_0x6e7a65[_0xeb81('0x2f')],'sectionId':_0x6e7a65['id']},{})[_0xeb81('0x28')](function(){return _0x275453;});}else{return _0x275453;}})[_0xeb81('0x49')](function(_0x4dd2fe){logger[_0xeb81('0x2d')](_0xeb81('0x54'),_0x4dd2fe);throw _0x4dd2fe;});}return _0x275453;})['then'](respondWithResult(_0x532c5b,0xc9))[_0xeb81('0x49')](handleError(_0x532c5b,null));};exports[_0xeb81('0x27')]=function(_0xff6c5,_0x1ccac8){if(_0xff6c5['body']['id']){delete _0xff6c5[_0xeb81('0x4f')]['id'];}return db[_0xeb81('0x45')][_0xeb81('0x4d')]({'where':{'id':_0xff6c5['params']['id']}})['then'](handleEntityNotFound(_0x1ccac8,null))[_0xeb81('0x28')](saveUpdates(_0xff6c5[_0xeb81('0x4f')],null))[_0xeb81('0x28')](respondWithResult(_0x1ccac8,null))[_0xeb81('0x49')](handleError(_0x1ccac8,null));};exports[_0xeb81('0x29')]=function(_0x53ee6b,_0x35f631){return db[_0xeb81('0x45')][_0xeb81('0x4d')]({'where':{'id':_0x53ee6b['params']['id']}})[_0xeb81('0x28')](handleEntityNotFound(_0x35f631,null))['then'](removeEntity(_0x35f631,null))[_0xeb81('0x49')](handleError(_0x35f631,null));};exports[_0xeb81('0x55')]=function(_0x4b07e2,_0x6578,_0x322091){var _0x2e8652=require(_0xeb81('0x56'));return db[_0xeb81('0x45')][_0xeb81('0x4d')]({'where':{'id':_0x4b07e2[_0xeb81('0x4b')]['id']},'raw':!![]})[_0xeb81('0x28')](handleEntityNotFound(_0x6578,null))['then'](function(){_0x2e8652[_0xeb81('0x55')](_0x4b07e2[_0xeb81('0x4b')]['id']);})[_0xeb81('0x28')](respondWithStatusCode(_0x6578,null))[_0xeb81('0x49')](handleError(_0x6578,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 74ed3f3..ef9cfee 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 _0x63c6=['tools_schedules','util','../../config/logger','request-promise','path','./schedule.attributes','exports','define','Schedule'];(function(_0x480ab2,_0x20b3a7){var _0x35c362=function(_0xddf9ac){while(--_0xddf9ac){_0x480ab2['push'](_0x480ab2['shift']());}};_0x35c362(++_0x20b3a7);}(_0x63c6,0x1d5));var _0x663c=function(_0x2cf094,_0xb81f90){_0x2cf094=_0x2cf094-0x0;var _0x527d68=_0x63c6[_0x2cf094];return _0x527d68;};'use strict';var _=require('lodash');var util=require(_0x663c('0x0'));var logger=require(_0x663c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x663c('0x2'));var fs=require('fs');var path=require(_0x663c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x663c('0x4'));module[_0x663c('0x5')]=function(_0x1c96f0,_0xd058ee){return _0x1c96f0[_0x663c('0x6')](_0x663c('0x7'),attributes,{'tableName':_0x663c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb32c=['define','Schedule','tools_schedules','lodash','util','api','request-promise','path','../../config/environment','exports'];(function(_0x823165,_0x9f4050){var _0x2f6f77=function(_0x12c38c){while(--_0x12c38c){_0x823165['push'](_0x823165['shift']());}};_0x2f6f77(++_0x9f4050);}(_0xb32c,0x7b));var _0xcb32=function(_0x1030e6,_0x2273ce){_0x1030e6=_0x1030e6-0x0;var _0x2cf67d=_0xb32c[_0x1030e6];return _0x2cf67d;};'use strict';var _=require(_0xcb32('0x0'));var util=require(_0xcb32('0x1'));var logger=require('../../config/logger')(_0xcb32('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb32('0x3'));var fs=require('fs');var path=require(_0xcb32('0x4'));var rimraf=require('rimraf');var config=require(_0xcb32('0x5'));var attributes=require('./schedule.attributes');module[_0xcb32('0x6')]=function(_0x587e94,_0x373377){return _0x587e94[_0xcb32('0x7')](_0xcb32('0x8'),attributes,{'tableName':_0xcb32('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index e56f6e7..2bb7563 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 _0xb094=['../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4086f9,_0x278d24){var _0x3be4fc=function(_0x2609bf){while(--_0x2609bf){_0x4086f9['push'](_0x4086f9['shift']());}};_0x3be4fc(++_0x278d24);}(_0xb094,0x1ad));var _0x4b09=function(_0x2aab90,_0x1a8c9a){_0x2aab90=_0x2aab90-0x0;var _0x3e7fe3=_0xb094[_0x2aab90];return _0x3e7fe3;};'use strict';var _=require(_0x4b09('0x0'));var util=require(_0x4b09('0x1'));var moment=require(_0x4b09('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b09('0x3'));var fs=require('fs');var Redis=require(_0x4b09('0x4'));var db=require(_0x4b09('0x5'))['db'];var utils=require(_0x4b09('0x6'));var logger=require('../../config/logger')(_0x4b09('0x7'));var config=require(_0x4b09('0x8'));var jayson=require(_0x4b09('0x9'));var client=jayson[_0x4b09('0xa')][_0x4b09('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c704b,_0x1484a9,_0x3d56cc){return new BPromise(function(_0x14411a,_0x1b6231){return client[_0x4b09('0xc')](_0x3c704b,_0x3d56cc)['then'](function(_0x5cecca){logger[_0x4b09('0xd')](_0x4b09('0xe'),_0x1484a9,_0x4b09('0xf'));logger[_0x4b09('0x10')](_0x4b09('0x11'),_0x1484a9,'request\x20sent',JSON[_0x4b09('0x12')](_0x5cecca));if(_0x5cecca[_0x4b09('0x13')]){if(_0x5cecca['error']['code']===0x1f4){logger[_0x4b09('0x13')](_0x4b09('0xe'),_0x1484a9,_0x5cecca[_0x4b09('0x13')][_0x4b09('0x14')]);return _0x1b6231(_0x5cecca['error'][_0x4b09('0x14')]);}logger[_0x4b09('0x13')]('Schedule,\x20%s,\x20%s',_0x1484a9,_0x5cecca[_0x4b09('0x13')][_0x4b09('0x14')]);return _0x14411a(_0x5cecca[_0x4b09('0x13')]['message']);}else{logger['info'](_0x4b09('0xe'),_0x1484a9,_0x4b09('0xf'));_0x14411a(_0x5cecca[_0x4b09('0x15')][_0x4b09('0x14')]);}})[_0x4b09('0x16')](function(_0x1cf95b){logger[_0x4b09('0x13')](_0x4b09('0xe'),_0x1484a9,_0x1cf95b);_0x1b6231(_0x1cf95b);});});} \ No newline at end of file +var _0x04df=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x551823,_0x304f96){var _0x2dca71=function(_0x524827){while(--_0x524827){_0x551823['push'](_0x551823['shift']());}};_0x2dca71(++_0x304f96);}(_0x04df,0x136));var _0xf04d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x04df[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xf04d('0x0'));var util=require(_0xf04d('0x1'));var moment=require(_0xf04d('0x2'));var BPromise=require('bluebird');var rs=require(_0xf04d('0x3'));var fs=require('fs');var Redis=require(_0xf04d('0x4'));var db=require(_0xf04d('0x5'))['db'];var utils=require(_0xf04d('0x6'));var logger=require(_0xf04d('0x7'))('rpc');var config=require(_0xf04d('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a3152,_0x40eba4,_0x22ece4){return new BPromise(function(_0x322ffa,_0x3025e3){return client[_0xf04d('0x9')](_0x3a3152,_0x22ece4)[_0xf04d('0xa')](function(_0x5ce6a4){logger[_0xf04d('0xb')]('Schedule,\x20%s,\x20%s',_0x40eba4,_0xf04d('0xc'));logger[_0xf04d('0xd')](_0xf04d('0xe'),_0x40eba4,'request\x20sent',JSON[_0xf04d('0xf')](_0x5ce6a4));if(_0x5ce6a4[_0xf04d('0x10')]){if(_0x5ce6a4[_0xf04d('0x10')][_0xf04d('0x11')]===0x1f4){logger[_0xf04d('0x10')]('Schedule,\x20%s,\x20%s',_0x40eba4,_0x5ce6a4['error'][_0xf04d('0x12')]);return _0x3025e3(_0x5ce6a4[_0xf04d('0x10')]['message']);}logger[_0xf04d('0x10')](_0xf04d('0x13'),_0x40eba4,_0x5ce6a4[_0xf04d('0x10')][_0xf04d('0x12')]);return _0x322ffa(_0x5ce6a4[_0xf04d('0x10')][_0xf04d('0x12')]);}else{logger[_0xf04d('0xb')]('Schedule,\x20%s,\x20%s',_0x40eba4,_0xf04d('0xc'));_0x322ffa(_0x5ce6a4['result'][_0xf04d('0x12')]);}})[_0xf04d('0x14')](function(_0x3daebb){logger[_0xf04d('0x10')](_0xf04d('0x13'),_0x40eba4,_0x3daebb);_0x3025e3(_0x3daebb);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 7795a04..20486a1 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 _0x761f=['/describe','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','get','index'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x761f,0x11e));var _0xf761=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x761f[_0x2b737c];return _0x466ed5;};'use strict';var multer=require(_0xf761('0x0'));var util=require(_0xf761('0x1'));var path=require(_0xf761('0x2'));var timeout=require(_0xf761('0x3'));var express=require(_0xf761('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf761('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0xf761('0x6')]('/',auth['isAuthenticated'](),controller[_0xf761('0x7')]);router[_0xf761('0x6')](_0xf761('0x8'),auth[_0xf761('0x9')](),controller['describe']);router[_0xf761('0x6')](_0xf761('0xa'),auth[_0xf761('0x9')](),controller[_0xf761('0xb')]);router[_0xf761('0x6')](_0xf761('0xc'),auth[_0xf761('0x9')](),controller[_0xf761('0xd')]);router[_0xf761('0xe')]('/',auth[_0xf761('0x9')](),controller[_0xf761('0xf')]);router[_0xf761('0x10')]('/:id',auth[_0xf761('0x9')](),controller[_0xf761('0x11')]);router[_0xf761('0x12')](_0xf761('0xa'),auth['isAuthenticated'](),controller[_0xf761('0x13')]);module[_0xf761('0x14')]=router; \ No newline at end of file +var _0xe005=['show','get','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./screenRecording.controller','isAuthenticated','index','/describe','describe','/:id'];(function(_0x451b36,_0x14dbae){var _0x181266=function(_0x58d6af){while(--_0x58d6af){_0x451b36['push'](_0x451b36['shift']());}};_0x181266(++_0x14dbae);}(_0xe005,0x17a));var _0x5e00=function(_0x146312,_0x4ca21a){_0x146312=_0x146312-0x0;var _0x3f8cf6=_0xe005[_0x146312];return _0x3f8cf6;};'use strict';var multer=require(_0x5e00('0x0'));var util=require(_0x5e00('0x1'));var path=require(_0x5e00('0x2'));var timeout=require(_0x5e00('0x3'));var express=require('express');var router=express[_0x5e00('0x4')]();var fs_extra=require(_0x5e00('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e00('0x6'));var controller=require(_0x5e00('0x7'));router['get']('/',auth[_0x5e00('0x8')](),controller[_0x5e00('0x9')]);router['get'](_0x5e00('0xa'),auth['isAuthenticated'](),controller[_0x5e00('0xb')]);router['get'](_0x5e00('0xc'),auth[_0x5e00('0x8')](),controller[_0x5e00('0xd')]);router[_0x5e00('0xe')]('/:id/download',auth[_0x5e00('0x8')](),controller[_0x5e00('0xf')]);router[_0x5e00('0x10')]('/',auth['isAuthenticated'](),controller[_0x5e00('0x11')]);router[_0x5e00('0x12')](_0x5e00('0xc'),auth[_0x5e00('0x8')](),controller[_0x5e00('0x13')]);router[_0x5e00('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x5e00('0x15')]);module[_0x5e00('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index eac05fc..e99787d 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 _0x94ff=['format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','exports','VIRTUAL','getDataValue','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt'];(function(_0x397e20,_0xfebe25){var _0x365229=function(_0x151747){while(--_0x151747){_0x397e20['push'](_0x397e20['shift']());}};_0x365229(++_0xfebe25);}(_0x94ff,0xc3));var _0xf94f=function(_0x254461,_0x5f03d2){_0x254461=_0x254461-0x0;var _0x5cfba5=_0x94ff[_0x254461];return _0x5cfba5;};'use strict';var Sequelize=require(_0xf94f('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module[_0xf94f('0x1')]={'format':{'type':Sequelize[_0xf94f('0x2')],'get':function(){return this[_0xf94f('0x3')]('value')?path[_0xf94f('0x4')](this[_0xf94f('0x3')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xf94f('0x5')]},'channel':{'type':Sequelize[_0xf94f('0x5')]},'value':{'type':Sequelize['STRING'],'set':function(_0x18919a){var _0x5e3f9c=_0x18919a[_0xf94f('0x6')](/\\/g,'/');this[_0xf94f('0x7')]('value',_0x5e3f9c);}},'rating':{'type':Sequelize[_0xf94f('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xf94f('0x8')],'set':function(_0x123003){this['setDataValue']('startedAt',moment()[_0xf94f('0x9')](_0x123003,'ms'));this[_0xf94f('0x7')](_0xf94f('0xa'),moment());this[_0xf94f('0x7')](_0xf94f('0xb'),_0x123003);}},'startedAt':{'type':Sequelize[_0xf94f('0xc')],'get':function(){return moment(this[_0xf94f('0x3')](_0xf94f('0xd')))[_0xf94f('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xf94f('0xf')]();}},'closedAt':{'type':Sequelize[_0xf94f('0xc')],'get':function(){return moment(this[_0xf94f('0x3')](_0xf94f('0xa')))['format'](_0xf94f('0x10'))[_0xf94f('0xf')]();}},'createdAt':{'type':Sequelize[_0xf94f('0xc')],'get':function(){return moment(this[_0xf94f('0x3')](_0xf94f('0x11')))[_0xf94f('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xf94f('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xf94f('0x3')](_0xf94f('0x12')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x49db=['../../config/environment','exports','getDataValue','value','extname','STRING','setDataValue','INTEGER','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x49db,0xc5));var _0xb49d=function(_0x4cce3e,_0x4a1349){_0x4cce3e=_0x4cce3e-0x0;var _0x391e08=_0x49db[_0x4cce3e];return _0x391e08;};'use strict';var Sequelize=require(_0xb49d('0x0'));var moment=require(_0xb49d('0x1'));var path=require(_0xb49d('0x2'));var config=require(_0xb49d('0x3'));module[_0xb49d('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb49d('0x5')](_0xb49d('0x6'))?path[_0xb49d('0x7')](this['getDataValue'](_0xb49d('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xb49d('0x8')],'set':function(_0x4180c8){var _0x15f52f=_0x4180c8['replace'](/\\/g,'/');this[_0xb49d('0x9')](_0xb49d('0x6'),_0x15f52f);}},'rating':{'type':Sequelize[_0xb49d('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb49d('0xa')],'set':function(_0x3d4825){this[_0xb49d('0x9')]('startedAt',moment()['subtract'](_0x3d4825,'ms'));this[_0xb49d('0x9')](_0xb49d('0xb'),moment());this[_0xb49d('0x9')](_0xb49d('0xc'),_0x3d4825);}},'startedAt':{'type':Sequelize[_0xb49d('0xd')],'get':function(){return moment(this[_0xb49d('0x5')](_0xb49d('0xe')))[_0xb49d('0xf')](_0xb49d('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0xb49d('0xd')],'get':function(){return moment(this[_0xb49d('0x5')](_0xb49d('0xb')))[_0xb49d('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xb49d('0x11')]();}},'createdAt':{'type':Sequelize[_0xb49d('0xd')],'get':function(){return moment(this['getDataValue'](_0xb49d('0x12')))[_0xb49d('0xf')](_0xb49d('0x10'))[_0xb49d('0x11')]();}},'updatedAt':{'type':Sequelize[_0xb49d('0xd')],'get':function(){return moment(this[_0xb49d('0x5')](_0xb49d('0x13')))['format'](_0xb49d('0x10'))[_0xb49d('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 4cb1152..99a7da2 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 _0xeec6=['options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','find','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ScreenRecording','rawAttributes','fieldName','type','model','format','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge'];(function(_0x397da2,_0x4d9588){var _0x4d09db=function(_0x40d204){while(--_0x40d204){_0x397da2['push'](_0x397da2['shift']());}};_0x4d09db(++_0x4d9588);}(_0xeec6,0x1c2));var _0x6eec=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0xeec6[_0xbbfe59];return _0x28a2a4;};'use strict';var emlformat=require(_0x6eec('0x0'));var rimraf=require(_0x6eec('0x1'));var zipdir=require(_0x6eec('0x2'));var jsonpatch=require(_0x6eec('0x3'));var rp=require('request-promise');var moment=require(_0x6eec('0x4'));var BPromise=require(_0x6eec('0x5'));var Mustache=require(_0x6eec('0x6'));var util=require(_0x6eec('0x7'));var path=require(_0x6eec('0x8'));var sox=require(_0x6eec('0x9'));var csv=require('to-csv');var ejs=require(_0x6eec('0xa'));var fs=require('fs');var fs_extra=require(_0x6eec('0xb'));var _=require('lodash');var squel=require(_0x6eec('0xc'));var crypto=require(_0x6eec('0xd'));var jsforce=require(_0x6eec('0xe'));var deskjs=require(_0x6eec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6eec('0x10'));var Papa=require(_0x6eec('0x11'));var Redis=require(_0x6eec('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eec('0x13'));var logger=require(_0x6eec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6eec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eec('0x16'))['db'];function respondWithStatusCode(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xcc;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0x17')](_0x162db1);}return _0x3387c2['status'](_0x162db1)[_0x6eec('0x18')]();};}function respondWithResult(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0xc8;return function(_0xc35914){if(_0xc35914){return _0x3b2972[_0x6eec('0x19')](_0x462dbb)[_0x6eec('0x1a')](_0xc35914);}};}function respondWithFilteredResult(_0x345852,_0x393271){return function(_0x34a7fc){if(_0x34a7fc){var _0x2ac797=typeof _0x393271['offset']===_0x6eec('0x1b')&&typeof _0x393271['limit']===_0x6eec('0x1b');var _0x45aa3f=_0x34a7fc['count'];var _0x3ee353=_0x2ac797?0x0:_0x393271[_0x6eec('0x1c')];var _0xb1eab7=_0x2ac797?_0x34a7fc['count']:_0x393271[_0x6eec('0x1c')]+_0x393271[_0x6eec('0x1d')];var _0x3c7152;if(_0xb1eab7>=_0x45aa3f){_0xb1eab7=_0x45aa3f;_0x3c7152=0xc8;}else{_0x3c7152=0xce;}_0x345852[_0x6eec('0x19')](_0x3c7152);return _0x345852[_0x6eec('0x1e')](_0x6eec('0x1f'),_0x3ee353+'-'+_0xb1eab7+'/'+_0x45aa3f)['json'](_0x34a7fc);}return null;};}function patchUpdates(_0x328693){return function(_0x2f843e){try{jsonpatch[_0x6eec('0x20')](_0x2f843e,_0x328693,!![]);}catch(_0x34522a){return BPromise[_0x6eec('0x21')](_0x34522a);}return _0x2f843e[_0x6eec('0x22')]();};}function saveUpdates(_0x52f941,_0x6e40b3){return function(_0x852d08){if(_0x852d08){return _0x852d08[_0x6eec('0x23')](_0x52f941)[_0x6eec('0x24')](function(_0x409b26){return _0x409b26;});}return null;};}function removeEntity(_0x13863c,_0x573249){return function(_0x384586){if(_0x384586){return _0x384586[_0x6eec('0x25')]()[_0x6eec('0x24')](function(){_0x13863c[_0x6eec('0x19')](0xcc)[_0x6eec('0x18')]();});}};}function handleEntityNotFound(_0x1f386c,_0x29879c){return function(_0x20bed3){if(!_0x20bed3){_0x1f386c[_0x6eec('0x17')](0x194);}return _0x20bed3;};}function handleError(_0x58f95c,_0x1d750c){_0x1d750c=_0x1d750c||0x1f4;return function(_0x44b31c){logger[_0x6eec('0x26')](_0x44b31c[_0x6eec('0x27')]);if(_0x44b31c['name']){delete _0x44b31c[_0x6eec('0x28')];}_0x58f95c[_0x6eec('0x19')](_0x1d750c)['send'](_0x44b31c);};}exports['index']=function(_0x3240c3,_0x47ed95){var _0x20a130={},_0xede270={},_0x3bbdf8={'count':0x0,'rows':[]};var _0x34bdea=_[_0x6eec('0x29')](db[_0x6eec('0x2a')][_0x6eec('0x2b')],function(_0x33e4a1){return{'name':_0x33e4a1[_0x6eec('0x2c')],'type':_0x33e4a1[_0x6eec('0x2d')]['key']};});_0xede270[_0x6eec('0x2e')]=_['differenceBy'](_[_0x6eec('0x29')](_0x34bdea,_0x6eec('0x28')),[_0x6eec('0x2f')]);_0xede270['query']=_['keys'](_0x3240c3['query']);_0xede270[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],_0xede270[_0x6eec('0x32')]);_0x20a130[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x34')]));_0x20a130[_0x6eec('0x33')]=_0x20a130[_0x6eec('0x33')]['length']?_0x20a130[_0x6eec('0x33')]:_0xede270[_0x6eec('0x2e')];if(!_0x3240c3[_0x6eec('0x32')]['hasOwnProperty'](_0x6eec('0x35'))){_0x20a130[_0x6eec('0x1d')]=qs[_0x6eec('0x1d')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1d')]);_0x20a130[_0x6eec('0x1c')]=qs['offset'](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1c')]);}_0x20a130[_0x6eec('0x36')]=qs['sort'](_0x3240c3['query'][_0x6eec('0x37')]);_0x20a130[_0x6eec('0x38')]=qs[_0x6eec('0x30')](_[_0x6eec('0x39')](_0x3240c3[_0x6eec('0x32')],_0xede270['filters']),_0x34bdea);if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3a')]){_0x20a130[_0x6eec('0x38')]=_[_0x6eec('0x3b')](_0x20a130[_0x6eec('0x38')],{'$or':_[_0x6eec('0x29')](_0x34bdea,function(_0x36cfe1){if(_0x36cfe1[_0x6eec('0x2d')]!=='VIRTUAL'){var _0x2f7a75={};_0x2f7a75[_0x36cfe1[_0x6eec('0x28')]]={'$like':'%'+_0x3240c3['query']['filter']+'%'};return _0x2f7a75;}})});}_0x20a130=_[_0x6eec('0x3b')]({},_0x20a130,_0x3240c3[_0x6eec('0x3c')]);var _0xf056e0={'where':_0x20a130[_0x6eec('0x38')]};return db['ScreenRecording']['count'](_0xf056e0)[_0x6eec('0x24')](function(_0x48fbf6){_0x3bbdf8['count']=_0x48fbf6;if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3d')]){_0x20a130[_0x6eec('0x3e')]=[{'all':!![]}];}return db[_0x6eec('0x2a')][_0x6eec('0x3f')](_0x20a130);})['then'](function(_0x931bcf){_0x3bbdf8[_0x6eec('0x40')]=_0x931bcf;return _0x3bbdf8;})['then'](respondWithFilteredResult(_0x47ed95,_0x20a130))[_0x6eec('0x41')](handleError(_0x47ed95,null));};exports[_0x6eec('0x42')]=function(_0x5028a2,_0x2d39bf){var _0x44d75d={'raw':![],'where':{'id':_0x5028a2[_0x6eec('0x43')]['id']}},_0x4e3b1e={};_0x4e3b1e[_0x6eec('0x2e')]=_[_0x6eec('0x44')](db[_0x6eec('0x2a')]['rawAttributes']);_0x4e3b1e[_0x6eec('0x32')]=_[_0x6eec('0x44')](_0x5028a2[_0x6eec('0x32')]);_0x4e3b1e[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0x4e3b1e['model'],_0x4e3b1e['query']);_0x44d75d[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0x4e3b1e[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x5028a2[_0x6eec('0x32')]['fields']));_0x44d75d[_0x6eec('0x33')]=_0x44d75d['attributes'][_0x6eec('0x45')]?_0x44d75d[_0x6eec('0x33')]:_0x4e3b1e[_0x6eec('0x2e')];if(_0x5028a2['query'][_0x6eec('0x3d')]){_0x44d75d[_0x6eec('0x3e')]=[{'all':!![]}];}_0x44d75d=_[_0x6eec('0x3b')]({},_0x44d75d,_0x5028a2[_0x6eec('0x3c')]);return db[_0x6eec('0x2a')]['find'](_0x44d75d)[_0x6eec('0x24')](handleEntityNotFound(_0x2d39bf,null))['then'](respondWithResult(_0x2d39bf,null))['catch'](handleError(_0x2d39bf,null));};exports[_0x6eec('0x46')]=function(_0x535d96,_0x245a1b){return db[_0x6eec('0x2a')][_0x6eec('0x46')](_0x535d96['body'],{})['then'](respondWithResult(_0x245a1b,0xc9))[_0x6eec('0x41')](handleError(_0x245a1b,null));};exports[_0x6eec('0x23')]=function(_0x1d6626,_0x2d0fc0){if(_0x1d6626[_0x6eec('0x47')]['id']){delete _0x1d6626[_0x6eec('0x47')]['id'];}delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x48')];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x49')];delete _0x1d6626['body']['closedAt'];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x4a')];return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x1d6626[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](handleEntityNotFound(_0x2d0fc0,null))[_0x6eec('0x24')](saveUpdates(_0x1d6626[_0x6eec('0x47')],null))[_0x6eec('0x24')](respondWithResult(_0x2d0fc0,null))[_0x6eec('0x41')](handleError(_0x2d0fc0,null));};exports[_0x6eec('0x4b')]=function(_0x413de9,_0x5a6e05){return db[_0x6eec('0x2a')][_0x6eec('0x4b')]()[_0x6eec('0x24')](respondWithResult(_0x5a6e05,null))[_0x6eec('0x41')](handleError(_0x5a6e05,null));};exports['download']=function(_0x51fd37,_0x50436d,_0x36c49b){var _0x32b289=require(_0x6eec('0x4c'));var _0x1de626=![];var _0x5178f5={};if(_0x51fd37['query'][_0x6eec('0x2d')]&&_0x51fd37[_0x6eec('0x32')][_0x6eec('0x2d')]==='uniqueid'){_0x5178f5[_0x6eec('0x4d')]=_0x51fd37[_0x6eec('0x43')]['id'];}else{_0x5178f5['id']=_0x51fd37[_0x6eec('0x43')]['id'];}return db[_0x6eec('0x2a')][_0x6eec('0x4e')]({'where':_0x5178f5,'attributes':['id',_0x6eec('0x4a')],'raw':!![]})[_0x6eec('0x24')](handleEntityNotFound(_0x50436d,null))[_0x6eec('0x24')](function(_0x45fed3){if(_0x45fed3){var _0x4e921a=path[_0x6eec('0x4f')](config['root'],_0x6eec('0x50'),_0x45fed3[_0x6eec('0x4a')]);var _0x424962=util[_0x6eec('0x2f')](_0x6eec('0x51'),_0x4e921a);if(fs[_0x6eec('0x52')](_0x424962)){_0x1de626=!![];return _0x32b289[_0x6eec('0x53')](_0x424962,_0x4e921a,config['secrets'][_0x6eec('0x54')])['then'](function(){return _0x45fed3;});}return _0x45fed3;}})[_0x6eec('0x24')](function(_0x5c905f){if(_0x5c905f){var _0x237324=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x5c905f[_0x6eec('0x4a')]);if(!fs[_0x6eec('0x52')](_0x237324)){throw new db[(_0x6eec('0x56'))][(_0x6eec('0x57'))](_0x6eec('0x58'));}if(_0x5c905f[_0x6eec('0x59')]){return _0x50436d['download'](_0x237324,_0x5c905f['filename']+path[_0x6eec('0x5a')](_0x237324),function(){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}else{return _0x50436d[_0x6eec('0x5c')](_0x237324,function(_0x2c0644){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}}})['catch'](function(_0x1d8fb1){if(_0x1d8fb1[_0x6eec('0x5d')]==='ScreenRecording\x20not\x20found'){_0x50436d['status'](0x194)['send'](_0x6eec('0x5e'));}else{return handleError(_0x50436d,null);}});};exports[_0x6eec('0x25')]=function(_0x4cf859,_0x1d2baf){return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x4cf859[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](function(_0xc852b3){if(_[_0x6eec('0x5f')](_0xc852b3)){throw new ReferenceError('Entity\x20not\x20found');}return _0xc852b3;})['then'](function(_0x54fcd0){var _0x1230fc=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x54fcd0[_0x6eec('0x4a')]);logger[_0x6eec('0x60')](_0x6eec('0x61'),_0x1230fc);if(!_[_0x6eec('0x5f')](_0x54fcd0[_0x6eec('0x4a')])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')](_0x6eec('0x62')+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}_0x1230fc=_0x1230fc+_0x6eec('0x65');if(!_[_0x6eec('0x5f')](_0x54fcd0['value'])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')]('File:\x20\x22'+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}return _0x54fcd0;})['then'](function(_0x7dd727){if(!_0x7dd727)throw new InternalError();return _0x7dd727[_0x6eec('0x25')]();})[_0x6eec('0x24')](function(){_0x1d2baf[_0x6eec('0x19')](0xcc)['end']();})[_0x6eec('0x41')](handleError(_0x1d2baf,null));}; \ No newline at end of file +var _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x5cb279,_0x2fa349){var _0x3458d0=function(_0xb887a4){while(--_0xb887a4){_0x5cb279['push'](_0x5cb279['shift']());}};_0x3458d0(++_0x2fa349);}(_0xe14b,0x93));var _0xbe14=function(_0x22c0fc,_0x14bec2){_0x22c0fc=_0x22c0fc-0x0;var _0x38a9a5=_0xe14b[_0x22c0fc];return _0x38a9a5;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index eb46e42..c70002a 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 _0xb77f=['interactionid','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','define','ScreenRecording'];(function(_0x1be3b3,_0x4335ee){var _0x4f8b2d=function(_0x1d955f){while(--_0x1d955f){_0x1be3b3['push'](_0x1be3b3['shift']());}};_0x4f8b2d(++_0x4335ee);}(_0xb77f,0x1cd));var _0xfb77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb77f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfb77('0x0'));var util=require(_0xfb77('0x1'));var logger=require(_0xfb77('0x2'))(_0xfb77('0x3'));var moment=require('moment');var BPromise=require(_0xfb77('0x4'));var rp=require(_0xfb77('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfb77('0x6'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x1d1b17,_0x41144e){return _0x1d1b17[_0xfb77('0x7')](_0xfb77('0x8'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xfb77('0x9'),'fields':[_0xfb77('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd23f=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes'];(function(_0x57a313,_0x12c11b){var _0x2c0274=function(_0x446748){while(--_0x446748){_0x57a313['push'](_0x57a313['shift']());}};_0x2c0274(++_0x12c11b);}(_0xd23f,0x82));var _0xfd23=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd23f[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xfd23('0x0'));var util=require(_0xfd23('0x1'));var logger=require(_0xfd23('0x2'))(_0xfd23('0x3'));var moment=require(_0xfd23('0x4'));var BPromise=require(_0xfd23('0x5'));var rp=require(_0xfd23('0x6'));var fs=require('fs');var path=require(_0xfd23('0x7'));var rimraf=require(_0xfd23('0x8'));var config=require('../../config/environment');var attributes=require(_0xfd23('0x9'));module['exports']=function(_0x33d34f,_0x15b33d){return _0x33d34f[_0xfd23('0xa')](_0xfd23('0xb'),attributes,{'tableName':_0xfd23('0xc'),'paranoid':![],'indexes':[{'name':_0xfd23('0xd'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 85629eb..fad2dda 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 _0x963d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x1c0923,_0x296c62){var _0xb649c2=function(_0x2d6def){while(--_0x2d6def){_0x1c0923['push'](_0x1c0923['shift']());}};_0xb649c2(++_0x296c62);}(_0x963d,0x10f));var _0xd963=function(_0x31d3e8,_0x3a12f7){_0x31d3e8=_0x31d3e8-0x0;var _0x4a5719=_0x963d[_0x31d3e8];return _0x4a5719;};'use strict';var _=require('lodash');var util=require(_0xd963('0x0'));var moment=require(_0xd963('0x1'));var BPromise=require(_0xd963('0x2'));var rs=require(_0xd963('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd963('0x4'));var logger=require(_0xd963('0x5'))(_0xd963('0x6'));var config=require(_0xd963('0x7'));var jayson=require(_0xd963('0x8'));var client=jayson[_0xd963('0x9')][_0xd963('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x245e0b,_0x30915b,_0xf961d7){return new BPromise(function(_0x6d0c0d,_0x5826df){return client[_0xd963('0xb')](_0x245e0b,_0xf961d7)[_0xd963('0xc')](function(_0x50a6df){logger[_0xd963('0xd')](_0xd963('0xe'),_0x30915b,_0xd963('0xf'));logger['debug'](_0xd963('0x10'),_0x30915b,_0xd963('0xf'),JSON[_0xd963('0x11')](_0x50a6df));if(_0x50a6df[_0xd963('0x12')]){if(_0x50a6df[_0xd963('0x12')][_0xd963('0x13')]===0x1f4){logger[_0xd963('0x12')](_0xd963('0xe'),_0x30915b,_0x50a6df[_0xd963('0x12')][_0xd963('0x14')]);return _0x5826df(_0x50a6df[_0xd963('0x12')]['message']);}logger[_0xd963('0x12')](_0xd963('0xe'),_0x30915b,_0x50a6df[_0xd963('0x12')][_0xd963('0x14')]);return _0x6d0c0d(_0x50a6df['error']['message']);}else{logger['info'](_0xd963('0xe'),_0x30915b,_0xd963('0xf'));_0x6d0c0d(_0x50a6df[_0xd963('0x15')][_0xd963('0x14')]);}})[_0xd963('0x16')](function(_0x64a6df){logger[_0xd963('0x12')](_0xd963('0xe'),_0x30915b,_0x64a6df);_0x5826df(_0x64a6df);});});} \ No newline at end of file +var _0xc094=['result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x50a783,_0xac43c6){var _0x3cf726=function(_0x54819f){while(--_0x54819f){_0x50a783['push'](_0x50a783['shift']());}};_0x3cf726(++_0xac43c6);}(_0xc094,0x151));var _0x4c09=function(_0xa7177,_0x474041){_0xa7177=_0xa7177-0x0;var _0x2fb17f=_0xc094[_0xa7177];return _0x2fb17f;};'use strict';var _=require('lodash');var util=require(_0x4c09('0x0'));var moment=require(_0x4c09('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c09('0x2'));var fs=require('fs');var Redis=require(_0x4c09('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c09('0x4'));var logger=require(_0x4c09('0x5'))('rpc');var config=require(_0x4c09('0x6'));var jayson=require(_0x4c09('0x7'));var client=jayson[_0x4c09('0x8')][_0x4c09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aab43,_0x354eab,_0x599491){return new BPromise(function(_0x2fe6a2,_0x59dd8d){return client[_0x4c09('0xa')](_0x5aab43,_0x599491)[_0x4c09('0xb')](function(_0xf11dab){logger['info'](_0x4c09('0xc'),_0x354eab,_0x4c09('0xd'));logger[_0x4c09('0xe')](_0x4c09('0xf'),_0x354eab,_0x4c09('0xd'),JSON['stringify'](_0xf11dab));if(_0xf11dab[_0x4c09('0x10')]){if(_0xf11dab[_0x4c09('0x10')][_0x4c09('0x11')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x354eab,_0xf11dab[_0x4c09('0x10')][_0x4c09('0x12')]);return _0x59dd8d(_0xf11dab[_0x4c09('0x10')]['message']);}logger['error'](_0x4c09('0xc'),_0x354eab,_0xf11dab['error'][_0x4c09('0x12')]);return _0x2fe6a2(_0xf11dab[_0x4c09('0x10')][_0x4c09('0x12')]);}else{logger[_0x4c09('0x13')](_0x4c09('0xc'),_0x354eab,'request\x20sent');_0x2fe6a2(_0xf11dab[_0x4c09('0x14')][_0x4c09('0x12')]);}})['catch'](function(_0x11c263){logger['error'](_0x4c09('0xc'),_0x354eab,_0x11c263);_0x59dd8d(_0x11c263);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 1cf99c7..f87a2fe 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 _0x6edf=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','server/files/images/logos/','%s%s','extname','originalname','/:id/logo','single','addLogo','root','format','logologin','post','file','preferred','addPreferred','addFavicon','put','exports','multer','connect-timeout','express'];(function(_0x55b199,_0xbef323){var _0x435690=function(_0x3f9d57){while(--_0x3f9d57){_0x55b199['push'](_0x55b199['shift']());}};_0x435690(++_0xbef323);}(_0x6edf,0x180));var _0xf6ed=function(_0x4f8366,_0x1fd48a){_0x4f8366=_0x4f8366-0x0;var _0x5b5fa2=_0x6edf[_0x4f8366];return _0x5b5fa2;};'use strict';var multer=require(_0xf6ed('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf6ed('0x1'));var express=require(_0xf6ed('0x2'));var router=express[_0xf6ed('0x3')]();var fs_extra=require(_0xf6ed('0x4'));var auth=require(_0xf6ed('0x5'));var interaction=require(_0xf6ed('0x6'));var config=require(_0xf6ed('0x7'));var controller=require(_0xf6ed('0x8'));router[_0xf6ed('0x9')]('/',auth[_0xf6ed('0xa')](),controller[_0xf6ed('0xb')]);router[_0xf6ed('0x9')](_0xf6ed('0xc'),controller[_0xf6ed('0xd')]);router[_0xf6ed('0x9')](_0xf6ed('0xe'),controller[_0xf6ed('0xf')]);router[_0xf6ed('0x9')]('/:id/logo',controller[_0xf6ed('0x10')]);router[_0xf6ed('0x9')](_0xf6ed('0x11'),controller[_0xf6ed('0x12')]);router['get'](_0xf6ed('0x13'),controller[_0xf6ed('0x14')]);router[_0xf6ed('0x9')](_0xf6ed('0x15'),controller[_0xf6ed('0x16')]);router[_0xf6ed('0x9')](_0xf6ed('0x17'),controller['getFavicon']);var upload=multer({'storage':multer[_0xf6ed('0x18')]({'destination':function(_0xd00709,_0x459a37,_0x49f57c){_0x49f57c(null,path[_0xf6ed('0x19')](config['root'],_0xf6ed('0x1a')));},'filename':function(_0x248cdf,_0x503711,_0x4a3ebb){_0x4a3ebb(null,util['format'](_0xf6ed('0x1b'),'logo',path[_0xf6ed('0x1c')](_0x503711[_0xf6ed('0x1d')])));}})});router['post'](_0xf6ed('0x1e'),upload[_0xf6ed('0x1f')]('file'),controller[_0xf6ed('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x211ab7,_0x5a5cd4,_0x4124b8){_0x4124b8(null,path[_0xf6ed('0x19')](config[_0xf6ed('0x21')],'server/files/images/logos/'));},'filename':function(_0x25f062,_0x1a73e3,_0x2f6c0a){_0x2f6c0a(null,util[_0xf6ed('0x22')](_0xf6ed('0x1b'),_0xf6ed('0x23'),path['extname'](_0x1a73e3[_0xf6ed('0x1d')])));}})});router[_0xf6ed('0x24')](_0xf6ed('0x11'),upload[_0xf6ed('0x1f')](_0xf6ed('0x25')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xf6ed('0x18')]({'destination':function(_0x1c53f1,_0x3999ad,_0x1422f9){_0x1422f9(null,path['join'](config['root'],_0xf6ed('0x1a')));},'filename':function(_0x2184e7,_0x5286ec,_0x1174d4){_0x1174d4(null,util[_0xf6ed('0x22')](_0xf6ed('0x1b'),_0xf6ed('0x26'),path[_0xf6ed('0x1c')](_0x5286ec['originalname'])));}})});router[_0xf6ed('0x24')](_0xf6ed('0x15'),upload[_0xf6ed('0x1f')](_0xf6ed('0x25')),controller[_0xf6ed('0x27')]);var upload=multer({'storage':multer[_0xf6ed('0x18')]({'destination':function(_0x37439b,_0x429981,_0x13db3e){_0x13db3e(null,path[_0xf6ed('0x19')](config[_0xf6ed('0x21')],_0xf6ed('0x1a')));},'filename':function(_0x2ecc18,_0x44333a,_0x2cb838){_0x2cb838(null,util[_0xf6ed('0x22')](_0xf6ed('0x1b'),'favicon',path['extname'](_0x44333a[_0xf6ed('0x1d')])));}})});router[_0xf6ed('0x24')](_0xf6ed('0x17'),upload['single'](_0xf6ed('0x25')),controller[_0xf6ed('0x28')]);router[_0xf6ed('0x29')](_0xf6ed('0xe'),auth['isAuthenticated'](),controller['update']);module[_0xf6ed('0x2a')]=router; \ No newline at end of file +var _0x8792=['multer','util','connect-timeout','Router','../../config/environment','./setting.controller','index','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','file','addLogo','join','format','logologin','addLogoLogin','preferred','addPreferred','addFavicon','put','update','exports'];(function(_0x1198d1,_0x7c8ffe){var _0x5a8d4a=function(_0x2a9781){while(--_0x2a9781){_0x1198d1['push'](_0x1198d1['shift']());}};_0x5a8d4a(++_0x7c8ffe);}(_0x8792,0x148));var _0x2879=function(_0x909306,_0x1cad80){_0x909306=_0x909306-0x0;var _0x3a5131=_0x8792[_0x909306];return _0x3a5131;};'use strict';var multer=require(_0x2879('0x0'));var util=require(_0x2879('0x1'));var path=require('path');var timeout=require(_0x2879('0x2'));var express=require('express');var router=express[_0x2879('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2879('0x4'));var controller=require(_0x2879('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x2879('0x6')]);router[_0x2879('0x7')]('/now',controller['getDate']);router[_0x2879('0x7')](_0x2879('0x8'),controller[_0x2879('0x9')]);router[_0x2879('0x7')](_0x2879('0xa'),controller[_0x2879('0xb')]);router[_0x2879('0x7')](_0x2879('0xc'),controller[_0x2879('0xd')]);router[_0x2879('0x7')](_0x2879('0xe'),controller[_0x2879('0xf')]);router[_0x2879('0x7')](_0x2879('0x10'),controller[_0x2879('0x11')]);router[_0x2879('0x7')](_0x2879('0x12'),controller[_0x2879('0x13')]);var upload=multer({'storage':multer[_0x2879('0x14')]({'destination':function(_0x21ddaa,_0x3ba693,_0x45b4f9){_0x45b4f9(null,path['join'](config[_0x2879('0x15')],_0x2879('0x16')));},'filename':function(_0x2789dd,_0x252783,_0x2503b9){_0x2503b9(null,util['format'](_0x2879('0x17'),_0x2879('0x18'),path[_0x2879('0x19')](_0x252783[_0x2879('0x1a')])));}})});router[_0x2879('0x1b')]('/:id/logo',upload[_0x2879('0x1c')](_0x2879('0x1d')),controller[_0x2879('0x1e')]);var upload=multer({'storage':multer[_0x2879('0x14')]({'destination':function(_0xac8f27,_0x395cd3,_0x1fd914){_0x1fd914(null,path[_0x2879('0x1f')](config[_0x2879('0x15')],_0x2879('0x16')));},'filename':function(_0x5bf6bd,_0x2f9ade,_0x1f7784){_0x1f7784(null,util[_0x2879('0x20')]('%s%s',_0x2879('0x21'),path[_0x2879('0x19')](_0x2f9ade[_0x2879('0x1a')])));}})});router['post'](_0x2879('0xc'),upload[_0x2879('0x1c')]('file'),controller[_0x2879('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd7ce1c,_0x3be9a8,_0x29954e){_0x29954e(null,path[_0x2879('0x1f')](config[_0x2879('0x15')],_0x2879('0x16')));},'filename':function(_0x53a047,_0x4e742a,_0x388dcf){_0x388dcf(null,util['format'](_0x2879('0x17'),_0x2879('0x23'),path[_0x2879('0x19')](_0x4e742a[_0x2879('0x1a')])));}})});router[_0x2879('0x1b')](_0x2879('0x10'),upload[_0x2879('0x1c')]('file'),controller[_0x2879('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ad064,_0x1a0686,_0x3cca6a){_0x3cca6a(null,path['join'](config[_0x2879('0x15')],_0x2879('0x16')));},'filename':function(_0x56fea3,_0x385dbb,_0x1d0c00){_0x1d0c00(null,util[_0x2879('0x20')]('%s%s','favicon',path[_0x2879('0x19')](_0x385dbb[_0x2879('0x1a')])));}})});router[_0x2879('0x1b')](_0x2879('0x12'),upload[_0x2879('0x1c')](_0x2879('0x1d')),controller[_0x2879('0x25')]);router[_0x2879('0x26')](_0x2879('0x8'),auth['isAuthenticated'](),controller[_0x2879('0x27')]);module[_0x2879('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index bbe0144..8bddb29 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 _0x2ef3=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x2a9995,_0x33e385){var _0x5f1c31=function(_0x22b3a5){while(--_0x22b3a5){_0x2a9995['push'](_0x2a9995['shift']());}};_0x5f1c31(++_0x33e385);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ef466,_0x251f98){_0x5ef466=_0x5ef466-0x0;var _0x57274a=_0x2ef3[_0x5ef466];return _0x57274a;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'min_internal':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x32ef('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnusername':{'type':Sequelize[_0x32ef('0x5')]},'turnpassword':{'type':Sequelize[_0x32ef('0x5')]},'pageTitle':{'type':Sequelize[_0x32ef('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x8')},'enableEmailPreview':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x32ef('0x5')]},'defaultFavicon':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x32ef('0x2')]},'transcribeRegion':{'type':Sequelize[_0x32ef('0x5')]},'sentiment':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x32ef('0x5')]},'language':{'type':Sequelize[_0x32ef('0x5')]},'bucket':{'type':Sequelize[_0x32ef('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x32ef('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xadb5=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0xadb5,0xad));var _0x5adb=function(_0x402d66,_0x122409){_0x402d66=_0x402d66-0x0;var _0x19220b=_0xadb5[_0x402d66];return _0x19220b;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5adb('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5adb('0x2')](0xb),'unique':_0x5adb('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':_0x5adb('0x5')},'logo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5adb('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnusername':{'type':Sequelize[_0x5adb('0x4')]},'turnpassword':{'type':Sequelize[_0x5adb('0x4')]},'pageTitle':{'type':Sequelize[_0x5adb('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5adb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x5adb('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5adb('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5adb('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5adb('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5adb('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5adb('0x4')]},'sentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5adb('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5adb('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x5adb('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5adb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 2b1a552..62beb94 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 _0xa85d=['desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','show','params','length','find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','download','server/files/images/logos','default_loginLogo.svg','default','gdpr','getPreferred','default_preferred.png','default_favicon.ico','getDate','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4c18ec,_0x48c217){var _0x31340a=function(_0x284dc0){while(--_0x284dc0){_0x4c18ec['push'](_0x4c18ec['shift']());}};_0x31340a(++_0x48c217);}(_0xa85d,0x68));var _0xda85=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xa85d[_0x209fcd];return _0x501d5e;};'use strict';var emlformat=require(_0xda85('0x0'));var rimraf=require(_0xda85('0x1'));var zipdir=require(_0xda85('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda85('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xda85('0x4'));var path=require(_0xda85('0x5'));var sox=require(_0xda85('0x6'));var csv=require(_0xda85('0x7'));var ejs=require(_0xda85('0x8'));var fs=require('fs');var fs_extra=require(_0xda85('0x9'));var _=require(_0xda85('0xa'));var squel=require(_0xda85('0xb'));var crypto=require(_0xda85('0xc'));var jsforce=require(_0xda85('0xd'));var deskjs=require(_0xda85('0xe'));var toCsv=require(_0xda85('0x7'));var querystring=require(_0xda85('0xf'));var Papa=require(_0xda85('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xda85('0x11'));var hardwareService=require(_0xda85('0x12'));var logger=require(_0xda85('0x13'))(_0xda85('0x14'));var utils=require(_0xda85('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xda85('0x16'));var db=require(_0xda85('0x17'))['db'];var jayson=require(_0xda85('0x18'));var client=jayson[_0xda85('0x19')][_0xda85('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1a5a30,_0x4a3bf4,_0x14cb3f,_0x30f8bd){return new BPromise(function(_0x530c06,_0x1338d3){var _0x481fe2=_0x30f8bd||client;return _0x481fe2[_0xda85('0x1b')](_0x1a5a30,_0x14cb3f)[_0xda85('0x1c')](function(_0x2a62c9){logger[_0xda85('0x1d')](_0xda85('0x1e'),_0x4a3bf4,'request\x20sent');logger[_0xda85('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x4a3bf4,_0xda85('0x20'),JSON['stringify'](_0x2a62c9));if(_0x2a62c9[_0xda85('0x21')]){if(_0x2a62c9[_0xda85('0x21')][_0xda85('0x22')]===0x1f4){logger[_0xda85('0x21')](_0xda85('0x1e'),_0x4a3bf4,_0x2a62c9[_0xda85('0x21')][_0xda85('0x23')]);return _0x1338d3(_0x2a62c9['error'][_0xda85('0x23')]);}logger['error']('Setting,\x20%s,\x20%s',_0x4a3bf4,_0x2a62c9[_0xda85('0x21')][_0xda85('0x23')]);return _0x530c06(_0x2a62c9[_0xda85('0x21')][_0xda85('0x23')]);}else{logger[_0xda85('0x1d')](_0xda85('0x1e'),_0x4a3bf4,_0xda85('0x20'));_0x530c06(_0x2a62c9['result'][_0xda85('0x23')]);}})[_0xda85('0x24')](function(_0x17f5df){logger[_0xda85('0x21')](_0xda85('0x1e'),_0x4a3bf4,_0x17f5df);_0x1338d3(_0x17f5df);});});}function respondWithStatusCode(_0x415eba,_0x47252e){_0x47252e=_0x47252e||0xcc;return function(_0x3501cf){if(_0x3501cf){return _0x415eba[_0xda85('0x25')](_0x47252e);}return _0x415eba[_0xda85('0x26')](_0x47252e)[_0xda85('0x27')]();};}function respondWithResult(_0x264628,_0x1f06cd){_0x1f06cd=_0x1f06cd||0xc8;return function(_0x4cfb5e){if(_0x4cfb5e){return _0x264628['status'](_0x1f06cd)[_0xda85('0x28')](_0x4cfb5e);}};}function respondWithFilteredResult(_0x5ae962,_0x2091f2){return function(_0x5d3544){if(_0x5d3544){var _0x5dfe83=typeof _0x2091f2['offset']===_0xda85('0x29')&&typeof _0x2091f2[_0xda85('0x2a')]===_0xda85('0x29');var _0x5e8b2c=_0x5d3544[_0xda85('0x2b')];var _0x1b7d08=_0x5dfe83?0x0:_0x2091f2[_0xda85('0x2c')];var _0x25576a=_0x5dfe83?_0x5d3544[_0xda85('0x2b')]:_0x2091f2[_0xda85('0x2c')]+_0x2091f2['limit'];var _0x196bef;if(_0x25576a>=_0x5e8b2c){_0x25576a=_0x5e8b2c;_0x196bef=0xc8;}else{_0x196bef=0xce;}_0x5ae962[_0xda85('0x26')](_0x196bef);return _0x5ae962[_0xda85('0x2d')]('Content-Range',_0x1b7d08+'-'+_0x25576a+'/'+_0x5e8b2c)[_0xda85('0x28')](_0x5d3544);}return null;};}function patchUpdates(_0x36bc10){return function(_0x44bf99){try{jsonpatch[_0xda85('0x2e')](_0x44bf99,_0x36bc10,!![]);}catch(_0x2de90f){return BPromise[_0xda85('0x2f')](_0x2de90f);}return _0x44bf99['save']();};}function saveUpdates(_0x1f3085,_0x459b1c){return function(_0x149120){if(_0x149120){return _0x149120[_0xda85('0x30')](_0x1f3085)['then'](function(_0x89c552){return _0x89c552;});}return null;};}function removeEntity(_0x7c3a40,_0x1e7578){return function(_0x419666){if(_0x419666){return _0x419666[_0xda85('0x31')]()['then'](function(){_0x7c3a40[_0xda85('0x26')](0xcc)[_0xda85('0x27')]();});}};}function handleEntityNotFound(_0x11f024,_0x3efbc0){return function(_0x2b44ef){if(!_0x2b44ef){_0x11f024[_0xda85('0x25')](0x194);}return _0x2b44ef;};}function handleError(_0x37dc65,_0x6a4463){_0x6a4463=_0x6a4463||0x1f4;return function(_0x58ff42){logger[_0xda85('0x21')](_0x58ff42[_0xda85('0x32')]);if(_0x58ff42[_0xda85('0x33')]){delete _0x58ff42[_0xda85('0x33')];}_0x37dc65[_0xda85('0x26')](_0x6a4463)[_0xda85('0x34')](_0x58ff42);};}exports[_0xda85('0x35')]=function(_0x21871b,_0x2e268b){var _0x2b05b7={},_0x41ed4e={},_0x3e65f2={'count':0x0,'rows':[]};var _0xf99452=_[_0xda85('0x36')](db[_0xda85('0x37')][_0xda85('0x38')],function(_0x3092a0){return{'name':_0x3092a0[_0xda85('0x39')],'type':_0x3092a0['type'][_0xda85('0x3a')]};});_0x41ed4e[_0xda85('0x3b')]=_['map'](_0xf99452,_0xda85('0x33'));_0x41ed4e[_0xda85('0x3c')]=_[_0xda85('0x3d')](_0x21871b[_0xda85('0x3c')]);_0x41ed4e[_0xda85('0x3e')]=_[_0xda85('0x3f')](_0x41ed4e[_0xda85('0x3b')],_0x41ed4e[_0xda85('0x3c')]);_0x2b05b7['attributes']=_[_0xda85('0x3f')](_0x41ed4e['model'],qs['fields'](_0x21871b['query'][_0xda85('0x40')]));_0x2b05b7[_0xda85('0x41')]=_0x2b05b7[_0xda85('0x41')]['length']?_0x2b05b7[_0xda85('0x41')]:_0x41ed4e['model'];if(!_0x21871b[_0xda85('0x3c')][_0xda85('0x42')]('nolimit')){_0x2b05b7['limit']=qs[_0xda85('0x2a')](_0x21871b[_0xda85('0x3c')]['limit']);_0x2b05b7[_0xda85('0x2c')]=qs[_0xda85('0x2c')](_0x21871b[_0xda85('0x3c')][_0xda85('0x2c')]);}_0x2b05b7[_0xda85('0x43')]=qs[_0xda85('0x44')](_0x21871b['query'][_0xda85('0x44')]);_0x2b05b7[_0xda85('0x45')]=qs[_0xda85('0x3e')](_[_0xda85('0x46')](_0x21871b[_0xda85('0x3c')],_0x41ed4e['filters']),_0xf99452);if(_0x21871b[_0xda85('0x3c')][_0xda85('0x47')]){_0x2b05b7[_0xda85('0x45')]=_[_0xda85('0x48')](_0x2b05b7[_0xda85('0x45')],{'$or':_[_0xda85('0x36')](_0xf99452,function(_0x4949ad){if(_0x4949ad[_0xda85('0x49')]!=='VIRTUAL'){var _0x1b8bef={};_0x1b8bef[_0x4949ad[_0xda85('0x33')]]={'$like':'%'+_0x21871b['query']['filter']+'%'};return _0x1b8bef;}})});}_0x2b05b7=_[_0xda85('0x48')]({},_0x2b05b7,_0x21871b[_0xda85('0x4a')]);var _0x2fb16c={'where':_0x2b05b7['where']};return db[_0xda85('0x37')][_0xda85('0x2b')](_0x2fb16c)['then'](function(_0xa19c01){_0x3e65f2[_0xda85('0x2b')]=_0xa19c01;if(_0x21871b[_0xda85('0x3c')][_0xda85('0x4b')]){_0x2b05b7[_0xda85('0x4c')]=[{'all':!![]}];}return db[_0xda85('0x37')]['findAll'](_0x2b05b7);})[_0xda85('0x1c')](function(_0x270d53){_0x3e65f2[_0xda85('0x4d')]=_0x270d53;return _0x3e65f2;})[_0xda85('0x1c')](respondWithFilteredResult(_0x2e268b,_0x2b05b7))[_0xda85('0x24')](handleError(_0x2e268b,null));};exports[_0xda85('0x4e')]=function(_0x5d3c81,_0x502c3a){var _0x267f29={'raw':![],'where':{'id':_0x5d3c81[_0xda85('0x4f')]['id']}},_0x26dc06={};_0x26dc06[_0xda85('0x3b')]=_['keys'](db[_0xda85('0x37')]['rawAttributes']);_0x26dc06['query']=_[_0xda85('0x3d')](_0x5d3c81['query']);_0x26dc06[_0xda85('0x3e')]=_[_0xda85('0x3f')](_0x26dc06[_0xda85('0x3b')],_0x26dc06[_0xda85('0x3c')]);_0x267f29['attributes']=_[_0xda85('0x3f')](_0x26dc06[_0xda85('0x3b')],qs['fields'](_0x5d3c81[_0xda85('0x3c')][_0xda85('0x40')]));_0x267f29['attributes']=_0x267f29['attributes'][_0xda85('0x50')]?_0x267f29[_0xda85('0x41')]:_0x26dc06[_0xda85('0x3b')];if(_0x5d3c81[_0xda85('0x3c')][_0xda85('0x4b')]){_0x267f29[_0xda85('0x4c')]=[{'all':!![]}];}_0x267f29=_[_0xda85('0x48')]({},_0x267f29,_0x5d3c81[_0xda85('0x4a')]);return db[_0xda85('0x37')][_0xda85('0x51')](_0x267f29)[_0xda85('0x1c')](handleEntityNotFound(_0x502c3a,null))[_0xda85('0x1c')](respondWithResult(_0x502c3a,null))[_0xda85('0x24')](handleError(_0x502c3a,null));};exports[_0xda85('0x30')]=function(_0x43f7b0,_0x50d3b0){if(_0x43f7b0[_0xda85('0x52')]['id']){delete _0x43f7b0[_0xda85('0x52')]['id'];}return db[_0xda85('0x37')][_0xda85('0x51')]({'where':{'id':_0x43f7b0[_0xda85('0x4f')]['id']}})[_0xda85('0x1c')](handleEntityNotFound(_0x50d3b0,null))['then'](saveUpdates(_0x43f7b0[_0xda85('0x52')],null))[_0xda85('0x1c')](respondWithResult(_0x50d3b0,null))['catch'](handleError(_0x50d3b0,null));};exports[_0xda85('0x53')]=function(_0x4803e8,_0x3518b9,_0x5d5da4){if(_0x4803e8[_0xda85('0x54')]&&_0x4803e8[_0xda85('0x54')][_0xda85('0x55')]){_0x4803e8[_0xda85('0x52')][_0xda85('0x56')]=_0x4803e8[_0xda85('0x54')][_0xda85('0x55')];}return db[_0xda85('0x37')][_0xda85('0x51')]({'where':{'id':_0x4803e8[_0xda85('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3518b9,null))[_0xda85('0x1c')](saveUpdates(_0x4803e8[_0xda85('0x52')],null))['then'](respondWithResult(_0x3518b9,null))['catch'](handleError(_0x3518b9,null));};exports[_0xda85('0x57')]=function(_0x448432,_0xc9ec0,_0x27ff3a){if(_0x448432[_0xda85('0x54')]&&_0x448432[_0xda85('0x54')][_0xda85('0x55')]){_0x448432[_0xda85('0x52')]['loginLogo']=_0x448432['file'][_0xda85('0x55')];}return db[_0xda85('0x37')][_0xda85('0x51')]({'where':{'id':_0x448432[_0xda85('0x4f')]['id']}})[_0xda85('0x1c')](handleEntityNotFound(_0xc9ec0,null))[_0xda85('0x1c')](saveUpdates(_0x448432[_0xda85('0x52')],null))[_0xda85('0x1c')](respondWithResult(_0xc9ec0,null))[_0xda85('0x24')](handleError(_0xc9ec0,null));};var utilLicense=require('../../config/license/util');exports[_0xda85('0x58')]=function(_0x5ef2c6,_0x52cd46,_0x4e983a){var _0x5eac44='server/files/images/logos';var _0x35953f={'custom':![]};return utilLicense[_0xda85('0x59')]()['then'](function(_0xb27425){if(_0xb27425){_0x35953f=_0xb27425;}return db[_0xda85('0x37')]['find']({'where':{'id':_0x5ef2c6[_0xda85('0x4f')]['id']},'attributes':[_0xda85('0x56'),_0xda85('0x5a'),_0xda85('0x5b'),_0xda85('0x5c'),_0xda85('0x5d'),_0xda85('0x5e'),_0xda85('0x5f'),_0xda85('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x52cd46,null))[_0xda85('0x1c')](function(_0x334ffa){if(_0x334ffa){var _0x1622b4=_0x334ffa['logo']&&fs['existsSync'](path[_0xda85('0x61')](config[_0xda85('0x62')],_0x5eac44,_['toLower'](_0x334ffa['logo'])))?path[_0xda85('0x61')](config[_0xda85('0x62')],_0x5eac44,_[_0xda85('0x63')](_0x334ffa[_0xda85('0x56')])):path['join'](config[_0xda85('0x62')],_0x5eac44,_[_0xda85('0x63')](_0xda85('0x64')));var _0x5a0b9b='default'+_[_0xda85('0x65')](_0xda85('0x56'));if(_0x334ffa[_0x5a0b9b]||!_0x35953f[_0xda85('0x66')]){_0x1622b4=path['join'](config[_0xda85('0x62')],_0x5eac44,_[_0xda85('0x63')](_0xda85('0x64')));}if(!fs[_0xda85('0x67')](_0x1622b4)){throw new db[(_0xda85('0x68'))][(_0xda85('0x69'))](_[_0xda85('0x65')](_0xda85('0x56'))+_0xda85('0x6a'));}return _0x52cd46[_0xda85('0x6b')](_0x1622b4);}})['catch'](handleError(_0x52cd46,null));};var utilLicense=require(_0xda85('0x16'));exports['getLogoLogin']=function(_0x553fef,_0x348539,_0x2efaa1){var _0x494638=_0xda85('0x6c');var _0x368074={'custom':![]};return utilLicense[_0xda85('0x59')]()['then'](function(_0x57c437){if(_0x57c437){_0x368074=_0x57c437;}return db[_0xda85('0x37')][_0xda85('0x51')]({'where':{'id':_0x553fef[_0xda85('0x4f')]['id']},'attributes':['logo','loginLogo','preferred',_0xda85('0x5c'),'defaultLogo',_0xda85('0x5e'),_0xda85('0x5f'),_0xda85('0x60')],'raw':!![]});})[_0xda85('0x1c')](handleEntityNotFound(_0x348539,null))[_0xda85('0x1c')](function(_0x3dce02){if(_0x3dce02){var _0x91f4cd=_0x3dce02[_0xda85('0x5a')]&&fs[_0xda85('0x67')](path[_0xda85('0x61')](config[_0xda85('0x62')],_0x494638,_[_0xda85('0x63')](_0x3dce02[_0xda85('0x5a')])))?path['join'](config[_0xda85('0x62')],_0x494638,_[_0xda85('0x63')](_0x3dce02[_0xda85('0x5a')])):path['join'](config['root'],_0x494638,_[_0xda85('0x63')](_0xda85('0x6d')));var _0x47ef38=_0xda85('0x6e')+_[_0xda85('0x65')](_0xda85('0x5a'));if(_0x3dce02[_0x47ef38]||!_0x368074[_0xda85('0x66')]){_0x91f4cd=path[_0xda85('0x61')](config[_0xda85('0x62')],_0x494638,_[_0xda85('0x63')](_0xda85('0x6d')));}if(!fs['existsSync'](_0x91f4cd)){throw new db[(_0xda85('0x68'))][(_0xda85('0x69'))](_['upperFirst'](_0xda85('0x5a'))+_0xda85('0x6a'));}return _0x348539[_0xda85('0x6b')](_0x91f4cd);}})[_0xda85('0x24')](handleError(_0x348539,null));};exports[_0xda85('0x6f')]=function(_0x58edb8,_0x1635b9){return db['Setting'][_0xda85('0x51')]({'where':{'id':_0x58edb8[_0xda85('0x4f')]['id']},'attributes':['securePassword']})[_0xda85('0x1c')](respondWithResult(_0x1635b9,null))[_0xda85('0x24')](handleError(_0x1635b9,null));};exports['addPreferred']=function(_0x59ff57,_0x534c4f,_0x3b61c7){if(_0x59ff57[_0xda85('0x54')]&&_0x59ff57[_0xda85('0x54')][_0xda85('0x55')]){_0x59ff57[_0xda85('0x52')][_0xda85('0x5b')]=_0x59ff57[_0xda85('0x54')]['filename'];}return db['Setting'][_0xda85('0x51')]({'where':{'id':_0x59ff57[_0xda85('0x4f')]['id']}})[_0xda85('0x1c')](handleEntityNotFound(_0x534c4f,null))[_0xda85('0x1c')](saveUpdates(_0x59ff57[_0xda85('0x52')],null))[_0xda85('0x1c')](respondWithResult(_0x534c4f,null))[_0xda85('0x24')](handleError(_0x534c4f,null));};var utilLicense=require('../../config/license/util');exports[_0xda85('0x70')]=function(_0x195974,_0x167029,_0x1a6394){var _0x3c3850=_0xda85('0x6c');var _0x7dbb3a={'custom':![]};return utilLicense[_0xda85('0x59')]()[_0xda85('0x1c')](function(_0x3cc3bd){if(_0x3cc3bd){_0x7dbb3a=_0x3cc3bd;}return db['Setting'][_0xda85('0x51')]({'where':{'id':_0x195974[_0xda85('0x4f')]['id']},'attributes':[_0xda85('0x56'),_0xda85('0x5a'),_0xda85('0x5b'),_0xda85('0x5c'),'defaultLogo',_0xda85('0x5e'),_0xda85('0x5f'),_0xda85('0x60')],'raw':!![]});})[_0xda85('0x1c')](handleEntityNotFound(_0x167029,null))[_0xda85('0x1c')](function(_0x31aa74){if(_0x31aa74){var _0x309916=_0x31aa74[_0xda85('0x5b')]&&fs['existsSync'](path[_0xda85('0x61')](config[_0xda85('0x62')],_0x3c3850,_[_0xda85('0x63')](_0x31aa74[_0xda85('0x5b')])))?path[_0xda85('0x61')](config['root'],_0x3c3850,_[_0xda85('0x63')](_0x31aa74[_0xda85('0x5b')])):path[_0xda85('0x61')](config[_0xda85('0x62')],_0x3c3850,_[_0xda85('0x63')](_0xda85('0x71')));var _0x8354d1=_0xda85('0x6e')+_[_0xda85('0x65')](_0xda85('0x5b'));if(_0x31aa74[_0x8354d1]||!_0x7dbb3a['custom']||!_0x7dbb3a[_0xda85('0x5b')]){_0x309916=path[_0xda85('0x61')](config[_0xda85('0x62')],_0x3c3850,_['toLower'](_0xda85('0x71')));}if(!fs[_0xda85('0x67')](_0x309916)){throw new db[(_0xda85('0x68'))][(_0xda85('0x69'))](_[_0xda85('0x65')](_0xda85('0x5b'))+_0xda85('0x6a'));}return _0x167029[_0xda85('0x6b')](_0x309916);}})[_0xda85('0x24')](handleError(_0x167029,null));};exports['addFavicon']=function(_0x4c4902,_0x32f4b6,_0x2bddcf){if(_0x4c4902[_0xda85('0x54')]&&_0x4c4902[_0xda85('0x54')]['filename']){_0x4c4902['body'][_0xda85('0x5c')]=_0x4c4902[_0xda85('0x54')][_0xda85('0x55')];}return db[_0xda85('0x37')][_0xda85('0x51')]({'where':{'id':_0x4c4902[_0xda85('0x4f')]['id']}})[_0xda85('0x1c')](handleEntityNotFound(_0x32f4b6,null))['then'](saveUpdates(_0x4c4902['body'],null))[_0xda85('0x1c')](respondWithResult(_0x32f4b6,null))['catch'](handleError(_0x32f4b6,null));};var utilLicense=require(_0xda85('0x16'));exports['getFavicon']=function(_0x9797bd,_0x421172,_0x2c255b){var _0x393962=_0xda85('0x6c');var _0x3b8ecc={'custom':![]};return utilLicense['getLicense']()[_0xda85('0x1c')](function(_0x7742e){if(_0x7742e){_0x3b8ecc=_0x7742e;}return db['Setting'][_0xda85('0x51')]({'where':{'id':_0x9797bd[_0xda85('0x4f')]['id']},'attributes':[_0xda85('0x56'),_0xda85('0x5a'),_0xda85('0x5b'),_0xda85('0x5c'),_0xda85('0x5d'),_0xda85('0x5e'),'defaultPreferred',_0xda85('0x60')],'raw':!![]});})[_0xda85('0x1c')](handleEntityNotFound(_0x421172,null))['then'](function(_0x28229a){if(_0x28229a){var _0x51ff89=_0x28229a[_0xda85('0x5c')]&&fs[_0xda85('0x67')](path[_0xda85('0x61')](config[_0xda85('0x62')],_0x393962,_[_0xda85('0x63')](_0x28229a[_0xda85('0x5c')])))?path[_0xda85('0x61')](config[_0xda85('0x62')],_0x393962,_[_0xda85('0x63')](_0x28229a['favicon'])):path[_0xda85('0x61')](config['root'],_0x393962,_[_0xda85('0x63')](_0xda85('0x72')));var _0x253776=_0xda85('0x6e')+_[_0xda85('0x65')](_0xda85('0x5c'));if(_0x28229a[_0x253776]||!_0x3b8ecc[_0xda85('0x66')]){_0x51ff89=path[_0xda85('0x61')](config['root'],_0x393962,_[_0xda85('0x63')]('default_favicon.ico'));}if(!fs[_0xda85('0x67')](_0x51ff89)){throw new db[(_0xda85('0x68'))][(_0xda85('0x69'))](_['upperFirst']('favicon')+_0xda85('0x6a'));}return _0x421172['download'](_0x51ff89);}})['catch'](handleError(_0x421172,null));};exports[_0xda85('0x73')]=function(_0x5bdbe8,_0x465ebf){var _0x8f3083={'offset':moment()['utcOffset']()};_0x8f3083['now']=moment()['utcOffset'](_0x8f3083[_0xda85('0x2c')])[_0xda85('0x74')](_0xda85('0x75'));return _0x465ebf[_0xda85('0x26')](0xc8)[_0xda85('0x34')](_0x8f3083);}; \ No newline at end of file +var _0xdffe=['destroy','end','sendStatus','stack','send','index','map','Setting','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','find','update','body','addLogo','file','filename','addLogoLogin','loginLogo','server/files/images/logos','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','default_logo.svg','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','default','Sequelize','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','offset','undefined','count','Content-Range','json','apply','reject','save'];(function(_0x13bd46,_0x52279d){var _0xf60b7b=function(_0x1398fb){while(--_0x1398fb){_0x13bd46['push'](_0x13bd46['shift']());}};_0xf60b7b(++_0x52279d);}(_0xdffe,0x1d2));var _0xedff=function(_0x58836f,_0x5351e2){_0x58836f=_0x58836f-0x0;var _0x28f9b1=_0xdffe[_0x58836f];return _0x28f9b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedff('0x1'));var rp=require(_0xedff('0x2'));var moment=require(_0xedff('0x3'));var BPromise=require(_0xedff('0x4'));var Mustache=require(_0xedff('0x5'));var util=require(_0xedff('0x6'));var path=require('path');var sox=require(_0xedff('0x7'));var csv=require(_0xedff('0x8'));var ejs=require(_0xedff('0x9'));var fs=require('fs');var fs_extra=require(_0xedff('0xa'));var _=require('lodash');var squel=require(_0xedff('0xb'));var crypto=require(_0xedff('0xc'));var jsforce=require(_0xedff('0xd'));var deskjs=require(_0xedff('0xe'));var toCsv=require(_0xedff('0x8'));var querystring=require(_0xedff('0xf'));var Papa=require(_0xedff('0x10'));var Redis=require(_0xedff('0x11'));var authService=require(_0xedff('0x12'));var qs=require(_0xedff('0x13'));var as=require(_0xedff('0x14'));var hardwareService=require(_0xedff('0x15'));var logger=require(_0xedff('0x16'))(_0xedff('0x17'));var utils=require(_0xedff('0x18'));var config=require(_0xedff('0x19'));var licenseUtil=require(_0xedff('0x1a'));var db=require(_0xedff('0x1b'))['db'];var jayson=require(_0xedff('0x1c'));var client=jayson['client'][_0xedff('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5edfa6,_0x5d9a1c,_0xcc68b9,_0x47a8a2){return new BPromise(function(_0x21b554,_0xddefb3){var _0x503e0f=_0x47a8a2||client;return _0x503e0f[_0xedff('0x1e')](_0x5edfa6,_0xcc68b9)[_0xedff('0x1f')](function(_0x4b74ea){logger[_0xedff('0x20')](_0xedff('0x21'),_0x5d9a1c,_0xedff('0x22'));logger[_0xedff('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x5d9a1c,'request\x20sent',JSON[_0xedff('0x24')](_0x4b74ea));if(_0x4b74ea[_0xedff('0x25')]){if(_0x4b74ea['error'][_0xedff('0x26')]===0x1f4){logger[_0xedff('0x25')](_0xedff('0x21'),_0x5d9a1c,_0x4b74ea[_0xedff('0x25')][_0xedff('0x27')]);return _0xddefb3(_0x4b74ea[_0xedff('0x25')]['message']);}logger[_0xedff('0x25')](_0xedff('0x21'),_0x5d9a1c,_0x4b74ea[_0xedff('0x25')][_0xedff('0x27')]);return _0x21b554(_0x4b74ea[_0xedff('0x25')][_0xedff('0x27')]);}else{logger[_0xedff('0x20')](_0xedff('0x21'),_0x5d9a1c,'request\x20sent');_0x21b554(_0x4b74ea[_0xedff('0x28')][_0xedff('0x27')]);}})['catch'](function(_0x38fdf7){logger['error'](_0xedff('0x21'),_0x5d9a1c,_0x38fdf7);_0xddefb3(_0x38fdf7);});});}function respondWithStatusCode(_0x4ed54b,_0x4a70cf){_0x4a70cf=_0x4a70cf||0xcc;return function(_0x4640c7){if(_0x4640c7){return _0x4ed54b['sendStatus'](_0x4a70cf);}return _0x4ed54b[_0xedff('0x29')](_0x4a70cf)['end']();};}function respondWithResult(_0x2f4e46,_0xf8896){_0xf8896=_0xf8896||0xc8;return function(_0x57ee89){if(_0x57ee89){return _0x2f4e46[_0xedff('0x29')](_0xf8896)['json'](_0x57ee89);}};}function respondWithFilteredResult(_0x1286df,_0x5a8ebd){return function(_0x4505bc){if(_0x4505bc){var _0x39ea40=typeof _0x5a8ebd[_0xedff('0x2a')]===_0xedff('0x2b')&&typeof _0x5a8ebd['limit']===_0xedff('0x2b');var _0x118a87=_0x4505bc[_0xedff('0x2c')];var _0xc3c70e=_0x39ea40?0x0:_0x5a8ebd[_0xedff('0x2a')];var _0x1e450c=_0x39ea40?_0x4505bc[_0xedff('0x2c')]:_0x5a8ebd['offset']+_0x5a8ebd['limit'];var _0x2ade43;if(_0x1e450c>=_0x118a87){_0x1e450c=_0x118a87;_0x2ade43=0xc8;}else{_0x2ade43=0xce;}_0x1286df['status'](_0x2ade43);return _0x1286df['set'](_0xedff('0x2d'),_0xc3c70e+'-'+_0x1e450c+'/'+_0x118a87)[_0xedff('0x2e')](_0x4505bc);}return null;};}function patchUpdates(_0x1befd0){return function(_0x23bb76){try{jsonpatch[_0xedff('0x2f')](_0x23bb76,_0x1befd0,!![]);}catch(_0x5bc7c5){return BPromise[_0xedff('0x30')](_0x5bc7c5);}return _0x23bb76[_0xedff('0x31')]();};}function saveUpdates(_0x537dd5,_0x5a02ae){return function(_0x43c155){if(_0x43c155){return _0x43c155['update'](_0x537dd5)['then'](function(_0x42bae7){return _0x42bae7;});}return null;};}function removeEntity(_0xf2ae2c,_0x33a3c7){return function(_0x2508b6){if(_0x2508b6){return _0x2508b6[_0xedff('0x32')]()[_0xedff('0x1f')](function(){_0xf2ae2c[_0xedff('0x29')](0xcc)[_0xedff('0x33')]();});}};}function handleEntityNotFound(_0x1bd2cb,_0x5ced47){return function(_0x338042){if(!_0x338042){_0x1bd2cb[_0xedff('0x34')](0x194);}return _0x338042;};}function handleError(_0x4ca17f,_0x4433e8){_0x4433e8=_0x4433e8||0x1f4;return function(_0x2a2d5c){logger['error'](_0x2a2d5c[_0xedff('0x35')]);if(_0x2a2d5c['name']){delete _0x2a2d5c['name'];}_0x4ca17f['status'](_0x4433e8)[_0xedff('0x36')](_0x2a2d5c);};}exports[_0xedff('0x37')]=function(_0x55138e,_0x12cce3){var _0x33e136={},_0x2ded75={},_0x587cdc={'count':0x0,'rows':[]};var _0x3d0ee5=_[_0xedff('0x38')](db[_0xedff('0x39')]['rawAttributes'],function(_0xe6af44){return{'name':_0xe6af44[_0xedff('0x3a')],'type':_0xe6af44['type'][_0xedff('0x3b')]};});_0x2ded75[_0xedff('0x3c')]=_['map'](_0x3d0ee5,_0xedff('0x3d'));_0x2ded75[_0xedff('0x3e')]=_[_0xedff('0x3f')](_0x55138e[_0xedff('0x3e')]);_0x2ded75[_0xedff('0x40')]=_[_0xedff('0x41')](_0x2ded75[_0xedff('0x3c')],_0x2ded75[_0xedff('0x3e')]);_0x33e136[_0xedff('0x42')]=_['intersection'](_0x2ded75['model'],qs[_0xedff('0x43')](_0x55138e[_0xedff('0x3e')][_0xedff('0x43')]));_0x33e136[_0xedff('0x42')]=_0x33e136[_0xedff('0x42')][_0xedff('0x44')]?_0x33e136['attributes']:_0x2ded75[_0xedff('0x3c')];if(!_0x55138e[_0xedff('0x3e')][_0xedff('0x45')](_0xedff('0x46'))){_0x33e136[_0xedff('0x47')]=qs[_0xedff('0x47')](_0x55138e[_0xedff('0x3e')][_0xedff('0x47')]);_0x33e136['offset']=qs[_0xedff('0x2a')](_0x55138e[_0xedff('0x3e')][_0xedff('0x2a')]);}_0x33e136[_0xedff('0x48')]=qs[_0xedff('0x49')](_0x55138e[_0xedff('0x3e')][_0xedff('0x49')]);_0x33e136[_0xedff('0x4a')]=qs[_0xedff('0x40')](_['pick'](_0x55138e[_0xedff('0x3e')],_0x2ded75[_0xedff('0x40')]),_0x3d0ee5);if(_0x55138e[_0xedff('0x3e')][_0xedff('0x4b')]){_0x33e136[_0xedff('0x4a')]=_[_0xedff('0x4c')](_0x33e136[_0xedff('0x4a')],{'$or':_[_0xedff('0x38')](_0x3d0ee5,function(_0x1f18be){if(_0x1f18be[_0xedff('0x4d')]!==_0xedff('0x4e')){var _0x385451={};_0x385451[_0x1f18be[_0xedff('0x3d')]]={'$like':'%'+_0x55138e['query'][_0xedff('0x4b')]+'%'};return _0x385451;}})});}_0x33e136=_[_0xedff('0x4c')]({},_0x33e136,_0x55138e[_0xedff('0x4f')]);var _0x5c44c6={'where':_0x33e136[_0xedff('0x4a')]};return db['Setting'][_0xedff('0x2c')](_0x5c44c6)[_0xedff('0x1f')](function(_0x24a1c7){_0x587cdc[_0xedff('0x2c')]=_0x24a1c7;if(_0x55138e[_0xedff('0x3e')]['includeAll']){_0x33e136[_0xedff('0x50')]=[{'all':!![]}];}return db['Setting'][_0xedff('0x51')](_0x33e136);})[_0xedff('0x1f')](function(_0x46516e){_0x587cdc[_0xedff('0x52')]=_0x46516e;return _0x587cdc;})[_0xedff('0x1f')](respondWithFilteredResult(_0x12cce3,_0x33e136))[_0xedff('0x53')](handleError(_0x12cce3,null));};exports[_0xedff('0x54')]=function(_0x3f98f8,_0xe884fc){var _0x2ec422={'raw':![],'where':{'id':_0x3f98f8[_0xedff('0x55')]['id']}},_0x1dfa4d={};_0x1dfa4d[_0xedff('0x3c')]=_[_0xedff('0x3f')](db[_0xedff('0x39')][_0xedff('0x56')]);_0x1dfa4d[_0xedff('0x3e')]=_['keys'](_0x3f98f8[_0xedff('0x3e')]);_0x1dfa4d[_0xedff('0x40')]=_[_0xedff('0x41')](_0x1dfa4d['model'],_0x1dfa4d[_0xedff('0x3e')]);_0x2ec422[_0xedff('0x42')]=_[_0xedff('0x41')](_0x1dfa4d[_0xedff('0x3c')],qs[_0xedff('0x43')](_0x3f98f8[_0xedff('0x3e')]['fields']));_0x2ec422[_0xedff('0x42')]=_0x2ec422['attributes'][_0xedff('0x44')]?_0x2ec422[_0xedff('0x42')]:_0x1dfa4d[_0xedff('0x3c')];if(_0x3f98f8['query']['includeAll']){_0x2ec422[_0xedff('0x50')]=[{'all':!![]}];}_0x2ec422=_[_0xedff('0x4c')]({},_0x2ec422,_0x3f98f8[_0xedff('0x4f')]);return db[_0xedff('0x39')][_0xedff('0x57')](_0x2ec422)['then'](handleEntityNotFound(_0xe884fc,null))[_0xedff('0x1f')](respondWithResult(_0xe884fc,null))[_0xedff('0x53')](handleError(_0xe884fc,null));};exports[_0xedff('0x58')]=function(_0x565fa4,_0x121897){if(_0x565fa4[_0xedff('0x59')]['id']){delete _0x565fa4[_0xedff('0x59')]['id'];}return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0x565fa4[_0xedff('0x55')]['id']}})['then'](handleEntityNotFound(_0x121897,null))[_0xedff('0x1f')](saveUpdates(_0x565fa4[_0xedff('0x59')],null))[_0xedff('0x1f')](respondWithResult(_0x121897,null))[_0xedff('0x53')](handleError(_0x121897,null));};exports[_0xedff('0x5a')]=function(_0x1f38f7,_0x398a9b,_0x1d1011){if(_0x1f38f7['file']&&_0x1f38f7[_0xedff('0x5b')][_0xedff('0x5c')]){_0x1f38f7[_0xedff('0x59')]['logo']=_0x1f38f7[_0xedff('0x5b')][_0xedff('0x5c')];}return db[_0xedff('0x39')]['find']({'where':{'id':_0x1f38f7['params']['id']}})[_0xedff('0x1f')](handleEntityNotFound(_0x398a9b,null))[_0xedff('0x1f')](saveUpdates(_0x1f38f7[_0xedff('0x59')],null))[_0xedff('0x1f')](respondWithResult(_0x398a9b,null))[_0xedff('0x53')](handleError(_0x398a9b,null));};exports[_0xedff('0x5d')]=function(_0x5bc759,_0xf34622,_0x35e1f2){if(_0x5bc759[_0xedff('0x5b')]&&_0x5bc759[_0xedff('0x5b')][_0xedff('0x5c')]){_0x5bc759[_0xedff('0x59')][_0xedff('0x5e')]=_0x5bc759[_0xedff('0x5b')][_0xedff('0x5c')];}return db['Setting'][_0xedff('0x57')]({'where':{'id':_0x5bc759['params']['id']}})['then'](handleEntityNotFound(_0xf34622,null))[_0xedff('0x1f')](saveUpdates(_0x5bc759['body'],null))[_0xedff('0x1f')](respondWithResult(_0xf34622,null))[_0xedff('0x53')](handleError(_0xf34622,null));};var utilLicense=require(_0xedff('0x1a'));exports['getLogo']=function(_0xecb1a2,_0x3df697,_0x4290cf){var _0x9dd55b=_0xedff('0x5f');var _0x1ff959={'custom':![]};return utilLicense['getLicense']()[_0xedff('0x1f')](function(_0x47c50b){if(_0x47c50b){_0x1ff959=_0x47c50b;}return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0xecb1a2['params']['id']},'attributes':[_0xedff('0x60'),_0xedff('0x5e'),_0xedff('0x61'),_0xedff('0x62'),_0xedff('0x63'),_0xedff('0x64'),_0xedff('0x65'),_0xedff('0x66')],'raw':!![]});})[_0xedff('0x1f')](handleEntityNotFound(_0x3df697,null))['then'](function(_0x2e2715){if(_0x2e2715){var _0x38c83a=_0x2e2715[_0xedff('0x60')]&&fs[_0xedff('0x67')](path[_0xedff('0x68')](config[_0xedff('0x69')],_0x9dd55b,_[_0xedff('0x6a')](_0x2e2715['logo'])))?path['join'](config[_0xedff('0x69')],_0x9dd55b,_['toLower'](_0x2e2715['logo'])):path[_0xedff('0x68')](config[_0xedff('0x69')],_0x9dd55b,_[_0xedff('0x6a')]('default_logo.svg'));var _0x22868a='default'+_[_0xedff('0x6b')]('logo');if(_0x2e2715[_0x22868a]||!_0x1ff959[_0xedff('0x6c')]){_0x38c83a=path[_0xedff('0x68')](config[_0xedff('0x69')],_0x9dd55b,_[_0xedff('0x6a')](_0xedff('0x6d')));}if(!fs[_0xedff('0x67')](_0x38c83a)){throw new db['Sequelize'][(_0xedff('0x6e'))](_[_0xedff('0x6b')](_0xedff('0x60'))+_0xedff('0x6f'));}return _0x3df697[_0xedff('0x70')](_0x38c83a);}})[_0xedff('0x53')](handleError(_0x3df697,null));};var utilLicense=require(_0xedff('0x1a'));exports[_0xedff('0x71')]=function(_0x59019b,_0xa392ef,_0x591e1d){var _0x55e863=_0xedff('0x5f');var _0x5ef89f={'custom':![]};return utilLicense[_0xedff('0x72')]()[_0xedff('0x1f')](function(_0x23167a){if(_0x23167a){_0x5ef89f=_0x23167a;}return db[_0xedff('0x39')]['find']({'where':{'id':_0x59019b['params']['id']},'attributes':[_0xedff('0x60'),_0xedff('0x5e'),_0xedff('0x61'),_0xedff('0x62'),_0xedff('0x63'),'defaultLoginLogo',_0xedff('0x65'),'defaultFavicon'],'raw':!![]});})[_0xedff('0x1f')](handleEntityNotFound(_0xa392ef,null))[_0xedff('0x1f')](function(_0x22b074){if(_0x22b074){var _0x1521a7=_0x22b074[_0xedff('0x5e')]&&fs['existsSync'](path[_0xedff('0x68')](config[_0xedff('0x69')],_0x55e863,_[_0xedff('0x6a')](_0x22b074[_0xedff('0x5e')])))?path[_0xedff('0x68')](config[_0xedff('0x69')],_0x55e863,_['toLower'](_0x22b074[_0xedff('0x5e')])):path[_0xedff('0x68')](config[_0xedff('0x69')],_0x55e863,_[_0xedff('0x6a')]('default_loginLogo.svg'));var _0x2eadf4=_0xedff('0x73')+_[_0xedff('0x6b')](_0xedff('0x5e'));if(_0x22b074[_0x2eadf4]||!_0x5ef89f[_0xedff('0x6c')]){_0x1521a7=path[_0xedff('0x68')](config[_0xedff('0x69')],_0x55e863,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xedff('0x67')](_0x1521a7)){throw new db[(_0xedff('0x74'))][(_0xedff('0x6e'))](_[_0xedff('0x6b')](_0xedff('0x5e'))+_0xedff('0x6f'));}return _0xa392ef['download'](_0x1521a7);}})[_0xedff('0x53')](handleError(_0xa392ef,null));};exports[_0xedff('0x75')]=function(_0x19ae5a,_0x424bb6){return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0x19ae5a[_0xedff('0x55')]['id']},'attributes':[_0xedff('0x76')]})[_0xedff('0x1f')](respondWithResult(_0x424bb6,null))['catch'](handleError(_0x424bb6,null));};exports[_0xedff('0x77')]=function(_0x4e773a,_0xea8ded,_0x501dbc){if(_0x4e773a['file']&&_0x4e773a['file'][_0xedff('0x5c')]){_0x4e773a[_0xedff('0x59')][_0xedff('0x61')]=_0x4e773a[_0xedff('0x5b')][_0xedff('0x5c')];}return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0x4e773a[_0xedff('0x55')]['id']}})['then'](handleEntityNotFound(_0xea8ded,null))[_0xedff('0x1f')](saveUpdates(_0x4e773a[_0xedff('0x59')],null))[_0xedff('0x1f')](respondWithResult(_0xea8ded,null))[_0xedff('0x53')](handleError(_0xea8ded,null));};var utilLicense=require(_0xedff('0x1a'));exports[_0xedff('0x78')]=function(_0x553eeb,_0xcdf306,_0x489159){var _0x4ebe99='server/files/images/logos';var _0x2b48be={'custom':![]};return utilLicense[_0xedff('0x72')]()[_0xedff('0x1f')](function(_0x3a4cc6){if(_0x3a4cc6){_0x2b48be=_0x3a4cc6;}return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0x553eeb[_0xedff('0x55')]['id']},'attributes':['logo',_0xedff('0x5e'),_0xedff('0x61'),'favicon',_0xedff('0x63'),_0xedff('0x64'),_0xedff('0x65'),_0xedff('0x66')],'raw':!![]});})[_0xedff('0x1f')](handleEntityNotFound(_0xcdf306,null))[_0xedff('0x1f')](function(_0x515fb4){if(_0x515fb4){var _0x590cd3=_0x515fb4['preferred']&&fs[_0xedff('0x67')](path[_0xedff('0x68')](config[_0xedff('0x69')],_0x4ebe99,_['toLower'](_0x515fb4[_0xedff('0x61')])))?path[_0xedff('0x68')](config[_0xedff('0x69')],_0x4ebe99,_[_0xedff('0x6a')](_0x515fb4[_0xedff('0x61')])):path[_0xedff('0x68')](config[_0xedff('0x69')],_0x4ebe99,_['toLower'](_0xedff('0x79')));var _0x142240=_0xedff('0x73')+_['upperFirst'](_0xedff('0x61'));if(_0x515fb4[_0x142240]||!_0x2b48be[_0xedff('0x6c')]||!_0x2b48be['preferred']){_0x590cd3=path[_0xedff('0x68')](config['root'],_0x4ebe99,_[_0xedff('0x6a')](_0xedff('0x79')));}if(!fs[_0xedff('0x67')](_0x590cd3)){throw new db['Sequelize'][(_0xedff('0x6e'))](_['upperFirst'](_0xedff('0x61'))+_0xedff('0x6f'));}return _0xcdf306[_0xedff('0x70')](_0x590cd3);}})[_0xedff('0x53')](handleError(_0xcdf306,null));};exports[_0xedff('0x7a')]=function(_0x35b783,_0x86f2d8,_0x28742c){if(_0x35b783['file']&&_0x35b783[_0xedff('0x5b')][_0xedff('0x5c')]){_0x35b783[_0xedff('0x59')][_0xedff('0x62')]=_0x35b783['file'][_0xedff('0x5c')];}return db[_0xedff('0x39')]['find']({'where':{'id':_0x35b783[_0xedff('0x55')]['id']}})['then'](handleEntityNotFound(_0x86f2d8,null))[_0xedff('0x1f')](saveUpdates(_0x35b783[_0xedff('0x59')],null))[_0xedff('0x1f')](respondWithResult(_0x86f2d8,null))[_0xedff('0x53')](handleError(_0x86f2d8,null));};var utilLicense=require(_0xedff('0x1a'));exports[_0xedff('0x7b')]=function(_0x4d2c7a,_0x59e5b7,_0x494eb6){var _0x11439f='server/files/images/logos';var _0x2b4463={'custom':![]};return utilLicense[_0xedff('0x72')]()[_0xedff('0x1f')](function(_0x585ab6){if(_0x585ab6){_0x2b4463=_0x585ab6;}return db[_0xedff('0x39')][_0xedff('0x57')]({'where':{'id':_0x4d2c7a[_0xedff('0x55')]['id']},'attributes':[_0xedff('0x60'),_0xedff('0x5e'),_0xedff('0x61'),_0xedff('0x62'),'defaultLogo',_0xedff('0x64'),_0xedff('0x65'),_0xedff('0x66')],'raw':!![]});})[_0xedff('0x1f')](handleEntityNotFound(_0x59e5b7,null))['then'](function(_0x4d044d){if(_0x4d044d){var _0x4962=_0x4d044d['favicon']&&fs[_0xedff('0x67')](path[_0xedff('0x68')](config[_0xedff('0x69')],_0x11439f,_[_0xedff('0x6a')](_0x4d044d[_0xedff('0x62')])))?path[_0xedff('0x68')](config[_0xedff('0x69')],_0x11439f,_['toLower'](_0x4d044d['favicon'])):path['join'](config[_0xedff('0x69')],_0x11439f,_[_0xedff('0x6a')]('default_favicon.ico'));var _0xa13f53=_0xedff('0x73')+_[_0xedff('0x6b')](_0xedff('0x62'));if(_0x4d044d[_0xa13f53]||!_0x2b4463[_0xedff('0x6c')]){_0x4962=path[_0xedff('0x68')](config[_0xedff('0x69')],_0x11439f,_[_0xedff('0x6a')]('default_favicon.ico'));}if(!fs[_0xedff('0x67')](_0x4962)){throw new db[(_0xedff('0x74'))][(_0xedff('0x6e'))](_[_0xedff('0x6b')](_0xedff('0x62'))+_0xedff('0x6f'));}return _0x59e5b7[_0xedff('0x70')](_0x4962);}})[_0xedff('0x53')](handleError(_0x59e5b7,null));};exports[_0xedff('0x7c')]=function(_0x16583b,_0x2cfdec){var _0x43637f={'offset':moment()['utcOffset']()};_0x43637f[_0xedff('0x7d')]=moment()[_0xedff('0x7e')](_0x43637f[_0xedff('0x2a')])[_0xedff('0x7f')](_0xedff('0x80'));return _0x2cfdec[_0xedff('0x29')](0xc8)[_0xedff('0x36')](_0x43637f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 1f5ed39..d81d167 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x24ad45,_0x3ad5e4){var _0x51af75=function(_0x3063dd){while(--_0x3063dd){_0x24ad45['push'](_0x24ad45['shift']());}};_0x51af75(++_0x3ad5e4);}(_0x34e8,0x12c));var _0x834e=function(_0x2376a7,_0xdd0b1f){_0x2376a7=_0x2376a7-0x0;var _0xdc423b=_0x34e8[_0x2376a7];return _0xdc423b;};'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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x55ca,0x126));var _0xa55c=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x55ca[_0xfd5f37];return _0x11bd01;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index ee69179..f950775 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 _0xb6ae=['include','map','model','ShowSetting','stringify','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','Setting','options','raw','where','attributes'];(function(_0x3cf5c5,_0x427736){var _0x15bfce=function(_0x1837b2){while(--_0x1837b2){_0x3cf5c5['push'](_0x3cf5c5['shift']());}};_0x15bfce(++_0x427736);}(_0xb6ae,0x16d));var _0xeb6a=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0xb6ae[_0x448f8];return _0xa73126;};'use strict';var _=require('lodash');var util=require(_0xeb6a('0x0'));var moment=require(_0xeb6a('0x1'));var BPromise=require('bluebird');var rs=require(_0xeb6a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeb6a('0x3'));var logger=require(_0xeb6a('0x4'))('rpc');var config=require(_0xeb6a('0x5'));var jayson=require(_0xeb6a('0x6'));var client=jayson[_0xeb6a('0x7')][_0xeb6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54ef68,_0xb813d8,_0x4cd294){return new BPromise(function(_0xfed423,_0x497f06){return client[_0xeb6a('0x9')](_0x54ef68,_0x4cd294)[_0xeb6a('0xa')](function(_0x820c28){logger['info'](_0xeb6a('0xb'),_0xb813d8,_0xeb6a('0xc'));logger[_0xeb6a('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0xb813d8,_0xeb6a('0xc'),JSON['stringify'](_0x820c28));if(_0x820c28[_0xeb6a('0xe')]){if(_0x820c28[_0xeb6a('0xe')][_0xeb6a('0xf')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0xb813d8,_0x820c28[_0xeb6a('0xe')][_0xeb6a('0x10')]);return _0x497f06(_0x820c28[_0xeb6a('0xe')][_0xeb6a('0x10')]);}logger[_0xeb6a('0xe')](_0xeb6a('0xb'),_0xb813d8,_0x820c28[_0xeb6a('0xe')][_0xeb6a('0x10')]);return _0xfed423(_0x820c28[_0xeb6a('0xe')][_0xeb6a('0x10')]);}else{logger[_0xeb6a('0x11')]('Setting,\x20%s,\x20%s',_0xb813d8,'request\x20sent');_0xfed423(_0x820c28[_0xeb6a('0x12')][_0xeb6a('0x10')]);}})[_0xeb6a('0x13')](function(_0x55825d){logger[_0xeb6a('0xe')](_0xeb6a('0xb'),_0xb813d8,_0x55825d);_0x497f06(_0x55825d);});});}exports['ShowSetting']=function(_0x42c7b4){var _0x4c0a8c=this;return new Promise(function(_0x29c4d7,_0x35dcc3){return db[_0xeb6a('0x14')]['find']({'raw':_0x42c7b4[_0xeb6a('0x15')]?_0x42c7b4['options'][_0xeb6a('0x16')]===undefined?!![]:![]:!![],'where':_0x42c7b4[_0xeb6a('0x15')]?_0x42c7b4[_0xeb6a('0x15')][_0xeb6a('0x17')]||null:null,'attributes':_0x42c7b4[_0xeb6a('0x15')]?_0x42c7b4[_0xeb6a('0x15')][_0xeb6a('0x18')]||null:null,'include':_0x42c7b4[_0xeb6a('0x15')]?_0x42c7b4['options'][_0xeb6a('0x19')]?_[_0xeb6a('0x1a')](_0x42c7b4[_0xeb6a('0x15')]['include'],function(_0x5dfbf7){return{'model':db[_0x5dfbf7['model']],'as':_0x5dfbf7['as'],'attributes':_0x5dfbf7['attributes'],'include':_0x5dfbf7[_0xeb6a('0x19')]?_['map'](_0x5dfbf7['include'],function(_0x25b3fb){return{'model':db[_0x25b3fb['model']],'as':_0x25b3fb['as'],'attributes':_0x25b3fb[_0xeb6a('0x18')],'include':_0x25b3fb[_0xeb6a('0x19')]?_[_0xeb6a('0x1a')](_0x25b3fb[_0xeb6a('0x19')],function(_0x1b63e6){return{'model':db[_0x1b63e6[_0xeb6a('0x1b')]],'as':_0x1b63e6['as'],'attributes':_0x1b63e6[_0xeb6a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeb6a('0xa')](function(_0x29136d){logger[_0xeb6a('0x11')](_0xeb6a('0x1c'),_0x42c7b4);logger[_0xeb6a('0xd')](_0xeb6a('0x1c'),_0x42c7b4,JSON[_0xeb6a('0x1d')](_0x29136d));_0x29c4d7(_0x29136d);})[_0xeb6a('0x13')](function(_0x337d07){logger[_0xeb6a('0xe')](_0xeb6a('0x1c'),_0x337d07['message'],_0x42c7b4);_0x35dcc3(_0x4c0a8c['error'](0x1f4,_0x337d07[_0xeb6a('0x10')]));});});}; \ No newline at end of file +var _0x4f61=['ShowSetting','Setting','find','options','raw','where','include','map','model','attributes','then','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x507f46,_0xda9145){var _0x5b80d5=function(_0x4ff360){while(--_0x4ff360){_0x507f46['push'](_0x507f46['shift']());}};_0x5b80d5(++_0xda9145);}(_0x4f61,0x185));var _0x14f6=function(_0x38320d,_0x212a29){_0x38320d=_0x38320d-0x0;var _0x5207a3=_0x4f61[_0x38320d];return _0x5207a3;};'use strict';var _=require('lodash');var util=require(_0x14f6('0x0'));var moment=require(_0x14f6('0x1'));var BPromise=require(_0x14f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14f6('0x3'));var db=require(_0x14f6('0x4'))['db'];var utils=require(_0x14f6('0x5'));var logger=require('../../config/logger')(_0x14f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x14f6('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a522d,_0x56fcfa,_0x291c97){return new BPromise(function(_0x883a16,_0x5eb625){return client['request'](_0x5a522d,_0x291c97)['then'](function(_0xd53e8b){logger['info'](_0x14f6('0x8'),_0x56fcfa,_0x14f6('0x9'));logger[_0x14f6('0xa')](_0x14f6('0xb'),_0x56fcfa,_0x14f6('0x9'),JSON['stringify'](_0xd53e8b));if(_0xd53e8b[_0x14f6('0xc')]){if(_0xd53e8b[_0x14f6('0xc')][_0x14f6('0xd')]===0x1f4){logger[_0x14f6('0xc')](_0x14f6('0x8'),_0x56fcfa,_0xd53e8b[_0x14f6('0xc')]['message']);return _0x5eb625(_0xd53e8b['error']['message']);}logger[_0x14f6('0xc')](_0x14f6('0x8'),_0x56fcfa,_0xd53e8b[_0x14f6('0xc')][_0x14f6('0xe')]);return _0x883a16(_0xd53e8b[_0x14f6('0xc')]['message']);}else{logger[_0x14f6('0xf')](_0x14f6('0x8'),_0x56fcfa,_0x14f6('0x9'));_0x883a16(_0xd53e8b[_0x14f6('0x10')][_0x14f6('0xe')]);}})['catch'](function(_0x2e697d){logger['error'](_0x14f6('0x8'),_0x56fcfa,_0x2e697d);_0x5eb625(_0x2e697d);});});}exports[_0x14f6('0x11')]=function(_0xefff7c){var _0x3fbeed=this;return new Promise(function(_0x260964,_0x42877f){return db[_0x14f6('0x12')][_0x14f6('0x13')]({'raw':_0xefff7c[_0x14f6('0x14')]?_0xefff7c[_0x14f6('0x14')][_0x14f6('0x15')]===undefined?!![]:![]:!![],'where':_0xefff7c[_0x14f6('0x14')]?_0xefff7c[_0x14f6('0x14')][_0x14f6('0x16')]||null:null,'attributes':_0xefff7c['options']?_0xefff7c[_0x14f6('0x14')]['attributes']||null:null,'include':_0xefff7c[_0x14f6('0x14')]?_0xefff7c[_0x14f6('0x14')][_0x14f6('0x17')]?_[_0x14f6('0x18')](_0xefff7c[_0x14f6('0x14')][_0x14f6('0x17')],function(_0x23cb0f){return{'model':db[_0x23cb0f[_0x14f6('0x19')]],'as':_0x23cb0f['as'],'attributes':_0x23cb0f[_0x14f6('0x1a')],'include':_0x23cb0f[_0x14f6('0x17')]?_[_0x14f6('0x18')](_0x23cb0f[_0x14f6('0x17')],function(_0x25604a){return{'model':db[_0x25604a[_0x14f6('0x19')]],'as':_0x25604a['as'],'attributes':_0x25604a[_0x14f6('0x1a')],'include':_0x25604a['include']?_[_0x14f6('0x18')](_0x25604a[_0x14f6('0x17')],function(_0x5d916f){return{'model':db[_0x5d916f[_0x14f6('0x19')]],'as':_0x5d916f['as'],'attributes':_0x5d916f[_0x14f6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x14f6('0x1b')](function(_0x513d08){logger['info'](_0x14f6('0x11'),_0xefff7c);logger['debug'](_0x14f6('0x11'),_0xefff7c,JSON['stringify'](_0x513d08));_0x260964(_0x513d08);})[_0x14f6('0x1c')](function(_0x3e84b0){logger[_0x14f6('0xc')](_0x14f6('0x11'),_0x3e84b0[_0x14f6('0xe')],_0xefff7c);_0x42877f(_0x3fbeed[_0x14f6('0xc')](0x1f4,_0x3e84b0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 135e8f9..5914cb9 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 _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x4a8b37,_0x529545){var _0x5710e3=function(_0x263d60){while(--_0x263d60){_0x4a8b37['push'](_0x4a8b37['shift']());}};_0x5710e3(++_0x529545);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file +var _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7217,0x19e));var _0x7721=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7217[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0bb3224..6a2a4af 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 _0xe53f=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x358f0e,_0x36e4f5){var _0x443272=function(_0x3f2d41){while(--_0x3f2d41){_0x358f0e['push'](_0x358f0e['shift']());}};_0x443272(++_0x36e4f5);}(_0xe53f,0x129));var _0xfe53=function(_0x4efc47,_0x36756d){_0x4efc47=_0x4efc47-0x0;var _0x9a021a=_0xe53f[_0x4efc47];return _0x9a021a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfe53('0x0'));module[_0xfe53('0x1')]={'name':{'type':Sequelize[_0xfe53('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xfe53('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xfe53('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xfe53('0x2')],'defaultValue':function(){return rs[_0xfe53('0x3')]();}},'phone':{'type':Sequelize[_0xfe53('0x2')]},'type':{'type':Sequelize[_0xfe53('0x4')](_0xfe53('0x5'),_0xfe53('0x6'),_0xfe53('0x7'),_0xfe53('0x8'),_0xfe53('0x9'),_0xfe53('0xa'),_0xfe53('0xb'),_0xfe53('0xc'),_0xfe53('0xd'),_0xfe53('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xfe53('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xfe53('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xfe53('0x2')]},'password':{'type':Sequelize[_0xfe53('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xfe53('0x2')]},'accountId':{'type':Sequelize[_0xfe53('0x2')]},'senderString':{'type':Sequelize[_0xfe53('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xfe53('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfe53('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfe53('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfe53('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfe53('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfe53('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xfe53('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe53('0x10')],'comment':_0xfe53('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xfe53('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x327053){if(!_0x327053)this[_0xfe53('0x12')](_0xfe53('0x13'),null);this['setDataValue'](_0xfe53('0x14'),_0x327053);}}}; \ No newline at end of file +var _0x3cdf=['mandatoryDisposition','exports','STRING','name','ENUM','twilio','clicksend','plivo','clickatell','bandwidth','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0xbdf961,_0x5157cb){var _0x2fba0e=function(_0x2d7d53){while(--_0x2d7d53){_0xbdf961['push'](_0xbdf961['shift']());}};_0x2fba0e(++_0x5157cb);}(_0x3cdf,0x122));var _0xf3cd=function(_0x50e117,_0x21aa13){_0x50e117=_0x50e117-0x0;var _0x44bd14=_0x3cdf[_0x50e117];return _0x44bd14;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xf3cd('0x0')]={'name':{'type':Sequelize[_0xf3cd('0x1')],'unique':_0xf3cd('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xf3cd('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xf3cd('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xf3cd('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xf3cd('0x1')]},'type':{'type':Sequelize[_0xf3cd('0x3')](_0xf3cd('0x4'),'skebby','connectel',_0xf3cd('0x5'),_0xf3cd('0x6'),_0xf3cd('0x7'),_0xf3cd('0x8'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xf3cd('0x1')]},'authId':{'type':Sequelize[_0xf3cd('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xf3cd('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xf3cd('0x1')]},'applicationId':{'type':Sequelize[_0xf3cd('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xf3cd('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xf3cd('0x1')]},'notificationTemplate':{'type':Sequelize[_0xf3cd('0x9')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf3cd('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf3cd('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf3cd('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf3cd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf3cd('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf3cd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf3cd('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf3cd('0xb')],'comment':_0xf3cd('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xf3cd('0xa')],'defaultValue':![],'comment':_0xf3cd('0xd'),'set':function(_0x33b5b6){if(!_0x33b5b6)this[_0xf3cd('0xe')](_0xf3cd('0xf'),null);this[_0xf3cd('0xe')](_0xf3cd('0x10'),_0x33b5b6);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c130bec..0df454c 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 _0xec9f=['sort','where','pick','filter','merge','include','findAll','rows','show','rawAttributes','includeAll','find','create','body','user','role','get','UserProfileSection','userProfileId','UserProfileResource','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','options','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','type','twilio','Body','messageId','MessageSid','skebby','sender','text','connectel','from','clicksend','message_id','plivo','From','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','updatedAt','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','entity\x20found','debug','Content-Type','text/xml','addApplications','findOne','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','Messages','SmsMessage','dataValues','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','inspect','update','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xec9f,0x176));var _0xfec9=function(_0x2ade54,_0x28432e){_0x2ade54=_0x2ade54-0x0;var _0x118e3f=_0xec9f[_0x2ade54];return _0x118e3f;};'use strict';var emlformat=require(_0xfec9('0x0'));var rimraf=require(_0xfec9('0x1'));var zipdir=require(_0xfec9('0x2'));var jsonpatch=require(_0xfec9('0x3'));var rp=require(_0xfec9('0x4'));var moment=require(_0xfec9('0x5'));var BPromise=require(_0xfec9('0x6'));var Mustache=require(_0xfec9('0x7'));var util=require(_0xfec9('0x8'));var path=require(_0xfec9('0x9'));var sox=require(_0xfec9('0xa'));var csv=require('to-csv');var ejs=require(_0xfec9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfec9('0xc'));var squel=require(_0xfec9('0xd'));var crypto=require(_0xfec9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfec9('0xf'));var toCsv=require(_0xfec9('0x10'));var querystring=require(_0xfec9('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfec9('0x12'));var qs=require(_0xfec9('0x13'));var as=require(_0xfec9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfec9('0x15'))(_0xfec9('0x16'));var utils=require(_0xfec9('0x17'));var config=require(_0xfec9('0x18'));var licenseUtil=require(_0xfec9('0x19'));var db=require(_0xfec9('0x1a'))['db'];config[_0xfec9('0x1b')]=_[_0xfec9('0x1c')](config[_0xfec9('0x1b')],{'host':_0xfec9('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfec9('0x1b')]));require(_0xfec9('0x1e'))[_0xfec9('0x1f')](socket);var jayson=require(_0xfec9('0x20'));var client=jayson[_0xfec9('0x21')][_0xfec9('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x4eaae2,_0x5be73a,_0x1cd5c0,_0x11c51f){return new BPromise(function(_0x2a48bc,_0x5694f2){var _0x16915c=_0x11c51f||client;return _0x16915c[_0xfec9('0x23')](_0x4eaae2,_0x1cd5c0)[_0xfec9('0x24')](function(_0x4c9808){logger[_0xfec9('0x25')](_0xfec9('0x26'),_0x5be73a,'request\x20sent');logger['debug'](_0xfec9('0x27'),_0x5be73a,_0xfec9('0x28'),JSON[_0xfec9('0x29')](_0x4c9808));if(_0x4c9808[_0xfec9('0x2a')]){if(_0x4c9808[_0xfec9('0x2a')][_0xfec9('0x2b')]===0x1f4){logger[_0xfec9('0x2a')](_0xfec9('0x26'),_0x5be73a,_0x4c9808['error'][_0xfec9('0x2c')]);return _0x5694f2(_0x4c9808[_0xfec9('0x2a')][_0xfec9('0x2c')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x5be73a,_0x4c9808[_0xfec9('0x2a')][_0xfec9('0x2c')]);return _0x2a48bc(_0x4c9808[_0xfec9('0x2a')][_0xfec9('0x2c')]);}else{logger[_0xfec9('0x25')](_0xfec9('0x26'),_0x5be73a,_0xfec9('0x28'));_0x2a48bc(_0x4c9808['result'][_0xfec9('0x2c')]);}})[_0xfec9('0x2d')](function(_0x21b43f){logger[_0xfec9('0x2a')](_0xfec9('0x26'),_0x5be73a,_0x21b43f);_0x5694f2(_0x21b43f);});});}function respondWithStatusCode(_0x1285f2,_0xe74521){_0xe74521=_0xe74521||0xcc;return function(_0x11a8cf){if(_0x11a8cf){return _0x1285f2[_0xfec9('0x2e')](_0xe74521);}return _0x1285f2[_0xfec9('0x2f')](_0xe74521)[_0xfec9('0x30')]();};}function respondWithResult(_0x236f13,_0x3aa22b){_0x3aa22b=_0x3aa22b||0xc8;return function(_0x43d512){if(_0x43d512){return _0x236f13['status'](_0x3aa22b)['json'](_0x43d512);}};}function respondWithFilteredResult(_0x4d06e1,_0x25a8cc){return function(_0x5ea7c9){if(_0x5ea7c9){var _0x5c0aa1=typeof _0x25a8cc[_0xfec9('0x31')]===_0xfec9('0x32')&&typeof _0x25a8cc[_0xfec9('0x33')]===_0xfec9('0x32');var _0x14aca=_0x5ea7c9[_0xfec9('0x34')];var _0x447018=_0x5c0aa1?0x0:_0x25a8cc[_0xfec9('0x31')];var _0x35a2f7=_0x5c0aa1?_0x5ea7c9[_0xfec9('0x34')]:_0x25a8cc[_0xfec9('0x31')]+_0x25a8cc[_0xfec9('0x33')];var _0x55251f;if(_0x35a2f7>=_0x14aca){_0x35a2f7=_0x14aca;_0x55251f=0xc8;}else{_0x55251f=0xce;}_0x4d06e1[_0xfec9('0x2f')](_0x55251f);return _0x4d06e1[_0xfec9('0x35')](_0xfec9('0x36'),_0x447018+'-'+_0x35a2f7+'/'+_0x14aca)[_0xfec9('0x37')](_0x5ea7c9);}return null;};}function patchUpdates(_0x59709e){return function(_0xeb1152){try{jsonpatch['apply'](_0xeb1152,_0x59709e,!![]);}catch(_0x5d6393){return BPromise[_0xfec9('0x38')](_0x5d6393);}return _0xeb1152[_0xfec9('0x39')]();};}function saveUpdates(_0x46a65,_0x40b6c5){return function(_0x5e8016){if(_0x5e8016){return _0x5e8016['update'](_0x46a65)[_0xfec9('0x24')](function(_0x3649fc){return _0x3649fc;});}return null;};}function removeEntity(_0x5af85e,_0x4459bf){return function(_0x9da4f1){if(_0x9da4f1){return _0x9da4f1[_0xfec9('0x3a')]()['then'](function(){var _0x3ed6ae=_0x9da4f1['get']({'plain':!![]});var _0x35bc6c=_0xfec9('0x3b');return db['UserProfileResource'][_0xfec9('0x3a')]({'where':{'type':_0x35bc6c,'resourceId':_0x3ed6ae['id']}})[_0xfec9('0x24')](function(){return _0x9da4f1;});})[_0xfec9('0x24')](function(){_0x5af85e[_0xfec9('0x2f')](0xcc)[_0xfec9('0x30')]();});}};}function handleEntityNotFound(_0x495c22,_0xce886d){return function(_0xc95a0d){if(!_0xc95a0d){_0x495c22[_0xfec9('0x2e')](0x194);}return _0xc95a0d;};}function handleError(_0x390b59,_0x518c0a){_0x518c0a=_0x518c0a||0x1f4;return function(_0x5e5ed1){logger[_0xfec9('0x2a')](_0x5e5ed1[_0xfec9('0x3c')]);if(_0x5e5ed1[_0xfec9('0x3d')]){delete _0x5e5ed1[_0xfec9('0x3d')];}_0x390b59[_0xfec9('0x2f')](_0x518c0a)[_0xfec9('0x3e')](_0x5e5ed1);};}exports[_0xfec9('0x3f')]=function(_0x24fb63,_0x1c9397){var _0x204538={'include':[{'model':db[_0xfec9('0x40')],'as':_0xfec9('0x41')}]},_0x1c034d={},_0x44956c={'count':0x0,'rows':[]};var _0x9bdfe9=_[_0xfec9('0x42')](db[_0xfec9('0x43')]['rawAttributes'],function(_0x36ea8e){return{'name':_0x36ea8e['fieldName'],'type':_0x36ea8e['type'][_0xfec9('0x44')]};});_0x1c034d[_0xfec9('0x45')]=_[_0xfec9('0x42')](_0x9bdfe9,'name');_0x1c034d[_0xfec9('0x46')]=_[_0xfec9('0x47')](_0x24fb63['query']);_0x1c034d[_0xfec9('0x48')]=_[_0xfec9('0x49')](_0x1c034d[_0xfec9('0x45')],_0x1c034d[_0xfec9('0x46')]);_0x204538[_0xfec9('0x4a')]=_['intersection'](_0x1c034d[_0xfec9('0x45')],qs[_0xfec9('0x4b')](_0x24fb63['query'][_0xfec9('0x4b')]));_0x204538['attributes']=_0x204538[_0xfec9('0x4a')][_0xfec9('0x4c')]?_0x204538[_0xfec9('0x4a')]:_0x1c034d[_0xfec9('0x45')];if(!_0x24fb63[_0xfec9('0x46')][_0xfec9('0x4d')](_0xfec9('0x4e'))){_0x204538[_0xfec9('0x33')]=qs[_0xfec9('0x33')](_0x24fb63[_0xfec9('0x46')]['limit']);_0x204538['offset']=qs['offset'](_0x24fb63['query'][_0xfec9('0x31')]);}_0x204538[_0xfec9('0x4f')]=qs['sort'](_0x24fb63[_0xfec9('0x46')][_0xfec9('0x50')]);_0x204538[_0xfec9('0x51')]=qs[_0xfec9('0x48')](_[_0xfec9('0x52')](_0x24fb63[_0xfec9('0x46')],_0x1c034d[_0xfec9('0x48')]),_0x9bdfe9);if(_0x24fb63[_0xfec9('0x46')][_0xfec9('0x53')]){_0x204538[_0xfec9('0x51')]=_[_0xfec9('0x54')](_0x204538[_0xfec9('0x51')],{'$or':_[_0xfec9('0x42')](_0x9bdfe9,function(_0x2c51a9){if(_0x2c51a9['type']!=='VIRTUAL'){var _0x36ed8a={};_0x36ed8a[_0x2c51a9[_0xfec9('0x3d')]]={'$like':'%'+_0x24fb63[_0xfec9('0x46')][_0xfec9('0x53')]+'%'};return _0x36ed8a;}})});}_0x204538=_[_0xfec9('0x54')]({},_0x204538,_0x24fb63['options']);var _0x5d7b18={'where':_0x204538[_0xfec9('0x51')]};return db[_0xfec9('0x43')][_0xfec9('0x34')](_0x5d7b18)[_0xfec9('0x24')](function(_0x472616){_0x44956c['count']=_0x472616;if(_0x24fb63[_0xfec9('0x46')]['includeAll']){_0x204538[_0xfec9('0x55')]=[{'all':!![]}];}return db[_0xfec9('0x43')][_0xfec9('0x56')](_0x204538);})[_0xfec9('0x24')](function(_0x3d3639){_0x44956c[_0xfec9('0x57')]=_0x3d3639;return _0x44956c;})['then'](respondWithFilteredResult(_0x1c9397,_0x204538))[_0xfec9('0x2d')](handleError(_0x1c9397,null));};exports[_0xfec9('0x58')]=function(_0x58d839,_0x4bba64){var _0x26e133={'raw':![],'where':{'id':_0x58d839['params']['id']},'include':[{'model':db[_0xfec9('0x40')],'as':'mandatoryDispositionPause'}]},_0x5ef30e={};_0x5ef30e[_0xfec9('0x45')]=_[_0xfec9('0x47')](db[_0xfec9('0x43')][_0xfec9('0x59')]);_0x5ef30e[_0xfec9('0x46')]=_[_0xfec9('0x47')](_0x58d839[_0xfec9('0x46')]);_0x5ef30e['filters']=_[_0xfec9('0x49')](_0x5ef30e['model'],_0x5ef30e['query']);_0x26e133[_0xfec9('0x4a')]=_['intersection'](_0x5ef30e[_0xfec9('0x45')],qs['fields'](_0x58d839[_0xfec9('0x46')][_0xfec9('0x4b')]));_0x26e133['attributes']=_0x26e133['attributes'][_0xfec9('0x4c')]?_0x26e133['attributes']:_0x5ef30e[_0xfec9('0x45')];if(_0x58d839[_0xfec9('0x46')][_0xfec9('0x5a')]){_0x26e133['include']=[{'all':!![]}];}_0x26e133=_['merge']({},_0x26e133,_0x58d839['options']);return db[_0xfec9('0x43')][_0xfec9('0x5b')](_0x26e133)[_0xfec9('0x24')](handleEntityNotFound(_0x4bba64,null))[_0xfec9('0x24')](respondWithResult(_0x4bba64,null))[_0xfec9('0x2d')](handleError(_0x4bba64,null));};exports['create']=function(_0xe94c1a,_0x8dbd80){return db['SmsAccount'][_0xfec9('0x5c')](_0xe94c1a[_0xfec9('0x5d')],{})[_0xfec9('0x24')](function(_0x2301d0){var _0x328315=_0xe94c1a[_0xfec9('0x5e')]['get']({'plain':!![]});if(!_0x328315)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x328315[_0xfec9('0x5f')]==='user'){var _0xedb26e=_0x2301d0[_0xfec9('0x60')]({'plain':!![]});var _0x4a981c=_0xfec9('0x3b');return db[_0xfec9('0x61')][_0xfec9('0x5b')]({'where':{'name':_0x4a981c,'userProfileId':_0x328315[_0xfec9('0x62')]},'raw':!![]})['then'](function(_0x16c435){if(_0x16c435&&_0x16c435['autoAssociation']===0x0){return db[_0xfec9('0x63')][_0xfec9('0x5c')]({'name':_0xedb26e[_0xfec9('0x3d')],'resourceId':_0xedb26e['id'],'type':_0x16c435[_0xfec9('0x3d')],'sectionId':_0x16c435['id']},{})[_0xfec9('0x24')](function(){return _0x2301d0;});}else{return _0x2301d0;}})[_0xfec9('0x2d')](function(_0x30680a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30680a);throw _0x30680a;});}return _0x2301d0;})[_0xfec9('0x24')](respondWithResult(_0x8dbd80,0xc9))[_0xfec9('0x2d')](handleError(_0x8dbd80,null));};exports['update']=function(_0x56f3e2,_0x1061d7){if(_0x56f3e2['body']['id']){delete _0x56f3e2[_0xfec9('0x5d')]['id'];}return db[_0xfec9('0x43')]['find']({'where':{'id':_0x56f3e2[_0xfec9('0x64')]['id']},'include':[{'model':db[_0xfec9('0x40')],'as':_0xfec9('0x41')}]})[_0xfec9('0x24')](handleEntityNotFound(_0x1061d7,null))['then'](saveUpdates(_0x56f3e2[_0xfec9('0x5d')],null))['then'](respondWithResult(_0x1061d7,null))[_0xfec9('0x2d')](handleError(_0x1061d7,null));};exports['destroy']=function(_0x14660f,_0x1f180a){return db[_0xfec9('0x43')][_0xfec9('0x5b')]({'where':{'id':_0x14660f[_0xfec9('0x64')]['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x1f180a,null))[_0xfec9('0x24')](removeEntity(_0x1f180a,null))[_0xfec9('0x2d')](handleError(_0x1f180a,null));};exports[_0xfec9('0x65')]=function(_0x5d5e8a,_0xfc3274){return db[_0xfec9('0x43')]['describe']()[_0xfec9('0x24')](respondWithResult(_0xfc3274,null))[_0xfec9('0x2d')](handleError(_0xfc3274,null));};exports[_0xfec9('0x66')]=function(_0x31b924,_0x305961,_0x126729){if(_0x31b924[_0xfec9('0x5d')]['id']){delete _0x31b924['body']['id'];}return db[_0xfec9('0x43')][_0xfec9('0x5b')]({'where':{'id':_0x31b924[_0xfec9('0x64')]['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x305961,null))[_0xfec9('0x24')](function(_0x414ccc){if(_0x414ccc){_0x31b924[_0xfec9('0x5d')][_0xfec9('0x67')]=_0x414ccc['id'];return db[_0xfec9('0x68')][_0xfec9('0x5c')](_0x31b924[_0xfec9('0x5d')]);}})[_0xfec9('0x24')](respondWithResult(_0x305961,null))[_0xfec9('0x2d')](handleError(_0x305961,null));};exports[_0xfec9('0x69')]=function(_0x3cc1f1,_0x2d34ad,_0x41add9){var _0x1087e0={'raw':![],'where':{}};var _0x6541f5={};var _0xd42b85={'count':0x0,'rows':[]};return db[_0xfec9('0x43')]['findOne']({'where':{'id':_0x3cc1f1[_0xfec9('0x64')]['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x2d34ad,null))[_0xfec9('0x24')](function(_0x25195d){if(_0x25195d){_0x6541f5[_0xfec9('0x45')]=_['keys'](db[_0xfec9('0x68')][_0xfec9('0x59')]);_0x6541f5[_0xfec9('0x46')]=_[_0xfec9('0x47')](_0x3cc1f1[_0xfec9('0x46')]);_0x6541f5[_0xfec9('0x48')]=_[_0xfec9('0x49')](_0x6541f5[_0xfec9('0x45')],_0x6541f5['query']);_0x1087e0[_0xfec9('0x4a')]=_['intersection'](_0x6541f5[_0xfec9('0x45')],qs[_0xfec9('0x4b')](_0x3cc1f1[_0xfec9('0x46')]['fields']));_0x1087e0[_0xfec9('0x4a')]=_0x1087e0['attributes']['length']?_0x1087e0[_0xfec9('0x4a')]:_0x6541f5[_0xfec9('0x45')];if(!_0x3cc1f1[_0xfec9('0x46')][_0xfec9('0x4d')](_0xfec9('0x4e'))){_0x1087e0['limit']=qs[_0xfec9('0x33')](_0x3cc1f1[_0xfec9('0x46')][_0xfec9('0x33')]);_0x1087e0[_0xfec9('0x31')]=qs[_0xfec9('0x31')](_0x3cc1f1['query']['offset']);}_0x1087e0[_0xfec9('0x4f')]=qs['sort'](_0x3cc1f1['query'][_0xfec9('0x50')]);_0x1087e0[_0xfec9('0x51')]=qs[_0xfec9('0x48')](_[_0xfec9('0x52')](_0x3cc1f1[_0xfec9('0x46')],_0x6541f5[_0xfec9('0x48')]));_0x1087e0['where'][_0xfec9('0x67')]=_0x25195d['id'];if(_0x3cc1f1[_0xfec9('0x46')][_0xfec9('0x53')]){_0x1087e0['where']=_[_0xfec9('0x54')](_0x1087e0[_0xfec9('0x51')],{'$or':_['map'](_0x1087e0[_0xfec9('0x4a')],function(_0x403660){var _0x1314a4={};_0x1314a4[_0x403660]={'$like':'%'+_0x3cc1f1['query'][_0xfec9('0x53')]+'%'};return _0x1314a4;})});}_0x1087e0=_[_0xfec9('0x54')]({},_0x1087e0,_0x3cc1f1['options']);return db[_0xfec9('0x68')][_0xfec9('0x34')]({'where':_0x1087e0[_0xfec9('0x51')]})[_0xfec9('0x24')](function(_0x4ae7ec){_0xd42b85[_0xfec9('0x34')]=_0x4ae7ec;if(_0x3cc1f1[_0xfec9('0x46')][_0xfec9('0x5a')]){_0x1087e0[_0xfec9('0x55')]=[{'all':!![]}];}return db[_0xfec9('0x68')][_0xfec9('0x56')](_0x1087e0);})['then'](function(_0x110caf){_0xd42b85[_0xfec9('0x57')]=_0x110caf;return _0xd42b85;});}})[_0xfec9('0x24')](respondWithFilteredResult(_0x2d34ad,_0x1087e0))[_0xfec9('0x2d')](handleError(_0x2d34ad,null));};exports[_0xfec9('0x6a')]=function(_0x527f1c,_0x5a9f27,_0x12bd58){return db['SmsAccount'][_0xfec9('0x5b')]({'where':{'id':_0x527f1c[_0xfec9('0x64')]['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x5a9f27,null))['then'](function(_0x10ab73){if(_0x10ab73){return _0x10ab73['removeDispositions'](_0x527f1c[_0xfec9('0x46')][_0xfec9('0x6b')]);}})[_0xfec9('0x24')](respondWithStatusCode(_0x5a9f27,null))[_0xfec9('0x2d')](handleError(_0x5a9f27,null));};exports[_0xfec9('0x6c')]=function(_0x4e02f6,_0x46294e,_0x47cad5){if(_0x4e02f6['body']['id']){delete _0x4e02f6['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x4e02f6[_0xfec9('0x64')]['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x46294e,null))[_0xfec9('0x24')](function(_0x41276b){if(_0x41276b){_0x4e02f6[_0xfec9('0x5d')][_0xfec9('0x67')]=_0x41276b['id'];return db[_0xfec9('0x6d')][_0xfec9('0x5c')](_0x4e02f6['body']);}})[_0xfec9('0x24')](respondWithResult(_0x46294e,null))[_0xfec9('0x2d')](handleError(_0x46294e,null));};exports['getAnswers']=function(_0x43e66d,_0xe496ca,_0x5a4901){var _0x1d0bc4={'raw':![],'where':{}};var _0x1a8841={};var _0x3c17af={'count':0x0,'rows':[]};return db[_0xfec9('0x43')]['findOne']({'where':{'id':_0x43e66d[_0xfec9('0x64')]['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0xe496ca,null))[_0xfec9('0x24')](function(_0x1de786){if(_0x1de786){_0x1a8841[_0xfec9('0x45')]=_['keys'](db[_0xfec9('0x6d')][_0xfec9('0x59')]);_0x1a8841[_0xfec9('0x46')]=_['keys'](_0x43e66d[_0xfec9('0x46')]);_0x1a8841[_0xfec9('0x48')]=_[_0xfec9('0x49')](_0x1a8841['model'],_0x1a8841['query']);_0x1d0bc4[_0xfec9('0x4a')]=_[_0xfec9('0x49')](_0x1a8841[_0xfec9('0x45')],qs['fields'](_0x43e66d[_0xfec9('0x46')][_0xfec9('0x4b')]));_0x1d0bc4[_0xfec9('0x4a')]=_0x1d0bc4[_0xfec9('0x4a')][_0xfec9('0x4c')]?_0x1d0bc4[_0xfec9('0x4a')]:_0x1a8841['model'];if(!_0x43e66d[_0xfec9('0x46')][_0xfec9('0x4d')](_0xfec9('0x4e'))){_0x1d0bc4['limit']=qs[_0xfec9('0x33')](_0x43e66d[_0xfec9('0x46')][_0xfec9('0x33')]);_0x1d0bc4['offset']=qs['offset'](_0x43e66d[_0xfec9('0x46')][_0xfec9('0x31')]);}_0x1d0bc4[_0xfec9('0x4f')]=qs[_0xfec9('0x50')](_0x43e66d['query'][_0xfec9('0x50')]);_0x1d0bc4[_0xfec9('0x51')]=qs['filters'](_[_0xfec9('0x52')](_0x43e66d[_0xfec9('0x46')],_0x1a8841[_0xfec9('0x48')]));_0x1d0bc4[_0xfec9('0x51')][_0xfec9('0x67')]=_0x1de786['id'];if(_0x43e66d[_0xfec9('0x46')][_0xfec9('0x53')]){_0x1d0bc4[_0xfec9('0x51')]=_['merge'](_0x1d0bc4[_0xfec9('0x51')],{'$or':_[_0xfec9('0x42')](_0x1d0bc4[_0xfec9('0x4a')],function(_0x59be76){var _0x19c0ca={};_0x19c0ca[_0x59be76]={'$like':'%'+_0x43e66d['query']['filter']+'%'};return _0x19c0ca;})});}_0x1d0bc4=_[_0xfec9('0x54')]({},_0x1d0bc4,_0x43e66d[_0xfec9('0x6e')]);return db[_0xfec9('0x6d')][_0xfec9('0x34')]({'where':_0x1d0bc4[_0xfec9('0x51')]})[_0xfec9('0x24')](function(_0x5d8bba){_0x3c17af[_0xfec9('0x34')]=_0x5d8bba;if(_0x43e66d[_0xfec9('0x46')][_0xfec9('0x5a')]){_0x1d0bc4[_0xfec9('0x55')]=[{'all':!![]}];}return db[_0xfec9('0x6d')][_0xfec9('0x56')](_0x1d0bc4);})[_0xfec9('0x24')](function(_0x32a9a6){_0x3c17af[_0xfec9('0x57')]=_0x32a9a6;return _0x3c17af;});}})[_0xfec9('0x24')](respondWithFilteredResult(_0xe496ca,_0x1d0bc4))[_0xfec9('0x2d')](handleError(_0xe496ca,null));};exports[_0xfec9('0x6f')]=function(_0x4d30c0,_0x3bcbff,_0x55ed66){return db[_0xfec9('0x43')][_0xfec9('0x5b')]({'where':{'id':_0x4d30c0[_0xfec9('0x64')]['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x3bcbff,null))[_0xfec9('0x24')](function(_0xf4fb60){if(_0xf4fb60){return _0xf4fb60['removeAnswers'](_0x4d30c0[_0xfec9('0x46')][_0xfec9('0x6b')]);}})['then'](respondWithStatusCode(_0x3bcbff,null))['catch'](handleError(_0x3bcbff,null));};exports['notify']=function(_0x2e118a,_0xb18a58,_0x3bcc0c){var _0x39ddea={'channel':_0xfec9('0x70')};var _0x52c46a=[];var _0x523c6f=[];var _0x392df9={};return db[_0xfec9('0x43')][_0xfec9('0x5b')]({'where':{'id':_0x2e118a[_0xfec9('0x64')]['id']},'include':[{'model':db[_0xfec9('0x71')],'as':_0xfec9('0x72')}]})[_0xfec9('0x24')](handleEntityNotFound(_0xb18a58,null))['then'](function(_0x131425){_0x39ddea[_0xfec9('0x73')]=_0x131425;_0x39ddea[_0xfec9('0x74')]=_[_0xfec9('0x75')](_0x131425[_0xfec9('0x72')],[_0xfec9('0x76')],[_0xfec9('0x77')]);if(_0x39ddea[_0xfec9('0x73')][_0xfec9('0x72')]){delete _0x39ddea['account'][_0xfec9('0x72')];}return db['CmContact'][_0xfec9('0x65')]();})['then'](function(_0x334952){if(!_0x334952){throw new db[(_0xfec9('0x78'))][(_0xfec9('0x79'))](_0xfec9('0x7a'));}_0x52c46a=_[_0xfec9('0x7b')](_['keys'](_0x334952),[_0xfec9('0x7c'),'updatedAt']);_0x523c6f=_[_0xfec9('0x7b')](_[_0xfec9('0x47')](_0x334952),['createdAt','updatedAt',_0xfec9('0x7d'),_0xfec9('0x7e')]);_0x39ddea[_0xfec9('0x5d')]={'mapKey':_0xfec9('0x7f')};if(_0x39ddea[_0xfec9('0x73')][_0xfec9('0x80')]){switch(_0x39ddea['account']['type']){case _0xfec9('0x81'):_0x39ddea[_0xfec9('0x5d')]['from']=_0x2e118a[_0xfec9('0x5d')]['From'];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x5d')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x82')];_0x39ddea['body'][_0xfec9('0x83')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x84')];break;case _0xfec9('0x85'):_0x39ddea[_0xfec9('0x5d')]['from']='+'+_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x86')];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x5d')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x87')];break;case _0xfec9('0x88'):_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x89')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x89')];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x5d')]=_0x2e118a['body'][_0xfec9('0x2c')];break;case _0xfec9('0x8a'):_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x89')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x89')];_0x39ddea['body']['body']=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x5d')];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x83')]=_0x2e118a['body'][_0xfec9('0x8b')];break;case _0xfec9('0x8c'):_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x89')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x8d')];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x5d')]=_0x2e118a[_0xfec9('0x5d')]['Text'];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x83')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x8e')];break;case _0xfec9('0x8f'):_0x39ddea['body'][_0xfec9('0x89')]='+'+_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x90')][0x0]['from'];_0x39ddea['body']['body']=_0x2e118a['body']['results'][0x0]['text'];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x83')]=_0x2e118a['body'][_0xfec9('0x90')][0x0][_0xfec9('0x83')];break;case _0xfec9('0x91'):_0x39ddea['body'][_0xfec9('0x89')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x92')];_0x39ddea[_0xfec9('0x5d')]['body']=_0x2e118a['body']['segmentedMessage'][_0xfec9('0x2c')];break;case _0xfec9('0x93'):_0x39ddea['body'][_0xfec9('0x89')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x94')];_0x39ddea[_0xfec9('0x5d')]['body']=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x87')];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x83')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x95')];break;case _0xfec9('0x96'):_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x83')]=_0x2e118a[_0xfec9('0x5d')][0x0][_0xfec9('0x2c')]['id'];_0x39ddea[_0xfec9('0x5d')]['from']=_0x2e118a['body'][0x0]['message'][_0xfec9('0x89')];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x5d')]=_0x2e118a[_0xfec9('0x5d')][0x0]['message']['text'];break;case _0xfec9('0x97'):_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x89')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x89')];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x5d')]=_0x2e118a['body']['message'];_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x83')]=_0x2e118a[_0xfec9('0x5d')][_0xfec9('0x98')];break;}}if(_0x39ddea['body']['id']){delete _0x39ddea['body']['id'];}if(_[_0xfec9('0x99')](_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x89')])){throw new db[(_0xfec9('0x78'))][(_0xfec9('0x79'))](_0xfec9('0x9a'));}if(_[_0xfec9('0x99')](_0x39ddea['body'][_0xfec9('0x5d')])||_0x39ddea['body'][_0xfec9('0x5d')]===''){throw new db[(_0xfec9('0x78'))][(_0xfec9('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x9b')])){throw new db[(_0xfec9('0x78'))]['ValidationError'](_0xfec9('0x9c')+_0x523c6f);}if(!_[_0xfec9('0x9d')](_0x523c6f,_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x9b')])){throw new db[(_0xfec9('0x78'))][(_0xfec9('0x79'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x523c6f);}_0x392df9[_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x9b')]]=_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x89')];return db[_0xfec9('0x9e')]['find']({'where':{'id':_0x39ddea['account'][_0xfec9('0x7e')]},'include':[{'model':db[_0xfec9('0x9f')],'as':_0xfec9('0xa0'),'where':_0x392df9,'limit':0x1,'order':[[_0xfec9('0xa1'),'DESC']]}]});})[_0xfec9('0x24')](handleEntityNotFound(_0xb18a58,null))[_0xfec9('0x24')](function(_0x717534){if(_0x717534){_0x39ddea['list']=_[_0xfec9('0xa2')](_0x717534,[_0xfec9('0xa0')]);if(_0x717534[_0xfec9('0xa0')][_0xfec9('0x4c')]){return _0x717534[_0xfec9('0xa0')][0x0];}var _0x372614=_[_0xfec9('0x1c')](_0x39ddea[_0xfec9('0x5d')],{'firstName':_0x39ddea[_0xfec9('0x5d')]['from'],'ListId':_0x717534['id']});_0x372614[_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x9b')]]=_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x89')];return db[_0xfec9('0x9f')]['create'](_0x372614,{'fields':_0x52c46a,'raw':!![]});}})['then'](handleEntityNotFound(_0xb18a58,null))[_0xfec9('0x24')](function(_0xccc66e){if(_0xccc66e){_0x39ddea[_0xfec9('0xa3')]=_0xccc66e;var _0x198613={'ContactId':_0xccc66e['id'],'phone':_0x39ddea[_0xfec9('0x5d')]['from'],'SmsAccountId':_0x2e118a[_0xfec9('0x64')]['id']};var _0xd39b70={'ContactId':_0xccc66e['id'],'SmsAccountId':_0x2e118a[_0xfec9('0x64')]['id'],'closed':![]};return db[_0xfec9('0xa4')]['find']({'where':_0xd39b70})['then'](function(_0x11549f){if(_0x11549f){return[_0x11549f,![]];}return db['SmsInteraction'][_0xfec9('0x5c')](_0x198613)[_0xfec9('0x24')](function(_0x56e798){return[_0x56e798,!![]];});});}})[_0xfec9('0xa5')](function(_0x3a310a,_0x4b2923){_0x39ddea[_0xfec9('0xa6')]=_0x3a310a[_0xfec9('0x60')]({'plain':!![]});_0x39ddea[_0xfec9('0xa6')][_0xfec9('0xa7')]=![];if(_0x4b2923){if(_0x39ddea[_0xfec9('0x73')][_0xfec9('0xa8')]){_0x39ddea[_0xfec9('0x74')][_0xfec9('0xa9')]({'id':0x0,'priority':_0x39ddea['applications'][_0xfec9('0x4c')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xfec9('0xaa')});}_0x39ddea[_0xfec9('0xa6')][_0xfec9('0xa7')]=!![];}return db['SmsMessage'][_0xfec9('0x5c')]({'phone':_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x89')],'messageId':_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x83')],'body':_0x39ddea[_0xfec9('0x5d')][_0xfec9('0x5d')],'SmsAccountId':_0x2e118a['params']['id'],'SmsInteractionId':_0x3a310a['id'],'direction':'in','ContactId':_0x3a310a['ContactId'],'AttachmentId':_0x39ddea['body'][_0xfec9('0xab')]});})[_0xfec9('0x24')](function(_0x272d50){_0x39ddea[_0xfec9('0x2c')]=_0x272d50;if(_0x39ddea['interaction'][_0xfec9('0xac')]){return db['User'][_0xfec9('0x5b')]({'attributes':['id',_0xfec9('0x3d')],'where':{'id':_0x39ddea[_0xfec9('0xa6')][_0xfec9('0xac')]}})[_0xfec9('0x24')](function(_0x34e6a5){if(_0x34e6a5){_0x39ddea[_0xfec9('0x74')][_0xfec9('0xad')]({'id':0x0,'priority':0x0,'app':_0xfec9('0xae'),'appdata':_0x34e6a5['name']+','+(_0x39ddea[_0xfec9('0x73')][_0xfec9('0xaf')]||0xa),'interval':_0xfec9('0xaa')});}return respondWithRpcPromise('Start',_0xfec9('0xb0'),_0x39ddea);});}return respondWithRpcPromise(_0xfec9('0xb1'),'startRouting',_0x39ddea);})[_0xfec9('0x24')](function(_0x17480c){if(_0x17480c){var _0x22361c=0xc8;var _0x107f0e='receiveMessage';logger[_0xfec9('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x107f0e,_0x22361c,_0xfec9('0xb2'));logger[_0xfec9('0xb3')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x107f0e,_0x22361c,'entity\x20found',JSON[_0xfec9('0x29')](_0x17480c));if(_0x39ddea[_0xfec9('0x73')][_0xfec9('0x80')]===_0xfec9('0x81')){return _0xb18a58[_0xfec9('0x2f')](_0x22361c)[_0xfec9('0x35')](_0xfec9('0xb4'),_0xfec9('0xb5'))[_0xfec9('0x3e')]('\x0a');}else{return _0xb18a58[_0xfec9('0x2f')](_0x22361c)['json'](_0x17480c);}}})[_0xfec9('0x2d')](handleError(_0xb18a58,null));};exports[_0xfec9('0xb6')]=function(_0x48f213,_0x43eaf8,_0x5415bb){return db['SmsAccount'][_0xfec9('0xb7')]({'where':{'id':_0x48f213[_0xfec9('0x64')]['id']}})['then'](handleEntityNotFound(_0x43eaf8,null))[_0xfec9('0x24')](function(_0x23830a){if(_0x23830a){return db['sequelize'][_0xfec9('0xb8')](function(_0x1817a7){return db[_0xfec9('0x71')]['destroy']({'where':{'SmsAccountId':_0x48f213[_0xfec9('0x64')]['id']},'transaction':_0x1817a7})[_0xfec9('0x24')](function(_0x509926){var _0x39ab32=_[_0xfec9('0x42')](_0x48f213[_0xfec9('0x5d')],function(_0x1e79d1){_0x1e79d1['SmsAccountId']=_0x48f213[_0xfec9('0x64')]['id'];return _0x1e79d1;});return db[_0xfec9('0x71')][_0xfec9('0xb9')](_0x39ab32,{'transaction':_0x1817a7});});})[_0xfec9('0x24')](function(){return db[_0xfec9('0x71')][_0xfec9('0xba')]({'where':{'SmsAccountId':_0x48f213[_0xfec9('0x64')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x43eaf8,null))[_0xfec9('0x2d')](handleError(_0x43eaf8,null));};exports[_0xfec9('0xbb')]=function(_0x2fecb6,_0x48b143,_0xbab974){var _0x4023ed={};var _0x32cae2={};var _0x37bacb;var _0x299911;return db[_0xfec9('0x43')]['findOne']({'where':{'id':_0x2fecb6[_0xfec9('0x64')]['id']}})['then'](handleEntityNotFound(_0x48b143,null))[_0xfec9('0x24')](function(_0xc0ba67){if(_0xc0ba67){_0x37bacb=_0xc0ba67;_0x32cae2[_0xfec9('0x45')]=_[_0xfec9('0x47')](db[_0xfec9('0x71')][_0xfec9('0x59')]);_0x32cae2[_0xfec9('0x46')]=_[_0xfec9('0x47')](_0x2fecb6['query']);_0x32cae2[_0xfec9('0x48')]=_[_0xfec9('0x49')](_0x32cae2[_0xfec9('0x45')],_0x32cae2[_0xfec9('0x46')]);_0x4023ed[_0xfec9('0x4a')]=_['intersection'](_0x32cae2[_0xfec9('0x45')],qs[_0xfec9('0x4b')](_0x2fecb6[_0xfec9('0x46')][_0xfec9('0x4b')]));_0x4023ed[_0xfec9('0x4a')]=_0x4023ed[_0xfec9('0x4a')][_0xfec9('0x4c')]?_0x4023ed['attributes']:_0x32cae2[_0xfec9('0x45')];_0x4023ed['order']=qs['sort'](_0x2fecb6[_0xfec9('0x46')][_0xfec9('0x50')]);_0x4023ed[_0xfec9('0x51')]=qs[_0xfec9('0x48')](_[_0xfec9('0x52')](_0x2fecb6[_0xfec9('0x46')],_0x32cae2[_0xfec9('0x48')]));if(_0x2fecb6[_0xfec9('0x46')]['filter']){_0x4023ed[_0xfec9('0x51')]=_[_0xfec9('0x54')](_0x4023ed[_0xfec9('0x51')],{'$or':_['map'](_0x4023ed[_0xfec9('0x4a')],function(_0x34190e){var _0x118f8c={};_0x118f8c[_0x34190e]={'$like':'%'+_0x2fecb6[_0xfec9('0x46')][_0xfec9('0x53')]+'%'};return _0x118f8c;})});}_0x4023ed=_[_0xfec9('0x54')]({},_0x4023ed,_0x2fecb6[_0xfec9('0x6e')]);return _0x37bacb['getApplications'](_0x4023ed);}})['then'](function(_0x506ad4){if(_0x506ad4){_0x299911=_0x506ad4['length'];if(!_0x2fecb6['query'][_0xfec9('0x4d')](_0xfec9('0x4e'))){_0x4023ed[_0xfec9('0x33')]=qs[_0xfec9('0x33')](_0x2fecb6['query'][_0xfec9('0x33')]);_0x4023ed[_0xfec9('0x31')]=qs[_0xfec9('0x31')](_0x2fecb6[_0xfec9('0x46')][_0xfec9('0x31')]);}return _0x37bacb[_0xfec9('0xbb')](_0x4023ed);}})[_0xfec9('0x24')](function(_0x259692){if(_0x259692){return _0x259692?{'count':_0x299911,'rows':_0x259692}:null;}})[_0xfec9('0x24')](respondWithResult(_0x48b143,null))['catch'](handleError(_0x48b143,null));};exports[_0xfec9('0xbc')]=function(_0x551498,_0x3163e1,_0x2d78ba){var _0x2b9f01={'raw':![],'where':{}};var _0x526d42={};var _0x3bf1a9={'count':0x0,'rows':[]};return db[_0xfec9('0x43')][_0xfec9('0xb7')]({'where':{'id':_0x551498['params']['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x3163e1,null))[_0xfec9('0x24')](function(_0x41be8a){if(_0x41be8a){_0x526d42[_0xfec9('0x45')]=_[_0xfec9('0x47')](db[_0xfec9('0xa4')][_0xfec9('0x59')]);_0x526d42[_0xfec9('0x46')]=_[_0xfec9('0x47')](_0x551498[_0xfec9('0x46')]);_0x526d42[_0xfec9('0x48')]=_[_0xfec9('0x49')](_0x526d42[_0xfec9('0x45')],_0x526d42[_0xfec9('0x46')]);_0x2b9f01[_0xfec9('0x4a')]=_['intersection'](_0x526d42[_0xfec9('0x45')],qs[_0xfec9('0x4b')](_0x551498['query'][_0xfec9('0x4b')]));_0x2b9f01['attributes']=_0x2b9f01[_0xfec9('0x4a')][_0xfec9('0x4c')]?_0x2b9f01[_0xfec9('0x4a')]:_0x526d42['model'];if(!_0x551498[_0xfec9('0x46')][_0xfec9('0x4d')]('nolimit')){_0x2b9f01[_0xfec9('0x33')]=qs['limit'](_0x551498[_0xfec9('0x46')]['limit']);_0x2b9f01['offset']=qs[_0xfec9('0x31')](_0x551498[_0xfec9('0x46')][_0xfec9('0x31')]);}_0x2b9f01[_0xfec9('0x4f')]=qs[_0xfec9('0x50')](_0x551498['query'][_0xfec9('0x50')]);_0x2b9f01[_0xfec9('0x51')]=qs[_0xfec9('0x48')](_['pick'](_0x551498['query'],_0x526d42['filters']));_0x2b9f01[_0xfec9('0x51')][_0xfec9('0x67')]=_0x41be8a['id'];if(_0x551498[_0xfec9('0x46')]['filter']){_0x2b9f01[_0xfec9('0x51')]=_[_0xfec9('0x54')](_0x2b9f01[_0xfec9('0x51')],{'$or':_[_0xfec9('0x42')](_0x2b9f01[_0xfec9('0x4a')],function(_0x48f5bd){var _0xd06c4d={};_0xd06c4d[_0x48f5bd]={'$like':'%'+_0x551498[_0xfec9('0x46')][_0xfec9('0x53')]+'%'};return _0xd06c4d;})});}_0x2b9f01=_[_0xfec9('0x54')]({},_0x2b9f01,_0x551498[_0xfec9('0x6e')]);return db[_0xfec9('0xa4')][_0xfec9('0x34')]({'where':_0x2b9f01[_0xfec9('0x51')]})[_0xfec9('0x24')](function(_0x31f49e){_0x3bf1a9[_0xfec9('0x34')]=_0x31f49e;if(_0x551498['query'][_0xfec9('0x5a')]){_0x2b9f01['include']=[{'model':db['CmContact'],'as':_0xfec9('0xbd'),'required':![]},{'model':db[_0xfec9('0xbe')],'as':_0xfec9('0xbf'),'attributes':[_0xfec9('0x3d'),_0xfec9('0xc0'),_0xfec9('0xc1')],'required':![]},{'model':db[_0xfec9('0xc2')],'as':_0xfec9('0xc3'),'attributes':['id','name',_0xfec9('0xc4')],'where':_0x551498[_0xfec9('0x46')][_0xfec9('0xc5')]?{'id':_0x551498['query'][_0xfec9('0xc5')]}:undefined,'required':_0x551498[_0xfec9('0x46')][_0xfec9('0xc5')]?!![]:![]}];}return db[_0xfec9('0xa4')][_0xfec9('0x56')](_0x2b9f01);})['then'](function(_0x5863dc){_0x3bf1a9[_0xfec9('0x57')]=_0x5863dc;return _0x3bf1a9;});}})[_0xfec9('0x24')](respondWithFilteredResult(_0x3163e1,_0x2b9f01))[_0xfec9('0x2d')](handleError(_0x3163e1,null));};exports[_0xfec9('0x3e')]=function(_0x42e94c,_0x753e5e,_0x37bca5){var _0x924f57,_0x512546,_0x140713;if(_['isNil'](_0x42e94c[_0xfec9('0x5d')]['body'])||_0x42e94c[_0xfec9('0x5d')][_0xfec9('0x5d')]===''){throw new db['Sequelize'][(_0xfec9('0x79'))](_0xfec9('0xc6'));}if(_[_0xfec9('0x99')](_0x42e94c['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xfec9('0xc7'));}_0x924f57=_0x42e94c['body']['to'];return db[_0xfec9('0x43')][_0xfec9('0x5b')]({'where':{'id':_0x42e94c[_0xfec9('0x64')]['id']},'include':[{'model':db[_0xfec9('0x9e')],'as':_0xfec9('0xc8'),'include':[{'model':db['CmContact'],'as':_0xfec9('0xa0'),'where':{'mobile':_0x924f57},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xfec9('0x24')](handleEntityNotFound(_0x753e5e,null))[_0xfec9('0x24')](function(_0x297e16){if(_0x297e16&&_0x297e16[_0xfec9('0xc8')]){_0x512546=_0x297e16[_0xfec9('0x60')]({'plain':!![]});if(_0x512546[_0xfec9('0xc8')]&&_0x512546[_0xfec9('0xc8')][_0xfec9('0xa0')]['length']){return _0x512546[_0xfec9('0xc8')][_0xfec9('0xa0')][0x0];}return db['CmContact'][_0xfec9('0x5c')](_[_0xfec9('0x1c')](_0x42e94c[_0xfec9('0x5d')],{'firstName':_0x924f57,'mobile':_0x924f57,'phone':_0x924f57,'ListId':_0x512546[_0xfec9('0x7e')]}));}})[_0xfec9('0x24')](handleEntityNotFound(_0x753e5e,null))[_0xfec9('0x24')](function(_0x1520a6){if(_0x1520a6){_0x140713=_0x1520a6;return db[_0xfec9('0xa4')]['find']({'where':{'ContactId':_0x140713['id'],'closed':![],'SmsAccountId':_0x512546['id']}})['then'](function(_0x11018e){if(_0x11018e){return[_0x11018e,![]];}return db[_0xfec9('0xa4')][_0xfec9('0x5c')]({'UserId':_0x42e94c['user']['id'],'ContactId':_0x140713['id'],'SmsAccountId':_0x512546['id'],'phone':_0x924f57,'firstMsgDirection':'out','Messages':[_[_0xfec9('0x54')](_0x42e94c[_0xfec9('0x5d')],{'read':![],'body':_0x42e94c[_0xfec9('0x5d')][_0xfec9('0x5d')],'phone':_0x924f57,'SmsAccountId':_0x512546['id'],'UserId':_0x42e94c[_0xfec9('0x5e')]['id'],'ContactId':_0x140713['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xfec9('0xc9')}]})[_0xfec9('0x24')](function(_0x21f542){return[_0x21f542,!![]];});});}})['spread'](function(_0x244807,_0x2b3413){if(_0x2b3413){return _0x244807;}return db[_0xfec9('0xca')][_0xfec9('0x5c')](_[_0xfec9('0x54')](_0x42e94c[_0xfec9('0x5d')],{'read':![],'body':_0x42e94c['body'][_0xfec9('0x5d')],'phone':_0x924f57,'SmsAccountId':_0x512546['id'],'SmsInteractionId':_0x244807['id'],'UserId':_0x42e94c['user']['id'],'ContactId':_0x140713['id']}))[_0xfec9('0x24')](function(_0x284728){_0x244807[_0xfec9('0xcb')][_0xfec9('0xc9')]=[];_0x244807[_0xfec9('0xcb')][_0xfec9('0xc9')][_0xfec9('0xa9')](_0x284728[_0xfec9('0xcb')]);return _0x244807;});})[_0xfec9('0x24')](respondWithResult(_0x753e5e,null))[_0xfec9('0x2d')](handleError(_0x753e5e,null));};exports[_0xfec9('0x2f')]=function(_0x207ed9,_0x5dc606,_0x32c71f){if(_0x207ed9[_0xfec9('0x5d')]['id']){delete _0x207ed9[_0xfec9('0x5d')]['id'];}var _0x324282,_0x19883c,_0x35ae6a;return db['SmsAccount']['find']({'where':{'id':_0x207ed9[_0xfec9('0x64')]['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x5dc606,null))[_0xfec9('0x24')](function(_0x469269){if(_0x469269){_0x35ae6a=_0x469269;logger[_0xfec9('0xb3')](_0xfec9('0x27'),'status','received\x20delivery\x20report\x20from',_0x469269[_0xfec9('0x80')],util['inspect'](_0x207ed9['body'],{'showHidden':![],'depth':null}));switch(_0x469269['type']){case _0xfec9('0x85'):if(_0x207ed9[_0xfec9('0x5d')][_0xfec9('0xcc')]&&_0x207ed9['body'][_0xfec9('0x2f')]){_0x19883c=_0x207ed9['body']['status'];return db['SmsMessage'][_0xfec9('0x5b')]({'where':{'messageId':_0x207ed9[_0xfec9('0x5d')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x207ed9[_0xfec9('0x5d')][_0xfec9('0xcd')]&&_0x207ed9['body'][_0xfec9('0xce')]){_0x19883c=_0x207ed9[_0xfec9('0x5d')][_0xfec9('0xce')];return db[_0xfec9('0xca')][_0xfec9('0x5b')]({'where':{'messageId':_0x207ed9['body'][_0xfec9('0xcd')]}});}break;case'clicksend':if(_0x207ed9[_0xfec9('0x5d')][_0xfec9('0x8b')]&&_0x207ed9['body'][_0xfec9('0xcf')]){_0x19883c=_0x207ed9['body'][_0xfec9('0xcf')];return db[_0xfec9('0xca')][_0xfec9('0x5b')]({'where':{'messageId':_0x207ed9[_0xfec9('0x5d')][_0xfec9('0x8b')]}});}break;case'infobip':var _0x538efe=_0x207ed9[_0xfec9('0x5d')]['results'][0x0];if(_0x538efe[_0xfec9('0x83')]&&_0x538efe['status'][_0xfec9('0xd0')]===_0xfec9('0xd1')){_0x19883c=_0x538efe[_0xfec9('0x2f')][_0xfec9('0xd0')];return db[_0xfec9('0xca')][_0xfec9('0x5b')]({'where':{'messageId':_0x538efe[_0xfec9('0x83')]}});}break;case _0xfec9('0x93'):if(_0x207ed9[_0xfec9('0x5d')][_0xfec9('0x83')]&&_0x207ed9['body'][_0xfec9('0x2f')]){_0x19883c=_0x207ed9['body'][_0xfec9('0x2f')];return db[_0xfec9('0xca')]['find']({'where':{'messageId':_0x207ed9['body'][_0xfec9('0x83')]}});}break;case'bandwidth':if(_0x207ed9['body'][0x0][_0xfec9('0x2c')]['id']){_0x19883c=_0x207ed9[_0xfec9('0x5d')][0x0]['type'];return db[_0xfec9('0xca')]['find']({'where':{'messageId':_0x207ed9[_0xfec9('0x5d')][0x0]['message']['id']}});}break;case _0xfec9('0x97'):if(_0x207ed9[_0xfec9('0x5d')][_0xfec9('0xd2')]&&_0x207ed9[_0xfec9('0x5d')][_0xfec9('0x2f')]){_0x19883c=_0x207ed9[_0xfec9('0x5d')]['status'];return db[_0xfec9('0xca')][_0xfec9('0x5b')]({'where':{'messageId':_0x207ed9[_0xfec9('0x5d')]['redif']}});}break;}}})[_0xfec9('0x24')](handleEntityNotFound(_0x5dc606,null))[_0xfec9('0x24')](function(_0x1c0536){if(_0x1c0536){_0x324282=_0x1c0536;switch(_0x35ae6a[_0xfec9('0x80')]){case'skebby':if(_0x19883c===_0xfec9('0xd1')){return _0x324282['update']({'read':!![]});}else{logger[_0xfec9('0x2a')](_0xfec9('0x27'),'status',_0xfec9('0x85'),util[_0xfec9('0xd3')](_0x207ed9[_0xfec9('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xfec9('0x88'):if(_0x19883c==='1'){return _0x324282[_0xfec9('0xd4')]({'read':!![]});}else{logger[_0xfec9('0x2a')](_0xfec9('0x27'),_0xfec9('0x2f'),'skebby',util[_0xfec9('0xd3')](_0x207ed9[_0xfec9('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xfec9('0x8a'):if(!_0x207ed9['body'][_0xfec9('0xd5')]&&_0x19883c>=0xc8&&_0x19883c<=0xce){return _0x324282['update']({'read':!![]});}else{logger[_0xfec9('0x2a')](_0xfec9('0x27'),_0xfec9('0x2f'),_0xfec9('0x8a'),util[_0xfec9('0xd3')](_0x207ed9[_0xfec9('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xfec9('0x8f'):var _0x5aebd8=_0x207ed9[_0xfec9('0x5d')][_0xfec9('0x90')][0x0];if(_0x5aebd8[_0xfec9('0x2f')]['groupName']===_0xfec9('0xd1')){return _0x324282[_0xfec9('0xd4')]({'read':!![]});}else{logger['error'](_0xfec9('0x27'),_0xfec9('0x2f'),_0xfec9('0x8f'),util[_0xfec9('0xd3')](_0x207ed9[_0xfec9('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xfec9('0x93'):if(_0x19883c=='DELIVERED_TO_GATEWAY'||_0x19883c==_0xfec9('0xd6')){return _0x324282[_0xfec9('0xd4')]({'read':!![]});}else{logger[_0xfec9('0x2a')](_0xfec9('0x27'),_0xfec9('0x2f'),_0xfec9('0x93'),util[_0xfec9('0xd3')](_0x207ed9[_0xfec9('0x5d')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x19883c==_0xfec9('0xd7')){return _0x324282['update']({'read':!![]});}else{logger[_0xfec9('0x2a')](_0xfec9('0x27'),_0xfec9('0x2f'),_0xfec9('0x96'),util['inspect'](_0x207ed9[_0xfec9('0x5d')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x19883c===_0xfec9('0xd8')||_0x19883c===_0xfec9('0xd9')){return _0x324282[_0xfec9('0xd4')]({'read':!![]});}else{logger[_0xfec9('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','intelepeer',util[_0xfec9('0xd3')](_0x207ed9[_0xfec9('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x324282;}})['then'](respondWithResult(_0x5dc606,null))[_0xfec9('0x2d')](handleError(_0x5dc606,null));};exports[_0xfec9('0xda')]=function(_0x4da312,_0x246bb4,_0x276792){var _0x15e518,_0x5de7e8,_0xb8669;return db['SmsAccount'][_0xfec9('0x5b')]({'where':{'id':_0x4da312['params']['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x246bb4,null))[_0xfec9('0x24')](function(_0x20b7f1){if(_0x20b7f1){_0xb8669=_0x20b7f1;logger['debug'](_0xfec9('0x27'),_0xfec9('0x2f'),_0xfec9('0xdb'),_0x20b7f1[_0xfec9('0x80')],util[_0xfec9('0xd3')](_0x4da312[_0xfec9('0x46')],{'showHidden':![],'depth':null}));switch(_0x20b7f1[_0xfec9('0x80')]){case _0xfec9('0x91'):if(_0x4da312['query'][_0xfec9('0xdc')]&&_0x4da312['query'][_0xfec9('0xdd')]){_0x5de7e8=_0x4da312[_0xfec9('0x46')][_0xfec9('0xdd')];return db[_0xfec9('0xca')][_0xfec9('0x5b')]({'where':{'messageId':_0x4da312[_0xfec9('0x46')][_0xfec9('0xdc')]}});}break;}}})[_0xfec9('0x24')](handleEntityNotFound(_0x246bb4,null))[_0xfec9('0x24')](function(_0x5d3342){if(_0x5d3342){_0x15e518=_0x5d3342;switch(_0xb8669[_0xfec9('0x80')]){case'csc':if(_0x5de7e8==='2'||_0x5de7e8==='6'){return _0x15e518[_0xfec9('0xd4')]({'read':!![]});}else{logger[_0xfec9('0x2a')](_0xfec9('0x27'),_0xfec9('0x2f'),'csc',util[_0xfec9('0xd3')](_0x4da312[_0xfec9('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x15e518;}})[_0xfec9('0x24')](respondWithResult(_0x246bb4,null))[_0xfec9('0x2d')](handleError(_0x246bb4,null));};exports[_0xfec9('0xde')]=function(_0xd59d96,_0x216e7f,_0x36b3ff){return db['SmsAccount'][_0xfec9('0x5b')]({'where':{'id':_0xd59d96[_0xfec9('0x64')]['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x216e7f,null))[_0xfec9('0x24')](function(_0x550300){if(_0x550300){return _0x550300[_0xfec9('0xde')](_0xd59d96[_0xfec9('0x5d')][_0xfec9('0x6b')],_[_0xfec9('0xa2')](_0xd59d96[_0xfec9('0x5d')],[_0xfec9('0x6b'),'id'])||{})[_0xfec9('0xa5')](function(_0x4c7a88){for(var _0x5d8fbb=0x0;_0x5d8fbb<_0xd59d96[_0xfec9('0x5d')]['ids'][_0xfec9('0x4c')];_0x5d8fbb+=0x1){socket[_0xfec9('0xdf')]('userSmsAccount:save',{'UserId':Number(_0xd59d96[_0xfec9('0x5d')]['ids'][_0x5d8fbb]),'SmsAccountId':Number(_0xd59d96[_0xfec9('0x64')]['id'])});}return _0x4c7a88;});}})[_0xfec9('0x24')](respondWithResult(_0x216e7f,null))[_0xfec9('0x2d')](handleError(_0x216e7f,null));};exports['removeAgents']=function(_0x3e196a,_0x4928a2,_0x3ebae7){return db[_0xfec9('0x43')][_0xfec9('0x5b')]({'where':{'id':_0x3e196a['params']['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x4928a2,null))[_0xfec9('0x24')](function(_0x4cdc61){if(_0x4cdc61){return _0x4cdc61['removeAgents'](_0x3e196a['query'][_0xfec9('0x6b')])['then'](function(){if(_[_0xfec9('0xe0')](_0x3e196a[_0xfec9('0x46')][_0xfec9('0x6b')])){for(var _0x153e73=0x0;_0x153e73<_0x3e196a[_0xfec9('0x46')][_0xfec9('0x6b')][_0xfec9('0x4c')];_0x153e73+=0x1){socket[_0xfec9('0xdf')](_0xfec9('0xe1'),{'UserId':Number(_0x3e196a[_0xfec9('0x46')][_0xfec9('0x6b')][_0x153e73]),'SmsAccountId':Number(_0x3e196a['params']['id'])});}}else{socket[_0xfec9('0xdf')](_0xfec9('0xe1'),{'UserId':Number(_0x3e196a[_0xfec9('0x46')][_0xfec9('0x6b')]),'SmsAccountId':Number(_0x3e196a['params']['id'])});}});}})[_0xfec9('0x24')](respondWithStatusCode(_0x4928a2,null))[_0xfec9('0x2d')](handleError(_0x4928a2,null));};exports[_0xfec9('0xe2')]=function(_0x1d0a4b,_0x198118,_0x5a9d27){var _0x5d699f={};var _0x54f29f={};var _0x51836e;var _0x390aa2;return db[_0xfec9('0x43')][_0xfec9('0xb7')]({'where':{'id':_0x1d0a4b[_0xfec9('0x64')]['id']}})[_0xfec9('0x24')](handleEntityNotFound(_0x198118,null))[_0xfec9('0x24')](function(_0x54eb0d){if(_0x54eb0d){_0x51836e=_0x54eb0d;_0x54f29f[_0xfec9('0x45')]=_[_0xfec9('0x47')](db[_0xfec9('0xbe')][_0xfec9('0x59')]);_0x54f29f[_0xfec9('0x46')]=_[_0xfec9('0x47')](_0x1d0a4b['query']);_0x54f29f['filters']=_[_0xfec9('0x49')](_0x54f29f[_0xfec9('0x45')],_0x54f29f[_0xfec9('0x46')]);_0x5d699f[_0xfec9('0x4a')]=_[_0xfec9('0x49')](_0x54f29f[_0xfec9('0x45')],qs['fields'](_0x1d0a4b['query'][_0xfec9('0x4b')]));_0x5d699f[_0xfec9('0x4a')]=_0x5d699f[_0xfec9('0x4a')][_0xfec9('0x4c')]?_0x5d699f[_0xfec9('0x4a')]:_0x54f29f[_0xfec9('0x45')];_0x5d699f[_0xfec9('0x4f')]=qs[_0xfec9('0x50')](_0x1d0a4b[_0xfec9('0x46')][_0xfec9('0x50')]);_0x5d699f[_0xfec9('0x51')]=qs[_0xfec9('0x48')](_[_0xfec9('0x52')](_0x1d0a4b[_0xfec9('0x46')],_0x54f29f['filters']));if(_0x1d0a4b[_0xfec9('0x46')][_0xfec9('0x53')]){_0x5d699f['where']=_[_0xfec9('0x54')](_0x5d699f[_0xfec9('0x51')],{'$or':_[_0xfec9('0x42')](_0x5d699f['attributes'],function(_0x25fb84){var _0x355e20={};_0x355e20[_0x25fb84]={'$like':'%'+_0x1d0a4b[_0xfec9('0x46')][_0xfec9('0x53')]+'%'};return _0x355e20;})});}_0x5d699f=_['merge']({},_0x5d699f,_0x1d0a4b['options']);return _0x51836e[_0xfec9('0xe2')](_0x5d699f);}})[_0xfec9('0x24')](function(_0x17f500){if(_0x17f500){_0x390aa2=_0x17f500['length'];if(!_0x1d0a4b[_0xfec9('0x46')][_0xfec9('0x4d')](_0xfec9('0x4e'))){_0x5d699f['limit']=qs[_0xfec9('0x33')](_0x1d0a4b['query'][_0xfec9('0x33')]);_0x5d699f[_0xfec9('0x31')]=qs[_0xfec9('0x31')](_0x1d0a4b['query']['offset']);}return _0x51836e[_0xfec9('0xe2')](_0x5d699f);}})[_0xfec9('0x24')](function(_0x40be26){if(_0x40be26){return _0x40be26?{'count':_0x390aa2,'rows':_0x40be26}:null;}})['then'](respondWithResult(_0x198118,null))[_0xfec9('0x2d')](handleError(_0x198118,null));}; \ No newline at end of file +var _0xa144=['getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','SmsAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','SmsAccount','includeAll','include','rows','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','length','sort','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','clicksend','message_id','plivo','Text','results','csc','originatingAddress','clickatell','fromNumber','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','Content-Type','text/xml','send','\x0a','addApplications','transaction','bulkCreate','priority','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','status_code','infobip','groupName','bandwidth','redif','error_code','DELIVERED','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','emit','removeAgents','isArray','userSmsAccount:remove'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xa144,0x1bf));var _0x4a14=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa144[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x4a14('0x0'));var rimraf=require(_0x4a14('0x1'));var zipdir=require(_0x4a14('0x2'));var jsonpatch=require(_0x4a14('0x3'));var rp=require(_0x4a14('0x4'));var moment=require('moment');var BPromise=require(_0x4a14('0x5'));var Mustache=require(_0x4a14('0x6'));var util=require(_0x4a14('0x7'));var path=require(_0x4a14('0x8'));var sox=require(_0x4a14('0x9'));var csv=require(_0x4a14('0xa'));var ejs=require(_0x4a14('0xb'));var fs=require('fs');var fs_extra=require(_0x4a14('0xc'));var _=require(_0x4a14('0xd'));var squel=require(_0x4a14('0xe'));var crypto=require('crypto');var jsforce=require(_0x4a14('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4a14('0xa'));var querystring=require('querystring');var Papa=require(_0x4a14('0x10'));var Redis=require('ioredis');var authService=require(_0x4a14('0x11'));var qs=require(_0x4a14('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a14('0x13'));var logger=require(_0x4a14('0x14'))(_0x4a14('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4a14('0x16'));var db=require(_0x4a14('0x17'))['db'];config[_0x4a14('0x18')]=_[_0x4a14('0x19')](config[_0x4a14('0x18')],{'host':_0x4a14('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a14('0x18')]));require('./smsAccount.socket')[_0x4a14('0x1b')](socket);var jayson=require(_0x4a14('0x1c'));var client=jayson[_0x4a14('0x1d')][_0x4a14('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x303a16,_0x4090a7,_0x1188cd,_0x32656a){return new BPromise(function(_0x50c0e6,_0x21fd7f){var _0x562777=_0x32656a||client;return _0x562777[_0x4a14('0x1f')](_0x303a16,_0x1188cd)[_0x4a14('0x20')](function(_0x49131f){logger[_0x4a14('0x21')](_0x4a14('0x22'),_0x4090a7,_0x4a14('0x23'));logger[_0x4a14('0x24')](_0x4a14('0x25'),_0x4090a7,_0x4a14('0x23'),JSON[_0x4a14('0x26')](_0x49131f));if(_0x49131f[_0x4a14('0x27')]){if(_0x49131f[_0x4a14('0x27')][_0x4a14('0x28')]===0x1f4){logger[_0x4a14('0x27')](_0x4a14('0x22'),_0x4090a7,_0x49131f[_0x4a14('0x27')]['message']);return _0x21fd7f(_0x49131f['error'][_0x4a14('0x29')]);}logger[_0x4a14('0x27')]('SmsAccount,\x20%s,\x20%s',_0x4090a7,_0x49131f['error'][_0x4a14('0x29')]);return _0x50c0e6(_0x49131f[_0x4a14('0x27')][_0x4a14('0x29')]);}else{logger[_0x4a14('0x21')]('SmsAccount,\x20%s,\x20%s',_0x4090a7,_0x4a14('0x23'));_0x50c0e6(_0x49131f['result'][_0x4a14('0x29')]);}})['catch'](function(_0x5b6bcb){logger[_0x4a14('0x27')](_0x4a14('0x22'),_0x4090a7,_0x5b6bcb);_0x21fd7f(_0x5b6bcb);});});}function respondWithStatusCode(_0x54fc86,_0x118dbd){_0x118dbd=_0x118dbd||0xcc;return function(_0x584457){if(_0x584457){return _0x54fc86[_0x4a14('0x2a')](_0x118dbd);}return _0x54fc86[_0x4a14('0x2b')](_0x118dbd)[_0x4a14('0x2c')]();};}function respondWithResult(_0x1dca0a,_0x3b92ea){_0x3b92ea=_0x3b92ea||0xc8;return function(_0x19c993){if(_0x19c993){return _0x1dca0a['status'](_0x3b92ea)[_0x4a14('0x2d')](_0x19c993);}};}function respondWithFilteredResult(_0x215268,_0xed62dd){return function(_0x5aa5b6){if(_0x5aa5b6){var _0x3d8f0d=typeof _0xed62dd[_0x4a14('0x2e')]===_0x4a14('0x2f')&&typeof _0xed62dd[_0x4a14('0x30')]===_0x4a14('0x2f');var _0x40239e=_0x5aa5b6[_0x4a14('0x31')];var _0x2294fa=_0x3d8f0d?0x0:_0xed62dd[_0x4a14('0x2e')];var _0x140efa=_0x3d8f0d?_0x5aa5b6[_0x4a14('0x31')]:_0xed62dd[_0x4a14('0x2e')]+_0xed62dd[_0x4a14('0x30')];var _0x15fbd5;if(_0x140efa>=_0x40239e){_0x140efa=_0x40239e;_0x15fbd5=0xc8;}else{_0x15fbd5=0xce;}_0x215268['status'](_0x15fbd5);return _0x215268['set']('Content-Range',_0x2294fa+'-'+_0x140efa+'/'+_0x40239e)['json'](_0x5aa5b6);}return null;};}function patchUpdates(_0x14a30a){return function(_0x424068){try{jsonpatch[_0x4a14('0x32')](_0x424068,_0x14a30a,!![]);}catch(_0x52b6c5){return BPromise[_0x4a14('0x33')](_0x52b6c5);}return _0x424068[_0x4a14('0x34')]();};}function saveUpdates(_0x3904c4,_0x4286c0){return function(_0x40ed09){if(_0x40ed09){return _0x40ed09[_0x4a14('0x35')](_0x3904c4)[_0x4a14('0x20')](function(_0x46cca9){return _0x46cca9;});}return null;};}function removeEntity(_0x4f1efe,_0x4b4aa6){return function(_0x1e7add){if(_0x1e7add){return _0x1e7add[_0x4a14('0x36')]()[_0x4a14('0x20')](function(){var _0x3dcc30=_0x1e7add['get']({'plain':!![]});var _0x8821bd=_0x4a14('0x37');return db[_0x4a14('0x38')][_0x4a14('0x36')]({'where':{'type':_0x8821bd,'resourceId':_0x3dcc30['id']}})[_0x4a14('0x20')](function(){return _0x1e7add;});})[_0x4a14('0x20')](function(){_0x4f1efe[_0x4a14('0x2b')](0xcc)[_0x4a14('0x2c')]();});}};}function handleEntityNotFound(_0x55858d,_0x2c5759){return function(_0x5938cf){if(!_0x5938cf){_0x55858d[_0x4a14('0x2a')](0x194);}return _0x5938cf;};}function handleError(_0x30b5ef,_0x293816){_0x293816=_0x293816||0x1f4;return function(_0x191f9e){logger[_0x4a14('0x27')](_0x191f9e['stack']);if(_0x191f9e[_0x4a14('0x39')]){delete _0x191f9e[_0x4a14('0x39')];}_0x30b5ef[_0x4a14('0x2b')](_0x293816)['send'](_0x191f9e);};}exports[_0x4a14('0x3a')]=function(_0x478a07,_0xadd059){var _0xfb70df={'include':[{'model':db[_0x4a14('0x3b')],'as':_0x4a14('0x3c')}]},_0x5ba385={},_0x41deef={'count':0x0,'rows':[]};var _0x31eaee=_[_0x4a14('0x3d')](db['SmsAccount'][_0x4a14('0x3e')],function(_0x109951){return{'name':_0x109951[_0x4a14('0x3f')],'type':_0x109951[_0x4a14('0x40')][_0x4a14('0x41')]};});_0x5ba385[_0x4a14('0x42')]=_[_0x4a14('0x3d')](_0x31eaee,'name');_0x5ba385[_0x4a14('0x43')]=_[_0x4a14('0x44')](_0x478a07[_0x4a14('0x43')]);_0x5ba385[_0x4a14('0x45')]=_[_0x4a14('0x46')](_0x5ba385['model'],_0x5ba385[_0x4a14('0x43')]);_0xfb70df[_0x4a14('0x47')]=_[_0x4a14('0x46')](_0x5ba385[_0x4a14('0x42')],qs[_0x4a14('0x48')](_0x478a07[_0x4a14('0x43')][_0x4a14('0x48')]));_0xfb70df[_0x4a14('0x47')]=_0xfb70df[_0x4a14('0x47')]['length']?_0xfb70df[_0x4a14('0x47')]:_0x5ba385[_0x4a14('0x42')];if(!_0x478a07[_0x4a14('0x43')][_0x4a14('0x49')](_0x4a14('0x4a'))){_0xfb70df[_0x4a14('0x30')]=qs['limit'](_0x478a07[_0x4a14('0x43')][_0x4a14('0x30')]);_0xfb70df[_0x4a14('0x2e')]=qs[_0x4a14('0x2e')](_0x478a07['query'][_0x4a14('0x2e')]);}_0xfb70df[_0x4a14('0x4b')]=qs['sort'](_0x478a07['query']['sort']);_0xfb70df[_0x4a14('0x4c')]=qs[_0x4a14('0x45')](_[_0x4a14('0x4d')](_0x478a07[_0x4a14('0x43')],_0x5ba385[_0x4a14('0x45')]),_0x31eaee);if(_0x478a07[_0x4a14('0x43')][_0x4a14('0x4e')]){_0xfb70df[_0x4a14('0x4c')]=_['merge'](_0xfb70df['where'],{'$or':_[_0x4a14('0x3d')](_0x31eaee,function(_0x51f078){if(_0x51f078['type']!==_0x4a14('0x4f')){var _0x335566={};_0x335566[_0x51f078[_0x4a14('0x39')]]={'$like':'%'+_0x478a07[_0x4a14('0x43')][_0x4a14('0x4e')]+'%'};return _0x335566;}})});}_0xfb70df=_[_0x4a14('0x50')]({},_0xfb70df,_0x478a07[_0x4a14('0x51')]);var _0x35a035={'where':_0xfb70df['where']};return db[_0x4a14('0x52')][_0x4a14('0x31')](_0x35a035)[_0x4a14('0x20')](function(_0x178355){_0x41deef[_0x4a14('0x31')]=_0x178355;if(_0x478a07['query'][_0x4a14('0x53')]){_0xfb70df[_0x4a14('0x54')]=[{'all':!![]}];}return db[_0x4a14('0x52')]['findAll'](_0xfb70df);})[_0x4a14('0x20')](function(_0x3468a5){_0x41deef[_0x4a14('0x55')]=_0x3468a5;return _0x41deef;})[_0x4a14('0x20')](respondWithFilteredResult(_0xadd059,_0xfb70df))[_0x4a14('0x56')](handleError(_0xadd059,null));};exports[_0x4a14('0x57')]=function(_0x27b739,_0x18b9ca){var _0x7a9790={'raw':![],'where':{'id':_0x27b739['params']['id']},'include':[{'model':db[_0x4a14('0x3b')],'as':_0x4a14('0x3c')}]},_0x5ccdea={};_0x5ccdea['model']=_[_0x4a14('0x44')](db[_0x4a14('0x52')]['rawAttributes']);_0x5ccdea[_0x4a14('0x43')]=_[_0x4a14('0x44')](_0x27b739[_0x4a14('0x43')]);_0x5ccdea[_0x4a14('0x45')]=_['intersection'](_0x5ccdea[_0x4a14('0x42')],_0x5ccdea[_0x4a14('0x43')]);_0x7a9790[_0x4a14('0x47')]=_[_0x4a14('0x46')](_0x5ccdea['model'],qs['fields'](_0x27b739[_0x4a14('0x43')][_0x4a14('0x48')]));_0x7a9790[_0x4a14('0x47')]=_0x7a9790[_0x4a14('0x47')]['length']?_0x7a9790[_0x4a14('0x47')]:_0x5ccdea[_0x4a14('0x42')];if(_0x27b739[_0x4a14('0x43')][_0x4a14('0x53')]){_0x7a9790[_0x4a14('0x54')]=[{'all':!![]}];}_0x7a9790=_[_0x4a14('0x50')]({},_0x7a9790,_0x27b739['options']);return db[_0x4a14('0x52')]['find'](_0x7a9790)[_0x4a14('0x20')](handleEntityNotFound(_0x18b9ca,null))[_0x4a14('0x20')](respondWithResult(_0x18b9ca,null))[_0x4a14('0x56')](handleError(_0x18b9ca,null));};exports[_0x4a14('0x58')]=function(_0x560208,_0x3afd4d){return db['SmsAccount']['create'](_0x560208[_0x4a14('0x59')],{})['then'](function(_0x417354){var _0x565130=_0x560208[_0x4a14('0x5a')][_0x4a14('0x5b')]({'plain':!![]});if(!_0x565130)throw new Error(_0x4a14('0x5c'));if(_0x565130[_0x4a14('0x5d')]==='user'){var _0x5e0509=_0x417354[_0x4a14('0x5b')]({'plain':!![]});var _0x5a7a18=_0x4a14('0x37');return db[_0x4a14('0x5e')][_0x4a14('0x5f')]({'where':{'name':_0x5a7a18,'userProfileId':_0x565130[_0x4a14('0x60')]},'raw':!![]})[_0x4a14('0x20')](function(_0x47e5b6){if(_0x47e5b6&&_0x47e5b6[_0x4a14('0x61')]===0x0){return db[_0x4a14('0x38')][_0x4a14('0x58')]({'name':_0x5e0509['name'],'resourceId':_0x5e0509['id'],'type':_0x47e5b6[_0x4a14('0x39')],'sectionId':_0x47e5b6['id']},{})[_0x4a14('0x20')](function(){return _0x417354;});}else{return _0x417354;}})[_0x4a14('0x56')](function(_0x2a256f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a256f);throw _0x2a256f;});}return _0x417354;})[_0x4a14('0x20')](respondWithResult(_0x3afd4d,0xc9))[_0x4a14('0x56')](handleError(_0x3afd4d,null));};exports[_0x4a14('0x35')]=function(_0x1617a7,_0x23e7e6){if(_0x1617a7['body']['id']){delete _0x1617a7['body']['id'];}return db['SmsAccount'][_0x4a14('0x5f')]({'where':{'id':_0x1617a7[_0x4a14('0x62')]['id']},'include':[{'model':db[_0x4a14('0x3b')],'as':_0x4a14('0x3c')}]})[_0x4a14('0x20')](handleEntityNotFound(_0x23e7e6,null))[_0x4a14('0x20')](saveUpdates(_0x1617a7[_0x4a14('0x59')],null))[_0x4a14('0x20')](respondWithResult(_0x23e7e6,null))[_0x4a14('0x56')](handleError(_0x23e7e6,null));};exports[_0x4a14('0x36')]=function(_0x517b66,_0x2181e0){return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x517b66[_0x4a14('0x62')]['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x2181e0,null))['then'](removeEntity(_0x2181e0,null))[_0x4a14('0x56')](handleError(_0x2181e0,null));};exports[_0x4a14('0x63')]=function(_0x2e867b,_0x2146fd){return db[_0x4a14('0x52')][_0x4a14('0x63')]()[_0x4a14('0x20')](respondWithResult(_0x2146fd,null))[_0x4a14('0x56')](handleError(_0x2146fd,null));};exports[_0x4a14('0x64')]=function(_0xe98619,_0xb0bd14,_0x1f11d5){if(_0xe98619['body']['id']){delete _0xe98619[_0x4a14('0x59')]['id'];}return db['SmsAccount'][_0x4a14('0x5f')]({'where':{'id':_0xe98619[_0x4a14('0x62')]['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0xb0bd14,null))[_0x4a14('0x20')](function(_0x2a5e82){if(_0x2a5e82){_0xe98619[_0x4a14('0x59')][_0x4a14('0x65')]=_0x2a5e82['id'];return db['Disposition'][_0x4a14('0x58')](_0xe98619['body']);}})[_0x4a14('0x20')](respondWithResult(_0xb0bd14,null))[_0x4a14('0x56')](handleError(_0xb0bd14,null));};exports[_0x4a14('0x66')]=function(_0x2fcf94,_0x4db2e3,_0xd0e3fd){var _0x42715e={'raw':![],'where':{}};var _0x10be8f={};var _0x318bfc={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4a14('0x67')]({'where':{'id':_0x2fcf94['params']['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x4db2e3,null))[_0x4a14('0x20')](function(_0x228390){if(_0x228390){_0x10be8f[_0x4a14('0x42')]=_[_0x4a14('0x44')](db[_0x4a14('0x68')][_0x4a14('0x3e')]);_0x10be8f[_0x4a14('0x43')]=_[_0x4a14('0x44')](_0x2fcf94[_0x4a14('0x43')]);_0x10be8f[_0x4a14('0x45')]=_[_0x4a14('0x46')](_0x10be8f[_0x4a14('0x42')],_0x10be8f[_0x4a14('0x43')]);_0x42715e[_0x4a14('0x47')]=_['intersection'](_0x10be8f[_0x4a14('0x42')],qs[_0x4a14('0x48')](_0x2fcf94[_0x4a14('0x43')][_0x4a14('0x48')]));_0x42715e[_0x4a14('0x47')]=_0x42715e[_0x4a14('0x47')][_0x4a14('0x69')]?_0x42715e[_0x4a14('0x47')]:_0x10be8f[_0x4a14('0x42')];if(!_0x2fcf94[_0x4a14('0x43')][_0x4a14('0x49')]('nolimit')){_0x42715e['limit']=qs[_0x4a14('0x30')](_0x2fcf94['query'][_0x4a14('0x30')]);_0x42715e[_0x4a14('0x2e')]=qs['offset'](_0x2fcf94[_0x4a14('0x43')]['offset']);}_0x42715e[_0x4a14('0x4b')]=qs[_0x4a14('0x6a')](_0x2fcf94['query'][_0x4a14('0x6a')]);_0x42715e['where']=qs['filters'](_['pick'](_0x2fcf94[_0x4a14('0x43')],_0x10be8f['filters']));_0x42715e[_0x4a14('0x4c')][_0x4a14('0x65')]=_0x228390['id'];if(_0x2fcf94[_0x4a14('0x43')][_0x4a14('0x4e')]){_0x42715e[_0x4a14('0x4c')]=_[_0x4a14('0x50')](_0x42715e[_0x4a14('0x4c')],{'$or':_['map'](_0x42715e[_0x4a14('0x47')],function(_0x28a7c3){var _0x38925f={};_0x38925f[_0x28a7c3]={'$like':'%'+_0x2fcf94[_0x4a14('0x43')]['filter']+'%'};return _0x38925f;})});}_0x42715e=_[_0x4a14('0x50')]({},_0x42715e,_0x2fcf94['options']);return db[_0x4a14('0x68')][_0x4a14('0x31')]({'where':_0x42715e['where']})[_0x4a14('0x20')](function(_0x532988){_0x318bfc[_0x4a14('0x31')]=_0x532988;if(_0x2fcf94[_0x4a14('0x43')][_0x4a14('0x53')]){_0x42715e[_0x4a14('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x4a14('0x6b')](_0x42715e);})['then'](function(_0xa22ddf){_0x318bfc['rows']=_0xa22ddf;return _0x318bfc;});}})['then'](respondWithFilteredResult(_0x4db2e3,_0x42715e))['catch'](handleError(_0x4db2e3,null));};exports[_0x4a14('0x6c')]=function(_0x41ab48,_0x485fe6,_0x3594be){return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x41ab48['params']['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x485fe6,null))[_0x4a14('0x20')](function(_0x531929){if(_0x531929){return _0x531929[_0x4a14('0x6c')](_0x41ab48[_0x4a14('0x43')][_0x4a14('0x6d')]);}})[_0x4a14('0x20')](respondWithStatusCode(_0x485fe6,null))[_0x4a14('0x56')](handleError(_0x485fe6,null));};exports[_0x4a14('0x6e')]=function(_0x266c69,_0xe1973a,_0x4ff112){if(_0x266c69[_0x4a14('0x59')]['id']){delete _0x266c69[_0x4a14('0x59')]['id'];}return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x266c69['params']['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0xe1973a,null))[_0x4a14('0x20')](function(_0x583ca4){if(_0x583ca4){_0x266c69[_0x4a14('0x59')][_0x4a14('0x65')]=_0x583ca4['id'];return db[_0x4a14('0x6f')][_0x4a14('0x58')](_0x266c69[_0x4a14('0x59')]);}})[_0x4a14('0x20')](respondWithResult(_0xe1973a,null))['catch'](handleError(_0xe1973a,null));};exports['getAnswers']=function(_0x45f8ab,_0x5ef2fb,_0x43b2de){var _0x1494ba={'raw':![],'where':{}};var _0x1ffee4={};var _0x346f4b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4a14('0x67')]({'where':{'id':_0x45f8ab[_0x4a14('0x62')]['id']}})['then'](handleEntityNotFound(_0x5ef2fb,null))[_0x4a14('0x20')](function(_0x3a6810){if(_0x3a6810){_0x1ffee4['model']=_[_0x4a14('0x44')](db[_0x4a14('0x6f')][_0x4a14('0x3e')]);_0x1ffee4[_0x4a14('0x43')]=_[_0x4a14('0x44')](_0x45f8ab[_0x4a14('0x43')]);_0x1ffee4['filters']=_['intersection'](_0x1ffee4['model'],_0x1ffee4[_0x4a14('0x43')]);_0x1494ba[_0x4a14('0x47')]=_['intersection'](_0x1ffee4[_0x4a14('0x42')],qs[_0x4a14('0x48')](_0x45f8ab[_0x4a14('0x43')]['fields']));_0x1494ba[_0x4a14('0x47')]=_0x1494ba[_0x4a14('0x47')][_0x4a14('0x69')]?_0x1494ba[_0x4a14('0x47')]:_0x1ffee4[_0x4a14('0x42')];if(!_0x45f8ab['query'][_0x4a14('0x49')](_0x4a14('0x4a'))){_0x1494ba[_0x4a14('0x30')]=qs[_0x4a14('0x30')](_0x45f8ab[_0x4a14('0x43')][_0x4a14('0x30')]);_0x1494ba[_0x4a14('0x2e')]=qs[_0x4a14('0x2e')](_0x45f8ab[_0x4a14('0x43')]['offset']);}_0x1494ba[_0x4a14('0x4b')]=qs[_0x4a14('0x6a')](_0x45f8ab[_0x4a14('0x43')][_0x4a14('0x6a')]);_0x1494ba[_0x4a14('0x4c')]=qs[_0x4a14('0x45')](_[_0x4a14('0x4d')](_0x45f8ab[_0x4a14('0x43')],_0x1ffee4['filters']));_0x1494ba[_0x4a14('0x4c')][_0x4a14('0x65')]=_0x3a6810['id'];if(_0x45f8ab[_0x4a14('0x43')][_0x4a14('0x4e')]){_0x1494ba[_0x4a14('0x4c')]=_[_0x4a14('0x50')](_0x1494ba[_0x4a14('0x4c')],{'$or':_[_0x4a14('0x3d')](_0x1494ba[_0x4a14('0x47')],function(_0x4c4943){var _0x29f1cf={};_0x29f1cf[_0x4c4943]={'$like':'%'+_0x45f8ab[_0x4a14('0x43')]['filter']+'%'};return _0x29f1cf;})});}_0x1494ba=_[_0x4a14('0x50')]({},_0x1494ba,_0x45f8ab[_0x4a14('0x51')]);return db[_0x4a14('0x6f')][_0x4a14('0x31')]({'where':_0x1494ba[_0x4a14('0x4c')]})['then'](function(_0x1315c9){_0x346f4b[_0x4a14('0x31')]=_0x1315c9;if(_0x45f8ab['query'][_0x4a14('0x53')]){_0x1494ba[_0x4a14('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4a14('0x6b')](_0x1494ba);})[_0x4a14('0x20')](function(_0x267717){_0x346f4b['rows']=_0x267717;return _0x346f4b;});}})[_0x4a14('0x20')](respondWithFilteredResult(_0x5ef2fb,_0x1494ba))[_0x4a14('0x56')](handleError(_0x5ef2fb,null));};exports[_0x4a14('0x70')]=function(_0x4a1225,_0x3830a1,_0xbcaa00){return db['SmsAccount'][_0x4a14('0x5f')]({'where':{'id':_0x4a1225[_0x4a14('0x62')]['id']}})['then'](handleEntityNotFound(_0x3830a1,null))[_0x4a14('0x20')](function(_0x2f0c99){if(_0x2f0c99){return _0x2f0c99['removeAnswers'](_0x4a1225['query'][_0x4a14('0x6d')]);}})[_0x4a14('0x20')](respondWithStatusCode(_0x3830a1,null))['catch'](handleError(_0x3830a1,null));};exports['notify']=function(_0x40a2e5,_0x9377e3,_0x10982a){var _0x5dea66={'channel':_0x4a14('0x71')};var _0x426120=[];var _0x1c527f=[];var _0x264c0c={};return db['SmsAccount']['find']({'where':{'id':_0x40a2e5[_0x4a14('0x62')]['id']},'include':[{'model':db[_0x4a14('0x72')],'as':_0x4a14('0x73')}]})[_0x4a14('0x20')](handleEntityNotFound(_0x9377e3,null))[_0x4a14('0x20')](function(_0x204aae){_0x5dea66[_0x4a14('0x74')]=_0x204aae;_0x5dea66[_0x4a14('0x75')]=_[_0x4a14('0x76')](_0x204aae['Applications'],['priority'],['asc']);if(_0x5dea66[_0x4a14('0x74')]['Applications']){delete _0x5dea66[_0x4a14('0x74')][_0x4a14('0x73')];}return db[_0x4a14('0x77')][_0x4a14('0x63')]();})['then'](function(_0x5ac232){if(!_0x5ac232){throw new db['Sequelize'][(_0x4a14('0x78'))](_0x4a14('0x79'));}_0x426120=_[_0x4a14('0x7a')](_[_0x4a14('0x44')](_0x5ac232),['createdAt',_0x4a14('0x7b')]);_0x1c527f=_[_0x4a14('0x7a')](_[_0x4a14('0x44')](_0x5ac232),[_0x4a14('0x7c'),_0x4a14('0x7b'),_0x4a14('0x7d'),_0x4a14('0x7e')]);_0x5dea66[_0x4a14('0x59')]={'mapKey':_0x4a14('0x7f')};if(_0x5dea66[_0x4a14('0x74')][_0x4a14('0x40')]){switch(_0x5dea66['account'][_0x4a14('0x40')]){case _0x4a14('0x80'):_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x82')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x83')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x85')];break;case'skebby':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')]='+'+_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x86')];_0x5dea66[_0x4a14('0x59')]['body']=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x87')];break;case'connectel':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x81')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x29')];break;case _0x4a14('0x88'):_0x5dea66['body'][_0x4a14('0x81')]=_0x40a2e5[_0x4a14('0x59')]['from'];_0x5dea66['body'][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x59')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x89')];break;case _0x4a14('0x8a'):_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')]=_0x40a2e5[_0x4a14('0x59')]['From'];_0x5dea66['body'][_0x4a14('0x59')]=_0x40a2e5['body'][_0x4a14('0x8b')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')]=_0x40a2e5[_0x4a14('0x59')]['MessageUUID'];break;case'infobip':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')]='+'+_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x8c')][0x0][_0x4a14('0x81')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')]=_0x40a2e5['body'][_0x4a14('0x8c')][0x0]['text'];_0x5dea66['body'][_0x4a14('0x84')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x8c')][0x0][_0x4a14('0x84')];break;case _0x4a14('0x8d'):_0x5dea66['body']['from']=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x8e')];_0x5dea66[_0x4a14('0x59')]['body']=_0x40a2e5[_0x4a14('0x59')]['segmentedMessage'][_0x4a14('0x29')];break;case _0x4a14('0x8f'):_0x5dea66[_0x4a14('0x59')]['from']=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x90')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x87')];_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')]=_0x40a2e5['body']['replyMessageId'];break;case'bandwidth':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')]=_0x40a2e5[_0x4a14('0x59')][0x0][_0x4a14('0x29')]['id'];_0x5dea66[_0x4a14('0x59')]['from']=_0x40a2e5[_0x4a14('0x59')][0x0]['message'][_0x4a14('0x81')];_0x5dea66['body'][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')][0x0][_0x4a14('0x29')][_0x4a14('0x87')];break;case _0x4a14('0x91'):_0x5dea66['body'][_0x4a14('0x81')]=_0x40a2e5['body'][_0x4a14('0x81')];_0x5dea66['body'][_0x4a14('0x59')]=_0x40a2e5[_0x4a14('0x59')]['message'];_0x5dea66[_0x4a14('0x59')]['messageId']=_0x40a2e5[_0x4a14('0x59')][_0x4a14('0x92')];break;}}if(_0x5dea66[_0x4a14('0x59')]['id']){delete _0x5dea66[_0x4a14('0x59')]['id'];}if(_[_0x4a14('0x93')](_0x5dea66['body'][_0x4a14('0x81')])){throw new db[(_0x4a14('0x94'))]['ValidationError'](_0x4a14('0x95'));}if(_[_0x4a14('0x93')](_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')])||_0x5dea66[_0x4a14('0x59')][_0x4a14('0x59')]===''){throw new db[(_0x4a14('0x94'))]['ValidationError'](_0x4a14('0x96'));}if(_[_0x4a14('0x93')](_0x5dea66[_0x4a14('0x59')]['mapKey'])){throw new db[(_0x4a14('0x94'))]['ValidationError'](_0x4a14('0x97')+_0x1c527f);}if(!_['includes'](_0x1c527f,_0x5dea66[_0x4a14('0x59')][_0x4a14('0x98')])){throw new db[(_0x4a14('0x94'))][(_0x4a14('0x78'))](_0x4a14('0x99')+_0x1c527f);}_0x264c0c[_0x5dea66[_0x4a14('0x59')][_0x4a14('0x98')]]=_0x5dea66['body']['from'];return db[_0x4a14('0x9a')][_0x4a14('0x5f')]({'where':{'id':_0x5dea66[_0x4a14('0x74')][_0x4a14('0x7e')]},'include':[{'model':db[_0x4a14('0x77')],'as':_0x4a14('0x9b'),'where':_0x264c0c,'limit':0x1,'order':[[_0x4a14('0x7b'),_0x4a14('0x9c')]]}]});})[_0x4a14('0x20')](handleEntityNotFound(_0x9377e3,null))[_0x4a14('0x20')](function(_0x128a21){if(_0x128a21){_0x5dea66['list']=_[_0x4a14('0x9d')](_0x128a21,[_0x4a14('0x9b')]);if(_0x128a21[_0x4a14('0x9b')]['length']){return _0x128a21[_0x4a14('0x9b')][0x0];}var _0x1028ed=_[_0x4a14('0x19')](_0x5dea66[_0x4a14('0x59')],{'firstName':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')],'ListId':_0x128a21['id']});_0x1028ed[_0x5dea66[_0x4a14('0x59')][_0x4a14('0x98')]]=_0x5dea66['body'][_0x4a14('0x81')];return db['CmContact'][_0x4a14('0x58')](_0x1028ed,{'fields':_0x426120,'raw':!![]});}})['then'](handleEntityNotFound(_0x9377e3,null))[_0x4a14('0x20')](function(_0x37c9ea){if(_0x37c9ea){_0x5dea66['contact']=_0x37c9ea;var _0x5d40a1={'ContactId':_0x37c9ea['id'],'phone':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')],'SmsAccountId':_0x40a2e5['params']['id']};var _0x559728={'ContactId':_0x37c9ea['id'],'SmsAccountId':_0x40a2e5['params']['id'],'closed':![]};return db[_0x4a14('0x9e')][_0x4a14('0x5f')]({'where':_0x559728})[_0x4a14('0x20')](function(_0x2b52b2){if(_0x2b52b2){return[_0x2b52b2,![]];}return db[_0x4a14('0x9e')]['create'](_0x5d40a1)[_0x4a14('0x20')](function(_0x345514){return[_0x345514,!![]];});});}})[_0x4a14('0x9f')](function(_0x425d8a,_0x46f051){_0x5dea66[_0x4a14('0xa0')]=_0x425d8a[_0x4a14('0x5b')]({'plain':!![]});_0x5dea66[_0x4a14('0xa0')][_0x4a14('0xa1')]=![];if(_0x46f051){if(_0x5dea66[_0x4a14('0x74')][_0x4a14('0xa2')]){_0x5dea66['applications'][_0x4a14('0xa3')]({'id':0x0,'priority':_0x5dea66[_0x4a14('0x75')][_0x4a14('0x69')]+0x1,'app':'close','appdata':_0x4a14('0xa4'),'interval':_0x4a14('0xa5')});}_0x5dea66[_0x4a14('0xa0')]['created']=!![];}return db[_0x4a14('0xa6')]['create']({'phone':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x81')],'messageId':_0x5dea66[_0x4a14('0x59')][_0x4a14('0x84')],'body':_0x5dea66[_0x4a14('0x59')]['body'],'SmsAccountId':_0x40a2e5[_0x4a14('0x62')]['id'],'SmsInteractionId':_0x425d8a['id'],'direction':'in','ContactId':_0x425d8a['ContactId'],'AttachmentId':_0x5dea66[_0x4a14('0x59')][_0x4a14('0xa7')]});})[_0x4a14('0x20')](function(_0x5be3bb){_0x5dea66[_0x4a14('0x29')]=_0x5be3bb;if(_0x5dea66[_0x4a14('0xa0')][_0x4a14('0xa8')]){return db[_0x4a14('0xa9')][_0x4a14('0x5f')]({'attributes':['id',_0x4a14('0x39')],'where':{'id':_0x5dea66[_0x4a14('0xa0')]['UserId']}})[_0x4a14('0x20')](function(_0x58357b){if(_0x58357b){_0x5dea66[_0x4a14('0x75')][_0x4a14('0xaa')]({'id':0x0,'priority':0x0,'app':_0x4a14('0xab'),'appdata':_0x58357b[_0x4a14('0x39')]+','+(_0x5dea66[_0x4a14('0x74')]['waitForTheAssignedAgent']||0xa),'interval':_0x4a14('0xa5')});}return respondWithRpcPromise(_0x4a14('0xac'),_0x4a14('0xad'),_0x5dea66);});}return respondWithRpcPromise(_0x4a14('0xac'),_0x4a14('0xad'),_0x5dea66);})[_0x4a14('0x20')](function(_0x19ac3a){if(_0x19ac3a){var _0x412b50=0xc8;var _0x182777=_0x4a14('0xae');logger[_0x4a14('0x21')](_0x4a14('0x25'),_0x182777,_0x412b50,'entity\x20found');logger[_0x4a14('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x182777,_0x412b50,'entity\x20found',JSON['stringify'](_0x19ac3a));if(_0x5dea66[_0x4a14('0x74')]['type']==='twilio'){return _0x9377e3[_0x4a14('0x2b')](_0x412b50)['set'](_0x4a14('0xaf'),_0x4a14('0xb0'))[_0x4a14('0xb1')](_0x4a14('0xb2'));}else{return _0x9377e3[_0x4a14('0x2b')](_0x412b50)['json'](_0x19ac3a);}}})['catch'](handleError(_0x9377e3,null));};exports[_0x4a14('0xb3')]=function(_0x5140d9,_0x416adc,_0x1683d2){return db[_0x4a14('0x52')][_0x4a14('0x67')]({'where':{'id':_0x5140d9[_0x4a14('0x62')]['id']}})['then'](handleEntityNotFound(_0x416adc,null))['then'](function(_0x478b6a){if(_0x478b6a){return db['sequelize'][_0x4a14('0xb4')](function(_0x20e16a){return db[_0x4a14('0x72')][_0x4a14('0x36')]({'where':{'SmsAccountId':_0x5140d9[_0x4a14('0x62')]['id']},'transaction':_0x20e16a})[_0x4a14('0x20')](function(_0x22552a){var _0x1e6dcd=_['map'](_0x5140d9[_0x4a14('0x59')],function(_0x156549){_0x156549[_0x4a14('0x65')]=_0x5140d9['params']['id'];return _0x156549;});return db[_0x4a14('0x72')][_0x4a14('0xb5')](_0x1e6dcd,{'transaction':_0x20e16a});});})[_0x4a14('0x20')](function(){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x5140d9[_0x4a14('0x62')]['id']},'order':_0x4a14('0xb6')});});}})[_0x4a14('0x20')](respondWithResult(_0x416adc,null))[_0x4a14('0x56')](handleError(_0x416adc,null));};exports[_0x4a14('0xb7')]=function(_0x206b88,_0x2f2960,_0x29be4d){var _0x480401={};var _0x33fcfb={};var _0x1b8419;var _0xa1907f;return db[_0x4a14('0x52')][_0x4a14('0x67')]({'where':{'id':_0x206b88[_0x4a14('0x62')]['id']}})['then'](handleEntityNotFound(_0x2f2960,null))[_0x4a14('0x20')](function(_0x3c6e0e){if(_0x3c6e0e){_0x1b8419=_0x3c6e0e;_0x33fcfb[_0x4a14('0x42')]=_[_0x4a14('0x44')](db['SmsApplication'][_0x4a14('0x3e')]);_0x33fcfb[_0x4a14('0x43')]=_['keys'](_0x206b88['query']);_0x33fcfb[_0x4a14('0x45')]=_[_0x4a14('0x46')](_0x33fcfb['model'],_0x33fcfb[_0x4a14('0x43')]);_0x480401['attributes']=_[_0x4a14('0x46')](_0x33fcfb['model'],qs['fields'](_0x206b88[_0x4a14('0x43')][_0x4a14('0x48')]));_0x480401['attributes']=_0x480401[_0x4a14('0x47')]['length']?_0x480401[_0x4a14('0x47')]:_0x33fcfb[_0x4a14('0x42')];_0x480401[_0x4a14('0x4b')]=qs[_0x4a14('0x6a')](_0x206b88[_0x4a14('0x43')][_0x4a14('0x6a')]);_0x480401[_0x4a14('0x4c')]=qs[_0x4a14('0x45')](_['pick'](_0x206b88[_0x4a14('0x43')],_0x33fcfb[_0x4a14('0x45')]));if(_0x206b88['query'][_0x4a14('0x4e')]){_0x480401[_0x4a14('0x4c')]=_[_0x4a14('0x50')](_0x480401[_0x4a14('0x4c')],{'$or':_[_0x4a14('0x3d')](_0x480401[_0x4a14('0x47')],function(_0xc696e2){var _0x2af42f={};_0x2af42f[_0xc696e2]={'$like':'%'+_0x206b88[_0x4a14('0x43')][_0x4a14('0x4e')]+'%'};return _0x2af42f;})});}_0x480401=_[_0x4a14('0x50')]({},_0x480401,_0x206b88[_0x4a14('0x51')]);return _0x1b8419[_0x4a14('0xb7')](_0x480401);}})[_0x4a14('0x20')](function(_0x14987f){if(_0x14987f){_0xa1907f=_0x14987f[_0x4a14('0x69')];if(!_0x206b88['query'][_0x4a14('0x49')](_0x4a14('0x4a'))){_0x480401[_0x4a14('0x30')]=qs[_0x4a14('0x30')](_0x206b88[_0x4a14('0x43')][_0x4a14('0x30')]);_0x480401['offset']=qs[_0x4a14('0x2e')](_0x206b88['query'][_0x4a14('0x2e')]);}return _0x1b8419[_0x4a14('0xb7')](_0x480401);}})['then'](function(_0x4d8348){if(_0x4d8348){return _0x4d8348?{'count':_0xa1907f,'rows':_0x4d8348}:null;}})[_0x4a14('0x20')](respondWithResult(_0x2f2960,null))[_0x4a14('0x56')](handleError(_0x2f2960,null));};exports[_0x4a14('0xb8')]=function(_0x3eeead,_0x4c1e70,_0x5ce8cf){var _0x4cfa2b={'raw':![],'where':{}};var _0x4cb708={};var _0x4f9f47={'count':0x0,'rows':[]};return db[_0x4a14('0x52')][_0x4a14('0x67')]({'where':{'id':_0x3eeead[_0x4a14('0x62')]['id']}})['then'](handleEntityNotFound(_0x4c1e70,null))[_0x4a14('0x20')](function(_0x53cad6){if(_0x53cad6){_0x4cb708[_0x4a14('0x42')]=_['keys'](db['SmsInteraction'][_0x4a14('0x3e')]);_0x4cb708['query']=_[_0x4a14('0x44')](_0x3eeead['query']);_0x4cb708['filters']=_[_0x4a14('0x46')](_0x4cb708[_0x4a14('0x42')],_0x4cb708['query']);_0x4cfa2b['attributes']=_[_0x4a14('0x46')](_0x4cb708[_0x4a14('0x42')],qs[_0x4a14('0x48')](_0x3eeead[_0x4a14('0x43')][_0x4a14('0x48')]));_0x4cfa2b[_0x4a14('0x47')]=_0x4cfa2b[_0x4a14('0x47')]['length']?_0x4cfa2b[_0x4a14('0x47')]:_0x4cb708['model'];if(!_0x3eeead[_0x4a14('0x43')]['hasOwnProperty']('nolimit')){_0x4cfa2b[_0x4a14('0x30')]=qs[_0x4a14('0x30')](_0x3eeead[_0x4a14('0x43')][_0x4a14('0x30')]);_0x4cfa2b['offset']=qs[_0x4a14('0x2e')](_0x3eeead[_0x4a14('0x43')][_0x4a14('0x2e')]);}_0x4cfa2b[_0x4a14('0x4b')]=qs['sort'](_0x3eeead[_0x4a14('0x43')][_0x4a14('0x6a')]);_0x4cfa2b[_0x4a14('0x4c')]=qs[_0x4a14('0x45')](_[_0x4a14('0x4d')](_0x3eeead['query'],_0x4cb708[_0x4a14('0x45')]));_0x4cfa2b[_0x4a14('0x4c')][_0x4a14('0x65')]=_0x53cad6['id'];if(_0x3eeead[_0x4a14('0x43')]['filter']){_0x4cfa2b['where']=_['merge'](_0x4cfa2b[_0x4a14('0x4c')],{'$or':_[_0x4a14('0x3d')](_0x4cfa2b[_0x4a14('0x47')],function(_0x342e47){var _0x245a88={};_0x245a88[_0x342e47]={'$like':'%'+_0x3eeead[_0x4a14('0x43')][_0x4a14('0x4e')]+'%'};return _0x245a88;})});}_0x4cfa2b=_[_0x4a14('0x50')]({},_0x4cfa2b,_0x3eeead[_0x4a14('0x51')]);return db[_0x4a14('0x9e')][_0x4a14('0x31')]({'where':_0x4cfa2b[_0x4a14('0x4c')]})[_0x4a14('0x20')](function(_0x1d13c2){_0x4f9f47[_0x4a14('0x31')]=_0x1d13c2;if(_0x3eeead[_0x4a14('0x43')][_0x4a14('0x53')]){_0x4cfa2b['include']=[{'model':db[_0x4a14('0x77')],'as':_0x4a14('0xb9'),'required':![]},{'model':db[_0x4a14('0xa9')],'as':_0x4a14('0xba'),'attributes':[_0x4a14('0x39'),_0x4a14('0xbb'),'internal'],'required':![]},{'model':db[_0x4a14('0xbc')],'as':_0x4a14('0xbd'),'attributes':['id',_0x4a14('0x39'),_0x4a14('0xbe')],'where':_0x3eeead[_0x4a14('0x43')][_0x4a14('0xbf')]?{'id':_0x3eeead[_0x4a14('0x43')][_0x4a14('0xbf')]}:undefined,'required':_0x3eeead[_0x4a14('0x43')]['tag']?!![]:![]}];}return db[_0x4a14('0x9e')][_0x4a14('0x6b')](_0x4cfa2b);})[_0x4a14('0x20')](function(_0x3a6658){_0x4f9f47['rows']=_0x3a6658;return _0x4f9f47;});}})['then'](respondWithFilteredResult(_0x4c1e70,_0x4cfa2b))[_0x4a14('0x56')](handleError(_0x4c1e70,null));};exports[_0x4a14('0xb1')]=function(_0x1f6adf,_0x2580a6,_0x11fbce){var _0x137a8f,_0x2a0b57,_0x166b57;if(_['isNil'](_0x1f6adf[_0x4a14('0x59')][_0x4a14('0x59')])||_0x1f6adf[_0x4a14('0x59')]['body']===''){throw new db[(_0x4a14('0x94'))][(_0x4a14('0x78'))](_0x4a14('0x96'));}if(_[_0x4a14('0x93')](_0x1f6adf['body']['to'])){throw new db[(_0x4a14('0x94'))]['ValidationError'](_0x4a14('0xc0'));}_0x137a8f=_0x1f6adf[_0x4a14('0x59')]['to'];return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x1f6adf['params']['id']},'include':[{'model':db[_0x4a14('0x9a')],'as':_0x4a14('0xc1'),'include':[{'model':db[_0x4a14('0x77')],'as':_0x4a14('0x9b'),'where':{'mobile':_0x137a8f},'limit':0x1,'order':[[_0x4a14('0x7b'),'DESC']]}]}]})[_0x4a14('0x20')](handleEntityNotFound(_0x2580a6,null))[_0x4a14('0x20')](function(_0x13adea){if(_0x13adea&&_0x13adea[_0x4a14('0xc1')]){_0x2a0b57=_0x13adea['get']({'plain':!![]});if(_0x2a0b57[_0x4a14('0xc1')]&&_0x2a0b57[_0x4a14('0xc1')][_0x4a14('0x9b')][_0x4a14('0x69')]){return _0x2a0b57[_0x4a14('0xc1')][_0x4a14('0x9b')][0x0];}return db[_0x4a14('0x77')]['create'](_[_0x4a14('0x19')](_0x1f6adf[_0x4a14('0x59')],{'firstName':_0x137a8f,'mobile':_0x137a8f,'phone':_0x137a8f,'ListId':_0x2a0b57['ListId']}));}})[_0x4a14('0x20')](handleEntityNotFound(_0x2580a6,null))['then'](function(_0x158b7a){if(_0x158b7a){_0x166b57=_0x158b7a;return db[_0x4a14('0x9e')][_0x4a14('0x5f')]({'where':{'ContactId':_0x166b57['id'],'closed':![],'SmsAccountId':_0x2a0b57['id']}})[_0x4a14('0x20')](function(_0xc5edbe){if(_0xc5edbe){return[_0xc5edbe,![]];}return db[_0x4a14('0x9e')][_0x4a14('0x58')]({'UserId':_0x1f6adf[_0x4a14('0x5a')]['id'],'ContactId':_0x166b57['id'],'SmsAccountId':_0x2a0b57['id'],'phone':_0x137a8f,'firstMsgDirection':_0x4a14('0xc2'),'Messages':[_[_0x4a14('0x50')](_0x1f6adf[_0x4a14('0x59')],{'read':![],'body':_0x1f6adf[_0x4a14('0x59')][_0x4a14('0x59')],'phone':_0x137a8f,'SmsAccountId':_0x2a0b57['id'],'UserId':_0x1f6adf['user']['id'],'ContactId':_0x166b57['id']})]},{'include':[{'model':db[_0x4a14('0xa6')],'as':_0x4a14('0xc3')}]})[_0x4a14('0x20')](function(_0xe219c0){return[_0xe219c0,!![]];});});}})[_0x4a14('0x9f')](function(_0x51dc08,_0x1cfb63){if(_0x1cfb63){return _0x51dc08;}return db['SmsMessage']['create'](_[_0x4a14('0x50')](_0x1f6adf[_0x4a14('0x59')],{'read':![],'body':_0x1f6adf[_0x4a14('0x59')]['body'],'phone':_0x137a8f,'SmsAccountId':_0x2a0b57['id'],'SmsInteractionId':_0x51dc08['id'],'UserId':_0x1f6adf[_0x4a14('0x5a')]['id'],'ContactId':_0x166b57['id']}))[_0x4a14('0x20')](function(_0xa603f5){_0x51dc08[_0x4a14('0xc4')][_0x4a14('0xc3')]=[];_0x51dc08[_0x4a14('0xc4')][_0x4a14('0xc3')][_0x4a14('0xa3')](_0xa603f5['dataValues']);return _0x51dc08;});})['then'](respondWithResult(_0x2580a6,null))[_0x4a14('0x56')](handleError(_0x2580a6,null));};exports[_0x4a14('0x2b')]=function(_0x59238e,_0x108ba6,_0x19a6d0){if(_0x59238e[_0x4a14('0x59')]['id']){delete _0x59238e[_0x4a14('0x59')]['id'];}var _0x2541be,_0x568db3,_0x3644c0;return db[_0x4a14('0x52')]['find']({'where':{'id':_0x59238e['params']['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x108ba6,null))[_0x4a14('0x20')](function(_0x14bed9){if(_0x14bed9){_0x3644c0=_0x14bed9;logger[_0x4a14('0x24')](_0x4a14('0x25'),'status','received\x20delivery\x20report\x20from',_0x14bed9[_0x4a14('0x40')],util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));switch(_0x14bed9[_0x4a14('0x40')]){case _0x4a14('0xc6'):if(_0x59238e[_0x4a14('0x59')][_0x4a14('0xc7')]&&_0x59238e[_0x4a14('0x59')][_0x4a14('0x2b')]){_0x568db3=_0x59238e[_0x4a14('0x59')][_0x4a14('0x2b')];return db['SmsMessage'][_0x4a14('0x5f')]({'where':{'messageId':_0x59238e[_0x4a14('0x59')][_0x4a14('0xc7')]}});}break;case _0x4a14('0xc8'):if(_0x59238e[_0x4a14('0x59')][_0x4a14('0xc9')]&&_0x59238e['body'][_0x4a14('0xca')]){_0x568db3=_0x59238e[_0x4a14('0x59')][_0x4a14('0xca')];return db[_0x4a14('0xa6')][_0x4a14('0x5f')]({'where':{'messageId':_0x59238e[_0x4a14('0x59')][_0x4a14('0xc9')]}});}break;case _0x4a14('0x88'):if(_0x59238e['body'][_0x4a14('0x89')]&&_0x59238e[_0x4a14('0x59')]['status_code']){_0x568db3=_0x59238e['body'][_0x4a14('0xcb')];return db[_0x4a14('0xa6')]['find']({'where':{'messageId':_0x59238e['body'][_0x4a14('0x89')]}});}break;case _0x4a14('0xcc'):var _0x94458d=_0x59238e[_0x4a14('0x59')]['results'][0x0];if(_0x94458d[_0x4a14('0x84')]&&_0x94458d[_0x4a14('0x2b')][_0x4a14('0xcd')]==='DELIVERED'){_0x568db3=_0x94458d[_0x4a14('0x2b')][_0x4a14('0xcd')];return db[_0x4a14('0xa6')][_0x4a14('0x5f')]({'where':{'messageId':_0x94458d[_0x4a14('0x84')]}});}break;case _0x4a14('0x8f'):if(_0x59238e[_0x4a14('0x59')][_0x4a14('0x84')]&&_0x59238e[_0x4a14('0x59')][_0x4a14('0x2b')]){_0x568db3=_0x59238e[_0x4a14('0x59')][_0x4a14('0x2b')];return db[_0x4a14('0xa6')]['find']({'where':{'messageId':_0x59238e[_0x4a14('0x59')][_0x4a14('0x84')]}});}break;case _0x4a14('0xce'):if(_0x59238e[_0x4a14('0x59')][0x0][_0x4a14('0x29')]['id']){_0x568db3=_0x59238e[_0x4a14('0x59')][0x0][_0x4a14('0x40')];return db[_0x4a14('0xa6')][_0x4a14('0x5f')]({'where':{'messageId':_0x59238e['body'][0x0][_0x4a14('0x29')]['id']}});}break;case _0x4a14('0x91'):if(_0x59238e['body'][_0x4a14('0xcf')]&&_0x59238e[_0x4a14('0x59')]['status']){_0x568db3=_0x59238e[_0x4a14('0x59')][_0x4a14('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x59238e[_0x4a14('0x59')][_0x4a14('0xcf')]}});}break;}}})[_0x4a14('0x20')](handleEntityNotFound(_0x108ba6,null))[_0x4a14('0x20')](function(_0x27dbdc){if(_0x27dbdc){_0x2541be=_0x27dbdc;switch(_0x3644c0[_0x4a14('0x40')]){case _0x4a14('0xc6'):if(_0x568db3==='DELIVERED'){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0xc6'),util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4a14('0xc8'):if(_0x568db3==='1'){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),'status',_0x4a14('0xc6'),util[_0x4a14('0xc5')](_0x59238e['body'],{'showHidden':![],'depth':null}));}break;case _0x4a14('0x88'):if(!_0x59238e[_0x4a14('0x59')][_0x4a14('0xd0')]&&_0x568db3>=0xc8&&_0x568db3<=0xce){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0x88'),util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4a14('0xcc'):var _0x3f14d8=_0x59238e['body'][_0x4a14('0x8c')][0x0];if(_0x3f14d8[_0x4a14('0x2b')][_0x4a14('0xcd')]===_0x4a14('0xd1')){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger['error'](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0xcc'),util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4a14('0x8f'):if(_0x568db3=='DELIVERED_TO_GATEWAY'||_0x568db3==_0x4a14('0xd2')){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0x8f'),util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4a14('0xce'):if(_0x568db3==_0x4a14('0xd3')){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0xce'),util['inspect'](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x568db3===_0x4a14('0xd4')||_0x568db3===_0x4a14('0xd5')){return _0x2541be[_0x4a14('0x35')]({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),'status',_0x4a14('0x91'),util[_0x4a14('0xc5')](_0x59238e[_0x4a14('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2541be;}})[_0x4a14('0x20')](respondWithResult(_0x108ba6,null))[_0x4a14('0x56')](handleError(_0x108ba6,null));};exports[_0x4a14('0xd6')]=function(_0x1a0e3b,_0x565b8d,_0x37b15a){var _0x49a48f,_0x3c99d6,_0x2e6917;return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x1a0e3b[_0x4a14('0x62')]['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x565b8d,null))[_0x4a14('0x20')](function(_0x4db77b){if(_0x4db77b){_0x2e6917=_0x4db77b;logger[_0x4a14('0x24')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0xd7'),_0x4db77b[_0x4a14('0x40')],util[_0x4a14('0xc5')](_0x1a0e3b[_0x4a14('0x43')],{'showHidden':![],'depth':null}));switch(_0x4db77b[_0x4a14('0x40')]){case _0x4a14('0x8d'):if(_0x1a0e3b[_0x4a14('0x43')][_0x4a14('0xd8')]&&_0x1a0e3b[_0x4a14('0x43')][_0x4a14('0xd9')]){_0x3c99d6=_0x1a0e3b[_0x4a14('0x43')][_0x4a14('0xd9')];return db['SmsMessage'][_0x4a14('0x5f')]({'where':{'messageId':_0x1a0e3b[_0x4a14('0x43')]['message-id']}});}break;}}})[_0x4a14('0x20')](handleEntityNotFound(_0x565b8d,null))[_0x4a14('0x20')](function(_0x4b8cd9){if(_0x4b8cd9){_0x49a48f=_0x4b8cd9;switch(_0x2e6917[_0x4a14('0x40')]){case _0x4a14('0x8d'):if(_0x3c99d6==='2'||_0x3c99d6==='6'){return _0x49a48f['update']({'read':!![]});}else{logger[_0x4a14('0x27')](_0x4a14('0x25'),_0x4a14('0x2b'),_0x4a14('0x8d'),util[_0x4a14('0xc5')](_0x1a0e3b[_0x4a14('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x49a48f;}})['then'](respondWithResult(_0x565b8d,null))['catch'](handleError(_0x565b8d,null));};exports['addAgents']=function(_0x3bd855,_0x1414a9,_0x44d068){return db[_0x4a14('0x52')]['find']({'where':{'id':_0x3bd855[_0x4a14('0x62')]['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x1414a9,null))[_0x4a14('0x20')](function(_0x3a8d3b){if(_0x3a8d3b){return _0x3a8d3b['addAgents'](_0x3bd855[_0x4a14('0x59')][_0x4a14('0x6d')],_[_0x4a14('0x9d')](_0x3bd855[_0x4a14('0x59')],[_0x4a14('0x6d'),'id'])||{})[_0x4a14('0x9f')](function(_0xee5b1){for(var _0x261030=0x0;_0x261030<_0x3bd855['body'][_0x4a14('0x6d')][_0x4a14('0x69')];_0x261030+=0x1){socket[_0x4a14('0xda')]('userSmsAccount:save',{'UserId':Number(_0x3bd855[_0x4a14('0x59')]['ids'][_0x261030]),'SmsAccountId':Number(_0x3bd855[_0x4a14('0x62')]['id'])});}return _0xee5b1;});}})['then'](respondWithResult(_0x1414a9,null))[_0x4a14('0x56')](handleError(_0x1414a9,null));};exports['removeAgents']=function(_0x33d40b,_0x4f1de0,_0xae1904){return db[_0x4a14('0x52')][_0x4a14('0x5f')]({'where':{'id':_0x33d40b['params']['id']}})['then'](handleEntityNotFound(_0x4f1de0,null))[_0x4a14('0x20')](function(_0x48403e){if(_0x48403e){return _0x48403e[_0x4a14('0xdb')](_0x33d40b[_0x4a14('0x43')]['ids'])[_0x4a14('0x20')](function(){if(_[_0x4a14('0xdc')](_0x33d40b[_0x4a14('0x43')][_0x4a14('0x6d')])){for(var _0x3107ad=0x0;_0x3107ad<_0x33d40b['query'][_0x4a14('0x6d')][_0x4a14('0x69')];_0x3107ad+=0x1){socket[_0x4a14('0xda')](_0x4a14('0xdd'),{'UserId':Number(_0x33d40b[_0x4a14('0x43')][_0x4a14('0x6d')][_0x3107ad]),'SmsAccountId':Number(_0x33d40b[_0x4a14('0x62')]['id'])});}}else{socket[_0x4a14('0xda')](_0x4a14('0xdd'),{'UserId':Number(_0x33d40b[_0x4a14('0x43')][_0x4a14('0x6d')]),'SmsAccountId':Number(_0x33d40b[_0x4a14('0x62')]['id'])});}});}})[_0x4a14('0x20')](respondWithStatusCode(_0x4f1de0,null))[_0x4a14('0x56')](handleError(_0x4f1de0,null));};exports['getAgents']=function(_0x5ee949,_0x3695b7,_0x504c93){var _0x5aeb50={};var _0x236c9b={};var _0x48940a;var _0x2492a8;return db[_0x4a14('0x52')][_0x4a14('0x67')]({'where':{'id':_0x5ee949[_0x4a14('0x62')]['id']}})[_0x4a14('0x20')](handleEntityNotFound(_0x3695b7,null))['then'](function(_0x1eab40){if(_0x1eab40){_0x48940a=_0x1eab40;_0x236c9b['model']=_[_0x4a14('0x44')](db[_0x4a14('0xa9')][_0x4a14('0x3e')]);_0x236c9b[_0x4a14('0x43')]=_[_0x4a14('0x44')](_0x5ee949[_0x4a14('0x43')]);_0x236c9b['filters']=_[_0x4a14('0x46')](_0x236c9b[_0x4a14('0x42')],_0x236c9b[_0x4a14('0x43')]);_0x5aeb50[_0x4a14('0x47')]=_[_0x4a14('0x46')](_0x236c9b['model'],qs['fields'](_0x5ee949[_0x4a14('0x43')][_0x4a14('0x48')]));_0x5aeb50[_0x4a14('0x47')]=_0x5aeb50[_0x4a14('0x47')][_0x4a14('0x69')]?_0x5aeb50[_0x4a14('0x47')]:_0x236c9b[_0x4a14('0x42')];_0x5aeb50['order']=qs[_0x4a14('0x6a')](_0x5ee949[_0x4a14('0x43')][_0x4a14('0x6a')]);_0x5aeb50[_0x4a14('0x4c')]=qs['filters'](_[_0x4a14('0x4d')](_0x5ee949[_0x4a14('0x43')],_0x236c9b[_0x4a14('0x45')]));if(_0x5ee949[_0x4a14('0x43')][_0x4a14('0x4e')]){_0x5aeb50['where']=_[_0x4a14('0x50')](_0x5aeb50[_0x4a14('0x4c')],{'$or':_['map'](_0x5aeb50['attributes'],function(_0x4221df){var _0xedfc8f={};_0xedfc8f[_0x4221df]={'$like':'%'+_0x5ee949[_0x4a14('0x43')][_0x4a14('0x4e')]+'%'};return _0xedfc8f;})});}_0x5aeb50=_[_0x4a14('0x50')]({},_0x5aeb50,_0x5ee949['options']);return _0x48940a['getAgents'](_0x5aeb50);}})[_0x4a14('0x20')](function(_0x353b4d){if(_0x353b4d){_0x2492a8=_0x353b4d[_0x4a14('0x69')];if(!_0x5ee949[_0x4a14('0x43')][_0x4a14('0x49')](_0x4a14('0x4a'))){_0x5aeb50['limit']=qs[_0x4a14('0x30')](_0x5ee949[_0x4a14('0x43')][_0x4a14('0x30')]);_0x5aeb50[_0x4a14('0x2e')]=qs['offset'](_0x5ee949['query']['offset']);}return _0x48940a[_0x4a14('0xde')](_0x5aeb50);}})[_0x4a14('0x20')](function(_0x27d546){if(_0x27d546){return _0x27d546?{'count':_0x2492a8,'rows':_0x27d546}:null;}})[_0x4a14('0x20')](respondWithResult(_0x3695b7,null))[_0x4a14('0x56')](handleError(_0x3695b7,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index e508eaf..cc8d5e7 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 _0xebde=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x7b0861,_0x1f9f63){var _0xd09e1d=function(_0x124f17){while(--_0x124f17){_0x7b0861['push'](_0x7b0861['shift']());}};_0xd09e1d(++_0x1f9f63);}(_0xebde,0x1d3));var _0xeebd=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0xebde[_0x81dcac];return _0xc7803b;};'use strict';var EventEmitter=require(_0xeebd('0x0'));var SmsAccount=require(_0xeebd('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xeebd('0x2')](0x0);var events={'afterCreate':_0xeebd('0x3'),'afterUpdate':_0xeebd('0x4'),'afterDestroy':_0xeebd('0x5')};function emitEvent(_0x59a8d1){return function(_0x5f3ac3,_0x510d05,_0x4f5bc3){SmsAccountEvents[_0xeebd('0x6')](_0x59a8d1+':'+_0x5f3ac3['id'],_0x5f3ac3);SmsAccountEvents[_0xeebd('0x6')](_0x59a8d1,_0x5f3ac3);_0x4f5bc3(null);};}for(var e in events){if(events[_0xeebd('0x7')](e)){var event=events[e];SmsAccount[_0xeebd('0x8')](e,emitEvent(event));}}module[_0xeebd('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x7b97=['emit','hasOwnProperty','setMaxListeners','update'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7b97,0x126));var _0x77b9=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x7b97[_0x72a33d];return _0x2621d5;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x77b9('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x77b9('0x1'),'afterDestroy':'remove'};function emitEvent(_0x6c661b){return function(_0x384627,_0x2a3c77,_0x4151b7){SmsAccountEvents[_0x77b9('0x2')](_0x6c661b+':'+_0x384627['id'],_0x384627);SmsAccountEvents[_0x77b9('0x2')](_0x6c661b,_0x384627);_0x4151b7(null);};}for(var e in events){if(events[_0x77b9('0x3')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 27c580c..be5d9ab 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 _0x53b9=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x53b9,0x77));var _0x953b=function(_0x509f92,_0x528dbb){_0x509f92=_0x509f92-0x0;var _0x3c3676=_0x53b9[_0x509f92];return _0x3c3676;};'use strict';var _=require(_0x953b('0x0'));var util=require(_0x953b('0x1'));var logger=require(_0x953b('0x2'))(_0x953b('0x3'));var moment=require(_0x953b('0x4'));var BPromise=require(_0x953b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x953b('0x6'));var rimraf=require('rimraf');var config=require(_0x953b('0x7'));var attributes=require(_0x953b('0x8'));module['exports']=function(_0x4da1a8,_0x3fa9be){return _0x4da1a8[_0x953b('0x9')](_0x953b('0xa'),attributes,{'tableName':_0x953b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e07=['moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger'];(function(_0x452820,_0x476b44){var _0x33015c=function(_0x1938c5){while(--_0x1938c5){_0x452820['push'](_0x452820['shift']());}};_0x33015c(++_0x476b44);}(_0x9e07,0xb1));var _0x79e0=function(_0x446230,_0x4be1d3){_0x446230=_0x446230-0x0;var _0xba9a89=_0x9e07[_0x446230];return _0xba9a89;};'use strict';var _=require(_0x79e0('0x0'));var util=require(_0x79e0('0x1'));var logger=require(_0x79e0('0x2'))('api');var moment=require(_0x79e0('0x3'));var BPromise=require(_0x79e0('0x4'));var rp=require(_0x79e0('0x5'));var fs=require('fs');var path=require(_0x79e0('0x6'));var rimraf=require('rimraf');var config=require(_0x79e0('0x7'));var attributes=require(_0x79e0('0x8'));module[_0x79e0('0x9')]=function(_0x5437ba,_0x1c6735){return _0x5437ba[_0x79e0('0xa')](_0x79e0('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 269ed4a..16eec22 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 _0x2a85=['rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','then','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x2d87a0,_0x4dc38a){var _0x2bfafc=function(_0x4588c3){while(--_0x4588c3){_0x2d87a0['push'](_0x2d87a0['shift']());}};_0x2bfafc(++_0x4dc38a);}(_0x2a85,0xa9));var _0x52a8=function(_0x59ef5e,_0x34be25){_0x59ef5e=_0x59ef5e-0x0;var _0xe7004d=_0x2a85[_0x59ef5e];return _0xe7004d;};'use strict';var _=require('lodash');var util=require(_0x52a8('0x0'));var moment=require(_0x52a8('0x1'));var BPromise=require(_0x52a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x52a8('0x4'));var logger=require(_0x52a8('0x5'))(_0x52a8('0x6'));var config=require('../../config/environment');var jayson=require(_0x52a8('0x7'));var client=jayson['client'][_0x52a8('0x8')]({'port':0x232a});config[_0x52a8('0x9')]=_['defaults'](config[_0x52a8('0x9')],{'host':_0x52a8('0xa'),'port':0x18eb});var socket=require(_0x52a8('0xb'))(new Redis(config[_0x52a8('0x9')]));require(_0x52a8('0xc'))[_0x52a8('0xd')](socket);function respondWithRpcPromise(_0x4ac8ce,_0x3f6688,_0x1981b6){return new BPromise(function(_0x21c961,_0x2fb547){return client[_0x52a8('0xe')](_0x4ac8ce,_0x1981b6)['then'](function(_0xb93790){logger[_0x52a8('0xf')](_0x52a8('0x10'),_0x3f6688,'request\x20sent');logger[_0x52a8('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3f6688,_0x52a8('0x12'),JSON[_0x52a8('0x13')](_0xb93790));if(_0xb93790[_0x52a8('0x14')]){if(_0xb93790[_0x52a8('0x14')]['code']===0x1f4){logger['error'](_0x52a8('0x10'),_0x3f6688,_0xb93790[_0x52a8('0x14')]['message']);return _0x2fb547(_0xb93790['error'][_0x52a8('0x15')]);}logger[_0x52a8('0x14')](_0x52a8('0x10'),_0x3f6688,_0xb93790[_0x52a8('0x14')][_0x52a8('0x15')]);return _0x21c961(_0xb93790[_0x52a8('0x14')]['message']);}else{logger[_0x52a8('0xf')](_0x52a8('0x10'),_0x3f6688,'request\x20sent');_0x21c961(_0xb93790[_0x52a8('0x16')][_0x52a8('0x15')]);}})[_0x52a8('0x17')](function(_0x51fd68){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3f6688,_0x51fd68);_0x2fb547(_0x51fd68);});});}exports[_0x52a8('0x18')]=function(_0x2324b6){var _0x2244d7=this;return new Promise(function(_0x47a0f7,_0x3c4f61){return db[_0x52a8('0x19')][_0x52a8('0x1a')]({'raw':_0x2324b6['options']?_0x2324b6[_0x52a8('0x1b')][_0x52a8('0x1c')]===undefined?!![]:![]:!![],'where':_0x2324b6[_0x52a8('0x1b')]?_0x2324b6['options'][_0x52a8('0x1d')]||null:null,'attributes':_0x2324b6[_0x52a8('0x1b')]?_0x2324b6[_0x52a8('0x1b')][_0x52a8('0x1e')]||null:null,'include':_0x2324b6[_0x52a8('0x1b')]?_0x2324b6['options'][_0x52a8('0x1f')]?_[_0x52a8('0x20')](_0x2324b6[_0x52a8('0x1b')][_0x52a8('0x1f')],function(_0x4a666d){return{'model':db[_0x4a666d['model']],'as':_0x4a666d['as'],'attributes':_0x4a666d[_0x52a8('0x1e')],'include':_0x4a666d[_0x52a8('0x1f')]?_[_0x52a8('0x20')](_0x4a666d[_0x52a8('0x1f')],function(_0x346506){return{'model':db[_0x346506[_0x52a8('0x21')]],'as':_0x346506['as'],'attributes':_0x346506['attributes'],'include':_0x346506[_0x52a8('0x1f')]?_[_0x52a8('0x20')](_0x346506[_0x52a8('0x1f')],function(_0x57a94c){return{'model':db[_0x57a94c[_0x52a8('0x21')]],'as':_0x57a94c['as'],'attributes':_0x57a94c[_0x52a8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x52a8('0x22')](function(_0x53e1c4){logger[_0x52a8('0xf')](_0x52a8('0x18'),_0x2324b6);logger[_0x52a8('0x11')]('ShowSmsAccount',_0x2324b6,JSON['stringify'](_0x53e1c4));_0x47a0f7(_0x53e1c4);})[_0x52a8('0x17')](function(_0x2b6e22){logger[_0x52a8('0x14')](_0x52a8('0x18'),_0x2b6e22[_0x52a8('0x15')],_0x2324b6);_0x3c4f61(_0x2244d7[_0x52a8('0x14')](0x1f4,_0x2b6e22[_0x52a8('0x15')]));});});}; \ No newline at end of file +var _0x85a2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','map','include','model','lodash','util','moment'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0x85a2,0x135));var _0x285a=function(_0x1dc591,_0x22643a){_0x1dc591=_0x1dc591-0x0;var _0x2d107b=_0x85a2[_0x1dc591];return _0x2d107b;};'use strict';var _=require(_0x285a('0x0'));var util=require(_0x285a('0x1'));var moment=require(_0x285a('0x2'));var BPromise=require(_0x285a('0x3'));var rs=require(_0x285a('0x4'));var fs=require('fs');var Redis=require(_0x285a('0x5'));var db=require(_0x285a('0x6'))['db'];var utils=require(_0x285a('0x7'));var logger=require(_0x285a('0x8'))('rpc');var config=require(_0x285a('0x9'));var jayson=require(_0x285a('0xa'));var client=jayson[_0x285a('0xb')][_0x285a('0xc')]({'port':0x232a});config[_0x285a('0xd')]=_[_0x285a('0xe')](config['redis'],{'host':_0x285a('0xf'),'port':0x18eb});var socket=require(_0x285a('0x10'))(new Redis(config[_0x285a('0xd')]));require(_0x285a('0x11'))['register'](socket);function respondWithRpcPromise(_0x309ffa,_0x54aee4,_0x86ceda){return new BPromise(function(_0xc26fcc,_0x1d524b){return client[_0x285a('0x12')](_0x309ffa,_0x86ceda)[_0x285a('0x13')](function(_0x1315e2){logger[_0x285a('0x14')](_0x285a('0x15'),_0x54aee4,_0x285a('0x16'));logger[_0x285a('0x17')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x54aee4,_0x285a('0x16'),JSON[_0x285a('0x18')](_0x1315e2));if(_0x1315e2[_0x285a('0x19')]){if(_0x1315e2['error'][_0x285a('0x1a')]===0x1f4){logger[_0x285a('0x19')](_0x285a('0x15'),_0x54aee4,_0x1315e2[_0x285a('0x19')]['message']);return _0x1d524b(_0x1315e2[_0x285a('0x19')]['message']);}logger[_0x285a('0x19')](_0x285a('0x15'),_0x54aee4,_0x1315e2[_0x285a('0x19')][_0x285a('0x1b')]);return _0xc26fcc(_0x1315e2[_0x285a('0x19')][_0x285a('0x1b')]);}else{logger[_0x285a('0x14')](_0x285a('0x15'),_0x54aee4,_0x285a('0x16'));_0xc26fcc(_0x1315e2[_0x285a('0x1c')][_0x285a('0x1b')]);}})[_0x285a('0x1d')](function(_0x271918){logger[_0x285a('0x19')]('SmsAccount,\x20%s,\x20%s',_0x54aee4,_0x271918);_0x1d524b(_0x271918);});});}exports[_0x285a('0x1e')]=function(_0x5ee20d){var _0x4fec04=this;return new Promise(function(_0x327de5,_0x3bf6a9){return db[_0x285a('0x1f')][_0x285a('0x20')]({'raw':_0x5ee20d[_0x285a('0x21')]?_0x5ee20d[_0x285a('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x5ee20d[_0x285a('0x21')]?_0x5ee20d[_0x285a('0x21')][_0x285a('0x22')]||null:null,'attributes':_0x5ee20d[_0x285a('0x21')]?_0x5ee20d[_0x285a('0x21')][_0x285a('0x23')]||null:null,'include':_0x5ee20d[_0x285a('0x21')]?_0x5ee20d[_0x285a('0x21')]['include']?_[_0x285a('0x24')](_0x5ee20d[_0x285a('0x21')][_0x285a('0x25')],function(_0x34cdc4){return{'model':db[_0x34cdc4[_0x285a('0x26')]],'as':_0x34cdc4['as'],'attributes':_0x34cdc4[_0x285a('0x23')],'include':_0x34cdc4[_0x285a('0x25')]?_[_0x285a('0x24')](_0x34cdc4[_0x285a('0x25')],function(_0x21c2b3){return{'model':db[_0x21c2b3['model']],'as':_0x21c2b3['as'],'attributes':_0x21c2b3[_0x285a('0x23')],'include':_0x21c2b3[_0x285a('0x25')]?_[_0x285a('0x24')](_0x21c2b3[_0x285a('0x25')],function(_0x1771ab){return{'model':db[_0x1771ab[_0x285a('0x26')]],'as':_0x1771ab['as'],'attributes':_0x1771ab[_0x285a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x546c4a){logger[_0x285a('0x14')](_0x285a('0x1e'),_0x5ee20d);logger[_0x285a('0x17')](_0x285a('0x1e'),_0x5ee20d,JSON[_0x285a('0x18')](_0x546c4a));_0x327de5(_0x546c4a);})[_0x285a('0x1d')](function(_0x2c4043){logger[_0x285a('0x19')]('ShowSmsAccount',_0x2c4043[_0x285a('0x1b')],_0x5ee20d);_0x3bf6a9(_0x4fec04['error'](0x1f4,_0x2c4043['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index ac4d0f2..92e385b 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 2a4d6b6..09cbf82 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x14e97c,_0x217512){var _0x4579ea=function(_0x557b28){while(--_0x557b28){_0x14e97c['push'](_0x14e97c['shift']());}};_0x4579ea(++_0x217512);}(_0x008c,0x188));var _0xc008=function(_0xd75d34,_0x2d31c6){_0xd75d34=_0xd75d34-0x0;var _0x8c5975=_0x008c[_0xd75d34];return _0x8c5975;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x15a819,_0x19d3b3){var _0x36a82f=function(_0x1c8c70){while(--_0x1c8c70){_0x15a819['push'](_0x15a819['shift']());}};_0x36a82f(++_0x19d3b3);}(_0x008c,0x188));var _0xc008=function(_0x241f06,_0x3c7ef8){_0x241f06=_0x241f06-0x0;var _0x2ec3a1=_0x008c[_0x241f06];return _0x2ec3a1;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 1fa21b1..9bc9e5d 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 _0x6883=['noop','*,*,*,*','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6883,0xd4));var _0x3688=function(_0x23dae3,_0x31b249){_0x23dae3=_0x23dae3-0x0;var _0x598774=_0x6883[_0x23dae3];return _0x598774;};'use strict';var Sequelize=require(_0x3688('0x0'));module[_0x3688('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3688('0x2')],'allowNull':![],'defaultValue':_0x3688('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3688('0x2')]},'interval':{'type':Sequelize[_0x3688('0x2')],'defaultValue':_0x3688('0x4')}}; \ No newline at end of file +var _0x06e8=['TEXT','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x06e8,0xf2));var _0x806e=function(_0x37f243,_0x115537){_0x37f243=_0x37f243-0x0;var _0x5e3bf1=_0x06e8[_0x37f243];return _0x5e3bf1;};'use strict';var Sequelize=require(_0x806e('0x0'));module[_0x806e('0x1')]={'priority':{'type':Sequelize[_0x806e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x806e('0x3')},'appdata':{'type':Sequelize[_0x806e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x806e('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6f51a2b..b207e6b 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 _0x3c0a=['send','index','map','SmsApplication','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','then','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','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','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','reject','save','update','end','sendStatus','error','name'];(function(_0xca4c4d,_0x20a804){var _0x1a6973=function(_0x1826bc){while(--_0x1826bc){_0xca4c4d['push'](_0xca4c4d['shift']());}};_0x1a6973(++_0x20a804);}(_0x3c0a,0x112));var _0xa3c0=function(_0x308e8b,_0x2cf6d2){_0x308e8b=_0x308e8b-0x0;var _0x1e0fbc=_0x3c0a[_0x308e8b];return _0x1e0fbc;};'use strict';var emlformat=require(_0xa3c0('0x0'));var rimraf=require(_0xa3c0('0x1'));var zipdir=require(_0xa3c0('0x2'));var jsonpatch=require(_0xa3c0('0x3'));var rp=require(_0xa3c0('0x4'));var moment=require(_0xa3c0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa3c0('0x6'));var sox=require(_0xa3c0('0x7'));var csv=require('to-csv');var ejs=require(_0xa3c0('0x8'));var fs=require('fs');var fs_extra=require(_0xa3c0('0x9'));var _=require(_0xa3c0('0xa'));var squel=require(_0xa3c0('0xb'));var crypto=require(_0xa3c0('0xc'));var jsforce=require(_0xa3c0('0xd'));var deskjs=require(_0xa3c0('0xe'));var toCsv=require(_0xa3c0('0xf'));var querystring=require(_0xa3c0('0x10'));var Papa=require(_0xa3c0('0x11'));var Redis=require(_0xa3c0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa3c0('0x13'));var as=require(_0xa3c0('0x14'));var hardwareService=require(_0xa3c0('0x15'));var logger=require(_0xa3c0('0x16'))(_0xa3c0('0x17'));var utils=require(_0xa3c0('0x18'));var config=require(_0xa3c0('0x19'));var licenseUtil=require(_0xa3c0('0x1a'));var db=require(_0xa3c0('0x1b'))['db'];function respondWithStatusCode(_0x6cbc3,_0x24bc1d){_0x24bc1d=_0x24bc1d||0xcc;return function(_0x3feb05){if(_0x3feb05){return _0x6cbc3['sendStatus'](_0x24bc1d);}return _0x6cbc3[_0xa3c0('0x1c')](_0x24bc1d)['end']();};}function respondWithResult(_0x4b7647,_0x55b197){_0x55b197=_0x55b197||0xc8;return function(_0x3ceacb){if(_0x3ceacb){return _0x4b7647['status'](_0x55b197)[_0xa3c0('0x1d')](_0x3ceacb);}};}function respondWithFilteredResult(_0x3c0d29,_0x5dde15){return function(_0x5089a7){if(_0x5089a7){var _0x3bad71=typeof _0x5dde15[_0xa3c0('0x1e')]===_0xa3c0('0x1f')&&typeof _0x5dde15[_0xa3c0('0x20')]===_0xa3c0('0x1f');var _0x6d0422=_0x5089a7[_0xa3c0('0x21')];var _0x545311=_0x3bad71?0x0:_0x5dde15[_0xa3c0('0x1e')];var _0x208a21=_0x3bad71?_0x5089a7[_0xa3c0('0x21')]:_0x5dde15['offset']+_0x5dde15[_0xa3c0('0x20')];var _0x169786;if(_0x208a21>=_0x6d0422){_0x208a21=_0x6d0422;_0x169786=0xc8;}else{_0x169786=0xce;}_0x3c0d29[_0xa3c0('0x1c')](_0x169786);return _0x3c0d29[_0xa3c0('0x22')]('Content-Range',_0x545311+'-'+_0x208a21+'/'+_0x6d0422)[_0xa3c0('0x1d')](_0x5089a7);}return null;};}function patchUpdates(_0x18c9fe){return function(_0x264d4d){try{jsonpatch['apply'](_0x264d4d,_0x18c9fe,!![]);}catch(_0x5398e2){return BPromise[_0xa3c0('0x23')](_0x5398e2);}return _0x264d4d[_0xa3c0('0x24')]();};}function saveUpdates(_0x18721e,_0x1d0e20){return function(_0x46f4b1){if(_0x46f4b1){return _0x46f4b1[_0xa3c0('0x25')](_0x18721e)['then'](function(_0xfe095d){return _0xfe095d;});}return null;};}function removeEntity(_0x1bf0a4,_0x133e3e){return function(_0x5eda70){if(_0x5eda70){return _0x5eda70['destroy']()['then'](function(){_0x1bf0a4['status'](0xcc)[_0xa3c0('0x26')]();});}};}function handleEntityNotFound(_0x39f7a9,_0x2addc4){return function(_0xba1dfc){if(!_0xba1dfc){_0x39f7a9[_0xa3c0('0x27')](0x194);}return _0xba1dfc;};}function handleError(_0x5606ed,_0x583d4f){_0x583d4f=_0x583d4f||0x1f4;return function(_0x2f3281){logger[_0xa3c0('0x28')](_0x2f3281['stack']);if(_0x2f3281[_0xa3c0('0x29')]){delete _0x2f3281[_0xa3c0('0x29')];}_0x5606ed[_0xa3c0('0x1c')](_0x583d4f)[_0xa3c0('0x2a')](_0x2f3281);};}exports[_0xa3c0('0x2b')]=function(_0x1475f3,_0x217610){var _0x5aff47={},_0xa69d4={},_0x39ebde={'count':0x0,'rows':[]};var _0x404762=_[_0xa3c0('0x2c')](db[_0xa3c0('0x2d')]['rawAttributes'],function(_0x3407c2){return{'name':_0x3407c2[_0xa3c0('0x2e')],'type':_0x3407c2[_0xa3c0('0x2f')][_0xa3c0('0x30')]};});_0xa69d4['model']=_[_0xa3c0('0x2c')](_0x404762,_0xa3c0('0x29'));_0xa69d4['query']=_[_0xa3c0('0x31')](_0x1475f3[_0xa3c0('0x32')]);_0xa69d4['filters']=_[_0xa3c0('0x33')](_0xa69d4[_0xa3c0('0x34')],_0xa69d4[_0xa3c0('0x32')]);_0x5aff47[_0xa3c0('0x35')]=_[_0xa3c0('0x33')](_0xa69d4[_0xa3c0('0x34')],qs[_0xa3c0('0x36')](_0x1475f3[_0xa3c0('0x32')][_0xa3c0('0x36')]));_0x5aff47['attributes']=_0x5aff47[_0xa3c0('0x35')][_0xa3c0('0x37')]?_0x5aff47[_0xa3c0('0x35')]:_0xa69d4['model'];if(!_0x1475f3[_0xa3c0('0x32')][_0xa3c0('0x38')](_0xa3c0('0x39'))){_0x5aff47[_0xa3c0('0x20')]=qs[_0xa3c0('0x20')](_0x1475f3[_0xa3c0('0x32')][_0xa3c0('0x20')]);_0x5aff47['offset']=qs['offset'](_0x1475f3['query'][_0xa3c0('0x1e')]);}_0x5aff47[_0xa3c0('0x3a')]=qs[_0xa3c0('0x3b')](_0x1475f3[_0xa3c0('0x32')][_0xa3c0('0x3b')]);_0x5aff47[_0xa3c0('0x3c')]=qs['filters'](_[_0xa3c0('0x3d')](_0x1475f3[_0xa3c0('0x32')],_0xa69d4[_0xa3c0('0x3e')]),_0x404762);if(_0x1475f3['query'][_0xa3c0('0x3f')]){_0x5aff47[_0xa3c0('0x3c')]=_[_0xa3c0('0x40')](_0x5aff47[_0xa3c0('0x3c')],{'$or':_[_0xa3c0('0x2c')](_0x404762,function(_0x29bc05){if(_0x29bc05['type']!==_0xa3c0('0x41')){var _0x594fb5={};_0x594fb5[_0x29bc05[_0xa3c0('0x29')]]={'$like':'%'+_0x1475f3[_0xa3c0('0x32')][_0xa3c0('0x3f')]+'%'};return _0x594fb5;}})});}_0x5aff47=_[_0xa3c0('0x40')]({},_0x5aff47,_0x1475f3['options']);var _0x10f731={'where':_0x5aff47['where']};return db[_0xa3c0('0x2d')][_0xa3c0('0x21')](_0x10f731)[_0xa3c0('0x42')](function(_0x281241){_0x39ebde['count']=_0x281241;if(_0x1475f3['query']['includeAll']){_0x5aff47[_0xa3c0('0x43')]=[{'all':!![]}];}return db['SmsApplication'][_0xa3c0('0x44')](_0x5aff47);})[_0xa3c0('0x42')](function(_0x3d8106){_0x39ebde[_0xa3c0('0x45')]=_0x3d8106;return _0x39ebde;})[_0xa3c0('0x42')](respondWithFilteredResult(_0x217610,_0x5aff47))[_0xa3c0('0x46')](handleError(_0x217610,null));};exports[_0xa3c0('0x47')]=function(_0xcd4eae,_0xc07adf){var _0xac1107={'raw':!![],'where':{'id':_0xcd4eae[_0xa3c0('0x48')]['id']}},_0x1bd8ff={};_0x1bd8ff['model']=_[_0xa3c0('0x31')](db['SmsApplication'][_0xa3c0('0x49')]);_0x1bd8ff[_0xa3c0('0x32')]=_[_0xa3c0('0x31')](_0xcd4eae['query']);_0x1bd8ff[_0xa3c0('0x3e')]=_['intersection'](_0x1bd8ff[_0xa3c0('0x34')],_0x1bd8ff[_0xa3c0('0x32')]);_0xac1107[_0xa3c0('0x35')]=_[_0xa3c0('0x33')](_0x1bd8ff[_0xa3c0('0x34')],qs[_0xa3c0('0x36')](_0xcd4eae[_0xa3c0('0x32')][_0xa3c0('0x36')]));_0xac1107[_0xa3c0('0x35')]=_0xac1107[_0xa3c0('0x35')][_0xa3c0('0x37')]?_0xac1107['attributes']:_0x1bd8ff[_0xa3c0('0x34')];if(_0xcd4eae[_0xa3c0('0x32')][_0xa3c0('0x4a')]){_0xac1107['include']=[{'all':!![]}];}_0xac1107=_[_0xa3c0('0x40')]({},_0xac1107,_0xcd4eae[_0xa3c0('0x4b')]);return db[_0xa3c0('0x2d')]['find'](_0xac1107)[_0xa3c0('0x42')](handleEntityNotFound(_0xc07adf,null))[_0xa3c0('0x42')](respondWithResult(_0xc07adf,null))['catch'](handleError(_0xc07adf,null));};exports[_0xa3c0('0x4c')]=function(_0x132275,_0x550810){return db[_0xa3c0('0x2d')][_0xa3c0('0x4c')](_0x132275[_0xa3c0('0x4d')],{})['then'](respondWithResult(_0x550810,0xc9))['catch'](handleError(_0x550810,null));};exports['update']=function(_0x59f498,_0x5777a6){if(_0x59f498[_0xa3c0('0x4d')]['id']){delete _0x59f498[_0xa3c0('0x4d')]['id'];}return db['SmsApplication'][_0xa3c0('0x4e')]({'where':{'id':_0x59f498['params']['id']}})['then'](handleEntityNotFound(_0x5777a6,null))[_0xa3c0('0x42')](saveUpdates(_0x59f498[_0xa3c0('0x4d')],null))[_0xa3c0('0x42')](respondWithResult(_0x5777a6,null))['catch'](handleError(_0x5777a6,null));};exports['destroy']=function(_0x5e83a2,_0x1e4802){return db[_0xa3c0('0x2d')][_0xa3c0('0x4e')]({'where':{'id':_0x5e83a2[_0xa3c0('0x48')]['id']}})[_0xa3c0('0x42')](handleEntityNotFound(_0x1e4802,null))['then'](removeEntity(_0x1e4802,null))['catch'](handleError(_0x1e4802,null));}; \ No newline at end of file +var _0xa28b=['send','map','SmsApplication','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','length','include','find','catch','create','body','update','params','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','then','destroy','error','stack','name'];(function(_0x17f85a,_0x12c0c3){var _0x4330c8=function(_0x19cafc){while(--_0x19cafc){_0x17f85a['push'](_0x17f85a['shift']());}};_0x4330c8(++_0x12c0c3);}(_0xa28b,0xab));var _0xba28=function(_0x4a89fb,_0x5a108a){_0x4a89fb=_0x4a89fb-0x0;var _0x265d0b=_0xa28b[_0x4a89fb];return _0x265d0b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba28('0x0'));var zipdir=require(_0xba28('0x1'));var jsonpatch=require(_0xba28('0x2'));var rp=require('request-promise');var moment=require(_0xba28('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xba28('0x4'));var csv=require(_0xba28('0x5'));var ejs=require(_0xba28('0x6'));var fs=require('fs');var fs_extra=require(_0xba28('0x7'));var _=require(_0xba28('0x8'));var squel=require(_0xba28('0x9'));var crypto=require(_0xba28('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xba28('0xb'));var toCsv=require('to-csv');var querystring=require(_0xba28('0xc'));var Papa=require('papaparse');var Redis=require(_0xba28('0xd'));var authService=require(_0xba28('0xe'));var qs=require(_0xba28('0xf'));var as=require(_0xba28('0x10'));var hardwareService=require(_0xba28('0x11'));var logger=require('../../config/logger')(_0xba28('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xba28('0x13'));var db=require(_0xba28('0x14'))['db'];function respondWithStatusCode(_0x14ce85,_0x3ae370){_0x3ae370=_0x3ae370||0xcc;return function(_0x4ced09){if(_0x4ced09){return _0x14ce85[_0xba28('0x15')](_0x3ae370);}return _0x14ce85[_0xba28('0x16')](_0x3ae370)[_0xba28('0x17')]();};}function respondWithResult(_0x134ffa,_0x1f9cb8){_0x1f9cb8=_0x1f9cb8||0xc8;return function(_0x171521){if(_0x171521){return _0x134ffa['status'](_0x1f9cb8)[_0xba28('0x18')](_0x171521);}};}function respondWithFilteredResult(_0xa1227e,_0x151363){return function(_0x252594){if(_0x252594){var _0x30dff2=typeof _0x151363[_0xba28('0x19')]===_0xba28('0x1a')&&typeof _0x151363[_0xba28('0x1b')]===_0xba28('0x1a');var _0x4c8b9a=_0x252594[_0xba28('0x1c')];var _0x40613a=_0x30dff2?0x0:_0x151363[_0xba28('0x19')];var _0x1f3c7d=_0x30dff2?_0x252594['count']:_0x151363[_0xba28('0x19')]+_0x151363[_0xba28('0x1b')];var _0x54c86a;if(_0x1f3c7d>=_0x4c8b9a){_0x1f3c7d=_0x4c8b9a;_0x54c86a=0xc8;}else{_0x54c86a=0xce;}_0xa1227e[_0xba28('0x16')](_0x54c86a);return _0xa1227e[_0xba28('0x1d')]('Content-Range',_0x40613a+'-'+_0x1f3c7d+'/'+_0x4c8b9a)[_0xba28('0x18')](_0x252594);}return null;};}function patchUpdates(_0x8f3afd){return function(_0x52f190){try{jsonpatch[_0xba28('0x1e')](_0x52f190,_0x8f3afd,!![]);}catch(_0x23753a){return BPromise['reject'](_0x23753a);}return _0x52f190['save']();};}function saveUpdates(_0x2ef473,_0x128a4c){return function(_0x9d3ca9){if(_0x9d3ca9){return _0x9d3ca9['update'](_0x2ef473)[_0xba28('0x1f')](function(_0x3f9969){return _0x3f9969;});}return null;};}function removeEntity(_0x3aa8c0,_0x52f322){return function(_0x1153f2){if(_0x1153f2){return _0x1153f2[_0xba28('0x20')]()[_0xba28('0x1f')](function(){_0x3aa8c0[_0xba28('0x16')](0xcc)[_0xba28('0x17')]();});}};}function handleEntityNotFound(_0x3e930b,_0xc2017e){return function(_0x5607b7){if(!_0x5607b7){_0x3e930b['sendStatus'](0x194);}return _0x5607b7;};}function handleError(_0x13b5c8,_0x56a847){_0x56a847=_0x56a847||0x1f4;return function(_0xc32b6){logger[_0xba28('0x21')](_0xc32b6[_0xba28('0x22')]);if(_0xc32b6['name']){delete _0xc32b6[_0xba28('0x23')];}_0x13b5c8[_0xba28('0x16')](_0x56a847)[_0xba28('0x24')](_0xc32b6);};}exports['index']=function(_0x16b439,_0x396711){var _0x20a4e5={},_0x15b133={},_0x2ee581={'count':0x0,'rows':[]};var _0x54e434=_[_0xba28('0x25')](db[_0xba28('0x26')][_0xba28('0x27')],function(_0x51d369){return{'name':_0x51d369['fieldName'],'type':_0x51d369['type'][_0xba28('0x28')]};});_0x15b133[_0xba28('0x29')]=_[_0xba28('0x25')](_0x54e434,_0xba28('0x23'));_0x15b133[_0xba28('0x2a')]=_[_0xba28('0x2b')](_0x16b439[_0xba28('0x2a')]);_0x15b133[_0xba28('0x2c')]=_[_0xba28('0x2d')](_0x15b133[_0xba28('0x29')],_0x15b133['query']);_0x20a4e5[_0xba28('0x2e')]=_['intersection'](_0x15b133[_0xba28('0x29')],qs[_0xba28('0x2f')](_0x16b439['query'][_0xba28('0x2f')]));_0x20a4e5[_0xba28('0x2e')]=_0x20a4e5[_0xba28('0x2e')]['length']?_0x20a4e5['attributes']:_0x15b133[_0xba28('0x29')];if(!_0x16b439['query'][_0xba28('0x30')]('nolimit')){_0x20a4e5['limit']=qs[_0xba28('0x1b')](_0x16b439['query'][_0xba28('0x1b')]);_0x20a4e5['offset']=qs[_0xba28('0x19')](_0x16b439['query']['offset']);}_0x20a4e5[_0xba28('0x31')]=qs[_0xba28('0x32')](_0x16b439[_0xba28('0x2a')][_0xba28('0x32')]);_0x20a4e5['where']=qs[_0xba28('0x2c')](_[_0xba28('0x33')](_0x16b439[_0xba28('0x2a')],_0x15b133['filters']),_0x54e434);if(_0x16b439[_0xba28('0x2a')][_0xba28('0x34')]){_0x20a4e5[_0xba28('0x35')]=_[_0xba28('0x36')](_0x20a4e5['where'],{'$or':_['map'](_0x54e434,function(_0x31bfd9){if(_0x31bfd9['type']!==_0xba28('0x37')){var _0x2fb8f6={};_0x2fb8f6[_0x31bfd9['name']]={'$like':'%'+_0x16b439[_0xba28('0x2a')]['filter']+'%'};return _0x2fb8f6;}})});}_0x20a4e5=_[_0xba28('0x36')]({},_0x20a4e5,_0x16b439[_0xba28('0x38')]);var _0x634fad={'where':_0x20a4e5[_0xba28('0x35')]};return db[_0xba28('0x26')][_0xba28('0x1c')](_0x634fad)[_0xba28('0x1f')](function(_0x1a6dbd){_0x2ee581['count']=_0x1a6dbd;if(_0x16b439['query'][_0xba28('0x39')]){_0x20a4e5['include']=[{'all':!![]}];}return db[_0xba28('0x26')][_0xba28('0x3a')](_0x20a4e5);})[_0xba28('0x1f')](function(_0x38c655){_0x2ee581[_0xba28('0x3b')]=_0x38c655;return _0x2ee581;})[_0xba28('0x1f')](respondWithFilteredResult(_0x396711,_0x20a4e5))['catch'](handleError(_0x396711,null));};exports[_0xba28('0x3c')]=function(_0x4aaefd,_0x258819){var _0x595b30={'raw':!![],'where':{'id':_0x4aaefd['params']['id']}},_0x19ffae={};_0x19ffae['model']=_['keys'](db['SmsApplication'][_0xba28('0x27')]);_0x19ffae[_0xba28('0x2a')]=_[_0xba28('0x2b')](_0x4aaefd['query']);_0x19ffae[_0xba28('0x2c')]=_[_0xba28('0x2d')](_0x19ffae['model'],_0x19ffae[_0xba28('0x2a')]);_0x595b30[_0xba28('0x2e')]=_[_0xba28('0x2d')](_0x19ffae[_0xba28('0x29')],qs[_0xba28('0x2f')](_0x4aaefd['query'][_0xba28('0x2f')]));_0x595b30[_0xba28('0x2e')]=_0x595b30[_0xba28('0x2e')][_0xba28('0x3d')]?_0x595b30[_0xba28('0x2e')]:_0x19ffae[_0xba28('0x29')];if(_0x4aaefd['query'][_0xba28('0x39')]){_0x595b30[_0xba28('0x3e')]=[{'all':!![]}];}_0x595b30=_[_0xba28('0x36')]({},_0x595b30,_0x4aaefd['options']);return db[_0xba28('0x26')][_0xba28('0x3f')](_0x595b30)['then'](handleEntityNotFound(_0x258819,null))[_0xba28('0x1f')](respondWithResult(_0x258819,null))[_0xba28('0x40')](handleError(_0x258819,null));};exports['create']=function(_0x92f1ac,_0x2e87bf){return db[_0xba28('0x26')][_0xba28('0x41')](_0x92f1ac[_0xba28('0x42')],{})['then'](respondWithResult(_0x2e87bf,0xc9))[_0xba28('0x40')](handleError(_0x2e87bf,null));};exports[_0xba28('0x43')]=function(_0x5a1a18,_0x1f7bab){if(_0x5a1a18[_0xba28('0x42')]['id']){delete _0x5a1a18[_0xba28('0x42')]['id'];}return db[_0xba28('0x26')][_0xba28('0x3f')]({'where':{'id':_0x5a1a18[_0xba28('0x44')]['id']}})[_0xba28('0x1f')](handleEntityNotFound(_0x1f7bab,null))[_0xba28('0x1f')](saveUpdates(_0x5a1a18[_0xba28('0x42')],null))['then'](respondWithResult(_0x1f7bab,null))[_0xba28('0x40')](handleError(_0x1f7bab,null));};exports[_0xba28('0x20')]=function(_0x11c1a9,_0x136f0c){return db[_0xba28('0x26')][_0xba28('0x3f')]({'where':{'id':_0x11c1a9[_0xba28('0x44')]['id']}})[_0xba28('0x1f')](handleEntityNotFound(_0x136f0c,null))[_0xba28('0x1f')](removeEntity(_0x136f0c,null))[_0xba28('0x40')](handleError(_0x136f0c,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 759b085..6fd6b43 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 _0x8ccc=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x8ccc,0x16f));var _0xc8cc=function(_0x5f3cb1,_0x37627d){_0x5f3cb1=_0x5f3cb1-0x0;var _0x1d3569=_0x8ccc[_0x5f3cb1];return _0x1d3569;};'use strict';var _=require(_0xc8cc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc8cc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc8cc('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8cc('0x3'));var config=require(_0xc8cc('0x4'));var attributes=require(_0xc8cc('0x5'));module[_0xc8cc('0x6')]=function(_0x21488f,_0x5764cc){return _0x21488f['define'](_0xc8cc('0x7'),attributes,{'tableName':_0xc8cc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8cc('0x9'),'collate':_0xc8cc('0xa')});}; \ No newline at end of file +var _0xb6fb=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','sms_applications','utf8mb4'];(function(_0x1e7ba7,_0x35eef2){var _0x94d667=function(_0x17edf7){while(--_0x17edf7){_0x1e7ba7['push'](_0x1e7ba7['shift']());}};_0x94d667(++_0x35eef2);}(_0xb6fb,0x1c3));var _0xbb6f=function(_0x3381f7,_0x815ced){_0x3381f7=_0x3381f7-0x0;var _0x31c2a7=_0xb6fb[_0x3381f7];return _0x31c2a7;};'use strict';var _=require(_0xbb6f('0x0'));var util=require(_0xbb6f('0x1'));var logger=require(_0xbb6f('0x2'))(_0xbb6f('0x3'));var moment=require(_0xbb6f('0x4'));var BPromise=require(_0xbb6f('0x5'));var rp=require(_0xbb6f('0x6'));var fs=require('fs');var path=require(_0xbb6f('0x7'));var rimraf=require(_0xbb6f('0x8'));var config=require(_0xbb6f('0x9'));var attributes=require('./smsApplication.attributes');module[_0xbb6f('0xa')]=function(_0x389a31,_0x18e2dc){return _0x389a31[_0xbb6f('0xb')]('SmsApplication',attributes,{'tableName':_0xbb6f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb6f('0xd'),'collate':_0xbb6f('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 89ee68e..52b6a74 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 _0xfa25=['info','SmsApplication,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request'];(function(_0x5bdf12,_0x2f4e56){var _0x635385=function(_0x34a99c){while(--_0x34a99c){_0x5bdf12['push'](_0x5bdf12['shift']());}};_0x635385(++_0x2f4e56);}(_0xfa25,0xd1));var _0x5fa2=function(_0x3b610c,_0x1f0eee){_0x3b610c=_0x3b610c-0x0;var _0x465e46=_0xfa25[_0x3b610c];return _0x465e46;};'use strict';var _=require('lodash');var util=require(_0x5fa2('0x0'));var moment=require(_0x5fa2('0x1'));var BPromise=require(_0x5fa2('0x2'));var rs=require(_0x5fa2('0x3'));var fs=require('fs');var Redis=require(_0x5fa2('0x4'));var db=require(_0x5fa2('0x5'))['db'];var utils=require(_0x5fa2('0x6'));var logger=require(_0x5fa2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5fa2('0x8'));var client=jayson[_0x5fa2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53a560,_0x2a9a69,_0x4b04ea){return new BPromise(function(_0x35c145,_0x9c9f1c){return client[_0x5fa2('0xa')](_0x53a560,_0x4b04ea)['then'](function(_0x36778e){logger[_0x5fa2('0xb')](_0x5fa2('0xc'),_0x2a9a69,'request\x20sent');logger[_0x5fa2('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2a9a69,'request\x20sent',JSON[_0x5fa2('0xe')](_0x36778e));if(_0x36778e[_0x5fa2('0xf')]){if(_0x36778e['error'][_0x5fa2('0x10')]===0x1f4){logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);return _0x9c9f1c(_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);}logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);return _0x35c145(_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);}else{logger[_0x5fa2('0xb')]('SmsApplication,\x20%s,\x20%s',_0x2a9a69,_0x5fa2('0x12'));_0x35c145(_0x36778e[_0x5fa2('0x13')][_0x5fa2('0x11')]);}})['catch'](function(_0x4e20d1){logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x4e20d1);_0x9c9f1c(_0x4e20d1);});});} \ No newline at end of file +var _0xa9e1=['ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','code','SmsApplication,\x20%s,\x20%s','message','error','request\x20sent','result','lodash','util','bluebird','randomstring'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0xa9e1,0x7a));var _0x1a9e=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xa9e1[_0x4e5552];return _0x60a338;};'use strict';var _=require(_0x1a9e('0x0'));var util=require(_0x1a9e('0x1'));var moment=require('moment');var BPromise=require(_0x1a9e('0x2'));var rs=require(_0x1a9e('0x3'));var fs=require('fs');var Redis=require(_0x1a9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a9e('0x5'));var logger=require('../../config/logger')(_0x1a9e('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a9e('0x7'));var client=jayson[_0x1a9e('0x8')][_0x1a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc9409c,_0x2b8600,_0x91b2c3){return new BPromise(function(_0x9bf04c,_0x32c466){return client[_0x1a9e('0xa')](_0xc9409c,_0x91b2c3)[_0x1a9e('0xb')](function(_0x4f9f78){logger[_0x1a9e('0xc')]('SmsApplication,\x20%s,\x20%s',_0x2b8600,'request\x20sent');logger['debug'](_0x1a9e('0xd'),_0x2b8600,'request\x20sent',JSON[_0x1a9e('0xe')](_0x4f9f78));if(_0x4f9f78['error']){if(_0x4f9f78['error'][_0x1a9e('0xf')]===0x1f4){logger['error'](_0x1a9e('0x10'),_0x2b8600,_0x4f9f78['error'][_0x1a9e('0x11')]);return _0x32c466(_0x4f9f78[_0x1a9e('0x12')][_0x1a9e('0x11')]);}logger[_0x1a9e('0x12')](_0x1a9e('0x10'),_0x2b8600,_0x4f9f78[_0x1a9e('0x12')][_0x1a9e('0x11')]);return _0x9bf04c(_0x4f9f78[_0x1a9e('0x12')]['message']);}else{logger[_0x1a9e('0xc')](_0x1a9e('0x10'),_0x2b8600,_0x1a9e('0x13'));_0x9bf04c(_0x4f9f78[_0x1a9e('0x14')][_0x1a9e('0x11')]);}})['catch'](function(_0x303979){logger[_0x1a9e('0x12')](_0x1a9e('0x10'),_0x2b8600,_0x303979);_0x32c466(_0x303979);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1058882..9265c89 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 _0x9348=['addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x9348,0x10d));var _0x8934=function(_0x20fd49,_0x245bfa){_0x20fd49=_0x20fd49-0x0;var _0x307f96=_0x9348[_0x20fd49];return _0x307f96;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/describe',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8934('0xd'),auth['isAuthenticated'](),controller[_0x8934('0xe')]);router[_0x8934('0x9')](_0x8934('0xf'),auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);router[_0x8934('0x11')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0x12')]);router['post'](_0x8934('0xd'),auth[_0x8934('0xa')](),controller[_0x8934('0x13')]);router[_0x8934('0x11')](_0x8934('0x14'),auth[_0x8934('0xa')](),interaction['tracked'](_0x8934('0x15'),_0x8934('0x16')),controller[_0x8934('0x17')]);router[_0x8934('0x18')](_0x8934('0x19'),auth[_0x8934('0xa')](),interaction[_0x8934('0x1a')](_0x8934('0x15'),'smsinteraction:update'),controller[_0x8934('0x1b')]);router[_0x8934('0x1c')](_0x8934('0x19'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x8934('0x1d')),controller['destroy']);router[_0x8934('0x1c')](_0x8934('0x14'),auth[_0x8934('0xa')](),controller[_0x8934('0x1e')]);module[_0x8934('0x1f')]=router; \ No newline at end of file +var _0x3423=['/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x11')](_0x3342('0x13'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x16')),controller['addTags']);router[_0x3342('0x17')](_0x3342('0xe'),auth['isAuthenticated'](),interaction[_0x3342('0x14')](_0x3342('0x15'),'smsinteraction:update'),controller['update']);router[_0x3342('0x18')](_0x3342('0xe'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x19')),controller[_0x3342('0x1a')]);router[_0x3342('0x18')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x1b')]);module[_0x3342('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d8cd5a2..fd2616a 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 _0xef17=['exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize','moment'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0xef17,0x136));var _0x7ef1=function(_0x56e517,_0x10ee40){_0x56e517=_0x56e517-0x0;var _0x3ed369=_0xef17[_0x56e517];return _0x3ed369;};'use strict';var Sequelize=require(_0x7ef1('0x0'));var moment=require(_0x7ef1('0x1'));module[_0x7ef1('0x2')]={'closed':{'type':Sequelize[_0x7ef1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7ef1('0x4')]},'disposition':{'type':Sequelize[_0x7ef1('0x5')]},'secondDisposition':{'type':Sequelize[_0x7ef1('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7ef1('0x5')]},'note':{'type':Sequelize[_0x7ef1('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7ef1('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7ef1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7ef1('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbd3c=['out','BOOLEAN','sequelize','moment','exports','DATE','STRING','ENUM'];(function(_0x1e4dca,_0x44147a){var _0x355ca9=function(_0x4d49b2){while(--_0x4d49b2){_0x1e4dca['push'](_0x1e4dca['shift']());}};_0x355ca9(++_0x44147a);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x2f3cb6,_0x3a455f){_0x2f3cb6=_0x2f3cb6-0x0;var _0x5dd5d5=_0xbd3c[_0x2f3cb6];return _0x5dd5d5;};'use strict';var Sequelize=require(_0xcbd3('0x0'));var moment=require(_0xcbd3('0x1'));module[_0xcbd3('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcbd3('0x3')]},'disposition':{'type':Sequelize[_0xcbd3('0x4')]},'secondDisposition':{'type':Sequelize[_0xcbd3('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xcbd3('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xcbd3('0x5')]('in',_0xcbd3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcbd3('0x5')]('in',_0xcbd3('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcbd3('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index da28130..c6e43da 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 _0x7a27=['it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','start','Tag','union','User','UserId','text','body','keys','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','SmsAccountId','toString','merge','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','SmsInteractionId','push','all','rows','show','params','includeAll','include','options','catch','create','describe','SmsMessage','addMessage','ids','omit','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','unix','join','root','server','tmp','transcript-%d-%s.zip','CmContact','Contact','lastName','Messages','direction','SmsAccount','Account','Owner','mkdirSync','Sms','closed','closedAt','disposition','out','System','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','end','stack','name','Users','fullname','TagIds','split','forEach','Tags','then','index','map','SmsInteraction','rawAttributes','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7a27,0x172));var _0x77a2=function(_0x5a1289,_0x3f729d){_0x5a1289=_0x5a1289-0x0;var _0x485cd4=_0x7a27[_0x5a1289];return _0x485cd4;};'use strict';var emlformat=require(_0x77a2('0x0'));var rimraf=require(_0x77a2('0x1'));var zipdir=require(_0x77a2('0x2'));var jsonpatch=require(_0x77a2('0x3'));var rp=require('request-promise');var moment=require(_0x77a2('0x4'));var BPromise=require(_0x77a2('0x5'));var Mustache=require(_0x77a2('0x6'));var util=require(_0x77a2('0x7'));var path=require('path');var sox=require(_0x77a2('0x8'));var csv=require(_0x77a2('0x9'));var ejs=require(_0x77a2('0xa'));var fs=require('fs');var fs_extra=require(_0x77a2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x77a2('0xc'));var deskjs=require(_0x77a2('0xd'));var toCsv=require(_0x77a2('0x9'));var querystring=require(_0x77a2('0xe'));var Papa=require(_0x77a2('0xf'));var Redis=require('ioredis');var authService=require(_0x77a2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x77a2('0x11'));var hardwareService=require(_0x77a2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x77a2('0x13'));var config=require(_0x77a2('0x14'));var licenseUtil=require(_0x77a2('0x15'));var db=require(_0x77a2('0x16'))['db'];config[_0x77a2('0x17')]=_[_0x77a2('0x18')](config['redis'],{'host':_0x77a2('0x19'),'port':0x18eb});var socket=require(_0x77a2('0x1a'))(new Redis(config['redis']));require(_0x77a2('0x1b'))['register'](socket);function respondWithStatusCode(_0x3c13f9,_0x154e25){_0x154e25=_0x154e25||0xcc;return function(_0x53a447){if(_0x53a447){return _0x3c13f9[_0x77a2('0x1c')](_0x154e25);}return _0x3c13f9[_0x77a2('0x1d')](_0x154e25)['end']();};}function respondWithResult(_0x19c5f2,_0x3e8946){_0x3e8946=_0x3e8946||0xc8;return function(_0x48c438){if(_0x48c438){return _0x19c5f2[_0x77a2('0x1d')](_0x3e8946)[_0x77a2('0x1e')](_0x48c438);}};}function respondWithFilteredResult(_0x2ebca3,_0x49fd4d){return function(_0x403b03){if(_0x403b03){var _0x76196d=typeof _0x49fd4d[_0x77a2('0x1f')]===_0x77a2('0x20')&&typeof _0x49fd4d[_0x77a2('0x21')]===_0x77a2('0x20');var _0x27e93a=_0x403b03[_0x77a2('0x22')];var _0xcc5e35=_0x76196d?0x0:_0x49fd4d[_0x77a2('0x1f')];var _0x52fe6c=_0x76196d?_0x403b03[_0x77a2('0x22')]:_0x49fd4d[_0x77a2('0x1f')]+_0x49fd4d['limit'];var _0x42c62e;if(_0x52fe6c>=_0x27e93a){_0x52fe6c=_0x27e93a;_0x42c62e=0xc8;}else{_0x42c62e=0xce;}_0x2ebca3[_0x77a2('0x1d')](_0x42c62e);return _0x2ebca3['set'](_0x77a2('0x23'),_0xcc5e35+'-'+_0x52fe6c+'/'+_0x27e93a)[_0x77a2('0x1e')](_0x403b03);}return null;};}function patchUpdates(_0x2b0b8f){return function(_0x3afc04){try{jsonpatch[_0x77a2('0x24')](_0x3afc04,_0x2b0b8f,!![]);}catch(_0x17e980){return BPromise['reject'](_0x17e980);}return _0x3afc04[_0x77a2('0x25')]();};}function saveUpdates(_0x1b4c14,_0x33e386){return function(_0x480c9b){if(_0x480c9b){return _0x480c9b[_0x77a2('0x26')](_0x1b4c14)['then'](function(_0xd6245d){return _0xd6245d;});}return null;};}function removeEntity(_0x1f0cfc,_0x24dc45){return function(_0x26d77a){if(_0x26d77a){return _0x26d77a[_0x77a2('0x27')]()['then'](function(){_0x1f0cfc[_0x77a2('0x1d')](0xcc)[_0x77a2('0x28')]();});}};}function handleEntityNotFound(_0x484ff7,_0x3a86b9){return function(_0x4e5720){if(!_0x4e5720){_0x484ff7['sendStatus'](0x194);}return _0x4e5720;};}function handleError(_0x57fe4a,_0x2b9cbb){_0x2b9cbb=_0x2b9cbb||0x1f4;return function(_0x49b1a6){logger['error'](_0x49b1a6[_0x77a2('0x29')]);if(_0x49b1a6['name']){delete _0x49b1a6[_0x77a2('0x2a')];}_0x57fe4a[_0x77a2('0x1d')](_0x2b9cbb)['send'](_0x49b1a6);};}function getInteractionUsers(_0x3452a3,_0x1b4a0c){return new BPromise(function(_0x30b58c,_0x77dd40){try{if(_0x1b4a0c[_0x3452a3['id']]){_0x3452a3[_0x77a2('0x2b')]=_['map'](_0x1b4a0c[_0x3452a3['id']],function(_0x392252){return{'id':_0x392252['id'],'fullname':_0x392252[_0x77a2('0x2c')]};});}}catch(_0x43081c){_0x77dd40(_0x43081c);}_0x30b58c(_0x3452a3);});}function getInteractionTags(_0x13359,_0x5a7ccc){return new BPromise(function(_0x3cb00c,_0x4b72e8){try{if(_0x13359[_0x77a2('0x2d')]){_0x13359['Tags']=[];_0x13359[_0x77a2('0x2d')][_0x77a2('0x2e')](',')[_0x77a2('0x2f')](function(_0x42eebb){_0x13359[_0x77a2('0x30')]['push'](_0x5a7ccc[_0x42eebb]);});}delete _0x13359['TagIds'];}catch(_0x223b5a){_0x4b72e8(_0x223b5a);}_0x3cb00c(_0x13359);});}function updateSmsInteraction(_0x1dd57f,_0x2c6644,_0x4a7094){return new BPromise(function(_0x4d8ecf,_0x5c5f70){return getInteractionUsers(_0x1dd57f,_0x4a7094)[_0x77a2('0x31')](function(_0x50577c){return getInteractionTags(_0x50577c,_0x2c6644);})[_0x77a2('0x31')](function(_0x5305d8){_0x4d8ecf(_0x5305d8);})['catch'](function(_0x2dc8a4){_0x5c5f70(_0x2dc8a4);});});}exports[_0x77a2('0x32')]=function(_0x284d07,_0x4590a2){var _0x487859={},_0x13e8dc={},_0x346f86={'count':0x0,'rows':[]};var _0x37bf75=_[_0x77a2('0x33')](db[_0x77a2('0x34')][_0x77a2('0x35')],function(_0x323884){return{'name':_0x323884['fieldName'],'type':_0x323884['type'][_0x77a2('0x36')]};});_0x13e8dc[_0x77a2('0x37')]=_[_0x77a2('0x33')](_0x37bf75,'name');_0x13e8dc['query']=_['keys'](_0x284d07[_0x77a2('0x38')]);_0x13e8dc[_0x77a2('0x39')]=_[_0x77a2('0x3a')](_0x13e8dc[_0x77a2('0x37')],_0x13e8dc[_0x77a2('0x38')]);_0x487859['attributes']=_[_0x77a2('0x3a')](_0x13e8dc['model'],qs[_0x77a2('0x3b')](_0x284d07[_0x77a2('0x38')][_0x77a2('0x3b')]));_0x487859[_0x77a2('0x3c')]=_0x487859['attributes']['length']?_0x487859[_0x77a2('0x3c')]:_0x13e8dc[_0x77a2('0x37')];if(!_0x284d07['query'][_0x77a2('0x3d')]('nolimit')){_0x487859[_0x77a2('0x21')]=qs['limit'](_0x284d07[_0x77a2('0x38')][_0x77a2('0x21')]);_0x487859[_0x77a2('0x1f')]=qs[_0x77a2('0x1f')](_0x284d07[_0x77a2('0x38')][_0x77a2('0x1f')]);}_0x487859[_0x77a2('0x3e')]=qs['sort'](_0x284d07['query'][_0x77a2('0x3f')]);_0x487859[_0x77a2('0x40')]=qs[_0x77a2('0x39')](_[_0x77a2('0x41')](_0x284d07[_0x77a2('0x38')],_0x13e8dc[_0x77a2('0x39')]),_0x37bf75);var _0x7a4c94=[];var _0x4497fc=squel[_0x77a2('0x42')]()['field']('id')[_0x77a2('0x43')]('name')[_0x77a2('0x43')](_0x77a2('0x44'))[_0x77a2('0x45')](_0x77a2('0x46'));var _0x24044b=squel[_0x77a2('0x42')]()[_0x77a2('0x43')](_0x77a2('0x47'))[_0x77a2('0x43')]('u.fullname')[_0x77a2('0x43')](_0x77a2('0x48'))[_0x77a2('0x45')]('user_has_sms_interactions','ui')[_0x77a2('0x49')]('users','u',_0x77a2('0x4a'));var _0x611018=squel[_0x77a2('0x42')]()['from'](_0x77a2('0x4b'),'i')[_0x77a2('0x49')](_0x77a2('0x4c'),'c',_0x77a2('0x4d'))[_0x77a2('0x49')](_0x77a2('0x4e'),'o',_0x77a2('0x4f'))['left_join'](_0x77a2('0x50'),'a','a.id\x20=\x20i.SmsAccountId')[_0x77a2('0x49')](_0x77a2('0x51'),'me',_0x77a2('0x52'))[_0x77a2('0x49')](_0x77a2('0x53'),'it',_0x77a2('0x54'))[_0x77a2('0x49')](_0x77a2('0x46'),'t',_0x77a2('0x55'));var _0x475f5c=squel[_0x77a2('0x56')]();var _0x161f5e=[];var _0x5d77e6=squel['expr']();var _0x2f1027;if(_0x284d07['query'][_0x77a2('0x57')]){_0x2f1027=as['parseSearch'](_0x284d07[_0x77a2('0x38')][_0x77a2('0x57')]);var _0x595557=_0x2f1027[_0x77a2('0x58')];for(var _0xafb4e8=0x0;_0xafb4e8<_0x2f1027[_0x77a2('0x59')][_0x77a2('0x5a')];_0xafb4e8++){var _0x1c1527=_0x2f1027['conditions'][_0xafb4e8];var _0x39ec7b='i';var _0x4b9c41=_[_0x77a2('0x5b')](_0x37bf75,[_0x77a2('0x2a'),_0x1c1527[_0x77a2('0x43')]]);if(!_0x4b9c41){switch(_0x1c1527[_0x77a2('0x43')]){case _0x77a2('0x5c'):if(_0x1c1527[_0x77a2('0x5d')]==0x1){_0x611018[_0x77a2('0x5e')]('`'+_0x1c1527[_0x77a2('0x43')]+_0x77a2('0x5f'));}else{_0x611018[_0x77a2('0x5e')]('`'+_0x1c1527[_0x77a2('0x43')]+_0x77a2('0x60'));}break;case'Contact':if(_0x1c1527[_0x77a2('0x61')]===_0x77a2('0x62')){if(_0x1c1527[_0x77a2('0x5d')][_0x77a2('0x2e')]('\x20')[_0x77a2('0x5a')]>0x1){_0x475f5c[_0x595557](_0x77a2('0x63'),qs[_0x77a2('0x64')](_0x1c1527[_0x77a2('0x5d')]),null);}else{var _0x17ff28='%'+_0x1c1527['value']+'%';_0x475f5c[_0x595557](_0x77a2('0x65'),_0x17ff28,_0x17ff28,_0x17ff28);}}else{_0x4b9c41=_[_0x77a2('0x5b')](_0x37bf75,['name',_0x77a2('0x66')]);_0x1c1527['field']=_0x77a2('0x66');_0x1de231=as[_0x77a2('0x67')](_0x39ec7b,_0x4b9c41[_0x77a2('0x68')],_0x1c1527);_0x475f5c[_0x595557](_0x1de231['text'],_0x1de231[_0x77a2('0x5d')][_0x77a2('0x69')],_0x1de231[_0x77a2('0x5d')][_0x77a2('0x28')]);}break;case _0x77a2('0x6a'):var _0x4767a9=_0x1c1527['value']['split'](',')[_0x77a2('0x33')](function(_0x1af224){return Number(_0x1af224);});_0x4767a9[_0x77a2('0x2f')](function(_0x1ec980){_0x5d77e6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1ec980+',%');});_0x161f5e=_[_0x77a2('0x6b')](_0x161f5e,_0x4767a9);break;case _0x77a2('0x6c'):if(_0x1c1527[_0x77a2('0x61')]===_0x77a2('0x62')){_0x475f5c[_0x595557]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1c1527[_0x77a2('0x5d')]+'%',null);}else{_0x4b9c41=_['find'](_0x37bf75,['name',_0x77a2('0x6d')]);_0x1c1527[_0x77a2('0x43')]=_0x77a2('0x6d');_0x1de231=as[_0x77a2('0x67')](_0x39ec7b,_0x4b9c41['type'],_0x1c1527);_0x475f5c[_0x595557](_0x1de231[_0x77a2('0x6e')],_0x1de231['value'][_0x77a2('0x69')],_0x1de231[_0x77a2('0x5d')]['end']);}break;case _0x77a2('0x6f'):_0x1de231=as[_0x77a2('0x67')]('me',null,_0x1c1527);_0x475f5c[_0x595557](_0x1de231['text'],_0x1de231['value'][_0x77a2('0x69')],_0x1de231[_0x77a2('0x5d')][_0x77a2('0x28')]);break;}}else{var _0x1de231=as[_0x77a2('0x67')](_0x39ec7b,_0x4b9c41['type'],_0x1c1527);_0x475f5c[_0x595557](_0x1de231[_0x77a2('0x6e')],_0x1de231[_0x77a2('0x5d')][_0x77a2('0x69')],_0x1de231[_0x77a2('0x5d')][_0x77a2('0x28')]);}}}else{var _0x85dc0a=_(_0x284d07[_0x77a2('0x38')])[_0x77a2('0x70')]()[_0x77a2('0x33')](function(_0x151b79){return _[_0x77a2('0x71')](_0x37bf75,[_0x77a2('0x2a'),_0x151b79])?_0x151b79:undefined;})[_0x77a2('0x72')]()[_0x77a2('0x5d')]();if(!_[_0x77a2('0x73')](_0x85dc0a)){_0x85dc0a[_0x77a2('0x2f')](function(_0x13c54e){if(_0x13c54e==='SmsAccountId'){_0x611018[_0x77a2('0x40')](_0x77a2('0x74'),[]['concat'](_0x284d07[_0x77a2('0x38')][_0x13c54e]));}else if(_0x13c54e===_0x77a2('0x75')){var _0x124147=JSON[_0x77a2('0x76')](_0x284d07[_0x77a2('0x38')][_0x13c54e])[_0x77a2('0x77')];var _0x4af527=JSON['parse'](_0x284d07['query'][_0x13c54e])[_0x77a2('0x78')];_0x611018[_0x77a2('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x124147,_0x4af527);}else{if(_0x284d07['query'][_0x13c54e]===_0x77a2('0x79')){_0x611018[_0x77a2('0x40')]('i.'+_0x13c54e+_0x77a2('0x7a'));}else{_0x611018[_0x77a2('0x40')]('i.'+_0x13c54e+'\x20=\x20?',_0x284d07[_0x77a2('0x38')][_0x13c54e]);}}});}if(_0x284d07['query'][_0x77a2('0x7b')]){if(_0x284d07[_0x77a2('0x38')]['read']==0x1){_0x611018['having'](_0x77a2('0x7c'));}else{_0x611018['having'](_0x77a2('0x7d'));}}if(_0x284d07[_0x77a2('0x38')]['tag']){_0x161f5e=_[_0x77a2('0x7e')](_0x284d07[_0x77a2('0x38')][_0x77a2('0x7f')])?_0x284d07[_0x77a2('0x38')]['tag']:new Array(_0x284d07['query'][_0x77a2('0x7f')]);_0x161f5e[_0x77a2('0x2f')](function(_0x2b7a8d){_0x5d77e6['or'](_0x77a2('0x80'),'%,'+_0x2b7a8d+',%');});}if(_0x284d07['query'][_0x77a2('0x81')]){var _0x1fcaf1=_0x284d07[_0x77a2('0x38')][_0x77a2('0x81')][_0x77a2('0x82')]('\x5c','\x5c\x5c')[_0x77a2('0x82')](/'/g,'\x27\x27');if(qs[_0x77a2('0x83')](_0x1fcaf1)){_0x475f5c['or']('i.id\x20LIKE\x20?',_0x1fcaf1+'%')['or'](_0x77a2('0x84'),_0x1fcaf1+'%');}else{_0x475f5c['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x77a2('0x64')](_0x1fcaf1))['or'](_0x77a2('0x85'),_0x1fcaf1+'%');}}}_0x611018[_0x77a2('0x40')](_0x475f5c);_0x611018[_0x77a2('0x86')](_0x77a2('0x87'));var _0x125fc0={'type':db[_0x77a2('0x88')][_0x77a2('0x89')]['SELECT'],'raw':!![]};var _0x3b84d7=_0x611018['clone']();_0x3b84d7[_0x77a2('0x43')](_0x77a2('0x87'));_0x3b84d7[_0x77a2('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x77a2('0x5c'));if(_0x487859[_0x77a2('0x3e')]){_0x487859[_0x77a2('0x3e')][_0x77a2('0x2f')](function(_0x376ec7){var _0x4876f1=_0x376ec7[0x0]===_0x77a2('0x8a')?_0x376ec7[0x0]:'i.'+_0x376ec7[0x0];_0x611018[_0x77a2('0x3e')](_0x4876f1,_0x376ec7[0x1]==='DESC'?![]:!![]);});}if(!_[_0x77a2('0x73')](_0x161f5e)){_0x611018[_0x77a2('0x5e')](_0x5d77e6);_0x3b84d7['where'](_0x77a2('0x8b'),_0x161f5e);}BPromise[_0x77a2('0x8c')]()['then'](function(){if(!_0x2f1027){if(_0x284d07[_0x77a2('0x38')]['SmsAccountId'])return;_0x3b84d7[_0x77a2('0x40')](_0x77a2('0x8d'));_0x611018[_0x77a2('0x40')](_0x77a2('0x8d'));return;}if(_0x284d07['user'][_0x77a2('0x8e')]!=='agent')return;return _0x284d07[_0x77a2('0x8f')][_0x77a2('0x90')]({'attributes':['id'],'raw':!![]})[_0x77a2('0x31')](function(_0x2912aa){if(_[_0x77a2('0x73')](_0x2912aa)){_0x3b84d7[_0x77a2('0x40')](_0x77a2('0x91'));_0x611018[_0x77a2('0x40')](_0x77a2('0x91'));}else{_0x3b84d7[_0x77a2('0x40')](_0x77a2('0x74'),_[_0x77a2('0x33')](_0x2912aa,'id'));_0x611018[_0x77a2('0x40')](_0x77a2('0x74'),_[_0x77a2('0x33')](_0x2912aa,'id'));}});})['then'](function(){if(_0x284d07[_0x77a2('0x8f')][_0x77a2('0x8e')]===_0x77a2('0x92')&&!_0x2f1027&&!_0x284d07[_0x77a2('0x38')][_0x77a2('0x93')])return[];return db['sequelize']['query'](_0x3b84d7[_0x77a2('0x94')](),_0x125fc0);})[_0x77a2('0x31')](function(_0x913f2c){_0x346f86[_0x77a2('0x22')]=_0x913f2c[_0x77a2('0x5a')];if(_0x346f86[_0x77a2('0x22')]===0x0)return[];return db['sequelize']['query'](_0x4497fc[_0x77a2('0x94')](),_0x125fc0)[_0x77a2('0x31')](function(_0x45fdbe){_0x7a4c94=_['keyBy'](_0x45fdbe,'id');_0x125fc0=_[_0x77a2('0x95')](_0x125fc0,{'model':db[_0x77a2('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x284d07[_0x77a2('0x38')][_0x77a2('0x3b')]){_0x487859[_0x77a2('0x3c')][_0x77a2('0x2f')](function(_0xfc0916){_0x611018[_0x77a2('0x43')]('i.'+_0xfc0916);});}else{_0x611018['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x611018[_0x77a2('0x43')](_0x77a2('0x96'),'Account.key');_0x611018[_0x77a2('0x43')](_0x77a2('0x97'),'Account.mandatoryDisposition');_0x611018['field'](_0x77a2('0x98'),_0x77a2('0x8a'));_0x611018[_0x77a2('0x43')](_0x77a2('0x99'));_0x611018[_0x77a2('0x43')]('c.firstName',_0x77a2('0x9a'));_0x611018[_0x77a2('0x43')](_0x77a2('0x9b'),_0x77a2('0x9c'));_0x611018[_0x77a2('0x43')](_0x77a2('0x9d'),_0x77a2('0x9e'));_0x611018[_0x77a2('0x43')](_0x77a2('0x9f'),_0x77a2('0xa0'));_0x611018[_0x77a2('0x43')](_0x77a2('0xa1'),'Contact.mobile');_0x611018['field'](_0x77a2('0xa2'),'Contact.fax');_0x611018[_0x77a2('0x43')](_0x77a2('0xa3'),_0x77a2('0xa4'));_0x611018[_0x77a2('0x43')](_0x77a2('0xa5'),'Owner.internal');_0x611018[_0x77a2('0x43')](_0x77a2('0xa6'),_0x77a2('0x2d'));}if(_0x487859['limit'])_0x611018[_0x77a2('0x21')](_0x487859[_0x77a2('0x21')]);if(_0x487859[_0x77a2('0x1f')])_0x611018['offset'](_0x487859[_0x77a2('0x1f')]);return db['sequelize'][_0x77a2('0x38')](_0x611018['toString'](),_0x125fc0);})[_0x77a2('0x31')](function(_0x36e19a){if(_0x36e19a[_0x77a2('0x5a')]>0x0)_0x24044b['where']('ui.SmsInteractionId\x20IN\x20?',_[_0x77a2('0x33')](_0x36e19a,'id'));return db[_0x77a2('0xa7')][_0x77a2('0x38')](_0x24044b[_0x77a2('0x94')](),_0x125fc0)[_0x77a2('0x31')](function(_0x20f4c9){var _0x5b3bb0=_[_0x77a2('0xa8')](_0x20f4c9,_0x77a2('0xa9'));var _0x1521df=[];_0x36e19a[_0x77a2('0x2f')](function(_0x13f463){_0x1521df[_0x77a2('0xaa')](updateSmsInteraction(_0x13f463,_0x7a4c94,_0x5b3bb0));});return BPromise[_0x77a2('0xab')](_0x1521df);});});})['then'](function(_0x2c977d){_0x346f86[_0x77a2('0xac')]=_0x2c977d;return _0x346f86;})[_0x77a2('0x31')](respondWithFilteredResult(_0x4590a2,_0x487859))['catch'](handleError(_0x4590a2,null));};exports[_0x77a2('0xad')]=function(_0x452bc7,_0x21d5d9){var _0x233596={'raw':![],'where':{'id':_0x452bc7[_0x77a2('0xae')]['id']}},_0x6a0673={};_0x6a0673[_0x77a2('0x37')]=_[_0x77a2('0x70')](db[_0x77a2('0x34')][_0x77a2('0x35')]);_0x6a0673[_0x77a2('0x38')]=_[_0x77a2('0x70')](_0x452bc7['query']);_0x6a0673['filters']=_[_0x77a2('0x3a')](_0x6a0673[_0x77a2('0x37')],_0x6a0673['query']);_0x233596[_0x77a2('0x3c')]=_['intersection'](_0x6a0673['model'],qs['fields'](_0x452bc7[_0x77a2('0x38')][_0x77a2('0x3b')]));_0x233596['attributes']=_0x233596[_0x77a2('0x3c')][_0x77a2('0x5a')]?_0x233596[_0x77a2('0x3c')]:_0x6a0673[_0x77a2('0x37')];if(_0x452bc7[_0x77a2('0x38')][_0x77a2('0xaf')]){_0x233596[_0x77a2('0xb0')]=[{'all':!![]}];}_0x233596=_['merge']({},_0x233596,_0x452bc7[_0x77a2('0xb1')]);return db[_0x77a2('0x34')][_0x77a2('0x5b')](_0x233596)[_0x77a2('0x31')](handleEntityNotFound(_0x21d5d9,null))[_0x77a2('0x31')](respondWithResult(_0x21d5d9,null))[_0x77a2('0xb2')](handleError(_0x21d5d9,null));};exports['create']=function(_0x31b7a6,_0x3b4f10){return db[_0x77a2('0x34')][_0x77a2('0xb3')](_0x31b7a6['body'],{})[_0x77a2('0x31')](respondWithResult(_0x3b4f10,0xc9))[_0x77a2('0xb2')](handleError(_0x3b4f10,null));};exports[_0x77a2('0x26')]=function(_0x398f06,_0x3ae757){if(_0x398f06[_0x77a2('0x6f')]['id']){delete _0x398f06[_0x77a2('0x6f')]['id'];}return db[_0x77a2('0x34')][_0x77a2('0x5b')]({'where':{'id':_0x398f06[_0x77a2('0xae')]['id']}})['then'](handleEntityNotFound(_0x3ae757,null))['then'](saveUpdates(_0x398f06[_0x77a2('0x6f')],null))[_0x77a2('0x31')](respondWithResult(_0x3ae757,null))['catch'](handleError(_0x3ae757,null));};exports['destroy']=function(_0x306003,_0x19cfd5){return db['SmsInteraction'][_0x77a2('0x5b')]({'where':{'id':_0x306003[_0x77a2('0xae')]['id']}})[_0x77a2('0x31')](handleEntityNotFound(_0x19cfd5,null))[_0x77a2('0x31')](removeEntity(_0x19cfd5,null))[_0x77a2('0xb2')](handleError(_0x19cfd5,null));};exports['describe']=function(_0x361ad9,_0x58b3af){return db[_0x77a2('0x34')][_0x77a2('0xb4')]()[_0x77a2('0x31')](respondWithResult(_0x58b3af,null))[_0x77a2('0xb2')](handleError(_0x58b3af,null));};exports['addMessage']=function(_0xe0b49d,_0xef47ed,_0x53c87d){return db[_0x77a2('0xb5')]['find']({'where':{'id':_0xe0b49d[_0x77a2('0xae')]['id']}})[_0x77a2('0x31')](handleEntityNotFound(_0xef47ed,null))['then'](function(_0x4f95ea){if(_0x4f95ea){return _0x4f95ea[_0x77a2('0xb6')](_0xe0b49d[_0x77a2('0x6f')][_0x77a2('0xb7')],_[_0x77a2('0xb8')](_0xe0b49d['body'],[_0x77a2('0xb7'),'id'])||{});}})[_0x77a2('0x31')](respondWithResult(_0xef47ed,null))[_0x77a2('0xb2')](handleError(_0xef47ed,null));};exports['getMessages']=function(_0xc660da,_0x3aa63b,_0x42f594){var _0x50ff56={'raw':![],'where':{}};var _0x41c26c={};var _0x3bff53={'count':0x0,'rows':[]};return db[_0x77a2('0x34')][_0x77a2('0xb9')]({'where':{'id':_0xc660da[_0x77a2('0xae')]['id']}})['then'](handleEntityNotFound(_0x3aa63b,null))[_0x77a2('0x31')](function(_0x344462){if(_0x344462){_0x41c26c[_0x77a2('0x37')]=_[_0x77a2('0x70')](db['SmsMessage'][_0x77a2('0x35')]);_0x41c26c[_0x77a2('0x38')]=_[_0x77a2('0x70')](_0xc660da[_0x77a2('0x38')]);_0x41c26c[_0x77a2('0x39')]=_[_0x77a2('0x3a')](_0x41c26c[_0x77a2('0x37')],_0x41c26c[_0x77a2('0x38')]);_0x50ff56[_0x77a2('0x3c')]=_[_0x77a2('0x3a')](_0x41c26c[_0x77a2('0x37')],qs[_0x77a2('0x3b')](_0xc660da[_0x77a2('0x38')][_0x77a2('0x3b')]));_0x50ff56[_0x77a2('0x3c')]=_0x50ff56['attributes']['length']?_0x50ff56[_0x77a2('0x3c')]:_0x41c26c[_0x77a2('0x37')];if(!_0xc660da[_0x77a2('0x38')][_0x77a2('0x3d')]('nolimit')){_0x50ff56[_0x77a2('0x21')]=qs[_0x77a2('0x21')](_0xc660da['query'][_0x77a2('0x21')]);_0x50ff56[_0x77a2('0x1f')]=qs['offset'](_0xc660da[_0x77a2('0x38')][_0x77a2('0x1f')]);}_0x50ff56[_0x77a2('0x3e')]=qs[_0x77a2('0x3f')](_0xc660da[_0x77a2('0x38')][_0x77a2('0x3f')]);_0x50ff56['where']=qs['filters'](_[_0x77a2('0x41')](_0xc660da[_0x77a2('0x38')],_0x41c26c[_0x77a2('0x39')]));_0x50ff56[_0x77a2('0x40')][_0x77a2('0xa9')]=_0x344462['id'];if(_0xc660da[_0x77a2('0x38')][_0x77a2('0x81')]){_0x50ff56[_0x77a2('0x40')]=_[_0x77a2('0x95')](_0x50ff56[_0x77a2('0x40')],{'$or':_[_0x77a2('0x33')](_0x50ff56[_0x77a2('0x3c')],function(_0x10db64){var _0x7bbe62={};_0x7bbe62[_0x10db64]={'$like':'%'+_0xc660da['query']['filter']+'%'};return _0x7bbe62;})});}if(_0xc660da['query'][_0x77a2('0x77')]){var _0x4f041b=_0xc660da[_0x77a2('0x38')][_0x77a2('0x77')][_0x77a2('0x2e')](',');var _0x276824={};_0x276824[_0x4f041b[0x0]]={'$gte':moment(_0x4f041b[0x1])[_0x77a2('0xba')](_0x77a2('0xbb'))};_0x50ff56['where']=_['merge'](_0x50ff56[_0x77a2('0x40')],_0x276824);}_0x50ff56=_[_0x77a2('0x95')]({},_0x50ff56,_0xc660da['options']);return db['SmsMessage'][_0x77a2('0x22')]({'where':_0x50ff56[_0x77a2('0x40')]})[_0x77a2('0x31')](function(_0x4ec5ee){_0x3bff53['count']=_0x4ec5ee;if(_0xc660da[_0x77a2('0x38')][_0x77a2('0xaf')]){_0x50ff56[_0x77a2('0xb0')]=[{'all':!![]}];}return db['SmsMessage'][_0x77a2('0xbc')](_0x50ff56);})[_0x77a2('0x31')](function(_0x315f80){_0x3bff53[_0x77a2('0xac')]=_0x315f80;return _0x3bff53;});}})[_0x77a2('0x31')](respondWithFilteredResult(_0x3aa63b,_0x50ff56))['catch'](handleError(_0x3aa63b,null));};exports[_0x77a2('0xbd')]=function(_0x5e9891,_0x6d3940,_0x4404c7){return db['SmsInteraction'][_0x77a2('0x5b')]({'where':{'id':_0x5e9891[_0x77a2('0xae')]['id']}})[_0x77a2('0x31')](handleEntityNotFound(_0x6d3940,null))[_0x77a2('0x31')](function(_0x3af6a1){if(_0x3af6a1){return _0x3af6a1[_0x77a2('0xbe')](_0x5e9891[_0x77a2('0x6f')][_0x77a2('0xb7')],_[_0x77a2('0xb8')](_0x5e9891['body'],[_0x77a2('0xb7'),'id'])||{})[_0x77a2('0xbf')](function(){return db[_0x77a2('0x6a')][_0x77a2('0xbc')]({'attributes':['id','name',_0x77a2('0x44')],'where':{'id':_0x5e9891[_0x77a2('0x6f')][_0x77a2('0xb7')]}});})[_0x77a2('0x31')](function(_0x2a0c54){socket[_0x77a2('0xc0')](_0x77a2('0xc1'),{'id':Number(_0x5e9891[_0x77a2('0xae')]['id']),'tags':_0x2a0c54||[]});return{'id':Number(_0x5e9891['params']['id']),'tags':_0x2a0c54||[]};});}})[_0x77a2('0x31')](respondWithResult(_0x6d3940,null))[_0x77a2('0xb2')](handleError(_0x6d3940,null));};exports[_0x77a2('0xc2')]=function(_0x3f2db4,_0x134f76,_0x3b756c){return db['SmsInteraction'][_0x77a2('0x5b')]({'where':{'id':_0x3f2db4['params']['id']}})['then'](handleEntityNotFound(_0x134f76,null))['then'](function(_0x2bb951){if(_0x2bb951){return _0x2bb951['removeTags'](_0x3f2db4['query'][_0x77a2('0xb7')]);}})[_0x77a2('0x31')](respondWithStatusCode(_0x134f76,null))['catch'](handleError(_0x134f76,null));};exports['download']=function(_0x356d87,_0x472d70){var _0x378402=moment()[_0x77a2('0xc3')]()['toString']();var _0x56088c=path[_0x77a2('0xc4')](config[_0x77a2('0xc5')],_0x77a2('0xc6'),'files',_0x77a2('0xc7'));var _0x5b68fa=path[_0x77a2('0xc4')](config[_0x77a2('0xc5')],_0x77a2('0xc6'),'files','attachments');var _0x4d79b3=path[_0x77a2('0xc4')](_0x56088c,_0x378402);var _0x5675ef=util[_0x77a2('0xba')](_0x77a2('0xc8'),_0x356d87['params']['id'],_0x378402);var _0x47d289=path[_0x77a2('0xc4')](_0x56088c,_0x5675ef);var _0x4a1126=[];_0x4a1126['push']({'model':db[_0x77a2('0x6c')],'as':_0x77a2('0x6c'),'attributes':['id',_0x77a2('0x2c')],'raw':!![]});_0x4a1126[_0x77a2('0xaa')]({'model':db[_0x77a2('0xc9')],'as':_0x77a2('0xca'),'attributes':['id','firstName',_0x77a2('0xcb')],'raw':!![]});var _0x5dc2df=[{'model':db['SmsMessage'],'as':_0x77a2('0xcc'),'attributes':['id',_0x77a2('0x6f'),_0x77a2('0x75'),_0x77a2('0xcd'),'secret',_0x77a2('0x7b')],'include':_0x4a1126}];_0x5dc2df[_0x77a2('0xaa')]({'model':db[_0x77a2('0xce')],'as':_0x77a2('0xcf'),'attributes':['id',_0x77a2('0x2a')]});_0x5dc2df[_0x77a2('0xaa')]({'model':db[_0x77a2('0x6c')],'as':_0x77a2('0xd0'),'attributes':['id','fullname']});return db['SmsInteraction']['find']({'where':{'id':_0x356d87[_0x77a2('0xae')]['id']},'include':_0x5dc2df})[_0x77a2('0x31')](handleEntityNotFound(_0x472d70,null))[_0x77a2('0x31')](function(_0x196e8e){if(_0x196e8e){var _0x50ff2e=_0x196e8e['get']({'plain':!![]});fs[_0x77a2('0xd1')](_0x4d79b3);var _0x241370={'channel':_0x77a2('0xd2'),'account':_0x50ff2e['Account'][_0x77a2('0x2a')],'agent':_0x50ff2e['Owner']?_0x50ff2e[_0x77a2('0xd0')][_0x77a2('0x2c')]:'N.A.','createdAt':moment(_0x50ff2e[_0x77a2('0x75')])[_0x77a2('0xba')](_0x77a2('0xbb'))[_0x77a2('0x94')](),'closedAt':_0x50ff2e[_0x77a2('0xd3')]?moment(_0x50ff2e[_0x77a2('0xd4')])[_0x77a2('0xba')](_0x77a2('0xbb'))[_0x77a2('0x94')]():'','disposition':_0x50ff2e[_0x77a2('0xd5')],'messages':_(_0x50ff2e['Messages'])[_0x77a2('0x81')]({'secret':![]})['map'](function(_0x1becb3){return{'date':moment(_0x1becb3[_0x77a2('0x75')])[_0x77a2('0xba')](_0x77a2('0xbb'))[_0x77a2('0x94')](),'sender':_0x1becb3[_0x77a2('0xcd')]===_0x77a2('0xd6')?_0x1becb3['User']?_0x1becb3['User']['fullname']:_0x77a2('0xd7'):_0x1becb3[_0x77a2('0xca')][_0x77a2('0xd8')]+(_0x1becb3['Contact'][_0x77a2('0xcb')]?'\x20'+_0x1becb3[_0x77a2('0xca')][_0x77a2('0xcb')]:''),'body':_0x1becb3['body'],'direction':_0x1becb3[_0x77a2('0xcd')]==='out'?'A':'C','secret':_0x1becb3['secret'],'read':_0x1becb3[_0x77a2('0x7b')]};})[_0x77a2('0x5d')]()};return ejs[_0x77a2('0xd9')](path[_0x77a2('0xc4')](config[_0x77a2('0xc5')],'server',_0x77a2('0xda'),_0x77a2('0xdb')),{'interaction':_0x241370})[_0x77a2('0x31')](function(_0xd1e1d2){var _0x3671ee=path[_0x77a2('0xc4')](_0x4d79b3,_0x77a2('0xdc')+_0x50ff2e['id']+'-'+_0x378402+_0x77a2('0xdd'));var _0x43fe09={'path':_0x3671ee,'channel':_0x77a2('0xd2'),'interactionId':_0x50ff2e['id']};return pdf[_0x77a2('0xde')](_0xd1e1d2,_0x43fe09);})[_0x77a2('0x31')](function(){return new BPromise(function(_0x3ea979,_0x1993ad){zipdir(_0x4d79b3,{'saveTo':_0x47d289},function(_0x2a4797,_0xf6850a){if(_0x2a4797)return _0x1993ad(_0x2a4797);return _0x3ea979(_0xf6850a);});})[_0x77a2('0x31')](function(){return new BPromise(function(_0x3059c9,_0x26900d){rimraf(_0x4d79b3,function(_0x378f5e){if(_0x378f5e)_0x26900d(_0x378f5e);return _0x3059c9();});});})[_0x77a2('0x31')](function(){return _0x472d70[_0x77a2('0xdf')](_0x47d289,_0x5675ef,function(_0xe7bb3e){if(_0xe7bb3e){console[_0x77a2('0xe0')](_0x77a2('0xe1'),_0xe7bb3e);}else{fs[_0x77a2('0xe2')](_0x47d289);}});});});}else{return _0x472d70[_0x77a2('0x1c')](0xc8);}})[_0x77a2('0xb2')](handleError(_0x472d70,null));}; \ No newline at end of file +var _0xc482=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','index','SmsInteraction','rawAttributes','fieldName','key','model','keys','query','attributes','fields','nolimit','order','sort','where','filters','pick','select','field','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','start','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','i.SmsAccountId\x20IS\x20NULL','role','toString','keyBy','merge','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','sequelize','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','includeAll','options','catch','create','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','intersection','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','color','emit','smsInteractionTags:save','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','lastName','Messages','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','closed','closedAt','direction','out','System','firstName','renderFile','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger'];(function(_0x155041,_0x1f1f67){var _0x362077=function(_0x5ed84b){while(--_0x5ed84b){_0x155041['push'](_0x155041['shift']());}};_0x362077(++_0x1f1f67);}(_0xc482,0x1d2));var _0x2c48=function(_0x177aef,_0x30cc35){_0x177aef=_0x177aef-0x0;var _0x69136=_0xc482[_0x177aef];return _0x69136;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c48('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c48('0x1'));var moment=require(_0x2c48('0x2'));var BPromise=require(_0x2c48('0x3'));var Mustache=require(_0x2c48('0x4'));var util=require(_0x2c48('0x5'));var path=require(_0x2c48('0x6'));var sox=require(_0x2c48('0x7'));var csv=require('to-csv');var ejs=require(_0x2c48('0x8'));var fs=require('fs');var fs_extra=require(_0x2c48('0x9'));var _=require(_0x2c48('0xa'));var squel=require(_0x2c48('0xb'));var crypto=require('crypto');var jsforce=require(_0x2c48('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2c48('0xd'));var querystring=require('querystring');var Papa=require(_0x2c48('0xe'));var Redis=require('ioredis');var authService=require(_0x2c48('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2c48('0x10'));var pdf=require(_0x2c48('0x11'));var hardwareService=require(_0x2c48('0x12'));var logger=require(_0x2c48('0x13'))('api');var utils=require(_0x2c48('0x14'));var config=require(_0x2c48('0x15'));var licenseUtil=require(_0x2c48('0x16'));var db=require(_0x2c48('0x17'))['db'];config[_0x2c48('0x18')]=_[_0x2c48('0x19')](config[_0x2c48('0x18')],{'host':_0x2c48('0x1a'),'port':0x18eb});var socket=require(_0x2c48('0x1b'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x30406f,_0x522b02){_0x522b02=_0x522b02||0xcc;return function(_0x12c6c7){if(_0x12c6c7){return _0x30406f[_0x2c48('0x1c')](_0x522b02);}return _0x30406f['status'](_0x522b02)[_0x2c48('0x1d')]();};}function respondWithResult(_0x17197e,_0x19cd8e){_0x19cd8e=_0x19cd8e||0xc8;return function(_0x22b05b){if(_0x22b05b){return _0x17197e[_0x2c48('0x1e')](_0x19cd8e)[_0x2c48('0x1f')](_0x22b05b);}};}function respondWithFilteredResult(_0x4bb469,_0x351025){return function(_0x4685f3){if(_0x4685f3){var _0x59980b=typeof _0x351025[_0x2c48('0x20')]==='undefined'&&typeof _0x351025[_0x2c48('0x21')]===_0x2c48('0x22');var _0x24447c=_0x4685f3[_0x2c48('0x23')];var _0x2f2ceb=_0x59980b?0x0:_0x351025[_0x2c48('0x20')];var _0x2bfcf9=_0x59980b?_0x4685f3[_0x2c48('0x23')]:_0x351025[_0x2c48('0x20')]+_0x351025['limit'];var _0x254ecb;if(_0x2bfcf9>=_0x24447c){_0x2bfcf9=_0x24447c;_0x254ecb=0xc8;}else{_0x254ecb=0xce;}_0x4bb469[_0x2c48('0x1e')](_0x254ecb);return _0x4bb469[_0x2c48('0x24')](_0x2c48('0x25'),_0x2f2ceb+'-'+_0x2bfcf9+'/'+_0x24447c)[_0x2c48('0x1f')](_0x4685f3);}return null;};}function patchUpdates(_0x2eeeaa){return function(_0x56370c){try{jsonpatch[_0x2c48('0x26')](_0x56370c,_0x2eeeaa,!![]);}catch(_0x58c64d){return BPromise[_0x2c48('0x27')](_0x58c64d);}return _0x56370c[_0x2c48('0x28')]();};}function saveUpdates(_0x4b0931,_0x1e2039){return function(_0x41771d){if(_0x41771d){return _0x41771d[_0x2c48('0x29')](_0x4b0931)[_0x2c48('0x2a')](function(_0xe17128){return _0xe17128;});}return null;};}function removeEntity(_0x2edeb2,_0x16fe6a){return function(_0x5f277c){if(_0x5f277c){return _0x5f277c[_0x2c48('0x2b')]()['then'](function(){_0x2edeb2[_0x2c48('0x1e')](0xcc)[_0x2c48('0x1d')]();});}};}function handleEntityNotFound(_0xa75439,_0x570d17){return function(_0x4af396){if(!_0x4af396){_0xa75439['sendStatus'](0x194);}return _0x4af396;};}function handleError(_0x13fe50,_0x402b56){_0x402b56=_0x402b56||0x1f4;return function(_0x2a20e5){logger[_0x2c48('0x2c')](_0x2a20e5[_0x2c48('0x2d')]);if(_0x2a20e5[_0x2c48('0x2e')]){delete _0x2a20e5[_0x2c48('0x2e')];}_0x13fe50[_0x2c48('0x1e')](_0x402b56)['send'](_0x2a20e5);};}function getInteractionUsers(_0x5abfa5,_0x396944){return new BPromise(function(_0x53d714,_0x5a791e){try{if(_0x396944[_0x5abfa5['id']]){_0x5abfa5[_0x2c48('0x2f')]=_[_0x2c48('0x30')](_0x396944[_0x5abfa5['id']],function(_0x4d52e3){return{'id':_0x4d52e3['id'],'fullname':_0x4d52e3[_0x2c48('0x31')]};});}}catch(_0x579bf1){_0x5a791e(_0x579bf1);}_0x53d714(_0x5abfa5);});}function getInteractionTags(_0x43311a,_0x33fdda){return new BPromise(function(_0x20f99a,_0x9d260a){try{if(_0x43311a[_0x2c48('0x32')]){_0x43311a[_0x2c48('0x33')]=[];_0x43311a['TagIds'][_0x2c48('0x34')](',')[_0x2c48('0x35')](function(_0x2a64ab){_0x43311a['Tags'][_0x2c48('0x36')](_0x33fdda[_0x2a64ab]);});}delete _0x43311a[_0x2c48('0x32')];}catch(_0x327f28){_0x9d260a(_0x327f28);}_0x20f99a(_0x43311a);});}function updateSmsInteraction(_0x2254bb,_0x4eafa9,_0x4374dc){return new BPromise(function(_0x173e46,_0x53caf4){return getInteractionUsers(_0x2254bb,_0x4374dc)['then'](function(_0x2ef6d6){return getInteractionTags(_0x2ef6d6,_0x4eafa9);})['then'](function(_0x376322){_0x173e46(_0x376322);})['catch'](function(_0x205dad){_0x53caf4(_0x205dad);});});}exports[_0x2c48('0x37')]=function(_0xf4b8b2,_0x598ae2){var _0x176f4e={},_0x59bbb3={},_0x47d016={'count':0x0,'rows':[]};var _0x3f4fec=_[_0x2c48('0x30')](db[_0x2c48('0x38')][_0x2c48('0x39')],function(_0x112bb7){return{'name':_0x112bb7[_0x2c48('0x3a')],'type':_0x112bb7['type'][_0x2c48('0x3b')]};});_0x59bbb3[_0x2c48('0x3c')]=_['map'](_0x3f4fec,_0x2c48('0x2e'));_0x59bbb3['query']=_[_0x2c48('0x3d')](_0xf4b8b2[_0x2c48('0x3e')]);_0x59bbb3['filters']=_['intersection'](_0x59bbb3[_0x2c48('0x3c')],_0x59bbb3[_0x2c48('0x3e')]);_0x176f4e[_0x2c48('0x3f')]=_['intersection'](_0x59bbb3[_0x2c48('0x3c')],qs[_0x2c48('0x40')](_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x40')]));_0x176f4e[_0x2c48('0x3f')]=_0x176f4e[_0x2c48('0x3f')]['length']?_0x176f4e[_0x2c48('0x3f')]:_0x59bbb3[_0x2c48('0x3c')];if(!_0xf4b8b2[_0x2c48('0x3e')]['hasOwnProperty'](_0x2c48('0x41'))){_0x176f4e[_0x2c48('0x21')]=qs[_0x2c48('0x21')](_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x21')]);_0x176f4e[_0x2c48('0x20')]=qs[_0x2c48('0x20')](_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x20')]);}_0x176f4e[_0x2c48('0x42')]=qs[_0x2c48('0x43')](_0xf4b8b2['query']['sort']);_0x176f4e[_0x2c48('0x44')]=qs[_0x2c48('0x45')](_[_0x2c48('0x46')](_0xf4b8b2[_0x2c48('0x3e')],_0x59bbb3[_0x2c48('0x45')]),_0x3f4fec);var _0x186714=[];var _0x26f31a=squel[_0x2c48('0x47')]()[_0x2c48('0x48')]('id')['field']('name')[_0x2c48('0x48')]('color')[_0x2c48('0x49')]('tools_tags');var _0x4757d7=squel[_0x2c48('0x47')]()[_0x2c48('0x48')](_0x2c48('0x4a'))['field'](_0x2c48('0x4b'))[_0x2c48('0x48')](_0x2c48('0x4c'))['from'](_0x2c48('0x4d'),'ui')[_0x2c48('0x4e')]('users','u',_0x2c48('0x4f'));var _0x1d8664=squel[_0x2c48('0x47')]()[_0x2c48('0x49')](_0x2c48('0x50'),'i')[_0x2c48('0x4e')](_0x2c48('0x51'),'c',_0x2c48('0x52'))[_0x2c48('0x4e')](_0x2c48('0x53'),'o',_0x2c48('0x54'))[_0x2c48('0x4e')](_0x2c48('0x55'),'a',_0x2c48('0x56'))['left_join']('sms_messages','me',_0x2c48('0x57'))[_0x2c48('0x4e')](_0x2c48('0x58'),'it',_0x2c48('0x59'))['left_join'](_0x2c48('0x5a'),'t',_0x2c48('0x5b'));var _0x1ade35=squel[_0x2c48('0x5c')]();var _0x1f4820=[];var _0x8964f3=squel[_0x2c48('0x5c')]();var _0x3baaf1;if(_0xf4b8b2['query']['search']){_0x3baaf1=as[_0x2c48('0x5d')](_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x5e')]);var _0x37dc80=_0x3baaf1['sqlOperator'];for(var _0x45caec=0x0;_0x45caec<_0x3baaf1['conditions']['length'];_0x45caec++){var _0x40d07d=_0x3baaf1[_0x2c48('0x5f')][_0x45caec];var _0x5abc98='i';var _0x3aad62=_[_0x2c48('0x60')](_0x3f4fec,[_0x2c48('0x2e'),_0x40d07d[_0x2c48('0x48')]]);if(!_0x3aad62){switch(_0x40d07d[_0x2c48('0x48')]){case'unreadMessages':if(_0x40d07d[_0x2c48('0x61')]==0x1){_0x1d8664[_0x2c48('0x62')]('`'+_0x40d07d['field']+_0x2c48('0x63'));}else{_0x1d8664[_0x2c48('0x62')]('`'+_0x40d07d[_0x2c48('0x48')]+_0x2c48('0x64'));}break;case _0x2c48('0x65'):if(_0x40d07d[_0x2c48('0x66')]===_0x2c48('0x67')){if(_0x40d07d[_0x2c48('0x61')]['split']('\x20')[_0x2c48('0x68')]>0x1){_0x1ade35[_0x37dc80](_0x2c48('0x69'),qs[_0x2c48('0x6a')](_0x40d07d[_0x2c48('0x61')]),null);}else{var _0xff7759='%'+_0x40d07d[_0x2c48('0x61')]+'%';_0x1ade35[_0x37dc80](_0x2c48('0x6b'),_0xff7759,_0xff7759,_0xff7759);}}else{_0x3aad62=_[_0x2c48('0x60')](_0x3f4fec,[_0x2c48('0x2e'),_0x2c48('0x6c')]);_0x40d07d[_0x2c48('0x48')]=_0x2c48('0x6c');_0x104a5f=as['buildExpression'](_0x5abc98,_0x3aad62[_0x2c48('0x6d')],_0x40d07d);_0x1ade35[_0x37dc80](_0x104a5f[_0x2c48('0x6e')],_0x104a5f['value']['start'],_0x104a5f[_0x2c48('0x61')][_0x2c48('0x1d')]);}break;case _0x2c48('0x6f'):var _0x2165c4=_0x40d07d[_0x2c48('0x61')][_0x2c48('0x34')](',')['map'](function(_0x26c6f2){return Number(_0x26c6f2);});_0x2165c4[_0x2c48('0x35')](function(_0x439ab1){_0x8964f3['or'](_0x2c48('0x70'),'%,'+_0x439ab1+',%');});_0x1f4820=_[_0x2c48('0x71')](_0x1f4820,_0x2165c4);break;case _0x2c48('0x72'):if(_0x40d07d[_0x2c48('0x66')]===_0x2c48('0x67')){_0x1ade35[_0x37dc80](_0x2c48('0x73'),'%'+_0x40d07d['value']+'%',null);}else{_0x3aad62=_[_0x2c48('0x60')](_0x3f4fec,[_0x2c48('0x2e'),_0x2c48('0x74')]);_0x40d07d['field']='UserId';_0x104a5f=as[_0x2c48('0x75')](_0x5abc98,_0x3aad62[_0x2c48('0x6d')],_0x40d07d);_0x1ade35[_0x37dc80](_0x104a5f[_0x2c48('0x6e')],_0x104a5f[_0x2c48('0x61')]['start'],_0x104a5f[_0x2c48('0x61')]['end']);}break;case _0x2c48('0x76'):_0x104a5f=as[_0x2c48('0x75')]('me',null,_0x40d07d);_0x1ade35[_0x37dc80](_0x104a5f[_0x2c48('0x6e')],_0x104a5f['value']['start'],_0x104a5f[_0x2c48('0x61')][_0x2c48('0x1d')]);break;}}else{var _0x104a5f=as[_0x2c48('0x75')](_0x5abc98,_0x3aad62[_0x2c48('0x6d')],_0x40d07d);_0x1ade35[_0x37dc80](_0x104a5f[_0x2c48('0x6e')],_0x104a5f[_0x2c48('0x61')][_0x2c48('0x77')],_0x104a5f[_0x2c48('0x61')][_0x2c48('0x1d')]);}}}else{var _0x46ba32=_(_0xf4b8b2['query'])['keys']()['map'](function(_0x3eaa5f){return _[_0x2c48('0x78')](_0x3f4fec,[_0x2c48('0x2e'),_0x3eaa5f])?_0x3eaa5f:undefined;})['compact']()[_0x2c48('0x61')]();if(!_[_0x2c48('0x79')](_0x46ba32)){_0x46ba32['forEach'](function(_0x5c27c5){if(_0x5c27c5===_0x2c48('0x7a')){_0x1d8664[_0x2c48('0x44')](_0x2c48('0x7b'),[]['concat'](_0xf4b8b2[_0x2c48('0x3e')][_0x5c27c5]));}else if(_0x5c27c5===_0x2c48('0x7c')){var _0x3a1d36=JSON[_0x2c48('0x7d')](_0xf4b8b2[_0x2c48('0x3e')][_0x5c27c5])[_0x2c48('0x7e')];var _0x2e2536=JSON[_0x2c48('0x7d')](_0xf4b8b2[_0x2c48('0x3e')][_0x5c27c5])[_0x2c48('0x7f')];_0x1d8664[_0x2c48('0x44')](_0x2c48('0x80'),_0x3a1d36,_0x2e2536);}else{if(_0xf4b8b2[_0x2c48('0x3e')][_0x5c27c5]===_0x2c48('0x81')){_0x1d8664[_0x2c48('0x44')]('i.'+_0x5c27c5+_0x2c48('0x82'));}else{_0x1d8664[_0x2c48('0x44')]('i.'+_0x5c27c5+_0x2c48('0x83'),_0xf4b8b2[_0x2c48('0x3e')][_0x5c27c5]);}}});}if(_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x84')]){if(_0xf4b8b2['query'][_0x2c48('0x84')]==0x1){_0x1d8664['having'](_0x2c48('0x85'));}else{_0x1d8664[_0x2c48('0x62')](_0x2c48('0x86'));}}if(_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x87')]){_0x1f4820=_[_0x2c48('0x88')](_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x87')])?_0xf4b8b2['query']['tag']:new Array(_0xf4b8b2['query']['tag']);_0x1f4820[_0x2c48('0x35')](function(_0x4e84fb){_0x8964f3['or'](_0x2c48('0x70'),'%,'+_0x4e84fb+',%');});}if(_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x89')]){var _0x4d0b5d=_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x89')][_0x2c48('0x8a')]('\x5c','\x5c\x5c')[_0x2c48('0x8a')](/'/g,'\x27\x27');if(qs[_0x2c48('0x8b')](_0x4d0b5d)){_0x1ade35['or'](_0x2c48('0x8c'),_0x4d0b5d+'%')['or'](_0x2c48('0x8d'),_0x4d0b5d+'%');}else{_0x1ade35['or'](_0x2c48('0x8e'),qs[_0x2c48('0x6a')](_0x4d0b5d))['or'](_0x2c48('0x8f'),_0x4d0b5d+'%');}}}_0x1d8664[_0x2c48('0x44')](_0x1ade35);_0x1d8664[_0x2c48('0x90')](_0x2c48('0x91'));var _0x41dd5a={'type':db[_0x2c48('0x92')][_0x2c48('0x93')][_0x2c48('0x94')],'raw':!![]};var _0x3b6a39=_0x1d8664[_0x2c48('0x95')]();_0x3b6a39['field'](_0x2c48('0x91'));_0x3b6a39[_0x2c48('0x48')](_0x2c48('0x96'),'unreadMessages');if(_0x176f4e[_0x2c48('0x42')]){_0x176f4e[_0x2c48('0x42')][_0x2c48('0x35')](function(_0x1cabfd){var _0x356331=_0x1cabfd[0x0]===_0x2c48('0x97')?_0x1cabfd[0x0]:'i.'+_0x1cabfd[0x0];_0x1d8664[_0x2c48('0x42')](_0x356331,_0x1cabfd[0x1]===_0x2c48('0x98')?![]:!![]);});}if(!_[_0x2c48('0x79')](_0x1f4820)){_0x1d8664[_0x2c48('0x62')](_0x8964f3);_0x3b6a39[_0x2c48('0x44')](_0x2c48('0x99'),_0x1f4820);}BPromise[_0x2c48('0x9a')]()['then'](function(){if(!_0x3baaf1){if(_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x7a')])return;_0x3b6a39[_0x2c48('0x44')](_0x2c48('0x9b'));_0x1d8664[_0x2c48('0x44')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xf4b8b2['user']['role']!==_0x2c48('0x9c'))return;return _0xf4b8b2[_0x2c48('0x9d')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x1c1087){if(_['isEmpty'](_0x1c1087)){_0x3b6a39[_0x2c48('0x44')](_0x2c48('0x9e'));_0x1d8664[_0x2c48('0x44')](_0x2c48('0x9e'));}else{_0x3b6a39[_0x2c48('0x44')]('i.SmsAccountId\x20IN\x20?',_[_0x2c48('0x30')](_0x1c1087,'id'));_0x1d8664['where'](_0x2c48('0x7b'),_[_0x2c48('0x30')](_0x1c1087,'id'));}});})[_0x2c48('0x2a')](function(){if(_0xf4b8b2[_0x2c48('0x9d')][_0x2c48('0x9f')]===_0x2c48('0x9c')&&!_0x3baaf1&&!_0xf4b8b2[_0x2c48('0x3e')][_0x2c48('0x7a')])return[];return db['sequelize']['query'](_0x3b6a39[_0x2c48('0xa0')](),_0x41dd5a);})['then'](function(_0x573fbd){_0x47d016[_0x2c48('0x23')]=_0x573fbd[_0x2c48('0x68')];if(_0x47d016['count']===0x0)return[];return db['sequelize'][_0x2c48('0x3e')](_0x26f31a[_0x2c48('0xa0')](),_0x41dd5a)[_0x2c48('0x2a')](function(_0x2e870a){_0x186714=_[_0x2c48('0xa1')](_0x2e870a,'id');_0x41dd5a=_[_0x2c48('0xa2')](_0x41dd5a,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf4b8b2[_0x2c48('0x3e')]['fields']){_0x176f4e['attributes'][_0x2c48('0x35')](function(_0x1482b4){_0x1d8664[_0x2c48('0x48')]('i.'+_0x1482b4);});}else{_0x1d8664[_0x2c48('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2c48('0xa3'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xa4'),_0x2c48('0xa5'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xa6'),_0x2c48('0xa7'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xa8'),_0x2c48('0x97'));_0x1d8664['field'](_0x2c48('0xa9'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xaa'),_0x2c48('0xab'));_0x1d8664['field']('c.lastName',_0x2c48('0xac'));_0x1d8664[_0x2c48('0x48')]('c.email',_0x2c48('0xad'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xae'),_0x2c48('0xaf'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xb0'),'Contact.mobile');_0x1d8664['field'](_0x2c48('0xb1'),_0x2c48('0xb2'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xb3'),_0x2c48('0xb4'));_0x1d8664[_0x2c48('0x48')](_0x2c48('0xb5'),_0x2c48('0xb6'));_0x1d8664[_0x2c48('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2c48('0x32'));}if(_0x176f4e[_0x2c48('0x21')])_0x1d8664[_0x2c48('0x21')](_0x176f4e['limit']);if(_0x176f4e[_0x2c48('0x20')])_0x1d8664['offset'](_0x176f4e[_0x2c48('0x20')]);return db[_0x2c48('0xb7')]['query'](_0x1d8664[_0x2c48('0xa0')](),_0x41dd5a);})[_0x2c48('0x2a')](function(_0x1c041b){if(_0x1c041b[_0x2c48('0x68')]>0x0)_0x4757d7[_0x2c48('0x44')](_0x2c48('0xb8'),_[_0x2c48('0x30')](_0x1c041b,'id'));return db['sequelize'][_0x2c48('0x3e')](_0x4757d7[_0x2c48('0xa0')](),_0x41dd5a)['then'](function(_0x432073){var _0x18655a=_[_0x2c48('0xb9')](_0x432073,_0x2c48('0xba'));var _0x225a46=[];_0x1c041b['forEach'](function(_0x16fba3){_0x225a46[_0x2c48('0x36')](updateSmsInteraction(_0x16fba3,_0x186714,_0x18655a));});return BPromise[_0x2c48('0xbb')](_0x225a46);});});})[_0x2c48('0x2a')](function(_0x7449c1){_0x47d016[_0x2c48('0xbc')]=_0x7449c1;return _0x47d016;})['then'](respondWithFilteredResult(_0x598ae2,_0x176f4e))['catch'](handleError(_0x598ae2,null));};exports['show']=function(_0x26c39a,_0x5ef669){var _0x4d6dd7={'raw':![],'where':{'id':_0x26c39a[_0x2c48('0xbd')]['id']}},_0xc47f7f={};_0xc47f7f[_0x2c48('0x3c')]=_[_0x2c48('0x3d')](db[_0x2c48('0x38')][_0x2c48('0x39')]);_0xc47f7f['query']=_[_0x2c48('0x3d')](_0x26c39a['query']);_0xc47f7f[_0x2c48('0x45')]=_['intersection'](_0xc47f7f[_0x2c48('0x3c')],_0xc47f7f[_0x2c48('0x3e')]);_0x4d6dd7[_0x2c48('0x3f')]=_['intersection'](_0xc47f7f[_0x2c48('0x3c')],qs[_0x2c48('0x40')](_0x26c39a['query']['fields']));_0x4d6dd7['attributes']=_0x4d6dd7[_0x2c48('0x3f')][_0x2c48('0x68')]?_0x4d6dd7[_0x2c48('0x3f')]:_0xc47f7f[_0x2c48('0x3c')];if(_0x26c39a[_0x2c48('0x3e')][_0x2c48('0xbe')]){_0x4d6dd7['include']=[{'all':!![]}];}_0x4d6dd7=_[_0x2c48('0xa2')]({},_0x4d6dd7,_0x26c39a[_0x2c48('0xbf')]);return db['SmsInteraction'][_0x2c48('0x60')](_0x4d6dd7)['then'](handleEntityNotFound(_0x5ef669,null))['then'](respondWithResult(_0x5ef669,null))[_0x2c48('0xc0')](handleError(_0x5ef669,null));};exports[_0x2c48('0xc1')]=function(_0x1afa62,_0x5e7c6e){return db[_0x2c48('0x38')][_0x2c48('0xc1')](_0x1afa62[_0x2c48('0x76')],{})[_0x2c48('0x2a')](respondWithResult(_0x5e7c6e,0xc9))['catch'](handleError(_0x5e7c6e,null));};exports['update']=function(_0x33e807,_0x368136){if(_0x33e807['body']['id']){delete _0x33e807['body']['id'];}return db[_0x2c48('0x38')][_0x2c48('0x60')]({'where':{'id':_0x33e807[_0x2c48('0xbd')]['id']}})[_0x2c48('0x2a')](handleEntityNotFound(_0x368136,null))['then'](saveUpdates(_0x33e807['body'],null))[_0x2c48('0x2a')](respondWithResult(_0x368136,null))['catch'](handleError(_0x368136,null));};exports['destroy']=function(_0x4b7657,_0x54b487){return db[_0x2c48('0x38')][_0x2c48('0x60')]({'where':{'id':_0x4b7657[_0x2c48('0xbd')]['id']}})[_0x2c48('0x2a')](handleEntityNotFound(_0x54b487,null))[_0x2c48('0x2a')](removeEntity(_0x54b487,null))['catch'](handleError(_0x54b487,null));};exports[_0x2c48('0xc2')]=function(_0x1de814,_0x336071){return db[_0x2c48('0x38')][_0x2c48('0xc2')]()[_0x2c48('0x2a')](respondWithResult(_0x336071,null))[_0x2c48('0xc0')](handleError(_0x336071,null));};exports[_0x2c48('0xc3')]=function(_0x2e649e,_0x4c2404,_0x2cf6df){return db['SmsMessage'][_0x2c48('0x60')]({'where':{'id':_0x2e649e[_0x2c48('0xbd')]['id']}})[_0x2c48('0x2a')](handleEntityNotFound(_0x4c2404,null))[_0x2c48('0x2a')](function(_0x5bdddb){if(_0x5bdddb){return _0x5bdddb[_0x2c48('0xc3')](_0x2e649e['body'][_0x2c48('0xc4')],_[_0x2c48('0xc5')](_0x2e649e[_0x2c48('0x76')],['ids','id'])||{});}})[_0x2c48('0x2a')](respondWithResult(_0x4c2404,null))['catch'](handleError(_0x4c2404,null));};exports[_0x2c48('0xc6')]=function(_0x2b2c32,_0x1bf12d,_0x4906af){var _0x22097f={'raw':![],'where':{}};var _0x30f747={};var _0x140075={'count':0x0,'rows':[]};return db[_0x2c48('0x38')][_0x2c48('0xc7')]({'where':{'id':_0x2b2c32['params']['id']}})[_0x2c48('0x2a')](handleEntityNotFound(_0x1bf12d,null))[_0x2c48('0x2a')](function(_0x3c8853){if(_0x3c8853){_0x30f747[_0x2c48('0x3c')]=_[_0x2c48('0x3d')](db[_0x2c48('0xc8')]['rawAttributes']);_0x30f747[_0x2c48('0x3e')]=_['keys'](_0x2b2c32[_0x2c48('0x3e')]);_0x30f747[_0x2c48('0x45')]=_[_0x2c48('0xc9')](_0x30f747[_0x2c48('0x3c')],_0x30f747[_0x2c48('0x3e')]);_0x22097f[_0x2c48('0x3f')]=_[_0x2c48('0xc9')](_0x30f747[_0x2c48('0x3c')],qs['fields'](_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x40')]));_0x22097f[_0x2c48('0x3f')]=_0x22097f[_0x2c48('0x3f')][_0x2c48('0x68')]?_0x22097f[_0x2c48('0x3f')]:_0x30f747[_0x2c48('0x3c')];if(!_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0xca')]('nolimit')){_0x22097f[_0x2c48('0x21')]=qs[_0x2c48('0x21')](_0x2b2c32[_0x2c48('0x3e')]['limit']);_0x22097f[_0x2c48('0x20')]=qs[_0x2c48('0x20')](_0x2b2c32[_0x2c48('0x3e')]['offset']);}_0x22097f['order']=qs[_0x2c48('0x43')](_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x43')]);_0x22097f['where']=qs[_0x2c48('0x45')](_['pick'](_0x2b2c32[_0x2c48('0x3e')],_0x30f747[_0x2c48('0x45')]));_0x22097f['where'][_0x2c48('0xba')]=_0x3c8853['id'];if(_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x89')]){_0x22097f[_0x2c48('0x44')]=_[_0x2c48('0xa2')](_0x22097f[_0x2c48('0x44')],{'$or':_[_0x2c48('0x30')](_0x22097f[_0x2c48('0x3f')],function(_0x3d0a38){var _0x2e6124={};_0x2e6124[_0x3d0a38]={'$like':'%'+_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x89')]+'%'};return _0x2e6124;})});}if(_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x7e')]){var _0x4607e6=_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0x7e')][_0x2c48('0x34')](',');var _0x5c46b8={};_0x5c46b8[_0x4607e6[0x0]]={'$gte':moment(_0x4607e6[0x1])[_0x2c48('0xcb')](_0x2c48('0xcc'))};_0x22097f[_0x2c48('0x44')]=_[_0x2c48('0xa2')](_0x22097f[_0x2c48('0x44')],_0x5c46b8);}_0x22097f=_[_0x2c48('0xa2')]({},_0x22097f,_0x2b2c32['options']);return db['SmsMessage'][_0x2c48('0x23')]({'where':_0x22097f['where']})[_0x2c48('0x2a')](function(_0xa0f57e){_0x140075['count']=_0xa0f57e;if(_0x2b2c32[_0x2c48('0x3e')][_0x2c48('0xbe')]){_0x22097f[_0x2c48('0xcd')]=[{'all':!![]}];}return db[_0x2c48('0xc8')]['findAll'](_0x22097f);})[_0x2c48('0x2a')](function(_0x81689d){_0x140075['rows']=_0x81689d;return _0x140075;});}})['then'](respondWithFilteredResult(_0x1bf12d,_0x22097f))[_0x2c48('0xc0')](handleError(_0x1bf12d,null));};exports[_0x2c48('0xce')]=function(_0x17d12f,_0x18ecac,_0x396ad8){return db[_0x2c48('0x38')]['find']({'where':{'id':_0x17d12f[_0x2c48('0xbd')]['id']}})[_0x2c48('0x2a')](handleEntityNotFound(_0x18ecac,null))[_0x2c48('0x2a')](function(_0x16d51c){if(_0x16d51c){return _0x16d51c[_0x2c48('0xcf')](_0x17d12f[_0x2c48('0x76')][_0x2c48('0xc4')],_[_0x2c48('0xc5')](_0x17d12f['body'],[_0x2c48('0xc4'),'id'])||{})[_0x2c48('0xd0')](function(){return db['Tag']['findAll']({'attributes':['id',_0x2c48('0x2e'),_0x2c48('0xd1')],'where':{'id':_0x17d12f[_0x2c48('0x76')]['ids']}});})[_0x2c48('0x2a')](function(_0x2ec8c9){socket[_0x2c48('0xd2')](_0x2c48('0xd3'),{'id':Number(_0x17d12f['params']['id']),'tags':_0x2ec8c9||[]});return{'id':Number(_0x17d12f[_0x2c48('0xbd')]['id']),'tags':_0x2ec8c9||[]};});}})[_0x2c48('0x2a')](respondWithResult(_0x18ecac,null))[_0x2c48('0xc0')](handleError(_0x18ecac,null));};exports['removeTags']=function(_0x457805,_0x25fec8,_0x4fc11d){return db['SmsInteraction'][_0x2c48('0x60')]({'where':{'id':_0x457805[_0x2c48('0xbd')]['id']}})['then'](handleEntityNotFound(_0x25fec8,null))[_0x2c48('0x2a')](function(_0x2317f2){if(_0x2317f2){return _0x2317f2['removeTags'](_0x457805[_0x2c48('0x3e')][_0x2c48('0xc4')]);}})['then'](respondWithStatusCode(_0x25fec8,null))[_0x2c48('0xc0')](handleError(_0x25fec8,null));};exports[_0x2c48('0xd4')]=function(_0xf3a024,_0x181c6a){var _0x56846e=moment()['unix']()['toString']();var _0x59db8d=path[_0x2c48('0xd5')](config[_0x2c48('0xd6')],_0x2c48('0xd7'),_0x2c48('0xd8'),_0x2c48('0xd9'));var _0x5d3ceb=path[_0x2c48('0xd5')](config[_0x2c48('0xd6')],'server','files',_0x2c48('0xda'));var _0x4aa29c=path[_0x2c48('0xd5')](_0x59db8d,_0x56846e);var _0x310267=util[_0x2c48('0xcb')](_0x2c48('0xdb'),_0xf3a024[_0x2c48('0xbd')]['id'],_0x56846e);var _0x849279=path[_0x2c48('0xd5')](_0x59db8d,_0x310267);var _0x5ad6c6=[];_0x5ad6c6[_0x2c48('0x36')]({'model':db['User'],'as':_0x2c48('0x72'),'attributes':['id',_0x2c48('0x31')],'raw':!![]});_0x5ad6c6[_0x2c48('0x36')]({'model':db[_0x2c48('0xdc')],'as':_0x2c48('0x65'),'attributes':['id','firstName',_0x2c48('0xdd')],'raw':!![]});var _0x553978=[{'model':db[_0x2c48('0xc8')],'as':_0x2c48('0xde'),'attributes':['id',_0x2c48('0x76'),'createdAt','direction',_0x2c48('0xdf'),_0x2c48('0x84')],'include':_0x5ad6c6}];_0x553978[_0x2c48('0x36')]({'model':db[_0x2c48('0xe0')],'as':_0x2c48('0xe1'),'attributes':['id',_0x2c48('0x2e')]});_0x553978['push']({'model':db[_0x2c48('0x72')],'as':_0x2c48('0xe2'),'attributes':['id',_0x2c48('0x31')]});return db[_0x2c48('0x38')][_0x2c48('0x60')]({'where':{'id':_0xf3a024[_0x2c48('0xbd')]['id']},'include':_0x553978})[_0x2c48('0x2a')](handleEntityNotFound(_0x181c6a,null))[_0x2c48('0x2a')](function(_0x126767){if(_0x126767){var _0x8ca709=_0x126767[_0x2c48('0xe3')]({'plain':!![]});fs[_0x2c48('0xe4')](_0x4aa29c);var _0x5b5652={'channel':_0x2c48('0xe5'),'account':_0x8ca709[_0x2c48('0xe1')]['name'],'agent':_0x8ca709[_0x2c48('0xe2')]?_0x8ca709[_0x2c48('0xe2')]['fullname']:'N.A.','createdAt':moment(_0x8ca709[_0x2c48('0x7c')])['format'](_0x2c48('0xcc'))[_0x2c48('0xa0')](),'closedAt':_0x8ca709[_0x2c48('0xe6')]?moment(_0x8ca709[_0x2c48('0xe7')])['format'](_0x2c48('0xcc'))[_0x2c48('0xa0')]():'','disposition':_0x8ca709['disposition'],'messages':_(_0x8ca709[_0x2c48('0xde')])[_0x2c48('0x89')]({'secret':![]})['map'](function(_0x6a5d7){return{'date':moment(_0x6a5d7['createdAt'])[_0x2c48('0xcb')](_0x2c48('0xcc'))[_0x2c48('0xa0')](),'sender':_0x6a5d7[_0x2c48('0xe8')]===_0x2c48('0xe9')?_0x6a5d7[_0x2c48('0x72')]?_0x6a5d7[_0x2c48('0x72')]['fullname']:_0x2c48('0xea'):_0x6a5d7[_0x2c48('0x65')][_0x2c48('0xeb')]+(_0x6a5d7[_0x2c48('0x65')][_0x2c48('0xdd')]?'\x20'+_0x6a5d7[_0x2c48('0x65')][_0x2c48('0xdd')]:''),'body':_0x6a5d7[_0x2c48('0x76')],'direction':_0x6a5d7[_0x2c48('0xe8')]===_0x2c48('0xe9')?'A':'C','secret':_0x6a5d7['secret'],'read':_0x6a5d7[_0x2c48('0x84')]};})['value']()};return ejs[_0x2c48('0xec')](path[_0x2c48('0xd5')](config[_0x2c48('0xd6')],_0x2c48('0xd7'),'views','downloadInteraction.ejs'),{'interaction':_0x5b5652})[_0x2c48('0x2a')](function(_0x5c26bd){var _0x290538=path[_0x2c48('0xd5')](_0x4aa29c,_0x2c48('0xed')+_0x8ca709['id']+'-'+_0x56846e+_0x2c48('0xee'));var _0x3969bf={'path':_0x290538,'channel':_0x2c48('0xe5'),'interactionId':_0x8ca709['id']};return pdf[_0x2c48('0xef')](_0x5c26bd,_0x3969bf);})[_0x2c48('0x2a')](function(){return new BPromise(function(_0x446171,_0x78fd72){zipdir(_0x4aa29c,{'saveTo':_0x849279},function(_0x16ba58,_0xeb7b00){if(_0x16ba58)return _0x78fd72(_0x16ba58);return _0x446171(_0xeb7b00);});})['then'](function(){return new BPromise(function(_0x1cdb2b,_0x1ede8b){rimraf(_0x4aa29c,function(_0x5deb43){if(_0x5deb43)_0x1ede8b(_0x5deb43);return _0x1cdb2b();});});})[_0x2c48('0x2a')](function(){return _0x181c6a[_0x2c48('0xd4')](_0x849279,_0x310267,function(_0x3b8141){if(_0x3b8141){console[_0x2c48('0xf0')](_0x2c48('0xf1'),_0x3b8141);}else{fs[_0x2c48('0xf2')](_0x849279);}});});});}else{return _0x181c6a[_0x2c48('0x1c')](0xc8);}})[_0x2c48('0xc0')](handleError(_0x181c6a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index dc0e4ea..b2f0691 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 _0x8603=['update','remove','getUsers','then','setDataValue','findAll','unreadMessages','emit','hasOwnProperty','hook','../../mysqldb','SmsInteraction','save'];(function(_0x4baa4c,_0x2ff5e1){var _0x28e7b1=function(_0x4d32a0){while(--_0x4d32a0){_0x4baa4c['push'](_0x4baa4c['shift']());}};_0x28e7b1(++_0x2ff5e1);}(_0x8603,0x190));var _0x3860=function(_0x10b1d0,_0x2adfa9){_0x10b1d0=_0x10b1d0-0x0;var _0x1bc06f=_0x8603[_0x10b1d0];return _0x1bc06f;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x3860('0x0'))['db'][_0x3860('0x1')];var SmsMessage=require(_0x3860('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3860('0x2'),'afterUpdate':_0x3860('0x3'),'afterDestroy':_0x3860('0x4')};function emitEvent(_0x490262){return function(_0x2fc97a,_0x56f8c5,_0xb0fc24){_0x2fc97a[_0x3860('0x5')]({'attributes':['id'],'raw':!![]})[_0x3860('0x6')](function(_0xd3ce26){_0x2fc97a[_0x3860('0x7')]('Users',_0xd3ce26['map'](function(_0x5b1ac8){return{'id':_0x5b1ac8['id']};}));return SmsMessage[_0x3860('0x8')]({'where':{'SmsInteractionId':_0x2fc97a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3860('0x6')](function(_0x52c277){_0x2fc97a[_0x3860('0x7')](_0x3860('0x9'),_0x52c277['length']);SmsInteractionEvents[_0x3860('0xa')](_0x490262+':'+_0x2fc97a['id'],_0x2fc97a);SmsInteractionEvents[_0x3860('0xa')](_0x490262,_0x2fc97a);_0xb0fc24(null);})['catch'](_0xb0fc24(null));};}for(var e in events){if(events[_0x3860('0xb')](e)){var event=events[e];SmsInteraction[_0x3860('0xc')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x41f9c3,_0x53117c){var _0x1201b3=function(_0x1d505e){while(--_0x1d505e){_0x41f9c3['push'](_0x41f9c3['shift']());}};_0x1201b3(++_0x53117c);}(_0xadb5,0xad));var _0x5adb=function(_0x56d871,_0x5cb372){_0x56d871=_0x56d871-0x0;var _0x2c2356=_0xadb5[_0x56d871];return _0x2c2356;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5adb('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return SmsMessage[_0x5adb('0xa')]({'where':{'SmsInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);SmsInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);SmsInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 3541fc3..f680e00 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 _0x9b96=['path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise'];(function(_0x1b4912,_0x3e8bb9){var _0x48cac5=function(_0x55798b){while(--_0x55798b){_0x1b4912['push'](_0x1b4912['shift']());}};_0x48cac5(++_0x3e8bb9);}(_0x9b96,0x17b));var _0x69b9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9b96[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x69b9('0x0'));var logger=require(_0x69b9('0x1'))(_0x69b9('0x2'));var moment=require(_0x69b9('0x3'));var BPromise=require('bluebird');var rp=require(_0x69b9('0x4'));var fs=require('fs');var path=require(_0x69b9('0x5'));var rimraf=require(_0x69b9('0x6'));var config=require('../../config/environment');var attributes=require(_0x69b9('0x7'));module[_0x69b9('0x8')]=function(_0x2be451,_0x3030a5){return _0x2be451[_0x69b9('0x9')](_0x69b9('0xa'),attributes,{'tableName':_0x69b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3beef1,_0x3d7e98,_0x152cda){if(_0x3beef1['changed'](_0x69b9('0xc'))){_0x3beef1[_0x69b9('0xd')]=moment()[_0x69b9('0xe')](_0x69b9('0xf'));}_0x152cda(null,_0x3beef1);}}});}; \ No newline at end of file +var _0x5694=['./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5694,0x18f));var _0x4569=function(_0x2dbc96,_0x4e1677){_0x2dbc96=_0x2dbc96-0x0;var _0x35f4d0=_0x5694[_0x2dbc96];return _0x35f4d0;};'use strict';var _=require('lodash');var util=require(_0x4569('0x0'));var logger=require(_0x4569('0x1'))(_0x4569('0x2'));var moment=require(_0x4569('0x3'));var BPromise=require('bluebird');var rp=require(_0x4569('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4569('0x5'));var attributes=require(_0x4569('0x6'));module['exports']=function(_0x28d642,_0xb4b574){return _0x28d642[_0x4569('0x7')](_0x4569('0x8'),attributes,{'tableName':_0x4569('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x70d9ca,_0x4d7210,_0x1e083c){if(_0x70d9ca[_0x4569('0xa')](_0x4569('0xb'))){_0x70d9ca[_0x4569('0xc')]=moment()[_0x4569('0xd')](_0x4569('0xe'));}_0x1e083c(null,_0x70d9ca);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 47188e5..d804735 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 _0x6776=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./smsInteraction.socket','request','then','info','request\x20sent','debug','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','body','options','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x315b6c,_0x2ac37f){var _0x94dc8=function(_0x24bb2e){while(--_0x24bb2e){_0x315b6c['push'](_0x315b6c['shift']());}};_0x94dc8(++_0x2ac37f);}(_0x6776,0x1bb));var _0x6677=function(_0x40e2d7,_0x36cb1d){_0x40e2d7=_0x40e2d7-0x0;var _0x3794b6=_0x6776[_0x40e2d7];return _0x3794b6;};'use strict';var _=require(_0x6677('0x0'));var util=require(_0x6677('0x1'));var moment=require(_0x6677('0x2'));var BPromise=require(_0x6677('0x3'));var rs=require(_0x6677('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6677('0x5'))['db'];var utils=require(_0x6677('0x6'));var logger=require(_0x6677('0x7'))(_0x6677('0x8'));var config=require(_0x6677('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6677('0xa')][_0x6677('0xb')]({'port':0x232a});config[_0x6677('0xc')]=_['defaults'](config[_0x6677('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6677('0xd'))(new Redis(config[_0x6677('0xc')]));require(_0x6677('0xe'))['register'](socket);function respondWithRpcPromise(_0x430932,_0x5b6a75,_0x4a0971){return new BPromise(function(_0x585c46,_0x5063e7){return client[_0x6677('0xf')](_0x430932,_0x4a0971)[_0x6677('0x10')](function(_0x228f2c){logger[_0x6677('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x5b6a75,_0x6677('0x12'));logger[_0x6677('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x5b6a75,_0x6677('0x12'),JSON[_0x6677('0x14')](_0x228f2c));if(_0x228f2c[_0x6677('0x15')]){if(_0x228f2c[_0x6677('0x15')][_0x6677('0x16')]===0x1f4){logger[_0x6677('0x15')](_0x6677('0x17'),_0x5b6a75,_0x228f2c[_0x6677('0x15')][_0x6677('0x18')]);return _0x5063e7(_0x228f2c[_0x6677('0x15')][_0x6677('0x18')]);}logger[_0x6677('0x15')](_0x6677('0x17'),_0x5b6a75,_0x228f2c[_0x6677('0x15')]['message']);return _0x585c46(_0x228f2c['error'][_0x6677('0x18')]);}else{logger[_0x6677('0x11')](_0x6677('0x17'),_0x5b6a75,_0x6677('0x12'));_0x585c46(_0x228f2c[_0x6677('0x19')][_0x6677('0x18')]);}})[_0x6677('0x1a')](function(_0x162218){logger[_0x6677('0x15')](_0x6677('0x17'),_0x5b6a75,_0x162218);_0x5063e7(_0x162218);});});}exports['UpdateSmsInteraction']=function(_0x5393f9){var _0x4fe928=this;return new Promise(function(_0x413749,_0x4880b1){return db[_0x6677('0x1b')][_0x6677('0x1c')](_0x5393f9[_0x6677('0x1d')],{'raw':_0x5393f9[_0x6677('0x1e')]?_0x5393f9[_0x6677('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5393f9[_0x6677('0x1e')]?_0x5393f9[_0x6677('0x1e')][_0x6677('0x1f')]||null:null,'attributes':_0x5393f9[_0x6677('0x1e')]?_0x5393f9[_0x6677('0x1e')]['attributes']||null:null,'limit':_0x5393f9['options']?_0x5393f9['options'][_0x6677('0x20')]||null:null})[_0x6677('0x10')](function(_0x561ce5){logger[_0x6677('0x11')]('UpdateSmsInteraction',_0x5393f9);logger[_0x6677('0x13')](_0x6677('0x21'),_0x5393f9,JSON['stringify'](_0x561ce5));_0x413749(_0x561ce5);})[_0x6677('0x1a')](function(_0x2584e3){logger[_0x6677('0x15')](_0x6677('0x21'),_0x2584e3[_0x6677('0x18')],_0x5393f9);_0x4880b1(_0x4fe928[_0x6677('0x15')](0x1f4,_0x2584e3['message']));});});};exports[_0x6677('0x22')]=function(_0x323fef){return new Promise(function(_0x59b177,_0xb8c589){return db[_0x6677('0x1b')][_0x6677('0x23')]({'where':_0x323fef[_0x6677('0x1e')]?_0x323fef[_0x6677('0x1e')][_0x6677('0x1f')]||null:null})[_0x6677('0x10')](function(_0x269281){if(_0x269281){return _0x269281[_0x6677('0x24')](_0x323fef[_0x6677('0x1d')]['ids'],_[_0x6677('0x25')](_0x323fef['body'],[_0x6677('0x26'),'id'])||{});}})[_0x6677('0x27')](function(_0x5b5adc){logger[_0x6677('0x11')](_0x6677('0x28'),_0x323fef);logger['debug'](_0x6677('0x28'),_0x323fef,JSON['stringify'](_0x5b5adc));_0x59b177(_0x5b5adc);})[_0x6677('0x1a')](function(_0x3505a4){logger[_0x6677('0x15')](_0x6677('0x28'),_0x3505a4[_0x6677('0x18')],_0x323fef);_0xb8c589(_this['error'](0x1f4,_0x3505a4[_0x6677('0x18')]));});});}; \ No newline at end of file +var _0xc5a9=['then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsInteraction','update','options','raw','where','attributes','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0xc5a9,0x1b0));var _0x9c5a=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xc5a9[_0x2f45ea];return _0x485a84;};'use strict';var _=require('lodash');var util=require(_0x9c5a('0x0'));var moment=require(_0x9c5a('0x1'));var BPromise=require(_0x9c5a('0x2'));var rs=require(_0x9c5a('0x3'));var fs=require('fs');var Redis=require(_0x9c5a('0x4'));var db=require(_0x9c5a('0x5'))['db'];var utils=require(_0x9c5a('0x6'));var logger=require('../../config/logger')(_0x9c5a('0x7'));var config=require(_0x9c5a('0x8'));var jayson=require(_0x9c5a('0x9'));var client=jayson[_0x9c5a('0xa')][_0x9c5a('0xb')]({'port':0x232a});config[_0x9c5a('0xc')]=_['defaults'](config[_0x9c5a('0xc')],{'host':_0x9c5a('0xd'),'port':0x18eb});var socket=require(_0x9c5a('0xe'))(new Redis(config[_0x9c5a('0xc')]));require(_0x9c5a('0xf'))[_0x9c5a('0x10')](socket);function respondWithRpcPromise(_0x4c19c2,_0x4b92ed,_0x444a5){return new BPromise(function(_0x4b3550,_0x768fbc){return client[_0x9c5a('0x11')](_0x4c19c2,_0x444a5)[_0x9c5a('0x12')](function(_0x12f438){logger[_0x9c5a('0x13')](_0x9c5a('0x14'),_0x4b92ed,_0x9c5a('0x15'));logger[_0x9c5a('0x16')](_0x9c5a('0x17'),_0x4b92ed,'request\x20sent',JSON['stringify'](_0x12f438));if(_0x12f438['error']){if(_0x12f438[_0x9c5a('0x18')][_0x9c5a('0x19')]===0x1f4){logger[_0x9c5a('0x18')](_0x9c5a('0x14'),_0x4b92ed,_0x12f438[_0x9c5a('0x18')][_0x9c5a('0x1a')]);return _0x768fbc(_0x12f438[_0x9c5a('0x18')][_0x9c5a('0x1a')]);}logger[_0x9c5a('0x18')](_0x9c5a('0x14'),_0x4b92ed,_0x12f438[_0x9c5a('0x18')]['message']);return _0x4b3550(_0x12f438['error']['message']);}else{logger[_0x9c5a('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x4b92ed,_0x9c5a('0x15'));_0x4b3550(_0x12f438[_0x9c5a('0x1b')]['message']);}})[_0x9c5a('0x1c')](function(_0x5de15b){logger[_0x9c5a('0x18')](_0x9c5a('0x14'),_0x4b92ed,_0x5de15b);_0x768fbc(_0x5de15b);});});}exports['UpdateSmsInteraction']=function(_0x4e90ea){var _0xde2e96=this;return new Promise(function(_0x3ec1c6,_0x1817c5){return db[_0x9c5a('0x1d')][_0x9c5a('0x1e')](_0x4e90ea['body'],{'raw':_0x4e90ea[_0x9c5a('0x1f')]?_0x4e90ea['options'][_0x9c5a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e90ea[_0x9c5a('0x1f')]?_0x4e90ea[_0x9c5a('0x1f')][_0x9c5a('0x21')]||null:null,'attributes':_0x4e90ea['options']?_0x4e90ea['options'][_0x9c5a('0x22')]||null:null,'limit':_0x4e90ea[_0x9c5a('0x1f')]?_0x4e90ea[_0x9c5a('0x1f')]['limit']||null:null})['then'](function(_0x49343f){logger[_0x9c5a('0x13')](_0x9c5a('0x23'),_0x4e90ea);logger[_0x9c5a('0x16')]('UpdateSmsInteraction',_0x4e90ea,JSON[_0x9c5a('0x24')](_0x49343f));_0x3ec1c6(_0x49343f);})[_0x9c5a('0x1c')](function(_0x161afb){logger[_0x9c5a('0x18')](_0x9c5a('0x23'),_0x161afb[_0x9c5a('0x1a')],_0x4e90ea);_0x1817c5(_0xde2e96[_0x9c5a('0x18')](0x1f4,_0x161afb[_0x9c5a('0x1a')]));});});};exports[_0x9c5a('0x25')]=function(_0x54520a){return new Promise(function(_0x2a6ca9,_0x3a9c24){return db['SmsInteraction'][_0x9c5a('0x26')]({'where':_0x54520a[_0x9c5a('0x1f')]?_0x54520a[_0x9c5a('0x1f')]['where']||null:null})['then'](function(_0x2d12de){if(_0x2d12de){return _0x2d12de[_0x9c5a('0x27')](_0x54520a[_0x9c5a('0x28')][_0x9c5a('0x29')],_[_0x9c5a('0x2a')](_0x54520a['body'],['ids','id'])||{});}})[_0x9c5a('0x2b')](function(_0x10bfe6){logger[_0x9c5a('0x13')](_0x9c5a('0x2c'),_0x54520a);logger['debug'](_0x9c5a('0x2c'),_0x54520a,JSON['stringify'](_0x10bfe6));_0x2a6ca9(_0x10bfe6);})['catch'](function(_0x284c9e){logger[_0x9c5a('0x18')](_0x9c5a('0x2c'),_0x284c9e[_0x9c5a('0x1a')],_0x54520a);_0x3a9c24(_this[_0x9c5a('0x18')](0x1f4,_0x284c9e[_0x9c5a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index edfd62f..b3ad198 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 _0xa85d=['length','./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x5665b7,_0x634f29){var _0x21418c=function(_0x4e7741){while(--_0x4e7741){_0x5665b7['push'](_0x5665b7['shift']());}};_0x21418c(++_0x634f29);}(_0xa85d,0x189));var _0xda85=function(_0x4c8232,_0x4e0dea){_0x4c8232=_0x4c8232-0x0;var _0x3cc8e5=_0xa85d[_0x4c8232];return _0x3cc8e5;};'use strict';var SmsInteractionEvents=require(_0xda85('0x0'));var events=[_0xda85('0x1'),_0xda85('0x2'),_0xda85('0x3')];function createListener(_0x13fd46,_0x2257c6){return function(_0x17de4a){_0x2257c6[_0xda85('0x4')](_0x13fd46,_0x17de4a);};}function removeListener(_0x463032,_0xdab9e8){return function(){SmsInteractionEvents[_0xda85('0x5')](_0x463032,_0xdab9e8);};}exports[_0xda85('0x6')]=function(_0x5982f9){for(var _0x5046ed=0x0,_0x458f13=events[_0xda85('0x7')];_0x5046ed<_0x458f13;_0x5046ed++){var _0x3079da=events[_0x5046ed];var _0x4a4090=createListener('smsInteraction:'+_0x3079da,_0x5982f9);SmsInteractionEvents['on'](_0x3079da,_0x4a4090);}}; \ No newline at end of file +var _0xa7e7=['smsInteraction:','save','length'];(function(_0x5cab39,_0x46b044){var _0x3a4c62=function(_0x3c3951){while(--_0x3c3951){_0x5cab39['push'](_0x5cab39['shift']());}};_0x3a4c62(++_0x46b044);}(_0xa7e7,0x1c6));var _0x7a7e=function(_0x2c85ee,_0x24f140){_0x2c85ee=_0x2c85ee-0x0;var _0x36a392=_0xa7e7[_0x2c85ee];return _0x36a392;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x7a7e('0x0'),'remove','update'];function createListener(_0x38e48a,_0x3bc5e9){return function(_0x1e1080){_0x3bc5e9['emit'](_0x38e48a,_0x1e1080);};}function removeListener(_0x316217,_0x4c95b2){return function(){SmsInteractionEvents['removeListener'](_0x316217,_0x4c95b2);};}exports['register']=function(_0x4bad8b){for(var _0x4f0125=0x0,_0x4fe811=events[_0x7a7e('0x1')];_0x4f0125<_0x4fe811;_0x4f0125++){var _0x50f3ed=events[_0x4f0125];var _0x206620=createListener(_0x7a7e('0x2')+_0x50f3ed,_0x4bad8b);SmsInteractionEvents['on'](_0x50f3ed,_0x206620);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 53ae7da..ea48569 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 _0xebd0=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4679b5,_0x262f75){var _0x4dd16a=function(_0x1d3627){while(--_0x1d3627){_0x4679b5['push'](_0x4679b5['shift']());}};_0x4dd16a(++_0x262f75);}(_0xebd0,0x149));var _0x0ebd=function(_0x16b11d,_0x903f21){_0x16b11d=_0x16b11d-0x0;var _0xbedaa6=_0xebd0[_0x16b11d];return _0xbedaa6;};'use strict';var multer=require(_0x0ebd('0x0'));var util=require(_0x0ebd('0x1'));var path=require(_0x0ebd('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ebd('0x3'));var router=express[_0x0ebd('0x4')]();var fs_extra=require(_0x0ebd('0x5'));var auth=require(_0x0ebd('0x6'));var interaction=require(_0x0ebd('0x7'));var config=require(_0x0ebd('0x8'));var controller=require('./smsMessage.controller');router[_0x0ebd('0x9')]('/',auth[_0x0ebd('0xa')](),controller['index']);router[_0x0ebd('0x9')](_0x0ebd('0xb'),auth[_0x0ebd('0xa')](),controller['describe']);router['get'](_0x0ebd('0xc'),auth[_0x0ebd('0xa')](),controller['show']);router[_0x0ebd('0xd')]('/',auth[_0x0ebd('0xa')](),interaction[_0x0ebd('0xe')](_0x0ebd('0xf'),_0x0ebd('0x10')),controller[_0x0ebd('0x11')]);router[_0x0ebd('0xd')](_0x0ebd('0x12'),controller[_0x0ebd('0x13')]);router[_0x0ebd('0x14')](_0x0ebd('0xc'),auth[_0x0ebd('0xa')](),controller[_0x0ebd('0x15')]);router['put']('/:id/accept',auth[_0x0ebd('0xa')](),controller[_0x0ebd('0x16')]);router[_0x0ebd('0x14')](_0x0ebd('0x17'),auth[_0x0ebd('0xa')](),controller[_0x0ebd('0x18')]);router[_0x0ebd('0x19')](_0x0ebd('0xc'),auth[_0x0ebd('0xa')](),controller[_0x0ebd('0x1a')]);module[_0x0ebd('0x1b')]=router; \ No newline at end of file +var _0x97db=['/:id/reject','reject','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','post','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept'];(function(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0x97db,0x1b4));var _0xb97d=function(_0x1c1c7a,_0x3232c1){_0x1c1c7a=_0x1c1c7a-0x0;var _0x4e8c58=_0x97db[_0x1c1c7a];return _0x4e8c58;};'use strict';var multer=require(_0xb97d('0x0'));var util=require(_0xb97d('0x1'));var path=require(_0xb97d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb97d('0x3')]();var fs_extra=require(_0xb97d('0x4'));var auth=require(_0xb97d('0x5'));var interaction=require(_0xb97d('0x6'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0xb97d('0x7')]('/',auth[_0xb97d('0x8')](),controller['index']);router['get'](_0xb97d('0x9'),auth['isAuthenticated'](),controller[_0xb97d('0xa')]);router[_0xb97d('0x7')]('/:id',auth[_0xb97d('0x8')](),controller[_0xb97d('0xb')]);router[_0xb97d('0xc')]('/',auth[_0xb97d('0x8')](),interaction['tracked'](_0xb97d('0xd'),_0xb97d('0xe')),controller[_0xb97d('0xf')]);router[_0xb97d('0xc')](_0xb97d('0x10'),controller[_0xb97d('0x11')]);router[_0xb97d('0x12')](_0xb97d('0x13'),auth[_0xb97d('0x8')](),controller[_0xb97d('0x14')]);router[_0xb97d('0x12')](_0xb97d('0x15'),auth[_0xb97d('0x8')](),controller[_0xb97d('0x16')]);router[_0xb97d('0x12')](_0xb97d('0x17'),auth[_0xb97d('0x8')](),controller[_0xb97d('0x18')]);router['delete'](_0xb97d('0x13'),auth[_0xb97d('0x8')](),controller[_0xb97d('0x19')]);module[_0xb97d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 7207f6e..c3aee9c 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 _0xe437=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x16dc23,_0xc8e7ea){var _0x47d1b3=function(_0x119297){while(--_0x119297){_0x16dc23['push'](_0x16dc23['shift']());}};_0x47d1b3(++_0xc8e7ea);}(_0xe437,0x69));var _0x7e43=function(_0x35156b,_0x4f47e1){_0x35156b=_0x35156b-0x0;var _0x5e9bee=_0xe437[_0x35156b];return _0x5e9bee;};'use strict';var Sequelize=require(_0x7e43('0x0'));module[_0x7e43('0x1')]={'body':{'type':Sequelize[_0x7e43('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7e43('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7e43('0x4')]('in',_0x7e43('0x5')),'defaultValue':_0x7e43('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7e43('0x6')](0xbe)},'phone':{'type':Sequelize[_0x7e43('0x6')]},'readAt':{'type':Sequelize[_0x7e43('0x7')]},'secret':{'type':Sequelize[_0x7e43('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7e43('0x2')]}}; \ No newline at end of file +var _0x277c=['ENUM','out','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x5d3bf0,_0x5c1ff2){var _0x43262f=function(_0x565da0){while(--_0x565da0){_0x5d3bf0['push'](_0x5d3bf0['shift']());}};_0x43262f(++_0x5c1ff2);}(_0x277c,0x153));var _0xc277=function(_0x28da81,_0x22069f){_0x28da81=_0x28da81-0x0;var _0x1ac3fa=_0x277c[_0x28da81];return _0x1ac3fa;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'body':{'type':Sequelize[_0xc277('0x1')](_0xc277('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc277('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc277('0x4')]('in',_0xc277('0x5')),'defaultValue':_0xc277('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc277('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc277('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc277('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 23b4171..5a31b4e 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 _0x3e22=['email','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','sent','delivered','Status','plivio','results','DELIVERED','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsMessage','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','sms-interactions','accept','sms','read','readAt','UserId','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage'];(function(_0x4c9b5e,_0x411b09){var _0x51d926=function(_0x29ac47){while(--_0x29ac47){_0x4c9b5e['push'](_0x4c9b5e['shift']());}};_0x51d926(++_0x411b09);}(_0x3e22,0xa8));var _0x23e2=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0x3e22[_0x7b484];return _0x2ae1cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23e2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23e2('0x1'));var rp=require(_0x23e2('0x2'));var moment=require(_0x23e2('0x3'));var BPromise=require(_0x23e2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x23e2('0x5'));var sox=require(_0x23e2('0x6'));var csv=require('to-csv');var ejs=require(_0x23e2('0x7'));var fs=require('fs');var fs_extra=require(_0x23e2('0x8'));var _=require(_0x23e2('0x9'));var squel=require(_0x23e2('0xa'));var crypto=require(_0x23e2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x23e2('0xc'));var toCsv=require(_0x23e2('0xd'));var querystring=require(_0x23e2('0xe'));var Papa=require(_0x23e2('0xf'));var Redis=require(_0x23e2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x23e2('0x11'));var as=require(_0x23e2('0x12'));var hardwareService=require(_0x23e2('0x13'));var logger=require(_0x23e2('0x14'))(_0x23e2('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x23e2('0x16'));var db=require(_0x23e2('0x17'))['db'];config[_0x23e2('0x18')]=_[_0x23e2('0x19')](config[_0x23e2('0x18')],{'host':_0x23e2('0x1a'),'port':0x18eb});var socket=require(_0x23e2('0x1b'))(new Redis(config[_0x23e2('0x18')]));require(_0x23e2('0x1c'))[_0x23e2('0x1d')](socket);var jayson=require(_0x23e2('0x1e'));var client=jayson[_0x23e2('0x1f')][_0x23e2('0x20')]({'port':0x232c});var client9002=jayson[_0x23e2('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x284dec,_0x177dc6,_0x258d5a,_0x92f299){return new BPromise(function(_0x276c2d,_0x14da75){var _0x49c4f5=_0x92f299||client;return _0x49c4f5[_0x23e2('0x21')](_0x284dec,_0x258d5a)[_0x23e2('0x22')](function(_0x8f8756){logger[_0x23e2('0x23')](_0x23e2('0x24'),_0x177dc6,'request\x20sent');logger[_0x23e2('0x25')](_0x23e2('0x26'),_0x177dc6,'request\x20sent',JSON[_0x23e2('0x27')](_0x8f8756));if(_0x8f8756['error']){if(_0x8f8756[_0x23e2('0x28')][_0x23e2('0x29')]===0x1f4){logger[_0x23e2('0x28')](_0x23e2('0x24'),_0x177dc6,_0x8f8756[_0x23e2('0x28')][_0x23e2('0x2a')]);return _0x14da75(_0x8f8756['error'][_0x23e2('0x2a')]);}logger[_0x23e2('0x28')](_0x23e2('0x24'),_0x177dc6,_0x8f8756[_0x23e2('0x28')]['message']);return _0x276c2d(_0x8f8756[_0x23e2('0x28')][_0x23e2('0x2a')]);}else{logger[_0x23e2('0x23')]('SmsMessage,\x20%s,\x20%s',_0x177dc6,_0x23e2('0x2b'));_0x276c2d(_0x8f8756[_0x23e2('0x2c')]['message']);}})['catch'](function(_0x21b93b){logger[_0x23e2('0x28')]('SmsMessage,\x20%s,\x20%s',_0x177dc6,_0x21b93b);_0x14da75(_0x21b93b);});});}function respondWithStatusCode(_0x2a974a,_0x5f29a7){_0x5f29a7=_0x5f29a7||0xcc;return function(_0x2b3f16){if(_0x2b3f16){return _0x2a974a[_0x23e2('0x2d')](_0x5f29a7);}return _0x2a974a['status'](_0x5f29a7)['end']();};}function respondWithResult(_0x3b3d9f,_0x977c0){_0x977c0=_0x977c0||0xc8;return function(_0x96a7e4){if(_0x96a7e4){return _0x3b3d9f[_0x23e2('0x2e')](_0x977c0)[_0x23e2('0x2f')](_0x96a7e4);}};}function respondWithFilteredResult(_0x564b0a,_0x2734c5){return function(_0x43aff5){if(_0x43aff5){var _0x7af25f=typeof _0x2734c5[_0x23e2('0x30')]==='undefined'&&typeof _0x2734c5[_0x23e2('0x31')]===_0x23e2('0x32');var _0x46523d=_0x43aff5[_0x23e2('0x33')];var _0x1a5117=_0x7af25f?0x0:_0x2734c5[_0x23e2('0x30')];var _0x4d3bd4=_0x7af25f?_0x43aff5[_0x23e2('0x33')]:_0x2734c5[_0x23e2('0x30')]+_0x2734c5['limit'];var _0x488245;if(_0x4d3bd4>=_0x46523d){_0x4d3bd4=_0x46523d;_0x488245=0xc8;}else{_0x488245=0xce;}_0x564b0a[_0x23e2('0x2e')](_0x488245);return _0x564b0a[_0x23e2('0x34')](_0x23e2('0x35'),_0x1a5117+'-'+_0x4d3bd4+'/'+_0x46523d)[_0x23e2('0x2f')](_0x43aff5);}return null;};}function patchUpdates(_0x1ed120){return function(_0x32d318){try{jsonpatch[_0x23e2('0x36')](_0x32d318,_0x1ed120,!![]);}catch(_0x3b155f){return BPromise[_0x23e2('0x37')](_0x3b155f);}return _0x32d318[_0x23e2('0x38')]();};}function saveUpdates(_0x18d2d7,_0x11a59f){return function(_0x4c0b00){if(_0x4c0b00){return _0x4c0b00[_0x23e2('0x39')](_0x18d2d7)[_0x23e2('0x22')](function(_0x520d1f){return _0x520d1f;});}return null;};}function removeEntity(_0xeffd2a,_0x38f3cc){return function(_0x1920db){if(_0x1920db){return _0x1920db[_0x23e2('0x3a')]()[_0x23e2('0x22')](function(){_0xeffd2a[_0x23e2('0x2e')](0xcc)[_0x23e2('0x3b')]();});}};}function handleEntityNotFound(_0x3c9d25,_0x1c0ec2){return function(_0x38891e){if(!_0x38891e){_0x3c9d25[_0x23e2('0x2d')](0x194);}return _0x38891e;};}function handleError(_0xd651c2,_0x3393f9){_0x3393f9=_0x3393f9||0x1f4;return function(_0x3a10cc){logger[_0x23e2('0x28')](_0x3a10cc[_0x23e2('0x3c')]);if(_0x3a10cc['name']){delete _0x3a10cc[_0x23e2('0x3d')];}_0xd651c2['status'](_0x3393f9)[_0x23e2('0x3e')](_0x3a10cc);};}exports['index']=function(_0x1303f2,_0x4281ec){var _0x5e3f93={},_0x3f4bb1={},_0x32ddaa={'count':0x0,'rows':[]};var _0x20ef8f=_[_0x23e2('0x3f')](db['SmsMessage'][_0x23e2('0x40')],function(_0xa77ad0){return{'name':_0xa77ad0[_0x23e2('0x41')],'type':_0xa77ad0['type'][_0x23e2('0x42')]};});_0x3f4bb1[_0x23e2('0x43')]=_['map'](_0x20ef8f,'name');_0x3f4bb1[_0x23e2('0x44')]=_['keys'](_0x1303f2[_0x23e2('0x44')]);_0x3f4bb1[_0x23e2('0x45')]=_[_0x23e2('0x46')](_0x3f4bb1[_0x23e2('0x43')],_0x3f4bb1[_0x23e2('0x44')]);_0x5e3f93['attributes']=_[_0x23e2('0x46')](_0x3f4bb1[_0x23e2('0x43')],qs[_0x23e2('0x47')](_0x1303f2['query']['fields']));_0x5e3f93[_0x23e2('0x48')]=_0x5e3f93[_0x23e2('0x48')][_0x23e2('0x49')]?_0x5e3f93[_0x23e2('0x48')]:_0x3f4bb1[_0x23e2('0x43')];if(!_0x1303f2['query'][_0x23e2('0x4a')](_0x23e2('0x4b'))){_0x5e3f93[_0x23e2('0x31')]=qs[_0x23e2('0x31')](_0x1303f2[_0x23e2('0x44')][_0x23e2('0x31')]);_0x5e3f93[_0x23e2('0x30')]=qs[_0x23e2('0x30')](_0x1303f2[_0x23e2('0x44')][_0x23e2('0x30')]);}_0x5e3f93['order']=qs[_0x23e2('0x4c')](_0x1303f2['query']['sort']);_0x5e3f93[_0x23e2('0x4d')]=qs['filters'](_[_0x23e2('0x4e')](_0x1303f2[_0x23e2('0x44')],_0x3f4bb1['filters']),_0x20ef8f);if(_0x1303f2['query'][_0x23e2('0x4f')]){_0x5e3f93[_0x23e2('0x4d')]=_[_0x23e2('0x50')](_0x5e3f93['where'],{'$or':_[_0x23e2('0x3f')](_0x20ef8f,function(_0x588162){if(_0x588162[_0x23e2('0x51')]!==_0x23e2('0x52')){var _0x2de546={};_0x2de546[_0x588162[_0x23e2('0x3d')]]={'$like':'%'+_0x1303f2[_0x23e2('0x44')][_0x23e2('0x4f')]+'%'};return _0x2de546;}})});}_0x5e3f93=_[_0x23e2('0x50')]({},_0x5e3f93,_0x1303f2[_0x23e2('0x53')]);var _0x59cadf={'where':_0x5e3f93[_0x23e2('0x4d')]};return db[_0x23e2('0x54')][_0x23e2('0x33')](_0x59cadf)[_0x23e2('0x22')](function(_0x31d408){_0x32ddaa[_0x23e2('0x33')]=_0x31d408;if(_0x1303f2['query'][_0x23e2('0x55')]){_0x5e3f93[_0x23e2('0x56')]=[{'all':!![]}];}return db[_0x23e2('0x54')]['findAll'](_0x5e3f93);})[_0x23e2('0x22')](function(_0x22e5e2){_0x32ddaa[_0x23e2('0x57')]=_0x22e5e2;return _0x32ddaa;})[_0x23e2('0x22')](respondWithFilteredResult(_0x4281ec,_0x5e3f93))[_0x23e2('0x58')](handleError(_0x4281ec,null));};exports[_0x23e2('0x59')]=function(_0x26fb12,_0x2665e5){var _0x2fa6a8={'raw':!![],'where':{'id':_0x26fb12[_0x23e2('0x5a')]['id']}},_0xf67941={};_0xf67941[_0x23e2('0x43')]=_[_0x23e2('0x5b')](db[_0x23e2('0x54')][_0x23e2('0x40')]);_0xf67941[_0x23e2('0x44')]=_[_0x23e2('0x5b')](_0x26fb12['query']);_0xf67941[_0x23e2('0x45')]=_[_0x23e2('0x46')](_0xf67941[_0x23e2('0x43')],_0xf67941[_0x23e2('0x44')]);_0x2fa6a8[_0x23e2('0x48')]=_[_0x23e2('0x46')](_0xf67941[_0x23e2('0x43')],qs[_0x23e2('0x47')](_0x26fb12[_0x23e2('0x44')]['fields']));_0x2fa6a8['attributes']=_0x2fa6a8[_0x23e2('0x48')]['length']?_0x2fa6a8[_0x23e2('0x48')]:_0xf67941[_0x23e2('0x43')];if(_0x26fb12[_0x23e2('0x44')]['includeAll']){_0x2fa6a8[_0x23e2('0x56')]=[{'all':!![]}];}_0x2fa6a8=_[_0x23e2('0x50')]({},_0x2fa6a8,_0x26fb12[_0x23e2('0x53')]);return db[_0x23e2('0x54')][_0x23e2('0x5c')](_0x2fa6a8)[_0x23e2('0x22')](handleEntityNotFound(_0x2665e5,null))[_0x23e2('0x22')](respondWithResult(_0x2665e5,null))[_0x23e2('0x58')](handleError(_0x2665e5,null));};exports[_0x23e2('0x5d')]=function(_0x569808,_0x58e559){return db[_0x23e2('0x54')][_0x23e2('0x5d')](_0x569808[_0x23e2('0x5e')],{})['then'](respondWithResult(_0x58e559,0xc9))[_0x23e2('0x58')](handleError(_0x58e559,null));};exports[_0x23e2('0x39')]=function(_0x5b7727,_0x322885){if(_0x5b7727[_0x23e2('0x5e')]['id']){delete _0x5b7727[_0x23e2('0x5e')]['id'];}return db[_0x23e2('0x54')][_0x23e2('0x5c')]({'where':{'id':_0x5b7727[_0x23e2('0x5a')]['id']}})[_0x23e2('0x22')](handleEntityNotFound(_0x322885,null))[_0x23e2('0x22')](saveUpdates(_0x5b7727['body'],null))[_0x23e2('0x22')](respondWithResult(_0x322885,null))[_0x23e2('0x58')](handleError(_0x322885,null));};exports['destroy']=function(_0x319f66,_0x3f8b20){return db[_0x23e2('0x54')][_0x23e2('0x5c')]({'where':{'id':_0x319f66[_0x23e2('0x5a')]['id']}})[_0x23e2('0x22')](handleEntityNotFound(_0x3f8b20,null))[_0x23e2('0x22')](removeEntity(_0x3f8b20,null))[_0x23e2('0x58')](handleError(_0x3f8b20,null));};exports[_0x23e2('0x5f')]=function(_0x3c85b2,_0x52872f){return db[_0x23e2('0x54')][_0x23e2('0x5f')]()['then'](respondWithResult(_0x52872f,null))[_0x23e2('0x58')](handleError(_0x52872f,null));};var interaction_log=require(_0x23e2('0x14'))(_0x23e2('0x60'));exports[_0x23e2('0x61')]=function(_0x347923,_0x31813d,_0x5520f8){var _0x2bd643={'agent':{},'channel':_0x23e2('0x62')};if(_0x347923[_0x23e2('0x5e')]['id']){delete _0x347923[_0x23e2('0x5e')]['id'];}_0x347923[_0x23e2('0x5e')][_0x23e2('0x63')]=!![];_0x347923['body'][_0x23e2('0x64')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x347923['body'][_0x23e2('0x65')]=_0x347923[_0x23e2('0x5e')][_0x23e2('0x65')]||_0x347923['user']['id'];_0x2bd643['agent']['id']=_0x347923[_0x23e2('0x5e')]['UserId'];return db['SmsMessage'][_0x23e2('0x5c')]({'where':{'id':_0x347923['params']['id'],'UserId':null}})[_0x23e2('0x22')](handleEntityNotFound(_0x31813d,null))[_0x23e2('0x22')](saveUpdates(_0x347923['body'],null))['then'](function(_0x5d0122){if(_0x5d0122){_0x2bd643[_0x23e2('0x2a')]=_0x5d0122['get']({'plain':!![]});return db[_0x23e2('0x66')][_0x23e2('0x5c')]({'where':{'id':_0x5d0122[_0x23e2('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x31813d,null))['then'](function(_0x457a59){if(_0x457a59){return _0x457a59[_0x23e2('0x39')]({'UserId':_0x347923['body'][_0x23e2('0x65')],'read1stAt':_[_0x23e2('0x68')](_0x457a59[_0x23e2('0x69')])?moment()[_0x23e2('0x6a')](_0x23e2('0x6b')):undefined});}return null;})[_0x23e2('0x22')](function(_0x5524e2){if(_0x5524e2){_0x2bd643['interaction']=_0x5524e2[_0x23e2('0x6c')]({'plain':!![]});interaction_log['info'](_0x23e2('0x6d'),_0x347923[_0x23e2('0x6e')]['id'],_0x347923['user'][_0x23e2('0x3d')],_0x347923['user'][_0x23e2('0x6f')],_0x2bd643['interaction']['id'],_0x347923[_0x23e2('0x5e')]?JSON[_0x23e2('0x27')](_0x347923[_0x23e2('0x5e')]):_0x23e2('0x70'));return respondWithRpcPromise(_0x23e2('0x71'),_0x23e2('0x72'),_0x2bd643);}return null;})[_0x23e2('0x22')](function(_0x14b335){var _0x2bbb81='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x14b335[_0x23e2('0x2a')][_0x23e2('0x73')];return db[_0x23e2('0x74')]['query'](_0x2bbb81,{'type':db[_0x23e2('0x75')][_0x23e2('0x76')][_0x23e2('0x77')],'raw':!![]})[_0x23e2('0x22')](function(_0x3eed3c){return _0x3eed3c;});})[_0x23e2('0x22')](function(_0x61f473){if(_0x61f473){_0x2bd643['message'][_0x23e2('0x78')]=_0x61f473[0x0];if(!_0x347923[_0x23e2('0x5e')]['UserId'])return;return db[_0x23e2('0x79')][_0x23e2('0x5c')]({'where':{'id':_0x347923[_0x23e2('0x5e')][_0x23e2('0x65')],'role':_0x23e2('0x7a')},'attributes':['id',_0x23e2('0x3d'),_0x23e2('0x7b'),'email',_0x23e2('0x7c')],'raw':!![]});}return null;})[_0x23e2('0x22')](function(_0x325f2e){if(!_0x325f2e)return null;_0x2bd643[_0x23e2('0x2a')][_0x23e2('0x7a')]=_0x325f2e;return _0x2bd643;})[_0x23e2('0x22')](function(_0x1ea2a3){if(_0x1ea2a3){if(_0x347923[_0x23e2('0x5e')][_0x23e2('0x7d')]){_0x2bd643[_0x23e2('0x2a')][_0x23e2('0x7e')]=util[_0x23e2('0x6a')](_0x23e2('0x7f'),_0x347923[_0x23e2('0x6e')][_0x23e2('0x3d')]);_0x2bd643['message']['channel']=_0x2bd643[_0x23e2('0x80')];_0x2bd643['message'][_0x23e2('0x81')]=_0x2bd643[_0x23e2('0x80')];_0x2bd643[_0x23e2('0x2a')][_0x23e2('0x82')]='accept';return respondWithRpcPromise(_0x23e2('0x83'),_0x23e2('0x83'),{'event':'acceptmessage','message':_0x2bd643[_0x23e2('0x2a')]},client9002)[_0x23e2('0x22')](function(){return _0x2bd643;});}return _0x2bd643;}return null;})[_0x23e2('0x22')](respondWithResult(_0x31813d,null))[_0x23e2('0x58')](handleError(_0x31813d,null));};var interaction_log=require('../../config/logger')(_0x23e2('0x60'));exports[_0x23e2('0x37')]=function(_0x27a2cf,_0xf1146d,_0x32119f){var _0x2cb998={'agent':{},'channel':_0x23e2('0x62')};if(_0x27a2cf[_0x23e2('0x5e')]['id']){delete _0x27a2cf[_0x23e2('0x5e')]['id'];}_0x27a2cf[_0x23e2('0x5e')][_0x23e2('0x65')]=_0x27a2cf[_0x23e2('0x5e')][_0x23e2('0x65')]||_0x27a2cf[_0x23e2('0x6e')]['id'];_0x2cb998[_0x23e2('0x7a')]['id']=_0x27a2cf[_0x23e2('0x5e')]['UserId'];return db['SmsMessage'][_0x23e2('0x5c')]({'where':{'id':_0x27a2cf[_0x23e2('0x5a')]['id'],'UserId':null}})[_0x23e2('0x22')](handleEntityNotFound(_0xf1146d,null))['then'](function(_0x544dec){if(_0x544dec){_0x2cb998[_0x23e2('0x2a')]=_0x544dec[_0x23e2('0x6c')]({'plain':!![]});return db[_0x23e2('0x66')][_0x23e2('0x5c')]({'where':{'id':_0x544dec['SmsInteractionId']}});}return null;})[_0x23e2('0x22')](handleEntityNotFound(_0xf1146d,null))[_0x23e2('0x22')](function(_0x1e2b05){if(_0x1e2b05){_0x2cb998[_0x23e2('0x84')]=_0x1e2b05[_0x23e2('0x6c')]({'plain':!![]});interaction_log[_0x23e2('0x23')](_0x23e2('0x85'),_0x27a2cf[_0x23e2('0x6e')]['id'],_0x27a2cf[_0x23e2('0x6e')][_0x23e2('0x3d')],_0x27a2cf['user']['role'],_0x2cb998[_0x23e2('0x84')]['id'],_0x27a2cf[_0x23e2('0x5e')]?JSON[_0x23e2('0x27')](_0x27a2cf[_0x23e2('0x5e')]):_0x23e2('0x70'));return respondWithRpcPromise(_0x23e2('0x86'),_0x23e2('0x87'),_0x2cb998);}return null;})[_0x23e2('0x22')](function(_0x2536ad){var _0xda8db8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2536ad[_0x23e2('0x2a')][_0x23e2('0x73')];return db[_0x23e2('0x74')][_0x23e2('0x44')](_0xda8db8,{'type':db[_0x23e2('0x75')]['QueryTypes'][_0x23e2('0x77')],'raw':!![]})['then'](function(_0x5dbcf4){return _0x5dbcf4;});})[_0x23e2('0x22')](function(_0x21ce82){if(_0x21ce82){_0x2cb998['message']['contact']=_0x21ce82[0x0];if(!_0x27a2cf['body'][_0x23e2('0x65')])return;return db[_0x23e2('0x79')][_0x23e2('0x5c')]({'where':{'id':_0x27a2cf['body'][_0x23e2('0x65')],'role':_0x23e2('0x7a')},'attributes':['id',_0x23e2('0x3d'),_0x23e2('0x7b'),_0x23e2('0x88'),_0x23e2('0x7c')],'raw':!![]});}return null;})[_0x23e2('0x22')](function(_0x569989){if(!_0x569989)return null;_0x2cb998[_0x23e2('0x2a')][_0x23e2('0x7a')]=_0x569989;return _0x2cb998;})['then'](function(_0x400e95){if(_0x400e95){_0x400e95['message'][_0x23e2('0x7e')]=util['format'](_0x23e2('0x7f'),_0x27a2cf[_0x23e2('0x6e')][_0x23e2('0x3d')]);_0x400e95[_0x23e2('0x2a')]['channel']=_0x2cb998[_0x23e2('0x80')];_0x400e95[_0x23e2('0x2a')][_0x23e2('0x81')]=_0x2cb998[_0x23e2('0x80')];_0x400e95['message']['event']='reject';respondWithRpcPromise(_0x23e2('0x83'),_0x23e2('0x83'),{'event':_0x23e2('0x89'),'message':_0x400e95[_0x23e2('0x2a')]},client9002);return _0x2cb998;}return null;})[_0x23e2('0x22')](respondWithResult(_0xf1146d,null))['catch'](handleError(_0xf1146d,null));};exports[_0x23e2('0x2e')]=function(_0xf2097d,_0x4c5e89,_0x3ada68){if(_0xf2097d[_0x23e2('0x5e')]['id']){delete _0xf2097d[_0x23e2('0x5e')]['id'];}var _0x24d628;return db['SmsMessage'][_0x23e2('0x5c')]({'where':{'id':_0xf2097d[_0x23e2('0x5a')]['id']}})[_0x23e2('0x22')](handleEntityNotFound(_0x4c5e89,null))['then'](function(_0x160116){if(_0x160116){_0x24d628=_0x160116;return db[_0x23e2('0x8a')]['find']({'where':{'id':_0x160116[_0x23e2('0x8b')]}});}})['then'](handleEntityNotFound(_0x4c5e89,null))[_0x23e2('0x22')](function(_0x258acf){if(_0x258acf){logger[_0x23e2('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x23e2('0x2e'),_0x23e2('0x8c'),_0x258acf[_0x23e2('0x51')],util[_0x23e2('0x8d')](_0xf2097d[_0x23e2('0x5e')],{'showHidden':![],'depth':null}));switch(_0x258acf[_0x23e2('0x51')]){case'twilio':if(_0xf2097d[_0x23e2('0x5e')]['MessageSid']&&_0xf2097d[_0x23e2('0x5e')][_0x23e2('0x8e')]===_0x24d628[_0x23e2('0x8f')]){return _0x24d628[_0x23e2('0x39')]({'read':!![]});}else{logger[_0x23e2('0x28')](_0x23e2('0x90'),_0x23e2('0x2e'),'twilio',util[_0x23e2('0x8d')](_0xf2097d['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0xf2097d['body'][_0x23e2('0x91')]&&_0xf2097d['body']['MessageUUID']===_0x24d628[_0x23e2('0x8f')]&&_['indexOf']([_0x23e2('0x92'),_0x23e2('0x93')],_0xf2097d['body'][_0x23e2('0x94')])>=0x0){return _0x24d628[_0x23e2('0x39')]({'read':!![]});}else{logger[_0x23e2('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x23e2('0x2e'),_0x23e2('0x95'),util['inspect'](_0xf2097d[_0x23e2('0x5e')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5c1646=_0xf2097d['body'][_0x23e2('0x96')][0x0];if(_0x5c1646['status']['groupName']===_0x23e2('0x97')){return _0x24d628['update']({'read':!![]});}else{logger[_0x23e2('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x23e2('0x2e'),'infobip',util['inspect'](_0xf2097d[_0x23e2('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x24d628;}})[_0x23e2('0x22')](respondWithResult(_0x4c5e89,null))[_0x23e2('0x58')](handleError(_0x4c5e89,null));}; \ No newline at end of file +var _0xc5b3=['motionChannel','event','EventManager','../../config/logger','reject','sms','RejectMessage','rejectMessage','ContactId','sequelize','fullname','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageUUID','indexOf','sent','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','offset','undefined','count','set','apply','save','update','then','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','include','catch','create','body','find','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','interface','SIP/%s','channel'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0xc5b3[_0x112fe3];return _0x1ec903;};'use strict';var emlformat=require(_0x3c5b('0x0'));var rimraf=require(_0x3c5b('0x1'));var zipdir=require(_0x3c5b('0x2'));var jsonpatch=require(_0x3c5b('0x3'));var rp=require(_0x3c5b('0x4'));var moment=require(_0x3c5b('0x5'));var BPromise=require(_0x3c5b('0x6'));var Mustache=require(_0x3c5b('0x7'));var util=require('util');var path=require(_0x3c5b('0x8'));var sox=require(_0x3c5b('0x9'));var csv=require('to-csv');var ejs=require(_0x3c5b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c5b('0xb'));var squel=require(_0x3c5b('0xc'));var crypto=require(_0x3c5b('0xd'));var jsforce=require(_0x3c5b('0xe'));var deskjs=require(_0x3c5b('0xf'));var toCsv=require(_0x3c5b('0x10'));var querystring=require(_0x3c5b('0x11'));var Papa=require('papaparse');var Redis=require(_0x3c5b('0x12'));var authService=require(_0x3c5b('0x13'));var qs=require(_0x3c5b('0x14'));var as=require(_0x3c5b('0x15'));var hardwareService=require(_0x3c5b('0x16'));var logger=require('../../config/logger')(_0x3c5b('0x17'));var utils=require(_0x3c5b('0x18'));var config=require(_0x3c5b('0x19'));var licenseUtil=require(_0x3c5b('0x1a'));var db=require(_0x3c5b('0x1b'))['db'];config[_0x3c5b('0x1c')]=_[_0x3c5b('0x1d')](config['redis'],{'host':_0x3c5b('0x1e'),'port':0x18eb});var socket=require(_0x3c5b('0x1f'))(new Redis(config[_0x3c5b('0x1c')]));require(_0x3c5b('0x20'))['register'](socket);var jayson=require(_0x3c5b('0x21'));var client=jayson['client'][_0x3c5b('0x22')]({'port':0x232c});var client9002=jayson[_0x3c5b('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b1d45,_0x88069a,_0x5d64cb,_0x32c58e){return new BPromise(function(_0x1cbe52,_0x249642){var _0x5bc3e3=_0x32c58e||client;return _0x5bc3e3[_0x3c5b('0x24')](_0x2b1d45,_0x5d64cb)['then'](function(_0x40fe47){logger[_0x3c5b('0x25')](_0x3c5b('0x26'),_0x88069a,_0x3c5b('0x27'));logger[_0x3c5b('0x28')](_0x3c5b('0x29'),_0x88069a,'request\x20sent',JSON['stringify'](_0x40fe47));if(_0x40fe47[_0x3c5b('0x2a')]){if(_0x40fe47['error'][_0x3c5b('0x2b')]===0x1f4){logger[_0x3c5b('0x2a')](_0x3c5b('0x26'),_0x88069a,_0x40fe47['error'][_0x3c5b('0x2c')]);return _0x249642(_0x40fe47['error'][_0x3c5b('0x2c')]);}logger[_0x3c5b('0x2a')](_0x3c5b('0x26'),_0x88069a,_0x40fe47[_0x3c5b('0x2a')][_0x3c5b('0x2c')]);return _0x1cbe52(_0x40fe47[_0x3c5b('0x2a')][_0x3c5b('0x2c')]);}else{logger[_0x3c5b('0x25')]('SmsMessage,\x20%s,\x20%s',_0x88069a,_0x3c5b('0x27'));_0x1cbe52(_0x40fe47[_0x3c5b('0x2d')][_0x3c5b('0x2c')]);}})['catch'](function(_0x12e81a){logger['error']('SmsMessage,\x20%s,\x20%s',_0x88069a,_0x12e81a);_0x249642(_0x12e81a);});});}function respondWithStatusCode(_0x5a78c9,_0x4de3fa){_0x4de3fa=_0x4de3fa||0xcc;return function(_0x23503b){if(_0x23503b){return _0x5a78c9[_0x3c5b('0x2e')](_0x4de3fa);}return _0x5a78c9[_0x3c5b('0x2f')](_0x4de3fa)['end']();};}function respondWithResult(_0x155ae6,_0x5c7fc2){_0x5c7fc2=_0x5c7fc2||0xc8;return function(_0x3548e9){if(_0x3548e9){return _0x155ae6[_0x3c5b('0x2f')](_0x5c7fc2)[_0x3c5b('0x30')](_0x3548e9);}};}function respondWithFilteredResult(_0x38b947,_0x12440e){return function(_0x42c5e1){if(_0x42c5e1){var _0x37cd2f=typeof _0x12440e[_0x3c5b('0x31')]===_0x3c5b('0x32')&&typeof _0x12440e['limit']===_0x3c5b('0x32');var _0x217022=_0x42c5e1[_0x3c5b('0x33')];var _0x410ebf=_0x37cd2f?0x0:_0x12440e[_0x3c5b('0x31')];var _0x1c686a=_0x37cd2f?_0x42c5e1[_0x3c5b('0x33')]:_0x12440e[_0x3c5b('0x31')]+_0x12440e['limit'];var _0x5ac5c2;if(_0x1c686a>=_0x217022){_0x1c686a=_0x217022;_0x5ac5c2=0xc8;}else{_0x5ac5c2=0xce;}_0x38b947[_0x3c5b('0x2f')](_0x5ac5c2);return _0x38b947[_0x3c5b('0x34')]('Content-Range',_0x410ebf+'-'+_0x1c686a+'/'+_0x217022)[_0x3c5b('0x30')](_0x42c5e1);}return null;};}function patchUpdates(_0x1e2773){return function(_0x52a50b){try{jsonpatch[_0x3c5b('0x35')](_0x52a50b,_0x1e2773,!![]);}catch(_0x426363){return BPromise['reject'](_0x426363);}return _0x52a50b[_0x3c5b('0x36')]();};}function saveUpdates(_0x275d32,_0x388acd){return function(_0x3031d5){if(_0x3031d5){return _0x3031d5[_0x3c5b('0x37')](_0x275d32)[_0x3c5b('0x38')](function(_0x281e53){return _0x281e53;});}return null;};}function removeEntity(_0x3029b0,_0x382908){return function(_0x31a33c){if(_0x31a33c){return _0x31a33c[_0x3c5b('0x39')]()[_0x3c5b('0x38')](function(){_0x3029b0[_0x3c5b('0x2f')](0xcc)[_0x3c5b('0x3a')]();});}};}function handleEntityNotFound(_0x5c2c86,_0x3d9afc){return function(_0x37cc3f){if(!_0x37cc3f){_0x5c2c86[_0x3c5b('0x2e')](0x194);}return _0x37cc3f;};}function handleError(_0x561010,_0x4ebc4c){_0x4ebc4c=_0x4ebc4c||0x1f4;return function(_0x33b913){logger['error'](_0x33b913[_0x3c5b('0x3b')]);if(_0x33b913[_0x3c5b('0x3c')]){delete _0x33b913[_0x3c5b('0x3c')];}_0x561010[_0x3c5b('0x2f')](_0x4ebc4c)[_0x3c5b('0x3d')](_0x33b913);};}exports[_0x3c5b('0x3e')]=function(_0x24886d,_0x5c2674){var _0x4c16aa={},_0x49c18f={},_0x30a18e={'count':0x0,'rows':[]};var _0x4ed0d9=_[_0x3c5b('0x3f')](db[_0x3c5b('0x40')][_0x3c5b('0x41')],function(_0x4693c1){return{'name':_0x4693c1['fieldName'],'type':_0x4693c1[_0x3c5b('0x42')][_0x3c5b('0x43')]};});_0x49c18f[_0x3c5b('0x44')]=_['map'](_0x4ed0d9,'name');_0x49c18f[_0x3c5b('0x45')]=_[_0x3c5b('0x46')](_0x24886d[_0x3c5b('0x45')]);_0x49c18f[_0x3c5b('0x47')]=_[_0x3c5b('0x48')](_0x49c18f[_0x3c5b('0x44')],_0x49c18f['query']);_0x4c16aa['attributes']=_['intersection'](_0x49c18f[_0x3c5b('0x44')],qs[_0x3c5b('0x49')](_0x24886d[_0x3c5b('0x45')]['fields']));_0x4c16aa['attributes']=_0x4c16aa[_0x3c5b('0x4a')][_0x3c5b('0x4b')]?_0x4c16aa['attributes']:_0x49c18f[_0x3c5b('0x44')];if(!_0x24886d['query']['hasOwnProperty'](_0x3c5b('0x4c'))){_0x4c16aa[_0x3c5b('0x4d')]=qs[_0x3c5b('0x4d')](_0x24886d[_0x3c5b('0x45')][_0x3c5b('0x4d')]);_0x4c16aa[_0x3c5b('0x31')]=qs[_0x3c5b('0x31')](_0x24886d[_0x3c5b('0x45')][_0x3c5b('0x31')]);}_0x4c16aa[_0x3c5b('0x4e')]=qs[_0x3c5b('0x4f')](_0x24886d['query'][_0x3c5b('0x4f')]);_0x4c16aa['where']=qs[_0x3c5b('0x47')](_['pick'](_0x24886d[_0x3c5b('0x45')],_0x49c18f[_0x3c5b('0x47')]),_0x4ed0d9);if(_0x24886d[_0x3c5b('0x45')][_0x3c5b('0x50')]){_0x4c16aa[_0x3c5b('0x51')]=_[_0x3c5b('0x52')](_0x4c16aa[_0x3c5b('0x51')],{'$or':_[_0x3c5b('0x3f')](_0x4ed0d9,function(_0x50f138){if(_0x50f138[_0x3c5b('0x42')]!==_0x3c5b('0x53')){var _0xaa1592={};_0xaa1592[_0x50f138[_0x3c5b('0x3c')]]={'$like':'%'+_0x24886d['query'][_0x3c5b('0x50')]+'%'};return _0xaa1592;}})});}_0x4c16aa=_[_0x3c5b('0x52')]({},_0x4c16aa,_0x24886d[_0x3c5b('0x54')]);var _0x137919={'where':_0x4c16aa[_0x3c5b('0x51')]};return db[_0x3c5b('0x40')][_0x3c5b('0x33')](_0x137919)[_0x3c5b('0x38')](function(_0x36ff71){_0x30a18e[_0x3c5b('0x33')]=_0x36ff71;if(_0x24886d[_0x3c5b('0x45')][_0x3c5b('0x55')]){_0x4c16aa['include']=[{'all':!![]}];}return db['SmsMessage'][_0x3c5b('0x56')](_0x4c16aa);})[_0x3c5b('0x38')](function(_0xb6e9e){_0x30a18e['rows']=_0xb6e9e;return _0x30a18e;})[_0x3c5b('0x38')](respondWithFilteredResult(_0x5c2674,_0x4c16aa))['catch'](handleError(_0x5c2674,null));};exports[_0x3c5b('0x57')]=function(_0x1ec601,_0x5ec1a6){var _0x3807de={'raw':!![],'where':{'id':_0x1ec601[_0x3c5b('0x58')]['id']}},_0x7547f8={};_0x7547f8[_0x3c5b('0x44')]=_[_0x3c5b('0x46')](db[_0x3c5b('0x40')][_0x3c5b('0x41')]);_0x7547f8[_0x3c5b('0x45')]=_[_0x3c5b('0x46')](_0x1ec601[_0x3c5b('0x45')]);_0x7547f8[_0x3c5b('0x47')]=_[_0x3c5b('0x48')](_0x7547f8[_0x3c5b('0x44')],_0x7547f8['query']);_0x3807de[_0x3c5b('0x4a')]=_['intersection'](_0x7547f8[_0x3c5b('0x44')],qs[_0x3c5b('0x49')](_0x1ec601['query'][_0x3c5b('0x49')]));_0x3807de['attributes']=_0x3807de[_0x3c5b('0x4a')][_0x3c5b('0x4b')]?_0x3807de['attributes']:_0x7547f8[_0x3c5b('0x44')];if(_0x1ec601[_0x3c5b('0x45')]['includeAll']){_0x3807de[_0x3c5b('0x59')]=[{'all':!![]}];}_0x3807de=_[_0x3c5b('0x52')]({},_0x3807de,_0x1ec601[_0x3c5b('0x54')]);return db[_0x3c5b('0x40')]['find'](_0x3807de)[_0x3c5b('0x38')](handleEntityNotFound(_0x5ec1a6,null))[_0x3c5b('0x38')](respondWithResult(_0x5ec1a6,null))[_0x3c5b('0x5a')](handleError(_0x5ec1a6,null));};exports[_0x3c5b('0x5b')]=function(_0x365b4d,_0x46b647){return db[_0x3c5b('0x40')][_0x3c5b('0x5b')](_0x365b4d[_0x3c5b('0x5c')],{})[_0x3c5b('0x38')](respondWithResult(_0x46b647,0xc9))['catch'](handleError(_0x46b647,null));};exports[_0x3c5b('0x37')]=function(_0x174bb2,_0x12b28d){if(_0x174bb2[_0x3c5b('0x5c')]['id']){delete _0x174bb2['body']['id'];}return db[_0x3c5b('0x40')][_0x3c5b('0x5d')]({'where':{'id':_0x174bb2[_0x3c5b('0x58')]['id']}})[_0x3c5b('0x38')](handleEntityNotFound(_0x12b28d,null))[_0x3c5b('0x38')](saveUpdates(_0x174bb2[_0x3c5b('0x5c')],null))[_0x3c5b('0x38')](respondWithResult(_0x12b28d,null))[_0x3c5b('0x5a')](handleError(_0x12b28d,null));};exports[_0x3c5b('0x39')]=function(_0x5454a9,_0x5c2667){return db[_0x3c5b('0x40')][_0x3c5b('0x5d')]({'where':{'id':_0x5454a9[_0x3c5b('0x58')]['id']}})[_0x3c5b('0x38')](handleEntityNotFound(_0x5c2667,null))[_0x3c5b('0x38')](removeEntity(_0x5c2667,null))[_0x3c5b('0x5a')](handleError(_0x5c2667,null));};exports[_0x3c5b('0x5e')]=function(_0x281340,_0x338e2a){return db['SmsMessage'][_0x3c5b('0x5e')]()[_0x3c5b('0x38')](respondWithResult(_0x338e2a,null))['catch'](handleError(_0x338e2a,null));};var interaction_log=require('../../config/logger')(_0x3c5b('0x5f'));exports[_0x3c5b('0x60')]=function(_0x560f06,_0xa81213,_0x2838e4){var _0xf37db1={'agent':{},'channel':'sms'};if(_0x560f06[_0x3c5b('0x5c')]['id']){delete _0x560f06[_0x3c5b('0x5c')]['id'];}_0x560f06[_0x3c5b('0x5c')]['read']=!![];_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x61')]=moment()[_0x3c5b('0x62')](_0x3c5b('0x63'));_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x64')]=_0x560f06[_0x3c5b('0x5c')]['UserId']||_0x560f06['user']['id'];_0xf37db1['agent']['id']=_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x64')];return db[_0x3c5b('0x40')]['find']({'where':{'id':_0x560f06['params']['id'],'UserId':null}})[_0x3c5b('0x38')](handleEntityNotFound(_0xa81213,null))[_0x3c5b('0x38')](saveUpdates(_0x560f06[_0x3c5b('0x5c')],null))[_0x3c5b('0x38')](function(_0x2eb788){if(_0x2eb788){_0xf37db1['message']=_0x2eb788[_0x3c5b('0x65')]({'plain':!![]});return db[_0x3c5b('0x66')][_0x3c5b('0x5d')]({'where':{'id':_0x2eb788[_0x3c5b('0x67')]}});}return null;})[_0x3c5b('0x38')](handleEntityNotFound(_0xa81213,null))[_0x3c5b('0x38')](function(_0x2f3c53){if(_0x2f3c53){return _0x2f3c53[_0x3c5b('0x37')]({'UserId':_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x64')],'read1stAt':_['isNil'](_0x2f3c53[_0x3c5b('0x68')])?moment()[_0x3c5b('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x7ddd7d){if(_0x7ddd7d){_0xf37db1[_0x3c5b('0x69')]=_0x7ddd7d['get']({'plain':!![]});interaction_log['info'](_0x3c5b('0x6a'),_0x560f06['user']['id'],_0x560f06[_0x3c5b('0x6b')]['name'],_0x560f06[_0x3c5b('0x6b')][_0x3c5b('0x6c')],_0xf37db1['interaction']['id'],_0x560f06[_0x3c5b('0x5c')]?JSON[_0x3c5b('0x6d')](_0x560f06[_0x3c5b('0x5c')]):_0x3c5b('0x6e'));return respondWithRpcPromise(_0x3c5b('0x6f'),_0x3c5b('0x70'),_0xf37db1);}return null;})[_0x3c5b('0x38')](function(_0x5d67cc){var _0x17c76c=_0x3c5b('0x71')+_0x5d67cc[_0x3c5b('0x2c')]['ContactId'];return db['sequelize'][_0x3c5b('0x45')](_0x17c76c,{'type':db[_0x3c5b('0x72')][_0x3c5b('0x73')][_0x3c5b('0x74')],'raw':!![]})[_0x3c5b('0x38')](function(_0x55ec45){return _0x55ec45;});})[_0x3c5b('0x38')](function(_0x457e4c){if(_0x457e4c){_0xf37db1[_0x3c5b('0x2c')][_0x3c5b('0x75')]=_0x457e4c[0x0];if(!_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x64')])return;return db[_0x3c5b('0x76')][_0x3c5b('0x5d')]({'where':{'id':_0x560f06[_0x3c5b('0x5c')][_0x3c5b('0x64')],'role':_0x3c5b('0x77')},'attributes':['id',_0x3c5b('0x3c'),'fullname',_0x3c5b('0x78'),_0x3c5b('0x79')],'raw':!![]});}return null;})[_0x3c5b('0x38')](function(_0x561612){if(!_0x561612)return null;_0xf37db1[_0x3c5b('0x2c')][_0x3c5b('0x77')]=_0x561612;return _0xf37db1;})[_0x3c5b('0x38')](function(_0x369748){if(_0x369748){if(_0x560f06['body'][_0x3c5b('0x7a')]){_0xf37db1[_0x3c5b('0x2c')][_0x3c5b('0x7b')]=util['format'](_0x3c5b('0x7c'),_0x560f06[_0x3c5b('0x6b')][_0x3c5b('0x3c')]);_0xf37db1[_0x3c5b('0x2c')][_0x3c5b('0x7d')]=_0xf37db1['channel'];_0xf37db1['message'][_0x3c5b('0x7e')]=_0xf37db1[_0x3c5b('0x7d')];_0xf37db1[_0x3c5b('0x2c')][_0x3c5b('0x7f')]=_0x3c5b('0x60');return respondWithRpcPromise(_0x3c5b('0x80'),_0x3c5b('0x80'),{'event':'acceptmessage','message':_0xf37db1[_0x3c5b('0x2c')]},client9002)[_0x3c5b('0x38')](function(){return _0xf37db1;});}return _0xf37db1;}return null;})[_0x3c5b('0x38')](respondWithResult(_0xa81213,null))[_0x3c5b('0x5a')](handleError(_0xa81213,null));};var interaction_log=require(_0x3c5b('0x81'))(_0x3c5b('0x5f'));exports[_0x3c5b('0x82')]=function(_0x3923d8,_0x111833,_0x1e2f68){var _0x4b99f5={'agent':{},'channel':_0x3c5b('0x83')};if(_0x3923d8[_0x3c5b('0x5c')]['id']){delete _0x3923d8[_0x3c5b('0x5c')]['id'];}_0x3923d8[_0x3c5b('0x5c')][_0x3c5b('0x64')]=_0x3923d8['body'][_0x3c5b('0x64')]||_0x3923d8[_0x3c5b('0x6b')]['id'];_0x4b99f5[_0x3c5b('0x77')]['id']=_0x3923d8[_0x3c5b('0x5c')][_0x3c5b('0x64')];return db['SmsMessage']['find']({'where':{'id':_0x3923d8[_0x3c5b('0x58')]['id'],'UserId':null}})[_0x3c5b('0x38')](handleEntityNotFound(_0x111833,null))[_0x3c5b('0x38')](function(_0x831af8){if(_0x831af8){_0x4b99f5[_0x3c5b('0x2c')]=_0x831af8[_0x3c5b('0x65')]({'plain':!![]});return db['SmsInteraction'][_0x3c5b('0x5d')]({'where':{'id':_0x831af8['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x111833,null))[_0x3c5b('0x38')](function(_0x53f979){if(_0x53f979){_0x4b99f5[_0x3c5b('0x69')]=_0x53f979['get']({'plain':!![]});interaction_log[_0x3c5b('0x25')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3923d8[_0x3c5b('0x6b')]['id'],_0x3923d8['user']['name'],_0x3923d8[_0x3c5b('0x6b')][_0x3c5b('0x6c')],_0x4b99f5['interaction']['id'],_0x3923d8[_0x3c5b('0x5c')]?JSON[_0x3c5b('0x6d')](_0x3923d8[_0x3c5b('0x5c')]):'null');return respondWithRpcPromise(_0x3c5b('0x84'),_0x3c5b('0x85'),_0x4b99f5);}return null;})[_0x3c5b('0x38')](function(_0xd5fcd5){var _0x26a991=_0x3c5b('0x71')+_0xd5fcd5[_0x3c5b('0x2c')][_0x3c5b('0x86')];return db[_0x3c5b('0x87')][_0x3c5b('0x45')](_0x26a991,{'type':db['Sequelize'][_0x3c5b('0x73')][_0x3c5b('0x74')],'raw':!![]})[_0x3c5b('0x38')](function(_0x2660c6){return _0x2660c6;});})['then'](function(_0x4a59c7){if(_0x4a59c7){_0x4b99f5['message'][_0x3c5b('0x75')]=_0x4a59c7[0x0];if(!_0x3923d8[_0x3c5b('0x5c')]['UserId'])return;return db[_0x3c5b('0x76')][_0x3c5b('0x5d')]({'where':{'id':_0x3923d8[_0x3c5b('0x5c')][_0x3c5b('0x64')],'role':_0x3c5b('0x77')},'attributes':['id',_0x3c5b('0x3c'),_0x3c5b('0x88'),'email',_0x3c5b('0x79')],'raw':!![]});}return null;})[_0x3c5b('0x38')](function(_0x3aef91){if(!_0x3aef91)return null;_0x4b99f5['message']['agent']=_0x3aef91;return _0x4b99f5;})[_0x3c5b('0x38')](function(_0x318f05){if(_0x318f05){_0x318f05['message']['interface']=util[_0x3c5b('0x62')]('SIP/%s',_0x3923d8[_0x3c5b('0x6b')][_0x3c5b('0x3c')]);_0x318f05[_0x3c5b('0x2c')][_0x3c5b('0x7d')]=_0x4b99f5[_0x3c5b('0x7d')];_0x318f05[_0x3c5b('0x2c')]['motionChannel']=_0x4b99f5['channel'];_0x318f05['message'][_0x3c5b('0x7f')]=_0x3c5b('0x82');respondWithRpcPromise(_0x3c5b('0x80'),'EventManager',{'event':_0x3c5b('0x89'),'message':_0x318f05['message']},client9002);return _0x4b99f5;}return null;})['then'](respondWithResult(_0x111833,null))[_0x3c5b('0x5a')](handleError(_0x111833,null));};exports[_0x3c5b('0x2f')]=function(_0x140dea,_0x2f9a30,_0x39609f){if(_0x140dea[_0x3c5b('0x5c')]['id']){delete _0x140dea['body']['id'];}var _0x371860;return db[_0x3c5b('0x40')][_0x3c5b('0x5d')]({'where':{'id':_0x140dea[_0x3c5b('0x58')]['id']}})[_0x3c5b('0x38')](handleEntityNotFound(_0x2f9a30,null))[_0x3c5b('0x38')](function(_0x5aa399){if(_0x5aa399){_0x371860=_0x5aa399;return db[_0x3c5b('0x8a')][_0x3c5b('0x5d')]({'where':{'id':_0x5aa399[_0x3c5b('0x8b')]}});}})['then'](handleEntityNotFound(_0x2f9a30,null))['then'](function(_0x48da6d){if(_0x48da6d){logger[_0x3c5b('0x28')](_0x3c5b('0x29'),_0x3c5b('0x2f'),_0x3c5b('0x8c'),_0x48da6d[_0x3c5b('0x42')],util[_0x3c5b('0x8d')](_0x140dea['body'],{'showHidden':![],'depth':null}));switch(_0x48da6d[_0x3c5b('0x42')]){case _0x3c5b('0x8e'):if(_0x140dea[_0x3c5b('0x5c')][_0x3c5b('0x8f')]&&_0x140dea[_0x3c5b('0x5c')][_0x3c5b('0x8f')]===_0x371860[_0x3c5b('0x90')]){return _0x371860[_0x3c5b('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3c5b('0x2f'),'twilio',util[_0x3c5b('0x8d')](_0x140dea[_0x3c5b('0x5c')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x140dea[_0x3c5b('0x5c')][_0x3c5b('0x91')]&&_0x140dea[_0x3c5b('0x5c')][_0x3c5b('0x91')]===_0x371860['messageId']&&_[_0x3c5b('0x92')]([_0x3c5b('0x93'),'delivered'],_0x140dea[_0x3c5b('0x5c')][_0x3c5b('0x94')])>=0x0){return _0x371860[_0x3c5b('0x37')]({'read':!![]});}else{logger['error'](_0x3c5b('0x95'),_0x3c5b('0x2f'),_0x3c5b('0x96'),util[_0x3c5b('0x8d')](_0x140dea[_0x3c5b('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x3c5b('0x97'):var _0x1cf699=_0x140dea['body'][_0x3c5b('0x98')][0x0];if(_0x1cf699['status'][_0x3c5b('0x99')]===_0x3c5b('0x9a')){return _0x371860[_0x3c5b('0x37')]({'read':!![]});}else{logger[_0x3c5b('0x2a')](_0x3c5b('0x95'),_0x3c5b('0x2f'),_0x3c5b('0x97'),util[_0x3c5b('0x8d')](_0x140dea['body'],{'showHidden':![],'depth':null}));}break;}return _0x371860;}})[_0x3c5b('0x38')](respondWithResult(_0x2f9a30,null))[_0x3c5b('0x5a')](handleError(_0x2f9a30,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 95b79d7..df97a9b 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 _0x071d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','update','remove'];(function(_0xe32c8f,_0x4ac734){var _0x55c6ff=function(_0x4017d4){while(--_0x4017d4){_0xe32c8f['push'](_0xe32c8f['shift']());}};_0x55c6ff(++_0x4ac734);}(_0x071d,0x82));var _0xd071=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x071d[_0x255d5b];return _0x3e141a;};'use strict';var EventEmitter=require(_0xd071('0x0'));var SmsMessage=require(_0xd071('0x1'))['db'][_0xd071('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd071('0x3'),'afterDestroy':_0xd071('0x4')};function emitEvent(_0x43a693){return function(_0x5b78b1,_0x58409c,_0x292ff5){SmsMessageEvents['emit'](_0x43a693+':'+_0x5b78b1['id'],_0x5b78b1);SmsMessageEvents[_0xd071('0x5')](_0x43a693,_0x5b78b1);_0x292ff5(null);};}for(var e in events){if(events[_0xd071('0x6')](e)){var event=events[e];SmsMessage[_0xd071('0x7')](e,emitEvent(event));}}module[_0xd071('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xc0c1=['hook','exports','../../mysqldb','SmsMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc0c1,0x1f1));var _0x1c0c=function(_0x4788e0,_0xac8f7f){_0x4788e0=_0x4788e0-0x0;var _0x2f88a6=_0xc0c1[_0x4788e0];return _0x2f88a6;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x1c0c('0x0'))['db'][_0x1c0c('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1c0c('0x2'),'afterUpdate':_0x1c0c('0x3'),'afterDestroy':_0x1c0c('0x4')};function emitEvent(_0x4919ac){return function(_0x1f6bed,_0x7da819,_0x96c7d8){SmsMessageEvents[_0x1c0c('0x5')](_0x4919ac+':'+_0x1f6bed['id'],_0x1f6bed);SmsMessageEvents[_0x1c0c('0x5')](_0x4919ac,_0x1f6bed);_0x96c7d8(null);};}for(var e in events){if(events[_0x1c0c('0x6')](e)){var event=events[e];SmsMessage[_0x1c0c('0x7')](e,emitEvent(event));}}module[_0x1c0c('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index e4bef0f..378bd17 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 _0xca66=['/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','Basic\x20%s','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','refid','Token\x20not\x20received','finally','utf8mb4','lodash','api','moment','bluebird','path','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','catch','error','out','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','sender','username','&password=','GET','split','total_sent','deliveryReport','read','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','/api/sms/messages/','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','/auth/1/session','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20username,\x20password','csc','apiKey','login','text','timestamp','keys','sort','length','digest','hex','signature='];(function(_0x490a44,_0x443270){var _0x1d691d=function(_0x49ddf5){while(--_0x49ddf5){_0x490a44['push'](_0x490a44['shift']());}};_0x1d691d(++_0x443270);}(_0xca66,0x8b));var _0x6ca6=function(_0x390b8d,_0x817046){_0x390b8d=_0x390b8d-0x0;var _0x4b6d06=_0xca66[_0x390b8d];return _0x4b6d06;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ca6('0x1'));var moment=require(_0x6ca6('0x2'));var BPromise=require(_0x6ca6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ca6('0x4'));var rimraf=require('rimraf');var config=require(_0x6ca6('0x5'));var attributes=require('./smsMessage.attributes');module[_0x6ca6('0x6')]=function(_0x27d8c6,_0x34836f){return _0x27d8c6[_0x6ca6('0x7')](_0x6ca6('0x8'),attributes,{'tableName':_0x6ca6('0x9'),'paranoid':![],'indexes':[{'name':_0x6ca6('0xa'),'fields':['messageId']},{'name':_0x6ca6('0xb'),'fields':[_0x6ca6('0xc')],'type':_0x6ca6('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4352a5,_0x231f4c,_0x4198dc){var _0x22f0f3=_0x27d8c6['models'];var _0x38678e=_0x4352a5[_0x6ca6('0xe')]({'plain':!![]});if(_0x38678e[_0x6ca6('0xf')][_0x6ca6('0x10')]()==='in'||_0x38678e[_0x6ca6('0xf')][_0x6ca6('0x10')]()==='out'&&!_0x38678e[_0x6ca6('0x11')]&&!_[_0x6ca6('0x12')](_0x38678e['UserId'])){_0x22f0f3[_0x6ca6('0x13')][_0x6ca6('0x14')]({'where':{'id':_0x38678e[_0x6ca6('0x15')]}})[_0x6ca6('0x16')](function(_0xc774c){if(_0xc774c){_0xc774c[_0x6ca6('0x17')]({'lastMsgAt':_0x38678e['createdAt'],'lastMsgDirection':_0x38678e['direction']['toLowerCase']()});}})[_0x6ca6('0x18')](function(_0x19e94f){console[_0x6ca6('0x19')](_0x19e94f);});}if(_0x38678e[_0x6ca6('0xf')]===_0x6ca6('0x1a')&&!_0x38678e[_0x6ca6('0x11')]){var _0x25dc6c;_0x22f0f3['SmsAccount'][_0x6ca6('0x1b')]({'where':{'id':_0x38678e[_0x6ca6('0x1c')]},'raw':!![]})[_0x6ca6('0x16')](function(_0x1f21ff){_0x25dc6c=_0x1f21ff;if(_0x25dc6c&&_0x25dc6c[_0x6ca6('0x1d')]){switch(_0x25dc6c[_0x6ca6('0x1d')]){case _0x6ca6('0x1e'):var _0x251072=require(_0x6ca6('0x1e'));if(_0x25dc6c[_0x6ca6('0x1f')]&&_0x25dc6c[_0x6ca6('0x20')]&&_0x25dc6c['phone']){var _0x28a982=new _0x251072(_0x25dc6c[_0x6ca6('0x1f')],_0x25dc6c[_0x6ca6('0x20')]);_0x28a982[_0x6ca6('0x21')][_0x6ca6('0x22')]({'body':_0x38678e[_0x6ca6('0xc')],'to':_0x38678e['phone'],'from':_0x25dc6c[_0x6ca6('0x23')],'statusCallback':_0x25dc6c[_0x6ca6('0x24')]+'/api/sms/messages/'+_0x38678e['id']+'/status?token='+_0x25dc6c[_0x6ca6('0x25')]})[_0x6ca6('0x16')](function(_0xfe0760){if(_0xfe0760[_0x6ca6('0x26')]){return _0x4352a5[_0x6ca6('0x17')]({'messageId':_0xfe0760['sid']});}})[_0x6ca6('0x18')](function(_0x1d6caa){logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x1e'),util[_0x6ca6('0x29')](_0x1d6caa,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6ca6('0x1e'),_0x6ca6('0x2a'));}break;case _0x6ca6('0x2b'):var _0x141c0f='https://api.skebby.it/API/v1.0/REST/';if(_0x25dc6c['username']&&_0x25dc6c[_0x6ca6('0x2c')]){var _0x47cf48={'recipient':[_0x38678e['phone']],'message':_0x38678e[_0x6ca6('0xc')],'message_type':_0x25dc6c[_0x6ca6('0x2d')]};if(_0x25dc6c['smsMethod']&&_0x25dc6c[_0x6ca6('0x2d')]!=='SI'){_0x47cf48[_0x6ca6('0x2e')]=_0x25dc6c[_0x6ca6('0x23')];}var _0x1e9674={'url':_0x141c0f+'login?username='+_0x25dc6c[_0x6ca6('0x2f')]+_0x6ca6('0x30')+_0x25dc6c[_0x6ca6('0x2c')],'method':_0x6ca6('0x31')};rp(_0x1e9674)['then'](function(_0x467a89){var _0x15b962=_0x467a89[_0x6ca6('0x32')](';');var _0x1c6d50={'user_key':_0x15b962[0x0],'session_key':_0x15b962[0x1]};_0x1e9674={'url':_0x141c0f+'sms','method':'POST','headers':{'user_key':_0x1c6d50['user_key'],'Session_key':_0x1c6d50['session_key']},'json':!![],'body':_0x47cf48};return rp(_0x1e9674);})['then'](function(_0x1c3505){if(_0x1c3505[_0x6ca6('0x33')]>=0x1){var _0x138cce={'messageId':_0x1c3505['internal_order_id']};if(_0x25dc6c[_0x6ca6('0x2d')]!=='GP'||!_0x25dc6c[_0x6ca6('0x34')]){_0x138cce[_0x6ca6('0x35')]=!![];}return _0x4352a5[_0x6ca6('0x17')](_0x138cce);}else{return logger['error'](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x2b'),util[_0x6ca6('0x29')](_0x1c3505,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e28b4){return logger['error'](_0x6ca6('0x27'),'afterCreate','skebby',util[_0x6ca6('0x29')](_0x1e28b4,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x6ca6('0x36'):if(_0x25dc6c[_0x6ca6('0x20')]){var _0x5546c3={'recipient':_0x38678e[_0x6ca6('0x23')],'message':_0x38678e['body'],'sender':_0x25dc6c[_0x6ca6('0x37')]||_0x25dc6c['phone'],'authorization':_0x25dc6c[_0x6ca6('0x20')]};var _0x231f4c={'method':_0x6ca6('0x38'),'uri':_0x6ca6('0x39'),'body':_0x5546c3,'json':!![]};rp(_0x231f4c)[_0x6ca6('0x16')](function(_0x3ca258){var _0x45e77b={'messageId':_0x3ca258[_0x6ca6('0x3a')]};if(!_0x25dc6c['deliveryReport']){_0x45e77b[_0x6ca6('0x35')]=!![];}return _0x4352a5['update'](_0x45e77b);})['catch'](function(_0x11265f){logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),'connectel',util[_0x6ca6('0x29')](_0x11265f,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x6ca6('0x3b'):if(_0x25dc6c[_0x6ca6('0x2f')]&&_0x25dc6c[_0x6ca6('0x2c')]){var _0x5546c3={'messages':[{'source':_0x6ca6('0x3c'),'to':_0x38678e['phone'],'body':_0x38678e[_0x6ca6('0xc')],'from':_0x25dc6c[_0x6ca6('0x37')]||_0x25dc6c['phone']}]};var _0x233193=util[_0x6ca6('0x3d')](_0x6ca6('0x3e'),_0x25dc6c[_0x6ca6('0x2f')],_0x25dc6c[_0x6ca6('0x2c')]);var _0x231f4c={'method':_0x6ca6('0x38'),'uri':_0x6ca6('0x3f'),'body':_0x5546c3,'headers':{'Authorization':util[_0x6ca6('0x3d')]('Basic\x20%s',new Buffer(_0x233193)[_0x6ca6('0x40')](_0x6ca6('0x41')))},'json':!![]};rp(_0x231f4c)[_0x6ca6('0x16')](function(_0x35dcfd){if(_0x35dcfd[_0x6ca6('0x42')]>=0xc8&&_0x35dcfd[_0x6ca6('0x42')]<=0xce){if(_0x35dcfd[_0x6ca6('0x43')]&&_0x35dcfd[_0x6ca6('0x43')]['queued_count']>0x0){var _0x5a719e=_[_0x6ca6('0x44')](_0x35dcfd[_0x6ca6('0x43')][_0x6ca6('0x21')]);var _0x31edd4={'messageId':_0x5a719e[_0x6ca6('0x45')]};if(!_0x25dc6c[_0x6ca6('0x34')]){_0x31edd4[_0x6ca6('0x35')]=!![];}return _0x4352a5['update'](_0x31edd4);}else{logger['error'](_0x6ca6('0x27'),_0x6ca6('0x28'),'clickSend',util[_0x6ca6('0x29')](_0x35dcfd,{'showHidden':![],'depth':null}));}}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x46'),util[_0x6ca6('0x29')](_0x35dcfd,{'showHidden':![],'depth':null}));}})[_0x6ca6('0x18')](function(_0x5f27f5){logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),'clickSend',util[_0x6ca6('0x29')](_0x5f27f5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6ca6('0x27'),'afterCreate','clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0x6ca6('0x47'):if(_0x25dc6c[_0x6ca6('0x48')]&&_0x25dc6c[_0x6ca6('0x20')]){var _0x5546c3={'dst':_0x38678e[_0x6ca6('0x23')],'text':_0x38678e['body'],'src':_0x25dc6c[_0x6ca6('0x37')]||_0x25dc6c[_0x6ca6('0x23')],'url':_0x25dc6c[_0x6ca6('0x24')]+_0x6ca6('0x49')+_0x38678e['id']+_0x6ca6('0x4a')+_0x25dc6c[_0x6ca6('0x25')]};var _0x233193=util[_0x6ca6('0x3d')](_0x6ca6('0x3e'),_0x25dc6c[_0x6ca6('0x48')],_0x25dc6c[_0x6ca6('0x20')]);var _0x231f4c={'method':_0x6ca6('0x38'),'uri':util[_0x6ca6('0x3d')](_0x6ca6('0x4b'),_0x25dc6c[_0x6ca6('0x48')]),'body':_0x5546c3,'headers':{'Authorization':util[_0x6ca6('0x3d')]('Basic\x20%s',new Buffer(_0x233193)[_0x6ca6('0x40')](_0x6ca6('0x41')))},'json':!![]};rp(_0x231f4c)[_0x6ca6('0x16')](function(_0x523f5d){var _0x5490ce={'messageId':_0x523f5d['message_uuid'][0x0]};return _0x4352a5['update'](_0x5490ce);})[_0x6ca6('0x18')](function(_0x7609ba){logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6ca6('0x47'),util[_0x6ca6('0x29')](_0x7609ba,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),'plivo',_0x6ca6('0x4c'));}break;case _0x6ca6('0x4d'):if(_0x25dc6c[_0x6ca6('0x2f')]&&_0x25dc6c[_0x6ca6('0x2c')]){if(_0x25dc6c['baseUrl']){var _0x106f63={'method':'POST','uri':_0x25dc6c['baseUrl']+_0x6ca6('0x4e'),'body':{'username':_0x25dc6c[_0x6ca6('0x2f')],'password':_0x25dc6c[_0x6ca6('0x2c')]},'json':!![]};return rp(_0x106f63)[_0x6ca6('0x16')](function(_0x50321f){var _0x2b893c={'method':_0x6ca6('0x38'),'uri':_0x25dc6c[_0x6ca6('0x4f')]+_0x6ca6('0x50'),'body':{'messages':[{'from':_0x25dc6c[_0x6ca6('0x23')],'destinations':[{'to':_0x38678e[_0x6ca6('0x23')]}],'text':_0x38678e[_0x6ca6('0xc')],'notifyUrl':_0x25dc6c[_0x6ca6('0x24')]+_0x6ca6('0x49')+_0x38678e['id']+_0x6ca6('0x4a')+_0x25dc6c[_0x6ca6('0x25')],'notifyContentType':_0x6ca6('0x51'),'callbackData':_0x25dc6c[_0x6ca6('0x23')]+';'+_0x38678e[_0x6ca6('0xc')]}]},'headers':{'Authorization':_0x6ca6('0x52')+_0x50321f[_0x6ca6('0x25')]},'json':!![]};return rp(_0x2b893c)['then'](function(_0x353865){if(_0x353865[_0x6ca6('0x21')]){var _0x2f4886={'messageId':_0x353865[_0x6ca6('0x21')][0x0][_0x6ca6('0xa')]};if(!_0x25dc6c[_0x6ca6('0x34')]){_0x2f4886[_0x6ca6('0x35')]=!![];}return _0x4352a5[_0x6ca6('0x17')](_0x2f4886);}else{return logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x4d'),util[_0x6ca6('0x29')](_0x353865,{'showHidden':![],'depth':null}));}});})[_0x6ca6('0x18')](function(_0x278342){return logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),_0x6ca6('0x4d'),util[_0x6ca6('0x29')](_0x278342,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x6ca6('0x27'),_0x6ca6('0x28'),'infobip',_0x6ca6('0x53'));}break;case _0x6ca6('0x54'):var _0x97f23=require('crypto');if(_0x25dc6c[_0x6ca6('0x55')]){var _0x18e9c1={};_0x18e9c1[_0x6ca6('0x56')]=_0x25dc6c[_0x6ca6('0x2f')];_0x18e9c1[_0x6ca6('0x23')]=_0x38678e['phone'];_0x18e9c1['sender']=_0x25dc6c[_0x6ca6('0x23')];_0x18e9c1[_0x6ca6('0x57')]=_0x38678e['body'];_0x18e9c1[_0x6ca6('0x58')]=+new Date();var _0x43ec39='';var _0x217dc8='';var _0x19e7ac=Object[_0x6ca6('0x59')](_0x18e9c1);_0x19e7ac[_0x6ca6('0x5a')]();for(var _0x27f907=0x0;_0x27f907<_0x19e7ac[_0x6ca6('0x5b')];_0x27f907++){if(_0x43ec39!=''){_0x43ec39+='&';}_0x43ec39+=_0x19e7ac[_0x27f907]+'='+encodeURIComponent(_0x18e9c1[_0x19e7ac[_0x27f907]]);_0x217dc8+=_0x18e9c1[_0x19e7ac[_0x27f907]];}_0x217dc8+=_0x25dc6c[_0x6ca6('0x55')];_0x217dc8=_0x97f23['createHash']('md5')[_0x6ca6('0x17')](_0x217dc8)[_0x6ca6('0x5c')](_0x6ca6('0x5d'));if(_0x43ec39!==''){_0x43ec39+='&';}_0x43ec39+=_0x6ca6('0x5e')+_0x217dc8;var _0x1e9674={'method':_0x6ca6('0x31'),'uri':_0x25dc6c['baseUrl']+_0x6ca6('0x5f')+_0x43ec39,'json':!![]};return rp(_0x1e9674)['then'](function(_0x450126){var _0x44bbe6=Object[_0x6ca6('0x59')](_0x450126);if(_0x450126[_0x44bbe6[0x0]][_0x6ca6('0x19')]&&parseInt(_0x450126[_0x44bbe6[0x0]][_0x6ca6('0x19')])===0x0){var _0x5a2775={'messageId':_0x450126[_0x44bbe6[0x0]]['id_sms']};if(!_0x25dc6c[_0x6ca6('0x34')]){_0x5a2775[_0x6ca6('0x35')]=!![];}return _0x4352a5[_0x6ca6('0x17')](_0x5a2775);}else{return logger['error'](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x54'),util[_0x6ca6('0x29')](_0x450126['error'],{'showHidden':![],'depth':null}));}})[_0x6ca6('0x18')](function(_0x377ec7){return logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),'csc',util[_0x6ca6('0x29')](_0x377ec7,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x54'),_0x6ca6('0x60'));}break;case _0x6ca6('0x61'):if(_0x25dc6c['apiKey']){var _0x5d9d14={'method':_0x6ca6('0x38'),'uri':_0x6ca6('0x62'),'headers':{'Authorization':_0x25dc6c[_0x6ca6('0x55')]},'body':{'content':_0x38678e['body'],'to':[_0x38678e[_0x6ca6('0x23')]],'from':_0x25dc6c[_0x6ca6('0x23')],'binary':![],'clientMessageId':_0x6ca6('0x63'),'charset':_0x6ca6('0x64')},'json':!![]};rp(_0x5d9d14)[_0x6ca6('0x16')](function(_0x299b87){if(!_0x299b87['error']){var _0x4e6c8c={'messageId':_0x299b87[_0x6ca6('0x21')][0x0]['apiMessageId']};if(!_0x25dc6c[_0x6ca6('0x34')]){_0x4e6c8c[_0x6ca6('0x35')]=!![];}return _0x4352a5[_0x6ca6('0x17')](_0x4e6c8c);}else{return logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x61'),util['inspect'](_0x299b87[_0x6ca6('0x19')],{'showHidden':![],'depth':null}));}})[_0x6ca6('0x18')](function(_0x1f051b){return logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x6ca6('0x29')](_0x1f051b,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x61'),'Missing\x20parameters:\x20apiKey');}break;case _0x6ca6('0x65'):if(_0x25dc6c[_0x6ca6('0x2f')]&&_0x25dc6c['password']){var _0x233193=util[_0x6ca6('0x3d')](_0x6ca6('0x3e'),_0x25dc6c['username'],_0x25dc6c[_0x6ca6('0x2c')]);var _0x231f4c={'method':'POST','uri':_0x6ca6('0x66')+_0x25dc6c['accountId']+_0x6ca6('0x67'),'body':{'to':[_0x38678e[_0x6ca6('0x23')]],'text':_0x38678e[_0x6ca6('0xc')],'from':_0x25dc6c[_0x6ca6('0x23')],'applicationId':_0x25dc6c[_0x6ca6('0x68')]},'headers':{'Authorization':util['format'](_0x6ca6('0x69'),new Buffer(_0x233193)['toString'](_0x6ca6('0x41')))},'json':!![]};rp(_0x231f4c)[_0x6ca6('0x16')](function(_0x2a79ee){if(_0x2a79ee['id']){var _0x4d4b77={'messageId':_0x2a79ee['id']};return _0x4352a5['update'](_0x4d4b77);}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x65'),util[_0x6ca6('0x29')](_0x2a79ee,{'showHidden':![],'depth':null}));}})[_0x6ca6('0x18')](function(_0x1b8c6e){logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),_0x6ca6('0x65'),util[_0x6ca6('0x29')](_0x1b8c6e,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x65'),_0x6ca6('0x53'));}break;case _0x6ca6('0x6a'):if(_0x25dc6c[_0x6ca6('0x55')]){var _0x4e714d={};var _0x1e9674={'method':_0x6ca6('0x38'),'uri':_0x6ca6('0x6b'),'headers':{'Authorization':_0x6ca6('0x6c')+_0x25dc6c[_0x6ca6('0x55')],'Content-Type':_0x6ca6('0x51')},'body':{'from':_0x25dc6c['phone'],'to':_0x38678e[_0x6ca6('0x23')],'text':_0x38678e[_0x6ca6('0xc')]},'json':!![]};return rp(_0x1e9674)[_0x6ca6('0x16')](function(_0x503670){if(_0x503670[_0x6ca6('0x6d')]==0xca){_0x4e714d['message']=_0x503670;var _0x1b67f6={'method':_0x6ca6('0x38'),'uri':_0x6ca6('0x6e'),'headers':{'Authorization':'Bearer\x20'+_0x25dc6c[_0x6ca6('0x55')],'Content-Type':'application/json'},'body':{'refid':_0x4e714d[_0x6ca6('0x6f')]['refid']},'json':!![]};return rp(_0x1b67f6)['then'](function(_0x4070c5){_0x4e714d[_0x6ca6('0x70')]=_0x4070c5;var _0x48790a={'messageId':_0x4e714d[_0x6ca6('0x6f')][_0x6ca6('0x71')],'read':!![]};return _0x4352a5['update'](_0x48790a);});}else{return logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x6a'),util[_0x6ca6('0x29')](_0x503670,{'showHidden':![],'depth':null}));}})[_0x6ca6('0x18')](function(_0x5e6f79){return logger[_0x6ca6('0x19')](_0x6ca6('0x27'),_0x6ca6('0x28'),_0x6ca6('0x6a'),util['inspect'](_0x5e6f79,{'showHidden':![],'depth':null}));});}else{return logger[_0x6ca6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x28'),'intelepeer',_0x6ca6('0x72'));}break;}}})[_0x6ca6('0x73')](function(){_0x4198dc();});}else{_0x4198dc();}}},'charset':_0x6ca6('0x74'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6c4b=['keys','sort','length','md5','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteraction','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','smsMethod','sender','login?username=','&password=','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','clicksend','password','xCALLY\x20Motion','format','%s:%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','plivo','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','text'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6c4b,0x93));var _0xb6c4=function(_0x10af12,_0x4cf4be){_0x10af12=_0x10af12-0x0;var _0x4ed7c8=_0x6c4b[_0x10af12];return _0x4ed7c8;};'use strict';var _=require(_0xb6c4('0x0'));var util=require(_0xb6c4('0x1'));var logger=require(_0xb6c4('0x2'))('api');var moment=require(_0xb6c4('0x3'));var BPromise=require(_0xb6c4('0x4'));var rp=require(_0xb6c4('0x5'));var fs=require('fs');var path=require(_0xb6c4('0x6'));var rimraf=require(_0xb6c4('0x7'));var config=require(_0xb6c4('0x8'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x1f7abc,_0x5a290a){return _0x1f7abc[_0xb6c4('0x9')](_0xb6c4('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xb6c4('0xb'),'fields':[_0xb6c4('0xb')]},{'name':_0xb6c4('0xc'),'fields':[_0xb6c4('0xd')],'type':_0xb6c4('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46b134,_0x377543,_0x4dca82){var _0x22d6fa=_0x1f7abc[_0xb6c4('0xf')];var _0x19d7bf=_0x46b134[_0xb6c4('0x10')]({'plain':!![]});if(_0x19d7bf['direction'][_0xb6c4('0x11')]()==='in'||_0x19d7bf[_0xb6c4('0x12')][_0xb6c4('0x11')]()===_0xb6c4('0x13')&&!_0x19d7bf[_0xb6c4('0x14')]&&!_[_0xb6c4('0x15')](_0x19d7bf[_0xb6c4('0x16')])){_0x22d6fa[_0xb6c4('0x17')]['findOne']({'where':{'id':_0x19d7bf['SmsInteractionId']}})[_0xb6c4('0x18')](function(_0x48e451){if(_0x48e451){_0x48e451[_0xb6c4('0x19')]({'lastMsgAt':_0x19d7bf[_0xb6c4('0x1a')],'lastMsgDirection':_0x19d7bf[_0xb6c4('0x12')]['toLowerCase']()});}})[_0xb6c4('0x1b')](function(_0x1566a8){console[_0xb6c4('0x1c')](_0x1566a8);});}if(_0x19d7bf['direction']===_0xb6c4('0x13')&&!_0x19d7bf[_0xb6c4('0x14')]){var _0x3c3204;_0x22d6fa[_0xb6c4('0x1d')][_0xb6c4('0x1e')]({'where':{'id':_0x19d7bf[_0xb6c4('0x1f')]},'raw':!![]})[_0xb6c4('0x18')](function(_0x55eb35){_0x3c3204=_0x55eb35;if(_0x3c3204&&_0x3c3204['type']){switch(_0x3c3204[_0xb6c4('0x20')]){case _0xb6c4('0x21'):var _0x1a7076=require(_0xb6c4('0x21'));if(_0x3c3204[_0xb6c4('0x22')]&&_0x3c3204[_0xb6c4('0x23')]&&_0x3c3204['phone']){var _0x49c1b5=new _0x1a7076(_0x3c3204[_0xb6c4('0x22')],_0x3c3204[_0xb6c4('0x23')]);_0x49c1b5[_0xb6c4('0x24')][_0xb6c4('0x25')]({'body':_0x19d7bf[_0xb6c4('0xd')],'to':_0x19d7bf[_0xb6c4('0x26')],'from':_0x3c3204[_0xb6c4('0x26')],'statusCallback':_0x3c3204[_0xb6c4('0x27')]+_0xb6c4('0x28')+_0x19d7bf['id']+_0xb6c4('0x29')+_0x3c3204[_0xb6c4('0x2a')]})[_0xb6c4('0x18')](function(_0x3341aa){if(_0x3341aa['sid']){return _0x46b134[_0xb6c4('0x19')]({'messageId':_0x3341aa[_0xb6c4('0x2b')]});}})[_0xb6c4('0x1b')](function(_0x547b25){logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x21'),util[_0xb6c4('0x2e')](_0x547b25,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x21'),_0xb6c4('0x2f'));}break;case'skebby':var _0x166775='https://api.skebby.it/API/v1.0/REST/';if(_0x3c3204[_0xb6c4('0x30')]&&_0x3c3204['password']){var _0xe0e62e={'recipient':[_0x19d7bf[_0xb6c4('0x26')]],'message':_0x19d7bf[_0xb6c4('0xd')],'message_type':_0x3c3204[_0xb6c4('0x31')]};if(_0x3c3204[_0xb6c4('0x31')]&&_0x3c3204[_0xb6c4('0x31')]!=='SI'){_0xe0e62e[_0xb6c4('0x32')]=_0x3c3204[_0xb6c4('0x26')];}var _0x5266c2={'url':_0x166775+_0xb6c4('0x33')+_0x3c3204[_0xb6c4('0x30')]+_0xb6c4('0x34')+_0x3c3204['password'],'method':'GET'};rp(_0x5266c2)[_0xb6c4('0x18')](function(_0x205010){var _0x846441=_0x205010['split'](';');var _0x50cdee={'user_key':_0x846441[0x0],'session_key':_0x846441[0x1]};_0x5266c2={'url':_0x166775+_0xb6c4('0x35'),'method':_0xb6c4('0x36'),'headers':{'user_key':_0x50cdee[_0xb6c4('0x37')],'Session_key':_0x50cdee[_0xb6c4('0x38')]},'json':!![],'body':_0xe0e62e};return rp(_0x5266c2);})[_0xb6c4('0x18')](function(_0xfdfe1d){if(_0xfdfe1d[_0xb6c4('0x39')]>=0x1){var _0x68265b={'messageId':_0xfdfe1d[_0xb6c4('0x3a')]};if(_0x3c3204['smsMethod']!=='GP'||!_0x3c3204[_0xb6c4('0x3b')]){_0x68265b[_0xb6c4('0x3c')]=!![];}return _0x46b134[_0xb6c4('0x19')](_0x68265b);}else{return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x3d'),util[_0xb6c4('0x2e')](_0xfdfe1d,{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0x2f79a1){return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'skebby',util['inspect'](_0x2f79a1,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),_0xb6c4('0x3d'),_0xb6c4('0x3e'));}break;case _0xb6c4('0x3f'):if(_0x3c3204[_0xb6c4('0x23')]){var _0x412052={'recipient':_0x19d7bf[_0xb6c4('0x26')],'message':_0x19d7bf[_0xb6c4('0xd')],'sender':_0x3c3204[_0xb6c4('0x40')]||_0x3c3204[_0xb6c4('0x26')],'authorization':_0x3c3204[_0xb6c4('0x23')]};var _0x377543={'method':_0xb6c4('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x412052,'json':!![]};rp(_0x377543)[_0xb6c4('0x18')](function(_0x894946){var _0x33b69d={'messageId':_0x894946[_0xb6c4('0x41')]};if(!_0x3c3204[_0xb6c4('0x3b')]){_0x33b69d['read']=!![];}return _0x46b134[_0xb6c4('0x19')](_0x33b69d);})[_0xb6c4('0x1b')](function(_0xc50fdf){logger['error'](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x3f'),util[_0xb6c4('0x2e')](_0xc50fdf,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xb6c4('0x42'):if(_0x3c3204[_0xb6c4('0x30')]&&_0x3c3204[_0xb6c4('0x43')]){var _0x412052={'messages':[{'source':_0xb6c4('0x44'),'to':_0x19d7bf[_0xb6c4('0x26')],'body':_0x19d7bf[_0xb6c4('0xd')],'from':_0x3c3204[_0xb6c4('0x40')]||_0x3c3204[_0xb6c4('0x26')]}]};var _0x615726=util[_0xb6c4('0x45')](_0xb6c4('0x46'),_0x3c3204[_0xb6c4('0x30')],_0x3c3204['password']);var _0x377543={'method':_0xb6c4('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x412052,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x615726)[_0xb6c4('0x47')](_0xb6c4('0x48')))},'json':!![]};rp(_0x377543)['then'](function(_0x30767f){if(_0x30767f[_0xb6c4('0x49')]>=0xc8&&_0x30767f['http_code']<=0xce){if(_0x30767f[_0xb6c4('0x4a')]&&_0x30767f[_0xb6c4('0x4a')][_0xb6c4('0x4b')]>0x0){var _0x2cc7a7=_[_0xb6c4('0x4c')](_0x30767f[_0xb6c4('0x4a')]['messages']);var _0x348260={'messageId':_0x2cc7a7[_0xb6c4('0x4d')]};if(!_0x3c3204['deliveryReport']){_0x348260[_0xb6c4('0x3c')]=!![];}return _0x46b134[_0xb6c4('0x19')](_0x348260);}else{logger[_0xb6c4('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),_0xb6c4('0x4e'),util[_0xb6c4('0x2e')](_0x30767f,{'showHidden':![],'depth':null}));}}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),'afterCreate',_0xb6c4('0x4e'),util[_0xb6c4('0x2e')](_0x30767f,{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0xa256a3){logger[_0xb6c4('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),_0xb6c4('0x4e'),util[_0xb6c4('0x2e')](_0xa256a3,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'clickSend',_0xb6c4('0x3e'));}break;case'plivo':if(_0x3c3204[_0xb6c4('0x4f')]&&_0x3c3204[_0xb6c4('0x23')]){var _0x412052={'dst':_0x19d7bf[_0xb6c4('0x26')],'text':_0x19d7bf[_0xb6c4('0xd')],'src':_0x3c3204[_0xb6c4('0x40')]||_0x3c3204[_0xb6c4('0x26')],'url':_0x3c3204['remote']+_0xb6c4('0x28')+_0x19d7bf['id']+'/status?token='+_0x3c3204[_0xb6c4('0x2a')]};var _0x615726=util['format'](_0xb6c4('0x46'),_0x3c3204[_0xb6c4('0x4f')],_0x3c3204['authToken']);var _0x377543={'method':_0xb6c4('0x36'),'uri':util[_0xb6c4('0x45')](_0xb6c4('0x50'),_0x3c3204[_0xb6c4('0x4f')]),'body':_0x412052,'headers':{'Authorization':util[_0xb6c4('0x45')](_0xb6c4('0x51'),new Buffer(_0x615726)['toString']('base64'))},'json':!![]};rp(_0x377543)['then'](function(_0x4d3443){var _0x2d4f29={'messageId':_0x4d3443[_0xb6c4('0x52')][0x0]};return _0x46b134[_0xb6c4('0x19')](_0x2d4f29);})[_0xb6c4('0x1b')](function(_0x37bc8a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',util[_0xb6c4('0x2e')](_0x37bc8a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x53'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xb6c4('0x54'):if(_0x3c3204[_0xb6c4('0x30')]&&_0x3c3204[_0xb6c4('0x43')]){if(_0x3c3204['baseUrl']){var _0x4d1329={'method':_0xb6c4('0x36'),'uri':_0x3c3204[_0xb6c4('0x55')]+'/auth/1/session','body':{'username':_0x3c3204[_0xb6c4('0x30')],'password':_0x3c3204[_0xb6c4('0x43')]},'json':!![]};return rp(_0x4d1329)[_0xb6c4('0x18')](function(_0x334a05){var _0x15c30c={'method':'POST','uri':_0x3c3204['baseUrl']+_0xb6c4('0x56'),'body':{'messages':[{'from':_0x3c3204['phone'],'destinations':[{'to':_0x19d7bf[_0xb6c4('0x26')]}],'text':_0x19d7bf[_0xb6c4('0xd')],'notifyUrl':_0x3c3204['remote']+_0xb6c4('0x28')+_0x19d7bf['id']+_0xb6c4('0x29')+_0x3c3204[_0xb6c4('0x2a')],'notifyContentType':_0xb6c4('0x57'),'callbackData':_0x3c3204[_0xb6c4('0x26')]+';'+_0x19d7bf[_0xb6c4('0xd')]}]},'headers':{'Authorization':_0xb6c4('0x58')+_0x334a05[_0xb6c4('0x2a')]},'json':!![]};return rp(_0x15c30c)[_0xb6c4('0x18')](function(_0x5e783a){if(_0x5e783a[_0xb6c4('0x24')]){var _0x4eab1e={'messageId':_0x5e783a[_0xb6c4('0x24')][0x0][_0xb6c4('0xb')]};if(!_0x3c3204[_0xb6c4('0x3b')]){_0x4eab1e[_0xb6c4('0x3c')]=!![];}return _0x46b134[_0xb6c4('0x19')](_0x4eab1e);}else{return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'infobip',util[_0xb6c4('0x2e')](_0x5e783a,{'showHidden':![],'depth':null}));}});})[_0xb6c4('0x1b')](function(_0x204ba4){return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x54'),util[_0xb6c4('0x2e')](_0x204ba4,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),'afterCreate',_0xb6c4('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x54'),_0xb6c4('0x3e'));}break;case _0xb6c4('0x59'):var _0x3b16fc=require(_0xb6c4('0x5a'));if(_0x3c3204[_0xb6c4('0x5b')]){var _0x361123={};_0x361123['login']=_0x3c3204[_0xb6c4('0x30')];_0x361123[_0xb6c4('0x26')]=_0x19d7bf[_0xb6c4('0x26')];_0x361123[_0xb6c4('0x32')]=_0x3c3204[_0xb6c4('0x26')];_0x361123[_0xb6c4('0x5c')]=_0x19d7bf['body'];_0x361123['timestamp']=+new Date();var _0x27b984='';var _0x475338='';var _0x8d538f=Object[_0xb6c4('0x5d')](_0x361123);_0x8d538f[_0xb6c4('0x5e')]();for(var _0x741b84=0x0;_0x741b84<_0x8d538f[_0xb6c4('0x5f')];_0x741b84++){if(_0x27b984!=''){_0x27b984+='&';}_0x27b984+=_0x8d538f[_0x741b84]+'='+encodeURIComponent(_0x361123[_0x8d538f[_0x741b84]]);_0x475338+=_0x361123[_0x8d538f[_0x741b84]];}_0x475338+=_0x3c3204['apiKey'];_0x475338=_0x3b16fc['createHash'](_0xb6c4('0x60'))[_0xb6c4('0x19')](_0x475338)['digest']('hex');if(_0x27b984!==''){_0x27b984+='&';}_0x27b984+=_0xb6c4('0x61')+_0x475338;var _0x5266c2={'method':_0xb6c4('0x62'),'uri':_0x3c3204[_0xb6c4('0x55')]+_0xb6c4('0x63')+_0x27b984,'json':!![]};return rp(_0x5266c2)[_0xb6c4('0x18')](function(_0x4175bd){var _0x29a385=Object[_0xb6c4('0x5d')](_0x4175bd);if(_0x4175bd[_0x29a385[0x0]][_0xb6c4('0x1c')]&&parseInt(_0x4175bd[_0x29a385[0x0]][_0xb6c4('0x1c')])===0x0){var _0x1827b4={'messageId':_0x4175bd[_0x29a385[0x0]][_0xb6c4('0x64')]};if(!_0x3c3204[_0xb6c4('0x3b')]){_0x1827b4[_0xb6c4('0x3c')]=!![];}return _0x46b134[_0xb6c4('0x19')](_0x1827b4);}else{return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x59'),util['inspect'](_0x4175bd[_0xb6c4('0x1c')],{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0xfed01e){return logger[_0xb6c4('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),'csc',util[_0xb6c4('0x2e')](_0xfed01e,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),'afterCreate',_0xb6c4('0x59'),_0xb6c4('0x65'));}break;case _0xb6c4('0x66'):if(_0x3c3204[_0xb6c4('0x5b')]){var _0x325ae7={'method':'POST','uri':_0xb6c4('0x67'),'headers':{'Authorization':_0x3c3204[_0xb6c4('0x5b')]},'body':{'content':_0x19d7bf[_0xb6c4('0xd')],'to':[_0x19d7bf[_0xb6c4('0x26')]],'from':_0x3c3204['phone'],'binary':![],'clientMessageId':'uuid','charset':_0xb6c4('0x68')},'json':!![]};rp(_0x325ae7)['then'](function(_0xb89375){if(!_0xb89375['error']){var _0x46e43e={'messageId':_0xb89375[_0xb6c4('0x24')][0x0][_0xb6c4('0x69')]};if(!_0x3c3204['deliveryReport']){_0x46e43e['read']=!![];}return _0x46b134[_0xb6c4('0x19')](_0x46e43e);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),_0xb6c4('0x66'),util['inspect'](_0xb89375[_0xb6c4('0x1c')],{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0x3148b3){return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x66'),util[_0xb6c4('0x2e')](_0x3148b3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6c4('0x2d'),_0xb6c4('0x66'),_0xb6c4('0x65'));}break;case _0xb6c4('0x6a'):if(_0x3c3204[_0xb6c4('0x30')]&&_0x3c3204[_0xb6c4('0x43')]){var _0x615726=util[_0xb6c4('0x45')]('%s:%s',_0x3c3204[_0xb6c4('0x30')],_0x3c3204[_0xb6c4('0x43')]);var _0x377543={'method':_0xb6c4('0x36'),'uri':_0xb6c4('0x6b')+_0x3c3204[_0xb6c4('0x6c')]+'/messages','body':{'to':[_0x19d7bf[_0xb6c4('0x26')]],'text':_0x19d7bf[_0xb6c4('0xd')],'from':_0x3c3204[_0xb6c4('0x26')],'applicationId':_0x3c3204[_0xb6c4('0x6d')]},'headers':{'Authorization':util[_0xb6c4('0x45')](_0xb6c4('0x51'),new Buffer(_0x615726)['toString'](_0xb6c4('0x48')))},'json':!![]};rp(_0x377543)['then'](function(_0x17b9f4){if(_0x17b9f4['id']){var _0x11494d={'messageId':_0x17b9f4['id']};return _0x46b134[_0xb6c4('0x19')](_0x11494d);}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x6a'),util[_0xb6c4('0x2e')](_0x17b9f4,{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0x375509){logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'bandwidth',util[_0xb6c4('0x2e')](_0x375509,{'showHidden':![],'depth':null}));});}else{logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x6a'),_0xb6c4('0x3e'));}break;case _0xb6c4('0x6e'):if(_0x3c3204[_0xb6c4('0x5b')]){var _0x4a5399={};var _0x5266c2={'method':_0xb6c4('0x36'),'uri':_0xb6c4('0x6f'),'headers':{'Authorization':_0xb6c4('0x70')+_0x3c3204[_0xb6c4('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x3c3204[_0xb6c4('0x26')],'to':_0x19d7bf[_0xb6c4('0x26')],'text':_0x19d7bf[_0xb6c4('0xd')]},'json':!![]};return rp(_0x5266c2)[_0xb6c4('0x18')](function(_0x5ec505){if(_0x5ec505[_0xb6c4('0x71')]==0xca){_0x4a5399[_0xb6c4('0x72')]=_0x5ec505;var _0x4942c4={'method':_0xb6c4('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xb6c4('0x70')+_0x3c3204[_0xb6c4('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x4a5399[_0xb6c4('0x72')][_0xb6c4('0x73')]},'json':!![]};return rp(_0x4942c4)[_0xb6c4('0x18')](function(_0xc974ca){_0x4a5399[_0xb6c4('0x74')]=_0xc974ca;var _0x148399={'messageId':_0x4a5399[_0xb6c4('0x72')][_0xb6c4('0x73')],'read':!![]};return _0x46b134[_0xb6c4('0x19')](_0x148399);});}else{return logger[_0xb6c4('0x1c')](_0xb6c4('0x2c'),_0xb6c4('0x2d'),_0xb6c4('0x6e'),util['inspect'](_0x5ec505,{'showHidden':![],'depth':null}));}})[_0xb6c4('0x1b')](function(_0xc37aed){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0xb6c4('0x2e')](_0xc37aed,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xb6c4('0x2c'),_0xb6c4('0x2d'),'intelepeer',_0xb6c4('0x75'));}break;}}})[_0xb6c4('0x76')](function(){_0x4dca82();});}else{_0x4dca82();}}},'charset':'utf8mb4','collate':_0xb6c4('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index a5a4659..31175f0 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 _0x5580=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsMessage','create','body','options','raw','then','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','localhost','redis','./smsMessage.socket','request'];(function(_0x31377e,_0x4c41e7){var _0x3c2ae2=function(_0x52b3d0){while(--_0x52b3d0){_0x31377e['push'](_0x31377e['shift']());}};_0x3c2ae2(++_0x4c41e7);}(_0x5580,0x14f));var _0x0558=function(_0x3e1dcb,_0x4a3361){_0x3e1dcb=_0x3e1dcb-0x0;var _0x22e525=_0x5580[_0x3e1dcb];return _0x22e525;};'use strict';var _=require(_0x0558('0x0'));var util=require(_0x0558('0x1'));var moment=require('moment');var BPromise=require(_0x0558('0x2'));var rs=require(_0x0558('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0558('0x4'));var config=require(_0x0558('0x5'));var jayson=require(_0x0558('0x6'));var client=jayson[_0x0558('0x7')][_0x0558('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0558('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0558('0xa')]));require(_0x0558('0xb'))['register'](socket);function respondWithRpcPromise(_0x4c718e,_0x3aa9a0,_0x3562b7){return new BPromise(function(_0x481ab0,_0x2ffd39){return client[_0x0558('0xc')](_0x4c718e,_0x3562b7)['then'](function(_0x2de400){logger[_0x0558('0xd')](_0x0558('0xe'),_0x3aa9a0,_0x0558('0xf'));logger[_0x0558('0x10')](_0x0558('0x11'),_0x3aa9a0,_0x0558('0xf'),JSON[_0x0558('0x12')](_0x2de400));if(_0x2de400['error']){if(_0x2de400['error']['code']===0x1f4){logger[_0x0558('0x13')](_0x0558('0xe'),_0x3aa9a0,_0x2de400[_0x0558('0x13')][_0x0558('0x14')]);return _0x2ffd39(_0x2de400[_0x0558('0x13')][_0x0558('0x14')]);}logger[_0x0558('0x13')]('SmsMessage,\x20%s,\x20%s',_0x3aa9a0,_0x2de400[_0x0558('0x13')][_0x0558('0x14')]);return _0x481ab0(_0x2de400[_0x0558('0x13')][_0x0558('0x14')]);}else{logger[_0x0558('0xd')](_0x0558('0xe'),_0x3aa9a0,_0x0558('0xf'));_0x481ab0(_0x2de400[_0x0558('0x15')]['message']);}})[_0x0558('0x16')](function(_0x526d07){logger[_0x0558('0x13')](_0x0558('0xe'),_0x3aa9a0,_0x526d07);_0x2ffd39(_0x526d07);});});}exports[_0x0558('0x17')]=function(_0x8b9375){var _0x586c25=this;return new Promise(function(_0x5e4c00,_0x40de7c){return db['SmsMessage'][_0x0558('0x18')](_0x8b9375[_0x0558('0x19')],{'raw':_0x8b9375['options']?_0x8b9375[_0x0558('0x1a')][_0x0558('0x1b')]===undefined?!![]:![]:!![]})[_0x0558('0x1c')](function(_0x326eec){logger[_0x0558('0xd')](_0x0558('0x17'),_0x8b9375);logger[_0x0558('0x10')](_0x0558('0x17'),_0x8b9375,JSON['stringify'](_0x326eec));_0x5e4c00(_0x326eec);})['catch'](function(_0x9bf9a6){logger[_0x0558('0x13')](_0x0558('0x17'),_0x9bf9a6[_0x0558('0x14')],_0x8b9375);_0x40de7c(_0x586c25[_0x0558('0x13')](0x1f4,_0x9bf9a6[_0x0558('0x14')]));});});}; \ No newline at end of file +var _0x1a0e=['code','message','catch','SmsMessage','create','body','options','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xeea8e9,_0x511a75){var _0x406ef0=function(_0x416c4d){while(--_0x416c4d){_0xeea8e9['push'](_0xeea8e9['shift']());}};_0x406ef0(++_0x511a75);}(_0x1a0e,0x1b5));var _0xe1a0=function(_0x2e78db,_0x5ab8a1){_0x2e78db=_0x2e78db-0x0;var _0x195fb4=_0x1a0e[_0x2e78db];return _0x195fb4;};'use strict';var _=require(_0xe1a0('0x0'));var util=require(_0xe1a0('0x1'));var moment=require(_0xe1a0('0x2'));var BPromise=require(_0xe1a0('0x3'));var rs=require(_0xe1a0('0x4'));var fs=require('fs');var Redis=require(_0xe1a0('0x5'));var db=require(_0xe1a0('0x6'))['db'];var utils=require(_0xe1a0('0x7'));var logger=require('../../config/logger')(_0xe1a0('0x8'));var config=require(_0xe1a0('0x9'));var jayson=require(_0xe1a0('0xa'));var client=jayson[_0xe1a0('0xb')][_0xe1a0('0xc')]({'port':0x232a});config[_0xe1a0('0xd')]=_[_0xe1a0('0xe')](config[_0xe1a0('0xd')],{'host':_0xe1a0('0xf'),'port':0x18eb});var socket=require(_0xe1a0('0x10'))(new Redis(config[_0xe1a0('0xd')]));require('./smsMessage.socket')[_0xe1a0('0x11')](socket);function respondWithRpcPromise(_0xe110f6,_0x1e76db,_0x59b643){return new BPromise(function(_0x3bff72,_0x127db6){return client[_0xe1a0('0x12')](_0xe110f6,_0x59b643)['then'](function(_0x34d4bb){logger[_0xe1a0('0x13')](_0xe1a0('0x14'),_0x1e76db,_0xe1a0('0x15'));logger[_0xe1a0('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1e76db,_0xe1a0('0x15'),JSON[_0xe1a0('0x17')](_0x34d4bb));if(_0x34d4bb[_0xe1a0('0x18')]){if(_0x34d4bb[_0xe1a0('0x18')][_0xe1a0('0x19')]===0x1f4){logger['error'](_0xe1a0('0x14'),_0x1e76db,_0x34d4bb['error'][_0xe1a0('0x1a')]);return _0x127db6(_0x34d4bb[_0xe1a0('0x18')][_0xe1a0('0x1a')]);}logger[_0xe1a0('0x18')](_0xe1a0('0x14'),_0x1e76db,_0x34d4bb['error']['message']);return _0x3bff72(_0x34d4bb[_0xe1a0('0x18')]['message']);}else{logger['info'](_0xe1a0('0x14'),_0x1e76db,_0xe1a0('0x15'));_0x3bff72(_0x34d4bb['result'][_0xe1a0('0x1a')]);}})[_0xe1a0('0x1b')](function(_0x1fea2b){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1e76db,_0x1fea2b);_0x127db6(_0x1fea2b);});});}exports['CreateSmsMessage']=function(_0x405e19){var _0x1d0150=this;return new Promise(function(_0x523d73,_0x457bb0){return db[_0xe1a0('0x1c')][_0xe1a0('0x1d')](_0x405e19[_0xe1a0('0x1e')],{'raw':_0x405e19[_0xe1a0('0x1f')]?_0x405e19[_0xe1a0('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d8e67){logger['info'](_0xe1a0('0x20'),_0x405e19);logger[_0xe1a0('0x16')](_0xe1a0('0x20'),_0x405e19,JSON[_0xe1a0('0x17')](_0x3d8e67));_0x523d73(_0x3d8e67);})[_0xe1a0('0x1b')](function(_0x54630b){logger['error'](_0xe1a0('0x20'),_0x54630b[_0xe1a0('0x1a')],_0x405e19);_0x457bb0(_0x1d0150['error'](0x1f4,_0x54630b[_0xe1a0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index db7d1b0..a1575cd 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 _0x4843=['emit','removeListener','register','length','./smsMessage.events','save','remove'];(function(_0x181dfe,_0xf84557){var _0x40c38f=function(_0x3aa818){while(--_0x3aa818){_0x181dfe['push'](_0x181dfe['shift']());}};_0x40c38f(++_0xf84557);}(_0x4843,0x19a));var _0x3484=function(_0x3df220,_0x5569cd){_0x3df220=_0x3df220-0x0;var _0x1e4054=_0x4843[_0x3df220];return _0x1e4054;};'use strict';var SmsMessageEvents=require(_0x3484('0x0'));var events=[_0x3484('0x1'),_0x3484('0x2'),'update'];function createListener(_0x76e306,_0x28682b){return function(_0x10abf0){_0x28682b[_0x3484('0x3')](_0x76e306,_0x10abf0);};}function removeListener(_0x10ac09,_0x1de239){return function(){SmsMessageEvents[_0x3484('0x4')](_0x10ac09,_0x1de239);};}exports[_0x3484('0x5')]=function(_0x55738c){for(var _0x1717df=0x0,_0x59d4ff=events[_0x3484('0x6')];_0x1717df<_0x59d4ff;_0x1717df++){var _0x582bd0=events[_0x1717df];var _0x53b6a9=createListener('smsMessage:'+_0x582bd0,_0x55738c);SmsMessageEvents['on'](_0x582bd0,_0x53b6a9);}}; \ No newline at end of file +var _0xe999=['length','smsMessage:','save','update','emit','removeListener','register'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe999,0x136));var _0x9e99=function(_0xb70c5b,_0x19e6b3){_0xb70c5b=_0xb70c5b-0x0;var _0x9927c3=_0xe999[_0xb70c5b];return _0x9927c3;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x9e99('0x0'),'remove',_0x9e99('0x1')];function createListener(_0x13cb76,_0x7cb67f){return function(_0x550364){_0x7cb67f[_0x9e99('0x2')](_0x13cb76,_0x550364);};}function removeListener(_0x2bacb2,_0x693a74){return function(){SmsMessageEvents[_0x9e99('0x3')](_0x2bacb2,_0x693a74);};}exports[_0x9e99('0x4')]=function(_0x483e6b){for(var _0x1ec968=0x0,_0x33bc75=events[_0x9e99('0x5')];_0x1ec968<_0x33bc75;_0x1ec968++){var _0x682803=events[_0x1ec968];var _0x4a89c5=createListener(_0x9e99('0x6')+_0x682803,_0x483e6b);SmsMessageEvents['on'](_0x682803,_0x4a89c5);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f21a3f6..68a08f7 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 _0x58cc=['../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x58cc,0xa6));var _0xc58c=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x58cc[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0xc58c('0x0'));var util=require(_0xc58c('0x1'));var path=require(_0xc58c('0x2'));var timeout=require(_0xc58c('0x3'));var express=require(_0xc58c('0x4'));var router=express[_0xc58c('0x5')]();var fs_extra=require(_0xc58c('0x6'));var auth=require(_0xc58c('0x7'));var interaction=require(_0xc58c('0x8'));var config=require(_0xc58c('0x9'));var controller=require(_0xc58c('0xa'));router[_0xc58c('0xb')]('/',auth[_0xc58c('0xc')](),controller['index']);router[_0xc58c('0xb')](_0xc58c('0xd'),auth[_0xc58c('0xc')](),controller['describe']);router[_0xc58c('0xb')](_0xc58c('0xe'),auth[_0xc58c('0xc')](),controller[_0xc58c('0xf')]);router['get']('/:id/members',auth[_0xc58c('0xc')](),controller[_0xc58c('0x10')]);router[_0xc58c('0xb')](_0xc58c('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0xc58c('0xb')](_0xc58c('0x12'),auth[_0xc58c('0xc')](),controller[_0xc58c('0x13')]);router[_0xc58c('0x14')]('/',auth[_0xc58c('0xc')](),controller[_0xc58c('0x15')]);router[_0xc58c('0x14')](_0xc58c('0x11'),auth[_0xc58c('0xc')](),controller[_0xc58c('0x16')]);router[_0xc58c('0x14')](_0xc58c('0x12'),auth[_0xc58c('0xc')](),controller[_0xc58c('0x17')]);router[_0xc58c('0x18')](_0xc58c('0xe'),auth[_0xc58c('0xc')](),controller[_0xc58c('0x19')]);router[_0xc58c('0x1a')]('/:id',auth[_0xc58c('0xc')](),controller[_0xc58c('0x1b')]);router[_0xc58c('0x1a')]('/:id/teams',auth[_0xc58c('0xc')](),controller['removeTeams']);router[_0xc58c('0x1a')](_0xc58c('0x12'),auth[_0xc58c('0xc')](),controller['removeAgents']);module[_0xc58c('0x1c')]=router; \ No newline at end of file +var _0xffa9=['show','/:id/members','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','addAgents','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x3e630f,_0x1d4b4d){var _0x9ebd58=function(_0x533c88){while(--_0x533c88){_0x3e630f['push'](_0x3e630f['shift']());}};_0x9ebd58(++_0x1d4b4d);}(_0xffa9,0x16c));var _0x9ffa=function(_0x1aac60,_0x2e5ce5){_0x1aac60=_0x1aac60-0x0;var _0x186adf=_0xffa9[_0x1aac60];return _0x186adf;};'use strict';var multer=require('multer');var util=require(_0x9ffa('0x0'));var path=require(_0x9ffa('0x1'));var timeout=require(_0x9ffa('0x2'));var express=require(_0x9ffa('0x3'));var router=express['Router']();var fs_extra=require(_0x9ffa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9ffa('0x5'));var config=require(_0x9ffa('0x6'));var controller=require('./smsQueue.controller');router[_0x9ffa('0x7')]('/',auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x9')]);router[_0x9ffa('0x7')]('/describe',auth[_0x9ffa('0x8')](),controller['describe']);router['get'](_0x9ffa('0xa'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0xb')]);router['get'](_0x9ffa('0xc'),auth[_0x9ffa('0x8')](),controller['getMembers']);router[_0x9ffa('0x7')]('/:id/teams',auth[_0x9ffa('0x8')](),controller[_0x9ffa('0xd')]);router[_0x9ffa('0x7')]('/:id/users',auth[_0x9ffa('0x8')](),controller[_0x9ffa('0xe')]);router[_0x9ffa('0xf')]('/',auth[_0x9ffa('0x8')](),controller['create']);router[_0x9ffa('0xf')](_0x9ffa('0x10'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x11')]);router[_0x9ffa('0xf')](_0x9ffa('0x12'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x13')]);router['put'](_0x9ffa('0xa'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x14')]);router[_0x9ffa('0x15')](_0x9ffa('0xa'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x16')]);router[_0x9ffa('0x15')](_0x9ffa('0x10'),auth[_0x9ffa('0x8')](),controller['removeTeams']);router[_0x9ffa('0x15')](_0x9ffa('0x12'),auth[_0x9ffa('0x8')](),controller[_0x9ffa('0x17')]);module[_0x9ffa('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 716ccb6..f621f53 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 _0x665c=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x665c,0x7b));var _0xc665=function(_0x26bf96,_0x58e883){_0x26bf96=_0x26bf96-0x0;var _0x911dd7=_0x665c[_0x26bf96];return _0x911dd7;};'use strict';var Sequelize=require(_0xc665('0x0'));module[_0xc665('0x1')]={'name':{'type':Sequelize[_0xc665('0x2')],'unique':_0xc665('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc665('0x2')]},'timeout':{'type':Sequelize[_0xc665('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc665('0x5')]('rrmemory',_0xc665('0x6'),_0xc665('0x7'))}}; \ No newline at end of file +var _0x2a97=['name','INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3ce0a7,_0x4bf1af){var _0x3d359a=function(_0x5dc909){while(--_0x5dc909){_0x3ce0a7['push'](_0x3ce0a7['shift']());}};_0x3d359a(++_0x4bf1af);}(_0x2a97,0x146));var _0x72a9=function(_0x2a69b2,_0xd13d12){_0x2a69b2=_0x2a69b2-0x0;var _0x2cde72=_0x2a97[_0x2a69b2];return _0x2cde72;};'use strict';var Sequelize=require(_0x72a9('0x0'));module[_0x72a9('0x1')]={'name':{'type':Sequelize[_0x72a9('0x2')],'unique':_0x72a9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x72a9('0x2')]},'timeout':{'type':Sequelize[_0x72a9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x72a9('0x5'),_0x72a9('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5d7c8cc..65eff45 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 _0x9a55=['query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','findAndCountAll','UserId','agent','smsPause','updatedAt','%s/%s','createdAt','getTeams','addTeams','Team','User','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','ids','select','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','includes','all','union','value','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key'];(function(_0x350d76,_0x1ffccd){var _0x53d681=function(_0x496a64){while(--_0x496a64){_0x350d76['push'](_0x350d76['shift']());}};_0x53d681(++_0x1ffccd);}(_0x9a55,0xe2));var _0x59a5=function(_0x47d7bf,_0x4ead0d){_0x47d7bf=_0x47d7bf-0x0;var _0x15e50a=_0x9a55[_0x47d7bf];return _0x15e50a;};'use strict';var emlformat=require(_0x59a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59a5('0x1'));var jsonpatch=require(_0x59a5('0x2'));var rp=require(_0x59a5('0x3'));var moment=require('moment');var BPromise=require(_0x59a5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x59a5('0x5'));var sox=require('sox');var csv=require(_0x59a5('0x6'));var ejs=require(_0x59a5('0x7'));var fs=require('fs');var fs_extra=require(_0x59a5('0x8'));var _=require(_0x59a5('0x9'));var squel=require(_0x59a5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x59a5('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x59a5('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x59a5('0xd'));var as=require(_0x59a5('0xe'));var hardwareService=require(_0x59a5('0xf'));var logger=require(_0x59a5('0x10'))(_0x59a5('0x11'));var utils=require(_0x59a5('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x59a5('0x13'))['db'];config[_0x59a5('0x14')]=_[_0x59a5('0x15')](config[_0x59a5('0x14')],{'host':_0x59a5('0x16'),'port':0x18eb});var socket=require(_0x59a5('0x17'))(new Redis(config[_0x59a5('0x14')]));require(_0x59a5('0x18'))['register'](socket);function respondWithStatusCode(_0x2ed149,_0xc8d8f3){_0xc8d8f3=_0xc8d8f3||0xcc;return function(_0x13a2c5){if(_0x13a2c5){return _0x2ed149[_0x59a5('0x19')](_0xc8d8f3);}return _0x2ed149[_0x59a5('0x1a')](_0xc8d8f3)[_0x59a5('0x1b')]();};}function respondWithResult(_0x25b019,_0x1a64df){_0x1a64df=_0x1a64df||0xc8;return function(_0x543fc7){if(_0x543fc7){return _0x25b019['status'](_0x1a64df)[_0x59a5('0x1c')](_0x543fc7);}};}function respondWithFilteredResult(_0xe4fee1,_0x3c3c20){return function(_0x44ef9a){if(_0x44ef9a){var _0x518857=typeof _0x3c3c20[_0x59a5('0x1d')]===_0x59a5('0x1e')&&typeof _0x3c3c20[_0x59a5('0x1f')]===_0x59a5('0x1e');var _0x46a0f8=_0x44ef9a['count'];var _0x7a941d=_0x518857?0x0:_0x3c3c20[_0x59a5('0x1d')];var _0xce24=_0x518857?_0x44ef9a['count']:_0x3c3c20['offset']+_0x3c3c20[_0x59a5('0x1f')];var _0x51fe04;if(_0xce24>=_0x46a0f8){_0xce24=_0x46a0f8;_0x51fe04=0xc8;}else{_0x51fe04=0xce;}_0xe4fee1[_0x59a5('0x1a')](_0x51fe04);return _0xe4fee1[_0x59a5('0x20')](_0x59a5('0x21'),_0x7a941d+'-'+_0xce24+'/'+_0x46a0f8)[_0x59a5('0x1c')](_0x44ef9a);}return null;};}function patchUpdates(_0x536339){return function(_0x1b83ec){try{jsonpatch[_0x59a5('0x22')](_0x1b83ec,_0x536339,!![]);}catch(_0x285a62){return BPromise[_0x59a5('0x23')](_0x285a62);}return _0x1b83ec[_0x59a5('0x24')]();};}function saveUpdates(_0x53865c,_0x3cd87e){return function(_0x71ae61){if(_0x71ae61){return _0x71ae61[_0x59a5('0x25')](_0x53865c)[_0x59a5('0x26')](function(_0x5b8f10){return _0x5b8f10;});}return null;};}function removeEntity(_0x5981c0,_0x1667a4){return function(_0x24eee2){if(_0x24eee2){return _0x24eee2['destroy']()[_0x59a5('0x26')](function(){var _0x4e43cd=_0x24eee2[_0x59a5('0x27')]({'plain':!![]});var _0x464722=_0x59a5('0x28');return db[_0x59a5('0x29')][_0x59a5('0x2a')]({'where':{'type':_0x464722,'resourceId':_0x4e43cd['id']}})['then'](function(){return _0x24eee2;});})['then'](function(){_0x5981c0['status'](0xcc)[_0x59a5('0x1b')]();});}};}function handleEntityNotFound(_0x2c9160,_0x5eacd6){return function(_0x5d93c3){if(!_0x5d93c3){_0x2c9160['sendStatus'](0x194);}return _0x5d93c3;};}function handleError(_0x2ea5ef,_0x3b6f94){_0x3b6f94=_0x3b6f94||0x1f4;return function(_0x549718){logger[_0x59a5('0x2b')](_0x549718[_0x59a5('0x2c')]);if(_0x549718[_0x59a5('0x2d')]){delete _0x549718[_0x59a5('0x2d')];}_0x2ea5ef[_0x59a5('0x1a')](_0x3b6f94)[_0x59a5('0x2e')](_0x549718);};}exports[_0x59a5('0x2f')]=function(_0x4fa68d,_0xfae469){var _0x18e2c2={},_0x181cdd={},_0x56c35f={'count':0x0,'rows':[]};var _0x5937e4=_[_0x59a5('0x30')](db[_0x59a5('0x31')][_0x59a5('0x32')],function(_0x2475db){return{'name':_0x2475db[_0x59a5('0x33')],'type':_0x2475db[_0x59a5('0x34')][_0x59a5('0x35')]};});_0x181cdd['model']=_[_0x59a5('0x30')](_0x5937e4,'name');_0x181cdd[_0x59a5('0x36')]=_[_0x59a5('0x37')](_0x4fa68d['query']);_0x181cdd[_0x59a5('0x38')]=_[_0x59a5('0x39')](_0x181cdd['model'],_0x181cdd[_0x59a5('0x36')]);_0x18e2c2[_0x59a5('0x3a')]=_[_0x59a5('0x39')](_0x181cdd[_0x59a5('0x3b')],qs[_0x59a5('0x3c')](_0x4fa68d[_0x59a5('0x36')]['fields']));_0x18e2c2[_0x59a5('0x3a')]=_0x18e2c2[_0x59a5('0x3a')][_0x59a5('0x3d')]?_0x18e2c2[_0x59a5('0x3a')]:_0x181cdd['model'];if(!_0x4fa68d[_0x59a5('0x36')][_0x59a5('0x3e')](_0x59a5('0x3f'))){_0x18e2c2[_0x59a5('0x1f')]=qs['limit'](_0x4fa68d[_0x59a5('0x36')][_0x59a5('0x1f')]);_0x18e2c2[_0x59a5('0x1d')]=qs[_0x59a5('0x1d')](_0x4fa68d[_0x59a5('0x36')]['offset']);}_0x18e2c2[_0x59a5('0x40')]=qs[_0x59a5('0x41')](_0x4fa68d[_0x59a5('0x36')]['sort']);_0x18e2c2[_0x59a5('0x42')]=qs['filters'](_[_0x59a5('0x43')](_0x4fa68d[_0x59a5('0x36')],_0x181cdd['filters']),_0x5937e4);if(_0x4fa68d[_0x59a5('0x36')][_0x59a5('0x44')]){_0x18e2c2[_0x59a5('0x42')]=_[_0x59a5('0x45')](_0x18e2c2[_0x59a5('0x42')],{'$or':_[_0x59a5('0x30')](_0x5937e4,function(_0x3d45d3){if(_0x3d45d3[_0x59a5('0x34')]!==_0x59a5('0x46')){var _0x351566={};_0x351566[_0x3d45d3[_0x59a5('0x2d')]]={'$like':'%'+_0x4fa68d[_0x59a5('0x36')]['filter']+'%'};return _0x351566;}})});}_0x18e2c2=_[_0x59a5('0x45')]({},_0x18e2c2,_0x4fa68d[_0x59a5('0x47')]);var _0x59363e={'where':_0x18e2c2[_0x59a5('0x42')]};return db[_0x59a5('0x31')]['count'](_0x59363e)['then'](function(_0x331cde){_0x56c35f[_0x59a5('0x48')]=_0x331cde;if(_0x4fa68d[_0x59a5('0x36')][_0x59a5('0x49')]){_0x18e2c2[_0x59a5('0x4a')]=[{'all':!![]}];}return db[_0x59a5('0x31')][_0x59a5('0x4b')](_0x18e2c2);})['then'](function(_0x7d826){_0x56c35f[_0x59a5('0x4c')]=_0x7d826;return _0x56c35f;})['then'](respondWithFilteredResult(_0xfae469,_0x18e2c2))[_0x59a5('0x4d')](handleError(_0xfae469,null));};exports[_0x59a5('0x4e')]=function(_0x243074,_0x4fbac2){var _0x589406={'raw':!![],'where':{'id':_0x243074[_0x59a5('0x4f')]['id']}},_0x272d13={};_0x272d13[_0x59a5('0x3b')]=_[_0x59a5('0x37')](db[_0x59a5('0x31')][_0x59a5('0x32')]);_0x272d13[_0x59a5('0x36')]=_[_0x59a5('0x37')](_0x243074['query']);_0x272d13['filters']=_[_0x59a5('0x39')](_0x272d13[_0x59a5('0x3b')],_0x272d13[_0x59a5('0x36')]);_0x589406['attributes']=_[_0x59a5('0x39')](_0x272d13[_0x59a5('0x3b')],qs[_0x59a5('0x3c')](_0x243074[_0x59a5('0x36')]['fields']));_0x589406[_0x59a5('0x3a')]=_0x589406[_0x59a5('0x3a')][_0x59a5('0x3d')]?_0x589406[_0x59a5('0x3a')]:_0x272d13[_0x59a5('0x3b')];if(_0x243074['query'][_0x59a5('0x49')]){_0x589406['include']=[{'all':!![]}];}_0x589406=_[_0x59a5('0x45')]({},_0x589406,_0x243074[_0x59a5('0x47')]);return db[_0x59a5('0x31')]['find'](_0x589406)[_0x59a5('0x26')](handleEntityNotFound(_0x4fbac2,null))[_0x59a5('0x26')](respondWithResult(_0x4fbac2,null))[_0x59a5('0x4d')](handleError(_0x4fbac2,null));};exports['create']=function(_0x5cdd2b,_0x3f3461){return db[_0x59a5('0x31')][_0x59a5('0x50')](_0x5cdd2b[_0x59a5('0x51')],{})['then'](function(_0x192a5a){var _0x716de1=_0x5cdd2b[_0x59a5('0x52')][_0x59a5('0x27')]({'plain':!![]});if(!_0x716de1)throw new Error(_0x59a5('0x53'));if(_0x716de1[_0x59a5('0x54')]===_0x59a5('0x52')){var _0x5b9627=_0x192a5a[_0x59a5('0x27')]({'plain':!![]});var _0x2d8771=_0x59a5('0x28');return db[_0x59a5('0x55')][_0x59a5('0x56')]({'where':{'name':_0x2d8771,'userProfileId':_0x716de1[_0x59a5('0x57')]},'raw':!![]})[_0x59a5('0x26')](function(_0x1ebb70){if(_0x1ebb70&&_0x1ebb70[_0x59a5('0x58')]===0x0){return db[_0x59a5('0x29')][_0x59a5('0x50')]({'name':_0x5b9627[_0x59a5('0x2d')],'resourceId':_0x5b9627['id'],'type':_0x1ebb70[_0x59a5('0x2d')],'sectionId':_0x1ebb70['id']},{})['then'](function(){return _0x192a5a;});}else{return _0x192a5a;}})['catch'](function(_0x16c5f5){logger[_0x59a5('0x2b')](_0x59a5('0x59'),_0x16c5f5);throw _0x16c5f5;});}return _0x192a5a;})[_0x59a5('0x26')](respondWithResult(_0x3f3461,0xc9))[_0x59a5('0x4d')](handleError(_0x3f3461,null));};exports[_0x59a5('0x25')]=function(_0x2aaa01,_0x884050){if(_0x2aaa01[_0x59a5('0x51')]['id']){delete _0x2aaa01[_0x59a5('0x51')]['id'];}return db['SmsQueue'][_0x59a5('0x56')]({'where':{'id':_0x2aaa01[_0x59a5('0x4f')]['id']}})[_0x59a5('0x26')](handleEntityNotFound(_0x884050,null))[_0x59a5('0x26')](saveUpdates(_0x2aaa01[_0x59a5('0x51')],null))[_0x59a5('0x26')](respondWithResult(_0x884050,null))['catch'](handleError(_0x884050,null));};exports[_0x59a5('0x2a')]=function(_0x1858ee,_0x525368){return db[_0x59a5('0x31')][_0x59a5('0x56')]({'where':{'id':_0x1858ee[_0x59a5('0x4f')]['id']}})[_0x59a5('0x26')](handleEntityNotFound(_0x525368,null))[_0x59a5('0x26')](removeEntity(_0x525368,null))[_0x59a5('0x4d')](handleError(_0x525368,null));};exports[_0x59a5('0x5a')]=function(_0x29c09d,_0x294e60){return db['SmsQueue'][_0x59a5('0x5a')]()['then'](respondWithResult(_0x294e60,null))['catch'](handleError(_0x294e60,null));};exports['getMembers']=function(_0x23bc2c,_0x5ea408,_0x2a4eca){var _0x38f60c={'raw':!![],'where':{}},_0x345723={},_0x27f397;return db['SmsQueue'][_0x59a5('0x5b')]({'where':{'id':_0x23bc2c['params']['id']}})[_0x59a5('0x26')](handleEntityNotFound(_0x5ea408,null))[_0x59a5('0x26')](function(_0x5a2790){if(_0x5a2790){_0x27f397=_0x5a2790[_0x59a5('0x27')]({'plain':!![]});_0x345723[_0x59a5('0x3b')]=_[_0x59a5('0x37')](db[_0x59a5('0x5c')]['rawAttributes']);_0x345723[_0x59a5('0x36')]=_[_0x59a5('0x37')](_0x23bc2c[_0x59a5('0x36')]);_0x345723[_0x59a5('0x38')]=_[_0x59a5('0x39')](_0x345723[_0x59a5('0x3b')],_0x345723[_0x59a5('0x36')]);_0x38f60c[_0x59a5('0x3a')]=_[_0x59a5('0x39')](_0x345723[_0x59a5('0x3b')],qs['fields'](_0x23bc2c[_0x59a5('0x36')][_0x59a5('0x3c')]));_0x38f60c['attributes']=_0x38f60c[_0x59a5('0x3a')][_0x59a5('0x3d')]?_0x38f60c['attributes']:_0x345723['model'];if(!_0x23bc2c['query']['hasOwnProperty'](_0x59a5('0x3f'))){_0x38f60c[_0x59a5('0x1f')]=qs[_0x59a5('0x1f')](_0x23bc2c['query']['limit']);_0x38f60c[_0x59a5('0x1d')]=qs[_0x59a5('0x1d')](_0x23bc2c['query'][_0x59a5('0x1d')]);}_0x38f60c['order']=qs['sort'](_0x23bc2c[_0x59a5('0x36')][_0x59a5('0x41')]);_0x38f60c[_0x59a5('0x42')]=qs[_0x59a5('0x38')](_['pick'](_0x23bc2c['query'],_0x345723[_0x59a5('0x38')]));_0x38f60c['where']['SmsQueueId']=_0x5a2790['id'];if(_0x23bc2c['query'][_0x59a5('0x44')]){_0x38f60c[_0x59a5('0x42')]=_[_0x59a5('0x45')](_0x38f60c[_0x59a5('0x42')],{'$or':_[_0x59a5('0x30')](_0x38f60c['attributes'],function(_0x2ff451){var _0x2bb630={};_0x2bb630[_0x2ff451]={'$like':'%'+_0x23bc2c[_0x59a5('0x36')][_0x59a5('0x44')]+'%'};return _0x2bb630;})});}_0x38f60c=_[_0x59a5('0x45')]({},_0x38f60c,_0x23bc2c[_0x59a5('0x47')]);return db[_0x59a5('0x5c')][_0x59a5('0x4b')](_0x38f60c);}})[_0x59a5('0x26')](function(_0x34c58a){if(_0x34c58a){return db['User'][_0x59a5('0x5d')]({'where':{'id':_[_0x59a5('0x30')](_0x34c58a,_0x59a5('0x5e')),'role':_0x59a5('0x5f')},'attributes':['id',_0x59a5('0x2d'),_0x59a5('0x60'),_0x59a5('0x61'),'createdAt']});}})[_0x59a5('0x26')](function(_0x5654fc){if(_0x5654fc){return{'count':_0x5654fc[_0x59a5('0x48')],'rows':_[_0x59a5('0x30')](_0x5654fc[_0x59a5('0x4c')],function(_0x596041){return{'membername':_0x596041['name'],'UserId':_0x596041['id'],'queue_name':_0x27f397[_0x59a5('0x2d')],'SmsQueueId':_0x27f397['id'],'interface':util['format'](_0x59a5('0x62'),'SIP',_0x596041[_0x59a5('0x2d')]),'penalty':0x0,'paused':_0x596041['smsPause'],'createdAt':_0x596041[_0x59a5('0x63')],'updatedAt':_0x596041[_0x59a5('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x59a5('0x26')](respondWithFilteredResult(_0x5ea408,_0x38f60c))[_0x59a5('0x4d')](handleError(_0x5ea408,null));};exports[_0x59a5('0x64')]=function(_0x3eb3f4,_0x5de518,_0x1a26c9){var _0x49e3dd={};var _0x3a9370={};var _0x4f584f;var _0xbec3c5;return db[_0x59a5('0x31')][_0x59a5('0x5b')]({'where':{'id':_0x3eb3f4['params']['id']}})[_0x59a5('0x26')](handleEntityNotFound(_0x5de518,null))[_0x59a5('0x26')](function(_0x558168){if(_0x558168){_0x4f584f=_0x558168;_0x3a9370[_0x59a5('0x3b')]=_[_0x59a5('0x37')](db['Team'][_0x59a5('0x32')]);_0x3a9370['query']=_[_0x59a5('0x37')](_0x3eb3f4[_0x59a5('0x36')]);_0x3a9370[_0x59a5('0x38')]=_[_0x59a5('0x39')](_0x3a9370['model'],_0x3a9370[_0x59a5('0x36')]);_0x49e3dd[_0x59a5('0x3a')]=_[_0x59a5('0x39')](_0x3a9370[_0x59a5('0x3b')],qs[_0x59a5('0x3c')](_0x3eb3f4[_0x59a5('0x36')][_0x59a5('0x3c')]));_0x49e3dd[_0x59a5('0x3a')]=_0x49e3dd[_0x59a5('0x3a')][_0x59a5('0x3d')]?_0x49e3dd[_0x59a5('0x3a')]:_0x3a9370[_0x59a5('0x3b')];_0x49e3dd[_0x59a5('0x40')]=qs[_0x59a5('0x41')](_0x3eb3f4[_0x59a5('0x36')][_0x59a5('0x41')]);_0x49e3dd['where']=qs[_0x59a5('0x38')](_[_0x59a5('0x43')](_0x3eb3f4['query'],_0x3a9370[_0x59a5('0x38')]));if(_0x3eb3f4[_0x59a5('0x36')][_0x59a5('0x44')]){_0x49e3dd[_0x59a5('0x42')]=_[_0x59a5('0x45')](_0x49e3dd['where'],{'$or':_[_0x59a5('0x30')](_0x49e3dd[_0x59a5('0x3a')],function(_0x5a3bed){var _0x22da6e={};_0x22da6e[_0x5a3bed]={'$like':'%'+_0x3eb3f4['query'][_0x59a5('0x44')]+'%'};return _0x22da6e;})});}_0x49e3dd=_[_0x59a5('0x45')]({},_0x49e3dd,_0x3eb3f4[_0x59a5('0x47')]);return _0x4f584f[_0x59a5('0x64')](_0x49e3dd);}})['then'](function(_0xef780b){if(_0xef780b){_0xbec3c5=_0xef780b[_0x59a5('0x3d')];if(!_0x3eb3f4['query'][_0x59a5('0x3e')](_0x59a5('0x3f'))){_0x49e3dd[_0x59a5('0x1f')]=qs['limit'](_0x3eb3f4[_0x59a5('0x36')]['limit']);_0x49e3dd[_0x59a5('0x1d')]=qs[_0x59a5('0x1d')](_0x3eb3f4[_0x59a5('0x36')][_0x59a5('0x1d')]);}return _0x4f584f['getTeams'](_0x49e3dd);}})[_0x59a5('0x26')](function(_0x3ad2c4){if(_0x3ad2c4){return _0x3ad2c4?{'count':_0xbec3c5,'rows':_0x3ad2c4}:null;}})['then'](respondWithResult(_0x5de518,null))[_0x59a5('0x4d')](handleError(_0x5de518,null));};exports[_0x59a5('0x65')]=function(_0x69dcc0,_0x4c3aa0,_0x23fb8c){var _0x2675f7=_0x69dcc0[_0x59a5('0x51')]['ids'];return db[_0x59a5('0x66')][_0x59a5('0x4b')]({'where':{'id':_0x2675f7},'attributes':['id'],'include':[{'model':db[_0x59a5('0x67')],'as':_0x59a5('0x68'),'attributes':['id',_0x59a5('0x2d'),'online',_0x59a5('0x69'),'interface'],'raw':!![]}]})[_0x59a5('0x26')](function(_0x4f74c9){if(_0x4f74c9){var _0x5a6844=_[_0x59a5('0x6a')](_0x4f74c9,function(_0x5ea2a9){var _0x509e98=_0x5ea2a9[_0x59a5('0x27')]({'plain':!![]});return _0x509e98[_0x59a5('0x68')];});return db[_0x59a5('0x31')][_0x59a5('0x56')]({'where':{'id':_0x69dcc0['params']['id']}})[_0x59a5('0x26')](function(_0x3a1ddf){return db[_0x59a5('0x6b')][_0x59a5('0x6c')](function(_0x3cfbda){return _0x3a1ddf[_0x59a5('0x65')](_0x2675f7,{'transaction':_0x3cfbda})[_0x59a5('0x26')](function(){return BPromise[_0x59a5('0x6d')](_0x5a6844,function(_0x493cd6){return db['UserSmsQueue'][_0x59a5('0x6e')]({'where':{'UserId':_0x493cd6['id'],'SmsQueueId':_0x69dcc0[_0x59a5('0x4f')]['id']},'transaction':_0x3cfbda});});})[_0x59a5('0x26')](function(){_0x5a6844['forEach'](function(_0x3993b9){socket[_0x59a5('0x6f')]('userSmsQueue:save',{'UserId':_0x3993b9['id'],'SmsQueueId':_0x3a1ddf['id']});});});});});}})[_0x59a5('0x26')](respondWithStatusCode(_0x4c3aa0,null))[_0x59a5('0x4d')](handleError(_0x4c3aa0,null));};exports[_0x59a5('0x70')]=function(_0x3d9bdf,_0x13ccec,_0x7430b6){return db[_0x59a5('0x66')]['findAll']({'where':{'id':_0x3d9bdf['query'][_0x59a5('0x71')]},'attributes':['id'],'include':[{'model':db[_0x59a5('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x59a5('0x26')](handleEntityNotFound(_0x13ccec,null))['then'](function(_0x3ecd04){var _0x5e1ca5=_[_0x59a5('0x30')](_0x3ecd04,'id');var _0x2f5963=[];var _0x39ef52=[];var _0x455b21=squel[_0x59a5('0x72')]();_0x455b21['field']('tq.TeamId')[_0x59a5('0x73')](_0x59a5('0x74'),'tq')[_0x59a5('0x75')](_0x59a5('0x76'),'ut',_0x59a5('0x77'))['where'](_0x59a5('0x78'),_0x3d9bdf[_0x59a5('0x4f')]['id']);for(var _0x541f4d=0x0;_0x541f4d<_0x3ecd04[_0x59a5('0x3d')];_0x541f4d+=0x1){let _0x24a741=_0x3ecd04[_0x541f4d];for(var _0x26616f=0x0;_0x26616f<_0x24a741[_0x59a5('0x68')]['length'];_0x26616f+=0x1){let _0xc7b44=_0x24a741['Agents'][_0x26616f];var _0x2eec9a=_0x455b21[_0x59a5('0x79')]();_0x2eec9a['where'](_0x59a5('0x7a'),_0xc7b44['id']);_0x39ef52[_0x59a5('0x7b')](db[_0x59a5('0x6b')][_0x59a5('0x36')](_0x2eec9a[_0x59a5('0x7c')](),{'type':db[_0x59a5('0x6b')]['QueryTypes']['SELECT']})[_0x59a5('0x26')](function(_0x103f36){if(_0x103f36['length']===0x1){return _0xc7b44['id'];}else{var _0x34d4d4=_[_0x59a5('0x7d')](_[_0x59a5('0x30')](_0x103f36,'TeamId'),function(_0x2299e5){return _[_0x59a5('0x7e')](_0x5e1ca5,_0x2299e5);});if(_0x34d4d4){return _0xc7b44['id'];}}}));}}return BPromise[_0x59a5('0x7f')](_0x39ef52)['then'](function(_0x59c22c){_0x2f5963=_(_0x2f5963)[_0x59a5('0x80')](_0x59c22c)['compact']()[_0x59a5('0x81')]();return db[_0x59a5('0x31')][_0x59a5('0x56')]({'where':{'id':_0x3d9bdf['params']['id']}})[_0x59a5('0x26')](function(_0x2d40ff){return db[_0x59a5('0x6b')][_0x59a5('0x6c')](function(_0x461014){return _0x2d40ff[_0x59a5('0x70')](_0x3d9bdf['query'][_0x59a5('0x71')],{'transaction':_0x461014})[_0x59a5('0x26')](function(){if(!_[_0x59a5('0x82')](_0x2f5963)){return _0x2d40ff[_0x59a5('0x83')](_0x2f5963,{'transaction':_0x461014});}})[_0x59a5('0x26')](function(){_0x2f5963[_0x59a5('0x84')](function(_0xc39623){socket[_0x59a5('0x6f')](_0x59a5('0x85'),{'UserId':_0xc39623,'SmsQueueId':_0x2d40ff['id']});});});});});});})['then'](respondWithStatusCode(_0x13ccec,null))[_0x59a5('0x4d')](handleError(_0x13ccec,null));};exports[_0x59a5('0x86')]=function(_0x8a117b,_0x398a2c,_0x1c9474){return db['SmsQueue']['find']({'where':{'id':_0x8a117b['params']['id']}})['then'](handleEntityNotFound(_0x398a2c,null))[_0x59a5('0x26')](function(_0x3ab98b){if(_0x3ab98b){return _0x3ab98b[_0x59a5('0x86')](_0x8a117b[_0x59a5('0x51')][_0x59a5('0x71')],_[_0x59a5('0x87')](_0x8a117b['body'],['ids','id'])||{})[_0x59a5('0x88')](function(_0x3b449c){for(var _0x59daa3=0x0;_0x59daa3<_0x8a117b[_0x59a5('0x51')][_0x59a5('0x71')][_0x59a5('0x3d')];_0x59daa3+=0x1){socket[_0x59a5('0x6f')](_0x59a5('0x89'),{'UserId':Number(_0x8a117b[_0x59a5('0x51')]['ids'][_0x59daa3]),'SmsQueueId':Number(_0x8a117b[_0x59a5('0x4f')]['id'])});}return _0x3b449c;});}})[_0x59a5('0x26')](respondWithResult(_0x398a2c,null))[_0x59a5('0x4d')](handleError(_0x398a2c,null));};exports[_0x59a5('0x83')]=function(_0x18264c,_0x3ad67e,_0x4eec71){return db[_0x59a5('0x31')]['find']({'where':{'id':_0x18264c[_0x59a5('0x4f')]['id']}})[_0x59a5('0x26')](handleEntityNotFound(_0x3ad67e,null))[_0x59a5('0x26')](function(_0x64c50d){if(_0x64c50d){return _0x64c50d[_0x59a5('0x83')](_0x18264c[_0x59a5('0x36')]['ids'])['then'](function(){if(_[_0x59a5('0x8a')](_0x18264c[_0x59a5('0x36')][_0x59a5('0x71')])){for(var _0x1b9b1a=0x0;_0x1b9b1a<_0x18264c[_0x59a5('0x36')]['ids'][_0x59a5('0x3d')];_0x1b9b1a+=0x1){socket[_0x59a5('0x6f')](_0x59a5('0x85'),{'UserId':Number(_0x18264c[_0x59a5('0x36')][_0x59a5('0x71')][_0x1b9b1a]),'SmsQueueId':Number(_0x18264c[_0x59a5('0x4f')]['id'])});}}else{socket['emit'](_0x59a5('0x85'),{'UserId':Number(_0x18264c[_0x59a5('0x36')]['ids']),'SmsQueueId':Number(_0x18264c['params']['id'])});}});}})[_0x59a5('0x26')](respondWithStatusCode(_0x3ad67e,null))[_0x59a5('0x4d')](handleError(_0x3ad67e,null));};exports[_0x59a5('0x8b')]=function(_0xd1e4da,_0xb6bc31,_0x51beef){var _0x15d1bb={};var _0x22363d={};var _0x480c7b;var _0x33917e;return db[_0x59a5('0x31')][_0x59a5('0x5b')]({'where':{'id':_0xd1e4da['params']['id']}})[_0x59a5('0x26')](handleEntityNotFound(_0xb6bc31,null))[_0x59a5('0x26')](function(_0xe05963){if(_0xe05963){_0x480c7b=_0xe05963;_0x22363d[_0x59a5('0x3b')]=_[_0x59a5('0x37')](db[_0x59a5('0x67')][_0x59a5('0x32')]);_0x22363d['query']=_[_0x59a5('0x37')](_0xd1e4da[_0x59a5('0x36')]);_0x22363d[_0x59a5('0x38')]=_[_0x59a5('0x39')](_0x22363d[_0x59a5('0x3b')],_0x22363d[_0x59a5('0x36')]);_0x15d1bb[_0x59a5('0x3a')]=_[_0x59a5('0x39')](_0x22363d['model'],qs[_0x59a5('0x3c')](_0xd1e4da[_0x59a5('0x36')][_0x59a5('0x3c')]));_0x15d1bb[_0x59a5('0x3a')]=_0x15d1bb[_0x59a5('0x3a')]['length']?_0x15d1bb[_0x59a5('0x3a')]:_0x22363d[_0x59a5('0x3b')];_0x15d1bb[_0x59a5('0x40')]=qs['sort'](_0xd1e4da[_0x59a5('0x36')][_0x59a5('0x41')]);_0x15d1bb[_0x59a5('0x42')]=qs[_0x59a5('0x38')](_[_0x59a5('0x43')](_0xd1e4da[_0x59a5('0x36')],_0x22363d[_0x59a5('0x38')]));if(_0xd1e4da[_0x59a5('0x36')][_0x59a5('0x44')]){_0x15d1bb['where']=_[_0x59a5('0x45')](_0x15d1bb[_0x59a5('0x42')],{'$or':_['map'](_0x15d1bb[_0x59a5('0x3a')],function(_0x3de31b){var _0x485fea={};_0x485fea[_0x3de31b]={'$like':'%'+_0xd1e4da[_0x59a5('0x36')][_0x59a5('0x44')]+'%'};return _0x485fea;})});}_0x15d1bb=_[_0x59a5('0x45')]({},_0x15d1bb,_0xd1e4da[_0x59a5('0x47')]);return _0x480c7b[_0x59a5('0x8b')](_0x15d1bb);}})[_0x59a5('0x26')](function(_0x13f2a8){if(_0x13f2a8){_0x33917e=_0x13f2a8[_0x59a5('0x3d')];if(!_0xd1e4da[_0x59a5('0x36')][_0x59a5('0x3e')](_0x59a5('0x3f'))){_0x15d1bb[_0x59a5('0x1f')]=qs['limit'](_0xd1e4da[_0x59a5('0x36')][_0x59a5('0x1f')]);_0x15d1bb['offset']=qs['offset'](_0xd1e4da[_0x59a5('0x36')][_0x59a5('0x1d')]);}return _0x480c7b[_0x59a5('0x8b')](_0x15d1bb);}})[_0x59a5('0x26')](function(_0x1609f9){if(_0x1609f9){return _0x1609f9?{'count':_0x33917e,'rows':_0x1609f9}:null;}})[_0x59a5('0x26')](respondWithResult(_0xb6bc31,null))['catch'](handleError(_0xb6bc31,null));}; \ No newline at end of file +var _0xeda7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','undefined','count','offset','limit','apply','reject','save','then','destroy','get','SmsQueues','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','SmsQueue','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','nolimit','order','pick','SmsQueueId','User','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','Agents','online','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x5d55a4,_0x557084){var _0x579597=function(_0x518ec6){while(--_0x518ec6){_0x5d55a4['push'](_0x5d55a4['shift']());}};_0x579597(++_0x557084);}(_0xeda7,0x196));var _0x7eda=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xeda7[_0x209fcd];return _0x501d5e;};'use strict';var emlformat=require(_0x7eda('0x0'));var rimraf=require(_0x7eda('0x1'));var zipdir=require(_0x7eda('0x2'));var jsonpatch=require(_0x7eda('0x3'));var rp=require(_0x7eda('0x4'));var moment=require(_0x7eda('0x5'));var BPromise=require(_0x7eda('0x6'));var Mustache=require(_0x7eda('0x7'));var util=require(_0x7eda('0x8'));var path=require(_0x7eda('0x9'));var sox=require(_0x7eda('0xa'));var csv=require(_0x7eda('0xb'));var ejs=require(_0x7eda('0xc'));var fs=require('fs');var fs_extra=require(_0x7eda('0xd'));var _=require(_0x7eda('0xe'));var squel=require(_0x7eda('0xf'));var crypto=require(_0x7eda('0x10'));var jsforce=require(_0x7eda('0x11'));var deskjs=require(_0x7eda('0x12'));var toCsv=require(_0x7eda('0xb'));var querystring=require('querystring');var Papa=require(_0x7eda('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7eda('0x14'));var as=require(_0x7eda('0x15'));var hardwareService=require(_0x7eda('0x16'));var logger=require(_0x7eda('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7eda('0x18'));var licenseUtil=require(_0x7eda('0x19'));var db=require(_0x7eda('0x1a'))['db'];config[_0x7eda('0x1b')]=_['defaults'](config[_0x7eda('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x7eda('0x1c'))(new Redis(config[_0x7eda('0x1b')]));require(_0x7eda('0x1d'))[_0x7eda('0x1e')](socket);function respondWithStatusCode(_0x3de1be,_0x192ab2){_0x192ab2=_0x192ab2||0xcc;return function(_0x951dfa){if(_0x951dfa){return _0x3de1be[_0x7eda('0x1f')](_0x192ab2);}return _0x3de1be[_0x7eda('0x20')](_0x192ab2)['end']();};}function respondWithResult(_0x4d13db,_0x106f26){_0x106f26=_0x106f26||0xc8;return function(_0x5331a5){if(_0x5331a5){return _0x4d13db['status'](_0x106f26)[_0x7eda('0x21')](_0x5331a5);}};}function respondWithFilteredResult(_0x44c83e,_0x97792c){return function(_0x8a1a07){if(_0x8a1a07){var _0x586344=typeof _0x97792c['offset']==='undefined'&&typeof _0x97792c['limit']===_0x7eda('0x22');var _0x558ecb=_0x8a1a07[_0x7eda('0x23')];var _0x1e0bcd=_0x586344?0x0:_0x97792c[_0x7eda('0x24')];var _0x3e7786=_0x586344?_0x8a1a07['count']:_0x97792c[_0x7eda('0x24')]+_0x97792c[_0x7eda('0x25')];var _0x3d73ce;if(_0x3e7786>=_0x558ecb){_0x3e7786=_0x558ecb;_0x3d73ce=0xc8;}else{_0x3d73ce=0xce;}_0x44c83e[_0x7eda('0x20')](_0x3d73ce);return _0x44c83e['set']('Content-Range',_0x1e0bcd+'-'+_0x3e7786+'/'+_0x558ecb)[_0x7eda('0x21')](_0x8a1a07);}return null;};}function patchUpdates(_0x58c409){return function(_0x3a1ef8){try{jsonpatch[_0x7eda('0x26')](_0x3a1ef8,_0x58c409,!![]);}catch(_0x557fec){return BPromise[_0x7eda('0x27')](_0x557fec);}return _0x3a1ef8[_0x7eda('0x28')]();};}function saveUpdates(_0x1c064d,_0x331b5f){return function(_0x40dc99){if(_0x40dc99){return _0x40dc99['update'](_0x1c064d)[_0x7eda('0x29')](function(_0x2ca61d){return _0x2ca61d;});}return null;};}function removeEntity(_0x1a4950,_0x5ae8ff){return function(_0x30fc8e){if(_0x30fc8e){return _0x30fc8e[_0x7eda('0x2a')]()[_0x7eda('0x29')](function(){var _0x76f1b2=_0x30fc8e[_0x7eda('0x2b')]({'plain':!![]});var _0x41ca40=_0x7eda('0x2c');return db[_0x7eda('0x2d')][_0x7eda('0x2a')]({'where':{'type':_0x41ca40,'resourceId':_0x76f1b2['id']}})[_0x7eda('0x29')](function(){return _0x30fc8e;});})['then'](function(){_0x1a4950[_0x7eda('0x20')](0xcc)[_0x7eda('0x2e')]();});}};}function handleEntityNotFound(_0x300e20,_0x2c5af0){return function(_0x5661fe){if(!_0x5661fe){_0x300e20[_0x7eda('0x1f')](0x194);}return _0x5661fe;};}function handleError(_0xb0b2bd,_0x5e1957){_0x5e1957=_0x5e1957||0x1f4;return function(_0x1bef90){logger[_0x7eda('0x2f')](_0x1bef90['stack']);if(_0x1bef90[_0x7eda('0x30')]){delete _0x1bef90[_0x7eda('0x30')];}_0xb0b2bd[_0x7eda('0x20')](_0x5e1957)[_0x7eda('0x31')](_0x1bef90);};}exports[_0x7eda('0x32')]=function(_0x6a95e7,_0x17bdc1){var _0x234200={},_0xac4dc7={},_0x42fb31={'count':0x0,'rows':[]};var _0x516b44=_[_0x7eda('0x33')](db['SmsQueue'][_0x7eda('0x34')],function(_0xce5037){return{'name':_0xce5037[_0x7eda('0x35')],'type':_0xce5037[_0x7eda('0x36')]['key']};});_0xac4dc7[_0x7eda('0x37')]=_[_0x7eda('0x33')](_0x516b44,_0x7eda('0x30'));_0xac4dc7['query']=_[_0x7eda('0x38')](_0x6a95e7[_0x7eda('0x39')]);_0xac4dc7[_0x7eda('0x3a')]=_['intersection'](_0xac4dc7[_0x7eda('0x37')],_0xac4dc7[_0x7eda('0x39')]);_0x234200[_0x7eda('0x3b')]=_[_0x7eda('0x3c')](_0xac4dc7['model'],qs[_0x7eda('0x3d')](_0x6a95e7[_0x7eda('0x39')]['fields']));_0x234200[_0x7eda('0x3b')]=_0x234200[_0x7eda('0x3b')][_0x7eda('0x3e')]?_0x234200[_0x7eda('0x3b')]:_0xac4dc7['model'];if(!_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x3f')]('nolimit')){_0x234200['limit']=qs[_0x7eda('0x25')](_0x6a95e7[_0x7eda('0x39')]['limit']);_0x234200[_0x7eda('0x24')]=qs[_0x7eda('0x24')](_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x24')]);}_0x234200['order']=qs['sort'](_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x40')]);_0x234200[_0x7eda('0x41')]=qs[_0x7eda('0x3a')](_['pick'](_0x6a95e7[_0x7eda('0x39')],_0xac4dc7[_0x7eda('0x3a')]),_0x516b44);if(_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x42')]){_0x234200[_0x7eda('0x41')]=_[_0x7eda('0x43')](_0x234200['where'],{'$or':_[_0x7eda('0x33')](_0x516b44,function(_0x234e10){if(_0x234e10[_0x7eda('0x36')]!=='VIRTUAL'){var _0x1b385b={};_0x1b385b[_0x234e10[_0x7eda('0x30')]]={'$like':'%'+_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x42')]+'%'};return _0x1b385b;}})});}_0x234200=_[_0x7eda('0x43')]({},_0x234200,_0x6a95e7[_0x7eda('0x44')]);var _0x1cabea={'where':_0x234200['where']};return db['SmsQueue'][_0x7eda('0x23')](_0x1cabea)[_0x7eda('0x29')](function(_0x425a16){_0x42fb31[_0x7eda('0x23')]=_0x425a16;if(_0x6a95e7[_0x7eda('0x39')][_0x7eda('0x45')]){_0x234200[_0x7eda('0x46')]=[{'all':!![]}];}return db[_0x7eda('0x47')][_0x7eda('0x48')](_0x234200);})[_0x7eda('0x29')](function(_0x17251a){_0x42fb31[_0x7eda('0x49')]=_0x17251a;return _0x42fb31;})[_0x7eda('0x29')](respondWithFilteredResult(_0x17bdc1,_0x234200))[_0x7eda('0x4a')](handleError(_0x17bdc1,null));};exports['show']=function(_0x1347fa,_0x38ef5e){var _0x4257b5={'raw':!![],'where':{'id':_0x1347fa[_0x7eda('0x4b')]['id']}},_0x5b3093={};_0x5b3093['model']=_[_0x7eda('0x38')](db[_0x7eda('0x47')][_0x7eda('0x34')]);_0x5b3093[_0x7eda('0x39')]=_['keys'](_0x1347fa[_0x7eda('0x39')]);_0x5b3093[_0x7eda('0x3a')]=_['intersection'](_0x5b3093[_0x7eda('0x37')],_0x5b3093['query']);_0x4257b5[_0x7eda('0x3b')]=_[_0x7eda('0x3c')](_0x5b3093[_0x7eda('0x37')],qs[_0x7eda('0x3d')](_0x1347fa['query']['fields']));_0x4257b5[_0x7eda('0x3b')]=_0x4257b5[_0x7eda('0x3b')][_0x7eda('0x3e')]?_0x4257b5[_0x7eda('0x3b')]:_0x5b3093[_0x7eda('0x37')];if(_0x1347fa[_0x7eda('0x39')][_0x7eda('0x45')]){_0x4257b5[_0x7eda('0x46')]=[{'all':!![]}];}_0x4257b5=_[_0x7eda('0x43')]({},_0x4257b5,_0x1347fa[_0x7eda('0x44')]);return db[_0x7eda('0x47')]['find'](_0x4257b5)[_0x7eda('0x29')](handleEntityNotFound(_0x38ef5e,null))[_0x7eda('0x29')](respondWithResult(_0x38ef5e,null))[_0x7eda('0x4a')](handleError(_0x38ef5e,null));};exports[_0x7eda('0x4c')]=function(_0x43ed16,_0x45ee89){return db['SmsQueue'][_0x7eda('0x4c')](_0x43ed16[_0x7eda('0x4d')],{})['then'](function(_0x47530d){var _0x4238e4=_0x43ed16[_0x7eda('0x4e')]['get']({'plain':!![]});if(!_0x4238e4)throw new Error(_0x7eda('0x4f'));if(_0x4238e4['role']===_0x7eda('0x4e')){var _0x479915=_0x47530d[_0x7eda('0x2b')]({'plain':!![]});var _0x1b4ac5='SmsQueues';return db[_0x7eda('0x50')][_0x7eda('0x51')]({'where':{'name':_0x1b4ac5,'userProfileId':_0x4238e4['userProfileId']},'raw':!![]})[_0x7eda('0x29')](function(_0x1211a5){if(_0x1211a5&&_0x1211a5[_0x7eda('0x52')]===0x0){return db[_0x7eda('0x2d')][_0x7eda('0x4c')]({'name':_0x479915[_0x7eda('0x30')],'resourceId':_0x479915['id'],'type':_0x1211a5[_0x7eda('0x30')],'sectionId':_0x1211a5['id']},{})[_0x7eda('0x29')](function(){return _0x47530d;});}else{return _0x47530d;}})[_0x7eda('0x4a')](function(_0x35a8e2){logger[_0x7eda('0x2f')](_0x7eda('0x53'),_0x35a8e2);throw _0x35a8e2;});}return _0x47530d;})['then'](respondWithResult(_0x45ee89,0xc9))[_0x7eda('0x4a')](handleError(_0x45ee89,null));};exports['update']=function(_0x4f7d8f,_0x418a77){if(_0x4f7d8f[_0x7eda('0x4d')]['id']){delete _0x4f7d8f[_0x7eda('0x4d')]['id'];}return db[_0x7eda('0x47')]['find']({'where':{'id':_0x4f7d8f[_0x7eda('0x4b')]['id']}})[_0x7eda('0x29')](handleEntityNotFound(_0x418a77,null))[_0x7eda('0x29')](saveUpdates(_0x4f7d8f[_0x7eda('0x4d')],null))[_0x7eda('0x29')](respondWithResult(_0x418a77,null))['catch'](handleError(_0x418a77,null));};exports[_0x7eda('0x2a')]=function(_0x1c3673,_0x1caf3f){return db[_0x7eda('0x47')][_0x7eda('0x51')]({'where':{'id':_0x1c3673[_0x7eda('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1caf3f,null))[_0x7eda('0x29')](removeEntity(_0x1caf3f,null))[_0x7eda('0x4a')](handleError(_0x1caf3f,null));};exports[_0x7eda('0x54')]=function(_0x1db30a,_0x2d2da8){return db[_0x7eda('0x47')][_0x7eda('0x54')]()['then'](respondWithResult(_0x2d2da8,null))[_0x7eda('0x4a')](handleError(_0x2d2da8,null));};exports[_0x7eda('0x55')]=function(_0x1b1841,_0x2509f7,_0x2f00e9){var _0x1aea6f={'raw':!![],'where':{}},_0x226bf4={},_0x435cf1;return db[_0x7eda('0x47')][_0x7eda('0x56')]({'where':{'id':_0x1b1841[_0x7eda('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2509f7,null))['then'](function(_0x572639){if(_0x572639){_0x435cf1=_0x572639[_0x7eda('0x2b')]({'plain':!![]});_0x226bf4[_0x7eda('0x37')]=_[_0x7eda('0x38')](db[_0x7eda('0x57')][_0x7eda('0x34')]);_0x226bf4[_0x7eda('0x39')]=_['keys'](_0x1b1841[_0x7eda('0x39')]);_0x226bf4[_0x7eda('0x3a')]=_['intersection'](_0x226bf4['model'],_0x226bf4[_0x7eda('0x39')]);_0x1aea6f[_0x7eda('0x3b')]=_['intersection'](_0x226bf4['model'],qs[_0x7eda('0x3d')](_0x1b1841[_0x7eda('0x39')]['fields']));_0x1aea6f[_0x7eda('0x3b')]=_0x1aea6f[_0x7eda('0x3b')][_0x7eda('0x3e')]?_0x1aea6f['attributes']:_0x226bf4[_0x7eda('0x37')];if(!_0x1b1841[_0x7eda('0x39')][_0x7eda('0x3f')](_0x7eda('0x58'))){_0x1aea6f[_0x7eda('0x25')]=qs[_0x7eda('0x25')](_0x1b1841[_0x7eda('0x39')][_0x7eda('0x25')]);_0x1aea6f[_0x7eda('0x24')]=qs['offset'](_0x1b1841[_0x7eda('0x39')][_0x7eda('0x24')]);}_0x1aea6f[_0x7eda('0x59')]=qs[_0x7eda('0x40')](_0x1b1841[_0x7eda('0x39')]['sort']);_0x1aea6f[_0x7eda('0x41')]=qs[_0x7eda('0x3a')](_[_0x7eda('0x5a')](_0x1b1841[_0x7eda('0x39')],_0x226bf4[_0x7eda('0x3a')]));_0x1aea6f['where'][_0x7eda('0x5b')]=_0x572639['id'];if(_0x1b1841['query']['filter']){_0x1aea6f[_0x7eda('0x41')]=_['merge'](_0x1aea6f[_0x7eda('0x41')],{'$or':_[_0x7eda('0x33')](_0x1aea6f[_0x7eda('0x3b')],function(_0x14afa9){var _0xaa63a4={};_0xaa63a4[_0x14afa9]={'$like':'%'+_0x1b1841[_0x7eda('0x39')]['filter']+'%'};return _0xaa63a4;})});}_0x1aea6f=_[_0x7eda('0x43')]({},_0x1aea6f,_0x1b1841[_0x7eda('0x44')]);return db[_0x7eda('0x57')]['findAll'](_0x1aea6f);}})['then'](function(_0x4236d8){if(_0x4236d8){return db[_0x7eda('0x5c')]['findAndCountAll']({'where':{'id':_[_0x7eda('0x33')](_0x4236d8,_0x7eda('0x5d')),'role':_0x7eda('0x5e')},'attributes':['id',_0x7eda('0x30'),_0x7eda('0x5f'),_0x7eda('0x60'),_0x7eda('0x61')]});}})[_0x7eda('0x29')](function(_0x408851){if(_0x408851){return{'count':_0x408851[_0x7eda('0x23')],'rows':_['map'](_0x408851['rows'],function(_0x3c44e6){return{'membername':_0x3c44e6[_0x7eda('0x30')],'UserId':_0x3c44e6['id'],'queue_name':_0x435cf1['name'],'SmsQueueId':_0x435cf1['id'],'interface':util['format'](_0x7eda('0x62'),_0x7eda('0x63'),_0x3c44e6['name']),'penalty':0x0,'paused':_0x3c44e6['smsPause'],'createdAt':_0x3c44e6[_0x7eda('0x61')],'updatedAt':_0x3c44e6[_0x7eda('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2509f7,_0x1aea6f))['catch'](handleError(_0x2509f7,null));};exports['getTeams']=function(_0x10070b,_0x24b974,_0x4716c9){var _0x3c8a6f={};var _0x12aa80={};var _0x3bf5e4;var _0x3f3b7c;return db[_0x7eda('0x47')][_0x7eda('0x56')]({'where':{'id':_0x10070b[_0x7eda('0x4b')]['id']}})[_0x7eda('0x29')](handleEntityNotFound(_0x24b974,null))[_0x7eda('0x29')](function(_0x388d19){if(_0x388d19){_0x3bf5e4=_0x388d19;_0x12aa80['model']=_[_0x7eda('0x38')](db[_0x7eda('0x64')][_0x7eda('0x34')]);_0x12aa80['query']=_[_0x7eda('0x38')](_0x10070b[_0x7eda('0x39')]);_0x12aa80[_0x7eda('0x3a')]=_[_0x7eda('0x3c')](_0x12aa80[_0x7eda('0x37')],_0x12aa80[_0x7eda('0x39')]);_0x3c8a6f['attributes']=_[_0x7eda('0x3c')](_0x12aa80[_0x7eda('0x37')],qs['fields'](_0x10070b[_0x7eda('0x39')][_0x7eda('0x3d')]));_0x3c8a6f[_0x7eda('0x3b')]=_0x3c8a6f[_0x7eda('0x3b')][_0x7eda('0x3e')]?_0x3c8a6f['attributes']:_0x12aa80[_0x7eda('0x37')];_0x3c8a6f[_0x7eda('0x59')]=qs[_0x7eda('0x40')](_0x10070b[_0x7eda('0x39')]['sort']);_0x3c8a6f['where']=qs['filters'](_[_0x7eda('0x5a')](_0x10070b['query'],_0x12aa80[_0x7eda('0x3a')]));if(_0x10070b['query'][_0x7eda('0x42')]){_0x3c8a6f['where']=_[_0x7eda('0x43')](_0x3c8a6f[_0x7eda('0x41')],{'$or':_[_0x7eda('0x33')](_0x3c8a6f[_0x7eda('0x3b')],function(_0x2bab0c){var _0x350213={};_0x350213[_0x2bab0c]={'$like':'%'+_0x10070b[_0x7eda('0x39')][_0x7eda('0x42')]+'%'};return _0x350213;})});}_0x3c8a6f=_[_0x7eda('0x43')]({},_0x3c8a6f,_0x10070b[_0x7eda('0x44')]);return _0x3bf5e4[_0x7eda('0x65')](_0x3c8a6f);}})['then'](function(_0x49e888){if(_0x49e888){_0x3f3b7c=_0x49e888[_0x7eda('0x3e')];if(!_0x10070b[_0x7eda('0x39')][_0x7eda('0x3f')](_0x7eda('0x58'))){_0x3c8a6f['limit']=qs[_0x7eda('0x25')](_0x10070b[_0x7eda('0x39')][_0x7eda('0x25')]);_0x3c8a6f[_0x7eda('0x24')]=qs['offset'](_0x10070b[_0x7eda('0x39')][_0x7eda('0x24')]);}return _0x3bf5e4['getTeams'](_0x3c8a6f);}})[_0x7eda('0x29')](function(_0x5cb329){if(_0x5cb329){return _0x5cb329?{'count':_0x3f3b7c,'rows':_0x5cb329}:null;}})[_0x7eda('0x29')](respondWithResult(_0x24b974,null))[_0x7eda('0x4a')](handleError(_0x24b974,null));};exports['addTeams']=function(_0x3c0be7,_0x52802a,_0x2c4780){var _0x514e7c=_0x3c0be7['body']['ids'];return db['Team'][_0x7eda('0x48')]({'where':{'id':_0x514e7c},'attributes':['id'],'include':[{'model':db[_0x7eda('0x5c')],'as':_0x7eda('0x66'),'attributes':['id',_0x7eda('0x30'),_0x7eda('0x67'),'voicePause',_0x7eda('0x68')],'raw':!![]}]})[_0x7eda('0x29')](function(_0x32efad){if(_0x32efad){var _0x2ef955=_[_0x7eda('0x69')](_0x32efad,function(_0x5ae719){var _0x5de51b=_0x5ae719[_0x7eda('0x2b')]({'plain':!![]});return _0x5de51b['Agents'];});return db['SmsQueue'][_0x7eda('0x51')]({'where':{'id':_0x3c0be7[_0x7eda('0x4b')]['id']}})[_0x7eda('0x29')](function(_0x33d4a4){return db[_0x7eda('0x6a')][_0x7eda('0x6b')](function(_0x3641fe){return _0x33d4a4[_0x7eda('0x6c')](_0x514e7c,{'transaction':_0x3641fe})['then'](function(){return BPromise['each'](_0x2ef955,function(_0x4b7e72){return db[_0x7eda('0x57')][_0x7eda('0x6d')]({'where':{'UserId':_0x4b7e72['id'],'SmsQueueId':_0x3c0be7[_0x7eda('0x4b')]['id']},'transaction':_0x3641fe});});})['then'](function(){_0x2ef955[_0x7eda('0x6e')](function(_0x4e44ec){socket['emit']('userSmsQueue:save',{'UserId':_0x4e44ec['id'],'SmsQueueId':_0x33d4a4['id']});});});});});}})[_0x7eda('0x29')](respondWithStatusCode(_0x52802a,null))['catch'](handleError(_0x52802a,null));};exports['removeTeams']=function(_0x3cb250,_0xa4e689,_0x4eed44){return db[_0x7eda('0x64')][_0x7eda('0x48')]({'where':{'id':_0x3cb250[_0x7eda('0x39')][_0x7eda('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7eda('0x29')](handleEntityNotFound(_0xa4e689,null))[_0x7eda('0x29')](function(_0x35e5dc){var _0x247528=_[_0x7eda('0x33')](_0x35e5dc,'id');var _0x253255=[];var _0x588c91=[];var _0x42de91=squel[_0x7eda('0x70')]();_0x42de91[_0x7eda('0x71')](_0x7eda('0x72'))[_0x7eda('0x73')](_0x7eda('0x74'),'tq')[_0x7eda('0x75')](_0x7eda('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7eda('0x41')](_0x7eda('0x77'),_0x3cb250[_0x7eda('0x4b')]['id']);for(var _0x55cf5d=0x0;_0x55cf5d<_0x35e5dc[_0x7eda('0x3e')];_0x55cf5d+=0x1){let _0x4dadb3=_0x35e5dc[_0x55cf5d];for(var _0x56d680=0x0;_0x56d680<_0x4dadb3[_0x7eda('0x66')][_0x7eda('0x3e')];_0x56d680+=0x1){let _0x2d7623=_0x4dadb3['Agents'][_0x56d680];var _0x365d67=_0x42de91[_0x7eda('0x78')]();_0x365d67[_0x7eda('0x41')]('ut.UserId\x20=\x20?',_0x2d7623['id']);_0x588c91[_0x7eda('0x79')](db[_0x7eda('0x6a')][_0x7eda('0x39')](_0x365d67[_0x7eda('0x7a')](),{'type':db[_0x7eda('0x6a')][_0x7eda('0x7b')][_0x7eda('0x7c')]})['then'](function(_0x1c5d95){if(_0x1c5d95['length']===0x1){return _0x2d7623['id'];}else{var _0x57173c=_[_0x7eda('0x7d')](_[_0x7eda('0x33')](_0x1c5d95,_0x7eda('0x7e')),function(_0x17b40b){return _[_0x7eda('0x7f')](_0x247528,_0x17b40b);});if(_0x57173c){return _0x2d7623['id'];}}}));}}return BPromise[_0x7eda('0x80')](_0x588c91)[_0x7eda('0x29')](function(_0x50d37d){_0x253255=_(_0x253255)[_0x7eda('0x81')](_0x50d37d)['compact']()[_0x7eda('0x82')]();return db[_0x7eda('0x47')][_0x7eda('0x51')]({'where':{'id':_0x3cb250[_0x7eda('0x4b')]['id']}})['then'](function(_0x2bf651){return db['sequelize'][_0x7eda('0x6b')](function(_0x10b4bb){return _0x2bf651[_0x7eda('0x83')](_0x3cb250[_0x7eda('0x39')]['ids'],{'transaction':_0x10b4bb})[_0x7eda('0x29')](function(){if(!_[_0x7eda('0x84')](_0x253255)){return _0x2bf651[_0x7eda('0x85')](_0x253255,{'transaction':_0x10b4bb});}})[_0x7eda('0x29')](function(){_0x253255[_0x7eda('0x6e')](function(_0xcb06a3){socket['emit'](_0x7eda('0x86'),{'UserId':_0xcb06a3,'SmsQueueId':_0x2bf651['id']});});});});});});})[_0x7eda('0x29')](respondWithStatusCode(_0xa4e689,null))[_0x7eda('0x4a')](handleError(_0xa4e689,null));};exports[_0x7eda('0x87')]=function(_0x1bcb98,_0x123f2e,_0x148460){return db[_0x7eda('0x47')][_0x7eda('0x51')]({'where':{'id':_0x1bcb98['params']['id']}})[_0x7eda('0x29')](handleEntityNotFound(_0x123f2e,null))[_0x7eda('0x29')](function(_0x3318a0){if(_0x3318a0){return _0x3318a0['addAgents'](_0x1bcb98['body'][_0x7eda('0x6f')],_[_0x7eda('0x88')](_0x1bcb98[_0x7eda('0x4d')],[_0x7eda('0x6f'),'id'])||{})[_0x7eda('0x89')](function(_0x299fa8){for(var _0x1c8f76=0x0;_0x1c8f76<_0x1bcb98[_0x7eda('0x4d')]['ids'][_0x7eda('0x3e')];_0x1c8f76+=0x1){socket['emit'](_0x7eda('0x8a'),{'UserId':Number(_0x1bcb98[_0x7eda('0x4d')]['ids'][_0x1c8f76]),'SmsQueueId':Number(_0x1bcb98['params']['id'])});}return _0x299fa8;});}})[_0x7eda('0x29')](respondWithResult(_0x123f2e,null))[_0x7eda('0x4a')](handleError(_0x123f2e,null));};exports[_0x7eda('0x85')]=function(_0x5b9831,_0x5b2dd0,_0x4dd4a3){return db[_0x7eda('0x47')][_0x7eda('0x51')]({'where':{'id':_0x5b9831[_0x7eda('0x4b')]['id']}})[_0x7eda('0x29')](handleEntityNotFound(_0x5b2dd0,null))[_0x7eda('0x29')](function(_0x14d69a){if(_0x14d69a){return _0x14d69a[_0x7eda('0x85')](_0x5b9831[_0x7eda('0x39')][_0x7eda('0x6f')])[_0x7eda('0x29')](function(){if(_[_0x7eda('0x8b')](_0x5b9831[_0x7eda('0x39')][_0x7eda('0x6f')])){for(var _0x24b79b=0x0;_0x24b79b<_0x5b9831[_0x7eda('0x39')][_0x7eda('0x6f')][_0x7eda('0x3e')];_0x24b79b+=0x1){socket['emit'](_0x7eda('0x86'),{'UserId':Number(_0x5b9831[_0x7eda('0x39')][_0x7eda('0x6f')][_0x24b79b]),'SmsQueueId':Number(_0x5b9831[_0x7eda('0x4b')]['id'])});}}else{socket[_0x7eda('0x8c')](_0x7eda('0x86'),{'UserId':Number(_0x5b9831[_0x7eda('0x39')][_0x7eda('0x6f')]),'SmsQueueId':Number(_0x5b9831[_0x7eda('0x4b')]['id'])});}});}})[_0x7eda('0x29')](respondWithStatusCode(_0x5b2dd0,null))[_0x7eda('0x4a')](handleError(_0x5b2dd0,null));};exports['getAgents']=function(_0x42a0a7,_0x117475,_0x2fb26a){var _0x52ddd7={};var _0x1b22d9={};var _0x35483e;var _0x428094;return db[_0x7eda('0x47')][_0x7eda('0x56')]({'where':{'id':_0x42a0a7[_0x7eda('0x4b')]['id']}})[_0x7eda('0x29')](handleEntityNotFound(_0x117475,null))[_0x7eda('0x29')](function(_0x42aec3){if(_0x42aec3){_0x35483e=_0x42aec3;_0x1b22d9[_0x7eda('0x37')]=_[_0x7eda('0x38')](db['User'][_0x7eda('0x34')]);_0x1b22d9[_0x7eda('0x39')]=_['keys'](_0x42a0a7[_0x7eda('0x39')]);_0x1b22d9[_0x7eda('0x3a')]=_[_0x7eda('0x3c')](_0x1b22d9[_0x7eda('0x37')],_0x1b22d9['query']);_0x52ddd7[_0x7eda('0x3b')]=_[_0x7eda('0x3c')](_0x1b22d9[_0x7eda('0x37')],qs['fields'](_0x42a0a7['query'][_0x7eda('0x3d')]));_0x52ddd7[_0x7eda('0x3b')]=_0x52ddd7[_0x7eda('0x3b')][_0x7eda('0x3e')]?_0x52ddd7[_0x7eda('0x3b')]:_0x1b22d9['model'];_0x52ddd7[_0x7eda('0x59')]=qs[_0x7eda('0x40')](_0x42a0a7[_0x7eda('0x39')][_0x7eda('0x40')]);_0x52ddd7['where']=qs[_0x7eda('0x3a')](_[_0x7eda('0x5a')](_0x42a0a7[_0x7eda('0x39')],_0x1b22d9[_0x7eda('0x3a')]));if(_0x42a0a7[_0x7eda('0x39')][_0x7eda('0x42')]){_0x52ddd7[_0x7eda('0x41')]=_[_0x7eda('0x43')](_0x52ddd7[_0x7eda('0x41')],{'$or':_['map'](_0x52ddd7['attributes'],function(_0x1950eb){var _0x155ca4={};_0x155ca4[_0x1950eb]={'$like':'%'+_0x42a0a7[_0x7eda('0x39')][_0x7eda('0x42')]+'%'};return _0x155ca4;})});}_0x52ddd7=_['merge']({},_0x52ddd7,_0x42a0a7[_0x7eda('0x44')]);return _0x35483e[_0x7eda('0x8d')](_0x52ddd7);}})[_0x7eda('0x29')](function(_0x309b7d){if(_0x309b7d){_0x428094=_0x309b7d[_0x7eda('0x3e')];if(!_0x42a0a7[_0x7eda('0x39')][_0x7eda('0x3f')]('nolimit')){_0x52ddd7[_0x7eda('0x25')]=qs[_0x7eda('0x25')](_0x42a0a7[_0x7eda('0x39')][_0x7eda('0x25')]);_0x52ddd7[_0x7eda('0x24')]=qs[_0x7eda('0x24')](_0x42a0a7['query'][_0x7eda('0x24')]);}return _0x35483e[_0x7eda('0x8d')](_0x52ddd7);}})[_0x7eda('0x29')](function(_0x5e106f){if(_0x5e106f){return _0x5e106f?{'count':_0x428094,'rows':_0x5e106f}:null;}})['then'](respondWithResult(_0x117475,null))[_0x7eda('0x4a')](handleError(_0x117475,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 1e585be..96849a9 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 _0x8865=['../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x58948b,_0x333c7a){var _0x5057c8=function(_0x541fe3){while(--_0x541fe3){_0x58948b['push'](_0x58948b['shift']());}};_0x5057c8(++_0x333c7a);}(_0x8865,0x66));var _0x5886=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x8865[_0x50a0c2];return _0x5ebadd;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x5886('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5886('0x1'),'afterDestroy':_0x5886('0x2')};function emitEvent(_0x4e13cf){return function(_0xccebae,_0x3e0fcc,_0x1272c9){SmsQueueEvents['emit'](_0x4e13cf+':'+_0xccebae['id'],_0xccebae);SmsQueueEvents[_0x5886('0x3')](_0x4e13cf,_0xccebae);_0x1272c9(null);};}for(var e in events){if(events[_0x5886('0x4')](e)){var event=events[e];SmsQueue[_0x5886('0x5')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xd37e=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue'];(function(_0x4c80c2,_0x1dd102){var _0x24e817=function(_0x4a3085){while(--_0x4a3085){_0x4c80c2['push'](_0x4c80c2['shift']());}};_0x24e817(++_0x1dd102);}(_0xd37e,0x17d));var _0xed37=function(_0x51733c,_0x448082){_0x51733c=_0x51733c-0x0;var _0x5f50f9=_0xd37e[_0x51733c];return _0x5f50f9;};'use strict';var EventEmitter=require(_0xed37('0x0'));var SmsQueue=require(_0xed37('0x1'))['db'][_0xed37('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xed37('0x3'),'afterUpdate':_0xed37('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a6501){return function(_0x336823,_0x63b6a7,_0x5f195c){SmsQueueEvents['emit'](_0x2a6501+':'+_0x336823['id'],_0x336823);SmsQueueEvents[_0xed37('0x5')](_0x2a6501,_0x336823);_0x5f195c(null);};}for(var e in events){if(events[_0xed37('0x6')](e)){var event=events[e];SmsQueue[_0xed37('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index bbf2907..fc404dc 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 _0xf089=['api','bluebird','path','rimraf','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x24d344,_0x4a2291){var _0x341736=function(_0x40fb8b){while(--_0x40fb8b){_0x24d344['push'](_0x24d344['shift']());}};_0x341736(++_0x4a2291);}(_0xf089,0x105));var _0x9f08=function(_0x2ce1e6,_0x20c691){_0x2ce1e6=_0x2ce1e6-0x0;var _0x4b62c4=_0xf089[_0x2ce1e6];return _0x4b62c4;};'use strict';var _=require(_0x9f08('0x0'));var util=require(_0x9f08('0x1'));var logger=require(_0x9f08('0x2'))(_0x9f08('0x3'));var moment=require('moment');var BPromise=require(_0x9f08('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f08('0x5'));var rimraf=require(_0x9f08('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x9f08('0x7')]=function(_0x32eb5d,_0x5b36a3){return _0x32eb5d[_0x9f08('0x8')](_0x9f08('0x9'),attributes,{'tableName':_0x9f08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcba=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x531a0a,_0x2680d0){var _0x23af6e=function(_0x3753c8){while(--_0x3753c8){_0x531a0a['push'](_0x531a0a['shift']());}};_0x23af6e(++_0x2680d0);}(_0xbcba,0x125));var _0xabcb=function(_0x313e46,_0x90ba88){_0x313e46=_0x313e46-0x0;var _0x5d704a=_0xbcba[_0x313e46];return _0x5d704a;};'use strict';var _=require(_0xabcb('0x0'));var util=require(_0xabcb('0x1'));var logger=require(_0xabcb('0x2'))(_0xabcb('0x3'));var moment=require(_0xabcb('0x4'));var BPromise=require(_0xabcb('0x5'));var rp=require(_0xabcb('0x6'));var fs=require('fs');var path=require(_0xabcb('0x7'));var rimraf=require(_0xabcb('0x8'));var config=require(_0xabcb('0x9'));var attributes=require(_0xabcb('0xa'));module[_0xabcb('0xb')]=function(_0x1f3ecd,_0x185d73){return _0x1f3ecd[_0xabcb('0xc')](_0xabcb('0xd'),attributes,{'tableName':_0xabcb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index c299ac1..78d6406 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 _0x3c9f=['client','http','redis','defaults','socket.io-emitter','register','request','info','request\x20sent','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','map','model','include','then','debug','stringify','ShowSmsQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0x3c9f,0x166));var _0xf3c9=function(_0x53b358,_0x18fea6){_0x53b358=_0x53b358-0x0;var _0x4bb43e=_0x3c9f[_0x53b358];return _0x4bb43e;};'use strict';var _=require(_0xf3c9('0x0'));var util=require(_0xf3c9('0x1'));var moment=require(_0xf3c9('0x2'));var BPromise=require(_0xf3c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3c9('0x4'));var db=require(_0xf3c9('0x5'))['db'];var utils=require(_0xf3c9('0x6'));var logger=require(_0xf3c9('0x7'))(_0xf3c9('0x8'));var config=require(_0xf3c9('0x9'));var jayson=require(_0xf3c9('0xa'));var client=jayson[_0xf3c9('0xb')][_0xf3c9('0xc')]({'port':0x232a});config[_0xf3c9('0xd')]=_[_0xf3c9('0xe')](config[_0xf3c9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf3c9('0xf'))(new Redis(config[_0xf3c9('0xd')]));require('./smsQueue.socket')[_0xf3c9('0x10')](socket);function respondWithRpcPromise(_0x4ce746,_0x368379,_0x2a3b4b){return new BPromise(function(_0x42c569,_0x2e3a11){return client[_0xf3c9('0x11')](_0x4ce746,_0x2a3b4b)['then'](function(_0x519327){logger[_0xf3c9('0x12')]('SmsQueue,\x20%s,\x20%s',_0x368379,_0xf3c9('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x368379,_0xf3c9('0x13'),JSON['stringify'](_0x519327));if(_0x519327[_0xf3c9('0x14')]){if(_0x519327[_0xf3c9('0x14')][_0xf3c9('0x15')]===0x1f4){logger[_0xf3c9('0x14')](_0xf3c9('0x16'),_0x368379,_0x519327[_0xf3c9('0x14')][_0xf3c9('0x17')]);return _0x2e3a11(_0x519327['error'][_0xf3c9('0x17')]);}logger[_0xf3c9('0x14')](_0xf3c9('0x16'),_0x368379,_0x519327[_0xf3c9('0x14')][_0xf3c9('0x17')]);return _0x42c569(_0x519327[_0xf3c9('0x14')][_0xf3c9('0x17')]);}else{logger[_0xf3c9('0x12')](_0xf3c9('0x16'),_0x368379,'request\x20sent');_0x42c569(_0x519327[_0xf3c9('0x18')][_0xf3c9('0x17')]);}})[_0xf3c9('0x19')](function(_0x228b73){logger[_0xf3c9('0x14')]('SmsQueue,\x20%s,\x20%s',_0x368379,_0x228b73);_0x2e3a11(_0x228b73);});});}exports[_0xf3c9('0x1a')]=function(_0x42f2de){var _0x366e8f=this;return new Promise(function(_0x2fe429,_0x4e3761){return db[_0xf3c9('0x1b')][_0xf3c9('0x1c')]({'raw':_0x42f2de[_0xf3c9('0x1d')]?_0x42f2de[_0xf3c9('0x1d')][_0xf3c9('0x1e')]===undefined?!![]:![]:!![],'where':_0x42f2de[_0xf3c9('0x1d')]?_0x42f2de[_0xf3c9('0x1d')][_0xf3c9('0x1f')]||null:null,'attributes':_0x42f2de[_0xf3c9('0x1d')]?_0x42f2de[_0xf3c9('0x1d')][_0xf3c9('0x20')]||null:null,'limit':_0x42f2de[_0xf3c9('0x1d')]?_0x42f2de[_0xf3c9('0x1d')][_0xf3c9('0x21')]||null:null,'include':_0x42f2de['options']?_0x42f2de[_0xf3c9('0x1d')]['include']?_[_0xf3c9('0x22')](_0x42f2de[_0xf3c9('0x1d')]['include'],function(_0x4d95c1){return{'model':db[_0x4d95c1[_0xf3c9('0x23')]],'as':_0x4d95c1['as'],'attributes':_0x4d95c1[_0xf3c9('0x20')],'include':_0x4d95c1[_0xf3c9('0x24')]?_[_0xf3c9('0x22')](_0x4d95c1[_0xf3c9('0x24')],function(_0x57ccf0){return{'model':db[_0x57ccf0[_0xf3c9('0x23')]],'as':_0x57ccf0['as'],'attributes':_0x57ccf0[_0xf3c9('0x20')],'include':_0x57ccf0[_0xf3c9('0x24')]?_[_0xf3c9('0x22')](_0x57ccf0['include'],function(_0x2d3d8e){return{'model':db[_0x2d3d8e[_0xf3c9('0x23')]],'as':_0x2d3d8e['as'],'attributes':_0x2d3d8e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf3c9('0x25')](function(_0x424642){logger['info'](_0xf3c9('0x1a'),_0x42f2de);logger[_0xf3c9('0x26')](_0xf3c9('0x1a'),_0x42f2de,JSON[_0xf3c9('0x27')](_0x424642));_0x2fe429(_0x424642);})[_0xf3c9('0x19')](function(_0x50111c){logger[_0xf3c9('0x14')](_0xf3c9('0x1a'),_0x50111c['message'],_0x42f2de);_0x4e3761(_0x366e8f['error'](0x1f4,_0x50111c[_0xf3c9('0x17')]));});});};exports[_0xf3c9('0x28')]=function(_0x208ab9){var _0x56ecfb=this;return new Promise(function(_0x440e8a,_0x496fae){return db[_0xf3c9('0x1b')]['find']({'raw':_0x208ab9[_0xf3c9('0x1d')]?_0x208ab9[_0xf3c9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x208ab9[_0xf3c9('0x1d')]?_0x208ab9[_0xf3c9('0x1d')][_0xf3c9('0x1f')]||null:null,'attributes':_0x208ab9['options']?_0x208ab9[_0xf3c9('0x1d')][_0xf3c9('0x20')]||null:null,'include':_0x208ab9['options']?_0x208ab9[_0xf3c9('0x1d')][_0xf3c9('0x24')]?_['map'](_0x208ab9['options'][_0xf3c9('0x24')],function(_0x637c28){return{'model':db[_0x637c28['model']],'as':_0x637c28['as'],'attributes':_0x637c28['attributes'],'include':_0x637c28[_0xf3c9('0x24')]?_[_0xf3c9('0x22')](_0x637c28[_0xf3c9('0x24')],function(_0x38101a){return{'model':db[_0x38101a['model']],'as':_0x38101a['as'],'attributes':_0x38101a[_0xf3c9('0x20')],'include':_0x38101a[_0xf3c9('0x24')]?_[_0xf3c9('0x22')](_0x38101a[_0xf3c9('0x24')],function(_0x2f308e){return{'model':db[_0x2f308e[_0xf3c9('0x23')]],'as':_0x2f308e['as'],'attributes':_0x2f308e[_0xf3c9('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf3c9('0x25')](function(_0x3a6a7c){logger[_0xf3c9('0x12')]('ShowSmsQueue',_0x208ab9);logger[_0xf3c9('0x26')](_0xf3c9('0x28'),_0x208ab9,JSON[_0xf3c9('0x27')](_0x3a6a7c));_0x440e8a(_0x3a6a7c);})['catch'](function(_0x354211){logger['error'](_0xf3c9('0x28'),_0x354211[_0xf3c9('0x17')],_0x208ab9);_0x496fae(_0x56ecfb[_0xf3c9('0x14')](0x1f4,_0x354211[_0xf3c9('0x17')]));});});}; \ No newline at end of file +var _0x63c9=['SmsQueue','findAll','options','raw','limit','include','map','model','attributes','find','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x63c9,0x10d));var _0x963c=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x63c9[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x963c('0x0'));var util=require(_0x963c('0x1'));var moment=require(_0x963c('0x2'));var BPromise=require('bluebird');var rs=require(_0x963c('0x3'));var fs=require('fs');var Redis=require(_0x963c('0x4'));var db=require(_0x963c('0x5'))['db'];var utils=require(_0x963c('0x6'));var logger=require(_0x963c('0x7'))(_0x963c('0x8'));var config=require(_0x963c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x963c('0xa')][_0x963c('0xb')]({'port':0x232a});config[_0x963c('0xc')]=_[_0x963c('0xd')](config[_0x963c('0xc')],{'host':_0x963c('0xe'),'port':0x18eb});var socket=require(_0x963c('0xf'))(new Redis(config[_0x963c('0xc')]));require(_0x963c('0x10'))[_0x963c('0x11')](socket);function respondWithRpcPromise(_0x1af056,_0x39dd22,_0x4d3e91){return new BPromise(function(_0x52fc0c,_0x4131ff){return client[_0x963c('0x12')](_0x1af056,_0x4d3e91)[_0x963c('0x13')](function(_0x1b89cf){logger[_0x963c('0x14')](_0x963c('0x15'),_0x39dd22,_0x963c('0x16'));logger[_0x963c('0x17')](_0x963c('0x18'),_0x39dd22,'request\x20sent',JSON[_0x963c('0x19')](_0x1b89cf));if(_0x1b89cf[_0x963c('0x1a')]){if(_0x1b89cf['error'][_0x963c('0x1b')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x39dd22,_0x1b89cf[_0x963c('0x1a')]['message']);return _0x4131ff(_0x1b89cf[_0x963c('0x1a')][_0x963c('0x1c')]);}logger['error'](_0x963c('0x15'),_0x39dd22,_0x1b89cf[_0x963c('0x1a')][_0x963c('0x1c')]);return _0x52fc0c(_0x1b89cf[_0x963c('0x1a')][_0x963c('0x1c')]);}else{logger[_0x963c('0x14')]('SmsQueue,\x20%s,\x20%s',_0x39dd22,_0x963c('0x16'));_0x52fc0c(_0x1b89cf[_0x963c('0x1d')][_0x963c('0x1c')]);}})[_0x963c('0x1e')](function(_0x32f16f){logger[_0x963c('0x1a')](_0x963c('0x15'),_0x39dd22,_0x32f16f);_0x4131ff(_0x32f16f);});});}exports[_0x963c('0x1f')]=function(_0xce6bb7){var _0x550d57=this;return new Promise(function(_0x595ea2,_0x5bd720){return db[_0x963c('0x20')][_0x963c('0x21')]({'raw':_0xce6bb7['options']?_0xce6bb7[_0x963c('0x22')][_0x963c('0x23')]===undefined?!![]:![]:!![],'where':_0xce6bb7[_0x963c('0x22')]?_0xce6bb7[_0x963c('0x22')]['where']||null:null,'attributes':_0xce6bb7[_0x963c('0x22')]?_0xce6bb7[_0x963c('0x22')]['attributes']||null:null,'limit':_0xce6bb7[_0x963c('0x22')]?_0xce6bb7[_0x963c('0x22')][_0x963c('0x24')]||null:null,'include':_0xce6bb7[_0x963c('0x22')]?_0xce6bb7['options'][_0x963c('0x25')]?_[_0x963c('0x26')](_0xce6bb7[_0x963c('0x22')][_0x963c('0x25')],function(_0x1ac939){return{'model':db[_0x1ac939[_0x963c('0x27')]],'as':_0x1ac939['as'],'attributes':_0x1ac939['attributes'],'include':_0x1ac939[_0x963c('0x25')]?_['map'](_0x1ac939[_0x963c('0x25')],function(_0xbc1c59){return{'model':db[_0xbc1c59['model']],'as':_0xbc1c59['as'],'attributes':_0xbc1c59['attributes'],'include':_0xbc1c59[_0x963c('0x25')]?_[_0x963c('0x26')](_0xbc1c59[_0x963c('0x25')],function(_0x3936b3){return{'model':db[_0x3936b3[_0x963c('0x27')]],'as':_0x3936b3['as'],'attributes':_0x3936b3[_0x963c('0x28')]};}):[]};}):[]};}):[]:[]})[_0x963c('0x13')](function(_0x36bad1){logger['info'](_0x963c('0x1f'),_0xce6bb7);logger[_0x963c('0x17')](_0x963c('0x1f'),_0xce6bb7,JSON[_0x963c('0x19')](_0x36bad1));_0x595ea2(_0x36bad1);})[_0x963c('0x1e')](function(_0x211fe9){logger[_0x963c('0x1a')]('GetSmsQueue',_0x211fe9[_0x963c('0x1c')],_0xce6bb7);_0x5bd720(_0x550d57[_0x963c('0x1a')](0x1f4,_0x211fe9[_0x963c('0x1c')]));});});};exports['ShowSmsQueue']=function(_0x16a243){var _0x5175cd=this;return new Promise(function(_0x1d4b1c,_0x5e08b3){return db[_0x963c('0x20')][_0x963c('0x29')]({'raw':_0x16a243[_0x963c('0x22')]?_0x16a243['options'][_0x963c('0x23')]===undefined?!![]:![]:!![],'where':_0x16a243[_0x963c('0x22')]?_0x16a243[_0x963c('0x22')]['where']||null:null,'attributes':_0x16a243[_0x963c('0x22')]?_0x16a243[_0x963c('0x22')]['attributes']||null:null,'include':_0x16a243[_0x963c('0x22')]?_0x16a243['options'][_0x963c('0x25')]?_[_0x963c('0x26')](_0x16a243[_0x963c('0x22')][_0x963c('0x25')],function(_0x3cc400){return{'model':db[_0x3cc400[_0x963c('0x27')]],'as':_0x3cc400['as'],'attributes':_0x3cc400['attributes'],'include':_0x3cc400[_0x963c('0x25')]?_[_0x963c('0x26')](_0x3cc400[_0x963c('0x25')],function(_0xf54a01){return{'model':db[_0xf54a01[_0x963c('0x27')]],'as':_0xf54a01['as'],'attributes':_0xf54a01[_0x963c('0x28')],'include':_0xf54a01['include']?_[_0x963c('0x26')](_0xf54a01['include'],function(_0xc2c799){return{'model':db[_0xc2c799[_0x963c('0x27')]],'as':_0xc2c799['as'],'attributes':_0xc2c799[_0x963c('0x28')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5873f0){logger['info'](_0x963c('0x2a'),_0x16a243);logger[_0x963c('0x17')](_0x963c('0x2a'),_0x16a243,JSON[_0x963c('0x19')](_0x5873f0));_0x1d4b1c(_0x5873f0);})['catch'](function(_0x599e73){logger[_0x963c('0x1a')](_0x963c('0x2a'),_0x599e73[_0x963c('0x1c')],_0x16a243);_0x5e08b3(_0x5175cd['error'](0x1f4,_0x599e73['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index cc07d0c..50c8bfa 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 _0xd1a0=['length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x400417,_0x349de4){var _0xd69021=function(_0x23a10d){while(--_0x23a10d){_0x400417['push'](_0x400417['shift']());}};_0xd69021(++_0x349de4);}(_0xd1a0,0xa4));var _0x0d1a=function(_0x39f39d,_0x2b0394){_0x39f39d=_0x39f39d-0x0;var _0x193f83=_0xd1a0[_0x39f39d];return _0x193f83;};'use strict';var SmsQueueEvents=require(_0x0d1a('0x0'));var events=[_0x0d1a('0x1'),_0x0d1a('0x2'),_0x0d1a('0x3')];function createListener(_0x259eab,_0x4ab1bf){return function(_0x1ac877){_0x4ab1bf[_0x0d1a('0x4')](_0x259eab,_0x1ac877);};}function removeListener(_0x4dd7aa,_0x5d0688){return function(){SmsQueueEvents[_0x0d1a('0x5')](_0x4dd7aa,_0x5d0688);};}exports[_0x0d1a('0x6')]=function(_0x4c5c81){for(var _0x4421b6=0x0,_0x117641=events[_0x0d1a('0x7')];_0x4421b6<_0x117641;_0x4421b6++){var _0x52b8b1=events[_0x4421b6];var _0x126223=createListener(_0x0d1a('0x8')+_0x52b8b1,_0x4c5c81);SmsQueueEvents['on'](_0x52b8b1,_0x126223);}}; \ No newline at end of file +var _0x68f7=['emit','length','smsQueue:','./smsQueue.events','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68f7,0x17d));var _0x768f=function(_0x37ef38,_0x2cfe4e){_0x37ef38=_0x37ef38-0x0;var _0x499daa=_0x68f7[_0x37ef38];return _0x499daa;};'use strict';var SmsQueueEvents=require(_0x768f('0x0'));var events=['save',_0x768f('0x1'),_0x768f('0x2')];function createListener(_0x5a4dfd,_0x698724){return function(_0x43030f){_0x698724[_0x768f('0x3')](_0x5a4dfd,_0x43030f);};}function removeListener(_0x4c5acc,_0x3a190f){return function(){SmsQueueEvents['removeListener'](_0x4c5acc,_0x3a190f);};}exports['register']=function(_0x15e129){for(var _0x1df262=0x0,_0xe7ebed=events[_0x768f('0x4')];_0x1df262<_0xe7ebed;_0x1df262++){var _0x229748=events[_0x1df262];var _0x594e31=createListener(_0x768f('0x5')+_0x229748,_0x15e129);SmsQueueEvents['on'](_0x229748,_0x594e31);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 683a76a..332288a 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 _0xe935=['Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout'];(function(_0x1faf84,_0x1aa70a){var _0x3c5f9d=function(_0x52c75d){while(--_0x52c75d){_0x1faf84['push'](_0x1faf84['shift']());}};_0x3c5f9d(++_0x1aa70a);}(_0xe935,0x10b));var _0x5e93=function(_0x1b1fce,_0x4b5fb5){_0x1b1fce=_0x1b1fce-0x0;var _0x2f9377=_0xe935[_0x1b1fce];return _0x2f9377;};'use strict';var multer=require(_0x5e93('0x0'));var util=require(_0x5e93('0x1'));var path=require('path');var timeout=require(_0x5e93('0x2'));var express=require('express');var router=express[_0x5e93('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e93('0x4'));var interaction=require(_0x5e93('0x5'));var config=require('../../config/environment');var controller=require(_0x5e93('0x6'));router[_0x5e93('0x7')]('/',auth[_0x5e93('0x8')](),controller[_0x5e93('0x9')]);router['get']('/describe',auth[_0x5e93('0x8')](),controller[_0x5e93('0xa')]);router[_0x5e93('0x7')](_0x5e93('0xb'),auth[_0x5e93('0x8')](),controller[_0x5e93('0xc')]);router[_0x5e93('0xd')]('/',auth[_0x5e93('0x8')](),controller[_0x5e93('0xe')]);router['put'](_0x5e93('0xb'),auth[_0x5e93('0x8')](),controller[_0x5e93('0xf')]);router[_0x5e93('0x10')](_0x5e93('0xb'),auth[_0x5e93('0x8')](),controller[_0x5e93('0x11')]);module['exports']=router; \ No newline at end of file +var _0x04f1=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','index','get','/describe','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x26a627,_0x565249){var _0x43c3ed=function(_0xd87d61){while(--_0xd87d61){_0x26a627['push'](_0x26a627['shift']());}};_0x43c3ed(++_0x565249);}(_0x04f1,0x92));var _0x104f=function(_0x441373,_0x15b94){_0x441373=_0x441373-0x0;var _0x4a61b2=_0x04f1[_0x441373];return _0x4a61b2;};'use strict';var multer=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var path=require(_0x104f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x104f('0x3')]();var fs_extra=require(_0x104f('0x4'));var auth=require(_0x104f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x104f('0x6')]);router[_0x104f('0x7')](_0x104f('0x8'),auth[_0x104f('0x9')](),controller['describe']);router[_0x104f('0x7')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x104f('0xc')]);router[_0x104f('0xd')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0xe')]);router[_0x104f('0xf')](_0x104f('0xa'),auth[_0x104f('0x9')](),controller[_0x104f('0x10')]);module[_0x104f('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6ba6451..92ce92b 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 _0x4225=['STRING','DATE','moment','sequelize'];(function(_0x4a0604,_0x3c94d2){var _0x56a13f=function(_0x311520){while(--_0x311520){_0x4a0604['push'](_0x4a0604['shift']());}};_0x56a13f(++_0x3c94d2);}(_0x4225,0xa6));var _0x5422=function(_0x2e83ff,_0x11b4c9){_0x2e83ff=_0x2e83ff-0x0;var _0x533aa9=_0x4225[_0x2e83ff];return _0x533aa9;};'use strict';var moment=require(_0x5422('0x0'));var Sequelize=require(_0x5422('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5422('0x2')]},'joinAt':{'type':Sequelize[_0x5422('0x3')]},'leaveAt':{'type':Sequelize[_0x5422('0x3')]},'acceptAt':{'type':Sequelize[_0x5422('0x3')]},'exitAt':{'type':Sequelize[_0x5422('0x3')]},'reason':{'type':Sequelize[_0x5422('0x2')]}}; \ No newline at end of file +var _0x3769=['moment','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3769,0x15c));var _0x9376=function(_0x2ac843,_0x388376){_0x2ac843=_0x2ac843-0x0;var _0x2f90ac=_0x3769[_0x2ac843];return _0x2f90ac;};'use strict';var moment=require(_0x9376('0x0'));var Sequelize=require('sequelize');module[_0x9376('0x1')]={'uniqueid':{'type':Sequelize[_0x9376('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9376('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9376('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9376('0x3')]},'reason':{'type':Sequelize[_0x9376('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b905f46..7133e5b 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 _0xa6bb=['stack','name','index','map','SmsQueueReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','type','options','includeAll','include','findAll','show','params','catch','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xa6bb,0x17d));var _0xba6b=function(_0x27db1b,_0x2a88eb){_0x27db1b=_0x27db1b-0x0;var _0x3c75bf=_0xa6bb[_0x27db1b];return _0x3c75bf;};'use strict';var emlformat=require(_0xba6b('0x0'));var rimraf=require(_0xba6b('0x1'));var zipdir=require(_0xba6b('0x2'));var jsonpatch=require(_0xba6b('0x3'));var rp=require(_0xba6b('0x4'));var moment=require('moment');var BPromise=require(_0xba6b('0x5'));var Mustache=require(_0xba6b('0x6'));var util=require(_0xba6b('0x7'));var path=require(_0xba6b('0x8'));var sox=require('sox');var csv=require(_0xba6b('0x9'));var ejs=require(_0xba6b('0xa'));var fs=require('fs');var fs_extra=require(_0xba6b('0xb'));var _=require('lodash');var squel=require(_0xba6b('0xc'));var crypto=require(_0xba6b('0xd'));var jsforce=require(_0xba6b('0xe'));var deskjs=require(_0xba6b('0xf'));var toCsv=require(_0xba6b('0x9'));var querystring=require(_0xba6b('0x10'));var Papa=require(_0xba6b('0x11'));var Redis=require(_0xba6b('0x12'));var authService=require(_0xba6b('0x13'));var qs=require(_0xba6b('0x14'));var as=require(_0xba6b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xba6b('0x16'));var db=require(_0xba6b('0x17'))['db'];function respondWithStatusCode(_0x466e67,_0x22b5c4){_0x22b5c4=_0x22b5c4||0xcc;return function(_0x251df0){if(_0x251df0){return _0x466e67[_0xba6b('0x18')](_0x22b5c4);}return _0x466e67[_0xba6b('0x19')](_0x22b5c4)[_0xba6b('0x1a')]();};}function respondWithResult(_0x428884,_0x50c99b){_0x50c99b=_0x50c99b||0xc8;return function(_0x167628){if(_0x167628){return _0x428884[_0xba6b('0x19')](_0x50c99b)[_0xba6b('0x1b')](_0x167628);}};}function respondWithFilteredResult(_0x374942,_0x1fffb1){return function(_0x17971b){if(_0x17971b){var _0x521dd2=typeof _0x1fffb1[_0xba6b('0x1c')]===_0xba6b('0x1d')&&typeof _0x1fffb1[_0xba6b('0x1e')]===_0xba6b('0x1d');var _0x9bf9c0=_0x17971b[_0xba6b('0x1f')];var _0x51af73=_0x521dd2?0x0:_0x1fffb1[_0xba6b('0x1c')];var _0x9905e9=_0x521dd2?_0x17971b[_0xba6b('0x1f')]:_0x1fffb1[_0xba6b('0x1c')]+_0x1fffb1[_0xba6b('0x1e')];var _0x5c869f;if(_0x9905e9>=_0x9bf9c0){_0x9905e9=_0x9bf9c0;_0x5c869f=0xc8;}else{_0x5c869f=0xce;}_0x374942['status'](_0x5c869f);return _0x374942[_0xba6b('0x20')](_0xba6b('0x21'),_0x51af73+'-'+_0x9905e9+'/'+_0x9bf9c0)[_0xba6b('0x1b')](_0x17971b);}return null;};}function patchUpdates(_0x439a4f){return function(_0x1ba5eb){try{jsonpatch[_0xba6b('0x22')](_0x1ba5eb,_0x439a4f,!![]);}catch(_0x4a5c0f){return BPromise[_0xba6b('0x23')](_0x4a5c0f);}return _0x1ba5eb[_0xba6b('0x24')]();};}function saveUpdates(_0x35c247,_0x3feaae){return function(_0x63ad81){if(_0x63ad81){return _0x63ad81[_0xba6b('0x25')](_0x35c247)[_0xba6b('0x26')](function(_0xfc77d7){return _0xfc77d7;});}return null;};}function removeEntity(_0x4621fa,_0x350a28){return function(_0x11ef03){if(_0x11ef03){return _0x11ef03['destroy']()['then'](function(){_0x4621fa[_0xba6b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fd16,_0xfd5df4){return function(_0x539989){if(!_0x539989){_0x55fd16[_0xba6b('0x18')](0x194);}return _0x539989;};}function handleError(_0x172a2e,_0x580b84){_0x580b84=_0x580b84||0x1f4;return function(_0x1b0fab){logger['error'](_0x1b0fab[_0xba6b('0x27')]);if(_0x1b0fab['name']){delete _0x1b0fab[_0xba6b('0x28')];}_0x172a2e['status'](_0x580b84)['send'](_0x1b0fab);};}exports[_0xba6b('0x29')]=function(_0x291650,_0x386c7f){var _0x586935={},_0x1b289f={},_0x5343cf={'count':0x0,'rows':[]};var _0x5395bc=_[_0xba6b('0x2a')](db[_0xba6b('0x2b')][_0xba6b('0x2c')],function(_0x19bb89){return{'name':_0x19bb89['fieldName'],'type':_0x19bb89['type']['key']};});_0x1b289f[_0xba6b('0x2d')]=_['map'](_0x5395bc,_0xba6b('0x28'));_0x1b289f[_0xba6b('0x2e')]=_[_0xba6b('0x2f')](_0x291650[_0xba6b('0x2e')]);_0x1b289f[_0xba6b('0x30')]=_[_0xba6b('0x31')](_0x1b289f['model'],_0x1b289f['query']);_0x586935[_0xba6b('0x32')]=_[_0xba6b('0x31')](_0x1b289f[_0xba6b('0x2d')],qs[_0xba6b('0x33')](_0x291650['query']['fields']));_0x586935[_0xba6b('0x32')]=_0x586935[_0xba6b('0x32')][_0xba6b('0x34')]?_0x586935[_0xba6b('0x32')]:_0x1b289f[_0xba6b('0x2d')];if(!_0x291650[_0xba6b('0x2e')][_0xba6b('0x35')](_0xba6b('0x36'))){_0x586935[_0xba6b('0x1e')]=qs[_0xba6b('0x1e')](_0x291650['query']['limit']);_0x586935[_0xba6b('0x1c')]=qs[_0xba6b('0x1c')](_0x291650[_0xba6b('0x2e')][_0xba6b('0x1c')]);}_0x586935[_0xba6b('0x37')]=qs['sort'](_0x291650[_0xba6b('0x2e')]['sort']);_0x586935[_0xba6b('0x38')]=qs[_0xba6b('0x30')](_['pick'](_0x291650['query'],_0x1b289f[_0xba6b('0x30')]),_0x5395bc);if(_0x291650[_0xba6b('0x2e')][_0xba6b('0x39')]){_0x586935[_0xba6b('0x38')]=_['merge'](_0x586935['where'],{'$or':_[_0xba6b('0x2a')](_0x5395bc,function(_0x529a3c){if(_0x529a3c[_0xba6b('0x3a')]!=='VIRTUAL'){var _0xa1952a={};_0xa1952a[_0x529a3c[_0xba6b('0x28')]]={'$like':'%'+_0x291650[_0xba6b('0x2e')][_0xba6b('0x39')]+'%'};return _0xa1952a;}})});}_0x586935=_['merge']({},_0x586935,_0x291650[_0xba6b('0x3b')]);var _0x42e484={'where':_0x586935[_0xba6b('0x38')]};return db['SmsQueueReport']['count'](_0x42e484)[_0xba6b('0x26')](function(_0x35da8b){_0x5343cf[_0xba6b('0x1f')]=_0x35da8b;if(_0x291650[_0xba6b('0x2e')][_0xba6b('0x3c')]){_0x586935[_0xba6b('0x3d')]=[{'all':!![]}];}return db[_0xba6b('0x2b')][_0xba6b('0x3e')](_0x586935);})[_0xba6b('0x26')](function(_0x28629a){_0x5343cf['rows']=_0x28629a;return _0x5343cf;})['then'](respondWithFilteredResult(_0x386c7f,_0x586935))['catch'](handleError(_0x386c7f,null));};exports[_0xba6b('0x3f')]=function(_0x374827,_0x1e2c5d){var _0x2b3f4f={'raw':!![],'where':{'id':_0x374827[_0xba6b('0x40')]['id']}},_0x18e900={};_0x18e900[_0xba6b('0x2d')]=_['keys'](db[_0xba6b('0x2b')][_0xba6b('0x2c')]);_0x18e900[_0xba6b('0x2e')]=_[_0xba6b('0x2f')](_0x374827[_0xba6b('0x2e')]);_0x18e900['filters']=_[_0xba6b('0x31')](_0x18e900['model'],_0x18e900[_0xba6b('0x2e')]);_0x2b3f4f[_0xba6b('0x32')]=_[_0xba6b('0x31')](_0x18e900[_0xba6b('0x2d')],qs['fields'](_0x374827['query']['fields']));_0x2b3f4f[_0xba6b('0x32')]=_0x2b3f4f[_0xba6b('0x32')][_0xba6b('0x34')]?_0x2b3f4f[_0xba6b('0x32')]:_0x18e900[_0xba6b('0x2d')];if(_0x374827[_0xba6b('0x2e')][_0xba6b('0x3c')]){_0x2b3f4f['include']=[{'all':!![]}];}_0x2b3f4f=_['merge']({},_0x2b3f4f,_0x374827[_0xba6b('0x3b')]);return db[_0xba6b('0x2b')]['find'](_0x2b3f4f)[_0xba6b('0x26')](handleEntityNotFound(_0x1e2c5d,null))[_0xba6b('0x26')](respondWithResult(_0x1e2c5d,null))[_0xba6b('0x41')](handleError(_0x1e2c5d,null));};exports['create']=function(_0xc3fc1d,_0x4e308e){return db[_0xba6b('0x2b')]['create'](_0xc3fc1d[_0xba6b('0x42')],{})[_0xba6b('0x26')](respondWithResult(_0x4e308e,0xc9))[_0xba6b('0x41')](handleError(_0x4e308e,null));};exports['update']=function(_0x5cef4e,_0x4073a6){if(_0x5cef4e['body']['id']){delete _0x5cef4e[_0xba6b('0x42')]['id'];}return db[_0xba6b('0x2b')][_0xba6b('0x43')]({'where':{'id':_0x5cef4e[_0xba6b('0x40')]['id']}})[_0xba6b('0x26')](handleEntityNotFound(_0x4073a6,null))[_0xba6b('0x26')](saveUpdates(_0x5cef4e[_0xba6b('0x42')],null))['then'](respondWithResult(_0x4073a6,null))[_0xba6b('0x41')](handleError(_0x4073a6,null));};exports[_0xba6b('0x44')]=function(_0x579ee1,_0x535d14){return db[_0xba6b('0x2b')][_0xba6b('0x43')]({'where':{'id':_0x579ee1['params']['id']}})[_0xba6b('0x26')](handleEntityNotFound(_0x535d14,null))[_0xba6b('0x26')](removeEntity(_0x535d14,null))[_0xba6b('0x41')](handleError(_0x535d14,null));};exports[_0xba6b('0x45')]=function(_0x4823f6,_0x1fd46e){return db[_0xba6b('0x2b')][_0xba6b('0x45')]()[_0xba6b('0x26')](respondWithResult(_0x1fd46e,null))[_0xba6b('0x41')](handleError(_0x1fd46e,null));}; \ No newline at end of file +var _0xf195=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsQueueReport','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4c2d70,_0x3877ae){var _0x54831e=function(_0x28eddc){while(--_0x28eddc){_0x4c2d70['push'](_0x4c2d70['shift']());}};_0x54831e(++_0x3877ae);}(_0xf195,0xcd));var _0x5f19=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xf195[_0x2b5513];return _0x578fd2;};'use strict';var emlformat=require(_0x5f19('0x0'));var rimraf=require(_0x5f19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f19('0x2'));var rp=require('request-promise');var moment=require(_0x5f19('0x3'));var BPromise=require(_0x5f19('0x4'));var Mustache=require('mustache');var util=require(_0x5f19('0x5'));var path=require(_0x5f19('0x6'));var sox=require(_0x5f19('0x7'));var csv=require(_0x5f19('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f19('0x9'));var _=require(_0x5f19('0xa'));var squel=require(_0x5f19('0xb'));var crypto=require(_0x5f19('0xc'));var jsforce=require(_0x5f19('0xd'));var deskjs=require(_0x5f19('0xe'));var toCsv=require(_0x5f19('0x8'));var querystring=require(_0x5f19('0xf'));var Papa=require(_0x5f19('0x10'));var Redis=require(_0x5f19('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f19('0x12'));var as=require(_0x5f19('0x13'));var hardwareService=require(_0x5f19('0x14'));var logger=require(_0x5f19('0x15'))(_0x5f19('0x16'));var utils=require('../../config/utils');var config=require(_0x5f19('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43a419,_0x73b1f0){_0x73b1f0=_0x73b1f0||0xcc;return function(_0x2a8499){if(_0x2a8499){return _0x43a419[_0x5f19('0x18')](_0x73b1f0);}return _0x43a419[_0x5f19('0x19')](_0x73b1f0)[_0x5f19('0x1a')]();};}function respondWithResult(_0x2fb974,_0x3de32c){_0x3de32c=_0x3de32c||0xc8;return function(_0x23c5c1){if(_0x23c5c1){return _0x2fb974[_0x5f19('0x19')](_0x3de32c)[_0x5f19('0x1b')](_0x23c5c1);}};}function respondWithFilteredResult(_0x41b05a,_0xf25216){return function(_0x9764ba){if(_0x9764ba){var _0x46f7e3=typeof _0xf25216[_0x5f19('0x1c')]===_0x5f19('0x1d')&&typeof _0xf25216[_0x5f19('0x1e')]===_0x5f19('0x1d');var _0x55c7fb=_0x9764ba[_0x5f19('0x1f')];var _0x22c137=_0x46f7e3?0x0:_0xf25216[_0x5f19('0x1c')];var _0x40640b=_0x46f7e3?_0x9764ba[_0x5f19('0x1f')]:_0xf25216[_0x5f19('0x1c')]+_0xf25216['limit'];var _0x3301a2;if(_0x40640b>=_0x55c7fb){_0x40640b=_0x55c7fb;_0x3301a2=0xc8;}else{_0x3301a2=0xce;}_0x41b05a['status'](_0x3301a2);return _0x41b05a[_0x5f19('0x20')](_0x5f19('0x21'),_0x22c137+'-'+_0x40640b+'/'+_0x55c7fb)['json'](_0x9764ba);}return null;};}function patchUpdates(_0xb6c91){return function(_0x31afaf){try{jsonpatch[_0x5f19('0x22')](_0x31afaf,_0xb6c91,!![]);}catch(_0x268c17){return BPromise[_0x5f19('0x23')](_0x268c17);}return _0x31afaf['save']();};}function saveUpdates(_0xc4a438,_0xf60b7c){return function(_0x3f06ec){if(_0x3f06ec){return _0x3f06ec[_0x5f19('0x24')](_0xc4a438)[_0x5f19('0x25')](function(_0x10db23){return _0x10db23;});}return null;};}function removeEntity(_0x47f1c4,_0x49f47a){return function(_0x2c4f61){if(_0x2c4f61){return _0x2c4f61[_0x5f19('0x26')]()['then'](function(){_0x47f1c4[_0x5f19('0x19')](0xcc)[_0x5f19('0x1a')]();});}};}function handleEntityNotFound(_0x41e683,_0x4a7a1d){return function(_0x46d405){if(!_0x46d405){_0x41e683['sendStatus'](0x194);}return _0x46d405;};}function handleError(_0x3d5416,_0x15207f){_0x15207f=_0x15207f||0x1f4;return function(_0x43e2ae){logger[_0x5f19('0x27')](_0x43e2ae['stack']);if(_0x43e2ae[_0x5f19('0x28')]){delete _0x43e2ae[_0x5f19('0x28')];}_0x3d5416['status'](_0x15207f)['send'](_0x43e2ae);};}exports[_0x5f19('0x29')]=function(_0x1ee1ba,_0x44d271){var _0x30d8fb={},_0x114b61={},_0x498061={'count':0x0,'rows':[]};var _0x148ae6=_[_0x5f19('0x2a')](db['SmsQueueReport'][_0x5f19('0x2b')],function(_0x35c304){return{'name':_0x35c304[_0x5f19('0x2c')],'type':_0x35c304[_0x5f19('0x2d')]['key']};});_0x114b61[_0x5f19('0x2e')]=_['map'](_0x148ae6,_0x5f19('0x28'));_0x114b61['query']=_[_0x5f19('0x2f')](_0x1ee1ba[_0x5f19('0x30')]);_0x114b61[_0x5f19('0x31')]=_[_0x5f19('0x32')](_0x114b61['model'],_0x114b61[_0x5f19('0x30')]);_0x30d8fb[_0x5f19('0x33')]=_[_0x5f19('0x32')](_0x114b61[_0x5f19('0x2e')],qs[_0x5f19('0x34')](_0x1ee1ba[_0x5f19('0x30')][_0x5f19('0x34')]));_0x30d8fb[_0x5f19('0x33')]=_0x30d8fb[_0x5f19('0x33')][_0x5f19('0x35')]?_0x30d8fb[_0x5f19('0x33')]:_0x114b61[_0x5f19('0x2e')];if(!_0x1ee1ba[_0x5f19('0x30')][_0x5f19('0x36')](_0x5f19('0x37'))){_0x30d8fb[_0x5f19('0x1e')]=qs[_0x5f19('0x1e')](_0x1ee1ba[_0x5f19('0x30')][_0x5f19('0x1e')]);_0x30d8fb[_0x5f19('0x1c')]=qs[_0x5f19('0x1c')](_0x1ee1ba[_0x5f19('0x30')]['offset']);}_0x30d8fb[_0x5f19('0x38')]=qs[_0x5f19('0x39')](_0x1ee1ba['query'][_0x5f19('0x39')]);_0x30d8fb[_0x5f19('0x3a')]=qs[_0x5f19('0x31')](_[_0x5f19('0x3b')](_0x1ee1ba[_0x5f19('0x30')],_0x114b61['filters']),_0x148ae6);if(_0x1ee1ba[_0x5f19('0x30')]['filter']){_0x30d8fb[_0x5f19('0x3a')]=_[_0x5f19('0x3c')](_0x30d8fb['where'],{'$or':_[_0x5f19('0x2a')](_0x148ae6,function(_0x2337c9){if(_0x2337c9[_0x5f19('0x2d')]!==_0x5f19('0x3d')){var _0x17b78a={};_0x17b78a[_0x2337c9['name']]={'$like':'%'+_0x1ee1ba['query'][_0x5f19('0x3e')]+'%'};return _0x17b78a;}})});}_0x30d8fb=_[_0x5f19('0x3c')]({},_0x30d8fb,_0x1ee1ba[_0x5f19('0x3f')]);var _0x3372ca={'where':_0x30d8fb[_0x5f19('0x3a')]};return db[_0x5f19('0x40')][_0x5f19('0x1f')](_0x3372ca)['then'](function(_0x1ecae4){_0x498061[_0x5f19('0x1f')]=_0x1ecae4;if(_0x1ee1ba['query'][_0x5f19('0x41')]){_0x30d8fb[_0x5f19('0x42')]=[{'all':!![]}];}return db[_0x5f19('0x40')][_0x5f19('0x43')](_0x30d8fb);})[_0x5f19('0x25')](function(_0x10bc04){_0x498061[_0x5f19('0x44')]=_0x10bc04;return _0x498061;})['then'](respondWithFilteredResult(_0x44d271,_0x30d8fb))[_0x5f19('0x45')](handleError(_0x44d271,null));};exports['show']=function(_0x4d5c0a,_0x2da215){var _0x50e0e1={'raw':!![],'where':{'id':_0x4d5c0a[_0x5f19('0x46')]['id']}},_0x18522a={};_0x18522a['model']=_[_0x5f19('0x2f')](db['SmsQueueReport'][_0x5f19('0x2b')]);_0x18522a[_0x5f19('0x30')]=_[_0x5f19('0x2f')](_0x4d5c0a[_0x5f19('0x30')]);_0x18522a[_0x5f19('0x31')]=_[_0x5f19('0x32')](_0x18522a[_0x5f19('0x2e')],_0x18522a[_0x5f19('0x30')]);_0x50e0e1[_0x5f19('0x33')]=_[_0x5f19('0x32')](_0x18522a['model'],qs['fields'](_0x4d5c0a[_0x5f19('0x30')][_0x5f19('0x34')]));_0x50e0e1['attributes']=_0x50e0e1[_0x5f19('0x33')][_0x5f19('0x35')]?_0x50e0e1[_0x5f19('0x33')]:_0x18522a[_0x5f19('0x2e')];if(_0x4d5c0a[_0x5f19('0x30')][_0x5f19('0x41')]){_0x50e0e1[_0x5f19('0x42')]=[{'all':!![]}];}_0x50e0e1=_['merge']({},_0x50e0e1,_0x4d5c0a[_0x5f19('0x3f')]);return db[_0x5f19('0x40')][_0x5f19('0x47')](_0x50e0e1)[_0x5f19('0x25')](handleEntityNotFound(_0x2da215,null))['then'](respondWithResult(_0x2da215,null))['catch'](handleError(_0x2da215,null));};exports['create']=function(_0x4be821,_0x354b70){return db[_0x5f19('0x40')]['create'](_0x4be821[_0x5f19('0x48')],{})['then'](respondWithResult(_0x354b70,0xc9))[_0x5f19('0x45')](handleError(_0x354b70,null));};exports['update']=function(_0x2ad71e,_0x140811){if(_0x2ad71e[_0x5f19('0x48')]['id']){delete _0x2ad71e[_0x5f19('0x48')]['id'];}return db[_0x5f19('0x40')][_0x5f19('0x47')]({'where':{'id':_0x2ad71e[_0x5f19('0x46')]['id']}})[_0x5f19('0x25')](handleEntityNotFound(_0x140811,null))[_0x5f19('0x25')](saveUpdates(_0x2ad71e['body'],null))[_0x5f19('0x25')](respondWithResult(_0x140811,null))[_0x5f19('0x45')](handleError(_0x140811,null));};exports['destroy']=function(_0x26c402,_0x4f52aa){return db[_0x5f19('0x40')]['find']({'where':{'id':_0x26c402[_0x5f19('0x46')]['id']}})[_0x5f19('0x25')](handleEntityNotFound(_0x4f52aa,null))[_0x5f19('0x25')](removeEntity(_0x4f52aa,null))['catch'](handleError(_0x4f52aa,null));};exports[_0x5f19('0x49')]=function(_0xcebb91,_0x5ce68d){return db[_0x5f19('0x40')][_0x5f19('0x49')]()[_0x5f19('0x25')](respondWithResult(_0x5ce68d,null))['catch'](handleError(_0x5ce68d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1bceca2..1659b4a 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 _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0xd8aa6e,_0x4dfe76){var _0x4885c9=function(_0x3e90d8){while(--_0x3e90d8){_0xd8aa6e['push'](_0xd8aa6e['shift']());}};_0x4885c9(++_0x4dfe76);}(_0x70e0,0x17b));var _0x070e=function(_0x251c21,_0xda373f){_0x251c21=_0x251c21-0x0;var _0x589815=_0x70e0[_0x251c21];return _0x589815;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2694e3,_0xa0a1ca){var _0x11b411=function(_0x35b956){while(--_0x35b956){_0x2694e3['push'](_0x2694e3['shift']());}};_0x11b411(++_0xa0a1ca);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 5705054..309ab0f 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 _0x71d0=['attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where'];(function(_0x5e2f9e,_0x373be3){var _0x4176ce=function(_0x11b9ba){while(--_0x11b9ba){_0x5e2f9e['push'](_0x5e2f9e['shift']());}};_0x4176ce(++_0x373be3);}(_0x71d0,0x156));var _0x071d=function(_0x114514,_0x48f1c9){_0x114514=_0x114514-0x0;var _0xd778be=_0x71d0[_0x114514];return _0xd778be;};'use strict';var _=require('lodash');var util=require(_0x071d('0x0'));var moment=require(_0x071d('0x1'));var BPromise=require(_0x071d('0x2'));var rs=require(_0x071d('0x3'));var fs=require('fs');var Redis=require(_0x071d('0x4'));var db=require(_0x071d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x071d('0x6'))('rpc');var config=require(_0x071d('0x7'));var jayson=require(_0x071d('0x8'));var client=jayson[_0x071d('0x9')][_0x071d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a20e2,_0x1fcfe6,_0x415981){return new BPromise(function(_0x1d9c07,_0xa915c){return client[_0x071d('0xb')](_0x1a20e2,_0x415981)[_0x071d('0xc')](function(_0x538cd1){logger[_0x071d('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x1fcfe6,_0x071d('0xe'));logger[_0x071d('0xf')](_0x071d('0x10'),_0x1fcfe6,_0x071d('0xe'),JSON[_0x071d('0x11')](_0x538cd1));if(_0x538cd1[_0x071d('0x12')]){if(_0x538cd1[_0x071d('0x12')][_0x071d('0x13')]===0x1f4){logger[_0x071d('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x1fcfe6,_0x538cd1['error'][_0x071d('0x14')]);return _0xa915c(_0x538cd1['error'][_0x071d('0x14')]);}logger[_0x071d('0x12')](_0x071d('0x15'),_0x1fcfe6,_0x538cd1[_0x071d('0x12')][_0x071d('0x14')]);return _0x1d9c07(_0x538cd1['error'][_0x071d('0x14')]);}else{logger[_0x071d('0xd')](_0x071d('0x15'),_0x1fcfe6,_0x071d('0xe'));_0x1d9c07(_0x538cd1['result'][_0x071d('0x14')]);}})[_0x071d('0x16')](function(_0x562285){logger[_0x071d('0x12')](_0x071d('0x15'),_0x1fcfe6,_0x562285);_0xa915c(_0x562285);});});}exports[_0x071d('0x17')]=function(_0x4af092){var _0x44d75c=this;return new Promise(function(_0x4e7f8a,_0x290269){return db[_0x071d('0x18')][_0x071d('0x19')](_0x4af092[_0x071d('0x1a')],{'raw':_0x4af092[_0x071d('0x1b')]?_0x4af092['options'][_0x071d('0x1c')]===undefined?!![]:![]:!![]})[_0x071d('0xc')](function(_0x1f8839){logger[_0x071d('0xd')](_0x071d('0x17'),_0x4af092);logger[_0x071d('0xf')](_0x071d('0x17'),_0x4af092,JSON[_0x071d('0x11')](_0x1f8839));_0x4e7f8a(_0x1f8839);})[_0x071d('0x16')](function(_0x250d91){logger[_0x071d('0x12')](_0x071d('0x17'),_0x250d91[_0x071d('0x14')],_0x4af092);_0x290269(_0x44d75c[_0x071d('0x12')](0x1f4,_0x250d91[_0x071d('0x14')]));});});};exports[_0x071d('0x1d')]=function(_0x571302){var _0x16a456=this;return new Promise(function(_0x1de910,_0x20d138){return db[_0x071d('0x18')][_0x071d('0x1e')](_0x571302['body'],{'raw':_0x571302['options']?_0x571302['options'][_0x071d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x571302[_0x071d('0x1b')]?_0x571302[_0x071d('0x1b')][_0x071d('0x1f')]||null:null,'attributes':_0x571302['options']?_0x571302['options'][_0x071d('0x20')]||null:null,'limit':_0x571302[_0x071d('0x1b')]?_0x571302[_0x071d('0x1b')][_0x071d('0x21')]||null:null})[_0x071d('0xc')](function(_0x2c58f8){logger['info'](_0x071d('0x1d'),_0x571302);logger[_0x071d('0xf')](_0x071d('0x1d'),_0x571302,JSON[_0x071d('0x11')](_0x2c58f8));_0x1de910(_0x2c58f8);})[_0x071d('0x16')](function(_0x200a7c){logger['error'](_0x071d('0x1d'),_0x200a7c[_0x071d('0x14')],_0x571302);_0x20d138(_0x16a456[_0x071d('0x12')](0x1f4,_0x200a7c[_0x071d('0x14')]));});});}; \ No newline at end of file +var _0x04eb=['request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','then','update','raw','where','limit','UpdateSmsQueueReport','lodash','util','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x29461c,_0x10d76f){var _0x401fee=function(_0x490de6){while(--_0x490de6){_0x29461c['push'](_0x29461c['shift']());}};_0x401fee(++_0x10d76f);}(_0x04eb,0x6f));var _0xb04e=function(_0x210082,_0x570890){_0x210082=_0x210082-0x0;var _0x2f95ac=_0x04eb[_0x210082];return _0x2f95ac;};'use strict';var _=require(_0xb04e('0x0'));var util=require(_0xb04e('0x1'));var moment=require(_0xb04e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb04e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb04e('0x4'))('rpc');var config=require(_0xb04e('0x5'));var jayson=require(_0xb04e('0x6'));var client=jayson[_0xb04e('0x7')][_0xb04e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51c130,_0x13b05f,_0x4342c9){return new BPromise(function(_0x15379a,_0x15c413){return client[_0xb04e('0x9')](_0x51c130,_0x4342c9)['then'](function(_0x224bd3){logger['info'](_0xb04e('0xa'),_0x13b05f,_0xb04e('0xb'));logger[_0xb04e('0xc')](_0xb04e('0xd'),_0x13b05f,_0xb04e('0xb'),JSON[_0xb04e('0xe')](_0x224bd3));if(_0x224bd3[_0xb04e('0xf')]){if(_0x224bd3['error']['code']===0x1f4){logger[_0xb04e('0xf')](_0xb04e('0xa'),_0x13b05f,_0x224bd3['error'][_0xb04e('0x10')]);return _0x15c413(_0x224bd3[_0xb04e('0xf')][_0xb04e('0x10')]);}logger[_0xb04e('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x13b05f,_0x224bd3[_0xb04e('0xf')][_0xb04e('0x10')]);return _0x15379a(_0x224bd3[_0xb04e('0xf')][_0xb04e('0x10')]);}else{logger[_0xb04e('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x13b05f,_0xb04e('0xb'));_0x15379a(_0x224bd3['result'][_0xb04e('0x10')]);}})[_0xb04e('0x12')](function(_0x3338a2){logger[_0xb04e('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x13b05f,_0x3338a2);_0x15c413(_0x3338a2);});});}exports[_0xb04e('0x13')]=function(_0x22afa2){var _0x235121=this;return new Promise(function(_0x46b4bb,_0x124f9c){return db[_0xb04e('0x14')][_0xb04e('0x15')](_0x22afa2[_0xb04e('0x16')],{'raw':_0x22afa2['options']?_0x22afa2[_0xb04e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xb04e('0x18')](function(_0x1cd1fe){logger[_0xb04e('0x11')](_0xb04e('0x13'),_0x22afa2);logger[_0xb04e('0xc')](_0xb04e('0x13'),_0x22afa2,JSON[_0xb04e('0xe')](_0x1cd1fe));_0x46b4bb(_0x1cd1fe);})['catch'](function(_0x1ad734){logger['error'](_0xb04e('0x13'),_0x1ad734[_0xb04e('0x10')],_0x22afa2);_0x124f9c(_0x235121[_0xb04e('0xf')](0x1f4,_0x1ad734[_0xb04e('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x437a55){var _0x29d4b2=this;return new Promise(function(_0x577d2d,_0x2c61a5){return db[_0xb04e('0x14')][_0xb04e('0x19')](_0x437a55[_0xb04e('0x16')],{'raw':_0x437a55[_0xb04e('0x17')]?_0x437a55['options'][_0xb04e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x437a55[_0xb04e('0x17')]?_0x437a55['options'][_0xb04e('0x1b')]||null:null,'attributes':_0x437a55['options']?_0x437a55[_0xb04e('0x17')]['attributes']||null:null,'limit':_0x437a55[_0xb04e('0x17')]?_0x437a55[_0xb04e('0x17')][_0xb04e('0x1c')]||null:null})[_0xb04e('0x18')](function(_0xcf0282){logger[_0xb04e('0x11')](_0xb04e('0x1d'),_0x437a55);logger[_0xb04e('0xc')](_0xb04e('0x1d'),_0x437a55,JSON[_0xb04e('0xe')](_0xcf0282));_0x577d2d(_0xcf0282);})['catch'](function(_0x45d9d7){logger[_0xb04e('0xf')](_0xb04e('0x1d'),_0x45d9d7[_0xb04e('0x10')],_0x437a55);_0x2c61a5(_0x29d4b2[_0xb04e('0xf')](0x1f4,_0x45d9d7['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index e3e415f..7bd6c73 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 _0x7fbe=['/describe','describe','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index'];(function(_0x5528f5,_0x53ea8b){var _0x4d6795=function(_0x29680a){while(--_0x29680a){_0x5528f5['push'](_0x5528f5['shift']());}};_0x4d6795(++_0x53ea8b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x18ea8a,_0x32f09f){_0x18ea8a=_0x18ea8a-0x0;var _0x19c99a=_0x7fbe[_0x18ea8a];return _0x19c99a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x3561=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','/:id','delete','destroy'];(function(_0x286917,_0x390246){var _0x3327b3=function(_0x3159d1){while(--_0x3159d1){_0x286917['push'](_0x286917['shift']());}};_0x3327b3(++_0x390246);}(_0x3561,0x94));var _0x1356=function(_0x3493a1,_0x4d7052){_0x3493a1=_0x3493a1-0x0;var _0x22f6c2=_0x3561[_0x3493a1];return _0x22f6c2;};'use strict';var multer=require(_0x1356('0x0'));var util=require('util');var path=require(_0x1356('0x1'));var timeout=require(_0x1356('0x2'));var express=require(_0x1356('0x3'));var router=express[_0x1356('0x4')]();var fs_extra=require(_0x1356('0x5'));var auth=require(_0x1356('0x6'));var interaction=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var controller=require(_0x1356('0x9'));router[_0x1356('0xa')]('/',auth[_0x1356('0xb')](),controller[_0x1356('0xc')]);router[_0x1356('0xa')]('/describe',auth[_0x1356('0xb')](),controller[_0x1356('0xd')]);router[_0x1356('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1356('0xe')]);router[_0x1356('0xf')]('/',auth['isAuthenticated'](),controller[_0x1356('0x10')]);router['put'](_0x1356('0x11'),auth[_0x1356('0xb')](),controller['update']);router[_0x1356('0x12')](_0x1356('0x11'),auth['isAuthenticated'](),controller[_0x1356('0x13')]);module[_0x1356('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 8a48ded..e6d0a88 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xb216b0,_0xdf62aa){var _0x10075f=function(_0x133606){while(--_0x133606){_0xb216b0['push'](_0xb216b0['shift']());}};_0x10075f(++_0xdf62aa);}(_0xaa88,0x137));var _0x8aa8=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0xaa88[_0x51b661];return _0x5d1971;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x277b55,_0x8ba28){var _0xff0d15=function(_0x1beefc){while(--_0x1beefc){_0x277b55['push'](_0x277b55['shift']());}};_0xff0d15(++_0x8ba28);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 581d1bb..4ad7570 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 _0x0d56=['../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','reject','save','name','send','SmsTransferReport','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','then','includeAll','findAll','rows','catch','show','rawAttributes','include','options','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x48b964,_0x491840){var _0x527277=function(_0x27bee6){while(--_0x27bee6){_0x48b964['push'](_0x48b964['shift']());}};_0x527277(++_0x491840);}(_0x0d56,0x113));var _0x60d5=function(_0x548911,_0x93233c){_0x548911=_0x548911-0x0;var _0xa41cf8=_0x0d56[_0x548911];return _0xa41cf8;};'use strict';var emlformat=require(_0x60d5('0x0'));var rimraf=require(_0x60d5('0x1'));var zipdir=require(_0x60d5('0x2'));var jsonpatch=require(_0x60d5('0x3'));var rp=require(_0x60d5('0x4'));var moment=require(_0x60d5('0x5'));var BPromise=require(_0x60d5('0x6'));var Mustache=require(_0x60d5('0x7'));var util=require(_0x60d5('0x8'));var path=require('path');var sox=require(_0x60d5('0x9'));var csv=require('to-csv');var ejs=require(_0x60d5('0xa'));var fs=require('fs');var fs_extra=require(_0x60d5('0xb'));var _=require(_0x60d5('0xc'));var squel=require(_0x60d5('0xd'));var crypto=require(_0x60d5('0xe'));var jsforce=require(_0x60d5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x60d5('0x10'));var querystring=require(_0x60d5('0x11'));var Papa=require(_0x60d5('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x60d5('0x13'));var as=require(_0x60d5('0x14'));var hardwareService=require(_0x60d5('0x15'));var logger=require(_0x60d5('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x60d5('0x17'));var db=require(_0x60d5('0x18'))['db'];function respondWithStatusCode(_0x1e77f0,_0x5836c7){_0x5836c7=_0x5836c7||0xcc;return function(_0x24e927){if(_0x24e927){return _0x1e77f0[_0x60d5('0x19')](_0x5836c7);}return _0x1e77f0['status'](_0x5836c7)[_0x60d5('0x1a')]();};}function respondWithResult(_0x112288,_0x54e295){_0x54e295=_0x54e295||0xc8;return function(_0x26576f){if(_0x26576f){return _0x112288['status'](_0x54e295)['json'](_0x26576f);}};}function respondWithFilteredResult(_0x36ac29,_0x472a11){return function(_0x1f0c34){if(_0x1f0c34){var _0x4457ca=typeof _0x472a11[_0x60d5('0x1b')]==='undefined'&&typeof _0x472a11[_0x60d5('0x1c')]===_0x60d5('0x1d');var _0x6cb3e8=_0x1f0c34[_0x60d5('0x1e')];var _0x49a6bb=_0x4457ca?0x0:_0x472a11[_0x60d5('0x1b')];var _0x616863=_0x4457ca?_0x1f0c34[_0x60d5('0x1e')]:_0x472a11[_0x60d5('0x1b')]+_0x472a11['limit'];var _0x1e56f1;if(_0x616863>=_0x6cb3e8){_0x616863=_0x6cb3e8;_0x1e56f1=0xc8;}else{_0x1e56f1=0xce;}_0x36ac29[_0x60d5('0x1f')](_0x1e56f1);return _0x36ac29[_0x60d5('0x20')](_0x60d5('0x21'),_0x49a6bb+'-'+_0x616863+'/'+_0x6cb3e8)[_0x60d5('0x22')](_0x1f0c34);}return null;};}function patchUpdates(_0x527d9a){return function(_0x500897){try{jsonpatch[_0x60d5('0x23')](_0x500897,_0x527d9a,!![]);}catch(_0x20af4f){return BPromise[_0x60d5('0x24')](_0x20af4f);}return _0x500897[_0x60d5('0x25')]();};}function saveUpdates(_0x1527aa,_0x424476){return function(_0x1460a0){if(_0x1460a0){return _0x1460a0['update'](_0x1527aa)['then'](function(_0x329e1d){return _0x329e1d;});}return null;};}function removeEntity(_0x59cea9,_0x13025a){return function(_0x3073c2){if(_0x3073c2){return _0x3073c2['destroy']()['then'](function(){_0x59cea9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f53a6,_0x273aab){return function(_0x1a69a7){if(!_0x1a69a7){_0x4f53a6[_0x60d5('0x19')](0x194);}return _0x1a69a7;};}function handleError(_0x1cf61a,_0x3af8fd){_0x3af8fd=_0x3af8fd||0x1f4;return function(_0x156d0a){logger['error'](_0x156d0a['stack']);if(_0x156d0a[_0x60d5('0x26')]){delete _0x156d0a['name'];}_0x1cf61a[_0x60d5('0x1f')](_0x3af8fd)[_0x60d5('0x27')](_0x156d0a);};}exports['index']=function(_0x399fef,_0x110ead){var _0x425279={},_0xa8533a={},_0x1e460d={'count':0x0,'rows':[]};var _0x37671a=_['map'](db[_0x60d5('0x28')]['rawAttributes'],function(_0x4e6095){return{'name':_0x4e6095['fieldName'],'type':_0x4e6095[_0x60d5('0x29')][_0x60d5('0x2a')]};});_0xa8533a['model']=_['map'](_0x37671a,'name');_0xa8533a[_0x60d5('0x2b')]=_[_0x60d5('0x2c')](_0x399fef['query']);_0xa8533a[_0x60d5('0x2d')]=_[_0x60d5('0x2e')](_0xa8533a[_0x60d5('0x2f')],_0xa8533a[_0x60d5('0x2b')]);_0x425279[_0x60d5('0x30')]=_[_0x60d5('0x2e')](_0xa8533a['model'],qs[_0x60d5('0x31')](_0x399fef[_0x60d5('0x2b')][_0x60d5('0x31')]));_0x425279[_0x60d5('0x30')]=_0x425279[_0x60d5('0x30')][_0x60d5('0x32')]?_0x425279[_0x60d5('0x30')]:_0xa8533a['model'];if(!_0x399fef['query'][_0x60d5('0x33')]('nolimit')){_0x425279[_0x60d5('0x1c')]=qs[_0x60d5('0x1c')](_0x399fef[_0x60d5('0x2b')]['limit']);_0x425279[_0x60d5('0x1b')]=qs[_0x60d5('0x1b')](_0x399fef[_0x60d5('0x2b')][_0x60d5('0x1b')]);}_0x425279[_0x60d5('0x34')]=qs[_0x60d5('0x35')](_0x399fef['query'][_0x60d5('0x35')]);_0x425279[_0x60d5('0x36')]=qs[_0x60d5('0x2d')](_[_0x60d5('0x37')](_0x399fef[_0x60d5('0x2b')],_0xa8533a[_0x60d5('0x2d')]),_0x37671a);if(_0x399fef[_0x60d5('0x2b')]['filter']){_0x425279[_0x60d5('0x36')]=_[_0x60d5('0x38')](_0x425279[_0x60d5('0x36')],{'$or':_[_0x60d5('0x39')](_0x37671a,function(_0x256169){if(_0x256169[_0x60d5('0x29')]!==_0x60d5('0x3a')){var _0x3045a7={};_0x3045a7[_0x256169[_0x60d5('0x26')]]={'$like':'%'+_0x399fef[_0x60d5('0x2b')]['filter']+'%'};return _0x3045a7;}})});}_0x425279=_[_0x60d5('0x38')]({},_0x425279,_0x399fef['options']);var _0x51ff84={'where':_0x425279[_0x60d5('0x36')]};return db[_0x60d5('0x28')][_0x60d5('0x1e')](_0x51ff84)[_0x60d5('0x3b')](function(_0x6c9eea){_0x1e460d[_0x60d5('0x1e')]=_0x6c9eea;if(_0x399fef[_0x60d5('0x2b')][_0x60d5('0x3c')]){_0x425279['include']=[{'all':!![]}];}return db[_0x60d5('0x28')][_0x60d5('0x3d')](_0x425279);})['then'](function(_0x136e8c){_0x1e460d[_0x60d5('0x3e')]=_0x136e8c;return _0x1e460d;})[_0x60d5('0x3b')](respondWithFilteredResult(_0x110ead,_0x425279))[_0x60d5('0x3f')](handleError(_0x110ead,null));};exports[_0x60d5('0x40')]=function(_0x3ed615,_0x5832e6){var _0x21952a={'raw':!![],'where':{'id':_0x3ed615['params']['id']}},_0x3810c7={};_0x3810c7[_0x60d5('0x2f')]=_[_0x60d5('0x2c')](db[_0x60d5('0x28')][_0x60d5('0x41')]);_0x3810c7[_0x60d5('0x2b')]=_[_0x60d5('0x2c')](_0x3ed615[_0x60d5('0x2b')]);_0x3810c7[_0x60d5('0x2d')]=_[_0x60d5('0x2e')](_0x3810c7[_0x60d5('0x2f')],_0x3810c7[_0x60d5('0x2b')]);_0x21952a[_0x60d5('0x30')]=_[_0x60d5('0x2e')](_0x3810c7[_0x60d5('0x2f')],qs[_0x60d5('0x31')](_0x3ed615[_0x60d5('0x2b')][_0x60d5('0x31')]));_0x21952a[_0x60d5('0x30')]=_0x21952a[_0x60d5('0x30')]['length']?_0x21952a[_0x60d5('0x30')]:_0x3810c7[_0x60d5('0x2f')];if(_0x3ed615[_0x60d5('0x2b')]['includeAll']){_0x21952a[_0x60d5('0x42')]=[{'all':!![]}];}_0x21952a=_[_0x60d5('0x38')]({},_0x21952a,_0x3ed615[_0x60d5('0x43')]);return db[_0x60d5('0x28')][_0x60d5('0x44')](_0x21952a)['then'](handleEntityNotFound(_0x5832e6,null))[_0x60d5('0x3b')](respondWithResult(_0x5832e6,null))[_0x60d5('0x3f')](handleError(_0x5832e6,null));};exports[_0x60d5('0x45')]=function(_0x21be05,_0x1ef5c5){return db['SmsTransferReport'][_0x60d5('0x45')](_0x21be05[_0x60d5('0x46')],{})['then'](respondWithResult(_0x1ef5c5,0xc9))[_0x60d5('0x3f')](handleError(_0x1ef5c5,null));};exports['update']=function(_0x5b5cd9,_0x23dcaf){if(_0x5b5cd9[_0x60d5('0x46')]['id']){delete _0x5b5cd9[_0x60d5('0x46')]['id'];}return db['SmsTransferReport'][_0x60d5('0x44')]({'where':{'id':_0x5b5cd9[_0x60d5('0x47')]['id']}})[_0x60d5('0x3b')](handleEntityNotFound(_0x23dcaf,null))['then'](saveUpdates(_0x5b5cd9[_0x60d5('0x46')],null))[_0x60d5('0x3b')](respondWithResult(_0x23dcaf,null))[_0x60d5('0x3f')](handleError(_0x23dcaf,null));};exports[_0x60d5('0x48')]=function(_0x213eae,_0x4a71b6){return db[_0x60d5('0x28')][_0x60d5('0x44')]({'where':{'id':_0x213eae[_0x60d5('0x47')]['id']}})[_0x60d5('0x3b')](handleEntityNotFound(_0x4a71b6,null))[_0x60d5('0x3b')](removeEntity(_0x4a71b6,null))[_0x60d5('0x3f')](handleError(_0x4a71b6,null));};exports[_0x60d5('0x49')]=function(_0x845f36,_0x10e4c2){return db[_0x60d5('0x28')][_0x60d5('0x49')]()[_0x60d5('0x3b')](respondWithResult(_0x10e4c2,null))[_0x60d5('0x3f')](handleError(_0x10e4c2,null));}; \ No newline at end of file +var _0x7d10=['sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','send','SmsTransferReport','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','limit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x1ca995,_0x458edc){var _0x6c1cbb=function(_0x109124){while(--_0x109124){_0x1ca995['push'](_0x1ca995['shift']());}};_0x6c1cbb(++_0x458edc);}(_0x7d10,0x1a3));var _0x07d1=function(_0x3aafe9,_0x4a1ea1){_0x3aafe9=_0x3aafe9-0x0;var _0x42c5a9=_0x7d10[_0x3aafe9];return _0x42c5a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x07d1('0x0'));var jsonpatch=require(_0x07d1('0x1'));var rp=require(_0x07d1('0x2'));var moment=require('moment');var BPromise=require(_0x07d1('0x3'));var Mustache=require(_0x07d1('0x4'));var util=require(_0x07d1('0x5'));var path=require(_0x07d1('0x6'));var sox=require(_0x07d1('0x7'));var csv=require(_0x07d1('0x8'));var ejs=require(_0x07d1('0x9'));var fs=require('fs');var fs_extra=require(_0x07d1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x07d1('0xb'));var jsforce=require(_0x07d1('0xc'));var deskjs=require(_0x07d1('0xd'));var toCsv=require(_0x07d1('0x8'));var querystring=require('querystring');var Papa=require(_0x07d1('0xe'));var Redis=require(_0x07d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x07d1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07d1('0x11'))(_0x07d1('0x12'));var utils=require(_0x07d1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x07d1('0x14'));var db=require(_0x07d1('0x15'))['db'];function respondWithStatusCode(_0x63bd3d,_0xaa2f1e){_0xaa2f1e=_0xaa2f1e||0xcc;return function(_0x2656ce){if(_0x2656ce){return _0x63bd3d[_0x07d1('0x16')](_0xaa2f1e);}return _0x63bd3d['status'](_0xaa2f1e)[_0x07d1('0x17')]();};}function respondWithResult(_0x41bd04,_0xb92ce2){_0xb92ce2=_0xb92ce2||0xc8;return function(_0x5c3a8c){if(_0x5c3a8c){return _0x41bd04[_0x07d1('0x18')](_0xb92ce2)[_0x07d1('0x19')](_0x5c3a8c);}};}function respondWithFilteredResult(_0x888536,_0x346ba2){return function(_0x15ac7e){if(_0x15ac7e){var _0x3c28ac=typeof _0x346ba2['offset']===_0x07d1('0x1a')&&typeof _0x346ba2['limit']==='undefined';var _0x2184b8=_0x15ac7e[_0x07d1('0x1b')];var _0xb21dc=_0x3c28ac?0x0:_0x346ba2[_0x07d1('0x1c')];var _0x437313=_0x3c28ac?_0x15ac7e[_0x07d1('0x1b')]:_0x346ba2[_0x07d1('0x1c')]+_0x346ba2['limit'];var _0x364101;if(_0x437313>=_0x2184b8){_0x437313=_0x2184b8;_0x364101=0xc8;}else{_0x364101=0xce;}_0x888536[_0x07d1('0x18')](_0x364101);return _0x888536[_0x07d1('0x1d')](_0x07d1('0x1e'),_0xb21dc+'-'+_0x437313+'/'+_0x2184b8)[_0x07d1('0x19')](_0x15ac7e);}return null;};}function patchUpdates(_0x14f6f9){return function(_0x171545){try{jsonpatch[_0x07d1('0x1f')](_0x171545,_0x14f6f9,!![]);}catch(_0x50db4c){return BPromise[_0x07d1('0x20')](_0x50db4c);}return _0x171545[_0x07d1('0x21')]();};}function saveUpdates(_0x1c504f,_0x4d159e){return function(_0x6144d){if(_0x6144d){return _0x6144d[_0x07d1('0x22')](_0x1c504f)[_0x07d1('0x23')](function(_0x1d8c28){return _0x1d8c28;});}return null;};}function removeEntity(_0xdbe99b,_0x27599c){return function(_0x481908){if(_0x481908){return _0x481908[_0x07d1('0x24')]()[_0x07d1('0x23')](function(){_0xdbe99b[_0x07d1('0x18')](0xcc)[_0x07d1('0x17')]();});}};}function handleEntityNotFound(_0x39a9c8,_0x18870f){return function(_0x915bef){if(!_0x915bef){_0x39a9c8[_0x07d1('0x16')](0x194);}return _0x915bef;};}function handleError(_0x296437,_0x196a26){_0x196a26=_0x196a26||0x1f4;return function(_0x28a324){logger[_0x07d1('0x25')](_0x28a324['stack']);if(_0x28a324['name']){delete _0x28a324['name'];}_0x296437[_0x07d1('0x18')](_0x196a26)[_0x07d1('0x26')](_0x28a324);};}exports['index']=function(_0x256492,_0x51095f){var _0x5906ad={},_0x4787b2={},_0x296313={'count':0x0,'rows':[]};var _0x36b7cf=_['map'](db[_0x07d1('0x27')][_0x07d1('0x28')],function(_0x2c5393){return{'name':_0x2c5393[_0x07d1('0x29')],'type':_0x2c5393[_0x07d1('0x2a')]['key']};});_0x4787b2[_0x07d1('0x2b')]=_[_0x07d1('0x2c')](_0x36b7cf,_0x07d1('0x2d'));_0x4787b2[_0x07d1('0x2e')]=_[_0x07d1('0x2f')](_0x256492['query']);_0x4787b2[_0x07d1('0x30')]=_[_0x07d1('0x31')](_0x4787b2[_0x07d1('0x2b')],_0x4787b2[_0x07d1('0x2e')]);_0x5906ad[_0x07d1('0x32')]=_['intersection'](_0x4787b2[_0x07d1('0x2b')],qs[_0x07d1('0x33')](_0x256492['query'][_0x07d1('0x33')]));_0x5906ad[_0x07d1('0x32')]=_0x5906ad['attributes'][_0x07d1('0x34')]?_0x5906ad[_0x07d1('0x32')]:_0x4787b2[_0x07d1('0x2b')];if(!_0x256492['query']['hasOwnProperty']('nolimit')){_0x5906ad[_0x07d1('0x35')]=qs[_0x07d1('0x35')](_0x256492[_0x07d1('0x2e')][_0x07d1('0x35')]);_0x5906ad[_0x07d1('0x1c')]=qs[_0x07d1('0x1c')](_0x256492[_0x07d1('0x2e')]['offset']);}_0x5906ad['order']=qs[_0x07d1('0x36')](_0x256492[_0x07d1('0x2e')][_0x07d1('0x36')]);_0x5906ad['where']=qs[_0x07d1('0x30')](_[_0x07d1('0x37')](_0x256492[_0x07d1('0x2e')],_0x4787b2[_0x07d1('0x30')]),_0x36b7cf);if(_0x256492[_0x07d1('0x2e')][_0x07d1('0x38')]){_0x5906ad[_0x07d1('0x39')]=_['merge'](_0x5906ad[_0x07d1('0x39')],{'$or':_['map'](_0x36b7cf,function(_0x338203){if(_0x338203[_0x07d1('0x2a')]!==_0x07d1('0x3a')){var _0x4eaabf={};_0x4eaabf[_0x338203[_0x07d1('0x2d')]]={'$like':'%'+_0x256492[_0x07d1('0x2e')][_0x07d1('0x38')]+'%'};return _0x4eaabf;}})});}_0x5906ad=_[_0x07d1('0x3b')]({},_0x5906ad,_0x256492[_0x07d1('0x3c')]);var _0x3bf35a={'where':_0x5906ad[_0x07d1('0x39')]};return db[_0x07d1('0x27')][_0x07d1('0x1b')](_0x3bf35a)[_0x07d1('0x23')](function(_0x3d53a8){_0x296313[_0x07d1('0x1b')]=_0x3d53a8;if(_0x256492[_0x07d1('0x2e')]['includeAll']){_0x5906ad[_0x07d1('0x3d')]=[{'all':!![]}];}return db[_0x07d1('0x27')][_0x07d1('0x3e')](_0x5906ad);})[_0x07d1('0x23')](function(_0x53a905){_0x296313[_0x07d1('0x3f')]=_0x53a905;return _0x296313;})[_0x07d1('0x23')](respondWithFilteredResult(_0x51095f,_0x5906ad))[_0x07d1('0x40')](handleError(_0x51095f,null));};exports['show']=function(_0xaa2214,_0x23eb79){var _0x9c8389={'raw':!![],'where':{'id':_0xaa2214[_0x07d1('0x41')]['id']}},_0x1c4f09={};_0x1c4f09[_0x07d1('0x2b')]=_[_0x07d1('0x2f')](db['SmsTransferReport'][_0x07d1('0x28')]);_0x1c4f09['query']=_[_0x07d1('0x2f')](_0xaa2214[_0x07d1('0x2e')]);_0x1c4f09[_0x07d1('0x30')]=_[_0x07d1('0x31')](_0x1c4f09[_0x07d1('0x2b')],_0x1c4f09[_0x07d1('0x2e')]);_0x9c8389[_0x07d1('0x32')]=_[_0x07d1('0x31')](_0x1c4f09[_0x07d1('0x2b')],qs[_0x07d1('0x33')](_0xaa2214[_0x07d1('0x2e')]['fields']));_0x9c8389['attributes']=_0x9c8389[_0x07d1('0x32')][_0x07d1('0x34')]?_0x9c8389[_0x07d1('0x32')]:_0x1c4f09[_0x07d1('0x2b')];if(_0xaa2214[_0x07d1('0x2e')][_0x07d1('0x42')]){_0x9c8389[_0x07d1('0x3d')]=[{'all':!![]}];}_0x9c8389=_['merge']({},_0x9c8389,_0xaa2214[_0x07d1('0x3c')]);return db[_0x07d1('0x27')][_0x07d1('0x43')](_0x9c8389)[_0x07d1('0x23')](handleEntityNotFound(_0x23eb79,null))[_0x07d1('0x23')](respondWithResult(_0x23eb79,null))[_0x07d1('0x40')](handleError(_0x23eb79,null));};exports['create']=function(_0x262f95,_0x4c1366){return db['SmsTransferReport'][_0x07d1('0x44')](_0x262f95[_0x07d1('0x45')],{})[_0x07d1('0x23')](respondWithResult(_0x4c1366,0xc9))[_0x07d1('0x40')](handleError(_0x4c1366,null));};exports['update']=function(_0x429a01,_0x55514c){if(_0x429a01[_0x07d1('0x45')]['id']){delete _0x429a01[_0x07d1('0x45')]['id'];}return db['SmsTransferReport'][_0x07d1('0x43')]({'where':{'id':_0x429a01['params']['id']}})[_0x07d1('0x23')](handleEntityNotFound(_0x55514c,null))[_0x07d1('0x23')](saveUpdates(_0x429a01['body'],null))[_0x07d1('0x23')](respondWithResult(_0x55514c,null))[_0x07d1('0x40')](handleError(_0x55514c,null));};exports[_0x07d1('0x24')]=function(_0x31448d,_0x5eec85){return db[_0x07d1('0x27')][_0x07d1('0x43')]({'where':{'id':_0x31448d[_0x07d1('0x41')]['id']}})['then'](handleEntityNotFound(_0x5eec85,null))[_0x07d1('0x23')](removeEntity(_0x5eec85,null))[_0x07d1('0x40')](handleError(_0x5eec85,null));};exports[_0x07d1('0x46')]=function(_0x2fad12,_0x567705){return db['SmsTransferReport'][_0x07d1('0x46')]()[_0x07d1('0x23')](respondWithResult(_0x567705,null))[_0x07d1('0x40')](handleError(_0x567705,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3e409c0..1e14f30 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 _0x614b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','api'];(function(_0x7cd505,_0x3e121b){var _0x46c64c=function(_0x551063){while(--_0x551063){_0x7cd505['push'](_0x7cd505['shift']());}};_0x46c64c(++_0x3e121b);}(_0x614b,0xb3));var _0xb614=function(_0x276dab,_0xb1782){_0x276dab=_0x276dab-0x0;var _0x21568e=_0x614b[_0x276dab];return _0x21568e;};'use strict';var _=require(_0xb614('0x0'));var util=require(_0xb614('0x1'));var logger=require('../../config/logger')(_0xb614('0x2'));var moment=require(_0xb614('0x3'));var BPromise=require(_0xb614('0x4'));var rp=require(_0xb614('0x5'));var fs=require('fs');var path=require(_0xb614('0x6'));var rimraf=require(_0xb614('0x7'));var config=require(_0xb614('0x8'));var attributes=require(_0xb614('0x9'));module[_0xb614('0xa')]=function(_0x466f91,_0x103506){return _0x466f91[_0xb614('0xb')](_0xb614('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xb614('0xd'),'fields':[_0xb614('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x320e=['request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','moment','bluebird'];(function(_0x175fc7,_0x545448){var _0x39335c=function(_0x2c412e){while(--_0x2c412e){_0x175fc7['push'](_0x175fc7['shift']());}};_0x39335c(++_0x545448);}(_0x320e,0x8c));var _0xe320=function(_0x27926c,_0x37d579){_0x27926c=_0x27926c-0x0;var _0x584578=_0x320e[_0x27926c];return _0x584578;};'use strict';var _=require(_0xe320('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe320('0x1'));var BPromise=require(_0xe320('0x2'));var rp=require(_0xe320('0x3'));var fs=require('fs');var path=require(_0xe320('0x4'));var rimraf=require('rimraf');var config=require(_0xe320('0x5'));var attributes=require(_0xe320('0x6'));module[_0xe320('0x7')]=function(_0x3f4b14,_0x436712){return _0x3f4b14[_0xe320('0x8')]('SmsTransferReport',attributes,{'tableName':_0xe320('0x9'),'paranoid':![],'indexes':[{'name':_0xe320('0xa'),'fields':[_0xe320('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 989c35d..0cf67e0 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 _0xf3ff=['error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xd1cc0e,_0x5202b4){var _0xda9e26=function(_0x440bca){while(--_0x440bca){_0xd1cc0e['push'](_0xd1cc0e['shift']());}};_0xda9e26(++_0x5202b4);}(_0xf3ff,0xae));var _0xff3f=function(_0xe0f09e,_0x3569ac){_0xe0f09e=_0xe0f09e-0x0;var _0x123129=_0xf3ff[_0xe0f09e];return _0x123129;};'use strict';var _=require(_0xff3f('0x0'));var util=require('util');var moment=require(_0xff3f('0x1'));var BPromise=require(_0xff3f('0x2'));var rs=require(_0xff3f('0x3'));var fs=require('fs');var Redis=require(_0xff3f('0x4'));var db=require(_0xff3f('0x5'))['db'];var utils=require(_0xff3f('0x6'));var logger=require('../../config/logger')(_0xff3f('0x7'));var config=require(_0xff3f('0x8'));var jayson=require(_0xff3f('0x9'));var client=jayson['client'][_0xff3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45a86f,_0x5568d0,_0x465c8a){return new BPromise(function(_0x1543bf,_0x5c1d76){return client['request'](_0x45a86f,_0x465c8a)['then'](function(_0x34df96){logger['info'](_0xff3f('0xb'),_0x5568d0,'request\x20sent');logger[_0xff3f('0xc')](_0xff3f('0xd'),_0x5568d0,_0xff3f('0xe'),JSON[_0xff3f('0xf')](_0x34df96));if(_0x34df96[_0xff3f('0x10')]){if(_0x34df96[_0xff3f('0x10')][_0xff3f('0x11')]===0x1f4){logger[_0xff3f('0x10')](_0xff3f('0xb'),_0x5568d0,_0x34df96[_0xff3f('0x10')]['message']);return _0x5c1d76(_0x34df96['error'][_0xff3f('0x12')]);}logger[_0xff3f('0x10')](_0xff3f('0xb'),_0x5568d0,_0x34df96['error']['message']);return _0x1543bf(_0x34df96[_0xff3f('0x10')]['message']);}else{logger['info'](_0xff3f('0xb'),_0x5568d0,_0xff3f('0xe'));_0x1543bf(_0x34df96['result'][_0xff3f('0x12')]);}})['catch'](function(_0x129647){logger['error'](_0xff3f('0xb'),_0x5568d0,_0x129647);_0x5c1d76(_0x129647);});});} \ No newline at end of file +var _0x29d4=['request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s'];(function(_0x31a99e,_0x4beb2b){var _0x245fe2=function(_0x185126){while(--_0x185126){_0x31a99e['push'](_0x31a99e['shift']());}};_0x245fe2(++_0x4beb2b);}(_0x29d4,0x1a1));var _0x429d=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x29d4[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var moment=require(_0x429d('0x1'));var BPromise=require(_0x429d('0x2'));var rs=require(_0x429d('0x3'));var fs=require('fs');var Redis=require(_0x429d('0x4'));var db=require(_0x429d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x429d('0x6'))(_0x429d('0x7'));var config=require(_0x429d('0x8'));var jayson=require(_0x429d('0x9'));var client=jayson[_0x429d('0xa')][_0x429d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56aa2f,_0x1ede3f,_0x4befb9){return new BPromise(function(_0x9fc337,_0x47cb29){return client[_0x429d('0xc')](_0x56aa2f,_0x4befb9)[_0x429d('0xd')](function(_0xe6f5b4){logger['info'](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));logger['debug'](_0x429d('0x10'),_0x1ede3f,_0x429d('0xf'),JSON[_0x429d('0x11')](_0xe6f5b4));if(_0xe6f5b4['error']){if(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x13')]===0x1f4){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4['error'][_0x429d('0x14')]);return _0x47cb29(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}logger['error'](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4[_0x429d('0x12')]['message']);return _0x9fc337(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}else{logger[_0x429d('0x15')](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));_0x9fc337(_0xe6f5b4[_0x429d('0x16')]['message']);}})[_0x429d('0x17')](function(_0x53d19d){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0x53d19d);_0x47cb29(_0x53d19d);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index e72b05f..e4a5845 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 _0x85e9=['now','extname','post','single','file','create','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','originalname','format','%s-%s%s','basename'];(function(_0x7fd9e9,_0x1765d0){var _0x285d92=function(_0x4060fe){while(--_0x4060fe){_0x7fd9e9['push'](_0x7fd9e9['shift']());}};_0x285d92(++_0x1765d0);}(_0x85e9,0x120));var _0x985e=function(_0x1363a1,_0x797c70){_0x1363a1=_0x1363a1-0x0;var _0x1202f8=_0x85e9[_0x1363a1];return _0x1202f8;};'use strict';var multer=require(_0x985e('0x0'));var util=require(_0x985e('0x1'));var path=require(_0x985e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x985e('0x3')]();var fs_extra=require(_0x985e('0x4'));var auth=require(_0x985e('0x5'));var interaction=require(_0x985e('0x6'));var config=require(_0x985e('0x7'));var controller=require(_0x985e('0x8'));router[_0x985e('0x9')]('/',auth[_0x985e('0xa')](),controller[_0x985e('0xb')]);router[_0x985e('0x9')](_0x985e('0xc'),auth['isAuthenticated'](),controller[_0x985e('0xd')]);router['get'](_0x985e('0xe'),auth[_0x985e('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x985e('0xf')]({'destination':function(_0x4bac48,_0x3967cf,_0x46cd27){_0x46cd27(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x59c5d4,_0x41ecff,_0x3ae9c7){_0x41ecff['originalname']=_0x41ecff[_0x985e('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ae9c7(null,util[_0x985e('0x11')](_0x985e('0x12'),path[_0x985e('0x13')](_0x41ecff[_0x985e('0x10')],path['extname'](_0x41ecff['originalname'])),Date[_0x985e('0x14')](),path[_0x985e('0x15')](_0x41ecff[_0x985e('0x10')])));}})});router[_0x985e('0x16')]('/',upload[_0x985e('0x17')](_0x985e('0x18')),controller[_0x985e('0x19')]);router['put'](_0x985e('0xc'),auth[_0x985e('0xa')](),controller[_0x985e('0x1a')]);router[_0x985e('0x1b')](_0x985e('0xc'),auth['isAuthenticated'](),controller[_0x985e('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa2c8=['index','show','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','now','extname','file','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x2e5cfd,_0x3e18a1){var _0x171636=function(_0xdf3162){while(--_0xdf3162){_0x2e5cfd['push'](_0x2e5cfd['shift']());}};_0x171636(++_0x3e18a1);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var path=require(_0x8a2c('0x2'));var timeout=require(_0x8a2c('0x3'));var express=require(_0x8a2c('0x4'));var router=express[_0x8a2c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8a2c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x8a2c('0x7')]('/',auth[_0x8a2c('0x8')](),controller[_0x8a2c('0x9')]);router[_0x8a2c('0x7')]('/:id',auth[_0x8a2c('0x8')](),controller[_0x8a2c('0xa')]);router[_0x8a2c('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x8a2c('0xb')]({'destination':function(_0x29071b,_0x4e31b5,_0x1da83c){_0x1da83c(null,path[_0x8a2c('0xc')](config[_0x8a2c('0xd')],_0x8a2c('0xe')));},'filename':function(_0x1fc918,_0xab22e4,_0x5b4fcb){_0xab22e4[_0x8a2c('0xf')]=_0xab22e4[_0x8a2c('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5b4fcb(null,util[_0x8a2c('0x10')](_0x8a2c('0x11'),path['basename'](_0xab22e4['originalname'],path['extname'](_0xab22e4['originalname'])),Date[_0x8a2c('0x12')](),path[_0x8a2c('0x13')](_0xab22e4[_0x8a2c('0xf')])));}})});router['post']('/',upload['single'](_0x8a2c('0x14')),controller[_0x8a2c('0x15')]);router[_0x8a2c('0x16')](_0x8a2c('0x17'),auth[_0x8a2c('0x8')](),controller[_0x8a2c('0x18')]);router[_0x8a2c('0x19')](_0x8a2c('0x17'),auth['isAuthenticated'](),controller['delete']);module[_0x8a2c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 0c21912..63de4fd 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 _0xb941=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x267337,_0x2496a9){var _0x14aef5=function(_0x55cfd0){while(--_0x55cfd0){_0x267337['push'](_0x267337['shift']());}};_0x14aef5(++_0x2496a9);}(_0xb941,0x7e));var _0x1b94=function(_0x9df75c,_0x26f5b5){_0x9df75c=_0x9df75c-0x0;var _0x481164=_0xb941[_0x9df75c];return _0x481164;};'use strict';var Sequelize=require(_0x1b94('0x0'));module[_0x1b94('0x1')]={'name':{'type':Sequelize[_0x1b94('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x1b94('0x2')]},'display_name':{'type':Sequelize[_0x1b94('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x1b94('0x3')]},'original_sampleCount':{'type':Sequelize[_0x1b94('0x4')]},'original_channelCount':{'type':Sequelize[_0x1b94('0x5')]},'original_bitRate':{'type':Sequelize[_0x1b94('0x4')]},'original_sampleRate':{'type':Sequelize[_0x1b94('0x5')]},'converted_format':{'type':Sequelize[_0x1b94('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x1b94('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x1b94('0x5')]}}; \ No newline at end of file +var _0x8369=['exports','name','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x1fa470,_0x20539d){var _0x28c4dd=function(_0x1b04e4){while(--_0x1b04e4){_0x1fa470['push'](_0x1fa470['shift']());}};_0x28c4dd(++_0x20539d);}(_0x8369,0x1e6));var _0x9836=function(_0x446666,_0x3e4543){_0x446666=_0x446666-0x0;var _0x120e29=_0x8369[_0x446666];return _0x120e29;};'use strict';var Sequelize=require('sequelize');module[_0x9836('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9836('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9836('0x2')]},'display_name':{'type':Sequelize[_0x9836('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x9836('0x2')]},'original_format':{'type':Sequelize[_0x9836('0x2')]},'original_duration':{'type':Sequelize[_0x9836('0x3')]},'original_sampleCount':{'type':Sequelize[_0x9836('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x9836('0x4')]},'original_sampleRate':{'type':Sequelize[_0x9836('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x9836('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x9836('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 86e4537..0914763 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 _0x3638=['userProfileId','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Sound','findAll','params','include','options','download','find','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','save_name','catch','create','basename','file','originalname','filename','extname','substring','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role'];(function(_0x284351,_0x102746){var _0x2035b8=function(_0x155edc){while(--_0x155edc){_0x284351['push'](_0x284351['shift']());}};_0x2035b8(++_0x102746);}(_0x3638,0x180));var _0x8363=function(_0x2543ad,_0x4a99b1){_0x2543ad=_0x2543ad-0x0;var _0x347664=_0x3638[_0x2543ad];return _0x347664;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8363('0x0'));var zipdir=require(_0x8363('0x1'));var jsonpatch=require(_0x8363('0x2'));var rp=require('request-promise');var moment=require(_0x8363('0x3'));var BPromise=require(_0x8363('0x4'));var Mustache=require(_0x8363('0x5'));var util=require(_0x8363('0x6'));var path=require(_0x8363('0x7'));var sox=require(_0x8363('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(_0x8363('0x9'));var crypto=require(_0x8363('0xa'));var jsforce=require(_0x8363('0xb'));var deskjs=require(_0x8363('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8363('0xd'));var authService=require(_0x8363('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8363('0xf'));var hardwareService=require(_0x8363('0x10'));var logger=require(_0x8363('0x11'))(_0x8363('0x12'));var utils=require(_0x8363('0x13'));var config=require(_0x8363('0x14'));var licenseUtil=require(_0x8363('0x15'));var db=require(_0x8363('0x16'))['db'];function respondWithStatusCode(_0x4cd2b8,_0x1f8915){_0x1f8915=_0x1f8915||0xcc;return function(_0x59e4ee){if(_0x59e4ee){return _0x4cd2b8[_0x8363('0x17')](_0x1f8915);}return _0x4cd2b8[_0x8363('0x18')](_0x1f8915)[_0x8363('0x19')]();};}function respondWithResult(_0x364092,_0x107d19){_0x107d19=_0x107d19||0xc8;return function(_0x53d21f){if(_0x53d21f){return _0x364092[_0x8363('0x18')](_0x107d19)[_0x8363('0x1a')](_0x53d21f);}};}function respondWithFilteredResult(_0x17a780,_0x18e4a9){return function(_0x380495){if(_0x380495){var _0x143ab5=typeof _0x18e4a9[_0x8363('0x1b')]===_0x8363('0x1c')&&typeof _0x18e4a9[_0x8363('0x1d')]===_0x8363('0x1c');var _0x3a785c=_0x380495['count'];var _0x3aa220=_0x143ab5?0x0:_0x18e4a9[_0x8363('0x1b')];var _0x6851fc=_0x143ab5?_0x380495[_0x8363('0x1e')]:_0x18e4a9[_0x8363('0x1b')]+_0x18e4a9['limit'];var _0x2c239b;if(_0x6851fc>=_0x3a785c){_0x6851fc=_0x3a785c;_0x2c239b=0xc8;}else{_0x2c239b=0xce;}_0x17a780[_0x8363('0x18')](_0x2c239b);return _0x17a780[_0x8363('0x1f')]('Content-Range',_0x3aa220+'-'+_0x6851fc+'/'+_0x3a785c)[_0x8363('0x1a')](_0x380495);}return null;};}function patchUpdates(_0x438754){return function(_0x369059){try{jsonpatch[_0x8363('0x20')](_0x369059,_0x438754,!![]);}catch(_0x103fc5){return BPromise[_0x8363('0x21')](_0x103fc5);}return _0x369059[_0x8363('0x22')]();};}function saveUpdates(_0x5c05e6,_0x3a2288){return function(_0x54b775){if(_0x54b775){return _0x54b775[_0x8363('0x23')](_0x5c05e6)[_0x8363('0x24')](function(_0x23b862){return _0x23b862;});}return null;};}function removeEntity(_0x424aa5,_0x36976b){return function(_0x42f22d){if(_0x42f22d){return _0x42f22d[_0x8363('0x25')]()[_0x8363('0x24')](function(){var _0x55620d=_0x42f22d['get']({'plain':!![]});var _0x6fdfcd=_0x8363('0x26');return db[_0x8363('0x27')][_0x8363('0x25')]({'where':{'type':_0x6fdfcd,'resourceId':_0x55620d['id']}})[_0x8363('0x24')](function(){return _0x42f22d;});})['then'](function(){_0x424aa5[_0x8363('0x18')](0xcc)[_0x8363('0x19')]();});}};}function handleEntityNotFound(_0x59f39a,_0x34e87e){return function(_0x14b52e){if(!_0x14b52e){_0x59f39a['sendStatus'](0x194);}return _0x14b52e;};}function handleError(_0x49af03,_0x3ea3ab){_0x3ea3ab=_0x3ea3ab||0x1f4;return function(_0x1c9149){logger[_0x8363('0x28')](_0x1c9149[_0x8363('0x29')]);if(_0x1c9149[_0x8363('0x2a')]){delete _0x1c9149['name'];}_0x49af03[_0x8363('0x18')](_0x3ea3ab)[_0x8363('0x2b')](_0x1c9149);};}exports['index']=function(_0x40bec3,_0x263cf6){var _0x57e65c={},_0x28dd3d={},_0x54654e={'count':0x0,'rows':[]};var _0x566400=_[_0x8363('0x2c')](db['Sound'][_0x8363('0x2d')],function(_0x5a2e92){return{'name':_0x5a2e92[_0x8363('0x2e')],'type':_0x5a2e92[_0x8363('0x2f')][_0x8363('0x30')]};});_0x28dd3d[_0x8363('0x31')]=_[_0x8363('0x2c')](_0x566400,_0x8363('0x2a'));_0x28dd3d[_0x8363('0x32')]=_[_0x8363('0x33')](_0x40bec3[_0x8363('0x32')]);_0x28dd3d['filters']=_[_0x8363('0x34')](_0x28dd3d[_0x8363('0x31')],_0x28dd3d[_0x8363('0x32')]);_0x57e65c[_0x8363('0x35')]=_[_0x8363('0x34')](_0x28dd3d['model'],qs[_0x8363('0x36')](_0x40bec3[_0x8363('0x32')]['fields']));_0x57e65c[_0x8363('0x35')]=_0x57e65c[_0x8363('0x35')][_0x8363('0x37')]?_0x57e65c[_0x8363('0x35')]:_0x28dd3d[_0x8363('0x31')];if(!_0x40bec3[_0x8363('0x32')]['hasOwnProperty'](_0x8363('0x38'))){_0x57e65c[_0x8363('0x1d')]=qs['limit'](_0x40bec3[_0x8363('0x32')][_0x8363('0x1d')]);_0x57e65c['offset']=qs[_0x8363('0x1b')](_0x40bec3[_0x8363('0x32')]['offset']);}_0x57e65c[_0x8363('0x39')]=qs[_0x8363('0x3a')](_0x40bec3[_0x8363('0x32')]['sort']);_0x57e65c[_0x8363('0x3b')]=qs[_0x8363('0x3c')](_[_0x8363('0x3d')](_0x40bec3[_0x8363('0x32')],_0x28dd3d[_0x8363('0x3c')]),_0x566400);if(_0x40bec3[_0x8363('0x32')][_0x8363('0x3e')]){_0x57e65c['where']=_[_0x8363('0x3f')](_0x57e65c['where'],{'$or':_['map'](_0x566400,function(_0x215952){if(_0x215952['type']!==_0x8363('0x40')){var _0x443916={};_0x443916[_0x215952['name']]={'$like':'%'+_0x40bec3[_0x8363('0x32')][_0x8363('0x3e')]+'%'};return _0x443916;}})});}_0x57e65c=_[_0x8363('0x3f')]({},_0x57e65c,_0x40bec3['options']);var _0x3cacf7={'where':_0x57e65c[_0x8363('0x3b')]};return db[_0x8363('0x41')][_0x8363('0x1e')](_0x3cacf7)['then'](function(_0x3f71f9){_0x54654e[_0x8363('0x1e')]=_0x3f71f9;if(_0x40bec3['query']['includeAll']){_0x57e65c['include']=[{'all':!![]}];}return db[_0x8363('0x41')][_0x8363('0x42')](_0x57e65c);})['then'](function(_0x2ce7c8){_0x54654e['rows']=_0x2ce7c8;return _0x54654e;})[_0x8363('0x24')](respondWithFilteredResult(_0x263cf6,_0x57e65c))['catch'](handleError(_0x263cf6,null));};exports['show']=function(_0xde55c,_0x405cae){var _0x12f655={'raw':!![],'where':{'id':_0xde55c[_0x8363('0x43')]['id']}},_0x3e148b={};_0x3e148b[_0x8363('0x31')]=_[_0x8363('0x33')](db[_0x8363('0x41')][_0x8363('0x2d')]);_0x3e148b[_0x8363('0x32')]=_[_0x8363('0x33')](_0xde55c['query']);_0x3e148b[_0x8363('0x3c')]=_[_0x8363('0x34')](_0x3e148b[_0x8363('0x31')],_0x3e148b[_0x8363('0x32')]);_0x12f655[_0x8363('0x35')]=_[_0x8363('0x34')](_0x3e148b[_0x8363('0x31')],qs[_0x8363('0x36')](_0xde55c['query']['fields']));_0x12f655[_0x8363('0x35')]=_0x12f655[_0x8363('0x35')]['length']?_0x12f655[_0x8363('0x35')]:_0x3e148b[_0x8363('0x31')];if(_0xde55c[_0x8363('0x32')]['includeAll']){_0x12f655[_0x8363('0x44')]=[{'all':!![]}];}_0x12f655=_[_0x8363('0x3f')]({},_0x12f655,_0xde55c[_0x8363('0x45')]);return db[_0x8363('0x41')]['find'](_0x12f655)[_0x8363('0x24')](handleEntityNotFound(_0x405cae,null))['then'](respondWithResult(_0x405cae,null))['catch'](handleError(_0x405cae,null));};exports[_0x8363('0x46')]=function(_0x3896b5,_0x3366db,_0xad3149){return db[_0x8363('0x41')][_0x8363('0x47')]({'where':{'id':_0x3896b5[_0x8363('0x43')]['id']},'attributes':[_0x8363('0x2a'),'save_name',_0x8363('0x48')],'raw':!![]})[_0x8363('0x24')](handleEntityNotFound(_0x3366db,null))['then'](function(_0x286a6d){if(_0x286a6d){if(!fs['existsSync'](path[_0x8363('0x49')](config['root'],_0x8363('0x4a'),_0x286a6d['save_name']+'.'+_0x286a6d[_0x8363('0x48')]))){throw new db[(_0x8363('0x4b'))][(_0x8363('0x4c'))](_0x8363('0x4d'));}return _0x3366db[_0x8363('0x46')](path[_0x8363('0x49')](config['root'],'server/files/sounds/converted',util[_0x8363('0x4e')](_0x8363('0x4f'),_0x286a6d[_0x8363('0x50')],_0x286a6d['converted_format'])),util[_0x8363('0x4e')](_0x8363('0x4f'),_0x286a6d[_0x8363('0x2a')],_0x286a6d[_0x8363('0x48')]));}return null;})[_0x8363('0x51')](handleError(_0x3366db,null));};exports[_0x8363('0x52')]=function(_0x42b1db,_0x1ebad8,_0x155cdd){var _0x4a4582={'name':path[_0x8363('0x53')](_0x42b1db['file']['originalname'],path['extname'](_0x42b1db[_0x8363('0x54')][_0x8363('0x55')])),'save_name':path[_0x8363('0x53')](_0x42b1db[_0x8363('0x54')][_0x8363('0x56')],path[_0x8363('0x57')](_0x42b1db[_0x8363('0x54')][_0x8363('0x56')])),'original_format':path[_0x8363('0x57')](_0x42b1db[_0x8363('0x54')][_0x8363('0x55')])[_0x8363('0x58')](0x1),'converted_format':'wav'};var _0x356e1a=path[_0x8363('0x49')](config[_0x8363('0x59')],_0x8363('0x5a'),_0x42b1db[_0x8363('0x54')]['filename']);var _0x5afba3=path[_0x8363('0x49')](config[_0x8363('0x59')],_0x8363('0x4a'),util[_0x8363('0x4e')](_0x8363('0x4f'),path[_0x8363('0x53')](_0x42b1db[_0x8363('0x54')]['filename'],path[_0x8363('0x57')](_0x42b1db[_0x8363('0x54')][_0x8363('0x56')])),_0x4a4582[_0x8363('0x48')]));logger[_0x8363('0x5b')](_0x8363('0x5c'),_0x356e1a);logger['info'](_0x8363('0x5d'),_0x5afba3);try{fs[_0x8363('0x5e')](_0x356e1a,parseInt(_0x8363('0x5f'),0x8));var _0x58ef2e=sox['transcode'](_0x356e1a,_0x5afba3,{'sampleRate':0x1f40,'format':_0x8363('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x58ef2e['on'](_0x8363('0x28'),function(_0x1807f6){fs[_0x8363('0x61')](_0x356e1a);_0x1ebad8[_0x8363('0x18')](0x1f4)[_0x8363('0x2b')](_0x1807f6);});_0x58ef2e['on'](_0x8363('0x62'),function(_0x32f5dc){_0x4a4582[_0x8363('0x63')]=isNaN(_0x32f5dc[_0x8363('0x64')])?null:_0x32f5dc[_0x8363('0x64')]*0x3e8;_0x4a4582[_0x8363('0x65')]=isNaN(_0x32f5dc['sampleCount'])?null:_0x32f5dc[_0x8363('0x66')];_0x4a4582['original_channelCount']=isNaN(_0x32f5dc[_0x8363('0x67')])?null:_0x32f5dc[_0x8363('0x67')];_0x4a4582[_0x8363('0x68')]=isNaN(_0x32f5dc[_0x8363('0x69')])?null:_0x32f5dc['bitRate'];_0x4a4582[_0x8363('0x6a')]=isNaN(_0x32f5dc['sampleRate'])?null:_0x32f5dc[_0x8363('0x6b')];});_0x58ef2e['on'](_0x8363('0x6c'),function(_0x3ff9ca){_0x4a4582[_0x8363('0x6d')]=isNaN(_0x3ff9ca[_0x8363('0x64')])?null:_0x3ff9ca[_0x8363('0x64')]*0x3e8;_0x4a4582[_0x8363('0x6e')]=isNaN(_0x3ff9ca[_0x8363('0x66')])?null:_0x3ff9ca['sampleCount'];_0x4a4582[_0x8363('0x6f')]=isNaN(_0x3ff9ca[_0x8363('0x67')])?null:_0x3ff9ca[_0x8363('0x67')];_0x4a4582[_0x8363('0x70')]=isNaN(_0x3ff9ca[_0x8363('0x69')])?null:_0x3ff9ca[_0x8363('0x69')];_0x4a4582[_0x8363('0x71')]=isNaN(_0x3ff9ca['sampleRate'])?null:_0x3ff9ca[_0x8363('0x6b')];});_0x58ef2e['on'](_0x8363('0x19'),function(){fs[_0x8363('0x5e')](_0x5afba3,parseInt(_0x8363('0x5f'),0x8));return db['Sound']['create'](_0x4a4582)['then'](function(_0x365bbc){var _0x163b46={'role':_0x42b1db[_0x8363('0x72')][_0x8363('0x73')],'userProfileId':_0x42b1db[_0x8363('0x72')][_0x8363('0x74')]};if(!_0x163b46)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x163b46[_0x8363('0x73')]===_0x8363('0x75')){var _0x101dbe=_0x365bbc[_0x8363('0x76')]({'plain':!![]});return db[_0x8363('0x77')][_0x8363('0x47')]({'where':{'name':'Sounds','userProfileId':_0x163b46[_0x8363('0x74')]},'raw':!![]})[_0x8363('0x24')](function(_0x389d0e){if(_0x389d0e&&_0x389d0e[_0x8363('0x78')]===0x0){return db[_0x8363('0x27')][_0x8363('0x52')]({'name':_0x101dbe[_0x8363('0x2a')],'resourceId':_0x101dbe['id'],'type':_0x389d0e[_0x8363('0x2a')],'sectionId':_0x389d0e['id']},{})['then'](function(){return _0x365bbc;});}else{return _0x365bbc;}})[_0x8363('0x51')](function(_0x5e98b3){logger[_0x8363('0x28')](_0x8363('0x79'),_0x5e98b3);throw _0x5e98b3;});}return _0x365bbc;})[_0x8363('0x24')](respondWithResult(_0x1ebad8,null))[_0x8363('0x51')](handleError(_0x1ebad8,null));});_0x58ef2e[_0x8363('0x7a')]();}catch(_0x320ff0){_0x1ebad8[_0x8363('0x18')](0x1f4)[_0x8363('0x2b')](_0x320ff0);}};exports[_0x8363('0x23')]=function(_0x18c090,_0x26c528,_0x1a8099){return db[_0x8363('0x41')][_0x8363('0x47')]({'where':{'id':_0x18c090['params']['id']}})[_0x8363('0x24')](handleEntityNotFound(_0x26c528,null))[_0x8363('0x24')](saveUpdates(_['pick'](_0x18c090[_0x8363('0x72')],[_0x8363('0x2a'),_0x8363('0x7b')]),null))[_0x8363('0x24')](respondWithResult(_0x26c528,null))[_0x8363('0x51')](handleError(_0x26c528,null));};exports[_0x8363('0x7c')]=function(_0x4cfcf5,_0x28bd9e,_0xb10f36){return db[_0x8363('0x41')][_0x8363('0x47')]({'where':{'id':_0x4cfcf5['params']['id']}})[_0x8363('0x24')](function(_0x2ef831){if(_0x2ef831){return _0x2ef831[_0x8363('0x25')]();}})['then'](function(_0xc38156){var _0x4c619b=path[_0x8363('0x49')](config[_0x8363('0x59')],_0x8363('0x5a'),util[_0x8363('0x4e')]('%s.%s',_0xc38156[_0x8363('0x50')],_0xc38156['original_format']));var _0x47ff64=path['join'](config[_0x8363('0x59')],'server/files/sounds/converted',util[_0x8363('0x4e')](_0x8363('0x4f'),_0xc38156['save_name'],_0xc38156[_0x8363('0x48')]));fs[_0x8363('0x61')](_0x4c619b);fs[_0x8363('0x61')](_0x47ff64);return _0xc38156;})[_0x8363('0x24')](function(_0x37d96a){if(_0x37d96a){return _0x28bd9e['status'](0xcc)['end']();}})[_0x8363('0x24')](handleEntityNotFound(_0x28bd9e,null))[_0x8363('0x51')](handleError(_0x28bd9e,null));}; \ No newline at end of file +var _0x39ef=['converted_bitRate','converted_sampleRate','body','userProfileId','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','bluebird','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','name','map','Sound','rawAttributes','type','key','model','keys','filters','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','chmodSync','0777','unlinkSync','send','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount'];(function(_0x3ad338,_0x4ee52b){var _0x2576e2=function(_0xe96331){while(--_0xe96331){_0x3ad338['push'](_0x3ad338['shift']());}};_0x2576e2(++_0x4ee52b);}(_0x39ef,0x1c3));var _0xf39e=function(_0x1fa68b,_0x152e4e){_0x1fa68b=_0x1fa68b-0x0;var _0x32a3c6=_0x39ef[_0x1fa68b];return _0x32a3c6;};'use strict';var emlformat=require(_0xf39e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf39e('0x1'));var Mustache=require('mustache');var util=require(_0xf39e('0x2'));var path=require(_0xf39e('0x3'));var sox=require(_0xf39e('0x4'));var csv=require('to-csv');var ejs=require(_0xf39e('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf39e('0x6'));var crypto=require(_0xf39e('0x7'));var jsforce=require(_0xf39e('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf39e('0x9'));var Papa=require(_0xf39e('0xa'));var Redis=require(_0xf39e('0xb'));var authService=require(_0xf39e('0xc'));var qs=require(_0xf39e('0xd'));var as=require(_0xf39e('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf39e('0xf'))('api');var utils=require(_0xf39e('0x10'));var config=require(_0xf39e('0x11'));var licenseUtil=require(_0xf39e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7cfd27,_0x5cff72){_0x5cff72=_0x5cff72||0xcc;return function(_0x25a7cf){if(_0x25a7cf){return _0x7cfd27[_0xf39e('0x13')](_0x5cff72);}return _0x7cfd27[_0xf39e('0x14')](_0x5cff72)[_0xf39e('0x15')]();};}function respondWithResult(_0x460c48,_0x4700f2){_0x4700f2=_0x4700f2||0xc8;return function(_0x510e6d){if(_0x510e6d){return _0x460c48['status'](_0x4700f2)[_0xf39e('0x16')](_0x510e6d);}};}function respondWithFilteredResult(_0x57f8c1,_0x22a69b){return function(_0x20e7d4){if(_0x20e7d4){var _0x4829ac=typeof _0x22a69b[_0xf39e('0x17')]===_0xf39e('0x18')&&typeof _0x22a69b[_0xf39e('0x19')]===_0xf39e('0x18');var _0x4934ac=_0x20e7d4[_0xf39e('0x1a')];var _0x333a84=_0x4829ac?0x0:_0x22a69b['offset'];var _0x4daf61=_0x4829ac?_0x20e7d4[_0xf39e('0x1a')]:_0x22a69b['offset']+_0x22a69b['limit'];var _0x3cdf02;if(_0x4daf61>=_0x4934ac){_0x4daf61=_0x4934ac;_0x3cdf02=0xc8;}else{_0x3cdf02=0xce;}_0x57f8c1['status'](_0x3cdf02);return _0x57f8c1['set']('Content-Range',_0x333a84+'-'+_0x4daf61+'/'+_0x4934ac)['json'](_0x20e7d4);}return null;};}function patchUpdates(_0x427f65){return function(_0x2211cd){try{jsonpatch['apply'](_0x2211cd,_0x427f65,!![]);}catch(_0x382253){return BPromise[_0xf39e('0x1b')](_0x382253);}return _0x2211cd[_0xf39e('0x1c')]();};}function saveUpdates(_0x3ab65e,_0x3a0dce){return function(_0x3188d8){if(_0x3188d8){return _0x3188d8[_0xf39e('0x1d')](_0x3ab65e)['then'](function(_0x2adcb5){return _0x2adcb5;});}return null;};}function removeEntity(_0x557a1e,_0x46e3fa){return function(_0x4f4e07){if(_0x4f4e07){return _0x4f4e07[_0xf39e('0x1e')]()[_0xf39e('0x1f')](function(){var _0x4292c8=_0x4f4e07[_0xf39e('0x20')]({'plain':!![]});var _0x4ee8e8=_0xf39e('0x21');return db[_0xf39e('0x22')][_0xf39e('0x1e')]({'where':{'type':_0x4ee8e8,'resourceId':_0x4292c8['id']}})['then'](function(){return _0x4f4e07;});})['then'](function(){_0x557a1e[_0xf39e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c6d63,_0x3d8cd0){return function(_0x165197){if(!_0x165197){_0x9c6d63[_0xf39e('0x13')](0x194);}return _0x165197;};}function handleError(_0x468439,_0xfd7801){_0xfd7801=_0xfd7801||0x1f4;return function(_0x3f5a80){logger[_0xf39e('0x23')](_0x3f5a80['stack']);if(_0x3f5a80['name']){delete _0x3f5a80[_0xf39e('0x24')];}_0x468439[_0xf39e('0x14')](_0xfd7801)['send'](_0x3f5a80);};}exports['index']=function(_0x1bcedf,_0x22cd00){var _0x4f6f3a={},_0x363320={},_0x3cdeb3={'count':0x0,'rows':[]};var _0x2c50a9=_[_0xf39e('0x25')](db[_0xf39e('0x26')][_0xf39e('0x27')],function(_0x2df2e8){return{'name':_0x2df2e8['fieldName'],'type':_0x2df2e8[_0xf39e('0x28')][_0xf39e('0x29')]};});_0x363320[_0xf39e('0x2a')]=_[_0xf39e('0x25')](_0x2c50a9,'name');_0x363320['query']=_[_0xf39e('0x2b')](_0x1bcedf['query']);_0x363320[_0xf39e('0x2c')]=_['intersection'](_0x363320[_0xf39e('0x2a')],_0x363320[_0xf39e('0x2d')]);_0x4f6f3a[_0xf39e('0x2e')]=_['intersection'](_0x363320[_0xf39e('0x2a')],qs[_0xf39e('0x2f')](_0x1bcedf[_0xf39e('0x2d')]['fields']));_0x4f6f3a['attributes']=_0x4f6f3a[_0xf39e('0x2e')][_0xf39e('0x30')]?_0x4f6f3a['attributes']:_0x363320[_0xf39e('0x2a')];if(!_0x1bcedf['query']['hasOwnProperty'](_0xf39e('0x31'))){_0x4f6f3a['limit']=qs['limit'](_0x1bcedf[_0xf39e('0x2d')][_0xf39e('0x19')]);_0x4f6f3a['offset']=qs[_0xf39e('0x17')](_0x1bcedf['query'][_0xf39e('0x17')]);}_0x4f6f3a['order']=qs['sort'](_0x1bcedf['query'][_0xf39e('0x32')]);_0x4f6f3a[_0xf39e('0x33')]=qs[_0xf39e('0x2c')](_[_0xf39e('0x34')](_0x1bcedf['query'],_0x363320[_0xf39e('0x2c')]),_0x2c50a9);if(_0x1bcedf[_0xf39e('0x2d')][_0xf39e('0x35')]){_0x4f6f3a[_0xf39e('0x33')]=_[_0xf39e('0x36')](_0x4f6f3a[_0xf39e('0x33')],{'$or':_[_0xf39e('0x25')](_0x2c50a9,function(_0x29f1c5){if(_0x29f1c5['type']!==_0xf39e('0x37')){var _0x3153f2={};_0x3153f2[_0x29f1c5[_0xf39e('0x24')]]={'$like':'%'+_0x1bcedf[_0xf39e('0x2d')][_0xf39e('0x35')]+'%'};return _0x3153f2;}})});}_0x4f6f3a=_[_0xf39e('0x36')]({},_0x4f6f3a,_0x1bcedf['options']);var _0x3a0c50={'where':_0x4f6f3a[_0xf39e('0x33')]};return db[_0xf39e('0x26')][_0xf39e('0x1a')](_0x3a0c50)[_0xf39e('0x1f')](function(_0x3c8068){_0x3cdeb3['count']=_0x3c8068;if(_0x1bcedf['query'][_0xf39e('0x38')]){_0x4f6f3a['include']=[{'all':!![]}];}return db[_0xf39e('0x26')][_0xf39e('0x39')](_0x4f6f3a);})[_0xf39e('0x1f')](function(_0x7dd856){_0x3cdeb3['rows']=_0x7dd856;return _0x3cdeb3;})[_0xf39e('0x1f')](respondWithFilteredResult(_0x22cd00,_0x4f6f3a))[_0xf39e('0x3a')](handleError(_0x22cd00,null));};exports[_0xf39e('0x3b')]=function(_0x117da2,_0x24f7ad){var _0x1ec825={'raw':!![],'where':{'id':_0x117da2[_0xf39e('0x3c')]['id']}},_0x526fe3={};_0x526fe3['model']=_[_0xf39e('0x2b')](db['Sound']['rawAttributes']);_0x526fe3[_0xf39e('0x2d')]=_[_0xf39e('0x2b')](_0x117da2[_0xf39e('0x2d')]);_0x526fe3[_0xf39e('0x2c')]=_['intersection'](_0x526fe3['model'],_0x526fe3[_0xf39e('0x2d')]);_0x1ec825[_0xf39e('0x2e')]=_['intersection'](_0x526fe3['model'],qs[_0xf39e('0x2f')](_0x117da2[_0xf39e('0x2d')][_0xf39e('0x2f')]));_0x1ec825[_0xf39e('0x2e')]=_0x1ec825[_0xf39e('0x2e')][_0xf39e('0x30')]?_0x1ec825[_0xf39e('0x2e')]:_0x526fe3[_0xf39e('0x2a')];if(_0x117da2[_0xf39e('0x2d')]['includeAll']){_0x1ec825[_0xf39e('0x3d')]=[{'all':!![]}];}_0x1ec825=_[_0xf39e('0x36')]({},_0x1ec825,_0x117da2[_0xf39e('0x3e')]);return db['Sound'][_0xf39e('0x3f')](_0x1ec825)['then'](handleEntityNotFound(_0x24f7ad,null))[_0xf39e('0x1f')](respondWithResult(_0x24f7ad,null))[_0xf39e('0x3a')](handleError(_0x24f7ad,null));};exports[_0xf39e('0x40')]=function(_0x53695e,_0x34d5e3,_0x7775cf){return db['Sound'][_0xf39e('0x3f')]({'where':{'id':_0x53695e['params']['id']},'attributes':[_0xf39e('0x24'),_0xf39e('0x41'),_0xf39e('0x42')],'raw':!![]})[_0xf39e('0x1f')](handleEntityNotFound(_0x34d5e3,null))[_0xf39e('0x1f')](function(_0x4be0f9){if(_0x4be0f9){if(!fs[_0xf39e('0x43')](path[_0xf39e('0x44')](config[_0xf39e('0x45')],_0xf39e('0x46'),_0x4be0f9[_0xf39e('0x41')]+'.'+_0x4be0f9['converted_format']))){throw new db['Sequelize']['ValidationError']('Sound\x20not\x20found');}return _0x34d5e3[_0xf39e('0x40')](path[_0xf39e('0x44')](config[_0xf39e('0x45')],_0xf39e('0x46'),util[_0xf39e('0x47')](_0xf39e('0x48'),_0x4be0f9[_0xf39e('0x41')],_0x4be0f9['converted_format'])),util[_0xf39e('0x47')](_0xf39e('0x48'),_0x4be0f9[_0xf39e('0x24')],_0x4be0f9[_0xf39e('0x42')]));}return null;})[_0xf39e('0x3a')](handleError(_0x34d5e3,null));};exports[_0xf39e('0x49')]=function(_0xaa709b,_0x20809a,_0x56c79e){var _0x5f065e={'name':path['basename'](_0xaa709b[_0xf39e('0x4a')][_0xf39e('0x4b')],path[_0xf39e('0x4c')](_0xaa709b[_0xf39e('0x4a')][_0xf39e('0x4b')])),'save_name':path[_0xf39e('0x4d')](_0xaa709b['file'][_0xf39e('0x4e')],path[_0xf39e('0x4c')](_0xaa709b[_0xf39e('0x4a')][_0xf39e('0x4e')])),'original_format':path[_0xf39e('0x4c')](_0xaa709b['file'][_0xf39e('0x4b')])[_0xf39e('0x4f')](0x1),'converted_format':_0xf39e('0x50')};var _0x2417e2=path[_0xf39e('0x44')](config[_0xf39e('0x45')],_0xf39e('0x51'),_0xaa709b[_0xf39e('0x4a')]['filename']);var _0x4bb22b=path[_0xf39e('0x44')](config[_0xf39e('0x45')],'server/files/sounds/converted',util[_0xf39e('0x47')](_0xf39e('0x48'),path[_0xf39e('0x4d')](_0xaa709b[_0xf39e('0x4a')][_0xf39e('0x4e')],path['extname'](_0xaa709b[_0xf39e('0x4a')][_0xf39e('0x4e')])),_0x5f065e[_0xf39e('0x42')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x2417e2);logger[_0xf39e('0x52')]('Sound\x20upload\x20destination:\x20%s',_0x4bb22b);try{fs[_0xf39e('0x53')](_0x2417e2,parseInt(_0xf39e('0x54'),0x8));var _0x4d57ac=sox['transcode'](_0x2417e2,_0x4bb22b,{'sampleRate':0x1f40,'format':_0xf39e('0x50'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d57ac['on'](_0xf39e('0x23'),function(_0x4a6e82){fs[_0xf39e('0x55')](_0x2417e2);_0x20809a[_0xf39e('0x14')](0x1f4)[_0xf39e('0x56')](_0x4a6e82);});_0x4d57ac['on'](_0xf39e('0x57'),function(_0x382cc6){_0x5f065e['original_duration']=isNaN(_0x382cc6[_0xf39e('0x58')])?null:_0x382cc6[_0xf39e('0x58')]*0x3e8;_0x5f065e[_0xf39e('0x59')]=isNaN(_0x382cc6[_0xf39e('0x5a')])?null:_0x382cc6[_0xf39e('0x5a')];_0x5f065e['original_channelCount']=isNaN(_0x382cc6[_0xf39e('0x5b')])?null:_0x382cc6[_0xf39e('0x5b')];_0x5f065e[_0xf39e('0x5c')]=isNaN(_0x382cc6[_0xf39e('0x5d')])?null:_0x382cc6[_0xf39e('0x5d')];_0x5f065e[_0xf39e('0x5e')]=isNaN(_0x382cc6[_0xf39e('0x5f')])?null:_0x382cc6['sampleRate'];});_0x4d57ac['on']('dest',function(_0x39b556){_0x5f065e[_0xf39e('0x60')]=isNaN(_0x39b556[_0xf39e('0x58')])?null:_0x39b556[_0xf39e('0x58')]*0x3e8;_0x5f065e[_0xf39e('0x61')]=isNaN(_0x39b556[_0xf39e('0x5a')])?null:_0x39b556[_0xf39e('0x5a')];_0x5f065e[_0xf39e('0x62')]=isNaN(_0x39b556[_0xf39e('0x5b')])?null:_0x39b556[_0xf39e('0x5b')];_0x5f065e[_0xf39e('0x63')]=isNaN(_0x39b556[_0xf39e('0x5d')])?null:_0x39b556[_0xf39e('0x5d')];_0x5f065e[_0xf39e('0x64')]=isNaN(_0x39b556['sampleRate'])?null:_0x39b556[_0xf39e('0x5f')];});_0x4d57ac['on'](_0xf39e('0x15'),function(){fs[_0xf39e('0x53')](_0x4bb22b,parseInt(_0xf39e('0x54'),0x8));return db[_0xf39e('0x26')][_0xf39e('0x49')](_0x5f065e)[_0xf39e('0x1f')](function(_0x154467){var _0x4c1abb={'role':_0xaa709b['body']['role'],'userProfileId':_0xaa709b[_0xf39e('0x65')][_0xf39e('0x66')]};if(!_0x4c1abb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1abb[_0xf39e('0x67')]===_0xf39e('0x68')){var _0x3758b0=_0x154467[_0xf39e('0x20')]({'plain':!![]});return db['UserProfileSection'][_0xf39e('0x3f')]({'where':{'name':_0xf39e('0x21'),'userProfileId':_0x4c1abb['userProfileId']},'raw':!![]})[_0xf39e('0x1f')](function(_0x5b62b2){if(_0x5b62b2&&_0x5b62b2[_0xf39e('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x3758b0[_0xf39e('0x24')],'resourceId':_0x3758b0['id'],'type':_0x5b62b2[_0xf39e('0x24')],'sectionId':_0x5b62b2['id']},{})[_0xf39e('0x1f')](function(){return _0x154467;});}else{return _0x154467;}})[_0xf39e('0x3a')](function(_0x3dbef0){logger[_0xf39e('0x23')](_0xf39e('0x6a'),_0x3dbef0);throw _0x3dbef0;});}return _0x154467;})['then'](respondWithResult(_0x20809a,null))[_0xf39e('0x3a')](handleError(_0x20809a,null));});_0x4d57ac[_0xf39e('0x6b')]();}catch(_0x1d77f2){_0x20809a['status'](0x1f4)['send'](_0x1d77f2);}};exports[_0xf39e('0x1d')]=function(_0x1df02c,_0x50f6e0,_0x3c2349){return db[_0xf39e('0x26')][_0xf39e('0x3f')]({'where':{'id':_0x1df02c[_0xf39e('0x3c')]['id']}})[_0xf39e('0x1f')](handleEntityNotFound(_0x50f6e0,null))['then'](saveUpdates(_[_0xf39e('0x34')](_0x1df02c[_0xf39e('0x65')],[_0xf39e('0x24'),'description']),null))[_0xf39e('0x1f')](respondWithResult(_0x50f6e0,null))[_0xf39e('0x3a')](handleError(_0x50f6e0,null));};exports[_0xf39e('0x6c')]=function(_0x14fc7e,_0x2d00a1,_0x2bd413){return db['Sound'][_0xf39e('0x3f')]({'where':{'id':_0x14fc7e[_0xf39e('0x3c')]['id']}})[_0xf39e('0x1f')](function(_0x41d6db){if(_0x41d6db){return _0x41d6db[_0xf39e('0x1e')]();}})[_0xf39e('0x1f')](function(_0x169b4f){var _0x42a3fb=path[_0xf39e('0x44')](config[_0xf39e('0x45')],_0xf39e('0x51'),util[_0xf39e('0x47')](_0xf39e('0x48'),_0x169b4f[_0xf39e('0x41')],_0x169b4f[_0xf39e('0x6d')]));var _0x10f3e8=path[_0xf39e('0x44')](config['root'],_0xf39e('0x46'),util['format'](_0xf39e('0x48'),_0x169b4f['save_name'],_0x169b4f[_0xf39e('0x42')]));fs[_0xf39e('0x55')](_0x42a3fb);fs[_0xf39e('0x55')](_0x10f3e8);return _0x169b4f;})[_0xf39e('0x1f')](function(_0x3c5eb9){if(_0x3c5eb9){return _0x2d00a1[_0xf39e('0x14')](0xcc)[_0xf39e('0x15')]();}})['then'](handleEntityNotFound(_0x2d00a1,null))[_0xf39e('0x3a')](handleError(_0x2d00a1,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 1044459..c76d575 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 _0x209c=['bluebird','request-promise','path','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','moment'];(function(_0x455306,_0x155415){var _0x120daf=function(_0x4b56c8){while(--_0x4b56c8){_0x455306['push'](_0x455306['shift']());}};_0x120daf(++_0x155415);}(_0x209c,0xf3));var _0xc209=function(_0xd8676a,_0x2baed0){_0xd8676a=_0xd8676a-0x0;var _0x53f5fe=_0x209c[_0xd8676a];return _0x53f5fe;};'use strict';var _=require(_0xc209('0x0'));var util=require(_0xc209('0x1'));var logger=require(_0xc209('0x2'))('api');var moment=require(_0xc209('0x3'));var BPromise=require(_0xc209('0x4'));var rp=require(_0xc209('0x5'));var fs=require('fs');var path=require(_0xc209('0x6'));var rimraf=require('rimraf');var config=require(_0xc209('0x7'));var attributes=require(_0xc209('0x8'));module[_0xc209('0x9')]=function(_0x451eb6,_0x14c3dd){return _0x451eb6[_0xc209('0xa')](_0xc209('0xb'),attributes,{'tableName':_0xc209('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cd0=['rimraf','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','lodash','../../config/logger','moment','bluebird','path'];(function(_0x3a52e1,_0x1dfbbe){var _0xe4f484=function(_0x4bcb8e){while(--_0x4bcb8e){_0x3a52e1['push'](_0x3a52e1['shift']());}};_0xe4f484(++_0x1dfbbe);}(_0x7cd0,0x192));var _0x07cd=function(_0x237587,_0x3922b7){_0x237587=_0x237587-0x0;var _0x485bd9=_0x7cd0[_0x237587];return _0x485bd9;};'use strict';var _=require(_0x07cd('0x0'));var util=require('util');var logger=require(_0x07cd('0x1'))('api');var moment=require(_0x07cd('0x2'));var BPromise=require(_0x07cd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07cd('0x4'));var rimraf=require(_0x07cd('0x5'));var config=require(_0x07cd('0x6'));var attributes=require(_0x07cd('0x7'));module[_0x07cd('0x8')]=function(_0x419b71,_0x490605){return _0x419b71['define'](_0x07cd('0x9'),attributes,{'tableName':_0x07cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 3368ac5..19c465c 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 _0x718b=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','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','error','code','message','result','catch','ShowSound','find','options','raw','attributes','include','model','map','stringify','lodash','util','moment'];(function(_0x617baa,_0x3bef5b){var _0x46266a=function(_0x25c51c){while(--_0x25c51c){_0x617baa['push'](_0x617baa['shift']());}};_0x46266a(++_0x3bef5b);}(_0x718b,0x1b7));var _0xb718=function(_0x1a9b94,_0x4d763e){_0x1a9b94=_0x1a9b94-0x0;var _0x379102=_0x718b[_0x1a9b94];return _0x379102;};'use strict';var _=require(_0xb718('0x0'));var util=require(_0xb718('0x1'));var moment=require(_0xb718('0x2'));var BPromise=require(_0xb718('0x3'));var rs=require(_0xb718('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb718('0x5'))['db'];var utils=require(_0xb718('0x6'));var logger=require(_0xb718('0x7'))(_0xb718('0x8'));var config=require(_0xb718('0x9'));var jayson=require(_0xb718('0xa'));var client=jayson[_0xb718('0xb')][_0xb718('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x872182,_0x18747c,_0x1eefaa){return new BPromise(function(_0x1ca738,_0x49e5af){return client[_0xb718('0xd')](_0x872182,_0x1eefaa)[_0xb718('0xe')](function(_0xf99cb1){logger[_0xb718('0xf')](_0xb718('0x10'),_0x18747c,'request\x20sent');logger[_0xb718('0x11')](_0xb718('0x12'),_0x18747c,_0xb718('0x13'),JSON['stringify'](_0xf99cb1));if(_0xf99cb1[_0xb718('0x14')]){if(_0xf99cb1['error'][_0xb718('0x15')]===0x1f4){logger[_0xb718('0x14')](_0xb718('0x10'),_0x18747c,_0xf99cb1[_0xb718('0x14')][_0xb718('0x16')]);return _0x49e5af(_0xf99cb1[_0xb718('0x14')]['message']);}logger[_0xb718('0x14')](_0xb718('0x10'),_0x18747c,_0xf99cb1['error'][_0xb718('0x16')]);return _0x1ca738(_0xf99cb1[_0xb718('0x14')][_0xb718('0x16')]);}else{logger[_0xb718('0xf')](_0xb718('0x10'),_0x18747c,_0xb718('0x13'));_0x1ca738(_0xf99cb1[_0xb718('0x17')][_0xb718('0x16')]);}})[_0xb718('0x18')](function(_0x2bd52c){logger[_0xb718('0x14')](_0xb718('0x10'),_0x18747c,_0x2bd52c);_0x49e5af(_0x2bd52c);});});}exports[_0xb718('0x19')]=function(_0xed5d8b){var _0x4e4d4f=this;return new Promise(function(_0x32cb5f,_0x5decf9){return db['Sound'][_0xb718('0x1a')]({'raw':_0xed5d8b[_0xb718('0x1b')]?_0xed5d8b[_0xb718('0x1b')][_0xb718('0x1c')]===undefined?!![]:![]:!![],'where':_0xed5d8b[_0xb718('0x1b')]?_0xed5d8b['options']['where']||null:null,'attributes':_0xed5d8b[_0xb718('0x1b')]?_0xed5d8b[_0xb718('0x1b')][_0xb718('0x1d')]||null:null,'include':_0xed5d8b[_0xb718('0x1b')]?_0xed5d8b[_0xb718('0x1b')][_0xb718('0x1e')]?_['map'](_0xed5d8b[_0xb718('0x1b')][_0xb718('0x1e')],function(_0x4a8275){return{'model':db[_0x4a8275[_0xb718('0x1f')]],'as':_0x4a8275['as'],'attributes':_0x4a8275[_0xb718('0x1d')],'include':_0x4a8275['include']?_[_0xb718('0x20')](_0x4a8275[_0xb718('0x1e')],function(_0x18a1a2){return{'model':db[_0x18a1a2[_0xb718('0x1f')]],'as':_0x18a1a2['as'],'attributes':_0x18a1a2[_0xb718('0x1d')],'include':_0x18a1a2['include']?_[_0xb718('0x20')](_0x18a1a2[_0xb718('0x1e')],function(_0x52fcfe){return{'model':db[_0x52fcfe[_0xb718('0x1f')]],'as':_0x52fcfe['as'],'attributes':_0x52fcfe['attributes']};}):[]};}):[]};}):[]:[]})[_0xb718('0xe')](function(_0x470744){logger[_0xb718('0xf')]('ShowSound',_0xed5d8b);logger[_0xb718('0x11')](_0xb718('0x19'),_0xed5d8b,JSON[_0xb718('0x21')](_0x470744));_0x32cb5f(_0x470744);})[_0xb718('0x18')](function(_0x1e5f26){logger[_0xb718('0x14')](_0xb718('0x19'),_0x1e5f26[_0xb718('0x16')],_0xed5d8b);_0x5decf9(_0x4e4d4f['error'](0x1f4,_0x1e5f26[_0xb718('0x16')]));});});}; \ No newline at end of file +var _0xa231=['debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSound','Sound','find','options','raw','where','attributes','map','model','include','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','Sound,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa231,0x101));var _0x1a23=function(_0x1058d1,_0x122d13){_0x1058d1=_0x1058d1-0x0;var _0x3078cf=_0xa231[_0x1058d1];return _0x3078cf;};'use strict';var _=require(_0x1a23('0x0'));var util=require('util');var moment=require(_0x1a23('0x1'));var BPromise=require(_0x1a23('0x2'));var rs=require(_0x1a23('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a23('0x4'))['db'];var utils=require(_0x1a23('0x5'));var logger=require(_0x1a23('0x6'))('rpc');var config=require(_0x1a23('0x7'));var jayson=require(_0x1a23('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2eaa1c,_0x1094cd,_0x6044f1){return new BPromise(function(_0x69af9,_0x119457){return client['request'](_0x2eaa1c,_0x6044f1)[_0x1a23('0x9')](function(_0x51c25f){logger[_0x1a23('0xa')](_0x1a23('0xb'),_0x1094cd,_0x1a23('0xc'));logger[_0x1a23('0xd')](_0x1a23('0xe'),_0x1094cd,'request\x20sent',JSON['stringify'](_0x51c25f));if(_0x51c25f[_0x1a23('0xf')]){if(_0x51c25f[_0x1a23('0xf')][_0x1a23('0x10')]===0x1f4){logger[_0x1a23('0xf')](_0x1a23('0xb'),_0x1094cd,_0x51c25f[_0x1a23('0xf')]['message']);return _0x119457(_0x51c25f[_0x1a23('0xf')][_0x1a23('0x11')]);}logger[_0x1a23('0xf')](_0x1a23('0xb'),_0x1094cd,_0x51c25f['error'][_0x1a23('0x11')]);return _0x69af9(_0x51c25f['error'][_0x1a23('0x11')]);}else{logger[_0x1a23('0xa')](_0x1a23('0xb'),_0x1094cd,'request\x20sent');_0x69af9(_0x51c25f['result'][_0x1a23('0x11')]);}})[_0x1a23('0x12')](function(_0xd11ff6){logger[_0x1a23('0xf')](_0x1a23('0xb'),_0x1094cd,_0xd11ff6);_0x119457(_0xd11ff6);});});}exports[_0x1a23('0x13')]=function(_0x25fb84){var _0x59cb3b=this;return new Promise(function(_0x32d748,_0x3af98d){return db[_0x1a23('0x14')][_0x1a23('0x15')]({'raw':_0x25fb84[_0x1a23('0x16')]?_0x25fb84['options'][_0x1a23('0x17')]===undefined?!![]:![]:!![],'where':_0x25fb84[_0x1a23('0x16')]?_0x25fb84[_0x1a23('0x16')][_0x1a23('0x18')]||null:null,'attributes':_0x25fb84[_0x1a23('0x16')]?_0x25fb84['options'][_0x1a23('0x19')]||null:null,'include':_0x25fb84['options']?_0x25fb84[_0x1a23('0x16')]['include']?_[_0x1a23('0x1a')](_0x25fb84[_0x1a23('0x16')]['include'],function(_0x144256){return{'model':db[_0x144256[_0x1a23('0x1b')]],'as':_0x144256['as'],'attributes':_0x144256[_0x1a23('0x19')],'include':_0x144256[_0x1a23('0x1c')]?_['map'](_0x144256[_0x1a23('0x1c')],function(_0x3654ec){return{'model':db[_0x3654ec[_0x1a23('0x1b')]],'as':_0x3654ec['as'],'attributes':_0x3654ec[_0x1a23('0x19')],'include':_0x3654ec['include']?_['map'](_0x3654ec[_0x1a23('0x1c')],function(_0x38e6fc){return{'model':db[_0x38e6fc[_0x1a23('0x1b')]],'as':_0x38e6fc['as'],'attributes':_0x38e6fc[_0x1a23('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1a23('0x9')](function(_0x4cb08b){logger[_0x1a23('0xa')]('ShowSound',_0x25fb84);logger[_0x1a23('0xd')]('ShowSound',_0x25fb84,JSON[_0x1a23('0x1d')](_0x4cb08b));_0x32d748(_0x4cb08b);})['catch'](function(_0x1f95ef){logger[_0x1a23('0xf')](_0x1a23('0x13'),_0x1f95ef[_0x1a23('0x11')],_0x25fb84);_0x3af98d(_0x59cb3b[_0x1a23('0xf')](0x1f4,_0x1f95ef[_0x1a23('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ec136f5..2819376 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x4fc2,0x111));var _0x24fc=function(_0x1c7b33,_0x381cc5){_0x1c7b33=_0x1c7b33-0x0;var _0x154be0=_0x4fc2[_0x1c7b33];return _0x154be0;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3f8b5a,_0x550ae5){var _0x46f642=function(_0x58ce1f){while(--_0x58ce1f){_0x3f8b5a['push'](_0x3f8b5a['shift']());}};_0x46f642(++_0x550ae5);}(_0xb10b,0x12a));var _0xbb10=function(_0x3afb47,_0x54bee0){_0x3afb47=_0x3afb47-0x0;var _0xe566d2=_0xb10b[_0x3afb47];return _0xe566d2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 4ce395b..5ff6321 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 _0x4499=['exports','STRING','medium','ENUM','out'];(function(_0x3ee03a,_0x257ef1){var _0x41475b=function(_0x98abc6){while(--_0x98abc6){_0x3ee03a['push'](_0x3ee03a['shift']());}};_0x41475b(++_0x257ef1);}(_0x4499,0x122));var _0x9449=function(_0x36ef57,_0x36156e){_0x36ef57=_0x36ef57-0x0;var _0x69397f=_0x4499[_0x36ef57];return _0x69397f;};'use strict';var Sequelize=require('sequelize');module[_0x9449('0x0')]={'uniqueid':{'type':Sequelize[_0x9449('0x1')]},'body':{'type':Sequelize['TEXT'](_0x9449('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x9449('0x3')]('in',_0x9449('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x95b7=['sequelize','STRING','TEXT','medium','ENUM','out'];(function(_0x328b9b,_0x13082a){var _0x3a2d51=function(_0x63002b){while(--_0x63002b){_0x328b9b['push'](_0x328b9b['shift']());}};_0x3a2d51(++_0x13082a);}(_0x95b7,0x1e6));var _0x795b=function(_0x3869c8,_0x2ff137){_0x3869c8=_0x3869c8-0x0;var _0x4caf60=_0x95b7[_0x3869c8];return _0x4caf60;};'use strict';var Sequelize=require(_0x795b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x795b('0x1')]},'body':{'type':Sequelize[_0x795b('0x2')](_0x795b('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x795b('0x4')]('in',_0x795b('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x795b('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 76611fd..f46e754 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 _0x8683=['key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','show','keys','rawAttributes','options','catch','body','find','params','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','name','send','index','map','SquareMessage','fieldName','type'];(function(_0x46611c,_0x31a4b5){var _0x39fa3f=function(_0x15e609){while(--_0x15e609){_0x46611c['push'](_0x46611c['shift']());}};_0x39fa3f(++_0x31a4b5);}(_0x8683,0xec));var _0x3868=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x8683[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3868('0x0'));var zipdir=require(_0x3868('0x1'));var jsonpatch=require(_0x3868('0x2'));var rp=require('request-promise');var moment=require(_0x3868('0x3'));var BPromise=require(_0x3868('0x4'));var Mustache=require('mustache');var util=require(_0x3868('0x5'));var path=require(_0x3868('0x6'));var sox=require(_0x3868('0x7'));var csv=require('to-csv');var ejs=require(_0x3868('0x8'));var fs=require('fs');var fs_extra=require(_0x3868('0x9'));var _=require(_0x3868('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3868('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3868('0xc'));var Papa=require(_0x3868('0xd'));var Redis=require(_0x3868('0xe'));var authService=require(_0x3868('0xf'));var qs=require(_0x3868('0x10'));var as=require(_0x3868('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3868('0x12'))(_0x3868('0x13'));var utils=require(_0x3868('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3868('0x15'));var db=require(_0x3868('0x16'))['db'];function respondWithStatusCode(_0x2f018f,_0x5b9ec0){_0x5b9ec0=_0x5b9ec0||0xcc;return function(_0x17929f){if(_0x17929f){return _0x2f018f[_0x3868('0x17')](_0x5b9ec0);}return _0x2f018f[_0x3868('0x18')](_0x5b9ec0)[_0x3868('0x19')]();};}function respondWithResult(_0x211c95,_0x29c965){_0x29c965=_0x29c965||0xc8;return function(_0x177285){if(_0x177285){return _0x211c95['status'](_0x29c965)[_0x3868('0x1a')](_0x177285);}};}function respondWithFilteredResult(_0x3593d1,_0x3b0a6f){return function(_0x5ef53e){if(_0x5ef53e){var _0x50975c=typeof _0x3b0a6f[_0x3868('0x1b')]===_0x3868('0x1c')&&typeof _0x3b0a6f[_0x3868('0x1d')]===_0x3868('0x1c');var _0x589246=_0x5ef53e[_0x3868('0x1e')];var _0xdc5cde=_0x50975c?0x0:_0x3b0a6f['offset'];var _0x151303=_0x50975c?_0x5ef53e[_0x3868('0x1e')]:_0x3b0a6f[_0x3868('0x1b')]+_0x3b0a6f[_0x3868('0x1d')];var _0x59fb82;if(_0x151303>=_0x589246){_0x151303=_0x589246;_0x59fb82=0xc8;}else{_0x59fb82=0xce;}_0x3593d1[_0x3868('0x18')](_0x59fb82);return _0x3593d1[_0x3868('0x1f')]('Content-Range',_0xdc5cde+'-'+_0x151303+'/'+_0x589246)[_0x3868('0x1a')](_0x5ef53e);}return null;};}function patchUpdates(_0x115f1d){return function(_0xedc44b){try{jsonpatch[_0x3868('0x20')](_0xedc44b,_0x115f1d,!![]);}catch(_0xc752ec){return BPromise[_0x3868('0x21')](_0xc752ec);}return _0xedc44b['save']();};}function saveUpdates(_0x2e629b,_0x22f5a3){return function(_0x2d7545){if(_0x2d7545){return _0x2d7545[_0x3868('0x22')](_0x2e629b)[_0x3868('0x23')](function(_0x13970c){return _0x13970c;});}return null;};}function removeEntity(_0x12d8f8,_0xa3d953){return function(_0x479e94){if(_0x479e94){return _0x479e94['destroy']()[_0x3868('0x23')](function(){_0x12d8f8[_0x3868('0x18')](0xcc)[_0x3868('0x19')]();});}};}function handleEntityNotFound(_0x4a817b,_0x50ffed){return function(_0x59acfe){if(!_0x59acfe){_0x4a817b[_0x3868('0x17')](0x194);}return _0x59acfe;};}function handleError(_0x81dcd3,_0x46dd05){_0x46dd05=_0x46dd05||0x1f4;return function(_0x3bf16b){logger[_0x3868('0x24')](_0x3bf16b['stack']);if(_0x3bf16b[_0x3868('0x25')]){delete _0x3bf16b['name'];}_0x81dcd3['status'](_0x46dd05)[_0x3868('0x26')](_0x3bf16b);};}exports[_0x3868('0x27')]=function(_0x21fbd9,_0x2750c4){var _0x10495a={},_0x2b00c4={},_0x489f57={'count':0x0,'rows':[]};var _0x33b42d=_[_0x3868('0x28')](db[_0x3868('0x29')]['rawAttributes'],function(_0x17bb4e){return{'name':_0x17bb4e[_0x3868('0x2a')],'type':_0x17bb4e[_0x3868('0x2b')][_0x3868('0x2c')]};});_0x2b00c4[_0x3868('0x2d')]=_[_0x3868('0x28')](_0x33b42d,_0x3868('0x25'));_0x2b00c4[_0x3868('0x2e')]=_['keys'](_0x21fbd9[_0x3868('0x2e')]);_0x2b00c4[_0x3868('0x2f')]=_[_0x3868('0x30')](_0x2b00c4[_0x3868('0x2d')],_0x2b00c4[_0x3868('0x2e')]);_0x10495a[_0x3868('0x31')]=_[_0x3868('0x30')](_0x2b00c4['model'],qs[_0x3868('0x32')](_0x21fbd9[_0x3868('0x2e')][_0x3868('0x32')]));_0x10495a[_0x3868('0x31')]=_0x10495a[_0x3868('0x31')][_0x3868('0x33')]?_0x10495a['attributes']:_0x2b00c4[_0x3868('0x2d')];if(!_0x21fbd9[_0x3868('0x2e')]['hasOwnProperty']('nolimit')){_0x10495a[_0x3868('0x1d')]=qs[_0x3868('0x1d')](_0x21fbd9[_0x3868('0x2e')][_0x3868('0x1d')]);_0x10495a[_0x3868('0x1b')]=qs[_0x3868('0x1b')](_0x21fbd9['query'][_0x3868('0x1b')]);}_0x10495a[_0x3868('0x34')]=qs[_0x3868('0x35')](_0x21fbd9['query']['sort']);_0x10495a[_0x3868('0x36')]=qs[_0x3868('0x2f')](_['pick'](_0x21fbd9['query'],_0x2b00c4['filters']),_0x33b42d);if(_0x21fbd9[_0x3868('0x2e')][_0x3868('0x37')]){_0x10495a[_0x3868('0x36')]=_[_0x3868('0x38')](_0x10495a[_0x3868('0x36')],{'$or':_[_0x3868('0x28')](_0x33b42d,function(_0xf2883d){if(_0xf2883d['type']!==_0x3868('0x39')){var _0x171a2d={};_0x171a2d[_0xf2883d[_0x3868('0x25')]]={'$like':'%'+_0x21fbd9[_0x3868('0x2e')][_0x3868('0x37')]+'%'};return _0x171a2d;}})});}_0x10495a=_['merge']({},_0x10495a,_0x21fbd9['options']);var _0x5e8b0a={'where':_0x10495a[_0x3868('0x36')]};return db['SquareMessage'][_0x3868('0x1e')](_0x5e8b0a)[_0x3868('0x23')](function(_0x3438ac){_0x489f57[_0x3868('0x1e')]=_0x3438ac;if(_0x21fbd9['query']['includeAll']){_0x10495a[_0x3868('0x3a')]=[{'all':!![]}];}return db[_0x3868('0x29')][_0x3868('0x3b')](_0x10495a);})[_0x3868('0x23')](function(_0x50fd6d){_0x489f57[_0x3868('0x3c')]=_0x50fd6d;return _0x489f57;})['then'](respondWithFilteredResult(_0x2750c4,_0x10495a))['catch'](handleError(_0x2750c4,null));};exports[_0x3868('0x3d')]=function(_0x27e23a,_0x40e1e0){var _0x2ede8d={'raw':!![],'where':{'id':_0x27e23a['params']['id']}},_0x37237c={};_0x37237c[_0x3868('0x2d')]=_[_0x3868('0x3e')](db[_0x3868('0x29')][_0x3868('0x3f')]);_0x37237c[_0x3868('0x2e')]=_[_0x3868('0x3e')](_0x27e23a[_0x3868('0x2e')]);_0x37237c[_0x3868('0x2f')]=_['intersection'](_0x37237c['model'],_0x37237c[_0x3868('0x2e')]);_0x2ede8d['attributes']=_[_0x3868('0x30')](_0x37237c[_0x3868('0x2d')],qs[_0x3868('0x32')](_0x27e23a[_0x3868('0x2e')][_0x3868('0x32')]));_0x2ede8d['attributes']=_0x2ede8d[_0x3868('0x31')][_0x3868('0x33')]?_0x2ede8d[_0x3868('0x31')]:_0x37237c[_0x3868('0x2d')];if(_0x27e23a[_0x3868('0x2e')]['includeAll']){_0x2ede8d[_0x3868('0x3a')]=[{'all':!![]}];}_0x2ede8d=_[_0x3868('0x38')]({},_0x2ede8d,_0x27e23a[_0x3868('0x40')]);return db[_0x3868('0x29')]['find'](_0x2ede8d)[_0x3868('0x23')](handleEntityNotFound(_0x40e1e0,null))[_0x3868('0x23')](respondWithResult(_0x40e1e0,null))[_0x3868('0x41')](handleError(_0x40e1e0,null));};exports['create']=function(_0x55f2e5,_0x5b9322){return db[_0x3868('0x29')]['create'](_0x55f2e5['body'],{})[_0x3868('0x23')](respondWithResult(_0x5b9322,0xc9))[_0x3868('0x41')](handleError(_0x5b9322,null));};exports[_0x3868('0x22')]=function(_0xbd1d7,_0x42adf4){if(_0xbd1d7[_0x3868('0x42')]['id']){delete _0xbd1d7[_0x3868('0x42')]['id'];}return db[_0x3868('0x29')][_0x3868('0x43')]({'where':{'id':_0xbd1d7[_0x3868('0x44')]['id']}})['then'](handleEntityNotFound(_0x42adf4,null))['then'](saveUpdates(_0xbd1d7[_0x3868('0x42')],null))[_0x3868('0x23')](respondWithResult(_0x42adf4,null))[_0x3868('0x41')](handleError(_0x42adf4,null));};exports[_0x3868('0x45')]=function(_0x3dfcd0,_0x21ed7b){return db['SquareMessage'][_0x3868('0x43')]({'where':{'id':_0x3dfcd0[_0x3868('0x44')]['id']}})[_0x3868('0x23')](handleEntityNotFound(_0x21ed7b,null))[_0x3868('0x23')](removeEntity(_0x21ed7b,null))[_0x3868('0x41')](handleError(_0x21ed7b,null));}; \ No newline at end of file +var _0x437b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x412ebb,_0x33f125){var _0x3580f9=function(_0x3ae08f){while(--_0x3ae08f){_0x412ebb['push'](_0x412ebb['shift']());}};_0x3580f9(++_0x33f125);}(_0x437b,0x1a8));var _0xb437=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x437b[_0x4450b1];return _0x399b0b;};'use strict';var emlformat=require(_0xb437('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb437('0x1'));var rp=require('request-promise');var moment=require(_0xb437('0x2'));var BPromise=require(_0xb437('0x3'));var Mustache=require(_0xb437('0x4'));var util=require('util');var path=require(_0xb437('0x5'));var sox=require('sox');var csv=require(_0xb437('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb437('0x7'));var _=require(_0xb437('0x8'));var squel=require(_0xb437('0x9'));var crypto=require(_0xb437('0xa'));var jsforce=require(_0xb437('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb437('0xc'));var Papa=require(_0xb437('0xd'));var Redis=require(_0xb437('0xe'));var authService=require(_0xb437('0xf'));var qs=require(_0xb437('0x10'));var as=require(_0xb437('0x11'));var hardwareService=require(_0xb437('0x12'));var logger=require(_0xb437('0x13'))(_0xb437('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eb4c2,_0x286dbd){_0x286dbd=_0x286dbd||0xcc;return function(_0x510d40){if(_0x510d40){return _0x2eb4c2[_0xb437('0x15')](_0x286dbd);}return _0x2eb4c2[_0xb437('0x16')](_0x286dbd)[_0xb437('0x17')]();};}function respondWithResult(_0x2aa76e,_0x1ea6de){_0x1ea6de=_0x1ea6de||0xc8;return function(_0x2bf4ef){if(_0x2bf4ef){return _0x2aa76e[_0xb437('0x16')](_0x1ea6de)[_0xb437('0x18')](_0x2bf4ef);}};}function respondWithFilteredResult(_0x5311a9,_0x1e6589){return function(_0x39fb99){if(_0x39fb99){var _0x5e4c9f=typeof _0x1e6589[_0xb437('0x19')]===_0xb437('0x1a')&&typeof _0x1e6589['limit']===_0xb437('0x1a');var _0x5d31fd=_0x39fb99['count'];var _0x1e2129=_0x5e4c9f?0x0:_0x1e6589[_0xb437('0x19')];var _0x5acf98=_0x5e4c9f?_0x39fb99[_0xb437('0x1b')]:_0x1e6589[_0xb437('0x19')]+_0x1e6589[_0xb437('0x1c')];var _0x5ab764;if(_0x5acf98>=_0x5d31fd){_0x5acf98=_0x5d31fd;_0x5ab764=0xc8;}else{_0x5ab764=0xce;}_0x5311a9[_0xb437('0x16')](_0x5ab764);return _0x5311a9[_0xb437('0x1d')](_0xb437('0x1e'),_0x1e2129+'-'+_0x5acf98+'/'+_0x5d31fd)[_0xb437('0x18')](_0x39fb99);}return null;};}function patchUpdates(_0x5a8888){return function(_0x5adb78){try{jsonpatch[_0xb437('0x1f')](_0x5adb78,_0x5a8888,!![]);}catch(_0x5752f1){return BPromise['reject'](_0x5752f1);}return _0x5adb78[_0xb437('0x20')]();};}function saveUpdates(_0x4a01bf,_0x136140){return function(_0x4c64a9){if(_0x4c64a9){return _0x4c64a9[_0xb437('0x21')](_0x4a01bf)['then'](function(_0x458ded){return _0x458ded;});}return null;};}function removeEntity(_0xcebd70,_0x56f4d6){return function(_0x4c4969){if(_0x4c4969){return _0x4c4969[_0xb437('0x22')]()[_0xb437('0x23')](function(){_0xcebd70[_0xb437('0x16')](0xcc)[_0xb437('0x17')]();});}};}function handleEntityNotFound(_0x2016f1,_0x19ce31){return function(_0x1e3a07){if(!_0x1e3a07){_0x2016f1[_0xb437('0x15')](0x194);}return _0x1e3a07;};}function handleError(_0x53a71e,_0x761738){_0x761738=_0x761738||0x1f4;return function(_0x3e8345){logger[_0xb437('0x24')](_0x3e8345[_0xb437('0x25')]);if(_0x3e8345[_0xb437('0x26')]){delete _0x3e8345[_0xb437('0x26')];}_0x53a71e['status'](_0x761738)[_0xb437('0x27')](_0x3e8345);};}exports[_0xb437('0x28')]=function(_0x585753,_0x194ebf){var _0x10eb36={},_0x1dbc8d={},_0x5d0323={'count':0x0,'rows':[]};var _0x20b227=_[_0xb437('0x29')](db[_0xb437('0x2a')][_0xb437('0x2b')],function(_0xb5bfa){return{'name':_0xb5bfa[_0xb437('0x2c')],'type':_0xb5bfa[_0xb437('0x2d')][_0xb437('0x2e')]};});_0x1dbc8d[_0xb437('0x2f')]=_[_0xb437('0x29')](_0x20b227,_0xb437('0x26'));_0x1dbc8d[_0xb437('0x30')]=_[_0xb437('0x31')](_0x585753[_0xb437('0x30')]);_0x1dbc8d[_0xb437('0x32')]=_[_0xb437('0x33')](_0x1dbc8d['model'],_0x1dbc8d[_0xb437('0x30')]);_0x10eb36[_0xb437('0x34')]=_[_0xb437('0x33')](_0x1dbc8d[_0xb437('0x2f')],qs['fields'](_0x585753['query']['fields']));_0x10eb36['attributes']=_0x10eb36[_0xb437('0x34')][_0xb437('0x35')]?_0x10eb36[_0xb437('0x34')]:_0x1dbc8d['model'];if(!_0x585753[_0xb437('0x30')][_0xb437('0x36')](_0xb437('0x37'))){_0x10eb36[_0xb437('0x1c')]=qs[_0xb437('0x1c')](_0x585753[_0xb437('0x30')][_0xb437('0x1c')]);_0x10eb36[_0xb437('0x19')]=qs[_0xb437('0x19')](_0x585753[_0xb437('0x30')][_0xb437('0x19')]);}_0x10eb36[_0xb437('0x38')]=qs[_0xb437('0x39')](_0x585753[_0xb437('0x30')][_0xb437('0x39')]);_0x10eb36[_0xb437('0x3a')]=qs[_0xb437('0x32')](_[_0xb437('0x3b')](_0x585753['query'],_0x1dbc8d['filters']),_0x20b227);if(_0x585753[_0xb437('0x30')]['filter']){_0x10eb36['where']=_[_0xb437('0x3c')](_0x10eb36[_0xb437('0x3a')],{'$or':_[_0xb437('0x29')](_0x20b227,function(_0x381a0b){if(_0x381a0b[_0xb437('0x2d')]!==_0xb437('0x3d')){var _0xf4cb6b={};_0xf4cb6b[_0x381a0b[_0xb437('0x26')]]={'$like':'%'+_0x585753['query'][_0xb437('0x3e')]+'%'};return _0xf4cb6b;}})});}_0x10eb36=_[_0xb437('0x3c')]({},_0x10eb36,_0x585753[_0xb437('0x3f')]);var _0x45042a={'where':_0x10eb36[_0xb437('0x3a')]};return db['SquareMessage'][_0xb437('0x1b')](_0x45042a)[_0xb437('0x23')](function(_0x27ac7b){_0x5d0323[_0xb437('0x1b')]=_0x27ac7b;if(_0x585753[_0xb437('0x30')][_0xb437('0x40')]){_0x10eb36[_0xb437('0x41')]=[{'all':!![]}];}return db[_0xb437('0x2a')][_0xb437('0x42')](_0x10eb36);})[_0xb437('0x23')](function(_0x9976a1){_0x5d0323[_0xb437('0x43')]=_0x9976a1;return _0x5d0323;})[_0xb437('0x23')](respondWithFilteredResult(_0x194ebf,_0x10eb36))[_0xb437('0x44')](handleError(_0x194ebf,null));};exports['show']=function(_0x3c9e49,_0x927def){var _0x26d043={'raw':!![],'where':{'id':_0x3c9e49[_0xb437('0x45')]['id']}},_0x3bc816={};_0x3bc816['model']=_[_0xb437('0x31')](db[_0xb437('0x2a')][_0xb437('0x2b')]);_0x3bc816[_0xb437('0x30')]=_[_0xb437('0x31')](_0x3c9e49[_0xb437('0x30')]);_0x3bc816[_0xb437('0x32')]=_[_0xb437('0x33')](_0x3bc816[_0xb437('0x2f')],_0x3bc816[_0xb437('0x30')]);_0x26d043[_0xb437('0x34')]=_['intersection'](_0x3bc816[_0xb437('0x2f')],qs['fields'](_0x3c9e49[_0xb437('0x30')]['fields']));_0x26d043['attributes']=_0x26d043[_0xb437('0x34')][_0xb437('0x35')]?_0x26d043[_0xb437('0x34')]:_0x3bc816[_0xb437('0x2f')];if(_0x3c9e49['query'][_0xb437('0x40')]){_0x26d043['include']=[{'all':!![]}];}_0x26d043=_[_0xb437('0x3c')]({},_0x26d043,_0x3c9e49['options']);return db[_0xb437('0x2a')]['find'](_0x26d043)[_0xb437('0x23')](handleEntityNotFound(_0x927def,null))['then'](respondWithResult(_0x927def,null))['catch'](handleError(_0x927def,null));};exports[_0xb437('0x46')]=function(_0x527c64,_0x47c91d){return db[_0xb437('0x2a')]['create'](_0x527c64[_0xb437('0x47')],{})[_0xb437('0x23')](respondWithResult(_0x47c91d,0xc9))[_0xb437('0x44')](handleError(_0x47c91d,null));};exports[_0xb437('0x21')]=function(_0x2932d4,_0x5c3024){if(_0x2932d4['body']['id']){delete _0x2932d4[_0xb437('0x47')]['id'];}return db[_0xb437('0x2a')][_0xb437('0x48')]({'where':{'id':_0x2932d4[_0xb437('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c3024,null))[_0xb437('0x23')](saveUpdates(_0x2932d4['body'],null))[_0xb437('0x23')](respondWithResult(_0x5c3024,null))['catch'](handleError(_0x5c3024,null));};exports['destroy']=function(_0x4e1017,_0x39f466){return db[_0xb437('0x2a')][_0xb437('0x48')]({'where':{'id':_0x4e1017['params']['id']}})['then'](handleEntityNotFound(_0x39f466,null))[_0xb437('0x23')](removeEntity(_0x39f466,null))['catch'](handleError(_0x39f466,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index e04d5ff..6120dcc 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 _0xab3f=['moment','bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports','define','square_messages','lodash','util','../../config/logger','api'];(function(_0x837dad,_0x1d9098){var _0x1d62d3=function(_0x40b7c1){while(--_0x40b7c1){_0x837dad['push'](_0x837dad['shift']());}};_0x1d62d3(++_0x1d9098);}(_0xab3f,0x8b));var _0xfab3=function(_0x4c6d2b,_0x22d240){_0x4c6d2b=_0x4c6d2b-0x0;var _0x2216b2=_0xab3f[_0x4c6d2b];return _0x2216b2;};'use strict';var _=require(_0xfab3('0x0'));var util=require(_0xfab3('0x1'));var logger=require(_0xfab3('0x2'))(_0xfab3('0x3'));var moment=require(_0xfab3('0x4'));var BPromise=require(_0xfab3('0x5'));var rp=require(_0xfab3('0x6'));var fs=require('fs');var path=require(_0xfab3('0x7'));var rimraf=require(_0xfab3('0x8'));var config=require('../../config/environment');var attributes=require(_0xfab3('0x9'));module[_0xfab3('0xa')]=function(_0x2dfada,_0x1c7200){return _0x2dfada[_0xfab3('0xb')]('SquareMessage',attributes,{'tableName':_0xfab3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d98=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','square_messages','lodash','util','../../config/logger','moment'];(function(_0xc4e81c,_0x1374fe){var _0x30e247=function(_0x2d5617){while(--_0x2d5617){_0xc4e81c['push'](_0xc4e81c['shift']());}};_0x30e247(++_0x1374fe);}(_0x5d98,0x15c));var _0x85d9=function(_0x43ccb1,_0x23c325){_0x43ccb1=_0x43ccb1-0x0;var _0x2a9b79=_0x5d98[_0x43ccb1];return _0x2a9b79;};'use strict';var _=require(_0x85d9('0x0'));var util=require(_0x85d9('0x1'));var logger=require(_0x85d9('0x2'))('api');var moment=require(_0x85d9('0x3'));var BPromise=require('bluebird');var rp=require(_0x85d9('0x4'));var fs=require('fs');var path=require(_0x85d9('0x5'));var rimraf=require(_0x85d9('0x6'));var config=require(_0x85d9('0x7'));var attributes=require(_0x85d9('0x8'));module['exports']=function(_0x5c7e95,_0x32e7c2){return _0x5c7e95[_0x85d9('0x9')]('SquareMessage',attributes,{'tableName':_0x85d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index dbfa8d2..3c39c1f 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 _0x2a62=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','lodash','util','moment'];(function(_0x28e17f,_0x2dd341){var _0x3b83ac=function(_0x551393){while(--_0x551393){_0x28e17f['push'](_0x28e17f['shift']());}};_0x3b83ac(++_0x2dd341);}(_0x2a62,0x115));var _0x22a6=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x2a62[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x22a6('0x0'));var util=require(_0x22a6('0x1'));var moment=require(_0x22a6('0x2'));var BPromise=require(_0x22a6('0x3'));var rs=require(_0x22a6('0x4'));var fs=require('fs');var Redis=require(_0x22a6('0x5'));var db=require(_0x22a6('0x6'))['db'];var utils=require(_0x22a6('0x7'));var logger=require(_0x22a6('0x8'))(_0x22a6('0x9'));var config=require('../../config/environment');var jayson=require(_0x22a6('0xa'));var client=jayson[_0x22a6('0xb')][_0x22a6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ec886,_0xcf3580,_0x2ab9c4){return new BPromise(function(_0x325114,_0x1f4585){return client['request'](_0x3ec886,_0x2ab9c4)[_0x22a6('0xd')](function(_0x1fdc81){logger[_0x22a6('0xe')](_0x22a6('0xf'),_0xcf3580,_0x22a6('0x10'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0xcf3580,'request\x20sent',JSON['stringify'](_0x1fdc81));if(_0x1fdc81[_0x22a6('0x11')]){if(_0x1fdc81[_0x22a6('0x11')]['code']===0x1f4){logger['error'](_0x22a6('0xf'),_0xcf3580,_0x1fdc81['error'][_0x22a6('0x12')]);return _0x1f4585(_0x1fdc81[_0x22a6('0x11')][_0x22a6('0x12')]);}logger[_0x22a6('0x11')](_0x22a6('0xf'),_0xcf3580,_0x1fdc81[_0x22a6('0x11')][_0x22a6('0x12')]);return _0x325114(_0x1fdc81[_0x22a6('0x11')][_0x22a6('0x12')]);}else{logger['info'](_0x22a6('0xf'),_0xcf3580,'request\x20sent');_0x325114(_0x1fdc81[_0x22a6('0x13')][_0x22a6('0x12')]);}})[_0x22a6('0x14')](function(_0x358032){logger[_0x22a6('0x11')](_0x22a6('0xf'),_0xcf3580,_0x358032);_0x1f4585(_0x358032);});});}exports[_0x22a6('0x15')]=function(_0xe6d670){var _0x32ca09=this;return new Promise(function(_0x4ca505,_0x55eac0){return db[_0x22a6('0x16')][_0x22a6('0x17')](_0xe6d670[_0x22a6('0x18')],{'raw':_0xe6d670['options']?_0xe6d670[_0x22a6('0x19')][_0x22a6('0x1a')]===undefined?!![]:![]:!![]})[_0x22a6('0xd')](function(_0x333d0a){logger[_0x22a6('0xe')]('CreateSquareMessage',_0xe6d670);logger['debug'](_0x22a6('0x15'),_0xe6d670,JSON[_0x22a6('0x1b')](_0x333d0a));_0x4ca505(_0x333d0a);})[_0x22a6('0x14')](function(_0x378a2f){logger[_0x22a6('0x11')](_0x22a6('0x15'),_0x378a2f[_0x22a6('0x12')],_0xe6d670);_0x55eac0(_0x32ca09[_0x22a6('0x11')](0x1f4,_0x378a2f[_0x22a6('0x12')]));});});}; \ No newline at end of file +var _0x3d3d=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateSquareMessage','SquareMessage','body','options','stringify','catch','lodash'];(function(_0xbe5669,_0x105462){var _0x3a17b5=function(_0x123071){while(--_0x123071){_0xbe5669['push'](_0xbe5669['shift']());}};_0x3a17b5(++_0x105462);}(_0x3d3d,0x137));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd3d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd3d3('0x1'));var rs=require(_0xd3d3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3d3('0x4'))(_0xd3d3('0x5'));var config=require(_0xd3d3('0x6'));var jayson=require(_0xd3d3('0x7'));var client=jayson[_0xd3d3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5742d6,_0x2ea34b,_0x5b335f){return new BPromise(function(_0x1770f,_0x48dac7){return client[_0xd3d3('0x9')](_0x5742d6,_0x5b335f)[_0xd3d3('0xa')](function(_0x4e2123){logger[_0xd3d3('0xb')](_0xd3d3('0xc'),_0x2ea34b,'request\x20sent');logger[_0xd3d3('0xd')](_0xd3d3('0xe'),_0x2ea34b,_0xd3d3('0xf'),JSON['stringify'](_0x4e2123));if(_0x4e2123['error']){if(_0x4e2123[_0xd3d3('0x10')][_0xd3d3('0x11')]===0x1f4){logger[_0xd3d3('0x10')]('SquareMessage,\x20%s,\x20%s',_0x2ea34b,_0x4e2123[_0xd3d3('0x10')][_0xd3d3('0x12')]);return _0x48dac7(_0x4e2123[_0xd3d3('0x10')]['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x2ea34b,_0x4e2123['error'][_0xd3d3('0x12')]);return _0x1770f(_0x4e2123[_0xd3d3('0x10')][_0xd3d3('0x12')]);}else{logger[_0xd3d3('0xb')](_0xd3d3('0xc'),_0x2ea34b,_0xd3d3('0xf'));_0x1770f(_0x4e2123[_0xd3d3('0x13')][_0xd3d3('0x12')]);}})['catch'](function(_0x4cebcc){logger[_0xd3d3('0x10')](_0xd3d3('0xc'),_0x2ea34b,_0x4cebcc);_0x48dac7(_0x4cebcc);});});}exports[_0xd3d3('0x14')]=function(_0x36d7bb){var _0x234505=this;return new Promise(function(_0x1db3d0,_0x33cb2d){return db[_0xd3d3('0x15')]['create'](_0x36d7bb[_0xd3d3('0x16')],{'raw':_0x36d7bb[_0xd3d3('0x17')]?_0x36d7bb[_0xd3d3('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x232088){logger[_0xd3d3('0xb')](_0xd3d3('0x14'),_0x36d7bb);logger[_0xd3d3('0xd')](_0xd3d3('0x14'),_0x36d7bb,JSON[_0xd3d3('0x18')](_0x232088));_0x1db3d0(_0x232088);})[_0xd3d3('0x19')](function(_0x4ba635){logger[_0xd3d3('0x10')](_0xd3d3('0x14'),_0x4ba635[_0xd3d3('0x12')],_0x36d7bb);_0x33cb2d(_0x234505[_0xd3d3('0x10')](0x1f4,_0x4ba635[_0xd3d3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 61d115e..94103c9 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 _0x99ac=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','15s','test','post'];(function(_0x1bb560,_0xeae53f){var _0x41416f=function(_0x4e3965){while(--_0x4e3965){_0x1bb560['push'](_0x1bb560['shift']());}};_0x41416f(++_0xeae53f);}(_0x99ac,0x16b));var _0xc99a=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x99ac[_0x5f309e];return _0x487b5e;};'use strict';var multer=require('multer');var util=require(_0xc99a('0x0'));var path=require(_0xc99a('0x1'));var timeout=require(_0xc99a('0x2'));var express=require(_0xc99a('0x3'));var router=express[_0xc99a('0x4')]();var fs_extra=require(_0xc99a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc99a('0x6'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0xc99a('0x7')]('/',auth[_0xc99a('0x8')](),controller[_0xc99a('0x9')]);router[_0xc99a('0x7')](_0xc99a('0xa'),auth[_0xc99a('0x8')](),controller[_0xc99a('0xb')]);router['get']('/:id/test',auth[_0xc99a('0x8')](),timeout(_0xc99a('0xc')),controller[_0xc99a('0xd')]);router[_0xc99a('0xe')]('/',auth[_0xc99a('0x8')](),controller[_0xc99a('0xf')]);router[_0xc99a('0x10')](_0xc99a('0xa'),auth[_0xc99a('0x8')](),controller[_0xc99a('0x11')]);router[_0xc99a('0x12')](_0xc99a('0xa'),auth[_0xc99a('0x8')](),controller[_0xc99a('0x13')]);module[_0xc99a('0x14')]=router; \ No newline at end of file +var _0xe4bb=['isAuthenticated','index','show','15s','test','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./squareOdbc.controller','get'];(function(_0x5cd2ab,_0x2d162b){var _0x4663db=function(_0x54a66d){while(--_0x54a66d){_0x5cd2ab['push'](_0x5cd2ab['shift']());}};_0x4663db(++_0x2d162b);}(_0xe4bb,0x19c));var _0xbe4b=function(_0x50893e,_0xdae1be){_0x50893e=_0x50893e-0x0;var _0x55196b=_0xe4bb[_0x50893e];return _0x55196b;};'use strict';var multer=require(_0xbe4b('0x0'));var util=require(_0xbe4b('0x1'));var path=require(_0xbe4b('0x2'));var timeout=require(_0xbe4b('0x3'));var express=require('express');var router=express[_0xbe4b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbe4b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe4b('0x6'));router[_0xbe4b('0x7')]('/',auth[_0xbe4b('0x8')](),controller[_0xbe4b('0x9')]);router[_0xbe4b('0x7')]('/:id',auth[_0xbe4b('0x8')](),controller[_0xbe4b('0xa')]);router['get']('/:id/test',auth['isAuthenticated'](),timeout(_0xbe4b('0xb')),controller[_0xbe4b('0xc')]);router[_0xbe4b('0xd')]('/',auth[_0xbe4b('0x8')](),controller[_0xbe4b('0xe')]);router[_0xbe4b('0xf')](_0xbe4b('0x10'),auth[_0xbe4b('0x8')](),controller['update']);router[_0xbe4b('0x11')](_0xbe4b('0x10'),auth[_0xbe4b('0x8')](),controller[_0xbe4b('0x12')]);module[_0xbe4b('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index ac12f28..81012ea 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 _0xdba7=['exports','STRING','name','sequelize'];(function(_0x3c45b4,_0x1941cf){var _0x73361f=function(_0x1ab007){while(--_0x1ab007){_0x3c45b4['push'](_0x3c45b4['shift']());}};_0x73361f(++_0x1941cf);}(_0xdba7,0x14b));var _0x7dba=function(_0x106847,_0x443184){_0x106847=_0x106847-0x0;var _0x157c5d=_0xdba7[_0x106847];return _0x157c5d;};'use strict';var Sequelize=require(_0x7dba('0x0'));module[_0x7dba('0x1')]={'name':{'type':Sequelize[_0x7dba('0x2')],'unique':_0x7dba('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7dba('0x2')]}}; \ No newline at end of file +var _0x9df1=['STRING','sequelize','name'];(function(_0x5a53f1,_0x282b3d){var _0x10f225=function(_0x1f7ee5){while(--_0x1f7ee5){_0x5a53f1['push'](_0x5a53f1['shift']());}};_0x10f225(++_0x282b3d);}(_0x9df1,0xbb));var _0x19df=function(_0x57e913,_0x3cef90){_0x57e913=_0x57e913-0x0;var _0x50ed36=_0x9df1[_0x57e913];return _0x50ed36;};'use strict';var Sequelize=require(_0x19df('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x19df('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x19df('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 60d7989..3383f13 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 _0xddec=['util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','name','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','SquareOdbc','findAll','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x4c55a2,_0x944f94){var _0x192d4d=function(_0x168147){while(--_0x168147){_0x4c55a2['push'](_0x4c55a2['shift']());}};_0x192d4d(++_0x944f94);}(_0xddec,0xff));var _0xcdde=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xddec[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xcdde('0x0'));var rimraf=require(_0xcdde('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcdde('0x2'));var rp=require(_0xcdde('0x3'));var moment=require('moment');var BPromise=require(_0xcdde('0x4'));var Mustache=require(_0xcdde('0x5'));var util=require(_0xcdde('0x6'));var path=require(_0xcdde('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdde('0x8'));var _=require(_0xcdde('0x9'));var squel=require(_0xcdde('0xa'));var crypto=require(_0xcdde('0xb'));var jsforce=require(_0xcdde('0xc'));var deskjs=require(_0xcdde('0xd'));var toCsv=require(_0xcdde('0xe'));var querystring=require(_0xcdde('0xf'));var Papa=require(_0xcdde('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcdde('0x11'));var as=require(_0xcdde('0x12'));var hardwareService=require(_0xcdde('0x13'));var logger=require(_0xcdde('0x14'))(_0xcdde('0x15'));var utils=require(_0xcdde('0x16'));var config=require(_0xcdde('0x17'));var licenseUtil=require(_0xcdde('0x18'));var db=require(_0xcdde('0x19'))['db'];function respondWithStatusCode(_0x3fcce4,_0x5ec8b2){_0x5ec8b2=_0x5ec8b2||0xcc;return function(_0xe69c7e){if(_0xe69c7e){return _0x3fcce4[_0xcdde('0x1a')](_0x5ec8b2);}return _0x3fcce4[_0xcdde('0x1b')](_0x5ec8b2)[_0xcdde('0x1c')]();};}function respondWithResult(_0x251463,_0xc1cd72){_0xc1cd72=_0xc1cd72||0xc8;return function(_0x19b9f3){if(_0x19b9f3){return _0x251463[_0xcdde('0x1b')](_0xc1cd72)[_0xcdde('0x1d')](_0x19b9f3);}};}function respondWithFilteredResult(_0x4d142b,_0xa8e0f9){return function(_0x4c4579){if(_0x4c4579){var _0x5f3a3c=typeof _0xa8e0f9['offset']===_0xcdde('0x1e')&&typeof _0xa8e0f9[_0xcdde('0x1f')]===_0xcdde('0x1e');var _0x48d97d=_0x4c4579[_0xcdde('0x20')];var _0xbbc9a9=_0x5f3a3c?0x0:_0xa8e0f9[_0xcdde('0x21')];var _0xcd2a85=_0x5f3a3c?_0x4c4579[_0xcdde('0x20')]:_0xa8e0f9[_0xcdde('0x21')]+_0xa8e0f9[_0xcdde('0x1f')];var _0x204f72;if(_0xcd2a85>=_0x48d97d){_0xcd2a85=_0x48d97d;_0x204f72=0xc8;}else{_0x204f72=0xce;}_0x4d142b['status'](_0x204f72);return _0x4d142b[_0xcdde('0x22')](_0xcdde('0x23'),_0xbbc9a9+'-'+_0xcd2a85+'/'+_0x48d97d)[_0xcdde('0x1d')](_0x4c4579);}return null;};}function patchUpdates(_0x83c33e){return function(_0x4d7fd4){try{jsonpatch[_0xcdde('0x24')](_0x4d7fd4,_0x83c33e,!![]);}catch(_0x1296a1){return BPromise[_0xcdde('0x25')](_0x1296a1);}return _0x4d7fd4[_0xcdde('0x26')]();};}function saveUpdates(_0x46146b,_0x4a940f){return function(_0x5a0575){if(_0x5a0575){return _0x5a0575['update'](_0x46146b)['then'](function(_0x2cda78){return _0x2cda78;});}return null;};}function removeEntity(_0x2125eb,_0x33893f){return function(_0x447bf8){if(_0x447bf8){return _0x447bf8[_0xcdde('0x27')]()[_0xcdde('0x28')](function(){var _0x493879=_0x447bf8[_0xcdde('0x29')]({'plain':!![]});var _0x5ee28f='ODBC';return db[_0xcdde('0x2a')][_0xcdde('0x27')]({'where':{'type':_0x5ee28f,'resourceId':_0x493879['id']}})[_0xcdde('0x28')](function(){return _0x447bf8;});})[_0xcdde('0x28')](function(){_0x2125eb['status'](0xcc)[_0xcdde('0x1c')]();});}};}function handleEntityNotFound(_0x373e47,_0x3aca23){return function(_0x23c957){if(!_0x23c957){_0x373e47[_0xcdde('0x1a')](0x194);}return _0x23c957;};}function handleError(_0x320b36,_0x22eb8b){_0x22eb8b=_0x22eb8b||0x1f4;return function(_0x24ea58){logger['error'](_0x24ea58['stack']);if(_0x24ea58[_0xcdde('0x2b')]){delete _0x24ea58[_0xcdde('0x2b')];}_0x320b36[_0xcdde('0x1b')](_0x22eb8b)['send'](_0x24ea58);};}exports['index']=function(_0x574523,_0xa54e53){var _0x4d6fb0={},_0x1a4f41={},_0x55f676={'count':0x0,'rows':[]};var _0x47ba9e=_[_0xcdde('0x2c')](db['SquareOdbc'][_0xcdde('0x2d')],function(_0x19e7e0){return{'name':_0x19e7e0['fieldName'],'type':_0x19e7e0[_0xcdde('0x2e')][_0xcdde('0x2f')]};});_0x1a4f41[_0xcdde('0x30')]=_[_0xcdde('0x2c')](_0x47ba9e,_0xcdde('0x2b'));_0x1a4f41['query']=_[_0xcdde('0x31')](_0x574523[_0xcdde('0x32')]);_0x1a4f41[_0xcdde('0x33')]=_[_0xcdde('0x34')](_0x1a4f41[_0xcdde('0x30')],_0x1a4f41['query']);_0x4d6fb0[_0xcdde('0x35')]=_['intersection'](_0x1a4f41[_0xcdde('0x30')],qs[_0xcdde('0x36')](_0x574523['query'][_0xcdde('0x36')]));_0x4d6fb0[_0xcdde('0x35')]=_0x4d6fb0[_0xcdde('0x35')][_0xcdde('0x37')]?_0x4d6fb0[_0xcdde('0x35')]:_0x1a4f41[_0xcdde('0x30')];if(!_0x574523[_0xcdde('0x32')][_0xcdde('0x38')](_0xcdde('0x39'))){_0x4d6fb0[_0xcdde('0x1f')]=qs[_0xcdde('0x1f')](_0x574523[_0xcdde('0x32')][_0xcdde('0x1f')]);_0x4d6fb0[_0xcdde('0x21')]=qs['offset'](_0x574523[_0xcdde('0x32')][_0xcdde('0x21')]);}_0x4d6fb0['order']=qs[_0xcdde('0x3a')](_0x574523[_0xcdde('0x32')]['sort']);_0x4d6fb0[_0xcdde('0x3b')]=qs[_0xcdde('0x33')](_['pick'](_0x574523[_0xcdde('0x32')],_0x1a4f41[_0xcdde('0x33')]),_0x47ba9e);if(_0x574523[_0xcdde('0x32')][_0xcdde('0x3c')]){_0x4d6fb0['where']=_[_0xcdde('0x3d')](_0x4d6fb0[_0xcdde('0x3b')],{'$or':_[_0xcdde('0x2c')](_0x47ba9e,function(_0xfd43d8){if(_0xfd43d8[_0xcdde('0x2e')]!==_0xcdde('0x3e')){var _0x36313b={};_0x36313b[_0xfd43d8[_0xcdde('0x2b')]]={'$like':'%'+_0x574523[_0xcdde('0x32')][_0xcdde('0x3c')]+'%'};return _0x36313b;}})});}_0x4d6fb0=_[_0xcdde('0x3d')]({},_0x4d6fb0,_0x574523[_0xcdde('0x3f')]);var _0x4f1e64={'where':_0x4d6fb0[_0xcdde('0x3b')]};return db['SquareOdbc'][_0xcdde('0x20')](_0x4f1e64)[_0xcdde('0x28')](function(_0x4fee3d){_0x55f676[_0xcdde('0x20')]=_0x4fee3d;if(_0x574523['query']['includeAll']){_0x4d6fb0[_0xcdde('0x40')]=[{'all':!![]}];}return db[_0xcdde('0x41')][_0xcdde('0x42')](_0x4d6fb0);})[_0xcdde('0x28')](function(_0x43bbaa){_0x55f676['rows']=_0x43bbaa;return _0x55f676;})[_0xcdde('0x28')](respondWithFilteredResult(_0xa54e53,_0x4d6fb0))[_0xcdde('0x43')](handleError(_0xa54e53,null));};exports[_0xcdde('0x44')]=function(_0x561197,_0x28cba1){var _0x87205a={'raw':!![],'where':{'id':_0x561197['params']['id']}},_0x36653c={};_0x36653c['model']=_[_0xcdde('0x31')](db['SquareOdbc'][_0xcdde('0x2d')]);_0x36653c[_0xcdde('0x32')]=_[_0xcdde('0x31')](_0x561197[_0xcdde('0x32')]);_0x36653c['filters']=_[_0xcdde('0x34')](_0x36653c['model'],_0x36653c['query']);_0x87205a[_0xcdde('0x35')]=_[_0xcdde('0x34')](_0x36653c['model'],qs[_0xcdde('0x36')](_0x561197['query'][_0xcdde('0x36')]));_0x87205a[_0xcdde('0x35')]=_0x87205a['attributes'][_0xcdde('0x37')]?_0x87205a[_0xcdde('0x35')]:_0x36653c[_0xcdde('0x30')];if(_0x561197[_0xcdde('0x32')][_0xcdde('0x45')]){_0x87205a['include']=[{'all':!![]}];}_0x87205a=_[_0xcdde('0x3d')]({},_0x87205a,_0x561197['options']);return db['SquareOdbc'][_0xcdde('0x46')](_0x87205a)['then'](handleEntityNotFound(_0x28cba1,null))[_0xcdde('0x28')](respondWithResult(_0x28cba1,null))['catch'](handleError(_0x28cba1,null));};exports['create']=function(_0x4e2405,_0x5ac285){return db[_0xcdde('0x41')][_0xcdde('0x47')](_0x4e2405[_0xcdde('0x48')],{})['then'](function(_0x1c945d){var _0x513388=_0x4e2405[_0xcdde('0x49')][_0xcdde('0x29')]({'plain':!![]});if(!_0x513388)throw new Error(_0xcdde('0x4a'));if(_0x513388[_0xcdde('0x4b')]===_0xcdde('0x49')){var _0x2f7b4b=_0x1c945d['get']({'plain':!![]});var _0x43f0f8=_0xcdde('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x43f0f8,'userProfileId':_0x513388[_0xcdde('0x4d')]},'raw':!![]})['then'](function(_0x559d2c){if(_0x559d2c&&_0x559d2c['autoAssociation']===0x0){return db[_0xcdde('0x2a')][_0xcdde('0x47')]({'name':_0x2f7b4b[_0xcdde('0x2b')],'resourceId':_0x2f7b4b['id'],'type':_0x559d2c[_0xcdde('0x2b')],'sectionId':_0x559d2c['id']},{})[_0xcdde('0x28')](function(){return _0x1c945d;});}else{return _0x1c945d;}})[_0xcdde('0x43')](function(_0x272ad4){logger[_0xcdde('0x4e')](_0xcdde('0x4f'),_0x272ad4);throw _0x272ad4;});}return _0x1c945d;})[_0xcdde('0x28')](respondWithResult(_0x5ac285,0xc9))['catch'](handleError(_0x5ac285,null));};exports[_0xcdde('0x50')]=function(_0x5b0804,_0x47f0e7){if(_0x5b0804[_0xcdde('0x48')]['id']){delete _0x5b0804[_0xcdde('0x48')]['id'];}return db[_0xcdde('0x41')]['find']({'where':{'id':_0x5b0804[_0xcdde('0x51')]['id']}})[_0xcdde('0x28')](handleEntityNotFound(_0x47f0e7,null))[_0xcdde('0x28')](saveUpdates(_0x5b0804['body'],null))['then'](respondWithResult(_0x47f0e7,null))[_0xcdde('0x43')](handleError(_0x47f0e7,null));};exports[_0xcdde('0x27')]=function(_0x4fdac9,_0x1ee995){return db[_0xcdde('0x41')][_0xcdde('0x46')]({'where':{'id':_0x4fdac9['params']['id']}})[_0xcdde('0x28')](handleEntityNotFound(_0x1ee995,null))[_0xcdde('0x28')](removeEntity(_0x1ee995,null))['catch'](handleError(_0x1ee995,null));};exports[_0xcdde('0x52')]=function(_0x53385b,_0x570fd3,_0xe37a3){var _0x38a355;return db['SquareOdbc']['find']({'where':{'id':_0x53385b[_0xcdde('0x51')]['id']},'attributes':['id',_0xcdde('0x53')]})['then'](handleEntityNotFound(_0x570fd3,null))[_0xcdde('0x28')](function(_0x572647){if(_0x572647){var _0x337c94=require(_0xcdde('0x54'))();_0x337c94[_0xcdde('0x55')](_0x572647[_0xcdde('0x53')]);_0x337c94[_0xcdde('0x56')]();return _0x572647;}})[_0xcdde('0x28')](respondWithResult(_0x570fd3,null))[_0xcdde('0x43')](handleError(_0x570fd3,null));}; \ No newline at end of file +var _0xefbf=['limit','set','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count'];(function(_0x29311d,_0x3f9e23){var _0xa29b8f=function(_0x2bb490){while(--_0x2bb490){_0x29311d['push'](_0x29311d['shift']());}};_0xa29b8f(++_0x3f9e23);}(_0xefbf,0x191));var _0xfefb=function(_0x4c008b,_0xa7851a){_0x4c008b=_0x4c008b-0x0;var _0x25f2cb=_0xefbf[_0x4c008b];return _0x25f2cb;};'use strict';var emlformat=require(_0xfefb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfefb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfefb('0x2'));var moment=require('moment');var BPromise=require(_0xfefb('0x3'));var Mustache=require(_0xfefb('0x4'));var util=require(_0xfefb('0x5'));var path=require(_0xfefb('0x6'));var sox=require(_0xfefb('0x7'));var csv=require(_0xfefb('0x8'));var ejs=require(_0xfefb('0x9'));var fs=require('fs');var fs_extra=require(_0xfefb('0xa'));var _=require(_0xfefb('0xb'));var squel=require(_0xfefb('0xc'));var crypto=require(_0xfefb('0xd'));var jsforce=require(_0xfefb('0xe'));var deskjs=require(_0xfefb('0xf'));var toCsv=require(_0xfefb('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfefb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfefb('0x11'));var as=require(_0xfefb('0x12'));var hardwareService=require(_0xfefb('0x13'));var logger=require('../../config/logger')(_0xfefb('0x14'));var utils=require(_0xfefb('0x15'));var config=require(_0xfefb('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17f325,_0x3c8824){_0x3c8824=_0x3c8824||0xcc;return function(_0x1ab8d0){if(_0x1ab8d0){return _0x17f325[_0xfefb('0x17')](_0x3c8824);}return _0x17f325[_0xfefb('0x18')](_0x3c8824)[_0xfefb('0x19')]();};}function respondWithResult(_0x5a11fc,_0x206354){_0x206354=_0x206354||0xc8;return function(_0x28907f){if(_0x28907f){return _0x5a11fc[_0xfefb('0x18')](_0x206354)['json'](_0x28907f);}};}function respondWithFilteredResult(_0x4f95e3,_0x100e89){return function(_0x578997){if(_0x578997){var _0x50debc=typeof _0x100e89[_0xfefb('0x1a')]===_0xfefb('0x1b')&&typeof _0x100e89['limit']===_0xfefb('0x1b');var _0x12b43f=_0x578997[_0xfefb('0x1c')];var _0x53551e=_0x50debc?0x0:_0x100e89[_0xfefb('0x1a')];var _0x1b80ca=_0x50debc?_0x578997[_0xfefb('0x1c')]:_0x100e89[_0xfefb('0x1a')]+_0x100e89[_0xfefb('0x1d')];var _0x45eb27;if(_0x1b80ca>=_0x12b43f){_0x1b80ca=_0x12b43f;_0x45eb27=0xc8;}else{_0x45eb27=0xce;}_0x4f95e3['status'](_0x45eb27);return _0x4f95e3[_0xfefb('0x1e')](_0xfefb('0x1f'),_0x53551e+'-'+_0x1b80ca+'/'+_0x12b43f)['json'](_0x578997);}return null;};}function patchUpdates(_0x117a3a){return function(_0x162a89){try{jsonpatch[_0xfefb('0x20')](_0x162a89,_0x117a3a,!![]);}catch(_0x3aedba){return BPromise[_0xfefb('0x21')](_0x3aedba);}return _0x162a89[_0xfefb('0x22')]();};}function saveUpdates(_0x248603,_0xf1b5b0){return function(_0x21a3ea){if(_0x21a3ea){return _0x21a3ea[_0xfefb('0x23')](_0x248603)[_0xfefb('0x24')](function(_0x2ca43f){return _0x2ca43f;});}return null;};}function removeEntity(_0x5ce1de,_0x359ff3){return function(_0x103fdb){if(_0x103fdb){return _0x103fdb['destroy']()['then'](function(){var _0x3a46a4=_0x103fdb[_0xfefb('0x25')]({'plain':!![]});var _0x44155a=_0xfefb('0x26');return db[_0xfefb('0x27')][_0xfefb('0x28')]({'where':{'type':_0x44155a,'resourceId':_0x3a46a4['id']}})['then'](function(){return _0x103fdb;});})[_0xfefb('0x24')](function(){_0x5ce1de[_0xfefb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ca74e,_0x446190){return function(_0x59dd01){if(!_0x59dd01){_0x4ca74e[_0xfefb('0x17')](0x194);}return _0x59dd01;};}function handleError(_0x4c74e8,_0x29339e){_0x29339e=_0x29339e||0x1f4;return function(_0x3daef8){logger[_0xfefb('0x29')](_0x3daef8[_0xfefb('0x2a')]);if(_0x3daef8[_0xfefb('0x2b')]){delete _0x3daef8[_0xfefb('0x2b')];}_0x4c74e8[_0xfefb('0x18')](_0x29339e)[_0xfefb('0x2c')](_0x3daef8);};}exports[_0xfefb('0x2d')]=function(_0x2e5270,_0x3beba9){var _0x1ee906={},_0x4f70de={},_0x57b891={'count':0x0,'rows':[]};var _0x5a42cc=_[_0xfefb('0x2e')](db[_0xfefb('0x2f')][_0xfefb('0x30')],function(_0x318418){return{'name':_0x318418[_0xfefb('0x31')],'type':_0x318418[_0xfefb('0x32')]['key']};});_0x4f70de[_0xfefb('0x33')]=_[_0xfefb('0x2e')](_0x5a42cc,_0xfefb('0x2b'));_0x4f70de[_0xfefb('0x34')]=_['keys'](_0x2e5270[_0xfefb('0x34')]);_0x4f70de[_0xfefb('0x35')]=_['intersection'](_0x4f70de[_0xfefb('0x33')],_0x4f70de['query']);_0x1ee906['attributes']=_[_0xfefb('0x36')](_0x4f70de[_0xfefb('0x33')],qs[_0xfefb('0x37')](_0x2e5270[_0xfefb('0x34')][_0xfefb('0x37')]));_0x1ee906[_0xfefb('0x38')]=_0x1ee906[_0xfefb('0x38')][_0xfefb('0x39')]?_0x1ee906[_0xfefb('0x38')]:_0x4f70de[_0xfefb('0x33')];if(!_0x2e5270[_0xfefb('0x34')][_0xfefb('0x3a')](_0xfefb('0x3b'))){_0x1ee906[_0xfefb('0x1d')]=qs['limit'](_0x2e5270['query'][_0xfefb('0x1d')]);_0x1ee906[_0xfefb('0x1a')]=qs[_0xfefb('0x1a')](_0x2e5270[_0xfefb('0x34')][_0xfefb('0x1a')]);}_0x1ee906['order']=qs['sort'](_0x2e5270['query'][_0xfefb('0x3c')]);_0x1ee906[_0xfefb('0x3d')]=qs['filters'](_[_0xfefb('0x3e')](_0x2e5270[_0xfefb('0x34')],_0x4f70de['filters']),_0x5a42cc);if(_0x2e5270[_0xfefb('0x34')][_0xfefb('0x3f')]){_0x1ee906['where']=_[_0xfefb('0x40')](_0x1ee906[_0xfefb('0x3d')],{'$or':_[_0xfefb('0x2e')](_0x5a42cc,function(_0x4c8027){if(_0x4c8027[_0xfefb('0x32')]!==_0xfefb('0x41')){var _0x5930bd={};_0x5930bd[_0x4c8027[_0xfefb('0x2b')]]={'$like':'%'+_0x2e5270[_0xfefb('0x34')][_0xfefb('0x3f')]+'%'};return _0x5930bd;}})});}_0x1ee906=_[_0xfefb('0x40')]({},_0x1ee906,_0x2e5270[_0xfefb('0x42')]);var _0x176cd8={'where':_0x1ee906['where']};return db[_0xfefb('0x2f')][_0xfefb('0x1c')](_0x176cd8)[_0xfefb('0x24')](function(_0x1bc95a){_0x57b891['count']=_0x1bc95a;if(_0x2e5270[_0xfefb('0x34')][_0xfefb('0x43')]){_0x1ee906[_0xfefb('0x44')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x1ee906);})['then'](function(_0x52b583){_0x57b891['rows']=_0x52b583;return _0x57b891;})['then'](respondWithFilteredResult(_0x3beba9,_0x1ee906))['catch'](handleError(_0x3beba9,null));};exports[_0xfefb('0x45')]=function(_0x59c02e,_0x4b5205){var _0x10cf50={'raw':!![],'where':{'id':_0x59c02e['params']['id']}},_0x1e5a5b={};_0x1e5a5b[_0xfefb('0x33')]=_[_0xfefb('0x46')](db['SquareOdbc']['rawAttributes']);_0x1e5a5b['query']=_[_0xfefb('0x46')](_0x59c02e['query']);_0x1e5a5b[_0xfefb('0x35')]=_['intersection'](_0x1e5a5b[_0xfefb('0x33')],_0x1e5a5b[_0xfefb('0x34')]);_0x10cf50[_0xfefb('0x38')]=_[_0xfefb('0x36')](_0x1e5a5b[_0xfefb('0x33')],qs[_0xfefb('0x37')](_0x59c02e[_0xfefb('0x34')][_0xfefb('0x37')]));_0x10cf50[_0xfefb('0x38')]=_0x10cf50['attributes'][_0xfefb('0x39')]?_0x10cf50[_0xfefb('0x38')]:_0x1e5a5b[_0xfefb('0x33')];if(_0x59c02e[_0xfefb('0x34')]['includeAll']){_0x10cf50[_0xfefb('0x44')]=[{'all':!![]}];}_0x10cf50=_['merge']({},_0x10cf50,_0x59c02e[_0xfefb('0x42')]);return db[_0xfefb('0x2f')][_0xfefb('0x47')](_0x10cf50)['then'](handleEntityNotFound(_0x4b5205,null))[_0xfefb('0x24')](respondWithResult(_0x4b5205,null))[_0xfefb('0x48')](handleError(_0x4b5205,null));};exports[_0xfefb('0x49')]=function(_0x2da76a,_0x4c5cc2){return db[_0xfefb('0x2f')][_0xfefb('0x49')](_0x2da76a[_0xfefb('0x4a')],{})['then'](function(_0x27ac72){var _0x497526=_0x2da76a[_0xfefb('0x4b')][_0xfefb('0x25')]({'plain':!![]});if(!_0x497526)throw new Error(_0xfefb('0x4c'));if(_0x497526['role']==='user'){var _0x244a3c=_0x27ac72[_0xfefb('0x25')]({'plain':!![]});var _0x51adaa=_0xfefb('0x26');return db[_0xfefb('0x4d')]['find']({'where':{'name':_0x51adaa,'userProfileId':_0x497526[_0xfefb('0x4e')]},'raw':!![]})[_0xfefb('0x24')](function(_0x3f9faf){if(_0x3f9faf&&_0x3f9faf[_0xfefb('0x4f')]===0x0){return db[_0xfefb('0x27')]['create']({'name':_0x244a3c[_0xfefb('0x2b')],'resourceId':_0x244a3c['id'],'type':_0x3f9faf[_0xfefb('0x2b')],'sectionId':_0x3f9faf['id']},{})[_0xfefb('0x24')](function(){return _0x27ac72;});}else{return _0x27ac72;}})['catch'](function(_0x1c99e5){logger[_0xfefb('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c99e5);throw _0x1c99e5;});}return _0x27ac72;})['then'](respondWithResult(_0x4c5cc2,0xc9))['catch'](handleError(_0x4c5cc2,null));};exports[_0xfefb('0x23')]=function(_0xcc6416,_0x4bf24f){if(_0xcc6416[_0xfefb('0x4a')]['id']){delete _0xcc6416['body']['id'];}return db[_0xfefb('0x2f')][_0xfefb('0x47')]({'where':{'id':_0xcc6416['params']['id']}})[_0xfefb('0x24')](handleEntityNotFound(_0x4bf24f,null))['then'](saveUpdates(_0xcc6416[_0xfefb('0x4a')],null))['then'](respondWithResult(_0x4bf24f,null))[_0xfefb('0x48')](handleError(_0x4bf24f,null));};exports[_0xfefb('0x28')]=function(_0x46f035,_0x5dd72e){return db[_0xfefb('0x2f')][_0xfefb('0x47')]({'where':{'id':_0x46f035[_0xfefb('0x50')]['id']}})['then'](handleEntityNotFound(_0x5dd72e,null))[_0xfefb('0x24')](removeEntity(_0x5dd72e,null))['catch'](handleError(_0x5dd72e,null));};exports[_0xfefb('0x51')]=function(_0x3547b4,_0x2a827f,_0x33cc20){var _0x157d05;return db[_0xfefb('0x2f')][_0xfefb('0x47')]({'where':{'id':_0x3547b4['params']['id']},'attributes':['id',_0xfefb('0x52')]})[_0xfefb('0x24')](handleEntityNotFound(_0x2a827f,null))[_0xfefb('0x24')](function(_0x37b7f7){if(_0x37b7f7){var _0xbacb8a=require(_0xfefb('0x53'))();_0xbacb8a[_0xfefb('0x54')](_0x37b7f7[_0xfefb('0x52')]);_0xbacb8a[_0xfefb('0x55')]();return _0x37b7f7;}})[_0xfefb('0x24')](respondWithResult(_0x2a827f,null))[_0xfefb('0x48')](handleError(_0x2a827f,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 18147f1..fe1d116 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 _0x920c=['rimraf','exports','define','SquareOdbc','square_odbc','util','../../config/logger','api','request-promise'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x920c,0x152));var _0xc920=function(_0x13a45f,_0x533e58){_0x13a45f=_0x13a45f-0x0;var _0x145ef3=_0x920c[_0x13a45f];return _0x145ef3;};'use strict';var _=require('lodash');var util=require(_0xc920('0x0'));var logger=require(_0xc920('0x1'))(_0xc920('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc920('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc920('0x4'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xc920('0x5')]=function(_0x4fca9f,_0x352142){return _0x4fca9f[_0xc920('0x6')](_0xc920('0x7'),attributes,{'tableName':_0xc920('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca60=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util'];(function(_0x25ad66,_0x46e4dc){var _0x141bc4=function(_0x3a7f8e){while(--_0x3a7f8e){_0x25ad66['push'](_0x25ad66['shift']());}};_0x141bc4(++_0x46e4dc);}(_0xca60,0x106));var _0x0ca6=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xca60[_0x510b98];return _0x45e775;};'use strict';var _=require(_0x0ca6('0x0'));var util=require(_0x0ca6('0x1'));var logger=require(_0x0ca6('0x2'))('api');var moment=require(_0x0ca6('0x3'));var BPromise=require(_0x0ca6('0x4'));var rp=require(_0x0ca6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ca6('0x6'));var config=require(_0x0ca6('0x7'));var attributes=require(_0x0ca6('0x8'));module[_0x0ca6('0x9')]=function(_0x544eb3,_0x181d0e){return _0x544eb3[_0x0ca6('0xa')]('SquareOdbc',attributes,{'tableName':_0x0ca6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 9d47449..38f94fa 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 _0xbe09=['request\x20sent','stringify','error','message','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','map','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xbe09,0x1a2));var _0x9be0=function(_0x151cf0,_0x12155e){_0x151cf0=_0x151cf0-0x0;var _0x148f53=_0xbe09[_0x151cf0];return _0x148f53;};'use strict';var _=require('lodash');var util=require(_0x9be0('0x0'));var moment=require(_0x9be0('0x1'));var BPromise=require(_0x9be0('0x2'));var rs=require(_0x9be0('0x3'));var fs=require('fs');var Redis=require(_0x9be0('0x4'));var db=require(_0x9be0('0x5'))['db'];var utils=require(_0x9be0('0x6'));var logger=require(_0x9be0('0x7'))(_0x9be0('0x8'));var config=require('../../config/environment');var jayson=require(_0x9be0('0x9'));var client=jayson[_0x9be0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x469bb7,_0x2490e6,_0x3be8f3){return new BPromise(function(_0x136d27,_0x22fc17){return client[_0x9be0('0xb')](_0x469bb7,_0x3be8f3)[_0x9be0('0xc')](function(_0x3e10c3){logger['info'](_0x9be0('0xd'),_0x2490e6,'request\x20sent');logger[_0x9be0('0xe')](_0x9be0('0xf'),_0x2490e6,_0x9be0('0x10'),JSON[_0x9be0('0x11')](_0x3e10c3));if(_0x3e10c3[_0x9be0('0x12')]){if(_0x3e10c3[_0x9be0('0x12')]['code']===0x1f4){logger[_0x9be0('0x12')](_0x9be0('0xd'),_0x2490e6,_0x3e10c3[_0x9be0('0x12')][_0x9be0('0x13')]);return _0x22fc17(_0x3e10c3[_0x9be0('0x12')][_0x9be0('0x13')]);}logger[_0x9be0('0x12')](_0x9be0('0xd'),_0x2490e6,_0x3e10c3[_0x9be0('0x12')]['message']);return _0x136d27(_0x3e10c3['error'][_0x9be0('0x13')]);}else{logger['info'](_0x9be0('0xd'),_0x2490e6,'request\x20sent');_0x136d27(_0x3e10c3[_0x9be0('0x14')][_0x9be0('0x13')]);}})[_0x9be0('0x15')](function(_0x3e7742){logger[_0x9be0('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x2490e6,_0x3e7742);_0x22fc17(_0x3e7742);});});}exports[_0x9be0('0x16')]=function(_0x4f23da){var _0x42cda9=this;return new Promise(function(_0x2c5eea,_0x2af9f7){return db['SquareOdbc'][_0x9be0('0x17')]({'raw':_0x4f23da[_0x9be0('0x18')]?_0x4f23da['options'][_0x9be0('0x19')]===undefined?!![]:![]:!![],'where':_0x4f23da[_0x9be0('0x18')]?_0x4f23da[_0x9be0('0x18')][_0x9be0('0x1a')]||null:null,'attributes':_0x4f23da[_0x9be0('0x18')]?_0x4f23da[_0x9be0('0x18')][_0x9be0('0x1b')]||null:null,'include':_0x4f23da[_0x9be0('0x18')]?_0x4f23da['options'][_0x9be0('0x1c')]?_['map'](_0x4f23da['options']['include'],function(_0x55ad9b){return{'model':db[_0x55ad9b['model']],'as':_0x55ad9b['as'],'attributes':_0x55ad9b[_0x9be0('0x1b')],'include':_0x55ad9b[_0x9be0('0x1c')]?_[_0x9be0('0x1d')](_0x55ad9b[_0x9be0('0x1c')],function(_0x157d9f){return{'model':db[_0x157d9f['model']],'as':_0x157d9f['as'],'attributes':_0x157d9f[_0x9be0('0x1b')],'include':_0x157d9f[_0x9be0('0x1c')]?_[_0x9be0('0x1d')](_0x157d9f[_0x9be0('0x1c')],function(_0x457946){return{'model':db[_0x457946['model']],'as':_0x457946['as'],'attributes':_0x457946[_0x9be0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9be0('0xc')](function(_0x53ef5b){logger[_0x9be0('0x1e')](_0x9be0('0x16'),_0x4f23da);logger[_0x9be0('0xe')](_0x9be0('0x16'),_0x4f23da,JSON['stringify'](_0x53ef5b));_0x2c5eea(_0x53ef5b);})[_0x9be0('0x15')](function(_0x3c4e4a){logger[_0x9be0('0x12')](_0x9be0('0x16'),_0x3c4e4a[_0x9be0('0x13')],_0x4f23da);_0x2af9f7(_0x42cda9[_0x9be0('0x12')](0x1f4,_0x3c4e4a['message']));});});}; \ No newline at end of file +var _0x187e=['where','attributes','include','map','model','ShowSquareOdbc','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareOdbc','options','raw'];(function(_0x59c3c1,_0x2b8e45){var _0xfd7c10=function(_0x44cdce){while(--_0x44cdce){_0x59c3c1['push'](_0x59c3c1['shift']());}};_0xfd7c10(++_0x2b8e45);}(_0x187e,0x1d5));var _0xe187=function(_0x3b685e,_0xb93ffa){_0x3b685e=_0x3b685e-0x0;var _0x437168=_0x187e[_0x3b685e];return _0x437168;};'use strict';var _=require(_0xe187('0x0'));var util=require(_0xe187('0x1'));var moment=require(_0xe187('0x2'));var BPromise=require(_0xe187('0x3'));var rs=require(_0xe187('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe187('0x5'))['db'];var utils=require(_0xe187('0x6'));var logger=require(_0xe187('0x7'))('rpc');var config=require(_0xe187('0x8'));var jayson=require(_0xe187('0x9'));var client=jayson['client'][_0xe187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x993875,_0xc0c751,_0x392294){return new BPromise(function(_0x2610e6,_0x52e4a5){return client[_0xe187('0xb')](_0x993875,_0x392294)[_0xe187('0xc')](function(_0x37fa4a){logger[_0xe187('0xd')](_0xe187('0xe'),_0xc0c751,_0xe187('0xf'));logger[_0xe187('0x10')](_0xe187('0x11'),_0xc0c751,'request\x20sent',JSON['stringify'](_0x37fa4a));if(_0x37fa4a[_0xe187('0x12')]){if(_0x37fa4a[_0xe187('0x12')][_0xe187('0x13')]===0x1f4){logger[_0xe187('0x12')](_0xe187('0xe'),_0xc0c751,_0x37fa4a[_0xe187('0x12')][_0xe187('0x14')]);return _0x52e4a5(_0x37fa4a['error']['message']);}logger[_0xe187('0x12')](_0xe187('0xe'),_0xc0c751,_0x37fa4a['error'][_0xe187('0x14')]);return _0x2610e6(_0x37fa4a['error'][_0xe187('0x14')]);}else{logger['info'](_0xe187('0xe'),_0xc0c751,_0xe187('0xf'));_0x2610e6(_0x37fa4a[_0xe187('0x15')][_0xe187('0x14')]);}})[_0xe187('0x16')](function(_0x4943cf){logger['error'](_0xe187('0xe'),_0xc0c751,_0x4943cf);_0x52e4a5(_0x4943cf);});});}exports['ShowSquareOdbc']=function(_0x461130){var _0x319014=this;return new Promise(function(_0x1b35e1,_0x39e692){return db[_0xe187('0x17')]['find']({'raw':_0x461130[_0xe187('0x18')]?_0x461130['options'][_0xe187('0x19')]===undefined?!![]:![]:!![],'where':_0x461130[_0xe187('0x18')]?_0x461130[_0xe187('0x18')][_0xe187('0x1a')]||null:null,'attributes':_0x461130[_0xe187('0x18')]?_0x461130['options'][_0xe187('0x1b')]||null:null,'include':_0x461130[_0xe187('0x18')]?_0x461130[_0xe187('0x18')][_0xe187('0x1c')]?_[_0xe187('0x1d')](_0x461130['options'][_0xe187('0x1c')],function(_0x2f2947){return{'model':db[_0x2f2947[_0xe187('0x1e')]],'as':_0x2f2947['as'],'attributes':_0x2f2947[_0xe187('0x1b')],'include':_0x2f2947[_0xe187('0x1c')]?_[_0xe187('0x1d')](_0x2f2947['include'],function(_0x4d7c47){return{'model':db[_0x4d7c47[_0xe187('0x1e')]],'as':_0x4d7c47['as'],'attributes':_0x4d7c47[_0xe187('0x1b')],'include':_0x4d7c47[_0xe187('0x1c')]?_[_0xe187('0x1d')](_0x4d7c47[_0xe187('0x1c')],function(_0xc0ffe){return{'model':db[_0xc0ffe[_0xe187('0x1e')]],'as':_0xc0ffe['as'],'attributes':_0xc0ffe['attributes']};}):[]};}):[]};}):[]:[]})[_0xe187('0xc')](function(_0x2e9527){logger['info'](_0xe187('0x1f'),_0x461130);logger[_0xe187('0x10')](_0xe187('0x1f'),_0x461130,JSON[_0xe187('0x20')](_0x2e9527));_0x1b35e1(_0x2e9527);})[_0xe187('0x16')](function(_0x20253c){logger[_0xe187('0x12')](_0xe187('0x1f'),_0x20253c[_0xe187('0x14')],_0x461130);_0x39e692(_0x319014[_0xe187('0x12')](0x1f4,_0x20253c[_0xe187('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e8765d3..558111c 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 _0xb8cb=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/users','getUsers','post','create','put','/:id','update','delete','destroy','removeUsers'];(function(_0x199d53,_0x1666ea){var _0x3f905c=function(_0x1af227){while(--_0x1af227){_0x199d53['push'](_0x199d53['shift']());}};_0x3f905c(++_0x1666ea);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x1ec18f,_0x20c79e){_0x1ec18f=_0x1ec18f-0x0;var _0x23a7b2=_0xb8cb[_0x1ec18f];return _0x23a7b2;};'use strict';var multer=require(_0xbb8c('0x0'));var util=require(_0xbb8c('0x1'));var path=require(_0xbb8c('0x2'));var timeout=require(_0xbb8c('0x3'));var express=require(_0xbb8c('0x4'));var router=express[_0xbb8c('0x5')]();var fs_extra=require(_0xbb8c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbb8c('0x7'));var config=require(_0xbb8c('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xbb8c('0x9')](),controller[_0xbb8c('0xa')]);router[_0xbb8c('0xb')]('/:id',auth[_0xbb8c('0x9')](),controller[_0xbb8c('0xc')]);router[_0xbb8c('0xb')](_0xbb8c('0xd'),auth[_0xbb8c('0x9')](),controller[_0xbb8c('0xe')]);router[_0xbb8c('0xf')]('/',auth[_0xbb8c('0x9')](),controller[_0xbb8c('0x10')]);router[_0xbb8c('0xf')](_0xbb8c('0xd'),auth[_0xbb8c('0x9')](),controller['addUsers']);router[_0xbb8c('0x11')](_0xbb8c('0x12'),auth[_0xbb8c('0x9')](),controller[_0xbb8c('0x13')]);router[_0xbb8c('0x14')]('/:id',auth[_0xbb8c('0x9')](),controller[_0xbb8c('0x15')]);router[_0xbb8c('0x14')](_0xbb8c('0xd'),auth[_0xbb8c('0x9')](),controller[_0xbb8c('0x16')]);module[_0xbb8c('0x17')]=router; \ No newline at end of file +var _0x4dcb=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1f01ec,_0x6622ab){var _0x141f9e=function(_0x3a0a07){while(--_0x3a0a07){_0x1f01ec['push'](_0x1f01ec['shift']());}};_0x141f9e(++_0x6622ab);}(_0x4dcb,0x186));var _0xb4dc=function(_0x154213,_0x37efc7){_0x154213=_0x154213-0x0;var _0x170001=_0x4dcb[_0x154213];return _0x170001;};'use strict';var multer=require('multer');var util=require(_0xb4dc('0x0'));var path=require(_0xb4dc('0x1'));var timeout=require(_0xb4dc('0x2'));var express=require(_0xb4dc('0x3'));var router=express[_0xb4dc('0x4')]();var fs_extra=require(_0xb4dc('0x5'));var auth=require(_0xb4dc('0x6'));var interaction=require(_0xb4dc('0x7'));var config=require(_0xb4dc('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xb4dc('0x9')](),controller['index']);router[_0xb4dc('0xa')](_0xb4dc('0xb'),auth[_0xb4dc('0x9')](),controller[_0xb4dc('0xc')]);router[_0xb4dc('0xa')](_0xb4dc('0xd'),auth['isAuthenticated'](),controller[_0xb4dc('0xe')]);router[_0xb4dc('0xf')]('/',auth[_0xb4dc('0x9')](),controller[_0xb4dc('0x10')]);router[_0xb4dc('0xf')](_0xb4dc('0xd'),auth[_0xb4dc('0x9')](),controller[_0xb4dc('0x11')]);router[_0xb4dc('0x12')](_0xb4dc('0xb'),auth[_0xb4dc('0x9')](),controller[_0xb4dc('0x13')]);router[_0xb4dc('0x14')]('/:id',auth[_0xb4dc('0x9')](),controller[_0xb4dc('0x15')]);router[_0xb4dc('0x14')](_0xb4dc('0xd'),auth[_0xb4dc('0x9')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f627fc3..cfae103 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 _0x52a1=['exports','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','production','utf8','sequelize'];(function(_0x446989,_0x1039cc){var _0xdfd8dd=function(_0x532c00){while(--_0x532c00){_0x446989['push'](_0x446989['shift']());}};_0xdfd8dd(++_0x1039cc);}(_0x52a1,0x1b7));var _0x152a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x52a1[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x152a('0x0'));module[_0x152a('0x1')]={'name':{'type':Sequelize[_0x152a('0x2')],'unique':_0x152a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x152a('0x2')]},'notes':{'type':Sequelize[_0x152a('0x4')]},'preproduction':{'type':Sequelize[_0x152a('0x5')]('long'),'get':function(){if(this[_0x152a('0x6')]('preproduction')){return this[_0x152a('0x6')](_0x152a('0x7'))[_0x152a('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0x152a('0x9'))){return this['getDataValue']('production')[_0x152a('0x8')](_0x152a('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xe056=['long','getDataValue','toString','utf8','production','DATE','sequelize','exports','name','TEXT','BLOB'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xe056,0xab));var _0x6e05=function(_0x1f0679,_0x53d43c){_0x1f0679=_0x1f0679-0x0;var _0x3dc3a4=_0xe056[_0x1f0679];return _0x3dc3a4;};'use strict';var Sequelize=require(_0x6e05('0x0'));module[_0x6e05('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6e05('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x6e05('0x3')]},'preproduction':{'type':Sequelize[_0x6e05('0x4')](_0x6e05('0x5')),'get':function(){if(this[_0x6e05('0x6')]('preproduction')){return this[_0x6e05('0x6')]('preproduction')[_0x6e05('0x7')](_0x6e05('0x8'));}}},'production':{'type':Sequelize[_0x6e05('0x4')]('long'),'get':function(){if(this[_0x6e05('0x6')](_0x6e05('0x9'))){return this[_0x6e05('0x6')](_0x6e05('0x9'))[_0x6e05('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0x6e05('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 10ab672..e7d8776 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 _0x898e=['merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','omit','ids','removeUsers','isArray','emit','getUsers','findOne','User','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x5d662c,_0x4a585c){var _0x3bc3e3=function(_0x3cb678){while(--_0x3cb678){_0x5d662c['push'](_0x5d662c['shift']());}};_0x3bc3e3(++_0x4a585c);}(_0x898e,0xe1));var _0xe898=function(_0x2f96a2,_0xc6b468){_0x2f96a2=_0x2f96a2-0x0;var _0x428699=_0x898e[_0x2f96a2];return _0x428699;};'use strict';var emlformat=require(_0xe898('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe898('0x1'));var rp=require(_0xe898('0x2'));var moment=require(_0xe898('0x3'));var BPromise=require(_0xe898('0x4'));var Mustache=require(_0xe898('0x5'));var util=require('util');var path=require(_0xe898('0x6'));var sox=require(_0xe898('0x7'));var csv=require(_0xe898('0x8'));var ejs=require(_0xe898('0x9'));var fs=require('fs');var fs_extra=require(_0xe898('0xa'));var _=require(_0xe898('0xb'));var squel=require(_0xe898('0xc'));var crypto=require(_0xe898('0xd'));var jsforce=require(_0xe898('0xe'));var deskjs=require(_0xe898('0xf'));var toCsv=require(_0xe898('0x8'));var querystring=require(_0xe898('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe898('0x11'));var qs=require(_0xe898('0x12'));var as=require(_0xe898('0x13'));var hardwareService=require(_0xe898('0x14'));var logger=require(_0xe898('0x15'))(_0xe898('0x16'));var utils=require(_0xe898('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe898('0x18'));var db=require('../../mysqldb')['db'];config[_0xe898('0x19')]=_['defaults'](config[_0xe898('0x19')],{'host':_0xe898('0x1a'),'port':0x18eb});var socket=require(_0xe898('0x1b'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x225d73,_0x1124e9){_0x1124e9=_0x1124e9||0xcc;return function(_0x36605c){if(_0x36605c){return _0x225d73[_0xe898('0x1c')](_0x1124e9);}return _0x225d73[_0xe898('0x1d')](_0x1124e9)[_0xe898('0x1e')]();};}function respondWithResult(_0x3d9b01,_0x55b48f){_0x55b48f=_0x55b48f||0xc8;return function(_0x30bb5e){if(_0x30bb5e){return _0x3d9b01[_0xe898('0x1d')](_0x55b48f)['json'](_0x30bb5e);}};}function respondWithFilteredResult(_0x52a13a,_0xe7c7c4){return function(_0x1c943f){if(_0x1c943f){var _0x1a2e45=typeof _0xe7c7c4[_0xe898('0x1f')]===_0xe898('0x20')&&typeof _0xe7c7c4[_0xe898('0x21')]===_0xe898('0x20');var _0x257a44=_0x1c943f[_0xe898('0x22')];var _0x33c4af=_0x1a2e45?0x0:_0xe7c7c4[_0xe898('0x1f')];var _0xd53da9=_0x1a2e45?_0x1c943f[_0xe898('0x22')]:_0xe7c7c4[_0xe898('0x1f')]+_0xe7c7c4[_0xe898('0x21')];var _0x3d01a6;if(_0xd53da9>=_0x257a44){_0xd53da9=_0x257a44;_0x3d01a6=0xc8;}else{_0x3d01a6=0xce;}_0x52a13a[_0xe898('0x1d')](_0x3d01a6);return _0x52a13a[_0xe898('0x23')](_0xe898('0x24'),_0x33c4af+'-'+_0xd53da9+'/'+_0x257a44)[_0xe898('0x25')](_0x1c943f);}return null;};}function patchUpdates(_0x22aa97){return function(_0x57e2c3){try{jsonpatch[_0xe898('0x26')](_0x57e2c3,_0x22aa97,!![]);}catch(_0x3db84c){return BPromise[_0xe898('0x27')](_0x3db84c);}return _0x57e2c3[_0xe898('0x28')]();};}function saveUpdates(_0x3171d7,_0x37afdd){return function(_0x41c47d){if(_0x41c47d){return _0x41c47d[_0xe898('0x29')](_0x3171d7)[_0xe898('0x2a')](function(_0x307131){return _0x307131;});}return null;};}function removeEntity(_0x517850,_0x1609af){return function(_0x5a37dc){if(_0x5a37dc){return _0x5a37dc[_0xe898('0x2b')]()[_0xe898('0x2a')](function(){var _0x4cf0b3=_0x5a37dc[_0xe898('0x2c')]({'plain':!![]});var _0x1008ab=_0xe898('0x2d');return db[_0xe898('0x2e')]['destroy']({'where':{'type':_0x1008ab,'resourceId':_0x4cf0b3['id']}})[_0xe898('0x2a')](function(){return _0x5a37dc;});})[_0xe898('0x2a')](function(){_0x517850['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b2e7d,_0x1bd44b){return function(_0x4c8854){if(!_0x4c8854){_0x3b2e7d[_0xe898('0x1c')](0x194);}return _0x4c8854;};}function handleError(_0x54b81c,_0xae1faf){_0xae1faf=_0xae1faf||0x1f4;return function(_0x95e2aa){logger[_0xe898('0x2f')](_0x95e2aa['stack']);if(_0x95e2aa[_0xe898('0x30')]){delete _0x95e2aa['name'];}_0x54b81c[_0xe898('0x1d')](_0xae1faf)[_0xe898('0x31')](_0x95e2aa);};}exports[_0xe898('0x32')]=function(_0x49ffa1,_0x3e1c49){var _0x208644={},_0x3d59a2={},_0x1c20d8={'count':0x0,'rows':[]};var _0x1777f5=_[_0xe898('0x33')](db[_0xe898('0x34')][_0xe898('0x35')],function(_0x36cf83){return{'name':_0x36cf83[_0xe898('0x36')],'type':_0x36cf83[_0xe898('0x37')][_0xe898('0x38')]};});_0x3d59a2['model']=_['map'](_0x1777f5,_0xe898('0x30'));_0x3d59a2[_0xe898('0x39')]=_[_0xe898('0x3a')](_0x49ffa1[_0xe898('0x39')]);_0x3d59a2[_0xe898('0x3b')]=_[_0xe898('0x3c')](_0x3d59a2[_0xe898('0x3d')],_0x3d59a2[_0xe898('0x39')]);_0x208644['attributes']=_['intersection'](_0x3d59a2['model'],qs[_0xe898('0x3e')](_0x49ffa1['query'][_0xe898('0x3e')]));_0x208644[_0xe898('0x3f')]=_0x208644[_0xe898('0x3f')][_0xe898('0x40')]?_0x208644[_0xe898('0x3f')]:_0x3d59a2['model'];if(!_0x49ffa1[_0xe898('0x39')][_0xe898('0x41')](_0xe898('0x42'))){_0x208644[_0xe898('0x21')]=qs[_0xe898('0x21')](_0x49ffa1[_0xe898('0x39')][_0xe898('0x21')]);_0x208644['offset']=qs['offset'](_0x49ffa1[_0xe898('0x39')][_0xe898('0x1f')]);}_0x208644[_0xe898('0x43')]=qs['sort'](_0x49ffa1['query'][_0xe898('0x44')]);_0x208644[_0xe898('0x45')]=qs[_0xe898('0x3b')](_[_0xe898('0x46')](_0x49ffa1[_0xe898('0x39')],_0x3d59a2[_0xe898('0x3b')]),_0x1777f5);if(_0x49ffa1[_0xe898('0x39')][_0xe898('0x47')]){_0x208644['where']=_[_0xe898('0x48')](_0x208644[_0xe898('0x45')],{'$or':_[_0xe898('0x33')](_0x1777f5,function(_0x870a2a){if(_0x870a2a[_0xe898('0x37')]!==_0xe898('0x49')){var _0x197b47={};_0x197b47[_0x870a2a['name']]={'$like':'%'+_0x49ffa1[_0xe898('0x39')][_0xe898('0x47')]+'%'};return _0x197b47;}})});}_0x208644=_[_0xe898('0x48')]({},_0x208644,_0x49ffa1[_0xe898('0x4a')]);var _0x4bbdb3={'where':_0x208644[_0xe898('0x45')]};return db[_0xe898('0x34')][_0xe898('0x22')](_0x4bbdb3)[_0xe898('0x2a')](function(_0x1712bf){_0x1c20d8['count']=_0x1712bf;if(_0x49ffa1['query'][_0xe898('0x4b')]){_0x208644['include']=[{'all':!![]}];}return db[_0xe898('0x34')][_0xe898('0x4c')](_0x208644);})[_0xe898('0x2a')](function(_0x5bbdc3){_0x1c20d8[_0xe898('0x4d')]=_0x5bbdc3;return _0x1c20d8;})['then'](respondWithFilteredResult(_0x3e1c49,_0x208644))[_0xe898('0x4e')](handleError(_0x3e1c49,null));};exports[_0xe898('0x4f')]=function(_0x445af9,_0x3eac8f){var _0x5136eb={'raw':![],'where':{'id':_0x445af9[_0xe898('0x50')]['id']}},_0x1e7fd3={};_0x1e7fd3[_0xe898('0x3d')]=_[_0xe898('0x3a')](db[_0xe898('0x34')]['rawAttributes']);_0x1e7fd3[_0xe898('0x39')]=_[_0xe898('0x3a')](_0x445af9[_0xe898('0x39')]);_0x1e7fd3[_0xe898('0x3b')]=_[_0xe898('0x3c')](_0x1e7fd3[_0xe898('0x3d')],_0x1e7fd3[_0xe898('0x39')]);_0x5136eb['attributes']=_[_0xe898('0x3c')](_0x1e7fd3[_0xe898('0x3d')],qs['fields'](_0x445af9[_0xe898('0x39')]['fields']));_0x5136eb['attributes']=_0x5136eb[_0xe898('0x3f')]['length']?_0x5136eb[_0xe898('0x3f')]:_0x1e7fd3['model'];if(_0x445af9[_0xe898('0x39')]['includeAll']){_0x5136eb['include']=[{'all':!![]}];}_0x5136eb=_[_0xe898('0x48')]({},_0x5136eb,_0x445af9[_0xe898('0x4a')]);return db['SquareProject'][_0xe898('0x51')](_0x5136eb)[_0xe898('0x2a')](handleEntityNotFound(_0x3eac8f,null))[_0xe898('0x2a')](respondWithResult(_0x3eac8f,null))[_0xe898('0x4e')](handleError(_0x3eac8f,null));};exports[_0xe898('0x52')]=function(_0x1cfe2d,_0xf69652){return db['SquareProject']['create'](_0x1cfe2d['body'],{})[_0xe898('0x2a')](function(_0xa5c67b){var _0x18432b=_0x1cfe2d['user'][_0xe898('0x2c')]({'plain':!![]});if(!_0x18432b)throw new Error(_0xe898('0x53'));if(_0x18432b[_0xe898('0x54')]===_0xe898('0x55')){var _0x3dfeea=_0xa5c67b[_0xe898('0x2c')]({'plain':!![]});var _0x588ef6=_0xe898('0x2d');return db[_0xe898('0x56')][_0xe898('0x51')]({'where':{'name':_0x588ef6,'userProfileId':_0x18432b[_0xe898('0x57')]},'raw':!![]})['then'](function(_0x346ff8){if(_0x346ff8&&_0x346ff8['autoAssociation']===0x0){return db[_0xe898('0x2e')][_0xe898('0x52')]({'name':_0x3dfeea[_0xe898('0x30')],'resourceId':_0x3dfeea['id'],'type':_0x346ff8[_0xe898('0x30')],'sectionId':_0x346ff8['id']},{})['then'](function(){return _0xa5c67b;});}else{return _0xa5c67b;}})[_0xe898('0x4e')](function(_0x46a422){logger[_0xe898('0x2f')](_0xe898('0x58'),_0x46a422);throw _0x46a422;});}return _0xa5c67b;})[_0xe898('0x2a')](respondWithResult(_0xf69652,0xc9))[_0xe898('0x4e')](handleError(_0xf69652,null));};exports[_0xe898('0x29')]=function(_0xd730a1,_0x99b260){if(_0xd730a1[_0xe898('0x59')]['id']){delete _0xd730a1['body']['id'];}return db[_0xe898('0x34')][_0xe898('0x51')]({'where':{'id':_0xd730a1[_0xe898('0x50')]['id']}})[_0xe898('0x2a')](handleEntityNotFound(_0x99b260,null))['then'](saveUpdates(_0xd730a1[_0xe898('0x59')],null))['then'](respondWithResult(_0x99b260,null))[_0xe898('0x4e')](handleError(_0x99b260,null));};exports[_0xe898('0x2b')]=function(_0x25e658,_0x38c516){return db[_0xe898('0x34')][_0xe898('0x51')]({'where':{'id':_0x25e658[_0xe898('0x50')]['id']}})['then'](handleEntityNotFound(_0x38c516,null))[_0xe898('0x2a')](removeEntity(_0x38c516,null))[_0xe898('0x4e')](handleError(_0x38c516,null));};exports[_0xe898('0x5a')]=function(_0x2a5bab,_0x3418f4,_0xbc31b){return db[_0xe898('0x34')][_0xe898('0x51')]({'where':{'id':_0x2a5bab['params']['id']}})[_0xe898('0x2a')](handleEntityNotFound(_0x3418f4,null))[_0xe898('0x2a')](function(_0x5c87d8){if(_0x5c87d8){return _0x5c87d8[_0xe898('0x5a')](_0x2a5bab[_0xe898('0x59')]['ids'],_[_0xe898('0x5b')](_0x2a5bab[_0xe898('0x59')],[_0xe898('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x3418f4,null))[_0xe898('0x4e')](handleError(_0x3418f4,null));};exports[_0xe898('0x5d')]=function(_0x52b549,_0x43c32a,_0x4abc34){return db[_0xe898('0x34')]['find']({'where':{'id':_0x52b549[_0xe898('0x50')]['id']}})[_0xe898('0x2a')](handleEntityNotFound(_0x43c32a,null))[_0xe898('0x2a')](function(_0x40b984){if(_0x40b984){return _0x40b984[_0xe898('0x5d')](_0x52b549['query']['ids'])[_0xe898('0x2a')](function(){if(_[_0xe898('0x5e')](_0x52b549[_0xe898('0x39')][_0xe898('0x5c')])){for(var _0x468e38=0x0;_0x468e38<_0x52b549[_0xe898('0x39')][_0xe898('0x5c')][_0xe898('0x40')];_0x468e38+=0x1){socket[_0xe898('0x5f')]('userSquareProject:remove',{'UserId':Number(_0x52b549[_0xe898('0x39')][_0xe898('0x5c')][_0x468e38]),'SquareProjectId':Number(_0x52b549[_0xe898('0x50')]['id'])});}}else{socket[_0xe898('0x5f')]('userSquareProject:remove',{'UserId':Number(_0x52b549[_0xe898('0x39')]['ids']),'SquareProjectId':Number(_0x52b549[_0xe898('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x43c32a,null))[_0xe898('0x4e')](handleError(_0x43c32a,null));};exports[_0xe898('0x60')]=function(_0x23ecf1,_0x579e43,_0x460181){var _0x42df94={};var _0x5c39e3={};var _0x172dc4;var _0x11c3ec;return db[_0xe898('0x34')][_0xe898('0x61')]({'where':{'id':_0x23ecf1['params']['id']}})['then'](handleEntityNotFound(_0x579e43,null))[_0xe898('0x2a')](function(_0x3b3323){if(_0x3b3323){_0x172dc4=_0x3b3323;_0x5c39e3[_0xe898('0x3d')]=_[_0xe898('0x3a')](db[_0xe898('0x62')][_0xe898('0x35')]);_0x5c39e3[_0xe898('0x39')]=_[_0xe898('0x3a')](_0x23ecf1[_0xe898('0x39')]);_0x5c39e3[_0xe898('0x3b')]=_['intersection'](_0x5c39e3[_0xe898('0x3d')],_0x5c39e3[_0xe898('0x39')]);_0x42df94[_0xe898('0x3f')]=_[_0xe898('0x3c')](_0x5c39e3[_0xe898('0x3d')],qs[_0xe898('0x3e')](_0x23ecf1['query']['fields']));_0x42df94[_0xe898('0x3f')]=_0x42df94[_0xe898('0x3f')][_0xe898('0x40')]?_0x42df94[_0xe898('0x3f')]:_0x5c39e3[_0xe898('0x3d')];_0x42df94[_0xe898('0x43')]=qs[_0xe898('0x44')](_0x23ecf1[_0xe898('0x39')][_0xe898('0x44')]);_0x42df94[_0xe898('0x45')]=qs['filters'](_[_0xe898('0x46')](_0x23ecf1['query'],_0x5c39e3[_0xe898('0x3b')]));if(_0x23ecf1[_0xe898('0x39')][_0xe898('0x47')]){_0x42df94[_0xe898('0x45')]=_[_0xe898('0x48')](_0x42df94[_0xe898('0x45')],{'$or':_['map'](_0x42df94[_0xe898('0x3f')],function(_0x5e355c){var _0x2c3bb0={};_0x2c3bb0[_0x5e355c]={'$like':'%'+_0x23ecf1['query']['filter']+'%'};return _0x2c3bb0;})});}_0x42df94=_[_0xe898('0x48')]({},_0x42df94,_0x23ecf1[_0xe898('0x4a')]);return _0x172dc4[_0xe898('0x60')](_0x42df94);}})[_0xe898('0x2a')](function(_0x1f70d6){if(_0x1f70d6){_0x11c3ec=_0x1f70d6[_0xe898('0x40')];if(!_0x23ecf1['query'][_0xe898('0x41')](_0xe898('0x42'))){_0x42df94[_0xe898('0x21')]=qs[_0xe898('0x21')](_0x23ecf1[_0xe898('0x39')][_0xe898('0x21')]);_0x42df94[_0xe898('0x1f')]=qs[_0xe898('0x1f')](_0x23ecf1[_0xe898('0x39')][_0xe898('0x1f')]);}return _0x172dc4[_0xe898('0x60')](_0x42df94);}})[_0xe898('0x2a')](function(_0x566e31){if(_0x566e31){return _0x566e31?{'count':_0x11c3ec,'rows':_0x566e31}:null;}})[_0xe898('0x2a')](respondWithResult(_0x579e43,null))[_0xe898('0x4e')](handleError(_0x579e43,null));}; \ No newline at end of file +var _0x87ab=['type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','options','create','SquareProject','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','order','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','UserProfileResource','end','sendStatus','error','send','fieldName'];(function(_0x280e0c,_0x321f6e){var _0x525645=function(_0x2aa56f){while(--_0x2aa56f){_0x280e0c['push'](_0x280e0c['shift']());}};_0x525645(++_0x321f6e);}(_0x87ab,0x157));var _0xb87a=function(_0x442a73,_0x4ab9db){_0x442a73=_0x442a73-0x0;var _0xc00b47=_0x87ab[_0x442a73];return _0xc00b47;};'use strict';var emlformat=require(_0xb87a('0x0'));var rimraf=require(_0xb87a('0x1'));var zipdir=require(_0xb87a('0x2'));var jsonpatch=require(_0xb87a('0x3'));var rp=require(_0xb87a('0x4'));var moment=require(_0xb87a('0x5'));var BPromise=require(_0xb87a('0x6'));var Mustache=require(_0xb87a('0x7'));var util=require(_0xb87a('0x8'));var path=require(_0xb87a('0x9'));var sox=require(_0xb87a('0xa'));var csv=require(_0xb87a('0xb'));var ejs=require(_0xb87a('0xc'));var fs=require('fs');var fs_extra=require(_0xb87a('0xd'));var _=require(_0xb87a('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb87a('0xf'));var deskjs=require(_0xb87a('0x10'));var toCsv=require(_0xb87a('0xb'));var querystring=require(_0xb87a('0x11'));var Papa=require(_0xb87a('0x12'));var Redis=require('ioredis');var authService=require(_0xb87a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb87a('0x14'))('api');var utils=require(_0xb87a('0x15'));var config=require(_0xb87a('0x16'));var licenseUtil=require(_0xb87a('0x17'));var db=require(_0xb87a('0x18'))['db'];config[_0xb87a('0x19')]=_[_0xb87a('0x1a')](config[_0xb87a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb87a('0x1b'))(new Redis(config[_0xb87a('0x19')]));require(_0xb87a('0x1c'))[_0xb87a('0x1d')](socket);function respondWithStatusCode(_0x492a69,_0x305e00){_0x305e00=_0x305e00||0xcc;return function(_0x18b334){if(_0x18b334){return _0x492a69['sendStatus'](_0x305e00);}return _0x492a69[_0xb87a('0x1e')](_0x305e00)['end']();};}function respondWithResult(_0x53f17d,_0x4a4236){_0x4a4236=_0x4a4236||0xc8;return function(_0x322dd6){if(_0x322dd6){return _0x53f17d[_0xb87a('0x1e')](_0x4a4236)['json'](_0x322dd6);}};}function respondWithFilteredResult(_0x19367c,_0x2569a4){return function(_0x5998cb){if(_0x5998cb){var _0x374d2b=typeof _0x2569a4[_0xb87a('0x1f')]===_0xb87a('0x20')&&typeof _0x2569a4['limit']==='undefined';var _0x292f8c=_0x5998cb['count'];var _0x462f20=_0x374d2b?0x0:_0x2569a4[_0xb87a('0x1f')];var _0x52b82b=_0x374d2b?_0x5998cb[_0xb87a('0x21')]:_0x2569a4[_0xb87a('0x1f')]+_0x2569a4[_0xb87a('0x22')];var _0x18fd8d;if(_0x52b82b>=_0x292f8c){_0x52b82b=_0x292f8c;_0x18fd8d=0xc8;}else{_0x18fd8d=0xce;}_0x19367c[_0xb87a('0x1e')](_0x18fd8d);return _0x19367c[_0xb87a('0x23')](_0xb87a('0x24'),_0x462f20+'-'+_0x52b82b+'/'+_0x292f8c)[_0xb87a('0x25')](_0x5998cb);}return null;};}function patchUpdates(_0x26d88e){return function(_0x5a5c5d){try{jsonpatch[_0xb87a('0x26')](_0x5a5c5d,_0x26d88e,!![]);}catch(_0x7ec935){return BPromise[_0xb87a('0x27')](_0x7ec935);}return _0x5a5c5d[_0xb87a('0x28')]();};}function saveUpdates(_0x454c83,_0x2e2640){return function(_0x1eb4f6){if(_0x1eb4f6){return _0x1eb4f6['update'](_0x454c83)[_0xb87a('0x29')](function(_0x27f6c8){return _0x27f6c8;});}return null;};}function removeEntity(_0x4b4e4f,_0x2c47a1){return function(_0x15f495){if(_0x15f495){return _0x15f495[_0xb87a('0x2a')]()['then'](function(){var _0x37e7e3=_0x15f495['get']({'plain':!![]});var _0x586d05='SquareProjects';return db[_0xb87a('0x2b')][_0xb87a('0x2a')]({'where':{'type':_0x586d05,'resourceId':_0x37e7e3['id']}})[_0xb87a('0x29')](function(){return _0x15f495;});})[_0xb87a('0x29')](function(){_0x4b4e4f[_0xb87a('0x1e')](0xcc)[_0xb87a('0x2c')]();});}};}function handleEntityNotFound(_0x109fae,_0x3278bd){return function(_0x5673c2){if(!_0x5673c2){_0x109fae[_0xb87a('0x2d')](0x194);}return _0x5673c2;};}function handleError(_0x12f317,_0x5be794){_0x5be794=_0x5be794||0x1f4;return function(_0x2683b0){logger[_0xb87a('0x2e')](_0x2683b0['stack']);if(_0x2683b0['name']){delete _0x2683b0['name'];}_0x12f317[_0xb87a('0x1e')](_0x5be794)[_0xb87a('0x2f')](_0x2683b0);};}exports['index']=function(_0x541b26,_0x36eb09){var _0x3aec25={},_0xa1e025={},_0x337a2c={'count':0x0,'rows':[]};var _0x10837b=_['map'](db['SquareProject']['rawAttributes'],function(_0x44e41f){return{'name':_0x44e41f[_0xb87a('0x30')],'type':_0x44e41f[_0xb87a('0x31')][_0xb87a('0x32')]};});_0xa1e025[_0xb87a('0x33')]=_[_0xb87a('0x34')](_0x10837b,_0xb87a('0x35'));_0xa1e025['query']=_[_0xb87a('0x36')](_0x541b26[_0xb87a('0x37')]);_0xa1e025[_0xb87a('0x38')]=_[_0xb87a('0x39')](_0xa1e025[_0xb87a('0x33')],_0xa1e025[_0xb87a('0x37')]);_0x3aec25[_0xb87a('0x3a')]=_[_0xb87a('0x39')](_0xa1e025[_0xb87a('0x33')],qs[_0xb87a('0x3b')](_0x541b26[_0xb87a('0x37')]['fields']));_0x3aec25[_0xb87a('0x3a')]=_0x3aec25[_0xb87a('0x3a')][_0xb87a('0x3c')]?_0x3aec25[_0xb87a('0x3a')]:_0xa1e025[_0xb87a('0x33')];if(!_0x541b26[_0xb87a('0x37')]['hasOwnProperty']('nolimit')){_0x3aec25[_0xb87a('0x22')]=qs[_0xb87a('0x22')](_0x541b26['query'][_0xb87a('0x22')]);_0x3aec25[_0xb87a('0x1f')]=qs[_0xb87a('0x1f')](_0x541b26['query'][_0xb87a('0x1f')]);}_0x3aec25['order']=qs[_0xb87a('0x3d')](_0x541b26[_0xb87a('0x37')][_0xb87a('0x3d')]);_0x3aec25[_0xb87a('0x3e')]=qs[_0xb87a('0x38')](_[_0xb87a('0x3f')](_0x541b26['query'],_0xa1e025[_0xb87a('0x38')]),_0x10837b);if(_0x541b26['query'][_0xb87a('0x40')]){_0x3aec25[_0xb87a('0x3e')]=_[_0xb87a('0x41')](_0x3aec25['where'],{'$or':_[_0xb87a('0x34')](_0x10837b,function(_0x55734f){if(_0x55734f[_0xb87a('0x31')]!==_0xb87a('0x42')){var _0x552224={};_0x552224[_0x55734f['name']]={'$like':'%'+_0x541b26[_0xb87a('0x37')][_0xb87a('0x40')]+'%'};return _0x552224;}})});}_0x3aec25=_[_0xb87a('0x41')]({},_0x3aec25,_0x541b26['options']);var _0xa3135b={'where':_0x3aec25['where']};return db['SquareProject'][_0xb87a('0x21')](_0xa3135b)[_0xb87a('0x29')](function(_0x12b3b3){_0x337a2c[_0xb87a('0x21')]=_0x12b3b3;if(_0x541b26[_0xb87a('0x37')][_0xb87a('0x43')]){_0x3aec25[_0xb87a('0x44')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x3aec25);})['then'](function(_0x2e6f91){_0x337a2c[_0xb87a('0x45')]=_0x2e6f91;return _0x337a2c;})[_0xb87a('0x29')](respondWithFilteredResult(_0x36eb09,_0x3aec25))[_0xb87a('0x46')](handleError(_0x36eb09,null));};exports[_0xb87a('0x47')]=function(_0x1471c1,_0x1c9e47){var _0xba91e4={'raw':![],'where':{'id':_0x1471c1[_0xb87a('0x48')]['id']}},_0x525376={};_0x525376[_0xb87a('0x33')]=_[_0xb87a('0x36')](db['SquareProject'][_0xb87a('0x49')]);_0x525376[_0xb87a('0x37')]=_[_0xb87a('0x36')](_0x1471c1[_0xb87a('0x37')]);_0x525376[_0xb87a('0x38')]=_['intersection'](_0x525376[_0xb87a('0x33')],_0x525376[_0xb87a('0x37')]);_0xba91e4[_0xb87a('0x3a')]=_['intersection'](_0x525376['model'],qs[_0xb87a('0x3b')](_0x1471c1[_0xb87a('0x37')][_0xb87a('0x3b')]));_0xba91e4[_0xb87a('0x3a')]=_0xba91e4[_0xb87a('0x3a')][_0xb87a('0x3c')]?_0xba91e4[_0xb87a('0x3a')]:_0x525376[_0xb87a('0x33')];if(_0x1471c1[_0xb87a('0x37')][_0xb87a('0x43')]){_0xba91e4[_0xb87a('0x44')]=[{'all':!![]}];}_0xba91e4=_[_0xb87a('0x41')]({},_0xba91e4,_0x1471c1[_0xb87a('0x4a')]);return db['SquareProject']['find'](_0xba91e4)[_0xb87a('0x29')](handleEntityNotFound(_0x1c9e47,null))[_0xb87a('0x29')](respondWithResult(_0x1c9e47,null))['catch'](handleError(_0x1c9e47,null));};exports[_0xb87a('0x4b')]=function(_0x204d09,_0x47ad1b){return db[_0xb87a('0x4c')][_0xb87a('0x4b')](_0x204d09[_0xb87a('0x4d')],{})['then'](function(_0x4cff93){var _0x4badba=_0x204d09[_0xb87a('0x4e')][_0xb87a('0x4f')]({'plain':!![]});if(!_0x4badba)throw new Error(_0xb87a('0x50'));if(_0x4badba['role']===_0xb87a('0x4e')){var _0x5cd10b=_0x4cff93[_0xb87a('0x4f')]({'plain':!![]});var _0x38913a=_0xb87a('0x51');return db[_0xb87a('0x52')]['find']({'where':{'name':_0x38913a,'userProfileId':_0x4badba[_0xb87a('0x53')]},'raw':!![]})[_0xb87a('0x29')](function(_0x2d32b8){if(_0x2d32b8&&_0x2d32b8['autoAssociation']===0x0){return db[_0xb87a('0x2b')][_0xb87a('0x4b')]({'name':_0x5cd10b[_0xb87a('0x35')],'resourceId':_0x5cd10b['id'],'type':_0x2d32b8[_0xb87a('0x35')],'sectionId':_0x2d32b8['id']},{})['then'](function(){return _0x4cff93;});}else{return _0x4cff93;}})[_0xb87a('0x46')](function(_0x568d47){logger[_0xb87a('0x2e')](_0xb87a('0x54'),_0x568d47);throw _0x568d47;});}return _0x4cff93;})['then'](respondWithResult(_0x47ad1b,0xc9))['catch'](handleError(_0x47ad1b,null));};exports[_0xb87a('0x55')]=function(_0x46f5e9,_0x5168ff){if(_0x46f5e9[_0xb87a('0x4d')]['id']){delete _0x46f5e9[_0xb87a('0x4d')]['id'];}return db[_0xb87a('0x4c')][_0xb87a('0x56')]({'where':{'id':_0x46f5e9['params']['id']}})['then'](handleEntityNotFound(_0x5168ff,null))[_0xb87a('0x29')](saveUpdates(_0x46f5e9[_0xb87a('0x4d')],null))[_0xb87a('0x29')](respondWithResult(_0x5168ff,null))[_0xb87a('0x46')](handleError(_0x5168ff,null));};exports[_0xb87a('0x2a')]=function(_0x246224,_0x2300d0){return db[_0xb87a('0x4c')][_0xb87a('0x56')]({'where':{'id':_0x246224[_0xb87a('0x48')]['id']}})[_0xb87a('0x29')](handleEntityNotFound(_0x2300d0,null))[_0xb87a('0x29')](removeEntity(_0x2300d0,null))[_0xb87a('0x46')](handleError(_0x2300d0,null));};exports[_0xb87a('0x57')]=function(_0x13573d,_0x16ba7a,_0x649e39){return db['SquareProject'][_0xb87a('0x56')]({'where':{'id':_0x13573d['params']['id']}})['then'](handleEntityNotFound(_0x16ba7a,null))['then'](function(_0x2d4d28){if(_0x2d4d28){return _0x2d4d28[_0xb87a('0x57')](_0x13573d[_0xb87a('0x4d')][_0xb87a('0x58')],_[_0xb87a('0x59')](_0x13573d[_0xb87a('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x16ba7a,null))[_0xb87a('0x46')](handleError(_0x16ba7a,null));};exports[_0xb87a('0x5a')]=function(_0x331333,_0x300688,_0x3511cd){return db['SquareProject'][_0xb87a('0x56')]({'where':{'id':_0x331333[_0xb87a('0x48')]['id']}})[_0xb87a('0x29')](handleEntityNotFound(_0x300688,null))[_0xb87a('0x29')](function(_0x1ab3d7){if(_0x1ab3d7){return _0x1ab3d7[_0xb87a('0x5a')](_0x331333[_0xb87a('0x37')][_0xb87a('0x58')])[_0xb87a('0x29')](function(){if(_[_0xb87a('0x5b')](_0x331333[_0xb87a('0x37')]['ids'])){for(var _0x5b2d16=0x0;_0x5b2d16<_0x331333[_0xb87a('0x37')][_0xb87a('0x58')][_0xb87a('0x3c')];_0x5b2d16+=0x1){socket['emit'](_0xb87a('0x5c'),{'UserId':Number(_0x331333[_0xb87a('0x37')][_0xb87a('0x58')][_0x5b2d16]),'SquareProjectId':Number(_0x331333[_0xb87a('0x48')]['id'])});}}else{socket[_0xb87a('0x5d')](_0xb87a('0x5c'),{'UserId':Number(_0x331333[_0xb87a('0x37')][_0xb87a('0x58')]),'SquareProjectId':Number(_0x331333['params']['id'])});}});}})['then'](respondWithStatusCode(_0x300688,null))['catch'](handleError(_0x300688,null));};exports[_0xb87a('0x5e')]=function(_0x1131cd,_0x5556e1,_0x4d6b9c){var _0x24af94={};var _0x106daa={};var _0x4992d3;var _0x5ca4c2;return db[_0xb87a('0x4c')]['findOne']({'where':{'id':_0x1131cd['params']['id']}})[_0xb87a('0x29')](handleEntityNotFound(_0x5556e1,null))[_0xb87a('0x29')](function(_0x2c3b3a){if(_0x2c3b3a){_0x4992d3=_0x2c3b3a;_0x106daa[_0xb87a('0x33')]=_['keys'](db['User'][_0xb87a('0x49')]);_0x106daa[_0xb87a('0x37')]=_[_0xb87a('0x36')](_0x1131cd[_0xb87a('0x37')]);_0x106daa[_0xb87a('0x38')]=_['intersection'](_0x106daa[_0xb87a('0x33')],_0x106daa[_0xb87a('0x37')]);_0x24af94[_0xb87a('0x3a')]=_[_0xb87a('0x39')](_0x106daa[_0xb87a('0x33')],qs[_0xb87a('0x3b')](_0x1131cd[_0xb87a('0x37')][_0xb87a('0x3b')]));_0x24af94['attributes']=_0x24af94[_0xb87a('0x3a')][_0xb87a('0x3c')]?_0x24af94[_0xb87a('0x3a')]:_0x106daa[_0xb87a('0x33')];_0x24af94[_0xb87a('0x5f')]=qs[_0xb87a('0x3d')](_0x1131cd['query'][_0xb87a('0x3d')]);_0x24af94[_0xb87a('0x3e')]=qs['filters'](_['pick'](_0x1131cd[_0xb87a('0x37')],_0x106daa['filters']));if(_0x1131cd[_0xb87a('0x37')][_0xb87a('0x40')]){_0x24af94['where']=_[_0xb87a('0x41')](_0x24af94[_0xb87a('0x3e')],{'$or':_[_0xb87a('0x34')](_0x24af94[_0xb87a('0x3a')],function(_0x48680a){var _0x28dcfe={};_0x28dcfe[_0x48680a]={'$like':'%'+_0x1131cd[_0xb87a('0x37')][_0xb87a('0x40')]+'%'};return _0x28dcfe;})});}_0x24af94=_[_0xb87a('0x41')]({},_0x24af94,_0x1131cd[_0xb87a('0x4a')]);return _0x4992d3['getUsers'](_0x24af94);}})[_0xb87a('0x29')](function(_0x45e063){if(_0x45e063){_0x5ca4c2=_0x45e063[_0xb87a('0x3c')];if(!_0x1131cd[_0xb87a('0x37')][_0xb87a('0x60')](_0xb87a('0x61'))){_0x24af94[_0xb87a('0x22')]=qs['limit'](_0x1131cd[_0xb87a('0x37')][_0xb87a('0x22')]);_0x24af94[_0xb87a('0x1f')]=qs[_0xb87a('0x1f')](_0x1131cd[_0xb87a('0x37')][_0xb87a('0x1f')]);}return _0x4992d3[_0xb87a('0x5e')](_0x24af94);}})[_0xb87a('0x29')](function(_0x5230ca){if(_0x5230ca){return _0x5230ca?{'count':_0x5ca4c2,'rows':_0x5230ca}:null;}})['then'](respondWithResult(_0x5556e1,null))[_0xb87a('0x46')](handleError(_0x5556e1,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d79e6d8..2bc188e 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 _0x226c=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x226c,0x16d));var _0xc226=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x226c[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xc226('0x0'))['db'][_0xc226('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xc226('0x2')](0x0);var events={'afterCreate':_0xc226('0x3'),'afterUpdate':_0xc226('0x4'),'afterDestroy':_0xc226('0x5')};function emitEvent(_0x47cf98){return function(_0x563aa3,_0x1d9663,_0x25576e){SquareProjectEvents[_0xc226('0x6')](_0x47cf98+':'+_0x563aa3['id'],_0x563aa3);SquareProjectEvents[_0xc226('0x6')](_0x47cf98,_0x563aa3);_0x25576e(null);};}for(var e in events){if(events[_0xc226('0x7')](e)){var event=events[e];SquareProject[_0xc226('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xa7e8=['hasOwnProperty','exports','events','../../mysqldb','SquareProject','update','emit'];(function(_0x453378,_0x2f360c){var _0xab3d9e=function(_0x58c2c8){while(--_0x58c2c8){_0x453378['push'](_0x453378['shift']());}};_0xab3d9e(++_0x2f360c);}(_0xa7e8,0xe2));var _0x8a7e=function(_0x4059b8,_0x3f7596){_0x4059b8=_0x4059b8-0x0;var _0x1b2fbf=_0xa7e8[_0x4059b8];return _0x1b2fbf;};'use strict';var EventEmitter=require(_0x8a7e('0x0'));var SquareProject=require(_0x8a7e('0x1'))['db'][_0x8a7e('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a7e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x45ec30){return function(_0x3cfde3,_0x302352,_0x47af21){SquareProjectEvents[_0x8a7e('0x4')](_0x45ec30+':'+_0x3cfde3['id'],_0x3cfde3);SquareProjectEvents[_0x8a7e('0x4')](_0x45ec30,_0x3cfde3);_0x47af21(null);};}for(var e in events){if(events[_0x8a7e('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x8a7e('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 485448e..3402395 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 _0x01f9=['publishedAt','lodash','util','../../config/logger','api','bluebird','request-promise','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x575783,_0x4f66f6){var _0x1aeae0=function(_0x3e05cb){while(--_0x3e05cb){_0x575783['push'](_0x575783['shift']());}};_0x1aeae0(++_0x4f66f6);}(_0x01f9,0xb1));var _0x901f=function(_0x13de46,_0x1485c2){_0x13de46=_0x13de46-0x0;var _0x3830f3=_0x01f9[_0x13de46];return _0x3830f3;};'use strict';var _=require(_0x901f('0x0'));var util=require(_0x901f('0x1'));var logger=require(_0x901f('0x2'))(_0x901f('0x3'));var moment=require('moment');var BPromise=require(_0x901f('0x4'));var rp=require(_0x901f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x901f('0x6'));module['exports']=function(_0x498ba0,_0x47aceb){return _0x498ba0[_0x901f('0x7')](_0x901f('0x8'),attributes,{'tableName':_0x901f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x489527,_0x37814a,_0x26c47a){if(_0x489527[_0x901f('0xa')](_0x901f('0xb'))){_0x489527['savedAt']=moment()[_0x901f('0xc')](_0x901f('0xd'));}if(_0x489527[_0x901f('0xa')](_0x901f('0xe'))){_0x489527[_0x901f('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x26c47a(null,_0x489527);}}});}; \ No newline at end of file +var _0xc362=['changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','api','moment','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects'];(function(_0x4f41cf,_0xdf03fe){var _0x5e19d0=function(_0x5af4ab){while(--_0x5af4ab){_0x4f41cf['push'](_0x4f41cf['shift']());}};_0x5e19d0(++_0xdf03fe);}(_0xc362,0x116));var _0x2c36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc362[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c36('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2c36('0x1'));var moment=require(_0x2c36('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c36('0x3'));var rimraf=require(_0x2c36('0x4'));var config=require(_0x2c36('0x5'));var attributes=require(_0x2c36('0x6'));module[_0x2c36('0x7')]=function(_0x208cec,_0x1a05b0){return _0x208cec[_0x2c36('0x8')](_0x2c36('0x9'),attributes,{'tableName':_0x2c36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36eba4,_0x48b0ed,_0x1217f9){if(_0x36eba4[_0x2c36('0xb')](_0x2c36('0xc'))){_0x36eba4['savedAt']=moment()[_0x2c36('0xd')](_0x2c36('0xe'));}if(_0x36eba4[_0x2c36('0xb')](_0x2c36('0xf'))){_0x36eba4[_0x2c36('0x10')]=moment()[_0x2c36('0xd')](_0x2c36('0xe'));}_0x1217f9(null,_0x36eba4);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 8ca648a..6ee77d6 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 _0xcc52=['util','moment','bluebird','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','register','request','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','then','lodash'];(function(_0x4e5052,_0x271e43){var _0x509cec=function(_0x5bd516){while(--_0x5bd516){_0x4e5052['push'](_0x4e5052['shift']());}};_0x509cec(++_0x271e43);}(_0xcc52,0xa9));var _0x2cc5=function(_0x526d64,_0x1dcff6){_0x526d64=_0x526d64-0x0;var _0xdc6941=_0xcc52[_0x526d64];return _0xdc6941;};'use strict';var _=require(_0x2cc5('0x0'));var util=require(_0x2cc5('0x1'));var moment=require(_0x2cc5('0x2'));var BPromise=require(_0x2cc5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2cc5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2cc5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2cc5('0x6')][_0x2cc5('0x7')]({'port':0x232a});config[_0x2cc5('0x8')]=_[_0x2cc5('0x9')](config[_0x2cc5('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2cc5('0xa'))(new Redis(config[_0x2cc5('0x8')]));require(_0x2cc5('0xb'))[_0x2cc5('0xc')](socket);function respondWithRpcPromise(_0x3d863c,_0x5edf1c,_0x42171d){return new BPromise(function(_0x1417ea,_0x5aed9c){return client[_0x2cc5('0xd')](_0x3d863c,_0x42171d)['then'](function(_0x2de28b){logger[_0x2cc5('0xe')]('SquareProject,\x20%s,\x20%s',_0x5edf1c,'request\x20sent');logger[_0x2cc5('0xf')](_0x2cc5('0x10'),_0x5edf1c,_0x2cc5('0x11'),JSON[_0x2cc5('0x12')](_0x2de28b));if(_0x2de28b[_0x2cc5('0x13')]){if(_0x2de28b[_0x2cc5('0x13')][_0x2cc5('0x14')]===0x1f4){logger[_0x2cc5('0x13')](_0x2cc5('0x15'),_0x5edf1c,_0x2de28b[_0x2cc5('0x13')]['message']);return _0x5aed9c(_0x2de28b[_0x2cc5('0x13')][_0x2cc5('0x16')]);}logger[_0x2cc5('0x13')](_0x2cc5('0x15'),_0x5edf1c,_0x2de28b[_0x2cc5('0x13')][_0x2cc5('0x16')]);return _0x1417ea(_0x2de28b[_0x2cc5('0x13')]['message']);}else{logger[_0x2cc5('0xe')]('SquareProject,\x20%s,\x20%s',_0x5edf1c,'request\x20sent');_0x1417ea(_0x2de28b[_0x2cc5('0x17')]['message']);}})['catch'](function(_0xa45eaf){logger[_0x2cc5('0x13')](_0x2cc5('0x15'),_0x5edf1c,_0xa45eaf);_0x5aed9c(_0xa45eaf);});});}exports[_0x2cc5('0x18')]=function(_0x422088){var _0x2f9736=this;return new Promise(function(_0xc267aa,_0x224010){return db[_0x2cc5('0x19')][_0x2cc5('0x1a')]({'raw':_0x422088['options']?_0x422088[_0x2cc5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x422088[_0x2cc5('0x1b')]?_0x422088['options'][_0x2cc5('0x1c')]||null:null,'attributes':_0x422088[_0x2cc5('0x1b')]?_0x422088[_0x2cc5('0x1b')][_0x2cc5('0x1d')]||null:null,'include':_0x422088[_0x2cc5('0x1b')]?_0x422088[_0x2cc5('0x1b')][_0x2cc5('0x1e')]?_[_0x2cc5('0x1f')](_0x422088[_0x2cc5('0x1b')][_0x2cc5('0x1e')],function(_0x22e238){return{'model':db[_0x22e238[_0x2cc5('0x20')]],'as':_0x22e238['as'],'attributes':_0x22e238['attributes'],'include':_0x22e238[_0x2cc5('0x1e')]?_[_0x2cc5('0x1f')](_0x22e238['include'],function(_0x107a0d){return{'model':db[_0x107a0d['model']],'as':_0x107a0d['as'],'attributes':_0x107a0d[_0x2cc5('0x1d')],'include':_0x107a0d[_0x2cc5('0x1e')]?_[_0x2cc5('0x1f')](_0x107a0d['include'],function(_0x594a45){return{'model':db[_0x594a45['model']],'as':_0x594a45['as'],'attributes':_0x594a45[_0x2cc5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2cc5('0x21')](function(_0x254254){logger['info'](_0x2cc5('0x18'),_0x422088);logger[_0x2cc5('0xf')](_0x2cc5('0x18'),_0x422088,JSON[_0x2cc5('0x12')](_0x254254));_0xc267aa(_0x254254);})['catch'](function(_0x5864de){logger[_0x2cc5('0x13')](_0x2cc5('0x18'),_0x5864de[_0x2cc5('0x16')],_0x422088);_0x224010(_0x2f9736[_0x2cc5('0x13')](0x1f4,_0x5864de[_0x2cc5('0x16')]));});});}; \ No newline at end of file +var _0x4dfc=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareProject','find','options','attributes','include','model','map','debug','ShowSquareProject','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x591db7,_0x150445){var _0x4ad760=function(_0x5dd24e){while(--_0x5dd24e){_0x591db7['push'](_0x591db7['shift']());}};_0x4ad760(++_0x150445);}(_0x4dfc,0x162));var _0xc4df=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0x4dfc[_0x39479f];return _0x4a6d96;};'use strict';var _=require(_0xc4df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc4df('0x1'));var rs=require(_0xc4df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4df('0x3'))['db'];var utils=require(_0xc4df('0x4'));var logger=require(_0xc4df('0x5'))(_0xc4df('0x6'));var config=require(_0xc4df('0x7'));var jayson=require(_0xc4df('0x8'));var client=jayson[_0xc4df('0x9')][_0xc4df('0xa')]({'port':0x232a});config[_0xc4df('0xb')]=_[_0xc4df('0xc')](config[_0xc4df('0xb')],{'host':_0xc4df('0xd'),'port':0x18eb});var socket=require(_0xc4df('0xe'))(new Redis(config['redis']));require('./squareProject.socket')[_0xc4df('0xf')](socket);function respondWithRpcPromise(_0x3c86da,_0x126c0d,_0x4c9763){return new BPromise(function(_0x421e53,_0x4bff26){return client[_0xc4df('0x10')](_0x3c86da,_0x4c9763)[_0xc4df('0x11')](function(_0x1123c2){logger[_0xc4df('0x12')](_0xc4df('0x13'),_0x126c0d,_0xc4df('0x14'));logger['debug'](_0xc4df('0x15'),_0x126c0d,_0xc4df('0x14'),JSON[_0xc4df('0x16')](_0x1123c2));if(_0x1123c2[_0xc4df('0x17')]){if(_0x1123c2[_0xc4df('0x17')][_0xc4df('0x18')]===0x1f4){logger[_0xc4df('0x17')](_0xc4df('0x13'),_0x126c0d,_0x1123c2[_0xc4df('0x17')]['message']);return _0x4bff26(_0x1123c2[_0xc4df('0x17')]['message']);}logger[_0xc4df('0x17')]('SquareProject,\x20%s,\x20%s',_0x126c0d,_0x1123c2[_0xc4df('0x17')][_0xc4df('0x19')]);return _0x421e53(_0x1123c2[_0xc4df('0x17')][_0xc4df('0x19')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x126c0d,'request\x20sent');_0x421e53(_0x1123c2['result'][_0xc4df('0x19')]);}})['catch'](function(_0x355d92){logger[_0xc4df('0x17')](_0xc4df('0x13'),_0x126c0d,_0x355d92);_0x4bff26(_0x355d92);});});}exports['ShowSquareProject']=function(_0x39bf34){var _0x23731b=this;return new Promise(function(_0x44ddd1,_0x1db555){return db[_0xc4df('0x1a')][_0xc4df('0x1b')]({'raw':_0x39bf34[_0xc4df('0x1c')]?_0x39bf34[_0xc4df('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x39bf34[_0xc4df('0x1c')]?_0x39bf34['options']['where']||null:null,'attributes':_0x39bf34[_0xc4df('0x1c')]?_0x39bf34['options'][_0xc4df('0x1d')]||null:null,'include':_0x39bf34[_0xc4df('0x1c')]?_0x39bf34[_0xc4df('0x1c')][_0xc4df('0x1e')]?_['map'](_0x39bf34[_0xc4df('0x1c')][_0xc4df('0x1e')],function(_0x491404){return{'model':db[_0x491404[_0xc4df('0x1f')]],'as':_0x491404['as'],'attributes':_0x491404['attributes'],'include':_0x491404[_0xc4df('0x1e')]?_[_0xc4df('0x20')](_0x491404[_0xc4df('0x1e')],function(_0x3eb8c6){return{'model':db[_0x3eb8c6['model']],'as':_0x3eb8c6['as'],'attributes':_0x3eb8c6[_0xc4df('0x1d')],'include':_0x3eb8c6[_0xc4df('0x1e')]?_[_0xc4df('0x20')](_0x3eb8c6['include'],function(_0x1b52ec){return{'model':db[_0x1b52ec['model']],'as':_0x1b52ec['as'],'attributes':_0x1b52ec['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4df('0x11')](function(_0x4e99e2){logger['info']('ShowSquareProject',_0x39bf34);logger[_0xc4df('0x21')](_0xc4df('0x22'),_0x39bf34,JSON['stringify'](_0x4e99e2));_0x44ddd1(_0x4e99e2);})[_0xc4df('0x23')](function(_0x5c131a){logger['error'](_0xc4df('0x22'),_0x5c131a[_0xc4df('0x19')],_0x39bf34);_0x1db555(_0x23731b[_0xc4df('0x17')](0x1f4,_0x5c131a[_0xc4df('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d1cd9e2..3791b10 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 _0xbb7d=['emit','register','squareProject:','./squareProject.events','save','remove','update'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xbb7d,0x1b5));var _0xdbb7=function(_0x361976,_0x40566d){_0x361976=_0x361976-0x0;var _0x589637=_0xbb7d[_0x361976];return _0x589637;};'use strict';var SquareProjectEvents=require(_0xdbb7('0x0'));var events=[_0xdbb7('0x1'),_0xdbb7('0x2'),_0xdbb7('0x3')];function createListener(_0x5449b1,_0x31a832){return function(_0x32b433){_0x31a832[_0xdbb7('0x4')](_0x5449b1,_0x32b433);};}function removeListener(_0x3b144d,_0x3b46f0){return function(){SquareProjectEvents['removeListener'](_0x3b144d,_0x3b46f0);};}exports[_0xdbb7('0x5')]=function(_0x13662e){for(var _0x51902f=0x0,_0x1a3cc3=events['length'];_0x51902f<_0x1a3cc3;_0x51902f++){var _0x1dcbc7=events[_0x51902f];var _0x590735=createListener(_0xdbb7('0x6')+_0x1dcbc7,_0x13662e);SquareProjectEvents['on'](_0x1dcbc7,_0x590735);}}; \ No newline at end of file +var _0x9acb=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x9acb,0x91));var _0xb9ac=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x9acb[_0x134c2e];return _0x2825db;};'use strict';var SquareProjectEvents=require(_0xb9ac('0x0'));var events=[_0xb9ac('0x1'),_0xb9ac('0x2'),_0xb9ac('0x3')];function createListener(_0x2e3ffe,_0x35cea3){return function(_0x2c723f){_0x35cea3[_0xb9ac('0x4')](_0x2e3ffe,_0x2c723f);};}function removeListener(_0x25fad7,_0x139ce4){return function(){SquareProjectEvents[_0xb9ac('0x5')](_0x25fad7,_0x139ce4);};}exports[_0xb9ac('0x6')]=function(_0x433732){for(var _0x4d0ea3=0x0,_0xeb7a9c=events[_0xb9ac('0x7')];_0x4d0ea3<_0xeb7a9c;_0x4d0ea3++){var _0xef4b29=events[_0x4d0ea3];var _0x413bcb=createListener(_0xb9ac('0x8')+_0xef4b29,_0x433732);SquareProjectEvents['on'](_0xef4b29,_0x413bcb);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 07e3730..1890e55 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x487924,_0x583e4e){var _0x49894f=function(_0x2d08ea){while(--_0x2d08ea){_0x487924['push'](_0x487924['shift']());}};_0x49894f(++_0x583e4e);}(_0x7a54,0x106));var _0x47a5=function(_0x3078dd,_0x5ed944){_0x3078dd=_0x3078dd-0x0;var _0x153aa9=_0x7a54[_0x3078dd];return _0x153aa9;};'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('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x3552e0,_0x6aab7f){var _0x24b02c=function(_0x26e238){while(--_0x26e238){_0x3552e0['push'](_0x3552e0['shift']());}};_0x24b02c(++_0x6aab7f);}(_0x53ec,0x192));var _0xc53e=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x53ec[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 737553b..8a24536 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 _0x9957=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x4829b6,_0x505474){var _0x25f36d=function(_0x31b6e1){while(--_0x31b6e1){_0x4829b6['push'](_0x4829b6['shift']());}};_0x25f36d(++_0x505474);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7995('0x2')]},'extension':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x7995('0x2')]},'saveName':{'type':Sequelize[_0x7995('0x2')]},'filename':{'type':Sequelize[_0x7995('0x2')]},'savePath':{'type':Sequelize[_0x7995('0x2')]},'format':{'type':Sequelize[_0x7995('0x3')],'get':function(){var _0x326741='';var _0x4996ca=this[_0x7995('0x4')](_0x7995('0x5'));if(_0x4996ca){_0x326741=_0x4996ca['substring'](_0x4996ca[_0x7995('0x6')]('.'));}return _0x326741;}}}; \ No newline at end of file +var _0xda19=['getDataValue','exports','STRING','VIRTUAL'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0xda19,0xd5));var _0x9da1=function(_0x4c9019,_0x1720ae){_0x4c9019=_0x4c9019-0x0;var _0x1ba741=_0xda19[_0x4c9019];return _0x1ba741;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'uniqueid':{'type':Sequelize[_0x9da1('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9da1('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9da1('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'dnid':{'type':Sequelize[_0x9da1('0x1')]},'projectName':{'type':Sequelize[_0x9da1('0x1')]},'saveName':{'type':Sequelize[_0x9da1('0x1')]},'filename':{'type':Sequelize[_0x9da1('0x1')]},'savePath':{'type':Sequelize[_0x9da1('0x1')]},'format':{'type':Sequelize[_0x9da1('0x2')],'get':function(){var _0x2c3cdd='';var _0x1c24e6=this[_0x9da1('0x3')]('savePath');if(_0x1c24e6){_0x2c3cdd=_0x1c24e6['substring'](_0x1c24e6['lastIndexOf']('.'));}return _0x2c3cdd;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 5c01185..028460b 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 _0x955f=['create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','send','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','error','name','index','map','SquareRecording','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','find'];(function(_0x267dcb,_0x3c0dfe){var _0x3d1396=function(_0x4d757e){while(--_0x4d757e){_0x267dcb['push'](_0x267dcb['shift']());}};_0x3d1396(++_0x3c0dfe);}(_0x955f,0x78));var _0xf955=function(_0x2d9a3a,_0x288e26){_0x2d9a3a=_0x2d9a3a-0x0;var _0x23f69f=_0x955f[_0x2d9a3a];return _0x23f69f;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require(_0xf955('0x6'));var util=require(_0xf955('0x7'));var path=require(_0xf955('0x8'));var sox=require(_0xf955('0x9'));var csv=require('to-csv');var ejs=require(_0xf955('0xa'));var fs=require('fs');var fs_extra=require(_0xf955('0xb'));var _=require(_0xf955('0xc'));var squel=require(_0xf955('0xd'));var crypto=require(_0xf955('0xe'));var jsforce=require(_0xf955('0xf'));var deskjs=require(_0xf955('0x10'));var toCsv=require(_0xf955('0x11'));var querystring=require(_0xf955('0x12'));var Papa=require('papaparse');var Redis=require(_0xf955('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf955('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf955('0x15'))(_0xf955('0x16'));var utils=require(_0xf955('0x17'));var config=require(_0xf955('0x18'));var licenseUtil=require(_0xf955('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48163b,_0x19d8fb){_0x19d8fb=_0x19d8fb||0xcc;return function(_0x3ad3ba){if(_0x3ad3ba){return _0x48163b[_0xf955('0x1a')](_0x19d8fb);}return _0x48163b[_0xf955('0x1b')](_0x19d8fb)[_0xf955('0x1c')]();};}function respondWithResult(_0x3f04ed,_0x4d34be){_0x4d34be=_0x4d34be||0xc8;return function(_0x5c11cc){if(_0x5c11cc){return _0x3f04ed[_0xf955('0x1b')](_0x4d34be)[_0xf955('0x1d')](_0x5c11cc);}};}function respondWithFilteredResult(_0x14e107,_0x180fa7){return function(_0x49071d){if(_0x49071d){var _0x59b2ac=typeof _0x180fa7[_0xf955('0x1e')]==='undefined'&&typeof _0x180fa7['limit']==='undefined';var _0x2e09c9=_0x49071d[_0xf955('0x1f')];var _0x41694b=_0x59b2ac?0x0:_0x180fa7[_0xf955('0x1e')];var _0x516e4a=_0x59b2ac?_0x49071d[_0xf955('0x1f')]:_0x180fa7[_0xf955('0x1e')]+_0x180fa7[_0xf955('0x20')];var _0x302d0f;if(_0x516e4a>=_0x2e09c9){_0x516e4a=_0x2e09c9;_0x302d0f=0xc8;}else{_0x302d0f=0xce;}_0x14e107[_0xf955('0x1b')](_0x302d0f);return _0x14e107[_0xf955('0x21')]('Content-Range',_0x41694b+'-'+_0x516e4a+'/'+_0x2e09c9)[_0xf955('0x1d')](_0x49071d);}return null;};}function patchUpdates(_0x4d5e03){return function(_0x43cb8a){try{jsonpatch[_0xf955('0x22')](_0x43cb8a,_0x4d5e03,!![]);}catch(_0x3f3ab0){return BPromise['reject'](_0x3f3ab0);}return _0x43cb8a[_0xf955('0x23')]();};}function saveUpdates(_0x30eaeb,_0xd59387){return function(_0x16b12c){if(_0x16b12c){return _0x16b12c[_0xf955('0x24')](_0x30eaeb)[_0xf955('0x25')](function(_0x1a9a89){return _0x1a9a89;});}return null;};}function removeEntity(_0x37617f,_0x26d437){return function(_0x46bade){if(_0x46bade){return _0x46bade[_0xf955('0x26')]()['then'](function(){_0x37617f[_0xf955('0x1b')](0xcc)[_0xf955('0x1c')]();});}};}function handleEntityNotFound(_0xe23c8e,_0x12afd2){return function(_0x51a6d1){if(!_0x51a6d1){_0xe23c8e[_0xf955('0x1a')](0x194);}return _0x51a6d1;};}function handleError(_0x166795,_0x7fc844){_0x7fc844=_0x7fc844||0x1f4;return function(_0x164b48){logger[_0xf955('0x27')](_0x164b48['stack']);if(_0x164b48['name']){delete _0x164b48[_0xf955('0x28')];}_0x166795[_0xf955('0x1b')](_0x7fc844)['send'](_0x164b48);};}exports[_0xf955('0x29')]=function(_0x40c13f,_0x3a192c){var _0x3e3f1b={},_0x902b48={},_0x36cac3={'count':0x0,'rows':[]};var _0x51e4f3=_[_0xf955('0x2a')](db[_0xf955('0x2b')][_0xf955('0x2c')],function(_0x4047a5){return{'name':_0x4047a5[_0xf955('0x2d')],'type':_0x4047a5['type'][_0xf955('0x2e')]};});_0x902b48['model']=_['map'](_0x51e4f3,'name');_0x902b48[_0xf955('0x2f')]=_[_0xf955('0x30')](_0x40c13f[_0xf955('0x2f')]);_0x902b48[_0xf955('0x31')]=_['intersection'](_0x902b48[_0xf955('0x32')],_0x902b48[_0xf955('0x2f')]);_0x3e3f1b[_0xf955('0x33')]=_[_0xf955('0x34')](_0x902b48[_0xf955('0x32')],qs['fields'](_0x40c13f[_0xf955('0x2f')][_0xf955('0x35')]));_0x3e3f1b[_0xf955('0x33')]=_0x3e3f1b[_0xf955('0x33')][_0xf955('0x36')]?_0x3e3f1b['attributes']:_0x902b48['model'];if(!_0x40c13f[_0xf955('0x2f')][_0xf955('0x37')](_0xf955('0x38'))){_0x3e3f1b[_0xf955('0x20')]=qs[_0xf955('0x20')](_0x40c13f[_0xf955('0x2f')]['limit']);_0x3e3f1b[_0xf955('0x1e')]=qs[_0xf955('0x1e')](_0x40c13f[_0xf955('0x2f')][_0xf955('0x1e')]);}_0x3e3f1b[_0xf955('0x39')]=qs[_0xf955('0x3a')](_0x40c13f[_0xf955('0x2f')][_0xf955('0x3a')]);_0x3e3f1b[_0xf955('0x3b')]=qs['filters'](_['pick'](_0x40c13f['query'],_0x902b48[_0xf955('0x31')]),_0x51e4f3);if(_0x40c13f[_0xf955('0x2f')][_0xf955('0x3c')]){_0x3e3f1b[_0xf955('0x3b')]=_['merge'](_0x3e3f1b[_0xf955('0x3b')],{'$or':_[_0xf955('0x2a')](_0x51e4f3,function(_0x4bc6bd){if(_0x4bc6bd[_0xf955('0x3d')]!==_0xf955('0x3e')){var _0x28e2a7={};_0x28e2a7[_0x4bc6bd[_0xf955('0x28')]]={'$like':'%'+_0x40c13f[_0xf955('0x2f')][_0xf955('0x3c')]+'%'};return _0x28e2a7;}})});}_0x3e3f1b=_['merge']({},_0x3e3f1b,_0x40c13f[_0xf955('0x3f')]);var _0x1e76a5={'where':_0x3e3f1b[_0xf955('0x3b')]};return db[_0xf955('0x2b')][_0xf955('0x1f')](_0x1e76a5)[_0xf955('0x25')](function(_0x2ae9b5){_0x36cac3[_0xf955('0x1f')]=_0x2ae9b5;if(_0x40c13f[_0xf955('0x2f')][_0xf955('0x40')]){_0x3e3f1b[_0xf955('0x41')]=[{'all':!![]}];}return db['SquareRecording'][_0xf955('0x42')](_0x3e3f1b);})[_0xf955('0x25')](function(_0x1cb376){_0x36cac3[_0xf955('0x43')]=_0x1cb376;return _0x36cac3;})['then'](respondWithFilteredResult(_0x3a192c,_0x3e3f1b))[_0xf955('0x44')](handleError(_0x3a192c,null));};exports['show']=function(_0x355cd5,_0x3721bf){var _0x1afbd6={'raw':!![],'where':{'id':_0x355cd5[_0xf955('0x45')]['id']}},_0x22b8cb={};_0x22b8cb[_0xf955('0x32')]=_[_0xf955('0x30')](db[_0xf955('0x2b')][_0xf955('0x2c')]);_0x22b8cb[_0xf955('0x2f')]=_['keys'](_0x355cd5[_0xf955('0x2f')]);_0x22b8cb[_0xf955('0x31')]=_[_0xf955('0x34')](_0x22b8cb[_0xf955('0x32')],_0x22b8cb[_0xf955('0x2f')]);_0x1afbd6[_0xf955('0x33')]=_[_0xf955('0x34')](_0x22b8cb[_0xf955('0x32')],qs[_0xf955('0x35')](_0x355cd5['query']['fields']));_0x1afbd6[_0xf955('0x33')]=_0x1afbd6[_0xf955('0x33')][_0xf955('0x36')]?_0x1afbd6[_0xf955('0x33')]:_0x22b8cb[_0xf955('0x32')];if(_0x355cd5['query'][_0xf955('0x40')]){_0x1afbd6['include']=[{'all':!![]}];}_0x1afbd6=_[_0xf955('0x46')]({},_0x1afbd6,_0x355cd5[_0xf955('0x3f')]);return db[_0xf955('0x2b')][_0xf955('0x47')](_0x1afbd6)[_0xf955('0x25')](handleEntityNotFound(_0x3721bf,null))[_0xf955('0x25')](respondWithResult(_0x3721bf,null))[_0xf955('0x44')](handleError(_0x3721bf,null));};exports[_0xf955('0x48')]=function(_0x2e0310,_0x44cd9a){return db['SquareRecording']['create'](_0x2e0310[_0xf955('0x49')],{})[_0xf955('0x25')](respondWithResult(_0x44cd9a,0xc9))[_0xf955('0x44')](handleError(_0x44cd9a,null));};exports[_0xf955('0x24')]=function(_0x3855d8,_0x5d58e7){if(_0x3855d8[_0xf955('0x49')]['id']){delete _0x3855d8[_0xf955('0x49')]['id'];}return db[_0xf955('0x2b')][_0xf955('0x47')]({'where':{'id':_0x3855d8['params']['id']}})[_0xf955('0x25')](handleEntityNotFound(_0x5d58e7,null))[_0xf955('0x25')](saveUpdates(_0x3855d8[_0xf955('0x49')],null))[_0xf955('0x25')](respondWithResult(_0x5d58e7,null))[_0xf955('0x44')](handleError(_0x5d58e7,null));};exports[_0xf955('0x4a')]=function(_0x2dbc34,_0x54e6fd,_0x4cb0d9){var _0xa836b=require('../../components/encryptor');var _0x3e0bb7=![];var _0x496c28={};if(_0x2dbc34[_0xf955('0x2f')][_0xf955('0x3d')]&&_0x2dbc34[_0xf955('0x2f')][_0xf955('0x3d')]==='uniqueid'){_0x496c28[_0xf955('0x4b')]=_0x2dbc34[_0xf955('0x45')]['id'];}else{_0x496c28['id']=_0x2dbc34[_0xf955('0x45')]['id'];}return db['SquareRecording']['find']({'where':_0x496c28,'attributes':['id',_0xf955('0x4c'),_0xf955('0x4d')],'raw':!![]})[_0xf955('0x25')](handleEntityNotFound(_0x54e6fd,null))[_0xf955('0x25')](function(_0x3105e9){if(_0x3105e9){var _0x388471=_0x3105e9[_0xf955('0x4c')];var _0x1c900b=util[_0xf955('0x4e')](_0xf955('0x4f'),_0x388471);if(fs[_0xf955('0x50')](_0x1c900b)){_0x3e0bb7=!![];return _0xa836b['decryptFile'](_0x1c900b,_0x388471,config[_0xf955('0x51')][_0xf955('0x52')])[_0xf955('0x25')](function(){return _0x3105e9;});}return _0x3105e9;}})['then'](function(_0x541595){if(_0x541595){var _0x2cd2f1=_0x541595['savePath'];if(!fs[_0xf955('0x50')](_0x2cd2f1)){throw new db['Sequelize'][(_0xf955('0x53'))](_0xf955('0x54'));}if(_0x541595['filename']){return _0x54e6fd[_0xf955('0x4a')](_0x2cd2f1,_0x541595['filename']+path[_0xf955('0x55')](_0x2cd2f1),function(){if(_0x3e0bb7){fs[_0xf955('0x56')](_0x2cd2f1);}});}else{return _0x54e6fd[_0xf955('0x4a')](_0x2cd2f1,function(_0x4f799b){if(_0x3e0bb7){fs[_0xf955('0x56')](_0x2cd2f1);}});}}})[_0xf955('0x44')](function(_0x5c02ca){if(_0x5c02ca['message']==='SquareRecording\x20not\x20found'){_0x54e6fd['status'](0x194)[_0xf955('0x57')](_0xf955('0x58'));}else{return handleError(_0x54e6fd,null);}});};exports[_0xf955('0x26')]=function(_0x43ef1a,_0x45cc91){return db[_0xf955('0x2b')][_0xf955('0x47')]({'where':{'id':_0x43ef1a[_0xf955('0x45')]['id']}})[_0xf955('0x25')](function(_0x1bd0a9){if(_[_0xf955('0x59')](_0x1bd0a9)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1bd0a9;})['then'](function(_0x180b97){var _0x3852bf=_0x180b97[_0xf955('0x4c')];logger[_0xf955('0x5a')](_0xf955('0x5b'),_0x3852bf);if(!_['isNil'](_0x180b97[_0xf955('0x4c')])&&fs[_0xf955('0x50')](_0x3852bf)){logger[_0xf955('0x5a')]('File:\x20\x22'+_0x3852bf+_0xf955('0x5c'));fs[_0xf955('0x5d')](_0x3852bf);}_0x3852bf=_0x3852bf+_0xf955('0x5e');if(!_[_0xf955('0x59')](_0x180b97[_0xf955('0x4c')])&&fs[_0xf955('0x50')](_0x3852bf)){logger[_0xf955('0x5a')](_0xf955('0x5f')+_0x3852bf+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf955('0x5d')](_0x3852bf);}return _0x180b97;})['then'](function(_0x3d66dd){if(!_0x3d66dd)throw new InternalError();return _0x3d66dd['destroy']();})[_0xf955('0x25')](function(){_0x45cc91[_0xf955('0x1b')](0xcc)[_0xf955('0x1c')]();})[_0xf955('0x44')](handleError(_0x45cc91,null));}; \ No newline at end of file +var _0xf847=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','SquareRecording','find','create','body','update','download','../../components/encryptor','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x13e4db,_0x45ac7e){var _0x5bface=function(_0x45c447){while(--_0x45c447){_0x13e4db['push'](_0x13e4db['shift']());}};_0x5bface(++_0x45ac7e);}(_0xf847,0x148));var _0x7f84=function(_0x36511e,_0x31477c){_0x36511e=_0x36511e-0x0;var _0x17de6f=_0xf847[_0x36511e];return _0x17de6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f84('0x0'));var zipdir=require(_0x7f84('0x1'));var jsonpatch=require(_0x7f84('0x2'));var rp=require(_0x7f84('0x3'));var moment=require(_0x7f84('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f84('0x5'));var util=require(_0x7f84('0x6'));var path=require(_0x7f84('0x7'));var sox=require('sox');var csv=require(_0x7f84('0x8'));var ejs=require(_0x7f84('0x9'));var fs=require('fs');var fs_extra=require(_0x7f84('0xa'));var _=require(_0x7f84('0xb'));var squel=require(_0x7f84('0xc'));var crypto=require(_0x7f84('0xd'));var jsforce=require(_0x7f84('0xe'));var deskjs=require(_0x7f84('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7f84('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7f84('0x11'));var hardwareService=require(_0x7f84('0x12'));var logger=require(_0x7f84('0x13'))(_0x7f84('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7f84('0x15'));var db=require(_0x7f84('0x16'))['db'];function respondWithStatusCode(_0x4cade9,_0xca9f3){_0xca9f3=_0xca9f3||0xcc;return function(_0x287e80){if(_0x287e80){return _0x4cade9[_0x7f84('0x17')](_0xca9f3);}return _0x4cade9[_0x7f84('0x18')](_0xca9f3)[_0x7f84('0x19')]();};}function respondWithResult(_0x12e376,_0x5e5e10){_0x5e5e10=_0x5e5e10||0xc8;return function(_0xb81871){if(_0xb81871){return _0x12e376[_0x7f84('0x18')](_0x5e5e10)[_0x7f84('0x1a')](_0xb81871);}};}function respondWithFilteredResult(_0xdba0cc,_0x541c6b){return function(_0x1a7214){if(_0x1a7214){var _0x47628e=typeof _0x541c6b[_0x7f84('0x1b')]==='undefined'&&typeof _0x541c6b[_0x7f84('0x1c')]===_0x7f84('0x1d');var _0x128872=_0x1a7214[_0x7f84('0x1e')];var _0x1062d1=_0x47628e?0x0:_0x541c6b[_0x7f84('0x1b')];var _0x11b536=_0x47628e?_0x1a7214[_0x7f84('0x1e')]:_0x541c6b['offset']+_0x541c6b[_0x7f84('0x1c')];var _0x5aa068;if(_0x11b536>=_0x128872){_0x11b536=_0x128872;_0x5aa068=0xc8;}else{_0x5aa068=0xce;}_0xdba0cc[_0x7f84('0x18')](_0x5aa068);return _0xdba0cc[_0x7f84('0x1f')](_0x7f84('0x20'),_0x1062d1+'-'+_0x11b536+'/'+_0x128872)[_0x7f84('0x1a')](_0x1a7214);}return null;};}function patchUpdates(_0x2cc417){return function(_0x596df8){try{jsonpatch['apply'](_0x596df8,_0x2cc417,!![]);}catch(_0x1d4a87){return BPromise[_0x7f84('0x21')](_0x1d4a87);}return _0x596df8[_0x7f84('0x22')]();};}function saveUpdates(_0x524d88,_0x4e059d){return function(_0x3ddd18){if(_0x3ddd18){return _0x3ddd18['update'](_0x524d88)['then'](function(_0x35c2e6){return _0x35c2e6;});}return null;};}function removeEntity(_0x3199df,_0x5d91e7){return function(_0x428c67){if(_0x428c67){return _0x428c67['destroy']()[_0x7f84('0x23')](function(){_0x3199df[_0x7f84('0x18')](0xcc)[_0x7f84('0x19')]();});}};}function handleEntityNotFound(_0x757688,_0x1841e6){return function(_0x48559b){if(!_0x48559b){_0x757688[_0x7f84('0x17')](0x194);}return _0x48559b;};}function handleError(_0x5f2d86,_0x283b3e){_0x283b3e=_0x283b3e||0x1f4;return function(_0x32035a){logger[_0x7f84('0x24')](_0x32035a[_0x7f84('0x25')]);if(_0x32035a['name']){delete _0x32035a[_0x7f84('0x26')];}_0x5f2d86[_0x7f84('0x18')](_0x283b3e)[_0x7f84('0x27')](_0x32035a);};}exports[_0x7f84('0x28')]=function(_0x5c1c28,_0x843bb){var _0x4cee5a={},_0x40decd={},_0x4005f0={'count':0x0,'rows':[]};var _0x58aa8c=_['map'](db['SquareRecording'][_0x7f84('0x29')],function(_0x426279){return{'name':_0x426279['fieldName'],'type':_0x426279[_0x7f84('0x2a')]['key']};});_0x40decd[_0x7f84('0x2b')]=_[_0x7f84('0x2c')](_0x58aa8c,'name');_0x40decd[_0x7f84('0x2d')]=_[_0x7f84('0x2e')](_0x5c1c28[_0x7f84('0x2d')]);_0x40decd[_0x7f84('0x2f')]=_[_0x7f84('0x30')](_0x40decd[_0x7f84('0x2b')],_0x40decd[_0x7f84('0x2d')]);_0x4cee5a['attributes']=_[_0x7f84('0x30')](_0x40decd[_0x7f84('0x2b')],qs[_0x7f84('0x31')](_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x31')]));_0x4cee5a[_0x7f84('0x32')]=_0x4cee5a[_0x7f84('0x32')][_0x7f84('0x33')]?_0x4cee5a[_0x7f84('0x32')]:_0x40decd[_0x7f84('0x2b')];if(!_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x34')](_0x7f84('0x35'))){_0x4cee5a[_0x7f84('0x1c')]=qs[_0x7f84('0x1c')](_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x1c')]);_0x4cee5a[_0x7f84('0x1b')]=qs['offset'](_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x1b')]);}_0x4cee5a[_0x7f84('0x36')]=qs[_0x7f84('0x37')](_0x5c1c28['query']['sort']);_0x4cee5a[_0x7f84('0x38')]=qs[_0x7f84('0x2f')](_[_0x7f84('0x39')](_0x5c1c28[_0x7f84('0x2d')],_0x40decd[_0x7f84('0x2f')]),_0x58aa8c);if(_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x3a')]){_0x4cee5a[_0x7f84('0x38')]=_[_0x7f84('0x3b')](_0x4cee5a[_0x7f84('0x38')],{'$or':_[_0x7f84('0x2c')](_0x58aa8c,function(_0x3cbf59){if(_0x3cbf59['type']!==_0x7f84('0x3c')){var _0x42a17e={};_0x42a17e[_0x3cbf59[_0x7f84('0x26')]]={'$like':'%'+_0x5c1c28['query'][_0x7f84('0x3a')]+'%'};return _0x42a17e;}})});}_0x4cee5a=_[_0x7f84('0x3b')]({},_0x4cee5a,_0x5c1c28[_0x7f84('0x3d')]);var _0x44cb38={'where':_0x4cee5a[_0x7f84('0x38')]};return db['SquareRecording'][_0x7f84('0x1e')](_0x44cb38)[_0x7f84('0x23')](function(_0x5c6e0c){_0x4005f0[_0x7f84('0x1e')]=_0x5c6e0c;if(_0x5c1c28[_0x7f84('0x2d')][_0x7f84('0x3e')]){_0x4cee5a[_0x7f84('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0x7f84('0x40')](_0x4cee5a);})['then'](function(_0x2b9245){_0x4005f0[_0x7f84('0x41')]=_0x2b9245;return _0x4005f0;})[_0x7f84('0x23')](respondWithFilteredResult(_0x843bb,_0x4cee5a))[_0x7f84('0x42')](handleError(_0x843bb,null));};exports[_0x7f84('0x43')]=function(_0x5f41d7,_0x41679d){var _0x38ee88={'raw':!![],'where':{'id':_0x5f41d7[_0x7f84('0x44')]['id']}},_0x83aac={};_0x83aac['model']=_[_0x7f84('0x2e')](db[_0x7f84('0x45')]['rawAttributes']);_0x83aac[_0x7f84('0x2d')]=_[_0x7f84('0x2e')](_0x5f41d7[_0x7f84('0x2d')]);_0x83aac[_0x7f84('0x2f')]=_[_0x7f84('0x30')](_0x83aac[_0x7f84('0x2b')],_0x83aac[_0x7f84('0x2d')]);_0x38ee88[_0x7f84('0x32')]=_[_0x7f84('0x30')](_0x83aac[_0x7f84('0x2b')],qs[_0x7f84('0x31')](_0x5f41d7[_0x7f84('0x2d')][_0x7f84('0x31')]));_0x38ee88['attributes']=_0x38ee88[_0x7f84('0x32')][_0x7f84('0x33')]?_0x38ee88[_0x7f84('0x32')]:_0x83aac[_0x7f84('0x2b')];if(_0x5f41d7[_0x7f84('0x2d')][_0x7f84('0x3e')]){_0x38ee88['include']=[{'all':!![]}];}_0x38ee88=_[_0x7f84('0x3b')]({},_0x38ee88,_0x5f41d7[_0x7f84('0x3d')]);return db[_0x7f84('0x45')][_0x7f84('0x46')](_0x38ee88)[_0x7f84('0x23')](handleEntityNotFound(_0x41679d,null))['then'](respondWithResult(_0x41679d,null))[_0x7f84('0x42')](handleError(_0x41679d,null));};exports[_0x7f84('0x47')]=function(_0xf176ab,_0x1810a5){return db[_0x7f84('0x45')][_0x7f84('0x47')](_0xf176ab[_0x7f84('0x48')],{})['then'](respondWithResult(_0x1810a5,0xc9))[_0x7f84('0x42')](handleError(_0x1810a5,null));};exports[_0x7f84('0x49')]=function(_0x23a0a8,_0x5dcdcc){if(_0x23a0a8[_0x7f84('0x48')]['id']){delete _0x23a0a8[_0x7f84('0x48')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x23a0a8['params']['id']}})[_0x7f84('0x23')](handleEntityNotFound(_0x5dcdcc,null))[_0x7f84('0x23')](saveUpdates(_0x23a0a8['body'],null))[_0x7f84('0x23')](respondWithResult(_0x5dcdcc,null))[_0x7f84('0x42')](handleError(_0x5dcdcc,null));};exports[_0x7f84('0x4a')]=function(_0x13910b,_0x47fad4,_0xc89dd6){var _0x4ad6ff=require(_0x7f84('0x4b'));var _0x3a2f36=![];var _0x364840={};if(_0x13910b[_0x7f84('0x2d')]['type']&&_0x13910b[_0x7f84('0x2d')][_0x7f84('0x2a')]==='uniqueid'){_0x364840['uniqueid']=_0x13910b[_0x7f84('0x44')]['id'];}else{_0x364840['id']=_0x13910b[_0x7f84('0x44')]['id'];}return db[_0x7f84('0x45')][_0x7f84('0x46')]({'where':_0x364840,'attributes':['id',_0x7f84('0x4c'),_0x7f84('0x4d')],'raw':!![]})[_0x7f84('0x23')](handleEntityNotFound(_0x47fad4,null))[_0x7f84('0x23')](function(_0x301120){if(_0x301120){var _0x19c59d=_0x301120[_0x7f84('0x4c')];var _0x1c0034=util[_0x7f84('0x4e')](_0x7f84('0x4f'),_0x19c59d);if(fs[_0x7f84('0x50')](_0x1c0034)){_0x3a2f36=!![];return _0x4ad6ff[_0x7f84('0x51')](_0x1c0034,_0x19c59d,config[_0x7f84('0x52')]['recording'])[_0x7f84('0x23')](function(){return _0x301120;});}return _0x301120;}})[_0x7f84('0x23')](function(_0x4dd54c){if(_0x4dd54c){var _0x243ef3=_0x4dd54c[_0x7f84('0x4c')];if(!fs[_0x7f84('0x50')](_0x243ef3)){throw new db[(_0x7f84('0x53'))][(_0x7f84('0x54'))](_0x7f84('0x55'));}if(_0x4dd54c['filename']){return _0x47fad4[_0x7f84('0x4a')](_0x243ef3,_0x4dd54c[_0x7f84('0x4d')]+path['extname'](_0x243ef3),function(){if(_0x3a2f36){fs[_0x7f84('0x56')](_0x243ef3);}});}else{return _0x47fad4[_0x7f84('0x4a')](_0x243ef3,function(_0x2c6e71){if(_0x3a2f36){fs[_0x7f84('0x56')](_0x243ef3);}});}}})[_0x7f84('0x42')](function(_0x59d799){if(_0x59d799['message']==='SquareRecording\x20not\x20found'){_0x47fad4[_0x7f84('0x18')](0x194)['send'](_0x7f84('0x57'));}else{return handleError(_0x47fad4,null);}});};exports[_0x7f84('0x58')]=function(_0x31f4f2,_0x175edc){return db[_0x7f84('0x45')][_0x7f84('0x46')]({'where':{'id':_0x31f4f2[_0x7f84('0x44')]['id']}})[_0x7f84('0x23')](function(_0x4374b5){if(_[_0x7f84('0x59')](_0x4374b5)){throw new ReferenceError(_0x7f84('0x5a'));}return _0x4374b5;})[_0x7f84('0x23')](function(_0x2764ad){var _0x3f5a23=_0x2764ad[_0x7f84('0x4c')];logger['info'](_0x7f84('0x5b'),_0x3f5a23);if(!_[_0x7f84('0x59')](_0x2764ad[_0x7f84('0x4c')])&&fs[_0x7f84('0x50')](_0x3f5a23)){logger[_0x7f84('0x5c')](_0x7f84('0x5d')+_0x3f5a23+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7f84('0x5e')](_0x3f5a23);}_0x3f5a23=_0x3f5a23+_0x7f84('0x5f');if(!_[_0x7f84('0x59')](_0x2764ad['savePath'])&&fs[_0x7f84('0x50')](_0x3f5a23)){logger['info'](_0x7f84('0x5d')+_0x3f5a23+_0x7f84('0x60'));fs[_0x7f84('0x5e')](_0x3f5a23);}return _0x2764ad;})[_0x7f84('0x23')](function(_0xafc175){if(!_0xafc175)throw new InternalError();return _0xafc175[_0x7f84('0x58')]();})[_0x7f84('0x23')](function(){_0x175edc[_0x7f84('0x18')](0xcc)[_0x7f84('0x19')]();})[_0x7f84('0x42')](handleError(_0x175edc,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index cbfc868..fc00987 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 _0x414f=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x53405c,_0x20f2e7){var _0x3c0a52=function(_0x22865c){while(--_0x22865c){_0x53405c['push'](_0x53405c['shift']());}};_0x3c0a52(++_0x20f2e7);}(_0x414f,0x13f));var _0xf414=function(_0x7460d8,_0x2fc1a1){_0x7460d8=_0x7460d8-0x0;var _0x338f82=_0x414f[_0x7460d8];return _0x338f82;};'use strict';var _=require(_0xf414('0x0'));var util=require('util');var logger=require(_0xf414('0x1'))(_0xf414('0x2'));var moment=require('moment');var BPromise=require(_0xf414('0x3'));var rp=require(_0xf414('0x4'));var fs=require('fs');var path=require(_0xf414('0x5'));var rimraf=require(_0xf414('0x6'));var config=require(_0xf414('0x7'));var attributes=require(_0xf414('0x8'));module[_0xf414('0x9')]=function(_0x5dda1d,_0x3be83a){return _0x5dda1d['define'](_0xf414('0xa'),attributes,{'tableName':_0xf414('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7b3=['api','moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','lodash','util'];(function(_0x4d43e0,_0x3a83bd){var _0x2516af=function(_0x8706a5){while(--_0x8706a5){_0x4d43e0['push'](_0x4d43e0['shift']());}};_0x2516af(++_0x3a83bd);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc7b3[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x3c7b('0x0'));var util=require(_0x3c7b('0x1'));var logger=require('../../config/logger')(_0x3c7b('0x2'));var moment=require(_0x3c7b('0x3'));var BPromise=require(_0x3c7b('0x4'));var rp=require(_0x3c7b('0x5'));var fs=require('fs');var path=require(_0x3c7b('0x6'));var rimraf=require(_0x3c7b('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c7b('0x8'));module[_0x3c7b('0x9')]=function(_0x1fa371,_0x55975f){return _0x1fa371[_0x3c7b('0xa')](_0x3c7b('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 7758bc9..20f7bcc 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 _0x0dd7=['create','body','options','raw','CreateSquareRecording','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareRecording'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0dd7,0x1eb));var _0x70dd=function(_0x334d1e,_0x28a488){_0x334d1e=_0x334d1e-0x0;var _0x3b33ba=_0x0dd7[_0x334d1e];return _0x3b33ba;};'use strict';var _=require('lodash');var util=require(_0x70dd('0x0'));var moment=require(_0x70dd('0x1'));var BPromise=require(_0x70dd('0x2'));var rs=require(_0x70dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x70dd('0x4'))(_0x70dd('0x5'));var config=require('../../config/environment');var jayson=require(_0x70dd('0x6'));var client=jayson[_0x70dd('0x7')][_0x70dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f2428,_0x58acd2,_0x47fb84){return new BPromise(function(_0x1b2785,_0x1c89c9){return client[_0x70dd('0x9')](_0x4f2428,_0x47fb84)[_0x70dd('0xa')](function(_0xda1823){logger[_0x70dd('0xb')](_0x70dd('0xc'),_0x58acd2,_0x70dd('0xd'));logger[_0x70dd('0xe')](_0x70dd('0xf'),_0x58acd2,'request\x20sent',JSON[_0x70dd('0x10')](_0xda1823));if(_0xda1823['error']){if(_0xda1823[_0x70dd('0x11')]['code']===0x1f4){logger['error'](_0x70dd('0xc'),_0x58acd2,_0xda1823[_0x70dd('0x11')][_0x70dd('0x12')]);return _0x1c89c9(_0xda1823[_0x70dd('0x11')][_0x70dd('0x12')]);}logger[_0x70dd('0x11')](_0x70dd('0xc'),_0x58acd2,_0xda1823[_0x70dd('0x11')][_0x70dd('0x12')]);return _0x1b2785(_0xda1823[_0x70dd('0x11')][_0x70dd('0x12')]);}else{logger['info'](_0x70dd('0xc'),_0x58acd2,'request\x20sent');_0x1b2785(_0xda1823[_0x70dd('0x13')][_0x70dd('0x12')]);}})[_0x70dd('0x14')](function(_0x42142b){logger[_0x70dd('0x11')](_0x70dd('0xc'),_0x58acd2,_0x42142b);_0x1c89c9(_0x42142b);});});}exports['CreateSquareRecording']=function(_0x59939f){var _0x1d4120=this;return new Promise(function(_0x5a3b1d,_0xfa81df){return db[_0x70dd('0x15')][_0x70dd('0x16')](_0x59939f[_0x70dd('0x17')],{'raw':_0x59939f[_0x70dd('0x18')]?_0x59939f['options'][_0x70dd('0x19')]===undefined?!![]:![]:!![]})[_0x70dd('0xa')](function(_0x402463){logger[_0x70dd('0xb')](_0x70dd('0x1a'),_0x59939f);logger['debug'](_0x70dd('0x1a'),_0x59939f,JSON['stringify'](_0x402463));_0x5a3b1d(_0x402463);})['catch'](function(_0x246520){logger[_0x70dd('0x11')]('CreateSquareRecording',_0x246520['message'],_0x59939f);_0xfa81df(_0x1d4120[_0x70dd('0x11')](0x1f4,_0x246520[_0x70dd('0x12')]));});});}; \ No newline at end of file +var _0x995c=['catch','CreateSquareRecording','SquareRecording','create','body','options','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','SquareRecording,\x20%s,\x20%s','message','info','result'];(function(_0x48b5a2,_0x5014c7){var _0xc7f542=function(_0xa288f5){while(--_0xa288f5){_0x48b5a2['push'](_0x48b5a2['shift']());}};_0xc7f542(++_0x5014c7);}(_0x995c,0xd2));var _0xc995=function(_0x1daf90,_0xe9dcfa){_0x1daf90=_0x1daf90-0x0;var _0x18d544=_0x995c[_0x1daf90];return _0x18d544;};'use strict';var _=require(_0xc995('0x0'));var util=require(_0xc995('0x1'));var moment=require(_0xc995('0x2'));var BPromise=require(_0xc995('0x3'));var rs=require(_0xc995('0x4'));var fs=require('fs');var Redis=require(_0xc995('0x5'));var db=require(_0xc995('0x6'))['db'];var utils=require(_0xc995('0x7'));var logger=require(_0xc995('0x8'))('rpc');var config=require(_0xc995('0x9'));var jayson=require(_0xc995('0xa'));var client=jayson[_0xc995('0xb')][_0xc995('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54f351,_0x3b7dac,_0x568d22){return new BPromise(function(_0x1bfbce,_0x1c0b22){return client[_0xc995('0xd')](_0x54f351,_0x568d22)['then'](function(_0x2eec2f){logger['info']('SquareRecording,\x20%s,\x20%s',_0x3b7dac,_0xc995('0xe'));logger[_0xc995('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3b7dac,'request\x20sent',JSON[_0xc995('0x10')](_0x2eec2f));if(_0x2eec2f[_0xc995('0x11')]){if(_0x2eec2f['error']['code']===0x1f4){logger['error'](_0xc995('0x12'),_0x3b7dac,_0x2eec2f[_0xc995('0x11')][_0xc995('0x13')]);return _0x1c0b22(_0x2eec2f['error'][_0xc995('0x13')]);}logger['error'](_0xc995('0x12'),_0x3b7dac,_0x2eec2f[_0xc995('0x11')]['message']);return _0x1bfbce(_0x2eec2f['error']['message']);}else{logger[_0xc995('0x14')](_0xc995('0x12'),_0x3b7dac,_0xc995('0xe'));_0x1bfbce(_0x2eec2f[_0xc995('0x15')]['message']);}})[_0xc995('0x16')](function(_0x538cdb){logger[_0xc995('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3b7dac,_0x538cdb);_0x1c0b22(_0x538cdb);});});}exports[_0xc995('0x17')]=function(_0x262f89){var _0x3dc47e=this;return new Promise(function(_0x21c0e1,_0x2cbf3e){return db[_0xc995('0x18')][_0xc995('0x19')](_0x262f89[_0xc995('0x1a')],{'raw':_0x262f89[_0xc995('0x1b')]?_0x262f89[_0xc995('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xc995('0x1c')](function(_0x3e5e54){logger[_0xc995('0x14')](_0xc995('0x17'),_0x262f89);logger['debug']('CreateSquareRecording',_0x262f89,JSON[_0xc995('0x10')](_0x3e5e54));_0x21c0e1(_0x3e5e54);})[_0xc995('0x16')](function(_0x1299db){logger[_0xc995('0x11')](_0xc995('0x17'),_0x1299db['message'],_0x262f89);_0x2cbf3e(_0x3dc47e[_0xc995('0x11')](0x1f4,_0x1299db[_0xc995('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9f66b2e..8441988 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2170e4,_0x5b969e){var _0xec86f5=function(_0x44e53e){while(--_0x44e53e){_0x2170e4['push'](_0x2170e4['shift']());}};_0xec86f5(++_0x5b969e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x96643c,_0x5e101c){var _0x359103=function(_0x216871){while(--_0x216871){_0x96643c['push'](_0x96643c['shift']());}};_0x359103(++_0x5e101c);}(_0xe706,0xa3));var _0x6e70=function(_0x34bfd8,_0x24eaa3){_0x34bfd8=_0x34bfd8-0x0;var _0x122c91=_0xe706[_0x34bfd8];return _0x122c91;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index eff452e..fa670de 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 _0x1cd3=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x37ec27,_0x51cfeb){var _0x26f0c2=function(_0x23c0a0){while(--_0x23c0a0){_0x37ec27['push'](_0x37ec27['shift']());}};_0x26f0c2(++_0x51cfeb);}(_0x1cd3,0x6a));var _0x31cd=function(_0x2d0513,_0x503d99){_0x2d0513=_0x2d0513-0x0;var _0x1f389e=_0x1cd3[_0x2d0513];return _0x1f389e;};'use strict';var Sequelize=require(_0x31cd('0x0'));module[_0x31cd('0x1')]={'network':{'type':Sequelize[_0x31cd('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x31cd('0x2')]},'channel':{'type':Sequelize[_0x31cd('0x2')]},'language':{'type':Sequelize[_0x31cd('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x31cd('0x2')]},'callerid':{'type':Sequelize[_0x31cd('0x2')]},'calleridname':{'type':Sequelize[_0x31cd('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x31cd('0x2')]},'callington':{'type':Sequelize[_0x31cd('0x2')]},'callingtns':{'type':Sequelize[_0x31cd('0x2')]},'dnid':{'type':Sequelize[_0x31cd('0x2')]},'rdnis':{'type':Sequelize[_0x31cd('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x31cd('0x2')]},'priority':{'type':Sequelize[_0x31cd('0x2')]},'enhanced':{'type':Sequelize[_0x31cd('0x2')]},'accountcode':{'type':Sequelize[_0x31cd('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x31cd('0x3')]},'leaveAt':{'type':Sequelize[_0x31cd('0x3')]},'bot':{'type':Sequelize[_0x31cd('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x7525=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0x7525,0x1a2));var _0x5752=function(_0x34e9da,_0xd22403){_0x34e9da=_0x34e9da-0x0;var _0x343289=_0x7525[_0x34e9da];return _0x343289;};'use strict';var Sequelize=require(_0x5752('0x0'));module[_0x5752('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x5752('0x2')]},'request':{'type':Sequelize[_0x5752('0x2')]},'channel':{'type':Sequelize[_0x5752('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5752('0x2')]},'uniqueid':{'type':Sequelize[_0x5752('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5752('0x2')]},'calleridname':{'type':Sequelize[_0x5752('0x2')]},'callingpres':{'type':Sequelize[_0x5752('0x2')]},'callingani2':{'type':Sequelize[_0x5752('0x2')]},'callington':{'type':Sequelize[_0x5752('0x2')]},'callingtns':{'type':Sequelize[_0x5752('0x2')]},'dnid':{'type':Sequelize[_0x5752('0x2')]},'rdnis':{'type':Sequelize[_0x5752('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5752('0x2')]},'enhanced':{'type':Sequelize[_0x5752('0x2')]},'accountcode':{'type':Sequelize[_0x5752('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x5752('0x2')]},'joinAt':{'type':Sequelize[_0x5752('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x5752('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 1be6e29..e87d6a2 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 _0x4ba1=['body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','then','destroy','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4ba1,0x144));var _0x14ba=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4ba1[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x14ba('0x0'));var rimraf=require(_0x14ba('0x1'));var zipdir=require(_0x14ba('0x2'));var jsonpatch=require(_0x14ba('0x3'));var rp=require(_0x14ba('0x4'));var moment=require(_0x14ba('0x5'));var BPromise=require(_0x14ba('0x6'));var Mustache=require(_0x14ba('0x7'));var util=require('util');var path=require(_0x14ba('0x8'));var sox=require(_0x14ba('0x9'));var csv=require(_0x14ba('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14ba('0xb'));var squel=require(_0x14ba('0xc'));var crypto=require(_0x14ba('0xd'));var jsforce=require(_0x14ba('0xe'));var deskjs=require(_0x14ba('0xf'));var toCsv=require(_0x14ba('0xa'));var querystring=require(_0x14ba('0x10'));var Papa=require('papaparse');var Redis=require(_0x14ba('0x11'));var authService=require(_0x14ba('0x12'));var qs=require(_0x14ba('0x13'));var as=require(_0x14ba('0x14'));var hardwareService=require(_0x14ba('0x15'));var logger=require(_0x14ba('0x16'))(_0x14ba('0x17'));var utils=require(_0x14ba('0x18'));var config=require(_0x14ba('0x19'));var licenseUtil=require(_0x14ba('0x1a'));var db=require(_0x14ba('0x1b'))['db'];function respondWithStatusCode(_0x38ca06,_0x58128e){_0x58128e=_0x58128e||0xcc;return function(_0x4118ea){if(_0x4118ea){return _0x38ca06['sendStatus'](_0x58128e);}return _0x38ca06[_0x14ba('0x1c')](_0x58128e)['end']();};}function respondWithResult(_0x2a7c4d,_0x5bc07d){_0x5bc07d=_0x5bc07d||0xc8;return function(_0x447e24){if(_0x447e24){return _0x2a7c4d[_0x14ba('0x1c')](_0x5bc07d)[_0x14ba('0x1d')](_0x447e24);}};}function respondWithFilteredResult(_0x9f3358,_0x3c9b58){return function(_0x45a4cf){if(_0x45a4cf){var _0x3e104a=typeof _0x3c9b58['offset']===_0x14ba('0x1e')&&typeof _0x3c9b58[_0x14ba('0x1f')]==='undefined';var _0x1a9e8d=_0x45a4cf['count'];var _0x4d46c2=_0x3e104a?0x0:_0x3c9b58[_0x14ba('0x20')];var _0x417677=_0x3e104a?_0x45a4cf[_0x14ba('0x21')]:_0x3c9b58[_0x14ba('0x20')]+_0x3c9b58['limit'];var _0x14af27;if(_0x417677>=_0x1a9e8d){_0x417677=_0x1a9e8d;_0x14af27=0xc8;}else{_0x14af27=0xce;}_0x9f3358['status'](_0x14af27);return _0x9f3358[_0x14ba('0x22')](_0x14ba('0x23'),_0x4d46c2+'-'+_0x417677+'/'+_0x1a9e8d)[_0x14ba('0x1d')](_0x45a4cf);}return null;};}function patchUpdates(_0x19af66){return function(_0x51fe58){try{jsonpatch[_0x14ba('0x24')](_0x51fe58,_0x19af66,!![]);}catch(_0x18db95){return BPromise['reject'](_0x18db95);}return _0x51fe58['save']();};}function saveUpdates(_0x38ea42,_0x4aa709){return function(_0x3789c7){if(_0x3789c7){return _0x3789c7['update'](_0x38ea42)[_0x14ba('0x25')](function(_0x5543e7){return _0x5543e7;});}return null;};}function removeEntity(_0x5c1e30,_0x1dde3b){return function(_0x4dbe8d){if(_0x4dbe8d){return _0x4dbe8d[_0x14ba('0x26')]()[_0x14ba('0x25')](function(){_0x5c1e30[_0x14ba('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b9585,_0x46e88b){return function(_0x14d366){if(!_0x14d366){_0x1b9585[_0x14ba('0x27')](0x194);}return _0x14d366;};}function handleError(_0x572668,_0x3c9a4a){_0x3c9a4a=_0x3c9a4a||0x1f4;return function(_0x475b30){logger[_0x14ba('0x28')](_0x475b30[_0x14ba('0x29')]);if(_0x475b30['name']){delete _0x475b30[_0x14ba('0x2a')];}_0x572668[_0x14ba('0x1c')](_0x3c9a4a)[_0x14ba('0x2b')](_0x475b30);};}exports[_0x14ba('0x2c')]=function(_0x468262,_0x3a8b15){var _0x5dabbc={},_0x1b8d5a={},_0x278475={'count':0x0,'rows':[]};var _0x57ee2a=_[_0x14ba('0x2d')](db[_0x14ba('0x2e')][_0x14ba('0x2f')],function(_0x51743e){return{'name':_0x51743e[_0x14ba('0x30')],'type':_0x51743e[_0x14ba('0x31')][_0x14ba('0x32')]};});_0x1b8d5a['model']=_[_0x14ba('0x2d')](_0x57ee2a,_0x14ba('0x2a'));_0x1b8d5a['query']=_[_0x14ba('0x33')](_0x468262[_0x14ba('0x34')]);_0x1b8d5a['filters']=_[_0x14ba('0x35')](_0x1b8d5a[_0x14ba('0x36')],_0x1b8d5a[_0x14ba('0x34')]);_0x5dabbc[_0x14ba('0x37')]=_[_0x14ba('0x35')](_0x1b8d5a[_0x14ba('0x36')],qs[_0x14ba('0x38')](_0x468262['query'][_0x14ba('0x38')]));_0x5dabbc['attributes']=_0x5dabbc[_0x14ba('0x37')][_0x14ba('0x39')]?_0x5dabbc[_0x14ba('0x37')]:_0x1b8d5a[_0x14ba('0x36')];if(!_0x468262['query'][_0x14ba('0x3a')](_0x14ba('0x3b'))){_0x5dabbc[_0x14ba('0x1f')]=qs[_0x14ba('0x1f')](_0x468262['query']['limit']);_0x5dabbc[_0x14ba('0x20')]=qs[_0x14ba('0x20')](_0x468262[_0x14ba('0x34')][_0x14ba('0x20')]);}_0x5dabbc[_0x14ba('0x3c')]=qs[_0x14ba('0x3d')](_0x468262['query'][_0x14ba('0x3d')]);_0x5dabbc[_0x14ba('0x3e')]=qs[_0x14ba('0x3f')](_[_0x14ba('0x40')](_0x468262['query'],_0x1b8d5a['filters']),_0x57ee2a);if(_0x468262[_0x14ba('0x34')]['filter']){_0x5dabbc['where']=_[_0x14ba('0x41')](_0x5dabbc[_0x14ba('0x3e')],{'$or':_['map'](_0x57ee2a,function(_0x58a157){if(_0x58a157[_0x14ba('0x31')]!==_0x14ba('0x42')){var _0x38ecd7={};_0x38ecd7[_0x58a157[_0x14ba('0x2a')]]={'$like':'%'+_0x468262[_0x14ba('0x34')]['filter']+'%'};return _0x38ecd7;}})});}_0x5dabbc=_[_0x14ba('0x41')]({},_0x5dabbc,_0x468262[_0x14ba('0x43')]);var _0x3fc25e={'where':_0x5dabbc[_0x14ba('0x3e')]};return db['SquareReport'][_0x14ba('0x21')](_0x3fc25e)['then'](function(_0x319d26){_0x278475[_0x14ba('0x21')]=_0x319d26;if(_0x468262[_0x14ba('0x34')][_0x14ba('0x44')]){_0x5dabbc[_0x14ba('0x45')]=[{'all':!![]}];}return db[_0x14ba('0x2e')][_0x14ba('0x46')](_0x5dabbc);})['then'](function(_0x1034a2){_0x278475[_0x14ba('0x47')]=_0x1034a2;return _0x278475;})[_0x14ba('0x25')](respondWithFilteredResult(_0x3a8b15,_0x5dabbc))[_0x14ba('0x48')](handleError(_0x3a8b15,null));};exports[_0x14ba('0x49')]=function(_0x5280a7,_0x46288f){var _0x5ea8b5={'raw':!![],'where':{'id':_0x5280a7['params']['id']}},_0x4cade1={};_0x4cade1['model']=_[_0x14ba('0x33')](db[_0x14ba('0x2e')][_0x14ba('0x2f')]);_0x4cade1[_0x14ba('0x34')]=_[_0x14ba('0x33')](_0x5280a7['query']);_0x4cade1[_0x14ba('0x3f')]=_[_0x14ba('0x35')](_0x4cade1[_0x14ba('0x36')],_0x4cade1[_0x14ba('0x34')]);_0x5ea8b5[_0x14ba('0x37')]=_[_0x14ba('0x35')](_0x4cade1[_0x14ba('0x36')],qs[_0x14ba('0x38')](_0x5280a7['query'][_0x14ba('0x38')]));_0x5ea8b5['attributes']=_0x5ea8b5[_0x14ba('0x37')][_0x14ba('0x39')]?_0x5ea8b5[_0x14ba('0x37')]:_0x4cade1['model'];if(_0x5280a7[_0x14ba('0x34')][_0x14ba('0x44')]){_0x5ea8b5[_0x14ba('0x45')]=[{'all':!![]}];}_0x5ea8b5=_[_0x14ba('0x41')]({},_0x5ea8b5,_0x5280a7['options']);return db[_0x14ba('0x2e')][_0x14ba('0x4a')](_0x5ea8b5)[_0x14ba('0x25')](handleEntityNotFound(_0x46288f,null))[_0x14ba('0x25')](respondWithResult(_0x46288f,null))[_0x14ba('0x48')](handleError(_0x46288f,null));};exports[_0x14ba('0x4b')]=function(_0x1a6ecd,_0x542512){return db[_0x14ba('0x2e')]['create'](_0x1a6ecd[_0x14ba('0x4c')],{})[_0x14ba('0x25')](respondWithResult(_0x542512,0xc9))[_0x14ba('0x48')](handleError(_0x542512,null));};exports[_0x14ba('0x4d')]=function(_0x3d03b3,_0x6fda2d){if(_0x3d03b3['body']['id']){delete _0x3d03b3[_0x14ba('0x4c')]['id'];}return db['SquareReport'][_0x14ba('0x4a')]({'where':{'id':_0x3d03b3[_0x14ba('0x4e')]['id']}})[_0x14ba('0x25')](handleEntityNotFound(_0x6fda2d,null))[_0x14ba('0x25')](saveUpdates(_0x3d03b3['body'],null))[_0x14ba('0x25')](respondWithResult(_0x6fda2d,null))[_0x14ba('0x48')](handleError(_0x6fda2d,null));};exports[_0x14ba('0x26')]=function(_0x4b476b,_0x54ec8a){return db[_0x14ba('0x2e')][_0x14ba('0x4a')]({'where':{'id':_0x4b476b['params']['id']}})[_0x14ba('0x25')](handleEntityNotFound(_0x54ec8a,null))['then'](removeEntity(_0x54ec8a,null))[_0x14ba('0x48')](handleError(_0x54ec8a,null));};exports['describe']=function(_0x44363f,_0x4fe8da){return db['SquareReport'][_0x14ba('0x4f')]()['then'](respondWithResult(_0x4fe8da,null))['catch'](handleError(_0x4fe8da,null));}; \ No newline at end of file +var _0x9159=['create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','merge','options','count','includeAll','include','findAll','params','keys','find','catch'];(function(_0x493ace,_0x56830c){var _0x2bebe9=function(_0x468553){while(--_0x468553){_0x493ace['push'](_0x493ace['shift']());}};_0x2bebe9(++_0x56830c);}(_0x9159,0x1ba));var _0x9915=function(_0xca04ff,_0xcb449f){_0xca04ff=_0xca04ff-0x0;var _0x6b547=_0x9159[_0xca04ff];return _0x6b547;};'use strict';var emlformat=require(_0x9915('0x0'));var rimraf=require(_0x9915('0x1'));var zipdir=require(_0x9915('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9915('0x3'));var moment=require(_0x9915('0x4'));var BPromise=require(_0x9915('0x5'));var Mustache=require('mustache');var util=require(_0x9915('0x6'));var path=require(_0x9915('0x7'));var sox=require('sox');var csv=require(_0x9915('0x8'));var ejs=require(_0x9915('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9915('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9915('0xb'));var toCsv=require(_0x9915('0x8'));var querystring=require('querystring');var Papa=require(_0x9915('0xc'));var Redis=require(_0x9915('0xd'));var authService=require(_0x9915('0xe'));var qs=require(_0x9915('0xf'));var as=require(_0x9915('0x10'));var hardwareService=require(_0x9915('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x9915('0x12'));var config=require(_0x9915('0x13'));var licenseUtil=require(_0x9915('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbb0dd0,_0x425af3){_0x425af3=_0x425af3||0xcc;return function(_0x5a4d9a){if(_0x5a4d9a){return _0xbb0dd0['sendStatus'](_0x425af3);}return _0xbb0dd0[_0x9915('0x15')](_0x425af3)[_0x9915('0x16')]();};}function respondWithResult(_0xe8fc3,_0x4f8f2c){_0x4f8f2c=_0x4f8f2c||0xc8;return function(_0x2ec0fa){if(_0x2ec0fa){return _0xe8fc3[_0x9915('0x15')](_0x4f8f2c)[_0x9915('0x17')](_0x2ec0fa);}};}function respondWithFilteredResult(_0x41cdd7,_0x28a65e){return function(_0x4f954e){if(_0x4f954e){var _0x35d70f=typeof _0x28a65e[_0x9915('0x18')]===_0x9915('0x19')&&typeof _0x28a65e[_0x9915('0x1a')]===_0x9915('0x19');var _0x320cc7=_0x4f954e['count'];var _0x5e3d39=_0x35d70f?0x0:_0x28a65e[_0x9915('0x18')];var _0x54c578=_0x35d70f?_0x4f954e['count']:_0x28a65e[_0x9915('0x18')]+_0x28a65e[_0x9915('0x1a')];var _0x280f5a;if(_0x54c578>=_0x320cc7){_0x54c578=_0x320cc7;_0x280f5a=0xc8;}else{_0x280f5a=0xce;}_0x41cdd7[_0x9915('0x15')](_0x280f5a);return _0x41cdd7[_0x9915('0x1b')](_0x9915('0x1c'),_0x5e3d39+'-'+_0x54c578+'/'+_0x320cc7)[_0x9915('0x17')](_0x4f954e);}return null;};}function patchUpdates(_0x2d0f61){return function(_0x462ffe){try{jsonpatch[_0x9915('0x1d')](_0x462ffe,_0x2d0f61,!![]);}catch(_0x499599){return BPromise[_0x9915('0x1e')](_0x499599);}return _0x462ffe['save']();};}function saveUpdates(_0x1eabde,_0x121783){return function(_0x16460f){if(_0x16460f){return _0x16460f[_0x9915('0x1f')](_0x1eabde)[_0x9915('0x20')](function(_0x1cc00f){return _0x1cc00f;});}return null;};}function removeEntity(_0x292e5d,_0x173801){return function(_0x1deccc){if(_0x1deccc){return _0x1deccc['destroy']()[_0x9915('0x20')](function(){_0x292e5d['status'](0xcc)[_0x9915('0x16')]();});}};}function handleEntityNotFound(_0x1ad0b8,_0x368104){return function(_0x50fb18){if(!_0x50fb18){_0x1ad0b8['sendStatus'](0x194);}return _0x50fb18;};}function handleError(_0x4aab31,_0x39176a){_0x39176a=_0x39176a||0x1f4;return function(_0x6a90fd){logger[_0x9915('0x21')](_0x6a90fd[_0x9915('0x22')]);if(_0x6a90fd[_0x9915('0x23')]){delete _0x6a90fd[_0x9915('0x23')];}_0x4aab31[_0x9915('0x15')](_0x39176a)[_0x9915('0x24')](_0x6a90fd);};}exports[_0x9915('0x25')]=function(_0x46dc88,_0x5332b1){var _0x59ae26={},_0xdbedbc={},_0x25da16={'count':0x0,'rows':[]};var _0x3d6bfd=_['map'](db[_0x9915('0x26')][_0x9915('0x27')],function(_0x165796){return{'name':_0x165796[_0x9915('0x28')],'type':_0x165796[_0x9915('0x29')][_0x9915('0x2a')]};});_0xdbedbc['model']=_['map'](_0x3d6bfd,'name');_0xdbedbc[_0x9915('0x2b')]=_['keys'](_0x46dc88['query']);_0xdbedbc[_0x9915('0x2c')]=_[_0x9915('0x2d')](_0xdbedbc['model'],_0xdbedbc[_0x9915('0x2b')]);_0x59ae26[_0x9915('0x2e')]=_[_0x9915('0x2d')](_0xdbedbc[_0x9915('0x2f')],qs[_0x9915('0x30')](_0x46dc88[_0x9915('0x2b')][_0x9915('0x30')]));_0x59ae26[_0x9915('0x2e')]=_0x59ae26[_0x9915('0x2e')][_0x9915('0x31')]?_0x59ae26[_0x9915('0x2e')]:_0xdbedbc[_0x9915('0x2f')];if(!_0x46dc88['query'][_0x9915('0x32')](_0x9915('0x33'))){_0x59ae26[_0x9915('0x1a')]=qs['limit'](_0x46dc88['query'][_0x9915('0x1a')]);_0x59ae26[_0x9915('0x18')]=qs[_0x9915('0x18')](_0x46dc88['query']['offset']);}_0x59ae26[_0x9915('0x34')]=qs[_0x9915('0x35')](_0x46dc88[_0x9915('0x2b')][_0x9915('0x35')]);_0x59ae26['where']=qs['filters'](_[_0x9915('0x36')](_0x46dc88[_0x9915('0x2b')],_0xdbedbc[_0x9915('0x2c')]),_0x3d6bfd);if(_0x46dc88['query'][_0x9915('0x37')]){_0x59ae26[_0x9915('0x38')]=_['merge'](_0x59ae26[_0x9915('0x38')],{'$or':_[_0x9915('0x39')](_0x3d6bfd,function(_0x11ecc9){if(_0x11ecc9[_0x9915('0x29')]!==_0x9915('0x3a')){var _0x5d2812={};_0x5d2812[_0x11ecc9[_0x9915('0x23')]]={'$like':'%'+_0x46dc88[_0x9915('0x2b')][_0x9915('0x37')]+'%'};return _0x5d2812;}})});}_0x59ae26=_[_0x9915('0x3b')]({},_0x59ae26,_0x46dc88[_0x9915('0x3c')]);var _0x5a3a99={'where':_0x59ae26['where']};return db[_0x9915('0x26')]['count'](_0x5a3a99)[_0x9915('0x20')](function(_0x126551){_0x25da16[_0x9915('0x3d')]=_0x126551;if(_0x46dc88[_0x9915('0x2b')][_0x9915('0x3e')]){_0x59ae26[_0x9915('0x3f')]=[{'all':!![]}];}return db[_0x9915('0x26')][_0x9915('0x40')](_0x59ae26);})[_0x9915('0x20')](function(_0x5c1a12){_0x25da16['rows']=_0x5c1a12;return _0x25da16;})[_0x9915('0x20')](respondWithFilteredResult(_0x5332b1,_0x59ae26))['catch'](handleError(_0x5332b1,null));};exports['show']=function(_0x4b9625,_0x1879ad){var _0x43c85d={'raw':!![],'where':{'id':_0x4b9625[_0x9915('0x41')]['id']}},_0x25cfb6={};_0x25cfb6[_0x9915('0x2f')]=_[_0x9915('0x42')](db[_0x9915('0x26')][_0x9915('0x27')]);_0x25cfb6[_0x9915('0x2b')]=_['keys'](_0x4b9625[_0x9915('0x2b')]);_0x25cfb6[_0x9915('0x2c')]=_['intersection'](_0x25cfb6[_0x9915('0x2f')],_0x25cfb6[_0x9915('0x2b')]);_0x43c85d[_0x9915('0x2e')]=_['intersection'](_0x25cfb6[_0x9915('0x2f')],qs[_0x9915('0x30')](_0x4b9625['query']['fields']));_0x43c85d[_0x9915('0x2e')]=_0x43c85d[_0x9915('0x2e')][_0x9915('0x31')]?_0x43c85d[_0x9915('0x2e')]:_0x25cfb6[_0x9915('0x2f')];if(_0x4b9625[_0x9915('0x2b')][_0x9915('0x3e')]){_0x43c85d[_0x9915('0x3f')]=[{'all':!![]}];}_0x43c85d=_[_0x9915('0x3b')]({},_0x43c85d,_0x4b9625[_0x9915('0x3c')]);return db[_0x9915('0x26')][_0x9915('0x43')](_0x43c85d)[_0x9915('0x20')](handleEntityNotFound(_0x1879ad,null))[_0x9915('0x20')](respondWithResult(_0x1879ad,null))[_0x9915('0x44')](handleError(_0x1879ad,null));};exports[_0x9915('0x45')]=function(_0xcc0a31,_0x307093){return db[_0x9915('0x26')][_0x9915('0x45')](_0xcc0a31[_0x9915('0x46')],{})[_0x9915('0x20')](respondWithResult(_0x307093,0xc9))[_0x9915('0x44')](handleError(_0x307093,null));};exports[_0x9915('0x1f')]=function(_0x291686,_0x4ac1c3){if(_0x291686[_0x9915('0x46')]['id']){delete _0x291686[_0x9915('0x46')]['id'];}return db[_0x9915('0x26')][_0x9915('0x43')]({'where':{'id':_0x291686[_0x9915('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ac1c3,null))[_0x9915('0x20')](saveUpdates(_0x291686['body'],null))['then'](respondWithResult(_0x4ac1c3,null))[_0x9915('0x44')](handleError(_0x4ac1c3,null));};exports[_0x9915('0x47')]=function(_0x1f948b,_0x3491b4){return db['SquareReport'][_0x9915('0x43')]({'where':{'id':_0x1f948b[_0x9915('0x41')]['id']}})[_0x9915('0x20')](handleEntityNotFound(_0x3491b4,null))[_0x9915('0x20')](removeEntity(_0x3491b4,null))[_0x9915('0x44')](handleError(_0x3491b4,null));};exports['describe']=function(_0x391db4,_0x29887b){return db[_0x9915('0x26')][_0x9915('0x48')]()[_0x9915('0x20')](respondWithResult(_0x29887b,null))[_0x9915('0x44')](handleError(_0x29887b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1c7564a..34c67bf 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 _0xf670=['SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2dea91,_0x1ab491){var _0x42474d=function(_0x4ee9cd){while(--_0x4ee9cd){_0x2dea91['push'](_0x2dea91['shift']());}};_0x42474d(++_0x1ab491);}(_0xf670,0x1c7));var _0x0f67=function(_0x479722,_0x231cef){_0x479722=_0x479722-0x0;var _0x2310fe=_0xf670[_0x479722];return _0x2310fe;};'use strict';var _=require(_0x0f67('0x0'));var util=require('util');var logger=require(_0x0f67('0x1'))(_0x0f67('0x2'));var moment=require('moment');var BPromise=require(_0x0f67('0x3'));var rp=require(_0x0f67('0x4'));var fs=require('fs');var path=require(_0x0f67('0x5'));var rimraf=require(_0x0f67('0x6'));var config=require(_0x0f67('0x7'));var attributes=require('./squareReport.attributes');module[_0x0f67('0x8')]=function(_0x3ea02e,_0x36527b){return _0x3ea02e[_0x0f67('0x9')](_0x0f67('0xa'),attributes,{'tableName':_0x0f67('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x0f67('0xc'),_0x0f67('0xd')]},{'name':_0x0f67('0xe'),'fields':[_0x0f67('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd4d=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0x436c38,_0x1b41bc){var _0x448768=function(_0xa17c59){while(--_0xa17c59){_0x436c38['push'](_0x436c38['shift']());}};_0x448768(++_0x1b41bc);}(_0xfd4d,0x1dc));var _0xdfd4=function(_0x5d4317,_0x175caf){_0x5d4317=_0x5d4317-0x0;var _0x42e674=_0xfd4d[_0x5d4317];return _0x42e674;};'use strict';var _=require(_0xdfd4('0x0'));var util=require('util');var logger=require(_0xdfd4('0x1'))(_0xdfd4('0x2'));var moment=require(_0xdfd4('0x3'));var BPromise=require('bluebird');var rp=require(_0xdfd4('0x4'));var fs=require('fs');var path=require(_0xdfd4('0x5'));var rimraf=require(_0xdfd4('0x6'));var config=require(_0xdfd4('0x7'));var attributes=require(_0xdfd4('0x8'));module[_0xdfd4('0x9')]=function(_0x1ba529,_0x3cd97b){return _0x1ba529[_0xdfd4('0xa')](_0xdfd4('0xb'),attributes,{'tableName':_0xdfd4('0xc'),'paranoid':![],'indexes':[{'name':_0xdfd4('0xd'),'fields':['uniqueid','project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 5beb4b1..fe172a0 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 _0x0433=['http','request','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','SquareReport','create','body','then','CreateSquareReport','catch','update','options','where','attributes','limit','UpdateSquareReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0433,0x16c));var _0x3043=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x0433[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x3043('0x0'));var util=require(_0x3043('0x1'));var moment=require(_0x3043('0x2'));var BPromise=require('bluebird');var rs=require(_0x3043('0x3'));var fs=require('fs');var Redis=require(_0x3043('0x4'));var db=require(_0x3043('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3043('0x6'))(_0x3043('0x7'));var config=require(_0x3043('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3043('0x9')][_0x3043('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x314274,_0x1e9d2a,_0x17cb46){return new BPromise(function(_0xda0871,_0x4e8dfb){return client[_0x3043('0xb')](_0x314274,_0x17cb46)['then'](function(_0x14354d){logger[_0x3043('0xc')]('SquareReport,\x20%s,\x20%s',_0x1e9d2a,_0x3043('0xd'));logger[_0x3043('0xe')](_0x3043('0xf'),_0x1e9d2a,_0x3043('0xd'),JSON[_0x3043('0x10')](_0x14354d));if(_0x14354d[_0x3043('0x11')]){if(_0x14354d[_0x3043('0x11')][_0x3043('0x12')]===0x1f4){logger[_0x3043('0x11')](_0x3043('0x13'),_0x1e9d2a,_0x14354d[_0x3043('0x11')]['message']);return _0x4e8dfb(_0x14354d['error'][_0x3043('0x14')]);}logger['error'](_0x3043('0x13'),_0x1e9d2a,_0x14354d[_0x3043('0x11')]['message']);return _0xda0871(_0x14354d[_0x3043('0x11')][_0x3043('0x14')]);}else{logger[_0x3043('0xc')](_0x3043('0x13'),_0x1e9d2a,'request\x20sent');_0xda0871(_0x14354d[_0x3043('0x15')][_0x3043('0x14')]);}})['catch'](function(_0x48169b){logger[_0x3043('0x11')](_0x3043('0x13'),_0x1e9d2a,_0x48169b);_0x4e8dfb(_0x48169b);});});}exports['CreateSquareReport']=function(_0x5ddc83){var _0x45fa6b=this;return new Promise(function(_0x172a88,_0x29ee2c){return db[_0x3043('0x16')][_0x3043('0x17')](_0x5ddc83[_0x3043('0x18')],{'raw':_0x5ddc83['options']?_0x5ddc83['options']['raw']===undefined?!![]:![]:!![]})[_0x3043('0x19')](function(_0x254a1c){logger['info']('CreateSquareReport',_0x5ddc83);logger[_0x3043('0xe')](_0x3043('0x1a'),_0x5ddc83,JSON[_0x3043('0x10')](_0x254a1c));_0x172a88(_0x254a1c);})[_0x3043('0x1b')](function(_0x20c0fb){logger[_0x3043('0x11')](_0x3043('0x1a'),_0x20c0fb['message'],_0x5ddc83);_0x29ee2c(_0x45fa6b[_0x3043('0x11')](0x1f4,_0x20c0fb[_0x3043('0x14')]));});});};exports['UpdateSquareReport']=function(_0xa6c680){var _0x23f362=this;return new Promise(function(_0x1b167f,_0x958a03){return db['SquareReport'][_0x3043('0x1c')](_0xa6c680[_0x3043('0x18')],{'raw':_0xa6c680[_0x3043('0x1d')]?_0xa6c680[_0x3043('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa6c680[_0x3043('0x1d')]?_0xa6c680[_0x3043('0x1d')][_0x3043('0x1e')]||null:null,'attributes':_0xa6c680[_0x3043('0x1d')]?_0xa6c680[_0x3043('0x1d')][_0x3043('0x1f')]||null:null,'limit':_0xa6c680[_0x3043('0x1d')]?_0xa6c680['options'][_0x3043('0x20')]||null:null})[_0x3043('0x19')](function(_0x5a28e5){logger['info'](_0x3043('0x21'),_0xa6c680);logger[_0x3043('0xe')](_0x3043('0x21'),_0xa6c680,JSON['stringify'](_0x5a28e5));_0x1b167f(_0x5a28e5);})['catch'](function(_0x2f620d){logger[_0x3043('0x11')]('UpdateSquareReport',_0x2f620d[_0x3043('0x14')],_0xa6c680);_0x958a03(_0x23f362[_0x3043('0x11')](0x1f4,_0x2f620d[_0x3043('0x14')]));});});}; \ No newline at end of file +var _0x445a=['debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x445a,0x18d));var _0xa445=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x445a[_0x432682];return _0x463d05;};'use strict';var _=require(_0xa445('0x0'));var util=require(_0xa445('0x1'));var moment=require(_0xa445('0x2'));var BPromise=require(_0xa445('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa445('0x4'));var db=require(_0xa445('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa445('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa445('0x7'));var client=jayson[_0xa445('0x8')][_0xa445('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bee35,_0x1e2a2c,_0xd041cb){return new BPromise(function(_0x3a19f8,_0x46f219){return client[_0xa445('0xa')](_0x4bee35,_0xd041cb)[_0xa445('0xb')](function(_0xaad3ea){logger[_0xa445('0xc')](_0xa445('0xd'),_0x1e2a2c,_0xa445('0xe'));logger['debug'](_0xa445('0xf'),_0x1e2a2c,_0xa445('0xe'),JSON[_0xa445('0x10')](_0xaad3ea));if(_0xaad3ea[_0xa445('0x11')]){if(_0xaad3ea[_0xa445('0x11')][_0xa445('0x12')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x1e2a2c,_0xaad3ea[_0xa445('0x11')][_0xa445('0x13')]);return _0x46f219(_0xaad3ea[_0xa445('0x11')][_0xa445('0x13')]);}logger[_0xa445('0x11')]('SquareReport,\x20%s,\x20%s',_0x1e2a2c,_0xaad3ea[_0xa445('0x11')]['message']);return _0x3a19f8(_0xaad3ea[_0xa445('0x11')][_0xa445('0x13')]);}else{logger['info'](_0xa445('0xd'),_0x1e2a2c,'request\x20sent');_0x3a19f8(_0xaad3ea[_0xa445('0x14')][_0xa445('0x13')]);}})[_0xa445('0x15')](function(_0x1866c5){logger['error']('SquareReport,\x20%s,\x20%s',_0x1e2a2c,_0x1866c5);_0x46f219(_0x1866c5);});});}exports[_0xa445('0x16')]=function(_0xb8b538){var _0x44de1c=this;return new Promise(function(_0x295844,_0x43c07d){return db[_0xa445('0x17')][_0xa445('0x18')](_0xb8b538[_0xa445('0x19')],{'raw':_0xb8b538[_0xa445('0x1a')]?_0xb8b538['options'][_0xa445('0x1b')]===undefined?!![]:![]:!![]})[_0xa445('0xb')](function(_0x393e0f){logger[_0xa445('0xc')](_0xa445('0x16'),_0xb8b538);logger['debug'](_0xa445('0x16'),_0xb8b538,JSON[_0xa445('0x10')](_0x393e0f));_0x295844(_0x393e0f);})[_0xa445('0x15')](function(_0x1e7e7d){logger[_0xa445('0x11')]('CreateSquareReport',_0x1e7e7d[_0xa445('0x13')],_0xb8b538);_0x43c07d(_0x44de1c['error'](0x1f4,_0x1e7e7d[_0xa445('0x13')]));});});};exports[_0xa445('0x1c')]=function(_0x57bf11){var _0x5537e2=this;return new Promise(function(_0x43b59c,_0x5dd94a){return db[_0xa445('0x17')]['update'](_0x57bf11['body'],{'raw':_0x57bf11[_0xa445('0x1a')]?_0x57bf11['options'][_0xa445('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57bf11['options']?_0x57bf11[_0xa445('0x1a')][_0xa445('0x1d')]||null:null,'attributes':_0x57bf11[_0xa445('0x1a')]?_0x57bf11[_0xa445('0x1a')][_0xa445('0x1e')]||null:null,'limit':_0x57bf11[_0xa445('0x1a')]?_0x57bf11['options'][_0xa445('0x1f')]||null:null})[_0xa445('0xb')](function(_0x156e17){logger['info'](_0xa445('0x1c'),_0x57bf11);logger[_0xa445('0x20')](_0xa445('0x1c'),_0x57bf11,JSON[_0xa445('0x10')](_0x156e17));_0x43b59c(_0x156e17);})[_0xa445('0x15')](function(_0x353983){logger[_0xa445('0x11')]('UpdateSquareReport',_0x353983[_0xa445('0x13')],_0x57bf11);_0x5dd94a(_0x5537e2[_0xa445('0x11')](0x1f4,_0x353983[_0xa445('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index db6a76e..ef040a6 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 _0x9d1a=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x6204bd,_0x5538cd){var _0x1bd5f2=function(_0x4f816f){while(--_0x4f816f){_0x6204bd['push'](_0x6204bd['shift']());}};_0x1bd5f2(++_0x5538cd);}(_0x9d1a,0x1b4));var _0xa9d1=function(_0x46763f,_0x473c32){_0x46763f=_0x46763f-0x0;var _0x22d8d4=_0x9d1a[_0x46763f];return _0x22d8d4;};'use strict';var multer=require('multer');var util=require(_0xa9d1('0x0'));var path=require(_0xa9d1('0x1'));var timeout=require(_0xa9d1('0x2'));var express=require(_0xa9d1('0x3'));var router=express[_0xa9d1('0x4')]();var fs_extra=require(_0xa9d1('0x5'));var auth=require(_0xa9d1('0x6'));var interaction=require(_0xa9d1('0x7'));var config=require(_0xa9d1('0x8'));var controller=require(_0xa9d1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xa9d1('0xa')]);router[_0xa9d1('0xb')](_0xa9d1('0xc'),auth[_0xa9d1('0xd')](),controller[_0xa9d1('0xe')]);router[_0xa9d1('0xb')](_0xa9d1('0xf'),auth[_0xa9d1('0xd')](),controller[_0xa9d1('0x10')]);router[_0xa9d1('0x11')]('/',auth[_0xa9d1('0xd')](),controller[_0xa9d1('0x12')]);router[_0xa9d1('0x13')]('/:id',auth[_0xa9d1('0xd')](),controller[_0xa9d1('0x14')]);router[_0xa9d1('0x15')](_0xa9d1('0xf'),auth[_0xa9d1('0xd')](),controller[_0xa9d1('0x16')]);module[_0xa9d1('0x17')]=router; \ No newline at end of file +var _0x4b63=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x102039,_0xc5e588){var _0x43388d=function(_0x4c5790){while(--_0x4c5790){_0x102039['push'](_0x102039['shift']());}};_0x43388d(++_0xc5e588);}(_0x4b63,0x143));var _0x34b6=function(_0x8f47ba,_0x512d97){_0x8f47ba=_0x8f47ba-0x0;var _0x36918c=_0x4b63[_0x8f47ba];return _0x36918c;};'use strict';var multer=require(_0x34b6('0x0'));var util=require('util');var path=require(_0x34b6('0x1'));var timeout=require(_0x34b6('0x2'));var express=require('express');var router=express[_0x34b6('0x3')]();var fs_extra=require(_0x34b6('0x4'));var auth=require(_0x34b6('0x5'));var interaction=require(_0x34b6('0x6'));var config=require(_0x34b6('0x7'));var controller=require(_0x34b6('0x8'));router['get']('/',auth[_0x34b6('0x9')](),controller[_0x34b6('0xa')]);router['get']('/describe',auth[_0x34b6('0x9')](),controller['describe']);router['get'](_0x34b6('0xb'),auth[_0x34b6('0x9')](),controller[_0x34b6('0xc')]);router[_0x34b6('0xd')]('/',auth[_0x34b6('0x9')](),controller['create']);router[_0x34b6('0xe')](_0x34b6('0xb'),auth[_0x34b6('0x9')](),controller[_0x34b6('0xf')]);router[_0x34b6('0x10')](_0x34b6('0xb'),auth['isAuthenticated'](),controller[_0x34b6('0x11')]);module[_0x34b6('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e071296..daeb1c8 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 _0x87b8=['exports','STRING','TEXT','sequelize'];(function(_0x457d82,_0x5b0d3){var _0x52e24d=function(_0x440953){while(--_0x440953){_0x457d82['push'](_0x457d82['shift']());}};_0x52e24d(++_0x5b0d3);}(_0x87b8,0xd3));var _0x887b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x87b8[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x887b('0x0'));module[_0x887b('0x1')]={'uniqueid':{'type':Sequelize[_0x887b('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x887b('0x2')]},'data':{'type':Sequelize[_0x887b('0x3')]},'project_name':{'type':Sequelize[_0x887b('0x2')]},'callerid':{'type':Sequelize[_0x887b('0x2')]}}; \ No newline at end of file +var _0x43b5=['sequelize','exports','STRING','TEXT'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x43b5,0x198));var _0x543b=function(_0x13743b,_0x246844){_0x13743b=_0x13743b-0x0;var _0x2374aa=_0x43b5[_0x13743b];return _0x2374aa;};'use strict';var Sequelize=require(_0x543b('0x0'));module[_0x543b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x543b('0x2')]},'application':{'type':Sequelize[_0x543b('0x2')]},'data':{'type':Sequelize[_0x543b('0x3')]},'project_name':{'type':Sequelize[_0x543b('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index d0b8004..1511f36 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 _0x1e0d=['Content-Range','apply','reject','save','update','then','error','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x115a0f,_0x46c0ae){var _0x2b53a0=function(_0x5ad110){while(--_0x5ad110){_0x115a0f['push'](_0x115a0f['shift']());}};_0x2b53a0(++_0x46c0ae);}(_0x1e0d,0x1bd));var _0xd1e0=function(_0x3f279e,_0x145e9a){_0x3f279e=_0x3f279e-0x0;var _0x57ae2d=_0x1e0d[_0x3f279e];return _0x57ae2d;};'use strict';var emlformat=require(_0xd1e0('0x0'));var rimraf=require(_0xd1e0('0x1'));var zipdir=require(_0xd1e0('0x2'));var jsonpatch=require(_0xd1e0('0x3'));var rp=require(_0xd1e0('0x4'));var moment=require(_0xd1e0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd1e0('0x6'));var util=require(_0xd1e0('0x7'));var path=require(_0xd1e0('0x8'));var sox=require(_0xd1e0('0x9'));var csv=require(_0xd1e0('0xa'));var ejs=require(_0xd1e0('0xb'));var fs=require('fs');var fs_extra=require(_0xd1e0('0xc'));var _=require(_0xd1e0('0xd'));var squel=require(_0xd1e0('0xe'));var crypto=require(_0xd1e0('0xf'));var jsforce=require(_0xd1e0('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd1e0('0xa'));var querystring=require('querystring');var Papa=require(_0xd1e0('0x11'));var Redis=require(_0xd1e0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd1e0('0x13'));var as=require(_0xd1e0('0x14'));var hardwareService=require(_0xd1e0('0x15'));var logger=require(_0xd1e0('0x16'))(_0xd1e0('0x17'));var utils=require(_0xd1e0('0x18'));var config=require(_0xd1e0('0x19'));var licenseUtil=require(_0xd1e0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3891,_0x2ab37b){_0x2ab37b=_0x2ab37b||0xcc;return function(_0x9f7abf){if(_0x9f7abf){return _0x2b3891[_0xd1e0('0x1b')](_0x2ab37b);}return _0x2b3891[_0xd1e0('0x1c')](_0x2ab37b)[_0xd1e0('0x1d')]();};}function respondWithResult(_0x3b36a6,_0x9db463){_0x9db463=_0x9db463||0xc8;return function(_0x2f893d){if(_0x2f893d){return _0x3b36a6[_0xd1e0('0x1c')](_0x9db463)[_0xd1e0('0x1e')](_0x2f893d);}};}function respondWithFilteredResult(_0x2ac454,_0x39558a){return function(_0x2963eb){if(_0x2963eb){var _0x28c29c=typeof _0x39558a[_0xd1e0('0x1f')]===_0xd1e0('0x20')&&typeof _0x39558a[_0xd1e0('0x21')]===_0xd1e0('0x20');var _0x52188e=_0x2963eb['count'];var _0xefd336=_0x28c29c?0x0:_0x39558a[_0xd1e0('0x1f')];var _0x12d8c1=_0x28c29c?_0x2963eb[_0xd1e0('0x22')]:_0x39558a[_0xd1e0('0x1f')]+_0x39558a[_0xd1e0('0x21')];var _0x2aeb65;if(_0x12d8c1>=_0x52188e){_0x12d8c1=_0x52188e;_0x2aeb65=0xc8;}else{_0x2aeb65=0xce;}_0x2ac454[_0xd1e0('0x1c')](_0x2aeb65);return _0x2ac454['set'](_0xd1e0('0x23'),_0xefd336+'-'+_0x12d8c1+'/'+_0x52188e)[_0xd1e0('0x1e')](_0x2963eb);}return null;};}function patchUpdates(_0x35c2b2){return function(_0x1823c6){try{jsonpatch[_0xd1e0('0x24')](_0x1823c6,_0x35c2b2,!![]);}catch(_0x5c7227){return BPromise[_0xd1e0('0x25')](_0x5c7227);}return _0x1823c6[_0xd1e0('0x26')]();};}function saveUpdates(_0x568a3c,_0x1773c7){return function(_0x14324d){if(_0x14324d){return _0x14324d[_0xd1e0('0x27')](_0x568a3c)[_0xd1e0('0x28')](function(_0x6c6acf){return _0x6c6acf;});}return null;};}function removeEntity(_0x45088d,_0x1d1e67){return function(_0x443b62){if(_0x443b62){return _0x443b62['destroy']()[_0xd1e0('0x28')](function(){_0x45088d[_0xd1e0('0x1c')](0xcc)[_0xd1e0('0x1d')]();});}};}function handleEntityNotFound(_0x39d87c,_0x3bd3e3){return function(_0x375de9){if(!_0x375de9){_0x39d87c['sendStatus'](0x194);}return _0x375de9;};}function handleError(_0x14f4a3,_0x4298b4){_0x4298b4=_0x4298b4||0x1f4;return function(_0x276de4){logger[_0xd1e0('0x29')](_0x276de4['stack']);if(_0x276de4[_0xd1e0('0x2a')]){delete _0x276de4[_0xd1e0('0x2a')];}_0x14f4a3[_0xd1e0('0x1c')](_0x4298b4)[_0xd1e0('0x2b')](_0x276de4);};}exports[_0xd1e0('0x2c')]=function(_0x3ead95,_0x5e9b64){var _0x2d027e={},_0x119f61={},_0x23f799={'count':0x0,'rows':[]};var _0x189572=_[_0xd1e0('0x2d')](db[_0xd1e0('0x2e')][_0xd1e0('0x2f')],function(_0x679c6e){return{'name':_0x679c6e['fieldName'],'type':_0x679c6e[_0xd1e0('0x30')][_0xd1e0('0x31')]};});_0x119f61[_0xd1e0('0x32')]=_['map'](_0x189572,_0xd1e0('0x2a'));_0x119f61[_0xd1e0('0x33')]=_[_0xd1e0('0x34')](_0x3ead95[_0xd1e0('0x33')]);_0x119f61[_0xd1e0('0x35')]=_['intersection'](_0x119f61[_0xd1e0('0x32')],_0x119f61[_0xd1e0('0x33')]);_0x2d027e[_0xd1e0('0x36')]=_[_0xd1e0('0x37')](_0x119f61['model'],qs['fields'](_0x3ead95[_0xd1e0('0x33')][_0xd1e0('0x38')]));_0x2d027e[_0xd1e0('0x36')]=_0x2d027e['attributes'][_0xd1e0('0x39')]?_0x2d027e[_0xd1e0('0x36')]:_0x119f61[_0xd1e0('0x32')];if(!_0x3ead95['query'][_0xd1e0('0x3a')](_0xd1e0('0x3b'))){_0x2d027e[_0xd1e0('0x21')]=qs[_0xd1e0('0x21')](_0x3ead95[_0xd1e0('0x33')][_0xd1e0('0x21')]);_0x2d027e[_0xd1e0('0x1f')]=qs[_0xd1e0('0x1f')](_0x3ead95['query'][_0xd1e0('0x1f')]);}_0x2d027e[_0xd1e0('0x3c')]=qs[_0xd1e0('0x3d')](_0x3ead95[_0xd1e0('0x33')][_0xd1e0('0x3d')]);_0x2d027e[_0xd1e0('0x3e')]=qs[_0xd1e0('0x35')](_[_0xd1e0('0x3f')](_0x3ead95[_0xd1e0('0x33')],_0x119f61[_0xd1e0('0x35')]),_0x189572);if(_0x3ead95['query'][_0xd1e0('0x40')]){_0x2d027e[_0xd1e0('0x3e')]=_[_0xd1e0('0x41')](_0x2d027e[_0xd1e0('0x3e')],{'$or':_[_0xd1e0('0x2d')](_0x189572,function(_0x102414){if(_0x102414[_0xd1e0('0x30')]!==_0xd1e0('0x42')){var _0x16dd25={};_0x16dd25[_0x102414['name']]={'$like':'%'+_0x3ead95['query'][_0xd1e0('0x40')]+'%'};return _0x16dd25;}})});}_0x2d027e=_[_0xd1e0('0x41')]({},_0x2d027e,_0x3ead95[_0xd1e0('0x43')]);var _0x562f76={'where':_0x2d027e['where']};return db[_0xd1e0('0x2e')][_0xd1e0('0x22')](_0x562f76)['then'](function(_0x5f41fc){_0x23f799['count']=_0x5f41fc;if(_0x3ead95['query'][_0xd1e0('0x44')]){_0x2d027e[_0xd1e0('0x45')]=[{'all':!![]}];}return db[_0xd1e0('0x2e')][_0xd1e0('0x46')](_0x2d027e);})[_0xd1e0('0x28')](function(_0x52ed80){_0x23f799[_0xd1e0('0x47')]=_0x52ed80;return _0x23f799;})[_0xd1e0('0x28')](respondWithFilteredResult(_0x5e9b64,_0x2d027e))[_0xd1e0('0x48')](handleError(_0x5e9b64,null));};exports[_0xd1e0('0x49')]=function(_0x3ce102,_0x3732d8){var _0x79dc50={'raw':!![],'where':{'id':_0x3ce102[_0xd1e0('0x4a')]['id']}},_0x89a8f2={};_0x89a8f2[_0xd1e0('0x32')]=_['keys'](db[_0xd1e0('0x2e')]['rawAttributes']);_0x89a8f2[_0xd1e0('0x33')]=_[_0xd1e0('0x34')](_0x3ce102[_0xd1e0('0x33')]);_0x89a8f2['filters']=_[_0xd1e0('0x37')](_0x89a8f2['model'],_0x89a8f2['query']);_0x79dc50[_0xd1e0('0x36')]=_[_0xd1e0('0x37')](_0x89a8f2[_0xd1e0('0x32')],qs[_0xd1e0('0x38')](_0x3ce102[_0xd1e0('0x33')][_0xd1e0('0x38')]));_0x79dc50[_0xd1e0('0x36')]=_0x79dc50['attributes'][_0xd1e0('0x39')]?_0x79dc50[_0xd1e0('0x36')]:_0x89a8f2[_0xd1e0('0x32')];if(_0x3ce102['query'][_0xd1e0('0x44')]){_0x79dc50['include']=[{'all':!![]}];}_0x79dc50=_[_0xd1e0('0x41')]({},_0x79dc50,_0x3ce102[_0xd1e0('0x43')]);return db['SquareDetailsReport'][_0xd1e0('0x4b')](_0x79dc50)[_0xd1e0('0x28')](handleEntityNotFound(_0x3732d8,null))[_0xd1e0('0x28')](respondWithResult(_0x3732d8,null))[_0xd1e0('0x48')](handleError(_0x3732d8,null));};exports['create']=function(_0x12137f,_0x485b57){return db[_0xd1e0('0x2e')][_0xd1e0('0x4c')](_0x12137f[_0xd1e0('0x4d')],{})[_0xd1e0('0x28')](respondWithResult(_0x485b57,0xc9))[_0xd1e0('0x48')](handleError(_0x485b57,null));};exports['update']=function(_0x3725d9,_0x4ffe7){if(_0x3725d9[_0xd1e0('0x4d')]['id']){delete _0x3725d9[_0xd1e0('0x4d')]['id'];}return db[_0xd1e0('0x2e')]['find']({'where':{'id':_0x3725d9['params']['id']}})[_0xd1e0('0x28')](handleEntityNotFound(_0x4ffe7,null))[_0xd1e0('0x28')](saveUpdates(_0x3725d9[_0xd1e0('0x4d')],null))[_0xd1e0('0x28')](respondWithResult(_0x4ffe7,null))[_0xd1e0('0x48')](handleError(_0x4ffe7,null));};exports[_0xd1e0('0x4e')]=function(_0x1c118d,_0x8058e7){return db[_0xd1e0('0x2e')][_0xd1e0('0x4b')]({'where':{'id':_0x1c118d['params']['id']}})['then'](handleEntityNotFound(_0x8058e7,null))[_0xd1e0('0x28')](removeEntity(_0x8058e7,null))['catch'](handleError(_0x8058e7,null));};exports[_0xd1e0('0x4f')]=function(_0x167515,_0x238025){return db[_0xd1e0('0x2e')][_0xd1e0('0x4f')]()[_0xd1e0('0x28')](respondWithResult(_0x238025,null))['catch'](handleError(_0x238025,null));}; \ No newline at end of file +var _0xb6e5=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','SquareDetailsReport','rawAttributes','model','map','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x18b2a2,_0x68b277){var _0x3054f9=function(_0x2059b4){while(--_0x2059b4){_0x18b2a2['push'](_0x18b2a2['shift']());}};_0x3054f9(++_0x68b277);}(_0xb6e5,0x81));var _0x5b6e=function(_0x62f0cd,_0x5172ba){_0x62f0cd=_0x62f0cd-0x0;var _0x1e15e1=_0xb6e5[_0x62f0cd];return _0x1e15e1;};'use strict';var emlformat=require(_0x5b6e('0x0'));var rimraf=require(_0x5b6e('0x1'));var zipdir=require(_0x5b6e('0x2'));var jsonpatch=require(_0x5b6e('0x3'));var rp=require(_0x5b6e('0x4'));var moment=require(_0x5b6e('0x5'));var BPromise=require(_0x5b6e('0x6'));var Mustache=require('mustache');var util=require(_0x5b6e('0x7'));var path=require(_0x5b6e('0x8'));var sox=require(_0x5b6e('0x9'));var csv=require('to-csv');var ejs=require(_0x5b6e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b6e('0xb'));var squel=require(_0x5b6e('0xc'));var crypto=require(_0x5b6e('0xd'));var jsforce=require(_0x5b6e('0xe'));var deskjs=require(_0x5b6e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5b6e('0x10'));var Papa=require(_0x5b6e('0x11'));var Redis=require(_0x5b6e('0x12'));var authService=require(_0x5b6e('0x13'));var qs=require(_0x5b6e('0x14'));var as=require(_0x5b6e('0x15'));var hardwareService=require(_0x5b6e('0x16'));var logger=require(_0x5b6e('0x17'))(_0x5b6e('0x18'));var utils=require('../../config/utils');var config=require(_0x5b6e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b6e('0x1a'))['db'];function respondWithStatusCode(_0x5cfece,_0x53d585){_0x53d585=_0x53d585||0xcc;return function(_0x10435d){if(_0x10435d){return _0x5cfece[_0x5b6e('0x1b')](_0x53d585);}return _0x5cfece['status'](_0x53d585)[_0x5b6e('0x1c')]();};}function respondWithResult(_0x3bbeff,_0x235356){_0x235356=_0x235356||0xc8;return function(_0x13fb99){if(_0x13fb99){return _0x3bbeff[_0x5b6e('0x1d')](_0x235356)[_0x5b6e('0x1e')](_0x13fb99);}};}function respondWithFilteredResult(_0x89385a,_0x44a5f5){return function(_0x1142f2){if(_0x1142f2){var _0x22c1fc=typeof _0x44a5f5[_0x5b6e('0x1f')]===_0x5b6e('0x20')&&typeof _0x44a5f5[_0x5b6e('0x21')]===_0x5b6e('0x20');var _0x5d577d=_0x1142f2['count'];var _0x336955=_0x22c1fc?0x0:_0x44a5f5[_0x5b6e('0x1f')];var _0x52bfb3=_0x22c1fc?_0x1142f2[_0x5b6e('0x22')]:_0x44a5f5['offset']+_0x44a5f5[_0x5b6e('0x21')];var _0x56ac7b;if(_0x52bfb3>=_0x5d577d){_0x52bfb3=_0x5d577d;_0x56ac7b=0xc8;}else{_0x56ac7b=0xce;}_0x89385a[_0x5b6e('0x1d')](_0x56ac7b);return _0x89385a[_0x5b6e('0x23')](_0x5b6e('0x24'),_0x336955+'-'+_0x52bfb3+'/'+_0x5d577d)[_0x5b6e('0x1e')](_0x1142f2);}return null;};}function patchUpdates(_0x15df92){return function(_0x2f609e){try{jsonpatch[_0x5b6e('0x25')](_0x2f609e,_0x15df92,!![]);}catch(_0x1076c4){return BPromise['reject'](_0x1076c4);}return _0x2f609e[_0x5b6e('0x26')]();};}function saveUpdates(_0x1ed102,_0x11fd67){return function(_0x183f89){if(_0x183f89){return _0x183f89[_0x5b6e('0x27')](_0x1ed102)[_0x5b6e('0x28')](function(_0x460803){return _0x460803;});}return null;};}function removeEntity(_0xe250c2,_0x346c02){return function(_0x5e85f2){if(_0x5e85f2){return _0x5e85f2[_0x5b6e('0x29')]()[_0x5b6e('0x28')](function(){_0xe250c2[_0x5b6e('0x1d')](0xcc)[_0x5b6e('0x1c')]();});}};}function handleEntityNotFound(_0x456dfc,_0x369b04){return function(_0x4faad0){if(!_0x4faad0){_0x456dfc['sendStatus'](0x194);}return _0x4faad0;};}function handleError(_0x1ea8fb,_0x3666d0){_0x3666d0=_0x3666d0||0x1f4;return function(_0x49b3d5){logger[_0x5b6e('0x2a')](_0x49b3d5[_0x5b6e('0x2b')]);if(_0x49b3d5[_0x5b6e('0x2c')]){delete _0x49b3d5[_0x5b6e('0x2c')];}_0x1ea8fb[_0x5b6e('0x1d')](_0x3666d0)['send'](_0x49b3d5);};}exports[_0x5b6e('0x2d')]=function(_0x171b4b,_0x5b7d34){var _0x3219b0={},_0x3af2b2={},_0x1560c0={'count':0x0,'rows':[]};var _0x251a70=_['map'](db[_0x5b6e('0x2e')][_0x5b6e('0x2f')],function(_0x110cf9){return{'name':_0x110cf9['fieldName'],'type':_0x110cf9['type']['key']};});_0x3af2b2[_0x5b6e('0x30')]=_[_0x5b6e('0x31')](_0x251a70,'name');_0x3af2b2['query']=_[_0x5b6e('0x32')](_0x171b4b['query']);_0x3af2b2[_0x5b6e('0x33')]=_['intersection'](_0x3af2b2[_0x5b6e('0x30')],_0x3af2b2['query']);_0x3219b0[_0x5b6e('0x34')]=_[_0x5b6e('0x35')](_0x3af2b2[_0x5b6e('0x30')],qs[_0x5b6e('0x36')](_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x36')]));_0x3219b0[_0x5b6e('0x34')]=_0x3219b0[_0x5b6e('0x34')][_0x5b6e('0x38')]?_0x3219b0[_0x5b6e('0x34')]:_0x3af2b2[_0x5b6e('0x30')];if(!_0x171b4b['query'][_0x5b6e('0x39')](_0x5b6e('0x3a'))){_0x3219b0[_0x5b6e('0x21')]=qs[_0x5b6e('0x21')](_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x21')]);_0x3219b0['offset']=qs['offset'](_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x1f')]);}_0x3219b0[_0x5b6e('0x3b')]=qs['sort'](_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x3c')]);_0x3219b0[_0x5b6e('0x3d')]=qs['filters'](_['pick'](_0x171b4b[_0x5b6e('0x37')],_0x3af2b2[_0x5b6e('0x33')]),_0x251a70);if(_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x3e')]){_0x3219b0[_0x5b6e('0x3d')]=_[_0x5b6e('0x3f')](_0x3219b0[_0x5b6e('0x3d')],{'$or':_[_0x5b6e('0x31')](_0x251a70,function(_0x2aa1a7){if(_0x2aa1a7[_0x5b6e('0x40')]!==_0x5b6e('0x41')){var _0x531e57={};_0x531e57[_0x2aa1a7[_0x5b6e('0x2c')]]={'$like':'%'+_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x3e')]+'%'};return _0x531e57;}})});}_0x3219b0=_[_0x5b6e('0x3f')]({},_0x3219b0,_0x171b4b[_0x5b6e('0x42')]);var _0x463abe={'where':_0x3219b0[_0x5b6e('0x3d')]};return db['SquareDetailsReport'][_0x5b6e('0x22')](_0x463abe)[_0x5b6e('0x28')](function(_0x1d477c){_0x1560c0[_0x5b6e('0x22')]=_0x1d477c;if(_0x171b4b[_0x5b6e('0x37')][_0x5b6e('0x43')]){_0x3219b0[_0x5b6e('0x44')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x5b6e('0x45')](_0x3219b0);})[_0x5b6e('0x28')](function(_0x24bb7b){_0x1560c0['rows']=_0x24bb7b;return _0x1560c0;})[_0x5b6e('0x28')](respondWithFilteredResult(_0x5b7d34,_0x3219b0))[_0x5b6e('0x46')](handleError(_0x5b7d34,null));};exports[_0x5b6e('0x47')]=function(_0x4af99a,_0x3b66a1){var _0x4b12cb={'raw':!![],'where':{'id':_0x4af99a[_0x5b6e('0x48')]['id']}},_0x58d324={};_0x58d324[_0x5b6e('0x30')]=_[_0x5b6e('0x32')](db['SquareDetailsReport'][_0x5b6e('0x2f')]);_0x58d324[_0x5b6e('0x37')]=_[_0x5b6e('0x32')](_0x4af99a[_0x5b6e('0x37')]);_0x58d324[_0x5b6e('0x33')]=_[_0x5b6e('0x35')](_0x58d324[_0x5b6e('0x30')],_0x58d324['query']);_0x4b12cb[_0x5b6e('0x34')]=_[_0x5b6e('0x35')](_0x58d324['model'],qs[_0x5b6e('0x36')](_0x4af99a['query'][_0x5b6e('0x36')]));_0x4b12cb[_0x5b6e('0x34')]=_0x4b12cb[_0x5b6e('0x34')]['length']?_0x4b12cb['attributes']:_0x58d324[_0x5b6e('0x30')];if(_0x4af99a[_0x5b6e('0x37')]['includeAll']){_0x4b12cb['include']=[{'all':!![]}];}_0x4b12cb=_[_0x5b6e('0x3f')]({},_0x4b12cb,_0x4af99a[_0x5b6e('0x42')]);return db[_0x5b6e('0x2e')][_0x5b6e('0x49')](_0x4b12cb)[_0x5b6e('0x28')](handleEntityNotFound(_0x3b66a1,null))[_0x5b6e('0x28')](respondWithResult(_0x3b66a1,null))[_0x5b6e('0x46')](handleError(_0x3b66a1,null));};exports[_0x5b6e('0x4a')]=function(_0x57f0f5,_0x2c0078){return db[_0x5b6e('0x2e')][_0x5b6e('0x4a')](_0x57f0f5[_0x5b6e('0x4b')],{})[_0x5b6e('0x28')](respondWithResult(_0x2c0078,0xc9))[_0x5b6e('0x46')](handleError(_0x2c0078,null));};exports[_0x5b6e('0x27')]=function(_0x3dde72,_0x34d97f){if(_0x3dde72[_0x5b6e('0x4b')]['id']){delete _0x3dde72['body']['id'];}return db[_0x5b6e('0x2e')]['find']({'where':{'id':_0x3dde72['params']['id']}})[_0x5b6e('0x28')](handleEntityNotFound(_0x34d97f,null))[_0x5b6e('0x28')](saveUpdates(_0x3dde72[_0x5b6e('0x4b')],null))[_0x5b6e('0x28')](respondWithResult(_0x34d97f,null))[_0x5b6e('0x46')](handleError(_0x34d97f,null));};exports['destroy']=function(_0x3c4224,_0x5b46aa){return db[_0x5b6e('0x2e')]['find']({'where':{'id':_0x3c4224[_0x5b6e('0x48')]['id']}})[_0x5b6e('0x28')](handleEntityNotFound(_0x5b46aa,null))['then'](removeEntity(_0x5b46aa,null))[_0x5b6e('0x46')](handleError(_0x5b46aa,null));};exports['describe']=function(_0x23118b,_0x191891){return db[_0x5b6e('0x2e')]['describe']()[_0x5b6e('0x28')](respondWithResult(_0x191891,null))['catch'](handleError(_0x191891,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index face70c..2585f92 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 _0x06f1=['exports','define','SquareDetailsReport','report_square_details','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x50dce6,_0x20a527){var _0x4c92d0=function(_0x154e66){while(--_0x154e66){_0x50dce6['push'](_0x50dce6['shift']());}};_0x4c92d0(++_0x20a527);}(_0x06f1,0xbf));var _0x106f=function(_0x53f160,_0x1eda99){_0x53f160=_0x53f160-0x0;var _0x3735b5=_0x06f1[_0x53f160];return _0x3735b5;};'use strict';var _=require(_0x106f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x106f('0x1'));var moment=require(_0x106f('0x2'));var BPromise=require(_0x106f('0x3'));var rp=require(_0x106f('0x4'));var fs=require('fs');var path=require(_0x106f('0x5'));var rimraf=require('rimraf');var config=require(_0x106f('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x106f('0x7')]=function(_0x9874a9,_0x498db8){return _0x9874a9[_0x106f('0x8')](_0x106f('0x9'),attributes,{'tableName':_0x106f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf174=['../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x56ed3c,_0x255f45){var _0xdf5c88=function(_0x413a6a){while(--_0x413a6a){_0x56ed3c['push'](_0x56ed3c['shift']());}};_0xdf5c88(++_0x255f45);}(_0xf174,0x148));var _0x4f17=function(_0x404417,_0x5bfd1d){_0x404417=_0x404417-0x0;var _0x54c72d=_0xf174[_0x404417];return _0x54c72d;};'use strict';var _=require(_0x4f17('0x0'));var util=require(_0x4f17('0x1'));var logger=require(_0x4f17('0x2'))(_0x4f17('0x3'));var moment=require('moment');var BPromise=require(_0x4f17('0x4'));var rp=require(_0x4f17('0x5'));var fs=require('fs');var path=require(_0x4f17('0x6'));var rimraf=require(_0x4f17('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f17('0x8'));module['exports']=function(_0x37818b,_0x1567f3){return _0x37818b['define'](_0x4f17('0x9'),attributes,{'tableName':_0x4f17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 24b08b2..858e90c 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 _0x68a5=['SquareDetailsReport,\x20%s,\x20%s','message','request\x20sent','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68a5,0xfc));var _0x568a=function(_0x43b095,_0x5725b6){_0x43b095=_0x43b095-0x0;var _0x1a17e8=_0x68a5[_0x43b095];return _0x1a17e8;};'use strict';var _=require(_0x568a('0x0'));var util=require('util');var moment=require(_0x568a('0x1'));var BPromise=require(_0x568a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x568a('0x3'));var db=require(_0x568a('0x4'))['db'];var utils=require(_0x568a('0x5'));var logger=require(_0x568a('0x6'))('rpc');var config=require(_0x568a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x568a('0x8')][_0x568a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d36ec,_0x3a7a9c,_0x4cda9a){return new BPromise(function(_0x172efd,_0x56deb6){return client[_0x568a('0xa')](_0x2d36ec,_0x4cda9a)[_0x568a('0xb')](function(_0x335ecd){logger[_0x568a('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x3a7a9c,'request\x20sent');logger[_0x568a('0xd')](_0x568a('0xe'),_0x3a7a9c,'request\x20sent',JSON[_0x568a('0xf')](_0x335ecd));if(_0x335ecd['error']){if(_0x335ecd[_0x568a('0x10')][_0x568a('0x11')]===0x1f4){logger[_0x568a('0x10')](_0x568a('0x12'),_0x3a7a9c,_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);return _0x56deb6(_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);}logger[_0x568a('0x10')](_0x568a('0x12'),_0x3a7a9c,_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);return _0x172efd(_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);}else{logger[_0x568a('0xc')](_0x568a('0x12'),_0x3a7a9c,_0x568a('0x14'));_0x172efd(_0x335ecd['result'][_0x568a('0x13')]);}})['catch'](function(_0xa77de8){logger[_0x568a('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x3a7a9c,_0xa77de8);_0x56deb6(_0xa77de8);});});}exports[_0x568a('0x15')]=function(_0x561ae1){var _0x40d4a1=this;return new Promise(function(_0x1c8e3a,_0x9b4670){return db[_0x568a('0x16')]['create'](_0x561ae1[_0x568a('0x17')],{'raw':_0x561ae1['options']?_0x561ae1[_0x568a('0x18')][_0x568a('0x19')]===undefined?!![]:![]:!![]})[_0x568a('0xb')](function(_0x3b9968){logger[_0x568a('0xc')](_0x568a('0x15'),_0x561ae1);logger[_0x568a('0xd')](_0x568a('0x15'),_0x561ae1,JSON['stringify'](_0x3b9968));_0x1c8e3a(_0x3b9968);})[_0x568a('0x1a')](function(_0x1f12b5){logger['error'](_0x568a('0x15'),_0x1f12b5[_0x568a('0x13')],_0x561ae1);_0x9b4670(_0x40d4a1[_0x568a('0x10')](0x1f4,_0x1f12b5['message']));});});}; \ No newline at end of file +var _0xd5fc=['SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','create','body','options','CreateSquareDetailsReport','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xd5fc,0xae));var _0xcd5f=function(_0x591e52,_0x3da792){_0x591e52=_0x591e52-0x0;var _0x3af11a=_0xd5fc[_0x591e52];return _0x3af11a;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});}exports['CreateSquareDetailsReport']=function(_0x1a4cb6){var _0x56a874=this;return new Promise(function(_0xb23761,_0x36c60c){return db['SquareDetailsReport'][_0xcd5f('0x13')](_0x1a4cb6[_0xcd5f('0x14')],{'raw':_0x1a4cb6['options']?_0x1a4cb6[_0xcd5f('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xcd5f('0x9')](function(_0x5c3c9f){logger['info'](_0xcd5f('0x16'),_0x1a4cb6);logger['debug']('CreateSquareDetailsReport',_0x1a4cb6,JSON['stringify'](_0x5c3c9f));_0xb23761(_0x5c3c9f);})[_0xcd5f('0x12')](function(_0x5c03b9){logger[_0xcd5f('0xe')](_0xcd5f('0x16'),_0x5c03b9[_0xcd5f('0xf')],_0x1a4cb6);_0x36c60c(_0x56a874[_0xcd5f('0xe')](0x1f4,_0x5c03b9[_0xcd5f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b20674b..08055c8 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 _0x6f3c=['./system.controller','get','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x364267,_0x3c6698){var _0x1b373c=function(_0x5d6d58){while(--_0x5d6d58){_0x364267['push'](_0x364267['shift']());}};_0x1b373c(++_0x3c6698);}(_0x6f3c,0x1b5));var _0xc6f3=function(_0x437ed2,_0x5bdbe5){_0x437ed2=_0x437ed2-0x0;var _0x52ad14=_0x6f3c[_0x437ed2];return _0x52ad14;};'use strict';var express=require(_0xc6f3('0x0'));var router=express[_0xc6f3('0x1')]();var auth=require(_0xc6f3('0x2'));var controller=require(_0xc6f3('0x3'));router[_0xc6f3('0x4')]('/',auth[_0xc6f3('0x5')](),controller['index']);router[_0xc6f3('0x4')]('/process/:pid/kill',auth[_0xc6f3('0x5')](),controller[_0xc6f3('0x6')]);module[_0xc6f3('0x7')]=router; \ No newline at end of file +var _0x8da9=['killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x4839a2,_0x1f67eb){var _0x465147=function(_0x4eae2e){while(--_0x4eae2e){_0x4839a2['push'](_0x4839a2['shift']());}};_0x465147(++_0x1f67eb);}(_0x8da9,0x146));var _0x98da=function(_0x4f3e5a,_0x1ee150){_0x4f3e5a=_0x4f3e5a-0x0;var _0x452880=_0x8da9[_0x4f3e5a];return _0x452880;};'use strict';var express=require(_0x98da('0x0'));var router=express[_0x98da('0x1')]();var auth=require(_0x98da('0x2'));var controller=require(_0x98da('0x3'));router[_0x98da('0x4')]('/',auth[_0x98da('0x5')](),controller[_0x98da('0x6')]);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x98da('0x7')]);module[_0x98da('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index d0f65a8..e82963a 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 _0x5e0b=['json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','api','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','getAllData','then','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','SIGINT'];(function(_0x456c5c,_0x4eb37c){var _0x246a7e=function(_0xf2c28c){while(--_0xf2c28c){_0x456c5c['push'](_0x456c5c['shift']());}};_0x246a7e(++_0x4eb37c);}(_0x5e0b,0x178));var _0xb5e0=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x5e0b[_0x459423];return _0x42ed14;};'use strict';var info=require(_0xb5e0('0x0'));var exec=require('child_process')['exec'];var logger=require('../../config/logger')(_0xb5e0('0x1'));var util=require('util');var BPromise=require(_0xb5e0('0x2'));var _=require('lodash');function handleError(_0xe2c9c9,_0x2e49cf,_0x1580e9){_0x2e49cf=_0x2e49cf||0x1f4;return function(_0x4caf3f){logger[_0xb5e0('0x3')](_0xb5e0('0x4'),_0x1580e9,_0x2e49cf,util[_0xb5e0('0x5')](_0x4caf3f,{'showHidden':![],'depth':null}));delete _0x4caf3f['name'];_0xe2c9c9[_0xb5e0('0x6')](_0x2e49cf)[_0xb5e0('0x7')](_0x4caf3f);};}exports['index']=function(_0x1992cf,_0x3061d0){return info[_0xb5e0('0x8')]()[_0xb5e0('0x9')](function(_0x33e3c9){return _0x3061d0[_0xb5e0('0x6')](0xc8)['json'](_0x33e3c9);})[_0xb5e0('0xa')](function(_0x47ed20){return _0x3061d0[_0xb5e0('0x6')](0x1f4)['json'](_0x47ed20);});};exports[_0xb5e0('0xb')]=function(_0x4ec866,_0x30b2c5){var _0x4937df=[_0xb5e0('0xc')];return new BPromise(function(_0x5335c1,_0x13fe8c){return exec(util[_0xb5e0('0xd')](_0xb5e0('0xe'),_0x4ec866[_0xb5e0('0xf')]['pid']),function(_0x3e87cf,_0x511119,_0x57716a){if(_0x3e87cf){return _0x13fe8c(_0x3e87cf);}return _0x5335c1(_0x511119);});})['then'](function(_0x5ada2e){var _0x2f77b7=![];var _0x4e46b1=_0x5ada2e[_0xb5e0('0x10')](/\n/);for(var _0xc80569=0x0,_0x422b23=_0x4937df['length'];_0xc80569<_0x422b23,_0x2f77b7===![];_0xc80569+=0x1){if(_0x5ada2e['indexOf'](_0x4937df[_0xc80569])>=0x0){_0x2f77b7=!![];}}if(!_0x2f77b7){throw new Error(util['format'](_0xb5e0('0x11'),_0x4ec866['params'][_0xb5e0('0x12')]));}process['kill'](_0x4ec866['params'][_0xb5e0('0x12')],_0xb5e0('0x13'));return _0x30b2c5[_0xb5e0('0x6')](0xc8)[_0xb5e0('0x14')]({'message':util[_0xb5e0('0xd')](_0xb5e0('0x15'),_0x4ec866['params'][_0xb5e0('0x12')])});})[_0xb5e0('0xa')](handleError(_0x30b2c5,null,_0xb5e0('0xb')));}; \ No newline at end of file +var _0x3794=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','exec','../../config/logger','api','util','bluebird','lodash','error','inspect','name','send','getAllData','then','json','catch','status','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x3794,0x8d));var _0x4379=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x3794[_0x671369];return _0x33f2b4;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x4379('0x0')];var logger=require(_0x4379('0x1'))(_0x4379('0x2'));var util=require(_0x4379('0x3'));var BPromise=require(_0x4379('0x4'));var _=require(_0x4379('0x5'));function handleError(_0x174632,_0x3192fb,_0x511571){_0x3192fb=_0x3192fb||0x1f4;return function(_0x5d2aa){logger[_0x4379('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x511571,_0x3192fb,util[_0x4379('0x7')](_0x5d2aa,{'showHidden':![],'depth':null}));delete _0x5d2aa[_0x4379('0x8')];_0x174632['status'](_0x3192fb)[_0x4379('0x9')](_0x5d2aa);};}exports['index']=function(_0x21cf3a,_0x3a6a75){return info[_0x4379('0xa')]()[_0x4379('0xb')](function(_0x2b4b27){return _0x3a6a75['status'](0xc8)[_0x4379('0xc')](_0x2b4b27);})[_0x4379('0xd')](function(_0x379aea){return _0x3a6a75[_0x4379('0xe')](0x1f4)[_0x4379('0xc')](_0x379aea);});};exports['killProcess']=function(_0x521295,_0x167f39){var _0x2d56d9=[_0x4379('0xf')];return new BPromise(function(_0x422352,_0x363967){return exec(util['format'](_0x4379('0x10'),_0x521295[_0x4379('0x11')][_0x4379('0x12')]),function(_0x56548b,_0x5061b9,_0x1985eb){if(_0x56548b){return _0x363967(_0x56548b);}return _0x422352(_0x5061b9);});})[_0x4379('0xb')](function(_0x42bdba){var _0x4b2d84=![];var _0x52794f=_0x42bdba[_0x4379('0x13')](/\n/);for(var _0x1a14e9=0x0,_0x109f7f=_0x2d56d9[_0x4379('0x14')];_0x1a14e9<_0x109f7f,_0x4b2d84===![];_0x1a14e9+=0x1){if(_0x42bdba[_0x4379('0x15')](_0x2d56d9[_0x1a14e9])>=0x0){_0x4b2d84=!![];}}if(!_0x4b2d84){throw new Error(util['format'](_0x4379('0x16'),_0x521295[_0x4379('0x11')]['pid']));}process[_0x4379('0x17')](_0x521295['params'][_0x4379('0x12')],'SIGINT');return _0x167f39[_0x4379('0xe')](0xc8)[_0x4379('0xc')]({'message':util[_0x4379('0x18')](_0x4379('0x19'),_0x521295[_0x4379('0x11')]['pid'])});})[_0x4379('0xd')](handleError(_0x167f39,null,_0x4379('0x1a')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b3882ba..f369dd4 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 _0x215d=['get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x133e3b,_0x443cd6){var _0x199e72=function(_0x379cab){while(--_0x379cab){_0x133e3b['push'](_0x133e3b['shift']());}};_0x199e72(++_0x443cd6);}(_0x215d,0x187));var _0xd215=function(_0x4f43eb,_0x1f1dac){_0x4f43eb=_0x4f43eb-0x0;var _0x25b024=_0x215d[_0x4f43eb];return _0x25b024;};'use strict';var multer=require(_0xd215('0x0'));var util=require('util');var path=require(_0xd215('0x1'));var timeout=require(_0xd215('0x2'));var express=require(_0xd215('0x3'));var router=express[_0xd215('0x4')]();var fs_extra=require(_0xd215('0x5'));var auth=require(_0xd215('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd215('0x7'));var controller=require('./tag.controller');router[_0xd215('0x8')]('/',auth[_0xd215('0x9')](),controller[_0xd215('0xa')]);router['get'](_0xd215('0xb'),auth['isAuthenticated'](),controller[_0xd215('0xc')]);router[_0xd215('0xd')]('/',auth[_0xd215('0x9')](),controller['create']);router[_0xd215('0xe')](_0xd215('0xb'),auth[_0xd215('0x9')](),controller[_0xd215('0xf')]);router[_0xd215('0x10')]('/:id',auth[_0xd215('0x9')](),controller[_0xd215('0x11')]);module[_0xd215('0x12')]=router; \ No newline at end of file +var _0xe2ec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x1e263a,_0xfae772){var _0x92c6cb=function(_0x193952){while(--_0x193952){_0x1e263a['push'](_0x1e263a['shift']());}};_0x92c6cb(++_0xfae772);}(_0xe2ec,0xe1));var _0xce2e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xe2ec[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0xce2e('0x0'));var util=require(_0xce2e('0x1'));var path=require(_0xce2e('0x2'));var timeout=require('connect-timeout');var express=require(_0xce2e('0x3'));var router=express[_0xce2e('0x4')]();var fs_extra=require(_0xce2e('0x5'));var auth=require(_0xce2e('0x6'));var interaction=require(_0xce2e('0x7'));var config=require(_0xce2e('0x8'));var controller=require(_0xce2e('0x9'));router[_0xce2e('0xa')]('/',auth[_0xce2e('0xb')](),controller[_0xce2e('0xc')]);router['get']('/:id',auth[_0xce2e('0xb')](),controller[_0xce2e('0xd')]);router[_0xce2e('0xe')]('/',auth[_0xce2e('0xb')](),controller[_0xce2e('0xf')]);router['put'](_0xce2e('0x10'),auth[_0xce2e('0xb')](),controller[_0xce2e('0x11')]);router[_0xce2e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xce2e('0x13')]);module[_0xce2e('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0eecf1e..9f1be87 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 _0x37e9=['name','#0091EA','sequelize','exports','STRING'];(function(_0x3e298e,_0x4bf337){var _0x2b8111=function(_0x4e7ba8){while(--_0x4e7ba8){_0x3e298e['push'](_0x3e298e['shift']());}};_0x2b8111(++_0x4bf337);}(_0x37e9,0x1e7));var _0x937e=function(_0x51f3ff,_0x2cb6ec){_0x51f3ff=_0x51f3ff-0x0;var _0x33dbb7=_0x37e9[_0x51f3ff];return _0x33dbb7;};'use strict';var Sequelize=require(_0x937e('0x0'));module[_0x937e('0x1')]={'name':{'type':Sequelize[_0x937e('0x2')],'unique':_0x937e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x937e('0x2')],'defaultValue':_0x937e('0x4')},'description':{'type':Sequelize[_0x937e('0x2')]}}; \ No newline at end of file +var _0x24b3=['STRING','sequelize','exports'];(function(_0x54496d,_0x5b8572){var _0x40e626=function(_0xb6475c){while(--_0xb6475c){_0x54496d['push'](_0x54496d['shift']());}};_0x40e626(++_0x5b8572);}(_0x24b3,0xd3));var _0x324b=function(_0x3629ab,_0xe33f9f){_0x3629ab=_0x3629ab-0x0;var _0x3ba9c1=_0x24b3[_0x3629ab];return _0x3ba9c1;};'use strict';var Sequelize=require(_0x324b('0x0'));module[_0x324b('0x1')]={'name':{'type':Sequelize[_0x324b('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x324b('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 74e0e3d..8ccac4b 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 _0x4fdb=['request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x516311,_0x1c202){var _0x5c2fc6=function(_0x84a3e3){while(--_0x84a3e3){_0x516311['push'](_0x516311['shift']());}};_0x5c2fc6(++_0x1c202);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x4632cc,_0x23104b){_0x4632cc=_0x4632cc-0x0;var _0x134de3=_0x4fdb[_0x4632cc];return _0x134de3;};'use strict';var emlformat=require(_0xb4fd('0x0'));var rimraf=require(_0xb4fd('0x1'));var zipdir=require(_0xb4fd('0x2'));var jsonpatch=require(_0xb4fd('0x3'));var rp=require(_0xb4fd('0x4'));var moment=require(_0xb4fd('0x5'));var BPromise=require(_0xb4fd('0x6'));var Mustache=require(_0xb4fd('0x7'));var util=require(_0xb4fd('0x8'));var path=require('path');var sox=require(_0xb4fd('0x9'));var csv=require('to-csv');var ejs=require(_0xb4fd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb4fd('0xb'));var crypto=require(_0xb4fd('0xc'));var jsforce=require(_0xb4fd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb4fd('0xe'));var Papa=require(_0xb4fd('0xf'));var Redis=require(_0xb4fd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb4fd('0x11'));var as=require(_0xb4fd('0x12'));var hardwareService=require(_0xb4fd('0x13'));var logger=require(_0xb4fd('0x14'))(_0xb4fd('0x15'));var utils=require('../../config/utils');var config=require(_0xb4fd('0x16'));var licenseUtil=require(_0xb4fd('0x17'));var db=require(_0xb4fd('0x18'))['db'];function respondWithStatusCode(_0x120c2e,_0x5ba7e1){_0x5ba7e1=_0x5ba7e1||0xcc;return function(_0x38173d){if(_0x38173d){return _0x120c2e[_0xb4fd('0x19')](_0x5ba7e1);}return _0x120c2e[_0xb4fd('0x1a')](_0x5ba7e1)['end']();};}function respondWithResult(_0x399756,_0x1234d7){_0x1234d7=_0x1234d7||0xc8;return function(_0xc35d8d){if(_0xc35d8d){return _0x399756[_0xb4fd('0x1a')](_0x1234d7)[_0xb4fd('0x1b')](_0xc35d8d);}};}function respondWithFilteredResult(_0x37801f,_0x3a0872){return function(_0x47e288){if(_0x47e288){var _0x2076d5=typeof _0x3a0872[_0xb4fd('0x1c')]===_0xb4fd('0x1d')&&typeof _0x3a0872[_0xb4fd('0x1e')]===_0xb4fd('0x1d');var _0x137e51=_0x47e288[_0xb4fd('0x1f')];var _0x44f0f0=_0x2076d5?0x0:_0x3a0872[_0xb4fd('0x1c')];var _0x233044=_0x2076d5?_0x47e288[_0xb4fd('0x1f')]:_0x3a0872['offset']+_0x3a0872['limit'];var _0x504e80;if(_0x233044>=_0x137e51){_0x233044=_0x137e51;_0x504e80=0xc8;}else{_0x504e80=0xce;}_0x37801f['status'](_0x504e80);return _0x37801f[_0xb4fd('0x20')](_0xb4fd('0x21'),_0x44f0f0+'-'+_0x233044+'/'+_0x137e51)[_0xb4fd('0x1b')](_0x47e288);}return null;};}function patchUpdates(_0x1392c4){return function(_0x458133){try{jsonpatch[_0xb4fd('0x22')](_0x458133,_0x1392c4,!![]);}catch(_0xedff2f){return BPromise['reject'](_0xedff2f);}return _0x458133['save']();};}function saveUpdates(_0x216307,_0x25bb7d){return function(_0x157fc2){if(_0x157fc2){return _0x157fc2['update'](_0x216307)[_0xb4fd('0x23')](function(_0x49d42c){return _0x49d42c;});}return null;};}function removeEntity(_0x46cba4,_0x4f5032){return function(_0x2a9c8c){if(_0x2a9c8c){return _0x2a9c8c[_0xb4fd('0x24')]()[_0xb4fd('0x23')](function(){var _0x261eda=_0x2a9c8c[_0xb4fd('0x25')]({'plain':!![]});var _0x456f35=_0xb4fd('0x26');return db[_0xb4fd('0x27')]['destroy']({'where':{'type':_0x456f35,'resourceId':_0x261eda['id']}})['then'](function(){return _0x2a9c8c;});})['then'](function(){_0x46cba4[_0xb4fd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3617b2,_0x5e9d2b){return function(_0x5738c2){if(!_0x5738c2){_0x3617b2[_0xb4fd('0x19')](0x194);}return _0x5738c2;};}function handleError(_0x7c5313,_0xda5ea8){_0xda5ea8=_0xda5ea8||0x1f4;return function(_0x4a057d){logger[_0xb4fd('0x28')](_0x4a057d[_0xb4fd('0x29')]);if(_0x4a057d[_0xb4fd('0x2a')]){delete _0x4a057d[_0xb4fd('0x2a')];}_0x7c5313['status'](_0xda5ea8)[_0xb4fd('0x2b')](_0x4a057d);};}exports[_0xb4fd('0x2c')]=function(_0x4836a0,_0x3e5060){var _0x421c89={},_0xbe7d2c={},_0x597874={'count':0x0,'rows':[]};var _0xe73e10=_[_0xb4fd('0x2d')](db[_0xb4fd('0x2e')]['rawAttributes'],function(_0x55eed3){return{'name':_0x55eed3['fieldName'],'type':_0x55eed3['type'][_0xb4fd('0x2f')]};});_0xbe7d2c[_0xb4fd('0x30')]=_[_0xb4fd('0x2d')](_0xe73e10,_0xb4fd('0x2a'));_0xbe7d2c[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0x4836a0[_0xb4fd('0x31')]);_0xbe7d2c[_0xb4fd('0x33')]=_[_0xb4fd('0x34')](_0xbe7d2c[_0xb4fd('0x30')],_0xbe7d2c[_0xb4fd('0x31')]);_0x421c89[_0xb4fd('0x35')]=_[_0xb4fd('0x34')](_0xbe7d2c[_0xb4fd('0x30')],qs[_0xb4fd('0x36')](_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x36')]));_0x421c89[_0xb4fd('0x35')]=_0x421c89['attributes']['length']?_0x421c89[_0xb4fd('0x35')]:_0xbe7d2c[_0xb4fd('0x30')];if(!_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x37')](_0xb4fd('0x38'))){_0x421c89['limit']=qs[_0xb4fd('0x1e')](_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x1e')]);_0x421c89[_0xb4fd('0x1c')]=qs[_0xb4fd('0x1c')](_0x4836a0['query'][_0xb4fd('0x1c')]);}_0x421c89['order']=qs[_0xb4fd('0x39')](_0x4836a0[_0xb4fd('0x31')]['sort']);_0x421c89['where']=qs[_0xb4fd('0x33')](_[_0xb4fd('0x3a')](_0x4836a0[_0xb4fd('0x31')],_0xbe7d2c[_0xb4fd('0x33')]),_0xe73e10);if(_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x3b')]){_0x421c89['where']=_[_0xb4fd('0x3c')](_0x421c89[_0xb4fd('0x3d')],{'$or':_['map'](_0xe73e10,function(_0x16d848){if(_0x16d848[_0xb4fd('0x3e')]!==_0xb4fd('0x3f')){var _0x39e607={};_0x39e607[_0x16d848['name']]={'$like':'%'+_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x3b')]+'%'};return _0x39e607;}})});}_0x421c89=_[_0xb4fd('0x3c')]({},_0x421c89,_0x4836a0[_0xb4fd('0x40')]);var _0xcbd37={'where':_0x421c89[_0xb4fd('0x3d')]};return db['Tag'][_0xb4fd('0x1f')](_0xcbd37)[_0xb4fd('0x23')](function(_0x5e11c0){_0x597874[_0xb4fd('0x1f')]=_0x5e11c0;if(_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x41')]){_0x421c89[_0xb4fd('0x42')]=[{'all':!![]}];}return db[_0xb4fd('0x2e')]['findAll'](_0x421c89);})[_0xb4fd('0x23')](function(_0x661f32){_0x597874[_0xb4fd('0x43')]=_0x661f32;return _0x597874;})['then'](respondWithFilteredResult(_0x3e5060,_0x421c89))[_0xb4fd('0x44')](handleError(_0x3e5060,null));};exports['show']=function(_0x3c1ffa,_0x3d5177){var _0x4d2c7c={'raw':!![],'where':{'id':_0x3c1ffa['params']['id']}},_0x563366={};_0x563366[_0xb4fd('0x30')]=_[_0xb4fd('0x32')](db[_0xb4fd('0x2e')]['rawAttributes']);_0x563366[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0x3c1ffa[_0xb4fd('0x31')]);_0x563366[_0xb4fd('0x33')]=_[_0xb4fd('0x34')](_0x563366[_0xb4fd('0x30')],_0x563366[_0xb4fd('0x31')]);_0x4d2c7c['attributes']=_['intersection'](_0x563366[_0xb4fd('0x30')],qs[_0xb4fd('0x36')](_0x3c1ffa[_0xb4fd('0x31')][_0xb4fd('0x36')]));_0x4d2c7c['attributes']=_0x4d2c7c[_0xb4fd('0x35')]['length']?_0x4d2c7c['attributes']:_0x563366[_0xb4fd('0x30')];if(_0x3c1ffa[_0xb4fd('0x31')]['includeAll']){_0x4d2c7c[_0xb4fd('0x42')]=[{'all':!![]}];}_0x4d2c7c=_[_0xb4fd('0x3c')]({},_0x4d2c7c,_0x3c1ffa['options']);return db[_0xb4fd('0x2e')][_0xb4fd('0x45')](_0x4d2c7c)[_0xb4fd('0x23')](handleEntityNotFound(_0x3d5177,null))['then'](respondWithResult(_0x3d5177,null))['catch'](handleError(_0x3d5177,null));};exports[_0xb4fd('0x46')]=function(_0x1b5f2d,_0x17fbc7){return db[_0xb4fd('0x2e')]['create'](_0x1b5f2d[_0xb4fd('0x47')],{})[_0xb4fd('0x23')](function(_0x4f542b){var _0x126225=_0x1b5f2d[_0xb4fd('0x48')][_0xb4fd('0x25')]({'plain':!![]});if(!_0x126225)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x126225[_0xb4fd('0x49')]===_0xb4fd('0x48')){var _0x4ff60b=_0x4f542b[_0xb4fd('0x25')]({'plain':!![]});var _0x4de371='Tags';return db[_0xb4fd('0x4a')][_0xb4fd('0x45')]({'where':{'name':_0x4de371,'userProfileId':_0x126225[_0xb4fd('0x4b')]},'raw':!![]})[_0xb4fd('0x23')](function(_0x23c2a7){if(_0x23c2a7&&_0x23c2a7[_0xb4fd('0x4c')]===0x0){return db[_0xb4fd('0x27')][_0xb4fd('0x46')]({'name':_0x4ff60b[_0xb4fd('0x2a')],'resourceId':_0x4ff60b['id'],'type':_0x23c2a7[_0xb4fd('0x2a')],'sectionId':_0x23c2a7['id']},{})[_0xb4fd('0x23')](function(){return _0x4f542b;});}else{return _0x4f542b;}})[_0xb4fd('0x44')](function(_0x106196){logger[_0xb4fd('0x28')](_0xb4fd('0x4d'),_0x106196);throw _0x106196;});}return _0x4f542b;})['then'](respondWithResult(_0x17fbc7,0xc9))['catch'](handleError(_0x17fbc7,null));};exports[_0xb4fd('0x4e')]=function(_0x7c85e8,_0x39b994){if(_0x7c85e8[_0xb4fd('0x47')]['id']){delete _0x7c85e8[_0xb4fd('0x47')]['id'];}return db['Tag']['find']({'where':{'id':_0x7c85e8[_0xb4fd('0x4f')]['id']}})[_0xb4fd('0x23')](handleEntityNotFound(_0x39b994,null))['then'](saveUpdates(_0x7c85e8['body'],null))['then'](respondWithResult(_0x39b994,null))[_0xb4fd('0x44')](handleError(_0x39b994,null));};exports[_0xb4fd('0x24')]=function(_0x1d18a4,_0xfdc372){return db['Tag']['find']({'where':{'id':_0x1d18a4[_0xb4fd('0x4f')]['id']}})[_0xb4fd('0x23')](handleEntityNotFound(_0xfdc372,null))[_0xb4fd('0x23')](removeEntity(_0xfdc372,null))['catch'](handleError(_0xfdc372,null));}; \ No newline at end of file +var _0xe28e=['stack','name','send','index','map','Tag','fieldName','key','model','query','keys','attributes','intersection','fields','limit','order','sort','where','filters','pick','VIRTUAL','merge','include','catch','show','rawAttributes','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','error'];(function(_0x41b840,_0x1a3baf){var _0x2a0adf=function(_0x2eb5a7){while(--_0x2eb5a7){_0x41b840['push'](_0x41b840['shift']());}};_0x2a0adf(++_0x1a3baf);}(_0xe28e,0x1ba));var _0xee28=function(_0x2bbd25,_0x58575b){_0x2bbd25=_0x2bbd25-0x0;var _0x44ae3e=_0xe28e[_0x2bbd25];return _0x44ae3e;};'use strict';var emlformat=require(_0xee28('0x0'));var rimraf=require(_0xee28('0x1'));var zipdir=require(_0xee28('0x2'));var jsonpatch=require(_0xee28('0x3'));var rp=require(_0xee28('0x4'));var moment=require(_0xee28('0x5'));var BPromise=require(_0xee28('0x6'));var Mustache=require(_0xee28('0x7'));var util=require(_0xee28('0x8'));var path=require(_0xee28('0x9'));var sox=require(_0xee28('0xa'));var csv=require(_0xee28('0xb'));var ejs=require(_0xee28('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee28('0xd'));var squel=require(_0xee28('0xe'));var crypto=require(_0xee28('0xf'));var jsforce=require(_0xee28('0x10'));var deskjs=require(_0xee28('0x11'));var toCsv=require(_0xee28('0xb'));var querystring=require(_0xee28('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee28('0x13'));var as=require(_0xee28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee28('0x15'))(_0xee28('0x16'));var utils=require('../../config/utils');var config=require(_0xee28('0x17'));var licenseUtil=require(_0xee28('0x18'));var db=require(_0xee28('0x19'))['db'];function respondWithStatusCode(_0x2488cf,_0x267031){_0x267031=_0x267031||0xcc;return function(_0x46e784){if(_0x46e784){return _0x2488cf[_0xee28('0x1a')](_0x267031);}return _0x2488cf['status'](_0x267031)[_0xee28('0x1b')]();};}function respondWithResult(_0x1df69a,_0x555b9c){_0x555b9c=_0x555b9c||0xc8;return function(_0x331b7c){if(_0x331b7c){return _0x1df69a[_0xee28('0x1c')](_0x555b9c)['json'](_0x331b7c);}};}function respondWithFilteredResult(_0x11ac93,_0x17c99a){return function(_0x3d3a5c){if(_0x3d3a5c){var _0x343358=typeof _0x17c99a[_0xee28('0x1d')]===_0xee28('0x1e')&&typeof _0x17c99a['limit']===_0xee28('0x1e');var _0x5de212=_0x3d3a5c[_0xee28('0x1f')];var _0x19472a=_0x343358?0x0:_0x17c99a['offset'];var _0x355b07=_0x343358?_0x3d3a5c['count']:_0x17c99a[_0xee28('0x1d')]+_0x17c99a['limit'];var _0x28da88;if(_0x355b07>=_0x5de212){_0x355b07=_0x5de212;_0x28da88=0xc8;}else{_0x28da88=0xce;}_0x11ac93['status'](_0x28da88);return _0x11ac93[_0xee28('0x20')]('Content-Range',_0x19472a+'-'+_0x355b07+'/'+_0x5de212)[_0xee28('0x21')](_0x3d3a5c);}return null;};}function patchUpdates(_0x2a01ff){return function(_0x96f5db){try{jsonpatch[_0xee28('0x22')](_0x96f5db,_0x2a01ff,!![]);}catch(_0x21ee24){return BPromise[_0xee28('0x23')](_0x21ee24);}return _0x96f5db[_0xee28('0x24')]();};}function saveUpdates(_0x4bda53,_0x342798){return function(_0x44d7ff){if(_0x44d7ff){return _0x44d7ff[_0xee28('0x25')](_0x4bda53)['then'](function(_0x5b500b){return _0x5b500b;});}return null;};}function removeEntity(_0x17d8e4,_0x4a524d){return function(_0x1519ae){if(_0x1519ae){return _0x1519ae[_0xee28('0x26')]()[_0xee28('0x27')](function(){var _0x3acfc9=_0x1519ae[_0xee28('0x28')]({'plain':!![]});var _0x95d917=_0xee28('0x29');return db[_0xee28('0x2a')][_0xee28('0x26')]({'where':{'type':_0x95d917,'resourceId':_0x3acfc9['id']}})['then'](function(){return _0x1519ae;});})[_0xee28('0x27')](function(){_0x17d8e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54528b,_0x587aac){return function(_0x51eae7){if(!_0x51eae7){_0x54528b[_0xee28('0x1a')](0x194);}return _0x51eae7;};}function handleError(_0x884e7d,_0x3b64ad){_0x3b64ad=_0x3b64ad||0x1f4;return function(_0x469889){logger[_0xee28('0x2b')](_0x469889[_0xee28('0x2c')]);if(_0x469889[_0xee28('0x2d')]){delete _0x469889['name'];}_0x884e7d[_0xee28('0x1c')](_0x3b64ad)[_0xee28('0x2e')](_0x469889);};}exports[_0xee28('0x2f')]=function(_0x49644a,_0x14f7c4){var _0x2890ad={},_0x213e45={},_0xf0b169={'count':0x0,'rows':[]};var _0x1421bc=_[_0xee28('0x30')](db[_0xee28('0x31')]['rawAttributes'],function(_0x15f294){return{'name':_0x15f294[_0xee28('0x32')],'type':_0x15f294['type'][_0xee28('0x33')]};});_0x213e45[_0xee28('0x34')]=_[_0xee28('0x30')](_0x1421bc,_0xee28('0x2d'));_0x213e45[_0xee28('0x35')]=_[_0xee28('0x36')](_0x49644a[_0xee28('0x35')]);_0x213e45['filters']=_['intersection'](_0x213e45['model'],_0x213e45[_0xee28('0x35')]);_0x2890ad[_0xee28('0x37')]=_[_0xee28('0x38')](_0x213e45[_0xee28('0x34')],qs[_0xee28('0x39')](_0x49644a[_0xee28('0x35')]['fields']));_0x2890ad[_0xee28('0x37')]=_0x2890ad[_0xee28('0x37')]['length']?_0x2890ad['attributes']:_0x213e45[_0xee28('0x34')];if(!_0x49644a[_0xee28('0x35')]['hasOwnProperty']('nolimit')){_0x2890ad[_0xee28('0x3a')]=qs[_0xee28('0x3a')](_0x49644a['query'][_0xee28('0x3a')]);_0x2890ad[_0xee28('0x1d')]=qs[_0xee28('0x1d')](_0x49644a[_0xee28('0x35')][_0xee28('0x1d')]);}_0x2890ad[_0xee28('0x3b')]=qs[_0xee28('0x3c')](_0x49644a[_0xee28('0x35')][_0xee28('0x3c')]);_0x2890ad[_0xee28('0x3d')]=qs[_0xee28('0x3e')](_[_0xee28('0x3f')](_0x49644a['query'],_0x213e45[_0xee28('0x3e')]),_0x1421bc);if(_0x49644a['query']['filter']){_0x2890ad[_0xee28('0x3d')]=_['merge'](_0x2890ad[_0xee28('0x3d')],{'$or':_['map'](_0x1421bc,function(_0x2b73d9){if(_0x2b73d9['type']!==_0xee28('0x40')){var _0x211345={};_0x211345[_0x2b73d9[_0xee28('0x2d')]]={'$like':'%'+_0x49644a[_0xee28('0x35')]['filter']+'%'};return _0x211345;}})});}_0x2890ad=_[_0xee28('0x41')]({},_0x2890ad,_0x49644a['options']);var _0x45ed94={'where':_0x2890ad[_0xee28('0x3d')]};return db[_0xee28('0x31')][_0xee28('0x1f')](_0x45ed94)[_0xee28('0x27')](function(_0x2e046e){_0xf0b169[_0xee28('0x1f')]=_0x2e046e;if(_0x49644a['query']['includeAll']){_0x2890ad[_0xee28('0x42')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x2890ad);})[_0xee28('0x27')](function(_0x14bd8d){_0xf0b169['rows']=_0x14bd8d;return _0xf0b169;})[_0xee28('0x27')](respondWithFilteredResult(_0x14f7c4,_0x2890ad))[_0xee28('0x43')](handleError(_0x14f7c4,null));};exports[_0xee28('0x44')]=function(_0x24cfaa,_0x460c61){var _0x2351f7={'raw':!![],'where':{'id':_0x24cfaa['params']['id']}},_0x1735a9={};_0x1735a9[_0xee28('0x34')]=_[_0xee28('0x36')](db[_0xee28('0x31')][_0xee28('0x45')]);_0x1735a9[_0xee28('0x35')]=_['keys'](_0x24cfaa[_0xee28('0x35')]);_0x1735a9[_0xee28('0x3e')]=_['intersection'](_0x1735a9[_0xee28('0x34')],_0x1735a9[_0xee28('0x35')]);_0x2351f7[_0xee28('0x37')]=_[_0xee28('0x38')](_0x1735a9[_0xee28('0x34')],qs[_0xee28('0x39')](_0x24cfaa['query'][_0xee28('0x39')]));_0x2351f7['attributes']=_0x2351f7['attributes'][_0xee28('0x46')]?_0x2351f7[_0xee28('0x37')]:_0x1735a9['model'];if(_0x24cfaa[_0xee28('0x35')][_0xee28('0x47')]){_0x2351f7[_0xee28('0x42')]=[{'all':!![]}];}_0x2351f7=_['merge']({},_0x2351f7,_0x24cfaa['options']);return db[_0xee28('0x31')][_0xee28('0x48')](_0x2351f7)[_0xee28('0x27')](handleEntityNotFound(_0x460c61,null))[_0xee28('0x27')](respondWithResult(_0x460c61,null))[_0xee28('0x43')](handleError(_0x460c61,null));};exports[_0xee28('0x49')]=function(_0x2574c5,_0x2b5f36){return db[_0xee28('0x31')][_0xee28('0x49')](_0x2574c5['body'],{})[_0xee28('0x27')](function(_0x5e174f){var _0x21a66a=_0x2574c5[_0xee28('0x4a')][_0xee28('0x28')]({'plain':!![]});if(!_0x21a66a)throw new Error(_0xee28('0x4b'));if(_0x21a66a[_0xee28('0x4c')]==='user'){var _0x5247fe=_0x5e174f['get']({'plain':!![]});var _0x1b15a4='Tags';return db['UserProfileSection'][_0xee28('0x48')]({'where':{'name':_0x1b15a4,'userProfileId':_0x21a66a['userProfileId']},'raw':!![]})[_0xee28('0x27')](function(_0x1f6754){if(_0x1f6754&&_0x1f6754[_0xee28('0x4d')]===0x0){return db[_0xee28('0x2a')][_0xee28('0x49')]({'name':_0x5247fe[_0xee28('0x2d')],'resourceId':_0x5247fe['id'],'type':_0x1f6754[_0xee28('0x2d')],'sectionId':_0x1f6754['id']},{})[_0xee28('0x27')](function(){return _0x5e174f;});}else{return _0x5e174f;}})[_0xee28('0x43')](function(_0x10d393){logger['error'](_0xee28('0x4e'),_0x10d393);throw _0x10d393;});}return _0x5e174f;})[_0xee28('0x27')](respondWithResult(_0x2b5f36,0xc9))[_0xee28('0x43')](handleError(_0x2b5f36,null));};exports['update']=function(_0x5b9ced,_0x57d865){if(_0x5b9ced['body']['id']){delete _0x5b9ced[_0xee28('0x4f')]['id'];}return db[_0xee28('0x31')][_0xee28('0x48')]({'where':{'id':_0x5b9ced['params']['id']}})[_0xee28('0x27')](handleEntityNotFound(_0x57d865,null))[_0xee28('0x27')](saveUpdates(_0x5b9ced[_0xee28('0x4f')],null))[_0xee28('0x27')](respondWithResult(_0x57d865,null))[_0xee28('0x43')](handleError(_0x57d865,null));};exports['destroy']=function(_0x2a5da9,_0x1c6696){return db[_0xee28('0x31')]['find']({'where':{'id':_0x2a5da9[_0xee28('0x50')]['id']}})[_0xee28('0x27')](handleEntityNotFound(_0x1c6696,null))[_0xee28('0x27')](removeEntity(_0x1c6696,null))[_0xee28('0x43')](handleError(_0x1c6696,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2a95e33..2ed2017 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 _0x96c1=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x339de7,_0x7c6d3a){var _0x1f7236=function(_0x4042c3){while(--_0x4042c3){_0x339de7['push'](_0x339de7['shift']());}};_0x1f7236(++_0x7c6d3a);}(_0x96c1,0x1bd));var _0x196c=function(_0x4dd8a0,_0x383c07){_0x4dd8a0=_0x4dd8a0-0x0;var _0x2b272a=_0x96c1[_0x4dd8a0];return _0x2b272a;};'use strict';var _=require(_0x196c('0x0'));var util=require(_0x196c('0x1'));var logger=require(_0x196c('0x2'))(_0x196c('0x3'));var moment=require(_0x196c('0x4'));var BPromise=require(_0x196c('0x5'));var rp=require(_0x196c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x196c('0x7'));var config=require(_0x196c('0x8'));var attributes=require(_0x196c('0x9'));module[_0x196c('0xa')]=function(_0x9f038f,_0x974473){return _0x9f038f[_0x196c('0xb')](_0x196c('0xc'),attributes,{'tableName':_0x196c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b1e=['rimraf','exports','define','Tag','lodash','util','api','bluebird','request-promise','path'];(function(_0xc17730,_0x161eff){var _0x3d9ee0=function(_0x896275){while(--_0x896275){_0xc17730['push'](_0xc17730['shift']());}};_0x3d9ee0(++_0x161eff);}(_0x2b1e,0x72));var _0xe2b1=function(_0x53961e,_0x2ec410){_0x53961e=_0x53961e-0x0;var _0x53523a=_0x2b1e[_0x53961e];return _0x53523a;};'use strict';var _=require(_0xe2b1('0x0'));var util=require(_0xe2b1('0x1'));var logger=require('../../config/logger')(_0xe2b1('0x2'));var moment=require('moment');var BPromise=require(_0xe2b1('0x3'));var rp=require(_0xe2b1('0x4'));var fs=require('fs');var path=require(_0xe2b1('0x5'));var rimraf=require(_0xe2b1('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xe2b1('0x7')]=function(_0x4837cd,_0x172367){return _0x4837cd[_0xe2b1('0x8')](_0xe2b1('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 78a749a..2465efc 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 _0x9221=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x549fb4,_0x57140c){var _0xc64c37=function(_0x40e702){while(--_0x40e702){_0x549fb4['push'](_0x549fb4['shift']());}};_0xc64c37(++_0x57140c);}(_0x9221,0x64));var _0x1922=function(_0x13f5a2,_0x435893){_0x13f5a2=_0x13f5a2-0x0;var _0x1c2719=_0x9221[_0x13f5a2];return _0x1c2719;};'use strict';var _=require('lodash');var util=require(_0x1922('0x0'));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('../../mysqldb')['db'];var utils=require(_0x1922('0x4'));var logger=require(_0x1922('0x5'))(_0x1922('0x6'));var config=require(_0x1922('0x7'));var jayson=require(_0x1922('0x8'));var client=jayson[_0x1922('0x9')][_0x1922('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aa05c,_0x116227,_0x3cfd98){return new BPromise(function(_0x195fa4,_0x47c225){return client[_0x1922('0xb')](_0x5aa05c,_0x3cfd98)['then'](function(_0x2b6c51){logger[_0x1922('0xc')](_0x1922('0xd'),_0x116227,'request\x20sent');logger[_0x1922('0xe')](_0x1922('0xf'),_0x116227,'request\x20sent',JSON[_0x1922('0x10')](_0x2b6c51));if(_0x2b6c51['error']){if(_0x2b6c51[_0x1922('0x11')]['code']===0x1f4){logger[_0x1922('0x11')](_0x1922('0xd'),_0x116227,_0x2b6c51[_0x1922('0x11')]['message']);return _0x47c225(_0x2b6c51['error'][_0x1922('0x12')]);}logger[_0x1922('0x11')](_0x1922('0xd'),_0x116227,_0x2b6c51[_0x1922('0x11')][_0x1922('0x12')]);return _0x195fa4(_0x2b6c51['error'][_0x1922('0x12')]);}else{logger['info'](_0x1922('0xd'),_0x116227,_0x1922('0x13'));_0x195fa4(_0x2b6c51[_0x1922('0x14')][_0x1922('0x12')]);}})['catch'](function(_0x459511){logger[_0x1922('0x11')](_0x1922('0xd'),_0x116227,_0x459511);_0x47c225(_0x459511);});});} \ No newline at end of file +var _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','Tag,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2287c3,_0x2b34e2){var _0x448916=function(_0x25b23a){while(--_0x25b23a){_0x2287c3['push'](_0x2287c3['shift']());}};_0x448916(++_0x2b34e2);}(_0x84ab,0x12f));var _0xb84a=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x84ab[_0x4a0e68];return _0x4fb274;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('Tag,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 571e3d6..7cea6e8 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 7c93637..2f8ff94 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xb7e7[_0x5834bc];return _0x3e183a;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 420454e..bb8bdd8 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 _0xb74b=['api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Team','rawAttributes','type','model','query','keys','attributes','fields','hasOwnProperty','sort','where','pick','filters','filter','merge','options','includeAll','findAll','rows','params','intersection','include','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','getQueues','channel','isValidChannel','Unknown\x20channel','capitalize','Queue','length','order','toLowerCase','addQueues','findOne','Sequelize','ValidationError','add','Queues','ids','remove','addAgents','isArray','Voice','Sms','Fax','Openchannel','transaction','through','QueueId','TeamVoiceQueue','penalty','User','emit','user','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','all','TeamVoicePrefix','UserVoicePrefix','spread','Chat','Mail','sequelize','VoicePrefixId','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0xec3b33,_0x5cdf24){var _0xdb039d=function(_0x40a351){while(--_0x40a351){_0xec3b33['push'](_0xec3b33['shift']());}};_0xdb039d(++_0x5cdf24);}(_0xb74b,0x6d));var _0xbb74=function(_0x2e440b,_0x540f27){_0x2e440b=_0x2e440b-0x0;var _0x46e1a4=_0xb74b[_0x2e440b];return _0x46e1a4;};'use strict';var emlformat=require(_0xbb74('0x0'));var rimraf=require(_0xbb74('0x1'));var zipdir=require(_0xbb74('0x2'));var jsonpatch=require(_0xbb74('0x3'));var rp=require('request-promise');var moment=require(_0xbb74('0x4'));var BPromise=require(_0xbb74('0x5'));var Mustache=require(_0xbb74('0x6'));var util=require(_0xbb74('0x7'));var path=require(_0xbb74('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb74('0x9'));var fs=require('fs');var fs_extra=require(_0xbb74('0xa'));var _=require(_0xbb74('0xb'));var squel=require('squel');var crypto=require(_0xbb74('0xc'));var jsforce=require(_0xbb74('0xd'));var deskjs=require(_0xbb74('0xe'));var toCsv=require(_0xbb74('0xf'));var querystring=require(_0xbb74('0x10'));var Papa=require(_0xbb74('0x11'));var Redis=require(_0xbb74('0x12'));var authService=require(_0xbb74('0x13'));var qs=require(_0xbb74('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb74('0x15'))(_0xbb74('0x16'));var utils=require(_0xbb74('0x17'));var config=require(_0xbb74('0x18'));var licenseUtil=require(_0xbb74('0x19'));var db=require('../../mysqldb')['db'];config[_0xbb74('0x1a')]=_[_0xbb74('0x1b')](config[_0xbb74('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb74('0x1c'))(new Redis(config[_0xbb74('0x1a')]));require(_0xbb74('0x1d'))[_0xbb74('0x1e')](socket);function respondWithStatusCode(_0x46e934,_0x29579c){_0x29579c=_0x29579c||0xcc;return function(_0x50e205){if(_0x50e205){return _0x46e934[_0xbb74('0x1f')](_0x29579c);}return _0x46e934[_0xbb74('0x20')](_0x29579c)[_0xbb74('0x21')]();};}function respondWithResult(_0x5b1a2a,_0x4f925d){_0x4f925d=_0x4f925d||0xc8;return function(_0x393660){if(_0x393660){return _0x5b1a2a['status'](_0x4f925d)[_0xbb74('0x22')](_0x393660);}};}function respondWithFilteredResult(_0x4ecfe4,_0x343048){return function(_0x558746){if(_0x558746){var _0x3fbc25=typeof _0x343048[_0xbb74('0x23')]===_0xbb74('0x24')&&typeof _0x343048[_0xbb74('0x25')]===_0xbb74('0x24');var _0x58f06e=_0x558746[_0xbb74('0x26')];var _0x1f919c=_0x3fbc25?0x0:_0x343048[_0xbb74('0x23')];var _0x51da19=_0x3fbc25?_0x558746[_0xbb74('0x26')]:_0x343048['offset']+_0x343048[_0xbb74('0x25')];var _0x524ba0;if(_0x51da19>=_0x58f06e){_0x51da19=_0x58f06e;_0x524ba0=0xc8;}else{_0x524ba0=0xce;}_0x4ecfe4[_0xbb74('0x20')](_0x524ba0);return _0x4ecfe4[_0xbb74('0x27')]('Content-Range',_0x1f919c+'-'+_0x51da19+'/'+_0x58f06e)[_0xbb74('0x22')](_0x558746);}return null;};}function patchUpdates(_0x3a2ba9){return function(_0x25fa77){try{jsonpatch[_0xbb74('0x28')](_0x25fa77,_0x3a2ba9,!![]);}catch(_0x3ccd9e){return BPromise[_0xbb74('0x29')](_0x3ccd9e);}return _0x25fa77['save']();};}function saveUpdates(_0x53512c,_0x163a43){return function(_0x4fd59f){if(_0x4fd59f){return _0x4fd59f[_0xbb74('0x2a')](_0x53512c)[_0xbb74('0x2b')](function(_0x4c49da){return _0x4c49da;});}return null;};}function removeEntity(_0x5485d5,_0x224930){return function(_0x3ca407){if(_0x3ca407){return _0x3ca407[_0xbb74('0x2c')]()[_0xbb74('0x2b')](function(){var _0x33c507=_0x3ca407[_0xbb74('0x2d')]({'plain':!![]});var _0x1b6a9e='Teams';return db[_0xbb74('0x2e')][_0xbb74('0x2c')]({'where':{'type':_0x1b6a9e,'resourceId':_0x33c507['id']}})[_0xbb74('0x2b')](function(){return _0x3ca407;});})['then'](function(){_0x5485d5['status'](0xcc)[_0xbb74('0x21')]();});}};}function handleEntityNotFound(_0x450a06,_0x179c07){return function(_0x3179d9){if(!_0x3179d9){_0x450a06[_0xbb74('0x1f')](0x194);}return _0x3179d9;};}function handleError(_0x1a91d8,_0xb98436){_0xb98436=_0xb98436||0x1f4;return function(_0x4087bb){logger[_0xbb74('0x2f')](_0x4087bb['stack']);if(_0x4087bb[_0xbb74('0x30')]){delete _0x4087bb[_0xbb74('0x30')];}_0x1a91d8[_0xbb74('0x20')](_0xb98436)[_0xbb74('0x31')](_0x4087bb);};}exports[_0xbb74('0x32')]=function(_0x37783a,_0x1cb7c7){var _0x313568={},_0x3a2d9f={},_0x5cc84c={'count':0x0,'rows':[]};var _0x10b1ce=_[_0xbb74('0x33')](db[_0xbb74('0x34')][_0xbb74('0x35')],function(_0x236163){return{'name':_0x236163['fieldName'],'type':_0x236163[_0xbb74('0x36')]['key']};});_0x3a2d9f[_0xbb74('0x37')]=_[_0xbb74('0x33')](_0x10b1ce,_0xbb74('0x30'));_0x3a2d9f[_0xbb74('0x38')]=_[_0xbb74('0x39')](_0x37783a[_0xbb74('0x38')]);_0x3a2d9f['filters']=_['intersection'](_0x3a2d9f['model'],_0x3a2d9f['query']);_0x313568[_0xbb74('0x3a')]=_['intersection'](_0x3a2d9f[_0xbb74('0x37')],qs[_0xbb74('0x3b')](_0x37783a[_0xbb74('0x38')][_0xbb74('0x3b')]));_0x313568['attributes']=_0x313568[_0xbb74('0x3a')]['length']?_0x313568[_0xbb74('0x3a')]:_0x3a2d9f[_0xbb74('0x37')];if(!_0x37783a[_0xbb74('0x38')][_0xbb74('0x3c')]('nolimit')){_0x313568[_0xbb74('0x25')]=qs['limit'](_0x37783a[_0xbb74('0x38')][_0xbb74('0x25')]);_0x313568[_0xbb74('0x23')]=qs[_0xbb74('0x23')](_0x37783a[_0xbb74('0x38')][_0xbb74('0x23')]);}_0x313568['order']=qs['sort'](_0x37783a[_0xbb74('0x38')][_0xbb74('0x3d')]);_0x313568[_0xbb74('0x3e')]=qs['filters'](_[_0xbb74('0x3f')](_0x37783a[_0xbb74('0x38')],_0x3a2d9f[_0xbb74('0x40')]),_0x10b1ce);if(_0x37783a[_0xbb74('0x38')][_0xbb74('0x41')]){_0x313568[_0xbb74('0x3e')]=_[_0xbb74('0x42')](_0x313568[_0xbb74('0x3e')],{'$or':_[_0xbb74('0x33')](_0x10b1ce,function(_0x5e6455){if(_0x5e6455[_0xbb74('0x36')]!=='VIRTUAL'){var _0x17bbe3={};_0x17bbe3[_0x5e6455[_0xbb74('0x30')]]={'$like':'%'+_0x37783a[_0xbb74('0x38')][_0xbb74('0x41')]+'%'};return _0x17bbe3;}})});}_0x313568=_['merge']({},_0x313568,_0x37783a[_0xbb74('0x43')]);var _0x142f33={'where':_0x313568[_0xbb74('0x3e')]};return db[_0xbb74('0x34')][_0xbb74('0x26')](_0x142f33)[_0xbb74('0x2b')](function(_0x399bd0){_0x5cc84c[_0xbb74('0x26')]=_0x399bd0;if(_0x37783a['query'][_0xbb74('0x44')]){_0x313568['include']=[{'all':!![]}];}return db[_0xbb74('0x34')][_0xbb74('0x45')](_0x313568);})[_0xbb74('0x2b')](function(_0x11e6a3){_0x5cc84c[_0xbb74('0x46')]=_0x11e6a3;return _0x5cc84c;})[_0xbb74('0x2b')](respondWithFilteredResult(_0x1cb7c7,_0x313568))['catch'](handleError(_0x1cb7c7,null));};exports['show']=function(_0x1b86bb,_0x5deb09){var _0x57547b={'raw':![],'where':{'id':_0x1b86bb[_0xbb74('0x47')]['id']}},_0x35f644={};_0x35f644[_0xbb74('0x37')]=_[_0xbb74('0x39')](db[_0xbb74('0x34')][_0xbb74('0x35')]);_0x35f644['query']=_['keys'](_0x1b86bb[_0xbb74('0x38')]);_0x35f644['filters']=_[_0xbb74('0x48')](_0x35f644[_0xbb74('0x37')],_0x35f644[_0xbb74('0x38')]);_0x57547b[_0xbb74('0x3a')]=_['intersection'](_0x35f644['model'],qs[_0xbb74('0x3b')](_0x1b86bb['query'][_0xbb74('0x3b')]));_0x57547b[_0xbb74('0x3a')]=_0x57547b[_0xbb74('0x3a')]['length']?_0x57547b[_0xbb74('0x3a')]:_0x35f644[_0xbb74('0x37')];if(_0x1b86bb[_0xbb74('0x38')]['includeAll']){_0x57547b[_0xbb74('0x49')]=[{'all':!![]}];}_0x57547b=_['merge']({},_0x57547b,_0x1b86bb[_0xbb74('0x43')]);return db['Team']['find'](_0x57547b)['then'](handleEntityNotFound(_0x5deb09,null))[_0xbb74('0x2b')](respondWithResult(_0x5deb09,null))[_0xbb74('0x4a')](handleError(_0x5deb09,null));};exports[_0xbb74('0x4b')]=function(_0x1d4bf2,_0x52e0fe){return db[_0xbb74('0x34')][_0xbb74('0x4b')](_0x1d4bf2[_0xbb74('0x4c')],{})[_0xbb74('0x2b')](function(_0x34996f){var _0x266736=_0x1d4bf2['user']['get']({'plain':!![]});if(!_0x266736)throw new Error(_0xbb74('0x4d'));if(_0x266736[_0xbb74('0x4e')]==='user'){var _0x33305f=_0x34996f[_0xbb74('0x2d')]({'plain':!![]});var _0x3278bf=_0xbb74('0x4f');return db[_0xbb74('0x50')][_0xbb74('0x51')]({'where':{'name':_0x3278bf,'userProfileId':_0x266736[_0xbb74('0x52')]},'raw':!![]})['then'](function(_0x1247de){if(_0x1247de&&_0x1247de[_0xbb74('0x53')]===0x0){return db[_0xbb74('0x2e')][_0xbb74('0x4b')]({'name':_0x33305f[_0xbb74('0x30')],'resourceId':_0x33305f['id'],'type':_0x1247de['name'],'sectionId':_0x1247de['id']},{})['then'](function(){return _0x34996f;});}else{return _0x34996f;}})['catch'](function(_0x3c4dc7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c4dc7);throw _0x3c4dc7;});}return _0x34996f;})[_0xbb74('0x2b')](respondWithResult(_0x52e0fe,0xc9))[_0xbb74('0x4a')](handleError(_0x52e0fe,null));};exports[_0xbb74('0x2a')]=function(_0x2e71ca,_0x393551){if(_0x2e71ca[_0xbb74('0x4c')]['id']){delete _0x2e71ca[_0xbb74('0x4c')]['id'];}return db[_0xbb74('0x34')][_0xbb74('0x51')]({'where':{'id':_0x2e71ca[_0xbb74('0x47')]['id']}})['then'](handleEntityNotFound(_0x393551,null))[_0xbb74('0x2b')](saveUpdates(_0x2e71ca[_0xbb74('0x4c')],null))[_0xbb74('0x2b')](respondWithResult(_0x393551,null))[_0xbb74('0x4a')](handleError(_0x393551,null));};exports[_0xbb74('0x2c')]=function(_0x4c2739,_0x247e07){return db[_0xbb74('0x34')][_0xbb74('0x51')]({'where':{'id':_0x4c2739[_0xbb74('0x47')]['id']}})[_0xbb74('0x2b')](handleEntityNotFound(_0x247e07,null))['then'](removeEntity(_0x247e07,null))[_0xbb74('0x4a')](handleError(_0x247e07,null));};exports[_0xbb74('0x54')]=function(_0x210710,_0x4c5cb8,_0x303eaa){return db[_0xbb74('0x34')]['findOne']({'where':{'id':_0x210710[_0xbb74('0x47')]['id']}})[_0xbb74('0x2b')](handleEntityNotFound(_0x4c5cb8,null))[_0xbb74('0x2b')](function(_0x8a7240){if(!_0x210710[_0xbb74('0x38')][_0xbb74('0x55')]||!utils[_0xbb74('0x56')](_0x210710[_0xbb74('0x38')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xbb74('0x57'));}var _0xbec515={};var _0x15d5fd={};_0x15d5fd[_0xbb74('0x37')]=_['keys'](db[_[_0xbb74('0x58')](_0x210710[_0xbb74('0x38')][_0xbb74('0x55')]['toLowerCase']())+_0xbb74('0x59')][_0xbb74('0x35')]);_0x15d5fd[_0xbb74('0x38')]=_[_0xbb74('0x39')](_0x210710['query']);_0x15d5fd[_0xbb74('0x40')]=_[_0xbb74('0x48')](_0x15d5fd['model'],_0x15d5fd[_0xbb74('0x38')]);_0xbec515[_0xbb74('0x3a')]=_['intersection'](_0x15d5fd[_0xbb74('0x37')],qs['fields'](_0x210710[_0xbb74('0x38')]['fields']));_0xbec515[_0xbb74('0x3a')]=_0xbec515[_0xbb74('0x3a')][_0xbb74('0x5a')]?_0xbec515[_0xbb74('0x3a')]:_0x15d5fd[_0xbb74('0x37')];_0xbec515[_0xbb74('0x25')]=qs[_0xbb74('0x25')](_0x210710[_0xbb74('0x38')][_0xbb74('0x25')]);_0xbec515[_0xbb74('0x23')]=qs['offset'](_0x210710['query'][_0xbb74('0x23')]);_0xbec515[_0xbb74('0x5b')]=qs[_0xbb74('0x3d')](_0x210710[_0xbb74('0x38')][_0xbb74('0x3d')]);_0xbec515[_0xbb74('0x3e')]=qs[_0xbb74('0x40')](_['pick'](_0x210710[_0xbb74('0x38')],_0x15d5fd[_0xbb74('0x40')]));_0xbec515=_[_0xbb74('0x42')]({},_0xbec515,_0x210710[_0xbb74('0x43')]);return _0x8a7240[_0xbb74('0x2d')+_[_0xbb74('0x58')](_0x210710[_0xbb74('0x38')][_0xbb74('0x55')][_0xbb74('0x5c')]())+'Queues'](_0xbec515);})[_0xbb74('0x2b')](respondWithResult(_0x4c5cb8,null))[_0xbb74('0x4a')](handleError(_0x4c5cb8,null));};exports[_0xbb74('0x5d')]=function(_0x39262a,_0x43f3f6,_0xc5cd88){return db[_0xbb74('0x34')][_0xbb74('0x5e')]({'where':{'id':_0x39262a[_0xbb74('0x47')]['id']}})[_0xbb74('0x2b')](function(_0x20b544){if(_0x20b544){if(!_0x39262a[_0xbb74('0x4c')][_0xbb74('0x55')]||!utils[_0xbb74('0x56')](_0x39262a[_0xbb74('0x4c')]['channel'])){throw new db[(_0xbb74('0x5f'))][(_0xbb74('0x60'))]('Unknown\x20channel');}return _0x20b544[_0xbb74('0x61')+_[_0xbb74('0x58')](_0x39262a[_0xbb74('0x4c')]['channel']['toLowerCase']())+_0xbb74('0x62')](_0x39262a[_0xbb74('0x4c')][_0xbb74('0x63')]);}return null;})[_0xbb74('0x2b')](handleEntityNotFound(_0x43f3f6,null))['then'](respondWithStatusCode(_0x43f3f6,null))['catch'](handleError(_0x43f3f6,null));};exports['removeQueues']=function(_0x2ef75b,_0x59e778,_0x33932b){return db[_0xbb74('0x34')][_0xbb74('0x5e')]({'where':{'id':_0x2ef75b['params']['id']}})['then'](function(_0x47c479){if(_0x47c479){if(!_0x2ef75b[_0xbb74('0x38')][_0xbb74('0x55')]||!utils[_0xbb74('0x56')](_0x2ef75b[_0xbb74('0x38')]['channel'])){throw new db['Sequelize'][(_0xbb74('0x60'))](_0xbb74('0x57'));}return _0x47c479[_0xbb74('0x64')+_[_0xbb74('0x58')](_0x2ef75b[_0xbb74('0x38')][_0xbb74('0x55')][_0xbb74('0x5c')]())+'Queues'](_0x2ef75b[_0xbb74('0x38')]['ids']);}return null;})[_0xbb74('0x2b')](handleEntityNotFound(_0x59e778,null))[_0xbb74('0x2b')](respondWithStatusCode(_0x59e778,null))[_0xbb74('0x4a')](handleError(_0x59e778,null));};exports[_0xbb74('0x65')]=function(_0x251288,_0x382069){var _0x37cda1=_[_0xbb74('0x66')](_0x251288['body'][_0xbb74('0x63')])?_0x251288[_0xbb74('0x4c')][_0xbb74('0x63')]:[_0x251288[_0xbb74('0x4c')][_0xbb74('0x63')]];var _0x2bb463=_0x251288[_0xbb74('0x47')]['id'];return db[_0xbb74('0x34')][_0xbb74('0x51')]({'where':{'id':_0x2bb463}})[_0xbb74('0x2b')](handleEntityNotFound(_0x382069,null))[_0xbb74('0x2b')](function(_0x1e5af5){if(_0x1e5af5){var _0x51f829=[_0xbb74('0x67'),'Chat','Mail',_0xbb74('0x68'),_0xbb74('0x69'),_0xbb74('0x6a'),'Whatsapp'];return db['sequelize'][_0xbb74('0x6b')](function(_0x470712){var _0x40b089=_[_0xbb74('0x33')](_0x51f829,function(_0x187cc0){var _0x2e4506={'attributes':['id',_0xbb74('0x30')]};if(_0x187cc0===_0xbb74('0x67')){_0x2e4506[_0xbb74('0x6c')]={'attributes':['penalty']};}return _0x1e5af5['get'+_0x187cc0+_0xbb74('0x62')](_0x2e4506)[_0xbb74('0x2b')](function(_0x4adb48){var _0x4e3eef=_[_0xbb74('0x33')](_0x4adb48,function(_0x1333e3){var _0x344240=_[_0xbb74('0x33')](_0x37cda1,function(_0xa17feb){var _0x327f87={'where':{'UserId':_0xa17feb,[_0x187cc0+_0xbb74('0x6d')]:_0x1333e3['id']},'transaction':_0x470712};if(_0x187cc0===_0xbb74('0x67')){_0x327f87[_0xbb74('0x1b')]={'penalty':_0x1333e3[_0xbb74('0x6e')][_0xbb74('0x6f')]};}return db[_0xbb74('0x70')+_0x187cc0+_0xbb74('0x59')]['findOrCreate'](_0x327f87)[_0xbb74('0x2b')](function(){socket[_0xbb74('0x71')](_0xbb74('0x72')+_0x187cc0+_0xbb74('0x73'),{'UserId':_0xa17feb,[_0x187cc0+_0xbb74('0x6d')]:_0x1333e3['id']});if(_0x187cc0!==_0xbb74('0x67')){return;}return db['User'][_0xbb74('0x45')]({'where':{'id':_0x37cda1,'online':0x1},'attributes':['id',_0xbb74('0x30'),_0xbb74('0x74'),_0xbb74('0x75'),'interface'],'raw':!![]})[_0xbb74('0x2b')](function(_0x257b63){var _0x2c082d=_[_0xbb74('0x33')](_0x257b63,function(_0x547ddf){return db[_0xbb74('0x76')][_0xbb74('0x77')]({'membername':_0x547ddf[_0xbb74('0x30')],'UserId':_0x547ddf['id'],'queue_name':_0x1333e3['name'],'VoiceQueueId':_0x1333e3['id'],'interface':_[_0xbb74('0x78')](_0x547ddf[_0xbb74('0x79')])?util['format']('SIP/%s',_0x547ddf['name']):_0x547ddf[_0xbb74('0x79')],'paused':_0x547ddf[_0xbb74('0x75')]||![],'penalty':_0x1333e3[_0xbb74('0x6e')][_0xbb74('0x6f')]},{'transaction':_0x470712});});return Promise[_0xbb74('0x7a')](_0x2c082d);});});});return Promise[_0xbb74('0x7a')](_0x344240);});return Promise[_0xbb74('0x7a')](_0x4e3eef);})[_0xbb74('0x2b')](function(){return db[_0xbb74('0x7b')][_0xbb74('0x5e')]({'where':{'teamId':_0x2bb463}})[_0xbb74('0x2b')](function(_0x352c81){if(_0x352c81){var _0x3b5cdf=_['map'](_0x37cda1,function(_0x3c9e1a){db[_0xbb74('0x7c')][_0xbb74('0x77')]({'UserId':_0x3c9e1a,'VoicePrefixId':_0x352c81['VoicePrefixId']});});return Promise[_0xbb74('0x7a')](_0x3b5cdf);}});});});return Promise[_0xbb74('0x7a')](_0x40b089)[_0xbb74('0x2b')](function(){return _0x1e5af5['addAgents'](_0x37cda1,{'transaction':_0x470712})[_0xbb74('0x7d')](function(_0x22d99c){return _0x22d99c;});});});}})[_0xbb74('0x2b')](respondWithResult(_0x382069,null))[_0xbb74('0x4a')](handleError(_0x382069,null));};exports['removeAgents']=function(_0x3d72df,_0x72f377){var _0x2ef3aa=_[_0xbb74('0x66')](_0x3d72df[_0xbb74('0x38')][_0xbb74('0x63')])?_0x3d72df[_0xbb74('0x38')][_0xbb74('0x63')]:[_0x3d72df[_0xbb74('0x38')][_0xbb74('0x63')]];var _0x2e821e=_0x3d72df[_0xbb74('0x47')]['id'];return db['Team'][_0xbb74('0x51')]({'where':{'id':_0x2e821e}})[_0xbb74('0x2b')](handleEntityNotFound(_0x72f377,null))[_0xbb74('0x2b')](function(_0x5048d3){if(_0x5048d3){var _0x2b6d80=[_0xbb74('0x67'),_0xbb74('0x7e'),_0xbb74('0x7f'),_0xbb74('0x68'),'Fax','Openchannel','Whatsapp'];return db[_0xbb74('0x80')][_0xbb74('0x6b')](function(_0x2dbd56){var _0x50ccf7=_[_0xbb74('0x33')](_0x2b6d80,function(_0x55a3c8){var _0x3f7b02={'attributes':['id',_0xbb74('0x30')]};return _0x5048d3['get'+_0x55a3c8+_0xbb74('0x62')](_0x3f7b02)[_0xbb74('0x2b')](function(_0x276677){var _0x268072=_[_0xbb74('0x33')](_0x276677,function(_0x3d5fe6){return _0x3d5fe6['removeAgents'](_0x2ef3aa,{'transaction':_0x2dbd56})[_0xbb74('0x2b')](function(){var _0xc429d3=_[_0xbb74('0x33')](_0x2ef3aa,function(_0x296c4c){socket[_0xbb74('0x71')](_0xbb74('0x72')+_0x55a3c8+'Queue:remove',{'UserId':Number(_0x296c4c),[_0x55a3c8+_0xbb74('0x6d')]:_0x3d5fe6['id']});if(_0x55a3c8!=='Voice'){return;}return db[_0xbb74('0x76')]['destroy']({'where':{'VoiceQueueId':_0x3d5fe6['id'],'UserId':_0x296c4c},'transaction':_0x2dbd56});});return Promise[_0xbb74('0x7a')](_0xc429d3);});});return Promise[_0xbb74('0x7a')](_0x268072);});});return Promise[_0xbb74('0x7a')](_0x50ccf7)[_0xbb74('0x2b')](function(){return _0x5048d3['removeAgents'](_0x2ef3aa,{'transaction':_0x2dbd56});})[_0xbb74('0x2b')](function(){return db[_0xbb74('0x7b')][_0xbb74('0x5e')]({'where':{'teamId':_0x2e821e}})[_0xbb74('0x2b')](function(_0x519d7c){if(_0x519d7c){var _0x327e3e=_[_0xbb74('0x33')](_0x2ef3aa,function(_0x4fa144){db[_0xbb74('0x7c')][_0xbb74('0x2c')]({'where':{'UserId':_0x4fa144,'VoicePrefixId':_0x519d7c[_0xbb74('0x81')]}});});return Promise[_0xbb74('0x7a')](_0x327e3e);}});});});}})[_0xbb74('0x2b')](respondWithStatusCode(_0x72f377,null))[_0xbb74('0x4a')](handleError(_0x72f377,null));};exports['getAgents']=function(_0x38d948,_0x1fd877,_0xba27c1){var _0x54ec76={};var _0x24cff5={};var _0x2b67d5;var _0x2a4767;return db['Team'][_0xbb74('0x5e')]({'where':{'id':_0x38d948[_0xbb74('0x47')]['id']}})[_0xbb74('0x2b')](handleEntityNotFound(_0x1fd877,null))[_0xbb74('0x2b')](function(_0x532a06){if(_0x532a06){_0x2b67d5=_0x532a06;_0x24cff5['model']=_['keys'](db[_0xbb74('0x70')]['rawAttributes']);_0x24cff5[_0xbb74('0x38')]=_[_0xbb74('0x39')](_0x38d948['query']);_0x24cff5[_0xbb74('0x40')]=_['intersection'](_0x24cff5['model'],_0x24cff5['query']);_0x54ec76[_0xbb74('0x3a')]=_[_0xbb74('0x48')](_0x24cff5['model'],qs['fields'](_0x38d948['query'][_0xbb74('0x3b')]));_0x54ec76[_0xbb74('0x3a')]=_0x54ec76[_0xbb74('0x3a')][_0xbb74('0x5a')]?_0x54ec76[_0xbb74('0x3a')]:_0x24cff5[_0xbb74('0x37')];_0x54ec76['order']=qs[_0xbb74('0x3d')](_0x38d948[_0xbb74('0x38')]['sort']);_0x54ec76[_0xbb74('0x3e')]=qs[_0xbb74('0x40')](_['pick'](_0x38d948[_0xbb74('0x38')],_0x24cff5[_0xbb74('0x40')]));if(_0x38d948['query'][_0xbb74('0x41')]){_0x54ec76[_0xbb74('0x3e')]=_['merge'](_0x54ec76[_0xbb74('0x3e')],{'$or':_['map'](_0x54ec76[_0xbb74('0x3a')],function(_0x2c3ada){var _0x568d43={};_0x568d43[_0x2c3ada]={'$like':'%'+_0x38d948['query'][_0xbb74('0x41')]+'%'};return _0x568d43;})});}_0x54ec76=_[_0xbb74('0x42')]({},_0x54ec76,_0x38d948[_0xbb74('0x43')]);return _0x2b67d5['getAgents'](_0x54ec76);}})[_0xbb74('0x2b')](function(_0x49c122){if(_0x49c122){_0x2a4767=_0x49c122[_0xbb74('0x5a')];if(!_0x38d948['query'][_0xbb74('0x3c')]('nolimit')){_0x54ec76[_0xbb74('0x25')]=qs[_0xbb74('0x25')](_0x38d948['query'][_0xbb74('0x25')]);_0x54ec76[_0xbb74('0x23')]=qs[_0xbb74('0x23')](_0x38d948[_0xbb74('0x38')][_0xbb74('0x23')]);}return _0x2b67d5[_0xbb74('0x82')](_0x54ec76);}})[_0xbb74('0x2b')](function(_0x3b77c6){if(_0x3b77c6){return _0x3b77c6?{'count':_0x2a4767,'rows':_0x3b77c6}:null;}})[_0xbb74('0x2b')](respondWithResult(_0x1fd877,null))['catch'](handleError(_0x1fd877,null));}; \ No newline at end of file +var _0x2e1c=['user','role','Teams','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getQueues','findOne','channel','isValidChannel','capitalize','toLowerCase','Queues','ValidationError','Unknown\x20channel','add','ids','removeQueues','Sequelize','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','through','QueueId','TeamVoiceQueue','Queue','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','TeamVoicePrefix','VoicePrefixId','spread','isArray','transaction','removeAgents','Queue:remove','UserVoicePrefix','getAgents','User','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Team','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','rawAttributes','keys'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x2e1c,0x1c8));var _0xc2e1=function(_0xb24013,_0x294d90){_0xb24013=_0xb24013-0x0;var _0x5a78eb=_0x2e1c[_0xb24013];return _0x5a78eb;};'use strict';var emlformat=require(_0xc2e1('0x0'));var rimraf=require(_0xc2e1('0x1'));var zipdir=require(_0xc2e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc2e1('0x3'));var moment=require(_0xc2e1('0x4'));var BPromise=require(_0xc2e1('0x5'));var Mustache=require(_0xc2e1('0x6'));var util=require('util');var path=require(_0xc2e1('0x7'));var sox=require(_0xc2e1('0x8'));var csv=require('to-csv');var ejs=require(_0xc2e1('0x9'));var fs=require('fs');var fs_extra=require(_0xc2e1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2e1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc2e1('0xc'));var toCsv=require(_0xc2e1('0xd'));var querystring=require(_0xc2e1('0xe'));var Papa=require(_0xc2e1('0xf'));var Redis=require(_0xc2e1('0x10'));var authService=require(_0xc2e1('0x11'));var qs=require(_0xc2e1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2e1('0x13'));var logger=require('../../config/logger')(_0xc2e1('0x14'));var utils=require('../../config/utils');var config=require(_0xc2e1('0x15'));var licenseUtil=require(_0xc2e1('0x16'));var db=require('../../mysqldb')['db'];config[_0xc2e1('0x17')]=_[_0xc2e1('0x18')](config[_0xc2e1('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc2e1('0x19'))(new Redis(config[_0xc2e1('0x17')]));require(_0xc2e1('0x1a'))[_0xc2e1('0x1b')](socket);function respondWithStatusCode(_0x5ae645,_0x4852bf){_0x4852bf=_0x4852bf||0xcc;return function(_0x3b5a1a){if(_0x3b5a1a){return _0x5ae645[_0xc2e1('0x1c')](_0x4852bf);}return _0x5ae645['status'](_0x4852bf)[_0xc2e1('0x1d')]();};}function respondWithResult(_0x2b5344,_0xb4e59f){_0xb4e59f=_0xb4e59f||0xc8;return function(_0x3a09ff){if(_0x3a09ff){return _0x2b5344['status'](_0xb4e59f)[_0xc2e1('0x1e')](_0x3a09ff);}};}function respondWithFilteredResult(_0xdff2ca,_0x594148){return function(_0x29ce89){if(_0x29ce89){var _0x2ec1ff=typeof _0x594148[_0xc2e1('0x1f')]===_0xc2e1('0x20')&&typeof _0x594148[_0xc2e1('0x21')]===_0xc2e1('0x20');var _0x4391ca=_0x29ce89[_0xc2e1('0x22')];var _0x1c2b9d=_0x2ec1ff?0x0:_0x594148[_0xc2e1('0x1f')];var _0xd63a8b=_0x2ec1ff?_0x29ce89[_0xc2e1('0x22')]:_0x594148[_0xc2e1('0x1f')]+_0x594148[_0xc2e1('0x21')];var _0x27ac6e;if(_0xd63a8b>=_0x4391ca){_0xd63a8b=_0x4391ca;_0x27ac6e=0xc8;}else{_0x27ac6e=0xce;}_0xdff2ca[_0xc2e1('0x23')](_0x27ac6e);return _0xdff2ca[_0xc2e1('0x24')](_0xc2e1('0x25'),_0x1c2b9d+'-'+_0xd63a8b+'/'+_0x4391ca)[_0xc2e1('0x1e')](_0x29ce89);}return null;};}function patchUpdates(_0x3a554c){return function(_0x452da8){try{jsonpatch[_0xc2e1('0x26')](_0x452da8,_0x3a554c,!![]);}catch(_0x433981){return BPromise[_0xc2e1('0x27')](_0x433981);}return _0x452da8['save']();};}function saveUpdates(_0x522094,_0x3c0310){return function(_0x4756c0){if(_0x4756c0){return _0x4756c0[_0xc2e1('0x28')](_0x522094)[_0xc2e1('0x29')](function(_0x3ad17d){return _0x3ad17d;});}return null;};}function removeEntity(_0x13eff7,_0x24925b){return function(_0x26d921){if(_0x26d921){return _0x26d921[_0xc2e1('0x2a')]()['then'](function(){var _0x4790d1=_0x26d921[_0xc2e1('0x2b')]({'plain':!![]});var _0x552968='Teams';return db[_0xc2e1('0x2c')][_0xc2e1('0x2a')]({'where':{'type':_0x552968,'resourceId':_0x4790d1['id']}})['then'](function(){return _0x26d921;});})['then'](function(){_0x13eff7[_0xc2e1('0x23')](0xcc)[_0xc2e1('0x1d')]();});}};}function handleEntityNotFound(_0x323232,_0xa93bdb){return function(_0x42859b){if(!_0x42859b){_0x323232[_0xc2e1('0x1c')](0x194);}return _0x42859b;};}function handleError(_0x352bbb,_0x586125){_0x586125=_0x586125||0x1f4;return function(_0x4b1c07){logger[_0xc2e1('0x2d')](_0x4b1c07[_0xc2e1('0x2e')]);if(_0x4b1c07['name']){delete _0x4b1c07[_0xc2e1('0x2f')];}_0x352bbb[_0xc2e1('0x23')](_0x586125)[_0xc2e1('0x30')](_0x4b1c07);};}exports[_0xc2e1('0x31')]=function(_0x50c63a,_0x7a040d){var _0x54c893={},_0x354705={},_0x9e35d7={'count':0x0,'rows':[]};var _0x2035a8=_[_0xc2e1('0x32')](db[_0xc2e1('0x33')]['rawAttributes'],function(_0x2a6549){return{'name':_0x2a6549[_0xc2e1('0x34')],'type':_0x2a6549[_0xc2e1('0x35')]['key']};});_0x354705[_0xc2e1('0x36')]=_[_0xc2e1('0x32')](_0x2035a8,_0xc2e1('0x2f'));_0x354705[_0xc2e1('0x37')]=_['keys'](_0x50c63a['query']);_0x354705[_0xc2e1('0x38')]=_[_0xc2e1('0x39')](_0x354705[_0xc2e1('0x36')],_0x354705['query']);_0x54c893[_0xc2e1('0x3a')]=_[_0xc2e1('0x39')](_0x354705[_0xc2e1('0x36')],qs[_0xc2e1('0x3b')](_0x50c63a['query'][_0xc2e1('0x3b')]));_0x54c893[_0xc2e1('0x3a')]=_0x54c893[_0xc2e1('0x3a')][_0xc2e1('0x3c')]?_0x54c893[_0xc2e1('0x3a')]:_0x354705['model'];if(!_0x50c63a[_0xc2e1('0x37')][_0xc2e1('0x3d')]('nolimit')){_0x54c893[_0xc2e1('0x21')]=qs[_0xc2e1('0x21')](_0x50c63a[_0xc2e1('0x37')]['limit']);_0x54c893[_0xc2e1('0x1f')]=qs[_0xc2e1('0x1f')](_0x50c63a[_0xc2e1('0x37')][_0xc2e1('0x1f')]);}_0x54c893[_0xc2e1('0x3e')]=qs[_0xc2e1('0x3f')](_0x50c63a['query']['sort']);_0x54c893['where']=qs['filters'](_[_0xc2e1('0x40')](_0x50c63a['query'],_0x354705[_0xc2e1('0x38')]),_0x2035a8);if(_0x50c63a[_0xc2e1('0x37')]['filter']){_0x54c893[_0xc2e1('0x41')]=_[_0xc2e1('0x42')](_0x54c893[_0xc2e1('0x41')],{'$or':_[_0xc2e1('0x32')](_0x2035a8,function(_0x38e828){if(_0x38e828['type']!==_0xc2e1('0x43')){var _0x5a9704={};_0x5a9704[_0x38e828['name']]={'$like':'%'+_0x50c63a[_0xc2e1('0x37')][_0xc2e1('0x44')]+'%'};return _0x5a9704;}})});}_0x54c893=_[_0xc2e1('0x42')]({},_0x54c893,_0x50c63a['options']);var _0x3e5bc0={'where':_0x54c893[_0xc2e1('0x41')]};return db['Team'][_0xc2e1('0x22')](_0x3e5bc0)[_0xc2e1('0x29')](function(_0x13fe0b){_0x9e35d7[_0xc2e1('0x22')]=_0x13fe0b;if(_0x50c63a[_0xc2e1('0x37')][_0xc2e1('0x45')]){_0x54c893[_0xc2e1('0x46')]=[{'all':!![]}];}return db[_0xc2e1('0x33')][_0xc2e1('0x47')](_0x54c893);})[_0xc2e1('0x29')](function(_0x13a96a){_0x9e35d7['rows']=_0x13a96a;return _0x9e35d7;})['then'](respondWithFilteredResult(_0x7a040d,_0x54c893))[_0xc2e1('0x48')](handleError(_0x7a040d,null));};exports[_0xc2e1('0x49')]=function(_0x235ea8,_0x1d9193){var _0x8e12b1={'raw':![],'where':{'id':_0x235ea8['params']['id']}},_0x59a264={};_0x59a264[_0xc2e1('0x36')]=_['keys'](db[_0xc2e1('0x33')][_0xc2e1('0x4a')]);_0x59a264[_0xc2e1('0x37')]=_[_0xc2e1('0x4b')](_0x235ea8[_0xc2e1('0x37')]);_0x59a264[_0xc2e1('0x38')]=_[_0xc2e1('0x39')](_0x59a264['model'],_0x59a264['query']);_0x8e12b1[_0xc2e1('0x3a')]=_[_0xc2e1('0x39')](_0x59a264[_0xc2e1('0x36')],qs[_0xc2e1('0x3b')](_0x235ea8[_0xc2e1('0x37')][_0xc2e1('0x3b')]));_0x8e12b1[_0xc2e1('0x3a')]=_0x8e12b1[_0xc2e1('0x3a')]['length']?_0x8e12b1[_0xc2e1('0x3a')]:_0x59a264[_0xc2e1('0x36')];if(_0x235ea8[_0xc2e1('0x37')][_0xc2e1('0x45')]){_0x8e12b1[_0xc2e1('0x46')]=[{'all':!![]}];}_0x8e12b1=_[_0xc2e1('0x42')]({},_0x8e12b1,_0x235ea8['options']);return db[_0xc2e1('0x33')]['find'](_0x8e12b1)[_0xc2e1('0x29')](handleEntityNotFound(_0x1d9193,null))['then'](respondWithResult(_0x1d9193,null))[_0xc2e1('0x48')](handleError(_0x1d9193,null));};exports['create']=function(_0x4de476,_0x46e1ff){return db[_0xc2e1('0x33')]['create'](_0x4de476['body'],{})[_0xc2e1('0x29')](function(_0x352f5e){var _0x12e255=_0x4de476[_0xc2e1('0x4c')][_0xc2e1('0x2b')]({'plain':!![]});if(!_0x12e255)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12e255[_0xc2e1('0x4d')]===_0xc2e1('0x4c')){var _0x234204=_0x352f5e['get']({'plain':!![]});var _0x2f6858=_0xc2e1('0x4e');return db['UserProfileSection'][_0xc2e1('0x4f')]({'where':{'name':_0x2f6858,'userProfileId':_0x12e255['userProfileId']},'raw':!![]})[_0xc2e1('0x29')](function(_0x5c7c23){if(_0x5c7c23&&_0x5c7c23[_0xc2e1('0x50')]===0x0){return db[_0xc2e1('0x2c')]['create']({'name':_0x234204['name'],'resourceId':_0x234204['id'],'type':_0x5c7c23[_0xc2e1('0x2f')],'sectionId':_0x5c7c23['id']},{})[_0xc2e1('0x29')](function(){return _0x352f5e;});}else{return _0x352f5e;}})[_0xc2e1('0x48')](function(_0x519251){logger[_0xc2e1('0x2d')](_0xc2e1('0x51'),_0x519251);throw _0x519251;});}return _0x352f5e;})[_0xc2e1('0x29')](respondWithResult(_0x46e1ff,0xc9))[_0xc2e1('0x48')](handleError(_0x46e1ff,null));};exports[_0xc2e1('0x28')]=function(_0x87d9dd,_0x38c10c){if(_0x87d9dd[_0xc2e1('0x52')]['id']){delete _0x87d9dd[_0xc2e1('0x52')]['id'];}return db['Team'][_0xc2e1('0x4f')]({'where':{'id':_0x87d9dd[_0xc2e1('0x53')]['id']}})[_0xc2e1('0x29')](handleEntityNotFound(_0x38c10c,null))[_0xc2e1('0x29')](saveUpdates(_0x87d9dd['body'],null))[_0xc2e1('0x29')](respondWithResult(_0x38c10c,null))['catch'](handleError(_0x38c10c,null));};exports[_0xc2e1('0x2a')]=function(_0x142b2f,_0x24789e){return db[_0xc2e1('0x33')][_0xc2e1('0x4f')]({'where':{'id':_0x142b2f[_0xc2e1('0x53')]['id']}})[_0xc2e1('0x29')](handleEntityNotFound(_0x24789e,null))[_0xc2e1('0x29')](removeEntity(_0x24789e,null))[_0xc2e1('0x48')](handleError(_0x24789e,null));};exports[_0xc2e1('0x54')]=function(_0x149c3d,_0x588f84,_0x558497){return db[_0xc2e1('0x33')][_0xc2e1('0x55')]({'where':{'id':_0x149c3d[_0xc2e1('0x53')]['id']}})['then'](handleEntityNotFound(_0x588f84,null))['then'](function(_0x35c903){if(!_0x149c3d[_0xc2e1('0x37')][_0xc2e1('0x56')]||!utils[_0xc2e1('0x57')](_0x149c3d[_0xc2e1('0x37')][_0xc2e1('0x56')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}var _0x24e1ee={};var _0xfa1c90={};_0xfa1c90[_0xc2e1('0x36')]=_[_0xc2e1('0x4b')](db[_[_0xc2e1('0x58')](_0x149c3d[_0xc2e1('0x37')]['channel'][_0xc2e1('0x59')]())+'Queue'][_0xc2e1('0x4a')]);_0xfa1c90[_0xc2e1('0x37')]=_['keys'](_0x149c3d[_0xc2e1('0x37')]);_0xfa1c90[_0xc2e1('0x38')]=_[_0xc2e1('0x39')](_0xfa1c90[_0xc2e1('0x36')],_0xfa1c90['query']);_0x24e1ee[_0xc2e1('0x3a')]=_['intersection'](_0xfa1c90[_0xc2e1('0x36')],qs[_0xc2e1('0x3b')](_0x149c3d[_0xc2e1('0x37')]['fields']));_0x24e1ee[_0xc2e1('0x3a')]=_0x24e1ee['attributes'][_0xc2e1('0x3c')]?_0x24e1ee['attributes']:_0xfa1c90[_0xc2e1('0x36')];_0x24e1ee[_0xc2e1('0x21')]=qs[_0xc2e1('0x21')](_0x149c3d[_0xc2e1('0x37')][_0xc2e1('0x21')]);_0x24e1ee['offset']=qs['offset'](_0x149c3d['query'][_0xc2e1('0x1f')]);_0x24e1ee[_0xc2e1('0x3e')]=qs['sort'](_0x149c3d[_0xc2e1('0x37')]['sort']);_0x24e1ee[_0xc2e1('0x41')]=qs['filters'](_[_0xc2e1('0x40')](_0x149c3d['query'],_0xfa1c90[_0xc2e1('0x38')]));_0x24e1ee=_[_0xc2e1('0x42')]({},_0x24e1ee,_0x149c3d['options']);return _0x35c903[_0xc2e1('0x2b')+_[_0xc2e1('0x58')](_0x149c3d[_0xc2e1('0x37')][_0xc2e1('0x56')][_0xc2e1('0x59')]())+_0xc2e1('0x5a')](_0x24e1ee);})[_0xc2e1('0x29')](respondWithResult(_0x588f84,null))[_0xc2e1('0x48')](handleError(_0x588f84,null));};exports['addQueues']=function(_0x12c9a4,_0x4b6c5f,_0x35fd4a){return db[_0xc2e1('0x33')]['findOne']({'where':{'id':_0x12c9a4[_0xc2e1('0x53')]['id']}})[_0xc2e1('0x29')](function(_0x1b25df){if(_0x1b25df){if(!_0x12c9a4[_0xc2e1('0x52')][_0xc2e1('0x56')]||!utils['isValidChannel'](_0x12c9a4[_0xc2e1('0x52')][_0xc2e1('0x56')])){throw new db['Sequelize'][(_0xc2e1('0x5b'))](_0xc2e1('0x5c'));}return _0x1b25df[_0xc2e1('0x5d')+_[_0xc2e1('0x58')](_0x12c9a4[_0xc2e1('0x52')][_0xc2e1('0x56')][_0xc2e1('0x59')]())+_0xc2e1('0x5a')](_0x12c9a4[_0xc2e1('0x52')][_0xc2e1('0x5e')]);}return null;})[_0xc2e1('0x29')](handleEntityNotFound(_0x4b6c5f,null))[_0xc2e1('0x29')](respondWithStatusCode(_0x4b6c5f,null))[_0xc2e1('0x48')](handleError(_0x4b6c5f,null));};exports[_0xc2e1('0x5f')]=function(_0x20a18d,_0x1211f2,_0x4f3bd1){return db['Team']['findOne']({'where':{'id':_0x20a18d[_0xc2e1('0x53')]['id']}})[_0xc2e1('0x29')](function(_0x270bb4){if(_0x270bb4){if(!_0x20a18d[_0xc2e1('0x37')]['channel']||!utils[_0xc2e1('0x57')](_0x20a18d[_0xc2e1('0x37')][_0xc2e1('0x56')])){throw new db[(_0xc2e1('0x60'))]['ValidationError'](_0xc2e1('0x5c'));}return _0x270bb4[_0xc2e1('0x61')+_['capitalize'](_0x20a18d[_0xc2e1('0x37')][_0xc2e1('0x56')]['toLowerCase']())+_0xc2e1('0x5a')](_0x20a18d[_0xc2e1('0x37')]['ids']);}return null;})[_0xc2e1('0x29')](handleEntityNotFound(_0x1211f2,null))[_0xc2e1('0x29')](respondWithStatusCode(_0x1211f2,null))[_0xc2e1('0x48')](handleError(_0x1211f2,null));};exports[_0xc2e1('0x62')]=function(_0x9e9c75,_0x3d4cd8){var _0x2e001d=_['isArray'](_0x9e9c75[_0xc2e1('0x52')]['ids'])?_0x9e9c75['body'][_0xc2e1('0x5e')]:[_0x9e9c75['body'][_0xc2e1('0x5e')]];var _0x355149=_0x9e9c75['params']['id'];return db['Team'][_0xc2e1('0x4f')]({'where':{'id':_0x355149}})['then'](handleEntityNotFound(_0x3d4cd8,null))[_0xc2e1('0x29')](function(_0x5bf1d6){if(_0x5bf1d6){var _0x2ffd3e=[_0xc2e1('0x63'),_0xc2e1('0x64'),_0xc2e1('0x65'),_0xc2e1('0x66'),_0xc2e1('0x67'),_0xc2e1('0x68'),_0xc2e1('0x69')];return db[_0xc2e1('0x6a')]['transaction'](function(_0x54d34f){var _0x1ecfa3=_[_0xc2e1('0x32')](_0x2ffd3e,function(_0x5708ce){var _0x25889c={'attributes':['id',_0xc2e1('0x2f')]};if(_0x5708ce===_0xc2e1('0x63')){_0x25889c[_0xc2e1('0x6b')]={'attributes':['penalty']};}return _0x5bf1d6[_0xc2e1('0x2b')+_0x5708ce+'Queues'](_0x25889c)[_0xc2e1('0x29')](function(_0x2925dc){var _0xf1fd64=_['map'](_0x2925dc,function(_0x5853c6){var _0x29cc83=_[_0xc2e1('0x32')](_0x2e001d,function(_0x48bb78){var _0x2e09db={'where':{'UserId':_0x48bb78,[_0x5708ce+_0xc2e1('0x6c')]:_0x5853c6['id']},'transaction':_0x54d34f};if(_0x5708ce==='Voice'){_0x2e09db['defaults']={'penalty':_0x5853c6[_0xc2e1('0x6d')]['penalty']};}return db['User'+_0x5708ce+_0xc2e1('0x6e')][_0xc2e1('0x6f')](_0x2e09db)[_0xc2e1('0x29')](function(){socket[_0xc2e1('0x70')](_0xc2e1('0x4c')+_0x5708ce+_0xc2e1('0x71'),{'UserId':_0x48bb78,[_0x5708ce+_0xc2e1('0x6c')]:_0x5853c6['id']});if(_0x5708ce!=='Voice'){return;}return db['User'][_0xc2e1('0x47')]({'where':{'id':_0x2e001d,'online':0x1},'attributes':['id',_0xc2e1('0x2f'),_0xc2e1('0x72'),'voicePause',_0xc2e1('0x73')],'raw':!![]})[_0xc2e1('0x29')](function(_0x4f800c){var _0x1acf62=_['map'](_0x4f800c,function(_0x589208){return db[_0xc2e1('0x74')][_0xc2e1('0x75')]({'membername':_0x589208[_0xc2e1('0x2f')],'UserId':_0x589208['id'],'queue_name':_0x5853c6[_0xc2e1('0x2f')],'VoiceQueueId':_0x5853c6['id'],'interface':_[_0xc2e1('0x76')](_0x589208[_0xc2e1('0x73')])?util[_0xc2e1('0x77')](_0xc2e1('0x78'),_0x589208[_0xc2e1('0x2f')]):_0x589208[_0xc2e1('0x73')],'paused':_0x589208['voicePause']||![],'penalty':_0x5853c6[_0xc2e1('0x6d')]['penalty']},{'transaction':_0x54d34f});});return Promise[_0xc2e1('0x79')](_0x1acf62);});});});return Promise[_0xc2e1('0x79')](_0x29cc83);});return Promise[_0xc2e1('0x79')](_0xf1fd64);})[_0xc2e1('0x29')](function(){return db[_0xc2e1('0x7a')][_0xc2e1('0x55')]({'where':{'teamId':_0x355149}})[_0xc2e1('0x29')](function(_0x165679){if(_0x165679){var _0x405b46=_[_0xc2e1('0x32')](_0x2e001d,function(_0x4dfe48){db['UserVoicePrefix'][_0xc2e1('0x75')]({'UserId':_0x4dfe48,'VoicePrefixId':_0x165679[_0xc2e1('0x7b')]});});return Promise[_0xc2e1('0x79')](_0x405b46);}});});});return Promise[_0xc2e1('0x79')](_0x1ecfa3)[_0xc2e1('0x29')](function(){return _0x5bf1d6['addAgents'](_0x2e001d,{'transaction':_0x54d34f})[_0xc2e1('0x7c')](function(_0x3ee275){return _0x3ee275;});});});}})[_0xc2e1('0x29')](respondWithResult(_0x3d4cd8,null))[_0xc2e1('0x48')](handleError(_0x3d4cd8,null));};exports['removeAgents']=function(_0x1204ef,_0x453a51){var _0x504d92=_[_0xc2e1('0x7d')](_0x1204ef[_0xc2e1('0x37')]['ids'])?_0x1204ef[_0xc2e1('0x37')][_0xc2e1('0x5e')]:[_0x1204ef[_0xc2e1('0x37')][_0xc2e1('0x5e')]];var _0x3eb4bf=_0x1204ef[_0xc2e1('0x53')]['id'];return db['Team']['find']({'where':{'id':_0x3eb4bf}})[_0xc2e1('0x29')](handleEntityNotFound(_0x453a51,null))[_0xc2e1('0x29')](function(_0x1e09e9){if(_0x1e09e9){var _0x18ebe3=[_0xc2e1('0x63'),_0xc2e1('0x64'),_0xc2e1('0x65'),'Sms',_0xc2e1('0x67'),'Openchannel',_0xc2e1('0x69')];return db[_0xc2e1('0x6a')][_0xc2e1('0x7e')](function(_0x2a9563){var _0x4ae56f=_[_0xc2e1('0x32')](_0x18ebe3,function(_0x71b62e){var _0x48bc98={'attributes':['id',_0xc2e1('0x2f')]};return _0x1e09e9['get'+_0x71b62e+_0xc2e1('0x5a')](_0x48bc98)[_0xc2e1('0x29')](function(_0x1bf7e9){var _0x328704=_['map'](_0x1bf7e9,function(_0x133982){return _0x133982[_0xc2e1('0x7f')](_0x504d92,{'transaction':_0x2a9563})[_0xc2e1('0x29')](function(){var _0x1c01bd=_[_0xc2e1('0x32')](_0x504d92,function(_0x561532){socket['emit'](_0xc2e1('0x4c')+_0x71b62e+_0xc2e1('0x80'),{'UserId':Number(_0x561532),[_0x71b62e+'QueueId']:_0x133982['id']});if(_0x71b62e!=='Voice'){return;}return db[_0xc2e1('0x74')]['destroy']({'where':{'VoiceQueueId':_0x133982['id'],'UserId':_0x561532},'transaction':_0x2a9563});});return Promise[_0xc2e1('0x79')](_0x1c01bd);});});return Promise[_0xc2e1('0x79')](_0x328704);});});return Promise[_0xc2e1('0x79')](_0x4ae56f)[_0xc2e1('0x29')](function(){return _0x1e09e9[_0xc2e1('0x7f')](_0x504d92,{'transaction':_0x2a9563});})[_0xc2e1('0x29')](function(){return db[_0xc2e1('0x7a')][_0xc2e1('0x55')]({'where':{'teamId':_0x3eb4bf}})['then'](function(_0x5126a6){if(_0x5126a6){var _0x34dab6=_['map'](_0x504d92,function(_0xe605e5){db[_0xc2e1('0x81')][_0xc2e1('0x2a')]({'where':{'UserId':_0xe605e5,'VoicePrefixId':_0x5126a6[_0xc2e1('0x7b')]}});});return Promise[_0xc2e1('0x79')](_0x34dab6);}});});});}})[_0xc2e1('0x29')](respondWithStatusCode(_0x453a51,null))['catch'](handleError(_0x453a51,null));};exports[_0xc2e1('0x82')]=function(_0x1eb36c,_0x197f80,_0x25c73f){var _0x5e167c={};var _0x27bea8={};var _0x312d87;var _0x3e746d;return db[_0xc2e1('0x33')]['findOne']({'where':{'id':_0x1eb36c['params']['id']}})[_0xc2e1('0x29')](handleEntityNotFound(_0x197f80,null))['then'](function(_0x22343f){if(_0x22343f){_0x312d87=_0x22343f;_0x27bea8[_0xc2e1('0x36')]=_[_0xc2e1('0x4b')](db[_0xc2e1('0x83')]['rawAttributes']);_0x27bea8[_0xc2e1('0x37')]=_[_0xc2e1('0x4b')](_0x1eb36c['query']);_0x27bea8[_0xc2e1('0x38')]=_[_0xc2e1('0x39')](_0x27bea8[_0xc2e1('0x36')],_0x27bea8[_0xc2e1('0x37')]);_0x5e167c[_0xc2e1('0x3a')]=_[_0xc2e1('0x39')](_0x27bea8[_0xc2e1('0x36')],qs['fields'](_0x1eb36c['query'][_0xc2e1('0x3b')]));_0x5e167c[_0xc2e1('0x3a')]=_0x5e167c[_0xc2e1('0x3a')][_0xc2e1('0x3c')]?_0x5e167c['attributes']:_0x27bea8[_0xc2e1('0x36')];_0x5e167c['order']=qs[_0xc2e1('0x3f')](_0x1eb36c[_0xc2e1('0x37')][_0xc2e1('0x3f')]);_0x5e167c['where']=qs[_0xc2e1('0x38')](_[_0xc2e1('0x40')](_0x1eb36c[_0xc2e1('0x37')],_0x27bea8[_0xc2e1('0x38')]));if(_0x1eb36c[_0xc2e1('0x37')][_0xc2e1('0x44')]){_0x5e167c[_0xc2e1('0x41')]=_[_0xc2e1('0x42')](_0x5e167c[_0xc2e1('0x41')],{'$or':_[_0xc2e1('0x32')](_0x5e167c[_0xc2e1('0x3a')],function(_0x3905c0){var _0x2f6006={};_0x2f6006[_0x3905c0]={'$like':'%'+_0x1eb36c[_0xc2e1('0x37')][_0xc2e1('0x44')]+'%'};return _0x2f6006;})});}_0x5e167c=_[_0xc2e1('0x42')]({},_0x5e167c,_0x1eb36c['options']);return _0x312d87['getAgents'](_0x5e167c);}})[_0xc2e1('0x29')](function(_0x1f9e03){if(_0x1f9e03){_0x3e746d=_0x1f9e03[_0xc2e1('0x3c')];if(!_0x1eb36c[_0xc2e1('0x37')]['hasOwnProperty'](_0xc2e1('0x84'))){_0x5e167c['limit']=qs[_0xc2e1('0x21')](_0x1eb36c[_0xc2e1('0x37')][_0xc2e1('0x21')]);_0x5e167c[_0xc2e1('0x1f')]=qs[_0xc2e1('0x1f')](_0x1eb36c[_0xc2e1('0x37')][_0xc2e1('0x1f')]);}return _0x312d87['getAgents'](_0x5e167c);}})[_0xc2e1('0x29')](function(_0x1d015e){if(_0x1d015e){return _0x1d015e?{'count':_0x3e746d,'rows':_0x1d015e}:null;}})[_0xc2e1('0x29')](respondWithResult(_0x197f80,null))[_0xc2e1('0x48')](handleError(_0x197f80,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 600dd5a..7c3318e 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 _0xb97c=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x42b1f6,_0x3df91b){var _0x37ee4f=function(_0x55df2){while(--_0x55df2){_0x42b1f6['push'](_0x42b1f6['shift']());}};_0x37ee4f(++_0x3df91b);}(_0xb97c,0x84));var _0xcb97=function(_0x51983b,_0x85092){_0x51983b=_0x51983b-0x0;var _0x190efc=_0xb97c[_0x51983b];return _0x190efc;};'use strict';var EventEmitter=require(_0xcb97('0x0'));var Team=require(_0xcb97('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xcb97('0x2')](0x0);var events={'afterCreate':_0xcb97('0x3'),'afterUpdate':_0xcb97('0x4'),'afterDestroy':_0xcb97('0x5')};function emitEvent(_0x1a0856){return function(_0x5d79cb,_0x14eb43,_0x800857){TeamEvents[_0xcb97('0x6')](_0x1a0856+':'+_0x5d79cb['id'],_0x5d79cb);TeamEvents['emit'](_0x1a0856,_0x5d79cb);_0x800857(null);};}for(var e in events){if(events[_0xcb97('0x7')](e)){var event=events[e];Team[_0xcb97('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xd79f=['hook','exports','../../mysqldb','save','remove','emit'];(function(_0x5e4548,_0x15f588){var _0x228870=function(_0x2f95fb){while(--_0x2f95fb){_0x5e4548['push'](_0x5e4548['shift']());}};_0x228870(++_0x15f588);}(_0xd79f,0x122));var _0xfd79=function(_0x2aaf41,_0x24923a){_0x2aaf41=_0x2aaf41-0x0;var _0x22b0b0=_0xd79f[_0x2aaf41];return _0x22b0b0;};'use strict';var EventEmitter=require('events');var Team=require(_0xfd79('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd79('0x1'),'afterUpdate':'update','afterDestroy':_0xfd79('0x2')};function emitEvent(_0x1ea7f4){return function(_0x526f1d,_0x486878,_0x1a4393){TeamEvents[_0xfd79('0x3')](_0x1ea7f4+':'+_0x526f1d['id'],_0x526f1d);TeamEvents[_0xfd79('0x3')](_0x1ea7f4,_0x526f1d);_0x1a4393(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xfd79('0x4')](e,emitEvent(event));}}module[_0xfd79('0x5')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 6199431..b0ab23c 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 _0x7c4a=['./team.attributes','exports','define','Team','teams','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x3e657e,_0x291656){var _0x33b3ed=function(_0x4911ef){while(--_0x4911ef){_0x3e657e['push'](_0x3e657e['shift']());}};_0x33b3ed(++_0x291656);}(_0x7c4a,0x1d3));var _0xa7c4=function(_0x1298ed,_0x39ba63){_0x1298ed=_0x1298ed-0x0;var _0x56b532=_0x7c4a[_0x1298ed];return _0x56b532;};'use strict';var _=require(_0xa7c4('0x0'));var util=require(_0xa7c4('0x1'));var logger=require('../../config/logger')(_0xa7c4('0x2'));var moment=require('moment');var BPromise=require(_0xa7c4('0x3'));var rp=require(_0xa7c4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa7c4('0x5'));var config=require('../../config/environment');var attributes=require(_0xa7c4('0x6'));module[_0xa7c4('0x7')]=function(_0x3122f9,_0xd3891e){return _0x3122f9[_0xa7c4('0x8')](_0xa7c4('0x9'),attributes,{'tableName':_0xa7c4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa582=['moment','bluebird','request-promise','path','exports','Team','teams','lodash','../../config/logger','api'];(function(_0x1c36a8,_0x49c835){var _0xb622c5=function(_0x24f4f3){while(--_0x24f4f3){_0x1c36a8['push'](_0x1c36a8['shift']());}};_0xb622c5(++_0x49c835);}(_0xa582,0x16f));var _0x2a58=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa582[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x2a58('0x0'));var util=require('util');var logger=require(_0x2a58('0x1'))(_0x2a58('0x2'));var moment=require(_0x2a58('0x3'));var BPromise=require(_0x2a58('0x4'));var rp=require(_0x2a58('0x5'));var fs=require('fs');var path=require(_0x2a58('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x2a58('0x7')]=function(_0xe91cc1,_0x5b5973){return _0xe91cc1['define'](_0x2a58('0x8'),attributes,{'tableName':_0x2a58('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 75b5605..d1be874 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 _0xf375=['debug','error','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x205733,_0x2dc909){var _0xae7850=function(_0x2f1cfc){while(--_0x2f1cfc){_0x205733['push'](_0x205733['shift']());}};_0xae7850(++_0x2dc909);}(_0xf375,0x147));var _0x5f37=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf375[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x5f37('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5f37('0x1'));var fs=require('fs');var Redis=require(_0x5f37('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f37('0x3'));var logger=require(_0x5f37('0x4'))('rpc');var config=require(_0x5f37('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5f37('0x6')][_0x5f37('0x7')]({'port':0x232a});config[_0x5f37('0x8')]=_[_0x5f37('0x9')](config[_0x5f37('0x8')],{'host':_0x5f37('0xa'),'port':0x18eb});var socket=require(_0x5f37('0xb'))(new Redis(config[_0x5f37('0x8')]));require('./team.socket')[_0x5f37('0xc')](socket);function respondWithRpcPromise(_0x4c7014,_0x12344e,_0xaf6510){return new BPromise(function(_0x5cde0b,_0x55dba6){return client[_0x5f37('0xd')](_0x4c7014,_0xaf6510)[_0x5f37('0xe')](function(_0x11bb09){logger[_0x5f37('0xf')](_0x5f37('0x10'),_0x12344e,_0x5f37('0x11'));logger[_0x5f37('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x12344e,_0x5f37('0x11'),JSON['stringify'](_0x11bb09));if(_0x11bb09[_0x5f37('0x13')]){if(_0x11bb09['error']['code']===0x1f4){logger[_0x5f37('0x13')](_0x5f37('0x10'),_0x12344e,_0x11bb09[_0x5f37('0x13')][_0x5f37('0x14')]);return _0x55dba6(_0x11bb09[_0x5f37('0x13')][_0x5f37('0x14')]);}logger[_0x5f37('0x13')](_0x5f37('0x10'),_0x12344e,_0x11bb09['error'][_0x5f37('0x14')]);return _0x5cde0b(_0x11bb09[_0x5f37('0x13')][_0x5f37('0x14')]);}else{logger['info'](_0x5f37('0x10'),_0x12344e,_0x5f37('0x11'));_0x5cde0b(_0x11bb09[_0x5f37('0x15')][_0x5f37('0x14')]);}})[_0x5f37('0x16')](function(_0x13fd9e){logger[_0x5f37('0x13')](_0x5f37('0x10'),_0x12344e,_0x13fd9e);_0x55dba6(_0x13fd9e);});});} \ No newline at end of file +var _0x739b=['socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x739b,0x15d));var _0xb739=function(_0x5039c0,_0x1be5b1){_0x5039c0=_0x5039c0-0x0;var _0x36b65b=_0x739b[_0x5039c0];return _0x36b65b;};'use strict';var _=require(_0xb739('0x0'));var util=require(_0xb739('0x1'));var moment=require(_0xb739('0x2'));var BPromise=require(_0xb739('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb739('0x4'));var db=require(_0xb739('0x5'))['db'];var utils=require(_0xb739('0x6'));var logger=require(_0xb739('0x7'))(_0xb739('0x8'));var config=require(_0xb739('0x9'));var jayson=require(_0xb739('0xa'));var client=jayson[_0xb739('0xb')]['http']({'port':0x232a});config[_0xb739('0xc')]=_[_0xb739('0xd')](config['redis'],{'host':_0xb739('0xe'),'port':0x18eb});var socket=require(_0xb739('0xf'))(new Redis(config[_0xb739('0xc')]));require(_0xb739('0x10'))[_0xb739('0x11')](socket);function respondWithRpcPromise(_0x2c734c,_0x443ac6,_0x2bd357){return new BPromise(function(_0x16b9e0,_0x145059){return client['request'](_0x2c734c,_0x2bd357)[_0xb739('0x12')](function(_0x519d2d){logger[_0xb739('0x13')](_0xb739('0x14'),_0x443ac6,_0xb739('0x15'));logger['debug'](_0xb739('0x16'),_0x443ac6,_0xb739('0x15'),JSON[_0xb739('0x17')](_0x519d2d));if(_0x519d2d[_0xb739('0x18')]){if(_0x519d2d[_0xb739('0x18')]['code']===0x1f4){logger[_0xb739('0x18')](_0xb739('0x14'),_0x443ac6,_0x519d2d['error']['message']);return _0x145059(_0x519d2d[_0xb739('0x18')][_0xb739('0x19')]);}logger['error']('Team,\x20%s,\x20%s',_0x443ac6,_0x519d2d[_0xb739('0x18')][_0xb739('0x19')]);return _0x16b9e0(_0x519d2d[_0xb739('0x18')]['message']);}else{logger[_0xb739('0x13')](_0xb739('0x14'),_0x443ac6,_0xb739('0x15'));_0x16b9e0(_0x519d2d[_0xb739('0x1a')][_0xb739('0x19')]);}})[_0xb739('0x1b')](function(_0x3ef948){logger[_0xb739('0x18')](_0xb739('0x14'),_0x443ac6,_0x3ef948);_0x145059(_0x3ef948);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 48ac57d..e53e7a7 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 _0xa249=['length','team:','./team.events','save','update'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xa249,0x183));var _0x9a24=function(_0x34648b,_0x425436){_0x34648b=_0x34648b-0x0;var _0x23489a=_0xa249[_0x34648b];return _0x23489a;};'use strict';var TeamEvents=require(_0x9a24('0x0'));var events=[_0x9a24('0x1'),'remove',_0x9a24('0x2')];function createListener(_0x251d51,_0x575a09){return function(_0x12ef32){_0x575a09['emit'](_0x251d51,_0x12ef32);};}function removeListener(_0x3f83df,_0x48c56d){return function(){TeamEvents['removeListener'](_0x3f83df,_0x48c56d);};}exports['register']=function(_0x1b0728){for(var _0x167980=0x0,_0x3f59a1=events[_0x9a24('0x3')];_0x167980<_0x3f59a1;_0x167980++){var _0x3f2459=events[_0x167980];var _0x22f220=createListener(_0x9a24('0x4')+_0x3f2459,_0x1b0728);TeamEvents['on'](_0x3f2459,_0x22f220);}}; \ No newline at end of file +var _0x2b2a=['register','save','remove','emit'];(function(_0x36e727,_0x22ca20){var _0x770a82=function(_0x4115b1){while(--_0x4115b1){_0x36e727['push'](_0x36e727['shift']());}};_0x770a82(++_0x22ca20);}(_0x2b2a,0x149));var _0xa2b2=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x2b2a[_0x126558];return _0x1f6d14;};'use strict';var TeamEvents=require('./team.events');var events=[_0xa2b2('0x0'),_0xa2b2('0x1'),'update'];function createListener(_0x2bea8e,_0x4e0560){return function(_0x4be2da){_0x4e0560[_0xa2b2('0x2')](_0x2bea8e,_0x4be2da);};}function removeListener(_0x7c415f,_0x53014d){return function(){TeamEvents['removeListener'](_0x7c415f,_0x53014d);};}exports[_0xa2b2('0x3')]=function(_0x2c0c87){for(var _0x29690f=0x0,_0x655546=events['length'];_0x29690f<_0x655546;_0x29690f++){var _0x5e066d=events[_0x29690f];var _0x47bc23=createListener('team:'+_0x5e066d,_0x2c0c87);TeamEvents['on'](_0x5e066d,_0x47bc23);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 4a9e59f..1aa3b9d 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 _0x9189=['INTEGER'];(function(_0x4fcf10,_0x2db1c9){var _0x474d90=function(_0x2997b7){while(--_0x2997b7){_0x4fcf10['push'](_0x4fcf10['shift']());}};_0x474d90(++_0x2db1c9);}(_0x9189,0x1b0));var _0x9918=function(_0x482fcb,_0x5a5ff2){_0x482fcb=_0x482fcb-0x0;var _0x4eae71=_0x9189[_0x482fcb];return _0x4eae71;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x9918('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x9918('0x0')]}}; \ No newline at end of file +var _0x37b4=['INTEGER','sequelize'];(function(_0x224704,_0x5e2a62){var _0x4890c5=function(_0x4417f2){while(--_0x4417f2){_0x224704['push'](_0x224704['shift']());}};_0x4890c5(++_0x5e2a62);}(_0x37b4,0xef));var _0x437b=function(_0x343dab,_0x134185){_0x343dab=_0x343dab-0x0;var _0xa7e52d=_0x37b4[_0x343dab];return _0xa7e52d;};'use strict';var Sequelize=require(_0x437b('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x437b('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x437b('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index c666522..3d441dd 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 _0x9e63=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','../../config/logger'];(function(_0x43acb6,_0x44e84e){var _0x1f2c7b=function(_0x5c104a){while(--_0x5c104a){_0x43acb6['push'](_0x43acb6['shift']());}};_0x1f2c7b(++_0x44e84e);}(_0x9e63,0x65));var _0x39e6=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x9e63[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var logger=require(_0x39e6('0x2'))('api');var moment=require(_0x39e6('0x3'));var BPromise=require(_0x39e6('0x4'));var rp=require(_0x39e6('0x5'));var fs=require('fs');var path=require(_0x39e6('0x6'));var rimraf=require(_0x39e6('0x7'));var config=require(_0x39e6('0x8'));var attributes=require(_0x39e6('0x9'));module[_0x39e6('0xa')]=function(_0x48f3bb,_0x367e77){return _0x48f3bb[_0x39e6('0xb')](_0x39e6('0xc'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb350=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./teamVoicePrefix.attributes','exports'];(function(_0x537fff,_0x4a9362){var _0x3c9874=function(_0x10b37d){while(--_0x10b37d){_0x537fff['push'](_0x537fff['shift']());}};_0x3c9874(++_0x4a9362);}(_0xb350,0x6f));var _0x0b35=function(_0xd06063,_0x2d9035){_0xd06063=_0xd06063-0x0;var _0x4dc9dd=_0xb350[_0xd06063];return _0x4dc9dd;};'use strict';var _=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var logger=require(_0x0b35('0x2'))(_0x0b35('0x3'));var moment=require('moment');var BPromise=require(_0x0b35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b35('0x5'));var rimraf=require('rimraf');var config=require(_0x0b35('0x6'));var attributes=require(_0x0b35('0x7'));module[_0x0b35('0x8')]=function(_0x1218c3,_0x417722){return _0x1218c3[_0x0b35('0x9')](_0x0b35('0xa'),attributes,{'tableName':_0x0b35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 0ab2068..221ff65 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x16ad64,_0x4dcee2){var _0x1ed263=function(_0x53c010){while(--_0x53c010){_0x16ad64['push'](_0x16ad64['shift']());}};_0x1ed263(++_0x4dcee2);}(_0x70e0,0x17b));var _0x070e=function(_0x32f95e,_0x21a460){_0x32f95e=_0x32f95e-0x0;var _0x3856b5=_0x70e0[_0x32f95e];return _0x3856b5;};'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(_0x148634,_0xb2a21c){var _0x4bf6ae=function(_0x46bc48){while(--_0x46bc48){_0x148634['push'](_0x148634['shift']());}};_0x4bf6ae(++_0xb2a21c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index c9c476c..706885a 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 _0xa3cf=['exports','INTEGER'];(function(_0x998868,_0x1fe845){var _0xa8cc08=function(_0x157aab){while(--_0x157aab){_0x998868['push'](_0x998868['shift']());}};_0xa8cc08(++_0x1fe845);}(_0xa3cf,0xfa));var _0xfa3c=function(_0x41d316,_0x167e72){_0x41d316=_0x41d316-0x0;var _0x1d9d2a=_0xa3cf[_0x41d316];return _0x1d9d2a;};'use strict';var Sequelize=require('sequelize');module[_0xfa3c('0x0')]={'penalty':{'type':Sequelize[_0xfa3c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x85e7=['INTEGER','sequelize'];(function(_0x1e5102,_0x43b35b){var _0x1a6705=function(_0x2d8f3e){while(--_0x2d8f3e){_0x1e5102['push'](_0x1e5102['shift']());}};_0x1a6705(++_0x43b35b);}(_0x85e7,0xad));var _0x785e=function(_0x18b910,_0x182ef0){_0x18b910=_0x18b910-0x0;var _0x59c95d=_0x85e7[_0x18b910];return _0x59c95d;};'use strict';var Sequelize=require(_0x785e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x785e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 65bca13..2de60fb 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 _0x0487=['api','moment','bluebird','path','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0487,0x14f));var _0x7048=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x0487[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require(_0x7048('0x0'));var util=require(_0x7048('0x1'));var logger=require(_0x7048('0x2'))(_0x7048('0x3'));var moment=require(_0x7048('0x4'));var BPromise=require(_0x7048('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7048('0x6'));var rimraf=require('rimraf');var config=require(_0x7048('0x7'));var attributes=require(_0x7048('0x8'));module[_0x7048('0x9')]=function(_0x3e709b,_0x53c160){return _0x3e709b[_0x7048('0xa')](_0x7048('0xb'),attributes,{'tableName':_0x7048('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x130d=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x218947,_0x22c2a0){var _0x25c3bd=function(_0x4b6652){while(--_0x4b6652){_0x218947['push'](_0x218947['shift']());}};_0x25c3bd(++_0x22c2a0);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var logger=require(_0xd130('0x1'))('api');var moment=require(_0xd130('0x2'));var BPromise=require(_0xd130('0x3'));var rp=require(_0xd130('0x4'));var fs=require('fs');var path=require(_0xd130('0x5'));var rimraf=require(_0xd130('0x6'));var config=require(_0xd130('0x7'));var attributes=require(_0xd130('0x8'));module[_0xd130('0x9')]=function(_0x287e61,_0x4689a8){return _0x287e61[_0xd130('0xa')](_0xd130('0xb'),attributes,{'tableName':_0xd130('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 6f6c07e..cd52751 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 _0x732c=['client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5b733d,_0x272606){var _0x2b7995=function(_0x1e5bf8){while(--_0x1e5bf8){_0x5b733d['push'](_0x5b733d['shift']());}};_0x2b7995(++_0x272606);}(_0x732c,0x151));var _0xc732=function(_0x2fcf65,_0x1317bf){_0x2fcf65=_0x2fcf65-0x0;var _0x2323e3=_0x732c[_0x2fcf65];return _0x2323e3;};'use strict';var _=require(_0xc732('0x0'));var util=require('util');var moment=require(_0xc732('0x1'));var BPromise=require('bluebird');var rs=require(_0xc732('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc732('0x3'))['db'];var utils=require(_0xc732('0x4'));var logger=require('../../config/logger')(_0xc732('0x5'));var config=require(_0xc732('0x6'));var jayson=require(_0xc732('0x7'));var client=jayson[_0xc732('0x8')][_0xc732('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x138ef7,_0x4fd566,_0x69cdcf){return new BPromise(function(_0x553294,_0x11f71b){return client[_0xc732('0xa')](_0x138ef7,_0x69cdcf)[_0xc732('0xb')](function(_0x241a22){logger[_0xc732('0xc')](_0xc732('0xd'),_0x4fd566,_0xc732('0xe'));logger[_0xc732('0xf')](_0xc732('0x10'),_0x4fd566,_0xc732('0xe'),JSON[_0xc732('0x11')](_0x241a22));if(_0x241a22[_0xc732('0x12')]){if(_0x241a22[_0xc732('0x12')][_0xc732('0x13')]===0x1f4){logger[_0xc732('0x12')](_0xc732('0xd'),_0x4fd566,_0x241a22['error'][_0xc732('0x14')]);return _0x11f71b(_0x241a22[_0xc732('0x12')][_0xc732('0x14')]);}logger['error'](_0xc732('0xd'),_0x4fd566,_0x241a22[_0xc732('0x12')]['message']);return _0x553294(_0x241a22[_0xc732('0x12')]['message']);}else{logger[_0xc732('0xc')](_0xc732('0xd'),_0x4fd566,_0xc732('0xe'));_0x553294(_0x241a22[_0xc732('0x15')]['message']);}})[_0xc732('0x16')](function(_0x24786b){logger[_0xc732('0x12')](_0xc732('0xd'),_0x4fd566,_0x24786b);_0x11f71b(_0x24786b);});});} \ No newline at end of file +var _0x1fe2=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','info','result','catch','lodash'];(function(_0x191ff0,_0x50515a){var _0x1003ac=function(_0x3c920d){while(--_0x3c920d){_0x191ff0['push'](_0x191ff0['shift']());}};_0x1003ac(++_0x50515a);}(_0x1fe2,0x72));var _0x21fe=function(_0x256098,_0xe6d89c){_0x256098=_0x256098-0x0;var _0x4eb2ac=_0x1fe2[_0x256098];return _0x4eb2ac;};'use strict';var _=require(_0x21fe('0x0'));var util=require(_0x21fe('0x1'));var moment=require(_0x21fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x21fe('0x3'));var fs=require('fs');var Redis=require(_0x21fe('0x4'));var db=require(_0x21fe('0x5'))['db'];var utils=require(_0x21fe('0x6'));var logger=require(_0x21fe('0x7'))('rpc');var config=require(_0x21fe('0x8'));var jayson=require(_0x21fe('0x9'));var client=jayson[_0x21fe('0xa')][_0x21fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b4e82,_0x4a45ba,_0x223ec5){return new BPromise(function(_0x14536f,_0x431336){return client[_0x21fe('0xc')](_0x2b4e82,_0x223ec5)['then'](function(_0x3f660d){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x4a45ba,'request\x20sent');logger['debug'](_0x21fe('0xd'),_0x4a45ba,_0x21fe('0xe'),JSON[_0x21fe('0xf')](_0x3f660d));if(_0x3f660d['error']){if(_0x3f660d[_0x21fe('0x10')][_0x21fe('0x11')]===0x1f4){logger[_0x21fe('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4a45ba,_0x3f660d[_0x21fe('0x10')][_0x21fe('0x12')]);return _0x431336(_0x3f660d[_0x21fe('0x10')]['message']);}logger[_0x21fe('0x10')](_0x21fe('0x13'),_0x4a45ba,_0x3f660d[_0x21fe('0x10')][_0x21fe('0x12')]);return _0x14536f(_0x3f660d[_0x21fe('0x10')][_0x21fe('0x12')]);}else{logger[_0x21fe('0x14')](_0x21fe('0x13'),_0x4a45ba,'request\x20sent');_0x14536f(_0x3f660d[_0x21fe('0x15')]['message']);}})[_0x21fe('0x16')](function(_0x3fa079){logger[_0x21fe('0x10')](_0x21fe('0x13'),_0x4a45ba,_0x3fa079);_0x431336(_0x3fa079);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f4011c1..35b1205 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 _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x955f,0x1eb));var _0xf955=function(_0x1b4400,_0x468581){_0x1b4400=_0x1b4400-0x0;var _0x2c7d78=_0x955f[_0x1b4400];return _0x2c7d78;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./template.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file +var _0xa7b5=['post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x5933d0,_0x2af3b0){_0x5933d0=_0x5933d0-0x0;var _0x323374=_0xa7b5[_0x5933d0];return _0x323374;};'use strict';var multer=require(_0x5a7b('0x0'));var util=require('util');var path=require(_0x5a7b('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a7b('0x2'));var router=express[_0x5a7b('0x3')]();var fs_extra=require(_0x5a7b('0x4'));var auth=require(_0x5a7b('0x5'));var interaction=require(_0x5a7b('0x6'));var config=require(_0x5a7b('0x7'));var controller=require(_0x5a7b('0x8'));router[_0x5a7b('0x9')]('/',auth[_0x5a7b('0xa')](),controller[_0x5a7b('0xb')]);router[_0x5a7b('0x9')](_0x5a7b('0xc'),auth[_0x5a7b('0xa')](),controller[_0x5a7b('0xd')]);router[_0x5a7b('0xe')]('/',auth[_0x5a7b('0xa')](),controller[_0x5a7b('0xf')]);router[_0x5a7b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5a7b('0x11')]);router['delete'](_0x5a7b('0xc'),auth[_0x5a7b('0xa')](),controller[_0x5a7b('0x12')]);module[_0x5a7b('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 3df1976..9f55075 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 _0x5f70=['TEXT','sequelize','exports','STRING'];(function(_0x43566f,_0x59c4b0){var _0x4b6263=function(_0x22dc88){while(--_0x22dc88){_0x43566f['push'](_0x43566f['shift']());}};_0x4b6263(++_0x59c4b0);}(_0x5f70,0xc1));var _0x05f7=function(_0x8d363e,_0x15cc38){_0x8d363e=_0x8d363e-0x0;var _0x3a3bff=_0x5f70[_0x8d363e];return _0x3a3bff;};'use strict';var Sequelize=require(_0x05f7('0x0'));module[_0x05f7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x05f7('0x2')]},'html':{'type':Sequelize[_0x05f7('0x3')]}}; \ No newline at end of file +var _0x58ef=['sequelize','exports','STRING','TEXT'];(function(_0x141957,_0x31f654){var _0x42abdd=function(_0x41ba2f){while(--_0x41ba2f){_0x141957['push'](_0x141957['shift']());}};_0x42abdd(++_0x31f654);}(_0x58ef,0x154));var _0xf58e=function(_0x2cb9de,_0x57f1d4){_0x2cb9de=_0x2cb9de-0x0;var _0x65384c=_0x58ef[_0x2cb9de];return _0x65384c;};'use strict';var Sequelize=require(_0xf58e('0x0'));module[_0xf58e('0x1')]={'name':{'type':Sequelize[_0xf58e('0x2')]},'description':{'type':Sequelize[_0xf58e('0x2')]},'html':{'type':Sequelize[_0xf58e('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5ebed36..e80bdc5 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 _0x7939=['query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','save','destroy','get','Templates','UserProfileResource','then','sendStatus','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model'];(function(_0x1b71c6,_0x5ce7e4){var _0x493849=function(_0x199bd3){while(--_0x199bd3){_0x1b71c6['push'](_0x1b71c6['shift']());}};_0x493849(++_0x5ce7e4);}(_0x7939,0x1c4));var _0x9793=function(_0x3dc603,_0x10ca8a){_0x3dc603=_0x3dc603-0x0;var _0x2ba542=_0x7939[_0x3dc603];return _0x2ba542;};'use strict';var emlformat=require(_0x9793('0x0'));var rimraf=require(_0x9793('0x1'));var zipdir=require(_0x9793('0x2'));var jsonpatch=require(_0x9793('0x3'));var rp=require(_0x9793('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9793('0x5'));var util=require('util');var path=require(_0x9793('0x6'));var sox=require(_0x9793('0x7'));var csv=require(_0x9793('0x8'));var ejs=require(_0x9793('0x9'));var fs=require('fs');var fs_extra=require(_0x9793('0xa'));var _=require(_0x9793('0xb'));var squel=require(_0x9793('0xc'));var crypto=require('crypto');var jsforce=require(_0x9793('0xd'));var deskjs=require(_0x9793('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9793('0xf'));var Papa=require(_0x9793('0x10'));var Redis=require(_0x9793('0x11'));var authService=require(_0x9793('0x12'));var qs=require(_0x9793('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9793('0x14'));var logger=require(_0x9793('0x15'))(_0x9793('0x16'));var utils=require(_0x9793('0x17'));var config=require(_0x9793('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9793('0x19'))['db'];function respondWithStatusCode(_0x5c0fa4,_0x161ae5){_0x161ae5=_0x161ae5||0xcc;return function(_0x4d92c0){if(_0x4d92c0){return _0x5c0fa4['sendStatus'](_0x161ae5);}return _0x5c0fa4[_0x9793('0x1a')](_0x161ae5)[_0x9793('0x1b')]();};}function respondWithResult(_0x167a61,_0x13852d){_0x13852d=_0x13852d||0xc8;return function(_0x5082be){if(_0x5082be){return _0x167a61[_0x9793('0x1a')](_0x13852d)[_0x9793('0x1c')](_0x5082be);}};}function respondWithFilteredResult(_0x1ac68f,_0x55c4e5){return function(_0x5a9c92){if(_0x5a9c92){var _0x17f1eb=typeof _0x55c4e5[_0x9793('0x1d')]==='undefined'&&typeof _0x55c4e5[_0x9793('0x1e')]===_0x9793('0x1f');var _0x1a6423=_0x5a9c92[_0x9793('0x20')];var _0x1ffc22=_0x17f1eb?0x0:_0x55c4e5['offset'];var _0x13a260=_0x17f1eb?_0x5a9c92[_0x9793('0x20')]:_0x55c4e5['offset']+_0x55c4e5[_0x9793('0x1e')];var _0x22bc06;if(_0x13a260>=_0x1a6423){_0x13a260=_0x1a6423;_0x22bc06=0xc8;}else{_0x22bc06=0xce;}_0x1ac68f[_0x9793('0x1a')](_0x22bc06);return _0x1ac68f['set'](_0x9793('0x21'),_0x1ffc22+'-'+_0x13a260+'/'+_0x1a6423)[_0x9793('0x1c')](_0x5a9c92);}return null;};}function patchUpdates(_0x3022d1){return function(_0x482046){try{jsonpatch['apply'](_0x482046,_0x3022d1,!![]);}catch(_0x17c21b){return BPromise['reject'](_0x17c21b);}return _0x482046[_0x9793('0x22')]();};}function saveUpdates(_0x27dfe4,_0x53f6d1){return function(_0x468621){if(_0x468621){return _0x468621['update'](_0x27dfe4)['then'](function(_0x593368){return _0x593368;});}return null;};}function removeEntity(_0x292f1d,_0x27a471){return function(_0x55608e){if(_0x55608e){return _0x55608e[_0x9793('0x23')]()['then'](function(){var _0x319b3c=_0x55608e[_0x9793('0x24')]({'plain':!![]});var _0x53bede=_0x9793('0x25');return db[_0x9793('0x26')][_0x9793('0x23')]({'where':{'type':_0x53bede,'resourceId':_0x319b3c['id']}})[_0x9793('0x27')](function(){return _0x55608e;});})[_0x9793('0x27')](function(){_0x292f1d[_0x9793('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dee6a,_0x424287){return function(_0x4d9822){if(!_0x4d9822){_0x3dee6a[_0x9793('0x28')](0x194);}return _0x4d9822;};}function handleError(_0x5e8aab,_0x3ab789){_0x3ab789=_0x3ab789||0x1f4;return function(_0x3a0e87){logger['error'](_0x3a0e87[_0x9793('0x29')]);if(_0x3a0e87[_0x9793('0x2a')]){delete _0x3a0e87['name'];}_0x5e8aab[_0x9793('0x1a')](_0x3ab789)[_0x9793('0x2b')](_0x3a0e87);};}exports[_0x9793('0x2c')]=function(_0xbf07b3,_0x27c3bd){var _0x25f37c={},_0xcea926={},_0xfa1a88={'count':0x0,'rows':[]};var _0x567254=_[_0x9793('0x2d')](db[_0x9793('0x2e')][_0x9793('0x2f')],function(_0x5ce5e2){return{'name':_0x5ce5e2[_0x9793('0x30')],'type':_0x5ce5e2[_0x9793('0x31')][_0x9793('0x32')]};});_0xcea926[_0x9793('0x33')]=_[_0x9793('0x2d')](_0x567254,_0x9793('0x2a'));_0xcea926[_0x9793('0x34')]=_['keys'](_0xbf07b3[_0x9793('0x34')]);_0xcea926[_0x9793('0x35')]=_[_0x9793('0x36')](_0xcea926[_0x9793('0x33')],_0xcea926[_0x9793('0x34')]);_0x25f37c['attributes']=_[_0x9793('0x36')](_0xcea926[_0x9793('0x33')],qs[_0x9793('0x37')](_0xbf07b3[_0x9793('0x34')]['fields']));_0x25f37c[_0x9793('0x38')]=_0x25f37c[_0x9793('0x38')][_0x9793('0x39')]?_0x25f37c[_0x9793('0x38')]:_0xcea926[_0x9793('0x33')];if(!_0xbf07b3[_0x9793('0x34')][_0x9793('0x3a')]('nolimit')){_0x25f37c['limit']=qs[_0x9793('0x1e')](_0xbf07b3[_0x9793('0x34')][_0x9793('0x1e')]);_0x25f37c['offset']=qs[_0x9793('0x1d')](_0xbf07b3[_0x9793('0x34')][_0x9793('0x1d')]);}_0x25f37c[_0x9793('0x3b')]=qs[_0x9793('0x3c')](_0xbf07b3[_0x9793('0x34')][_0x9793('0x3c')]);_0x25f37c[_0x9793('0x3d')]=qs['filters'](_[_0x9793('0x3e')](_0xbf07b3[_0x9793('0x34')],_0xcea926[_0x9793('0x35')]),_0x567254);if(_0xbf07b3[_0x9793('0x34')][_0x9793('0x3f')]){_0x25f37c[_0x9793('0x3d')]=_[_0x9793('0x40')](_0x25f37c['where'],{'$or':_[_0x9793('0x2d')](_0x567254,function(_0xdd56df){if(_0xdd56df[_0x9793('0x31')]!==_0x9793('0x41')){var _0x45a80a={};_0x45a80a[_0xdd56df['name']]={'$like':'%'+_0xbf07b3[_0x9793('0x34')]['filter']+'%'};return _0x45a80a;}})});}_0x25f37c=_[_0x9793('0x40')]({},_0x25f37c,_0xbf07b3[_0x9793('0x42')]);var _0x38adaf={'where':_0x25f37c[_0x9793('0x3d')]};return db['Template'][_0x9793('0x20')](_0x38adaf)[_0x9793('0x27')](function(_0x37c50b){_0xfa1a88['count']=_0x37c50b;if(_0xbf07b3['query'][_0x9793('0x43')]){_0x25f37c['include']=[{'all':!![]}];}return db[_0x9793('0x2e')][_0x9793('0x44')](_0x25f37c);})[_0x9793('0x27')](function(_0x3def41){_0xfa1a88[_0x9793('0x45')]=_0x3def41;return _0xfa1a88;})[_0x9793('0x27')](respondWithFilteredResult(_0x27c3bd,_0x25f37c))[_0x9793('0x46')](handleError(_0x27c3bd,null));};exports['show']=function(_0x52740d,_0x250c9a){var _0x4a3a10={'raw':!![],'where':{'id':_0x52740d[_0x9793('0x47')]['id']}},_0x58107c={};_0x58107c[_0x9793('0x33')]=_[_0x9793('0x48')](db[_0x9793('0x2e')][_0x9793('0x2f')]);_0x58107c[_0x9793('0x34')]=_['keys'](_0x52740d[_0x9793('0x34')]);_0x58107c[_0x9793('0x35')]=_[_0x9793('0x36')](_0x58107c[_0x9793('0x33')],_0x58107c[_0x9793('0x34')]);_0x4a3a10[_0x9793('0x38')]=_[_0x9793('0x36')](_0x58107c[_0x9793('0x33')],qs[_0x9793('0x37')](_0x52740d[_0x9793('0x34')]['fields']));_0x4a3a10[_0x9793('0x38')]=_0x4a3a10[_0x9793('0x38')]['length']?_0x4a3a10[_0x9793('0x38')]:_0x58107c[_0x9793('0x33')];if(_0x52740d['query'][_0x9793('0x43')]){_0x4a3a10[_0x9793('0x49')]=[{'all':!![]}];}_0x4a3a10=_[_0x9793('0x40')]({},_0x4a3a10,_0x52740d[_0x9793('0x42')]);return db[_0x9793('0x2e')][_0x9793('0x4a')](_0x4a3a10)[_0x9793('0x27')](handleEntityNotFound(_0x250c9a,null))['then'](respondWithResult(_0x250c9a,null))[_0x9793('0x46')](handleError(_0x250c9a,null));};exports[_0x9793('0x4b')]=function(_0x41d660,_0x39ee85){return db[_0x9793('0x2e')][_0x9793('0x4b')](_0x41d660['body'],{})[_0x9793('0x27')](function(_0x4b71d0){var _0x3074f9=_0x41d660[_0x9793('0x4c')][_0x9793('0x24')]({'plain':!![]});if(!_0x3074f9)throw new Error(_0x9793('0x4d'));if(_0x3074f9[_0x9793('0x4e')]===_0x9793('0x4c')){var _0x2a2d04=_0x4b71d0['get']({'plain':!![]});var _0x59fba8='Templates';return db[_0x9793('0x4f')][_0x9793('0x4a')]({'where':{'name':_0x59fba8,'userProfileId':_0x3074f9['userProfileId']},'raw':!![]})[_0x9793('0x27')](function(_0x4544ff){if(_0x4544ff&&_0x4544ff['autoAssociation']===0x0){return db[_0x9793('0x26')][_0x9793('0x4b')]({'name':_0x2a2d04[_0x9793('0x2a')],'resourceId':_0x2a2d04['id'],'type':_0x4544ff[_0x9793('0x2a')],'sectionId':_0x4544ff['id']},{})['then'](function(){return _0x4b71d0;});}else{return _0x4b71d0;}})[_0x9793('0x46')](function(_0x799bfd){logger[_0x9793('0x50')](_0x9793('0x51'),_0x799bfd);throw _0x799bfd;});}return _0x4b71d0;})[_0x9793('0x27')](respondWithResult(_0x39ee85,0xc9))['catch'](handleError(_0x39ee85,null));};exports[_0x9793('0x52')]=function(_0x4daed0,_0x24e221){if(_0x4daed0[_0x9793('0x53')]['id']){delete _0x4daed0[_0x9793('0x53')]['id'];}return db[_0x9793('0x2e')][_0x9793('0x4a')]({'where':{'id':_0x4daed0[_0x9793('0x47')]['id']}})['then'](handleEntityNotFound(_0x24e221,null))[_0x9793('0x27')](saveUpdates(_0x4daed0[_0x9793('0x53')],null))[_0x9793('0x27')](respondWithResult(_0x24e221,null))[_0x9793('0x46')](handleError(_0x24e221,null));};exports[_0x9793('0x23')]=function(_0x5308e9,_0x3e7a55){return db[_0x9793('0x2e')][_0x9793('0x4a')]({'where':{'id':_0x5308e9['params']['id']}})[_0x9793('0x27')](handleEntityNotFound(_0x3e7a55,null))[_0x9793('0x27')](removeEntity(_0x3e7a55,null))[_0x9793('0x46')](handleError(_0x3e7a55,null));}; \ No newline at end of file +var _0x6553=['role','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','Template','includeAll','include','catch','show','merge','find','create','body','user'];(function(_0x33f841,_0x55f458){var _0x527e28=function(_0x51e628){while(--_0x51e628){_0x33f841['push'](_0x33f841['shift']());}};_0x527e28(++_0x55f458);}(_0x6553,0x153));var _0x3655=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6553[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x3655('0x0'));var rimraf=require(_0x3655('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3655('0x2'));var rp=require(_0x3655('0x3'));var moment=require(_0x3655('0x4'));var BPromise=require(_0x3655('0x5'));var Mustache=require('mustache');var util=require(_0x3655('0x6'));var path=require(_0x3655('0x7'));var sox=require(_0x3655('0x8'));var csv=require(_0x3655('0x9'));var ejs=require(_0x3655('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3655('0xb'));var squel=require(_0x3655('0xc'));var crypto=require(_0x3655('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3655('0xe'));var toCsv=require(_0x3655('0x9'));var querystring=require(_0x3655('0xf'));var Papa=require(_0x3655('0x10'));var Redis=require('ioredis');var authService=require(_0x3655('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3655('0x12'));var hardwareService=require(_0x3655('0x13'));var logger=require(_0x3655('0x14'))('api');var utils=require(_0x3655('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3655('0x16'));var db=require(_0x3655('0x17'))['db'];function respondWithStatusCode(_0x3af8fd,_0xecc532){_0xecc532=_0xecc532||0xcc;return function(_0x3f4a7f){if(_0x3f4a7f){return _0x3af8fd[_0x3655('0x18')](_0xecc532);}return _0x3af8fd[_0x3655('0x19')](_0xecc532)[_0x3655('0x1a')]();};}function respondWithResult(_0x471676,_0x2633e1){_0x2633e1=_0x2633e1||0xc8;return function(_0x55026e){if(_0x55026e){return _0x471676[_0x3655('0x19')](_0x2633e1)['json'](_0x55026e);}};}function respondWithFilteredResult(_0x5621e8,_0xf49d26){return function(_0x3c40b6){if(_0x3c40b6){var _0x3bc12f=typeof _0xf49d26[_0x3655('0x1b')]===_0x3655('0x1c')&&typeof _0xf49d26[_0x3655('0x1d')]===_0x3655('0x1c');var _0x8dc3a8=_0x3c40b6['count'];var _0x2d13a6=_0x3bc12f?0x0:_0xf49d26[_0x3655('0x1b')];var _0x4edccd=_0x3bc12f?_0x3c40b6[_0x3655('0x1e')]:_0xf49d26[_0x3655('0x1b')]+_0xf49d26[_0x3655('0x1d')];var _0x24438a;if(_0x4edccd>=_0x8dc3a8){_0x4edccd=_0x8dc3a8;_0x24438a=0xc8;}else{_0x24438a=0xce;}_0x5621e8[_0x3655('0x19')](_0x24438a);return _0x5621e8[_0x3655('0x1f')]('Content-Range',_0x2d13a6+'-'+_0x4edccd+'/'+_0x8dc3a8)['json'](_0x3c40b6);}return null;};}function patchUpdates(_0x42ea39){return function(_0x56f269){try{jsonpatch[_0x3655('0x20')](_0x56f269,_0x42ea39,!![]);}catch(_0x585f87){return BPromise[_0x3655('0x21')](_0x585f87);}return _0x56f269[_0x3655('0x22')]();};}function saveUpdates(_0xc09d4e,_0x2455b8){return function(_0x4c49b0){if(_0x4c49b0){return _0x4c49b0[_0x3655('0x23')](_0xc09d4e)[_0x3655('0x24')](function(_0x5ce2f8){return _0x5ce2f8;});}return null;};}function removeEntity(_0x477dce,_0xd99b60){return function(_0x41f405){if(_0x41f405){return _0x41f405[_0x3655('0x25')]()[_0x3655('0x24')](function(){var _0x2cfced=_0x41f405[_0x3655('0x26')]({'plain':!![]});var _0x4a0dab='Templates';return db[_0x3655('0x27')][_0x3655('0x25')]({'where':{'type':_0x4a0dab,'resourceId':_0x2cfced['id']}})[_0x3655('0x24')](function(){return _0x41f405;});})['then'](function(){_0x477dce['status'](0xcc)[_0x3655('0x1a')]();});}};}function handleEntityNotFound(_0x1083df,_0x92ced9){return function(_0x301751){if(!_0x301751){_0x1083df[_0x3655('0x18')](0x194);}return _0x301751;};}function handleError(_0x4ac941,_0x5cc8fa){_0x5cc8fa=_0x5cc8fa||0x1f4;return function(_0x25c73e){logger[_0x3655('0x28')](_0x25c73e[_0x3655('0x29')]);if(_0x25c73e[_0x3655('0x2a')]){delete _0x25c73e[_0x3655('0x2a')];}_0x4ac941[_0x3655('0x19')](_0x5cc8fa)[_0x3655('0x2b')](_0x25c73e);};}exports['index']=function(_0x1570e0,_0x54b545){var _0x2cbfa5={},_0x346aaa={},_0x4e25e1={'count':0x0,'rows':[]};var _0x337f08=_[_0x3655('0x2c')](db['Template'][_0x3655('0x2d')],function(_0x16b9b1){return{'name':_0x16b9b1[_0x3655('0x2e')],'type':_0x16b9b1[_0x3655('0x2f')][_0x3655('0x30')]};});_0x346aaa[_0x3655('0x31')]=_[_0x3655('0x2c')](_0x337f08,_0x3655('0x2a'));_0x346aaa[_0x3655('0x32')]=_[_0x3655('0x33')](_0x1570e0[_0x3655('0x32')]);_0x346aaa[_0x3655('0x34')]=_[_0x3655('0x35')](_0x346aaa[_0x3655('0x31')],_0x346aaa[_0x3655('0x32')]);_0x2cbfa5[_0x3655('0x36')]=_[_0x3655('0x35')](_0x346aaa['model'],qs[_0x3655('0x37')](_0x1570e0[_0x3655('0x32')][_0x3655('0x37')]));_0x2cbfa5[_0x3655('0x36')]=_0x2cbfa5[_0x3655('0x36')][_0x3655('0x38')]?_0x2cbfa5['attributes']:_0x346aaa[_0x3655('0x31')];if(!_0x1570e0[_0x3655('0x32')][_0x3655('0x39')](_0x3655('0x3a'))){_0x2cbfa5['limit']=qs['limit'](_0x1570e0[_0x3655('0x32')][_0x3655('0x1d')]);_0x2cbfa5[_0x3655('0x1b')]=qs[_0x3655('0x1b')](_0x1570e0[_0x3655('0x32')][_0x3655('0x1b')]);}_0x2cbfa5[_0x3655('0x3b')]=qs[_0x3655('0x3c')](_0x1570e0[_0x3655('0x32')]['sort']);_0x2cbfa5[_0x3655('0x3d')]=qs['filters'](_[_0x3655('0x3e')](_0x1570e0[_0x3655('0x32')],_0x346aaa[_0x3655('0x34')]),_0x337f08);if(_0x1570e0['query'][_0x3655('0x3f')]){_0x2cbfa5['where']=_['merge'](_0x2cbfa5[_0x3655('0x3d')],{'$or':_[_0x3655('0x2c')](_0x337f08,function(_0x3a3d03){if(_0x3a3d03[_0x3655('0x2f')]!==_0x3655('0x40')){var _0x590497={};_0x590497[_0x3a3d03['name']]={'$like':'%'+_0x1570e0['query'][_0x3655('0x3f')]+'%'};return _0x590497;}})});}_0x2cbfa5=_['merge']({},_0x2cbfa5,_0x1570e0[_0x3655('0x41')]);var _0x3d97b1={'where':_0x2cbfa5[_0x3655('0x3d')]};return db[_0x3655('0x42')]['count'](_0x3d97b1)[_0x3655('0x24')](function(_0x2f49e6){_0x4e25e1[_0x3655('0x1e')]=_0x2f49e6;if(_0x1570e0[_0x3655('0x32')][_0x3655('0x43')]){_0x2cbfa5[_0x3655('0x44')]=[{'all':!![]}];}return db[_0x3655('0x42')]['findAll'](_0x2cbfa5);})[_0x3655('0x24')](function(_0x15b84f){_0x4e25e1['rows']=_0x15b84f;return _0x4e25e1;})[_0x3655('0x24')](respondWithFilteredResult(_0x54b545,_0x2cbfa5))[_0x3655('0x45')](handleError(_0x54b545,null));};exports[_0x3655('0x46')]=function(_0x8dd1e5,_0x4488a7){var _0xec6e6f={'raw':!![],'where':{'id':_0x8dd1e5['params']['id']}},_0x37b8bf={};_0x37b8bf[_0x3655('0x31')]=_['keys'](db[_0x3655('0x42')]['rawAttributes']);_0x37b8bf['query']=_['keys'](_0x8dd1e5['query']);_0x37b8bf['filters']=_['intersection'](_0x37b8bf[_0x3655('0x31')],_0x37b8bf[_0x3655('0x32')]);_0xec6e6f['attributes']=_[_0x3655('0x35')](_0x37b8bf[_0x3655('0x31')],qs['fields'](_0x8dd1e5[_0x3655('0x32')][_0x3655('0x37')]));_0xec6e6f[_0x3655('0x36')]=_0xec6e6f['attributes'][_0x3655('0x38')]?_0xec6e6f[_0x3655('0x36')]:_0x37b8bf[_0x3655('0x31')];if(_0x8dd1e5[_0x3655('0x32')][_0x3655('0x43')]){_0xec6e6f[_0x3655('0x44')]=[{'all':!![]}];}_0xec6e6f=_[_0x3655('0x47')]({},_0xec6e6f,_0x8dd1e5['options']);return db[_0x3655('0x42')][_0x3655('0x48')](_0xec6e6f)['then'](handleEntityNotFound(_0x4488a7,null))[_0x3655('0x24')](respondWithResult(_0x4488a7,null))['catch'](handleError(_0x4488a7,null));};exports[_0x3655('0x49')]=function(_0x101d10,_0x352062){return db[_0x3655('0x42')][_0x3655('0x49')](_0x101d10[_0x3655('0x4a')],{})['then'](function(_0x453b6b){var _0x35eea2=_0x101d10[_0x3655('0x4b')]['get']({'plain':!![]});if(!_0x35eea2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35eea2[_0x3655('0x4c')]===_0x3655('0x4b')){var _0x10e053=_0x453b6b[_0x3655('0x26')]({'plain':!![]});var _0x5da7df=_0x3655('0x4d');return db[_0x3655('0x4e')]['find']({'where':{'name':_0x5da7df,'userProfileId':_0x35eea2[_0x3655('0x4f')]},'raw':!![]})['then'](function(_0x44fe43){if(_0x44fe43&&_0x44fe43[_0x3655('0x50')]===0x0){return db[_0x3655('0x27')][_0x3655('0x49')]({'name':_0x10e053[_0x3655('0x2a')],'resourceId':_0x10e053['id'],'type':_0x44fe43[_0x3655('0x2a')],'sectionId':_0x44fe43['id']},{})['then'](function(){return _0x453b6b;});}else{return _0x453b6b;}})[_0x3655('0x45')](function(_0x18ffaf){logger[_0x3655('0x28')](_0x3655('0x51'),_0x18ffaf);throw _0x18ffaf;});}return _0x453b6b;})[_0x3655('0x24')](respondWithResult(_0x352062,0xc9))[_0x3655('0x45')](handleError(_0x352062,null));};exports[_0x3655('0x23')]=function(_0x43ffeb,_0x3e5fa0){if(_0x43ffeb[_0x3655('0x4a')]['id']){delete _0x43ffeb['body']['id'];}return db['Template'][_0x3655('0x48')]({'where':{'id':_0x43ffeb[_0x3655('0x52')]['id']}})[_0x3655('0x24')](handleEntityNotFound(_0x3e5fa0,null))[_0x3655('0x24')](saveUpdates(_0x43ffeb[_0x3655('0x4a')],null))[_0x3655('0x24')](respondWithResult(_0x3e5fa0,null))[_0x3655('0x45')](handleError(_0x3e5fa0,null));};exports[_0x3655('0x25')]=function(_0x777517,_0x2189e3){return db['Template']['find']({'where':{'id':_0x777517[_0x3655('0x52')]['id']}})[_0x3655('0x24')](handleEntityNotFound(_0x2189e3,null))[_0x3655('0x24')](removeEntity(_0x2189e3,null))[_0x3655('0x45')](handleError(_0x2189e3,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index daabcb9..7d337c8 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 _0x8ee5=['bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api'];(function(_0x5c060d,_0x4195dc){var _0x217e6b=function(_0x54788f){while(--_0x54788f){_0x5c060d['push'](_0x5c060d['shift']());}};_0x217e6b(++_0x4195dc);}(_0x8ee5,0x19c));var _0x58ee=function(_0x2e563f,_0x1e1b19){_0x2e563f=_0x2e563f-0x0;var _0x5b7288=_0x8ee5[_0x2e563f];return _0x5b7288;};'use strict';var _=require(_0x58ee('0x0'));var util=require(_0x58ee('0x1'));var logger=require(_0x58ee('0x2'))(_0x58ee('0x3'));var moment=require('moment');var BPromise=require(_0x58ee('0x4'));var rp=require(_0x58ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58ee('0x6'));var config=require(_0x58ee('0x7'));var attributes=require(_0x58ee('0x8'));module[_0x58ee('0x9')]=function(_0x2cb015,_0x5b96d3){return _0x2cb015[_0x58ee('0xa')](_0x58ee('0xb'),attributes,{'tableName':_0x58ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2afb=['api','moment','bluebird','request-promise','path','define','Template','lodash','util','../../config/logger'];(function(_0x2e56b1,_0x3ee61a){var _0x4c1d3f=function(_0x1c8bab){while(--_0x1c8bab){_0x2e56b1['push'](_0x2e56b1['shift']());}};_0x4c1d3f(++_0x3ee61a);}(_0x2afb,0x165));var _0xb2af=function(_0x2986fb,_0x9482a0){_0x2986fb=_0x2986fb-0x0;var _0xb3c156=_0x2afb[_0x2986fb];return _0xb3c156;};'use strict';var _=require(_0xb2af('0x0'));var util=require(_0xb2af('0x1'));var logger=require(_0xb2af('0x2'))(_0xb2af('0x3'));var moment=require(_0xb2af('0x4'));var BPromise=require(_0xb2af('0x5'));var rp=require(_0xb2af('0x6'));var fs=require('fs');var path=require(_0xb2af('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x5c6018,_0x7a4847){return _0x5c6018[_0xb2af('0x8')](_0xb2af('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index b8c302b..a75f50e 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 _0xcfa0=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTemplate','findAll','options','raw','where','attributes','map','include','model','debug','lodash','moment'];(function(_0x1614c7,_0x34d93d){var _0x103a98=function(_0x344376){while(--_0x344376){_0x1614c7['push'](_0x1614c7['shift']());}};_0x103a98(++_0x34d93d);}(_0xcfa0,0xde));var _0x0cfa=function(_0x1fe4a2,_0x2210b0){_0x1fe4a2=_0x1fe4a2-0x0;var _0x312795=_0xcfa0[_0x1fe4a2];return _0x312795;};'use strict';var _=require(_0x0cfa('0x0'));var util=require('util');var moment=require(_0x0cfa('0x1'));var BPromise=require(_0x0cfa('0x2'));var rs=require(_0x0cfa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cfa('0x4'))['db'];var utils=require(_0x0cfa('0x5'));var logger=require('../../config/logger')(_0x0cfa('0x6'));var config=require(_0x0cfa('0x7'));var jayson=require(_0x0cfa('0x8'));var client=jayson['client'][_0x0cfa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3371cb,_0x255c45,_0x106169){return new BPromise(function(_0x1b28af,_0x5df040){return client[_0x0cfa('0xa')](_0x3371cb,_0x106169)[_0x0cfa('0xb')](function(_0x16d150){logger['info'](_0x0cfa('0xc'),_0x255c45,_0x0cfa('0xd'));logger['debug'](_0x0cfa('0xe'),_0x255c45,_0x0cfa('0xd'),JSON[_0x0cfa('0xf')](_0x16d150));if(_0x16d150[_0x0cfa('0x10')]){if(_0x16d150[_0x0cfa('0x10')][_0x0cfa('0x11')]===0x1f4){logger[_0x0cfa('0x10')](_0x0cfa('0xc'),_0x255c45,_0x16d150[_0x0cfa('0x10')][_0x0cfa('0x12')]);return _0x5df040(_0x16d150[_0x0cfa('0x10')][_0x0cfa('0x12')]);}logger[_0x0cfa('0x10')](_0x0cfa('0xc'),_0x255c45,_0x16d150[_0x0cfa('0x10')]['message']);return _0x1b28af(_0x16d150['error'][_0x0cfa('0x12')]);}else{logger[_0x0cfa('0x13')](_0x0cfa('0xc'),_0x255c45,'request\x20sent');_0x1b28af(_0x16d150[_0x0cfa('0x14')]['message']);}})[_0x0cfa('0x15')](function(_0x3e7d38){logger['error'](_0x0cfa('0xc'),_0x255c45,_0x3e7d38);_0x5df040(_0x3e7d38);});});}exports[_0x0cfa('0x16')]=function(_0x6cdc3){var _0x7fcdcc=this;return new Promise(function(_0x266762,_0x4c4f63){return db['Template'][_0x0cfa('0x17')]({'raw':_0x6cdc3[_0x0cfa('0x18')]?_0x6cdc3['options'][_0x0cfa('0x19')]===undefined?!![]:![]:!![],'where':_0x6cdc3['options']?_0x6cdc3[_0x0cfa('0x18')][_0x0cfa('0x1a')]||null:null,'attributes':_0x6cdc3[_0x0cfa('0x18')]?_0x6cdc3['options'][_0x0cfa('0x1b')]||null:null,'limit':_0x6cdc3[_0x0cfa('0x18')]?_0x6cdc3['options']['limit']||null:null,'include':_0x6cdc3[_0x0cfa('0x18')]?_0x6cdc3[_0x0cfa('0x18')]['include']?_[_0x0cfa('0x1c')](_0x6cdc3[_0x0cfa('0x18')][_0x0cfa('0x1d')],function(_0x214f4f){return{'model':db[_0x214f4f[_0x0cfa('0x1e')]],'as':_0x214f4f['as'],'attributes':_0x214f4f[_0x0cfa('0x1b')],'include':_0x214f4f['include']?_['map'](_0x214f4f[_0x0cfa('0x1d')],function(_0x438144){return{'model':db[_0x438144[_0x0cfa('0x1e')]],'as':_0x438144['as'],'attributes':_0x438144[_0x0cfa('0x1b')],'include':_0x438144[_0x0cfa('0x1d')]?_[_0x0cfa('0x1c')](_0x438144[_0x0cfa('0x1d')],function(_0x4a879d){return{'model':db[_0x4a879d[_0x0cfa('0x1e')]],'as':_0x4a879d['as'],'attributes':_0x4a879d[_0x0cfa('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a3b21){logger['info'](_0x0cfa('0x16'),_0x6cdc3);logger[_0x0cfa('0x1f')](_0x0cfa('0x16'),_0x6cdc3,JSON['stringify'](_0x1a3b21));_0x266762(_0x1a3b21);})['catch'](function(_0x53aa88){logger[_0x0cfa('0x10')]('GetTemplate',_0x53aa88['message'],_0x6cdc3);_0x4c4f63(_0x7fcdcc[_0x0cfa('0x10')](0x1f4,_0x53aa88['message']));});});}; \ No newline at end of file +var _0xd3ec=['request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','model','map','info','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x5fdf81,_0x50ab35){var _0x31198a=function(_0x1b8158){while(--_0x1b8158){_0x5fdf81['push'](_0x5fdf81['shift']());}};_0x31198a(++_0x50ab35);}(_0xd3ec,0x1c9));var _0xcd3e=function(_0x4ca789,_0x2340b2){_0x4ca789=_0x4ca789-0x0;var _0x2efc92=_0xd3ec[_0x4ca789];return _0x2efc92;};'use strict';var _=require(_0xcd3e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd3e('0x1'));var fs=require('fs');var Redis=require(_0xcd3e('0x2'));var db=require(_0xcd3e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd3e('0x4'))(_0xcd3e('0x5'));var config=require('../../config/environment');var jayson=require(_0xcd3e('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbfa4b4,_0x45dfba,_0x18cdd7){return new BPromise(function(_0x3e3946,_0x6206ba){return client[_0xcd3e('0x7')](_0xbfa4b4,_0x18cdd7)[_0xcd3e('0x8')](function(_0x469bae){logger['info'](_0xcd3e('0x9'),_0x45dfba,_0xcd3e('0xa'));logger[_0xcd3e('0xb')](_0xcd3e('0xc'),_0x45dfba,'request\x20sent',JSON[_0xcd3e('0xd')](_0x469bae));if(_0x469bae[_0xcd3e('0xe')]){if(_0x469bae[_0xcd3e('0xe')]['code']===0x1f4){logger[_0xcd3e('0xe')](_0xcd3e('0x9'),_0x45dfba,_0x469bae['error'][_0xcd3e('0xf')]);return _0x6206ba(_0x469bae[_0xcd3e('0xe')][_0xcd3e('0xf')]);}logger[_0xcd3e('0xe')](_0xcd3e('0x9'),_0x45dfba,_0x469bae['error'][_0xcd3e('0xf')]);return _0x3e3946(_0x469bae[_0xcd3e('0xe')]['message']);}else{logger['info']('Template,\x20%s,\x20%s',_0x45dfba,_0xcd3e('0xa'));_0x3e3946(_0x469bae[_0xcd3e('0x10')][_0xcd3e('0xf')]);}})[_0xcd3e('0x11')](function(_0x3158a1){logger[_0xcd3e('0xe')](_0xcd3e('0x9'),_0x45dfba,_0x3158a1);_0x6206ba(_0x3158a1);});});}exports[_0xcd3e('0x12')]=function(_0x5889f0){var _0x2021d2=this;return new Promise(function(_0x151190,_0x1e076a){return db[_0xcd3e('0x13')][_0xcd3e('0x14')]({'raw':_0x5889f0[_0xcd3e('0x15')]?_0x5889f0[_0xcd3e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5889f0[_0xcd3e('0x15')]?_0x5889f0[_0xcd3e('0x15')][_0xcd3e('0x16')]||null:null,'attributes':_0x5889f0[_0xcd3e('0x15')]?_0x5889f0[_0xcd3e('0x15')][_0xcd3e('0x17')]||null:null,'limit':_0x5889f0[_0xcd3e('0x15')]?_0x5889f0[_0xcd3e('0x15')][_0xcd3e('0x18')]||null:null,'include':_0x5889f0['options']?_0x5889f0[_0xcd3e('0x15')][_0xcd3e('0x19')]?_['map'](_0x5889f0['options'][_0xcd3e('0x19')],function(_0x3adc99){return{'model':db[_0x3adc99[_0xcd3e('0x1a')]],'as':_0x3adc99['as'],'attributes':_0x3adc99[_0xcd3e('0x17')],'include':_0x3adc99[_0xcd3e('0x19')]?_[_0xcd3e('0x1b')](_0x3adc99[_0xcd3e('0x19')],function(_0x3d4e80){return{'model':db[_0x3d4e80[_0xcd3e('0x1a')]],'as':_0x3d4e80['as'],'attributes':_0x3d4e80[_0xcd3e('0x17')],'include':_0x3d4e80[_0xcd3e('0x19')]?_['map'](_0x3d4e80[_0xcd3e('0x19')],function(_0x2df55d){return{'model':db[_0x2df55d[_0xcd3e('0x1a')]],'as':_0x2df55d['as'],'attributes':_0x2df55d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3569fb){logger[_0xcd3e('0x1c')](_0xcd3e('0x12'),_0x5889f0);logger['debug']('GetTemplate',_0x5889f0,JSON[_0xcd3e('0xd')](_0x3569fb));_0x151190(_0x3569fb);})[_0xcd3e('0x11')](function(_0x428302){logger[_0xcd3e('0xe')](_0xcd3e('0x12'),_0x428302[_0xcd3e('0xf')],_0x5889f0);_0x1e076a(_0x2021d2[_0xcd3e('0xe')](0x1f4,_0x428302[_0xcd3e('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 13d206f..0e14ab2 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 _0xf553=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','addAllCondition','post','addAnyCondition','addAction','put','update','delete','destroy','multer'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf553,0xb5));var _0x3f55=function(_0x455150,_0x274121){_0x455150=_0x455150-0x0;var _0x12ca9c=_0xf553[_0x455150];return _0x12ca9c;};'use strict';var multer=require(_0x3f55('0x0'));var util=require(_0x3f55('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3f55('0x2'));var router=express[_0x3f55('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3f55('0x4'));var interaction=require(_0x3f55('0x5'));var config=require(_0x3f55('0x6'));var controller=require(_0x3f55('0x7'));router['get']('/',auth[_0x3f55('0x8')](),controller[_0x3f55('0x9')]);router[_0x3f55('0xa')](_0x3f55('0xb'),auth[_0x3f55('0x8')](),controller[_0x3f55('0xc')]);router[_0x3f55('0xa')]('/:id/all_conditions',auth[_0x3f55('0x8')](),controller[_0x3f55('0xd')]);router[_0x3f55('0xa')](_0x3f55('0xe'),auth[_0x3f55('0x8')](),controller[_0x3f55('0xf')]);router['get'](_0x3f55('0x10'),auth['isAuthenticated'](),controller[_0x3f55('0x11')]);router['post']('/',auth[_0x3f55('0x8')](),controller['create']);router['post']('/:id/all_conditions',auth[_0x3f55('0x8')](),controller[_0x3f55('0x12')]);router[_0x3f55('0x13')](_0x3f55('0xe'),auth[_0x3f55('0x8')](),controller[_0x3f55('0x14')]);router[_0x3f55('0x13')]('/:id/actions',auth[_0x3f55('0x8')](),controller[_0x3f55('0x15')]);router[_0x3f55('0x16')](_0x3f55('0xb'),auth[_0x3f55('0x8')](),controller[_0x3f55('0x17')]);router[_0x3f55('0x18')](_0x3f55('0xb'),auth['isAuthenticated'](),controller[_0x3f55('0x19')]);module['exports']=router; \ No newline at end of file +var _0x96bb=['/:id/any_conditions','/:id/actions','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','addAllCondition'];(function(_0x4dff55,_0x18cd20){var _0x53b1a8=function(_0x1758be){while(--_0x1758be){_0x4dff55['push'](_0x4dff55['shift']());}};_0x53b1a8(++_0x18cd20);}(_0x96bb,0x9c));var _0xb96b=function(_0x111165,_0x4f9303){_0x111165=_0x111165-0x0;var _0x64f7b6=_0x96bb[_0x111165];return _0x64f7b6;};'use strict';var multer=require('multer');var util=require(_0xb96b('0x0'));var path=require(_0xb96b('0x1'));var timeout=require(_0xb96b('0x2'));var express=require(_0xb96b('0x3'));var router=express[_0xb96b('0x4')]();var fs_extra=require(_0xb96b('0x5'));var auth=require(_0xb96b('0x6'));var interaction=require(_0xb96b('0x7'));var config=require(_0xb96b('0x8'));var controller=require(_0xb96b('0x9'));router[_0xb96b('0xa')]('/',auth[_0xb96b('0xb')](),controller['index']);router['get'](_0xb96b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb96b('0xa')](_0xb96b('0xd'),auth[_0xb96b('0xb')](),controller[_0xb96b('0xe')]);router[_0xb96b('0xa')]('/:id/any_conditions',auth[_0xb96b('0xb')](),controller[_0xb96b('0xf')]);router['get']('/:id/actions',auth[_0xb96b('0xb')](),controller[_0xb96b('0x10')]);router['post']('/',auth[_0xb96b('0xb')](),controller['create']);router[_0xb96b('0x11')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xb96b('0x12')]);router['post'](_0xb96b('0x13'),auth[_0xb96b('0xb')](),controller['addAnyCondition']);router[_0xb96b('0x11')](_0xb96b('0x14'),auth[_0xb96b('0xb')](),controller['addAction']);router[_0xb96b('0x15')](_0xb96b('0xc'),auth[_0xb96b('0xb')](),controller[_0xb96b('0x16')]);router['delete']('/:id',auth[_0xb96b('0xb')](),controller[_0xb96b('0x17')]);module[_0xb96b('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 7a3f07f..78e7098 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 _0xbcc8=['STRING','BOOLEAN','exports'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xbcc8,0x1cd));var _0x8bcc=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xbcc8[_0x1b51ea];return _0x18bbdc;};'use strict';var Sequelize=require('sequelize');module[_0x8bcc('0x0')]={'name':{'type':Sequelize[_0x8bcc('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x8bcc('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4f3f=['exports','STRING'];(function(_0x24c405,_0x56d6fb){var _0x383aef=function(_0x20da69){while(--_0x20da69){_0x24c405['push'](_0x24c405['shift']());}};_0x383aef(++_0x56d6fb);}(_0x4f3f,0x102));var _0xf4f3=function(_0x24d611,_0xf5742d){_0x24d611=_0x24d611-0x0;var _0x581ac0=_0x4f3f[_0x24d611];return _0x581ac0;};'use strict';var Sequelize=require('sequelize');module[_0xf4f3('0x0')]={'name':{'type':Sequelize[_0xf4f3('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf4f3('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 7af1b24..214d9d1 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 _0xeb0b=['getAllConditions','getAnyConditions','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','Trigger','count','includeAll','include','findAll','rows','catch','show','params','length','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','UserProfileSection','find','userProfileId','autoAssociation','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','findOne','pick'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0xeb0b,0x1d0));var _0xbeb0=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xeb0b[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xbeb0('0x0'));var rimraf=require(_0xbeb0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbeb0('0x2'));var rp=require(_0xbeb0('0x3'));var moment=require(_0xbeb0('0x4'));var BPromise=require(_0xbeb0('0x5'));var Mustache=require(_0xbeb0('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbeb0('0x7'));var csv=require('to-csv');var ejs=require(_0xbeb0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbeb0('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbeb0('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbeb0('0xb'));var querystring=require(_0xbeb0('0xc'));var Papa=require(_0xbeb0('0xd'));var Redis=require('ioredis');var authService=require(_0xbeb0('0xe'));var qs=require(_0xbeb0('0xf'));var as=require(_0xbeb0('0x10'));var hardwareService=require(_0xbeb0('0x11'));var logger=require('../../config/logger')(_0xbeb0('0x12'));var utils=require(_0xbeb0('0x13'));var config=require(_0xbeb0('0x14'));var licenseUtil=require(_0xbeb0('0x15'));var db=require(_0xbeb0('0x16'))['db'];function respondWithStatusCode(_0x477ab9,_0xb909ca){_0xb909ca=_0xb909ca||0xcc;return function(_0x5e81c4){if(_0x5e81c4){return _0x477ab9['sendStatus'](_0xb909ca);}return _0x477ab9[_0xbeb0('0x17')](_0xb909ca)[_0xbeb0('0x18')]();};}function respondWithResult(_0x1fdca5,_0x205047){_0x205047=_0x205047||0xc8;return function(_0x437de4){if(_0x437de4){return _0x1fdca5[_0xbeb0('0x17')](_0x205047)[_0xbeb0('0x19')](_0x437de4);}};}function respondWithFilteredResult(_0x503182,_0x54bc6f){return function(_0x3d1c3e){if(_0x3d1c3e){var _0x37c6a2=typeof _0x54bc6f[_0xbeb0('0x1a')]===_0xbeb0('0x1b')&&typeof _0x54bc6f[_0xbeb0('0x1c')]===_0xbeb0('0x1b');var _0x338793=_0x3d1c3e['count'];var _0x5b2cbc=_0x37c6a2?0x0:_0x54bc6f[_0xbeb0('0x1a')];var _0x47e2b1=_0x37c6a2?_0x3d1c3e['count']:_0x54bc6f[_0xbeb0('0x1a')]+_0x54bc6f['limit'];var _0x504ffa;if(_0x47e2b1>=_0x338793){_0x47e2b1=_0x338793;_0x504ffa=0xc8;}else{_0x504ffa=0xce;}_0x503182[_0xbeb0('0x17')](_0x504ffa);return _0x503182[_0xbeb0('0x1d')](_0xbeb0('0x1e'),_0x5b2cbc+'-'+_0x47e2b1+'/'+_0x338793)['json'](_0x3d1c3e);}return null;};}function patchUpdates(_0x244794){return function(_0x17d6be){try{jsonpatch[_0xbeb0('0x1f')](_0x17d6be,_0x244794,!![]);}catch(_0x5fd1ad){return BPromise['reject'](_0x5fd1ad);}return _0x17d6be[_0xbeb0('0x20')]();};}function saveUpdates(_0x31e34c,_0x4644bb){return function(_0x49c40d){if(_0x49c40d){return _0x49c40d[_0xbeb0('0x21')](_0x31e34c)[_0xbeb0('0x22')](function(_0x392649){return _0x392649;});}return null;};}function removeEntity(_0x40e0eb,_0x24d3f9){return function(_0x1dc3a8){if(_0x1dc3a8){return _0x1dc3a8[_0xbeb0('0x23')]()[_0xbeb0('0x22')](function(){var _0x4f1cf2=_0x1dc3a8[_0xbeb0('0x24')]({'plain':!![]});var _0x234534='Triggers';return db[_0xbeb0('0x25')][_0xbeb0('0x23')]({'where':{'type':_0x234534,'resourceId':_0x4f1cf2['id']}})[_0xbeb0('0x22')](function(){return _0x1dc3a8;});})[_0xbeb0('0x22')](function(){_0x40e0eb[_0xbeb0('0x17')](0xcc)[_0xbeb0('0x18')]();});}};}function handleEntityNotFound(_0x3894ac,_0x71b04e){return function(_0x3cbc0d){if(!_0x3cbc0d){_0x3894ac[_0xbeb0('0x26')](0x194);}return _0x3cbc0d;};}function handleError(_0x42bdac,_0x4f10f4){_0x4f10f4=_0x4f10f4||0x1f4;return function(_0x5088c6){logger[_0xbeb0('0x27')](_0x5088c6[_0xbeb0('0x28')]);if(_0x5088c6[_0xbeb0('0x29')]){delete _0x5088c6['name'];}_0x42bdac[_0xbeb0('0x17')](_0x4f10f4)[_0xbeb0('0x2a')](_0x5088c6);};}exports['index']=function(_0x35bab2,_0x5106eb){var _0x1d956c={},_0xb46f2e={},_0x470c22={'count':0x0,'rows':[]};var _0x1c440e=_[_0xbeb0('0x2b')](db['Trigger'][_0xbeb0('0x2c')],function(_0x51231b){return{'name':_0x51231b['fieldName'],'type':_0x51231b[_0xbeb0('0x2d')][_0xbeb0('0x2e')]};});_0xb46f2e[_0xbeb0('0x2f')]=_[_0xbeb0('0x2b')](_0x1c440e,_0xbeb0('0x29'));_0xb46f2e['query']=_[_0xbeb0('0x30')](_0x35bab2['query']);_0xb46f2e['filters']=_[_0xbeb0('0x31')](_0xb46f2e['model'],_0xb46f2e[_0xbeb0('0x32')]);_0x1d956c[_0xbeb0('0x33')]=_[_0xbeb0('0x31')](_0xb46f2e['model'],qs[_0xbeb0('0x34')](_0x35bab2[_0xbeb0('0x32')][_0xbeb0('0x34')]));_0x1d956c[_0xbeb0('0x33')]=_0x1d956c['attributes']['length']?_0x1d956c['attributes']:_0xb46f2e[_0xbeb0('0x2f')];if(!_0x35bab2[_0xbeb0('0x32')][_0xbeb0('0x35')](_0xbeb0('0x36'))){_0x1d956c[_0xbeb0('0x1c')]=qs['limit'](_0x35bab2['query']['limit']);_0x1d956c[_0xbeb0('0x1a')]=qs[_0xbeb0('0x1a')](_0x35bab2[_0xbeb0('0x32')]['offset']);}_0x1d956c[_0xbeb0('0x37')]=qs[_0xbeb0('0x38')](_0x35bab2[_0xbeb0('0x32')][_0xbeb0('0x38')]);_0x1d956c[_0xbeb0('0x39')]=qs[_0xbeb0('0x3a')](_['pick'](_0x35bab2[_0xbeb0('0x32')],_0xb46f2e['filters']),_0x1c440e);if(_0x35bab2['query'][_0xbeb0('0x3b')]){_0x1d956c[_0xbeb0('0x39')]=_['merge'](_0x1d956c['where'],{'$or':_[_0xbeb0('0x2b')](_0x1c440e,function(_0x1b940c){if(_0x1b940c[_0xbeb0('0x2d')]!==_0xbeb0('0x3c')){var _0x5d7c13={};_0x5d7c13[_0x1b940c[_0xbeb0('0x29')]]={'$like':'%'+_0x35bab2[_0xbeb0('0x32')][_0xbeb0('0x3b')]+'%'};return _0x5d7c13;}})});}_0x1d956c=_['merge']({},_0x1d956c,_0x35bab2[_0xbeb0('0x3d')]);var _0x42d32a={'where':_0x1d956c['where']};return db[_0xbeb0('0x3e')]['count'](_0x42d32a)[_0xbeb0('0x22')](function(_0x270d57){_0x470c22[_0xbeb0('0x3f')]=_0x270d57;if(_0x35bab2['query'][_0xbeb0('0x40')]){_0x1d956c[_0xbeb0('0x41')]=[{'all':!![]}];}return db[_0xbeb0('0x3e')][_0xbeb0('0x42')](_0x1d956c);})[_0xbeb0('0x22')](function(_0x34b00a){_0x470c22[_0xbeb0('0x43')]=_0x34b00a;return _0x470c22;})[_0xbeb0('0x22')](respondWithFilteredResult(_0x5106eb,_0x1d956c))[_0xbeb0('0x44')](handleError(_0x5106eb,null));};exports[_0xbeb0('0x45')]=function(_0x580d60,_0x126aa3){var _0x1ec917={'raw':![],'where':{'id':_0x580d60[_0xbeb0('0x46')]['id']}},_0x1a8ec6={};_0x1a8ec6[_0xbeb0('0x2f')]=_[_0xbeb0('0x30')](db[_0xbeb0('0x3e')][_0xbeb0('0x2c')]);_0x1a8ec6['query']=_['keys'](_0x580d60['query']);_0x1a8ec6[_0xbeb0('0x3a')]=_[_0xbeb0('0x31')](_0x1a8ec6['model'],_0x1a8ec6[_0xbeb0('0x32')]);_0x1ec917[_0xbeb0('0x33')]=_[_0xbeb0('0x31')](_0x1a8ec6[_0xbeb0('0x2f')],qs['fields'](_0x580d60[_0xbeb0('0x32')][_0xbeb0('0x34')]));_0x1ec917[_0xbeb0('0x33')]=_0x1ec917['attributes'][_0xbeb0('0x47')]?_0x1ec917[_0xbeb0('0x33')]:_0x1a8ec6[_0xbeb0('0x2f')];if(_0x580d60[_0xbeb0('0x32')][_0xbeb0('0x40')]){_0x1ec917[_0xbeb0('0x41')]=[{'all':!![]}];}_0x1ec917=_[_0xbeb0('0x48')]({},_0x1ec917,_0x580d60[_0xbeb0('0x3d')]);return db[_0xbeb0('0x3e')]['find'](_0x1ec917)[_0xbeb0('0x22')](handleEntityNotFound(_0x126aa3,null))[_0xbeb0('0x22')](respondWithResult(_0x126aa3,null))[_0xbeb0('0x44')](handleError(_0x126aa3,null));};exports[_0xbeb0('0x49')]=function(_0x55f8fb,_0x4b3cf8){return db[_0xbeb0('0x3e')][_0xbeb0('0x49')](_0x55f8fb['body'],{})[_0xbeb0('0x22')](function(_0x4193c3){var _0x1317cc=_0x55f8fb[_0xbeb0('0x4a')]['get']({'plain':!![]});if(!_0x1317cc)throw new Error(_0xbeb0('0x4b'));if(_0x1317cc['role']==='user'){var _0x1492a3=_0x4193c3[_0xbeb0('0x24')]({'plain':!![]});var _0x2824ef=_0xbeb0('0x4c');return db[_0xbeb0('0x4d')][_0xbeb0('0x4e')]({'where':{'name':_0x2824ef,'userProfileId':_0x1317cc[_0xbeb0('0x4f')]},'raw':!![]})[_0xbeb0('0x22')](function(_0x89003d){if(_0x89003d&&_0x89003d[_0xbeb0('0x50')]===0x0){return db['UserProfileResource'][_0xbeb0('0x49')]({'name':_0x1492a3['name'],'resourceId':_0x1492a3['id'],'type':_0x89003d['name'],'sectionId':_0x89003d['id']},{})[_0xbeb0('0x22')](function(){return _0x4193c3;});}else{return _0x4193c3;}})[_0xbeb0('0x44')](function(_0x284b53){logger[_0xbeb0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x284b53);throw _0x284b53;});}return _0x4193c3;})[_0xbeb0('0x22')](respondWithResult(_0x4b3cf8,0xc9))[_0xbeb0('0x44')](handleError(_0x4b3cf8,null));};exports[_0xbeb0('0x21')]=function(_0x2a8e4a,_0x4f37a6){if(_0x2a8e4a[_0xbeb0('0x51')]['id']){delete _0x2a8e4a[_0xbeb0('0x51')]['id'];}return db[_0xbeb0('0x3e')][_0xbeb0('0x4e')]({'where':{'id':_0x2a8e4a[_0xbeb0('0x46')]['id']}})[_0xbeb0('0x22')](handleEntityNotFound(_0x4f37a6,null))[_0xbeb0('0x22')](saveUpdates(_0x2a8e4a[_0xbeb0('0x51')],null))[_0xbeb0('0x22')](respondWithResult(_0x4f37a6,null))[_0xbeb0('0x44')](handleError(_0x4f37a6,null));};exports[_0xbeb0('0x23')]=function(_0xb61f49,_0x4cbc19){return db['Trigger']['find']({'where':{'id':_0xb61f49[_0xbeb0('0x46')]['id']}})[_0xbeb0('0x22')](handleEntityNotFound(_0x4cbc19,null))[_0xbeb0('0x22')](removeEntity(_0x4cbc19,null))[_0xbeb0('0x44')](handleError(_0x4cbc19,null));};exports[_0xbeb0('0x52')]=function(_0x258401,_0x1cda06,_0x265c8d){if(_0x258401[_0xbeb0('0x51')]['id']){delete _0x258401[_0xbeb0('0x51')]['id'];}return db[_0xbeb0('0x3e')][_0xbeb0('0x4e')]({'where':{'id':_0x258401[_0xbeb0('0x46')]['id']}})[_0xbeb0('0x22')](handleEntityNotFound(_0x1cda06,null))[_0xbeb0('0x22')](function(_0x5015b6){if(_0x5015b6){_0x258401[_0xbeb0('0x51')][_0xbeb0('0x53')]=_0x5015b6['id'];return db[_0xbeb0('0x54')][_0xbeb0('0x49')](_0x258401[_0xbeb0('0x51')]);}})[_0xbeb0('0x22')](respondWithResult(_0x1cda06,null))[_0xbeb0('0x44')](handleError(_0x1cda06,null));};exports[_0xbeb0('0x55')]=function(_0x2b0069,_0x4a7ea4,_0x2eb1a3){if(_0x2b0069[_0xbeb0('0x51')]['id']){delete _0x2b0069['body']['id'];}return db[_0xbeb0('0x3e')][_0xbeb0('0x4e')]({'where':{'id':_0x2b0069[_0xbeb0('0x46')]['id']}})[_0xbeb0('0x22')](handleEntityNotFound(_0x4a7ea4,null))[_0xbeb0('0x22')](function(_0x4ccfdc){if(_0x4ccfdc){_0x2b0069[_0xbeb0('0x51')]['TriggerAnyId']=_0x4ccfdc['id'];return db[_0xbeb0('0x54')][_0xbeb0('0x49')](_0x2b0069[_0xbeb0('0x51')]);}})['then'](respondWithResult(_0x4a7ea4,null))[_0xbeb0('0x44')](handleError(_0x4a7ea4,null));};exports['getAllConditions']=function(_0x4bd5a5,_0x4838ff,_0x91b14c){var _0x418d6f={};var _0x303a5e={};var _0x1ee773;var _0x5a306f;return db[_0xbeb0('0x3e')][_0xbeb0('0x56')]({'where':{'id':_0x4bd5a5[_0xbeb0('0x46')]['id']}})[_0xbeb0('0x22')](handleEntityNotFound(_0x4838ff,null))[_0xbeb0('0x22')](function(_0x14f757){if(_0x14f757){_0x1ee773=_0x14f757;_0x303a5e['model']=_[_0xbeb0('0x30')](db[_0xbeb0('0x54')][_0xbeb0('0x2c')]);_0x303a5e[_0xbeb0('0x32')]=_[_0xbeb0('0x30')](_0x4bd5a5[_0xbeb0('0x32')]);_0x303a5e['filters']=_[_0xbeb0('0x31')](_0x303a5e[_0xbeb0('0x2f')],_0x303a5e[_0xbeb0('0x32')]);_0x418d6f[_0xbeb0('0x33')]=_[_0xbeb0('0x31')](_0x303a5e[_0xbeb0('0x2f')],qs[_0xbeb0('0x34')](_0x4bd5a5[_0xbeb0('0x32')]['fields']));_0x418d6f['attributes']=_0x418d6f[_0xbeb0('0x33')][_0xbeb0('0x47')]?_0x418d6f[_0xbeb0('0x33')]:_0x303a5e[_0xbeb0('0x2f')];_0x418d6f[_0xbeb0('0x37')]=qs[_0xbeb0('0x38')](_0x4bd5a5[_0xbeb0('0x32')][_0xbeb0('0x38')]);_0x418d6f[_0xbeb0('0x39')]=qs[_0xbeb0('0x3a')](_[_0xbeb0('0x57')](_0x4bd5a5[_0xbeb0('0x32')],_0x303a5e[_0xbeb0('0x3a')]));if(_0x4bd5a5[_0xbeb0('0x32')]['filter']){_0x418d6f[_0xbeb0('0x39')]=_['merge'](_0x418d6f[_0xbeb0('0x39')],{'$or':_['map'](_0x418d6f[_0xbeb0('0x33')],function(_0x445475){var _0x310807={};_0x310807[_0x445475]={'$like':'%'+_0x4bd5a5['query'][_0xbeb0('0x3b')]+'%'};return _0x310807;})});}_0x418d6f=_[_0xbeb0('0x48')]({},_0x418d6f,_0x4bd5a5[_0xbeb0('0x3d')]);return _0x1ee773['getAllConditions'](_0x418d6f);}})[_0xbeb0('0x22')](function(_0x512a40){if(_0x512a40){_0x5a306f=_0x512a40[_0xbeb0('0x47')];if(!_0x4bd5a5[_0xbeb0('0x32')]['hasOwnProperty'](_0xbeb0('0x36'))){_0x418d6f[_0xbeb0('0x1c')]=qs[_0xbeb0('0x1c')](_0x4bd5a5[_0xbeb0('0x32')][_0xbeb0('0x1c')]);_0x418d6f['offset']=qs[_0xbeb0('0x1a')](_0x4bd5a5[_0xbeb0('0x32')][_0xbeb0('0x1a')]);}return _0x1ee773[_0xbeb0('0x58')](_0x418d6f);}})[_0xbeb0('0x22')](function(_0x486148){if(_0x486148){return _0x486148?{'count':_0x5a306f,'rows':_0x486148}:null;}})[_0xbeb0('0x22')](respondWithResult(_0x4838ff,null))[_0xbeb0('0x44')](handleError(_0x4838ff,null));};exports[_0xbeb0('0x59')]=function(_0x54960b,_0x259a45,_0x10d060){var _0x4583ef={};var _0x307673={};var _0x1e1bec;var _0x383db5;return db[_0xbeb0('0x3e')][_0xbeb0('0x56')]({'where':{'id':_0x54960b['params']['id']}})[_0xbeb0('0x22')](handleEntityNotFound(_0x259a45,null))[_0xbeb0('0x22')](function(_0x2cdff4){if(_0x2cdff4){_0x1e1bec=_0x2cdff4;_0x307673[_0xbeb0('0x2f')]=_[_0xbeb0('0x30')](db[_0xbeb0('0x54')][_0xbeb0('0x2c')]);_0x307673[_0xbeb0('0x32')]=_['keys'](_0x54960b[_0xbeb0('0x32')]);_0x307673[_0xbeb0('0x3a')]=_[_0xbeb0('0x31')](_0x307673['model'],_0x307673[_0xbeb0('0x32')]);_0x4583ef[_0xbeb0('0x33')]=_[_0xbeb0('0x31')](_0x307673[_0xbeb0('0x2f')],qs[_0xbeb0('0x34')](_0x54960b[_0xbeb0('0x32')][_0xbeb0('0x34')]));_0x4583ef[_0xbeb0('0x33')]=_0x4583ef[_0xbeb0('0x33')][_0xbeb0('0x47')]?_0x4583ef[_0xbeb0('0x33')]:_0x307673[_0xbeb0('0x2f')];_0x4583ef[_0xbeb0('0x37')]=qs['sort'](_0x54960b[_0xbeb0('0x32')][_0xbeb0('0x38')]);_0x4583ef[_0xbeb0('0x39')]=qs['filters'](_[_0xbeb0('0x57')](_0x54960b[_0xbeb0('0x32')],_0x307673[_0xbeb0('0x3a')]));if(_0x54960b[_0xbeb0('0x32')][_0xbeb0('0x3b')]){_0x4583ef[_0xbeb0('0x39')]=_['merge'](_0x4583ef[_0xbeb0('0x39')],{'$or':_[_0xbeb0('0x2b')](_0x4583ef[_0xbeb0('0x33')],function(_0x3cf859){var _0x58b0a8={};_0x58b0a8[_0x3cf859]={'$like':'%'+_0x54960b[_0xbeb0('0x32')][_0xbeb0('0x3b')]+'%'};return _0x58b0a8;})});}_0x4583ef=_['merge']({},_0x4583ef,_0x54960b[_0xbeb0('0x3d')]);return _0x1e1bec[_0xbeb0('0x59')](_0x4583ef);}})[_0xbeb0('0x22')](function(_0x2c3ca6){if(_0x2c3ca6){_0x383db5=_0x2c3ca6['length'];if(!_0x54960b[_0xbeb0('0x32')]['hasOwnProperty'](_0xbeb0('0x36'))){_0x4583ef[_0xbeb0('0x1c')]=qs[_0xbeb0('0x1c')](_0x54960b[_0xbeb0('0x32')][_0xbeb0('0x1c')]);_0x4583ef[_0xbeb0('0x1a')]=qs[_0xbeb0('0x1a')](_0x54960b[_0xbeb0('0x32')][_0xbeb0('0x1a')]);}return _0x1e1bec['getAnyConditions'](_0x4583ef);}})['then'](function(_0x40d94e){if(_0x40d94e){return _0x40d94e?{'count':_0x383db5,'rows':_0x40d94e}:null;}})[_0xbeb0('0x22')](respondWithResult(_0x259a45,null))[_0xbeb0('0x44')](handleError(_0x259a45,null));};exports['addAction']=function(_0x49147f,_0x5e2eb9,_0x17404c){if(_0x49147f['body']['id']){delete _0x49147f[_0xbeb0('0x51')]['id'];}return db['Trigger'][_0xbeb0('0x4e')]({'where':{'id':_0x49147f[_0xbeb0('0x46')]['id']}})[_0xbeb0('0x22')](handleEntityNotFound(_0x5e2eb9,null))['then'](function(_0x52a2c5){if(_0x52a2c5){_0x49147f[_0xbeb0('0x51')]['TriggerId']=_0x52a2c5['id'];return db[_0xbeb0('0x5a')]['create'](_0x49147f['body']);}})[_0xbeb0('0x22')](respondWithResult(_0x5e2eb9,null))[_0xbeb0('0x44')](handleError(_0x5e2eb9,null));};exports[_0xbeb0('0x5b')]=function(_0x12fb31,_0x2fdc7b,_0x433fdc){var _0x4508c4={};var _0x4b70da={};var _0x11b2ab;var _0x225cd2;return db[_0xbeb0('0x3e')][_0xbeb0('0x56')]({'where':{'id':_0x12fb31['params']['id']}})[_0xbeb0('0x22')](handleEntityNotFound(_0x2fdc7b,null))[_0xbeb0('0x22')](function(_0x531a75){if(_0x531a75){_0x11b2ab=_0x531a75;_0x4b70da[_0xbeb0('0x2f')]=_[_0xbeb0('0x30')](db[_0xbeb0('0x5a')][_0xbeb0('0x2c')]);_0x4b70da[_0xbeb0('0x32')]=_['keys'](_0x12fb31[_0xbeb0('0x32')]);_0x4b70da[_0xbeb0('0x3a')]=_['intersection'](_0x4b70da[_0xbeb0('0x2f')],_0x4b70da['query']);_0x4508c4[_0xbeb0('0x33')]=_['intersection'](_0x4b70da[_0xbeb0('0x2f')],qs[_0xbeb0('0x34')](_0x12fb31['query'][_0xbeb0('0x34')]));_0x4508c4[_0xbeb0('0x33')]=_0x4508c4[_0xbeb0('0x33')]['length']?_0x4508c4['attributes']:_0x4b70da[_0xbeb0('0x2f')];_0x4508c4['order']=qs[_0xbeb0('0x38')](_0x12fb31[_0xbeb0('0x32')]['sort']);_0x4508c4[_0xbeb0('0x39')]=qs['filters'](_[_0xbeb0('0x57')](_0x12fb31['query'],_0x4b70da[_0xbeb0('0x3a')]));if(_0x12fb31[_0xbeb0('0x32')]['filter']){_0x4508c4[_0xbeb0('0x39')]=_['merge'](_0x4508c4[_0xbeb0('0x39')],{'$or':_[_0xbeb0('0x2b')](_0x4508c4['attributes'],function(_0x59d28d){var _0x5622f9={};_0x5622f9[_0x59d28d]={'$like':'%'+_0x12fb31['query']['filter']+'%'};return _0x5622f9;})});}_0x4508c4=_[_0xbeb0('0x48')]({},_0x4508c4,_0x12fb31[_0xbeb0('0x3d')]);return _0x11b2ab[_0xbeb0('0x5b')](_0x4508c4);}})[_0xbeb0('0x22')](function(_0x5cd9ec){if(_0x5cd9ec){_0x225cd2=_0x5cd9ec[_0xbeb0('0x47')];if(!_0x12fb31[_0xbeb0('0x32')][_0xbeb0('0x35')](_0xbeb0('0x36'))){_0x4508c4[_0xbeb0('0x1c')]=qs[_0xbeb0('0x1c')](_0x12fb31[_0xbeb0('0x32')]['limit']);_0x4508c4[_0xbeb0('0x1a')]=qs[_0xbeb0('0x1a')](_0x12fb31['query']['offset']);}return _0x11b2ab['getActions'](_0x4508c4);}})[_0xbeb0('0x22')](function(_0x1fb7b6){if(_0x1fb7b6){return _0x1fb7b6?{'count':_0x225cd2,'rows':_0x1fb7b6}:null;}})['then'](respondWithResult(_0x2fdc7b,null))[_0xbeb0('0x44')](handleError(_0x2fdc7b,null));}; \ No newline at end of file +var _0x1d78=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','sort','where','merge','filter','options','Trigger','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','length','hasOwnProperty','nolimit','pick','getAnyConditions','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3c64ab,_0x130481){var _0x14346c=function(_0x3942e5){while(--_0x3942e5){_0x3c64ab['push'](_0x3c64ab['shift']());}};_0x14346c(++_0x130481);}(_0x1d78,0x1c6));var _0x81d7=function(_0xd37178,_0x54616a){_0xd37178=_0xd37178-0x0;var _0x468262=_0x1d78[_0xd37178];return _0x468262;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81d7('0x0'));var zipdir=require(_0x81d7('0x1'));var jsonpatch=require(_0x81d7('0x2'));var rp=require('request-promise');var moment=require(_0x81d7('0x3'));var BPromise=require(_0x81d7('0x4'));var Mustache=require(_0x81d7('0x5'));var util=require(_0x81d7('0x6'));var path=require('path');var sox=require(_0x81d7('0x7'));var csv=require(_0x81d7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81d7('0x9'));var _=require(_0x81d7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x81d7('0xb'));var deskjs=require(_0x81d7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x81d7('0xd'));var Papa=require(_0x81d7('0xe'));var Redis=require(_0x81d7('0xf'));var authService=require(_0x81d7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x81d7('0x11'));var hardwareService=require(_0x81d7('0x12'));var logger=require(_0x81d7('0x13'))(_0x81d7('0x14'));var utils=require(_0x81d7('0x15'));var config=require(_0x81d7('0x16'));var licenseUtil=require(_0x81d7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c7d45,_0x74bcb){_0x74bcb=_0x74bcb||0xcc;return function(_0x2e8438){if(_0x2e8438){return _0x3c7d45[_0x81d7('0x18')](_0x74bcb);}return _0x3c7d45[_0x81d7('0x19')](_0x74bcb)[_0x81d7('0x1a')]();};}function respondWithResult(_0x10f55d,_0x3ff680){_0x3ff680=_0x3ff680||0xc8;return function(_0x4ff65b){if(_0x4ff65b){return _0x10f55d[_0x81d7('0x19')](_0x3ff680)[_0x81d7('0x1b')](_0x4ff65b);}};}function respondWithFilteredResult(_0x599b8f,_0x2d9b69){return function(_0x3cc430){if(_0x3cc430){var _0x220c5d=typeof _0x2d9b69[_0x81d7('0x1c')]===_0x81d7('0x1d')&&typeof _0x2d9b69[_0x81d7('0x1e')]===_0x81d7('0x1d');var _0x1c7654=_0x3cc430[_0x81d7('0x1f')];var _0x1bf333=_0x220c5d?0x0:_0x2d9b69[_0x81d7('0x1c')];var _0x5665d5=_0x220c5d?_0x3cc430[_0x81d7('0x1f')]:_0x2d9b69['offset']+_0x2d9b69['limit'];var _0x7e7836;if(_0x5665d5>=_0x1c7654){_0x5665d5=_0x1c7654;_0x7e7836=0xc8;}else{_0x7e7836=0xce;}_0x599b8f[_0x81d7('0x19')](_0x7e7836);return _0x599b8f[_0x81d7('0x20')]('Content-Range',_0x1bf333+'-'+_0x5665d5+'/'+_0x1c7654)[_0x81d7('0x1b')](_0x3cc430);}return null;};}function patchUpdates(_0x2c844f){return function(_0x32a26f){try{jsonpatch[_0x81d7('0x21')](_0x32a26f,_0x2c844f,!![]);}catch(_0x56114b){return BPromise[_0x81d7('0x22')](_0x56114b);}return _0x32a26f[_0x81d7('0x23')]();};}function saveUpdates(_0x369dea,_0x3a8585){return function(_0x3467ea){if(_0x3467ea){return _0x3467ea[_0x81d7('0x24')](_0x369dea)[_0x81d7('0x25')](function(_0x1ffe34){return _0x1ffe34;});}return null;};}function removeEntity(_0x10d7c7,_0x12b3df){return function(_0x48ff7d){if(_0x48ff7d){return _0x48ff7d[_0x81d7('0x26')]()[_0x81d7('0x25')](function(){var _0x301a2e=_0x48ff7d['get']({'plain':!![]});var _0x5474ec=_0x81d7('0x27');return db[_0x81d7('0x28')][_0x81d7('0x26')]({'where':{'type':_0x5474ec,'resourceId':_0x301a2e['id']}})[_0x81d7('0x25')](function(){return _0x48ff7d;});})['then'](function(){_0x10d7c7[_0x81d7('0x19')](0xcc)[_0x81d7('0x1a')]();});}};}function handleEntityNotFound(_0x2d5f09,_0x5d57a8){return function(_0x5bd7b7){if(!_0x5bd7b7){_0x2d5f09['sendStatus'](0x194);}return _0x5bd7b7;};}function handleError(_0x404c55,_0x42e1c1){_0x42e1c1=_0x42e1c1||0x1f4;return function(_0x11d3f5){logger['error'](_0x11d3f5['stack']);if(_0x11d3f5[_0x81d7('0x29')]){delete _0x11d3f5[_0x81d7('0x29')];}_0x404c55[_0x81d7('0x19')](_0x42e1c1)[_0x81d7('0x2a')](_0x11d3f5);};}exports[_0x81d7('0x2b')]=function(_0x5152c0,_0x5b369d){var _0xdd2bcb={},_0x36ec03={},_0x11e4f0={'count':0x0,'rows':[]};var _0x8e9050=_[_0x81d7('0x2c')](db['Trigger'][_0x81d7('0x2d')],function(_0x3d1a07){return{'name':_0x3d1a07[_0x81d7('0x2e')],'type':_0x3d1a07[_0x81d7('0x2f')][_0x81d7('0x30')]};});_0x36ec03['model']=_[_0x81d7('0x2c')](_0x8e9050,_0x81d7('0x29'));_0x36ec03['query']=_['keys'](_0x5152c0[_0x81d7('0x31')]);_0x36ec03[_0x81d7('0x32')]=_[_0x81d7('0x33')](_0x36ec03[_0x81d7('0x34')],_0x36ec03[_0x81d7('0x31')]);_0xdd2bcb[_0x81d7('0x35')]=_['intersection'](_0x36ec03['model'],qs[_0x81d7('0x36')](_0x5152c0['query'][_0x81d7('0x36')]));_0xdd2bcb[_0x81d7('0x35')]=_0xdd2bcb[_0x81d7('0x35')]['length']?_0xdd2bcb[_0x81d7('0x35')]:_0x36ec03[_0x81d7('0x34')];if(!_0x5152c0['query']['hasOwnProperty']('nolimit')){_0xdd2bcb[_0x81d7('0x1e')]=qs[_0x81d7('0x1e')](_0x5152c0[_0x81d7('0x31')][_0x81d7('0x1e')]);_0xdd2bcb[_0x81d7('0x1c')]=qs[_0x81d7('0x1c')](_0x5152c0[_0x81d7('0x31')][_0x81d7('0x1c')]);}_0xdd2bcb['order']=qs[_0x81d7('0x37')](_0x5152c0[_0x81d7('0x31')]['sort']);_0xdd2bcb[_0x81d7('0x38')]=qs[_0x81d7('0x32')](_['pick'](_0x5152c0[_0x81d7('0x31')],_0x36ec03[_0x81d7('0x32')]),_0x8e9050);if(_0x5152c0['query']['filter']){_0xdd2bcb[_0x81d7('0x38')]=_[_0x81d7('0x39')](_0xdd2bcb[_0x81d7('0x38')],{'$or':_['map'](_0x8e9050,function(_0x100c01){if(_0x100c01['type']!=='VIRTUAL'){var _0x2605da={};_0x2605da[_0x100c01[_0x81d7('0x29')]]={'$like':'%'+_0x5152c0[_0x81d7('0x31')][_0x81d7('0x3a')]+'%'};return _0x2605da;}})});}_0xdd2bcb=_['merge']({},_0xdd2bcb,_0x5152c0[_0x81d7('0x3b')]);var _0x4ef933={'where':_0xdd2bcb[_0x81d7('0x38')]};return db[_0x81d7('0x3c')]['count'](_0x4ef933)[_0x81d7('0x25')](function(_0x3177e3){_0x11e4f0[_0x81d7('0x1f')]=_0x3177e3;if(_0x5152c0[_0x81d7('0x31')][_0x81d7('0x3d')]){_0xdd2bcb[_0x81d7('0x3e')]=[{'all':!![]}];}return db['Trigger'][_0x81d7('0x3f')](_0xdd2bcb);})[_0x81d7('0x25')](function(_0x34decc){_0x11e4f0[_0x81d7('0x40')]=_0x34decc;return _0x11e4f0;})[_0x81d7('0x25')](respondWithFilteredResult(_0x5b369d,_0xdd2bcb))['catch'](handleError(_0x5b369d,null));};exports[_0x81d7('0x41')]=function(_0x5acd8f,_0x6f3127){var _0x21c5ca={'raw':![],'where':{'id':_0x5acd8f[_0x81d7('0x42')]['id']}},_0x566469={};_0x566469['model']=_[_0x81d7('0x43')](db[_0x81d7('0x3c')]['rawAttributes']);_0x566469[_0x81d7('0x31')]=_[_0x81d7('0x43')](_0x5acd8f[_0x81d7('0x31')]);_0x566469[_0x81d7('0x32')]=_['intersection'](_0x566469['model'],_0x566469['query']);_0x21c5ca[_0x81d7('0x35')]=_[_0x81d7('0x33')](_0x566469['model'],qs[_0x81d7('0x36')](_0x5acd8f['query'][_0x81d7('0x36')]));_0x21c5ca[_0x81d7('0x35')]=_0x21c5ca[_0x81d7('0x35')]['length']?_0x21c5ca[_0x81d7('0x35')]:_0x566469[_0x81d7('0x34')];if(_0x5acd8f[_0x81d7('0x31')][_0x81d7('0x3d')]){_0x21c5ca[_0x81d7('0x3e')]=[{'all':!![]}];}_0x21c5ca=_[_0x81d7('0x39')]({},_0x21c5ca,_0x5acd8f[_0x81d7('0x3b')]);return db[_0x81d7('0x3c')]['find'](_0x21c5ca)[_0x81d7('0x25')](handleEntityNotFound(_0x6f3127,null))[_0x81d7('0x25')](respondWithResult(_0x6f3127,null))[_0x81d7('0x44')](handleError(_0x6f3127,null));};exports[_0x81d7('0x45')]=function(_0x45acb6,_0x58cf52){return db[_0x81d7('0x3c')][_0x81d7('0x45')](_0x45acb6[_0x81d7('0x46')],{})[_0x81d7('0x25')](function(_0x3d339e){var _0x3e8979=_0x45acb6[_0x81d7('0x47')][_0x81d7('0x48')]({'plain':!![]});if(!_0x3e8979)throw new Error(_0x81d7('0x49'));if(_0x3e8979[_0x81d7('0x4a')]===_0x81d7('0x47')){var _0x4ad901=_0x3d339e['get']({'plain':!![]});var _0x18b3ad=_0x81d7('0x27');return db['UserProfileSection'][_0x81d7('0x4b')]({'where':{'name':_0x18b3ad,'userProfileId':_0x3e8979[_0x81d7('0x4c')]},'raw':!![]})[_0x81d7('0x25')](function(_0x183605){if(_0x183605&&_0x183605[_0x81d7('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x4ad901[_0x81d7('0x29')],'resourceId':_0x4ad901['id'],'type':_0x183605['name'],'sectionId':_0x183605['id']},{})[_0x81d7('0x25')](function(){return _0x3d339e;});}else{return _0x3d339e;}})['catch'](function(_0x2aef55){logger['error'](_0x81d7('0x4e'),_0x2aef55);throw _0x2aef55;});}return _0x3d339e;})[_0x81d7('0x25')](respondWithResult(_0x58cf52,0xc9))[_0x81d7('0x44')](handleError(_0x58cf52,null));};exports[_0x81d7('0x24')]=function(_0x380cd1,_0x521e6c){if(_0x380cd1['body']['id']){delete _0x380cd1['body']['id'];}return db[_0x81d7('0x3c')][_0x81d7('0x4b')]({'where':{'id':_0x380cd1[_0x81d7('0x42')]['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x521e6c,null))[_0x81d7('0x25')](saveUpdates(_0x380cd1['body'],null))[_0x81d7('0x25')](respondWithResult(_0x521e6c,null))[_0x81d7('0x44')](handleError(_0x521e6c,null));};exports[_0x81d7('0x26')]=function(_0x3e6057,_0x36b568){return db[_0x81d7('0x3c')][_0x81d7('0x4b')]({'where':{'id':_0x3e6057[_0x81d7('0x42')]['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x36b568,null))[_0x81d7('0x25')](removeEntity(_0x36b568,null))[_0x81d7('0x44')](handleError(_0x36b568,null));};exports[_0x81d7('0x4f')]=function(_0x145e0f,_0x910b6a,_0x280b55){if(_0x145e0f[_0x81d7('0x46')]['id']){delete _0x145e0f['body']['id'];}return db[_0x81d7('0x3c')][_0x81d7('0x4b')]({'where':{'id':_0x145e0f[_0x81d7('0x42')]['id']}})['then'](handleEntityNotFound(_0x910b6a,null))[_0x81d7('0x25')](function(_0x38ae76){if(_0x38ae76){_0x145e0f[_0x81d7('0x46')][_0x81d7('0x50')]=_0x38ae76['id'];return db[_0x81d7('0x51')][_0x81d7('0x45')](_0x145e0f[_0x81d7('0x46')]);}})[_0x81d7('0x25')](respondWithResult(_0x910b6a,null))['catch'](handleError(_0x910b6a,null));};exports[_0x81d7('0x52')]=function(_0x38485b,_0x1079a8,_0x557c77){if(_0x38485b[_0x81d7('0x46')]['id']){delete _0x38485b[_0x81d7('0x46')]['id'];}return db[_0x81d7('0x3c')][_0x81d7('0x4b')]({'where':{'id':_0x38485b['params']['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x1079a8,null))['then'](function(_0xe09585){if(_0xe09585){_0x38485b[_0x81d7('0x46')][_0x81d7('0x53')]=_0xe09585['id'];return db['Condition'][_0x81d7('0x45')](_0x38485b[_0x81d7('0x46')]);}})[_0x81d7('0x25')](respondWithResult(_0x1079a8,null))[_0x81d7('0x44')](handleError(_0x1079a8,null));};exports[_0x81d7('0x54')]=function(_0x4aa9bd,_0x270e9e,_0x506dd6){var _0x1104a4={};var _0x25427f={};var _0x1362b1;var _0x1833c9;return db[_0x81d7('0x3c')][_0x81d7('0x55')]({'where':{'id':_0x4aa9bd[_0x81d7('0x42')]['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x270e9e,null))[_0x81d7('0x25')](function(_0x1aa20d){if(_0x1aa20d){_0x1362b1=_0x1aa20d;_0x25427f[_0x81d7('0x34')]=_[_0x81d7('0x43')](db[_0x81d7('0x51')][_0x81d7('0x2d')]);_0x25427f[_0x81d7('0x31')]=_[_0x81d7('0x43')](_0x4aa9bd['query']);_0x25427f['filters']=_[_0x81d7('0x33')](_0x25427f[_0x81d7('0x34')],_0x25427f[_0x81d7('0x31')]);_0x1104a4[_0x81d7('0x35')]=_['intersection'](_0x25427f[_0x81d7('0x34')],qs[_0x81d7('0x36')](_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x36')]));_0x1104a4[_0x81d7('0x35')]=_0x1104a4[_0x81d7('0x35')]['length']?_0x1104a4[_0x81d7('0x35')]:_0x25427f[_0x81d7('0x34')];_0x1104a4[_0x81d7('0x56')]=qs['sort'](_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x37')]);_0x1104a4['where']=qs['filters'](_['pick'](_0x4aa9bd[_0x81d7('0x31')],_0x25427f[_0x81d7('0x32')]));if(_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x3a')]){_0x1104a4[_0x81d7('0x38')]=_[_0x81d7('0x39')](_0x1104a4[_0x81d7('0x38')],{'$or':_[_0x81d7('0x2c')](_0x1104a4[_0x81d7('0x35')],function(_0x4b7e6a){var _0x12c740={};_0x12c740[_0x4b7e6a]={'$like':'%'+_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x3a')]+'%'};return _0x12c740;})});}_0x1104a4=_[_0x81d7('0x39')]({},_0x1104a4,_0x4aa9bd[_0x81d7('0x3b')]);return _0x1362b1['getAllConditions'](_0x1104a4);}})['then'](function(_0x574d64){if(_0x574d64){_0x1833c9=_0x574d64[_0x81d7('0x57')];if(!_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x58')](_0x81d7('0x59'))){_0x1104a4[_0x81d7('0x1e')]=qs[_0x81d7('0x1e')](_0x4aa9bd[_0x81d7('0x31')][_0x81d7('0x1e')]);_0x1104a4[_0x81d7('0x1c')]=qs[_0x81d7('0x1c')](_0x4aa9bd['query'][_0x81d7('0x1c')]);}return _0x1362b1[_0x81d7('0x54')](_0x1104a4);}})[_0x81d7('0x25')](function(_0x1b23d2){if(_0x1b23d2){return _0x1b23d2?{'count':_0x1833c9,'rows':_0x1b23d2}:null;}})[_0x81d7('0x25')](respondWithResult(_0x270e9e,null))[_0x81d7('0x44')](handleError(_0x270e9e,null));};exports['getAnyConditions']=function(_0x162916,_0x1f5404,_0x10e50d){var _0x2c2173={};var _0x30bdcf={};var _0x2153da;var _0x432d79;return db['Trigger'][_0x81d7('0x55')]({'where':{'id':_0x162916[_0x81d7('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f5404,null))[_0x81d7('0x25')](function(_0x15e8cb){if(_0x15e8cb){_0x2153da=_0x15e8cb;_0x30bdcf[_0x81d7('0x34')]=_[_0x81d7('0x43')](db[_0x81d7('0x51')][_0x81d7('0x2d')]);_0x30bdcf['query']=_['keys'](_0x162916['query']);_0x30bdcf['filters']=_[_0x81d7('0x33')](_0x30bdcf[_0x81d7('0x34')],_0x30bdcf[_0x81d7('0x31')]);_0x2c2173[_0x81d7('0x35')]=_['intersection'](_0x30bdcf[_0x81d7('0x34')],qs['fields'](_0x162916[_0x81d7('0x31')][_0x81d7('0x36')]));_0x2c2173[_0x81d7('0x35')]=_0x2c2173[_0x81d7('0x35')]['length']?_0x2c2173[_0x81d7('0x35')]:_0x30bdcf[_0x81d7('0x34')];_0x2c2173[_0x81d7('0x56')]=qs[_0x81d7('0x37')](_0x162916[_0x81d7('0x31')][_0x81d7('0x37')]);_0x2c2173[_0x81d7('0x38')]=qs['filters'](_[_0x81d7('0x5a')](_0x162916[_0x81d7('0x31')],_0x30bdcf['filters']));if(_0x162916['query'][_0x81d7('0x3a')]){_0x2c2173[_0x81d7('0x38')]=_['merge'](_0x2c2173[_0x81d7('0x38')],{'$or':_['map'](_0x2c2173[_0x81d7('0x35')],function(_0x57bea9){var _0x5c148b={};_0x5c148b[_0x57bea9]={'$like':'%'+_0x162916[_0x81d7('0x31')][_0x81d7('0x3a')]+'%'};return _0x5c148b;})});}_0x2c2173=_[_0x81d7('0x39')]({},_0x2c2173,_0x162916['options']);return _0x2153da[_0x81d7('0x5b')](_0x2c2173);}})['then'](function(_0x391f47){if(_0x391f47){_0x432d79=_0x391f47[_0x81d7('0x57')];if(!_0x162916[_0x81d7('0x31')]['hasOwnProperty'](_0x81d7('0x59'))){_0x2c2173['limit']=qs[_0x81d7('0x1e')](_0x162916[_0x81d7('0x31')][_0x81d7('0x1e')]);_0x2c2173[_0x81d7('0x1c')]=qs[_0x81d7('0x1c')](_0x162916['query'][_0x81d7('0x1c')]);}return _0x2153da['getAnyConditions'](_0x2c2173);}})[_0x81d7('0x25')](function(_0x43fb63){if(_0x43fb63){return _0x43fb63?{'count':_0x432d79,'rows':_0x43fb63}:null;}})[_0x81d7('0x25')](respondWithResult(_0x1f5404,null))[_0x81d7('0x44')](handleError(_0x1f5404,null));};exports['addAction']=function(_0x2e9ad8,_0x315336,_0x2af51a){if(_0x2e9ad8[_0x81d7('0x46')]['id']){delete _0x2e9ad8['body']['id'];}return db[_0x81d7('0x3c')][_0x81d7('0x4b')]({'where':{'id':_0x2e9ad8['params']['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x315336,null))[_0x81d7('0x25')](function(_0x3e6bd4){if(_0x3e6bd4){_0x2e9ad8['body'][_0x81d7('0x5c')]=_0x3e6bd4['id'];return db[_0x81d7('0x5d')]['create'](_0x2e9ad8['body']);}})[_0x81d7('0x25')](respondWithResult(_0x315336,null))[_0x81d7('0x44')](handleError(_0x315336,null));};exports[_0x81d7('0x5e')]=function(_0x47029c,_0x16979e,_0x1aff75){var _0x1953f3={};var _0x318bac={};var _0x3bbda0;var _0x1acb24;return db[_0x81d7('0x3c')][_0x81d7('0x55')]({'where':{'id':_0x47029c[_0x81d7('0x42')]['id']}})[_0x81d7('0x25')](handleEntityNotFound(_0x16979e,null))[_0x81d7('0x25')](function(_0x3f9620){if(_0x3f9620){_0x3bbda0=_0x3f9620;_0x318bac[_0x81d7('0x34')]=_['keys'](db['Action'][_0x81d7('0x2d')]);_0x318bac[_0x81d7('0x31')]=_[_0x81d7('0x43')](_0x47029c[_0x81d7('0x31')]);_0x318bac['filters']=_[_0x81d7('0x33')](_0x318bac[_0x81d7('0x34')],_0x318bac[_0x81d7('0x31')]);_0x1953f3['attributes']=_['intersection'](_0x318bac[_0x81d7('0x34')],qs[_0x81d7('0x36')](_0x47029c[_0x81d7('0x31')]['fields']));_0x1953f3[_0x81d7('0x35')]=_0x1953f3[_0x81d7('0x35')][_0x81d7('0x57')]?_0x1953f3[_0x81d7('0x35')]:_0x318bac[_0x81d7('0x34')];_0x1953f3[_0x81d7('0x56')]=qs['sort'](_0x47029c[_0x81d7('0x31')][_0x81d7('0x37')]);_0x1953f3[_0x81d7('0x38')]=qs[_0x81d7('0x32')](_[_0x81d7('0x5a')](_0x47029c['query'],_0x318bac[_0x81d7('0x32')]));if(_0x47029c[_0x81d7('0x31')][_0x81d7('0x3a')]){_0x1953f3[_0x81d7('0x38')]=_[_0x81d7('0x39')](_0x1953f3[_0x81d7('0x38')],{'$or':_['map'](_0x1953f3['attributes'],function(_0x4543d4){var _0x4defa5={};_0x4defa5[_0x4543d4]={'$like':'%'+_0x47029c[_0x81d7('0x31')][_0x81d7('0x3a')]+'%'};return _0x4defa5;})});}_0x1953f3=_[_0x81d7('0x39')]({},_0x1953f3,_0x47029c['options']);return _0x3bbda0[_0x81d7('0x5e')](_0x1953f3);}})[_0x81d7('0x25')](function(_0x25c24c){if(_0x25c24c){_0x1acb24=_0x25c24c[_0x81d7('0x57')];if(!_0x47029c[_0x81d7('0x31')][_0x81d7('0x58')](_0x81d7('0x59'))){_0x1953f3[_0x81d7('0x1e')]=qs[_0x81d7('0x1e')](_0x47029c[_0x81d7('0x31')]['limit']);_0x1953f3[_0x81d7('0x1c')]=qs[_0x81d7('0x1c')](_0x47029c[_0x81d7('0x31')][_0x81d7('0x1c')]);}return _0x3bbda0[_0x81d7('0x5e')](_0x1953f3);}})['then'](function(_0x4f40b1){if(_0x4f40b1){return _0x4f40b1?{'count':_0x1acb24,'rows':_0x4f40b1}:null;}})[_0x81d7('0x25')](respondWithResult(_0x16979e,null))[_0x81d7('0x44')](handleError(_0x16979e,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d001a82..d30e6dd 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 _0x9330=['lodash','api','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x3b5a7a,_0x2c3f5c){var _0x597fbd=function(_0x41b2aa){while(--_0x41b2aa){_0x3b5a7a['push'](_0x3b5a7a['shift']());}};_0x597fbd(++_0x2c3f5c);}(_0x9330,0x14a));var _0x0933=function(_0x1f391a,_0x2ab6cc){_0x1f391a=_0x1f391a-0x0;var _0x50f11d=_0x9330[_0x1f391a];return _0x50f11d;};'use strict';var _=require(_0x0933('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0933('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0933('0x2'));var fs=require('fs');var path=require(_0x0933('0x3'));var rimraf=require(_0x0933('0x4'));var config=require(_0x0933('0x5'));var attributes=require(_0x0933('0x6'));module[_0x0933('0x7')]=function(_0x579dee,_0x4c79de){return _0x579dee[_0x0933('0x8')](_0x0933('0x9'),attributes,{'tableName':_0x0933('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6753=['bluebird','request-promise','rimraf','../../config/environment','define','Trigger','tools_triggers','lodash','util','../../config/logger','api'];(function(_0x768f7f,_0x3d7b62){var _0x4d29e1=function(_0x377f41){while(--_0x377f41){_0x768f7f['push'](_0x768f7f['shift']());}};_0x4d29e1(++_0x3d7b62);}(_0x6753,0xa1));var _0x3675=function(_0x3d7427,_0x278fd9){_0x3d7427=_0x3d7427-0x0;var _0x1a7764=_0x6753[_0x3d7427];return _0x1a7764;};'use strict';var _=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var logger=require(_0x3675('0x2'))(_0x3675('0x3'));var moment=require('moment');var BPromise=require(_0x3675('0x4'));var rp=require(_0x3675('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3675('0x6'));var config=require(_0x3675('0x7'));var attributes=require('./trigger.attributes');module['exports']=function(_0x4e4e73,_0x396a35){return _0x4e4e73[_0x3675('0x8')](_0x3675('0x9'),attributes,{'tableName':_0x3675('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 3096640..af6a036 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 _0x740c=['model','stringify','catch','ShowTrigger','Trigger','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','GetTrigger','findAll','options','raw','attributes','include','map'];(function(_0x4b6894,_0x5680e3){var _0x43d826=function(_0x14a68d){while(--_0x14a68d){_0x4b6894['push'](_0x4b6894['shift']());}};_0x43d826(++_0x5680e3);}(_0x740c,0xed));var _0xc740=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x740c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc740('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc740('0x1'));var rs=require(_0xc740('0x2'));var fs=require('fs');var Redis=require(_0xc740('0x3'));var db=require(_0xc740('0x4'))['db'];var utils=require(_0xc740('0x5'));var logger=require('../../config/logger')(_0xc740('0x6'));var config=require(_0xc740('0x7'));var jayson=require(_0xc740('0x8'));var client=jayson[_0xc740('0x9')][_0xc740('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x384c70,_0x419871,_0x493b55){return new BPromise(function(_0x55c956,_0x1b9ec6){return client['request'](_0x384c70,_0x493b55)[_0xc740('0xb')](function(_0x237de8){logger[_0xc740('0xc')](_0xc740('0xd'),_0x419871,_0xc740('0xe'));logger[_0xc740('0xf')](_0xc740('0x10'),_0x419871,'request\x20sent',JSON['stringify'](_0x237de8));if(_0x237de8[_0xc740('0x11')]){if(_0x237de8['error'][_0xc740('0x12')]===0x1f4){logger['error'](_0xc740('0xd'),_0x419871,_0x237de8[_0xc740('0x11')][_0xc740('0x13')]);return _0x1b9ec6(_0x237de8[_0xc740('0x11')]['message']);}logger[_0xc740('0x11')](_0xc740('0xd'),_0x419871,_0x237de8[_0xc740('0x11')]['message']);return _0x55c956(_0x237de8['error'][_0xc740('0x13')]);}else{logger[_0xc740('0xc')](_0xc740('0xd'),_0x419871,_0xc740('0xe'));_0x55c956(_0x237de8['result']['message']);}})['catch'](function(_0x18f5d7){logger['error'](_0xc740('0xd'),_0x419871,_0x18f5d7);_0x1b9ec6(_0x18f5d7);});});}exports[_0xc740('0x14')]=function(_0x2bfe0d){var _0x4054dc=this;return new Promise(function(_0x87463b,_0x3ffc45){return db['Trigger'][_0xc740('0x15')]({'raw':_0x2bfe0d[_0xc740('0x16')]?_0x2bfe0d[_0xc740('0x16')][_0xc740('0x17')]===undefined?!![]:![]:!![],'where':_0x2bfe0d[_0xc740('0x16')]?_0x2bfe0d[_0xc740('0x16')]['where']||null:null,'attributes':_0x2bfe0d[_0xc740('0x16')]?_0x2bfe0d[_0xc740('0x16')][_0xc740('0x18')]||null:null,'limit':_0x2bfe0d['options']?_0x2bfe0d[_0xc740('0x16')]['limit']||null:null,'include':_0x2bfe0d['options']?_0x2bfe0d['options'][_0xc740('0x19')]?_[_0xc740('0x1a')](_0x2bfe0d[_0xc740('0x16')][_0xc740('0x19')],function(_0x17ca67){return{'model':db[_0x17ca67[_0xc740('0x1b')]],'as':_0x17ca67['as'],'attributes':_0x17ca67['attributes'],'include':_0x17ca67[_0xc740('0x19')]?_[_0xc740('0x1a')](_0x17ca67[_0xc740('0x19')],function(_0x2a6300){return{'model':db[_0x2a6300[_0xc740('0x1b')]],'as':_0x2a6300['as'],'attributes':_0x2a6300[_0xc740('0x18')],'include':_0x2a6300[_0xc740('0x19')]?_[_0xc740('0x1a')](_0x2a6300['include'],function(_0x46571f){return{'model':db[_0x46571f[_0xc740('0x1b')]],'as':_0x46571f['as'],'attributes':_0x46571f['attributes']};}):[]};}):[]};}):[]:[]})[_0xc740('0xb')](function(_0x2d633b){logger[_0xc740('0xc')]('GetTrigger',_0x2bfe0d);logger['debug'](_0xc740('0x14'),_0x2bfe0d,JSON[_0xc740('0x1c')](_0x2d633b));_0x87463b(_0x2d633b);})[_0xc740('0x1d')](function(_0x576a84){logger[_0xc740('0x11')](_0xc740('0x14'),_0x576a84['message'],_0x2bfe0d);_0x3ffc45(_0x4054dc[_0xc740('0x11')](0x1f4,_0x576a84[_0xc740('0x13')]));});});};exports[_0xc740('0x1e')]=function(_0x205f3b){var _0x5b6d16=this;return new Promise(function(_0x3cacaf,_0x52ef98){return db[_0xc740('0x1f')]['find']({'raw':_0x205f3b[_0xc740('0x16')]?_0x205f3b[_0xc740('0x16')][_0xc740('0x17')]===undefined?!![]:![]:!![],'where':_0x205f3b['options']?_0x205f3b[_0xc740('0x16')][_0xc740('0x20')]||null:null,'attributes':_0x205f3b[_0xc740('0x16')]?_0x205f3b[_0xc740('0x16')]['attributes']||null:null,'include':_0x205f3b[_0xc740('0x16')]?_0x205f3b[_0xc740('0x16')][_0xc740('0x19')]?_[_0xc740('0x1a')](_0x205f3b[_0xc740('0x16')]['include'],function(_0x44c1a1){return{'model':db[_0x44c1a1[_0xc740('0x1b')]],'as':_0x44c1a1['as'],'attributes':_0x44c1a1[_0xc740('0x18')],'include':_0x44c1a1[_0xc740('0x19')]?_[_0xc740('0x1a')](_0x44c1a1[_0xc740('0x19')],function(_0x226f67){return{'model':db[_0x226f67[_0xc740('0x1b')]],'as':_0x226f67['as'],'attributes':_0x226f67[_0xc740('0x18')],'include':_0x226f67[_0xc740('0x19')]?_[_0xc740('0x1a')](_0x226f67['include'],function(_0x2d6194){return{'model':db[_0x2d6194[_0xc740('0x1b')]],'as':_0x2d6194['as'],'attributes':_0x2d6194[_0xc740('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35efd2){logger[_0xc740('0xc')](_0xc740('0x1e'),_0x205f3b);logger[_0xc740('0xf')]('ShowTrigger',_0x205f3b,JSON[_0xc740('0x1c')](_0x35efd2));_0x3cacaf(_0x35efd2);})[_0xc740('0x1d')](function(_0x29489b){logger[_0xc740('0x11')](_0xc740('0x1e'),_0x29489b[_0xc740('0x13')],_0x205f3b);_0x52ef98(_0x5b6d16[_0xc740('0x11')](0x1f4,_0x29489b[_0xc740('0x13')]));});});}; \ No newline at end of file +var _0x7054=['catch','ShowTrigger','Trigger','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','findAll','options','raw','map','include','attributes','model','GetTrigger','debug','stringify'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7054,0x125));var _0x4705=function(_0x25cb87,_0xc2d352){_0x25cb87=_0x25cb87-0x0;var _0x3a7537=_0x7054[_0x25cb87];return _0x3a7537;};'use strict';var _=require(_0x4705('0x0'));var util=require(_0x4705('0x1'));var moment=require(_0x4705('0x2'));var BPromise=require(_0x4705('0x3'));var rs=require(_0x4705('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4705('0x5'))['db'];var utils=require(_0x4705('0x6'));var logger=require('../../config/logger')(_0x4705('0x7'));var config=require(_0x4705('0x8'));var jayson=require(_0x4705('0x9'));var client=jayson[_0x4705('0xa')][_0x4705('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47e778,_0x1c5bf7,_0x496223){return new BPromise(function(_0x50e204,_0x474db8){return client[_0x4705('0xc')](_0x47e778,_0x496223)[_0x4705('0xd')](function(_0x3dd18a){logger[_0x4705('0xe')](_0x4705('0xf'),_0x1c5bf7,_0x4705('0x10'));logger['debug'](_0x4705('0x11'),_0x1c5bf7,'request\x20sent',JSON['stringify'](_0x3dd18a));if(_0x3dd18a[_0x4705('0x12')]){if(_0x3dd18a['error'][_0x4705('0x13')]===0x1f4){logger[_0x4705('0x12')](_0x4705('0xf'),_0x1c5bf7,_0x3dd18a[_0x4705('0x12')][_0x4705('0x14')]);return _0x474db8(_0x3dd18a['error'][_0x4705('0x14')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x1c5bf7,_0x3dd18a[_0x4705('0x12')]['message']);return _0x50e204(_0x3dd18a[_0x4705('0x12')][_0x4705('0x14')]);}else{logger['info'](_0x4705('0xf'),_0x1c5bf7,_0x4705('0x10'));_0x50e204(_0x3dd18a['result'][_0x4705('0x14')]);}})['catch'](function(_0x565c0f){logger[_0x4705('0x12')](_0x4705('0xf'),_0x1c5bf7,_0x565c0f);_0x474db8(_0x565c0f);});});}exports['GetTrigger']=function(_0x319671){var _0x4b7594=this;return new Promise(function(_0x10eda6,_0xcab255){return db['Trigger'][_0x4705('0x15')]({'raw':_0x319671[_0x4705('0x16')]?_0x319671['options'][_0x4705('0x17')]===undefined?!![]:![]:!![],'where':_0x319671[_0x4705('0x16')]?_0x319671[_0x4705('0x16')]['where']||null:null,'attributes':_0x319671[_0x4705('0x16')]?_0x319671[_0x4705('0x16')]['attributes']||null:null,'limit':_0x319671[_0x4705('0x16')]?_0x319671[_0x4705('0x16')]['limit']||null:null,'include':_0x319671[_0x4705('0x16')]?_0x319671[_0x4705('0x16')]['include']?_[_0x4705('0x18')](_0x319671[_0x4705('0x16')][_0x4705('0x19')],function(_0x3bbc23){return{'model':db[_0x3bbc23['model']],'as':_0x3bbc23['as'],'attributes':_0x3bbc23[_0x4705('0x1a')],'include':_0x3bbc23['include']?_[_0x4705('0x18')](_0x3bbc23['include'],function(_0xbe6cc6){return{'model':db[_0xbe6cc6[_0x4705('0x1b')]],'as':_0xbe6cc6['as'],'attributes':_0xbe6cc6[_0x4705('0x1a')],'include':_0xbe6cc6[_0x4705('0x19')]?_[_0x4705('0x18')](_0xbe6cc6[_0x4705('0x19')],function(_0x48e24f){return{'model':db[_0x48e24f['model']],'as':_0x48e24f['as'],'attributes':_0x48e24f[_0x4705('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb6219d){logger[_0x4705('0xe')](_0x4705('0x1c'),_0x319671);logger[_0x4705('0x1d')](_0x4705('0x1c'),_0x319671,JSON[_0x4705('0x1e')](_0xb6219d));_0x10eda6(_0xb6219d);})[_0x4705('0x1f')](function(_0xeebe15){logger[_0x4705('0x12')]('GetTrigger',_0xeebe15[_0x4705('0x14')],_0x319671);_0xcab255(_0x4b7594[_0x4705('0x12')](0x1f4,_0xeebe15[_0x4705('0x14')]));});});};exports[_0x4705('0x20')]=function(_0x1c6377){var _0x1e50ff=this;return new Promise(function(_0x314b2e,_0x15308a){return db[_0x4705('0x21')][_0x4705('0x22')]({'raw':_0x1c6377[_0x4705('0x16')]?_0x1c6377['options'][_0x4705('0x17')]===undefined?!![]:![]:!![],'where':_0x1c6377['options']?_0x1c6377[_0x4705('0x16')][_0x4705('0x23')]||null:null,'attributes':_0x1c6377[_0x4705('0x16')]?_0x1c6377[_0x4705('0x16')]['attributes']||null:null,'include':_0x1c6377['options']?_0x1c6377['options'][_0x4705('0x19')]?_[_0x4705('0x18')](_0x1c6377[_0x4705('0x16')]['include'],function(_0x5ccfba){return{'model':db[_0x5ccfba[_0x4705('0x1b')]],'as':_0x5ccfba['as'],'attributes':_0x5ccfba[_0x4705('0x1a')],'include':_0x5ccfba[_0x4705('0x19')]?_[_0x4705('0x18')](_0x5ccfba[_0x4705('0x19')],function(_0x10e2b8){return{'model':db[_0x10e2b8['model']],'as':_0x10e2b8['as'],'attributes':_0x10e2b8['attributes'],'include':_0x10e2b8[_0x4705('0x19')]?_[_0x4705('0x18')](_0x10e2b8[_0x4705('0x19')],function(_0x4d77f2){return{'model':db[_0x4d77f2[_0x4705('0x1b')]],'as':_0x4d77f2['as'],'attributes':_0x4d77f2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a4d70){logger[_0x4705('0xe')]('ShowTrigger',_0x1c6377);logger[_0x4705('0x1d')](_0x4705('0x20'),_0x1c6377,JSON[_0x4705('0x1e')](_0x5a4d70));_0x314b2e(_0x5a4d70);})['catch'](function(_0x3db76d){logger[_0x4705('0x12')]('ShowTrigger',_0x3db76d[_0x4705('0x14')],_0x1c6377);_0x15308a(_0x1e50ff['error'](0x1f4,_0x3db76d[_0x4705('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0114dce..8e821f4 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 _0xc2a3=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x353b00,_0x43e1a6){var _0x351555=function(_0x15e27e){while(--_0x15e27e){_0x353b00['push'](_0x353b00['shift']());}};_0x351555(++_0x43e1a6);}(_0xc2a3,0x1c7));var _0x3c2a=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc2a3[_0x55e08b];return _0xd1a7ff;};'use strict';var multer=require('multer');var util=require(_0x3c2a('0x0'));var path=require(_0x3c2a('0x1'));var timeout=require(_0x3c2a('0x2'));var express=require(_0x3c2a('0x3'));var router=express[_0x3c2a('0x4')]();var fs_extra=require(_0x3c2a('0x5'));var auth=require(_0x3c2a('0x6'));var interaction=require(_0x3c2a('0x7'));var config=require(_0x3c2a('0x8'));var controller=require(_0x3c2a('0x9'));router[_0x3c2a('0xa')]('/',auth[_0x3c2a('0xb')](),controller[_0x3c2a('0xc')]);router[_0x3c2a('0xa')](_0x3c2a('0xd'),auth[_0x3c2a('0xb')](),controller[_0x3c2a('0xe')]);router['post'](_0x3c2a('0xf'),auth[_0x3c2a('0xb')](),controller['clone']);router[_0x3c2a('0x10')]('/',auth[_0x3c2a('0xb')](),controller[_0x3c2a('0x11')]);router[_0x3c2a('0x12')](_0x3c2a('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x3c2a('0x13')](_0x3c2a('0xd'),auth[_0x3c2a('0xb')](),controller[_0x3c2a('0x14')]);module[_0x3c2a('0x15')]=router; \ No newline at end of file +var _0xf330=['../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','post','/:id/clone','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x324010,_0x23670f){var _0x11cc09=function(_0x313177){while(--_0x313177){_0x324010['push'](_0x324010['shift']());}};_0x11cc09(++_0x23670f);}(_0xf330,0xa9));var _0x0f33=function(_0x1fa4ea,_0x592ea0){_0x1fa4ea=_0x1fa4ea-0x0;var _0x21d671=_0xf330[_0x1fa4ea];return _0x21d671;};'use strict';var multer=require(_0x0f33('0x0'));var util=require(_0x0f33('0x1'));var path=require('path');var timeout=require(_0x0f33('0x2'));var express=require(_0x0f33('0x3'));var router=express[_0x0f33('0x4')]();var fs_extra=require(_0x0f33('0x5'));var auth=require(_0x0f33('0x6'));var interaction=require(_0x0f33('0x7'));var config=require(_0x0f33('0x8'));var controller=require(_0x0f33('0x9'));router['get']('/',auth[_0x0f33('0xa')](),controller[_0x0f33('0xb')]);router[_0x0f33('0xc')](_0x0f33('0xd'),auth[_0x0f33('0xa')](),controller[_0x0f33('0xe')]);router[_0x0f33('0xf')](_0x0f33('0x10'),auth[_0x0f33('0xa')](),controller['clone']);router[_0x0f33('0xf')]('/',auth[_0x0f33('0xa')](),controller[_0x0f33('0x11')]);router[_0x0f33('0x12')](_0x0f33('0xd'),auth[_0x0f33('0xa')](),controller[_0x0f33('0x13')]);router['delete'](_0x0f33('0xd'),auth[_0x0f33('0xa')](),controller[_0x0f33('0x14')]);module[_0x0f33('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ea8c33a..bd8afe9 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 _0xbc26=['transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','inband','auto','rfc2833','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','user','peer','friend','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue'];(function(_0x48c060,_0x4d6335){var _0x397915=function(_0x4e9265){while(--_0x4e9265){_0x48c060['push'](_0x48c060['shift']());}};_0x397915(++_0x4d6335);}(_0xbc26,0x8d));var _0x6bc2=function(_0x3fe1c4,_0x3fe21c){_0x3fe1c4=_0x3fe1c4-0x0;var _0x1ede52=_0xbc26[_0x3fe1c4];return _0x1ede52;};'use strict';var Sequelize=require('sequelize');module[_0x6bc2('0x0')]={'name':{'type':Sequelize[_0x6bc2('0x1')],'allowNull':![],'unique':_0x6bc2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x6bc2('0x3'),_0x6bc2('0x4')),'allowNull':![],'defaultValue':_0x6bc2('0x5')},'context':{'type':Sequelize[_0x6bc2('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x7'),_0x6bc2('0x8'),_0x6bc2('0x9'),'ALLOWED',_0x6bc2('0xa'),_0x6bc2('0xb'),'PROHIB_FAILED_SCREEN',_0x6bc2('0xc'))},'deny':{'type':Sequelize[_0x6bc2('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x6bc2('0x1')]},'md5secret':{'type':Sequelize[_0x6bc2('0x1')]},'remotesecret':{'type':Sequelize[_0x6bc2('0x1')]},'transport':{'type':Sequelize[_0x6bc2('0x1')],'defaultValue':_0x6bc2('0xd'),'set':function(_0x14f116){this[_0x6bc2('0xe')](_0x6bc2('0xf'),_0x14f116?_0x14f116[_0x6bc2('0x10')](','):null);},'get':function(){return this[_0x6bc2('0x11')](_0x6bc2('0xf'))?this[_0x6bc2('0x11')](_0x6bc2('0xf'))[_0x6bc2('0x12')](','):null;},'comment':_0x6bc2('0x13')},'dtmfmode':{'type':Sequelize[_0x6bc2('0x6')]('rfc2833','info','shortinfo',_0x6bc2('0x14'),_0x6bc2('0x15')),'defaultValue':_0x6bc2('0x16')},'directmedia':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no',_0x6bc2('0x18'),_0x6bc2('0x19'),_0x6bc2('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x6bc2('0x1')]},'nat':{'type':Sequelize[_0x6bc2('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x52cefd){this[_0x6bc2('0xe')](_0x6bc2('0x1b'),_0x52cefd?_0x52cefd[_0x6bc2('0x10')](','):null);},'get':function(){return this[_0x6bc2('0x11')](_0x6bc2('0x1b'))?this[_0x6bc2('0x11')]('nat')['split'](','):null;},'comment':_0x6bc2('0x1c')},'callgroup':{'type':Sequelize[_0x6bc2('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x6bc2('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6bc2('0x1')]},'language':{'type':Sequelize[_0x6bc2('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6bc2('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6bc2('0x1')],'defaultValue':_0x6bc2('0x1d')},'allow':{'type':Sequelize[_0x6bc2('0x1')],'allowNull':![],'defaultValue':_0x6bc2('0x1e'),'set':function(_0x185895){this[_0x6bc2('0xe')]('allow',_0x185895?_0x185895[_0x6bc2('0x10')](';'):_0x6bc2('0x1e'));},'get':function(){return this[_0x6bc2('0x11')](_0x6bc2('0x1f'))?this[_0x6bc2('0x11')](_0x6bc2('0x1f'))['split'](';'):null;},'comment':_0x6bc2('0x20')},'autoframing':{'type':Sequelize[_0x6bc2('0x6')]('yes','no')},'insecure':{'type':Sequelize[_0x6bc2('0x1')],'defaultValue':_0x6bc2('0x21'),'set':function(_0x5111df){this[_0x6bc2('0xe')](_0x6bc2('0x22'),_0x5111df?_0x5111df[_0x6bc2('0x10')](','):null);},'get':function(){return this[_0x6bc2('0x11')]('insecure')?this[_0x6bc2('0x11')](_0x6bc2('0x22'))[_0x6bc2('0x12')](','):null;},'comment':_0x6bc2('0x23')},'trustrpid':{'type':Sequelize[_0x6bc2('0x6')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no',_0x6bc2('0x24'))},'promiscredir':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x6bc2('0x6')]('yes','no')},'accountcode':{'type':Sequelize[_0x6bc2('0x25')](0xb)},'setvar':{'type':Sequelize[_0x6bc2('0x1')]},'callerid':{'type':Sequelize[_0x6bc2('0x1')],'defaultValue':_0x6bc2('0x26')},'amaflags':{'type':Sequelize[_0x6bc2('0x1')]},'callcounter':{'type':Sequelize[_0x6bc2('0x6')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x6bc2('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x6bc2('0x1')]},'template':{'type':Sequelize[_0x6bc2('0x1')]},'videosupport':{'type':Sequelize[_0x6bc2('0x6')]('yes','no',_0x6bc2('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6bc2('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6bc2('0x17'),'no')},'mailbox':{'type':Sequelize[_0x6bc2('0x1')]},'session_timers':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x28'),_0x6bc2('0x29'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x6bc2('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x2a'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x6bc2('0x1')]},'regexten':{'type':Sequelize[_0x6bc2('0x1')]},'fromdomain':{'type':Sequelize[_0x6bc2('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6bc2('0x25')](0x5)},'qualify':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no'),'defaultValue':_0x6bc2('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x6bc2('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x6bc2('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6bc2('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no',_0x6bc2('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6bc2('0x1')]},'callbackextension':{'type':Sequelize[_0x6bc2('0x1')]},'timert1':{'type':Sequelize[_0x6bc2('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x6bc2('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x6bc2('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x6bc2('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x6bc2('0x25')](0xb)},'encryption':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x6bc2('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x17'),'no',_0x6bc2('0x2c'),_0x6bc2('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x6bc2('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x6bc2('0x1')]},'dtlscafile':{'type':Sequelize[_0x6bc2('0x1')]},'dtlscapath':{'type':Sequelize[_0x6bc2('0x1')]},'dtlssetup':{'type':Sequelize[_0x6bc2('0x6')](_0x6bc2('0x2e'),_0x6bc2('0x2f'),_0x6bc2('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6bc2('0x1')]},'usereqphone':{'type':Sequelize[_0x6bc2('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6bc2('0x1')]},'recordofffeature':{'type':Sequelize[_0x6bc2('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x6bc2('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x6bc2('0x1')]},'mohsuggest':{'type':Sequelize[_0x6bc2('0x1')]},'parkinglot':{'type':Sequelize[_0x6bc2('0x1')]},'description':{'type':Sequelize[_0x6bc2('0x1')]},'host':{'type':Sequelize[_0x6bc2('0x1')],'defaultValue':_0x6bc2('0x31')},'canreinvite':{'type':Sequelize[_0x6bc2('0x6')]('yes','no',_0x6bc2('0x18'),_0x6bc2('0x19'),_0x6bc2('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6bc2('0x1')]},'otherFields':{'type':Sequelize[_0x6bc2('0x1')]},'active':{'type':Sequelize[_0x6bc2('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6bc2('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x96ac=['ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','join','transport','getDataValue','split','rfc2833','info','shortinfo','inband','auto','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','actpass','update','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0xfb65aa,_0x1651a6){var _0x2aee31=function(_0x492245){while(--_0x492245){_0xfb65aa['push'](_0xfb65aa['shift']());}};_0x2aee31(++_0x1651a6);}(_0x96ac,0xc2));var _0xc96a=function(_0x16dc44,_0x3d3edd){_0x16dc44=_0x16dc44-0x0;var _0x3a60da=_0x96ac[_0x16dc44];return _0x3a60da;};'use strict';var Sequelize=require(_0xc96a('0x0'));module[_0xc96a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc96a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x4'),_0xc96a('0x5'),_0xc96a('0x6')),'allowNull':![],'defaultValue':_0xc96a('0x4')},'context':{'type':Sequelize[_0xc96a('0x7')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x8'),_0xc96a('0x9'),_0xc96a('0xa'),_0xc96a('0xb'),_0xc96a('0xc'),_0xc96a('0xd'),'PROHIB_FAILED_SCREEN',_0xc96a('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xc96a('0x7')]},'secret':{'type':Sequelize[_0xc96a('0x7')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xc96a('0x7')],'defaultValue':'udp','set':function(_0x2de326){this[_0xc96a('0xf')]('transport',_0x2de326?_0x2de326[_0xc96a('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xc96a('0x11'))?this[_0xc96a('0x12')]('transport')[_0xc96a('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x14'),_0xc96a('0x15'),_0xc96a('0x16'),_0xc96a('0x17'),_0xc96a('0x18')),'defaultValue':_0xc96a('0x14')},'directmedia':{'type':Sequelize[_0xc96a('0x3')]('yes','no','nonat','update',_0xc96a('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc96a('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc96a('0x7')]},'directmediadeny':{'type':Sequelize[_0xc96a('0x7')]},'nat':{'type':Sequelize[_0xc96a('0x7')],'defaultValue':_0xc96a('0x1a'),'set':function(_0x5b2506){this[_0xc96a('0xf')]('nat',_0x5b2506?_0x5b2506['join'](','):null);},'get':function(){return this[_0xc96a('0x12')]('nat')?this[_0xc96a('0x12')](_0xc96a('0x1b'))['split'](','):null;},'comment':_0xc96a('0x1c')},'callgroup':{'type':Sequelize[_0xc96a('0x7')]},'namedcallgroup':{'type':Sequelize[_0xc96a('0x7')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc96a('0x7')]},'language':{'type':Sequelize[_0xc96a('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc96a('0x7')],'defaultValue':_0xc96a('0x1d')},'allow':{'type':Sequelize[_0xc96a('0x7')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x244151){this[_0xc96a('0xf')]('allow',_0x244151?_0x244151[_0xc96a('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xc96a('0x12')](_0xc96a('0x1e'))?this[_0xc96a('0x12')]('allow')[_0xc96a('0x13')](';'):null;},'comment':_0xc96a('0x1f')},'autoframing':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xc96a('0x21'),'set':function(_0x383bea){this[_0xc96a('0xf')](_0xc96a('0x22'),_0x383bea?_0x383bea['join'](','):null);},'get':function(){return this['getDataValue'](_0xc96a('0x22'))?this[_0xc96a('0x12')](_0xc96a('0x22'))['split'](','):null;},'comment':_0xc96a('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0xc96a('0x20'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xc96a('0x20'),'no',_0xc96a('0x24'))},'promiscredir':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'useclientcode':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'accountcode':{'type':Sequelize[_0xc96a('0x25')](0xb)},'setvar':{'type':Sequelize[_0xc96a('0x7')]},'callerid':{'type':Sequelize[_0xc96a('0x7')],'defaultValue':_0xc96a('0x26')},'amaflags':{'type':Sequelize[_0xc96a('0x7')]},'callcounter':{'type':Sequelize[_0xc96a('0x3')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc96a('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'ignoresdpversion':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'subscribecontext':{'type':Sequelize[_0xc96a('0x7')]},'template':{'type':Sequelize[_0xc96a('0x7')]},'videosupport':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no',_0xc96a('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc96a('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0xc96a('0x7')]},'session_timers':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x28'),_0xc96a('0x29'),_0xc96a('0x2a'))},'session_expires':{'type':Sequelize[_0xc96a('0x25')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc96a('0x3')]('uac',_0xc96a('0x2b')),'defaultValue':_0xc96a('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xc96a('0x7')]},'regexten':{'type':Sequelize[_0xc96a('0x7')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xc96a('0x3')]('yes','no'),'defaultValue':_0xc96a('0x20')},'keepalive':{'type':Sequelize[_0xc96a('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xc96a('0x7')]},'defaultuser':{'type':Sequelize[_0xc96a('0x7')]},'rtptimeout':{'type':Sequelize[_0xc96a('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc96a('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no',_0xc96a('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc96a('0x7')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xc96a('0x25')](0xb)},'timerb':{'type':Sequelize[_0xc96a('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc96a('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xc96a('0x7')]},'contactdeny':{'type':Sequelize[_0xc96a('0x7')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xc96a('0x7')]},'use_q850_reason':{'type':Sequelize[_0xc96a('0x7')]},'maxforwards':{'type':Sequelize[_0xc96a('0x25')](0xb)},'encryption':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'force_avp':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'icesupport':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'dtlsenable':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'dtlsverify':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no',_0xc96a('0x2d'),_0xc96a('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xc96a('0x7')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xc96a('0x7')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x2f'),'passive',_0xc96a('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc96a('0x7')]},'usereqphone':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc96a('0x7')]},'recordofffeature':{'type':Sequelize[_0xc96a('0x7')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc96a('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xc96a('0x3')](_0xc96a('0x20'),'no')},'vmexten':{'type':Sequelize[_0xc96a('0x7')]},'mohinterpret':{'type':Sequelize[_0xc96a('0x7')]},'mohsuggest':{'type':Sequelize[_0xc96a('0x7')]},'parkinglot':{'type':Sequelize[_0xc96a('0x7')]},'description':{'type':Sequelize[_0xc96a('0x7')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xc96a('0x3')]('yes','no','nonat',_0xc96a('0x31'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc96a('0x7')]},'otherFields':{'type':Sequelize[_0xc96a('0x7')]},'active':{'type':Sequelize[_0xc96a('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 4dcc718..3384ec2 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 _0x008c=['update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Trunk','findAll','show','params','includeAll','include','options','clone','find','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','server/files/templates/trunk.ejs','join','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x101842,_0x4db31b){var _0x45ce04=function(_0x1754a3){while(--_0x1754a3){_0x101842['push'](_0x101842['shift']());}};_0x45ce04(++_0x4db31b);}(_0x008c,0x188));var _0xc008=function(_0xa4b8e1,_0x49d30b){_0xa4b8e1=_0xa4b8e1-0x0;var _0x507e42=_0x008c[_0xa4b8e1];return _0x507e42;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];var jayson=require(_0xc008('0x18'));var client=jayson[_0xc008('0x19')][_0xc008('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x593f7a,_0x560e28,_0x33f44c,_0x50c1ab){return new BPromise(function(_0x25e13f,_0x4584e1){var _0x2073ef=_0x50c1ab||client;return _0x2073ef[_0xc008('0x1b')](_0x593f7a,_0x33f44c)[_0xc008('0x1c')](function(_0x5ee00b){logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));logger[_0xc008('0x1e')](_0xc008('0x1f'),_0x560e28,_0xc008('0x1d'),JSON['stringify'](_0x5ee00b));if(_0x5ee00b['error']){if(_0x5ee00b['error']['code']===0x1f4){logger[_0xc008('0x20')](_0xc008('0x21'),_0x560e28,_0x5ee00b['error'][_0xc008('0x22')]);return _0x4584e1(_0x5ee00b['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x560e28,_0x5ee00b[_0xc008('0x20')]['message']);return _0x25e13f(_0x5ee00b['error']['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));_0x25e13f(_0x5ee00b[_0xc008('0x23')][_0xc008('0x22')]);}})[_0xc008('0x24')](function(_0x11cc75){logger[_0xc008('0x20')]('Trunk,\x20%s,\x20%s',_0x560e28,_0x11cc75);_0x4584e1(_0x11cc75);});});}function respondWithStatusCode(_0x459fd9,_0x5c85f2){_0x5c85f2=_0x5c85f2||0xcc;return function(_0x58a6ea){if(_0x58a6ea){return _0x459fd9[_0xc008('0x25')](_0x5c85f2);}return _0x459fd9[_0xc008('0x26')](_0x5c85f2)[_0xc008('0x27')]();};}function respondWithResult(_0x3cb28c,_0x5410f5){_0x5410f5=_0x5410f5||0xc8;return function(_0x48582b){if(_0x48582b){return _0x3cb28c['status'](_0x5410f5)[_0xc008('0x28')](_0x48582b);}};}function respondWithFilteredResult(_0x15dade,_0x92c582){return function(_0x2e31c2){if(_0x2e31c2){var _0x5bebd9=typeof _0x92c582['offset']==='undefined'&&typeof _0x92c582['limit']==='undefined';var _0x3865c0=_0x2e31c2[_0xc008('0x29')];var _0x25eae4=_0x5bebd9?0x0:_0x92c582['offset'];var _0x24c14c=_0x5bebd9?_0x2e31c2[_0xc008('0x29')]:_0x92c582[_0xc008('0x2a')]+_0x92c582[_0xc008('0x2b')];var _0x4c5dec;if(_0x24c14c>=_0x3865c0){_0x24c14c=_0x3865c0;_0x4c5dec=0xc8;}else{_0x4c5dec=0xce;}_0x15dade[_0xc008('0x26')](_0x4c5dec);return _0x15dade[_0xc008('0x2c')]('Content-Range',_0x25eae4+'-'+_0x24c14c+'/'+_0x3865c0)['json'](_0x2e31c2);}return null;};}function patchUpdates(_0x539766){return function(_0x1032b2){try{jsonpatch[_0xc008('0x2d')](_0x1032b2,_0x539766,!![]);}catch(_0xf831f2){return BPromise[_0xc008('0x2e')](_0xf831f2);}return _0x1032b2[_0xc008('0x2f')]();};}function saveUpdates(_0xceebc3,_0x294f97){return function(_0x22d8e8){if(_0x22d8e8){return _0x22d8e8[_0xc008('0x30')](_0xceebc3)[_0xc008('0x1c')](function(_0x2f4b6b){return _0x2f4b6b;});}return null;};}function removeEntity(_0x1ac7c8,_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x31')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x32')]({'plain':!![]});var _0x383be7=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x31')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x1c')](function(){return _0x334a09;});})[_0xc008('0x1c')](function(){_0x1ac7c8[_0xc008('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87,_0x389a40){return function(_0x459df4){if(!_0x459df4){_0x415b87[_0xc008('0x25')](0x194);}return _0x459df4;};}function handleError(_0x40002f,_0x315562){_0x315562=_0x315562||0x1f4;return function(_0x1667a0){logger['error'](_0x1667a0[_0xc008('0x35')]);if(_0x1667a0[_0xc008('0x36')]){delete _0x1667a0['name'];}_0x40002f[_0xc008('0x26')](_0x315562)[_0xc008('0x37')](_0x1667a0);};}exports['index']=function(_0x263473,_0x2e4ae1){var _0x280e9b={},_0x55ff48={},_0x53b353={'count':0x0,'rows':[]};var _0x478810=_[_0xc008('0x38')](db['Trunk'][_0xc008('0x39')],function(_0x3884dd){return{'name':_0x3884dd[_0xc008('0x3a')],'type':_0x3884dd[_0xc008('0x3b')][_0xc008('0x3c')]};});_0x55ff48[_0xc008('0x3d')]=_[_0xc008('0x38')](_0x478810,_0xc008('0x36'));_0x55ff48[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x263473[_0xc008('0x3e')]);_0x55ff48[_0xc008('0x40')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],_0x55ff48['query']);_0x280e9b[_0xc008('0x42')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x263473['query'][_0xc008('0x43')]));_0x280e9b[_0xc008('0x42')]=_0x280e9b[_0xc008('0x42')][_0xc008('0x44')]?_0x280e9b[_0xc008('0x42')]:_0x55ff48['model'];if(!_0x263473[_0xc008('0x3e')][_0xc008('0x45')](_0xc008('0x46'))){_0x280e9b[_0xc008('0x2b')]=qs[_0xc008('0x2b')](_0x263473['query'][_0xc008('0x2b')]);_0x280e9b[_0xc008('0x2a')]=qs[_0xc008('0x2a')](_0x263473[_0xc008('0x3e')]['offset']);}_0x280e9b[_0xc008('0x47')]=qs[_0xc008('0x48')](_0x263473[_0xc008('0x3e')]['sort']);_0x280e9b[_0xc008('0x49')]=qs['filters'](_[_0xc008('0x4a')](_0x263473['query'],_0x55ff48[_0xc008('0x40')]),_0x478810);if(_0x263473[_0xc008('0x3e')]['filter']){_0x280e9b[_0xc008('0x49')]=_[_0xc008('0x4b')](_0x280e9b[_0xc008('0x49')],{'$or':_['map'](_0x478810,function(_0x1cec64){if(_0x1cec64[_0xc008('0x3b')]!==_0xc008('0x4c')){var _0x44fc5d={};_0x44fc5d[_0x1cec64[_0xc008('0x36')]]={'$like':'%'+_0x263473[_0xc008('0x3e')]['filter']+'%'};return _0x44fc5d;}})});}_0x280e9b=_['merge']({},_0x280e9b,_0x263473['options']);var _0x4552ed={'where':_0x280e9b[_0xc008('0x49')]};return db[_0xc008('0x4d')][_0xc008('0x29')](_0x4552ed)[_0xc008('0x1c')](function(_0x24f6a4){_0x53b353[_0xc008('0x29')]=_0x24f6a4;if(_0x263473[_0xc008('0x3e')]['includeAll']){_0x280e9b['include']=[{'all':!![]}];}return db['Trunk'][_0xc008('0x4e')](_0x280e9b);})[_0xc008('0x1c')](function(_0x158eae){_0x53b353['rows']=_0x158eae;return _0x53b353;})[_0xc008('0x1c')](respondWithFilteredResult(_0x2e4ae1,_0x280e9b))[_0xc008('0x24')](handleError(_0x2e4ae1,null));};exports[_0xc008('0x4f')]=function(_0x1c2c50,_0x4981b4){var _0x56e4ac={'raw':![],'where':{'id':_0x1c2c50[_0xc008('0x50')]['id']}},_0x17ec90={};_0x17ec90[_0xc008('0x3d')]=_[_0xc008('0x3f')](db['Trunk']['rawAttributes']);_0x17ec90[_0xc008('0x3e')]=_['keys'](_0x1c2c50[_0xc008('0x3e')]);_0x17ec90[_0xc008('0x40')]=_[_0xc008('0x41')](_0x17ec90['model'],_0x17ec90[_0xc008('0x3e')]);_0x56e4ac[_0xc008('0x42')]=_[_0xc008('0x41')](_0x17ec90[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x1c2c50['query'][_0xc008('0x43')]));_0x56e4ac[_0xc008('0x42')]=_0x56e4ac['attributes'][_0xc008('0x44')]?_0x56e4ac[_0xc008('0x42')]:_0x17ec90['model'];if(_0x1c2c50['query'][_0xc008('0x51')]){_0x56e4ac[_0xc008('0x52')]=[{'all':!![]}];}_0x56e4ac=_[_0xc008('0x4b')]({},_0x56e4ac,_0x1c2c50[_0xc008('0x53')]);return db[_0xc008('0x4d')]['find'](_0x56e4ac)['then'](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1c')](respondWithResult(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports[_0xc008('0x54')]=function(_0x25d351,_0xf94fcb){var _0x2f1105={'where':{'id':_0x25d351[_0xc008('0x50')]['id']}},_0x44f42d={};_0x44f42d['model']=_[_0xc008('0x3f')](db[_0xc008('0x4d')][_0xc008('0x39')]);_0x2f1105[_0xc008('0x42')]=_[_0xc008('0x41')](_0x44f42d['model'],qs[_0xc008('0x43')](_0x25d351['query']['fields']));_0x2f1105['attributes']=_0x2f1105[_0xc008('0x42')][_0xc008('0x44')]?_0x2f1105[_0xc008('0x42')]:_0x44f42d['model'];if(_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]){_0x2f1105[_0xc008('0x52')]=[{'all':!![]}];}_0x2f1105=_['merge']({},_0x2f1105,_0x25d351[_0xc008('0x53')]);return db[_0xc008('0x4d')][_0xc008('0x55')](_0x2f1105)[_0xc008('0x1c')](handleEntityNotFound(_0xf94fcb,null))['then'](function(_0x4022dd){if(_0x4022dd){var _0x4eaa6d=_0x4022dd[_0xc008('0x32')]({'plain':!![]});_0x4eaa6d=qs[_0xc008('0x56')](_0x4eaa6d,['id',_0xc008('0x57'),_0xc008('0x58')]);_0x25d351[_0xc008('0x59')]=_[_0xc008('0x56')](_0x25d351['body'],['id',_0xc008('0x57'),'updatedAt']);return db['Trunk'][_0xc008('0x5a')](_[_0xc008('0x4b')](_0x4eaa6d,_0x25d351['body']),{'include':_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]?[{'all':!![]}]:undefined})[_0xc008('0x1c')](function(_0x4517c0){var _0x21ee6d=_0x25d351[_0xc008('0x5b')][_0xc008('0x32')]({'plain':!![]});if(!_0x21ee6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21ee6d[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x3bfb15=_0x4517c0[_0xc008('0x32')]({'plain':!![]});var _0xb3ca0f=_0xc008('0x33');return db[_0xc008('0x5d')][_0xc008('0x55')]({'where':{'name':_0xb3ca0f,'userProfileId':_0x21ee6d[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x1bef66){if(_0x1bef66&&_0x1bef66[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x3bfb15['name'],'resourceId':_0x3bfb15['id'],'type':_0x1bef66[_0xc008('0x36')],'sectionId':_0x1bef66['id']},{})[_0xc008('0x1c')](function(){return _0x4517c0;});}else{return _0x4517c0;}})[_0xc008('0x24')](function(_0x566dea){logger[_0xc008('0x20')](_0xc008('0x60'),_0x566dea);throw _0x566dea;});}return _0x4517c0;});}})['then'](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x5a')]=function(_0x2a4c2b,_0x7bad14,_0x39083c){var _0x1a2ce7;return db[_0xc008('0x4d')][_0xc008('0x5a')](_0x2a4c2b[_0xc008('0x59')],{'raw':!![]})[_0xc008('0x1c')](function(_0x1b059b){_0x1a2ce7=_0x1b059b;return db[_0xc008('0x4d')]['findAll']({'raw':!![]});})[_0xc008('0x1c')](function(_0x25a52b){var _0xfdb5e3=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],'server/files/templates/trunk.ejs'),_0xc008('0x63'));var _0x46fa7b=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x64')),_0xc008('0x63'));var _0x553f5c=ejs[_0xc008('0x65')](_0xfdb5e3,{'trunks':_0x25a52b||[]});fs['writeFileSync'](_0xc008('0x66'),_0x553f5c);if(_0x1a2ce7[_0xc008('0x67')]){var _0x23012c=ejs[_0xc008('0x65')](_0x46fa7b,{'trunks':_0x25a52b||[]});fs[_0xc008('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x23012c);}})[_0xc008('0x1c')](function(){return respondWithRpcPromise(_0xc008('0x69'),'create',{'module':_0xc008('0x6a')});})['then'](function(){var _0x278cbe=_0x2a4c2b['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x278cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x278cbe[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x33d8e4=_0x1a2ce7[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x55')]({'where':{'name':_0xc008('0x33'),'userProfileId':_0x278cbe[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x321500){if(_0x321500&&_0x321500[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x33d8e4['name'],'resourceId':_0x33d8e4['id'],'type':_0x321500[_0xc008('0x36')],'sectionId':_0x321500['id']},{})['then'](function(){return _0x1a2ce7;});}else{return _0x1a2ce7;}})['catch'](function(_0x4c84da){logger[_0xc008('0x20')](_0xc008('0x60'),_0x4c84da);throw _0x4c84da;});}return _0x1a2ce7;})[_0xc008('0x1c')](respondWithResult(_0x7bad14,0xc9))[_0xc008('0x24')](handleError(_0x7bad14,null));};exports[_0xc008('0x30')]=function(_0x2e9646,_0x23ef42,_0x519328){var _0x127bdf;return db['Trunk'][_0xc008('0x55')]({'where':{'id':_0x2e9646[_0xc008('0x50')]['id']}})[_0xc008('0x1c')](handleEntityNotFound(_0x23ef42,null))[_0xc008('0x1c')](saveUpdates(_0x2e9646[_0xc008('0x59')],null))[_0xc008('0x1c')](function(_0x23d4ff){if(_0x23d4ff){_0x127bdf=_0x23d4ff;return db[_0xc008('0x4d')][_0xc008('0x4e')]({'raw':!![]});}})[_0xc008('0x1c')](function(_0x334ed8){if(_0x334ed8){var _0x1dd9fe=fs['readFileSync'](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x572d93=fs[_0xc008('0x61')](path[_0xc008('0x6c')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x3fc44f=ejs[_0xc008('0x65')](_0x1dd9fe,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x66'),_0x3fc44f);var _0x1101b8=ejs[_0xc008('0x65')](_0x572d93,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x6d'),_0x1101b8);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xc644fe){if(_0xc644fe){return _0x127bdf;}})[_0xc008('0x1c')](respondWithResult(_0x23ef42,null))[_0xc008('0x24')](handleError(_0x23ef42,null));};exports[_0xc008('0x31')]=function(_0x2b94b2,_0x37fc2c,_0x4b434f){var _0x5794fe;return db[_0xc008('0x4d')][_0xc008('0x55')]({'where':{'id':_0x2b94b2[_0xc008('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc2c,null))['then'](removeEntity(_0x37fc2c,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x276de2){var _0x52bf60=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x5bc8b0=fs['readFileSync'](path[_0xc008('0x6c')](config['root'],_0xc008('0x64')),_0xc008('0x63'));var _0x544519=ejs[_0xc008('0x65')](_0x52bf60,{'trunks':_0x276de2});var _0x4db90b=ejs['render'](_0x5bc8b0,{'trunks':_0x276de2});fs[_0xc008('0x68')](_0xc008('0x66'),_0x544519);fs['writeFileSync'](_0xc008('0x6d'),_0x4db90b);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x31'),{'module':'chan_sip.so'});})[_0xc008('0x24')](handleError(_0x37fc2c,null));}; \ No newline at end of file +var _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4d6e3f,_0x48e790){var _0x2f7002=function(_0x28fdaa){while(--_0x28fdaa){_0x4d6e3f['push'](_0x4d6e3f['shift']());}};_0x2f7002(++_0x48e790);}(_0x24ca,0x1bc));var _0xa24c=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x24ca[_0x33c9f8];return _0x2d7004;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index a6588cf..10fbf6e 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 _0x6991=['Trunk','tools_trunks','util','api','moment','bluebird','request-promise','../../config/environment','./trunk.attributes','exports'];(function(_0x334829,_0x3dd523){var _0x37d036=function(_0x626265){while(--_0x626265){_0x334829['push'](_0x334829['shift']());}};_0x37d036(++_0x3dd523);}(_0x6991,0xb6));var _0x1699=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x6991[_0x387777];return _0x3f84c0;};'use strict';var _=require('lodash');var util=require(_0x1699('0x0'));var logger=require('../../config/logger')(_0x1699('0x1'));var moment=require(_0x1699('0x2'));var BPromise=require(_0x1699('0x3'));var rp=require(_0x1699('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1699('0x5'));var attributes=require(_0x1699('0x6'));module[_0x1699('0x7')]=function(_0x594524,_0x4a7041){return _0x594524['define'](_0x1699('0x8'),attributes,{'tableName':_0x1699('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6df8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','api'];(function(_0x18fe74,_0x4e6b5d){var _0xdf7bbc=function(_0x474ad1){while(--_0x474ad1){_0x18fe74['push'](_0x18fe74['shift']());}};_0xdf7bbc(++_0x4e6b5d);}(_0x6df8,0x10e));var _0x86df=function(_0x5c1c0f,_0x72c16){_0x5c1c0f=_0x5c1c0f-0x0;var _0x23a98c=_0x6df8[_0x5c1c0f];return _0x23a98c;};'use strict';var _=require(_0x86df('0x0'));var util=require('util');var logger=require(_0x86df('0x1'))(_0x86df('0x2'));var moment=require(_0x86df('0x3'));var BPromise=require(_0x86df('0x4'));var rp=require(_0x86df('0x5'));var fs=require('fs');var path=require(_0x86df('0x6'));var rimraf=require(_0x86df('0x7'));var config=require(_0x86df('0x8'));var attributes=require(_0x86df('0x9'));module[_0x86df('0xa')]=function(_0x19b2bf,_0x38d1dc){return _0x19b2bf['define'](_0x86df('0xb'),attributes,{'tableName':_0x86df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 71534cb..3018320 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 _0x189f=['raw','where','attributes','limit','map','include','model','then','GetTrunk','debug','ShowTrunk','Trunk','lodash','util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','findAll','options'];(function(_0x256522,_0x5785d8){var _0xa65029=function(_0x30a9d0){while(--_0x30a9d0){_0x256522['push'](_0x256522['shift']());}};_0xa65029(++_0x5785d8);}(_0x189f,0x1ec));var _0xf189=function(_0x236487,_0x39046f){_0x236487=_0x236487-0x0;var _0x1c64cc=_0x189f[_0x236487];return _0x1c64cc;};'use strict';var _=require(_0xf189('0x0'));var util=require(_0xf189('0x1'));var moment=require(_0xf189('0x2'));var BPromise=require(_0xf189('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf189('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf189('0x5'));var jayson=require(_0xf189('0x6'));var client=jayson[_0xf189('0x7')][_0xf189('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b58ac,_0x132113,_0x48efc8){return new BPromise(function(_0x5cee35,_0x204c2e){return client[_0xf189('0x9')](_0x2b58ac,_0x48efc8)['then'](function(_0x263668){logger[_0xf189('0xa')](_0xf189('0xb'),_0x132113,_0xf189('0xc'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x132113,_0xf189('0xc'),JSON[_0xf189('0xd')](_0x263668));if(_0x263668[_0xf189('0xe')]){if(_0x263668[_0xf189('0xe')]['code']===0x1f4){logger[_0xf189('0xe')](_0xf189('0xb'),_0x132113,_0x263668[_0xf189('0xe')][_0xf189('0xf')]);return _0x204c2e(_0x263668[_0xf189('0xe')][_0xf189('0xf')]);}logger[_0xf189('0xe')](_0xf189('0xb'),_0x132113,_0x263668['error']['message']);return _0x5cee35(_0x263668['error'][_0xf189('0xf')]);}else{logger['info'](_0xf189('0xb'),_0x132113,_0xf189('0xc'));_0x5cee35(_0x263668[_0xf189('0x10')][_0xf189('0xf')]);}})[_0xf189('0x11')](function(_0x495c58){logger[_0xf189('0xe')]('Trunk,\x20%s,\x20%s',_0x132113,_0x495c58);_0x204c2e(_0x495c58);});});}exports['GetTrunk']=function(_0x551f1f){var _0x49707a=this;return new Promise(function(_0x276ec7,_0x347632){return db['Trunk'][_0xf189('0x12')]({'raw':_0x551f1f['options']?_0x551f1f[_0xf189('0x13')][_0xf189('0x14')]===undefined?!![]:![]:!![],'where':_0x551f1f[_0xf189('0x13')]?_0x551f1f['options'][_0xf189('0x15')]||null:null,'attributes':_0x551f1f[_0xf189('0x13')]?_0x551f1f[_0xf189('0x13')][_0xf189('0x16')]||null:null,'limit':_0x551f1f[_0xf189('0x13')]?_0x551f1f[_0xf189('0x13')][_0xf189('0x17')]||null:null,'include':_0x551f1f[_0xf189('0x13')]?_0x551f1f[_0xf189('0x13')]['include']?_[_0xf189('0x18')](_0x551f1f['options'][_0xf189('0x19')],function(_0x36736d){return{'model':db[_0x36736d[_0xf189('0x1a')]],'as':_0x36736d['as'],'attributes':_0x36736d[_0xf189('0x16')],'include':_0x36736d['include']?_[_0xf189('0x18')](_0x36736d[_0xf189('0x19')],function(_0x49b659){return{'model':db[_0x49b659[_0xf189('0x1a')]],'as':_0x49b659['as'],'attributes':_0x49b659[_0xf189('0x16')],'include':_0x49b659[_0xf189('0x19')]?_[_0xf189('0x18')](_0x49b659[_0xf189('0x19')],function(_0x3a0011){return{'model':db[_0x3a0011[_0xf189('0x1a')]],'as':_0x3a0011['as'],'attributes':_0x3a0011['attributes']};}):[]};}):[]};}):[]:[]})[_0xf189('0x1b')](function(_0x303e0d){logger['info'](_0xf189('0x1c'),_0x551f1f);logger[_0xf189('0x1d')](_0xf189('0x1c'),_0x551f1f,JSON[_0xf189('0xd')](_0x303e0d));_0x276ec7(_0x303e0d);})[_0xf189('0x11')](function(_0x3407eb){logger[_0xf189('0xe')](_0xf189('0x1c'),_0x3407eb['message'],_0x551f1f);_0x347632(_0x49707a['error'](0x1f4,_0x3407eb[_0xf189('0xf')]));});});};exports[_0xf189('0x1e')]=function(_0x166c01){var _0x285b27=this;return new Promise(function(_0x8d51fb,_0x2b3c91){return db[_0xf189('0x1f')]['find']({'raw':_0x166c01[_0xf189('0x13')]?_0x166c01[_0xf189('0x13')][_0xf189('0x14')]===undefined?!![]:![]:!![],'where':_0x166c01['options']?_0x166c01[_0xf189('0x13')]['where']||null:null,'attributes':_0x166c01[_0xf189('0x13')]?_0x166c01['options']['attributes']||null:null,'include':_0x166c01[_0xf189('0x13')]?_0x166c01['options'][_0xf189('0x19')]?_[_0xf189('0x18')](_0x166c01['options']['include'],function(_0x400077){return{'model':db[_0x400077[_0xf189('0x1a')]],'as':_0x400077['as'],'attributes':_0x400077[_0xf189('0x16')],'include':_0x400077[_0xf189('0x19')]?_[_0xf189('0x18')](_0x400077[_0xf189('0x19')],function(_0x19fb89){return{'model':db[_0x19fb89['model']],'as':_0x19fb89['as'],'attributes':_0x19fb89['attributes'],'include':_0x19fb89[_0xf189('0x19')]?_['map'](_0x19fb89[_0xf189('0x19')],function(_0x44c7cd){return{'model':db[_0x44c7cd[_0xf189('0x1a')]],'as':_0x44c7cd['as'],'attributes':_0x44c7cd[_0xf189('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x147a19){logger['info'](_0xf189('0x1e'),_0x166c01);logger['debug']('ShowTrunk',_0x166c01,JSON[_0xf189('0xd')](_0x147a19));_0x8d51fb(_0x147a19);})[_0xf189('0x11')](function(_0x57d24e){logger['error']('ShowTrunk',_0x57d24e['message'],_0x166c01);_0x2b3c91(_0x285b27[_0xf189('0xe')](0x1f4,_0x57d24e[_0xf189('0xf')]));});});}; \ No newline at end of file +var _0xb2c9=['options','raw','where','attributes','limit','include','model','map','info','find','ShowTrunk','debug','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll'];(function(_0x8e4e8,_0x158fc4){var _0x21fa1b=function(_0x56eb9c){while(--_0x56eb9c){_0x8e4e8['push'](_0x8e4e8['shift']());}};_0x21fa1b(++_0x158fc4);}(_0xb2c9,0xde));var _0x9b2c=function(_0x4389d6,_0x58768d){_0x4389d6=_0x4389d6-0x0;var _0x3f279b=_0xb2c9[_0x4389d6];return _0x3f279b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9b2c('0x0'));var BPromise=require(_0x9b2c('0x1'));var rs=require(_0x9b2c('0x2'));var fs=require('fs');var Redis=require(_0x9b2c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b2c('0x4'));var logger=require('../../config/logger')(_0x9b2c('0x5'));var config=require(_0x9b2c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9b2c('0x7')][_0x9b2c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ec288,_0x38cbc2,_0x12b07b){return new BPromise(function(_0x4eb31f,_0x30d6c1){return client[_0x9b2c('0x9')](_0x3ec288,_0x12b07b)[_0x9b2c('0xa')](function(_0x12c83c){logger['info'](_0x9b2c('0xb'),_0x38cbc2,_0x9b2c('0xc'));logger['debug'](_0x9b2c('0xd'),_0x38cbc2,'request\x20sent',JSON[_0x9b2c('0xe')](_0x12c83c));if(_0x12c83c[_0x9b2c('0xf')]){if(_0x12c83c[_0x9b2c('0xf')][_0x9b2c('0x10')]===0x1f4){logger[_0x9b2c('0xf')](_0x9b2c('0xb'),_0x38cbc2,_0x12c83c[_0x9b2c('0xf')][_0x9b2c('0x11')]);return _0x30d6c1(_0x12c83c[_0x9b2c('0xf')][_0x9b2c('0x11')]);}logger[_0x9b2c('0xf')](_0x9b2c('0xb'),_0x38cbc2,_0x12c83c[_0x9b2c('0xf')]['message']);return _0x4eb31f(_0x12c83c[_0x9b2c('0xf')]['message']);}else{logger['info'](_0x9b2c('0xb'),_0x38cbc2,_0x9b2c('0xc'));_0x4eb31f(_0x12c83c[_0x9b2c('0x12')][_0x9b2c('0x11')]);}})[_0x9b2c('0x13')](function(_0x40b70e){logger['error'](_0x9b2c('0xb'),_0x38cbc2,_0x40b70e);_0x30d6c1(_0x40b70e);});});}exports[_0x9b2c('0x14')]=function(_0x1639eb){var _0x23c940=this;return new Promise(function(_0x35a9ca,_0x32cc78){return db[_0x9b2c('0x15')][_0x9b2c('0x16')]({'raw':_0x1639eb[_0x9b2c('0x17')]?_0x1639eb[_0x9b2c('0x17')][_0x9b2c('0x18')]===undefined?!![]:![]:!![],'where':_0x1639eb['options']?_0x1639eb['options'][_0x9b2c('0x19')]||null:null,'attributes':_0x1639eb['options']?_0x1639eb[_0x9b2c('0x17')][_0x9b2c('0x1a')]||null:null,'limit':_0x1639eb[_0x9b2c('0x17')]?_0x1639eb[_0x9b2c('0x17')][_0x9b2c('0x1b')]||null:null,'include':_0x1639eb[_0x9b2c('0x17')]?_0x1639eb[_0x9b2c('0x17')][_0x9b2c('0x1c')]?_['map'](_0x1639eb[_0x9b2c('0x17')][_0x9b2c('0x1c')],function(_0xe8fae1){return{'model':db[_0xe8fae1[_0x9b2c('0x1d')]],'as':_0xe8fae1['as'],'attributes':_0xe8fae1['attributes'],'include':_0xe8fae1[_0x9b2c('0x1c')]?_['map'](_0xe8fae1[_0x9b2c('0x1c')],function(_0x171122){return{'model':db[_0x171122[_0x9b2c('0x1d')]],'as':_0x171122['as'],'attributes':_0x171122[_0x9b2c('0x1a')],'include':_0x171122['include']?_[_0x9b2c('0x1e')](_0x171122[_0x9b2c('0x1c')],function(_0x41ac3e){return{'model':db[_0x41ac3e[_0x9b2c('0x1d')]],'as':_0x41ac3e['as'],'attributes':_0x41ac3e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b2c('0xa')](function(_0x119258){logger[_0x9b2c('0x1f')](_0x9b2c('0x14'),_0x1639eb);logger['debug'](_0x9b2c('0x14'),_0x1639eb,JSON['stringify'](_0x119258));_0x35a9ca(_0x119258);})[_0x9b2c('0x13')](function(_0x44b801){logger[_0x9b2c('0xf')]('GetTrunk',_0x44b801['message'],_0x1639eb);_0x32cc78(_0x23c940[_0x9b2c('0xf')](0x1f4,_0x44b801[_0x9b2c('0x11')]));});});};exports['ShowTrunk']=function(_0x1210f7){var _0x14cf72=this;return new Promise(function(_0x567c0d,_0x48450b){return db[_0x9b2c('0x15')][_0x9b2c('0x20')]({'raw':_0x1210f7['options']?_0x1210f7[_0x9b2c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1210f7[_0x9b2c('0x17')]?_0x1210f7[_0x9b2c('0x17')][_0x9b2c('0x19')]||null:null,'attributes':_0x1210f7[_0x9b2c('0x17')]?_0x1210f7[_0x9b2c('0x17')][_0x9b2c('0x1a')]||null:null,'include':_0x1210f7[_0x9b2c('0x17')]?_0x1210f7[_0x9b2c('0x17')][_0x9b2c('0x1c')]?_['map'](_0x1210f7[_0x9b2c('0x17')][_0x9b2c('0x1c')],function(_0x26019c){return{'model':db[_0x26019c[_0x9b2c('0x1d')]],'as':_0x26019c['as'],'attributes':_0x26019c[_0x9b2c('0x1a')],'include':_0x26019c[_0x9b2c('0x1c')]?_[_0x9b2c('0x1e')](_0x26019c['include'],function(_0x3f052a){return{'model':db[_0x3f052a[_0x9b2c('0x1d')]],'as':_0x3f052a['as'],'attributes':_0x3f052a['attributes'],'include':_0x3f052a[_0x9b2c('0x1c')]?_[_0x9b2c('0x1e')](_0x3f052a[_0x9b2c('0x1c')],function(_0x31542a){return{'model':db[_0x31542a['model']],'as':_0x31542a['as'],'attributes':_0x31542a[_0x9b2c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1227eb){logger[_0x9b2c('0x1f')](_0x9b2c('0x21'),_0x1210f7);logger[_0x9b2c('0x22')](_0x9b2c('0x21'),_0x1210f7,JSON[_0x9b2c('0xe')](_0x1227eb));_0x567c0d(_0x1227eb);})[_0x9b2c('0x13')](function(_0x256e70){logger[_0x9b2c('0xf')]('ShowTrunk',_0x256e70[_0x9b2c('0x11')],_0x1210f7);_0x48450b(_0x14cf72['error'](0x1f4,_0x256e70[_0x9b2c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index db3eabb..5663494 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 _0xdbc4=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','/:id/queues','addQueues','diskStorage','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addOpenchannelAccounts','addSmsAccounts','put','/:id','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdbc4,0x16f));var _0x4dbc=function(_0x19b2b8,_0x5e51d){_0x19b2b8=_0x19b2b8-0x0;var _0x14813b=_0xdbc4[_0x19b2b8];return _0x14813b;};'use strict';var multer=require(_0x4dbc('0x0'));var util=require(_0x4dbc('0x1'));var path=require(_0x4dbc('0x2'));var timeout=require(_0x4dbc('0x3'));var express=require(_0x4dbc('0x4'));var router=express[_0x4dbc('0x5')]();var fs_extra=require(_0x4dbc('0x6'));var auth=require(_0x4dbc('0x7'));var interaction=require(_0x4dbc('0x8'));var config=require(_0x4dbc('0x9'));var controller=require('./user.controller');router[_0x4dbc('0xa')]('/',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0xc')]);router[_0x4dbc('0xa')](_0x4dbc('0xd'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0xe')]);router[_0x4dbc('0xa')]('/whoami',auth[_0x4dbc('0xb')](),controller['whoami']);router[_0x4dbc('0xa')](_0x4dbc('0xf'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x10')]);router['get']('/:id',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x11')]);router[_0x4dbc('0xa')](_0x4dbc('0x12'),controller[_0x4dbc('0x13')]);router[_0x4dbc('0xa')](_0x4dbc('0x14'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x15')]);router[_0x4dbc('0xa')]('/:id/contacts',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x16')]);router[_0x4dbc('0xa')]('/:id/queues',auth[_0x4dbc('0xb')](),controller['getQueues']);router['get']('/:id/queues_rt',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x17')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router[_0x4dbc('0xa')](_0x4dbc('0x18'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x19')]);router[_0x4dbc('0xa')](_0x4dbc('0x1a'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x1b')]);router[_0x4dbc('0xa')](_0x4dbc('0x1c'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x1d')]);router[_0x4dbc('0xa')](_0x4dbc('0x1e'),auth['isAuthenticated'](),controller[_0x4dbc('0x1f')]);router['get'](_0x4dbc('0x20'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x21')]);router[_0x4dbc('0xa')](_0x4dbc('0x22'),auth[_0x4dbc('0xb')](),controller['getSmsInteractions']);router[_0x4dbc('0xa')]('/:id/fax/interactions',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x23')]);router[_0x4dbc('0xa')](_0x4dbc('0x24'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x25')]);router[_0x4dbc('0xa')]('/:id/teams',auth[_0x4dbc('0xb')](),controller['getTeams']);router[_0x4dbc('0xa')](_0x4dbc('0x26'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x27')]);router[_0x4dbc('0xa')](_0x4dbc('0x28'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x29')]);router[_0x4dbc('0xa')](_0x4dbc('0x2a'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x2b')]);router[_0x4dbc('0xa')](_0x4dbc('0x2c'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x2d')]);router[_0x4dbc('0xa')]('/:id/mail_accounts',auth[_0x4dbc('0xb')](),controller['getMailAccounts']);router['get'](_0x4dbc('0x2e'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x2f')]);router[_0x4dbc('0xa')](_0x4dbc('0x30'),auth['isAuthenticated'](),controller[_0x4dbc('0x31')]);router['get']('/:id/chat_websites',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x32')]);router[_0x4dbc('0xa')](_0x4dbc('0x33'),auth['isAuthenticated'](),controller[_0x4dbc('0x34')]);router[_0x4dbc('0xa')](_0x4dbc('0x35'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x36')]);router['get'](_0x4dbc('0x37'),auth['isAuthenticated'](),controller[_0x4dbc('0x38')]);router['get'](_0x4dbc('0x39'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x3a')]);router[_0x4dbc('0x3b')]('/:id/contacts',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x3c')]);router[_0x4dbc('0x3b')]('/',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x3d')]);router[_0x4dbc('0x3b')]('/create_many',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x3e')]);router[_0x4dbc('0x3b')](_0x4dbc('0x3f'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x40')]);var upload=multer({'storage':multer[_0x4dbc('0x41')]({'destination':function(_0x28d63f,_0x2509d9,_0x255197){_0x255197(null,path['join'](config['root'],_0x4dbc('0x42')));},'filename':function(_0x47a8dc,_0x16166a,_0x5a25de){_0x5a25de(null,util[_0x4dbc('0x43')](_0x4dbc('0x44'),Date[_0x4dbc('0x45')](),_0x16166a[_0x4dbc('0x46')]));}})});router[_0x4dbc('0x3b')](_0x4dbc('0x12'),upload[_0x4dbc('0x47')](_0x4dbc('0x48')),controller[_0x4dbc('0x49')]);router['post'](_0x4dbc('0x4a'),auth['isAuthenticated'](),controller[_0x4dbc('0x4b')]);router['post'](_0x4dbc('0x4c'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x4d')]);router['post']('/:id/pause',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x4e')]);router[_0x4dbc('0x3b')](_0x4dbc('0x4f'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x50')]);router['post'](_0x4dbc('0x51'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x52')]);router[_0x4dbc('0x3b')](_0x4dbc('0x53'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x54')]);router[_0x4dbc('0x3b')](_0x4dbc('0x55'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x56')]);router[_0x4dbc('0x3b')](_0x4dbc('0x57'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x58')]);router[_0x4dbc('0x3b')](_0x4dbc('0x59'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x5a')]);router['post'](_0x4dbc('0x5b'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x5c')]);router[_0x4dbc('0x3b')](_0x4dbc('0x5d'),auth['isAuthenticated'](),controller[_0x4dbc('0x5e')]);router[_0x4dbc('0x3b')]('/:id/fax_accounts',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x5f')]);router[_0x4dbc('0x3b')](_0x4dbc('0x60'),auth[_0x4dbc('0xb')](),controller['addMailAccounts']);router['post'](_0x4dbc('0x2e'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x61')]);router[_0x4dbc('0x3b')](_0x4dbc('0x30'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x62')]);router[_0x4dbc('0x3b')]('/:id/chat_websites',auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x4dbc('0x3b')]('/:id/whatsapp_accounts',auth[_0x4dbc('0xb')](),controller['addWhatsappAccounts']);router['post']('/:id/square_projects',auth[_0x4dbc('0xb')](),controller['addSquareProjects']);router[_0x4dbc('0x3b')](_0x4dbc('0x39'),auth[_0x4dbc('0xb')](),controller['createApiKey']);router[_0x4dbc('0x63')](_0x4dbc('0x64'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x65')]);router['put'](_0x4dbc('0x66'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x67')]);router[_0x4dbc('0x68')](_0x4dbc('0x3f'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x69')]);router[_0x4dbc('0x68')](_0x4dbc('0x51'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x6a')]);router[_0x4dbc('0x68')](_0x4dbc('0x64'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x6b')]);router[_0x4dbc('0x68')](_0x4dbc('0x53'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x6c')]);router['delete'](_0x4dbc('0x55'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x6d')]);router[_0x4dbc('0x68')](_0x4dbc('0x57'),auth['isAuthenticated'](),controller[_0x4dbc('0x6e')]);router[_0x4dbc('0x68')]('/:id/sms_interactions',auth[_0x4dbc('0xb')](),controller['removeSmsInteractions']);router[_0x4dbc('0x68')](_0x4dbc('0x5b'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x6f')]);router['delete'](_0x4dbc('0x5d'),auth['isAuthenticated'](),controller[_0x4dbc('0x70')]);router[_0x4dbc('0x68')](_0x4dbc('0x2c'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x71')]);router[_0x4dbc('0x68')]('/:id/mail_accounts',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x72')]);router['delete'](_0x4dbc('0x2e'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x73')]);router[_0x4dbc('0x68')]('/:id/sms_accounts',auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x74')]);router[_0x4dbc('0x68')](_0x4dbc('0x75'),auth['isAuthenticated'](),controller[_0x4dbc('0x76')]);router[_0x4dbc('0x68')](_0x4dbc('0x33'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x77')]);router[_0x4dbc('0x68')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x4dbc('0x78')]);router[_0x4dbc('0x68')](_0x4dbc('0x39'),auth[_0x4dbc('0xb')](),controller[_0x4dbc('0x79')]);module[_0x4dbc('0x7a')]=router; \ No newline at end of file +var _0xcf9e=['format','%s-%s','now','originalname','/:id/avatar','addAvatar','/:id/login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','/:id/chat_websites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','removeQueues','delete','removeTeams','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','root','server/files/images/'];(function(_0x1ddd0,_0x15f9f4){var _0x4d86d0=function(_0x3173d7){while(--_0x3173d7){_0x1ddd0['push'](_0x1ddd0['shift']());}};_0x4d86d0(++_0x15f9f4);}(_0xcf9e,0x1a6));var _0xecf9=function(_0x46cfaf,_0x226a65){_0x46cfaf=_0x46cfaf-0x0;var _0x2671ba=_0xcf9e[_0x46cfaf];return _0x2671ba;};'use strict';var multer=require(_0xecf9('0x0'));var util=require(_0xecf9('0x1'));var path=require('path');var timeout=require(_0xecf9('0x2'));var express=require(_0xecf9('0x3'));var router=express[_0xecf9('0x4')]();var fs_extra=require(_0xecf9('0x5'));var auth=require(_0xecf9('0x6'));var interaction=require(_0xecf9('0x7'));var config=require(_0xecf9('0x8'));var controller=require(_0xecf9('0x9'));router[_0xecf9('0xa')]('/',auth[_0xecf9('0xb')](),controller[_0xecf9('0xc')]);router['get'](_0xecf9('0xd'),auth['isAuthenticated'](),controller[_0xecf9('0xe')]);router['get'](_0xecf9('0xf'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x10')]);router[_0xecf9('0xa')](_0xecf9('0x11'),auth[_0xecf9('0xb')](),controller['getPresence']);router[_0xecf9('0xa')](_0xecf9('0x12'),auth['isAuthenticated'](),controller[_0xecf9('0x13')]);router[_0xecf9('0xa')]('/:id/avatar',controller[_0xecf9('0x14')]);router[_0xecf9('0xa')](_0xecf9('0x15'),auth['isAuthenticated'](),controller[_0xecf9('0x16')]);router[_0xecf9('0xa')](_0xecf9('0x17'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x18')]);router['get'](_0xecf9('0x19'),auth['isAuthenticated'](),controller[_0xecf9('0x1a')]);router[_0xecf9('0xa')](_0xecf9('0x1b'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x1c')]);router[_0xecf9('0xa')](_0xecf9('0x1d'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x1e')]);router[_0xecf9('0xa')](_0xecf9('0x1f'),auth['isAuthenticated'](),controller[_0xecf9('0x20')]);router['get'](_0xecf9('0x21'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x22')]);router['get'](_0xecf9('0x23'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x24')]);router[_0xecf9('0xa')](_0xecf9('0x25'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x26')]);router[_0xecf9('0xa')]('/:id/mail/interactions',auth[_0xecf9('0xb')](),controller[_0xecf9('0x27')]);router[_0xecf9('0xa')](_0xecf9('0x28'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x29')]);router['get']('/:id/fax/interactions',auth[_0xecf9('0xb')](),controller[_0xecf9('0x2a')]);router[_0xecf9('0xa')](_0xecf9('0x2b'),auth['isAuthenticated'](),controller[_0xecf9('0x2c')]);router[_0xecf9('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xecf9('0x2d')]);router[_0xecf9('0xa')](_0xecf9('0x2e'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x2f')]);router['get'](_0xecf9('0x30'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x31')]);router['get'](_0xecf9('0x32'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x33')]);router[_0xecf9('0xa')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xecf9('0x34')]);router[_0xecf9('0xa')](_0xecf9('0x35'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x36')]);router[_0xecf9('0xa')](_0xecf9('0x37'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x38')]);router['get']('/:id/sms_accounts',auth[_0xecf9('0xb')](),controller[_0xecf9('0x39')]);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xecf9('0x3a')]);router[_0xecf9('0xa')](_0xecf9('0x3b'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x3c')]);router[_0xecf9('0xa')]('/:id/square_projects',auth[_0xecf9('0xb')](),controller[_0xecf9('0x3d')]);router[_0xecf9('0xa')]('/:id/scheduled_calls',auth[_0xecf9('0xb')](),controller[_0xecf9('0x3e')]);router[_0xecf9('0xa')](_0xecf9('0x3f'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x40')]);router[_0xecf9('0x41')](_0xecf9('0x17'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x42')]);router['post']('/',auth[_0xecf9('0xb')](),controller[_0xecf9('0x43')]);router[_0xecf9('0x41')](_0xecf9('0x44'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x45')]);router[_0xecf9('0x41')](_0xecf9('0x19'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x46')]);var upload=multer({'storage':multer[_0xecf9('0x47')]({'destination':function(_0x5ebc87,_0x3e870a,_0x30621d){_0x30621d(null,path['join'](config[_0xecf9('0x48')],_0xecf9('0x49')));},'filename':function(_0x3e2ea2,_0x11dcdc,_0x45caf6){_0x45caf6(null,util[_0xecf9('0x4a')](_0xecf9('0x4b'),Date[_0xecf9('0x4c')](),_0x11dcdc[_0xecf9('0x4d')]));}})});router[_0xecf9('0x41')](_0xecf9('0x4e'),upload['single']('file'),controller[_0xecf9('0x4f')]);router['post'](_0xecf9('0x50'),auth['isAuthenticated'](),controller['login']);router[_0xecf9('0x41')]('/:id/logout',auth['isAuthenticated'](),controller[_0xecf9('0x51')]);router[_0xecf9('0x41')](_0xecf9('0x52'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x53')]);router[_0xecf9('0x41')](_0xecf9('0x54'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x55')]);router[_0xecf9('0x41')](_0xecf9('0x56'),auth['isAuthenticated'](),controller['addTeams']);router[_0xecf9('0x41')](_0xecf9('0x57'),auth['isAuthenticated'](),controller[_0xecf9('0x58')]);router[_0xecf9('0x41')](_0xecf9('0x59'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x5a')]);router[_0xecf9('0x41')]('/:id/fax_interactions',auth[_0xecf9('0xb')](),controller[_0xecf9('0x5b')]);router[_0xecf9('0x41')](_0xecf9('0x5c'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x5d')]);router['post'](_0xecf9('0x5e'),auth['isAuthenticated'](),controller[_0xecf9('0x5f')]);router[_0xecf9('0x41')](_0xecf9('0x60'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x61')]);router['post'](_0xecf9('0x62'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x63')]);router[_0xecf9('0x41')](_0xecf9('0x35'),auth[_0xecf9('0xb')](),controller['addMailAccounts']);router[_0xecf9('0x41')](_0xecf9('0x37'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x64')]);router[_0xecf9('0x41')]('/:id/sms_accounts',auth[_0xecf9('0xb')](),controller['addSmsAccounts']);router['post'](_0xecf9('0x65'),auth[_0xecf9('0xb')](),controller['addChatWebsites']);router[_0xecf9('0x41')](_0xecf9('0x3b'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x66')]);router[_0xecf9('0x41')](_0xecf9('0x67'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x68')]);router[_0xecf9('0x41')](_0xecf9('0x3f'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x69')]);router[_0xecf9('0x6a')](_0xecf9('0x12'),auth[_0xecf9('0xb')](),controller['update']);router[_0xecf9('0x6a')]('/:id/password',auth[_0xecf9('0xb')](),controller['changePassword']);router['delete']('/:id/queues',auth[_0xecf9('0xb')](),controller[_0xecf9('0x6b')]);router[_0xecf9('0x6c')](_0xecf9('0x56'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x6d')]);router[_0xecf9('0x6c')](_0xecf9('0x12'),auth[_0xecf9('0xb')](),controller['destroy']);router[_0xecf9('0x6c')](_0xecf9('0x57'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x6e')]);router[_0xecf9('0x6c')]('/:id/mail_interactions',auth[_0xecf9('0xb')](),controller['removeMailInteractions']);router[_0xecf9('0x6c')](_0xecf9('0x6f'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x70')]);router[_0xecf9('0x6c')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xecf9('0x71')]);router[_0xecf9('0x6c')](_0xecf9('0x5e'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x72')]);router[_0xecf9('0x6c')](_0xecf9('0x60'),auth[_0xecf9('0xb')](),controller['removeWhatsappInteractions']);router[_0xecf9('0x6c')]('/:id/fax_accounts',auth[_0xecf9('0xb')](),controller[_0xecf9('0x73')]);router['delete'](_0xecf9('0x35'),auth['isAuthenticated'](),controller[_0xecf9('0x74')]);router[_0xecf9('0x6c')]('/:id/openchannel_accounts',auth[_0xecf9('0xb')](),controller[_0xecf9('0x75')]);router[_0xecf9('0x6c')](_0xecf9('0x76'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x77')]);router[_0xecf9('0x6c')]('/:id/chat_websites',auth[_0xecf9('0xb')](),controller[_0xecf9('0x78')]);router[_0xecf9('0x6c')](_0xecf9('0x3b'),auth['isAuthenticated'](),controller[_0xecf9('0x79')]);router[_0xecf9('0x6c')]('/:id/square_projects',auth[_0xecf9('0xb')](),controller['removeSquareProjects']);router['delete'](_0xecf9('0x3f'),auth[_0xecf9('0xb')](),controller[_0xecf9('0x7a')]);module[_0xecf9('0x7b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6cb3f47..fa48a1b 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 _0x8921=['dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','shortinfo','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlscertfile','dtlsprivatekey','dtlsenable','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','telephone','INTEGER','accountcode','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE'];(function(_0x1d42e3,_0x20497c){var _0x433f9e=function(_0x49a2d6){while(--_0x49a2d6){_0x1d42e3['push'](_0x1d42e3['shift']());}};_0x433f9e(++_0x20497c);}(_0x8921,0x9a));var _0x1892=function(_0xe8c010,_0x5a49ed){_0xe8c010=_0xe8c010-0x0;var _0x35bc75=_0x8921[_0xe8c010];return _0x35bc75;};'use strict';var Sequelize=require(_0x1892('0x0'));var moment=require('moment');var util=require(_0x1892('0x1'));var _=require(_0x1892('0x2'));module[_0x1892('0x3')]={'name':{'type':Sequelize[_0x1892('0x4')],'allowNull':![],'unique':_0x1892('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x110b75){this[_0x1892('0x6')](_0x1892('0x5'),_0x110b75);this[_0x1892('0x6')](_0x1892('0x7'),_0x110b75);},'comment':_0x1892('0x8')},'fullname':{'type':Sequelize[_0x1892('0x4')],'allowNull':![],'set':function(_0x504741){this[_0x1892('0x6')](_0x1892('0x9'),_0x504741);this[_0x1892('0x6')](_0x1892('0xa'),util[_0x1892('0xb')](_0x1892('0xc'),_0x504741,this['getDataValue'](_0x1892('0xd'))));}},'alias':{'type':Sequelize[_0x1892('0x4')]},'email':{'type':Sequelize[_0x1892('0x4')],'allowNull':![],'unique':_0x1892('0xe'),'validate':{'isEmail':!![]},'set':function(_0x1efeed){if(_0x1efeed){this[_0x1892('0x6')](_0x1892('0xe'),_0x1efeed[_0x1892('0xf')]());}}},'role':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x11'),_0x1892('0x12'),'agent',_0x1892('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x1892('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1892('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':![],'unique':_0x1892('0xd'),'set':function(_0xdfdecf){this[_0x1892('0x6')]('internal',_0xdfdecf);this['setDataValue'](_0x1892('0x15'),_0xdfdecf);this['setDataValue'](_0x1892('0xa'),util['format'](_0x1892('0xc'),this[_0x1892('0x16')](_0x1892('0x9')),_0xdfdecf));}},'salt':{'type':Sequelize[_0x1892('0x4')]},'phone':{'type':Sequelize[_0x1892('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x1892('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1892('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1892('0x18')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x1892('0x19')},'lastPauseAt':{'type':Sequelize[_0x1892('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1892('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1892('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1892('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1892('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1892('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1892('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1892('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1892('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![],'defaultValue':_0x1892('0x1a')},'ipaddr':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x1892('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x1892('0x1b'),'user',_0x1892('0x1c')),'allowNull':!![],'defaultValue':_0x1892('0x1b')},'context':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![],'defaultValue':_0x1892('0x1d')},'callingpres':{'type':Sequelize[_0x1892('0x10')]('ALLOWED_NOT_SCREENED',_0x1892('0x1e'),_0x1892('0x1f'),_0x1892('0x20'),_0x1892('0x21'),_0x1892('0x22'),_0x1892('0x23'),_0x1892('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![],'defaultValue':_0x1892('0x25'),'set':function(_0x55f751){this['setDataValue'](_0x1892('0x26'),_0x55f751?_0x55f751[_0x1892('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x1892('0x26'))?this[_0x1892('0x16')](_0x1892('0x26'))[_0x1892('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x29'),'info',_0x1892('0x2a'),'inband','auto'),'allowNull':!![],'defaultValue':_0x1892('0x29')},'directmedia':{'type':Sequelize[_0x1892('0x10')]('yes','no',_0x1892('0x2b'),_0x1892('0x2c'),_0x1892('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![],'defaultValue':_0x1892('0x2f'),'set':function(_0xaea57f){this['setDataValue'](_0x1892('0x30'),_0xaea57f?_0xaea57f[_0x1892('0x27')](','):null);},'get':function(){return this[_0x1892('0x16')]('nat')?this[_0x1892('0x16')](_0x1892('0x30'))[_0x1892('0x28')](','):null;},'comment':_0x1892('0x31')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1892('0x4')]},'pickupgroup':{'type':Sequelize[_0x1892('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x1892('0x4')]},'language':{'type':Sequelize[_0x1892('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1892('0x4')]},'disallow':{'type':Sequelize[_0x1892('0x4')],'allowNull':![],'defaultValue':_0x1892('0x32')},'allow':{'type':Sequelize[_0x1892('0x4')],'allowNull':![],'defaultValue':_0x1892('0x33'),'set':function(_0x3cb36f){this[_0x1892('0x6')]('allow',_0x3cb36f?_0x3cb36f[_0x1892('0x27')](';'):_0x1892('0x33'));},'get':function(){return this[_0x1892('0x16')](_0x1892('0x34'))?this[_0x1892('0x16')](_0x1892('0x34'))[_0x1892('0x28')](';'):null;},'comment':_0x1892('0x35')},'autoframing':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![],'set':function(_0x30db96){this['setDataValue']('insecure',_0x30db96?_0x30db96['join'](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x1892('0x16')]('insecure')[_0x1892('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no',_0x1892('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1892('0x37')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x1892('0x2e'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1892('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x1892('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1892('0x10')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no',_0x1892('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1892('0x10')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x1892('0x39'),_0x1892('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x3b'),_0x1892('0x3c')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1892('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1892('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x1892('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1892('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1892('0x10')]('yes','no',_0x1892('0x3d'),_0x1892('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1892('0x10')]('active',_0x1892('0x3f'),_0x1892('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1892('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1892('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1892('0x10')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1892('0x10')](_0x1892('0x2e'),'no',_0x1892('0x2b'),'update',_0x1892('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x1892('0x18')]},'passwordResetAt':{'type':Sequelize[_0x1892('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1892('0x42')]},'showWebBar':{'type':Sequelize[_0x1892('0x14')],'defaultValue':0x0,'set':function(_0x3ab3a9){this['setDataValue'](_0x1892('0x43'),_0x3ab3a9);var _0x4d1e21=this[_0x1892('0x44')]({'plain':!![]});switch(_0x3ab3a9){case 0x0:case 0x1:var _0x2e419c=_0x4d1e21[_0x1892('0x26')]?_[_0x1892('0x45')](_0x4d1e21['transport'])?_0x4d1e21[_0x1892('0x26')][_0x1892('0x27')]():_0x4d1e21[_0x1892('0x26')]:_0x1892('0x25');if(_0x2e419c===_0x1892('0x46')){_0x2e419c='udp';}this['setDataValue'](_0x1892('0x26'),_0x2e419c);this[_0x1892('0x6')](_0x1892('0x47'),'no');this[_0x1892('0x6')](_0x1892('0x48'),null);this[_0x1892('0x6')](_0x1892('0x49'),null);this['setDataValue'](_0x1892('0x4a'),null);this['setDataValue']('dtlsenable',null);this['setDataValue'](_0x1892('0x4b'),null);this['setDataValue']('dtlssetup',null);this[_0x1892('0x6')](_0x1892('0x4c'),null);this[_0x1892('0x6')](_0x1892('0x4d'),null);this[_0x1892('0x6')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x1892('0x26'),_0x1892('0x46'));this['setDataValue'](_0x1892('0x47'),_0x1892('0x2e'));this[_0x1892('0x6')]('avpf',_0x1892('0x2e'));this[_0x1892('0x6')](_0x1892('0x49'),_0x1892('0x2e'));this[_0x1892('0x6')](_0x1892('0x4a'),_0x1892('0x2e'));this['setDataValue'](_0x1892('0x4e'),_0x1892('0x2e'));this['setDataValue'](_0x1892('0x4b'),'no');this['setDataValue']('dtlssetup','actpass');this[_0x1892('0x6')](_0x1892('0x4c'),_0x4d1e21[_0x1892('0x4c')]||'/etc/pki/tls/certs/motion.crt');this[_0x1892('0x6')]('dtlsprivatekey',_0x4d1e21[_0x1892('0x4d')]||_0x1892('0x4f'));this[_0x1892('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x1892('0x42')],'set':function(_0x35e7bf){this[_0x1892('0x6')](_0x1892('0x50'),_0x35e7bf?_0x35e7bf['join'](','):[]);},'get':function(){return this['getDataValue'](_0x1892('0x50'))?_[_0x1892('0x51')](this[_0x1892('0x16')]('permissions')[_0x1892('0x28')](','),function(_0x108669){return parseInt(_0x108669,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1892('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1892('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1892('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1892('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x1892('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1892('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1892('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1892('0x52')],'get':function(){return this[_0x1892('0x16')]('phoneBarEnableScreenRecordingByAgent')?this[_0x1892('0x16')](_0x1892('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1892('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1892('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1892('0x17')],'defaultValue':![],'set':function(_0x5b857b){if(typeof _0x5b857b===_0x1892('0x54')){var _0x4d140b=_0x5b857b==='1'?!![]:_0x5b857b==='0'?![]:_0x5b857b===_0x1892('0x55')?!![]:_0x5b857b==='false'?![]:![];this[_0x1892('0x6')](_0x1892('0x56'),_0x4d140b);}else{this[_0x1892('0x6')]('screenrecording',_0x5b857b);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4d3122){this['setDataValue']('blocked',_0x4d3122);if(_0x4d3122===!![]){this[_0x1892('0x6')](_0x1892('0x57'),moment());this['setDataValue'](_0x1892('0x58'),0x0);}else{this['setDataValue'](_0x1892('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x1892('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1892('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1892('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1892('0x14')](0x5)[_0x1892('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1892('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1892('0x17')],'defaultValue':!![]}}; \ No newline at end of file +var _0x55c1=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','get','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','dtlsverify','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','getDataValue','internal','toLowerCase','ENUM','user','agent','local','callerid','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','transport','join','split'];(function(_0x2d93be,_0x730aea){var _0x23ee45=function(_0x4f399f){while(--_0x4f399f){_0x2d93be['push'](_0x2d93be['shift']());}};_0x23ee45(++_0x730aea);}(_0x55c1,0x1e5));var _0x155c=function(_0x3ff78f,_0x4bfafd){_0x3ff78f=_0x3ff78f-0x0;var _0x5abe3c=_0x55c1[_0x3ff78f];return _0x5abe3c;};'use strict';var Sequelize=require(_0x155c('0x0'));var moment=require(_0x155c('0x1'));var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'unique':_0x155c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x30444a){this[_0x155c('0x4')](_0x155c('0x3'),_0x30444a);this['setDataValue'](_0x155c('0x5'),_0x30444a);},'comment':_0x155c('0x6')},'fullname':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'set':function(_0x4df902){this[_0x155c('0x4')](_0x155c('0x7'),_0x4df902);this[_0x155c('0x4')]('callerid',util['format']('\x22%s\x22\x20<%s>',_0x4df902,this[_0x155c('0x8')](_0x155c('0x9'))));}},'alias':{'type':Sequelize[_0x155c('0x2')]},'email':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x228de5){if(_0x228de5){this[_0x155c('0x4')]('email',_0x228de5[_0x155c('0xa')]());}}},'role':{'type':Sequelize[_0x155c('0xb')]('admin',_0x155c('0xc'),_0x155c('0xd'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x155c('0x2')],'defaultValue':_0x155c('0xe')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x155c('0x9'),'set':function(_0x37903b){this[_0x155c('0x4')](_0x155c('0x9'),_0x37903b);this[_0x155c('0x4')]('accountcode',_0x37903b);this[_0x155c('0x4')](_0x155c('0xf'),util['format'](_0x155c('0x10'),this['getDataValue'](_0x155c('0x7')),_0x37903b));}},'salt':{'type':Sequelize[_0x155c('0x2')]},'phone':{'type':Sequelize[_0x155c('0x2')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x155c('0x2')]},'zipcode':{'type':Sequelize[_0x155c('0x2')]},'userpic':{'type':Sequelize[_0x155c('0x2')]},'city':{'type':Sequelize[_0x155c('0x2')]},'country':{'type':Sequelize[_0x155c('0x2')]},'online':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x155c('0x12')]},'voicePause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x155c('0x2')],'defaultValue':_0x155c('0x13')},'lastPauseAt':{'type':Sequelize[_0x155c('0x12')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x155c('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'description':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![],'defaultValue':_0x155c('0x15')},'ipaddr':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x155c('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x155c('0x16'),'user','peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x155c('0x17')},'callingpres':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x18'),'ALLOWED_PASSED_SCREEN',_0x155c('0x19'),_0x155c('0x1a'),_0x155c('0x1b'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2a84e7){this['setDataValue'](_0x155c('0x1c'),_0x2a84e7?_0x2a84e7[_0x155c('0x1d')](','):null);},'get':function(){return this['getDataValue'](_0x155c('0x1c'))?this[_0x155c('0x8')]('transport')[_0x155c('0x1e')](','):null;},'comment':_0x155c('0x1f')},'dtmfmode':{'type':Sequelize['ENUM'](_0x155c('0x20'),_0x155c('0x21'),_0x155c('0x22'),_0x155c('0x23'),_0x155c('0x24')),'allowNull':!![],'defaultValue':_0x155c('0x20')},'directmedia':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no',_0x155c('0x26'),_0x155c('0x27'),_0x155c('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x155c('0x29'),'set':function(_0x2b9482){this['setDataValue']('nat',_0x2b9482?_0x2b9482[_0x155c('0x1d')](','):null);},'get':function(){return this[_0x155c('0x8')](_0x155c('0x2a'))?this['getDataValue'](_0x155c('0x2a'))[_0x155c('0x1e')](','):null;},'comment':_0x155c('0x2b')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x155c('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x155c('0x2')]},'language':{'type':Sequelize[_0x155c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x155c('0x2')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'defaultValue':_0x155c('0x2c'),'set':function(_0x22fe10){this['setDataValue'](_0x155c('0x2d'),_0x22fe10?_0x22fe10[_0x155c('0x1d')](';'):_0x155c('0x2c'));},'get':function(){return this[_0x155c('0x8')](_0x155c('0x2d'))?this['getDataValue']('allow')[_0x155c('0x1e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3848e1){this[_0x155c('0x4')](_0x155c('0x2e'),_0x3848e1?_0x3848e1[_0x155c('0x1d')](','):null);},'get':function(){return this[_0x155c('0x8')]('insecure')?this[_0x155c('0x8')](_0x155c('0x2e'))[_0x155c('0x1e')](','):null;},'comment':_0x155c('0x2f')},'trustrpid':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no',_0x155c('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![],'defaultValue':_0x155c('0x31')},'amaflags':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':_0x155c('0x25')},'busylevel':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no',_0x155c('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x155c('0x33'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x155c('0xb')]('uac','uas'),'allowNull':!![],'defaultValue':_0x155c('0x34')},'t38pt_usertpsource':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':_0x155c('0x25')},'keepalive':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no',_0x155c('0x35'),_0x155c('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x37'),_0x155c('0x38'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x155c('0xb')]('yes','no','nonat',_0x155c('0x27'),_0x155c('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x155c('0x12')]},'passwordResetAt':{'type':Sequelize[_0x155c('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x155c('0x3a')]},'showWebBar':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0,'set':function(_0x3476b9){this[_0x155c('0x4')]('showWebBar',_0x3476b9);var _0x582220=this[_0x155c('0x3b')]({'plain':!![]});switch(_0x3476b9){case 0x0:case 0x1:var _0x165e9=_0x582220[_0x155c('0x1c')]?_['isArray'](_0x582220[_0x155c('0x1c')])?_0x582220[_0x155c('0x1c')][_0x155c('0x1d')]():_0x582220[_0x155c('0x1c')]:_0x155c('0x3c');if(_0x165e9==='wss'){_0x165e9=_0x155c('0x3c');}this[_0x155c('0x4')](_0x155c('0x1c'),_0x165e9);this[_0x155c('0x4')](_0x155c('0x3d'),'no');this['setDataValue'](_0x155c('0x3e'),null);this[_0x155c('0x4')](_0x155c('0x3f'),null);this['setDataValue'](_0x155c('0x40'),null);this['setDataValue'](_0x155c('0x41'),null);this[_0x155c('0x4')]('dtlsverify',null);this[_0x155c('0x4')](_0x155c('0x42'),null);this[_0x155c('0x4')]('dtlscertfile',null);this[_0x155c('0x4')](_0x155c('0x43'),null);this[_0x155c('0x4')]('rtcp_mux','no');break;case 0x2:this[_0x155c('0x4')](_0x155c('0x1c'),'wss');this[_0x155c('0x4')]('encryption',_0x155c('0x25'));this[_0x155c('0x4')](_0x155c('0x3e'),_0x155c('0x25'));this[_0x155c('0x4')]('force_avp',_0x155c('0x25'));this[_0x155c('0x4')]('icesupport',_0x155c('0x25'));this[_0x155c('0x4')](_0x155c('0x41'),_0x155c('0x25'));this['setDataValue'](_0x155c('0x44'),'no');this[_0x155c('0x4')]('dtlssetup',_0x155c('0x45'));this[_0x155c('0x4')](_0x155c('0x46'),_0x582220[_0x155c('0x46')]||_0x155c('0x47'));this[_0x155c('0x4')](_0x155c('0x43'),_0x582220['dtlsprivatekey']||_0x155c('0x48'));this[_0x155c('0x4')](_0x155c('0x49'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x31ca0f){this[_0x155c('0x4')](_0x155c('0x4a'),_0x31ca0f?_0x31ca0f['join'](','):[]);},'get':function(){return this['getDataValue'](_0x155c('0x4a'))?_[_0x155c('0x4b')](this['getDataValue'](_0x155c('0x4a'))[_0x155c('0x1e')](','),function(_0x690148){return parseInt(_0x690148,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x155c('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x155c('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x155c('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x155c('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x155c('0x4c')],'get':function(){return this[_0x155c('0x8')](_0x155c('0x4d'))?this[_0x155c('0x8')](_0x155c('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![],'set':function(_0x15f172){if(typeof _0x15f172===_0x155c('0x4e')){var _0xb22afe=_0x15f172==='1'?!![]:_0x15f172==='0'?![]:_0x15f172===_0x155c('0x4f')?!![]:_0x15f172===_0x155c('0x50')?![]:![];this['setDataValue'](_0x155c('0x51'),_0xb22afe);}else{this['setDataValue'](_0x155c('0x51'),_0x15f172);}}},'blocked':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![],'set':function(_0x1faa6e){this[_0x155c('0x4')](_0x155c('0x52'),_0x1faa6e);if(_0x1faa6e===!![]){this[_0x155c('0x4')](_0x155c('0x53'),moment());this[_0x155c('0x4')](_0x155c('0x54'),0x0);}else{this['setDataValue'](_0x155c('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0x155c('0x12')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x155c('0x14')](0x5)[_0x155c('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 1b7870e..4cc7540 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 _0x9536=['status','end','json','offset','undefined','count','Content-Range','update','then','admin','Users','user','Agents','Telephones','filter','value','includes','UserProfileResource','destroy','stack','name','send','index','User','rawAttributes','map','fieldName','type','key','where','query','includeAll','include','attributes','findAll','rows','openTabs','true','length','push','sms','dataValues','fax','mail','openchannel','whatsapp','all','params','model','differenceBy','keys','password','salt','intersection','fields','find','body','role','describe','addContacts','ids','omit','Setting','securePassword','validatePasswordPattern','max','internal','isNil','min_internal','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)','sequelize','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','101','102','110','104','107','108','109','100','114','115','create','agent','Unauthorized','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','each','telephone','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','Unknown\x20channel','add','toLowerCase','Queues','spread','capitalize','QueueId','emit','Queue:save','voice','VoiceQueue','get','format','SIP/%s','penalty','upsert','removeQueues','isValidChannel','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','file','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','getOpenTabs','chat','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','order','sort','filters','pick','merge','options','CmList','List','tag','hasOwnProperty','nolimit','limit','getContacts','getQueues','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','smsPause','whatsapppause','pauseType','manual','set','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','Openchannel','flatten','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','transaction','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contained','$any','firstName','CmContact','dialActive','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','teams','queues','resolve','inbound','getAgents','lower','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','util','path','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','client','http','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x284bd9,_0x4aefcf){var _0x1449ba=function(_0x5405c4){while(--_0x5405c4){_0x284bd9['push'](_0x284bd9['shift']());}};_0x1449ba(++_0x4aefcf);}(_0x9536,0x179));var _0x6953=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x9536[_0x3a8db5];return _0x2c03cd;};'use strict';var moment=require(_0x6953('0x0'));var BPromise=require(_0x6953('0x1'));var util=require(_0x6953('0x2'));var path=require(_0x6953('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6953('0x4'));var jayson=require('jayson/promise');var Redis=require(_0x6953('0x5'));var authService=require(_0x6953('0x6'));var qs=require(_0x6953('0x7'));var logger=require(_0x6953('0x8'))(_0x6953('0x9'));var utils=require('../../config/utils');var config=require(_0x6953('0xa'));var licenseUtil=require(_0x6953('0xb'));var db=require(_0x6953('0xc'))['db'];var socket=require(_0x6953('0xd'))(new Redis(config[_0x6953('0xe')]));require('./user.socket')[_0x6953('0xf')](socket);config[_0x6953('0xe')]=_[_0x6953('0x10')](config['redis'],{'host':_0x6953('0x11'),'port':0x18eb});var client=jayson[_0x6953('0x12')][_0x6953('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0xb13f2c,_0x448c89,_0x1f3062,_0x246534){return new BPromise(function(_0x2144c5,_0xdd0b40){var _0x57652e=_0x246534||client;return _0x57652e[_0x6953('0x14')](_0xb13f2c,_0x1f3062)['then'](function(_0x8de91e){logger[_0x6953('0x15')](_0x6953('0x16'),_0x448c89,_0x6953('0x17'));logger[_0x6953('0x18')](_0x6953('0x19'),_0x448c89,_0x6953('0x17'),JSON[_0x6953('0x1a')](_0x8de91e));if(_0x8de91e[_0x6953('0x1b')]){if(_0x8de91e[_0x6953('0x1b')][_0x6953('0x1c')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x448c89,_0x8de91e[_0x6953('0x1b')][_0x6953('0x1d')]);return _0xdd0b40(_0x8de91e[_0x6953('0x1b')][_0x6953('0x1d')]);}logger['error'](_0x6953('0x16'),_0x448c89,_0x8de91e[_0x6953('0x1b')]['message']);return _0x2144c5(_0x8de91e[_0x6953('0x1b')][_0x6953('0x1d')]);}else{logger[_0x6953('0x15')](_0x6953('0x16'),_0x448c89,_0x6953('0x17'));_0x2144c5(_0x8de91e['result'][_0x6953('0x1d')]);}})[_0x6953('0x1e')](function(_0x31d5fd){logger[_0x6953('0x1b')](_0x6953('0x16'),_0x448c89,_0x31d5fd);_0xdd0b40(_0x31d5fd);});});}function respondWithStatusCode(_0x5e33ec,_0xf96d07){_0xf96d07=_0xf96d07||0xcc;return function(_0x1388b7){if(_0x1388b7){return _0x5e33ec['sendStatus'](_0xf96d07);}return _0x5e33ec[_0x6953('0x1f')](_0xf96d07)[_0x6953('0x20')]();};}function respondWithResult(_0xb92529,_0x171dd8){_0x171dd8=_0x171dd8||0xc8;return function(_0x53640a){if(_0x53640a){return _0xb92529[_0x6953('0x1f')](_0x171dd8)[_0x6953('0x21')](_0x53640a);}};}function respondWithFilteredResult(_0x2a7f6a,_0x508ea7){return function(_0x495ebd){if(_0x495ebd){var _0x5a4cd7=typeof _0x508ea7[_0x6953('0x22')]===_0x6953('0x23')&&typeof _0x508ea7['limit']===_0x6953('0x23');var _0x587df0=_0x495ebd[_0x6953('0x24')];var _0x2bf39b=_0x5a4cd7?0x0:_0x508ea7[_0x6953('0x22')];var _0x2cc01e=_0x5a4cd7?_0x495ebd[_0x6953('0x24')]:_0x508ea7[_0x6953('0x22')]+_0x508ea7['limit'];var _0x3dd890;if(_0x2cc01e>=_0x587df0){_0x2cc01e=_0x587df0;_0x3dd890=0xc8;}else{_0x3dd890=0xce;}_0x2a7f6a[_0x6953('0x1f')](_0x3dd890);return _0x2a7f6a['set'](_0x6953('0x25'),_0x2bf39b+'-'+_0x2cc01e+'/'+_0x587df0)['json'](_0x495ebd);}return null;};}function saveUpdates(_0x173b3c){return function(_0x3b1175){if(_0x3b1175){return _0x3b1175[_0x6953('0x26')](_0x173b3c)['then'](function(_0x131992){return _0x131992;});}return null;};}function removeEntity(_0x3d7b04){return function(_0xf78141){if(_0xf78141){return _0xf78141['destroy']()[_0x6953('0x27')](function(){var _0x132a71=_0xf78141['get']({'plain':!![]});if(_0x132a71['role']===_0x6953('0x28'))return;var _0x44389b=[{'name':_0x6953('0x29'),'value':_0x6953('0x2a'),'ignore':!![]},{'name':_0x6953('0x2b'),'value':'agent','ignore':![]},{'name':_0x6953('0x2c'),'value':'telephone','ignore':![]}];var _0x2d5e76=_(_0x44389b)[_0x6953('0x2d')]('ignore')['map'](_0x6953('0x2e'))[_0x6953('0x2e')]();if(_[_0x6953('0x2f')](_0x2d5e76,_0x132a71['role'])){return;}var _0x28cb92=_['find'](_0x44389b,['value',_0x132a71['role']])['name'];return db[_0x6953('0x30')][_0x6953('0x31')]({'where':{'type':_0x28cb92,'resourceId':_0x132a71['id']}})[_0x6953('0x27')](function(){return _0xf78141;});})[_0x6953('0x27')](function(){_0x3d7b04[_0x6953('0x1f')](0xcc)[_0x6953('0x20')]();});}};}function handleEntityNotFound(_0x4f6e06){return function(_0x2b76a5){if(!_0x2b76a5){_0x4f6e06['sendStatus'](0x194);}return _0x2b76a5;};}function handleError(_0x199c67,_0x5c9a4e){_0x5c9a4e=_0x5c9a4e||0x1f4;return function(_0xc63da7){logger[_0x6953('0x1b')](_0xc63da7[_0x6953('0x32')]);if(_0xc63da7[_0x6953('0x33')]){delete _0xc63da7['name'];}_0x199c67[_0x6953('0x1f')](_0x5c9a4e)[_0x6953('0x34')](_0xc63da7);};}exports[_0x6953('0x35')]=function(_0xba2c1d,_0x40b6ea){var _0x475ea8={},_0x37b2b3={'count':0x0,'rows':[]};var _0x81428b=_(db[_0x6953('0x36')][_0x6953('0x37')])[_0x6953('0x38')](function(_0x483a33){return{'name':_0x483a33[_0x6953('0x39')],'type':_0x483a33[_0x6953('0x3a')][_0x6953('0x3b')]};})['filter'](function(_0x47e7e7){return!_[_0x6953('0x2f')](['password','salt'],_0x47e7e7[_0x6953('0x33')]);})[_0x6953('0x2e')]();_0x475ea8=qs['getOptions'](_0x81428b,_0xba2c1d);var _0x3434d6={'where':_0x475ea8[_0x6953('0x3c')]};return db[_0x6953('0x36')][_0x6953('0x24')](_0x3434d6)[_0x6953('0x27')](function(_0x4d7f59){_0x37b2b3['count']=_0x4d7f59;if(_0xba2c1d[_0x6953('0x3d')][_0x6953('0x3e')]){_0x475ea8[_0x6953('0x3f')]=[{'all':!![]}];}if(!_[_0x6953('0x2f')](_0x475ea8[_0x6953('0x40')],'id')){_0x475ea8[_0x6953('0x40')]['push']('id');}return db['User'][_0x6953('0x41')](_0x475ea8);})['then'](function(_0x588ff8){_0x37b2b3[_0x6953('0x42')]=_0x588ff8;if(_0xba2c1d[_0x6953('0x3d')][_0x6953('0x43')]===_0x6953('0x44')){var _0x139a84=[];for(var _0x5ac8f7=0x0;_0x5ac8f7<_0x37b2b3['rows'][_0x6953('0x45')];_0x5ac8f7++){_0x139a84[_0x6953('0x46')](get_open_tabs('chat',_0x37b2b3[_0x6953('0x42')][_0x5ac8f7]['dataValues']));_0x139a84[_0x6953('0x46')](get_open_tabs(_0x6953('0x47'),_0x37b2b3[_0x6953('0x42')][_0x5ac8f7][_0x6953('0x48')]));_0x139a84['push'](get_open_tabs(_0x6953('0x49'),_0x37b2b3[_0x6953('0x42')][_0x5ac8f7]['dataValues']));_0x139a84[_0x6953('0x46')](get_open_tabs(_0x6953('0x4a'),_0x37b2b3[_0x6953('0x42')][_0x5ac8f7][_0x6953('0x48')]));_0x139a84[_0x6953('0x46')](get_open_tabs(_0x6953('0x4b'),_0x37b2b3[_0x6953('0x42')][_0x5ac8f7][_0x6953('0x48')]));_0x139a84[_0x6953('0x46')](get_open_tabs(_0x6953('0x4c'),_0x37b2b3[_0x6953('0x42')][_0x5ac8f7]['dataValues']));}return BPromise[_0x6953('0x4d')](_0x139a84)['then'](function(_0x15c142){return _0x37b2b3;});}else{return _0x37b2b3;}})[_0x6953('0x27')](respondWithFilteredResult(_0x40b6ea,_0x475ea8))[_0x6953('0x1e')](handleError(_0x40b6ea,null));};exports['show']=function(_0xfb9613,_0x2a4e54){var _0x506561={'raw':![],'where':{'id':_0xfb9613[_0x6953('0x4e')]['id']}},_0x525145={};_0x525145[_0x6953('0x4f')]=_[_0x6953('0x50')](_[_0x6953('0x51')](db[_0x6953('0x36')][_0x6953('0x37')]),[_0x6953('0x52'),_0x6953('0x53')]);_0x525145[_0x6953('0x3d')]=_[_0x6953('0x51')](_0xfb9613[_0x6953('0x3d')]);_0x525145['filters']=_['intersection'](_0x525145[_0x6953('0x4f')],_0x525145[_0x6953('0x3d')]);_0x506561[_0x6953('0x40')]=_[_0x6953('0x54')](_0x525145[_0x6953('0x4f')],qs[_0x6953('0x55')](_0xfb9613[_0x6953('0x3d')][_0x6953('0x55')]));_0x506561[_0x6953('0x40')]=_0x506561['attributes']['length']?_0x506561['attributes']:_0x525145['model'];if(_0xfb9613[_0x6953('0x3d')][_0x6953('0x3e')]){_0x506561[_0x6953('0x3f')]=[{'all':!![]}];}_0x506561=_['merge']({},_0x506561,_0xfb9613['options']);if(!_[_0x6953('0x2f')](_0x506561[_0x6953('0x40')],'id')){_0x506561[_0x6953('0x40')]['push']('id');}return db['User'][_0x6953('0x56')](_0x506561)[_0x6953('0x27')](handleEntityNotFound(_0x2a4e54,null))['then'](function(_0x58fcb3){var _0x29937b=[];values=_0x58fcb3;if(_0xfb9613[_0x6953('0x3d')][_0x6953('0x43')]===_0x6953('0x44')){_0x29937b[_0x6953('0x46')](get_open_tabs('chat',_0x58fcb3[_0x6953('0x48')]));_0x29937b[_0x6953('0x46')](get_open_tabs('sms',_0x58fcb3[_0x6953('0x48')]));_0x29937b['push'](get_open_tabs(_0x6953('0x4b'),_0x58fcb3[_0x6953('0x48')]));_0x29937b[_0x6953('0x46')](get_open_tabs(_0x6953('0x4c'),_0x58fcb3['dataValues']));_0x29937b[_0x6953('0x46')](get_open_tabs(_0x6953('0x49'),_0x58fcb3[_0x6953('0x48')]));_0x29937b['push'](get_open_tabs('mail',_0x58fcb3[_0x6953('0x48')]));return BPromise[_0x6953('0x4d')](_0x29937b);}else{return values;}})[_0x6953('0x27')](function(_0x482f3b){return values;})['then'](respondWithResult(_0x2a4e54,null))[_0x6953('0x1e')](handleError(_0x2a4e54,null));};exports[_0x6953('0x26')]=function(_0x4c0f1c,_0x4f3df2){if(_0x4c0f1c[_0x6953('0x57')]['id']){delete _0x4c0f1c['body']['id'];}delete _0x4c0f1c[_0x6953('0x57')][_0x6953('0x58')];return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0x4c0f1c[_0x6953('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4f3df2,null))[_0x6953('0x27')](saveUpdates(_0x4c0f1c[_0x6953('0x57')],null))[_0x6953('0x27')](respondWithResult(_0x4f3df2,null))['catch'](handleError(_0x4f3df2,null));};exports['describe']=function(_0x1c0678,_0x2bf359){return db[_0x6953('0x36')][_0x6953('0x59')]()[_0x6953('0x27')](respondWithResult(_0x2bf359,null))['catch'](handleError(_0x2bf359,null));};exports[_0x6953('0x5a')]=function(_0x2df49c,_0xe93bf2){return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0x2df49c[_0x6953('0x4e')]['id']}})[_0x6953('0x27')](handleEntityNotFound(_0xe93bf2,null))[_0x6953('0x27')](function(_0x1cbc70){if(_0x1cbc70){return _0x1cbc70[_0x6953('0x5a')](_0x2df49c[_0x6953('0x57')][_0x6953('0x5b')],_[_0x6953('0x5c')](_0x2df49c['body'],[_0x6953('0x5b'),'id'])||{});}})[_0x6953('0x27')](respondWithResult(_0xe93bf2,null))[_0x6953('0x1e')](handleError(_0xe93bf2,null));};function validateUser(_0x20efa9){return new BPromise(function(_0x38674d,_0x523a4a){if(_0x20efa9['internal'])return _0x38674d(_0x20efa9);return db[_0x6953('0x5d')]['findById'](0x1)[_0x6953('0x27')](function(_0x2b5de2){if(_0x2b5de2[_0x6953('0x5e')])authService[_0x6953('0x5f')](_0x20efa9['password']);db[_0x6953('0x36')][_0x6953('0x60')](_0x6953('0x61'))[_0x6953('0x27')](function(_0x1c3190){if(_[_0x6953('0x62')](_0x1c3190)){_0x20efa9[_0x6953('0x61')]=_0x2b5de2[_0x6953('0x63')]||0x1;return;}if(_[_0x6953('0x62')](_0x2b5de2[_0x6953('0x63')])||_0x2b5de2[_0x6953('0x63')]===_0x1c3190){_0x20efa9[_0x6953('0x61')]=_0x1c3190+0x1;return;}if(_0x2b5de2[_0x6953('0x63')]>_0x1c3190){_0x20efa9[_0x6953('0x61')]=_0x2b5de2[_0x6953('0x63')];return;}return db['sequelize'][_0x6953('0x3d')](_0x6953('0x64'),{'type':db[_0x6953('0x65')][_0x6953('0x66')][_0x6953('0x67')]})[_0x6953('0x27')](function(_0x3e19f1){if(_0x3e19f1&&_0x3e19f1['length']){for(var _0x3bb873=0x0,_0x403d81=_0x3e19f1['length'];_0x3bb873<_0x403d81&&_[_0x6953('0x62')](_0x20efa9[_0x6953('0x61')]);_0x3bb873++){if(_0x2b5de2[_0x6953('0x63')]<=_0x3e19f1[_0x3bb873]['from']){_0x20efa9['internal']=_0x3e19f1[_0x3bb873][_0x6953('0x68')];}else if(_0x2b5de2[_0x6953('0x63')]>_0x3e19f1[_0x3bb873][_0x6953('0x68')]&&_0x2b5de2[_0x6953('0x63')]<=_0x3e19f1[_0x3bb873]['to']){_0x20efa9[_0x6953('0x61')]=_0x2b5de2[_0x6953('0x63')];}}}if(_[_0x6953('0x62')](_0x20efa9[_0x6953('0x61')])){_0x20efa9[_0x6953('0x61')]=_0x1c3190+0x1;}return _0x38674d(_0x20efa9);});});})['catch'](function(_0x78eb85){_0x523a4a(_0x78eb85);});});}function updateUser(_0x729812){return new BPromise(function(_0x1b641e,_0x3bdb47){try{if(_0x729812['voicemail']){_0x729812[_0x6953('0x69')]=_0x729812[_0x6953('0x61')];_0x729812[_0x6953('0x6a')]={'mailbox':_0x729812['internal'],'password':_0x729812[_0x6953('0x52')],'fullname':_0x729812[_0x6953('0x6b')],'email':_0x729812[_0x6953('0x6c')]};}if(_0x729812[_0x6953('0x58')]==='agent'){if(!_0x729812[_0x6953('0x6d')])_0x729812[_0x6953('0x6d')]=[_0x6953('0x6e'),_0x6953('0x6f'),'103','113',_0x6953('0x70'),_0x6953('0x71'),'105','106',_0x6953('0x72'),_0x6953('0x73'),_0x6953('0x74'),_0x6953('0x75'),'111',_0x6953('0x76'),_0x6953('0x77')];}_0x1b641e(_0x729812);}catch(_0x574606){_0x3bdb47(_0x574606);}});}exports[_0x6953('0x78')]=function(_0xd2aae9,_0x491bae){if(_0xd2aae9['user']['role']===_0x6953('0x79'))throw new Error(_0x6953('0x7a'));if(_0xd2aae9[_0x6953('0x57')][_0x6953('0x58')]===_0x6953('0x2a')&&_0xd2aae9[_0x6953('0x2a')][_0x6953('0x58')]!==_0x6953('0x28')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0xd2aae9[_0x6953('0x57')][_0x6953('0x58')]===_0x6953('0x28')&&_0xd2aae9[_0x6953('0x2a')][_0x6953('0x58')]!==_0x6953('0x28')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x6953('0x7b')]([_0xd2aae9['body']])[_0x6953('0x27')](function(){return validateUser(_0xd2aae9['body']);})[_0x6953('0x27')](function(_0x9de87a){return updateUser(_0x9de87a)[_0x6953('0x27')](function(_0x50d2e0){if(_0x50d2e0[_0x6953('0x58')]===_0x6953('0x28')){_0x50d2e0[_0x6953('0x7c')]=_0xd2aae9[_0x6953('0x2a')][_0x6953('0x7c')];delete _0x50d2e0[_0x6953('0x7d')];}return _0x50d2e0;});})['then'](function(_0x24a666){return db[_0x6953('0x36')][_0x6953('0x78')](_0x24a666,{'include':[{'model':db[_0x6953('0x6a')],'as':_0x6953('0x6a')}]});})[_0x6953('0x27')](function(_0x19716d){if(_0xd2aae9[_0x6953('0x57')][_0x6953('0x58')]===_0x6953('0x2a'))return _0x19716d;if(_0xd2aae9[_0x6953('0x2a')]['role']!==_0x6953('0x2a'))return _0x19716d;return db[_0x6953('0x7e')][_0x6953('0x56')]({'where':{'name':_0x19716d[_0x6953('0x58')]===_0x6953('0x79')?_0x6953('0x2b'):_0x6953('0x2c'),'userProfileId':_0xd2aae9[_0x6953('0x2a')][_0x6953('0x7d')]},'raw':!![]})[_0x6953('0x27')](function(_0x2feda2){if(!_0x2feda2||_0x2feda2['autoAssociation']!=0x0)return _0x19716d;return db[_0x6953('0x30')][_0x6953('0x78')]({'name':_0x19716d[_0x6953('0x33')],'resourceId':_0x19716d['id'],'type':_0x2feda2['name'],'sectionId':_0x2feda2['id']},{})[_0x6953('0x27')](function(){return _0x19716d;});})['catch'](function(_0x5c2078){logger[_0x6953('0x1b')](_0x6953('0x7f'),_0x5c2078);throw _0x5c2078;});})[_0x6953('0x27')](respondWithResult(_0x491bae,0xc9))[_0x6953('0x1e')](handleError(_0x491bae,null));};exports[_0x6953('0x80')]=function(_0x2928c3,_0x228544){var _0x5e34b6=_0x2928c3[_0x6953('0x57')];var _0x3113c0=[];if(_0x2928c3[_0x6953('0x2a')]['role']===_0x6953('0x79'))throw new Error(_0x6953('0x7a'));if(_['some'](_0x5e34b6,[_0x6953('0x58'),'user'])&&_0x2928c3['user'][_0x6953('0x58')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x6953('0x81')](_0x5e34b6,[_0x6953('0x58'),_0x6953('0x28')])&&_0x2928c3['user'][_0x6953('0x58')]!==_0x6953('0x28')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x6953('0x7b')](_0x5e34b6)[_0x6953('0x27')](function(){return validateUser(_0x5e34b6[0x0]);})[_0x6953('0x27')](function(){for(var _0x200599=0x1;_0x200599<_0x5e34b6[_0x6953('0x45')];_0x200599++){var _0x31d847=_0x5e34b6[_0x200599-0x1][_0x6953('0x61')];if(!_0x5e34b6[_0x200599][_0x6953('0x61')])_0x5e34b6[_0x200599][_0x6953('0x61')]=_0x31d847+0x1;_0x3113c0['push'](validateUser(_0x5e34b6[_0x200599]));}return BPromise[_0x6953('0x4d')](_0x3113c0);})[_0x6953('0x27')](function(){_0x3113c0=[];for(var _0x52ba59=0x0;_0x52ba59<_0x5e34b6[_0x6953('0x45')];_0x52ba59++){_0x3113c0[_0x6953('0x46')](updateUser(_0x5e34b6[_0x52ba59]));}return BPromise[_0x6953('0x4d')](_0x3113c0);})[_0x6953('0x27')](function(){return BPromise[_0x6953('0x82')](_0x5e34b6,function(_0x300be9){return db[_0x6953('0x36')]['create'](_0x300be9,{'include':[{'model':db[_0x6953('0x6a')],'as':_0x6953('0x6a')}]})[_0x6953('0x27')](function(_0x12e2ec){_0x300be9['id']=_0x12e2ec['id'];return _0x300be9;});});})[_0x6953('0x27')](function(_0xa54eb8){if(_0x2928c3[_0x6953('0x57')][_0x6953('0x58')]===_0x6953('0x2a'))return _0xa54eb8;if(_0x2928c3['user'][_0x6953('0x58')]!=='user')return _0xa54eb8;var _0x476893=_['some'](_0xa54eb8,function(_0x2c8907){return _0x2c8907[_0x6953('0x58')]===_0x6953('0x79')||_0x2c8907[_0x6953('0x58')]===_0x6953('0x83');});if(!_0x476893)return _0xa54eb8;return db['UserProfileSection'][_0x6953('0x41')]({'where':{'name':{'$or':['Agents',_0x6953('0x2c')]},'userProfileId':_0x2928c3[_0x6953('0x2a')][_0x6953('0x7d')]},'raw':!![]})[_0x6953('0x27')](function(_0x564a73){if(_[_0x6953('0x84')](_0x564a73)||!_[_0x6953('0x81')](_0x564a73,[_0x6953('0x85'),0x0]))return _0xa54eb8;_0x3113c0=[];var _0x2e5191=_(_0x564a73)[_0x6953('0x38')](function(_0x1b3658){if(_0x1b3658[_0x6953('0x85')]===0x1)return;return _0x1b3658['name']===_0x6953('0x2b')?_0x6953('0x79'):_0x6953('0x83');})[_0x6953('0x86')]()[_0x6953('0x2e')]();for(var _0x575b5f=0x0;_0x575b5f<_0xa54eb8['length'];_0x575b5f++){if(!_['includes'](_0x2e5191,_0xa54eb8[_0x575b5f][_0x6953('0x58')]))return;var _0xe578d4=_0xa54eb8[_0x575b5f][_0x6953('0x58')]==='agent'?_0x6953('0x2b'):'Telephones';_0x3113c0[_0x6953('0x46')](db[_0x6953('0x30')]['create']({'name':_0xa54eb8[_0x575b5f][_0x6953('0x33')],'resourceId':_0xa54eb8[_0x575b5f]['id'],'type':_0xe578d4,'sectionId':_['find'](_0x564a73,[_0x6953('0x33'),_0xe578d4])['id']},{}));}return BPromise['all'](_0x3113c0);});})['then'](respondWithResult(_0x228544,0xc9))[_0x6953('0x1e')](handleError(_0x228544,null));};exports[_0x6953('0x87')]=function(_0xbf0da2,_0x14ad16){if(_0xbf0da2[_0x6953('0x57')]['id']){delete _0xbf0da2[_0x6953('0x57')]['id'];}return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0xbf0da2['params']['id']}})['then'](function(_0x49fefc){if(!_0x49fefc)return null;if(_0x49fefc['id']===_0xbf0da2[_0x6953('0x2a')]['id']){if(!_0xbf0da2[_0x6953('0x57')][_0x6953('0x88')]||!_0xbf0da2[_0x6953('0x57')][_0x6953('0x89')]){throw new db['Sequelize'][(_0x6953('0x8a'))](_0x6953('0x8b'));}if(!_0x49fefc[_0x6953('0x8c')](_0xbf0da2[_0x6953('0x57')][_0x6953('0x88')])){throw new db[(_0x6953('0x8d'))][(_0x6953('0x8a'))](_0x6953('0x8e'));}if(_0xbf0da2['body'][_0x6953('0x88')]===_0xbf0da2['body'][_0x6953('0x89')]){throw new db[(_0x6953('0x8d'))][(_0x6953('0x8a'))](_0x6953('0x8f'));}}else if(_0xbf0da2[_0x6953('0x2a')][_0x6953('0x58')]==='admin'){if(!_0xbf0da2[_0x6953('0x57')]['newPassword']){throw new db[(_0x6953('0x8d'))][(_0x6953('0x8a'))](_0x6953('0x90'));}}else if(_0xbf0da2[_0x6953('0x2a')][_0x6953('0x58')]===_0x6953('0x2a')){if(!_0xbf0da2[_0x6953('0x57')][_0x6953('0x89')]){throw new db[(_0x6953('0x8d'))][(_0x6953('0x8a'))](_0x6953('0x90'));}if(_0x49fefc[_0x6953('0x58')]!==_0x6953('0x79')){throw new db[(_0x6953('0x8d'))]['ValidationError'](_0x6953('0x7a'));}}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}return _0x49fefc;})[_0x6953('0x27')](handleEntityNotFound(_0x14ad16,null))[_0x6953('0x27')](function(_0x17cd4b){return db[_0x6953('0x5d')][_0x6953('0x91')]({'attributes':['id',_0x6953('0x5e'),_0x6953('0x92'),_0x6953('0x93')]})[_0x6953('0x27')](function(_0x2a9080){if(_0x2a9080[_0x6953('0x5e')])authService[_0x6953('0x5f')](_0xbf0da2[_0x6953('0x57')]['newPassword']);if(!_0x2a9080[_0x6953('0x92')]||!_0x17cd4b[_0x6953('0x94')])return _0x17cd4b;authService[_0x6953('0x95')](_0xbf0da2[_0x6953('0x57')]['newPassword'],_0x17cd4b[_0x6953('0x94')],_0x2a9080[_0x6953('0x93')]);return _0x17cd4b;})['then'](saveUpdates({'password':_0xbf0da2[_0x6953('0x57')][_0x6953('0x89')],'passwordResetAt':_0xbf0da2[_0x6953('0x2a')]['id']==_0xbf0da2[_0x6953('0x4e')]['id']?moment():null,'previousPasswords':authService[_0x6953('0x96')](_0xbf0da2['body'][_0x6953('0x89')],_0x17cd4b[_0x6953('0x94')])},null));})[_0x6953('0x27')](respondWithResult(_0x14ad16,null))[_0x6953('0x1e')](handleError(_0x14ad16,null));};exports[_0x6953('0x97')]=function(_0x4769f9,_0xedf35d){var _0x37aa51=_0x4769f9[_0x6953('0x57')][_0x6953('0x98')];return db[_0x6953('0x36')]['find']({'where':{'id':_0x4769f9['params']['id']},'attributes':['id',_0x6953('0x33'),_0x6953('0x58'),_0x6953('0x99'),_0x6953('0x9a'),_0x6953('0x9b'),_0x6953('0x9c')]})[_0x6953('0x27')](handleEntityNotFound(_0xedf35d,null))[_0x6953('0x27')](function(_0x56cf6f){if(_0x56cf6f){if(!utils['isValidChannel'](_0x37aa51)){throw new db[(_0x6953('0x8d'))]['ValidationError'](_0x6953('0x9d'));}return _0x56cf6f[_0x6953('0x9e')+_['capitalize'](_0x37aa51[_0x6953('0x9f')]())+_0x6953('0xa0')](_0x4769f9[_0x6953('0x57')][_0x6953('0x5b')],{'penalty':_0x4769f9[_0x6953('0x57')]['penalty']||0x0})[_0x6953('0xa1')](function(_0x5229b8){for(var _0x4eeecf=0x0;_0x4eeecf<_0x4769f9[_0x6953('0x57')]['ids'][_0x6953('0x45')];_0x4eeecf+=0x1){var _0x355497={'UserId':Number(_0x4769f9['params']['id'])};_0x355497[_[_0x6953('0xa2')](_0x37aa51[_0x6953('0x9f')]())+_0x6953('0xa3')]=Number(_0x4769f9[_0x6953('0x57')][_0x6953('0x5b')][_0x4eeecf]);socket[_0x6953('0xa4')](_0x6953('0x2a')+_[_0x6953('0xa2')](_0x37aa51['toLowerCase']())+_0x6953('0xa5'),_0x355497);}return _0x5229b8;})[_0x6953('0x27')](function(){if(_0x37aa51===_0x6953('0xa6')){return db[_0x6953('0xa7')][_0x6953('0x41')]({'where':{'id':_0x4769f9[_0x6953('0x57')][_0x6953('0x5b')]||[]},'raw':!![],'attributes':['id',_0x6953('0x33')]});}})['then'](function(_0x2d0702){var _0xdbd3db=_0x56cf6f[_0x6953('0xa8')]({'plain':!![]});var _0x3661ce=[];if(_0x37aa51===_0x6953('0xa6')&&_0xdbd3db[_0x6953('0x58')]===_0x6953('0x79')&&_0xdbd3db['online']){for(var _0x4c2505=0x0;_0x4c2505<_0x2d0702[_0x6953('0x45')];_0x4c2505+=0x1){_0x3661ce[_0x6953('0x46')]({'membername':_0xdbd3db[_0x6953('0x33')],'UserId':_0xdbd3db['id'],'queue_name':_0x2d0702[_0x4c2505][_0x6953('0x33')],'VoiceQueueId':_0x2d0702[_0x4c2505]['id'],'interface':_[_0x6953('0x62')](_0xdbd3db[_0x6953('0x9c')])?util[_0x6953('0xa9')](_0x6953('0xaa'),_0xdbd3db[_0x6953('0x33')]):_0xdbd3db[_0x6953('0x9c')],'paused':_0xdbd3db[_0x6953('0x9b')]||![],'penalty':_0x4769f9[_0x6953('0x57')][_0x6953('0xab')]||0x0});}return BPromise[_0x6953('0x82')](_0x3661ce,function(_0x1dcbd2){return db['UserVoiceQueueRt'][_0x6953('0xac')](_0x1dcbd2);});}return _0x56cf6f;});}})['then'](respondWithStatusCode(_0xedf35d,null))['catch'](handleError(_0xedf35d,null));};exports[_0x6953('0xad')]=function(_0x4ca574,_0x1cedb8){var _0x128748;return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0x4ca574[_0x6953('0x4e')]['id']},'attributes':['id',_0x6953('0x33'),'role']})[_0x6953('0x27')](handleEntityNotFound(_0x1cedb8,null))[_0x6953('0x27')](function(_0x7cd620){if(_0x7cd620){_0x128748=_0x7cd620;if(!_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')]||!utils[_0x6953('0xae')](_0x4ca574['query'][_0x6953('0x98')])){throw new db[(_0x6953('0x8d'))][(_0x6953('0x8a'))](_0x6953('0x9d'));}return _0x7cd620[_0x6953('0xaf')+_['capitalize'](_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')][_0x6953('0x9f')]())+_0x6953('0xa0')](_0x4ca574[_0x6953('0x3d')][_0x6953('0x5b')]);}})[_0x6953('0x27')](function(_0x2e68d0){if(_[_0x6953('0xb0')](_0x4ca574[_0x6953('0x3d')][_0x6953('0x5b')])){for(var _0xb74ca4=0x0;_0xb74ca4<_0x4ca574[_0x6953('0x3d')]['ids'][_0x6953('0x45')];_0xb74ca4+=0x1){var _0xcd7f7c={'UserId':Number(_0x4ca574[_0x6953('0x4e')]['id'])};_0xcd7f7c[_[_0x6953('0xa2')](_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')]['toLowerCase']())+'QueueId']=Number(_0x4ca574[_0x6953('0x3d')]['ids'][_0xb74ca4]);socket[_0x6953('0xa4')](_0x6953('0x2a')+_[_0x6953('0xa2')](_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')][_0x6953('0x9f')]())+'Queue:remove',_0xcd7f7c);}}else{var _0xcd7f7c={'UserId':Number(_0x4ca574[_0x6953('0x4e')]['id'])};_0xcd7f7c[_[_0x6953('0xa2')](_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')][_0x6953('0x9f')]())+_0x6953('0xa3')]=Number(_0x4ca574[_0x6953('0x3d')]['ids']);socket[_0x6953('0xa4')](_0x6953('0x2a')+_['capitalize'](_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')][_0x6953('0x9f')]())+_0x6953('0xb1'),_0xcd7f7c);}return _0x2e68d0;})[_0x6953('0x27')](function(){if(_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')]===_0x6953('0xa6')){return db[_0x6953('0xb2')][_0x6953('0x31')]({'where':{'UserId':_0x4ca574['params']['id'],'VoiceQueueId':_0x4ca574[_0x6953('0x3d')]['ids']},'individualHooks':!![]})['then'](function(){return _0x128748;});}return _0x128748;})[_0x6953('0x27')](respondWithStatusCode(_0x1cedb8,null))[_0x6953('0x1e')](handleError(_0x1cedb8,null));};exports[_0x6953('0xb3')]=function(_0x49b41d,_0x487e1d){_0x49b41d[_0x6953('0x57')]['userpic']=_0x49b41d[_0x6953('0xb4')]['filename'];return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0x49b41d['params']['id']}})['then'](handleEntityNotFound(_0x487e1d,null))[_0x6953('0x27')](saveUpdates(_0x49b41d[_0x6953('0x57')],null))[_0x6953('0x27')](respondWithResult(_0x487e1d,null))[_0x6953('0x1e')](handleError(_0x487e1d,null));};exports['getAvatar']=function(_0x5ef901,_0x43fa2f){var _0xbeda4b=path[_0x6953('0xb5')](config[_0x6953('0xb6')],_0x6953('0xb7'));return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0x5ef901[_0x6953('0x4e')]['id']},'attributes':['id',_0x6953('0xb8')],'raw':!![]})['then'](handleEntityNotFound(_0x43fa2f,null))[_0x6953('0x27')](function(_0x46e1a0){if(_0x46e1a0){if(_[_0x6953('0x62')](_0x46e1a0[_0x6953('0xb8')])){return _0x43fa2f[_0x6953('0xb9')](_0xbeda4b);}else{if(!fs[_0x6953('0xba')](path[_0x6953('0xb5')](config[_0x6953('0xb6')],_0x6953('0xbb'),_0x46e1a0[_0x6953('0xb8')]))){return _0x43fa2f[_0x6953('0xb9')](_0xbeda4b);}return _0x43fa2f[_0x6953('0xb9')](path[_0x6953('0xb5')](config[_0x6953('0xb6')],_0x6953('0xbb'),_0x46e1a0[_0x6953('0xb8')]));}}})[_0x6953('0x1e')](handleError(_0x43fa2f,null));};exports[_0x6953('0xbc')]=function(_0xb8b49b,_0x2b52ef){return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0xb8b49b[_0x6953('0x4e')]['id']},'attributes':['id']})[_0x6953('0x27')](handleEntityNotFound(_0x2b52ef,null))[_0x6953('0x27')](function(_0x51ea38){var _0x11aece=[];values=_0x51ea38['dataValues'];_0x11aece[_0x6953('0x46')](get_open_tabs(_0x6953('0xbd'),_0x51ea38[_0x6953('0x48')]));_0x11aece[_0x6953('0x46')](get_open_tabs(_0x6953('0x47'),_0x51ea38[_0x6953('0x48')]));_0x11aece[_0x6953('0x46')](get_open_tabs('openchannel',_0x51ea38[_0x6953('0x48')]));_0x11aece[_0x6953('0x46')](get_open_tabs(_0x6953('0x4c'),_0x51ea38[_0x6953('0x48')]));_0x11aece[_0x6953('0x46')](get_open_tabs(_0x6953('0x49'),_0x51ea38[_0x6953('0x48')]));_0x11aece[_0x6953('0x46')](get_open_tabs(_0x6953('0x4a'),_0x51ea38[_0x6953('0x48')]));return BPromise[_0x6953('0x4d')](_0x11aece);})[_0x6953('0x27')](function(_0x481206){var _0x392c3d=[];if(_0x481206){for(var _0x36d3ef=0x0;_0x36d3ef=_0x4bfa76){_0x180e1e=_0x4bfa76;_0x46f76a=0xc8;}else{_0x46f76a=0xce;}_0x1a7853[_0x7d11('0x22')](_0x46f76a);return _0x1a7853[_0x7d11('0x27')]('Content-Range',_0x3ba092+'-'+_0x180e1e+'/'+_0x4bfa76)[_0x7d11('0x23')](_0xd938df);}return null;};}function saveUpdates(_0x35a789){return function(_0x18c049){if(_0x18c049){return _0x18c049[_0x7d11('0x28')](_0x35a789)['then'](function(_0x1a7745){return _0x1a7745;});}return null;};}function removeEntity(_0x512f7f){return function(_0x1bc218){if(_0x1bc218){return _0x1bc218['destroy']()[_0x7d11('0x17')](function(){var _0xba4e80=_0x1bc218[_0x7d11('0x29')]({'plain':!![]});if(_0xba4e80['role']==='admin')return;var _0x8e0a53=[{'name':_0x7d11('0x2a'),'value':'user','ignore':!![]},{'name':_0x7d11('0x2b'),'value':_0x7d11('0x2c'),'ignore':![]},{'name':_0x7d11('0x2d'),'value':'telephone','ignore':![]}];var _0x9c6609=_(_0x8e0a53)['filter']('ignore')[_0x7d11('0x2e')]('value')[_0x7d11('0x2f')]();if(_[_0x7d11('0x30')](_0x9c6609,_0xba4e80[_0x7d11('0x31')])){return;}var _0x35b997=_['find'](_0x8e0a53,[_0x7d11('0x2f'),_0xba4e80[_0x7d11('0x31')]])['name'];return db['UserProfileResource'][_0x7d11('0x32')]({'where':{'type':_0x35b997,'resourceId':_0xba4e80['id']}})[_0x7d11('0x17')](function(){return _0x1bc218;});})['then'](function(){_0x512f7f[_0x7d11('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c0113){return function(_0x1286d6){if(!_0x1286d6){_0x5c0113['sendStatus'](0x194);}return _0x1286d6;};}function handleError(_0x4e53be,_0x3414cd){_0x3414cd=_0x3414cd||0x1f4;return function(_0x30e2fa){logger[_0x7d11('0x1e')](_0x30e2fa[_0x7d11('0x33')]);if(_0x30e2fa[_0x7d11('0x34')]){delete _0x30e2fa[_0x7d11('0x34')];}_0x4e53be[_0x7d11('0x22')](_0x3414cd)[_0x7d11('0x35')](_0x30e2fa);};}exports[_0x7d11('0x36')]=function(_0x16cf5d,_0x1a9f18){var _0x779731={},_0x5d2305={'count':0x0,'rows':[]};var _0x157731=_(db['User'][_0x7d11('0x37')])[_0x7d11('0x2e')](function(_0x36be62){return{'name':_0x36be62[_0x7d11('0x38')],'type':_0x36be62['type'][_0x7d11('0x39')]};})[_0x7d11('0x3a')](function(_0x19284){return!_[_0x7d11('0x30')](['password',_0x7d11('0x3b')],_0x19284['name']);})[_0x7d11('0x2f')]();_0x779731=qs['getOptions'](_0x157731,_0x16cf5d);var _0xede1cc={'where':_0x779731[_0x7d11('0x3c')]};return db[_0x7d11('0x3d')][_0x7d11('0x26')](_0xede1cc)['then'](function(_0x57b827){_0x5d2305[_0x7d11('0x26')]=_0x57b827;if(_0x16cf5d[_0x7d11('0x3e')]['includeAll']){_0x779731[_0x7d11('0x3f')]=[{'all':!![]}];}if(!_[_0x7d11('0x30')](_0x779731[_0x7d11('0x40')],'id')){_0x779731[_0x7d11('0x40')][_0x7d11('0x41')]('id');}return db[_0x7d11('0x3d')]['findAll'](_0x779731);})[_0x7d11('0x17')](function(_0x5cf6a6){_0x5d2305[_0x7d11('0x42')]=_0x5cf6a6;if(_0x16cf5d[_0x7d11('0x3e')][_0x7d11('0x43')]===_0x7d11('0x44')){var _0x2a0c2f=[];for(var _0x29da73=0x0;_0x29da73<_0x5d2305['rows']['length'];_0x29da73++){_0x2a0c2f['push'](get_open_tabs(_0x7d11('0x45'),_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x47'),_0x5d2305['rows'][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs('fax',_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs('mail',_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs('openchannel',_0x5d2305[_0x7d11('0x42')][_0x29da73]['dataValues']));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x48'),_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));}return BPromise[_0x7d11('0x49')](_0x2a0c2f)[_0x7d11('0x17')](function(_0x161213){return _0x5d2305;});}else{return _0x5d2305;}})[_0x7d11('0x17')](respondWithFilteredResult(_0x1a9f18,_0x779731))[_0x7d11('0x21')](handleError(_0x1a9f18,null));};exports['show']=function(_0x50d458,_0x49a21c){var _0x10c0e9={'raw':![],'where':{'id':_0x50d458[_0x7d11('0x4a')]['id']}},_0x1e5bb5={};_0x1e5bb5[_0x7d11('0x4b')]=_[_0x7d11('0x4c')](_[_0x7d11('0x4d')](db[_0x7d11('0x3d')][_0x7d11('0x37')]),[_0x7d11('0x4e'),_0x7d11('0x3b')]);_0x1e5bb5[_0x7d11('0x3e')]=_[_0x7d11('0x4d')](_0x50d458['query']);_0x1e5bb5[_0x7d11('0x4f')]=_[_0x7d11('0x50')](_0x1e5bb5[_0x7d11('0x4b')],_0x1e5bb5['query']);_0x10c0e9['attributes']=_[_0x7d11('0x50')](_0x1e5bb5[_0x7d11('0x4b')],qs[_0x7d11('0x51')](_0x50d458['query']['fields']));_0x10c0e9[_0x7d11('0x40')]=_0x10c0e9[_0x7d11('0x40')]['length']?_0x10c0e9[_0x7d11('0x40')]:_0x1e5bb5[_0x7d11('0x4b')];if(_0x50d458[_0x7d11('0x3e')][_0x7d11('0x52')]){_0x10c0e9['include']=[{'all':!![]}];}_0x10c0e9=_[_0x7d11('0x53')]({},_0x10c0e9,_0x50d458[_0x7d11('0x54')]);if(!_[_0x7d11('0x30')](_0x10c0e9['attributes'],'id')){_0x10c0e9['attributes'][_0x7d11('0x41')]('id');}return db[_0x7d11('0x3d')][_0x7d11('0x55')](_0x10c0e9)[_0x7d11('0x17')](handleEntityNotFound(_0x49a21c,null))[_0x7d11('0x17')](function(_0x4c7d7a){var _0x46a8e1=[];values=_0x4c7d7a;if(_0x50d458[_0x7d11('0x3e')][_0x7d11('0x43')]===_0x7d11('0x44')){_0x46a8e1['push'](get_open_tabs('chat',_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x47'),_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x56'),_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x48'),_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1['push'](get_open_tabs('fax',_0x4c7d7a['dataValues']));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x57'),_0x4c7d7a[_0x7d11('0x46')]));return BPromise['all'](_0x46a8e1);}else{return values;}})[_0x7d11('0x17')](function(_0x222375){return values;})[_0x7d11('0x17')](respondWithResult(_0x49a21c,null))[_0x7d11('0x21')](handleError(_0x49a21c,null));};exports[_0x7d11('0x28')]=function(_0x178a3a,_0x505573){if(_0x178a3a[_0x7d11('0x58')]['id']){delete _0x178a3a[_0x7d11('0x58')]['id'];}delete _0x178a3a[_0x7d11('0x58')]['role'];return db['User']['find']({'where':{'id':_0x178a3a['params']['id']}})[_0x7d11('0x17')](handleEntityNotFound(_0x505573,null))['then'](saveUpdates(_0x178a3a['body'],null))['then'](respondWithResult(_0x505573,null))[_0x7d11('0x21')](handleError(_0x505573,null));};exports[_0x7d11('0x59')]=function(_0x1072f1,_0x407f2c){return db[_0x7d11('0x3d')][_0x7d11('0x59')]()['then'](respondWithResult(_0x407f2c,null))[_0x7d11('0x21')](handleError(_0x407f2c,null));};exports['addContacts']=function(_0x34aab4,_0x49f904){return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x34aab4['params']['id']}})[_0x7d11('0x17')](handleEntityNotFound(_0x49f904,null))[_0x7d11('0x17')](function(_0x2581d5){if(_0x2581d5){return _0x2581d5[_0x7d11('0x5a')](_0x34aab4['body']['ids'],_[_0x7d11('0x5b')](_0x34aab4[_0x7d11('0x58')],[_0x7d11('0x5c'),'id'])||{});}})[_0x7d11('0x17')](respondWithResult(_0x49f904,null))[_0x7d11('0x21')](handleError(_0x49f904,null));};function validateUser(_0x492183){return new BPromise(function(_0x2b9ba0,_0x5ad800){if(_0x492183[_0x7d11('0x5d')])return _0x2b9ba0(_0x492183);return db[_0x7d11('0x5e')][_0x7d11('0x5f')](0x1)[_0x7d11('0x17')](function(_0x4df2da){if(_0x4df2da[_0x7d11('0x60')])authService['validatePasswordPattern'](_0x492183[_0x7d11('0x4e')]);db[_0x7d11('0x3d')][_0x7d11('0x61')](_0x7d11('0x5d'))[_0x7d11('0x17')](function(_0x776b20){if(_[_0x7d11('0x62')](_0x776b20)){_0x492183[_0x7d11('0x5d')]=_0x4df2da[_0x7d11('0x63')]||0x1;return;}if(_[_0x7d11('0x62')](_0x4df2da[_0x7d11('0x63')])||_0x4df2da[_0x7d11('0x63')]===_0x776b20){_0x492183[_0x7d11('0x5d')]=_0x776b20+0x1;return;}if(_0x4df2da[_0x7d11('0x63')]>_0x776b20){_0x492183['internal']=_0x4df2da[_0x7d11('0x63')];return;}return db['sequelize'][_0x7d11('0x3e')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x7d11('0x64')][_0x7d11('0x65')][_0x7d11('0x66')]})[_0x7d11('0x17')](function(_0x4aac67){if(_0x4aac67&&_0x4aac67['length']){for(var _0x1351ee=0x0,_0x15938b=_0x4aac67[_0x7d11('0x67')];_0x1351ee<_0x15938b&&_['isNil'](_0x492183[_0x7d11('0x5d')]);_0x1351ee++){if(_0x4df2da[_0x7d11('0x63')]<=_0x4aac67[_0x1351ee][_0x7d11('0x68')]){_0x492183[_0x7d11('0x5d')]=_0x4aac67[_0x1351ee][_0x7d11('0x68')];}else if(_0x4df2da[_0x7d11('0x63')]>_0x4aac67[_0x1351ee]['from']&&_0x4df2da[_0x7d11('0x63')]<=_0x4aac67[_0x1351ee]['to']){_0x492183['internal']=_0x4df2da[_0x7d11('0x63')];}}}if(_['isNil'](_0x492183['internal'])){_0x492183[_0x7d11('0x5d')]=_0x776b20+0x1;}return _0x2b9ba0(_0x492183);});});})[_0x7d11('0x21')](function(_0xeed31b){_0x5ad800(_0xeed31b);});});}function updateUser(_0x14ee15){return new BPromise(function(_0x119da7,_0x2da548){try{if(_0x14ee15[_0x7d11('0x69')]){_0x14ee15[_0x7d11('0x6a')]=_0x14ee15[_0x7d11('0x5d')];_0x14ee15[_0x7d11('0x6b')]={'mailbox':_0x14ee15[_0x7d11('0x5d')],'password':_0x14ee15['password'],'fullname':_0x14ee15[_0x7d11('0x6c')],'email':_0x14ee15['email']};}if(_0x14ee15[_0x7d11('0x31')]===_0x7d11('0x2c')){if(!_0x14ee15[_0x7d11('0x6d')])_0x14ee15[_0x7d11('0x6d')]=[_0x7d11('0x6e'),_0x7d11('0x6f'),_0x7d11('0x70'),'113','110',_0x7d11('0x71'),_0x7d11('0x72'),_0x7d11('0x73'),_0x7d11('0x74'),_0x7d11('0x75'),'109',_0x7d11('0x76'),'111',_0x7d11('0x77'),_0x7d11('0x78')];}_0x119da7(_0x14ee15);}catch(_0x1bddb4){_0x2da548(_0x1bddb4);}});}exports[_0x7d11('0x79')]=function(_0x1b5e35,_0x1c02c8){if(_0x1b5e35[_0x7d11('0x7a')][_0x7d11('0x31')]==='agent')throw new Error('Unauthorized');if(_0x1b5e35[_0x7d11('0x58')][_0x7d11('0x31')]===_0x7d11('0x7a')&&_0x1b5e35['user']['role']!==_0x7d11('0x7b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x1b5e35[_0x7d11('0x58')][_0x7d11('0x31')]===_0x7d11('0x7b')&&_0x1b5e35[_0x7d11('0x7a')]['role']!==_0x7d11('0x7b')){throw new Error(_0x7d11('0x7c'));}return licenseUtil[_0x7d11('0x7d')]([_0x1b5e35[_0x7d11('0x58')]])[_0x7d11('0x17')](function(){return validateUser(_0x1b5e35[_0x7d11('0x58')]);})[_0x7d11('0x17')](function(_0x1b719a){return updateUser(_0x1b719a)['then'](function(_0x41f989){if(_0x41f989[_0x7d11('0x31')]===_0x7d11('0x7b')){_0x41f989[_0x7d11('0x7e')]=_0x1b5e35[_0x7d11('0x7a')]['settingsEnabled'];delete _0x41f989[_0x7d11('0x7f')];}return _0x41f989;});})[_0x7d11('0x17')](function(_0xa4d2ad){return db[_0x7d11('0x3d')][_0x7d11('0x79')](_0xa4d2ad,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x1fdae2){if(_0x1b5e35['body'][_0x7d11('0x31')]==='user')return _0x1fdae2;if(_0x1b5e35['user'][_0x7d11('0x31')]!==_0x7d11('0x7a'))return _0x1fdae2;return db[_0x7d11('0x80')][_0x7d11('0x55')]({'where':{'name':_0x1fdae2[_0x7d11('0x31')]===_0x7d11('0x2c')?_0x7d11('0x2b'):_0x7d11('0x2d'),'userProfileId':_0x1b5e35[_0x7d11('0x7a')][_0x7d11('0x7f')]},'raw':!![]})['then'](function(_0xfdfcb7){if(!_0xfdfcb7||_0xfdfcb7[_0x7d11('0x81')]!=0x0)return _0x1fdae2;return db['UserProfileResource'][_0x7d11('0x79')]({'name':_0x1fdae2[_0x7d11('0x34')],'resourceId':_0x1fdae2['id'],'type':_0xfdfcb7[_0x7d11('0x34')],'sectionId':_0xfdfcb7['id']},{})[_0x7d11('0x17')](function(){return _0x1fdae2;});})['catch'](function(_0x573fa9){logger[_0x7d11('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x573fa9);throw _0x573fa9;});})[_0x7d11('0x17')](respondWithResult(_0x1c02c8,0xc9))[_0x7d11('0x21')](handleError(_0x1c02c8,null));};exports[_0x7d11('0x82')]=function(_0x13ccd5,_0x1565d9){var _0x269f3f=_0x13ccd5[_0x7d11('0x58')];var _0x596228=[];if(_0x13ccd5[_0x7d11('0x7a')][_0x7d11('0x31')]===_0x7d11('0x2c'))throw new Error(_0x7d11('0x83'));if(_['some'](_0x269f3f,[_0x7d11('0x31'),_0x7d11('0x7a')])&&_0x13ccd5['user'][_0x7d11('0x31')]!==_0x7d11('0x7b')){throw new Error(_0x7d11('0x84'));}if(_['some'](_0x269f3f,[_0x7d11('0x31'),_0x7d11('0x7b')])&&_0x13ccd5['user'][_0x7d11('0x31')]!==_0x7d11('0x7b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x7d11('0x7d')](_0x269f3f)['then'](function(){return validateUser(_0x269f3f[0x0]);})['then'](function(){for(var _0x4ba3f6=0x1;_0x4ba3f6<_0x269f3f['length'];_0x4ba3f6++){var _0x526e65=_0x269f3f[_0x4ba3f6-0x1][_0x7d11('0x5d')];if(!_0x269f3f[_0x4ba3f6][_0x7d11('0x5d')])_0x269f3f[_0x4ba3f6][_0x7d11('0x5d')]=_0x526e65+0x1;_0x596228[_0x7d11('0x41')](validateUser(_0x269f3f[_0x4ba3f6]));}return BPromise[_0x7d11('0x49')](_0x596228);})[_0x7d11('0x17')](function(){_0x596228=[];for(var _0x1a2df6=0x0;_0x1a2df6<_0x269f3f[_0x7d11('0x67')];_0x1a2df6++){_0x596228[_0x7d11('0x41')](updateUser(_0x269f3f[_0x1a2df6]));}return BPromise['all'](_0x596228);})['then'](function(){return BPromise[_0x7d11('0x85')](_0x269f3f,function(_0x158e0f){return db['User']['create'](_0x158e0f,{'include':[{'model':db[_0x7d11('0x6b')],'as':_0x7d11('0x6b')}]})[_0x7d11('0x17')](function(_0x391d7){_0x158e0f['id']=_0x391d7['id'];return _0x158e0f;});});})['then'](function(_0x542596){if(_0x13ccd5['body'][_0x7d11('0x31')]===_0x7d11('0x7a'))return _0x542596;if(_0x13ccd5[_0x7d11('0x7a')]['role']!==_0x7d11('0x7a'))return _0x542596;var _0x238cfd=_['some'](_0x542596,function(_0x4aafef){return _0x4aafef[_0x7d11('0x31')]==='agent'||_0x4aafef['role']===_0x7d11('0x86');});if(!_0x238cfd)return _0x542596;return db[_0x7d11('0x80')]['findAll']({'where':{'name':{'$or':['Agents',_0x7d11('0x2d')]},'userProfileId':_0x13ccd5[_0x7d11('0x7a')][_0x7d11('0x7f')]},'raw':!![]})[_0x7d11('0x17')](function(_0x4af02c){if(_[_0x7d11('0x87')](_0x4af02c)||!_[_0x7d11('0x88')](_0x4af02c,[_0x7d11('0x81'),0x0]))return _0x542596;_0x596228=[];var _0x83416b=_(_0x4af02c)['map'](function(_0xdd679a){if(_0xdd679a[_0x7d11('0x81')]===0x1)return;return _0xdd679a[_0x7d11('0x34')]==='Agents'?_0x7d11('0x2c'):'telephone';})[_0x7d11('0x89')]()['value']();for(var _0x1a0e19=0x0;_0x1a0e19<_0x542596[_0x7d11('0x67')];_0x1a0e19++){if(!_[_0x7d11('0x30')](_0x83416b,_0x542596[_0x1a0e19][_0x7d11('0x31')]))return;var _0x38094f=_0x542596[_0x1a0e19][_0x7d11('0x31')]==='agent'?'Agents':_0x7d11('0x2d');_0x596228[_0x7d11('0x41')](db[_0x7d11('0x8a')][_0x7d11('0x79')]({'name':_0x542596[_0x1a0e19]['name'],'resourceId':_0x542596[_0x1a0e19]['id'],'type':_0x38094f,'sectionId':_[_0x7d11('0x55')](_0x4af02c,[_0x7d11('0x34'),_0x38094f])['id']},{}));}return BPromise[_0x7d11('0x49')](_0x596228);});})[_0x7d11('0x17')](respondWithResult(_0x1565d9,0xc9))['catch'](handleError(_0x1565d9,null));};exports[_0x7d11('0x8b')]=function(_0x2bac2a,_0x3aad38){if(_0x2bac2a[_0x7d11('0x58')]['id']){delete _0x2bac2a[_0x7d11('0x58')]['id'];}return db[_0x7d11('0x3d')]['find']({'where':{'id':_0x2bac2a[_0x7d11('0x4a')]['id']}})['then'](function(_0xe03909){if(!_0xe03909)return null;if(_0xe03909['id']===_0x2bac2a['user']['id']){if(!_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8c')]||!_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0x90'));}if(!_0xe03909[_0x7d11('0x91')](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8c')])){throw new db['Sequelize'][(_0x7d11('0x8f'))]('Wrong\x20credentials');}if(_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8c')]===_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x2bac2a[_0x7d11('0x7a')][_0x7d11('0x31')]==='admin'){if(!_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0x92'));}}else if(_0x2bac2a['user']['role']==='user'){if(!_0x2bac2a['body'][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))]['ValidationError'](_0x7d11('0x92'));}if(_0xe03909[_0x7d11('0x31')]!==_0x7d11('0x2c')){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0x83'));}}else{throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))]('Unauthorized');}return _0xe03909;})[_0x7d11('0x17')](handleEntityNotFound(_0x3aad38,null))[_0x7d11('0x17')](function(_0x54fd6a){return db[_0x7d11('0x5e')][_0x7d11('0x93')]({'attributes':['id',_0x7d11('0x60'),_0x7d11('0x94'),_0x7d11('0x95')]})[_0x7d11('0x17')](function(_0x1b8ad6){if(_0x1b8ad6[_0x7d11('0x60')])authService[_0x7d11('0x96')](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]);if(!_0x1b8ad6[_0x7d11('0x94')]||!_0x54fd6a['previousPasswords'])return _0x54fd6a;authService['validatePasswordHistory'](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')],_0x54fd6a[_0x7d11('0x97')],_0x1b8ad6['passwordHistoryLimit']);return _0x54fd6a;})[_0x7d11('0x17')](saveUpdates({'password':_0x2bac2a['body'][_0x7d11('0x8d')],'passwordResetAt':_0x2bac2a[_0x7d11('0x7a')]['id']==_0x2bac2a[_0x7d11('0x4a')]['id']?moment():null,'previousPasswords':authService[_0x7d11('0x98')](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')],_0x54fd6a[_0x7d11('0x97')])},null));})[_0x7d11('0x17')](respondWithResult(_0x3aad38,null))[_0x7d11('0x21')](handleError(_0x3aad38,null));};exports[_0x7d11('0x99')]=function(_0x358178,_0x460c72){var _0x2c3a17=_0x358178[_0x7d11('0x58')][_0x7d11('0x9a')];return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x358178[_0x7d11('0x4a')]['id']},'attributes':['id','name','role',_0x7d11('0x9b'),_0x7d11('0x9c'),_0x7d11('0x9d'),_0x7d11('0x9e')]})[_0x7d11('0x17')](handleEntityNotFound(_0x460c72,null))['then'](function(_0x59d543){if(_0x59d543){if(!utils['isValidChannel'](_0x2c3a17)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x59d543[_0x7d11('0x9f')+_[_0x7d11('0xa0')](_0x2c3a17[_0x7d11('0xa1')]())+_0x7d11('0xa2')](_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')],{'penalty':_0x358178[_0x7d11('0x58')][_0x7d11('0xa3')]||0x0})[_0x7d11('0xa4')](function(_0x1570be){for(var _0x4135f7=0x0;_0x4135f7<_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')]['length'];_0x4135f7+=0x1){var _0x51b469={'UserId':Number(_0x358178['params']['id'])};_0x51b469[_['capitalize'](_0x2c3a17['toLowerCase']())+_0x7d11('0xa5')]=Number(_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')][_0x4135f7]);socket[_0x7d11('0xa6')](_0x7d11('0x7a')+_[_0x7d11('0xa0')](_0x2c3a17[_0x7d11('0xa1')]())+_0x7d11('0xa7'),_0x51b469);}return _0x1570be;})[_0x7d11('0x17')](function(){if(_0x2c3a17===_0x7d11('0xa8')){return db['VoiceQueue'][_0x7d11('0xa9')]({'where':{'id':_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')]||[]},'raw':!![],'attributes':['id',_0x7d11('0x34')]});}})[_0x7d11('0x17')](function(_0x43a20c){var _0x53887c=_0x59d543[_0x7d11('0x29')]({'plain':!![]});var _0x25c8e4=[];if(_0x2c3a17===_0x7d11('0xa8')&&_0x53887c[_0x7d11('0x31')]==='agent'&&_0x53887c[_0x7d11('0x9b')]){for(var _0xbdc907=0x0;_0xbdc907<_0x43a20c['length'];_0xbdc907+=0x1){_0x25c8e4[_0x7d11('0x41')]({'membername':_0x53887c[_0x7d11('0x34')],'UserId':_0x53887c['id'],'queue_name':_0x43a20c[_0xbdc907][_0x7d11('0x34')],'VoiceQueueId':_0x43a20c[_0xbdc907]['id'],'interface':_['isNil'](_0x53887c[_0x7d11('0x9e')])?util[_0x7d11('0xaa')]('SIP/%s',_0x53887c[_0x7d11('0x34')]):_0x53887c[_0x7d11('0x9e')],'paused':_0x53887c[_0x7d11('0x9d')]||![],'penalty':_0x358178[_0x7d11('0x58')]['penalty']||0x0});}return BPromise['each'](_0x25c8e4,function(_0x83a280){return db[_0x7d11('0xab')][_0x7d11('0xac')](_0x83a280);});}return _0x59d543;});}})[_0x7d11('0x17')](respondWithStatusCode(_0x460c72,null))[_0x7d11('0x21')](handleError(_0x460c72,null));};exports['removeQueues']=function(_0x462e6b,_0x1398e8){var _0x45f8e0;return db[_0x7d11('0x3d')]['find']({'where':{'id':_0x462e6b[_0x7d11('0x4a')]['id']},'attributes':['id',_0x7d11('0x34'),_0x7d11('0x31')]})['then'](handleEntityNotFound(_0x1398e8,null))[_0x7d11('0x17')](function(_0x3fb52a){if(_0x3fb52a){_0x45f8e0=_0x3fb52a;if(!_0x462e6b[_0x7d11('0x3e')]['channel']||!utils[_0x7d11('0xad')](_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x9a')])){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0xae'));}return _0x3fb52a[_0x7d11('0xaf')+_['capitalize'](_0x462e6b[_0x7d11('0x3e')]['channel'][_0x7d11('0xa1')]())+_0x7d11('0xa2')](_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x5c')]);}})['then'](function(_0x2e4eac){if(_['isArray'](_0x462e6b['query'][_0x7d11('0x5c')])){for(var _0x1ebd24=0x0;_0x1ebd24<_0x462e6b['query'][_0x7d11('0x5c')]['length'];_0x1ebd24+=0x1){var _0x451e24={'UserId':Number(_0x462e6b['params']['id'])};_0x451e24[_['capitalize'](_0x462e6b[_0x7d11('0x3e')]['channel'][_0x7d11('0xa1')]())+_0x7d11('0xa5')]=Number(_0x462e6b['query'][_0x7d11('0x5c')][_0x1ebd24]);socket['emit']('user'+_[_0x7d11('0xa0')](_0x462e6b['query']['channel']['toLowerCase']())+_0x7d11('0xb0'),_0x451e24);}}else{var _0x451e24={'UserId':Number(_0x462e6b[_0x7d11('0x4a')]['id'])};_0x451e24[_[_0x7d11('0xa0')](_0x462e6b[_0x7d11('0x3e')]['channel'][_0x7d11('0xa1')]())+_0x7d11('0xa5')]=Number(_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x5c')]);socket[_0x7d11('0xa6')](_0x7d11('0x7a')+_['capitalize'](_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x9a')][_0x7d11('0xa1')]())+_0x7d11('0xb0'),_0x451e24);}return _0x2e4eac;})[_0x7d11('0x17')](function(){if(_0x462e6b[_0x7d11('0x3e')]['channel']===_0x7d11('0xa8')){return db[_0x7d11('0xab')][_0x7d11('0x32')]({'where':{'UserId':_0x462e6b['params']['id'],'VoiceQueueId':_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x5c')]},'individualHooks':!![]})[_0x7d11('0x17')](function(){return _0x45f8e0;});}return _0x45f8e0;})['then'](respondWithStatusCode(_0x1398e8,null))[_0x7d11('0x21')](handleError(_0x1398e8,null));};exports[_0x7d11('0xb1')]=function(_0x945c35,_0xd55b9b){_0x945c35[_0x7d11('0x58')]['userpic']=_0x945c35[_0x7d11('0xb2')][_0x7d11('0xb3')];return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x945c35[_0x7d11('0x4a')]['id']}})['then'](handleEntityNotFound(_0xd55b9b,null))['then'](saveUpdates(_0x945c35[_0x7d11('0x58')],null))[_0x7d11('0x17')](respondWithResult(_0xd55b9b,null))[_0x7d11('0x21')](handleError(_0xd55b9b,null));};exports[_0x7d11('0xb4')]=function(_0x388028,_0x3e8c11){var _0x3aceef=path[_0x7d11('0xb5')](config[_0x7d11('0xb6')],_0x7d11('0xb7'));return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x388028['params']['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x3e8c11,null))[_0x7d11('0x17')](function(_0x2ff073){if(_0x2ff073){if(_[_0x7d11('0x62')](_0x2ff073[_0x7d11('0xb8')])){return _0x3e8c11[_0x7d11('0xb9')](_0x3aceef);}else{if(!fs[_0x7d11('0xba')](path[_0x7d11('0xb5')](config[_0x7d11('0xb6')],_0x7d11('0xbb'),_0x2ff073['userpic']))){return _0x3e8c11[_0x7d11('0xb9')](_0x3aceef);}return _0x3e8c11[_0x7d11('0xb9')](path[_0x7d11('0xb5')](config['root'],_0x7d11('0xbb'),_0x2ff073[_0x7d11('0xb8')]));}}})[_0x7d11('0x21')](handleError(_0x3e8c11,null));};exports[_0x7d11('0xbc')]=function(_0x39c200,_0x250b96){return db['User'][_0x7d11('0x55')]({'where':{'id':_0x39c200['params']['id']},'attributes':['id']})[_0x7d11('0x17')](handleEntityNotFound(_0x250b96,null))[_0x7d11('0x17')](function(_0x248f58){var _0x1b65aa=[];values=_0x248f58[_0x7d11('0x46')];_0x1b65aa['push'](get_open_tabs('chat',_0x248f58['dataValues']));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x47'),_0x248f58[_0x7d11('0x46')]));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x56'),_0x248f58['dataValues']));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x48'),_0x248f58['dataValues']));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0xbd'),_0x248f58[_0x7d11('0x46')]));_0x1b65aa[_0x7d11('0x41')](get_open_tabs('mail',_0x248f58['dataValues']));return BPromise[_0x7d11('0x49')](_0x1b65aa);})['then'](function(_0x10890c){var _0x58e579=[];if(_0x10890c){for(var _0x3604e7=0x0;_0x3604e7=_0x30c05c[_0xd7b2('0x56')]){throw new Error(_0xd7b2('0x57'));}})[_0xd7b2('0x25')](function(){if(_0x138ca8){return db[_0xd7b2('0x41')][_0xd7b2('0x50')]({'where':{'membername':_0x138ca8[_0xd7b2('0x30')]},'individualHooks':!![]});}})[_0xd7b2('0x25')](function(){if(_0x138ca8){return _0x138ca8['getVoiceQueues']({'raw':!![]});}})[_0xd7b2('0x25')](function(_0x3a75dc){if(_0x138ca8){if(_0x3a75dc){var _0x2af249=[];_0x3c0ed3=_0x3a75dc;if(_0x3c0ed3[_0xd7b2('0x32')]){for(var _0x13e0be=0x0;_0x13e0be<_0x3c0ed3['length'];_0x13e0be++){_0x2af249['push'](db[_0xd7b2('0x41')][_0xd7b2('0x58')]({'membername':_0x138ca8['name'],'UserId':_0x138ca8['id'],'queue_name':_0x3c0ed3[_0x13e0be][_0xd7b2('0x30')],'VoiceQueueId':_0x3c0ed3[_0x13e0be]['id'],'interface':_0x2ebb72,'paused':_0x138ca8[_0xd7b2('0x51')]||![],'penalty':_0x3c0ed3[_0x13e0be]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x2af249);}}}})[_0xd7b2('0x25')](function(){if(_0x138ca8){return db[_0xd7b2('0x3a')]['findAll']({'where':{'membername':_0x138ca8[_0xd7b2('0x30')],'exitAt':null}});}})['then'](function(_0x366fba){if(_0x138ca8){if(_0x366fba&&_0x366fba[_0xd7b2('0x32')]){var _0x2aa4df=[];_0x366fba['forEach'](function(_0x4df44c){_0x2aa4df[_0xd7b2('0x4d')](_0x4df44c[_0xd7b2('0x2e')]({'exitAt':moment()[_0xd7b2('0x35')](_0xd7b2('0x33'))}));});return BPromise[_0xd7b2('0x4e')](_0x2aa4df);}}})[_0xd7b2('0x25')](function(_0x1f7c2e){if(_0x138ca8){var _0x433035=[];var _0x571999=[];var _0x3bbe88=utils[_0xd7b2('0x59')]();var _0x5cbafe={'membername':_0x138ca8['name'],'interface':_0x2ebb72,'enterAt':moment()[_0xd7b2('0x35')](_0xd7b2('0x33')),'role':_0x138ca8['role'],'internal':_0x138ca8[_0xd7b2('0x2c')]};_0x3bbe88[_0xd7b2('0x4c')](function(_0xa2722e){_0x433035['push'](_[_0xd7b2('0x5a')]({'channel':_0xa2722e,'type':_0xd7b2('0x5b'),'data1':_0xd7b2('0x5c'),'data2':_0x2ebb72},_0x5cbafe));if(_0x138ca8[_0xd7b2('0x51')]){_0x571999[_0xd7b2('0x4d')](_[_0xd7b2('0x5a')]({'channel':_0xa2722e,'type':'PAUSE','data1':_0xd7b2('0x5d')},_0x5cbafe));}});return db[_0xd7b2('0x3a')][_0xd7b2('0x3b')](_0x433035['concat'](_0x571999),{'individualHooks':!![]});}})['then'](function(){if(_0x138ca8){return _0x138ca8[_0xd7b2('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xd7b2('0x35')](_0xd7b2('0x33')),'voicePause':_0x138ca8[_0xd7b2('0x51')]||![],'mailPause':_0x138ca8[_0xd7b2('0x51')]||![],'chatPause':_0x138ca8[_0xd7b2('0x51')]||![],'faxPause':_0x138ca8[_0xd7b2('0x51')]||![],'smsPause':_0x138ca8[_0xd7b2('0x51')]||![],'openchannelPause':_0x138ca8['loginInPause']||![],'pauseType':_0x138ca8[_0xd7b2('0x51')]?_0xd7b2('0x5d'):null,'lastPauseAt':moment()[_0xd7b2('0x35')](_0xd7b2('0x33')),'interface':_0x2ebb72});}})['then'](function(_0x3fd9cf){_0x5df27f(_0x3fd9cf);})['catch'](function(_0x4ed89e){_0xbde9d0(_0x20242b[_0xd7b2('0x18')](0x1f4,_0x4ed89e[_0xd7b2('0x19')]));});});}; \ No newline at end of file +var _0x4d05=['Maximum\x20login\x20has\x20been\x20reached','loginInPause','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','concat','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./user.socket','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','User','findAll','options','raw','where','limit','include','map','attributes','model','GetUser','debug','ShowUser','find','role','interface','UserVoiceQueueRt','MemberReport','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','isNil','type','DEFAULT\x20PAUSE','internal','body','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','update','system','mail','chat','fax','sms','whatsapp','%s%s','Pause','all','LogoutUser','destroy','mobile','SIP/%s','agent','../../config/license/util','getLicense','agents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d05,0x1d1));var _0x54d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4d05[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x54d0('0x0'));var util=require(_0x54d0('0x1'));var moment=require('moment');var BPromise=require(_0x54d0('0x2'));var rs=require(_0x54d0('0x3'));var fs=require('fs');var Redis=require(_0x54d0('0x4'));var db=require(_0x54d0('0x5'))['db'];var utils=require(_0x54d0('0x6'));var logger=require('../../config/logger')(_0x54d0('0x7'));var config=require(_0x54d0('0x8'));var jayson=require(_0x54d0('0x9'));var client=jayson[_0x54d0('0xa')]['http']({'port':0x232a});config['redis']=_[_0x54d0('0xb')](config[_0x54d0('0xc')],{'host':_0x54d0('0xd'),'port':0x18eb});var socket=require(_0x54d0('0xe'))(new Redis(config[_0x54d0('0xc')]));require(_0x54d0('0xf'))['register'](socket);function respondWithRpcPromise(_0x40e79c,_0xabdf47,_0x5c3ce8){return new BPromise(function(_0x2334dc,_0x44966b){return client['request'](_0x40e79c,_0x5c3ce8)[_0x54d0('0x10')](function(_0x1e4f42){logger[_0x54d0('0x11')](_0x54d0('0x12'),_0xabdf47,_0x54d0('0x13'));logger['debug'](_0x54d0('0x14'),_0xabdf47,_0x54d0('0x13'),JSON[_0x54d0('0x15')](_0x1e4f42));if(_0x1e4f42['error']){if(_0x1e4f42[_0x54d0('0x16')][_0x54d0('0x17')]===0x1f4){logger[_0x54d0('0x16')](_0x54d0('0x12'),_0xabdf47,_0x1e4f42[_0x54d0('0x16')][_0x54d0('0x18')]);return _0x44966b(_0x1e4f42[_0x54d0('0x16')][_0x54d0('0x18')]);}logger['error']('User,\x20%s,\x20%s',_0xabdf47,_0x1e4f42['error'][_0x54d0('0x18')]);return _0x2334dc(_0x1e4f42['error'][_0x54d0('0x18')]);}else{logger[_0x54d0('0x11')](_0x54d0('0x12'),_0xabdf47,_0x54d0('0x13'));_0x2334dc(_0x1e4f42[_0x54d0('0x19')]['message']);}})[_0x54d0('0x1a')](function(_0xb3b097){logger[_0x54d0('0x16')](_0x54d0('0x12'),_0xabdf47,_0xb3b097);_0x44966b(_0xb3b097);});});}exports['GetUser']=function(_0x1e47a4){var _0x5c8533=this;return new Promise(function(_0x17ac76,_0x1237aa){return db[_0x54d0('0x1b')][_0x54d0('0x1c')]({'raw':_0x1e47a4['options']?_0x1e47a4[_0x54d0('0x1d')][_0x54d0('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e47a4['options']?_0x1e47a4[_0x54d0('0x1d')][_0x54d0('0x1f')]||null:null,'attributes':_0x1e47a4['options']?_0x1e47a4[_0x54d0('0x1d')]['attributes']||null:null,'limit':_0x1e47a4[_0x54d0('0x1d')]?_0x1e47a4['options'][_0x54d0('0x20')]||null:null,'include':_0x1e47a4['options']?_0x1e47a4[_0x54d0('0x1d')][_0x54d0('0x21')]?_[_0x54d0('0x22')](_0x1e47a4[_0x54d0('0x1d')][_0x54d0('0x21')],function(_0x66d005){return{'model':db[_0x66d005['model']],'as':_0x66d005['as'],'attributes':_0x66d005[_0x54d0('0x23')],'include':_0x66d005['include']?_[_0x54d0('0x22')](_0x66d005[_0x54d0('0x21')],function(_0x4ad0d9){return{'model':db[_0x4ad0d9[_0x54d0('0x24')]],'as':_0x4ad0d9['as'],'attributes':_0x4ad0d9['attributes'],'include':_0x4ad0d9['include']?_[_0x54d0('0x22')](_0x4ad0d9[_0x54d0('0x21')],function(_0x80154e){return{'model':db[_0x80154e[_0x54d0('0x24')]],'as':_0x80154e['as'],'attributes':_0x80154e[_0x54d0('0x23')]};}):[]};}):[]};}):[]:[]})[_0x54d0('0x10')](function(_0x4d74db){logger[_0x54d0('0x11')](_0x54d0('0x25'),_0x1e47a4);logger[_0x54d0('0x26')](_0x54d0('0x25'),_0x1e47a4,JSON[_0x54d0('0x15')](_0x4d74db));_0x17ac76(_0x4d74db);})[_0x54d0('0x1a')](function(_0x13c591){logger[_0x54d0('0x16')]('GetUser',_0x13c591['message'],_0x1e47a4);_0x1237aa(_0x5c8533[_0x54d0('0x16')](0x1f4,_0x13c591[_0x54d0('0x18')]));});});};exports['ShowUser']=function(_0x214be7){var _0x21e708=this;return new Promise(function(_0xf2ac8a,_0x11089c){return db['User']['find']({'raw':_0x214be7['options']?_0x214be7['options'][_0x54d0('0x1e')]===undefined?!![]:![]:!![],'where':_0x214be7[_0x54d0('0x1d')]?_0x214be7[_0x54d0('0x1d')][_0x54d0('0x1f')]||null:null,'attributes':_0x214be7[_0x54d0('0x1d')]?_0x214be7['options'][_0x54d0('0x23')]||null:null,'include':_0x214be7[_0x54d0('0x1d')]?_0x214be7[_0x54d0('0x1d')][_0x54d0('0x21')]?_[_0x54d0('0x22')](_0x214be7[_0x54d0('0x1d')][_0x54d0('0x21')],function(_0x24471e){return{'model':db[_0x24471e[_0x54d0('0x24')]],'as':_0x24471e['as'],'attributes':_0x24471e[_0x54d0('0x23')],'include':_0x24471e[_0x54d0('0x21')]?_[_0x54d0('0x22')](_0x24471e[_0x54d0('0x21')],function(_0x331dd5){return{'model':db[_0x331dd5[_0x54d0('0x24')]],'as':_0x331dd5['as'],'attributes':_0x331dd5['attributes'],'include':_0x331dd5[_0x54d0('0x21')]?_['map'](_0x331dd5['include'],function(_0x1b3420){return{'model':db[_0x1b3420[_0x54d0('0x24')]],'as':_0x1b3420['as'],'attributes':_0x1b3420[_0x54d0('0x23')]};}):[]};}):[]};}):[]:[]})[_0x54d0('0x10')](function(_0x386abf){logger[_0x54d0('0x11')](_0x54d0('0x27'),_0x214be7);logger[_0x54d0('0x26')](_0x54d0('0x27'),_0x214be7,JSON[_0x54d0('0x15')](_0x386abf));_0xf2ac8a(_0x386abf);})[_0x54d0('0x1a')](function(_0x1aa05b){logger[_0x54d0('0x16')](_0x54d0('0x27'),_0x1aa05b['message'],_0x214be7);_0x11089c(_0x21e708['error'](0x1f4,_0x1aa05b['message']));});});};exports['PauseUser']=function(_0x13ed43){var _0x4365f2=this;return new Promise(function(_0x3847a1,_0x1ac3d8){var _0x3435f8;return db['User'][_0x54d0('0x28')]({'where':_0x13ed43[_0x54d0('0x1d')][_0x54d0('0x1f')]||{},'attributes':['id','name',_0x54d0('0x29'),'internal',_0x54d0('0x2a')]})[_0x54d0('0x10')](function(_0x2a5fd0){if(_0x2a5fd0){_0x3435f8=_0x2a5fd0;return db[_0x54d0('0x2b')]['update']({'paused':0x1},{'where':{'UserId':_0x3435f8['id']},'individualHooks':!![]});}})[_0x54d0('0x10')](function(){if(_0x3435f8){return db[_0x54d0('0x2c')][_0x54d0('0x1c')]({'where':{'membername':_0x3435f8[_0x54d0('0x2d')],'type':_0x54d0('0x2e'),'exitAt':null}});}})[_0x54d0('0x10')](function(_0x2dbb9e){if(_0x3435f8){if(_0x2dbb9e&&_0x2dbb9e[_0x54d0('0x2f')]){var _0xf9cc9a=moment()[_0x54d0('0x30')](_0x54d0('0x31'));for(var _0x3bc8c1=0x0,_0x1f5cf7=_0x2dbb9e[_0x54d0('0x2f')];_0x3bc8c1<_0x1f5cf7;_0x3bc8c1++){_0x2dbb9e[_0x3bc8c1][_0x54d0('0x32')]({'exitAt':_0xf9cc9a});}}}})[_0x54d0('0x10')](function(){if(_0x3435f8){var _0x46e00c=[];var _0x17fc49=utils['getChannels']();_0x17fc49[_0x54d0('0x33')](function(_0x505638){_0x46e00c[_0x54d0('0x34')]({'channel':_0x505638,'membername':_0x3435f8['name'],'interface':_[_0x54d0('0x35')](_0x3435f8[_0x54d0('0x2a')])?util[_0x54d0('0x30')]('SIP/%s',_0x3435f8[_0x54d0('0x2d')]):_0x3435f8[_0x54d0('0x2a')],'type':_0x54d0('0x2e'),'enterAt':moment()['format'](_0x54d0('0x31')),'data1':_0x13ed43['body'][_0x54d0('0x36')]||_0x54d0('0x37'),'role':_0x3435f8[_0x54d0('0x29')],'internal':_0x3435f8[_0x54d0('0x38')],'uniqueid':_0x13ed43[_0x54d0('0x39')]['uniqueid']||null});});return db[_0x54d0('0x2c')]['bulkCreate'](_0x46e00c,{'individualHooks':!![]});}})[_0x54d0('0x10')](function(){if(_0x3435f8){return _0x3435f8['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x13ed43[_0x54d0('0x39')][_0x54d0('0x36')]||_0x54d0('0x37'),'lastPauseAt':moment()[_0x54d0('0x30')](_0x54d0('0x31'))});}})['then'](function(_0x2dba20){_0x3847a1(_0x2dba20);})[_0x54d0('0x1a')](function(_0x462787){_0x1ac3d8(_0x4365f2[_0x54d0('0x16')](0x1f4,_0x462787[_0x54d0('0x18')]));});});};exports[_0x54d0('0x3a')]=function(_0x48583f){var _0x43da68=this;return new Promise(function(_0x284e0f,_0x4c40e7){var _0x1aa685;return db[_0x54d0('0x1b')][_0x54d0('0x3b')]({'where':_0x48583f[_0x54d0('0x1d')][_0x54d0('0x1f')]||{},'attributes':['id',_0x54d0('0x2d')]})['then'](function(_0x433e2e){if(_0x433e2e){_0x1aa685=_0x433e2e;if(_0x48583f[_0x54d0('0x39')][_0x54d0('0x3c')]&&!utils[_0x54d0('0x3d')](_0x48583f[_0x54d0('0x39')]['channel'])){throw new Error(_0x54d0('0x3e'));}switch(_0x48583f[_0x54d0('0x39')][_0x54d0('0x3c')]){case'voice':return db[_0x54d0('0x2b')][_0x54d0('0x3f')]({'paused':0x0},{'where':{'UserId':_0x1aa685['id']}})[_0x54d0('0x10')](function(){return db[_0x54d0('0x2c')][_0x54d0('0x28')]({'where':{'channel':_0x48583f['body'][_0x54d0('0x3c')],'membername':_0x1aa685[_0x54d0('0x2d')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x5ab107){if(_0x5ab107){return _0x5ab107['update']({'exitAt':moment()[_0x54d0('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x54d0('0x40')},{'individualHooks':!![]});}return null;})[_0x54d0('0x10')](function(){return _0x1aa685['update']({'voicePause':![]});});case _0x54d0('0x41'):case _0x54d0('0x42'):case _0x54d0('0x43'):case _0x54d0('0x44'):case'openchannel':case _0x54d0('0x45'):return db[_0x54d0('0x2c')]['find']({'where':{'channel':_0x48583f[_0x54d0('0x39')]['channel'],'membername':_0x1aa685[_0x54d0('0x2d')],'type':_0x54d0('0x2e'),'exitAt':null}})['then'](function(_0x3d0e44){return _0x3d0e44['update']({'exitAt':moment()[_0x54d0('0x30')](_0x54d0('0x31')),'data2':_0x54d0('0x40')},{'individualHooks':!![]});})[_0x54d0('0x10')](function(){var _0x16e80e={};_['set'](_0x16e80e,util[_0x54d0('0x30')](_0x54d0('0x46'),_0x48583f[_0x54d0('0x39')]['channel'],_0x54d0('0x47')),![]);return _0x1aa685['update'](_0x16e80e);});default:return db[_0x54d0('0x2b')]['update']({'paused':0x0},{'where':{'UserId':_0x1aa685['id']}})[_0x54d0('0x10')](function(){return db['MemberReport'][_0x54d0('0x1c')]({'where':{'membername':_0x1aa685[_0x54d0('0x2d')],'type':'PAUSE','exitAt':null}});})[_0x54d0('0x10')](function(_0x20f625){var _0x3ef734=[];_0x20f625['forEach'](function(_0x13adae){_0x3ef734[_0x54d0('0x34')](_0x13adae['update']({'exitAt':moment()[_0x54d0('0x30')](_0x54d0('0x31')),'data2':_0x54d0('0x40')}));});return BPromise[_0x54d0('0x48')](_0x3ef734);})[_0x54d0('0x10')](function(){return _0x1aa685[_0x54d0('0x3f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x54d0('0x10')](function(_0x5d3d6f){_0x284e0f(_0x5d3d6f);})['catch'](function(_0x3a7fa6){_0x4c40e7(_0x43da68[_0x54d0('0x16')](0x1f4,_0x3a7fa6['message']));});});};exports[_0x54d0('0x49')]=function(_0x1d5768){var _0x1ce957=this;return new Promise(function(_0xb01c17,_0x3c2317){var _0x15e4fb;return db[_0x54d0('0x1b')][_0x54d0('0x3b')]({'where':_0x1d5768[_0x54d0('0x1d')]['where']||{},'attributes':['id',_0x54d0('0x2d')]})[_0x54d0('0x10')](function(_0xe23882){if(_0xe23882){_0x15e4fb=_0xe23882;return db['UserVoiceQueueRt'][_0x54d0('0x4a')]({'where':{'membername':_0x15e4fb['name']},'individualHooks':!![]});}})['then'](function(){if(_0x15e4fb){return db['MemberReport']['findAll']({'where':{'membername':_0x15e4fb['name'],'exitAt':null}});}})[_0x54d0('0x10')](function(_0x49be3d){if(_0x15e4fb){if(_0x49be3d&&_0x49be3d[_0x54d0('0x2f')]){var _0x20e711=[];_0x49be3d['forEach'](function(_0x5d3b9e){_0x20e711[_0x54d0('0x34')](_0x5d3b9e[_0x54d0('0x3f')]({'exitAt':moment()['format'](_0x54d0('0x31'))}));});return BPromise[_0x54d0('0x48')](_0x20e711);}}})[_0x54d0('0x10')](function(){if(_0x15e4fb){return _0x15e4fb[_0x54d0('0x3f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x54d0('0x10')](function(_0x190099){_0xb01c17(_0x190099);})[_0x54d0('0x1a')](function(_0x3501b5){_0x3c2317(_0x1ce957[_0x54d0('0x16')](0x1f4,_0x3501b5['message']));});});};exports['LoginUser']=function(_0x38ef75){var _0x41bba9=this;return new Promise(function(_0x2b076c,_0x14b221){var _0x20d412;var _0x6bdb33;var _0x3fb1eb;var _0x31b743;return db[_0x54d0('0x1b')][_0x54d0('0x3b')]({'where':_0x38ef75[_0x54d0('0x1d')][_0x54d0('0x1f')]||{},'attributes':['id',_0x54d0('0x2d'),'role',_0x54d0('0x4b'),'phone',_0x54d0('0x38'),'loginInPause',_0x54d0('0x2a')]})[_0x54d0('0x10')](function(_0x536233){if(_0x536233){_0x20d412=_0x536233;_0x31b743=_0x38ef75['body'][_0x54d0('0x2a')]?_0x38ef75[_0x54d0('0x39')][_0x54d0('0x2a')]:util[_0x54d0('0x30')](_0x54d0('0x4c'),_0x20d412[_0x54d0('0x2d')]);return db[_0x54d0('0x1b')]['count']({'where':{'role':_0x54d0('0x4d'),'online':!![],'id':{'$ne':_0x20d412['id']}}});}})['then'](function(_0x89bdb5){if(_0x89bdb5){_0x3fb1eb=_0x89bdb5;return require(_0x54d0('0x4e'))[_0x54d0('0x4f')]();}})[_0x54d0('0x10')](function(_0x21ca0b){if(_0x21ca0b&&_0x21ca0b[_0x54d0('0x50')]&&_0x3fb1eb>=_0x21ca0b['agents']){throw new Error(_0x54d0('0x51'));}})[_0x54d0('0x10')](function(){if(_0x20d412){return db['UserVoiceQueueRt'][_0x54d0('0x4a')]({'where':{'membername':_0x20d412[_0x54d0('0x2d')]},'individualHooks':!![]});}})['then'](function(){if(_0x20d412){return _0x20d412['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x1561b2){if(_0x20d412){if(_0x1561b2){var _0x40f047=[];_0x6bdb33=_0x1561b2;if(_0x6bdb33[_0x54d0('0x2f')]){for(var _0xc146b8=0x0;_0xc146b8<_0x6bdb33[_0x54d0('0x2f')];_0xc146b8++){_0x40f047['push'](db[_0x54d0('0x2b')]['upsert']({'membername':_0x20d412[_0x54d0('0x2d')],'UserId':_0x20d412['id'],'queue_name':_0x6bdb33[_0xc146b8]['name'],'VoiceQueueId':_0x6bdb33[_0xc146b8]['id'],'interface':_0x31b743,'paused':_0x20d412[_0x54d0('0x52')]||![],'penalty':_0x6bdb33[_0xc146b8][_0x54d0('0x53')]||0x0}));}return BPromise[_0x54d0('0x48')](_0x40f047);}}}})[_0x54d0('0x10')](function(){if(_0x20d412){return db[_0x54d0('0x2c')][_0x54d0('0x1c')]({'where':{'membername':_0x20d412[_0x54d0('0x2d')],'exitAt':null}});}})['then'](function(_0x3cf5b9){if(_0x20d412){if(_0x3cf5b9&&_0x3cf5b9[_0x54d0('0x2f')]){var _0x4523f8=[];_0x3cf5b9['forEach'](function(_0x136ac2){_0x4523f8[_0x54d0('0x34')](_0x136ac2[_0x54d0('0x3f')]({'exitAt':moment()['format'](_0x54d0('0x31'))}));});return BPromise[_0x54d0('0x48')](_0x4523f8);}}})[_0x54d0('0x10')](function(_0x39090c){if(_0x20d412){var _0x28988e=[];var _0x3ffa3a=[];var _0x4945c5=utils[_0x54d0('0x54')]();var _0x2d426b={'membername':_0x20d412[_0x54d0('0x2d')],'interface':_0x31b743,'enterAt':moment()[_0x54d0('0x30')](_0x54d0('0x31')),'role':_0x20d412[_0x54d0('0x29')],'internal':_0x20d412['internal']};_0x4945c5[_0x54d0('0x33')](function(_0x51bd4f){_0x28988e[_0x54d0('0x34')](_[_0x54d0('0x55')]({'channel':_0x51bd4f,'type':_0x54d0('0x56'),'data1':_0x54d0('0x57'),'data2':_0x31b743},_0x2d426b));if(_0x20d412[_0x54d0('0x52')]){_0x3ffa3a['push'](_[_0x54d0('0x55')]({'channel':_0x51bd4f,'type':_0x54d0('0x2e'),'data1':_0x54d0('0x58')},_0x2d426b));}});return db[_0x54d0('0x2c')][_0x54d0('0x59')](_0x28988e[_0x54d0('0x5a')](_0x3ffa3a),{'individualHooks':!![]});}})[_0x54d0('0x10')](function(){if(_0x20d412){return _0x20d412['update']({'online':!![],'lastLoginAt':moment()[_0x54d0('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x20d412[_0x54d0('0x52')]||![],'mailPause':_0x20d412[_0x54d0('0x52')]||![],'chatPause':_0x20d412[_0x54d0('0x52')]||![],'faxPause':_0x20d412[_0x54d0('0x52')]||![],'smsPause':_0x20d412[_0x54d0('0x52')]||![],'openchannelPause':_0x20d412[_0x54d0('0x52')]||![],'pauseType':_0x20d412[_0x54d0('0x52')]?_0x54d0('0x58'):null,'lastPauseAt':moment()[_0x54d0('0x30')](_0x54d0('0x31')),'interface':_0x31b743});}})[_0x54d0('0x10')](function(_0x2a0c9e){_0x2b076c(_0x2a0c9e);})['catch'](function(_0x492815){_0x14b221(_0x41bba9[_0x54d0('0x16')](0x1f4,_0x492815['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index bd00dd5..68acbac 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 _0x2409=['register','length','user:','./user.events','remove','update','emit','removeListener'];(function(_0x265cb0,_0x2c73d1){var _0x350d98=function(_0x1c6861){while(--_0x1c6861){_0x265cb0['push'](_0x265cb0['shift']());}};_0x350d98(++_0x2c73d1);}(_0x2409,0x8b));var _0x9240=function(_0x408de0,_0x10f2bd){_0x408de0=_0x408de0-0x0;var _0x240762=_0x2409[_0x408de0];return _0x240762;};'use strict';var UserEvents=require(_0x9240('0x0'));var events=['save',_0x9240('0x1'),_0x9240('0x2')];function createListener(_0x142981,_0xe365cd){return function(_0x4f8853){_0xe365cd[_0x9240('0x3')](_0x142981,_0x4f8853);};}function removeListener(_0x4bf459,_0xd1c905){return function(){UserEvents[_0x9240('0x4')](_0x4bf459,_0xd1c905);};}exports[_0x9240('0x5')]=function(_0x32240e){for(var _0x5879b5=0x0,_0x47d79c=events[_0x9240('0x6')];_0x5879b5<_0x47d79c;_0x5879b5++){var _0x46259d=events[_0x5879b5];var _0x2e05aa=createListener(_0x9240('0x7')+_0x46259d,_0x32240e);UserEvents['on'](_0x46259d,_0x2e05aa);}}; \ No newline at end of file +var _0x695e=['removeListener','register','length','user:','./user.events','save','remove','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x695e,0x94));var _0xe695=function(_0x2d7712,_0x39aba4){_0x2d7712=_0x2d7712-0x0;var _0x2efa08=_0x695e[_0x2d7712];return _0x2efa08;};'use strict';var UserEvents=require(_0xe695('0x0'));var events=[_0xe695('0x1'),_0xe695('0x2'),_0xe695('0x3')];function createListener(_0x4fa15e,_0x3d2797){return function(_0x2290b1){_0x3d2797[_0xe695('0x4')](_0x4fa15e,_0x2290b1);};}function removeListener(_0x99ba3d,_0x602df3){return function(){UserEvents[_0xe695('0x5')](_0x99ba3d,_0x602df3);};}exports[_0xe695('0x6')]=function(_0x348d08){for(var _0xd0b8a0=0x0,_0x306825=events[_0xe695('0x7')];_0xd0b8a0<_0x306825;_0xd0b8a0++){var _0x79a5df=events[_0xd0b8a0];var _0x375b1f=createListener(_0xe695('0x8')+_0x79a5df,_0x348d08);UserEvents['on'](_0x79a5df,_0x375b1f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 4db6ee6..03a61a4 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(_0x290232,_0x1e8ebd){var _0x3b2a32=function(_0x2de30e){while(--_0x2de30e){_0x290232['push'](_0x290232['shift']());}};_0x3b2a32(++_0x1e8ebd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1ad39c,_0x4b13b0){var _0x22fa19=function(_0x272c8a){while(--_0x272c8a){_0x1ad39c['push'](_0x1ad39c['shift']());}};_0x22fa19(++_0x4b13b0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index eff40ea..d848811 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 _0xf24f=['sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf24f,0x192));var _0xff24=function(_0x39bfb6,_0x4272c8){_0x39bfb6=_0x39bfb6-0x0;var _0x23fef9=_0xf24f[_0x39bfb6];return _0x23fef9;};'use strict';var Sequelize=require(_0xff24('0x0'));module[_0xff24('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xce0a=['INTEGER'];(function(_0x2cd04b,_0xd130f9){var _0x213da5=function(_0x2e0e68){while(--_0x2e0e68){_0x2cd04b['push'](_0x2cd04b['shift']());}};_0x213da5(++_0xd130f9);}(_0xce0a,0xbb));var _0xace0=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0xce0a[_0x34e752];return _0x7c6347;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xace0('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index b6000d0..c38c89e 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 _0x3862=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3862,0x7f));var _0x2386=function(_0x1e8b1e,_0x407bbd){_0x1e8b1e=_0x1e8b1e-0x0;var _0x4a0fde=_0x3862[_0x1e8b1e];return _0x4a0fde;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2386('0x0'))(_0x2386('0x1'));var moment=require(_0x2386('0x2'));var BPromise=require(_0x2386('0x3'));var rp=require(_0x2386('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2386('0x5'));var config=require(_0x2386('0x6'));var attributes=require(_0x2386('0x7'));module[_0x2386('0x8')]=function(_0x4d9bf6,_0x1b5d93){return _0x4d9bf6[_0x2386('0x9')]('UserChatQueue',attributes,{'tableName':_0x2386('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc99f=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc99f,0x1e6));var _0xfc99=function(_0x207114,_0x25902e){_0x207114=_0x207114-0x0;var _0x14d3b4=_0xc99f[_0x207114];return _0x14d3b4;};'use strict';var _=require(_0xfc99('0x0'));var util=require(_0xfc99('0x1'));var logger=require(_0xfc99('0x2'))('api');var moment=require(_0xfc99('0x3'));var BPromise=require(_0xfc99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc99('0x5'));var config=require(_0xfc99('0x6'));var attributes=require(_0xfc99('0x7'));module[_0xfc99('0x8')]=function(_0x133c5d,_0x14b045){return _0x133c5d[_0xfc99('0x9')](_0xfc99('0xa'),attributes,{'tableName':_0xfc99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 589c6c6..594e1fc 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 _0x7daa=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x1c9f90,_0x538898){var _0x2e0c4c=function(_0x458786){while(--_0x458786){_0x1c9f90['push'](_0x1c9f90['shift']());}};_0x2e0c4c(++_0x538898);}(_0x7daa,0x152));var _0xa7da=function(_0x23ee83,_0x4d639e){_0x23ee83=_0x23ee83-0x0;var _0x1b3b10=_0x7daa[_0x23ee83];return _0x1b3b10;};'use strict';var _=require(_0xa7da('0x0'));var util=require(_0xa7da('0x1'));var moment=require('moment');var BPromise=require(_0xa7da('0x2'));var rs=require(_0xa7da('0x3'));var fs=require('fs');var Redis=require(_0xa7da('0x4'));var db=require(_0xa7da('0x5'))['db'];var utils=require(_0xa7da('0x6'));var logger=require(_0xa7da('0x7'))(_0xa7da('0x8'));var config=require(_0xa7da('0x9'));var jayson=require(_0xa7da('0xa'));var client=jayson[_0xa7da('0xb')][_0xa7da('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d7eba,_0x53c0c6,_0x133c12){return new BPromise(function(_0x2c1a9e,_0x40519a){return client[_0xa7da('0xd')](_0x4d7eba,_0x133c12)['then'](function(_0x3a17e6){logger['info'](_0xa7da('0xe'),_0x53c0c6,_0xa7da('0xf'));logger[_0xa7da('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x53c0c6,_0xa7da('0xf'),JSON[_0xa7da('0x11')](_0x3a17e6));if(_0x3a17e6[_0xa7da('0x12')]){if(_0x3a17e6['error'][_0xa7da('0x13')]===0x1f4){logger[_0xa7da('0x12')](_0xa7da('0xe'),_0x53c0c6,_0x3a17e6[_0xa7da('0x12')][_0xa7da('0x14')]);return _0x40519a(_0x3a17e6[_0xa7da('0x12')]['message']);}logger[_0xa7da('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x53c0c6,_0x3a17e6[_0xa7da('0x12')][_0xa7da('0x14')]);return _0x2c1a9e(_0x3a17e6[_0xa7da('0x12')][_0xa7da('0x14')]);}else{logger[_0xa7da('0x15')](_0xa7da('0xe'),_0x53c0c6,_0xa7da('0xf'));_0x2c1a9e(_0x3a17e6[_0xa7da('0x16')]['message']);}})[_0xa7da('0x17')](function(_0x324326){logger['error'](_0xa7da('0xe'),_0x53c0c6,_0x324326);_0x40519a(_0x324326);});});} \ No newline at end of file +var _0xe339=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x56b056,_0x2a557f){var _0x4536d1=function(_0x47ca71){while(--_0x47ca71){_0x56b056['push'](_0x56b056['shift']());}};_0x4536d1(++_0x2a557f);}(_0xe339,0x169));var _0x9e33=function(_0x1a13b1,_0x4d1d25){_0x1a13b1=_0x1a13b1-0x0;var _0x395e05=_0xe339[_0x1a13b1];return _0x395e05;};'use strict';var _=require(_0x9e33('0x0'));var util=require(_0x9e33('0x1'));var moment=require(_0x9e33('0x2'));var BPromise=require(_0x9e33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e33('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e33('0x5'))('rpc');var config=require(_0x9e33('0x6'));var jayson=require(_0x9e33('0x7'));var client=jayson[_0x9e33('0x8')][_0x9e33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ea33d,_0x310691,_0x533f2d){return new BPromise(function(_0x54f729,_0x152a0f){return client[_0x9e33('0xa')](_0x3ea33d,_0x533f2d)[_0x9e33('0xb')](function(_0x4ce9a7){logger[_0x9e33('0xc')](_0x9e33('0xd'),_0x310691,_0x9e33('0xe'));logger[_0x9e33('0xf')](_0x9e33('0x10'),_0x310691,_0x9e33('0xe'),JSON[_0x9e33('0x11')](_0x4ce9a7));if(_0x4ce9a7[_0x9e33('0x12')]){if(_0x4ce9a7[_0x9e33('0x12')]['code']===0x1f4){logger['error'](_0x9e33('0xd'),_0x310691,_0x4ce9a7[_0x9e33('0x12')][_0x9e33('0x13')]);return _0x152a0f(_0x4ce9a7[_0x9e33('0x12')]['message']);}logger[_0x9e33('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x310691,_0x4ce9a7['error'][_0x9e33('0x13')]);return _0x54f729(_0x4ce9a7['error']['message']);}else{logger[_0x9e33('0xc')](_0x9e33('0xd'),_0x310691,_0x9e33('0xe'));_0x54f729(_0x4ce9a7[_0x9e33('0x14')]['message']);}})[_0x9e33('0x15')](function(_0x12127c){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x310691,_0x12127c);_0x152a0f(_0x12127c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index bf379b9..44f18d9 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x50776d,_0x21cfb4){var _0x53579a=function(_0x1dc6fa){while(--_0x1dc6fa){_0x50776d['push'](_0x50776d['shift']());}};_0x53579a(++_0x21cfb4);}(_0xe706,0xa3));var _0x6e70=function(_0x5480e7,_0x2a6133){_0x5480e7=_0x5480e7-0x0;var _0x30eabf=_0xe706[_0x5480e7];return _0x30eabf;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x51f2c0,_0xb7c46e){var _0x34ffd5=function(_0x2238c0){while(--_0x2238c0){_0x51f2c0['push'](_0x51f2c0['shift']());}};_0x34ffd5(++_0xb7c46e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 2ae7812..b76e382 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 _0xf732=['INTEGER','STRING','sequelize','exports'];(function(_0x95860d,_0x19e303){var _0xbd5e42=function(_0x1f8bac){while(--_0x1f8bac){_0x95860d['push'](_0x95860d['shift']());}};_0xbd5e42(++_0x19e303);}(_0xf732,0x12e));var _0x2f73=function(_0x2159e6,_0x55c285){_0x2159e6=_0x2159e6-0x0;var _0x355dbb=_0xf732[_0x2159e6];return _0x355dbb;};'use strict';var Sequelize=require(_0x2f73('0x0'));module[_0x2f73('0x1')]={'penalty':{'type':Sequelize[_0x2f73('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2f73('0x3')]}}; \ No newline at end of file +var _0x1c0d=['STRING','exports','INTEGER'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x1c0d,0x8e));var _0xd1c0=function(_0x1237dc,_0x1f9831){_0x1237dc=_0x1237dc-0x0;var _0x4e65e3=_0x1c0d[_0x1237dc];return _0x4e65e3;};'use strict';var Sequelize=require('sequelize');module[_0xd1c0('0x0')]={'penalty':{'type':Sequelize[_0xd1c0('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd1c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index f9fcd4a..20d8e3c 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 _0xc56b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','UserFaxQueue','lodash'];(function(_0x405dc0,_0x5f2898){var _0x1ed46d=function(_0x5efad7){while(--_0x5efad7){_0x405dc0['push'](_0x405dc0['shift']());}};_0x1ed46d(++_0x5f2898);}(_0xc56b,0x13e));var _0xbc56=function(_0x5a6b0e,_0x32912d){_0x5a6b0e=_0x5a6b0e-0x0;var _0x274090=_0xc56b[_0x5a6b0e];return _0x274090;};'use strict';var _=require(_0xbc56('0x0'));var util=require('util');var logger=require(_0xbc56('0x1'))(_0xbc56('0x2'));var moment=require(_0xbc56('0x3'));var BPromise=require(_0xbc56('0x4'));var rp=require(_0xbc56('0x5'));var fs=require('fs');var path=require(_0xbc56('0x6'));var rimraf=require(_0xbc56('0x7'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xbc56('0x8')]=function(_0x42b293,_0x3d8ad1){return _0x42b293[_0xbc56('0x9')](_0xbc56('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0568=['exports','define','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x242181,_0x1ba64b){var _0x949b7f=function(_0x11ffc3){while(--_0x11ffc3){_0x242181['push'](_0x242181['shift']());}};_0x949b7f(++_0x1ba64b);}(_0x0568,0x86));var _0x8056=function(_0x40cd86,_0x5920ff){_0x40cd86=_0x40cd86-0x0;var _0x22d8a3=_0x0568[_0x40cd86];return _0x22d8a3;};'use strict';var _=require('lodash');var util=require(_0x8056('0x0'));var logger=require('../../config/logger')(_0x8056('0x1'));var moment=require(_0x8056('0x2'));var BPromise=require(_0x8056('0x3'));var rp=require(_0x8056('0x4'));var fs=require('fs');var path=require(_0x8056('0x5'));var rimraf=require(_0x8056('0x6'));var config=require(_0x8056('0x7'));var attributes=require(_0x8056('0x8'));module[_0x8056('0x9')]=function(_0x54d77f,_0x4151f3){return _0x54d77f[_0x8056('0xa')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 2cac4af..18fa918 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 _0xfe8a=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x79e32a,_0x1d3a86){var _0x5d1f3f=function(_0x2e28c2){while(--_0x2e28c2){_0x79e32a['push'](_0x79e32a['shift']());}};_0x5d1f3f(++_0x1d3a86);}(_0xfe8a,0x1e0));var _0xafe8=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xfe8a[_0x3f0b30];return _0x2748a5;};'use strict';var _=require(_0xafe8('0x0'));var util=require(_0xafe8('0x1'));var moment=require(_0xafe8('0x2'));var BPromise=require(_0xafe8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafe8('0x4'));var db=require(_0xafe8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xafe8('0x6'))(_0xafe8('0x7'));var config=require(_0xafe8('0x8'));var jayson=require(_0xafe8('0x9'));var client=jayson['client'][_0xafe8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x295abd,_0x4e3987,_0x559f6d){return new BPromise(function(_0x3d5d0d,_0x8a4ce8){return client['request'](_0x295abd,_0x559f6d)[_0xafe8('0xb')](function(_0x246edd){logger[_0xafe8('0xc')](_0xafe8('0xd'),_0x4e3987,_0xafe8('0xe'));logger[_0xafe8('0xf')](_0xafe8('0x10'),_0x4e3987,'request\x20sent',JSON[_0xafe8('0x11')](_0x246edd));if(_0x246edd['error']){if(_0x246edd[_0xafe8('0x12')][_0xafe8('0x13')]===0x1f4){logger[_0xafe8('0x12')](_0xafe8('0xd'),_0x4e3987,_0x246edd[_0xafe8('0x12')][_0xafe8('0x14')]);return _0x8a4ce8(_0x246edd[_0xafe8('0x12')][_0xafe8('0x14')]);}logger['error'](_0xafe8('0xd'),_0x4e3987,_0x246edd['error'][_0xafe8('0x14')]);return _0x3d5d0d(_0x246edd[_0xafe8('0x12')][_0xafe8('0x14')]);}else{logger[_0xafe8('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x4e3987,_0xafe8('0xe'));_0x3d5d0d(_0x246edd['result'][_0xafe8('0x14')]);}})[_0xafe8('0x15')](function(_0x181d82){logger[_0xafe8('0x12')](_0xafe8('0xd'),_0x4e3987,_0x181d82);_0x8a4ce8(_0x181d82);});});} \ No newline at end of file +var _0x020e=['code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4a3d64,_0x1d5806){var _0x32e223=function(_0x4901d8){while(--_0x4901d8){_0x4a3d64['push'](_0x4a3d64['shift']());}};_0x32e223(++_0x1d5806);}(_0x020e,0x1c7));var _0xe020=function(_0xbfb2b5,_0x2ad9f1){_0xbfb2b5=_0xbfb2b5-0x0;var _0x105957=_0x020e[_0xbfb2b5];return _0x105957;};'use strict';var _=require(_0xe020('0x0'));var util=require(_0xe020('0x1'));var moment=require(_0xe020('0x2'));var BPromise=require(_0xe020('0x3'));var rs=require(_0xe020('0x4'));var fs=require('fs');var Redis=require(_0xe020('0x5'));var db=require(_0xe020('0x6'))['db'];var utils=require(_0xe020('0x7'));var logger=require(_0xe020('0x8'))('rpc');var config=require(_0xe020('0x9'));var jayson=require(_0xe020('0xa'));var client=jayson[_0xe020('0xb')][_0xe020('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e920c,_0x5ca241,_0x13b1ce){return new BPromise(function(_0x4044cb,_0x1c0704){return client['request'](_0x3e920c,_0x13b1ce)[_0xe020('0xd')](function(_0x408a5f){logger[_0xe020('0xe')](_0xe020('0xf'),_0x5ca241,'request\x20sent');logger[_0xe020('0x10')](_0xe020('0x11'),_0x5ca241,'request\x20sent',JSON[_0xe020('0x12')](_0x408a5f));if(_0x408a5f['error']){if(_0x408a5f[_0xe020('0x13')][_0xe020('0x14')]===0x1f4){logger[_0xe020('0x13')](_0xe020('0xf'),_0x5ca241,_0x408a5f[_0xe020('0x13')][_0xe020('0x15')]);return _0x1c0704(_0x408a5f['error']['message']);}logger['error'](_0xe020('0xf'),_0x5ca241,_0x408a5f[_0xe020('0x13')]['message']);return _0x4044cb(_0x408a5f[_0xe020('0x13')][_0xe020('0x15')]);}else{logger[_0xe020('0xe')](_0xe020('0xf'),_0x5ca241,_0xe020('0x16'));_0x4044cb(_0x408a5f[_0xe020('0x17')]['message']);}})[_0xe020('0x18')](function(_0x1a3914){logger[_0xe020('0x13')](_0xe020('0xf'),_0x5ca241,_0x1a3914);_0x1c0704(_0x1a3914);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 68fba36..0a5bdd0 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x7986a2,_0x2967e0){var _0x23c61a=function(_0x52c17d){while(--_0x52c17d){_0x7986a2['push'](_0x7986a2['shift']());}};_0x23c61a(++_0x2967e0);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x14b5c2,_0x155f08){var _0x10f07d=function(_0x3c1095){while(--_0x3c1095){_0x14b5c2['push'](_0x14b5c2['shift']());}};_0x10f07d(++_0x155f08);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0xcb91[_0x5311a1];return _0x2acb9f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 3dc55de..5771d38 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 _0xd891=['sequelize','exports'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xd891,0x1a8));var _0x1d89=function(_0x2a6322,_0x66b5ea){_0x2a6322=_0x2a6322-0x0;var _0x47f019=_0xd891[_0x2a6322];return _0x47f019;};'use strict';var Sequelize=require(_0x1d89('0x0'));module[_0x1d89('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xba5f=['exports','INTEGER'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xba5f,0x6c));var _0xfba5=function(_0x538b9,_0x1b91e3){_0x538b9=_0x538b9-0x0;var _0x3a92cc=_0xba5f[_0x538b9];return _0x3a92cc;};'use strict';var Sequelize=require('sequelize');module[_0xfba5('0x0')]={'penalty':{'type':Sequelize[_0xfba5('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 3008b3d..5a3e127 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 _0xff3b=['define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xff3b,0x148));var _0xbff3=function(_0xcc8f,_0x349972){_0xcc8f=_0xcc8f-0x0;var _0xc25794=_0xff3b[_0xcc8f];return _0xc25794;};'use strict';var _=require('lodash');var util=require(_0xbff3('0x0'));var logger=require(_0xbff3('0x1'))(_0xbff3('0x2'));var moment=require(_0xbff3('0x3'));var BPromise=require(_0xbff3('0x4'));var rp=require(_0xbff3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbff3('0x6'));var config=require(_0xbff3('0x7'));var attributes=require(_0xbff3('0x8'));module[_0xbff3('0x9')]=function(_0xaa0044,_0x5caad4){return _0xaa0044[_0xbff3('0xa')](_0xbff3('0xb'),attributes,{'tableName':_0xbff3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f06=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x3e4cbf,_0x17d245){var _0x2d47c8=function(_0x4693f8){while(--_0x4693f8){_0x3e4cbf['push'](_0x3e4cbf['shift']());}};_0x2d47c8(++_0x17d245);}(_0x8f06,0x12a));var _0x68f0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8f06[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x68f0('0x0'));var logger=require(_0x68f0('0x1'))(_0x68f0('0x2'));var moment=require(_0x68f0('0x3'));var BPromise=require(_0x68f0('0x4'));var rp=require(_0x68f0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68f0('0x6'));var config=require(_0x68f0('0x7'));var attributes=require(_0x68f0('0x8'));module[_0x68f0('0x9')]=function(_0x4c6af0,_0x31a5a1){return _0x4c6af0[_0x68f0('0xa')](_0x68f0('0xb'),attributes,{'tableName':_0x68f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index b8ffa42..2044d02 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2824d4,_0x5b1299){var _0x465c92=function(_0x508999){while(--_0x508999){_0x2824d4['push'](_0x2824d4['shift']());}};_0x465c92(++_0x5b1299);}(_0x8ef6,0xf2));var _0x68ef=function(_0xfb9c4b,_0x10e644){_0xfb9c4b=_0xfb9c4b-0x0;var _0x35193d=_0x8ef6[_0xfb9c4b];return _0x35193d;};'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')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7217,0x19e));var _0x7721=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7217[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 84ea42f..3458b50 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 _0x68fb=['fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x68fb,0xff));var _0xb68f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68fb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb68f('0x0'));var util=require(_0xb68f('0x1'));var path=require('path');var timeout=require(_0xb68f('0x2'));var express=require(_0xb68f('0x3'));var router=express[_0xb68f('0x4')]();var fs_extra=require(_0xb68f('0x5'));var auth=require(_0xb68f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb68f('0x7'));var controller=require(_0xb68f('0x8'));router[_0xb68f('0x9')]('/',auth[_0xb68f('0xa')](),controller[_0xb68f('0xb')]);module[_0xb68f('0xc')]=router; \ No newline at end of file +var _0x1d92=['Router','./userNotification.controller','post','isAuthenticated','exports','multer','connect-timeout','express'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1d92,0x18d));var _0x21d9=function(_0x5426e2,_0x5f2968){_0x5426e2=_0x5426e2-0x0;var _0x920dc=_0x1d92[_0x5426e2];return _0x920dc;};'use strict';var multer=require(_0x21d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x21d9('0x1'));var express=require(_0x21d9('0x2'));var router=express[_0x21d9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x21d9('0x4'));router[_0x21d9('0x5')]('/',auth[_0x21d9('0x6')](),controller['sendUserNotification']);module[_0x21d9('0x7')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index cc63993..318a538 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 _0x32b4=['TEXT','STRING','BOOLEAN','exports'];(function(_0x1936ff,_0x3c304b){var _0x3c90b9=function(_0x1e00a4){while(--_0x1e00a4){_0x1936ff['push'](_0x1936ff['shift']());}};_0x3c90b9(++_0x3c304b);}(_0x32b4,0x7b));var _0x432b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x32b4[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');module[_0x432b('0x0')]={'body':{'type':Sequelize[_0x432b('0x1')]},'senderName':{'type':Sequelize[_0x432b('0x2')]},'recipientsId':{'type':Sequelize[_0x432b('0x1')]},'recipientsDescription':{'type':Sequelize[_0x432b('0x2')]},'beep':{'type':Sequelize[_0x432b('0x3')]}}; \ No newline at end of file +var _0x52a1=['TEXT','BOOLEAN','exports','STRING'];(function(_0xf3c843,_0x8ff24e){var _0x3191c6=function(_0x2f1ef7){while(--_0x2f1ef7){_0xf3c843['push'](_0xf3c843['shift']());}};_0x3191c6(++_0x8ff24e);}(_0x52a1,0x1ba));var _0x152a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x52a1[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x152a('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x152a('0x1')]},'recipientsId':{'type':Sequelize[_0x152a('0x2')]},'recipientsDescription':{'type':Sequelize[_0x152a('0x1')]},'beep':{'type':Sequelize[_0x152a('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index c7e590d..d9acb23 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 _0xa2e5=['json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','view','User','ids','replace','push','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end'];(function(_0xe7d22c,_0x3abec5){var _0x5b7fb0=function(_0x168bed){while(--_0x168bed){_0xe7d22c['push'](_0xe7d22c['shift']());}};_0x5b7fb0(++_0x3abec5);}(_0xa2e5,0x9c));var _0x5a2e=function(_0x57622f,_0xdb896){_0x57622f=_0x57622f-0x0;var _0x336714=_0xa2e5[_0x57622f];return _0x336714;};'use strict';var emlformat=require(_0x5a2e('0x0'));var rimraf=require(_0x5a2e('0x1'));var zipdir=require(_0x5a2e('0x2'));var jsonpatch=require(_0x5a2e('0x3'));var rp=require('request-promise');var moment=require(_0x5a2e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5a2e('0x5'));var util=require('util');var path=require(_0x5a2e('0x6'));var sox=require(_0x5a2e('0x7'));var csv=require('to-csv');var ejs=require(_0x5a2e('0x8'));var fs=require('fs');var fs_extra=require(_0x5a2e('0x9'));var _=require('lodash');var squel=require(_0x5a2e('0xa'));var crypto=require(_0x5a2e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5a2e('0xc'));var toCsv=require(_0x5a2e('0xd'));var querystring=require(_0x5a2e('0xe'));var Papa=require(_0x5a2e('0xf'));var Redis=require('ioredis');var authService=require(_0x5a2e('0x10'));var qs=require(_0x5a2e('0x11'));var as=require(_0x5a2e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a2e('0x13'))(_0x5a2e('0x14'));var utils=require('../../config/utils');var config=require(_0x5a2e('0x15'));var licenseUtil=require(_0x5a2e('0x16'));var db=require(_0x5a2e('0x17'))['db'];config[_0x5a2e('0x18')]=_[_0x5a2e('0x19')](config['redis'],{'host':_0x5a2e('0x1a'),'port':0x18eb});var socket=require(_0x5a2e('0x1b'))(new Redis(config[_0x5a2e('0x18')]));require('./userNotification.socket')[_0x5a2e('0x1c')](socket);function respondWithStatusCode(_0x453124,_0x4dd6bf){_0x4dd6bf=_0x4dd6bf||0xcc;return function(_0x5604ce){if(_0x5604ce){return _0x453124[_0x5a2e('0x1d')](_0x4dd6bf);}return _0x453124[_0x5a2e('0x1e')](_0x4dd6bf)[_0x5a2e('0x1f')]();};}function respondWithResult(_0xb91d28,_0x318adb){_0x318adb=_0x318adb||0xc8;return function(_0x2597cb){if(_0x2597cb){return _0xb91d28[_0x5a2e('0x1e')](_0x318adb)[_0x5a2e('0x20')](_0x2597cb);}};}function respondWithFilteredResult(_0x47e43f,_0x53ee5c){return function(_0x385f59){if(_0x385f59){var _0x503b29=typeof _0x53ee5c['offset']===_0x5a2e('0x21')&&typeof _0x53ee5c[_0x5a2e('0x22')]===_0x5a2e('0x21');var _0x3e3ea1=_0x385f59['count'];var _0x5aefef=_0x503b29?0x0:_0x53ee5c[_0x5a2e('0x23')];var _0x33fea6=_0x503b29?_0x385f59[_0x5a2e('0x24')]:_0x53ee5c[_0x5a2e('0x23')]+_0x53ee5c[_0x5a2e('0x22')];var _0x430e65;if(_0x33fea6>=_0x3e3ea1){_0x33fea6=_0x3e3ea1;_0x430e65=0xc8;}else{_0x430e65=0xce;}_0x47e43f[_0x5a2e('0x1e')](_0x430e65);return _0x47e43f[_0x5a2e('0x25')](_0x5a2e('0x26'),_0x5aefef+'-'+_0x33fea6+'/'+_0x3e3ea1)['json'](_0x385f59);}return null;};}function patchUpdates(_0x213069){return function(_0x1209f4){try{jsonpatch[_0x5a2e('0x27')](_0x1209f4,_0x213069,!![]);}catch(_0x60430c){return BPromise[_0x5a2e('0x28')](_0x60430c);}return _0x1209f4[_0x5a2e('0x29')]();};}function saveUpdates(_0x212bf4,_0x27d9b4){return function(_0x5b8e01){if(_0x5b8e01){return _0x5b8e01['update'](_0x212bf4)[_0x5a2e('0x2a')](function(_0x23b48e){return _0x23b48e;});}return null;};}function removeEntity(_0x590cbf,_0x2a295f){return function(_0x57798f){if(_0x57798f){return _0x57798f[_0x5a2e('0x2b')]()['then'](function(){_0x590cbf[_0x5a2e('0x1e')](0xcc)[_0x5a2e('0x1f')]();});}};}function handleEntityNotFound(_0x367b07,_0x2f6e41){return function(_0x2787db){if(!_0x2787db){_0x367b07[_0x5a2e('0x1d')](0x194);}return _0x2787db;};}function handleError(_0x3011a6,_0x1c05f7){_0x1c05f7=_0x1c05f7||0x1f4;return function(_0x23c439){logger[_0x5a2e('0x2c')](_0x23c439['stack']);if(_0x23c439['name']){delete _0x23c439[_0x5a2e('0x2d')];}_0x3011a6[_0x5a2e('0x1e')](_0x1c05f7)['send'](_0x23c439);};}exports[_0x5a2e('0x2e')]=function(_0x194074,_0x301bf6,_0x4bf6f4){if(!_0x194074[_0x5a2e('0x2f')][_0x5a2e('0x30')](_0x5a2e('0x31'))&&!_0x194074[_0x5a2e('0x2f')][_0x5a2e('0x30')](_0x5a2e('0x32'))){throw new db[(_0x5a2e('0x33'))][(_0x5a2e('0x34'))](_0x5a2e('0x35'));}else{if(_0x194074[_0x5a2e('0x2f')][_0x5a2e('0x30')](_0x5a2e('0x32'))&&!_0x194074[_0x5a2e('0x2f')][_0x5a2e('0x30')]('view')){throw new db['Sequelize'][(_0x5a2e('0x34'))](_0x5a2e('0x36'));}if(!_0x194074['body'][_0x5a2e('0x30')](_0x5a2e('0x37'))){throw new db['Sequelize'][(_0x5a2e('0x34'))](_0x5a2e('0x38'));}else{try{var _0x29fe81=JSON[_0x5a2e('0x39')](_0x194074[_0x5a2e('0x2f')][_0x5a2e('0x37')]);}catch(_0x94fcf9){logger[_0x5a2e('0x2c')](_0x94fcf9);throw new db[(_0x5a2e('0x33'))][(_0x5a2e('0x34'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x208ded=[_0x5a2e('0x3a'),'faxqueue',_0x5a2e('0x3b'),_0x5a2e('0x3c'),_0x5a2e('0x3d'),_0x5a2e('0x3e'),'whatsappqueue','team',_0x5a2e('0x3f')];if(_[_0x5a2e('0x40')](_0x29fe81,function(_0x50b603){return!_[_0x5a2e('0x41')](_0x208ded,_0x50b603[_0x5a2e('0x42')][_0x5a2e('0x43')]());})){throw new db[(_0x5a2e('0x33'))][(_0x5a2e('0x34'))](_0x5a2e('0x44'));}}}var _0x583183={};_0x583183['senderName']=_0x194074['body']['hasOwnProperty'](_0x5a2e('0x45'))?_0x194074['body']['senderName']:_0x194074[_0x5a2e('0x3f')][_0x5a2e('0x46')];_0x583183['recipientsDescription']=_[_0x5a2e('0x47')](_0x194074['body'][_0x5a2e('0x48')])?null:_0x194074[_0x5a2e('0x2f')][_0x5a2e('0x48')];_0x583183['beep']=_0x194074['body'][_0x5a2e('0x49')]||![];_0x583183[_0x5a2e('0x4a')]=_0x194074[_0x5a2e('0x3f')]['id'];return getContent(_0x194074[_0x5a2e('0x2f')])[_0x5a2e('0x2a')](function(_0x247047){_0x583183[_0x5a2e('0x2f')]=_0x247047;return getRecipients(_0x29fe81);})['then'](function(_0x3ed7be){_0x583183['recipientsId']=_['sortBy'](_0x3ed7be)['join'](',');return db[_0x5a2e('0x4b')][_0x5a2e('0x4c')](function(_0x24526e){return db[_0x5a2e('0x4d')][_0x5a2e('0x4e')](_0x583183,{'raw':!![],'transaction':_0x24526e})['then'](function(_0x291863){var _0x1587d5={'sender':_0x583183[_0x5a2e('0x45')],'description':_0x583183[_0x5a2e('0x48')],'content':_0x583183[_0x5a2e('0x2f')],'beep':_0x583183[_0x5a2e('0x49')]};_0x3ed7be[_0x5a2e('0x4f')](function(_0x4982ce){_0x1587d5['recipient']=_0x4982ce;socket[_0x5a2e('0x50')](_0x5a2e('0x51'),_0x1587d5);});return _0x291863;});});})[_0x5a2e('0x2a')](respondWithResult(_0x301bf6,0xc9))[_0x5a2e('0x52')](handleError(_0x301bf6,null));};function getContent(_0x21b0bd){return new BPromise(function(_0x15d692,_0x473cd5){if(_0x21b0bd[_0x5a2e('0x31')]){_0x15d692(_0x21b0bd[_0x5a2e('0x31')]);return;}return db[_0x5a2e('0x53')][_0x5a2e('0x54')]({'attributes':['html'],'where':{'id':_0x21b0bd[_0x5a2e('0x32')]},'raw':!![]})[_0x5a2e('0x2a')](function(_0x850b66){if(!_0x850b66)throw new db[(_0x5a2e('0x33'))][(_0x5a2e('0x34'))](_0x5a2e('0x55'));var _0x2bd9b6=Mustache[_0x5a2e('0x56')](_0x850b66[_0x5a2e('0x57')],_0x21b0bd[_0x5a2e('0x58')]);_0x15d692(_0x2bd9b6);})[_0x5a2e('0x52')](function(_0x226b97){_0x473cd5(_0x226b97);});});}function getRecipients(_0x35c9aa){return new BPromise(function(_0x1605cc,_0x3d0fcb){var _0x24be73=[];var _0x6ab1b0=[];_0x35c9aa[_0x5a2e('0x4f')](function(_0x5930bd){var _0x1dc1ab=_['startCase'](_0x5930bd['model'][_0x5a2e('0x43')]());if(_0x1dc1ab===_0x5a2e('0x59')){_0x24be73=_['union'](_0x24be73,_0x5930bd[_0x5a2e('0x5a')]);}else{if(_[_0x5a2e('0x41')](_0x1dc1ab,'queue'))_0x1dc1ab=_0x1dc1ab[_0x5a2e('0x5b')]('queue','Queue');_0x5930bd[_0x5a2e('0x5a')]['forEach'](function(_0x5b6812){_0x6ab1b0[_0x5a2e('0x5c')](getAgents(_0x1dc1ab,_0x5b6812));});}});return BPromise[_0x5a2e('0x5d')](_0x6ab1b0)['then'](function(_0x913572){_0x24be73=_['union'](_0x24be73,_['flatten'](_0x913572));_0x1605cc(_0x24be73);})[_0x5a2e('0x52')](function(_0x1382ca){_0x3d0fcb(_0x1382ca);});});}function getAgents(_0x95ca46,_0x1b1638){return new BPromise(function(_0x4468a8,_0x4090f5){return db[_0x95ca46][_0x5a2e('0x54')]({'where':{'id':_0x1b1638}})['then'](function(_0x1c08c7){return _0x1c08c7['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x34c108){var _0x59fbf9=_['map'](_0x34c108,'id');_0x4468a8(_0x59fbf9);});})[_0x5a2e('0x52')](function(_0x1c8294){_0x4090f5(_0x1c8294);});});} \ No newline at end of file +var _0x919a=['limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','UserNotification','create','recipient','emit','userNotification:send','catch','text','Template','findOne','render','forEach','User','union','ids','includes','queue','replace','Queue','all','flatten','map','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','undefined'];(function(_0x1306f3,_0x1da761){var _0xc1c7bf=function(_0x1ca08e){while(--_0x1ca08e){_0x1306f3['push'](_0x1306f3['shift']());}};_0xc1c7bf(++_0x1da761);}(_0x919a,0x10e));var _0xa919=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x919a[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa919('0x0'));var jsonpatch=require(_0xa919('0x1'));var rp=require(_0xa919('0x2'));var moment=require(_0xa919('0x3'));var BPromise=require(_0xa919('0x4'));var Mustache=require(_0xa919('0x5'));var util=require('util');var path=require(_0xa919('0x6'));var sox=require(_0xa919('0x7'));var csv=require(_0xa919('0x8'));var ejs=require(_0xa919('0x9'));var fs=require('fs');var fs_extra=require(_0xa919('0xa'));var _=require(_0xa919('0xb'));var squel=require(_0xa919('0xc'));var crypto=require(_0xa919('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa919('0xe'));var toCsv=require(_0xa919('0x8'));var querystring=require(_0xa919('0xf'));var Papa=require(_0xa919('0x10'));var Redis=require(_0xa919('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa919('0x12'));var as=require(_0xa919('0x13'));var hardwareService=require(_0xa919('0x14'));var logger=require('../../config/logger')(_0xa919('0x15'));var utils=require(_0xa919('0x16'));var config=require(_0xa919('0x17'));var licenseUtil=require(_0xa919('0x18'));var db=require(_0xa919('0x19'))['db'];config[_0xa919('0x1a')]=_[_0xa919('0x1b')](config[_0xa919('0x1a')],{'host':_0xa919('0x1c'),'port':0x18eb});var socket=require(_0xa919('0x1d'))(new Redis(config[_0xa919('0x1a')]));require(_0xa919('0x1e'))[_0xa919('0x1f')](socket);function respondWithStatusCode(_0x25c867,_0x2e1ad0){_0x2e1ad0=_0x2e1ad0||0xcc;return function(_0x74fa24){if(_0x74fa24){return _0x25c867[_0xa919('0x20')](_0x2e1ad0);}return _0x25c867['status'](_0x2e1ad0)[_0xa919('0x21')]();};}function respondWithResult(_0x8a9a8b,_0x2d63aa){_0x2d63aa=_0x2d63aa||0xc8;return function(_0x24b878){if(_0x24b878){return _0x8a9a8b[_0xa919('0x22')](_0x2d63aa)['json'](_0x24b878);}};}function respondWithFilteredResult(_0x269c9c,_0x5a0885){return function(_0x51be65){if(_0x51be65){var _0x5591e4=typeof _0x5a0885['offset']===_0xa919('0x23')&&typeof _0x5a0885[_0xa919('0x24')]===_0xa919('0x23');var _0x306717=_0x51be65[_0xa919('0x25')];var _0x701d0b=_0x5591e4?0x0:_0x5a0885[_0xa919('0x26')];var _0x1824d0=_0x5591e4?_0x51be65[_0xa919('0x25')]:_0x5a0885[_0xa919('0x26')]+_0x5a0885[_0xa919('0x24')];var _0x22e50a;if(_0x1824d0>=_0x306717){_0x1824d0=_0x306717;_0x22e50a=0xc8;}else{_0x22e50a=0xce;}_0x269c9c[_0xa919('0x22')](_0x22e50a);return _0x269c9c[_0xa919('0x27')](_0xa919('0x28'),_0x701d0b+'-'+_0x1824d0+'/'+_0x306717)['json'](_0x51be65);}return null;};}function patchUpdates(_0x5e4c23){return function(_0x501012){try{jsonpatch[_0xa919('0x29')](_0x501012,_0x5e4c23,!![]);}catch(_0x40d592){return BPromise[_0xa919('0x2a')](_0x40d592);}return _0x501012['save']();};}function saveUpdates(_0x1212d7,_0x29796e){return function(_0x2b3997){if(_0x2b3997){return _0x2b3997[_0xa919('0x2b')](_0x1212d7)['then'](function(_0x927c31){return _0x927c31;});}return null;};}function removeEntity(_0x5bb07c,_0x3b6eec){return function(_0x21f542){if(_0x21f542){return _0x21f542[_0xa919('0x2c')]()[_0xa919('0x2d')](function(){_0x5bb07c[_0xa919('0x22')](0xcc)[_0xa919('0x21')]();});}};}function handleEntityNotFound(_0x116cb6,_0x5c97b5){return function(_0x3367cb){if(!_0x3367cb){_0x116cb6[_0xa919('0x20')](0x194);}return _0x3367cb;};}function handleError(_0x43b204,_0x158e30){_0x158e30=_0x158e30||0x1f4;return function(_0x25b1e1){logger[_0xa919('0x2e')](_0x25b1e1[_0xa919('0x2f')]);if(_0x25b1e1[_0xa919('0x30')]){delete _0x25b1e1[_0xa919('0x30')];}_0x43b204['status'](_0x158e30)[_0xa919('0x31')](_0x25b1e1);};}exports[_0xa919('0x32')]=function(_0x57fe75,_0x1a197a,_0x57bd63){if(!_0x57fe75[_0xa919('0x33')]['hasOwnProperty']('text')&&!_0x57fe75[_0xa919('0x33')][_0xa919('0x34')](_0xa919('0x35'))){throw new db['Sequelize'][(_0xa919('0x36'))](_0xa919('0x37'));}else{if(_0x57fe75[_0xa919('0x33')][_0xa919('0x34')]('TemplateId')&&!_0x57fe75[_0xa919('0x33')]['hasOwnProperty'](_0xa919('0x38'))){throw new db[(_0xa919('0x39'))][(_0xa919('0x36'))](_0xa919('0x3a'));}if(!_0x57fe75[_0xa919('0x33')][_0xa919('0x34')]('recipients')){throw new db[(_0xa919('0x39'))][(_0xa919('0x36'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2c9c1e=JSON[_0xa919('0x3b')](_0x57fe75[_0xa919('0x33')][_0xa919('0x3c')]);}catch(_0x504b6e){logger[_0xa919('0x2e')](_0x504b6e);throw new db[(_0xa919('0x39'))][(_0xa919('0x36'))](_0xa919('0x3d'));}var _0x3beed0=['chatqueue',_0xa919('0x3e'),_0xa919('0x3f'),_0xa919('0x40'),_0xa919('0x41'),_0xa919('0x42'),_0xa919('0x43'),'team',_0xa919('0x44')];if(_[_0xa919('0x45')](_0x2c9c1e,function(_0x3a4159){return!_['includes'](_0x3beed0,_0x3a4159[_0xa919('0x46')][_0xa919('0x47')]());})){throw new db[(_0xa919('0x39'))][(_0xa919('0x36'))](_0xa919('0x48'));}}}var _0x285899={};_0x285899[_0xa919('0x49')]=_0x57fe75[_0xa919('0x33')][_0xa919('0x34')](_0xa919('0x49'))?_0x57fe75[_0xa919('0x33')]['senderName']:_0x57fe75[_0xa919('0x44')][_0xa919('0x4a')];_0x285899[_0xa919('0x4b')]=_[_0xa919('0x4c')](_0x57fe75[_0xa919('0x33')][_0xa919('0x4b')])?null:_0x57fe75[_0xa919('0x33')][_0xa919('0x4b')];_0x285899['beep']=_0x57fe75[_0xa919('0x33')][_0xa919('0x4d')]||![];_0x285899['SenderId']=_0x57fe75[_0xa919('0x44')]['id'];return getContent(_0x57fe75['body'])[_0xa919('0x2d')](function(_0x511857){_0x285899[_0xa919('0x33')]=_0x511857;return getRecipients(_0x2c9c1e);})[_0xa919('0x2d')](function(_0x191b35){_0x285899['recipientsId']=_[_0xa919('0x4e')](_0x191b35)[_0xa919('0x4f')](',');return db[_0xa919('0x50')]['transaction'](function(_0x1cc0bb){return db[_0xa919('0x51')][_0xa919('0x52')](_0x285899,{'raw':!![],'transaction':_0x1cc0bb})[_0xa919('0x2d')](function(_0x30dfde){var _0x250d48={'sender':_0x285899['senderName'],'description':_0x285899['recipientsDescription'],'content':_0x285899[_0xa919('0x33')],'beep':_0x285899[_0xa919('0x4d')]};_0x191b35['forEach'](function(_0x39c6ef){_0x250d48[_0xa919('0x53')]=_0x39c6ef;socket[_0xa919('0x54')](_0xa919('0x55'),_0x250d48);});return _0x30dfde;});});})['then'](respondWithResult(_0x1a197a,0xc9))[_0xa919('0x56')](handleError(_0x1a197a,null));};function getContent(_0x3c299e){return new BPromise(function(_0x1ac7d9,_0x4b11e2){if(_0x3c299e[_0xa919('0x57')]){_0x1ac7d9(_0x3c299e[_0xa919('0x57')]);return;}return db[_0xa919('0x58')][_0xa919('0x59')]({'attributes':['html'],'where':{'id':_0x3c299e[_0xa919('0x35')]},'raw':!![]})['then'](function(_0x218d49){if(!_0x218d49)throw new db[(_0xa919('0x39'))][(_0xa919('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x23a910=Mustache[_0xa919('0x5a')](_0x218d49['html'],_0x3c299e[_0xa919('0x38')]);_0x1ac7d9(_0x23a910);})['catch'](function(_0x49e796){_0x4b11e2(_0x49e796);});});}function getRecipients(_0x286451){return new BPromise(function(_0xe0e5cb,_0x1bb610){var _0xe33f25=[];var _0x194da3=[];_0x286451[_0xa919('0x5b')](function(_0x30386e){var _0x536a50=_['startCase'](_0x30386e['model'][_0xa919('0x47')]());if(_0x536a50===_0xa919('0x5c')){_0xe33f25=_[_0xa919('0x5d')](_0xe33f25,_0x30386e[_0xa919('0x5e')]);}else{if(_[_0xa919('0x5f')](_0x536a50,_0xa919('0x60')))_0x536a50=_0x536a50[_0xa919('0x61')](_0xa919('0x60'),_0xa919('0x62'));_0x30386e[_0xa919('0x5e')]['forEach'](function(_0x3d6065){_0x194da3['push'](getAgents(_0x536a50,_0x3d6065));});}});return BPromise[_0xa919('0x63')](_0x194da3)[_0xa919('0x2d')](function(_0x271299){_0xe33f25=_[_0xa919('0x5d')](_0xe33f25,_[_0xa919('0x64')](_0x271299));_0xe0e5cb(_0xe33f25);})[_0xa919('0x56')](function(_0x20ad4e){_0x1bb610(_0x20ad4e);});});}function getAgents(_0x323ea1,_0x3de8da){return new BPromise(function(_0x46f153,_0x4ee9e8){return db[_0x323ea1][_0xa919('0x59')]({'where':{'id':_0x3de8da}})[_0xa919('0x2d')](function(_0x2ee26e){return _0x2ee26e['getAgents']({'attributes':['id'],'raw':!![]})[_0xa919('0x2d')](function(_0x3f6393){var _0x5348c1=_[_0xa919('0x65')](_0x3f6393,'id');_0x46f153(_0x5348c1);});})['catch'](function(_0x2c5cd0){_0x4ee9e8(_0x2c5cd0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 2da2c44..ceee490 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 _0x6f49=['hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','remove','emit'];(function(_0x281a2c,_0x42d423){var _0x287b2c=function(_0x42d84d){while(--_0x42d84d){_0x281a2c['push'](_0x281a2c['shift']());}};_0x287b2c(++_0x42d423);}(_0x6f49,0x1bb));var _0x96f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f49[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x96f4('0x0'));var UserNotification=require(_0x96f4('0x1'))['db'][_0x96f4('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x96f4('0x3')](0x0);var events={'afterCreate':_0x96f4('0x4'),'afterUpdate':'update','afterDestroy':_0x96f4('0x5')};function emitEvent(_0x24d8f0){return function(_0x4067e5,_0x3467b6,_0x579002){UserNotificationEvents['emit'](_0x24d8f0+':'+_0x4067e5['id'],_0x4067e5);UserNotificationEvents[_0x96f4('0x6')](_0x24d8f0,_0x4067e5);_0x579002(null);};}for(var e in events){if(events[_0x96f4('0x7')](e)){var event=events[e];UserNotification[_0x96f4('0x8')](e,emitEvent(event));}}module[_0x96f4('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x670d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','UserNotification'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x670d,0x15d));var _0xd670=function(_0x3b0f89,_0x5c1e5a){_0x3b0f89=_0x3b0f89-0x0;var _0x3b6de5=_0x670d[_0x3b0f89];return _0x3b6de5;};'use strict';var EventEmitter=require(_0xd670('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xd670('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xd670('0x2')](0x0);var events={'afterCreate':_0xd670('0x3'),'afterUpdate':_0xd670('0x4'),'afterDestroy':_0xd670('0x5')};function emitEvent(_0x1140e7){return function(_0x45ffcc,_0xf4285a,_0x46b78e){UserNotificationEvents['emit'](_0x1140e7+':'+_0x45ffcc['id'],_0x45ffcc);UserNotificationEvents[_0xd670('0x6')](_0x1140e7,_0x45ffcc);_0x46b78e(null);};}for(var e in events){if(events[_0xd670('0x7')](e)){var event=events[e];UserNotification[_0xd670('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index fd4f3a2..594f77a 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 _0xcca2=['./userNotification.attributes','define','userNotifications','utf8mb4','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x5cbed4,_0xf829ae){var _0x37d95c=function(_0x58ec3b){while(--_0x58ec3b){_0x5cbed4['push'](_0x5cbed4['shift']());}};_0x37d95c(++_0xf829ae);}(_0xcca2,0x1bc));var _0x2cca=function(_0x31ec41,_0x4ce0ef){_0x31ec41=_0x31ec41-0x0;var _0x4bd8b6=_0xcca2[_0x31ec41];return _0x4bd8b6;};'use strict';var _=require(_0x2cca('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2cca('0x1'));var BPromise=require(_0x2cca('0x2'));var rp=require(_0x2cca('0x3'));var fs=require('fs');var path=require(_0x2cca('0x4'));var rimraf=require(_0x2cca('0x5'));var config=require('../../config/environment');var attributes=require(_0x2cca('0x6'));module['exports']=function(_0x235c3a,_0x459a16){return _0x235c3a[_0x2cca('0x7')]('UserNotification',attributes,{'tableName':_0x2cca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2cca('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x01f5=['./userNotification.attributes','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x175bd2,_0x5dd709){var _0x14819e=function(_0x499059){while(--_0x499059){_0x175bd2['push'](_0x175bd2['shift']());}};_0x14819e(++_0x5dd709);}(_0x01f5,0x131));var _0x501f=function(_0x12bc4d,_0x70b2bd){_0x12bc4d=_0x12bc4d-0x0;var _0x5ed1a3=_0x01f5[_0x12bc4d];return _0x5ed1a3;};'use strict';var _=require(_0x501f('0x0'));var util=require(_0x501f('0x1'));var logger=require('../../config/logger')(_0x501f('0x2'));var moment=require(_0x501f('0x3'));var BPromise=require('bluebird');var rp=require(_0x501f('0x4'));var fs=require('fs');var path=require(_0x501f('0x5'));var rimraf=require(_0x501f('0x6'));var config=require('../../config/environment');var attributes=require(_0x501f('0x7'));module[_0x501f('0x8')]=function(_0x12574c,_0x3a9ce1){return _0x12574c[_0x501f('0x9')](_0x501f('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x501f('0xb'),'collate':_0x501f('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 490882a..d4a7727 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 _0x9217=['register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0xe8adb7,_0x408aea){var _0x3aa618=function(_0x4de2c8){while(--_0x4de2c8){_0xe8adb7['push'](_0xe8adb7['shift']());}};_0x3aa618(++_0x408aea);}(_0x9217,0xff));var _0x7921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9217[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7921('0x0'));var util=require(_0x7921('0x1'));var moment=require(_0x7921('0x2'));var BPromise=require('bluebird');var rs=require(_0x7921('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7921('0x4'))['db'];var utils=require(_0x7921('0x5'));var logger=require(_0x7921('0x6'))(_0x7921('0x7'));var config=require(_0x7921('0x8'));var jayson=require(_0x7921('0x9'));var client=jayson[_0x7921('0xa')][_0x7921('0xb')]({'port':0x232a});config[_0x7921('0xc')]=_[_0x7921('0xd')](config[_0x7921('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7921('0xe'))(new Redis(config['redis']));require('./userNotification.socket')[_0x7921('0xf')](socket);function respondWithRpcPromise(_0x55510e,_0x5b925e,_0x26ecc2){return new BPromise(function(_0x26c7a9,_0xa2799b){return client[_0x7921('0x10')](_0x55510e,_0x26ecc2)[_0x7921('0x11')](function(_0xac649f){logger[_0x7921('0x12')](_0x7921('0x13'),_0x5b925e,_0x7921('0x14'));logger[_0x7921('0x15')](_0x7921('0x16'),_0x5b925e,_0x7921('0x14'),JSON[_0x7921('0x17')](_0xac649f));if(_0xac649f[_0x7921('0x18')]){if(_0xac649f[_0x7921('0x18')][_0x7921('0x19')]===0x1f4){logger[_0x7921('0x18')](_0x7921('0x13'),_0x5b925e,_0xac649f[_0x7921('0x18')]['message']);return _0xa2799b(_0xac649f['error']['message']);}logger[_0x7921('0x18')](_0x7921('0x13'),_0x5b925e,_0xac649f[_0x7921('0x18')][_0x7921('0x1a')]);return _0x26c7a9(_0xac649f[_0x7921('0x18')]['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x5b925e,_0x7921('0x14'));_0x26c7a9(_0xac649f['result'][_0x7921('0x1a')]);}})['catch'](function(_0x8d41d7){logger[_0x7921('0x18')](_0x7921('0x13'),_0x5b925e,_0x8d41d7);_0xa2799b(_0x8d41d7);});});} \ No newline at end of file +var _0x0218=['util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch'];(function(_0x225b4e,_0x179ee4){var _0x24237a=function(_0x4ac970){while(--_0x4ac970){_0x225b4e['push'](_0x225b4e['shift']());}};_0x24237a(++_0x179ee4);}(_0x0218,0x186));var _0x8021=function(_0x208aad,_0x29a73f){_0x208aad=_0x208aad-0x0;var _0xe30095=_0x0218[_0x208aad];return _0xe30095;};'use strict';var _=require('lodash');var util=require(_0x8021('0x0'));var moment=require(_0x8021('0x1'));var BPromise=require(_0x8021('0x2'));var rs=require(_0x8021('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8021('0x4'))(_0x8021('0x5'));var config=require('../../config/environment');var jayson=require(_0x8021('0x6'));var client=jayson[_0x8021('0x7')][_0x8021('0x8')]({'port':0x232a});config[_0x8021('0x9')]=_[_0x8021('0xa')](config[_0x8021('0x9')],{'host':_0x8021('0xb'),'port':0x18eb});var socket=require(_0x8021('0xc'))(new Redis(config[_0x8021('0x9')]));require(_0x8021('0xd'))[_0x8021('0xe')](socket);function respondWithRpcPromise(_0x3c3383,_0x599a8b,_0x3beb34){return new BPromise(function(_0x22dd33,_0x514627){return client[_0x8021('0xf')](_0x3c3383,_0x3beb34)['then'](function(_0x3353b5){logger[_0x8021('0x10')](_0x8021('0x11'),_0x599a8b,'request\x20sent');logger['debug'](_0x8021('0x12'),_0x599a8b,_0x8021('0x13'),JSON[_0x8021('0x14')](_0x3353b5));if(_0x3353b5['error']){if(_0x3353b5['error'][_0x8021('0x15')]===0x1f4){logger[_0x8021('0x16')]('UserNotification,\x20%s,\x20%s',_0x599a8b,_0x3353b5['error'][_0x8021('0x17')]);return _0x514627(_0x3353b5[_0x8021('0x16')][_0x8021('0x17')]);}logger[_0x8021('0x16')]('UserNotification,\x20%s,\x20%s',_0x599a8b,_0x3353b5[_0x8021('0x16')][_0x8021('0x17')]);return _0x22dd33(_0x3353b5[_0x8021('0x16')]['message']);}else{logger[_0x8021('0x10')]('UserNotification,\x20%s,\x20%s',_0x599a8b,_0x8021('0x13'));_0x22dd33(_0x3353b5[_0x8021('0x18')][_0x8021('0x17')]);}})[_0x8021('0x19')](function(_0x36a0d6){logger[_0x8021('0x16')]('UserNotification,\x20%s,\x20%s',_0x599a8b,_0x36a0d6);_0x514627(_0x36a0d6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index fcfe93c..008107e 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 _0x25c3=['length','./userNotification.events','update','removeListener','register'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0x25c3,0x9c));var _0x325c=function(_0x959f63,_0x1c3099){_0x959f63=_0x959f63-0x0;var _0x44f31c=_0x25c3[_0x959f63];return _0x44f31c;};'use strict';var UserNotificationEvents=require(_0x325c('0x0'));var events=['save','remove',_0x325c('0x1')];function createListener(_0x4ff0fa,_0x56518){return function(_0x1a70bb){_0x56518['emit'](_0x4ff0fa,_0x1a70bb);};}function removeListener(_0x424c94,_0x410ba5){return function(){UserNotificationEvents[_0x325c('0x2')](_0x424c94,_0x410ba5);};}exports[_0x325c('0x3')]=function(_0x43a732){for(var _0x342412=0x0,_0x4c4ce4=events[_0x325c('0x4')];_0x342412<_0x4c4ce4;_0x342412++){var _0x214a84=events[_0x342412];var _0x184640=createListener('userNotification:'+_0x214a84,_0x43a732);UserNotificationEvents['on'](_0x214a84,_0x184640);}}; \ No newline at end of file +var _0x702e=['length','./userNotification.events','save','update','emit','removeListener','register'];(function(_0x34099c,_0x2c9a04){var _0x50e4ec=function(_0x1d5e19){while(--_0x1d5e19){_0x34099c['push'](_0x34099c['shift']());}};_0x50e4ec(++_0x2c9a04);}(_0x702e,0x1c1));var _0xe702=function(_0x58218b,_0x28ffaf){_0x58218b=_0x58218b-0x0;var _0x52c0cc=_0x702e[_0x58218b];return _0x52c0cc;};'use strict';var UserNotificationEvents=require(_0xe702('0x0'));var events=[_0xe702('0x1'),'remove',_0xe702('0x2')];function createListener(_0x446745,_0x4fa407){return function(_0x4e82cc){_0x4fa407[_0xe702('0x3')](_0x446745,_0x4e82cc);};}function removeListener(_0x951e4,_0x23712a){return function(){UserNotificationEvents[_0xe702('0x4')](_0x951e4,_0x23712a);};}exports[_0xe702('0x5')]=function(_0x52668d){for(var _0x4ebb4b=0x0,_0x4a9494=events[_0xe702('0x6')];_0x4ebb4b<_0x4a9494;_0x4ebb4b++){var _0xbb9a0d=events[_0x4ebb4b];var _0x2c521f=createListener('userNotification:'+_0xbb9a0d,_0x52668d);UserNotificationEvents['on'](_0xbb9a0d,_0x2c521f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f3eb7d6..4b16448 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(_0x317333,_0x558a35){var _0x1f7c0d=function(_0x43e641){while(--_0x43e641){_0x317333['push'](_0x317333['shift']());}};_0x1f7c0d(++_0x558a35);}(_0xedd9,0xfc));var _0x9edd=function(_0x3557a7,_0x2b8fb9){_0x3557a7=_0x3557a7-0x0;var _0x2de325=_0xedd9[_0x3557a7];return _0x2de325;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x27b001,_0x299ce6){var _0x4ad9af=function(_0x33a9de){while(--_0x33a9de){_0x27b001['push'](_0x27b001['shift']());}};_0x4ad9af(++_0x299ce6);}(_0xedd9,0xfc));var _0x9edd=function(_0x272cee,_0x153b02){_0x272cee=_0x272cee-0x0;var _0x31c95c=_0xedd9[_0x272cee];return _0x31c95c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 1d69937..e5e5d9d 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 _0x80fc=['exports','INTEGER','sequelize'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x80fc,0x1af));var _0xc80f=function(_0x20d994,_0x4f8973){_0x20d994=_0x20d994-0x0;var _0x468771=_0x80fc[_0x20d994];return _0x468771;};'use strict';var Sequelize=require(_0xc80f('0x0'));module[_0xc80f('0x1')]={'penalty':{'type':Sequelize[_0xc80f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe780=['exports','INTEGER'];(function(_0x4e4827,_0x4c1947){var _0x58d622=function(_0x5a6ab6){while(--_0x5a6ab6){_0x4e4827['push'](_0x4e4827['shift']());}};_0x58d622(++_0x4c1947);}(_0xe780,0x90));var _0x0e78=function(_0x239dd9,_0x2f2526){_0x239dd9=_0x239dd9-0x0;var _0x39fcb1=_0xe780[_0x239dd9];return _0x39fcb1;};'use strict';var Sequelize=require('sequelize');module[_0x0e78('0x0')]={'penalty':{'type':Sequelize[_0x0e78('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index f697648..e7a18e8 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 _0xfb77=['./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x580725,_0x50a4b3){var _0x2c8911=function(_0x2216f8){while(--_0x2216f8){_0x580725['push'](_0x580725['shift']());}};_0x2c8911(++_0x50a4b3);}(_0xfb77,0x157));var _0x7fb7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xfb77[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7fb7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7fb7('0x1'));var moment=require(_0x7fb7('0x2'));var BPromise=require(_0x7fb7('0x3'));var rp=require(_0x7fb7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fb7('0x5'));var config=require(_0x7fb7('0x6'));var attributes=require(_0x7fb7('0x7'));module['exports']=function(_0xb14489,_0x3f0c86){return _0xb14489[_0x7fb7('0x8')](_0x7fb7('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41e5=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','path','rimraf','./userOpenchannelQueue.attributes','exports','define'];(function(_0x4471b3,_0x511a9f){var _0x386593=function(_0x1057e2){while(--_0x1057e2){_0x4471b3['push'](_0x4471b3['shift']());}};_0x386593(++_0x511a9f);}(_0x41e5,0x176));var _0x541e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41e5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x541e('0x0'));var util=require(_0x541e('0x1'));var logger=require(_0x541e('0x2'))(_0x541e('0x3'));var moment=require(_0x541e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x541e('0x5'));var rimraf=require(_0x541e('0x6'));var config=require('../../config/environment');var attributes=require(_0x541e('0x7'));module[_0x541e('0x8')]=function(_0x36830a,_0xb51d96){return _0x36830a[_0x541e('0x9')](_0x541e('0xa'),attributes,{'tableName':_0x541e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index fd8a91b..c76c487 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 _0x7f3d=['debug','request\x20sent','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','then','info'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x7f3d,0xbc));var _0xd7f3=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0x7f3d[_0x172948];return _0x4aeaa9;};'use strict';var _=require(_0xd7f3('0x0'));var util=require(_0xd7f3('0x1'));var moment=require(_0xd7f3('0x2'));var BPromise=require(_0xd7f3('0x3'));var rs=require(_0xd7f3('0x4'));var fs=require('fs');var Redis=require(_0xd7f3('0x5'));var db=require(_0xd7f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd7f3('0x7'));var config=require(_0xd7f3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd7f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa31053,_0x526f3b,_0x36594a){return new BPromise(function(_0x5e073b,_0x474681){return client['request'](_0xa31053,_0x36594a)[_0xd7f3('0xa')](function(_0x1f0bbe){logger[_0xd7f3('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x526f3b,'request\x20sent');logger[_0xd7f3('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x526f3b,_0xd7f3('0xd'),JSON[_0xd7f3('0xe')](_0x1f0bbe));if(_0x1f0bbe[_0xd7f3('0xf')]){if(_0x1f0bbe['error'][_0xd7f3('0x10')]===0x1f4){logger['error'](_0xd7f3('0x11'),_0x526f3b,_0x1f0bbe[_0xd7f3('0xf')][_0xd7f3('0x12')]);return _0x474681(_0x1f0bbe[_0xd7f3('0xf')][_0xd7f3('0x12')]);}logger[_0xd7f3('0xf')](_0xd7f3('0x11'),_0x526f3b,_0x1f0bbe[_0xd7f3('0xf')][_0xd7f3('0x12')]);return _0x5e073b(_0x1f0bbe[_0xd7f3('0xf')][_0xd7f3('0x12')]);}else{logger[_0xd7f3('0xb')](_0xd7f3('0x11'),_0x526f3b,_0xd7f3('0xd'));_0x5e073b(_0x1f0bbe['result'][_0xd7f3('0x12')]);}})[_0xd7f3('0x13')](function(_0xd321d1){logger['error'](_0xd7f3('0x11'),_0x526f3b,_0xd321d1);_0x474681(_0xd321d1);});});} \ No newline at end of file +var _0x5e45=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f7115,_0x573c94){var _0x41ca8d=function(_0x47105d){while(--_0x47105d){_0x1f7115['push'](_0x1f7115['shift']());}};_0x41ca8d(++_0x573c94);}(_0x5e45,0x16c));var _0x55e4=function(_0x52ad65,_0x33d94d){_0x52ad65=_0x52ad65-0x0;var _0x10f111=_0x5e45[_0x52ad65];return _0x10f111;};'use strict';var _=require(_0x55e4('0x0'));var util=require('util');var moment=require(_0x55e4('0x1'));var BPromise=require(_0x55e4('0x2'));var rs=require(_0x55e4('0x3'));var fs=require('fs');var Redis=require(_0x55e4('0x4'));var db=require(_0x55e4('0x5'))['db'];var utils=require(_0x55e4('0x6'));var logger=require('../../config/logger')(_0x55e4('0x7'));var config=require('../../config/environment');var jayson=require(_0x55e4('0x8'));var client=jayson[_0x55e4('0x9')][_0x55e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eba0b,_0x30dc70,_0x3db6b2){return new BPromise(function(_0x37033c,_0x2344ea){return client[_0x55e4('0xb')](_0x1eba0b,_0x3db6b2)[_0x55e4('0xc')](function(_0x4da947){logger[_0x55e4('0xd')](_0x55e4('0xe'),_0x30dc70,_0x55e4('0xf'));logger[_0x55e4('0x10')](_0x55e4('0x11'),_0x30dc70,_0x55e4('0xf'),JSON[_0x55e4('0x12')](_0x4da947));if(_0x4da947[_0x55e4('0x13')]){if(_0x4da947['error'][_0x55e4('0x14')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x30dc70,_0x4da947[_0x55e4('0x13')][_0x55e4('0x15')]);return _0x2344ea(_0x4da947[_0x55e4('0x13')][_0x55e4('0x15')]);}logger[_0x55e4('0x13')](_0x55e4('0xe'),_0x30dc70,_0x4da947[_0x55e4('0x13')]['message']);return _0x37033c(_0x4da947['error'][_0x55e4('0x15')]);}else{logger['info'](_0x55e4('0xe'),_0x30dc70,_0x55e4('0xf'));_0x37033c(_0x4da947[_0x55e4('0x16')]['message']);}})[_0x55e4('0x17')](function(_0x290063){logger[_0x55e4('0x13')](_0x55e4('0xe'),_0x30dc70,_0x290063);_0x2344ea(_0x290063);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index bbce205..3ad17fb 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 _0xf896=['create','clone','/:id/sections','addSections','put','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','show','getSections','/:id/resources','getResources','post'];(function(_0xabc7d,_0x538ddb){var _0x5f1404=function(_0x47cf96){while(--_0x47cf96){_0xabc7d['push'](_0xabc7d['shift']());}};_0x5f1404(++_0x538ddb);}(_0xf896,0x88));var _0x6f89=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0xf896[_0x5a7d5f];return _0x5dcded;};'use strict';var multer=require(_0x6f89('0x0'));var util=require(_0x6f89('0x1'));var path=require(_0x6f89('0x2'));var timeout=require(_0x6f89('0x3'));var express=require(_0x6f89('0x4'));var router=express['Router']();var fs_extra=require(_0x6f89('0x5'));var auth=require(_0x6f89('0x6'));var interaction=require(_0x6f89('0x7'));var config=require(_0x6f89('0x8'));var controller=require(_0x6f89('0x9'));router[_0x6f89('0xa')]('/',auth[_0x6f89('0xb')](),controller['index']);router['get'](_0x6f89('0xc'),auth['isAuthenticated'](),controller[_0x6f89('0xd')]);router[_0x6f89('0xa')]('/:id',auth[_0x6f89('0xb')](),controller[_0x6f89('0xe')]);router[_0x6f89('0xa')]('/:id/sections',auth[_0x6f89('0xb')](),controller[_0x6f89('0xf')]);router[_0x6f89('0xa')](_0x6f89('0x10'),auth['isAuthenticated'](),controller[_0x6f89('0x11')]);router[_0x6f89('0x12')]('/',auth[_0x6f89('0xb')](),controller[_0x6f89('0x13')]);router[_0x6f89('0x12')]('/:id/clone',auth[_0x6f89('0xb')](),controller[_0x6f89('0x14')]);router[_0x6f89('0x12')](_0x6f89('0x15'),auth[_0x6f89('0xb')](),controller[_0x6f89('0x16')]);router[_0x6f89('0x12')](_0x6f89('0x10'),auth['isAuthenticated'](),controller['addResources']);router[_0x6f89('0x17')](_0x6f89('0x18'),auth[_0x6f89('0xb')](),controller[_0x6f89('0x19')]);router[_0x6f89('0x1a')](_0x6f89('0x18'),auth[_0x6f89('0xb')](),controller[_0x6f89('0x1b')]);router[_0x6f89('0x1a')](_0x6f89('0x15'),auth[_0x6f89('0xb')](),controller[_0x6f89('0x1c')]);router[_0x6f89('0x1a')]('/:id/resources',auth[_0x6f89('0xb')](),controller[_0x6f89('0x1d')]);module[_0x6f89('0x1e')]=router; \ No newline at end of file +var _0x6f36=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','create','clone','addSections','addResources','put','update','delete','destroy','removeSections','/:id/resources','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2dd04d,_0x1feb11){var _0x543ca7=function(_0x5c66c9){while(--_0x5c66c9){_0x2dd04d['push'](_0x2dd04d['shift']());}};_0x543ca7(++_0x1feb11);}(_0x6f36,0x102));var _0x66f3=function(_0x27d57a,_0x1f1c02){_0x27d57a=_0x27d57a-0x0;var _0x4e99a5=_0x6f36[_0x27d57a];return _0x4e99a5;};'use strict';var multer=require(_0x66f3('0x0'));var util=require(_0x66f3('0x1'));var path=require(_0x66f3('0x2'));var timeout=require(_0x66f3('0x3'));var express=require(_0x66f3('0x4'));var router=express['Router']();var fs_extra=require(_0x66f3('0x5'));var auth=require(_0x66f3('0x6'));var interaction=require(_0x66f3('0x7'));var config=require(_0x66f3('0x8'));var controller=require(_0x66f3('0x9'));router[_0x66f3('0xa')]('/',auth[_0x66f3('0xb')](),controller[_0x66f3('0xc')]);router['get'](_0x66f3('0xd'),auth[_0x66f3('0xb')](),controller[_0x66f3('0xe')]);router[_0x66f3('0xa')](_0x66f3('0xf'),auth['isAuthenticated'](),controller[_0x66f3('0x10')]);router['get'](_0x66f3('0x11'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x12')]);router[_0x66f3('0xa')]('/:id/resources',auth[_0x66f3('0xb')](),controller[_0x66f3('0x13')]);router[_0x66f3('0x14')]('/',auth[_0x66f3('0xb')](),controller[_0x66f3('0x15')]);router[_0x66f3('0x14')]('/:id/clone',auth['isAuthenticated'](),controller[_0x66f3('0x16')]);router['post'](_0x66f3('0x11'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x17')]);router['post']('/:id/resources',auth[_0x66f3('0xb')](),controller[_0x66f3('0x18')]);router[_0x66f3('0x19')](_0x66f3('0xf'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x1a')]);router[_0x66f3('0x1b')](_0x66f3('0xf'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x1c')]);router[_0x66f3('0x1b')](_0x66f3('0x11'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x1d')]);router['delete'](_0x66f3('0x1e'),auth[_0x66f3('0xb')](),controller[_0x66f3('0x1f')]);module[_0x66f3('0x20')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index cfcd5cb..cb3abcb 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 _0x8278=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0xd56f72,_0xfb682b){var _0x2fcfcf=function(_0xba0b19){while(--_0xba0b19){_0xd56f72['push'](_0xd56f72['shift']());}};_0x2fcfcf(++_0xfb682b);}(_0x8278,0xb6));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8827('0x0'));module[_0x8827('0x1')]={'name':{'type':Sequelize[_0x8827('0x2')],'allowNull':![],'unique':_0x8827('0x3')},'crudPermissions':{'type':Sequelize[_0x8827('0x2')],'set':function(_0x48e30d){this[_0x8827('0x4')](_0x8827('0x5'),_0x48e30d?_0x48e30d[_0x8827('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x8827('0x5'))?this[_0x8827('0x7')](_0x8827('0x5'))[_0x8827('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8827('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8827('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8827('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8827('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8827('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8827('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8827('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3eca=['BOOLEAN','sequelize','name','STRING','join','getDataValue','crudPermissions','split'];(function(_0x24579a,_0x59612d){var _0x59dff7=function(_0x47c50f){while(--_0x47c50f){_0x24579a['push'](_0x24579a['shift']());}};_0x59dff7(++_0x59612d);}(_0x3eca,0xb9));var _0xa3ec=function(_0x2002b3,_0x11e91c){_0x2002b3=_0x2002b3-0x0;var _0x2756f0=_0x3eca[_0x2002b3];return _0x2756f0;};'use strict';var Sequelize=require(_0xa3ec('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa3ec('0x1')},'crudPermissions':{'type':Sequelize[_0xa3ec('0x2')],'set':function(_0x4fb30f){this['setDataValue']('crudPermissions',_0x4fb30f?_0x4fb30f[_0xa3ec('0x3')](''):[]);},'get':function(){return this[_0xa3ec('0x4')](_0xa3ec('0x5'))?this[_0xa3ec('0x4')]('crudPermissions')[_0xa3ec('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa3ec('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 4803c15..5b2f4fb 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 _0x4b74=['catch','create','body','clone','length','omit','updatedAt','crudPermissions','createdAt','each','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','destroy','describe','sequelize','transaction','get','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','autoAssociation','Dashboard','forEach','push','resourceId','addResources','bulkCreate','removeResources','getResources','section','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','map','UserProfile','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','type','filter','merge','options','includeAll','include','findAll','rows','show','params','find'];(function(_0x4f2055,_0x392905){var _0x4bcb37=function(_0x41582b){while(--_0x41582b){_0x4f2055['push'](_0x4f2055['shift']());}};_0x4bcb37(++_0x392905);}(_0x4b74,0x103));var _0x44b7=function(_0x4c49f3,_0x106f13){_0x4c49f3=_0x4c49f3-0x0;var _0x482989=_0x4b74[_0x4c49f3];return _0x482989;};'use strict';var emlformat=require(_0x44b7('0x0'));var rimraf=require(_0x44b7('0x1'));var zipdir=require(_0x44b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44b7('0x3'));var moment=require(_0x44b7('0x4'));var BPromise=require(_0x44b7('0x5'));var Mustache=require(_0x44b7('0x6'));var util=require(_0x44b7('0x7'));var path=require(_0x44b7('0x8'));var sox=require(_0x44b7('0x9'));var csv=require(_0x44b7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b7('0xb'));var _=require(_0x44b7('0xc'));var squel=require(_0x44b7('0xd'));var crypto=require('crypto');var jsforce=require(_0x44b7('0xe'));var deskjs=require(_0x44b7('0xf'));var toCsv=require(_0x44b7('0xa'));var querystring=require('querystring');var Papa=require(_0x44b7('0x10'));var Redis=require(_0x44b7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x44b7('0x12'));var as=require(_0x44b7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44b7('0x14'))(_0x44b7('0x15'));var utils=require(_0x44b7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x44b7('0x17'));var db=require(_0x44b7('0x18'))['db'];config['redis']=_[_0x44b7('0x19')](config['redis'],{'host':_0x44b7('0x1a'),'port':0x18eb});var socket=require(_0x44b7('0x1b'))(new Redis(config[_0x44b7('0x1c')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x186f40,_0x49c0d3){_0x49c0d3=_0x49c0d3||0xcc;return function(_0x5ebac8){if(_0x5ebac8){return _0x186f40['sendStatus'](_0x49c0d3);}return _0x186f40[_0x44b7('0x1d')](_0x49c0d3)[_0x44b7('0x1e')]();};}function respondWithResult(_0x4bae25,_0x304807){_0x304807=_0x304807||0xc8;return function(_0x3ba9b0){if(_0x3ba9b0){return _0x4bae25[_0x44b7('0x1d')](_0x304807)[_0x44b7('0x1f')](_0x3ba9b0);}};}function respondWithFilteredResult(_0x18cc2f,_0x206e28){return function(_0x40c84e){if(_0x40c84e){var _0xb6e09d=typeof _0x206e28[_0x44b7('0x20')]===_0x44b7('0x21')&&typeof _0x206e28[_0x44b7('0x22')]===_0x44b7('0x21');var _0xee568b=_0x40c84e['count'];var _0x90b0ad=_0xb6e09d?0x0:_0x206e28[_0x44b7('0x20')];var _0x58f438=_0xb6e09d?_0x40c84e[_0x44b7('0x23')]:_0x206e28[_0x44b7('0x20')]+_0x206e28[_0x44b7('0x22')];var _0x300eea;if(_0x58f438>=_0xee568b){_0x58f438=_0xee568b;_0x300eea=0xc8;}else{_0x300eea=0xce;}_0x18cc2f[_0x44b7('0x1d')](_0x300eea);return _0x18cc2f[_0x44b7('0x24')](_0x44b7('0x25'),_0x90b0ad+'-'+_0x58f438+'/'+_0xee568b)['json'](_0x40c84e);}return null;};}function patchUpdates(_0x449abb){return function(_0x507829){try{jsonpatch[_0x44b7('0x26')](_0x507829,_0x449abb,!![]);}catch(_0x24b8d){return BPromise['reject'](_0x24b8d);}return _0x507829[_0x44b7('0x27')]();};}function saveUpdates(_0x4350ef,_0x2eb268){return function(_0x1e0b8d){if(_0x1e0b8d){return _0x1e0b8d[_0x44b7('0x28')](_0x4350ef)[_0x44b7('0x29')](function(_0xe90edf){return _0xe90edf;});}return null;};}function removeEntity(_0x54a933,_0x58c71c){return function(_0x2c2a29){if(_0x2c2a29){return _0x2c2a29['destroy']()[_0x44b7('0x29')](function(){_0x54a933['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39de72,_0x1128b1){return function(_0x15d176){if(!_0x15d176){_0x39de72[_0x44b7('0x2a')](0x194);}return _0x15d176;};}function handleError(_0x2bad24,_0x5bfc84){_0x5bfc84=_0x5bfc84||0x1f4;return function(_0x19416d){logger[_0x44b7('0x2b')](_0x19416d[_0x44b7('0x2c')]);if(_0x19416d[_0x44b7('0x2d')]){delete _0x19416d[_0x44b7('0x2d')];}_0x2bad24['status'](_0x5bfc84)['send'](_0x19416d);};}exports['index']=function(_0x2a83cf,_0x2cbbde){var _0x50c34c={},_0x4ed0cc={},_0x178126={'count':0x0,'rows':[]};var _0x2a7bbe=_[_0x44b7('0x2e')](db[_0x44b7('0x2f')][_0x44b7('0x30')],function(_0x28a90d){return{'name':_0x28a90d[_0x44b7('0x31')],'type':_0x28a90d['type']['key']};});_0x4ed0cc[_0x44b7('0x32')]=_[_0x44b7('0x2e')](_0x2a7bbe,_0x44b7('0x2d'));_0x4ed0cc[_0x44b7('0x33')]=_[_0x44b7('0x34')](_0x2a83cf[_0x44b7('0x33')]);_0x4ed0cc['filters']=_[_0x44b7('0x35')](_0x4ed0cc[_0x44b7('0x32')],_0x4ed0cc[_0x44b7('0x33')]);_0x50c34c[_0x44b7('0x36')]=_[_0x44b7('0x35')](_0x4ed0cc[_0x44b7('0x32')],qs[_0x44b7('0x37')](_0x2a83cf[_0x44b7('0x33')][_0x44b7('0x37')]));_0x50c34c[_0x44b7('0x36')]=_0x50c34c[_0x44b7('0x36')]['length']?_0x50c34c[_0x44b7('0x36')]:_0x4ed0cc[_0x44b7('0x32')];if(!_0x2a83cf['query'][_0x44b7('0x38')](_0x44b7('0x39'))){_0x50c34c[_0x44b7('0x22')]=qs[_0x44b7('0x22')](_0x2a83cf['query'][_0x44b7('0x22')]);_0x50c34c['offset']=qs[_0x44b7('0x20')](_0x2a83cf[_0x44b7('0x33')][_0x44b7('0x20')]);}_0x50c34c[_0x44b7('0x3a')]=qs['sort'](_0x2a83cf[_0x44b7('0x33')][_0x44b7('0x3b')]);_0x50c34c[_0x44b7('0x3c')]=qs['filters'](_[_0x44b7('0x3d')](_0x2a83cf[_0x44b7('0x33')],_0x4ed0cc[_0x44b7('0x3e')]),_0x2a7bbe);if(_0x2a83cf[_0x44b7('0x33')]['filter']){_0x50c34c[_0x44b7('0x3c')]=_['merge'](_0x50c34c[_0x44b7('0x3c')],{'$or':_['map'](_0x2a7bbe,function(_0x2e9877){if(_0x2e9877[_0x44b7('0x3f')]!=='VIRTUAL'){var _0x48c3b3={};_0x48c3b3[_0x2e9877['name']]={'$like':'%'+_0x2a83cf[_0x44b7('0x33')][_0x44b7('0x40')]+'%'};return _0x48c3b3;}})});}_0x50c34c=_[_0x44b7('0x41')]({},_0x50c34c,_0x2a83cf[_0x44b7('0x42')]);var _0x3549e1={'where':_0x50c34c['where']};return db[_0x44b7('0x2f')]['count'](_0x3549e1)[_0x44b7('0x29')](function(_0x1d56e8){_0x178126[_0x44b7('0x23')]=_0x1d56e8;if(_0x2a83cf['query'][_0x44b7('0x43')]){_0x50c34c[_0x44b7('0x44')]=[{'all':!![]}];}return db[_0x44b7('0x2f')][_0x44b7('0x45')](_0x50c34c);})[_0x44b7('0x29')](function(_0xace055){_0x178126[_0x44b7('0x46')]=_0xace055;return _0x178126;})['then'](respondWithFilteredResult(_0x2cbbde,_0x50c34c))['catch'](handleError(_0x2cbbde,null));};exports[_0x44b7('0x47')]=function(_0x2ec3d9,_0xbf1fd5){var _0xa35d97={'raw':![],'where':{'id':_0x2ec3d9[_0x44b7('0x48')]['id']}},_0xd8aaa3={};_0xd8aaa3[_0x44b7('0x32')]=_[_0x44b7('0x34')](db[_0x44b7('0x2f')][_0x44b7('0x30')]);_0xd8aaa3['query']=_['keys'](_0x2ec3d9['query']);_0xd8aaa3['filters']=_[_0x44b7('0x35')](_0xd8aaa3[_0x44b7('0x32')],_0xd8aaa3[_0x44b7('0x33')]);_0xa35d97[_0x44b7('0x36')]=_[_0x44b7('0x35')](_0xd8aaa3[_0x44b7('0x32')],qs[_0x44b7('0x37')](_0x2ec3d9['query'][_0x44b7('0x37')]));_0xa35d97[_0x44b7('0x36')]=_0xa35d97[_0x44b7('0x36')]['length']?_0xa35d97[_0x44b7('0x36')]:_0xd8aaa3[_0x44b7('0x32')];if(_0x2ec3d9[_0x44b7('0x33')]['includeAll']){_0xa35d97[_0x44b7('0x44')]=[{'all':!![]}];}_0xa35d97=_[_0x44b7('0x41')]({},_0xa35d97,_0x2ec3d9['options']);return db[_0x44b7('0x2f')][_0x44b7('0x49')](_0xa35d97)[_0x44b7('0x29')](handleEntityNotFound(_0xbf1fd5,null))[_0x44b7('0x29')](respondWithResult(_0xbf1fd5,null))[_0x44b7('0x4a')](handleError(_0xbf1fd5,null));};exports[_0x44b7('0x4b')]=function(_0x13f70e,_0x5a88d0){return db[_0x44b7('0x2f')][_0x44b7('0x4b')](_0x13f70e[_0x44b7('0x4c')],{})[_0x44b7('0x29')](respondWithResult(_0x5a88d0,0xc9))['catch'](handleError(_0x5a88d0,null));};exports[_0x44b7('0x4d')]=function(_0xede2d3,_0x2936c3){var _0x481240={'where':{'id':_0xede2d3[_0x44b7('0x48')]['id']}},_0x5ba0fa={};_0x5ba0fa[_0x44b7('0x32')]=_[_0x44b7('0x34')](db[_0x44b7('0x2f')]['rawAttributes']);_0x481240[_0x44b7('0x36')]=_[_0x44b7('0x35')](_0x5ba0fa[_0x44b7('0x32')],qs[_0x44b7('0x37')](_0xede2d3['query']['fields']));_0x481240[_0x44b7('0x36')]=_0x481240[_0x44b7('0x36')][_0x44b7('0x4e')]?_0x481240[_0x44b7('0x36')]:_0x5ba0fa[_0x44b7('0x32')];if(_0xede2d3[_0x44b7('0x33')][_0x44b7('0x43')]){_0x481240['include']=[{'all':!![]}];}_0x481240=_[_0x44b7('0x41')]({},_0x481240,_0xede2d3[_0x44b7('0x42')]);return db[_0x44b7('0x2f')][_0x44b7('0x49')](_0x481240)[_0x44b7('0x29')](handleEntityNotFound(_0x2936c3,null))['then'](function(_0x3e313a){if(_0x3e313a){var _0x416824=_0x3e313a['get']({'plain':!![]});_0x416824=qs[_0x44b7('0x4f')](_0x416824,['id','createdAt',_0x44b7('0x50'),_0x44b7('0x51')]);_0xede2d3[_0x44b7('0x4c')]=_[_0x44b7('0x4f')](_0xede2d3[_0x44b7('0x4c')],['id',_0x44b7('0x52'),_0x44b7('0x50')]);return db['sequelize']['transaction'](function(_0x55aba7){return db[_0x44b7('0x2f')][_0x44b7('0x4b')](_[_0x44b7('0x41')](_0x416824,_0xede2d3[_0x44b7('0x4c')]),{'include':_0xede2d3['query'][_0x44b7('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x55aba7})[_0x44b7('0x29')](function(_0x2fb7b5){var _0x149879=_0x2fb7b5['get']({'plain':!![]});return db['UserProfileSection'][_0x44b7('0x45')]({'where':{'userProfileId':_0xede2d3[_0x44b7('0x48')]['id']},'raw':!![]})[_0x44b7('0x29')](function(_0x5bf2e6){if(_0x5bf2e6){return BPromise[_0x44b7('0x53')](_0x5bf2e6,function(_0x2e7220){return new BPromise(function(_0x5075e7,_0x2e273e){if(_0x2e7220['autoAssociation']===null||_0x2e7220['autoAssociation']===0x1)_0x5075e7(null);return db[_0x44b7('0x54')]['findAll']({'where':{'sectionId':_0x2e7220['id']},'raw':!![]})[_0x44b7('0x29')](function(_0x5f3347){var _0x35f474=_[_0x44b7('0x2e')](_0x5f3347,function(_0x131e9c){return qs['omit'](_0x131e9c,['id','createdAt','updatedAt',_0x44b7('0x55')]);});_0x5075e7(_0x35f474);})[_0x44b7('0x4a')](function(_0x561aab){_0x2e273e(_0x561aab);});})[_0x44b7('0x29')](function(_0x117ff4){var _0x13a9c7=qs[_0x44b7('0x4f')](_0x2e7220,['id',_0x44b7('0x52'),_0x44b7('0x50')]);_0x13a9c7[_0x44b7('0x56')]=_0x149879['id'];if(_0x117ff4)_0x13a9c7[_0x44b7('0x57')]=_0x117ff4;return _0x13a9c7;})[_0x44b7('0x29')](function(_0x449357){return db[_0x44b7('0x58')][_0x44b7('0x4b')](_0x449357,{'include':[{'model':db[_0x44b7('0x54')],'as':_0x44b7('0x57')}],'raw':!![],'transaction':_0x55aba7});});})[_0x44b7('0x29')](function(){return _0x149879;});}});});});}})[_0x44b7('0x29')](respondWithResult(_0x2936c3,0xc9))[_0x44b7('0x4a')](handleError(_0x2936c3,null));};exports[_0x44b7('0x28')]=function(_0x8e38cd,_0x24ab46){if(_0x8e38cd[_0x44b7('0x4c')]['id']){delete _0x8e38cd[_0x44b7('0x4c')]['id'];}return db[_0x44b7('0x2f')][_0x44b7('0x49')]({'where':{'id':_0x8e38cd[_0x44b7('0x48')]['id']}})[_0x44b7('0x29')](handleEntityNotFound(_0x24ab46,null))[_0x44b7('0x29')](saveUpdates(_0x8e38cd[_0x44b7('0x4c')],null))['then'](respondWithResult(_0x24ab46,null))[_0x44b7('0x4a')](handleError(_0x24ab46,null));};exports[_0x44b7('0x59')]=function(_0x3eb3b3,_0x22adf2){return db[_0x44b7('0x2f')][_0x44b7('0x49')]({'where':{'id':_0x3eb3b3[_0x44b7('0x48')]['id']}})[_0x44b7('0x29')](handleEntityNotFound(_0x22adf2,null))[_0x44b7('0x29')](removeEntity(_0x22adf2,null))['catch'](handleError(_0x22adf2,null));};exports['describe']=function(_0x440513,_0x17c31b){return db[_0x44b7('0x2f')][_0x44b7('0x5a')]()['then'](respondWithResult(_0x17c31b,null))[_0x44b7('0x4a')](handleError(_0x17c31b,null));};exports['addSections']=function(_0x30ab7e,_0x42317a){var _0x49ec9a=_0x30ab7e[_0x44b7('0x4c')];return db[_0x44b7('0x2f')][_0x44b7('0x49')]({'where':{'id':_0x30ab7e[_0x44b7('0x48')]['id']}})[_0x44b7('0x29')](handleEntityNotFound(_0x42317a,null))[_0x44b7('0x29')](function(_0x202f8b){if(_0x202f8b){return db[_0x44b7('0x5b')][_0x44b7('0x5c')](function(_0x5d74be){return db[_0x44b7('0x58')][_0x44b7('0x59')]({'where':{'userProfileId':_0x30ab7e[_0x44b7('0x48')]['id'],'sectionId':_['map'](_0x49ec9a,function(_0x2b092b){return _0x2b092b[_0x44b7('0x55')];})},'transaction':_0x5d74be})[_0x44b7('0x29')](function(){var _0x4d316f=_[_0x44b7('0x2e')](_0x49ec9a,function(_0xb31c7){_0xb31c7[_0x44b7('0x56')]=_0x30ab7e[_0x44b7('0x48')]['id'];return _0xb31c7;});var _0x285bc2=[];return BPromise['each'](_0x4d316f,function(_0x4bffa7){return db[_0x44b7('0x58')][_0x44b7('0x4b')](_0x4bffa7,{'include':[{'model':db[_0x44b7('0x54')],'as':'Resources'}],'raw':!![],'transaction':_0x5d74be})['then'](function(_0x5c7f8e){_0x285bc2['push'](_0x5c7f8e[_0x44b7('0x5d')]({'plain':!![]}));});})[_0x44b7('0x29')](function(){return _0x285bc2;});});});}})[_0x44b7('0x29')](function(_0x2bd6cc){return _0x2bd6cc;})['then'](respondWithResult(_0x42317a,null))[_0x44b7('0x4a')](handleError(_0x42317a,null));};exports[_0x44b7('0x5e')]=function(_0x3dc8e2,_0xc3d1c4){var _0xb9e744;return db[_0x44b7('0x2f')][_0x44b7('0x49')]({'where':{'id':_0x3dc8e2[_0x44b7('0x48')]['id']},'attributes':['id',_0x44b7('0x2d')]})[_0x44b7('0x29')](handleEntityNotFound(_0xc3d1c4,null))[_0x44b7('0x29')](function(_0x3f787c){if(_0x3f787c){_0xb9e744=_0x3f787c;return db[_0x44b7('0x58')][_0x44b7('0x59')]({'where':{'userProfileId':_0x3dc8e2[_0x44b7('0x48')]['id'],'sectionId':_0x3dc8e2['query'][_0x44b7('0x5f')]}});}})[_0x44b7('0x29')](function(){return _0xb9e744;})[_0x44b7('0x29')](respondWithStatusCode(_0xc3d1c4,null))['catch'](handleError(_0xc3d1c4,null));};exports[_0x44b7('0x60')]=function(_0x563852,_0x1bd40e){var _0x11f3dd=[];var _0x361adc=[];return db[_0x44b7('0x58')][_0x44b7('0x45')]({'where':{'userProfileId':_0x563852['params']['id']},'raw':!![]})[_0x44b7('0x29')](function(_0x1825ca){_0x11f3dd=_[_0x44b7('0x40')](_0x1825ca,function(_0x1dc9b1){return _0x1dc9b1['enabled']===0x1||_[_0x44b7('0x61')]([0x3eb,0x709],_0x1dc9b1[_0x44b7('0x55')]);});if(!_[_0x44b7('0x62')](_0x11f3dd)){return _[_0x44b7('0x2e')](_0x11f3dd,function(_0x452a13){return _0x452a13[_0x44b7('0x55')];});}else{return;}})[_0x44b7('0x29')](function(_0x2bfd85){if(_0x2bfd85)_0x361adc=_0x2bfd85;if(_['includes'](_0x361adc,0x64)){var _0xcd7c36=_[_0x44b7('0x49')](_0x11f3dd,{'sectionId':0x64});return hasDefaultDashboard(_0xcd7c36)[_0x44b7('0x29')](function(_0x4d2414){return _[_0x44b7('0x2e')](_0x11f3dd,function(_0x43c831){if(_0x43c831[_0x44b7('0x55')]===0x64){_0x43c831[_0x44b7('0x63')]=_0x4d2414;}return _0x43c831;});});}else{return;}})[_0x44b7('0x29')](function(_0x3efcf5){if(_0x3efcf5)_0x11f3dd=_0x3efcf5;if(_[_0x44b7('0x61')](_0x361adc,0x3eb)){var _0x47cdd1=_['find'](_0x11f3dd,{'sectionId':0x3eb});return getCustomDashboards(_0x47cdd1)[_0x44b7('0x29')](function(_0x4e3924){return _['map'](_0x11f3dd,function(_0x22d22d){if(_0x47cdd1[_0x44b7('0x64')]){if(_0x22d22d[_0x44b7('0x55')]===0x3eb){_0x22d22d[_0x44b7('0x63')]=_0x4e3924;}}else{if(_0x22d22d[_0x44b7('0x55')]===0x64){_0x22d22d[_0x44b7('0x63')]=_0x4e3924;}}return _0x22d22d;});});}else{return;}})['then'](function(_0x4f3070){if(_0x4f3070)_0x11f3dd=_0x4f3070;if(_[_0x44b7('0x61')](_0x361adc,0x709)){var _0x4ffab9=_[_0x44b7('0x49')](_0x11f3dd,{'sectionId':0x709});return getPlugins(_0x4ffab9)[_0x44b7('0x29')](function(_0x175876){if(_0x4ffab9[_0x44b7('0x64')]){return _['map'](_0x11f3dd,function(_0x159c71){if(_0x159c71[_0x44b7('0x55')]===0x709){_0x159c71['subsections']=_0x175876;}return _0x159c71;});}else{var _0x2d95bf={'sectionId':0x76c,'enabled':0x1,'subsections':_0x175876};var _0x2c49bc=_[_0x44b7('0x2e')](_0x11f3dd);_0x2c49bc['push'](_0x2d95bf);return _0x2c49bc;}});}else{return;}})[_0x44b7('0x29')](function(_0x2fe688){if(_0x2fe688)_0x11f3dd=_0x2fe688;return _[_0x44b7('0x40')](_0x11f3dd,[_0x44b7('0x64'),0x1]);})[_0x44b7('0x29')](respondWithResult(_0x1bd40e,null))['catch'](handleError(_0x1bd40e,null));};function hasDefaultDashboard(_0x298928){var _0x23afc1=[0x65];return new BPromise(function(_0x6bf686,_0x4c09d2){try{if(_0x298928['autoAssociation']){_0x6bf686(_0x23afc1);}else{return db[_0x44b7('0x54')]['findOne']({'where':{'sectionId':_0x298928['id']},'raw':!![]})[_0x44b7('0x29')](function(_0x5c7953){_0x5c7953?_0x6bf686(_0x23afc1):_0x6bf686();});}}catch(_0x45506e){_0x4c09d2(_0x45506e);}});}function getCustomDashboards(_0x50d2a6){var _0x50e159=[];return new BPromise(function(_0x5d5ad6,_0x1478ba){try{if(_0x50d2a6[_0x44b7('0x65')]){return db[_0x44b7('0x66')][_0x44b7('0x45')]({'raw':!![]})[_0x44b7('0x29')](function(_0x280a22){_0x280a22[_0x44b7('0x67')](function(_0x205115){_0x50e159[_0x44b7('0x68')](_0x205115['id']+0x1869f);});_0x5d5ad6(_0x50e159);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x50d2a6['id']},'raw':!![]})[_0x44b7('0x29')](function(_0x2bc7fc){_0x2bc7fc[_0x44b7('0x67')](function(_0x1d9c66){_0x50e159['push'](_0x1d9c66[_0x44b7('0x69')]+0x1869f);});_0x5d5ad6(_0x50e159);});}}catch(_0x58dbbd){_0x1478ba(_0x58dbbd);}});}function getPlugins(_0x174799){var _0x256e0b=[];return new BPromise(function(_0x4401a2,_0x34f34b){try{if(_0x174799['autoAssociation']){return db['Plugin'][_0x44b7('0x45')]({'raw':!![]})[_0x44b7('0x29')](function(_0xa6c02){_0xa6c02[_0x44b7('0x67')](function(_0x5dbe18){_0x256e0b[_0x44b7('0x68')](_0x5dbe18['id']+0x15b38);});_0x4401a2(_0x256e0b);});}else{return db[_0x44b7('0x54')]['findAll']({'where':{'sectionId':_0x174799['id']},'raw':!![]})[_0x44b7('0x29')](function(_0x2dc564){_0x2dc564[_0x44b7('0x67')](function(_0x2b80da){_0x256e0b[_0x44b7('0x68')](_0x2b80da[_0x44b7('0x69')]+0x15b38);});_0x4401a2(_0x256e0b);});}}catch(_0x9a8775){_0x34f34b(_0x9a8775);}});}exports[_0x44b7('0x6a')]=function(_0x190e92,_0x4d8a3d){return db[_0x44b7('0x2f')][_0x44b7('0x49')]({'where':{'id':_0x190e92[_0x44b7('0x48')]['id']}})[_0x44b7('0x29')](handleEntityNotFound(_0x4d8a3d,null))['then'](function(_0x26c7ef){if(_0x26c7ef){return db['sequelize'][_0x44b7('0x5c')](function(_0x22ec9b){return db[_0x44b7('0x58')][_0x44b7('0x45')]({'where':{'userProfileId':_0x190e92['params']['id']},'attributes':['id'],'raw':!![]})[_0x44b7('0x29')](function(_0x4a6a87){if(_0x4a6a87){return db[_0x44b7('0x58')][_0x44b7('0x59')]({'where':{'userProfileId':_0x190e92[_0x44b7('0x48')]['id'],'id':_[_0x44b7('0x2e')](_0x4a6a87,function(_0xc0482d){return _0xc0482d['id'];})},'transaction':_0x22ec9b});}})[_0x44b7('0x29')](function(_0x32801a){var _0x18e321=_[_0x44b7('0x2e')](_0x190e92[_0x44b7('0x4c')],function(_0x25a099){_0x25a099[_0x44b7('0x56')]=_0x190e92[_0x44b7('0x48')]['id'];return _0x25a099;});return db[_0x44b7('0x58')][_0x44b7('0x6b')](_0x18e321,{'raw':!![],'transaction':_0x22ec9b});})[_0x44b7('0x29')](function(_0x247ed5){var _0x2747ff=_[_0x44b7('0x40')](_[_0x44b7('0x2e')](_0x247ed5,function(_0x127e4f){return _0x127e4f[_0x44b7('0x5d')]({'plain':!![]});}),{'includeAll':![]});if(_0x2747ff){return db[_0x44b7('0x58')][_0x44b7('0x45')]({'where':{'userProfileId':_0x190e92[_0x44b7('0x48')]['id'],'sectionId':_[_0x44b7('0x2e')](_0x2747ff,function(_0xcb6363){return _0xcb6363[_0x44b7('0x55')];})},'attributes':['id',_0x44b7('0x55')],'raw':!![]})[_0x44b7('0x29')](function(_0x11ff32){var _0x5e7b56=_['map'](_0x190e92[_0x44b7('0x4c')],function(_0x2fa422){_0x2fa422[_0x44b7('0x56')]=_0x190e92['params']['id'];return _0x2fa422;});return db['UserProfileResource'][_0x44b7('0x6b')](_0x5e7b56,{'raw':!![],'transaction':_0x22ec9b});});}})[_0x44b7('0x4a')](handleError(_0x4d8a3d,null));});}})[_0x44b7('0x29')](function(_0x443298){var _0x19de3e=_[_0x44b7('0x2e')](_0x443298,function(_0x13aae4){return _0x13aae4['get']({'plain':!![]});});})[_0x44b7('0x29')](respondWithResult(_0x4d8a3d,null))[_0x44b7('0x4a')](handleError(_0x4d8a3d,null));};exports[_0x44b7('0x6c')]=function(_0x2b8421,_0x3ff3e8,_0x3fc2b7){return db[_0x44b7('0x2f')][_0x44b7('0x49')]({'where':{'id':_0x2b8421[_0x44b7('0x48')]['id']}})[_0x44b7('0x29')](handleEntityNotFound(_0x3ff3e8,null))['then'](function(_0x39d06c){if(_0x39d06c){return _0x39d06c[_0x44b7('0x6c')](_0x2b8421[_0x44b7('0x33')][_0x44b7('0x5f')]);}})[_0x44b7('0x29')](respondWithStatusCode(_0x3ff3e8,null))[_0x44b7('0x4a')](handleError(_0x3ff3e8,null));};exports[_0x44b7('0x6d')]=function(_0x340add,_0x19ec23){var _0x160c0f={};if(!_0x340add[_0x44b7('0x33')][_0x44b7('0x6e')])throw new Error('Missing\x20section\x20parameter');if(!_0x340add['query'][_0x44b7('0x38')](_0x44b7('0x39'))){_0x160c0f[_0x44b7('0x22')]=qs[_0x44b7('0x22')](_0x340add['query'][_0x44b7('0x22')]);_0x160c0f[_0x44b7('0x20')]=qs['offset'](_0x340add[_0x44b7('0x33')]['offset']);}return db[_0x44b7('0x2f')][_0x44b7('0x49')]({'where':{'id':_0x340add[_0x44b7('0x48')]['id']}})[_0x44b7('0x29')](function(_0x22b0cf){if(!_0x22b0cf)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x340add['params']['id']);return db[_0x44b7('0x2f')][_0x44b7('0x6d')](_0x340add);})[_0x44b7('0x29')](respondWithFilteredResult(_0x19ec23,_0x160c0f))[_0x44b7('0x4a')](handleError(_0x19ec23,null));}; \ No newline at end of file +var _0x8af6=['forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','save','update','then','destroy','name','map','UserProfile','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','clone','keys','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','get','UserProfileSection','autoAssociation','Resources','UserProfileResource','describe','addSections','sectionId','push','removeSections','ids','enabled','includes','isEmpty','subsections','findOne','Dashboard'];(function(_0x5c15b8,_0x3ac219){var _0x160211=function(_0x49b7d5){while(--_0x49b7d5){_0x5c15b8['push'](_0x5c15b8['shift']());}};_0x160211(++_0x3ac219);}(_0x8af6,0x76));var _0x68af=function(_0x32b336,_0x37ab35){_0x32b336=_0x32b336-0x0;var _0x51035e=_0x8af6[_0x32b336];return _0x51035e;};'use strict';var emlformat=require(_0x68af('0x0'));var rimraf=require(_0x68af('0x1'));var zipdir=require(_0x68af('0x2'));var jsonpatch=require(_0x68af('0x3'));var rp=require(_0x68af('0x4'));var moment=require(_0x68af('0x5'));var BPromise=require(_0x68af('0x6'));var Mustache=require(_0x68af('0x7'));var util=require(_0x68af('0x8'));var path=require(_0x68af('0x9'));var sox=require('sox');var csv=require(_0x68af('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68af('0xb'));var _=require(_0x68af('0xc'));var squel=require(_0x68af('0xd'));var crypto=require(_0x68af('0xe'));var jsforce=require(_0x68af('0xf'));var deskjs=require(_0x68af('0x10'));var toCsv=require(_0x68af('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x68af('0x11'));var authService=require(_0x68af('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x68af('0x13'));var hardwareService=require(_0x68af('0x14'));var logger=require(_0x68af('0x15'))(_0x68af('0x16'));var utils=require(_0x68af('0x17'));var config=require(_0x68af('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x68af('0x19')]=_['defaults'](config['redis'],{'host':_0x68af('0x1a'),'port':0x18eb});var socket=require(_0x68af('0x1b'))(new Redis(config[_0x68af('0x19')]));require('./userProfile.socket')[_0x68af('0x1c')](socket);function respondWithStatusCode(_0x50f1ea,_0x3a6d18){_0x3a6d18=_0x3a6d18||0xcc;return function(_0x3c37db){if(_0x3c37db){return _0x50f1ea[_0x68af('0x1d')](_0x3a6d18);}return _0x50f1ea[_0x68af('0x1e')](_0x3a6d18)[_0x68af('0x1f')]();};}function respondWithResult(_0x58764e,_0x43c1d9){_0x43c1d9=_0x43c1d9||0xc8;return function(_0xcdf590){if(_0xcdf590){return _0x58764e[_0x68af('0x1e')](_0x43c1d9)[_0x68af('0x20')](_0xcdf590);}};}function respondWithFilteredResult(_0x59d7f3,_0x5357b1){return function(_0x3aa998){if(_0x3aa998){var _0x29ddbf=typeof _0x5357b1['offset']===_0x68af('0x21')&&typeof _0x5357b1[_0x68af('0x22')]===_0x68af('0x21');var _0x1a82f0=_0x3aa998['count'];var _0x2ed0a6=_0x29ddbf?0x0:_0x5357b1[_0x68af('0x23')];var _0x5ab38b=_0x29ddbf?_0x3aa998['count']:_0x5357b1[_0x68af('0x23')]+_0x5357b1[_0x68af('0x22')];var _0x14b930;if(_0x5ab38b>=_0x1a82f0){_0x5ab38b=_0x1a82f0;_0x14b930=0xc8;}else{_0x14b930=0xce;}_0x59d7f3[_0x68af('0x1e')](_0x14b930);return _0x59d7f3[_0x68af('0x24')](_0x68af('0x25'),_0x2ed0a6+'-'+_0x5ab38b+'/'+_0x1a82f0)['json'](_0x3aa998);}return null;};}function patchUpdates(_0x25a210){return function(_0x3c71ef){try{jsonpatch['apply'](_0x3c71ef,_0x25a210,!![]);}catch(_0x3ebd57){return BPromise['reject'](_0x3ebd57);}return _0x3c71ef[_0x68af('0x26')]();};}function saveUpdates(_0x1f0d0e,_0xa489c3){return function(_0x16e07a){if(_0x16e07a){return _0x16e07a[_0x68af('0x27')](_0x1f0d0e)[_0x68af('0x28')](function(_0x5851b9){return _0x5851b9;});}return null;};}function removeEntity(_0x514ebc,_0x29f003){return function(_0x6c175e){if(_0x6c175e){return _0x6c175e[_0x68af('0x29')]()[_0x68af('0x28')](function(){_0x514ebc[_0x68af('0x1e')](0xcc)[_0x68af('0x1f')]();});}};}function handleEntityNotFound(_0x1839f9,_0x2729fd){return function(_0x5417e9){if(!_0x5417e9){_0x1839f9[_0x68af('0x1d')](0x194);}return _0x5417e9;};}function handleError(_0x1c6011,_0xec7c01){_0xec7c01=_0xec7c01||0x1f4;return function(_0x3d1303){logger['error'](_0x3d1303['stack']);if(_0x3d1303[_0x68af('0x2a')]){delete _0x3d1303[_0x68af('0x2a')];}_0x1c6011[_0x68af('0x1e')](_0xec7c01)['send'](_0x3d1303);};}exports['index']=function(_0x3c3268,_0x135dc1){var _0x5c0adb={},_0x718b39={},_0x2d5aac={'count':0x0,'rows':[]};var _0x21b677=_[_0x68af('0x2b')](db[_0x68af('0x2c')][_0x68af('0x2d')],function(_0x18120e){return{'name':_0x18120e['fieldName'],'type':_0x18120e[_0x68af('0x2e')][_0x68af('0x2f')]};});_0x718b39[_0x68af('0x30')]=_['map'](_0x21b677,_0x68af('0x2a'));_0x718b39[_0x68af('0x31')]=_['keys'](_0x3c3268[_0x68af('0x31')]);_0x718b39[_0x68af('0x32')]=_['intersection'](_0x718b39[_0x68af('0x30')],_0x718b39['query']);_0x5c0adb['attributes']=_[_0x68af('0x33')](_0x718b39[_0x68af('0x30')],qs[_0x68af('0x34')](_0x3c3268[_0x68af('0x31')][_0x68af('0x34')]));_0x5c0adb[_0x68af('0x35')]=_0x5c0adb['attributes']['length']?_0x5c0adb['attributes']:_0x718b39[_0x68af('0x30')];if(!_0x3c3268[_0x68af('0x31')]['hasOwnProperty'](_0x68af('0x36'))){_0x5c0adb[_0x68af('0x22')]=qs[_0x68af('0x22')](_0x3c3268['query'][_0x68af('0x22')]);_0x5c0adb[_0x68af('0x23')]=qs[_0x68af('0x23')](_0x3c3268[_0x68af('0x31')][_0x68af('0x23')]);}_0x5c0adb['order']=qs[_0x68af('0x37')](_0x3c3268[_0x68af('0x31')][_0x68af('0x37')]);_0x5c0adb[_0x68af('0x38')]=qs[_0x68af('0x32')](_[_0x68af('0x39')](_0x3c3268[_0x68af('0x31')],_0x718b39[_0x68af('0x32')]),_0x21b677);if(_0x3c3268[_0x68af('0x31')][_0x68af('0x3a')]){_0x5c0adb['where']=_[_0x68af('0x3b')](_0x5c0adb[_0x68af('0x38')],{'$or':_['map'](_0x21b677,function(_0x3ba003){if(_0x3ba003[_0x68af('0x2e')]!==_0x68af('0x3c')){var _0x47292c={};_0x47292c[_0x3ba003[_0x68af('0x2a')]]={'$like':'%'+_0x3c3268['query']['filter']+'%'};return _0x47292c;}})});}_0x5c0adb=_['merge']({},_0x5c0adb,_0x3c3268[_0x68af('0x3d')]);var _0x139900={'where':_0x5c0adb['where']};return db[_0x68af('0x2c')][_0x68af('0x3e')](_0x139900)[_0x68af('0x28')](function(_0x3bb630){_0x2d5aac['count']=_0x3bb630;if(_0x3c3268[_0x68af('0x31')][_0x68af('0x3f')]){_0x5c0adb[_0x68af('0x40')]=[{'all':!![]}];}return db[_0x68af('0x2c')][_0x68af('0x41')](_0x5c0adb);})[_0x68af('0x28')](function(_0x3b0953){_0x2d5aac[_0x68af('0x42')]=_0x3b0953;return _0x2d5aac;})[_0x68af('0x28')](respondWithFilteredResult(_0x135dc1,_0x5c0adb))[_0x68af('0x43')](handleError(_0x135dc1,null));};exports['show']=function(_0x52adab,_0x395cce){var _0x105243={'raw':![],'where':{'id':_0x52adab[_0x68af('0x44')]['id']}},_0x1a0b10={};_0x1a0b10[_0x68af('0x30')]=_['keys'](db[_0x68af('0x2c')][_0x68af('0x2d')]);_0x1a0b10[_0x68af('0x31')]=_['keys'](_0x52adab[_0x68af('0x31')]);_0x1a0b10[_0x68af('0x32')]=_[_0x68af('0x33')](_0x1a0b10[_0x68af('0x30')],_0x1a0b10[_0x68af('0x31')]);_0x105243[_0x68af('0x35')]=_[_0x68af('0x33')](_0x1a0b10['model'],qs[_0x68af('0x34')](_0x52adab[_0x68af('0x31')][_0x68af('0x34')]));_0x105243[_0x68af('0x35')]=_0x105243['attributes'][_0x68af('0x45')]?_0x105243[_0x68af('0x35')]:_0x1a0b10['model'];if(_0x52adab[_0x68af('0x31')]['includeAll']){_0x105243[_0x68af('0x40')]=[{'all':!![]}];}_0x105243=_['merge']({},_0x105243,_0x52adab[_0x68af('0x3d')]);return db[_0x68af('0x2c')][_0x68af('0x46')](_0x105243)[_0x68af('0x28')](handleEntityNotFound(_0x395cce,null))[_0x68af('0x28')](respondWithResult(_0x395cce,null))[_0x68af('0x43')](handleError(_0x395cce,null));};exports[_0x68af('0x47')]=function(_0x3b43a6,_0x3544d5){return db[_0x68af('0x2c')][_0x68af('0x47')](_0x3b43a6[_0x68af('0x48')],{})['then'](respondWithResult(_0x3544d5,0xc9))[_0x68af('0x43')](handleError(_0x3544d5,null));};exports[_0x68af('0x49')]=function(_0x4d44cd,_0x2bce28){var _0x472868={'where':{'id':_0x4d44cd['params']['id']}},_0x46a1f0={};_0x46a1f0[_0x68af('0x30')]=_[_0x68af('0x4a')](db[_0x68af('0x2c')][_0x68af('0x2d')]);_0x472868[_0x68af('0x35')]=_['intersection'](_0x46a1f0[_0x68af('0x30')],qs[_0x68af('0x34')](_0x4d44cd[_0x68af('0x31')][_0x68af('0x34')]));_0x472868[_0x68af('0x35')]=_0x472868[_0x68af('0x35')][_0x68af('0x45')]?_0x472868[_0x68af('0x35')]:_0x46a1f0[_0x68af('0x30')];if(_0x4d44cd[_0x68af('0x31')]['includeAll']){_0x472868[_0x68af('0x40')]=[{'all':!![]}];}_0x472868=_[_0x68af('0x3b')]({},_0x472868,_0x4d44cd[_0x68af('0x3d')]);return db[_0x68af('0x2c')][_0x68af('0x46')](_0x472868)[_0x68af('0x28')](handleEntityNotFound(_0x2bce28,null))['then'](function(_0x5ca2ae){if(_0x5ca2ae){var _0x433d50=_0x5ca2ae['get']({'plain':!![]});_0x433d50=qs['omit'](_0x433d50,['id',_0x68af('0x4b'),_0x68af('0x4c'),_0x68af('0x4d')]);_0x4d44cd[_0x68af('0x48')]=_[_0x68af('0x4e')](_0x4d44cd[_0x68af('0x48')],['id',_0x68af('0x4b'),'updatedAt']);return db[_0x68af('0x4f')][_0x68af('0x50')](function(_0x255e1c){return db[_0x68af('0x2c')][_0x68af('0x47')](_[_0x68af('0x3b')](_0x433d50,_0x4d44cd[_0x68af('0x48')]),{'include':_0x4d44cd[_0x68af('0x31')][_0x68af('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x255e1c})['then'](function(_0x367685){var _0x2706a4=_0x367685[_0x68af('0x51')]({'plain':!![]});return db[_0x68af('0x52')][_0x68af('0x41')]({'where':{'userProfileId':_0x4d44cd[_0x68af('0x44')]['id']},'raw':!![]})['then'](function(_0x1f2ba6){if(_0x1f2ba6){return BPromise['each'](_0x1f2ba6,function(_0x2fea5f){return new BPromise(function(_0x4ee21b,_0x5e6aca){if(_0x2fea5f['autoAssociation']===null||_0x2fea5f[_0x68af('0x53')]===0x1)_0x4ee21b(null);return db['UserProfileResource'][_0x68af('0x41')]({'where':{'sectionId':_0x2fea5f['id']},'raw':!![]})[_0x68af('0x28')](function(_0x39388f){var _0x137d3e=_[_0x68af('0x2b')](_0x39388f,function(_0x162961){return qs[_0x68af('0x4e')](_0x162961,['id','createdAt',_0x68af('0x4c'),'sectionId']);});_0x4ee21b(_0x137d3e);})[_0x68af('0x43')](function(_0x37170a){_0x5e6aca(_0x37170a);});})[_0x68af('0x28')](function(_0x588453){var _0x3d57ca=qs[_0x68af('0x4e')](_0x2fea5f,['id',_0x68af('0x4b'),_0x68af('0x4c')]);_0x3d57ca['userProfileId']=_0x2706a4['id'];if(_0x588453)_0x3d57ca[_0x68af('0x54')]=_0x588453;return _0x3d57ca;})['then'](function(_0x20d912){return db['UserProfileSection'][_0x68af('0x47')](_0x20d912,{'include':[{'model':db[_0x68af('0x55')],'as':_0x68af('0x54')}],'raw':!![],'transaction':_0x255e1c});});})['then'](function(){return _0x2706a4;});}});});});}})[_0x68af('0x28')](respondWithResult(_0x2bce28,0xc9))[_0x68af('0x43')](handleError(_0x2bce28,null));};exports[_0x68af('0x27')]=function(_0x36b9ae,_0x55c62a){if(_0x36b9ae[_0x68af('0x48')]['id']){delete _0x36b9ae['body']['id'];}return db[_0x68af('0x2c')]['find']({'where':{'id':_0x36b9ae['params']['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x55c62a,null))['then'](saveUpdates(_0x36b9ae[_0x68af('0x48')],null))['then'](respondWithResult(_0x55c62a,null))[_0x68af('0x43')](handleError(_0x55c62a,null));};exports[_0x68af('0x29')]=function(_0x4d3587,_0x21260a){return db[_0x68af('0x2c')]['find']({'where':{'id':_0x4d3587[_0x68af('0x44')]['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x21260a,null))[_0x68af('0x28')](removeEntity(_0x21260a,null))[_0x68af('0x43')](handleError(_0x21260a,null));};exports[_0x68af('0x56')]=function(_0x5bb1e8,_0x2f7a3a){return db[_0x68af('0x2c')][_0x68af('0x56')]()[_0x68af('0x28')](respondWithResult(_0x2f7a3a,null))[_0x68af('0x43')](handleError(_0x2f7a3a,null));};exports[_0x68af('0x57')]=function(_0x125d2a,_0x183349){var _0x2d814a=_0x125d2a['body'];return db[_0x68af('0x2c')]['find']({'where':{'id':_0x125d2a[_0x68af('0x44')]['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x183349,null))[_0x68af('0x28')](function(_0x4b23e6){if(_0x4b23e6){return db[_0x68af('0x4f')][_0x68af('0x50')](function(_0x4e1f0e){return db[_0x68af('0x52')][_0x68af('0x29')]({'where':{'userProfileId':_0x125d2a[_0x68af('0x44')]['id'],'sectionId':_[_0x68af('0x2b')](_0x2d814a,function(_0x5dbf33){return _0x5dbf33[_0x68af('0x58')];})},'transaction':_0x4e1f0e})[_0x68af('0x28')](function(){var _0x1acb3e=_[_0x68af('0x2b')](_0x2d814a,function(_0x51b055){_0x51b055['userProfileId']=_0x125d2a[_0x68af('0x44')]['id'];return _0x51b055;});var _0x44418f=[];return BPromise['each'](_0x1acb3e,function(_0x351d52){return db[_0x68af('0x52')][_0x68af('0x47')](_0x351d52,{'include':[{'model':db[_0x68af('0x55')],'as':_0x68af('0x54')}],'raw':!![],'transaction':_0x4e1f0e})['then'](function(_0x22cd4c){_0x44418f[_0x68af('0x59')](_0x22cd4c[_0x68af('0x51')]({'plain':!![]}));});})['then'](function(){return _0x44418f;});});});}})[_0x68af('0x28')](function(_0x290f64){return _0x290f64;})['then'](respondWithResult(_0x183349,null))['catch'](handleError(_0x183349,null));};exports[_0x68af('0x5a')]=function(_0x3e837d,_0x2e61f9){var _0x324205;return db['UserProfile'][_0x68af('0x46')]({'where':{'id':_0x3e837d['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x2e61f9,null))[_0x68af('0x28')](function(_0x56cadf){if(_0x56cadf){_0x324205=_0x56cadf;return db['UserProfileSection'][_0x68af('0x29')]({'where':{'userProfileId':_0x3e837d[_0x68af('0x44')]['id'],'sectionId':_0x3e837d[_0x68af('0x31')][_0x68af('0x5b')]}});}})[_0x68af('0x28')](function(){return _0x324205;})[_0x68af('0x28')](respondWithStatusCode(_0x2e61f9,null))[_0x68af('0x43')](handleError(_0x2e61f9,null));};exports['getSections']=function(_0x36d27e,_0x2643a1){var _0x2f6a9c=[];var _0x4cd9b3=[];return db[_0x68af('0x52')]['findAll']({'where':{'userProfileId':_0x36d27e[_0x68af('0x44')]['id']},'raw':!![]})[_0x68af('0x28')](function(_0x10521b){_0x2f6a9c=_[_0x68af('0x3a')](_0x10521b,function(_0x270392){return _0x270392[_0x68af('0x5c')]===0x1||_[_0x68af('0x5d')]([0x3eb,0x709],_0x270392[_0x68af('0x58')]);});if(!_[_0x68af('0x5e')](_0x2f6a9c)){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x3e8660){return _0x3e8660[_0x68af('0x58')];});}else{return;}})[_0x68af('0x28')](function(_0x576e9d){if(_0x576e9d)_0x4cd9b3=_0x576e9d;if(_[_0x68af('0x5d')](_0x4cd9b3,0x64)){var _0x3b1fec=_['find'](_0x2f6a9c,{'sectionId':0x64});return hasDefaultDashboard(_0x3b1fec)[_0x68af('0x28')](function(_0x20b73b){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x469711){if(_0x469711[_0x68af('0x58')]===0x64){_0x469711[_0x68af('0x5f')]=_0x20b73b;}return _0x469711;});});}else{return;}})['then'](function(_0x43dc7b){if(_0x43dc7b)_0x2f6a9c=_0x43dc7b;if(_[_0x68af('0x5d')](_0x4cd9b3,0x3eb)){var _0x387f2d=_['find'](_0x2f6a9c,{'sectionId':0x3eb});return getCustomDashboards(_0x387f2d)['then'](function(_0x1bebe1){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x126ece){if(_0x387f2d['enabled']){if(_0x126ece[_0x68af('0x58')]===0x3eb){_0x126ece[_0x68af('0x5f')]=_0x1bebe1;}}else{if(_0x126ece[_0x68af('0x58')]===0x64){_0x126ece[_0x68af('0x5f')]=_0x1bebe1;}}return _0x126ece;});});}else{return;}})['then'](function(_0x2eea52){if(_0x2eea52)_0x2f6a9c=_0x2eea52;if(_[_0x68af('0x5d')](_0x4cd9b3,0x709)){var _0x2bbd03=_[_0x68af('0x46')](_0x2f6a9c,{'sectionId':0x709});return getPlugins(_0x2bbd03)[_0x68af('0x28')](function(_0x4d2fca){if(_0x2bbd03[_0x68af('0x5c')]){return _[_0x68af('0x2b')](_0x2f6a9c,function(_0x3c6c97){if(_0x3c6c97['sectionId']===0x709){_0x3c6c97[_0x68af('0x5f')]=_0x4d2fca;}return _0x3c6c97;});}else{var _0x226d1f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4d2fca};var _0x216506=_[_0x68af('0x2b')](_0x2f6a9c);_0x216506[_0x68af('0x59')](_0x226d1f);return _0x216506;}});}else{return;}})[_0x68af('0x28')](function(_0x58901d){if(_0x58901d)_0x2f6a9c=_0x58901d;return _[_0x68af('0x3a')](_0x2f6a9c,[_0x68af('0x5c'),0x1]);})[_0x68af('0x28')](respondWithResult(_0x2643a1,null))['catch'](handleError(_0x2643a1,null));};function hasDefaultDashboard(_0x56404f){var _0x470804=[0x65];return new BPromise(function(_0x42b58d,_0x1ce09a){try{if(_0x56404f[_0x68af('0x53')]){_0x42b58d(_0x470804);}else{return db['UserProfileResource'][_0x68af('0x60')]({'where':{'sectionId':_0x56404f['id']},'raw':!![]})[_0x68af('0x28')](function(_0x4a2797){_0x4a2797?_0x42b58d(_0x470804):_0x42b58d();});}}catch(_0x584796){_0x1ce09a(_0x584796);}});}function getCustomDashboards(_0x3a348c){var _0x1f77c1=[];return new BPromise(function(_0x5dc173,_0x220fe8){try{if(_0x3a348c[_0x68af('0x53')]){return db[_0x68af('0x61')][_0x68af('0x41')]({'raw':!![]})['then'](function(_0x12a8c2){_0x12a8c2[_0x68af('0x62')](function(_0x53cad0){_0x1f77c1['push'](_0x53cad0['id']+0x1869f);});_0x5dc173(_0x1f77c1);});}else{return db[_0x68af('0x55')][_0x68af('0x41')]({'where':{'sectionId':_0x3a348c['id']},'raw':!![]})['then'](function(_0x3f97ad){_0x3f97ad['forEach'](function(_0x2dcaaa){_0x1f77c1['push'](_0x2dcaaa['resourceId']+0x1869f);});_0x5dc173(_0x1f77c1);});}}catch(_0x5babfa){_0x220fe8(_0x5babfa);}});}function getPlugins(_0x8c5d55){var _0x31b589=[];return new BPromise(function(_0x3c3313,_0x3749f2){try{if(_0x8c5d55[_0x68af('0x53')]){return db['Plugin'][_0x68af('0x41')]({'raw':!![]})[_0x68af('0x28')](function(_0x47948b){_0x47948b[_0x68af('0x62')](function(_0x160a65){_0x31b589['push'](_0x160a65['id']+0x15b38);});_0x3c3313(_0x31b589);});}else{return db[_0x68af('0x55')][_0x68af('0x41')]({'where':{'sectionId':_0x8c5d55['id']},'raw':!![]})[_0x68af('0x28')](function(_0xc9e13a){_0xc9e13a['forEach'](function(_0x31ebb5){_0x31b589[_0x68af('0x59')](_0x31ebb5[_0x68af('0x63')]+0x15b38);});_0x3c3313(_0x31b589);});}}catch(_0x4b0616){_0x3749f2(_0x4b0616);}});}exports[_0x68af('0x64')]=function(_0x3d8421,_0x258677){return db[_0x68af('0x2c')][_0x68af('0x46')]({'where':{'id':_0x3d8421[_0x68af('0x44')]['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x258677,null))['then'](function(_0xadc4e2){if(_0xadc4e2){return db['sequelize'][_0x68af('0x50')](function(_0x48f249){return db[_0x68af('0x52')][_0x68af('0x41')]({'where':{'userProfileId':_0x3d8421[_0x68af('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x68af('0x28')](function(_0x414566){if(_0x414566){return db[_0x68af('0x52')][_0x68af('0x29')]({'where':{'userProfileId':_0x3d8421[_0x68af('0x44')]['id'],'id':_[_0x68af('0x2b')](_0x414566,function(_0x1339c0){return _0x1339c0['id'];})},'transaction':_0x48f249});}})['then'](function(_0x3afa1e){var _0x5580a3=_[_0x68af('0x2b')](_0x3d8421[_0x68af('0x48')],function(_0x39451d){_0x39451d['userProfileId']=_0x3d8421[_0x68af('0x44')]['id'];return _0x39451d;});return db['UserProfileSection']['bulkCreate'](_0x5580a3,{'raw':!![],'transaction':_0x48f249});})[_0x68af('0x28')](function(_0x2357c8){var _0x1e7a6a=_['filter'](_[_0x68af('0x2b')](_0x2357c8,function(_0x544979){return _0x544979[_0x68af('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x1e7a6a){return db[_0x68af('0x52')][_0x68af('0x41')]({'where':{'userProfileId':_0x3d8421[_0x68af('0x44')]['id'],'sectionId':_[_0x68af('0x2b')](_0x1e7a6a,function(_0x1138bd){return _0x1138bd['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x68af('0x28')](function(_0x3dbea6){var _0x3a68d8=_[_0x68af('0x2b')](_0x3d8421[_0x68af('0x48')],function(_0x1a845f){_0x1a845f['userProfileId']=_0x3d8421['params']['id'];return _0x1a845f;});return db[_0x68af('0x55')][_0x68af('0x65')](_0x3a68d8,{'raw':!![],'transaction':_0x48f249});});}})[_0x68af('0x43')](handleError(_0x258677,null));});}})[_0x68af('0x28')](function(_0x4e18ec){var _0x4b1f2c=_[_0x68af('0x2b')](_0x4e18ec,function(_0xe7205d){return _0xe7205d[_0x68af('0x51')]({'plain':!![]});});})[_0x68af('0x28')](respondWithResult(_0x258677,null))[_0x68af('0x43')](handleError(_0x258677,null));};exports['removeResources']=function(_0x3a72a0,_0x1714a9,_0x148a17){return db['UserProfile'][_0x68af('0x46')]({'where':{'id':_0x3a72a0['params']['id']}})[_0x68af('0x28')](handleEntityNotFound(_0x1714a9,null))[_0x68af('0x28')](function(_0xaa0fd8){if(_0xaa0fd8){return _0xaa0fd8[_0x68af('0x66')](_0x3a72a0['query'][_0x68af('0x5b')]);}})[_0x68af('0x28')](respondWithStatusCode(_0x1714a9,null))[_0x68af('0x43')](handleError(_0x1714a9,null));};exports[_0x68af('0x67')]=function(_0xc2cfe7,_0x1f2fe8){var _0xd51acf={};if(!_0xc2cfe7['query'][_0x68af('0x68')])throw new Error(_0x68af('0x69'));if(!_0xc2cfe7['query'][_0x68af('0x6a')](_0x68af('0x36'))){_0xd51acf[_0x68af('0x22')]=qs['limit'](_0xc2cfe7[_0x68af('0x31')][_0x68af('0x22')]);_0xd51acf[_0x68af('0x23')]=qs[_0x68af('0x23')](_0xc2cfe7[_0x68af('0x31')][_0x68af('0x23')]);}return db['UserProfile']['find']({'where':{'id':_0xc2cfe7[_0x68af('0x44')]['id']}})[_0x68af('0x28')](function(_0x52d79e){if(!_0x52d79e)throw new Error(_0x68af('0x6b')+_0xc2cfe7[_0x68af('0x44')]['id']);return db['UserProfile'][_0x68af('0x67')](_0xc2cfe7);})['then'](respondWithFilteredResult(_0x1f2fe8,_0xd51acf))[_0x68af('0x43')](handleError(_0x1f2fe8,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9b0d17a..0a2bfbe 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 _0xaf5a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','UserProfile'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0xaf5a,0x116));var _0xaaf5=function(_0x5b964b,_0xe2062a){_0x5b964b=_0x5b964b-0x0;var _0x2f187d=_0xaf5a[_0x5b964b];return _0x2f187d;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xaaf5('0x0'))['db'][_0xaaf5('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xaaf5('0x2')](0x0);var events={'afterCreate':_0xaaf5('0x3'),'afterUpdate':_0xaaf5('0x4'),'afterDestroy':_0xaaf5('0x5')};function emitEvent(_0x5c55af){return function(_0x1bdf16,_0x4ae9ed,_0x23fbd9){UserProfileEvents[_0xaaf5('0x6')](_0x5c55af+':'+_0x1bdf16['id'],_0x1bdf16);UserProfileEvents[_0xaaf5('0x6')](_0x5c55af,_0x1bdf16);_0x23fbd9(null);};}for(var e in events){if(events[_0xaaf5('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xb7f0=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x3e8f3b,_0x33c90d){var _0x577742=function(_0x358477){while(--_0x358477){_0x3e8f3b['push'](_0x3e8f3b['shift']());}};_0x577742(++_0x33c90d);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x264ca3,_0x65b645){_0x264ca3=_0x264ca3-0x0;var _0x156d1e=_0xb7f0[_0x264ca3];return _0x156d1e;};'use strict';var EventEmitter=require(_0x0b7f('0x0'));var UserProfile=require(_0x0b7f('0x1'))['db'][_0x0b7f('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0b7f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0b7f('0x4')};function emitEvent(_0xa1285e){return function(_0x228377,_0x188ea8,_0x34e188){UserProfileEvents[_0x0b7f('0x5')](_0xa1285e+':'+_0x228377['id'],_0x228377);UserProfileEvents[_0x0b7f('0x5')](_0xa1285e,_0x228377);_0x34e188(null);};}for(var e in events){if(events[_0x0b7f('0x6')](e)){var event=events[e];UserProfile[_0x0b7f('0x7')](e,emitEvent(event));}}module[_0x0b7f('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 9efb6aa..7ba3a67 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 _0xf494=['SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','sequelize','query','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','pick','filters','key','foreignKey','merge','options','includeAll','forEach','reportType','default','reportId','DefaultReports','custom','CustomReports','count','include','Tag','Tags','color','tag','ThroughTags','rows','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','value','findAll','then','associatedResources','map','catch','model','name','UserProfileResource','field','AnalyticExtractedReport','resourceId','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','teams','Team','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','scheduler','sounds','Sound','tags','templates','triggers','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes'];(function(_0x46e900,_0x4a2c54){var _0x1de732=function(_0x3e7bb){while(--_0x3e7bb){_0x46e900['push'](_0x46e900['shift']());}};_0x1de732(++_0x4a2c54);}(_0xf494,0x1c6));var _0x4f49=function(_0x16715a,_0x41b9bb){_0x16715a=_0x16715a-0x0;var _0x511c46=_0xf494[_0x16715a];return _0x511c46;};'use strict';var _=require(_0x4f49('0x0'));var attributes=require(_0x4f49('0x1'));var qs=require(_0x4f49('0x2'));var squel=require('squel');module[_0x4f49('0x3')]=function(_0x1d54cc){var _0x423b25=_0x1d54cc[_0x4f49('0x4')];function _0x20c0d7(_0x2a15fb,_0x3267c1){return new Promise(function(_0x790e8b,_0xc5e778){if(!_0x3267c1)return _0x790e8b(null);var _0x413530=_0x3267c1[_0x4f49('0x5')]?{[_0x3267c1['filter']['field']]:_0x3267c1[_0x4f49('0x5')][_0x4f49('0x6')]}:undefined;return _0x423b25[_0x2a15fb][_0x4f49('0x7')]({'where':_0x413530,'raw':!![]})[_0x4f49('0x8')](function(_0x185174){_0x3267c1[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x185174,'id');_0x790e8b(_0x3267c1);})[_0x4f49('0xb')](function(_0x53ee74){_0xc5e778(_0x53ee74);});});}function _0x3e464f(_0x411759,_0x5bcfe5){return new Promise(function(_0x15e7a1,_0x5bbc75){var _0x496293=_0x411759[_0x4f49('0x5')]?{[_0x411759[_0x4f49('0x5')]['field']]:_0x411759[_0x4f49('0x5')][_0x4f49('0x6')]}:undefined;return _0x423b25[_0x411759[_0x4f49('0xc')]][_0x4f49('0x7')]({'where':_0x496293,'raw':!![]})[_0x4f49('0x8')](function(_0x2f0131){_0x5bcfe5[_0x4f49('0x9')]=_['map'](_0x2f0131,function(_0x515ace){return _0x515ace[_0x4f49('0xd')];});_0x15e7a1(_0x5bcfe5);})[_0x4f49('0xb')](function(_0x5878f4){_0x5bbc75(_0x5878f4);});});}function _0x5bdfaf(_0x2f0a0d,_0x2ecaaa,_0x74886e){if(!_0x2ecaaa)return Promise['resolve'](null);return new Promise(function(_0x1dccfd,_0x399be7){return _0x423b25[_0x4f49('0xe')]['findAll']({'where':{'sectionId':_0x2ecaaa['id']},'raw':!![]})['then'](function(_0x560592){if(_0x2f0a0d['field']&&_0x2f0a0d[_0x4f49('0xf')]!=='id'){_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0x407042){return _0x407042[_0x2f0a0d['field']];});}else{if(_0x74886e===_0x4f49('0x10')){_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0xaab5e7){return{'id':_0xaab5e7[_0x4f49('0x11')],'type':_0xaab5e7['type']};});}else{_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0x3ae590){return _0x3ae590['resourceId'];});}}_0x1dccfd(_0x2ecaaa);})[_0x4f49('0xb')](function(_0x1d70a7){_0x399be7(_0x1d70a7);});});}function _0x32ca7b(_0x43c458,_0x9d30aa){var _0x36187b={'parentSections':[]};switch(_0x43c458['toLowerCase']()){case'squareprojects':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x13');break;case'odbc':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x14');break;case _0x4f49('0x15'):_0x36187b['childModel']=_0x4f49('0x16');_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x18'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x19')}];break;case _0x4f49('0x1a'):_0x36187b['childModel']='JscriptyProject';break;case _0x4f49('0x1b'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x1c');_0x36187b['parentSections']=[{'name':_0x4f49('0x1d'),'field':'id','foreignKey':_0x4f49('0x1e')}];break;case _0x4f49('0x1f'):_0x36187b['childModel']='CmList';break;case _0x4f49('0x20'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x21');break;case'globalcustomfields':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x22');break;case _0x4f49('0x23'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x24');break;case _0x4f49('0x25'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x26');break;case _0x4f49('0x27'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x28');break;case _0x4f49('0x29'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2a');break;case _0x4f49('0x2b'):case _0x4f49('0x2c'):case _0x4f49('0x2d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2e');break;case'contexts':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2f');break;case _0x4f49('0x30'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x31');break;case _0x4f49('0x32'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x33');_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x34'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x35'),'model':_0x4f49('0x36'),'filter':{'field':'role','value':[_0x4f49('0x37')]}},{'name':_0x4f49('0x38'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x35'),'model':_0x4f49('0x36'),'filter':{'field':_0x4f49('0x39'),'value':[_0x4f49('0x3a')]}},{'name':_0x4f49('0x3b'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x3c'),'model':_0x4f49('0x3d'),'filter':{'field':_0x4f49('0x3e'),'value':[_0x4f49('0x3f')]}},{'name':_0x4f49('0x40'),'field':'name','foreignKey':_0x4f49('0x3c'),'model':_0x4f49('0x3d'),'filter':{'field':'type','value':[_0x4f49('0x41')]}}];break;case _0x4f49('0x42'):_0x36187b['childModel']=_0x4f49('0x43');break;case _0x4f49('0x44'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x45');break;case _0x4f49('0x46'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x47');break;case'ivrcampaigns':_0x36187b['childModel']='Campaign';break;case _0x4f49('0x48'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x49');break;case _0x4f49('0x4a'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x4b');break;case _0x4f49('0x4c'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x4d');break;case'openchannelqueues':_0x36187b['childModel']=_0x4f49('0x4e');break;case _0x4f49('0x4f'):_0x36187b[_0x4f49('0x12')]='OpenchannelAccount';break;case _0x4f49('0x50'):_0x36187b['childModel']='SmsQueue';break;case _0x4f49('0x51'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x52');break;case'whatsappqueues':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x53');break;case'whatsappaccounts':_0x36187b[_0x4f49('0x12')]='WhatsappAccount';break;case _0x4f49('0x54'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x55');break;case'voicequeues':case _0x4f49('0x56'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x3d');if(_0x9d30aa){_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x3b')},{'name':_0x4f49('0x40')}];}break;case _0x4f49('0x57'):case _0x4f49('0x58'):case _0x4f49('0x59'):_0x36187b[_0x4f49('0x12')]='User';if(_0x9d30aa){_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x5a'),'filter':{'field':'role','value':[_0x4f49('0x5b'),'user']},'ignore':!![]},{'name':_0x4f49('0x34')},{'name':_0x4f49('0x38')}];}break;case _0x4f49('0x5c'):_0x36187b[_0x4f49('0x12')]='ZendeskAccount';break;case _0x4f49('0x5d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x5e');break;case _0x4f49('0x5f'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x60');break;case _0x4f49('0x61'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x62');break;case _0x4f49('0x63'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x64');break;case _0x4f49('0x65'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x66');break;case _0x4f49('0x67'):_0x36187b['childModel']='User';break;case _0x4f49('0x68'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x69');break;case _0x4f49('0x6a'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x6b');break;case _0x4f49('0x6c'):_0x36187b['childModel']=_0x4f49('0x6d');break;case'intervals':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x6e');break;case _0x4f49('0x6f'):_0x36187b[_0x4f49('0x12')]='Pause';break;case _0x4f49('0x70'):_0x36187b['childModel']='Schedule';break;case _0x4f49('0x71'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x72');break;case _0x4f49('0x73'):_0x36187b['childModel']='Tag';break;case _0x4f49('0x74'):_0x36187b[_0x4f49('0x12')]='Template';break;case _0x4f49('0x75'):_0x36187b['childModel']='Trigger';break;case _0x4f49('0x76'):_0x36187b['childModel']=_0x4f49('0x77');break;case'variables':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x78');break;case _0x4f49('0x79'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x7a');break;case _0x4f49('0x7b'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x10');_0x36187b['parentSections']=[{'name':_0x4f49('0x7c'),'field':'id','foreignKey':'reportId'}];break;case _0x4f49('0x7d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x7e');break;}return _0x36187b;}function _0x467f12(_0x1981e0,_0xb7538c){var _0x553981=_0x1981e0[_0x4f49('0x7f')](0x0)[_0x4f49('0x80')]()+_0x1981e0['slice'](0x1);var _0x5d2b3c={'type':_0x423b25[_0x4f49('0x81')][_0x4f49('0x82')][_0x4f49('0x83')],'raw':!![]};return new Promise(function(_0x2409f1,_0x19a788){var _0x4af08d=squel[_0x4f49('0x84')]()['field'](_0x4f49('0x85')+_0x553981+_0x4f49('0x86'),'id')[_0x4f49('0xf')]('ui.createdAt')[_0x4f49('0x87')](_0x4f49('0x88')+_0x1981e0+_0x4f49('0x89'),'ui')[_0x4f49('0x8a')]('ui.UserId\x20=\x20?',_0xb7538c['id']);return _0x423b25[_0x4f49('0x8b')][_0x4f49('0x8c')](_0x4af08d['toString'](),_0x5d2b3c)[_0x4f49('0x8')](function(_0x17b15){_0xb7538c[_0x553981+_0x4f49('0x8d')]=_0x17b15;_0x2409f1(_0x17b15);})[_0x4f49('0xb')](function(_0x28ea73){_0x19a788(_0x28ea73);});});}return _0x1d54cc[_0x4f49('0x8e')](_0x4f49('0x8f'),attributes,{'tableName':_0x4f49('0x90'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x519721){var _0x468821={'raw':![],'where':{}};var _0x3566f2={};var _0x1e91a5={'count':0x0,'rows':[]};var _0x192b5a=_0x519721[_0x4f49('0x8c')][_0x4f49('0x91')];var _0x335875=_0x519721['query'][_0x4f49('0x92')]||![];var _0x50d1ad=_0x32ca7b(_0x192b5a,_0x335875);if(!_0x50d1ad[_0x4f49('0x12')])throw new Error(_0x4f49('0x93')+_0x192b5a+'\x27');var _0x4714c7=[{'name':_0x192b5a}];if(!_[_0x4f49('0x94')](_0x50d1ad[_0x4f49('0x17')]))_0x4714c7=_0x50d1ad[_0x4f49('0x17')];var _0x61a565=[];for(var _0x297698=0x0;_0x297698<_0x4714c7[_0x4f49('0x95')];_0x297698++){_0x61a565[_0x4f49('0x96')](_0x423b25['UserProfileSection'][_0x4f49('0x97')]({'where':{'userProfileId':_0x519721[_0x4f49('0x98')]['id'],'name':_0x4714c7[_0x297698][_0x4f49('0xd')]},'raw':!![]}));}return Promise[_0x4f49('0x99')](_0x61a565)['then'](function(_0x54c67b){var _0x28e8ae=_['filter'](_0x54c67b,function(_0x30defd){return _0x30defd?_0x30defd:undefined;});var _0x287705=_[_0x4f49('0x5')](_0x4714c7,[_0x4f49('0x9a'),!![]]);var _0x224c8d=_[_0x4f49('0x94')](_0x28e8ae)&&_[_0x4f49('0x94')](_0x287705)?null:_[_0x4f49('0x9b')](_0x287705,_0x28e8ae);if(!_0x224c8d)return null;var _0x3823f0=[];for(var _0x3e9b47=0x0;_0x3e9b47<_0x224c8d[_0x4f49('0x95')];_0x3e9b47++){var _0x1ba97e=_[_0x4f49('0x97')](_0x4714c7,function(_0xd53de8){return _0x224c8d[_0x3e9b47]?_0xd53de8[_0x4f49('0xd')]===_0x224c8d[_0x3e9b47][_0x4f49('0xd')]:null;});if(_0x1ba97e){if(_0x224c8d[_0x3e9b47][_0x4f49('0x9a')]){_0x3823f0[_0x4f49('0x96')](_0x20c0d7(_0x50d1ad[_0x4f49('0x12')],_0x224c8d[_0x3e9b47]));}else{if(!_0x224c8d[_0x3e9b47][_0x4f49('0x9c')]){_0x3823f0[_0x4f49('0x96')](_0x5bdfaf(_0x1ba97e,_0x224c8d[_0x3e9b47],_0x50d1ad[_0x4f49('0x12')]));}else{if(_0x1ba97e[_0x4f49('0xc')]){_0x3823f0[_0x4f49('0x96')](_0x3e464f(_0x1ba97e,_0x224c8d[_0x3e9b47]));}}}}}return Promise[_0x4f49('0x99')](_0x3823f0);})['then'](function(_0x3e9460){var _0x4ff0c1=_0x3e9460;var _0x31df7f=null;if(_0x4ff0c1){_0x31df7f=_0x4ff0c1[_0x4f49('0x95')]===0x1?_0x4ff0c1[0x0]:null;}if(!_0x31df7f&&!_0x4ff0c1)return _0x1e91a5;var _0x38fe50=_0x423b25[_0x50d1ad[_0x4f49('0x12')]][_0x4f49('0x9d')];_0x3566f2[_0x4f49('0xc')]=_[_0x4f49('0x9e')](_0x38fe50);_0x3566f2[_0x4f49('0x8c')]=_[_0x4f49('0x9e')](_0x519721['query']);_0x3566f2['filters']=_[_0x4f49('0x9f')](_0x3566f2['model'],_0x3566f2[_0x4f49('0x8c')]);_0x468821[_0x4f49('0xa0')]=_[_0x4f49('0x9f')](_0x3566f2[_0x4f49('0xc')],qs[_0x4f49('0xa1')](_0x519721['query']['fields']));_0x468821[_0x4f49('0xa0')]=_0x468821[_0x4f49('0xa0')]['length']?_0x468821[_0x4f49('0xa0')]:_0x3566f2[_0x4f49('0xc')];if(!_0x519721['query'][_0x4f49('0xa2')]('nolimit')){_0x468821[_0x4f49('0xa3')]=qs[_0x4f49('0xa3')](_0x519721['query'][_0x4f49('0xa3')]);_0x468821[_0x4f49('0xa4')]=qs[_0x4f49('0xa4')](_0x519721[_0x4f49('0x8c')][_0x4f49('0xa4')]);}_0x468821[_0x4f49('0xa5')]=qs['sort'](_0x519721[_0x4f49('0x8c')]['sort']);_0x468821[_0x4f49('0x8a')]=qs['filters'](_[_0x4f49('0xa6')](_0x519721['query'],_0x3566f2[_0x4f49('0xa7')]));if(_0x519721[_0x4f49('0x8c')][_0x4f49('0x5')]){_0x468821[_0x4f49('0x8a')]=_['merge'](_0x468821[_0x4f49('0x8a')],{'$or':_['map'](_0x38fe50,function(_0x5ddfe4){if(_0x5ddfe4['type'][_0x4f49('0xa8')]!=='VIRTUAL'){var _0x4938a6={};_0x4938a6[_0x5ddfe4[_0x4f49('0xf')]]={'$like':'%'+_0x519721[_0x4f49('0x8c')][_0x4f49('0x5')]+'%'};return _0x4938a6;}})});}var _0x4c0e7a=[];var _0x289810=null;var _0x431c15={};if(_0x31df7f){_0x289810=_['find'](_0x4714c7,['name',_0x31df7f['name']]);if(_0x289810[_0x4f49('0xf')]){_0x431c15={};if(_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x10')){_0x431c15[_0x289810[_0x4f49('0xa9')]]=_[_0x4f49('0xa')](_0x31df7f['associatedResources'],'id');}else{_0x431c15[_0x289810[_0x4f49('0xa9')]]=_0x31df7f[_0x4f49('0x9')];}_0x4c0e7a[_0x4f49('0x96')](_0x431c15);}else{_0x468821['where']['id']=_0x31df7f[_0x4f49('0x9')];}}else{for(var _0x34843a=0x0;_0x34843a<_0x4ff0c1[_0x4f49('0x95')];_0x34843a++){_0x289810=_[_0x4f49('0x97')](_0x4714c7,['name',_0x4ff0c1[_0x34843a][_0x4f49('0xd')]]);if(_0x289810[_0x4f49('0xf')]){_0x431c15={};_0x431c15[_0x289810[_0x4f49('0xa9')]]=_0x4ff0c1[_0x34843a][_0x4f49('0x9')];_0x4c0e7a[_0x4f49('0x96')](_0x431c15);}else{if(!_0x468821['where']['id'])_0x468821[_0x4f49('0x8a')]['id']=[];_0x4ff0c1[_0x34843a][_0x4f49('0x9')]['forEach'](function(_0x3eebc0){_0x468821['where']['id'][_0x4f49('0x96')](_0x3eebc0);});}}}if(!_['isEmpty'](_0x4c0e7a)){_0x468821[_0x4f49('0x8a')]=_[_0x4f49('0xaa')](_0x468821[_0x4f49('0x8a')],{'$and':{'$or':_0x4c0e7a}});}_0x468821=_[_0x4f49('0xaa')]({},_0x468821,_0x519721[_0x4f49('0xab')]);if(_0x31df7f&&!_0x31df7f['autoAssociation']&&_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x10')){if(_0x519721[_0x4f49('0x8c')][_0x4f49('0xac')]){_0x468821['include']=[{'all':!![]}];}return _0x423b25[_0x50d1ad[_0x4f49('0x12')]]['findAll'](_0x468821)[_0x4f49('0x8')](function(_0x59a5e9){var _0x3066ee=[];_0x59a5e9[_0x4f49('0xad')](function(_0x288f75){var _0x34fca3;switch(_0x288f75[_0x4f49('0xae')]){case _0x4f49('0xaf'):_0x34fca3=_[_0x4f49('0x97')](_0x31df7f[_0x4f49('0x9')],function(_0x3a26ff){return _0x3a26ff['id']===_0x288f75[_0x4f49('0xb0')]&&_0x3a26ff['type']===_0x4f49('0xb1');});break;case _0x4f49('0xb2'):_0x34fca3=_[_0x4f49('0x97')](_0x31df7f[_0x4f49('0x9')],function(_0x302861){return _0x302861['id']===_0x288f75[_0x4f49('0xb0')]&&_0x302861['type']===_0x4f49('0xb3');});break;}if(_0x34fca3)_0x3066ee[_0x4f49('0x96')](_0x288f75);});_0x1e91a5[_0x4f49('0xb4')]=_0x3066ee[_0x4f49('0x95')];_0x1e91a5['rows']=_0x3066ee;return _0x1e91a5;});}else{return _0x423b25[_0x50d1ad[_0x4f49('0x12')]]['count']({'where':_0x468821[_0x4f49('0x8a')]})[_0x4f49('0x8')](function(_0x5c5d2){_0x1e91a5[_0x4f49('0xb4')]=_0x5c5d2;if(_0x519721['query'][_0x4f49('0xac')]){if(_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x1c')){_0x468821[_0x4f49('0xb5')]=[{'model':_0x423b25[_0x4f49('0xb6')],'as':_0x4f49('0xb7'),'attributes':['id',_0x4f49('0xd'),_0x4f49('0xb8')],'required':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]?!![]:![]},{'model':_0x423b25[_0x4f49('0xb6')],'as':_0x4f49('0xba'),'attributes':['id',_0x4f49('0xd'),_0x4f49('0xb8')],'through':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]?{'attributes':[],'where':{'TagId':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]||undefined}}:{},'required':_0x519721['query'][_0x4f49('0xb9')]?!![]:![]}];}else{_0x468821[_0x4f49('0xb5')]=[{'all':!![]}];}}return _0x423b25[_0x50d1ad[_0x4f49('0x12')]][_0x4f49('0x7')](_0x468821);})['then'](function(_0x225e63){_0x1e91a5[_0x4f49('0xbb')]=_0x225e63;if(_0x192b5a==='Agents'&&_0x519721[_0x4f49('0x8c')]['openTabs']===_0x4f49('0xbc')){var _0x3bc245=[];for(var _0x1b6e82=0x0;_0x1b6e82<_0x1e91a5[_0x4f49('0xbb')][_0x4f49('0x95')];_0x1b6e82++){_0x3bc245[_0x4f49('0x96')](_0x467f12(_0x4f49('0xbd'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245[_0x4f49('0x96')](_0x467f12('sms',_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245['push'](_0x467f12(_0x4f49('0xbf'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82]['dataValues']));_0x3bc245['push'](_0x467f12(_0x4f49('0xc0'),_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245[_0x4f49('0x96')](_0x467f12(_0x4f49('0xc1'),_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245['push'](_0x467f12(_0x4f49('0xc2'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82][_0x4f49('0xbe')]));}return Promise['all'](_0x3bc245)[_0x4f49('0x8')](function(){return _0x1e91a5;});}return _0x1e91a5;});}});}}});}; \ No newline at end of file +var _0xed1c=['UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','ignore','union','autoAssociation','all','keys','filters','intersection','attributes','nolimit','limit','offset','where','pick','key','VIRTUAL','foreignKey','merge','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','rows','count','CmContact','Tags','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','models','filter','field','value','findAll','then','associatedResources','catch','model','map','name','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','projects','JscriptyProject','Lists','ListId','lists','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','admin','user','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','triggers','Trigger','Variable','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','ui.UserId\x20=\x20?','query','OpenTabs','define'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xed1c,0xe4));var _0xced1=function(_0x44241f,_0x404b5a){_0x44241f=_0x44241f-0x0;var _0xd60e65=_0xed1c[_0x44241f];return _0xd60e65;};'use strict';var _=require(_0xced1('0x0'));var attributes=require(_0xced1('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module['exports']=function(_0x4c3102){var _0x424db6=_0x4c3102[_0xced1('0x2')];function _0x79202e(_0x47a45c,_0x1e23a9){return new Promise(function(_0x445160,_0x466657){if(!_0x1e23a9)return _0x445160(null);var _0x37b22b=_0x1e23a9['filter']?{[_0x1e23a9[_0xced1('0x3')][_0xced1('0x4')]]:_0x1e23a9[_0xced1('0x3')][_0xced1('0x5')]}:undefined;return _0x424db6[_0x47a45c][_0xced1('0x6')]({'where':_0x37b22b,'raw':!![]})[_0xced1('0x7')](function(_0x325dd2){_0x1e23a9[_0xced1('0x8')]=_['map'](_0x325dd2,'id');_0x445160(_0x1e23a9);})[_0xced1('0x9')](function(_0x59c820){_0x466657(_0x59c820);});});}function _0x3464f3(_0x15e99f,_0x1edaaa){return new Promise(function(_0x18c028,_0x15f678){var _0x44b05c=_0x15e99f[_0xced1('0x3')]?{[_0x15e99f['filter'][_0xced1('0x4')]]:_0x15e99f[_0xced1('0x3')][_0xced1('0x5')]}:undefined;return _0x424db6[_0x15e99f[_0xced1('0xa')]]['findAll']({'where':_0x44b05c,'raw':!![]})[_0xced1('0x7')](function(_0x31a32c){_0x1edaaa['associatedResources']=_[_0xced1('0xb')](_0x31a32c,function(_0x26f81){return _0x26f81[_0xced1('0xc')];});_0x18c028(_0x1edaaa);})[_0xced1('0x9')](function(_0x47baec){_0x15f678(_0x47baec);});});}function _0x5560af(_0x3eb3ac,_0x4178d8,_0x236473){if(!_0x4178d8)return Promise[_0xced1('0xd')](null);return new Promise(function(_0x3e53bd,_0x292997){return _0x424db6['UserProfileResource']['findAll']({'where':{'sectionId':_0x4178d8['id']},'raw':!![]})[_0xced1('0x7')](function(_0x111fb0){if(_0x3eb3ac[_0xced1('0x4')]&&_0x3eb3ac['field']!=='id'){_0x4178d8[_0xced1('0x8')]=_[_0xced1('0xb')](_0x111fb0,function(_0x3e51e4){return _0x3e51e4[_0x3eb3ac['field']];});}else{if(_0x236473===_0xced1('0xe')){_0x4178d8[_0xced1('0x8')]=_[_0xced1('0xb')](_0x111fb0,function(_0x4819fd){return{'id':_0x4819fd[_0xced1('0xf')],'type':_0x4819fd[_0xced1('0x10')]};});}else{_0x4178d8[_0xced1('0x8')]=_['map'](_0x111fb0,function(_0x4dab56){return _0x4dab56[_0xced1('0xf')];});}}_0x3e53bd(_0x4178d8);})[_0xced1('0x9')](function(_0x2a6248){_0x292997(_0x2a6248);});});}function _0x20dcb4(_0x210d7e,_0x49c8b9){var _0x14f47e={'parentSections':[]};switch(_0x210d7e[_0xced1('0x11')]()){case'squareprojects':_0x14f47e['childModel']=_0xced1('0x12');break;case _0xced1('0x13'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x15');break;case _0xced1('0x16'):_0x14f47e[_0xced1('0x14')]='SquareRecording';_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x18'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x19')}];break;case _0xced1('0x1a'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x1b');break;case'contacts':_0x14f47e[_0xced1('0x14')]='CmContact';_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x1c'),'field':'id','foreignKey':_0xced1('0x1d')}];break;case _0xced1('0x1e'):_0x14f47e['childModel']='CmList';break;case _0xced1('0x1f'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x20');break;case'globalcustomfields':_0x14f47e['childModel']='CmCustomField';break;case _0xced1('0x21'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x22');break;case _0xced1('0x23'):_0x14f47e['childModel']=_0xced1('0x24');break;case _0xced1('0x25'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x26');break;case _0xced1('0x27'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x28');break;case'inboundroutes':case'internalroutes':case _0xced1('0x29'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x2a');break;case _0xced1('0x2b'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x2c');break;case'voicemails':_0x14f47e['childModel']='VoiceMail';break;case'voicerecordings':_0x14f47e[_0xced1('0x14')]=_0xced1('0x2d');_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x2e'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x2f'),'model':_0xced1('0x30'),'filter':{'field':_0xced1('0x31'),'value':[_0xced1('0x32')]}},{'name':_0xced1('0x33'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x2f'),'model':_0xced1('0x30'),'filter':{'field':'role','value':[_0xced1('0x34')]}},{'name':_0xced1('0x35'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x36'),'model':_0xced1('0x37'),'filter':{'field':_0xced1('0x10'),'value':['inbound']}},{'name':_0xced1('0x38'),'field':_0xced1('0xc'),'foreignKey':_0xced1('0x36'),'model':_0xced1('0x37'),'filter':{'field':_0xced1('0x10'),'value':[_0xced1('0x39')]}}];break;case _0xced1('0x3a'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x3b');break;case _0xced1('0x3c'):_0x14f47e[_0xced1('0x14')]='VoiceChanSpy';break;case'voiceprefixes':_0x14f47e[_0xced1('0x14')]=_0xced1('0x3d');break;case _0xced1('0x3e'):_0x14f47e['childModel']=_0xced1('0x3f');break;case _0xced1('0x40'):_0x14f47e[_0xced1('0x14')]='MailQueue';break;case _0xced1('0x41'):_0x14f47e[_0xced1('0x14')]='MailAccount';break;case _0xced1('0x42'):_0x14f47e['childModel']=_0xced1('0x43');break;case _0xced1('0x44'):_0x14f47e['childModel']=_0xced1('0x45');break;case _0xced1('0x46'):_0x14f47e[_0xced1('0x14')]='OpenchannelAccount';break;case _0xced1('0x47'):_0x14f47e[_0xced1('0x14')]='SmsQueue';break;case _0xced1('0x48'):_0x14f47e['childModel']='SmsAccount';break;case _0xced1('0x49'):_0x14f47e['childModel']=_0xced1('0x4a');break;case _0xced1('0x4b'):_0x14f47e[_0xced1('0x14')]='WhatsappAccount';break;case _0xced1('0x4c'):_0x14f47e['childModel']=_0xced1('0x4d');break;case _0xced1('0x4e'):case _0xced1('0x4f'):_0x14f47e[_0xced1('0x14')]='VoiceQueue';if(_0x49c8b9){_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x35')},{'name':'QueueCampaigns'}];}break;case _0xced1('0x50'):case _0xced1('0x51'):case'telephones':_0x14f47e[_0xced1('0x14')]=_0xced1('0x30');if(_0x49c8b9){_0x14f47e[_0xced1('0x17')]=[{'name':'Users','filter':{'field':_0xced1('0x31'),'value':[_0xced1('0x52'),_0xced1('0x53')]},'ignore':!![]},{'name':_0xced1('0x2e')},{'name':_0xced1('0x33')}];}break;case'zendeskaccounts':_0x14f47e[_0xced1('0x14')]='ZendeskAccount';break;case _0xced1('0x54'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x55');break;case _0xced1('0x56'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x57');break;case'sugarcrmaccounts':_0x14f47e[_0xced1('0x14')]=_0xced1('0x58');break;case'deskaccounts':_0x14f47e[_0xced1('0x14')]='DeskAccount';break;case'zohoaccounts':_0x14f47e[_0xced1('0x14')]=_0xced1('0x59');break;case _0xced1('0x5a'):_0x14f47e[_0xced1('0x14')]='User';break;case _0xced1('0x5b'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x5c');break;case'dispositions':_0x14f47e['childModel']=_0xced1('0x5d');break;case _0xced1('0x5e'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x5f');break;case'intervals':_0x14f47e['childModel']='Interval';break;case _0xced1('0x60'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x61');break;case _0xced1('0x62'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x63');break;case _0xced1('0x64'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x65');break;case'tags':_0x14f47e[_0xced1('0x14')]=_0xced1('0x66');break;case _0xced1('0x67'):_0x14f47e['childModel']=_0xced1('0x68');break;case _0xced1('0x69'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x6a');break;case'trunks':_0x14f47e[_0xced1('0x14')]='Trunk';break;case'variables':_0x14f47e[_0xced1('0x14')]=_0xced1('0x6b');break;case'plugins':_0x14f47e['childModel']='Plugin';break;case _0xced1('0x6c'):_0x14f47e['childModel']=_0xced1('0xe');_0x14f47e[_0xced1('0x17')]=[{'name':_0xced1('0x6d'),'field':'id','foreignKey':_0xced1('0x6e')}];break;case _0xced1('0x6f'):_0x14f47e[_0xced1('0x14')]=_0xced1('0x70');break;}return _0x14f47e;}function _0x849056(_0x4d5a58,_0x4f17fb){var _0x4832d2=_0x4d5a58[_0xced1('0x71')](0x0)[_0xced1('0x72')]()+_0x4d5a58[_0xced1('0x73')](0x1);var _0x5b40ea={'type':_0x424db6[_0xced1('0x74')][_0xced1('0x75')][_0xced1('0x76')],'raw':!![]};return new Promise(function(_0x4365da,_0x5950d2){var _0x458f36=squel[_0xced1('0x77')]()[_0xced1('0x4')](_0xced1('0x78')+_0x4832d2+_0xced1('0x79'),'id')[_0xced1('0x4')](_0xced1('0x7a'))[_0xced1('0x7b')]('user_has_'+_0x4d5a58+'_interactions','ui')['where'](_0xced1('0x7c'),_0x4f17fb['id']);return _0x424db6['sequelize'][_0xced1('0x7d')](_0x458f36['toString'](),_0x5b40ea)['then'](function(_0x37bec5){_0x4f17fb[_0x4832d2+_0xced1('0x7e')]=_0x37bec5;_0x4365da(_0x37bec5);})[_0xced1('0x9')](function(_0x2bdcea){_0x5950d2(_0x2bdcea);});});}return _0x4c3102[_0xced1('0x7f')](_0xced1('0x80'),attributes,{'tableName':_0xced1('0x81'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x164ca1){var _0x395b52={'raw':![],'where':{}};var _0x2f22aa={};var _0x1d850b={'count':0x0,'rows':[]};var _0x57b644=_0x164ca1[_0xced1('0x7d')][_0xced1('0x82')];var _0x4956a4=_0x164ca1[_0xced1('0x7d')][_0xced1('0x83')]||![];var _0x55c21d=_0x20dcb4(_0x57b644,_0x4956a4);if(!_0x55c21d[_0xced1('0x14')])throw new Error(_0xced1('0x84')+_0x57b644+'\x27');var _0x2dd0d6=[{'name':_0x57b644}];if(!_[_0xced1('0x85')](_0x55c21d[_0xced1('0x17')]))_0x2dd0d6=_0x55c21d['parentSections'];var _0x59806a=[];for(var _0x487094=0x0;_0x487094<_0x2dd0d6[_0xced1('0x86')];_0x487094++){_0x59806a[_0xced1('0x87')](_0x424db6['UserProfileSection'][_0xced1('0x88')]({'where':{'userProfileId':_0x164ca1[_0xced1('0x89')]['id'],'name':_0x2dd0d6[_0x487094][_0xced1('0xc')]},'raw':!![]}));}return Promise['all'](_0x59806a)[_0xced1('0x7')](function(_0x384efc){var _0x4ed12c=_[_0xced1('0x3')](_0x384efc,function(_0x47e33d){return _0x47e33d?_0x47e33d:undefined;});var _0x1e77e8=_[_0xced1('0x3')](_0x2dd0d6,[_0xced1('0x8a'),!![]]);var _0x2b54e2=_[_0xced1('0x85')](_0x4ed12c)&&_[_0xced1('0x85')](_0x1e77e8)?null:_[_0xced1('0x8b')](_0x1e77e8,_0x4ed12c);if(!_0x2b54e2)return null;var _0x49e802=[];for(var _0x395fe0=0x0;_0x395fe0<_0x2b54e2[_0xced1('0x86')];_0x395fe0++){var _0x154808=_['find'](_0x2dd0d6,function(_0x5c2567){return _0x2b54e2[_0x395fe0]?_0x5c2567[_0xced1('0xc')]===_0x2b54e2[_0x395fe0][_0xced1('0xc')]:null;});if(_0x154808){if(_0x2b54e2[_0x395fe0]['ignore']){_0x49e802[_0xced1('0x87')](_0x79202e(_0x55c21d[_0xced1('0x14')],_0x2b54e2[_0x395fe0]));}else{if(!_0x2b54e2[_0x395fe0][_0xced1('0x8c')]){_0x49e802['push'](_0x5560af(_0x154808,_0x2b54e2[_0x395fe0],_0x55c21d['childModel']));}else{if(_0x154808[_0xced1('0xa')]){_0x49e802[_0xced1('0x87')](_0x3464f3(_0x154808,_0x2b54e2[_0x395fe0]));}}}}}return Promise[_0xced1('0x8d')](_0x49e802);})[_0xced1('0x7')](function(_0x95c83b){var _0x224b8f=_0x95c83b;var _0x5b6acb=null;if(_0x224b8f){_0x5b6acb=_0x224b8f[_0xced1('0x86')]===0x1?_0x224b8f[0x0]:null;}if(!_0x5b6acb&&!_0x224b8f)return _0x1d850b;var _0x4fa327=_0x424db6[_0x55c21d['childModel']]['rawAttributes'];_0x2f22aa['model']=_[_0xced1('0x8e')](_0x4fa327);_0x2f22aa[_0xced1('0x7d')]=_['keys'](_0x164ca1['query']);_0x2f22aa[_0xced1('0x8f')]=_[_0xced1('0x90')](_0x2f22aa['model'],_0x2f22aa['query']);_0x395b52[_0xced1('0x91')]=_[_0xced1('0x90')](_0x2f22aa['model'],qs['fields'](_0x164ca1['query']['fields']));_0x395b52[_0xced1('0x91')]=_0x395b52[_0xced1('0x91')][_0xced1('0x86')]?_0x395b52[_0xced1('0x91')]:_0x2f22aa[_0xced1('0xa')];if(!_0x164ca1[_0xced1('0x7d')]['hasOwnProperty'](_0xced1('0x92'))){_0x395b52[_0xced1('0x93')]=qs[_0xced1('0x93')](_0x164ca1[_0xced1('0x7d')][_0xced1('0x93')]);_0x395b52[_0xced1('0x94')]=qs[_0xced1('0x94')](_0x164ca1[_0xced1('0x7d')][_0xced1('0x94')]);}_0x395b52['order']=qs['sort'](_0x164ca1[_0xced1('0x7d')]['sort']);_0x395b52[_0xced1('0x95')]=qs['filters'](_[_0xced1('0x96')](_0x164ca1[_0xced1('0x7d')],_0x2f22aa[_0xced1('0x8f')]));if(_0x164ca1[_0xced1('0x7d')][_0xced1('0x3')]){_0x395b52[_0xced1('0x95')]=_['merge'](_0x395b52[_0xced1('0x95')],{'$or':_[_0xced1('0xb')](_0x4fa327,function(_0x4104ad){if(_0x4104ad[_0xced1('0x10')][_0xced1('0x97')]!==_0xced1('0x98')){var _0x4fc259={};_0x4fc259[_0x4104ad['field']]={'$like':'%'+_0x164ca1[_0xced1('0x7d')][_0xced1('0x3')]+'%'};return _0x4fc259;}})});}var _0x40eed6=[];var _0x173e9a=null;var _0x37fa95={};if(_0x5b6acb){_0x173e9a=_['find'](_0x2dd0d6,[_0xced1('0xc'),_0x5b6acb[_0xced1('0xc')]]);if(_0x173e9a[_0xced1('0x4')]){_0x37fa95={};if(_0x55c21d[_0xced1('0x14')]==='AnalyticExtractedReport'){_0x37fa95[_0x173e9a[_0xced1('0x99')]]=_[_0xced1('0xb')](_0x5b6acb['associatedResources'],'id');}else{_0x37fa95[_0x173e9a[_0xced1('0x99')]]=_0x5b6acb['associatedResources'];}_0x40eed6[_0xced1('0x87')](_0x37fa95);}else{_0x395b52[_0xced1('0x95')]['id']=_0x5b6acb[_0xced1('0x8')];}}else{for(var _0x19f15d=0x0;_0x19f15d<_0x224b8f[_0xced1('0x86')];_0x19f15d++){_0x173e9a=_[_0xced1('0x88')](_0x2dd0d6,[_0xced1('0xc'),_0x224b8f[_0x19f15d][_0xced1('0xc')]]);if(_0x173e9a[_0xced1('0x4')]){_0x37fa95={};_0x37fa95[_0x173e9a[_0xced1('0x99')]]=_0x224b8f[_0x19f15d]['associatedResources'];_0x40eed6[_0xced1('0x87')](_0x37fa95);}else{if(!_0x395b52[_0xced1('0x95')]['id'])_0x395b52[_0xced1('0x95')]['id']=[];_0x224b8f[_0x19f15d][_0xced1('0x8')]['forEach'](function(_0x35ff8d){_0x395b52[_0xced1('0x95')]['id'][_0xced1('0x87')](_0x35ff8d);});}}}if(!_[_0xced1('0x85')](_0x40eed6)){_0x395b52['where']=_[_0xced1('0x9a')](_0x395b52[_0xced1('0x95')],{'$and':{'$or':_0x40eed6}});}_0x395b52=_[_0xced1('0x9a')]({},_0x395b52,_0x164ca1[_0xced1('0x9b')]);if(_0x5b6acb&&!_0x5b6acb[_0xced1('0x8c')]&&_0x55c21d['childModel']===_0xced1('0xe')){if(_0x164ca1['query'][_0xced1('0x9c')]){_0x395b52[_0xced1('0x9d')]=[{'all':!![]}];}return _0x424db6[_0x55c21d[_0xced1('0x14')]]['findAll'](_0x395b52)[_0xced1('0x7')](function(_0x328079){var _0x5eca32=[];_0x328079[_0xced1('0x9e')](function(_0x4eaf08){var _0xc4a5c8;switch(_0x4eaf08[_0xced1('0x9f')]){case _0xced1('0xa0'):_0xc4a5c8=_['find'](_0x5b6acb['associatedResources'],function(_0x1b6c00){return _0x1b6c00['id']===_0x4eaf08[_0xced1('0x6e')]&&_0x1b6c00[_0xced1('0x10')]===_0xced1('0xa1');});break;case _0xced1('0xa2'):_0xc4a5c8=_['find'](_0x5b6acb['associatedResources'],function(_0x30a9a1){return _0x30a9a1['id']===_0x4eaf08[_0xced1('0x6e')]&&_0x30a9a1[_0xced1('0x10')]==='CustomReports';});break;}if(_0xc4a5c8)_0x5eca32[_0xced1('0x87')](_0x4eaf08);});_0x1d850b['count']=_0x5eca32['length'];_0x1d850b[_0xced1('0xa3')]=_0x5eca32;return _0x1d850b;});}else{return _0x424db6[_0x55c21d['childModel']][_0xced1('0xa4')]({'where':_0x395b52['where']})[_0xced1('0x7')](function(_0x19120f){_0x1d850b[_0xced1('0xa4')]=_0x19120f;if(_0x164ca1[_0xced1('0x7d')][_0xced1('0x9c')]){if(_0x55c21d[_0xced1('0x14')]===_0xced1('0xa5')){_0x395b52['include']=[{'model':_0x424db6['Tag'],'as':_0xced1('0xa6'),'attributes':['id',_0xced1('0xc'),_0xced1('0xa7')],'required':_0x164ca1[_0xced1('0x7d')]['tag']?!![]:![]},{'model':_0x424db6['Tag'],'as':_0xced1('0xa8'),'attributes':['id','name',_0xced1('0xa7')],'through':_0x164ca1[_0xced1('0x7d')][_0xced1('0xa9')]?{'attributes':[],'where':{'TagId':_0x164ca1['query'][_0xced1('0xa9')]||undefined}}:{},'required':_0x164ca1[_0xced1('0x7d')]['tag']?!![]:![]}];}else{_0x395b52[_0xced1('0x9d')]=[{'all':!![]}];}}return _0x424db6[_0x55c21d[_0xced1('0x14')]][_0xced1('0x6')](_0x395b52);})['then'](function(_0x2f4f7a){_0x1d850b[_0xced1('0xa3')]=_0x2f4f7a;if(_0x57b644===_0xced1('0x2e')&&_0x164ca1[_0xced1('0x7d')][_0xced1('0xaa')]===_0xced1('0xab')){var _0x53fca5=[];for(var _0x5126d2=0x0;_0x5126d2<_0x1d850b[_0xced1('0xa3')][_0xced1('0x86')];_0x5126d2++){_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xac'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xae'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056('fax',_0x1d850b['rows'][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xaf'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xb0'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));_0x53fca5[_0xced1('0x87')](_0x849056(_0xced1('0xb1'),_0x1d850b[_0xced1('0xa3')][_0x5126d2][_0xced1('0xad')]));}return Promise[_0xced1('0x8d')](_0x53fca5)[_0xced1('0x7')](function(){return _0x1d850b;});}return _0x1d850b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index a961b55..0679204 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 _0xe1d7=['client','http','defaults','redis','socket.io-emitter','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3e0ee8,_0x245028){var _0x1f379e=function(_0x43eff8){while(--_0x43eff8){_0x3e0ee8['push'](_0x3e0ee8['shift']());}};_0x1f379e(++_0x245028);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x527acd,_0x32b758){_0x527acd=_0x527acd-0x0;var _0x2c990f=_0xe1d7[_0x527acd];return _0x2c990f;};'use strict';var _=require('lodash');var util=require(_0x7e1d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e1d('0x1'));var db=require(_0x7e1d('0x2'))['db'];var utils=require(_0x7e1d('0x3'));var logger=require('../../config/logger')(_0x7e1d('0x4'));var config=require(_0x7e1d('0x5'));var jayson=require(_0x7e1d('0x6'));var client=jayson[_0x7e1d('0x7')][_0x7e1d('0x8')]({'port':0x232a});config['redis']=_[_0x7e1d('0x9')](config[_0x7e1d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e1d('0xb'))(new Redis(config[_0x7e1d('0xa')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x39b933,_0x1e78ac,_0x15a029){return new BPromise(function(_0x36cf4d,_0x1e771a){return client[_0x7e1d('0xc')](_0x39b933,_0x15a029)[_0x7e1d('0xd')](function(_0x539502){logger[_0x7e1d('0xe')](_0x7e1d('0xf'),_0x1e78ac,_0x7e1d('0x10'));logger[_0x7e1d('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x1e78ac,_0x7e1d('0x10'),JSON[_0x7e1d('0x12')](_0x539502));if(_0x539502[_0x7e1d('0x13')]){if(_0x539502['error'][_0x7e1d('0x14')]===0x1f4){logger[_0x7e1d('0x13')]('UserProfile,\x20%s,\x20%s',_0x1e78ac,_0x539502['error'][_0x7e1d('0x15')]);return _0x1e771a(_0x539502[_0x7e1d('0x13')][_0x7e1d('0x15')]);}logger['error'](_0x7e1d('0xf'),_0x1e78ac,_0x539502[_0x7e1d('0x13')]['message']);return _0x36cf4d(_0x539502[_0x7e1d('0x13')][_0x7e1d('0x15')]);}else{logger[_0x7e1d('0xe')](_0x7e1d('0xf'),_0x1e78ac,'request\x20sent');_0x36cf4d(_0x539502[_0x7e1d('0x16')][_0x7e1d('0x15')]);}})[_0x7e1d('0x17')](function(_0x368320){logger[_0x7e1d('0x13')](_0x7e1d('0xf'),_0x1e78ac,_0x368320);_0x1e771a(_0x368320);});});} \ No newline at end of file +var _0xe062=['client','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4cb450,_0x30ddd0){var _0x15b1e7=function(_0x475224){while(--_0x475224){_0x4cb450['push'](_0x4cb450['shift']());}};_0x15b1e7(++_0x30ddd0);}(_0xe062,0x1b8));var _0x2e06=function(_0x4cbfc4,_0x29e96d){_0x4cbfc4=_0x4cbfc4-0x0;var _0x3e7889=_0xe062[_0x4cbfc4];return _0x3e7889;};'use strict';var _=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2e06('0x2'));var fs=require('fs');var Redis=require(_0x2e06('0x3'));var db=require(_0x2e06('0x4'))['db'];var utils=require(_0x2e06('0x5'));var logger=require(_0x2e06('0x6'))(_0x2e06('0x7'));var config=require(_0x2e06('0x8'));var jayson=require(_0x2e06('0x9'));var client=jayson[_0x2e06('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2e06('0xb'),'port':0x18eb});var socket=require(_0x2e06('0xc'))(new Redis(config['redis']));require('./userProfile.socket')[_0x2e06('0xd')](socket);function respondWithRpcPromise(_0x28433e,_0x6be39d,_0x29a813){return new BPromise(function(_0x18552c,_0x450369){return client[_0x2e06('0xe')](_0x28433e,_0x29a813)[_0x2e06('0xf')](function(_0x396810){logger[_0x2e06('0x10')](_0x2e06('0x11'),_0x6be39d,_0x2e06('0x12'));logger['debug'](_0x2e06('0x13'),_0x6be39d,_0x2e06('0x12'),JSON['stringify'](_0x396810));if(_0x396810['error']){if(_0x396810[_0x2e06('0x14')][_0x2e06('0x15')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x6be39d,_0x396810[_0x2e06('0x14')]['message']);return _0x450369(_0x396810['error'][_0x2e06('0x16')]);}logger[_0x2e06('0x14')]('UserProfile,\x20%s,\x20%s',_0x6be39d,_0x396810[_0x2e06('0x14')]['message']);return _0x18552c(_0x396810[_0x2e06('0x14')]['message']);}else{logger[_0x2e06('0x10')](_0x2e06('0x11'),_0x6be39d,_0x2e06('0x12'));_0x18552c(_0x396810[_0x2e06('0x17')][_0x2e06('0x16')]);}})[_0x2e06('0x18')](function(_0x3773fa){logger['error'](_0x2e06('0x11'),_0x6be39d,_0x3773fa);_0x450369(_0x3773fa);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index b6460c7..b6cddc6 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 _0x6bbc=['register','length','userProfile:','./userProfile.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6bbc,0x1db));var _0xc6bb=function(_0x279abf,_0x32561b){_0x279abf=_0x279abf-0x0;var _0x1d0fd8=_0x6bbc[_0x279abf];return _0x1d0fd8;};'use strict';var UserProfileEvents=require(_0xc6bb('0x0'));var events=[_0xc6bb('0x1'),_0xc6bb('0x2'),'update'];function createListener(_0x4d556f,_0x280fe9){return function(_0x2d2e11){_0x280fe9[_0xc6bb('0x3')](_0x4d556f,_0x2d2e11);};}function removeListener(_0x5cc9af,_0xf45eff){return function(){UserProfileEvents[_0xc6bb('0x4')](_0x5cc9af,_0xf45eff);};}exports[_0xc6bb('0x5')]=function(_0x85fd52){for(var _0x2ac1eb=0x0,_0x263a38=events[_0xc6bb('0x6')];_0x2ac1eb<_0x263a38;_0x2ac1eb++){var _0x4cbc0b=events[_0x2ac1eb];var _0xf4ad0=createListener(_0xc6bb('0x7')+_0x4cbc0b,_0x85fd52);UserProfileEvents['on'](_0x4cbc0b,_0xf4ad0);}}; \ No newline at end of file +var _0x017d=['emit','removeListener','userProfile:','./userProfile.events','save','remove','update'];(function(_0x2a7399,_0x53f430){var _0x4931f3=function(_0x52b6ac){while(--_0x52b6ac){_0x2a7399['push'](_0x2a7399['shift']());}};_0x4931f3(++_0x53f430);}(_0x017d,0x17d));var _0xd017=function(_0xa79df4,_0x1b420e){_0xa79df4=_0xa79df4-0x0;var _0x1c666f=_0x017d[_0xa79df4];return _0x1c666f;};'use strict';var UserProfileEvents=require(_0xd017('0x0'));var events=[_0xd017('0x1'),_0xd017('0x2'),_0xd017('0x3')];function createListener(_0x25c26d,_0x1553ef){return function(_0x40d61c){_0x1553ef[_0xd017('0x4')](_0x25c26d,_0x40d61c);};}function removeListener(_0x267e19,_0x4433b1){return function(){UserProfileEvents[_0xd017('0x5')](_0x267e19,_0x4433b1);};}exports['register']=function(_0x42e738){for(var _0x28f063=0x0,_0x2a1863=events['length'];_0x28f063<_0x2a1863;_0x28f063++){var _0x5dee8d=events[_0x28f063];var _0xccb366=createListener(_0xd017('0x6')+_0x5dee8d,_0x42e738);UserProfileEvents['on'](_0x5dee8d,_0xccb366);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 9a72082..f2ab3af 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 _0xa888=['./userProfileResource.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0xa888,0xc0));var _0x8a88=function(_0x29af75,_0x152b87){_0x29af75=_0x29af75-0x0;var _0x32b56b=_0xa888[_0x29af75];return _0x32b56b;};'use strict';var multer=require(_0x8a88('0x0'));var util=require(_0x8a88('0x1'));var path=require(_0x8a88('0x2'));var timeout=require(_0x8a88('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8a88('0x4'));var auth=require(_0x8a88('0x5'));var interaction=require(_0x8a88('0x6'));var config=require(_0x8a88('0x7'));var controller=require(_0x8a88('0x8'));router[_0x8a88('0x9')]('/',auth[_0x8a88('0xa')](),controller['index']);router[_0x8a88('0x9')]('/describe',auth[_0x8a88('0xa')](),controller[_0x8a88('0xb')]);router[_0x8a88('0x9')](_0x8a88('0xc'),auth[_0x8a88('0xa')](),controller[_0x8a88('0xd')]);router[_0x8a88('0xe')]('/',auth['isAuthenticated'](),controller[_0x8a88('0xf')]);router[_0x8a88('0x10')](_0x8a88('0xc'),auth['isAuthenticated'](),controller[_0x8a88('0x11')]);router['delete'](_0x8a88('0xc'),auth[_0x8a88('0xa')](),controller[_0x8a88('0x12')]);module[_0x8a88('0x13')]=router; \ No newline at end of file +var _0x2f7f=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x295188,_0x109ec7){var _0x51d6a4=function(_0x15beeb){while(--_0x15beeb){_0x295188['push'](_0x295188['shift']());}};_0x51d6a4(++_0x109ec7);}(_0x2f7f,0x83));var _0xf2f7=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x2f7f[_0x77d310];return _0x2cdce4;};'use strict';var multer=require(_0xf2f7('0x0'));var util=require(_0xf2f7('0x1'));var path=require(_0xf2f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2f7('0x3'));var router=express[_0xf2f7('0x4')]();var fs_extra=require(_0xf2f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf2f7('0x6'));var config=require(_0xf2f7('0x7'));var controller=require(_0xf2f7('0x8'));router[_0xf2f7('0x9')]('/',auth[_0xf2f7('0xa')](),controller[_0xf2f7('0xb')]);router[_0xf2f7('0x9')](_0xf2f7('0xc'),auth['isAuthenticated'](),controller[_0xf2f7('0xd')]);router[_0xf2f7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf2f7('0xe')]);router[_0xf2f7('0xf')]('/',auth['isAuthenticated'](),controller[_0xf2f7('0x10')]);router[_0xf2f7('0x11')](_0xf2f7('0x12'),auth[_0xf2f7('0xa')](),controller['update']);router[_0xf2f7('0x13')](_0xf2f7('0x12'),auth[_0xf2f7('0xa')](),controller[_0xf2f7('0x14')]);module[_0xf2f7('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e6b3c6c..3676017 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 _0xabda=['STRING','exports','INTEGER'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xabda,0x8e));var _0xaabd=function(_0x455893,_0x909838){_0x455893=_0x455893-0x0;var _0x3851e8=_0xabda[_0x455893];return _0x3851e8;};'use strict';var Sequelize=require('sequelize');module[_0xaabd('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xaabd('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xaabd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf51a=['exports','STRING'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0xf51a,0xfa));var _0xaf51=function(_0x4daf35,_0x28480c){_0x4daf35=_0x4daf35-0x0;var _0x54a0a7=_0xf51a[_0x4daf35];return _0x54a0a7;};'use strict';var Sequelize=require('sequelize');module[_0xaf51('0x0')]={'name':{'type':Sequelize[_0xaf51('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xaf51('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index af4daa5..a395572 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 _0x430c=['status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','UserProfileResource','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','describe','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0x430c,0x1a1));var _0xc430=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x430c[_0x1b6186];return _0x186121;};'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));};exports[_0xc430('0x48')]=function(_0x214954,_0x2a5143){return db[_0xc430('0x25')][_0xc430('0x48')]()[_0xc430('0x1e')](respondWithResult(_0x2a5143,null))['catch'](handleError(_0x2a5143,null));}; \ No newline at end of file +var _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x39f864,_0x26139a){var _0x5db44e=function(_0x3b3ba8){while(--_0x3b3ba8){_0x39f864['push'](_0x39f864['shift']());}};_0x5db44e(++_0x26139a);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d6eeda3..2ff7b2d 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 _0x7ef0=['rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','api','moment','bluebird','path'];(function(_0x38c4d1,_0x2d8769){var _0x2e3b4f=function(_0xa69e34){while(--_0xa69e34){_0x38c4d1['push'](_0x38c4d1['shift']());}};_0x2e3b4f(++_0x2d8769);}(_0x7ef0,0x13d));var _0x07ef=function(_0x23617d,_0x4dee70){_0x23617d=_0x23617d-0x0;var _0x4e35d8=_0x7ef0[_0x23617d];return _0x4e35d8;};'use strict';var _=require('lodash');var util=require(_0x07ef('0x0'));var logger=require('../../config/logger')(_0x07ef('0x1'));var moment=require(_0x07ef('0x2'));var BPromise=require(_0x07ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07ef('0x4'));var rimraf=require(_0x07ef('0x5'));var config=require(_0x07ef('0x6'));var attributes=require(_0x07ef('0x7'));module['exports']=function(_0x1b99a0,_0x27250e){return _0x1b99a0[_0x07ef('0x8')](_0x07ef('0x9'),attributes,{'tableName':_0x07ef('0xa'),'paranoid':![],'indexes':[{'name':_0x07ef('0xb'),'fields':[_0x07ef('0xc'),_0x07ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c48=['exports','define','UserProfileResource','compositeIndex','resourceId','sectionId','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0xdedef0,_0x16668c){var _0x248498=function(_0x37e96f){while(--_0x37e96f){_0xdedef0['push'](_0xdedef0['shift']());}};_0x248498(++_0x16668c);}(_0x2c48,0x1b8));var _0x82c4=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x2c48[_0x473738];return _0x1df4ae;};'use strict';var _=require('lodash');var util=require(_0x82c4('0x0'));var logger=require('../../config/logger')(_0x82c4('0x1'));var moment=require('moment');var BPromise=require(_0x82c4('0x2'));var rp=require(_0x82c4('0x3'));var fs=require('fs');var path=require(_0x82c4('0x4'));var rimraf=require(_0x82c4('0x5'));var config=require(_0x82c4('0x6'));var attributes=require(_0x82c4('0x7'));module[_0x82c4('0x8')]=function(_0x5919eb,_0x53f15c){return _0x5919eb[_0x82c4('0x9')](_0x82c4('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x82c4('0xb'),'fields':[_0x82c4('0xc'),_0x82c4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b0dce35..d2bf0a7 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 _0x60f4=['jayson/promise','client','http','request','then','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x58ee8a,_0x2ef628){var _0x2b89cb=function(_0x49b783){while(--_0x49b783){_0x58ee8a['push'](_0x58ee8a['shift']());}};_0x2b89cb(++_0x2ef628);}(_0x60f4,0x17f));var _0x460f=function(_0xc283cf,_0x112241){_0xc283cf=_0xc283cf-0x0;var _0x4d1164=_0x60f4[_0xc283cf];return _0x4d1164;};'use strict';var _=require('lodash');var util=require(_0x460f('0x0'));var moment=require(_0x460f('0x1'));var BPromise=require(_0x460f('0x2'));var rs=require(_0x460f('0x3'));var fs=require('fs');var Redis=require(_0x460f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x460f('0x5'));var logger=require(_0x460f('0x6'))('rpc');var config=require(_0x460f('0x7'));var jayson=require(_0x460f('0x8'));var client=jayson[_0x460f('0x9')][_0x460f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5af754,_0x3c2b41,_0xb86a10){return new BPromise(function(_0x2df337,_0x33a91a){return client[_0x460f('0xb')](_0x5af754,_0xb86a10)[_0x460f('0xc')](function(_0x5b2508){logger[_0x460f('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x3c2b41,_0x460f('0xe'));logger['debug'](_0x460f('0xf'),_0x3c2b41,_0x460f('0xe'),JSON[_0x460f('0x10')](_0x5b2508));if(_0x5b2508[_0x460f('0x11')]){if(_0x5b2508[_0x460f('0x11')][_0x460f('0x12')]===0x1f4){logger[_0x460f('0x11')](_0x460f('0x13'),_0x3c2b41,_0x5b2508[_0x460f('0x11')][_0x460f('0x14')]);return _0x33a91a(_0x5b2508['error'][_0x460f('0x14')]);}logger[_0x460f('0x11')](_0x460f('0x13'),_0x3c2b41,_0x5b2508[_0x460f('0x11')][_0x460f('0x14')]);return _0x2df337(_0x5b2508[_0x460f('0x11')][_0x460f('0x14')]);}else{logger[_0x460f('0xd')](_0x460f('0x13'),_0x3c2b41,'request\x20sent');_0x2df337(_0x5b2508[_0x460f('0x15')][_0x460f('0x14')]);}})[_0x460f('0x16')](function(_0x12b744){logger[_0x460f('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x3c2b41,_0x12b744);_0x33a91a(_0x12b744);});});} \ No newline at end of file +var _0x58c6=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x59e73c,_0x599dc9){var _0xce736e=function(_0x59967f){while(--_0x59967f){_0x59e73c['push'](_0x59e73c['shift']());}};_0xce736e(++_0x599dc9);}(_0x58c6,0x75));var _0x658c=function(_0x3f0577,_0x13d404){_0x3f0577=_0x3f0577-0x0;var _0x3c70dc=_0x58c6[_0x3f0577];return _0x3c70dc;};'use strict';var _=require(_0x658c('0x0'));var util=require(_0x658c('0x1'));var moment=require('moment');var BPromise=require(_0x658c('0x2'));var rs=require(_0x658c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x658c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x658c('0x5'))(_0x658c('0x6'));var config=require(_0x658c('0x7'));var jayson=require(_0x658c('0x8'));var client=jayson[_0x658c('0x9')][_0x658c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c174,_0x563463,_0x49e376){return new BPromise(function(_0x5a1062,_0x54bca1){return client[_0x658c('0xb')](_0x29c174,_0x49e376)[_0x658c('0xc')](function(_0x3e1ee7){logger['info'](_0x658c('0xd'),_0x563463,_0x658c('0xe'));logger[_0x658c('0xf')](_0x658c('0x10'),_0x563463,'request\x20sent',JSON['stringify'](_0x3e1ee7));if(_0x3e1ee7[_0x658c('0x11')]){if(_0x3e1ee7[_0x658c('0x11')][_0x658c('0x12')]===0x1f4){logger['error'](_0x658c('0xd'),_0x563463,_0x3e1ee7[_0x658c('0x11')]['message']);return _0x54bca1(_0x3e1ee7[_0x658c('0x11')][_0x658c('0x13')]);}logger[_0x658c('0x11')](_0x658c('0xd'),_0x563463,_0x3e1ee7[_0x658c('0x11')]['message']);return _0x5a1062(_0x3e1ee7[_0x658c('0x11')][_0x658c('0x13')]);}else{logger[_0x658c('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x563463,_0x658c('0xe'));_0x5a1062(_0x3e1ee7[_0x658c('0x15')]['message']);}})['catch'](function(_0xafb239){logger[_0x658c('0x11')](_0x658c('0xd'),_0x563463,_0xafb239);_0x54bca1(_0xafb239);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7d40530..b62b349 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 _0x86f3=['destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','put','update','/:id'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x86f3,0x13d));var _0x386f=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0x86f3[_0x37d3f3];return _0x185c9c;};'use strict';var multer=require('multer');var util=require(_0x386f('0x0'));var path=require(_0x386f('0x1'));var timeout=require('connect-timeout');var express=require(_0x386f('0x2'));var router=express[_0x386f('0x3')]();var fs_extra=require(_0x386f('0x4'));var auth=require(_0x386f('0x5'));var interaction=require(_0x386f('0x6'));var config=require(_0x386f('0x7'));var controller=require(_0x386f('0x8'));router[_0x386f('0x9')]('/',auth[_0x386f('0xa')](),controller[_0x386f('0xb')]);router[_0x386f('0x9')](_0x386f('0xc'),auth['isAuthenticated'](),controller[_0x386f('0xd')]);router[_0x386f('0x9')]('/:id',auth[_0x386f('0xa')](),controller[_0x386f('0xe')]);router[_0x386f('0xf')]('/',auth[_0x386f('0xa')](),controller['create']);router[_0x386f('0x10')]('/:id',auth[_0x386f('0xa')](),controller[_0x386f('0x11')]);router['delete'](_0x386f('0x12'),auth[_0x386f('0xa')](),controller[_0x386f('0x13')]);module[_0x386f('0x14')]=router; \ No newline at end of file +var _0x194a=['/describe','describe','show','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x366772,_0x388c35){var _0x408105=function(_0x393873){while(--_0x393873){_0x366772['push'](_0x366772['shift']());}};_0x408105(++_0x388c35);}(_0x194a,0x135));var _0xa194=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x194a[_0x4ab3fb];return _0x34fe1e;};'use strict';var multer=require('multer');var util=require(_0xa194('0x0'));var path=require(_0xa194('0x1'));var timeout=require(_0xa194('0x2'));var express=require(_0xa194('0x3'));var router=express[_0xa194('0x4')]();var fs_extra=require(_0xa194('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa194('0x6'));var config=require(_0xa194('0x7'));var controller=require(_0xa194('0x8'));router[_0xa194('0x9')]('/',auth[_0xa194('0xa')](),controller['index']);router[_0xa194('0x9')](_0xa194('0xb'),auth[_0xa194('0xa')](),controller[_0xa194('0xc')]);router[_0xa194('0x9')]('/:id',auth[_0xa194('0xa')](),controller[_0xa194('0xd')]);router['post']('/',auth[_0xa194('0xa')](),controller['create']);router[_0xa194('0xe')](_0xa194('0xf'),auth[_0xa194('0xa')](),controller[_0xa194('0x10')]);router[_0xa194('0x11')](_0xa194('0xf'),auth['isAuthenticated'](),controller[_0xa194('0x12')]);module[_0xa194('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 8092c0f..ade0cea 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 _0xfef3=['sequelize','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split'];(function(_0x5825e7,_0x49463a){var _0xc85dc3=function(_0x29ccfe){while(--_0x29ccfe){_0x5825e7['push'](_0x5825e7['shift']());}};_0xc85dc3(++_0x49463a);}(_0xfef3,0x118));var _0x3fef=function(_0x573ace,_0x5f5c56){_0x573ace=_0x573ace-0x0;var _0x6059c1=_0xfef3[_0x573ace];return _0x6059c1;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3fef('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3fef('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3fef('0x1')],'set':function(_0x3b71e5){this['setDataValue'](_0x3fef('0x4'),_0x3b71e5?_0x3b71e5[_0x3fef('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x3fef('0x4'))?this[_0x3fef('0x6')](_0x3fef('0x4'))[_0x3fef('0x7')](''):[];}}}; \ No newline at end of file +var _0x351d=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split'];(function(_0x391620,_0x5ae5a){var _0x3e3f9b=function(_0x56d4b4){while(--_0x56d4b4){_0x391620['push'](_0x391620['shift']());}};_0x3e3f9b(++_0x5ae5a);}(_0x351d,0x90));var _0xd351=function(_0x3712a2,_0x57e2b8){_0x3712a2=_0x3712a2-0x0;var _0x2418e8=_0x351d[_0x3712a2];return _0x2418e8;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'name':{'type':Sequelize[_0xd351('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xd351('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd351('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd351('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41d16d){this[_0xd351('0x4')]('crudPermissions',_0x41d16d?_0x41d16d[_0xd351('0x5')](''):[]);},'get':function(){return this[_0xd351('0x6')](_0xd351('0x7'))?this['getDataValue'](_0xd351('0x7'))[_0xd351('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 26523d4..464279c 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 _0x7c8a=['params','rawAttributes','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','send','UserProfileSection','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','merge','includeAll','findAll','catch','show'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x7c8a,0x9e));var _0xa7c8=function(_0x324ad4,_0x770e8e){_0x324ad4=_0x324ad4-0x0;var _0x231183=_0x7c8a[_0x324ad4];return _0x231183;};'use strict';var emlformat=require(_0xa7c8('0x0'));var rimraf=require(_0xa7c8('0x1'));var zipdir=require(_0xa7c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa7c8('0x3'));var moment=require(_0xa7c8('0x4'));var BPromise=require(_0xa7c8('0x5'));var Mustache=require(_0xa7c8('0x6'));var util=require(_0xa7c8('0x7'));var path=require(_0xa7c8('0x8'));var sox=require(_0xa7c8('0x9'));var csv=require('to-csv');var ejs=require(_0xa7c8('0xa'));var fs=require('fs');var fs_extra=require(_0xa7c8('0xb'));var _=require(_0xa7c8('0xc'));var squel=require(_0xa7c8('0xd'));var crypto=require(_0xa7c8('0xe'));var jsforce=require(_0xa7c8('0xf'));var deskjs=require(_0xa7c8('0x10'));var toCsv=require(_0xa7c8('0x11'));var querystring=require(_0xa7c8('0x12'));var Papa=require(_0xa7c8('0x13'));var Redis=require('ioredis');var authService=require(_0xa7c8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7c8('0x15'));var logger=require(_0xa7c8('0x16'))(_0xa7c8('0x17'));var utils=require(_0xa7c8('0x18'));var config=require(_0xa7c8('0x19'));var licenseUtil=require(_0xa7c8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x141975,_0x52b445){_0x52b445=_0x52b445||0xcc;return function(_0x5b7a42){if(_0x5b7a42){return _0x141975[_0xa7c8('0x1b')](_0x52b445);}return _0x141975['status'](_0x52b445)[_0xa7c8('0x1c')]();};}function respondWithResult(_0xa6e41e,_0x47660c){_0x47660c=_0x47660c||0xc8;return function(_0x27fdbe){if(_0x27fdbe){return _0xa6e41e[_0xa7c8('0x1d')](_0x47660c)[_0xa7c8('0x1e')](_0x27fdbe);}};}function respondWithFilteredResult(_0x4c09d5,_0x5ee51c){return function(_0x18e4c2){if(_0x18e4c2){var _0xfa833f=typeof _0x5ee51c[_0xa7c8('0x1f')]==='undefined'&&typeof _0x5ee51c['limit']==='undefined';var _0x337c08=_0x18e4c2[_0xa7c8('0x20')];var _0x2cfa78=_0xfa833f?0x0:_0x5ee51c['offset'];var _0x582d74=_0xfa833f?_0x18e4c2[_0xa7c8('0x20')]:_0x5ee51c[_0xa7c8('0x1f')]+_0x5ee51c[_0xa7c8('0x21')];var _0x21275a;if(_0x582d74>=_0x337c08){_0x582d74=_0x337c08;_0x21275a=0xc8;}else{_0x21275a=0xce;}_0x4c09d5[_0xa7c8('0x1d')](_0x21275a);return _0x4c09d5[_0xa7c8('0x22')](_0xa7c8('0x23'),_0x2cfa78+'-'+_0x582d74+'/'+_0x337c08)[_0xa7c8('0x1e')](_0x18e4c2);}return null;};}function patchUpdates(_0x27f659){return function(_0x4384a8){try{jsonpatch[_0xa7c8('0x24')](_0x4384a8,_0x27f659,!![]);}catch(_0x17a9be){return BPromise['reject'](_0x17a9be);}return _0x4384a8[_0xa7c8('0x25')]();};}function saveUpdates(_0x460c1e,_0x3638af){return function(_0x5db513){if(_0x5db513){return _0x5db513[_0xa7c8('0x26')](_0x460c1e)[_0xa7c8('0x27')](function(_0x82911c){return _0x82911c;});}return null;};}function removeEntity(_0x1389bf,_0x4edbe8){return function(_0x12ec16){if(_0x12ec16){return _0x12ec16[_0xa7c8('0x28')]()[_0xa7c8('0x27')](function(){_0x1389bf[_0xa7c8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23b60f,_0x2d780b){return function(_0x174e99){if(!_0x174e99){_0x23b60f['sendStatus'](0x194);}return _0x174e99;};}function handleError(_0x21a345,_0x4c9fe9){_0x4c9fe9=_0x4c9fe9||0x1f4;return function(_0x243a88){logger['error'](_0x243a88[_0xa7c8('0x29')]);if(_0x243a88['name']){delete _0x243a88['name'];}_0x21a345[_0xa7c8('0x1d')](_0x4c9fe9)[_0xa7c8('0x2a')](_0x243a88);};}exports['index']=function(_0x3e6cbc,_0x231c2c){var _0x91dfa5={},_0x33b0da={},_0x302fed={'count':0x0,'rows':[]};var _0x1599b1=_['map'](db[_0xa7c8('0x2b')]['rawAttributes'],function(_0x3179d8){return{'name':_0x3179d8['fieldName'],'type':_0x3179d8[_0xa7c8('0x2c')][_0xa7c8('0x2d')]};});_0x33b0da[_0xa7c8('0x2e')]=_['map'](_0x1599b1,_0xa7c8('0x2f'));_0x33b0da[_0xa7c8('0x30')]=_[_0xa7c8('0x31')](_0x3e6cbc[_0xa7c8('0x30')]);_0x33b0da[_0xa7c8('0x32')]=_['intersection'](_0x33b0da[_0xa7c8('0x2e')],_0x33b0da['query']);_0x91dfa5[_0xa7c8('0x33')]=_[_0xa7c8('0x34')](_0x33b0da['model'],qs['fields'](_0x3e6cbc['query'][_0xa7c8('0x35')]));_0x91dfa5[_0xa7c8('0x33')]=_0x91dfa5[_0xa7c8('0x33')][_0xa7c8('0x36')]?_0x91dfa5['attributes']:_0x33b0da[_0xa7c8('0x2e')];if(!_0x3e6cbc[_0xa7c8('0x30')][_0xa7c8('0x37')](_0xa7c8('0x38'))){_0x91dfa5[_0xa7c8('0x21')]=qs['limit'](_0x3e6cbc[_0xa7c8('0x30')]['limit']);_0x91dfa5['offset']=qs[_0xa7c8('0x1f')](_0x3e6cbc['query'][_0xa7c8('0x1f')]);}_0x91dfa5[_0xa7c8('0x39')]=qs[_0xa7c8('0x3a')](_0x3e6cbc[_0xa7c8('0x30')][_0xa7c8('0x3a')]);_0x91dfa5[_0xa7c8('0x3b')]=qs[_0xa7c8('0x32')](_['pick'](_0x3e6cbc[_0xa7c8('0x30')],_0x33b0da[_0xa7c8('0x32')]),_0x1599b1);if(_0x3e6cbc['query'][_0xa7c8('0x3c')]){_0x91dfa5['where']=_['merge'](_0x91dfa5['where'],{'$or':_[_0xa7c8('0x3d')](_0x1599b1,function(_0x560a19){if(_0x560a19[_0xa7c8('0x2c')]!=='VIRTUAL'){var _0xb2634c={};_0xb2634c[_0x560a19['name']]={'$like':'%'+_0x3e6cbc[_0xa7c8('0x30')][_0xa7c8('0x3c')]+'%'};return _0xb2634c;}})});}_0x91dfa5=_[_0xa7c8('0x3e')]({},_0x91dfa5,_0x3e6cbc['options']);var _0x4e094d={'where':_0x91dfa5[_0xa7c8('0x3b')]};return db[_0xa7c8('0x2b')][_0xa7c8('0x20')](_0x4e094d)[_0xa7c8('0x27')](function(_0x5ac2fd){_0x302fed[_0xa7c8('0x20')]=_0x5ac2fd;if(_0x3e6cbc['query'][_0xa7c8('0x3f')]){_0x91dfa5['include']=[{'all':!![]}];}return db[_0xa7c8('0x2b')][_0xa7c8('0x40')](_0x91dfa5);})[_0xa7c8('0x27')](function(_0x18d725){_0x302fed['rows']=_0x18d725;return _0x302fed;})['then'](respondWithFilteredResult(_0x231c2c,_0x91dfa5))[_0xa7c8('0x41')](handleError(_0x231c2c,null));};exports[_0xa7c8('0x42')]=function(_0x1814f3,_0x17a2f1){var _0x4c2854={'raw':![],'where':{'id':_0x1814f3[_0xa7c8('0x43')]['id']}},_0x54727b={};_0x54727b[_0xa7c8('0x2e')]=_['keys'](db['UserProfileSection'][_0xa7c8('0x44')]);_0x54727b['query']=_[_0xa7c8('0x31')](_0x1814f3['query']);_0x54727b[_0xa7c8('0x32')]=_[_0xa7c8('0x34')](_0x54727b[_0xa7c8('0x2e')],_0x54727b[_0xa7c8('0x30')]);_0x4c2854[_0xa7c8('0x33')]=_[_0xa7c8('0x34')](_0x54727b[_0xa7c8('0x2e')],qs[_0xa7c8('0x35')](_0x1814f3[_0xa7c8('0x30')][_0xa7c8('0x35')]));_0x4c2854[_0xa7c8('0x33')]=_0x4c2854[_0xa7c8('0x33')][_0xa7c8('0x36')]?_0x4c2854['attributes']:_0x54727b[_0xa7c8('0x2e')];if(_0x1814f3['query']['includeAll']){_0x4c2854[_0xa7c8('0x45')]=[{'all':!![]}];}_0x4c2854=_[_0xa7c8('0x3e')]({},_0x4c2854,_0x1814f3[_0xa7c8('0x46')]);return db[_0xa7c8('0x2b')][_0xa7c8('0x47')](_0x4c2854)['then'](handleEntityNotFound(_0x17a2f1,null))[_0xa7c8('0x27')](respondWithResult(_0x17a2f1,null))[_0xa7c8('0x41')](handleError(_0x17a2f1,null));};exports[_0xa7c8('0x48')]=function(_0x1ebcfb,_0x1a539f){return db[_0xa7c8('0x2b')][_0xa7c8('0x48')](_0x1ebcfb[_0xa7c8('0x49')],{})[_0xa7c8('0x27')](respondWithResult(_0x1a539f,0xc9))[_0xa7c8('0x41')](handleError(_0x1a539f,null));};exports['update']=function(_0x1080a4,_0x1a30d1){if(_0x1080a4[_0xa7c8('0x49')]['id']){delete _0x1080a4[_0xa7c8('0x49')]['id'];}return db[_0xa7c8('0x2b')][_0xa7c8('0x47')]({'where':{'id':_0x1080a4[_0xa7c8('0x43')]['id']}})[_0xa7c8('0x27')](handleEntityNotFound(_0x1a30d1,null))['then'](saveUpdates(_0x1080a4['body'],null))['then'](respondWithResult(_0x1a30d1,null))[_0xa7c8('0x41')](handleError(_0x1a30d1,null));};exports[_0xa7c8('0x28')]=function(_0x1b77b8,_0x3ad438){return db[_0xa7c8('0x2b')]['find']({'where':{'id':_0x1b77b8[_0xa7c8('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ad438,null))[_0xa7c8('0x27')](removeEntity(_0x3ad438,null))[_0xa7c8('0x41')](handleError(_0x3ad438,null));};exports[_0xa7c8('0x4a')]=function(_0x2027c5,_0x5f5ad3){return db[_0xa7c8('0x2b')][_0xa7c8('0x4a')]()[_0xa7c8('0x27')](respondWithResult(_0x5f5ad3,null))[_0xa7c8('0x41')](handleError(_0x5f5ad3,null));}; \ No newline at end of file +var _0xe4d0=['create','update','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','UserProfileSection','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','include','catch'];(function(_0x4e79a1,_0x2f0595){var _0x41c3e2=function(_0x40e2f9){while(--_0x40e2f9){_0x4e79a1['push'](_0x4e79a1['shift']());}};_0x41c3e2(++_0x2f0595);}(_0xe4d0,0x145));var _0x0e4d=function(_0x2a6754,_0x277259){_0x2a6754=_0x2a6754-0x0;var _0x17feda=_0xe4d0[_0x2a6754];return _0x17feda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e4d('0x0'));var zipdir=require(_0x0e4d('0x1'));var jsonpatch=require(_0x0e4d('0x2'));var rp=require(_0x0e4d('0x3'));var moment=require(_0x0e4d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e4d('0x5'));var util=require(_0x0e4d('0x6'));var path=require(_0x0e4d('0x7'));var sox=require(_0x0e4d('0x8'));var csv=require(_0x0e4d('0x9'));var ejs=require(_0x0e4d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e4d('0xb'));var squel=require(_0x0e4d('0xc'));var crypto=require(_0x0e4d('0xd'));var jsforce=require(_0x0e4d('0xe'));var deskjs=require(_0x0e4d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0e4d('0x10'));var Papa=require('papaparse');var Redis=require(_0x0e4d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0e4d('0x12'));var as=require(_0x0e4d('0x13'));var hardwareService=require(_0x0e4d('0x14'));var logger=require(_0x0e4d('0x15'))(_0x0e4d('0x16'));var utils=require(_0x0e4d('0x17'));var config=require(_0x0e4d('0x18'));var licenseUtil=require(_0x0e4d('0x19'));var db=require(_0x0e4d('0x1a'))['db'];function respondWithStatusCode(_0x106369,_0x92ce0d){_0x92ce0d=_0x92ce0d||0xcc;return function(_0x2c0071){if(_0x2c0071){return _0x106369[_0x0e4d('0x1b')](_0x92ce0d);}return _0x106369['status'](_0x92ce0d)[_0x0e4d('0x1c')]();};}function respondWithResult(_0x1b879d,_0x22ef99){_0x22ef99=_0x22ef99||0xc8;return function(_0x599f0d){if(_0x599f0d){return _0x1b879d[_0x0e4d('0x1d')](_0x22ef99)[_0x0e4d('0x1e')](_0x599f0d);}};}function respondWithFilteredResult(_0x4ff0e0,_0x2051a8){return function(_0x321c81){if(_0x321c81){var _0x5dccb0=typeof _0x2051a8[_0x0e4d('0x1f')]==='undefined'&&typeof _0x2051a8['limit']===_0x0e4d('0x20');var _0x4fa38b=_0x321c81[_0x0e4d('0x21')];var _0x519547=_0x5dccb0?0x0:_0x2051a8[_0x0e4d('0x1f')];var _0x5e94c2=_0x5dccb0?_0x321c81[_0x0e4d('0x21')]:_0x2051a8['offset']+_0x2051a8[_0x0e4d('0x22')];var _0x2f0901;if(_0x5e94c2>=_0x4fa38b){_0x5e94c2=_0x4fa38b;_0x2f0901=0xc8;}else{_0x2f0901=0xce;}_0x4ff0e0[_0x0e4d('0x1d')](_0x2f0901);return _0x4ff0e0[_0x0e4d('0x23')](_0x0e4d('0x24'),_0x519547+'-'+_0x5e94c2+'/'+_0x4fa38b)['json'](_0x321c81);}return null;};}function patchUpdates(_0xe6903e){return function(_0x3b383a){try{jsonpatch[_0x0e4d('0x25')](_0x3b383a,_0xe6903e,!![]);}catch(_0x23760e){return BPromise[_0x0e4d('0x26')](_0x23760e);}return _0x3b383a[_0x0e4d('0x27')]();};}function saveUpdates(_0x5ea62c,_0x1c41d2){return function(_0x2418a5){if(_0x2418a5){return _0x2418a5['update'](_0x5ea62c)[_0x0e4d('0x28')](function(_0x204e9d){return _0x204e9d;});}return null;};}function removeEntity(_0x2e8bb9,_0x1c70cf){return function(_0x287c94){if(_0x287c94){return _0x287c94[_0x0e4d('0x29')]()[_0x0e4d('0x28')](function(){_0x2e8bb9[_0x0e4d('0x1d')](0xcc)[_0x0e4d('0x1c')]();});}};}function handleEntityNotFound(_0x2155b3,_0xae62af){return function(_0x50f625){if(!_0x50f625){_0x2155b3[_0x0e4d('0x1b')](0x194);}return _0x50f625;};}function handleError(_0xee3955,_0x21b942){_0x21b942=_0x21b942||0x1f4;return function(_0x282b9d){logger[_0x0e4d('0x2a')](_0x282b9d[_0x0e4d('0x2b')]);if(_0x282b9d['name']){delete _0x282b9d[_0x0e4d('0x2c')];}_0xee3955[_0x0e4d('0x1d')](_0x21b942)['send'](_0x282b9d);};}exports[_0x0e4d('0x2d')]=function(_0x495602,_0x521f7e){var _0x4dcb49={},_0x38f2f1={},_0x3eb3ec={'count':0x0,'rows':[]};var _0x5f4ea2=_['map'](db[_0x0e4d('0x2e')][_0x0e4d('0x2f')],function(_0x5b1d4f){return{'name':_0x5b1d4f[_0x0e4d('0x30')],'type':_0x5b1d4f[_0x0e4d('0x31')][_0x0e4d('0x32')]};});_0x38f2f1['model']=_[_0x0e4d('0x33')](_0x5f4ea2,_0x0e4d('0x2c'));_0x38f2f1[_0x0e4d('0x34')]=_[_0x0e4d('0x35')](_0x495602[_0x0e4d('0x34')]);_0x38f2f1[_0x0e4d('0x36')]=_['intersection'](_0x38f2f1[_0x0e4d('0x37')],_0x38f2f1[_0x0e4d('0x34')]);_0x4dcb49[_0x0e4d('0x38')]=_[_0x0e4d('0x39')](_0x38f2f1['model'],qs[_0x0e4d('0x3a')](_0x495602[_0x0e4d('0x34')][_0x0e4d('0x3a')]));_0x4dcb49[_0x0e4d('0x38')]=_0x4dcb49[_0x0e4d('0x38')][_0x0e4d('0x3b')]?_0x4dcb49[_0x0e4d('0x38')]:_0x38f2f1[_0x0e4d('0x37')];if(!_0x495602['query'][_0x0e4d('0x3c')](_0x0e4d('0x3d'))){_0x4dcb49['limit']=qs['limit'](_0x495602['query'][_0x0e4d('0x22')]);_0x4dcb49[_0x0e4d('0x1f')]=qs['offset'](_0x495602[_0x0e4d('0x34')][_0x0e4d('0x1f')]);}_0x4dcb49[_0x0e4d('0x3e')]=qs[_0x0e4d('0x3f')](_0x495602[_0x0e4d('0x34')]['sort']);_0x4dcb49[_0x0e4d('0x40')]=qs[_0x0e4d('0x36')](_[_0x0e4d('0x41')](_0x495602[_0x0e4d('0x34')],_0x38f2f1[_0x0e4d('0x36')]),_0x5f4ea2);if(_0x495602['query']['filter']){_0x4dcb49[_0x0e4d('0x40')]=_['merge'](_0x4dcb49[_0x0e4d('0x40')],{'$or':_[_0x0e4d('0x33')](_0x5f4ea2,function(_0x177d81){if(_0x177d81[_0x0e4d('0x31')]!==_0x0e4d('0x42')){var _0x20679e={};_0x20679e[_0x177d81[_0x0e4d('0x2c')]]={'$like':'%'+_0x495602[_0x0e4d('0x34')][_0x0e4d('0x43')]+'%'};return _0x20679e;}})});}_0x4dcb49=_[_0x0e4d('0x44')]({},_0x4dcb49,_0x495602[_0x0e4d('0x45')]);var _0x5e8912={'where':_0x4dcb49[_0x0e4d('0x40')]};return db[_0x0e4d('0x2e')][_0x0e4d('0x21')](_0x5e8912)['then'](function(_0x65684c){_0x3eb3ec[_0x0e4d('0x21')]=_0x65684c;if(_0x495602[_0x0e4d('0x34')][_0x0e4d('0x46')]){_0x4dcb49['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x0e4d('0x47')](_0x4dcb49);})[_0x0e4d('0x28')](function(_0x178674){_0x3eb3ec[_0x0e4d('0x48')]=_0x178674;return _0x3eb3ec;})[_0x0e4d('0x28')](respondWithFilteredResult(_0x521f7e,_0x4dcb49))['catch'](handleError(_0x521f7e,null));};exports['show']=function(_0x595e6a,_0x15d156){var _0xa0f053={'raw':![],'where':{'id':_0x595e6a['params']['id']}},_0x198715={};_0x198715['model']=_[_0x0e4d('0x35')](db[_0x0e4d('0x2e')][_0x0e4d('0x2f')]);_0x198715[_0x0e4d('0x34')]=_[_0x0e4d('0x35')](_0x595e6a[_0x0e4d('0x34')]);_0x198715['filters']=_[_0x0e4d('0x39')](_0x198715['model'],_0x198715[_0x0e4d('0x34')]);_0xa0f053[_0x0e4d('0x38')]=_['intersection'](_0x198715['model'],qs[_0x0e4d('0x3a')](_0x595e6a[_0x0e4d('0x34')][_0x0e4d('0x3a')]));_0xa0f053[_0x0e4d('0x38')]=_0xa0f053[_0x0e4d('0x38')][_0x0e4d('0x3b')]?_0xa0f053[_0x0e4d('0x38')]:_0x198715[_0x0e4d('0x37')];if(_0x595e6a[_0x0e4d('0x34')][_0x0e4d('0x46')]){_0xa0f053[_0x0e4d('0x49')]=[{'all':!![]}];}_0xa0f053=_[_0x0e4d('0x44')]({},_0xa0f053,_0x595e6a[_0x0e4d('0x45')]);return db['UserProfileSection']['find'](_0xa0f053)['then'](handleEntityNotFound(_0x15d156,null))[_0x0e4d('0x28')](respondWithResult(_0x15d156,null))[_0x0e4d('0x4a')](handleError(_0x15d156,null));};exports['create']=function(_0x56186f,_0x28a9bd){return db[_0x0e4d('0x2e')][_0x0e4d('0x4b')](_0x56186f['body'],{})['then'](respondWithResult(_0x28a9bd,0xc9))[_0x0e4d('0x4a')](handleError(_0x28a9bd,null));};exports[_0x0e4d('0x4c')]=function(_0x4242ab,_0xa8decf){if(_0x4242ab['body']['id']){delete _0x4242ab[_0x0e4d('0x4d')]['id'];}return db[_0x0e4d('0x2e')][_0x0e4d('0x4e')]({'where':{'id':_0x4242ab[_0x0e4d('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa8decf,null))[_0x0e4d('0x28')](saveUpdates(_0x4242ab[_0x0e4d('0x4d')],null))['then'](respondWithResult(_0xa8decf,null))['catch'](handleError(_0xa8decf,null));};exports[_0x0e4d('0x29')]=function(_0x50686e,_0x16226f){return db[_0x0e4d('0x2e')][_0x0e4d('0x4e')]({'where':{'id':_0x50686e[_0x0e4d('0x4f')]['id']}})[_0x0e4d('0x28')](handleEntityNotFound(_0x16226f,null))[_0x0e4d('0x28')](removeEntity(_0x16226f,null))[_0x0e4d('0x4a')](handleError(_0x16226f,null));};exports['describe']=function(_0x445a35,_0x439a98){return db[_0x0e4d('0x2e')]['describe']()['then'](respondWithResult(_0x439a98,null))[_0x0e4d('0x4a')](handleError(_0x439a98,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index e0ed45f..1fd06f3 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 _0x2bbc=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','userProfileId','lodash','util'];(function(_0x472f39,_0x457d1d){var _0x3eb129=function(_0x3bf380){while(--_0x3bf380){_0x472f39['push'](_0x472f39['shift']());}};_0x3eb129(++_0x457d1d);}(_0x2bbc,0x1ea));var _0xc2bb=function(_0x49f974,_0x1cdcae){_0x49f974=_0x49f974-0x0;var _0x341f7e=_0x2bbc[_0x49f974];return _0x341f7e;};'use strict';var _=require(_0xc2bb('0x0'));var util=require(_0xc2bb('0x1'));var logger=require(_0xc2bb('0x2'))(_0xc2bb('0x3'));var moment=require('moment');var BPromise=require(_0xc2bb('0x4'));var rp=require(_0xc2bb('0x5'));var fs=require('fs');var path=require(_0xc2bb('0x6'));var rimraf=require(_0xc2bb('0x7'));var config=require(_0xc2bb('0x8'));var attributes=require(_0xc2bb('0x9'));module['exports']=function(_0x32d66c,_0xa597f2){return _0x32d66c[_0xc2bb('0xa')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xc2bb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cf1=['path','rimraf','../../config/environment','exports','define','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e7c86,_0x6688d8){var _0x30e446=function(_0x18c775){while(--_0x18c775){_0x2e7c86['push'](_0x2e7c86['shift']());}};_0x30e446(++_0x6688d8);}(_0x4cf1,0x13c));var _0x14cf=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x4cf1[_0x271060];return _0x40540b;};'use strict';var _=require('lodash');var util=require(_0x14cf('0x0'));var logger=require(_0x14cf('0x1'))(_0x14cf('0x2'));var moment=require(_0x14cf('0x3'));var BPromise=require(_0x14cf('0x4'));var rp=require(_0x14cf('0x5'));var fs=require('fs');var path=require(_0x14cf('0x6'));var rimraf=require(_0x14cf('0x7'));var config=require(_0x14cf('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x14cf('0x9')]=function(_0x12f300,_0x2bcbfe){return _0x12f300[_0x14cf('0xa')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x14cf('0xb'),'fields':[_0x14cf('0xc'),_0x14cf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 80fc8e9..330d6c3 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 _0xf1e9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x1adfc8,_0x5f3b92){var _0x45a200=function(_0x212db2){while(--_0x212db2){_0x1adfc8['push'](_0x1adfc8['shift']());}};_0x45a200(++_0x5f3b92);}(_0xf1e9,0xc3));var _0x9f1e=function(_0x42b45a,_0x272f8e){_0x42b45a=_0x42b45a-0x0;var _0x2531ce=_0xf1e9[_0x42b45a];return _0x2531ce;};'use strict';var _=require(_0x9f1e('0x0'));var util=require('util');var moment=require(_0x9f1e('0x1'));var BPromise=require(_0x9f1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f1e('0x3'));var db=require(_0x9f1e('0x4'))['db'];var utils=require(_0x9f1e('0x5'));var logger=require(_0x9f1e('0x6'))(_0x9f1e('0x7'));var config=require(_0x9f1e('0x8'));var jayson=require(_0x9f1e('0x9'));var client=jayson[_0x9f1e('0xa')][_0x9f1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c2a58,_0x1f2657,_0x4e4c6b){return new BPromise(function(_0x3faf94,_0x439820){return client['request'](_0x1c2a58,_0x4e4c6b)[_0x9f1e('0xc')](function(_0x27ae54){logger[_0x9f1e('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x1f2657,_0x9f1e('0xe'));logger[_0x9f1e('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1f2657,_0x9f1e('0xe'),JSON['stringify'](_0x27ae54));if(_0x27ae54['error']){if(_0x27ae54[_0x9f1e('0x10')][_0x9f1e('0x11')]===0x1f4){logger[_0x9f1e('0x10')](_0x9f1e('0x12'),_0x1f2657,_0x27ae54[_0x9f1e('0x10')]['message']);return _0x439820(_0x27ae54['error']['message']);}logger[_0x9f1e('0x10')](_0x9f1e('0x12'),_0x1f2657,_0x27ae54['error'][_0x9f1e('0x13')]);return _0x3faf94(_0x27ae54[_0x9f1e('0x10')][_0x9f1e('0x13')]);}else{logger[_0x9f1e('0xd')](_0x9f1e('0x12'),_0x1f2657,_0x9f1e('0xe'));_0x3faf94(_0x27ae54[_0x9f1e('0x14')][_0x9f1e('0x13')]);}})[_0x9f1e('0x15')](function(_0x2b8901){logger[_0x9f1e('0x10')](_0x9f1e('0x12'),_0x1f2657,_0x2b8901);_0x439820(_0x2b8901);});});} \ No newline at end of file +var _0x2755=['jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2755,0x19a));var _0x5275=function(_0x42efa7,_0x2d5d92){_0x42efa7=_0x42efa7-0x0;var _0x5d1b50=_0x2755[_0x42efa7];return _0x5d1b50;};'use strict';var _=require(_0x5275('0x0'));var util=require('util');var moment=require(_0x5275('0x1'));var BPromise=require(_0x5275('0x2'));var rs=require(_0x5275('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5275('0x4'))['db'];var utils=require(_0x5275('0x5'));var logger=require('../../config/logger')(_0x5275('0x6'));var config=require(_0x5275('0x7'));var jayson=require(_0x5275('0x8'));var client=jayson[_0x5275('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x589615,_0x4b5a0e,_0x207a00){return new BPromise(function(_0x3618da,_0xeea7d8){return client[_0x5275('0xa')](_0x589615,_0x207a00)[_0x5275('0xb')](function(_0x4e9987){logger[_0x5275('0xc')](_0x5275('0xd'),_0x4b5a0e,_0x5275('0xe'));logger[_0x5275('0xf')](_0x5275('0x10'),_0x4b5a0e,_0x5275('0xe'),JSON[_0x5275('0x11')](_0x4e9987));if(_0x4e9987[_0x5275('0x12')]){if(_0x4e9987[_0x5275('0x12')]['code']===0x1f4){logger[_0x5275('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x4b5a0e,_0x4e9987[_0x5275('0x12')][_0x5275('0x13')]);return _0xeea7d8(_0x4e9987[_0x5275('0x12')]['message']);}logger[_0x5275('0x12')](_0x5275('0xd'),_0x4b5a0e,_0x4e9987[_0x5275('0x12')]['message']);return _0x3618da(_0x4e9987['error'][_0x5275('0x13')]);}else{logger['info'](_0x5275('0xd'),_0x4b5a0e,'request\x20sent');_0x3618da(_0x4e9987[_0x5275('0x14')][_0x5275('0x13')]);}})[_0x5275('0x15')](function(_0x53f3a6){logger[_0x5275('0x12')](_0x5275('0xd'),_0x4b5a0e,_0x53f3a6);_0xeea7d8(_0x53f3a6);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b134001..a56990d 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x32ce61,_0x2ba733){var _0x28eded=function(_0x34db11){while(--_0x34db11){_0x32ce61['push'](_0x32ce61['shift']());}};_0x28eded(++_0x2ba733);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x10e9e2,_0x21a4a8){var _0xc12c3=function(_0x2cc7e3){while(--_0x2cc7e3){_0x10e9e2['push'](_0x10e9e2['shift']());}};_0xc12c3(++_0x21a4a8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 9614f67..6385486 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 _0xa0bf=['INTEGER','exports'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xa0bf,0xcd));var _0xfa0b=function(_0x17d2da,_0x36a695){_0x17d2da=_0x17d2da-0x0;var _0x3d4012=_0xa0bf[_0x17d2da];return _0x3d4012;};'use strict';var Sequelize=require('sequelize');module[_0xfa0b('0x0')]={'penalty':{'type':Sequelize[_0xfa0b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xff74=['sequelize','exports','INTEGER'];(function(_0xbf1cb4,_0x542455){var _0x15bc4d=function(_0x670798){while(--_0x670798){_0xbf1cb4['push'](_0xbf1cb4['shift']());}};_0x15bc4d(++_0x542455);}(_0xff74,0x12c));var _0x4ff7=function(_0x42d0ed,_0x91a115){_0x42d0ed=_0x42d0ed-0x0;var _0x3f63f6=_0xff74[_0x42d0ed];return _0x3f63f6;};'use strict';var Sequelize=require(_0x4ff7('0x0'));module[_0x4ff7('0x1')]={'penalty':{'type':Sequelize[_0x4ff7('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 1cf881b..074ee36 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 _0x5e0e=['../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3915bd,_0x20ff38){var _0x35ad44=function(_0x5cbb3a){while(--_0x5cbb3a){_0x3915bd['push'](_0x3915bd['shift']());}};_0x35ad44(++_0x20ff38);}(_0x5e0e,0x89));var _0xe5e0=function(_0x3af21a,_0x41400d){_0x3af21a=_0x3af21a-0x0;var _0x31334b=_0x5e0e[_0x3af21a];return _0x31334b;};'use strict';var _=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var logger=require('../../config/logger')(_0xe5e0('0x2'));var moment=require(_0xe5e0('0x3'));var BPromise=require(_0xe5e0('0x4'));var rp=require(_0xe5e0('0x5'));var fs=require('fs');var path=require(_0xe5e0('0x6'));var rimraf=require('rimraf');var config=require(_0xe5e0('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xe5e0('0x8')]=function(_0x3e564e,_0x2ff9ac){return _0x3e564e[_0xe5e0('0x9')](_0xe5e0('0xa'),attributes,{'tableName':_0xe5e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x583c=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','lodash'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x583c,0x12b));var _0xc583=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x583c[_0x593564];return _0x211a89;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));module['exports']=function(_0xd3a750,_0x365ed6){return _0xd3a750[_0xc583('0x8')](_0xc583('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index e93e274..78ad902 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 _0xc495=['../../config/utils','../../config/logger','rpc','jayson/promise','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xc495,0x10b));var _0x5c49=function(_0x5b9300,_0x4a8dbf){_0x5b9300=_0x5b9300-0x0;var _0x311a5f=_0xc495[_0x5b9300];return _0x311a5f;};'use strict';var _=require(_0x5c49('0x0'));var util=require('util');var moment=require(_0x5c49('0x1'));var BPromise=require(_0x5c49('0x2'));var rs=require(_0x5c49('0x3'));var fs=require('fs');var Redis=require(_0x5c49('0x4'));var db=require(_0x5c49('0x5'))['db'];var utils=require(_0x5c49('0x6'));var logger=require(_0x5c49('0x7'))(_0x5c49('0x8'));var config=require('../../config/environment');var jayson=require(_0x5c49('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49fe61,_0x400ebf,_0x4192ab){return new BPromise(function(_0x34e77f,_0x3209f4){return client[_0x5c49('0xa')](_0x49fe61,_0x4192ab)['then'](function(_0x4db8ea){logger[_0x5c49('0xb')](_0x5c49('0xc'),_0x400ebf,_0x5c49('0xd'));logger['debug'](_0x5c49('0xe'),_0x400ebf,'request\x20sent',JSON[_0x5c49('0xf')](_0x4db8ea));if(_0x4db8ea[_0x5c49('0x10')]){if(_0x4db8ea[_0x5c49('0x10')][_0x5c49('0x11')]===0x1f4){logger[_0x5c49('0x10')](_0x5c49('0xc'),_0x400ebf,_0x4db8ea[_0x5c49('0x10')][_0x5c49('0x12')]);return _0x3209f4(_0x4db8ea[_0x5c49('0x10')][_0x5c49('0x12')]);}logger[_0x5c49('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x400ebf,_0x4db8ea[_0x5c49('0x10')][_0x5c49('0x12')]);return _0x34e77f(_0x4db8ea[_0x5c49('0x10')]['message']);}else{logger[_0x5c49('0xb')](_0x5c49('0xc'),_0x400ebf,_0x5c49('0xd'));_0x34e77f(_0x4db8ea[_0x5c49('0x13')][_0x5c49('0x12')]);}})[_0x5c49('0x14')](function(_0x225974){logger[_0x5c49('0x10')](_0x5c49('0xc'),_0x400ebf,_0x225974);_0x3209f4(_0x225974);});});} \ No newline at end of file +var _0x1f4a=['then','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0x1f4a,0x181));var _0xa1f4=function(_0x21a134,_0x2e6cbe){_0x21a134=_0x21a134-0x0;var _0x3cd451=_0x1f4a[_0x21a134];return _0x3cd451;};'use strict';var _=require('lodash');var util=require(_0xa1f4('0x0'));var moment=require('moment');var BPromise=require(_0xa1f4('0x1'));var rs=require(_0xa1f4('0x2'));var fs=require('fs');var Redis=require(_0xa1f4('0x3'));var db=require(_0xa1f4('0x4'))['db'];var utils=require(_0xa1f4('0x5'));var logger=require(_0xa1f4('0x6'))(_0xa1f4('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1f4('0x8'));var client=jayson['client'][_0xa1f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51a195,_0x64f4ef,_0x5af077){return new BPromise(function(_0x10f2c1,_0x1362e4){return client[_0xa1f4('0xa')](_0x51a195,_0x5af077)[_0xa1f4('0xb')](function(_0x4a593e){logger['info'](_0xa1f4('0xc'),_0x64f4ef,'request\x20sent');logger[_0xa1f4('0xd')](_0xa1f4('0xe'),_0x64f4ef,'request\x20sent',JSON[_0xa1f4('0xf')](_0x4a593e));if(_0x4a593e[_0xa1f4('0x10')]){if(_0x4a593e['error'][_0xa1f4('0x11')]===0x1f4){logger[_0xa1f4('0x10')](_0xa1f4('0xc'),_0x64f4ef,_0x4a593e[_0xa1f4('0x10')]['message']);return _0x1362e4(_0x4a593e[_0xa1f4('0x10')]['message']);}logger[_0xa1f4('0x10')](_0xa1f4('0xc'),_0x64f4ef,_0x4a593e['error'][_0xa1f4('0x12')]);return _0x10f2c1(_0x4a593e[_0xa1f4('0x10')][_0xa1f4('0x12')]);}else{logger[_0xa1f4('0x13')](_0xa1f4('0xc'),_0x64f4ef,'request\x20sent');_0x10f2c1(_0x4a593e[_0xa1f4('0x14')][_0xa1f4('0x12')]);}})[_0xa1f4('0x15')](function(_0x520d92){logger[_0xa1f4('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x64f4ef,_0x520d92);_0x1362e4(_0x520d92);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 76aa5f8..27ddcb2 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfdc=['sequelize','INTEGER'];(function(_0x4d7815,_0x33847e){var _0x34eee7=function(_0x4cafd2){while(--_0x4cafd2){_0x4d7815['push'](_0x4d7815['shift']());}};_0x34eee7(++_0x33847e);}(_0xdfdc,0x186));var _0xcdfd=function(_0x428cc2,_0xb978ef){_0x428cc2=_0x428cc2-0x0;var _0xbd664b=_0xdfdc[_0x428cc2];return _0xbd664b;};'use strict';var Sequelize=require(_0xcdfd('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xcdfd('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xcdfd('0x1')]}}; \ No newline at end of file +var _0x4e49=['INTEGER','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4e49,0x10f));var _0x94e4=function(_0x40a5e8,_0x21b743){_0x40a5e8=_0x40a5e8-0x0;var _0x3d9295=_0x4e49[_0x40a5e8];return _0x3d9295;};'use strict';var Sequelize=require(_0x94e4('0x0'));module[_0x94e4('0x1')]={'UserId':{'type':Sequelize[_0x94e4('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index b92c3e3..4fd9c32 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(_0x129d50,_0x419d25){var _0x209068=function(_0x475ca7){while(--_0x475ca7){_0x129d50['push'](_0x129d50['shift']());}};_0x209068(++_0x419d25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x3ed801,_0x190579){var _0x10bffc=function(_0x4a1632){while(--_0x4a1632){_0x3ed801['push'](_0x3ed801['shift']());}};_0x10bffc(++_0x190579);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 23192cb..9942553 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(_0x5bf35e,_0x24dd1b){var _0x533fa1=function(_0x30b4b5){while(--_0x30b4b5){_0x5bf35e['push'](_0x5bf35e['shift']());}};_0x533fa1(++_0x24dd1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4da3aa,_0x45e833){var _0x515ec3=function(_0x462867){while(--_0x462867){_0x4da3aa['push'](_0x4da3aa['shift']());}};_0x515ec3(++_0x45e833);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xcb91[_0x4c4037];return _0x357862;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 51f02ce..0123e40 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 _0x27b5=['INTEGER','exports'];(function(_0x5c0974,_0x133f4a){var _0x45877a=function(_0xcca9c7){while(--_0xcca9c7){_0x5c0974['push'](_0x5c0974['shift']());}};_0x45877a(++_0x133f4a);}(_0x27b5,0x1a3));var _0x527b=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0x27b5[_0xbf5e16];return _0x5975a5;};'use strict';var Sequelize=require('sequelize');module[_0x527b('0x0')]={'penalty':{'type':Sequelize[_0x527b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xff92=['exports','sequelize'];(function(_0x2d7116,_0x37bee1){var _0x522d5a=function(_0x34cba3){while(--_0x34cba3){_0x2d7116['push'](_0x2d7116['shift']());}};_0x522d5a(++_0x37bee1);}(_0xff92,0x67));var _0x2ff9=function(_0x470029,_0x717f29){_0x470029=_0x470029-0x0;var _0x31d517=_0xff92[_0x470029];return _0x31d517;};'use strict';var Sequelize=require(_0x2ff9('0x0'));module[_0x2ff9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 0c1ed8b..3b4e6fe 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 _0x48fc=['exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x58725a,_0x389d19){var _0x2e6e65=function(_0x2f034e){while(--_0x2f034e){_0x58725a['push'](_0x58725a['shift']());}};_0x2e6e65(++_0x389d19);}(_0x48fc,0x199));var _0xc48f=function(_0x303c6d,_0x401e12){_0x303c6d=_0x303c6d-0x0;var _0x576f1b=_0x48fc[_0x303c6d];return _0x576f1b;};'use strict';var _=require(_0xc48f('0x0'));var util=require(_0xc48f('0x1'));var logger=require(_0xc48f('0x2'))(_0xc48f('0x3'));var moment=require(_0xc48f('0x4'));var BPromise=require(_0xc48f('0x5'));var rp=require(_0xc48f('0x6'));var fs=require('fs');var path=require(_0xc48f('0x7'));var rimraf=require(_0xc48f('0x8'));var config=require(_0xc48f('0x9'));var attributes=require(_0xc48f('0xa'));module[_0xc48f('0xb')]=function(_0x561c8b,_0x20e9f9){return _0x561c8b[_0xc48f('0xc')](_0xc48f('0xd'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf68f=['path','rimraf','../../config/environment','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xf68f,0x130));var _0xff68=function(_0x4554ff,_0x32759d){_0x4554ff=_0x4554ff-0x0;var _0x39da6b=_0xf68f[_0x4554ff];return _0x39da6b;};'use strict';var _=require(_0xff68('0x0'));var util=require('util');var logger=require(_0xff68('0x1'))(_0xff68('0x2'));var moment=require(_0xff68('0x3'));var BPromise=require(_0xff68('0x4'));var rp=require(_0xff68('0x5'));var fs=require('fs');var path=require(_0xff68('0x6'));var rimraf=require(_0xff68('0x7'));var config=require(_0xff68('0x8'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x488578,_0x4b563b){return _0x488578['define']('UserVoiceQueue',attributes,{'tableName':_0xff68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 309b462..e6d972d 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 _0x1809=['../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x5b90e8,_0x48f7d5){var _0x52fa9b=function(_0x3c8c9e){while(--_0x3c8c9e){_0x5b90e8['push'](_0x5b90e8['shift']());}};_0x52fa9b(++_0x48f7d5);}(_0x1809,0x1c7));var _0x9180=function(_0x582924,_0x1d16e8){_0x582924=_0x582924-0x0;var _0x521973=_0x1809[_0x582924];return _0x521973;};'use strict';var _=require(_0x9180('0x0'));var util=require(_0x9180('0x1'));var moment=require(_0x9180('0x2'));var BPromise=require(_0x9180('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9180('0x4'))['db'];var utils=require(_0x9180('0x5'));var logger=require('../../config/logger')(_0x9180('0x6'));var config=require(_0x9180('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9180('0x8')][_0x9180('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dcb37,_0x1b793c,_0x48bf7b){return new BPromise(function(_0xb3e321,_0x7d7310){return client[_0x9180('0xa')](_0x2dcb37,_0x48bf7b)[_0x9180('0xb')](function(_0x28e4db){logger[_0x9180('0xc')](_0x9180('0xd'),_0x1b793c,_0x9180('0xe'));logger['debug'](_0x9180('0xf'),_0x1b793c,'request\x20sent',JSON[_0x9180('0x10')](_0x28e4db));if(_0x28e4db['error']){if(_0x28e4db[_0x9180('0x11')][_0x9180('0x12')]===0x1f4){logger[_0x9180('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x1b793c,_0x28e4db[_0x9180('0x11')][_0x9180('0x13')]);return _0x7d7310(_0x28e4db[_0x9180('0x11')][_0x9180('0x13')]);}logger[_0x9180('0x11')](_0x9180('0xd'),_0x1b793c,_0x28e4db['error'][_0x9180('0x13')]);return _0xb3e321(_0x28e4db[_0x9180('0x11')][_0x9180('0x13')]);}else{logger[_0x9180('0xc')](_0x9180('0xd'),_0x1b793c,_0x9180('0xe'));_0xb3e321(_0x28e4db['result'][_0x9180('0x13')]);}})[_0x9180('0x14')](function(_0x29fbf3){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x1b793c,_0x29fbf3);_0x7d7310(_0x29fbf3);});});} \ No newline at end of file +var _0x8228=['jayson/promise','client','http','request','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x3cad30,_0xdfc5c7){var _0x5f12ed=function(_0x2c4d41){while(--_0x2c4d41){_0x3cad30['push'](_0x3cad30['shift']());}};_0x5f12ed(++_0xdfc5c7);}(_0x8228,0xae));var _0x8822=function(_0x4d9e91,_0x1336d5){_0x4d9e91=_0x4d9e91-0x0;var _0x363f98=_0x8228[_0x4d9e91];return _0x363f98;};'use strict';var _=require(_0x8822('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8822('0x1'));var fs=require('fs');var Redis=require(_0x8822('0x2'));var db=require(_0x8822('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8822('0x4'))('rpc');var config=require(_0x8822('0x5'));var jayson=require(_0x8822('0x6'));var client=jayson[_0x8822('0x7')][_0x8822('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15734e,_0x2b6812,_0x3fcb14){return new BPromise(function(_0x4ac6d3,_0x45d596){return client[_0x8822('0x9')](_0x15734e,_0x3fcb14)['then'](function(_0x50682e){logger['info'](_0x8822('0xa'),_0x2b6812,_0x8822('0xb'));logger[_0x8822('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2b6812,_0x8822('0xb'),JSON[_0x8822('0xd')](_0x50682e));if(_0x50682e[_0x8822('0xe')]){if(_0x50682e[_0x8822('0xe')][_0x8822('0xf')]===0x1f4){logger[_0x8822('0xe')](_0x8822('0xa'),_0x2b6812,_0x50682e[_0x8822('0xe')][_0x8822('0x10')]);return _0x45d596(_0x50682e[_0x8822('0xe')][_0x8822('0x10')]);}logger[_0x8822('0xe')](_0x8822('0xa'),_0x2b6812,_0x50682e[_0x8822('0xe')][_0x8822('0x10')]);return _0x4ac6d3(_0x50682e[_0x8822('0xe')][_0x8822('0x10')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x2b6812,_0x8822('0xb'));_0x4ac6d3(_0x50682e[_0x8822('0x11')][_0x8822('0x10')]);}})['catch'](function(_0xadf7a2){logger[_0x8822('0xe')](_0x8822('0xa'),_0x2b6812,_0xadf7a2);_0x45d596(_0xadf7a2);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index ff60046..ec41263 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x24eb2f,_0x361426){var _0x231c1b=function(_0x49cc7d){while(--_0x49cc7d){_0x24eb2f['push'](_0x24eb2f['shift']());}};_0x231c1b(++_0x361426);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x34d6cb,_0x1ae55c){var _0x4372cb=function(_0x1a073a){while(--_0x1a073a){_0x34d6cb['push'](_0x34d6cb['shift']());}};_0x4372cb(++_0x1ae55c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 1de104f..72c1271 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 _0x6fe6=['sequelize','Required\x20by\x20Asterisk','INTEGER','STRING','queue_interface'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6fe6,0xff));var _0x66fe=function(_0x2675ff,_0x92f02){_0x2675ff=_0x2675ff-0x0;var _0x12b2cf=_0x6fe6[_0x2675ff];return _0x12b2cf;};'use strict';var Sequelize=require(_0x66fe('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x66fe('0x1')},'UserId':{'type':Sequelize[_0x66fe('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x66fe('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x66fe('0x1')},'VoiceQueueId':{'type':Sequelize[_0x66fe('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x66fe('0x3')],'allowNull':![],'unique':_0x66fe('0x4'),'comment':_0x66fe('0x1')},'penalty':{'type':Sequelize[_0x66fe('0x2')](0xb),'defaultValue':0x0,'comment':_0x66fe('0x1')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xc522=['queue_interface','sequelize','exports','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xc522,0xa3));var _0x2c52=function(_0x3dff4d,_0x48e7bb){_0x3dff4d=_0x3dff4d-0x0;var _0x51e2ff=_0xc522[_0x3dff4d];return _0x51e2ff;};'use strict';var Sequelize=require(_0x2c52('0x0'));module[_0x2c52('0x1')]={'uniqueid':{'type':Sequelize[_0x2c52('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2c52('0x3')],'allowNull':![],'comment':_0x2c52('0x4')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2c52('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x2c52('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x2c52('0x3')],'allowNull':![],'unique':_0x2c52('0x5'),'comment':_0x2c52('0x4')},'penalty':{'type':Sequelize[_0x2c52('0x2')](0xb),'defaultValue':0x0,'comment':_0x2c52('0x4')},'paused':{'type':Sequelize[_0x2c52('0x2')](0xb),'defaultValue':0x0,'comment':_0x2c52('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 12f5536..675fc51 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 _0x1099=['hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x13b650,_0x4f428f){var _0x19c55f=function(_0x11f13c){while(--_0x11f13c){_0x13b650['push'](_0x13b650['shift']());}};_0x19c55f(++_0x4f428f);}(_0x1099,0x105));var _0x9109=function(_0x356889,_0x4bb6ce){_0x356889=_0x356889-0x0;var _0x22e376=_0x1099[_0x356889];return _0x22e376;};'use strict';var EventEmitter=require(_0x9109('0x0'));var UserVoiceQueueRt=require(_0x9109('0x1'))['db'][_0x9109('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9109('0x3')](0x0);var events={'afterCreate':_0x9109('0x4'),'afterUpdate':_0x9109('0x5'),'afterDestroy':_0x9109('0x6')};function emitEvent(_0x3c55c1){return function(_0x5559b7,_0x1c2837,_0x5a45d4){UserVoiceQueueRtEvents[_0x9109('0x7')](_0x3c55c1+':'+_0x5559b7['id'],_0x5559b7);UserVoiceQueueRtEvents['emit'](_0x3c55c1,_0x5559b7);_0x5a45d4(null);};}for(var e in events){if(events[_0x9109('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x9109('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x02db=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x02db,0x11e));var _0xb02d=function(_0x6154ce,_0x4b77f8){_0x6154ce=_0x6154ce-0x0;var _0x80b098=_0x02db[_0x6154ce];return _0x80b098;};'use strict';var EventEmitter=require(_0xb02d('0x0'));var UserVoiceQueueRt=require(_0xb02d('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb02d('0x2')](0x0);var events={'afterCreate':_0xb02d('0x3'),'afterUpdate':_0xb02d('0x4'),'afterDestroy':_0xb02d('0x5')};function emitEvent(_0xdbefe2){return function(_0x4220f2,_0x89ed38,_0x3e7a66){UserVoiceQueueRtEvents[_0xb02d('0x6')](_0xdbefe2+':'+_0x4220f2['id'],_0x4220f2);UserVoiceQueueRtEvents[_0xb02d('0x6')](_0xdbefe2,_0x4220f2);_0x3e7a66(null);};}for(var e in events){if(events[_0xb02d('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xb02d('0x8')](e,emitEvent(event));}}module[_0xb02d('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 9bb3ea9..da634d7 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 _0xc435=['rimraf','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x49eccb,_0x4ec802){var _0x481538=function(_0x22c896){while(--_0x22c896){_0x49eccb['push'](_0x49eccb['shift']());}};_0x481538(++_0x4ec802);}(_0xc435,0x7b));var _0x5c43=function(_0x15bac1,_0x4d791b){_0x15bac1=_0x15bac1-0x0;var _0x64f1c=_0xc435[_0x15bac1];return _0x64f1c;};'use strict';var _=require(_0x5c43('0x0'));var util=require('util');var logger=require(_0x5c43('0x1'))(_0x5c43('0x2'));var moment=require(_0x5c43('0x3'));var BPromise=require(_0x5c43('0x4'));var rp=require(_0x5c43('0x5'));var fs=require('fs');var path=require(_0x5c43('0x6'));var rimraf=require(_0x5c43('0x7'));var config=require(_0x5c43('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x5c43('0x9')]=function(_0x3b8e6e,_0x429711){return _0x3b8e6e[_0x5c43('0xa')](_0x5c43('0xb'),attributes,{'tableName':_0x5c43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9ca=['bluebird','request-promise','path','rimraf','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment'];(function(_0x176646,_0x5adeea){var _0x2e2b90=function(_0x50e1aa){while(--_0x50e1aa){_0x176646['push'](_0x176646['shift']());}};_0x2e2b90(++_0x5adeea);}(_0xd9ca,0x8b));var _0xad9c=function(_0x597d25,_0x7b52af){_0x597d25=_0x597d25-0x0;var _0xfa0c0d=_0xd9ca[_0x597d25];return _0xfa0c0d;};'use strict';var _=require(_0xad9c('0x0'));var util=require(_0xad9c('0x1'));var logger=require(_0xad9c('0x2'))(_0xad9c('0x3'));var moment=require(_0xad9c('0x4'));var BPromise=require(_0xad9c('0x5'));var rp=require(_0xad9c('0x6'));var fs=require('fs');var path=require(_0xad9c('0x7'));var rimraf=require(_0xad9c('0x8'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xad9c('0x9')]=function(_0x494119,_0x1378da){return _0x494119['define'](_0xad9c('0xa'),attributes,{'tableName':_0xad9c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 37331df..941ddd7 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 _0xafaf=['client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','UserVoiceQueueRt,\x20%s,\x20%s','message','request\x20sent','result','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x396cda,_0x6bed41){var _0xc27b48=function(_0x55407e){while(--_0x55407e){_0x396cda['push'](_0x396cda['shift']());}};_0xc27b48(++_0x6bed41);}(_0xafaf,0x1f1));var _0xfafa=function(_0x142bdb,_0x32fd9a){_0x142bdb=_0x142bdb-0x0;var _0xa2c1e5=_0xafaf[_0x142bdb];return _0xa2c1e5;};'use strict';var _=require('lodash');var util=require(_0xfafa('0x0'));var moment=require(_0xfafa('0x1'));var BPromise=require(_0xfafa('0x2'));var rs=require(_0xfafa('0x3'));var fs=require('fs');var Redis=require(_0xfafa('0x4'));var db=require(_0xfafa('0x5'))['db'];var utils=require(_0xfafa('0x6'));var logger=require(_0xfafa('0x7'))(_0xfafa('0x8'));var config=require('../../config/environment');var jayson=require(_0xfafa('0x9'));var client=jayson[_0xfafa('0xa')][_0xfafa('0xb')]({'port':0x232a});config[_0xfafa('0xc')]=_['defaults'](config[_0xfafa('0xc')],{'host':_0xfafa('0xd'),'port':0x18eb});var socket=require(_0xfafa('0xe'))(new Redis(config[_0xfafa('0xc')]));require(_0xfafa('0xf'))[_0xfafa('0x10')](socket);function respondWithRpcPromise(_0x42f308,_0x148ed8,_0x2955dc){return new BPromise(function(_0x313aca,_0x3e50ca){return client[_0xfafa('0x11')](_0x42f308,_0x2955dc)[_0xfafa('0x12')](function(_0x202d39){logger[_0xfafa('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x148ed8,'request\x20sent');logger['debug'](_0xfafa('0x14'),_0x148ed8,'request\x20sent',JSON['stringify'](_0x202d39));if(_0x202d39[_0xfafa('0x15')]){if(_0x202d39[_0xfafa('0x15')]['code']===0x1f4){logger[_0xfafa('0x15')](_0xfafa('0x16'),_0x148ed8,_0x202d39[_0xfafa('0x15')][_0xfafa('0x17')]);return _0x3e50ca(_0x202d39['error'][_0xfafa('0x17')]);}logger[_0xfafa('0x15')](_0xfafa('0x16'),_0x148ed8,_0x202d39['error'][_0xfafa('0x17')]);return _0x313aca(_0x202d39[_0xfafa('0x15')][_0xfafa('0x17')]);}else{logger[_0xfafa('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x148ed8,_0xfafa('0x18'));_0x313aca(_0x202d39[_0xfafa('0x19')][_0xfafa('0x17')]);}})['catch'](function(_0x27a380){logger[_0xfafa('0x15')](_0xfafa('0x16'),_0x148ed8,_0x27a380);_0x3e50ca(_0x27a380);});});}exports[_0xfafa('0x1a')]=function(_0x42e011){var _0x3bd5fd=this;return new Promise(function(_0x4534bb,_0x1335f6){return db['UserVoiceQueueRt'][_0xfafa('0x1b')]({'raw':_0x42e011[_0xfafa('0x1c')]?_0x42e011[_0xfafa('0x1c')][_0xfafa('0x1d')]===undefined?!![]:![]:!![],'where':_0x42e011[_0xfafa('0x1c')]?_0x42e011[_0xfafa('0x1c')][_0xfafa('0x1e')]||null:null,'attributes':[[db[_0xfafa('0x1f')]['fn'](_0xfafa('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xfafa('0x21')](_0xfafa('0x22')))),_0xfafa('0x23')]]})[_0xfafa('0x12')](function(_0x5a99e2){logger[_0xfafa('0x13')]('GetVoiceQueueRtPauses',_0x42e011);logger[_0xfafa('0x24')](_0xfafa('0x1a'),_0x42e011,JSON[_0xfafa('0x25')](_0x5a99e2));_0x4534bb(_0x5a99e2);})[_0xfafa('0x26')](function(_0x373865){logger[_0xfafa('0x15')](_0xfafa('0x1a'),_0x373865[_0xfafa('0x17')],_0x42e011);_0x1335f6(_0x3bd5fd[_0xfafa('0x15')](0x1f4,_0x373865['message']));});});}; \ No newline at end of file +var _0xb351=['sequelize','outboundQueuePauses','GetVoiceQueueRtPauses','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','UserVoiceQueueRt','options','raw','where'];(function(_0x2606a9,_0x2eeca8){var _0x1698ea=function(_0x49a9f8){while(--_0x49a9f8){_0x2606a9['push'](_0x2606a9['shift']());}};_0x1698ea(++_0x2eeca8);}(_0xb351,0x147));var _0x1b35=function(_0x3f187b,_0x1333f9){_0x3f187b=_0x3f187b-0x0;var _0x2ba71f=_0xb351[_0x3f187b];return _0x2ba71f;};'use strict';var _=require('lodash');var util=require(_0x1b35('0x0'));var moment=require(_0x1b35('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b35('0x2'));var fs=require('fs');var Redis=require(_0x1b35('0x3'));var db=require(_0x1b35('0x4'))['db'];var utils=require(_0x1b35('0x5'));var logger=require(_0x1b35('0x6'))(_0x1b35('0x7'));var config=require(_0x1b35('0x8'));var jayson=require(_0x1b35('0x9'));var client=jayson[_0x1b35('0xa')][_0x1b35('0xb')]({'port':0x232a});config['redis']=_[_0x1b35('0xc')](config[_0x1b35('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b35('0xe'))(new Redis(config[_0x1b35('0xd')]));require(_0x1b35('0xf'))[_0x1b35('0x10')](socket);function respondWithRpcPromise(_0x1403a1,_0x59f143,_0x51e9a9){return new BPromise(function(_0x4c3372,_0x247b03){return client[_0x1b35('0x11')](_0x1403a1,_0x51e9a9)[_0x1b35('0x12')](function(_0x51aa4f){logger[_0x1b35('0x13')](_0x1b35('0x14'),_0x59f143,_0x1b35('0x15'));logger[_0x1b35('0x16')](_0x1b35('0x17'),_0x59f143,'request\x20sent',JSON['stringify'](_0x51aa4f));if(_0x51aa4f['error']){if(_0x51aa4f['error'][_0x1b35('0x18')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x59f143,_0x51aa4f[_0x1b35('0x19')][_0x1b35('0x1a')]);return _0x247b03(_0x51aa4f[_0x1b35('0x19')][_0x1b35('0x1a')]);}logger[_0x1b35('0x19')](_0x1b35('0x14'),_0x59f143,_0x51aa4f['error'][_0x1b35('0x1a')]);return _0x4c3372(_0x51aa4f[_0x1b35('0x19')]['message']);}else{logger[_0x1b35('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x59f143,_0x1b35('0x15'));_0x4c3372(_0x51aa4f[_0x1b35('0x1b')]['message']);}})[_0x1b35('0x1c')](function(_0x44a0d0){logger[_0x1b35('0x19')](_0x1b35('0x14'),_0x59f143,_0x44a0d0);_0x247b03(_0x44a0d0);});});}exports['GetVoiceQueueRtPauses']=function(_0x545afa){var _0x1013d4=this;return new Promise(function(_0x4dfe38,_0x586e39){return db[_0x1b35('0x1d')]['findAll']({'raw':_0x545afa[_0x1b35('0x1e')]?_0x545afa[_0x1b35('0x1e')][_0x1b35('0x1f')]===undefined?!![]:![]:!![],'where':_0x545afa[_0x1b35('0x1e')]?_0x545afa[_0x1b35('0x1e')][_0x1b35('0x20')]||null:null,'attributes':[[db[_0x1b35('0x21')]['fn']('COUNT',db[_0x1b35('0x21')]['fn']('IF',db[_0x1b35('0x21')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x1b35('0x22')]]})[_0x1b35('0x12')](function(_0x4da911){logger[_0x1b35('0x13')](_0x1b35('0x23'),_0x545afa);logger['debug'](_0x1b35('0x23'),_0x545afa,JSON['stringify'](_0x4da911));_0x4dfe38(_0x4da911);})['catch'](function(_0x4afe94){logger[_0x1b35('0x19')]('GetVoiceQueueRtPauses',_0x4afe94[_0x1b35('0x1a')],_0x545afa);_0x586e39(_0x1013d4['error'](0x1f4,_0x4afe94['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d3be96d..6acda5b 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 _0xdd68=['update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xdd68,0x196));var _0x8dd6=function(_0x2b49bc,_0x47b636){_0x2b49bc=_0x2b49bc-0x0;var _0x43cc65=_0xdd68[_0x2b49bc];return _0x43cc65;};'use strict';var UserVoiceQueueRtEvents=require(_0x8dd6('0x0'));var events=['save',_0x8dd6('0x1'),_0x8dd6('0x2')];function createListener(_0x1aa630,_0x437161){return function(_0x5be787){_0x437161[_0x8dd6('0x3')](_0x1aa630,_0x5be787);};}function removeListener(_0x469e0c,_0x5c7c72){return function(){UserVoiceQueueRtEvents[_0x8dd6('0x4')](_0x469e0c,_0x5c7c72);};}exports[_0x8dd6('0x5')]=function(_0x5aa303){for(var _0x54708f=0x0,_0x4c021f=events[_0x8dd6('0x6')];_0x54708f<_0x4c021f;_0x54708f++){var _0x51f78e=events[_0x54708f];var _0x199f07=createListener(_0x8dd6('0x7')+_0x51f78e,_0x5aa303);UserVoiceQueueRtEvents['on'](_0x51f78e,_0x199f07);}}; \ No newline at end of file +var _0xa13d=['emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update'];(function(_0x5ecad8,_0x58f50d){var _0x34d992=function(_0x5833a8){while(--_0x5833a8){_0x5ecad8['push'](_0x5ecad8['shift']());}};_0x34d992(++_0x58f50d);}(_0xa13d,0x154));var _0xda13=function(_0x2b45c2,_0x288111){_0x2b45c2=_0x2b45c2-0x0;var _0x9cb440=_0xa13d[_0x2b45c2];return _0x9cb440;};'use strict';var UserVoiceQueueRtEvents=require(_0xda13('0x0'));var events=['save',_0xda13('0x1'),_0xda13('0x2')];function createListener(_0x558451,_0x3549a5){return function(_0x52c2c5){_0x3549a5[_0xda13('0x3')](_0x558451,_0x52c2c5);};}function removeListener(_0x208aa8,_0x56837b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x208aa8,_0x56837b);};}exports[_0xda13('0x4')]=function(_0x3d5a0e){for(var _0x4df317=0x0,_0x48cd5f=events[_0xda13('0x5')];_0x4df317<_0x48cd5f;_0x4df317++){var _0x2584c5=events[_0x4df317];var _0x51fa1b=createListener(_0xda13('0x6')+_0x2584c5,_0x3d5a0e);UserVoiceQueueRtEvents['on'](_0x2584c5,_0x51fa1b);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 564e949..4709f06 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x31bbf7,_0x292c9a){var _0x1469f3=function(_0x58ca15){while(--_0x58ca15){_0x31bbf7['push'](_0x31bbf7['shift']());}};_0x1469f3(++_0x292c9a);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2ff980,_0x1fb53f){var _0x40b81b=function(_0x2d6d5f){while(--_0x2d6d5f){_0x2ff980['push'](_0x2ff980['shift']());}};_0x40b81b(++_0x1fb53f);}(_0x70e0,0x17b));var _0x070e=function(_0x3c0c0b,_0x291f51){_0x3c0c0b=_0x3c0c0b-0x0;var _0x581a24=_0x70e0[_0x3c0c0b];return _0x581a24;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 37cc6e1..1ea7691 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 _0xdfe8=['INTEGER','sequelize','exports'];(function(_0x4eaa4c,_0x2f7422){var _0x15aec6=function(_0x23efc9){while(--_0x23efc9){_0x4eaa4c['push'](_0x4eaa4c['shift']());}};_0x15aec6(++_0x2f7422);}(_0xdfe8,0xa3));var _0x8dfe=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0xdfe8[_0x20e7e3];return _0x14b9de;};'use strict';var Sequelize=require(_0x8dfe('0x0'));module[_0x8dfe('0x1')]={'penalty':{'type':Sequelize[_0x8dfe('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ab6=['exports','INTEGER','sequelize'];(function(_0x4fdb79,_0x12c116){var _0x3ec15b=function(_0x50c82e){while(--_0x50c82e){_0x4fdb79['push'](_0x4fdb79['shift']());}};_0x3ec15b(++_0x12c116);}(_0x8ab6,0x8c));var _0x68ab=function(_0x253171,_0x400cb3){_0x253171=_0x253171-0x0;var _0x18f986=_0x8ab6[_0x253171];return _0x18f986;};'use strict';var Sequelize=require(_0x68ab('0x0'));module[_0x68ab('0x1')]={'penalty':{'type':Sequelize[_0x68ab('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index fb32d07..bafe98e 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 _0xd66c=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xc4e62c,_0x5b226e){var _0x44c950=function(_0x3c1298){while(--_0x3c1298){_0xc4e62c['push'](_0xc4e62c['shift']());}};_0x44c950(++_0x5b226e);}(_0xd66c,0x1ce));var _0xcd66=function(_0x365460,_0x280c44){_0x365460=_0x365460-0x0;var _0x42151c=_0xd66c[_0x365460];return _0x42151c;};'use strict';var _=require(_0xcd66('0x0'));var util=require('util');var logger=require(_0xcd66('0x1'))('api');var moment=require(_0xcd66('0x2'));var BPromise=require(_0xcd66('0x3'));var rp=require(_0xcd66('0x4'));var fs=require('fs');var path=require(_0xcd66('0x5'));var rimraf=require(_0xcd66('0x6'));var config=require(_0xcd66('0x7'));var attributes=require(_0xcd66('0x8'));module[_0xcd66('0x9')]=function(_0x455ee8,_0x1ca291){return _0x455ee8[_0xcd66('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0xcd66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82eb=['define','UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x3fffe8,_0x235db8){var _0x54c53f=function(_0x5cca17){while(--_0x5cca17){_0x3fffe8['push'](_0x3fffe8['shift']());}};_0x54c53f(++_0x235db8);}(_0x82eb,0x19d));var _0xb82e=function(_0x2e017a,_0x3e6d1f){_0x2e017a=_0x2e017a-0x0;var _0x5c0656=_0x82eb[_0x2e017a];return _0x5c0656;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb82e('0x0'))('api');var moment=require(_0xb82e('0x1'));var BPromise=require(_0xb82e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb82e('0x3'));var rimraf=require(_0xb82e('0x4'));var config=require(_0xb82e('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0xb82e('0x6')]=function(_0x4137fb,_0x5065ff){return _0x4137fb[_0xb82e('0x7')](_0xb82e('0x8'),attributes,{'tableName':_0xb82e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index d58ceb6..7a22832 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 _0x8dfb=['client','http','request','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3ece35,_0x1fb93c){var _0x35ce47=function(_0x316f60){while(--_0x316f60){_0x3ece35['push'](_0x3ece35['shift']());}};_0x35ce47(++_0x1fb93c);}(_0x8dfb,0x147));var _0xb8df=function(_0x2ecd91,_0x1f21e8){_0x2ecd91=_0x2ecd91-0x0;var _0x3bf737=_0x8dfb[_0x2ecd91];return _0x3bf737;};'use strict';var _=require(_0xb8df('0x0'));var util=require(_0xb8df('0x1'));var moment=require('moment');var BPromise=require(_0xb8df('0x2'));var rs=require(_0xb8df('0x3'));var fs=require('fs');var Redis=require(_0xb8df('0x4'));var db=require(_0xb8df('0x5'))['db'];var utils=require(_0xb8df('0x6'));var logger=require(_0xb8df('0x7'))('rpc');var config=require(_0xb8df('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb8df('0x9')][_0xb8df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55ec65,_0xc28d4c,_0x3df298){return new BPromise(function(_0x149a19,_0x39af85){return client[_0xb8df('0xb')](_0x55ec65,_0x3df298)['then'](function(_0x112a2e){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0xc28d4c,_0xb8df('0xc'));logger[_0xb8df('0xd')](_0xb8df('0xe'),_0xc28d4c,_0xb8df('0xc'),JSON['stringify'](_0x112a2e));if(_0x112a2e[_0xb8df('0xf')]){if(_0x112a2e[_0xb8df('0xf')][_0xb8df('0x10')]===0x1f4){logger['error'](_0xb8df('0x11'),_0xc28d4c,_0x112a2e[_0xb8df('0xf')][_0xb8df('0x12')]);return _0x39af85(_0x112a2e[_0xb8df('0xf')][_0xb8df('0x12')]);}logger[_0xb8df('0xf')](_0xb8df('0x11'),_0xc28d4c,_0x112a2e['error']['message']);return _0x149a19(_0x112a2e[_0xb8df('0xf')]['message']);}else{logger[_0xb8df('0x13')](_0xb8df('0x11'),_0xc28d4c,_0xb8df('0xc'));_0x149a19(_0x112a2e['result'][_0xb8df('0x12')]);}})[_0xb8df('0x14')](function(_0x558828){logger[_0xb8df('0xf')](_0xb8df('0x11'),_0xc28d4c,_0x558828);_0x39af85(_0x558828);});});} \ No newline at end of file +var _0x57d9=['result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x230b69,_0x132ce5){var _0x3cf857=function(_0x32cd5c){while(--_0x32cd5c){_0x230b69['push'](_0x230b69['shift']());}};_0x3cf857(++_0x132ce5);}(_0x57d9,0x15b));var _0x957d=function(_0x37594c,_0x250938){_0x37594c=_0x37594c-0x0;var _0xc6c829=_0x57d9[_0x37594c];return _0xc6c829;};'use strict';var _=require('lodash');var util=require(_0x957d('0x0'));var moment=require(_0x957d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x957d('0x2'))['db'];var utils=require(_0x957d('0x3'));var logger=require(_0x957d('0x4'))(_0x957d('0x5'));var config=require(_0x957d('0x6'));var jayson=require(_0x957d('0x7'));var client=jayson[_0x957d('0x8')][_0x957d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb17481,_0x1d618e,_0x4af0cb){return new BPromise(function(_0x5328bb,_0x396ce9){return client[_0x957d('0xa')](_0xb17481,_0x4af0cb)[_0x957d('0xb')](function(_0x3d4d7b){logger[_0x957d('0xc')](_0x957d('0xd'),_0x1d618e,_0x957d('0xe'));logger[_0x957d('0xf')](_0x957d('0x10'),_0x1d618e,'request\x20sent',JSON[_0x957d('0x11')](_0x3d4d7b));if(_0x3d4d7b['error']){if(_0x3d4d7b[_0x957d('0x12')][_0x957d('0x13')]===0x1f4){logger[_0x957d('0x12')](_0x957d('0xd'),_0x1d618e,_0x3d4d7b[_0x957d('0x12')][_0x957d('0x14')]);return _0x396ce9(_0x3d4d7b[_0x957d('0x12')][_0x957d('0x14')]);}logger[_0x957d('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1d618e,_0x3d4d7b[_0x957d('0x12')][_0x957d('0x14')]);return _0x5328bb(_0x3d4d7b['error'][_0x957d('0x14')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x1d618e,_0x957d('0xe'));_0x5328bb(_0x3d4d7b[_0x957d('0x15')][_0x957d('0x14')]);}})[_0x957d('0x16')](function(_0x32d92d){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x1d618e,_0x32d92d);_0x396ce9(_0x32d92d);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d7a0474..7908740 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 _0x8388=['/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4ca64e,_0x4b9475){var _0x10164c=function(_0x503798){while(--_0x503798){_0x4ca64e['push'](_0x4ca64e['shift']());}};_0x10164c(++_0x4b9475);}(_0x8388,0x18d));var _0x8838=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0x8388[_0x336ca2];return _0xda59a6;};'use strict';var multer=require(_0x8838('0x0'));var util=require(_0x8838('0x1'));var path=require(_0x8838('0x2'));var timeout=require(_0x8838('0x3'));var express=require('express');var router=express[_0x8838('0x4')]();var fs_extra=require(_0x8838('0x5'));var auth=require(_0x8838('0x6'));var interaction=require(_0x8838('0x7'));var config=require(_0x8838('0x8'));var controller=require('./variable.controller');router[_0x8838('0x9')]('/',auth[_0x8838('0xa')](),controller['index']);router[_0x8838('0x9')](_0x8838('0xb'),auth[_0x8838('0xa')](),controller['show']);router[_0x8838('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8838('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8838('0xe')]);router[_0x8838('0xf')](_0x8838('0xb'),auth[_0x8838('0xa')](),controller['destroy']);module[_0x8838('0x10')]=router; \ No newline at end of file +var _0xf430=['index','get','show','post','create','/:id','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0xf430,0x1e4));var _0x0f43=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0xf430[_0x136619];return _0x38c4a5;};'use strict';var multer=require(_0x0f43('0x0'));var util=require(_0x0f43('0x1'));var path=require(_0x0f43('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f43('0x3'));var router=express[_0x0f43('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f43('0x5'));var config=require(_0x0f43('0x6'));var controller=require(_0x0f43('0x7'));router['get']('/',auth[_0x0f43('0x8')](),controller[_0x0f43('0x9')]);router[_0x0f43('0xa')]('/:id',auth[_0x0f43('0x8')](),controller[_0x0f43('0xb')]);router[_0x0f43('0xc')]('/',auth['isAuthenticated'](),controller[_0x0f43('0xd')]);router['put'](_0x0f43('0xe'),auth[_0x0f43('0x8')](),controller['update']);router['delete'](_0x0f43('0xe'),auth[_0x0f43('0x8')](),controller[_0x0f43('0xf')]);module[_0x0f43('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 21a665b..648a169 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 _0xcd56=['STRING','sequelize','exports','name'];(function(_0x1a1506,_0x29c2d9){var _0x5de75f=function(_0x25f921){while(--_0x25f921){_0x1a1506['push'](_0x1a1506['shift']());}};_0x5de75f(++_0x29c2d9);}(_0xcd56,0xb1));var _0x6cd5=function(_0x46d596,_0x54caf1){_0x46d596=_0x46d596-0x0;var _0x438e5a=_0xcd56[_0x46d596];return _0x438e5a;};'use strict';var Sequelize=require(_0x6cd5('0x0'));module[_0x6cd5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6cd5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6cd5('0x3')]}}; \ No newline at end of file +var _0x489a=['name','STRING','sequelize','exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x489a,0x66));var _0xa489=function(_0x170f9d,_0xba5fad){_0x170f9d=_0x170f9d-0x0;var _0x44d5f5=_0x489a[_0x170f9d];return _0x44d5f5;};'use strict';var Sequelize=require(_0xa489('0x0'));module[_0xa489('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa489('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa489('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 5e428b2..a4605a3 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 _0x5ae8=['map','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then','destroy','Variables','UserProfileResource','error','stack','name','send','index','Variable','fieldName','type','key','model'];(function(_0x25c9ce,_0x10152a){var _0xcc7ac0=function(_0x363263){while(--_0x363263){_0x25c9ce['push'](_0x25c9ce['shift']());}};_0xcc7ac0(++_0x10152a);}(_0x5ae8,0xcf));var _0x85ae=function(_0x12246f,_0x2c06da){_0x12246f=_0x12246f-0x0;var _0x5a435e=_0x5ae8[_0x12246f];return _0x5a435e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85ae('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85ae('0x1'));var moment=require(_0x85ae('0x2'));var BPromise=require(_0x85ae('0x3'));var Mustache=require(_0x85ae('0x4'));var util=require('util');var path=require(_0x85ae('0x5'));var sox=require(_0x85ae('0x6'));var csv=require(_0x85ae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85ae('0x8'));var _=require(_0x85ae('0x9'));var squel=require(_0x85ae('0xa'));var crypto=require(_0x85ae('0xb'));var jsforce=require(_0x85ae('0xc'));var deskjs=require(_0x85ae('0xd'));var toCsv=require(_0x85ae('0x7'));var querystring=require(_0x85ae('0xe'));var Papa=require(_0x85ae('0xf'));var Redis=require(_0x85ae('0x10'));var authService=require(_0x85ae('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x85ae('0x12'));var hardwareService=require(_0x85ae('0x13'));var logger=require(_0x85ae('0x14'))(_0x85ae('0x15'));var utils=require('../../config/utils');var config=require(_0x85ae('0x16'));var licenseUtil=require(_0x85ae('0x17'));var db=require(_0x85ae('0x18'))['db'];function respondWithStatusCode(_0x2f9aaa,_0x44e196){_0x44e196=_0x44e196||0xcc;return function(_0x39a676){if(_0x39a676){return _0x2f9aaa[_0x85ae('0x19')](_0x44e196);}return _0x2f9aaa[_0x85ae('0x1a')](_0x44e196)[_0x85ae('0x1b')]();};}function respondWithResult(_0x491068,_0x4c7480){_0x4c7480=_0x4c7480||0xc8;return function(_0x4fec00){if(_0x4fec00){return _0x491068[_0x85ae('0x1a')](_0x4c7480)[_0x85ae('0x1c')](_0x4fec00);}};}function respondWithFilteredResult(_0x566602,_0x2aa3db){return function(_0x35a606){if(_0x35a606){var _0x4527b8=typeof _0x2aa3db['offset']==='undefined'&&typeof _0x2aa3db[_0x85ae('0x1d')]===_0x85ae('0x1e');var _0x297789=_0x35a606[_0x85ae('0x1f')];var _0x3233fc=_0x4527b8?0x0:_0x2aa3db['offset'];var _0x330e17=_0x4527b8?_0x35a606[_0x85ae('0x1f')]:_0x2aa3db[_0x85ae('0x20')]+_0x2aa3db[_0x85ae('0x1d')];var _0x2c4355;if(_0x330e17>=_0x297789){_0x330e17=_0x297789;_0x2c4355=0xc8;}else{_0x2c4355=0xce;}_0x566602[_0x85ae('0x1a')](_0x2c4355);return _0x566602[_0x85ae('0x21')]('Content-Range',_0x3233fc+'-'+_0x330e17+'/'+_0x297789)[_0x85ae('0x1c')](_0x35a606);}return null;};}function patchUpdates(_0x2a17bf){return function(_0xf63942){try{jsonpatch[_0x85ae('0x22')](_0xf63942,_0x2a17bf,!![]);}catch(_0x32c935){return BPromise['reject'](_0x32c935);}return _0xf63942[_0x85ae('0x23')]();};}function saveUpdates(_0xa805d9,_0x576d43){return function(_0x397434){if(_0x397434){return _0x397434[_0x85ae('0x24')](_0xa805d9)[_0x85ae('0x25')](function(_0x29e223){return _0x29e223;});}return null;};}function removeEntity(_0x17ece1,_0xf22533){return function(_0x176a3f){if(_0x176a3f){return _0x176a3f[_0x85ae('0x26')]()['then'](function(){var _0x35e8bc=_0x176a3f['get']({'plain':!![]});var _0x52c326=_0x85ae('0x27');return db[_0x85ae('0x28')]['destroy']({'where':{'type':_0x52c326,'resourceId':_0x35e8bc['id']}})[_0x85ae('0x25')](function(){return _0x176a3f;});})[_0x85ae('0x25')](function(){_0x17ece1[_0x85ae('0x1a')](0xcc)[_0x85ae('0x1b')]();});}};}function handleEntityNotFound(_0x5b4f14,_0x290092){return function(_0x5723c7){if(!_0x5723c7){_0x5b4f14[_0x85ae('0x19')](0x194);}return _0x5723c7;};}function handleError(_0x5efb42,_0x470833){_0x470833=_0x470833||0x1f4;return function(_0x49aa3a){logger[_0x85ae('0x29')](_0x49aa3a[_0x85ae('0x2a')]);if(_0x49aa3a['name']){delete _0x49aa3a[_0x85ae('0x2b')];}_0x5efb42[_0x85ae('0x1a')](_0x470833)[_0x85ae('0x2c')](_0x49aa3a);};}exports[_0x85ae('0x2d')]=function(_0x59eef1,_0x22f5c4){var _0x9a75c={},_0x23fa2a={},_0xf3fe06={'count':0x0,'rows':[]};var _0x1f08ca=_['map'](db[_0x85ae('0x2e')]['rawAttributes'],function(_0x1f47f1){return{'name':_0x1f47f1[_0x85ae('0x2f')],'type':_0x1f47f1[_0x85ae('0x30')][_0x85ae('0x31')]};});_0x23fa2a[_0x85ae('0x32')]=_[_0x85ae('0x33')](_0x1f08ca,'name');_0x23fa2a['query']=_[_0x85ae('0x34')](_0x59eef1[_0x85ae('0x35')]);_0x23fa2a[_0x85ae('0x36')]=_[_0x85ae('0x37')](_0x23fa2a[_0x85ae('0x32')],_0x23fa2a['query']);_0x9a75c['attributes']=_[_0x85ae('0x37')](_0x23fa2a[_0x85ae('0x32')],qs[_0x85ae('0x38')](_0x59eef1[_0x85ae('0x35')][_0x85ae('0x38')]));_0x9a75c[_0x85ae('0x39')]=_0x9a75c[_0x85ae('0x39')]['length']?_0x9a75c[_0x85ae('0x39')]:_0x23fa2a[_0x85ae('0x32')];if(!_0x59eef1['query']['hasOwnProperty'](_0x85ae('0x3a'))){_0x9a75c[_0x85ae('0x1d')]=qs[_0x85ae('0x1d')](_0x59eef1['query'][_0x85ae('0x1d')]);_0x9a75c[_0x85ae('0x20')]=qs[_0x85ae('0x20')](_0x59eef1[_0x85ae('0x35')]['offset']);}_0x9a75c[_0x85ae('0x3b')]=qs[_0x85ae('0x3c')](_0x59eef1[_0x85ae('0x35')][_0x85ae('0x3c')]);_0x9a75c[_0x85ae('0x3d')]=qs[_0x85ae('0x36')](_[_0x85ae('0x3e')](_0x59eef1[_0x85ae('0x35')],_0x23fa2a[_0x85ae('0x36')]),_0x1f08ca);if(_0x59eef1[_0x85ae('0x35')]['filter']){_0x9a75c[_0x85ae('0x3d')]=_[_0x85ae('0x3f')](_0x9a75c[_0x85ae('0x3d')],{'$or':_[_0x85ae('0x33')](_0x1f08ca,function(_0x1964ee){if(_0x1964ee[_0x85ae('0x30')]!==_0x85ae('0x40')){var _0x7a0178={};_0x7a0178[_0x1964ee[_0x85ae('0x2b')]]={'$like':'%'+_0x59eef1[_0x85ae('0x35')]['filter']+'%'};return _0x7a0178;}})});}_0x9a75c=_[_0x85ae('0x3f')]({},_0x9a75c,_0x59eef1[_0x85ae('0x41')]);var _0x39dfbb={'where':_0x9a75c[_0x85ae('0x3d')]};return db[_0x85ae('0x2e')][_0x85ae('0x1f')](_0x39dfbb)[_0x85ae('0x25')](function(_0x2403ea){_0xf3fe06[_0x85ae('0x1f')]=_0x2403ea;if(_0x59eef1[_0x85ae('0x35')][_0x85ae('0x42')]){_0x9a75c[_0x85ae('0x43')]=[{'all':!![]}];}return db[_0x85ae('0x2e')][_0x85ae('0x44')](_0x9a75c);})[_0x85ae('0x25')](function(_0x4517ce){_0xf3fe06[_0x85ae('0x45')]=_0x4517ce;return _0xf3fe06;})[_0x85ae('0x25')](respondWithFilteredResult(_0x22f5c4,_0x9a75c))['catch'](handleError(_0x22f5c4,null));};exports[_0x85ae('0x46')]=function(_0x2671f6,_0x524e70){var _0x1d90a0={'raw':!![],'where':{'id':_0x2671f6[_0x85ae('0x47')]['id']}},_0x2a8b31={};_0x2a8b31[_0x85ae('0x32')]=_[_0x85ae('0x34')](db[_0x85ae('0x2e')][_0x85ae('0x48')]);_0x2a8b31[_0x85ae('0x35')]=_[_0x85ae('0x34')](_0x2671f6[_0x85ae('0x35')]);_0x2a8b31[_0x85ae('0x36')]=_['intersection'](_0x2a8b31[_0x85ae('0x32')],_0x2a8b31[_0x85ae('0x35')]);_0x1d90a0['attributes']=_[_0x85ae('0x37')](_0x2a8b31[_0x85ae('0x32')],qs[_0x85ae('0x38')](_0x2671f6[_0x85ae('0x35')][_0x85ae('0x38')]));_0x1d90a0[_0x85ae('0x39')]=_0x1d90a0[_0x85ae('0x39')][_0x85ae('0x49')]?_0x1d90a0[_0x85ae('0x39')]:_0x2a8b31[_0x85ae('0x32')];if(_0x2671f6['query'][_0x85ae('0x42')]){_0x1d90a0[_0x85ae('0x43')]=[{'all':!![]}];}_0x1d90a0=_[_0x85ae('0x3f')]({},_0x1d90a0,_0x2671f6[_0x85ae('0x41')]);return db['Variable'][_0x85ae('0x4a')](_0x1d90a0)[_0x85ae('0x25')](handleEntityNotFound(_0x524e70,null))[_0x85ae('0x25')](respondWithResult(_0x524e70,null))[_0x85ae('0x4b')](handleError(_0x524e70,null));};exports[_0x85ae('0x4c')]=function(_0x3cae08,_0x14c4c9){return db[_0x85ae('0x2e')][_0x85ae('0x4c')](_0x3cae08[_0x85ae('0x4d')],{})[_0x85ae('0x25')](function(_0x57a80c){var _0x4dc638=_0x3cae08[_0x85ae('0x4e')]['get']({'plain':!![]});if(!_0x4dc638)throw new Error(_0x85ae('0x4f'));if(_0x4dc638[_0x85ae('0x50')]===_0x85ae('0x4e')){var _0x3006a7=_0x57a80c[_0x85ae('0x51')]({'plain':!![]});var _0x8f9c11='Variables';return db[_0x85ae('0x52')][_0x85ae('0x4a')]({'where':{'name':_0x8f9c11,'userProfileId':_0x4dc638[_0x85ae('0x53')]},'raw':!![]})['then'](function(_0x2b553d){if(_0x2b553d&&_0x2b553d[_0x85ae('0x54')]===0x0){return db[_0x85ae('0x28')][_0x85ae('0x4c')]({'name':_0x3006a7[_0x85ae('0x2b')],'resourceId':_0x3006a7['id'],'type':_0x2b553d['name'],'sectionId':_0x2b553d['id']},{})['then'](function(){return _0x57a80c;});}else{return _0x57a80c;}})[_0x85ae('0x4b')](function(_0x49456e){logger['error'](_0x85ae('0x55'),_0x49456e);throw _0x49456e;});}return _0x57a80c;})[_0x85ae('0x25')](respondWithResult(_0x14c4c9,0xc9))[_0x85ae('0x4b')](handleError(_0x14c4c9,null));};exports['update']=function(_0x100e19,_0x4db591){if(_0x100e19[_0x85ae('0x4d')]['id']){delete _0x100e19[_0x85ae('0x4d')]['id'];}return db[_0x85ae('0x2e')][_0x85ae('0x4a')]({'where':{'id':_0x100e19[_0x85ae('0x47')]['id']}})[_0x85ae('0x25')](handleEntityNotFound(_0x4db591,null))[_0x85ae('0x25')](saveUpdates(_0x100e19[_0x85ae('0x4d')],null))[_0x85ae('0x25')](respondWithResult(_0x4db591,null))[_0x85ae('0x4b')](handleError(_0x4db591,null));};exports[_0x85ae('0x26')]=function(_0x37f42b,_0x50b051){return db[_0x85ae('0x2e')][_0x85ae('0x4a')]({'where':{'id':_0x37f42b[_0x85ae('0x47')]['id']}})[_0x85ae('0x25')](handleEntityNotFound(_0x50b051,null))[_0x85ae('0x25')](removeEntity(_0x50b051,null))[_0x85ae('0x4b')](handleError(_0x50b051,null));}; \ No newline at end of file +var _0xee5c=['findAll','catch','show','params','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','Variables','UserProfileResource','sendStatus','error','name','send','Variable','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','options','includeAll'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xee5c,0x141));var _0xcee5=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xee5c[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0xcee5('0x0'));var rimraf=require(_0xcee5('0x1'));var zipdir=require(_0xcee5('0x2'));var jsonpatch=require(_0xcee5('0x3'));var rp=require(_0xcee5('0x4'));var moment=require(_0xcee5('0x5'));var BPromise=require(_0xcee5('0x6'));var Mustache=require('mustache');var util=require(_0xcee5('0x7'));var path=require(_0xcee5('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcee5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcee5('0xa'));var jsforce=require(_0xcee5('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcee5('0xc'));var Papa=require(_0xcee5('0xd'));var Redis=require(_0xcee5('0xe'));var authService=require(_0xcee5('0xf'));var qs=require(_0xcee5('0x10'));var as=require(_0xcee5('0x11'));var hardwareService=require(_0xcee5('0x12'));var logger=require(_0xcee5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcee5('0x14'));var licenseUtil=require(_0xcee5('0x15'));var db=require(_0xcee5('0x16'))['db'];function respondWithStatusCode(_0x23bb19,_0x228e6a){_0x228e6a=_0x228e6a||0xcc;return function(_0x5c3dde){if(_0x5c3dde){return _0x23bb19['sendStatus'](_0x228e6a);}return _0x23bb19['status'](_0x228e6a)[_0xcee5('0x17')]();};}function respondWithResult(_0x33e16f,_0x1d4301){_0x1d4301=_0x1d4301||0xc8;return function(_0x56d84b){if(_0x56d84b){return _0x33e16f[_0xcee5('0x18')](_0x1d4301)[_0xcee5('0x19')](_0x56d84b);}};}function respondWithFilteredResult(_0x276209,_0x3735be){return function(_0x4475a3){if(_0x4475a3){var _0x33377f=typeof _0x3735be[_0xcee5('0x1a')]===_0xcee5('0x1b')&&typeof _0x3735be[_0xcee5('0x1c')]===_0xcee5('0x1b');var _0xb091f7=_0x4475a3[_0xcee5('0x1d')];var _0x57ebe6=_0x33377f?0x0:_0x3735be[_0xcee5('0x1a')];var _0x24a9bf=_0x33377f?_0x4475a3['count']:_0x3735be[_0xcee5('0x1a')]+_0x3735be['limit'];var _0x3906b5;if(_0x24a9bf>=_0xb091f7){_0x24a9bf=_0xb091f7;_0x3906b5=0xc8;}else{_0x3906b5=0xce;}_0x276209[_0xcee5('0x18')](_0x3906b5);return _0x276209[_0xcee5('0x1e')](_0xcee5('0x1f'),_0x57ebe6+'-'+_0x24a9bf+'/'+_0xb091f7)[_0xcee5('0x19')](_0x4475a3);}return null;};}function patchUpdates(_0x503988){return function(_0x24f40d){try{jsonpatch[_0xcee5('0x20')](_0x24f40d,_0x503988,!![]);}catch(_0x4f32fb){return BPromise[_0xcee5('0x21')](_0x4f32fb);}return _0x24f40d[_0xcee5('0x22')]();};}function saveUpdates(_0x498ce3,_0x273fef){return function(_0x15609a){if(_0x15609a){return _0x15609a['update'](_0x498ce3)[_0xcee5('0x23')](function(_0x319bbc){return _0x319bbc;});}return null;};}function removeEntity(_0x13f670,_0x35ce9b){return function(_0x21d858){if(_0x21d858){return _0x21d858['destroy']()[_0xcee5('0x23')](function(){var _0x196b98=_0x21d858[_0xcee5('0x24')]({'plain':!![]});var _0x1ad3c8=_0xcee5('0x25');return db[_0xcee5('0x26')]['destroy']({'where':{'type':_0x1ad3c8,'resourceId':_0x196b98['id']}})[_0xcee5('0x23')](function(){return _0x21d858;});})['then'](function(){_0x13f670['status'](0xcc)[_0xcee5('0x17')]();});}};}function handleEntityNotFound(_0x1e0a45,_0x81041d){return function(_0x2b747c){if(!_0x2b747c){_0x1e0a45[_0xcee5('0x27')](0x194);}return _0x2b747c;};}function handleError(_0x1101bf,_0x20ddc4){_0x20ddc4=_0x20ddc4||0x1f4;return function(_0xacf0b0){logger[_0xcee5('0x28')](_0xacf0b0['stack']);if(_0xacf0b0[_0xcee5('0x29')]){delete _0xacf0b0[_0xcee5('0x29')];}_0x1101bf[_0xcee5('0x18')](_0x20ddc4)[_0xcee5('0x2a')](_0xacf0b0);};}exports['index']=function(_0x282983,_0x10cc1f){var _0x408b4a={},_0x44fbf1={},_0x26f5b5={'count':0x0,'rows':[]};var _0x2b789f=_['map'](db[_0xcee5('0x2b')][_0xcee5('0x2c')],function(_0x28762e){return{'name':_0x28762e['fieldName'],'type':_0x28762e['type'][_0xcee5('0x2d')]};});_0x44fbf1[_0xcee5('0x2e')]=_['map'](_0x2b789f,_0xcee5('0x29'));_0x44fbf1[_0xcee5('0x2f')]=_[_0xcee5('0x30')](_0x282983[_0xcee5('0x2f')]);_0x44fbf1[_0xcee5('0x31')]=_[_0xcee5('0x32')](_0x44fbf1[_0xcee5('0x2e')],_0x44fbf1[_0xcee5('0x2f')]);_0x408b4a[_0xcee5('0x33')]=_[_0xcee5('0x32')](_0x44fbf1['model'],qs['fields'](_0x282983['query'][_0xcee5('0x34')]));_0x408b4a[_0xcee5('0x33')]=_0x408b4a[_0xcee5('0x33')]['length']?_0x408b4a[_0xcee5('0x33')]:_0x44fbf1[_0xcee5('0x2e')];if(!_0x282983['query'][_0xcee5('0x35')](_0xcee5('0x36'))){_0x408b4a[_0xcee5('0x1c')]=qs[_0xcee5('0x1c')](_0x282983[_0xcee5('0x2f')]['limit']);_0x408b4a[_0xcee5('0x1a')]=qs[_0xcee5('0x1a')](_0x282983[_0xcee5('0x2f')][_0xcee5('0x1a')]);}_0x408b4a[_0xcee5('0x37')]=qs[_0xcee5('0x38')](_0x282983['query'][_0xcee5('0x38')]);_0x408b4a[_0xcee5('0x39')]=qs[_0xcee5('0x31')](_[_0xcee5('0x3a')](_0x282983['query'],_0x44fbf1[_0xcee5('0x31')]),_0x2b789f);if(_0x282983[_0xcee5('0x2f')][_0xcee5('0x3b')]){_0x408b4a['where']=_['merge'](_0x408b4a['where'],{'$or':_[_0xcee5('0x3c')](_0x2b789f,function(_0x43d556){if(_0x43d556[_0xcee5('0x3d')]!=='VIRTUAL'){var _0x2986ca={};_0x2986ca[_0x43d556[_0xcee5('0x29')]]={'$like':'%'+_0x282983[_0xcee5('0x2f')][_0xcee5('0x3b')]+'%'};return _0x2986ca;}})});}_0x408b4a=_['merge']({},_0x408b4a,_0x282983[_0xcee5('0x3e')]);var _0x11af0e={'where':_0x408b4a[_0xcee5('0x39')]};return db[_0xcee5('0x2b')][_0xcee5('0x1d')](_0x11af0e)[_0xcee5('0x23')](function(_0x3b414d){_0x26f5b5[_0xcee5('0x1d')]=_0x3b414d;if(_0x282983['query'][_0xcee5('0x3f')]){_0x408b4a['include']=[{'all':!![]}];}return db[_0xcee5('0x2b')][_0xcee5('0x40')](_0x408b4a);})[_0xcee5('0x23')](function(_0x3e4089){_0x26f5b5['rows']=_0x3e4089;return _0x26f5b5;})[_0xcee5('0x23')](respondWithFilteredResult(_0x10cc1f,_0x408b4a))[_0xcee5('0x41')](handleError(_0x10cc1f,null));};exports[_0xcee5('0x42')]=function(_0x1a7259,_0x2e52f9){var _0x768e48={'raw':!![],'where':{'id':_0x1a7259[_0xcee5('0x43')]['id']}},_0x5c86bf={};_0x5c86bf[_0xcee5('0x2e')]=_['keys'](db[_0xcee5('0x2b')]['rawAttributes']);_0x5c86bf['query']=_[_0xcee5('0x30')](_0x1a7259['query']);_0x5c86bf[_0xcee5('0x31')]=_[_0xcee5('0x32')](_0x5c86bf[_0xcee5('0x2e')],_0x5c86bf[_0xcee5('0x2f')]);_0x768e48[_0xcee5('0x33')]=_[_0xcee5('0x32')](_0x5c86bf[_0xcee5('0x2e')],qs['fields'](_0x1a7259[_0xcee5('0x2f')][_0xcee5('0x34')]));_0x768e48[_0xcee5('0x33')]=_0x768e48[_0xcee5('0x33')]['length']?_0x768e48[_0xcee5('0x33')]:_0x5c86bf[_0xcee5('0x2e')];if(_0x1a7259[_0xcee5('0x2f')][_0xcee5('0x3f')]){_0x768e48[_0xcee5('0x44')]=[{'all':!![]}];}_0x768e48=_[_0xcee5('0x45')]({},_0x768e48,_0x1a7259[_0xcee5('0x3e')]);return db[_0xcee5('0x2b')][_0xcee5('0x46')](_0x768e48)[_0xcee5('0x23')](handleEntityNotFound(_0x2e52f9,null))[_0xcee5('0x23')](respondWithResult(_0x2e52f9,null))[_0xcee5('0x41')](handleError(_0x2e52f9,null));};exports['create']=function(_0x180ac5,_0xd4afd2){return db[_0xcee5('0x2b')][_0xcee5('0x47')](_0x180ac5[_0xcee5('0x48')],{})[_0xcee5('0x23')](function(_0x40e13b){var _0x523410=_0x180ac5['user'][_0xcee5('0x24')]({'plain':!![]});if(!_0x523410)throw new Error(_0xcee5('0x49'));if(_0x523410['role']==='user'){var _0x5c3d10=_0x40e13b[_0xcee5('0x24')]({'plain':!![]});var _0x461001=_0xcee5('0x25');return db[_0xcee5('0x4a')][_0xcee5('0x46')]({'where':{'name':_0x461001,'userProfileId':_0x523410[_0xcee5('0x4b')]},'raw':!![]})[_0xcee5('0x23')](function(_0x5e125d){if(_0x5e125d&&_0x5e125d['autoAssociation']===0x0){return db[_0xcee5('0x26')][_0xcee5('0x47')]({'name':_0x5c3d10[_0xcee5('0x29')],'resourceId':_0x5c3d10['id'],'type':_0x5e125d['name'],'sectionId':_0x5e125d['id']},{})[_0xcee5('0x23')](function(){return _0x40e13b;});}else{return _0x40e13b;}})[_0xcee5('0x41')](function(_0x2a9ed5){logger[_0xcee5('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a9ed5);throw _0x2a9ed5;});}return _0x40e13b;})[_0xcee5('0x23')](respondWithResult(_0xd4afd2,0xc9))[_0xcee5('0x41')](handleError(_0xd4afd2,null));};exports['update']=function(_0x4039dc,_0x4500c2){if(_0x4039dc[_0xcee5('0x48')]['id']){delete _0x4039dc[_0xcee5('0x48')]['id'];}return db[_0xcee5('0x2b')]['find']({'where':{'id':_0x4039dc['params']['id']}})[_0xcee5('0x23')](handleEntityNotFound(_0x4500c2,null))['then'](saveUpdates(_0x4039dc['body'],null))['then'](respondWithResult(_0x4500c2,null))[_0xcee5('0x41')](handleError(_0x4500c2,null));};exports[_0xcee5('0x4c')]=function(_0x35264a,_0x50dd3a){return db['Variable']['find']({'where':{'id':_0x35264a[_0xcee5('0x43')]['id']}})[_0xcee5('0x23')](handleEntityNotFound(_0x50dd3a,null))[_0xcee5('0x23')](removeEntity(_0x50dd3a,null))[_0xcee5('0x41')](handleError(_0x50dd3a,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index de33f07..e0317bc 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 _0xd311=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables','lodash'];(function(_0x2e93eb,_0x47911f){var _0x535f15=function(_0xb279c3){while(--_0xb279c3){_0x2e93eb['push'](_0x2e93eb['shift']());}};_0x535f15(++_0x47911f);}(_0xd311,0x17f));var _0x1d31=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd311[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1d31('0x0'));var util=require(_0x1d31('0x1'));var logger=require(_0x1d31('0x2'))(_0x1d31('0x3'));var moment=require(_0x1d31('0x4'));var BPromise=require(_0x1d31('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d31('0x6'));var rimraf=require(_0x1d31('0x7'));var config=require(_0x1d31('0x8'));var attributes=require(_0x1d31('0x9'));module[_0x1d31('0xa')]=function(_0x3df8e7,_0x291bde){return _0x3df8e7['define']('Variable',attributes,{'tableName':_0x1d31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75cc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash','util','api'];(function(_0x12d2d8,_0x120c41){var _0x3ea062=function(_0x51ee2a){while(--_0x51ee2a){_0x12d2d8['push'](_0x12d2d8['shift']());}};_0x3ea062(++_0x120c41);}(_0x75cc,0x142));var _0xc75c=function(_0x25e59d,_0x395d17){_0x25e59d=_0x25e59d-0x0;var _0x39d1f8=_0x75cc[_0x25e59d];return _0x39d1f8;};'use strict';var _=require(_0xc75c('0x0'));var util=require(_0xc75c('0x1'));var logger=require('../../config/logger')(_0xc75c('0x2'));var moment=require(_0xc75c('0x3'));var BPromise=require(_0xc75c('0x4'));var rp=require(_0xc75c('0x5'));var fs=require('fs');var path=require(_0xc75c('0x6'));var rimraf=require(_0xc75c('0x7'));var config=require(_0xc75c('0x8'));var attributes=require(_0xc75c('0x9'));module[_0xc75c('0xa')]=function(_0xc0c07e,_0x160d5e){return _0xc0c07e[_0xc75c('0xb')](_0xc75c('0xc'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 96e9592..87b3279 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x380949,_0x27c686){var _0x16b517=function(_0xb98158){while(--_0xb98158){_0x380949['push'](_0x380949['shift']());}};_0x16b517(++_0x27c686);}(_0x814b,0x1a2));var _0xb814=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x814b[_0x7ad123];return _0x37d073;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x554598,_0x6800a2){var _0x45e778=function(_0x2df20c){while(--_0x2df20c){_0x554598['push'](_0x554598['shift']());}};_0x45e778(++_0x6800a2);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xe05ae6,_0x2b82a7){_0xe05ae6=_0xe05ae6-0x0;var _0x4f3030=_0x7fbe[_0xe05ae6];return _0x4f3030;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index ddf4c07..817a801 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 _0x6e94=['../../components/auth/service','index','get','/fetch','canUpdate','/reset','isAuthenticated','pull','restart','migrations','express','Router'];(function(_0x20c6af,_0x4832bf){var _0xb2b99e=function(_0x320ce9){while(--_0x320ce9){_0x20c6af['push'](_0x20c6af['shift']());}};_0xb2b99e(++_0x4832bf);}(_0x6e94,0x8e));var _0x46e9=function(_0x2064b0,_0x232d42){_0x2064b0=_0x2064b0-0x0;var _0x4ac160=_0x6e94[_0x2064b0];return _0x4ac160;};'use strict';var express=require(_0x46e9('0x0'));var router=express[_0x46e9('0x1')]();var auth=require(_0x46e9('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0x46e9('0x3')]);router[_0x46e9('0x4')](_0x46e9('0x5'),auth['isAuthenticated'](),auth[_0x46e9('0x6')](),controller['fetch']);router[_0x46e9('0x4')](_0x46e9('0x7'),auth[_0x46e9('0x8')](),auth[_0x46e9('0x6')](),controller['reset']);router[_0x46e9('0x4')]('/pull',auth[_0x46e9('0x8')](),auth[_0x46e9('0x6')](),controller[_0x46e9('0x9')]);router[_0x46e9('0x4')]('/restart',auth[_0x46e9('0x8')](),controller[_0x46e9('0xa')]);router[_0x46e9('0x4')]('/migrations',controller[_0x46e9('0xb')]);module['exports']=router; \ No newline at end of file +var _0x7707=['/fetch','isAuthenticated','canUpdate','reset','/pull','pull','restart','/migrations','exports','express','Router','./version.controller','get'];(function(_0x51aa71,_0xc902d6){var _0x2a4426=function(_0x32c3bc){while(--_0x32c3bc){_0x51aa71['push'](_0x51aa71['shift']());}};_0x2a4426(++_0xc902d6);}(_0x7707,0x1dd));var _0x7770=function(_0x5142a9,_0xe1bb99){_0x5142a9=_0x5142a9-0x0;var _0x3139c8=_0x7707[_0x5142a9];return _0x3139c8;};'use strict';var express=require(_0x7770('0x0'));var router=express[_0x7770('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x7770('0x2'));router[_0x7770('0x3')]('/',controller['index']);router[_0x7770('0x3')](_0x7770('0x4'),auth[_0x7770('0x5')](),auth['canUpdate'](),controller['fetch']);router[_0x7770('0x3')]('/reset',auth[_0x7770('0x5')](),auth[_0x7770('0x6')](),controller[_0x7770('0x7')]);router[_0x7770('0x3')](_0x7770('0x8'),auth[_0x7770('0x5')](),auth[_0x7770('0x6')](),controller[_0x7770('0x9')]);router[_0x7770('0x3')]('/restart',auth[_0x7770('0x5')](),controller[_0x7770('0xa')]);router[_0x7770('0x3')](_0x7770('0xb'),controller['migrations']);module[_0x7770('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a07c189..b8fe502 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 _0x981d=['pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','master','info','reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard'];(function(_0x214972,_0x54bc02){var _0x92bbaf=function(_0x5b65e7){while(--_0x5b65e7){_0x214972['push'](_0x214972['shift']());}};_0x92bbaf(++_0x54bc02);}(_0x981d,0x1a3));var _0xd981=function(_0x17c2bb,_0xcc3528){_0x17c2bb=_0x17c2bb-0x0;var _0x361ac5=_0x981d[_0x17c2bb];return _0x361ac5;};'use strict';var Umzug=require(_0xd981('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xd981('0x1'));var pkginfo=require(_0xd981('0x2'))(module,_0xd981('0x3'));var compareVersions=require(_0xd981('0x4'));var exec=require(_0xd981('0x5'))[_0xd981('0x6')];var db=require(_0xd981('0x7'))['db'];var config=require(_0xd981('0x8'));var pm2=require(_0xd981('0x9'));var logger=require('../../config/logger')(_0xd981('0xa'));var git=require(_0xd981('0xb'))(config[_0xd981('0xc')]);exports[_0xd981('0xd')]=function(_0xc3f270,_0x2f5363){var _0x1255f7={'current':module[_0xd981('0xe')]['version'],'phonebar':0x2};if(_0xc3f270[_0xd981('0xf')]&&_0xc3f270[_0xd981('0xf')]['latest']){return git[_0xd981('0x10')]()[_0xd981('0x11')](function(_0x259fa8,_0x41e748){_0x1255f7[_0xd981('0x12')]=(_0x259fa8?module['exports'][_0xd981('0x3')]:_0x41e748['latest'])||_0xd981('0x13');return _0x2f5363[_0xd981('0x14')](0xc8)['json'](_0x1255f7);});}else{return _0x2f5363[_0xd981('0x14')](0xc8)[_0xd981('0x15')](_0x1255f7);}};exports[_0xd981('0x10')]=function(_0x78a6f2,_0x5668c9){return git[_0xd981('0x10')](['origin',_0xd981('0x16')],function(_0x5d4cac){if(_0x5d4cac){logger['error'](_0x5d4cac);return _0x5668c9[_0xd981('0x14')](0x1f4)[_0xd981('0x15')](_0x5d4cac);}logger[_0xd981('0x17')]('git\x20fetch');return _0x5668c9[_0xd981('0x14')](0xc8)[_0xd981('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xd981('0x18')]=function(_0xffabde,_0x52e2e6){return git[_0xd981('0x18')]([_0xd981('0x19'),'FETCH_HEAD'],function(_0x5d5a9f){if(_0x5d5a9f){logger[_0xd981('0x1a')](_0x5d5a9f);return _0x52e2e6[_0xd981('0x14')](0x1f4)[_0xd981('0x15')](_0x5d5a9f);}logger[_0xd981('0x17')](_0xd981('0x1b'));return _0x52e2e6[_0xd981('0x14')](0xc8)['json']({'output':_0xd981('0x1c')});});};exports[_0xd981('0x1d')]=function(_0x18a4d8,_0x4ec061){exec(_0xd981('0x1e'),function(_0x467761,_0x515d02,_0x1b9335){logger[_0xd981('0x17')](_0x515d02);logger[_0xd981('0x17')](_0x1b9335);if(_0x467761){logger[_0xd981('0x1a')](_0x467761);return _0x4ec061['status'](0x1f4)[_0xd981('0x15')](_0x467761);}return _0x4ec061[_0xd981('0x14')](0xc8)[_0xd981('0x15')]({'output':_0x515d02});});};exports[_0xd981('0x1f')]=function(_0x5951b9,_0x7a9913){return pm2[_0xd981('0x1f')](_0xd981('0x20'))['then'](function(_0x1d9208){logger[_0xd981('0x17')](_0xd981('0x21'),_0x1d9208);return _0x7a9913[_0xd981('0x14')](0xc8)[_0xd981('0x15')]({'output':_0xd981('0x22')});})[_0xd981('0x23')](function(_0x17adbb){logger[_0xd981('0x1a')](_0x17adbb);return _0x7a9913['status'](0x1f4)[_0xd981('0x15')](_0x17adbb);});};exports[_0xd981('0x24')]=function(_0x2015d6,_0x22e778){var _0x438dca=fs[_0xd981('0x25')](path[_0xd981('0x26')](config['root'],_0xd981('0x27'),_0xd981('0x24')));var _0x181e2d=[];for(var _0x1e3e5b=0x0;_0x1e3e5b<_0x438dca['length'];_0x1e3e5b++){var _0x3ba806=_0x438dca[_0x1e3e5b][_0xd981('0x28')](_0xd981('0x29'),'');if(compareVersions(module[_0xd981('0xe')][_0xd981('0x3')],_0x3ba806)===-0x1){_0x181e2d[_0xd981('0x2a')](_0x3ba806);}}if(_0x181e2d[_0xd981('0x2b')]){var _0x19da6e=_0x181e2d[_0xd981('0x2c')](compareVersions);var _0x51d3c5=new Umzug({'storage':_0xd981('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0xd981('0x2e'),'columnName':_0xd981('0x3')},'migrations':{'params':[db[_0xd981('0x2d')][_0xd981('0x2f')](),db[_0xd981('0x2d')][_0xd981('0x30')],function(){throw new Error(_0xd981('0x31'));}],'path':path[_0xd981('0x26')](config[_0xd981('0xc')],_0xd981('0x27'),_0xd981('0x24')),'pattern':/\.js$/}});_0x51d3c5['up']({'migrations':_['map'](_0x19da6e,function(_0x21a215){return _0x21a215+_0xd981('0x29');})})[_0xd981('0x32')](function(){return _0x22e778[_0xd981('0x14')](0xc8)[_0xd981('0x15')]({'output':_0xd981('0x33')+module['exports'][_0xd981('0x3')]+_0xd981('0x34')+_[_0xd981('0x35')](_0x19da6e),'migrations':_[_0xd981('0x26')](_0x19da6e)});})[_0xd981('0x23')](function(_0x849181){if(_0x849181 instanceof db[_0xd981('0x2d')][_0xd981('0x36')]){return _0x22e778['status'](0xc8)[_0xd981('0x15')]({'output':_0xd981('0x37')});}else{return _0x22e778[_0xd981('0x14')](0x1f4)['json'](_0x849181);}});}else{return _0x22e778[_0xd981('0x14')](0xc8)[_0xd981('0x15')]({'output':_0xd981('0x37')});}}; \ No newline at end of file +var _0x945b=['motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','exports','query','latest','fetch','tags','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart'];(function(_0x653f35,_0x5476fd){var _0x506f37=function(_0x4a6a21){while(--_0x4a6a21){_0x653f35['push'](_0x653f35['shift']());}};_0x506f37(++_0x5476fd);}(_0x945b,0x123));var _0xb945=function(_0x40c039,_0x1d02b1){_0x40c039=_0x40c039-0x0;var _0x26254b=_0x945b[_0x40c039];return _0x26254b;};'use strict';var Umzug=require(_0xb945('0x0'));var path=require(_0xb945('0x1'));var fs=require('fs');var _=require(_0xb945('0x2'));var pkginfo=require(_0xb945('0x3'))(module,_0xb945('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xb945('0x5'))[_0xb945('0x6')];var db=require(_0xb945('0x7'))['db'];var config=require(_0xb945('0x8'));var pm2=require(_0xb945('0x9'));var logger=require(_0xb945('0xa'))(_0xb945('0xb'));var git=require('simple-git')(config[_0xb945('0xc')]);exports['index']=function(_0x1919d3,_0x3c689f){var _0x1362b2={'current':module[_0xb945('0xd')]['version'],'phonebar':0x2};if(_0x1919d3[_0xb945('0xe')]&&_0x1919d3['query'][_0xb945('0xf')]){return git[_0xb945('0x10')]()[_0xb945('0x11')](function(_0x1cd4bb,_0x4d53f9){_0x1362b2[_0xb945('0xf')]=(_0x1cd4bb?module[_0xb945('0xd')]['version']:_0x4d53f9[_0xb945('0xf')])||'2.0.0';return _0x3c689f[_0xb945('0x12')](0xc8)[_0xb945('0x13')](_0x1362b2);});}else{return _0x3c689f['status'](0xc8)[_0xb945('0x13')](_0x1362b2);}};exports[_0xb945('0x10')]=function(_0xb0d640,_0x2a3b43){return git[_0xb945('0x10')]([_0xb945('0x14'),_0xb945('0x15')],function(_0x1642fd){if(_0x1642fd){logger[_0xb945('0x16')](_0x1642fd);return _0x2a3b43[_0xb945('0x12')](0x1f4)[_0xb945('0x13')](_0x1642fd);}logger[_0xb945('0x17')](_0xb945('0x18'));return _0x2a3b43[_0xb945('0x12')](0xc8)[_0xb945('0x13')]({'output':_0xb945('0x19')});});};exports[_0xb945('0x1a')]=function(_0x1d707d,_0x1cd2e5){return git[_0xb945('0x1a')]([_0xb945('0x1b'),_0xb945('0x1c')],function(_0x562ea1){if(_0x562ea1){logger['error'](_0x562ea1);return _0x1cd2e5['status'](0x1f4)[_0xb945('0x13')](_0x562ea1);}logger[_0xb945('0x17')](_0xb945('0x1d'));return _0x1cd2e5[_0xb945('0x12')](0xc8)[_0xb945('0x13')]({'output':_0xb945('0x1e')});});};exports['pull']=function(_0x2faed2,_0x433536){exec(_0xb945('0x1f'),function(_0x5c7d16,_0x333510,_0x254bfb){logger[_0xb945('0x17')](_0x333510);logger['info'](_0x254bfb);if(_0x5c7d16){logger[_0xb945('0x16')](_0x5c7d16);return _0x433536[_0xb945('0x12')](0x1f4)[_0xb945('0x13')](_0x5c7d16);}return _0x433536[_0xb945('0x12')](0xc8)[_0xb945('0x13')]({'output':_0x333510});});};exports['restart']=function(_0x1a3dfc,_0x303fdf){return pm2[_0xb945('0x20')](_0xb945('0x21'))[_0xb945('0x22')](function(_0x4a732f){logger[_0xb945('0x17')]('pm2\x20restart\x20motion\x20%s',_0x4a732f);return _0x303fdf['status'](0xc8)[_0xb945('0x13')]({'output':_0xb945('0x23')});})['catch'](function(_0x7e2666){logger[_0xb945('0x16')](_0x7e2666);return _0x303fdf[_0xb945('0x12')](0x1f4)[_0xb945('0x13')](_0x7e2666);});};exports[_0xb945('0x24')]=function(_0x4bf53e,_0x4ccad8){var _0x550d79=fs['readdirSync'](path['join'](config[_0xb945('0xc')],_0xb945('0x25'),_0xb945('0x24')));var _0x5a9df8=[];for(var _0x4ec1ee=0x0;_0x4ec1ee<_0x550d79[_0xb945('0x26')];_0x4ec1ee++){var _0x410ee5=_0x550d79[_0x4ec1ee][_0xb945('0x27')]('.js','');if(compareVersions(module[_0xb945('0xd')][_0xb945('0x4')],_0x410ee5)===-0x1){_0x5a9df8[_0xb945('0x28')](_0x410ee5);}}if(_0x5a9df8['length']){var _0x6dc898=_0x5a9df8[_0xb945('0x29')](compareVersions);var _0x6ab927=new Umzug({'storage':_0xb945('0x2a'),'storageOptions':{'model':db[_0xb945('0x2b')],'modelName':_0xb945('0x2b'),'columnName':_0xb945('0x4')},'migrations':{'params':[db[_0xb945('0x2a')][_0xb945('0x2c')](),db[_0xb945('0x2a')]['constructor'],function(){throw new Error(_0xb945('0x2d'));}],'path':path[_0xb945('0x2e')](config['root'],_0xb945('0x25'),'migrations'),'pattern':/\.js$/}});_0x6ab927['up']({'migrations':_[_0xb945('0x2f')](_0x6dc898,function(_0x4b9e61){return _0x4b9e61+_0xb945('0x30');})})[_0xb945('0x22')](function(){return _0x4ccad8[_0xb945('0x12')](0xc8)[_0xb945('0x13')]({'output':_0xb945('0x31')+module['exports'][_0xb945('0x4')]+_0xb945('0x32')+_[_0xb945('0x33')](_0x6dc898),'migrations':_[_0xb945('0x2e')](_0x6dc898)});})[_0xb945('0x34')](function(_0x6e0649){if(_0x6e0649 instanceof db[_0xb945('0x2a')][_0xb945('0x35')]){return _0x4ccad8['status'](0xc8)[_0xb945('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4ccad8[_0xb945('0x12')](0x1f4)[_0xb945('0x13')](_0x6e0649);}});}else{return _0x4ccad8[_0xb945('0x12')](0xc8)[_0xb945('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 4185005..6ef15fb 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 _0xb7aa=['multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xb7aa,0x13b));var _0xab7a=function(_0xb3bb1,_0x4f5325){_0xb3bb1=_0xb3bb1-0x0;var _0xb6b605=_0xb7aa[_0xb3bb1];return _0xb6b605;};'use strict';var multer=require(_0xab7a('0x0'));var util=require(_0xab7a('0x1'));var path=require(_0xab7a('0x2'));var timeout=require(_0xab7a('0x3'));var express=require('express');var router=express[_0xab7a('0x4')]();var fs_extra=require(_0xab7a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xab7a('0x6'));var controller=require(_0xab7a('0x7'));router[_0xab7a('0x8')]('/',auth['isAuthenticated'](),controller[_0xab7a('0x9')]);router[_0xab7a('0x8')](_0xab7a('0xa'),auth[_0xab7a('0xb')](),controller[_0xab7a('0xc')]);router[_0xab7a('0x8')]('/:id',auth[_0xab7a('0xb')](),controller[_0xab7a('0xd')]);router[_0xab7a('0xe')]('/',auth[_0xab7a('0xb')](),controller[_0xab7a('0xf')]);router[_0xab7a('0x10')](_0xab7a('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xab7a('0x12')](_0xab7a('0x11'),auth['isAuthenticated'](),controller[_0xab7a('0x13')]);module[_0xab7a('0x14')]=router; \ No newline at end of file +var _0x1890=['/:id','show','post','create','put','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated','index','get','/describe'];(function(_0x47fb4b,_0xb02631){var _0x3c5187=function(_0x40edd4){while(--_0x40edd4){_0x47fb4b['push'](_0x47fb4b['shift']());}};_0x3c5187(++_0xb02631);}(_0x1890,0x1e2));var _0x0189=function(_0x21e41d,_0x24f03f){_0x21e41d=_0x21e41d-0x0;var _0x406b0c=_0x1890[_0x21e41d];return _0x406b0c;};'use strict';var multer=require(_0x0189('0x0'));var util=require('util');var path=require(_0x0189('0x1'));var timeout=require(_0x0189('0x2'));var express=require(_0x0189('0x3'));var router=express['Router']();var fs_extra=require(_0x0189('0x4'));var auth=require(_0x0189('0x5'));var interaction=require(_0x0189('0x6'));var config=require('../../config/environment');var controller=require(_0x0189('0x7'));router['get']('/',auth[_0x0189('0x8')](),controller[_0x0189('0x9')]);router[_0x0189('0xa')](_0x0189('0xb'),auth[_0x0189('0x8')](),controller['describe']);router['get'](_0x0189('0xc'),auth[_0x0189('0x8')](),controller[_0x0189('0xd')]);router[_0x0189('0xe')]('/',auth[_0x0189('0x8')](),controller[_0x0189('0xf')]);router[_0x0189('0x10')](_0x0189('0xc'),auth[_0x0189('0x8')](),controller['update']);router[_0x0189('0x11')](_0x0189('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0189('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 7b45c39..2b9935b 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 _0xab95=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x8222bd,_0x2c3e97){var _0x509947=function(_0x58a970){while(--_0x58a970){_0x8222bd['push'](_0x8222bd['shift']());}};_0x509947(++_0x2c3e97);}(_0xab95,0x1d5));var _0x5ab9=function(_0x1f989d,_0xada30c){_0x1f989d=_0x1f989d-0x0;var _0x2f6738=_0xab95[_0x1f989d];return _0x2f6738;};'use strict';var Sequelize=require(_0x5ab9('0x0'));module[_0x5ab9('0x1')]={'type':{'type':Sequelize[_0x5ab9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5ab9('0x2')]},'calleridname':{'type':Sequelize[_0x5ab9('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5ab9('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5ab9('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x5ab9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x5ab9('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x5ab9('0x4')]},'agentcomplete':{'type':Sequelize[_0x5ab9('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5ab9('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5ab9('0x4')]},'agentacw':{'type':Sequelize[_0x5ab9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x5ab9('0x2')]},'channel':{'type':Sequelize[_0x5ab9('0x2')]},'channelstate':{'type':Sequelize[_0x5ab9('0x4')]},'channelstatedesc':{'type':Sequelize[_0x5ab9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5ab9('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5ab9('0x2')]},'context':{'type':Sequelize[_0x5ab9('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5ab9('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x5ab9('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x5ab9('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5ab9('0x2')]},'destcalleridname':{'type':Sequelize[_0x5ab9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5ab9('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5ab9('0x2')]},'destaccountcode':{'type':Sequelize[_0x5ab9('0x2')]},'destcontext':{'type':Sequelize[_0x5ab9('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5ab9('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x5ab9('0x2')]},'transfer':{'type':Sequelize[_0x5ab9('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5ab9('0x2')],'comment':_0x5ab9('0x6')},'transferexten':{'type':Sequelize[_0x5ab9('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5ab9('0x2')]},'agententerreason':{'type':Sequelize[_0x5ab9('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4f4=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xe342b4,_0x11bb80){_0xe342b4=_0xe342b4-0x0;var _0x172a5f=_0xd4f4[_0xe342b4];return _0x172a5f;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'type':{'type':Sequelize[_0x4d4f('0x2')]},'uniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'calleridnum':{'type':Sequelize[_0x4d4f('0x2')]},'calleridname':{'type':Sequelize[_0x4d4f('0x2')]},'queue':{'type':Sequelize[_0x4d4f('0x2')]},'interface':{'type':Sequelize[_0x4d4f('0x2')]},'membername':{'type':Sequelize[_0x4d4f('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4d4f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4d4f('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x4d4f('0x4')]},'agentcomplete':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4d4f('0x4')]},'agentacw':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4d4f('0x4')]},'reason':{'type':Sequelize[_0x4d4f('0x2')]},'lastevent':{'type':Sequelize[_0x4d4f('0x2')]},'channel':{'type':Sequelize[_0x4d4f('0x2')]},'channelstate':{'type':Sequelize[_0x4d4f('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4d4f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4d4f('0x2')]},'connectedlinename':{'type':Sequelize[_0x4d4f('0x2')]},'language':{'type':Sequelize[_0x4d4f('0x2')]},'accountcode':{'type':Sequelize[_0x4d4f('0x2')]},'context':{'type':Sequelize[_0x4d4f('0x2')]},'exten':{'type':Sequelize[_0x4d4f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4d4f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4d4f('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4d4f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4d4f('0x2')]},'destlanguage':{'type':Sequelize[_0x4d4f('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4d4f('0x2')]},'destexten':{'type':Sequelize[_0x4d4f('0x2')]},'destpriority':{'type':Sequelize[_0x4d4f('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4d4f('0x2')],'comment':_0x4d4f('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'agententerreason':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index cfd09ae..de8483a 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(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index d12f6e4..5564f02 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 _0xef8b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api'];(function(_0x16d389,_0x2cdefc){var _0xa28d44=function(_0x4c9166){while(--_0x4c9166){_0x16d389['push'](_0x16d389['shift']());}};_0xa28d44(++_0x2cdefc);}(_0xef8b,0x192));var _0xbef8=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xef8b[_0x1b1e76];return _0x3d743a;};'use strict';var _=require('lodash');var util=require(_0xbef8('0x0'));var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var moment=require(_0xbef8('0x3'));var BPromise=require(_0xbef8('0x4'));var rp=require(_0xbef8('0x5'));var fs=require('fs');var path=require(_0xbef8('0x6'));var rimraf=require(_0xbef8('0x7'));var config=require(_0xbef8('0x8'));var attributes=require(_0xbef8('0x9'));module[_0xbef8('0xa')]=function(_0x550cb1,_0x1dd4a3){return _0x550cb1[_0xbef8('0xb')](_0xbef8('0xc'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xbef8('0xd'),_0xbef8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb5d=['../../config/logger','api','moment','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util'];(function(_0x4b657e,_0x379f1e){var _0x5032=function(_0x200e6a){while(--_0x200e6a){_0x4b657e['push'](_0x4b657e['shift']());}};_0x5032(++_0x379f1e);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xeb5d[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb5('0x4'));var rimraf=require(_0xdeb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x6'));module[_0xdeb5('0x7')]=function(_0x164ecb,_0x33af72){return _0x164ecb[_0xdeb5('0x8')](_0xdeb5('0x9'),attributes,{'tableName':_0xdeb5('0xa'),'paranoid':![],'indexes':[{'fields':[_0xdeb5('0xb'),_0xdeb5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 41c4c44..7a29aa8 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 _0x9ab8=['where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw'];(function(_0x581e65,_0xf93ab5){var _0x13e900=function(_0x5ca874){while(--_0x5ca874){_0x581e65['push'](_0x581e65['shift']());}};_0x13e900(++_0xf93ab5);}(_0x9ab8,0x1d8));var _0x89ab=function(_0x39beec,_0x3bad19){_0x39beec=_0x39beec-0x0;var _0x5668c7=_0x9ab8[_0x39beec];return _0x5668c7;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require(_0x89ab('0x3'));var rs=require(_0x89ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x89ab('0x5'))['db'];var utils=require(_0x89ab('0x6'));var logger=require(_0x89ab('0x7'))('rpc');var config=require(_0x89ab('0x8'));var jayson=require(_0x89ab('0x9'));var client=jayson[_0x89ab('0xa')][_0x89ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9a0335,_0x1f23ba,_0x29e6a3){return new BPromise(function(_0x120fe0,_0xd3db0c){return client[_0x89ab('0xc')](_0x9a0335,_0x29e6a3)[_0x89ab('0xd')](function(_0x349112){logger[_0x89ab('0xe')](_0x89ab('0xf'),_0x1f23ba,'request\x20sent');logger['debug'](_0x89ab('0x10'),_0x1f23ba,_0x89ab('0x11'),JSON[_0x89ab('0x12')](_0x349112));if(_0x349112['error']){if(_0x349112[_0x89ab('0x13')][_0x89ab('0x14')]===0x1f4){logger['error'](_0x89ab('0xf'),_0x1f23ba,_0x349112['error'][_0x89ab('0x15')]);return _0xd3db0c(_0x349112['error'][_0x89ab('0x15')]);}logger[_0x89ab('0x13')](_0x89ab('0xf'),_0x1f23ba,_0x349112[_0x89ab('0x13')][_0x89ab('0x15')]);return _0x120fe0(_0x349112[_0x89ab('0x13')]['message']);}else{logger[_0x89ab('0xe')](_0x89ab('0xf'),_0x1f23ba,_0x89ab('0x11'));_0x120fe0(_0x349112[_0x89ab('0x16')][_0x89ab('0x15')]);}})[_0x89ab('0x17')](function(_0x1d0cb5){logger[_0x89ab('0x13')](_0x89ab('0xf'),_0x1f23ba,_0x1d0cb5);_0xd3db0c(_0x1d0cb5);});});}exports['CreateVoiceAgentReport']=function(_0x41a36e){var _0x185ffa=this;return new Promise(function(_0x16f492,_0xf361e0){return db[_0x89ab('0x18')][_0x89ab('0x19')](_0x41a36e[_0x89ab('0x1a')],{'raw':_0x41a36e[_0x89ab('0x1b')]?_0x41a36e[_0x89ab('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x89ab('0xd')](function(_0x3ab147){logger['info'](_0x89ab('0x1c'),_0x41a36e);logger['debug']('CreateVoiceAgentReport',_0x41a36e,JSON[_0x89ab('0x12')](_0x3ab147));_0x16f492(_0x3ab147);})[_0x89ab('0x17')](function(_0x31a997){logger[_0x89ab('0x13')](_0x89ab('0x1c'),_0x31a997[_0x89ab('0x15')],_0x41a36e);_0xf361e0(_0x185ffa[_0x89ab('0x13')](0x1f4,_0x31a997[_0x89ab('0x15')]));});});};exports[_0x89ab('0x1d')]=function(_0x3073cf){var _0x7b01c7=this;return new Promise(function(_0xd694fd,_0x18d64f){return db[_0x89ab('0x18')][_0x89ab('0x1e')](_0x3073cf[_0x89ab('0x1a')],{'raw':_0x3073cf['options']?_0x3073cf['options'][_0x89ab('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3073cf[_0x89ab('0x1b')]?_0x3073cf['options'][_0x89ab('0x20')]||null:null,'attributes':_0x3073cf[_0x89ab('0x1b')]?_0x3073cf[_0x89ab('0x1b')][_0x89ab('0x21')]||null:null,'limit':_0x3073cf['options']?_0x3073cf['options'][_0x89ab('0x22')]||null:null})[_0x89ab('0xd')](function(_0x531af4){logger['info'](_0x89ab('0x1d'),_0x3073cf);logger[_0x89ab('0x23')](_0x89ab('0x1d'),_0x3073cf,JSON[_0x89ab('0x12')](_0x531af4));_0xd694fd(_0x531af4);})[_0x89ab('0x17')](function(_0x146822){logger[_0x89ab('0x13')]('UpdateVoiceAgentReport',_0x146822[_0x89ab('0x15')],_0x3073cf);_0x18d64f(_0x7b01c7[_0x89ab('0x13')](0x1f4,_0x146822[_0x89ab('0x15')]));});});}; \ No newline at end of file +var _0xf645=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','VoiceAgentReport','create','body','options','raw','then','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','attributes','lodash','moment'];(function(_0x319bd6,_0x17d8cf){var _0x4a01fb=function(_0x1e7fd8){while(--_0x1e7fd8){_0x319bd6['push'](_0x319bd6['shift']());}};_0x4a01fb(++_0x17d8cf);}(_0xf645,0xfe));var _0x5f64=function(_0x2c17c7,_0x171f6a){_0x2c17c7=_0x2c17c7-0x0;var _0x2c0cda=_0xf645[_0x2c17c7];return _0x2c0cda;};'use strict';var _=require(_0x5f64('0x0'));var util=require('util');var moment=require(_0x5f64('0x1'));var BPromise=require(_0x5f64('0x2'));var rs=require(_0x5f64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f64('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f64('0x5'))(_0x5f64('0x6'));var config=require(_0x5f64('0x7'));var jayson=require(_0x5f64('0x8'));var client=jayson[_0x5f64('0x9')][_0x5f64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d0bbf,_0x1adb61,_0x382bf2){return new BPromise(function(_0x1a0d67,_0x1171af){return client[_0x5f64('0xb')](_0x5d0bbf,_0x382bf2)['then'](function(_0x2cde85){logger[_0x5f64('0xc')](_0x5f64('0xd'),_0x1adb61,'request\x20sent');logger[_0x5f64('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1adb61,_0x5f64('0xf'),JSON[_0x5f64('0x10')](_0x2cde85));if(_0x2cde85[_0x5f64('0x11')]){if(_0x2cde85['error'][_0x5f64('0x12')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x1adb61,_0x2cde85[_0x5f64('0x11')][_0x5f64('0x13')]);return _0x1171af(_0x2cde85[_0x5f64('0x11')][_0x5f64('0x13')]);}logger[_0x5f64('0x11')](_0x5f64('0xd'),_0x1adb61,_0x2cde85[_0x5f64('0x11')][_0x5f64('0x13')]);return _0x1a0d67(_0x2cde85['error'][_0x5f64('0x13')]);}else{logger[_0x5f64('0xc')](_0x5f64('0xd'),_0x1adb61,_0x5f64('0xf'));_0x1a0d67(_0x2cde85[_0x5f64('0x14')]['message']);}})[_0x5f64('0x15')](function(_0x130fdc){logger[_0x5f64('0x11')](_0x5f64('0xd'),_0x1adb61,_0x130fdc);_0x1171af(_0x130fdc);});});}exports['CreateVoiceAgentReport']=function(_0x41b530){var _0x7589e6=this;return new Promise(function(_0x3f9c28,_0x3e79d0){return db[_0x5f64('0x16')][_0x5f64('0x17')](_0x41b530[_0x5f64('0x18')],{'raw':_0x41b530[_0x5f64('0x19')]?_0x41b530['options'][_0x5f64('0x1a')]===undefined?!![]:![]:!![]})[_0x5f64('0x1b')](function(_0x14bb75){logger[_0x5f64('0xc')](_0x5f64('0x1c'),_0x41b530);logger[_0x5f64('0xe')](_0x5f64('0x1c'),_0x41b530,JSON[_0x5f64('0x10')](_0x14bb75));_0x3f9c28(_0x14bb75);})[_0x5f64('0x15')](function(_0x1a6de8){logger[_0x5f64('0x11')](_0x5f64('0x1c'),_0x1a6de8[_0x5f64('0x13')],_0x41b530);_0x3e79d0(_0x7589e6[_0x5f64('0x11')](0x1f4,_0x1a6de8[_0x5f64('0x13')]));});});};exports[_0x5f64('0x1d')]=function(_0x28ca15){var _0x2d7788=this;return new Promise(function(_0x2d32ad,_0x58808d){return db['VoiceAgentReport'][_0x5f64('0x1e')](_0x28ca15[_0x5f64('0x18')],{'raw':_0x28ca15[_0x5f64('0x19')]?_0x28ca15['options'][_0x5f64('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28ca15[_0x5f64('0x19')]?_0x28ca15['options']['where']||null:null,'attributes':_0x28ca15['options']?_0x28ca15['options'][_0x5f64('0x1f')]||null:null,'limit':_0x28ca15[_0x5f64('0x19')]?_0x28ca15['options']['limit']||null:null})[_0x5f64('0x1b')](function(_0x216b09){logger['info'](_0x5f64('0x1d'),_0x28ca15);logger[_0x5f64('0xe')](_0x5f64('0x1d'),_0x28ca15,JSON[_0x5f64('0x10')](_0x216b09));_0x2d32ad(_0x216b09);})['catch'](function(_0x8e23d9){logger[_0x5f64('0x11')]('UpdateVoiceAgentReport',_0x8e23d9[_0x5f64('0x13')],_0x28ca15);_0x58808d(_0x2d7788[_0x5f64('0x11')](0x1f4,_0x8e23d9[_0x5f64('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 9d3d238..1a6c93e 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 _0xdb94=['/describe','/:id','show','post','create','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','isAuthenticated','index','get'];(function(_0x34ca95,_0x353ed0){var _0x1572cd=function(_0x39c998){while(--_0x39c998){_0x34ca95['push'](_0x34ca95['shift']());}};_0x1572cd(++_0x353ed0);}(_0xdb94,0xe5));var _0x4db9=function(_0x44a2e6,_0x294394){_0x44a2e6=_0x44a2e6-0x0;var _0x2cbd04=_0xdb94[_0x44a2e6];return _0x2cbd04;};'use strict';var multer=require('multer');var util=require(_0x4db9('0x0'));var path=require(_0x4db9('0x1'));var timeout=require('connect-timeout');var express=require(_0x4db9('0x2'));var router=express[_0x4db9('0x3')]();var fs_extra=require(_0x4db9('0x4'));var auth=require(_0x4db9('0x5'));var interaction=require(_0x4db9('0x6'));var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth[_0x4db9('0x8')](),controller[_0x4db9('0x9')]);router[_0x4db9('0xa')](_0x4db9('0xb'),auth[_0x4db9('0x8')](),controller['describe']);router[_0x4db9('0xa')](_0x4db9('0xc'),auth[_0x4db9('0x8')](),controller[_0x4db9('0xd')]);router[_0x4db9('0xe')]('/',auth['isAuthenticated'](),controller[_0x4db9('0xf')]);router[_0x4db9('0x10')](_0x4db9('0xc'),auth[_0x4db9('0x8')](),controller[_0x4db9('0x11')]);router[_0x4db9('0x12')]('/:id',auth[_0x4db9('0x8')](),controller[_0x4db9('0x13')]);module['exports']=router; \ No newline at end of file +var _0xca9e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xca9e,0x136));var _0xeca9=function(_0x5e5c44,_0x595e3b){_0x5e5c44=_0x5e5c44-0x0;var _0x38ad1f=_0xca9e[_0x5e5c44];return _0x38ad1f;};'use strict';var multer=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var path=require(_0xeca9('0x2'));var timeout=require(_0xeca9('0x3'));var express=require(_0xeca9('0x4'));var router=express[_0xeca9('0x5')]();var fs_extra=require(_0xeca9('0x6'));var auth=require(_0xeca9('0x7'));var interaction=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var controller=require(_0xeca9('0xa'));router[_0xeca9('0xb')]('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0xd')]);router['get'](_0xeca9('0xe'),auth[_0xeca9('0xc')](),controller['describe']);router['get'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x10')]);router['post']('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0x11')]);router[_0xeca9('0x12')](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x13')]);router['delete'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller['destroy']);module[_0xeca9('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 153c24b..a217f19 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 _0xf7d2=['INTEGER','sequelize','exports','STRING','inbound','internal','dialer','DATE'];(function(_0x1b0cc8,_0x6e3392){var _0x441d1a=function(_0x248cef){while(--_0x248cef){_0x1b0cc8['push'](_0x1b0cc8['shift']());}};_0x441d1a(++_0x6e3392);}(_0xf7d2,0x149));var _0x2f7d=function(_0x361d2b,_0x378b12){_0x361d2b=_0x361d2b-0x0;var _0x4690c5=_0xf7d2[_0x361d2b];return _0x4690c5;};'use strict';var Sequelize=require(_0x2f7d('0x0'));module[_0x2f7d('0x1')]={'uniqueid':{'type':Sequelize[_0x2f7d('0x2')]},'type':{'type':Sequelize['ENUM'](_0x2f7d('0x3'),_0x2f7d('0x4'),'outbound','inbound-fax','outbound-fax',_0x2f7d('0x5'))},'tag':{'type':Sequelize[_0x2f7d('0x2')]},'accountcode':{'type':Sequelize[_0x2f7d('0x2')]},'source':{'type':Sequelize[_0x2f7d('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x2f7d('0x2')]},'callerid':{'type':Sequelize[_0x2f7d('0x2')]},'channel':{'type':Sequelize[_0x2f7d('0x2')]},'destinationchannel':{'type':Sequelize[_0x2f7d('0x2')]},'lastapplication':{'type':Sequelize[_0x2f7d('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x2f7d('0x6')]},'answertime':{'type':Sequelize[_0x2f7d('0x6')]},'endtime':{'type':Sequelize[_0x2f7d('0x6')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x2f7d('0x7')]},'mohtime':{'type':Sequelize[_0x2f7d('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2f7d('0x2')]},'amaflags':{'type':Sequelize[_0x2f7d('0x2')]},'userfield':{'type':Sequelize[_0x2f7d('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x2f7d('0x2')]},'note':{'type':Sequelize[_0x2f7d('0x2')]},'prefix':{'type':Sequelize[_0x2f7d('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc7da=['DATE','INTEGER','sequelize','exports','STRING','inbound','internal','inbound-fax','outbound-fax','TEXT'];(function(_0x2b2a02,_0x581f53){var _0x1b4b08=function(_0x134472){while(--_0x134472){_0x2b2a02['push'](_0x2b2a02['shift']());}};_0x1b4b08(++_0x581f53);}(_0xc7da,0xf2));var _0xac7d=function(_0x38a95e,_0x526fd8){_0x38a95e=_0x38a95e-0x0;var _0x5e4d7a=_0xc7da[_0x38a95e];return _0x5e4d7a;};'use strict';var Sequelize=require(_0xac7d('0x0'));module[_0xac7d('0x1')]={'uniqueid':{'type':Sequelize[_0xac7d('0x2')]},'type':{'type':Sequelize['ENUM'](_0xac7d('0x3'),_0xac7d('0x4'),'outbound',_0xac7d('0x5'),_0xac7d('0x6'),'dialer')},'tag':{'type':Sequelize[_0xac7d('0x2')]},'accountcode':{'type':Sequelize[_0xac7d('0x2')]},'source':{'type':Sequelize[_0xac7d('0x2')]},'destination':{'type':Sequelize[_0xac7d('0x2')]},'destinationcontext':{'type':Sequelize[_0xac7d('0x2')]},'callerid':{'type':Sequelize[_0xac7d('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xac7d('0x2')]},'lastapplication':{'type':Sequelize[_0xac7d('0x2')]},'lastdata':{'type':Sequelize[_0xac7d('0x7')]},'starttime':{'type':Sequelize[_0xac7d('0x8')]},'systemanswertime':{'type':Sequelize[_0xac7d('0x8')]},'answertime':{'type':Sequelize[_0xac7d('0x8')]},'endtime':{'type':Sequelize[_0xac7d('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xac7d('0x9')]},'mohtime':{'type':Sequelize[_0xac7d('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xac7d('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xac7d('0x2')]},'userDisposition':{'type':Sequelize[_0xac7d('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xac7d('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xac7d('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xac7d('0x2')]},'routeid':{'type':Sequelize[_0xac7d('0x9')]},'sipcallid':{'type':Sequelize[_0xac7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8857d62..b36db59 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x5f2f,0x73));var _0xf5f2=function(_0x14435f,_0x2df842){_0x14435f=_0x14435f-0x0;var _0x56a8e8=_0x5f2f[_0x14435f];return _0x56a8e8;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x4cca08,_0x210a3a){var _0x364a19=function(_0x394fc1){while(--_0x394fc1){_0x4cca08['push'](_0x4cca08['shift']());}};_0x364a19(++_0x210a3a);}(_0xdb28,0x106));var _0x8db2=function(_0xdd539e,_0x5f5aca){_0xdd539e=_0xdd539e-0x0;var _0x5e268e=_0xdb28[_0xdd539e];return _0x5e268e;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index adf2d90..1f5d83c 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 _0x260b=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x260b,0x1e8));var _0xb260=function(_0x2ed3c3,_0x16c01a){_0x2ed3c3=_0x2ed3c3-0x0;var _0x492de1=_0x260b[_0x2ed3c3];return _0x492de1;};'use strict';var _=require(_0xb260('0x0'));var util=require(_0xb260('0x1'));var logger=require('../../config/logger')(_0xb260('0x2'));var moment=require(_0xb260('0x3'));var BPromise=require(_0xb260('0x4'));var rp=require(_0xb260('0x5'));var fs=require('fs');var path=require(_0xb260('0x6'));var rimraf=require(_0xb260('0x7'));var config=require(_0xb260('0x8'));var attributes=require(_0xb260('0x9'));module[_0xb260('0xa')]=function(_0x281b5a,_0x51fb6a){return _0x281b5a['define']('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xacdd=['api','moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','../../config/logger'];(function(_0x46515e,_0x37e24b){var _0x50090b=function(_0x42c732){while(--_0x42c732){_0x46515e['push'](_0x46515e['shift']());}};_0x50090b(++_0x37e24b);}(_0xacdd,0xc1));var _0xdacd=function(_0x31c479,_0x303887){_0x31c479=_0x31c479-0x0;var _0x3562b2=_0xacdd[_0x31c479];return _0x3562b2;};'use strict';var _=require(_0xdacd('0x0'));var util=require('util');var logger=require(_0xdacd('0x1'))(_0xdacd('0x2'));var moment=require(_0xdacd('0x3'));var BPromise=require(_0xdacd('0x4'));var rp=require(_0xdacd('0x5'));var fs=require('fs');var path=require(_0xdacd('0x6'));var rimraf=require('rimraf');var config=require(_0xdacd('0x7'));var attributes=require(_0xdacd('0x8'));module[_0xdacd('0x9')]=function(_0x19ec8f,_0x52e21b){return _0x19ec8f[_0xdacd('0xa')]('VoiceCallReport',attributes,{'tableName':_0xdacd('0xb'),'paranoid':![],'indexes':[{'fields':[_0xdacd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index f8d7454..ade7d08 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 _0xb0f1=['map','catch','create','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','model'];(function(_0x1ee098,_0x56e7b1){var _0x3f0da8=function(_0x188b82){while(--_0x188b82){_0x1ee098['push'](_0x1ee098['shift']());}};_0x3f0da8(++_0x56e7b1);}(_0xb0f1,0x14b));var _0x1b0f=function(_0x158a58,_0x28e8e7){_0x158a58=_0x158a58-0x0;var _0x4935d9=_0xb0f1[_0x158a58];return _0x4935d9;};'use strict';var _=require('lodash');var util=require(_0x1b0f('0x0'));var moment=require(_0x1b0f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b0f('0x2'));var db=require(_0x1b0f('0x3'))['db'];var utils=require(_0x1b0f('0x4'));var logger=require(_0x1b0f('0x5'))(_0x1b0f('0x6'));var config=require(_0x1b0f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b0f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b2575,_0x16230b,_0xe3a70a){return new BPromise(function(_0x1705db,_0x3e31db){return client['request'](_0x4b2575,_0xe3a70a)[_0x1b0f('0x9')](function(_0x14fbaa){logger[_0x1b0f('0xa')](_0x1b0f('0xb'),_0x16230b,_0x1b0f('0xc'));logger[_0x1b0f('0xd')](_0x1b0f('0xe'),_0x16230b,_0x1b0f('0xc'),JSON[_0x1b0f('0xf')](_0x14fbaa));if(_0x14fbaa[_0x1b0f('0x10')]){if(_0x14fbaa['error'][_0x1b0f('0x11')]===0x1f4){logger[_0x1b0f('0x10')](_0x1b0f('0xb'),_0x16230b,_0x14fbaa[_0x1b0f('0x10')][_0x1b0f('0x12')]);return _0x3e31db(_0x14fbaa['error'][_0x1b0f('0x12')]);}logger[_0x1b0f('0x10')](_0x1b0f('0xb'),_0x16230b,_0x14fbaa[_0x1b0f('0x10')][_0x1b0f('0x12')]);return _0x1705db(_0x14fbaa['error'][_0x1b0f('0x12')]);}else{logger[_0x1b0f('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x16230b,_0x1b0f('0xc'));_0x1705db(_0x14fbaa[_0x1b0f('0x13')][_0x1b0f('0x12')]);}})['catch'](function(_0x5b9ebc){logger[_0x1b0f('0x10')](_0x1b0f('0xb'),_0x16230b,_0x5b9ebc);_0x3e31db(_0x5b9ebc);});});}exports[_0x1b0f('0x14')]=function(_0x5d4fd0){var _0x4f3648=this;return new Promise(function(_0x3c52eb,_0xb85577){return db[_0x1b0f('0x15')][_0x1b0f('0x16')]({'raw':_0x5d4fd0[_0x1b0f('0x17')]?_0x5d4fd0[_0x1b0f('0x17')][_0x1b0f('0x18')]===undefined?!![]:![]:!![],'where':_0x5d4fd0[_0x1b0f('0x17')]?_0x5d4fd0['options'][_0x1b0f('0x19')]||null:null,'attributes':_0x5d4fd0[_0x1b0f('0x17')]?_0x5d4fd0['options'][_0x1b0f('0x1a')]||null:null,'limit':_0x5d4fd0[_0x1b0f('0x17')]?_0x5d4fd0[_0x1b0f('0x17')]['limit']||null:null,'include':_0x5d4fd0[_0x1b0f('0x17')]?_0x5d4fd0[_0x1b0f('0x17')][_0x1b0f('0x1b')]?_['map'](_0x5d4fd0['options'][_0x1b0f('0x1b')],function(_0x526b12){return{'model':db[_0x526b12[_0x1b0f('0x1c')]],'as':_0x526b12['as'],'attributes':_0x526b12['attributes'],'include':_0x526b12[_0x1b0f('0x1b')]?_[_0x1b0f('0x1d')](_0x526b12[_0x1b0f('0x1b')],function(_0x5cf242){return{'model':db[_0x5cf242[_0x1b0f('0x1c')]],'as':_0x5cf242['as'],'attributes':_0x5cf242[_0x1b0f('0x1a')],'include':_0x5cf242[_0x1b0f('0x1b')]?_[_0x1b0f('0x1d')](_0x5cf242[_0x1b0f('0x1b')],function(_0x3da322){return{'model':db[_0x3da322[_0x1b0f('0x1c')]],'as':_0x3da322['as'],'attributes':_0x3da322[_0x1b0f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1b0f('0x9')](function(_0xe3b34e){logger[_0x1b0f('0xa')](_0x1b0f('0x14'),_0x5d4fd0);logger[_0x1b0f('0xd')](_0x1b0f('0x14'),_0x5d4fd0,JSON[_0x1b0f('0xf')](_0xe3b34e));_0x3c52eb(_0xe3b34e);})[_0x1b0f('0x1e')](function(_0x220265){logger[_0x1b0f('0x10')]('GetVoiceCallReport',_0x220265[_0x1b0f('0x12')],_0x5d4fd0);_0xb85577(_0x4f3648[_0x1b0f('0x10')](0x1f4,_0x220265['message']));});});};exports['CreateVoiceCallReport']=function(_0xed51db){var _0x319d95=this;return new Promise(function(_0x2a3ded,_0x36ad9b){return db[_0x1b0f('0x15')][_0x1b0f('0x1f')](_0xed51db[_0x1b0f('0x20')],{'raw':_0xed51db[_0x1b0f('0x17')]?_0xed51db[_0x1b0f('0x17')][_0x1b0f('0x18')]===undefined?!![]:![]:!![]})[_0x1b0f('0x9')](function(_0x1737ae){logger[_0x1b0f('0xa')]('CreateVoiceCallReport',_0xed51db);logger[_0x1b0f('0xd')](_0x1b0f('0x21'),_0xed51db,JSON['stringify'](_0x1737ae));_0x2a3ded(_0x1737ae);})['catch'](function(_0x1b7108){logger[_0x1b0f('0x10')](_0x1b0f('0x21'),_0x1b7108['message'],_0xed51db);_0x36ad9b(_0x319d95[_0x1b0f('0x10')](0x1f4,_0x1b7108['message']));});});};exports['UpdateVoiceCallReport']=function(_0x22da16){var _0x32ddc6=this;return new Promise(function(_0xb0989f,_0x4d3afe){return db[_0x1b0f('0x15')][_0x1b0f('0x22')](_0x22da16[_0x1b0f('0x20')],{'raw':_0x22da16[_0x1b0f('0x17')]?_0x22da16['options'][_0x1b0f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22da16[_0x1b0f('0x17')]?_0x22da16['options'][_0x1b0f('0x19')]||null:null,'attributes':_0x22da16[_0x1b0f('0x17')]?_0x22da16[_0x1b0f('0x17')]['attributes']||null:null,'limit':_0x22da16['options']?_0x22da16[_0x1b0f('0x17')]['limit']||null:null})[_0x1b0f('0x9')](function(_0x4de710){logger[_0x1b0f('0xa')]('UpdateVoiceCallReport',_0x22da16);logger['debug'](_0x1b0f('0x23'),_0x22da16,JSON[_0x1b0f('0xf')](_0x4de710));_0xb0989f(_0x4de710);})['catch'](function(_0x1a8999){logger[_0x1b0f('0x10')](_0x1b0f('0x23'),_0x1a8999['message'],_0x22da16);_0x4d3afe(_0x32ddc6[_0x1b0f('0x10')](0x1f4,_0x1a8999[_0x1b0f('0x12')]));});});}; \ No newline at end of file +var _0x20d8=['GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20d8,0xbe));var _0x820d=function(_0x1cf3b3,_0x1d5d50){_0x1cf3b3=_0x1cf3b3-0x0;var _0x2daba7=_0x20d8[_0x1cf3b3];return _0x2daba7;};'use strict';var _=require('lodash');var util=require(_0x820d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x820d('0x1'));var fs=require('fs');var Redis=require(_0x820d('0x2'));var db=require(_0x820d('0x3'))['db'];var utils=require(_0x820d('0x4'));var logger=require(_0x820d('0x5'))('rpc');var config=require(_0x820d('0x6'));var jayson=require(_0x820d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b7f1e,_0x24632d,_0x1d0990){return new BPromise(function(_0x23ec72,_0x4d3b1c){return client[_0x820d('0x8')](_0x3b7f1e,_0x1d0990)[_0x820d('0x9')](function(_0x31d836){logger[_0x820d('0xa')](_0x820d('0xb'),_0x24632d,_0x820d('0xc'));logger[_0x820d('0xd')](_0x820d('0xe'),_0x24632d,'request\x20sent',JSON['stringify'](_0x31d836));if(_0x31d836['error']){if(_0x31d836[_0x820d('0xf')][_0x820d('0x10')]===0x1f4){logger[_0x820d('0xf')](_0x820d('0xb'),_0x24632d,_0x31d836[_0x820d('0xf')][_0x820d('0x11')]);return _0x4d3b1c(_0x31d836[_0x820d('0xf')][_0x820d('0x11')]);}logger[_0x820d('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x24632d,_0x31d836[_0x820d('0xf')][_0x820d('0x11')]);return _0x23ec72(_0x31d836[_0x820d('0xf')][_0x820d('0x11')]);}else{logger[_0x820d('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x24632d,_0x820d('0xc'));_0x23ec72(_0x31d836[_0x820d('0x12')][_0x820d('0x11')]);}})[_0x820d('0x13')](function(_0x237983){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x24632d,_0x237983);_0x4d3b1c(_0x237983);});});}exports[_0x820d('0x14')]=function(_0x283d98){var _0x22d3dd=this;return new Promise(function(_0x40d220,_0x2c50dc){return db[_0x820d('0x15')][_0x820d('0x16')]({'raw':_0x283d98[_0x820d('0x17')]?_0x283d98[_0x820d('0x17')][_0x820d('0x18')]===undefined?!![]:![]:!![],'where':_0x283d98[_0x820d('0x17')]?_0x283d98[_0x820d('0x17')][_0x820d('0x19')]||null:null,'attributes':_0x283d98[_0x820d('0x17')]?_0x283d98[_0x820d('0x17')][_0x820d('0x1a')]||null:null,'limit':_0x283d98[_0x820d('0x17')]?_0x283d98[_0x820d('0x17')][_0x820d('0x1b')]||null:null,'include':_0x283d98[_0x820d('0x17')]?_0x283d98[_0x820d('0x17')][_0x820d('0x1c')]?_[_0x820d('0x1d')](_0x283d98[_0x820d('0x17')]['include'],function(_0x15ea83){return{'model':db[_0x15ea83[_0x820d('0x1e')]],'as':_0x15ea83['as'],'attributes':_0x15ea83[_0x820d('0x1a')],'include':_0x15ea83[_0x820d('0x1c')]?_['map'](_0x15ea83['include'],function(_0x5c7195){return{'model':db[_0x5c7195[_0x820d('0x1e')]],'as':_0x5c7195['as'],'attributes':_0x5c7195[_0x820d('0x1a')],'include':_0x5c7195[_0x820d('0x1c')]?_['map'](_0x5c7195[_0x820d('0x1c')],function(_0xc6399c){return{'model':db[_0xc6399c['model']],'as':_0xc6399c['as'],'attributes':_0xc6399c['attributes']};}):[]};}):[]};}):[]:[]})[_0x820d('0x9')](function(_0x415d72){logger[_0x820d('0xa')](_0x820d('0x14'),_0x283d98);logger[_0x820d('0xd')](_0x820d('0x14'),_0x283d98,JSON['stringify'](_0x415d72));_0x40d220(_0x415d72);})[_0x820d('0x13')](function(_0x4c901a){logger[_0x820d('0xf')](_0x820d('0x14'),_0x4c901a['message'],_0x283d98);_0x2c50dc(_0x22d3dd[_0x820d('0xf')](0x1f4,_0x4c901a['message']));});});};exports[_0x820d('0x1f')]=function(_0xf2cf97){var _0x30a418=this;return new Promise(function(_0x9c8a7b,_0x27ec46){return db[_0x820d('0x15')][_0x820d('0x20')](_0xf2cf97[_0x820d('0x21')],{'raw':_0xf2cf97['options']?_0xf2cf97[_0x820d('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x820d('0x9')](function(_0x54140c){logger[_0x820d('0xa')]('CreateVoiceCallReport',_0xf2cf97);logger[_0x820d('0xd')](_0x820d('0x1f'),_0xf2cf97,JSON['stringify'](_0x54140c));_0x9c8a7b(_0x54140c);})[_0x820d('0x13')](function(_0x4b84e3){logger[_0x820d('0xf')](_0x820d('0x1f'),_0x4b84e3[_0x820d('0x11')],_0xf2cf97);_0x27ec46(_0x30a418[_0x820d('0xf')](0x1f4,_0x4b84e3[_0x820d('0x11')]));});});};exports[_0x820d('0x22')]=function(_0x45b154){var _0x13188d=this;return new Promise(function(_0x5c852f,_0x3c4794){return db[_0x820d('0x15')]['update'](_0x45b154['body'],{'raw':_0x45b154['options']?_0x45b154['options'][_0x820d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45b154[_0x820d('0x17')]?_0x45b154[_0x820d('0x17')][_0x820d('0x19')]||null:null,'attributes':_0x45b154['options']?_0x45b154[_0x820d('0x17')][_0x820d('0x1a')]||null:null,'limit':_0x45b154['options']?_0x45b154['options'][_0x820d('0x1b')]||null:null})[_0x820d('0x9')](function(_0x44dc94){logger[_0x820d('0xa')](_0x820d('0x22'),_0x45b154);logger[_0x820d('0xd')](_0x820d('0x22'),_0x45b154,JSON['stringify'](_0x44dc94));_0x5c852f(_0x44dc94);})[_0x820d('0x13')](function(_0x2bfd73){logger[_0x820d('0xf')]('UpdateVoiceCallReport',_0x2bfd73[_0x820d('0x11')],_0x45b154);_0x3c4794(_0x13188d['error'](0x1f4,_0x2bfd73[_0x820d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 67ecc72..b0bf728 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 _0x2f62=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x575062,_0x52c38b){var _0x5ed424=function(_0x45fea4){while(--_0x45fea4){_0x575062['push'](_0x575062['shift']());}};_0x5ed424(++_0x52c38b);}(_0x2f62,0x182));var _0x22f6=function(_0x4839f4,_0xc5b0e4){_0x4839f4=_0x4839f4-0x0;var _0x1608d8=_0x2f62[_0x4839f4];return _0x1608d8;};'use strict';var multer=require(_0x22f6('0x0'));var util=require(_0x22f6('0x1'));var path=require(_0x22f6('0x2'));var timeout=require(_0x22f6('0x3'));var express=require(_0x22f6('0x4'));var router=express[_0x22f6('0x5')]();var fs_extra=require(_0x22f6('0x6'));var auth=require(_0x22f6('0x7'));var interaction=require(_0x22f6('0x8'));var config=require(_0x22f6('0x9'));var controller=require(_0x22f6('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x22f6('0xb')]);router[_0x22f6('0xc')](_0x22f6('0xd'),auth[_0x22f6('0xe')](),controller[_0x22f6('0xf')]);router[_0x22f6('0x10')]('/',auth[_0x22f6('0xe')](),controller[_0x22f6('0x11')]);router[_0x22f6('0x12')](_0x22f6('0xd'),auth[_0x22f6('0xe')](),controller[_0x22f6('0x13')]);router[_0x22f6('0x14')]('/:id',auth[_0x22f6('0xe')](),controller[_0x22f6('0x15')]);module[_0x22f6('0x16')]=router; \ No newline at end of file +var _0x299e=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','./voiceChanSpy.controller'];(function(_0x15449d,_0x537b1d){var _0x55cf8c=function(_0x4fc014){while(--_0x4fc014){_0x15449d['push'](_0x15449d['shift']());}};_0x55cf8c(++_0x537b1d);}(_0x299e,0x1e7));var _0xe299=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x299e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xe299('0x0'));var path=require(_0xe299('0x1'));var timeout=require(_0xe299('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe299('0x3'));var auth=require(_0xe299('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe299('0x5'));router['get']('/',auth[_0xe299('0x6')](),controller[_0xe299('0x7')]);router['get'](_0xe299('0x8'),auth[_0xe299('0x6')](),controller[_0xe299('0x9')]);router[_0xe299('0xa')]('/',auth[_0xe299('0x6')](),controller[_0xe299('0xb')]);router[_0xe299('0xc')](_0xe299('0x8'),auth[_0xe299('0x6')](),controller[_0xe299('0xd')]);router[_0xe299('0xe')](_0xe299('0x8'),auth['isAuthenticated'](),controller[_0xe299('0xf')]);module[_0xe299('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 56f8c18..733f799 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 _0x311d=['exports','STRING','name','options','getDataValue','BOOLEAN','sequelize'];(function(_0x4dcce8,_0x1d584d){var _0x16673a=function(_0x4865b1){while(--_0x4865b1){_0x4dcce8['push'](_0x4dcce8['shift']());}};_0x16673a(++_0x1d584d);}(_0x311d,0x8b));var _0xd311=function(_0x514ba6,_0x96eaf2){_0x514ba6=_0x514ba6-0x0;var _0x191c1e=_0x311d[_0x514ba6];return _0x191c1e;};'use strict';var Sequelize=require(_0xd311('0x0'));module[_0xd311('0x1')]={'name':{'type':Sequelize[_0xd311('0x2')]},'prefix':{'type':Sequelize[_0xd311('0x2')],'unique':_0xd311('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1652b3){this['setDataValue'](_0xd311('0x4'),_0x1652b3?_0x1652b3['join'](''):[]);},'get':function(){return this[_0xd311('0x5')](_0xd311('0x4'))?this[_0xd311('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0xd311('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd311('0x2')]},'description':{'type':Sequelize[_0xd311('0x2')]}}; \ No newline at end of file +var _0xb78c=['name','setDataValue','join','getDataValue','options','split','BOOLEAN','exports','STRING'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb78c,0x1c0));var _0xcb78=function(_0x38616d,_0x22fbe5){_0x38616d=_0x38616d-0x0;var _0x505626=_0xb78c[_0x38616d];return _0x505626;};'use strict';var Sequelize=require('sequelize');module[_0xcb78('0x0')]={'name':{'type':Sequelize[_0xcb78('0x1')]},'prefix':{'type':Sequelize[_0xcb78('0x1')],'unique':_0xcb78('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xcb78('0x1')],'set':function(_0x1eaf46){this[_0xcb78('0x3')]('options',_0x1eaf46?_0x1eaf46[_0xcb78('0x4')](''):[]);},'get':function(){return this[_0xcb78('0x5')](_0xcb78('0x6'))?this[_0xcb78('0x5')](_0xcb78('0x6'))[_0xcb78('0x7')](''):[];}},'auth':{'type':Sequelize[_0xcb78('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xcb78('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcb78('0x1')]},'description':{'type':Sequelize[_0xcb78('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 28ad897..72c3a45 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 _0xde13=['mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','ChanSpies','UserProfileResource','error','stack','name','send','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','params','include','options','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x20b1b2,_0x3b3404){var _0x2c72f1=function(_0x395209){while(--_0x395209){_0x20b1b2['push'](_0x20b1b2['shift']());}};_0x2c72f1(++_0x3b3404);}(_0xde13,0x146));var _0x3de1=function(_0x342ee3,_0x259044){_0x342ee3=_0x342ee3-0x0;var _0x2e274d=_0xde13[_0x342ee3];return _0x2e274d;};'use strict';var emlformat=require(_0x3de1('0x0'));var rimraf=require(_0x3de1('0x1'));var zipdir=require(_0x3de1('0x2'));var jsonpatch=require(_0x3de1('0x3'));var rp=require(_0x3de1('0x4'));var moment=require('moment');var BPromise=require(_0x3de1('0x5'));var Mustache=require(_0x3de1('0x6'));var util=require(_0x3de1('0x7'));var path=require('path');var sox=require(_0x3de1('0x8'));var csv=require('to-csv');var ejs=require(_0x3de1('0x9'));var fs=require('fs');var fs_extra=require(_0x3de1('0xa'));var _=require(_0x3de1('0xb'));var squel=require(_0x3de1('0xc'));var crypto=require('crypto');var jsforce=require(_0x3de1('0xd'));var deskjs=require(_0x3de1('0xe'));var toCsv=require(_0x3de1('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3de1('0x10'));var qs=require(_0x3de1('0x11'));var as=require(_0x3de1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3de1('0x13'))(_0x3de1('0x14'));var utils=require(_0x3de1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3de1('0x16'))['db'];function respondWithStatusCode(_0x4afe3b,_0x585909){_0x585909=_0x585909||0xcc;return function(_0x5794ff){if(_0x5794ff){return _0x4afe3b[_0x3de1('0x17')](_0x585909);}return _0x4afe3b[_0x3de1('0x18')](_0x585909)[_0x3de1('0x19')]();};}function respondWithResult(_0xa014a6,_0x5e4c56){_0x5e4c56=_0x5e4c56||0xc8;return function(_0x3405f9){if(_0x3405f9){return _0xa014a6['status'](_0x5e4c56)[_0x3de1('0x1a')](_0x3405f9);}};}function respondWithFilteredResult(_0x57ce0e,_0x48e218){return function(_0x14156f){if(_0x14156f){var _0x214f19=typeof _0x48e218['offset']===_0x3de1('0x1b')&&typeof _0x48e218[_0x3de1('0x1c')]===_0x3de1('0x1b');var _0x2cf3e1=_0x14156f[_0x3de1('0x1d')];var _0x510e5a=_0x214f19?0x0:_0x48e218[_0x3de1('0x1e')];var _0x5a10f2=_0x214f19?_0x14156f[_0x3de1('0x1d')]:_0x48e218[_0x3de1('0x1e')]+_0x48e218['limit'];var _0x3b5bcb;if(_0x5a10f2>=_0x2cf3e1){_0x5a10f2=_0x2cf3e1;_0x3b5bcb=0xc8;}else{_0x3b5bcb=0xce;}_0x57ce0e['status'](_0x3b5bcb);return _0x57ce0e[_0x3de1('0x1f')](_0x3de1('0x20'),_0x510e5a+'-'+_0x5a10f2+'/'+_0x2cf3e1)[_0x3de1('0x1a')](_0x14156f);}return null;};}function patchUpdates(_0x5635b5){return function(_0x2c4830){try{jsonpatch[_0x3de1('0x21')](_0x2c4830,_0x5635b5,!![]);}catch(_0x440a36){return BPromise['reject'](_0x440a36);}return _0x2c4830[_0x3de1('0x22')]();};}function saveUpdates(_0x2a4a31,_0x594bdb){return function(_0x4c0c1a){if(_0x4c0c1a){return _0x4c0c1a[_0x3de1('0x23')](_0x2a4a31)[_0x3de1('0x24')](function(_0x412c70){return _0x412c70;});}return null;};}function removeEntity(_0xcfe95c,_0x242ab0){return function(_0x4370f2){if(_0x4370f2){return _0x4370f2[_0x3de1('0x25')]()[_0x3de1('0x24')](function(){var _0x491b3d=_0x4370f2['get']({'plain':!![]});var _0x9873fa=_0x3de1('0x26');return db[_0x3de1('0x27')][_0x3de1('0x25')]({'where':{'type':_0x9873fa,'resourceId':_0x491b3d['id']}})[_0x3de1('0x24')](function(){return _0x4370f2;});})['then'](function(){_0xcfe95c[_0x3de1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59f14f,_0x3f4856){return function(_0xc6537a){if(!_0xc6537a){_0x59f14f[_0x3de1('0x17')](0x194);}return _0xc6537a;};}function handleError(_0x8d5da7,_0x359c68){_0x359c68=_0x359c68||0x1f4;return function(_0x149df5){logger[_0x3de1('0x28')](_0x149df5[_0x3de1('0x29')]);if(_0x149df5[_0x3de1('0x2a')]){delete _0x149df5[_0x3de1('0x2a')];}_0x8d5da7[_0x3de1('0x18')](_0x359c68)[_0x3de1('0x2b')](_0x149df5);};}exports['index']=function(_0x566804,_0x8a3054){var _0x4e0517={},_0x9c9ff5={},_0x33408c={'count':0x0,'rows':[]};var _0x17988e=_['map'](db[_0x3de1('0x2c')][_0x3de1('0x2d')],function(_0x3d038d){return{'name':_0x3d038d[_0x3de1('0x2e')],'type':_0x3d038d[_0x3de1('0x2f')][_0x3de1('0x30')]};});_0x9c9ff5[_0x3de1('0x31')]=_[_0x3de1('0x32')](_0x17988e,_0x3de1('0x2a'));_0x9c9ff5[_0x3de1('0x33')]=_[_0x3de1('0x34')](_0x566804[_0x3de1('0x33')]);_0x9c9ff5['filters']=_['intersection'](_0x9c9ff5['model'],_0x9c9ff5[_0x3de1('0x33')]);_0x4e0517[_0x3de1('0x35')]=_[_0x3de1('0x36')](_0x9c9ff5[_0x3de1('0x31')],qs['fields'](_0x566804['query'][_0x3de1('0x37')]));_0x4e0517['attributes']=_0x4e0517['attributes'][_0x3de1('0x38')]?_0x4e0517[_0x3de1('0x35')]:_0x9c9ff5['model'];if(!_0x566804[_0x3de1('0x33')][_0x3de1('0x39')](_0x3de1('0x3a'))){_0x4e0517[_0x3de1('0x1c')]=qs[_0x3de1('0x1c')](_0x566804['query'][_0x3de1('0x1c')]);_0x4e0517['offset']=qs[_0x3de1('0x1e')](_0x566804[_0x3de1('0x33')][_0x3de1('0x1e')]);}_0x4e0517[_0x3de1('0x3b')]=qs[_0x3de1('0x3c')](_0x566804[_0x3de1('0x33')][_0x3de1('0x3c')]);_0x4e0517[_0x3de1('0x3d')]=qs[_0x3de1('0x3e')](_['pick'](_0x566804[_0x3de1('0x33')],_0x9c9ff5['filters']),_0x17988e);if(_0x566804[_0x3de1('0x33')][_0x3de1('0x3f')]){_0x4e0517[_0x3de1('0x3d')]=_[_0x3de1('0x40')](_0x4e0517[_0x3de1('0x3d')],{'$or':_[_0x3de1('0x32')](_0x17988e,function(_0x363556){if(_0x363556['type']!==_0x3de1('0x41')){var _0x1001b0={};_0x1001b0[_0x363556[_0x3de1('0x2a')]]={'$like':'%'+_0x566804[_0x3de1('0x33')][_0x3de1('0x3f')]+'%'};return _0x1001b0;}})});}_0x4e0517=_[_0x3de1('0x40')]({},_0x4e0517,_0x566804['options']);var _0x200c41={'where':_0x4e0517[_0x3de1('0x3d')]};return db[_0x3de1('0x2c')][_0x3de1('0x1d')](_0x200c41)[_0x3de1('0x24')](function(_0x44d9c7){_0x33408c[_0x3de1('0x1d')]=_0x44d9c7;if(_0x566804[_0x3de1('0x33')][_0x3de1('0x42')]){_0x4e0517['include']=[{'all':!![]}];}return db[_0x3de1('0x2c')][_0x3de1('0x43')](_0x4e0517);})['then'](function(_0x573cbb){_0x33408c[_0x3de1('0x44')]=_0x573cbb;return _0x33408c;})[_0x3de1('0x24')](respondWithFilteredResult(_0x8a3054,_0x4e0517))['catch'](handleError(_0x8a3054,null));};exports['show']=function(_0x707bfc,_0x20dbbf){var _0x5ef4e9={'raw':![],'where':{'id':_0x707bfc[_0x3de1('0x45')]['id']}},_0xf5f212={};_0xf5f212[_0x3de1('0x31')]=_['keys'](db[_0x3de1('0x2c')][_0x3de1('0x2d')]);_0xf5f212[_0x3de1('0x33')]=_['keys'](_0x707bfc['query']);_0xf5f212[_0x3de1('0x3e')]=_[_0x3de1('0x36')](_0xf5f212['model'],_0xf5f212[_0x3de1('0x33')]);_0x5ef4e9[_0x3de1('0x35')]=_[_0x3de1('0x36')](_0xf5f212[_0x3de1('0x31')],qs[_0x3de1('0x37')](_0x707bfc[_0x3de1('0x33')][_0x3de1('0x37')]));_0x5ef4e9[_0x3de1('0x35')]=_0x5ef4e9['attributes'][_0x3de1('0x38')]?_0x5ef4e9[_0x3de1('0x35')]:_0xf5f212['model'];if(_0x707bfc['query'][_0x3de1('0x42')]){_0x5ef4e9[_0x3de1('0x46')]=[{'all':!![]}];}_0x5ef4e9=_[_0x3de1('0x40')]({},_0x5ef4e9,_0x707bfc[_0x3de1('0x47')]);return db['VoiceChanSpy']['find'](_0x5ef4e9)['then'](handleEntityNotFound(_0x20dbbf,null))[_0x3de1('0x24')](respondWithResult(_0x20dbbf,null))[_0x3de1('0x48')](handleError(_0x20dbbf,null));};exports[_0x3de1('0x49')]=function(_0x5c552f,_0x9bb512){return db[_0x3de1('0x2c')][_0x3de1('0x49')](_0x5c552f[_0x3de1('0x4a')],{})[_0x3de1('0x24')](function(_0x506f02){var _0x23f1e6=_0x5c552f[_0x3de1('0x4b')][_0x3de1('0x4c')]({'plain':!![]});if(!_0x23f1e6)throw new Error(_0x3de1('0x4d'));if(_0x23f1e6[_0x3de1('0x4e')]===_0x3de1('0x4b')){var _0x382f85=_0x506f02[_0x3de1('0x4c')]({'plain':!![]});var _0x4463d3=_0x3de1('0x26');return db[_0x3de1('0x4f')][_0x3de1('0x50')]({'where':{'name':_0x4463d3,'userProfileId':_0x23f1e6[_0x3de1('0x51')]},'raw':!![]})[_0x3de1('0x24')](function(_0x38b58c){if(_0x38b58c&&_0x38b58c[_0x3de1('0x52')]===0x0){return db[_0x3de1('0x27')][_0x3de1('0x49')]({'name':_0x382f85[_0x3de1('0x2a')],'resourceId':_0x382f85['id'],'type':_0x38b58c[_0x3de1('0x2a')],'sectionId':_0x38b58c['id']},{})[_0x3de1('0x24')](function(){return _0x506f02;});}else{return _0x506f02;}})['catch'](function(_0x3fa07a){logger[_0x3de1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fa07a);throw _0x3fa07a;});}return _0x506f02;})[_0x3de1('0x24')](respondWithResult(_0x9bb512,0xc9))[_0x3de1('0x48')](handleError(_0x9bb512,null));};exports[_0x3de1('0x23')]=function(_0xecd118,_0x818fc5){if(_0xecd118[_0x3de1('0x4a')]['id']){delete _0xecd118[_0x3de1('0x4a')]['id'];}return db[_0x3de1('0x2c')]['find']({'where':{'id':_0xecd118[_0x3de1('0x45')]['id']}})[_0x3de1('0x24')](handleEntityNotFound(_0x818fc5,null))[_0x3de1('0x24')](saveUpdates(_0xecd118[_0x3de1('0x4a')],null))[_0x3de1('0x24')](respondWithResult(_0x818fc5,null))[_0x3de1('0x48')](handleError(_0x818fc5,null));};exports[_0x3de1('0x25')]=function(_0x1ad58f,_0x362f0d){return db[_0x3de1('0x2c')][_0x3de1('0x50')]({'where':{'id':_0x1ad58f['params']['id']}})[_0x3de1('0x24')](handleEntityNotFound(_0x362f0d,null))['then'](removeEntity(_0x362f0d,null))['catch'](handleError(_0x362f0d,null));}; \ No newline at end of file +var _0x5ab4=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','apply','reject','save','then','get','UserProfileResource','error','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','findAll','rows','show','keys','intersection','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x36918b,_0x1704cb){var _0x17a97f=function(_0xff39ec){while(--_0xff39ec){_0x36918b['push'](_0x36918b['shift']());}};_0x17a97f(++_0x1704cb);}(_0x5ab4,0x9f));var _0x45ab=function(_0x949b88,_0xb83c3b){_0x949b88=_0x949b88-0x0;var _0x1c8f4d=_0x5ab4[_0x949b88];return _0x1c8f4d;};'use strict';var emlformat=require(_0x45ab('0x0'));var rimraf=require(_0x45ab('0x1'));var zipdir=require(_0x45ab('0x2'));var jsonpatch=require(_0x45ab('0x3'));var rp=require(_0x45ab('0x4'));var moment=require('moment');var BPromise=require(_0x45ab('0x5'));var Mustache=require(_0x45ab('0x6'));var util=require(_0x45ab('0x7'));var path=require(_0x45ab('0x8'));var sox=require(_0x45ab('0x9'));var csv=require(_0x45ab('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x45ab('0xb'));var _=require(_0x45ab('0xc'));var squel=require(_0x45ab('0xd'));var crypto=require(_0x45ab('0xe'));var jsforce=require(_0x45ab('0xf'));var deskjs=require(_0x45ab('0x10'));var toCsv=require(_0x45ab('0xa'));var querystring=require(_0x45ab('0x11'));var Papa=require(_0x45ab('0x12'));var Redis=require(_0x45ab('0x13'));var authService=require(_0x45ab('0x14'));var qs=require(_0x45ab('0x15'));var as=require(_0x45ab('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45ab('0x17'))(_0x45ab('0x18'));var utils=require(_0x45ab('0x19'));var config=require(_0x45ab('0x1a'));var licenseUtil=require(_0x45ab('0x1b'));var db=require(_0x45ab('0x1c'))['db'];function respondWithStatusCode(_0x1f509a,_0x46bbc4){_0x46bbc4=_0x46bbc4||0xcc;return function(_0x288913){if(_0x288913){return _0x1f509a['sendStatus'](_0x46bbc4);}return _0x1f509a['status'](_0x46bbc4)[_0x45ab('0x1d')]();};}function respondWithResult(_0x3402ca,_0x224165){_0x224165=_0x224165||0xc8;return function(_0x2b26d3){if(_0x2b26d3){return _0x3402ca[_0x45ab('0x1e')](_0x224165)[_0x45ab('0x1f')](_0x2b26d3);}};}function respondWithFilteredResult(_0x1e6325,_0xdc85c5){return function(_0x4bc375){if(_0x4bc375){var _0x40611f=typeof _0xdc85c5[_0x45ab('0x20')]==='undefined'&&typeof _0xdc85c5[_0x45ab('0x21')]==='undefined';var _0x4b5e24=_0x4bc375[_0x45ab('0x22')];var _0x46ef46=_0x40611f?0x0:_0xdc85c5[_0x45ab('0x20')];var _0xac7ce0=_0x40611f?_0x4bc375[_0x45ab('0x22')]:_0xdc85c5['offset']+_0xdc85c5[_0x45ab('0x21')];var _0x1478d6;if(_0xac7ce0>=_0x4b5e24){_0xac7ce0=_0x4b5e24;_0x1478d6=0xc8;}else{_0x1478d6=0xce;}_0x1e6325[_0x45ab('0x1e')](_0x1478d6);return _0x1e6325[_0x45ab('0x23')]('Content-Range',_0x46ef46+'-'+_0xac7ce0+'/'+_0x4b5e24)[_0x45ab('0x1f')](_0x4bc375);}return null;};}function patchUpdates(_0x54fdab){return function(_0x43d561){try{jsonpatch[_0x45ab('0x24')](_0x43d561,_0x54fdab,!![]);}catch(_0x2515ce){return BPromise[_0x45ab('0x25')](_0x2515ce);}return _0x43d561[_0x45ab('0x26')]();};}function saveUpdates(_0x5b9933,_0x16549e){return function(_0x1b3017){if(_0x1b3017){return _0x1b3017['update'](_0x5b9933)[_0x45ab('0x27')](function(_0x192fda){return _0x192fda;});}return null;};}function removeEntity(_0x74856a,_0x5b4859){return function(_0x229ead){if(_0x229ead){return _0x229ead['destroy']()['then'](function(){var _0x4d5fac=_0x229ead[_0x45ab('0x28')]({'plain':!![]});var _0x5d6aca='ChanSpies';return db[_0x45ab('0x29')]['destroy']({'where':{'type':_0x5d6aca,'resourceId':_0x4d5fac['id']}})[_0x45ab('0x27')](function(){return _0x229ead;});})[_0x45ab('0x27')](function(){_0x74856a[_0x45ab('0x1e')](0xcc)[_0x45ab('0x1d')]();});}};}function handleEntityNotFound(_0xe401db,_0x457514){return function(_0x5027e8){if(!_0x5027e8){_0xe401db['sendStatus'](0x194);}return _0x5027e8;};}function handleError(_0x1e96ad,_0x2c70cd){_0x2c70cd=_0x2c70cd||0x1f4;return function(_0x2bd621){logger[_0x45ab('0x2a')](_0x2bd621['stack']);if(_0x2bd621['name']){delete _0x2bd621['name'];}_0x1e96ad[_0x45ab('0x1e')](_0x2c70cd)[_0x45ab('0x2b')](_0x2bd621);};}exports[_0x45ab('0x2c')]=function(_0x2fcb43,_0x3994cf){var _0x4487e6={},_0x15e627={},_0x2eeb85={'count':0x0,'rows':[]};var _0xb7a809=_['map'](db[_0x45ab('0x2d')][_0x45ab('0x2e')],function(_0x5af73a){return{'name':_0x5af73a[_0x45ab('0x2f')],'type':_0x5af73a[_0x45ab('0x30')][_0x45ab('0x31')]};});_0x15e627['model']=_['map'](_0xb7a809,'name');_0x15e627[_0x45ab('0x32')]=_['keys'](_0x2fcb43[_0x45ab('0x32')]);_0x15e627[_0x45ab('0x33')]=_['intersection'](_0x15e627[_0x45ab('0x34')],_0x15e627[_0x45ab('0x32')]);_0x4487e6[_0x45ab('0x35')]=_['intersection'](_0x15e627[_0x45ab('0x34')],qs[_0x45ab('0x36')](_0x2fcb43[_0x45ab('0x32')][_0x45ab('0x36')]));_0x4487e6[_0x45ab('0x35')]=_0x4487e6['attributes'][_0x45ab('0x37')]?_0x4487e6[_0x45ab('0x35')]:_0x15e627['model'];if(!_0x2fcb43[_0x45ab('0x32')]['hasOwnProperty'](_0x45ab('0x38'))){_0x4487e6[_0x45ab('0x21')]=qs[_0x45ab('0x21')](_0x2fcb43[_0x45ab('0x32')]['limit']);_0x4487e6[_0x45ab('0x20')]=qs['offset'](_0x2fcb43['query'][_0x45ab('0x20')]);}_0x4487e6[_0x45ab('0x39')]=qs[_0x45ab('0x3a')](_0x2fcb43[_0x45ab('0x32')][_0x45ab('0x3a')]);_0x4487e6[_0x45ab('0x3b')]=qs['filters'](_[_0x45ab('0x3c')](_0x2fcb43[_0x45ab('0x32')],_0x15e627[_0x45ab('0x33')]),_0xb7a809);if(_0x2fcb43[_0x45ab('0x32')][_0x45ab('0x3d')]){_0x4487e6[_0x45ab('0x3b')]=_['merge'](_0x4487e6[_0x45ab('0x3b')],{'$or':_[_0x45ab('0x3e')](_0xb7a809,function(_0x365f70){if(_0x365f70['type']!==_0x45ab('0x3f')){var _0x19dd97={};_0x19dd97[_0x365f70['name']]={'$like':'%'+_0x2fcb43[_0x45ab('0x32')][_0x45ab('0x3d')]+'%'};return _0x19dd97;}})});}_0x4487e6=_[_0x45ab('0x40')]({},_0x4487e6,_0x2fcb43[_0x45ab('0x41')]);var _0x42b490={'where':_0x4487e6[_0x45ab('0x3b')]};return db[_0x45ab('0x2d')][_0x45ab('0x22')](_0x42b490)['then'](function(_0x41ac22){_0x2eeb85[_0x45ab('0x22')]=_0x41ac22;if(_0x2fcb43[_0x45ab('0x32')][_0x45ab('0x42')]){_0x4487e6['include']=[{'all':!![]}];}return db[_0x45ab('0x2d')][_0x45ab('0x43')](_0x4487e6);})['then'](function(_0x434d75){_0x2eeb85[_0x45ab('0x44')]=_0x434d75;return _0x2eeb85;})[_0x45ab('0x27')](respondWithFilteredResult(_0x3994cf,_0x4487e6))['catch'](handleError(_0x3994cf,null));};exports[_0x45ab('0x45')]=function(_0x4f4c0d,_0x353ff5){var _0x2a871e={'raw':![],'where':{'id':_0x4f4c0d['params']['id']}},_0xbbcfd1={};_0xbbcfd1['model']=_[_0x45ab('0x46')](db['VoiceChanSpy'][_0x45ab('0x2e')]);_0xbbcfd1[_0x45ab('0x32')]=_[_0x45ab('0x46')](_0x4f4c0d['query']);_0xbbcfd1[_0x45ab('0x33')]=_[_0x45ab('0x47')](_0xbbcfd1[_0x45ab('0x34')],_0xbbcfd1[_0x45ab('0x32')]);_0x2a871e[_0x45ab('0x35')]=_[_0x45ab('0x47')](_0xbbcfd1[_0x45ab('0x34')],qs['fields'](_0x4f4c0d[_0x45ab('0x32')]['fields']));_0x2a871e[_0x45ab('0x35')]=_0x2a871e[_0x45ab('0x35')][_0x45ab('0x37')]?_0x2a871e[_0x45ab('0x35')]:_0xbbcfd1[_0x45ab('0x34')];if(_0x4f4c0d[_0x45ab('0x32')][_0x45ab('0x42')]){_0x2a871e['include']=[{'all':!![]}];}_0x2a871e=_[_0x45ab('0x40')]({},_0x2a871e,_0x4f4c0d['options']);return db['VoiceChanSpy'][_0x45ab('0x48')](_0x2a871e)['then'](handleEntityNotFound(_0x353ff5,null))[_0x45ab('0x27')](respondWithResult(_0x353ff5,null))[_0x45ab('0x49')](handleError(_0x353ff5,null));};exports['create']=function(_0x126a43,_0xc77f26){return db[_0x45ab('0x2d')][_0x45ab('0x4a')](_0x126a43[_0x45ab('0x4b')],{})[_0x45ab('0x27')](function(_0x24c17c){var _0x58c80a=_0x126a43['user'][_0x45ab('0x28')]({'plain':!![]});if(!_0x58c80a)throw new Error(_0x45ab('0x4c'));if(_0x58c80a[_0x45ab('0x4d')]===_0x45ab('0x4e')){var _0x41fbaf=_0x24c17c[_0x45ab('0x28')]({'plain':!![]});var _0xf13632=_0x45ab('0x4f');return db[_0x45ab('0x50')][_0x45ab('0x48')]({'where':{'name':_0xf13632,'userProfileId':_0x58c80a[_0x45ab('0x51')]},'raw':!![]})[_0x45ab('0x27')](function(_0x4de175){if(_0x4de175&&_0x4de175['autoAssociation']===0x0){return db[_0x45ab('0x29')]['create']({'name':_0x41fbaf[_0x45ab('0x52')],'resourceId':_0x41fbaf['id'],'type':_0x4de175[_0x45ab('0x52')],'sectionId':_0x4de175['id']},{})['then'](function(){return _0x24c17c;});}else{return _0x24c17c;}})['catch'](function(_0x26f423){logger[_0x45ab('0x2a')](_0x45ab('0x53'),_0x26f423);throw _0x26f423;});}return _0x24c17c;})[_0x45ab('0x27')](respondWithResult(_0xc77f26,0xc9))[_0x45ab('0x49')](handleError(_0xc77f26,null));};exports[_0x45ab('0x54')]=function(_0x2f31cc,_0x2ee47c){if(_0x2f31cc[_0x45ab('0x4b')]['id']){delete _0x2f31cc['body']['id'];}return db[_0x45ab('0x2d')][_0x45ab('0x48')]({'where':{'id':_0x2f31cc[_0x45ab('0x55')]['id']}})['then'](handleEntityNotFound(_0x2ee47c,null))[_0x45ab('0x27')](saveUpdates(_0x2f31cc[_0x45ab('0x4b')],null))[_0x45ab('0x27')](respondWithResult(_0x2ee47c,null))['catch'](handleError(_0x2ee47c,null));};exports[_0x45ab('0x56')]=function(_0x20974d,_0x50051a){return db[_0x45ab('0x2d')][_0x45ab('0x48')]({'where':{'id':_0x20974d[_0x45ab('0x55')]['id']}})[_0x45ab('0x27')](handleEntityNotFound(_0x50051a,null))[_0x45ab('0x27')](removeEntity(_0x50051a,null))[_0x45ab('0x49')](handleError(_0x50051a,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 071913c..7e06b9f 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 _0x46c6=['system','Set','chanspy','record','MixMonitor','recordingFormat','merge','password','push','name','join','StopMixMonitor','length','concat','internal','User','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix'];(function(_0x573332,_0x570538){var _0x939e6e=function(_0x2fb7f9){while(--_0x2fb7f9){_0x573332['push'](_0x573332['shift']());}};_0x939e6e(++_0x570538);}(_0x46c6,0xc5));var _0x646c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x46c6[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require('lodash');var util=require(_0x646c('0x0'));var BPromise=require('bluebird');var attributes=require(_0x646c('0x1'));var getUserApplications=function(_0x548686,_0x469357,_0x1c1902){var _0x10529d=0x1;var _0x313653=[];var _0x5dca26={'context':_0x469357[_0x646c('0x2')]||_0x646c('0x3'),'exten':util[_0x646c('0x4')](_0x646c('0x5'),_0x548686[_0x646c('0x6')],_0x1c1902),'type':_0x646c('0x7'),'isApp':![],'ChanSpyId':_0x548686['id'],'UserId':_0x469357['id']};_0x313653['push'](_['merge']({'app':_0x646c('0x8'),'appdata':util['format']('CDR(type)=%s',_0x646c('0x9')),'priority':_0x10529d++},_0x5dca26));if(_0x548686[_0x646c('0xa')]){_0x313653['push'](_['merge']({'app':_0x646c('0xb'),'appdata':util[_0x646c('0x4')]('${UNIQUEID}.%s,a',_0x548686[_0x646c('0xc')]),'priority':_0x10529d++},_0x5dca26));}if(_0x548686['auth']){_0x313653['push'](_[_0x646c('0xd')]({'app':'Authenticate','appdata':_0x548686[_0x646c('0xe')],'priority':_0x10529d++},_0x5dca26));}_0x313653[_0x646c('0xf')](_[_0x646c('0xd')]({'app':'ChanSpy','appdata':util[_0x646c('0x4')]('SIP/%s,%s',_0x469357[_0x646c('0x10')],_0x548686['options']?_0x548686['options'][_0x646c('0x11')](''):''),'priority':_0x10529d++},_0x5dca26));if(_0x548686[_0x646c('0xa')]){_0x313653['push'](_['merge']({'app':_0x646c('0x12'),'priority':_0x10529d++},_0x5dca26));}return _0x313653;};var getChanSpyApplications=function(_0x104c0e,_0x1e10b5){var _0xbfa9a6=[];for(var _0x383ab7=0x0,_0x4e0be5=0x1;_0x383ab7<_0x1e10b5[_0x646c('0x13')];_0x383ab7++,_0x4e0be5=0x1){_0xbfa9a6=_0xbfa9a6[_0x646c('0x14')](getUserApplications(_0x104c0e,_0x1e10b5[_0x383ab7],_0x1e10b5[_0x383ab7][_0x646c('0x15')]));if(_0x1e10b5[_0x383ab7][_0x646c('0x15')]!=_0x1e10b5[_0x383ab7][_0x646c('0x10')]){_0xbfa9a6=_0xbfa9a6[_0x646c('0x14')](getUserApplications(_0x104c0e,_0x1e10b5[_0x383ab7],_0x1e10b5[_0x383ab7][_0x646c('0x10')]));}}return _0xbfa9a6;};var getChanSpyPromise=function(_0x8e9c1,_0x26a35c){return new BPromise(function(_0x1cc333,_0x1e6482){return _0x8e9c1[_0x646c('0x16')]['findAll']({'attributes':['id','name',_0x646c('0x15')],'where':{'role':_0x646c('0x17'),'chanspy':!![]},'raw':!![]})[_0x646c('0x18')](function(_0x408ed4){if(_0x408ed4){return _0x1cc333(getChanSpyApplications(_0x26a35c,_0x408ed4));}return _0x1cc333([]);})[_0x646c('0x19')](function(_0x4bbcbe){_0x1e6482(_0x4bbcbe);});});};module[_0x646c('0x1a')]=function(_0xd2e2be,_0x3b7ec6){var _0x5b8c37=_0xd2e2be[_0x646c('0x1b')];return _0xd2e2be[_0x646c('0x1c')](_0x646c('0x1d'),attributes,{'tableName':_0x646c('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xb28394,_0x4cc789,_0x5c5a2f){return getChanSpyPromise(_0x5b8c37,_0xb28394)['then'](function(_0x1a2ef3){if(_0x1a2ef3&&_0x1a2ef3[_0x646c('0x13')]){return _0x5b8c37[_0x646c('0x1f')][_0x646c('0x20')](_0x1a2ef3);}})[_0x646c('0x18')](function(){_0x5c5a2f();})[_0x646c('0x19')](function(_0x2c8866){_0x5c5a2f(_0x2c8866);});},'afterUpdate':function(_0x2596f1,_0x30e2d6,_0x3a68b5){return _0x5b8c37[_0x646c('0x1f')][_0x646c('0x21')]({'where':{'ChanSpyId':_0x2596f1['id']}})[_0x646c('0x18')](function(){return getChanSpyPromise(_0x5b8c37,_0x2596f1);})[_0x646c('0x18')](function(_0x1c661d){if(_0x1c661d&&_0x1c661d['length']){return _0x5b8c37[_0x646c('0x1f')]['bulkCreate'](_0x1c661d);}})[_0x646c('0x18')](function(){_0x3a68b5();})['catch'](function(_0x732c2d){_0x3a68b5(_0x732c2d);});},'afterDestroy':function(_0x55007,_0x2e72b9,_0x307298){return _0x5b8c37['VoiceExtension'][_0x646c('0x21')]({'where':{'ChanSpyId':_0x55007['id']}})['then'](function(){_0x307298();})[_0x646c('0x19')](function(_0x4ff7a7){_0x307298(_0x4ff7a7);});}}});}; \ No newline at end of file +var _0x4b8c=['VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','name','options','join','StopMixMonitor','internal','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','length'];(function(_0x48be93,_0x4dd760){var _0x5d2d9a=function(_0x1ef85d){while(--_0x1ef85d){_0x48be93['push'](_0x48be93['shift']());}};_0x5d2d9a(++_0x4dd760);}(_0x4b8c,0x19a));var _0xc4b8=function(_0x11e00a,_0x220b34){_0x11e00a=_0x11e00a-0x0;var _0x74b738=_0x4b8c[_0x11e00a];return _0x74b738;};'use strict';var _=require(_0xc4b8('0x0'));var util=require(_0xc4b8('0x1'));var BPromise=require(_0xc4b8('0x2'));var attributes=require(_0xc4b8('0x3'));var getUserApplications=function(_0x5b50c8,_0xe227ad,_0x4c9ede){var _0x26191e=0x1;var _0x3b03c9=[];var _0x3ffff5={'context':_0xe227ad[_0xc4b8('0x4')]||'from-sip','exten':util[_0xc4b8('0x5')](_0xc4b8('0x6'),_0x5b50c8[_0xc4b8('0x7')],_0x4c9ede),'type':_0xc4b8('0x8'),'isApp':![],'ChanSpyId':_0x5b50c8['id'],'UserId':_0xe227ad['id']};_0x3b03c9[_0xc4b8('0x9')](_[_0xc4b8('0xa')]({'app':'Set','appdata':util[_0xc4b8('0x5')](_0xc4b8('0xb'),_0xc4b8('0xc')),'priority':_0x26191e++},_0x3ffff5));if(_0x5b50c8[_0xc4b8('0xd')]){_0x3b03c9[_0xc4b8('0x9')](_['merge']({'app':_0xc4b8('0xe'),'appdata':util[_0xc4b8('0x5')](_0xc4b8('0xf'),_0x5b50c8[_0xc4b8('0x10')]),'priority':_0x26191e++},_0x3ffff5));}if(_0x5b50c8[_0xc4b8('0x11')]){_0x3b03c9['push'](_[_0xc4b8('0xa')]({'app':_0xc4b8('0x12'),'appdata':_0x5b50c8['password'],'priority':_0x26191e++},_0x3ffff5));}_0x3b03c9[_0xc4b8('0x9')](_[_0xc4b8('0xa')]({'app':'ChanSpy','appdata':util[_0xc4b8('0x5')]('SIP/%s,%s',_0xe227ad[_0xc4b8('0x13')],_0x5b50c8[_0xc4b8('0x14')]?_0x5b50c8[_0xc4b8('0x14')][_0xc4b8('0x15')](''):''),'priority':_0x26191e++},_0x3ffff5));if(_0x5b50c8[_0xc4b8('0xd')]){_0x3b03c9[_0xc4b8('0x9')](_[_0xc4b8('0xa')]({'app':_0xc4b8('0x16'),'priority':_0x26191e++},_0x3ffff5));}return _0x3b03c9;};var getChanSpyApplications=function(_0x535d16,_0x432644){var _0x17e4bd=[];for(var _0x59ef5b=0x0,_0x58a1e9=0x1;_0x59ef5b<_0x432644['length'];_0x59ef5b++,_0x58a1e9=0x1){_0x17e4bd=_0x17e4bd['concat'](getUserApplications(_0x535d16,_0x432644[_0x59ef5b],_0x432644[_0x59ef5b][_0xc4b8('0x17')]));if(_0x432644[_0x59ef5b][_0xc4b8('0x17')]!=_0x432644[_0x59ef5b][_0xc4b8('0x13')]){_0x17e4bd=_0x17e4bd['concat'](getUserApplications(_0x535d16,_0x432644[_0x59ef5b],_0x432644[_0x59ef5b]['name']));}}return _0x17e4bd;};var getChanSpyPromise=function(_0x4189c6,_0x2eba74){return new BPromise(function(_0x302fb8,_0x1b336c){return _0x4189c6[_0xc4b8('0x18')][_0xc4b8('0x19')]({'attributes':['id',_0xc4b8('0x13'),_0xc4b8('0x17')],'where':{'role':_0xc4b8('0x1a'),'chanspy':!![]},'raw':!![]})[_0xc4b8('0x1b')](function(_0xb0a13e){if(_0xb0a13e){return _0x302fb8(getChanSpyApplications(_0x2eba74,_0xb0a13e));}return _0x302fb8([]);})[_0xc4b8('0x1c')](function(_0x37ad5d){_0x1b336c(_0x37ad5d);});});};module[_0xc4b8('0x1d')]=function(_0x2f67ea,_0x39282b){var _0x511313=_0x2f67ea['models'];return _0x2f67ea[_0xc4b8('0x1e')](_0xc4b8('0x1f'),attributes,{'tableName':_0xc4b8('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x6a0b23,_0x2b455f,_0x2e732f){return getChanSpyPromise(_0x511313,_0x6a0b23)['then'](function(_0x52d6a4){if(_0x52d6a4&&_0x52d6a4[_0xc4b8('0x21')]){return _0x511313[_0xc4b8('0x22')][_0xc4b8('0x23')](_0x52d6a4);}})[_0xc4b8('0x1b')](function(){_0x2e732f();})[_0xc4b8('0x1c')](function(_0x12c792){_0x2e732f(_0x12c792);});},'afterUpdate':function(_0x2259ab,_0x40df9e,_0xbcd5af){return _0x511313['VoiceExtension'][_0xc4b8('0x24')]({'where':{'ChanSpyId':_0x2259ab['id']}})[_0xc4b8('0x1b')](function(){return getChanSpyPromise(_0x511313,_0x2259ab);})[_0xc4b8('0x1b')](function(_0x552aac){if(_0x552aac&&_0x552aac[_0xc4b8('0x21')]){return _0x511313[_0xc4b8('0x22')][_0xc4b8('0x23')](_0x552aac);}})[_0xc4b8('0x1b')](function(){_0xbcd5af();})['catch'](function(_0x184f15){_0xbcd5af(_0x184f15);});},'afterDestroy':function(_0x57f31c,_0x3f05d9,_0x5ed5b5){return _0x511313[_0xc4b8('0x22')]['destroy']({'where':{'ChanSpyId':_0x57f31c['id']}})['then'](function(){_0x5ed5b5();})[_0xc4b8('0x1c')](function(_0x3a0576){_0x5ed5b5(_0x3a0576);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5a6eccc..8d97440 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 _0x0e9f=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x4c06ac,_0x568788){var _0x2333cb=function(_0xdb5c64){while(--_0xdb5c64){_0x4c06ac['push'](_0x4c06ac['shift']());}};_0x2333cb(++_0x568788);}(_0x0e9f,0x116));var _0xf0e9=function(_0x5dd42b,_0x58dd59){_0x5dd42b=_0x5dd42b-0x0;var _0x1dced0=_0x0e9f[_0x5dd42b];return _0x1dced0;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0e9('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0e9('0x4'));var jayson=require(_0xf0e9('0x5'));var client=jayson['client'][_0xf0e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a35a3,_0x3f9792,_0x2fa08f){return new BPromise(function(_0x106ba0,_0x58edfe){return client['request'](_0x4a35a3,_0x2fa08f)[_0xf0e9('0x7')](function(_0x7b3146){logger[_0xf0e9('0x8')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9792,_0xf0e9('0x9'));logger[_0xf0e9('0xa')](_0xf0e9('0xb'),_0x3f9792,'request\x20sent',JSON[_0xf0e9('0xc')](_0x7b3146));if(_0x7b3146[_0xf0e9('0xd')]){if(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0xe')]===0x1f4){logger['error'](_0xf0e9('0xf'),_0x3f9792,_0x7b3146['error'][_0xf0e9('0x10')]);return _0x58edfe(_0x7b3146[_0xf0e9('0xd')]['message']);}logger[_0xf0e9('0xd')](_0xf0e9('0xf'),_0x3f9792,_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);return _0x106ba0(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);}else{logger['info'](_0xf0e9('0xf'),_0x3f9792,_0xf0e9('0x9'));_0x106ba0(_0x7b3146['result'][_0xf0e9('0x10')]);}})[_0xf0e9('0x11')](function(_0x3d0b4d){logger[_0xf0e9('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9792,_0x3d0b4d);_0x58edfe(_0x3d0b4d);});});} \ No newline at end of file +var _0x3c81=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3428ca,_0x5a035c){var _0x4da854=function(_0x528dd7){while(--_0x528dd7){_0x3428ca['push'](_0x3428ca['shift']());}};_0x4da854(++_0x5a035c);}(_0x3c81,0x102));var _0x13c8=function(_0x54ce4a,_0x2de6b9){_0x54ce4a=_0x54ce4a-0x0;var _0x234153=_0x3c81[_0x54ce4a];return _0x234153;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c77d5ed..8bac887 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 _0x0c95=['../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1a0db6,_0x75f519){var _0x239367=function(_0xe505d3){while(--_0xe505d3){_0x1a0db6['push'](_0x1a0db6['shift']());}};_0x239367(++_0x75f519);}(_0x0c95,0x197));var _0x50c9=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0x0c95[_0x1ac77b];return _0x161584;};'use strict';var multer=require(_0x50c9('0x0'));var util=require(_0x50c9('0x1'));var path=require(_0x50c9('0x2'));var timeout=require(_0x50c9('0x3'));var express=require(_0x50c9('0x4'));var router=express[_0x50c9('0x5')]();var fs_extra=require(_0x50c9('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x50c9('0x7'));var controller=require(_0x50c9('0x8'));router['get']('/',auth[_0x50c9('0x9')](),controller[_0x50c9('0xa')]);router[_0x50c9('0xb')](_0x50c9('0xc'),auth[_0x50c9('0x9')](),controller['show']);router[_0x50c9('0xd')]('/',auth['isAuthenticated'](),controller[_0x50c9('0xe')]);router['put'](_0x50c9('0xc'),auth['isAuthenticated'](),controller[_0x50c9('0xf')]);router['delete'](_0x50c9('0xc'),auth['isAuthenticated'](),controller[_0x50c9('0x10')]);module[_0x50c9('0x11')]=router; \ No newline at end of file +var _0x2798=['./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x39e9dd,_0x46cc61){var _0x34896b=function(_0x394afa){while(--_0x394afa){_0x39e9dd['push'](_0x39e9dd['shift']());}};_0x34896b(++_0x46cc61);}(_0x2798,0xaa));var _0x8279=function(_0x60cf00,_0x4bd822){_0x60cf00=_0x60cf00-0x0;var _0x12fb1e=_0x2798[_0x60cf00];return _0x12fb1e;};'use strict';var multer=require(_0x8279('0x0'));var util=require('util');var path=require(_0x8279('0x1'));var timeout=require(_0x8279('0x2'));var express=require('express');var router=express[_0x8279('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8279('0x4'));var config=require(_0x8279('0x5'));var controller=require(_0x8279('0x6'));router[_0x8279('0x7')]('/',auth[_0x8279('0x8')](),controller['index']);router[_0x8279('0x7')](_0x8279('0x9'),auth[_0x8279('0x8')](),controller[_0x8279('0xa')]);router[_0x8279('0xb')]('/',auth['isAuthenticated'](),controller[_0x8279('0xc')]);router[_0x8279('0xd')](_0x8279('0x9'),auth[_0x8279('0x8')](),controller[_0x8279('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8279('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index cc36b8c..c7d0e15 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 _0x8c38=['STRING','name','BOOLEAN','sequelize'];(function(_0x2e0c7f,_0x594ed8){var _0x49d09c=function(_0x5e840a){while(--_0x5e840a){_0x2e0c7f['push'](_0x2e0c7f['shift']());}};_0x49d09c(++_0x594ed8);}(_0x8c38,0x1bf));var _0x88c3=function(_0x1208e9,_0x5cacf6){_0x1208e9=_0x1208e9-0x0;var _0x4b7f0b=_0x8c38[_0x1208e9];return _0x4b7f0b;};'use strict';var Sequelize=require(_0x88c3('0x0'));module['exports']={'name':{'type':Sequelize[_0x88c3('0x1')],'unique':_0x88c3('0x2')},'description':{'type':Sequelize[_0x88c3('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x88c3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfe26=['sequelize','STRING','name'];(function(_0x327143,_0x158d1a){var _0x530193=function(_0x372702){while(--_0x372702){_0x327143['push'](_0x327143['shift']());}};_0x530193(++_0x158d1a);}(_0xfe26,0x102));var _0x6fe2=function(_0x46e17f,_0x14829a){_0x46e17f=_0x46e17f-0x0;var _0x3d5f9f=_0xfe26[_0x46e17f];return _0x3d5f9f;};'use strict';var Sequelize=require(_0x6fe2('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fe2('0x1')],'unique':_0x6fe2('0x2')},'description':{'type':Sequelize[_0x6fe2('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 8a3a85c..758c1dd 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 _0x41d5=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','show','params','keys','find','create','body','readFileSync','join','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','writeFileSync','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x41d5,0xa7));var _0x541d=function(_0x32365d,_0x211baf){_0x32365d=_0x32365d-0x0;var _0x1e49b4=_0x41d5[_0x32365d];return _0x1e49b4;};'use strict';var emlformat=require(_0x541d('0x0'));var rimraf=require(_0x541d('0x1'));var zipdir=require(_0x541d('0x2'));var jsonpatch=require(_0x541d('0x3'));var rp=require(_0x541d('0x4'));var moment=require(_0x541d('0x5'));var BPromise=require(_0x541d('0x6'));var Mustache=require(_0x541d('0x7'));var util=require('util');var path=require('path');var sox=require(_0x541d('0x8'));var csv=require(_0x541d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x541d('0xa'));var _=require(_0x541d('0xb'));var squel=require(_0x541d('0xc'));var crypto=require(_0x541d('0xd'));var jsforce=require(_0x541d('0xe'));var deskjs=require(_0x541d('0xf'));var toCsv=require(_0x541d('0x9'));var querystring=require(_0x541d('0x10'));var Papa=require(_0x541d('0x11'));var Redis=require(_0x541d('0x12'));var authService=require(_0x541d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x541d('0x14'))('api');var utils=require(_0x541d('0x15'));var config=require(_0x541d('0x16'));var licenseUtil=require(_0x541d('0x17'));var db=require(_0x541d('0x18'))['db'];var jayson=require(_0x541d('0x19'));var client=jayson[_0x541d('0x1a')][_0x541d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2ae73e,_0xfa8877,_0xc66195,_0x192779){return new BPromise(function(_0x197694,_0x260340){var _0x2838db=_0x192779||client;return _0x2838db['request'](_0x2ae73e,_0xc66195)[_0x541d('0x1c')](function(_0x1a502a){logger[_0x541d('0x1d')](_0x541d('0x1e'),_0xfa8877,_0x541d('0x1f'));logger['debug'](_0x541d('0x20'),_0xfa8877,_0x541d('0x1f'),JSON[_0x541d('0x21')](_0x1a502a));if(_0x1a502a[_0x541d('0x22')]){if(_0x1a502a[_0x541d('0x22')][_0x541d('0x23')]===0x1f4){logger[_0x541d('0x22')](_0x541d('0x1e'),_0xfa8877,_0x1a502a[_0x541d('0x22')][_0x541d('0x24')]);return _0x260340(_0x1a502a[_0x541d('0x22')][_0x541d('0x24')]);}logger[_0x541d('0x22')](_0x541d('0x1e'),_0xfa8877,_0x1a502a[_0x541d('0x22')][_0x541d('0x24')]);return _0x197694(_0x1a502a['error'][_0x541d('0x24')]);}else{logger[_0x541d('0x1d')](_0x541d('0x1e'),_0xfa8877,_0x541d('0x1f'));_0x197694(_0x1a502a[_0x541d('0x25')][_0x541d('0x24')]);}})[_0x541d('0x26')](function(_0x49572a){logger[_0x541d('0x22')](_0x541d('0x1e'),_0xfa8877,_0x49572a);_0x260340(_0x49572a);});});}function respondWithStatusCode(_0xa5a371,_0x149108){_0x149108=_0x149108||0xcc;return function(_0xf7d00d){if(_0xf7d00d){return _0xa5a371[_0x541d('0x27')](_0x149108);}return _0xa5a371[_0x541d('0x28')](_0x149108)[_0x541d('0x29')]();};}function respondWithResult(_0x5c3aae,_0x3a6f48){_0x3a6f48=_0x3a6f48||0xc8;return function(_0x41f250){if(_0x41f250){return _0x5c3aae[_0x541d('0x28')](_0x3a6f48)[_0x541d('0x2a')](_0x41f250);}};}function respondWithFilteredResult(_0x838da6,_0x596d9a){return function(_0xa8d3d7){if(_0xa8d3d7){var _0x57712d=typeof _0x596d9a[_0x541d('0x2b')]===_0x541d('0x2c')&&typeof _0x596d9a[_0x541d('0x2d')]==='undefined';var _0xf1fbe0=_0xa8d3d7[_0x541d('0x2e')];var _0x10fc75=_0x57712d?0x0:_0x596d9a[_0x541d('0x2b')];var _0x53f481=_0x57712d?_0xa8d3d7['count']:_0x596d9a[_0x541d('0x2b')]+_0x596d9a[_0x541d('0x2d')];var _0x37e8d0;if(_0x53f481>=_0xf1fbe0){_0x53f481=_0xf1fbe0;_0x37e8d0=0xc8;}else{_0x37e8d0=0xce;}_0x838da6[_0x541d('0x28')](_0x37e8d0);return _0x838da6[_0x541d('0x2f')](_0x541d('0x30'),_0x10fc75+'-'+_0x53f481+'/'+_0xf1fbe0)[_0x541d('0x2a')](_0xa8d3d7);}return null;};}function patchUpdates(_0x5a5a74){return function(_0x2be8a3){try{jsonpatch[_0x541d('0x31')](_0x2be8a3,_0x5a5a74,!![]);}catch(_0x19d0e7){return BPromise[_0x541d('0x32')](_0x19d0e7);}return _0x2be8a3['save']();};}function saveUpdates(_0x17b646,_0x2c306a){return function(_0xf60be3){if(_0xf60be3){return _0xf60be3[_0x541d('0x33')](_0x17b646)[_0x541d('0x1c')](function(_0x3baf1e){return _0x3baf1e;});}return null;};}function removeEntity(_0xb592bb,_0x583796){return function(_0x515364){if(_0x515364){return _0x515364[_0x541d('0x34')]()['then'](function(){var _0x3aba7d=_0x515364['get']({'plain':!![]});var _0x58908f='Contexts';return db[_0x541d('0x35')][_0x541d('0x34')]({'where':{'type':_0x58908f,'resourceId':_0x3aba7d['id']}})[_0x541d('0x1c')](function(){return _0x515364;});})[_0x541d('0x1c')](function(){_0xb592bb[_0x541d('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x421d0b,_0x5b2d27){return function(_0xa3e833){if(!_0xa3e833){_0x421d0b[_0x541d('0x27')](0x194);}return _0xa3e833;};}function handleError(_0x231771,_0x128d6b){_0x128d6b=_0x128d6b||0x1f4;return function(_0x79afb5){logger['error'](_0x79afb5[_0x541d('0x36')]);if(_0x79afb5[_0x541d('0x37')]){delete _0x79afb5[_0x541d('0x37')];}_0x231771[_0x541d('0x28')](_0x128d6b)[_0x541d('0x38')](_0x79afb5);};}exports[_0x541d('0x39')]=function(_0x2b60f7,_0x3c93a4){var _0x4aeb60={},_0x511b73={},_0x49892f={'count':0x0,'rows':[]};var _0x1d7ed0=_[_0x541d('0x3a')](db[_0x541d('0x3b')][_0x541d('0x3c')],function(_0x1e6b40){return{'name':_0x1e6b40[_0x541d('0x3d')],'type':_0x1e6b40[_0x541d('0x3e')][_0x541d('0x3f')]};});_0x511b73[_0x541d('0x40')]=_[_0x541d('0x3a')](_0x1d7ed0,_0x541d('0x37'));_0x511b73[_0x541d('0x41')]=_['keys'](_0x2b60f7[_0x541d('0x41')]);_0x511b73[_0x541d('0x42')]=_['intersection'](_0x511b73[_0x541d('0x40')],_0x511b73[_0x541d('0x41')]);_0x4aeb60['attributes']=_[_0x541d('0x43')](_0x511b73[_0x541d('0x40')],qs[_0x541d('0x44')](_0x2b60f7[_0x541d('0x41')][_0x541d('0x44')]));_0x4aeb60['attributes']=_0x4aeb60['attributes'][_0x541d('0x45')]?_0x4aeb60[_0x541d('0x46')]:_0x511b73[_0x541d('0x40')];if(!_0x2b60f7[_0x541d('0x41')][_0x541d('0x47')]('nolimit')){_0x4aeb60[_0x541d('0x2d')]=qs[_0x541d('0x2d')](_0x2b60f7['query'][_0x541d('0x2d')]);_0x4aeb60[_0x541d('0x2b')]=qs['offset'](_0x2b60f7[_0x541d('0x41')][_0x541d('0x2b')]);}_0x4aeb60[_0x541d('0x48')]=qs[_0x541d('0x49')](_0x2b60f7[_0x541d('0x41')][_0x541d('0x49')]);_0x4aeb60[_0x541d('0x4a')]=qs[_0x541d('0x42')](_[_0x541d('0x4b')](_0x2b60f7[_0x541d('0x41')],_0x511b73[_0x541d('0x42')]),_0x1d7ed0);if(_0x2b60f7[_0x541d('0x41')][_0x541d('0x4c')]){_0x4aeb60['where']=_[_0x541d('0x4d')](_0x4aeb60['where'],{'$or':_[_0x541d('0x3a')](_0x1d7ed0,function(_0x97e1cd){if(_0x97e1cd[_0x541d('0x3e')]!==_0x541d('0x4e')){var _0x18a1e5={};_0x18a1e5[_0x97e1cd[_0x541d('0x37')]]={'$like':'%'+_0x2b60f7[_0x541d('0x41')]['filter']+'%'};return _0x18a1e5;}})});}_0x4aeb60=_[_0x541d('0x4d')]({},_0x4aeb60,_0x2b60f7[_0x541d('0x4f')]);var _0x15f41e={'where':_0x4aeb60[_0x541d('0x4a')]};return db[_0x541d('0x3b')][_0x541d('0x2e')](_0x15f41e)['then'](function(_0x1c511f){_0x49892f[_0x541d('0x2e')]=_0x1c511f;if(_0x2b60f7[_0x541d('0x41')]['includeAll']){_0x4aeb60[_0x541d('0x50')]=[{'all':!![]}];}return db[_0x541d('0x3b')]['findAll'](_0x4aeb60);})[_0x541d('0x1c')](function(_0x525f2f){_0x49892f['rows']=_0x525f2f;return _0x49892f;})['then'](respondWithFilteredResult(_0x3c93a4,_0x4aeb60))[_0x541d('0x26')](handleError(_0x3c93a4,null));};exports[_0x541d('0x51')]=function(_0x3c73e3,_0x3ffcae){var _0x3812a5={'raw':![],'where':{'id':_0x3c73e3[_0x541d('0x52')]['id']}},_0x1e9305={};_0x1e9305[_0x541d('0x40')]=_[_0x541d('0x53')](db['VoiceContext'][_0x541d('0x3c')]);_0x1e9305[_0x541d('0x41')]=_['keys'](_0x3c73e3['query']);_0x1e9305[_0x541d('0x42')]=_[_0x541d('0x43')](_0x1e9305['model'],_0x1e9305[_0x541d('0x41')]);_0x3812a5[_0x541d('0x46')]=_[_0x541d('0x43')](_0x1e9305[_0x541d('0x40')],qs['fields'](_0x3c73e3[_0x541d('0x41')]['fields']));_0x3812a5[_0x541d('0x46')]=_0x3812a5['attributes']['length']?_0x3812a5[_0x541d('0x46')]:_0x1e9305[_0x541d('0x40')];if(_0x3c73e3['query']['includeAll']){_0x3812a5[_0x541d('0x50')]=[{'all':!![]}];}_0x3812a5=_['merge']({},_0x3812a5,_0x3c73e3[_0x541d('0x4f')]);return db[_0x541d('0x3b')][_0x541d('0x54')](_0x3812a5)['then'](handleEntityNotFound(_0x3ffcae,null))[_0x541d('0x1c')](respondWithResult(_0x3ffcae,null))[_0x541d('0x26')](handleError(_0x3ffcae,null));};exports['create']=function(_0x212ac8,_0x4fe87d,_0x3297c4){var _0x289730;return db[_0x541d('0x3b')][_0x541d('0x55')](_0x212ac8[_0x541d('0x56')],{'raw':!![]})['then'](function(_0x22cc12){_0x289730=_0x22cc12;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x1a57ba){var _0x5c4f03=fs[_0x541d('0x57')](path[_0x541d('0x58')](config[_0x541d('0x59')],'server/files/templates/context.ejs'),_0x541d('0x5a'));var _0x1f98e3=ejs[_0x541d('0x5b')](_0x5c4f03,{'contexts':_0x1a57ba||[]});fs['writeFileSync'](_0x541d('0x5c'),_0x1f98e3);})[_0x541d('0x1c')](function(){return respondWithRpcPromise(_0x541d('0x5d'),_0x541d('0x55'),{'module':_0x541d('0x5e')});})[_0x541d('0x1c')](function(){var _0x50109d=_0x212ac8[_0x541d('0x5f')][_0x541d('0x60')]({'plain':!![]});if(!_0x50109d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50109d[_0x541d('0x61')]===_0x541d('0x5f')){var _0x1698af=_0x289730[_0x541d('0x60')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Contexts','userProfileId':_0x50109d['userProfileId']},'raw':!![]})['then'](function(_0x186003){if(_0x186003&&_0x186003[_0x541d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x1698af['name'],'resourceId':_0x1698af['id'],'type':_0x186003[_0x541d('0x37')],'sectionId':_0x186003['id']},{})[_0x541d('0x1c')](function(){return _0x289730;});}else{return _0x289730;}})[_0x541d('0x26')](function(_0x34c55b){logger[_0x541d('0x22')](_0x541d('0x63'),_0x34c55b);throw _0x34c55b;});}return _0x289730;})[_0x541d('0x1c')](respondWithResult(_0x4fe87d,0xc9))[_0x541d('0x26')](handleError(_0x4fe87d,null));};exports['update']=function(_0x5607ad,_0x557fdb,_0x570bb8){var _0x56661a;return db[_0x541d('0x3b')][_0x541d('0x54')]({'where':{'id':_0x5607ad[_0x541d('0x52')]['id']}})[_0x541d('0x1c')](handleEntityNotFound(_0x557fdb,null))[_0x541d('0x1c')](saveUpdates(_0x5607ad[_0x541d('0x56')],null))[_0x541d('0x1c')](function(_0x49d992){if(_0x49d992){_0x56661a=_0x49d992;return db['VoiceContext'][_0x541d('0x64')]({'raw':!![]});}})[_0x541d('0x1c')](function(_0x11d245){var _0x3d7455=fs[_0x541d('0x57')](path[_0x541d('0x58')](config[_0x541d('0x59')],'server/files/templates/context.ejs'),_0x541d('0x5a'));var _0x5becad=ejs[_0x541d('0x5b')](_0x3d7455,{'contexts':_0x11d245||[]});fs[_0x541d('0x65')](_0x541d('0x5c'),_0x5becad);})[_0x541d('0x1c')](function(){return respondWithRpcPromise(_0x541d('0x5d'),'update',{'module':'chan_sip.so'});})[_0x541d('0x1c')](function(){return _0x56661a;})['then'](respondWithResult(_0x557fdb,null))[_0x541d('0x26')](handleError(_0x557fdb,null));};exports['destroy']=function(_0x43db24,_0x5d37a3,_0xea4eb4){var _0x1ea94b;return db[_0x541d('0x3b')]['find']({'where':{'id':_0x43db24[_0x541d('0x52')]['id']}})[_0x541d('0x1c')](handleEntityNotFound(_0x5d37a3,null))['then'](removeEntity(_0x5d37a3,null))[_0x541d('0x1c')](function(){return db[_0x541d('0x3b')][_0x541d('0x64')]({'raw':!![]});})['then'](function(_0x3f8f98){var _0x48aa09=fs[_0x541d('0x57')](path['join'](config[_0x541d('0x59')],_0x541d('0x66')),_0x541d('0x5a'));var _0x274b5f=ejs[_0x541d('0x5b')](_0x48aa09,{'contexts':_0x3f8f98});fs[_0x541d('0x65')](_0x541d('0x5c'),_0x274b5f);return respondWithRpcPromise(_0x541d('0x5d'),_0x541d('0x34'),{'module':_0x541d('0x5e')});})[_0x541d('0x26')](handleError(_0x5d37a3,null));}; \ No newline at end of file +var _0xc0d4=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','update','then','Contexts','UserProfileResource','destroy','end','stack','name','index','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','VoiceContext','findAll','rows','params','rawAttributes','find','create','body','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','UserProfileSection','userProfileId','autoAssociation'];(function(_0x1de751,_0x3b3293){var _0x126937=function(_0x396a93){while(--_0x396a93){_0x1de751['push'](_0x1de751['shift']());}};_0x126937(++_0x3b3293);}(_0xc0d4,0x69));var _0x4c0d=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xc0d4[_0x13ce0c];return _0x4388fb;};'use strict';var emlformat=require(_0x4c0d('0x0'));var rimraf=require(_0x4c0d('0x1'));var zipdir=require(_0x4c0d('0x2'));var jsonpatch=require(_0x4c0d('0x3'));var rp=require(_0x4c0d('0x4'));var moment=require(_0x4c0d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4c0d('0x6'));var util=require(_0x4c0d('0x7'));var path=require(_0x4c0d('0x8'));var sox=require(_0x4c0d('0x9'));var csv=require('to-csv');var ejs=require(_0x4c0d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c0d('0xb'));var squel=require(_0x4c0d('0xc'));var crypto=require(_0x4c0d('0xd'));var jsforce=require(_0x4c0d('0xe'));var deskjs=require(_0x4c0d('0xf'));var toCsv=require(_0x4c0d('0x10'));var querystring=require(_0x4c0d('0x11'));var Papa=require(_0x4c0d('0x12'));var Redis=require(_0x4c0d('0x13'));var authService=require(_0x4c0d('0x14'));var qs=require(_0x4c0d('0x15'));var as=require(_0x4c0d('0x16'));var hardwareService=require(_0x4c0d('0x17'));var logger=require(_0x4c0d('0x18'))(_0x4c0d('0x19'));var utils=require(_0x4c0d('0x1a'));var config=require(_0x4c0d('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c0d('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4c0d('0x1d')][_0x4c0d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x48a465,_0x3487d4,_0x21ac5f,_0x51504b){return new BPromise(function(_0x40efe1,_0x233041){var _0x4a8969=_0x51504b||client;return _0x4a8969['request'](_0x48a465,_0x21ac5f)['then'](function(_0x5630c7){logger['info'](_0x4c0d('0x1f'),_0x3487d4,_0x4c0d('0x20'));logger[_0x4c0d('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3487d4,_0x4c0d('0x20'),JSON[_0x4c0d('0x22')](_0x5630c7));if(_0x5630c7['error']){if(_0x5630c7['error']['code']===0x1f4){logger[_0x4c0d('0x23')]('VoiceContext,\x20%s,\x20%s',_0x3487d4,_0x5630c7['error'][_0x4c0d('0x24')]);return _0x233041(_0x5630c7[_0x4c0d('0x23')][_0x4c0d('0x24')]);}logger[_0x4c0d('0x23')](_0x4c0d('0x1f'),_0x3487d4,_0x5630c7[_0x4c0d('0x23')]['message']);return _0x40efe1(_0x5630c7[_0x4c0d('0x23')][_0x4c0d('0x24')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x3487d4,_0x4c0d('0x20'));_0x40efe1(_0x5630c7[_0x4c0d('0x25')][_0x4c0d('0x24')]);}})[_0x4c0d('0x26')](function(_0x32b357){logger[_0x4c0d('0x23')](_0x4c0d('0x1f'),_0x3487d4,_0x32b357);_0x233041(_0x32b357);});});}function respondWithStatusCode(_0x38bdad,_0x477ce8){_0x477ce8=_0x477ce8||0xcc;return function(_0xda5dc3){if(_0xda5dc3){return _0x38bdad[_0x4c0d('0x27')](_0x477ce8);}return _0x38bdad[_0x4c0d('0x28')](_0x477ce8)['end']();};}function respondWithResult(_0x25cd84,_0x571f61){_0x571f61=_0x571f61||0xc8;return function(_0x2d811a){if(_0x2d811a){return _0x25cd84[_0x4c0d('0x28')](_0x571f61)[_0x4c0d('0x29')](_0x2d811a);}};}function respondWithFilteredResult(_0x3fb32a,_0x4e6818){return function(_0x4f6c89){if(_0x4f6c89){var _0x374e3b=typeof _0x4e6818[_0x4c0d('0x2a')]==='undefined'&&typeof _0x4e6818[_0x4c0d('0x2b')]===_0x4c0d('0x2c');var _0x12d457=_0x4f6c89[_0x4c0d('0x2d')];var _0x1b897f=_0x374e3b?0x0:_0x4e6818[_0x4c0d('0x2a')];var _0x34e2ff=_0x374e3b?_0x4f6c89[_0x4c0d('0x2d')]:_0x4e6818[_0x4c0d('0x2a')]+_0x4e6818[_0x4c0d('0x2b')];var _0x361d39;if(_0x34e2ff>=_0x12d457){_0x34e2ff=_0x12d457;_0x361d39=0xc8;}else{_0x361d39=0xce;}_0x3fb32a[_0x4c0d('0x28')](_0x361d39);return _0x3fb32a['set']('Content-Range',_0x1b897f+'-'+_0x34e2ff+'/'+_0x12d457)['json'](_0x4f6c89);}return null;};}function patchUpdates(_0x5cb99a){return function(_0x2d59ed){try{jsonpatch[_0x4c0d('0x2e')](_0x2d59ed,_0x5cb99a,!![]);}catch(_0x442cba){return BPromise[_0x4c0d('0x2f')](_0x442cba);}return _0x2d59ed[_0x4c0d('0x30')]();};}function saveUpdates(_0x4adc0a,_0x4886b5){return function(_0x2ffe85){if(_0x2ffe85){return _0x2ffe85[_0x4c0d('0x31')](_0x4adc0a)[_0x4c0d('0x32')](function(_0x513f8a){return _0x513f8a;});}return null;};}function removeEntity(_0xf3ddeb,_0x4c994f){return function(_0x23b9a7){if(_0x23b9a7){return _0x23b9a7['destroy']()[_0x4c0d('0x32')](function(){var _0x2f5260=_0x23b9a7['get']({'plain':!![]});var _0x3ad1f8=_0x4c0d('0x33');return db[_0x4c0d('0x34')][_0x4c0d('0x35')]({'where':{'type':_0x3ad1f8,'resourceId':_0x2f5260['id']}})['then'](function(){return _0x23b9a7;});})['then'](function(){_0xf3ddeb[_0x4c0d('0x28')](0xcc)[_0x4c0d('0x36')]();});}};}function handleEntityNotFound(_0x2f84b1,_0x4cde32){return function(_0x139fec){if(!_0x139fec){_0x2f84b1[_0x4c0d('0x27')](0x194);}return _0x139fec;};}function handleError(_0x5c29d0,_0x220052){_0x220052=_0x220052||0x1f4;return function(_0x28a0ae){logger['error'](_0x28a0ae[_0x4c0d('0x37')]);if(_0x28a0ae[_0x4c0d('0x38')]){delete _0x28a0ae[_0x4c0d('0x38')];}_0x5c29d0[_0x4c0d('0x28')](_0x220052)['send'](_0x28a0ae);};}exports[_0x4c0d('0x39')]=function(_0x31a29f,_0x20ecd2){var _0x1f85dc={},_0x130197={},_0x5ae80b={'count':0x0,'rows':[]};var _0x1eb5f6=_['map'](db['VoiceContext']['rawAttributes'],function(_0x5e3471){return{'name':_0x5e3471['fieldName'],'type':_0x5e3471['type'][_0x4c0d('0x3a')]};});_0x130197[_0x4c0d('0x3b')]=_[_0x4c0d('0x3c')](_0x1eb5f6,_0x4c0d('0x38'));_0x130197[_0x4c0d('0x3d')]=_[_0x4c0d('0x3e')](_0x31a29f[_0x4c0d('0x3d')]);_0x130197['filters']=_[_0x4c0d('0x3f')](_0x130197[_0x4c0d('0x3b')],_0x130197[_0x4c0d('0x3d')]);_0x1f85dc[_0x4c0d('0x40')]=_[_0x4c0d('0x3f')](_0x130197['model'],qs[_0x4c0d('0x41')](_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x41')]));_0x1f85dc[_0x4c0d('0x40')]=_0x1f85dc[_0x4c0d('0x40')][_0x4c0d('0x42')]?_0x1f85dc[_0x4c0d('0x40')]:_0x130197[_0x4c0d('0x3b')];if(!_0x31a29f[_0x4c0d('0x3d')]['hasOwnProperty']('nolimit')){_0x1f85dc[_0x4c0d('0x2b')]=qs[_0x4c0d('0x2b')](_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x2b')]);_0x1f85dc[_0x4c0d('0x2a')]=qs[_0x4c0d('0x2a')](_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x2a')]);}_0x1f85dc[_0x4c0d('0x43')]=qs[_0x4c0d('0x44')](_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x44')]);_0x1f85dc[_0x4c0d('0x45')]=qs[_0x4c0d('0x46')](_[_0x4c0d('0x47')](_0x31a29f[_0x4c0d('0x3d')],_0x130197['filters']),_0x1eb5f6);if(_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x48')]){_0x1f85dc[_0x4c0d('0x45')]=_[_0x4c0d('0x49')](_0x1f85dc[_0x4c0d('0x45')],{'$or':_[_0x4c0d('0x3c')](_0x1eb5f6,function(_0xa991c9){if(_0xa991c9[_0x4c0d('0x4a')]!=='VIRTUAL'){var _0x334cbe={};_0x334cbe[_0xa991c9[_0x4c0d('0x38')]]={'$like':'%'+_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x48')]+'%'};return _0x334cbe;}})});}_0x1f85dc=_[_0x4c0d('0x49')]({},_0x1f85dc,_0x31a29f[_0x4c0d('0x4b')]);var _0x2387e7={'where':_0x1f85dc['where']};return db['VoiceContext'][_0x4c0d('0x2d')](_0x2387e7)['then'](function(_0x2ef759){_0x5ae80b[_0x4c0d('0x2d')]=_0x2ef759;if(_0x31a29f[_0x4c0d('0x3d')][_0x4c0d('0x4c')]){_0x1f85dc[_0x4c0d('0x4d')]=[{'all':!![]}];}return db[_0x4c0d('0x4e')][_0x4c0d('0x4f')](_0x1f85dc);})[_0x4c0d('0x32')](function(_0x37e00d){_0x5ae80b[_0x4c0d('0x50')]=_0x37e00d;return _0x5ae80b;})[_0x4c0d('0x32')](respondWithFilteredResult(_0x20ecd2,_0x1f85dc))[_0x4c0d('0x26')](handleError(_0x20ecd2,null));};exports['show']=function(_0x121e4e,_0xc51ffa){var _0x568893={'raw':![],'where':{'id':_0x121e4e[_0x4c0d('0x51')]['id']}},_0x3f731f={};_0x3f731f[_0x4c0d('0x3b')]=_[_0x4c0d('0x3e')](db['VoiceContext'][_0x4c0d('0x52')]);_0x3f731f['query']=_[_0x4c0d('0x3e')](_0x121e4e[_0x4c0d('0x3d')]);_0x3f731f[_0x4c0d('0x46')]=_[_0x4c0d('0x3f')](_0x3f731f[_0x4c0d('0x3b')],_0x3f731f[_0x4c0d('0x3d')]);_0x568893[_0x4c0d('0x40')]=_['intersection'](_0x3f731f['model'],qs[_0x4c0d('0x41')](_0x121e4e['query'][_0x4c0d('0x41')]));_0x568893[_0x4c0d('0x40')]=_0x568893['attributes'][_0x4c0d('0x42')]?_0x568893['attributes']:_0x3f731f['model'];if(_0x121e4e['query']['includeAll']){_0x568893[_0x4c0d('0x4d')]=[{'all':!![]}];}_0x568893=_['merge']({},_0x568893,_0x121e4e[_0x4c0d('0x4b')]);return db[_0x4c0d('0x4e')][_0x4c0d('0x53')](_0x568893)[_0x4c0d('0x32')](handleEntityNotFound(_0xc51ffa,null))[_0x4c0d('0x32')](respondWithResult(_0xc51ffa,null))[_0x4c0d('0x26')](handleError(_0xc51ffa,null));};exports[_0x4c0d('0x54')]=function(_0x38d347,_0x94f07,_0x17a3c8){var _0x32fc03;return db[_0x4c0d('0x4e')]['create'](_0x38d347[_0x4c0d('0x55')],{'raw':!![]})['then'](function(_0x29c6ee){_0x32fc03=_0x29c6ee;return db['VoiceContext'][_0x4c0d('0x4f')]({'raw':!![]});})[_0x4c0d('0x32')](function(_0x3733cd){var _0x4fc59b=fs['readFileSync'](path[_0x4c0d('0x56')](config['root'],_0x4c0d('0x57')),_0x4c0d('0x58'));var _0x555a65=ejs[_0x4c0d('0x59')](_0x4fc59b,{'contexts':_0x3733cd||[]});fs[_0x4c0d('0x5a')](_0x4c0d('0x5b'),_0x555a65);})[_0x4c0d('0x32')](function(){return respondWithRpcPromise(_0x4c0d('0x5c'),_0x4c0d('0x54'),{'module':_0x4c0d('0x5d')});})[_0x4c0d('0x32')](function(){var _0x942a1d=_0x38d347[_0x4c0d('0x5e')]['get']({'plain':!![]});if(!_0x942a1d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x942a1d['role']===_0x4c0d('0x5e')){var _0x314364=_0x32fc03[_0x4c0d('0x5f')]({'plain':!![]});return db[_0x4c0d('0x60')][_0x4c0d('0x53')]({'where':{'name':_0x4c0d('0x33'),'userProfileId':_0x942a1d[_0x4c0d('0x61')]},'raw':!![]})[_0x4c0d('0x32')](function(_0x1d38ff){if(_0x1d38ff&&_0x1d38ff[_0x4c0d('0x62')]===0x0){return db[_0x4c0d('0x34')][_0x4c0d('0x54')]({'name':_0x314364['name'],'resourceId':_0x314364['id'],'type':_0x1d38ff[_0x4c0d('0x38')],'sectionId':_0x1d38ff['id']},{})['then'](function(){return _0x32fc03;});}else{return _0x32fc03;}})[_0x4c0d('0x26')](function(_0x4bf3a7){logger[_0x4c0d('0x23')](_0x4c0d('0x63'),_0x4bf3a7);throw _0x4bf3a7;});}return _0x32fc03;})[_0x4c0d('0x32')](respondWithResult(_0x94f07,0xc9))[_0x4c0d('0x26')](handleError(_0x94f07,null));};exports[_0x4c0d('0x31')]=function(_0xc15bdc,_0x33354f,_0xda0984){var _0x461090;return db[_0x4c0d('0x4e')][_0x4c0d('0x53')]({'where':{'id':_0xc15bdc[_0x4c0d('0x51')]['id']}})[_0x4c0d('0x32')](handleEntityNotFound(_0x33354f,null))[_0x4c0d('0x32')](saveUpdates(_0xc15bdc[_0x4c0d('0x55')],null))[_0x4c0d('0x32')](function(_0x14fcef){if(_0x14fcef){_0x461090=_0x14fcef;return db[_0x4c0d('0x4e')][_0x4c0d('0x4f')]({'raw':!![]});}})[_0x4c0d('0x32')](function(_0x535430){var _0x4cd6e7=fs[_0x4c0d('0x64')](path[_0x4c0d('0x56')](config[_0x4c0d('0x65')],_0x4c0d('0x57')),_0x4c0d('0x58'));var _0x2abe09=ejs[_0x4c0d('0x59')](_0x4cd6e7,{'contexts':_0x535430||[]});fs[_0x4c0d('0x5a')](_0x4c0d('0x5b'),_0x2abe09);})[_0x4c0d('0x32')](function(){return respondWithRpcPromise(_0x4c0d('0x5c'),_0x4c0d('0x31'),{'module':_0x4c0d('0x5d')});})[_0x4c0d('0x32')](function(){return _0x461090;})[_0x4c0d('0x32')](respondWithResult(_0x33354f,null))[_0x4c0d('0x26')](handleError(_0x33354f,null));};exports['destroy']=function(_0x1366ef,_0x373aab,_0x1ed0fd){var _0x44585b;return db[_0x4c0d('0x4e')][_0x4c0d('0x53')]({'where':{'id':_0x1366ef[_0x4c0d('0x51')]['id']}})[_0x4c0d('0x32')](handleEntityNotFound(_0x373aab,null))[_0x4c0d('0x32')](removeEntity(_0x373aab,null))[_0x4c0d('0x32')](function(){return db[_0x4c0d('0x4e')]['findAll']({'raw':!![]});})[_0x4c0d('0x32')](function(_0x345313){var _0x4a8d44=fs[_0x4c0d('0x64')](path[_0x4c0d('0x56')](config[_0x4c0d('0x65')],_0x4c0d('0x57')),_0x4c0d('0x58'));var _0x2e5711=ejs[_0x4c0d('0x59')](_0x4a8d44,{'contexts':_0x345313});fs[_0x4c0d('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2e5711);return respondWithRpcPromise(_0x4c0d('0x5c'),_0x4c0d('0x35'),{'module':'chan_sip.so'});})[_0x4c0d('0x26')](handleError(_0x373aab,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 0fe6e61..de3f066 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 _0xa648=['exports','define','VoiceContext','voice_contexts','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4eb867,_0x356513){var _0x1e7684=function(_0x40c03d){while(--_0x40c03d){_0x4eb867['push'](_0x4eb867['shift']());}};_0x1e7684(++_0x356513);}(_0xa648,0xf6));var _0x8a64=function(_0x10be8b,_0x2e2bd5){_0x10be8b=_0x10be8b-0x0;var _0x128f11=_0xa648[_0x10be8b];return _0x128f11;};'use strict';var _=require(_0x8a64('0x0'));var util=require(_0x8a64('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8a64('0x2'));var BPromise=require(_0x8a64('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a64('0x4'));var rimraf=require(_0x8a64('0x5'));var config=require(_0x8a64('0x6'));var attributes=require('./voiceContext.attributes');module[_0x8a64('0x7')]=function(_0x5b4f9a,_0x39a0b9){return _0x5b4f9a[_0x8a64('0x8')](_0x8a64('0x9'),attributes,{'tableName':_0x8a64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ea4=['rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','util','api','moment','request-promise','path'];(function(_0x1dcaa3,_0x4601c6){var _0xf670fc=function(_0x27b6b7){while(--_0x27b6b7){_0x1dcaa3['push'](_0x1dcaa3['shift']());}};_0xf670fc(++_0x4601c6);}(_0x9ea4,0xc1));var _0x49ea=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9ea4[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x49ea('0x0'));var logger=require('../../config/logger')(_0x49ea('0x1'));var moment=require(_0x49ea('0x2'));var BPromise=require('bluebird');var rp=require(_0x49ea('0x3'));var fs=require('fs');var path=require(_0x49ea('0x4'));var rimraf=require(_0x49ea('0x5'));var config=require(_0x49ea('0x6'));var attributes=require(_0x49ea('0x7'));module[_0x49ea('0x8')]=function(_0x4df95f,_0x23032a){return _0x4df95f['define'](_0x49ea('0x9'),attributes,{'tableName':_0x49ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index ded86e8..ee02ee5 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 _0x2c64=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x394b25,_0x58bd27){var _0x273434=function(_0x15f746){while(--_0x15f746){_0x394b25['push'](_0x394b25['shift']());}};_0x273434(++_0x58bd27);}(_0x2c64,0x181));var _0x42c6=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x2c64[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x42c6('0x0'));var util=require(_0x42c6('0x1'));var moment=require('moment');var BPromise=require(_0x42c6('0x2'));var rs=require(_0x42c6('0x3'));var fs=require('fs');var Redis=require(_0x42c6('0x4'));var db=require(_0x42c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x42c6('0x6'));var config=require(_0x42c6('0x7'));var jayson=require(_0x42c6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58d2d0,_0x1d7439,_0x2c3d36){return new BPromise(function(_0x40abb6,_0x420503){return client[_0x42c6('0x9')](_0x58d2d0,_0x2c3d36)['then'](function(_0x373994){logger[_0x42c6('0xa')](_0x42c6('0xb'),_0x1d7439,'request\x20sent');logger[_0x42c6('0xc')](_0x42c6('0xd'),_0x1d7439,'request\x20sent',JSON[_0x42c6('0xe')](_0x373994));if(_0x373994[_0x42c6('0xf')]){if(_0x373994[_0x42c6('0xf')][_0x42c6('0x10')]===0x1f4){logger[_0x42c6('0xf')](_0x42c6('0xb'),_0x1d7439,_0x373994[_0x42c6('0xf')]['message']);return _0x420503(_0x373994[_0x42c6('0xf')][_0x42c6('0x11')]);}logger[_0x42c6('0xf')](_0x42c6('0xb'),_0x1d7439,_0x373994[_0x42c6('0xf')][_0x42c6('0x11')]);return _0x40abb6(_0x373994[_0x42c6('0xf')]['message']);}else{logger[_0x42c6('0xa')](_0x42c6('0xb'),_0x1d7439,_0x42c6('0x12'));_0x40abb6(_0x373994[_0x42c6('0x13')]['message']);}})[_0x42c6('0x14')](function(_0x4ee7e2){logger[_0x42c6('0xf')](_0x42c6('0xb'),_0x1d7439,_0x4ee7e2);_0x420503(_0x4ee7e2);});});} \ No newline at end of file +var _0x2e21=['request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b25d0,_0x50ee52){var _0x29dfe6=function(_0x34a53d){while(--_0x34a53d){_0x5b25d0['push'](_0x5b25d0['shift']());}};_0x29dfe6(++_0x50ee52);}(_0x2e21,0xba));var _0x12e2=function(_0x5185bf,_0x2a92a8){_0x5185bf=_0x5185bf-0x0;var _0x4fc5b0=_0x2e21[_0x5185bf];return _0x4fc5b0;};'use strict';var _=require(_0x12e2('0x0'));var util=require(_0x12e2('0x1'));var moment=require(_0x12e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x12e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12e2('0x4'))['db'];var utils=require(_0x12e2('0x5'));var logger=require(_0x12e2('0x6'))(_0x12e2('0x7'));var config=require(_0x12e2('0x8'));var jayson=require(_0x12e2('0x9'));var client=jayson[_0x12e2('0xa')][_0x12e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f52d6,_0x2a7059,_0x321e79){return new BPromise(function(_0x372494,_0x4a53a2){return client[_0x12e2('0xc')](_0x2f52d6,_0x321e79)['then'](function(_0xf7ae46){logger['info'](_0x12e2('0xd'),_0x2a7059,_0x12e2('0xe'));logger[_0x12e2('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2a7059,_0x12e2('0xe'),JSON[_0x12e2('0x10')](_0xf7ae46));if(_0xf7ae46['error']){if(_0xf7ae46[_0x12e2('0x11')]['code']===0x1f4){logger[_0x12e2('0x11')]('VoiceContext,\x20%s,\x20%s',_0x2a7059,_0xf7ae46[_0x12e2('0x11')][_0x12e2('0x12')]);return _0x4a53a2(_0xf7ae46[_0x12e2('0x11')][_0x12e2('0x12')]);}logger[_0x12e2('0x11')](_0x12e2('0xd'),_0x2a7059,_0xf7ae46[_0x12e2('0x11')][_0x12e2('0x12')]);return _0x372494(_0xf7ae46[_0x12e2('0x11')]['message']);}else{logger[_0x12e2('0x13')](_0x12e2('0xd'),_0x2a7059,_0x12e2('0xe'));_0x372494(_0xf7ae46[_0x12e2('0x14')][_0x12e2('0x12')]);}})[_0x12e2('0x15')](function(_0x18e557){logger[_0x12e2('0x11')](_0x12e2('0xd'),_0x2a7059,_0x18e557);_0x4a53a2(_0x18e557);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c790de2..9967483 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 _0xf195=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','index','get','describe'];(function(_0x22dc6e,_0x537131){var _0x2024b8=function(_0x21ae4f){while(--_0x21ae4f){_0x22dc6e['push'](_0x22dc6e['shift']());}};_0x2024b8(++_0x537131);}(_0xf195,0x7f));var _0x5f19=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0xf195[_0x1d7037];return _0x4d6568;};'use strict';var multer=require(_0x5f19('0x0'));var util=require(_0x5f19('0x1'));var path=require(_0x5f19('0x2'));var timeout=require(_0x5f19('0x3'));var express=require(_0x5f19('0x4'));var router=express[_0x5f19('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5f19('0x6'));var interaction=require(_0x5f19('0x7'));var config=require('../../config/environment');var controller=require(_0x5f19('0x8'));router['get']('/',auth[_0x5f19('0x9')](),controller[_0x5f19('0xa')]);router[_0x5f19('0xb')]('/describe',auth[_0x5f19('0x9')](),controller[_0x5f19('0xc')]);router[_0x5f19('0xb')]('/:id',auth[_0x5f19('0x9')](),controller[_0x5f19('0xd')]);router[_0x5f19('0xe')]('/',auth[_0x5f19('0x9')](),controller[_0x5f19('0xf')]);router[_0x5f19('0x10')](_0x5f19('0x11'),auth[_0x5f19('0x9')](),controller[_0x5f19('0x12')]);router['delete']('/:id',auth[_0x5f19('0x9')](),controller[_0x5f19('0x13')]);module['exports']=router; \ No newline at end of file +var _0x46a4=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x5b9692,_0x1e4e4c){var _0x4a32f0=function(_0x234655){while(--_0x234655){_0x5b9692['push'](_0x5b9692['shift']());}};_0x4a32f0(++_0x1e4e4c);}(_0x46a4,0x190));var _0x446a=function(_0x2cb98f,_0x111ee0){_0x2cb98f=_0x2cb98f-0x0;var _0xd77c55=_0x46a4[_0x2cb98f];return _0xd77c55;};'use strict';var multer=require(_0x446a('0x0'));var util=require(_0x446a('0x1'));var path=require('path');var timeout=require(_0x446a('0x2'));var express=require(_0x446a('0x3'));var router=express[_0x446a('0x4')]();var fs_extra=require(_0x446a('0x5'));var auth=require(_0x446a('0x6'));var interaction=require(_0x446a('0x7'));var config=require(_0x446a('0x8'));var controller=require('./voiceDialReport.controller');router[_0x446a('0x9')]('/',auth['isAuthenticated'](),controller[_0x446a('0xa')]);router[_0x446a('0x9')](_0x446a('0xb'),auth[_0x446a('0xc')](),controller[_0x446a('0xd')]);router[_0x446a('0x9')](_0x446a('0xe'),auth[_0x446a('0xc')](),controller[_0x446a('0xf')]);router[_0x446a('0x10')]('/',auth[_0x446a('0xc')](),controller[_0x446a('0x11')]);router[_0x446a('0x12')](_0x446a('0xe'),auth[_0x446a('0xc')](),controller[_0x446a('0x13')]);router[_0x446a('0x14')](_0x446a('0xe'),auth[_0x446a('0xc')](),controller[_0x446a('0x15')]);module[_0x446a('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f436b66..749b280 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 _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x37ea6e,_0x5f46d9){var _0x534652=function(_0x5bf9c6){while(--_0x5bf9c6){_0x37ea6e['push'](_0x37ea6e['shift']());}};_0x534652(++_0x5f46d9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xf3cd[_0x13b7fd];return _0x32a74a;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 828e59a..52ffb2b 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 _0xc706=['bluebird','mustache','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','fast-json-patch','moment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc706,0x19c));var _0x6c70=function(_0x1582ba,_0x37b6b2){_0x1582ba=_0x1582ba-0x0;var _0xf4e3ed=_0xc706[_0x1582ba];return _0xf4e3ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6c70('0x0'));var rp=require('request-promise');var moment=require(_0x6c70('0x1'));var BPromise=require(_0x6c70('0x2'));var Mustache=require(_0x6c70('0x3'));var util=require('util');var path=require(_0x6c70('0x4'));var sox=require('sox');var csv=require(_0x6c70('0x5'));var ejs=require(_0x6c70('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6c70('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x6c70('0x8'));var toCsv=require('to-csv');var querystring=require(_0x6c70('0x9'));var Papa=require(_0x6c70('0xa'));var Redis=require(_0x6c70('0xb'));var authService=require(_0x6c70('0xc'));var qs=require(_0x6c70('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c70('0xe'));var logger=require(_0x6c70('0xf'))('api');var utils=require(_0x6c70('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x6c70('0x11'));var db=require(_0x6c70('0x12'))['db'];function respondWithStatusCode(_0xb4ac0f,_0x2a8f5e){_0x2a8f5e=_0x2a8f5e||0xcc;return function(_0x3d4fd6){if(_0x3d4fd6){return _0xb4ac0f[_0x6c70('0x13')](_0x2a8f5e);}return _0xb4ac0f[_0x6c70('0x14')](_0x2a8f5e)[_0x6c70('0x15')]();};}function respondWithResult(_0x1a0486,_0x4000c2){_0x4000c2=_0x4000c2||0xc8;return function(_0x3de1e8){if(_0x3de1e8){return _0x1a0486[_0x6c70('0x14')](_0x4000c2)[_0x6c70('0x16')](_0x3de1e8);}};}function respondWithFilteredResult(_0x4cbeaf,_0x2051a1){return function(_0x15a07c){if(_0x15a07c){var _0x402d20=typeof _0x2051a1[_0x6c70('0x17')]===_0x6c70('0x18')&&typeof _0x2051a1[_0x6c70('0x19')]==='undefined';var _0x29ffaa=_0x15a07c[_0x6c70('0x1a')];var _0x56f12e=_0x402d20?0x0:_0x2051a1['offset'];var _0x382672=_0x402d20?_0x15a07c[_0x6c70('0x1a')]:_0x2051a1[_0x6c70('0x17')]+_0x2051a1[_0x6c70('0x19')];var _0x228334;if(_0x382672>=_0x29ffaa){_0x382672=_0x29ffaa;_0x228334=0xc8;}else{_0x228334=0xce;}_0x4cbeaf[_0x6c70('0x14')](_0x228334);return _0x4cbeaf[_0x6c70('0x1b')]('Content-Range',_0x56f12e+'-'+_0x382672+'/'+_0x29ffaa)[_0x6c70('0x16')](_0x15a07c);}return null;};}function patchUpdates(_0x5a4a8e){return function(_0x19fd9f){try{jsonpatch['apply'](_0x19fd9f,_0x5a4a8e,!![]);}catch(_0x4f22ad){return BPromise[_0x6c70('0x1c')](_0x4f22ad);}return _0x19fd9f[_0x6c70('0x1d')]();};}function saveUpdates(_0x294694,_0x65f8a5){return function(_0x4b3465){if(_0x4b3465){return _0x4b3465[_0x6c70('0x1e')](_0x294694)[_0x6c70('0x1f')](function(_0x222105){return _0x222105;});}return null;};}function removeEntity(_0x20bef1,_0x533209){return function(_0x417963){if(_0x417963){return _0x417963[_0x6c70('0x20')]()['then'](function(){_0x20bef1['status'](0xcc)[_0x6c70('0x15')]();});}};}function handleEntityNotFound(_0x1189a9,_0x40274a){return function(_0x3f3ce4){if(!_0x3f3ce4){_0x1189a9[_0x6c70('0x13')](0x194);}return _0x3f3ce4;};}function handleError(_0x43ef1d,_0x12f17f){_0x12f17f=_0x12f17f||0x1f4;return function(_0x544417){logger[_0x6c70('0x21')](_0x544417[_0x6c70('0x22')]);if(_0x544417[_0x6c70('0x23')]){delete _0x544417[_0x6c70('0x23')];}_0x43ef1d[_0x6c70('0x14')](_0x12f17f)[_0x6c70('0x24')](_0x544417);};}exports[_0x6c70('0x25')]=function(_0x32a68f,_0x481fda){var _0x3194b5={},_0x3ba79e={},_0x253da4={'count':0x0,'rows':[]};var _0x34ffbb=_[_0x6c70('0x26')](db[_0x6c70('0x27')][_0x6c70('0x28')],function(_0x2e4367){return{'name':_0x2e4367['fieldName'],'type':_0x2e4367[_0x6c70('0x29')]['key']};});_0x3ba79e['model']=_[_0x6c70('0x26')](_0x34ffbb,_0x6c70('0x23'));_0x3ba79e['query']=_['keys'](_0x32a68f[_0x6c70('0x2a')]);_0x3ba79e[_0x6c70('0x2b')]=_[_0x6c70('0x2c')](_0x3ba79e[_0x6c70('0x2d')],_0x3ba79e[_0x6c70('0x2a')]);_0x3194b5['attributes']=_['intersection'](_0x3ba79e['model'],qs[_0x6c70('0x2e')](_0x32a68f[_0x6c70('0x2a')]['fields']));_0x3194b5[_0x6c70('0x2f')]=_0x3194b5[_0x6c70('0x2f')][_0x6c70('0x30')]?_0x3194b5[_0x6c70('0x2f')]:_0x3ba79e['model'];if(!_0x32a68f[_0x6c70('0x2a')][_0x6c70('0x31')](_0x6c70('0x32'))){_0x3194b5[_0x6c70('0x19')]=qs[_0x6c70('0x19')](_0x32a68f[_0x6c70('0x2a')][_0x6c70('0x19')]);_0x3194b5['offset']=qs[_0x6c70('0x17')](_0x32a68f[_0x6c70('0x2a')]['offset']);}_0x3194b5['order']=qs[_0x6c70('0x33')](_0x32a68f[_0x6c70('0x2a')][_0x6c70('0x33')]);_0x3194b5[_0x6c70('0x34')]=qs[_0x6c70('0x2b')](_['pick'](_0x32a68f[_0x6c70('0x2a')],_0x3ba79e[_0x6c70('0x2b')]),_0x34ffbb);if(_0x32a68f[_0x6c70('0x2a')][_0x6c70('0x35')]){_0x3194b5['where']=_[_0x6c70('0x36')](_0x3194b5[_0x6c70('0x34')],{'$or':_[_0x6c70('0x26')](_0x34ffbb,function(_0x416400){if(_0x416400['type']!==_0x6c70('0x37')){var _0xe9fd13={};_0xe9fd13[_0x416400[_0x6c70('0x23')]]={'$like':'%'+_0x32a68f[_0x6c70('0x2a')][_0x6c70('0x35')]+'%'};return _0xe9fd13;}})});}_0x3194b5=_[_0x6c70('0x36')]({},_0x3194b5,_0x32a68f[_0x6c70('0x38')]);var _0x557f89={'where':_0x3194b5[_0x6c70('0x34')]};return db[_0x6c70('0x27')]['count'](_0x557f89)['then'](function(_0x3f53c7){_0x253da4[_0x6c70('0x1a')]=_0x3f53c7;if(_0x32a68f[_0x6c70('0x2a')][_0x6c70('0x39')]){_0x3194b5[_0x6c70('0x3a')]=[{'all':!![]}];}return db[_0x6c70('0x27')][_0x6c70('0x3b')](_0x3194b5);})['then'](function(_0x566b5e){_0x253da4[_0x6c70('0x3c')]=_0x566b5e;return _0x253da4;})[_0x6c70('0x1f')](respondWithFilteredResult(_0x481fda,_0x3194b5))[_0x6c70('0x3d')](handleError(_0x481fda,null));};exports[_0x6c70('0x3e')]=function(_0x2629bf,_0x3321c8){var _0x33ceb1={'raw':!![],'where':{'id':_0x2629bf['params']['id']}},_0x39088f={};_0x39088f[_0x6c70('0x2d')]=_['keys'](db[_0x6c70('0x27')][_0x6c70('0x28')]);_0x39088f[_0x6c70('0x2a')]=_[_0x6c70('0x3f')](_0x2629bf[_0x6c70('0x2a')]);_0x39088f[_0x6c70('0x2b')]=_[_0x6c70('0x2c')](_0x39088f[_0x6c70('0x2d')],_0x39088f[_0x6c70('0x2a')]);_0x33ceb1[_0x6c70('0x2f')]=_['intersection'](_0x39088f['model'],qs['fields'](_0x2629bf[_0x6c70('0x2a')][_0x6c70('0x2e')]));_0x33ceb1[_0x6c70('0x2f')]=_0x33ceb1[_0x6c70('0x2f')][_0x6c70('0x30')]?_0x33ceb1['attributes']:_0x39088f[_0x6c70('0x2d')];if(_0x2629bf['query'][_0x6c70('0x39')]){_0x33ceb1[_0x6c70('0x3a')]=[{'all':!![]}];}_0x33ceb1=_[_0x6c70('0x36')]({},_0x33ceb1,_0x2629bf[_0x6c70('0x38')]);return db['VoiceDialReport'][_0x6c70('0x40')](_0x33ceb1)[_0x6c70('0x1f')](handleEntityNotFound(_0x3321c8,null))[_0x6c70('0x1f')](respondWithResult(_0x3321c8,null))[_0x6c70('0x3d')](handleError(_0x3321c8,null));};exports['create']=function(_0x34d355,_0x1b49a6){return db[_0x6c70('0x27')][_0x6c70('0x41')](_0x34d355[_0x6c70('0x42')],{})[_0x6c70('0x1f')](respondWithResult(_0x1b49a6,0xc9))[_0x6c70('0x3d')](handleError(_0x1b49a6,null));};exports[_0x6c70('0x1e')]=function(_0x36ce7a,_0x3d1c88){if(_0x36ce7a[_0x6c70('0x42')]['id']){delete _0x36ce7a['body']['id'];}return db[_0x6c70('0x27')][_0x6c70('0x40')]({'where':{'id':_0x36ce7a[_0x6c70('0x43')]['id']}})[_0x6c70('0x1f')](handleEntityNotFound(_0x3d1c88,null))[_0x6c70('0x1f')](saveUpdates(_0x36ce7a['body'],null))[_0x6c70('0x1f')](respondWithResult(_0x3d1c88,null))[_0x6c70('0x3d')](handleError(_0x3d1c88,null));};exports[_0x6c70('0x20')]=function(_0x531873,_0x1f07d1){return db['VoiceDialReport'][_0x6c70('0x40')]({'where':{'id':_0x531873[_0x6c70('0x43')]['id']}})[_0x6c70('0x1f')](handleEntityNotFound(_0x1f07d1,null))[_0x6c70('0x1f')](removeEntity(_0x1f07d1,null))[_0x6c70('0x3d')](handleError(_0x1f07d1,null));};exports['describe']=function(_0x1a27c2,_0x1b6449){return db[_0x6c70('0x27')][_0x6c70('0x44')]()[_0x6c70('0x1f')](respondWithResult(_0x1b6449,null))[_0x6c70('0x3d')](handleError(_0x1b6449,null));}; \ No newline at end of file +var _0x9c60=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c60,0x164));var _0x09c6=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c60[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require(_0x09c6('0x0'));var rimraf=require(_0x09c6('0x1'));var zipdir=require(_0x09c6('0x2'));var jsonpatch=require(_0x09c6('0x3'));var rp=require(_0x09c6('0x4'));var moment=require(_0x09c6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x09c6('0x6'));var path=require(_0x09c6('0x7'));var sox=require(_0x09c6('0x8'));var csv=require(_0x09c6('0x9'));var ejs=require(_0x09c6('0xa'));var fs=require('fs');var fs_extra=require(_0x09c6('0xb'));var _=require(_0x09c6('0xc'));var squel=require(_0x09c6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x09c6('0xe'));var toCsv=require(_0x09c6('0x9'));var querystring=require(_0x09c6('0xf'));var Papa=require(_0x09c6('0x10'));var Redis=require(_0x09c6('0x11'));var authService=require(_0x09c6('0x12'));var qs=require(_0x09c6('0x13'));var as=require(_0x09c6('0x14'));var hardwareService=require(_0x09c6('0x15'));var logger=require(_0x09c6('0x16'))(_0x09c6('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x09c6('0x18'));var db=require(_0x09c6('0x19'))['db'];function respondWithStatusCode(_0x69c292,_0x5adeb9){_0x5adeb9=_0x5adeb9||0xcc;return function(_0x25f31c){if(_0x25f31c){return _0x69c292['sendStatus'](_0x5adeb9);}return _0x69c292[_0x09c6('0x1a')](_0x5adeb9)[_0x09c6('0x1b')]();};}function respondWithResult(_0x3e80a6,_0x12095c){_0x12095c=_0x12095c||0xc8;return function(_0x42a222){if(_0x42a222){return _0x3e80a6[_0x09c6('0x1a')](_0x12095c)[_0x09c6('0x1c')](_0x42a222);}};}function respondWithFilteredResult(_0x5c8959,_0x30fb56){return function(_0x506bbd){if(_0x506bbd){var _0x575124=typeof _0x30fb56[_0x09c6('0x1d')]===_0x09c6('0x1e')&&typeof _0x30fb56['limit']===_0x09c6('0x1e');var _0x272580=_0x506bbd[_0x09c6('0x1f')];var _0x2ad2ff=_0x575124?0x0:_0x30fb56[_0x09c6('0x1d')];var _0x4dd5f2=_0x575124?_0x506bbd[_0x09c6('0x1f')]:_0x30fb56[_0x09c6('0x1d')]+_0x30fb56['limit'];var _0x16c5e7;if(_0x4dd5f2>=_0x272580){_0x4dd5f2=_0x272580;_0x16c5e7=0xc8;}else{_0x16c5e7=0xce;}_0x5c8959[_0x09c6('0x1a')](_0x16c5e7);return _0x5c8959[_0x09c6('0x20')]('Content-Range',_0x2ad2ff+'-'+_0x4dd5f2+'/'+_0x272580)[_0x09c6('0x1c')](_0x506bbd);}return null;};}function patchUpdates(_0x1c1173){return function(_0x532d74){try{jsonpatch[_0x09c6('0x21')](_0x532d74,_0x1c1173,!![]);}catch(_0x346e34){return BPromise[_0x09c6('0x22')](_0x346e34);}return _0x532d74[_0x09c6('0x23')]();};}function saveUpdates(_0x1c5d75,_0x4c2b34){return function(_0x3e8a6b){if(_0x3e8a6b){return _0x3e8a6b[_0x09c6('0x24')](_0x1c5d75)[_0x09c6('0x25')](function(_0x3dc051){return _0x3dc051;});}return null;};}function removeEntity(_0x57f4ae,_0x1e7e3f){return function(_0x3ff04d){if(_0x3ff04d){return _0x3ff04d['destroy']()['then'](function(){_0x57f4ae[_0x09c6('0x1a')](0xcc)[_0x09c6('0x1b')]();});}};}function handleEntityNotFound(_0x4c6040,_0x3563f5){return function(_0x114660){if(!_0x114660){_0x4c6040['sendStatus'](0x194);}return _0x114660;};}function handleError(_0x5793ef,_0x83706d){_0x83706d=_0x83706d||0x1f4;return function(_0x49628d){logger[_0x09c6('0x26')](_0x49628d[_0x09c6('0x27')]);if(_0x49628d[_0x09c6('0x28')]){delete _0x49628d[_0x09c6('0x28')];}_0x5793ef['status'](_0x83706d)[_0x09c6('0x29')](_0x49628d);};}exports['index']=function(_0x477062,_0x182433){var _0x32f079={},_0xe2e13={},_0x428ed7={'count':0x0,'rows':[]};var _0x44383b=_['map'](db[_0x09c6('0x2a')][_0x09c6('0x2b')],function(_0x2712df){return{'name':_0x2712df[_0x09c6('0x2c')],'type':_0x2712df[_0x09c6('0x2d')][_0x09c6('0x2e')]};});_0xe2e13[_0x09c6('0x2f')]=_['map'](_0x44383b,_0x09c6('0x28'));_0xe2e13[_0x09c6('0x30')]=_[_0x09c6('0x31')](_0x477062['query']);_0xe2e13['filters']=_['intersection'](_0xe2e13[_0x09c6('0x2f')],_0xe2e13['query']);_0x32f079[_0x09c6('0x32')]=_[_0x09c6('0x33')](_0xe2e13[_0x09c6('0x2f')],qs[_0x09c6('0x34')](_0x477062[_0x09c6('0x30')][_0x09c6('0x34')]));_0x32f079[_0x09c6('0x32')]=_0x32f079['attributes']['length']?_0x32f079['attributes']:_0xe2e13[_0x09c6('0x2f')];if(!_0x477062['query'][_0x09c6('0x35')](_0x09c6('0x36'))){_0x32f079[_0x09c6('0x37')]=qs[_0x09c6('0x37')](_0x477062[_0x09c6('0x30')]['limit']);_0x32f079[_0x09c6('0x1d')]=qs[_0x09c6('0x1d')](_0x477062[_0x09c6('0x30')][_0x09c6('0x1d')]);}_0x32f079['order']=qs[_0x09c6('0x38')](_0x477062[_0x09c6('0x30')][_0x09c6('0x38')]);_0x32f079[_0x09c6('0x39')]=qs['filters'](_[_0x09c6('0x3a')](_0x477062['query'],_0xe2e13['filters']),_0x44383b);if(_0x477062[_0x09c6('0x30')][_0x09c6('0x3b')]){_0x32f079[_0x09c6('0x39')]=_['merge'](_0x32f079[_0x09c6('0x39')],{'$or':_[_0x09c6('0x3c')](_0x44383b,function(_0x14eb54){if(_0x14eb54['type']!==_0x09c6('0x3d')){var _0x351587={};_0x351587[_0x14eb54[_0x09c6('0x28')]]={'$like':'%'+_0x477062[_0x09c6('0x30')]['filter']+'%'};return _0x351587;}})});}_0x32f079=_['merge']({},_0x32f079,_0x477062[_0x09c6('0x3e')]);var _0x19cccb={'where':_0x32f079[_0x09c6('0x39')]};return db['VoiceDialReport'][_0x09c6('0x1f')](_0x19cccb)[_0x09c6('0x25')](function(_0x3536e6){_0x428ed7[_0x09c6('0x1f')]=_0x3536e6;if(_0x477062[_0x09c6('0x30')][_0x09c6('0x3f')]){_0x32f079[_0x09c6('0x40')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x09c6('0x41')](_0x32f079);})[_0x09c6('0x25')](function(_0x2718d8){_0x428ed7[_0x09c6('0x42')]=_0x2718d8;return _0x428ed7;})[_0x09c6('0x25')](respondWithFilteredResult(_0x182433,_0x32f079))[_0x09c6('0x43')](handleError(_0x182433,null));};exports[_0x09c6('0x44')]=function(_0x398e0f,_0x1b12b3){var _0x4342fe={'raw':!![],'where':{'id':_0x398e0f[_0x09c6('0x45')]['id']}},_0x470d1a={};_0x470d1a[_0x09c6('0x2f')]=_[_0x09c6('0x31')](db[_0x09c6('0x2a')][_0x09c6('0x2b')]);_0x470d1a[_0x09c6('0x30')]=_[_0x09c6('0x31')](_0x398e0f[_0x09c6('0x30')]);_0x470d1a['filters']=_[_0x09c6('0x33')](_0x470d1a[_0x09c6('0x2f')],_0x470d1a['query']);_0x4342fe['attributes']=_[_0x09c6('0x33')](_0x470d1a['model'],qs[_0x09c6('0x34')](_0x398e0f[_0x09c6('0x30')]['fields']));_0x4342fe[_0x09c6('0x32')]=_0x4342fe[_0x09c6('0x32')]['length']?_0x4342fe[_0x09c6('0x32')]:_0x470d1a[_0x09c6('0x2f')];if(_0x398e0f[_0x09c6('0x30')][_0x09c6('0x3f')]){_0x4342fe['include']=[{'all':!![]}];}_0x4342fe=_[_0x09c6('0x46')]({},_0x4342fe,_0x398e0f[_0x09c6('0x3e')]);return db[_0x09c6('0x2a')][_0x09c6('0x47')](_0x4342fe)['then'](handleEntityNotFound(_0x1b12b3,null))['then'](respondWithResult(_0x1b12b3,null))[_0x09c6('0x43')](handleError(_0x1b12b3,null));};exports['create']=function(_0x4b9ed6,_0x34e6cc){return db['VoiceDialReport']['create'](_0x4b9ed6[_0x09c6('0x48')],{})[_0x09c6('0x25')](respondWithResult(_0x34e6cc,0xc9))['catch'](handleError(_0x34e6cc,null));};exports[_0x09c6('0x24')]=function(_0x366937,_0x560237){if(_0x366937[_0x09c6('0x48')]['id']){delete _0x366937[_0x09c6('0x48')]['id'];}return db[_0x09c6('0x2a')]['find']({'where':{'id':_0x366937[_0x09c6('0x45')]['id']}})[_0x09c6('0x25')](handleEntityNotFound(_0x560237,null))[_0x09c6('0x25')](saveUpdates(_0x366937[_0x09c6('0x48')],null))[_0x09c6('0x25')](respondWithResult(_0x560237,null))[_0x09c6('0x43')](handleError(_0x560237,null));};exports[_0x09c6('0x49')]=function(_0x5b4f73,_0x3b9c9c){return db['VoiceDialReport'][_0x09c6('0x47')]({'where':{'id':_0x5b4f73[_0x09c6('0x45')]['id']}})[_0x09c6('0x25')](handleEntityNotFound(_0x3b9c9c,null))[_0x09c6('0x25')](removeEntity(_0x3b9c9c,null))[_0x09c6('0x43')](handleError(_0x3b9c9c,null));};exports[_0x09c6('0x4a')]=function(_0x42f17a,_0x37c2d0){return db[_0x09c6('0x2a')]['describe']()['then'](respondWithResult(_0x37c2d0,null))[_0x09c6('0x43')](handleError(_0x37c2d0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 595233c..d3f5589 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 _0x954d=['rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','uniqueid','api','moment','bluebird','request-promise'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x954d,0x196));var _0xd954=function(_0xaa9204,_0x163a47){_0xaa9204=_0xaa9204-0x0;var _0x1e39f8=_0x954d[_0xaa9204];return _0x1e39f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd954('0x0'));var moment=require(_0xd954('0x1'));var BPromise=require(_0xd954('0x2'));var rp=require(_0xd954('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd954('0x4'));var config=require(_0xd954('0x5'));var attributes=require(_0xd954('0x6'));module['exports']=function(_0x53e385,_0x57382b){return _0x53e385[_0xd954('0x7')](_0xd954('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xd954('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1229=['define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','moment','path','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x44ea9c,_0x24e9dd){var _0x389df9=function(_0x2c83f3){while(--_0x2c83f3){_0x44ea9c['push'](_0x44ea9c['shift']());}};_0x389df9(++_0x24e9dd);}(_0x1229,0xac));var _0x9122=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x1229[_0x28aea5];return _0x6a55f9;};'use strict';var _=require('lodash');var util=require(_0x9122('0x0'));var logger=require(_0x9122('0x1'))(_0x9122('0x2'));var moment=require(_0x9122('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9122('0x4'));var rimraf=require('rimraf');var config=require(_0x9122('0x5'));var attributes=require(_0x9122('0x6'));module[_0x9122('0x7')]=function(_0x4c3994,_0x165c75){return _0x4c3994[_0x9122('0x8')](_0x9122('0x9'),attributes,{'tableName':_0x9122('0xa'),'paranoid':![],'indexes':[{'fields':[_0x9122('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 435dcf2..7a515cb 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 _0x8fff=['UpdateVoiceDialReport','update','raw','where','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateVoiceDialReport','VoiceDialReport','body','options','catch'];(function(_0xe275cf,_0x213b9b){var _0x648160=function(_0x1441c4){while(--_0x1441c4){_0xe275cf['push'](_0xe275cf['shift']());}};_0x648160(++_0x213b9b);}(_0x8fff,0xfd));var _0xf8ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf8ff('0x0'));var util=require(_0xf8ff('0x1'));var moment=require('moment');var BPromise=require(_0xf8ff('0x2'));var rs=require(_0xf8ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8ff('0x4'))['db'];var utils=require(_0xf8ff('0x5'));var logger=require(_0xf8ff('0x6'))('rpc');var config=require(_0xf8ff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf8ff('0x8')][_0xf8ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4908b6,_0x1410fe,_0x365727){return new BPromise(function(_0x5335e3,_0x1ea582){return client[_0xf8ff('0xa')](_0x4908b6,_0x365727)[_0xf8ff('0xb')](function(_0x3a4f70){logger[_0xf8ff('0xc')](_0xf8ff('0xd'),_0x1410fe,_0xf8ff('0xe'));logger[_0xf8ff('0xf')](_0xf8ff('0x10'),_0x1410fe,_0xf8ff('0xe'),JSON[_0xf8ff('0x11')](_0x3a4f70));if(_0x3a4f70[_0xf8ff('0x12')]){if(_0x3a4f70[_0xf8ff('0x12')]['code']===0x1f4){logger[_0xf8ff('0x12')](_0xf8ff('0xd'),_0x1410fe,_0x3a4f70[_0xf8ff('0x12')][_0xf8ff('0x13')]);return _0x1ea582(_0x3a4f70['error'][_0xf8ff('0x13')]);}logger['error'](_0xf8ff('0xd'),_0x1410fe,_0x3a4f70[_0xf8ff('0x12')][_0xf8ff('0x13')]);return _0x5335e3(_0x3a4f70['error'][_0xf8ff('0x13')]);}else{logger[_0xf8ff('0xc')](_0xf8ff('0xd'),_0x1410fe,_0xf8ff('0xe'));_0x5335e3(_0x3a4f70[_0xf8ff('0x14')][_0xf8ff('0x13')]);}})['catch'](function(_0x41cc11){logger[_0xf8ff('0x12')](_0xf8ff('0xd'),_0x1410fe,_0x41cc11);_0x1ea582(_0x41cc11);});});}exports[_0xf8ff('0x15')]=function(_0xdd1c7d){var _0x1a6fcf=this;return new Promise(function(_0x27abd3,_0x3f8b85){return db[_0xf8ff('0x16')]['create'](_0xdd1c7d[_0xf8ff('0x17')],{'raw':_0xdd1c7d[_0xf8ff('0x18')]?_0xdd1c7d[_0xf8ff('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf8ff('0xb')](function(_0x3f6fe8){logger[_0xf8ff('0xc')](_0xf8ff('0x15'),_0xdd1c7d);logger[_0xf8ff('0xf')](_0xf8ff('0x15'),_0xdd1c7d,JSON[_0xf8ff('0x11')](_0x3f6fe8));_0x27abd3(_0x3f6fe8);})[_0xf8ff('0x19')](function(_0x180bfb){logger[_0xf8ff('0x12')](_0xf8ff('0x15'),_0x180bfb['message'],_0xdd1c7d);_0x3f8b85(_0x1a6fcf[_0xf8ff('0x12')](0x1f4,_0x180bfb[_0xf8ff('0x13')]));});});};exports[_0xf8ff('0x1a')]=function(_0x284f7f){var _0x3be982=this;return new Promise(function(_0x42b496,_0x32158c){return db[_0xf8ff('0x16')][_0xf8ff('0x1b')](_0x284f7f['body'],{'raw':_0x284f7f[_0xf8ff('0x18')]?_0x284f7f['options'][_0xf8ff('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x284f7f[_0xf8ff('0x18')]?_0x284f7f['options'][_0xf8ff('0x1d')]||null:null,'attributes':_0x284f7f[_0xf8ff('0x18')]?_0x284f7f[_0xf8ff('0x18')]['attributes']||null:null,'limit':_0x284f7f[_0xf8ff('0x18')]?_0x284f7f['options'][_0xf8ff('0x1e')]||null:null})[_0xf8ff('0xb')](function(_0x3b3194){logger[_0xf8ff('0xc')](_0xf8ff('0x1a'),_0x284f7f);logger['debug'](_0xf8ff('0x1a'),_0x284f7f,JSON['stringify'](_0x3b3194));_0x42b496(_0x3b3194);})['catch'](function(_0x47930b){logger[_0xf8ff('0x12')](_0xf8ff('0x1a'),_0x47930b[_0xf8ff('0x13')],_0x284f7f);_0x32158c(_0x3be982[_0xf8ff('0x12')](0x1f4,_0x47930b['message']));});});}; \ No newline at end of file +var _0xe9e7=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','body','raw','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','options','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x2be80c,_0x53be5b){var _0x4ceb09=function(_0x3df184){while(--_0x3df184){_0x2be80c['push'](_0x2be80c['shift']());}};_0x4ceb09(++_0x53be5b);}(_0xe9e7,0xbf));var _0x7e9e=function(_0x46b20d,_0x5866c0){_0x46b20d=_0x46b20d-0x0;var _0x5e5c5b=_0xe9e7[_0x46b20d];return _0x5e5c5b;};'use strict';var _=require(_0x7e9e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e9e('0x1'));var rs=require(_0x7e9e('0x2'));var fs=require('fs');var Redis=require(_0x7e9e('0x3'));var db=require(_0x7e9e('0x4'))['db'];var utils=require(_0x7e9e('0x5'));var logger=require(_0x7e9e('0x6'))(_0x7e9e('0x7'));var config=require(_0x7e9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7e9e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e322c,_0x29d0f5,_0x1ee48c){return new BPromise(function(_0x88ce31,_0x5de9d8){return client['request'](_0x5e322c,_0x1ee48c)[_0x7e9e('0xa')](function(_0x13cf17){logger[_0x7e9e('0xb')](_0x7e9e('0xc'),_0x29d0f5,_0x7e9e('0xd'));logger[_0x7e9e('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x29d0f5,'request\x20sent',JSON[_0x7e9e('0xf')](_0x13cf17));if(_0x13cf17[_0x7e9e('0x10')]){if(_0x13cf17['error'][_0x7e9e('0x11')]===0x1f4){logger[_0x7e9e('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x29d0f5,_0x13cf17[_0x7e9e('0x10')][_0x7e9e('0x12')]);return _0x5de9d8(_0x13cf17['error'][_0x7e9e('0x12')]);}logger[_0x7e9e('0x10')](_0x7e9e('0xc'),_0x29d0f5,_0x13cf17[_0x7e9e('0x10')][_0x7e9e('0x12')]);return _0x88ce31(_0x13cf17[_0x7e9e('0x10')][_0x7e9e('0x12')]);}else{logger[_0x7e9e('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x29d0f5,_0x7e9e('0xd'));_0x88ce31(_0x13cf17[_0x7e9e('0x13')][_0x7e9e('0x12')]);}})[_0x7e9e('0x14')](function(_0x3f14df){logger[_0x7e9e('0x10')](_0x7e9e('0xc'),_0x29d0f5,_0x3f14df);_0x5de9d8(_0x3f14df);});});}exports['CreateVoiceDialReport']=function(_0x285f1f){var _0x4d7bee=this;return new Promise(function(_0x153faf,_0x5ca471){return db['VoiceDialReport']['create'](_0x285f1f[_0x7e9e('0x15')],{'raw':_0x285f1f['options']?_0x285f1f['options'][_0x7e9e('0x16')]===undefined?!![]:![]:!![]})[_0x7e9e('0xa')](function(_0x5d3d54){logger[_0x7e9e('0xb')]('CreateVoiceDialReport',_0x285f1f);logger['debug']('CreateVoiceDialReport',_0x285f1f,JSON['stringify'](_0x5d3d54));_0x153faf(_0x5d3d54);})['catch'](function(_0xc29f28){logger[_0x7e9e('0x10')](_0x7e9e('0x17'),_0xc29f28[_0x7e9e('0x12')],_0x285f1f);_0x5ca471(_0x4d7bee[_0x7e9e('0x10')](0x1f4,_0xc29f28[_0x7e9e('0x12')]));});});};exports[_0x7e9e('0x18')]=function(_0x63ace7){var _0x4bc7ea=this;return new Promise(function(_0x1ca664,_0x12f85f){return db[_0x7e9e('0x19')]['update'](_0x63ace7[_0x7e9e('0x15')],{'raw':_0x63ace7[_0x7e9e('0x1a')]?_0x63ace7[_0x7e9e('0x1a')][_0x7e9e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63ace7[_0x7e9e('0x1a')]?_0x63ace7[_0x7e9e('0x1a')]['where']||null:null,'attributes':_0x63ace7[_0x7e9e('0x1a')]?_0x63ace7[_0x7e9e('0x1a')][_0x7e9e('0x1b')]||null:null,'limit':_0x63ace7[_0x7e9e('0x1a')]?_0x63ace7[_0x7e9e('0x1a')][_0x7e9e('0x1c')]||null:null})[_0x7e9e('0xa')](function(_0x26f9e9){logger['info'](_0x7e9e('0x18'),_0x63ace7);logger['debug']('UpdateVoiceDialReport',_0x63ace7,JSON[_0x7e9e('0xf')](_0x26f9e9));_0x1ca664(_0x26f9e9);})[_0x7e9e('0x14')](function(_0x2cae3e){logger[_0x7e9e('0x10')](_0x7e9e('0x18'),_0x2cae3e[_0x7e9e('0x12')],_0x63ace7);_0x12f85f(_0x4bc7ea[_0x7e9e('0x10')](0x1f4,_0x2cae3e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 183e1fb..779b148 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 _0x6bdf=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete'];(function(_0x5161fc,_0x37c5f6){var _0x38490b=function(_0x49ebd8){while(--_0x49ebd8){_0x5161fc['push'](_0x5161fc['shift']());}};_0x38490b(++_0x37c5f6);}(_0x6bdf,0x162));var _0xf6bd=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0x6bdf[_0x466247];return _0x4b352e;};'use strict';var multer=require('multer');var util=require(_0xf6bd('0x0'));var path=require(_0xf6bd('0x1'));var timeout=require(_0xf6bd('0x2'));var express=require(_0xf6bd('0x3'));var router=express[_0xf6bd('0x4')]();var fs_extra=require(_0xf6bd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf6bd('0x6'));var controller=require(_0xf6bd('0x7'));router[_0xf6bd('0x8')]('/',auth[_0xf6bd('0x9')](),controller[_0xf6bd('0xa')]);router[_0xf6bd('0x8')](_0xf6bd('0xb'),auth[_0xf6bd('0x9')](),controller[_0xf6bd('0xc')]);router[_0xf6bd('0xd')]('/',auth['isAuthenticated'](),controller[_0xf6bd('0xe')]);router[_0xf6bd('0xd')](_0xf6bd('0xf'),auth[_0xf6bd('0x9')](),controller[_0xf6bd('0x10')]);router[_0xf6bd('0x11')](_0xf6bd('0xb'),auth[_0xf6bd('0x9')](),controller[_0xf6bd('0x12')]);router[_0xf6bd('0x13')](_0xf6bd('0xb'),auth[_0xf6bd('0x9')](),controller[_0xf6bd('0x14')]);module[_0xf6bd('0x15')]=router; \ No newline at end of file +var _0xc460=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy'];(function(_0x1b880d,_0x3fec46){var _0x5e373f=function(_0x46a38d){while(--_0x46a38d){_0x1b880d['push'](_0x1b880d['shift']());}};_0x5e373f(++_0x3fec46);}(_0xc460,0x127));var _0x0c46=function(_0x4ea0ee,_0x26bc56){_0x4ea0ee=_0x4ea0ee-0x0;var _0x4eda79=_0xc460[_0x4ea0ee];return _0x4eda79;};'use strict';var multer=require(_0x0c46('0x0'));var util=require(_0x0c46('0x1'));var path=require(_0x0c46('0x2'));var timeout=require(_0x0c46('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c46('0x4'));var auth=require(_0x0c46('0x5'));var interaction=require(_0x0c46('0x6'));var config=require('../../config/environment');var controller=require(_0x0c46('0x7'));router[_0x0c46('0x8')]('/',auth[_0x0c46('0x9')](),controller[_0x0c46('0xa')]);router[_0x0c46('0x8')](_0x0c46('0xb'),auth[_0x0c46('0x9')](),controller[_0x0c46('0xc')]);router[_0x0c46('0xd')]('/',auth[_0x0c46('0x9')](),controller[_0x0c46('0xe')]);router[_0x0c46('0xd')](_0x0c46('0xf'),auth[_0x0c46('0x9')](),controller[_0x0c46('0x10')]);router[_0x0c46('0x11')](_0x0c46('0xb'),auth[_0x0c46('0x9')](),controller['update']);router[_0x0c46('0x12')](_0x0c46('0xb'),auth[_0x0c46('0x9')](),controller[_0x0c46('0x13')]);module[_0x0c46('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 5dcdcd5..40bba21 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 _0xcc13=['INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any'];(function(_0x2b0a6a,_0x4cd73e){var _0x428907=function(_0x5e4845){while(--_0x5e4845){_0x2b0a6a['push'](_0x2b0a6a['shift']());}};_0x428907(++_0x4cd73e);}(_0xcc13,0x149));var _0x3cc1=function(_0x352f4a,_0x1f931b){_0x352f4a=_0x352f4a-0x0;var _0x959b35=_0xcc13[_0x352f4a];return _0x959b35;};'use strict';var Sequelize=require(_0x3cc1('0x0'));module[_0x3cc1('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3cc1('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x3cc1('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x3cc1('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3cc1('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3cc1('0x5')](_0x3cc1('0x6'),_0x3cc1('0x7'),_0x3cc1('0x8'),_0x3cc1('0x9'),_0x3cc1('0xa'),_0x3cc1('0xb'),_0x3cc1('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x3cc1('0x2')]},'interval':{'type':Sequelize[_0x3cc1('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x3cc1('0xd')]},'isApp':{'type':Sequelize[_0x3cc1('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x3cc1('0x2')],'defaultValue':_0x3cc1('0xf')},'answer':{'type':Sequelize[_0x3cc1('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3cc1('0x10')],'get':function(_0x92bfcb){return this[_0x3cc1('0x11')](_0x3cc1('0x12'));}},'alias':{'type':Sequelize[_0x3cc1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x976a=['sequelize','STRING','compositeIndex','NoOp','outbound','inbound-fax','outbound-fax','any','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x976a,0xb6));var _0xa976=function(_0x5b37f9,_0x311ec1){_0x5b37f9=_0x5b37f9-0x0;var _0x5945e2=_0x976a[_0x5b37f9];return _0x5945e2;};'use strict';var Sequelize=require(_0xa976('0x0'));module['exports']={'context':{'type':Sequelize[_0xa976('0x1')],'allowNull':![],'unique':_0xa976('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xa976('0x1')],'allowNull':![],'unique':_0xa976('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xa976('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xa976('0x1')],'allowNull':![],'defaultValue':_0xa976('0x3')},'appdata':{'type':Sequelize[_0xa976('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0xa976('0x4'),'internal',_0xa976('0x5'),_0xa976('0x6'),'system',_0xa976('0x7')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xa976('0x8')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xa976('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xa976('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xa976('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xa976('0x8')]},'recordingFormat':{'type':Sequelize[_0xa976('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xa976('0x9')],'defaultValue':!![]},'name':{'type':Sequelize[_0xa976('0xa')],'get':function(_0x1fdef){return this[_0xa976('0xb')](_0xa976('0xc'));}},'alias':{'type':Sequelize[_0xa976('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index aa65189..9723cdb 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 _0xa699=['autoAssociation','update','description','recordingFormat','cutdigits','alias','context','addApplications','findOne','transaction','VoiceExtensionId','isApp','log','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','undefined','limit','count','offset','set','Content-Range','json','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','includes','type','value','name','sendStatus','error','send','index','VoiceExtension','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','length','options','find','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa699,0x6b));var _0x9a69=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0xa699[_0x5c1cdc];return _0x2e8317;};'use strict';var _=require(_0x9a69('0x0'));var Redis=require(_0x9a69('0x1'));var qs=require(_0x9a69('0x2'));var logger=require(_0x9a69('0x3'))(_0x9a69('0x4'));var config=require(_0x9a69('0x5'));var db=require(_0x9a69('0x6'))['db'];config[_0x9a69('0x7')]=_[_0x9a69('0x8')](config[_0x9a69('0x7')],{'host':_0x9a69('0x9'),'port':0x18eb});var socket=require(_0x9a69('0xa'))(new Redis(config[_0x9a69('0x7')]));require('./voiceExtension.socket')[_0x9a69('0xb')](socket);function respondWithStatusCode(_0x3f9bce,_0x3bb021){_0x3bb021=_0x3bb021||0xcc;return function(_0x4665a9){if(_0x4665a9){return _0x3f9bce['sendStatus'](_0x3bb021);}return _0x3f9bce[_0x9a69('0xc')](_0x3bb021)[_0x9a69('0xd')]();};}function respondWithResult(_0x3fb953,_0x1ee4e3){_0x1ee4e3=_0x1ee4e3||0xc8;return function(_0x43d2f2){if(_0x43d2f2){return _0x3fb953['status'](_0x1ee4e3)['json'](_0x43d2f2);}};}function respondWithFilteredResult(_0x1562e2,_0x5781fd){return function(_0x3f6dc7){if(_0x3f6dc7){var _0x5016b2=typeof _0x5781fd['offset']===_0x9a69('0xe')&&typeof _0x5781fd[_0x9a69('0xf')]==='undefined';var _0x81dfb1=_0x3f6dc7[_0x9a69('0x10')];var _0x57e34=_0x5016b2?0x0:_0x5781fd[_0x9a69('0x11')];var _0x404b9d=_0x5016b2?_0x3f6dc7[_0x9a69('0x10')]:_0x5781fd[_0x9a69('0x11')]+_0x5781fd[_0x9a69('0xf')];var _0x1581d6;if(_0x404b9d>=_0x81dfb1){_0x404b9d=_0x81dfb1;_0x1581d6=0xc8;}else{_0x1581d6=0xce;}_0x1562e2['status'](_0x1581d6);return _0x1562e2[_0x9a69('0x12')](_0x9a69('0x13'),_0x57e34+'-'+_0x404b9d+'/'+_0x81dfb1)[_0x9a69('0x14')](_0x3f6dc7);}return null;};}function removeEntity(_0x5e982d){return function(_0x13fd7){if(_0x13fd7){return _0x13fd7[_0x9a69('0x15')]()[_0x9a69('0x16')](function(){var _0x46fc33=_0x13fd7[_0x9a69('0x17')]({'plain':!![]});var _0x5b5161=[{'name':_0x9a69('0x18'),'value':_0x9a69('0x19'),'ignore':![]},{'name':_0x9a69('0x1a'),'value':_0x9a69('0x1b'),'ignore':![]},{'name':_0x9a69('0x1c'),'value':_0x9a69('0x1d'),'ignore':![]}];var _0x2633d5=_(_0x5b5161)[_0x9a69('0x1e')](_0x9a69('0x1f'))[_0x9a69('0x20')]('value')['value']();if(_[_0x9a69('0x21')](_0x2633d5,_0x46fc33[_0x9a69('0x22')])){return;}var _0x12ebe5=_['find'](_0x5b5161,[_0x9a69('0x23'),_0x46fc33[_0x9a69('0x22')]])[_0x9a69('0x24')];return db['UserProfileResource']['destroy']({'where':{'type':_0x12ebe5,'resourceId':_0x46fc33['id']}})['then'](function(){return _0x13fd7;});})[_0x9a69('0x16')](function(){_0x5e982d['status'](0xcc)[_0x9a69('0xd')]();});}};}function handleEntityNotFound(_0x28f5f7){return function(_0x256cc1){if(!_0x256cc1){_0x28f5f7[_0x9a69('0x25')](0x194);}return _0x256cc1;};}function handleError(_0x593a1a,_0x2f5eb0){_0x2f5eb0=_0x2f5eb0||0x1f4;return function(_0x5130b2){logger[_0x9a69('0x26')](_0x5130b2['stack']);if(_0x5130b2['name']){delete _0x5130b2[_0x9a69('0x24')];}_0x593a1a[_0x9a69('0xc')](_0x2f5eb0)[_0x9a69('0x27')](_0x5130b2);};}exports[_0x9a69('0x28')]=function(_0x26369e,_0x2514fa){var _0x1e8334={},_0x447f0f={},_0xbdd2c0={'count':0x0,'rows':[]};var _0x36af38=_['map'](db[_0x9a69('0x29')][_0x9a69('0x2a')],function(_0x5433b3){return{'name':_0x5433b3['fieldName'],'type':_0x5433b3['type'][_0x9a69('0x2b')]};});_0x447f0f['model']=_[_0x9a69('0x20')](_0x36af38,_0x9a69('0x24'));_0x447f0f[_0x9a69('0x2c')]=_[_0x9a69('0x2d')](_0x26369e[_0x9a69('0x2c')]);_0x447f0f[_0x9a69('0x2e')]=_[_0x9a69('0x2f')](_0x447f0f[_0x9a69('0x30')],_0x447f0f[_0x9a69('0x2c')]);_0x1e8334[_0x9a69('0x31')]=_[_0x9a69('0x2f')](_0x447f0f[_0x9a69('0x30')],qs[_0x9a69('0x32')](_0x26369e[_0x9a69('0x2c')][_0x9a69('0x32')]));_0x1e8334[_0x9a69('0x31')]=_0x1e8334[_0x9a69('0x31')]['length']?_0x1e8334['attributes']:_0x447f0f[_0x9a69('0x30')];if(!_0x26369e[_0x9a69('0x2c')][_0x9a69('0x33')](_0x9a69('0x34'))){_0x1e8334[_0x9a69('0xf')]=qs['limit'](_0x26369e['query']['limit']);_0x1e8334['offset']=qs[_0x9a69('0x11')](_0x26369e[_0x9a69('0x2c')][_0x9a69('0x11')]);}_0x1e8334[_0x9a69('0x35')]=qs[_0x9a69('0x36')](_0x26369e[_0x9a69('0x2c')]['sort']);_0x1e8334['where']=qs[_0x9a69('0x2e')](_[_0x9a69('0x37')](_0x26369e[_0x9a69('0x2c')],_0x447f0f['filters']),_0x36af38);if(_0x26369e[_0x9a69('0x2c')][_0x9a69('0x1e')]){_0x1e8334[_0x9a69('0x38')]=_[_0x9a69('0x39')](_0x1e8334[_0x9a69('0x38')],{'$or':_[_0x9a69('0x20')](_0x36af38,function(_0x786d02){if(_0x786d02[_0x9a69('0x22')]!==_0x9a69('0x3a')){var _0x36684a={};_0x36684a[_0x786d02[_0x9a69('0x24')]]={'$like':'%'+_0x26369e['query'][_0x9a69('0x1e')]+'%'};return _0x36684a;}})});}_0x1e8334=_['merge']({},_0x1e8334,_0x26369e['options']);var _0x4cc399={'where':_0x1e8334['where']};return db[_0x9a69('0x29')][_0x9a69('0x10')](_0x4cc399)['then'](function(_0x47c1fc){_0xbdd2c0['count']=_0x47c1fc;if(_0x26369e[_0x9a69('0x2c')][_0x9a69('0x3b')]){_0x1e8334[_0x9a69('0x3c')]=[{'all':!![]}];}return db['VoiceExtension'][_0x9a69('0x3d')](_0x1e8334);})[_0x9a69('0x16')](function(_0x399e2b){_0xbdd2c0[_0x9a69('0x3e')]=_0x399e2b;return _0xbdd2c0;})[_0x9a69('0x16')](respondWithFilteredResult(_0x2514fa,_0x1e8334))[_0x9a69('0x3f')](handleError(_0x2514fa,null));};exports['show']=function(_0x359d62,_0x27d0db){var _0x1d54c9={'raw':![],'where':{'id':_0x359d62['params']['id']}},_0x18b0ed={};_0x18b0ed[_0x9a69('0x30')]=_[_0x9a69('0x2d')](db['VoiceExtension'][_0x9a69('0x2a')]);_0x18b0ed[_0x9a69('0x2c')]=_[_0x9a69('0x2d')](_0x359d62['query']);_0x18b0ed['filters']=_['intersection'](_0x18b0ed[_0x9a69('0x30')],_0x18b0ed[_0x9a69('0x2c')]);_0x1d54c9[_0x9a69('0x31')]=_[_0x9a69('0x2f')](_0x18b0ed['model'],qs[_0x9a69('0x32')](_0x359d62[_0x9a69('0x2c')][_0x9a69('0x32')]));_0x1d54c9[_0x9a69('0x31')]=_0x1d54c9['attributes'][_0x9a69('0x40')]?_0x1d54c9[_0x9a69('0x31')]:_0x18b0ed[_0x9a69('0x30')];if(_0x359d62[_0x9a69('0x2c')]['includeAll']){_0x1d54c9[_0x9a69('0x3c')]=[{'all':!![]}];}_0x1d54c9=_['merge']({},_0x1d54c9,_0x359d62[_0x9a69('0x41')]);return db['VoiceExtension'][_0x9a69('0x42')](_0x1d54c9)['then'](handleEntityNotFound(_0x27d0db,null))[_0x9a69('0x16')](respondWithResult(_0x27d0db,null))['catch'](handleError(_0x27d0db,null));};exports[_0x9a69('0x15')]=function(_0x1785e2,_0x19f3a4){return db[_0x9a69('0x29')]['find']({'where':{'id':_0x1785e2[_0x9a69('0x43')]['id']}})[_0x9a69('0x16')](handleEntityNotFound(_0x19f3a4,null))[_0x9a69('0x16')](removeEntity(_0x19f3a4,null))[_0x9a69('0x3f')](handleError(_0x19f3a4,null));};exports[_0x9a69('0x44')]=function(_0xc691be,_0x415be1){if(_0xc691be[_0x9a69('0x45')][_0x9a69('0x22')]==='outbound'&&!_[_0x9a69('0x46')](_0xc691be[_0x9a69('0x45')][_0x9a69('0x47')],'_')){_0xc691be[_0x9a69('0x45')][_0x9a69('0x47')]='_'[_0x9a69('0x48')](_0xc691be[_0x9a69('0x45')][_0x9a69('0x47')]);}return db[_0x9a69('0x29')][_0x9a69('0x44')](_0xc691be[_0x9a69('0x45')],{'raw':![]})[_0x9a69('0x16')](function(_0x185622){var _0x43b084=_0xc691be[_0x9a69('0x49')]['get']({'plain':!![]});if(!_0x43b084)throw new Error(_0x9a69('0x4a'));if(_0x43b084[_0x9a69('0x4b')]===_0x9a69('0x49')){var _0x16a891=_0x185622[_0x9a69('0x17')]({'plain':!![]});var _0x3d9ac2=[{'name':_0x9a69('0x18'),'value':'inbound'},{'name':_0x9a69('0x1a'),'value':_0x9a69('0x1b')},{'name':_0x9a69('0x1c'),'value':_0x9a69('0x1d')}];var _0x18c353=_[_0x9a69('0x42')](_0x3d9ac2,[_0x9a69('0x23'),_0x16a891[_0x9a69('0x22')]])[_0x9a69('0x24')];return db[_0x9a69('0x4c')][_0x9a69('0x42')]({'where':{'name':_0x18c353,'userProfileId':_0x43b084['userProfileId']},'raw':!![]})[_0x9a69('0x16')](function(_0x1b9410){if(_0x1b9410&&_0x1b9410[_0x9a69('0x4d')]===0x0){return db['UserProfileResource'][_0x9a69('0x44')]({'name':_0x16a891['name'],'resourceId':_0x16a891['id'],'type':_0x1b9410['name'],'sectionId':_0x1b9410['id']},{})[_0x9a69('0x16')](function(){return _0x185622;});}else{return _0x185622;}})[_0x9a69('0x3f')](function(_0x3f1b10){logger[_0x9a69('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f1b10);throw _0x3f1b10;});}return _0x185622;})['then'](respondWithResult(_0x415be1,0xc9))[_0x9a69('0x3f')](handleError(_0x415be1,null));};exports['update']=function(_0x1ddd4c,_0x5c3e61){if(_0x1ddd4c['body']['id']){delete _0x1ddd4c[_0x9a69('0x45')]['id'];}return db[_0x9a69('0x29')][_0x9a69('0x42')]({'where':{'id':_0x1ddd4c[_0x9a69('0x43')]['id']}})[_0x9a69('0x16')](handleEntityNotFound(_0x5c3e61,null))[_0x9a69('0x16')](function(_0x1c7f4b){if(_0x1c7f4b){return db['VoiceExtension'][_0x9a69('0x4e')](_[_0x9a69('0x37')](_0x1ddd4c[_0x9a69('0x45')],[_0x9a69('0x47'),'context',_0x9a69('0x4f'),_0x9a69('0x50'),_0x9a69('0x51'),'mandatoryDisposition',_0x9a69('0x52')]),{'where':{'context':_0x1c7f4b[_0x9a69('0x53')],'exten':_0x1c7f4b['exten']},'individualHooks':!![]})['then'](function(_0x34ee21){return _0x34ee21;});}return null;})[_0x9a69('0x16')](respondWithStatusCode(_0x5c3e61,null))[_0x9a69('0x3f')](handleError(_0x5c3e61,null));};exports[_0x9a69('0x54')]=function(_0x51a8ec,_0x52f2f9){return db[_0x9a69('0x29')][_0x9a69('0x55')]({'where':{'id':_0x51a8ec['params']['id']}})[_0x9a69('0x16')](function(_0x15e04f){if(_0x15e04f){return db['sequelize'][_0x9a69('0x56')](function(_0x5d7ea2){return db[_0x9a69('0x29')]['destroy']({'where':{'VoiceExtensionId':_0x51a8ec['params']['id']},'transaction':_0x5d7ea2})[_0x9a69('0x16')](function(){var _0x41a8b0=_[_0x9a69('0x20')](_0x51a8ec['body'],function(_0x215974){_0x215974[_0x9a69('0x57')]=_0x51a8ec[_0x9a69('0x43')]['id'];_0x215974[_0x9a69('0x58')]=!![];return _0x215974;});return _0x15e04f['createRouting'](_0x41a8b0);})[_0x9a69('0x16')](function(_0x45549e){console[_0x9a69('0x59')](_0x9a69('0x5a'),_0x45549e);return db[_0x9a69('0x29')][_0x9a69('0x5b')](_0x45549e,{'transaction':_0x5d7ea2});});})[_0x9a69('0x16')](function(){return db[_0x9a69('0x29')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x51a8ec[_0x9a69('0x43')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x52f2f9,null))['catch'](handleError(_0x52f2f9,null));}; \ No newline at end of file +var _0xb974=['bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../config/environment','defaults','redis','localhost','register','sendStatus','status','offset','limit','undefined','count','set','json','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','find','type','error','stack','name','send','index','map','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','params','create','startsWith','exten','body','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','update','pick','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','findOne','transaction','VoiceExtensionId','isApp','createRouting','log','LOG\x20~\x20.then\x20~\x20routing'];(function(_0x50fcae,_0x492eeb){var _0x44440f=function(_0x8f2342){while(--_0x8f2342){_0x50fcae['push'](_0x50fcae['shift']());}};_0x44440f(++_0x492eeb);}(_0xb974,0xb3));var _0x4b97=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb974[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x4b97('0x0'));var Redis=require(_0x4b97('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x4b97('0x2'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4b97('0x3')](config[_0x4b97('0x4')],{'host':_0x4b97('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b97('0x4')]));require('./voiceExtension.socket')[_0x4b97('0x6')](socket);function respondWithStatusCode(_0x4b6f00,_0x4068e7){_0x4068e7=_0x4068e7||0xcc;return function(_0x2933cd){if(_0x2933cd){return _0x4b6f00[_0x4b97('0x7')](_0x4068e7);}return _0x4b6f00[_0x4b97('0x8')](_0x4068e7)['end']();};}function respondWithResult(_0x35b3e0,_0xfb45df){_0xfb45df=_0xfb45df||0xc8;return function(_0x4cb1be){if(_0x4cb1be){return _0x35b3e0[_0x4b97('0x8')](_0xfb45df)['json'](_0x4cb1be);}};}function respondWithFilteredResult(_0xe5ccbd,_0x21fec4){return function(_0x5d9973){if(_0x5d9973){var _0x2dc86a=typeof _0x21fec4[_0x4b97('0x9')]==='undefined'&&typeof _0x21fec4[_0x4b97('0xa')]===_0x4b97('0xb');var _0x193a02=_0x5d9973['count'];var _0x56924c=_0x2dc86a?0x0:_0x21fec4[_0x4b97('0x9')];var _0xc89765=_0x2dc86a?_0x5d9973[_0x4b97('0xc')]:_0x21fec4[_0x4b97('0x9')]+_0x21fec4[_0x4b97('0xa')];var _0x6fa36e;if(_0xc89765>=_0x193a02){_0xc89765=_0x193a02;_0x6fa36e=0xc8;}else{_0x6fa36e=0xce;}_0xe5ccbd[_0x4b97('0x8')](_0x6fa36e);return _0xe5ccbd[_0x4b97('0xd')]('Content-Range',_0x56924c+'-'+_0xc89765+'/'+_0x193a02)[_0x4b97('0xe')](_0x5d9973);}return null;};}function removeEntity(_0x63b167){return function(_0x104e78){if(_0x104e78){return _0x104e78[_0x4b97('0xf')]()[_0x4b97('0x10')](function(){var _0x2a2f01=_0x104e78[_0x4b97('0x11')]({'plain':!![]});var _0x29ad6c=[{'name':'InboundRoutes','value':_0x4b97('0x12'),'ignore':![]},{'name':_0x4b97('0x13'),'value':_0x4b97('0x14'),'ignore':![]},{'name':_0x4b97('0x15'),'value':_0x4b97('0x16'),'ignore':![]}];var _0x16a684=_(_0x29ad6c)[_0x4b97('0x17')](_0x4b97('0x18'))['map'](_0x4b97('0x19'))['value']();if(_['includes'](_0x16a684,_0x2a2f01['type'])){return;}var _0x5b094f=_[_0x4b97('0x1a')](_0x29ad6c,[_0x4b97('0x19'),_0x2a2f01[_0x4b97('0x1b')]])['name'];return db['UserProfileResource'][_0x4b97('0xf')]({'where':{'type':_0x5b094f,'resourceId':_0x2a2f01['id']}})[_0x4b97('0x10')](function(){return _0x104e78;});})['then'](function(){_0x63b167['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5039e2){return function(_0x48e8ec){if(!_0x48e8ec){_0x5039e2[_0x4b97('0x7')](0x194);}return _0x48e8ec;};}function handleError(_0x4ad92e,_0x50e9a3){_0x50e9a3=_0x50e9a3||0x1f4;return function(_0x3505d2){logger[_0x4b97('0x1c')](_0x3505d2[_0x4b97('0x1d')]);if(_0x3505d2[_0x4b97('0x1e')]){delete _0x3505d2['name'];}_0x4ad92e['status'](_0x50e9a3)[_0x4b97('0x1f')](_0x3505d2);};}exports[_0x4b97('0x20')]=function(_0x40a928,_0x489c0f){var _0x558214={},_0x18c6c2={},_0x37a69f={'count':0x0,'rows':[]};var _0x476089=_[_0x4b97('0x21')](db[_0x4b97('0x22')][_0x4b97('0x23')],function(_0x3e358e){return{'name':_0x3e358e[_0x4b97('0x24')],'type':_0x3e358e[_0x4b97('0x1b')][_0x4b97('0x25')]};});_0x18c6c2['model']=_[_0x4b97('0x21')](_0x476089,_0x4b97('0x1e'));_0x18c6c2[_0x4b97('0x26')]=_[_0x4b97('0x27')](_0x40a928[_0x4b97('0x26')]);_0x18c6c2[_0x4b97('0x28')]=_['intersection'](_0x18c6c2['model'],_0x18c6c2[_0x4b97('0x26')]);_0x558214[_0x4b97('0x29')]=_[_0x4b97('0x2a')](_0x18c6c2[_0x4b97('0x2b')],qs[_0x4b97('0x2c')](_0x40a928[_0x4b97('0x26')][_0x4b97('0x2c')]));_0x558214[_0x4b97('0x29')]=_0x558214[_0x4b97('0x29')][_0x4b97('0x2d')]?_0x558214[_0x4b97('0x29')]:_0x18c6c2[_0x4b97('0x2b')];if(!_0x40a928[_0x4b97('0x26')][_0x4b97('0x2e')](_0x4b97('0x2f'))){_0x558214[_0x4b97('0xa')]=qs[_0x4b97('0xa')](_0x40a928[_0x4b97('0x26')]['limit']);_0x558214[_0x4b97('0x9')]=qs['offset'](_0x40a928[_0x4b97('0x26')][_0x4b97('0x9')]);}_0x558214[_0x4b97('0x30')]=qs[_0x4b97('0x31')](_0x40a928[_0x4b97('0x26')][_0x4b97('0x31')]);_0x558214[_0x4b97('0x32')]=qs[_0x4b97('0x28')](_['pick'](_0x40a928[_0x4b97('0x26')],_0x18c6c2['filters']),_0x476089);if(_0x40a928[_0x4b97('0x26')][_0x4b97('0x17')]){_0x558214[_0x4b97('0x32')]=_['merge'](_0x558214[_0x4b97('0x32')],{'$or':_[_0x4b97('0x21')](_0x476089,function(_0x3d952b){if(_0x3d952b[_0x4b97('0x1b')]!=='VIRTUAL'){var _0x45fde9={};_0x45fde9[_0x3d952b[_0x4b97('0x1e')]]={'$like':'%'+_0x40a928[_0x4b97('0x26')][_0x4b97('0x17')]+'%'};return _0x45fde9;}})});}_0x558214=_[_0x4b97('0x33')]({},_0x558214,_0x40a928[_0x4b97('0x34')]);var _0x3c15bb={'where':_0x558214['where']};return db['VoiceExtension'][_0x4b97('0xc')](_0x3c15bb)[_0x4b97('0x10')](function(_0x175040){_0x37a69f[_0x4b97('0xc')]=_0x175040;if(_0x40a928['query'][_0x4b97('0x35')]){_0x558214[_0x4b97('0x36')]=[{'all':!![]}];}return db[_0x4b97('0x22')][_0x4b97('0x37')](_0x558214);})['then'](function(_0x221abc){_0x37a69f[_0x4b97('0x38')]=_0x221abc;return _0x37a69f;})[_0x4b97('0x10')](respondWithFilteredResult(_0x489c0f,_0x558214))[_0x4b97('0x39')](handleError(_0x489c0f,null));};exports['show']=function(_0x3fe209,_0x50ec87){var _0x3a40a9={'raw':![],'where':{'id':_0x3fe209[_0x4b97('0x3a')]['id']}},_0x7719ac={};_0x7719ac[_0x4b97('0x2b')]=_[_0x4b97('0x27')](db[_0x4b97('0x22')][_0x4b97('0x23')]);_0x7719ac[_0x4b97('0x26')]=_[_0x4b97('0x27')](_0x3fe209[_0x4b97('0x26')]);_0x7719ac[_0x4b97('0x28')]=_[_0x4b97('0x2a')](_0x7719ac['model'],_0x7719ac[_0x4b97('0x26')]);_0x3a40a9[_0x4b97('0x29')]=_[_0x4b97('0x2a')](_0x7719ac[_0x4b97('0x2b')],qs[_0x4b97('0x2c')](_0x3fe209[_0x4b97('0x26')][_0x4b97('0x2c')]));_0x3a40a9['attributes']=_0x3a40a9['attributes']['length']?_0x3a40a9[_0x4b97('0x29')]:_0x7719ac[_0x4b97('0x2b')];if(_0x3fe209[_0x4b97('0x26')][_0x4b97('0x35')]){_0x3a40a9['include']=[{'all':!![]}];}_0x3a40a9=_[_0x4b97('0x33')]({},_0x3a40a9,_0x3fe209[_0x4b97('0x34')]);return db[_0x4b97('0x22')][_0x4b97('0x1a')](_0x3a40a9)[_0x4b97('0x10')](handleEntityNotFound(_0x50ec87,null))[_0x4b97('0x10')](respondWithResult(_0x50ec87,null))[_0x4b97('0x39')](handleError(_0x50ec87,null));};exports[_0x4b97('0xf')]=function(_0x3960e6,_0x275fd8){return db[_0x4b97('0x22')][_0x4b97('0x1a')]({'where':{'id':_0x3960e6['params']['id']}})[_0x4b97('0x10')](handleEntityNotFound(_0x275fd8,null))[_0x4b97('0x10')](removeEntity(_0x275fd8,null))[_0x4b97('0x39')](handleError(_0x275fd8,null));};exports[_0x4b97('0x3b')]=function(_0x5756a5,_0x195f46){if(_0x5756a5['body']['type']===_0x4b97('0x14')&&!_[_0x4b97('0x3c')](_0x5756a5['body'][_0x4b97('0x3d')],'_')){_0x5756a5[_0x4b97('0x3e')][_0x4b97('0x3d')]='_'[_0x4b97('0x3f')](_0x5756a5[_0x4b97('0x3e')][_0x4b97('0x3d')]);}return db['VoiceExtension'][_0x4b97('0x3b')](_0x5756a5[_0x4b97('0x3e')],{'raw':![]})[_0x4b97('0x10')](function(_0x5e6994){var _0x339803=_0x5756a5[_0x4b97('0x40')][_0x4b97('0x11')]({'plain':!![]});if(!_0x339803)throw new Error(_0x4b97('0x41'));if(_0x339803[_0x4b97('0x42')]===_0x4b97('0x40')){var _0x1e98e7=_0x5e6994[_0x4b97('0x11')]({'plain':!![]});var _0x1621bb=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x4b97('0x13'),'value':_0x4b97('0x14')},{'name':_0x4b97('0x15'),'value':_0x4b97('0x16')}];var _0x5cfd58=_['find'](_0x1621bb,['value',_0x1e98e7[_0x4b97('0x1b')]])[_0x4b97('0x1e')];return db[_0x4b97('0x43')][_0x4b97('0x1a')]({'where':{'name':_0x5cfd58,'userProfileId':_0x339803[_0x4b97('0x44')]},'raw':!![]})[_0x4b97('0x10')](function(_0x4a2fd5){if(_0x4a2fd5&&_0x4a2fd5['autoAssociation']===0x0){return db[_0x4b97('0x45')][_0x4b97('0x3b')]({'name':_0x1e98e7[_0x4b97('0x1e')],'resourceId':_0x1e98e7['id'],'type':_0x4a2fd5[_0x4b97('0x1e')],'sectionId':_0x4a2fd5['id']},{})[_0x4b97('0x10')](function(){return _0x5e6994;});}else{return _0x5e6994;}})[_0x4b97('0x39')](function(_0x2e3344){logger[_0x4b97('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e3344);throw _0x2e3344;});}return _0x5e6994;})[_0x4b97('0x10')](respondWithResult(_0x195f46,0xc9))['catch'](handleError(_0x195f46,null));};exports[_0x4b97('0x46')]=function(_0x5a8de6,_0x569b63){if(_0x5a8de6[_0x4b97('0x3e')]['id']){delete _0x5a8de6[_0x4b97('0x3e')]['id'];}return db['VoiceExtension'][_0x4b97('0x1a')]({'where':{'id':_0x5a8de6[_0x4b97('0x3a')]['id']}})['then'](handleEntityNotFound(_0x569b63,null))['then'](function(_0x524d84){if(_0x524d84){return db[_0x4b97('0x22')][_0x4b97('0x46')](_[_0x4b97('0x47')](_0x5a8de6[_0x4b97('0x3e')],[_0x4b97('0x3d'),'context',_0x4b97('0x48'),_0x4b97('0x49'),_0x4b97('0x4a'),_0x4b97('0x4b'),_0x4b97('0x4c')]),{'where':{'context':_0x524d84[_0x4b97('0x4d')],'exten':_0x524d84[_0x4b97('0x3d')]},'individualHooks':!![]})['then'](function(_0x935585){return _0x935585;});}return null;})[_0x4b97('0x10')](respondWithStatusCode(_0x569b63,null))[_0x4b97('0x39')](handleError(_0x569b63,null));};exports['addApplications']=function(_0x28e28b,_0x54d259){return db['VoiceExtension'][_0x4b97('0x4e')]({'where':{'id':_0x28e28b[_0x4b97('0x3a')]['id']}})[_0x4b97('0x10')](function(_0x345473){if(_0x345473){return db['sequelize'][_0x4b97('0x4f')](function(_0x36c93a){return db[_0x4b97('0x22')]['destroy']({'where':{'VoiceExtensionId':_0x28e28b['params']['id']},'transaction':_0x36c93a})[_0x4b97('0x10')](function(){var _0x49b6e1=_[_0x4b97('0x21')](_0x28e28b['body'],function(_0x5e0280){_0x5e0280[_0x4b97('0x50')]=_0x28e28b[_0x4b97('0x3a')]['id'];_0x5e0280[_0x4b97('0x51')]=!![];return _0x5e0280;});return _0x345473[_0x4b97('0x52')](_0x49b6e1);})[_0x4b97('0x10')](function(_0x2c63df){console[_0x4b97('0x53')](_0x4b97('0x54'),_0x2c63df);return db[_0x4b97('0x22')][_0x4b97('0x55')](_0x2c63df,{'transaction':_0x36c93a});});})[_0x4b97('0x10')](function(){return db[_0x4b97('0x22')][_0x4b97('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x28e28b[_0x4b97('0x3a')]['id']},'order':_0x4b97('0x57')});});}})[_0x4b97('0x10')](respondWithResult(_0x54d259,null))[_0x4b97('0x39')](handleError(_0x54d259,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 350ebcb..76ca11f 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 _0xc862=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners','remove'];(function(_0xa876f3,_0x1aa343){var _0x5718ba=function(_0x8dcccb){while(--_0x8dcccb){_0xa876f3['push'](_0xa876f3['shift']());}};_0x5718ba(++_0x1aa343);}(_0xc862,0x94));var _0x2c86=function(_0x4e4afb,_0x47e1dc){_0x4e4afb=_0x4e4afb-0x0;var _0x2d045c=_0xc862[_0x4e4afb];return _0x2d045c;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x2c86('0x0'))['db'][_0x2c86('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2c86('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2c86('0x3')};function emitEvent(_0x98b423){return function(_0x36d0aa,_0x2627c3,_0x2ff9e4){VoiceExtensionEvents[_0x2c86('0x4')](_0x98b423+':'+_0x36d0aa['id'],_0x36d0aa);VoiceExtensionEvents[_0x2c86('0x4')](_0x98b423,_0x36d0aa);_0x2ff9e4(null);};}for(var e in events){if(events[_0x2c86('0x5')](e)){var event=events[e];VoiceExtension[_0x2c86('0x6')](e,emitEvent(event));}}module[_0x2c86('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xded1=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x584894,_0x23b9bf){var _0x46a209=function(_0x330acf){while(--_0x330acf){_0x584894['push'](_0x584894['shift']());}};_0x46a209(++_0x23b9bf);}(_0xded1,0xbf));var _0x1ded=function(_0x47cc41,_0x11e552){_0x47cc41=_0x47cc41-0x0;var _0x580c72=_0xded1[_0x47cc41];return _0x580c72;};'use strict';var EventEmitter=require(_0x1ded('0x0'));var VoiceExtension=require(_0x1ded('0x1'))['db'][_0x1ded('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1ded('0x3')](0x0);var events={'afterCreate':_0x1ded('0x4'),'afterUpdate':_0x1ded('0x5'),'afterDestroy':_0x1ded('0x6')};function emitEvent(_0x3fec7f){return function(_0x59ce95,_0x59514b,_0x4616b2){VoiceExtensionEvents[_0x1ded('0x7')](_0x3fec7f+':'+_0x59ce95['id'],_0x59ce95);VoiceExtensionEvents[_0x1ded('0x7')](_0x3fec7f,_0x59ce95);_0x4616b2(null);};}for(var e in events){if(events[_0x1ded('0x8')](e)){var event=events[e];VoiceExtension[_0x1ded('0x9')](e,emitEvent(event));}}module[_0x1ded('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 6033266..da1e6b9 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 _0xaab2=['XCALLY-MOTION-PROGRESS=0','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','length','name','param','split','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','filter','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','includes','appType','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','define','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','Set','type','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix'];(function(_0x4f8982,_0x5885c9){var _0x5a46c1=function(_0x142066){while(--_0x142066){_0x4f8982['push'](_0x4f8982['shift']());}};_0x5a46c1(++_0x5885c9);}(_0xaab2,0xca));var _0x2aab=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xaab2[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var attributes=require(_0x2aab('0x0'));module[_0x2aab('0x1')]=function(_0x1d1057){var _0x564a5a=_0x1d1057[_0x2aab('0x2')];function _0xc770d0(_0xaaa037){var _0x342fe5=0x2;var _0x3d6ee0=[{'type':_0xaaa037['type'],'app':_0x2aab('0x3'),'appdata':'CDR(type)='+_0xaaa037[_0x2aab('0x4')],'context':_0xaaa037[_0x2aab('0x5')],'exten':_0xaaa037[_0x2aab('0x6')],'priority':_0x342fe5++,'VoiceExtensionId':_0xaaa037['id']},{'type':_0xaaa037[_0x2aab('0x4')],'app':_0xaaa037['alias']?_0x2aab('0x3'):_0x2aab('0x7'),'appdata':_0xaaa037[_0x2aab('0x8')]?_0x2aab('0x9')+_0xaaa037[_0x2aab('0x8')]:_0x2aab('0xa'),'context':_0xaaa037['context'],'exten':_0xaaa037['exten'],'priority':_0x342fe5++,'VoiceExtensionId':_0xaaa037['id']}];if(_0xaaa037[_0x2aab('0x4')]===_0x2aab('0xb')){_0x3d6ee0['push']({'type':_0x2aab('0xb'),'app':_0x2aab('0x3'),'appdata':_0x2aab('0xc')+_0xaaa037['id'],'context':_0xaaa037['context'],'exten':_0xaaa037[_0x2aab('0x6')],'priority':_0x342fe5++,'VoiceExtensionId':_0xaaa037['id']});}_0x3d6ee0[_0x2aab('0xd')]({'type':_0xaaa037[_0x2aab('0x4')],'app':_0x2aab('0x3'),'appdata':_0x2aab('0xe'),'context':_0xaaa037[_0x2aab('0x5')],'exten':_0xaaa037['exten'],'priority':_0x342fe5++,'VoiceExtensionId':_0xaaa037['id']},{'type':_0xaaa037['type'],'app':_0x2aab('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xaaa037['context'],'exten':_0xaaa037[_0x2aab('0x6')],'priority':_0x342fe5++,'VoiceExtensionId':_0xaaa037['id']},{'type':_0xaaa037[_0x2aab('0x4')],'app':_0x2aab('0x3'),'appdata':_0x2aab('0xf'),'context':_0xaaa037[_0x2aab('0x5')],'exten':_0xaaa037[_0x2aab('0x6')],'priority':_0x342fe5++,'VoiceExtensionId':_0xaaa037['id']});return _0x3d6ee0;}function _0x543ca0(_0x3437c2){var _0x4ebce7=0x2;var _0x3855b7=[{'type':_0x2aab('0x10'),'app':_0x2aab('0x3'),'appdata':_0x2aab('0x11'),'context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2[_0x2aab('0x6')],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']},{'type':_0x2aab('0x10'),'app':_0x3437c2[_0x2aab('0x8')]?_0x2aab('0x3'):_0x2aab('0x7'),'appdata':_0x3437c2[_0x2aab('0x8')]?_0x2aab('0x9')+_0x3437c2[_0x2aab('0x8')]:_0x2aab('0xa'),'context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2[_0x2aab('0x6')],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']},{'type':_0x2aab('0x10'),'app':_0x2aab('0x3'),'appdata':_0x2aab('0x12')+(_0x3437c2[_0x2aab('0x13')]?'${EXTEN:'+_0x3437c2[_0x2aab('0x13')]+'}':_0x2aab('0x14')),'context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2['exten'],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']},{'type':_0x2aab('0x10'),'app':_0x2aab('0x3'),'appdata':_0x2aab('0xc')+_0x3437c2['id'],'context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2[_0x2aab('0x6')],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']},{'type':'outbound','app':_0x2aab('0x15'),'appdata':_0x2aab('0x16')+(_0x4ebce7+0x2)+_0x2aab('0x17')+(_0x4ebce7+0x1)+')','context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2['exten'],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']},{'type':_0x2aab('0x10'),'app':_0x2aab('0x3'),'appdata':_0x3437c2['cutdigits']?_0x2aab('0x18')+_0x3437c2[_0x2aab('0x13')]+'}':_0x2aab('0x19'),'context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2['exten'],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']},{'type':'outbound','app':_0x2aab('0x3'),'appdata':_0x2aab('0xe'),'context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2[_0x2aab('0x6')],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']},{'type':_0x2aab('0x10'),'app':_0x2aab('0x3'),'appdata':_0x2aab('0x1a'),'context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2[_0x2aab('0x6')],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']},{'type':_0x2aab('0x10'),'app':_0x2aab('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2[_0x2aab('0x6')],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']},{'type':_0x2aab('0x10'),'app':_0x2aab('0x3'),'appdata':'outboundrouteid='+_0x3437c2['id'],'context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2[_0x2aab('0x6')],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']}];if(_0x3437c2[_0x2aab('0x1b')](_0x2aab('0x1c'))&&_0x3437c2[_0x2aab('0x1c')]!=='none'){_0x3855b7[_0x2aab('0xd')]({'type':'outbound','app':_0x2aab('0x3'),'appdata':_0x2aab('0x1d'),'context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2[_0x2aab('0x6')],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']},{'type':'outbound','app':_0x2aab('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3437c2[_0x2aab('0x1c')]||_0x2aab('0x1e'),'context':_0x3437c2[_0x2aab('0x5')],'exten':_0x3437c2[_0x2aab('0x6')],'priority':_0x4ebce7++,'VoiceExtensionId':_0x3437c2['id']});}return _0x3855b7;}function _0x37d262(_0x458d86,_0x23e4a4){var _0xe5aa48=[{'name':_0x2aab('0x1f'),'param':0x0},{'name':_0x2aab('0x20'),'param':0x1},{'name':_0x2aab('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0x2642d5={};var _0x2081b6=_0x23e4a4['split'](',');var _0x4ee39f=[];for(var _0x2d5f1e=0x0;_0x2d5f1e<_0xe5aa48[_0x2aab('0x22')];_0x2d5f1e++){switch(_0xe5aa48[_0x2d5f1e][_0x2aab('0x23')]){case'trunk':_0x2642d5['trunk']=_0x2081b6[_0xe5aa48[_0x2d5f1e][_0x2aab('0x24')]][_0x2aab('0x25')]('/')[0x1];_0x2642d5[_0x2aab('0x26')]=_0x2081b6[_0xe5aa48[_0x2d5f1e]['param']]['split']('/')[0x2];_0x2642d5['prefix']=_0x2642d5[_0x2aab('0x26')]?_0x2642d5[_0x2aab('0x26')][_0x2aab('0x25')]('$')[0x0]:undefined;_0x2642d5[_0x2aab('0x26')]=_0x458d86[_0x2aab('0x13')]?(_0x2642d5[_0x2aab('0x27')]||'')+'${EXTEN:'+_0x458d86['cutdigits']+'}':(_0x2642d5[_0x2aab('0x27')]||'')+'${EXTEN}';_0x4ee39f[_0xe5aa48[_0x2d5f1e][_0x2aab('0x24')]]=[_0x2aab('0x28'),_0x2642d5[_0x2aab('0x1f')],_0x2642d5['phone']][_0x2aab('0x29')]('/');break;case'options':_0x2642d5[_0x2aab('0x21')]=_0x2081b6[_0xe5aa48[_0x2d5f1e][_0x2aab('0x24')]];if(_0x458d86['recordingFormat']!=='none'){if(_0x2642d5[_0x2aab('0x21')][_0x2aab('0x2a')](_0x2aab('0x2b'))<0x0){_0x2642d5['options']+=_0x2aab('0x2b');}}else{_0x2642d5[_0x2aab('0x21')]=_0x2642d5[_0x2aab('0x21')][_0x2aab('0x2c')](_0x2aab('0x2b'),'');}_0x4ee39f[_0xe5aa48[_0x2d5f1e][_0x2aab('0x24')]]=_0x2642d5['options'];break;default:_0x4ee39f[_0xe5aa48[_0x2d5f1e][_0x2aab('0x24')]]=_0x2081b6[_0xe5aa48[_0x2d5f1e]['param']];}}return _0x4ee39f['join'](',');}function _0x252ba3(_0x1babcc,_0x5b950e,_0x2acb1f){return new Promise(function(_0x43ff16,_0x3770c3){var _0x4e1d2f=[];if(_[_0x2aab('0x2d')](_0x5b950e))return _0x43ff16(_0x4e1d2f);_0x564a5a[_0x2aab('0x2e')][_0x2aab('0x2f')]({'attributes':['id',_0x2aab('0x30'),'IntervalId'],'raw':!![]})[_0x2aab('0x31')](function(_0x30a583){for(var _0xc436ba=0x0,_0x339aab=0x0;_0xc436ba<_0x5b950e[_0x2aab('0x22')];_0xc436ba++,_0x339aab=0x0){var _0x23e4f4=_0x5b950e[_0xc436ba];var _0xb48f8a=[];var _0x18e7db=[];delete _0x23e4f4['id'];if(_0x23e4f4[_0x2aab('0x30')]!==_0x2aab('0x32')){_0x23e4f4['intervals']=[_0x23e4f4[_0x2aab('0x30')]];}else{_0x23e4f4[_0x2aab('0x33')]=_0x23e4f4[_0x2aab('0x34')]?_['map'](_[_0x2aab('0x35')](_0x30a583,{'IntervalId':_0x23e4f4[_0x2aab('0x34')]}),_0x2aab('0x30')):[];}_0x23e4f4[_0x2aab('0x5')]=_0x1babcc['context'];_0x23e4f4[_0x2aab('0x6')]=_0x1babcc[_0x2aab('0x6')];if(_0x23e4f4[_0x2aab('0x4')])_0x23e4f4[_0x2aab('0x4')]=_0x23e4f4[_0x2aab('0x4')]['toLowerCase']();if(_0x1babcc['type']===_0x2aab('0x10')){if(_0x23e4f4[_0x2aab('0x1b')](_0x2aab('0x36'))&&_0x23e4f4['tag']&&_0x23e4f4[_0x2aab('0x36')]!=='--'){_0xb48f8a[_0x2aab('0xd')]({'type':_0x23e4f4['type'][_0x2aab('0x37')](),'app':'Set','appdata':'CDR(tag)='+_0x23e4f4['tag'],'context':_0x1babcc[_0x2aab('0x5')],'exten':_0x1babcc[_0x2aab('0x6')],'priority':_0x23e4f4[_0x2aab('0x33')][_0x2aab('0x22')]+_0x2acb1f+_0x339aab++,'VoiceExtensionId':_0x1babcc['id']});}_0xb48f8a[_0x2aab('0xd')]({'type':_0x23e4f4[_0x2aab('0x4')][_0x2aab('0x37')](),'app':'ExecIf','appdata':_0x2aab('0x38')+(_0x23e4f4[_0x2aab('0x39')]?_0x2aab('0x3a')+_0x23e4f4[_0x2aab('0x39')]+')':_0x2aab('0x3b')),'context':_0x1babcc[_0x2aab('0x5')],'exten':_0x1babcc[_0x2aab('0x6')],'priority':_0x23e4f4[_0x2aab('0x33')][_0x2aab('0x22')]+_0x2acb1f+_0x339aab++,'VoiceExtensionId':_0x1babcc['id']});}else{if(_0x23e4f4[_0x2aab('0x1b')]('answer')){if([_0x2aab('0x3c'),'playback'][_0x2aab('0x3d')](_0x23e4f4['app']['toLowerCase']())&&_0x23e4f4[_0x2aab('0x3e')]!=='custom'){if(_0x23e4f4['answer']){_0xb48f8a[_0x2aab('0xd')]({'type':_0x23e4f4[_0x2aab('0x4')][_0x2aab('0x37')](),'app':_0x2aab('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x1babcc[_0x2aab('0x5')],'exten':_0x1babcc[_0x2aab('0x6')],'priority':_0x23e4f4[_0x2aab('0x33')]['length']+_0x2acb1f+_0x339aab++,'VoiceExtensionId':_0x1babcc['id']});_0xb48f8a['push']({'type':_0x23e4f4['type'][_0x2aab('0x37')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1babcc['context'],'exten':_0x1babcc[_0x2aab('0x6')],'priority':_0x23e4f4[_0x2aab('0x33')][_0x2aab('0x22')]+_0x2acb1f+_0x339aab++,'VoiceExtensionId':_0x1babcc['id']});}else{_0xb48f8a[_0x2aab('0xd')]({'type':_0x23e4f4['type'][_0x2aab('0x37')](),'app':_0x2aab('0x15'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1babcc['context'],'exten':_0x1babcc[_0x2aab('0x6')],'priority':_0x23e4f4['intervals'][_0x2aab('0x22')]+_0x2acb1f+_0x339aab++,'VoiceExtensionId':_0x1babcc['id']});_0xb48f8a[_0x2aab('0xd')]({'type':_0x23e4f4[_0x2aab('0x4')]['toLowerCase'](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x1babcc['context'],'exten':_0x1babcc[_0x2aab('0x6')],'priority':_0x23e4f4['intervals'][_0x2aab('0x22')]+_0x2acb1f+_0x339aab++,'VoiceExtensionId':_0x1babcc['id']});}}}}for(var _0x3a0529=0x0;_0x3a0529<_0x23e4f4[_0x2aab('0x33')][_0x2aab('0x22')];_0x3a0529++){var _0x3f2127=_0x2acb1f+_0x23e4f4[_0x2aab('0x33')][_0x2aab('0x22')];var _0x3b9d98=_0x3a0529===_0x23e4f4[_0x2aab('0x33')][_0x2aab('0x22')]-0x1?_0x2acb1f+_0xb48f8a[_0x2aab('0x22')]+_0x18e7db[_0x2aab('0x22')]+0x2:_0x2acb1f+_0x3a0529+0x1;_0xb48f8a[_0x2aab('0x3f')](_0x3a0529,0x0,{'type':_0x1babcc['type'],'app':_0x2aab('0x40'),'appdata':_0x23e4f4[_0x2aab('0x33')][_0x3a0529]+'?'+_0x1babcc[_0x2aab('0x5')]+_0x2aab('0x41')+_0x3f2127+':'+_0x1babcc[_0x2aab('0x5')]+',${EXTEN},'+_0x3b9d98,'exten':_0x1babcc[_0x2aab('0x6')],'context':_0x1babcc['context'],'priority':_0x2acb1f+_0x3a0529,'VoiceExtensionId':_0x1babcc['id']});}if(_0x23e4f4[_0x2aab('0x3e')]===_0x2aab('0x42'))_0x23e4f4[_0x2aab('0x43')]=_0x37d262(_0x1babcc,_0x23e4f4[_0x2aab('0x43')]);_0x23e4f4[_0x2aab('0x44')]=_0xb48f8a[_0x2aab('0x22')]?_['last'](_0xb48f8a)[_0x2aab('0x44')]+0x1:_0x2acb1f;_0x4e1d2f=_[_0x2aab('0x45')](_0x4e1d2f,_0xb48f8a,[_0x23e4f4],_0x18e7db);_0x2acb1f=_[_0x2aab('0x46')](_0x4e1d2f)[_0x2aab('0x44')]+0x1;}return _0x43ff16(_0x4e1d2f);})[_0x2aab('0x47')](function(_0x2c7a55){_0x3770c3(_0x2c7a55);});});}return _0x1d1057[_0x2aab('0x48')]('VoiceExtension',attributes,{'tableName':_0x2aab('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x58c035){var _0x209329=this[_0x2aab('0x4a')]({'plain':!![]});var _0x28842b=_0x209329[_0x2aab('0x4')]==='outbound'?_0x543ca0(_0x209329):_0xc770d0(_0x209329);return _0x252ba3(_0x209329,_0x58c035,_[_0x2aab('0x46')](_0x28842b)['priority']+0x1)[_0x2aab('0x31')](function(_0x218661){var _0x188f50=_[_0x2aab('0x45')](_0x28842b,_0x218661);_0x188f50[_0x2aab('0xd')]({'type':_0x209329[_0x2aab('0x4')],'app':_0x2aab('0x4b'),'exten':_0x209329[_0x2aab('0x6')],'context':_0x209329[_0x2aab('0x5')],'priority':_[_0x2aab('0x46')](_0x188f50)['priority']+0x1,'VoiceExtensionId':_0x209329['id']});return _0x188f50;});}}});}; \ No newline at end of file +var _0x4cfd=['CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','param','split','phone','prefix','SIP','none','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','queue','playback','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}'];(function(_0x8819c6,_0x52d431){var _0x81d5dd=function(_0x4df16e){while(--_0x4df16e){_0x8819c6['push'](_0x8819c6['shift']());}};_0x81d5dd(++_0x52d431);}(_0x4cfd,0x170));var _0xd4cf=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x4cfd[_0x10f6e8];return _0x35bb3c;};'use strict';var _=require(_0xd4cf('0x0'));var attributes=require(_0xd4cf('0x1'));module['exports']=function(_0x4072d3){var _0x356001=_0x4072d3[_0xd4cf('0x2')];function _0x407d96(_0x332f55){var _0xe90497=0x2;var _0x4e6f40=[{'type':_0x332f55[_0xd4cf('0x3')],'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x5')+_0x332f55[_0xd4cf('0x3')],'context':_0x332f55[_0xd4cf('0x6')],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']},{'type':_0x332f55['type'],'app':_0x332f55[_0xd4cf('0x8')]?_0xd4cf('0x4'):_0xd4cf('0x9'),'appdata':_0x332f55[_0xd4cf('0x8')]?_0xd4cf('0xa')+_0x332f55[_0xd4cf('0x8')]:_0xd4cf('0xb'),'context':_0x332f55['context'],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']}];if(_0x332f55[_0xd4cf('0x3')]===_0xd4cf('0xc')){_0x4e6f40[_0xd4cf('0xd')]({'type':_0xd4cf('0xc'),'app':'Set','appdata':'CDR(routeid)='+_0x332f55['id'],'context':_0x332f55[_0xd4cf('0x6')],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']});}_0x4e6f40['push']({'type':_0x332f55[_0xd4cf('0x3')],'app':'Set','appdata':_0xd4cf('0xe'),'context':_0x332f55['context'],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']},{'type':_0x332f55[_0xd4cf('0x3')],'app':'Set','appdata':_0xd4cf('0xf'),'context':_0x332f55[_0xd4cf('0x6')],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']},{'type':_0x332f55[_0xd4cf('0x3')],'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x10'),'context':_0x332f55['context'],'exten':_0x332f55[_0xd4cf('0x7')],'priority':_0xe90497++,'VoiceExtensionId':_0x332f55['id']});return _0x4e6f40;}function _0x1769e6(_0x2fa4b3){var _0x11b06a=0x2;var _0x8c327a=[{'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x12'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':_0x2fa4b3[_0xd4cf('0x8')]?_0xd4cf('0x4'):_0xd4cf('0x9'),'appdata':_0x2fa4b3[_0xd4cf('0x8')]?_0xd4cf('0xa')+_0x2fa4b3[_0xd4cf('0x8')]:_0xd4cf('0xb'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3['exten'],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':'Set','appdata':'CDR(destination)='+(_0x2fa4b3[_0xd4cf('0x13')]?_0xd4cf('0x14')+_0x2fa4b3[_0xd4cf('0x13')]+'}':_0xd4cf('0x15')),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':'outbound','app':_0xd4cf('0x4'),'appdata':'CDR(routeid)='+_0x2fa4b3['id'],'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x11b06a+0x2)+'):Goto('+(_0x11b06a+0x1)+')','context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':'outbound','app':'Set','appdata':_0x2fa4b3['cutdigits']?_0xd4cf('0x16')+_0x2fa4b3['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x2fa4b3['context'],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':'outbound','app':_0xd4cf('0x4'),'appdata':_0xd4cf('0xe'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0xf'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3['exten'],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x10'),'context':_0x2fa4b3['context'],'exten':_0x2fa4b3['exten'],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x17')+_0x2fa4b3['id'],'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']}];if(_0x2fa4b3[_0xd4cf('0x18')](_0xd4cf('0x19'))&&_0x2fa4b3[_0xd4cf('0x19')]!=='none'){_0x8c327a[_0xd4cf('0xd')]({'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x1a'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']},{'type':_0xd4cf('0x11'),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x1b')+_0x2fa4b3[_0xd4cf('0x19')]||_0xd4cf('0x1c'),'context':_0x2fa4b3[_0xd4cf('0x6')],'exten':_0x2fa4b3[_0xd4cf('0x7')],'priority':_0x11b06a++,'VoiceExtensionId':_0x2fa4b3['id']});}return _0x8c327a;}function _0x4b7399(_0x54a6c2,_0x313a5a){var _0x3a1ea2=[{'name':_0xd4cf('0x1d'),'param':0x0},{'name':_0xd4cf('0x1e'),'param':0x1},{'name':_0xd4cf('0x1f'),'param':0x2},{'name':_0xd4cf('0x20'),'param':0x3}];var _0x3ffc93={};var _0x277106=_0x313a5a['split'](',');var _0x30dcfc=[];for(var _0x2b1a48=0x0;_0x2b1a48<_0x3a1ea2[_0xd4cf('0x21')];_0x2b1a48++){switch(_0x3a1ea2[_0x2b1a48]['name']){case'trunk':_0x3ffc93[_0xd4cf('0x1d')]=_0x277106[_0x3a1ea2[_0x2b1a48][_0xd4cf('0x22')]][_0xd4cf('0x23')]('/')[0x1];_0x3ffc93[_0xd4cf('0x24')]=_0x277106[_0x3a1ea2[_0x2b1a48]['param']][_0xd4cf('0x23')]('/')[0x2];_0x3ffc93[_0xd4cf('0x25')]=_0x3ffc93[_0xd4cf('0x24')]?_0x3ffc93[_0xd4cf('0x24')]['split']('$')[0x0]:undefined;_0x3ffc93['phone']=_0x54a6c2['cutdigits']?(_0x3ffc93[_0xd4cf('0x25')]||'')+_0xd4cf('0x14')+_0x54a6c2[_0xd4cf('0x13')]+'}':(_0x3ffc93[_0xd4cf('0x25')]||'')+_0xd4cf('0x15');_0x30dcfc[_0x3a1ea2[_0x2b1a48][_0xd4cf('0x22')]]=[_0xd4cf('0x26'),_0x3ffc93[_0xd4cf('0x1d')],_0x3ffc93['phone']]['join']('/');break;case'options':_0x3ffc93[_0xd4cf('0x1f')]=_0x277106[_0x3a1ea2[_0x2b1a48]['param']];if(_0x54a6c2[_0xd4cf('0x19')]!==_0xd4cf('0x27')){if(_0x3ffc93[_0xd4cf('0x1f')]['indexOf'](_0xd4cf('0x28'))<0x0){_0x3ffc93[_0xd4cf('0x1f')]+='U(xcally-mixmonitor-context)';}}else{_0x3ffc93[_0xd4cf('0x1f')]=_0x3ffc93['options'][_0xd4cf('0x29')]('U(xcally-mixmonitor-context)','');}_0x30dcfc[_0x3a1ea2[_0x2b1a48][_0xd4cf('0x22')]]=_0x3ffc93[_0xd4cf('0x1f')];break;default:_0x30dcfc[_0x3a1ea2[_0x2b1a48]['param']]=_0x277106[_0x3a1ea2[_0x2b1a48]['param']];}}return _0x30dcfc['join'](',');}function _0x468418(_0x316509,_0x2afc4b,_0x33ebb4){return new Promise(function(_0x430e0e,_0x6d3af9){var _0x5d0cbe=[];if(_[_0xd4cf('0x2a')](_0x2afc4b))return _0x430e0e(_0x5d0cbe);_0x356001[_0xd4cf('0x2b')][_0xd4cf('0x2c')]({'attributes':['id',_0xd4cf('0x2d'),'IntervalId'],'raw':!![]})[_0xd4cf('0x2e')](function(_0x53b3c7){for(var _0x3f63b4=0x0,_0x179c15=0x0;_0x3f63b4<_0x2afc4b['length'];_0x3f63b4++,_0x179c15=0x0){var _0x4be48c=_0x2afc4b[_0x3f63b4];var _0x10d021=[];var _0x37582d=[];delete _0x4be48c['id'];if(_0x4be48c['interval']!==_0xd4cf('0x2f')){_0x4be48c[_0xd4cf('0x30')]=[_0x4be48c[_0xd4cf('0x2d')]];}else{_0x4be48c[_0xd4cf('0x30')]=_0x4be48c[_0xd4cf('0x31')]?_['map'](_[_0xd4cf('0x32')](_0x53b3c7,{'IntervalId':_0x4be48c[_0xd4cf('0x31')]}),_0xd4cf('0x2d')):[];}_0x4be48c[_0xd4cf('0x6')]=_0x316509[_0xd4cf('0x6')];_0x4be48c[_0xd4cf('0x7')]=_0x316509['exten'];if(_0x4be48c[_0xd4cf('0x3')])_0x4be48c[_0xd4cf('0x3')]=_0x4be48c[_0xd4cf('0x3')][_0xd4cf('0x33')]();if(_0x316509[_0xd4cf('0x3')]===_0xd4cf('0x11')){if(_0x4be48c[_0xd4cf('0x18')]('tag')&&_0x4be48c[_0xd4cf('0x34')]&&_0x4be48c[_0xd4cf('0x34')]!=='--'){_0x10d021[_0xd4cf('0xd')]({'type':_0x4be48c[_0xd4cf('0x3')]['toLowerCase'](),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x35')+_0x4be48c[_0xd4cf('0x34')],'context':_0x316509[_0xd4cf('0x6')],'exten':_0x316509[_0xd4cf('0x7')],'priority':_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')]+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});}_0x10d021['push']({'type':_0x4be48c['type']['toLowerCase'](),'app':_0xd4cf('0x36'),'appdata':_0xd4cf('0x37')+(_0x4be48c[_0xd4cf('0x38')]?_0xd4cf('0x39')+_0x4be48c[_0xd4cf('0x38')]+')':'NoOp(No\x20number\x20available)'),'context':_0x316509['context'],'exten':_0x316509[_0xd4cf('0x7')],'priority':_0x4be48c['intervals'][_0xd4cf('0x21')]+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});}else{if(_0x4be48c[_0xd4cf('0x18')]('answer')){if([_0xd4cf('0x3a'),_0xd4cf('0x3b')]['includes'](_0x4be48c['app']['toLowerCase']())&&_0x4be48c['appType']!==_0xd4cf('0x3c')){if(_0x4be48c[_0xd4cf('0x3d')]){_0x10d021['push']({'type':_0x4be48c[_0xd4cf('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':_0xd4cf('0x3e'),'context':_0x316509[_0xd4cf('0x6')],'exten':_0x316509[_0xd4cf('0x7')],'priority':_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')]+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});_0x10d021[_0xd4cf('0xd')]({'type':_0x4be48c[_0xd4cf('0x3')][_0xd4cf('0x33')](),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x3f'),'context':_0x316509[_0xd4cf('0x6')],'exten':_0x316509[_0xd4cf('0x7')],'priority':_0x4be48c[_0xd4cf('0x30')]['length']+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});}else{_0x10d021[_0xd4cf('0xd')]({'type':_0x4be48c[_0xd4cf('0x3')][_0xd4cf('0x33')](),'app':_0xd4cf('0x36'),'appdata':_0xd4cf('0x40'),'context':_0x316509[_0xd4cf('0x6')],'exten':_0x316509['exten'],'priority':_0x4be48c['intervals'][_0xd4cf('0x21')]+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});_0x10d021[_0xd4cf('0xd')]({'type':_0x4be48c[_0xd4cf('0x3')][_0xd4cf('0x33')](),'app':_0xd4cf('0x4'),'appdata':_0xd4cf('0x41'),'context':_0x316509[_0xd4cf('0x6')],'exten':_0x316509[_0xd4cf('0x7')],'priority':_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')]+_0x33ebb4+_0x179c15++,'VoiceExtensionId':_0x316509['id']});}}}}for(var _0x671fb9=0x0;_0x671fb9<_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')];_0x671fb9++){var _0x4cbe4f=_0x33ebb4+_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')];var _0x419149=_0x671fb9===_0x4be48c[_0xd4cf('0x30')][_0xd4cf('0x21')]-0x1?_0x33ebb4+_0x10d021[_0xd4cf('0x21')]+_0x37582d[_0xd4cf('0x21')]+0x2:_0x33ebb4+_0x671fb9+0x1;_0x10d021[_0xd4cf('0x42')](_0x671fb9,0x0,{'type':_0x316509[_0xd4cf('0x3')],'app':_0xd4cf('0x43'),'appdata':_0x4be48c[_0xd4cf('0x30')][_0x671fb9]+'?'+_0x316509[_0xd4cf('0x6')]+_0xd4cf('0x44')+_0x4cbe4f+':'+_0x316509['context']+_0xd4cf('0x44')+_0x419149,'exten':_0x316509[_0xd4cf('0x7')],'context':_0x316509[_0xd4cf('0x6')],'priority':_0x33ebb4+_0x671fb9,'VoiceExtensionId':_0x316509['id']});}if(_0x4be48c[_0xd4cf('0x45')]===_0xd4cf('0x46'))_0x4be48c[_0xd4cf('0x47')]=_0x4b7399(_0x316509,_0x4be48c[_0xd4cf('0x47')]);_0x4be48c[_0xd4cf('0x48')]=_0x10d021['length']?_[_0xd4cf('0x49')](_0x10d021)['priority']+0x1:_0x33ebb4;_0x5d0cbe=_[_0xd4cf('0x4a')](_0x5d0cbe,_0x10d021,[_0x4be48c],_0x37582d);_0x33ebb4=_[_0xd4cf('0x49')](_0x5d0cbe)[_0xd4cf('0x48')]+0x1;}return _0x430e0e(_0x5d0cbe);})['catch'](function(_0x4112fc){_0x6d3af9(_0x4112fc);});});}return _0x4072d3['define'](_0xd4cf('0x4b'),attributes,{'tableName':_0xd4cf('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5353e2){var _0x13acbe=this[_0xd4cf('0x4d')]({'plain':!![]});var _0x39d32d=_0x13acbe[_0xd4cf('0x3')]===_0xd4cf('0x11')?_0x1769e6(_0x13acbe):_0x407d96(_0x13acbe);return _0x468418(_0x13acbe,_0x5353e2,_[_0xd4cf('0x49')](_0x39d32d)[_0xd4cf('0x48')]+0x1)[_0xd4cf('0x2e')](function(_0x514cf2){var _0x2afdd0=_[_0xd4cf('0x4a')](_0x39d32d,_0x514cf2);_0x2afdd0['push']({'type':_0x13acbe[_0xd4cf('0x3')],'app':'Hangup','exten':_0x13acbe[_0xd4cf('0x7')],'context':_0x13acbe[_0xd4cf('0x6')],'priority':_['last'](_0x2afdd0)[_0xd4cf('0x48')]+0x1,'VoiceExtensionId':_0x13acbe['id']});return _0x2afdd0;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 662ac4a..9dac5d3 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 _0x1bce=['map','model','GetVoiceExtension','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','VoiceExtension','options','attributes','limit','include'];(function(_0x34af74,_0x59ab9d){var _0x12d74b=function(_0x51a854){while(--_0x51a854){_0x34af74['push'](_0x34af74['shift']());}};_0x12d74b(++_0x59ab9d);}(_0x1bce,0x73));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var moment=require('moment');var BPromise=require(_0xe1bc('0x2'));var rs=require(_0xe1bc('0x3'));var fs=require('fs');var Redis=require(_0xe1bc('0x4'));var db=require(_0xe1bc('0x5'))['db'];var utils=require(_0xe1bc('0x6'));var logger=require(_0xe1bc('0x7'))(_0xe1bc('0x8'));var config=require(_0xe1bc('0x9'));var jayson=require(_0xe1bc('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xe1bc('0xb')]=_[_0xe1bc('0xc')](config[_0xe1bc('0xb')],{'host':_0xe1bc('0xd'),'port':0x18eb});var socket=require(_0xe1bc('0xe'))(new Redis(config[_0xe1bc('0xb')]));require('./voiceExtension.socket')[_0xe1bc('0xf')](socket);function respondWithRpcPromise(_0x5718a3,_0x191147,_0x355757){return new BPromise(function(_0x43e2b8,_0x55f429){return client[_0xe1bc('0x10')](_0x5718a3,_0x355757)[_0xe1bc('0x11')](function(_0x5239e0){logger[_0xe1bc('0x12')](_0xe1bc('0x13'),_0x191147,'request\x20sent');logger['debug'](_0xe1bc('0x14'),_0x191147,_0xe1bc('0x15'),JSON[_0xe1bc('0x16')](_0x5239e0));if(_0x5239e0['error']){if(_0x5239e0['error'][_0xe1bc('0x17')]===0x1f4){logger[_0xe1bc('0x18')](_0xe1bc('0x13'),_0x191147,_0x5239e0['error'][_0xe1bc('0x19')]);return _0x55f429(_0x5239e0[_0xe1bc('0x18')][_0xe1bc('0x19')]);}logger[_0xe1bc('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x191147,_0x5239e0[_0xe1bc('0x18')]['message']);return _0x43e2b8(_0x5239e0[_0xe1bc('0x18')][_0xe1bc('0x19')]);}else{logger['info'](_0xe1bc('0x13'),_0x191147,_0xe1bc('0x15'));_0x43e2b8(_0x5239e0[_0xe1bc('0x1a')][_0xe1bc('0x19')]);}})[_0xe1bc('0x1b')](function(_0x47620e){logger['error'](_0xe1bc('0x13'),_0x191147,_0x47620e);_0x55f429(_0x47620e);});});}exports['GetVoiceExtension']=function(_0x6fbd46){var _0x25c548=this;return new Promise(function(_0x417a37,_0x1d222c){return db[_0xe1bc('0x1c')]['findAll']({'raw':_0x6fbd46[_0xe1bc('0x1d')]?_0x6fbd46['options']['raw']===undefined?!![]:![]:!![],'where':_0x6fbd46[_0xe1bc('0x1d')]?_0x6fbd46[_0xe1bc('0x1d')]['where']||null:null,'attributes':_0x6fbd46['options']?_0x6fbd46[_0xe1bc('0x1d')][_0xe1bc('0x1e')]||null:null,'limit':_0x6fbd46[_0xe1bc('0x1d')]?_0x6fbd46[_0xe1bc('0x1d')][_0xe1bc('0x1f')]||null:null,'include':_0x6fbd46[_0xe1bc('0x1d')]?_0x6fbd46[_0xe1bc('0x1d')][_0xe1bc('0x20')]?_[_0xe1bc('0x21')](_0x6fbd46[_0xe1bc('0x1d')][_0xe1bc('0x20')],function(_0x3d1946){return{'model':db[_0x3d1946[_0xe1bc('0x22')]],'as':_0x3d1946['as'],'attributes':_0x3d1946['attributes'],'include':_0x3d1946['include']?_[_0xe1bc('0x21')](_0x3d1946['include'],function(_0x43527d){return{'model':db[_0x43527d['model']],'as':_0x43527d['as'],'attributes':_0x43527d[_0xe1bc('0x1e')],'include':_0x43527d['include']?_['map'](_0x43527d[_0xe1bc('0x20')],function(_0x3958a4){return{'model':db[_0x3958a4['model']],'as':_0x3958a4['as'],'attributes':_0x3958a4['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1bc('0x11')](function(_0x23caa1){logger[_0xe1bc('0x12')](_0xe1bc('0x23'),_0x6fbd46);logger[_0xe1bc('0x24')](_0xe1bc('0x23'),_0x6fbd46,JSON[_0xe1bc('0x16')](_0x23caa1));_0x417a37(_0x23caa1);})[_0xe1bc('0x1b')](function(_0x32bedb){logger['error'](_0xe1bc('0x23'),_0x32bedb[_0xe1bc('0x19')],_0x6fbd46);_0x1d222c(_0x25c548[_0xe1bc('0x18')](0x1f4,_0x32bedb['message']));});});}; \ No newline at end of file +var _0x4e83=['VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceExtension.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension'];(function(_0x979fa0,_0x507187){var _0x442532=function(_0x347477){while(--_0x347477){_0x979fa0['push'](_0x979fa0['shift']());}};_0x442532(++_0x507187);}(_0x4e83,0x1ae));var _0x34e8=function(_0x5cbf3a,_0x31b32b){_0x5cbf3a=_0x5cbf3a-0x0;var _0x360805=_0x4e83[_0x5cbf3a];return _0x360805;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});config[_0x34e8('0x8')]=_[_0x34e8('0x9')](config[_0x34e8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x34e8('0xa'))(new Redis(config[_0x34e8('0x8')]));require(_0x34e8('0xb'))['register'](socket);function respondWithRpcPromise(_0x8ad56d,_0x1e3038,_0x42bb8d){return new BPromise(function(_0x46fe66,_0x316e99){return client[_0x34e8('0xc')](_0x8ad56d,_0x42bb8d)[_0x34e8('0xd')](function(_0x6827a3){logger[_0x34e8('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'));logger[_0x34e8('0x10')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'),JSON[_0x34e8('0x11')](_0x6827a3));if(_0x6827a3[_0x34e8('0x12')]){if(_0x6827a3[_0x34e8('0x12')][_0x34e8('0x13')]===0x1f4){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x316e99(_0x6827a3['error'][_0x34e8('0x15')]);}logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x46fe66(_0x6827a3['error'][_0x34e8('0x15')]);}else{logger[_0x34e8('0xe')](_0x34e8('0x14'),_0x1e3038,_0x34e8('0xf'));_0x46fe66(_0x6827a3[_0x34e8('0x16')][_0x34e8('0x15')]);}})[_0x34e8('0x17')](function(_0x3eb461){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x3eb461);_0x316e99(_0x3eb461);});});}exports[_0x34e8('0x18')]=function(_0x53b90a){var _0x37fc9e=this;return new Promise(function(_0x368706,_0xe42e15){return db[_0x34e8('0x19')][_0x34e8('0x1a')]({'raw':_0x53b90a[_0x34e8('0x1b')]?_0x53b90a[_0x34e8('0x1b')][_0x34e8('0x1c')]===undefined?!![]:![]:!![],'where':_0x53b90a['options']?_0x53b90a[_0x34e8('0x1b')][_0x34e8('0x1d')]||null:null,'attributes':_0x53b90a['options']?_0x53b90a[_0x34e8('0x1b')]['attributes']||null:null,'limit':_0x53b90a[_0x34e8('0x1b')]?_0x53b90a[_0x34e8('0x1b')][_0x34e8('0x1e')]||null:null,'include':_0x53b90a['options']?_0x53b90a['options'][_0x34e8('0x1f')]?_[_0x34e8('0x20')](_0x53b90a[_0x34e8('0x1b')][_0x34e8('0x1f')],function(_0x2e29fb){return{'model':db[_0x2e29fb[_0x34e8('0x21')]],'as':_0x2e29fb['as'],'attributes':_0x2e29fb[_0x34e8('0x22')],'include':_0x2e29fb['include']?_[_0x34e8('0x20')](_0x2e29fb[_0x34e8('0x1f')],function(_0x46c2a0){return{'model':db[_0x46c2a0[_0x34e8('0x21')]],'as':_0x46c2a0['as'],'attributes':_0x46c2a0[_0x34e8('0x22')],'include':_0x46c2a0[_0x34e8('0x1f')]?_[_0x34e8('0x20')](_0x46c2a0[_0x34e8('0x1f')],function(_0x2b445a){return{'model':db[_0x2b445a[_0x34e8('0x21')]],'as':_0x2b445a['as'],'attributes':_0x2b445a[_0x34e8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x34e8('0xd')](function(_0x1df399){logger[_0x34e8('0xe')](_0x34e8('0x18'),_0x53b90a);logger[_0x34e8('0x10')](_0x34e8('0x18'),_0x53b90a,JSON['stringify'](_0x1df399));_0x368706(_0x1df399);})[_0x34e8('0x17')](function(_0x1a3146){logger['error'](_0x34e8('0x18'),_0x1a3146[_0x34e8('0x15')],_0x53b90a);_0xe42e15(_0x37fc9e[_0x34e8('0x12')](0x1f4,_0x1a3146[_0x34e8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0c2ac00..de2fca4 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 _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x47179e,_0x5a6ac3){var _0x35aa82=function(_0x2dc9c9){while(--_0x2dc9c9){_0x47179e['push'](_0x47179e['shift']());}};_0x35aa82(++_0x5a6ac3);}(_0x5fab,0x177));var _0xb5fa=function(_0x46c8fb,_0x253501){_0x46c8fb=_0x46c8fb-0x0;var _0x48f9eb=_0x5fab[_0x46c8fb];return _0x48f9eb;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x47bf22,_0x428e2c){var _0x3c9a31=function(_0x27fada){while(--_0x27fada){_0x47bf22['push'](_0x47bf22['shift']());}};_0x3c9a31(++_0x428e2c);}(_0x7a54,0x106));var _0x47a5=function(_0x2fdfda,_0x1d6a0e){_0x2fdfda=_0x2fdfda-0x0;var _0x546bf4=_0x7a54[_0x2fdfda];return _0x546bf4;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index a9e60ef..1e6aaaf 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 _0x1883=['index','/:id','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0x1883,0xab));var _0x3188=function(_0x3f088e,_0x422e52){_0x3f088e=_0x3f088e-0x0;var _0x443c86=_0x1883[_0x3f088e];return _0x443c86;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['show']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['post']('/',auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xe'),auth['isAuthenticated'](),controller[_0x3188('0x13')]);router[_0x3188('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3188('0x15')]);module[_0x3188('0x16')]=router; \ No newline at end of file +var _0x90b1=['getMessages','post','create','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/messages'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x90b1,0x1bb));var _0x190b=function(_0x7d78f,_0x22d980){_0x7d78f=_0x7d78f-0x0;var _0x1005c3=_0x90b1[_0x7d78f];return _0x1005c3;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')]('/',auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x10')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0x11')]);router['delete'](_0x190b('0x9'),auth[_0x190b('0xa')](),controller['destroy']);module[_0x190b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index c735431..4bb71cc 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 _0x62ad=['sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x4ed30f,_0x4b4b87){var _0x3e55f4=function(_0x1dd232){while(--_0x1dd232){_0x4ed30f['push'](_0x4ed30f['shift']());}};_0x3e55f4(++_0x4b4b87);}(_0x62ad,0xee));var _0xd62a=function(_0x5d1fcc,_0x1cb014){_0x5d1fcc=_0x5d1fcc-0x0;var _0x1f196e=_0x62ad[_0x5d1fcc];return _0x1f196e;};'use strict';var Sequelize=require(_0xd62a('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xd62a('0x1')]},'context':{'type':Sequelize[_0xd62a('0x1')],'defaultValue':_0xd62a('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xd62a('0x1')],'defaultValue':'','allowNull':![],'unique':_0xd62a('0x3')},'password':{'type':Sequelize[_0xd62a('0x1')]},'fullname':{'type':Sequelize[_0xd62a('0x1')]},'email':{'type':Sequelize[_0xd62a('0x1')],'validate':{'isEmail':!![]},'set':function(_0x2e76b6){this[_0xd62a('0x4')](_0xd62a('0x5'),typeof _0x2e76b6==='string'&&_0x2e76b6[_0xd62a('0x6')]()?_0x2e76b6[_0xd62a('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xd62a('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xd62a('0x7')](_0xd62a('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xd62a('0x7')](_0xd62a('0x8'),'no'),'defaultValue':_0xd62a('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd62a('0x1')]},'callback':{'type':Sequelize[_0xd62a('0x1')]},'review':{'type':Sequelize[_0xd62a('0x7')](_0xd62a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd62a('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd62a('0x7')](_0xd62a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd62a('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xd62a('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xd62a('0x7')](_0xd62a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd62a('0x7')](_0xd62a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd62a('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xd62a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd62a('0x7')](_0xd62a('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xd62a('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xd62a('0x1')]},'maxsecs':{'type':Sequelize[_0xd62a('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd62a('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd62a('0xc')],'get':function(){return this[_0xd62a('0xd')](_0xd62a('0xe'))+_0xd62a('0xf')+this['getDataValue'](_0xd62a('0x10'));}}}; \ No newline at end of file +var _0xe027=['yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','string','trim','central','ENUM'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe027,0x178));var _0x7e02=function(_0x17cfa0,_0x4a480d){_0x17cfa0=_0x17cfa0-0x0;var _0x5a6e9d=_0xe027[_0x17cfa0];return _0x5a6e9d;};'use strict';var Sequelize=require(_0x7e02('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7e02('0x1')],'defaultValue':_0x7e02('0x2'),'unique':_0x7e02('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x7e02('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7e02('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3247e7){this['setDataValue']('email',typeof _0x3247e7===_0x7e02('0x4')&&_0x3247e7[_0x7e02('0x5')]()?_0x3247e7['trim']():null);}},'pager':{'type':Sequelize[_0x7e02('0x1')]},'tz':{'type':Sequelize[_0x7e02('0x1')],'defaultValue':_0x7e02('0x6')},'attach':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':_0x7e02('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x7e02('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x7e02('0x1')]},'callback':{'type':Sequelize[_0x7e02('0x1')]},'review':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':_0x7e02('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7e02('0x7')](_0x7e02('0x8'),'no'),'defaultValue':_0x7e02('0x8'),'allowNull':![]},'stamp':{'type':_0x7e02('0x9')},'emailsubject':{'type':Sequelize[_0x7e02('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x7e02('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7e02('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7e02('0xb')],'get':function(){return this[_0x7e02('0xc')](_0x7e02('0xd'))+_0x7e02('0xe')+this[_0x7e02('0xc')](_0x7e02('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 34d1056..ecf03e4 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 _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x3b934b,_0x11f330){var _0x16e6dc=function(_0x25f455){while(--_0x25f455){_0x3b934b['push'](_0x3b934b['shift']());}};_0x16e6dc(++_0x11f330);}(_0x9c00,0x1a0));var _0x09c0=function(_0x1ef2e3,_0x380ec2){_0x1ef2e3=_0x1ef2e3-0x0;var _0x173e11=_0x9c00[_0x1ef2e3];return _0x173e11;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file +var _0xea28=['undefined','limit','count','reject','update','then','get','Voicemails','sendStatus','stack','name','send','index','map','VoiceMail','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','getMessages','VoiceMailMessage','rawAttributes','order','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x1788c5,_0x183a9d){var _0x41830f=function(_0xddf3aa){while(--_0xddf3aa){_0x1788c5['push'](_0x1788c5['shift']());}};_0x41830f(++_0x183a9d);}(_0xea28,0x13a));var _0x8ea2=function(_0x39e428,_0x38293d){_0x39e428=_0x39e428-0x0;var _0x5a497b=_0xea28[_0x39e428];return _0x5a497b;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['VoiceMail']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))[_0x8ea2('0x42')](handleError(_0x58674d,null));};exports[_0x8ea2('0x51')]=function(_0x3836c3,_0x36fda3,_0x5265e7){return db['VoiceMail']['findOne']({'where':{'id':_0x3836c3[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x36fda3,null))[_0x8ea2('0x23')](function(_0x2bbec0){var _0x57720d;var _0x11824e={},_0x2b8662={};_0x2b8662['model']=_[_0x8ea2('0x31')](db[_0x8ea2('0x52')][_0x8ea2('0x53')]);_0x2b8662[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x3836c3['query']);_0x2b8662['filters']=_['intersection'](_0x2b8662[_0x8ea2('0x2f')],_0x2b8662[_0x8ea2('0x30')]);_0x11824e[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x2b8662[_0x8ea2('0x2f')],qs['fields'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x11824e[_0x8ea2('0x32')]=_0x11824e[_0x8ea2('0x32')]['length']?_0x11824e[_0x8ea2('0x32')]:_0x2b8662['model'];if(!_0x3836c3[_0x8ea2('0x30')]['hasOwnProperty'](_0x8ea2('0x36'))){_0x11824e[_0x8ea2('0x1f')]=qs['limit'](_0x3836c3['query'][_0x8ea2('0x1f')]);_0x11824e['offset']=qs[_0x8ea2('0x1d')](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x11824e[_0x8ea2('0x54')]=qs['sort'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x37')]);_0x11824e[_0x8ea2('0x38')]=qs[_0x8ea2('0x3a')](_[_0x8ea2('0x39')](_0x3836c3[_0x8ea2('0x30')],_0x2b8662[_0x8ea2('0x3a')]));if(_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'$or':_['map'](_0x11824e[_0x8ea2('0x32')],function(_0x2d130a){var _0x4de6ba={};_0x4de6ba[_0x2d130a]={'$like':'%'+_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]+'%'};return _0x4de6ba;})});}_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'mailboxuser':_0x2bbec0[_0x8ea2('0x55')]});_0x11824e=_[_0x8ea2('0x3c')]({},_0x11824e,_0x3836c3[_0x8ea2('0x3f')]);return db[_0x8ea2('0x52')]['findAndCountAll'](_0x11824e)[_0x8ea2('0x23')](respondWithFilteredResult(_0x36fda3,_0x11824e));})[_0x8ea2('0x42')](handleError(_0x36fda3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ef64f47..46787d6 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 _0x9857=['define','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9857,0x100));var _0x7985=function(_0x1d2bfd,_0x5e22c1){_0x1d2bfd=_0x1d2bfd-0x0;var _0x3e4414=_0x9857[_0x1d2bfd];return _0x3e4414;};'use strict';var _=require(_0x7985('0x0'));var util=require(_0x7985('0x1'));var logger=require(_0x7985('0x2'))(_0x7985('0x3'));var moment=require(_0x7985('0x4'));var BPromise=require(_0x7985('0x5'));var rp=require(_0x7985('0x6'));var fs=require('fs');var path=require(_0x7985('0x7'));var rimraf=require('rimraf');var config=require(_0x7985('0x8'));var attributes=require('./voiceMail.attributes');module[_0x7985('0x9')]=function(_0x172b7f,_0x22df26){return _0x172b7f[_0x7985('0xa')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x7985('0xb'),'fields':[_0x7985('0xc'),_0x7985('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31c8=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x815c23,_0x577e3a){var _0x357aa1=function(_0x289b7a){while(--_0x289b7a){_0x815c23['push'](_0x815c23['shift']());}};_0x357aa1(++_0x577e3a);}(_0x31c8,0x89));var _0x831c=function(_0x57d32a,_0x4d051e){_0x57d32a=_0x57d32a-0x0;var _0x2f11a2=_0x31c8[_0x57d32a];return _0x2f11a2;};'use strict';var _=require(_0x831c('0x0'));var util=require(_0x831c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x831c('0x2'));var BPromise=require(_0x831c('0x3'));var rp=require(_0x831c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x831c('0x5'));var config=require(_0x831c('0x6'));var attributes=require(_0x831c('0x7'));module[_0x831c('0x8')]=function(_0xb9915a,_0x534e03){return _0xb9915a[_0x831c('0x9')](_0x831c('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x831c('0xb'),'fields':[_0x831c('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8d24630..ed2db2f 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 _0xf4f4=['jayson/promise','client','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4f4,0x134));var _0x4f4f=function(_0x14b61b,_0x8968d9){_0x14b61b=_0x14b61b-0x0;var _0x45e287=_0xf4f4[_0x14b61b];return _0x45e287;};'use strict';var _=require('lodash');var util=require(_0x4f4f('0x0'));var moment=require(_0x4f4f('0x1'));var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f4f('0x5'));var config=require(_0x4f4f('0x6'));var jayson=require(_0x4f4f('0x7'));var client=jayson[_0x4f4f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57d9f3,_0x313fb8,_0x212e5d){return new BPromise(function(_0x5b3154,_0x56adc8){return client['request'](_0x57d9f3,_0x212e5d)[_0x4f4f('0x9')](function(_0x168e8f){logger[_0x4f4f('0xa')](_0x4f4f('0xb'),_0x313fb8,_0x4f4f('0xc'));logger[_0x4f4f('0xd')](_0x4f4f('0xe'),_0x313fb8,_0x4f4f('0xc'),JSON[_0x4f4f('0xf')](_0x168e8f));if(_0x168e8f['error']){if(_0x168e8f[_0x4f4f('0x10')][_0x4f4f('0x11')]===0x1f4){logger[_0x4f4f('0x10')](_0x4f4f('0xb'),_0x313fb8,_0x168e8f['error']['message']);return _0x56adc8(_0x168e8f[_0x4f4f('0x10')][_0x4f4f('0x12')]);}logger[_0x4f4f('0x10')](_0x4f4f('0xb'),_0x313fb8,_0x168e8f['error'][_0x4f4f('0x12')]);return _0x5b3154(_0x168e8f['error']['message']);}else{logger[_0x4f4f('0xa')](_0x4f4f('0xb'),_0x313fb8,_0x4f4f('0xc'));_0x5b3154(_0x168e8f[_0x4f4f('0x13')][_0x4f4f('0x12')]);}})[_0x4f4f('0x14')](function(_0x567759){logger[_0x4f4f('0x10')]('VoiceMail,\x20%s,\x20%s',_0x313fb8,_0x567759);_0x56adc8(_0x567759);});});} \ No newline at end of file +var _0xdea4=['then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdea4,0x19a));var _0x4dea=function(_0x471344,_0x4b9cdd){_0x471344=_0x471344-0x0;var _0x22a302=_0xdea4[_0x471344];return _0x22a302;};'use strict';var _=require(_0x4dea('0x0'));var util=require(_0x4dea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4dea('0x2'));var db=require(_0x4dea('0x3'))['db'];var utils=require(_0x4dea('0x4'));var logger=require(_0x4dea('0x5'))('rpc');var config=require(_0x4dea('0x6'));var jayson=require(_0x4dea('0x7'));var client=jayson[_0x4dea('0x8')][_0x4dea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2017,_0x331781,_0x1e30bf){return new BPromise(function(_0x3e6e70,_0x1dfa02){return client['request'](_0x2b2017,_0x1e30bf)[_0x4dea('0xa')](function(_0xfab72d){logger[_0x4dea('0xb')](_0x4dea('0xc'),_0x331781,_0x4dea('0xd'));logger['debug'](_0x4dea('0xe'),_0x331781,'request\x20sent',JSON[_0x4dea('0xf')](_0xfab72d));if(_0xfab72d['error']){if(_0xfab72d[_0x4dea('0x10')][_0x4dea('0x11')]===0x1f4){logger['error'](_0x4dea('0xc'),_0x331781,_0xfab72d['error'][_0x4dea('0x12')]);return _0x1dfa02(_0xfab72d[_0x4dea('0x10')][_0x4dea('0x12')]);}logger['error'](_0x4dea('0xc'),_0x331781,_0xfab72d[_0x4dea('0x10')][_0x4dea('0x12')]);return _0x3e6e70(_0xfab72d['error']['message']);}else{logger['info'](_0x4dea('0xc'),_0x331781,_0x4dea('0xd'));_0x3e6e70(_0xfab72d[_0x4dea('0x13')][_0x4dea('0x12')]);}})[_0x4dea('0x14')](function(_0x4595a8){logger['error'](_0x4dea('0xc'),_0x331781,_0x4595a8);_0x1dfa02(_0x4595a8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9a900b6..8496697 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 _0x6bc1=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete'];(function(_0x55805b,_0x46e0d7){var _0x26ae17=function(_0x1bf240){while(--_0x1bf240){_0x55805b['push'](_0x55805b['shift']());}};_0x26ae17(++_0x46e0d7);}(_0x6bc1,0x119));var _0x16bc=function(_0x4dab7c,_0xf7f6c2){_0x4dab7c=_0x4dab7c-0x0;var _0x13426e=_0x6bc1[_0x4dab7c];return _0x13426e;};'use strict';var multer=require(_0x16bc('0x0'));var util=require('util');var path=require(_0x16bc('0x1'));var timeout=require(_0x16bc('0x2'));var express=require(_0x16bc('0x3'));var router=express['Router']();var fs_extra=require(_0x16bc('0x4'));var auth=require(_0x16bc('0x5'));var interaction=require(_0x16bc('0x6'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x16bc('0x7')]('/',auth[_0x16bc('0x8')](),controller[_0x16bc('0x9')]);router[_0x16bc('0x7')](_0x16bc('0xa'),auth[_0x16bc('0x8')](),controller[_0x16bc('0xb')]);router[_0x16bc('0x7')](_0x16bc('0xc'),auth[_0x16bc('0x8')](),controller[_0x16bc('0xd')]);router[_0x16bc('0xe')]('/',auth[_0x16bc('0x8')](),controller[_0x16bc('0xf')]);router[_0x16bc('0x10')](_0x16bc('0xa'),auth[_0x16bc('0x8')](),controller[_0x16bc('0x11')]);router[_0x16bc('0x12')](_0x16bc('0xa'),auth[_0x16bc('0x8')](),controller['destroy']);module[_0x16bc('0x13')]=router; \ No newline at end of file +var _0xceba=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','destroy','multer','util','path','express'];(function(_0x205808,_0x2aa319){var _0x472ea4=function(_0x38de51){while(--_0x38de51){_0x205808['push'](_0x205808['shift']());}};_0x472ea4(++_0x2aa319);}(_0xceba,0x8f));var _0xaceb=function(_0x2323c3,_0x12f22e){_0x2323c3=_0x2323c3-0x0;var _0x26d04d=_0xceba[_0x2323c3];return _0x26d04d;};'use strict';var multer=require(_0xaceb('0x0'));var util=require(_0xaceb('0x1'));var path=require(_0xaceb('0x2'));var timeout=require('connect-timeout');var express=require(_0xaceb('0x3'));var router=express[_0xaceb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaceb('0x5'));var interaction=require(_0xaceb('0x6'));var config=require(_0xaceb('0x7'));var controller=require(_0xaceb('0x8'));router[_0xaceb('0x9')]('/',auth[_0xaceb('0xa')](),controller[_0xaceb('0xb')]);router[_0xaceb('0x9')](_0xaceb('0xc'),auth[_0xaceb('0xa')](),controller[_0xaceb('0xd')]);router['get'](_0xaceb('0xe'),auth[_0xaceb('0xa')](),controller[_0xaceb('0xf')]);router[_0xaceb('0x10')]('/',auth['isAuthenticated'](),controller[_0xaceb('0x11')]);router[_0xaceb('0x12')](_0xaceb('0xc'),auth[_0xaceb('0xa')](),controller[_0xaceb('0x13')]);router['delete']('/:id',auth[_0xaceb('0xa')](),controller[_0xaceb('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 7f4e150..8e15b8b 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 _0xe0f2=['BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING'];(function(_0x3eb21,_0x545849){var _0x4e647a=function(_0xc7c7be){while(--_0xc7c7be){_0x3eb21['push'](_0x3eb21['shift']());}};_0x4e647a(++_0x545849);}(_0xe0f2,0xa5));var _0x2e0f=function(_0x30c6ad,_0x1f5481){_0x30c6ad=_0x30c6ad-0x0;var _0x5e7357=_0xe0f2[_0x30c6ad];return _0x5e7357;};'use strict';var Sequelize=require(_0x2e0f('0x0'));module[_0x2e0f('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x591790){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x2e0f('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x2e0f('0x2')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x2e0f('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x2e0f('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x2e0f('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x2e0f('0x3')](_0x2e0f('0x4')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x2e0f('0x5'),'defaultValue':Sequelize[_0x2e0f('0x6')](_0x2e0f('0x7'))}}; \ No newline at end of file +var _0x35a7=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x4ed5ca,_0x37d9a9){var _0x3f730f=function(_0x1429a7){while(--_0x1429a7){_0x4ed5ca['push'](_0x4ed5ca['shift']());}};_0x3f730f(++_0x37d9a9);}(_0x35a7,0xe4));var _0x735a=function(_0x4eb662,_0x540e40){_0x4eb662=_0x4eb662-0x0;var _0x2d7889=_0x35a7[_0x4eb662];return _0x2d7889;};'use strict';var Sequelize=require(_0x735a('0x0'));module['exports']={'name':{'type':Sequelize[_0x735a('0x1')],'get':function(_0x4f7d3e){return this[_0x735a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x735a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x735a('0x5')](_0x735a('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x735a('0x4')],'defaultValue':''},'stamp':{'type':_0x735a('0x7'),'defaultValue':Sequelize[_0x735a('0x8')](_0x735a('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 257a682..4593c9f 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 _0xe6e4=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','fields','include','create','body','download','find','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra'];(function(_0x5aba05,_0x2b2dd2){var _0x36de06=function(_0x436ebb){while(--_0x436ebb){_0x5aba05['push'](_0x5aba05['shift']());}};_0x36de06(++_0x2b2dd2);}(_0xe6e4,0xa4));var _0x4e6e=function(_0x37e21b,_0x50b31e){_0x37e21b=_0x37e21b-0x0;var _0x411f61=_0xe6e4[_0x37e21b];return _0x411f61;};'use strict';var emlformat=require(_0x4e6e('0x0'));var rimraf=require(_0x4e6e('0x1'));var zipdir=require(_0x4e6e('0x2'));var jsonpatch=require(_0x4e6e('0x3'));var rp=require(_0x4e6e('0x4'));var moment=require(_0x4e6e('0x5'));var BPromise=require(_0x4e6e('0x6'));var Mustache=require(_0x4e6e('0x7'));var util=require('util');var path=require(_0x4e6e('0x8'));var sox=require('sox');var csv=require(_0x4e6e('0x9'));var ejs=require(_0x4e6e('0xa'));var fs=require('fs');var fs_extra=require(_0x4e6e('0xb'));var _=require(_0x4e6e('0xc'));var squel=require(_0x4e6e('0xd'));var crypto=require(_0x4e6e('0xe'));var jsforce=require(_0x4e6e('0xf'));var deskjs=require(_0x4e6e('0x10'));var toCsv=require(_0x4e6e('0x9'));var querystring=require('querystring');var Papa=require(_0x4e6e('0x11'));var Redis=require(_0x4e6e('0x12'));var authService=require(_0x4e6e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e6e('0x14'));var logger=require(_0x4e6e('0x15'))(_0x4e6e('0x16'));var utils=require(_0x4e6e('0x17'));var config=require(_0x4e6e('0x18'));var licenseUtil=require(_0x4e6e('0x19'));var db=require(_0x4e6e('0x1a'))['db'];function respondWithStatusCode(_0x43b043,_0xe914e5){_0xe914e5=_0xe914e5||0xcc;return function(_0x550ac0){if(_0x550ac0){return _0x43b043['sendStatus'](_0xe914e5);}return _0x43b043[_0x4e6e('0x1b')](_0xe914e5)[_0x4e6e('0x1c')]();};}function respondWithResult(_0xec583d,_0x11772c){_0x11772c=_0x11772c||0xc8;return function(_0x549846){if(_0x549846){return _0xec583d['status'](_0x11772c)[_0x4e6e('0x1d')](_0x549846);}};}function respondWithFilteredResult(_0x3531b4,_0x145a76){return function(_0x391420){if(_0x391420){var _0x5d558c=typeof _0x145a76[_0x4e6e('0x1e')]==='undefined'&&typeof _0x145a76[_0x4e6e('0x1f')]===_0x4e6e('0x20');var _0x7bfe50=_0x391420[_0x4e6e('0x21')];var _0x56e87b=_0x5d558c?0x0:_0x145a76['offset'];var _0x50488=_0x5d558c?_0x391420[_0x4e6e('0x21')]:_0x145a76['offset']+_0x145a76[_0x4e6e('0x1f')];var _0x534d92;if(_0x50488>=_0x7bfe50){_0x50488=_0x7bfe50;_0x534d92=0xc8;}else{_0x534d92=0xce;}_0x3531b4[_0x4e6e('0x1b')](_0x534d92);return _0x3531b4[_0x4e6e('0x22')](_0x4e6e('0x23'),_0x56e87b+'-'+_0x50488+'/'+_0x7bfe50)[_0x4e6e('0x1d')](_0x391420);}return null;};}function patchUpdates(_0x5664e9){return function(_0x2ff406){try{jsonpatch[_0x4e6e('0x24')](_0x2ff406,_0x5664e9,!![]);}catch(_0x2c0668){return BPromise[_0x4e6e('0x25')](_0x2c0668);}return _0x2ff406['save']();};}function saveUpdates(_0x186ad0,_0x5a57da){return function(_0x985e96){if(_0x985e96){return _0x985e96[_0x4e6e('0x26')](_0x186ad0)[_0x4e6e('0x27')](function(_0x32bb72){return _0x32bb72;});}return null;};}function removeEntity(_0x3b0e20,_0x411abe){return function(_0x55693a){if(_0x55693a){return _0x55693a[_0x4e6e('0x28')]()[_0x4e6e('0x27')](function(){_0x3b0e20[_0x4e6e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fcb5b,_0x497d2b){return function(_0x5e801f){if(!_0x5e801f){_0x1fcb5b[_0x4e6e('0x29')](0x194);}return _0x5e801f;};}function handleError(_0x42ae57,_0x5d68c4){_0x5d68c4=_0x5d68c4||0x1f4;return function(_0xf0dee7){logger[_0x4e6e('0x2a')](_0xf0dee7['stack']);if(_0xf0dee7['name']){delete _0xf0dee7[_0x4e6e('0x2b')];}_0x42ae57[_0x4e6e('0x1b')](_0x5d68c4)[_0x4e6e('0x2c')](_0xf0dee7);};}exports[_0x4e6e('0x2d')]=function(_0x7ce56a,_0x32a73a){var _0x16b07d={},_0x523612={},_0x560f1e={'count':0x0,'rows':[]};var _0x2d01da=_['map'](db[_0x4e6e('0x2e')][_0x4e6e('0x2f')],function(_0x36e347){return{'name':_0x36e347[_0x4e6e('0x30')],'type':_0x36e347[_0x4e6e('0x31')][_0x4e6e('0x32')]};});_0x523612[_0x4e6e('0x33')]=_['differenceBy'](_[_0x4e6e('0x34')](_0x2d01da,'name'),[_0x4e6e('0x2b')]);_0x523612[_0x4e6e('0x35')]=_['keys'](_0x7ce56a['query']);_0x523612[_0x4e6e('0x36')]=_[_0x4e6e('0x37')](_0x523612[_0x4e6e('0x33')],_0x523612[_0x4e6e('0x35')]);_0x16b07d[_0x4e6e('0x38')]=_['intersection'](_0x523612[_0x4e6e('0x33')],qs['fields'](_0x7ce56a[_0x4e6e('0x35')]['fields']));_0x16b07d['attributes']=_0x16b07d[_0x4e6e('0x38')][_0x4e6e('0x39')]?_0x16b07d[_0x4e6e('0x38')]:_0x523612[_0x4e6e('0x33')];if(!_0x7ce56a[_0x4e6e('0x35')][_0x4e6e('0x3a')](_0x4e6e('0x3b'))){_0x16b07d[_0x4e6e('0x1f')]=qs[_0x4e6e('0x1f')](_0x7ce56a['query'][_0x4e6e('0x1f')]);_0x16b07d[_0x4e6e('0x1e')]=qs[_0x4e6e('0x1e')](_0x7ce56a[_0x4e6e('0x35')]['offset']);}_0x16b07d['order']=qs[_0x4e6e('0x3c')](_0x7ce56a[_0x4e6e('0x35')][_0x4e6e('0x3c')]);_0x16b07d[_0x4e6e('0x3d')]=qs[_0x4e6e('0x36')](_['pick'](_0x7ce56a['query'],_0x523612['filters']),_0x2d01da);if(_0x7ce56a['query'][_0x4e6e('0x3e')]){_0x16b07d[_0x4e6e('0x3d')]=_[_0x4e6e('0x3f')](_0x16b07d['where'],{'$or':_['map'](_0x2d01da,function(_0x307064){if(_0x307064['type']!=='VIRTUAL'){var _0x27591f={};_0x27591f[_0x307064['name']]={'$like':'%'+_0x7ce56a[_0x4e6e('0x35')][_0x4e6e('0x3e')]+'%'};return _0x27591f;}})});}_0x16b07d=_['merge']({},_0x16b07d,_0x7ce56a[_0x4e6e('0x40')]);var _0x299d41={'where':_0x16b07d['where']};return db[_0x4e6e('0x2e')]['count'](_0x299d41)[_0x4e6e('0x27')](function(_0x17da7e){_0x560f1e[_0x4e6e('0x21')]=_0x17da7e;if(_0x7ce56a[_0x4e6e('0x35')][_0x4e6e('0x41')]){_0x16b07d['include']=[{'all':!![]}];}return db[_0x4e6e('0x2e')][_0x4e6e('0x42')](_0x16b07d);})['then'](function(_0x35b190){_0x560f1e[_0x4e6e('0x43')]=_0x35b190;return _0x560f1e;})[_0x4e6e('0x27')](respondWithFilteredResult(_0x32a73a,_0x16b07d))[_0x4e6e('0x44')](handleError(_0x32a73a,null));};exports[_0x4e6e('0x45')]=function(_0x2b7653,_0x6c4bc3){var _0x4af5ad={'raw':!![],'where':{'id':_0x2b7653[_0x4e6e('0x46')]['id']}},_0x47f54f={};_0x47f54f[_0x4e6e('0x33')]=_['keys'](db[_0x4e6e('0x2e')][_0x4e6e('0x2f')]);_0x47f54f[_0x4e6e('0x35')]=_[_0x4e6e('0x47')](_0x2b7653[_0x4e6e('0x35')]);_0x47f54f['filters']=_[_0x4e6e('0x37')](_0x47f54f[_0x4e6e('0x33')],_0x47f54f[_0x4e6e('0x35')]);_0x4af5ad[_0x4e6e('0x38')]=_[_0x4e6e('0x37')](_0x47f54f[_0x4e6e('0x33')],qs[_0x4e6e('0x48')](_0x2b7653[_0x4e6e('0x35')][_0x4e6e('0x48')]));_0x4af5ad[_0x4e6e('0x38')]=_0x4af5ad['attributes'][_0x4e6e('0x39')]?_0x4af5ad[_0x4e6e('0x38')]:_0x47f54f[_0x4e6e('0x33')];if(_0x2b7653[_0x4e6e('0x35')][_0x4e6e('0x41')]){_0x4af5ad[_0x4e6e('0x49')]=[{'all':!![]}];}_0x4af5ad=_['merge']({},_0x4af5ad,_0x2b7653[_0x4e6e('0x40')]);return db[_0x4e6e('0x2e')]['find'](_0x4af5ad)[_0x4e6e('0x27')](handleEntityNotFound(_0x6c4bc3,null))[_0x4e6e('0x27')](respondWithResult(_0x6c4bc3,null))[_0x4e6e('0x44')](handleError(_0x6c4bc3,null));};exports[_0x4e6e('0x4a')]=function(_0x5089f2,_0x2d8c32){return db['VoiceMailMessage'][_0x4e6e('0x4a')](_0x5089f2['body'],{})[_0x4e6e('0x27')](respondWithResult(_0x2d8c32,0xc9))['catch'](handleError(_0x2d8c32,null));};exports['update']=function(_0x137ca4,_0x431cd6){if(_0x137ca4['body']['id']){delete _0x137ca4[_0x4e6e('0x4b')]['id'];}return db[_0x4e6e('0x2e')]['find']({'where':{'id':_0x137ca4[_0x4e6e('0x46')]['id']}})[_0x4e6e('0x27')](handleEntityNotFound(_0x431cd6,null))['then'](saveUpdates(_0x137ca4[_0x4e6e('0x4b')],null))[_0x4e6e('0x27')](respondWithResult(_0x431cd6,null))[_0x4e6e('0x44')](handleError(_0x431cd6,null));};exports['destroy']=function(_0x573042,_0x3f0461){return db['VoiceMailMessage']['find']({'where':{'id':_0x573042[_0x4e6e('0x46')]['id']}})[_0x4e6e('0x27')](handleEntityNotFound(_0x3f0461,null))[_0x4e6e('0x27')](removeEntity(_0x3f0461,null))[_0x4e6e('0x44')](handleError(_0x3f0461,null));};exports[_0x4e6e('0x4c')]=function(_0x378209,_0x3a4fdc,_0xf589f4){return db[_0x4e6e('0x2e')][_0x4e6e('0x4d')]({'where':{'id':_0x378209[_0x4e6e('0x46')]['id']},'attributes':['id',_0x4e6e('0x4e'),_0x4e6e('0x4f')]})[_0x4e6e('0x27')](handleEntityNotFound(_0x3a4fdc,null))[_0x4e6e('0x27')](function(_0x278d54){if(_0x278d54){if(!_0x278d54[_0x4e6e('0x4e')]){throw new db[(_0x4e6e('0x50'))][(_0x4e6e('0x51'))](_0x4e6e('0x52'));}var _0x4d420b={'Content-Type':_0x4e6e('0x53'),'Content-Disposition':_0x4e6e('0x54')};if(_0x278d54[_0x4e6e('0x4f')]){_0x4d420b[_0x4e6e('0x55')]=_0x4e6e('0x56')+_0x278d54[_0x4e6e('0x4f')]+_0x4e6e('0x57');}_0x3a4fdc[_0x4e6e('0x22')](_0x4d420b);return _0x3a4fdc[_0x4e6e('0x2c')](new Buffer(_0x278d54[_0x4e6e('0x4e')]));}})[_0x4e6e('0x44')](handleError(_0x3a4fdc,null));}; \ No newline at end of file +var _0xcce8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','fieldName','type','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','recording','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','.wav\x22','send','eml-format','zip-dir','fast-json-patch','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5a6ee4,_0x2e1727){var _0x5906fa=function(_0x3aacb5){while(--_0x3aacb5){_0x5a6ee4['push'](_0x5a6ee4['shift']());}};_0x5906fa(++_0x2e1727);}(_0xcce8,0x1d7));var _0x8cce=function(_0x502449,_0x24d7a4){_0x502449=_0x502449-0x0;var _0x474d90=_0xcce8[_0x502449];return _0x474d90;};'use strict';var emlformat=require(_0x8cce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8cce('0x1'));var jsonpatch=require(_0x8cce('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8cce('0x3'));var Mustache=require(_0x8cce('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8cce('0x5'));var ejs=require(_0x8cce('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cce('0x7'));var squel=require(_0x8cce('0x8'));var crypto=require(_0x8cce('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8cce('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8cce('0xb'));var Papa=require(_0x8cce('0xc'));var Redis=require(_0x8cce('0xd'));var authService=require(_0x8cce('0xe'));var qs=require(_0x8cce('0xf'));var as=require(_0x8cce('0x10'));var hardwareService=require(_0x8cce('0x11'));var logger=require(_0x8cce('0x12'))(_0x8cce('0x13'));var utils=require(_0x8cce('0x14'));var config=require(_0x8cce('0x15'));var licenseUtil=require(_0x8cce('0x16'));var db=require(_0x8cce('0x17'))['db'];function respondWithStatusCode(_0xe55ba0,_0x4f980b){_0x4f980b=_0x4f980b||0xcc;return function(_0x1d02b1){if(_0x1d02b1){return _0xe55ba0[_0x8cce('0x18')](_0x4f980b);}return _0xe55ba0[_0x8cce('0x19')](_0x4f980b)[_0x8cce('0x1a')]();};}function respondWithResult(_0x540c30,_0x5e89f1){_0x5e89f1=_0x5e89f1||0xc8;return function(_0x21a24b){if(_0x21a24b){return _0x540c30[_0x8cce('0x19')](_0x5e89f1)[_0x8cce('0x1b')](_0x21a24b);}};}function respondWithFilteredResult(_0x3649cb,_0x21ed86){return function(_0x13bb00){if(_0x13bb00){var _0x3e73fe=typeof _0x21ed86[_0x8cce('0x1c')]===_0x8cce('0x1d')&&typeof _0x21ed86['limit']==='undefined';var _0x322d25=_0x13bb00[_0x8cce('0x1e')];var _0x34e5b2=_0x3e73fe?0x0:_0x21ed86[_0x8cce('0x1c')];var _0x2b0b21=_0x3e73fe?_0x13bb00[_0x8cce('0x1e')]:_0x21ed86[_0x8cce('0x1c')]+_0x21ed86[_0x8cce('0x1f')];var _0x1f608c;if(_0x2b0b21>=_0x322d25){_0x2b0b21=_0x322d25;_0x1f608c=0xc8;}else{_0x1f608c=0xce;}_0x3649cb['status'](_0x1f608c);return _0x3649cb[_0x8cce('0x20')](_0x8cce('0x21'),_0x34e5b2+'-'+_0x2b0b21+'/'+_0x322d25)[_0x8cce('0x1b')](_0x13bb00);}return null;};}function patchUpdates(_0x438c24){return function(_0x1635d5){try{jsonpatch['apply'](_0x1635d5,_0x438c24,!![]);}catch(_0x372bc6){return BPromise[_0x8cce('0x22')](_0x372bc6);}return _0x1635d5['save']();};}function saveUpdates(_0x5b8ada,_0x47417c){return function(_0x595434){if(_0x595434){return _0x595434[_0x8cce('0x23')](_0x5b8ada)[_0x8cce('0x24')](function(_0x86a291){return _0x86a291;});}return null;};}function removeEntity(_0x6c1695,_0xbde3b4){return function(_0x31b185){if(_0x31b185){return _0x31b185[_0x8cce('0x25')]()[_0x8cce('0x24')](function(){_0x6c1695[_0x8cce('0x19')](0xcc)[_0x8cce('0x1a')]();});}};}function handleEntityNotFound(_0xd61702,_0x449387){return function(_0x54988f){if(!_0x54988f){_0xd61702[_0x8cce('0x18')](0x194);}return _0x54988f;};}function handleError(_0x45c4fe,_0x5f125e){_0x5f125e=_0x5f125e||0x1f4;return function(_0x33a093){logger[_0x8cce('0x26')](_0x33a093[_0x8cce('0x27')]);if(_0x33a093[_0x8cce('0x28')]){delete _0x33a093[_0x8cce('0x28')];}_0x45c4fe[_0x8cce('0x19')](_0x5f125e)['send'](_0x33a093);};}exports[_0x8cce('0x29')]=function(_0x43bf24,_0x50c328){var _0x44a6a4={},_0x4f1b4f={},_0xd15ced={'count':0x0,'rows':[]};var _0x3ffce9=_[_0x8cce('0x2a')](db['VoiceMailMessage']['rawAttributes'],function(_0x40c3af){return{'name':_0x40c3af[_0x8cce('0x2b')],'type':_0x40c3af[_0x8cce('0x2c')]['key']};});_0x4f1b4f[_0x8cce('0x2d')]=_[_0x8cce('0x2e')](_[_0x8cce('0x2a')](_0x3ffce9,_0x8cce('0x28')),[_0x8cce('0x28')]);_0x4f1b4f['query']=_[_0x8cce('0x2f')](_0x43bf24[_0x8cce('0x30')]);_0x4f1b4f[_0x8cce('0x31')]=_[_0x8cce('0x32')](_0x4f1b4f['model'],_0x4f1b4f[_0x8cce('0x30')]);_0x44a6a4[_0x8cce('0x33')]=_[_0x8cce('0x32')](_0x4f1b4f[_0x8cce('0x2d')],qs['fields'](_0x43bf24['query'][_0x8cce('0x34')]));_0x44a6a4['attributes']=_0x44a6a4[_0x8cce('0x33')][_0x8cce('0x35')]?_0x44a6a4[_0x8cce('0x33')]:_0x4f1b4f[_0x8cce('0x2d')];if(!_0x43bf24['query'][_0x8cce('0x36')]('nolimit')){_0x44a6a4[_0x8cce('0x1f')]=qs['limit'](_0x43bf24['query'][_0x8cce('0x1f')]);_0x44a6a4[_0x8cce('0x1c')]=qs[_0x8cce('0x1c')](_0x43bf24[_0x8cce('0x30')][_0x8cce('0x1c')]);}_0x44a6a4[_0x8cce('0x37')]=qs['sort'](_0x43bf24['query'][_0x8cce('0x38')]);_0x44a6a4['where']=qs[_0x8cce('0x31')](_[_0x8cce('0x39')](_0x43bf24['query'],_0x4f1b4f['filters']),_0x3ffce9);if(_0x43bf24[_0x8cce('0x30')][_0x8cce('0x3a')]){_0x44a6a4['where']=_[_0x8cce('0x3b')](_0x44a6a4[_0x8cce('0x3c')],{'$or':_[_0x8cce('0x2a')](_0x3ffce9,function(_0x59e8b3){if(_0x59e8b3[_0x8cce('0x2c')]!=='VIRTUAL'){var _0x1bbfc3={};_0x1bbfc3[_0x59e8b3[_0x8cce('0x28')]]={'$like':'%'+_0x43bf24[_0x8cce('0x30')]['filter']+'%'};return _0x1bbfc3;}})});}_0x44a6a4=_[_0x8cce('0x3b')]({},_0x44a6a4,_0x43bf24['options']);var _0x287567={'where':_0x44a6a4['where']};return db[_0x8cce('0x3d')][_0x8cce('0x1e')](_0x287567)['then'](function(_0x360735){_0xd15ced[_0x8cce('0x1e')]=_0x360735;if(_0x43bf24['query'][_0x8cce('0x3e')]){_0x44a6a4[_0x8cce('0x3f')]=[{'all':!![]}];}return db[_0x8cce('0x3d')][_0x8cce('0x40')](_0x44a6a4);})[_0x8cce('0x24')](function(_0x46e01e){_0xd15ced[_0x8cce('0x41')]=_0x46e01e;return _0xd15ced;})[_0x8cce('0x24')](respondWithFilteredResult(_0x50c328,_0x44a6a4))[_0x8cce('0x42')](handleError(_0x50c328,null));};exports[_0x8cce('0x43')]=function(_0x252af6,_0x178dbb){var _0x1a1a26={'raw':!![],'where':{'id':_0x252af6[_0x8cce('0x44')]['id']}},_0x25bddc={};_0x25bddc[_0x8cce('0x2d')]=_[_0x8cce('0x2f')](db[_0x8cce('0x3d')]['rawAttributes']);_0x25bddc[_0x8cce('0x30')]=_[_0x8cce('0x2f')](_0x252af6[_0x8cce('0x30')]);_0x25bddc['filters']=_[_0x8cce('0x32')](_0x25bddc[_0x8cce('0x2d')],_0x25bddc['query']);_0x1a1a26[_0x8cce('0x33')]=_[_0x8cce('0x32')](_0x25bddc[_0x8cce('0x2d')],qs[_0x8cce('0x34')](_0x252af6[_0x8cce('0x30')][_0x8cce('0x34')]));_0x1a1a26[_0x8cce('0x33')]=_0x1a1a26[_0x8cce('0x33')][_0x8cce('0x35')]?_0x1a1a26[_0x8cce('0x33')]:_0x25bddc['model'];if(_0x252af6['query'][_0x8cce('0x3e')]){_0x1a1a26['include']=[{'all':!![]}];}_0x1a1a26=_[_0x8cce('0x3b')]({},_0x1a1a26,_0x252af6[_0x8cce('0x45')]);return db[_0x8cce('0x3d')]['find'](_0x1a1a26)['then'](handleEntityNotFound(_0x178dbb,null))['then'](respondWithResult(_0x178dbb,null))[_0x8cce('0x42')](handleError(_0x178dbb,null));};exports[_0x8cce('0x46')]=function(_0x42099e,_0x574402){return db[_0x8cce('0x3d')][_0x8cce('0x46')](_0x42099e['body'],{})[_0x8cce('0x24')](respondWithResult(_0x574402,0xc9))[_0x8cce('0x42')](handleError(_0x574402,null));};exports[_0x8cce('0x23')]=function(_0x4ced08,_0x324b3f){if(_0x4ced08[_0x8cce('0x47')]['id']){delete _0x4ced08[_0x8cce('0x47')]['id'];}return db['VoiceMailMessage'][_0x8cce('0x48')]({'where':{'id':_0x4ced08[_0x8cce('0x44')]['id']}})[_0x8cce('0x24')](handleEntityNotFound(_0x324b3f,null))['then'](saveUpdates(_0x4ced08[_0x8cce('0x47')],null))['then'](respondWithResult(_0x324b3f,null))['catch'](handleError(_0x324b3f,null));};exports[_0x8cce('0x25')]=function(_0x5625e6,_0x39fcd6){return db[_0x8cce('0x3d')][_0x8cce('0x48')]({'where':{'id':_0x5625e6[_0x8cce('0x44')]['id']}})[_0x8cce('0x24')](handleEntityNotFound(_0x39fcd6,null))[_0x8cce('0x24')](removeEntity(_0x39fcd6,null))[_0x8cce('0x42')](handleError(_0x39fcd6,null));};exports['download']=function(_0x4c353f,_0x31c06a,_0x5524ee){return db['VoiceMailMessage']['find']({'where':{'id':_0x4c353f[_0x8cce('0x44')]['id']},'attributes':['id',_0x8cce('0x49'),_0x8cce('0x4a')]})[_0x8cce('0x24')](handleEntityNotFound(_0x31c06a,null))[_0x8cce('0x24')](function(_0x248b4b){if(_0x248b4b){if(!_0x248b4b['recording']){throw new db['Sequelize'][(_0x8cce('0x4b'))]('VoiceMailMessage\x20not\x20found');}var _0x230f57={'Content-Type':_0x8cce('0x4c'),'Content-Disposition':_0x8cce('0x4d')};if(_0x248b4b[_0x8cce('0x4a')]){_0x230f57[_0x8cce('0x4e')]='attachment;\x20filename=\x22'+_0x248b4b[_0x8cce('0x4a')]+_0x8cce('0x4f');}_0x31c06a[_0x8cce('0x20')](_0x230f57);return _0x31c06a[_0x8cce('0x50')](new Buffer(_0x248b4b[_0x8cce('0x49')]));}})[_0x8cce('0x42')](handleError(_0x31c06a,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index a878a23..12b4910 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 _0x6f89=['./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x2ea20e,_0x28eda7){var _0x251089=function(_0x274eab){while(--_0x274eab){_0x2ea20e['push'](_0x2ea20e['shift']());}};_0x251089(++_0x28eda7);}(_0x6f89,0x95));var _0x96f8=function(_0x109b06,_0x4bb2a0){_0x109b06=_0x109b06-0x0;var _0x3ad4b3=_0x6f89[_0x109b06];return _0x3ad4b3;};'use strict';var _=require(_0x96f8('0x0'));var util=require('util');var logger=require(_0x96f8('0x1'))(_0x96f8('0x2'));var moment=require(_0x96f8('0x3'));var BPromise=require('bluebird');var rp=require(_0x96f8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96f8('0x5'));var config=require(_0x96f8('0x6'));var attributes=require(_0x96f8('0x7'));module['exports']=function(_0x1ca425,_0x41615c){return _0x1ca425[_0x96f8('0x8')](_0x96f8('0x9'),attributes,{'tableName':_0x96f8('0xa'),'paranoid':![],'indexes':[{'name':_0x96f8('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xab4b=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports'];(function(_0x2a9546,_0x1a0e9c){var _0x400007=function(_0x26d2e0){while(--_0x26d2e0){_0x2a9546['push'](_0x2a9546['shift']());}};_0x400007(++_0x1a0e9c);}(_0xab4b,0x1f2));var _0xbab4=function(_0x27e029,_0x17e305){_0x27e029=_0x27e029-0x0;var _0x29bf95=_0xab4b[_0x27e029];return _0x29bf95;};'use strict';var _=require(_0xbab4('0x0'));var util=require(_0xbab4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbab4('0x2'));var BPromise=require(_0xbab4('0x3'));var rp=require(_0xbab4('0x4'));var fs=require('fs');var path=require(_0xbab4('0x5'));var rimraf=require(_0xbab4('0x6'));var config=require('../../config/environment');var attributes=require(_0xbab4('0x7'));module[_0xbab4('0x8')]=function(_0x4ea595,_0xe8dcd6){return _0x4ea595[_0xbab4('0x9')](_0xbab4('0xa'),attributes,{'tableName':_0xbab4('0xb'),'paranoid':![],'indexes':[{'name':_0xbab4('0xc'),'fields':[_0xbab4('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 91bed2a..bd516a3 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 _0xa23d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x54fd90,_0x2adf73){var _0x51cdef=function(_0x2e5152){while(--_0x2e5152){_0x54fd90['push'](_0x54fd90['shift']());}};_0x51cdef(++_0x2adf73);}(_0xa23d,0x183));var _0xda23=function(_0x83586c,_0x5402b6){_0x83586c=_0x83586c-0x0;var _0xd52e8b=_0xa23d[_0x83586c];return _0xd52e8b;};'use strict';var _=require(_0xda23('0x0'));var util=require(_0xda23('0x1'));var moment=require(_0xda23('0x2'));var BPromise=require('bluebird');var rs=require(_0xda23('0x3'));var fs=require('fs');var Redis=require(_0xda23('0x4'));var db=require(_0xda23('0x5'))['db'];var utils=require(_0xda23('0x6'));var logger=require(_0xda23('0x7'))(_0xda23('0x8'));var config=require(_0xda23('0x9'));var jayson=require(_0xda23('0xa'));var client=jayson[_0xda23('0xb')][_0xda23('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e33a0,_0x4ba0ad,_0x4db5a1){return new BPromise(function(_0xcf85df,_0x4d4bd7){return client[_0xda23('0xd')](_0x3e33a0,_0x4db5a1)['then'](function(_0x3620dc){logger[_0xda23('0xe')](_0xda23('0xf'),_0x4ba0ad,'request\x20sent');logger['debug'](_0xda23('0x10'),_0x4ba0ad,_0xda23('0x11'),JSON[_0xda23('0x12')](_0x3620dc));if(_0x3620dc[_0xda23('0x13')]){if(_0x3620dc[_0xda23('0x13')]['code']===0x1f4){logger[_0xda23('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x4ba0ad,_0x3620dc['error']['message']);return _0x4d4bd7(_0x3620dc[_0xda23('0x13')][_0xda23('0x14')]);}logger[_0xda23('0x13')](_0xda23('0xf'),_0x4ba0ad,_0x3620dc[_0xda23('0x13')]['message']);return _0xcf85df(_0x3620dc[_0xda23('0x13')][_0xda23('0x14')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x4ba0ad,_0xda23('0x11'));_0xcf85df(_0x3620dc[_0xda23('0x15')][_0xda23('0x14')]);}})[_0xda23('0x16')](function(_0x57cf60){logger[_0xda23('0x13')](_0xda23('0xf'),_0x4ba0ad,_0x57cf60);_0x4d4bd7(_0x57cf60);});});} \ No newline at end of file +var _0xded8=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird'];(function(_0x309049,_0x458436){var _0x546715=function(_0x39198b){while(--_0x39198b){_0x309049['push'](_0x309049['shift']());}};_0x546715(++_0x458436);}(_0xded8,0xbb));var _0x8ded=function(_0x1f12e0,_0x42a248){_0x1f12e0=_0x1f12e0-0x0;var _0x4a1142=_0xded8[_0x1f12e0];return _0x4a1142;};'use strict';var _=require('lodash');var util=require(_0x8ded('0x0'));var moment=require('moment');var BPromise=require(_0x8ded('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ded('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8ded('0x3'))('rpc');var config=require(_0x8ded('0x4'));var jayson=require(_0x8ded('0x5'));var client=jayson[_0x8ded('0x6')][_0x8ded('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1cd4a3,_0x2104eb,_0x404f70){return new BPromise(function(_0x1b41b7,_0x45255f){return client[_0x8ded('0x8')](_0x1cd4a3,_0x404f70)[_0x8ded('0x9')](function(_0x4a4370){logger['info'](_0x8ded('0xa'),_0x2104eb,'request\x20sent');logger[_0x8ded('0xb')](_0x8ded('0xc'),_0x2104eb,_0x8ded('0xd'),JSON[_0x8ded('0xe')](_0x4a4370));if(_0x4a4370[_0x8ded('0xf')]){if(_0x4a4370[_0x8ded('0xf')][_0x8ded('0x10')]===0x1f4){logger[_0x8ded('0xf')](_0x8ded('0xa'),_0x2104eb,_0x4a4370[_0x8ded('0xf')][_0x8ded('0x11')]);return _0x45255f(_0x4a4370['error'][_0x8ded('0x11')]);}logger['error'](_0x8ded('0xa'),_0x2104eb,_0x4a4370['error'][_0x8ded('0x11')]);return _0x1b41b7(_0x4a4370['error'][_0x8ded('0x11')]);}else{logger[_0x8ded('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x2104eb,_0x8ded('0xd'));_0x1b41b7(_0x4a4370[_0x8ded('0x13')][_0x8ded('0x11')]);}})[_0x8ded('0x14')](function(_0x2f9764){logger[_0x8ded('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x2104eb,_0x2f9764);_0x45255f(_0x2f9764);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1a746f6..1f12bb9 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 _0xb092=['multer','util','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','delete','/:id/sounds/:id2','removeSound','exports'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_0xb092,0xb8));var _0x2b09=function(_0x2f6c8c,_0x35fcdf){_0x2f6c8c=_0x2f6c8c-0x0;var _0x5ed400=_0xb092[_0x2f6c8c];return _0x5ed400;};'use strict';var multer=require(_0x2b09('0x0'));var util=require(_0x2b09('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2b09('0x2'));var router=express[_0x2b09('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2b09('0x4'));var config=require(_0x2b09('0x5'));var controller=require(_0x2b09('0x6'));router[_0x2b09('0x7')]('/',auth[_0x2b09('0x8')](),controller[_0x2b09('0x9')]);router[_0x2b09('0x7')]('/:id',auth[_0x2b09('0x8')](),controller[_0x2b09('0xa')]);router[_0x2b09('0x7')](_0x2b09('0xb'),auth[_0x2b09('0x8')](),controller[_0x2b09('0xc')]);router[_0x2b09('0xd')]('/',auth[_0x2b09('0x8')](),controller[_0x2b09('0xe')]);router[_0x2b09('0xd')](_0x2b09('0xb'),auth[_0x2b09('0x8')](),controller[_0x2b09('0xf')]);router[_0x2b09('0x10')](_0x2b09('0x11'),auth[_0x2b09('0x8')](),controller[_0x2b09('0x12')]);router[_0x2b09('0x13')](_0x2b09('0x11'),auth[_0x2b09('0x8')](),controller['destroy']);router[_0x2b09('0x13')](_0x2b09('0x14'),auth['isAuthenticated'](),controller[_0x2b09('0x15')]);module[_0x2b09('0x16')]=router; \ No newline at end of file +var _0xf8b4=['/:id','isAuthenticated','show','getSounds','create','/:id/sounds','put','delete','destroy','removeSound','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index'];(function(_0x25f121,_0x792dff){var _0x17fcf6=function(_0x4ed817){while(--_0x4ed817){_0x25f121['push'](_0x25f121['shift']());}};_0x17fcf6(++_0x792dff);}(_0xf8b4,0x1c3));var _0x4f8b=function(_0x20c6f4,_0x21f383){_0x20c6f4=_0x20c6f4-0x0;var _0x374d4f=_0xf8b4[_0x20c6f4];return _0x374d4f;};'use strict';var multer=require('multer');var util=require(_0x4f8b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f8b('0x1'));var router=express['Router']();var fs_extra=require(_0x4f8b('0x2'));var auth=require(_0x4f8b('0x3'));var interaction=require(_0x4f8b('0x4'));var config=require(_0x4f8b('0x5'));var controller=require(_0x4f8b('0x6'));router[_0x4f8b('0x7')]('/',auth['isAuthenticated'](),controller[_0x4f8b('0x8')]);router[_0x4f8b('0x7')](_0x4f8b('0x9'),auth[_0x4f8b('0xa')](),controller[_0x4f8b('0xb')]);router[_0x4f8b('0x7')]('/:id/sounds',auth[_0x4f8b('0xa')](),controller[_0x4f8b('0xc')]);router['post']('/',auth[_0x4f8b('0xa')](),controller[_0x4f8b('0xd')]);router['post'](_0x4f8b('0xe'),auth[_0x4f8b('0xa')](),controller['addSound']);router[_0x4f8b('0xf')](_0x4f8b('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4f8b('0x10')](_0x4f8b('0x9'),auth['isAuthenticated'](),controller[_0x4f8b('0x11')]);router[_0x4f8b('0x10')]('/:id/sounds/:id2',auth[_0x4f8b('0xa')](),controller[_0x4f8b('0x12')]);module[_0x4f8b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index b00eafe..1ac8d71 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 _0x8f3d=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','alpha'];(function(_0xfb180b,_0x102f3e){var _0x3f9246=function(_0xa50478){while(--_0xa50478){_0xfb180b['push'](_0xfb180b['shift']());}};_0x3f9246(++_0x102f3e);}(_0x8f3d,0x77));var _0xd8f3=function(_0x26e84,_0x4e89d7){_0x26e84=_0x26e84-0x0;var _0x4a7f40=_0x8f3d[_0x26e84];return _0x4a7f40;};'use strict';var Sequelize=require(_0xd8f3('0x0'));module[_0xd8f3('0x1')]={'name':{'type':Sequelize[_0xd8f3('0x2')],'allowNull':![],'unique':_0xd8f3('0x3')},'mode':{'type':Sequelize[_0xd8f3('0x4')](_0xd8f3('0x5'),_0xd8f3('0x6'),_0xd8f3('0x7'),_0xd8f3('0x8'),_0xd8f3('0x9'),'mp3'),'allowNull':!![],'defaultValue':_0xd8f3('0x6')},'directory':{'type':Sequelize[_0xd8f3('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xd8f3('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xd8f3('0x2')],'allowNull':!![],'defaultValue':_0xd8f3('0xa')},'format':{'type':Sequelize[_0xd8f3('0x2')],'allowNull':!![]},'stamp':{'type':_0xd8f3('0xb')},'defaultEntry':{'type':Sequelize[_0xd8f3('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb8e4=['BOOLEAN','sequelize','exports','STRING','name','ENUM','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb8e4,0x12d));var _0x4b8e=function(_0x3aaabe,_0x535e71){_0x3aaabe=_0x3aaabe-0x0;var _0x11c947=_0xb8e4[_0x3aaabe];return _0x11c947;};'use strict';var Sequelize=require(_0x4b8e('0x0'));module[_0x4b8e('0x1')]={'name':{'type':Sequelize[_0x4b8e('0x2')],'allowNull':![],'unique':_0x4b8e('0x3')},'mode':{'type':Sequelize[_0x4b8e('0x4')]('custom',_0x4b8e('0x5'),_0x4b8e('0x6'),_0x4b8e('0x7'),'quietmp3',_0x4b8e('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x4b8e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4b8e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x4b8e('0x2')],'allowNull':!![],'defaultValue':_0x4b8e('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x4b8e('0xa')},'defaultEntry':{'type':Sequelize[_0x4b8e('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 4c25cd6..9bff7d3 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 _0xa4bc=['fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','MusicOnHolds','end','error','stack','name','send','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','merge','find','body','sequelize','mode','files','directory','join','root','server/files/moh','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','unlinkSync','rmdirSync','Sequelize','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','extname','symlinkSync','ValidationError','removeSound','Sound','id2','%s.%s','getSounds','fields','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x32939a,_0x12a1c7){var _0x19e797=function(_0x4ebc01){while(--_0x4ebc01){_0x32939a['push'](_0x32939a['shift']());}};_0x19e797(++_0x12a1c7);}(_0xa4bc,0x1ca));var _0xca4b=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xa4bc[_0x295314];return _0x584b0c;};'use strict';var emlformat=require(_0xca4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca4b('0x1'));var jsonpatch=require(_0xca4b('0x2'));var rp=require(_0xca4b('0x3'));var moment=require(_0xca4b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xca4b('0x5'));var util=require(_0xca4b('0x6'));var path=require(_0xca4b('0x7'));var sox=require(_0xca4b('0x8'));var csv=require(_0xca4b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca4b('0xa'));var _=require(_0xca4b('0xb'));var squel=require('squel');var crypto=require(_0xca4b('0xc'));var jsforce=require(_0xca4b('0xd'));var deskjs=require(_0xca4b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca4b('0xf'));var Redis=require(_0xca4b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xca4b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca4b('0x12'));var logger=require(_0xca4b('0x13'))(_0xca4b('0x14'));var utils=require(_0xca4b('0x15'));var config=require(_0xca4b('0x16'));var licenseUtil=require(_0xca4b('0x17'));var db=require(_0xca4b('0x18'))['db'];function respondWithStatusCode(_0x5e7679,_0x53be11){_0x53be11=_0x53be11||0xcc;return function(_0x35e86b){if(_0x35e86b){return _0x5e7679[_0xca4b('0x19')](_0x53be11);}return _0x5e7679['status'](_0x53be11)['end']();};}function respondWithResult(_0xbf5722,_0x12bc09){_0x12bc09=_0x12bc09||0xc8;return function(_0x1282ed){if(_0x1282ed){return _0xbf5722[_0xca4b('0x1a')](_0x12bc09)[_0xca4b('0x1b')](_0x1282ed);}};}function respondWithFilteredResult(_0x4f7222,_0x272226){return function(_0xa63bc2){if(_0xa63bc2){var _0x1747f9=typeof _0x272226[_0xca4b('0x1c')]===_0xca4b('0x1d')&&typeof _0x272226['limit']===_0xca4b('0x1d');var _0x599df7=_0xa63bc2[_0xca4b('0x1e')];var _0xb5a374=_0x1747f9?0x0:_0x272226[_0xca4b('0x1c')];var _0x3da13a=_0x1747f9?_0xa63bc2[_0xca4b('0x1e')]:_0x272226[_0xca4b('0x1c')]+_0x272226[_0xca4b('0x1f')];var _0x5a17f7;if(_0x3da13a>=_0x599df7){_0x3da13a=_0x599df7;_0x5a17f7=0xc8;}else{_0x5a17f7=0xce;}_0x4f7222[_0xca4b('0x1a')](_0x5a17f7);return _0x4f7222[_0xca4b('0x20')](_0xca4b('0x21'),_0xb5a374+'-'+_0x3da13a+'/'+_0x599df7)[_0xca4b('0x1b')](_0xa63bc2);}return null;};}function patchUpdates(_0x10d650){return function(_0x4df9b6){try{jsonpatch['apply'](_0x4df9b6,_0x10d650,!![]);}catch(_0xe3443e){return BPromise[_0xca4b('0x22')](_0xe3443e);}return _0x4df9b6[_0xca4b('0x23')]();};}function saveUpdates(_0x4063fe,_0x6a4b3f){return function(_0x190619){if(_0x190619){return _0x190619[_0xca4b('0x24')](_0x4063fe)[_0xca4b('0x25')](function(_0x2346fd){return _0x2346fd;});}return null;};}function removeEntity(_0x1ca17d,_0x50d4e7){return function(_0x5c6f14){if(_0x5c6f14){return _0x5c6f14[_0xca4b('0x26')]()[_0xca4b('0x25')](function(){var _0x5414bf=_0x5c6f14[_0xca4b('0x27')]({'plain':!![]});var _0x1386fd=_0xca4b('0x28');return db['UserProfileResource'][_0xca4b('0x26')]({'where':{'type':_0x1386fd,'resourceId':_0x5414bf['id']}})['then'](function(){return _0x5c6f14;});})[_0xca4b('0x25')](function(){_0x1ca17d[_0xca4b('0x1a')](0xcc)[_0xca4b('0x29')]();});}};}function handleEntityNotFound(_0x1607c2,_0x30f16c){return function(_0x5100b6){if(!_0x5100b6){_0x1607c2[_0xca4b('0x19')](0x194);}return _0x5100b6;};}function handleError(_0x456bac,_0x3f1679){_0x3f1679=_0x3f1679||0x1f4;return function(_0x1ca6e8){logger[_0xca4b('0x2a')](_0x1ca6e8[_0xca4b('0x2b')]);if(_0x1ca6e8['name']){delete _0x1ca6e8[_0xca4b('0x2c')];}_0x456bac[_0xca4b('0x1a')](_0x3f1679)[_0xca4b('0x2d')](_0x1ca6e8);};}exports['index']=function(_0x151c02,_0x358e51){var _0x51ae62={},_0x42692a={},_0x52f00f={'count':0x0,'rows':[]};var _0x3d9753=_[_0xca4b('0x2e')](db[_0xca4b('0x2f')]['rawAttributes'],function(_0xa793f){return{'name':_0xa793f[_0xca4b('0x30')],'type':_0xa793f[_0xca4b('0x31')][_0xca4b('0x32')]};});_0x42692a[_0xca4b('0x33')]=_['map'](_0x3d9753,_0xca4b('0x2c'));_0x42692a[_0xca4b('0x34')]=_[_0xca4b('0x35')](_0x151c02['query']);_0x42692a[_0xca4b('0x36')]=_[_0xca4b('0x37')](_0x42692a[_0xca4b('0x33')],_0x42692a[_0xca4b('0x34')]);_0x51ae62['attributes']=_[_0xca4b('0x37')](_0x42692a[_0xca4b('0x33')],qs['fields'](_0x151c02['query']['fields']));_0x51ae62['attributes']=_0x51ae62[_0xca4b('0x38')][_0xca4b('0x39')]?_0x51ae62[_0xca4b('0x38')]:_0x42692a['model'];if(!_0x151c02[_0xca4b('0x34')]['hasOwnProperty'](_0xca4b('0x3a'))){_0x51ae62[_0xca4b('0x1f')]=qs[_0xca4b('0x1f')](_0x151c02[_0xca4b('0x34')][_0xca4b('0x1f')]);_0x51ae62[_0xca4b('0x1c')]=qs[_0xca4b('0x1c')](_0x151c02[_0xca4b('0x34')]['offset']);}_0x51ae62[_0xca4b('0x3b')]=qs['sort'](_0x151c02['query'][_0xca4b('0x3c')]);delete _0x151c02[_0xca4b('0x34')][_0xca4b('0x3c')];_0x51ae62[_0xca4b('0x3d')]=qs[_0xca4b('0x36')](_['pick'](_0x151c02[_0xca4b('0x34')],_0x42692a[_0xca4b('0x36')]),_0x3d9753);if(_0x151c02[_0xca4b('0x34')][_0xca4b('0x3e')]){_0x51ae62[_0xca4b('0x3d')]=_['merge'](_0x51ae62[_0xca4b('0x3d')],{'$or':_['map'](_0x3d9753,function(_0x32a933){if(_0x32a933[_0xca4b('0x31')]!==_0xca4b('0x3f')){var _0x4c2a06={};_0x4c2a06[_0x32a933[_0xca4b('0x2c')]]={'$like':'%'+_0x151c02[_0xca4b('0x34')][_0xca4b('0x3e')]+'%'};return _0x4c2a06;}})});}_0x51ae62=_['merge']({},_0x51ae62,_0x151c02[_0xca4b('0x40')]);var _0x24bfc2={'where':_0x51ae62[_0xca4b('0x3d')]};return db[_0xca4b('0x2f')][_0xca4b('0x1e')](_0x24bfc2)['then'](function(_0x324474){_0x52f00f[_0xca4b('0x1e')]=_0x324474;if(_0x151c02[_0xca4b('0x34')][_0xca4b('0x41')]){_0x51ae62['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x51ae62);})[_0xca4b('0x25')](function(_0x3738ea){_0x52f00f[_0xca4b('0x42')]=_0x3738ea;return _0x52f00f;})[_0xca4b('0x25')](respondWithFilteredResult(_0x358e51,_0x51ae62))[_0xca4b('0x43')](handleError(_0x358e51,null));};exports[_0xca4b('0x44')]=function(_0x23804f,_0x2feb20){var _0x5148b5={'raw':![],'where':{'id':_0x23804f[_0xca4b('0x45')]['id']}},_0x45ee43={};_0x45ee43[_0xca4b('0x33')]=_['keys'](db[_0xca4b('0x2f')][_0xca4b('0x46')]);_0x45ee43[_0xca4b('0x34')]=_[_0xca4b('0x35')](_0x23804f['query']);_0x45ee43[_0xca4b('0x36')]=_[_0xca4b('0x37')](_0x45ee43[_0xca4b('0x33')],_0x45ee43[_0xca4b('0x34')]);_0x5148b5[_0xca4b('0x38')]=_[_0xca4b('0x37')](_0x45ee43[_0xca4b('0x33')],qs['fields'](_0x23804f[_0xca4b('0x34')]['fields']));_0x5148b5[_0xca4b('0x38')]=_0x5148b5[_0xca4b('0x38')]['length']?_0x5148b5[_0xca4b('0x38')]:_0x45ee43[_0xca4b('0x33')];if(_0x23804f[_0xca4b('0x34')][_0xca4b('0x41')]){_0x5148b5[_0xca4b('0x47')]=[{'all':!![]}];}_0x5148b5=_[_0xca4b('0x48')]({},_0x5148b5,_0x23804f['options']);return db[_0xca4b('0x2f')][_0xca4b('0x49')](_0x5148b5)[_0xca4b('0x25')](handleEntityNotFound(_0x2feb20,null))[_0xca4b('0x25')](respondWithResult(_0x2feb20,null))['catch'](handleError(_0x2feb20,null));};exports[_0xca4b('0x24')]=function(_0x1cacf3,_0x102056){if(_0x1cacf3[_0xca4b('0x4a')]['id']){delete _0x1cacf3[_0xca4b('0x4a')]['id'];}return db[_0xca4b('0x2f')][_0xca4b('0x49')]({'where':{'id':_0x1cacf3[_0xca4b('0x45')]['id']}})[_0xca4b('0x25')](handleEntityNotFound(_0x102056,null))[_0xca4b('0x25')](saveUpdates(_0x1cacf3['body'],null))['then'](respondWithResult(_0x102056,null))['catch'](handleError(_0x102056,null));};exports['create']=function(_0x33a0a0,_0x2d73ef,_0x28b0c3){return db[_0xca4b('0x4b')]['transaction'](function(_0x44a0dd){if(_0x33a0a0[_0xca4b('0x4a')][_0xca4b('0x4c')]===_0xca4b('0x4d')){_0x33a0a0['body'][_0xca4b('0x4e')]=path[_0xca4b('0x4f')](config[_0xca4b('0x50')],_0xca4b('0x51'),_0x33a0a0[_0xca4b('0x4a')][_0xca4b('0x2c')]);}return db['VoiceMusicOnHold'][_0xca4b('0x52')](_0x33a0a0[_0xca4b('0x4a')],{'transaction':_0x44a0dd})[_0xca4b('0x25')](function(_0xa25efa){if(_0x33a0a0['body']['mode']===_0xca4b('0x4d')){fs[_0xca4b('0x53')](_0xa25efa[_0xca4b('0x4e')],parseInt(_0xca4b('0x54'),0x8));}var _0x5c9331=_0x33a0a0[_0xca4b('0x55')]['get']({'plain':!![]});if(!_0x5c9331)throw new Error(_0xca4b('0x56'));if(_0x5c9331[_0xca4b('0x57')]===_0xca4b('0x55')){var _0x516107=_0xa25efa[_0xca4b('0x27')]({'plain':!![]});return db[_0xca4b('0x58')][_0xca4b('0x49')]({'where':{'name':_0xca4b('0x28'),'userProfileId':_0x5c9331[_0xca4b('0x59')]},'raw':!![]})['then'](function(_0x5e7da3){if(_0x5e7da3&&_0x5e7da3[_0xca4b('0x5a')]===0x0){return db[_0xca4b('0x5b')][_0xca4b('0x52')]({'name':_0x516107[_0xca4b('0x2c')],'resourceId':_0x516107['id'],'type':_0x5e7da3[_0xca4b('0x2c')],'sectionId':_0x5e7da3['id']},{})['then'](function(){return _0xa25efa;});}else{return _0xa25efa;}})[_0xca4b('0x43')](function(_0x4f4a25){logger['error'](_0xca4b('0x5c'),_0x4f4a25);});}return _0xa25efa;});})[_0xca4b('0x25')](respondWithResult(_0x2d73ef,0xc9))[_0xca4b('0x43')](handleError(_0x2d73ef,null));};exports[_0xca4b('0x26')]=function(_0x274ca8,_0xcdffd3,_0x422f70){var _0x531b7c;return db['VoiceMusicOnHold'][_0xca4b('0x49')]({'where':{'id':_0x274ca8['params']['id']}})[_0xca4b('0x25')](function(_0x2f19fb){if(_0x2f19fb){return db[_0xca4b('0x4b')][_0xca4b('0x5d')](function(_0x28ce62){return _0x2f19fb['destroy']({'transaction':_0x28ce62,'raw':!![]})['then'](function(_0xc2b0b3){if(_0xc2b0b3[_0xca4b('0x4e')]){fs[_0xca4b('0x5e')](_0xc2b0b3[_0xca4b('0x4e')])['forEach'](function(_0x5e7ff6){fs[_0xca4b('0x5f')](path['join'](_0xc2b0b3[_0xca4b('0x4e')],_0x5e7ff6));});fs[_0xca4b('0x60')](_0xc2b0b3[_0xca4b('0x4e')]);}return _0xc2b0b3;});})['catch'](function(_0x117439){throw new db[(_0xca4b('0x61'))]['ValidationError'](_0x117439[_0xca4b('0x62')]);});}})[_0xca4b('0x25')](handleEntityNotFound(_0xcdffd3,null))[_0xca4b('0x25')](removeEntity(_0xcdffd3,null))['catch'](handleError(_0xcdffd3,null));};exports[_0xca4b('0x63')]=function(_0x5f21ca,_0x43e81e,_0x6e8728){return db[_0xca4b('0x4b')]['transaction'](function(_0x15df99){var _0x380061;return db['VoiceMusicOnHold'][_0xca4b('0x49')]({'where':{'id':_0x5f21ca[_0xca4b('0x45')]['id']}})['then'](function(_0x214ff1){if(_0x214ff1){_0x380061=_0x214ff1;return _0x214ff1[_0xca4b('0x63')](_0x5f21ca[_0xca4b('0x4a')]['id'],{'transaction':_0x15df99});}})[_0xca4b('0x25')](function(_0x50835e){if(_0x50835e){return db['Sound'][_0xca4b('0x64')]({'where':{'id':_0x5f21ca['body']['id']},'attributes':['id',_0xca4b('0x2c'),_0xca4b('0x65'),_0xca4b('0x66'),_0xca4b('0x67')],'raw':!![]});}})[_0xca4b('0x25')](function(_0x17e73e){if(_0x17e73e){var _0x2d349c=path[_0xca4b('0x4f')](config['root'],_0xca4b('0x68'),util[_0xca4b('0x69')]('%s.%s',path[_0xca4b('0x6a')](_0x17e73e[_0xca4b('0x65')],path[_0xca4b('0x6b')](_0x17e73e[_0xca4b('0x65')])),_0x17e73e[_0xca4b('0x66')]));var _0x59213e=path['join'](config['root'],'server/files/moh',_0x380061[_0xca4b('0x2c')],util[_0xca4b('0x69')]('%s.%s',_0x17e73e[_0xca4b('0x2c')],_0x17e73e[_0xca4b('0x66')]));fs[_0xca4b('0x6c')](_0x2d349c,_0x59213e);return _0x17e73e;}})[_0xca4b('0x43')](function(_0x5ccd64){throw new db[(_0xca4b('0x61'))][(_0xca4b('0x6d'))](_0x5ccd64[_0xca4b('0x62')]);});})[_0xca4b('0x25')](handleEntityNotFound(_0x43e81e,null))['then'](respondWithResult(_0x43e81e,0xc9))[_0xca4b('0x43')](handleError(_0x43e81e,null));};exports[_0xca4b('0x6e')]=function(_0x2199ce,_0x3cbd3a,_0x369c01){return db['sequelize'][_0xca4b('0x5d')](function(_0x3a4e93){var _0x114679;return db['VoiceMusicOnHold'][_0xca4b('0x64')]({'where':{'id':_0x2199ce[_0xca4b('0x45')]['id']}})[_0xca4b('0x25')](handleEntityNotFound(_0x3cbd3a,null))['then'](function(_0x4c00e3){if(_0x4c00e3){_0x114679=_0x4c00e3;return _0x4c00e3['removeSound'](_0x2199ce[_0xca4b('0x45')]['id2']);}})[_0xca4b('0x25')](function(_0x19e7a5){if(_0x19e7a5){return db[_0xca4b('0x6f')][_0xca4b('0x64')]({'where':{'id':_0x2199ce[_0xca4b('0x45')][_0xca4b('0x70')]},'attributes':['id',_0xca4b('0x2c'),'save_name',_0xca4b('0x66'),_0xca4b('0x67')],'raw':!![]});}})[_0xca4b('0x25')](function(_0x3bf49c){if(_0x3bf49c){fs[_0xca4b('0x5f')](path['join'](_0x114679[_0xca4b('0x4e')],util[_0xca4b('0x69')](_0xca4b('0x71'),_0x3bf49c[_0xca4b('0x2c')],_0x3bf49c[_0xca4b('0x66')])));return _0x3bf49c;}})[_0xca4b('0x43')](function(_0x128fc2){throw new db[(_0xca4b('0x61'))]['ValidationError'](_0x128fc2[_0xca4b('0x62')]);});})['then'](handleEntityNotFound(_0x3cbd3a,null))[_0xca4b('0x25')](respondWithStatusCode(_0x3cbd3a,0xcc))['catch'](handleError(_0x3cbd3a,null));};exports[_0xca4b('0x72')]=function(_0x2aba49,_0x275f1d,_0x464b73){var _0x2f3db7={};var _0x128457={};var _0x1b20bb;var _0x48ed72;return db[_0xca4b('0x2f')][_0xca4b('0x64')]({'where':{'id':_0x2aba49[_0xca4b('0x45')]['id']}})[_0xca4b('0x25')](handleEntityNotFound(_0x275f1d,null))[_0xca4b('0x25')](function(_0x5cd6fd){if(_0x5cd6fd){_0x1b20bb=_0x5cd6fd;_0x128457['model']=_['keys'](db[_0xca4b('0x6f')][_0xca4b('0x46')]);_0x128457[_0xca4b('0x34')]=_[_0xca4b('0x35')](_0x2aba49[_0xca4b('0x34')]);_0x128457['filters']=_[_0xca4b('0x37')](_0x128457[_0xca4b('0x33')],_0x128457[_0xca4b('0x34')]);_0x2f3db7['attributes']=_[_0xca4b('0x37')](_0x128457[_0xca4b('0x33')],qs[_0xca4b('0x73')](_0x2aba49['query'][_0xca4b('0x73')]));_0x2f3db7[_0xca4b('0x38')]=_0x2f3db7['attributes'][_0xca4b('0x39')]?_0x2f3db7['attributes']:_0x128457[_0xca4b('0x33')];_0x2f3db7[_0xca4b('0x3b')]=qs[_0xca4b('0x3c')](_0x2aba49[_0xca4b('0x34')][_0xca4b('0x3c')]);_0x2f3db7['where']=qs['filters'](_[_0xca4b('0x74')](_0x2aba49['query'],_0x128457['filters']));if(_0x2aba49[_0xca4b('0x34')][_0xca4b('0x3e')]){_0x2f3db7[_0xca4b('0x3d')]=_[_0xca4b('0x48')](_0x2f3db7[_0xca4b('0x3d')],{'$or':_[_0xca4b('0x2e')](_0x2f3db7[_0xca4b('0x38')],function(_0x4a201b){var _0x33eeb8={};_0x33eeb8[_0x4a201b]={'$like':'%'+_0x2aba49[_0xca4b('0x34')][_0xca4b('0x3e')]+'%'};return _0x33eeb8;})});}_0x2f3db7=_[_0xca4b('0x48')]({},_0x2f3db7,_0x2aba49['options']);return _0x1b20bb[_0xca4b('0x72')](_0x2f3db7);}})[_0xca4b('0x25')](function(_0x3a0dd3){if(_0x3a0dd3){_0x48ed72=_0x3a0dd3[_0xca4b('0x39')];if(!_0x2aba49['query']['hasOwnProperty'](_0xca4b('0x3a'))){_0x2f3db7['limit']=qs[_0xca4b('0x1f')](_0x2aba49[_0xca4b('0x34')]['limit']);_0x2f3db7['offset']=qs[_0xca4b('0x1c')](_0x2aba49[_0xca4b('0x34')][_0xca4b('0x1c')]);}return _0x1b20bb[_0xca4b('0x72')](_0x2f3db7);}})[_0xca4b('0x25')](function(_0x4f24c5){if(_0x4f24c5){return _0x4f24c5?{'count':_0x48ed72,'rows':_0x4f24c5}:null;}})[_0xca4b('0x25')](respondWithResult(_0x275f1d,null))[_0xca4b('0x43')](handleError(_0x275f1d,null));}; \ No newline at end of file +var _0x7500=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','keys','find','body','params','create','sequelize','files','directory','root','server/files/moh','mode','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','join','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','symlinkSync','id2','getSounds','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','then','destroy','MusicOnHolds','UserProfileResource','end','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length'];(function(_0x40316d,_0x430b14){var _0x1e6947=function(_0xd17179){while(--_0xd17179){_0x40316d['push'](_0x40316d['shift']());}};_0x1e6947(++_0x430b14);}(_0x7500,0xaa));var _0x0750=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7500[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x0750('0x0'));var rimraf=require(_0x0750('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0750('0x2'));var moment=require(_0x0750('0x3'));var BPromise=require(_0x0750('0x4'));var Mustache=require(_0x0750('0x5'));var util=require(_0x0750('0x6'));var path=require(_0x0750('0x7'));var sox=require('sox');var csv=require(_0x0750('0x8'));var ejs=require(_0x0750('0x9'));var fs=require('fs');var fs_extra=require(_0x0750('0xa'));var _=require('lodash');var squel=require(_0x0750('0xb'));var crypto=require(_0x0750('0xc'));var jsforce=require(_0x0750('0xd'));var deskjs=require(_0x0750('0xe'));var toCsv=require(_0x0750('0x8'));var querystring=require(_0x0750('0xf'));var Papa=require(_0x0750('0x10'));var Redis=require(_0x0750('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0750('0x12'));var as=require(_0x0750('0x13'));var hardwareService=require(_0x0750('0x14'));var logger=require(_0x0750('0x15'))(_0x0750('0x16'));var utils=require(_0x0750('0x17'));var config=require(_0x0750('0x18'));var licenseUtil=require(_0x0750('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc9735f,_0x40de79){_0x40de79=_0x40de79||0xcc;return function(_0x240f41){if(_0x240f41){return _0xc9735f[_0x0750('0x1a')](_0x40de79);}return _0xc9735f['status'](_0x40de79)['end']();};}function respondWithResult(_0xc50a47,_0x527b9b){_0x527b9b=_0x527b9b||0xc8;return function(_0x165fde){if(_0x165fde){return _0xc50a47['status'](_0x527b9b)[_0x0750('0x1b')](_0x165fde);}};}function respondWithFilteredResult(_0x4be56b,_0x493d72){return function(_0x118685){if(_0x118685){var _0x19062d=typeof _0x493d72[_0x0750('0x1c')]==='undefined'&&typeof _0x493d72['limit']===_0x0750('0x1d');var _0x176cfa=_0x118685[_0x0750('0x1e')];var _0x426711=_0x19062d?0x0:_0x493d72[_0x0750('0x1c')];var _0x5c9d37=_0x19062d?_0x118685[_0x0750('0x1e')]:_0x493d72[_0x0750('0x1c')]+_0x493d72[_0x0750('0x1f')];var _0x59e053;if(_0x5c9d37>=_0x176cfa){_0x5c9d37=_0x176cfa;_0x59e053=0xc8;}else{_0x59e053=0xce;}_0x4be56b[_0x0750('0x20')](_0x59e053);return _0x4be56b[_0x0750('0x21')](_0x0750('0x22'),_0x426711+'-'+_0x5c9d37+'/'+_0x176cfa)['json'](_0x118685);}return null;};}function patchUpdates(_0x1f3293){return function(_0x38ee1d){try{jsonpatch[_0x0750('0x23')](_0x38ee1d,_0x1f3293,!![]);}catch(_0x5778ed){return BPromise[_0x0750('0x24')](_0x5778ed);}return _0x38ee1d[_0x0750('0x25')]();};}function saveUpdates(_0x127d33,_0x432064){return function(_0x56db66){if(_0x56db66){return _0x56db66['update'](_0x127d33)[_0x0750('0x26')](function(_0x89be64){return _0x89be64;});}return null;};}function removeEntity(_0x48b221,_0x45ec76){return function(_0x56c12c){if(_0x56c12c){return _0x56c12c[_0x0750('0x27')]()[_0x0750('0x26')](function(){var _0xe0d9b4=_0x56c12c['get']({'plain':!![]});var _0x5106eb=_0x0750('0x28');return db[_0x0750('0x29')]['destroy']({'where':{'type':_0x5106eb,'resourceId':_0xe0d9b4['id']}})[_0x0750('0x26')](function(){return _0x56c12c;});})[_0x0750('0x26')](function(){_0x48b221[_0x0750('0x20')](0xcc)[_0x0750('0x2a')]();});}};}function handleEntityNotFound(_0x59b3d6,_0x27b180){return function(_0x5ce95b){if(!_0x5ce95b){_0x59b3d6['sendStatus'](0x194);}return _0x5ce95b;};}function handleError(_0xabe957,_0x51be6e){_0x51be6e=_0x51be6e||0x1f4;return function(_0x230cca){logger[_0x0750('0x2b')](_0x230cca[_0x0750('0x2c')]);if(_0x230cca[_0x0750('0x2d')]){delete _0x230cca[_0x0750('0x2d')];}_0xabe957['status'](_0x51be6e)[_0x0750('0x2e')](_0x230cca);};}exports['index']=function(_0x3b730d,_0x56d3ac){var _0x3dae08={},_0x443fec={},_0x2fbea3={'count':0x0,'rows':[]};var _0x5ac783=_['map'](db['VoiceMusicOnHold'][_0x0750('0x2f')],function(_0x16b84f){return{'name':_0x16b84f[_0x0750('0x30')],'type':_0x16b84f['type'][_0x0750('0x31')]};});_0x443fec[_0x0750('0x32')]=_[_0x0750('0x33')](_0x5ac783,_0x0750('0x2d'));_0x443fec[_0x0750('0x34')]=_['keys'](_0x3b730d[_0x0750('0x34')]);_0x443fec[_0x0750('0x35')]=_[_0x0750('0x36')](_0x443fec['model'],_0x443fec['query']);_0x3dae08['attributes']=_[_0x0750('0x36')](_0x443fec['model'],qs[_0x0750('0x37')](_0x3b730d[_0x0750('0x34')][_0x0750('0x37')]));_0x3dae08[_0x0750('0x38')]=_0x3dae08['attributes'][_0x0750('0x39')]?_0x3dae08[_0x0750('0x38')]:_0x443fec[_0x0750('0x32')];if(!_0x3b730d['query'][_0x0750('0x3a')](_0x0750('0x3b'))){_0x3dae08['limit']=qs[_0x0750('0x1f')](_0x3b730d[_0x0750('0x34')][_0x0750('0x1f')]);_0x3dae08['offset']=qs['offset'](_0x3b730d[_0x0750('0x34')]['offset']);}_0x3dae08[_0x0750('0x3c')]=qs[_0x0750('0x3d')](_0x3b730d[_0x0750('0x34')][_0x0750('0x3d')]);delete _0x3b730d[_0x0750('0x34')]['sort'];_0x3dae08[_0x0750('0x3e')]=qs['filters'](_[_0x0750('0x3f')](_0x3b730d[_0x0750('0x34')],_0x443fec[_0x0750('0x35')]),_0x5ac783);if(_0x3b730d[_0x0750('0x34')][_0x0750('0x40')]){_0x3dae08[_0x0750('0x3e')]=_[_0x0750('0x41')](_0x3dae08[_0x0750('0x3e')],{'$or':_[_0x0750('0x33')](_0x5ac783,function(_0x291f51){if(_0x291f51[_0x0750('0x42')]!==_0x0750('0x43')){var _0x3ae0e2={};_0x3ae0e2[_0x291f51[_0x0750('0x2d')]]={'$like':'%'+_0x3b730d[_0x0750('0x34')]['filter']+'%'};return _0x3ae0e2;}})});}_0x3dae08=_[_0x0750('0x41')]({},_0x3dae08,_0x3b730d['options']);var _0x46e0ac={'where':_0x3dae08['where']};return db[_0x0750('0x44')][_0x0750('0x1e')](_0x46e0ac)[_0x0750('0x26')](function(_0x29372c){_0x2fbea3[_0x0750('0x1e')]=_0x29372c;if(_0x3b730d['query'][_0x0750('0x45')]){_0x3dae08[_0x0750('0x46')]=[{'all':!![]}];}return db[_0x0750('0x44')][_0x0750('0x47')](_0x3dae08);})['then'](function(_0xccf8ea){_0x2fbea3[_0x0750('0x48')]=_0xccf8ea;return _0x2fbea3;})[_0x0750('0x26')](respondWithFilteredResult(_0x56d3ac,_0x3dae08))[_0x0750('0x49')](handleError(_0x56d3ac,null));};exports[_0x0750('0x4a')]=function(_0x297ee8,_0x48f778){var _0x246218={'raw':![],'where':{'id':_0x297ee8['params']['id']}},_0x49e77f={};_0x49e77f['model']=_[_0x0750('0x4b')](db['VoiceMusicOnHold'][_0x0750('0x2f')]);_0x49e77f[_0x0750('0x34')]=_[_0x0750('0x4b')](_0x297ee8[_0x0750('0x34')]);_0x49e77f[_0x0750('0x35')]=_['intersection'](_0x49e77f[_0x0750('0x32')],_0x49e77f[_0x0750('0x34')]);_0x246218[_0x0750('0x38')]=_[_0x0750('0x36')](_0x49e77f[_0x0750('0x32')],qs['fields'](_0x297ee8['query']['fields']));_0x246218[_0x0750('0x38')]=_0x246218['attributes'][_0x0750('0x39')]?_0x246218[_0x0750('0x38')]:_0x49e77f[_0x0750('0x32')];if(_0x297ee8[_0x0750('0x34')][_0x0750('0x45')]){_0x246218[_0x0750('0x46')]=[{'all':!![]}];}_0x246218=_[_0x0750('0x41')]({},_0x246218,_0x297ee8['options']);return db['VoiceMusicOnHold'][_0x0750('0x4c')](_0x246218)[_0x0750('0x26')](handleEntityNotFound(_0x48f778,null))[_0x0750('0x26')](respondWithResult(_0x48f778,null))['catch'](handleError(_0x48f778,null));};exports['update']=function(_0x1ea5d2,_0x4b9a36){if(_0x1ea5d2[_0x0750('0x4d')]['id']){delete _0x1ea5d2[_0x0750('0x4d')]['id'];}return db['VoiceMusicOnHold'][_0x0750('0x4c')]({'where':{'id':_0x1ea5d2[_0x0750('0x4e')]['id']}})[_0x0750('0x26')](handleEntityNotFound(_0x4b9a36,null))[_0x0750('0x26')](saveUpdates(_0x1ea5d2[_0x0750('0x4d')],null))[_0x0750('0x26')](respondWithResult(_0x4b9a36,null))[_0x0750('0x49')](handleError(_0x4b9a36,null));};exports[_0x0750('0x4f')]=function(_0x5a9599,_0xdea021,_0x48f12c){return db[_0x0750('0x50')]['transaction'](function(_0x1bf88a){if(_0x5a9599[_0x0750('0x4d')]['mode']===_0x0750('0x51')){_0x5a9599[_0x0750('0x4d')][_0x0750('0x52')]=path['join'](config[_0x0750('0x53')],_0x0750('0x54'),_0x5a9599['body'][_0x0750('0x2d')]);}return db['VoiceMusicOnHold'][_0x0750('0x4f')](_0x5a9599[_0x0750('0x4d')],{'transaction':_0x1bf88a})['then'](function(_0x406f47){if(_0x5a9599[_0x0750('0x4d')][_0x0750('0x55')]===_0x0750('0x51')){fs[_0x0750('0x56')](_0x406f47[_0x0750('0x52')],parseInt('0777',0x8));}var _0x3bc32a=_0x5a9599['user']['get']({'plain':!![]});if(!_0x3bc32a)throw new Error(_0x0750('0x57'));if(_0x3bc32a['role']===_0x0750('0x58')){var _0x33949c=_0x406f47[_0x0750('0x59')]({'plain':!![]});return db['UserProfileSection'][_0x0750('0x4c')]({'where':{'name':_0x0750('0x28'),'userProfileId':_0x3bc32a['userProfileId']},'raw':!![]})[_0x0750('0x26')](function(_0x28d406){if(_0x28d406&&_0x28d406[_0x0750('0x5a')]===0x0){return db[_0x0750('0x29')][_0x0750('0x4f')]({'name':_0x33949c[_0x0750('0x2d')],'resourceId':_0x33949c['id'],'type':_0x28d406[_0x0750('0x2d')],'sectionId':_0x28d406['id']},{})[_0x0750('0x26')](function(){return _0x406f47;});}else{return _0x406f47;}})[_0x0750('0x49')](function(_0x551571){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x551571);});}return _0x406f47;});})['then'](respondWithResult(_0xdea021,0xc9))[_0x0750('0x49')](handleError(_0xdea021,null));};exports[_0x0750('0x27')]=function(_0x42a59f,_0x43dd81,_0x3265d6){var _0x42faa0;return db[_0x0750('0x44')]['find']({'where':{'id':_0x42a59f['params']['id']}})[_0x0750('0x26')](function(_0x57c889){if(_0x57c889){return db[_0x0750('0x50')][_0x0750('0x5b')](function(_0x3cd82b){return _0x57c889[_0x0750('0x27')]({'transaction':_0x3cd82b,'raw':!![]})['then'](function(_0x540f57){if(_0x540f57[_0x0750('0x52')]){fs[_0x0750('0x5c')](_0x540f57[_0x0750('0x52')])[_0x0750('0x5d')](function(_0x5b6bb4){fs[_0x0750('0x5e')](path['join'](_0x540f57[_0x0750('0x52')],_0x5b6bb4));});fs[_0x0750('0x5f')](_0x540f57[_0x0750('0x52')]);}return _0x540f57;});})[_0x0750('0x49')](function(_0x432d9a){throw new db[(_0x0750('0x60'))][(_0x0750('0x61'))](_0x432d9a[_0x0750('0x62')]);});}})[_0x0750('0x26')](handleEntityNotFound(_0x43dd81,null))[_0x0750('0x26')](removeEntity(_0x43dd81,null))[_0x0750('0x49')](handleError(_0x43dd81,null));};exports[_0x0750('0x63')]=function(_0x17311c,_0x1acb97,_0xb16916){return db[_0x0750('0x50')][_0x0750('0x5b')](function(_0x4beadb){var _0x3a9eee;return db['VoiceMusicOnHold'][_0x0750('0x4c')]({'where':{'id':_0x17311c[_0x0750('0x4e')]['id']}})[_0x0750('0x26')](function(_0x369e3e){if(_0x369e3e){_0x3a9eee=_0x369e3e;return _0x369e3e[_0x0750('0x63')](_0x17311c['body']['id'],{'transaction':_0x4beadb});}})[_0x0750('0x26')](function(_0x4adc0f){if(_0x4adc0f){return db[_0x0750('0x64')][_0x0750('0x65')]({'where':{'id':_0x17311c[_0x0750('0x4d')]['id']},'attributes':['id','name',_0x0750('0x66'),'converted_format',_0x0750('0x67')],'raw':!![]});}})[_0x0750('0x26')](function(_0x32a1be){if(_0x32a1be){var _0x30a2e3=path[_0x0750('0x68')](config['root'],_0x0750('0x69'),util[_0x0750('0x6a')](_0x0750('0x6b'),path[_0x0750('0x6c')](_0x32a1be[_0x0750('0x66')],path[_0x0750('0x6d')](_0x32a1be['save_name'])),_0x32a1be[_0x0750('0x6e')]));var _0x5d6fb0=path[_0x0750('0x68')](config[_0x0750('0x53')],_0x0750('0x54'),_0x3a9eee[_0x0750('0x2d')],util[_0x0750('0x6a')](_0x0750('0x6b'),_0x32a1be[_0x0750('0x2d')],_0x32a1be['converted_format']));fs[_0x0750('0x6f')](_0x30a2e3,_0x5d6fb0);return _0x32a1be;}})[_0x0750('0x49')](function(_0x3acbbb){throw new db[(_0x0750('0x60'))][(_0x0750('0x61'))](_0x3acbbb[_0x0750('0x62')]);});})['then'](handleEntityNotFound(_0x1acb97,null))['then'](respondWithResult(_0x1acb97,0xc9))[_0x0750('0x49')](handleError(_0x1acb97,null));};exports['removeSound']=function(_0x2d36a0,_0x457224,_0x5e2e87){return db[_0x0750('0x50')][_0x0750('0x5b')](function(_0x2a4b34){var _0x42f48a;return db[_0x0750('0x44')]['findOne']({'where':{'id':_0x2d36a0[_0x0750('0x4e')]['id']}})[_0x0750('0x26')](handleEntityNotFound(_0x457224,null))['then'](function(_0x280063){if(_0x280063){_0x42f48a=_0x280063;return _0x280063['removeSound'](_0x2d36a0[_0x0750('0x4e')][_0x0750('0x70')]);}})['then'](function(_0x2b224c){if(_0x2b224c){return db[_0x0750('0x64')][_0x0750('0x65')]({'where':{'id':_0x2d36a0['params'][_0x0750('0x70')]},'attributes':['id',_0x0750('0x2d'),'save_name',_0x0750('0x6e'),_0x0750('0x67')],'raw':!![]});}})[_0x0750('0x26')](function(_0x319afd){if(_0x319afd){fs[_0x0750('0x5e')](path['join'](_0x42f48a[_0x0750('0x52')],util['format'](_0x0750('0x6b'),_0x319afd[_0x0750('0x2d')],_0x319afd['converted_format'])));return _0x319afd;}})[_0x0750('0x49')](function(_0x1b7467){throw new db['Sequelize']['ValidationError'](_0x1b7467[_0x0750('0x62')]);});})[_0x0750('0x26')](handleEntityNotFound(_0x457224,null))[_0x0750('0x26')](respondWithStatusCode(_0x457224,0xcc))[_0x0750('0x49')](handleError(_0x457224,null));};exports[_0x0750('0x71')]=function(_0x538239,_0x572bf9,_0x3e8b52){var _0x5d753c={};var _0x45a638={};var _0x435326;var _0x5226a1;return db['VoiceMusicOnHold'][_0x0750('0x65')]({'where':{'id':_0x538239[_0x0750('0x4e')]['id']}})[_0x0750('0x26')](handleEntityNotFound(_0x572bf9,null))[_0x0750('0x26')](function(_0x695ea){if(_0x695ea){_0x435326=_0x695ea;_0x45a638[_0x0750('0x32')]=_[_0x0750('0x4b')](db[_0x0750('0x64')]['rawAttributes']);_0x45a638[_0x0750('0x34')]=_[_0x0750('0x4b')](_0x538239[_0x0750('0x34')]);_0x45a638[_0x0750('0x35')]=_[_0x0750('0x36')](_0x45a638[_0x0750('0x32')],_0x45a638[_0x0750('0x34')]);_0x5d753c['attributes']=_[_0x0750('0x36')](_0x45a638[_0x0750('0x32')],qs[_0x0750('0x37')](_0x538239[_0x0750('0x34')][_0x0750('0x37')]));_0x5d753c['attributes']=_0x5d753c[_0x0750('0x38')][_0x0750('0x39')]?_0x5d753c[_0x0750('0x38')]:_0x45a638['model'];_0x5d753c[_0x0750('0x3c')]=qs[_0x0750('0x3d')](_0x538239['query']['sort']);_0x5d753c[_0x0750('0x3e')]=qs['filters'](_['pick'](_0x538239[_0x0750('0x34')],_0x45a638['filters']));if(_0x538239[_0x0750('0x34')][_0x0750('0x40')]){_0x5d753c[_0x0750('0x3e')]=_[_0x0750('0x41')](_0x5d753c['where'],{'$or':_[_0x0750('0x33')](_0x5d753c['attributes'],function(_0x1deb6b){var _0x2c22ed={};_0x2c22ed[_0x1deb6b]={'$like':'%'+_0x538239[_0x0750('0x34')][_0x0750('0x40')]+'%'};return _0x2c22ed;})});}_0x5d753c=_[_0x0750('0x41')]({},_0x5d753c,_0x538239['options']);return _0x435326[_0x0750('0x71')](_0x5d753c);}})['then'](function(_0x25555a){if(_0x25555a){_0x5226a1=_0x25555a[_0x0750('0x39')];if(!_0x538239[_0x0750('0x34')]['hasOwnProperty'](_0x0750('0x3b'))){_0x5d753c[_0x0750('0x1f')]=qs[_0x0750('0x1f')](_0x538239['query'][_0x0750('0x1f')]);_0x5d753c[_0x0750('0x1c')]=qs[_0x0750('0x1c')](_0x538239[_0x0750('0x34')]['offset']);}return _0x435326[_0x0750('0x71')](_0x5d753c);}})[_0x0750('0x26')](function(_0xf89c87){if(_0xf89c87){return _0xf89c87?{'count':_0x5226a1,'rows':_0xf89c87}:null;}})[_0x0750('0x26')](respondWithResult(_0x572bf9,null))[_0x0750('0x49')](handleError(_0x572bf9,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 11adc89..fa3101e 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 _0x6141=['bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment'];(function(_0x44745f,_0x432d7e){var _0xac7f24=function(_0x53038f){while(--_0x53038f){_0x44745f['push'](_0x44745f['shift']());}};_0xac7f24(++_0x432d7e);}(_0x6141,0x95));var _0x1614=function(_0x35c4f8,_0x5101e9){_0x35c4f8=_0x35c4f8-0x0;var _0x3c9222=_0x6141[_0x35c4f8];return _0x3c9222;};'use strict';var _=require(_0x1614('0x0'));var util=require(_0x1614('0x1'));var logger=require(_0x1614('0x2'))(_0x1614('0x3'));var moment=require(_0x1614('0x4'));var BPromise=require(_0x1614('0x5'));var rp=require(_0x1614('0x6'));var fs=require('fs');var path=require(_0x1614('0x7'));var rimraf=require(_0x1614('0x8'));var config=require('../../config/environment');var attributes=require(_0x1614('0x9'));module[_0x1614('0xa')]=function(_0x20321e,_0x4c97d6){return _0x20321e[_0x1614('0xb')](_0x1614('0xc'),attributes,{'tableName':_0x1614('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e88=['path','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','moment','bluebird'];(function(_0x4ac79a,_0x46c40b){var _0x29aa11=function(_0x15aadb){while(--_0x15aadb){_0x4ac79a['push'](_0x4ac79a['shift']());}};_0x29aa11(++_0x46c40b);}(_0x4e88,0x11c));var _0x84e8=function(_0x3b2463,_0x211c4d){_0x3b2463=_0x3b2463-0x0;var _0x87ffd0=_0x4e88[_0x3b2463];return _0x87ffd0;};'use strict';var _=require('lodash');var util=require(_0x84e8('0x0'));var logger=require(_0x84e8('0x1'))('api');var moment=require(_0x84e8('0x2'));var BPromise=require(_0x84e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84e8('0x4'));var rimraf=require('rimraf');var config=require(_0x84e8('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x1f9533,_0x14c775){return _0x1f9533[_0x84e8('0x6')](_0x84e8('0x7'),attributes,{'tableName':_0x84e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 082b699..6b979a1 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1efae0,_0x5534cd){var _0x8d8a5b=function(_0x4b9872){while(--_0x4b9872){_0x1efae0['push'](_0x1efae0['shift']());}};_0x8d8a5b(++_0x5534cd);}(_0xe706,0xa3));var _0x6e70=function(_0x2c6a0d,_0x28a135){_0x2c6a0d=_0x2c6a0d-0x0;var _0x4f9bde=_0xe706[_0x2c6a0d];return _0x4f9bde;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x24fb91,_0x534736){var _0x31f217=function(_0x4e2d45){while(--_0x4e2d45){_0x24fb91['push'](_0x24fb91['shift']());}};_0x31f217(++_0x534736);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xcb91[_0x334599];return _0x4cdff2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 5364df8..b15d34a 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 _0x556b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/teams','post','create','/:id/users','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express'];(function(_0x1f7bb4,_0x2c6720){var _0x53b8bd=function(_0x1b0f1c){while(--_0x1b0f1c){_0x1f7bb4['push'](_0x1f7bb4['shift']());}};_0x53b8bd(++_0x2c6720);}(_0x556b,0x1d7));var _0xb556=function(_0xf13be0,_0x4a9c42){_0xf13be0=_0xf13be0-0x0;var _0x38d174=_0x556b[_0xf13be0];return _0x38d174;};'use strict';var multer=require(_0xb556('0x0'));var util=require(_0xb556('0x1'));var path=require(_0xb556('0x2'));var timeout=require(_0xb556('0x3'));var express=require(_0xb556('0x4'));var router=express['Router']();var fs_extra=require(_0xb556('0x5'));var auth=require(_0xb556('0x6'));var interaction=require(_0xb556('0x7'));var config=require(_0xb556('0x8'));var controller=require(_0xb556('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb556('0xa')](_0xb556('0xb'),auth[_0xb556('0xc')](),controller[_0xb556('0xd')]);router[_0xb556('0xa')](_0xb556('0xe'),auth[_0xb556('0xc')](),controller[_0xb556('0xf')]);router['get']('/:id/users',auth[_0xb556('0xc')](),controller['getAgents']);router[_0xb556('0xa')](_0xb556('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0xb556('0x11')]('/',auth[_0xb556('0xc')](),controller[_0xb556('0x12')]);router[_0xb556('0x11')](_0xb556('0x13'),auth[_0xb556('0xc')](),controller['addAgents']);router['post'](_0xb556('0x10'),auth['isAuthenticated'](),controller[_0xb556('0x14')]);router[_0xb556('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb556('0x16')]);router[_0xb556('0x17')](_0xb556('0xe'),auth[_0xb556('0xc')](),controller[_0xb556('0x18')]);router[_0xb556('0x17')](_0xb556('0x13'),auth[_0xb556('0xc')](),controller[_0xb556('0x19')]);router['delete'](_0xb556('0x10'),auth[_0xb556('0xc')](),controller[_0xb556('0x1a')]);module[_0xb556('0x1b')]=router; \ No newline at end of file +var _0xcacd=['fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe','/:id','show','/:id/teams','getTeams','post','create','/:id/users','addAgents','addTeams','put','update','delete','destroy','removeAgents','exports','multer','express','Router'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xcacd,0x1bf));var _0xdcac=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcacd[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xdcac('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdcac('0x1'));var router=express[_0xdcac('0x2')]();var fs_extra=require(_0xdcac('0x3'));var auth=require(_0xdcac('0x4'));var interaction=require(_0xdcac('0x5'));var config=require('../../config/environment');var controller=require(_0xdcac('0x6'));router[_0xdcac('0x7')]('/',auth[_0xdcac('0x8')](),controller['index']);router[_0xdcac('0x7')](_0xdcac('0x9'),auth[_0xdcac('0x8')](),controller['describe']);router[_0xdcac('0x7')](_0xdcac('0xa'),auth['isAuthenticated'](),controller[_0xdcac('0xb')]);router[_0xdcac('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xdcac('0xc'),auth[_0xdcac('0x8')](),controller[_0xdcac('0xd')]);router[_0xdcac('0xe')]('/',auth[_0xdcac('0x8')](),controller[_0xdcac('0xf')]);router[_0xdcac('0xe')](_0xdcac('0x10'),auth['isAuthenticated'](),controller[_0xdcac('0x11')]);router[_0xdcac('0xe')](_0xdcac('0xc'),auth['isAuthenticated'](),controller[_0xdcac('0x12')]);router[_0xdcac('0x13')](_0xdcac('0xa'),auth[_0xdcac('0x8')](),controller[_0xdcac('0x14')]);router[_0xdcac('0x15')](_0xdcac('0xa'),auth[_0xdcac('0x8')](),controller[_0xdcac('0x16')]);router[_0xdcac('0x15')](_0xdcac('0x10'),auth['isAuthenticated'](),controller[_0xdcac('0x17')]);router[_0xdcac('0x15')](_0xdcac('0xc'),auth[_0xdcac('0x8')](),controller['removeTeams']);module[_0xdcac('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 7bf19e0..4b8e633 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 _0x0184=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x18ff4b,_0x4ebb8c){var _0x481ee3=function(_0x4cd770){while(--_0x4cd770){_0x18ff4b['push'](_0x18ff4b['shift']());}};_0x481ee3(++_0x4ebb8c);}(_0x0184,0x14d));var _0x4018=function(_0x2f5fea,_0x3ba2c0){_0x2f5fea=_0x2f5fea-0x0;var _0x36fe14=_0x0184[_0x2f5fea];return _0x36fe14;};'use strict';var Sequelize=require(_0x4018('0x0'));module[_0x4018('0x1')]={'name':{'type':Sequelize[_0x4018('0x2')],'allowNull':![],'unique':_0x4018('0x3')},'prefix':{'type':Sequelize[_0x4018('0x4')],'get':function(_0x1df499){return _0x4018('0x5')+this[_0x4018('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x4018('0x2')]},'callerIdAll':{'type':Sequelize[_0x4018('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x4018('0x7')]}}; \ No newline at end of file +var _0x3a42=['VIRTUAL','getDataValue','INTEGER','sequelize','STRING','name'];(function(_0xb5f414,_0x47efad){var _0x50c2e3=function(_0x139dad){while(--_0x139dad){_0xb5f414['push'](_0xb5f414['shift']());}};_0x50c2e3(++_0x47efad);}(_0x3a42,0x75));var _0x23a4=function(_0x224519,_0x12da79){_0x224519=_0x224519-0x0;var _0x52dc95=_0x3a42[_0x224519];return _0x52dc95;};'use strict';var Sequelize=require(_0x23a4('0x0'));module['exports']={'name':{'type':Sequelize[_0x23a4('0x1')],'allowNull':![],'unique':_0x23a4('0x2')},'prefix':{'type':Sequelize[_0x23a4('0x3')],'get':function(_0x11332b){return'system-'+this[_0x23a4('0x4')](_0x23a4('0x2'))+'-';}},'description':{'type':Sequelize[_0x23a4('0x1')]},'callerIdAll':{'type':Sequelize[_0x23a4('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x23a4('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 205b15c..72efbcb 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 _0x84a0=['query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','online','voicePause','interface','flatMap','Agents','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','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','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84a0,0x66));var _0x084a=function(_0x53cc7b,_0x4a98ea){_0x53cc7b=_0x53cc7b-0x0;var _0x19e00f=_0x84a0[_0x53cc7b];return _0x19e00f;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];config[_0x084a('0x18')]=_[_0x084a('0x19')](config[_0x084a('0x18')],{'host':_0x084a('0x1a'),'port':0x18eb});var socket=require(_0x084a('0x1b'))(new Redis(config[_0x084a('0x18')]));require(_0x084a('0x1c'))['register'](socket);function respondWithStatusCode(_0x4277c9,_0x4b9cc5){_0x4b9cc5=_0x4b9cc5||0xcc;return function(_0x225de0){if(_0x225de0){return _0x4277c9[_0x084a('0x1d')](_0x4b9cc5);}return _0x4277c9[_0x084a('0x1e')](_0x4b9cc5)[_0x084a('0x1f')]();};}function respondWithResult(_0xd20527,_0x4cbd16){_0x4cbd16=_0x4cbd16||0xc8;return function(_0x443ebb){if(_0x443ebb){return _0xd20527['status'](_0x4cbd16)[_0x084a('0x20')](_0x443ebb);}};}function respondWithFilteredResult(_0x355b45,_0x4af43e){return function(_0xf2c333){if(_0xf2c333){var _0x32c729=typeof _0x4af43e[_0x084a('0x21')]===_0x084a('0x22')&&typeof _0x4af43e[_0x084a('0x23')]===_0x084a('0x22');var _0x447a19=_0xf2c333[_0x084a('0x24')];var _0x3f60cf=_0x32c729?0x0:_0x4af43e[_0x084a('0x21')];var _0x3c7fd6=_0x32c729?_0xf2c333[_0x084a('0x24')]:_0x4af43e[_0x084a('0x21')]+_0x4af43e[_0x084a('0x23')];var _0xf0dd98;if(_0x3c7fd6>=_0x447a19){_0x3c7fd6=_0x447a19;_0xf0dd98=0xc8;}else{_0xf0dd98=0xce;}_0x355b45['status'](_0xf0dd98);return _0x355b45[_0x084a('0x25')](_0x084a('0x26'),_0x3f60cf+'-'+_0x3c7fd6+'/'+_0x447a19)[_0x084a('0x20')](_0xf2c333);}return null;};}function patchUpdates(_0x2d62bf){return function(_0x1c3f6c){try{jsonpatch['apply'](_0x1c3f6c,_0x2d62bf,!![]);}catch(_0x755c24){return BPromise[_0x084a('0x27')](_0x755c24);}return _0x1c3f6c[_0x084a('0x28')]();};}function saveUpdates(_0x1f2c9f,_0x18b43d){return function(_0x3cdc1e){if(_0x3cdc1e){return _0x3cdc1e['update'](_0x1f2c9f)[_0x084a('0x29')](function(_0x2af138){return _0x2af138;});}return null;};}function removeEntity(_0x54233b,_0x5b1474){return function(_0x8806d5){if(_0x8806d5){return _0x8806d5[_0x084a('0x2a')]()[_0x084a('0x29')](function(){var _0x4c5658=_0x8806d5['get']({'plain':!![]});var _0x4874fe='VoicePrefixes';return db[_0x084a('0x2b')]['destroy']({'where':{'type':_0x4874fe,'resourceId':_0x4c5658['id']}})['then'](function(){return _0x8806d5;});})['then'](function(){_0x54233b[_0x084a('0x1e')](0xcc)[_0x084a('0x1f')]();});}};}function handleEntityNotFound(_0x388062,_0x2c4149){return function(_0x3be7a6){if(!_0x3be7a6){_0x388062[_0x084a('0x1d')](0x194);}return _0x3be7a6;};}function handleError(_0x378de6,_0x16053f){_0x16053f=_0x16053f||0x1f4;return function(_0x5e6ea8){logger[_0x084a('0x2c')](_0x5e6ea8[_0x084a('0x2d')]);if(_0x5e6ea8['name']){delete _0x5e6ea8[_0x084a('0x2e')];}_0x378de6[_0x084a('0x1e')](_0x16053f)[_0x084a('0x2f')](_0x5e6ea8);};}exports[_0x084a('0x30')]=function(_0x448ae9,_0x202602){var _0x3a99fe={},_0x1e971a={},_0x50cb54={'count':0x0,'rows':[]};var _0x2f59a6=_[_0x084a('0x31')](db[_0x084a('0x32')][_0x084a('0x33')],function(_0x49c9db){return{'name':_0x49c9db['fieldName'],'type':_0x49c9db[_0x084a('0x34')][_0x084a('0x35')]};});_0x1e971a[_0x084a('0x36')]=_[_0x084a('0x31')](_0x2f59a6,_0x084a('0x2e'));_0x1e971a['query']=_[_0x084a('0x37')](_0x448ae9[_0x084a('0x38')]);_0x1e971a[_0x084a('0x39')]=_['intersection'](_0x1e971a[_0x084a('0x36')],_0x1e971a[_0x084a('0x38')]);_0x3a99fe[_0x084a('0x3a')]=_['intersection'](_0x1e971a['model'],qs['fields'](_0x448ae9[_0x084a('0x38')][_0x084a('0x3b')]));_0x3a99fe[_0x084a('0x3a')]=_0x3a99fe['attributes'][_0x084a('0x3c')]?_0x3a99fe[_0x084a('0x3a')]:_0x1e971a[_0x084a('0x36')];if(!_0x448ae9[_0x084a('0x38')][_0x084a('0x3d')](_0x084a('0x3e'))){_0x3a99fe[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x448ae9[_0x084a('0x38')][_0x084a('0x23')]);_0x3a99fe[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x448ae9[_0x084a('0x38')][_0x084a('0x21')]);}_0x3a99fe[_0x084a('0x3f')]=qs['sort'](_0x448ae9[_0x084a('0x38')][_0x084a('0x40')]);_0x3a99fe[_0x084a('0x41')]=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x448ae9[_0x084a('0x38')],_0x1e971a[_0x084a('0x39')]),_0x2f59a6);if(_0x448ae9[_0x084a('0x38')][_0x084a('0x43')]){_0x3a99fe['where']=_[_0x084a('0x44')](_0x3a99fe[_0x084a('0x41')],{'$or':_[_0x084a('0x31')](_0x2f59a6,function(_0x432eb7){if(_0x432eb7[_0x084a('0x34')]!==_0x084a('0x45')){var _0x515743={};_0x515743[_0x432eb7[_0x084a('0x2e')]]={'$like':'%'+_0x448ae9[_0x084a('0x38')]['filter']+'%'};return _0x515743;}})});}_0x3a99fe=_[_0x084a('0x44')]({},_0x3a99fe,_0x448ae9[_0x084a('0x46')]);var _0x68e0d6={'where':_0x3a99fe['where']};return db[_0x084a('0x32')][_0x084a('0x24')](_0x68e0d6)['then'](function(_0x3e2b92){_0x50cb54[_0x084a('0x24')]=_0x3e2b92;if(_0x448ae9['query']['includeAll']){_0x3a99fe[_0x084a('0x47')]=[{'all':!![]}];}return db[_0x084a('0x32')][_0x084a('0x48')](_0x3a99fe);})[_0x084a('0x29')](function(_0x1e2a2d){_0x50cb54[_0x084a('0x49')]=_0x1e2a2d;return _0x50cb54;})[_0x084a('0x29')](respondWithFilteredResult(_0x202602,_0x3a99fe))[_0x084a('0x4a')](handleError(_0x202602,null));};exports[_0x084a('0x4b')]=function(_0x8b61f5,_0x30f8a4){var _0x593cc8={'raw':![],'where':{'id':_0x8b61f5[_0x084a('0x4c')]['id']}},_0x51dbda={};_0x51dbda[_0x084a('0x36')]=_[_0x084a('0x37')](db['VoicePrefix'][_0x084a('0x33')]);_0x51dbda[_0x084a('0x38')]=_[_0x084a('0x37')](_0x8b61f5[_0x084a('0x38')]);_0x51dbda[_0x084a('0x39')]=_['intersection'](_0x51dbda[_0x084a('0x36')],_0x51dbda['query']);_0x593cc8[_0x084a('0x3a')]=_[_0x084a('0x4d')](_0x51dbda[_0x084a('0x36')],qs['fields'](_0x8b61f5['query'][_0x084a('0x3b')]));_0x593cc8[_0x084a('0x3a')]=_0x593cc8['attributes'][_0x084a('0x3c')]?_0x593cc8[_0x084a('0x3a')]:_0x51dbda[_0x084a('0x36')];if(_0x8b61f5[_0x084a('0x38')]['includeAll']){_0x593cc8[_0x084a('0x47')]=[{'all':!![]}];}_0x593cc8=_[_0x084a('0x44')]({},_0x593cc8,_0x8b61f5[_0x084a('0x46')]);return db[_0x084a('0x32')]['find'](_0x593cc8)[_0x084a('0x29')](handleEntityNotFound(_0x30f8a4,null))[_0x084a('0x29')](respondWithResult(_0x30f8a4,null))[_0x084a('0x4a')](handleError(_0x30f8a4,null));};exports[_0x084a('0x2a')]=function(_0x5a718c,_0x502d9a){return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x5a718c[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x502d9a,null))[_0x084a('0x29')](removeEntity(_0x502d9a,null))[_0x084a('0x4a')](handleError(_0x502d9a,null));};exports[_0x084a('0x4f')]=function(_0x12c3a8,_0xf6ce0d){return db[_0x084a('0x32')][_0x084a('0x4f')]()[_0x084a('0x29')](respondWithResult(_0xf6ce0d,null))['catch'](handleError(_0xf6ce0d,null));};exports[_0x084a('0x50')]=function(_0x37fce4,_0x29fa4b){var _0x39edc1;return db[_0x084a('0x51')][_0x084a('0x52')](function(_0xa5362){return db['VoicePrefix'][_0x084a('0x50')](_0x37fce4[_0x084a('0x53')],{'transaction':_0xa5362})[_0x084a('0x29')](function(_0x54aa6c){_0x39edc1=_0x54aa6c['get']({'plain':!![]});return db[_0x084a('0x54')]['find']({'where':{'id':_0x39edc1[_0x084a('0x55')]},'raw':!![]})[_0x084a('0x29')](function(_0x490ad9){return createVoicePrefixExtensions(_0x39edc1,_0x490ad9,_0xa5362);});});})[_0x084a('0x29')](function(){var _0x54e9a5=_0x37fce4['user'][_0x084a('0x56')]({'plain':!![]});if(!_0x54e9a5)throw new Error(_0x084a('0x57'));if(_0x54e9a5[_0x084a('0x58')]===_0x084a('0x59')){var _0x2a8056=_0x39edc1;return db[_0x084a('0x5a')][_0x084a('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x54e9a5[_0x084a('0x5b')]},'raw':!![]})[_0x084a('0x29')](function(_0x3d7f0a){if(_0x3d7f0a&&_0x3d7f0a['autoAssociation']===0x0){return db[_0x084a('0x2b')][_0x084a('0x50')]({'name':_0x2a8056[_0x084a('0x2e')],'resourceId':_0x2a8056['id'],'type':_0x3d7f0a[_0x084a('0x2e')],'sectionId':_0x3d7f0a['id']},{})['then'](function(){return _0x39edc1;});}else{return _0x39edc1;}})[_0x084a('0x4a')](function(_0x58fe64){logger[_0x084a('0x2c')](_0x084a('0x5c'),_0x58fe64);throw _0x58fe64;});}return _0x39edc1;})[_0x084a('0x29')](respondWithResult(_0x29fa4b,null))['catch'](handleError(_0x29fa4b,null));};function Extension(_0x589e38,_0xd37003,_0x2f228c,_0x598075){this[_0x084a('0x5d')]='from-sip';this['exten']=_0x589e38;this[_0x084a('0x5e')]=_0x2f228c;this[_0x084a('0x34')]=_0x084a('0x5f');this[_0x084a('0x60')]=_0x084a('0x61');this[_0x084a('0x62')]=_0xd37003;this[_0x084a('0x63')]=_0x598075;}function createVoicePrefixExtensions(_0x5ab9d6,_0x114aa5,_0x50fe69){return new BPromise(function(_0x445563,_0x12588a){var _0x3668eb=new Extension(formatPrefixName(_0x5ab9d6['prefix']),0x1,_0x084a('0x64'),_0x084a('0x65'));_0x3668eb['VoicePrefixId']=_0x5ab9d6['id'];return db[_0x084a('0x54')]['create'](_0x3668eb,{'transaction':_0x50fe69})['then'](function(_0x1c40f3){var _0x534db3=_0x1c40f3['get']({'plain':!![]});var _0x2368f5=_[_0x084a('0x31')](addVoicePrefixExtensions(_0x5ab9d6,_0x114aa5),function(_0x495304){_0x495304['VoiceExtensionId']=_0x534db3['id'];_0x495304[_0x084a('0x66')]=_0x5ab9d6['id'];return _0x495304;});return db[_0x084a('0x54')][_0x084a('0x67')](_0x2368f5,{'transaction':_0x50fe69})[_0x084a('0x29')](function(_0x45e2d3){if(!_0x45e2d3){return _0x12588a(_0x084a('0x68'));}else{return _0x445563(_0x45e2d3);}})[_0x084a('0x4a')](function(_0x560f60){return _0x12588a(_0x560f60);});});;});};function addVoicePrefixExtensions(_0x51e090,_0x2ba35a){var _0x36ba24=[];var _0x5c77a3=formatPrefixName(_0x51e090[_0x084a('0x69')]);_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x2,_0x084a('0x6b'),_0x084a('0x6c')+_0x51e090['name']));if(_0x51e090[_0x084a('0x6d')]){_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x3,_0x084a('0x6b'),'PREFIX-CALLERIDALL='+_0x51e090['callerIdAll']));}else{_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x3,_0x084a('0x64'),_0x084a('0x6e')));}_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x4,_0x084a('0x6f'),_0x2ba35a[_0x084a('0x5d')]+','+_0x084a('0x70')+(0x8+_0x51e090['name'][_0x084a('0x3c')])+'}'+','+0x1));return _0x36ba24;}function formatPrefixName(_0x51a066){var _0x4e713c='_';for(var _0x24a553=0x0;_0x24a553<_0x51a066[_0x084a('0x3c')];_0x24a553++){if(_0x51a066[_0x084a('0x71')](_0x24a553)=='-'){_0x4e713c+=_0x51a066['charAt'](_0x24a553);}else{_0x4e713c+='['+_0x51a066[_0x084a('0x71')](_0x24a553)+']';}}_0x4e713c+='.';return _0x4e713c;}exports['update']=function(_0x1eb7be,_0x1054ea,_0x2417b4){var _0x12cef4=_0x1eb7be[_0x084a('0x53')];_0x12cef4[_0x084a('0x69')]='system-'+_0x12cef4['name']+'-';return db[_0x084a('0x51')][_0x084a('0x52')](function(_0x782285){return db[_0x084a('0x32')][_0x084a('0x72')](_0x12cef4,{'where':{'id':_0x12cef4['id']},'transaction':_0x782285})[_0x084a('0x29')](function(){return db['VoiceExtension'][_0x084a('0x2a')]({'where':{'VoicePrefixId':_0x12cef4['id']},'transaction':_0x782285})[_0x084a('0x29')](function(){return db[_0x084a('0x54')][_0x084a('0x4e')]({'where':{'id':_0x12cef4[_0x084a('0x55')]},'raw':!![]})[_0x084a('0x29')](function(_0x537578){return createVoicePrefixExtensions(_0x12cef4,_0x537578,_0x782285);});});});})['then'](function(){return db[_0x084a('0x32')][_0x084a('0x73')](_0x12cef4['id']);})[_0x084a('0x29')](respondWithResult(_0x1054ea,null))[_0x084a('0x4a')](handleError(_0x1054ea,null));};exports[_0x084a('0x74')]=function(_0xb287e7,_0x3824db,_0x26cd70){return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0xb287e7['params']['id']}})['then'](handleEntityNotFound(_0x3824db,null))['then'](function(_0x2216d4){if(_0x2216d4){return _0x2216d4[_0x084a('0x74')](_0xb287e7['body'][_0x084a('0x75')],_[_0x084a('0x76')](_0xb287e7[_0x084a('0x53')],[_0x084a('0x75'),'id'])||{})['spread'](function(_0x50cb3a){for(var _0x30ea2a=0x0;_0x30ea2a<_0xb287e7[_0x084a('0x53')][_0x084a('0x75')][_0x084a('0x3c')];_0x30ea2a+=0x1){socket[_0x084a('0x77')](_0x084a('0x78'),{'UserId':Number(_0xb287e7[_0x084a('0x53')]['ids'][_0x30ea2a]),'VoicePrefixId':Number(_0xb287e7[_0x084a('0x4c')]['id'])});}return _0x50cb3a;});}})[_0x084a('0x29')](respondWithResult(_0x3824db,null))[_0x084a('0x4a')](handleError(_0x3824db,null));};exports[_0x084a('0x79')]=function(_0x3dcafb,_0x31b89a,_0x14617e){return db['VoicePrefix'][_0x084a('0x4e')]({'where':{'id':_0x3dcafb[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x31b89a,null))[_0x084a('0x29')](function(_0x417048){if(_0x417048){return _0x417048[_0x084a('0x79')](_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')])[_0x084a('0x29')](function(){if(_[_0x084a('0x7a')](_0x3dcafb[_0x084a('0x38')]['ids'])){for(var _0x2932b6=0x0;_0x2932b6<_0x3dcafb[_0x084a('0x38')]['ids'][_0x084a('0x3c')];_0x2932b6+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')][_0x2932b6]),'VoicePrefixId':Number(_0x3dcafb['params']['id'])});}}else{socket[_0x084a('0x77')](_0x084a('0x7b'),{'UserId':Number(_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')]),'VoicePrefixId':Number(_0x3dcafb[_0x084a('0x4c')]['id'])});}});}})[_0x084a('0x29')](respondWithStatusCode(_0x31b89a,null))[_0x084a('0x4a')](handleError(_0x31b89a,null));};exports[_0x084a('0x7c')]=function(_0x1916b1,_0x8074aa,_0xe03abd){var _0x7c85e3={};var _0x19ea24={};var _0x18cf1e;var _0x3b8dda;return db['VoicePrefix'][_0x084a('0x7d')]({'where':{'id':_0x1916b1[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x8074aa,null))[_0x084a('0x29')](function(_0x1a99b2){if(_0x1a99b2){_0x18cf1e=_0x1a99b2;_0x19ea24[_0x084a('0x36')]=_[_0x084a('0x37')](db[_0x084a('0x7e')]['rawAttributes']);_0x19ea24['query']=_[_0x084a('0x37')](_0x1916b1[_0x084a('0x38')]);_0x19ea24['filters']=_['intersection'](_0x19ea24[_0x084a('0x36')],_0x19ea24['query']);_0x7c85e3[_0x084a('0x3a')]=_['intersection'](_0x19ea24[_0x084a('0x36')],qs[_0x084a('0x3b')](_0x1916b1[_0x084a('0x38')][_0x084a('0x3b')]));_0x7c85e3['attributes']=_0x7c85e3['attributes']['length']?_0x7c85e3[_0x084a('0x3a')]:_0x19ea24[_0x084a('0x36')];_0x7c85e3[_0x084a('0x3f')]=qs['sort'](_0x1916b1[_0x084a('0x38')][_0x084a('0x40')]);_0x7c85e3['where']=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x1916b1['query'],_0x19ea24[_0x084a('0x39')]));if(_0x1916b1[_0x084a('0x38')][_0x084a('0x43')]){_0x7c85e3['where']=_['merge'](_0x7c85e3[_0x084a('0x41')],{'$or':_['map'](_0x7c85e3[_0x084a('0x3a')],function(_0x67d92b){var _0x11894e={};_0x11894e[_0x67d92b]={'$like':'%'+_0x1916b1[_0x084a('0x38')][_0x084a('0x43')]+'%'};return _0x11894e;})});}_0x7c85e3=_[_0x084a('0x44')]({},_0x7c85e3,_0x1916b1['options']);return _0x18cf1e[_0x084a('0x7c')](_0x7c85e3);}})['then'](function(_0x5ce185){if(_0x5ce185){_0x3b8dda=_0x5ce185[_0x084a('0x3c')];if(!_0x1916b1[_0x084a('0x38')][_0x084a('0x3d')](_0x084a('0x3e'))){_0x7c85e3[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x1916b1['query']['limit']);_0x7c85e3[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x1916b1[_0x084a('0x38')]['offset']);}return _0x18cf1e[_0x084a('0x7c')](_0x7c85e3);}})[_0x084a('0x29')](function(_0x4eb3da){if(_0x4eb3da){return _0x4eb3da?{'count':_0x3b8dda,'rows':_0x4eb3da}:null;}})['then'](respondWithResult(_0x8074aa,null))[_0x084a('0x4a')](handleError(_0x8074aa,null));};exports['getTeams']=function(_0x5c93b2,_0x135e46,_0x2d9c66){var _0x57d90c={};var _0x42d267={};var _0x2ee08a;var _0x4f40c4;return db[_0x084a('0x32')][_0x084a('0x7d')]({'where':{'id':_0x5c93b2[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x135e46,null))[_0x084a('0x29')](function(_0x29cdb8){if(_0x29cdb8){_0x2ee08a=_0x29cdb8;_0x42d267['model']=_['keys'](db[_0x084a('0x7f')][_0x084a('0x33')]);_0x42d267['query']=_[_0x084a('0x37')](_0x5c93b2['query']);_0x42d267[_0x084a('0x39')]=_[_0x084a('0x4d')](_0x42d267[_0x084a('0x36')],_0x42d267[_0x084a('0x38')]);_0x57d90c[_0x084a('0x3a')]=_[_0x084a('0x4d')](_0x42d267['model'],qs['fields'](_0x5c93b2[_0x084a('0x38')][_0x084a('0x3b')]));_0x57d90c[_0x084a('0x3a')]=_0x57d90c[_0x084a('0x3a')][_0x084a('0x3c')]?_0x57d90c['attributes']:_0x42d267[_0x084a('0x36')];_0x57d90c[_0x084a('0x3f')]=qs[_0x084a('0x40')](_0x5c93b2[_0x084a('0x38')]['sort']);_0x57d90c[_0x084a('0x41')]=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x5c93b2[_0x084a('0x38')],_0x42d267[_0x084a('0x39')]));if(_0x5c93b2[_0x084a('0x38')][_0x084a('0x43')]){_0x57d90c[_0x084a('0x41')]=_[_0x084a('0x44')](_0x57d90c[_0x084a('0x41')],{'$or':_[_0x084a('0x31')](_0x57d90c['attributes'],function(_0x5ed84e){var _0x35df86={};_0x35df86[_0x5ed84e]={'$like':'%'+_0x5c93b2['query'][_0x084a('0x43')]+'%'};return _0x35df86;})});}_0x57d90c=_[_0x084a('0x44')]({},_0x57d90c,_0x5c93b2[_0x084a('0x46')]);return _0x2ee08a[_0x084a('0x80')](_0x57d90c);}})[_0x084a('0x29')](function(_0x5412d1){if(_0x5412d1){_0x4f40c4=_0x5412d1[_0x084a('0x3c')];if(!_0x5c93b2[_0x084a('0x38')]['hasOwnProperty'](_0x084a('0x3e'))){_0x57d90c[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x5c93b2['query'][_0x084a('0x23')]);_0x57d90c[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x5c93b2[_0x084a('0x38')][_0x084a('0x21')]);}return _0x2ee08a[_0x084a('0x80')](_0x57d90c);}})[_0x084a('0x29')](function(_0x37d422){if(_0x37d422){return _0x37d422?{'count':_0x4f40c4,'rows':_0x37d422}:null;}})['then'](respondWithResult(_0x135e46,null))[_0x084a('0x4a')](handleError(_0x135e46,null));};exports[_0x084a('0x81')]=function(_0x355c04,_0x8b89d0,_0x5db744){var _0x45a53a=_0x355c04[_0x084a('0x53')][_0x084a('0x75')];var _0xab0f66;return db[_0x084a('0x7f')][_0x084a('0x48')]({'where':{'id':_0x45a53a},'attributes':['id'],'include':[{'model':db[_0x084a('0x7e')],'as':'Agents','attributes':['id',_0x084a('0x2e'),_0x084a('0x82'),_0x084a('0x83'),_0x084a('0x84')],'raw':!![]}]})[_0x084a('0x29')](function(_0x4087bf){if(_0x4087bf){_0xab0f66=_0x4087bf;var _0x88598d=_[_0x084a('0x85')](_0x4087bf,function(_0x1106ff){var _0x3339d4=_0x1106ff[_0x084a('0x56')]({'plain':!![]});return _0x3339d4[_0x084a('0x86')];});return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x355c04[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](function(_0x378b74){return db['sequelize'][_0x084a('0x52')](function(_0x383bb8){return _0x378b74[_0x084a('0x81')](_0x45a53a,{'transaction':_0x383bb8})[_0x084a('0x29')](function(){return BPromise['each'](_0xab0f66,function(_0x133f4c){return db[_0x084a('0x87')][_0x084a('0x88')]({'TeamId':_0x133f4c['id'],'VoicePrefixId':_0x355c04[_0x084a('0x4c')]['id']},{'transaction':_0x383bb8});});})[_0x084a('0x29')](function(){return BPromise[_0x084a('0x89')](_0x88598d,function(_0x5b5c6c){return db['UserVoicePrefix'][_0x084a('0x8a')]({'where':{'UserId':_0x5b5c6c['id'],'VoicePrefixId':_0x355c04[_0x084a('0x4c')]['id']},'transaction':_0x383bb8});});})[_0x084a('0x29')](function(){_0x88598d[_0x084a('0x8b')](function(_0x3dd10e){socket[_0x084a('0x77')](_0x084a('0x78'),{'UserId':_0x3dd10e['id'],'VoicePrefixId':_0x378b74['id']});});});});});}})[_0x084a('0x29')](respondWithStatusCode(_0x8b89d0,null))['catch'](handleError(_0x8b89d0,null));};exports[_0x084a('0x8c')]=function(_0x294cca,_0x3be1f3,_0x1c6dec){return db['Team']['findAll']({'where':{'id':_0x294cca[_0x084a('0x38')][_0x084a('0x75')]},'attributes':['id'],'include':[{'model':db[_0x084a('0x7e')],'as':_0x084a('0x86'),'attributes':['id'],'raw':!![]}]})[_0x084a('0x29')](handleEntityNotFound(_0x3be1f3,null))['then'](function(_0x57ed50){var _0x5288ea=_[_0x084a('0x31')](_0x57ed50,'id');var _0x19aff1=[];var _0x5dab17=[];var _0x3983b1=squel[_0x084a('0x8d')]();_0x3983b1['field'](_0x084a('0x8e'))[_0x084a('0x8f')](_0x084a('0x90'),'tq')['join'](_0x084a('0x91'),'ut',_0x084a('0x92'))[_0x084a('0x41')](_0x084a('0x93'),_0x294cca[_0x084a('0x4c')]['id']);for(var _0x1d6333=0x0;_0x1d6333<_0x57ed50['length'];_0x1d6333+=0x1){let _0x277932=_0x57ed50[_0x1d6333];for(var _0x5f16a1=0x0;_0x5f16a1<_0x277932[_0x084a('0x86')]['length'];_0x5f16a1+=0x1){let _0x4156fa=_0x277932[_0x084a('0x86')][_0x5f16a1];var _0x43f940=_0x3983b1[_0x084a('0x94')]();_0x43f940[_0x084a('0x41')](_0x084a('0x95'),_0x4156fa['id']);_0x5dab17[_0x084a('0x6a')](db[_0x084a('0x51')][_0x084a('0x38')](_0x43f940[_0x084a('0x96')](),{'type':db[_0x084a('0x51')][_0x084a('0x97')]['SELECT']})[_0x084a('0x29')](function(_0x44f94e){if(_0x44f94e[_0x084a('0x3c')]===0x1){return _0x4156fa['id'];}else{var _0x4725a0=_[_0x084a('0x98')](_[_0x084a('0x31')](_0x44f94e,_0x084a('0x99')),function(_0x13b3f0){return _['includes'](_0x5288ea,_0x13b3f0);});if(_0x4725a0){return _0x4156fa['id'];}}}));}}return BPromise['all'](_0x5dab17)['then'](function(_0x1bcb9d){_0x19aff1=_(_0x19aff1)[_0x084a('0x9a')](_0x1bcb9d)[_0x084a('0x9b')]()[_0x084a('0x9c')]();return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x294cca[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](function(_0x1997ee){return db[_0x084a('0x51')][_0x084a('0x52')](function(_0x1f5843){return _0x1997ee[_0x084a('0x8c')](_0x294cca[_0x084a('0x38')][_0x084a('0x75')],{'transaction':_0x1f5843})[_0x084a('0x29')](function(){if(!_[_0x084a('0x9d')](_0x19aff1)){return _0x1997ee[_0x084a('0x79')](_0x19aff1,{'transaction':_0x1f5843});}})[_0x084a('0x29')](function(){_0x19aff1[_0x084a('0x8b')](function(_0x2ee2a7){socket['emit'](_0x084a('0x7b'),{'UserId':_0x2ee2a7,'VoicePrefixId':_0x1997ee['id']});});});});});});})[_0x084a('0x29')](respondWithStatusCode(_0x3be1f3,null))[_0x084a('0x4a')](handleError(_0x3be1f3,null));}; \ No newline at end of file +var _0x28f2=['filter','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','catch','show','params','keys','merge','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','${EXTEN:','charAt','update','system-','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','getAgents','findOne','User','getTeams','pick','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','field','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','union','removeTeams','userVoicePrefix:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x7c1a77,_0x1cefe3){var _0x3496d7=function(_0x306bb5){while(--_0x306bb5){_0x7c1a77['push'](_0x7c1a77['shift']());}};_0x3496d7(++_0x1cefe3);}(_0x28f2,0x193));var _0x228f=function(_0x4c3b54,_0xcb2450){_0x4c3b54=_0x4c3b54-0x0;var _0x300fdc=_0x28f2[_0x4c3b54];return _0x300fdc;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];config[_0x228f('0x1a')]=_[_0x228f('0x1b')](config[_0x228f('0x1a')],{'host':_0x228f('0x1c'),'port':0x18eb});var socket=require(_0x228f('0x1d'))(new Redis(config[_0x228f('0x1a')]));require('./voicePrefix.socket')[_0x228f('0x1e')](socket);function respondWithStatusCode(_0xfb6aff,_0x14d6fc){_0x14d6fc=_0x14d6fc||0xcc;return function(_0x31dc9e){if(_0x31dc9e){return _0xfb6aff[_0x228f('0x1f')](_0x14d6fc);}return _0xfb6aff[_0x228f('0x20')](_0x14d6fc)[_0x228f('0x21')]();};}function respondWithResult(_0x5b5abb,_0x5e4d20){_0x5e4d20=_0x5e4d20||0xc8;return function(_0x4cae4a){if(_0x4cae4a){return _0x5b5abb[_0x228f('0x20')](_0x5e4d20)[_0x228f('0x22')](_0x4cae4a);}};}function respondWithFilteredResult(_0x195e65,_0x5bf5a2){return function(_0x2d4819){if(_0x2d4819){var _0x4e1968=typeof _0x5bf5a2[_0x228f('0x23')]==='undefined'&&typeof _0x5bf5a2[_0x228f('0x24')]==='undefined';var _0x5aa203=_0x2d4819[_0x228f('0x25')];var _0x52da36=_0x4e1968?0x0:_0x5bf5a2[_0x228f('0x23')];var _0x139373=_0x4e1968?_0x2d4819[_0x228f('0x25')]:_0x5bf5a2[_0x228f('0x23')]+_0x5bf5a2[_0x228f('0x24')];var _0x313cf2;if(_0x139373>=_0x5aa203){_0x139373=_0x5aa203;_0x313cf2=0xc8;}else{_0x313cf2=0xce;}_0x195e65[_0x228f('0x20')](_0x313cf2);return _0x195e65[_0x228f('0x26')](_0x228f('0x27'),_0x52da36+'-'+_0x139373+'/'+_0x5aa203)['json'](_0x2d4819);}return null;};}function patchUpdates(_0x1e96d4){return function(_0x8f7004){try{jsonpatch[_0x228f('0x28')](_0x8f7004,_0x1e96d4,!![]);}catch(_0x3c00ad){return BPromise[_0x228f('0x29')](_0x3c00ad);}return _0x8f7004[_0x228f('0x2a')]();};}function saveUpdates(_0x33e882,_0x20c111){return function(_0x2dcf68){if(_0x2dcf68){return _0x2dcf68['update'](_0x33e882)[_0x228f('0x2b')](function(_0x306928){return _0x306928;});}return null;};}function removeEntity(_0x2b3553,_0x272c7d){return function(_0x3036d4){if(_0x3036d4){return _0x3036d4['destroy']()[_0x228f('0x2b')](function(){var _0x49efe9=_0x3036d4[_0x228f('0x2c')]({'plain':!![]});var _0x5afa52='VoicePrefixes';return db[_0x228f('0x2d')][_0x228f('0x2e')]({'where':{'type':_0x5afa52,'resourceId':_0x49efe9['id']}})[_0x228f('0x2b')](function(){return _0x3036d4;});})[_0x228f('0x2b')](function(){_0x2b3553[_0x228f('0x20')](0xcc)[_0x228f('0x21')]();});}};}function handleEntityNotFound(_0x2eaf4f,_0x2511e5){return function(_0xe67c83){if(!_0xe67c83){_0x2eaf4f[_0x228f('0x1f')](0x194);}return _0xe67c83;};}function handleError(_0x2ba4f5,_0x136a9e){_0x136a9e=_0x136a9e||0x1f4;return function(_0xc25917){logger[_0x228f('0x2f')](_0xc25917[_0x228f('0x30')]);if(_0xc25917['name']){delete _0xc25917[_0x228f('0x31')];}_0x2ba4f5[_0x228f('0x20')](_0x136a9e)[_0x228f('0x32')](_0xc25917);};}exports['index']=function(_0x32e0ce,_0x41be2d){var _0x5acf64={},_0x38375d={},_0x31abd0={'count':0x0,'rows':[]};var _0x45a67a=_[_0x228f('0x33')](db['VoicePrefix'][_0x228f('0x34')],function(_0x5201ba){return{'name':_0x5201ba[_0x228f('0x35')],'type':_0x5201ba[_0x228f('0x36')][_0x228f('0x37')]};});_0x38375d[_0x228f('0x38')]=_['map'](_0x45a67a,_0x228f('0x31'));_0x38375d[_0x228f('0x39')]=_['keys'](_0x32e0ce['query']);_0x38375d['filters']=_[_0x228f('0x3a')](_0x38375d[_0x228f('0x38')],_0x38375d[_0x228f('0x39')]);_0x5acf64[_0x228f('0x3b')]=_[_0x228f('0x3a')](_0x38375d[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x32e0ce[_0x228f('0x39')][_0x228f('0x3c')]));_0x5acf64['attributes']=_0x5acf64['attributes'][_0x228f('0x3d')]?_0x5acf64[_0x228f('0x3b')]:_0x38375d[_0x228f('0x38')];if(!_0x32e0ce[_0x228f('0x39')][_0x228f('0x3e')](_0x228f('0x3f'))){_0x5acf64[_0x228f('0x24')]=qs[_0x228f('0x24')](_0x32e0ce[_0x228f('0x39')][_0x228f('0x24')]);_0x5acf64['offset']=qs['offset'](_0x32e0ce[_0x228f('0x39')][_0x228f('0x23')]);}_0x5acf64[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x32e0ce['query'][_0x228f('0x41')]);_0x5acf64[_0x228f('0x42')]=qs['filters'](_['pick'](_0x32e0ce[_0x228f('0x39')],_0x38375d[_0x228f('0x43')]),_0x45a67a);if(_0x32e0ce['query'][_0x228f('0x44')]){_0x5acf64[_0x228f('0x42')]=_['merge'](_0x5acf64['where'],{'$or':_[_0x228f('0x33')](_0x45a67a,function(_0x5838e6){if(_0x5838e6[_0x228f('0x36')]!==_0x228f('0x45')){var _0x3da118={};_0x3da118[_0x5838e6[_0x228f('0x31')]]={'$like':'%'+_0x32e0ce[_0x228f('0x39')][_0x228f('0x44')]+'%'};return _0x3da118;}})});}_0x5acf64=_['merge']({},_0x5acf64,_0x32e0ce[_0x228f('0x46')]);var _0x5cdd16={'where':_0x5acf64[_0x228f('0x42')]};return db[_0x228f('0x47')][_0x228f('0x25')](_0x5cdd16)[_0x228f('0x2b')](function(_0x41cba5){_0x31abd0[_0x228f('0x25')]=_0x41cba5;if(_0x32e0ce[_0x228f('0x39')][_0x228f('0x48')]){_0x5acf64[_0x228f('0x49')]=[{'all':!![]}];}return db[_0x228f('0x47')][_0x228f('0x4a')](_0x5acf64);})[_0x228f('0x2b')](function(_0x19839d){_0x31abd0['rows']=_0x19839d;return _0x31abd0;})['then'](respondWithFilteredResult(_0x41be2d,_0x5acf64))[_0x228f('0x4b')](handleError(_0x41be2d,null));};exports[_0x228f('0x4c')]=function(_0x34cd3c,_0xbfa169){var _0x2f2b47={'raw':![],'where':{'id':_0x34cd3c[_0x228f('0x4d')]['id']}},_0x334fb1={};_0x334fb1[_0x228f('0x38')]=_[_0x228f('0x4e')](db[_0x228f('0x47')]['rawAttributes']);_0x334fb1[_0x228f('0x39')]=_[_0x228f('0x4e')](_0x34cd3c['query']);_0x334fb1[_0x228f('0x43')]=_['intersection'](_0x334fb1[_0x228f('0x38')],_0x334fb1['query']);_0x2f2b47[_0x228f('0x3b')]=_['intersection'](_0x334fb1[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x34cd3c[_0x228f('0x39')][_0x228f('0x3c')]));_0x2f2b47[_0x228f('0x3b')]=_0x2f2b47[_0x228f('0x3b')][_0x228f('0x3d')]?_0x2f2b47[_0x228f('0x3b')]:_0x334fb1[_0x228f('0x38')];if(_0x34cd3c[_0x228f('0x39')][_0x228f('0x48')]){_0x2f2b47[_0x228f('0x49')]=[{'all':!![]}];}_0x2f2b47=_[_0x228f('0x4f')]({},_0x2f2b47,_0x34cd3c[_0x228f('0x46')]);return db[_0x228f('0x47')][_0x228f('0x50')](_0x2f2b47)[_0x228f('0x2b')](handleEntityNotFound(_0xbfa169,null))[_0x228f('0x2b')](respondWithResult(_0xbfa169,null))[_0x228f('0x4b')](handleError(_0xbfa169,null));};exports['destroy']=function(_0x47cb21,_0xa538ce){return db[_0x228f('0x47')][_0x228f('0x50')]({'where':{'id':_0x47cb21['params']['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0xa538ce,null))[_0x228f('0x2b')](removeEntity(_0xa538ce,null))[_0x228f('0x4b')](handleError(_0xa538ce,null));};exports['describe']=function(_0x559490,_0x51db80){return db[_0x228f('0x47')][_0x228f('0x51')]()[_0x228f('0x2b')](respondWithResult(_0x51db80,null))[_0x228f('0x4b')](handleError(_0x51db80,null));};exports[_0x228f('0x52')]=function(_0x292c39,_0xafd0e4){var _0x30ff69;return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x43bbd2){return db[_0x228f('0x47')]['create'](_0x292c39[_0x228f('0x55')],{'transaction':_0x43bbd2})[_0x228f('0x2b')](function(_0x472035){_0x30ff69=_0x472035[_0x228f('0x2c')]({'plain':!![]});return db[_0x228f('0x56')][_0x228f('0x50')]({'where':{'id':_0x30ff69[_0x228f('0x57')]},'raw':!![]})[_0x228f('0x2b')](function(_0x4feefb){return createVoicePrefixExtensions(_0x30ff69,_0x4feefb,_0x43bbd2);});});})[_0x228f('0x2b')](function(){var _0x1c6114=_0x292c39[_0x228f('0x58')][_0x228f('0x2c')]({'plain':!![]});if(!_0x1c6114)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c6114[_0x228f('0x59')]===_0x228f('0x58')){var _0x4b516e=_0x30ff69;return db[_0x228f('0x5a')][_0x228f('0x50')]({'where':{'name':_0x228f('0x5b'),'userProfileId':_0x1c6114[_0x228f('0x5c')]},'raw':!![]})[_0x228f('0x2b')](function(_0x9d7417){if(_0x9d7417&&_0x9d7417[_0x228f('0x5d')]===0x0){return db[_0x228f('0x2d')][_0x228f('0x52')]({'name':_0x4b516e[_0x228f('0x31')],'resourceId':_0x4b516e['id'],'type':_0x9d7417['name'],'sectionId':_0x9d7417['id']},{})[_0x228f('0x2b')](function(){return _0x30ff69;});}else{return _0x30ff69;}})['catch'](function(_0x331b33){logger[_0x228f('0x2f')](_0x228f('0x5e'),_0x331b33);throw _0x331b33;});}return _0x30ff69;})[_0x228f('0x2b')](respondWithResult(_0xafd0e4,null))[_0x228f('0x4b')](handleError(_0xafd0e4,null));};function Extension(_0x2860dc,_0x1c8be4,_0xadb0e6,_0x56d70f){this[_0x228f('0x5f')]=_0x228f('0x60');this[_0x228f('0x61')]=_0x2860dc;this['app']=_0xadb0e6;this[_0x228f('0x36')]='system';this[_0x228f('0x62')]=_0x228f('0x63');this['priority']=_0x1c8be4;this[_0x228f('0x64')]=_0x56d70f;}function createVoicePrefixExtensions(_0x26fe6b,_0x16318d,_0xb8200d){return new BPromise(function(_0x3a0454,_0x651060){var _0x11b481=new Extension(formatPrefixName(_0x26fe6b[_0x228f('0x65')]),0x1,_0x228f('0x66'),_0x228f('0x67'));_0x11b481[_0x228f('0x68')]=_0x26fe6b['id'];return db['VoiceExtension'][_0x228f('0x52')](_0x11b481,{'transaction':_0xb8200d})[_0x228f('0x2b')](function(_0x1d4203){var _0x3be1f3=_0x1d4203[_0x228f('0x2c')]({'plain':!![]});var _0x506191=_['map'](addVoicePrefixExtensions(_0x26fe6b,_0x16318d),function(_0x14a732){_0x14a732['VoiceExtensionId']=_0x3be1f3['id'];_0x14a732[_0x228f('0x68')]=_0x26fe6b['id'];return _0x14a732;});return db['VoiceExtension'][_0x228f('0x69')](_0x506191,{'transaction':_0xb8200d})[_0x228f('0x2b')](function(_0x53a6a5){if(!_0x53a6a5){return _0x651060(_0x228f('0x6a'));}else{return _0x3a0454(_0x53a6a5);}})[_0x228f('0x4b')](function(_0x120ae1){return _0x651060(_0x120ae1);});});;});};function addVoicePrefixExtensions(_0x392270,_0x5f0b95){var _0x42dd54=[];var _0x21f860=formatPrefixName(_0x392270[_0x228f('0x65')]);_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x2,_0x228f('0x6c'),_0x228f('0x6d')+_0x392270[_0x228f('0x31')]));if(_0x392270[_0x228f('0x6e')]){_0x42dd54['push'](new Extension(_0x21f860,0x3,_0x228f('0x6c'),_0x228f('0x6f')+_0x392270[_0x228f('0x6e')]));}else{_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x3,_0x228f('0x66'),'No\x20callerid\x20available'));}_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x4,'goto',_0x5f0b95[_0x228f('0x5f')]+','+_0x228f('0x70')+(0x8+_0x392270['name'][_0x228f('0x3d')])+'}'+','+0x1));return _0x42dd54;}function formatPrefixName(_0x11a657){var _0x260e70='_';for(var _0x5eb9ed=0x0;_0x5eb9ed<_0x11a657[_0x228f('0x3d')];_0x5eb9ed++){if(_0x11a657[_0x228f('0x71')](_0x5eb9ed)=='-'){_0x260e70+=_0x11a657[_0x228f('0x71')](_0x5eb9ed);}else{_0x260e70+='['+_0x11a657[_0x228f('0x71')](_0x5eb9ed)+']';}}_0x260e70+='.';return _0x260e70;}exports[_0x228f('0x72')]=function(_0x5990e9,_0x221b3,_0x187f84){var _0x5718e1=_0x5990e9['body'];_0x5718e1[_0x228f('0x65')]=_0x228f('0x73')+_0x5718e1[_0x228f('0x31')]+'-';return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x1162ca){return db[_0x228f('0x47')][_0x228f('0x72')](_0x5718e1,{'where':{'id':_0x5718e1['id']},'transaction':_0x1162ca})['then'](function(){return db[_0x228f('0x56')]['destroy']({'where':{'VoicePrefixId':_0x5718e1['id']},'transaction':_0x1162ca})[_0x228f('0x2b')](function(){return db[_0x228f('0x56')][_0x228f('0x50')]({'where':{'id':_0x5718e1[_0x228f('0x57')]},'raw':!![]})[_0x228f('0x2b')](function(_0x32a32e){return createVoicePrefixExtensions(_0x5718e1,_0x32a32e,_0x1162ca);});});});})[_0x228f('0x2b')](function(){return db['VoicePrefix']['findById'](_0x5718e1['id']);})[_0x228f('0x2b')](respondWithResult(_0x221b3,null))[_0x228f('0x4b')](handleError(_0x221b3,null));};exports[_0x228f('0x74')]=function(_0x16776b,_0x6854c1,_0x29446b){return db['VoicePrefix'][_0x228f('0x50')]({'where':{'id':_0x16776b[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x6854c1,null))[_0x228f('0x2b')](function(_0x3fa413){if(_0x3fa413){return _0x3fa413[_0x228f('0x74')](_0x16776b[_0x228f('0x55')][_0x228f('0x75')],_[_0x228f('0x76')](_0x16776b['body'],[_0x228f('0x75'),'id'])||{})[_0x228f('0x77')](function(_0x47fe2b){for(var _0x1abf6d=0x0;_0x1abf6d<_0x16776b[_0x228f('0x55')]['ids']['length'];_0x1abf6d+=0x1){socket['emit'](_0x228f('0x78'),{'UserId':Number(_0x16776b['body'][_0x228f('0x75')][_0x1abf6d]),'VoicePrefixId':Number(_0x16776b['params']['id'])});}return _0x47fe2b;});}})[_0x228f('0x2b')](respondWithResult(_0x6854c1,null))[_0x228f('0x4b')](handleError(_0x6854c1,null));};exports['removeAgents']=function(_0x27ffdd,_0x16430e,_0x2dadc9){return db[_0x228f('0x47')][_0x228f('0x50')]({'where':{'id':_0x27ffdd['params']['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x16430e,null))[_0x228f('0x2b')](function(_0xa33189){if(_0xa33189){return _0xa33189[_0x228f('0x79')](_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')])[_0x228f('0x2b')](function(){if(_[_0x228f('0x7a')](_0x27ffdd[_0x228f('0x39')]['ids'])){for(var _0x74fe35=0x0;_0x74fe35<_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')]['length'];_0x74fe35+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x27ffdd[_0x228f('0x39')]['ids'][_0x74fe35]),'VoicePrefixId':Number(_0x27ffdd[_0x228f('0x4d')]['id'])});}}else{socket[_0x228f('0x7b')]('userVoicePrefix:remove',{'UserId':Number(_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')]),'VoicePrefixId':Number(_0x27ffdd['params']['id'])});}});}})[_0x228f('0x2b')](respondWithStatusCode(_0x16430e,null))[_0x228f('0x4b')](handleError(_0x16430e,null));};exports[_0x228f('0x7c')]=function(_0x32ea8d,_0x5b29d3,_0x268e71){var _0x3418b2={};var _0x2240de={};var _0x20f029;var _0x37ab8a;return db[_0x228f('0x47')][_0x228f('0x7d')]({'where':{'id':_0x32ea8d[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x5b29d3,null))['then'](function(_0x257aa6){if(_0x257aa6){_0x20f029=_0x257aa6;_0x2240de[_0x228f('0x38')]=_[_0x228f('0x4e')](db[_0x228f('0x7e')][_0x228f('0x34')]);_0x2240de['query']=_['keys'](_0x32ea8d[_0x228f('0x39')]);_0x2240de['filters']=_[_0x228f('0x3a')](_0x2240de['model'],_0x2240de[_0x228f('0x39')]);_0x3418b2['attributes']=_[_0x228f('0x3a')](_0x2240de[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x32ea8d[_0x228f('0x39')][_0x228f('0x3c')]));_0x3418b2[_0x228f('0x3b')]=_0x3418b2[_0x228f('0x3b')][_0x228f('0x3d')]?_0x3418b2[_0x228f('0x3b')]:_0x2240de[_0x228f('0x38')];_0x3418b2[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x32ea8d[_0x228f('0x39')][_0x228f('0x41')]);_0x3418b2[_0x228f('0x42')]=qs[_0x228f('0x43')](_['pick'](_0x32ea8d[_0x228f('0x39')],_0x2240de[_0x228f('0x43')]));if(_0x32ea8d[_0x228f('0x39')]['filter']){_0x3418b2[_0x228f('0x42')]=_['merge'](_0x3418b2['where'],{'$or':_['map'](_0x3418b2[_0x228f('0x3b')],function(_0x50ed6a){var _0x22448b={};_0x22448b[_0x50ed6a]={'$like':'%'+_0x32ea8d[_0x228f('0x39')]['filter']+'%'};return _0x22448b;})});}_0x3418b2=_[_0x228f('0x4f')]({},_0x3418b2,_0x32ea8d[_0x228f('0x46')]);return _0x20f029['getAgents'](_0x3418b2);}})[_0x228f('0x2b')](function(_0x620f5a){if(_0x620f5a){_0x37ab8a=_0x620f5a['length'];if(!_0x32ea8d['query'][_0x228f('0x3e')](_0x228f('0x3f'))){_0x3418b2[_0x228f('0x24')]=qs[_0x228f('0x24')](_0x32ea8d['query'][_0x228f('0x24')]);_0x3418b2[_0x228f('0x23')]=qs['offset'](_0x32ea8d[_0x228f('0x39')][_0x228f('0x23')]);}return _0x20f029[_0x228f('0x7c')](_0x3418b2);}})[_0x228f('0x2b')](function(_0x39aa20){if(_0x39aa20){return _0x39aa20?{'count':_0x37ab8a,'rows':_0x39aa20}:null;}})[_0x228f('0x2b')](respondWithResult(_0x5b29d3,null))[_0x228f('0x4b')](handleError(_0x5b29d3,null));};exports[_0x228f('0x7f')]=function(_0x5a1a8c,_0x5a7f73,_0x597271){var _0x548882={};var _0x47eba6={};var _0x5ac69a;var _0x182858;return db[_0x228f('0x47')][_0x228f('0x7d')]({'where':{'id':_0x5a1a8c[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x5a7f73,null))[_0x228f('0x2b')](function(_0x35aa2c){if(_0x35aa2c){_0x5ac69a=_0x35aa2c;_0x47eba6['model']=_[_0x228f('0x4e')](db['Team']['rawAttributes']);_0x47eba6['query']=_['keys'](_0x5a1a8c[_0x228f('0x39')]);_0x47eba6['filters']=_[_0x228f('0x3a')](_0x47eba6[_0x228f('0x38')],_0x47eba6[_0x228f('0x39')]);_0x548882[_0x228f('0x3b')]=_['intersection'](_0x47eba6[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x5a1a8c[_0x228f('0x39')][_0x228f('0x3c')]));_0x548882[_0x228f('0x3b')]=_0x548882[_0x228f('0x3b')][_0x228f('0x3d')]?_0x548882[_0x228f('0x3b')]:_0x47eba6[_0x228f('0x38')];_0x548882[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x5a1a8c['query']['sort']);_0x548882['where']=qs[_0x228f('0x43')](_[_0x228f('0x80')](_0x5a1a8c[_0x228f('0x39')],_0x47eba6[_0x228f('0x43')]));if(_0x5a1a8c[_0x228f('0x39')][_0x228f('0x44')]){_0x548882[_0x228f('0x42')]=_[_0x228f('0x4f')](_0x548882['where'],{'$or':_[_0x228f('0x33')](_0x548882[_0x228f('0x3b')],function(_0x433c1f){var _0xea049c={};_0xea049c[_0x433c1f]={'$like':'%'+_0x5a1a8c[_0x228f('0x39')][_0x228f('0x44')]+'%'};return _0xea049c;})});}_0x548882=_[_0x228f('0x4f')]({},_0x548882,_0x5a1a8c[_0x228f('0x46')]);return _0x5ac69a[_0x228f('0x7f')](_0x548882);}})['then'](function(_0x2db468){if(_0x2db468){_0x182858=_0x2db468[_0x228f('0x3d')];if(!_0x5a1a8c[_0x228f('0x39')]['hasOwnProperty']('nolimit')){_0x548882[_0x228f('0x24')]=qs['limit'](_0x5a1a8c[_0x228f('0x39')][_0x228f('0x24')]);_0x548882[_0x228f('0x23')]=qs[_0x228f('0x23')](_0x5a1a8c['query'][_0x228f('0x23')]);}return _0x5ac69a[_0x228f('0x7f')](_0x548882);}})[_0x228f('0x2b')](function(_0x237b92){if(_0x237b92){return _0x237b92?{'count':_0x182858,'rows':_0x237b92}:null;}})['then'](respondWithResult(_0x5a7f73,null))['catch'](handleError(_0x5a7f73,null));};exports[_0x228f('0x81')]=function(_0x578762,_0x19e488,_0x48c6ee){var _0x59b34c=_0x578762['body'][_0x228f('0x75')];var _0x4865e5;return db[_0x228f('0x82')][_0x228f('0x4a')]({'where':{'id':_0x59b34c},'attributes':['id'],'include':[{'model':db[_0x228f('0x7e')],'as':_0x228f('0x83'),'attributes':['id',_0x228f('0x31'),_0x228f('0x84'),_0x228f('0x85'),_0x228f('0x86')],'raw':!![]}]})[_0x228f('0x2b')](function(_0x1e8511){if(_0x1e8511){_0x4865e5=_0x1e8511;var _0x35363e=_[_0x228f('0x87')](_0x1e8511,function(_0x2f8379){var _0x38fca3=_0x2f8379[_0x228f('0x2c')]({'plain':!![]});return _0x38fca3[_0x228f('0x83')];});return db[_0x228f('0x47')]['find']({'where':{'id':_0x578762[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](function(_0x553895){return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x3a2c9c){return _0x553895[_0x228f('0x81')](_0x59b34c,{'transaction':_0x3a2c9c})['then'](function(){return BPromise[_0x228f('0x88')](_0x4865e5,function(_0x38da32){return db[_0x228f('0x89')][_0x228f('0x8a')]({'TeamId':_0x38da32['id'],'VoicePrefixId':_0x578762[_0x228f('0x4d')]['id']},{'transaction':_0x3a2c9c});});})['then'](function(){return BPromise['each'](_0x35363e,function(_0x25f726){return db[_0x228f('0x8b')]['findOrCreate']({'where':{'UserId':_0x25f726['id'],'VoicePrefixId':_0x578762[_0x228f('0x4d')]['id']},'transaction':_0x3a2c9c});});})[_0x228f('0x2b')](function(){_0x35363e[_0x228f('0x8c')](function(_0x525439){socket[_0x228f('0x7b')](_0x228f('0x78'),{'UserId':_0x525439['id'],'VoicePrefixId':_0x553895['id']});});});});});}})['then'](respondWithStatusCode(_0x19e488,null))[_0x228f('0x4b')](handleError(_0x19e488,null));};exports['removeTeams']=function(_0x29201c,_0x207d64,_0xff507b){return db[_0x228f('0x82')]['findAll']({'where':{'id':_0x29201c['query'][_0x228f('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x228f('0x83'),'attributes':['id'],'raw':!![]}]})[_0x228f('0x2b')](handleEntityNotFound(_0x207d64,null))[_0x228f('0x2b')](function(_0x16ebcf){var _0x21efb1=_['map'](_0x16ebcf,'id');var _0x3526b0=[];var _0x45da1f=[];var _0x69a9a5=squel['select']();_0x69a9a5[_0x228f('0x8d')]('tq.TeamId')[_0x228f('0x8e')](_0x228f('0x8f'),'tq')['join'](_0x228f('0x90'),'ut',_0x228f('0x91'))[_0x228f('0x42')](_0x228f('0x92'),_0x29201c['params']['id']);for(var _0x2b6a34=0x0;_0x2b6a34<_0x16ebcf[_0x228f('0x3d')];_0x2b6a34+=0x1){let _0x13ba88=_0x16ebcf[_0x2b6a34];for(var _0x106451=0x0;_0x106451<_0x13ba88[_0x228f('0x83')][_0x228f('0x3d')];_0x106451+=0x1){let _0x57b1d6=_0x13ba88[_0x228f('0x83')][_0x106451];var _0x22b0ff=_0x69a9a5[_0x228f('0x93')]();_0x22b0ff[_0x228f('0x42')](_0x228f('0x94'),_0x57b1d6['id']);_0x45da1f[_0x228f('0x6b')](db[_0x228f('0x53')]['query'](_0x22b0ff['toString'](),{'type':db[_0x228f('0x53')][_0x228f('0x95')][_0x228f('0x96')]})['then'](function(_0x348662){if(_0x348662[_0x228f('0x3d')]===0x1){return _0x57b1d6['id'];}else{var _0x3c83e1=_[_0x228f('0x97')](_[_0x228f('0x33')](_0x348662,_0x228f('0x98')),function(_0x437b8b){return _[_0x228f('0x99')](_0x21efb1,_0x437b8b);});if(_0x3c83e1){return _0x57b1d6['id'];}}}));}}return BPromise['all'](_0x45da1f)[_0x228f('0x2b')](function(_0x56d3ee){_0x3526b0=_(_0x3526b0)[_0x228f('0x9a')](_0x56d3ee)['compact']()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x29201c['params']['id']}})[_0x228f('0x2b')](function(_0x24a8ae){return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x298c83){return _0x24a8ae[_0x228f('0x9b')](_0x29201c[_0x228f('0x39')][_0x228f('0x75')],{'transaction':_0x298c83})[_0x228f('0x2b')](function(){if(!_['isEmpty'](_0x3526b0)){return _0x24a8ae[_0x228f('0x79')](_0x3526b0,{'transaction':_0x298c83});}})['then'](function(){_0x3526b0[_0x228f('0x8c')](function(_0x5830f7){socket['emit'](_0x228f('0x9c'),{'UserId':_0x5830f7,'VoicePrefixId':_0x24a8ae['id']});});});});});});})[_0x228f('0x2b')](respondWithStatusCode(_0x207d64,null))[_0x228f('0x4b')](handleError(_0x207d64,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7826ec5..503cc93 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 _0xcfa8=['update','emit','hook','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x2195f7,_0x97e54c){var _0x5ba13e=function(_0x46c5a5){while(--_0x46c5a5){_0x2195f7['push'](_0x2195f7['shift']());}};_0x5ba13e(++_0x97e54c);}(_0xcfa8,0x16b));var _0x8cfa=function(_0x5289b5,_0xc3a80b){_0x5289b5=_0x5289b5-0x0;var _0x619175=_0xcfa8[_0x5289b5];return _0x619175;};'use strict';var EventEmitter=require(_0x8cfa('0x0'));var VoicePrefix=require(_0x8cfa('0x1'))['db'][_0x8cfa('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x8cfa('0x3')](0x0);var events={'afterCreate':_0x8cfa('0x4'),'afterUpdate':_0x8cfa('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5450f8){return function(_0x315473,_0x33e1ae,_0x2c2afa){VoicePrefixEvents[_0x8cfa('0x6')](_0x5450f8+':'+_0x315473['id'],_0x315473);VoicePrefixEvents[_0x8cfa('0x6')](_0x5450f8,_0x315473);_0x2c2afa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x8cfa('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x346d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove'];(function(_0x5df61d,_0x44ad6d){var _0x4f0aba=function(_0x24c244){while(--_0x24c244){_0x5df61d['push'](_0x5df61d['shift']());}};_0x4f0aba(++_0x44ad6d);}(_0x346d,0x19e));var _0xd346=function(_0x386b08,_0x5d49da){_0x386b08=_0x386b08-0x0;var _0x4b38ef=_0x346d[_0x386b08];return _0x4b38ef;};'use strict';var EventEmitter=require(_0xd346('0x0'));var VoicePrefix=require(_0xd346('0x1'))['db'][_0xd346('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd346('0x3')](0x0);var events={'afterCreate':_0xd346('0x4'),'afterUpdate':'update','afterDestroy':_0xd346('0x5')};function emitEvent(_0xdc3630){return function(_0x14d67f,_0x324251,_0x350909){VoicePrefixEvents[_0xd346('0x6')](_0xdc3630+':'+_0x14d67f['id'],_0x14d67f);VoicePrefixEvents[_0xd346('0x6')](_0xdc3630,_0x14d67f);_0x350909(null);};}for(var e in events){if(events[_0xd346('0x7')](e)){var event=events[e];VoicePrefix[_0xd346('0x8')](e,emitEvent(event));}}module[_0xd346('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 98a0415..e29b146 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 _0xe2e6=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0xe2e6,0x1c3));var _0x6e2e=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0xe2e6[_0x254b22];return _0x1279db;};'use strict';var _=require(_0x6e2e('0x0'));var util=require('util');var logger=require(_0x6e2e('0x1'))('api');var moment=require(_0x6e2e('0x2'));var BPromise=require(_0x6e2e('0x3'));var rp=require(_0x6e2e('0x4'));var fs=require('fs');var path=require(_0x6e2e('0x5'));var rimraf=require('rimraf');var config=require(_0x6e2e('0x6'));var attributes=require(_0x6e2e('0x7'));module[_0x6e2e('0x8')]=function(_0x3f727c,_0x447a1b){return _0x3f727c['define'](_0x6e2e('0x9'),attributes,{'tableName':_0x6e2e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fa3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x2b11de,_0x26af66){var _0x4050e4=function(_0x212823){while(--_0x212823){_0x2b11de['push'](_0x2b11de['shift']());}};_0x4050e4(++_0x26af66);}(_0x0fa3,0xa5));var _0x30fa=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x0fa3[_0x338f73];return _0x163fdf;};'use strict';var _=require(_0x30fa('0x0'));var util=require(_0x30fa('0x1'));var logger=require(_0x30fa('0x2'))(_0x30fa('0x3'));var moment=require(_0x30fa('0x4'));var BPromise=require(_0x30fa('0x5'));var rp=require(_0x30fa('0x6'));var fs=require('fs');var path=require(_0x30fa('0x7'));var rimraf=require(_0x30fa('0x8'));var config=require(_0x30fa('0x9'));var attributes=require(_0x30fa('0xa'));module[_0x30fa('0xb')]=function(_0xe34e39,_0x2f02aa){return _0xe34e39[_0x30fa('0xc')](_0x30fa('0xd'),attributes,{'tableName':_0x30fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index fb6593f..05bd82c 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 _0x5bd7=['bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x11e03f,_0x20b967){var _0x5666fe=function(_0x19ce63){while(--_0x19ce63){_0x11e03f['push'](_0x11e03f['shift']());}};_0x5666fe(++_0x20b967);}(_0x5bd7,0x12a));var _0x75bd=function(_0x46bdf7,_0x5e773f){_0x46bdf7=_0x46bdf7-0x0;var _0x1d2c71=_0x5bd7[_0x46bdf7];return _0x1d2c71;};'use strict';var _=require('lodash');var util=require(_0x75bd('0x0'));var moment=require(_0x75bd('0x1'));var BPromise=require(_0x75bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x75bd('0x4'));var logger=require(_0x75bd('0x5'))('rpc');var config=require(_0x75bd('0x6'));var jayson=require(_0x75bd('0x7'));var client=jayson[_0x75bd('0x8')]['http']({'port':0x232a});config[_0x75bd('0x9')]=_[_0x75bd('0xa')](config[_0x75bd('0x9')],{'host':_0x75bd('0xb'),'port':0x18eb});var socket=require(_0x75bd('0xc'))(new Redis(config[_0x75bd('0x9')]));require(_0x75bd('0xd'))['register'](socket);function respondWithRpcPromise(_0x6533d2,_0x5521c6,_0x4803ea){return new BPromise(function(_0x7ffa78,_0x5112f0){return client[_0x75bd('0xe')](_0x6533d2,_0x4803ea)['then'](function(_0xe552eb){logger[_0x75bd('0xf')](_0x75bd('0x10'),_0x5521c6,_0x75bd('0x11'));logger[_0x75bd('0x12')](_0x75bd('0x13'),_0x5521c6,'request\x20sent',JSON['stringify'](_0xe552eb));if(_0xe552eb['error']){if(_0xe552eb[_0x75bd('0x14')][_0x75bd('0x15')]===0x1f4){logger[_0x75bd('0x14')](_0x75bd('0x10'),_0x5521c6,_0xe552eb[_0x75bd('0x14')][_0x75bd('0x16')]);return _0x5112f0(_0xe552eb[_0x75bd('0x14')][_0x75bd('0x16')]);}logger[_0x75bd('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x5521c6,_0xe552eb['error']['message']);return _0x7ffa78(_0xe552eb['error'][_0x75bd('0x16')]);}else{logger[_0x75bd('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x5521c6,'request\x20sent');_0x7ffa78(_0xe552eb[_0x75bd('0x17')][_0x75bd('0x16')]);}})[_0x75bd('0x18')](function(_0x4a18fd){logger['error'](_0x75bd('0x10'),_0x5521c6,_0x4a18fd);_0x5112f0(_0x4a18fd);});});} \ No newline at end of file +var _0x6931=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x6931,0x1a9));var _0x1693=function(_0x510ba4,_0x3115e3){_0x510ba4=_0x510ba4-0x0;var _0x46f37c=_0x6931[_0x510ba4];return _0x46f37c;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var moment=require(_0x1693('0x2'));var BPromise=require(_0x1693('0x3'));var rs=require(_0x1693('0x4'));var fs=require('fs');var Redis=require(_0x1693('0x5'));var db=require(_0x1693('0x6'))['db'];var utils=require(_0x1693('0x7'));var logger=require('../../config/logger')(_0x1693('0x8'));var config=require(_0x1693('0x9'));var jayson=require(_0x1693('0xa'));var client=jayson[_0x1693('0xb')][_0x1693('0xc')]({'port':0x232a});config['redis']=_[_0x1693('0xd')](config[_0x1693('0xe')],{'host':_0x1693('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1693('0xe')]));require(_0x1693('0x10'))[_0x1693('0x11')](socket);function respondWithRpcPromise(_0x141ea9,_0x2af3d1,_0x181184){return new BPromise(function(_0x26ba4b,_0x3807dd){return client[_0x1693('0x12')](_0x141ea9,_0x181184)[_0x1693('0x13')](function(_0x1ba755){logger['info'](_0x1693('0x14'),_0x2af3d1,_0x1693('0x15'));logger[_0x1693('0x16')](_0x1693('0x17'),_0x2af3d1,_0x1693('0x15'),JSON[_0x1693('0x18')](_0x1ba755));if(_0x1ba755[_0x1693('0x19')]){if(_0x1ba755['error'][_0x1693('0x1a')]===0x1f4){logger['error'](_0x1693('0x14'),_0x2af3d1,_0x1ba755['error'][_0x1693('0x1b')]);return _0x3807dd(_0x1ba755[_0x1693('0x19')]['message']);}logger['error'](_0x1693('0x14'),_0x2af3d1,_0x1ba755['error']['message']);return _0x26ba4b(_0x1ba755['error'][_0x1693('0x1b')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2af3d1,_0x1693('0x15'));_0x26ba4b(_0x1ba755[_0x1693('0x1c')][_0x1693('0x1b')]);}})[_0x1693('0x1d')](function(_0x28edfe){logger[_0x1693('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x2af3d1,_0x28edfe);_0x3807dd(_0x28edfe);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 2aa8127..7b8029b 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 _0xcb18=['remove','emit','removeListener','register','voicePrefix:'];(function(_0x3877f8,_0x265b71){var _0x53b9e1=function(_0xa64da9){while(--_0xa64da9){_0x3877f8['push'](_0x3877f8['shift']());}};_0x53b9e1(++_0x265b71);}(_0xcb18,0x159));var _0x8cb1=function(_0x32bc0d,_0x58a635){_0x32bc0d=_0x32bc0d-0x0;var _0x4764e5=_0xcb18[_0x32bc0d];return _0x4764e5;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x8cb1('0x0'),'update'];function createListener(_0x3df352,_0x50513d){return function(_0x5e800d){_0x50513d[_0x8cb1('0x1')](_0x3df352,_0x5e800d);};}function removeListener(_0x87b1d3,_0x15d761){return function(){VoicePrefixEvents[_0x8cb1('0x2')](_0x87b1d3,_0x15d761);};}exports[_0x8cb1('0x3')]=function(_0x503927){for(var _0x355d91=0x0,_0x335e41=events['length'];_0x355d91<_0x335e41;_0x355d91++){var _0x186f71=events[_0x355d91];var _0x510e92=createListener(_0x8cb1('0x4')+_0x186f71,_0x503927);VoicePrefixEvents['on'](_0x186f71,_0x510e92);}}; \ No newline at end of file +var _0xc125=['register','save','update','emit','removeListener'];(function(_0x2d5e9c,_0x47623d){var _0x475b9a=function(_0x243682){while(--_0x243682){_0x2d5e9c['push'](_0x2d5e9c['shift']());}};_0x475b9a(++_0x47623d);}(_0xc125,0x150));var _0x5c12=function(_0x14cc30,_0xd574b){_0x14cc30=_0x14cc30-0x0;var _0x3ad39c=_0xc125[_0x14cc30];return _0x3ad39c;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x5c12('0x0'),'remove',_0x5c12('0x1')];function createListener(_0x44b9de,_0x2b4f53){return function(_0x2423dc){_0x2b4f53[_0x5c12('0x2')](_0x44b9de,_0x2423dc);};}function removeListener(_0x46f293,_0x31bd53){return function(){VoicePrefixEvents[_0x5c12('0x3')](_0x46f293,_0x31bd53);};}exports[_0x5c12('0x4')]=function(_0x3f1c8b){for(var _0x1a1608=0x0,_0x11ace0=events['length'];_0x1a1608<_0x11ace0;_0x1a1608++){var _0x1d0635=events[_0x1a1608];var _0x4465e3=createListener('voicePrefix:'+_0x1d0635,_0x3f1c8b);VoicePrefixEvents['on'](_0x1d0635,_0x4465e3);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 0aeda17..210d700 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 _0x66ba=['delete','destroy','removeTeams','removeBlackLists','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index','/:id','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getBlackLists','post','create','/:id/clone','addTeams','/:id/lists','/:id/blacklists','addBlackLists','put','update'];(function(_0x3f37c2,_0x2331cb){var _0x542ccb=function(_0x3e02ad){while(--_0x3e02ad){_0x3f37c2['push'](_0x3f37c2['shift']());}};_0x542ccb(++_0x2331cb);}(_0x66ba,0x163));var _0xa66b=function(_0x5be0a1,_0x49ee54){_0x5be0a1=_0x5be0a1-0x0;var _0x1e3f13=_0x66ba[_0x5be0a1];return _0x1e3f13;};'use strict';var multer=require(_0xa66b('0x0'));var util=require('util');var path=require(_0xa66b('0x1'));var timeout=require(_0xa66b('0x2'));var express=require(_0xa66b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa66b('0x4'));var interaction=require(_0xa66b('0x5'));var config=require(_0xa66b('0x6'));var controller=require(_0xa66b('0x7'));router['get']('/',auth[_0xa66b('0x8')](),controller[_0xa66b('0x9')]);router['get'](_0xa66b('0xa'),auth[_0xa66b('0x8')](),controller['show']);router[_0xa66b('0xb')](_0xa66b('0xc'),auth[_0xa66b('0x8')](),controller[_0xa66b('0xd')]);router[_0xa66b('0xb')](_0xa66b('0xe'),auth[_0xa66b('0x8')](),controller[_0xa66b('0xf')]);router['get'](_0xa66b('0x10'),auth[_0xa66b('0x8')](),controller[_0xa66b('0x11')]);router[_0xa66b('0xb')](_0xa66b('0x12'),auth[_0xa66b('0x8')](),controller['getHopperBlacks']);router[_0xa66b('0xb')](_0xa66b('0x13'),auth[_0xa66b('0x8')](),controller[_0xa66b('0x14')]);router[_0xa66b('0xb')](_0xa66b('0x15'),auth[_0xa66b('0x8')](),controller[_0xa66b('0x16')]);router[_0xa66b('0xb')](_0xa66b('0x17'),auth[_0xa66b('0x8')](),controller[_0xa66b('0x18')]);router[_0xa66b('0xb')]('/:id/lists',auth[_0xa66b('0x8')](),controller['getLists']);router[_0xa66b('0xb')]('/:id/blacklists',auth[_0xa66b('0x8')](),controller[_0xa66b('0x19')]);router[_0xa66b('0x1a')]('/',auth['isAuthenticated'](),controller[_0xa66b('0x1b')]);router[_0xa66b('0x1a')](_0xa66b('0x1c'),auth[_0xa66b('0x8')](),controller['clone']);router['post'](_0xa66b('0x13'),auth[_0xa66b('0x8')](),controller[_0xa66b('0x1d')]);router[_0xa66b('0x1a')](_0xa66b('0x15'),auth[_0xa66b('0x8')](),controller['addAgents']);router[_0xa66b('0x1a')](_0xa66b('0x1e'),auth['isAuthenticated'](),controller['addLists']);router[_0xa66b('0x1a')](_0xa66b('0x1f'),auth[_0xa66b('0x8')](),controller[_0xa66b('0x20')]);router[_0xa66b('0x21')](_0xa66b('0xa'),auth['isAuthenticated'](),controller[_0xa66b('0x22')]);router[_0xa66b('0x23')]('/:id',auth['isAuthenticated'](),controller[_0xa66b('0x24')]);router[_0xa66b('0x23')](_0xa66b('0x13'),auth['isAuthenticated'](),controller[_0xa66b('0x25')]);router[_0xa66b('0x23')](_0xa66b('0x15'),auth[_0xa66b('0x8')](),controller['removeAgents']);router[_0xa66b('0x23')](_0xa66b('0x1e'),auth[_0xa66b('0x8')](),controller['removeLists']);router[_0xa66b('0x23')](_0xa66b('0x1f'),auth[_0xa66b('0x8')](),controller[_0xa66b('0x26')]);module['exports']=router; \ No newline at end of file +var _0xd02e=['addAgents','addBlackLists','put','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','/:id/users'];(function(_0x4a120c,_0x30b07b){var _0x25bd6e=function(_0x3d566c){while(--_0x3d566c){_0x4a120c['push'](_0x4a120c['shift']());}};_0x25bd6e(++_0x30b07b);}(_0xd02e,0xd1));var _0xed02=function(_0x394be7,_0x249850){_0x394be7=_0x394be7-0x0;var _0x4e9e86=_0xd02e[_0x394be7];return _0x4e9e86;};'use strict';var multer=require(_0xed02('0x0'));var util=require(_0xed02('0x1'));var path=require(_0xed02('0x2'));var timeout=require(_0xed02('0x3'));var express=require(_0xed02('0x4'));var router=express[_0xed02('0x5')]();var fs_extra=require(_0xed02('0x6'));var auth=require(_0xed02('0x7'));var interaction=require(_0xed02('0x8'));var config=require(_0xed02('0x9'));var controller=require('./voiceQueue.controller');router['get']('/',auth[_0xed02('0xa')](),controller['index']);router[_0xed02('0xb')](_0xed02('0xc'),auth[_0xed02('0xa')](),controller[_0xed02('0xd')]);router[_0xed02('0xb')]('/:id/hoppers',auth[_0xed02('0xa')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xed02('0xe')]);router[_0xed02('0xb')](_0xed02('0xf'),auth['isAuthenticated'](),controller[_0xed02('0x10')]);router['get'](_0xed02('0x11'),auth[_0xed02('0xa')](),controller[_0xed02('0x12')]);router[_0xed02('0xb')](_0xed02('0x13'),auth[_0xed02('0xa')](),controller[_0xed02('0x14')]);router[_0xed02('0xb')]('/:id/users',auth[_0xed02('0xa')](),controller[_0xed02('0x15')]);router[_0xed02('0xb')](_0xed02('0x16'),auth[_0xed02('0xa')](),controller['getMembers']);router['get'](_0xed02('0x17'),auth['isAuthenticated'](),controller[_0xed02('0x18')]);router[_0xed02('0xb')](_0xed02('0x19'),auth[_0xed02('0xa')](),controller['getBlackLists']);router[_0xed02('0x1a')]('/',auth[_0xed02('0xa')](),controller[_0xed02('0x1b')]);router[_0xed02('0x1a')](_0xed02('0x1c'),auth['isAuthenticated'](),controller[_0xed02('0x1d')]);router[_0xed02('0x1a')](_0xed02('0x13'),auth[_0xed02('0xa')](),controller['addTeams']);router['post'](_0xed02('0x1e'),auth[_0xed02('0xa')](),controller[_0xed02('0x1f')]);router['post']('/:id/lists',auth[_0xed02('0xa')](),controller['addLists']);router['post'](_0xed02('0x19'),auth[_0xed02('0xa')](),controller[_0xed02('0x20')]);router[_0xed02('0x21')](_0xed02('0xc'),auth[_0xed02('0xa')](),controller[_0xed02('0x22')]);router[_0xed02('0x23')](_0xed02('0xc'),auth[_0xed02('0xa')](),controller['destroy']);router['delete'](_0xed02('0x13'),auth['isAuthenticated'](),controller[_0xed02('0x24')]);router[_0xed02('0x23')](_0xed02('0x1e'),auth[_0xed02('0xa')](),controller[_0xed02('0x25')]);router[_0xed02('0x23')](_0xed02('0x17'),auth[_0xed02('0xa')](),controller[_0xed02('0x26')]);router['delete'](_0xed02('0x19'),auth[_0xed02('0xa')](),controller[_0xed02('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index d21ceb5..a45f84a 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 _0x76cd=['#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','BOOLEAN','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','fewestcalls','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','rrmemory','roundrobin','progressive','predictive','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','Active/Disactive\x20Campaign','preview','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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','never','onlyIfOpen','Active/Disactive\x20AMD'];(function(_0x17d26c,_0x16361e){var _0x4e11e6=function(_0x39ca2a){while(--_0x39ca2a){_0x17d26c['push'](_0x17d26c['shift']());}};_0x4e11e6(++_0x16361e);}(_0x76cd,0x1b7));var _0xd76c=function(_0x3b6a3e,_0x3bd5cf){_0x3b6a3e=_0x3b6a3e-0x0;var _0x134800=_0x76cd[_0x3b6a3e];return _0x134800;};'use strict';var Sequelize=require(_0xd76c('0x0'));module[_0xd76c('0x1')]={'name':{'type':Sequelize[_0xd76c('0x2')],'allowNull':![],'unique':_0xd76c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x5'),_0xd76c('0x6')),'allowNull':![],'defaultValue':_0xd76c('0x5')},'musiconhold':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':_0xd76c('0x7')},'announce':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xd76c('0x8'),'leastrecent',_0xd76c('0x9'),'random','rrmemory',_0xd76c('0xa'),_0xd76c('0xb'),_0xd76c('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1700a4){this[_0xd76c('0xd')](_0xd76c('0xe'),_0x1700a4?_0x1700a4:'rrmemory');},'get':function(){var _0x5826e3=this[_0xd76c('0xf')](_0xd76c('0x10'));var _0x542f52=this[_0xd76c('0xf')](_0xd76c('0x11'));var _0x1dfa33=this['getDataValue']('strategy');if(_0x5826e3===_0xd76c('0x5')){return _0x1dfa33;}if(_0x542f52===_0xd76c('0x12')&&_0x1dfa33===_0xd76c('0x13')||_0x542f52===_0xd76c('0x12')&&_0x1dfa33===_0xd76c('0x14')){return _0x1dfa33;}if(_0x542f52===_0xd76c('0x15')||_0x542f52===_0xd76c('0x16')||_0x542f52==='power'){return _0x1dfa33;}return null;}},'servicelevel':{'type':Sequelize[_0xd76c('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xd76c('0x17')](0xb)},'timeout':{'type':Sequelize[_0xd76c('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xd76c('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xd76c('0x2')]},'weight':{'type':Sequelize[_0xd76c('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xd76c('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x18'),'no'),'defaultValue':_0xd76c('0x18')},'autopause':{'type':Sequelize['ENUM'](_0xd76c('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xd76c('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xd76c('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xd76c('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xd76c('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xd76c('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xd76c('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xd76c('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xd76c('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x18'),'no'),'defaultValue':_0xd76c('0x18')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xd76c('0x18'),'no',_0xd76c('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x18'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd76c('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xd76c('0x2')]},'queue_youarenext':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd76c('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xd76c('0x2')]},'queue_quantity1':{'type':Sequelize[_0xd76c('0x2')]},'queue_quantity2':{'type':Sequelize[_0xd76c('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xd76c('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xd76c('0x1a')],'set':function(_0x1db641){this['setDataValue'](_0xd76c('0x1b'),_0x1db641?_0x1db641[_0xd76c('0x1c')](','):[]);},'get':function(){return this[_0xd76c('0xf')](_0xd76c('0x1b'))?this[_0xd76c('0xf')](_0xd76c('0x1b'))[_0xd76c('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':'yes','set':function(_0x514b09){this[_0xd76c('0xd')]('joinempty',_0x514b09?_0x514b09[_0xd76c('0x1c')](','):undefined);},'get':function(){return this[_0xd76c('0xf')](_0xd76c('0x1e'))?this[_0xd76c('0xf')](_0xd76c('0x1e'))[_0xd76c('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':'no','set':function(_0x4bf907){this[_0xd76c('0xd')]('leavewhenempty',_0x4bf907?_0x4bf907[_0xd76c('0x1c')](','):undefined);},'get':function(){return this[_0xd76c('0xf')](_0xd76c('0x1f'))?this[_0xd76c('0xf')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xd76c('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xd76c('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xd76c('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xd76c('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xd76c('0x2')]},'description':{'type':Sequelize[_0xd76c('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x209a84){this['setDataValue'](_0xd76c('0x20'),_0x209a84);if(_0x209a84){if(this['getDataValue'](_0xd76c('0x21'))<0x2){this['setDataValue'](_0xd76c('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xd76c('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd76c('0x22')},'dialMethod':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x23'),'progressive','power','predictive','booked'),'defaultValue':_0xd76c('0x15'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xd76c('0x17')](0x4)[_0xd76c('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xd76c('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd76c('0x25')},'dialPowerLevel':{'type':Sequelize[_0xd76c('0x26')](0x2)[_0xd76c('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xd76c('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x28'),_0xd76c('0x29')),'defaultValue':'dropRate','comment':_0xd76c('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xd76c('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xd76c('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xd76c('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd76c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xd76c('0x17')](0x3)[_0xd76c('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd76c('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':_0xd76c('0x2e'),'comment':_0xd76c('0x2f')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd76c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd76c('0x30')},'dialQueueProject':{'type':Sequelize[_0xd76c('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xd76c('0x17')](0x3)[_0xd76c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd76c('0x17')](0x5)[_0xd76c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd76c('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xd76c('0x17')](0x3)[_0xd76c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd76c('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd76c('0x17')](0x5)[_0xd76c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd76c('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd76c('0x17')](0x3)[_0xd76c('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd76c('0x17')](0x5)[_0xd76c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd76c('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd76c('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd76c('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':_0xd76c('0x36')},'dialPrefix':{'type':Sequelize[_0xd76c('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xd76c('0x4')](_0xd76c('0x37'),_0xd76c('0x38'),_0xd76c('0x39')),'defaultValue':_0xd76c('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd76c('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd76c('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd76c('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd76c('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd76c('0x17')](0x9)[_0xd76c('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd76c('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xd76c('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd76c('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0xd76c('0x17')](0x9)[_0xd76c('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd76c('0x17')](0x9)[_0xd76c('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd76c('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd76c('0x17')](0x9)[_0xd76c('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd76c('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd76c('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd76c('0x17')](0x9)[_0xd76c('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xd76c('0x17')](0x5)[_0xd76c('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd76c('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xd76c('0x43')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xd76c('0x4')]('DESC',_0xd76c('0x44')),'defaultValue':_0xd76c('0x45')},'dialQueueProject2':{'type':Sequelize[_0xd76c('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xd76c('0x43')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xd76c('0x43')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd76c('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd76c('0x46')},'dialCutDigit':{'type':Sequelize[_0xd76c('0x17')](0x3)[_0xd76c('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd76c('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd76c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd76c('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd76c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd76c('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0xd76c('0x17')](0x3)[_0xd76c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd76c('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0xd76c('0x17')](0x5)[_0xd76c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd76c('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd76c('0x17')](0x3)[_0xd76c('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd76c('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd76c('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0xd76c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd76c('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd76c('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd76c('0x4f')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd76c('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd76c('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd76c('0x17')],'allowNull':!![],'comment':_0xd76c('0x51')},'mandatoryDisposition':{'type':Sequelize[_0xd76c('0x43')],'defaultValue':![],'comment':_0xd76c('0x52'),'set':function(_0x145a3c){if(!_0x145a3c)this[_0xd76c('0xd')]('mandatoryDispositionPauseId',null);this[_0xd76c('0xd')]('mandatoryDisposition',_0x145a3c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd76c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd76c('0x17')](0x3)[_0xd76c('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x88ff=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','ringall','leastrecent','fewestcalls','random','rrmemory','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','power','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x1016d0,_0xe93f77){var _0x398fad=function(_0x40e01d){while(--_0x40e01d){_0x1016d0['push'](_0x1016d0['shift']());}};_0x398fad(++_0xe93f77);}(_0x88ff,0x196));var _0xf88f=function(_0x3c5a7c,_0x892e91){_0x3c5a7c=_0x3c5a7c-0x0;var _0x4d1219=_0x88ff[_0x3c5a7c];return _0x4d1219;};'use strict';var Sequelize=require(_0xf88f('0x0'));module[_0xf88f('0x1')]={'name':{'type':Sequelize[_0xf88f('0x2')],'allowNull':![],'unique':_0xf88f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x5'),'outbound'),'allowNull':![],'defaultValue':_0xf88f('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xf88f('0x4')]('rr',_0xf88f('0x6'),_0xf88f('0x7'),_0xf88f('0x8'),_0xf88f('0x9'),_0xf88f('0xa'),'linear','wrandom',_0xf88f('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1e52b0){this[_0xf88f('0xc')](_0xf88f('0xd'),_0x1e52b0?_0x1e52b0:'rrmemory');},'get':function(){var _0x5d5b08=this[_0xf88f('0xe')](_0xf88f('0xf'));var _0x56ae80=this[_0xf88f('0xe')](_0xf88f('0x10'));var _0x12dfcc=this[_0xf88f('0xe')](_0xf88f('0xd'));if(_0x5d5b08===_0xf88f('0x5')){return _0x12dfcc;}if(_0x56ae80===_0xf88f('0x11')&&_0x12dfcc===_0xf88f('0xa')||_0x56ae80==='booked'&&_0x12dfcc==='roundrobin'){return _0x12dfcc;}if(_0x56ae80===_0xf88f('0x12')||_0x56ae80===_0xf88f('0x13')||_0x56ae80==='power'){return _0x12dfcc;}return null;}},'servicelevel':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xf88f('0x14')](0xb)},'timeout':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf88f('0x2')]},'weight':{'type':Sequelize[_0xf88f('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf88f('0x4')]('yes','no'),'defaultValue':_0xf88f('0x15')},'autopause':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xf88f('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xf88f('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf88f('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xf88f('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xf88f('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf88f('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no'),'defaultValue':_0xf88f('0x15')},'announce_holdtime':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no',_0xf88f('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xf88f('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xf88f('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xf88f('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xf88f('0x2')]},'queue_youarenext':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xf88f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf88f('0x2')]},'queue_quantity1':{'type':Sequelize[_0xf88f('0x2')]},'queue_quantity2':{'type':Sequelize[_0xf88f('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xf88f('0x2')]},'periodic_announce':{'type':Sequelize[_0xf88f('0x17')],'set':function(_0x346a98){this['setDataValue'](_0xf88f('0x18'),_0x346a98?_0x346a98[_0xf88f('0x19')](','):[]);},'get':function(){return this[_0xf88f('0xe')](_0xf88f('0x18'))?this[_0xf88f('0xe')](_0xf88f('0x18'))[_0xf88f('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':'yes','set':function(_0x3d4ea3){this[_0xf88f('0xc')](_0xf88f('0x1b'),_0x3d4ea3?_0x3d4ea3[_0xf88f('0x19')](','):undefined);},'get':function(){return this[_0xf88f('0xe')]('joinempty')?this[_0xf88f('0xe')](_0xf88f('0x1b'))[_0xf88f('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':'no','set':function(_0x115332){this[_0xf88f('0xc')](_0xf88f('0x1c'),_0x115332?_0x115332['join'](','):undefined);},'get':function(){return this[_0xf88f('0xe')]('leavewhenempty')?this[_0xf88f('0xe')](_0xf88f('0x1c'))[_0xf88f('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xf88f('0x4')](_0xf88f('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xf88f('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf88f('0x2')]},'description':{'type':Sequelize[_0xf88f('0x2')]},'acw':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':0x0,'set':function(_0x2b741d){this[_0xf88f('0xc')]('acw',_0x2b741d);if(_0x2b741d){if(this['getDataValue'](_0xf88f('0x1e'))<0x2){this[_0xf88f('0xc')](_0xf88f('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf88f('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xf88f('0x4')]('preview',_0xf88f('0x12'),_0xf88f('0x1f'),_0xf88f('0x13'),_0xf88f('0x11')),'defaultValue':_0xf88f('0x12'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xf88f('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf88f('0x20')},'dialLimitQueue':{'type':Sequelize[_0xf88f('0x14')](0x4)[_0xf88f('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf88f('0x22')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xf88f('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xf88f('0x23')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0xf88f('0x24')),'defaultValue':_0xf88f('0x24'),'comment':_0xf88f('0x25')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf88f('0x26')](0x2)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xf88f('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf88f('0x28')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf88f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf88f('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':_0xf88f('0x29'),'comment':_0xf88f('0x2a')},'dialQueueTimeout':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x2b')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xf88f('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf88f('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'comment':_0xf88f('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':_0xf88f('0x30')},'dialPrefix':{'type':Sequelize[_0xf88f('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xf88f('0x31'),_0xf88f('0x32')),'defaultValue':_0xf88f('0x33')},'dialAMDActive':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':0x0,'comment':_0xf88f('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0xf88f('0x14')](0x9)[_0xf88f('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf88f('0x35')},'dialAMDGreeting':{'type':Sequelize[_0xf88f('0x14')](0x9)[_0xf88f('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf88f('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf88f('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf88f('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xf88f('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf88f('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0xf88f('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf88f('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf88f('0x14')](0x9)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf88f('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xf88f('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf88f('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf88f('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf88f('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0xf88f('0x14')](0x5)[_0xf88f('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf88f('0x3d')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf88f('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf88f('0x4')]('DESC',_0xf88f('0x3f')),'defaultValue':_0xf88f('0x40')},'dialQueueProject2':{'type':Sequelize[_0xf88f('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf88f('0x41')},'dialCutDigit':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf88f('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x44')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf88f('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf88f('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x47')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf88f('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf88f('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf88f('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf88f('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf88f('0x14')],'allowNull':!![],'comment':_0xf88f('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0xf88f('0x1d')],'defaultValue':![],'comment':_0xf88f('0x4b'),'set':function(_0x54ca85){if(!_0x54ca85)this[_0xf88f('0xc')]('mandatoryDispositionPauseId',null);this[_0xf88f('0xc')](_0xf88f('0x4c'),_0x54ca85);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf88f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf88f('0x14')](0x3)[_0xf88f('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 0db7331..9c7f648 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 _0xc812=['interface','flatMap','Agents','forEach','penalty','sequelize','TeamVoiceQueue','upsert','each','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','Team','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','compact','removeTeams','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','userVoiceQueue:save','push','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','scheduledAt','ListId','phone','NOW()','CmListId','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','ContactId','cm_contacts','ListId\x20=\x20?','fromQuery','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','localhost','./voiceQueue.socket','register','end','status','json','offset','undefined','limit','count','Content-Range','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','value','type','find','name','UserProfileResource','stack','send','index','map','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','update','CmHopper','order','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','rows','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','User','online','voicePause'];(function(_0x1663dd,_0x5b91cc){var _0x5cb71a=function(_0x1ced30){while(--_0x1ced30){_0x1663dd['push'](_0x1663dd['shift']());}};_0x5cb71a(++_0x5b91cc);}(_0xc812,0x1b7));var _0x2c81=function(_0x21a20c,_0x183b7e){_0x21a20c=_0x21a20c-0x0;var _0x20b0cc=_0xc812[_0x21a20c];return _0x20b0cc;};'use strict';var emlformat=require(_0x2c81('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c81('0x1'));var jsonpatch=require(_0x2c81('0x2'));var rp=require(_0x2c81('0x3'));var moment=require(_0x2c81('0x4'));var BPromise=require(_0x2c81('0x5'));var Mustache=require(_0x2c81('0x6'));var util=require(_0x2c81('0x7'));var path=require(_0x2c81('0x8'));var sox=require(_0x2c81('0x9'));var csv=require(_0x2c81('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c81('0xb'));var _=require('lodash');var squel=require(_0x2c81('0xc'));var crypto=require(_0x2c81('0xd'));var jsforce=require(_0x2c81('0xe'));var deskjs=require(_0x2c81('0xf'));var toCsv=require(_0x2c81('0xa'));var querystring=require(_0x2c81('0x10'));var Papa=require(_0x2c81('0x11'));var Redis=require(_0x2c81('0x12'));var authService=require(_0x2c81('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2c81('0x14'));var hardwareService=require(_0x2c81('0x15'));var logger=require('../../config/logger')(_0x2c81('0x16'));var utils=require(_0x2c81('0x17'));var config=require(_0x2c81('0x18'));var licenseUtil=require(_0x2c81('0x19'));var db=require(_0x2c81('0x1a'))['db'];config[_0x2c81('0x1b')]=_[_0x2c81('0x1c')](config[_0x2c81('0x1b')],{'host':_0x2c81('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2c81('0x1e'))[_0x2c81('0x1f')](socket);function respondWithStatusCode(_0x5f247e,_0x5222dd){_0x5222dd=_0x5222dd||0xcc;return function(_0x5c7f01){if(_0x5c7f01){return _0x5f247e['sendStatus'](_0x5222dd);}return _0x5f247e['status'](_0x5222dd)[_0x2c81('0x20')]();};}function respondWithResult(_0x204c38,_0x3f3d58){_0x3f3d58=_0x3f3d58||0xc8;return function(_0x1e4730){if(_0x1e4730){return _0x204c38[_0x2c81('0x21')](_0x3f3d58)[_0x2c81('0x22')](_0x1e4730);}};}function respondWithFilteredResult(_0x3cb5e2,_0x6d9a03){return function(_0x5326bb){if(_0x5326bb){var _0x50dd47=typeof _0x6d9a03[_0x2c81('0x23')]===_0x2c81('0x24')&&typeof _0x6d9a03[_0x2c81('0x25')]===_0x2c81('0x24');var _0x46a640=_0x5326bb[_0x2c81('0x26')];var _0xb9ba6f=_0x50dd47?0x0:_0x6d9a03[_0x2c81('0x23')];var _0xc45dd0=_0x50dd47?_0x5326bb[_0x2c81('0x26')]:_0x6d9a03['offset']+_0x6d9a03[_0x2c81('0x25')];var _0x5ded7b;if(_0xc45dd0>=_0x46a640){_0xc45dd0=_0x46a640;_0x5ded7b=0xc8;}else{_0x5ded7b=0xce;}_0x3cb5e2[_0x2c81('0x21')](_0x5ded7b);return _0x3cb5e2['set'](_0x2c81('0x27'),_0xb9ba6f+'-'+_0xc45dd0+'/'+_0x46a640)[_0x2c81('0x22')](_0x5326bb);}return null;};}function patchUpdates(_0x4f71fa){return function(_0x4ca6f1){try{jsonpatch['apply'](_0x4ca6f1,_0x4f71fa,!![]);}catch(_0x13ac74){return BPromise['reject'](_0x13ac74);}return _0x4ca6f1[_0x2c81('0x28')]();};}function saveUpdates(_0x4460a6,_0xa3cc09){return function(_0xed2ff1){if(_0xed2ff1){return _0xed2ff1['update'](_0x4460a6)[_0x2c81('0x29')](function(_0x24c82f){return _0x24c82f;});}return null;};}function removeEntity(_0x46c7a2,_0x2d52bf){return function(_0x3b1aaa){if(_0x3b1aaa){return _0x3b1aaa[_0x2c81('0x2a')]()[_0x2c81('0x29')](function(){var _0x4c74c5=_0x3b1aaa[_0x2c81('0x2b')]({'plain':!![]});var _0xe1c15d=[{'name':_0x2c81('0x2c'),'value':_0x2c81('0x2d'),'ignore':![]},{'name':_0x2c81('0x2e'),'value':_0x2c81('0x2f'),'ignore':![]}];var _0x380691=_(_0xe1c15d)['filter']('ignore')['map'](_0x2c81('0x30'))[_0x2c81('0x30')]();if(_['includes'](_0x380691,_0x4c74c5[_0x2c81('0x31')])){return;}var _0x1dfd99=_[_0x2c81('0x32')](_0xe1c15d,['value',_0x4c74c5[_0x2c81('0x31')]])[_0x2c81('0x33')];return db[_0x2c81('0x34')][_0x2c81('0x2a')]({'where':{'type':_0x1dfd99,'resourceId':_0x4c74c5['id']}})[_0x2c81('0x29')](function(){return _0x3b1aaa;});})[_0x2c81('0x29')](function(){_0x46c7a2[_0x2c81('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cfaaf,_0x204669){return function(_0x1b8b84){if(!_0x1b8b84){_0x4cfaaf['sendStatus'](0x194);}return _0x1b8b84;};}function handleError(_0x404709,_0x53c71b){_0x53c71b=_0x53c71b||0x1f4;return function(_0x57c04b){logger['error'](_0x57c04b[_0x2c81('0x35')]);if(_0x57c04b[_0x2c81('0x33')]){delete _0x57c04b[_0x2c81('0x33')];}_0x404709[_0x2c81('0x21')](_0x53c71b)[_0x2c81('0x36')](_0x57c04b);};}exports[_0x2c81('0x37')]=function(_0x511561,_0x2658b3){var _0x2ddeca={},_0x26eef8={},_0x389856={'count':0x0,'rows':[]};var _0x108c0e=_[_0x2c81('0x38')](db[_0x2c81('0x39')][_0x2c81('0x3a')],function(_0x168a0e){return{'name':_0x168a0e[_0x2c81('0x3b')],'type':_0x168a0e[_0x2c81('0x31')][_0x2c81('0x3c')]};});_0x26eef8[_0x2c81('0x3d')]=_['map'](_0x108c0e,'name');_0x26eef8[_0x2c81('0x3e')]=_[_0x2c81('0x3f')](_0x511561[_0x2c81('0x3e')]);_0x26eef8[_0x2c81('0x40')]=_[_0x2c81('0x41')](_0x26eef8[_0x2c81('0x3d')],_0x26eef8[_0x2c81('0x3e')]);_0x2ddeca[_0x2c81('0x42')]=_[_0x2c81('0x41')](_0x26eef8[_0x2c81('0x3d')],qs[_0x2c81('0x43')](_0x511561[_0x2c81('0x3e')][_0x2c81('0x43')]));_0x2ddeca[_0x2c81('0x42')]=_0x2ddeca['attributes'][_0x2c81('0x44')]?_0x2ddeca[_0x2c81('0x42')]:_0x26eef8[_0x2c81('0x3d')];if(!_0x511561[_0x2c81('0x3e')][_0x2c81('0x45')](_0x2c81('0x46'))){_0x2ddeca['limit']=qs[_0x2c81('0x25')](_0x511561[_0x2c81('0x3e')][_0x2c81('0x25')]);_0x2ddeca[_0x2c81('0x23')]=qs['offset'](_0x511561['query'][_0x2c81('0x23')]);}_0x2ddeca['order']=qs[_0x2c81('0x47')](_0x511561[_0x2c81('0x3e')][_0x2c81('0x47')]);_0x2ddeca[_0x2c81('0x48')]=qs[_0x2c81('0x40')](_[_0x2c81('0x49')](_0x511561['query'],_0x26eef8[_0x2c81('0x40')]),_0x108c0e);if(_0x511561[_0x2c81('0x3e')][_0x2c81('0x4a')]){_0x2ddeca['where']=_[_0x2c81('0x4b')](_0x2ddeca[_0x2c81('0x48')],{'$or':_[_0x2c81('0x38')](_0x108c0e,function(_0x50d16d){if(_0x50d16d[_0x2c81('0x31')]!==_0x2c81('0x4c')){var _0x530caf={};_0x530caf[_0x50d16d[_0x2c81('0x33')]]={'$like':'%'+_0x511561[_0x2c81('0x3e')][_0x2c81('0x4a')]+'%'};return _0x530caf;}})});}_0x2ddeca=_[_0x2c81('0x4b')]({},_0x2ddeca,_0x511561[_0x2c81('0x4d')]);var _0xa082c={'where':_0x2ddeca['where']};return db[_0x2c81('0x39')][_0x2c81('0x26')](_0xa082c)['then'](function(_0x5e03e6){_0x389856[_0x2c81('0x26')]=_0x5e03e6;if(_0x511561[_0x2c81('0x3e')][_0x2c81('0x4e')]){_0x2ddeca[_0x2c81('0x4f')]=[{'all':!![]}];}return db[_0x2c81('0x39')][_0x2c81('0x50')](_0x2ddeca);})[_0x2c81('0x29')](function(_0x243a36){_0x389856['rows']=_0x243a36;return _0x389856;})[_0x2c81('0x29')](respondWithFilteredResult(_0x2658b3,_0x2ddeca))[_0x2c81('0x51')](handleError(_0x2658b3,null));};exports[_0x2c81('0x52')]=function(_0x4ce026,_0x1d7a95){var _0x146b9c={'raw':![],'where':{'id':_0x4ce026[_0x2c81('0x53')]['id']}},_0x1d2a06={};_0x1d2a06[_0x2c81('0x3d')]=_[_0x2c81('0x3f')](db['VoiceQueue']['rawAttributes']);_0x1d2a06[_0x2c81('0x3e')]=_['keys'](_0x4ce026[_0x2c81('0x3e')]);_0x1d2a06[_0x2c81('0x40')]=_['intersection'](_0x1d2a06['model'],_0x1d2a06[_0x2c81('0x3e')]);_0x146b9c[_0x2c81('0x42')]=_[_0x2c81('0x41')](_0x1d2a06[_0x2c81('0x3d')],qs[_0x2c81('0x43')](_0x4ce026[_0x2c81('0x3e')]['fields']));_0x146b9c[_0x2c81('0x42')]=_0x146b9c[_0x2c81('0x42')][_0x2c81('0x44')]?_0x146b9c['attributes']:_0x1d2a06[_0x2c81('0x3d')];if(_0x4ce026[_0x2c81('0x3e')][_0x2c81('0x4e')]){_0x146b9c[_0x2c81('0x4f')]=[{'all':!![]}];}_0x146b9c=_[_0x2c81('0x4b')]({},_0x146b9c,_0x4ce026[_0x2c81('0x4d')]);return db[_0x2c81('0x39')]['find'](_0x146b9c)[_0x2c81('0x29')](handleEntityNotFound(_0x1d7a95,null))[_0x2c81('0x29')](respondWithResult(_0x1d7a95,null))['catch'](handleError(_0x1d7a95,null));};exports[_0x2c81('0x54')]=function(_0x4bdcff,_0x29f761){return db[_0x2c81('0x39')]['create'](_0x4bdcff[_0x2c81('0x55')],{})['then'](function(_0x14f10e){var _0x598530=_0x4bdcff[_0x2c81('0x56')][_0x2c81('0x2b')]({'plain':!![]});if(!_0x598530)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x598530['role']===_0x2c81('0x56')){var _0x41a0d0=_0x14f10e['get']({'plain':!![]});var _0x274e51=[{'name':_0x2c81('0x2c'),'value':_0x2c81('0x2d')},{'name':_0x2c81('0x2e'),'value':_0x2c81('0x2f')}];var _0x3740b3=_['find'](_0x274e51,[_0x2c81('0x30'),_0x41a0d0['type']])[_0x2c81('0x33')];return db['UserProfileSection'][_0x2c81('0x32')]({'where':{'name':_0x3740b3,'userProfileId':_0x598530[_0x2c81('0x57')]},'raw':!![]})[_0x2c81('0x29')](function(_0x56d860){if(_0x56d860&&_0x56d860['autoAssociation']===0x0){return db[_0x2c81('0x34')][_0x2c81('0x54')]({'name':_0x41a0d0['name'],'resourceId':_0x41a0d0['id'],'type':_0x56d860[_0x2c81('0x33')],'sectionId':_0x56d860['id']},{})[_0x2c81('0x29')](function(){return _0x14f10e;});}else{return _0x14f10e;}})[_0x2c81('0x51')](function(_0x4154bb){logger['error'](_0x2c81('0x58'),_0x4154bb);throw _0x4154bb;});}return _0x14f10e;})[_0x2c81('0x29')](respondWithResult(_0x29f761,0xc9))['catch'](handleError(_0x29f761,null));};exports['clone']=function(_0x4af849,_0x4683b5){var _0x46db06={'where':{'id':_0x4af849['params']['id']}},_0x5e9d9f={};_0x5e9d9f[_0x2c81('0x3d')]=_['keys'](db[_0x2c81('0x39')][_0x2c81('0x3a')]);_0x46db06[_0x2c81('0x42')]=_[_0x2c81('0x41')](_0x5e9d9f[_0x2c81('0x3d')],qs[_0x2c81('0x43')](_0x4af849[_0x2c81('0x3e')]['fields']));_0x46db06['attributes']=_0x46db06[_0x2c81('0x42')][_0x2c81('0x44')]?_0x46db06['attributes']:_0x5e9d9f[_0x2c81('0x3d')];if(_0x4af849['query']['includeAll']){_0x46db06[_0x2c81('0x4f')]=[{'all':!![]}];}_0x46db06=_[_0x2c81('0x4b')]({},_0x46db06,_0x4af849[_0x2c81('0x4d')]);return db['VoiceQueue'][_0x2c81('0x32')](_0x46db06)[_0x2c81('0x29')](handleEntityNotFound(_0x4683b5,null))['then'](function(_0x45db82){if(_0x45db82){var _0x5a7590=_0x45db82[_0x2c81('0x2b')]({'plain':!![]});_0x5a7590=qs[_0x2c81('0x59')](_0x5a7590,['id',_0x2c81('0x5a'),_0x2c81('0x5b')]);_0x4af849[_0x2c81('0x55')]=_['omit'](_0x4af849[_0x2c81('0x55')],['id',_0x2c81('0x5a'),_0x2c81('0x5b')]);return db[_0x2c81('0x39')][_0x2c81('0x54')](_[_0x2c81('0x4b')](_0x5a7590,_0x4af849[_0x2c81('0x55')]),{'include':_0x4af849[_0x2c81('0x3e')][_0x2c81('0x4e')]?[{'all':!![]}]:undefined})[_0x2c81('0x29')](function(_0x3ced18){var _0x1e6da7=_0x4af849[_0x2c81('0x56')][_0x2c81('0x2b')]({'plain':!![]});if(!_0x1e6da7)throw new Error(_0x2c81('0x5c'));if(_0x1e6da7[_0x2c81('0x5d')]==='user'){var _0x1e8833=_0x3ced18[_0x2c81('0x2b')]({'plain':!![]});var _0x564f7f=[{'name':'VoiceQueues','value':_0x2c81('0x2d')},{'name':_0x2c81('0x2e'),'value':_0x2c81('0x2f')}];var _0x5f007d=_['find'](_0x564f7f,[_0x2c81('0x30'),_0x1e8833['type']])[_0x2c81('0x33')];return db[_0x2c81('0x5e')]['find']({'where':{'name':_0x5f007d,'userProfileId':_0x1e6da7[_0x2c81('0x57')]},'raw':!![]})[_0x2c81('0x29')](function(_0x4131cf){if(_0x4131cf&&_0x4131cf[_0x2c81('0x5f')]===0x0){return db[_0x2c81('0x34')][_0x2c81('0x54')]({'name':_0x1e8833['name'],'resourceId':_0x1e8833['id'],'type':_0x4131cf[_0x2c81('0x33')],'sectionId':_0x4131cf['id']},{})[_0x2c81('0x29')](function(){return _0x3ced18;});}else{return _0x3ced18;}})[_0x2c81('0x51')](function(_0x58c81d){logger[_0x2c81('0x60')](_0x2c81('0x58'),_0x58c81d);throw _0x58c81d;});}return _0x3ced18;});}})[_0x2c81('0x29')](respondWithResult(_0x4683b5,0xc9))[_0x2c81('0x51')](handleError(_0x4683b5,null));};exports[_0x2c81('0x61')]=function(_0x818961,_0x146eb1){if(_0x818961['body']['id']){delete _0x818961['body']['id'];}return db[_0x2c81('0x39')][_0x2c81('0x32')]({'where':{'id':_0x818961[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x146eb1,null))[_0x2c81('0x29')](saveUpdates(_0x818961['body'],null))[_0x2c81('0x29')](respondWithResult(_0x146eb1,null))[_0x2c81('0x51')](handleError(_0x146eb1,null));};exports[_0x2c81('0x2a')]=function(_0x4b3f1a,_0x11b604){return db[_0x2c81('0x39')][_0x2c81('0x32')]({'where':{'id':_0x4b3f1a[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x11b604,null))['then'](removeEntity(_0x11b604,null))['catch'](handleError(_0x11b604,null));};exports['getHoppers']=function(_0x553c54,_0x565876,_0x3198da){var _0x36728a={'raw':![],'where':{}};var _0x35aec2={};var _0x261415={'count':0x0,'rows':[]};return db[_0x2c81('0x39')]['findOne']({'where':{'id':_0x553c54[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x565876,null))[_0x2c81('0x29')](function(_0x11453a){if(_0x11453a){_0x35aec2['model']=_[_0x2c81('0x3f')](db[_0x2c81('0x62')][_0x2c81('0x3a')]);_0x35aec2[_0x2c81('0x3e')]=_[_0x2c81('0x3f')](_0x553c54[_0x2c81('0x3e')]);_0x35aec2[_0x2c81('0x40')]=_['intersection'](_0x35aec2[_0x2c81('0x3d')],_0x35aec2[_0x2c81('0x3e')]);_0x36728a['attributes']=_['intersection'](_0x35aec2[_0x2c81('0x3d')],qs[_0x2c81('0x43')](_0x553c54['query']['fields']));_0x36728a[_0x2c81('0x42')]=_0x36728a[_0x2c81('0x42')]['length']?_0x36728a['attributes']:_0x35aec2[_0x2c81('0x3d')];if(!_0x553c54[_0x2c81('0x3e')][_0x2c81('0x45')](_0x2c81('0x46'))){_0x36728a['limit']=qs[_0x2c81('0x25')](_0x553c54[_0x2c81('0x3e')][_0x2c81('0x25')]);_0x36728a[_0x2c81('0x23')]=qs['offset'](_0x553c54[_0x2c81('0x3e')]['offset']);}_0x36728a[_0x2c81('0x63')]=qs[_0x2c81('0x47')](_0x553c54[_0x2c81('0x3e')][_0x2c81('0x47')]);_0x36728a['where']=qs[_0x2c81('0x40')](_[_0x2c81('0x49')](_0x553c54['query'],_0x35aec2[_0x2c81('0x40')]));_0x36728a[_0x2c81('0x48')][_0x2c81('0x64')]=_0x11453a['id'];if(_0x553c54[_0x2c81('0x3e')][_0x2c81('0x4a')]){_0x36728a[_0x2c81('0x48')]=_[_0x2c81('0x4b')](_0x36728a['where'],{'$or':_['map'](_0x36728a[_0x2c81('0x42')],function(_0x3296fd){var _0x10ca77={};_0x10ca77[_0x3296fd]={'$like':'%'+_0x553c54['query'][_0x2c81('0x4a')]+'%'};return _0x10ca77;})});}_0x36728a=_[_0x2c81('0x4b')]({},_0x36728a,_0x553c54[_0x2c81('0x4d')]);return db[_0x2c81('0x62')][_0x2c81('0x26')]({'where':_0x36728a[_0x2c81('0x48')]})['then'](function(_0x2f4888){_0x261415[_0x2c81('0x26')]=_0x2f4888;if(_0x553c54['query'][_0x2c81('0x4e')]){_0x36728a[_0x2c81('0x4f')]=[{'all':!![]}];}return db[_0x2c81('0x62')][_0x2c81('0x50')](_0x36728a);})[_0x2c81('0x29')](function(_0x39c734){_0x261415['rows']=_0x39c734;return _0x261415;});}})[_0x2c81('0x29')](respondWithFilteredResult(_0x565876,_0x36728a))[_0x2c81('0x51')](handleError(_0x565876,null));};exports[_0x2c81('0x65')]=function(_0x31bc68,_0x538246,_0x30a47f){var _0x328dcf={'raw':!![],'where':{}};var _0x576735={};var _0x58087c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2c81('0x66')]({'where':{'id':_0x31bc68['params']['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x538246,null))['then'](function(_0xa43fdc){if(_0xa43fdc){_0x576735[_0x2c81('0x3d')]=_[_0x2c81('0x3f')](db[_0x2c81('0x67')]['rawAttributes']);_0x576735[_0x2c81('0x3e')]=_[_0x2c81('0x3f')](_0x31bc68[_0x2c81('0x3e')]);_0x576735[_0x2c81('0x40')]=_[_0x2c81('0x41')](_0x576735[_0x2c81('0x3d')],_0x576735[_0x2c81('0x3e')]);_0x328dcf[_0x2c81('0x42')]=_['intersection'](_0x576735[_0x2c81('0x3d')],qs[_0x2c81('0x43')](_0x31bc68['query'][_0x2c81('0x43')]));_0x328dcf[_0x2c81('0x42')]=_0x328dcf[_0x2c81('0x42')][_0x2c81('0x44')]?_0x328dcf['attributes']:_0x576735['model'];if(!_0x31bc68['query'][_0x2c81('0x45')](_0x2c81('0x46'))){_0x328dcf[_0x2c81('0x25')]=qs[_0x2c81('0x25')](_0x31bc68[_0x2c81('0x3e')][_0x2c81('0x25')]);_0x328dcf[_0x2c81('0x23')]=qs['offset'](_0x31bc68[_0x2c81('0x3e')][_0x2c81('0x23')]);}_0x328dcf[_0x2c81('0x63')]=qs[_0x2c81('0x47')](_0x31bc68[_0x2c81('0x3e')]['sort']);_0x328dcf[_0x2c81('0x48')]=qs[_0x2c81('0x40')](_[_0x2c81('0x49')](_0x31bc68['query'],_0x576735[_0x2c81('0x40')]));_0x328dcf[_0x2c81('0x48')][_0x2c81('0x64')]=_0xa43fdc['id'];if(_0x31bc68[_0x2c81('0x3e')][_0x2c81('0x4a')]){_0x328dcf[_0x2c81('0x48')]=_[_0x2c81('0x4b')](_0x328dcf[_0x2c81('0x48')],{'$or':_[_0x2c81('0x38')](_0x328dcf[_0x2c81('0x42')],function(_0x33722e){var _0x426439={};_0x426439[_0x33722e]={'$like':'%'+_0x31bc68[_0x2c81('0x3e')]['filter']+'%'};return _0x426439;})});}_0x328dcf=_[_0x2c81('0x4b')]({},_0x328dcf,_0x31bc68[_0x2c81('0x4d')]);return db[_0x2c81('0x67')][_0x2c81('0x26')]({'where':_0x328dcf[_0x2c81('0x48')]})[_0x2c81('0x29')](function(_0x5857b0){_0x58087c['count']=_0x5857b0;if(_0x31bc68[_0x2c81('0x3e')][_0x2c81('0x4e')]){_0x328dcf['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x2c81('0x50')](_0x328dcf);})['then'](function(_0x8058ec){_0x58087c[_0x2c81('0x68')]=_0x8058ec;return _0x58087c;});}})[_0x2c81('0x29')](respondWithFilteredResult(_0x538246,_0x328dcf))[_0x2c81('0x51')](handleError(_0x538246,null));};exports['getHopperFinals']=function(_0x239a72,_0x39b8e3,_0xe2a024){var _0x4b2a63={'raw':!![],'where':{}};var _0x33e526={};var _0x2fbb7d={'count':0x0,'rows':[]};return db[_0x2c81('0x39')][_0x2c81('0x66')]({'where':{'id':_0x239a72['params']['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x39b8e3,null))[_0x2c81('0x29')](function(_0x47bf9c){if(_0x47bf9c){_0x33e526['model']=_[_0x2c81('0x3f')](db[_0x2c81('0x69')]['rawAttributes']);_0x33e526['query']=_[_0x2c81('0x3f')](_0x239a72[_0x2c81('0x3e')]);_0x33e526[_0x2c81('0x40')]=_[_0x2c81('0x41')](_0x33e526[_0x2c81('0x3d')],_0x33e526['query']);_0x4b2a63[_0x2c81('0x42')]=_[_0x2c81('0x41')](_0x33e526[_0x2c81('0x3d')],qs[_0x2c81('0x43')](_0x239a72[_0x2c81('0x3e')]['fields']));_0x4b2a63[_0x2c81('0x42')]=_0x4b2a63[_0x2c81('0x42')][_0x2c81('0x44')]?_0x4b2a63[_0x2c81('0x42')]:_0x33e526['model'];if(!_0x239a72[_0x2c81('0x3e')][_0x2c81('0x45')](_0x2c81('0x46'))){_0x4b2a63['limit']=qs[_0x2c81('0x25')](_0x239a72[_0x2c81('0x3e')]['limit']);_0x4b2a63[_0x2c81('0x23')]=qs[_0x2c81('0x23')](_0x239a72[_0x2c81('0x3e')]['offset']);}_0x4b2a63[_0x2c81('0x63')]=qs[_0x2c81('0x47')](_0x239a72['query'][_0x2c81('0x47')]);_0x4b2a63['where']=qs[_0x2c81('0x40')](_[_0x2c81('0x49')](_0x239a72['query'],_0x33e526['filters']));_0x4b2a63[_0x2c81('0x48')]['VoiceQueueId']=_0x47bf9c['id'];if(_0x239a72[_0x2c81('0x3e')]['filter']){_0x4b2a63['where']=_[_0x2c81('0x4b')](_0x4b2a63['where'],{'$or':_[_0x2c81('0x38')](_0x4b2a63['attributes'],function(_0x202185){var _0x328f01={};_0x328f01[_0x202185]={'$like':'%'+_0x239a72[_0x2c81('0x3e')][_0x2c81('0x4a')]+'%'};return _0x328f01;})});}_0x4b2a63=_[_0x2c81('0x4b')]({},_0x4b2a63,_0x239a72['options']);return db[_0x2c81('0x69')]['count']({'where':_0x4b2a63[_0x2c81('0x48')]})['then'](function(_0x445f78){_0x2fbb7d[_0x2c81('0x26')]=_0x445f78;if(_0x239a72[_0x2c81('0x3e')]['includeAll']){_0x4b2a63[_0x2c81('0x4f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x2c81('0x50')](_0x4b2a63);})['then'](function(_0x2004f5){_0x2fbb7d[_0x2c81('0x68')]=_0x2004f5;return _0x2fbb7d;});}})[_0x2c81('0x29')](respondWithFilteredResult(_0x39b8e3,_0x4b2a63))[_0x2c81('0x51')](handleError(_0x39b8e3,null));};exports['getHopperBlacks']=function(_0x562e74,_0x3d28fc,_0x4cd800){var _0x17d73e={'raw':!![],'where':{}};var _0x705716={};var _0x40653b={'count':0x0,'rows':[]};return db[_0x2c81('0x39')][_0x2c81('0x66')]({'where':{'id':_0x562e74[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x3d28fc,null))[_0x2c81('0x29')](function(_0x15a41a){if(_0x15a41a){_0x705716[_0x2c81('0x3d')]=_[_0x2c81('0x3f')](db[_0x2c81('0x6a')][_0x2c81('0x3a')]);_0x705716[_0x2c81('0x3e')]=_[_0x2c81('0x3f')](_0x562e74[_0x2c81('0x3e')]);_0x705716[_0x2c81('0x40')]=_[_0x2c81('0x41')](_0x705716[_0x2c81('0x3d')],_0x705716['query']);_0x17d73e[_0x2c81('0x42')]=_[_0x2c81('0x41')](_0x705716['model'],qs[_0x2c81('0x43')](_0x562e74[_0x2c81('0x3e')][_0x2c81('0x43')]));_0x17d73e['attributes']=_0x17d73e['attributes'][_0x2c81('0x44')]?_0x17d73e['attributes']:_0x705716[_0x2c81('0x3d')];if(!_0x562e74[_0x2c81('0x3e')][_0x2c81('0x45')](_0x2c81('0x46'))){_0x17d73e['limit']=qs['limit'](_0x562e74[_0x2c81('0x3e')][_0x2c81('0x25')]);_0x17d73e[_0x2c81('0x23')]=qs[_0x2c81('0x23')](_0x562e74['query'][_0x2c81('0x23')]);}_0x17d73e[_0x2c81('0x63')]=qs[_0x2c81('0x47')](_0x562e74[_0x2c81('0x3e')][_0x2c81('0x47')]);_0x17d73e[_0x2c81('0x48')]=qs[_0x2c81('0x40')](_[_0x2c81('0x49')](_0x562e74[_0x2c81('0x3e')],_0x705716[_0x2c81('0x40')]));_0x17d73e[_0x2c81('0x48')][_0x2c81('0x64')]=_0x15a41a['id'];if(_0x562e74[_0x2c81('0x3e')][_0x2c81('0x4a')]){_0x17d73e[_0x2c81('0x48')]=_[_0x2c81('0x4b')](_0x17d73e[_0x2c81('0x48')],{'$or':_[_0x2c81('0x38')](_0x17d73e[_0x2c81('0x42')],function(_0x39d6ba){var _0x3df045={};_0x3df045[_0x39d6ba]={'$like':'%'+_0x562e74[_0x2c81('0x3e')][_0x2c81('0x4a')]+'%'};return _0x3df045;})});}_0x17d73e=_[_0x2c81('0x4b')]({},_0x17d73e,_0x562e74[_0x2c81('0x4d')]);return db[_0x2c81('0x6a')][_0x2c81('0x26')]({'where':_0x17d73e[_0x2c81('0x48')]})[_0x2c81('0x29')](function(_0x38800b){_0x40653b[_0x2c81('0x26')]=_0x38800b;if(_0x562e74[_0x2c81('0x3e')][_0x2c81('0x4e')]){_0x17d73e[_0x2c81('0x4f')]=[{'all':!![]}];}return db[_0x2c81('0x6a')]['findAll'](_0x17d73e);})[_0x2c81('0x29')](function(_0x41d83e){_0x40653b[_0x2c81('0x68')]=_0x41d83e;return _0x40653b;});}})[_0x2c81('0x29')](respondWithFilteredResult(_0x3d28fc,_0x17d73e))[_0x2c81('0x51')](handleError(_0x3d28fc,null));};exports['getTeams']=function(_0x20388f,_0x27c810,_0x11e382){var _0x436674={};var _0x1a8ebe={};var _0x35d3a6;var _0x2aff34;return db[_0x2c81('0x39')][_0x2c81('0x66')]({'where':{'id':_0x20388f[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x27c810,null))[_0x2c81('0x29')](function(_0x356b89){if(_0x356b89){_0x35d3a6=_0x356b89;_0x1a8ebe[_0x2c81('0x3d')]=_['keys'](db['Team'][_0x2c81('0x3a')]);_0x1a8ebe[_0x2c81('0x3e')]=_[_0x2c81('0x3f')](_0x20388f['query']);_0x1a8ebe[_0x2c81('0x40')]=_[_0x2c81('0x41')](_0x1a8ebe['model'],_0x1a8ebe[_0x2c81('0x3e')]);_0x436674['attributes']=_[_0x2c81('0x41')](_0x1a8ebe[_0x2c81('0x3d')],qs[_0x2c81('0x43')](_0x20388f['query'][_0x2c81('0x43')]));_0x436674['attributes']=_0x436674[_0x2c81('0x42')][_0x2c81('0x44')]?_0x436674[_0x2c81('0x42')]:_0x1a8ebe[_0x2c81('0x3d')];_0x436674[_0x2c81('0x63')]=qs[_0x2c81('0x47')](_0x20388f[_0x2c81('0x3e')][_0x2c81('0x47')]);_0x436674['where']=qs['filters'](_[_0x2c81('0x49')](_0x20388f[_0x2c81('0x3e')],_0x1a8ebe[_0x2c81('0x40')]));if(_0x20388f[_0x2c81('0x3e')][_0x2c81('0x4a')]){_0x436674[_0x2c81('0x48')]=_['merge'](_0x436674[_0x2c81('0x48')],{'$or':_[_0x2c81('0x38')](_0x436674[_0x2c81('0x42')],function(_0x3dd45d){var _0x293685={};_0x293685[_0x3dd45d]={'$like':'%'+_0x20388f[_0x2c81('0x3e')]['filter']+'%'};return _0x293685;})});}_0x436674=_[_0x2c81('0x4b')]({},_0x436674,_0x20388f[_0x2c81('0x4d')]);return _0x35d3a6[_0x2c81('0x6b')](_0x436674);}})[_0x2c81('0x29')](function(_0xb66387){if(_0xb66387){_0x2aff34=_0xb66387[_0x2c81('0x44')];if(!_0x20388f[_0x2c81('0x3e')][_0x2c81('0x45')]('nolimit')){_0x436674['limit']=qs['limit'](_0x20388f[_0x2c81('0x3e')][_0x2c81('0x25')]);_0x436674[_0x2c81('0x23')]=qs['offset'](_0x20388f[_0x2c81('0x3e')][_0x2c81('0x23')]);}return _0x35d3a6[_0x2c81('0x6b')](_0x436674);}})['then'](function(_0xeccf9){if(_0xeccf9){return _0xeccf9?{'count':_0x2aff34,'rows':_0xeccf9}:null;}})[_0x2c81('0x29')](respondWithResult(_0x27c810,null))[_0x2c81('0x51')](handleError(_0x27c810,null));};exports[_0x2c81('0x6c')]=function(_0x2c8828,_0x439c38,_0x4d04d4){var _0x495837=_0x2c8828[_0x2c81('0x55')][_0x2c81('0x6d')];var _0x27cc4d=_[_0x2c81('0x38')](_0x495837,'id');return db['Team'][_0x2c81('0x50')]({'where':{'id':_0x27cc4d},'attributes':['id'],'include':[{'model':db[_0x2c81('0x6e')],'as':'Agents','attributes':['id',_0x2c81('0x33'),_0x2c81('0x6f'),_0x2c81('0x70'),_0x2c81('0x71')],'raw':!![]}]})[_0x2c81('0x29')](function(_0x161ce4){if(_0x161ce4){var _0x41a4a0=_[_0x2c81('0x72')](_0x161ce4,function(_0x4b609c){var _0x222a6b=_0x4b609c[_0x2c81('0x2b')]({'plain':!![]});_0x222a6b[_0x2c81('0x73')][_0x2c81('0x74')](function(_0x3c7805){_0x3c7805[_0x2c81('0x75')]=_[_0x2c81('0x32')](_0x495837,{'id':_0x222a6b['id']})['penalty'];});return _0x222a6b['Agents'];});return db[_0x2c81('0x39')]['find']({'where':{'id':_0x2c8828['params']['id']}})[_0x2c81('0x29')](function(_0x1d5e83){return db[_0x2c81('0x76')]['transaction'](function(_0x2c6d42){return _0x1d5e83[_0x2c81('0x6c')](_0x27cc4d,{'transaction':_0x2c6d42})[_0x2c81('0x29')](function(){return BPromise['each'](_0x495837,function(_0x156b46){return db[_0x2c81('0x77')][_0x2c81('0x78')]({'TeamId':_0x156b46['id'],'VoiceQueueId':_0x2c8828[_0x2c81('0x53')]['id'],'penalty':_0x156b46['penalty']},{'transaction':_0x2c6d42});});})[_0x2c81('0x29')](function(){return BPromise[_0x2c81('0x79')](_0x41a4a0,function(_0x4635ef){return db['UserVoiceQueue'][_0x2c81('0x7a')]({'where':{'UserId':_0x4635ef['id'],'VoiceQueueId':_0x2c8828[_0x2c81('0x53')]['id']},'defaults':{'penalty':_0x4635ef[_0x2c81('0x75')]},'transaction':_0x2c6d42});});})[_0x2c81('0x29')](function(){return BPromise['each'](_[_0x2c81('0x4a')](_0x41a4a0,{'online':!![]}),function(_0x373f57){return db[_0x2c81('0x7b')][_0x2c81('0x78')]({'membername':_0x373f57[_0x2c81('0x33')],'UserId':_0x373f57['id'],'queue_name':_0x1d5e83[_0x2c81('0x33')],'VoiceQueueId':_0x1d5e83['id'],'interface':_[_0x2c81('0x7c')](_0x373f57[_0x2c81('0x71')])?util[_0x2c81('0x7d')](_0x2c81('0x7e'),_0x373f57[_0x2c81('0x33')]):_0x373f57[_0x2c81('0x71')],'paused':_0x373f57[_0x2c81('0x70')]||![],'penalty':_0x373f57[_0x2c81('0x75')]},{'transaction':_0x2c6d42});});})['then'](function(){_0x41a4a0['forEach'](function(_0x10aa61){socket['emit']('userVoiceQueue:save',{'UserId':_0x10aa61['id'],'VoiceQueueId':_0x1d5e83['id']});});});});});}})[_0x2c81('0x29')](respondWithStatusCode(_0x439c38,null))[_0x2c81('0x51')](handleError(_0x439c38,null));};exports['removeTeams']=function(_0x1eaeda,_0x1fcb22,_0x16e428){return db[_0x2c81('0x7f')][_0x2c81('0x50')]({'where':{'id':_0x1eaeda[_0x2c81('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2c81('0x6e')],'as':_0x2c81('0x73'),'attributes':['id'],'raw':!![]}]})[_0x2c81('0x29')](handleEntityNotFound(_0x1fcb22,null))[_0x2c81('0x29')](function(_0x1ededd){var _0x87e873=_[_0x2c81('0x38')](_0x1ededd,'id');var _0x5e7dad=[];var _0x176904=[];var _0x5a3adc=squel[_0x2c81('0x80')]();_0x5a3adc[_0x2c81('0x81')](_0x2c81('0x82'))[_0x2c81('0x83')](_0x2c81('0x84'),'tq')[_0x2c81('0x85')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2c81('0x48')](_0x2c81('0x86'),_0x1eaeda[_0x2c81('0x53')]['id']);for(var _0x172a9e=0x0;_0x172a9e<_0x1ededd[_0x2c81('0x44')];_0x172a9e+=0x1){let _0x4bf729=_0x1ededd[_0x172a9e];for(var _0x468838=0x0;_0x468838<_0x4bf729['Agents'][_0x2c81('0x44')];_0x468838+=0x1){let _0x38c70d=_0x4bf729[_0x2c81('0x73')][_0x468838];var _0xc797b5=_0x5a3adc['clone']();_0xc797b5['where'](_0x2c81('0x87'),_0x38c70d['id']);_0x176904['push'](db['sequelize'][_0x2c81('0x3e')](_0xc797b5[_0x2c81('0x88')](),{'type':db[_0x2c81('0x76')][_0x2c81('0x89')]['SELECT']})[_0x2c81('0x29')](function(_0x403ee8){if(_0x403ee8['length']===0x1){return _0x38c70d['id'];}else{var _0x15f61a=_[_0x2c81('0x8a')](_['map'](_0x403ee8,_0x2c81('0x8b')),function(_0x7e8d7c){return _[_0x2c81('0x8c')](_0x87e873,_0x7e8d7c);});if(_0x15f61a){return _0x38c70d['id'];}}}));}}return BPromise[_0x2c81('0x8d')](_0x176904)[_0x2c81('0x29')](function(_0x4efec2){_0x5e7dad=_(_0x5e7dad)['union'](_0x4efec2)[_0x2c81('0x8e')]()[_0x2c81('0x30')]();return db[_0x2c81('0x39')]['find']({'where':{'id':_0x1eaeda[_0x2c81('0x53')]['id']}})['then'](function(_0x315927){return db[_0x2c81('0x76')]['transaction'](function(_0x48202d){return _0x315927[_0x2c81('0x8f')](_0x1eaeda['query'][_0x2c81('0x90')],{'transaction':_0x48202d})['then'](function(){if(!_[_0x2c81('0x91')](_0x5e7dad)){return _0x315927[_0x2c81('0x92')](_0x5e7dad,{'transaction':_0x48202d})['then'](function(){return db[_0x2c81('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x1eaeda[_0x2c81('0x53')]['id'],'UserId':_0x5e7dad},'transaction':_0x48202d});});}})[_0x2c81('0x29')](function(){_0x5e7dad[_0x2c81('0x74')](function(_0xaaacfa){socket['emit'](_0x2c81('0x93'),{'UserId':_0xaaacfa,'VoiceQueueId':_0x315927['id']});});});});});});})[_0x2c81('0x29')](respondWithStatusCode(_0x1fcb22,null))[_0x2c81('0x51')](handleError(_0x1fcb22,null));};exports[_0x2c81('0x94')]=function(_0x3f4bc8,_0x36d850,_0x119ad0){var _0x41b4fc,_0x56e8e9;return db[_0x2c81('0x39')]['find']({'where':{'id':_0x3f4bc8['params']['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x36d850,null))[_0x2c81('0x29')](function(_0x51fef6){if(_0x51fef6){_0x56e8e9=_0x51fef6;return _0x51fef6[_0x2c81('0x94')](_0x3f4bc8[_0x2c81('0x55')][_0x2c81('0x90')],_['omit'](_0x3f4bc8[_0x2c81('0x55')],[_0x2c81('0x90'),'id'])||{})[_0x2c81('0x95')](function(_0x460df8){for(var _0x49321e=0x0;_0x49321e<_0x3f4bc8[_0x2c81('0x55')][_0x2c81('0x90')]['length'];_0x49321e+=0x1){socket[_0x2c81('0x96')](_0x2c81('0x97'),{'UserId':Number(_0x3f4bc8[_0x2c81('0x55')]['ids'][_0x49321e]),'VoiceQueueId':Number(_0x3f4bc8['params']['id'])});}return _0x460df8;});}})[_0x2c81('0x29')](function(_0x2874b4){_0x41b4fc=_0x2874b4||[];if(_0x56e8e9){return db[_0x2c81('0x6e')]['findAll']({'where':{'id':_0x3f4bc8[_0x2c81('0x55')][_0x2c81('0x90')]},'attributes':['id','name',_0x2c81('0x6f'),_0x2c81('0x70'),_0x2c81('0x71')],'raw':!![]});}})[_0x2c81('0x29')](function(_0x59108d){if(!_[_0x2c81('0x91')](_0x59108d)){var _0x361b80=[];for(var _0xcd15d8=0x0;_0xcd15d8<_0x59108d[_0x2c81('0x44')];_0xcd15d8++){if(_0x59108d[_0xcd15d8][_0x2c81('0x6f')]){_0x361b80[_0x2c81('0x98')](db['UserVoiceQueueRt'][_0x2c81('0x78')]({'membername':_0x59108d[_0xcd15d8]['name'],'UserId':_0x59108d[_0xcd15d8]['id'],'queue_name':_0x56e8e9['name'],'VoiceQueueId':_0x56e8e9['id'],'interface':_['isNil'](_0x59108d[_0xcd15d8][_0x2c81('0x71')])?util[_0x2c81('0x7d')](_0x2c81('0x7e'),_0x59108d[_0xcd15d8]['name']):_0x59108d[_0xcd15d8][_0x2c81('0x71')],'paused':_0x59108d[_0xcd15d8][_0x2c81('0x70')]||![],'penalty':_0x3f4bc8[_0x2c81('0x55')][_0x2c81('0x75')]||0x0}));}}return BPromise[_0x2c81('0x8d')](_0x361b80);}})[_0x2c81('0x29')](function(){return _0x41b4fc;})[_0x2c81('0x29')](respondWithResult(_0x36d850,null))['catch'](handleError(_0x36d850,null));};exports[_0x2c81('0x92')]=function(_0x19f6b5,_0x1f0592,_0x2d5d5e){return db['VoiceQueue']['find']({'where':{'id':_0x19f6b5[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x1f0592,null))['then'](function(_0x5c4ed8){if(_0x5c4ed8){return _0x5c4ed8[_0x2c81('0x92')](_0x19f6b5[_0x2c81('0x3e')][_0x2c81('0x90')])[_0x2c81('0x29')](function(){if(_[_0x2c81('0x99')](_0x19f6b5[_0x2c81('0x3e')][_0x2c81('0x90')])){for(var _0x157c93=0x0;_0x157c93<_0x19f6b5[_0x2c81('0x3e')][_0x2c81('0x90')][_0x2c81('0x44')];_0x157c93+=0x1){socket[_0x2c81('0x96')](_0x2c81('0x93'),{'UserId':Number(_0x19f6b5[_0x2c81('0x3e')][_0x2c81('0x90')][_0x157c93]),'VoiceQueueId':Number(_0x19f6b5['params']['id'])});}}else{socket[_0x2c81('0x96')](_0x2c81('0x93'),{'UserId':Number(_0x19f6b5[_0x2c81('0x3e')][_0x2c81('0x90')]),'VoiceQueueId':Number(_0x19f6b5[_0x2c81('0x53')]['id'])});}});}})[_0x2c81('0x29')](function(_0x4f2cd0){return db[_0x2c81('0x7b')][_0x2c81('0x2a')]({'where':{'VoiceQueueId':_0x19f6b5['params']['id'],'UserId':_0x19f6b5['query'][_0x2c81('0x90')]}})[_0x2c81('0x29')](function(){return _0x4f2cd0;});})['then'](respondWithStatusCode(_0x1f0592,null))[_0x2c81('0x51')](handleError(_0x1f0592,null));};exports[_0x2c81('0x9a')]=function(_0x420514,_0x79ef97,_0x5d9a55){var _0x535f3f={};var _0x47d1a9={};var _0x2afe14;var _0x18c50f;return db['VoiceQueue']['findOne']({'where':{'id':_0x420514[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x79ef97,null))[_0x2c81('0x29')](function(_0x31aeb8){if(_0x31aeb8){_0x2afe14=_0x31aeb8;_0x47d1a9[_0x2c81('0x3d')]=_[_0x2c81('0x3f')](db['User']['rawAttributes']);_0x47d1a9[_0x2c81('0x3e')]=_['keys'](_0x420514[_0x2c81('0x3e')]);_0x47d1a9['filters']=_[_0x2c81('0x41')](_0x47d1a9[_0x2c81('0x3d')],_0x47d1a9[_0x2c81('0x3e')]);_0x535f3f[_0x2c81('0x42')]=_[_0x2c81('0x41')](_0x47d1a9['model'],qs[_0x2c81('0x43')](_0x420514[_0x2c81('0x3e')][_0x2c81('0x43')]));_0x535f3f['attributes']=_0x535f3f[_0x2c81('0x42')][_0x2c81('0x44')]?_0x535f3f['attributes']:_0x47d1a9[_0x2c81('0x3d')];_0x535f3f[_0x2c81('0x63')]=qs[_0x2c81('0x47')](_0x420514['query'][_0x2c81('0x47')]);_0x535f3f[_0x2c81('0x48')]=qs['filters'](_[_0x2c81('0x49')](_0x420514[_0x2c81('0x3e')],_0x47d1a9['filters']));if(_0x420514[_0x2c81('0x3e')][_0x2c81('0x4a')]){_0x535f3f['where']=_[_0x2c81('0x4b')](_0x535f3f[_0x2c81('0x48')],{'$or':_[_0x2c81('0x38')](_0x535f3f[_0x2c81('0x42')],function(_0x5cd8f4){var _0x40a7f6={};_0x40a7f6[_0x5cd8f4]={'$like':'%'+_0x420514[_0x2c81('0x3e')][_0x2c81('0x4a')]+'%'};return _0x40a7f6;})});}_0x535f3f=_[_0x2c81('0x4b')]({},_0x535f3f,_0x420514['options']);return _0x2afe14[_0x2c81('0x9a')](_0x535f3f);}})[_0x2c81('0x29')](function(_0x43e5a4){if(_0x43e5a4){_0x18c50f=_0x43e5a4['length'];if(!_0x420514[_0x2c81('0x3e')]['hasOwnProperty'](_0x2c81('0x46'))){_0x535f3f[_0x2c81('0x25')]=qs[_0x2c81('0x25')](_0x420514['query']['limit']);_0x535f3f[_0x2c81('0x23')]=qs[_0x2c81('0x23')](_0x420514[_0x2c81('0x3e')]['offset']);}return _0x2afe14[_0x2c81('0x9a')](_0x535f3f);}})[_0x2c81('0x29')](function(_0x8dbee3){if(_0x8dbee3){return _0x8dbee3?{'count':_0x18c50f,'rows':_0x8dbee3}:null;}})[_0x2c81('0x29')](respondWithResult(_0x79ef97,null))[_0x2c81('0x51')](handleError(_0x79ef97,null));};exports[_0x2c81('0x9b')]=function(_0x1ff427,_0x1071ac,_0x292ea7){var _0x31a7c1={};var _0xc902d={};var _0x1a1a48;var _0x478d4d;return db[_0x2c81('0x39')][_0x2c81('0x66')]({'where':{'id':_0x1ff427[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x1071ac,null))['then'](function(_0x139f0f){if(_0x139f0f){_0x1a1a48=_0x139f0f;_0xc902d[_0x2c81('0x3d')]=_['keys'](db[_0x2c81('0x7b')]['rawAttributes']);_0xc902d[_0x2c81('0x3e')]=_['keys'](_0x1ff427[_0x2c81('0x3e')]);_0xc902d[_0x2c81('0x40')]=_[_0x2c81('0x41')](_0xc902d[_0x2c81('0x3d')],_0xc902d[_0x2c81('0x3e')]);_0x31a7c1[_0x2c81('0x42')]=_[_0x2c81('0x41')](_0xc902d['model'],qs[_0x2c81('0x43')](_0x1ff427[_0x2c81('0x3e')][_0x2c81('0x43')]));_0x31a7c1[_0x2c81('0x42')]=_0x31a7c1[_0x2c81('0x42')]['length']?_0x31a7c1['attributes']:_0xc902d[_0x2c81('0x3d')];_0x31a7c1['order']=qs[_0x2c81('0x47')](_0x1ff427[_0x2c81('0x3e')][_0x2c81('0x47')]);_0x31a7c1[_0x2c81('0x48')]=qs[_0x2c81('0x40')](_['pick'](_0x1ff427[_0x2c81('0x3e')],_0xc902d[_0x2c81('0x40')]));if(_0x1ff427[_0x2c81('0x3e')]['filter']){_0x31a7c1['where']=_[_0x2c81('0x4b')](_0x31a7c1[_0x2c81('0x48')],{'$or':_[_0x2c81('0x38')](_0x31a7c1['attributes'],function(_0x2ffb93){var _0x3a9c74={};_0x3a9c74[_0x2ffb93]={'$like':'%'+_0x1ff427['query'][_0x2c81('0x4a')]+'%'};return _0x3a9c74;})});}_0x31a7c1=_['merge']({},_0x31a7c1,_0x1ff427[_0x2c81('0x4d')]);return _0x1a1a48[_0x2c81('0x9b')](_0x31a7c1);}})[_0x2c81('0x29')](function(_0x4e412e){if(_0x4e412e){_0x478d4d=_0x4e412e[_0x2c81('0x44')];if(!_0x1ff427[_0x2c81('0x3e')]['hasOwnProperty']('nolimit')){_0x31a7c1[_0x2c81('0x25')]=qs[_0x2c81('0x25')](_0x1ff427[_0x2c81('0x3e')][_0x2c81('0x25')]);_0x31a7c1[_0x2c81('0x23')]=qs[_0x2c81('0x23')](_0x1ff427[_0x2c81('0x3e')][_0x2c81('0x23')]);}return _0x1a1a48[_0x2c81('0x9b')](_0x31a7c1);}})[_0x2c81('0x29')](function(_0x1972aa){return _0x1972aa?{'count':_0x478d4d,'rows':_0x1972aa}:null;})['then'](respondWithResult(_0x1071ac,null))[_0x2c81('0x51')](handleError(_0x1071ac,null));};exports[_0x2c81('0x9c')]=function(_0x4bc8ce,_0x37b786,_0x2c6386){var _0x4665a3={};var _0x1da154={};var _0x5b87e7;var _0x1119f5;return db['VoiceQueue'][_0x2c81('0x66')]({'where':{'id':_0x4bc8ce[_0x2c81('0x53')]['id']}})['then'](handleEntityNotFound(_0x37b786,null))['then'](function(_0x589db3){if(_0x589db3){_0x5b87e7=_0x589db3;_0x1da154[_0x2c81('0x3d')]=_[_0x2c81('0x3f')](db['CmList'][_0x2c81('0x3a')]);_0x1da154[_0x2c81('0x3e')]=_[_0x2c81('0x3f')](_0x4bc8ce['query']);_0x1da154[_0x2c81('0x40')]=_[_0x2c81('0x41')](_0x1da154[_0x2c81('0x3d')],_0x1da154[_0x2c81('0x3e')]);_0x4665a3['attributes']=_[_0x2c81('0x41')](_0x1da154['model'],qs['fields'](_0x4bc8ce[_0x2c81('0x3e')]['fields']));_0x4665a3[_0x2c81('0x42')]=_0x4665a3[_0x2c81('0x42')][_0x2c81('0x44')]?_0x4665a3['attributes']:_0x1da154[_0x2c81('0x3d')];_0x4665a3[_0x2c81('0x63')]=qs['sort'](_0x4bc8ce[_0x2c81('0x3e')][_0x2c81('0x47')]);_0x4665a3[_0x2c81('0x48')]=qs[_0x2c81('0x40')](_[_0x2c81('0x49')](_0x4bc8ce['query'],_0x1da154['filters']));if(_0x4bc8ce[_0x2c81('0x3e')][_0x2c81('0x4a')]){_0x4665a3[_0x2c81('0x48')]=_[_0x2c81('0x4b')](_0x4665a3[_0x2c81('0x48')],{'$or':_[_0x2c81('0x38')](_0x4665a3[_0x2c81('0x42')],function(_0x360d28){var _0x3bd880={};_0x3bd880[_0x360d28]={'$like':'%'+_0x4bc8ce[_0x2c81('0x3e')][_0x2c81('0x4a')]+'%'};return _0x3bd880;})});}_0x4665a3=_[_0x2c81('0x4b')]({},_0x4665a3,_0x4bc8ce[_0x2c81('0x4d')]);return _0x5b87e7[_0x2c81('0x9c')](_0x4665a3);}})[_0x2c81('0x29')](function(_0x6e05cb){if(_0x6e05cb){_0x1119f5=_0x6e05cb['length'];if(!_0x4bc8ce[_0x2c81('0x3e')][_0x2c81('0x45')](_0x2c81('0x46'))){_0x4665a3[_0x2c81('0x25')]=qs[_0x2c81('0x25')](_0x4bc8ce['query'][_0x2c81('0x25')]);_0x4665a3[_0x2c81('0x23')]=qs[_0x2c81('0x23')](_0x4bc8ce[_0x2c81('0x3e')]['offset']);}return _0x5b87e7[_0x2c81('0x9c')](_0x4665a3);}})[_0x2c81('0x29')](function(_0x5b0303){if(_0x5b0303){return _0x5b0303?{'count':_0x1119f5,'rows':_0x5b0303}:null;}})['then'](respondWithResult(_0x37b786,null))[_0x2c81('0x51')](handleError(_0x37b786,null));};exports[_0x2c81('0x9d')]=function(_0x383810,_0x267207,_0x27be96){var _0x53a856,_0x532d4e;return db['VoiceQueue'][_0x2c81('0x32')]({'where':{'id':_0x383810['params']['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x267207,null))[_0x2c81('0x29')](function(_0x2d6711){if(_0x2d6711){_0x532d4e=_0x2d6711;return _0x2d6711[_0x2c81('0x9d')](_0x383810[_0x2c81('0x55')]['ids'],_[_0x2c81('0x59')](_0x383810[_0x2c81('0x55')],[_0x2c81('0x90'),'id'])||{});}return null;})['spread'](function(_0x18d1d3){var _0x5246e7;_0x53a856=_0x18d1d3||[];var _0x32a501=[];if(_0x18d1d3){for(var _0x73a44c=0x0;_0x73a44c<_0x18d1d3[_0x2c81('0x44')];_0x73a44c+=0x1){var _0x626341=_0x18d1d3[_0x73a44c]['get']({'plain':!![]});_0x532d4e[_0x2c81('0x9e')]=_0x383810['body'][_0x2c81('0x9e')]?_0x383810[_0x2c81('0x55')][_0x2c81('0x9e')]:_0x532d4e[_0x2c81('0x9e')];switch(_0x532d4e[_0x2c81('0x9e')]){case _0x2c81('0x9f'):_0x5246e7=squel['insert']()[_0x2c81('0xa0')](_0x2c81('0xa1'))['fromQuery'](['phone',_0x2c81('0xa2'),'ContactId',_0x2c81('0xa3'),_0x2c81('0x64'),'createdAt','updatedAt'],squel[_0x2c81('0x80')]()['field'](_0x2c81('0xa4'),_0x2c81('0xa4'))[_0x2c81('0x81')](_0x2c81('0xa5'),'scheduledAt')['field']('id','ContactId')[_0x2c81('0x81')](_0x626341[_0x2c81('0xa6')][_0x2c81('0x88')](),'ListId')['field'](_0x383810[_0x2c81('0x53')]['id']['toString'](),_0x2c81('0x64'))[_0x2c81('0x81')](_0x2c81('0xa5'),_0x2c81('0x5a'))[_0x2c81('0x81')](_0x2c81('0xa5'),_0x2c81('0x5b'))['from']('cm_contacts')['where'](_0x2c81('0xa7'))[_0x2c81('0x48')]('ListId\x20=\x20?',_0x626341['CmListId'][_0x2c81('0x88')]())['where'](_0x2c81('0xa8'))[_0x2c81('0x48')](_0x2c81('0xa9'),squel['select']()[_0x2c81('0x81')](_0x2c81('0xaa'))['from'](_0x2c81('0xab'))[_0x2c81('0x48')](_0x2c81('0x86'),_0x383810[_0x2c81('0x53')]['id']['toString']()))[_0x2c81('0x48')](_0x2c81('0xa9'),squel[_0x2c81('0x80')]()[_0x2c81('0x81')](_0x2c81('0xac'))[_0x2c81('0x83')](_0x2c81('0xa1'))[_0x2c81('0x48')]('VoiceQueueId\x20=\x20?',_0x383810[_0x2c81('0x53')]['id']['toString']())))[_0x2c81('0x88')]();break;case _0x2c81('0xad'):_0x5246e7=squel[_0x2c81('0xae')]()['into'](_0x2c81('0xa1'))['fromQuery']([_0x2c81('0xa4'),_0x2c81('0xa2'),_0x2c81('0xaf'),_0x2c81('0xa3'),_0x2c81('0x64'),_0x2c81('0x5a'),_0x2c81('0x5b')],squel['select']()[_0x2c81('0x81')](_0x2c81('0xa4'),_0x2c81('0xa4'))['field']('NOW()','scheduledAt')[_0x2c81('0x81')]('id',_0x2c81('0xaf'))[_0x2c81('0x81')](_0x626341[_0x2c81('0xa6')]['toString'](),_0x2c81('0xa3'))['field'](_0x383810[_0x2c81('0x53')]['id'][_0x2c81('0x88')](),_0x2c81('0x64'))['field'](_0x2c81('0xa5'),_0x2c81('0x5a'))[_0x2c81('0x81')]('NOW()',_0x2c81('0x5b'))[_0x2c81('0x83')](_0x2c81('0xb0'))[_0x2c81('0x48')](_0x2c81('0xa7'))[_0x2c81('0x48')](_0x2c81('0xb1'),_0x626341[_0x2c81('0xa6')][_0x2c81('0x88')]())[_0x2c81('0x48')](_0x2c81('0xa8'))[_0x2c81('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2c81('0x80')]()[_0x2c81('0x81')](_0x2c81('0xac'))[_0x2c81('0x83')](_0x2c81('0xa1'))['where'](_0x2c81('0x86'),_0x383810[_0x2c81('0x53')]['id']['toString']())))[_0x2c81('0x88')]();break;default:_0x5246e7=squel[_0x2c81('0xae')]()[_0x2c81('0xa0')](_0x2c81('0xa1'))[_0x2c81('0xb2')](['phone',_0x2c81('0xa2'),'ContactId',_0x2c81('0xa3'),_0x2c81('0x64'),_0x2c81('0x5a'),_0x2c81('0x5b')],squel[_0x2c81('0x80')]()[_0x2c81('0x81')]('phone',_0x2c81('0xa4'))['field'](_0x2c81('0xa5'),_0x2c81('0xa2'))[_0x2c81('0x81')]('id',_0x2c81('0xaf'))[_0x2c81('0x81')](_0x626341[_0x2c81('0xa6')]['toString'](),'ListId')[_0x2c81('0x81')](_0x383810[_0x2c81('0x53')]['id'][_0x2c81('0x88')](),_0x2c81('0x64'))[_0x2c81('0x81')](_0x2c81('0xa5'),_0x2c81('0x5a'))[_0x2c81('0x81')]('NOW()',_0x2c81('0x5b'))['from'](_0x2c81('0xb0'))['where'](_0x2c81('0xa7'))[_0x2c81('0x48')](_0x2c81('0xb1'),_0x626341[_0x2c81('0xa6')][_0x2c81('0x88')]())[_0x2c81('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x2c81('0x88')]();}_0x32a501[_0x2c81('0x98')](db[_0x2c81('0x76')][_0x2c81('0x3e')](_0x5246e7));}return BPromise['all'](_0x32a501);}})['then'](function(){return _0x53a856;})[_0x2c81('0x29')](respondWithResult(_0x267207,null))[_0x2c81('0x51')](handleError(_0x267207,null));};exports[_0x2c81('0xb3')]=function(_0xfb80f0,_0x2a52be,_0x273ca2){return db['VoiceQueue'][_0x2c81('0x32')]({'where':{'id':_0xfb80f0[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x2a52be,null))[_0x2c81('0x29')](function(_0xe65a34){if(_0xe65a34){return _0xe65a34['removeLists'](_0xfb80f0[_0x2c81('0x3e')][_0x2c81('0x90')]);}})[_0x2c81('0x29')](function(_0x275db9){if(_0x275db9){return db[_0x2c81('0x62')][_0x2c81('0x2a')]({'where':{'ListId':_0xfb80f0[_0x2c81('0x3e')][_0x2c81('0x90')],'VoiceQueueId':_0xfb80f0['params']['id']}})[_0x2c81('0x29')](function(){return _0x275db9;});}})[_0x2c81('0x29')](respondWithStatusCode(_0x2a52be,null))[_0x2c81('0x51')](handleError(_0x2a52be,null));};exports[_0x2c81('0xb4')]=function(_0x1d541f,_0x3ed9c7,_0x208fa6){var _0x4bb2e0={};var _0x3fb9a2={};var _0x15fe9b;var _0x41b8df;return db[_0x2c81('0x39')][_0x2c81('0x66')]({'where':{'id':_0x1d541f['params']['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x3ed9c7,null))['then'](function(_0x42b089){if(_0x42b089){_0x15fe9b=_0x42b089;_0x3fb9a2[_0x2c81('0x3d')]=_[_0x2c81('0x3f')](db['CmList'][_0x2c81('0x3a')]);_0x3fb9a2['query']=_[_0x2c81('0x3f')](_0x1d541f[_0x2c81('0x3e')]);_0x3fb9a2[_0x2c81('0x40')]=_[_0x2c81('0x41')](_0x3fb9a2[_0x2c81('0x3d')],_0x3fb9a2[_0x2c81('0x3e')]);_0x4bb2e0[_0x2c81('0x42')]=_[_0x2c81('0x41')](_0x3fb9a2[_0x2c81('0x3d')],qs[_0x2c81('0x43')](_0x1d541f[_0x2c81('0x3e')][_0x2c81('0x43')]));_0x4bb2e0['attributes']=_0x4bb2e0['attributes'][_0x2c81('0x44')]?_0x4bb2e0[_0x2c81('0x42')]:_0x3fb9a2[_0x2c81('0x3d')];_0x4bb2e0['order']=qs[_0x2c81('0x47')](_0x1d541f[_0x2c81('0x3e')]['sort']);_0x4bb2e0[_0x2c81('0x48')]=qs['filters'](_[_0x2c81('0x49')](_0x1d541f[_0x2c81('0x3e')],_0x3fb9a2[_0x2c81('0x40')]));if(_0x1d541f[_0x2c81('0x3e')][_0x2c81('0x4a')]){_0x4bb2e0[_0x2c81('0x48')]=_['merge'](_0x4bb2e0[_0x2c81('0x48')],{'$or':_['map'](_0x4bb2e0[_0x2c81('0x42')],function(_0x2b8a2c){var _0x3f00e8={};_0x3f00e8[_0x2b8a2c]={'$like':'%'+_0x1d541f['query'][_0x2c81('0x4a')]+'%'};return _0x3f00e8;})});}_0x4bb2e0=_[_0x2c81('0x4b')]({},_0x4bb2e0,_0x1d541f[_0x2c81('0x4d')]);return _0x15fe9b[_0x2c81('0xb4')](_0x4bb2e0);}})[_0x2c81('0x29')](function(_0x51c354){if(_0x51c354){_0x41b8df=_0x51c354['length'];if(!_0x1d541f['query'][_0x2c81('0x45')](_0x2c81('0x46'))){_0x4bb2e0[_0x2c81('0x25')]=qs[_0x2c81('0x25')](_0x1d541f['query'][_0x2c81('0x25')]);_0x4bb2e0[_0x2c81('0x23')]=qs[_0x2c81('0x23')](_0x1d541f[_0x2c81('0x3e')][_0x2c81('0x23')]);}return _0x15fe9b[_0x2c81('0xb4')](_0x4bb2e0);}})['then'](function(_0x489648){if(_0x489648){return _0x489648?{'count':_0x41b8df,'rows':_0x489648}:null;}})[_0x2c81('0x29')](respondWithResult(_0x3ed9c7,null))[_0x2c81('0x51')](handleError(_0x3ed9c7,null));};exports[_0x2c81('0xb5')]=function(_0xf9b1cb,_0x47e8b1,_0x46de98){var _0x5282fb,_0x1ef2ac;return db[_0x2c81('0x39')][_0x2c81('0x32')]({'where':{'id':_0xf9b1cb['params']['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x47e8b1,null))[_0x2c81('0x29')](function(_0xc0a75a){if(_0xc0a75a){_0x1ef2ac=_0xc0a75a;return _0xc0a75a[_0x2c81('0xb5')](_0xf9b1cb[_0x2c81('0x55')][_0x2c81('0x90')],_['omit'](_0xf9b1cb[_0x2c81('0x55')],[_0x2c81('0x90'),'id'])||{});}return null;})['spread'](function(_0xd504d){var _0x4781ec;_0x5282fb=_0xd504d||[];var _0x27166b=[];if(_0xd504d){for(var _0x1ccf28=0x0;_0x1ccf28<_0xd504d['length'];_0x1ccf28+=0x1){var _0x433d22=_0xd504d[_0x1ccf28][_0x2c81('0x2b')]({'plain':!![]});_0x4781ec=squel['insert']()[_0x2c81('0xa0')](_0x2c81('0xb6'))[_0x2c81('0xb2')]([_0x2c81('0xa4'),'ContactId',_0x2c81('0xa3'),_0x2c81('0x64'),_0x2c81('0x5a'),_0x2c81('0x5b')],squel[_0x2c81('0x80')]()[_0x2c81('0x81')](_0x2c81('0xa4'),'phone')[_0x2c81('0x81')]('id',_0x2c81('0xaf'))[_0x2c81('0x81')](_0x433d22['CmListId']['toString'](),_0x2c81('0xa3'))[_0x2c81('0x81')](_0xf9b1cb[_0x2c81('0x53')]['id'][_0x2c81('0x88')](),_0x2c81('0x64'))[_0x2c81('0x81')](_0x2c81('0xa5'),'createdAt')[_0x2c81('0x81')]('NOW()',_0x2c81('0x5b'))['from'](_0x2c81('0xb0'))[_0x2c81('0x48')](_0x2c81('0xa7'))[_0x2c81('0x48')]('ListId\x20=\x20?',_0x433d22[_0x2c81('0xa6')][_0x2c81('0x88')]())[_0x2c81('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x2c81('0x88')]();_0x27166b['push'](db[_0x2c81('0x76')][_0x2c81('0x3e')](_0x4781ec));}return BPromise[_0x2c81('0x8d')](_0x27166b);}})[_0x2c81('0x29')](function(){return _0x5282fb;})['then'](respondWithResult(_0x47e8b1,null))[_0x2c81('0x51')](handleError(_0x47e8b1,null));};exports[_0x2c81('0xb7')]=function(_0x1aed7f,_0x3efa8d,_0xd0f0e7){return db[_0x2c81('0x39')][_0x2c81('0x32')]({'where':{'id':_0x1aed7f[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](handleEntityNotFound(_0x3efa8d,null))[_0x2c81('0x29')](function(_0x972c6d){if(_0x972c6d){return _0x972c6d[_0x2c81('0xb7')](_0x1aed7f[_0x2c81('0x3e')][_0x2c81('0x90')]);}})[_0x2c81('0x29')](function(_0x2e559d){if(_0x2e559d){return db[_0x2c81('0x6a')]['destroy']({'where':{'ListId':_0x1aed7f[_0x2c81('0x3e')][_0x2c81('0x90')],'VoiceQueueId':_0x1aed7f[_0x2c81('0x53')]['id']}})[_0x2c81('0x29')](function(){return _0x2e559d;});}})[_0x2c81('0x29')](respondWithStatusCode(_0x3efa8d,null))[_0x2c81('0x51')](handleError(_0x3efa8d,null));}; \ No newline at end of file +var _0x1819=['pick','merge','VIRTUAL','options','include','VoiceQueue','findAll','rows','catch','show','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','clone','params','omit','updatedAt','createdAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','emit','removeTeams','ids','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','sequelize','SELECT','every','TeamId','all','compact','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isEmpty','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','toString','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','scheduledAt','removeLists','getBlackLists','addBlackLists','deletedAt\x20IS\x20NULL','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','send','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1890ae,_0x33ad7f){var _0x20e537=function(_0x478fec){while(--_0x478fec){_0x1890ae['push'](_0x1890ae['shift']());}};_0x20e537(++_0x33ad7f);}(_0x1819,0x12a));var _0x9181=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x1819[_0x3b87f4];return _0x63d16e;};'use strict';var emlformat=require(_0x9181('0x0'));var rimraf=require(_0x9181('0x1'));var zipdir=require(_0x9181('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9181('0x3'));var moment=require(_0x9181('0x4'));var BPromise=require(_0x9181('0x5'));var Mustache=require(_0x9181('0x6'));var util=require(_0x9181('0x7'));var path=require(_0x9181('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9181('0x9'));var fs=require('fs');var fs_extra=require(_0x9181('0xa'));var _=require(_0x9181('0xb'));var squel=require(_0x9181('0xc'));var crypto=require('crypto');var jsforce=require(_0x9181('0xd'));var deskjs=require(_0x9181('0xe'));var toCsv=require(_0x9181('0xf'));var querystring=require(_0x9181('0x10'));var Papa=require(_0x9181('0x11'));var Redis=require('ioredis');var authService=require(_0x9181('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9181('0x13'));var logger=require('../../config/logger')(_0x9181('0x14'));var utils=require(_0x9181('0x15'));var config=require(_0x9181('0x16'));var licenseUtil=require(_0x9181('0x17'));var db=require(_0x9181('0x18'))['db'];config[_0x9181('0x19')]=_['defaults'](config[_0x9181('0x19')],{'host':_0x9181('0x1a'),'port':0x18eb});var socket=require(_0x9181('0x1b'))(new Redis(config[_0x9181('0x19')]));require('./voiceQueue.socket')[_0x9181('0x1c')](socket);function respondWithStatusCode(_0xa6946,_0x558c8d){_0x558c8d=_0x558c8d||0xcc;return function(_0x4a560e){if(_0x4a560e){return _0xa6946['sendStatus'](_0x558c8d);}return _0xa6946[_0x9181('0x1d')](_0x558c8d)[_0x9181('0x1e')]();};}function respondWithResult(_0x1190ee,_0x319095){_0x319095=_0x319095||0xc8;return function(_0x407130){if(_0x407130){return _0x1190ee[_0x9181('0x1d')](_0x319095)[_0x9181('0x1f')](_0x407130);}};}function respondWithFilteredResult(_0xa2fe87,_0x209dbb){return function(_0x54e2ee){if(_0x54e2ee){var _0x13ae36=typeof _0x209dbb[_0x9181('0x20')]==='undefined'&&typeof _0x209dbb[_0x9181('0x21')]===_0x9181('0x22');var _0x1daba8=_0x54e2ee['count'];var _0x1b9810=_0x13ae36?0x0:_0x209dbb['offset'];var _0x38fcc1=_0x13ae36?_0x54e2ee[_0x9181('0x23')]:_0x209dbb[_0x9181('0x20')]+_0x209dbb[_0x9181('0x21')];var _0x336fb9;if(_0x38fcc1>=_0x1daba8){_0x38fcc1=_0x1daba8;_0x336fb9=0xc8;}else{_0x336fb9=0xce;}_0xa2fe87[_0x9181('0x1d')](_0x336fb9);return _0xa2fe87[_0x9181('0x24')](_0x9181('0x25'),_0x1b9810+'-'+_0x38fcc1+'/'+_0x1daba8)[_0x9181('0x1f')](_0x54e2ee);}return null;};}function patchUpdates(_0x3d323d){return function(_0x256f67){try{jsonpatch[_0x9181('0x26')](_0x256f67,_0x3d323d,!![]);}catch(_0xa440c7){return BPromise['reject'](_0xa440c7);}return _0x256f67[_0x9181('0x27')]();};}function saveUpdates(_0x41df9b,_0x1dd5e6){return function(_0x13662b){if(_0x13662b){return _0x13662b[_0x9181('0x28')](_0x41df9b)[_0x9181('0x29')](function(_0x29b600){return _0x29b600;});}return null;};}function removeEntity(_0x12e13a,_0x2e13d7){return function(_0x11b33b){if(_0x11b33b){return _0x11b33b[_0x9181('0x2a')]()[_0x9181('0x29')](function(){var _0xea1f2c=_0x11b33b[_0x9181('0x2b')]({'plain':!![]});var _0x45e252=[{'name':_0x9181('0x2c'),'value':_0x9181('0x2d'),'ignore':![]},{'name':_0x9181('0x2e'),'value':_0x9181('0x2f'),'ignore':![]}];var _0x5444e3=_(_0x45e252)[_0x9181('0x30')](_0x9181('0x31'))['map'](_0x9181('0x32'))['value']();if(_[_0x9181('0x33')](_0x5444e3,_0xea1f2c[_0x9181('0x34')])){return;}var _0x140ee2=_[_0x9181('0x35')](_0x45e252,[_0x9181('0x32'),_0xea1f2c[_0x9181('0x34')]])[_0x9181('0x36')];return db[_0x9181('0x37')]['destroy']({'where':{'type':_0x140ee2,'resourceId':_0xea1f2c['id']}})[_0x9181('0x29')](function(){return _0x11b33b;});})[_0x9181('0x29')](function(){_0x12e13a[_0x9181('0x1d')](0xcc)[_0x9181('0x1e')]();});}};}function handleEntityNotFound(_0x3569b5,_0x325da3){return function(_0x17d979){if(!_0x17d979){_0x3569b5[_0x9181('0x38')](0x194);}return _0x17d979;};}function handleError(_0x523189,_0x88b404){_0x88b404=_0x88b404||0x1f4;return function(_0x55aac8){logger[_0x9181('0x39')](_0x55aac8[_0x9181('0x3a')]);if(_0x55aac8['name']){delete _0x55aac8[_0x9181('0x36')];}_0x523189['status'](_0x88b404)[_0x9181('0x3b')](_0x55aac8);};}exports['index']=function(_0x34d81d,_0x3cb28f){var _0x4a5faa={},_0x2d6d28={},_0x1e935e={'count':0x0,'rows':[]};var _0x50e8e2=_[_0x9181('0x3c')](db['VoiceQueue'][_0x9181('0x3d')],function(_0xe06cc0){return{'name':_0xe06cc0[_0x9181('0x3e')],'type':_0xe06cc0[_0x9181('0x34')][_0x9181('0x3f')]};});_0x2d6d28[_0x9181('0x40')]=_['map'](_0x50e8e2,_0x9181('0x36'));_0x2d6d28['query']=_[_0x9181('0x41')](_0x34d81d['query']);_0x2d6d28[_0x9181('0x42')]=_[_0x9181('0x43')](_0x2d6d28[_0x9181('0x40')],_0x2d6d28[_0x9181('0x44')]);_0x4a5faa[_0x9181('0x45')]=_['intersection'](_0x2d6d28[_0x9181('0x40')],qs[_0x9181('0x46')](_0x34d81d[_0x9181('0x44')][_0x9181('0x46')]));_0x4a5faa['attributes']=_0x4a5faa['attributes']['length']?_0x4a5faa[_0x9181('0x45')]:_0x2d6d28[_0x9181('0x40')];if(!_0x34d81d[_0x9181('0x44')][_0x9181('0x47')](_0x9181('0x48'))){_0x4a5faa[_0x9181('0x21')]=qs['limit'](_0x34d81d[_0x9181('0x44')][_0x9181('0x21')]);_0x4a5faa['offset']=qs[_0x9181('0x20')](_0x34d81d[_0x9181('0x44')][_0x9181('0x20')]);}_0x4a5faa[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x34d81d['query'][_0x9181('0x4a')]);_0x4a5faa[_0x9181('0x4b')]=qs[_0x9181('0x42')](_[_0x9181('0x4c')](_0x34d81d[_0x9181('0x44')],_0x2d6d28[_0x9181('0x42')]),_0x50e8e2);if(_0x34d81d['query'][_0x9181('0x30')]){_0x4a5faa[_0x9181('0x4b')]=_[_0x9181('0x4d')](_0x4a5faa[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x50e8e2,function(_0x4ecca2){if(_0x4ecca2[_0x9181('0x34')]!==_0x9181('0x4e')){var _0xd03675={};_0xd03675[_0x4ecca2[_0x9181('0x36')]]={'$like':'%'+_0x34d81d['query']['filter']+'%'};return _0xd03675;}})});}_0x4a5faa=_['merge']({},_0x4a5faa,_0x34d81d[_0x9181('0x4f')]);var _0x32c4f5={'where':_0x4a5faa[_0x9181('0x4b')]};return db['VoiceQueue'][_0x9181('0x23')](_0x32c4f5)[_0x9181('0x29')](function(_0xbbfe4e){_0x1e935e[_0x9181('0x23')]=_0xbbfe4e;if(_0x34d81d[_0x9181('0x44')]['includeAll']){_0x4a5faa[_0x9181('0x50')]=[{'all':!![]}];}return db[_0x9181('0x51')][_0x9181('0x52')](_0x4a5faa);})['then'](function(_0x11e144){_0x1e935e[_0x9181('0x53')]=_0x11e144;return _0x1e935e;})[_0x9181('0x29')](respondWithFilteredResult(_0x3cb28f,_0x4a5faa))[_0x9181('0x54')](handleError(_0x3cb28f,null));};exports[_0x9181('0x55')]=function(_0x243f9b,_0x3980af){var _0x573d7f={'raw':![],'where':{'id':_0x243f9b['params']['id']}},_0x4f2cf3={};_0x4f2cf3[_0x9181('0x40')]=_[_0x9181('0x41')](db[_0x9181('0x51')][_0x9181('0x3d')]);_0x4f2cf3[_0x9181('0x44')]=_[_0x9181('0x41')](_0x243f9b[_0x9181('0x44')]);_0x4f2cf3[_0x9181('0x42')]=_[_0x9181('0x43')](_0x4f2cf3[_0x9181('0x40')],_0x4f2cf3[_0x9181('0x44')]);_0x573d7f[_0x9181('0x45')]=_[_0x9181('0x43')](_0x4f2cf3[_0x9181('0x40')],qs[_0x9181('0x46')](_0x243f9b[_0x9181('0x44')]['fields']));_0x573d7f[_0x9181('0x45')]=_0x573d7f[_0x9181('0x45')][_0x9181('0x56')]?_0x573d7f[_0x9181('0x45')]:_0x4f2cf3[_0x9181('0x40')];if(_0x243f9b['query'][_0x9181('0x57')]){_0x573d7f[_0x9181('0x50')]=[{'all':!![]}];}_0x573d7f=_[_0x9181('0x4d')]({},_0x573d7f,_0x243f9b[_0x9181('0x4f')]);return db[_0x9181('0x51')]['find'](_0x573d7f)[_0x9181('0x29')](handleEntityNotFound(_0x3980af,null))[_0x9181('0x29')](respondWithResult(_0x3980af,null))[_0x9181('0x54')](handleError(_0x3980af,null));};exports[_0x9181('0x58')]=function(_0x3ca8d3,_0x4bc537){return db[_0x9181('0x51')][_0x9181('0x58')](_0x3ca8d3[_0x9181('0x59')],{})[_0x9181('0x29')](function(_0x368c16){var _0x1a2a41=_0x3ca8d3['user'][_0x9181('0x2b')]({'plain':!![]});if(!_0x1a2a41)throw new Error(_0x9181('0x5a'));if(_0x1a2a41[_0x9181('0x5b')]===_0x9181('0x5c')){var _0x2f3a06=_0x368c16[_0x9181('0x2b')]({'plain':!![]});var _0x3331ae=[{'name':'VoiceQueues','value':_0x9181('0x2d')},{'name':_0x9181('0x2e'),'value':_0x9181('0x2f')}];var _0x4a13e4=_['find'](_0x3331ae,['value',_0x2f3a06[_0x9181('0x34')]])['name'];return db[_0x9181('0x5d')][_0x9181('0x35')]({'where':{'name':_0x4a13e4,'userProfileId':_0x1a2a41['userProfileId']},'raw':!![]})['then'](function(_0x541024){if(_0x541024&&_0x541024[_0x9181('0x5e')]===0x0){return db[_0x9181('0x37')][_0x9181('0x58')]({'name':_0x2f3a06[_0x9181('0x36')],'resourceId':_0x2f3a06['id'],'type':_0x541024[_0x9181('0x36')],'sectionId':_0x541024['id']},{})[_0x9181('0x29')](function(){return _0x368c16;});}else{return _0x368c16;}})['catch'](function(_0x470a5e){logger[_0x9181('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x470a5e);throw _0x470a5e;});}return _0x368c16;})[_0x9181('0x29')](respondWithResult(_0x4bc537,0xc9))['catch'](handleError(_0x4bc537,null));};exports[_0x9181('0x5f')]=function(_0x5002c6,_0x1b2efb){var _0x53ffe1={'where':{'id':_0x5002c6[_0x9181('0x60')]['id']}},_0x3553dd={};_0x3553dd['model']=_['keys'](db[_0x9181('0x51')][_0x9181('0x3d')]);_0x53ffe1['attributes']=_[_0x9181('0x43')](_0x3553dd[_0x9181('0x40')],qs[_0x9181('0x46')](_0x5002c6['query'][_0x9181('0x46')]));_0x53ffe1['attributes']=_0x53ffe1[_0x9181('0x45')]['length']?_0x53ffe1[_0x9181('0x45')]:_0x3553dd['model'];if(_0x5002c6[_0x9181('0x44')][_0x9181('0x57')]){_0x53ffe1['include']=[{'all':!![]}];}_0x53ffe1=_[_0x9181('0x4d')]({},_0x53ffe1,_0x5002c6[_0x9181('0x4f')]);return db[_0x9181('0x51')]['find'](_0x53ffe1)[_0x9181('0x29')](handleEntityNotFound(_0x1b2efb,null))[_0x9181('0x29')](function(_0x3300be){if(_0x3300be){var _0x2ba9f0=_0x3300be[_0x9181('0x2b')]({'plain':!![]});_0x2ba9f0=qs[_0x9181('0x61')](_0x2ba9f0,['id','createdAt',_0x9181('0x62')]);_0x5002c6['body']=_['omit'](_0x5002c6[_0x9181('0x59')],['id',_0x9181('0x63'),_0x9181('0x62')]);return db['VoiceQueue']['create'](_['merge'](_0x2ba9f0,_0x5002c6[_0x9181('0x59')]),{'include':_0x5002c6['query'][_0x9181('0x57')]?[{'all':!![]}]:undefined})[_0x9181('0x29')](function(_0x39fe82){var _0x1c8ceb=_0x5002c6[_0x9181('0x5c')]['get']({'plain':!![]});if(!_0x1c8ceb)throw new Error(_0x9181('0x5a'));if(_0x1c8ceb[_0x9181('0x5b')]==='user'){var _0x4bc536=_0x39fe82['get']({'plain':!![]});var _0x521363=[{'name':_0x9181('0x2c'),'value':'inbound'},{'name':_0x9181('0x2e'),'value':_0x9181('0x2f')}];var _0x480b47=_['find'](_0x521363,[_0x9181('0x32'),_0x4bc536[_0x9181('0x34')]])[_0x9181('0x36')];return db['UserProfileSection'][_0x9181('0x35')]({'where':{'name':_0x480b47,'userProfileId':_0x1c8ceb[_0x9181('0x64')]},'raw':!![]})['then'](function(_0x5baac4){if(_0x5baac4&&_0x5baac4['autoAssociation']===0x0){return db['UserProfileResource'][_0x9181('0x58')]({'name':_0x4bc536['name'],'resourceId':_0x4bc536['id'],'type':_0x5baac4[_0x9181('0x36')],'sectionId':_0x5baac4['id']},{})[_0x9181('0x29')](function(){return _0x39fe82;});}else{return _0x39fe82;}})[_0x9181('0x54')](function(_0x648101){logger[_0x9181('0x39')](_0x9181('0x65'),_0x648101);throw _0x648101;});}return _0x39fe82;});}})[_0x9181('0x29')](respondWithResult(_0x1b2efb,0xc9))['catch'](handleError(_0x1b2efb,null));};exports[_0x9181('0x28')]=function(_0x449c93,_0x5ddfe3){if(_0x449c93['body']['id']){delete _0x449c93[_0x9181('0x59')]['id'];}return db[_0x9181('0x51')][_0x9181('0x35')]({'where':{'id':_0x449c93[_0x9181('0x60')]['id']}})['then'](handleEntityNotFound(_0x5ddfe3,null))[_0x9181('0x29')](saveUpdates(_0x449c93[_0x9181('0x59')],null))[_0x9181('0x29')](respondWithResult(_0x5ddfe3,null))[_0x9181('0x54')](handleError(_0x5ddfe3,null));};exports[_0x9181('0x2a')]=function(_0x5d2081,_0x33efb6){return db['VoiceQueue'][_0x9181('0x35')]({'where':{'id':_0x5d2081[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x33efb6,null))['then'](removeEntity(_0x33efb6,null))['catch'](handleError(_0x33efb6,null));};exports[_0x9181('0x66')]=function(_0x40973a,_0x15c8a8,_0x2afec1){var _0x134d9a={'raw':![],'where':{}};var _0x56b805={};var _0x27f644={'count':0x0,'rows':[]};return db[_0x9181('0x51')][_0x9181('0x67')]({'where':{'id':_0x40973a[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x15c8a8,null))['then'](function(_0x5d1e82){if(_0x5d1e82){_0x56b805['model']=_[_0x9181('0x41')](db[_0x9181('0x68')]['rawAttributes']);_0x56b805[_0x9181('0x44')]=_['keys'](_0x40973a[_0x9181('0x44')]);_0x56b805[_0x9181('0x42')]=_[_0x9181('0x43')](_0x56b805[_0x9181('0x40')],_0x56b805[_0x9181('0x44')]);_0x134d9a[_0x9181('0x45')]=_['intersection'](_0x56b805[_0x9181('0x40')],qs['fields'](_0x40973a[_0x9181('0x44')][_0x9181('0x46')]));_0x134d9a['attributes']=_0x134d9a[_0x9181('0x45')]['length']?_0x134d9a[_0x9181('0x45')]:_0x56b805[_0x9181('0x40')];if(!_0x40973a[_0x9181('0x44')][_0x9181('0x47')](_0x9181('0x48'))){_0x134d9a[_0x9181('0x21')]=qs['limit'](_0x40973a[_0x9181('0x44')]['limit']);_0x134d9a[_0x9181('0x20')]=qs[_0x9181('0x20')](_0x40973a[_0x9181('0x44')][_0x9181('0x20')]);}_0x134d9a[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x40973a['query'][_0x9181('0x4a')]);_0x134d9a[_0x9181('0x4b')]=qs[_0x9181('0x42')](_['pick'](_0x40973a[_0x9181('0x44')],_0x56b805[_0x9181('0x42')]));_0x134d9a[_0x9181('0x4b')][_0x9181('0x69')]=_0x5d1e82['id'];if(_0x40973a[_0x9181('0x44')][_0x9181('0x30')]){_0x134d9a[_0x9181('0x4b')]=_['merge'](_0x134d9a[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x134d9a['attributes'],function(_0x1d4603){var _0xa38033={};_0xa38033[_0x1d4603]={'$like':'%'+_0x40973a[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0xa38033;})});}_0x134d9a=_[_0x9181('0x4d')]({},_0x134d9a,_0x40973a[_0x9181('0x4f')]);return db[_0x9181('0x68')][_0x9181('0x23')]({'where':_0x134d9a[_0x9181('0x4b')]})[_0x9181('0x29')](function(_0x5ad92a){_0x27f644[_0x9181('0x23')]=_0x5ad92a;if(_0x40973a[_0x9181('0x44')]['includeAll']){_0x134d9a[_0x9181('0x50')]=[{'all':!![]}];}return db[_0x9181('0x68')]['findAll'](_0x134d9a);})['then'](function(_0x40c1d2){_0x27f644[_0x9181('0x53')]=_0x40c1d2;return _0x27f644;});}})['then'](respondWithFilteredResult(_0x15c8a8,_0x134d9a))[_0x9181('0x54')](handleError(_0x15c8a8,null));};exports['getHopperHistories']=function(_0x3f2a16,_0x1529b2,_0x1ec3fc){var _0x45eef8={'raw':!![],'where':{}};var _0x5fa0f1={};var _0x59b7be={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9181('0x67')]({'where':{'id':_0x3f2a16[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x1529b2,null))[_0x9181('0x29')](function(_0x404fb3){if(_0x404fb3){_0x5fa0f1[_0x9181('0x40')]=_[_0x9181('0x41')](db[_0x9181('0x6a')]['rawAttributes']);_0x5fa0f1[_0x9181('0x44')]=_[_0x9181('0x41')](_0x3f2a16['query']);_0x5fa0f1[_0x9181('0x42')]=_['intersection'](_0x5fa0f1[_0x9181('0x40')],_0x5fa0f1['query']);_0x45eef8[_0x9181('0x45')]=_[_0x9181('0x43')](_0x5fa0f1[_0x9181('0x40')],qs[_0x9181('0x46')](_0x3f2a16[_0x9181('0x44')]['fields']));_0x45eef8[_0x9181('0x45')]=_0x45eef8['attributes'][_0x9181('0x56')]?_0x45eef8['attributes']:_0x5fa0f1[_0x9181('0x40')];if(!_0x3f2a16[_0x9181('0x44')]['hasOwnProperty'](_0x9181('0x48'))){_0x45eef8[_0x9181('0x21')]=qs[_0x9181('0x21')](_0x3f2a16[_0x9181('0x44')][_0x9181('0x21')]);_0x45eef8[_0x9181('0x20')]=qs[_0x9181('0x20')](_0x3f2a16[_0x9181('0x44')][_0x9181('0x20')]);}_0x45eef8[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x3f2a16['query']['sort']);_0x45eef8['where']=qs[_0x9181('0x42')](_[_0x9181('0x4c')](_0x3f2a16['query'],_0x5fa0f1[_0x9181('0x42')]));_0x45eef8['where'][_0x9181('0x69')]=_0x404fb3['id'];if(_0x3f2a16[_0x9181('0x44')][_0x9181('0x30')]){_0x45eef8['where']=_[_0x9181('0x4d')](_0x45eef8[_0x9181('0x4b')],{'$or':_['map'](_0x45eef8['attributes'],function(_0x3fca46){var _0x4d18e5={};_0x4d18e5[_0x3fca46]={'$like':'%'+_0x3f2a16['query'][_0x9181('0x30')]+'%'};return _0x4d18e5;})});}_0x45eef8=_['merge']({},_0x45eef8,_0x3f2a16[_0x9181('0x4f')]);return db[_0x9181('0x6a')]['count']({'where':_0x45eef8[_0x9181('0x4b')]})['then'](function(_0x34ac2a){_0x59b7be[_0x9181('0x23')]=_0x34ac2a;if(_0x3f2a16[_0x9181('0x44')][_0x9181('0x57')]){_0x45eef8[_0x9181('0x50')]=[{'all':!![]}];}return db[_0x9181('0x6a')][_0x9181('0x52')](_0x45eef8);})['then'](function(_0x5dda96){_0x59b7be['rows']=_0x5dda96;return _0x59b7be;});}})[_0x9181('0x29')](respondWithFilteredResult(_0x1529b2,_0x45eef8))[_0x9181('0x54')](handleError(_0x1529b2,null));};exports[_0x9181('0x6b')]=function(_0x261ec7,_0x1eab75,_0x1a7fbe){var _0x4e66a8={'raw':!![],'where':{}};var _0x5e58f0={};var _0x388944={'count':0x0,'rows':[]};return db[_0x9181('0x51')][_0x9181('0x67')]({'where':{'id':_0x261ec7[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x1eab75,null))[_0x9181('0x29')](function(_0x197371){if(_0x197371){_0x5e58f0['model']=_[_0x9181('0x41')](db[_0x9181('0x6c')][_0x9181('0x3d')]);_0x5e58f0['query']=_[_0x9181('0x41')](_0x261ec7[_0x9181('0x44')]);_0x5e58f0['filters']=_[_0x9181('0x43')](_0x5e58f0[_0x9181('0x40')],_0x5e58f0[_0x9181('0x44')]);_0x4e66a8['attributes']=_[_0x9181('0x43')](_0x5e58f0[_0x9181('0x40')],qs[_0x9181('0x46')](_0x261ec7['query'][_0x9181('0x46')]));_0x4e66a8[_0x9181('0x45')]=_0x4e66a8[_0x9181('0x45')][_0x9181('0x56')]?_0x4e66a8[_0x9181('0x45')]:_0x5e58f0[_0x9181('0x40')];if(!_0x261ec7['query'][_0x9181('0x47')](_0x9181('0x48'))){_0x4e66a8['limit']=qs[_0x9181('0x21')](_0x261ec7[_0x9181('0x44')][_0x9181('0x21')]);_0x4e66a8['offset']=qs[_0x9181('0x20')](_0x261ec7[_0x9181('0x44')][_0x9181('0x20')]);}_0x4e66a8[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x261ec7[_0x9181('0x44')][_0x9181('0x4a')]);_0x4e66a8[_0x9181('0x4b')]=qs['filters'](_[_0x9181('0x4c')](_0x261ec7['query'],_0x5e58f0[_0x9181('0x42')]));_0x4e66a8[_0x9181('0x4b')]['VoiceQueueId']=_0x197371['id'];if(_0x261ec7[_0x9181('0x44')]['filter']){_0x4e66a8[_0x9181('0x4b')]=_['merge'](_0x4e66a8[_0x9181('0x4b')],{'$or':_['map'](_0x4e66a8['attributes'],function(_0x55a99c){var _0x48f09c={};_0x48f09c[_0x55a99c]={'$like':'%'+_0x261ec7['query']['filter']+'%'};return _0x48f09c;})});}_0x4e66a8=_['merge']({},_0x4e66a8,_0x261ec7[_0x9181('0x4f')]);return db[_0x9181('0x6c')][_0x9181('0x23')]({'where':_0x4e66a8[_0x9181('0x4b')]})[_0x9181('0x29')](function(_0xcd95a4){_0x388944['count']=_0xcd95a4;if(_0x261ec7[_0x9181('0x44')][_0x9181('0x57')]){_0x4e66a8[_0x9181('0x50')]=[{'all':!![]}];}return db[_0x9181('0x6c')][_0x9181('0x52')](_0x4e66a8);})['then'](function(_0x573e12){_0x388944['rows']=_0x573e12;return _0x388944;});}})[_0x9181('0x29')](respondWithFilteredResult(_0x1eab75,_0x4e66a8))[_0x9181('0x54')](handleError(_0x1eab75,null));};exports[_0x9181('0x6d')]=function(_0x32e01c,_0x14e261,_0x24c79b){var _0x1cec71={'raw':!![],'where':{}};var _0x3f000e={};var _0x37e804={'count':0x0,'rows':[]};return db[_0x9181('0x51')][_0x9181('0x67')]({'where':{'id':_0x32e01c[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x14e261,null))[_0x9181('0x29')](function(_0xfea322){if(_0xfea322){_0x3f000e[_0x9181('0x40')]=_[_0x9181('0x41')](db[_0x9181('0x6e')][_0x9181('0x3d')]);_0x3f000e['query']=_[_0x9181('0x41')](_0x32e01c['query']);_0x3f000e['filters']=_[_0x9181('0x43')](_0x3f000e['model'],_0x3f000e['query']);_0x1cec71[_0x9181('0x45')]=_[_0x9181('0x43')](_0x3f000e[_0x9181('0x40')],qs[_0x9181('0x46')](_0x32e01c[_0x9181('0x44')]['fields']));_0x1cec71[_0x9181('0x45')]=_0x1cec71['attributes'][_0x9181('0x56')]?_0x1cec71[_0x9181('0x45')]:_0x3f000e[_0x9181('0x40')];if(!_0x32e01c[_0x9181('0x44')][_0x9181('0x47')](_0x9181('0x48'))){_0x1cec71['limit']=qs[_0x9181('0x21')](_0x32e01c[_0x9181('0x44')][_0x9181('0x21')]);_0x1cec71['offset']=qs[_0x9181('0x20')](_0x32e01c['query'][_0x9181('0x20')]);}_0x1cec71[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x32e01c[_0x9181('0x44')]['sort']);_0x1cec71['where']=qs[_0x9181('0x42')](_[_0x9181('0x4c')](_0x32e01c[_0x9181('0x44')],_0x3f000e[_0x9181('0x42')]));_0x1cec71[_0x9181('0x4b')][_0x9181('0x69')]=_0xfea322['id'];if(_0x32e01c['query'][_0x9181('0x30')]){_0x1cec71[_0x9181('0x4b')]=_[_0x9181('0x4d')](_0x1cec71[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x1cec71[_0x9181('0x45')],function(_0x3e9351){var _0x45b152={};_0x45b152[_0x3e9351]={'$like':'%'+_0x32e01c[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x45b152;})});}_0x1cec71=_[_0x9181('0x4d')]({},_0x1cec71,_0x32e01c[_0x9181('0x4f')]);return db[_0x9181('0x6e')]['count']({'where':_0x1cec71['where']})[_0x9181('0x29')](function(_0x55bfe3){_0x37e804[_0x9181('0x23')]=_0x55bfe3;if(_0x32e01c[_0x9181('0x44')][_0x9181('0x57')]){_0x1cec71[_0x9181('0x50')]=[{'all':!![]}];}return db[_0x9181('0x6e')][_0x9181('0x52')](_0x1cec71);})[_0x9181('0x29')](function(_0x1f0f08){_0x37e804['rows']=_0x1f0f08;return _0x37e804;});}})[_0x9181('0x29')](respondWithFilteredResult(_0x14e261,_0x1cec71))[_0x9181('0x54')](handleError(_0x14e261,null));};exports[_0x9181('0x6f')]=function(_0x275046,_0x512162,_0x27f9d0){var _0x25c181={};var _0x42df8a={};var _0x4c0d11;var _0x15cb36;return db[_0x9181('0x51')][_0x9181('0x67')]({'where':{'id':_0x275046[_0x9181('0x60')]['id']}})['then'](handleEntityNotFound(_0x512162,null))['then'](function(_0x88b881){if(_0x88b881){_0x4c0d11=_0x88b881;_0x42df8a['model']=_[_0x9181('0x41')](db[_0x9181('0x70')][_0x9181('0x3d')]);_0x42df8a[_0x9181('0x44')]=_[_0x9181('0x41')](_0x275046[_0x9181('0x44')]);_0x42df8a[_0x9181('0x42')]=_[_0x9181('0x43')](_0x42df8a['model'],_0x42df8a[_0x9181('0x44')]);_0x25c181[_0x9181('0x45')]=_[_0x9181('0x43')](_0x42df8a['model'],qs[_0x9181('0x46')](_0x275046[_0x9181('0x44')][_0x9181('0x46')]));_0x25c181['attributes']=_0x25c181[_0x9181('0x45')]['length']?_0x25c181[_0x9181('0x45')]:_0x42df8a[_0x9181('0x40')];_0x25c181['order']=qs[_0x9181('0x4a')](_0x275046[_0x9181('0x44')][_0x9181('0x4a')]);_0x25c181[_0x9181('0x4b')]=qs[_0x9181('0x42')](_['pick'](_0x275046[_0x9181('0x44')],_0x42df8a[_0x9181('0x42')]));if(_0x275046['query'][_0x9181('0x30')]){_0x25c181[_0x9181('0x4b')]=_['merge'](_0x25c181[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x25c181[_0x9181('0x45')],function(_0x1e6f60){var _0x157af3={};_0x157af3[_0x1e6f60]={'$like':'%'+_0x275046[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x157af3;})});}_0x25c181=_[_0x9181('0x4d')]({},_0x25c181,_0x275046['options']);return _0x4c0d11[_0x9181('0x6f')](_0x25c181);}})[_0x9181('0x29')](function(_0x34b228){if(_0x34b228){_0x15cb36=_0x34b228[_0x9181('0x56')];if(!_0x275046['query'][_0x9181('0x47')](_0x9181('0x48'))){_0x25c181[_0x9181('0x21')]=qs[_0x9181('0x21')](_0x275046[_0x9181('0x44')][_0x9181('0x21')]);_0x25c181[_0x9181('0x20')]=qs[_0x9181('0x20')](_0x275046[_0x9181('0x44')][_0x9181('0x20')]);}return _0x4c0d11['getTeams'](_0x25c181);}})['then'](function(_0x22c06d){if(_0x22c06d){return _0x22c06d?{'count':_0x15cb36,'rows':_0x22c06d}:null;}})[_0x9181('0x29')](respondWithResult(_0x512162,null))[_0x9181('0x54')](handleError(_0x512162,null));};exports[_0x9181('0x71')]=function(_0x5aef47,_0x1d0e8b,_0x35535e){var _0x12a5d4=_0x5aef47[_0x9181('0x59')][_0x9181('0x72')];var _0x24b6f4=_[_0x9181('0x3c')](_0x12a5d4,'id');return db[_0x9181('0x70')][_0x9181('0x52')]({'where':{'id':_0x24b6f4},'attributes':['id'],'include':[{'model':db[_0x9181('0x73')],'as':'Agents','attributes':['id',_0x9181('0x36'),_0x9181('0x74'),_0x9181('0x75'),_0x9181('0x76')],'raw':!![]}]})[_0x9181('0x29')](function(_0x3415e7){if(_0x3415e7){var _0x50e21a=_[_0x9181('0x77')](_0x3415e7,function(_0xfe4088){var _0xc921b0=_0xfe4088[_0x9181('0x2b')]({'plain':!![]});_0xc921b0[_0x9181('0x78')][_0x9181('0x79')](function(_0x5862af){_0x5862af[_0x9181('0x7a')]=_[_0x9181('0x35')](_0x12a5d4,{'id':_0xc921b0['id']})[_0x9181('0x7a')];});return _0xc921b0['Agents'];});return db['VoiceQueue'][_0x9181('0x35')]({'where':{'id':_0x5aef47[_0x9181('0x60')]['id']}})[_0x9181('0x29')](function(_0x41673c){return db['sequelize'][_0x9181('0x7b')](function(_0x3328dd){return _0x41673c[_0x9181('0x71')](_0x24b6f4,{'transaction':_0x3328dd})[_0x9181('0x29')](function(){return BPromise[_0x9181('0x7c')](_0x12a5d4,function(_0x587c89){return db[_0x9181('0x7d')][_0x9181('0x7e')]({'TeamId':_0x587c89['id'],'VoiceQueueId':_0x5aef47[_0x9181('0x60')]['id'],'penalty':_0x587c89[_0x9181('0x7a')]},{'transaction':_0x3328dd});});})[_0x9181('0x29')](function(){return BPromise[_0x9181('0x7c')](_0x50e21a,function(_0xae090e){return db[_0x9181('0x7f')][_0x9181('0x80')]({'where':{'UserId':_0xae090e['id'],'VoiceQueueId':_0x5aef47[_0x9181('0x60')]['id']},'defaults':{'penalty':_0xae090e[_0x9181('0x7a')]},'transaction':_0x3328dd});});})[_0x9181('0x29')](function(){return BPromise[_0x9181('0x7c')](_['filter'](_0x50e21a,{'online':!![]}),function(_0x534668){return db[_0x9181('0x81')][_0x9181('0x7e')]({'membername':_0x534668['name'],'UserId':_0x534668['id'],'queue_name':_0x41673c[_0x9181('0x36')],'VoiceQueueId':_0x41673c['id'],'interface':_[_0x9181('0x82')](_0x534668[_0x9181('0x76')])?util[_0x9181('0x83')]('SIP/%s',_0x534668[_0x9181('0x36')]):_0x534668['interface'],'paused':_0x534668[_0x9181('0x75')]||![],'penalty':_0x534668[_0x9181('0x7a')]},{'transaction':_0x3328dd});});})[_0x9181('0x29')](function(){_0x50e21a[_0x9181('0x79')](function(_0x2eb367){socket[_0x9181('0x84')]('userVoiceQueue:save',{'UserId':_0x2eb367['id'],'VoiceQueueId':_0x41673c['id']});});});});});}})[_0x9181('0x29')](respondWithStatusCode(_0x1d0e8b,null))[_0x9181('0x54')](handleError(_0x1d0e8b,null));};exports[_0x9181('0x85')]=function(_0x54b5fb,_0x3afdea,_0x307094){return db[_0x9181('0x70')][_0x9181('0x52')]({'where':{'id':_0x54b5fb['query'][_0x9181('0x86')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9181('0x78'),'attributes':['id'],'raw':!![]}]})[_0x9181('0x29')](handleEntityNotFound(_0x3afdea,null))[_0x9181('0x29')](function(_0x2699c2){var _0x58f36d=_['map'](_0x2699c2,'id');var _0x46ba55=[];var _0x298eae=[];var _0xb2c160=squel[_0x9181('0x87')]();_0xb2c160['field'](_0x9181('0x88'))[_0x9181('0x89')]('team_has_voice_queues','tq')[_0x9181('0x8a')]('user_has_teams','ut',_0x9181('0x8b'))[_0x9181('0x4b')](_0x9181('0x8c'),_0x54b5fb[_0x9181('0x60')]['id']);for(var _0x119996=0x0;_0x119996<_0x2699c2[_0x9181('0x56')];_0x119996+=0x1){let _0x35e4dd=_0x2699c2[_0x119996];for(var _0x2f1d17=0x0;_0x2f1d17<_0x35e4dd['Agents'][_0x9181('0x56')];_0x2f1d17+=0x1){let _0x71240f=_0x35e4dd['Agents'][_0x2f1d17];var _0x318ea0=_0xb2c160[_0x9181('0x5f')]();_0x318ea0[_0x9181('0x4b')]('ut.UserId\x20=\x20?',_0x71240f['id']);_0x298eae[_0x9181('0x8d')](db[_0x9181('0x8e')][_0x9181('0x44')](_0x318ea0['toString'](),{'type':db[_0x9181('0x8e')]['QueryTypes'][_0x9181('0x8f')]})[_0x9181('0x29')](function(_0x53e5fa){if(_0x53e5fa[_0x9181('0x56')]===0x1){return _0x71240f['id'];}else{var _0x27115f=_[_0x9181('0x90')](_[_0x9181('0x3c')](_0x53e5fa,_0x9181('0x91')),function(_0xeea115){return _['includes'](_0x58f36d,_0xeea115);});if(_0x27115f){return _0x71240f['id'];}}}));}}return BPromise[_0x9181('0x92')](_0x298eae)['then'](function(_0x2e7bf0){_0x46ba55=_(_0x46ba55)['union'](_0x2e7bf0)[_0x9181('0x93')]()[_0x9181('0x32')]();return db[_0x9181('0x51')]['find']({'where':{'id':_0x54b5fb[_0x9181('0x60')]['id']}})[_0x9181('0x29')](function(_0x46c02e){return db['sequelize'][_0x9181('0x7b')](function(_0x314e09){return _0x46c02e[_0x9181('0x85')](_0x54b5fb[_0x9181('0x44')][_0x9181('0x86')],{'transaction':_0x314e09})[_0x9181('0x29')](function(){if(!_['isEmpty'](_0x46ba55)){return _0x46c02e['removeAgents'](_0x46ba55,{'transaction':_0x314e09})[_0x9181('0x29')](function(){return db[_0x9181('0x81')][_0x9181('0x2a')]({'where':{'VoiceQueueId':_0x54b5fb['params']['id'],'UserId':_0x46ba55},'transaction':_0x314e09});});}})['then'](function(){_0x46ba55[_0x9181('0x79')](function(_0x258452){socket['emit'](_0x9181('0x94'),{'UserId':_0x258452,'VoiceQueueId':_0x46c02e['id']});});});});});});})[_0x9181('0x29')](respondWithStatusCode(_0x3afdea,null))[_0x9181('0x54')](handleError(_0x3afdea,null));};exports[_0x9181('0x95')]=function(_0x133812,_0x2f1300,_0x5c9c0f){var _0x4c3afc,_0x1f5a80;return db['VoiceQueue'][_0x9181('0x35')]({'where':{'id':_0x133812[_0x9181('0x60')]['id']}})['then'](handleEntityNotFound(_0x2f1300,null))[_0x9181('0x29')](function(_0x2d426b){if(_0x2d426b){_0x1f5a80=_0x2d426b;return _0x2d426b[_0x9181('0x95')](_0x133812[_0x9181('0x59')][_0x9181('0x86')],_[_0x9181('0x61')](_0x133812[_0x9181('0x59')],[_0x9181('0x86'),'id'])||{})[_0x9181('0x96')](function(_0x2c8275){for(var _0xff521b=0x0;_0xff521b<_0x133812[_0x9181('0x59')]['ids']['length'];_0xff521b+=0x1){socket[_0x9181('0x84')](_0x9181('0x97'),{'UserId':Number(_0x133812[_0x9181('0x59')]['ids'][_0xff521b]),'VoiceQueueId':Number(_0x133812['params']['id'])});}return _0x2c8275;});}})['then'](function(_0x18cac3){_0x4c3afc=_0x18cac3||[];if(_0x1f5a80){return db['User']['findAll']({'where':{'id':_0x133812[_0x9181('0x59')][_0x9181('0x86')]},'attributes':['id','name',_0x9181('0x74'),_0x9181('0x75'),_0x9181('0x76')],'raw':!![]});}})[_0x9181('0x29')](function(_0x187396){if(!_[_0x9181('0x98')](_0x187396)){var _0x1f0b65=[];for(var _0x57ecec=0x0;_0x57ecec<_0x187396['length'];_0x57ecec++){if(_0x187396[_0x57ecec][_0x9181('0x74')]){_0x1f0b65[_0x9181('0x8d')](db[_0x9181('0x81')]['upsert']({'membername':_0x187396[_0x57ecec]['name'],'UserId':_0x187396[_0x57ecec]['id'],'queue_name':_0x1f5a80[_0x9181('0x36')],'VoiceQueueId':_0x1f5a80['id'],'interface':_[_0x9181('0x82')](_0x187396[_0x57ecec][_0x9181('0x76')])?util[_0x9181('0x83')](_0x9181('0x99'),_0x187396[_0x57ecec][_0x9181('0x36')]):_0x187396[_0x57ecec][_0x9181('0x76')],'paused':_0x187396[_0x57ecec][_0x9181('0x75')]||![],'penalty':_0x133812['body']['penalty']||0x0}));}}return BPromise[_0x9181('0x92')](_0x1f0b65);}})['then'](function(){return _0x4c3afc;})[_0x9181('0x29')](respondWithResult(_0x2f1300,null))['catch'](handleError(_0x2f1300,null));};exports[_0x9181('0x9a')]=function(_0xe21875,_0x24264f,_0x3f771a){return db['VoiceQueue']['find']({'where':{'id':_0xe21875[_0x9181('0x60')]['id']}})['then'](handleEntityNotFound(_0x24264f,null))[_0x9181('0x29')](function(_0x10a3c8){if(_0x10a3c8){return _0x10a3c8[_0x9181('0x9a')](_0xe21875[_0x9181('0x44')][_0x9181('0x86')])['then'](function(){if(_[_0x9181('0x9b')](_0xe21875['query']['ids'])){for(var _0x11b3e1=0x0;_0x11b3e1<_0xe21875[_0x9181('0x44')][_0x9181('0x86')][_0x9181('0x56')];_0x11b3e1+=0x1){socket[_0x9181('0x84')](_0x9181('0x94'),{'UserId':Number(_0xe21875[_0x9181('0x44')][_0x9181('0x86')][_0x11b3e1]),'VoiceQueueId':Number(_0xe21875[_0x9181('0x60')]['id'])});}}else{socket[_0x9181('0x84')](_0x9181('0x94'),{'UserId':Number(_0xe21875[_0x9181('0x44')][_0x9181('0x86')]),'VoiceQueueId':Number(_0xe21875[_0x9181('0x60')]['id'])});}});}})[_0x9181('0x29')](function(_0x2750a4){return db[_0x9181('0x81')][_0x9181('0x2a')]({'where':{'VoiceQueueId':_0xe21875[_0x9181('0x60')]['id'],'UserId':_0xe21875['query'][_0x9181('0x86')]}})[_0x9181('0x29')](function(){return _0x2750a4;});})['then'](respondWithStatusCode(_0x24264f,null))['catch'](handleError(_0x24264f,null));};exports[_0x9181('0x9c')]=function(_0x4a3c14,_0xbad506,_0x38df72){var _0x5146e2={};var _0x7e11a5={};var _0x1c2359;var _0xf966ce;return db[_0x9181('0x51')][_0x9181('0x67')]({'where':{'id':_0x4a3c14['params']['id']}})[_0x9181('0x29')](handleEntityNotFound(_0xbad506,null))[_0x9181('0x29')](function(_0x90d815){if(_0x90d815){_0x1c2359=_0x90d815;_0x7e11a5[_0x9181('0x40')]=_[_0x9181('0x41')](db['User'][_0x9181('0x3d')]);_0x7e11a5['query']=_[_0x9181('0x41')](_0x4a3c14['query']);_0x7e11a5['filters']=_['intersection'](_0x7e11a5[_0x9181('0x40')],_0x7e11a5[_0x9181('0x44')]);_0x5146e2[_0x9181('0x45')]=_[_0x9181('0x43')](_0x7e11a5['model'],qs[_0x9181('0x46')](_0x4a3c14[_0x9181('0x44')]['fields']));_0x5146e2[_0x9181('0x45')]=_0x5146e2['attributes']['length']?_0x5146e2[_0x9181('0x45')]:_0x7e11a5[_0x9181('0x40')];_0x5146e2['order']=qs['sort'](_0x4a3c14[_0x9181('0x44')]['sort']);_0x5146e2[_0x9181('0x4b')]=qs[_0x9181('0x42')](_[_0x9181('0x4c')](_0x4a3c14[_0x9181('0x44')],_0x7e11a5['filters']));if(_0x4a3c14[_0x9181('0x44')][_0x9181('0x30')]){_0x5146e2[_0x9181('0x4b')]=_[_0x9181('0x4d')](_0x5146e2[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x5146e2[_0x9181('0x45')],function(_0x4b74d2){var _0x3b97d6={};_0x3b97d6[_0x4b74d2]={'$like':'%'+_0x4a3c14[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x3b97d6;})});}_0x5146e2=_[_0x9181('0x4d')]({},_0x5146e2,_0x4a3c14[_0x9181('0x4f')]);return _0x1c2359[_0x9181('0x9c')](_0x5146e2);}})['then'](function(_0x59a43c){if(_0x59a43c){_0xf966ce=_0x59a43c[_0x9181('0x56')];if(!_0x4a3c14[_0x9181('0x44')][_0x9181('0x47')](_0x9181('0x48'))){_0x5146e2[_0x9181('0x21')]=qs[_0x9181('0x21')](_0x4a3c14[_0x9181('0x44')]['limit']);_0x5146e2['offset']=qs[_0x9181('0x20')](_0x4a3c14[_0x9181('0x44')][_0x9181('0x20')]);}return _0x1c2359['getAgents'](_0x5146e2);}})[_0x9181('0x29')](function(_0x2d6a84){if(_0x2d6a84){return _0x2d6a84?{'count':_0xf966ce,'rows':_0x2d6a84}:null;}})[_0x9181('0x29')](respondWithResult(_0xbad506,null))[_0x9181('0x54')](handleError(_0xbad506,null));};exports[_0x9181('0x9d')]=function(_0x5bffe5,_0x3ae2a1,_0x304b4a){var _0x4a8bed={};var _0x2856a4={};var _0x18e6db;var _0x36738b;return db['VoiceQueue'][_0x9181('0x67')]({'where':{'id':_0x5bffe5['params']['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x3ae2a1,null))[_0x9181('0x29')](function(_0x38bd21){if(_0x38bd21){_0x18e6db=_0x38bd21;_0x2856a4['model']=_[_0x9181('0x41')](db['UserVoiceQueueRt']['rawAttributes']);_0x2856a4[_0x9181('0x44')]=_[_0x9181('0x41')](_0x5bffe5['query']);_0x2856a4[_0x9181('0x42')]=_[_0x9181('0x43')](_0x2856a4[_0x9181('0x40')],_0x2856a4[_0x9181('0x44')]);_0x4a8bed[_0x9181('0x45')]=_[_0x9181('0x43')](_0x2856a4[_0x9181('0x40')],qs[_0x9181('0x46')](_0x5bffe5[_0x9181('0x44')][_0x9181('0x46')]));_0x4a8bed[_0x9181('0x45')]=_0x4a8bed[_0x9181('0x45')]['length']?_0x4a8bed['attributes']:_0x2856a4[_0x9181('0x40')];_0x4a8bed[_0x9181('0x49')]=qs['sort'](_0x5bffe5[_0x9181('0x44')][_0x9181('0x4a')]);_0x4a8bed[_0x9181('0x4b')]=qs['filters'](_['pick'](_0x5bffe5['query'],_0x2856a4[_0x9181('0x42')]));if(_0x5bffe5[_0x9181('0x44')][_0x9181('0x30')]){_0x4a8bed['where']=_[_0x9181('0x4d')](_0x4a8bed['where'],{'$or':_[_0x9181('0x3c')](_0x4a8bed['attributes'],function(_0x2c0bef){var _0x1a9936={};_0x1a9936[_0x2c0bef]={'$like':'%'+_0x5bffe5[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x1a9936;})});}_0x4a8bed=_['merge']({},_0x4a8bed,_0x5bffe5[_0x9181('0x4f')]);return _0x18e6db['getMembers'](_0x4a8bed);}})[_0x9181('0x29')](function(_0x304f19){if(_0x304f19){_0x36738b=_0x304f19[_0x9181('0x56')];if(!_0x5bffe5['query'][_0x9181('0x47')]('nolimit')){_0x4a8bed[_0x9181('0x21')]=qs['limit'](_0x5bffe5[_0x9181('0x44')]['limit']);_0x4a8bed[_0x9181('0x20')]=qs[_0x9181('0x20')](_0x5bffe5[_0x9181('0x44')]['offset']);}return _0x18e6db[_0x9181('0x9d')](_0x4a8bed);}})[_0x9181('0x29')](function(_0x3153ae){return _0x3153ae?{'count':_0x36738b,'rows':_0x3153ae}:null;})[_0x9181('0x29')](respondWithResult(_0x3ae2a1,null))['catch'](handleError(_0x3ae2a1,null));};exports[_0x9181('0x9e')]=function(_0x25bd8c,_0x8edb26,_0x432e62){var _0x5b7c6={};var _0x1df7e9={};var _0x29d929;var _0x311844;return db['VoiceQueue'][_0x9181('0x67')]({'where':{'id':_0x25bd8c[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x8edb26,null))[_0x9181('0x29')](function(_0x438b61){if(_0x438b61){_0x29d929=_0x438b61;_0x1df7e9[_0x9181('0x40')]=_[_0x9181('0x41')](db[_0x9181('0x9f')][_0x9181('0x3d')]);_0x1df7e9[_0x9181('0x44')]=_[_0x9181('0x41')](_0x25bd8c[_0x9181('0x44')]);_0x1df7e9[_0x9181('0x42')]=_[_0x9181('0x43')](_0x1df7e9['model'],_0x1df7e9[_0x9181('0x44')]);_0x5b7c6['attributes']=_[_0x9181('0x43')](_0x1df7e9[_0x9181('0x40')],qs['fields'](_0x25bd8c[_0x9181('0x44')]['fields']));_0x5b7c6[_0x9181('0x45')]=_0x5b7c6[_0x9181('0x45')][_0x9181('0x56')]?_0x5b7c6[_0x9181('0x45')]:_0x1df7e9[_0x9181('0x40')];_0x5b7c6[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x25bd8c[_0x9181('0x44')]['sort']);_0x5b7c6[_0x9181('0x4b')]=qs[_0x9181('0x42')](_['pick'](_0x25bd8c[_0x9181('0x44')],_0x1df7e9[_0x9181('0x42')]));if(_0x25bd8c[_0x9181('0x44')][_0x9181('0x30')]){_0x5b7c6['where']=_[_0x9181('0x4d')](_0x5b7c6['where'],{'$or':_['map'](_0x5b7c6['attributes'],function(_0x147ef6){var _0x13801b={};_0x13801b[_0x147ef6]={'$like':'%'+_0x25bd8c[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x13801b;})});}_0x5b7c6=_[_0x9181('0x4d')]({},_0x5b7c6,_0x25bd8c[_0x9181('0x4f')]);return _0x29d929[_0x9181('0x9e')](_0x5b7c6);}})[_0x9181('0x29')](function(_0x142d0a){if(_0x142d0a){_0x311844=_0x142d0a[_0x9181('0x56')];if(!_0x25bd8c['query'][_0x9181('0x47')](_0x9181('0x48'))){_0x5b7c6['limit']=qs['limit'](_0x25bd8c[_0x9181('0x44')][_0x9181('0x21')]);_0x5b7c6[_0x9181('0x20')]=qs['offset'](_0x25bd8c[_0x9181('0x44')][_0x9181('0x20')]);}return _0x29d929['getLists'](_0x5b7c6);}})[_0x9181('0x29')](function(_0x35ea85){if(_0x35ea85){return _0x35ea85?{'count':_0x311844,'rows':_0x35ea85}:null;}})['then'](respondWithResult(_0x8edb26,null))['catch'](handleError(_0x8edb26,null));};exports[_0x9181('0xa0')]=function(_0x3cccdc,_0x4b6689,_0x2405a5){var _0x3d3819,_0x312f5c;return db[_0x9181('0x51')][_0x9181('0x35')]({'where':{'id':_0x3cccdc[_0x9181('0x60')]['id']}})['then'](handleEntityNotFound(_0x4b6689,null))['then'](function(_0x3d345c){if(_0x3d345c){_0x312f5c=_0x3d345c;return _0x3d345c[_0x9181('0xa0')](_0x3cccdc[_0x9181('0x59')][_0x9181('0x86')],_['omit'](_0x3cccdc['body'],[_0x9181('0x86'),'id'])||{});}return null;})['spread'](function(_0x4599ef){var _0x275cfb;_0x3d3819=_0x4599ef||[];var _0x1ab424=[];if(_0x4599ef){for(var _0x3ea6db=0x0;_0x3ea6db<_0x4599ef[_0x9181('0x56')];_0x3ea6db+=0x1){var _0x2028f5=_0x4599ef[_0x3ea6db]['get']({'plain':!![]});_0x312f5c[_0x9181('0xa1')]=_0x3cccdc['body']['dialCheckDuplicateType']?_0x3cccdc[_0x9181('0x59')][_0x9181('0xa1')]:_0x312f5c[_0x9181('0xa1')];switch(_0x312f5c[_0x9181('0xa1')]){case _0x9181('0xa2'):_0x275cfb=squel[_0x9181('0xa3')]()[_0x9181('0xa4')](_0x9181('0xa5'))[_0x9181('0xa6')]([_0x9181('0xa7'),'scheduledAt',_0x9181('0xa8'),_0x9181('0xa9'),_0x9181('0x69'),_0x9181('0x63'),_0x9181('0x62')],squel[_0x9181('0x87')]()[_0x9181('0xaa')](_0x9181('0xa7'),'phone')[_0x9181('0xaa')](_0x9181('0xab'),'scheduledAt')[_0x9181('0xaa')]('id','ContactId')[_0x9181('0xaa')](_0x2028f5['CmListId'][_0x9181('0xac')](),'ListId')[_0x9181('0xaa')](_0x3cccdc[_0x9181('0x60')]['id'][_0x9181('0xac')](),_0x9181('0x69'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0x63'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0x62'))[_0x9181('0x89')](_0x9181('0xad'))[_0x9181('0x4b')]('deletedAt\x20IS\x20NULL')[_0x9181('0x4b')](_0x9181('0xae'),_0x2028f5[_0x9181('0xaf')][_0x9181('0xac')]())[_0x9181('0x4b')](_0x9181('0xb0'))['where'](_0x9181('0xb1'),squel['select']()[_0x9181('0xaa')](_0x9181('0xb2'))['from'](_0x9181('0xb3'))[_0x9181('0x4b')](_0x9181('0x8c'),_0x3cccdc[_0x9181('0x60')]['id'][_0x9181('0xac')]()))[_0x9181('0x4b')](_0x9181('0xb1'),squel[_0x9181('0x87')]()[_0x9181('0xaa')](_0x9181('0xb4'))[_0x9181('0x89')](_0x9181('0xa5'))[_0x9181('0x4b')](_0x9181('0x8c'),_0x3cccdc[_0x9181('0x60')]['id'][_0x9181('0xac')]())))[_0x9181('0xac')]();break;case'onlyIfOpen':_0x275cfb=squel[_0x9181('0xa3')]()[_0x9181('0xa4')]('cm_hopper')[_0x9181('0xa6')](['phone',_0x9181('0xb5'),_0x9181('0xa8'),_0x9181('0xa9'),_0x9181('0x69'),_0x9181('0x63'),'updatedAt'],squel[_0x9181('0x87')]()[_0x9181('0xaa')]('phone','phone')['field'](_0x9181('0xab'),'scheduledAt')[_0x9181('0xaa')]('id',_0x9181('0xa8'))['field'](_0x2028f5[_0x9181('0xaf')][_0x9181('0xac')](),_0x9181('0xa9'))[_0x9181('0xaa')](_0x3cccdc[_0x9181('0x60')]['id']['toString'](),_0x9181('0x69'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0x63'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0x62'))[_0x9181('0x89')](_0x9181('0xad'))[_0x9181('0x4b')]('deletedAt\x20IS\x20NULL')[_0x9181('0x4b')](_0x9181('0xae'),_0x2028f5['CmListId'][_0x9181('0xac')]())[_0x9181('0x4b')](_0x9181('0xb0'))['where'](_0x9181('0xb1'),squel[_0x9181('0x87')]()['field'](_0x9181('0xb4'))[_0x9181('0x89')](_0x9181('0xa5'))[_0x9181('0x4b')](_0x9181('0x8c'),_0x3cccdc[_0x9181('0x60')]['id'][_0x9181('0xac')]())))['toString']();break;default:_0x275cfb=squel[_0x9181('0xa3')]()[_0x9181('0xa4')](_0x9181('0xa5'))[_0x9181('0xa6')]([_0x9181('0xa7'),'scheduledAt',_0x9181('0xa8'),_0x9181('0xa9'),_0x9181('0x69'),_0x9181('0x63'),_0x9181('0x62')],squel[_0x9181('0x87')]()['field'](_0x9181('0xa7'),_0x9181('0xa7'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0xb5'))[_0x9181('0xaa')]('id',_0x9181('0xa8'))[_0x9181('0xaa')](_0x2028f5[_0x9181('0xaf')][_0x9181('0xac')](),_0x9181('0xa9'))[_0x9181('0xaa')](_0x3cccdc[_0x9181('0x60')]['id'][_0x9181('0xac')](),_0x9181('0x69'))[_0x9181('0xaa')]('NOW()',_0x9181('0x63'))['field'](_0x9181('0xab'),_0x9181('0x62'))[_0x9181('0x89')](_0x9181('0xad'))[_0x9181('0x4b')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x2028f5[_0x9181('0xaf')][_0x9181('0xac')]())['where'](_0x9181('0xb0')))[_0x9181('0xac')]();}_0x1ab424[_0x9181('0x8d')](db['sequelize'][_0x9181('0x44')](_0x275cfb));}return BPromise[_0x9181('0x92')](_0x1ab424);}})[_0x9181('0x29')](function(){return _0x3d3819;})[_0x9181('0x29')](respondWithResult(_0x4b6689,null))[_0x9181('0x54')](handleError(_0x4b6689,null));};exports['removeLists']=function(_0x210025,_0x41dda4,_0x530eaf){return db[_0x9181('0x51')][_0x9181('0x35')]({'where':{'id':_0x210025[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x41dda4,null))[_0x9181('0x29')](function(_0x16e53c){if(_0x16e53c){return _0x16e53c[_0x9181('0xb6')](_0x210025['query'][_0x9181('0x86')]);}})[_0x9181('0x29')](function(_0x5c2d39){if(_0x5c2d39){return db[_0x9181('0x68')]['destroy']({'where':{'ListId':_0x210025['query'][_0x9181('0x86')],'VoiceQueueId':_0x210025[_0x9181('0x60')]['id']}})['then'](function(){return _0x5c2d39;});}})[_0x9181('0x29')](respondWithStatusCode(_0x41dda4,null))[_0x9181('0x54')](handleError(_0x41dda4,null));};exports[_0x9181('0xb7')]=function(_0x3dcac5,_0xe40122,_0x97f0e9){var _0x1f7e69={};var _0x4949bc={};var _0x4bd0ff;var _0x418c66;return db[_0x9181('0x51')]['findOne']({'where':{'id':_0x3dcac5['params']['id']}})[_0x9181('0x29')](handleEntityNotFound(_0xe40122,null))['then'](function(_0x32fb4b){if(_0x32fb4b){_0x4bd0ff=_0x32fb4b;_0x4949bc['model']=_[_0x9181('0x41')](db[_0x9181('0x9f')][_0x9181('0x3d')]);_0x4949bc[_0x9181('0x44')]=_[_0x9181('0x41')](_0x3dcac5[_0x9181('0x44')]);_0x4949bc[_0x9181('0x42')]=_[_0x9181('0x43')](_0x4949bc[_0x9181('0x40')],_0x4949bc[_0x9181('0x44')]);_0x1f7e69[_0x9181('0x45')]=_['intersection'](_0x4949bc[_0x9181('0x40')],qs[_0x9181('0x46')](_0x3dcac5[_0x9181('0x44')][_0x9181('0x46')]));_0x1f7e69[_0x9181('0x45')]=_0x1f7e69['attributes'][_0x9181('0x56')]?_0x1f7e69[_0x9181('0x45')]:_0x4949bc[_0x9181('0x40')];_0x1f7e69[_0x9181('0x49')]=qs[_0x9181('0x4a')](_0x3dcac5[_0x9181('0x44')][_0x9181('0x4a')]);_0x1f7e69[_0x9181('0x4b')]=qs[_0x9181('0x42')](_[_0x9181('0x4c')](_0x3dcac5['query'],_0x4949bc[_0x9181('0x42')]));if(_0x3dcac5['query'][_0x9181('0x30')]){_0x1f7e69[_0x9181('0x4b')]=_[_0x9181('0x4d')](_0x1f7e69[_0x9181('0x4b')],{'$or':_[_0x9181('0x3c')](_0x1f7e69['attributes'],function(_0x17ba38){var _0x22bb5b={};_0x22bb5b[_0x17ba38]={'$like':'%'+_0x3dcac5[_0x9181('0x44')][_0x9181('0x30')]+'%'};return _0x22bb5b;})});}_0x1f7e69=_['merge']({},_0x1f7e69,_0x3dcac5[_0x9181('0x4f')]);return _0x4bd0ff[_0x9181('0xb7')](_0x1f7e69);}})[_0x9181('0x29')](function(_0x4b73f7){if(_0x4b73f7){_0x418c66=_0x4b73f7[_0x9181('0x56')];if(!_0x3dcac5[_0x9181('0x44')]['hasOwnProperty'](_0x9181('0x48'))){_0x1f7e69[_0x9181('0x21')]=qs[_0x9181('0x21')](_0x3dcac5[_0x9181('0x44')][_0x9181('0x21')]);_0x1f7e69[_0x9181('0x20')]=qs[_0x9181('0x20')](_0x3dcac5[_0x9181('0x44')][_0x9181('0x20')]);}return _0x4bd0ff['getBlackLists'](_0x1f7e69);}})['then'](function(_0xb0da39){if(_0xb0da39){return _0xb0da39?{'count':_0x418c66,'rows':_0xb0da39}:null;}})['then'](respondWithResult(_0xe40122,null))[_0x9181('0x54')](handleError(_0xe40122,null));};exports[_0x9181('0xb8')]=function(_0x52f563,_0x5b02ab,_0x35e7ce){var _0x1e985b,_0x19f599;return db[_0x9181('0x51')]['find']({'where':{'id':_0x52f563[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x5b02ab,null))[_0x9181('0x29')](function(_0x2f16da){if(_0x2f16da){_0x19f599=_0x2f16da;return _0x2f16da['addBlackLists'](_0x52f563['body'][_0x9181('0x86')],_[_0x9181('0x61')](_0x52f563['body'],[_0x9181('0x86'),'id'])||{});}return null;})[_0x9181('0x96')](function(_0x3c988c){var _0x2c2446;_0x1e985b=_0x3c988c||[];var _0x3ad131=[];if(_0x3c988c){for(var _0x643a9d=0x0;_0x643a9d<_0x3c988c[_0x9181('0x56')];_0x643a9d+=0x1){var _0x204553=_0x3c988c[_0x643a9d]['get']({'plain':!![]});_0x2c2446=squel[_0x9181('0xa3')]()['into']('cm_hopper_black')[_0x9181('0xa6')](['phone',_0x9181('0xa8'),'ListId',_0x9181('0x69'),_0x9181('0x63'),'updatedAt'],squel[_0x9181('0x87')]()[_0x9181('0xaa')](_0x9181('0xa7'),_0x9181('0xa7'))[_0x9181('0xaa')]('id',_0x9181('0xa8'))['field'](_0x204553[_0x9181('0xaf')][_0x9181('0xac')](),_0x9181('0xa9'))[_0x9181('0xaa')](_0x52f563[_0x9181('0x60')]['id'][_0x9181('0xac')](),_0x9181('0x69'))[_0x9181('0xaa')]('NOW()',_0x9181('0x63'))[_0x9181('0xaa')](_0x9181('0xab'),_0x9181('0x62'))[_0x9181('0x89')]('cm_contacts')[_0x9181('0x4b')](_0x9181('0xb9'))[_0x9181('0x4b')](_0x9181('0xae'),_0x204553[_0x9181('0xaf')][_0x9181('0xac')]())[_0x9181('0x4b')](_0x9181('0xb0')))[_0x9181('0xac')]();_0x3ad131[_0x9181('0x8d')](db[_0x9181('0x8e')]['query'](_0x2c2446));}return BPromise[_0x9181('0x92')](_0x3ad131);}})[_0x9181('0x29')](function(){return _0x1e985b;})[_0x9181('0x29')](respondWithResult(_0x5b02ab,null))['catch'](handleError(_0x5b02ab,null));};exports[_0x9181('0xba')]=function(_0xe2e408,_0x230bd3,_0x215b2a){return db[_0x9181('0x51')]['find']({'where':{'id':_0xe2e408[_0x9181('0x60')]['id']}})[_0x9181('0x29')](handleEntityNotFound(_0x230bd3,null))[_0x9181('0x29')](function(_0x478f9e){if(_0x478f9e){return _0x478f9e[_0x9181('0xba')](_0xe2e408['query'][_0x9181('0x86')]);}})[_0x9181('0x29')](function(_0x26834b){if(_0x26834b){return db['CmHopperBlack'][_0x9181('0x2a')]({'where':{'ListId':_0xe2e408[_0x9181('0x44')][_0x9181('0x86')],'VoiceQueueId':_0xe2e408[_0x9181('0x60')]['id']}})[_0x9181('0x29')](function(){return _0x26834b;});}})['then'](respondWithStatusCode(_0x230bd3,null))[_0x9181('0x54')](handleError(_0x230bd3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 3c68b5e..f2a62ce 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 _0x1e90=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x83b21d,_0x747f5f){var _0x52d1f1=function(_0x9d5ffd){while(--_0x9d5ffd){_0x83b21d['push'](_0x83b21d['shift']());}};_0x52d1f1(++_0x747f5f);}(_0x1e90,0x16e));var _0x01e9=function(_0x2de2cf,_0xe7cec4){_0x2de2cf=_0x2de2cf-0x0;var _0x37d714=_0x1e90[_0x2de2cf];return _0x37d714;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x01e9('0x0'))['db'][_0x01e9('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x01e9('0x2')](0x0);var events={'afterCreate':_0x01e9('0x3'),'afterUpdate':_0x01e9('0x4'),'afterDestroy':_0x01e9('0x5')};function emitEvent(_0x4c6ed6){return function(_0x409f91,_0x40b861,_0x1a2662){VoiceQueueEvents[_0x01e9('0x6')](_0x4c6ed6+':'+_0x409f91['id'],_0x409f91);VoiceQueueEvents['emit'](_0x4c6ed6,_0x409f91);_0x1a2662(null);};}for(var e in events){if(events[_0x01e9('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x01e9('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xf799=['update','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','save'];(function(_0x20b439,_0x5aae74){var _0x122b8f=function(_0x337e82){while(--_0x337e82){_0x20b439['push'](_0x20b439['shift']());}};_0x122b8f(++_0x5aae74);}(_0xf799,0x114));var _0x9f79=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xf799[_0x416cdc];return _0x1931ce;};'use strict';var EventEmitter=require(_0x9f79('0x0'));var VoiceQueue=require(_0x9f79('0x1'))['db'][_0x9f79('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9f79('0x3'),'afterUpdate':_0x9f79('0x4'),'afterDestroy':'remove'};function emitEvent(_0x777eff){return function(_0x1efeeb,_0x49a6b0,_0x2f86e){VoiceQueueEvents['emit'](_0x777eff+':'+_0x1efeeb['id'],_0x1efeeb);VoiceQueueEvents['emit'](_0x777eff,_0x1efeeb);_0x2f86e(null);};}for(var e in events){if(events[_0x9f79('0x5')](e)){var event=events[e];VoiceQueue[_0x9f79('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index a486049..1f2cb32 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x4b1f9c,_0x422fc9){var _0x3e0632=function(_0x480a6f){while(--_0x480a6f){_0x4b1f9c['push'](_0x4b1f9c['shift']());}};_0x3e0632(++_0x422fc9);}(_0x70e0,0x17b));var _0x070e=function(_0x304251,_0x514c33){_0x304251=_0x304251-0x0;var _0x424343=_0x70e0[_0x304251];return _0x424343;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x3d7f22,_0x5e9762){var _0x5da24b=function(_0x3ddeab){while(--_0x3ddeab){_0x3d7f22['push'](_0x3d7f22['shift']());}};_0x5da24b(++_0x5e9762);}(_0xedd9,0xfc));var _0x9edd=function(_0x384610,_0x116dfe){_0x384610=_0x384610-0x0;var _0x63f5d5=_0xedd9[_0x384610];return _0x63f5d5;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index a82f85c..7e115a4 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 _0x5454=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','ioredis'];(function(_0x20dc67,_0x1e3655){var _0x4005d9=function(_0x474874){while(--_0x474874){_0x20dc67['push'](_0x20dc67['shift']());}};_0x4005d9(++_0x1e3655);}(_0x5454,0xc3));var _0x4545=function(_0x40a271,_0x2552b0){_0x40a271=_0x40a271-0x0;var _0x5a468b=_0x5454[_0x40a271];return _0x5a468b;};'use strict';var _=require(_0x4545('0x0'));var util=require(_0x4545('0x1'));var moment=require('moment');var BPromise=require(_0x4545('0x2'));var rs=require(_0x4545('0x3'));var fs=require('fs');var Redis=require(_0x4545('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4545('0x5'));var logger=require(_0x4545('0x6'))(_0x4545('0x7'));var config=require(_0x4545('0x8'));var jayson=require(_0x4545('0x9'));var client=jayson['client'][_0x4545('0xa')]({'port':0x232a});config['redis']=_[_0x4545('0xb')](config['redis'],{'host':_0x4545('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4545('0xd')]));require(_0x4545('0xe'))[_0x4545('0xf')](socket);function respondWithRpcPromise(_0x4cac28,_0xae3935,_0x47d893){return new BPromise(function(_0x172f70,_0x7c8997){return client['request'](_0x4cac28,_0x47d893)[_0x4545('0x10')](function(_0x4f4271){logger[_0x4545('0x11')](_0x4545('0x12'),_0xae3935,'request\x20sent');logger[_0x4545('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xae3935,_0x4545('0x14'),JSON[_0x4545('0x15')](_0x4f4271));if(_0x4f4271[_0x4545('0x16')]){if(_0x4f4271['error'][_0x4545('0x17')]===0x1f4){logger[_0x4545('0x16')](_0x4545('0x12'),_0xae3935,_0x4f4271[_0x4545('0x16')][_0x4545('0x18')]);return _0x7c8997(_0x4f4271[_0x4545('0x16')]['message']);}logger['error'](_0x4545('0x12'),_0xae3935,_0x4f4271['error'][_0x4545('0x18')]);return _0x172f70(_0x4f4271[_0x4545('0x16')][_0x4545('0x18')]);}else{logger[_0x4545('0x11')](_0x4545('0x12'),_0xae3935,_0x4545('0x14'));_0x172f70(_0x4f4271[_0x4545('0x19')]['message']);}})[_0x4545('0x1a')](function(_0x5aa1af){logger[_0x4545('0x16')](_0x4545('0x12'),_0xae3935,_0x5aa1af);_0x7c8997(_0x5aa1af);});});}exports[_0x4545('0x1b')]=function(_0x54ef1a){var _0x38b83d=this;return new Promise(function(_0x5debbc,_0x2312a8){return db[_0x4545('0x1c')][_0x4545('0x1d')]({'raw':_0x54ef1a[_0x4545('0x1e')]?_0x54ef1a[_0x4545('0x1e')][_0x4545('0x1f')]===undefined?!![]:![]:!![],'where':_0x54ef1a[_0x4545('0x1e')]?_0x54ef1a['options'][_0x4545('0x20')]||null:null,'attributes':_0x54ef1a['options']?_0x54ef1a[_0x4545('0x1e')][_0x4545('0x21')]||null:null,'limit':_0x54ef1a[_0x4545('0x1e')]?_0x54ef1a[_0x4545('0x1e')][_0x4545('0x22')]||null:null,'include':_0x54ef1a[_0x4545('0x1e')]?_0x54ef1a[_0x4545('0x1e')][_0x4545('0x23')]?_[_0x4545('0x24')](_0x54ef1a['options'][_0x4545('0x23')],function(_0x4c7c6d){return{'model':db[_0x4c7c6d[_0x4545('0x25')]],'as':_0x4c7c6d['as'],'attributes':_0x4c7c6d['attributes'],'include':_0x4c7c6d[_0x4545('0x23')]?_[_0x4545('0x24')](_0x4c7c6d['include'],function(_0x54b971){return{'model':db[_0x54b971['model']],'as':_0x54b971['as'],'attributes':_0x54b971['attributes'],'include':_0x54b971[_0x4545('0x23')]?_[_0x4545('0x24')](_0x54b971[_0x4545('0x23')],function(_0x221ec3){return{'model':db[_0x221ec3[_0x4545('0x25')]],'as':_0x221ec3['as'],'attributes':_0x221ec3[_0x4545('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4545('0x10')](function(_0x1e8463){logger['info']('GetVoiceQueue',_0x54ef1a);logger[_0x4545('0x13')](_0x4545('0x1b'),_0x54ef1a,JSON[_0x4545('0x15')](_0x1e8463));_0x5debbc(_0x1e8463);})[_0x4545('0x1a')](function(_0x3ede18){logger['error']('GetVoiceQueue',_0x3ede18[_0x4545('0x18')],_0x54ef1a);_0x2312a8(_0x38b83d[_0x4545('0x16')](0x1f4,_0x3ede18[_0x4545('0x18')]));});});};exports[_0x4545('0x26')]=function(_0x30045c){var _0x1f6440=this;return new Promise(function(_0x2c3ca1,_0x344d62){return db['VoiceQueue'][_0x4545('0x27')]({'raw':_0x30045c[_0x4545('0x1e')]?_0x30045c[_0x4545('0x1e')][_0x4545('0x1f')]===undefined?!![]:![]:!![],'where':_0x30045c['options']?_0x30045c[_0x4545('0x1e')]['where']||null:null,'attributes':_0x30045c[_0x4545('0x1e')]?_0x30045c[_0x4545('0x1e')][_0x4545('0x21')]||null:null,'include':_0x30045c[_0x4545('0x1e')]?_0x30045c[_0x4545('0x1e')][_0x4545('0x23')]?_[_0x4545('0x24')](_0x30045c[_0x4545('0x1e')][_0x4545('0x23')],function(_0x395171){return{'model':db[_0x395171['model']],'as':_0x395171['as'],'attributes':_0x395171[_0x4545('0x21')],'include':_0x395171[_0x4545('0x23')]?_[_0x4545('0x24')](_0x395171[_0x4545('0x23')],function(_0x42d1c1){return{'model':db[_0x42d1c1[_0x4545('0x25')]],'as':_0x42d1c1['as'],'attributes':_0x42d1c1[_0x4545('0x21')],'include':_0x42d1c1['include']?_[_0x4545('0x24')](_0x42d1c1[_0x4545('0x23')],function(_0x345da8){return{'model':db[_0x345da8[_0x4545('0x25')]],'as':_0x345da8['as'],'attributes':_0x345da8['attributes']};}):[]};}):[]};}):[]:[]})[_0x4545('0x10')](function(_0x4d11c9){logger[_0x4545('0x11')](_0x4545('0x26'),_0x30045c);logger[_0x4545('0x13')](_0x4545('0x26'),_0x30045c,JSON[_0x4545('0x15')](_0x4d11c9));_0x2c3ca1(_0x4d11c9);})[_0x4545('0x1a')](function(_0x4958fe){logger['error'](_0x4545('0x26'),_0x4958fe['message'],_0x30045c);_0x344d62(_0x1f6440[_0x4545('0x16')](0x1f4,_0x4958fe[_0x4545('0x18')]));});});}; \ No newline at end of file +var _0x744a=['info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then'];(function(_0xa1f7cb,_0x24d50a){var _0x449364=function(_0x4a65e9){while(--_0x4a65e9){_0xa1f7cb['push'](_0xa1f7cb['shift']());}};_0x449364(++_0x24d50a);}(_0x744a,0x186));var _0xa744=function(_0x286724,_0x5c7829){_0x286724=_0x286724-0x0;var _0x55651=_0x744a[_0x286724];return _0x55651;};'use strict';var _=require(_0xa744('0x0'));var util=require(_0xa744('0x1'));var moment=require(_0xa744('0x2'));var BPromise=require('bluebird');var rs=require(_0xa744('0x3'));var fs=require('fs');var Redis=require(_0xa744('0x4'));var db=require(_0xa744('0x5'))['db'];var utils=require(_0xa744('0x6'));var logger=require('../../config/logger')(_0xa744('0x7'));var config=require(_0xa744('0x8'));var jayson=require(_0xa744('0x9'));var client=jayson[_0xa744('0xa')][_0xa744('0xb')]({'port':0x232a});config[_0xa744('0xc')]=_[_0xa744('0xd')](config[_0xa744('0xc')],{'host':_0xa744('0xe'),'port':0x18eb});var socket=require(_0xa744('0xf'))(new Redis(config[_0xa744('0xc')]));require(_0xa744('0x10'))[_0xa744('0x11')](socket);function respondWithRpcPromise(_0x396d37,_0x18a1d1,_0x5002ea){return new BPromise(function(_0xeb3340,_0x37e4e6){return client[_0xa744('0x12')](_0x396d37,_0x5002ea)[_0xa744('0x13')](function(_0x390eb9){logger[_0xa744('0x14')](_0xa744('0x15'),_0x18a1d1,_0xa744('0x16'));logger[_0xa744('0x17')](_0xa744('0x18'),_0x18a1d1,'request\x20sent',JSON[_0xa744('0x19')](_0x390eb9));if(_0x390eb9[_0xa744('0x1a')]){if(_0x390eb9['error'][_0xa744('0x1b')]===0x1f4){logger[_0xa744('0x1a')](_0xa744('0x15'),_0x18a1d1,_0x390eb9['error'][_0xa744('0x1c')]);return _0x37e4e6(_0x390eb9['error'][_0xa744('0x1c')]);}logger[_0xa744('0x1a')](_0xa744('0x15'),_0x18a1d1,_0x390eb9['error']['message']);return _0xeb3340(_0x390eb9[_0xa744('0x1a')][_0xa744('0x1c')]);}else{logger[_0xa744('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x18a1d1,'request\x20sent');_0xeb3340(_0x390eb9['result']['message']);}})[_0xa744('0x1d')](function(_0x47d3ec){logger['error'](_0xa744('0x15'),_0x18a1d1,_0x47d3ec);_0x37e4e6(_0x47d3ec);});});}exports['GetVoiceQueue']=function(_0x5d9b15){var _0x18080b=this;return new Promise(function(_0x158357,_0x5a914e){return db[_0xa744('0x1e')][_0xa744('0x1f')]({'raw':_0x5d9b15['options']?_0x5d9b15[_0xa744('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x5d9b15[_0xa744('0x20')]?_0x5d9b15[_0xa744('0x20')][_0xa744('0x21')]||null:null,'attributes':_0x5d9b15[_0xa744('0x20')]?_0x5d9b15[_0xa744('0x20')][_0xa744('0x22')]||null:null,'limit':_0x5d9b15[_0xa744('0x20')]?_0x5d9b15[_0xa744('0x20')][_0xa744('0x23')]||null:null,'include':_0x5d9b15[_0xa744('0x20')]?_0x5d9b15[_0xa744('0x20')][_0xa744('0x24')]?_[_0xa744('0x25')](_0x5d9b15['options'][_0xa744('0x24')],function(_0x342484){return{'model':db[_0x342484[_0xa744('0x26')]],'as':_0x342484['as'],'attributes':_0x342484[_0xa744('0x22')],'include':_0x342484[_0xa744('0x24')]?_[_0xa744('0x25')](_0x342484[_0xa744('0x24')],function(_0x252de0){return{'model':db[_0x252de0[_0xa744('0x26')]],'as':_0x252de0['as'],'attributes':_0x252de0[_0xa744('0x22')],'include':_0x252de0['include']?_[_0xa744('0x25')](_0x252de0[_0xa744('0x24')],function(_0x3569b6){return{'model':db[_0x3569b6[_0xa744('0x26')]],'as':_0x3569b6['as'],'attributes':_0x3569b6['attributes']};}):[]};}):[]};}):[]:[]})[_0xa744('0x13')](function(_0x24bb0a){logger[_0xa744('0x14')](_0xa744('0x27'),_0x5d9b15);logger[_0xa744('0x17')](_0xa744('0x27'),_0x5d9b15,JSON[_0xa744('0x19')](_0x24bb0a));_0x158357(_0x24bb0a);})['catch'](function(_0x15ce9f){logger['error'](_0xa744('0x27'),_0x15ce9f['message'],_0x5d9b15);_0x5a914e(_0x18080b[_0xa744('0x1a')](0x1f4,_0x15ce9f[_0xa744('0x1c')]));});});};exports[_0xa744('0x28')]=function(_0x581431){var _0x46be05=this;return new Promise(function(_0x1ea07d,_0x198e58){return db['VoiceQueue']['find']({'raw':_0x581431[_0xa744('0x20')]?_0x581431[_0xa744('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x581431[_0xa744('0x20')]?_0x581431[_0xa744('0x20')][_0xa744('0x21')]||null:null,'attributes':_0x581431[_0xa744('0x20')]?_0x581431[_0xa744('0x20')]['attributes']||null:null,'include':_0x581431[_0xa744('0x20')]?_0x581431['options'][_0xa744('0x24')]?_[_0xa744('0x25')](_0x581431[_0xa744('0x20')][_0xa744('0x24')],function(_0x306ecb){return{'model':db[_0x306ecb[_0xa744('0x26')]],'as':_0x306ecb['as'],'attributes':_0x306ecb[_0xa744('0x22')],'include':_0x306ecb[_0xa744('0x24')]?_[_0xa744('0x25')](_0x306ecb['include'],function(_0xa9de18){return{'model':db[_0xa9de18['model']],'as':_0xa9de18['as'],'attributes':_0xa9de18[_0xa744('0x22')],'include':_0xa9de18['include']?_[_0xa744('0x25')](_0xa9de18['include'],function(_0x4fca8b){return{'model':db[_0x4fca8b[_0xa744('0x26')]],'as':_0x4fca8b['as'],'attributes':_0x4fca8b[_0xa744('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58655e){logger[_0xa744('0x14')](_0xa744('0x28'),_0x581431);logger[_0xa744('0x17')](_0xa744('0x28'),_0x581431,JSON[_0xa744('0x19')](_0x58655e));_0x1ea07d(_0x58655e);})[_0xa744('0x1d')](function(_0x536b25){logger[_0xa744('0x1a')](_0xa744('0x28'),_0x536b25[_0xa744('0x1c')],_0x581431);_0x198e58(_0x46be05[_0xa744('0x1a')](0x1f4,_0x536b25[_0xa744('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 1267e31..2d48644 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 _0x94fd=['./voiceQueue.events','save','remove','emit','register','length','voiceQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94fd,0x1f1));var _0xd94f=function(_0x505cb1,_0x4566e4){_0x505cb1=_0x505cb1-0x0;var _0x968f58=_0x94fd[_0x505cb1];return _0x968f58;};'use strict';var VoiceQueueEvents=require(_0xd94f('0x0'));var events=[_0xd94f('0x1'),_0xd94f('0x2'),'update'];function createListener(_0x77816e,_0x6fc075){return function(_0xe90248){_0x6fc075[_0xd94f('0x3')](_0x77816e,_0xe90248);};}function removeListener(_0x59dea8,_0x663cc3){return function(){VoiceQueueEvents['removeListener'](_0x59dea8,_0x663cc3);};}exports[_0xd94f('0x4')]=function(_0x274ce5){for(var _0x2317a6=0x0,_0x536e78=events[_0xd94f('0x5')];_0x2317a6<_0x536e78;_0x2317a6++){var _0x32a007=events[_0x2317a6];var _0x19ca1c=createListener(_0xd94f('0x6')+_0x32a007,_0x274ce5);VoiceQueueEvents['on'](_0x32a007,_0x19ca1c);}}; \ No newline at end of file +var _0x3b00=['length','voiceQueue:','./voiceQueue.events','save','removeListener','register'];(function(_0x110be2,_0x303bd4){var _0x2c31c1=function(_0xf7ec84){while(--_0xf7ec84){_0x110be2['push'](_0x110be2['shift']());}};_0x2c31c1(++_0x303bd4);}(_0x3b00,0x134));var _0x03b0=function(_0x5e9b2d,_0x40933e){_0x5e9b2d=_0x5e9b2d-0x0;var _0xb2a3c9=_0x3b00[_0x5e9b2d];return _0xb2a3c9;};'use strict';var VoiceQueueEvents=require(_0x03b0('0x0'));var events=[_0x03b0('0x1'),'remove','update'];function createListener(_0x1c6c9a,_0x14121d){return function(_0x2ded99){_0x14121d['emit'](_0x1c6c9a,_0x2ded99);};}function removeListener(_0x3148cd,_0x4f1721){return function(){VoiceQueueEvents[_0x03b0('0x2')](_0x3148cd,_0x4f1721);};}exports[_0x03b0('0x3')]=function(_0x42a6f7){for(var _0x54c9ef=0x0,_0x1b1a36=events[_0x03b0('0x4')];_0x54c9ef<_0x1b1a36;_0x54c9ef++){var _0x30cb02=events[_0x54c9ef];var _0x2690e4=createListener(_0x03b0('0x5')+_0x30cb02,_0x42a6f7);VoiceQueueEvents['on'](_0x30cb02,_0x2690e4);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e816101..dc1be5c 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 _0xf0da=['delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/index','/:id','show','post','create','put','update'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0xf0da,0x80));var _0xaf0d=function(_0x2c6c93,_0x15c387){_0x2c6c93=_0x2c6c93-0x0;var _0x401a59=_0xf0da[_0x2c6c93];return _0x401a59;};'use strict';var multer=require(_0xaf0d('0x0'));var util=require(_0xaf0d('0x1'));var path=require('path');var timeout=require(_0xaf0d('0x2'));var express=require('express');var router=express[_0xaf0d('0x3')]();var fs_extra=require(_0xaf0d('0x4'));var auth=require(_0xaf0d('0x5'));var interaction=require(_0xaf0d('0x6'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xaf0d('0x7')]('/',auth[_0xaf0d('0x8')](),controller[_0xaf0d('0x9')]);router[_0xaf0d('0x7')](_0xaf0d('0xa'),auth[_0xaf0d('0x8')](),controller[_0xaf0d('0xb')]);router[_0xaf0d('0x7')](_0xaf0d('0xc'),auth[_0xaf0d('0x8')](),controller['getVoiceQueuesReport']);router[_0xaf0d('0x7')](_0xaf0d('0xd'),auth[_0xaf0d('0x8')](),controller[_0xaf0d('0xe')]);router[_0xaf0d('0xf')]('/',auth[_0xaf0d('0x8')](),controller[_0xaf0d('0x10')]);router[_0xaf0d('0x11')](_0xaf0d('0xd'),auth[_0xaf0d('0x8')](),controller[_0xaf0d('0x12')]);router[_0xaf0d('0x13')](_0xaf0d('0xd'),auth[_0xaf0d('0x8')](),controller['destroy']);module[_0xaf0d('0x14')]=router; \ No newline at end of file +var _0xfe62=['/index','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x174a1d,_0x580ab8){var _0x269f8b=function(_0x266260){while(--_0x266260){_0x174a1d['push'](_0x174a1d['shift']());}};_0x269f8b(++_0x580ab8);}(_0xfe62,0x197));var _0x2fe6=function(_0x273f16,_0x5f3019){_0x273f16=_0x273f16-0x0;var _0x422e82=_0xfe62[_0x273f16];return _0x422e82;};'use strict';var multer=require(_0x2fe6('0x0'));var util=require(_0x2fe6('0x1'));var path=require(_0x2fe6('0x2'));var timeout=require(_0x2fe6('0x3'));var express=require(_0x2fe6('0x4'));var router=express[_0x2fe6('0x5')]();var fs_extra=require(_0x2fe6('0x6'));var auth=require(_0x2fe6('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2fe6('0x8'));router[_0x2fe6('0x9')]('/',auth[_0x2fe6('0xa')](),controller[_0x2fe6('0xb')]);router[_0x2fe6('0x9')](_0x2fe6('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2fe6('0x9')](_0x2fe6('0xd'),auth[_0x2fe6('0xa')](),controller['getVoiceQueuesReport']);router[_0x2fe6('0x9')](_0x2fe6('0xe'),auth['isAuthenticated'](),controller[_0x2fe6('0xf')]);router[_0x2fe6('0x10')]('/',auth[_0x2fe6('0xa')](),controller['create']);router[_0x2fe6('0x11')](_0x2fe6('0xe'),auth[_0x2fe6('0xa')](),controller[_0x2fe6('0x12')]);router['delete']('/:id',auth[_0x2fe6('0xa')](),controller[_0x2fe6('0x13')]);module[_0x2fe6('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 6b19c83..3618dcd 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 _0x41b4=['setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x4539c4,_0x16b553){var _0x389375=function(_0x4568e6){while(--_0x4568e6){_0x4539c4['push'](_0x4539c4['shift']());}};_0x389375(++_0x16b553);}(_0x41b4,0x18d));var _0x441b=function(_0x2cd068,_0x7a0a83){_0x2cd068=_0x2cd068-0x0;var _0x1f2d00=_0x41b4[_0x2cd068];return _0x1f2d00;};'use strict';var Sequelize=require(_0x441b('0x0'));var moment=require(_0x441b('0x1'));module[_0x441b('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x441b('0x3')]},'calleridnum':{'type':Sequelize[_0x441b('0x3')]},'calleridname':{'type':Sequelize[_0x441b('0x3')]},'queue':{'type':Sequelize[_0x441b('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x441b('0x4')],'set':function(_0x3eb8db){var _0x453023=moment(_0x3eb8db);var _0x5ebd9a=moment(this['getDataValue'](_0x441b('0x5')))[_0x441b('0x6')](_0x441b('0x7'));var _0x2c0162=_0x453023[_0x441b('0x8')](_0x5ebd9a,'seconds');this[_0x441b('0x9')](_0x441b('0xa'),_0x3eb8db);this[_0x441b('0x9')]('holdtime',_0x2c0162||null);}},'position':{'type':Sequelize[_0x441b('0xb')]},'count':{'type':Sequelize[_0x441b('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x441b('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x441b('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x441b('0x4')]},'queuecallerexit':{'type':Sequelize[_0x441b('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x441b('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x441b('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x441b('0x3')]},'connectedlinename':{'type':Sequelize[_0x441b('0x3')]},'accountcode':{'type':Sequelize[_0x441b('0x3')]},'context':{'type':Sequelize[_0x441b('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x441b('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x441b('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x441b('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x441b('0x3')]},'transfer':{'type':Sequelize[_0x441b('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x441b('0x3')],'comment':_0x441b('0xd')},'transferexten':{'type':Sequelize[_0x441b('0x3')]},'transferuniqueid':{'type':Sequelize[_0x441b('0x3')]},'disposition':{'type':Sequelize[_0x441b('0x3')]},'secondDisposition':{'type':Sequelize[_0x441b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x441b('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x441b('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa136=['setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt'];(function(_0x13e30c,_0x41251a){var _0x4447a9=function(_0x168834){while(--_0x168834){_0x13e30c['push'](_0x13e30c['shift']());}};_0x4447a9(++_0x41251a);}(_0xa136,0x176));var _0x6a13=function(_0xa0be1c,_0x152d5d){_0xa0be1c=_0xa0be1c-0x0;var _0x546eec=_0xa136[_0xa0be1c];return _0x546eec;};'use strict';var Sequelize=require(_0x6a13('0x0'));var moment=require('moment');module[_0x6a13('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6a13('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6a13('0x2')]},'queue':{'type':Sequelize[_0x6a13('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x6a13('0x3')],'set':function(_0x41bfda){var _0xa0807c=moment(_0x41bfda);var _0x3b73e3=moment(this[_0x6a13('0x4')](_0x6a13('0x5')))[_0x6a13('0x6')](_0x6a13('0x7'));var _0x459bbe=_0xa0807c['diff'](_0x3b73e3,_0x6a13('0x8'));this['setDataValue'](_0x6a13('0x9'),_0x41bfda);this[_0x6a13('0xa')](_0x6a13('0xb'),_0x459bbe||null);}},'position':{'type':Sequelize[_0x6a13('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6a13('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x6a13('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6a13('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x6a13('0x2')],'comment':_0x6a13('0xe')},'originalposition':{'type':Sequelize[_0x6a13('0xc')]},'channel':{'type':Sequelize[_0x6a13('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6a13('0x2')]},'connectedlinename':{'type':Sequelize[_0x6a13('0x2')]},'accountcode':{'type':Sequelize[_0x6a13('0x2')]},'context':{'type':Sequelize[_0x6a13('0x2')]},'exten':{'type':Sequelize[_0x6a13('0x2')]},'priority':{'type':Sequelize[_0x6a13('0x2')]},'holdtime':{'type':Sequelize[_0x6a13('0xc')]},'mohtime':{'type':Sequelize[_0x6a13('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6a13('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6a13('0x2')],'comment':_0x6a13('0xf')},'transferexten':{'type':Sequelize[_0x6a13('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6a13('0x2')]},'disposition':{'type':Sequelize[_0x6a13('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6a13('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x6a13('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index fe3497f..a744e15 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 _0x69b5=['includeAll','include','options','create','body','find','params','describe','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','then','findAll','rows','catch','show','keys','fields'];(function(_0x1f4674,_0x146085){var _0x3e7f42=function(_0x4bd366){while(--_0x4bd366){_0x1f4674['push'](_0x1f4674['shift']());}};_0x3e7f42(++_0x146085);}(_0x69b5,0x1a3));var _0x569b=function(_0x7eee15,_0x3fe21a){_0x7eee15=_0x7eee15-0x0;var _0x7ad23=_0x69b5[_0x7eee15];return _0x7ad23;};'use strict';var emlformat=require(_0x569b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x569b('0x1'));var jsonpatch=require(_0x569b('0x2'));var rp=require(_0x569b('0x3'));var moment=require(_0x569b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x569b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x569b('0x6'));var _=require(_0x569b('0x7'));var squel=require(_0x569b('0x8'));var crypto=require(_0x569b('0x9'));var jsforce=require(_0x569b('0xa'));var deskjs=require(_0x569b('0xb'));var toCsv=require(_0x569b('0xc'));var querystring=require(_0x569b('0xd'));var Papa=require(_0x569b('0xe'));var Redis=require(_0x569b('0xf'));var authService=require(_0x569b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x569b('0x11'));var logger=require(_0x569b('0x12'))(_0x569b('0x13'));var utils=require(_0x569b('0x14'));var config=require(_0x569b('0x15'));var licenseUtil=require(_0x569b('0x16'));var db=require(_0x569b('0x17'))['db'];config['redis']=_['defaults'](config[_0x569b('0x18')],{'host':_0x569b('0x19'),'port':0x18eb});var socket=require(_0x569b('0x1a'))(new Redis(config[_0x569b('0x18')]));require(_0x569b('0x1b'))[_0x569b('0x1c')](socket);function respondWithStatusCode(_0x1109f0,_0x543df3){_0x543df3=_0x543df3||0xcc;return function(_0x31c00f){if(_0x31c00f){return _0x1109f0['sendStatus'](_0x543df3);}return _0x1109f0[_0x569b('0x1d')](_0x543df3)['end']();};}function respondWithResult(_0x167b4f,_0x1075b8){_0x1075b8=_0x1075b8||0xc8;return function(_0x15f6b0){if(_0x15f6b0){return _0x167b4f[_0x569b('0x1d')](_0x1075b8)[_0x569b('0x1e')](_0x15f6b0);}};}function respondWithFilteredResult(_0xd33fa7,_0x2ad567){return function(_0x2b3494){if(_0x2b3494){var _0x142c45=typeof _0x2ad567['offset']===_0x569b('0x1f')&&typeof _0x2ad567[_0x569b('0x20')]===_0x569b('0x1f');var _0x9d1518=_0x2b3494[_0x569b('0x21')];var _0x2a1f30=_0x142c45?0x0:_0x2ad567['offset'];var _0x10d55a=_0x142c45?_0x2b3494[_0x569b('0x21')]:_0x2ad567[_0x569b('0x22')]+_0x2ad567['limit'];var _0x3061bc;if(_0x10d55a>=_0x9d1518){_0x10d55a=_0x9d1518;_0x3061bc=0xc8;}else{_0x3061bc=0xce;}_0xd33fa7[_0x569b('0x1d')](_0x3061bc);return _0xd33fa7['set']('Content-Range',_0x2a1f30+'-'+_0x10d55a+'/'+_0x9d1518)[_0x569b('0x1e')](_0x2b3494);}return null;};}function patchUpdates(_0x3615de){return function(_0x274e96){try{jsonpatch[_0x569b('0x23')](_0x274e96,_0x3615de,!![]);}catch(_0x48d11e){return BPromise[_0x569b('0x24')](_0x48d11e);}return _0x274e96[_0x569b('0x25')]();};}function saveUpdates(_0x44c64b,_0x45c848){return function(_0x1129d6){if(_0x1129d6){return _0x1129d6[_0x569b('0x26')](_0x44c64b)['then'](function(_0x4b6f23){return _0x4b6f23;});}return null;};}function removeEntity(_0x12f38a,_0x187617){return function(_0x465d65){if(_0x465d65){return _0x465d65[_0x569b('0x27')]()['then'](function(){_0x12f38a['status'](0xcc)[_0x569b('0x28')]();});}};}function handleEntityNotFound(_0x54e334,_0x47595e){return function(_0x5c0f04){if(!_0x5c0f04){_0x54e334['sendStatus'](0x194);}return _0x5c0f04;};}function handleError(_0x20382d,_0x1d94f0){_0x1d94f0=_0x1d94f0||0x1f4;return function(_0x3be586){logger[_0x569b('0x29')](_0x3be586[_0x569b('0x2a')]);if(_0x3be586[_0x569b('0x2b')]){delete _0x3be586['name'];}_0x20382d[_0x569b('0x1d')](_0x1d94f0)[_0x569b('0x2c')](_0x3be586);};}exports[_0x569b('0x2d')]=function(_0x59f3d,_0x186990){var _0x5d4377={},_0x526ab3={},_0x59a912={'count':0x0,'rows':[]};var _0x337597=_[_0x569b('0x2e')](db[_0x569b('0x2f')][_0x569b('0x30')],function(_0x204db5){return{'name':_0x204db5['fieldName'],'type':_0x204db5[_0x569b('0x31')][_0x569b('0x32')]};});_0x526ab3[_0x569b('0x33')]=_['map'](_0x337597,_0x569b('0x2b'));_0x526ab3[_0x569b('0x34')]=_['keys'](_0x59f3d[_0x569b('0x34')]);_0x526ab3[_0x569b('0x35')]=_[_0x569b('0x36')](_0x526ab3[_0x569b('0x33')],_0x526ab3['query']);_0x5d4377[_0x569b('0x37')]=_['intersection'](_0x526ab3[_0x569b('0x33')],qs['fields'](_0x59f3d[_0x569b('0x34')]['fields']));_0x5d4377['attributes']=_0x5d4377[_0x569b('0x37')][_0x569b('0x38')]?_0x5d4377[_0x569b('0x37')]:_0x526ab3[_0x569b('0x33')];if(!_0x59f3d['query'][_0x569b('0x39')](_0x569b('0x3a'))){_0x5d4377[_0x569b('0x20')]=qs[_0x569b('0x20')](_0x59f3d[_0x569b('0x34')][_0x569b('0x20')]);_0x5d4377[_0x569b('0x22')]=qs[_0x569b('0x22')](_0x59f3d[_0x569b('0x34')][_0x569b('0x22')]);}_0x5d4377[_0x569b('0x3b')]=qs[_0x569b('0x3c')](_0x59f3d[_0x569b('0x34')]['sort']);_0x5d4377[_0x569b('0x3d')]=qs['filters'](_[_0x569b('0x3e')](_0x59f3d[_0x569b('0x34')],_0x526ab3[_0x569b('0x35')]),_0x337597);if(_0x59f3d[_0x569b('0x34')][_0x569b('0x3f')]){_0x5d4377[_0x569b('0x3d')]=_['merge'](_0x5d4377['where'],{'$or':_[_0x569b('0x2e')](_0x337597,function(_0x5a40e2){if(_0x5a40e2[_0x569b('0x31')]!==_0x569b('0x40')){var _0x4f6b8c={};_0x4f6b8c[_0x5a40e2['name']]={'$like':'%'+_0x59f3d['query'][_0x569b('0x3f')]+'%'};return _0x4f6b8c;}})});}_0x5d4377=_[_0x569b('0x41')]({},_0x5d4377,_0x59f3d['options']);var _0x2d5e71={'where':_0x5d4377[_0x569b('0x3d')]};return db[_0x569b('0x2f')]['count'](_0x2d5e71)[_0x569b('0x42')](function(_0x3fd219){_0x59a912[_0x569b('0x21')]=_0x3fd219;if(_0x59f3d[_0x569b('0x34')]['includeAll']){_0x5d4377['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x569b('0x43')](_0x5d4377);})[_0x569b('0x42')](function(_0x47363b){_0x59a912[_0x569b('0x44')]=_0x47363b;return _0x59a912;})['then'](respondWithFilteredResult(_0x186990,_0x5d4377))[_0x569b('0x45')](handleError(_0x186990,null));};exports[_0x569b('0x46')]=function(_0x4ac9c9,_0x116552){var _0x4ef2b5={'raw':![],'where':{'id':_0x4ac9c9['params']['id']}},_0x3aa9f9={};_0x3aa9f9['model']=_[_0x569b('0x47')](db[_0x569b('0x2f')][_0x569b('0x30')]);_0x3aa9f9[_0x569b('0x34')]=_[_0x569b('0x47')](_0x4ac9c9[_0x569b('0x34')]);_0x3aa9f9['filters']=_[_0x569b('0x36')](_0x3aa9f9[_0x569b('0x33')],_0x3aa9f9[_0x569b('0x34')]);_0x4ef2b5[_0x569b('0x37')]=_[_0x569b('0x36')](_0x3aa9f9['model'],qs[_0x569b('0x48')](_0x4ac9c9[_0x569b('0x34')][_0x569b('0x48')]));_0x4ef2b5[_0x569b('0x37')]=_0x4ef2b5[_0x569b('0x37')][_0x569b('0x38')]?_0x4ef2b5[_0x569b('0x37')]:_0x3aa9f9[_0x569b('0x33')];if(_0x4ac9c9['query'][_0x569b('0x49')]){_0x4ef2b5[_0x569b('0x4a')]=[{'all':!![]}];}_0x4ef2b5=_[_0x569b('0x41')]({},_0x4ef2b5,_0x4ac9c9[_0x569b('0x4b')]);return db[_0x569b('0x2f')]['find'](_0x4ef2b5)[_0x569b('0x42')](handleEntityNotFound(_0x116552,null))[_0x569b('0x42')](respondWithResult(_0x116552,null))[_0x569b('0x45')](handleError(_0x116552,null));};exports['create']=function(_0x2c187b,_0x5d8f70){return db[_0x569b('0x2f')][_0x569b('0x4c')](_0x2c187b['body'],{})[_0x569b('0x42')](respondWithResult(_0x5d8f70,0xc9))[_0x569b('0x45')](handleError(_0x5d8f70,null));};exports[_0x569b('0x26')]=function(_0x4ebe32,_0x10cc8f){if(_0x4ebe32[_0x569b('0x4d')]['id']){delete _0x4ebe32[_0x569b('0x4d')]['id'];}return db[_0x569b('0x2f')][_0x569b('0x4e')]({'where':{'id':_0x4ebe32['params']['id']}})[_0x569b('0x42')](handleEntityNotFound(_0x10cc8f,null))[_0x569b('0x42')](saveUpdates(_0x4ebe32['body'],null))[_0x569b('0x42')](respondWithResult(_0x10cc8f,null))[_0x569b('0x45')](handleError(_0x10cc8f,null));};exports[_0x569b('0x27')]=function(_0x14fcbe,_0x399b54){return db[_0x569b('0x2f')][_0x569b('0x4e')]({'where':{'id':_0x14fcbe[_0x569b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x399b54,null))['then'](removeEntity(_0x399b54,null))[_0x569b('0x45')](handleError(_0x399b54,null));};exports['describe']=function(_0x23406e,_0x4ef664){return db[_0x569b('0x2f')][_0x569b('0x50')]()['then'](respondWithResult(_0x4ef664,null))['catch'](handleError(_0x4ef664,null));};exports[_0x569b('0x51')]=function(_0xbcdd53,_0x415c31){var _0x1ff3bf={},_0x5ed45c={},_0x2b5497={'count':0x0,'rows':[]};_0x5ed45c[_0x569b('0x33')]=_['keys'](db[_0x569b('0x2f')][_0x569b('0x30')]);_0x5ed45c[_0x569b('0x34')]=_[_0x569b('0x47')](_0xbcdd53['query']);_0x5ed45c['filters']=_[_0x569b('0x36')](_0x5ed45c[_0x569b('0x33')],_0x5ed45c['query']);_0x1ff3bf[_0x569b('0x37')]=_['intersection'](_0x5ed45c[_0x569b('0x33')],qs[_0x569b('0x48')](_0xbcdd53['query'][_0x569b('0x48')]));_0x1ff3bf[_0x569b('0x37')]=_0x1ff3bf[_0x569b('0x37')][_0x569b('0x38')]?_0x1ff3bf[_0x569b('0x37')]:_0x5ed45c['model'];if(!_0xbcdd53[_0x569b('0x34')][_0x569b('0x39')](_0x569b('0x3a'))){_0x1ff3bf[_0x569b('0x20')]=qs[_0x569b('0x20')](_0xbcdd53[_0x569b('0x34')][_0x569b('0x20')]);_0x1ff3bf['offset']=qs[_0x569b('0x22')](_0xbcdd53[_0x569b('0x34')][_0x569b('0x22')]);}_0x1ff3bf[_0x569b('0x3b')]=qs[_0x569b('0x3c')](_0xbcdd53[_0x569b('0x34')][_0x569b('0x3c')]);_0x1ff3bf[_0x569b('0x3d')]=qs['filters'](_['pick'](_0xbcdd53[_0x569b('0x34')],_0x5ed45c[_0x569b('0x35')]));if(_0xbcdd53[_0x569b('0x34')][_0x569b('0x3f')]){_0x1ff3bf[_0x569b('0x3d')]=_[_0x569b('0x41')](_0x1ff3bf[_0x569b('0x3d')],{'$or':_[_0x569b('0x2e')](_0x1ff3bf[_0x569b('0x37')],function(_0xad58bf){var _0x4e6338={};_0x4e6338[_0xad58bf]={'$like':'%'+_0xbcdd53[_0x569b('0x34')][_0x569b('0x3f')]+'%'};return _0x4e6338;})});}_0x1ff3bf=_['merge']({},_0x1ff3bf,_0xbcdd53[_0x569b('0x4b')]);var _0x2ece27={'where':_0x1ff3bf[_0x569b('0x3d')]};return db[_0x569b('0x2f')]['count'](_0x2ece27)[_0x569b('0x42')](function(_0x25499b){_0x2b5497[_0x569b('0x21')]=_0x25499b;if(_0xbcdd53[_0x569b('0x34')][_0x569b('0x49')]){_0x1ff3bf['include']=[{'all':!![]}];}return db[_0x569b('0x2f')][_0x569b('0x43')](_0x1ff3bf);})[_0x569b('0x42')](function(_0x129e0d){_0x2b5497[_0x569b('0x44')]=_0x129e0d;return _0x2b5497;})['then'](respondWithFilteredResult(_0x415c31,_0x1ff3bf,_0x569b('0x51')))[_0x569b('0x45')](handleError(_0x415c31,null,_0x569b('0x51')));}; \ No newline at end of file +var _0x7dec=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','catch','show','params','find','create','body','describe','filter','rows','getVoiceQueuesReport','eml-format'];(function(_0xe1bef,_0x547214){var _0x5717a8=function(_0x32243a){while(--_0x32243a){_0xe1bef['push'](_0xe1bef['shift']());}};_0x5717a8(++_0x547214);}(_0x7dec,0x1ad));var _0xc7de=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x7dec[_0x3bef2c];return _0x331503;};'use strict';var emlformat=require(_0xc7de('0x0'));var rimraf=require(_0xc7de('0x1'));var zipdir=require(_0xc7de('0x2'));var jsonpatch=require(_0xc7de('0x3'));var rp=require(_0xc7de('0x4'));var moment=require(_0xc7de('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc7de('0x6'));var util=require('util');var path=require(_0xc7de('0x7'));var sox=require('sox');var csv=require(_0xc7de('0x8'));var ejs=require(_0xc7de('0x9'));var fs=require('fs');var fs_extra=require(_0xc7de('0xa'));var _=require(_0xc7de('0xb'));var squel=require(_0xc7de('0xc'));var crypto=require(_0xc7de('0xd'));var jsforce=require(_0xc7de('0xe'));var deskjs=require(_0xc7de('0xf'));var toCsv=require(_0xc7de('0x8'));var querystring=require('querystring');var Papa=require(_0xc7de('0x10'));var Redis=require(_0xc7de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc7de('0x12'));var as=require(_0xc7de('0x13'));var hardwareService=require(_0xc7de('0x14'));var logger=require(_0xc7de('0x15'))(_0xc7de('0x16'));var utils=require(_0xc7de('0x17'));var config=require(_0xc7de('0x18'));var licenseUtil=require(_0xc7de('0x19'));var db=require(_0xc7de('0x1a'))['db'];config['redis']=_[_0xc7de('0x1b')](config[_0xc7de('0x1c')],{'host':_0xc7de('0x1d'),'port':0x18eb});var socket=require(_0xc7de('0x1e'))(new Redis(config[_0xc7de('0x1c')]));require('./voiceQueueReport.socket')[_0xc7de('0x1f')](socket);function respondWithStatusCode(_0x3b944,_0x5c2a33){_0x5c2a33=_0x5c2a33||0xcc;return function(_0x5396b9){if(_0x5396b9){return _0x3b944[_0xc7de('0x20')](_0x5c2a33);}return _0x3b944['status'](_0x5c2a33)[_0xc7de('0x21')]();};}function respondWithResult(_0x4f53fa,_0x4604f7){_0x4604f7=_0x4604f7||0xc8;return function(_0x22be3f){if(_0x22be3f){return _0x4f53fa[_0xc7de('0x22')](_0x4604f7)[_0xc7de('0x23')](_0x22be3f);}};}function respondWithFilteredResult(_0x48e0cd,_0x101dc6){return function(_0x528bcf){if(_0x528bcf){var _0x41bb56=typeof _0x101dc6[_0xc7de('0x24')]===_0xc7de('0x25')&&typeof _0x101dc6['limit']===_0xc7de('0x25');var _0x13947f=_0x528bcf[_0xc7de('0x26')];var _0x28d4cd=_0x41bb56?0x0:_0x101dc6[_0xc7de('0x24')];var _0x3187d7=_0x41bb56?_0x528bcf[_0xc7de('0x26')]:_0x101dc6[_0xc7de('0x24')]+_0x101dc6[_0xc7de('0x27')];var _0x4b872;if(_0x3187d7>=_0x13947f){_0x3187d7=_0x13947f;_0x4b872=0xc8;}else{_0x4b872=0xce;}_0x48e0cd[_0xc7de('0x22')](_0x4b872);return _0x48e0cd[_0xc7de('0x28')](_0xc7de('0x29'),_0x28d4cd+'-'+_0x3187d7+'/'+_0x13947f)[_0xc7de('0x23')](_0x528bcf);}return null;};}function patchUpdates(_0x5c9f6e){return function(_0x24c447){try{jsonpatch[_0xc7de('0x2a')](_0x24c447,_0x5c9f6e,!![]);}catch(_0x575748){return BPromise['reject'](_0x575748);}return _0x24c447[_0xc7de('0x2b')]();};}function saveUpdates(_0x1f0c56,_0x300b91){return function(_0x2d31d1){if(_0x2d31d1){return _0x2d31d1[_0xc7de('0x2c')](_0x1f0c56)['then'](function(_0x5be01c){return _0x5be01c;});}return null;};}function removeEntity(_0x1fde80,_0x166d53){return function(_0x11c5f5){if(_0x11c5f5){return _0x11c5f5[_0xc7de('0x2d')]()[_0xc7de('0x2e')](function(){_0x1fde80['status'](0xcc)[_0xc7de('0x21')]();});}};}function handleEntityNotFound(_0x42d680,_0x1ac7bb){return function(_0x3f0562){if(!_0x3f0562){_0x42d680[_0xc7de('0x20')](0x194);}return _0x3f0562;};}function handleError(_0x1dc85c,_0x12e25e){_0x12e25e=_0x12e25e||0x1f4;return function(_0x3aad44){logger[_0xc7de('0x2f')](_0x3aad44[_0xc7de('0x30')]);if(_0x3aad44[_0xc7de('0x31')]){delete _0x3aad44[_0xc7de('0x31')];}_0x1dc85c[_0xc7de('0x22')](_0x12e25e)['send'](_0x3aad44);};}exports['index']=function(_0x5e26b2,_0x5edf51){var _0x1cf2bb={},_0x7576b1={},_0x594d70={'count':0x0,'rows':[]};var _0x1bb025=_[_0xc7de('0x32')](db['VoiceQueueReport'][_0xc7de('0x33')],function(_0x12a16e){return{'name':_0x12a16e[_0xc7de('0x34')],'type':_0x12a16e['type'][_0xc7de('0x35')]};});_0x7576b1['model']=_[_0xc7de('0x32')](_0x1bb025,_0xc7de('0x31'));_0x7576b1[_0xc7de('0x36')]=_[_0xc7de('0x37')](_0x5e26b2[_0xc7de('0x36')]);_0x7576b1[_0xc7de('0x38')]=_['intersection'](_0x7576b1[_0xc7de('0x39')],_0x7576b1['query']);_0x1cf2bb[_0xc7de('0x3a')]=_[_0xc7de('0x3b')](_0x7576b1[_0xc7de('0x39')],qs[_0xc7de('0x3c')](_0x5e26b2[_0xc7de('0x36')][_0xc7de('0x3c')]));_0x1cf2bb[_0xc7de('0x3a')]=_0x1cf2bb[_0xc7de('0x3a')][_0xc7de('0x3d')]?_0x1cf2bb[_0xc7de('0x3a')]:_0x7576b1[_0xc7de('0x39')];if(!_0x5e26b2[_0xc7de('0x36')][_0xc7de('0x3e')](_0xc7de('0x3f'))){_0x1cf2bb['limit']=qs[_0xc7de('0x27')](_0x5e26b2[_0xc7de('0x36')][_0xc7de('0x27')]);_0x1cf2bb[_0xc7de('0x24')]=qs[_0xc7de('0x24')](_0x5e26b2['query'][_0xc7de('0x24')]);}_0x1cf2bb[_0xc7de('0x40')]=qs[_0xc7de('0x41')](_0x5e26b2[_0xc7de('0x36')][_0xc7de('0x41')]);_0x1cf2bb[_0xc7de('0x42')]=qs['filters'](_[_0xc7de('0x43')](_0x5e26b2[_0xc7de('0x36')],_0x7576b1['filters']),_0x1bb025);if(_0x5e26b2['query']['filter']){_0x1cf2bb[_0xc7de('0x42')]=_[_0xc7de('0x44')](_0x1cf2bb['where'],{'$or':_['map'](_0x1bb025,function(_0x4971bb){if(_0x4971bb[_0xc7de('0x45')]!==_0xc7de('0x46')){var _0x1ace80={};_0x1ace80[_0x4971bb['name']]={'$like':'%'+_0x5e26b2[_0xc7de('0x36')]['filter']+'%'};return _0x1ace80;}})});}_0x1cf2bb=_[_0xc7de('0x44')]({},_0x1cf2bb,_0x5e26b2[_0xc7de('0x47')]);var _0x59561e={'where':_0x1cf2bb[_0xc7de('0x42')]};return db[_0xc7de('0x48')][_0xc7de('0x26')](_0x59561e)[_0xc7de('0x2e')](function(_0x5798fb){_0x594d70[_0xc7de('0x26')]=_0x5798fb;if(_0x5e26b2[_0xc7de('0x36')][_0xc7de('0x49')]){_0x1cf2bb[_0xc7de('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xc7de('0x4b')](_0x1cf2bb);})[_0xc7de('0x2e')](function(_0x5f09ec){_0x594d70['rows']=_0x5f09ec;return _0x594d70;})[_0xc7de('0x2e')](respondWithFilteredResult(_0x5edf51,_0x1cf2bb))[_0xc7de('0x4c')](handleError(_0x5edf51,null));};exports[_0xc7de('0x4d')]=function(_0x1b1ce9,_0x1d42b5){var _0x9908aa={'raw':![],'where':{'id':_0x1b1ce9[_0xc7de('0x4e')]['id']}},_0x125878={};_0x125878[_0xc7de('0x39')]=_['keys'](db['VoiceQueueReport'][_0xc7de('0x33')]);_0x125878[_0xc7de('0x36')]=_[_0xc7de('0x37')](_0x1b1ce9[_0xc7de('0x36')]);_0x125878['filters']=_[_0xc7de('0x3b')](_0x125878[_0xc7de('0x39')],_0x125878['query']);_0x9908aa[_0xc7de('0x3a')]=_[_0xc7de('0x3b')](_0x125878[_0xc7de('0x39')],qs[_0xc7de('0x3c')](_0x1b1ce9[_0xc7de('0x36')][_0xc7de('0x3c')]));_0x9908aa[_0xc7de('0x3a')]=_0x9908aa['attributes'][_0xc7de('0x3d')]?_0x9908aa[_0xc7de('0x3a')]:_0x125878['model'];if(_0x1b1ce9[_0xc7de('0x36')][_0xc7de('0x49')]){_0x9908aa['include']=[{'all':!![]}];}_0x9908aa=_[_0xc7de('0x44')]({},_0x9908aa,_0x1b1ce9[_0xc7de('0x47')]);return db[_0xc7de('0x48')][_0xc7de('0x4f')](_0x9908aa)[_0xc7de('0x2e')](handleEntityNotFound(_0x1d42b5,null))[_0xc7de('0x2e')](respondWithResult(_0x1d42b5,null))[_0xc7de('0x4c')](handleError(_0x1d42b5,null));};exports['create']=function(_0x28dba0,_0xe97e39){return db[_0xc7de('0x48')][_0xc7de('0x50')](_0x28dba0[_0xc7de('0x51')],{})['then'](respondWithResult(_0xe97e39,0xc9))[_0xc7de('0x4c')](handleError(_0xe97e39,null));};exports['update']=function(_0x343c19,_0x27bf6e){if(_0x343c19[_0xc7de('0x51')]['id']){delete _0x343c19[_0xc7de('0x51')]['id'];}return db[_0xc7de('0x48')][_0xc7de('0x4f')]({'where':{'id':_0x343c19[_0xc7de('0x4e')]['id']}})[_0xc7de('0x2e')](handleEntityNotFound(_0x27bf6e,null))[_0xc7de('0x2e')](saveUpdates(_0x343c19[_0xc7de('0x51')],null))[_0xc7de('0x2e')](respondWithResult(_0x27bf6e,null))['catch'](handleError(_0x27bf6e,null));};exports[_0xc7de('0x2d')]=function(_0x2dd299,_0xacbfaa){return db['VoiceQueueReport'][_0xc7de('0x4f')]({'where':{'id':_0x2dd299['params']['id']}})[_0xc7de('0x2e')](handleEntityNotFound(_0xacbfaa,null))['then'](removeEntity(_0xacbfaa,null))[_0xc7de('0x4c')](handleError(_0xacbfaa,null));};exports[_0xc7de('0x52')]=function(_0x552e2c,_0x368c0d){return db[_0xc7de('0x48')]['describe']()[_0xc7de('0x2e')](respondWithResult(_0x368c0d,null))[_0xc7de('0x4c')](handleError(_0x368c0d,null));};exports['getVoiceQueuesReport']=function(_0x550f3a,_0x32813b){var _0x3b1141={},_0x3f7170={},_0x29d0a5={'count':0x0,'rows':[]};_0x3f7170[_0xc7de('0x39')]=_[_0xc7de('0x37')](db[_0xc7de('0x48')]['rawAttributes']);_0x3f7170[_0xc7de('0x36')]=_[_0xc7de('0x37')](_0x550f3a[_0xc7de('0x36')]);_0x3f7170[_0xc7de('0x38')]=_[_0xc7de('0x3b')](_0x3f7170[_0xc7de('0x39')],_0x3f7170['query']);_0x3b1141[_0xc7de('0x3a')]=_[_0xc7de('0x3b')](_0x3f7170[_0xc7de('0x39')],qs[_0xc7de('0x3c')](_0x550f3a[_0xc7de('0x36')][_0xc7de('0x3c')]));_0x3b1141[_0xc7de('0x3a')]=_0x3b1141[_0xc7de('0x3a')]['length']?_0x3b1141['attributes']:_0x3f7170[_0xc7de('0x39')];if(!_0x550f3a['query'][_0xc7de('0x3e')](_0xc7de('0x3f'))){_0x3b1141[_0xc7de('0x27')]=qs[_0xc7de('0x27')](_0x550f3a[_0xc7de('0x36')][_0xc7de('0x27')]);_0x3b1141[_0xc7de('0x24')]=qs[_0xc7de('0x24')](_0x550f3a[_0xc7de('0x36')][_0xc7de('0x24')]);}_0x3b1141[_0xc7de('0x40')]=qs['sort'](_0x550f3a[_0xc7de('0x36')][_0xc7de('0x41')]);_0x3b1141['where']=qs[_0xc7de('0x38')](_[_0xc7de('0x43')](_0x550f3a[_0xc7de('0x36')],_0x3f7170[_0xc7de('0x38')]));if(_0x550f3a[_0xc7de('0x36')][_0xc7de('0x53')]){_0x3b1141[_0xc7de('0x42')]=_[_0xc7de('0x44')](_0x3b1141[_0xc7de('0x42')],{'$or':_['map'](_0x3b1141[_0xc7de('0x3a')],function(_0x45879c){var _0x5f287f={};_0x5f287f[_0x45879c]={'$like':'%'+_0x550f3a['query'][_0xc7de('0x53')]+'%'};return _0x5f287f;})});}_0x3b1141=_[_0xc7de('0x44')]({},_0x3b1141,_0x550f3a[_0xc7de('0x47')]);var _0x1f0386={'where':_0x3b1141[_0xc7de('0x42')]};return db[_0xc7de('0x48')][_0xc7de('0x26')](_0x1f0386)[_0xc7de('0x2e')](function(_0xad2bcd){_0x29d0a5[_0xc7de('0x26')]=_0xad2bcd;if(_0x550f3a[_0xc7de('0x36')]['includeAll']){_0x3b1141[_0xc7de('0x4a')]=[{'all':!![]}];}return db[_0xc7de('0x48')]['findAll'](_0x3b1141);})[_0xc7de('0x2e')](function(_0x36843d){_0x29d0a5[_0xc7de('0x54')]=_0x36843d;return _0x29d0a5;})[_0xc7de('0x2e')](respondWithFilteredResult(_0x32813b,_0x3b1141,'getVoiceQueuesReport'))[_0xc7de('0x4c')](handleError(_0x32813b,null,_0xc7de('0x55')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d5bc27c..066f1da 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 _0x1685=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x39cede,_0x3220e2){var _0x52ea2b=function(_0x100817){while(--_0x100817){_0x39cede['push'](_0x39cede['shift']());}};_0x52ea2b(++_0x3220e2);}(_0x1685,0x13f));var _0x5168=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x1685[_0xe73080];return _0x12cbc4;};'use strict';var EventEmitter=require(_0x5168('0x0'));var VoiceQueueReport=require(_0x5168('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5168('0x2')](0x0);var events={'afterCreate':_0x5168('0x3'),'afterUpdate':_0x5168('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3961df){return function(_0x3dc818,_0x56dbb8,_0x238db8){VoiceQueueReportEvents[_0x5168('0x5')](_0x3961df+':'+_0x3dc818['id'],_0x3dc818);VoiceQueueReportEvents[_0x5168('0x5')](_0x3961df,_0x3dc818);_0x238db8(null);};}for(var e in events){if(events[_0x5168('0x6')](e)){var event=events[e];VoiceQueueReport[_0x5168('0x7')](e,emitEvent(event));}}module[_0x5168('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x7d49=['update','remove','hasOwnProperty','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7d49,0x18b));var _0x97d4=function(_0x3ae707,_0x1c502f){_0x3ae707=_0x3ae707-0x0;var _0xa148bb=_0x7d49[_0x3ae707];return _0xa148bb;};'use strict';var EventEmitter=require(_0x97d4('0x0'));var VoiceQueueReport=require(_0x97d4('0x1'))['db'][_0x97d4('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x97d4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x97d4('0x4'),'afterDestroy':_0x97d4('0x5')};function emitEvent(_0x20963a){return function(_0x5c695b,_0x231ebe,_0x55db15){VoiceQueueReportEvents['emit'](_0x20963a+':'+_0x5c695b['id'],_0x5c695b);VoiceQueueReportEvents['emit'](_0x20963a,_0x5c695b);_0x55db15(null);};}for(var e in events){if(events[_0x97d4('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 2795fde..2cd1a67 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 _0xe20e=['uniqueid','calleridnum','lodash','util','api','moment','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue'];(function(_0x32de96,_0xa59446){var _0x32b431=function(_0x533c46){while(--_0x533c46){_0x32de96['push'](_0x32de96['shift']());}};_0x32b431(++_0xa59446);}(_0xe20e,0x195));var _0xee20=function(_0x23e02e,_0x4d26cb){_0x23e02e=_0x23e02e-0x0;var _0x2a6db8=_0xe20e[_0x23e02e];return _0x2a6db8;};'use strict';var _=require(_0xee20('0x0'));var util=require(_0xee20('0x1'));var logger=require('../../config/logger')(_0xee20('0x2'));var moment=require(_0xee20('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee20('0x4'));var rimraf=require('rimraf');var config=require(_0xee20('0x5'));var attributes=require(_0xee20('0x6'));module[_0xee20('0x7')]=function(_0x411721,_0x3ca08d){return _0x411721[_0xee20('0x8')](_0xee20('0x9'),attributes,{'tableName':_0xee20('0xa'),'paranoid':![],'indexes':[{'fields':[_0xee20('0xb')]},{'fields':[_0xee20('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28bf=['./voiceQueueReport.attributes','exports','define','moment','request-promise','rimraf','../../config/environment'];(function(_0x260200,_0x2ad688){var _0x19391f=function(_0x592306){while(--_0x592306){_0x260200['push'](_0x260200['shift']());}};_0x19391f(++_0x2ad688);}(_0x28bf,0xe3));var _0xf28b=function(_0xb64a6,_0x12f08c){_0xb64a6=_0xb64a6-0x0;var _0x28abcd=_0x28bf[_0xb64a6];return _0x28abcd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf28b('0x0'));var BPromise=require('bluebird');var rp=require(_0xf28b('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf28b('0x2'));var config=require(_0xf28b('0x3'));var attributes=require(_0xf28b('0x4'));module[_0xf28b('0x5')]=function(_0x1e3a2c,_0x43a216){return _0x1e3a2c[_0xf28b('0x6')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0597f95..5d39e03 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 _0x488b=['./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','options','raw','where','limit','include','model','attributes','map','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','body','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x488b,0x174));var _0xb488=function(_0x4400dd,_0x1f0b61){_0x4400dd=_0x4400dd-0x0;var _0x5d8001=_0x488b[_0x4400dd];return _0x5d8001;};'use strict';var _=require(_0xb488('0x0'));var util=require('util');var moment=require(_0xb488('0x1'));var BPromise=require(_0xb488('0x2'));var rs=require(_0xb488('0x3'));var fs=require('fs');var Redis=require(_0xb488('0x4'));var db=require(_0xb488('0x5'))['db'];var utils=require(_0xb488('0x6'));var logger=require('../../config/logger')(_0xb488('0x7'));var config=require('../../config/environment');var jayson=require(_0xb488('0x8'));var client=jayson[_0xb488('0x9')][_0xb488('0xa')]({'port':0x232a});config[_0xb488('0xb')]=_[_0xb488('0xc')](config[_0xb488('0xb')],{'host':_0xb488('0xd'),'port':0x18eb});var socket=require(_0xb488('0xe'))(new Redis(config[_0xb488('0xb')]));require(_0xb488('0xf'))[_0xb488('0x10')](socket);function respondWithRpcPromise(_0x541c05,_0x284ce7,_0x39bb20){return new BPromise(function(_0x3854c0,_0x5e1ef7){return client[_0xb488('0x11')](_0x541c05,_0x39bb20)[_0xb488('0x12')](function(_0x5975c2){logger['info'](_0xb488('0x13'),_0x284ce7,'request\x20sent');logger[_0xb488('0x14')](_0xb488('0x15'),_0x284ce7,'request\x20sent',JSON[_0xb488('0x16')](_0x5975c2));if(_0x5975c2[_0xb488('0x17')]){if(_0x5975c2[_0xb488('0x17')]['code']===0x1f4){logger[_0xb488('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x284ce7,_0x5975c2['error'][_0xb488('0x18')]);return _0x5e1ef7(_0x5975c2[_0xb488('0x17')][_0xb488('0x18')]);}logger[_0xb488('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x284ce7,_0x5975c2[_0xb488('0x17')][_0xb488('0x18')]);return _0x3854c0(_0x5975c2[_0xb488('0x17')][_0xb488('0x18')]);}else{logger[_0xb488('0x19')](_0xb488('0x13'),_0x284ce7,_0xb488('0x1a'));_0x3854c0(_0x5975c2[_0xb488('0x1b')]['message']);}})[_0xb488('0x1c')](function(_0x4f23ad){logger[_0xb488('0x17')](_0xb488('0x13'),_0x284ce7,_0x4f23ad);_0x5e1ef7(_0x4f23ad);});});}exports['GetVoiceQueueReport']=function(_0x28d841){var _0x313773=this;return new Promise(function(_0x74ce6d,_0x58d818){return db['VoiceQueueReport']['findAll']({'raw':_0x28d841['options']?_0x28d841[_0xb488('0x1d')][_0xb488('0x1e')]===undefined?!![]:![]:!![],'where':_0x28d841[_0xb488('0x1d')]?_0x28d841[_0xb488('0x1d')][_0xb488('0x1f')]||null:null,'attributes':_0x28d841[_0xb488('0x1d')]?_0x28d841['options']['attributes']||null:null,'limit':_0x28d841['options']?_0x28d841[_0xb488('0x1d')][_0xb488('0x20')]||null:null,'include':_0x28d841[_0xb488('0x1d')]?_0x28d841['options'][_0xb488('0x21')]?_['map'](_0x28d841[_0xb488('0x1d')]['include'],function(_0x3317a4){return{'model':db[_0x3317a4[_0xb488('0x22')]],'as':_0x3317a4['as'],'attributes':_0x3317a4[_0xb488('0x23')],'include':_0x3317a4[_0xb488('0x21')]?_[_0xb488('0x24')](_0x3317a4[_0xb488('0x21')],function(_0xec2a2d){return{'model':db[_0xec2a2d[_0xb488('0x22')]],'as':_0xec2a2d['as'],'attributes':_0xec2a2d[_0xb488('0x23')],'include':_0xec2a2d[_0xb488('0x21')]?_[_0xb488('0x24')](_0xec2a2d[_0xb488('0x21')],function(_0x451582){return{'model':db[_0x451582['model']],'as':_0x451582['as'],'attributes':_0x451582[_0xb488('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb488('0x12')](function(_0x2a8add){logger[_0xb488('0x19')](_0xb488('0x25'),_0x28d841);logger['debug']('GetVoiceQueueReport',_0x28d841,JSON[_0xb488('0x16')](_0x2a8add));_0x74ce6d(_0x2a8add);})[_0xb488('0x1c')](function(_0x1ee9f2){logger['error']('GetVoiceQueueReport',_0x1ee9f2['message'],_0x28d841);_0x58d818(_0x313773[_0xb488('0x17')](0x1f4,_0x1ee9f2['message']));});});};exports[_0xb488('0x26')]=function(_0x23253f){var _0x5c5644=this;return new Promise(function(_0x4253c8,_0x459b92){return db[_0xb488('0x27')][_0xb488('0x28')](_0x23253f['body'],{'raw':_0x23253f['options']?_0x23253f['options'][_0xb488('0x1e')]===undefined?!![]:![]:!![]})[_0xb488('0x12')](function(_0x4954ba){logger[_0xb488('0x19')](_0xb488('0x26'),_0x23253f);logger[_0xb488('0x14')](_0xb488('0x26'),_0x23253f,JSON[_0xb488('0x16')](_0x4954ba));_0x4253c8(_0x4954ba);})[_0xb488('0x1c')](function(_0x218cf7){logger[_0xb488('0x17')](_0xb488('0x26'),_0x218cf7[_0xb488('0x18')],_0x23253f);_0x459b92(_0x5c5644[_0xb488('0x17')](0x1f4,_0x218cf7[_0xb488('0x18')]));});});};exports[_0xb488('0x29')]=function(_0x104aa1){var _0x365526=this;return new Promise(function(_0xcd64ed,_0x4f88ff){return db[_0xb488('0x27')]['update'](_0x104aa1[_0xb488('0x2a')],{'raw':_0x104aa1[_0xb488('0x1d')]?_0x104aa1[_0xb488('0x1d')][_0xb488('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x104aa1[_0xb488('0x1d')]?_0x104aa1['options'][_0xb488('0x1f')]||null:null,'attributes':_0x104aa1[_0xb488('0x1d')]?_0x104aa1[_0xb488('0x1d')]['attributes']||null:null,'limit':_0x104aa1[_0xb488('0x1d')]?_0x104aa1['options'][_0xb488('0x20')]||null:null})[_0xb488('0x12')](function(_0x27c3e2){logger['info'](_0xb488('0x29'),_0x104aa1);logger['debug'](_0xb488('0x29'),_0x104aa1,JSON[_0xb488('0x16')](_0x27c3e2));_0xcd64ed(_0x27c3e2);})['catch'](function(_0x359a77){logger[_0xb488('0x17')](_0xb488('0x29'),_0x359a77[_0xb488('0x18')],_0x104aa1);_0x4f88ff(_0x365526['error'](0x1f4,_0x359a77[_0xb488('0x18')]));});});}; \ No newline at end of file +var _0x1a70=['map','model','CreateVoiceQueueReport','create','body','update','raw','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include'];(function(_0x238c37,_0x1f30ac){var _0x17848b=function(_0x2619dd){while(--_0x2619dd){_0x238c37['push'](_0x238c37['shift']());}};_0x17848b(++_0x1f30ac);}(_0x1a70,0x194));var _0x01a7=function(_0x46c974,_0x2908c5){_0x46c974=_0x46c974-0x0;var _0x2b91dc=_0x1a70[_0x46c974];return _0x2b91dc;};'use strict';var _=require('lodash');var util=require(_0x01a7('0x0'));var moment=require(_0x01a7('0x1'));var BPromise=require(_0x01a7('0x2'));var rs=require(_0x01a7('0x3'));var fs=require('fs');var Redis=require(_0x01a7('0x4'));var db=require(_0x01a7('0x5'))['db'];var utils=require(_0x01a7('0x6'));var logger=require(_0x01a7('0x7'))('rpc');var config=require(_0x01a7('0x8'));var jayson=require(_0x01a7('0x9'));var client=jayson[_0x01a7('0xa')][_0x01a7('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x01a7('0xc')],{'host':_0x01a7('0xd'),'port':0x18eb});var socket=require(_0x01a7('0xe'))(new Redis(config[_0x01a7('0xc')]));require('./voiceQueueReport.socket')[_0x01a7('0xf')](socket);function respondWithRpcPromise(_0xc6c326,_0x22fc5c,_0x370ab2){return new BPromise(function(_0x273c02,_0x5d85ee){return client[_0x01a7('0x10')](_0xc6c326,_0x370ab2)[_0x01a7('0x11')](function(_0x352dbd){logger['info'](_0x01a7('0x12'),_0x22fc5c,_0x01a7('0x13'));logger[_0x01a7('0x14')](_0x01a7('0x15'),_0x22fc5c,_0x01a7('0x13'),JSON[_0x01a7('0x16')](_0x352dbd));if(_0x352dbd[_0x01a7('0x17')]){if(_0x352dbd[_0x01a7('0x17')][_0x01a7('0x18')]===0x1f4){logger['error'](_0x01a7('0x12'),_0x22fc5c,_0x352dbd[_0x01a7('0x17')][_0x01a7('0x19')]);return _0x5d85ee(_0x352dbd['error'][_0x01a7('0x19')]);}logger[_0x01a7('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x22fc5c,_0x352dbd['error'][_0x01a7('0x19')]);return _0x273c02(_0x352dbd['error'][_0x01a7('0x19')]);}else{logger[_0x01a7('0x1a')](_0x01a7('0x12'),_0x22fc5c,_0x01a7('0x13'));_0x273c02(_0x352dbd['result'][_0x01a7('0x19')]);}})[_0x01a7('0x1b')](function(_0x158c82){logger[_0x01a7('0x17')](_0x01a7('0x12'),_0x22fc5c,_0x158c82);_0x5d85ee(_0x158c82);});});}exports[_0x01a7('0x1c')]=function(_0x259bdd){var _0xe11204=this;return new Promise(function(_0x5d83c2,_0x506ed3){return db[_0x01a7('0x1d')][_0x01a7('0x1e')]({'raw':_0x259bdd[_0x01a7('0x1f')]?_0x259bdd['options']['raw']===undefined?!![]:![]:!![],'where':_0x259bdd[_0x01a7('0x1f')]?_0x259bdd[_0x01a7('0x1f')][_0x01a7('0x20')]||null:null,'attributes':_0x259bdd['options']?_0x259bdd[_0x01a7('0x1f')][_0x01a7('0x21')]||null:null,'limit':_0x259bdd[_0x01a7('0x1f')]?_0x259bdd[_0x01a7('0x1f')][_0x01a7('0x22')]||null:null,'include':_0x259bdd[_0x01a7('0x1f')]?_0x259bdd['options'][_0x01a7('0x23')]?_[_0x01a7('0x24')](_0x259bdd[_0x01a7('0x1f')]['include'],function(_0x1a7621){return{'model':db[_0x1a7621[_0x01a7('0x25')]],'as':_0x1a7621['as'],'attributes':_0x1a7621[_0x01a7('0x21')],'include':_0x1a7621[_0x01a7('0x23')]?_[_0x01a7('0x24')](_0x1a7621[_0x01a7('0x23')],function(_0x3af10e){return{'model':db[_0x3af10e[_0x01a7('0x25')]],'as':_0x3af10e['as'],'attributes':_0x3af10e['attributes'],'include':_0x3af10e[_0x01a7('0x23')]?_[_0x01a7('0x24')](_0x3af10e[_0x01a7('0x23')],function(_0x49d9a4){return{'model':db[_0x49d9a4[_0x01a7('0x25')]],'as':_0x49d9a4['as'],'attributes':_0x49d9a4[_0x01a7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x01a7('0x11')](function(_0x2a7155){logger[_0x01a7('0x1a')]('GetVoiceQueueReport',_0x259bdd);logger[_0x01a7('0x14')](_0x01a7('0x1c'),_0x259bdd,JSON[_0x01a7('0x16')](_0x2a7155));_0x5d83c2(_0x2a7155);})['catch'](function(_0x379419){logger[_0x01a7('0x17')](_0x01a7('0x1c'),_0x379419[_0x01a7('0x19')],_0x259bdd);_0x506ed3(_0xe11204[_0x01a7('0x17')](0x1f4,_0x379419[_0x01a7('0x19')]));});});};exports[_0x01a7('0x26')]=function(_0x12d709){var _0x3c5681=this;return new Promise(function(_0x1223da,_0x1beca3){return db['VoiceQueueReport'][_0x01a7('0x27')](_0x12d709[_0x01a7('0x28')],{'raw':_0x12d709[_0x01a7('0x1f')]?_0x12d709['options']['raw']===undefined?!![]:![]:!![]})[_0x01a7('0x11')](function(_0x264d3c){logger[_0x01a7('0x1a')](_0x01a7('0x26'),_0x12d709);logger[_0x01a7('0x14')](_0x01a7('0x26'),_0x12d709,JSON[_0x01a7('0x16')](_0x264d3c));_0x1223da(_0x264d3c);})[_0x01a7('0x1b')](function(_0x156749){logger[_0x01a7('0x17')]('CreateVoiceQueueReport',_0x156749[_0x01a7('0x19')],_0x12d709);_0x1beca3(_0x3c5681['error'](0x1f4,_0x156749['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x597e99){var _0x44d8c8=this;return new Promise(function(_0x5cc013,_0x28d85c){return db[_0x01a7('0x1d')][_0x01a7('0x29')](_0x597e99[_0x01a7('0x28')],{'raw':_0x597e99[_0x01a7('0x1f')]?_0x597e99[_0x01a7('0x1f')][_0x01a7('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597e99['options']?_0x597e99['options'][_0x01a7('0x20')]||null:null,'attributes':_0x597e99[_0x01a7('0x1f')]?_0x597e99[_0x01a7('0x1f')]['attributes']||null:null,'limit':_0x597e99[_0x01a7('0x1f')]?_0x597e99[_0x01a7('0x1f')]['limit']||null:null})[_0x01a7('0x11')](function(_0x2671c5){logger['info']('UpdateVoiceQueueReport',_0x597e99);logger['debug'](_0x01a7('0x2b'),_0x597e99,JSON[_0x01a7('0x16')](_0x2671c5));_0x5cc013(_0x2671c5);})['catch'](function(_0x22b13a){logger[_0x01a7('0x17')](_0x01a7('0x2b'),_0x22b13a[_0x01a7('0x19')],_0x597e99);_0x28d85c(_0x44d8c8[_0x01a7('0x17')](0x1f4,_0x22b13a[_0x01a7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index fc8e421..24162f5 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 _0x6f54=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6f54,0xc6));var _0x46f5=function(_0xcadc68,_0x42318b){_0xcadc68=_0xcadc68-0x0;var _0x22212c=_0x6f54[_0xcadc68];return _0x22212c;};'use strict';var VoiceQueueReportEvents=require(_0x46f5('0x0'));var events=[_0x46f5('0x1'),_0x46f5('0x2'),_0x46f5('0x3')];function createListener(_0x2d0a83,_0x40fda2){return function(_0x5d1457){_0x40fda2[_0x46f5('0x4')](_0x2d0a83,_0x5d1457);};}function removeListener(_0x33567f,_0x496ef4){return function(){VoiceQueueReportEvents['removeListener'](_0x33567f,_0x496ef4);};}exports['register']=function(_0x432f5a){for(var _0xa17660=0x0,_0x5a56c2=events[_0x46f5('0x5')];_0xa17660<_0x5a56c2;_0xa17660++){var _0x1c810c=events[_0xa17660];var _0x2bcb74=createListener(_0x46f5('0x6')+_0x1c810c,_0x432f5a);VoiceQueueReportEvents['on'](_0x1c810c,_0x2bcb74);}}; \ No newline at end of file +var _0x5144=['register','length','save','remove','update','emit','removeListener'];(function(_0x168fad,_0x58d7ff){var _0x2b312f=function(_0x1f124d){while(--_0x1f124d){_0x168fad['push'](_0x168fad['shift']());}};_0x2b312f(++_0x58d7ff);}(_0x5144,0xe2));var _0x4514=function(_0x4d4c5e,_0x20c6d7){_0x4d4c5e=_0x4d4c5e-0x0;var _0x39d475=_0x5144[_0x4d4c5e];return _0x39d475;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x4514('0x0'),_0x4514('0x1'),_0x4514('0x2')];function createListener(_0x2fc838,_0x288608){return function(_0x56397c){_0x288608[_0x4514('0x3')](_0x2fc838,_0x56397c);};}function removeListener(_0x58803f,_0x4058b9){return function(){VoiceQueueReportEvents[_0x4514('0x4')](_0x58803f,_0x4058b9);};}exports[_0x4514('0x5')]=function(_0x58dcc2){for(var _0xa9e360=0x0,_0xde1113=events[_0x4514('0x6')];_0xa9e360<_0xde1113;_0xa9e360++){var _0x273e20=events[_0xa9e360];var _0x397596=createListener('voiceQueueReport:'+_0x273e20,_0x58dcc2);VoiceQueueReportEvents['on'](_0x273e20,_0x397596);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b48d1af..3c14669 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 _0xfd4e=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','create','/:id','update'];(function(_0x326647,_0xfc913b){var _0x4e667f=function(_0x523a16){while(--_0x523a16){_0x326647['push'](_0x326647['shift']());}};_0x4e667f(++_0xfc913b);}(_0xfd4e,0x1a0));var _0xefd4=function(_0x15a7aa,_0x2a5580){_0x15a7aa=_0x15a7aa-0x0;var _0x1a63d3=_0xfd4e[_0x15a7aa];return _0x1a63d3;};'use strict';var multer=require('multer');var util=require(_0xefd4('0x0'));var path=require(_0xefd4('0x1'));var timeout=require(_0xefd4('0x2'));var express=require(_0xefd4('0x3'));var router=express[_0xefd4('0x4')]();var fs_extra=require(_0xefd4('0x5'));var auth=require(_0xefd4('0x6'));var interaction=require(_0xefd4('0x7'));var config=require(_0xefd4('0x8'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0xefd4('0x9')](),controller[_0xefd4('0xa')]);router[_0xefd4('0xb')]('/:id',auth[_0xefd4('0x9')](),controller['show']);router[_0xefd4('0xc')]('/',auth[_0xefd4('0x9')](),controller[_0xefd4('0xd')]);router['put'](_0xefd4('0xe'),auth[_0xefd4('0x9')](),controller[_0xefd4('0xf')]);router[_0xefd4('0x10')](_0xefd4('0xe'),auth[_0xefd4('0x9')](),controller[_0xefd4('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb745=['delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','show','create','put','update'];(function(_0x49397f,_0x39853a){var _0x2232c3=function(_0x28e477){while(--_0x28e477){_0x49397f['push'](_0x49397f['shift']());}};_0x2232c3(++_0x39853a);}(_0xb745,0xe0));var _0x5b74=function(_0x103ff9,_0x576a4d){_0x103ff9=_0x103ff9-0x0;var _0x40693e=_0xb745[_0x103ff9];return _0x40693e;};'use strict';var multer=require(_0x5b74('0x0'));var util=require(_0x5b74('0x1'));var path=require(_0x5b74('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5b74('0x3')]();var fs_extra=require(_0x5b74('0x4'));var auth=require(_0x5b74('0x5'));var interaction=require(_0x5b74('0x6'));var config=require(_0x5b74('0x7'));var controller=require(_0x5b74('0x8'));router['get']('/',auth[_0x5b74('0x9')](),controller[_0x5b74('0xa')]);router[_0x5b74('0xb')]('/:id',auth[_0x5b74('0x9')](),controller[_0x5b74('0xc')]);router['post']('/',auth[_0x5b74('0x9')](),controller[_0x5b74('0xd')]);router[_0x5b74('0xe')]('/:id',auth[_0x5b74('0x9')](),controller[_0x5b74('0xf')]);router[_0x5b74('0x10')](_0x5b74('0x11'),auth[_0x5b74('0x9')](),controller[_0x5b74('0x12')]);module[_0x5b74('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d8f8eeb..6042530 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 _0xc712=['sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0xc712,0xbd));var _0x2c71=function(_0x2595a6,_0x48fc45){_0x2595a6=_0x2595a6-0x0;var _0x460197=_0xc712[_0x2595a6];return _0x460197;};'use strict';var Sequelize=require(_0x2c71('0x0'));var moment=require(_0x2c71('0x1'));module[_0x2c71('0x2')]={'time':{'type':Sequelize[_0x2c71('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2c71('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2c71('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x2c71('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x2c71('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x2c71('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x2c71('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x2c71('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2c71('0x4')],'allowNull':![],'defaultValue':moment()[_0x2c71('0x5')](_0x2c71('0x6'))}}; \ No newline at end of file +var _0x3c02=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x271371,_0x5d8c5d){var _0x3c9e22=function(_0x2068bc){while(--_0x2068bc){_0x271371['push'](_0x271371['shift']());}};_0x3c9e22(++_0x5d8c5d);}(_0x3c02,0x146));var _0x23c0=function(_0xdbc676,_0xe702f9){_0xdbc676=_0xdbc676-0x0;var _0x5ec3cf=_0x3c02[_0xdbc676];return _0x5ec3cf;};'use strict';var Sequelize=require(_0x23c0('0x0'));var moment=require(_0x23c0('0x1'));module[_0x23c0('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x23c0('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x23c0('0x4')],'allowNull':![],'defaultValue':moment()[_0x23c0('0x5')](_0x23c0('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4e82cdb..e2f77fd 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 _0xfdc6=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','index','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','intersection'];(function(_0x4a16c7,_0x3fce36){var _0x850c78=function(_0x474d33){while(--_0x474d33){_0x4a16c7['push'](_0x4a16c7['shift']());}};_0x850c78(++_0x3fce36);}(_0xfdc6,0x129));var _0x6fdc=function(_0x5d1d6c,_0x8c94ff){_0x5d1d6c=_0x5d1d6c-0x0;var _0x3f4b02=_0xfdc6[_0x5d1d6c];return _0x3f4b02;};'use strict';var emlformat=require(_0x6fdc('0x0'));var rimraf=require(_0x6fdc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fdc('0x2'));var rp=require(_0x6fdc('0x3'));var moment=require(_0x6fdc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6fdc('0x5'));var sox=require(_0x6fdc('0x6'));var csv=require(_0x6fdc('0x7'));var ejs=require(_0x6fdc('0x8'));var fs=require('fs');var fs_extra=require(_0x6fdc('0x9'));var _=require(_0x6fdc('0xa'));var squel=require(_0x6fdc('0xb'));var crypto=require(_0x6fdc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6fdc('0xd'));var toCsv=require(_0x6fdc('0x7'));var querystring=require('querystring');var Papa=require(_0x6fdc('0xe'));var Redis=require('ioredis');var authService=require(_0x6fdc('0xf'));var qs=require(_0x6fdc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fdc('0x11'));var logger=require(_0x6fdc('0x12'))(_0x6fdc('0x13'));var utils=require(_0x6fdc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6fdc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58f68f,_0x1f3f62){_0x1f3f62=_0x1f3f62||0xcc;return function(_0xd0a207){if(_0xd0a207){return _0x58f68f[_0x6fdc('0x16')](_0x1f3f62);}return _0x58f68f[_0x6fdc('0x17')](_0x1f3f62)[_0x6fdc('0x18')]();};}function respondWithResult(_0xae6848,_0x714038){_0x714038=_0x714038||0xc8;return function(_0x28774c){if(_0x28774c){return _0xae6848[_0x6fdc('0x17')](_0x714038)[_0x6fdc('0x19')](_0x28774c);}};}function respondWithFilteredResult(_0x48e1ac,_0x562919){return function(_0x53cc9b){if(_0x53cc9b){var _0x61caf9=typeof _0x562919[_0x6fdc('0x1a')]===_0x6fdc('0x1b')&&typeof _0x562919[_0x6fdc('0x1c')]===_0x6fdc('0x1b');var _0x43a216=_0x53cc9b[_0x6fdc('0x1d')];var _0x3e4258=_0x61caf9?0x0:_0x562919['offset'];var _0x3e484a=_0x61caf9?_0x53cc9b['count']:_0x562919['offset']+_0x562919[_0x6fdc('0x1c')];var _0x1f75dc;if(_0x3e484a>=_0x43a216){_0x3e484a=_0x43a216;_0x1f75dc=0xc8;}else{_0x1f75dc=0xce;}_0x48e1ac[_0x6fdc('0x17')](_0x1f75dc);return _0x48e1ac[_0x6fdc('0x1e')](_0x6fdc('0x1f'),_0x3e4258+'-'+_0x3e484a+'/'+_0x43a216)[_0x6fdc('0x19')](_0x53cc9b);}return null;};}function patchUpdates(_0x250cb2){return function(_0x3b6699){try{jsonpatch['apply'](_0x3b6699,_0x250cb2,!![]);}catch(_0x2df3d1){return BPromise[_0x6fdc('0x20')](_0x2df3d1);}return _0x3b6699[_0x6fdc('0x21')]();};}function saveUpdates(_0x32d2ab,_0x472b6c){return function(_0x59ee1b){if(_0x59ee1b){return _0x59ee1b[_0x6fdc('0x22')](_0x32d2ab)['then'](function(_0x637175){return _0x637175;});}return null;};}function removeEntity(_0xa674e4,_0x4f65fb){return function(_0x42d86f){if(_0x42d86f){return _0x42d86f['destroy']()[_0x6fdc('0x23')](function(){_0xa674e4[_0x6fdc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x565d56,_0x434a19){return function(_0x1c2458){if(!_0x1c2458){_0x565d56['sendStatus'](0x194);}return _0x1c2458;};}function handleError(_0x99da17,_0x33861b){_0x33861b=_0x33861b||0x1f4;return function(_0x3fcb3c){logger[_0x6fdc('0x24')](_0x3fcb3c['stack']);if(_0x3fcb3c[_0x6fdc('0x25')]){delete _0x3fcb3c[_0x6fdc('0x25')];}_0x99da17[_0x6fdc('0x17')](_0x33861b)['send'](_0x3fcb3c);};}exports[_0x6fdc('0x26')]=function(_0x42e03c,_0x2bf009){var _0x4772cb={},_0x3d51bb={},_0x2fb307={'count':0x0,'rows':[]};var _0x359801=_[_0x6fdc('0x27')](db[_0x6fdc('0x28')][_0x6fdc('0x29')],function(_0xb5ed25){return{'name':_0xb5ed25['fieldName'],'type':_0xb5ed25[_0x6fdc('0x2a')][_0x6fdc('0x2b')]};});_0x3d51bb[_0x6fdc('0x2c')]=_['map'](_0x359801,_0x6fdc('0x25'));_0x3d51bb[_0x6fdc('0x2d')]=_[_0x6fdc('0x2e')](_0x42e03c[_0x6fdc('0x2d')]);_0x3d51bb['filters']=_[_0x6fdc('0x2f')](_0x3d51bb[_0x6fdc('0x2c')],_0x3d51bb[_0x6fdc('0x2d')]);_0x4772cb[_0x6fdc('0x30')]=_[_0x6fdc('0x2f')](_0x3d51bb[_0x6fdc('0x2c')],qs[_0x6fdc('0x31')](_0x42e03c[_0x6fdc('0x2d')]['fields']));_0x4772cb[_0x6fdc('0x30')]=_0x4772cb['attributes'][_0x6fdc('0x32')]?_0x4772cb[_0x6fdc('0x30')]:_0x3d51bb[_0x6fdc('0x2c')];if(!_0x42e03c['query'][_0x6fdc('0x33')](_0x6fdc('0x34'))){_0x4772cb['limit']=qs['limit'](_0x42e03c[_0x6fdc('0x2d')][_0x6fdc('0x1c')]);_0x4772cb[_0x6fdc('0x1a')]=qs[_0x6fdc('0x1a')](_0x42e03c['query']['offset']);}_0x4772cb['order']=qs[_0x6fdc('0x35')](_0x42e03c[_0x6fdc('0x2d')][_0x6fdc('0x35')]);_0x4772cb[_0x6fdc('0x36')]=qs[_0x6fdc('0x37')](_[_0x6fdc('0x38')](_0x42e03c[_0x6fdc('0x2d')],_0x3d51bb[_0x6fdc('0x37')]),_0x359801);if(_0x42e03c[_0x6fdc('0x2d')][_0x6fdc('0x39')]){_0x4772cb[_0x6fdc('0x36')]=_[_0x6fdc('0x3a')](_0x4772cb[_0x6fdc('0x36')],{'$or':_[_0x6fdc('0x27')](_0x359801,function(_0x4c9f4d){if(_0x4c9f4d[_0x6fdc('0x2a')]!=='VIRTUAL'){var _0x3f8e2b={};_0x3f8e2b[_0x4c9f4d['name']]={'$like':'%'+_0x42e03c[_0x6fdc('0x2d')][_0x6fdc('0x39')]+'%'};return _0x3f8e2b;}})});}_0x4772cb=_['merge']({},_0x4772cb,_0x42e03c['options']);var _0x501b8e={'where':_0x4772cb['where']};return db[_0x6fdc('0x28')]['count'](_0x501b8e)['then'](function(_0x2164fd){_0x2fb307[_0x6fdc('0x1d')]=_0x2164fd;if(_0x42e03c['query'][_0x6fdc('0x3b')]){_0x4772cb[_0x6fdc('0x3c')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x6fdc('0x3d')](_0x4772cb);})[_0x6fdc('0x23')](function(_0x1ee11e){_0x2fb307[_0x6fdc('0x3e')]=_0x1ee11e;return _0x2fb307;})[_0x6fdc('0x23')](respondWithFilteredResult(_0x2bf009,_0x4772cb))['catch'](handleError(_0x2bf009,null));};exports[_0x6fdc('0x3f')]=function(_0x533310,_0x43e2b2){var _0x54440e={'raw':!![],'where':{'id':_0x533310[_0x6fdc('0x40')]['id']}},_0x5d3605={};_0x5d3605[_0x6fdc('0x2c')]=_['keys'](db[_0x6fdc('0x28')][_0x6fdc('0x29')]);_0x5d3605['query']=_[_0x6fdc('0x2e')](_0x533310[_0x6fdc('0x2d')]);_0x5d3605[_0x6fdc('0x37')]=_['intersection'](_0x5d3605[_0x6fdc('0x2c')],_0x5d3605['query']);_0x54440e[_0x6fdc('0x30')]=_[_0x6fdc('0x2f')](_0x5d3605[_0x6fdc('0x2c')],qs[_0x6fdc('0x31')](_0x533310['query'][_0x6fdc('0x31')]));_0x54440e[_0x6fdc('0x30')]=_0x54440e[_0x6fdc('0x30')][_0x6fdc('0x32')]?_0x54440e['attributes']:_0x5d3605['model'];if(_0x533310[_0x6fdc('0x2d')]['includeAll']){_0x54440e[_0x6fdc('0x3c')]=[{'all':!![]}];}_0x54440e=_[_0x6fdc('0x3a')]({},_0x54440e,_0x533310['options']);return db[_0x6fdc('0x28')][_0x6fdc('0x41')](_0x54440e)['then'](handleEntityNotFound(_0x43e2b2,null))['then'](respondWithResult(_0x43e2b2,null))[_0x6fdc('0x42')](handleError(_0x43e2b2,null));};exports[_0x6fdc('0x43')]=function(_0xca71f6,_0x54c946){return db[_0x6fdc('0x28')][_0x6fdc('0x43')](_0xca71f6[_0x6fdc('0x44')],{})[_0x6fdc('0x23')](respondWithResult(_0x54c946,0xc9))[_0x6fdc('0x42')](handleError(_0x54c946,null));};exports[_0x6fdc('0x22')]=function(_0x5cf6c9,_0x464b2d){if(_0x5cf6c9['body']['id']){delete _0x5cf6c9[_0x6fdc('0x44')]['id'];}return db[_0x6fdc('0x28')][_0x6fdc('0x41')]({'where':{'id':_0x5cf6c9[_0x6fdc('0x40')]['id']}})[_0x6fdc('0x23')](handleEntityNotFound(_0x464b2d,null))['then'](saveUpdates(_0x5cf6c9[_0x6fdc('0x44')],null))['then'](respondWithResult(_0x464b2d,null))[_0x6fdc('0x42')](handleError(_0x464b2d,null));};exports['destroy']=function(_0x2ba4e8,_0x3cba63){return db[_0x6fdc('0x28')][_0x6fdc('0x41')]({'where':{'id':_0x2ba4e8[_0x6fdc('0x40')]['id']}})[_0x6fdc('0x23')](handleEntityNotFound(_0x3cba63,null))[_0x6fdc('0x23')](removeEntity(_0x3cba63,null))['catch'](handleError(_0x3cba63,null));}; \ No newline at end of file +var _0xf5a8=['VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','catch','update','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x2adf40,_0x446dab){var _0x4f536a=function(_0x47ba0a){while(--_0x47ba0a){_0x2adf40['push'](_0x2adf40['shift']());}};_0x4f536a(++_0x446dab);}(_0xf5a8,0x134));var _0x8f5a=function(_0x1a97cb,_0x3e174c){_0x1a97cb=_0x1a97cb-0x0;var _0x4ab190=_0xf5a8[_0x1a97cb];return _0x4ab190;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f5a('0x0'));var zipdir=require(_0x8f5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8f5a('0x2'));var BPromise=require(_0x8f5a('0x3'));var Mustache=require(_0x8f5a('0x4'));var util=require(_0x8f5a('0x5'));var path=require(_0x8f5a('0x6'));var sox=require(_0x8f5a('0x7'));var csv=require(_0x8f5a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f5a('0x9'));var _=require(_0x8f5a('0xa'));var squel=require('squel');var crypto=require(_0x8f5a('0xb'));var jsforce=require(_0x8f5a('0xc'));var deskjs=require(_0x8f5a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8f5a('0xe'));var Papa=require(_0x8f5a('0xf'));var Redis=require(_0x8f5a('0x10'));var authService=require(_0x8f5a('0x11'));var qs=require(_0x8f5a('0x12'));var as=require(_0x8f5a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f5a('0x14'));var utils=require(_0x8f5a('0x15'));var config=require(_0x8f5a('0x16'));var licenseUtil=require(_0x8f5a('0x17'));var db=require(_0x8f5a('0x18'))['db'];function respondWithStatusCode(_0x1ef7ca,_0xcd0010){_0xcd0010=_0xcd0010||0xcc;return function(_0x598445){if(_0x598445){return _0x1ef7ca[_0x8f5a('0x19')](_0xcd0010);}return _0x1ef7ca[_0x8f5a('0x1a')](_0xcd0010)[_0x8f5a('0x1b')]();};}function respondWithResult(_0x1005a9,_0x2d0615){_0x2d0615=_0x2d0615||0xc8;return function(_0x1053e0){if(_0x1053e0){return _0x1005a9[_0x8f5a('0x1a')](_0x2d0615)[_0x8f5a('0x1c')](_0x1053e0);}};}function respondWithFilteredResult(_0x11b621,_0x32670b){return function(_0x4e91ee){if(_0x4e91ee){var _0x4a19f0=typeof _0x32670b[_0x8f5a('0x1d')]===_0x8f5a('0x1e')&&typeof _0x32670b['limit']===_0x8f5a('0x1e');var _0x59804d=_0x4e91ee['count'];var _0xec25=_0x4a19f0?0x0:_0x32670b[_0x8f5a('0x1d')];var _0x103c34=_0x4a19f0?_0x4e91ee[_0x8f5a('0x1f')]:_0x32670b[_0x8f5a('0x1d')]+_0x32670b[_0x8f5a('0x20')];var _0x328614;if(_0x103c34>=_0x59804d){_0x103c34=_0x59804d;_0x328614=0xc8;}else{_0x328614=0xce;}_0x11b621[_0x8f5a('0x1a')](_0x328614);return _0x11b621[_0x8f5a('0x21')](_0x8f5a('0x22'),_0xec25+'-'+_0x103c34+'/'+_0x59804d)[_0x8f5a('0x1c')](_0x4e91ee);}return null;};}function patchUpdates(_0x3ad0ac){return function(_0x4c2dce){try{jsonpatch[_0x8f5a('0x23')](_0x4c2dce,_0x3ad0ac,!![]);}catch(_0x16410b){return BPromise[_0x8f5a('0x24')](_0x16410b);}return _0x4c2dce['save']();};}function saveUpdates(_0xfdef04,_0x5ae809){return function(_0x39b2e0){if(_0x39b2e0){return _0x39b2e0['update'](_0xfdef04)[_0x8f5a('0x25')](function(_0x2d678b){return _0x2d678b;});}return null;};}function removeEntity(_0x2da483,_0x46d242){return function(_0x5d4418){if(_0x5d4418){return _0x5d4418[_0x8f5a('0x26')]()['then'](function(){_0x2da483[_0x8f5a('0x1a')](0xcc)[_0x8f5a('0x1b')]();});}};}function handleEntityNotFound(_0x47e38d,_0x4be082){return function(_0x14db9e){if(!_0x14db9e){_0x47e38d[_0x8f5a('0x19')](0x194);}return _0x14db9e;};}function handleError(_0x24db94,_0x7e38f9){_0x7e38f9=_0x7e38f9||0x1f4;return function(_0x11901){logger[_0x8f5a('0x27')](_0x11901[_0x8f5a('0x28')]);if(_0x11901[_0x8f5a('0x29')]){delete _0x11901[_0x8f5a('0x29')];}_0x24db94[_0x8f5a('0x1a')](_0x7e38f9)['send'](_0x11901);};}exports[_0x8f5a('0x2a')]=function(_0x958bd5,_0x2d192c){var _0x4623fe={},_0x1f3d30={},_0xd43d83={'count':0x0,'rows':[]};var _0x126d6f=_[_0x8f5a('0x2b')](db[_0x8f5a('0x2c')][_0x8f5a('0x2d')],function(_0x3c076f){return{'name':_0x3c076f[_0x8f5a('0x2e')],'type':_0x3c076f[_0x8f5a('0x2f')]['key']};});_0x1f3d30[_0x8f5a('0x30')]=_[_0x8f5a('0x2b')](_0x126d6f,'name');_0x1f3d30[_0x8f5a('0x31')]=_[_0x8f5a('0x32')](_0x958bd5[_0x8f5a('0x31')]);_0x1f3d30[_0x8f5a('0x33')]=_['intersection'](_0x1f3d30[_0x8f5a('0x30')],_0x1f3d30[_0x8f5a('0x31')]);_0x4623fe[_0x8f5a('0x34')]=_[_0x8f5a('0x35')](_0x1f3d30[_0x8f5a('0x30')],qs[_0x8f5a('0x36')](_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x36')]));_0x4623fe[_0x8f5a('0x34')]=_0x4623fe[_0x8f5a('0x34')]['length']?_0x4623fe['attributes']:_0x1f3d30[_0x8f5a('0x30')];if(!_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x37')](_0x8f5a('0x38'))){_0x4623fe[_0x8f5a('0x20')]=qs['limit'](_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x20')]);_0x4623fe[_0x8f5a('0x1d')]=qs[_0x8f5a('0x1d')](_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x1d')]);}_0x4623fe['order']=qs[_0x8f5a('0x39')](_0x958bd5['query'][_0x8f5a('0x39')]);_0x4623fe[_0x8f5a('0x3a')]=qs[_0x8f5a('0x33')](_[_0x8f5a('0x3b')](_0x958bd5['query'],_0x1f3d30[_0x8f5a('0x33')]),_0x126d6f);if(_0x958bd5['query'][_0x8f5a('0x3c')]){_0x4623fe[_0x8f5a('0x3a')]=_[_0x8f5a('0x3d')](_0x4623fe['where'],{'$or':_[_0x8f5a('0x2b')](_0x126d6f,function(_0x1be421){if(_0x1be421[_0x8f5a('0x2f')]!==_0x8f5a('0x3e')){var _0xc8875a={};_0xc8875a[_0x1be421[_0x8f5a('0x29')]]={'$like':'%'+_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x3c')]+'%'};return _0xc8875a;}})});}_0x4623fe=_[_0x8f5a('0x3d')]({},_0x4623fe,_0x958bd5['options']);var _0x169406={'where':_0x4623fe[_0x8f5a('0x3a')]};return db[_0x8f5a('0x2c')][_0x8f5a('0x1f')](_0x169406)['then'](function(_0x5d690f){_0xd43d83[_0x8f5a('0x1f')]=_0x5d690f;if(_0x958bd5[_0x8f5a('0x31')][_0x8f5a('0x3f')]){_0x4623fe[_0x8f5a('0x40')]=[{'all':!![]}];}return db[_0x8f5a('0x2c')][_0x8f5a('0x41')](_0x4623fe);})['then'](function(_0x552c71){_0xd43d83[_0x8f5a('0x42')]=_0x552c71;return _0xd43d83;})[_0x8f5a('0x25')](respondWithFilteredResult(_0x2d192c,_0x4623fe))['catch'](handleError(_0x2d192c,null));};exports['show']=function(_0x1f9795,_0x10d4f3){var _0x225f94={'raw':!![],'where':{'id':_0x1f9795[_0x8f5a('0x43')]['id']}},_0x1bea50={};_0x1bea50[_0x8f5a('0x30')]=_[_0x8f5a('0x32')](db[_0x8f5a('0x2c')][_0x8f5a('0x2d')]);_0x1bea50[_0x8f5a('0x31')]=_[_0x8f5a('0x32')](_0x1f9795[_0x8f5a('0x31')]);_0x1bea50[_0x8f5a('0x33')]=_[_0x8f5a('0x35')](_0x1bea50['model'],_0x1bea50['query']);_0x225f94['attributes']=_[_0x8f5a('0x35')](_0x1bea50['model'],qs[_0x8f5a('0x36')](_0x1f9795['query'][_0x8f5a('0x36')]));_0x225f94['attributes']=_0x225f94[_0x8f5a('0x34')]['length']?_0x225f94[_0x8f5a('0x34')]:_0x1bea50[_0x8f5a('0x30')];if(_0x1f9795['query'][_0x8f5a('0x3f')]){_0x225f94[_0x8f5a('0x40')]=[{'all':!![]}];}_0x225f94=_[_0x8f5a('0x3d')]({},_0x225f94,_0x1f9795[_0x8f5a('0x44')]);return db[_0x8f5a('0x2c')][_0x8f5a('0x45')](_0x225f94)[_0x8f5a('0x25')](handleEntityNotFound(_0x10d4f3,null))['then'](respondWithResult(_0x10d4f3,null))['catch'](handleError(_0x10d4f3,null));};exports[_0x8f5a('0x46')]=function(_0x2c0eaa,_0x527c1a){return db[_0x8f5a('0x2c')][_0x8f5a('0x46')](_0x2c0eaa['body'],{})['then'](respondWithResult(_0x527c1a,0xc9))[_0x8f5a('0x47')](handleError(_0x527c1a,null));};exports[_0x8f5a('0x48')]=function(_0x1327be,_0x298d39){if(_0x1327be[_0x8f5a('0x49')]['id']){delete _0x1327be[_0x8f5a('0x49')]['id'];}return db[_0x8f5a('0x2c')]['find']({'where':{'id':_0x1327be[_0x8f5a('0x43')]['id']}})[_0x8f5a('0x25')](handleEntityNotFound(_0x298d39,null))[_0x8f5a('0x25')](saveUpdates(_0x1327be['body'],null))[_0x8f5a('0x25')](respondWithResult(_0x298d39,null))['catch'](handleError(_0x298d39,null));};exports[_0x8f5a('0x26')]=function(_0x10c69b,_0x2e2505){return db[_0x8f5a('0x2c')][_0x8f5a('0x45')]({'where':{'id':_0x10c69b['params']['id']}})[_0x8f5a('0x25')](handleEntityNotFound(_0x2e2505,null))['then'](removeEntity(_0x2e2505,null))['catch'](handleError(_0x2e2505,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b2bd394..310f69c 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 _0xf757=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','lodash','util','../../config/logger'];(function(_0x482f37,_0x4bb683){var _0x16a132=function(_0x4c8dd3){while(--_0x4c8dd3){_0x482f37['push'](_0x482f37['shift']());}};_0x16a132(++_0x4bb683);}(_0xf757,0x89));var _0x7f75=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0xf757[_0x1ff2ec];return _0x405683;};'use strict';var _=require(_0x7f75('0x0'));var util=require(_0x7f75('0x1'));var logger=require(_0x7f75('0x2'))(_0x7f75('0x3'));var moment=require(_0x7f75('0x4'));var BPromise=require(_0x7f75('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f75('0x6'));var rimraf=require(_0x7f75('0x7'));var config=require(_0x7f75('0x8'));var attributes=require(_0x7f75('0x9'));module[_0x7f75('0xa')]=function(_0x27f49a,_0x50129a){return _0x27f49a[_0x7f75('0xb')]('VoiceQueuesLog',attributes,{'tableName':_0x7f75('0xc'),'paranoid':![],'indexes':[{'name':_0x7f75('0xd'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xe5f7=['../../config/logger','api','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util'];(function(_0x274319,_0x3fc0e0){var _0x435969=function(_0x202344){while(--_0x202344){_0x274319['push'](_0x274319['shift']());}};_0x435969(++_0x3fc0e0);}(_0xe5f7,0x178));var _0x7e5f=function(_0x51ef3d,_0x1bf411){_0x51ef3d=_0x51ef3d-0x0;var _0x5d0084=_0xe5f7[_0x51ef3d];return _0x5d0084;};'use strict';var _=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var logger=require(_0x7e5f('0x2'))(_0x7e5f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e5f('0x4'));var fs=require('fs');var path=require(_0x7e5f('0x5'));var rimraf=require(_0x7e5f('0x6'));var config=require('../../config/environment');var attributes=require(_0x7e5f('0x7'));module[_0x7e5f('0x8')]=function(_0x5ba513,_0x1a6abb){return _0x5ba513[_0x7e5f('0x9')](_0x7e5f('0xa'),attributes,{'tableName':_0x7e5f('0xb'),'paranoid':![],'indexes':[{'name':_0x7e5f('0xc'),'fields':[_0x7e5f('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a47dce0..fbd538e 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 _0xa74e=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4c50df,_0x39925c){var _0x2babcb=function(_0x2c99af){while(--_0x2c99af){_0x4c50df['push'](_0x4c50df['shift']());}};_0x2babcb(++_0x39925c);}(_0xa74e,0x8d));var _0xea74=function(_0x5d5b13,_0x257829){_0x5d5b13=_0x5d5b13-0x0;var _0x328ef1=_0xa74e[_0x5d5b13];return _0x328ef1;};'use strict';var _=require(_0xea74('0x0'));var util=require(_0xea74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xea74('0x2'));var fs=require('fs');var Redis=require(_0xea74('0x3'));var db=require(_0xea74('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xea74('0x5'))(_0xea74('0x6'));var config=require(_0xea74('0x7'));var jayson=require(_0xea74('0x8'));var client=jayson['client'][_0xea74('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2295a7,_0x213057,_0x4f5795){return new BPromise(function(_0x44f885,_0x3c816d){return client[_0xea74('0xa')](_0x2295a7,_0x4f5795)[_0xea74('0xb')](function(_0x29ceda){logger[_0xea74('0xc')](_0xea74('0xd'),_0x213057,_0xea74('0xe'));logger[_0xea74('0xf')](_0xea74('0x10'),_0x213057,'request\x20sent',JSON['stringify'](_0x29ceda));if(_0x29ceda[_0xea74('0x11')]){if(_0x29ceda[_0xea74('0x11')][_0xea74('0x12')]===0x1f4){logger[_0xea74('0x11')](_0xea74('0xd'),_0x213057,_0x29ceda[_0xea74('0x11')][_0xea74('0x13')]);return _0x3c816d(_0x29ceda['error'][_0xea74('0x13')]);}logger[_0xea74('0x11')](_0xea74('0xd'),_0x213057,_0x29ceda['error']['message']);return _0x44f885(_0x29ceda[_0xea74('0x11')][_0xea74('0x13')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x213057,_0xea74('0xe'));_0x44f885(_0x29ceda[_0xea74('0x14')][_0xea74('0x13')]);}})['catch'](function(_0x114dd9){logger[_0xea74('0x11')](_0xea74('0xd'),_0x213057,_0x114dd9);_0x3c816d(_0x114dd9);});});} \ No newline at end of file +var _0x5c7c=['code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','error'];(function(_0x5d325c,_0x38ef8c){var _0x29c9ea=function(_0x322a5d){while(--_0x322a5d){_0x5d325c['push'](_0x5d325c['shift']());}};_0x29c9ea(++_0x38ef8c);}(_0x5c7c,0xe2));var _0xc5c7=function(_0x5ab3b4,_0x5ede5d){_0x5ab3b4=_0x5ab3b4-0x0;var _0x1a7c0c=_0x5c7c[_0x5ab3b4];return _0x1a7c0c;};'use strict';var _=require(_0xc5c7('0x0'));var util=require('util');var moment=require(_0xc5c7('0x1'));var BPromise=require(_0xc5c7('0x2'));var rs=require(_0xc5c7('0x3'));var fs=require('fs');var Redis=require(_0xc5c7('0x4'));var db=require(_0xc5c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5c7('0x6'))(_0xc5c7('0x7'));var config=require(_0xc5c7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc5c7('0x9')][_0xc5c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d70c1,_0x18ba87,_0x1c0e31){return new BPromise(function(_0x1ab3f7,_0xb722db){return client[_0xc5c7('0xb')](_0x3d70c1,_0x1c0e31)[_0xc5c7('0xc')](function(_0x335360){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x18ba87,_0xc5c7('0xd'));logger[_0xc5c7('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x18ba87,'request\x20sent',JSON['stringify'](_0x335360));if(_0x335360[_0xc5c7('0xf')]){if(_0x335360[_0xc5c7('0xf')][_0xc5c7('0x10')]===0x1f4){logger[_0xc5c7('0xf')](_0xc5c7('0x11'),_0x18ba87,_0x335360[_0xc5c7('0xf')][_0xc5c7('0x12')]);return _0xb722db(_0x335360[_0xc5c7('0xf')]['message']);}logger[_0xc5c7('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x18ba87,_0x335360[_0xc5c7('0xf')][_0xc5c7('0x12')]);return _0x1ab3f7(_0x335360[_0xc5c7('0xf')][_0xc5c7('0x12')]);}else{logger[_0xc5c7('0x13')](_0xc5c7('0x11'),_0x18ba87,_0xc5c7('0xd'));_0x1ab3f7(_0x335360[_0xc5c7('0x14')]['message']);}})[_0xc5c7('0x15')](function(_0x16826b){logger[_0xc5c7('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x18ba87,_0x16826b);_0xb722db(_0x16826b);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 99648ab..122b055 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 _0xb7dd=['runTranscribe','update','delete','destroy','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','downloads','/:id/transcribe','downloadTranscribe','create','post'];(function(_0xcb1a29,_0x1b67e3){var _0x1f2525=function(_0x887ff5){while(--_0x887ff5){_0xcb1a29['push'](_0xcb1a29['shift']());}};_0x1f2525(++_0x1b67e3);}(_0xb7dd,0x8e));var _0xdb7d=function(_0x56568a,_0x19f4b7){_0x56568a=_0x56568a-0x0;var _0x158b26=_0xb7dd[_0x56568a];return _0x158b26;};'use strict';var multer=require(_0xdb7d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdb7d('0x1'));var express=require('express');var router=express[_0xdb7d('0x2')]();var fs_extra=require(_0xdb7d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdb7d('0x4'));var config=require(_0xdb7d('0x5'));var controller=require(_0xdb7d('0x6'));router[_0xdb7d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdb7d('0x7')](_0xdb7d('0x8'),auth[_0xdb7d('0x9')](),controller[_0xdb7d('0xa')]);router[_0xdb7d('0x7')](_0xdb7d('0xb'),auth[_0xdb7d('0x9')](),controller[_0xdb7d('0xc')]);router[_0xdb7d('0x7')](_0xdb7d('0xd'),auth[_0xdb7d('0x9')](),controller['download']);router[_0xdb7d('0x7')]('/:id/downloads',controller[_0xdb7d('0xe')]);router[_0xdb7d('0x7')](_0xdb7d('0xf'),auth[_0xdb7d('0x9')](),controller[_0xdb7d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdb7d('0x11')]);router[_0xdb7d('0x12')](_0xdb7d('0xf'),auth['isAuthenticated'](),controller[_0xdb7d('0x13')]);router['put'](_0xdb7d('0xb'),auth[_0xdb7d('0x9')](),controller[_0xdb7d('0x14')]);router[_0xdb7d('0x15')]('/:id',auth[_0xdb7d('0x9')](),controller[_0xdb7d('0x16')]);module['exports']=router; \ No newline at end of file +var _0x30d4=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','get','/describe','isAuthenticated','/:id','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','multer','path'];(function(_0x1423db,_0x175e32){var _0x3e4c85=function(_0x4e62fe){while(--_0x4e62fe){_0x1423db['push'](_0x1423db['shift']());}};_0x3e4c85(++_0x175e32);}(_0x30d4,0x143));var _0x430d=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x30d4[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x430d('0x0'));var util=require('util');var path=require(_0x430d('0x1'));var timeout=require(_0x430d('0x2'));var express=require(_0x430d('0x3'));var router=express['Router']();var fs_extra=require(_0x430d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x430d('0x5'));var config=require(_0x430d('0x6'));var controller=require(_0x430d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x430d('0x8')]);router[_0x430d('0x9')](_0x430d('0xa'),auth[_0x430d('0xb')](),controller['describe']);router[_0x430d('0x9')](_0x430d('0xc'),auth[_0x430d('0xb')](),controller['show']);router[_0x430d('0x9')](_0x430d('0xd'),auth[_0x430d('0xb')](),controller['download']);router[_0x430d('0x9')](_0x430d('0xe'),controller[_0x430d('0xf')]);router[_0x430d('0x9')](_0x430d('0x10'),auth[_0x430d('0xb')](),controller[_0x430d('0x11')]);router['post']('/',auth[_0x430d('0xb')](),controller['create']);router[_0x430d('0x12')](_0x430d('0x10'),auth[_0x430d('0xb')](),controller[_0x430d('0x13')]);router[_0x430d('0x14')](_0x430d('0xc'),auth['isAuthenticated'](),controller[_0x430d('0x15')]);router[_0x430d('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x430d('0x17')]);module[_0x430d('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index ddc9db1..d31ece0 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(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 898b9aa..905326e 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 _0xc166=['File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeAccountId','transcribeRegion','language','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','update','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','push','$and','decryptFile','info','cancellazione\x20fisica\x20documento\x20%s'];(function(_0x522c5c,_0x4983dc){var _0x247016=function(_0x23fa00){while(--_0x23fa00){_0x522c5c['push'](_0x522c5c['shift']());}};_0x247016(++_0x4983dc);}(_0xc166,0xcd));var _0x6c16=function(_0x5566a3,_0x2ac4b0){_0x5566a3=_0x5566a3-0x0;var _0x4ca847=_0xc166[_0x5566a3];return _0x4ca847;};'use strict';var emlformat=require(_0x6c16('0x0'));var rimraf=require(_0x6c16('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c16('0x2'));var rp=require(_0x6c16('0x3'));var moment=require(_0x6c16('0x4'));var BPromise=require(_0x6c16('0x5'));var Mustache=require(_0x6c16('0x6'));var util=require(_0x6c16('0x7'));var path=require(_0x6c16('0x8'));var sox=require(_0x6c16('0x9'));var csv=require(_0x6c16('0xa'));var ejs=require(_0x6c16('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c16('0xc'));var squel=require(_0x6c16('0xd'));var crypto=require(_0x6c16('0xe'));var jsforce=require(_0x6c16('0xf'));var deskjs=require(_0x6c16('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6c16('0x11'));var Papa=require(_0x6c16('0x12'));var AWS=require(_0x6c16('0x13'));var uuidv4=require(_0x6c16('0x14'));var Redis=require(_0x6c16('0x15'));var authService=require(_0x6c16('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x6c16('0x17'));var hardwareService=require(_0x6c16('0x18'));var logger=require('../../config/logger')(_0x6c16('0x19'));var utils=require(_0x6c16('0x1a'));var config=require(_0x6c16('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c16('0x1c'))['db'];function respondWithStatusCode(_0x4ebe7e,_0x1f574b){_0x1f574b=_0x1f574b||0xcc;return function(_0x1de23a){if(_0x1de23a){return _0x4ebe7e[_0x6c16('0x1d')](_0x1f574b);}return _0x4ebe7e[_0x6c16('0x1e')](_0x1f574b)['end']();};}function respondWithResult(_0x2dcd6c,_0x5eb26e){_0x5eb26e=_0x5eb26e||0xc8;return function(_0x19c4d0){if(_0x19c4d0){return _0x2dcd6c[_0x6c16('0x1e')](_0x5eb26e)['json'](_0x19c4d0);}};}function respondWithFilteredResult(_0x5c69f8,_0x394349){return function(_0x175c9f){if(_0x175c9f){var _0xf9982e=typeof _0x394349[_0x6c16('0x1f')]===_0x6c16('0x20')&&typeof _0x394349[_0x6c16('0x21')]===_0x6c16('0x20');var _0x2a6780=_0x175c9f[_0x6c16('0x22')];var _0x478d2a=_0xf9982e?0x0:_0x394349['offset'];var _0x1c632f=_0xf9982e?_0x175c9f[_0x6c16('0x22')]:_0x394349['offset']+_0x394349[_0x6c16('0x21')];var _0x52c5d4;if(_0x1c632f>=_0x2a6780){_0x1c632f=_0x2a6780;_0x52c5d4=0xc8;}else{_0x52c5d4=0xce;}_0x5c69f8[_0x6c16('0x1e')](_0x52c5d4);return _0x5c69f8[_0x6c16('0x23')](_0x6c16('0x24'),_0x478d2a+'-'+_0x1c632f+'/'+_0x2a6780)[_0x6c16('0x25')](_0x175c9f);}return null;};}function patchUpdates(_0x4a80ad){return function(_0x1ca34a){try{jsonpatch['apply'](_0x1ca34a,_0x4a80ad,!![]);}catch(_0x1661c1){return BPromise[_0x6c16('0x26')](_0x1661c1);}return _0x1ca34a[_0x6c16('0x27')]();};}function saveUpdates(_0x33869e,_0x2aab56){return function(_0x3dce1c){if(_0x3dce1c){return _0x3dce1c['update'](_0x33869e)[_0x6c16('0x28')](function(_0x45bae5){return _0x45bae5;});}return null;};}function removeEntity(_0x2dac3e,_0x540981){return function(_0x31629b){if(_0x31629b){return _0x31629b[_0x6c16('0x29')]()[_0x6c16('0x28')](function(){_0x2dac3e['status'](0xcc)[_0x6c16('0x2a')]();});}};}function handleEntityNotFound(_0x9700bd,_0x360fda){return function(_0x57d746){if(!_0x57d746){_0x9700bd[_0x6c16('0x1d')](0x194);}return _0x57d746;};}function handleError(_0x1fa783,_0x5b6233){_0x5b6233=_0x5b6233||0x1f4;return function(_0x58c95e){logger[_0x6c16('0x2b')](_0x58c95e[_0x6c16('0x2c')]);if(_0x58c95e[_0x6c16('0x2d')]){delete _0x58c95e[_0x6c16('0x2d')];}_0x1fa783[_0x6c16('0x1e')](_0x5b6233)[_0x6c16('0x2e')](_0x58c95e);};}exports[_0x6c16('0x2f')]=function(_0x33d81a,_0x2118d1){var _0x3ecf7f={},_0x39b0da={},_0x3f4b08={'count':0x0,'rows':[]};var _0x450649=_[_0x6c16('0x30')](db[_0x6c16('0x31')][_0x6c16('0x32')],function(_0x4ac56f){return{'name':_0x4ac56f[_0x6c16('0x33')],'type':_0x4ac56f[_0x6c16('0x34')][_0x6c16('0x35')]};});_0x39b0da[_0x6c16('0x36')]=_[_0x6c16('0x37')](_[_0x6c16('0x30')](_0x450649,'name'),[_0x6c16('0x38')]);_0x39b0da[_0x6c16('0x39')]=_['keys'](_0x33d81a[_0x6c16('0x39')]);_0x39b0da[_0x6c16('0x3a')]=_[_0x6c16('0x3b')](_0x39b0da[_0x6c16('0x36')],_0x39b0da[_0x6c16('0x39')]);_0x3ecf7f[_0x6c16('0x3c')]=_[_0x6c16('0x3b')](_0x39b0da[_0x6c16('0x36')],qs['fields'](_0x33d81a[_0x6c16('0x39')][_0x6c16('0x3d')]));_0x3ecf7f['attributes']=_0x3ecf7f[_0x6c16('0x3c')][_0x6c16('0x3e')]?_0x3ecf7f[_0x6c16('0x3c')]:_0x39b0da['model'];if(!_0x33d81a[_0x6c16('0x39')][_0x6c16('0x3f')](_0x6c16('0x40'))){_0x3ecf7f[_0x6c16('0x21')]=qs[_0x6c16('0x21')](_0x33d81a[_0x6c16('0x39')][_0x6c16('0x21')]);_0x3ecf7f[_0x6c16('0x1f')]=qs[_0x6c16('0x1f')](_0x33d81a[_0x6c16('0x39')]['offset']);}_0x3ecf7f['order']=qs['sort'](_0x33d81a[_0x6c16('0x39')][_0x6c16('0x41')]);_0x3ecf7f[_0x6c16('0x42')]=qs['filters'](_['pick'](_0x33d81a[_0x6c16('0x39')],_0x39b0da[_0x6c16('0x3a')]),_0x450649);if(_0x33d81a[_0x6c16('0x39')]['filter']){_0x3ecf7f[_0x6c16('0x42')]=_[_0x6c16('0x43')](_0x3ecf7f['where'],{'$or':_[_0x6c16('0x30')](_0x450649,function(_0x59d145){if(_0x59d145[_0x6c16('0x34')]!==_0x6c16('0x44')){var _0x143326={};_0x143326[_0x59d145['name']]={'$like':'%'+_0x33d81a['query'][_0x6c16('0x45')]+'%'};return _0x143326;}})});}_0x3ecf7f=_[_0x6c16('0x43')]({},_0x3ecf7f,_0x33d81a[_0x6c16('0x46')]);var _0x3f8a9c={'where':_0x3ecf7f['where']};return db[_0x6c16('0x31')][_0x6c16('0x22')](_0x3f8a9c)[_0x6c16('0x28')](function(_0x1b5c1a){_0x3f4b08['count']=_0x1b5c1a;if(_0x33d81a[_0x6c16('0x39')][_0x6c16('0x47')]){_0x3ecf7f[_0x6c16('0x48')]=[{'all':!![]}];}return db['VoiceRecording'][_0x6c16('0x49')](_0x3ecf7f);})[_0x6c16('0x28')](function(_0x41c616){_0x3f4b08[_0x6c16('0x4a')]=_0x41c616;return _0x3f4b08;})[_0x6c16('0x28')](respondWithFilteredResult(_0x2118d1,_0x3ecf7f))[_0x6c16('0x4b')](handleError(_0x2118d1,null));};exports[_0x6c16('0x4c')]=function(_0xefb30a,_0x4b7262){var _0x4f4c5f={'raw':![],'where':{'id':_0xefb30a[_0x6c16('0x4d')]['id']}},_0x44214f={};_0x44214f[_0x6c16('0x36')]=_[_0x6c16('0x4e')](db[_0x6c16('0x31')]['rawAttributes']);_0x44214f['query']=_[_0x6c16('0x4e')](_0xefb30a[_0x6c16('0x39')]);_0x44214f[_0x6c16('0x3a')]=_[_0x6c16('0x3b')](_0x44214f['model'],_0x44214f[_0x6c16('0x39')]);_0x4f4c5f['attributes']=_[_0x6c16('0x3b')](_0x44214f['model'],qs['fields'](_0xefb30a['query'][_0x6c16('0x3d')]));_0x4f4c5f['attributes']=_0x4f4c5f[_0x6c16('0x3c')][_0x6c16('0x3e')]?_0x4f4c5f[_0x6c16('0x3c')]:_0x44214f[_0x6c16('0x36')];if(_0xefb30a[_0x6c16('0x39')][_0x6c16('0x47')]){_0x4f4c5f['include']=[{'all':!![]}];}_0x4f4c5f=_[_0x6c16('0x43')]({},_0x4f4c5f,_0xefb30a[_0x6c16('0x46')]);return db['VoiceRecording'][_0x6c16('0x4f')](_0x4f4c5f)[_0x6c16('0x28')](handleEntityNotFound(_0x4b7262,null))[_0x6c16('0x28')](respondWithResult(_0x4b7262,null))[_0x6c16('0x4b')](handleError(_0x4b7262,null));};exports[_0x6c16('0x50')]=function(_0x635b39,_0x38b3f9){return db[_0x6c16('0x31')][_0x6c16('0x50')](_0x635b39['body'],{})[_0x6c16('0x28')](respondWithResult(_0x38b3f9,0xc9))[_0x6c16('0x4b')](handleError(_0x38b3f9,null));};exports[_0x6c16('0x51')]=function(_0x31918c,_0x4bb760){if(_0x31918c['body']['id']){delete _0x31918c[_0x6c16('0x52')]['id'];}return db[_0x6c16('0x31')][_0x6c16('0x4f')]({'where':{'id':_0x31918c['params']['id']}})[_0x6c16('0x28')](handleEntityNotFound(_0x4bb760,null))['then'](saveUpdates(_0x31918c[_0x6c16('0x52')],null))[_0x6c16('0x28')](respondWithResult(_0x4bb760,null))[_0x6c16('0x4b')](handleError(_0x4bb760,null));};exports[_0x6c16('0x53')]=function(_0xf75738,_0x287d14){return db[_0x6c16('0x31')][_0x6c16('0x53')]()[_0x6c16('0x28')](respondWithResult(_0x287d14,null))[_0x6c16('0x4b')](handleError(_0x287d14,null));};exports[_0x6c16('0x54')]=function(_0x267294,_0x5a998e,_0x5495de){var _0x22e17d=require(_0x6c16('0x55'));var _0x4dda6d=![];var _0x5a87c1={};if(_0x267294[_0x6c16('0x39')][_0x6c16('0x34')]&&_0x267294[_0x6c16('0x39')]['type']===_0x6c16('0x56')){_0x5a87c1[_0x6c16('0x56')]=_0x267294[_0x6c16('0x4d')]['id'];}else{_0x5a87c1['id']=_0x267294[_0x6c16('0x4d')]['id'];}return db['VoiceRecording'][_0x6c16('0x4f')]({'where':_0x5a87c1,'attributes':['id',_0x6c16('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x5a998e,null))[_0x6c16('0x28')](function(_0x15d64d){if(_0x15d64d){var _0x45121f=_0x15d64d[_0x6c16('0x57')];var _0x2926e3=util[_0x6c16('0x38')](_0x6c16('0x58'),_0x45121f);if(fs[_0x6c16('0x59')](_0x2926e3)){_0x4dda6d=!![];return _0x22e17d['decryptFile'](_0x2926e3,_0x45121f,config[_0x6c16('0x5a')][_0x6c16('0x5b')])[_0x6c16('0x28')](function(){return _0x15d64d;});}return _0x15d64d;}})[_0x6c16('0x28')](function(_0x540047){if(_0x540047){var _0x24fb7c=_0x540047['value'];if(!fs[_0x6c16('0x59')](_0x24fb7c)){throw new db[(_0x6c16('0x5c'))][(_0x6c16('0x5d'))](_0x6c16('0x5e'));}if(_0x540047[_0x6c16('0x5f')]){return _0x5a998e[_0x6c16('0x54')](_0x24fb7c,_0x540047['filename']+path[_0x6c16('0x60')](_0x24fb7c),function(){if(_0x4dda6d){fs[_0x6c16('0x61')](_0x24fb7c);}});}else{return _0x5a998e[_0x6c16('0x54')](_0x24fb7c,function(_0x15c67d){if(_0x4dda6d){fs[_0x6c16('0x61')](_0x24fb7c);}});}}})[_0x6c16('0x4b')](function(_0x7bde31){if(_0x7bde31[_0x6c16('0x62')]==='VoiceRecording\x20not\x20found'){_0x5a998e[_0x6c16('0x1e')](0x194)['send'](_0x6c16('0x63'));}else{return handleError(_0x5a998e,null);}});};exports[_0x6c16('0x64')]=function(_0x45fb73,_0x3e9a80,_0x248ccd){var _0x565e93=require(_0x6c16('0x55'));var _0x40f511=![];var _0xaa4038={'$and':[db[_0x6c16('0x65')][_0x6c16('0x42')](db[_0x6c16('0x65')]['fn'](_0x6c16('0x66'),db['sequelize'][_0x6c16('0x67')]('uniqueid')),_0x45fb73['query']['token'])]};if(_0x45fb73['query']['type']&&_0x45fb73['query'][_0x6c16('0x34')]==='uniqueid'){_0xaa4038['$and'][_0x6c16('0x68')]({'uniqueid':_0x45fb73['params']['id']});}else{_0xaa4038[_0x6c16('0x69')][_0x6c16('0x68')]({'id':_0x45fb73[_0x6c16('0x4d')]['id']});}return db[_0x6c16('0x31')]['find']({'where':_0xaa4038,'attributes':['id','value'],'raw':!![]})[_0x6c16('0x28')](handleEntityNotFound(_0x3e9a80,null))[_0x6c16('0x28')](function(_0x11ff3d){if(_0x11ff3d){var _0x4787aa=util[_0x6c16('0x38')](_0x6c16('0x58'),_0x11ff3d[_0x6c16('0x57')]);if(fs[_0x6c16('0x59')](_0x4787aa)){_0x40f511=!![];return _0x565e93[_0x6c16('0x6a')](_0x4787aa,_0x11ff3d['value'],config[_0x6c16('0x5a')][_0x6c16('0x5b')])[_0x6c16('0x28')](function(){return _0x11ff3d;});}return _0x11ff3d;}})[_0x6c16('0x28')](function(_0x5d308f){if(_0x5d308f){if(!fs[_0x6c16('0x59')](_0x5d308f['value'])){throw new db[(_0x6c16('0x5c'))][(_0x6c16('0x5d'))](_0x6c16('0x5e'));}if(_0x5d308f[_0x6c16('0x5f')]){return _0x3e9a80['download'](_0x5d308f[_0x6c16('0x57')],_0x5d308f['filename']+path['extname'](_0x5d308f[_0x6c16('0x57')]),function(){if(_0x40f511){fs[_0x6c16('0x61')](_0x5d308f[_0x6c16('0x57')]);}});}else{return _0x3e9a80[_0x6c16('0x54')](_0x5d308f['value'],function(_0x1cd78d){if(_0x40f511){fs[_0x6c16('0x61')](_0x5d308f[_0x6c16('0x57')]);}});}}})[_0x6c16('0x4b')](handleError(_0x3e9a80,null));};exports[_0x6c16('0x29')]=function(_0x4d89d3,_0x4c2aa4){return db[_0x6c16('0x31')]['find']({'where':{'id':_0x4d89d3[_0x6c16('0x4d')]['id']}})[_0x6c16('0x28')](function(_0x559877){if(_['isNil'](_0x559877)){throw new ReferenceError('Entity\x20not\x20found');}return _0x559877;})['then'](function(_0x838c06){var _0x20ae18=_0x838c06[_0x6c16('0x57')];logger[_0x6c16('0x6b')](_0x6c16('0x6c'),_0x20ae18);if(!_['isNil'](_0x838c06[_0x6c16('0x57')])&&fs[_0x6c16('0x59')](_0x20ae18)){logger[_0x6c16('0x6b')](_0x6c16('0x6d')+_0x20ae18+_0x6c16('0x6e'));fs[_0x6c16('0x6f')](_0x20ae18);}_0x20ae18=_0x20ae18+_0x6c16('0x70');if(!_[_0x6c16('0x71')](_0x838c06[_0x6c16('0x57')])&&fs[_0x6c16('0x59')](_0x20ae18)){logger['info'](_0x6c16('0x6d')+_0x20ae18+_0x6c16('0x6e'));fs['unlinkSync'](_0x20ae18);}return _0x838c06;})[_0x6c16('0x28')](function(_0x5aed6b){if(!_0x5aed6b)throw new InternalError();return _0x5aed6b[_0x6c16('0x29')]();})[_0x6c16('0x28')](function(){_0x4c2aa4[_0x6c16('0x1e')](0xcc)[_0x6c16('0x2a')]();})[_0x6c16('0x4b')](handleError(_0x4c2aa4,null));};function getBucketslist(_0x5ae4f5,_0x2bc619,_0x1053a3){return new Promise(function(_0x99c933,_0x4b9e4e){var _0x12f84e=new AWS['S3']({'accessKeyId':_0x2bc619,'secretAccessKey':_0x5ae4f5,'region':_0x1053a3});_0x12f84e[_0x6c16('0x72')]({},function(_0x2bce6f,_0x290d40){if(_0x2bce6f){return _0x4b9e4e(_0x2bce6f);}else{return _0x99c933(_0x290d40);}});});}function createBucket(_0x5d2780,_0x185738,_0x4ce0ff,_0x46f86f){return new Promise(function(_0x237c2e,_0x38a2a7){var _0x1a1178=new AWS['S3']({'accessKeyId':_0x185738,'secretAccessKey':_0x5d2780,'region':_0x4ce0ff});_0x1a1178[_0x6c16('0x73')]({'Bucket':_0x46f86f},function(_0x4880d7,_0x3ae39e){if(_0x4880d7){return _0x38a2a7(_0x4880d7);}else{return _0x237c2e(_0x3ae39e);}});});}function uploadFile(_0x107b38,_0x2e40ca,_0x44562c,_0x24f3ee,_0x3dd54e,_0x4c8d75){return new Promise(function(_0x125cd8,_0x4f33c8){var _0xae4bf2=new AWS['S3']({'accessKeyId':_0x2e40ca,'secretAccessKey':_0x107b38,'region':_0x44562c});_0xae4bf2[_0x6c16('0x74')]({'Bucket':_0x24f3ee,'Key':_0x3dd54e,'Body':_0x4c8d75},function(_0x5b1b61,_0x367ab4){if(_0x5b1b61){return _0x4f33c8(_0x5b1b61);}else{return _0x125cd8(_0x367ab4);}});});}function startTranscribe(_0xc1d13e,_0x5c7803,_0x5f4593,_0x230968,_0x2bdf2e,_0x30e35c){return new Promise(function(_0x52c533,_0x20d85a){var _0x28a997=new AWS[(_0x6c16('0x75'))]({'accessKeyId':_0x5c7803,'secretAccessKey':_0xc1d13e,'region':_0x5f4593});_0x28a997['startTranscriptionJob']({'TranscriptionJobName':_0x230968,'LanguageCode':_0x2bdf2e,'Media':{'MediaFileUri':_0x30e35c}},function(_0x150235,_0x240450){if(_0x150235){return _0x20d85a(_0x150235);}else{return _0x52c533(_0x240450);}});});}function transcribe(_0x22de47,_0x4248b2,_0x593a0a,_0x30d66f,_0x277776,_0x4c354e,_0x8015eb){return new Promise(function(_0x3c3663,_0x18f4e7){var _0x33b1fe={};logger[_0x6c16('0x6b')](util[_0x6c16('0x38')](_0x6c16('0x76'),_0x22de47,_0x277776));return uploadFile(_0x4248b2,_0x593a0a,_0x30d66f,_0x277776,path['basename'](_0x4c354e),fs['readFileSync'](_0x4c354e))[_0x6c16('0x28')](function(_0x1b9ccf){logger[_0x6c16('0x6b')](util[_0x6c16('0x38')](_0x6c16('0x77'),_0x22de47,_0x277776,_0x1b9ccf[_0x6c16('0x78')]));_0x33b1fe[_0x6c16('0x79')]=_0x1b9ccf[_0x6c16('0x7a')];_0x33b1fe['location']=_0x1b9ccf[_0x6c16('0x78')];logger[_0x6c16('0x6b')](util['format'](_0x6c16('0x7b'),_0x22de47));return startTranscribe(_0x4248b2,_0x593a0a,_0x30d66f,uuidv4(),_0x8015eb,_0x1b9ccf[_0x6c16('0x78')]);})[_0x6c16('0x28')](function(_0x38c2c7){logger['info'](util[_0x6c16('0x38')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x22de47,_0x38c2c7[_0x6c16('0x7c')]['TranscriptionJobName']));_0x33b1fe[_0x6c16('0x7d')]=_0x38c2c7['TranscriptionJob'][_0x6c16('0x7e')];_0x33b1fe[_0x6c16('0x7f')]=_0x38c2c7[_0x6c16('0x7c')][_0x6c16('0x80')];return _0x3c3663(_0x33b1fe);})[_0x6c16('0x4b')](function(_0x183347){return _0x18f4e7(_0x183347);});});}exports[_0x6c16('0x81')]=function(_0x2789b9,_0x486c7a,_0x4d11cc){var _0xd498d6;var _0x316e29;var _0x430428;var _0x96f59d=require(_0x6c16('0x55'));return db[_0x6c16('0x31')]['findOne']({'where':{'id':_0x2789b9[_0x6c16('0x4d')]['id']}})[_0x6c16('0x28')](function(_0x1958d0){if(_0x1958d0){var _0x582821=util[_0x6c16('0x38')](_0x6c16('0x58'),_0x1958d0[_0x6c16('0x57')]);if(fs['existsSync'](_0x582821)){cypher=!![];return _0x96f59d[_0x6c16('0x6a')](_0x582821,_0x1958d0[_0x6c16('0x57')],config[_0x6c16('0x5a')]['recording'])['then'](function(){return _0x1958d0;});}return _0x1958d0;}})[_0x6c16('0x28')](function(_0x4a4102){if(!_0x4a4102){throw new db[(_0x6c16('0x5c'))][(_0x6c16('0x5d'))](_0x6c16('0x82'));}_0x316e29=_0x4a4102;return db[_0x6c16('0x83')][_0x6c16('0x84')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x486c7a,null))['then'](function(_0x4e7de5){if(_0x4e7de5){_0xd498d6=_0x4e7de5;if(!_0xd498d6['transcribe']||!_0xd498d6[_0x6c16('0x85')]||!_0xd498d6[_0x6c16('0x86')]||!_0xd498d6[_0x6c16('0x87')]||!_0xd498d6['bucket']){throw new db[(_0x6c16('0x5c'))][(_0x6c16('0x5d'))]('Transcribe\x20not\x20configured');}if(_0x2789b9[_0x6c16('0x52')][_0x6c16('0x88')]&&(!_0xd498d6['sentiment']||!_0xd498d6[_0x6c16('0x89')]||!_0xd498d6[_0x6c16('0x8a')]||!_0xd498d6[_0x6c16('0x87')]||!_0xd498d6[_0x6c16('0x79')])){throw new db[(_0x6c16('0x5c'))][(_0x6c16('0x5d'))](_0x6c16('0x8b'));}return db[_0x6c16('0x8c')][_0x6c16('0x84')]({'where':{'id':_0xd498d6[_0x6c16('0x85')]}});}})[_0x6c16('0x28')](function(_0x51b5e7){if(!_0x51b5e7){throw new db[(_0x6c16('0x5c'))]['ValidationError'](_0x6c16('0x8d'));}if(!_0x51b5e7[_0x6c16('0x8e')]||!_0x51b5e7[_0x6c16('0x8f')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x430428=_0x51b5e7;return getBucketslist(_0x430428[_0x6c16('0x8e')],_0x430428['data2'],_0xd498d6['transcribeRegion']);})[_0x6c16('0x28')](function(_0x33ea08){if(_0x33ea08&&_0x33ea08['Buckets']){var _0x49d6d8=_[_0x6c16('0x4f')](_0x33ea08[_0x6c16('0x90')],function(_0x327381){return _0x327381[_0x6c16('0x91')]===_0xd498d6[_0x6c16('0x79')];});if(!_0x49d6d8){logger[_0x6c16('0x6b')](util[_0x6c16('0x38')](_0x6c16('0x92'),_0x2789b9[_0x6c16('0x4d')]['id'],_0xd498d6[_0x6c16('0x79')]));return createBucket(_0x430428[_0x6c16('0x8e')],_0x430428[_0x6c16('0x8f')],_0xd498d6[_0x6c16('0x86')],_0xd498d6[_0x6c16('0x79')]);}logger[_0x6c16('0x6b')](util[_0x6c16('0x38')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2789b9[_0x6c16('0x4d')]['id'],_0xd498d6['bucket']));return;}})[_0x6c16('0x28')](function(_0x41eda6){if(_0x316e29[_0x6c16('0x7f')]==='NEW'){return transcribe(_0x2789b9[_0x6c16('0x4d')]['id'],_0x430428[_0x6c16('0x8e')],_0x430428[_0x6c16('0x8f')],_0xd498d6[_0x6c16('0x86')],_0xd498d6[_0x6c16('0x79')],_0x316e29[_0x6c16('0x57')],_0xd498d6[_0x6c16('0x87')]);}else{logger['info'](util['format'](_0x6c16('0x93'),_0x2789b9[_0x6c16('0x4d')]['id']));return{'transcribeStatus':_0x6c16('0x94')};}})[_0x6c16('0x28')](function(_0x318e84){if(_0x318e84){_0x318e84[_0x6c16('0x95')]=_0x2789b9[_0x6c16('0x52')][_0x6c16('0x88')];return _0x316e29[_0x6c16('0x96')](_0x318e84);}})['then'](respondWithResult(_0x486c7a,null))[_0x6c16('0x4b')](handleError(_0x486c7a,null));};function writeFile(_0x7e86ce,_0x56c55f){return new Promise(function(_0x20cfe0,_0x252314){fs[_0x6c16('0x97')](_0x56c55f,_0x7e86ce,function(_0x3b2073,_0x5aec89){if(_0x3b2073){return _0x252314(_0x3b2073);}else{return _0x20cfe0(_0x5aec89);}});});}exports[_0x6c16('0x98')]=function(_0x53fdbc,_0x4c6671,_0x8e3ec){return db[_0x6c16('0x31')][_0x6c16('0x84')]({'where':{'id':_0x53fdbc['params']['id']}})['then'](handleEntityNotFound(_0x4c6671))[_0x6c16('0x28')](function(_0xd151d0){if(_0xd151d0&&_0xd151d0[_0x6c16('0x99')]){var _0x213de9=_0xd151d0[_0x6c16('0x99')];var _0x294c2a=config[_0x6c16('0x9a')]+_0x6c16('0x9b')+_0xd151d0['id']+'.txt';if(fs['existsSync'](_0x294c2a)){return _0x294c2a;}return writeFile(_0x213de9,_0x294c2a)[_0x6c16('0x28')](function(){return _0x294c2a;});}else{throw new db[(_0x6c16('0x5c'))]['ValidationError'](_0x6c16('0x9c'));}})[_0x6c16('0x28')](function(_0x37dcc7){return _0x4c6671[_0x6c16('0x54')](_0x37dcc7);})[_0x6c16('0x4b')](handleError(_0x4c6671));}; \ No newline at end of file +var _0xf18a=['writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','options','includeAll','catch','show','params','include','merge','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','col','token','$and','push','%s.cypher','recording','ValidationError','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes'];(function(_0x181080,_0x544018){var _0x3ae061=function(_0x20f568){while(--_0x20f568){_0x181080['push'](_0x181080['shift']());}};_0x3ae061(++_0x544018);}(_0xf18a,0xa1));var _0xaf18=function(_0x1e5cde,_0x262b61){_0x1e5cde=_0x1e5cde-0x0;var _0x5178e3=_0xf18a[_0x1e5cde];return _0x5178e3;};'use strict';var emlformat=require(_0xaf18('0x0'));var rimraf=require(_0xaf18('0x1'));var zipdir=require(_0xaf18('0x2'));var jsonpatch=require(_0xaf18('0x3'));var rp=require(_0xaf18('0x4'));var moment=require(_0xaf18('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaf18('0x6'));var path=require(_0xaf18('0x7'));var sox=require(_0xaf18('0x8'));var csv=require(_0xaf18('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf18('0xa'));var _=require(_0xaf18('0xb'));var squel=require(_0xaf18('0xc'));var crypto=require(_0xaf18('0xd'));var jsforce=require(_0xaf18('0xe'));var deskjs=require(_0xaf18('0xf'));var toCsv=require(_0xaf18('0x9'));var querystring=require(_0xaf18('0x10'));var Papa=require('papaparse');var AWS=require(_0xaf18('0x11'));var uuidv4=require(_0xaf18('0x12'));var Redis=require(_0xaf18('0x13'));var authService=require(_0xaf18('0x14'));var qs=require(_0xaf18('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf18('0x16'))(_0xaf18('0x17'));var utils=require(_0xaf18('0x18'));var config=require(_0xaf18('0x19'));var licenseUtil=require(_0xaf18('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20c044,_0x2633b0){_0x2633b0=_0x2633b0||0xcc;return function(_0x15b6ac){if(_0x15b6ac){return _0x20c044['sendStatus'](_0x2633b0);}return _0x20c044[_0xaf18('0x1b')](_0x2633b0)['end']();};}function respondWithResult(_0x378aa9,_0x57adbb){_0x57adbb=_0x57adbb||0xc8;return function(_0x35f484){if(_0x35f484){return _0x378aa9[_0xaf18('0x1b')](_0x57adbb)[_0xaf18('0x1c')](_0x35f484);}};}function respondWithFilteredResult(_0x18f21f,_0x37d5d1){return function(_0x9edf2b){if(_0x9edf2b){var _0x5ab883=typeof _0x37d5d1[_0xaf18('0x1d')]===_0xaf18('0x1e')&&typeof _0x37d5d1['limit']==='undefined';var _0x4d676a=_0x9edf2b[_0xaf18('0x1f')];var _0x85247=_0x5ab883?0x0:_0x37d5d1[_0xaf18('0x1d')];var _0x2715dc=_0x5ab883?_0x9edf2b[_0xaf18('0x1f')]:_0x37d5d1[_0xaf18('0x1d')]+_0x37d5d1[_0xaf18('0x20')];var _0x130f03;if(_0x2715dc>=_0x4d676a){_0x2715dc=_0x4d676a;_0x130f03=0xc8;}else{_0x130f03=0xce;}_0x18f21f[_0xaf18('0x1b')](_0x130f03);return _0x18f21f[_0xaf18('0x21')](_0xaf18('0x22'),_0x85247+'-'+_0x2715dc+'/'+_0x4d676a)[_0xaf18('0x1c')](_0x9edf2b);}return null;};}function patchUpdates(_0x26c74b){return function(_0x175c6d){try{jsonpatch[_0xaf18('0x23')](_0x175c6d,_0x26c74b,!![]);}catch(_0x49f09e){return BPromise[_0xaf18('0x24')](_0x49f09e);}return _0x175c6d['save']();};}function saveUpdates(_0x4fd094,_0x409eb2){return function(_0x1c6430){if(_0x1c6430){return _0x1c6430[_0xaf18('0x25')](_0x4fd094)[_0xaf18('0x26')](function(_0x5e9ee4){return _0x5e9ee4;});}return null;};}function removeEntity(_0x3e1415,_0x1b0b3c){return function(_0x35c3f1){if(_0x35c3f1){return _0x35c3f1[_0xaf18('0x27')]()[_0xaf18('0x26')](function(){_0x3e1415[_0xaf18('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x146080,_0x30c3c2){return function(_0x5b25f2){if(!_0x5b25f2){_0x146080[_0xaf18('0x28')](0x194);}return _0x5b25f2;};}function handleError(_0x235e5a,_0x373da1){_0x373da1=_0x373da1||0x1f4;return function(_0x3002c2){logger[_0xaf18('0x29')](_0x3002c2['stack']);if(_0x3002c2[_0xaf18('0x2a')]){delete _0x3002c2[_0xaf18('0x2a')];}_0x235e5a[_0xaf18('0x1b')](_0x373da1)[_0xaf18('0x2b')](_0x3002c2);};}exports[_0xaf18('0x2c')]=function(_0x3fbaab,_0xfc1470){var _0x159386={},_0x306008={},_0x3cdfd7={'count':0x0,'rows':[]};var _0x5ced8c=_[_0xaf18('0x2d')](db[_0xaf18('0x2e')][_0xaf18('0x2f')],function(_0x2e953f){return{'name':_0x2e953f[_0xaf18('0x30')],'type':_0x2e953f[_0xaf18('0x31')]['key']};});_0x306008[_0xaf18('0x32')]=_[_0xaf18('0x33')](_[_0xaf18('0x2d')](_0x5ced8c,_0xaf18('0x2a')),[_0xaf18('0x34')]);_0x306008[_0xaf18('0x35')]=_[_0xaf18('0x36')](_0x3fbaab[_0xaf18('0x35')]);_0x306008['filters']=_[_0xaf18('0x37')](_0x306008[_0xaf18('0x32')],_0x306008[_0xaf18('0x35')]);_0x159386[_0xaf18('0x38')]=_[_0xaf18('0x37')](_0x306008[_0xaf18('0x32')],qs[_0xaf18('0x39')](_0x3fbaab['query'][_0xaf18('0x39')]));_0x159386[_0xaf18('0x38')]=_0x159386[_0xaf18('0x38')][_0xaf18('0x3a')]?_0x159386['attributes']:_0x306008[_0xaf18('0x32')];if(!_0x3fbaab[_0xaf18('0x35')]['hasOwnProperty'](_0xaf18('0x3b'))){_0x159386['limit']=qs['limit'](_0x3fbaab[_0xaf18('0x35')][_0xaf18('0x20')]);_0x159386[_0xaf18('0x1d')]=qs[_0xaf18('0x1d')](_0x3fbaab[_0xaf18('0x35')]['offset']);}_0x159386[_0xaf18('0x3c')]=qs[_0xaf18('0x3d')](_0x3fbaab[_0xaf18('0x35')][_0xaf18('0x3d')]);_0x159386[_0xaf18('0x3e')]=qs[_0xaf18('0x3f')](_[_0xaf18('0x40')](_0x3fbaab[_0xaf18('0x35')],_0x306008[_0xaf18('0x3f')]),_0x5ced8c);if(_0x3fbaab['query']['filter']){_0x159386[_0xaf18('0x3e')]=_['merge'](_0x159386['where'],{'$or':_[_0xaf18('0x2d')](_0x5ced8c,function(_0x19c3c3){if(_0x19c3c3['type']!==_0xaf18('0x41')){var _0x592f9b={};_0x592f9b[_0x19c3c3[_0xaf18('0x2a')]]={'$like':'%'+_0x3fbaab[_0xaf18('0x35')]['filter']+'%'};return _0x592f9b;}})});}_0x159386=_['merge']({},_0x159386,_0x3fbaab[_0xaf18('0x42')]);var _0x53c1cd={'where':_0x159386[_0xaf18('0x3e')]};return db[_0xaf18('0x2e')]['count'](_0x53c1cd)['then'](function(_0x41796d){_0x3cdfd7[_0xaf18('0x1f')]=_0x41796d;if(_0x3fbaab[_0xaf18('0x35')][_0xaf18('0x43')]){_0x159386['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x159386);})[_0xaf18('0x26')](function(_0x1cce40){_0x3cdfd7['rows']=_0x1cce40;return _0x3cdfd7;})[_0xaf18('0x26')](respondWithFilteredResult(_0xfc1470,_0x159386))[_0xaf18('0x44')](handleError(_0xfc1470,null));};exports[_0xaf18('0x45')]=function(_0x5c51f9,_0x222a01){var _0x49ab8c={'raw':![],'where':{'id':_0x5c51f9[_0xaf18('0x46')]['id']}},_0x3d0015={};_0x3d0015[_0xaf18('0x32')]=_[_0xaf18('0x36')](db[_0xaf18('0x2e')]['rawAttributes']);_0x3d0015[_0xaf18('0x35')]=_[_0xaf18('0x36')](_0x5c51f9[_0xaf18('0x35')]);_0x3d0015['filters']=_[_0xaf18('0x37')](_0x3d0015['model'],_0x3d0015['query']);_0x49ab8c[_0xaf18('0x38')]=_[_0xaf18('0x37')](_0x3d0015[_0xaf18('0x32')],qs[_0xaf18('0x39')](_0x5c51f9['query']['fields']));_0x49ab8c[_0xaf18('0x38')]=_0x49ab8c['attributes']['length']?_0x49ab8c['attributes']:_0x3d0015[_0xaf18('0x32')];if(_0x5c51f9[_0xaf18('0x35')][_0xaf18('0x43')]){_0x49ab8c[_0xaf18('0x47')]=[{'all':!![]}];}_0x49ab8c=_[_0xaf18('0x48')]({},_0x49ab8c,_0x5c51f9[_0xaf18('0x42')]);return db[_0xaf18('0x2e')][_0xaf18('0x49')](_0x49ab8c)[_0xaf18('0x26')](handleEntityNotFound(_0x222a01,null))[_0xaf18('0x26')](respondWithResult(_0x222a01,null))[_0xaf18('0x44')](handleError(_0x222a01,null));};exports[_0xaf18('0x4a')]=function(_0x534568,_0x4a3221){return db[_0xaf18('0x2e')][_0xaf18('0x4a')](_0x534568[_0xaf18('0x4b')],{})[_0xaf18('0x26')](respondWithResult(_0x4a3221,0xc9))[_0xaf18('0x44')](handleError(_0x4a3221,null));};exports[_0xaf18('0x25')]=function(_0x539e45,_0x3ae6ff){if(_0x539e45['body']['id']){delete _0x539e45['body']['id'];}return db['VoiceRecording'][_0xaf18('0x49')]({'where':{'id':_0x539e45['params']['id']}})[_0xaf18('0x26')](handleEntityNotFound(_0x3ae6ff,null))['then'](saveUpdates(_0x539e45[_0xaf18('0x4b')],null))['then'](respondWithResult(_0x3ae6ff,null))['catch'](handleError(_0x3ae6ff,null));};exports[_0xaf18('0x4c')]=function(_0x281dc1,_0x7c29f3){return db['VoiceRecording'][_0xaf18('0x4c')]()[_0xaf18('0x26')](respondWithResult(_0x7c29f3,null))['catch'](handleError(_0x7c29f3,null));};exports[_0xaf18('0x4d')]=function(_0x1ca931,_0x55d8a3,_0x30835e){var _0x1d4a02=require(_0xaf18('0x4e'));var _0x59ed96=![];var _0x3107c1={};if(_0x1ca931['query'][_0xaf18('0x31')]&&_0x1ca931[_0xaf18('0x35')][_0xaf18('0x31')]===_0xaf18('0x4f')){_0x3107c1[_0xaf18('0x4f')]=_0x1ca931[_0xaf18('0x46')]['id'];}else{_0x3107c1['id']=_0x1ca931[_0xaf18('0x46')]['id'];}return db[_0xaf18('0x2e')][_0xaf18('0x49')]({'where':_0x3107c1,'attributes':['id',_0xaf18('0x50')],'raw':!![]})[_0xaf18('0x26')](handleEntityNotFound(_0x55d8a3,null))[_0xaf18('0x26')](function(_0x3a7379){if(_0x3a7379){var _0x4dc272=_0x3a7379[_0xaf18('0x50')];var _0x3bacb3=util[_0xaf18('0x34')]('%s.cypher',_0x4dc272);if(fs[_0xaf18('0x51')](_0x3bacb3)){_0x59ed96=!![];return _0x1d4a02[_0xaf18('0x52')](_0x3bacb3,_0x4dc272,config[_0xaf18('0x53')]['recording'])['then'](function(){return _0x3a7379;});}return _0x3a7379;}})[_0xaf18('0x26')](function(_0x1835ed){if(_0x1835ed){var _0x73550=_0x1835ed['value'];if(!fs[_0xaf18('0x51')](_0x73550)){throw new db[(_0xaf18('0x54'))]['ValidationError'](_0xaf18('0x55'));}if(_0x1835ed[_0xaf18('0x56')]){return _0x55d8a3[_0xaf18('0x4d')](_0x73550,_0x1835ed[_0xaf18('0x56')]+path[_0xaf18('0x57')](_0x73550),function(){if(_0x59ed96){fs['unlink'](_0x73550);}});}else{return _0x55d8a3[_0xaf18('0x4d')](_0x73550,function(_0x462058){if(_0x59ed96){fs[_0xaf18('0x58')](_0x73550);}});}}})['catch'](function(_0x4fb863){if(_0x4fb863['message']==='VoiceRecording\x20not\x20found'){_0x55d8a3[_0xaf18('0x1b')](0x194)[_0xaf18('0x2b')](_0xaf18('0x59'));}else{return handleError(_0x55d8a3,null);}});};exports[_0xaf18('0x5a')]=function(_0x2bc1d1,_0xa40f,_0x5a2b88){var _0x560706=require(_0xaf18('0x4e'));var _0xe6f9a=![];var _0x2d2125={'$and':[db['sequelize']['where'](db[_0xaf18('0x5b')]['fn']('MD5',db[_0xaf18('0x5b')][_0xaf18('0x5c')](_0xaf18('0x4f'))),_0x2bc1d1['query'][_0xaf18('0x5d')])]};if(_0x2bc1d1[_0xaf18('0x35')]['type']&&_0x2bc1d1[_0xaf18('0x35')][_0xaf18('0x31')]===_0xaf18('0x4f')){_0x2d2125[_0xaf18('0x5e')][_0xaf18('0x5f')]({'uniqueid':_0x2bc1d1[_0xaf18('0x46')]['id']});}else{_0x2d2125[_0xaf18('0x5e')][_0xaf18('0x5f')]({'id':_0x2bc1d1[_0xaf18('0x46')]['id']});}return db[_0xaf18('0x2e')][_0xaf18('0x49')]({'where':_0x2d2125,'attributes':['id',_0xaf18('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0xa40f,null))['then'](function(_0x3b0695){if(_0x3b0695){var _0x54c73d=util[_0xaf18('0x34')](_0xaf18('0x60'),_0x3b0695['value']);if(fs[_0xaf18('0x51')](_0x54c73d)){_0xe6f9a=!![];return _0x560706[_0xaf18('0x52')](_0x54c73d,_0x3b0695['value'],config[_0xaf18('0x53')][_0xaf18('0x61')])[_0xaf18('0x26')](function(){return _0x3b0695;});}return _0x3b0695;}})['then'](function(_0x46d190){if(_0x46d190){if(!fs['existsSync'](_0x46d190['value'])){throw new db['Sequelize'][(_0xaf18('0x62'))]('VoiceRecording\x20not\x20found');}if(_0x46d190[_0xaf18('0x56')]){return _0xa40f['download'](_0x46d190['value'],_0x46d190[_0xaf18('0x56')]+path[_0xaf18('0x57')](_0x46d190[_0xaf18('0x50')]),function(){if(_0xe6f9a){fs[_0xaf18('0x58')](_0x46d190[_0xaf18('0x50')]);}});}else{return _0xa40f[_0xaf18('0x4d')](_0x46d190[_0xaf18('0x50')],function(_0x4998af){if(_0xe6f9a){fs[_0xaf18('0x58')](_0x46d190[_0xaf18('0x50')]);}});}}})['catch'](handleError(_0xa40f,null));};exports['destroy']=function(_0x5ddc30,_0x3a9e17){return db[_0xaf18('0x2e')][_0xaf18('0x49')]({'where':{'id':_0x5ddc30[_0xaf18('0x46')]['id']}})[_0xaf18('0x26')](function(_0xfbfca7){if(_[_0xaf18('0x63')](_0xfbfca7)){throw new ReferenceError(_0xaf18('0x64'));}return _0xfbfca7;})[_0xaf18('0x26')](function(_0x2242e7){var _0xdc698f=_0x2242e7[_0xaf18('0x50')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0xdc698f);if(!_[_0xaf18('0x63')](_0x2242e7[_0xaf18('0x50')])&&fs[_0xaf18('0x51')](_0xdc698f)){logger[_0xaf18('0x65')](_0xaf18('0x66')+_0xdc698f+_0xaf18('0x67'));fs[_0xaf18('0x68')](_0xdc698f);}_0xdc698f=_0xdc698f+_0xaf18('0x69');if(!_['isNil'](_0x2242e7[_0xaf18('0x50')])&&fs[_0xaf18('0x51')](_0xdc698f)){logger[_0xaf18('0x65')](_0xaf18('0x66')+_0xdc698f+_0xaf18('0x67'));fs[_0xaf18('0x68')](_0xdc698f);}return _0x2242e7;})[_0xaf18('0x26')](function(_0x538205){if(!_0x538205)throw new InternalError();return _0x538205[_0xaf18('0x27')]();})[_0xaf18('0x26')](function(){_0x3a9e17['status'](0xcc)['end']();})[_0xaf18('0x44')](handleError(_0x3a9e17,null));};function getBucketslist(_0x517c38,_0x41245d,_0x591a5b){return new Promise(function(_0x3ec9e2,_0x2dda00){var _0x57c04a=new AWS['S3']({'accessKeyId':_0x41245d,'secretAccessKey':_0x517c38,'region':_0x591a5b});_0x57c04a[_0xaf18('0x6a')]({},function(_0x16fc2a,_0x3ed39a){if(_0x16fc2a){return _0x2dda00(_0x16fc2a);}else{return _0x3ec9e2(_0x3ed39a);}});});}function createBucket(_0x3011ab,_0x4fc3e0,_0x588595,_0x44641b){return new Promise(function(_0x1972cc,_0x2c857f){var _0xf74c8c=new AWS['S3']({'accessKeyId':_0x4fc3e0,'secretAccessKey':_0x3011ab,'region':_0x588595});_0xf74c8c[_0xaf18('0x6b')]({'Bucket':_0x44641b},function(_0xf78c8d,_0x3131ad){if(_0xf78c8d){return _0x2c857f(_0xf78c8d);}else{return _0x1972cc(_0x3131ad);}});});}function uploadFile(_0x19b075,_0x341994,_0x150972,_0x388fb3,_0x57646d,_0x492761){return new Promise(function(_0x50de7b,_0x4bddde){var _0x3df05e=new AWS['S3']({'accessKeyId':_0x341994,'secretAccessKey':_0x19b075,'region':_0x150972});_0x3df05e[_0xaf18('0x6c')]({'Bucket':_0x388fb3,'Key':_0x57646d,'Body':_0x492761},function(_0x442117,_0x29bd8c){if(_0x442117){return _0x4bddde(_0x442117);}else{return _0x50de7b(_0x29bd8c);}});});}function startTranscribe(_0x3fdaaf,_0x517644,_0xcf21d7,_0x205030,_0xa4b8e5,_0x1308c3){return new Promise(function(_0x1b9f20,_0x49d88b){var _0x450a8c=new AWS[(_0xaf18('0x6d'))]({'accessKeyId':_0x517644,'secretAccessKey':_0x3fdaaf,'region':_0xcf21d7});_0x450a8c[_0xaf18('0x6e')]({'TranscriptionJobName':_0x205030,'LanguageCode':_0xa4b8e5,'Media':{'MediaFileUri':_0x1308c3}},function(_0x3e5a94,_0x4facf9){if(_0x3e5a94){return _0x49d88b(_0x3e5a94);}else{return _0x1b9f20(_0x4facf9);}});});}function transcribe(_0x308196,_0x377a6f,_0x5ab9b7,_0x33c795,_0x40033b,_0x3f54d7,_0x3cfe63){return new Promise(function(_0x127b79,_0x4a9235){var _0x3548fb={};logger[_0xaf18('0x65')](util[_0xaf18('0x34')](_0xaf18('0x6f'),_0x308196,_0x40033b));return uploadFile(_0x377a6f,_0x5ab9b7,_0x33c795,_0x40033b,path[_0xaf18('0x70')](_0x3f54d7),fs[_0xaf18('0x71')](_0x3f54d7))[_0xaf18('0x26')](function(_0x52e384){logger[_0xaf18('0x65')](util[_0xaf18('0x34')](_0xaf18('0x72'),_0x308196,_0x40033b,_0x52e384[_0xaf18('0x73')]));_0x3548fb['bucket']=_0x52e384[_0xaf18('0x74')];_0x3548fb['location']=_0x52e384[_0xaf18('0x73')];logger[_0xaf18('0x65')](util['format'](_0xaf18('0x75'),_0x308196));return startTranscribe(_0x377a6f,_0x5ab9b7,_0x33c795,uuidv4(),_0x3cfe63,_0x52e384[_0xaf18('0x73')]);})[_0xaf18('0x26')](function(_0x46bdb4){logger['info'](util[_0xaf18('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x308196,_0x46bdb4[_0xaf18('0x76')][_0xaf18('0x77')]));_0x3548fb[_0xaf18('0x78')]=_0x46bdb4[_0xaf18('0x76')]['TranscriptionJobName'];_0x3548fb[_0xaf18('0x79')]=_0x46bdb4[_0xaf18('0x76')][_0xaf18('0x7a')];return _0x127b79(_0x3548fb);})[_0xaf18('0x44')](function(_0x3647d0){return _0x4a9235(_0x3647d0);});});}exports[_0xaf18('0x7b')]=function(_0x44e57e,_0x2273c8,_0x13cb46){var _0x39d587;var _0x56f564;var _0x1f8d60;var _0x3a54e0=require('../../components/encryptor');return db[_0xaf18('0x2e')][_0xaf18('0x7c')]({'where':{'id':_0x44e57e[_0xaf18('0x46')]['id']}})[_0xaf18('0x26')](function(_0x448007){if(_0x448007){var _0x52ed4d=util[_0xaf18('0x34')]('%s.cypher',_0x448007[_0xaf18('0x50')]);if(fs[_0xaf18('0x51')](_0x52ed4d)){cypher=!![];return _0x3a54e0['decryptFile'](_0x52ed4d,_0x448007['value'],config['secrets']['recording'])[_0xaf18('0x26')](function(){return _0x448007;});}return _0x448007;}})[_0xaf18('0x26')](function(_0x5d9e17){if(!_0x5d9e17){throw new db[(_0xaf18('0x54'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x56f564=_0x5d9e17;return db[_0xaf18('0x7d')]['findOne']({'where':{'id':0x1}});})[_0xaf18('0x26')](handleEntityNotFound(_0x2273c8,null))[_0xaf18('0x26')](function(_0x1c3cad){if(_0x1c3cad){_0x39d587=_0x1c3cad;if(!_0x39d587[_0xaf18('0x7e')]||!_0x39d587[_0xaf18('0x7f')]||!_0x39d587['transcribeRegion']||!_0x39d587[_0xaf18('0x80')]||!_0x39d587['bucket']){throw new db[(_0xaf18('0x54'))]['ValidationError'](_0xaf18('0x81'));}if(_0x44e57e[_0xaf18('0x4b')][_0xaf18('0x82')]&&(!_0x39d587[_0xaf18('0x83')]||!_0x39d587[_0xaf18('0x84')]||!_0x39d587[_0xaf18('0x85')]||!_0x39d587[_0xaf18('0x80')]||!_0x39d587[_0xaf18('0x86')])){throw new db[(_0xaf18('0x54'))][(_0xaf18('0x62'))](_0xaf18('0x87'));}return db[_0xaf18('0x88')][_0xaf18('0x7c')]({'where':{'id':_0x39d587[_0xaf18('0x7f')]}});}})[_0xaf18('0x26')](function(_0x2c8aa2){if(!_0x2c8aa2){throw new db['Sequelize'][(_0xaf18('0x62'))](_0xaf18('0x89'));}if(!_0x2c8aa2[_0xaf18('0x8a')]||!_0x2c8aa2[_0xaf18('0x8b')]){throw new db['Sequelize'][(_0xaf18('0x62'))](_0xaf18('0x8c'));}_0x1f8d60=_0x2c8aa2;return getBucketslist(_0x1f8d60[_0xaf18('0x8a')],_0x1f8d60[_0xaf18('0x8b')],_0x39d587['transcribeRegion']);})[_0xaf18('0x26')](function(_0x33bd81){if(_0x33bd81&&_0x33bd81[_0xaf18('0x8d')]){var _0x50eaef=_[_0xaf18('0x49')](_0x33bd81[_0xaf18('0x8d')],function(_0xa836c4){return _0xa836c4['Name']===_0x39d587[_0xaf18('0x86')];});if(!_0x50eaef){logger[_0xaf18('0x65')](util[_0xaf18('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x44e57e[_0xaf18('0x46')]['id'],_0x39d587[_0xaf18('0x86')]));return createBucket(_0x1f8d60[_0xaf18('0x8a')],_0x1f8d60[_0xaf18('0x8b')],_0x39d587[_0xaf18('0x8e')],_0x39d587[_0xaf18('0x86')]);}logger[_0xaf18('0x65')](util[_0xaf18('0x34')](_0xaf18('0x8f'),_0x44e57e['params']['id'],_0x39d587['bucket']));return;}})[_0xaf18('0x26')](function(_0x28bac8){if(_0x56f564[_0xaf18('0x79')]===_0xaf18('0x90')){return transcribe(_0x44e57e[_0xaf18('0x46')]['id'],_0x1f8d60[_0xaf18('0x8a')],_0x1f8d60[_0xaf18('0x8b')],_0x39d587['transcribeRegion'],_0x39d587[_0xaf18('0x86')],_0x56f564['value'],_0x39d587['language']);}else{logger[_0xaf18('0x65')](util['format'](_0xaf18('0x91'),_0x44e57e[_0xaf18('0x46')]['id']));return{'transcribeStatus':_0xaf18('0x92')};}})[_0xaf18('0x26')](function(_0x53a54c){if(_0x53a54c){_0x53a54c[_0xaf18('0x93')]=_0x44e57e[_0xaf18('0x4b')]['runSentiment'];return _0x56f564[_0xaf18('0x94')](_0x53a54c);}})[_0xaf18('0x26')](respondWithResult(_0x2273c8,null))['catch'](handleError(_0x2273c8,null));};function writeFile(_0x3a9c3b,_0x2a8656){return new Promise(function(_0xa29189,_0x1df2d9){fs[_0xaf18('0x95')](_0x2a8656,_0x3a9c3b,function(_0xbc126c,_0x15e57a){if(_0xbc126c){return _0x1df2d9(_0xbc126c);}else{return _0xa29189(_0x15e57a);}});});}exports[_0xaf18('0x96')]=function(_0x5ad914,_0x1c06d2,_0x20c4f5){return db[_0xaf18('0x2e')][_0xaf18('0x7c')]({'where':{'id':_0x5ad914['params']['id']}})[_0xaf18('0x26')](handleEntityNotFound(_0x1c06d2))[_0xaf18('0x26')](function(_0x23df67){if(_0x23df67&&_0x23df67[_0xaf18('0x97')]){var _0x236d5a=_0x23df67[_0xaf18('0x97')];var _0x451985=config[_0xaf18('0x98')]+_0xaf18('0x99')+_0x23df67['id']+_0xaf18('0x9a');if(fs['existsSync'](_0x451985)){return _0x451985;}return writeFile(_0x236d5a,_0x451985)['then'](function(){return _0x451985;});}else{throw new db[(_0xaf18('0x54'))][(_0xaf18('0x62'))]('Transcript\x20not\x20available');}})['then'](function(_0x112e10){return _0x1c06d2[_0xaf18('0x4d')](_0x112e10);})[_0xaf18('0x44')](handleError(_0x1c06d2));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 52d8ffe..64bd729 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 _0xff99=['rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','util','api','path'];(function(_0x65a31e,_0x1cee3d){var _0x2c8f6e=function(_0xc22267){while(--_0xc22267){_0x65a31e['push'](_0x65a31e['shift']());}};_0x2c8f6e(++_0x1cee3d);}(_0xff99,0x129));var _0x9ff9=function(_0x2b201a,_0xa16892){_0x2b201a=_0x2b201a-0x0;var _0x1acbee=_0xff99[_0x2b201a];return _0x1acbee;};'use strict';var _=require('lodash');var util=require(_0x9ff9('0x0'));var logger=require('../../config/logger')(_0x9ff9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ff9('0x2'));var rimraf=require(_0x9ff9('0x3'));var config=require(_0x9ff9('0x4'));var attributes=require(_0x9ff9('0x5'));module['exports']=function(_0x5f294c,_0x2e8c22){return _0x5f294c[_0x9ff9('0x6')](_0x9ff9('0x7'),attributes,{'tableName':_0x9ff9('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9ff9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65ec=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x65ec,0x16c));var _0xc65e=function(_0x17cd23,_0x2a4b1a){_0x17cd23=_0x17cd23-0x0;var _0x204df4=_0x65ec[_0x17cd23];return _0x204df4;};'use strict';var _=require(_0xc65e('0x0'));var util=require(_0xc65e('0x1'));var logger=require(_0xc65e('0x2'))('api');var moment=require(_0xc65e('0x3'));var BPromise=require('bluebird');var rp=require(_0xc65e('0x4'));var fs=require('fs');var path=require(_0xc65e('0x5'));var rimraf=require(_0xc65e('0x6'));var config=require(_0xc65e('0x7'));var attributes=require(_0xc65e('0x8'));module[_0xc65e('0x9')]=function(_0x1e8206,_0x1bade7){return _0x1e8206[_0xc65e('0xa')]('VoiceRecording',attributes,{'tableName':_0xc65e('0xb'),'paranoid':![],'indexes':[{'name':_0xc65e('0xc'),'fields':[_0xc65e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index cba3550..e6f6f98 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 _0x0424=['stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s'];(function(_0x5400a1,_0x2275aa){var _0x4006c7=function(_0x5002dc){while(--_0x5002dc){_0x5400a1['push'](_0x5400a1['shift']());}};_0x4006c7(++_0x2275aa);}(_0x0424,0x159));var _0x4042=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0x0424[_0xb3b452];return _0x238983;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('VoiceRecording,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['update'](_0x466077[_0x4042('0x17')],{'raw':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466077['options']?_0x466077[_0x4042('0x18')][_0x4042('0x1a')]||null:null,'attributes':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')]['attributes']||null:null,'limit':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x1b')]||null:null})[_0x4042('0xa')](function(_0x352631){logger['info'](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('UpdateVoiceRecording',_0x466077,JSON[_0x4042('0xf')](_0x352631));_0xe5c1ec(_0x352631);})['catch'](function(_0x271b82){logger[_0x4042('0x10')](_0x4042('0x15'),_0x271b82['message'],_0x466077);_0x4fe024(_0x4b02d4[_0x4042('0x10')](0x1f4,_0x271b82[_0x4042('0x11')]));});});};exports[_0x4042('0x1c')]=function(_0xbdadc8){var _0x1c4d9f=this;return new Promise(function(_0x52e575,_0x58c409){var _0x1d8d48=require(_0x4042('0x1d'));var _0x26542c;return db[_0x4042('0x1e')][_0x4042('0x1f')]({'attributes':['id',_0x4042('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x33733b){_0x26542c=_0x33733b;return db[_0x4042('0x16')]['create'](_0xbdadc8[_0x4042('0x17')]);})[_0x4042('0xa')](function(_0xe924fe){if(_0x26542c['callRecordingEncryption']&&fs['existsSync'](_0xe924fe[_0x4042('0x21')])){var _0x43bd1c=util['format'](_0x4042('0x22'),_0xe924fe[_0x4042('0x21')]);return _0x1d8d48[_0x4042('0x23')](_0xe924fe[_0x4042('0x21')],_0x43bd1c,config[_0x4042('0x24')][_0x4042('0x25')])[_0x4042('0xa')](function(){fs[_0x4042('0x26')](_0xe924fe[_0x4042('0x21')]);logger['info'](_0x4042('0x27'));return _0xe924fe;});}return _0xe924fe;})[_0x4042('0xa')](function(_0x5320f8){logger[_0x4042('0x12')](_0x4042('0x1c'),_0xbdadc8);logger['debug'](_0x4042('0x1c'),_0xbdadc8,JSON[_0x4042('0xf')](_0x5320f8));_0x52e575(_0x5320f8);})[_0x4042('0x14')](function(_0xaa7c99){logger[_0x4042('0x10')](_0x4042('0x1c'),_0xaa7c99[_0x4042('0x11')],_0xbdadc8);_0x58c409(_0x1c4d9f[_0x4042('0x10')](0x1f4,_0xaa7c99[_0x4042('0x11')]));});});}; \ No newline at end of file +var _0xe5af=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','raw','options','where','limit','debug','../../components/encryptor','Setting','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xe5af,0x9c));var _0xfe5a=function(_0x3f7929,_0x5db3e1){_0x3f7929=_0x3f7929-0x0;var _0x4df0e5=_0xe5af[_0x3f7929];return _0x4df0e5;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eea2e,_0x356c69,_0x106492){return new BPromise(function(_0xfb4357,_0x3e683c){return client['request'](_0x5eea2e,_0x106492)[_0xfe5a('0x8')](function(_0x5a48ff){logger['info'](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));logger['debug'](_0xfe5a('0xb'),_0x356c69,_0xfe5a('0xa'),JSON[_0xfe5a('0xc')](_0x5a48ff));if(_0x5a48ff[_0xfe5a('0xd')]){if(_0x5a48ff[_0xfe5a('0xd')]['code']===0x1f4){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0x3e683c(_0x5a48ff[_0xfe5a('0xd')]['message']);}logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0xfb4357(_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));_0xfb4357(_0x5a48ff[_0xfe5a('0x10')][_0xfe5a('0xe')]);}})[_0xfe5a('0x11')](function(_0x22afa7){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x22afa7);_0x3e683c(_0x22afa7);});});}exports[_0xfe5a('0x12')]=function(_0x5bf597){var _0x20620b=this;return new Promise(function(_0x456707,_0x54d5fb){return db[_0xfe5a('0x13')][_0xfe5a('0x14')](_0x5bf597[_0xfe5a('0x15')],{'raw':_0x5bf597['options']?_0x5bf597['options'][_0xfe5a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bf597[_0xfe5a('0x17')]?_0x5bf597[_0xfe5a('0x17')][_0xfe5a('0x18')]||null:null,'attributes':_0x5bf597[_0xfe5a('0x17')]?_0x5bf597[_0xfe5a('0x17')]['attributes']||null:null,'limit':_0x5bf597[_0xfe5a('0x17')]?_0x5bf597['options'][_0xfe5a('0x19')]||null:null})[_0xfe5a('0x8')](function(_0x1fbde5){logger['info']('UpdateVoiceRecording',_0x5bf597);logger[_0xfe5a('0x1a')](_0xfe5a('0x12'),_0x5bf597,JSON['stringify'](_0x1fbde5));_0x456707(_0x1fbde5);})[_0xfe5a('0x11')](function(_0x26f744){logger['error'](_0xfe5a('0x12'),_0x26f744[_0xfe5a('0xe')],_0x5bf597);_0x54d5fb(_0x20620b[_0xfe5a('0xd')](0x1f4,_0x26f744[_0xfe5a('0xe')]));});});};exports['CreateVoiceRecording']=function(_0x42136e){var _0x2f5d04=this;return new Promise(function(_0x24481f,_0x1cd531){var _0x36bf20=require(_0xfe5a('0x1b'));var _0xdbf1e0;return db[_0xfe5a('0x1c')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xfe5a('0x8')](function(_0x485f9d){_0xdbf1e0=_0x485f9d;return db[_0xfe5a('0x13')][_0xfe5a('0x1d')](_0x42136e[_0xfe5a('0x15')]);})['then'](function(_0x48a061){if(_0xdbf1e0['callRecordingEncryption']&&fs[_0xfe5a('0x1e')](_0x48a061['value'])){var _0x51d1f4=util['format'](_0xfe5a('0x1f'),_0x48a061[_0xfe5a('0x20')]);return _0x36bf20[_0xfe5a('0x21')](_0x48a061[_0xfe5a('0x20')],_0x51d1f4,config[_0xfe5a('0x22')][_0xfe5a('0x23')])[_0xfe5a('0x8')](function(){fs[_0xfe5a('0x24')](_0x48a061[_0xfe5a('0x20')]);logger[_0xfe5a('0xf')](_0xfe5a('0x25'));return _0x48a061;});}return _0x48a061;})['then'](function(_0x1f0c86){logger[_0xfe5a('0xf')]('CreateVoiceRecording',_0x42136e);logger[_0xfe5a('0x1a')](_0xfe5a('0x26'),_0x42136e,JSON[_0xfe5a('0xc')](_0x1f0c86));_0x24481f(_0x1f0c86);})[_0xfe5a('0x11')](function(_0xe5a992){logger['error']('CreateVoiceRecording',_0xe5a992[_0xfe5a('0xe')],_0x42136e);_0x1cd531(_0x2f5d04['error'](0x1f4,_0xe5a992[_0xfe5a('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 29f1ad0..a98fb18 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 _0x4e5b=['exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x28c1b2,_0x38711b){var _0x20ba28=function(_0x194648){while(--_0x194648){_0x28c1b2['push'](_0x28c1b2['shift']());}};_0x20ba28(++_0x38711b);}(_0x4e5b,0x1ba));var _0xb4e5=function(_0x1a4092,_0x3551f3){_0x1a4092=_0x1a4092-0x0;var _0x26d9f7=_0x4e5b[_0x1a4092];return _0x26d9f7;};'use strict';var multer=require(_0xb4e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb4e5('0x1'));var express=require(_0xb4e5('0x2'));var router=express['Router']();var fs_extra=require(_0xb4e5('0x3'));var auth=require(_0xb4e5('0x4'));var interaction=require(_0xb4e5('0x5'));var config=require(_0xb4e5('0x6'));var controller=require(_0xb4e5('0x7'));router[_0xb4e5('0x8')]('/',auth[_0xb4e5('0x9')](),controller[_0xb4e5('0xa')]);router[_0xb4e5('0x8')](_0xb4e5('0xb'),auth[_0xb4e5('0x9')](),controller['describe']);router['get'](_0xb4e5('0xc'),auth[_0xb4e5('0x9')](),controller[_0xb4e5('0xd')]);router[_0xb4e5('0xe')]('/',auth[_0xb4e5('0x9')](),controller[_0xb4e5('0xf')]);router[_0xb4e5('0x10')]('/:id',auth[_0xb4e5('0x9')](),controller[_0xb4e5('0x11')]);router[_0xb4e5('0x12')]('/:id',auth[_0xb4e5('0x9')](),controller[_0xb4e5('0x13')]);module[_0xb4e5('0x14')]=router; \ No newline at end of file +var _0x509c=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0x509c,0x16f));var _0xc509=function(_0x18f9e1,_0x2763b3){_0x18f9e1=_0x18f9e1-0x0;var _0x61a32d=_0x509c[_0x18f9e1];return _0x61a32d;};'use strict';var multer=require(_0xc509('0x0'));var util=require(_0xc509('0x1'));var path=require(_0xc509('0x2'));var timeout=require(_0xc509('0x3'));var express=require(_0xc509('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc509('0x5'));var interaction=require(_0xc509('0x6'));var config=require(_0xc509('0x7'));var controller=require(_0xc509('0x8'));router[_0xc509('0x9')]('/',auth[_0xc509('0xa')](),controller['index']);router['get'](_0xc509('0xb'),auth[_0xc509('0xa')](),controller[_0xc509('0xc')]);router[_0xc509('0x9')](_0xc509('0xd'),auth[_0xc509('0xa')](),controller[_0xc509('0xe')]);router[_0xc509('0xf')]('/',auth[_0xc509('0xa')](),controller[_0xc509('0x10')]);router[_0xc509('0x11')](_0xc509('0xd'),auth[_0xc509('0xa')](),controller[_0xc509('0x12')]);router[_0xc509('0x13')](_0xc509('0xd'),auth[_0xc509('0xa')](),controller[_0xc509('0x14')]);module[_0xc509('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 42700fb..248c15d 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 _0x296f=['ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x4c39c9,_0x4f4f33){var _0x4e603c=function(_0x4d6dd9){while(--_0x4d6dd9){_0x4c39c9['push'](_0x4c39c9['shift']());}};_0x4e603c(++_0x4f4f33);}(_0x296f,0x83));var _0xf296=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0x296f[_0x1af05b];return _0x5be7cc;};'use strict';var Sequelize=require(_0xf296('0x0'));var moment=require(_0xf296('0x1'));module['exports']={'type':{'type':Sequelize[_0xf296('0x2')](_0xf296('0x3'),_0xf296('0x4'))},'result':{'type':Sequelize[_0xf296('0x5')]},'transfererchannel':{'type':Sequelize[_0xf296('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xf296('0x5')]},'transferercalleridname':{'type':Sequelize[_0xf296('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xf296('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xf296('0x5')]},'transferercontext':{'type':Sequelize[_0xf296('0x5')]},'transfererexten':{'type':Sequelize[_0xf296('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xf296('0x5')]},'transfereechannel':{'type':Sequelize[_0xf296('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf296('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf296('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf296('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xf296('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xf296('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xf296('0x5')]},'isexternal':{'type':Sequelize[_0xf296('0x2')](_0xf296('0x6'),'No')},'context':{'type':Sequelize[_0xf296('0x5')]},'extension':{'type':Sequelize[_0xf296('0x5')]}}; \ No newline at end of file +var _0x578c=['ENUM','blind','STRING','Yes','exports'];(function(_0x3bcaec,_0x2c4e2c){var _0x1b068c=function(_0x36046a){while(--_0x36046a){_0x3bcaec['push'](_0x3bcaec['shift']());}};_0x1b068c(++_0x2c4e2c);}(_0x578c,0x17b));var _0xc578=function(_0x4baa55,_0x250d3c){_0x4baa55=_0x4baa55-0x0;var _0x1cfc4c=_0x578c[_0x4baa55];return _0x1cfc4c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xc578('0x0')]={'type':{'type':Sequelize[_0xc578('0x1')](_0xc578('0x2'),'attended')},'result':{'type':Sequelize[_0xc578('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xc578('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xc578('0x3')]},'transferercontext':{'type':Sequelize[_0xc578('0x3')]},'transfererexten':{'type':Sequelize[_0xc578('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xc578('0x3')]},'transfereechannel':{'type':Sequelize[_0xc578('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xc578('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xc578('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xc578('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xc578('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xc578('0x3')]},'transfereecontext':{'type':Sequelize[_0xc578('0x3')]},'transfereeexten':{'type':Sequelize[_0xc578('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xc578('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0xc578('0x4'),'No')},'context':{'type':Sequelize[_0xc578('0x3')]},'extension':{'type':Sequelize[_0xc578('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f21a66e..619b18d 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 _0xe2dc=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','VoiceTransferReport','includeAll','catch','show','params','fields','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then'];(function(_0x548e4a,_0x48d82e){var _0x19d4cc=function(_0x2ed375){while(--_0x2ed375){_0x548e4a['push'](_0x548e4a['shift']());}};_0x19d4cc(++_0x48d82e);}(_0xe2dc,0xc3));var _0xce2d=function(_0x2c6f6f,_0x579475){_0x2c6f6f=_0x2c6f6f-0x0;var _0x19902b=_0xe2dc[_0x2c6f6f];return _0x19902b;};'use strict';var emlformat=require(_0xce2d('0x0'));var rimraf=require(_0xce2d('0x1'));var zipdir=require(_0xce2d('0x2'));var jsonpatch=require(_0xce2d('0x3'));var rp=require(_0xce2d('0x4'));var moment=require('moment');var BPromise=require(_0xce2d('0x5'));var Mustache=require(_0xce2d('0x6'));var util=require('util');var path=require(_0xce2d('0x7'));var sox=require(_0xce2d('0x8'));var csv=require(_0xce2d('0x9'));var ejs=require(_0xce2d('0xa'));var fs=require('fs');var fs_extra=require(_0xce2d('0xb'));var _=require(_0xce2d('0xc'));var squel=require(_0xce2d('0xd'));var crypto=require(_0xce2d('0xe'));var jsforce=require(_0xce2d('0xf'));var deskjs=require(_0xce2d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xce2d('0x11'));var Papa=require(_0xce2d('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce2d('0x13'));var as=require(_0xce2d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xce2d('0x15'));var utils=require(_0xce2d('0x16'));var config=require(_0xce2d('0x17'));var licenseUtil=require(_0xce2d('0x18'));var db=require(_0xce2d('0x19'))['db'];function respondWithStatusCode(_0x3024ab,_0x3add8c){_0x3add8c=_0x3add8c||0xcc;return function(_0x2f4bcc){if(_0x2f4bcc){return _0x3024ab[_0xce2d('0x1a')](_0x3add8c);}return _0x3024ab['status'](_0x3add8c)[_0xce2d('0x1b')]();};}function respondWithResult(_0x179efd,_0x2aa4d1){_0x2aa4d1=_0x2aa4d1||0xc8;return function(_0x50b621){if(_0x50b621){return _0x179efd[_0xce2d('0x1c')](_0x2aa4d1)[_0xce2d('0x1d')](_0x50b621);}};}function respondWithFilteredResult(_0x4b1a93,_0x5c8ba6){return function(_0x19669c){if(_0x19669c){var _0x307857=typeof _0x5c8ba6[_0xce2d('0x1e')]===_0xce2d('0x1f')&&typeof _0x5c8ba6['limit']===_0xce2d('0x1f');var _0x5c01b5=_0x19669c[_0xce2d('0x20')];var _0x3ef0a9=_0x307857?0x0:_0x5c8ba6[_0xce2d('0x1e')];var _0x4368ae=_0x307857?_0x19669c[_0xce2d('0x20')]:_0x5c8ba6[_0xce2d('0x1e')]+_0x5c8ba6['limit'];var _0x2d44d9;if(_0x4368ae>=_0x5c01b5){_0x4368ae=_0x5c01b5;_0x2d44d9=0xc8;}else{_0x2d44d9=0xce;}_0x4b1a93[_0xce2d('0x1c')](_0x2d44d9);return _0x4b1a93['set'](_0xce2d('0x21'),_0x3ef0a9+'-'+_0x4368ae+'/'+_0x5c01b5)[_0xce2d('0x1d')](_0x19669c);}return null;};}function patchUpdates(_0x4e7e6f){return function(_0x3b871e){try{jsonpatch[_0xce2d('0x22')](_0x3b871e,_0x4e7e6f,!![]);}catch(_0x282cf3){return BPromise[_0xce2d('0x23')](_0x282cf3);}return _0x3b871e[_0xce2d('0x24')]();};}function saveUpdates(_0x2cd397,_0x36f882){return function(_0x313f69){if(_0x313f69){return _0x313f69[_0xce2d('0x25')](_0x2cd397)[_0xce2d('0x26')](function(_0x52e328){return _0x52e328;});}return null;};}function removeEntity(_0x4e3568,_0x2c7c18){return function(_0x240cc5){if(_0x240cc5){return _0x240cc5[_0xce2d('0x27')]()['then'](function(){_0x4e3568['status'](0xcc)[_0xce2d('0x1b')]();});}};}function handleEntityNotFound(_0x524803,_0x563e64){return function(_0x192e64){if(!_0x192e64){_0x524803[_0xce2d('0x1a')](0x194);}return _0x192e64;};}function handleError(_0x3ba878,_0x3d6912){_0x3d6912=_0x3d6912||0x1f4;return function(_0x512c61){logger[_0xce2d('0x28')](_0x512c61[_0xce2d('0x29')]);if(_0x512c61['name']){delete _0x512c61[_0xce2d('0x2a')];}_0x3ba878[_0xce2d('0x1c')](_0x3d6912)[_0xce2d('0x2b')](_0x512c61);};}exports[_0xce2d('0x2c')]=function(_0x2f8a3b,_0x33f7fc){var _0x5567a7={},_0x924e04={},_0xb25d3b={'count':0x0,'rows':[]};var _0x116c3a=_[_0xce2d('0x2d')](db['VoiceTransferReport'][_0xce2d('0x2e')],function(_0x272813){return{'name':_0x272813[_0xce2d('0x2f')],'type':_0x272813['type']['key']};});_0x924e04[_0xce2d('0x30')]=_[_0xce2d('0x2d')](_0x116c3a,'name');_0x924e04[_0xce2d('0x31')]=_[_0xce2d('0x32')](_0x2f8a3b['query']);_0x924e04[_0xce2d('0x33')]=_[_0xce2d('0x34')](_0x924e04[_0xce2d('0x30')],_0x924e04[_0xce2d('0x31')]);_0x5567a7['attributes']=_[_0xce2d('0x34')](_0x924e04[_0xce2d('0x30')],qs['fields'](_0x2f8a3b[_0xce2d('0x31')]['fields']));_0x5567a7['attributes']=_0x5567a7[_0xce2d('0x35')]['length']?_0x5567a7[_0xce2d('0x35')]:_0x924e04[_0xce2d('0x30')];if(!_0x2f8a3b[_0xce2d('0x31')][_0xce2d('0x36')](_0xce2d('0x37'))){_0x5567a7[_0xce2d('0x38')]=qs['limit'](_0x2f8a3b[_0xce2d('0x31')][_0xce2d('0x38')]);_0x5567a7[_0xce2d('0x1e')]=qs['offset'](_0x2f8a3b[_0xce2d('0x31')][_0xce2d('0x1e')]);}_0x5567a7[_0xce2d('0x39')]=qs['sort'](_0x2f8a3b['query'][_0xce2d('0x3a')]);_0x5567a7[_0xce2d('0x3b')]=qs['filters'](_[_0xce2d('0x3c')](_0x2f8a3b[_0xce2d('0x31')],_0x924e04[_0xce2d('0x33')]),_0x116c3a);if(_0x2f8a3b[_0xce2d('0x31')]['filter']){_0x5567a7[_0xce2d('0x3b')]=_['merge'](_0x5567a7[_0xce2d('0x3b')],{'$or':_[_0xce2d('0x2d')](_0x116c3a,function(_0x104faf){if(_0x104faf[_0xce2d('0x3d')]!==_0xce2d('0x3e')){var _0x1920aa={};_0x1920aa[_0x104faf[_0xce2d('0x2a')]]={'$like':'%'+_0x2f8a3b[_0xce2d('0x31')][_0xce2d('0x3f')]+'%'};return _0x1920aa;}})});}_0x5567a7=_[_0xce2d('0x40')]({},_0x5567a7,_0x2f8a3b[_0xce2d('0x41')]);var _0x3115d5={'where':_0x5567a7[_0xce2d('0x3b')]};return db[_0xce2d('0x42')][_0xce2d('0x20')](_0x3115d5)[_0xce2d('0x26')](function(_0x441eef){_0xb25d3b[_0xce2d('0x20')]=_0x441eef;if(_0x2f8a3b[_0xce2d('0x31')][_0xce2d('0x43')]){_0x5567a7['include']=[{'all':!![]}];}return db[_0xce2d('0x42')]['findAll'](_0x5567a7);})['then'](function(_0x5a538c){_0xb25d3b['rows']=_0x5a538c;return _0xb25d3b;})[_0xce2d('0x26')](respondWithFilteredResult(_0x33f7fc,_0x5567a7))[_0xce2d('0x44')](handleError(_0x33f7fc,null));};exports[_0xce2d('0x45')]=function(_0x4eebe3,_0x4b979f){var _0x37aad0={'raw':!![],'where':{'id':_0x4eebe3[_0xce2d('0x46')]['id']}},_0x29a51e={};_0x29a51e[_0xce2d('0x30')]=_[_0xce2d('0x32')](db['VoiceTransferReport'][_0xce2d('0x2e')]);_0x29a51e[_0xce2d('0x31')]=_['keys'](_0x4eebe3['query']);_0x29a51e[_0xce2d('0x33')]=_[_0xce2d('0x34')](_0x29a51e[_0xce2d('0x30')],_0x29a51e[_0xce2d('0x31')]);_0x37aad0[_0xce2d('0x35')]=_[_0xce2d('0x34')](_0x29a51e[_0xce2d('0x30')],qs['fields'](_0x4eebe3[_0xce2d('0x31')][_0xce2d('0x47')]));_0x37aad0[_0xce2d('0x35')]=_0x37aad0[_0xce2d('0x35')][_0xce2d('0x48')]?_0x37aad0[_0xce2d('0x35')]:_0x29a51e[_0xce2d('0x30')];if(_0x4eebe3[_0xce2d('0x31')][_0xce2d('0x43')]){_0x37aad0[_0xce2d('0x49')]=[{'all':!![]}];}_0x37aad0=_[_0xce2d('0x40')]({},_0x37aad0,_0x4eebe3['options']);return db['VoiceTransferReport'][_0xce2d('0x4a')](_0x37aad0)['then'](handleEntityNotFound(_0x4b979f,null))['then'](respondWithResult(_0x4b979f,null))[_0xce2d('0x44')](handleError(_0x4b979f,null));};exports[_0xce2d('0x4b')]=function(_0x1e7ecc,_0x35764c){return db[_0xce2d('0x42')][_0xce2d('0x4b')](_0x1e7ecc[_0xce2d('0x4c')],{})[_0xce2d('0x26')](respondWithResult(_0x35764c,0xc9))[_0xce2d('0x44')](handleError(_0x35764c,null));};exports['update']=function(_0x351d59,_0x49ac11){if(_0x351d59['body']['id']){delete _0x351d59['body']['id'];}return db[_0xce2d('0x42')][_0xce2d('0x4a')]({'where':{'id':_0x351d59[_0xce2d('0x46')]['id']}})[_0xce2d('0x26')](handleEntityNotFound(_0x49ac11,null))['then'](saveUpdates(_0x351d59[_0xce2d('0x4c')],null))[_0xce2d('0x26')](respondWithResult(_0x49ac11,null))[_0xce2d('0x44')](handleError(_0x49ac11,null));};exports['destroy']=function(_0x50c1ed,_0x10e6cc){return db['VoiceTransferReport']['find']({'where':{'id':_0x50c1ed[_0xce2d('0x46')]['id']}})[_0xce2d('0x26')](handleEntityNotFound(_0x10e6cc,null))[_0xce2d('0x26')](removeEntity(_0x10e6cc,null))[_0xce2d('0x44')](handleError(_0x10e6cc,null));};exports[_0xce2d('0x4d')]=function(_0xbe6f44,_0x4537a1){return db['VoiceTransferReport'][_0xce2d('0x4d')]()[_0xce2d('0x26')](respondWithResult(_0x4537a1,null))[_0xce2d('0x44')](handleError(_0x4537a1,null));}; \ No newline at end of file +var _0x16f1=['find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','reject','destroy','then','end','sendStatus','error','name','send','map','VoiceTransferReport','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x16f1,0x99));var _0x116f=function(_0x34dccd,_0x45a1b1){_0x34dccd=_0x34dccd-0x0;var _0x5aea54=_0x16f1[_0x34dccd];return _0x5aea54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x116f('0x0'));var zipdir=require(_0x116f('0x1'));var jsonpatch=require(_0x116f('0x2'));var rp=require(_0x116f('0x3'));var moment=require('moment');var BPromise=require(_0x116f('0x4'));var Mustache=require(_0x116f('0x5'));var util=require(_0x116f('0x6'));var path=require(_0x116f('0x7'));var sox=require('sox');var csv=require(_0x116f('0x8'));var ejs=require(_0x116f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x116f('0xa'));var squel=require(_0x116f('0xb'));var crypto=require(_0x116f('0xc'));var jsforce=require(_0x116f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x116f('0xe'));var Papa=require(_0x116f('0xf'));var Redis=require('ioredis');var authService=require(_0x116f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x116f('0x11'));var logger=require(_0x116f('0x12'))(_0x116f('0x13'));var utils=require(_0x116f('0x14'));var config=require(_0x116f('0x15'));var licenseUtil=require(_0x116f('0x16'));var db=require(_0x116f('0x17'))['db'];function respondWithStatusCode(_0x788594,_0x41a595){_0x41a595=_0x41a595||0xcc;return function(_0x5d77fe){if(_0x5d77fe){return _0x788594['sendStatus'](_0x41a595);}return _0x788594[_0x116f('0x18')](_0x41a595)['end']();};}function respondWithResult(_0x3ac0bd,_0x3308e4){_0x3308e4=_0x3308e4||0xc8;return function(_0x2d9dc8){if(_0x2d9dc8){return _0x3ac0bd[_0x116f('0x18')](_0x3308e4)[_0x116f('0x19')](_0x2d9dc8);}};}function respondWithFilteredResult(_0x5b7481,_0x2175d9){return function(_0x193bc8){if(_0x193bc8){var _0x55d01a=typeof _0x2175d9[_0x116f('0x1a')]===_0x116f('0x1b')&&typeof _0x2175d9[_0x116f('0x1c')]==='undefined';var _0x4bd20f=_0x193bc8['count'];var _0x50f3f0=_0x55d01a?0x0:_0x2175d9['offset'];var _0x2e1973=_0x55d01a?_0x193bc8['count']:_0x2175d9[_0x116f('0x1a')]+_0x2175d9[_0x116f('0x1c')];var _0x5e6949;if(_0x2e1973>=_0x4bd20f){_0x2e1973=_0x4bd20f;_0x5e6949=0xc8;}else{_0x5e6949=0xce;}_0x5b7481[_0x116f('0x18')](_0x5e6949);return _0x5b7481[_0x116f('0x1d')]('Content-Range',_0x50f3f0+'-'+_0x2e1973+'/'+_0x4bd20f)[_0x116f('0x19')](_0x193bc8);}return null;};}function patchUpdates(_0x23355a){return function(_0x391f4e){try{jsonpatch['apply'](_0x391f4e,_0x23355a,!![]);}catch(_0x1aad03){return BPromise[_0x116f('0x1e')](_0x1aad03);}return _0x391f4e['save']();};}function saveUpdates(_0x1da8b2,_0x13a5ed){return function(_0x1d8830){if(_0x1d8830){return _0x1d8830['update'](_0x1da8b2)['then'](function(_0x46a2a4){return _0x46a2a4;});}return null;};}function removeEntity(_0x1f660,_0x4d607c){return function(_0x545c72){if(_0x545c72){return _0x545c72[_0x116f('0x1f')]()[_0x116f('0x20')](function(){_0x1f660[_0x116f('0x18')](0xcc)[_0x116f('0x21')]();});}};}function handleEntityNotFound(_0x514db5,_0x587acd){return function(_0x179307){if(!_0x179307){_0x514db5[_0x116f('0x22')](0x194);}return _0x179307;};}function handleError(_0x382dc3,_0x29536f){_0x29536f=_0x29536f||0x1f4;return function(_0x531f6f){logger[_0x116f('0x23')](_0x531f6f['stack']);if(_0x531f6f['name']){delete _0x531f6f[_0x116f('0x24')];}_0x382dc3['status'](_0x29536f)[_0x116f('0x25')](_0x531f6f);};}exports['index']=function(_0x480056,_0x52d983){var _0x3ba033={},_0x58992d={},_0x3d97a6={'count':0x0,'rows':[]};var _0x3b1bc7=_[_0x116f('0x26')](db[_0x116f('0x27')]['rawAttributes'],function(_0x36345d){return{'name':_0x36345d[_0x116f('0x28')],'type':_0x36345d['type'][_0x116f('0x29')]};});_0x58992d[_0x116f('0x2a')]=_[_0x116f('0x26')](_0x3b1bc7,_0x116f('0x24'));_0x58992d[_0x116f('0x2b')]=_[_0x116f('0x2c')](_0x480056['query']);_0x58992d['filters']=_['intersection'](_0x58992d['model'],_0x58992d[_0x116f('0x2b')]);_0x3ba033[_0x116f('0x2d')]=_[_0x116f('0x2e')](_0x58992d['model'],qs[_0x116f('0x2f')](_0x480056['query']['fields']));_0x3ba033['attributes']=_0x3ba033[_0x116f('0x2d')][_0x116f('0x30')]?_0x3ba033[_0x116f('0x2d')]:_0x58992d[_0x116f('0x2a')];if(!_0x480056[_0x116f('0x2b')][_0x116f('0x31')](_0x116f('0x32'))){_0x3ba033['limit']=qs[_0x116f('0x1c')](_0x480056[_0x116f('0x2b')][_0x116f('0x1c')]);_0x3ba033[_0x116f('0x1a')]=qs['offset'](_0x480056[_0x116f('0x2b')]['offset']);}_0x3ba033[_0x116f('0x33')]=qs[_0x116f('0x34')](_0x480056[_0x116f('0x2b')][_0x116f('0x34')]);_0x3ba033[_0x116f('0x35')]=qs[_0x116f('0x36')](_[_0x116f('0x37')](_0x480056[_0x116f('0x2b')],_0x58992d[_0x116f('0x36')]),_0x3b1bc7);if(_0x480056[_0x116f('0x2b')][_0x116f('0x38')]){_0x3ba033[_0x116f('0x35')]=_[_0x116f('0x39')](_0x3ba033[_0x116f('0x35')],{'$or':_[_0x116f('0x26')](_0x3b1bc7,function(_0x12e1c2){if(_0x12e1c2['type']!==_0x116f('0x3a')){var _0x231717={};_0x231717[_0x12e1c2[_0x116f('0x24')]]={'$like':'%'+_0x480056['query'][_0x116f('0x38')]+'%'};return _0x231717;}})});}_0x3ba033=_['merge']({},_0x3ba033,_0x480056[_0x116f('0x3b')]);var _0x9fca77={'where':_0x3ba033['where']};return db[_0x116f('0x27')]['count'](_0x9fca77)[_0x116f('0x20')](function(_0x4fba97){_0x3d97a6[_0x116f('0x3c')]=_0x4fba97;if(_0x480056[_0x116f('0x2b')][_0x116f('0x3d')]){_0x3ba033['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x116f('0x3e')](_0x3ba033);})[_0x116f('0x20')](function(_0xeded0a){_0x3d97a6[_0x116f('0x3f')]=_0xeded0a;return _0x3d97a6;})[_0x116f('0x20')](respondWithFilteredResult(_0x52d983,_0x3ba033))[_0x116f('0x40')](handleError(_0x52d983,null));};exports[_0x116f('0x41')]=function(_0x49f875,_0xe7ff52){var _0x24e2c3={'raw':!![],'where':{'id':_0x49f875[_0x116f('0x42')]['id']}},_0x3ad6a8={};_0x3ad6a8['model']=_[_0x116f('0x2c')](db[_0x116f('0x27')][_0x116f('0x43')]);_0x3ad6a8[_0x116f('0x2b')]=_[_0x116f('0x2c')](_0x49f875[_0x116f('0x2b')]);_0x3ad6a8['filters']=_[_0x116f('0x2e')](_0x3ad6a8[_0x116f('0x2a')],_0x3ad6a8['query']);_0x24e2c3[_0x116f('0x2d')]=_['intersection'](_0x3ad6a8['model'],qs[_0x116f('0x2f')](_0x49f875[_0x116f('0x2b')][_0x116f('0x2f')]));_0x24e2c3[_0x116f('0x2d')]=_0x24e2c3[_0x116f('0x2d')][_0x116f('0x30')]?_0x24e2c3['attributes']:_0x3ad6a8[_0x116f('0x2a')];if(_0x49f875[_0x116f('0x2b')]['includeAll']){_0x24e2c3[_0x116f('0x44')]=[{'all':!![]}];}_0x24e2c3=_[_0x116f('0x39')]({},_0x24e2c3,_0x49f875[_0x116f('0x3b')]);return db[_0x116f('0x27')][_0x116f('0x45')](_0x24e2c3)[_0x116f('0x20')](handleEntityNotFound(_0xe7ff52,null))['then'](respondWithResult(_0xe7ff52,null))[_0x116f('0x40')](handleError(_0xe7ff52,null));};exports[_0x116f('0x46')]=function(_0x4aa888,_0x2f2227){return db[_0x116f('0x27')][_0x116f('0x46')](_0x4aa888[_0x116f('0x47')],{})['then'](respondWithResult(_0x2f2227,0xc9))[_0x116f('0x40')](handleError(_0x2f2227,null));};exports[_0x116f('0x48')]=function(_0x17b961,_0x2b26a9){if(_0x17b961['body']['id']){delete _0x17b961[_0x116f('0x47')]['id'];}return db[_0x116f('0x27')]['find']({'where':{'id':_0x17b961[_0x116f('0x42')]['id']}})[_0x116f('0x20')](handleEntityNotFound(_0x2b26a9,null))[_0x116f('0x20')](saveUpdates(_0x17b961[_0x116f('0x47')],null))[_0x116f('0x20')](respondWithResult(_0x2b26a9,null))['catch'](handleError(_0x2b26a9,null));};exports[_0x116f('0x1f')]=function(_0x33d95f,_0x954d7c){return db[_0x116f('0x27')]['find']({'where':{'id':_0x33d95f[_0x116f('0x42')]['id']}})[_0x116f('0x20')](handleEntityNotFound(_0x954d7c,null))[_0x116f('0x20')](removeEntity(_0x954d7c,null))['catch'](handleError(_0x954d7c,null));};exports[_0x116f('0x49')]=function(_0x500347,_0x1bed9a){return db[_0x116f('0x27')][_0x116f('0x49')]()[_0x116f('0x20')](respondWithResult(_0x1bed9a,null))['catch'](handleError(_0x1bed9a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6240da4..993a912 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 _0x76ce=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','util','../../config/logger','api'];(function(_0x265556,_0x32adf9){var _0x2eb886=function(_0x2b3b4b){while(--_0x2b3b4b){_0x265556['push'](_0x265556['shift']());}};_0x2eb886(++_0x32adf9);}(_0x76ce,0xbb));var _0xe76c=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x76ce[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0xe76c('0x0'));var logger=require(_0xe76c('0x1'))(_0xe76c('0x2'));var moment=require(_0xe76c('0x3'));var BPromise=require(_0xe76c('0x4'));var rp=require(_0xe76c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe76c('0x6'));var config=require(_0xe76c('0x7'));var attributes=require(_0xe76c('0x8'));module['exports']=function(_0x53798a,_0x243359){return _0x53798a['define'](_0xe76c('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf36a=['rimraf','../../config/environment','exports','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5afec5,_0x1198b5){var _0x23f5e3=function(_0x41f8f6){while(--_0x41f8f6){_0x5afec5['push'](_0x5afec5['shift']());}};_0x23f5e3(++_0x1198b5);}(_0xf36a,0x1d7));var _0xaf36=function(_0x294799,_0x57f889){_0x294799=_0x294799-0x0;var _0x2e6f56=_0xf36a[_0x294799];return _0x2e6f56;};'use strict';var _=require(_0xaf36('0x0'));var util=require(_0xaf36('0x1'));var logger=require(_0xaf36('0x2'))('api');var moment=require(_0xaf36('0x3'));var BPromise=require(_0xaf36('0x4'));var rp=require(_0xaf36('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf36('0x6'));var config=require(_0xaf36('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0xaf36('0x8')]=function(_0x1fbb24,_0x15e965){return _0x1fbb24['define']('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index d7aa441..9c5a377 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 _0xc365=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','VoiceTransferReport','create','body','raw','CreateVoiceTransferReport','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3e980e,_0x4c0637){var _0x54a7e2=function(_0x19c843){while(--_0x19c843){_0x3e980e['push'](_0x3e980e['shift']());}};_0x54a7e2(++_0x4c0637);}(_0xc365,0xaf));var _0x5c36=function(_0x5e9ab6,_0x10a0b2){_0x5e9ab6=_0x5e9ab6-0x0;var _0x4b562c=_0xc365[_0x5e9ab6];return _0x4b562c;};'use strict';var _=require(_0x5c36('0x0'));var util=require(_0x5c36('0x1'));var moment=require(_0x5c36('0x2'));var BPromise=require(_0x5c36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c36('0x4'));var db=require(_0x5c36('0x5'))['db'];var utils=require(_0x5c36('0x6'));var logger=require(_0x5c36('0x7'))(_0x5c36('0x8'));var config=require(_0x5c36('0x9'));var jayson=require(_0x5c36('0xa'));var client=jayson[_0x5c36('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f7048,_0x44a67e,_0x2f7067){return new BPromise(function(_0x30ca28,_0x1cd6e0){return client[_0x5c36('0xc')](_0x4f7048,_0x2f7067)[_0x5c36('0xd')](function(_0x54c7b2){logger[_0x5c36('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x44a67e,_0x5c36('0xf'));logger[_0x5c36('0x10')](_0x5c36('0x11'),_0x44a67e,_0x5c36('0xf'),JSON[_0x5c36('0x12')](_0x54c7b2));if(_0x54c7b2[_0x5c36('0x13')]){if(_0x54c7b2['error'][_0x5c36('0x14')]===0x1f4){logger[_0x5c36('0x13')](_0x5c36('0x15'),_0x44a67e,_0x54c7b2[_0x5c36('0x13')][_0x5c36('0x16')]);return _0x1cd6e0(_0x54c7b2['error'][_0x5c36('0x16')]);}logger[_0x5c36('0x13')](_0x5c36('0x15'),_0x44a67e,_0x54c7b2[_0x5c36('0x13')][_0x5c36('0x16')]);return _0x30ca28(_0x54c7b2[_0x5c36('0x13')]['message']);}else{logger[_0x5c36('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x44a67e,_0x5c36('0xf'));_0x30ca28(_0x54c7b2[_0x5c36('0x17')][_0x5c36('0x16')]);}})['catch'](function(_0x1ca4d0){logger[_0x5c36('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x44a67e,_0x1ca4d0);_0x1cd6e0(_0x1ca4d0);});});}exports['CreateVoiceTransferReport']=function(_0x334172){var _0x1ea135=this;return new Promise(function(_0x1566db,_0xc3bfdd){return db[_0x5c36('0x18')][_0x5c36('0x19')](_0x334172[_0x5c36('0x1a')],{'raw':_0x334172['options']?_0x334172['options'][_0x5c36('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1d7d55){logger[_0x5c36('0xe')](_0x5c36('0x1c'),_0x334172);logger[_0x5c36('0x10')](_0x5c36('0x1c'),_0x334172,JSON[_0x5c36('0x12')](_0x1d7d55));_0x1566db(_0x1d7d55);})[_0x5c36('0x1d')](function(_0x4b2a24){logger[_0x5c36('0x13')]('CreateVoiceTransferReport',_0x4b2a24[_0x5c36('0x16')],_0x334172);_0xc3bfdd(_0x1ea135['error'](0x1f4,_0x4b2a24[_0x5c36('0x16')]));});});}; \ No newline at end of file +var _0x0655=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','util','moment','bluebird','randomstring','ioredis'];(function(_0x30a75f,_0x1ebfe7){var _0x64a76f=function(_0x370e30){while(--_0x370e30){_0x30a75f['push'](_0x30a75f['shift']());}};_0x64a76f(++_0x1ebfe7);}(_0x0655,0x183));var _0x5065=function(_0x30121e,_0x240c86){_0x30121e=_0x30121e-0x0;var _0x4ba328=_0x0655[_0x30121e];return _0x4ba328;};'use strict';var _=require('lodash');var util=require(_0x5065('0x0'));var moment=require(_0x5065('0x1'));var BPromise=require(_0x5065('0x2'));var rs=require(_0x5065('0x3'));var fs=require('fs');var Redis=require(_0x5065('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5065('0x5'));var logger=require(_0x5065('0x6'))('rpc');var config=require(_0x5065('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5065('0x8')][_0x5065('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46f521,_0x5384af,_0x2ab2d2){return new BPromise(function(_0x3de4a3,_0x5221ed){return client[_0x5065('0xa')](_0x46f521,_0x2ab2d2)[_0x5065('0xb')](function(_0xdd99eb){logger[_0x5065('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5384af,'request\x20sent');logger[_0x5065('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5384af,'request\x20sent',JSON[_0x5065('0xe')](_0xdd99eb));if(_0xdd99eb['error']){if(_0xdd99eb[_0x5065('0xf')][_0x5065('0x10')]===0x1f4){logger[_0x5065('0xf')](_0x5065('0x11'),_0x5384af,_0xdd99eb['error'][_0x5065('0x12')]);return _0x5221ed(_0xdd99eb['error'][_0x5065('0x12')]);}logger[_0x5065('0xf')](_0x5065('0x11'),_0x5384af,_0xdd99eb['error'][_0x5065('0x12')]);return _0x3de4a3(_0xdd99eb['error'][_0x5065('0x12')]);}else{logger[_0x5065('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5384af,_0x5065('0x13'));_0x3de4a3(_0xdd99eb[_0x5065('0x14')][_0x5065('0x12')]);}})[_0x5065('0x15')](function(_0x33c127){logger[_0x5065('0xf')](_0x5065('0x11'),_0x5384af,_0x33c127);_0x5221ed(_0x33c127);});});}exports['CreateVoiceTransferReport']=function(_0x4821d8){var _0x992412=this;return new Promise(function(_0x3da42e,_0x2658c6){return db[_0x5065('0x16')][_0x5065('0x17')](_0x4821d8[_0x5065('0x18')],{'raw':_0x4821d8[_0x5065('0x19')]?_0x4821d8[_0x5065('0x19')][_0x5065('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2643ee){logger[_0x5065('0xc')]('CreateVoiceTransferReport',_0x4821d8);logger[_0x5065('0xd')]('CreateVoiceTransferReport',_0x4821d8,JSON[_0x5065('0xe')](_0x2643ee));_0x3da42e(_0x2643ee);})[_0x5065('0x15')](function(_0x1d1df0){logger[_0x5065('0xf')](_0x5065('0x1b'),_0x1d1df0[_0x5065('0x12')],_0x4821d8);_0x2658c6(_0x992412[_0x5065('0xf')](0x1f4,_0x1d1df0[_0x5065('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9b80d6a..16f67c9 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 _0xb75b=['originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','transfer','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate'];(function(_0x3bcf75,_0xc685a4){var _0xf4e0bf=function(_0x1fc1b3){while(--_0x1fc1b3){_0x3bcf75['push'](_0x3bcf75['shift']());}};_0xf4e0bf(++_0xc685a4);}(_0xb75b,0x1c0));var _0xbb75=function(_0x22ac72,_0x30310a){_0x22ac72=_0x22ac72-0x0;var _0x4dcdc0=_0xb75b[_0x22ac72];return _0x4dcdc0;};'use strict';var express=require(_0xbb75('0x0'));var router=express[_0xbb75('0x1')]();var auth=require(_0xbb75('0x2'));var controller=require(_0xbb75('0x3'));router[_0xbb75('0x4')](_0xbb75('0x5'),auth[_0xbb75('0x6')](),auth[_0xbb75('0x7')](),controller[_0xbb75('0x8')]);router[_0xbb75('0x4')](_0xbb75('0x9'),auth[_0xbb75('0x6')](),auth['canUpdate'](),controller[_0xbb75('0xa')]);router[_0xbb75('0x4')](_0xbb75('0xb'),auth['isAuthenticated'](),auth[_0xbb75('0x7')](),controller[_0xbb75('0xc')]);router['post'](_0xbb75('0xd'),auth[_0xbb75('0x6')](),auth[_0xbb75('0x7')](),controller[_0xbb75('0xe')]);router['post'](_0xbb75('0xf'),auth[_0xbb75('0x6')](),auth['canUpdate'](),controller[_0xbb75('0x10')]);router[_0xbb75('0x4')](_0xbb75('0x11'),auth['isAuthenticated'](),auth[_0xbb75('0x7')](),controller['calls']);router[_0xbb75('0x4')]('/transfer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xbb75('0x12')]);module['exports']=router; \ No newline at end of file +var _0x742f=['express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','calls','/transfer'];(function(_0x5506e3,_0x86f20d){var _0x571955=function(_0x5099b2){while(--_0x5099b2){_0x5506e3['push'](_0x5506e3['shift']());}};_0x571955(++_0x86f20d);}(_0x742f,0xe0));var _0xf742=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x742f[_0xc4001c];return _0x49f7bc;};'use strict';var express=require(_0xf742('0x0'));var router=express[_0xf742('0x1')]();var auth=require(_0xf742('0x2'));var controller=require(_0xf742('0x3'));router[_0xf742('0x4')](_0xf742('0x5'),auth[_0xf742('0x6')](),auth[_0xf742('0x7')](),controller['originate']);router[_0xf742('0x4')]('/hangup',auth[_0xf742('0x6')](),auth[_0xf742('0x7')](),controller[_0xf742('0x8')]);router[_0xf742('0x4')](_0xf742('0x9'),auth[_0xf742('0x6')](),auth['canUpdate'](),controller[_0xf742('0xa')]);router[_0xf742('0x4')](_0xf742('0xb'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xf742('0xc')]);router[_0xf742('0x4')](_0xf742('0xd'),auth['isAuthenticated'](),auth[_0xf742('0x7')](),controller['unhold']);router[_0xf742('0x4')]('/calls',auth[_0xf742('0x6')](),auth[_0xf742('0x7')](),controller[_0xf742('0xe')]);router['post'](_0xf742('0xf'),auth[_0xf742('0x6')](),auth[_0xf742('0x7')](),controller['transfer']);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 9aae46a..6e5f60f 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 _0x7980=['webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','error','name','send','status','NotFound','request','then','code','message','result','User','agent','VoiceChannels','all','filter','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','validate','callNumber','callerId','user:%s','webbar:originate','json','originate\x20executed!','catch','hangup','hangup\x20fired:','userId','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','format','answer\x20executed!','hold\x20fired:'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x7980,0xab));var _0x0798=function(_0x452f43,_0x405adc){_0x452f43=_0x452f43-0x0;var _0x4ecad6=_0x7980[_0x452f43];return _0x4ecad6;};'use strict';var path=require(_0x0798('0x0'));var fs=require('fs');var _=require(_0x0798('0x1'));var db=require(_0x0798('0x2'))['db'];var config=require(_0x0798('0x3'));var util=require(_0x0798('0x4'));var BPromise=require('bluebird');var jayson=require(_0x0798('0x5'));var amiClient=jayson[_0x0798('0x6')][_0x0798('0x7')]({'port':0x232a});var logger=require(_0x0798('0x8'))(_0x0798('0x9'));var Redis=require('ioredis');config[_0x0798('0xa')]=_['defaults'](config[_0x0798('0xa')],{'host':_0x0798('0xb'),'port':0x18eb});var io=require(_0x0798('0xc'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]},'callNumber':{'type':_0x0798('0xf'),'required':[!![],_0x0798('0x10')]},'callerId':{'type':_0x0798('0xf')},'callbackUrl':{'type':_0x0798('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]},'sessionId':{'type':_0x0798('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0798('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0x0798('0x11')]},'transferNumber':{'type':_0x0798('0xf'),'required':[!![],_0x0798('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]},'sessionId':{'type':_0x0798('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x21c30b,_0x45cae6,_0x258081){logger['info'](_0x21c30b,_0x45cae6,JSON['stringify'](_0x258081));io['to'](_0x21c30b)[_0x0798('0x13')](_0x45cae6,_0x258081);}function handleError(_0x502635){return function(_0x41e217){console[_0x0798('0x14')](_0x0798('0x15'),_0x41e217,_0x41e217 instanceof RangeError);logger[_0x0798('0x16')](_0x41e217['stack']);if(_0x41e217 instanceof RangeError){if(_0x41e217[_0x0798('0x17')]){delete _0x41e217[_0x0798('0x17')];}_0x502635['status'](0x194)[_0x0798('0x18')](_0x41e217);}else{if(_0x41e217[_0x0798('0x17')]){delete _0x41e217[_0x0798('0x17')];}_0x502635[_0x0798('0x19')](0x1f4)[_0x0798('0x18')](_0x41e217);}};}function checkError(){return function(_0x273ba8){if(!_0x273ba8){throw new RangeError(_0x0798('0x1a'));}return _0x273ba8;};}function respondWithRpcPromise(_0x212ad5,_0x23b37d){return new BPromise(function(_0x4a86d5,_0x2aaabf){var _0x35c141=amiClient;return _0x35c141[_0x0798('0x1b')](_0x212ad5,_0x23b37d)[_0x0798('0x1c')](function(_0x20654b){if(_0x20654b[_0x0798('0x16')]){if(_0x20654b['error'][_0x0798('0x1d')]===0x1f4){return _0x2aaabf(_0x20654b[_0x0798('0x16')][_0x0798('0x1e')]);}return _0x4a86d5(_0x20654b[_0x0798('0x16')][_0x0798('0x1e')]);}else{_0x4a86d5(_0x20654b[_0x0798('0x1f')]);}})['catch'](function(_0x43d99f){_0x2aaabf(_0x43d99f);});});}function getAgent(_0x14f828){return db[_0x0798('0x20')]['findOne']({'where':{'id':_0x14f828,'role':_0x0798('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x53a3d7,_0x406030){return new BPromise(function(_0x2dfbff,_0x134d24){var _0xaa949b=respondWithRpcPromise(_0x0798('0x22'));var _0x161244=getAgent(_0x53a3d7);Promise[_0x0798('0x23')]([_0xaa949b,_0x161244])[_0x0798('0x1c')](function(_0x5bbe3d){var _0x167960=_0x5bbe3d[0x0];var _0x4f5d1d=_0x5bbe3d[0x1];var _0x5f1780=_[_0x0798('0x24')](_0x167960['rows'],function(_0x1dabd5){return _0x1dabd5['UserId']==_0x4f5d1d['id']&&_0x1dabd5[_0x0798('0x25')]==_0x406030;});if(_0x5f1780[_0x0798('0x26')]==0x1){_0x2dfbff(_0x4f5d1d);}else{_0x134d24(new RangeError(_0x0798('0x27')+_0x406030+_0x0798('0x28')));}});});}exports[_0x0798('0x29')]=function(_0x1ebd07,_0xa1376e){logger[_0x0798('0x2a')](_0x0798('0x2b'),_0x1ebd07[_0x0798('0x2c')]);var _0x54a955=originateValidation[_0x0798('0x2d')](_0x1ebd07['body']);if(_0x54a955[_0x0798('0x26')]>0x0){return _0xa1376e['status'](0x190)['json'](_0x54a955);}var _0x104d23=_0x1ebd07[_0x0798('0x2c')]['userId'];var _0x49d5b8=_0x1ebd07[_0x0798('0x2c')][_0x0798('0x2e')];var _0x322adf=_0x1ebd07[_0x0798('0x2c')][_0x0798('0x2f')];var _0x2ad922=_0x1ebd07['body']['callbackUrl'];return getAgent(_0x104d23)[_0x0798('0x1c')](function(_0x23a70b){logger[_0x0798('0x2a')]('entityFound:',_0x23a70b['name']);emit(util['format'](_0x0798('0x30'),_0x23a70b[_0x0798('0x17')]),_0x0798('0x31'),{'callNumber':_0x49d5b8,'callerId':_0x322adf,'callbackUrl':_0x2ad922});return _0xa1376e[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x33')});})[_0x0798('0x34')](handleError(_0xa1376e));};exports[_0x0798('0x35')]=function(_0x502556,_0x16dae6){logger['info'](_0x0798('0x36'),_0x502556[_0x0798('0x2c')]);var _0x2caa82=hangupValidation['validate'](_0x502556[_0x0798('0x2c')]);if(_0x2caa82['length']>0x0){return _0x16dae6[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x2caa82);}var _0x223751=_0x502556['body'][_0x0798('0x37')];var _0xb5937b=_0x502556['body'][_0x0798('0x25')];return getAgent(_0x223751)['then'](function(_0x4e9d94){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x4e9d94['name']);emit(util['format'](_0x0798('0x30'),_0x4e9d94[_0x0798('0x17')]),_0x0798('0x39'),{'sessionId':_0xb5937b});return _0x16dae6[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x3a')});})[_0x0798('0x34')](handleError(_0x16dae6));};exports['answer']=function(_0x3aa79c,_0x11c5bf){logger[_0x0798('0x2a')](_0x0798('0x3b'),_0x3aa79c[_0x0798('0x2c')]);var _0x26e9cb=answerValidation['validate'](_0x3aa79c[_0x0798('0x2c')]);if(_0x26e9cb[_0x0798('0x26')]>0x0){return _0x11c5bf[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x26e9cb);}var _0x387450=_0x3aa79c[_0x0798('0x2c')][_0x0798('0x37')];var _0x10a50a=_0x3aa79c[_0x0798('0x2c')][_0x0798('0x25')];return getAgent(_0x387450)[_0x0798('0x1c')](function(_0x31a3cb){logger['info'](_0x0798('0x38'),_0x31a3cb[_0x0798('0x17')]);emit(util[_0x0798('0x3c')](_0x0798('0x30'),_0x31a3cb['name']),'webbar:answer',{'sessionId':_0x10a50a});return _0x11c5bf[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x3d')});})[_0x0798('0x34')](handleError(_0x11c5bf));};exports['hold']=function(_0x21c28c,_0x4858e6){logger['info'](_0x0798('0x3e'),_0x21c28c[_0x0798('0x2c')]);var _0x42c5b8=holdValidation[_0x0798('0x2d')](_0x21c28c[_0x0798('0x2c')]);if(_0x42c5b8[_0x0798('0x26')]>0x0){return _0x4858e6[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x42c5b8);}var _0x182e3b=_0x21c28c['body'][_0x0798('0x37')];var _0x56d438=_0x21c28c[_0x0798('0x2c')][_0x0798('0x25')];return getAgent(_0x182e3b)[_0x0798('0x1c')](function(_0x54634d){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x54634d[_0x0798('0x17')]);emit(util[_0x0798('0x3c')]('user:%s',_0x54634d[_0x0798('0x17')]),_0x0798('0x3f'),{'sessionId':_0x56d438});return _0x4858e6[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x40')});})['catch'](handleError(_0x4858e6));};exports[_0x0798('0x41')]=function(_0x3e1c15,_0x2679b1){logger[_0x0798('0x2a')](_0x0798('0x42'),_0x3e1c15[_0x0798('0x2c')]);var _0x181757=unholdValidation[_0x0798('0x2d')](_0x3e1c15[_0x0798('0x2c')]);if(_0x181757['length']>0x0){return _0x2679b1['status'](0x190)[_0x0798('0x32')](_0x181757);}var _0x499073=_0x3e1c15[_0x0798('0x2c')][_0x0798('0x37')];var _0x40b3d6=_0x3e1c15[_0x0798('0x2c')][_0x0798('0x25')];return getAgent(_0x499073)['then'](function(_0x3cb0b4){logger['info'](_0x0798('0x38'),_0x3cb0b4[_0x0798('0x17')]);emit(util[_0x0798('0x3c')]('user:%s',_0x3cb0b4['name']),'webbar:unhold',{'sessionId':_0x40b3d6});return _0x2679b1[_0x0798('0x19')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x0798('0x34')](handleError(_0x2679b1));};exports[_0x0798('0x43')]=function(_0x455d19,_0x499580){logger[_0x0798('0x2a')](_0x0798('0x44'),_0x499580[_0x0798('0x2c')]);var _0x743d26=callsValidation['validate'](_0x455d19['body']);if(_0x743d26[_0x0798('0x26')]>0x0){return _0x499580[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x743d26);}var _0x59ad6c=_0x455d19['body'][_0x0798('0x37')];var _0x82599=respondWithRpcPromise(_0x0798('0x22'));var _0x190467=getAgent(_0x59ad6c);return Promise[_0x0798('0x23')]([_0x82599,_0x190467])[_0x0798('0x1c')](function(_0x18c0fa){var _0x1a55c0=_0x18c0fa[0x0];var _0x4f35c7=_0x18c0fa[0x1];var _0x349f86=_[_0x0798('0x24')](_0x1a55c0['rows'],function(_0x3ab2cc){return _0x3ab2cc[_0x0798('0x45')]==_0x4f35c7['id'];});return _0x499580['status'](0xc8)[_0x0798('0x32')]({'count':_0x349f86[_0x0798('0x26')],'rows':_0x349f86});})[_0x0798('0x34')](handleError(_0x499580));};exports[_0x0798('0x46')]=function(_0x458a4e,_0x541669){logger[_0x0798('0x2a')](_0x0798('0x47'),_0x458a4e[_0x0798('0x2c')]);var _0x47cfc0=conferenceValidation[_0x0798('0x2d')](_0x458a4e['body']);if(_0x47cfc0[_0x0798('0x26')]>0x0){return _0x541669[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x47cfc0);}var _0x26b393=_0x458a4e[_0x0798('0x2c')][_0x0798('0x37')];return getAgent(_0x26b393)['then'](function(_0x3cc8bd){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x3cc8bd[_0x0798('0x17')]);emit(util['format'](_0x0798('0x30'),_0x3cc8bd[_0x0798('0x17')]),_0x0798('0x48'));return _0x541669[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':'conference\x20executed!'});})[_0x0798('0x34')](handleError(_0x541669));};exports[_0x0798('0x49')]=function(_0x5668b7,_0x48d1d1){logger[_0x0798('0x2a')](_0x0798('0x4a'),_0x5668b7['body']);var _0x2f336a=transferValidation[_0x0798('0x2d')](_0x5668b7[_0x0798('0x2c')]);if(_0x2f336a[_0x0798('0x26')]>0x0){return _0x48d1d1[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x2f336a);}var _0x21c156=_0x5668b7[_0x0798('0x2c')]['userId'];var _0x316762=_0x5668b7[_0x0798('0x2c')][_0x0798('0x25')];var _0xf5100e=_0x5668b7['body'][_0x0798('0x4b')];return getAgent(_0x21c156)[_0x0798('0x1c')](function(_0x11946d){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x11946d[_0x0798('0x17')]);emit(util[_0x0798('0x3c')](_0x0798('0x30'),_0x11946d['name']),_0x0798('0x4c'),{'sessionId':_0x316762,'transferNumber':_0xf5100e});return _0x48d1d1['status'](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x4d')});})[_0x0798('0x34')](handleError(_0x48d1d1));}; \ No newline at end of file +var _0x34e5=['string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','catch','User','findOne','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','json','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','calls','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','number','callNumber\x20is\x20required'];(function(_0x5861d9,_0xb9a131){var _0x13cae0=function(_0x3d79a6){while(--_0x3d79a6){_0x5861d9['push'](_0x5861d9['shift']());}};_0x13cae0(++_0xb9a131);}(_0x34e5,0x172));var _0x534e=function(_0x1f994c,_0x26cec8){_0x1f994c=_0x1f994c-0x0;var _0x201382=_0x34e5[_0x1f994c];return _0x201382;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x534e('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x534e('0x1'));var util=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var jayson=require(_0x534e('0x4'));var amiClient=jayson[_0x534e('0x5')]['http']({'port':0x232a});var logger=require(_0x534e('0x6'))(_0x534e('0x7'));var Redis=require(_0x534e('0x8'));config[_0x534e('0x9')]=_[_0x534e('0xa')](config[_0x534e('0x9')],{'host':_0x534e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x534e('0x9')]));var Schema=require(_0x534e('0xc'));var originateValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x534e('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x534e('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x534e('0x10')]},'sessionId':{'type':_0x534e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x534e('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],_0x534e('0x10')]},'sessionId':{'type':_0x534e('0xf'),'required':[!![],_0x534e('0x11')]},'transferNumber':{'type':'string','required':[!![],_0x534e('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],_0x534e('0x10')]},'sessionId':{'type':_0x534e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],_0x534e('0x10')]},'sessionId':{'type':_0x534e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x534e('0xd'),'required':[!![],_0x534e('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x534e('0x10')]}});function emit(_0x3940c3,_0x5bdae2,_0x4eca13){logger[_0x534e('0x13')](_0x3940c3,_0x5bdae2,JSON[_0x534e('0x14')](_0x4eca13));io['to'](_0x3940c3)[_0x534e('0x15')](_0x5bdae2,_0x4eca13);}function handleError(_0x16ad40){return function(_0x22bc92){console[_0x534e('0x16')](_0x534e('0x17'),_0x22bc92,_0x22bc92 instanceof RangeError);logger['error'](_0x22bc92[_0x534e('0x18')]);if(_0x22bc92 instanceof RangeError){if(_0x22bc92[_0x534e('0x19')]){delete _0x22bc92[_0x534e('0x19')];}_0x16ad40[_0x534e('0x1a')](0x194)[_0x534e('0x1b')](_0x22bc92);}else{if(_0x22bc92['name']){delete _0x22bc92[_0x534e('0x19')];}_0x16ad40[_0x534e('0x1a')](0x1f4)[_0x534e('0x1b')](_0x22bc92);}};}function checkError(){return function(_0x325005){if(!_0x325005){throw new RangeError(_0x534e('0x1c'));}return _0x325005;};}function respondWithRpcPromise(_0xb558fd,_0x1182c3){return new BPromise(function(_0x85188b,_0x21f2e1){var _0x5e086a=amiClient;return _0x5e086a[_0x534e('0x1d')](_0xb558fd,_0x1182c3)[_0x534e('0x1e')](function(_0x39466c){if(_0x39466c[_0x534e('0x1f')]){if(_0x39466c[_0x534e('0x1f')][_0x534e('0x20')]===0x1f4){return _0x21f2e1(_0x39466c[_0x534e('0x1f')][_0x534e('0x21')]);}return _0x85188b(_0x39466c['error'][_0x534e('0x21')]);}else{_0x85188b(_0x39466c['result']);}})[_0x534e('0x22')](function(_0x106b7a){_0x21f2e1(_0x106b7a);});});}function getAgent(_0x3ea5bd){return db[_0x534e('0x23')][_0x534e('0x24')]({'where':{'id':_0x3ea5bd,'role':'agent'}})[_0x534e('0x1e')](checkError());}function getAgentCheckSession(_0x443f85,_0x4f3d30){return new BPromise(function(_0x4bd073,_0x3abacf){var _0x534783=respondWithRpcPromise(_0x534e('0x25'));var _0x3c5c11=getAgent(_0x443f85);Promise[_0x534e('0x26')]([_0x534783,_0x3c5c11])[_0x534e('0x1e')](function(_0x15be5c){var _0x42119b=_0x15be5c[0x0];var _0x5253b5=_0x15be5c[0x1];var _0x53dd97=_['filter'](_0x42119b[_0x534e('0x27')],function(_0x15bdc1){return _0x15bdc1[_0x534e('0x28')]==_0x5253b5['id']&&_0x15bdc1[_0x534e('0x29')]==_0x4f3d30;});if(_0x53dd97[_0x534e('0x2a')]==0x1){_0x4bd073(_0x5253b5);}else{_0x3abacf(new RangeError(_0x534e('0x2b')+_0x4f3d30+_0x534e('0x2c')));}});});}exports[_0x534e('0x2d')]=function(_0x533d62,_0x312744){logger[_0x534e('0x13')](_0x534e('0x2e'),_0x533d62['body']);var _0x170ff6=originateValidation[_0x534e('0xc')](_0x533d62['body']);if(_0x170ff6[_0x534e('0x2a')]>0x0){return _0x312744['status'](0x190)[_0x534e('0x2f')](_0x170ff6);}var _0x41eebe=_0x533d62[_0x534e('0x30')][_0x534e('0x31')];var _0x508b94=_0x533d62[_0x534e('0x30')][_0x534e('0x32')];var _0x4a850f=_0x533d62['body'][_0x534e('0x33')];var _0x17baab=_0x533d62[_0x534e('0x30')][_0x534e('0x34')];return getAgent(_0x41eebe)['then'](function(_0x348573){logger['info'](_0x534e('0x35'),_0x348573['name']);emit(util[_0x534e('0x36')](_0x534e('0x37'),_0x348573['name']),_0x534e('0x38'),{'callNumber':_0x508b94,'callerId':_0x4a850f,'callbackUrl':_0x17baab});return _0x312744['status'](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x312744));};exports[_0x534e('0x39')]=function(_0x4de87f,_0x49f188){logger[_0x534e('0x13')](_0x534e('0x3a'),_0x4de87f[_0x534e('0x30')]);var _0x5718fa=hangupValidation[_0x534e('0xc')](_0x4de87f[_0x534e('0x30')]);if(_0x5718fa['length']>0x0){return _0x49f188[_0x534e('0x1a')](0x190)['json'](_0x5718fa);}var _0x6cc5e8=_0x4de87f[_0x534e('0x30')]['userId'];var _0x7df9da=_0x4de87f['body'][_0x534e('0x29')];return getAgent(_0x6cc5e8)[_0x534e('0x1e')](function(_0x1f483c){logger[_0x534e('0x13')]('entityFound:',_0x1f483c['name']);emit(util[_0x534e('0x36')]('user:%s',_0x1f483c[_0x534e('0x19')]),_0x534e('0x3b'),{'sessionId':_0x7df9da});return _0x49f188[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'error':![],'message':'hangup\x20executed!'});})[_0x534e('0x22')](handleError(_0x49f188));};exports[_0x534e('0x3c')]=function(_0x376114,_0x52d53f){logger[_0x534e('0x13')]('answer\x20fired:',_0x376114[_0x534e('0x30')]);var _0x24c9c2=answerValidation[_0x534e('0xc')](_0x376114['body']);if(_0x24c9c2[_0x534e('0x2a')]>0x0){return _0x52d53f[_0x534e('0x1a')](0x190)[_0x534e('0x2f')](_0x24c9c2);}var _0x436b0f=_0x376114[_0x534e('0x30')][_0x534e('0x31')];var _0x197ce2=_0x376114['body'][_0x534e('0x29')];return getAgent(_0x436b0f)['then'](function(_0x5adac3){logger[_0x534e('0x13')](_0x534e('0x35'),_0x5adac3[_0x534e('0x19')]);emit(util[_0x534e('0x36')](_0x534e('0x37'),_0x5adac3[_0x534e('0x19')]),'webbar:answer',{'sessionId':_0x197ce2});return _0x52d53f[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'error':![],'message':_0x534e('0x3d')});})['catch'](handleError(_0x52d53f));};exports[_0x534e('0x3e')]=function(_0x4c655b,_0x2057d0){logger[_0x534e('0x13')](_0x534e('0x3f'),_0x4c655b[_0x534e('0x30')]);var _0x2c0ca5=holdValidation[_0x534e('0xc')](_0x4c655b['body']);if(_0x2c0ca5[_0x534e('0x2a')]>0x0){return _0x2057d0['status'](0x190)['json'](_0x2c0ca5);}var _0x298e11=_0x4c655b[_0x534e('0x30')][_0x534e('0x31')];var _0x1a0118=_0x4c655b[_0x534e('0x30')][_0x534e('0x29')];return getAgent(_0x298e11)[_0x534e('0x1e')](function(_0x376c83){logger[_0x534e('0x13')]('entityFound:',_0x376c83[_0x534e('0x19')]);emit(util[_0x534e('0x36')](_0x534e('0x37'),_0x376c83[_0x534e('0x19')]),'webbar:hold',{'sessionId':_0x1a0118});return _0x2057d0[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'error':![],'message':_0x534e('0x40')});})[_0x534e('0x22')](handleError(_0x2057d0));};exports[_0x534e('0x41')]=function(_0x176147,_0xc625df){logger[_0x534e('0x13')](_0x534e('0x42'),_0x176147[_0x534e('0x30')]);var _0x1d9782=unholdValidation[_0x534e('0xc')](_0x176147['body']);if(_0x1d9782[_0x534e('0x2a')]>0x0){return _0xc625df[_0x534e('0x1a')](0x190)['json'](_0x1d9782);}var _0x328ef6=_0x176147[_0x534e('0x30')][_0x534e('0x31')];var _0x4ef39f=_0x176147['body'][_0x534e('0x29')];return getAgent(_0x328ef6)[_0x534e('0x1e')](function(_0x45224a){logger[_0x534e('0x13')](_0x534e('0x35'),_0x45224a[_0x534e('0x19')]);emit(util[_0x534e('0x36')](_0x534e('0x37'),_0x45224a[_0x534e('0x19')]),'webbar:unhold',{'sessionId':_0x4ef39f});return _0xc625df['status'](0xc8)[_0x534e('0x2f')]({'error':![],'message':'unhold\x20executed!'});})[_0x534e('0x22')](handleError(_0xc625df));};exports[_0x534e('0x43')]=function(_0x13af68,_0x23da96){logger[_0x534e('0x13')]('calls\x20fired:',_0x23da96[_0x534e('0x30')]);var _0x2de255=callsValidation['validate'](_0x13af68['body']);if(_0x2de255[_0x534e('0x2a')]>0x0){return _0x23da96['status'](0x190)['json'](_0x2de255);}var _0x10ea1c=_0x13af68[_0x534e('0x30')][_0x534e('0x31')];var _0x482a1f=respondWithRpcPromise(_0x534e('0x25'));var _0x2dbff9=getAgent(_0x10ea1c);return Promise['all']([_0x482a1f,_0x2dbff9])['then'](function(_0x467f37){var _0x617fde=_0x467f37[0x0];var _0x5c01fd=_0x467f37[0x1];var _0x47d39e=_[_0x534e('0x44')](_0x617fde['rows'],function(_0x5a2649){return _0x5a2649['UserId']==_0x5c01fd['id'];});return _0x23da96[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'count':_0x47d39e[_0x534e('0x2a')],'rows':_0x47d39e});})[_0x534e('0x22')](handleError(_0x23da96));};exports[_0x534e('0x45')]=function(_0x3db45a,_0xe0b1bd){logger[_0x534e('0x13')](_0x534e('0x46'),_0x3db45a[_0x534e('0x30')]);var _0x57a530=conferenceValidation[_0x534e('0xc')](_0x3db45a[_0x534e('0x30')]);if(_0x57a530[_0x534e('0x2a')]>0x0){return _0xe0b1bd[_0x534e('0x1a')](0x190)[_0x534e('0x2f')](_0x57a530);}var _0x5c9004=_0x3db45a[_0x534e('0x30')]['userId'];return getAgent(_0x5c9004)[_0x534e('0x1e')](function(_0x9b6c1e){logger[_0x534e('0x13')](_0x534e('0x35'),_0x9b6c1e['name']);emit(util[_0x534e('0x36')]('user:%s',_0x9b6c1e[_0x534e('0x19')]),_0x534e('0x47'));return _0xe0b1bd[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'error':![],'message':_0x534e('0x48')});})[_0x534e('0x22')](handleError(_0xe0b1bd));};exports[_0x534e('0x49')]=function(_0x35a0c6,_0x5775e7){logger['info'](_0x534e('0x4a'),_0x35a0c6[_0x534e('0x30')]);var _0x21a6f6=transferValidation['validate'](_0x35a0c6[_0x534e('0x30')]);if(_0x21a6f6[_0x534e('0x2a')]>0x0){return _0x5775e7[_0x534e('0x1a')](0x190)[_0x534e('0x2f')](_0x21a6f6);}var _0x29c1d4=_0x35a0c6['body'][_0x534e('0x31')];var _0x17cfe0=_0x35a0c6[_0x534e('0x30')]['sessionId'];var _0x5e38fa=_0x35a0c6[_0x534e('0x30')][_0x534e('0x4b')];return getAgent(_0x29c1d4)['then'](function(_0x411b3c){logger[_0x534e('0x13')](_0x534e('0x35'),_0x411b3c['name']);emit(util['format'](_0x534e('0x37'),_0x411b3c[_0x534e('0x19')]),_0x534e('0x4c'),{'sessionId':_0x17cfe0,'transferNumber':_0x5e38fa});return _0x5775e7[_0x534e('0x1a')](0xc8)[_0x534e('0x2f')]({'error':![],'message':'transfer\x20executed!'});})[_0x534e('0x22')](handleError(_0x5775e7));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index bf07a85..4671550 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 _0xdb28=['removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update','delete','destroy'];(function(_0x3fe54e,_0x357b41){var _0x2bf275=function(_0x57f05a){while(--_0x57f05a){_0x3fe54e['push'](_0x3fe54e['shift']());}};_0x2bf275(++_0x357b41);}(_0xdb28,0x106));var _0x8db2=function(_0x4e08f4,_0x38ee10){_0x4e08f4=_0x4e08f4-0x0;var _0x5a2582=_0xdb28[_0x4e08f4];return _0x5a2582;};'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('./whatsappAccount.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getAnswers']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8db2('0x14')]);router[_0x8db2('0x15')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x15')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x17')]);router[_0x8db2('0x15')](_0x8db2('0x11'),auth['isAuthenticated'](),controller[_0x8db2('0x18')]);router[_0x8db2('0x15')]('/:id/users',auth[_0x8db2('0xa')](),controller[_0x8db2('0x19')]);router[_0x8db2('0x15')](_0x8db2('0x1a'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1b')]);router['post']('/:id/notify',controller[_0x8db2('0x1c')]);router[_0x8db2('0x15')](_0x8db2('0x1d'),auth[_0x8db2('0xa')](),controller['send']);router[_0x8db2('0x1e')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);router[_0x8db2('0x20')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x21')]);router[_0x8db2('0x20')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x22')]);router[_0x8db2('0x20')]('/:id/canned_answers',auth[_0x8db2('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x8db2('0x23')]);module[_0x8db2('0x24')]=router; \ No newline at end of file +var _0x2ef3=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','/:id/notify','/:id/send','send','put','update','delete','removeAnswers'];(function(_0x8d244d,_0x49c04a){var _0x30fcd2=function(_0x167302){while(--_0x167302){_0x8d244d['push'](_0x8d244d['shift']());}};_0x30fcd2(++_0x49c04a);}(_0x2ef3,0xba));var _0x32ef=function(_0x4d899c,_0x5b6dc3){_0x4d899c=_0x4d899c-0x0;var _0x46a3d1=_0x2ef3[_0x4d899c];return _0x46a3d1;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['get'](_0x32ef('0x12'),auth['isAuthenticated'](),controller[_0x32ef('0x13')]);router['get'](_0x32ef('0x14'),auth[_0x32ef('0xb')](),controller['getApplications']);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x15')](_0x32ef('0xf'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x16')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x32ef('0x17')]);router[_0x32ef('0x15')](_0x32ef('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x32ef('0x15')](_0x32ef('0x14'),auth[_0x32ef('0xb')](),controller['addApplications']);router[_0x32ef('0x15')](_0x32ef('0x18'),controller['notify']);router[_0x32ef('0x15')](_0x32ef('0x19'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x1a')]);router[_0x32ef('0x1b')](_0x32ef('0xd'),auth['isAuthenticated'](),controller[_0x32ef('0x1c')]);router['delete'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller['destroy']);router[_0x32ef('0x1d')](_0x32ef('0xf'),auth[_0x32ef('0xb')](),controller['removeDispositions']);router['delete'](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x1e')]);router['delete']('/:id/users',auth[_0x32ef('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 8b4f8e1..6202062 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 _0x108b=['sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x305b49,_0x17ed26){var _0x364e28=function(_0x14e26a){while(--_0x14e26a){_0x305b49['push'](_0x305b49['shift']());}};_0x364e28(++_0x17ed26);}(_0x108b,0x168));var _0xb108=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x108b[_0x3cc9d9];return _0x1a425d;};'use strict';var Sequelize=require(_0xb108('0x0'));var rs=require(_0xb108('0x1'));module[_0xb108('0x2')]={'name':{'type':Sequelize[_0xb108('0x3')],'unique':_0xb108('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xb108('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb108('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb108('0x6')](_0xb108('0x7'))},'accountSid':{'type':Sequelize[_0xb108('0x3')]},'authToken':{'type':Sequelize[_0xb108('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb108('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb108('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb108('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb108('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb108('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb108('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb108('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb108('0xa')],'comment':_0xb108('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xb108('0x9')],'defaultValue':![],'comment':_0xb108('0xc'),'set':function(_0x3ffe06){if(!_0x3ffe06){this[_0xb108('0xd')](_0xb108('0xe'),null);}this[_0xb108('0xd')]('mandatoryDisposition',_0x3ffe06);}},'description':{'type':Sequelize[_0xb108('0x3')]}}; \ No newline at end of file +var _0xc235=['mandatoryDisposition','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x2a112c,_0x205870){var _0x5b28fb=function(_0x5e9ff4){while(--_0x5e9ff4){_0x2a112c['push'](_0x2a112c['shift']());}};_0x5b28fb(++_0x205870);}(_0xc235,0xe1));var _0x5c23=function(_0x11f0e1,_0x520662){_0x11f0e1=_0x11f0e1-0x0;var _0x383b23=_0xc235[_0x11f0e1];return _0x383b23;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x5c23('0x0')]={'name':{'type':Sequelize[_0x5c23('0x1')],'unique':_0x5c23('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x5c23('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5c23('0x1')],'defaultValue':function(){return rs[_0x5c23('0x3')]();}},'phone':{'type':Sequelize[_0x5c23('0x1')]},'type':{'type':Sequelize[_0x5c23('0x4')](_0x5c23('0x5'))},'accountSid':{'type':Sequelize[_0x5c23('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5c23('0x6')],'defaultValue':function(){return _0x5c23('0x7');}},'notificationSound':{'type':Sequelize[_0x5c23('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5c23('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5c23('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5c23('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5c23('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5c23('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5c23('0x9')],'comment':_0x5c23('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x5c23('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x210f04){if(!_0x210f04){this[_0x5c23('0xb')](_0x5c23('0xc'),null);}this[_0x5c23('0xb')](_0x5c23('0xd'),_0x210f04);}},'description':{'type':Sequelize[_0x5c23('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 5def7e7..44d6b32 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 _0x1204=['sort','where','pick','type','VIRTUAL','merge','options','include','findAll','rows','show','keys','includeAll','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','params','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','filter','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','whatsapp','Applications','account','applications','orderBy','priority','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','whatsapp:','Body','MessageSid','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','DESC','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','messageId','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','send','\x0a','to\x20is\x20mandatory','CmList','List','defaults','out','Messages','WhatsappMessage','dataValues','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0xeb0f1f,_0xd71808){var _0x2b2bec=function(_0x16efb1){while(--_0x16efb1){_0xeb0f1f['push'](_0xeb0f1f['shift']());}};_0x2b2bec(++_0xd71808);}(_0x1204,0x6f));var _0x4120=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1204[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x4120('0x0'));var rimraf=require(_0x4120('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4120('0x2'));var moment=require(_0x4120('0x3'));var BPromise=require(_0x4120('0x4'));var Mustache=require(_0x4120('0x5'));var util=require(_0x4120('0x6'));var path=require('path');var sox=require(_0x4120('0x7'));var csv=require(_0x4120('0x8'));var ejs=require(_0x4120('0x9'));var fs=require('fs');var fs_extra=require(_0x4120('0xa'));var _=require(_0x4120('0xb'));var squel=require('squel');var crypto=require(_0x4120('0xc'));var jsforce=require(_0x4120('0xd'));var deskjs=require(_0x4120('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4120('0xf'));var Papa=require('papaparse');var Redis=require(_0x4120('0x10'));var authService=require(_0x4120('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4120('0x12'));var logger=require(_0x4120('0x13'))(_0x4120('0x14'));var utils=require('../../config/utils');var config=require(_0x4120('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4120('0x16'))['db'];config[_0x4120('0x17')]=_['defaults'](config['redis'],{'host':_0x4120('0x18'),'port':0x18eb});var socket=require(_0x4120('0x19'))(new Redis(config[_0x4120('0x17')]));require(_0x4120('0x1a'))[_0x4120('0x1b')](socket);var jayson=require(_0x4120('0x1c'));var client=jayson[_0x4120('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x17ced0,_0x21ffea,_0x2f25a5,_0x5cc781){return new BPromise(function(_0xc3245d,_0x4dcdfd){var _0x298c05=_0x5cc781||client;return _0x298c05[_0x4120('0x1e')](_0x17ced0,_0x2f25a5)[_0x4120('0x1f')](function(_0x213860){logger[_0x4120('0x20')](_0x4120('0x21'),_0x21ffea,_0x4120('0x22'));logger[_0x4120('0x23')](_0x4120('0x24'),_0x21ffea,_0x4120('0x22'),JSON['stringify'](_0x213860));if(_0x213860[_0x4120('0x25')]){if(_0x213860[_0x4120('0x25')]['code']===0x1f4){logger['error'](_0x4120('0x21'),_0x21ffea,_0x213860[_0x4120('0x25')][_0x4120('0x26')]);return _0x4dcdfd(_0x213860[_0x4120('0x25')][_0x4120('0x26')]);}logger[_0x4120('0x25')](_0x4120('0x21'),_0x21ffea,_0x213860[_0x4120('0x25')][_0x4120('0x26')]);return _0xc3245d(_0x213860[_0x4120('0x25')]['message']);}else{logger[_0x4120('0x20')](_0x4120('0x21'),_0x21ffea,_0x4120('0x22'));_0xc3245d(_0x213860[_0x4120('0x27')][_0x4120('0x26')]);}})[_0x4120('0x28')](function(_0xc8ac84){logger['error'](_0x4120('0x21'),_0x21ffea,_0xc8ac84);_0x4dcdfd(_0xc8ac84);});});}function respondWithStatusCode(_0x4841e8,_0x540dd8){_0x540dd8=_0x540dd8||0xcc;return function(_0x25e623){if(_0x25e623){return _0x4841e8[_0x4120('0x29')](_0x540dd8);}return _0x4841e8[_0x4120('0x2a')](_0x540dd8)[_0x4120('0x2b')]();};}function respondWithResult(_0x38ffa4,_0x1107b8){_0x1107b8=_0x1107b8||0xc8;return function(_0x283c42){if(_0x283c42){return _0x38ffa4[_0x4120('0x2a')](_0x1107b8)['json'](_0x283c42);}};}function respondWithFilteredResult(_0x3b7142,_0x227435){return function(_0x488fe2){if(_0x488fe2){var _0x596ccf=typeof _0x227435[_0x4120('0x2c')]===_0x4120('0x2d')&&typeof _0x227435[_0x4120('0x2e')]===_0x4120('0x2d');var _0x4f49d9=_0x488fe2[_0x4120('0x2f')];var _0x1125a9=_0x596ccf?0x0:_0x227435[_0x4120('0x2c')];var _0x5da918=_0x596ccf?_0x488fe2[_0x4120('0x2f')]:_0x227435[_0x4120('0x2c')]+_0x227435[_0x4120('0x2e')];var _0x36e316;if(_0x5da918>=_0x4f49d9){_0x5da918=_0x4f49d9;_0x36e316=0xc8;}else{_0x36e316=0xce;}_0x3b7142[_0x4120('0x2a')](_0x36e316);return _0x3b7142[_0x4120('0x30')](_0x4120('0x31'),_0x1125a9+'-'+_0x5da918+'/'+_0x4f49d9)[_0x4120('0x32')](_0x488fe2);}return null;};}function patchUpdates(_0x24a322){return function(_0x4c01bc){try{jsonpatch['apply'](_0x4c01bc,_0x24a322,!![]);}catch(_0x555257){return BPromise[_0x4120('0x33')](_0x555257);}return _0x4c01bc[_0x4120('0x34')]();};}function saveUpdates(_0x309a7f,_0x1df2e0){return function(_0x28e4b2){if(_0x28e4b2){return _0x28e4b2[_0x4120('0x35')](_0x309a7f)[_0x4120('0x1f')](function(_0x457bc0){return _0x457bc0;});}return null;};}function removeEntity(_0x46a246,_0x385045){return function(_0x1e94f8){if(_0x1e94f8){return _0x1e94f8[_0x4120('0x36')]()[_0x4120('0x1f')](function(){var _0x465ce7=_0x1e94f8[_0x4120('0x37')]({'plain':!![]});var _0x978c35=_0x4120('0x38');return db[_0x4120('0x39')][_0x4120('0x36')]({'where':{'type':_0x978c35,'resourceId':_0x465ce7['id']}})[_0x4120('0x1f')](function(){return _0x1e94f8;});})[_0x4120('0x1f')](function(){_0x46a246[_0x4120('0x2a')](0xcc)[_0x4120('0x2b')]();});}};}function handleEntityNotFound(_0x32e78e,_0x34ca92){return function(_0x57fc85){if(!_0x57fc85){_0x32e78e[_0x4120('0x29')](0x194);}return _0x57fc85;};}function handleError(_0x1135dc,_0x102a0f){_0x102a0f=_0x102a0f||0x1f4;return function(_0x550492){logger[_0x4120('0x25')](_0x550492['stack']);if(_0x550492[_0x4120('0x3a')]){delete _0x550492[_0x4120('0x3a')];}_0x1135dc[_0x4120('0x2a')](_0x102a0f)['send'](_0x550492);};}exports[_0x4120('0x3b')]=function(_0x2bec37,_0x5b6de6){var _0x516c95={'include':[{'model':db[_0x4120('0x3c')],'as':_0x4120('0x3d')}]},_0x182afb={},_0x495d08={'count':0x0,'rows':[]};var _0x5d0c0f=_[_0x4120('0x3e')](db[_0x4120('0x3f')][_0x4120('0x40')],function(_0x91b1b4){return{'name':_0x91b1b4[_0x4120('0x41')],'type':_0x91b1b4['type'][_0x4120('0x42')]};});_0x182afb[_0x4120('0x43')]=_[_0x4120('0x3e')](_0x5d0c0f,_0x4120('0x3a'));_0x182afb[_0x4120('0x44')]=_['keys'](_0x2bec37[_0x4120('0x44')]);_0x182afb[_0x4120('0x45')]=_[_0x4120('0x46')](_0x182afb['model'],_0x182afb[_0x4120('0x44')]);_0x516c95[_0x4120('0x47')]=_[_0x4120('0x46')](_0x182afb[_0x4120('0x43')],qs[_0x4120('0x48')](_0x2bec37[_0x4120('0x44')][_0x4120('0x48')]));_0x516c95[_0x4120('0x47')]=_0x516c95['attributes'][_0x4120('0x49')]?_0x516c95[_0x4120('0x47')]:_0x182afb['model'];if(!_0x2bec37['query']['hasOwnProperty'](_0x4120('0x4a'))){_0x516c95[_0x4120('0x2e')]=qs[_0x4120('0x2e')](_0x2bec37['query']['limit']);_0x516c95[_0x4120('0x2c')]=qs['offset'](_0x2bec37[_0x4120('0x44')][_0x4120('0x2c')]);}_0x516c95['order']=qs[_0x4120('0x4b')](_0x2bec37[_0x4120('0x44')][_0x4120('0x4b')]);_0x516c95[_0x4120('0x4c')]=qs[_0x4120('0x45')](_[_0x4120('0x4d')](_0x2bec37['query'],_0x182afb['filters']),_0x5d0c0f);if(_0x2bec37['query']['filter']){_0x516c95[_0x4120('0x4c')]=_['merge'](_0x516c95[_0x4120('0x4c')],{'$or':_[_0x4120('0x3e')](_0x5d0c0f,function(_0x5ca4ab){if(_0x5ca4ab[_0x4120('0x4e')]!==_0x4120('0x4f')){var _0x30e5be={};_0x30e5be[_0x5ca4ab[_0x4120('0x3a')]]={'$like':'%'+_0x2bec37[_0x4120('0x44')]['filter']+'%'};return _0x30e5be;}})});}_0x516c95=_[_0x4120('0x50')]({},_0x516c95,_0x2bec37[_0x4120('0x51')]);var _0xc7e4c3={'where':_0x516c95['where']};return db['WhatsappAccount'][_0x4120('0x2f')](_0xc7e4c3)[_0x4120('0x1f')](function(_0x44afcd){_0x495d08[_0x4120('0x2f')]=_0x44afcd;if(_0x2bec37[_0x4120('0x44')]['includeAll']){_0x516c95[_0x4120('0x52')]=[{'all':!![]}];}return db[_0x4120('0x3f')][_0x4120('0x53')](_0x516c95);})[_0x4120('0x1f')](function(_0x37cde0){_0x495d08[_0x4120('0x54')]=_0x37cde0;return _0x495d08;})[_0x4120('0x1f')](respondWithFilteredResult(_0x5b6de6,_0x516c95))['catch'](handleError(_0x5b6de6,null));};exports[_0x4120('0x55')]=function(_0x375036,_0x260e6c){var _0x355632={'raw':![],'where':{'id':_0x375036['params']['id']},'include':[{'model':db[_0x4120('0x3c')],'as':_0x4120('0x3d')}]},_0x3bc383={};_0x3bc383[_0x4120('0x43')]=_[_0x4120('0x56')](db['WhatsappAccount']['rawAttributes']);_0x3bc383[_0x4120('0x44')]=_['keys'](_0x375036[_0x4120('0x44')]);_0x3bc383[_0x4120('0x45')]=_[_0x4120('0x46')](_0x3bc383[_0x4120('0x43')],_0x3bc383[_0x4120('0x44')]);_0x355632['attributes']=_[_0x4120('0x46')](_0x3bc383[_0x4120('0x43')],qs[_0x4120('0x48')](_0x375036[_0x4120('0x44')][_0x4120('0x48')]));_0x355632[_0x4120('0x47')]=_0x355632[_0x4120('0x47')][_0x4120('0x49')]?_0x355632[_0x4120('0x47')]:_0x3bc383['model'];if(_0x375036[_0x4120('0x44')][_0x4120('0x57')]){_0x355632['include']=[{'all':!![]}];}_0x355632=_[_0x4120('0x50')]({},_0x355632,_0x375036[_0x4120('0x51')]);return db[_0x4120('0x3f')][_0x4120('0x58')](_0x355632)[_0x4120('0x1f')](handleEntityNotFound(_0x260e6c,null))[_0x4120('0x1f')](respondWithResult(_0x260e6c,null))[_0x4120('0x28')](handleError(_0x260e6c,null));};exports[_0x4120('0x59')]=function(_0x1689c6,_0x5a24d){return db['WhatsappAccount'][_0x4120('0x59')](_0x1689c6['body'],{})[_0x4120('0x1f')](function(_0x384fd5){var _0x188eb4=_0x1689c6[_0x4120('0x5a')][_0x4120('0x37')]({'plain':!![]});if(!_0x188eb4)throw new Error(_0x4120('0x5b'));if(_0x188eb4[_0x4120('0x5c')]===_0x4120('0x5a')){var _0x3990b1=_0x384fd5[_0x4120('0x37')]({'plain':!![]});var _0x5d3d39='WhatsappAccounts';return db[_0x4120('0x5d')][_0x4120('0x58')]({'where':{'name':_0x5d3d39,'userProfileId':_0x188eb4[_0x4120('0x5e')]},'raw':!![]})['then'](function(_0xed7b9){if(_0xed7b9&&_0xed7b9[_0x4120('0x5f')]===0x0){return db[_0x4120('0x39')][_0x4120('0x59')]({'name':_0x3990b1[_0x4120('0x3a')],'resourceId':_0x3990b1['id'],'type':_0xed7b9[_0x4120('0x3a')],'sectionId':_0xed7b9['id']},{})['then'](function(){return _0x384fd5;});}else{return _0x384fd5;}})[_0x4120('0x28')](function(_0x3929be){logger[_0x4120('0x25')](_0x4120('0x60'),_0x3929be);throw _0x3929be;});}return _0x384fd5;})[_0x4120('0x1f')](respondWithResult(_0x5a24d,0xc9))[_0x4120('0x28')](handleError(_0x5a24d,null));};exports['update']=function(_0x5d5847,_0x187db0){if(_0x5d5847[_0x4120('0x61')]['id']){delete _0x5d5847['body']['id'];}return db['WhatsappAccount'][_0x4120('0x58')]({'where':{'id':_0x5d5847['params']['id']},'include':[{'model':db['Pause'],'as':_0x4120('0x3d')}]})['then'](handleEntityNotFound(_0x187db0,null))[_0x4120('0x1f')](saveUpdates(_0x5d5847[_0x4120('0x61')],null))[_0x4120('0x1f')](respondWithResult(_0x187db0,null))[_0x4120('0x28')](handleError(_0x187db0,null));};exports[_0x4120('0x36')]=function(_0x5ef52a,_0x3353d6){return db[_0x4120('0x3f')]['find']({'where':{'id':_0x5ef52a[_0x4120('0x62')]['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x3353d6,null))[_0x4120('0x1f')](removeEntity(_0x3353d6,null))[_0x4120('0x28')](handleError(_0x3353d6,null));};exports['describe']=function(_0x272676,_0x4449b8){return db['WhatsappAccount']['describe']()[_0x4120('0x1f')](respondWithResult(_0x4449b8,null))[_0x4120('0x28')](handleError(_0x4449b8,null));};exports['addDisposition']=function(_0x24a1ce,_0x19abd2,_0x472340){if(_0x24a1ce['body']['id']){delete _0x24a1ce[_0x4120('0x61')]['id'];}return db[_0x4120('0x3f')][_0x4120('0x58')]({'where':{'id':_0x24a1ce[_0x4120('0x62')]['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x19abd2,null))[_0x4120('0x1f')](function(_0x458a0a){if(_0x458a0a){_0x24a1ce[_0x4120('0x61')][_0x4120('0x63')]=_0x458a0a['id'];return db[_0x4120('0x64')][_0x4120('0x59')](_0x24a1ce['body']);}})['then'](respondWithResult(_0x19abd2,null))[_0x4120('0x28')](handleError(_0x19abd2,null));};exports[_0x4120('0x65')]=function(_0x139ba9,_0x2430e2,_0x416cdf){var _0xca5da9={'raw':![],'where':{}};var _0x3bfb4f={};var _0x27ac68={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x4120('0x66')]({'where':{'id':_0x139ba9[_0x4120('0x62')]['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x2430e2,null))[_0x4120('0x1f')](function(_0x3af3cd){if(_0x3af3cd){_0x3bfb4f['model']=_[_0x4120('0x56')](db[_0x4120('0x64')][_0x4120('0x40')]);_0x3bfb4f[_0x4120('0x44')]=_['keys'](_0x139ba9['query']);_0x3bfb4f[_0x4120('0x45')]=_[_0x4120('0x46')](_0x3bfb4f[_0x4120('0x43')],_0x3bfb4f[_0x4120('0x44')]);_0xca5da9['attributes']=_['intersection'](_0x3bfb4f['model'],qs[_0x4120('0x48')](_0x139ba9[_0x4120('0x44')][_0x4120('0x48')]));_0xca5da9[_0x4120('0x47')]=_0xca5da9['attributes']['length']?_0xca5da9['attributes']:_0x3bfb4f[_0x4120('0x43')];if(!_0x139ba9[_0x4120('0x44')][_0x4120('0x67')](_0x4120('0x4a'))){_0xca5da9[_0x4120('0x2e')]=qs[_0x4120('0x2e')](_0x139ba9[_0x4120('0x44')]['limit']);_0xca5da9['offset']=qs[_0x4120('0x2c')](_0x139ba9[_0x4120('0x44')][_0x4120('0x2c')]);}_0xca5da9[_0x4120('0x68')]=qs[_0x4120('0x4b')](_0x139ba9[_0x4120('0x44')][_0x4120('0x4b')]);_0xca5da9[_0x4120('0x4c')]=qs[_0x4120('0x45')](_[_0x4120('0x4d')](_0x139ba9[_0x4120('0x44')],_0x3bfb4f['filters']));_0xca5da9[_0x4120('0x4c')][_0x4120('0x63')]=_0x3af3cd['id'];if(_0x139ba9[_0x4120('0x44')]['filter']){_0xca5da9[_0x4120('0x4c')]=_[_0x4120('0x50')](_0xca5da9[_0x4120('0x4c')],{'$or':_[_0x4120('0x3e')](_0xca5da9[_0x4120('0x47')],function(_0xa17a47){var _0x2512d1={};_0x2512d1[_0xa17a47]={'$like':'%'+_0x139ba9[_0x4120('0x44')][_0x4120('0x69')]+'%'};return _0x2512d1;})});}_0xca5da9=_[_0x4120('0x50')]({},_0xca5da9,_0x139ba9[_0x4120('0x51')]);return db[_0x4120('0x64')][_0x4120('0x2f')]({'where':_0xca5da9['where']})[_0x4120('0x1f')](function(_0x337bc7){_0x27ac68['count']=_0x337bc7;if(_0x139ba9[_0x4120('0x44')][_0x4120('0x57')]){_0xca5da9[_0x4120('0x52')]=[{'all':!![]}];}return db[_0x4120('0x64')][_0x4120('0x53')](_0xca5da9);})[_0x4120('0x1f')](function(_0x5e5ccf){_0x27ac68['rows']=_0x5e5ccf;return _0x27ac68;});}})['then'](respondWithFilteredResult(_0x2430e2,_0xca5da9))[_0x4120('0x28')](handleError(_0x2430e2,null));};exports[_0x4120('0x6a')]=function(_0x429dde,_0x3cb48a,_0x57ebab){return db[_0x4120('0x3f')][_0x4120('0x58')]({'where':{'id':_0x429dde[_0x4120('0x62')]['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x3cb48a,null))['then'](function(_0x21a10e){if(_0x21a10e){return _0x21a10e[_0x4120('0x6a')](_0x429dde[_0x4120('0x44')][_0x4120('0x6b')]);}})['then'](respondWithStatusCode(_0x3cb48a,null))[_0x4120('0x28')](handleError(_0x3cb48a,null));};exports['addAnswer']=function(_0x58e33b,_0x42d683,_0x3ec1c8){if(_0x58e33b[_0x4120('0x61')]['id']){delete _0x58e33b[_0x4120('0x61')]['id'];}return db[_0x4120('0x3f')][_0x4120('0x58')]({'where':{'id':_0x58e33b[_0x4120('0x62')]['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x42d683,null))[_0x4120('0x1f')](function(_0x287523){if(_0x287523){_0x58e33b[_0x4120('0x61')][_0x4120('0x63')]=_0x287523['id'];return db[_0x4120('0x6c')]['create'](_0x58e33b[_0x4120('0x61')]);}})[_0x4120('0x1f')](respondWithResult(_0x42d683,null))[_0x4120('0x28')](handleError(_0x42d683,null));};exports[_0x4120('0x6d')]=function(_0x166835,_0x3b5e3b,_0x535b7e){var _0x1851c7={'raw':![],'where':{}};var _0x2b4975={};var _0x410f1b={'count':0x0,'rows':[]};return db[_0x4120('0x3f')]['findOne']({'where':{'id':_0x166835[_0x4120('0x62')]['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x3b5e3b,null))[_0x4120('0x1f')](function(_0x5b7a05){if(_0x5b7a05){_0x2b4975['model']=_['keys'](db[_0x4120('0x6c')][_0x4120('0x40')]);_0x2b4975['query']=_['keys'](_0x166835['query']);_0x2b4975[_0x4120('0x45')]=_[_0x4120('0x46')](_0x2b4975[_0x4120('0x43')],_0x2b4975[_0x4120('0x44')]);_0x1851c7[_0x4120('0x47')]=_[_0x4120('0x46')](_0x2b4975[_0x4120('0x43')],qs[_0x4120('0x48')](_0x166835[_0x4120('0x44')][_0x4120('0x48')]));_0x1851c7[_0x4120('0x47')]=_0x1851c7[_0x4120('0x47')][_0x4120('0x49')]?_0x1851c7[_0x4120('0x47')]:_0x2b4975[_0x4120('0x43')];if(!_0x166835['query'][_0x4120('0x67')]('nolimit')){_0x1851c7[_0x4120('0x2e')]=qs[_0x4120('0x2e')](_0x166835[_0x4120('0x44')]['limit']);_0x1851c7[_0x4120('0x2c')]=qs[_0x4120('0x2c')](_0x166835[_0x4120('0x44')][_0x4120('0x2c')]);}_0x1851c7[_0x4120('0x68')]=qs[_0x4120('0x4b')](_0x166835[_0x4120('0x44')][_0x4120('0x4b')]);_0x1851c7[_0x4120('0x4c')]=qs[_0x4120('0x45')](_[_0x4120('0x4d')](_0x166835[_0x4120('0x44')],_0x2b4975[_0x4120('0x45')]));_0x1851c7[_0x4120('0x4c')]['WhatsappAccountId']=_0x5b7a05['id'];if(_0x166835['query']['filter']){_0x1851c7['where']=_[_0x4120('0x50')](_0x1851c7[_0x4120('0x4c')],{'$or':_['map'](_0x1851c7[_0x4120('0x47')],function(_0x4b92ab){var _0x5d1455={};_0x5d1455[_0x4b92ab]={'$like':'%'+_0x166835['query'][_0x4120('0x69')]+'%'};return _0x5d1455;})});}_0x1851c7=_['merge']({},_0x1851c7,_0x166835[_0x4120('0x51')]);return db[_0x4120('0x6c')][_0x4120('0x2f')]({'where':_0x1851c7[_0x4120('0x4c')]})[_0x4120('0x1f')](function(_0x49375e){_0x410f1b[_0x4120('0x2f')]=_0x49375e;if(_0x166835[_0x4120('0x44')][_0x4120('0x57')]){_0x1851c7[_0x4120('0x52')]=[{'all':!![]}];}return db[_0x4120('0x6c')]['findAll'](_0x1851c7);})[_0x4120('0x1f')](function(_0xa682c8){_0x410f1b[_0x4120('0x54')]=_0xa682c8;return _0x410f1b;});}})['then'](respondWithFilteredResult(_0x3b5e3b,_0x1851c7))[_0x4120('0x28')](handleError(_0x3b5e3b,null));};exports[_0x4120('0x6e')]=function(_0x320f1e,_0x181f86,_0x3af30e){return db['WhatsappAccount'][_0x4120('0x58')]({'where':{'id':_0x320f1e[_0x4120('0x62')]['id']}})['then'](handleEntityNotFound(_0x181f86,null))[_0x4120('0x1f')](function(_0xbc9b97){if(_0xbc9b97){return _0xbc9b97[_0x4120('0x6e')](_0x320f1e['query'][_0x4120('0x6b')]);}})[_0x4120('0x1f')](respondWithStatusCode(_0x181f86,null))['catch'](handleError(_0x181f86,null));};exports['addAgents']=function(_0x4c6761,_0x2d4a30,_0x2ad71e){return db[_0x4120('0x3f')]['find']({'where':{'id':_0x4c6761[_0x4120('0x62')]['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x2d4a30,null))[_0x4120('0x1f')](function(_0x177ebd){if(_0x177ebd){return _0x177ebd['addAgents'](_0x4c6761[_0x4120('0x61')][_0x4120('0x6b')],_[_0x4120('0x6f')](_0x4c6761[_0x4120('0x61')],[_0x4120('0x6b'),'id'])||{})[_0x4120('0x70')](function(_0x2c2a15){for(var _0x40efc1=0x0;_0x40efc1<_0x4c6761[_0x4120('0x61')]['ids'][_0x4120('0x49')];_0x40efc1+=0x1){socket[_0x4120('0x71')](_0x4120('0x72'),{'UserId':Number(_0x4c6761[_0x4120('0x61')][_0x4120('0x6b')][_0x40efc1]),'WhatsappAccountId':Number(_0x4c6761[_0x4120('0x62')]['id'])});}return _0x2c2a15;});}})[_0x4120('0x1f')](respondWithResult(_0x2d4a30,null))[_0x4120('0x28')](handleError(_0x2d4a30,null));};exports[_0x4120('0x73')]=function(_0x53e47c,_0x4afbea,_0x15acb1){return db[_0x4120('0x3f')][_0x4120('0x58')]({'where':{'id':_0x53e47c['params']['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x4afbea,null))[_0x4120('0x1f')](function(_0x28f9f8){if(_0x28f9f8){return _0x28f9f8['removeAgents'](_0x53e47c[_0x4120('0x44')][_0x4120('0x6b')])['then'](function(){if(_[_0x4120('0x74')](_0x53e47c['query']['ids'])){for(var _0x208c19=0x0;_0x208c19<_0x53e47c['query'][_0x4120('0x6b')][_0x4120('0x49')];_0x208c19+=0x1){socket['emit'](_0x4120('0x75'),{'UserId':Number(_0x53e47c[_0x4120('0x44')][_0x4120('0x6b')][_0x208c19]),'WhatsappAccountId':Number(_0x53e47c[_0x4120('0x62')]['id'])});}}else{socket[_0x4120('0x71')](_0x4120('0x75'),{'UserId':Number(_0x53e47c['query'][_0x4120('0x6b')]),'WhatsappAccountId':Number(_0x53e47c[_0x4120('0x62')]['id'])});}});}})[_0x4120('0x1f')](respondWithStatusCode(_0x4afbea,null))[_0x4120('0x28')](handleError(_0x4afbea,null));};exports[_0x4120('0x76')]=function(_0x235897,_0x4519b6,_0x4bcdae){var _0x1f173a={};var _0x41abef={};var _0x3e1b1e;var _0x28fefa;return db['WhatsappAccount'][_0x4120('0x66')]({'where':{'id':_0x235897['params']['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x4519b6,null))['then'](function(_0x1002f6){if(_0x1002f6){_0x3e1b1e=_0x1002f6;_0x41abef[_0x4120('0x43')]=_[_0x4120('0x56')](db[_0x4120('0x77')]['rawAttributes']);_0x41abef[_0x4120('0x44')]=_[_0x4120('0x56')](_0x235897[_0x4120('0x44')]);_0x41abef[_0x4120('0x45')]=_[_0x4120('0x46')](_0x41abef['model'],_0x41abef['query']);_0x1f173a[_0x4120('0x47')]=_[_0x4120('0x46')](_0x41abef[_0x4120('0x43')],qs[_0x4120('0x48')](_0x235897[_0x4120('0x44')]['fields']));_0x1f173a[_0x4120('0x47')]=_0x1f173a['attributes']['length']?_0x1f173a[_0x4120('0x47')]:_0x41abef['model'];_0x1f173a['order']=qs[_0x4120('0x4b')](_0x235897[_0x4120('0x44')]['sort']);_0x1f173a[_0x4120('0x4c')]=qs['filters'](_['pick'](_0x235897[_0x4120('0x44')],_0x41abef[_0x4120('0x45')]));if(_0x235897['query'][_0x4120('0x69')]){_0x1f173a[_0x4120('0x4c')]=_[_0x4120('0x50')](_0x1f173a[_0x4120('0x4c')],{'$or':_[_0x4120('0x3e')](_0x1f173a[_0x4120('0x47')],function(_0xb7a98b){var _0xe2f144={};_0xe2f144[_0xb7a98b]={'$like':'%'+_0x235897[_0x4120('0x44')][_0x4120('0x69')]+'%'};return _0xe2f144;})});}_0x1f173a=_[_0x4120('0x50')]({},_0x1f173a,_0x235897['options']);return _0x3e1b1e[_0x4120('0x76')](_0x1f173a);}})[_0x4120('0x1f')](function(_0x5319c0){if(_0x5319c0){_0x28fefa=_0x5319c0[_0x4120('0x49')];if(!_0x235897[_0x4120('0x44')][_0x4120('0x67')](_0x4120('0x4a'))){_0x1f173a[_0x4120('0x2e')]=qs['limit'](_0x235897[_0x4120('0x44')][_0x4120('0x2e')]);_0x1f173a[_0x4120('0x2c')]=qs[_0x4120('0x2c')](_0x235897[_0x4120('0x44')]['offset']);}return _0x3e1b1e[_0x4120('0x76')](_0x1f173a);}})[_0x4120('0x1f')](function(_0x429f93){if(_0x429f93){return _0x429f93?{'count':_0x28fefa,'rows':_0x429f93}:null;}})[_0x4120('0x1f')](respondWithResult(_0x4519b6,null))[_0x4120('0x28')](handleError(_0x4519b6,null));};exports[_0x4120('0x78')]=function(_0x34d029,_0x213d47,_0xb3f3b1){return db[_0x4120('0x3f')][_0x4120('0x66')]({'where':{'id':_0x34d029[_0x4120('0x62')]['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x213d47,null))[_0x4120('0x1f')](function(_0x48876c){if(_0x48876c){return db['sequelize'][_0x4120('0x79')](function(_0x4cfe70){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x34d029[_0x4120('0x62')]['id']},'transaction':_0x4cfe70})[_0x4120('0x1f')](function(_0x5d2e2d){var _0x4c49bf=_[_0x4120('0x3e')](_0x34d029[_0x4120('0x61')],function(_0x508b16){_0x508b16['WhatsappAccountId']=_0x34d029[_0x4120('0x62')]['id'];return _0x508b16;});return db[_0x4120('0x7a')][_0x4120('0x7b')](_0x4c49bf,{'transaction':_0x4cfe70});});})[_0x4120('0x1f')](function(){return db[_0x4120('0x7a')][_0x4120('0x7c')]({'where':{'WhatsappAccountId':_0x34d029['params']['id']},'order':'priority'});});}})[_0x4120('0x1f')](respondWithResult(_0x213d47,null))[_0x4120('0x28')](handleError(_0x213d47,null));};exports[_0x4120('0x7d')]=function(_0xac8bc,_0x24dc1b,_0x353d10){var _0x4ccc0a={};var _0xa7abd6={};var _0x366b2f;var _0x170558;return db[_0x4120('0x3f')][_0x4120('0x66')]({'where':{'id':_0xac8bc[_0x4120('0x62')]['id']}})[_0x4120('0x1f')](handleEntityNotFound(_0x24dc1b,null))['then'](function(_0x409331){if(_0x409331){_0x366b2f=_0x409331;_0xa7abd6[_0x4120('0x43')]=_[_0x4120('0x56')](db[_0x4120('0x7a')]['rawAttributes']);_0xa7abd6[_0x4120('0x44')]=_[_0x4120('0x56')](_0xac8bc[_0x4120('0x44')]);_0xa7abd6['filters']=_[_0x4120('0x46')](_0xa7abd6[_0x4120('0x43')],_0xa7abd6[_0x4120('0x44')]);_0x4ccc0a[_0x4120('0x47')]=_['intersection'](_0xa7abd6[_0x4120('0x43')],qs['fields'](_0xac8bc[_0x4120('0x44')][_0x4120('0x48')]));_0x4ccc0a[_0x4120('0x47')]=_0x4ccc0a['attributes'][_0x4120('0x49')]?_0x4ccc0a[_0x4120('0x47')]:_0xa7abd6['model'];_0x4ccc0a[_0x4120('0x68')]=qs[_0x4120('0x4b')](_0xac8bc['query'][_0x4120('0x4b')]);_0x4ccc0a[_0x4120('0x4c')]=qs['filters'](_[_0x4120('0x4d')](_0xac8bc[_0x4120('0x44')],_0xa7abd6[_0x4120('0x45')]));if(_0xac8bc[_0x4120('0x44')][_0x4120('0x69')]){_0x4ccc0a[_0x4120('0x4c')]=_[_0x4120('0x50')](_0x4ccc0a[_0x4120('0x4c')],{'$or':_[_0x4120('0x3e')](_0x4ccc0a[_0x4120('0x47')],function(_0x14e5e3){var _0x33bc76={};_0x33bc76[_0x14e5e3]={'$like':'%'+_0xac8bc[_0x4120('0x44')][_0x4120('0x69')]+'%'};return _0x33bc76;})});}_0x4ccc0a=_[_0x4120('0x50')]({},_0x4ccc0a,_0xac8bc[_0x4120('0x51')]);return _0x366b2f[_0x4120('0x7d')](_0x4ccc0a);}})[_0x4120('0x1f')](function(_0x434e46){if(_0x434e46){_0x170558=_0x434e46[_0x4120('0x49')];if(!_0xac8bc[_0x4120('0x44')][_0x4120('0x67')]('nolimit')){_0x4ccc0a[_0x4120('0x2e')]=qs[_0x4120('0x2e')](_0xac8bc[_0x4120('0x44')][_0x4120('0x2e')]);_0x4ccc0a[_0x4120('0x2c')]=qs[_0x4120('0x2c')](_0xac8bc[_0x4120('0x44')][_0x4120('0x2c')]);}return _0x366b2f['getApplications'](_0x4ccc0a);}})['then'](function(_0xffeed5){if(_0xffeed5){return _0xffeed5?{'count':_0x170558,'rows':_0xffeed5}:null;}})['then'](respondWithResult(_0x24dc1b,null))[_0x4120('0x28')](handleError(_0x24dc1b,null));};exports['notify']=function(_0x460bea,_0x3be89c,_0x45d481){var _0x40db6a={'channel':_0x4120('0x7e')};var _0x3f3100=[];var _0xb611b8=[];var _0x3d2583={};return db[_0x4120('0x3f')][_0x4120('0x58')]({'where':{'id':_0x460bea['params']['id']},'include':[{'model':db[_0x4120('0x7a')],'as':_0x4120('0x7f')}]})['then'](handleEntityNotFound(_0x3be89c,null))[_0x4120('0x1f')](function(_0x2748f3){_0x40db6a[_0x4120('0x80')]=_0x2748f3;_0x40db6a[_0x4120('0x81')]=_[_0x4120('0x82')](_0x2748f3[_0x4120('0x7f')],[_0x4120('0x83')],['asc']);if(_0x40db6a[_0x4120('0x80')][_0x4120('0x7f')]){delete _0x40db6a['account'][_0x4120('0x7f')];}return db[_0x4120('0x84')][_0x4120('0x85')]();})['then'](function(_0x3b3bc5){if(!_0x3b3bc5){throw new db[(_0x4120('0x86'))][(_0x4120('0x87'))](_0x4120('0x88'));}_0x3f3100=_[_0x4120('0x89')](_[_0x4120('0x56')](_0x3b3bc5),[_0x4120('0x8a'),_0x4120('0x8b')]);_0xb611b8=_[_0x4120('0x89')](_[_0x4120('0x56')](_0x3b3bc5),['createdAt',_0x4120('0x8b'),'CompanyId',_0x4120('0x8c')]);_0x40db6a[_0x4120('0x61')]={'mapKey':_0x4120('0x8d')};if(_0x40db6a['account'][_0x4120('0x4e')]&&_0x40db6a[_0x4120('0x80')][_0x4120('0x4e')]===_0x4120('0x8e')){_0x40db6a[_0x4120('0x61')]['from']=_0x460bea[_0x4120('0x61')]['From']['replace'](_0x4120('0x8f'),'');_0x40db6a[_0x4120('0x61')][_0x4120('0x61')]=_0x460bea[_0x4120('0x61')][_0x4120('0x90')];_0x40db6a[_0x4120('0x61')]['messageId']=_0x460bea[_0x4120('0x61')][_0x4120('0x91')];}if(_0x40db6a[_0x4120('0x61')]['id']){delete _0x40db6a[_0x4120('0x61')]['id'];}if(_[_0x4120('0x92')](_0x40db6a[_0x4120('0x61')][_0x4120('0x93')])){throw new db[(_0x4120('0x86'))][(_0x4120('0x87'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x40db6a[_0x4120('0x61')]['body'])||_0x40db6a[_0x4120('0x61')][_0x4120('0x61')]===''){throw new db[(_0x4120('0x86'))]['ValidationError'](_0x4120('0x94'));}if(_[_0x4120('0x92')](_0x40db6a[_0x4120('0x61')][_0x4120('0x95')])){throw new db[(_0x4120('0x86'))][(_0x4120('0x87'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb611b8);}if(!_[_0x4120('0x96')](_0xb611b8,_0x40db6a[_0x4120('0x61')][_0x4120('0x95')])){throw new db[(_0x4120('0x86'))][(_0x4120('0x87'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb611b8);}_0x3d2583[_0x40db6a[_0x4120('0x61')]['mapKey']]=_0x40db6a[_0x4120('0x61')][_0x4120('0x93')];return db['CmList'][_0x4120('0x58')]({'where':{'id':_0x40db6a[_0x4120('0x80')][_0x4120('0x8c')]},'include':[{'model':db[_0x4120('0x84')],'as':'Contacts','where':_0x3d2583,'limit':0x1,'order':[[_0x4120('0x8b'),_0x4120('0x97')]]}]});})['then'](handleEntityNotFound(_0x3be89c,null))['then'](function(_0x58f5e5){if(_0x58f5e5){_0x40db6a['list']=_[_0x4120('0x6f')](_0x58f5e5,[_0x4120('0x98')]);if(_0x58f5e5['Contacts'][_0x4120('0x49')]){return _0x58f5e5['Contacts'][0x0];}var _0x312662=_['defaults'](_0x40db6a['body'],{'firstName':_0x40db6a[_0x4120('0x61')][_0x4120('0x93')],'ListId':_0x58f5e5['id']});_0x312662[_0x40db6a[_0x4120('0x61')]['mapKey']]=_0x40db6a[_0x4120('0x61')][_0x4120('0x93')];return db['CmContact'][_0x4120('0x59')](_0x312662,{'fields':_0x3f3100,'raw':!![]});}})[_0x4120('0x1f')](handleEntityNotFound(_0x3be89c,null))[_0x4120('0x1f')](function(_0x16d37a){if(_0x16d37a){_0x40db6a[_0x4120('0x99')]=_0x16d37a;var _0x12832e={'ContactId':_0x16d37a['id'],'phone':_0x40db6a[_0x4120('0x61')][_0x4120('0x93')],'WhatsappAccountId':_0x460bea['params']['id']};var _0x14f5aa={'ContactId':_0x16d37a['id'],'WhatsappAccountId':_0x460bea[_0x4120('0x62')]['id'],'closed':![]};return db[_0x4120('0x9a')][_0x4120('0x58')]({'where':_0x14f5aa})['then'](function(_0x4f4dc9){if(_0x4f4dc9){return[_0x4f4dc9,![]];}return db['WhatsappInteraction']['create'](_0x12832e)[_0x4120('0x1f')](function(_0x491662){return[_0x491662,!![]];});});}})[_0x4120('0x70')](function(_0x5baa76,_0x4244ef){_0x40db6a[_0x4120('0x9b')]=_0x5baa76['get']({'plain':!![]});_0x40db6a[_0x4120('0x9b')][_0x4120('0x9c')]=![];if(_0x4244ef){if(_0x40db6a[_0x4120('0x80')][_0x4120('0x9d')]){_0x40db6a[_0x4120('0x81')][_0x4120('0x9e')]({'id':0x0,'priority':_0x40db6a[_0x4120('0x81')][_0x4120('0x49')]+0x1,'app':_0x4120('0x9f'),'appdata':_0x4120('0xa0'),'interval':_0x4120('0xa1')});}_0x40db6a[_0x4120('0x9b')][_0x4120('0x9c')]=!![];}return db['WhatsappMessage'][_0x4120('0x59')]({'phone':_0x40db6a[_0x4120('0x61')]['from'],'messageId':_0x40db6a[_0x4120('0x61')][_0x4120('0xa2')],'body':_0x40db6a[_0x4120('0x61')]['body'],'WhatsappAccountId':_0x460bea['params']['id'],'WhatsappInteractionId':_0x5baa76['id'],'direction':'in','ContactId':_0x5baa76[_0x4120('0xa3')],'AttachmentId':_0x40db6a[_0x4120('0x61')][_0x4120('0xa4')]});})[_0x4120('0x1f')](function(_0x5bb2b5){_0x40db6a['message']=_0x5bb2b5;if(_0x40db6a[_0x4120('0x9b')][_0x4120('0xa5')]){return db['User'][_0x4120('0x58')]({'attributes':['id',_0x4120('0x3a')],'where':{'id':_0x40db6a[_0x4120('0x9b')][_0x4120('0xa5')]}})['then'](function(_0x279256){if(_0x279256){_0x40db6a['applications'][_0x4120('0xa6')]({'id':0x0,'priority':0x0,'app':_0x4120('0xa7'),'appdata':_0x279256[_0x4120('0x3a')]+','+(_0x40db6a[_0x4120('0x80')][_0x4120('0xa8')]||0xa),'interval':_0x4120('0xa1')});}return respondWithRpcPromise('Start',_0x4120('0xa9'),_0x40db6a);});}return respondWithRpcPromise(_0x4120('0xaa'),_0x4120('0xa9'),_0x40db6a);})[_0x4120('0x1f')](function(_0x4f2eb8){if(_0x4f2eb8){var _0x5739f4=0xc8;var _0x23f824=_0x4120('0xab');logger[_0x4120('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x23f824,_0x5739f4,_0x4120('0xac'));logger[_0x4120('0x23')](_0x4120('0xad'),_0x23f824,_0x5739f4,_0x4120('0xac'),JSON[_0x4120('0xae')](_0x4f2eb8));if(_0x40db6a[_0x4120('0x80')][_0x4120('0x4e')]===_0x4120('0x8e')){return _0x3be89c[_0x4120('0x2a')](_0x5739f4)[_0x4120('0x30')](_0x4120('0xaf'),'text/xml')[_0x4120('0xb0')](_0x4120('0xb1'));}else{return _0x3be89c[_0x4120('0x2a')](_0x5739f4)[_0x4120('0x32')](_0x4f2eb8);}}})[_0x4120('0x28')](handleError(_0x3be89c,null));};exports[_0x4120('0xb0')]=function(_0x18102a,_0x2580ff,_0x2f409d){var _0x49f65c,_0x20f3d7,_0x4d5f51;if(_['isNil'](_0x18102a[_0x4120('0x61')][_0x4120('0x61')])||_0x18102a[_0x4120('0x61')]['body']===''){throw new db[(_0x4120('0x86'))][(_0x4120('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4120('0x92')](_0x18102a[_0x4120('0x61')]['to'])){throw new db['Sequelize']['ValidationError'](_0x4120('0xb2'));}_0x49f65c=_0x18102a[_0x4120('0x61')]['to'];return db[_0x4120('0x3f')][_0x4120('0x58')]({'where':{'id':_0x18102a[_0x4120('0x62')]['id']},'include':[{'model':db[_0x4120('0xb3')],'as':_0x4120('0xb4'),'include':[{'model':db[_0x4120('0x84')],'as':_0x4120('0x98'),'where':{'mobile':_0x49f65c},'limit':0x1,'order':[[_0x4120('0x8b'),_0x4120('0x97')]]}]}]})[_0x4120('0x1f')](handleEntityNotFound(_0x2580ff,null))[_0x4120('0x1f')](function(_0x2d093c){if(_0x2d093c&&_0x2d093c[_0x4120('0xb4')]){_0x20f3d7=_0x2d093c['get']({'plain':!![]});if(_0x20f3d7['List']&&_0x20f3d7['List']['Contacts'][_0x4120('0x49')]){return _0x20f3d7[_0x4120('0xb4')]['Contacts'][0x0];}return db[_0x4120('0x84')][_0x4120('0x59')](_[_0x4120('0xb5')](_0x18102a[_0x4120('0x61')],{'firstName':_0x49f65c,'mobile':_0x49f65c,'phone':_0x49f65c,'ListId':_0x20f3d7[_0x4120('0x8c')]}));}})[_0x4120('0x1f')](handleEntityNotFound(_0x2580ff,null))[_0x4120('0x1f')](function(_0x33b94d){if(_0x33b94d){_0x4d5f51=_0x33b94d;return db[_0x4120('0x9a')][_0x4120('0x58')]({'where':{'ContactId':_0x4d5f51['id'],'closed':![],'WhatsappAccountId':_0x20f3d7['id']}})['then'](function(_0xc49ad9){if(_0xc49ad9){return[_0xc49ad9,![]];}return db[_0x4120('0x9a')][_0x4120('0x59')]({'UserId':_0x18102a[_0x4120('0x5a')]['id'],'ContactId':_0x4d5f51['id'],'WhatsappAccountId':_0x20f3d7['id'],'phone':_0x49f65c,'firstMsgDirection':_0x4120('0xb6'),'Messages':[_['merge'](_0x18102a['body'],{'read':![],'body':_0x18102a['body'][_0x4120('0x61')],'phone':_0x49f65c,'WhatsappAccountId':_0x20f3d7['id'],'UserId':_0x18102a[_0x4120('0x5a')]['id'],'ContactId':_0x4d5f51['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x4120('0xb7')}]})['then'](function(_0xfc30cf){return[_0xfc30cf,!![]];});});}})[_0x4120('0x70')](function(_0x30e45c,_0x551ae7){if(_0x551ae7){return _0x30e45c;}return db[_0x4120('0xb8')][_0x4120('0x59')](_['merge'](_0x18102a[_0x4120('0x61')],{'read':![],'body':_0x18102a[_0x4120('0x61')][_0x4120('0x61')],'phone':_0x49f65c,'WhatsappAccountId':_0x20f3d7['id'],'WhatsappInteractionId':_0x30e45c['id'],'UserId':_0x18102a['user']['id'],'ContactId':_0x4d5f51['id']}))['then'](function(_0x49741c){_0x30e45c['dataValues'][_0x4120('0xb7')]=[];_0x30e45c[_0x4120('0xb9')][_0x4120('0xb7')]['push'](_0x49741c[_0x4120('0xb9')]);return _0x30e45c;});})[_0x4120('0x1f')](respondWithResult(_0x2580ff,null))[_0x4120('0x28')](handleError(_0x2580ff,null));}; \ No newline at end of file +var _0xe8a1=['out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','info','sendStatus','end','status','json','offset','undefined','count','set','reject','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','updatedAt','CompanyId','ListId','mobile','twilio','from','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','close','unmanaged','WhatsappMessage','AttachmentId','UserId','unshift','*,*,*,*','startRouting','Start','receiveMessage','Content-Type','text/xml','\x0a','List'];(function(_0x2a702f,_0x377aa7){var _0x52106f=function(_0x45726f){while(--_0x45726f){_0x2a702f['push'](_0x2a702f['shift']());}};_0x52106f(++_0x377aa7);}(_0xe8a1,0x163));var _0x1e8a=function(_0x4b957a,_0x2392b1){_0x4b957a=_0x4b957a-0x0;var _0x19f75f=_0xe8a1[_0x4b957a];return _0x19f75f;};'use strict';var emlformat=require(_0x1e8a('0x0'));var rimraf=require(_0x1e8a('0x1'));var zipdir=require(_0x1e8a('0x2'));var jsonpatch=require(_0x1e8a('0x3'));var rp=require(_0x1e8a('0x4'));var moment=require(_0x1e8a('0x5'));var BPromise=require(_0x1e8a('0x6'));var Mustache=require('mustache');var util=require(_0x1e8a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1e8a('0x8'));var ejs=require(_0x1e8a('0x9'));var fs=require('fs');var fs_extra=require(_0x1e8a('0xa'));var _=require(_0x1e8a('0xb'));var squel=require(_0x1e8a('0xc'));var crypto=require(_0x1e8a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1e8a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e8a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e8a('0x10'));var as=require(_0x1e8a('0x11'));var hardwareService=require(_0x1e8a('0x12'));var logger=require(_0x1e8a('0x13'))(_0x1e8a('0x14'));var utils=require(_0x1e8a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1e8a('0x16'))['db'];config[_0x1e8a('0x17')]=_[_0x1e8a('0x18')](config['redis'],{'host':_0x1e8a('0x19'),'port':0x18eb});var socket=require(_0x1e8a('0x1a'))(new Redis(config['redis']));require(_0x1e8a('0x1b'))[_0x1e8a('0x1c')](socket);var jayson=require(_0x1e8a('0x1d'));var client=jayson['client'][_0x1e8a('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x576bec,_0x5bcfbd,_0x3e7f52,_0x1508c5){return new BPromise(function(_0x1f0090,_0x3f2c6f){var _0x203356=_0x1508c5||client;return _0x203356['request'](_0x576bec,_0x3e7f52)[_0x1e8a('0x1f')](function(_0x4e9350){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5bcfbd,_0x1e8a('0x20'));logger[_0x1e8a('0x21')](_0x1e8a('0x22'),_0x5bcfbd,_0x1e8a('0x20'),JSON[_0x1e8a('0x23')](_0x4e9350));if(_0x4e9350[_0x1e8a('0x24')]){if(_0x4e9350[_0x1e8a('0x24')]['code']===0x1f4){logger[_0x1e8a('0x24')](_0x1e8a('0x25'),_0x5bcfbd,_0x4e9350[_0x1e8a('0x24')][_0x1e8a('0x26')]);return _0x3f2c6f(_0x4e9350[_0x1e8a('0x24')][_0x1e8a('0x26')]);}logger[_0x1e8a('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5bcfbd,_0x4e9350[_0x1e8a('0x24')][_0x1e8a('0x26')]);return _0x1f0090(_0x4e9350[_0x1e8a('0x24')][_0x1e8a('0x26')]);}else{logger[_0x1e8a('0x27')](_0x1e8a('0x25'),_0x5bcfbd,_0x1e8a('0x20'));_0x1f0090(_0x4e9350['result'][_0x1e8a('0x26')]);}})['catch'](function(_0x4198ec){logger['error'](_0x1e8a('0x25'),_0x5bcfbd,_0x4198ec);_0x3f2c6f(_0x4198ec);});});}function respondWithStatusCode(_0x26988b,_0x429452){_0x429452=_0x429452||0xcc;return function(_0x3e4ab3){if(_0x3e4ab3){return _0x26988b[_0x1e8a('0x28')](_0x429452);}return _0x26988b['status'](_0x429452)[_0x1e8a('0x29')]();};}function respondWithResult(_0x318ddc,_0x148ccc){_0x148ccc=_0x148ccc||0xc8;return function(_0x1f1e3b){if(_0x1f1e3b){return _0x318ddc[_0x1e8a('0x2a')](_0x148ccc)[_0x1e8a('0x2b')](_0x1f1e3b);}};}function respondWithFilteredResult(_0x5d6e3f,_0x116718){return function(_0x5e75c1){if(_0x5e75c1){var _0x23774f=typeof _0x116718[_0x1e8a('0x2c')]===_0x1e8a('0x2d')&&typeof _0x116718['limit']===_0x1e8a('0x2d');var _0xa27e64=_0x5e75c1['count'];var _0x54a11e=_0x23774f?0x0:_0x116718[_0x1e8a('0x2c')];var _0x3bd9a7=_0x23774f?_0x5e75c1[_0x1e8a('0x2e')]:_0x116718[_0x1e8a('0x2c')]+_0x116718['limit'];var _0x3c983e;if(_0x3bd9a7>=_0xa27e64){_0x3bd9a7=_0xa27e64;_0x3c983e=0xc8;}else{_0x3c983e=0xce;}_0x5d6e3f[_0x1e8a('0x2a')](_0x3c983e);return _0x5d6e3f[_0x1e8a('0x2f')]('Content-Range',_0x54a11e+'-'+_0x3bd9a7+'/'+_0xa27e64)['json'](_0x5e75c1);}return null;};}function patchUpdates(_0x477eff){return function(_0x68441e){try{jsonpatch['apply'](_0x68441e,_0x477eff,!![]);}catch(_0x442d61){return BPromise[_0x1e8a('0x30')](_0x442d61);}return _0x68441e['save']();};}function saveUpdates(_0x429a4e,_0x46152b){return function(_0x56af07){if(_0x56af07){return _0x56af07['update'](_0x429a4e)[_0x1e8a('0x1f')](function(_0x3daa1d){return _0x3daa1d;});}return null;};}function removeEntity(_0x365ea7,_0x2224af){return function(_0x683148){if(_0x683148){return _0x683148[_0x1e8a('0x31')]()[_0x1e8a('0x1f')](function(){var _0x3468e5=_0x683148[_0x1e8a('0x32')]({'plain':!![]});var _0x1216bd=_0x1e8a('0x33');return db[_0x1e8a('0x34')][_0x1e8a('0x31')]({'where':{'type':_0x1216bd,'resourceId':_0x3468e5['id']}})['then'](function(){return _0x683148;});})['then'](function(){_0x365ea7['status'](0xcc)[_0x1e8a('0x29')]();});}};}function handleEntityNotFound(_0x469109,_0x369e48){return function(_0x3f9099){if(!_0x3f9099){_0x469109[_0x1e8a('0x28')](0x194);}return _0x3f9099;};}function handleError(_0x50212f,_0x3b76c7){_0x3b76c7=_0x3b76c7||0x1f4;return function(_0x378807){logger[_0x1e8a('0x24')](_0x378807[_0x1e8a('0x35')]);if(_0x378807['name']){delete _0x378807[_0x1e8a('0x36')];}_0x50212f[_0x1e8a('0x2a')](_0x3b76c7)[_0x1e8a('0x37')](_0x378807);};}exports['index']=function(_0x2dcaaf,_0x3d61ae){var _0x5c5d90={'include':[{'model':db[_0x1e8a('0x38')],'as':_0x1e8a('0x39')}]},_0x8c48ee={},_0x16a41b={'count':0x0,'rows':[]};var _0x5e299a=_[_0x1e8a('0x3a')](db[_0x1e8a('0x3b')][_0x1e8a('0x3c')],function(_0x5af2f6){return{'name':_0x5af2f6['fieldName'],'type':_0x5af2f6[_0x1e8a('0x3d')][_0x1e8a('0x3e')]};});_0x8c48ee['model']=_[_0x1e8a('0x3a')](_0x5e299a,_0x1e8a('0x36'));_0x8c48ee['query']=_['keys'](_0x2dcaaf[_0x1e8a('0x3f')]);_0x8c48ee[_0x1e8a('0x40')]=_[_0x1e8a('0x41')](_0x8c48ee[_0x1e8a('0x42')],_0x8c48ee[_0x1e8a('0x3f')]);_0x5c5d90[_0x1e8a('0x43')]=_[_0x1e8a('0x41')](_0x8c48ee[_0x1e8a('0x42')],qs['fields'](_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0x5c5d90[_0x1e8a('0x43')]=_0x5c5d90[_0x1e8a('0x43')][_0x1e8a('0x45')]?_0x5c5d90[_0x1e8a('0x43')]:_0x8c48ee['model'];if(!_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x46')](_0x1e8a('0x47'))){_0x5c5d90[_0x1e8a('0x48')]=qs[_0x1e8a('0x48')](_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x48')]);_0x5c5d90[_0x1e8a('0x2c')]=qs[_0x1e8a('0x2c')](_0x2dcaaf[_0x1e8a('0x3f')]['offset']);}_0x5c5d90[_0x1e8a('0x49')]=qs[_0x1e8a('0x4a')](_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x4a')]);_0x5c5d90[_0x1e8a('0x4b')]=qs[_0x1e8a('0x40')](_[_0x1e8a('0x4c')](_0x2dcaaf[_0x1e8a('0x3f')],_0x8c48ee['filters']),_0x5e299a);if(_0x2dcaaf['query'][_0x1e8a('0x4d')]){_0x5c5d90[_0x1e8a('0x4b')]=_[_0x1e8a('0x4e')](_0x5c5d90[_0x1e8a('0x4b')],{'$or':_['map'](_0x5e299a,function(_0x44a67c){if(_0x44a67c[_0x1e8a('0x3d')]!==_0x1e8a('0x4f')){var _0x42c113={};_0x42c113[_0x44a67c[_0x1e8a('0x36')]]={'$like':'%'+_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x4d')]+'%'};return _0x42c113;}})});}_0x5c5d90=_[_0x1e8a('0x4e')]({},_0x5c5d90,_0x2dcaaf[_0x1e8a('0x50')]);var _0x10acef={'where':_0x5c5d90[_0x1e8a('0x4b')]};return db[_0x1e8a('0x3b')]['count'](_0x10acef)[_0x1e8a('0x1f')](function(_0x3b9b45){_0x16a41b[_0x1e8a('0x2e')]=_0x3b9b45;if(_0x2dcaaf[_0x1e8a('0x3f')][_0x1e8a('0x51')]){_0x5c5d90[_0x1e8a('0x52')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x1e8a('0x53')](_0x5c5d90);})[_0x1e8a('0x1f')](function(_0x24ef7e){_0x16a41b['rows']=_0x24ef7e;return _0x16a41b;})[_0x1e8a('0x1f')](respondWithFilteredResult(_0x3d61ae,_0x5c5d90))['catch'](handleError(_0x3d61ae,null));};exports[_0x1e8a('0x54')]=function(_0x48d894,_0x2e0eb4){var _0xe3c749={'raw':![],'where':{'id':_0x48d894[_0x1e8a('0x55')]['id']},'include':[{'model':db[_0x1e8a('0x38')],'as':'mandatoryDispositionPause'}]},_0x1c67eb={};_0x1c67eb[_0x1e8a('0x42')]=_['keys'](db[_0x1e8a('0x3b')]['rawAttributes']);_0x1c67eb['query']=_[_0x1e8a('0x56')](_0x48d894[_0x1e8a('0x3f')]);_0x1c67eb[_0x1e8a('0x40')]=_[_0x1e8a('0x41')](_0x1c67eb[_0x1e8a('0x42')],_0x1c67eb[_0x1e8a('0x3f')]);_0xe3c749[_0x1e8a('0x43')]=_[_0x1e8a('0x41')](_0x1c67eb['model'],qs[_0x1e8a('0x44')](_0x48d894[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0xe3c749[_0x1e8a('0x43')]=_0xe3c749[_0x1e8a('0x43')][_0x1e8a('0x45')]?_0xe3c749[_0x1e8a('0x43')]:_0x1c67eb['model'];if(_0x48d894['query']['includeAll']){_0xe3c749[_0x1e8a('0x52')]=[{'all':!![]}];}_0xe3c749=_[_0x1e8a('0x4e')]({},_0xe3c749,_0x48d894[_0x1e8a('0x50')]);return db['WhatsappAccount']['find'](_0xe3c749)['then'](handleEntityNotFound(_0x2e0eb4,null))['then'](respondWithResult(_0x2e0eb4,null))['catch'](handleError(_0x2e0eb4,null));};exports[_0x1e8a('0x57')]=function(_0x775b8c,_0x33bc71){return db[_0x1e8a('0x3b')][_0x1e8a('0x57')](_0x775b8c[_0x1e8a('0x58')],{})[_0x1e8a('0x1f')](function(_0x5454b5){var _0xcf7210=_0x775b8c[_0x1e8a('0x59')][_0x1e8a('0x32')]({'plain':!![]});if(!_0xcf7210)throw new Error(_0x1e8a('0x5a'));if(_0xcf7210[_0x1e8a('0x5b')]===_0x1e8a('0x59')){var _0x1344dd=_0x5454b5[_0x1e8a('0x32')]({'plain':!![]});var _0xa6809f=_0x1e8a('0x33');return db[_0x1e8a('0x5c')][_0x1e8a('0x5d')]({'where':{'name':_0xa6809f,'userProfileId':_0xcf7210[_0x1e8a('0x5e')]},'raw':!![]})[_0x1e8a('0x1f')](function(_0x1ef3b4){if(_0x1ef3b4&&_0x1ef3b4[_0x1e8a('0x5f')]===0x0){return db[_0x1e8a('0x34')][_0x1e8a('0x57')]({'name':_0x1344dd[_0x1e8a('0x36')],'resourceId':_0x1344dd['id'],'type':_0x1ef3b4[_0x1e8a('0x36')],'sectionId':_0x1ef3b4['id']},{})[_0x1e8a('0x1f')](function(){return _0x5454b5;});}else{return _0x5454b5;}})[_0x1e8a('0x60')](function(_0x29f028){logger[_0x1e8a('0x24')](_0x1e8a('0x61'),_0x29f028);throw _0x29f028;});}return _0x5454b5;})[_0x1e8a('0x1f')](respondWithResult(_0x33bc71,0xc9))[_0x1e8a('0x60')](handleError(_0x33bc71,null));};exports['update']=function(_0x526be8,_0x2b15b3){if(_0x526be8['body']['id']){delete _0x526be8[_0x1e8a('0x58')]['id'];}return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x526be8[_0x1e8a('0x55')]['id']},'include':[{'model':db[_0x1e8a('0x38')],'as':'mandatoryDispositionPause'}]})[_0x1e8a('0x1f')](handleEntityNotFound(_0x2b15b3,null))[_0x1e8a('0x1f')](saveUpdates(_0x526be8[_0x1e8a('0x58')],null))[_0x1e8a('0x1f')](respondWithResult(_0x2b15b3,null))[_0x1e8a('0x60')](handleError(_0x2b15b3,null));};exports[_0x1e8a('0x31')]=function(_0x399be8,_0x5ad627){return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x399be8[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x5ad627,null))['then'](removeEntity(_0x5ad627,null))[_0x1e8a('0x60')](handleError(_0x5ad627,null));};exports[_0x1e8a('0x62')]=function(_0x31be90,_0x407cd4){return db[_0x1e8a('0x3b')][_0x1e8a('0x62')]()['then'](respondWithResult(_0x407cd4,null))[_0x1e8a('0x60')](handleError(_0x407cd4,null));};exports['addDisposition']=function(_0x1fa7a9,_0x4d0212,_0x5874c0){if(_0x1fa7a9[_0x1e8a('0x58')]['id']){delete _0x1fa7a9[_0x1e8a('0x58')]['id'];}return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x1fa7a9[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x4d0212,null))[_0x1e8a('0x1f')](function(_0xa99a3a){if(_0xa99a3a){_0x1fa7a9[_0x1e8a('0x58')][_0x1e8a('0x63')]=_0xa99a3a['id'];return db[_0x1e8a('0x64')]['create'](_0x1fa7a9[_0x1e8a('0x58')]);}})[_0x1e8a('0x1f')](respondWithResult(_0x4d0212,null))[_0x1e8a('0x60')](handleError(_0x4d0212,null));};exports[_0x1e8a('0x65')]=function(_0x505459,_0x250b45,_0x3ad266){var _0x4d9b10={'raw':![],'where':{}};var _0x17da20={};var _0x65af7e={'count':0x0,'rows':[]};return db[_0x1e8a('0x3b')][_0x1e8a('0x66')]({'where':{'id':_0x505459[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x250b45,null))[_0x1e8a('0x1f')](function(_0x37cf46){if(_0x37cf46){_0x17da20[_0x1e8a('0x42')]=_['keys'](db[_0x1e8a('0x64')][_0x1e8a('0x3c')]);_0x17da20[_0x1e8a('0x3f')]=_[_0x1e8a('0x56')](_0x505459[_0x1e8a('0x3f')]);_0x17da20['filters']=_[_0x1e8a('0x41')](_0x17da20[_0x1e8a('0x42')],_0x17da20[_0x1e8a('0x3f')]);_0x4d9b10[_0x1e8a('0x43')]=_[_0x1e8a('0x41')](_0x17da20['model'],qs[_0x1e8a('0x44')](_0x505459[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0x4d9b10[_0x1e8a('0x43')]=_0x4d9b10['attributes'][_0x1e8a('0x45')]?_0x4d9b10[_0x1e8a('0x43')]:_0x17da20[_0x1e8a('0x42')];if(!_0x505459[_0x1e8a('0x3f')][_0x1e8a('0x46')](_0x1e8a('0x47'))){_0x4d9b10['limit']=qs[_0x1e8a('0x48')](_0x505459[_0x1e8a('0x3f')][_0x1e8a('0x48')]);_0x4d9b10[_0x1e8a('0x2c')]=qs['offset'](_0x505459[_0x1e8a('0x3f')]['offset']);}_0x4d9b10[_0x1e8a('0x49')]=qs[_0x1e8a('0x4a')](_0x505459[_0x1e8a('0x3f')][_0x1e8a('0x4a')]);_0x4d9b10[_0x1e8a('0x4b')]=qs['filters'](_[_0x1e8a('0x4c')](_0x505459[_0x1e8a('0x3f')],_0x17da20['filters']));_0x4d9b10[_0x1e8a('0x4b')][_0x1e8a('0x63')]=_0x37cf46['id'];if(_0x505459['query'][_0x1e8a('0x4d')]){_0x4d9b10[_0x1e8a('0x4b')]=_[_0x1e8a('0x4e')](_0x4d9b10[_0x1e8a('0x4b')],{'$or':_['map'](_0x4d9b10[_0x1e8a('0x43')],function(_0x595fb0){var _0x366706={};_0x366706[_0x595fb0]={'$like':'%'+_0x505459[_0x1e8a('0x3f')][_0x1e8a('0x4d')]+'%'};return _0x366706;})});}_0x4d9b10=_[_0x1e8a('0x4e')]({},_0x4d9b10,_0x505459['options']);return db[_0x1e8a('0x64')]['count']({'where':_0x4d9b10['where']})[_0x1e8a('0x1f')](function(_0x5d44b8){_0x65af7e[_0x1e8a('0x2e')]=_0x5d44b8;if(_0x505459[_0x1e8a('0x3f')]['includeAll']){_0x4d9b10[_0x1e8a('0x52')]=[{'all':!![]}];}return db[_0x1e8a('0x64')][_0x1e8a('0x53')](_0x4d9b10);})['then'](function(_0x597086){_0x65af7e[_0x1e8a('0x67')]=_0x597086;return _0x65af7e;});}})[_0x1e8a('0x1f')](respondWithFilteredResult(_0x250b45,_0x4d9b10))[_0x1e8a('0x60')](handleError(_0x250b45,null));};exports[_0x1e8a('0x68')]=function(_0x2f97a2,_0x2e14b1,_0x1da90a){return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x2f97a2['params']['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x2e14b1,null))[_0x1e8a('0x1f')](function(_0x1e2b9b){if(_0x1e2b9b){return _0x1e2b9b[_0x1e8a('0x68')](_0x2f97a2[_0x1e8a('0x3f')][_0x1e8a('0x69')]);}})[_0x1e8a('0x1f')](respondWithStatusCode(_0x2e14b1,null))[_0x1e8a('0x60')](handleError(_0x2e14b1,null));};exports[_0x1e8a('0x6a')]=function(_0x437946,_0x10d423,_0x576e74){if(_0x437946['body']['id']){delete _0x437946['body']['id'];}return db['WhatsappAccount'][_0x1e8a('0x5d')]({'where':{'id':_0x437946[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x10d423,null))[_0x1e8a('0x1f')](function(_0x2583ba){if(_0x2583ba){_0x437946[_0x1e8a('0x58')][_0x1e8a('0x63')]=_0x2583ba['id'];return db[_0x1e8a('0x6b')][_0x1e8a('0x57')](_0x437946[_0x1e8a('0x58')]);}})['then'](respondWithResult(_0x10d423,null))[_0x1e8a('0x60')](handleError(_0x10d423,null));};exports[_0x1e8a('0x6c')]=function(_0x39765c,_0x8f752f,_0x5e5d66){var _0x1fcd10={'raw':![],'where':{}};var _0x2daa18={};var _0x3ac158={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x1e8a('0x66')]({'where':{'id':_0x39765c['params']['id']}})['then'](handleEntityNotFound(_0x8f752f,null))['then'](function(_0x1c2c20){if(_0x1c2c20){_0x2daa18[_0x1e8a('0x42')]=_['keys'](db[_0x1e8a('0x6b')][_0x1e8a('0x3c')]);_0x2daa18['query']=_[_0x1e8a('0x56')](_0x39765c[_0x1e8a('0x3f')]);_0x2daa18['filters']=_['intersection'](_0x2daa18[_0x1e8a('0x42')],_0x2daa18[_0x1e8a('0x3f')]);_0x1fcd10[_0x1e8a('0x43')]=_[_0x1e8a('0x41')](_0x2daa18[_0x1e8a('0x42')],qs[_0x1e8a('0x44')](_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0x1fcd10[_0x1e8a('0x43')]=_0x1fcd10[_0x1e8a('0x43')][_0x1e8a('0x45')]?_0x1fcd10[_0x1e8a('0x43')]:_0x2daa18['model'];if(!_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x46')](_0x1e8a('0x47'))){_0x1fcd10[_0x1e8a('0x48')]=qs[_0x1e8a('0x48')](_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x48')]);_0x1fcd10[_0x1e8a('0x2c')]=qs[_0x1e8a('0x2c')](_0x39765c['query'][_0x1e8a('0x2c')]);}_0x1fcd10['order']=qs[_0x1e8a('0x4a')](_0x39765c[_0x1e8a('0x3f')]['sort']);_0x1fcd10[_0x1e8a('0x4b')]=qs[_0x1e8a('0x40')](_[_0x1e8a('0x4c')](_0x39765c['query'],_0x2daa18[_0x1e8a('0x40')]));_0x1fcd10[_0x1e8a('0x4b')][_0x1e8a('0x63')]=_0x1c2c20['id'];if(_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x4d')]){_0x1fcd10[_0x1e8a('0x4b')]=_[_0x1e8a('0x4e')](_0x1fcd10[_0x1e8a('0x4b')],{'$or':_[_0x1e8a('0x3a')](_0x1fcd10[_0x1e8a('0x43')],function(_0x4c7731){var _0x5a4fc6={};_0x5a4fc6[_0x4c7731]={'$like':'%'+_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x4d')]+'%'};return _0x5a4fc6;})});}_0x1fcd10=_[_0x1e8a('0x4e')]({},_0x1fcd10,_0x39765c[_0x1e8a('0x50')]);return db[_0x1e8a('0x6b')][_0x1e8a('0x2e')]({'where':_0x1fcd10['where']})[_0x1e8a('0x1f')](function(_0x470475){_0x3ac158['count']=_0x470475;if(_0x39765c[_0x1e8a('0x3f')][_0x1e8a('0x51')]){_0x1fcd10[_0x1e8a('0x52')]=[{'all':!![]}];}return db[_0x1e8a('0x6b')][_0x1e8a('0x53')](_0x1fcd10);})['then'](function(_0x43889f){_0x3ac158['rows']=_0x43889f;return _0x3ac158;});}})[_0x1e8a('0x1f')](respondWithFilteredResult(_0x8f752f,_0x1fcd10))[_0x1e8a('0x60')](handleError(_0x8f752f,null));};exports['removeAnswers']=function(_0x3f379a,_0x23221e,_0x39bc50){return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x3f379a[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x23221e,null))[_0x1e8a('0x1f')](function(_0x4da035){if(_0x4da035){return _0x4da035[_0x1e8a('0x6d')](_0x3f379a[_0x1e8a('0x3f')][_0x1e8a('0x69')]);}})[_0x1e8a('0x1f')](respondWithStatusCode(_0x23221e,null))[_0x1e8a('0x60')](handleError(_0x23221e,null));};exports[_0x1e8a('0x6e')]=function(_0x3debcb,_0x268fb5,_0x1fa561){return db['WhatsappAccount'][_0x1e8a('0x5d')]({'where':{'id':_0x3debcb[_0x1e8a('0x55')]['id']}})['then'](handleEntityNotFound(_0x268fb5,null))[_0x1e8a('0x1f')](function(_0x41aab6){if(_0x41aab6){return _0x41aab6['addAgents'](_0x3debcb[_0x1e8a('0x58')][_0x1e8a('0x69')],_[_0x1e8a('0x6f')](_0x3debcb[_0x1e8a('0x58')],[_0x1e8a('0x69'),'id'])||{})[_0x1e8a('0x70')](function(_0x521e0b){for(var _0x15ba49=0x0;_0x15ba49<_0x3debcb[_0x1e8a('0x58')]['ids']['length'];_0x15ba49+=0x1){socket[_0x1e8a('0x71')](_0x1e8a('0x72'),{'UserId':Number(_0x3debcb[_0x1e8a('0x58')][_0x1e8a('0x69')][_0x15ba49]),'WhatsappAccountId':Number(_0x3debcb['params']['id'])});}return _0x521e0b;});}})[_0x1e8a('0x1f')](respondWithResult(_0x268fb5,null))[_0x1e8a('0x60')](handleError(_0x268fb5,null));};exports[_0x1e8a('0x73')]=function(_0x310707,_0x283f36,_0x1fa988){return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x310707[_0x1e8a('0x55')]['id']}})['then'](handleEntityNotFound(_0x283f36,null))[_0x1e8a('0x1f')](function(_0xd8c9c1){if(_0xd8c9c1){return _0xd8c9c1[_0x1e8a('0x73')](_0x310707[_0x1e8a('0x3f')]['ids'])[_0x1e8a('0x1f')](function(){if(_[_0x1e8a('0x74')](_0x310707['query'][_0x1e8a('0x69')])){for(var _0x179b4c=0x0;_0x179b4c<_0x310707[_0x1e8a('0x3f')]['ids'][_0x1e8a('0x45')];_0x179b4c+=0x1){socket[_0x1e8a('0x71')](_0x1e8a('0x75'),{'UserId':Number(_0x310707[_0x1e8a('0x3f')][_0x1e8a('0x69')][_0x179b4c]),'WhatsappAccountId':Number(_0x310707[_0x1e8a('0x55')]['id'])});}}else{socket[_0x1e8a('0x71')](_0x1e8a('0x75'),{'UserId':Number(_0x310707[_0x1e8a('0x3f')][_0x1e8a('0x69')]),'WhatsappAccountId':Number(_0x310707['params']['id'])});}});}})[_0x1e8a('0x1f')](respondWithStatusCode(_0x283f36,null))[_0x1e8a('0x60')](handleError(_0x283f36,null));};exports[_0x1e8a('0x76')]=function(_0x1259bc,_0x56de42,_0xd7e2b1){var _0x518c5a={};var _0x35682b={};var _0x1cba9d;var _0x22a345;return db[_0x1e8a('0x3b')]['findOne']({'where':{'id':_0x1259bc[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x56de42,null))['then'](function(_0x8ce8a0){if(_0x8ce8a0){_0x1cba9d=_0x8ce8a0;_0x35682b[_0x1e8a('0x42')]=_[_0x1e8a('0x56')](db[_0x1e8a('0x77')][_0x1e8a('0x3c')]);_0x35682b['query']=_[_0x1e8a('0x56')](_0x1259bc[_0x1e8a('0x3f')]);_0x35682b[_0x1e8a('0x40')]=_['intersection'](_0x35682b[_0x1e8a('0x42')],_0x35682b['query']);_0x518c5a['attributes']=_[_0x1e8a('0x41')](_0x35682b[_0x1e8a('0x42')],qs[_0x1e8a('0x44')](_0x1259bc[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0x518c5a[_0x1e8a('0x43')]=_0x518c5a['attributes'][_0x1e8a('0x45')]?_0x518c5a[_0x1e8a('0x43')]:_0x35682b[_0x1e8a('0x42')];_0x518c5a[_0x1e8a('0x49')]=qs['sort'](_0x1259bc[_0x1e8a('0x3f')][_0x1e8a('0x4a')]);_0x518c5a['where']=qs['filters'](_[_0x1e8a('0x4c')](_0x1259bc[_0x1e8a('0x3f')],_0x35682b[_0x1e8a('0x40')]));if(_0x1259bc[_0x1e8a('0x3f')][_0x1e8a('0x4d')]){_0x518c5a[_0x1e8a('0x4b')]=_[_0x1e8a('0x4e')](_0x518c5a[_0x1e8a('0x4b')],{'$or':_[_0x1e8a('0x3a')](_0x518c5a[_0x1e8a('0x43')],function(_0x15dcd){var _0x2e3711={};_0x2e3711[_0x15dcd]={'$like':'%'+_0x1259bc['query']['filter']+'%'};return _0x2e3711;})});}_0x518c5a=_[_0x1e8a('0x4e')]({},_0x518c5a,_0x1259bc[_0x1e8a('0x50')]);return _0x1cba9d[_0x1e8a('0x76')](_0x518c5a);}})[_0x1e8a('0x1f')](function(_0x4fb29b){if(_0x4fb29b){_0x22a345=_0x4fb29b[_0x1e8a('0x45')];if(!_0x1259bc[_0x1e8a('0x3f')][_0x1e8a('0x46')](_0x1e8a('0x47'))){_0x518c5a['limit']=qs[_0x1e8a('0x48')](_0x1259bc[_0x1e8a('0x3f')][_0x1e8a('0x48')]);_0x518c5a[_0x1e8a('0x2c')]=qs[_0x1e8a('0x2c')](_0x1259bc['query'][_0x1e8a('0x2c')]);}return _0x1cba9d['getAgents'](_0x518c5a);}})[_0x1e8a('0x1f')](function(_0x3d79d6){if(_0x3d79d6){return _0x3d79d6?{'count':_0x22a345,'rows':_0x3d79d6}:null;}})[_0x1e8a('0x1f')](respondWithResult(_0x56de42,null))[_0x1e8a('0x60')](handleError(_0x56de42,null));};exports[_0x1e8a('0x78')]=function(_0x19b453,_0x246cd5,_0x1ce178){return db['WhatsappAccount'][_0x1e8a('0x66')]({'where':{'id':_0x19b453['params']['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x246cd5,null))[_0x1e8a('0x1f')](function(_0x4499a1){if(_0x4499a1){return db['sequelize'][_0x1e8a('0x79')](function(_0x2f9e1e){return db[_0x1e8a('0x7a')][_0x1e8a('0x31')]({'where':{'WhatsappAccountId':_0x19b453[_0x1e8a('0x55')]['id']},'transaction':_0x2f9e1e})['then'](function(_0x1aaaac){var _0x2c733a=_[_0x1e8a('0x3a')](_0x19b453[_0x1e8a('0x58')],function(_0xb7cb90){_0xb7cb90[_0x1e8a('0x63')]=_0x19b453[_0x1e8a('0x55')]['id'];return _0xb7cb90;});return db[_0x1e8a('0x7a')][_0x1e8a('0x7b')](_0x2c733a,{'transaction':_0x2f9e1e});});})[_0x1e8a('0x1f')](function(){return db[_0x1e8a('0x7a')][_0x1e8a('0x7c')]({'where':{'WhatsappAccountId':_0x19b453[_0x1e8a('0x55')]['id']},'order':_0x1e8a('0x7d')});});}})[_0x1e8a('0x1f')](respondWithResult(_0x246cd5,null))[_0x1e8a('0x60')](handleError(_0x246cd5,null));};exports['getApplications']=function(_0x25a891,_0x3492ad,_0x3c4af5){var _0xdfa814={};var _0x1bbe57={};var _0x208994;var _0x31e234;return db[_0x1e8a('0x3b')][_0x1e8a('0x66')]({'where':{'id':_0x25a891[_0x1e8a('0x55')]['id']}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x3492ad,null))['then'](function(_0x24b03b){if(_0x24b03b){_0x208994=_0x24b03b;_0x1bbe57[_0x1e8a('0x42')]=_[_0x1e8a('0x56')](db['WhatsappApplication'][_0x1e8a('0x3c')]);_0x1bbe57[_0x1e8a('0x3f')]=_['keys'](_0x25a891[_0x1e8a('0x3f')]);_0x1bbe57['filters']=_[_0x1e8a('0x41')](_0x1bbe57[_0x1e8a('0x42')],_0x1bbe57[_0x1e8a('0x3f')]);_0xdfa814['attributes']=_[_0x1e8a('0x41')](_0x1bbe57[_0x1e8a('0x42')],qs[_0x1e8a('0x44')](_0x25a891[_0x1e8a('0x3f')][_0x1e8a('0x44')]));_0xdfa814[_0x1e8a('0x43')]=_0xdfa814[_0x1e8a('0x43')][_0x1e8a('0x45')]?_0xdfa814[_0x1e8a('0x43')]:_0x1bbe57[_0x1e8a('0x42')];_0xdfa814['order']=qs[_0x1e8a('0x4a')](_0x25a891['query'][_0x1e8a('0x4a')]);_0xdfa814[_0x1e8a('0x4b')]=qs[_0x1e8a('0x40')](_['pick'](_0x25a891[_0x1e8a('0x3f')],_0x1bbe57[_0x1e8a('0x40')]));if(_0x25a891['query'][_0x1e8a('0x4d')]){_0xdfa814[_0x1e8a('0x4b')]=_[_0x1e8a('0x4e')](_0xdfa814['where'],{'$or':_[_0x1e8a('0x3a')](_0xdfa814[_0x1e8a('0x43')],function(_0x32a80c){var _0x5a3321={};_0x5a3321[_0x32a80c]={'$like':'%'+_0x25a891[_0x1e8a('0x3f')][_0x1e8a('0x4d')]+'%'};return _0x5a3321;})});}_0xdfa814=_[_0x1e8a('0x4e')]({},_0xdfa814,_0x25a891[_0x1e8a('0x50')]);return _0x208994['getApplications'](_0xdfa814);}})[_0x1e8a('0x1f')](function(_0x481e0d){if(_0x481e0d){_0x31e234=_0x481e0d[_0x1e8a('0x45')];if(!_0x25a891[_0x1e8a('0x3f')][_0x1e8a('0x46')](_0x1e8a('0x47'))){_0xdfa814[_0x1e8a('0x48')]=qs[_0x1e8a('0x48')](_0x25a891['query'][_0x1e8a('0x48')]);_0xdfa814['offset']=qs['offset'](_0x25a891['query']['offset']);}return _0x208994[_0x1e8a('0x7e')](_0xdfa814);}})[_0x1e8a('0x1f')](function(_0x2beefb){if(_0x2beefb){return _0x2beefb?{'count':_0x31e234,'rows':_0x2beefb}:null;}})['then'](respondWithResult(_0x3492ad,null))[_0x1e8a('0x60')](handleError(_0x3492ad,null));};exports['notify']=function(_0x5f1579,_0x35ee86,_0x49aa6e){var _0x58a8b4={'channel':_0x1e8a('0x7f')};var _0x58b71b=[];var _0x1b53fa=[];var _0x1b7a90={};return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x5f1579[_0x1e8a('0x55')]['id']},'include':[{'model':db[_0x1e8a('0x7a')],'as':_0x1e8a('0x80')}]})[_0x1e8a('0x1f')](handleEntityNotFound(_0x35ee86,null))[_0x1e8a('0x1f')](function(_0x5b55b1){_0x58a8b4[_0x1e8a('0x81')]=_0x5b55b1;_0x58a8b4[_0x1e8a('0x82')]=_['orderBy'](_0x5b55b1['Applications'],[_0x1e8a('0x7d')],[_0x1e8a('0x83')]);if(_0x58a8b4[_0x1e8a('0x81')][_0x1e8a('0x80')]){delete _0x58a8b4[_0x1e8a('0x81')]['Applications'];}return db[_0x1e8a('0x84')][_0x1e8a('0x62')]();})[_0x1e8a('0x1f')](function(_0x15a2d6){if(!_0x15a2d6){throw new db[(_0x1e8a('0x85'))][(_0x1e8a('0x86'))]('no\x20available\x20attributes');}_0x58b71b=_['difference'](_[_0x1e8a('0x56')](_0x15a2d6),['createdAt','updatedAt']);_0x1b53fa=_['difference'](_['keys'](_0x15a2d6),['createdAt',_0x1e8a('0x87'),_0x1e8a('0x88'),_0x1e8a('0x89')]);_0x58a8b4['body']={'mapKey':_0x1e8a('0x8a')};if(_0x58a8b4[_0x1e8a('0x81')][_0x1e8a('0x3d')]&&_0x58a8b4[_0x1e8a('0x81')][_0x1e8a('0x3d')]===_0x1e8a('0x8b')){_0x58a8b4['body'][_0x1e8a('0x8c')]=_0x5f1579[_0x1e8a('0x58')]['From']['replace'](_0x1e8a('0x8d'),'');_0x58a8b4['body'][_0x1e8a('0x58')]=_0x5f1579['body'][_0x1e8a('0x8e')];_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x8f')]=_0x5f1579[_0x1e8a('0x58')][_0x1e8a('0x90')];}if(_0x58a8b4[_0x1e8a('0x58')]['id']){delete _0x58a8b4[_0x1e8a('0x58')]['id'];}if(_[_0x1e8a('0x91')](_0x58a8b4[_0x1e8a('0x58')]['from'])){throw new db[(_0x1e8a('0x85'))][(_0x1e8a('0x86'))](_0x1e8a('0x92'));}if(_[_0x1e8a('0x91')](_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x58')])||_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x58')]===''){throw new db[(_0x1e8a('0x85'))][(_0x1e8a('0x86'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1e8a('0x91')](_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x93')])){throw new db[(_0x1e8a('0x85'))]['ValidationError'](_0x1e8a('0x94')+_0x1b53fa);}if(!_[_0x1e8a('0x95')](_0x1b53fa,_0x58a8b4['body'][_0x1e8a('0x93')])){throw new db[(_0x1e8a('0x85'))][(_0x1e8a('0x86'))](_0x1e8a('0x96')+_0x1b53fa);}_0x1b7a90[_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x93')]]=_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x8c')];return db[_0x1e8a('0x97')][_0x1e8a('0x5d')]({'where':{'id':_0x58a8b4['account']['ListId']},'include':[{'model':db[_0x1e8a('0x84')],'as':_0x1e8a('0x98'),'where':_0x1b7a90,'limit':0x1,'order':[[_0x1e8a('0x87'),_0x1e8a('0x99')]]}]});})[_0x1e8a('0x1f')](handleEntityNotFound(_0x35ee86,null))[_0x1e8a('0x1f')](function(_0x3262b5){if(_0x3262b5){_0x58a8b4[_0x1e8a('0x9a')]=_[_0x1e8a('0x6f')](_0x3262b5,[_0x1e8a('0x98')]);if(_0x3262b5[_0x1e8a('0x98')][_0x1e8a('0x45')]){return _0x3262b5[_0x1e8a('0x98')][0x0];}var _0x3b9e59=_[_0x1e8a('0x18')](_0x58a8b4[_0x1e8a('0x58')],{'firstName':_0x58a8b4[_0x1e8a('0x58')]['from'],'ListId':_0x3262b5['id']});_0x3b9e59[_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x93')]]=_0x58a8b4['body'][_0x1e8a('0x8c')];return db[_0x1e8a('0x84')]['create'](_0x3b9e59,{'fields':_0x58b71b,'raw':!![]});}})['then'](handleEntityNotFound(_0x35ee86,null))[_0x1e8a('0x1f')](function(_0x2706ed){if(_0x2706ed){_0x58a8b4[_0x1e8a('0x9b')]=_0x2706ed;var _0x24ba83={'ContactId':_0x2706ed['id'],'phone':_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x8c')],'WhatsappAccountId':_0x5f1579[_0x1e8a('0x55')]['id']};var _0x400c8e={'ContactId':_0x2706ed['id'],'WhatsappAccountId':_0x5f1579[_0x1e8a('0x55')]['id'],'closed':![]};return db[_0x1e8a('0x9c')][_0x1e8a('0x5d')]({'where':_0x400c8e})['then'](function(_0x26177c){if(_0x26177c){return[_0x26177c,![]];}return db[_0x1e8a('0x9c')][_0x1e8a('0x57')](_0x24ba83)[_0x1e8a('0x1f')](function(_0x344ce0){return[_0x344ce0,!![]];});});}})[_0x1e8a('0x70')](function(_0x47d05b,_0x2059a4){_0x58a8b4[_0x1e8a('0x9d')]=_0x47d05b['get']({'plain':!![]});_0x58a8b4[_0x1e8a('0x9d')][_0x1e8a('0x9e')]=![];if(_0x2059a4){if(_0x58a8b4[_0x1e8a('0x81')]['autoclose']){_0x58a8b4[_0x1e8a('0x82')]['push']({'id':0x0,'priority':_0x58a8b4[_0x1e8a('0x82')][_0x1e8a('0x45')]+0x1,'app':_0x1e8a('0x9f'),'appdata':_0x1e8a('0xa0'),'interval':'*,*,*,*'});}_0x58a8b4[_0x1e8a('0x9d')]['created']=!![];}return db[_0x1e8a('0xa1')][_0x1e8a('0x57')]({'phone':_0x58a8b4['body'][_0x1e8a('0x8c')],'messageId':_0x58a8b4['body'][_0x1e8a('0x8f')],'body':_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0x58')],'WhatsappAccountId':_0x5f1579['params']['id'],'WhatsappInteractionId':_0x47d05b['id'],'direction':'in','ContactId':_0x47d05b['ContactId'],'AttachmentId':_0x58a8b4[_0x1e8a('0x58')][_0x1e8a('0xa2')]});})[_0x1e8a('0x1f')](function(_0x470433){_0x58a8b4[_0x1e8a('0x26')]=_0x470433;if(_0x58a8b4[_0x1e8a('0x9d')][_0x1e8a('0xa3')]){return db[_0x1e8a('0x77')][_0x1e8a('0x5d')]({'attributes':['id',_0x1e8a('0x36')],'where':{'id':_0x58a8b4[_0x1e8a('0x9d')][_0x1e8a('0xa3')]}})[_0x1e8a('0x1f')](function(_0x184911){if(_0x184911){_0x58a8b4[_0x1e8a('0x82')][_0x1e8a('0xa4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x184911[_0x1e8a('0x36')]+','+(_0x58a8b4[_0x1e8a('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0x1e8a('0xa5')});}return respondWithRpcPromise('Start',_0x1e8a('0xa6'),_0x58a8b4);});}return respondWithRpcPromise(_0x1e8a('0xa7'),_0x1e8a('0xa6'),_0x58a8b4);})[_0x1e8a('0x1f')](function(_0xc5e650){if(_0xc5e650){var _0x3245e9=0xc8;var _0x872411=_0x1e8a('0xa8');logger[_0x1e8a('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x872411,_0x3245e9,'entity\x20found');logger[_0x1e8a('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x872411,_0x3245e9,'entity\x20found',JSON[_0x1e8a('0x23')](_0xc5e650));if(_0x58a8b4[_0x1e8a('0x81')][_0x1e8a('0x3d')]===_0x1e8a('0x8b')){return _0x35ee86[_0x1e8a('0x2a')](_0x3245e9)[_0x1e8a('0x2f')](_0x1e8a('0xa9'),_0x1e8a('0xaa'))['send'](_0x1e8a('0xab'));}else{return _0x35ee86[_0x1e8a('0x2a')](_0x3245e9)[_0x1e8a('0x2b')](_0xc5e650);}}})[_0x1e8a('0x60')](handleError(_0x35ee86,null));};exports['send']=function(_0x441bd2,_0x76a6f1,_0x18c254){var _0x5526df,_0x3b218b,_0x57e37a;if(_[_0x1e8a('0x91')](_0x441bd2[_0x1e8a('0x58')][_0x1e8a('0x58')])||_0x441bd2[_0x1e8a('0x58')][_0x1e8a('0x58')]===''){throw new db[(_0x1e8a('0x85'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1e8a('0x91')](_0x441bd2[_0x1e8a('0x58')]['to'])){throw new db[(_0x1e8a('0x85'))][(_0x1e8a('0x86'))]('to\x20is\x20mandatory');}_0x5526df=_0x441bd2[_0x1e8a('0x58')]['to'];return db[_0x1e8a('0x3b')][_0x1e8a('0x5d')]({'where':{'id':_0x441bd2['params']['id']},'include':[{'model':db[_0x1e8a('0x97')],'as':'List','include':[{'model':db[_0x1e8a('0x84')],'as':_0x1e8a('0x98'),'where':{'mobile':_0x5526df},'limit':0x1,'order':[[_0x1e8a('0x87'),_0x1e8a('0x99')]]}]}]})[_0x1e8a('0x1f')](handleEntityNotFound(_0x76a6f1,null))[_0x1e8a('0x1f')](function(_0x5ace41){if(_0x5ace41&&_0x5ace41[_0x1e8a('0xac')]){_0x3b218b=_0x5ace41[_0x1e8a('0x32')]({'plain':!![]});if(_0x3b218b['List']&&_0x3b218b[_0x1e8a('0xac')]['Contacts'][_0x1e8a('0x45')]){return _0x3b218b['List'][_0x1e8a('0x98')][0x0];}return db[_0x1e8a('0x84')][_0x1e8a('0x57')](_[_0x1e8a('0x18')](_0x441bd2[_0x1e8a('0x58')],{'firstName':_0x5526df,'mobile':_0x5526df,'phone':_0x5526df,'ListId':_0x3b218b[_0x1e8a('0x89')]}));}})[_0x1e8a('0x1f')](handleEntityNotFound(_0x76a6f1,null))[_0x1e8a('0x1f')](function(_0x3b3d73){if(_0x3b3d73){_0x57e37a=_0x3b3d73;return db[_0x1e8a('0x9c')][_0x1e8a('0x5d')]({'where':{'ContactId':_0x57e37a['id'],'closed':![],'WhatsappAccountId':_0x3b218b['id']}})[_0x1e8a('0x1f')](function(_0x8df857){if(_0x8df857){return[_0x8df857,![]];}return db[_0x1e8a('0x9c')]['create']({'UserId':_0x441bd2[_0x1e8a('0x59')]['id'],'ContactId':_0x57e37a['id'],'WhatsappAccountId':_0x3b218b['id'],'phone':_0x5526df,'firstMsgDirection':_0x1e8a('0xad'),'Messages':[_[_0x1e8a('0x4e')](_0x441bd2[_0x1e8a('0x58')],{'read':![],'body':_0x441bd2[_0x1e8a('0x58')]['body'],'phone':_0x5526df,'WhatsappAccountId':_0x3b218b['id'],'UserId':_0x441bd2[_0x1e8a('0x59')]['id'],'ContactId':_0x57e37a['id']})]},{'include':[{'model':db[_0x1e8a('0xa1')],'as':'Messages'}]})[_0x1e8a('0x1f')](function(_0xf56448){return[_0xf56448,!![]];});});}})[_0x1e8a('0x70')](function(_0x1e047c,_0x3f68af){if(_0x3f68af){return _0x1e047c;}return db[_0x1e8a('0xa1')][_0x1e8a('0x57')](_['merge'](_0x441bd2[_0x1e8a('0x58')],{'read':![],'body':_0x441bd2[_0x1e8a('0x58')][_0x1e8a('0x58')],'phone':_0x5526df,'WhatsappAccountId':_0x3b218b['id'],'WhatsappInteractionId':_0x1e047c['id'],'UserId':_0x441bd2[_0x1e8a('0x59')]['id'],'ContactId':_0x57e37a['id']}))[_0x1e8a('0x1f')](function(_0xd4b342){_0x1e047c[_0x1e8a('0xae')][_0x1e8a('0xaf')]=[];_0x1e047c[_0x1e8a('0xae')][_0x1e8a('0xaf')]['push'](_0xd4b342[_0x1e8a('0xae')]);return _0x1e047c;});})['then'](respondWithResult(_0x76a6f1,null))[_0x1e8a('0x60')](handleError(_0x76a6f1,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index cfc2958..f1aa9b3 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 _0x67d2=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0x67d2,0x121));var _0x267d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x67d2[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x267d('0x0'));var WhatsappAccount=require(_0x267d('0x1'))['db'][_0x267d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x267d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x267d('0x4'),'afterDestroy':_0x267d('0x5')};function emitEvent(_0x3a9aae){return function(_0x2c1959,_0x4474b3,_0x4c3c0b){WhatsappAccountEvents[_0x267d('0x6')](_0x3a9aae+':'+_0x2c1959['id'],_0x2c1959);WhatsappAccountEvents[_0x267d('0x6')](_0x3a9aae,_0x2c1959);_0x4c3c0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x267d('0x7')](e,emitEvent(event));}}module[_0x267d('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xe09c=['hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xe09c,0x146));var _0xce09=function(_0x3a1af0,_0x8c74f8){_0x3a1af0=_0x3a1af0-0x0;var _0x109590=_0xe09c[_0x3a1af0];return _0x109590;};'use strict';var EventEmitter=require(_0xce09('0x0'));var WhatsappAccount=require(_0xce09('0x1'))['db'][_0xce09('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xce09('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xce09('0x4')};function emitEvent(_0x51dae8){return function(_0x4f7eba,_0x383cba,_0x1b0b1a){WhatsappAccountEvents[_0xce09('0x5')](_0x51dae8+':'+_0x4f7eba['id'],_0x4f7eba);WhatsappAccountEvents[_0xce09('0x5')](_0x51dae8,_0x4f7eba);_0x1b0b1a(null);};}for(var e in events){if(events[_0xce09('0x6')](e)){var event=events[e];WhatsappAccount[_0xce09('0x7')](e,emitEvent(event));}}module[_0xce09('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 185a4b2..26aed5e 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 _0x6ec9=['moment','bluebird','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api'];(function(_0x24d658,_0x543cc8){var _0x171467=function(_0x8de678){while(--_0x8de678){_0x24d658['push'](_0x24d658['shift']());}};_0x171467(++_0x543cc8);}(_0x6ec9,0xd9));var _0x96ec=function(_0x348369,_0x514e99){_0x348369=_0x348369-0x0;var _0x14396d=_0x6ec9[_0x348369];return _0x14396d;};'use strict';var _=require('lodash');var util=require(_0x96ec('0x0'));var logger=require(_0x96ec('0x1'))(_0x96ec('0x2'));var moment=require(_0x96ec('0x3'));var BPromise=require(_0x96ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x96ec('0x5'));var config=require(_0x96ec('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x96ec('0x7')]=function(_0x3660c8,_0x192f6){return _0x3660c8[_0x96ec('0x8')](_0x96ec('0x9'),attributes,{'tableName':_0x96ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc17=['bluebird','../../config/environment','exports','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment'];(function(_0x4eb358,_0x9cecc9){var _0x5eaa2e=function(_0x5743a7){while(--_0x5743a7){_0x4eb358['push'](_0x4eb358['shift']());}};_0x5eaa2e(++_0x9cecc9);}(_0xcc17,0x7a));var _0x7cc1=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0xcc17[_0x285800];return _0x4b809e;};'use strict';var _=require('lodash');var util=require(_0x7cc1('0x0'));var logger=require(_0x7cc1('0x1'))(_0x7cc1('0x2'));var moment=require(_0x7cc1('0x3'));var BPromise=require(_0x7cc1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7cc1('0x5'));var attributes=require('./whatsappAccount.attributes');module[_0x7cc1('0x6')]=function(_0x5f0858,_0x396f36){return _0x5f0858['define'](_0x7cc1('0x7'),attributes,{'tableName':_0x7cc1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 5360841..ac7d2a6 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 _0xabe1=['WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','map','include','attributes','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','request\x20sent'];(function(_0x5a5c65,_0x58f9a0){var _0x4a6a5e=function(_0x348ac2){while(--_0x348ac2){_0x5a5c65['push'](_0x5a5c65['shift']());}};_0x4a6a5e(++_0x58f9a0);}(_0xabe1,0x1c2));var _0x1abe=function(_0x2d7a7b,_0x3f026a){_0x2d7a7b=_0x2d7a7b-0x0;var _0x154863=_0xabe1[_0x2d7a7b];return _0x154863;};'use strict';var _=require(_0x1abe('0x0'));var util=require(_0x1abe('0x1'));var moment=require(_0x1abe('0x2'));var BPromise=require(_0x1abe('0x3'));var rs=require(_0x1abe('0x4'));var fs=require('fs');var Redis=require(_0x1abe('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1abe('0x6'));var config=require(_0x1abe('0x7'));var jayson=require(_0x1abe('0x8'));var client=jayson[_0x1abe('0x9')][_0x1abe('0xa')]({'port':0x232a});config[_0x1abe('0xb')]=_[_0x1abe('0xc')](config[_0x1abe('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1abe('0xd'))(new Redis(config[_0x1abe('0xb')]));require('./whatsappAccount.socket')[_0x1abe('0xe')](socket);function respondWithRpcPromise(_0x2f38f4,_0xfec794,_0x32ca59){return new BPromise(function(_0x270db9,_0x5676b0){return client[_0x1abe('0xf')](_0x2f38f4,_0x32ca59)[_0x1abe('0x10')](function(_0x17fda1){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0xfec794,_0x1abe('0x11'));logger['debug'](_0x1abe('0x12'),_0xfec794,_0x1abe('0x11'),JSON[_0x1abe('0x13')](_0x17fda1));if(_0x17fda1['error']){if(_0x17fda1[_0x1abe('0x14')][_0x1abe('0x15')]===0x1f4){logger[_0x1abe('0x14')](_0x1abe('0x16'),_0xfec794,_0x17fda1[_0x1abe('0x14')][_0x1abe('0x17')]);return _0x5676b0(_0x17fda1[_0x1abe('0x14')]['message']);}logger[_0x1abe('0x14')](_0x1abe('0x16'),_0xfec794,_0x17fda1[_0x1abe('0x14')][_0x1abe('0x17')]);return _0x270db9(_0x17fda1[_0x1abe('0x14')]['message']);}else{logger[_0x1abe('0x18')](_0x1abe('0x16'),_0xfec794,_0x1abe('0x11'));_0x270db9(_0x17fda1['result'][_0x1abe('0x17')]);}})[_0x1abe('0x19')](function(_0x35e7ee){logger[_0x1abe('0x14')](_0x1abe('0x16'),_0xfec794,_0x35e7ee);_0x5676b0(_0x35e7ee);});});}exports[_0x1abe('0x1a')]=function(_0x1c4ff0){var _0x1c4d0e=this;return new Promise(function(_0xf1b9e5,_0x19c0e4){return db[_0x1abe('0x1b')]['find']({'raw':_0x1c4ff0['options']?_0x1c4ff0[_0x1abe('0x1c')][_0x1abe('0x1d')]===undefined?!![]:![]:!![],'where':_0x1c4ff0[_0x1abe('0x1c')]?_0x1c4ff0[_0x1abe('0x1c')][_0x1abe('0x1e')]||null:null,'attributes':_0x1c4ff0[_0x1abe('0x1c')]?_0x1c4ff0[_0x1abe('0x1c')]['attributes']||null:null,'include':_0x1c4ff0[_0x1abe('0x1c')]?_0x1c4ff0[_0x1abe('0x1c')]['include']?_[_0x1abe('0x1f')](_0x1c4ff0[_0x1abe('0x1c')][_0x1abe('0x20')],function(_0x386746){return{'model':db[_0x386746['model']],'as':_0x386746['as'],'attributes':_0x386746[_0x1abe('0x21')],'include':_0x386746['include']?_[_0x1abe('0x1f')](_0x386746['include'],function(_0xf772e){return{'model':db[_0xf772e[_0x1abe('0x22')]],'as':_0xf772e['as'],'attributes':_0xf772e['attributes'],'include':_0xf772e[_0x1abe('0x20')]?_[_0x1abe('0x1f')](_0xf772e[_0x1abe('0x20')],function(_0x949016){return{'model':db[_0x949016['model']],'as':_0x949016['as'],'attributes':_0x949016[_0x1abe('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1abe('0x10')](function(_0x298911){logger[_0x1abe('0x18')](_0x1abe('0x1a'),_0x1c4ff0);logger[_0x1abe('0x23')](_0x1abe('0x1a'),_0x1c4ff0,JSON[_0x1abe('0x13')](_0x298911));_0xf1b9e5(_0x298911);})['catch'](function(_0xfd6d3d){logger[_0x1abe('0x14')](_0x1abe('0x1a'),_0xfd6d3d[_0x1abe('0x17')],_0x1c4ff0);_0x19c0e4(_0x1c4d0e['error'](0x1f4,_0xfd6d3d[_0x1abe('0x17')]));});});}; \ No newline at end of file +var _0xb9f4=['find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1730fe,_0x3f40ee){var _0x1d0a14=function(_0x5ef6fc){while(--_0x5ef6fc){_0x1730fe['push'](_0x1730fe['shift']());}};_0x1d0a14(++_0x3f40ee);}(_0xb9f4,0xdc));var _0x4b9f=function(_0x325db9,_0x20e189){_0x325db9=_0x325db9-0x0;var _0x70b5b2=_0xb9f4[_0x325db9];return _0x70b5b2;};'use strict';var _=require(_0x4b9f('0x0'));var util=require(_0x4b9f('0x1'));var moment=require(_0x4b9f('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b9f('0x3'));var fs=require('fs');var Redis=require(_0x4b9f('0x4'));var db=require(_0x4b9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4b9f('0x6'));var config=require(_0x4b9f('0x7'));var jayson=require(_0x4b9f('0x8'));var client=jayson[_0x4b9f('0x9')][_0x4b9f('0xa')]({'port':0x232a});config[_0x4b9f('0xb')]=_[_0x4b9f('0xc')](config[_0x4b9f('0xb')],{'host':_0x4b9f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b9f('0xb')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x49ba85,_0x44eb21,_0x3c756a){return new BPromise(function(_0x15799e,_0x4ead80){return client[_0x4b9f('0xe')](_0x49ba85,_0x3c756a)[_0x4b9f('0xf')](function(_0x1a18ad){logger[_0x4b9f('0x10')](_0x4b9f('0x11'),_0x44eb21,_0x4b9f('0x12'));logger[_0x4b9f('0x13')](_0x4b9f('0x14'),_0x44eb21,_0x4b9f('0x12'),JSON[_0x4b9f('0x15')](_0x1a18ad));if(_0x1a18ad[_0x4b9f('0x16')]){if(_0x1a18ad['error'][_0x4b9f('0x17')]===0x1f4){logger[_0x4b9f('0x16')](_0x4b9f('0x11'),_0x44eb21,_0x1a18ad['error'][_0x4b9f('0x18')]);return _0x4ead80(_0x1a18ad['error'][_0x4b9f('0x18')]);}logger[_0x4b9f('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x44eb21,_0x1a18ad['error'][_0x4b9f('0x18')]);return _0x15799e(_0x1a18ad[_0x4b9f('0x16')][_0x4b9f('0x18')]);}else{logger['info'](_0x4b9f('0x11'),_0x44eb21,_0x4b9f('0x12'));_0x15799e(_0x1a18ad['result'][_0x4b9f('0x18')]);}})['catch'](function(_0x11495f){logger[_0x4b9f('0x16')](_0x4b9f('0x11'),_0x44eb21,_0x11495f);_0x4ead80(_0x11495f);});});}exports['ShowWhatsappAccount']=function(_0x2001fa){var _0x1725b4=this;return new Promise(function(_0x392e4b,_0x4495a9){return db['WhatsappAccount'][_0x4b9f('0x19')]({'raw':_0x2001fa['options']?_0x2001fa[_0x4b9f('0x1a')][_0x4b9f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2001fa[_0x4b9f('0x1a')]?_0x2001fa['options'][_0x4b9f('0x1c')]||null:null,'attributes':_0x2001fa[_0x4b9f('0x1a')]?_0x2001fa[_0x4b9f('0x1a')][_0x4b9f('0x1d')]||null:null,'include':_0x2001fa['options']?_0x2001fa[_0x4b9f('0x1a')][_0x4b9f('0x1e')]?_[_0x4b9f('0x1f')](_0x2001fa[_0x4b9f('0x1a')][_0x4b9f('0x1e')],function(_0x5650fc){return{'model':db[_0x5650fc[_0x4b9f('0x20')]],'as':_0x5650fc['as'],'attributes':_0x5650fc[_0x4b9f('0x1d')],'include':_0x5650fc[_0x4b9f('0x1e')]?_['map'](_0x5650fc[_0x4b9f('0x1e')],function(_0x150802){return{'model':db[_0x150802[_0x4b9f('0x20')]],'as':_0x150802['as'],'attributes':_0x150802['attributes'],'include':_0x150802[_0x4b9f('0x1e')]?_['map'](_0x150802[_0x4b9f('0x1e')],function(_0x3eee9a){return{'model':db[_0x3eee9a[_0x4b9f('0x20')]],'as':_0x3eee9a['as'],'attributes':_0x3eee9a[_0x4b9f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4b9f('0xf')](function(_0xa59c9c){logger[_0x4b9f('0x10')](_0x4b9f('0x21'),_0x2001fa);logger[_0x4b9f('0x13')]('ShowWhatsappAccount',_0x2001fa,JSON['stringify'](_0xa59c9c));_0x392e4b(_0xa59c9c);})[_0x4b9f('0x22')](function(_0x28fe24){logger[_0x4b9f('0x16')](_0x4b9f('0x21'),_0x28fe24[_0x4b9f('0x18')],_0x2001fa);_0x4495a9(_0x1725b4['error'](0x1f4,_0x28fe24[_0x4b9f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 93752f3..121417e 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 _0x3b40=['whatsappAccount:','save','update','emit','removeListener','length'];(function(_0x4609ce,_0x3b9100){var _0x47e9ec=function(_0x7acc51){while(--_0x7acc51){_0x4609ce['push'](_0x4609ce['shift']());}};_0x47e9ec(++_0x3b9100);}(_0x3b40,0x85));var _0x03b4=function(_0x60ff7e,_0x1823d5){_0x60ff7e=_0x60ff7e-0x0;var _0x27c040=_0x3b40[_0x60ff7e];return _0x27c040;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x03b4('0x0'),'remove',_0x03b4('0x1')];function createListener(_0x2e1e16,_0x3609f3){return function(_0x4f7c3d){_0x3609f3[_0x03b4('0x2')](_0x2e1e16,_0x4f7c3d);};}function removeListener(_0x3c8290,_0x4145f8){return function(){WhatsappAccountEvents[_0x03b4('0x3')](_0x3c8290,_0x4145f8);};}exports['register']=function(_0x3a3762){for(var _0x2ca104=0x0,_0x22b45d=events[_0x03b4('0x4')];_0x2ca104<_0x22b45d;_0x2ca104++){var _0x24555b=events[_0x2ca104];var _0x29f793=createListener(_0x03b4('0x5')+_0x24555b,_0x3a3762);WhatsappAccountEvents['on'](_0x24555b,_0x29f793);}}; \ No newline at end of file +var _0x83fc=['update','emit','removeListener','register','whatsappAccount:','remove'];(function(_0x230949,_0x790da6){var _0x54a3dd=function(_0x510d0d){while(--_0x510d0d){_0x230949['push'](_0x230949['shift']());}};_0x54a3dd(++_0x790da6);}(_0x83fc,0x1c7));var _0xc83f=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x83fc[_0x15c421];return _0x5e5ed5;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xc83f('0x0'),_0xc83f('0x1')];function createListener(_0x810cb,_0x1074d6){return function(_0xb39e26){_0x1074d6[_0xc83f('0x2')](_0x810cb,_0xb39e26);};}function removeListener(_0x240534,_0x4864f4){return function(){WhatsappAccountEvents[_0xc83f('0x3')](_0x240534,_0x4864f4);};}exports[_0xc83f('0x4')]=function(_0xe324de){for(var _0x2f63e3=0x0,_0x207cc0=events['length'];_0x2f63e3<_0x207cc0;_0x2f63e3++){var _0x420511=events[_0x2f63e3];var _0x110c81=createListener(_0xc83f('0x5')+_0x420511,_0xe324de);WhatsappAccountEvents['on'](_0x420511,_0x110c81);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index fe11dc3..e20043e 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 _0xd5cb=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index'];(function(_0x145ef5,_0x46d9d2){var _0x31f324=function(_0x12efc9){while(--_0x12efc9){_0x145ef5['push'](_0x145ef5['shift']());}};_0x31f324(++_0x46d9d2);}(_0xd5cb,0xe4));var _0xbd5c=function(_0x964270,_0x10787f){_0x964270=_0x964270-0x0;var _0x5a93b0=_0xd5cb[_0x964270];return _0x5a93b0;};'use strict';var multer=require(_0xbd5c('0x0'));var util=require(_0xbd5c('0x1'));var path=require(_0xbd5c('0x2'));var timeout=require(_0xbd5c('0x3'));var express=require(_0xbd5c('0x4'));var router=express[_0xbd5c('0x5')]();var fs_extra=require(_0xbd5c('0x6'));var auth=require(_0xbd5c('0x7'));var interaction=require(_0xbd5c('0x8'));var config=require(_0xbd5c('0x9'));var controller=require(_0xbd5c('0xa'));router[_0xbd5c('0xb')]('/',auth[_0xbd5c('0xc')](),controller[_0xbd5c('0xd')]);router[_0xbd5c('0xb')](_0xbd5c('0xe'),auth[_0xbd5c('0xc')](),controller['show']);router[_0xbd5c('0xf')]('/',auth[_0xbd5c('0xc')](),controller[_0xbd5c('0x10')]);router[_0xbd5c('0x11')](_0xbd5c('0xe'),auth['isAuthenticated'](),controller[_0xbd5c('0x12')]);router[_0xbd5c('0x13')](_0xbd5c('0xe'),auth['isAuthenticated'](),controller[_0xbd5c('0x14')]);module[_0xbd5c('0x15')]=router; \ No newline at end of file +var _0x40c1=['put','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0x40c1,0x135));var _0x140c=function(_0x186ac5,_0x3f1ec9){_0x186ac5=_0x186ac5-0x0;var _0x55b797=_0x40c1[_0x186ac5];return _0x55b797;};'use strict';var multer=require(_0x140c('0x0'));var util=require(_0x140c('0x1'));var path=require(_0x140c('0x2'));var timeout=require('connect-timeout');var express=require(_0x140c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x140c('0x4'));var interaction=require(_0x140c('0x5'));var config=require('../../config/environment');var controller=require(_0x140c('0x6'));router[_0x140c('0x7')]('/',auth[_0x140c('0x8')](),controller[_0x140c('0x9')]);router[_0x140c('0x7')](_0x140c('0xa'),auth[_0x140c('0x8')](),controller[_0x140c('0xb')]);router[_0x140c('0xc')]('/',auth[_0x140c('0x8')](),controller[_0x140c('0xd')]);router[_0x140c('0xe')]('/:id',auth[_0x140c('0x8')](),controller['update']);router[_0x140c('0xf')](_0x140c('0xa'),auth[_0x140c('0x8')](),controller[_0x140c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 6b3431a..9c21c87 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 _0x3c27=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x5ece52,_0x2d13ea){var _0x1cc0db=function(_0x5da631){while(--_0x5da631){_0x5ece52['push'](_0x5ece52['shift']());}};_0x1cc0db(++_0x2d13ea);}(_0x3c27,0x1c9));var _0x73c2=function(_0x4a79fd,_0x429333){_0x4a79fd=_0x4a79fd-0x0;var _0xef2f88=_0x3c27[_0x4a79fd];return _0xef2f88;};'use strict';var Sequelize=require(_0x73c2('0x0'));module[_0x73c2('0x1')]={'priority':{'type':Sequelize[_0x73c2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x73c2('0x3')],'allowNull':![],'defaultValue':_0x73c2('0x4')},'appdata':{'type':Sequelize[_0x73c2('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x73c2('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xc7a2=['STRING','*,*,*,*','sequelize','noop'];(function(_0x3b4270,_0x14d84c){var _0x5e46ed=function(_0x1180bf){while(--_0x1180bf){_0x3b4270['push'](_0x3b4270['shift']());}};_0x5e46ed(++_0x14d84c);}(_0xc7a2,0x7a));var _0x2c7a=function(_0x29c9eb,_0x3d680b){_0x29c9eb=_0x29c9eb-0x0;var _0x438352=_0xc7a2[_0x29c9eb];return _0x438352;};'use strict';var Sequelize=require(_0x2c7a('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2c7a('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2c7a('0x2')],'defaultValue':_0x2c7a('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 929cfce..5bc539a 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 _0x3914=['order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','rawAttributes','intersection','includeAll','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','send','index','map','WhatsappApplication','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','nolimit'];(function(_0x2828b3,_0x2bb499){var _0x3ddbce=function(_0x424ced){while(--_0x424ced){_0x2828b3['push'](_0x2828b3['shift']());}};_0x3ddbce(++_0x2bb499);}(_0x3914,0xeb));var _0x4391=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x3914[_0x16de68];return _0x1c277e;};'use strict';var emlformat=require(_0x4391('0x0'));var rimraf=require(_0x4391('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4391('0x2'));var rp=require(_0x4391('0x3'));var moment=require('moment');var BPromise=require(_0x4391('0x4'));var Mustache=require(_0x4391('0x5'));var util=require(_0x4391('0x6'));var path=require('path');var sox=require(_0x4391('0x7'));var csv=require(_0x4391('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4391('0x9'));var _=require('lodash');var squel=require(_0x4391('0xa'));var crypto=require('crypto');var jsforce=require(_0x4391('0xb'));var deskjs=require(_0x4391('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4391('0xd'));var Redis=require(_0x4391('0xe'));var authService=require(_0x4391('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4391('0x10'));var hardwareService=require(_0x4391('0x11'));var logger=require(_0x4391('0x12'))(_0x4391('0x13'));var utils=require('../../config/utils');var config=require(_0x4391('0x14'));var licenseUtil=require(_0x4391('0x15'));var db=require(_0x4391('0x16'))['db'];function respondWithStatusCode(_0x137902,_0x254ffb){_0x254ffb=_0x254ffb||0xcc;return function(_0xdebb72){if(_0xdebb72){return _0x137902[_0x4391('0x17')](_0x254ffb);}return _0x137902[_0x4391('0x18')](_0x254ffb)['end']();};}function respondWithResult(_0x1a49ba,_0x3bd3a7){_0x3bd3a7=_0x3bd3a7||0xc8;return function(_0x3f82fb){if(_0x3f82fb){return _0x1a49ba[_0x4391('0x18')](_0x3bd3a7)['json'](_0x3f82fb);}};}function respondWithFilteredResult(_0x62c763,_0x4ff882){return function(_0x343203){if(_0x343203){var _0x3a1b80=typeof _0x4ff882[_0x4391('0x19')]===_0x4391('0x1a')&&typeof _0x4ff882[_0x4391('0x1b')]===_0x4391('0x1a');var _0x2b5117=_0x343203[_0x4391('0x1c')];var _0x58a311=_0x3a1b80?0x0:_0x4ff882['offset'];var _0x2ecb23=_0x3a1b80?_0x343203['count']:_0x4ff882[_0x4391('0x19')]+_0x4ff882[_0x4391('0x1b')];var _0xa9c97f;if(_0x2ecb23>=_0x2b5117){_0x2ecb23=_0x2b5117;_0xa9c97f=0xc8;}else{_0xa9c97f=0xce;}_0x62c763[_0x4391('0x18')](_0xa9c97f);return _0x62c763[_0x4391('0x1d')]('Content-Range',_0x58a311+'-'+_0x2ecb23+'/'+_0x2b5117)['json'](_0x343203);}return null;};}function patchUpdates(_0x36c34c){return function(_0x37fca4){try{jsonpatch[_0x4391('0x1e')](_0x37fca4,_0x36c34c,!![]);}catch(_0x5570a8){return BPromise[_0x4391('0x1f')](_0x5570a8);}return _0x37fca4[_0x4391('0x20')]();};}function saveUpdates(_0x737d10,_0x3e1e0b){return function(_0x505d2c){if(_0x505d2c){return _0x505d2c[_0x4391('0x21')](_0x737d10)[_0x4391('0x22')](function(_0x3c4c9b){return _0x3c4c9b;});}return null;};}function removeEntity(_0xfee343,_0x24e16c){return function(_0x40ff34){if(_0x40ff34){return _0x40ff34['destroy']()[_0x4391('0x22')](function(){_0xfee343[_0x4391('0x18')](0xcc)[_0x4391('0x23')]();});}};}function handleEntityNotFound(_0x333ca6,_0x540339){return function(_0x4b0c28){if(!_0x4b0c28){_0x333ca6[_0x4391('0x17')](0x194);}return _0x4b0c28;};}function handleError(_0x3aa79f,_0x3f2554){_0x3f2554=_0x3f2554||0x1f4;return function(_0x197408){logger[_0x4391('0x24')](_0x197408['stack']);if(_0x197408['name']){delete _0x197408['name'];}_0x3aa79f['status'](_0x3f2554)[_0x4391('0x25')](_0x197408);};}exports[_0x4391('0x26')]=function(_0x471d43,_0x2f7b18){var _0x49aa36={},_0x34059f={},_0x32ed74={'count':0x0,'rows':[]};var _0x115e36=_[_0x4391('0x27')](db[_0x4391('0x28')]['rawAttributes'],function(_0x1a8df0){return{'name':_0x1a8df0[_0x4391('0x29')],'type':_0x1a8df0[_0x4391('0x2a')][_0x4391('0x2b')]};});_0x34059f[_0x4391('0x2c')]=_[_0x4391('0x27')](_0x115e36,_0x4391('0x2d'));_0x34059f[_0x4391('0x2e')]=_[_0x4391('0x2f')](_0x471d43[_0x4391('0x2e')]);_0x34059f[_0x4391('0x30')]=_['intersection'](_0x34059f[_0x4391('0x2c')],_0x34059f['query']);_0x49aa36[_0x4391('0x31')]=_['intersection'](_0x34059f['model'],qs[_0x4391('0x32')](_0x471d43[_0x4391('0x2e')][_0x4391('0x32')]));_0x49aa36[_0x4391('0x31')]=_0x49aa36[_0x4391('0x31')][_0x4391('0x33')]?_0x49aa36[_0x4391('0x31')]:_0x34059f['model'];if(!_0x471d43[_0x4391('0x2e')]['hasOwnProperty'](_0x4391('0x34'))){_0x49aa36['limit']=qs[_0x4391('0x1b')](_0x471d43[_0x4391('0x2e')][_0x4391('0x1b')]);_0x49aa36[_0x4391('0x19')]=qs[_0x4391('0x19')](_0x471d43[_0x4391('0x2e')][_0x4391('0x19')]);}_0x49aa36[_0x4391('0x35')]=qs[_0x4391('0x36')](_0x471d43[_0x4391('0x2e')][_0x4391('0x36')]);_0x49aa36[_0x4391('0x37')]=qs[_0x4391('0x30')](_[_0x4391('0x38')](_0x471d43[_0x4391('0x2e')],_0x34059f[_0x4391('0x30')]),_0x115e36);if(_0x471d43[_0x4391('0x2e')][_0x4391('0x39')]){_0x49aa36['where']=_['merge'](_0x49aa36[_0x4391('0x37')],{'$or':_[_0x4391('0x27')](_0x115e36,function(_0x58e161){if(_0x58e161[_0x4391('0x2a')]!==_0x4391('0x3a')){var _0x1c716c={};_0x1c716c[_0x58e161[_0x4391('0x2d')]]={'$like':'%'+_0x471d43[_0x4391('0x2e')]['filter']+'%'};return _0x1c716c;}})});}_0x49aa36=_[_0x4391('0x3b')]({},_0x49aa36,_0x471d43['options']);var _0x5ec1cf={'where':_0x49aa36['where']};return db['WhatsappApplication'][_0x4391('0x1c')](_0x5ec1cf)[_0x4391('0x22')](function(_0x33736a){_0x32ed74[_0x4391('0x1c')]=_0x33736a;if(_0x471d43['query']['includeAll']){_0x49aa36[_0x4391('0x3c')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x4391('0x3d')](_0x49aa36);})[_0x4391('0x22')](function(_0x3bfcdc){_0x32ed74[_0x4391('0x3e')]=_0x3bfcdc;return _0x32ed74;})[_0x4391('0x22')](respondWithFilteredResult(_0x2f7b18,_0x49aa36))[_0x4391('0x3f')](handleError(_0x2f7b18,null));};exports['show']=function(_0x2708e2,_0x3da701){var _0x361f44={'raw':!![],'where':{'id':_0x2708e2[_0x4391('0x40')]['id']}},_0x13f5f4={};_0x13f5f4[_0x4391('0x2c')]=_[_0x4391('0x2f')](db['WhatsappApplication'][_0x4391('0x41')]);_0x13f5f4[_0x4391('0x2e')]=_[_0x4391('0x2f')](_0x2708e2[_0x4391('0x2e')]);_0x13f5f4[_0x4391('0x30')]=_[_0x4391('0x42')](_0x13f5f4[_0x4391('0x2c')],_0x13f5f4['query']);_0x361f44[_0x4391('0x31')]=_['intersection'](_0x13f5f4[_0x4391('0x2c')],qs[_0x4391('0x32')](_0x2708e2[_0x4391('0x2e')][_0x4391('0x32')]));_0x361f44[_0x4391('0x31')]=_0x361f44[_0x4391('0x31')][_0x4391('0x33')]?_0x361f44[_0x4391('0x31')]:_0x13f5f4[_0x4391('0x2c')];if(_0x2708e2[_0x4391('0x2e')][_0x4391('0x43')]){_0x361f44[_0x4391('0x3c')]=[{'all':!![]}];}_0x361f44=_[_0x4391('0x3b')]({},_0x361f44,_0x2708e2['options']);return db['WhatsappApplication'][_0x4391('0x44')](_0x361f44)[_0x4391('0x22')](handleEntityNotFound(_0x3da701,null))[_0x4391('0x22')](respondWithResult(_0x3da701,null))[_0x4391('0x3f')](handleError(_0x3da701,null));};exports[_0x4391('0x45')]=function(_0x25c7f6,_0x4efc22){return db[_0x4391('0x28')]['create'](_0x25c7f6[_0x4391('0x46')],{})['then'](respondWithResult(_0x4efc22,0xc9))[_0x4391('0x3f')](handleError(_0x4efc22,null));};exports[_0x4391('0x21')]=function(_0x738d35,_0x1b07b2){if(_0x738d35[_0x4391('0x46')]['id']){delete _0x738d35[_0x4391('0x46')]['id'];}return db['WhatsappApplication'][_0x4391('0x44')]({'where':{'id':_0x738d35[_0x4391('0x40')]['id']}})[_0x4391('0x22')](handleEntityNotFound(_0x1b07b2,null))[_0x4391('0x22')](saveUpdates(_0x738d35[_0x4391('0x46')],null))[_0x4391('0x22')](respondWithResult(_0x1b07b2,null))[_0x4391('0x3f')](handleError(_0x1b07b2,null));};exports[_0x4391('0x47')]=function(_0x1ca698,_0x294498){return db[_0x4391('0x28')][_0x4391('0x44')]({'where':{'id':_0x1ca698[_0x4391('0x40')]['id']}})['then'](handleEntityNotFound(_0x294498,null))[_0x4391('0x22')](removeEntity(_0x294498,null))[_0x4391('0x3f')](handleError(_0x294498,null));}; \ No newline at end of file +var _0xfe39=['find','create','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params'];(function(_0x55d70e,_0x3b9b5f){var _0x195850=function(_0x548cfc){while(--_0x548cfc){_0x55d70e['push'](_0x55d70e['shift']());}};_0x195850(++_0x3b9b5f);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xfe39[_0x88cd7b];return _0x56fcc8;};'use strict';var emlformat=require(_0x9fe3('0x0'));var rimraf=require(_0x9fe3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fe3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9fe3('0x3'));var Mustache=require(_0x9fe3('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9fe3('0x5'));var csv=require(_0x9fe3('0x6'));var ejs=require(_0x9fe3('0x7'));var fs=require('fs');var fs_extra=require(_0x9fe3('0x8'));var _=require(_0x9fe3('0x9'));var squel=require(_0x9fe3('0xa'));var crypto=require(_0x9fe3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fe3('0xc'));var toCsv=require(_0x9fe3('0x6'));var querystring=require(_0x9fe3('0xd'));var Papa=require(_0x9fe3('0xe'));var Redis=require(_0x9fe3('0xf'));var authService=require(_0x9fe3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fe3('0x11'));var logger=require(_0x9fe3('0x12'))('api');var utils=require(_0x9fe3('0x13'));var config=require(_0x9fe3('0x14'));var licenseUtil=require(_0x9fe3('0x15'));var db=require(_0x9fe3('0x16'))['db'];function respondWithStatusCode(_0x51d1cb,_0x37bfef){_0x37bfef=_0x37bfef||0xcc;return function(_0x155013){if(_0x155013){return _0x51d1cb[_0x9fe3('0x17')](_0x37bfef);}return _0x51d1cb[_0x9fe3('0x18')](_0x37bfef)['end']();};}function respondWithResult(_0x4e4dcc,_0x329032){_0x329032=_0x329032||0xc8;return function(_0x31bbf3){if(_0x31bbf3){return _0x4e4dcc[_0x9fe3('0x18')](_0x329032)[_0x9fe3('0x19')](_0x31bbf3);}};}function respondWithFilteredResult(_0x1b2057,_0x5f5b58){return function(_0x5f0067){if(_0x5f0067){var _0x207eef=typeof _0x5f5b58[_0x9fe3('0x1a')]===_0x9fe3('0x1b')&&typeof _0x5f5b58[_0x9fe3('0x1c')]==='undefined';var _0xd7141a=_0x5f0067[_0x9fe3('0x1d')];var _0x15fcaa=_0x207eef?0x0:_0x5f5b58['offset'];var _0x35bbaf=_0x207eef?_0x5f0067[_0x9fe3('0x1d')]:_0x5f5b58['offset']+_0x5f5b58[_0x9fe3('0x1c')];var _0x4f272c;if(_0x35bbaf>=_0xd7141a){_0x35bbaf=_0xd7141a;_0x4f272c=0xc8;}else{_0x4f272c=0xce;}_0x1b2057[_0x9fe3('0x18')](_0x4f272c);return _0x1b2057['set'](_0x9fe3('0x1e'),_0x15fcaa+'-'+_0x35bbaf+'/'+_0xd7141a)[_0x9fe3('0x19')](_0x5f0067);}return null;};}function patchUpdates(_0x302d5c){return function(_0x5b53f3){try{jsonpatch['apply'](_0x5b53f3,_0x302d5c,!![]);}catch(_0x113f23){return BPromise[_0x9fe3('0x1f')](_0x113f23);}return _0x5b53f3['save']();};}function saveUpdates(_0x328989,_0x2e9ae5){return function(_0x587e43){if(_0x587e43){return _0x587e43[_0x9fe3('0x20')](_0x328989)[_0x9fe3('0x21')](function(_0x5b6719){return _0x5b6719;});}return null;};}function removeEntity(_0x3ec2e7,_0x2fb7a9){return function(_0x3fd88e){if(_0x3fd88e){return _0x3fd88e[_0x9fe3('0x22')]()[_0x9fe3('0x21')](function(){_0x3ec2e7[_0x9fe3('0x18')](0xcc)[_0x9fe3('0x23')]();});}};}function handleEntityNotFound(_0x4c1a30,_0x1763c0){return function(_0x1304ff){if(!_0x1304ff){_0x4c1a30[_0x9fe3('0x17')](0x194);}return _0x1304ff;};}function handleError(_0x3b29dd,_0x47f38b){_0x47f38b=_0x47f38b||0x1f4;return function(_0x1a4a43){logger[_0x9fe3('0x24')](_0x1a4a43[_0x9fe3('0x25')]);if(_0x1a4a43['name']){delete _0x1a4a43[_0x9fe3('0x26')];}_0x3b29dd[_0x9fe3('0x18')](_0x47f38b)[_0x9fe3('0x27')](_0x1a4a43);};}exports[_0x9fe3('0x28')]=function(_0x1d2da7,_0x17f01f){var _0x59eb15={},_0xa4d56e={},_0x369fde={'count':0x0,'rows':[]};var _0x31d8fb=_[_0x9fe3('0x29')](db[_0x9fe3('0x2a')][_0x9fe3('0x2b')],function(_0x5a9af3){return{'name':_0x5a9af3[_0x9fe3('0x2c')],'type':_0x5a9af3[_0x9fe3('0x2d')]['key']};});_0xa4d56e[_0x9fe3('0x2e')]=_[_0x9fe3('0x29')](_0x31d8fb,_0x9fe3('0x26'));_0xa4d56e[_0x9fe3('0x2f')]=_[_0x9fe3('0x30')](_0x1d2da7[_0x9fe3('0x2f')]);_0xa4d56e['filters']=_[_0x9fe3('0x31')](_0xa4d56e[_0x9fe3('0x2e')],_0xa4d56e[_0x9fe3('0x2f')]);_0x59eb15['attributes']=_['intersection'](_0xa4d56e['model'],qs[_0x9fe3('0x32')](_0x1d2da7['query'][_0x9fe3('0x32')]));_0x59eb15[_0x9fe3('0x33')]=_0x59eb15[_0x9fe3('0x33')][_0x9fe3('0x34')]?_0x59eb15[_0x9fe3('0x33')]:_0xa4d56e[_0x9fe3('0x2e')];if(!_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x35')](_0x9fe3('0x36'))){_0x59eb15['limit']=qs[_0x9fe3('0x1c')](_0x1d2da7['query']['limit']);_0x59eb15[_0x9fe3('0x1a')]=qs[_0x9fe3('0x1a')](_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x1a')]);}_0x59eb15['order']=qs[_0x9fe3('0x37')](_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x37')]);_0x59eb15['where']=qs[_0x9fe3('0x38')](_[_0x9fe3('0x39')](_0x1d2da7[_0x9fe3('0x2f')],_0xa4d56e[_0x9fe3('0x38')]),_0x31d8fb);if(_0x1d2da7['query'][_0x9fe3('0x3a')]){_0x59eb15[_0x9fe3('0x3b')]=_['merge'](_0x59eb15['where'],{'$or':_[_0x9fe3('0x29')](_0x31d8fb,function(_0x5a09e8){if(_0x5a09e8[_0x9fe3('0x2d')]!==_0x9fe3('0x3c')){var _0x294073={};_0x294073[_0x5a09e8[_0x9fe3('0x26')]]={'$like':'%'+_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x3a')]+'%'};return _0x294073;}})});}_0x59eb15=_[_0x9fe3('0x3d')]({},_0x59eb15,_0x1d2da7[_0x9fe3('0x3e')]);var _0x5932b5={'where':_0x59eb15[_0x9fe3('0x3b')]};return db[_0x9fe3('0x2a')][_0x9fe3('0x1d')](_0x5932b5)[_0x9fe3('0x21')](function(_0x24f7bf){_0x369fde[_0x9fe3('0x1d')]=_0x24f7bf;if(_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x3f')]){_0x59eb15[_0x9fe3('0x40')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x59eb15);})['then'](function(_0x4d96b8){_0x369fde[_0x9fe3('0x41')]=_0x4d96b8;return _0x369fde;})[_0x9fe3('0x21')](respondWithFilteredResult(_0x17f01f,_0x59eb15))[_0x9fe3('0x42')](handleError(_0x17f01f,null));};exports[_0x9fe3('0x43')]=function(_0x1e5c52,_0x5126b6){var _0x1868a2={'raw':!![],'where':{'id':_0x1e5c52[_0x9fe3('0x44')]['id']}},_0x157bf5={};_0x157bf5['model']=_[_0x9fe3('0x30')](db[_0x9fe3('0x2a')][_0x9fe3('0x2b')]);_0x157bf5['query']=_['keys'](_0x1e5c52['query']);_0x157bf5[_0x9fe3('0x38')]=_['intersection'](_0x157bf5[_0x9fe3('0x2e')],_0x157bf5[_0x9fe3('0x2f')]);_0x1868a2['attributes']=_['intersection'](_0x157bf5['model'],qs['fields'](_0x1e5c52[_0x9fe3('0x2f')][_0x9fe3('0x32')]));_0x1868a2[_0x9fe3('0x33')]=_0x1868a2[_0x9fe3('0x33')][_0x9fe3('0x34')]?_0x1868a2[_0x9fe3('0x33')]:_0x157bf5[_0x9fe3('0x2e')];if(_0x1e5c52[_0x9fe3('0x2f')]['includeAll']){_0x1868a2['include']=[{'all':!![]}];}_0x1868a2=_['merge']({},_0x1868a2,_0x1e5c52[_0x9fe3('0x3e')]);return db['WhatsappApplication'][_0x9fe3('0x45')](_0x1868a2)[_0x9fe3('0x21')](handleEntityNotFound(_0x5126b6,null))[_0x9fe3('0x21')](respondWithResult(_0x5126b6,null))[_0x9fe3('0x42')](handleError(_0x5126b6,null));};exports[_0x9fe3('0x46')]=function(_0x501504,_0x105373){return db[_0x9fe3('0x2a')][_0x9fe3('0x46')](_0x501504[_0x9fe3('0x47')],{})[_0x9fe3('0x21')](respondWithResult(_0x105373,0xc9))[_0x9fe3('0x42')](handleError(_0x105373,null));};exports['update']=function(_0x5dc31e,_0x480aa5){if(_0x5dc31e[_0x9fe3('0x47')]['id']){delete _0x5dc31e['body']['id'];}return db[_0x9fe3('0x2a')][_0x9fe3('0x45')]({'where':{'id':_0x5dc31e[_0x9fe3('0x44')]['id']}})[_0x9fe3('0x21')](handleEntityNotFound(_0x480aa5,null))[_0x9fe3('0x21')](saveUpdates(_0x5dc31e[_0x9fe3('0x47')],null))['then'](respondWithResult(_0x480aa5,null))[_0x9fe3('0x42')](handleError(_0x480aa5,null));};exports['destroy']=function(_0xe25bdb,_0x435e75){return db['WhatsappApplication'][_0x9fe3('0x45')]({'where':{'id':_0xe25bdb['params']['id']}})[_0x9fe3('0x21')](handleEntityNotFound(_0x435e75,null))[_0x9fe3('0x21')](removeEntity(_0x435e75,null))[_0x9fe3('0x42')](handleError(_0x435e75,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 88009f6..76a357c 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 _0xc23a=['util','../../config/logger','api','bluebird','rimraf','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0x548ede,_0x3e6cd9){var _0x84388=function(_0x4dae9f){while(--_0x4dae9f){_0x548ede['push'](_0x548ede['shift']());}};_0x84388(++_0x3e6cd9);}(_0xc23a,0xd2));var _0xac23=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0xc23a[_0x209ec9];return _0x129b1b;};'use strict';var _=require('lodash');var util=require(_0xac23('0x0'));var logger=require(_0xac23('0x1'))(_0xac23('0x2'));var moment=require('moment');var BPromise=require(_0xac23('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xac23('0x4'));var config=require('../../config/environment');var attributes=require(_0xac23('0x5'));module[_0xac23('0x6')]=function(_0xc71a6d,_0x4c1482){return _0xc71a6d['define'](_0xac23('0x7'),attributes,{'tableName':_0xac23('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xac23('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5455=['define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappApplication.attributes','exports'];(function(_0x2a4a45,_0x4b05ba){var _0x322cd8=function(_0xba8b35){while(--_0xba8b35){_0x2a4a45['push'](_0x2a4a45['shift']());}};_0x322cd8(++_0x4b05ba);}(_0x5455,0x197));var _0x5545=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5455[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var logger=require(_0x5545('0x1'))(_0x5545('0x2'));var moment=require(_0x5545('0x3'));var BPromise=require(_0x5545('0x4'));var rp=require(_0x5545('0x5'));var fs=require('fs');var path=require(_0x5545('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5545('0x7'));module[_0x5545('0x8')]=function(_0x5c22f1,_0x5a6ac7){return _0x5c22f1[_0x5545('0x9')](_0x5545('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5545('0xb'),'collate':_0x5545('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index bcf0980..fa59337 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 _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0xda55,0x6d));var _0x5da5=function(_0x537883,_0x542802){_0x537883=_0x537883-0x0;var _0xacfb01=_0xda55[_0x537883];return _0xacfb01;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file +var _0x2d17=['WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2fc1f6,_0x51543e){var _0x7a3346=function(_0x589b08){while(--_0x589b08){_0x2fc1f6['push'](_0x2fc1f6['shift']());}};_0x7a3346(++_0x51543e);}(_0x2d17,0x17e));var _0x72d1=function(_0x27fef7,_0xa9162f){_0x27fef7=_0x27fef7-0x0;var _0x3a1084=_0x2d17[_0x27fef7];return _0x3a1084;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index dbd46ee..175a6e8 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 _0x5e0e=['whatsappinteraction:addtags','addTags','put','tracked','whatsappinteraction:update','delete','whatsappinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsapp'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x5e0e,0x89));var _0xe5e0=function(_0xd58fc1,_0x1d931c){_0xd58fc1=_0xd58fc1-0x0;var _0xc71c40=_0x5e0e[_0xd58fc1];return _0xc71c40;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require('path');var timeout=require(_0xe5e0('0x2'));var express=require(_0xe5e0('0x3'));var router=express[_0xe5e0('0x4')]();var fs_extra=require(_0xe5e0('0x5'));var auth=require(_0xe5e0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe5e0('0x7'));var controller=require('./whatsappInteraction.controller');router[_0xe5e0('0x8')]('/',auth[_0xe5e0('0x9')](),controller[_0xe5e0('0xa')]);router[_0xe5e0('0x8')](_0xe5e0('0xb'),auth[_0xe5e0('0x9')](),controller['describe']);router[_0xe5e0('0x8')](_0xe5e0('0xc'),auth['isAuthenticated'](),controller[_0xe5e0('0xd')]);router[_0xe5e0('0x8')](_0xe5e0('0xe'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0xf')]);router[_0xe5e0('0x8')](_0xe5e0('0x10'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x11')]);router[_0xe5e0('0x12')]('/',auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x13')]);router[_0xe5e0('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0xe5e0('0x14')]);router[_0xe5e0('0x12')](_0xe5e0('0x15'),auth[_0xe5e0('0x9')](),interaction['tracked'](_0xe5e0('0x16'),_0xe5e0('0x17')),controller[_0xe5e0('0x18')]);router[_0xe5e0('0x19')](_0xe5e0('0xc'),auth[_0xe5e0('0x9')](),interaction[_0xe5e0('0x1a')](_0xe5e0('0x16'),_0xe5e0('0x1b')),controller['update']);router[_0xe5e0('0x1c')]('/:id',auth[_0xe5e0('0x9')](),interaction['tracked'](_0xe5e0('0x16'),_0xe5e0('0x1d')),controller['destroy']);router[_0xe5e0('0x1c')]('/:id/tags',auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x1e')]);module[_0xe5e0('0x1f')]=router; \ No newline at end of file +var _0x25fa=['update','delete','whatsappinteraction:destroy','removeTags','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x3763d7,_0x105b20){var _0x9694e4=function(_0x2ed882){while(--_0x2ed882){_0x3763d7['push'](_0x3763d7['shift']());}};_0x9694e4(++_0x105b20);}(_0x25fa,0x109));var _0xa25f=function(_0x47ced9,_0x1bc596){_0x47ced9=_0x47ced9-0x0;var _0x3b9dc8=_0x25fa[_0x47ced9];return _0x3b9dc8;};'use strict';var multer=require(_0xa25f('0x0'));var util=require('util');var path=require(_0xa25f('0x1'));var timeout=require(_0xa25f('0x2'));var express=require('express');var router=express[_0xa25f('0x3')]();var fs_extra=require(_0xa25f('0x4'));var auth=require(_0xa25f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa25f('0x6'));router['get']('/',auth[_0xa25f('0x7')](),controller[_0xa25f('0x8')]);router[_0xa25f('0x9')](_0xa25f('0xa'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xb')]);router[_0xa25f('0x9')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['show']);router[_0xa25f('0x9')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0xe')]);router[_0xa25f('0x9')](_0xa25f('0xf'),auth[_0xa25f('0x7')](),controller['download']);router[_0xa25f('0x10')]('/',auth[_0xa25f('0x7')](),controller['create']);router[_0xa25f('0x10')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0x11')]);router[_0xa25f('0x10')](_0xa25f('0x12'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')](_0xa25f('0x14'),_0xa25f('0x15')),controller[_0xa25f('0x16')]);router[_0xa25f('0x17')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x18')),controller[_0xa25f('0x19')]);router[_0xa25f('0x1a')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x1b')),controller['destroy']);router[_0xa25f('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa25f('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 3e68a17..d064849 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 _0xf2ca=['out','BOOLEAN','sequelize','moment','exports','DATE','STRING','ENUM'];(function(_0x496ecc,_0x54e4ac){var _0x25c19d=function(_0x2e1f9d){while(--_0x2e1f9d){_0x496ecc['push'](_0x496ecc['shift']());}};_0x25c19d(++_0x54e4ac);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x318256,_0xa773f3){_0x318256=_0x318256-0x0;var _0xb1e352=_0xf2ca[_0x318256];return _0xb1e352;};'use strict';var Sequelize=require(_0xaf2c('0x0'));var moment=require(_0xaf2c('0x1'));module[_0xaf2c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaf2c('0x3')]},'disposition':{'type':Sequelize[_0xaf2c('0x4')]},'secondDisposition':{'type':Sequelize[_0xaf2c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xaf2c('0x4')]},'note':{'type':Sequelize[_0xaf2c('0x4')]},'phone':{'type':Sequelize[_0xaf2c('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xaf2c('0x5')]('in',_0xaf2c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaf2c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xaf2c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaf2c('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xc1fc=['moment','exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x1317a0,_0x146f49){var _0xdacc6d=function(_0x229042){while(--_0x229042){_0x1317a0['push'](_0x1317a0['shift']());}};_0xdacc6d(++_0x146f49);}(_0xc1fc,0x93));var _0xcc1f=function(_0x3e4613,_0x53121f){_0x3e4613=_0x3e4613-0x0;var _0x26be5a=_0xc1fc[_0x3e4613];return _0x26be5a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcc1f('0x0'));module[_0xcc1f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcc1f('0x2')]},'disposition':{'type':Sequelize[_0xcc1f('0x3')]},'secondDisposition':{'type':Sequelize[_0xcc1f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xcc1f('0x3')]},'note':{'type':Sequelize[_0xcc1f('0x3')]},'phone':{'type':Sequelize[_0xcc1f('0x3')]},'read1stAt':{'type':Sequelize[_0xcc1f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xcc1f('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcc1f('0x4')]('in',_0xcc1f('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcc1f('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 3f5120f..8e88d95 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 _0xe186=['filter','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.WhatsappAccountId\x20IS\x20NULL','toString','sequelize','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','Contact.firstName','c.email','Contact.email','c.phone','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','rows','catch','show','params','include','options','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','whatsappInteractionTags:save','removeTags','download','unix','join','tmp','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','Whatsapp','basename','createReadStream','pipe','direction','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','u.id\x20=\x20ui.UserId','select','left_join','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray'];(function(_0x8f7472,_0x3049d9){var _0x119044=function(_0x5aa580){while(--_0x5aa580){_0x8f7472['push'](_0x8f7472['shift']());}};_0x119044(++_0x3049d9);}(_0xe186,0x146));var _0x6e18=function(_0x4e22d4,_0x1352e9){_0x4e22d4=_0x4e22d4-0x0;var _0x1e7c32=_0xe186[_0x4e22d4];return _0x1e7c32;};'use strict';var emlformat=require(_0x6e18('0x0'));var rimraf=require(_0x6e18('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e18('0x2'));var rp=require(_0x6e18('0x3'));var moment=require(_0x6e18('0x4'));var BPromise=require(_0x6e18('0x5'));var Mustache=require(_0x6e18('0x6'));var util=require('util');var path=require(_0x6e18('0x7'));var sox=require('sox');var csv=require(_0x6e18('0x8'));var ejs=require(_0x6e18('0x9'));var fs=require('fs');var fs_extra=require(_0x6e18('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6e18('0xb'));var jsforce=require(_0x6e18('0xc'));var deskjs=require(_0x6e18('0xd'));var toCsv=require(_0x6e18('0x8'));var querystring=require(_0x6e18('0xe'));var Papa=require(_0x6e18('0xf'));var Redis=require(_0x6e18('0x10'));var authService=require(_0x6e18('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6e18('0x12'));var pdf=require(_0x6e18('0x13'));var hardwareService=require(_0x6e18('0x14'));var logger=require(_0x6e18('0x15'))(_0x6e18('0x16'));var utils=require('../../config/utils');var config=require(_0x6e18('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e18('0x18'))['db'];config[_0x6e18('0x19')]=_[_0x6e18('0x1a')](config[_0x6e18('0x19')],{'host':_0x6e18('0x1b'),'port':0x18eb});var socket=require(_0x6e18('0x1c'))(new Redis(config['redis']));require(_0x6e18('0x1d'))[_0x6e18('0x1e')](socket);function respondWithStatusCode(_0x32c848,_0x4dcc63){_0x4dcc63=_0x4dcc63||0xcc;return function(_0xef7033){if(_0xef7033){return _0x32c848[_0x6e18('0x1f')](_0x4dcc63);}return _0x32c848[_0x6e18('0x20')](_0x4dcc63)[_0x6e18('0x21')]();};}function respondWithResult(_0x430a28,_0x521f5c){_0x521f5c=_0x521f5c||0xc8;return function(_0xd6b56a){if(_0xd6b56a){return _0x430a28['status'](_0x521f5c)['json'](_0xd6b56a);}};}function respondWithFilteredResult(_0x348c46,_0x5bdcfd){return function(_0x5bae96){if(_0x5bae96){var _0x12ad28=typeof _0x5bdcfd['offset']===_0x6e18('0x22')&&typeof _0x5bdcfd[_0x6e18('0x23')]===_0x6e18('0x22');var _0x5e8f59=_0x5bae96['count'];var _0x3ac8ce=_0x12ad28?0x0:_0x5bdcfd[_0x6e18('0x24')];var _0x1376dc=_0x12ad28?_0x5bae96[_0x6e18('0x25')]:_0x5bdcfd[_0x6e18('0x24')]+_0x5bdcfd[_0x6e18('0x23')];var _0x340920;if(_0x1376dc>=_0x5e8f59){_0x1376dc=_0x5e8f59;_0x340920=0xc8;}else{_0x340920=0xce;}_0x348c46['status'](_0x340920);return _0x348c46[_0x6e18('0x26')](_0x6e18('0x27'),_0x3ac8ce+'-'+_0x1376dc+'/'+_0x5e8f59)['json'](_0x5bae96);}return null;};}function patchUpdates(_0x4d6c43){return function(_0x18f2e7){try{jsonpatch[_0x6e18('0x28')](_0x18f2e7,_0x4d6c43,!![]);}catch(_0x24b3af){return BPromise[_0x6e18('0x29')](_0x24b3af);}return _0x18f2e7[_0x6e18('0x2a')]();};}function saveUpdates(_0x1104f6,_0x3bb43d){return function(_0x18d214){if(_0x18d214){return _0x18d214[_0x6e18('0x2b')](_0x1104f6)[_0x6e18('0x2c')](function(_0x28c82a){return _0x28c82a;});}return null;};}function removeEntity(_0x10946a,_0x34a2a7){return function(_0x243508){if(_0x243508){return _0x243508[_0x6e18('0x2d')]()[_0x6e18('0x2c')](function(){_0x10946a[_0x6e18('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113feb,_0x2f4d11){return function(_0x4dc894){if(!_0x4dc894){_0x113feb[_0x6e18('0x1f')](0x194);}return _0x4dc894;};}function handleError(_0x3007d9,_0x176ad5){_0x176ad5=_0x176ad5||0x1f4;return function(_0x1f3ce0){logger['error'](_0x1f3ce0[_0x6e18('0x2e')]);if(_0x1f3ce0[_0x6e18('0x2f')]){delete _0x1f3ce0[_0x6e18('0x2f')];}_0x3007d9[_0x6e18('0x20')](_0x176ad5)[_0x6e18('0x30')](_0x1f3ce0);};}function getInteractionUsers(_0x39279a,_0x17ed8e){return new BPromise(function(_0x1391af,_0x43a18d){try{if(_0x17ed8e[_0x39279a['id']]){_0x39279a[_0x6e18('0x31')]=_[_0x6e18('0x32')](_0x17ed8e[_0x39279a['id']],function(_0x298ae1){return{'id':_0x298ae1['id'],'fullname':_0x298ae1[_0x6e18('0x33')]};});}}catch(_0x739a56){_0x43a18d(_0x739a56);}_0x1391af(_0x39279a);});}function getInteractionTags(_0x301920,_0x2610b1){return new BPromise(function(_0x21daca,_0x1ab9cc){try{if(_0x301920[_0x6e18('0x34')]){_0x301920[_0x6e18('0x35')]=[];_0x301920[_0x6e18('0x34')][_0x6e18('0x36')](',')[_0x6e18('0x37')](function(_0x510b42){_0x301920['Tags'][_0x6e18('0x38')](_0x2610b1[_0x510b42]);});}delete _0x301920[_0x6e18('0x34')];}catch(_0x180163){_0x1ab9cc(_0x180163);}_0x21daca(_0x301920);});}function updateWhatsappInteraction(_0x46089a,_0x11be2f,_0x2113fa){return new BPromise(function(_0x4cc94d,_0x36c5b3){return getInteractionUsers(_0x46089a,_0x2113fa)['then'](function(_0x1dcdab){return getInteractionTags(_0x1dcdab,_0x11be2f);})['then'](function(_0x9ecfd3){_0x4cc94d(_0x9ecfd3);})['catch'](function(_0x720244){_0x36c5b3(_0x720244);});});}exports[_0x6e18('0x39')]=function(_0x5e3ac6,_0x372731){var _0xcc9156={},_0x2e16c5={},_0x1208f7={'count':0x0,'rows':[]};var _0x2195af=_['map'](db['WhatsappInteraction'][_0x6e18('0x3a')],function(_0x1cbfda){return{'name':_0x1cbfda[_0x6e18('0x3b')],'type':_0x1cbfda[_0x6e18('0x3c')][_0x6e18('0x3d')]};});_0x2e16c5[_0x6e18('0x3e')]=_[_0x6e18('0x32')](_0x2195af,_0x6e18('0x2f'));_0x2e16c5[_0x6e18('0x3f')]=_[_0x6e18('0x40')](_0x5e3ac6[_0x6e18('0x3f')]);_0x2e16c5[_0x6e18('0x41')]=_[_0x6e18('0x42')](_0x2e16c5['model'],_0x2e16c5[_0x6e18('0x3f')]);_0xcc9156['attributes']=_[_0x6e18('0x42')](_0x2e16c5[_0x6e18('0x3e')],qs[_0x6e18('0x43')](_0x5e3ac6[_0x6e18('0x3f')]['fields']));_0xcc9156[_0x6e18('0x44')]=_0xcc9156[_0x6e18('0x44')][_0x6e18('0x45')]?_0xcc9156[_0x6e18('0x44')]:_0x2e16c5[_0x6e18('0x3e')];if(!_0x5e3ac6[_0x6e18('0x3f')]['hasOwnProperty'](_0x6e18('0x46'))){_0xcc9156[_0x6e18('0x23')]=qs['limit'](_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x23')]);_0xcc9156['offset']=qs['offset'](_0x5e3ac6['query'][_0x6e18('0x24')]);}_0xcc9156[_0x6e18('0x47')]=qs[_0x6e18('0x48')](_0x5e3ac6['query']['sort']);_0xcc9156['where']=qs['filters'](_['pick'](_0x5e3ac6['query'],_0x2e16c5['filters']),_0x2195af);var _0x39bfa2=[];var _0x2cb367=squel['select']()[_0x6e18('0x49')]('id')['field'](_0x6e18('0x2f'))['field'](_0x6e18('0x4a'))[_0x6e18('0x4b')]('tools_tags');var _0x3a98e2=squel['select']()[_0x6e18('0x49')](_0x6e18('0x4c'))[_0x6e18('0x49')](_0x6e18('0x4d'))[_0x6e18('0x49')](_0x6e18('0x4e'))[_0x6e18('0x4b')](_0x6e18('0x4f'),'ui')['left_join']('users','u',_0x6e18('0x50'));var _0x7d0d65=squel[_0x6e18('0x51')]()['from']('whatsapp_interactions','i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6e18('0x52')]('users','o',_0x6e18('0x53'))[_0x6e18('0x52')](_0x6e18('0x54'),'a',_0x6e18('0x55'))['left_join']('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0x6e18('0x52')](_0x6e18('0x56'),'it',_0x6e18('0x57'))['left_join'](_0x6e18('0x58'),'t',_0x6e18('0x59'));var _0x25701a=squel[_0x6e18('0x5a')]();var _0x36e691=[];var _0xe091e7=squel[_0x6e18('0x5a')]();var _0x484de9;if(_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x5b')]){_0x484de9=as[_0x6e18('0x5c')](_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x5b')]);var _0xaf0201=_0x484de9['sqlOperator'];for(var _0x58cbe0=0x0;_0x58cbe0<_0x484de9['conditions'][_0x6e18('0x45')];_0x58cbe0++){var _0x1b5e20=_0x484de9[_0x6e18('0x5d')][_0x58cbe0];var _0x402edc='i';var _0x390992=_['find'](_0x2195af,[_0x6e18('0x2f'),_0x1b5e20['field']]);if(!_0x390992){switch(_0x1b5e20[_0x6e18('0x49')]){case _0x6e18('0x5e'):if(_0x1b5e20[_0x6e18('0x5f')]==0x1){_0x7d0d65[_0x6e18('0x60')]('`'+_0x1b5e20['field']+_0x6e18('0x61'));}else{_0x7d0d65['having']('`'+_0x1b5e20[_0x6e18('0x49')]+_0x6e18('0x62'));}break;case _0x6e18('0x63'):if(_0x1b5e20[_0x6e18('0x64')]===_0x6e18('0x65')){if(_0x1b5e20[_0x6e18('0x5f')]['split']('\x20')[_0x6e18('0x45')]>0x1){_0x25701a[_0xaf0201](_0x6e18('0x66'),qs[_0x6e18('0x67')](_0x1b5e20['value']),null);}else{var _0x16e440='%'+_0x1b5e20[_0x6e18('0x5f')]+'%';_0x25701a[_0xaf0201](_0x6e18('0x68'),_0x16e440,_0x16e440,_0x16e440);}}else{_0x390992=_[_0x6e18('0x69')](_0x2195af,['name',_0x6e18('0x6a')]);_0x1b5e20[_0x6e18('0x49')]='ContactId';_0x1a80ca=as[_0x6e18('0x6b')](_0x402edc,_0x390992[_0x6e18('0x3c')],_0x1b5e20);_0x25701a[_0xaf0201](_0x1a80ca[_0x6e18('0x6c')],_0x1a80ca[_0x6e18('0x5f')][_0x6e18('0x6d')],_0x1a80ca[_0x6e18('0x5f')][_0x6e18('0x21')]);}break;case _0x6e18('0x6e'):var _0x153789=_0x1b5e20[_0x6e18('0x5f')][_0x6e18('0x36')](',')['map'](function(_0x217156){return Number(_0x217156);});_0x153789['forEach'](function(_0x55d54d){_0xe091e7['or'](_0x6e18('0x6f'),'%,'+_0x55d54d+',%');});_0x36e691=_[_0x6e18('0x70')](_0x36e691,_0x153789);break;case'User':if(_0x1b5e20[_0x6e18('0x64')]===_0x6e18('0x65')){_0x25701a[_0xaf0201](_0x6e18('0x71'),'%'+_0x1b5e20['value']+'%',null);}else{_0x390992=_[_0x6e18('0x69')](_0x2195af,[_0x6e18('0x2f'),_0x6e18('0x72')]);_0x1b5e20[_0x6e18('0x49')]='UserId';_0x1a80ca=as[_0x6e18('0x6b')](_0x402edc,_0x390992[_0x6e18('0x3c')],_0x1b5e20);_0x25701a[_0xaf0201](_0x1a80ca['text'],_0x1a80ca['value'][_0x6e18('0x6d')],_0x1a80ca[_0x6e18('0x5f')][_0x6e18('0x21')]);}break;case _0x6e18('0x73'):_0x1a80ca=as[_0x6e18('0x6b')]('me',null,_0x1b5e20);_0x25701a[_0xaf0201](_0x1a80ca[_0x6e18('0x6c')],_0x1a80ca['value'][_0x6e18('0x6d')],_0x1a80ca[_0x6e18('0x5f')][_0x6e18('0x21')]);break;}}else{var _0x1a80ca=as[_0x6e18('0x6b')](_0x402edc,_0x390992[_0x6e18('0x3c')],_0x1b5e20);_0x25701a[_0xaf0201](_0x1a80ca[_0x6e18('0x6c')],_0x1a80ca[_0x6e18('0x5f')][_0x6e18('0x6d')],_0x1a80ca['value']['end']);}}}else{var _0x5b2fd8=_(_0x5e3ac6[_0x6e18('0x3f')])['keys']()[_0x6e18('0x32')](function(_0x4be074){return _[_0x6e18('0x74')](_0x2195af,['name',_0x4be074])?_0x4be074:undefined;})[_0x6e18('0x75')]()[_0x6e18('0x5f')]();if(!_[_0x6e18('0x76')](_0x5b2fd8)){_0x5b2fd8['forEach'](function(_0x2d900f){if(_0x2d900f==='WhatsappAccountId'){_0x7d0d65[_0x6e18('0x77')](_0x6e18('0x78'),[][_0x6e18('0x79')](_0x5e3ac6['query'][_0x2d900f]));}else if(_0x2d900f===_0x6e18('0x7a')){var _0x1214e7=JSON[_0x6e18('0x7b')](_0x5e3ac6[_0x6e18('0x3f')][_0x2d900f])['$gte'];var _0x1558a2=JSON[_0x6e18('0x7b')](_0x5e3ac6[_0x6e18('0x3f')][_0x2d900f])[_0x6e18('0x7c')];_0x7d0d65['where'](_0x6e18('0x7d'),_0x1214e7,_0x1558a2);}else{if(_0x5e3ac6[_0x6e18('0x3f')][_0x2d900f]===_0x6e18('0x7e')){_0x7d0d65[_0x6e18('0x77')]('i.'+_0x2d900f+_0x6e18('0x7f'));}else{_0x7d0d65[_0x6e18('0x77')]('i.'+_0x2d900f+_0x6e18('0x80'),_0x5e3ac6['query'][_0x2d900f]);}}});}if(_0x5e3ac6[_0x6e18('0x3f')]['read']){if(_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x81')]==0x1){_0x7d0d65[_0x6e18('0x60')](_0x6e18('0x82'));}else{_0x7d0d65['having'](_0x6e18('0x83'));}}if(_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x84')]){_0x36e691=_[_0x6e18('0x85')](_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x84')])?_0x5e3ac6[_0x6e18('0x3f')]['tag']:new Array(_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x84')]);_0x36e691[_0x6e18('0x37')](function(_0x5ef746){_0xe091e7['or'](_0x6e18('0x6f'),'%,'+_0x5ef746+',%');});}if(_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x86')]){var _0x59a43f=_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x86')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x59a43f)){_0x25701a['or'](_0x6e18('0x87'),_0x59a43f+'%')['or']('i.phone\x20LIKE\x20?',_0x59a43f+'%');}else{_0x25701a['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x59a43f))['or'](_0x6e18('0x88'),_0x59a43f+'%');}}}_0x7d0d65['where'](_0x25701a);_0x7d0d65['group'](_0x6e18('0x89'));var _0x20bacc={'type':db[_0x6e18('0x8a')][_0x6e18('0x8b')]['SELECT'],'raw':!![]};var _0x578d65=_0x7d0d65[_0x6e18('0x8c')]();_0x578d65['field'](_0x6e18('0x89'));_0x578d65[_0x6e18('0x49')](_0x6e18('0x8d'),_0x6e18('0x5e'));if(_0xcc9156[_0x6e18('0x47')]){_0xcc9156[_0x6e18('0x47')][_0x6e18('0x37')](function(_0x42db4c){var _0x46c63c=_0x42db4c[0x0]===_0x6e18('0x8e')?_0x42db4c[0x0]:'i.'+_0x42db4c[0x0];_0x7d0d65[_0x6e18('0x47')](_0x46c63c,_0x42db4c[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x36e691)){_0x7d0d65[_0x6e18('0x60')](_0xe091e7);_0x578d65['where']('t.id\x20IN\x20?',_0x36e691);}BPromise[_0x6e18('0x8f')]()['then'](function(){if(!_0x484de9){if(_0x5e3ac6['query'][_0x6e18('0x90')])return;_0x578d65['where'](_0x6e18('0x91'));_0x7d0d65[_0x6e18('0x77')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5e3ac6['user'][_0x6e18('0x92')]!==_0x6e18('0x93'))return;return _0x5e3ac6[_0x6e18('0x94')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x6e18('0x2c')](function(_0x56ec3c){if(_[_0x6e18('0x76')](_0x56ec3c)){_0x578d65['where'](_0x6e18('0x95'));_0x7d0d65[_0x6e18('0x77')](_0x6e18('0x95'));}else{_0x578d65['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x6e18('0x32')](_0x56ec3c,'id'));_0x7d0d65['where'](_0x6e18('0x78'),_['map'](_0x56ec3c,'id'));}});})[_0x6e18('0x2c')](function(){if(_0x5e3ac6[_0x6e18('0x94')][_0x6e18('0x92')]===_0x6e18('0x93')&&!_0x484de9&&!_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x90')])return[];return db['sequelize'][_0x6e18('0x3f')](_0x578d65[_0x6e18('0x96')](),_0x20bacc);})['then'](function(_0xb16592){_0x1208f7[_0x6e18('0x25')]=_0xb16592['length'];if(_0x1208f7['count']===0x0)return[];return db[_0x6e18('0x97')]['query'](_0x2cb367[_0x6e18('0x96')](),_0x20bacc)[_0x6e18('0x2c')](function(_0x5e5884){_0x39bfa2=_[_0x6e18('0x98')](_0x5e5884,'id');_0x20bacc=_[_0x6e18('0x99')](_0x20bacc,{'model':db[_0x6e18('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e3ac6[_0x6e18('0x3f')][_0x6e18('0x43')]){_0xcc9156[_0x6e18('0x44')][_0x6e18('0x37')](function(_0x5d0d00){_0x7d0d65['field']('i.'+_0x5d0d00);});}else{_0x7d0d65[_0x6e18('0x49')](_0x6e18('0x8d'),_0x6e18('0x5e'));_0x7d0d65[_0x6e18('0x49')](_0x6e18('0x9b'),_0x6e18('0x9c'));_0x7d0d65[_0x6e18('0x49')](_0x6e18('0x9d'),'Account.mandatoryDisposition');_0x7d0d65[_0x6e18('0x49')](_0x6e18('0x9e'),_0x6e18('0x8e'));_0x7d0d65[_0x6e18('0x49')](_0x6e18('0x9f'));_0x7d0d65[_0x6e18('0x49')](_0x6e18('0xa0'),_0x6e18('0xa1'));_0x7d0d65['field']('c.lastName','Contact.lastName');_0x7d0d65[_0x6e18('0x49')](_0x6e18('0xa2'),_0x6e18('0xa3'));_0x7d0d65[_0x6e18('0x49')](_0x6e18('0xa4'),'Contact.phone');_0x7d0d65['field']('c.mobile','Contact.mobile');_0x7d0d65[_0x6e18('0x49')]('c.fax',_0x6e18('0xa5'));_0x7d0d65['field'](_0x6e18('0xa6'),_0x6e18('0xa7'));_0x7d0d65[_0x6e18('0x49')](_0x6e18('0xa8'),_0x6e18('0xa9'));_0x7d0d65['field'](_0x6e18('0xaa'),_0x6e18('0x34'));}if(_0xcc9156['limit'])_0x7d0d65['limit'](_0xcc9156['limit']);if(_0xcc9156['offset'])_0x7d0d65['offset'](_0xcc9156[_0x6e18('0x24')]);return db[_0x6e18('0x97')]['query'](_0x7d0d65['toString'](),_0x20bacc);})[_0x6e18('0x2c')](function(_0x3535d4){if(_0x3535d4[_0x6e18('0x45')]>0x0)_0x3a98e2[_0x6e18('0x77')](_0x6e18('0xab'),_['map'](_0x3535d4,'id'));return db['sequelize']['query'](_0x3a98e2[_0x6e18('0x96')](),_0x20bacc)[_0x6e18('0x2c')](function(_0x3d866a){var _0x63127a=_[_0x6e18('0xac')](_0x3d866a,'WhatsappInteractionId');var _0x2ae180=[];_0x3535d4[_0x6e18('0x37')](function(_0x1241ab){_0x2ae180[_0x6e18('0x38')](updateWhatsappInteraction(_0x1241ab,_0x39bfa2,_0x63127a));});return BPromise['all'](_0x2ae180);});});})[_0x6e18('0x2c')](function(_0x2866d0){_0x1208f7[_0x6e18('0xad')]=_0x2866d0;return _0x1208f7;})[_0x6e18('0x2c')](respondWithFilteredResult(_0x372731,_0xcc9156))[_0x6e18('0xae')](handleError(_0x372731,null));};exports[_0x6e18('0xaf')]=function(_0x5e9925,_0x130705){var _0x50f898={'raw':![],'where':{'id':_0x5e9925[_0x6e18('0xb0')]['id']}},_0x3a856b={};_0x3a856b[_0x6e18('0x3e')]=_[_0x6e18('0x40')](db['WhatsappInteraction'][_0x6e18('0x3a')]);_0x3a856b[_0x6e18('0x3f')]=_['keys'](_0x5e9925['query']);_0x3a856b['filters']=_[_0x6e18('0x42')](_0x3a856b[_0x6e18('0x3e')],_0x3a856b[_0x6e18('0x3f')]);_0x50f898['attributes']=_[_0x6e18('0x42')](_0x3a856b[_0x6e18('0x3e')],qs[_0x6e18('0x43')](_0x5e9925[_0x6e18('0x3f')][_0x6e18('0x43')]));_0x50f898[_0x6e18('0x44')]=_0x50f898[_0x6e18('0x44')][_0x6e18('0x45')]?_0x50f898[_0x6e18('0x44')]:_0x3a856b[_0x6e18('0x3e')];if(_0x5e9925[_0x6e18('0x3f')]['includeAll']){_0x50f898[_0x6e18('0xb1')]=[{'all':!![]}];}_0x50f898=_[_0x6e18('0x99')]({},_0x50f898,_0x5e9925[_0x6e18('0xb2')]);return db[_0x6e18('0x9a')][_0x6e18('0x69')](_0x50f898)[_0x6e18('0x2c')](handleEntityNotFound(_0x130705,null))['then'](respondWithResult(_0x130705,null))[_0x6e18('0xae')](handleError(_0x130705,null));};exports['create']=function(_0x4312ef,_0x5f1a23){return db[_0x6e18('0x9a')]['create'](_0x4312ef[_0x6e18('0x73')],{})['then'](respondWithResult(_0x5f1a23,0xc9))[_0x6e18('0xae')](handleError(_0x5f1a23,null));};exports[_0x6e18('0x2b')]=function(_0x4e16ae,_0x595bfd){if(_0x4e16ae[_0x6e18('0x73')]['id']){delete _0x4e16ae[_0x6e18('0x73')]['id'];}return db[_0x6e18('0x9a')][_0x6e18('0x69')]({'where':{'id':_0x4e16ae[_0x6e18('0xb0')]['id']}})['then'](handleEntityNotFound(_0x595bfd,null))[_0x6e18('0x2c')](saveUpdates(_0x4e16ae['body'],null))[_0x6e18('0x2c')](respondWithResult(_0x595bfd,null))['catch'](handleError(_0x595bfd,null));};exports['destroy']=function(_0x1ce556,_0x365786){return db[_0x6e18('0x9a')][_0x6e18('0x69')]({'where':{'id':_0x1ce556[_0x6e18('0xb0')]['id']}})[_0x6e18('0x2c')](handleEntityNotFound(_0x365786,null))[_0x6e18('0x2c')](removeEntity(_0x365786,null))[_0x6e18('0xae')](handleError(_0x365786,null));};exports[_0x6e18('0xb3')]=function(_0x2812f4,_0x500acd){return db['WhatsappInteraction'][_0x6e18('0xb3')]()['then'](respondWithResult(_0x500acd,null))[_0x6e18('0xae')](handleError(_0x500acd,null));};exports[_0x6e18('0xb4')]=function(_0x56026b,_0x1ea5e8,_0xc368be){return db[_0x6e18('0xb5')][_0x6e18('0x69')]({'where':{'id':_0x56026b[_0x6e18('0xb0')]['id']}})[_0x6e18('0x2c')](handleEntityNotFound(_0x1ea5e8,null))[_0x6e18('0x2c')](function(_0x2343f2){if(_0x2343f2){return _0x2343f2['addMessage'](_0x56026b[_0x6e18('0x73')][_0x6e18('0xb6')],_[_0x6e18('0xb7')](_0x56026b[_0x6e18('0x73')],[_0x6e18('0xb6'),'id'])||{});}})['then'](respondWithResult(_0x1ea5e8,null))['catch'](handleError(_0x1ea5e8,null));};exports[_0x6e18('0xb8')]=function(_0x1f253f,_0x29c685,_0x2e95ba){var _0x2187f9={'raw':![],'where':{}};var _0x19a31d={};var _0xcd8e22={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x6e18('0xb9')]({'where':{'id':_0x1f253f['params']['id']}})[_0x6e18('0x2c')](handleEntityNotFound(_0x29c685,null))['then'](function(_0x186894){if(_0x186894){_0x19a31d[_0x6e18('0x3e')]=_['keys'](db[_0x6e18('0xb5')][_0x6e18('0x3a')]);_0x19a31d['query']=_[_0x6e18('0x40')](_0x1f253f['query']);_0x19a31d[_0x6e18('0x41')]=_[_0x6e18('0x42')](_0x19a31d[_0x6e18('0x3e')],_0x19a31d['query']);_0x2187f9[_0x6e18('0x44')]=_[_0x6e18('0x42')](_0x19a31d['model'],qs[_0x6e18('0x43')](_0x1f253f[_0x6e18('0x3f')][_0x6e18('0x43')]));_0x2187f9[_0x6e18('0x44')]=_0x2187f9[_0x6e18('0x44')]['length']?_0x2187f9[_0x6e18('0x44')]:_0x19a31d['model'];if(!_0x1f253f[_0x6e18('0x3f')][_0x6e18('0xba')]('nolimit')){_0x2187f9[_0x6e18('0x23')]=qs['limit'](_0x1f253f[_0x6e18('0x3f')][_0x6e18('0x23')]);_0x2187f9[_0x6e18('0x24')]=qs[_0x6e18('0x24')](_0x1f253f[_0x6e18('0x3f')][_0x6e18('0x24')]);}_0x2187f9[_0x6e18('0x47')]=qs['sort'](_0x1f253f[_0x6e18('0x3f')]['sort']);_0x2187f9['where']=qs[_0x6e18('0x41')](_[_0x6e18('0xbb')](_0x1f253f[_0x6e18('0x3f')],_0x19a31d[_0x6e18('0x41')]));_0x2187f9[_0x6e18('0x77')]['WhatsappInteractionId']=_0x186894['id'];if(_0x1f253f['query']['filter']){_0x2187f9[_0x6e18('0x77')]=_['merge'](_0x2187f9[_0x6e18('0x77')],{'$or':_[_0x6e18('0x32')](_0x2187f9['attributes'],function(_0x429809){var _0x134c39={};_0x134c39[_0x429809]={'$like':'%'+_0x1f253f[_0x6e18('0x3f')][_0x6e18('0x86')]+'%'};return _0x134c39;})});}if(_0x1f253f[_0x6e18('0x3f')]['$gte']){var _0x3ebf85=_0x1f253f[_0x6e18('0x3f')]['$gte'][_0x6e18('0x36')](',');var _0x1486c7={};_0x1486c7[_0x3ebf85[0x0]]={'$gte':moment(_0x3ebf85[0x1])[_0x6e18('0xbc')](_0x6e18('0xbd'))};_0x2187f9[_0x6e18('0x77')]=_[_0x6e18('0x99')](_0x2187f9[_0x6e18('0x77')],_0x1486c7);}_0x2187f9=_[_0x6e18('0x99')]({},_0x2187f9,_0x1f253f['options']);return db[_0x6e18('0xb5')][_0x6e18('0x25')]({'where':_0x2187f9[_0x6e18('0x77')]})['then'](function(_0x2c0e59){_0xcd8e22[_0x6e18('0x25')]=_0x2c0e59;if(_0x1f253f['query'][_0x6e18('0xbe')]){_0x2187f9[_0x6e18('0xb1')]=[{'all':!![]}];}return db[_0x6e18('0xb5')][_0x6e18('0xbf')](_0x2187f9);})[_0x6e18('0x2c')](function(_0x3b506a){_0xcd8e22[_0x6e18('0xad')]=_0x3b506a;return _0xcd8e22;});}})['then'](respondWithFilteredResult(_0x29c685,_0x2187f9))[_0x6e18('0xae')](handleError(_0x29c685,null));};exports[_0x6e18('0xc0')]=function(_0x3446cc,_0x50f519,_0x1c7b7a){return db[_0x6e18('0x9a')]['find']({'where':{'id':_0x3446cc[_0x6e18('0xb0')]['id']}})['then'](handleEntityNotFound(_0x50f519,null))[_0x6e18('0x2c')](function(_0x1cd66b){if(_0x1cd66b){return _0x1cd66b[_0x6e18('0xc1')](_0x3446cc[_0x6e18('0x73')][_0x6e18('0xb6')],_['omit'](_0x3446cc['body'],[_0x6e18('0xb6'),'id'])||{})[_0x6e18('0xc2')](function(){return db['Tag']['findAll']({'attributes':['id',_0x6e18('0x2f'),_0x6e18('0x4a')],'where':{'id':_0x3446cc[_0x6e18('0x73')][_0x6e18('0xb6')]}});})[_0x6e18('0x2c')](function(_0x323ab2){socket['emit'](_0x6e18('0xc3'),{'id':Number(_0x3446cc[_0x6e18('0xb0')]['id']),'tags':_0x323ab2||[]});return{'id':Number(_0x3446cc[_0x6e18('0xb0')]['id']),'tags':_0x323ab2||[]};});}})['then'](respondWithResult(_0x50f519,null))[_0x6e18('0xae')](handleError(_0x50f519,null));};exports['removeTags']=function(_0x6fe0fa,_0x3f8df7,_0x2e2a08){return db[_0x6e18('0x9a')]['find']({'where':{'id':_0x6fe0fa['params']['id']}})[_0x6e18('0x2c')](handleEntityNotFound(_0x3f8df7,null))['then'](function(_0x5ab9e5){if(_0x5ab9e5){return _0x5ab9e5[_0x6e18('0xc4')](_0x6fe0fa[_0x6e18('0x3f')][_0x6e18('0xb6')]);}})['then'](respondWithStatusCode(_0x3f8df7,null))[_0x6e18('0xae')](handleError(_0x3f8df7,null));};exports[_0x6e18('0xc5')]=function(_0x107a86,_0x531dd9){var _0x398a29=moment()[_0x6e18('0xc6')]()[_0x6e18('0x96')]();var _0x27f057=path[_0x6e18('0xc7')](config['root'],'server','files',_0x6e18('0xc8'));var _0x18a6ec=path[_0x6e18('0xc7')](config[_0x6e18('0xc9')],_0x6e18('0xca'),_0x6e18('0xcb'),_0x6e18('0xcc'));var _0x13e6bc=path['join'](_0x27f057,_0x398a29);var _0x20979e=util[_0x6e18('0xbc')](_0x6e18('0xcd'),_0x107a86[_0x6e18('0xb0')]['id'],_0x398a29);var _0x165e1a=path[_0x6e18('0xc7')](_0x27f057,_0x20979e);var _0x2fad73=[];_0x2fad73['push']({'model':db[_0x6e18('0xce')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x2fad73['push']({'model':db[_0x6e18('0xcf')],'as':'Contact','attributes':['id','firstName',_0x6e18('0xd0')],'raw':!![]});if(_0x107a86[_0x6e18('0x3f')][_0x6e18('0xcc')]){_0x2fad73[_0x6e18('0x38')]({'model':db[_0x6e18('0xd1')],'as':_0x6e18('0xd1'),'raw':!![]});}var _0x753c82=[{'model':db['WhatsappMessage'],'as':_0x6e18('0xd2'),'attributes':['id',_0x6e18('0x73'),'createdAt','direction',_0x6e18('0xd3'),_0x6e18('0x81')],'include':_0x2fad73}];_0x753c82[_0x6e18('0x38')]({'model':db[_0x6e18('0xd4')],'as':_0x6e18('0xd5'),'attributes':['id','name']});_0x753c82[_0x6e18('0x38')]({'model':db['User'],'as':_0x6e18('0xd6'),'attributes':['id','fullname']});return db[_0x6e18('0x9a')]['find']({'where':{'id':_0x107a86[_0x6e18('0xb0')]['id']},'include':_0x753c82})[_0x6e18('0x2c')](handleEntityNotFound(_0x531dd9,null))['then'](function(_0x6361a5){if(_0x6361a5){var _0x238850=_0x6361a5[_0x6e18('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x13e6bc);var _0x418f2d={'channel':_0x6e18('0xd8'),'account':_0x238850[_0x6e18('0xd5')]['name'],'agent':_0x238850[_0x6e18('0xd6')]?_0x238850['Owner'][_0x6e18('0x33')]:'N.A.','createdAt':moment(_0x238850[_0x6e18('0x7a')])[_0x6e18('0xbc')](_0x6e18('0xbd'))['toString'](),'closedAt':_0x238850['closed']?moment(_0x238850['closedAt'])[_0x6e18('0xbc')](_0x6e18('0xbd'))['toString']():'','disposition':_0x238850['disposition'],'messages':_(_0x238850['Messages'])['filter']({'secret':![]})['map'](function(_0x390f0d){if(_0x390f0d[_0x6e18('0xd1')]){var _0x287d62=path[_0x6e18('0xc7')](_0x18a6ec,_0x390f0d['Attachment'][_0x6e18('0xd9')]);if(fs['existsSync'](_0x287d62)){fs[_0x6e18('0xda')](_0x287d62)[_0x6e18('0xdb')](fs['createWriteStream'](path['join'](_0x13e6bc,_0x390f0d[_0x6e18('0xd1')][_0x6e18('0xd9')])));}}return{'date':moment(_0x390f0d[_0x6e18('0x7a')])[_0x6e18('0xbc')](_0x6e18('0xbd'))[_0x6e18('0x96')](),'sender':_0x390f0d[_0x6e18('0xdc')]===_0x6e18('0xdd')?_0x390f0d[_0x6e18('0xce')]?_0x390f0d['User']['fullname']:_0x6e18('0xde'):_0x390f0d[_0x6e18('0x63')]['firstName']+(_0x390f0d[_0x6e18('0x63')][_0x6e18('0xd0')]?'\x20'+_0x390f0d[_0x6e18('0x63')][_0x6e18('0xd0')]:''),'body':_0x390f0d[_0x6e18('0xd1')]?_0x390f0d[_0x6e18('0xd1')][_0x6e18('0xd9')]:_0x390f0d['body'],'direction':_0x390f0d[_0x6e18('0xdc')]==='out'?'A':'C','secret':_0x390f0d['secret'],'read':_0x390f0d['read'],'attachment':_0x390f0d[_0x6e18('0xd1')]};})[_0x6e18('0x5f')]()};return ejs[_0x6e18('0xdf')](path['join'](config[_0x6e18('0xc9')],_0x6e18('0xca'),_0x6e18('0xe0'),_0x6e18('0xe1')),{'interaction':_0x418f2d})['then'](function(_0x422113){var _0x1cf2c2=path[_0x6e18('0xc7')](_0x13e6bc,_0x6e18('0xe2')+_0x238850['id']+'-'+_0x398a29+_0x6e18('0xe3'));var _0x57cf08={'path':_0x1cf2c2,'channel':'Whatsapp','interactionId':_0x238850['id']};return pdf[_0x6e18('0xe4')](_0x422113,_0x57cf08);})[_0x6e18('0x2c')](function(){return new BPromise(function(_0x2210b1,_0x478ef0){zipdir(_0x13e6bc,{'saveTo':_0x165e1a},function(_0x29ff1d,_0x3e0d61){if(_0x29ff1d)return _0x478ef0(_0x29ff1d);return _0x2210b1(_0x3e0d61);});})[_0x6e18('0x2c')](function(){return new BPromise(function(_0xd5f6b2,_0x271934){rimraf(_0x13e6bc,function(_0x1d3adf){if(_0x1d3adf)_0x271934(_0x1d3adf);return _0xd5f6b2();});});})[_0x6e18('0x2c')](function(){return _0x531dd9[_0x6e18('0xc5')](_0x165e1a,_0x20979e,function(_0x4b0416){if(_0x4b0416){console['log']('err',_0x4b0416);}else{fs[_0x6e18('0xe5')](_0x165e1a);}});});});}else{return _0x531dd9[_0x6e18('0x1f')](0xc8);}})[_0x6e18('0xae')](handleError(_0x531dd9,null));}; \ No newline at end of file +var _0xe233=['tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','show','includeAll','include','merge','options','create','params','describe','addMessage','WhatsappMessage','ids','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','color','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','Whatsapp','N.A.','createdAt','closed','closedAt','disposition','existsSync','pipe','createWriteStream','basename','out','System','Contact','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','status','end','error','name','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe233,0x15b));var _0x3e23=function(_0x84827d,_0x4f5722){_0x84827d=_0x84827d-0x0;var _0x289cf9=_0xe233[_0x84827d];return _0x289cf9;};'use strict';var emlformat=require(_0x3e23('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3e23('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e23('0x2'));var Mustache=require(_0x3e23('0x3'));var util=require(_0x3e23('0x4'));var path=require(_0x3e23('0x5'));var sox=require(_0x3e23('0x6'));var csv=require('to-csv');var ejs=require(_0x3e23('0x7'));var fs=require('fs');var fs_extra=require(_0x3e23('0x8'));var _=require(_0x3e23('0x9'));var squel=require(_0x3e23('0xa'));var crypto=require(_0x3e23('0xb'));var jsforce=require(_0x3e23('0xc'));var deskjs=require(_0x3e23('0xd'));var toCsv=require(_0x3e23('0xe'));var querystring=require(_0x3e23('0xf'));var Papa=require(_0x3e23('0x10'));var Redis=require(_0x3e23('0x11'));var authService=require(_0x3e23('0x12'));var qs=require(_0x3e23('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x3e23('0x14'));var logger=require(_0x3e23('0x15'))(_0x3e23('0x16'));var utils=require(_0x3e23('0x17'));var config=require(_0x3e23('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3e23('0x19')](config[_0x3e23('0x1a')],{'host':_0x3e23('0x1b'),'port':0x18eb});var socket=require(_0x3e23('0x1c'))(new Redis(config[_0x3e23('0x1a')]));require(_0x3e23('0x1d'))['register'](socket);function respondWithStatusCode(_0x4dd333,_0x49162b){_0x49162b=_0x49162b||0xcc;return function(_0x5e7559){if(_0x5e7559){return _0x4dd333[_0x3e23('0x1e')](_0x49162b);}return _0x4dd333['status'](_0x49162b)['end']();};}function respondWithResult(_0x443436,_0xe893a){_0xe893a=_0xe893a||0xc8;return function(_0x420516){if(_0x420516){return _0x443436['status'](_0xe893a)[_0x3e23('0x1f')](_0x420516);}};}function respondWithFilteredResult(_0x496e97,_0x492f88){return function(_0x55790a){if(_0x55790a){var _0x13fe4f=typeof _0x492f88[_0x3e23('0x20')]===_0x3e23('0x21')&&typeof _0x492f88[_0x3e23('0x22')]===_0x3e23('0x21');var _0x4efdac=_0x55790a[_0x3e23('0x23')];var _0x1113a3=_0x13fe4f?0x0:_0x492f88[_0x3e23('0x20')];var _0x30faeb=_0x13fe4f?_0x55790a[_0x3e23('0x23')]:_0x492f88['offset']+_0x492f88[_0x3e23('0x22')];var _0x104d96;if(_0x30faeb>=_0x4efdac){_0x30faeb=_0x4efdac;_0x104d96=0xc8;}else{_0x104d96=0xce;}_0x496e97['status'](_0x104d96);return _0x496e97[_0x3e23('0x24')](_0x3e23('0x25'),_0x1113a3+'-'+_0x30faeb+'/'+_0x4efdac)[_0x3e23('0x1f')](_0x55790a);}return null;};}function patchUpdates(_0x27bffa){return function(_0x20c16f){try{jsonpatch['apply'](_0x20c16f,_0x27bffa,!![]);}catch(_0x511169){return BPromise[_0x3e23('0x26')](_0x511169);}return _0x20c16f[_0x3e23('0x27')]();};}function saveUpdates(_0x5a0735,_0x1a4a20){return function(_0xac447a){if(_0xac447a){return _0xac447a[_0x3e23('0x28')](_0x5a0735)[_0x3e23('0x29')](function(_0x56ba42){return _0x56ba42;});}return null;};}function removeEntity(_0xd36333,_0x5c9a95){return function(_0x12a1ea){if(_0x12a1ea){return _0x12a1ea[_0x3e23('0x2a')]()['then'](function(){_0xd36333[_0x3e23('0x2b')](0xcc)[_0x3e23('0x2c')]();});}};}function handleEntityNotFound(_0x38428f,_0x1b1e73){return function(_0x1c5007){if(!_0x1c5007){_0x38428f['sendStatus'](0x194);}return _0x1c5007;};}function handleError(_0x2848d2,_0x8b7a75){_0x8b7a75=_0x8b7a75||0x1f4;return function(_0x1e61a9){logger[_0x3e23('0x2d')](_0x1e61a9['stack']);if(_0x1e61a9[_0x3e23('0x2e')]){delete _0x1e61a9[_0x3e23('0x2e')];}_0x2848d2[_0x3e23('0x2b')](_0x8b7a75)['send'](_0x1e61a9);};}function getInteractionUsers(_0xb8d05b,_0x437fc8){return new BPromise(function(_0x131b70,_0x327985){try{if(_0x437fc8[_0xb8d05b['id']]){_0xb8d05b[_0x3e23('0x2f')]=_[_0x3e23('0x30')](_0x437fc8[_0xb8d05b['id']],function(_0x552f5e){return{'id':_0x552f5e['id'],'fullname':_0x552f5e[_0x3e23('0x31')]};});}}catch(_0x429546){_0x327985(_0x429546);}_0x131b70(_0xb8d05b);});}function getInteractionTags(_0x26107f,_0x1cb602){return new BPromise(function(_0x57977b,_0x75bfb){try{if(_0x26107f[_0x3e23('0x32')]){_0x26107f[_0x3e23('0x33')]=[];_0x26107f['TagIds'][_0x3e23('0x34')](',')[_0x3e23('0x35')](function(_0x9a8cf2){_0x26107f['Tags']['push'](_0x1cb602[_0x9a8cf2]);});}delete _0x26107f[_0x3e23('0x32')];}catch(_0x3e46d2){_0x75bfb(_0x3e46d2);}_0x57977b(_0x26107f);});}function updateWhatsappInteraction(_0x1e5f5d,_0x294f46,_0x37827a){return new BPromise(function(_0x2d8f34,_0x2e307d){return getInteractionUsers(_0x1e5f5d,_0x37827a)[_0x3e23('0x29')](function(_0x1d94c9){return getInteractionTags(_0x1d94c9,_0x294f46);})['then'](function(_0x2418ee){_0x2d8f34(_0x2418ee);})[_0x3e23('0x36')](function(_0x382abb){_0x2e307d(_0x382abb);});});}exports[_0x3e23('0x37')]=function(_0x41eb94,_0x408352){var _0x378303={},_0x449fff={},_0x3fbabb={'count':0x0,'rows':[]};var _0x382dbb=_[_0x3e23('0x30')](db[_0x3e23('0x38')][_0x3e23('0x39')],function(_0x24c9f5){return{'name':_0x24c9f5[_0x3e23('0x3a')],'type':_0x24c9f5[_0x3e23('0x3b')][_0x3e23('0x3c')]};});_0x449fff[_0x3e23('0x3d')]=_[_0x3e23('0x30')](_0x382dbb,_0x3e23('0x2e'));_0x449fff[_0x3e23('0x3e')]=_['keys'](_0x41eb94[_0x3e23('0x3e')]);_0x449fff[_0x3e23('0x3f')]=_[_0x3e23('0x40')](_0x449fff[_0x3e23('0x3d')],_0x449fff[_0x3e23('0x3e')]);_0x378303[_0x3e23('0x41')]=_[_0x3e23('0x40')](_0x449fff[_0x3e23('0x3d')],qs[_0x3e23('0x42')](_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x42')]));_0x378303[_0x3e23('0x41')]=_0x378303[_0x3e23('0x41')][_0x3e23('0x43')]?_0x378303[_0x3e23('0x41')]:_0x449fff[_0x3e23('0x3d')];if(!_0x41eb94['query'][_0x3e23('0x44')](_0x3e23('0x45'))){_0x378303[_0x3e23('0x22')]=qs[_0x3e23('0x22')](_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x22')]);_0x378303['offset']=qs[_0x3e23('0x20')](_0x41eb94['query'][_0x3e23('0x20')]);}_0x378303[_0x3e23('0x46')]=qs[_0x3e23('0x47')](_0x41eb94[_0x3e23('0x3e')]['sort']);_0x378303['where']=qs[_0x3e23('0x3f')](_[_0x3e23('0x48')](_0x41eb94[_0x3e23('0x3e')],_0x449fff[_0x3e23('0x3f')]),_0x382dbb);var _0x2d4c2f=[];var _0x56c6f0=squel[_0x3e23('0x49')]()[_0x3e23('0x4a')]('id')[_0x3e23('0x4a')]('name')[_0x3e23('0x4a')]('color')['from'](_0x3e23('0x4b'));var _0xfd51e8=squel[_0x3e23('0x49')]()[_0x3e23('0x4a')](_0x3e23('0x4c'))[_0x3e23('0x4a')](_0x3e23('0x4d'))['field']('ui.WhatsappInteractionId')['from'](_0x3e23('0x4e'),'ui')[_0x3e23('0x4f')]('users','u','u.id\x20=\x20ui.UserId');var _0x3b8a22=squel[_0x3e23('0x49')]()[_0x3e23('0x50')]('whatsapp_interactions','i')['left_join'](_0x3e23('0x51'),'c',_0x3e23('0x52'))[_0x3e23('0x4f')](_0x3e23('0x53'),'o','o.id\x20=\x20i.UserId')[_0x3e23('0x4f')](_0x3e23('0x54'),'a',_0x3e23('0x55'))[_0x3e23('0x4f')]('whatsapp_messages','me',_0x3e23('0x56'))[_0x3e23('0x4f')](_0x3e23('0x57'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x3e23('0x4f')](_0x3e23('0x4b'),'t',_0x3e23('0x58'));var _0x159ca2=squel[_0x3e23('0x59')]();var _0x2195b5=[];var _0x10dba2=squel[_0x3e23('0x59')]();var _0x1e6c86;if(_0x41eb94['query'][_0x3e23('0x5a')]){_0x1e6c86=as[_0x3e23('0x5b')](_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x5a')]);var _0x26aa9d=_0x1e6c86[_0x3e23('0x5c')];for(var _0x51688e=0x0;_0x51688e<_0x1e6c86['conditions']['length'];_0x51688e++){var _0x108993=_0x1e6c86[_0x3e23('0x5d')][_0x51688e];var _0x13c468='i';var _0x3384d6=_[_0x3e23('0x5e')](_0x382dbb,[_0x3e23('0x2e'),_0x108993[_0x3e23('0x4a')]]);if(!_0x3384d6){switch(_0x108993[_0x3e23('0x4a')]){case _0x3e23('0x5f'):if(_0x108993[_0x3e23('0x60')]==0x1){_0x3b8a22[_0x3e23('0x61')]('`'+_0x108993['field']+_0x3e23('0x62'));}else{_0x3b8a22['having']('`'+_0x108993[_0x3e23('0x4a')]+_0x3e23('0x63'));}break;case'Contact':if(_0x108993['operator']===_0x3e23('0x64')){if(_0x108993[_0x3e23('0x60')]['split']('\x20')['length']>0x1){_0x159ca2[_0x26aa9d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3e23('0x65')](_0x108993['value']),null);}else{var _0x4a6efd='%'+_0x108993['value']+'%';_0x159ca2[_0x26aa9d](_0x3e23('0x66'),_0x4a6efd,_0x4a6efd,_0x4a6efd);}}else{_0x3384d6=_['find'](_0x382dbb,['name','ContactId']);_0x108993[_0x3e23('0x4a')]=_0x3e23('0x67');_0xecc18d=as[_0x3e23('0x68')](_0x13c468,_0x3384d6['type'],_0x108993);_0x159ca2[_0x26aa9d](_0xecc18d[_0x3e23('0x69')],_0xecc18d['value'][_0x3e23('0x6a')],_0xecc18d[_0x3e23('0x60')][_0x3e23('0x2c')]);}break;case'Tag':var _0x12e17a=_0x108993['value'][_0x3e23('0x34')](',')['map'](function(_0x3ae366){return Number(_0x3ae366);});_0x12e17a[_0x3e23('0x35')](function(_0x42ab22){_0x10dba2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x42ab22+',%');});_0x2195b5=_[_0x3e23('0x6b')](_0x2195b5,_0x12e17a);break;case _0x3e23('0x6c'):if(_0x108993[_0x3e23('0x6d')]===_0x3e23('0x64')){_0x159ca2[_0x26aa9d](_0x3e23('0x6e'),'%'+_0x108993[_0x3e23('0x60')]+'%',null);}else{_0x3384d6=_[_0x3e23('0x5e')](_0x382dbb,[_0x3e23('0x2e'),'UserId']);_0x108993[_0x3e23('0x4a')]=_0x3e23('0x6f');_0xecc18d=as['buildExpression'](_0x13c468,_0x3384d6['type'],_0x108993);_0x159ca2[_0x26aa9d](_0xecc18d[_0x3e23('0x69')],_0xecc18d[_0x3e23('0x60')][_0x3e23('0x6a')],_0xecc18d[_0x3e23('0x60')][_0x3e23('0x2c')]);}break;case _0x3e23('0x70'):_0xecc18d=as[_0x3e23('0x68')]('me',null,_0x108993);_0x159ca2[_0x26aa9d](_0xecc18d['text'],_0xecc18d[_0x3e23('0x60')][_0x3e23('0x6a')],_0xecc18d[_0x3e23('0x60')]['end']);break;}}else{var _0xecc18d=as['buildExpression'](_0x13c468,_0x3384d6[_0x3e23('0x3b')],_0x108993);_0x159ca2[_0x26aa9d](_0xecc18d['text'],_0xecc18d['value'][_0x3e23('0x6a')],_0xecc18d[_0x3e23('0x60')][_0x3e23('0x2c')]);}}}else{var _0x5cc960=_(_0x41eb94[_0x3e23('0x3e')])[_0x3e23('0x71')]()[_0x3e23('0x30')](function(_0x3c8897){return _[_0x3e23('0x72')](_0x382dbb,[_0x3e23('0x2e'),_0x3c8897])?_0x3c8897:undefined;})['compact']()[_0x3e23('0x60')]();if(!_['isEmpty'](_0x5cc960)){_0x5cc960[_0x3e23('0x35')](function(_0x51535e){if(_0x51535e===_0x3e23('0x73')){_0x3b8a22[_0x3e23('0x74')](_0x3e23('0x75'),[][_0x3e23('0x76')](_0x41eb94[_0x3e23('0x3e')][_0x51535e]));}else if(_0x51535e==='createdAt'){var _0x348378=JSON['parse'](_0x41eb94[_0x3e23('0x3e')][_0x51535e])[_0x3e23('0x77')];var _0x582c91=JSON[_0x3e23('0x78')](_0x41eb94[_0x3e23('0x3e')][_0x51535e])[_0x3e23('0x79')];_0x3b8a22[_0x3e23('0x74')](_0x3e23('0x7a'),_0x348378,_0x582c91);}else{if(_0x41eb94['query'][_0x51535e]===_0x3e23('0x7b')){_0x3b8a22['where']('i.'+_0x51535e+'\x20IS\x20NULL');}else{_0x3b8a22[_0x3e23('0x74')]('i.'+_0x51535e+_0x3e23('0x7c'),_0x41eb94[_0x3e23('0x3e')][_0x51535e]);}}});}if(_0x41eb94[_0x3e23('0x3e')]['read']){if(_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x7d')]==0x1){_0x3b8a22['having'](_0x3e23('0x7e'));}else{_0x3b8a22['having']('`unreadMessages`\x20>\x200');}}if(_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x7f')]){_0x2195b5=_[_0x3e23('0x80')](_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x7f')])?_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x7f')]:new Array(_0x41eb94[_0x3e23('0x3e')]['tag']);_0x2195b5[_0x3e23('0x35')](function(_0x94e884){_0x10dba2['or'](_0x3e23('0x81'),'%,'+_0x94e884+',%');});}if(_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x82')]){var _0x5c4269=_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x82')][_0x3e23('0x83')]('\x5c','\x5c\x5c')[_0x3e23('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5c4269)){_0x159ca2['or']('i.id\x20LIKE\x20?',_0x5c4269+'%')['or'](_0x3e23('0x84'),_0x5c4269+'%');}else{_0x159ca2['or'](_0x3e23('0x85'),qs[_0x3e23('0x65')](_0x5c4269))['or'](_0x3e23('0x86'),_0x5c4269+'%');}}}_0x3b8a22[_0x3e23('0x74')](_0x159ca2);_0x3b8a22['group'](_0x3e23('0x87'));var _0x1df20d={'type':db[_0x3e23('0x88')]['QueryTypes']['SELECT'],'raw':!![]};var _0x44b87b=_0x3b8a22['clone']();_0x44b87b[_0x3e23('0x4a')]('i.id');_0x44b87b[_0x3e23('0x4a')](_0x3e23('0x89'),_0x3e23('0x5f'));if(_0x378303['order']){_0x378303[_0x3e23('0x46')][_0x3e23('0x35')](function(_0x13f50c){var _0x3bbdd3=_0x13f50c[0x0]===_0x3e23('0x8a')?_0x13f50c[0x0]:'i.'+_0x13f50c[0x0];_0x3b8a22['order'](_0x3bbdd3,_0x13f50c[0x1]===_0x3e23('0x8b')?![]:!![]);});}if(!_[_0x3e23('0x8c')](_0x2195b5)){_0x3b8a22[_0x3e23('0x61')](_0x10dba2);_0x44b87b[_0x3e23('0x74')](_0x3e23('0x8d'),_0x2195b5);}BPromise[_0x3e23('0x8e')]()[_0x3e23('0x29')](function(){if(!_0x1e6c86){if(_0x41eb94[_0x3e23('0x3e')]['WhatsappAccountId'])return;_0x44b87b[_0x3e23('0x74')](_0x3e23('0x8f'));_0x3b8a22[_0x3e23('0x74')](_0x3e23('0x8f'));return;}if(_0x41eb94['user']['role']!==_0x3e23('0x90'))return;return _0x41eb94[_0x3e23('0x91')][_0x3e23('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x339a8c){if(_['isEmpty'](_0x339a8c)){_0x44b87b[_0x3e23('0x74')](_0x3e23('0x93'));_0x3b8a22['where'](_0x3e23('0x93'));}else{_0x44b87b[_0x3e23('0x74')](_0x3e23('0x75'),_['map'](_0x339a8c,'id'));_0x3b8a22[_0x3e23('0x74')](_0x3e23('0x75'),_[_0x3e23('0x30')](_0x339a8c,'id'));}});})[_0x3e23('0x29')](function(){if(_0x41eb94[_0x3e23('0x91')][_0x3e23('0x94')]===_0x3e23('0x90')&&!_0x1e6c86&&!_0x41eb94[_0x3e23('0x3e')][_0x3e23('0x73')])return[];return db[_0x3e23('0x95')][_0x3e23('0x3e')](_0x44b87b[_0x3e23('0x96')](),_0x1df20d);})[_0x3e23('0x29')](function(_0x2dcb98){_0x3fbabb['count']=_0x2dcb98[_0x3e23('0x43')];if(_0x3fbabb[_0x3e23('0x23')]===0x0)return[];return db[_0x3e23('0x95')][_0x3e23('0x3e')](_0x56c6f0[_0x3e23('0x96')](),_0x1df20d)[_0x3e23('0x29')](function(_0x124c6f){_0x2d4c2f=_[_0x3e23('0x97')](_0x124c6f,'id');_0x1df20d=_['merge'](_0x1df20d,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41eb94['query']['fields']){_0x378303[_0x3e23('0x41')]['forEach'](function(_0x54241e){_0x3b8a22[_0x3e23('0x4a')]('i.'+_0x54241e);});}else{_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0x89'),_0x3e23('0x5f'));_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0x98'),_0x3e23('0x99'));_0x3b8a22['field'](_0x3e23('0x9a'),_0x3e23('0x9b'));_0x3b8a22['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x3b8a22[_0x3e23('0x4a')]('i.*');_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0x9c'),_0x3e23('0x9d'));_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0x9e'),'Contact.lastName');_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0x9f'),'Contact.email');_0x3b8a22['field'](_0x3e23('0xa0'),_0x3e23('0xa1'));_0x3b8a22['field'](_0x3e23('0xa2'),_0x3e23('0xa3'));_0x3b8a22['field'](_0x3e23('0xa4'),_0x3e23('0xa5'));_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0xa6'),_0x3e23('0xa7'));_0x3b8a22[_0x3e23('0x4a')](_0x3e23('0xa8'),_0x3e23('0xa9'));_0x3b8a22[_0x3e23('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3e23('0x32'));}if(_0x378303[_0x3e23('0x22')])_0x3b8a22[_0x3e23('0x22')](_0x378303['limit']);if(_0x378303['offset'])_0x3b8a22[_0x3e23('0x20')](_0x378303[_0x3e23('0x20')]);return db[_0x3e23('0x95')][_0x3e23('0x3e')](_0x3b8a22[_0x3e23('0x96')](),_0x1df20d);})[_0x3e23('0x29')](function(_0x93c7a4){if(_0x93c7a4[_0x3e23('0x43')]>0x0)_0xfd51e8[_0x3e23('0x74')](_0x3e23('0xaa'),_['map'](_0x93c7a4,'id'));return db[_0x3e23('0x95')][_0x3e23('0x3e')](_0xfd51e8['toString'](),_0x1df20d)[_0x3e23('0x29')](function(_0x902761){var _0x19d448=_[_0x3e23('0xab')](_0x902761,_0x3e23('0xac'));var _0x5b3adc=[];_0x93c7a4[_0x3e23('0x35')](function(_0x4d1325){_0x5b3adc[_0x3e23('0xad')](updateWhatsappInteraction(_0x4d1325,_0x2d4c2f,_0x19d448));});return BPromise[_0x3e23('0xae')](_0x5b3adc);});});})['then'](function(_0x1d6eb0){_0x3fbabb[_0x3e23('0xaf')]=_0x1d6eb0;return _0x3fbabb;})[_0x3e23('0x29')](respondWithFilteredResult(_0x408352,_0x378303))[_0x3e23('0x36')](handleError(_0x408352,null));};exports[_0x3e23('0xb0')]=function(_0x543390,_0x3765c7){var _0x8df177={'raw':![],'where':{'id':_0x543390['params']['id']}},_0x35eba0={};_0x35eba0[_0x3e23('0x3d')]=_[_0x3e23('0x71')](db[_0x3e23('0x38')]['rawAttributes']);_0x35eba0[_0x3e23('0x3e')]=_['keys'](_0x543390[_0x3e23('0x3e')]);_0x35eba0['filters']=_[_0x3e23('0x40')](_0x35eba0['model'],_0x35eba0[_0x3e23('0x3e')]);_0x8df177[_0x3e23('0x41')]=_[_0x3e23('0x40')](_0x35eba0[_0x3e23('0x3d')],qs[_0x3e23('0x42')](_0x543390[_0x3e23('0x3e')][_0x3e23('0x42')]));_0x8df177[_0x3e23('0x41')]=_0x8df177[_0x3e23('0x41')][_0x3e23('0x43')]?_0x8df177['attributes']:_0x35eba0['model'];if(_0x543390[_0x3e23('0x3e')][_0x3e23('0xb1')]){_0x8df177[_0x3e23('0xb2')]=[{'all':!![]}];}_0x8df177=_[_0x3e23('0xb3')]({},_0x8df177,_0x543390[_0x3e23('0xb4')]);return db[_0x3e23('0x38')][_0x3e23('0x5e')](_0x8df177)[_0x3e23('0x29')](handleEntityNotFound(_0x3765c7,null))[_0x3e23('0x29')](respondWithResult(_0x3765c7,null))[_0x3e23('0x36')](handleError(_0x3765c7,null));};exports[_0x3e23('0xb5')]=function(_0x2645c9,_0x4c67b4){return db[_0x3e23('0x38')][_0x3e23('0xb5')](_0x2645c9['body'],{})['then'](respondWithResult(_0x4c67b4,0xc9))[_0x3e23('0x36')](handleError(_0x4c67b4,null));};exports[_0x3e23('0x28')]=function(_0x5e4363,_0x42e235){if(_0x5e4363['body']['id']){delete _0x5e4363[_0x3e23('0x70')]['id'];}return db[_0x3e23('0x38')][_0x3e23('0x5e')]({'where':{'id':_0x5e4363[_0x3e23('0xb6')]['id']}})[_0x3e23('0x29')](handleEntityNotFound(_0x42e235,null))[_0x3e23('0x29')](saveUpdates(_0x5e4363[_0x3e23('0x70')],null))[_0x3e23('0x29')](respondWithResult(_0x42e235,null))[_0x3e23('0x36')](handleError(_0x42e235,null));};exports[_0x3e23('0x2a')]=function(_0x2a9f97,_0x591945){return db[_0x3e23('0x38')][_0x3e23('0x5e')]({'where':{'id':_0x2a9f97['params']['id']}})[_0x3e23('0x29')](handleEntityNotFound(_0x591945,null))['then'](removeEntity(_0x591945,null))[_0x3e23('0x36')](handleError(_0x591945,null));};exports[_0x3e23('0xb7')]=function(_0x373cac,_0xfb75b){return db[_0x3e23('0x38')][_0x3e23('0xb7')]()[_0x3e23('0x29')](respondWithResult(_0xfb75b,null))[_0x3e23('0x36')](handleError(_0xfb75b,null));};exports[_0x3e23('0xb8')]=function(_0x3329d6,_0x2223f7,_0x5a22e7){return db[_0x3e23('0xb9')]['find']({'where':{'id':_0x3329d6[_0x3e23('0xb6')]['id']}})[_0x3e23('0x29')](handleEntityNotFound(_0x2223f7,null))[_0x3e23('0x29')](function(_0x25cb08){if(_0x25cb08){return _0x25cb08[_0x3e23('0xb8')](_0x3329d6[_0x3e23('0x70')]['ids'],_['omit'](_0x3329d6[_0x3e23('0x70')],[_0x3e23('0xba'),'id'])||{});}})['then'](respondWithResult(_0x2223f7,null))[_0x3e23('0x36')](handleError(_0x2223f7,null));};exports['getMessages']=function(_0x183730,_0x56212a,_0x52c5fd){var _0x245b3c={'raw':![],'where':{}};var _0x1e847a={};var _0x66e68f={'count':0x0,'rows':[]};return db[_0x3e23('0x38')][_0x3e23('0xbb')]({'where':{'id':_0x183730[_0x3e23('0xb6')]['id']}})[_0x3e23('0x29')](handleEntityNotFound(_0x56212a,null))[_0x3e23('0x29')](function(_0x4037d3){if(_0x4037d3){_0x1e847a[_0x3e23('0x3d')]=_[_0x3e23('0x71')](db[_0x3e23('0xb9')]['rawAttributes']);_0x1e847a[_0x3e23('0x3e')]=_[_0x3e23('0x71')](_0x183730['query']);_0x1e847a[_0x3e23('0x3f')]=_['intersection'](_0x1e847a[_0x3e23('0x3d')],_0x1e847a[_0x3e23('0x3e')]);_0x245b3c[_0x3e23('0x41')]=_[_0x3e23('0x40')](_0x1e847a['model'],qs[_0x3e23('0x42')](_0x183730[_0x3e23('0x3e')][_0x3e23('0x42')]));_0x245b3c[_0x3e23('0x41')]=_0x245b3c[_0x3e23('0x41')][_0x3e23('0x43')]?_0x245b3c[_0x3e23('0x41')]:_0x1e847a[_0x3e23('0x3d')];if(!_0x183730[_0x3e23('0x3e')][_0x3e23('0x44')]('nolimit')){_0x245b3c[_0x3e23('0x22')]=qs[_0x3e23('0x22')](_0x183730['query'][_0x3e23('0x22')]);_0x245b3c[_0x3e23('0x20')]=qs[_0x3e23('0x20')](_0x183730[_0x3e23('0x3e')][_0x3e23('0x20')]);}_0x245b3c['order']=qs['sort'](_0x183730[_0x3e23('0x3e')][_0x3e23('0x47')]);_0x245b3c[_0x3e23('0x74')]=qs[_0x3e23('0x3f')](_[_0x3e23('0x48')](_0x183730[_0x3e23('0x3e')],_0x1e847a['filters']));_0x245b3c[_0x3e23('0x74')][_0x3e23('0xac')]=_0x4037d3['id'];if(_0x183730[_0x3e23('0x3e')][_0x3e23('0x82')]){_0x245b3c[_0x3e23('0x74')]=_[_0x3e23('0xb3')](_0x245b3c[_0x3e23('0x74')],{'$or':_['map'](_0x245b3c['attributes'],function(_0x36f4b3){var _0x3d0142={};_0x3d0142[_0x36f4b3]={'$like':'%'+_0x183730['query'][_0x3e23('0x82')]+'%'};return _0x3d0142;})});}if(_0x183730[_0x3e23('0x3e')]['$gte']){var _0x4fc372=_0x183730[_0x3e23('0x3e')][_0x3e23('0x77')][_0x3e23('0x34')](',');var _0x496285={};_0x496285[_0x4fc372[0x0]]={'$gte':moment(_0x4fc372[0x1])['format'](_0x3e23('0xbc'))};_0x245b3c[_0x3e23('0x74')]=_[_0x3e23('0xb3')](_0x245b3c[_0x3e23('0x74')],_0x496285);}_0x245b3c=_[_0x3e23('0xb3')]({},_0x245b3c,_0x183730[_0x3e23('0xb4')]);return db[_0x3e23('0xb9')][_0x3e23('0x23')]({'where':_0x245b3c[_0x3e23('0x74')]})[_0x3e23('0x29')](function(_0x18e05a){_0x66e68f[_0x3e23('0x23')]=_0x18e05a;if(_0x183730[_0x3e23('0x3e')][_0x3e23('0xb1')]){_0x245b3c['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x3e23('0xbd')](_0x245b3c);})['then'](function(_0x39bbc1){_0x66e68f['rows']=_0x39bbc1;return _0x66e68f;});}})['then'](respondWithFilteredResult(_0x56212a,_0x245b3c))['catch'](handleError(_0x56212a,null));};exports['addTags']=function(_0x3dbe29,_0x1c5e2b,_0x9d0810){return db['WhatsappInteraction'][_0x3e23('0x5e')]({'where':{'id':_0x3dbe29['params']['id']}})[_0x3e23('0x29')](handleEntityNotFound(_0x1c5e2b,null))[_0x3e23('0x29')](function(_0x1fc63e){if(_0x1fc63e){return _0x1fc63e[_0x3e23('0xbe')](_0x3dbe29[_0x3e23('0x70')][_0x3e23('0xba')],_[_0x3e23('0xbf')](_0x3dbe29['body'],[_0x3e23('0xba'),'id'])||{})[_0x3e23('0xc0')](function(){return db['Tag'][_0x3e23('0xbd')]({'attributes':['id',_0x3e23('0x2e'),_0x3e23('0xc1')],'where':{'id':_0x3dbe29[_0x3e23('0x70')][_0x3e23('0xba')]}});})['then'](function(_0x3782f0){socket['emit'](_0x3e23('0xc2'),{'id':Number(_0x3dbe29[_0x3e23('0xb6')]['id']),'tags':_0x3782f0||[]});return{'id':Number(_0x3dbe29[_0x3e23('0xb6')]['id']),'tags':_0x3782f0||[]};});}})[_0x3e23('0x29')](respondWithResult(_0x1c5e2b,null))['catch'](handleError(_0x1c5e2b,null));};exports[_0x3e23('0xc3')]=function(_0x2f902c,_0x4d2019,_0x447c04){return db[_0x3e23('0x38')][_0x3e23('0x5e')]({'where':{'id':_0x2f902c[_0x3e23('0xb6')]['id']}})['then'](handleEntityNotFound(_0x4d2019,null))[_0x3e23('0x29')](function(_0x4476fa){if(_0x4476fa){return _0x4476fa['removeTags'](_0x2f902c[_0x3e23('0x3e')]['ids']);}})[_0x3e23('0x29')](respondWithStatusCode(_0x4d2019,null))[_0x3e23('0x36')](handleError(_0x4d2019,null));};exports[_0x3e23('0xc4')]=function(_0x3d0d23,_0x3872c9){var _0x1227ef=moment()[_0x3e23('0xc5')]()[_0x3e23('0x96')]();var _0xc26f1c=path[_0x3e23('0xc6')](config[_0x3e23('0xc7')],_0x3e23('0xc8'),_0x3e23('0xc9'),_0x3e23('0xca'));var _0x1c9776=path[_0x3e23('0xc6')](config[_0x3e23('0xc7')],'server','files',_0x3e23('0xcb'));var _0x11d2d3=path['join'](_0xc26f1c,_0x1227ef);var _0x2365eb=util[_0x3e23('0xcc')]('transcript-%d-%s.zip',_0x3d0d23[_0x3e23('0xb6')]['id'],_0x1227ef);var _0x2a9878=path[_0x3e23('0xc6')](_0xc26f1c,_0x2365eb);var _0x5979c3=[];_0x5979c3[_0x3e23('0xad')]({'model':db[_0x3e23('0x6c')],'as':_0x3e23('0x6c'),'attributes':['id',_0x3e23('0x31')],'raw':!![]});_0x5979c3[_0x3e23('0xad')]({'model':db[_0x3e23('0xcd')],'as':'Contact','attributes':['id',_0x3e23('0xce'),_0x3e23('0xcf')],'raw':!![]});if(_0x3d0d23['query'][_0x3e23('0xcb')]){_0x5979c3[_0x3e23('0xad')]({'model':db[_0x3e23('0xd0')],'as':_0x3e23('0xd0'),'raw':!![]});}var _0x36833d=[{'model':db[_0x3e23('0xb9')],'as':_0x3e23('0xd1'),'attributes':['id',_0x3e23('0x70'),'createdAt',_0x3e23('0xd2'),_0x3e23('0xd3'),_0x3e23('0x7d')],'include':_0x5979c3}];_0x36833d['push']({'model':db[_0x3e23('0xd4')],'as':_0x3e23('0xd5'),'attributes':['id',_0x3e23('0x2e')]});_0x36833d[_0x3e23('0xad')]({'model':db[_0x3e23('0x6c')],'as':_0x3e23('0xd6'),'attributes':['id',_0x3e23('0x31')]});return db[_0x3e23('0x38')][_0x3e23('0x5e')]({'where':{'id':_0x3d0d23[_0x3e23('0xb6')]['id']},'include':_0x36833d})[_0x3e23('0x29')](handleEntityNotFound(_0x3872c9,null))[_0x3e23('0x29')](function(_0x24d450){if(_0x24d450){var _0x545860=_0x24d450['get']({'plain':!![]});fs['mkdirSync'](_0x11d2d3);var _0x148ee6={'channel':_0x3e23('0xd7'),'account':_0x545860['Account'][_0x3e23('0x2e')],'agent':_0x545860['Owner']?_0x545860['Owner'][_0x3e23('0x31')]:_0x3e23('0xd8'),'createdAt':moment(_0x545860[_0x3e23('0xd9')])['format'](_0x3e23('0xbc'))[_0x3e23('0x96')](),'closedAt':_0x545860[_0x3e23('0xda')]?moment(_0x545860[_0x3e23('0xdb')])['format'](_0x3e23('0xbc'))[_0x3e23('0x96')]():'','disposition':_0x545860[_0x3e23('0xdc')],'messages':_(_0x545860[_0x3e23('0xd1')])['filter']({'secret':![]})[_0x3e23('0x30')](function(_0xbafb62){if(_0xbafb62[_0x3e23('0xd0')]){var _0x15ddaf=path[_0x3e23('0xc6')](_0x1c9776,_0xbafb62['Attachment']['basename']);if(fs[_0x3e23('0xdd')](_0x15ddaf)){fs['createReadStream'](_0x15ddaf)[_0x3e23('0xde')](fs[_0x3e23('0xdf')](path[_0x3e23('0xc6')](_0x11d2d3,_0xbafb62[_0x3e23('0xd0')][_0x3e23('0xe0')])));}}return{'date':moment(_0xbafb62['createdAt'])[_0x3e23('0xcc')](_0x3e23('0xbc'))[_0x3e23('0x96')](),'sender':_0xbafb62[_0x3e23('0xd2')]===_0x3e23('0xe1')?_0xbafb62[_0x3e23('0x6c')]?_0xbafb62[_0x3e23('0x6c')][_0x3e23('0x31')]:_0x3e23('0xe2'):_0xbafb62[_0x3e23('0xe3')][_0x3e23('0xce')]+(_0xbafb62[_0x3e23('0xe3')][_0x3e23('0xcf')]?'\x20'+_0xbafb62['Contact']['lastName']:''),'body':_0xbafb62[_0x3e23('0xd0')]?_0xbafb62['Attachment']['basename']:_0xbafb62[_0x3e23('0x70')],'direction':_0xbafb62[_0x3e23('0xd2')]===_0x3e23('0xe1')?'A':'C','secret':_0xbafb62[_0x3e23('0xd3')],'read':_0xbafb62[_0x3e23('0x7d')],'attachment':_0xbafb62[_0x3e23('0xd0')]};})[_0x3e23('0x60')]()};return ejs[_0x3e23('0xe4')](path[_0x3e23('0xc6')](config[_0x3e23('0xc7')],_0x3e23('0xc8'),_0x3e23('0xe5'),_0x3e23('0xe6')),{'interaction':_0x148ee6})['then'](function(_0x57b02e){var _0x1c07a8=path[_0x3e23('0xc6')](_0x11d2d3,_0x3e23('0xe7')+_0x545860['id']+'-'+_0x1227ef+_0x3e23('0xe8'));var _0x17eef1={'path':_0x1c07a8,'channel':_0x3e23('0xd7'),'interactionId':_0x545860['id']};return pdf[_0x3e23('0xe9')](_0x57b02e,_0x17eef1);})[_0x3e23('0x29')](function(){return new BPromise(function(_0x167798,_0x2825fe){zipdir(_0x11d2d3,{'saveTo':_0x2a9878},function(_0xf2e333,_0x22a1c8){if(_0xf2e333)return _0x2825fe(_0xf2e333);return _0x167798(_0x22a1c8);});})['then'](function(){return new BPromise(function(_0x28c55e,_0x3cb683){rimraf(_0x11d2d3,function(_0x36b7e8){if(_0x36b7e8)_0x3cb683(_0x36b7e8);return _0x28c55e();});});})['then'](function(){return _0x3872c9[_0x3e23('0xc4')](_0x2a9878,_0x2365eb,function(_0x361160){if(_0x361160){console[_0x3e23('0xea')](_0x3e23('0xeb'),_0x361160);}else{fs[_0x3e23('0xec')](_0x2a9878);}});});});}else{return _0x3872c9['sendStatus'](0xc8);}})[_0x3e23('0x36')](handleError(_0x3872c9,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index c650d38..19d2cc3 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 _0x4e61=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','events','../../mysqldb','WhatsappInteraction','setMaxListeners'];(function(_0x39324b,_0x3318d0){var _0xa28af9=function(_0x2a3797){while(--_0x2a3797){_0x39324b['push'](_0x39324b['shift']());}};_0xa28af9(++_0x3318d0);}(_0x4e61,0x8c));var _0x14e6=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0x4e61[_0x3f55de];return _0x2698de;};'use strict';var EventEmitter=require(_0x14e6('0x0'));var WhatsappInteraction=require(_0x14e6('0x1'))['db'][_0x14e6('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x14e6('0x3')](0x0);var events={'afterCreate':_0x14e6('0x4'),'afterUpdate':_0x14e6('0x5'),'afterDestroy':_0x14e6('0x6')};function emitEvent(_0x1cef29){return function(_0x2b4538,_0x723ba9,_0x5ae983){_0x2b4538[_0x14e6('0x7')]({'attributes':['id'],'raw':!![]})[_0x14e6('0x8')](function(_0x2a5bc1){_0x2b4538[_0x14e6('0x9')](_0x14e6('0xa'),_0x2a5bc1[_0x14e6('0xb')](function(_0x24326b){return{'id':_0x24326b['id']};}));return WhatsappMessage[_0x14e6('0xc')]({'where':{'WhatsappInteractionId':_0x2b4538['id'],'direction':'in','read':![]},'raw':!![]});})[_0x14e6('0x8')](function(_0x40ce5d){_0x2b4538['setDataValue'](_0x14e6('0xd'),_0x40ce5d[_0x14e6('0xe')]);WhatsappInteractionEvents[_0x14e6('0xf')](_0x1cef29+':'+_0x2b4538['id'],_0x2b4538);WhatsappInteractionEvents[_0x14e6('0xf')](_0x1cef29,_0x2b4538);_0x5ae983(null);})['catch'](_0x5ae983(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x402f=['then','map','findAll','setDataValue','unreadMessages','length','emit','events','WhatsappInteraction','setMaxListeners','save','update','getUsers'];(function(_0x5b6786,_0x1636cc){var _0x5c409c=function(_0x279db6){while(--_0x279db6){_0x5b6786['push'](_0x5b6786['shift']());}};_0x5c409c(++_0x1636cc);}(_0x402f,0x6f));var _0xf402=function(_0x458a6e,_0xc6a2ec){_0x458a6e=_0x458a6e-0x0;var _0x3ad477=_0x402f[_0x458a6e];return _0x3ad477;};'use strict';var EventEmitter=require(_0xf402('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xf402('0x1')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf402('0x2')](0x0);var events={'afterCreate':_0xf402('0x3'),'afterUpdate':_0xf402('0x4'),'afterDestroy':'remove'};function emitEvent(_0x246c5f){return function(_0x48771a,_0x20c2cc,_0x270766){_0x48771a[_0xf402('0x5')]({'attributes':['id'],'raw':!![]})[_0xf402('0x6')](function(_0xa1b27d){_0x48771a['setDataValue']('Users',_0xa1b27d[_0xf402('0x7')](function(_0x154bd3){return{'id':_0x154bd3['id']};}));return WhatsappMessage[_0xf402('0x8')]({'where':{'WhatsappInteractionId':_0x48771a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf402('0x6')](function(_0x18c918){_0x48771a[_0xf402('0x9')](_0xf402('0xa'),_0x18c918[_0xf402('0xb')]);WhatsappInteractionEvents['emit'](_0x246c5f+':'+_0x48771a['id'],_0x48771a);WhatsappInteractionEvents[_0xf402('0xc')](_0x246c5f,_0x48771a);_0x270766(null);})['catch'](_0x270766(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f911964..e58df7a 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 _0x64c2=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','changed','closed','closedAt','format'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x64c2,0x71));var _0x264c=function(_0x510a2e,_0x10dd03){_0x510a2e=_0x510a2e-0x0;var _0x296bb4=_0x64c2[_0x510a2e];return _0x296bb4;};'use strict';var _=require(_0x264c('0x0'));var util=require(_0x264c('0x1'));var logger=require(_0x264c('0x2'))(_0x264c('0x3'));var moment=require(_0x264c('0x4'));var BPromise=require(_0x264c('0x5'));var rp=require(_0x264c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x264c('0x7'));var config=require(_0x264c('0x8'));var attributes=require(_0x264c('0x9'));module[_0x264c('0xa')]=function(_0x49f2a1,_0x1d1a73){return _0x49f2a1['define']('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f33e7,_0x2b9572,_0x119d3c){if(_0x4f33e7[_0x264c('0xb')](_0x264c('0xc'))){_0x4f33e7[_0x264c('0xd')]=moment()[_0x264c('0xe')](_0x264c('0xf'));}_0x119d3c(null,_0x4f33e7);}}});}; \ No newline at end of file +var _0x920c=['util','../../config/logger','api','request-promise','rimraf','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x920c,0x152));var _0xc920=function(_0x5b8499,_0x131622){_0x5b8499=_0x5b8499-0x0;var _0x50aa33=_0x920c[_0x5b8499];return _0x50aa33;};'use strict';var _=require('lodash');var util=require(_0xc920('0x0'));var logger=require(_0xc920('0x1'))(_0xc920('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc920('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc920('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xc920('0x5')]=function(_0x4fca9f,_0x352142){return _0x4fca9f[_0xc920('0x6')](_0xc920('0x7'),attributes,{'tableName':_0xc920('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x495446,_0xd43c87,_0x46b09d){if(_0x495446[_0xc920('0x9')](_0xc920('0xa'))){_0x495446['closedAt']=moment()[_0xc920('0xb')](_0xc920('0xc'));}_0x46b09d(null,_0x495446);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 186c57d..e88a10c 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 _0x8f52=['omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappInteraction','update','options','raw','where','limit','UpdateWhatsappInteraction','find','addTags','body','ids'];(function(_0x209dfc,_0xf610e5){var _0x48e378=function(_0x496f09){while(--_0x496f09){_0x209dfc['push'](_0x209dfc['shift']());}};_0x48e378(++_0xf610e5);}(_0x8f52,0x1ef));var _0x28f5=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0x8f52[_0x1e3c02];return _0x4d26d7;};'use strict';var _=require(_0x28f5('0x0'));var util=require(_0x28f5('0x1'));var moment=require(_0x28f5('0x2'));var BPromise=require(_0x28f5('0x3'));var rs=require(_0x28f5('0x4'));var fs=require('fs');var Redis=require(_0x28f5('0x5'));var db=require(_0x28f5('0x6'))['db'];var utils=require(_0x28f5('0x7'));var logger=require(_0x28f5('0x8'))(_0x28f5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x28f5('0xa')][_0x28f5('0xb')]({'port':0x232a});config[_0x28f5('0xc')]=_[_0x28f5('0xd')](config[_0x28f5('0xc')],{'host':_0x28f5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28f5('0xc')]));require(_0x28f5('0xf'))[_0x28f5('0x10')](socket);function respondWithRpcPromise(_0x484e8e,_0x22d103,_0x1c4a2b){return new BPromise(function(_0x1059fe,_0x316067){return client['request'](_0x484e8e,_0x1c4a2b)[_0x28f5('0x11')](function(_0x3869a3){logger[_0x28f5('0x12')](_0x28f5('0x13'),_0x22d103,'request\x20sent');logger[_0x28f5('0x14')](_0x28f5('0x15'),_0x22d103,'request\x20sent',JSON[_0x28f5('0x16')](_0x3869a3));if(_0x3869a3['error']){if(_0x3869a3[_0x28f5('0x17')]['code']===0x1f4){logger['error'](_0x28f5('0x13'),_0x22d103,_0x3869a3['error'][_0x28f5('0x18')]);return _0x316067(_0x3869a3[_0x28f5('0x17')][_0x28f5('0x18')]);}logger[_0x28f5('0x17')](_0x28f5('0x13'),_0x22d103,_0x3869a3['error'][_0x28f5('0x18')]);return _0x1059fe(_0x3869a3[_0x28f5('0x17')][_0x28f5('0x18')]);}else{logger['info'](_0x28f5('0x13'),_0x22d103,'request\x20sent');_0x1059fe(_0x3869a3[_0x28f5('0x19')][_0x28f5('0x18')]);}})[_0x28f5('0x1a')](function(_0x2111c5){logger[_0x28f5('0x17')](_0x28f5('0x13'),_0x22d103,_0x2111c5);_0x316067(_0x2111c5);});});}exports['UpdateWhatsappInteraction']=function(_0x146235){var _0x50bbac=this;return new Promise(function(_0xf84e24,_0x2b1d06){return db[_0x28f5('0x1b')][_0x28f5('0x1c')](_0x146235['body'],{'raw':_0x146235['options']?_0x146235[_0x28f5('0x1d')][_0x28f5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x146235['options']?_0x146235[_0x28f5('0x1d')][_0x28f5('0x1f')]||null:null,'attributes':_0x146235[_0x28f5('0x1d')]?_0x146235[_0x28f5('0x1d')]['attributes']||null:null,'limit':_0x146235[_0x28f5('0x1d')]?_0x146235['options'][_0x28f5('0x20')]||null:null})[_0x28f5('0x11')](function(_0x566351){logger[_0x28f5('0x12')](_0x28f5('0x21'),_0x146235);logger[_0x28f5('0x14')](_0x28f5('0x21'),_0x146235,JSON[_0x28f5('0x16')](_0x566351));_0xf84e24(_0x566351);})[_0x28f5('0x1a')](function(_0x940d26){logger[_0x28f5('0x17')]('UpdateWhatsappInteraction',_0x940d26[_0x28f5('0x18')],_0x146235);_0x2b1d06(_0x50bbac['error'](0x1f4,_0x940d26['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x463548){return new Promise(function(_0x2d1b6e,_0x381f1f){return db[_0x28f5('0x1b')][_0x28f5('0x22')]({'where':_0x463548['options']?_0x463548[_0x28f5('0x1d')][_0x28f5('0x1f')]||null:null})[_0x28f5('0x11')](function(_0x40eaca){if(_0x40eaca){return _0x40eaca[_0x28f5('0x23')](_0x463548[_0x28f5('0x24')][_0x28f5('0x25')],_[_0x28f5('0x26')](_0x463548['body'],[_0x28f5('0x25'),'id'])||{});}})[_0x28f5('0x27')](function(_0x10e209){logger[_0x28f5('0x12')](_0x28f5('0x28'),_0x463548);logger['debug'](_0x28f5('0x28'),_0x463548,JSON['stringify'](_0x10e209));_0x2d1b6e(_0x10e209);})[_0x28f5('0x1a')](function(_0x488b49){logger[_0x28f5('0x17')](_0x28f5('0x28'),_0x488b49[_0x28f5('0x18')],_0x463548);_0x381f1f(_this['error'](0x1f4,_0x488b49[_0x28f5('0x18')]));});});}; \ No newline at end of file +var _0xbd21=['code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','then','find','addTags','ids','spread','AddTags','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd21,0x8d));var _0x1bd2=function(_0x23bcf4,_0x17c810){_0x23bcf4=_0x23bcf4-0x0;var _0x1e2938=_0xbd21[_0x23bcf4];return _0x1e2938;};'use strict';var _=require('lodash');var util=require(_0x1bd2('0x0'));var moment=require(_0x1bd2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bd2('0x2'))['db'];var utils=require(_0x1bd2('0x3'));var logger=require(_0x1bd2('0x4'))(_0x1bd2('0x5'));var config=require(_0x1bd2('0x6'));var jayson=require(_0x1bd2('0x7'));var client=jayson[_0x1bd2('0x8')][_0x1bd2('0x9')]({'port':0x232a});config[_0x1bd2('0xa')]=_[_0x1bd2('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1bd2('0xc'))(new Redis(config[_0x1bd2('0xa')]));require(_0x1bd2('0xd'))[_0x1bd2('0xe')](socket);function respondWithRpcPromise(_0x1bae44,_0x4f2a55,_0x27d6f9){return new BPromise(function(_0x59003e,_0x114e36){return client[_0x1bd2('0xf')](_0x1bae44,_0x27d6f9)['then'](function(_0x474d5){logger[_0x1bd2('0x10')](_0x1bd2('0x11'),_0x4f2a55,_0x1bd2('0x12'));logger[_0x1bd2('0x13')](_0x1bd2('0x14'),_0x4f2a55,'request\x20sent',JSON[_0x1bd2('0x15')](_0x474d5));if(_0x474d5['error']){if(_0x474d5[_0x1bd2('0x16')][_0x1bd2('0x17')]===0x1f4){logger[_0x1bd2('0x16')](_0x1bd2('0x11'),_0x4f2a55,_0x474d5[_0x1bd2('0x16')][_0x1bd2('0x18')]);return _0x114e36(_0x474d5[_0x1bd2('0x16')][_0x1bd2('0x18')]);}logger[_0x1bd2('0x16')](_0x1bd2('0x11'),_0x4f2a55,_0x474d5[_0x1bd2('0x16')]['message']);return _0x59003e(_0x474d5['error'][_0x1bd2('0x18')]);}else{logger[_0x1bd2('0x10')](_0x1bd2('0x11'),_0x4f2a55,_0x1bd2('0x12'));_0x59003e(_0x474d5[_0x1bd2('0x19')]['message']);}})[_0x1bd2('0x1a')](function(_0x1710ab){logger[_0x1bd2('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x4f2a55,_0x1710ab);_0x114e36(_0x1710ab);});});}exports[_0x1bd2('0x1b')]=function(_0x24d60a){var _0xf3db8f=this;return new Promise(function(_0x257ac2,_0x3bc469){return db[_0x1bd2('0x1c')][_0x1bd2('0x1d')](_0x24d60a[_0x1bd2('0x1e')],{'raw':_0x24d60a[_0x1bd2('0x1f')]?_0x24d60a[_0x1bd2('0x1f')][_0x1bd2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d60a[_0x1bd2('0x1f')]?_0x24d60a['options'][_0x1bd2('0x21')]||null:null,'attributes':_0x24d60a[_0x1bd2('0x1f')]?_0x24d60a[_0x1bd2('0x1f')][_0x1bd2('0x22')]||null:null,'limit':_0x24d60a['options']?_0x24d60a[_0x1bd2('0x1f')]['limit']||null:null})[_0x1bd2('0x23')](function(_0x53d117){logger[_0x1bd2('0x10')](_0x1bd2('0x1b'),_0x24d60a);logger[_0x1bd2('0x13')](_0x1bd2('0x1b'),_0x24d60a,JSON[_0x1bd2('0x15')](_0x53d117));_0x257ac2(_0x53d117);})[_0x1bd2('0x1a')](function(_0x439a68){logger['error'](_0x1bd2('0x1b'),_0x439a68[_0x1bd2('0x18')],_0x24d60a);_0x3bc469(_0xf3db8f[_0x1bd2('0x16')](0x1f4,_0x439a68[_0x1bd2('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x5d215a){return new Promise(function(_0x385049,_0xe3b0a0){return db[_0x1bd2('0x1c')][_0x1bd2('0x24')]({'where':_0x5d215a['options']?_0x5d215a[_0x1bd2('0x1f')][_0x1bd2('0x21')]||null:null})[_0x1bd2('0x23')](function(_0x4224c7){if(_0x4224c7){return _0x4224c7[_0x1bd2('0x25')](_0x5d215a[_0x1bd2('0x1e')][_0x1bd2('0x26')],_['omit'](_0x5d215a[_0x1bd2('0x1e')],['ids','id'])||{});}})[_0x1bd2('0x27')](function(_0x20d49b){logger['info'](_0x1bd2('0x28'),_0x5d215a);logger[_0x1bd2('0x13')](_0x1bd2('0x28'),_0x5d215a,JSON[_0x1bd2('0x15')](_0x20d49b));_0x385049(_0x20d49b);})[_0x1bd2('0x1a')](function(_0x1b472c){logger[_0x1bd2('0x16')](_0x1bd2('0x28'),_0x1b472c[_0x1bd2('0x18')],_0x5d215a);_0xe3b0a0(_this[_0x1bd2('0x16')](0x1f4,_0x1b472c[_0x1bd2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 8e855fa..f89aa79 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 _0x683a=['whatsappInteraction:','./whatsappInteraction.events','remove','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x683a,0xf6));var _0xa683=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x683a[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0xa683('0x0'));var events=['save',_0xa683('0x1'),'update'];function createListener(_0x365321,_0x25a067){return function(_0xff4c9e){_0x25a067[_0xa683('0x2')](_0x365321,_0xff4c9e);};}function removeListener(_0x4679f2,_0xfb3c9c){return function(){WhatsappInteractionEvents[_0xa683('0x3')](_0x4679f2,_0xfb3c9c);};}exports[_0xa683('0x4')]=function(_0x3f9453){for(var _0x293fb0=0x0,_0x162ce6=events[_0xa683('0x5')];_0x293fb0<_0x162ce6;_0x293fb0++){var _0x534373=events[_0x293fb0];var _0x4146dd=createListener(_0xa683('0x6')+_0x534373,_0x3f9453);WhatsappInteractionEvents['on'](_0x534373,_0x4146dd);}}; \ No newline at end of file +var _0xf619=['emit','register','length','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0xc52550,_0x53feb1){var _0x30605b=function(_0x2fcdf8){while(--_0x2fcdf8){_0xc52550['push'](_0xc52550['shift']());}};_0x30605b(++_0x53feb1);}(_0xf619,0xe4));var _0x9f61=function(_0x126761,_0x485246){_0x126761=_0x126761-0x0;var _0xb77d80=_0xf619[_0x126761];return _0xb77d80;};'use strict';var WhatsappInteractionEvents=require(_0x9f61('0x0'));var events=['save',_0x9f61('0x1'),_0x9f61('0x2')];function createListener(_0x216e81,_0x33d91f){return function(_0x4016a9){_0x33d91f[_0x9f61('0x3')](_0x216e81,_0x4016a9);};}function removeListener(_0x4d9854,_0x5dc9b2){return function(){WhatsappInteractionEvents['removeListener'](_0x4d9854,_0x5dc9b2);};}exports[_0x9f61('0x4')]=function(_0x6a543f){for(var _0x26197c=0x0,_0x5df222=events[_0x9f61('0x5')];_0x26197c<_0x5df222;_0x26197c++){var _0xd4d324=events[_0x26197c];var _0x44e6f=createListener(_0x9f61('0x6')+_0xd4d324,_0x6a543f);WhatsappInteractionEvents['on'](_0xd4d324,_0x44e6f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 673e83a..5c27736 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 _0x7c91=['/:id','destroy','exports','multer','connect-timeout','Router','fs-extra','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x24123d,_0x35b969){var _0x5ddecf=function(_0x539873){while(--_0x539873){_0x24123d['push'](_0x24123d['shift']());}};_0x5ddecf(++_0x35b969);}(_0x7c91,0x199));var _0x17c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c91[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x17c9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x17c9('0x1'));var express=require('express');var router=express[_0x17c9('0x2')]();var fs_extra=require(_0x17c9('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x17c9('0x4'));var controller=require(_0x17c9('0x5'));router[_0x17c9('0x6')]('/',auth['isAuthenticated'](),controller[_0x17c9('0x7')]);router[_0x17c9('0x6')](_0x17c9('0x8'),auth[_0x17c9('0x9')](),controller[_0x17c9('0xa')]);router[_0x17c9('0x6')]('/:id',auth[_0x17c9('0x9')](),controller[_0x17c9('0xb')]);router[_0x17c9('0xc')]('/',auth[_0x17c9('0x9')](),interaction[_0x17c9('0xd')](_0x17c9('0xe'),_0x17c9('0xf')),controller[_0x17c9('0x10')]);router[_0x17c9('0xc')](_0x17c9('0x11'),controller[_0x17c9('0x12')]);router[_0x17c9('0x13')]('/:id',auth[_0x17c9('0x9')](),controller[_0x17c9('0x14')]);router[_0x17c9('0x13')](_0x17c9('0x15'),auth[_0x17c9('0x9')](),controller[_0x17c9('0x16')]);router[_0x17c9('0x13')](_0x17c9('0x17'),auth['isAuthenticated'](),controller[_0x17c9('0x18')]);router[_0x17c9('0x19')](_0x17c9('0x1a'),auth[_0x17c9('0x9')](),controller[_0x17c9('0x1b')]);module[_0x17c9('0x1c')]=router; \ No newline at end of file +var _0x2c9e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','whatsapp','create','post','/:id/status','put','update','/:id/accept','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5eb868,_0x3edfb0){var _0x278458=function(_0x266273){while(--_0x266273){_0x5eb868['push'](_0x5eb868['shift']());}};_0x278458(++_0x3edfb0);}(_0x2c9e,0x12f));var _0xe2c9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2c9e[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xe2c9('0x0'));var util=require(_0xe2c9('0x1'));var path=require(_0xe2c9('0x2'));var timeout=require(_0xe2c9('0x3'));var express=require(_0xe2c9('0x4'));var router=express[_0xe2c9('0x5')]();var fs_extra=require(_0xe2c9('0x6'));var auth=require(_0xe2c9('0x7'));var interaction=require(_0xe2c9('0x8'));var config=require(_0xe2c9('0x9'));var controller=require('./whatsappMessage.controller');router[_0xe2c9('0xa')]('/',auth[_0xe2c9('0xb')](),controller[_0xe2c9('0xc')]);router[_0xe2c9('0xa')](_0xe2c9('0xd'),auth[_0xe2c9('0xb')](),controller[_0xe2c9('0xe')]);router['get'](_0xe2c9('0xf'),auth[_0xe2c9('0xb')](),controller[_0xe2c9('0x10')]);router['post']('/',auth[_0xe2c9('0xb')](),interaction[_0xe2c9('0x11')](_0xe2c9('0x12'),'whatsappmessage:create'),controller[_0xe2c9('0x13')]);router[_0xe2c9('0x14')](_0xe2c9('0x15'),controller['status']);router[_0xe2c9('0x16')](_0xe2c9('0xf'),auth[_0xe2c9('0xb')](),controller[_0xe2c9('0x17')]);router[_0xe2c9('0x16')](_0xe2c9('0x18'),auth[_0xe2c9('0xb')](),controller['accept']);router[_0xe2c9('0x16')]('/:id/reject',auth[_0xe2c9('0xb')](),controller['reject']);router[_0xe2c9('0x19')]('/:id',auth[_0xe2c9('0xb')](),controller[_0xe2c9('0x1a')]);module[_0xe2c9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 96994a2..b286209 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 _0x4577=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x5401ae,_0x5e58ac){var _0x286068=function(_0x2cac88){while(--_0x2cac88){_0x5401ae['push'](_0x5401ae['shift']());}};_0x286068(++_0x5e58ac);}(_0x4577,0x117));var _0x7457=function(_0x5d3f51,_0x3025b6){_0x5d3f51=_0x5d3f51-0x0;var _0x24bcdb=_0x4577[_0x5d3f51];return _0x24bcdb;};'use strict';var Sequelize=require(_0x7457('0x0'));module['exports']={'body':{'type':Sequelize[_0x7457('0x1')](_0x7457('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7457('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7457('0x4')]('in','out'),'defaultValue':_0x7457('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7457('0x6')](0xbe)},'phone':{'type':Sequelize[_0x7457('0x6')]},'readAt':{'type':Sequelize[_0x7457('0x7')]},'secret':{'type':Sequelize[_0x7457('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7457('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa5fd=['sequelize','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x22e257,_0x54db13){var _0x5a8775=function(_0x313830){while(--_0x313830){_0x22e257['push'](_0x22e257['shift']());}};_0x5a8775(++_0x54db13);}(_0xa5fd,0x90));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xda5f('0x0'));module['exports']={'body':{'type':Sequelize[_0xda5f('0x1')](_0xda5f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xda5f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xda5f('0x4')),'defaultValue':_0xda5f('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xda5f('0x5')](0xbe)},'phone':{'type':Sequelize[_0xda5f('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xda5f('0x5')]},'providerResponse':{'type':Sequelize[_0xda5f('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 4f022ae..d9140c2 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 _0xfe60=['describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body'];(function(_0x4f0dd2,_0x3c85f3){var _0x4ce9c8=function(_0xe77bb4){while(--_0xe77bb4){_0x4f0dd2['push'](_0x4f0dd2['shift']());}};_0x4ce9c8(++_0x3c85f3);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x47114f,_0x1d0a22){_0x47114f=_0x47114f-0x0;var _0x159093=_0xfe60[_0x47114f];return _0x159093;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fe6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fe6('0x1'));var rp=require(_0x0fe6('0x2'));var moment=require(_0x0fe6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0fe6('0x4'));var util=require(_0x0fe6('0x5'));var path=require(_0x0fe6('0x6'));var sox=require(_0x0fe6('0x7'));var csv=require(_0x0fe6('0x8'));var ejs=require(_0x0fe6('0x9'));var fs=require('fs');var fs_extra=require(_0x0fe6('0xa'));var _=require(_0x0fe6('0xb'));var squel=require(_0x0fe6('0xc'));var crypto=require(_0x0fe6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0fe6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0fe6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0fe6('0x10'));var as=require(_0x0fe6('0x11'));var hardwareService=require(_0x0fe6('0x12'));var logger=require(_0x0fe6('0x13'))(_0x0fe6('0x14'));var utils=require(_0x0fe6('0x15'));var config=require(_0x0fe6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fe6('0x17'))['db'];config[_0x0fe6('0x18')]=_[_0x0fe6('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0fe6('0x1a'))(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x0fe6('0x1b'));var client=jayson[_0x0fe6('0x1c')][_0x0fe6('0x1d')]({'port':0x232c});var client9002=jayson[_0x0fe6('0x1c')][_0x0fe6('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x16f2f6,_0x44011a,_0x14286b,_0x2f9cd5){return new BPromise(function(_0x4669c4,_0x3e2108){var _0x347ebb=_0x2f9cd5||client;return _0x347ebb['request'](_0x16f2f6,_0x14286b)[_0x0fe6('0x1e')](function(_0xe6bb13){logger[_0x0fe6('0x1f')](_0x0fe6('0x20'),_0x44011a,_0x0fe6('0x21'));logger[_0x0fe6('0x22')](_0x0fe6('0x23'),_0x44011a,_0x0fe6('0x21'),JSON[_0x0fe6('0x24')](_0xe6bb13));if(_0xe6bb13[_0x0fe6('0x25')]){if(_0xe6bb13[_0x0fe6('0x25')][_0x0fe6('0x26')]===0x1f4){logger['error'](_0x0fe6('0x20'),_0x44011a,_0xe6bb13[_0x0fe6('0x25')][_0x0fe6('0x27')]);return _0x3e2108(_0xe6bb13[_0x0fe6('0x25')]['message']);}logger[_0x0fe6('0x25')](_0x0fe6('0x20'),_0x44011a,_0xe6bb13['error'][_0x0fe6('0x27')]);return _0x4669c4(_0xe6bb13['error'][_0x0fe6('0x27')]);}else{logger[_0x0fe6('0x1f')](_0x0fe6('0x20'),_0x44011a,_0x0fe6('0x21'));_0x4669c4(_0xe6bb13['result'][_0x0fe6('0x27')]);}})[_0x0fe6('0x28')](function(_0x7f855d){logger[_0x0fe6('0x25')](_0x0fe6('0x20'),_0x44011a,_0x7f855d);_0x3e2108(_0x7f855d);});});}function respondWithStatusCode(_0x490ca4,_0x2a7f1e){_0x2a7f1e=_0x2a7f1e||0xcc;return function(_0x45a708){if(_0x45a708){return _0x490ca4[_0x0fe6('0x29')](_0x2a7f1e);}return _0x490ca4[_0x0fe6('0x2a')](_0x2a7f1e)[_0x0fe6('0x2b')]();};}function respondWithResult(_0x45f831,_0x4e1c48){_0x4e1c48=_0x4e1c48||0xc8;return function(_0x45ba9d){if(_0x45ba9d){return _0x45f831[_0x0fe6('0x2a')](_0x4e1c48)[_0x0fe6('0x2c')](_0x45ba9d);}};}function respondWithFilteredResult(_0x167d17,_0x2ede48){return function(_0x1bb6c0){if(_0x1bb6c0){var _0x18fad1=typeof _0x2ede48[_0x0fe6('0x2d')]===_0x0fe6('0x2e')&&typeof _0x2ede48['limit']===_0x0fe6('0x2e');var _0x331fa5=_0x1bb6c0['count'];var _0x34451d=_0x18fad1?0x0:_0x2ede48[_0x0fe6('0x2d')];var _0x118f31=_0x18fad1?_0x1bb6c0[_0x0fe6('0x2f')]:_0x2ede48[_0x0fe6('0x2d')]+_0x2ede48[_0x0fe6('0x30')];var _0xf1b69a;if(_0x118f31>=_0x331fa5){_0x118f31=_0x331fa5;_0xf1b69a=0xc8;}else{_0xf1b69a=0xce;}_0x167d17[_0x0fe6('0x2a')](_0xf1b69a);return _0x167d17[_0x0fe6('0x31')](_0x0fe6('0x32'),_0x34451d+'-'+_0x118f31+'/'+_0x331fa5)[_0x0fe6('0x2c')](_0x1bb6c0);}return null;};}function patchUpdates(_0x4707b7){return function(_0x3ffc47){try{jsonpatch[_0x0fe6('0x33')](_0x3ffc47,_0x4707b7,!![]);}catch(_0x346811){return BPromise[_0x0fe6('0x34')](_0x346811);}return _0x3ffc47[_0x0fe6('0x35')]();};}function saveUpdates(_0x5e8b51,_0x5c9441){return function(_0xad67bb){if(_0xad67bb){return _0xad67bb[_0x0fe6('0x36')](_0x5e8b51)[_0x0fe6('0x1e')](function(_0x25f92d){return _0x25f92d;});}return null;};}function removeEntity(_0x2ea07c,_0x4e183e){return function(_0xd1b332){if(_0xd1b332){return _0xd1b332[_0x0fe6('0x37')]()[_0x0fe6('0x1e')](function(){_0x2ea07c[_0x0fe6('0x2a')](0xcc)[_0x0fe6('0x2b')]();});}};}function handleEntityNotFound(_0x13a329,_0x48d244){return function(_0x5938f1){if(!_0x5938f1){_0x13a329[_0x0fe6('0x29')](0x194);}return _0x5938f1;};}function handleError(_0x2db407,_0x40ea32){_0x40ea32=_0x40ea32||0x1f4;return function(_0x57f831){logger[_0x0fe6('0x25')](_0x57f831[_0x0fe6('0x38')]);if(_0x57f831[_0x0fe6('0x39')]){delete _0x57f831['name'];}_0x2db407[_0x0fe6('0x2a')](_0x40ea32)[_0x0fe6('0x3a')](_0x57f831);};}exports[_0x0fe6('0x3b')]=function(_0x4f351a,_0x527730){var _0x28571e={},_0x25f8fd={},_0x1d0a1b={'count':0x0,'rows':[]};var _0x8aa6c8=_[_0x0fe6('0x3c')](db[_0x0fe6('0x3d')]['rawAttributes'],function(_0x13bb46){return{'name':_0x13bb46[_0x0fe6('0x3e')],'type':_0x13bb46[_0x0fe6('0x3f')][_0x0fe6('0x40')]};});_0x25f8fd[_0x0fe6('0x41')]=_[_0x0fe6('0x3c')](_0x8aa6c8,_0x0fe6('0x39'));_0x25f8fd['query']=_[_0x0fe6('0x42')](_0x4f351a[_0x0fe6('0x43')]);_0x25f8fd[_0x0fe6('0x44')]=_['intersection'](_0x25f8fd[_0x0fe6('0x41')],_0x25f8fd[_0x0fe6('0x43')]);_0x28571e['attributes']=_[_0x0fe6('0x45')](_0x25f8fd[_0x0fe6('0x41')],qs[_0x0fe6('0x46')](_0x4f351a[_0x0fe6('0x43')][_0x0fe6('0x46')]));_0x28571e[_0x0fe6('0x47')]=_0x28571e[_0x0fe6('0x47')][_0x0fe6('0x48')]?_0x28571e[_0x0fe6('0x47')]:_0x25f8fd[_0x0fe6('0x41')];if(!_0x4f351a[_0x0fe6('0x43')][_0x0fe6('0x49')](_0x0fe6('0x4a'))){_0x28571e[_0x0fe6('0x30')]=qs[_0x0fe6('0x30')](_0x4f351a[_0x0fe6('0x43')]['limit']);_0x28571e[_0x0fe6('0x2d')]=qs[_0x0fe6('0x2d')](_0x4f351a[_0x0fe6('0x43')][_0x0fe6('0x2d')]);}_0x28571e[_0x0fe6('0x4b')]=qs[_0x0fe6('0x4c')](_0x4f351a['query']['sort']);_0x28571e[_0x0fe6('0x4d')]=qs[_0x0fe6('0x44')](_[_0x0fe6('0x4e')](_0x4f351a['query'],_0x25f8fd[_0x0fe6('0x44')]),_0x8aa6c8);if(_0x4f351a[_0x0fe6('0x43')]['filter']){_0x28571e[_0x0fe6('0x4d')]=_['merge'](_0x28571e['where'],{'$or':_[_0x0fe6('0x3c')](_0x8aa6c8,function(_0x1ebbdd){if(_0x1ebbdd['type']!==_0x0fe6('0x4f')){var _0x505d41={};_0x505d41[_0x1ebbdd['name']]={'$like':'%'+_0x4f351a[_0x0fe6('0x43')]['filter']+'%'};return _0x505d41;}})});}_0x28571e=_['merge']({},_0x28571e,_0x4f351a[_0x0fe6('0x50')]);var _0x5429fb={'where':_0x28571e['where']};return db['WhatsappMessage'][_0x0fe6('0x2f')](_0x5429fb)[_0x0fe6('0x1e')](function(_0x57e750){_0x1d0a1b[_0x0fe6('0x2f')]=_0x57e750;if(_0x4f351a[_0x0fe6('0x43')][_0x0fe6('0x51')]){_0x28571e[_0x0fe6('0x52')]=[{'all':!![]}];}return db[_0x0fe6('0x3d')][_0x0fe6('0x53')](_0x28571e);})[_0x0fe6('0x1e')](function(_0x41c07d){_0x1d0a1b['rows']=_0x41c07d;return _0x1d0a1b;})[_0x0fe6('0x1e')](respondWithFilteredResult(_0x527730,_0x28571e))['catch'](handleError(_0x527730,null));};exports[_0x0fe6('0x54')]=function(_0x596116,_0x10283e){var _0x321d40={'raw':!![],'where':{'id':_0x596116[_0x0fe6('0x55')]['id']}},_0x41d6e6={};_0x41d6e6[_0x0fe6('0x41')]=_[_0x0fe6('0x42')](db[_0x0fe6('0x3d')]['rawAttributes']);_0x41d6e6[_0x0fe6('0x43')]=_[_0x0fe6('0x42')](_0x596116[_0x0fe6('0x43')]);_0x41d6e6[_0x0fe6('0x44')]=_[_0x0fe6('0x45')](_0x41d6e6[_0x0fe6('0x41')],_0x41d6e6[_0x0fe6('0x43')]);_0x321d40[_0x0fe6('0x47')]=_[_0x0fe6('0x45')](_0x41d6e6[_0x0fe6('0x41')],qs['fields'](_0x596116['query'][_0x0fe6('0x46')]));_0x321d40[_0x0fe6('0x47')]=_0x321d40[_0x0fe6('0x47')][_0x0fe6('0x48')]?_0x321d40[_0x0fe6('0x47')]:_0x41d6e6[_0x0fe6('0x41')];if(_0x596116[_0x0fe6('0x43')][_0x0fe6('0x51')]){_0x321d40[_0x0fe6('0x52')]=[{'all':!![]}];}_0x321d40=_['merge']({},_0x321d40,_0x596116[_0x0fe6('0x50')]);return db[_0x0fe6('0x3d')][_0x0fe6('0x56')](_0x321d40)[_0x0fe6('0x1e')](handleEntityNotFound(_0x10283e,null))['then'](respondWithResult(_0x10283e,null))[_0x0fe6('0x28')](handleError(_0x10283e,null));};exports[_0x0fe6('0x57')]=function(_0x5050ad,_0x5400f8){return db[_0x0fe6('0x3d')][_0x0fe6('0x57')](_0x5050ad[_0x0fe6('0x58')],{})['then'](respondWithResult(_0x5400f8,0xc9))['catch'](handleError(_0x5400f8,null));};exports['update']=function(_0x512bb9,_0x2be896){if(_0x512bb9['body']['id']){delete _0x512bb9[_0x0fe6('0x58')]['id'];}return db['WhatsappMessage'][_0x0fe6('0x56')]({'where':{'id':_0x512bb9[_0x0fe6('0x55')]['id']}})['then'](handleEntityNotFound(_0x2be896,null))['then'](saveUpdates(_0x512bb9[_0x0fe6('0x58')],null))[_0x0fe6('0x1e')](respondWithResult(_0x2be896,null))[_0x0fe6('0x28')](handleError(_0x2be896,null));};exports[_0x0fe6('0x37')]=function(_0x31ba5d,_0x353d3c){return db['WhatsappMessage'][_0x0fe6('0x56')]({'where':{'id':_0x31ba5d[_0x0fe6('0x55')]['id']}})[_0x0fe6('0x1e')](handleEntityNotFound(_0x353d3c,null))[_0x0fe6('0x1e')](removeEntity(_0x353d3c,null))['catch'](handleError(_0x353d3c,null));};exports[_0x0fe6('0x59')]=function(_0x279af8,_0x1c4957){return db[_0x0fe6('0x3d')]['describe']()[_0x0fe6('0x1e')](respondWithResult(_0x1c4957,null))['catch'](handleError(_0x1c4957,null));};var interaction_log=require(_0x0fe6('0x13'))(_0x0fe6('0x5a'));exports[_0x0fe6('0x5b')]=function(_0x15c7bd,_0x4f13f3,_0x51f0e0){var _0x57a6ae={'agent':{},'channel':_0x0fe6('0x5c')};if(_0x15c7bd[_0x0fe6('0x58')]['id']){delete _0x15c7bd['body']['id'];}_0x15c7bd[_0x0fe6('0x58')][_0x0fe6('0x5d')]=!![];_0x15c7bd[_0x0fe6('0x58')][_0x0fe6('0x5e')]=moment()[_0x0fe6('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x15c7bd[_0x0fe6('0x58')][_0x0fe6('0x60')]=_0x15c7bd[_0x0fe6('0x58')]['UserId']||_0x15c7bd[_0x0fe6('0x61')]['id'];_0x57a6ae[_0x0fe6('0x62')]['id']=_0x15c7bd[_0x0fe6('0x58')][_0x0fe6('0x60')];return db['WhatsappMessage'][_0x0fe6('0x56')]({'where':{'id':_0x15c7bd[_0x0fe6('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4f13f3,null))['then'](saveUpdates(_0x15c7bd[_0x0fe6('0x58')],null))[_0x0fe6('0x1e')](function(_0x162827){if(_0x162827){_0x57a6ae[_0x0fe6('0x27')]=_0x162827[_0x0fe6('0x63')]({'plain':!![]});return db[_0x0fe6('0x64')][_0x0fe6('0x56')]({'where':{'id':_0x162827[_0x0fe6('0x65')]}});}return null;})[_0x0fe6('0x1e')](handleEntityNotFound(_0x4f13f3,null))[_0x0fe6('0x1e')](function(_0x55f644){if(_0x55f644){return _0x55f644[_0x0fe6('0x36')]({'UserId':_0x15c7bd[_0x0fe6('0x58')]['UserId'],'read1stAt':_[_0x0fe6('0x66')](_0x55f644[_0x0fe6('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0fe6('0x1e')](function(_0xab9a41){if(_0xab9a41){_0x57a6ae['interaction']=_0xab9a41[_0x0fe6('0x63')]({'plain':!![]});interaction_log[_0x0fe6('0x1f')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x15c7bd[_0x0fe6('0x61')]['id'],_0x15c7bd[_0x0fe6('0x61')][_0x0fe6('0x39')],_0x15c7bd[_0x0fe6('0x61')][_0x0fe6('0x68')],_0x57a6ae[_0x0fe6('0x69')]['id'],_0x15c7bd[_0x0fe6('0x58')]?JSON[_0x0fe6('0x24')](_0x15c7bd[_0x0fe6('0x58')]):_0x0fe6('0x6a'));return respondWithRpcPromise(_0x0fe6('0x6b'),'acceptMessage',_0x57a6ae);}return null;})[_0x0fe6('0x1e')](function(_0x26ea11){var _0x44b946=_0x0fe6('0x6c')+_0x26ea11['message']['ContactId'];return db[_0x0fe6('0x6d')][_0x0fe6('0x43')](_0x44b946,{'type':db[_0x0fe6('0x6e')][_0x0fe6('0x6f')]['SELECT'],'raw':!![]})[_0x0fe6('0x1e')](function(_0x3c8469){return _0x3c8469;});})[_0x0fe6('0x1e')](function(_0x4a0af5){if(_0x4a0af5){_0x57a6ae[_0x0fe6('0x27')][_0x0fe6('0x70')]=_0x4a0af5[0x0];if(!_0x15c7bd[_0x0fe6('0x58')][_0x0fe6('0x60')])return;return db[_0x0fe6('0x71')][_0x0fe6('0x56')]({'where':{'id':_0x15c7bd['body'][_0x0fe6('0x60')],'role':_0x0fe6('0x62')},'attributes':['id',_0x0fe6('0x39'),_0x0fe6('0x72'),_0x0fe6('0x73'),_0x0fe6('0x74')],'raw':!![]});}return null;})[_0x0fe6('0x1e')](function(_0x22aa88){if(!_0x22aa88)return null;_0x57a6ae[_0x0fe6('0x27')][_0x0fe6('0x62')]=_0x22aa88;return _0x57a6ae;})['then'](function(_0x113511){if(_0x113511){if(_0x15c7bd['body'][_0x0fe6('0x75')]){_0x57a6ae[_0x0fe6('0x27')][_0x0fe6('0x76')]=util[_0x0fe6('0x5f')](_0x0fe6('0x77'),_0x15c7bd['user'][_0x0fe6('0x39')]);_0x57a6ae['message'][_0x0fe6('0x78')]=_0x57a6ae[_0x0fe6('0x78')];_0x57a6ae[_0x0fe6('0x27')][_0x0fe6('0x79')]=_0x57a6ae[_0x0fe6('0x78')];_0x57a6ae['message'][_0x0fe6('0x7a')]=_0x0fe6('0x5b');return respondWithRpcPromise(_0x0fe6('0x7b'),_0x0fe6('0x7b'),{'event':_0x0fe6('0x7c'),'message':_0x57a6ae[_0x0fe6('0x27')]},client9002)[_0x0fe6('0x1e')](function(){return _0x57a6ae;});}return _0x57a6ae;}return null;})[_0x0fe6('0x1e')](respondWithResult(_0x4f13f3,null))['catch'](handleError(_0x4f13f3,null));};var interaction_log=require(_0x0fe6('0x13'))(_0x0fe6('0x5a'));exports[_0x0fe6('0x34')]=function(_0x50ebaf,_0xd1a8ce,_0x52823d){var _0xa2c718={'agent':{},'channel':'whatsapp'};if(_0x50ebaf['body']['id']){delete _0x50ebaf[_0x0fe6('0x58')]['id'];}_0x50ebaf[_0x0fe6('0x58')]['UserId']=_0x50ebaf[_0x0fe6('0x58')]['UserId']||_0x50ebaf[_0x0fe6('0x61')]['id'];_0xa2c718['agent']['id']=_0x50ebaf[_0x0fe6('0x58')][_0x0fe6('0x60')];return db[_0x0fe6('0x3d')]['find']({'where':{'id':_0x50ebaf['params']['id'],'UserId':null}})[_0x0fe6('0x1e')](handleEntityNotFound(_0xd1a8ce,null))[_0x0fe6('0x1e')](function(_0x1a1c34){if(_0x1a1c34){_0xa2c718[_0x0fe6('0x27')]=_0x1a1c34[_0x0fe6('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0x0fe6('0x56')]({'where':{'id':_0x1a1c34[_0x0fe6('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xd1a8ce,null))[_0x0fe6('0x1e')](function(_0x604478){if(_0x604478){_0xa2c718[_0x0fe6('0x69')]=_0x604478[_0x0fe6('0x63')]({'plain':!![]});interaction_log[_0x0fe6('0x1f')](_0x0fe6('0x7d'),_0x50ebaf[_0x0fe6('0x61')]['id'],_0x50ebaf[_0x0fe6('0x61')][_0x0fe6('0x39')],_0x50ebaf['user'][_0x0fe6('0x68')],_0xa2c718[_0x0fe6('0x69')]['id'],_0x50ebaf['body']?JSON['stringify'](_0x50ebaf['body']):_0x0fe6('0x6a'));return respondWithRpcPromise(_0x0fe6('0x7e'),_0x0fe6('0x7f'),_0xa2c718);}return null;})['then'](function(_0x4cfd46){var _0xa2863e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4cfd46[_0x0fe6('0x27')][_0x0fe6('0x80')];return db[_0x0fe6('0x6d')][_0x0fe6('0x43')](_0xa2863e,{'type':db[_0x0fe6('0x6e')][_0x0fe6('0x6f')][_0x0fe6('0x81')],'raw':!![]})['then'](function(_0x483284){return _0x483284;});})['then'](function(_0x27623b){if(_0x27623b){_0xa2c718[_0x0fe6('0x27')][_0x0fe6('0x70')]=_0x27623b[0x0];if(!_0x50ebaf[_0x0fe6('0x58')][_0x0fe6('0x60')])return;return db['User']['find']({'where':{'id':_0x50ebaf['body']['UserId'],'role':'agent'},'attributes':['id',_0x0fe6('0x39'),_0x0fe6('0x72'),'email','internal'],'raw':!![]});}return null;})[_0x0fe6('0x1e')](function(_0xc6a5b7){if(!_0xc6a5b7)return null;_0xa2c718[_0x0fe6('0x27')]['agent']=_0xc6a5b7;return _0xa2c718;})[_0x0fe6('0x1e')](function(_0x197124){if(_0x197124){_0x197124[_0x0fe6('0x27')]['interface']=util[_0x0fe6('0x5f')](_0x0fe6('0x77'),_0x50ebaf['user'][_0x0fe6('0x39')]);_0x197124[_0x0fe6('0x27')][_0x0fe6('0x78')]=_0xa2c718[_0x0fe6('0x78')];_0x197124['message'][_0x0fe6('0x79')]=_0xa2c718[_0x0fe6('0x78')];_0x197124[_0x0fe6('0x27')]['event']=_0x0fe6('0x34');respondWithRpcPromise(_0x0fe6('0x7b'),_0x0fe6('0x7b'),{'event':'rejectmessage','message':_0x197124['message']},client9002);return _0xa2c718;}return null;})[_0x0fe6('0x1e')](respondWithResult(_0xd1a8ce,null))[_0x0fe6('0x28')](handleError(_0xd1a8ce,null));};exports[_0x0fe6('0x2a')]=function(_0x48b3e8,_0x5a6f07,_0x1ccc6e){if(_0x48b3e8['body']['id']){delete _0x48b3e8['body']['id'];}var _0x1ad0c5;return db[_0x0fe6('0x3d')][_0x0fe6('0x56')]({'where':{'id':_0x48b3e8['params']['id']}})[_0x0fe6('0x1e')](handleEntityNotFound(_0x5a6f07,null))[_0x0fe6('0x1e')](function(_0x55cdf2){if(_0x55cdf2){_0x1ad0c5=_0x55cdf2;return db['WhatsappAccount'][_0x0fe6('0x56')]({'where':{'id':_0x55cdf2[_0x0fe6('0x82')]}});}})[_0x0fe6('0x1e')](handleEntityNotFound(_0x5a6f07,null))[_0x0fe6('0x1e')](function(_0x1eeba4){if(_0x1eeba4){logger[_0x0fe6('0x22')](_0x0fe6('0x83'),_0x0fe6('0x2a'),'received\x20delivery\x20report\x20from',_0x1eeba4['type'],util[_0x0fe6('0x84')](_0x48b3e8['body'],{'showHidden':![],'depth':null}));switch(_0x1eeba4[_0x0fe6('0x3f')]){case _0x0fe6('0x85'):if(_0x48b3e8[_0x0fe6('0x58')]['MessageSid']&&_0x48b3e8[_0x0fe6('0x58')][_0x0fe6('0x86')]===_0x1ad0c5['messageId']&&_0x48b3e8[_0x0fe6('0x58')][_0x0fe6('0x87')]&&_0x48b3e8[_0x0fe6('0x58')][_0x0fe6('0x87')]===_0x0fe6('0x5d')){return _0x1ad0c5[_0x0fe6('0x36')]({'read':!![]});}else{logger['error'](_0x0fe6('0x88'),'status','twilio',util[_0x0fe6('0x84')](_0x48b3e8['body'],{'showHidden':![],'depth':null}));}break;}return _0x1ad0c5;}})[_0x0fe6('0x1e')](respondWithResult(_0x5a6f07,null))[_0x0fe6('0x28')](handleError(_0x5a6f07,null));}; \ No newline at end of file +var _0xaea0=['send','WhatsappMessage','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','../../config/logger','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','sendStatus','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','end','stack','name'];(function(_0x1e8c12,_0x5a31e7){var _0x289917=function(_0x486f72){while(--_0x486f72){_0x1e8c12['push'](_0x1e8c12['shift']());}};_0x289917(++_0x5a31e7);}(_0xaea0,0x165));var _0x0aea=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0xaea0[_0x316c42];return _0x2b38f7;};'use strict';var emlformat=require(_0x0aea('0x0'));var rimraf=require(_0x0aea('0x1'));var zipdir=require(_0x0aea('0x2'));var jsonpatch=require(_0x0aea('0x3'));var rp=require(_0x0aea('0x4'));var moment=require('moment');var BPromise=require(_0x0aea('0x5'));var Mustache=require(_0x0aea('0x6'));var util=require(_0x0aea('0x7'));var path=require('path');var sox=require(_0x0aea('0x8'));var csv=require('to-csv');var ejs=require(_0x0aea('0x9'));var fs=require('fs');var fs_extra=require(_0x0aea('0xa'));var _=require(_0x0aea('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0aea('0xc'));var querystring=require(_0x0aea('0xd'));var Papa=require(_0x0aea('0xe'));var Redis=require(_0x0aea('0xf'));var authService=require(_0x0aea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0aea('0x11'));var hardwareService=require(_0x0aea('0x12'));var logger=require('../../config/logger')(_0x0aea('0x13'));var utils=require(_0x0aea('0x14'));var config=require(_0x0aea('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0aea('0x16'))['db'];config['redis']=_['defaults'](config[_0x0aea('0x17')],{'host':_0x0aea('0x18'),'port':0x18eb});var socket=require(_0x0aea('0x19'))(new Redis(config[_0x0aea('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x0aea('0x1a'));var client=jayson[_0x0aea('0x1b')][_0x0aea('0x1c')]({'port':0x232c});var client9002=jayson[_0x0aea('0x1b')][_0x0aea('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x75cac3,_0x51372e,_0x2a4c82,_0x2bc986){return new BPromise(function(_0x1684bc,_0x5412b1){var _0x2e3915=_0x2bc986||client;return _0x2e3915['request'](_0x75cac3,_0x2a4c82)[_0x0aea('0x1d')](function(_0x590e01){logger[_0x0aea('0x1e')](_0x0aea('0x1f'),_0x51372e,'request\x20sent');logger[_0x0aea('0x20')](_0x0aea('0x21'),_0x51372e,_0x0aea('0x22'),JSON['stringify'](_0x590e01));if(_0x590e01[_0x0aea('0x23')]){if(_0x590e01[_0x0aea('0x23')]['code']===0x1f4){logger[_0x0aea('0x23')](_0x0aea('0x1f'),_0x51372e,_0x590e01[_0x0aea('0x23')]['message']);return _0x5412b1(_0x590e01[_0x0aea('0x23')][_0x0aea('0x24')]);}logger['error'](_0x0aea('0x1f'),_0x51372e,_0x590e01[_0x0aea('0x23')][_0x0aea('0x24')]);return _0x1684bc(_0x590e01[_0x0aea('0x23')]['message']);}else{logger[_0x0aea('0x1e')](_0x0aea('0x1f'),_0x51372e,'request\x20sent');_0x1684bc(_0x590e01[_0x0aea('0x25')][_0x0aea('0x24')]);}})['catch'](function(_0x4c2902){logger[_0x0aea('0x23')](_0x0aea('0x1f'),_0x51372e,_0x4c2902);_0x5412b1(_0x4c2902);});});}function respondWithStatusCode(_0x3dae13,_0x2a0b6a){_0x2a0b6a=_0x2a0b6a||0xcc;return function(_0x46cece){if(_0x46cece){return _0x3dae13[_0x0aea('0x26')](_0x2a0b6a);}return _0x3dae13[_0x0aea('0x27')](_0x2a0b6a)['end']();};}function respondWithResult(_0x4e181f,_0x282019){_0x282019=_0x282019||0xc8;return function(_0x34b252){if(_0x34b252){return _0x4e181f['status'](_0x282019)[_0x0aea('0x28')](_0x34b252);}};}function respondWithFilteredResult(_0x2597e8,_0x55ec88){return function(_0x155467){if(_0x155467){var _0x55ef2f=typeof _0x55ec88['offset']===_0x0aea('0x29')&&typeof _0x55ec88[_0x0aea('0x2a')]===_0x0aea('0x29');var _0x5590a1=_0x155467['count'];var _0x52d611=_0x55ef2f?0x0:_0x55ec88[_0x0aea('0x2b')];var _0x899e36=_0x55ef2f?_0x155467[_0x0aea('0x2c')]:_0x55ec88[_0x0aea('0x2b')]+_0x55ec88[_0x0aea('0x2a')];var _0x25fd40;if(_0x899e36>=_0x5590a1){_0x899e36=_0x5590a1;_0x25fd40=0xc8;}else{_0x25fd40=0xce;}_0x2597e8[_0x0aea('0x27')](_0x25fd40);return _0x2597e8[_0x0aea('0x2d')]('Content-Range',_0x52d611+'-'+_0x899e36+'/'+_0x5590a1)['json'](_0x155467);}return null;};}function patchUpdates(_0x435153){return function(_0x234101){try{jsonpatch[_0x0aea('0x2e')](_0x234101,_0x435153,!![]);}catch(_0x3f5286){return BPromise[_0x0aea('0x2f')](_0x3f5286);}return _0x234101[_0x0aea('0x30')]();};}function saveUpdates(_0x47c4f6,_0x5139e0){return function(_0x3e0544){if(_0x3e0544){return _0x3e0544[_0x0aea('0x31')](_0x47c4f6)['then'](function(_0x156d30){return _0x156d30;});}return null;};}function removeEntity(_0x576cc9,_0x590238){return function(_0x3ebc3f){if(_0x3ebc3f){return _0x3ebc3f[_0x0aea('0x32')]()[_0x0aea('0x1d')](function(){_0x576cc9[_0x0aea('0x27')](0xcc)[_0x0aea('0x33')]();});}};}function handleEntityNotFound(_0x5df7e7,_0x501cee){return function(_0x2c95bc){if(!_0x2c95bc){_0x5df7e7[_0x0aea('0x26')](0x194);}return _0x2c95bc;};}function handleError(_0x40006a,_0x18c367){_0x18c367=_0x18c367||0x1f4;return function(_0x3d6b93){logger['error'](_0x3d6b93[_0x0aea('0x34')]);if(_0x3d6b93[_0x0aea('0x35')]){delete _0x3d6b93['name'];}_0x40006a[_0x0aea('0x27')](_0x18c367)[_0x0aea('0x36')](_0x3d6b93);};}exports['index']=function(_0xb1dfdc,_0x159d37){var _0x451f3a={},_0x3d0951={},_0x1b3520={'count':0x0,'rows':[]};var _0x43cb6a=_['map'](db[_0x0aea('0x37')][_0x0aea('0x38')],function(_0x72d5ce){return{'name':_0x72d5ce[_0x0aea('0x39')],'type':_0x72d5ce[_0x0aea('0x3a')][_0x0aea('0x3b')]};});_0x3d0951[_0x0aea('0x3c')]=_[_0x0aea('0x3d')](_0x43cb6a,_0x0aea('0x35'));_0x3d0951['query']=_[_0x0aea('0x3e')](_0xb1dfdc[_0x0aea('0x3f')]);_0x3d0951[_0x0aea('0x40')]=_[_0x0aea('0x41')](_0x3d0951['model'],_0x3d0951['query']);_0x451f3a[_0x0aea('0x42')]=_[_0x0aea('0x41')](_0x3d0951[_0x0aea('0x3c')],qs[_0x0aea('0x43')](_0xb1dfdc['query']['fields']));_0x451f3a[_0x0aea('0x42')]=_0x451f3a[_0x0aea('0x42')][_0x0aea('0x44')]?_0x451f3a[_0x0aea('0x42')]:_0x3d0951['model'];if(!_0xb1dfdc[_0x0aea('0x3f')][_0x0aea('0x45')](_0x0aea('0x46'))){_0x451f3a['limit']=qs['limit'](_0xb1dfdc[_0x0aea('0x3f')][_0x0aea('0x2a')]);_0x451f3a[_0x0aea('0x2b')]=qs[_0x0aea('0x2b')](_0xb1dfdc['query'][_0x0aea('0x2b')]);}_0x451f3a['order']=qs['sort'](_0xb1dfdc[_0x0aea('0x3f')]['sort']);_0x451f3a['where']=qs['filters'](_[_0x0aea('0x47')](_0xb1dfdc['query'],_0x3d0951['filters']),_0x43cb6a);if(_0xb1dfdc['query'][_0x0aea('0x48')]){_0x451f3a[_0x0aea('0x49')]=_[_0x0aea('0x4a')](_0x451f3a[_0x0aea('0x49')],{'$or':_['map'](_0x43cb6a,function(_0x400471){if(_0x400471[_0x0aea('0x3a')]!==_0x0aea('0x4b')){var _0x633a2f={};_0x633a2f[_0x400471[_0x0aea('0x35')]]={'$like':'%'+_0xb1dfdc['query'][_0x0aea('0x48')]+'%'};return _0x633a2f;}})});}_0x451f3a=_[_0x0aea('0x4a')]({},_0x451f3a,_0xb1dfdc[_0x0aea('0x4c')]);var _0x22954b={'where':_0x451f3a[_0x0aea('0x49')]};return db[_0x0aea('0x37')]['count'](_0x22954b)['then'](function(_0x504b85){_0x1b3520[_0x0aea('0x2c')]=_0x504b85;if(_0xb1dfdc['query'][_0x0aea('0x4d')]){_0x451f3a[_0x0aea('0x4e')]=[{'all':!![]}];}return db[_0x0aea('0x37')][_0x0aea('0x4f')](_0x451f3a);})[_0x0aea('0x1d')](function(_0x3b2e72){_0x1b3520[_0x0aea('0x50')]=_0x3b2e72;return _0x1b3520;})[_0x0aea('0x1d')](respondWithFilteredResult(_0x159d37,_0x451f3a))['catch'](handleError(_0x159d37,null));};exports[_0x0aea('0x51')]=function(_0x4cbeb3,_0x3cf957){var _0x3aa5c7={'raw':!![],'where':{'id':_0x4cbeb3[_0x0aea('0x52')]['id']}},_0x2b20ee={};_0x2b20ee['model']=_[_0x0aea('0x3e')](db[_0x0aea('0x37')]['rawAttributes']);_0x2b20ee[_0x0aea('0x3f')]=_['keys'](_0x4cbeb3['query']);_0x2b20ee[_0x0aea('0x40')]=_[_0x0aea('0x41')](_0x2b20ee[_0x0aea('0x3c')],_0x2b20ee['query']);_0x3aa5c7[_0x0aea('0x42')]=_[_0x0aea('0x41')](_0x2b20ee['model'],qs[_0x0aea('0x43')](_0x4cbeb3['query']['fields']));_0x3aa5c7[_0x0aea('0x42')]=_0x3aa5c7[_0x0aea('0x42')][_0x0aea('0x44')]?_0x3aa5c7[_0x0aea('0x42')]:_0x2b20ee['model'];if(_0x4cbeb3['query']['includeAll']){_0x3aa5c7[_0x0aea('0x4e')]=[{'all':!![]}];}_0x3aa5c7=_[_0x0aea('0x4a')]({},_0x3aa5c7,_0x4cbeb3[_0x0aea('0x4c')]);return db[_0x0aea('0x37')][_0x0aea('0x53')](_0x3aa5c7)[_0x0aea('0x1d')](handleEntityNotFound(_0x3cf957,null))[_0x0aea('0x1d')](respondWithResult(_0x3cf957,null))[_0x0aea('0x54')](handleError(_0x3cf957,null));};exports['create']=function(_0x1a25ef,_0x1f9a37){return db['WhatsappMessage'][_0x0aea('0x55')](_0x1a25ef[_0x0aea('0x56')],{})[_0x0aea('0x1d')](respondWithResult(_0x1f9a37,0xc9))[_0x0aea('0x54')](handleError(_0x1f9a37,null));};exports['update']=function(_0x1d41de,_0x1fb1f7){if(_0x1d41de[_0x0aea('0x56')]['id']){delete _0x1d41de[_0x0aea('0x56')]['id'];}return db[_0x0aea('0x37')][_0x0aea('0x53')]({'where':{'id':_0x1d41de[_0x0aea('0x52')]['id']}})[_0x0aea('0x1d')](handleEntityNotFound(_0x1fb1f7,null))['then'](saveUpdates(_0x1d41de[_0x0aea('0x56')],null))[_0x0aea('0x1d')](respondWithResult(_0x1fb1f7,null))[_0x0aea('0x54')](handleError(_0x1fb1f7,null));};exports[_0x0aea('0x32')]=function(_0x243208,_0x5ee51c){return db[_0x0aea('0x37')][_0x0aea('0x53')]({'where':{'id':_0x243208[_0x0aea('0x52')]['id']}})['then'](handleEntityNotFound(_0x5ee51c,null))[_0x0aea('0x1d')](removeEntity(_0x5ee51c,null))['catch'](handleError(_0x5ee51c,null));};exports[_0x0aea('0x57')]=function(_0x579ecc,_0x52f1d1){return db[_0x0aea('0x37')][_0x0aea('0x57')]()[_0x0aea('0x1d')](respondWithResult(_0x52f1d1,null))['catch'](handleError(_0x52f1d1,null));};var interaction_log=require(_0x0aea('0x58'))('whatsapp-interactions');exports['accept']=function(_0x36edfb,_0x1344d3,_0x410102){var _0x5e9249={'agent':{},'channel':_0x0aea('0x59')};if(_0x36edfb[_0x0aea('0x56')]['id']){delete _0x36edfb[_0x0aea('0x56')]['id'];}_0x36edfb['body'][_0x0aea('0x5a')]=!![];_0x36edfb[_0x0aea('0x56')]['readAt']=moment()[_0x0aea('0x5b')](_0x0aea('0x5c'));_0x36edfb[_0x0aea('0x56')][_0x0aea('0x5d')]=_0x36edfb['body'][_0x0aea('0x5d')]||_0x36edfb[_0x0aea('0x5e')]['id'];_0x5e9249[_0x0aea('0x5f')]['id']=_0x36edfb[_0x0aea('0x56')]['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x36edfb[_0x0aea('0x52')]['id'],'UserId':null}})[_0x0aea('0x1d')](handleEntityNotFound(_0x1344d3,null))[_0x0aea('0x1d')](saveUpdates(_0x36edfb[_0x0aea('0x56')],null))[_0x0aea('0x1d')](function(_0x53ebe2){if(_0x53ebe2){_0x5e9249[_0x0aea('0x24')]=_0x53ebe2[_0x0aea('0x60')]({'plain':!![]});return db[_0x0aea('0x61')][_0x0aea('0x53')]({'where':{'id':_0x53ebe2[_0x0aea('0x62')]}});}return null;})[_0x0aea('0x1d')](handleEntityNotFound(_0x1344d3,null))[_0x0aea('0x1d')](function(_0x5b7c0b){if(_0x5b7c0b){return _0x5b7c0b['update']({'UserId':_0x36edfb['body'][_0x0aea('0x5d')],'read1stAt':_['isNil'](_0x5b7c0b['read1stAt'])?moment()[_0x0aea('0x5b')](_0x0aea('0x5c')):undefined});}return null;})[_0x0aea('0x1d')](function(_0x3be821){if(_0x3be821){_0x5e9249[_0x0aea('0x63')]=_0x3be821[_0x0aea('0x60')]({'plain':!![]});interaction_log[_0x0aea('0x1e')](_0x0aea('0x64'),_0x36edfb[_0x0aea('0x5e')]['id'],_0x36edfb[_0x0aea('0x5e')][_0x0aea('0x35')],_0x36edfb['user'][_0x0aea('0x65')],_0x5e9249['interaction']['id'],_0x36edfb[_0x0aea('0x56')]?JSON[_0x0aea('0x66')](_0x36edfb['body']):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5e9249);}return null;})[_0x0aea('0x1d')](function(_0x28dd83){var _0x536bd0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x28dd83['message'][_0x0aea('0x67')];return db[_0x0aea('0x68')][_0x0aea('0x3f')](_0x536bd0,{'type':db[_0x0aea('0x69')]['QueryTypes'][_0x0aea('0x6a')],'raw':!![]})[_0x0aea('0x1d')](function(_0x23f8d2){return _0x23f8d2;});})[_0x0aea('0x1d')](function(_0x48976b){if(_0x48976b){_0x5e9249[_0x0aea('0x24')][_0x0aea('0x6b')]=_0x48976b[0x0];if(!_0x36edfb[_0x0aea('0x56')]['UserId'])return;return db[_0x0aea('0x6c')][_0x0aea('0x53')]({'where':{'id':_0x36edfb[_0x0aea('0x56')][_0x0aea('0x5d')],'role':_0x0aea('0x5f')},'attributes':['id',_0x0aea('0x35'),_0x0aea('0x6d'),_0x0aea('0x6e'),_0x0aea('0x6f')],'raw':!![]});}return null;})[_0x0aea('0x1d')](function(_0x161d34){if(!_0x161d34)return null;_0x5e9249[_0x0aea('0x24')][_0x0aea('0x5f')]=_0x161d34;return _0x5e9249;})[_0x0aea('0x1d')](function(_0x1ac7e3){if(_0x1ac7e3){if(_0x36edfb[_0x0aea('0x56')][_0x0aea('0x70')]){_0x5e9249[_0x0aea('0x24')][_0x0aea('0x71')]=util[_0x0aea('0x5b')](_0x0aea('0x72'),_0x36edfb[_0x0aea('0x5e')][_0x0aea('0x35')]);_0x5e9249[_0x0aea('0x24')]['channel']=_0x5e9249[_0x0aea('0x73')];_0x5e9249[_0x0aea('0x24')][_0x0aea('0x74')]=_0x5e9249[_0x0aea('0x73')];_0x5e9249[_0x0aea('0x24')][_0x0aea('0x75')]=_0x0aea('0x76');return respondWithRpcPromise('EventManager',_0x0aea('0x77'),{'event':_0x0aea('0x78'),'message':_0x5e9249[_0x0aea('0x24')]},client9002)['then'](function(){return _0x5e9249;});}return _0x5e9249;}return null;})[_0x0aea('0x1d')](respondWithResult(_0x1344d3,null))['catch'](handleError(_0x1344d3,null));};var interaction_log=require(_0x0aea('0x58'))(_0x0aea('0x79'));exports[_0x0aea('0x2f')]=function(_0x3348ae,_0x92cadf,_0x4234d3){var _0x627a92={'agent':{},'channel':_0x0aea('0x59')};if(_0x3348ae[_0x0aea('0x56')]['id']){delete _0x3348ae[_0x0aea('0x56')]['id'];}_0x3348ae[_0x0aea('0x56')][_0x0aea('0x5d')]=_0x3348ae[_0x0aea('0x56')][_0x0aea('0x5d')]||_0x3348ae['user']['id'];_0x627a92[_0x0aea('0x5f')]['id']=_0x3348ae['body'][_0x0aea('0x5d')];return db[_0x0aea('0x37')][_0x0aea('0x53')]({'where':{'id':_0x3348ae['params']['id'],'UserId':null}})[_0x0aea('0x1d')](handleEntityNotFound(_0x92cadf,null))['then'](function(_0x4e92dd){if(_0x4e92dd){_0x627a92[_0x0aea('0x24')]=_0x4e92dd[_0x0aea('0x60')]({'plain':!![]});return db[_0x0aea('0x61')][_0x0aea('0x53')]({'where':{'id':_0x4e92dd[_0x0aea('0x62')]}});}return null;})[_0x0aea('0x1d')](handleEntityNotFound(_0x92cadf,null))['then'](function(_0x2cd01e){if(_0x2cd01e){_0x627a92[_0x0aea('0x63')]=_0x2cd01e['get']({'plain':!![]});interaction_log['info'](_0x0aea('0x7a'),_0x3348ae[_0x0aea('0x5e')]['id'],_0x3348ae['user'][_0x0aea('0x35')],_0x3348ae['user']['role'],_0x627a92[_0x0aea('0x63')]['id'],_0x3348ae[_0x0aea('0x56')]?JSON[_0x0aea('0x66')](_0x3348ae[_0x0aea('0x56')]):'null');return respondWithRpcPromise(_0x0aea('0x7b'),_0x0aea('0x7c'),_0x627a92);}return null;})[_0x0aea('0x1d')](function(_0x364075){var _0x3bdaca=_0x0aea('0x7d')+_0x364075['message']['ContactId'];return db[_0x0aea('0x68')][_0x0aea('0x3f')](_0x3bdaca,{'type':db['Sequelize'][_0x0aea('0x7e')][_0x0aea('0x6a')],'raw':!![]})[_0x0aea('0x1d')](function(_0x129a95){return _0x129a95;});})['then'](function(_0x5a2e83){if(_0x5a2e83){_0x627a92[_0x0aea('0x24')][_0x0aea('0x6b')]=_0x5a2e83[0x0];if(!_0x3348ae[_0x0aea('0x56')]['UserId'])return;return db[_0x0aea('0x6c')][_0x0aea('0x53')]({'where':{'id':_0x3348ae[_0x0aea('0x56')][_0x0aea('0x5d')],'role':_0x0aea('0x5f')},'attributes':['id','name','fullname',_0x0aea('0x6e'),_0x0aea('0x6f')],'raw':!![]});}return null;})['then'](function(_0x16dca2){if(!_0x16dca2)return null;_0x627a92[_0x0aea('0x24')][_0x0aea('0x5f')]=_0x16dca2;return _0x627a92;})['then'](function(_0x3cd3d1){if(_0x3cd3d1){_0x3cd3d1[_0x0aea('0x24')]['interface']=util['format'](_0x0aea('0x72'),_0x3348ae[_0x0aea('0x5e')]['name']);_0x3cd3d1[_0x0aea('0x24')][_0x0aea('0x73')]=_0x627a92['channel'];_0x3cd3d1[_0x0aea('0x24')][_0x0aea('0x74')]=_0x627a92[_0x0aea('0x73')];_0x3cd3d1[_0x0aea('0x24')][_0x0aea('0x75')]=_0x0aea('0x2f');respondWithRpcPromise(_0x0aea('0x77'),'EventManager',{'event':_0x0aea('0x7f'),'message':_0x3cd3d1[_0x0aea('0x24')]},client9002);return _0x627a92;}return null;})[_0x0aea('0x1d')](respondWithResult(_0x92cadf,null))[_0x0aea('0x54')](handleError(_0x92cadf,null));};exports[_0x0aea('0x27')]=function(_0x152c61,_0x533e83,_0x1b38c3){if(_0x152c61[_0x0aea('0x56')]['id']){delete _0x152c61[_0x0aea('0x56')]['id'];}var _0x375e0c;return db['WhatsappMessage'][_0x0aea('0x53')]({'where':{'id':_0x152c61['params']['id']}})['then'](handleEntityNotFound(_0x533e83,null))[_0x0aea('0x1d')](function(_0x2668e5){if(_0x2668e5){_0x375e0c=_0x2668e5;return db[_0x0aea('0x80')][_0x0aea('0x53')]({'where':{'id':_0x2668e5[_0x0aea('0x81')]}});}})[_0x0aea('0x1d')](handleEntityNotFound(_0x533e83,null))['then'](function(_0xf39723){if(_0xf39723){logger['debug'](_0x0aea('0x82'),'status',_0x0aea('0x83'),_0xf39723[_0x0aea('0x3a')],util[_0x0aea('0x84')](_0x152c61['body'],{'showHidden':![],'depth':null}));switch(_0xf39723[_0x0aea('0x3a')]){case _0x0aea('0x85'):if(_0x152c61['body']['MessageSid']&&_0x152c61[_0x0aea('0x56')][_0x0aea('0x86')]===_0x375e0c[_0x0aea('0x87')]&&_0x152c61[_0x0aea('0x56')]['MessageStatus']&&_0x152c61[_0x0aea('0x56')]['MessageStatus']===_0x0aea('0x5a')){return _0x375e0c[_0x0aea('0x31')]({'read':!![]});}else{logger['error'](_0x0aea('0x88'),_0x0aea('0x27'),_0x0aea('0x85'),util['inspect'](_0x152c61['body'],{'showHidden':![],'depth':null}));}break;}return _0x375e0c;}})[_0x0aea('0x1d')](respondWithResult(_0x533e83,null))[_0x0aea('0x54')](handleError(_0x533e83,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 78a595e..13a43d7 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 _0x236c=['WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x236c,0x155));var _0xc236=function(_0x4e7fd5,_0x2ee78f){_0x4e7fd5=_0x4e7fd5-0x0;var _0x4c0bf7=_0x236c[_0x4e7fd5];return _0x4c0bf7;};'use strict';var EventEmitter=require(_0xc236('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc236('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc236('0x2')](0x0);var events={'afterCreate':_0xc236('0x3'),'afterUpdate':_0xc236('0x4'),'afterDestroy':_0xc236('0x5')};function emitEvent(_0x518d6a){return function(_0x3adce9,_0x36e87d,_0x33bc57){WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a+':'+_0x3adce9['id'],_0x3adce9);WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a,_0x3adce9);_0x33bc57(null);};}for(var e in events){if(events[_0xc236('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xc236('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x55ea=['WhatsappMessage','save','update','remove','exports','events','../../mysqldb'];(function(_0x204b04,_0x19f527){var _0x22a79b=function(_0x4b9464){while(--_0x4b9464){_0x204b04['push'](_0x204b04['shift']());}};_0x22a79b(++_0x19f527);}(_0x55ea,0xc9));var _0xa55e=function(_0x1bba1e,_0x28a649){_0x1bba1e=_0x1bba1e-0x0;var _0x32ece7=_0x55ea[_0x1bba1e];return _0x32ece7;};'use strict';var EventEmitter=require(_0xa55e('0x0'));var WhatsappMessage=require(_0xa55e('0x1'))['db'][_0xa55e('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa55e('0x3'),'afterUpdate':_0xa55e('0x4'),'afterDestroy':_0xa55e('0x5')};function emitEvent(_0x1325cc){return function(_0x95af3d,_0x54f178,_0x2d1040){WhatsappMessageEvents['emit'](_0x1325cc+':'+_0x95af3d['id'],_0x95af3d);WhatsappMessageEvents['emit'](_0x1325cc,_0x95af3d);_0x2d1040(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xa55e('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ab83164..d681262 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 _0xf83f=['create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','direction','catch','error','find','WhatsappAccountId','type','authToken','phone','accountSid','messages'];(function(_0x2edea1,_0x38457c){var _0x5c9576=function(_0x3e6cda){while(--_0x3e6cda){_0x2edea1['push'](_0x2edea1['shift']());}};_0x5c9576(++_0x38457c);}(_0xf83f,0xf8));var _0xff83=function(_0x1383de,_0x1fbad2){_0x1383de=_0x1383de-0x0;var _0x4d1bad=_0xf83f[_0x1383de];return _0x4d1bad;};'use strict';var _=require(_0xff83('0x0'));var util=require(_0xff83('0x1'));var logger=require('../../config/logger')(_0xff83('0x2'));var moment=require(_0xff83('0x3'));var BPromise=require(_0xff83('0x4'));var rp=require(_0xff83('0x5'));var fs=require('fs');var path=require(_0xff83('0x6'));var rimraf=require('rimraf');var config=require(_0xff83('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0xff83('0x8')]=function(_0x5a24ba,_0x22a1b6){return _0x5a24ba[_0xff83('0x9')](_0xff83('0xa'),attributes,{'tableName':_0xff83('0xb'),'paranoid':![],'indexes':[{'name':_0xff83('0xc'),'fields':[_0xff83('0xc')]},{'name':_0xff83('0xd'),'fields':['body'],'type':_0xff83('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x30af33,_0x5b2cdf,_0x310d6a){var _0x1bc2ab=_0x5a24ba['models'];var _0x551774=_0x30af33[_0xff83('0xf')]({'plain':!![]});if(_0x551774['direction']['toLowerCase']()==='in'||_0x551774['direction'][_0xff83('0x10')]()===_0xff83('0x11')&&!_0x551774[_0xff83('0x12')]&&!_[_0xff83('0x13')](_0x551774[_0xff83('0x14')])){_0x1bc2ab[_0xff83('0x15')]['findOne']({'where':{'id':_0x551774[_0xff83('0x16')]}})[_0xff83('0x17')](function(_0x15843d){if(_0x15843d){_0x15843d['update']({'lastMsgAt':_0x551774['createdAt'],'lastMsgDirection':_0x551774[_0xff83('0x18')][_0xff83('0x10')]()});}})[_0xff83('0x19')](function(_0x2e5403){console[_0xff83('0x1a')](_0x2e5403);});}if(_0x551774['direction']===_0xff83('0x11')&&!_0x551774['secret']){var _0x561ac6;_0x1bc2ab['WhatsappAccount'][_0xff83('0x1b')]({'where':{'id':_0x551774[_0xff83('0x1c')]},'raw':!![]})[_0xff83('0x17')](function(_0x3de245){_0x561ac6=_0x3de245;if(_0x561ac6&&_0x561ac6['type']){switch(_0x561ac6[_0xff83('0x1d')]){case'twilio':var _0x3a05b4=require('twilio');if(_0x561ac6['accountSid']&&_0x561ac6[_0xff83('0x1e')]&&_0x561ac6[_0xff83('0x1f')]){var _0x4a961e=new _0x3a05b4(_0x561ac6[_0xff83('0x20')],_0x561ac6[_0xff83('0x1e')]);_0x4a961e[_0xff83('0x21')][_0xff83('0x22')]({'body':_0x551774[_0xff83('0x23')],'to':_0xff83('0x24')+_0x551774['phone'],'from':_0xff83('0x24')+_0x561ac6[_0xff83('0x1f')],'statusCallback':_0x561ac6[_0xff83('0x25')]+_0xff83('0x26')+_0x551774['id']+_0xff83('0x27')+_0x561ac6['token']})[_0xff83('0x17')](function(_0x1e5a13){if(_0x1e5a13['sid']){return _0x30af33[_0xff83('0x28')]({'messageId':_0x1e5a13[_0xff83('0x29')]});}})['catch'](function(_0x4ae3d6){logger[_0xff83('0x1a')](_0xff83('0x2a'),_0xff83('0x2b'),'twilio',util['inspect'](_0x4ae3d6,{'showHidden':![],'depth':null}));});}else{logger[_0xff83('0x1a')](_0xff83('0x2a'),_0xff83('0x2b'),_0xff83('0x2c'),_0xff83('0x2d'));}break;}}})['finally'](function(){_0x310d6a();});}else{_0x310d6a();}}},'charset':'utf8mb4','collate':_0xff83('0x2e')});}; \ No newline at end of file +var _0x53d1=['/api/whatsapp/messages/','/status?token=','token','sid','inspect','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','phone','messages','body'];(function(_0x35974c,_0x1421f1){var _0x3f3fce=function(_0x6f425c){while(--_0x6f425c){_0x35974c['push'](_0x35974c['shift']());}};_0x3f3fce(++_0x1421f1);}(_0x53d1,0xc6));var _0x153d=function(_0x50a3ea,_0x232e76){_0x50a3ea=_0x50a3ea-0x0;var _0x1b2169=_0x53d1[_0x50a3ea];return _0x1b2169;};'use strict';var _=require(_0x153d('0x0'));var util=require(_0x153d('0x1'));var logger=require(_0x153d('0x2'))(_0x153d('0x3'));var moment=require(_0x153d('0x4'));var BPromise=require('bluebird');var rp=require(_0x153d('0x5'));var fs=require('fs');var path=require(_0x153d('0x6'));var rimraf=require(_0x153d('0x7'));var config=require(_0x153d('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x153d('0x9')]=function(_0x5056d1,_0xd02876){return _0x5056d1[_0x153d('0xa')](_0x153d('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x153d('0xc'),'fields':[_0x153d('0xc')]},{'name':_0x153d('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b3f44,_0x2bc714,_0x2c487b){var _0x413db3=_0x5056d1[_0x153d('0xe')];var _0x583e4d=_0x4b3f44[_0x153d('0xf')]({'plain':!![]});if(_0x583e4d[_0x153d('0x10')][_0x153d('0x11')]()==='in'||_0x583e4d[_0x153d('0x10')][_0x153d('0x11')]()===_0x153d('0x12')&&!_0x583e4d[_0x153d('0x13')]&&!_[_0x153d('0x14')](_0x583e4d[_0x153d('0x15')])){_0x413db3[_0x153d('0x16')][_0x153d('0x17')]({'where':{'id':_0x583e4d[_0x153d('0x18')]}})[_0x153d('0x19')](function(_0xaa1754){if(_0xaa1754){_0xaa1754[_0x153d('0x1a')]({'lastMsgAt':_0x583e4d[_0x153d('0x1b')],'lastMsgDirection':_0x583e4d[_0x153d('0x10')][_0x153d('0x11')]()});}})[_0x153d('0x1c')](function(_0x4a0efa){console['error'](_0x4a0efa);});}if(_0x583e4d[_0x153d('0x10')]===_0x153d('0x12')&&!_0x583e4d[_0x153d('0x13')]){var _0x2839df;_0x413db3[_0x153d('0x1d')][_0x153d('0x1e')]({'where':{'id':_0x583e4d[_0x153d('0x1f')]},'raw':!![]})['then'](function(_0xec9658){_0x2839df=_0xec9658;if(_0x2839df&&_0x2839df[_0x153d('0x20')]){switch(_0x2839df['type']){case _0x153d('0x21'):var _0x317133=require(_0x153d('0x21'));if(_0x2839df['accountSid']&&_0x2839df['authToken']&&_0x2839df[_0x153d('0x22')]){var _0x1344e4=new _0x317133(_0x2839df['accountSid'],_0x2839df['authToken']);_0x1344e4[_0x153d('0x23')]['create']({'body':_0x583e4d[_0x153d('0x24')],'to':'whatsapp:'+_0x583e4d['phone'],'from':'whatsapp:'+_0x2839df[_0x153d('0x22')],'statusCallback':_0x2839df['remote']+_0x153d('0x25')+_0x583e4d['id']+_0x153d('0x26')+_0x2839df[_0x153d('0x27')]})[_0x153d('0x19')](function(_0x51f295){if(_0x51f295[_0x153d('0x28')]){return _0x4b3f44['update']({'messageId':_0x51f295['sid']});}})['catch'](function(_0x5f97b8){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x153d('0x21'),util[_0x153d('0x29')](_0x5f97b8,{'showHidden':![],'depth':null}));});}else{logger[_0x153d('0x2a')](_0x153d('0x2b'),_0x153d('0x2c'),_0x153d('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x153d('0x2d')](function(){_0x2c487b();});}else{_0x2c487b();}}},'charset':_0x153d('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f4a5adb..f893d20 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 _0xfe34=['stringify','error','code','message','result','catch','WhatsappMessage','create','body','options','raw','then','debug','CreateWhatsappMessage','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0xf3f965,_0x2b6275){var _0x20f2f9=function(_0x4a83c1){while(--_0x4a83c1){_0xf3f965['push'](_0xf3f965['shift']());}};_0x20f2f9(++_0x2b6275);}(_0xfe34,0x96));var _0x4fe3=function(_0x199bbd,_0x5220ff){_0x199bbd=_0x199bbd-0x0;var _0x363f2c=_0xfe34[_0x199bbd];return _0x363f2c;};'use strict';var _=require(_0x4fe3('0x0'));var util=require('util');var moment=require(_0x4fe3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fe3('0x2'));var db=require(_0x4fe3('0x3'))['db'];var utils=require(_0x4fe3('0x4'));var logger=require(_0x4fe3('0x5'))('rpc');var config=require(_0x4fe3('0x6'));var jayson=require(_0x4fe3('0x7'));var client=jayson[_0x4fe3('0x8')][_0x4fe3('0x9')]({'port':0x232a});config[_0x4fe3('0xa')]=_[_0x4fe3('0xb')](config[_0x4fe3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fe3('0xc'))(new Redis(config[_0x4fe3('0xa')]));require(_0x4fe3('0xd'))[_0x4fe3('0xe')](socket);function respondWithRpcPromise(_0x576c32,_0x2f05b6,_0x4274b7){return new BPromise(function(_0x1c14d5,_0x20a437){return client[_0x4fe3('0xf')](_0x576c32,_0x4274b7)['then'](function(_0x464bd1){logger[_0x4fe3('0x10')](_0x4fe3('0x11'),_0x2f05b6,_0x4fe3('0x12'));logger['debug'](_0x4fe3('0x13'),_0x2f05b6,_0x4fe3('0x12'),JSON[_0x4fe3('0x14')](_0x464bd1));if(_0x464bd1[_0x4fe3('0x15')]){if(_0x464bd1[_0x4fe3('0x15')][_0x4fe3('0x16')]===0x1f4){logger['error'](_0x4fe3('0x11'),_0x2f05b6,_0x464bd1[_0x4fe3('0x15')][_0x4fe3('0x17')]);return _0x20a437(_0x464bd1[_0x4fe3('0x15')][_0x4fe3('0x17')]);}logger['error'](_0x4fe3('0x11'),_0x2f05b6,_0x464bd1[_0x4fe3('0x15')][_0x4fe3('0x17')]);return _0x1c14d5(_0x464bd1[_0x4fe3('0x15')][_0x4fe3('0x17')]);}else{logger[_0x4fe3('0x10')](_0x4fe3('0x11'),_0x2f05b6,_0x4fe3('0x12'));_0x1c14d5(_0x464bd1[_0x4fe3('0x18')][_0x4fe3('0x17')]);}})[_0x4fe3('0x19')](function(_0x15d13e){logger[_0x4fe3('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x2f05b6,_0x15d13e);_0x20a437(_0x15d13e);});});}exports['CreateWhatsappMessage']=function(_0x14ce04){var _0x789ba3=this;return new Promise(function(_0x539cb4,_0x4ce7ff){return db[_0x4fe3('0x1a')][_0x4fe3('0x1b')](_0x14ce04[_0x4fe3('0x1c')],{'raw':_0x14ce04['options']?_0x14ce04[_0x4fe3('0x1d')][_0x4fe3('0x1e')]===undefined?!![]:![]:!![]})[_0x4fe3('0x1f')](function(_0x463914){logger[_0x4fe3('0x10')]('CreateWhatsappMessage',_0x14ce04);logger[_0x4fe3('0x20')](_0x4fe3('0x21'),_0x14ce04,JSON[_0x4fe3('0x14')](_0x463914));_0x539cb4(_0x463914);})[_0x4fe3('0x19')](function(_0x3b2327){logger[_0x4fe3('0x15')](_0x4fe3('0x21'),_0x3b2327['message'],_0x14ce04);_0x4ce7ff(_0x789ba3[_0x4fe3('0x15')](0x1f4,_0x3b2327[_0x4fe3('0x17')]));});});}; \ No newline at end of file +var _0x1f90=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','request','then','info','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','CreateWhatsappMessage','WhatsappMessage','create','body','options','catch','lodash','util','bluebird','randomstring'];(function(_0x5f234b,_0x5b2a7f){var _0x348bf8=function(_0x32b0ab){while(--_0x32b0ab){_0x5f234b['push'](_0x5f234b['shift']());}};_0x348bf8(++_0x5b2a7f);}(_0x1f90,0x1be));var _0x01f9=function(_0xeb80c9,_0x3fe888){_0xeb80c9=_0xeb80c9-0x0;var _0x259c37=_0x1f90[_0xeb80c9];return _0x259c37;};'use strict';var _=require(_0x01f9('0x0'));var util=require(_0x01f9('0x1'));var moment=require('moment');var BPromise=require(_0x01f9('0x2'));var rs=require(_0x01f9('0x3'));var fs=require('fs');var Redis=require(_0x01f9('0x4'));var db=require(_0x01f9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x01f9('0x6'));var config=require(_0x01f9('0x7'));var jayson=require(_0x01f9('0x8'));var client=jayson[_0x01f9('0x9')][_0x01f9('0xa')]({'port':0x232a});config['redis']=_[_0x01f9('0xb')](config[_0x01f9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x01f9('0xd'))(new Redis(config['redis']));require(_0x01f9('0xe'))['register'](socket);function respondWithRpcPromise(_0x4a53da,_0x4746b1,_0x14b38c){return new BPromise(function(_0xd9499c,_0x51e163){return client[_0x01f9('0xf')](_0x4a53da,_0x14b38c)[_0x01f9('0x10')](function(_0x41e226){logger[_0x01f9('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x4746b1,'request\x20sent');logger[_0x01f9('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4746b1,'request\x20sent',JSON[_0x01f9('0x13')](_0x41e226));if(_0x41e226[_0x01f9('0x14')]){if(_0x41e226[_0x01f9('0x14')][_0x01f9('0x15')]===0x1f4){logger[_0x01f9('0x14')](_0x01f9('0x16'),_0x4746b1,_0x41e226['error'][_0x01f9('0x17')]);return _0x51e163(_0x41e226['error'][_0x01f9('0x17')]);}logger[_0x01f9('0x14')](_0x01f9('0x16'),_0x4746b1,_0x41e226[_0x01f9('0x14')][_0x01f9('0x17')]);return _0xd9499c(_0x41e226[_0x01f9('0x14')][_0x01f9('0x17')]);}else{logger[_0x01f9('0x11')](_0x01f9('0x16'),_0x4746b1,'request\x20sent');_0xd9499c(_0x41e226['result'][_0x01f9('0x17')]);}})['catch'](function(_0x4da88c){logger[_0x01f9('0x14')](_0x01f9('0x16'),_0x4746b1,_0x4da88c);_0x51e163(_0x4da88c);});});}exports[_0x01f9('0x18')]=function(_0x28683d){var _0x49dab8=this;return new Promise(function(_0x50b063,_0x2f4bc3){return db[_0x01f9('0x19')][_0x01f9('0x1a')](_0x28683d[_0x01f9('0x1b')],{'raw':_0x28683d[_0x01f9('0x1c')]?_0x28683d['options']['raw']===undefined?!![]:![]:!![]})[_0x01f9('0x10')](function(_0x2f9ac6){logger[_0x01f9('0x11')](_0x01f9('0x18'),_0x28683d);logger[_0x01f9('0x12')](_0x01f9('0x18'),_0x28683d,JSON[_0x01f9('0x13')](_0x2f9ac6));_0x50b063(_0x2f9ac6);})[_0x01f9('0x1d')](function(_0x434f3a){logger[_0x01f9('0x14')]('CreateWhatsappMessage',_0x434f3a[_0x01f9('0x17')],_0x28683d);_0x2f4bc3(_0x49dab8['error'](0x1f4,_0x434f3a[_0x01f9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 75eb09c..96691c5 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 _0x7fb8=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x7fb8,0xab));var _0x87fb=function(_0x245b41,_0x3fddfa){_0x245b41=_0x245b41-0x0;var _0x818684=_0x7fb8[_0x245b41];return _0x818684;};'use strict';var WhatsappMessageEvents=require(_0x87fb('0x0'));var events=[_0x87fb('0x1'),_0x87fb('0x2'),_0x87fb('0x3')];function createListener(_0x33216c,_0x3f3b51){return function(_0x43f1a0){_0x3f3b51[_0x87fb('0x4')](_0x33216c,_0x43f1a0);};}function removeListener(_0x56a2b7,_0x41dd78){return function(){WhatsappMessageEvents['removeListener'](_0x56a2b7,_0x41dd78);};}exports[_0x87fb('0x5')]=function(_0x3c4ccb){for(var _0x432bdb=0x0,_0x21a3fd=events[_0x87fb('0x6')];_0x432bdb<_0x21a3fd;_0x432bdb++){var _0x5724c6=events[_0x432bdb];var _0x4ea045=createListener(_0x87fb('0x7')+_0x5724c6,_0x3c4ccb);WhatsappMessageEvents['on'](_0x5724c6,_0x4ea045);}}; \ No newline at end of file +var _0x27f5=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x230471,_0x10441f){var _0x5dd908=function(_0x2bbc28){while(--_0x2bbc28){_0x230471['push'](_0x230471['shift']());}};_0x5dd908(++_0x10441f);}(_0x27f5,0xbb));var _0x527f=function(_0x2c4260,_0x19882c){_0x2c4260=_0x2c4260-0x0;var _0x13972e=_0x27f5[_0x2c4260];return _0x13972e;};'use strict';var WhatsappMessageEvents=require(_0x527f('0x0'));var events=[_0x527f('0x1'),_0x527f('0x2'),_0x527f('0x3')];function createListener(_0x54f272,_0x310860){return function(_0x22b970){_0x310860[_0x527f('0x4')](_0x54f272,_0x22b970);};}function removeListener(_0x251198,_0x2a3240){return function(){WhatsappMessageEvents['removeListener'](_0x251198,_0x2a3240);};}exports[_0x527f('0x5')]=function(_0x4f01ed){for(var _0x4cea9f=0x0,_0x53a27c=events[_0x527f('0x6')];_0x4cea9f<_0x53a27c;_0x4cea9f++){var _0x35bf26=events[_0x4cea9f];var _0x4c02dc=createListener(_0x527f('0x7')+_0x35bf26,_0x4f01ed);WhatsappMessageEvents['on'](_0x35bf26,_0x4c02dc);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 4134851..6a81dd2 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 _0xc139=['create','addTeams','/:id/users','addAgents','put','destroy','delete','removeTeams','removeAgents','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','getMembers','/:id/teams','getTeams','post'];(function(_0x33e470,_0x2fe85b){var _0x37d1c5=function(_0x200e69){while(--_0x200e69){_0x33e470['push'](_0x33e470['shift']());}};_0x37d1c5(++_0x2fe85b);}(_0xc139,0x1b9));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9c13('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9c13('0x1'));var express=require(_0x9c13('0x2'));var router=express[_0x9c13('0x3')]();var fs_extra=require(_0x9c13('0x4'));var auth=require(_0x9c13('0x5'));var interaction=require(_0x9c13('0x6'));var config=require(_0x9c13('0x7'));var controller=require(_0x9c13('0x8'));router[_0x9c13('0x9')]('/',auth[_0x9c13('0xa')](),controller[_0x9c13('0xb')]);router[_0x9c13('0x9')](_0x9c13('0xc'),auth[_0x9c13('0xa')](),controller['describe']);router[_0x9c13('0x9')](_0x9c13('0xd'),auth[_0x9c13('0xa')](),controller['show']);router[_0x9c13('0x9')]('/:id/members',auth[_0x9c13('0xa')](),controller[_0x9c13('0xe')]);router[_0x9c13('0x9')](_0x9c13('0xf'),auth['isAuthenticated'](),controller[_0x9c13('0x10')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x9c13('0x11')]('/',auth['isAuthenticated'](),controller[_0x9c13('0x12')]);router[_0x9c13('0x11')](_0x9c13('0xf'),auth['isAuthenticated'](),controller[_0x9c13('0x13')]);router[_0x9c13('0x11')](_0x9c13('0x14'),auth[_0x9c13('0xa')](),controller[_0x9c13('0x15')]);router[_0x9c13('0x16')](_0x9c13('0xd'),auth[_0x9c13('0xa')](),controller['update']);router['delete'](_0x9c13('0xd'),auth[_0x9c13('0xa')](),controller[_0x9c13('0x17')]);router[_0x9c13('0x18')]('/:id/teams',auth[_0x9c13('0xa')](),controller[_0x9c13('0x19')]);router[_0x9c13('0x18')](_0x9c13('0x14'),auth['isAuthenticated'](),controller[_0x9c13('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xa4de=['getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','/describe','isAuthenticated','describe','show','getMembers','/:id/teams'];(function(_0x24c7fe,_0x28aad9){var _0x3ee6bf=function(_0x71c27b){while(--_0x71c27b){_0x24c7fe['push'](_0x24c7fe['shift']());}};_0x3ee6bf(++_0x28aad9);}(_0xa4de,0x107));var _0xea4d=function(_0xe7dfc2,_0x59ef08){_0xe7dfc2=_0xe7dfc2-0x0;var _0x17aa52=_0xa4de[_0xe7dfc2];return _0x17aa52;};'use strict';var multer=require(_0xea4d('0x0'));var util=require(_0xea4d('0x1'));var path=require('path');var timeout=require(_0xea4d('0x2'));var express=require(_0xea4d('0x3'));var router=express[_0xea4d('0x4')]();var fs_extra=require(_0xea4d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea4d('0x6'));var config=require(_0xea4d('0x7'));var controller=require(_0xea4d('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xea4d('0x9')](_0xea4d('0xa'),auth[_0xea4d('0xb')](),controller[_0xea4d('0xc')]);router[_0xea4d('0x9')]('/:id',auth[_0xea4d('0xb')](),controller[_0xea4d('0xd')]);router[_0xea4d('0x9')]('/:id/members',auth[_0xea4d('0xb')](),controller[_0xea4d('0xe')]);router['get'](_0xea4d('0xf'),auth[_0xea4d('0xb')](),controller[_0xea4d('0x10')]);router[_0xea4d('0x9')]('/:id/users',auth[_0xea4d('0xb')](),controller[_0xea4d('0x11')]);router[_0xea4d('0x12')]('/',auth['isAuthenticated'](),controller[_0xea4d('0x13')]);router[_0xea4d('0x12')](_0xea4d('0xf'),auth[_0xea4d('0xb')](),controller[_0xea4d('0x14')]);router[_0xea4d('0x12')](_0xea4d('0x15'),auth['isAuthenticated'](),controller[_0xea4d('0x16')]);router[_0xea4d('0x17')]('/:id',auth[_0xea4d('0xb')](),controller[_0xea4d('0x18')]);router[_0xea4d('0x19')](_0xea4d('0x1a'),auth[_0xea4d('0xb')](),controller[_0xea4d('0x1b')]);router['delete'](_0xea4d('0xf'),auth[_0xea4d('0xb')](),controller[_0xea4d('0x1c')]);router['delete']('/:id/users',auth[_0xea4d('0xb')](),controller[_0xea4d('0x1d')]);module[_0xea4d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 2f1802c..3faee21 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 _0x93e7=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x93e7,0x9e));var _0x793e=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0x93e7[_0xd3b0ac];return _0x3d773e;};'use strict';var Sequelize=require(_0x793e('0x0'));module['exports']={'name':{'type':Sequelize[_0x793e('0x1')],'unique':_0x793e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x793e('0x3')](_0x793e('0x4'),_0x793e('0x5'),_0x793e('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7217=['roundrobin','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x213144,_0x184a2e){var _0x24b3e2=function(_0x3e8b68){while(--_0x3e8b68){_0x213144['push'](_0x213144['shift']());}};_0x24b3e2(++_0x184a2e);}(_0x7217,0xa9));var _0x7721=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x7217[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7721('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7721('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7721('0x2')](_0x7721('0x3'),_0x7721('0x4'),_0x7721('0x5'))},'description':{'type':Sequelize[_0x7721('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f446d20..f41eef0 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 _0x321b=['status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','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','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','transaction','each','forEach','userWhatsappQueue:save','removeTeams','ids','select','field','from','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','emit','User','getAgents','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x321b,0xf7));var _0xb321=function(_0x20ffa2,_0x41da40){_0x20ffa2=_0x20ffa2-0x0;var _0x42c967=_0x321b[_0x20ffa2];return _0x42c967;};'use strict';var emlformat=require(_0xb321('0x0'));var rimraf=require(_0xb321('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb321('0x2'));var BPromise=require(_0xb321('0x3'));var Mustache=require(_0xb321('0x4'));var util=require('util');var path=require(_0xb321('0x5'));var sox=require(_0xb321('0x6'));var csv=require(_0xb321('0x7'));var ejs=require(_0xb321('0x8'));var fs=require('fs');var fs_extra=require(_0xb321('0x9'));var _=require(_0xb321('0xa'));var squel=require(_0xb321('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb321('0x7'));var querystring=require(_0xb321('0xc'));var Papa=require(_0xb321('0xd'));var Redis=require(_0xb321('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb321('0xf'));var hardwareService=require(_0xb321('0x10'));var logger=require(_0xb321('0x11'))('api');var utils=require(_0xb321('0x12'));var config=require(_0xb321('0x13'));var licenseUtil=require(_0xb321('0x14'));var db=require(_0xb321('0x15'))['db'];config[_0xb321('0x16')]=_['defaults'](config[_0xb321('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xb321('0x17'))(new Redis(config[_0xb321('0x16')]));require(_0xb321('0x18'))[_0xb321('0x19')](socket);function respondWithStatusCode(_0x4d794f,_0x5f1a4f){_0x5f1a4f=_0x5f1a4f||0xcc;return function(_0x262f5f){if(_0x262f5f){return _0x4d794f[_0xb321('0x1a')](_0x5f1a4f);}return _0x4d794f[_0xb321('0x1b')](_0x5f1a4f)['end']();};}function respondWithResult(_0x5e24fd,_0x32b576){_0x32b576=_0x32b576||0xc8;return function(_0x64397e){if(_0x64397e){return _0x5e24fd[_0xb321('0x1b')](_0x32b576)[_0xb321('0x1c')](_0x64397e);}};}function respondWithFilteredResult(_0xaacc1c,_0x2403f4){return function(_0x5c7872){if(_0x5c7872){var _0x1f52de=typeof _0x2403f4[_0xb321('0x1d')]==='undefined'&&typeof _0x2403f4[_0xb321('0x1e')]===_0xb321('0x1f');var _0x2fc1df=_0x5c7872[_0xb321('0x20')];var _0x2109bb=_0x1f52de?0x0:_0x2403f4['offset'];var _0x44b417=_0x1f52de?_0x5c7872[_0xb321('0x20')]:_0x2403f4[_0xb321('0x1d')]+_0x2403f4[_0xb321('0x1e')];var _0x590992;if(_0x44b417>=_0x2fc1df){_0x44b417=_0x2fc1df;_0x590992=0xc8;}else{_0x590992=0xce;}_0xaacc1c[_0xb321('0x1b')](_0x590992);return _0xaacc1c[_0xb321('0x21')]('Content-Range',_0x2109bb+'-'+_0x44b417+'/'+_0x2fc1df)[_0xb321('0x1c')](_0x5c7872);}return null;};}function patchUpdates(_0x1a2420){return function(_0x34ae23){try{jsonpatch[_0xb321('0x22')](_0x34ae23,_0x1a2420,!![]);}catch(_0x2c6b8b){return BPromise[_0xb321('0x23')](_0x2c6b8b);}return _0x34ae23[_0xb321('0x24')]();};}function saveUpdates(_0x4a5940,_0x57fc65){return function(_0x940869){if(_0x940869){return _0x940869[_0xb321('0x25')](_0x4a5940)[_0xb321('0x26')](function(_0x4dfe56){return _0x4dfe56;});}return null;};}function removeEntity(_0x456ab7,_0x39d1ce){return function(_0x14fb3a){if(_0x14fb3a){return _0x14fb3a[_0xb321('0x27')]()[_0xb321('0x26')](function(){var _0x21e2fc=_0x14fb3a[_0xb321('0x28')]({'plain':!![]});var _0x3215f6=_0xb321('0x29');return db[_0xb321('0x2a')][_0xb321('0x27')]({'where':{'type':_0x3215f6,'resourceId':_0x21e2fc['id']}})[_0xb321('0x26')](function(){return _0x14fb3a;});})[_0xb321('0x26')](function(){_0x456ab7[_0xb321('0x1b')](0xcc)[_0xb321('0x2b')]();});}};}function handleEntityNotFound(_0x1ba012,_0x1c675c){return function(_0x3142d2){if(!_0x3142d2){_0x1ba012['sendStatus'](0x194);}return _0x3142d2;};}function handleError(_0x5ebff7,_0x387ced){_0x387ced=_0x387ced||0x1f4;return function(_0xba30b2){logger[_0xb321('0x2c')](_0xba30b2['stack']);if(_0xba30b2[_0xb321('0x2d')]){delete _0xba30b2[_0xb321('0x2d')];}_0x5ebff7['status'](_0x387ced)[_0xb321('0x2e')](_0xba30b2);};}exports[_0xb321('0x2f')]=function(_0x21b7ab,_0x3d558d){var _0x263721={},_0x2695b0={},_0x1bc87e={'count':0x0,'rows':[]};var _0xd26962=_[_0xb321('0x30')](db[_0xb321('0x31')][_0xb321('0x32')],function(_0x4b8182){return{'name':_0x4b8182[_0xb321('0x33')],'type':_0x4b8182[_0xb321('0x34')][_0xb321('0x35')]};});_0x2695b0[_0xb321('0x36')]=_[_0xb321('0x30')](_0xd26962,_0xb321('0x2d'));_0x2695b0[_0xb321('0x37')]=_[_0xb321('0x38')](_0x21b7ab[_0xb321('0x37')]);_0x2695b0['filters']=_[_0xb321('0x39')](_0x2695b0[_0xb321('0x36')],_0x2695b0[_0xb321('0x37')]);_0x263721[_0xb321('0x3a')]=_[_0xb321('0x39')](_0x2695b0[_0xb321('0x36')],qs[_0xb321('0x3b')](_0x21b7ab['query'][_0xb321('0x3b')]));_0x263721[_0xb321('0x3a')]=_0x263721[_0xb321('0x3a')][_0xb321('0x3c')]?_0x263721['attributes']:_0x2695b0[_0xb321('0x36')];if(!_0x21b7ab[_0xb321('0x37')][_0xb321('0x3d')](_0xb321('0x3e'))){_0x263721[_0xb321('0x1e')]=qs[_0xb321('0x1e')](_0x21b7ab[_0xb321('0x37')]['limit']);_0x263721['offset']=qs[_0xb321('0x1d')](_0x21b7ab[_0xb321('0x37')][_0xb321('0x1d')]);}_0x263721[_0xb321('0x3f')]=qs[_0xb321('0x40')](_0x21b7ab[_0xb321('0x37')]['sort']);_0x263721[_0xb321('0x41')]=qs[_0xb321('0x42')](_[_0xb321('0x43')](_0x21b7ab['query'],_0x2695b0[_0xb321('0x42')]),_0xd26962);if(_0x21b7ab['query'][_0xb321('0x44')]){_0x263721[_0xb321('0x41')]=_[_0xb321('0x45')](_0x263721[_0xb321('0x41')],{'$or':_[_0xb321('0x30')](_0xd26962,function(_0x50e0b3){if(_0x50e0b3[_0xb321('0x34')]!=='VIRTUAL'){var _0x53a3fb={};_0x53a3fb[_0x50e0b3['name']]={'$like':'%'+_0x21b7ab[_0xb321('0x37')][_0xb321('0x44')]+'%'};return _0x53a3fb;}})});}_0x263721=_[_0xb321('0x45')]({},_0x263721,_0x21b7ab[_0xb321('0x46')]);var _0x14d93f={'where':_0x263721[_0xb321('0x41')]};return db['WhatsappQueue'][_0xb321('0x20')](_0x14d93f)[_0xb321('0x26')](function(_0x59d020){_0x1bc87e[_0xb321('0x20')]=_0x59d020;if(_0x21b7ab[_0xb321('0x37')][_0xb321('0x47')]){_0x263721[_0xb321('0x48')]=[{'all':!![]}];}return db[_0xb321('0x31')][_0xb321('0x49')](_0x263721);})['then'](function(_0x4121d0){_0x1bc87e[_0xb321('0x4a')]=_0x4121d0;return _0x1bc87e;})['then'](respondWithFilteredResult(_0x3d558d,_0x263721))[_0xb321('0x4b')](handleError(_0x3d558d,null));};exports[_0xb321('0x4c')]=function(_0x69b780,_0x40cb06){var _0x419191={'raw':!![],'where':{'id':_0x69b780[_0xb321('0x4d')]['id']}},_0x40f10a={};_0x40f10a[_0xb321('0x36')]=_[_0xb321('0x38')](db[_0xb321('0x31')]['rawAttributes']);_0x40f10a[_0xb321('0x37')]=_[_0xb321('0x38')](_0x69b780[_0xb321('0x37')]);_0x40f10a[_0xb321('0x42')]=_['intersection'](_0x40f10a[_0xb321('0x36')],_0x40f10a[_0xb321('0x37')]);_0x419191[_0xb321('0x3a')]=_[_0xb321('0x39')](_0x40f10a[_0xb321('0x36')],qs[_0xb321('0x3b')](_0x69b780['query'][_0xb321('0x3b')]));_0x419191['attributes']=_0x419191[_0xb321('0x3a')]['length']?_0x419191[_0xb321('0x3a')]:_0x40f10a[_0xb321('0x36')];if(_0x69b780[_0xb321('0x37')][_0xb321('0x47')]){_0x419191[_0xb321('0x48')]=[{'all':!![]}];}_0x419191=_[_0xb321('0x45')]({},_0x419191,_0x69b780[_0xb321('0x46')]);return db['WhatsappQueue'][_0xb321('0x4e')](_0x419191)[_0xb321('0x26')](handleEntityNotFound(_0x40cb06,null))[_0xb321('0x26')](respondWithResult(_0x40cb06,null))[_0xb321('0x4b')](handleError(_0x40cb06,null));};exports[_0xb321('0x4f')]=function(_0x3007c9,_0x8640c){return db[_0xb321('0x31')][_0xb321('0x4f')](_0x3007c9[_0xb321('0x50')],{})['then'](function(_0x252447){var _0x1521a9=_0x3007c9[_0xb321('0x51')][_0xb321('0x28')]({'plain':!![]});if(!_0x1521a9)throw new Error(_0xb321('0x52'));if(_0x1521a9[_0xb321('0x53')]==='user'){var _0x39f87a=_0x252447[_0xb321('0x28')]({'plain':!![]});var _0x548ac5=_0xb321('0x29');return db[_0xb321('0x54')][_0xb321('0x4e')]({'where':{'name':_0x548ac5,'userProfileId':_0x1521a9[_0xb321('0x55')]},'raw':!![]})[_0xb321('0x26')](function(_0xc1f389){if(_0xc1f389&&_0xc1f389[_0xb321('0x56')]===0x0){return db[_0xb321('0x2a')][_0xb321('0x4f')]({'name':_0x39f87a[_0xb321('0x2d')],'resourceId':_0x39f87a['id'],'type':_0xc1f389['name'],'sectionId':_0xc1f389['id']},{})['then'](function(){return _0x252447;});}else{return _0x252447;}})['catch'](function(_0x17c22){logger['error'](_0xb321('0x57'),_0x17c22);throw _0x17c22;});}return _0x252447;})[_0xb321('0x26')](respondWithResult(_0x8640c,0xc9))[_0xb321('0x4b')](handleError(_0x8640c,null));};exports[_0xb321('0x25')]=function(_0x2c2ec0,_0x1d3806){if(_0x2c2ec0[_0xb321('0x50')]['id']){delete _0x2c2ec0[_0xb321('0x50')]['id'];}return db['WhatsappQueue'][_0xb321('0x4e')]({'where':{'id':_0x2c2ec0[_0xb321('0x4d')]['id']}})[_0xb321('0x26')](handleEntityNotFound(_0x1d3806,null))['then'](saveUpdates(_0x2c2ec0[_0xb321('0x50')],null))[_0xb321('0x26')](respondWithResult(_0x1d3806,null))[_0xb321('0x4b')](handleError(_0x1d3806,null));};exports['destroy']=function(_0x1b06b7,_0x4ab627){return db[_0xb321('0x31')][_0xb321('0x4e')]({'where':{'id':_0x1b06b7[_0xb321('0x4d')]['id']}})[_0xb321('0x26')](handleEntityNotFound(_0x4ab627,null))[_0xb321('0x26')](removeEntity(_0x4ab627,null))[_0xb321('0x4b')](handleError(_0x4ab627,null));};exports['describe']=function(_0x2f0c55,_0x4d5948){return db[_0xb321('0x31')][_0xb321('0x58')]()['then'](respondWithResult(_0x4d5948,null))[_0xb321('0x4b')](handleError(_0x4d5948,null));};exports[_0xb321('0x59')]=function(_0x18525e,_0x592b4b,_0x4e1fd0){var _0xc639da={'raw':!![],'where':{}},_0x28d8c8={},_0x51026b;return db['WhatsappQueue'][_0xb321('0x5a')]({'where':{'id':_0x18525e['params']['id']}})['then'](handleEntityNotFound(_0x592b4b,null))[_0xb321('0x26')](function(_0xea4284){if(_0xea4284){_0x51026b=_0xea4284[_0xb321('0x28')]({'plain':!![]});_0x28d8c8[_0xb321('0x36')]=_[_0xb321('0x38')](db[_0xb321('0x5b')][_0xb321('0x32')]);_0x28d8c8[_0xb321('0x37')]=_[_0xb321('0x38')](_0x18525e['query']);_0x28d8c8['filters']=_[_0xb321('0x39')](_0x28d8c8[_0xb321('0x36')],_0x28d8c8[_0xb321('0x37')]);_0xc639da[_0xb321('0x3a')]=_[_0xb321('0x39')](_0x28d8c8['model'],qs[_0xb321('0x3b')](_0x18525e[_0xb321('0x37')][_0xb321('0x3b')]));_0xc639da[_0xb321('0x3a')]=_0xc639da[_0xb321('0x3a')]['length']?_0xc639da[_0xb321('0x3a')]:_0x28d8c8[_0xb321('0x36')];if(!_0x18525e['query'][_0xb321('0x3d')]('nolimit')){_0xc639da[_0xb321('0x1e')]=qs[_0xb321('0x1e')](_0x18525e['query'][_0xb321('0x1e')]);_0xc639da['offset']=qs[_0xb321('0x1d')](_0x18525e[_0xb321('0x37')][_0xb321('0x1d')]);}_0xc639da[_0xb321('0x3f')]=qs[_0xb321('0x40')](_0x18525e[_0xb321('0x37')][_0xb321('0x40')]);_0xc639da[_0xb321('0x41')]=qs[_0xb321('0x42')](_[_0xb321('0x43')](_0x18525e[_0xb321('0x37')],_0x28d8c8[_0xb321('0x42')]));_0xc639da[_0xb321('0x41')][_0xb321('0x5c')]=_0xea4284['id'];if(_0x18525e[_0xb321('0x37')][_0xb321('0x44')]){_0xc639da[_0xb321('0x41')]=_[_0xb321('0x45')](_0xc639da['where'],{'$or':_[_0xb321('0x30')](_0xc639da['attributes'],function(_0x589954){var _0x3aaf76={};_0x3aaf76[_0x589954]={'$like':'%'+_0x18525e['query'][_0xb321('0x44')]+'%'};return _0x3aaf76;})});}_0xc639da=_[_0xb321('0x45')]({},_0xc639da,_0x18525e[_0xb321('0x46')]);return db['UserWhatsappQueue']['findAll'](_0xc639da);}})[_0xb321('0x26')](function(_0x5ec819){if(_0x5ec819){return db['User'][_0xb321('0x5d')]({'where':{'id':_[_0xb321('0x30')](_0x5ec819,'UserId'),'role':_0xb321('0x5e')},'attributes':['id',_0xb321('0x2d'),_0xb321('0x5f'),_0xb321('0x60'),_0xb321('0x61')]});}})[_0xb321('0x26')](function(_0x500f8d){if(_0x500f8d){return{'count':_0x500f8d[_0xb321('0x20')],'rows':_[_0xb321('0x30')](_0x500f8d[_0xb321('0x4a')],function(_0x2ec373){return{'membername':_0x2ec373['name'],'UserId':_0x2ec373['id'],'queue_name':_0x51026b[_0xb321('0x2d')],'WhatsappQueueId':_0x51026b['id'],'interface':util[_0xb321('0x62')]('%s/%s','SIP',_0x2ec373[_0xb321('0x2d')]),'penalty':0x0,'paused':_0x2ec373[_0xb321('0x5f')],'createdAt':_0x2ec373['createdAt'],'updatedAt':_0x2ec373['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb321('0x26')](respondWithFilteredResult(_0x592b4b,_0xc639da))[_0xb321('0x4b')](handleError(_0x592b4b,null));};exports[_0xb321('0x63')]=function(_0xd4e586,_0x5c6e50,_0x583d50){var _0x58435d={};var _0x272685={};var _0x442d58;var _0x42de8b;return db[_0xb321('0x31')]['findOne']({'where':{'id':_0xd4e586['params']['id']}})[_0xb321('0x26')](handleEntityNotFound(_0x5c6e50,null))[_0xb321('0x26')](function(_0x1b8c98){if(_0x1b8c98){_0x442d58=_0x1b8c98;_0x272685['model']=_[_0xb321('0x38')](db[_0xb321('0x64')][_0xb321('0x32')]);_0x272685[_0xb321('0x37')]=_['keys'](_0xd4e586[_0xb321('0x37')]);_0x272685[_0xb321('0x42')]=_[_0xb321('0x39')](_0x272685[_0xb321('0x36')],_0x272685[_0xb321('0x37')]);_0x58435d[_0xb321('0x3a')]=_['intersection'](_0x272685[_0xb321('0x36')],qs['fields'](_0xd4e586[_0xb321('0x37')][_0xb321('0x3b')]));_0x58435d[_0xb321('0x3a')]=_0x58435d[_0xb321('0x3a')][_0xb321('0x3c')]?_0x58435d[_0xb321('0x3a')]:_0x272685[_0xb321('0x36')];_0x58435d[_0xb321('0x3f')]=qs[_0xb321('0x40')](_0xd4e586['query']['sort']);_0x58435d[_0xb321('0x41')]=qs[_0xb321('0x42')](_[_0xb321('0x43')](_0xd4e586['query'],_0x272685[_0xb321('0x42')]));if(_0xd4e586[_0xb321('0x37')]['filter']){_0x58435d[_0xb321('0x41')]=_[_0xb321('0x45')](_0x58435d[_0xb321('0x41')],{'$or':_['map'](_0x58435d[_0xb321('0x3a')],function(_0x104e92){var _0x1238cc={};_0x1238cc[_0x104e92]={'$like':'%'+_0xd4e586['query'][_0xb321('0x44')]+'%'};return _0x1238cc;})});}_0x58435d=_[_0xb321('0x45')]({},_0x58435d,_0xd4e586['options']);return _0x442d58[_0xb321('0x63')](_0x58435d);}})[_0xb321('0x26')](function(_0x46471f){if(_0x46471f){_0x42de8b=_0x46471f[_0xb321('0x3c')];if(!_0xd4e586['query'][_0xb321('0x3d')]('nolimit')){_0x58435d['limit']=qs['limit'](_0xd4e586[_0xb321('0x37')][_0xb321('0x1e')]);_0x58435d[_0xb321('0x1d')]=qs[_0xb321('0x1d')](_0xd4e586[_0xb321('0x37')][_0xb321('0x1d')]);}return _0x442d58[_0xb321('0x63')](_0x58435d);}})[_0xb321('0x26')](function(_0x4e78f1){if(_0x4e78f1){return _0x4e78f1?{'count':_0x42de8b,'rows':_0x4e78f1}:null;}})[_0xb321('0x26')](respondWithResult(_0x5c6e50,null))[_0xb321('0x4b')](handleError(_0x5c6e50,null));};exports[_0xb321('0x65')]=function(_0x50636b,_0x6cc31f,_0x447a64){var _0x15dd1e=_0x50636b[_0xb321('0x50')]['ids'];return db['Team'][_0xb321('0x49')]({'where':{'id':_0x15dd1e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb321('0x66'),'attributes':['id','name',_0xb321('0x67'),_0xb321('0x68'),'interface'],'raw':!![]}]})[_0xb321('0x26')](function(_0x192ed6){if(_0x192ed6){var _0x242aa9=_[_0xb321('0x69')](_0x192ed6,function(_0x35faf7){var _0x4a45ad=_0x35faf7['get']({'plain':!![]});return _0x4a45ad[_0xb321('0x66')];});return db['WhatsappQueue'][_0xb321('0x4e')]({'where':{'id':_0x50636b['params']['id']}})['then'](function(_0x2d0deb){return db['sequelize'][_0xb321('0x6a')](function(_0x35c238){return _0x2d0deb[_0xb321('0x65')](_0x15dd1e,{'transaction':_0x35c238})[_0xb321('0x26')](function(){return BPromise[_0xb321('0x6b')](_0x242aa9,function(_0x297c9d){return db[_0xb321('0x5b')]['findOrCreate']({'where':{'UserId':_0x297c9d['id'],'WhatsappQueueId':_0x50636b[_0xb321('0x4d')]['id']},'transaction':_0x35c238});});})[_0xb321('0x26')](function(){_0x242aa9[_0xb321('0x6c')](function(_0x34fc23){socket['emit'](_0xb321('0x6d'),{'UserId':_0x34fc23['id'],'WhatsappQueueId':_0x2d0deb['id']});});});});});}})[_0xb321('0x26')](respondWithStatusCode(_0x6cc31f,null))[_0xb321('0x4b')](handleError(_0x6cc31f,null));};exports[_0xb321('0x6e')]=function(_0x3833e7,_0x2c6996,_0x30c3bb){return db[_0xb321('0x64')][_0xb321('0x49')]({'where':{'id':_0x3833e7['query'][_0xb321('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb321('0x66'),'attributes':['id'],'raw':!![]}]})[_0xb321('0x26')](handleEntityNotFound(_0x2c6996,null))[_0xb321('0x26')](function(_0x5b82c8){var _0x556e6d=_['map'](_0x5b82c8,'id');var _0x20480d=[];var _0x114656=[];var _0x4afd3a=squel[_0xb321('0x70')]();_0x4afd3a[_0xb321('0x71')]('tq.TeamId')[_0xb321('0x72')]('team_has_whatsapp_queues','tq')[_0xb321('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb321('0x41')](_0xb321('0x74'),_0x3833e7[_0xb321('0x4d')]['id']);for(var _0x315fbc=0x0;_0x315fbc<_0x5b82c8[_0xb321('0x3c')];_0x315fbc+=0x1){let _0x3ae4eb=_0x5b82c8[_0x315fbc];for(var _0x339ebc=0x0;_0x339ebc<_0x3ae4eb['Agents'][_0xb321('0x3c')];_0x339ebc+=0x1){let _0x2fb418=_0x3ae4eb[_0xb321('0x66')][_0x339ebc];var _0x1c497d=_0x4afd3a[_0xb321('0x75')]();_0x1c497d[_0xb321('0x41')](_0xb321('0x76'),_0x2fb418['id']);_0x114656[_0xb321('0x77')](db[_0xb321('0x78')]['query'](_0x1c497d[_0xb321('0x79')](),{'type':db[_0xb321('0x78')][_0xb321('0x7a')]['SELECT']})[_0xb321('0x26')](function(_0x32ca76){if(_0x32ca76[_0xb321('0x3c')]===0x1){return _0x2fb418['id'];}else{var _0x33cabd=_[_0xb321('0x7b')](_[_0xb321('0x30')](_0x32ca76,_0xb321('0x7c')),function(_0x725e43){return _[_0xb321('0x7d')](_0x556e6d,_0x725e43);});if(_0x33cabd){return _0x2fb418['id'];}}}));}}return BPromise['all'](_0x114656)[_0xb321('0x26')](function(_0x459be2){_0x20480d=_(_0x20480d)[_0xb321('0x7e')](_0x459be2)[_0xb321('0x7f')]()[_0xb321('0x80')]();return db[_0xb321('0x31')][_0xb321('0x4e')]({'where':{'id':_0x3833e7[_0xb321('0x4d')]['id']}})['then'](function(_0x532242){return db[_0xb321('0x78')][_0xb321('0x6a')](function(_0x541349){return _0x532242[_0xb321('0x6e')](_0x3833e7[_0xb321('0x37')][_0xb321('0x6f')],{'transaction':_0x541349})[_0xb321('0x26')](function(){if(!_[_0xb321('0x81')](_0x20480d)){return _0x532242[_0xb321('0x82')](_0x20480d,{'transaction':_0x541349});}})['then'](function(){_0x20480d[_0xb321('0x6c')](function(_0x30e91e){socket['emit'](_0xb321('0x83'),{'UserId':_0x30e91e,'WhatsappQueueId':_0x532242['id']});});});});});});})[_0xb321('0x26')](respondWithStatusCode(_0x2c6996,null))[_0xb321('0x4b')](handleError(_0x2c6996,null));};exports['addAgents']=function(_0x440640,_0xc02f96,_0x362a27){return db[_0xb321('0x31')][_0xb321('0x4e')]({'where':{'id':_0x440640[_0xb321('0x4d')]['id']}})[_0xb321('0x26')](handleEntityNotFound(_0xc02f96,null))[_0xb321('0x26')](function(_0x469a4c){if(_0x469a4c){return _0x469a4c[_0xb321('0x84')](_0x440640['body']['ids'],_[_0xb321('0x85')](_0x440640[_0xb321('0x50')],[_0xb321('0x6f'),'id'])||{})['spread'](function(_0x5222e9){for(var _0x41e071=0x0;_0x41e071<_0x440640[_0xb321('0x50')][_0xb321('0x6f')][_0xb321('0x3c')];_0x41e071+=0x1){socket[_0xb321('0x86')](_0xb321('0x6d'),{'UserId':Number(_0x440640[_0xb321('0x50')]['ids'][_0x41e071]),'WhatsappQueueId':Number(_0x440640[_0xb321('0x4d')]['id'])});}return _0x5222e9;});}})[_0xb321('0x26')](respondWithResult(_0xc02f96,null))[_0xb321('0x4b')](handleError(_0xc02f96,null));};exports[_0xb321('0x82')]=function(_0x581f11,_0x2094a5,_0x30570b){return db['WhatsappQueue'][_0xb321('0x4e')]({'where':{'id':_0x581f11[_0xb321('0x4d')]['id']}})[_0xb321('0x26')](handleEntityNotFound(_0x2094a5,null))[_0xb321('0x26')](function(_0x19a675){if(_0x19a675){return _0x19a675[_0xb321('0x82')](_0x581f11[_0xb321('0x37')][_0xb321('0x6f')])[_0xb321('0x26')](function(){if(_['isArray'](_0x581f11['query'][_0xb321('0x6f')])){for(var _0x510564=0x0;_0x510564<_0x581f11[_0xb321('0x37')][_0xb321('0x6f')][_0xb321('0x3c')];_0x510564+=0x1){socket[_0xb321('0x86')]('userWhatsappQueue:remove',{'UserId':Number(_0x581f11['query'][_0xb321('0x6f')][_0x510564]),'WhatsappQueueId':Number(_0x581f11[_0xb321('0x4d')]['id'])});}}else{socket[_0xb321('0x86')](_0xb321('0x83'),{'UserId':Number(_0x581f11[_0xb321('0x37')][_0xb321('0x6f')]),'WhatsappQueueId':Number(_0x581f11[_0xb321('0x4d')]['id'])});}});}})[_0xb321('0x26')](respondWithStatusCode(_0x2094a5,null))[_0xb321('0x4b')](handleError(_0x2094a5,null));};exports['getAgents']=function(_0x1fcee9,_0x427032,_0x8003b2){var _0x3fdb71={};var _0x409c83={};var _0x3c9abc;var _0x52c00e;return db[_0xb321('0x31')][_0xb321('0x5a')]({'where':{'id':_0x1fcee9['params']['id']}})['then'](handleEntityNotFound(_0x427032,null))[_0xb321('0x26')](function(_0x31cfaa){if(_0x31cfaa){_0x3c9abc=_0x31cfaa;_0x409c83[_0xb321('0x36')]=_[_0xb321('0x38')](db[_0xb321('0x87')]['rawAttributes']);_0x409c83[_0xb321('0x37')]=_[_0xb321('0x38')](_0x1fcee9[_0xb321('0x37')]);_0x409c83['filters']=_[_0xb321('0x39')](_0x409c83[_0xb321('0x36')],_0x409c83[_0xb321('0x37')]);_0x3fdb71['attributes']=_[_0xb321('0x39')](_0x409c83[_0xb321('0x36')],qs[_0xb321('0x3b')](_0x1fcee9[_0xb321('0x37')]['fields']));_0x3fdb71[_0xb321('0x3a')]=_0x3fdb71[_0xb321('0x3a')][_0xb321('0x3c')]?_0x3fdb71[_0xb321('0x3a')]:_0x409c83[_0xb321('0x36')];_0x3fdb71[_0xb321('0x3f')]=qs[_0xb321('0x40')](_0x1fcee9[_0xb321('0x37')][_0xb321('0x40')]);_0x3fdb71[_0xb321('0x41')]=qs[_0xb321('0x42')](_[_0xb321('0x43')](_0x1fcee9[_0xb321('0x37')],_0x409c83[_0xb321('0x42')]));if(_0x1fcee9[_0xb321('0x37')]['filter']){_0x3fdb71[_0xb321('0x41')]=_[_0xb321('0x45')](_0x3fdb71[_0xb321('0x41')],{'$or':_['map'](_0x3fdb71[_0xb321('0x3a')],function(_0x148953){var _0x19dbf6={};_0x19dbf6[_0x148953]={'$like':'%'+_0x1fcee9[_0xb321('0x37')][_0xb321('0x44')]+'%'};return _0x19dbf6;})});}_0x3fdb71=_[_0xb321('0x45')]({},_0x3fdb71,_0x1fcee9[_0xb321('0x46')]);return _0x3c9abc[_0xb321('0x88')](_0x3fdb71);}})['then'](function(_0x97ffa4){if(_0x97ffa4){_0x52c00e=_0x97ffa4[_0xb321('0x3c')];if(!_0x1fcee9['query']['hasOwnProperty'](_0xb321('0x3e'))){_0x3fdb71[_0xb321('0x1e')]=qs[_0xb321('0x1e')](_0x1fcee9[_0xb321('0x37')]['limit']);_0x3fdb71[_0xb321('0x1d')]=qs[_0xb321('0x1d')](_0x1fcee9[_0xb321('0x37')][_0xb321('0x1d')]);}return _0x3c9abc['getAgents'](_0x3fdb71);}})[_0xb321('0x26')](function(_0x5a7c08){if(_0x5a7c08){return _0x5a7c08?{'count':_0x52c00e,'rows':_0x5a7c08}:null;}})['then'](respondWithResult(_0x427032,null))['catch'](handleError(_0x427032,null));}; \ No newline at end of file +var _0x2f1d=['send','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','catch','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','pick','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','status','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','end','sendStatus','error','stack','name'];(function(_0x20d304,_0x1ec407){var _0x186a62=function(_0x186d9d){while(--_0x186d9d){_0x20d304['push'](_0x20d304['shift']());}};_0x186a62(++_0x1ec407);}(_0x2f1d,0x187));var _0xd2f1=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x2f1d[_0x15c421];return _0x5e5ed5;};'use strict';var emlformat=require(_0xd2f1('0x0'));var rimraf=require(_0xd2f1('0x1'));var zipdir=require(_0xd2f1('0x2'));var jsonpatch=require(_0xd2f1('0x3'));var rp=require(_0xd2f1('0x4'));var moment=require('moment');var BPromise=require(_0xd2f1('0x5'));var Mustache=require(_0xd2f1('0x6'));var util=require(_0xd2f1('0x7'));var path=require(_0xd2f1('0x8'));var sox=require(_0xd2f1('0x9'));var csv=require('to-csv');var ejs=require(_0xd2f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd2f1('0xb'));var squel=require(_0xd2f1('0xc'));var crypto=require(_0xd2f1('0xd'));var jsforce=require(_0xd2f1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd2f1('0xf'));var Papa=require(_0xd2f1('0x10'));var Redis=require(_0xd2f1('0x11'));var authService=require(_0xd2f1('0x12'));var qs=require(_0xd2f1('0x13'));var as=require(_0xd2f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2f1('0x15'))(_0xd2f1('0x16'));var utils=require(_0xd2f1('0x17'));var config=require(_0xd2f1('0x18'));var licenseUtil=require(_0xd2f1('0x19'));var db=require(_0xd2f1('0x1a'))['db'];config[_0xd2f1('0x1b')]=_['defaults'](config[_0xd2f1('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xd2f1('0x1c'))(new Redis(config['redis']));require(_0xd2f1('0x1d'))[_0xd2f1('0x1e')](socket);function respondWithStatusCode(_0x140bec,_0x32728f){_0x32728f=_0x32728f||0xcc;return function(_0x9b0d6e){if(_0x9b0d6e){return _0x140bec['sendStatus'](_0x32728f);}return _0x140bec[_0xd2f1('0x1f')](_0x32728f)['end']();};}function respondWithResult(_0x54b97c,_0x137aef){_0x137aef=_0x137aef||0xc8;return function(_0x579011){if(_0x579011){return _0x54b97c[_0xd2f1('0x1f')](_0x137aef)['json'](_0x579011);}};}function respondWithFilteredResult(_0x3d45b0,_0x534f7d){return function(_0x88cd27){if(_0x88cd27){var _0x5a1cf0=typeof _0x534f7d[_0xd2f1('0x20')]===_0xd2f1('0x21')&&typeof _0x534f7d['limit']===_0xd2f1('0x21');var _0x333846=_0x88cd27[_0xd2f1('0x22')];var _0x337a89=_0x5a1cf0?0x0:_0x534f7d[_0xd2f1('0x20')];var _0xa38a08=_0x5a1cf0?_0x88cd27[_0xd2f1('0x22')]:_0x534f7d[_0xd2f1('0x20')]+_0x534f7d[_0xd2f1('0x23')];var _0x43b342;if(_0xa38a08>=_0x333846){_0xa38a08=_0x333846;_0x43b342=0xc8;}else{_0x43b342=0xce;}_0x3d45b0[_0xd2f1('0x1f')](_0x43b342);return _0x3d45b0['set'](_0xd2f1('0x24'),_0x337a89+'-'+_0xa38a08+'/'+_0x333846)['json'](_0x88cd27);}return null;};}function patchUpdates(_0x512a6d){return function(_0x2ac64f){try{jsonpatch[_0xd2f1('0x25')](_0x2ac64f,_0x512a6d,!![]);}catch(_0x5c996c){return BPromise[_0xd2f1('0x26')](_0x5c996c);}return _0x2ac64f[_0xd2f1('0x27')]();};}function saveUpdates(_0x196493,_0x1be0dd){return function(_0x2c954f){if(_0x2c954f){return _0x2c954f[_0xd2f1('0x28')](_0x196493)[_0xd2f1('0x29')](function(_0xb4a4c){return _0xb4a4c;});}return null;};}function removeEntity(_0x1cf7ac,_0x6e4ef5){return function(_0x5d6b6c){if(_0x5d6b6c){return _0x5d6b6c[_0xd2f1('0x2a')]()[_0xd2f1('0x29')](function(){var _0x5efa1d=_0x5d6b6c['get']({'plain':!![]});var _0x2c855a=_0xd2f1('0x2b');return db[_0xd2f1('0x2c')][_0xd2f1('0x2a')]({'where':{'type':_0x2c855a,'resourceId':_0x5efa1d['id']}})[_0xd2f1('0x29')](function(){return _0x5d6b6c;});})[_0xd2f1('0x29')](function(){_0x1cf7ac['status'](0xcc)[_0xd2f1('0x2d')]();});}};}function handleEntityNotFound(_0x3b874a,_0x31645a){return function(_0x277c3d){if(!_0x277c3d){_0x3b874a[_0xd2f1('0x2e')](0x194);}return _0x277c3d;};}function handleError(_0x2cd0ce,_0x2ff8b4){_0x2ff8b4=_0x2ff8b4||0x1f4;return function(_0x55668c){logger[_0xd2f1('0x2f')](_0x55668c[_0xd2f1('0x30')]);if(_0x55668c[_0xd2f1('0x31')]){delete _0x55668c[_0xd2f1('0x31')];}_0x2cd0ce[_0xd2f1('0x1f')](_0x2ff8b4)[_0xd2f1('0x32')](_0x55668c);};}exports[_0xd2f1('0x33')]=function(_0xea9fb3,_0x34677d){var _0x2d941a={},_0x142d2c={},_0x30b315={'count':0x0,'rows':[]};var _0x89b5dc=_[_0xd2f1('0x34')](db[_0xd2f1('0x35')][_0xd2f1('0x36')],function(_0x446596){return{'name':_0x446596[_0xd2f1('0x37')],'type':_0x446596['type'][_0xd2f1('0x38')]};});_0x142d2c[_0xd2f1('0x39')]=_[_0xd2f1('0x34')](_0x89b5dc,_0xd2f1('0x31'));_0x142d2c[_0xd2f1('0x3a')]=_[_0xd2f1('0x3b')](_0xea9fb3['query']);_0x142d2c[_0xd2f1('0x3c')]=_[_0xd2f1('0x3d')](_0x142d2c[_0xd2f1('0x39')],_0x142d2c[_0xd2f1('0x3a')]);_0x2d941a[_0xd2f1('0x3e')]=_['intersection'](_0x142d2c[_0xd2f1('0x39')],qs['fields'](_0xea9fb3[_0xd2f1('0x3a')][_0xd2f1('0x3f')]));_0x2d941a['attributes']=_0x2d941a[_0xd2f1('0x3e')][_0xd2f1('0x40')]?_0x2d941a[_0xd2f1('0x3e')]:_0x142d2c[_0xd2f1('0x39')];if(!_0xea9fb3[_0xd2f1('0x3a')]['hasOwnProperty'](_0xd2f1('0x41'))){_0x2d941a['limit']=qs[_0xd2f1('0x23')](_0xea9fb3['query'][_0xd2f1('0x23')]);_0x2d941a[_0xd2f1('0x20')]=qs[_0xd2f1('0x20')](_0xea9fb3[_0xd2f1('0x3a')]['offset']);}_0x2d941a['order']=qs[_0xd2f1('0x42')](_0xea9fb3[_0xd2f1('0x3a')][_0xd2f1('0x42')]);_0x2d941a[_0xd2f1('0x43')]=qs[_0xd2f1('0x3c')](_['pick'](_0xea9fb3[_0xd2f1('0x3a')],_0x142d2c[_0xd2f1('0x3c')]),_0x89b5dc);if(_0xea9fb3['query'][_0xd2f1('0x44')]){_0x2d941a['where']=_['merge'](_0x2d941a['where'],{'$or':_[_0xd2f1('0x34')](_0x89b5dc,function(_0x2df942){if(_0x2df942[_0xd2f1('0x45')]!==_0xd2f1('0x46')){var _0x2271e2={};_0x2271e2[_0x2df942['name']]={'$like':'%'+_0xea9fb3[_0xd2f1('0x3a')][_0xd2f1('0x44')]+'%'};return _0x2271e2;}})});}_0x2d941a=_[_0xd2f1('0x47')]({},_0x2d941a,_0xea9fb3[_0xd2f1('0x48')]);var _0x1875e3={'where':_0x2d941a[_0xd2f1('0x43')]};return db['WhatsappQueue'][_0xd2f1('0x22')](_0x1875e3)[_0xd2f1('0x29')](function(_0x443898){_0x30b315[_0xd2f1('0x22')]=_0x443898;if(_0xea9fb3['query'][_0xd2f1('0x49')]){_0x2d941a[_0xd2f1('0x4a')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xd2f1('0x4b')](_0x2d941a);})[_0xd2f1('0x29')](function(_0x4f0dbe){_0x30b315['rows']=_0x4f0dbe;return _0x30b315;})[_0xd2f1('0x29')](respondWithFilteredResult(_0x34677d,_0x2d941a))['catch'](handleError(_0x34677d,null));};exports[_0xd2f1('0x4c')]=function(_0x3e074f,_0xbe3707){var _0x281a7c={'raw':!![],'where':{'id':_0x3e074f['params']['id']}},_0x41be18={};_0x41be18['model']=_[_0xd2f1('0x3b')](db[_0xd2f1('0x35')][_0xd2f1('0x36')]);_0x41be18[_0xd2f1('0x3a')]=_['keys'](_0x3e074f[_0xd2f1('0x3a')]);_0x41be18[_0xd2f1('0x3c')]=_[_0xd2f1('0x3d')](_0x41be18[_0xd2f1('0x39')],_0x41be18[_0xd2f1('0x3a')]);_0x281a7c[_0xd2f1('0x3e')]=_[_0xd2f1('0x3d')](_0x41be18[_0xd2f1('0x39')],qs[_0xd2f1('0x3f')](_0x3e074f[_0xd2f1('0x3a')][_0xd2f1('0x3f')]));_0x281a7c[_0xd2f1('0x3e')]=_0x281a7c[_0xd2f1('0x3e')][_0xd2f1('0x40')]?_0x281a7c[_0xd2f1('0x3e')]:_0x41be18['model'];if(_0x3e074f[_0xd2f1('0x3a')][_0xd2f1('0x49')]){_0x281a7c['include']=[{'all':!![]}];}_0x281a7c=_[_0xd2f1('0x47')]({},_0x281a7c,_0x3e074f[_0xd2f1('0x48')]);return db['WhatsappQueue']['find'](_0x281a7c)[_0xd2f1('0x29')](handleEntityNotFound(_0xbe3707,null))[_0xd2f1('0x29')](respondWithResult(_0xbe3707,null))[_0xd2f1('0x4d')](handleError(_0xbe3707,null));};exports[_0xd2f1('0x4e')]=function(_0x5a61c8,_0x57f503){return db['WhatsappQueue']['create'](_0x5a61c8[_0xd2f1('0x4f')],{})[_0xd2f1('0x29')](function(_0x5b41d3){var _0x34543d=_0x5a61c8[_0xd2f1('0x50')][_0xd2f1('0x51')]({'plain':!![]});if(!_0x34543d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34543d[_0xd2f1('0x52')]===_0xd2f1('0x50')){var _0x19df7c=_0x5b41d3[_0xd2f1('0x51')]({'plain':!![]});var _0x3db3d6=_0xd2f1('0x2b');return db[_0xd2f1('0x53')]['find']({'where':{'name':_0x3db3d6,'userProfileId':_0x34543d['userProfileId']},'raw':!![]})['then'](function(_0x16220e){if(_0x16220e&&_0x16220e[_0xd2f1('0x54')]===0x0){return db[_0xd2f1('0x2c')][_0xd2f1('0x4e')]({'name':_0x19df7c[_0xd2f1('0x31')],'resourceId':_0x19df7c['id'],'type':_0x16220e[_0xd2f1('0x31')],'sectionId':_0x16220e['id']},{})[_0xd2f1('0x29')](function(){return _0x5b41d3;});}else{return _0x5b41d3;}})[_0xd2f1('0x4d')](function(_0x409e0e){logger['error'](_0xd2f1('0x55'),_0x409e0e);throw _0x409e0e;});}return _0x5b41d3;})[_0xd2f1('0x29')](respondWithResult(_0x57f503,0xc9))['catch'](handleError(_0x57f503,null));};exports[_0xd2f1('0x28')]=function(_0x27bbd4,_0x1009ef){if(_0x27bbd4[_0xd2f1('0x4f')]['id']){delete _0x27bbd4[_0xd2f1('0x4f')]['id'];}return db[_0xd2f1('0x35')][_0xd2f1('0x56')]({'where':{'id':_0x27bbd4[_0xd2f1('0x57')]['id']}})[_0xd2f1('0x29')](handleEntityNotFound(_0x1009ef,null))[_0xd2f1('0x29')](saveUpdates(_0x27bbd4[_0xd2f1('0x4f')],null))[_0xd2f1('0x29')](respondWithResult(_0x1009ef,null))[_0xd2f1('0x4d')](handleError(_0x1009ef,null));};exports[_0xd2f1('0x2a')]=function(_0x2e7de8,_0x44c417){return db[_0xd2f1('0x35')]['find']({'where':{'id':_0x2e7de8['params']['id']}})[_0xd2f1('0x29')](handleEntityNotFound(_0x44c417,null))['then'](removeEntity(_0x44c417,null))['catch'](handleError(_0x44c417,null));};exports[_0xd2f1('0x58')]=function(_0x4e2ce7,_0x40fb9c){return db[_0xd2f1('0x35')][_0xd2f1('0x58')]()[_0xd2f1('0x29')](respondWithResult(_0x40fb9c,null))[_0xd2f1('0x4d')](handleError(_0x40fb9c,null));};exports[_0xd2f1('0x59')]=function(_0x3c5c09,_0x1dcbcc,_0x2f18d3){var _0x5eccf2={'raw':!![],'where':{}},_0x3c4c89={},_0x5f4f07;return db['WhatsappQueue'][_0xd2f1('0x5a')]({'where':{'id':_0x3c5c09[_0xd2f1('0x57')]['id']}})[_0xd2f1('0x29')](handleEntityNotFound(_0x1dcbcc,null))[_0xd2f1('0x29')](function(_0x3d8a2c){if(_0x3d8a2c){_0x5f4f07=_0x3d8a2c[_0xd2f1('0x51')]({'plain':!![]});_0x3c4c89[_0xd2f1('0x39')]=_[_0xd2f1('0x3b')](db[_0xd2f1('0x5b')]['rawAttributes']);_0x3c4c89[_0xd2f1('0x3a')]=_['keys'](_0x3c5c09[_0xd2f1('0x3a')]);_0x3c4c89[_0xd2f1('0x3c')]=_[_0xd2f1('0x3d')](_0x3c4c89[_0xd2f1('0x39')],_0x3c4c89['query']);_0x5eccf2[_0xd2f1('0x3e')]=_[_0xd2f1('0x3d')](_0x3c4c89[_0xd2f1('0x39')],qs[_0xd2f1('0x3f')](_0x3c5c09[_0xd2f1('0x3a')]['fields']));_0x5eccf2[_0xd2f1('0x3e')]=_0x5eccf2[_0xd2f1('0x3e')]['length']?_0x5eccf2['attributes']:_0x3c4c89[_0xd2f1('0x39')];if(!_0x3c5c09[_0xd2f1('0x3a')][_0xd2f1('0x5c')]('nolimit')){_0x5eccf2[_0xd2f1('0x23')]=qs[_0xd2f1('0x23')](_0x3c5c09['query'][_0xd2f1('0x23')]);_0x5eccf2[_0xd2f1('0x20')]=qs[_0xd2f1('0x20')](_0x3c5c09[_0xd2f1('0x3a')][_0xd2f1('0x20')]);}_0x5eccf2[_0xd2f1('0x5d')]=qs['sort'](_0x3c5c09['query']['sort']);_0x5eccf2['where']=qs['filters'](_['pick'](_0x3c5c09[_0xd2f1('0x3a')],_0x3c4c89[_0xd2f1('0x3c')]));_0x5eccf2[_0xd2f1('0x43')][_0xd2f1('0x5e')]=_0x3d8a2c['id'];if(_0x3c5c09[_0xd2f1('0x3a')][_0xd2f1('0x44')]){_0x5eccf2['where']=_[_0xd2f1('0x47')](_0x5eccf2[_0xd2f1('0x43')],{'$or':_[_0xd2f1('0x34')](_0x5eccf2[_0xd2f1('0x3e')],function(_0x2a2e00){var _0x1f7e84={};_0x1f7e84[_0x2a2e00]={'$like':'%'+_0x3c5c09[_0xd2f1('0x3a')][_0xd2f1('0x44')]+'%'};return _0x1f7e84;})});}_0x5eccf2=_[_0xd2f1('0x47')]({},_0x5eccf2,_0x3c5c09[_0xd2f1('0x48')]);return db[_0xd2f1('0x5b')][_0xd2f1('0x4b')](_0x5eccf2);}})['then'](function(_0x5755ca){if(_0x5755ca){return db[_0xd2f1('0x5f')][_0xd2f1('0x60')]({'where':{'id':_[_0xd2f1('0x34')](_0x5755ca,_0xd2f1('0x61')),'role':'agent'},'attributes':['id',_0xd2f1('0x31'),_0xd2f1('0x62'),_0xd2f1('0x63'),'createdAt']});}})[_0xd2f1('0x29')](function(_0x1300fb){if(_0x1300fb){return{'count':_0x1300fb[_0xd2f1('0x22')],'rows':_[_0xd2f1('0x34')](_0x1300fb[_0xd2f1('0x64')],function(_0x255d8e){return{'membername':_0x255d8e[_0xd2f1('0x31')],'UserId':_0x255d8e['id'],'queue_name':_0x5f4f07[_0xd2f1('0x31')],'WhatsappQueueId':_0x5f4f07['id'],'interface':util[_0xd2f1('0x65')](_0xd2f1('0x66'),_0xd2f1('0x67'),_0x255d8e[_0xd2f1('0x31')]),'penalty':0x0,'paused':_0x255d8e['whatsappPause'],'createdAt':_0x255d8e[_0xd2f1('0x68')],'updatedAt':_0x255d8e[_0xd2f1('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd2f1('0x29')](respondWithFilteredResult(_0x1dcbcc,_0x5eccf2))[_0xd2f1('0x4d')](handleError(_0x1dcbcc,null));};exports[_0xd2f1('0x69')]=function(_0x28788f,_0x2ee4dd,_0x174419){var _0x34f417={};var _0x5f12db={};var _0x2e11f1;var _0x3c5b1a;return db[_0xd2f1('0x35')][_0xd2f1('0x5a')]({'where':{'id':_0x28788f[_0xd2f1('0x57')]['id']}})[_0xd2f1('0x29')](handleEntityNotFound(_0x2ee4dd,null))[_0xd2f1('0x29')](function(_0x47a631){if(_0x47a631){_0x2e11f1=_0x47a631;_0x5f12db[_0xd2f1('0x39')]=_[_0xd2f1('0x3b')](db[_0xd2f1('0x6a')]['rawAttributes']);_0x5f12db[_0xd2f1('0x3a')]=_[_0xd2f1('0x3b')](_0x28788f[_0xd2f1('0x3a')]);_0x5f12db['filters']=_['intersection'](_0x5f12db[_0xd2f1('0x39')],_0x5f12db[_0xd2f1('0x3a')]);_0x34f417[_0xd2f1('0x3e')]=_[_0xd2f1('0x3d')](_0x5f12db['model'],qs[_0xd2f1('0x3f')](_0x28788f[_0xd2f1('0x3a')][_0xd2f1('0x3f')]));_0x34f417[_0xd2f1('0x3e')]=_0x34f417[_0xd2f1('0x3e')][_0xd2f1('0x40')]?_0x34f417['attributes']:_0x5f12db[_0xd2f1('0x39')];_0x34f417[_0xd2f1('0x5d')]=qs[_0xd2f1('0x42')](_0x28788f[_0xd2f1('0x3a')]['sort']);_0x34f417[_0xd2f1('0x43')]=qs[_0xd2f1('0x3c')](_[_0xd2f1('0x6b')](_0x28788f['query'],_0x5f12db[_0xd2f1('0x3c')]));if(_0x28788f[_0xd2f1('0x3a')][_0xd2f1('0x44')]){_0x34f417[_0xd2f1('0x43')]=_['merge'](_0x34f417['where'],{'$or':_[_0xd2f1('0x34')](_0x34f417[_0xd2f1('0x3e')],function(_0x14d85a){var _0x7c5400={};_0x7c5400[_0x14d85a]={'$like':'%'+_0x28788f['query'][_0xd2f1('0x44')]+'%'};return _0x7c5400;})});}_0x34f417=_[_0xd2f1('0x47')]({},_0x34f417,_0x28788f['options']);return _0x2e11f1[_0xd2f1('0x69')](_0x34f417);}})[_0xd2f1('0x29')](function(_0x3569eb){if(_0x3569eb){_0x3c5b1a=_0x3569eb[_0xd2f1('0x40')];if(!_0x28788f[_0xd2f1('0x3a')][_0xd2f1('0x5c')]('nolimit')){_0x34f417[_0xd2f1('0x23')]=qs[_0xd2f1('0x23')](_0x28788f[_0xd2f1('0x3a')][_0xd2f1('0x23')]);_0x34f417[_0xd2f1('0x20')]=qs['offset'](_0x28788f['query']['offset']);}return _0x2e11f1[_0xd2f1('0x69')](_0x34f417);}})['then'](function(_0x39edf9){if(_0x39edf9){return _0x39edf9?{'count':_0x3c5b1a,'rows':_0x39edf9}:null;}})[_0xd2f1('0x29')](respondWithResult(_0x2ee4dd,null))[_0xd2f1('0x4d')](handleError(_0x2ee4dd,null));};exports[_0xd2f1('0x6c')]=function(_0x1e2e79,_0xb7bde1,_0x14f2ba){var _0x2939ec=_0x1e2e79[_0xd2f1('0x4f')][_0xd2f1('0x6d')];return db['Team'][_0xd2f1('0x4b')]({'where':{'id':_0x2939ec},'attributes':['id'],'include':[{'model':db[_0xd2f1('0x5f')],'as':'Agents','attributes':['id',_0xd2f1('0x31'),_0xd2f1('0x6e'),_0xd2f1('0x6f'),_0xd2f1('0x70')],'raw':!![]}]})[_0xd2f1('0x29')](function(_0x373e23){if(_0x373e23){var _0x112a0b=_[_0xd2f1('0x71')](_0x373e23,function(_0x4ce742){var _0x3f2b71=_0x4ce742[_0xd2f1('0x51')]({'plain':!![]});return _0x3f2b71[_0xd2f1('0x72')];});return db['WhatsappQueue'][_0xd2f1('0x56')]({'where':{'id':_0x1e2e79['params']['id']}})[_0xd2f1('0x29')](function(_0x4d9d70){return db[_0xd2f1('0x73')][_0xd2f1('0x74')](function(_0x1aae11){return _0x4d9d70[_0xd2f1('0x6c')](_0x2939ec,{'transaction':_0x1aae11})[_0xd2f1('0x29')](function(){return BPromise['each'](_0x112a0b,function(_0xb559fd){return db[_0xd2f1('0x5b')][_0xd2f1('0x75')]({'where':{'UserId':_0xb559fd['id'],'WhatsappQueueId':_0x1e2e79['params']['id']},'transaction':_0x1aae11});});})['then'](function(){_0x112a0b['forEach'](function(_0x5c8edb){socket[_0xd2f1('0x76')](_0xd2f1('0x77'),{'UserId':_0x5c8edb['id'],'WhatsappQueueId':_0x4d9d70['id']});});});});});}})['then'](respondWithStatusCode(_0xb7bde1,null))[_0xd2f1('0x4d')](handleError(_0xb7bde1,null));};exports['removeTeams']=function(_0x5c4fe7,_0x1e4678,_0x186d5b){return db['Team'][_0xd2f1('0x4b')]({'where':{'id':_0x5c4fe7[_0xd2f1('0x3a')][_0xd2f1('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xd2f1('0x5f')],'as':_0xd2f1('0x72'),'attributes':['id'],'raw':!![]}]})[_0xd2f1('0x29')](handleEntityNotFound(_0x1e4678,null))[_0xd2f1('0x29')](function(_0x377b69){var _0x21e586=_[_0xd2f1('0x34')](_0x377b69,'id');var _0x493f0a=[];var _0x378046=[];var _0x346012=squel[_0xd2f1('0x78')]();_0x346012[_0xd2f1('0x79')](_0xd2f1('0x7a'))[_0xd2f1('0x7b')](_0xd2f1('0x7c'),'tq')['join']('user_has_teams','ut',_0xd2f1('0x7d'))['where'](_0xd2f1('0x7e'),_0x5c4fe7[_0xd2f1('0x57')]['id']);for(var _0x4bdc41=0x0;_0x4bdc41<_0x377b69['length'];_0x4bdc41+=0x1){let _0x3c50ea=_0x377b69[_0x4bdc41];for(var _0xcf4a20=0x0;_0xcf4a20<_0x3c50ea[_0xd2f1('0x72')][_0xd2f1('0x40')];_0xcf4a20+=0x1){let _0x1c32c3=_0x3c50ea[_0xd2f1('0x72')][_0xcf4a20];var _0x376993=_0x346012['clone']();_0x376993['where'](_0xd2f1('0x7f'),_0x1c32c3['id']);_0x378046[_0xd2f1('0x80')](db['sequelize'][_0xd2f1('0x3a')](_0x376993[_0xd2f1('0x81')](),{'type':db[_0xd2f1('0x73')][_0xd2f1('0x82')][_0xd2f1('0x83')]})[_0xd2f1('0x29')](function(_0x53d123){if(_0x53d123[_0xd2f1('0x40')]===0x1){return _0x1c32c3['id'];}else{var _0x51ea2d=_[_0xd2f1('0x84')](_[_0xd2f1('0x34')](_0x53d123,_0xd2f1('0x85')),function(_0x38bef6){return _[_0xd2f1('0x86')](_0x21e586,_0x38bef6);});if(_0x51ea2d){return _0x1c32c3['id'];}}}));}}return BPromise[_0xd2f1('0x87')](_0x378046)[_0xd2f1('0x29')](function(_0x24ba2d){_0x493f0a=_(_0x493f0a)[_0xd2f1('0x88')](_0x24ba2d)[_0xd2f1('0x89')]()['value']();return db[_0xd2f1('0x35')][_0xd2f1('0x56')]({'where':{'id':_0x5c4fe7[_0xd2f1('0x57')]['id']}})[_0xd2f1('0x29')](function(_0xaf6140){return db[_0xd2f1('0x73')][_0xd2f1('0x74')](function(_0x31181a){return _0xaf6140['removeTeams'](_0x5c4fe7[_0xd2f1('0x3a')][_0xd2f1('0x6d')],{'transaction':_0x31181a})[_0xd2f1('0x29')](function(){if(!_[_0xd2f1('0x8a')](_0x493f0a)){return _0xaf6140[_0xd2f1('0x8b')](_0x493f0a,{'transaction':_0x31181a});}})['then'](function(){_0x493f0a[_0xd2f1('0x8c')](function(_0x2861ba){socket[_0xd2f1('0x76')](_0xd2f1('0x8d'),{'UserId':_0x2861ba,'WhatsappQueueId':_0xaf6140['id']});});});});});});})[_0xd2f1('0x29')](respondWithStatusCode(_0x1e4678,null))[_0xd2f1('0x4d')](handleError(_0x1e4678,null));};exports[_0xd2f1('0x8e')]=function(_0x2aa3fc,_0x116cb0,_0x1ceaa9){return db[_0xd2f1('0x35')][_0xd2f1('0x56')]({'where':{'id':_0x2aa3fc[_0xd2f1('0x57')]['id']}})['then'](handleEntityNotFound(_0x116cb0,null))[_0xd2f1('0x29')](function(_0x48ada2){if(_0x48ada2){return _0x48ada2[_0xd2f1('0x8e')](_0x2aa3fc[_0xd2f1('0x4f')][_0xd2f1('0x6d')],_[_0xd2f1('0x8f')](_0x2aa3fc[_0xd2f1('0x4f')],[_0xd2f1('0x6d'),'id'])||{})[_0xd2f1('0x90')](function(_0x1424d2){for(var _0x445831=0x0;_0x445831<_0x2aa3fc[_0xd2f1('0x4f')][_0xd2f1('0x6d')]['length'];_0x445831+=0x1){socket['emit'](_0xd2f1('0x77'),{'UserId':Number(_0x2aa3fc[_0xd2f1('0x4f')][_0xd2f1('0x6d')][_0x445831]),'WhatsappQueueId':Number(_0x2aa3fc[_0xd2f1('0x57')]['id'])});}return _0x1424d2;});}})[_0xd2f1('0x29')](respondWithResult(_0x116cb0,null))[_0xd2f1('0x4d')](handleError(_0x116cb0,null));};exports[_0xd2f1('0x8b')]=function(_0x333334,_0x5e5ad6,_0x353cfe){return db[_0xd2f1('0x35')]['find']({'where':{'id':_0x333334[_0xd2f1('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e5ad6,null))[_0xd2f1('0x29')](function(_0x3924b4){if(_0x3924b4){return _0x3924b4[_0xd2f1('0x8b')](_0x333334[_0xd2f1('0x3a')]['ids'])[_0xd2f1('0x29')](function(){if(_[_0xd2f1('0x91')](_0x333334['query'][_0xd2f1('0x6d')])){for(var _0xc8e771=0x0;_0xc8e771<_0x333334[_0xd2f1('0x3a')][_0xd2f1('0x6d')][_0xd2f1('0x40')];_0xc8e771+=0x1){socket[_0xd2f1('0x76')]('userWhatsappQueue:remove',{'UserId':Number(_0x333334['query'][_0xd2f1('0x6d')][_0xc8e771]),'WhatsappQueueId':Number(_0x333334[_0xd2f1('0x57')]['id'])});}}else{socket['emit'](_0xd2f1('0x8d'),{'UserId':Number(_0x333334[_0xd2f1('0x3a')][_0xd2f1('0x6d')]),'WhatsappQueueId':Number(_0x333334[_0xd2f1('0x57')]['id'])});}});}})[_0xd2f1('0x29')](respondWithStatusCode(_0x5e5ad6,null))[_0xd2f1('0x4d')](handleError(_0x5e5ad6,null));};exports[_0xd2f1('0x92')]=function(_0x1dbe60,_0x16c75e,_0x1488cb){var _0x5a87ba={};var _0x15a2f4={};var _0x33117c;var _0x58e195;return db[_0xd2f1('0x35')][_0xd2f1('0x5a')]({'where':{'id':_0x1dbe60['params']['id']}})[_0xd2f1('0x29')](handleEntityNotFound(_0x16c75e,null))[_0xd2f1('0x29')](function(_0x2b3927){if(_0x2b3927){_0x33117c=_0x2b3927;_0x15a2f4[_0xd2f1('0x39')]=_['keys'](db[_0xd2f1('0x5f')][_0xd2f1('0x36')]);_0x15a2f4['query']=_[_0xd2f1('0x3b')](_0x1dbe60['query']);_0x15a2f4['filters']=_[_0xd2f1('0x3d')](_0x15a2f4[_0xd2f1('0x39')],_0x15a2f4[_0xd2f1('0x3a')]);_0x5a87ba[_0xd2f1('0x3e')]=_['intersection'](_0x15a2f4[_0xd2f1('0x39')],qs['fields'](_0x1dbe60[_0xd2f1('0x3a')][_0xd2f1('0x3f')]));_0x5a87ba[_0xd2f1('0x3e')]=_0x5a87ba[_0xd2f1('0x3e')]['length']?_0x5a87ba[_0xd2f1('0x3e')]:_0x15a2f4[_0xd2f1('0x39')];_0x5a87ba[_0xd2f1('0x5d')]=qs[_0xd2f1('0x42')](_0x1dbe60['query'][_0xd2f1('0x42')]);_0x5a87ba[_0xd2f1('0x43')]=qs[_0xd2f1('0x3c')](_[_0xd2f1('0x6b')](_0x1dbe60[_0xd2f1('0x3a')],_0x15a2f4['filters']));if(_0x1dbe60[_0xd2f1('0x3a')]['filter']){_0x5a87ba[_0xd2f1('0x43')]=_['merge'](_0x5a87ba[_0xd2f1('0x43')],{'$or':_[_0xd2f1('0x34')](_0x5a87ba[_0xd2f1('0x3e')],function(_0x5b20f9){var _0x1819e7={};_0x1819e7[_0x5b20f9]={'$like':'%'+_0x1dbe60[_0xd2f1('0x3a')][_0xd2f1('0x44')]+'%'};return _0x1819e7;})});}_0x5a87ba=_[_0xd2f1('0x47')]({},_0x5a87ba,_0x1dbe60[_0xd2f1('0x48')]);return _0x33117c[_0xd2f1('0x92')](_0x5a87ba);}})['then'](function(_0xcdf8c9){if(_0xcdf8c9){_0x58e195=_0xcdf8c9[_0xd2f1('0x40')];if(!_0x1dbe60[_0xd2f1('0x3a')][_0xd2f1('0x5c')](_0xd2f1('0x41'))){_0x5a87ba[_0xd2f1('0x23')]=qs[_0xd2f1('0x23')](_0x1dbe60['query'][_0xd2f1('0x23')]);_0x5a87ba[_0xd2f1('0x20')]=qs[_0xd2f1('0x20')](_0x1dbe60['query'][_0xd2f1('0x20')]);}return _0x33117c[_0xd2f1('0x92')](_0x5a87ba);}})[_0xd2f1('0x29')](function(_0x213768){if(_0x213768){return _0x213768?{'count':_0x58e195,'rows':_0x213768}:null;}})['then'](respondWithResult(_0x16c75e,null))[_0xd2f1('0x4d')](handleError(_0x16c75e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 722f77d..f197beb 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 _0x977f=['emit','exports','../../mysqldb','remove'];(function(_0x49df41,_0x1cf984){var _0x6e4a55=function(_0x10268d){while(--_0x10268d){_0x49df41['push'](_0x49df41['shift']());}};_0x6e4a55(++_0x1cf984);}(_0x977f,0x152));var _0xf977=function(_0x11baca,_0x5426db){_0x11baca=_0x11baca-0x0;var _0x12359b=_0x977f[_0x11baca];return _0x12359b;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xf977('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf977('0x1')};function emitEvent(_0x475bb3){return function(_0x3d884e,_0x1cf82b,_0x4399a3){WhatsappQueueEvents[_0xf977('0x2')](_0x475bb3+':'+_0x3d884e['id'],_0x3d884e);WhatsappQueueEvents[_0xf977('0x2')](_0x475bb3,_0x3d884e);_0x4399a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xf977('0x3')]=WhatsappQueueEvents; \ No newline at end of file +var _0x83d7=['save','update','remove','emit','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x8e9597,_0x2aa555){var _0x3be06a=function(_0x7a8e7a){while(--_0x7a8e7a){_0x8e9597['push'](_0x8e9597['shift']());}};_0x3be06a(++_0x2aa555);}(_0x83d7,0x1e2));var _0x783d=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x83d7[_0x5b34c0];return _0x242bd3;};'use strict';var EventEmitter=require(_0x783d('0x0'));var WhatsappQueue=require(_0x783d('0x1'))['db'][_0x783d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x783d('0x3')](0x0);var events={'afterCreate':_0x783d('0x4'),'afterUpdate':_0x783d('0x5'),'afterDestroy':_0x783d('0x6')};function emitEvent(_0x3b1ffb){return function(_0xd4577d,_0xab8ada,_0xbfc59d){WhatsappQueueEvents['emit'](_0x3b1ffb+':'+_0xd4577d['id'],_0xd4577d);WhatsappQueueEvents[_0x783d('0x7')](_0x3b1ffb,_0xd4577d);_0xbfc59d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x783d('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index dd19b79..20cb2bf 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 _0x7509=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment'];(function(_0x59a40c,_0x35999f){var _0x3cf340=function(_0x3d2c47){while(--_0x3d2c47){_0x59a40c['push'](_0x59a40c['shift']());}};_0x3cf340(++_0x35999f);}(_0x7509,0x1a0));var _0x9750=function(_0x114211,_0x38ec1d){_0x114211=_0x114211-0x0;var _0x1c5440=_0x7509[_0x114211];return _0x1c5440;};'use strict';var _=require(_0x9750('0x0'));var util=require('util');var logger=require(_0x9750('0x1'))(_0x9750('0x2'));var moment=require(_0x9750('0x3'));var BPromise=require(_0x9750('0x4'));var rp=require(_0x9750('0x5'));var fs=require('fs');var path=require(_0x9750('0x6'));var rimraf=require(_0x9750('0x7'));var config=require(_0x9750('0x8'));var attributes=require(_0x9750('0x9'));module[_0x9750('0xa')]=function(_0x20f7f3,_0x547c2e){return _0x20f7f3[_0x9750('0xb')](_0x9750('0xc'),attributes,{'tableName':_0x9750('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78f9=['WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','bluebird','path','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0x595a77,_0x51bbe3){var _0x55ee58=function(_0x334087){while(--_0x334087){_0x595a77['push'](_0x595a77['shift']());}};_0x55ee58(++_0x51bbe3);}(_0x78f9,0x70));var _0x978f=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x78f9[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x978f('0x0'));var util=require('util');var logger=require(_0x978f('0x1'))(_0x978f('0x2'));var moment=require('moment');var BPromise=require(_0x978f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x978f('0x4'));var rimraf=require('rimraf');var config=require(_0x978f('0x5'));var attributes=require(_0x978f('0x6'));module[_0x978f('0x7')]=function(_0x11cd16,_0x2f4e54){return _0x11cd16[_0x978f('0x8')](_0x978f('0x9'),attributes,{'tableName':_0x978f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index e907804..a3cdbe5 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 _0x0c3f=['redis','localhost','./whatsappQueue.socket','register','request','info','request\x20sent','debug','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','attributes','include','map','model','then','find','where','ShowWhatsappQueue','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x4ec8f6,_0x20ab5b){var _0x43ccb6=function(_0x23458b){while(--_0x23458b){_0x4ec8f6['push'](_0x4ec8f6['shift']());}};_0x43ccb6(++_0x20ab5b);}(_0x0c3f,0x1cb));var _0xf0c3=function(_0x3f6b0c,_0x35c501){_0x3f6b0c=_0x3f6b0c-0x0;var _0x305f63=_0x0c3f[_0x3f6b0c];return _0x305f63;};'use strict';var _=require(_0xf0c3('0x0'));var util=require(_0xf0c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0c3('0x2'));var fs=require('fs');var Redis=require(_0xf0c3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0c3('0x4'));var logger=require('../../config/logger')(_0xf0c3('0x5'));var config=require(_0xf0c3('0x6'));var jayson=require(_0xf0c3('0x7'));var client=jayson['client'][_0xf0c3('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf0c3('0x9')],{'host':_0xf0c3('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf0c3('0xb'))[_0xf0c3('0xc')](socket);function respondWithRpcPromise(_0x4ba472,_0xef663c,_0x263bcd){return new BPromise(function(_0x46239c,_0x16eec0){return client[_0xf0c3('0xd')](_0x4ba472,_0x263bcd)['then'](function(_0x299bde){logger[_0xf0c3('0xe')]('WhatsappQueue,\x20%s,\x20%s',_0xef663c,_0xf0c3('0xf'));logger[_0xf0c3('0x10')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0xef663c,_0xf0c3('0xf'),JSON[_0xf0c3('0x11')](_0x299bde));if(_0x299bde[_0xf0c3('0x12')]){if(_0x299bde[_0xf0c3('0x12')][_0xf0c3('0x13')]===0x1f4){logger['error'](_0xf0c3('0x14'),_0xef663c,_0x299bde[_0xf0c3('0x12')][_0xf0c3('0x15')]);return _0x16eec0(_0x299bde[_0xf0c3('0x12')]['message']);}logger[_0xf0c3('0x12')](_0xf0c3('0x14'),_0xef663c,_0x299bde[_0xf0c3('0x12')][_0xf0c3('0x15')]);return _0x46239c(_0x299bde['error'][_0xf0c3('0x15')]);}else{logger[_0xf0c3('0xe')](_0xf0c3('0x14'),_0xef663c,_0xf0c3('0xf'));_0x46239c(_0x299bde[_0xf0c3('0x16')][_0xf0c3('0x15')]);}})[_0xf0c3('0x17')](function(_0x46b5eb){logger[_0xf0c3('0x12')](_0xf0c3('0x14'),_0xef663c,_0x46b5eb);_0x16eec0(_0x46b5eb);});});}exports[_0xf0c3('0x18')]=function(_0x189588){var _0x28c4ce=this;return new Promise(function(_0xc47da3,_0x4ba834){return db[_0xf0c3('0x19')]['findAll']({'raw':_0x189588[_0xf0c3('0x1a')]?_0x189588['options'][_0xf0c3('0x1b')]===undefined?!![]:![]:!![],'where':_0x189588[_0xf0c3('0x1a')]?_0x189588[_0xf0c3('0x1a')]['where']||null:null,'attributes':_0x189588[_0xf0c3('0x1a')]?_0x189588[_0xf0c3('0x1a')][_0xf0c3('0x1c')]||null:null,'limit':_0x189588[_0xf0c3('0x1a')]?_0x189588['options']['limit']||null:null,'include':_0x189588[_0xf0c3('0x1a')]?_0x189588[_0xf0c3('0x1a')][_0xf0c3('0x1d')]?_[_0xf0c3('0x1e')](_0x189588[_0xf0c3('0x1a')][_0xf0c3('0x1d')],function(_0x40fa3f){return{'model':db[_0x40fa3f[_0xf0c3('0x1f')]],'as':_0x40fa3f['as'],'attributes':_0x40fa3f[_0xf0c3('0x1c')],'include':_0x40fa3f[_0xf0c3('0x1d')]?_[_0xf0c3('0x1e')](_0x40fa3f['include'],function(_0x33b67e){return{'model':db[_0x33b67e[_0xf0c3('0x1f')]],'as':_0x33b67e['as'],'attributes':_0x33b67e[_0xf0c3('0x1c')],'include':_0x33b67e[_0xf0c3('0x1d')]?_['map'](_0x33b67e[_0xf0c3('0x1d')],function(_0x2e1368){return{'model':db[_0x2e1368[_0xf0c3('0x1f')]],'as':_0x2e1368['as'],'attributes':_0x2e1368[_0xf0c3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf0c3('0x20')](function(_0x433739){logger[_0xf0c3('0xe')]('GetWhatsappQueue',_0x189588);logger[_0xf0c3('0x10')](_0xf0c3('0x18'),_0x189588,JSON[_0xf0c3('0x11')](_0x433739));_0xc47da3(_0x433739);})[_0xf0c3('0x17')](function(_0x66c629){logger[_0xf0c3('0x12')](_0xf0c3('0x18'),_0x66c629[_0xf0c3('0x15')],_0x189588);_0x4ba834(_0x28c4ce[_0xf0c3('0x12')](0x1f4,_0x66c629[_0xf0c3('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x46b8c2){var _0x5dfb80=this;return new Promise(function(_0x1901f7,_0x2a1c67){return db[_0xf0c3('0x19')][_0xf0c3('0x21')]({'raw':_0x46b8c2[_0xf0c3('0x1a')]?_0x46b8c2[_0xf0c3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x46b8c2[_0xf0c3('0x1a')]?_0x46b8c2[_0xf0c3('0x1a')][_0xf0c3('0x22')]||null:null,'attributes':_0x46b8c2['options']?_0x46b8c2[_0xf0c3('0x1a')]['attributes']||null:null,'include':_0x46b8c2[_0xf0c3('0x1a')]?_0x46b8c2[_0xf0c3('0x1a')][_0xf0c3('0x1d')]?_[_0xf0c3('0x1e')](_0x46b8c2[_0xf0c3('0x1a')][_0xf0c3('0x1d')],function(_0x36176a){return{'model':db[_0x36176a[_0xf0c3('0x1f')]],'as':_0x36176a['as'],'attributes':_0x36176a[_0xf0c3('0x1c')],'include':_0x36176a[_0xf0c3('0x1d')]?_[_0xf0c3('0x1e')](_0x36176a[_0xf0c3('0x1d')],function(_0x712497){return{'model':db[_0x712497['model']],'as':_0x712497['as'],'attributes':_0x712497[_0xf0c3('0x1c')],'include':_0x712497[_0xf0c3('0x1d')]?_['map'](_0x712497['include'],function(_0x2f8323){return{'model':db[_0x2f8323[_0xf0c3('0x1f')]],'as':_0x2f8323['as'],'attributes':_0x2f8323[_0xf0c3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf0c3('0x20')](function(_0x17c8ef){logger[_0xf0c3('0xe')]('ShowWhatsappQueue',_0x46b8c2);logger[_0xf0c3('0x10')](_0xf0c3('0x23'),_0x46b8c2,JSON[_0xf0c3('0x11')](_0x17c8ef));_0x1901f7(_0x17c8ef);})[_0xf0c3('0x17')](function(_0x2f8ca7){logger[_0xf0c3('0x12')](_0xf0c3('0x23'),_0x2f8ca7['message'],_0x46b8c2);_0x2a1c67(_0x5dfb80[_0xf0c3('0x12')](0x1f4,_0x2f8ca7['message']));});});}; \ No newline at end of file +var _0x2a4d=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','lodash','util','moment'];(function(_0x67a151,_0x3201de){var _0x47b5a8=function(_0x2bf317){while(--_0x2bf317){_0x67a151['push'](_0x67a151['shift']());}};_0x47b5a8(++_0x3201de);}(_0x2a4d,0x1d6));var _0xd2a4=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x2a4d[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xd2a4('0x0'));var util=require(_0xd2a4('0x1'));var moment=require(_0xd2a4('0x2'));var BPromise=require(_0xd2a4('0x3'));var rs=require(_0xd2a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2a4('0x5'))['db'];var utils=require(_0xd2a4('0x6'));var logger=require(_0xd2a4('0x7'))(_0xd2a4('0x8'));var config=require(_0xd2a4('0x9'));var jayson=require(_0xd2a4('0xa'));var client=jayson[_0xd2a4('0xb')][_0xd2a4('0xc')]({'port':0x232a});config[_0xd2a4('0xd')]=_[_0xd2a4('0xe')](config[_0xd2a4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd2a4('0xf'))(new Redis(config['redis']));require(_0xd2a4('0x10'))[_0xd2a4('0x11')](socket);function respondWithRpcPromise(_0x43d8ef,_0x3f178e,_0x5b0f98){return new BPromise(function(_0xc92589,_0x326835){return client[_0xd2a4('0x12')](_0x43d8ef,_0x5b0f98)[_0xd2a4('0x13')](function(_0x8ec172){logger[_0xd2a4('0x14')](_0xd2a4('0x15'),_0x3f178e,_0xd2a4('0x16'));logger[_0xd2a4('0x17')](_0xd2a4('0x18'),_0x3f178e,_0xd2a4('0x16'),JSON[_0xd2a4('0x19')](_0x8ec172));if(_0x8ec172[_0xd2a4('0x1a')]){if(_0x8ec172[_0xd2a4('0x1a')]['code']===0x1f4){logger[_0xd2a4('0x1a')](_0xd2a4('0x15'),_0x3f178e,_0x8ec172[_0xd2a4('0x1a')][_0xd2a4('0x1b')]);return _0x326835(_0x8ec172['error'][_0xd2a4('0x1b')]);}logger['error'](_0xd2a4('0x15'),_0x3f178e,_0x8ec172[_0xd2a4('0x1a')]['message']);return _0xc92589(_0x8ec172[_0xd2a4('0x1a')][_0xd2a4('0x1b')]);}else{logger[_0xd2a4('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x3f178e,_0xd2a4('0x16'));_0xc92589(_0x8ec172[_0xd2a4('0x1c')]['message']);}})[_0xd2a4('0x1d')](function(_0x1c285b){logger['error'](_0xd2a4('0x15'),_0x3f178e,_0x1c285b);_0x326835(_0x1c285b);});});}exports[_0xd2a4('0x1e')]=function(_0x32a587){var _0x38611f=this;return new Promise(function(_0x888286,_0x15ca88){return db[_0xd2a4('0x1f')][_0xd2a4('0x20')]({'raw':_0x32a587[_0xd2a4('0x21')]?_0x32a587[_0xd2a4('0x21')][_0xd2a4('0x22')]===undefined?!![]:![]:!![],'where':_0x32a587[_0xd2a4('0x21')]?_0x32a587[_0xd2a4('0x21')][_0xd2a4('0x23')]||null:null,'attributes':_0x32a587[_0xd2a4('0x21')]?_0x32a587['options'][_0xd2a4('0x24')]||null:null,'limit':_0x32a587[_0xd2a4('0x21')]?_0x32a587['options'][_0xd2a4('0x25')]||null:null,'include':_0x32a587[_0xd2a4('0x21')]?_0x32a587[_0xd2a4('0x21')][_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x32a587[_0xd2a4('0x21')][_0xd2a4('0x26')],function(_0x16e01b){return{'model':db[_0x16e01b[_0xd2a4('0x28')]],'as':_0x16e01b['as'],'attributes':_0x16e01b[_0xd2a4('0x24')],'include':_0x16e01b[_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x16e01b[_0xd2a4('0x26')],function(_0x4de195){return{'model':db[_0x4de195[_0xd2a4('0x28')]],'as':_0x4de195['as'],'attributes':_0x4de195[_0xd2a4('0x24')],'include':_0x4de195[_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x4de195['include'],function(_0x2d7fbf){return{'model':db[_0x2d7fbf[_0xd2a4('0x28')]],'as':_0x2d7fbf['as'],'attributes':_0x2d7fbf[_0xd2a4('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f44f5){logger[_0xd2a4('0x14')](_0xd2a4('0x1e'),_0x32a587);logger[_0xd2a4('0x17')]('GetWhatsappQueue',_0x32a587,JSON[_0xd2a4('0x19')](_0x3f44f5));_0x888286(_0x3f44f5);})[_0xd2a4('0x1d')](function(_0xbc22fc){logger['error'](_0xd2a4('0x1e'),_0xbc22fc[_0xd2a4('0x1b')],_0x32a587);_0x15ca88(_0x38611f[_0xd2a4('0x1a')](0x1f4,_0xbc22fc[_0xd2a4('0x1b')]));});});};exports[_0xd2a4('0x29')]=function(_0x4b38c0){var _0x4d2073=this;return new Promise(function(_0x1a78fd,_0x43a35a){return db[_0xd2a4('0x1f')][_0xd2a4('0x2a')]({'raw':_0x4b38c0[_0xd2a4('0x21')]?_0x4b38c0[_0xd2a4('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x4b38c0[_0xd2a4('0x21')]?_0x4b38c0[_0xd2a4('0x21')][_0xd2a4('0x23')]||null:null,'attributes':_0x4b38c0[_0xd2a4('0x21')]?_0x4b38c0[_0xd2a4('0x21')][_0xd2a4('0x24')]||null:null,'include':_0x4b38c0['options']?_0x4b38c0[_0xd2a4('0x21')][_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x4b38c0['options'][_0xd2a4('0x26')],function(_0x1a075a){return{'model':db[_0x1a075a[_0xd2a4('0x28')]],'as':_0x1a075a['as'],'attributes':_0x1a075a[_0xd2a4('0x24')],'include':_0x1a075a[_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x1a075a[_0xd2a4('0x26')],function(_0x3f7e5d){return{'model':db[_0x3f7e5d[_0xd2a4('0x28')]],'as':_0x3f7e5d['as'],'attributes':_0x3f7e5d[_0xd2a4('0x24')],'include':_0x3f7e5d[_0xd2a4('0x26')]?_[_0xd2a4('0x27')](_0x3f7e5d[_0xd2a4('0x26')],function(_0xe06191){return{'model':db[_0xe06191[_0xd2a4('0x28')]],'as':_0xe06191['as'],'attributes':_0xe06191[_0xd2a4('0x24')]};}):[]};}):[]};}):[]:[]})[_0xd2a4('0x13')](function(_0x1f3989){logger[_0xd2a4('0x14')](_0xd2a4('0x29'),_0x4b38c0);logger[_0xd2a4('0x17')]('ShowWhatsappQueue',_0x4b38c0,JSON['stringify'](_0x1f3989));_0x1a78fd(_0x1f3989);})[_0xd2a4('0x1d')](function(_0x18d38b){logger[_0xd2a4('0x1a')](_0xd2a4('0x29'),_0x18d38b['message'],_0x4b38c0);_0x43a35a(_0x4d2073[_0xd2a4('0x1a')](0x1f4,_0x18d38b[_0xd2a4('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 9ccf88e..4e8d245 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 _0xa345=['save','remove','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xa345,0x147));var _0x5a34=function(_0x49c906,_0x1a1d8d){_0x49c906=_0x49c906-0x0;var _0x73e70c=_0xa345[_0x49c906];return _0x73e70c;};'use strict';var WhatsappQueueEvents=require(_0x5a34('0x0'));var events=[_0x5a34('0x1'),_0x5a34('0x2'),'update'];function createListener(_0x3fd5fb,_0xa8f379){return function(_0xafe20a){_0xa8f379[_0x5a34('0x3')](_0x3fd5fb,_0xafe20a);};}function removeListener(_0x348d36,_0x3db5c0){return function(){WhatsappQueueEvents[_0x5a34('0x4')](_0x348d36,_0x3db5c0);};}exports[_0x5a34('0x5')]=function(_0x352745){for(var _0x38eea1=0x0,_0x2ed24e=events[_0x5a34('0x6')];_0x38eea1<_0x2ed24e;_0x38eea1++){var _0x263a76=events[_0x38eea1];var _0x4d0d6b=createListener(_0x5a34('0x7')+_0x263a76,_0x352745);WhatsappQueueEvents['on'](_0x263a76,_0x4d0d6b);}}; \ No newline at end of file +var _0x5374=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x16105f,_0x5b2cef){var _0x249e9e=function(_0x5ea34f){while(--_0x5ea34f){_0x16105f['push'](_0x16105f['shift']());}};_0x249e9e(++_0x5b2cef);}(_0x5374,0x192));var _0x4537=function(_0x5c6022,_0x2108e6){_0x5c6022=_0x5c6022-0x0;var _0x4a729c=_0x5374[_0x5c6022];return _0x4a729c;};'use strict';var WhatsappQueueEvents=require(_0x4537('0x0'));var events=[_0x4537('0x1'),_0x4537('0x2'),_0x4537('0x3')];function createListener(_0x4bf836,_0x2d3145){return function(_0x270a2f){_0x2d3145['emit'](_0x4bf836,_0x270a2f);};}function removeListener(_0x5d8e46,_0x3551e4){return function(){WhatsappQueueEvents[_0x4537('0x4')](_0x5d8e46,_0x3551e4);};}exports[_0x4537('0x5')]=function(_0x4be027){for(var _0x52cf43=0x0,_0x1f9488=events[_0x4537('0x6')];_0x52cf43<_0x1f9488;_0x52cf43++){var _0x214dca=events[_0x52cf43];var _0x1ab37a=createListener(_0x4537('0x7')+_0x214dca,_0x4be027);WhatsappQueueEvents['on'](_0x214dca,_0x1ab37a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 18aed52..8ac19e0 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 _0x2171=['show','post','create','/:id','update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2171,0x15c));var _0x1217=function(_0x21be1a,_0x598997){_0x21be1a=_0x21be1a-0x0;var _0x2f2ab5=_0x2171[_0x21be1a];return _0x2f2ab5;};'use strict';var multer=require(_0x1217('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1217('0x1'));var express=require(_0x1217('0x2'));var router=express[_0x1217('0x3')]();var fs_extra=require(_0x1217('0x4'));var auth=require(_0x1217('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1217('0x6'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x1217('0x7')](),controller[_0x1217('0x8')]);router[_0x1217('0x9')](_0x1217('0xa'),auth['isAuthenticated'](),controller[_0x1217('0xb')]);router[_0x1217('0x9')]('/:id',auth[_0x1217('0x7')](),controller[_0x1217('0xc')]);router[_0x1217('0xd')]('/',auth[_0x1217('0x7')](),controller[_0x1217('0xe')]);router['put'](_0x1217('0xf'),auth[_0x1217('0x7')](),controller[_0x1217('0x10')]);router[_0x1217('0x11')](_0x1217('0xf'),auth[_0x1217('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x089f=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x51073a,_0x2c6891){var _0x16949a=function(_0x57de8c){while(--_0x57de8c){_0x51073a['push'](_0x51073a['shift']());}};_0x16949a(++_0x2c6891);}(_0x089f,0x86));var _0xf089=function(_0x4617f4,_0xdd90f){_0x4617f4=_0x4617f4-0x0;var _0x3ec7ba=_0x089f[_0x4617f4];return _0x3ec7ba;};'use strict';var multer=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var path=require(_0xf089('0x2'));var timeout=require(_0xf089('0x3'));var express=require('express');var router=express[_0xf089('0x4')]();var fs_extra=require(_0xf089('0x5'));var auth=require(_0xf089('0x6'));var interaction=require(_0xf089('0x7'));var config=require('../../config/environment');var controller=require(_0xf089('0x8'));router[_0xf089('0x9')]('/',auth[_0xf089('0xa')](),controller[_0xf089('0xb')]);router['get']('/describe',auth[_0xf089('0xa')](),controller[_0xf089('0xc')]);router[_0xf089('0x9')](_0xf089('0xd'),auth[_0xf089('0xa')](),controller[_0xf089('0xe')]);router['post']('/',auth[_0xf089('0xa')](),controller[_0xf089('0xf')]);router[_0xf089('0x10')]('/:id',auth[_0xf089('0xa')](),controller[_0xf089('0x11')]);router[_0xf089('0x12')]('/:id',auth[_0xf089('0xa')](),controller[_0xf089('0x13')]);module[_0xf089('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 35dc463..5486da9 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1db05a,_0x5790c5){var _0x4e2ce7=function(_0x1a8a5d){while(--_0x1a8a5d){_0x1db05a['push'](_0x1db05a['shift']());}};_0x4e2ce7(++_0x5790c5);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x207cd5,_0x42638d){var _0x3451f6=function(_0x3f62bf){while(--_0x3f62bf){_0x207cd5['push'](_0x207cd5['shift']());}};_0x3451f6(++_0x42638d);}(_0x7a54,0x106));var _0x47a5=function(_0x278a37,_0x3cbff8){_0x278a37=_0x278a37-0x0;var _0x14fde4=_0x7a54[_0x278a37];return _0x14fde4;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 28460cb..49f796f 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 _0x2e54=['catch','show','params','find','create','body','update','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x4e3ff5,_0x29a755){var _0x702f2f=function(_0x4c5b4a){while(--_0x4c5b4a){_0x4e3ff5['push'](_0x4e3ff5['shift']());}};_0x702f2f(++_0x29a755);}(_0x2e54,0x1dd));var _0x42e5=function(_0xf547bb,_0x3386dc){_0xf547bb=_0xf547bb-0x0;var _0x22ffbc=_0x2e54[_0xf547bb];return _0x22ffbc;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){_0x37d10e[_0x42e5('0x19')](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x275c80,_0x4638bc){return function(_0x4f52b2){if(!_0x4f52b2){_0x275c80['sendStatus'](0x194);}return _0x4f52b2;};}function handleError(_0x3115e4,_0x534a26){_0x534a26=_0x534a26||0x1f4;return function(_0x56f812){logger[_0x42e5('0x25')](_0x56f812['stack']);if(_0x56f812[_0x42e5('0x26')]){delete _0x56f812[_0x42e5('0x26')];}_0x3115e4[_0x42e5('0x19')](_0x534a26)[_0x42e5('0x27')](_0x56f812);};}exports[_0x42e5('0x28')]=function(_0x2f1edc,_0x59a46b){var _0x3e2ea5={},_0x201d9e={},_0x39f763={'count':0x0,'rows':[]};var _0x2c53d4=_[_0x42e5('0x29')](db[_0x42e5('0x2a')][_0x42e5('0x2b')],function(_0x282cbf){return{'name':_0x282cbf[_0x42e5('0x2c')],'type':_0x282cbf[_0x42e5('0x2d')][_0x42e5('0x2e')]};});_0x201d9e[_0x42e5('0x2f')]=_[_0x42e5('0x29')](_0x2c53d4,'name');_0x201d9e[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2f1edc[_0x42e5('0x30')]);_0x201d9e[_0x42e5('0x32')]=_['intersection'](_0x201d9e['model'],_0x201d9e[_0x42e5('0x30')]);_0x3e2ea5['attributes']=_[_0x42e5('0x33')](_0x201d9e['model'],qs[_0x42e5('0x34')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x34')]));_0x3e2ea5['attributes']=_0x3e2ea5[_0x42e5('0x35')][_0x42e5('0x36')]?_0x3e2ea5['attributes']:_0x201d9e[_0x42e5('0x2f')];if(!_0x2f1edc['query'][_0x42e5('0x37')](_0x42e5('0x38'))){_0x3e2ea5[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x1e')]);_0x3e2ea5[_0x42e5('0x1c')]=qs['offset'](_0x2f1edc['query'][_0x42e5('0x1c')]);}_0x3e2ea5[_0x42e5('0x39')]=qs[_0x42e5('0x3a')](_0x2f1edc['query']['sort']);_0x3e2ea5['where']=qs['filters'](_[_0x42e5('0x3b')](_0x2f1edc[_0x42e5('0x30')],_0x201d9e[_0x42e5('0x32')]),_0x2c53d4);if(_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]){_0x3e2ea5[_0x42e5('0x3d')]=_[_0x42e5('0x3e')](_0x3e2ea5[_0x42e5('0x3d')],{'$or':_['map'](_0x2c53d4,function(_0x260413){if(_0x260413['type']!==_0x42e5('0x3f')){var _0x343363={};_0x343363[_0x260413[_0x42e5('0x26')]]={'$like':'%'+_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]+'%'};return _0x343363;}})});}_0x3e2ea5=_[_0x42e5('0x3e')]({},_0x3e2ea5,_0x2f1edc[_0x42e5('0x40')]);var _0x5ab9b8={'where':_0x3e2ea5[_0x42e5('0x3d')]};return db[_0x42e5('0x2a')]['count'](_0x5ab9b8)[_0x42e5('0x24')](function(_0x5e8f96){_0x39f763['count']=_0x5e8f96;if(_0x2f1edc['query'][_0x42e5('0x41')]){_0x3e2ea5[_0x42e5('0x42')]=[{'all':!![]}];}return db[_0x42e5('0x2a')][_0x42e5('0x43')](_0x3e2ea5);})[_0x42e5('0x24')](function(_0x77aa22){_0x39f763[_0x42e5('0x44')]=_0x77aa22;return _0x39f763;})['then'](respondWithFilteredResult(_0x59a46b,_0x3e2ea5))[_0x42e5('0x45')](handleError(_0x59a46b,null));};exports[_0x42e5('0x46')]=function(_0x5bec97,_0x398b73){var _0x1c697a={'raw':!![],'where':{'id':_0x5bec97[_0x42e5('0x47')]['id']}},_0x5db771={};_0x5db771[_0x42e5('0x2f')]=_[_0x42e5('0x31')](db[_0x42e5('0x2a')][_0x42e5('0x2b')]);_0x5db771['query']=_[_0x42e5('0x31')](_0x5bec97[_0x42e5('0x30')]);_0x5db771[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x5db771['model'],_0x5db771[_0x42e5('0x30')]);_0x1c697a[_0x42e5('0x35')]=_[_0x42e5('0x33')](_0x5db771[_0x42e5('0x2f')],qs[_0x42e5('0x34')](_0x5bec97[_0x42e5('0x30')][_0x42e5('0x34')]));_0x1c697a[_0x42e5('0x35')]=_0x1c697a['attributes'][_0x42e5('0x36')]?_0x1c697a['attributes']:_0x5db771['model'];if(_0x5bec97[_0x42e5('0x30')][_0x42e5('0x41')]){_0x1c697a[_0x42e5('0x42')]=[{'all':!![]}];}_0x1c697a=_[_0x42e5('0x3e')]({},_0x1c697a,_0x5bec97[_0x42e5('0x40')]);return db[_0x42e5('0x2a')][_0x42e5('0x48')](_0x1c697a)['then'](handleEntityNotFound(_0x398b73,null))[_0x42e5('0x24')](respondWithResult(_0x398b73,null))[_0x42e5('0x45')](handleError(_0x398b73,null));};exports[_0x42e5('0x49')]=function(_0x21a047,_0x1086b2){return db[_0x42e5('0x2a')][_0x42e5('0x49')](_0x21a047[_0x42e5('0x4a')],{})['then'](respondWithResult(_0x1086b2,0xc9))[_0x42e5('0x45')](handleError(_0x1086b2,null));};exports[_0x42e5('0x4b')]=function(_0x3616f4,_0x48757e){if(_0x3616f4[_0x42e5('0x4a')]['id']){delete _0x3616f4[_0x42e5('0x4a')]['id'];}return db[_0x42e5('0x2a')][_0x42e5('0x48')]({'where':{'id':_0x3616f4[_0x42e5('0x47')]['id']}})['then'](handleEntityNotFound(_0x48757e,null))[_0x42e5('0x24')](saveUpdates(_0x3616f4['body'],null))[_0x42e5('0x24')](respondWithResult(_0x48757e,null))[_0x42e5('0x45')](handleError(_0x48757e,null));};exports[_0x42e5('0x4c')]=function(_0x48b63b,_0x50f59c){return db['WhatsappQueueReport'][_0x42e5('0x48')]({'where':{'id':_0x48b63b[_0x42e5('0x47')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x50f59c,null))[_0x42e5('0x24')](removeEntity(_0x50f59c,null))['catch'](handleError(_0x50f59c,null));};exports[_0x42e5('0x4d')]=function(_0x26782e,_0x18cedc){return db['WhatsappQueueReport'][_0x42e5('0x4d')]()['then'](respondWithResult(_0x18cedc,null))[_0x42e5('0x45')](handleError(_0x18cedc,null));}; \ No newline at end of file +var _0xeb74=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring'];(function(_0x76ab71,_0x3a8692){var _0x2cc491=function(_0x366563){while(--_0x366563){_0x76ab71['push'](_0x76ab71['shift']());}};_0x2cc491(++_0x3a8692);}(_0xeb74,0xe3));var _0x4eb7=function(_0xeb294,_0x109de3){_0xeb294=_0xeb294-0x0;var _0x1dcf1d=_0xeb74[_0xeb294];return _0x1dcf1d;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x27')]();});}};}function handleEntityNotFound(_0x3e0da2,_0x25eb74){return function(_0x365060){if(!_0x365060){_0x3e0da2[_0x4eb7('0x28')](0x194);}return _0x365060;};}function handleError(_0x80b804,_0x248759){_0x248759=_0x248759||0x1f4;return function(_0xf83c11){logger[_0x4eb7('0x29')](_0xf83c11[_0x4eb7('0x2a')]);if(_0xf83c11[_0x4eb7('0x2b')]){delete _0xf83c11[_0x4eb7('0x2b')];}_0x80b804[_0x4eb7('0x19')](_0x248759)[_0x4eb7('0x2c')](_0xf83c11);};}exports[_0x4eb7('0x2d')]=function(_0x33a2c1,_0x28fda8){var _0x114c68={},_0x17030a={},_0x3ed224={'count':0x0,'rows':[]};var _0x50209d=_[_0x4eb7('0x2e')](db['WhatsappQueueReport'][_0x4eb7('0x2f')],function(_0x13f71a){return{'name':_0x13f71a[_0x4eb7('0x30')],'type':_0x13f71a[_0x4eb7('0x31')][_0x4eb7('0x32')]};});_0x17030a[_0x4eb7('0x33')]=_[_0x4eb7('0x2e')](_0x50209d,_0x4eb7('0x2b'));_0x17030a[_0x4eb7('0x34')]=_['keys'](_0x33a2c1[_0x4eb7('0x34')]);_0x17030a['filters']=_[_0x4eb7('0x35')](_0x17030a[_0x4eb7('0x33')],_0x17030a['query']);_0x114c68['attributes']=_[_0x4eb7('0x35')](_0x17030a[_0x4eb7('0x33')],qs[_0x4eb7('0x36')](_0x33a2c1[_0x4eb7('0x34')]['fields']));_0x114c68[_0x4eb7('0x37')]=_0x114c68[_0x4eb7('0x37')][_0x4eb7('0x38')]?_0x114c68[_0x4eb7('0x37')]:_0x17030a[_0x4eb7('0x33')];if(!_0x33a2c1['query'][_0x4eb7('0x39')](_0x4eb7('0x3a'))){_0x114c68[_0x4eb7('0x1d')]=qs['limit'](_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x1d')]);_0x114c68[_0x4eb7('0x1b')]=qs['offset'](_0x33a2c1[_0x4eb7('0x34')]['offset']);}_0x114c68[_0x4eb7('0x3b')]=qs[_0x4eb7('0x3c')](_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x3c')]);_0x114c68['where']=qs[_0x4eb7('0x3d')](_[_0x4eb7('0x3e')](_0x33a2c1[_0x4eb7('0x34')],_0x17030a[_0x4eb7('0x3d')]),_0x50209d);if(_0x33a2c1['query']['filter']){_0x114c68['where']=_[_0x4eb7('0x3f')](_0x114c68[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x2e')](_0x50209d,function(_0x20ac7b){if(_0x20ac7b[_0x4eb7('0x31')]!==_0x4eb7('0x41')){var _0x1038c1={};_0x1038c1[_0x20ac7b[_0x4eb7('0x2b')]]={'$like':'%'+_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x42')]+'%'};return _0x1038c1;}})});}_0x114c68=_['merge']({},_0x114c68,_0x33a2c1[_0x4eb7('0x43')]);var _0x38218f={'where':_0x114c68[_0x4eb7('0x40')]};return db[_0x4eb7('0x44')][_0x4eb7('0x1e')](_0x38218f)[_0x4eb7('0x25')](function(_0x704d4d){_0x3ed224[_0x4eb7('0x1e')]=_0x704d4d;if(_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x45')]){_0x114c68[_0x4eb7('0x46')]=[{'all':!![]}];}return db[_0x4eb7('0x44')][_0x4eb7('0x47')](_0x114c68);})[_0x4eb7('0x25')](function(_0x38af1f){_0x3ed224[_0x4eb7('0x48')]=_0x38af1f;return _0x3ed224;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x28fda8,_0x114c68))[_0x4eb7('0x49')](handleError(_0x28fda8,null));};exports[_0x4eb7('0x4a')]=function(_0x79aec5,_0x5eff9e){var _0x2fd5c2={'raw':!![],'where':{'id':_0x79aec5[_0x4eb7('0x4b')]['id']}},_0x2df542={};_0x2df542[_0x4eb7('0x33')]=_[_0x4eb7('0x4c')](db[_0x4eb7('0x44')][_0x4eb7('0x2f')]);_0x2df542[_0x4eb7('0x34')]=_[_0x4eb7('0x4c')](_0x79aec5['query']);_0x2df542[_0x4eb7('0x3d')]=_['intersection'](_0x2df542[_0x4eb7('0x33')],_0x2df542[_0x4eb7('0x34')]);_0x2fd5c2[_0x4eb7('0x37')]=_['intersection'](_0x2df542[_0x4eb7('0x33')],qs[_0x4eb7('0x36')](_0x79aec5[_0x4eb7('0x34')][_0x4eb7('0x36')]));_0x2fd5c2['attributes']=_0x2fd5c2[_0x4eb7('0x37')]['length']?_0x2fd5c2[_0x4eb7('0x37')]:_0x2df542[_0x4eb7('0x33')];if(_0x79aec5[_0x4eb7('0x34')][_0x4eb7('0x45')]){_0x2fd5c2[_0x4eb7('0x46')]=[{'all':!![]}];}_0x2fd5c2=_['merge']({},_0x2fd5c2,_0x79aec5['options']);return db[_0x4eb7('0x44')][_0x4eb7('0x4d')](_0x2fd5c2)[_0x4eb7('0x25')](handleEntityNotFound(_0x5eff9e,null))[_0x4eb7('0x25')](respondWithResult(_0x5eff9e,null))[_0x4eb7('0x49')](handleError(_0x5eff9e,null));};exports['create']=function(_0x6086,_0x104284){return db['WhatsappQueueReport'][_0x4eb7('0x4e')](_0x6086[_0x4eb7('0x4f')],{})['then'](respondWithResult(_0x104284,0xc9))[_0x4eb7('0x49')](handleError(_0x104284,null));};exports[_0x4eb7('0x24')]=function(_0x3c8049,_0x5774d5){if(_0x3c8049[_0x4eb7('0x4f')]['id']){delete _0x3c8049['body']['id'];}return db['WhatsappQueueReport'][_0x4eb7('0x4d')]({'where':{'id':_0x3c8049[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x5774d5,null))[_0x4eb7('0x25')](saveUpdates(_0x3c8049[_0x4eb7('0x4f')],null))[_0x4eb7('0x25')](respondWithResult(_0x5774d5,null))[_0x4eb7('0x49')](handleError(_0x5774d5,null));};exports[_0x4eb7('0x26')]=function(_0x2913c5,_0x23c0d5){return db[_0x4eb7('0x44')][_0x4eb7('0x4d')]({'where':{'id':_0x2913c5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x23c0d5,null))[_0x4eb7('0x25')](removeEntity(_0x23c0d5,null))[_0x4eb7('0x49')](handleError(_0x23c0d5,null));};exports[_0x4eb7('0x50')]=function(_0x1580ba,_0x1411c9){return db[_0x4eb7('0x44')]['describe']()[_0x4eb7('0x25')](respondWithResult(_0x1411c9,null))['catch'](handleError(_0x1411c9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 7af317f..7cdb438 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 _0xb864=['api','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','report_whatsapp_queue','uniqueid','util','../../config/logger'];(function(_0x36afd7,_0x1181dc){var _0x2e0da0=function(_0x2254e1){while(--_0x2254e1){_0x36afd7['push'](_0x36afd7['shift']());}};_0x2e0da0(++_0x1181dc);}(_0xb864,0x77));var _0x4b86=function(_0x19c1dc,_0x3ce3b0){_0x19c1dc=_0x19c1dc-0x0;var _0x9dac69=_0xb864[_0x19c1dc];return _0x9dac69;};'use strict';var _=require('lodash');var util=require(_0x4b86('0x0'));var logger=require(_0x4b86('0x1'))(_0x4b86('0x2'));var moment=require('moment');var BPromise=require(_0x4b86('0x3'));var rp=require(_0x4b86('0x4'));var fs=require('fs');var path=require(_0x4b86('0x5'));var rimraf=require('rimraf');var config=require(_0x4b86('0x6'));var attributes=require(_0x4b86('0x7'));module[_0x4b86('0x8')]=function(_0x55cfa5,_0x20a7ee){return _0x55cfa5['define']('WhatsappQueueReport',attributes,{'tableName':_0x4b86('0x9'),'paranoid':![],'indexes':[{'name':_0x4b86('0xa'),'fields':[_0x4b86('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf0a=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1f52e4,_0x59d42e){var _0x321101=function(_0x31269b){while(--_0x31269b){_0x1f52e4['push'](_0x1f52e4['shift']());}};_0x321101(++_0x59d42e);}(_0xaf0a,0x1b3));var _0xaaf0=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xaf0a[_0x58e469];return _0x4c01c5;};'use strict';var _=require('lodash');var util=require(_0xaaf0('0x0'));var logger=require(_0xaaf0('0x1'))(_0xaaf0('0x2'));var moment=require('moment');var BPromise=require(_0xaaf0('0x3'));var rp=require(_0xaaf0('0x4'));var fs=require('fs');var path=require(_0xaaf0('0x5'));var rimraf=require(_0xaaf0('0x6'));var config=require(_0xaaf0('0x7'));var attributes=require(_0xaaf0('0x8'));module[_0xaaf0('0x9')]=function(_0x54fa87,_0x3390a9){return _0x54fa87[_0xaaf0('0xa')](_0xaaf0('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaaf0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index bce9e0f..f2ac6c4 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 _0xf182=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','WhatsappQueueReport,\x20%s,\x20%s','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','UpdateWhatsappQueueReport','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','rpc'];(function(_0x3a0c61,_0xff74b5){var _0x147740=function(_0x302c10){while(--_0x302c10){_0x3a0c61['push'](_0x3a0c61['shift']());}};_0x147740(++_0xff74b5);}(_0xf182,0x1da));var _0x2f18=function(_0x4636e0,_0x1a7a1d){_0x4636e0=_0x4636e0-0x0;var _0x562873=_0xf182[_0x4636e0];return _0x562873;};'use strict';var _=require(_0x2f18('0x0'));var util=require(_0x2f18('0x1'));var moment=require(_0x2f18('0x2'));var BPromise=require(_0x2f18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f18('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2f18('0x5'));var config=require(_0x2f18('0x6'));var jayson=require(_0x2f18('0x7'));var client=jayson[_0x2f18('0x8')][_0x2f18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12cffc,_0x255ccb,_0x2f7470){return new BPromise(function(_0x4ed769,_0x388c84){return client['request'](_0x12cffc,_0x2f7470)[_0x2f18('0xa')](function(_0x5701e0){logger[_0x2f18('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x255ccb,_0x2f18('0xc'));logger[_0x2f18('0xd')](_0x2f18('0xe'),_0x255ccb,_0x2f18('0xc'),JSON[_0x2f18('0xf')](_0x5701e0));if(_0x5701e0['error']){if(_0x5701e0['error'][_0x2f18('0x10')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x255ccb,_0x5701e0['error'][_0x2f18('0x11')]);return _0x388c84(_0x5701e0['error'][_0x2f18('0x11')]);}logger[_0x2f18('0x12')](_0x2f18('0x13'),_0x255ccb,_0x5701e0[_0x2f18('0x12')]['message']);return _0x4ed769(_0x5701e0[_0x2f18('0x12')][_0x2f18('0x11')]);}else{logger[_0x2f18('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x255ccb,'request\x20sent');_0x4ed769(_0x5701e0['result'][_0x2f18('0x11')]);}})[_0x2f18('0x14')](function(_0x1b482c){logger[_0x2f18('0x12')](_0x2f18('0x13'),_0x255ccb,_0x1b482c);_0x388c84(_0x1b482c);});});}exports[_0x2f18('0x15')]=function(_0x371df6){var _0x492227=this;return new Promise(function(_0x4bc806,_0xf07146){return db[_0x2f18('0x16')][_0x2f18('0x17')](_0x371df6['body'],{'raw':_0x371df6[_0x2f18('0x18')]?_0x371df6[_0x2f18('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x2f18('0xa')](function(_0x1a044d){logger['info'](_0x2f18('0x15'),_0x371df6);logger[_0x2f18('0xd')](_0x2f18('0x15'),_0x371df6,JSON[_0x2f18('0xf')](_0x1a044d));_0x4bc806(_0x1a044d);})['catch'](function(_0x3b33ea){logger[_0x2f18('0x12')](_0x2f18('0x15'),_0x3b33ea[_0x2f18('0x11')],_0x371df6);_0xf07146(_0x492227[_0x2f18('0x12')](0x1f4,_0x3b33ea[_0x2f18('0x11')]));});});};exports[_0x2f18('0x19')]=function(_0x3d841c){var _0x3bf7a5=this;return new Promise(function(_0x367b21,_0x3455ee){return db[_0x2f18('0x16')][_0x2f18('0x1a')](_0x3d841c[_0x2f18('0x1b')],{'raw':_0x3d841c['options']?_0x3d841c['options'][_0x2f18('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d841c[_0x2f18('0x18')]?_0x3d841c[_0x2f18('0x18')][_0x2f18('0x1d')]||null:null,'attributes':_0x3d841c[_0x2f18('0x18')]?_0x3d841c[_0x2f18('0x18')][_0x2f18('0x1e')]||null:null,'limit':_0x3d841c[_0x2f18('0x18')]?_0x3d841c[_0x2f18('0x18')][_0x2f18('0x1f')]||null:null})[_0x2f18('0xa')](function(_0xf570ca){logger[_0x2f18('0xb')]('UpdateWhatsappQueueReport',_0x3d841c);logger[_0x2f18('0xd')](_0x2f18('0x19'),_0x3d841c,JSON[_0x2f18('0xf')](_0xf570ca));_0x367b21(_0xf570ca);})[_0x2f18('0x14')](function(_0x5d5bed){logger[_0x2f18('0x12')]('UpdateWhatsappQueueReport',_0x5d5bed[_0x2f18('0x11')],_0x3d841c);_0x3455ee(_0x3bf7a5[_0x2f18('0x12')](0x1f4,_0x5d5bed[_0x2f18('0x11')]));});});}; \ No newline at end of file +var _0x50a0=['http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport','update','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x239ddb,_0x5e79b8){var _0x4559f5=function(_0x1001b9){while(--_0x1001b9){_0x239ddb['push'](_0x239ddb['shift']());}};_0x4559f5(++_0x5e79b8);}(_0x50a0,0x80));var _0x050a=function(_0x228b50,_0x5e99e0){_0x228b50=_0x228b50-0x0;var _0xfb2870=_0x50a0[_0x228b50];return _0xfb2870;};'use strict';var _=require(_0x050a('0x0'));var util=require(_0x050a('0x1'));var moment=require(_0x050a('0x2'));var BPromise=require('bluebird');var rs=require(_0x050a('0x3'));var fs=require('fs');var Redis=require(_0x050a('0x4'));var db=require(_0x050a('0x5'))['db'];var utils=require(_0x050a('0x6'));var logger=require(_0x050a('0x7'))(_0x050a('0x8'));var config=require(_0x050a('0x9'));var jayson=require(_0x050a('0xa'));var client=jayson[_0x050a('0xb')][_0x050a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bc19f,_0x31a75d,_0xb192e2){return new BPromise(function(_0x4fdb67,_0x29f38e){return client[_0x050a('0xd')](_0x3bc19f,_0xb192e2)[_0x050a('0xe')](function(_0x1b3df2){logger[_0x050a('0xf')](_0x050a('0x10'),_0x31a75d,'request\x20sent');logger[_0x050a('0x11')](_0x050a('0x12'),_0x31a75d,'request\x20sent',JSON[_0x050a('0x13')](_0x1b3df2));if(_0x1b3df2[_0x050a('0x14')]){if(_0x1b3df2['error']['code']===0x1f4){logger[_0x050a('0x14')](_0x050a('0x10'),_0x31a75d,_0x1b3df2[_0x050a('0x14')][_0x050a('0x15')]);return _0x29f38e(_0x1b3df2['error'][_0x050a('0x15')]);}logger[_0x050a('0x14')](_0x050a('0x10'),_0x31a75d,_0x1b3df2[_0x050a('0x14')]['message']);return _0x4fdb67(_0x1b3df2['error'][_0x050a('0x15')]);}else{logger['info'](_0x050a('0x10'),_0x31a75d,_0x050a('0x16'));_0x4fdb67(_0x1b3df2[_0x050a('0x17')][_0x050a('0x15')]);}})[_0x050a('0x18')](function(_0xaa1385){logger[_0x050a('0x14')](_0x050a('0x10'),_0x31a75d,_0xaa1385);_0x29f38e(_0xaa1385);});});}exports[_0x050a('0x19')]=function(_0x21fe10){var _0x43624c=this;return new Promise(function(_0x10a2ce,_0x23129f){return db[_0x050a('0x1a')][_0x050a('0x1b')](_0x21fe10[_0x050a('0x1c')],{'raw':_0x21fe10[_0x050a('0x1d')]?_0x21fe10[_0x050a('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x050a('0xe')](function(_0xbf8163){logger[_0x050a('0xf')]('CreateWhatsappQueueReport',_0x21fe10);logger[_0x050a('0x11')](_0x050a('0x19'),_0x21fe10,JSON[_0x050a('0x13')](_0xbf8163));_0x10a2ce(_0xbf8163);})[_0x050a('0x18')](function(_0x15a6e8){logger[_0x050a('0x14')](_0x050a('0x19'),_0x15a6e8['message'],_0x21fe10);_0x23129f(_0x43624c[_0x050a('0x14')](0x1f4,_0x15a6e8[_0x050a('0x15')]));});});};exports[_0x050a('0x1e')]=function(_0x497b86){var _0x12c525=this;return new Promise(function(_0x1833c6,_0xf379c){return db['WhatsappQueueReport'][_0x050a('0x1f')](_0x497b86[_0x050a('0x1c')],{'raw':_0x497b86[_0x050a('0x1d')]?_0x497b86[_0x050a('0x1d')][_0x050a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x497b86['options']?_0x497b86['options'][_0x050a('0x21')]||null:null,'attributes':_0x497b86[_0x050a('0x1d')]?_0x497b86[_0x050a('0x1d')][_0x050a('0x22')]||null:null,'limit':_0x497b86[_0x050a('0x1d')]?_0x497b86['options']['limit']||null:null})[_0x050a('0xe')](function(_0x4960b0){logger[_0x050a('0xf')](_0x050a('0x1e'),_0x497b86);logger['debug']('UpdateWhatsappQueueReport',_0x497b86,JSON[_0x050a('0x13')](_0x4960b0));_0x1833c6(_0x4960b0);})[_0x050a('0x18')](function(_0x52de67){logger[_0x050a('0x14')](_0x050a('0x1e'),_0x52de67[_0x050a('0x15')],_0x497b86);_0xf379c(_0x12c525[_0x050a('0x14')](0x1f4,_0x52de67['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 8650b40..9228c34 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 _0xb149=['Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x4287e9,_0x31f01c){var _0x2f8390=function(_0xb41856){while(--_0xb41856){_0x4287e9['push'](_0x4287e9['shift']());}};_0x2f8390(++_0x31f01c);}(_0xb149,0xe3));var _0x9b14=function(_0x152a8d,_0x5c9019){_0x152a8d=_0x152a8d-0x0;var _0x144e3d=_0xb149[_0x152a8d];return _0x144e3d;};'use strict';var multer=require(_0x9b14('0x0'));var util=require(_0x9b14('0x1'));var path=require('path');var timeout=require(_0x9b14('0x2'));var express=require(_0x9b14('0x3'));var router=express[_0x9b14('0x4')]();var fs_extra=require(_0x9b14('0x5'));var auth=require(_0x9b14('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9b14('0x7'));var controller=require(_0x9b14('0x8'));router[_0x9b14('0x9')]('/',auth[_0x9b14('0xa')](),controller['index']);router[_0x9b14('0x9')](_0x9b14('0xb'),auth[_0x9b14('0xa')](),controller[_0x9b14('0xc')]);router['get'](_0x9b14('0xd'),auth[_0x9b14('0xa')](),controller[_0x9b14('0xe')]);router[_0x9b14('0xf')]('/',auth[_0x9b14('0xa')](),controller[_0x9b14('0x10')]);router[_0x9b14('0x11')]('/:id',auth[_0x9b14('0xa')](),controller[_0x9b14('0x12')]);router['delete']('/:id',auth[_0x9b14('0xa')](),controller[_0x9b14('0x13')]);module[_0x9b14('0x14')]=router; \ No newline at end of file +var _0x1f68=['describe','/:id','show','create','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x5541d4,_0x59dd80){var _0x389afa=function(_0x577fcc){while(--_0x577fcc){_0x5541d4['push'](_0x5541d4['shift']());}};_0x389afa(++_0x59dd80);}(_0x1f68,0x195));var _0x81f6=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x1f68[_0x5317b5];return _0x3b7ce2;};'use strict';var multer=require(_0x81f6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x81f6('0x1'));var router=express[_0x81f6('0x2')]();var fs_extra=require(_0x81f6('0x3'));var auth=require(_0x81f6('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x81f6('0x5'));router[_0x81f6('0x6')]('/',auth[_0x81f6('0x7')](),controller['index']);router[_0x81f6('0x6')](_0x81f6('0x8'),auth[_0x81f6('0x7')](),controller[_0x81f6('0x9')]);router[_0x81f6('0x6')](_0x81f6('0xa'),auth[_0x81f6('0x7')](),controller[_0x81f6('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x81f6('0xc')]);router[_0x81f6('0xd')](_0x81f6('0xa'),auth['isAuthenticated'](),controller[_0x81f6('0xe')]);router[_0x81f6('0xf')]('/:id',auth[_0x81f6('0x7')](),controller[_0x81f6('0x10')]);module[_0x81f6('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 92f790a..366f6c6 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 _0x6c00=['STRING','account','agent','queue','DATE','sequelize','exports'];(function(_0x3a3b85,_0xe290ef){var _0x297068=function(_0x53fd9e){while(--_0x53fd9e){_0x3a3b85['push'](_0x3a3b85['shift']());}};_0x297068(++_0xe290ef);}(_0x6c00,0x1a9));var _0x06c0=function(_0x5bce33,_0x4a4b06){_0x5bce33=_0x5bce33-0x0;var _0x15bc20=_0x6c00[_0x5bce33];return _0x15bc20;};'use strict';var Sequelize=require(_0x06c0('0x0'));module[_0x06c0('0x1')]={'uniqueid':{'type':Sequelize[_0x06c0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x06c0('0x3'),_0x06c0('0x4'),_0x06c0('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x06c0('0x6')]}}; \ No newline at end of file +var _0xf3aa=['agent','sequelize','exports','STRING','ENUM'];(function(_0x35212e,_0x3931a5){var _0x5d0792=function(_0x31c762){while(--_0x31c762){_0x35212e['push'](_0x35212e['shift']());}};_0x5d0792(++_0x3931a5);}(_0xf3aa,0xf1));var _0xaf3a=function(_0xc6b104,_0x1d805a){_0xc6b104=_0xc6b104-0x0;var _0x1c6fce=_0xf3aa[_0xc6b104];return _0x1c6fce;};'use strict';var Sequelize=require(_0xaf3a('0x0'));module[_0xaf3a('0x1')]={'uniqueid':{'type':Sequelize[_0xaf3a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaf3a('0x3')]('account',_0xaf3a('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index f3b646c..3b2eaa0 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 _0x3f74=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappTransferReport','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','jsforce','desk.js','to-csv'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0x3f74,0x121));var _0x43f7=function(_0x35142e,_0x4238ad){_0x35142e=_0x35142e-0x0;var _0x1059b3=_0x3f74[_0x35142e];return _0x1059b3;};'use strict';var emlformat=require(_0x43f7('0x0'));var rimraf=require(_0x43f7('0x1'));var zipdir=require(_0x43f7('0x2'));var jsonpatch=require(_0x43f7('0x3'));var rp=require(_0x43f7('0x4'));var moment=require(_0x43f7('0x5'));var BPromise=require(_0x43f7('0x6'));var Mustache=require(_0x43f7('0x7'));var util=require('util');var path=require(_0x43f7('0x8'));var sox=require(_0x43f7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43f7('0xa'));var _=require('lodash');var squel=require(_0x43f7('0xb'));var crypto=require('crypto');var jsforce=require(_0x43f7('0xc'));var deskjs=require(_0x43f7('0xd'));var toCsv=require(_0x43f7('0xe'));var querystring=require(_0x43f7('0xf'));var Papa=require(_0x43f7('0x10'));var Redis=require('ioredis');var authService=require(_0x43f7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x43f7('0x12'));var hardwareService=require(_0x43f7('0x13'));var logger=require('../../config/logger')(_0x43f7('0x14'));var utils=require(_0x43f7('0x15'));var config=require(_0x43f7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x43f7('0x17'))['db'];function respondWithStatusCode(_0x3402c1,_0x227050){_0x227050=_0x227050||0xcc;return function(_0x14abd8){if(_0x14abd8){return _0x3402c1[_0x43f7('0x18')](_0x227050);}return _0x3402c1[_0x43f7('0x19')](_0x227050)[_0x43f7('0x1a')]();};}function respondWithResult(_0x17d588,_0x2680c7){_0x2680c7=_0x2680c7||0xc8;return function(_0x1ba361){if(_0x1ba361){return _0x17d588[_0x43f7('0x19')](_0x2680c7)[_0x43f7('0x1b')](_0x1ba361);}};}function respondWithFilteredResult(_0x38a060,_0x201273){return function(_0x1775b5){if(_0x1775b5){var _0x2316fa=typeof _0x201273[_0x43f7('0x1c')]===_0x43f7('0x1d')&&typeof _0x201273['limit']===_0x43f7('0x1d');var _0x5a558e=_0x1775b5['count'];var _0x3d8571=_0x2316fa?0x0:_0x201273['offset'];var _0x44380f=_0x2316fa?_0x1775b5[_0x43f7('0x1e')]:_0x201273[_0x43f7('0x1c')]+_0x201273[_0x43f7('0x1f')];var _0x294dce;if(_0x44380f>=_0x5a558e){_0x44380f=_0x5a558e;_0x294dce=0xc8;}else{_0x294dce=0xce;}_0x38a060['status'](_0x294dce);return _0x38a060[_0x43f7('0x20')](_0x43f7('0x21'),_0x3d8571+'-'+_0x44380f+'/'+_0x5a558e)['json'](_0x1775b5);}return null;};}function patchUpdates(_0x320317){return function(_0x4c5727){try{jsonpatch[_0x43f7('0x22')](_0x4c5727,_0x320317,!![]);}catch(_0x246e06){return BPromise[_0x43f7('0x23')](_0x246e06);}return _0x4c5727[_0x43f7('0x24')]();};}function saveUpdates(_0x4185c0,_0x4528bc){return function(_0x1d15e9){if(_0x1d15e9){return _0x1d15e9[_0x43f7('0x25')](_0x4185c0)[_0x43f7('0x26')](function(_0x422bbd){return _0x422bbd;});}return null;};}function removeEntity(_0x3bdb19,_0x4e6e98){return function(_0x313965){if(_0x313965){return _0x313965[_0x43f7('0x27')]()[_0x43f7('0x26')](function(){_0x3bdb19[_0x43f7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d7b3a,_0x4cdc92){return function(_0x173cf9){if(!_0x173cf9){_0x2d7b3a[_0x43f7('0x18')](0x194);}return _0x173cf9;};}function handleError(_0x39f2a6,_0x235cbc){_0x235cbc=_0x235cbc||0x1f4;return function(_0x339775){logger[_0x43f7('0x28')](_0x339775[_0x43f7('0x29')]);if(_0x339775[_0x43f7('0x2a')]){delete _0x339775[_0x43f7('0x2a')];}_0x39f2a6[_0x43f7('0x19')](_0x235cbc)[_0x43f7('0x2b')](_0x339775);};}exports[_0x43f7('0x2c')]=function(_0x4819b1,_0xf1e837){var _0x1bdd3c={},_0x16f48c={},_0x4472cc={'count':0x0,'rows':[]};var _0x79fae=_['map'](db[_0x43f7('0x2d')]['rawAttributes'],function(_0x5385e8){return{'name':_0x5385e8[_0x43f7('0x2e')],'type':_0x5385e8[_0x43f7('0x2f')]['key']};});_0x16f48c['model']=_[_0x43f7('0x30')](_0x79fae,_0x43f7('0x2a'));_0x16f48c[_0x43f7('0x31')]=_[_0x43f7('0x32')](_0x4819b1[_0x43f7('0x31')]);_0x16f48c[_0x43f7('0x33')]=_[_0x43f7('0x34')](_0x16f48c['model'],_0x16f48c[_0x43f7('0x31')]);_0x1bdd3c[_0x43f7('0x35')]=_[_0x43f7('0x34')](_0x16f48c[_0x43f7('0x36')],qs[_0x43f7('0x37')](_0x4819b1[_0x43f7('0x31')]['fields']));_0x1bdd3c[_0x43f7('0x35')]=_0x1bdd3c[_0x43f7('0x35')][_0x43f7('0x38')]?_0x1bdd3c[_0x43f7('0x35')]:_0x16f48c[_0x43f7('0x36')];if(!_0x4819b1[_0x43f7('0x31')][_0x43f7('0x39')]('nolimit')){_0x1bdd3c[_0x43f7('0x1f')]=qs[_0x43f7('0x1f')](_0x4819b1['query']['limit']);_0x1bdd3c['offset']=qs[_0x43f7('0x1c')](_0x4819b1['query'][_0x43f7('0x1c')]);}_0x1bdd3c[_0x43f7('0x3a')]=qs[_0x43f7('0x3b')](_0x4819b1[_0x43f7('0x31')]['sort']);_0x1bdd3c[_0x43f7('0x3c')]=qs[_0x43f7('0x33')](_[_0x43f7('0x3d')](_0x4819b1[_0x43f7('0x31')],_0x16f48c[_0x43f7('0x33')]),_0x79fae);if(_0x4819b1[_0x43f7('0x31')][_0x43f7('0x3e')]){_0x1bdd3c[_0x43f7('0x3c')]=_[_0x43f7('0x3f')](_0x1bdd3c[_0x43f7('0x3c')],{'$or':_[_0x43f7('0x30')](_0x79fae,function(_0x23712d){if(_0x23712d[_0x43f7('0x2f')]!==_0x43f7('0x40')){var _0x822a8c={};_0x822a8c[_0x23712d[_0x43f7('0x2a')]]={'$like':'%'+_0x4819b1[_0x43f7('0x31')][_0x43f7('0x3e')]+'%'};return _0x822a8c;}})});}_0x1bdd3c=_['merge']({},_0x1bdd3c,_0x4819b1['options']);var _0x13f21b={'where':_0x1bdd3c[_0x43f7('0x3c')]};return db['WhatsappTransferReport'][_0x43f7('0x1e')](_0x13f21b)[_0x43f7('0x26')](function(_0x338538){_0x4472cc['count']=_0x338538;if(_0x4819b1[_0x43f7('0x31')][_0x43f7('0x41')]){_0x1bdd3c[_0x43f7('0x42')]=[{'all':!![]}];}return db[_0x43f7('0x2d')][_0x43f7('0x43')](_0x1bdd3c);})[_0x43f7('0x26')](function(_0x1096f3){_0x4472cc[_0x43f7('0x44')]=_0x1096f3;return _0x4472cc;})[_0x43f7('0x26')](respondWithFilteredResult(_0xf1e837,_0x1bdd3c))[_0x43f7('0x45')](handleError(_0xf1e837,null));};exports['show']=function(_0x207654,_0x3e459f){var _0x28c3dc={'raw':!![],'where':{'id':_0x207654[_0x43f7('0x46')]['id']}},_0x2eff54={};_0x2eff54[_0x43f7('0x36')]=_['keys'](db[_0x43f7('0x2d')][_0x43f7('0x47')]);_0x2eff54[_0x43f7('0x31')]=_[_0x43f7('0x32')](_0x207654[_0x43f7('0x31')]);_0x2eff54[_0x43f7('0x33')]=_[_0x43f7('0x34')](_0x2eff54[_0x43f7('0x36')],_0x2eff54[_0x43f7('0x31')]);_0x28c3dc[_0x43f7('0x35')]=_[_0x43f7('0x34')](_0x2eff54['model'],qs['fields'](_0x207654[_0x43f7('0x31')][_0x43f7('0x37')]));_0x28c3dc[_0x43f7('0x35')]=_0x28c3dc[_0x43f7('0x35')][_0x43f7('0x38')]?_0x28c3dc[_0x43f7('0x35')]:_0x2eff54[_0x43f7('0x36')];if(_0x207654['query'][_0x43f7('0x41')]){_0x28c3dc[_0x43f7('0x42')]=[{'all':!![]}];}_0x28c3dc=_['merge']({},_0x28c3dc,_0x207654['options']);return db[_0x43f7('0x2d')][_0x43f7('0x48')](_0x28c3dc)[_0x43f7('0x26')](handleEntityNotFound(_0x3e459f,null))[_0x43f7('0x26')](respondWithResult(_0x3e459f,null))[_0x43f7('0x45')](handleError(_0x3e459f,null));};exports[_0x43f7('0x49')]=function(_0xd9685d,_0x177135){return db['WhatsappTransferReport'][_0x43f7('0x49')](_0xd9685d[_0x43f7('0x4a')],{})[_0x43f7('0x26')](respondWithResult(_0x177135,0xc9))['catch'](handleError(_0x177135,null));};exports[_0x43f7('0x25')]=function(_0x22c83,_0x490607){if(_0x22c83[_0x43f7('0x4a')]['id']){delete _0x22c83['body']['id'];}return db[_0x43f7('0x2d')][_0x43f7('0x48')]({'where':{'id':_0x22c83['params']['id']}})[_0x43f7('0x26')](handleEntityNotFound(_0x490607,null))[_0x43f7('0x26')](saveUpdates(_0x22c83[_0x43f7('0x4a')],null))['then'](respondWithResult(_0x490607,null))[_0x43f7('0x45')](handleError(_0x490607,null));};exports[_0x43f7('0x27')]=function(_0x4df844,_0x5a394f){return db[_0x43f7('0x2d')]['find']({'where':{'id':_0x4df844[_0x43f7('0x46')]['id']}})[_0x43f7('0x26')](handleEntityNotFound(_0x5a394f,null))[_0x43f7('0x26')](removeEntity(_0x5a394f,null))[_0x43f7('0x45')](handleError(_0x5a394f,null));};exports[_0x43f7('0x4b')]=function(_0x7b735c,_0x19fffd){return db[_0x43f7('0x2d')][_0x43f7('0x4b')]()[_0x43f7('0x26')](respondWithResult(_0x19fffd,null))[_0x43f7('0x45')](handleError(_0x19fffd,null));}; \ No newline at end of file +var _0x50bf=['request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch'];(function(_0xb73530,_0x31eba1){var _0x160eec=function(_0x3dfe0e){while(--_0x3dfe0e){_0xb73530['push'](_0xb73530['shift']());}};_0x160eec(++_0x31eba1);}(_0x50bf,0x106));var _0xf50b=function(_0x35f08f,_0x3b56f1){_0x35f08f=_0x35f08f-0x0;var _0x8e8ccb=_0x50bf[_0x35f08f];return _0x8e8ccb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf50b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf50b('0x1'));var rp=require(_0xf50b('0x2'));var moment=require('moment');var BPromise=require(_0xf50b('0x3'));var Mustache=require(_0xf50b('0x4'));var util=require('util');var path=require(_0xf50b('0x5'));var sox=require('sox');var csv=require(_0xf50b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf50b('0x7'));var _=require(_0xf50b('0x8'));var squel=require(_0xf50b('0x9'));var crypto=require('crypto');var jsforce=require(_0xf50b('0xa'));var deskjs=require(_0xf50b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf50b('0xc'));var qs=require(_0xf50b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf50b('0xe'));var logger=require('../../config/logger')(_0xf50b('0xf'));var utils=require(_0xf50b('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xf50b('0x11'));var db=require(_0xf50b('0x12'))['db'];function respondWithStatusCode(_0x5cb80c,_0x27800c){_0x27800c=_0x27800c||0xcc;return function(_0x420701){if(_0x420701){return _0x5cb80c[_0xf50b('0x13')](_0x27800c);}return _0x5cb80c[_0xf50b('0x14')](_0x27800c)['end']();};}function respondWithResult(_0x3a1c56,_0x110158){_0x110158=_0x110158||0xc8;return function(_0x405f94){if(_0x405f94){return _0x3a1c56[_0xf50b('0x14')](_0x110158)['json'](_0x405f94);}};}function respondWithFilteredResult(_0x543f7b,_0x69fbcc){return function(_0x4c041d){if(_0x4c041d){var _0x19460c=typeof _0x69fbcc[_0xf50b('0x15')]===_0xf50b('0x16')&&typeof _0x69fbcc[_0xf50b('0x17')]==='undefined';var _0x47950c=_0x4c041d[_0xf50b('0x18')];var _0x4fbf00=_0x19460c?0x0:_0x69fbcc['offset'];var _0x43ad41=_0x19460c?_0x4c041d[_0xf50b('0x18')]:_0x69fbcc[_0xf50b('0x15')]+_0x69fbcc[_0xf50b('0x17')];var _0x4b2b94;if(_0x43ad41>=_0x47950c){_0x43ad41=_0x47950c;_0x4b2b94=0xc8;}else{_0x4b2b94=0xce;}_0x543f7b['status'](_0x4b2b94);return _0x543f7b[_0xf50b('0x19')]('Content-Range',_0x4fbf00+'-'+_0x43ad41+'/'+_0x47950c)[_0xf50b('0x1a')](_0x4c041d);}return null;};}function patchUpdates(_0x442c89){return function(_0x3b439a){try{jsonpatch[_0xf50b('0x1b')](_0x3b439a,_0x442c89,!![]);}catch(_0x26912b){return BPromise[_0xf50b('0x1c')](_0x26912b);}return _0x3b439a[_0xf50b('0x1d')]();};}function saveUpdates(_0x445f57,_0xf15c47){return function(_0x5121fd){if(_0x5121fd){return _0x5121fd[_0xf50b('0x1e')](_0x445f57)[_0xf50b('0x1f')](function(_0x24a4aa){return _0x24a4aa;});}return null;};}function removeEntity(_0x1cefd3,_0x1572c9){return function(_0x3a0df9){if(_0x3a0df9){return _0x3a0df9['destroy']()[_0xf50b('0x1f')](function(){_0x1cefd3[_0xf50b('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x531399,_0x37ff8b){return function(_0x50f773){if(!_0x50f773){_0x531399[_0xf50b('0x13')](0x194);}return _0x50f773;};}function handleError(_0x4a6eda,_0x1d12ed){_0x1d12ed=_0x1d12ed||0x1f4;return function(_0x10bfeb){logger['error'](_0x10bfeb[_0xf50b('0x20')]);if(_0x10bfeb[_0xf50b('0x21')]){delete _0x10bfeb[_0xf50b('0x21')];}_0x4a6eda[_0xf50b('0x14')](_0x1d12ed)[_0xf50b('0x22')](_0x10bfeb);};}exports[_0xf50b('0x23')]=function(_0xf2dfac,_0x2997b9){var _0x5e4c29={},_0x49ed08={},_0x162304={'count':0x0,'rows':[]};var _0x5a1e92=_[_0xf50b('0x24')](db[_0xf50b('0x25')][_0xf50b('0x26')],function(_0x25fbdd){return{'name':_0x25fbdd['fieldName'],'type':_0x25fbdd[_0xf50b('0x27')][_0xf50b('0x28')]};});_0x49ed08['model']=_[_0xf50b('0x24')](_0x5a1e92,_0xf50b('0x21'));_0x49ed08[_0xf50b('0x29')]=_[_0xf50b('0x2a')](_0xf2dfac[_0xf50b('0x29')]);_0x49ed08['filters']=_['intersection'](_0x49ed08[_0xf50b('0x2b')],_0x49ed08[_0xf50b('0x29')]);_0x5e4c29[_0xf50b('0x2c')]=_[_0xf50b('0x2d')](_0x49ed08['model'],qs[_0xf50b('0x2e')](_0xf2dfac[_0xf50b('0x29')][_0xf50b('0x2e')]));_0x5e4c29[_0xf50b('0x2c')]=_0x5e4c29[_0xf50b('0x2c')]['length']?_0x5e4c29[_0xf50b('0x2c')]:_0x49ed08[_0xf50b('0x2b')];if(!_0xf2dfac[_0xf50b('0x29')][_0xf50b('0x2f')](_0xf50b('0x30'))){_0x5e4c29['limit']=qs[_0xf50b('0x17')](_0xf2dfac[_0xf50b('0x29')]['limit']);_0x5e4c29[_0xf50b('0x15')]=qs[_0xf50b('0x15')](_0xf2dfac[_0xf50b('0x29')][_0xf50b('0x15')]);}_0x5e4c29['order']=qs[_0xf50b('0x31')](_0xf2dfac[_0xf50b('0x29')][_0xf50b('0x31')]);_0x5e4c29[_0xf50b('0x32')]=qs[_0xf50b('0x33')](_['pick'](_0xf2dfac[_0xf50b('0x29')],_0x49ed08[_0xf50b('0x33')]),_0x5a1e92);if(_0xf2dfac['query'][_0xf50b('0x34')]){_0x5e4c29[_0xf50b('0x32')]=_[_0xf50b('0x35')](_0x5e4c29[_0xf50b('0x32')],{'$or':_[_0xf50b('0x24')](_0x5a1e92,function(_0x372d71){if(_0x372d71[_0xf50b('0x27')]!=='VIRTUAL'){var _0x5ca8cb={};_0x5ca8cb[_0x372d71[_0xf50b('0x21')]]={'$like':'%'+_0xf2dfac[_0xf50b('0x29')]['filter']+'%'};return _0x5ca8cb;}})});}_0x5e4c29=_['merge']({},_0x5e4c29,_0xf2dfac[_0xf50b('0x36')]);var _0x4ff1fa={'where':_0x5e4c29[_0xf50b('0x32')]};return db[_0xf50b('0x25')][_0xf50b('0x18')](_0x4ff1fa)[_0xf50b('0x1f')](function(_0x5864bd){_0x162304['count']=_0x5864bd;if(_0xf2dfac[_0xf50b('0x29')][_0xf50b('0x37')]){_0x5e4c29[_0xf50b('0x38')]=[{'all':!![]}];}return db[_0xf50b('0x25')][_0xf50b('0x39')](_0x5e4c29);})['then'](function(_0x54add5){_0x162304[_0xf50b('0x3a')]=_0x54add5;return _0x162304;})[_0xf50b('0x1f')](respondWithFilteredResult(_0x2997b9,_0x5e4c29))[_0xf50b('0x3b')](handleError(_0x2997b9,null));};exports[_0xf50b('0x3c')]=function(_0x309cd2,_0x32bcb8){var _0x4df85={'raw':!![],'where':{'id':_0x309cd2[_0xf50b('0x3d')]['id']}},_0x53b055={};_0x53b055[_0xf50b('0x2b')]=_[_0xf50b('0x2a')](db['WhatsappTransferReport'][_0xf50b('0x26')]);_0x53b055[_0xf50b('0x29')]=_[_0xf50b('0x2a')](_0x309cd2['query']);_0x53b055[_0xf50b('0x33')]=_[_0xf50b('0x2d')](_0x53b055[_0xf50b('0x2b')],_0x53b055['query']);_0x4df85[_0xf50b('0x2c')]=_['intersection'](_0x53b055[_0xf50b('0x2b')],qs['fields'](_0x309cd2[_0xf50b('0x29')][_0xf50b('0x2e')]));_0x4df85[_0xf50b('0x2c')]=_0x4df85[_0xf50b('0x2c')]['length']?_0x4df85['attributes']:_0x53b055[_0xf50b('0x2b')];if(_0x309cd2[_0xf50b('0x29')][_0xf50b('0x37')]){_0x4df85[_0xf50b('0x38')]=[{'all':!![]}];}_0x4df85=_[_0xf50b('0x35')]({},_0x4df85,_0x309cd2[_0xf50b('0x36')]);return db[_0xf50b('0x25')][_0xf50b('0x3e')](_0x4df85)[_0xf50b('0x1f')](handleEntityNotFound(_0x32bcb8,null))[_0xf50b('0x1f')](respondWithResult(_0x32bcb8,null))[_0xf50b('0x3b')](handleError(_0x32bcb8,null));};exports['create']=function(_0x494126,_0x8944b6){return db[_0xf50b('0x25')][_0xf50b('0x3f')](_0x494126['body'],{})['then'](respondWithResult(_0x8944b6,0xc9))['catch'](handleError(_0x8944b6,null));};exports['update']=function(_0x1d5498,_0x47b010){if(_0x1d5498[_0xf50b('0x40')]['id']){delete _0x1d5498[_0xf50b('0x40')]['id'];}return db[_0xf50b('0x25')]['find']({'where':{'id':_0x1d5498[_0xf50b('0x3d')]['id']}})[_0xf50b('0x1f')](handleEntityNotFound(_0x47b010,null))[_0xf50b('0x1f')](saveUpdates(_0x1d5498[_0xf50b('0x40')],null))[_0xf50b('0x1f')](respondWithResult(_0x47b010,null))[_0xf50b('0x3b')](handleError(_0x47b010,null));};exports['destroy']=function(_0x336db8,_0x4dcb1e){return db[_0xf50b('0x25')][_0xf50b('0x3e')]({'where':{'id':_0x336db8['params']['id']}})[_0xf50b('0x1f')](handleEntityNotFound(_0x4dcb1e,null))['then'](removeEntity(_0x4dcb1e,null))[_0xf50b('0x3b')](handleError(_0x4dcb1e,null));};exports['describe']=function(_0x4672be,_0x57de5e){return db[_0xf50b('0x25')][_0xf50b('0x41')]()[_0xf50b('0x1f')](respondWithResult(_0x57de5e,null))[_0xf50b('0x3b')](handleError(_0x57de5e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index fd15ee3..2ce3ace 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 _0xa4b7=['util','moment','bluebird','path','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x455f19,_0x4f8f3a){var _0x422f21=function(_0x4537cd){while(--_0x4537cd){_0x455f19['push'](_0x455f19['shift']());}};_0x422f21(++_0x4f8f3a);}(_0xa4b7,0x199));var _0x7a4b=function(_0x3fc404,_0x57b215){_0x3fc404=_0x3fc404-0x0;var _0x332a12=_0xa4b7[_0x3fc404];return _0x332a12;};'use strict';var _=require(_0x7a4b('0x0'));var util=require(_0x7a4b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7a4b('0x2'));var BPromise=require(_0x7a4b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a4b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a4b('0x5'));module[_0x7a4b('0x6')]=function(_0x272356,_0x531672){return _0x272356[_0x7a4b('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0x7a4b('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7a4b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9805=['request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','moment'];(function(_0x588787,_0x4f103b){var _0x3bf7c6=function(_0x551a50){while(--_0x551a50){_0x588787['push'](_0x588787['shift']());}};_0x3bf7c6(++_0x4f103b);}(_0x9805,0xd5));var _0x5980=function(_0x3626ad,_0xae31a9){_0x3626ad=_0x3626ad-0x0;var _0x2d9b1c=_0x9805[_0x3626ad];return _0x2d9b1c;};'use strict';var _=require(_0x5980('0x0'));var util=require(_0x5980('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5980('0x2'));var BPromise=require('bluebird');var rp=require(_0x5980('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5980('0x4'));var config=require(_0x5980('0x5'));var attributes=require(_0x5980('0x6'));module[_0x5980('0x7')]=function(_0x5f0d6a,_0x3d0e26){return _0x5f0d6a[_0x5980('0x8')](_0x5980('0x9'),attributes,{'tableName':_0x5980('0xa'),'paranoid':![],'indexes':[{'name':_0x5980('0xb'),'fields':[_0x5980('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index a1a8558..f1965fb 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 _0x1710=['client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x26fd29,_0x51da92){var _0x1a403f=function(_0x4dd8f8){while(--_0x4dd8f8){_0x26fd29['push'](_0x26fd29['shift']());}};_0x1a403f(++_0x51da92);}(_0x1710,0x19e));var _0x0171=function(_0x2f7e5f,_0x2891f5){_0x2f7e5f=_0x2f7e5f-0x0;var _0x465840=_0x1710[_0x2f7e5f];return _0x465840;};'use strict';var _=require(_0x0171('0x0'));var util=require(_0x0171('0x1'));var moment=require(_0x0171('0x2'));var BPromise=require(_0x0171('0x3'));var rs=require(_0x0171('0x4'));var fs=require('fs');var Redis=require(_0x0171('0x5'));var db=require(_0x0171('0x6'))['db'];var utils=require(_0x0171('0x7'));var logger=require(_0x0171('0x8'))('rpc');var config=require(_0x0171('0x9'));var jayson=require(_0x0171('0xa'));var client=jayson[_0x0171('0xb')][_0x0171('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fea6d,_0x3b51de,_0x3037a4){return new BPromise(function(_0xa2eb72,_0xfdad94){return client[_0x0171('0xd')](_0x2fea6d,_0x3037a4)[_0x0171('0xe')](function(_0x37d509){logger[_0x0171('0xf')](_0x0171('0x10'),_0x3b51de,'request\x20sent');logger[_0x0171('0x11')](_0x0171('0x12'),_0x3b51de,_0x0171('0x13'),JSON[_0x0171('0x14')](_0x37d509));if(_0x37d509['error']){if(_0x37d509[_0x0171('0x15')][_0x0171('0x16')]===0x1f4){logger[_0x0171('0x15')](_0x0171('0x10'),_0x3b51de,_0x37d509[_0x0171('0x15')]['message']);return _0xfdad94(_0x37d509[_0x0171('0x15')]['message']);}logger[_0x0171('0x15')](_0x0171('0x10'),_0x3b51de,_0x37d509['error'][_0x0171('0x17')]);return _0xa2eb72(_0x37d509[_0x0171('0x15')][_0x0171('0x17')]);}else{logger[_0x0171('0xf')](_0x0171('0x10'),_0x3b51de,_0x0171('0x13'));_0xa2eb72(_0x37d509[_0x0171('0x18')][_0x0171('0x17')]);}})['catch'](function(_0x302cf5){logger[_0x0171('0x15')](_0x0171('0x10'),_0x3b51de,_0x302cf5);_0xfdad94(_0x302cf5);});});} \ No newline at end of file +var _0x832c=['WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x41006f,_0x2e8d07){var _0x500cb4=function(_0x407769){while(--_0x407769){_0x41006f['push'](_0x41006f['shift']());}};_0x500cb4(++_0x2e8d07);}(_0x832c,0xd9));var _0xc832=function(_0x1fb9d7,_0x423a06){_0x1fb9d7=_0x1fb9d7-0x0;var _0x3e9641=_0x832c[_0x1fb9d7];return _0x3e9641;};'use strict';var _=require(_0xc832('0x0'));var util=require('util');var moment=require(_0xc832('0x1'));var BPromise=require(_0xc832('0x2'));var rs=require(_0xc832('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc832('0x4'));var logger=require(_0xc832('0x5'))(_0xc832('0x6'));var config=require(_0xc832('0x7'));var jayson=require(_0xc832('0x8'));var client=jayson[_0xc832('0x9')][_0xc832('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50db9e,_0x331a96,_0x4b1f1a){return new BPromise(function(_0x50bf84,_0x5cea5f){return client[_0xc832('0xb')](_0x50db9e,_0x4b1f1a)[_0xc832('0xc')](function(_0x520584){logger['info'](_0xc832('0xd'),_0x331a96,'request\x20sent');logger[_0xc832('0xe')](_0xc832('0xf'),_0x331a96,_0xc832('0x10'),JSON[_0xc832('0x11')](_0x520584));if(_0x520584[_0xc832('0x12')]){if(_0x520584[_0xc832('0x12')][_0xc832('0x13')]===0x1f4){logger[_0xc832('0x12')](_0xc832('0xd'),_0x331a96,_0x520584[_0xc832('0x12')][_0xc832('0x14')]);return _0x5cea5f(_0x520584[_0xc832('0x12')][_0xc832('0x14')]);}logger[_0xc832('0x12')](_0xc832('0xd'),_0x331a96,_0x520584[_0xc832('0x12')][_0xc832('0x14')]);return _0x50bf84(_0x520584[_0xc832('0x12')][_0xc832('0x14')]);}else{logger[_0xc832('0x15')](_0xc832('0xd'),_0x331a96,_0xc832('0x10'));_0x50bf84(_0x520584['result'][_0xc832('0x14')]);}})[_0xc832('0x16')](function(_0xc2699d){logger[_0xc832('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x331a96,_0xc2699d);_0x5cea5f(_0xc2699d);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 84a609e..3b97b6e 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb65d=['./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','listen','start','info','Online\x20apps:','map','filter','online','join','status','name','seedDB','./config/seedDB','default','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config'];(function(_0x2b4806,_0x52213a){var _0x3a10ae=function(_0x3f958e){while(--_0x3f958e){_0x2b4806['push'](_0x2b4806['shift']());}};_0x3a10ae(++_0x52213a);}(_0xb65d,0x6d));var _0xdb65=function(_0x290292,_0x2579ed){_0x290292=_0x290292-0x0;var _0x41d982=_0xb65d[_0x290292];return _0x41d982;};'use strict';var _=require('lodash');var mysqldb=require(_0xdb65('0x0'));var rpc=require(_0xdb65('0x1'));var config=require(_0xdb65('0x2'));var logger=require(_0xdb65('0x3'))(_0xdb65('0x4'));var pm2=require(_0xdb65('0x5'));var pm2Config=require(_0xdb65('0x6'));var schedule=require(_0xdb65('0x7'));var chat=require(_0xdb65('0x8'));var whatsapp=require(_0xdb65('0x9'));var transcribe=require(_0xdb65('0xa'));function main(){return mysqldb['db'][_0xdb65('0xb')]['sync']()[_0xdb65('0xc')](function(){return rpc[_0xdb65('0xd')]();})[_0xdb65('0xc')](function(_0xe6bbdd){logger['info'](_0xe6bbdd);return chat[_0xdb65('0xe')]();})[_0xdb65('0xc')](function(){return whatsapp[_0xdb65('0xe')]();})[_0xdb65('0xc')](function(){return schedule[_0xdb65('0xe')]();})[_0xdb65('0xc')](function(){return transcribe['start']();})[_0xdb65('0xc')](function(_0x3edd0f){logger[_0xdb65('0xf')](_0x3edd0f);return pm2[_0xdb65('0xe')](pm2Config);})['then'](function(_0x4c5cd7){logger['info'](_0xdb65('0x10'),_[_0xdb65('0x11')](_[_0xdb65('0x12')](_0x4c5cd7,{'status':_0xdb65('0x13')}),'name')[_0xdb65('0x14')]());logger[_0xdb65('0xf')]('Offline\x20apps:',_['map'](_[_0xdb65('0x12')](_0x4c5cd7,function(_0x2f3899){return _0x2f3899[_0xdb65('0x15')]!=='online';}),_0xdb65('0x16'))[_0xdb65('0x14')]()||'None');config[_0xdb65('0x17')]&&require(_0xdb65('0x18'))[_0xdb65('0x19')]();require(_0xdb65('0x1a'))[_0xdb65('0x19')]();})['catch'](function(_0xfdf001){logger['error'](_0xdb65('0x1b'),_0xfdf001);process[_0xdb65('0x1c')](0x1);});}main(); \ No newline at end of file +var _0x94d1=['./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','info','start','then','Online\x20apps:','filter','online','join','Offline\x20apps:','map','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc'];(function(_0xffc39b,_0x1f1007){var _0x2d9eb3=function(_0x367947){while(--_0x367947){_0xffc39b['push'](_0xffc39b['shift']());}};_0x2d9eb3(++_0x1f1007);}(_0x94d1,0x7d));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x194d('0x0'));var mysqldb=require(_0x194d('0x1'));var rpc=require(_0x194d('0x2'));var config=require(_0x194d('0x3'));var logger=require(_0x194d('0x4'))(_0x194d('0x5'));var pm2=require(_0x194d('0x6'));var pm2Config=require(_0x194d('0x7'));var schedule=require(_0x194d('0x8'));var chat=require(_0x194d('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x194d('0xa'));function main(){return mysqldb['db'][_0x194d('0xb')][_0x194d('0xc')]()['then'](function(){return rpc['listen']();})['then'](function(_0x397568){logger[_0x194d('0xd')](_0x397568);return chat[_0x194d('0xe')]();})[_0x194d('0xf')](function(){return whatsapp[_0x194d('0xe')]();})['then'](function(){return schedule[_0x194d('0xe')]();})[_0x194d('0xf')](function(){return transcribe['start']();})['then'](function(_0x5aa360){logger[_0x194d('0xd')](_0x5aa360);return pm2['start'](pm2Config);})[_0x194d('0xf')](function(_0x45f5d3){logger['info'](_0x194d('0x10'),_['map'](_[_0x194d('0x11')](_0x45f5d3,{'status':_0x194d('0x12')}),'name')[_0x194d('0x13')]());logger[_0x194d('0xd')](_0x194d('0x14'),_[_0x194d('0x15')](_[_0x194d('0x11')](_0x45f5d3,function(_0x23dc0c){return _0x23dc0c[_0x194d('0x16')]!=='online';}),'name')['join']()||_0x194d('0x17'));config[_0x194d('0x18')]&&require(_0x194d('0x19'))[_0x194d('0x1a')]();require(_0x194d('0x1b'))['default']();})[_0x194d('0x1c')](function(_0x7f15d7){logger[_0x194d('0x1d')](_0x194d('0x1e'),_0x7f15d7);process[_0x194d('0x1f')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 2176a44..7ce2651 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 _0xf30c=['setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','promisify','sign','secret','payload','options','secrets','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','basic-auth','bluebird','util','moment','session','role','name','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isAuthenticated','user','ChatInteraction','findOne','closed','then','status','disposition','unmanaged','json','Unmanaged.','catch','use','headers','authorization','startsWith','Basic','User','find','authenticate','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf30c,0x122));var _0xcf30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf30c[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0xcf30('0x0'))['db'];var config=require(_0xcf30('0x1'));var hardwareConf=require(_0xcf30('0x2'));var licenseUtil=require(_0xcf30('0x3'));var encryptor=require(_0xcf30('0x4'));var _=require(_0xcf30('0x5'));var jwt=require(_0xcf30('0x6'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0xcf30('0x7'));var crypto=require('crypto');var BPromise=require(_0xcf30('0x8'));var util=require(_0xcf30('0x9'));var moment=require(_0xcf30('0xa'));var validateJwt=expressJwt({'secret':config['secrets'][_0xcf30('0xb')]});var userAttributes=['id',_0xcf30('0xc'),'fullname',_0xcf30('0xd'),'internal','email','userpic',_0xcf30('0xe'),_0xcf30('0xf'),_0xcf30('0x10'),_0xcf30('0x11'),_0xcf30('0x12'),_0xcf30('0x13'),_0xcf30('0x14'),_0xcf30('0x15'),_0xcf30('0x16'),_0xcf30('0x17'),_0xcf30('0x18'),_0xcf30('0x19'),_0xcf30('0x1a'),_0xcf30('0x1b'),_0xcf30('0x1c'),_0xcf30('0x1d'),'phoneBarAutoAnswer',_0xcf30('0x1e'),_0xcf30('0x1f'),_0xcf30('0x20'),_0xcf30('0x21'),'phoneBarEnableSettings','phoneBarExpires',_0xcf30('0x22'),_0xcf30('0x23'),_0xcf30('0x24'),'hotdesk','interface','userProfileId',_0xcf30('0x25'),_0xcf30('0x26'),_0xcf30('0x27'),_0xcf30('0x28'),_0xcf30('0x29'),_0xcf30('0x2a')];exports['isChatInteractionAuthorized']=function(){return this[_0xcf30('0x2b')](!![])['use'](function(_0x480c19,_0x3824fb,_0x586f96){if(_0x480c19[_0xcf30('0x2c')]){_0x586f96();}else{return db[_0xcf30('0x2d')][_0xcf30('0x2e')]({'where':{'id':_0x480c19['params']['id']},'attributes':['id',_0xcf30('0x2f'),'disposition'],'raw':!![]})[_0xcf30('0x30')](function(_0xcfcbe4){if(_0xcfcbe4&&_0xcfcbe4[_0xcf30('0x2f')]){return _0x3824fb[_0xcf30('0x31')](_0xcfcbe4[_0xcf30('0x32')]===_0xcf30('0x33')?0x195:0x193)[_0xcf30('0x34')]({'message':_0xcfcbe4['disposition']===_0xcf30('0x33')?_0xcf30('0x35'):'Forbidden.'});}else{_0x586f96();}})[_0xcf30('0x36')](function(_0xce2e75){_0x586f96(_0xce2e75);});}});};exports[_0xcf30('0x2b')]=function isAuthenticated(_0x59ccc8){return compose()[_0xcf30('0x37')](function(_0x3858b1,_0x43144b,_0x28fe45){var _0x498cc9;if(_0x3858b1[_0xcf30('0x38')][_0xcf30('0x39')]){if(_[_0xcf30('0x3a')](_0x3858b1[_0xcf30('0x38')][_0xcf30('0x39')],_0xcf30('0x3b'))){var _0x1677bf=basicAuth(_0x3858b1);db[_0xcf30('0x3c')][_0xcf30('0x3d')]({'where':{'name':_0x1677bf[_0xcf30('0xd')]}})['then'](function(_0x55847e){if(!_0x55847e||!_0x55847e[_0xcf30('0x3e')](_0x1677bf['pass'])){return _0x43144b[_0xcf30('0x31')](0x191)[_0xcf30('0x34')]({'message':_0xcf30('0x3f')});}_0x3858b1[_0xcf30('0x2c')]={'id':_0x55847e['id']};_0x28fe45();})[_0xcf30('0x36')](function(_0x119700){_0x28fe45(_0x119700);});}else if(_['startsWith'](_0x3858b1[_0xcf30('0x38')]['authorization'],_0xcf30('0x40'))){validateJwt(_0x3858b1,_0x43144b,_0x28fe45);}else{if(_0x59ccc8){_0x28fe45();}else{return _0x43144b[_0xcf30('0x31')](0x193)['json']({'message':_0xcf30('0x41')});}}}else if(_0x3858b1[_0xcf30('0x42')]['apikey']){try{var _0x2325f5={'audience':hardwareConf[_0xcf30('0x43')](),'issuer':hardwareConf[_0xcf30('0x43')]()};verifyJwt(_0x3858b1[_0xcf30('0x42')][_0xcf30('0x44')],_0x2325f5)[_0xcf30('0x30')](function(_0x42bf16){return db['User'][_0xcf30('0x3d')]({'where':{'id':_0x42bf16['sub']}})[_0xcf30('0x30')](function(_0x4440a1){_0x498cc9=_0x4440a1;return db[_0xcf30('0x45')]['findOne']({'where':{'id':0x1},'attributes':[_0xcf30('0x46'),'blockDuration'],'raw':!![]});})[_0xcf30('0x30')](function(_0x8c1f73){if(!_0x498cc9||!_[_0xcf30('0x47')](_0x498cc9[_0xcf30('0x48')],_0x42bf16[_0xcf30('0x49')])){return _0x43144b[_0xcf30('0x31')](0x191)[_0xcf30('0x34')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x498cc9[_0xcf30('0x4a')]){return _0x43144b[_0xcf30('0x31')](0x191)['json']({'message':_0xcf30('0x4b')});}if(_0x498cc9[_0xcf30('0x4c')]){if(_0x8c1f73[_0xcf30('0x4d')]>0x0){if(moment(_0x498cc9['blockedAt'])[_0xcf30('0x4e')](_0x8c1f73[_0xcf30('0x4d')],_0xcf30('0x4f'))>moment()){return _0x43144b[_0xcf30('0x31')](0x191)[_0xcf30('0x34')]({'message':_0xcf30('0x4b')});}}else{return _0x43144b[_0xcf30('0x31')](0x191)[_0xcf30('0x34')]({'message':_0xcf30('0x4b')});}}_0x3858b1[_0xcf30('0x2c')]={'id':_0x498cc9['id']};_0x28fe45();});})['catch'](function(){return _0x43144b[_0xcf30('0x31')](0x191)[_0xcf30('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xa7fc13){_0x28fe45(_0xa7fc13);}}else if(_0x59ccc8){_0x28fe45();}else{return _0x43144b[_0xcf30('0x31')](0x193)['json']({'message':_0xcf30('0x41')});}})['use'](function(_0x5dc5b9,_0x8f9b04,_0x5562de){if(_0x5dc5b9[_0xcf30('0x2c')]){db[_0xcf30('0x3c')][_0xcf30('0x3d')]({'where':{'id':_0x5dc5b9['user']['id']},'attributes':userAttributes})[_0xcf30('0x30')](function(_0x55edd1){if(!_0x55edd1){return _0x8f9b04[_0xcf30('0x31')](0x194)['json']({'message':_0xcf30('0x50')});}_0x5dc5b9[_0xcf30('0x2c')]=_0x55edd1;_0x5562de();})[_0xcf30('0x36')](function(_0x3fa766){_0x5562de(_0x3fa766);});}else if(_0x59ccc8){_0x5562de();}else{return _0x8f9b04[_0xcf30('0x31')](0x194)[_0xcf30('0x34')]({'message':_0xcf30('0x51')});}});};exports[_0xcf30('0x52')]=function canUpdate(){return compose()[_0xcf30('0x37')](function(_0x33bde4,_0x52311e,_0x3721e7){return licenseUtil[_0xcf30('0x53')]()[_0xcf30('0x30')](function(_0x5cedbd){if(_0x5cedbd[_0xcf30('0x54')]){_0x3721e7();}else{return _0x52311e[_0xcf30('0x31')](0x193)['json']({'message':_0xcf30('0x55')});}})[_0xcf30('0x36')](function(_0x3410e2){_0x3721e7(_0x3410e2);});});};exports[_0xcf30('0x56')]=function(_0x57faed,_0x4dd06e,_0x55f67d){_0x57faed[_0xcf30('0x56')]=!![];return _0x55f67d();};exports[_0xcf30('0x57')]=function signToken(_0x36f762){return signJwt(_0x36f762);};exports[_0xcf30('0x58')]=function(_0x44c7bf,_0x3c01b7){if(!_0x44c7bf[_0xcf30('0x2c')]){return _0x3c01b7[_0xcf30('0x31')](0x194)['json']({'message':_0xcf30('0x59')});}var _0x19c3c4={'payload':{'id':_0x44c7bf[_0xcf30('0x2c')]['id'],'role':_0x44c7bf[_0xcf30('0x2c')][_0xcf30('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19c3c4)[_0xcf30('0x30')](function(_0x575368){_0x3c01b7[_0xcf30('0x5a')](_0xcf30('0x5b'),_0x575368);_0x3c01b7[_0xcf30('0x5c')](_0xcf30('0x5d'));})[_0xcf30('0x36')](function(_0x419346){return _0x3c01b7[_0xcf30('0x31')](0x1f4)[_0xcf30('0x5e')](_0x419346);});};exports[_0xcf30('0x5f')]=function(_0x3d76cd){if(_[_0xcf30('0x60')](_0x3d76cd[_0xcf30('0x48')])||_[_0xcf30('0x60')](_0x3d76cd[_0xcf30('0x61')])){return null;}else{return createJwt(_0x3d76cd);}};exports[_0xcf30('0x62')]=function(_0x2a85f2){_0x2a85f2['apiKeyNonce']=generateNonce();_0x2a85f2[_0xcf30('0x61')]=generateIssuedAt();return createJwt(_0x2a85f2);};exports[_0xcf30('0x63')]=function(_0x1ea3fc,_0x17172b){var _0x31f1bd=_0x1ea3fc[_0xcf30('0x42')][_0xcf30('0x44')];if(_0x31f1bd){var _0x3a89ea={'nonce':_0x17172b[_0xcf30('0x48')],'iat':_0x17172b[_0xcf30('0x61')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x31f1bd,_0x3a89ea)[_0xcf30('0x30')](function(){return generateApiKey(_0x17172b);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xcf30('0x64')]=function(_0x4002a8){var _0x50d45c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x50d45c['test'](_0x4002a8))throw new db[(_0xcf30('0x65'))]['ValidationError'](_0xcf30('0x66'));return;};exports[_0xcf30('0x67')]=function(_0x5e7672,_0x483481,_0x26c037){var _0x305f60=encryptor[_0xcf30('0x68')](_0x483481)[_0xcf30('0x69')](',');for(var _0x3413cf=0x0;_0x3413cf<_0x26c037;_0x3413cf++){if(!_0x305f60[_0x3413cf])break;if(_0x5e7672[_0xcf30('0x6a')]()===_0x305f60[_0x3413cf]['toLowerCase']()){var _0x5799d7=util[_0xcf30('0x6b')](_0xcf30('0x6c'),_0x26c037);if(_0x26c037===0x1){_0x5799d7=_0xcf30('0x6d');}throw new db['Sequelize']['ValidationError'](_0x5799d7);}}return;};exports[_0xcf30('0x6e')]=function(_0x4864a5,_0xee0ff8){var _0x3bb15c=_0xee0ff8?encryptor['decryptString'](_0xee0ff8)[_0xcf30('0x69')](','):[];if(_0x3bb15c[_0xcf30('0x6f')]===0x5){_0x3bb15c[_0xcf30('0x70')](-0x1,0x1);}_0x3bb15c[_0xcf30('0x71')](_0x4864a5);return encryptor[_0xcf30('0x72')](_0x3bb15c['join'](','));};function signJwt(_0xb8febf){var _0x7a735c=BPromise[_0xcf30('0x73')](jwt[_0xcf30('0x74')],{'context':jwt});var _0x4ea412=_0xb8febf[_0xcf30('0x75')]||config['secrets'][_0xcf30('0xb')];return new BPromise(function(_0x1bc0c4,_0x4e0611){_0x7a735c(_0xb8febf[_0xcf30('0x76')],_0x4ea412,_0xb8febf[_0xcf30('0x77')])['then'](function(_0xc01cfa){_0x1bc0c4(_0xc01cfa);})[_0xcf30('0x36')](function(_0x49e5a8){_0x4e0611(_0x49e5a8);});});}function verifyJwt(_0x237296,_0x3991c8,_0x5aa176){var _0x53c1de=BPromise[_0xcf30('0x73')](jwt['verify'],{'context':jwt});var _0x164775=_0x5aa176||config[_0xcf30('0x78')][_0xcf30('0xb')];return new BPromise(function(_0x3bd103,_0xc21fe4){_0x53c1de(_0x237296,_0x164775,_0x3991c8)[_0xcf30('0x30')](function(_0x5da752){_0x3bd103(_0x5da752);})[_0xcf30('0x36')](function(_0x3404f2){_0xc21fe4(_0x3404f2);});});}function generateNonce(){return crypto[_0xcf30('0x79')](0x10)[_0xcf30('0x7a')]('hex');}function generateIssuedAt(){return Math[_0xcf30('0x7b')](Date[_0xcf30('0x7c')]()/0x3e8)['toString']();}function createJwt(_0x2d977a){var _0x2102a={'payload':{'iat':_0x2d977a[_0xcf30('0x61')],'nonce':_0x2d977a[_0xcf30('0x48')]},'options':{'algorithm':_0xcf30('0x7d'),'subject':_0x2d977a['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xcf30('0x43')]()}};return signJwt(_0x2102a)[_0xcf30('0x30')](function(_0x653896){return{'iat':_0x2d977a[_0xcf30('0x61')],'nonce':_0x2d977a[_0xcf30('0x48')],'token':_0x653896};});} \ No newline at end of file +var _0x99e1=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','sign','secret','payload','options','verify','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','bluebird','util','moment','secrets','session','fullname','internal','email','userpic','permissions','md5secret','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','find','name','authenticate','json','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','sub','Setting','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','decryptString','split','toLowerCase'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x99e1,0x105));var _0x199e=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x99e1[_0x4e9628];return _0x27bc8c;};'use strict';var db=require(_0x199e('0x0'))['db'];var config=require(_0x199e('0x1'));var hardwareConf=require(_0x199e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x199e('0x3'));var _=require(_0x199e('0x4'));var jwt=require(_0x199e('0x5'));var expressJwt=require(_0x199e('0x6'));var compose=require(_0x199e('0x7'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x199e('0x8'));var util=require(_0x199e('0x9'));var moment=require(_0x199e('0xa'));var validateJwt=expressJwt({'secret':config[_0x199e('0xb')][_0x199e('0xc')]});var userAttributes=['id','role',_0x199e('0xd'),'name',_0x199e('0xe'),_0x199e('0xf'),_0x199e('0x10'),_0x199e('0x11'),_0x199e('0x12'),'voicePause','chatPause',_0x199e('0x13'),'faxPause',_0x199e('0x14'),'openchannelPause',_0x199e('0x15'),_0x199e('0x16'),_0x199e('0x17'),_0x199e('0x18'),_0x199e('0x19'),'allowmessenger','passwordResetAt',_0x199e('0x1a'),_0x199e('0x1b'),_0x199e('0x1c'),'phoneBarDnd',_0x199e('0x1d'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires',_0x199e('0x1e'),_0x199e('0x1f'),_0x199e('0x20'),_0x199e('0x21'),_0x199e('0x22'),_0x199e('0x23'),_0x199e('0x24'),_0x199e('0x25'),_0x199e('0x26'),_0x199e('0x27'),_0x199e('0x28'),'downloadAttachments'];exports[_0x199e('0x29')]=function(){return this[_0x199e('0x2a')](!![])['use'](function(_0x15f93a,_0x9ecb95,_0x3c7fe5){if(_0x15f93a['user']){_0x3c7fe5();}else{return db[_0x199e('0x2b')][_0x199e('0x2c')]({'where':{'id':_0x15f93a[_0x199e('0x2d')]['id']},'attributes':['id',_0x199e('0x2e'),_0x199e('0x2f')],'raw':!![]})[_0x199e('0x30')](function(_0x228c36){if(_0x228c36&&_0x228c36[_0x199e('0x2e')]){return _0x9ecb95[_0x199e('0x31')](_0x228c36['disposition']==='unmanaged'?0x195:0x193)['json']({'message':_0x228c36[_0x199e('0x2f')]===_0x199e('0x32')?_0x199e('0x33'):_0x199e('0x34')});}else{_0x3c7fe5();}})[_0x199e('0x35')](function(_0x2f8b8f){_0x3c7fe5(_0x2f8b8f);});}});};exports[_0x199e('0x2a')]=function isAuthenticated(_0x1425b9){return compose()[_0x199e('0x36')](function(_0x4da151,_0xcf7367,_0x11f6ce){var _0xe50968;if(_0x4da151[_0x199e('0x37')][_0x199e('0x38')]){if(_[_0x199e('0x39')](_0x4da151[_0x199e('0x37')]['authorization'],_0x199e('0x3a'))){var _0x5b02c1=basicAuth(_0x4da151);db[_0x199e('0x3b')][_0x199e('0x3c')]({'where':{'name':_0x5b02c1[_0x199e('0x3d')]}})[_0x199e('0x30')](function(_0x35a28c){if(!_0x35a28c||!_0x35a28c[_0x199e('0x3e')](_0x5b02c1['pass'])){return _0xcf7367[_0x199e('0x31')](0x191)[_0x199e('0x3f')]({'message':_0x199e('0x40')});}_0x4da151[_0x199e('0x41')]={'id':_0x35a28c['id']};_0x11f6ce();})['catch'](function(_0x143f2f){_0x11f6ce(_0x143f2f);});}else if(_[_0x199e('0x39')](_0x4da151[_0x199e('0x37')][_0x199e('0x38')],_0x199e('0x42'))){validateJwt(_0x4da151,_0xcf7367,_0x11f6ce);}else{if(_0x1425b9){_0x11f6ce();}else{return _0xcf7367[_0x199e('0x31')](0x193)[_0x199e('0x3f')]({'message':_0x199e('0x43')});}}}else if(_0x4da151['query'][_0x199e('0x44')]){try{var _0x46a3d0={'audience':hardwareConf[_0x199e('0x45')](),'issuer':hardwareConf[_0x199e('0x45')]()};verifyJwt(_0x4da151['query'][_0x199e('0x44')],_0x46a3d0)[_0x199e('0x30')](function(_0x56279c){return db['User'][_0x199e('0x3c')]({'where':{'id':_0x56279c[_0x199e('0x46')]}})[_0x199e('0x30')](function(_0x2e1370){_0xe50968=_0x2e1370;return db[_0x199e('0x47')][_0x199e('0x2c')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x199e('0x48')],'raw':!![]});})[_0x199e('0x30')](function(_0x38b412){if(!_0xe50968||!_[_0x199e('0x49')](_0xe50968['apiKeyNonce'],_0x56279c[_0x199e('0x4a')])){return _0xcf7367[_0x199e('0x31')](0x191)[_0x199e('0x3f')]({'message':_0x199e('0x4b')});}if(_0xe50968[_0x199e('0x4c')]){return _0xcf7367['status'](0x191)[_0x199e('0x3f')]({'message':_0x199e('0x4d')});}if(_0xe50968[_0x199e('0x4e')]){if(_0x38b412[_0x199e('0x48')]>0x0){if(moment(_0xe50968[_0x199e('0x4f')])[_0x199e('0x50')](_0x38b412[_0x199e('0x48')],_0x199e('0x51'))>moment()){return _0xcf7367[_0x199e('0x31')](0x191)[_0x199e('0x3f')]({'message':_0x199e('0x4d')});}}else{return _0xcf7367[_0x199e('0x31')](0x191)[_0x199e('0x3f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4da151[_0x199e('0x41')]={'id':_0xe50968['id']};_0x11f6ce();});})[_0x199e('0x35')](function(){return _0xcf7367[_0x199e('0x31')](0x191)[_0x199e('0x3f')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x5b1ce0){_0x11f6ce(_0x5b1ce0);}}else if(_0x1425b9){_0x11f6ce();}else{return _0xcf7367[_0x199e('0x31')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x199e('0x36')](function(_0x5c1d17,_0x5eb7b1,_0x230ead){if(_0x5c1d17[_0x199e('0x41')]){db['User'][_0x199e('0x3c')]({'where':{'id':_0x5c1d17[_0x199e('0x41')]['id']},'attributes':userAttributes})['then'](function(_0x299c5f){if(!_0x299c5f){return _0x5eb7b1[_0x199e('0x31')](0x194)[_0x199e('0x3f')]({'message':_0x199e('0x52')});}_0x5c1d17['user']=_0x299c5f;_0x230ead();})[_0x199e('0x35')](function(_0x253101){_0x230ead(_0x253101);});}else if(_0x1425b9){_0x230ead();}else{return _0x5eb7b1[_0x199e('0x31')](0x194)['json']({'message':_0x199e('0x53')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x199e('0x36')](function(_0x47f96b,_0x3ef33a,_0x9ed8fa){return licenseUtil['getLicense']()[_0x199e('0x30')](function(_0x22f95c){if(_0x22f95c[_0x199e('0x54')]){_0x9ed8fa();}else{return _0x3ef33a[_0x199e('0x31')](0x193)['json']({'message':_0x199e('0x55')});}})[_0x199e('0x35')](function(_0x3c762d){_0x9ed8fa(_0x3c762d);});});};exports[_0x199e('0x56')]=function(_0x54d293,_0x539a92,_0x82953d){_0x54d293[_0x199e('0x56')]=!![];return _0x82953d();};exports[_0x199e('0x57')]=function signToken(_0x49ea67){return signJwt(_0x49ea67);};exports[_0x199e('0x58')]=function(_0x30e891,_0x542f47){if(!_0x30e891[_0x199e('0x41')]){return _0x542f47[_0x199e('0x31')](0x194)[_0x199e('0x3f')]({'message':_0x199e('0x59')});}var _0x507c63={'payload':{'id':_0x30e891[_0x199e('0x41')]['id'],'role':_0x30e891[_0x199e('0x41')][_0x199e('0x5a')]},'options':{'expiresIn':0x15180}};return signJwt(_0x507c63)[_0x199e('0x30')](function(_0x13d9b0){_0x542f47[_0x199e('0x5b')](_0x199e('0x5c'),_0x13d9b0);_0x542f47[_0x199e('0x5d')]('/dashboards/general');})[_0x199e('0x35')](function(_0x5b6283){return _0x542f47['status'](0x1f4)[_0x199e('0x5e')](_0x5b6283);});};exports['retrieveApiKey']=function(_0x5cdc95){if(_[_0x199e('0x5f')](_0x5cdc95[_0x199e('0x60')])||_[_0x199e('0x5f')](_0x5cdc95[_0x199e('0x61')])){return null;}else{return createJwt(_0x5cdc95);}};exports[_0x199e('0x62')]=function(_0x883c04){_0x883c04[_0x199e('0x60')]=generateNonce();_0x883c04[_0x199e('0x61')]=generateIssuedAt();return createJwt(_0x883c04);};exports[_0x199e('0x63')]=function(_0x3799a1,_0x46b712){var _0x25e2b3=_0x3799a1[_0x199e('0x64')][_0x199e('0x44')];if(_0x25e2b3){var _0x10fa17={'nonce':_0x46b712[_0x199e('0x60')],'iat':_0x46b712[_0x199e('0x61')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x199e('0x45')]()};return verifyJwt(_0x25e2b3,_0x10fa17)[_0x199e('0x30')](function(){return generateApiKey(_0x46b712);});}else{throw{'message':_0x199e('0x65')};}};exports[_0x199e('0x66')]=function(_0x569d5a){var _0x397b33=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x397b33['test'](_0x569d5a))throw new db[(_0x199e('0x67'))][(_0x199e('0x68'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x4f693e,_0x1c54f9,_0x455887){var _0x20a4b4=encryptor[_0x199e('0x69')](_0x1c54f9)[_0x199e('0x6a')](',');for(var _0x1e95c3=0x0;_0x1e95c3<_0x455887;_0x1e95c3++){if(!_0x20a4b4[_0x1e95c3])break;if(_0x4f693e[_0x199e('0x6b')]()===_0x20a4b4[_0x1e95c3][_0x199e('0x6b')]()){var _0x3bb58=util['format'](_0x199e('0x6c'),_0x455887);if(_0x455887===0x1){_0x3bb58=_0x199e('0x6d');}throw new db['Sequelize'][(_0x199e('0x68'))](_0x3bb58);}}return;};exports[_0x199e('0x6e')]=function(_0x122f52,_0x2b3c52){var _0x588a12=_0x2b3c52?encryptor[_0x199e('0x69')](_0x2b3c52)[_0x199e('0x6a')](','):[];if(_0x588a12[_0x199e('0x6f')]===0x5){_0x588a12[_0x199e('0x70')](-0x1,0x1);}_0x588a12[_0x199e('0x71')](_0x122f52);return encryptor[_0x199e('0x72')](_0x588a12['join'](','));};function signJwt(_0x2880cc){var _0x4abc78=BPromise['promisify'](jwt[_0x199e('0x73')],{'context':jwt});var _0x17801f=_0x2880cc[_0x199e('0x74')]||config[_0x199e('0xb')]['session'];return new BPromise(function(_0x1c0f9a,_0x26015c){_0x4abc78(_0x2880cc[_0x199e('0x75')],_0x17801f,_0x2880cc[_0x199e('0x76')])[_0x199e('0x30')](function(_0x159d0e){_0x1c0f9a(_0x159d0e);})[_0x199e('0x35')](function(_0x5b46c4){_0x26015c(_0x5b46c4);});});}function verifyJwt(_0x3789c9,_0x21c32f,_0x18d8d3){var _0x5e9536=BPromise['promisify'](jwt[_0x199e('0x77')],{'context':jwt});var _0x32ba36=_0x18d8d3||config[_0x199e('0xb')][_0x199e('0xc')];return new BPromise(function(_0x2d17e1,_0x14e4bf){_0x5e9536(_0x3789c9,_0x32ba36,_0x21c32f)['then'](function(_0x4dff28){_0x2d17e1(_0x4dff28);})[_0x199e('0x35')](function(_0x2e217a){_0x14e4bf(_0x2e217a);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x199e('0x78')](_0x199e('0x79'));}function generateIssuedAt(){return Math['floor'](Date[_0x199e('0x7a')]()/0x3e8)['toString']();}function createJwt(_0x4a1756){var _0x32742f={'payload':{'iat':_0x4a1756[_0x199e('0x61')],'nonce':_0x4a1756['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x4a1756['id'][_0x199e('0x78')](),'issuer':hardwareConf[_0x199e('0x45')](),'audience':hardwareConf[_0x199e('0x45')]()}};return signJwt(_0x32742f)[_0x199e('0x30')](function(_0x355638){return{'iat':_0x4a1756['apiKeyIat'],'nonce':_0x4a1756['apiKeyNonce'],'token':_0x355638};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 083c9d6..b73845b 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 _0xcb4b=['base64','decryptString','createDecipher','bluebird','../../config/environment','../../config/logger','app','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','binary','write','final','end','close','decryptFile','createWriteStream','unlink','encryptString','secret','update','utf8'];(function(_0x242ff2,_0x59bcda){var _0x2589e8=function(_0x14c147){while(--_0x14c147){_0x242ff2['push'](_0x242ff2['shift']());}};_0x2589e8(++_0x59bcda);}(_0xcb4b,0x179));var _0xbcb4=function(_0x2727c7,_0x222c63){_0x2727c7=_0x2727c7-0x0;var _0x332f48=_0xcb4b[_0x2727c7];return _0x332f48;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xbcb4('0x0'));var _=require('lodash');var config=require(_0xbcb4('0x1'));var logger=require(_0xbcb4('0x2'))(_0xbcb4('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xbcb4('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xbcb4('0x5')};if(config[_0xbcb4('0x6')]&&config[_0xbcb4('0x6')][_0xbcb4('0x7')]){var isSupported=isAlgorithmSupported(config[_0xbcb4('0x6')][_0xbcb4('0x7')]);if(isSupported){fileOptions[_0xbcb4('0x7')]=config[_0xbcb4('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xbcb4('0x8')](',\x20');logger[_0xbcb4('0x9')](config['encrypt']['algorithm'],_0xbcb4('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x279170){return AES_SUPPORTED_RX['test'](_0x279170);}function getSupportedCiphers(){return crypto[_0xbcb4('0xb')]()[_0xbcb4('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x3e1316){return getSupportedCiphers()[_0xbcb4('0xd')](_0x3e1316)>-0x1;}function combineOptions(_0x289d03){var _0x290fae={};for(var _0x41c6e1 in fileOptions){if(fileOptions['hasOwnProperty'](_0x41c6e1)){_0x290fae[_0x41c6e1]=fileOptions[_0x41c6e1];}}if(_0x289d03){for(var _0x321e21 in _0x289d03){if(_0x289d03[_0xbcb4('0xe')](_0x321e21)){_0x290fae[_0x321e21]=_0x289d03[_0x321e21];}}}return _0x290fae;}exports[_0xbcb4('0xf')]=function(_0x40ef1b,_0xa61b31,_0x39f13e,_0x125cdc){return new BPromise(function(_0x1fbe7b,_0x47a383){_0x125cdc=combineOptions(_0x125cdc);var _0x593211=new Buffer(_0x39f13e);var _0x1090cc=fs[_0xbcb4('0x10')](_0x40ef1b);var _0x3c5dbb=fs['createWriteStream'](_0xa61b31);var _0x360031=crypto[_0xbcb4('0x11')](_0x125cdc[_0xbcb4('0x7')],_0x593211);_0x1090cc['on'](_0xbcb4('0x12'),function(_0x4807d3){var _0xb86ab4=new Buffer(_0x360031['update'](_0x4807d3),_0xbcb4('0x13'));_0x3c5dbb[_0xbcb4('0x14')](_0xb86ab4);});_0x1090cc['on']('end',function(){try{var _0x1ceeb7=new Buffer(_0x360031[_0xbcb4('0x15')]('binary'),_0xbcb4('0x13'));_0x3c5dbb[_0xbcb4('0x14')](_0x1ceeb7);_0x3c5dbb[_0xbcb4('0x16')]();_0x3c5dbb['on'](_0xbcb4('0x17'),function(){return _0x1fbe7b(_0xa61b31);});}catch(_0x428ae1){fs['unlink'](_0xa61b31);return _0x47a383(_0x428ae1);}});});};exports[_0xbcb4('0x18')]=function(_0x9a20d8,_0x149709,_0x29a7d5,_0x5f11da){return new BPromise(function(_0x484546,_0xf92bf3){_0x5f11da=combineOptions(_0x5f11da);var _0x7f615d=new Buffer(_0x29a7d5);var _0x35f8ae=fs[_0xbcb4('0x10')](_0x9a20d8);var _0x2e4766=fs[_0xbcb4('0x19')](_0x149709);var _0x3d756f=crypto['createDecipher'](_0x5f11da[_0xbcb4('0x7')],_0x7f615d);_0x35f8ae['on'](_0xbcb4('0x12'),function(_0x2a37cf){var _0x198817=new Buffer(_0x3d756f['update'](_0x2a37cf),'binary');_0x2e4766[_0xbcb4('0x14')](_0x198817);});_0x35f8ae['on'](_0xbcb4('0x16'),function(){try{var _0x14e2ce=new Buffer(_0x3d756f[_0xbcb4('0x15')](_0xbcb4('0x13')),_0xbcb4('0x13'));_0x2e4766['write'](_0x14e2ce);_0x2e4766[_0xbcb4('0x16')]();_0x2e4766['on'](_0xbcb4('0x17'),function(){return _0x484546(_0x149709);});}catch(_0xbbda1a){fs[_0xbcb4('0x1a')](_0x149709);return _0xf92bf3(_0xbbda1a);}});});};exports[_0xbcb4('0x1b')]=function(_0x4f29ef,_0x177c0d,_0x2860b4){var _0x5db6fe=_0x2860b4||stringOptions[_0xbcb4('0x7')];var _0x4a0597=_0x177c0d||stringOptions[_0xbcb4('0x1c')];var _0x4d9382=crypto['createCipher'](_0x5db6fe,_0x4a0597);var _0x358bda=_0x4d9382[_0xbcb4('0x1d')](_0x4f29ef,_0xbcb4('0x1e'),_0xbcb4('0x1f'));_0x358bda+=_0x4d9382[_0xbcb4('0x15')]('base64');return _0x358bda;};exports[_0xbcb4('0x20')]=function(_0x14376f,_0x12c4ef,_0x49ab09){var _0x11a8dc=_0x49ab09||stringOptions[_0xbcb4('0x7')];var _0x568bc7=_0x12c4ef||stringOptions[_0xbcb4('0x1c')];var _0x4d20d6=crypto[_0xbcb4('0x21')](_0x11a8dc,_0x568bc7);var _0x42b3f5=_0x4d20d6[_0xbcb4('0x1d')](_0x14376f,'base64',_0xbcb4('0x1e'));_0x42b3f5+=_0x4d20d6[_0xbcb4('0x15')](_0xbcb4('0x1e'));return _0x42b3f5;}; \ No newline at end of file +var _0xfbb4=['error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createCipher','update','binary','write','end','final','unlink','createWriteStream','createDecipher','data','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join'];(function(_0x3d3b05,_0x334c57){var _0x2c6ca3=function(_0x3fd1cc){while(--_0x3fd1cc){_0x3d3b05['push'](_0x3d3b05['shift']());}};_0x2c6ca3(++_0x334c57);}(_0xfbb4,0x16b));var _0x4fbb=function(_0x58486a,_0x12fbd7){_0x58486a=_0x58486a-0x0;var _0x426bf0=_0xfbb4[_0x58486a];return _0x426bf0;};'use strict';var crypto=require(_0x4fbb('0x0'));var fs=require('fs');var BPromise=require(_0x4fbb('0x1'));var _=require(_0x4fbb('0x2'));var config=require('../../config/environment');var logger=require(_0x4fbb('0x3'))(_0x4fbb('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4fbb('0x5')]['session'],'algorithm':_0x4fbb('0x6')};const fileOptions={'algorithm':_0x4fbb('0x7')};if(config[_0x4fbb('0x8')]&&config[_0x4fbb('0x8')][_0x4fbb('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x4fbb('0x9')]);if(isSupported){fileOptions[_0x4fbb('0x9')]=config[_0x4fbb('0x8')][_0x4fbb('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4fbb('0xa')](',\x20');logger[_0x4fbb('0xb')](config[_0x4fbb('0x8')][_0x4fbb('0x9')],_0x4fbb('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x3099d0){return AES_SUPPORTED_RX[_0x4fbb('0xd')](_0x3099d0);}function getSupportedCiphers(){return crypto[_0x4fbb('0xe')]()[_0x4fbb('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x14f8c5){return getSupportedCiphers()['indexOf'](_0x14f8c5)>-0x1;}function combineOptions(_0x40182d){var _0x587f5b={};for(var _0x499259 in fileOptions){if(fileOptions[_0x4fbb('0x10')](_0x499259)){_0x587f5b[_0x499259]=fileOptions[_0x499259];}}if(_0x40182d){for(var _0x49d1df in _0x40182d){if(_0x40182d[_0x4fbb('0x10')](_0x49d1df)){_0x587f5b[_0x49d1df]=_0x40182d[_0x49d1df];}}}return _0x587f5b;}exports[_0x4fbb('0x11')]=function(_0x5a52b1,_0x594cef,_0x1be85a,_0x2fdb30){return new BPromise(function(_0x49a8a0,_0x511b43){_0x2fdb30=combineOptions(_0x2fdb30);var _0x97e874=new Buffer(_0x1be85a);var _0x59eb8d=fs[_0x4fbb('0x12')](_0x5a52b1);var _0x594f1f=fs['createWriteStream'](_0x594cef);var _0xca2f89=crypto[_0x4fbb('0x13')](_0x2fdb30[_0x4fbb('0x9')],_0x97e874);_0x59eb8d['on']('data',function(_0x2e593d){var _0x4a4bd7=new Buffer(_0xca2f89[_0x4fbb('0x14')](_0x2e593d),_0x4fbb('0x15'));_0x594f1f[_0x4fbb('0x16')](_0x4a4bd7);});_0x59eb8d['on'](_0x4fbb('0x17'),function(){try{var _0x15ddd8=new Buffer(_0xca2f89[_0x4fbb('0x18')]('binary'),_0x4fbb('0x15'));_0x594f1f[_0x4fbb('0x16')](_0x15ddd8);_0x594f1f[_0x4fbb('0x17')]();_0x594f1f['on']('close',function(){return _0x49a8a0(_0x594cef);});}catch(_0x119c22){fs[_0x4fbb('0x19')](_0x594cef);return _0x511b43(_0x119c22);}});});};exports['decryptFile']=function(_0x51c198,_0xc79982,_0x5abe51,_0x2a4098){return new BPromise(function(_0x3aec8f,_0xd2770b){_0x2a4098=combineOptions(_0x2a4098);var _0x40e0c1=new Buffer(_0x5abe51);var _0x14429e=fs['createReadStream'](_0x51c198);var _0x3abfe6=fs[_0x4fbb('0x1a')](_0xc79982);var _0x804c43=crypto[_0x4fbb('0x1b')](_0x2a4098[_0x4fbb('0x9')],_0x40e0c1);_0x14429e['on'](_0x4fbb('0x1c'),function(_0x57ddfb){var _0x585241=new Buffer(_0x804c43[_0x4fbb('0x14')](_0x57ddfb),_0x4fbb('0x15'));_0x3abfe6[_0x4fbb('0x16')](_0x585241);});_0x14429e['on'](_0x4fbb('0x17'),function(){try{var _0x4125cd=new Buffer(_0x804c43[_0x4fbb('0x18')]('binary'),_0x4fbb('0x15'));_0x3abfe6[_0x4fbb('0x16')](_0x4125cd);_0x3abfe6[_0x4fbb('0x17')]();_0x3abfe6['on']('close',function(){return _0x3aec8f(_0xc79982);});}catch(_0x399f08){fs[_0x4fbb('0x19')](_0xc79982);return _0xd2770b(_0x399f08);}});});};exports[_0x4fbb('0x1d')]=function(_0x34ba05,_0xe9b066,_0x39bd11){var _0x424a48=_0x39bd11||stringOptions[_0x4fbb('0x9')];var _0x2f3fc7=_0xe9b066||stringOptions[_0x4fbb('0x1e')];var _0x3a17fa=crypto[_0x4fbb('0x13')](_0x424a48,_0x2f3fc7);var _0x29d976=_0x3a17fa[_0x4fbb('0x14')](_0x34ba05,_0x4fbb('0x1f'),_0x4fbb('0x20'));_0x29d976+=_0x3a17fa[_0x4fbb('0x18')](_0x4fbb('0x20'));return _0x29d976;};exports[_0x4fbb('0x21')]=function(_0x4f5508,_0x11e03d,_0x4277da){var _0x3184f1=_0x4277da||stringOptions[_0x4fbb('0x9')];var _0x5b95e9=_0x11e03d||stringOptions['secret'];var _0x2a4fc1=crypto['createDecipher'](_0x3184f1,_0x5b95e9);var _0x3d548e=_0x2a4fc1[_0x4fbb('0x14')](_0x4f5508,'base64',_0x4fbb('0x1f'));_0x3d548e+=_0x2a4fc1[_0x4fbb('0x18')](_0x4fbb('0x1f'));return _0x3d548e;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0d75dae..f3fa808 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 _0xb6dc=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','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','Failed','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query'];(function(_0x4bb5f1,_0x4d2c44){var _0x50ccd9=function(_0x401ad7){while(--_0x401ad7){_0x4bb5f1['push'](_0x4bb5f1['shift']());}};_0x50ccd9(++_0x4d2c44);}(_0xb6dc,0x164));var _0xcb6d=function(_0x3ca9cf,_0x3ba67d){_0x3ca9cf=_0x3ca9cf-0x0;var _0xe137d2=_0xb6dc[_0x3ca9cf];return _0xe137d2;};'use strict';var util=require('util');var path=require(_0xcb6d('0x0'));var _=require(_0xcb6d('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xcb6d('0x2'));var zipdir=require(_0xcb6d('0x3'));var rimraf=require(_0xcb6d('0x4'));var db=require(_0xcb6d('0x5'))['db'];var dbH=require(_0xcb6d('0x5'))['dbH'];var logger=require('../../config/logger')(_0xcb6d('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xcb6d('0x7')][0x2]);var QUERY=process[_0xcb6d('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x6d00aa,_0x538af4){var _0x459017={'status':_0x6d00aa};var _0x284ab6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x538af4){_0x459017['savename']=_0x538af4;}return db[_0xcb6d('0x8')][_0xcb6d('0x9')](_0x459017,_0x284ab6);}function main(){var _0x5bfefb=0x1388;var _0x4db993;logger[_0xcb6d('0xa')](util[_0xcb6d('0xb')](_0xcb6d('0xc'),EXTRACTED_REPORT_ID,_0xcb6d('0xd')));return db[_0xcb6d('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcb6d('0xf'),_0xcb6d('0x10')]})[_0xcb6d('0x11')](function(_0x1203f2){if(_0x1203f2){_0x4db993=_0x1203f2;_0x5bfefb=_0x4db993['splitSizeCsv']||0x1388;}})[_0xcb6d('0x11')](function(){return dbH[_0xcb6d('0x12')][_0xcb6d('0x13')](util[_0xcb6d('0xb')](_0xcb6d('0x14'),QUERY),{'type':dbH[_0xcb6d('0x12')][_0xcb6d('0x15')][_0xcb6d('0x16')]});})[_0xcb6d('0x11')](function(_0xebc035){if(!_0xebc035[0x0][_0xcb6d('0x17')]){return analyticExtractedReport(_0xcb6d('0x18'));}var _0x388ab1=[];var _0x110a3f=0x0;if(_0x4db993[_0xcb6d('0xf')]){if(_0xebc035&&_0xebc035['length']){var _0x4c7e69=_[_0xcb6d('0x19')](_0xebc035[0x0][_0xcb6d('0x17')]/_0x5bfefb);var _0x1c0353=Number['isInteger'](_0xebc035[0x0][_0xcb6d('0x17')]/_0x5bfefb)?_0xebc035[0x0][_0xcb6d('0x17')]%_0x5bfefb:0x0;_0x4c7e69[_0xcb6d('0x1a')](function(_0xada338){if(_0xada338>0x0){_0x110a3f+=_0x5bfefb;}_0x388ab1['push'](dbH[_0xcb6d('0x12')]['query'](util[_0xcb6d('0xb')](_0xcb6d('0x1b'),QUERY,_0x5bfefb,_0x110a3f),{'type':dbH[_0xcb6d('0x12')][_0xcb6d('0x15')][_0xcb6d('0x16')]}));});if(_0x1c0353>0x0){_0x110a3f+=_0x5bfefb;_0x388ab1[_0xcb6d('0x1c')](dbH['sequelize'][_0xcb6d('0x13')](util[_0xcb6d('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1c0353,_0x110a3f),{'type':dbH[_0xcb6d('0x12')]['QueryTypes'][_0xcb6d('0x16')]}));}}}else{_0x388ab1[_0xcb6d('0x1c')](dbH[_0xcb6d('0x12')][_0xcb6d('0x13')](QUERY,{'type':dbH[_0xcb6d('0x12')][_0xcb6d('0x15')]['SELECT']}));}var _0x2423cb=path[_0xcb6d('0x1d')](PATH);var _0x1640d9=path[_0xcb6d('0x1e')](PATH,_0xcb6d('0x1f'));var _0x5837b3=_0x4db993[_0xcb6d('0xf')]&&_0x388ab1[_0xcb6d('0x20')]>0x1;var _0x23bde9=[];if(!fs[_0xcb6d('0x21')](path[_0xcb6d('0x22')](_0x2423cb,_0x1640d9))&&_0x5837b3){fs[_0xcb6d('0x23')](path[_0xcb6d('0x22')](_0x2423cb,_0x1640d9));}return BPromise[_0xcb6d('0x24')](_0x388ab1,function(_0x57ec82){_0x23bde9[_0xcb6d('0x1c')](_0x57ec82);})['then'](function(){for(var _0xb3150b=0x0;_0xb3150b<_0x23bde9[_0xcb6d('0x20')];_0xb3150b+=0x1){var _0x33adbe;var _0x35a5bc=_0x23bde9[_0xb3150b];if(_0x5837b3){_0x33adbe=path[_0xcb6d('0x22')](_0x2423cb,_0x1640d9,util[_0xcb6d('0xb')](_0xcb6d('0x25'),_0x1640d9,_0xb3150b,_0xcb6d('0x26')));}else{_0x33adbe=path[_0xcb6d('0x22')](_0x2423cb,util['format'](_0xcb6d('0x27'),_0x1640d9,_0xcb6d('0x26')));}fs['writeFileSync'](_0x33adbe,csv(_0x35a5bc));}})[_0xcb6d('0x11')](function(){if(_0x5837b3){return new Promise(function(_0x58b843){zipdir(path['join'](_0x2423cb,_0x1640d9),{'saveTo':path[_0xcb6d('0x22')](_0x2423cb,util['format']('%s.%s',_0x1640d9,_0xcb6d('0x28')))},function(_0x43451a,_0x32976f){rimraf(path['join'](_0x2423cb,_0x1640d9),function(){});_0x58b843('zip\x20finished');});});}})[_0xcb6d('0x11')](function(){logger[_0xcb6d('0xa')](util[_0xcb6d('0xb')](_0xcb6d('0x29'),EXTRACTED_REPORT_ID,_0xcb6d('0xd')));return analyticExtractedReport(_0xcb6d('0x2a'),_0x5837b3?util['format'](_0xcb6d('0x27'),_0x1640d9,_0x5837b3?_0xcb6d('0x28'):_0xcb6d('0x26')):null);});})[_0xcb6d('0x2b')](function(_0x2cc0a0){logger[_0xcb6d('0xa')](util[_0xcb6d('0xb')](_0xcb6d('0x2c'),EXTRACTED_REPORT_ID,_0xcb6d('0xd')),util[_0xcb6d('0x2d')](_0x2cc0a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcb6d('0x2e'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd9de=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','to-csv','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','then','Empty','split','range','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','length','join','mkdirSync','each','%s%d.%s','csv','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xd9de,0x126));var _0xed9d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd9de[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0xed9d('0x0'));var path=require(_0xed9d('0x1'));var _=require('lodash');var csv=require(_0xed9d('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xed9d('0x3'));var rimraf=require(_0xed9d('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xed9d('0x5')];var logger=require(_0xed9d('0x6'))(_0xed9d('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xed9d('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xed9d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1ed079,_0x695b9a){var _0x16410b={'status':_0x1ed079};var _0x3c7865={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x695b9a){_0x16410b[_0xed9d('0x9')]=_0x695b9a;}return db['AnalyticExtractedReport'][_0xed9d('0xa')](_0x16410b,_0x3c7865);}function main(){var _0x5b6439=0x1388;var _0x4dd6d5;logger[_0xed9d('0xb')](util[_0xed9d('0xc')](_0xed9d('0xd'),EXTRACTED_REPORT_ID,_0xed9d('0xe')));return db[_0xed9d('0xf')][_0xed9d('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xed9d('0x11')]})['then'](function(_0x14b0c6){if(_0x14b0c6){_0x4dd6d5=_0x14b0c6;_0x5b6439=_0x4dd6d5[_0xed9d('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xed9d('0x12')](util[_0xed9d('0xc')](_0xed9d('0x13'),QUERY),{'type':dbH[_0xed9d('0x14')][_0xed9d('0x15')][_0xed9d('0x16')]});})[_0xed9d('0x17')](function(_0x5051e2){if(!_0x5051e2[0x0]['num']){return analyticExtractedReport(_0xed9d('0x18'));}var _0x4f68d6=[];var _0x35ac06=0x0;if(_0x4dd6d5[_0xed9d('0x19')]){if(_0x5051e2&&_0x5051e2['length']){var _0x5d8be2=_[_0xed9d('0x1a')](_0x5051e2[0x0][_0xed9d('0x1b')]/_0x5b6439);var _0x51122c=Number['isInteger'](_0x5051e2[0x0][_0xed9d('0x1b')]/_0x5b6439)?_0x5051e2[0x0][_0xed9d('0x1b')]%_0x5b6439:0x0;_0x5d8be2['forEach'](function(_0x49405f){if(_0x49405f>0x0){_0x35ac06+=_0x5b6439;}_0x4f68d6[_0xed9d('0x1c')](dbH[_0xed9d('0x14')]['query'](util[_0xed9d('0xc')](_0xed9d('0x1d'),QUERY,_0x5b6439,_0x35ac06),{'type':dbH['sequelize']['QueryTypes'][_0xed9d('0x16')]}));});if(_0x51122c>0x0){_0x35ac06+=_0x5b6439;_0x4f68d6[_0xed9d('0x1c')](dbH[_0xed9d('0x14')][_0xed9d('0x12')](util['format'](_0xed9d('0x1d'),QUERY,_0x51122c,_0x35ac06),{'type':dbH[_0xed9d('0x14')][_0xed9d('0x15')][_0xed9d('0x16')]}));}}}else{_0x4f68d6['push'](dbH[_0xed9d('0x14')][_0xed9d('0x12')](QUERY,{'type':dbH[_0xed9d('0x14')][_0xed9d('0x15')]['SELECT']}));}var _0xb285dd=path['dirname'](PATH);var _0x1cdc8a=path[_0xed9d('0x1e')](PATH,_0xed9d('0x1f'));var _0x4eec32=_0x4dd6d5[_0xed9d('0x19')]&&_0x4f68d6[_0xed9d('0x20')]>0x1;var _0x5b25ac=[];if(!fs['existsSync'](path[_0xed9d('0x21')](_0xb285dd,_0x1cdc8a))&&_0x4eec32){fs[_0xed9d('0x22')](path['join'](_0xb285dd,_0x1cdc8a));}return BPromise[_0xed9d('0x23')](_0x4f68d6,function(_0x221454){_0x5b25ac[_0xed9d('0x1c')](_0x221454);})[_0xed9d('0x17')](function(){for(var _0x1b9d22=0x0;_0x1b9d22<_0x5b25ac[_0xed9d('0x20')];_0x1b9d22+=0x1){var _0x491420;var _0x324937=_0x5b25ac[_0x1b9d22];if(_0x4eec32){_0x491420=path[_0xed9d('0x21')](_0xb285dd,_0x1cdc8a,util[_0xed9d('0xc')](_0xed9d('0x24'),_0x1cdc8a,_0x1b9d22,_0xed9d('0x25')));}else{_0x491420=path[_0xed9d('0x21')](_0xb285dd,util['format']('%s.%s',_0x1cdc8a,'csv'));}fs['writeFileSync'](_0x491420,csv(_0x324937));}})[_0xed9d('0x17')](function(){if(_0x4eec32){return new Promise(function(_0x2e433d){zipdir(path[_0xed9d('0x21')](_0xb285dd,_0x1cdc8a),{'saveTo':path['join'](_0xb285dd,util[_0xed9d('0xc')]('%s.%s',_0x1cdc8a,_0xed9d('0x26')))},function(_0x4d6fdb,_0x412748){rimraf(path[_0xed9d('0x21')](_0xb285dd,_0x1cdc8a),function(){});_0x2e433d('zip\x20finished');});});}})[_0xed9d('0x17')](function(){logger['info'](util[_0xed9d('0xc')](_0xed9d('0x27'),EXTRACTED_REPORT_ID,_0xed9d('0xe')));return analyticExtractedReport(_0xed9d('0x28'),_0x4eec32?util[_0xed9d('0xc')](_0xed9d('0x29'),_0x1cdc8a,_0x4eec32?_0xed9d('0x26'):'csv'):null);});})[_0xed9d('0x2a')](function(_0x59c9b6){logger['info'](util['format'](_0xed9d('0x2b'),EXTRACTED_REPORT_ID,_0xed9d('0xe')),util[_0xed9d('0x2c')](_0x59c9b6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xed9d('0x2d'));})[_0xed9d('0x2e')](function(){process[_0xed9d('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d241699..bd8e0a1 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 _0x449d=['info','PDF','Completed','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','JSDOM','window','bluebird','../../mysqldb','dbH','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','fill','length','auto','body','push','concat','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','header','landscape','\x20/\x20','footer','Arial','num','Empty','Setting','splitSizePdf','then','split','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished'];(function(_0x3806e6,_0x2f55d1){var _0x43aea8=function(_0x3c9928){while(--_0x3c9928){_0x3806e6['push'](_0x3806e6['shift']());}};_0x43aea8(++_0x2f55d1);}(_0x449d,0x1ba));var _0xd449=function(_0x261832,_0x5a24e6){_0x261832=_0x261832-0x0;var _0x186143=_0x449d[_0x261832];return _0x186143;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xd449('0x0'));var path=require(_0xd449('0x1'));var moment=require(_0xd449('0x2'));var htmlToPdfmake=require(_0xd449('0x3'));var PdfPrinter=require(_0xd449('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xd449('0x5'));var JSDOM=require('jsdom')[_0xd449('0x6')];var window=new JSDOM('')[_0xd449('0x7')];var BPromise=require(_0xd449('0x8'));var db=require(_0xd449('0x9'))['db'];var dbH=require(_0xd449('0x9'))[_0xd449('0xa')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xd449('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f28c6,_0x5bd838){var _0x12359c={'status':_0x1f28c6};var _0x38ad50={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5bd838){_0x12359c['savename']=_0x5bd838;}return db[_0xd449('0xc')][_0xd449('0xd')](_0x12359c,_0x38ad50);}function getHeaders(_0x2d244e){return _['map'](_0x2d244e,function(_0x272f27){return{'text':_0x272f27,'style':_0xd449('0xe')};});}function getRows(_0xbffe1c,_0x3516f9){return _[_0xd449('0xf')](_0x3516f9,function(_0x30e417){return _(_0x30e417)[_0xd449('0x10')](_0xbffe1c)[_0xd449('0xf')](function(_0x1c96af){return _0x1c96af?_[_0xd449('0x11')](_0x1c96af):'';})[_0xd449('0x12')]();});}function createTable(_0x2ae512,_0x421eee){var _0x323289={'widths':_[_0xd449('0x13')](Array(_0x2ae512[_0xd449('0x14')]),0x91),'heights':function(_0x4a0b20){return _0x4a0b20===0x0?_0xd449('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x11e73d=getHeaders(_0x2ae512);_0x323289[_0xd449('0x16')][_0xd449('0x17')](_0x11e73d);var _0x5e4256=getRows(_0x2ae512,_0x421eee);_0x323289['body']=_0x323289[_0xd449('0x16')][_0xd449('0x18')](_0x5e4256);return _0x323289;}function createTables(_0x5bc27c){var _0x1f9aa2=[];var _0x2684ad=_[_0xd449('0x19')](Object['keys'](_0x5bc27c[0x0]),0x5);_0x2684ad[_0xd449('0x1a')](function(_0x469293){_0x1f9aa2['push'](createTable(_0x469293,_0x5bc27c));});return _0x1f9aa2;}function getPDFDocDefinition(_0x177b45){var _0x5db349=util['format'](_0xd449('0x1b'),NAME,EXTRACTED_REPORT[_0xd449('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0xd449('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xd449('0x1d')](FORMAT));var _0x165a6a=[];for(var _0x552607=0x0;_0x552607<_0x177b45[_0xd449('0x14')];_0x552607++){var _0x4fbd5f=[];if(_0x552607===0x0){_0x4fbd5f['push']({'text':_0x5db349,'style':_0xd449('0x1e')});}var _0x452c8e={'table':_0x177b45[_0x552607]};if(_0x552607>0x0){_0x452c8e['pageBreak']='before';_0x452c8e['margin']=[0x0,0x46,0x0,0x0];}_0x4fbd5f[_0xd449('0x17')](_0x452c8e);_0x165a6a['push'](_0x4fbd5f);}return{'pageSize':'A4','pageOrientation':_0xd449('0x1f'),'content':_0x165a6a,'footer':function(_0x32b2ec,_0x3ed3ad){return{'text':_0x32b2ec[_0xd449('0x11')]()+_0xd449('0x20')+_0x3ed3ad,'style':_0xd449('0x21')};},'defaultStyle':{'font':_0xd449('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3de632){var _0x3f3d1d=0x1388;var _0x38cf26;if(!_0x3de632[0x0][_0xd449('0x23')]){return analyticExtractedReport(_0xd449('0x24'));}return db[_0xd449('0x25')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd449('0x26')]})[_0xd449('0x27')](function(_0x56611a){if(_0x56611a){_0x38cf26=_0x56611a;_0x3f3d1d=_0x38cf26['splitSizePdf']||0x3e8;}})[_0xd449('0x27')](function(){var _0x517f90=[];var _0x5db1e8=0x0;if(_0x38cf26[_0xd449('0x28')]){if(_0x3de632&&_0x3de632['length']){var _0x43b248=_['range'](_0x3de632[0x0]['num']/_0x3f3d1d);var _0x53bee8=Number[_0xd449('0x29')](_0x3de632[0x0][_0xd449('0x23')]/_0x3f3d1d)?_0x3de632[0x0][_0xd449('0x23')]%_0x3f3d1d:0x0;_0x43b248[_0xd449('0x1a')](function(_0x3e7142){if(_0x3e7142>0x0){_0x5db1e8+=_0x3f3d1d;}_0x517f90[_0xd449('0x17')](dbH[_0xd449('0x2a')][_0xd449('0x2b')](util['format'](_0xd449('0x2c'),QUERY,_0x3f3d1d,_0x5db1e8),{'type':dbH['sequelize'][_0xd449('0x2d')]['SELECT']}));});if(_0x53bee8>0x0){_0x5db1e8+=_0x3f3d1d;_0x517f90[_0xd449('0x17')](dbH[_0xd449('0x2a')]['query'](util[_0xd449('0x1d')](_0xd449('0x2c'),QUERY,_0x53bee8,_0x5db1e8),{'type':dbH[_0xd449('0x2a')][_0xd449('0x2d')][_0xd449('0x2e')]}));}}}else{_0x517f90[_0xd449('0x17')](dbH['sequelize'][_0xd449('0x2b')](QUERY,{'type':dbH['sequelize'][_0xd449('0x2d')]['SELECT']}));}var _0x723c43=path[_0xd449('0x2f')](PATH);var _0xbdf967=path[_0xd449('0x30')](PATH,_0xd449('0x31'));var _0x2d0f4f=_0x38cf26['split']&&_0x517f90[_0xd449('0x14')]>0x1;var _0x30be14=[];if(!fs[_0xd449('0x32')](path['join'](_0x723c43,_0xbdf967))&&_0x2d0f4f){fs[_0xd449('0x33')](path[_0xd449('0x34')](_0x723c43,_0xbdf967));}return BPromise[_0xd449('0x35')](_0x517f90,function(_0x49111c){_0x30be14['push'](_0x49111c);})['then'](function(){var _0x49bdb8=[];for(var _0x7298ed=0x0;_0x7298ed<_0x30be14[_0xd449('0x14')];_0x7298ed+=0x1){var _0x165bd5=_0x30be14[_0x7298ed];var _0x3dddd5=createTables(_[_0xd449('0x36')](_0x165bd5));var _0x1cbc62;var _0x4a7806=getPDFDocDefinition(_0x3dddd5);var _0x35601b=getPDFPrinter();var _0x3ebabc=_0x35601b[_0xd449('0x37')](_0x4a7806);if(_0x2d0f4f){_0x1cbc62=path[_0xd449('0x34')](_0x723c43,_0xbdf967,util[_0xd449('0x1d')](_0xd449('0x38'),_0xbdf967,_0x7298ed,'pdf'));}else{_0x1cbc62=path[_0xd449('0x34')](_0x723c43,util['format'](_0xd449('0x39'),_0xbdf967,_0xd449('0x3a')));}_0x49bdb8['push'](writePDFDocument(_0x3ebabc,_0x1cbc62));}return Promise[_0xd449('0x3b')](_0x49bdb8);})[_0xd449('0x27')](function(){if(_0x2d0f4f){return new Promise(function(_0x54c2aa){zipdir(path[_0xd449('0x34')](_0x723c43,_0xbdf967),{'saveTo':path[_0xd449('0x34')](_0x723c43,util['format'](_0xd449('0x39'),_0xbdf967,_0xd449('0x3c')))},function(){rimraf(path[_0xd449('0x34')](_0x723c43,_0xbdf967),function(){});_0x54c2aa(_0xd449('0x3d'));});});}})[_0xd449('0x27')](function(){if(!_0x2d0f4f)return;rimraf(path[_0xd449('0x34')](_0x723c43,_0xbdf967),function(){});})[_0xd449('0x27')](function(){logger[_0xd449('0x3e')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xd449('0x3f')));return analyticExtractedReport(_0xd449('0x40'),_0x2d0f4f?util[_0xd449('0x1d')](_0xd449('0x39'),_0xbdf967,_0x2d0f4f?_0xd449('0x3c'):_0xd449('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd449('0x3e')](util[_0xd449('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd449('0x27')](function(_0x49c122){EXTRACTED_REPORT=_0x49c122;return dbH[_0xd449('0x2a')][_0xd449('0x2b')](util['format'](_0xd449('0x41'),QUERY),{'type':dbH[_0xd449('0x2a')]['QueryTypes'][_0xd449('0x2e')]});})[_0xd449('0x27')](extractReport)[_0xd449('0x42')](function(_0x3a5212){logger[_0xd449('0x3e')](util['format'](_0xd449('0x43'),EXTRACTED_REPORT_ID,_0xd449('0x3f')),util['inspect'](_0x3a5212,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd449('0x44')](function(){process[_0xd449('0x45')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x93c53f=new PdfPrinter({'Arial':{'normal':__dirname+_0xd449('0x46'),'bold':__dirname+_0xd449('0x47'),'italics':__dirname+_0xd449('0x48'),'bolditalics':__dirname+_0xd449('0x49')}});return _0x93c53f;}function getPDFDocDefinitionFromHTML(_0x1d5411,_0x2034a2){var _0x5a6c6a=util[_0xd449('0x1d')](_0xd449('0x4a'),_0x2034a2[_0xd449('0x4b')],_0x2034a2[_0xd449('0x4c')]);var _0x2e2d05=moment()['format'](_0xd449('0x4d'))['toString']();var _0x1a30a5=htmlToPdfmake(_0x1d5411,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1a30a5],'defaultStyle':{'font':_0xd449('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd449('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xd449('0x4f'),'style':_0xd449('0x1e')}];},'footer':function(_0x3b5353,_0x3d427f){return[{'text':util[_0xd449('0x1d')](_0xd449('0x50'),_0x5a6c6a,_0x3b5353,_0x3d427f,_0x2e2d05),'style':'footer'}];}};}function writePDFDocument(_0x3fb044,_0x819eb0){return new Promise(function(_0x2e8d99,_0x2b99b2){var _0x3c976f=_0x3fb044[_0xd449('0x51')](fs['createWriteStream'](_0x819eb0));_0x3c976f['on'](_0xd449('0x52'),function(){_0x2e8d99(_0xd449('0x52'));});_0x3c976f['on'](_0xd449('0x53'),function(_0x408ce6){_0x2b99b2(_0x408ce6);});_0x3fb044['end']();});}exports['createPdfFromHTML']=function(_0x49ae6a,_0x5c5cdd){var _0x1fcba5=getPDFPrinter();var _0x5c86ba=getPDFDocDefinitionFromHTML(_0x49ae6a,_0x5c5cdd);var _0xac6e65=_0x1fcba5[_0xd449('0x37')](_0x5c86ba);return writePDFDocument(_0xac6e65,_0x5c5cdd[_0xd449('0x1')])[_0xd449('0x42')](function(_0x46f7a2){throw _0x46f7a2;});}; \ No newline at end of file +var _0xac5f=['/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','lodash','path','moment','html-to-pdfmake','zip-dir','jsdom','window','bluebird','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','pick','value','fill','auto','body','push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','pageBreak','margin','landscape','toString','footer','Arial','right','Empty','find','split','splitSizePdf','then','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','/fonts/arial-bold.ttf'];(function(_0x518ccc,_0x283328){var _0x1b4e2e=function(_0x3c0a70){while(--_0x3c0a70){_0x518ccc['push'](_0x518ccc['shift']());}};_0x1b4e2e(++_0x283328);}(_0xac5f,0x103));var _0xfac5=function(_0xcc2acb,_0x33f0dd){_0xcc2acb=_0xcc2acb-0x0;var _0x1908d0=_0xac5f[_0xcc2acb];return _0x1908d0;};'use strict';var _=require(_0xfac5('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xfac5('0x1'));var moment=require(_0xfac5('0x2'));var htmlToPdfmake=require(_0xfac5('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xfac5('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0xfac5('0x5'))['JSDOM'];var window=new JSDOM('')[_0xfac5('0x6')];var BPromise=require(_0xfac5('0x7'));var db=require(_0xfac5('0x8'))['db'];var dbH=require(_0xfac5('0x8'))[_0xfac5('0x9')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xfac5('0xa')][0x2]);var QUERY=process[_0xfac5('0xa')][0x3];var PATH=process[_0xfac5('0xa')][0x4];var NAME=process[_0xfac5('0xa')][0x5];var FORMAT=_0xfac5('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x220ed9,_0x250d9e){var _0xbbc6={'status':_0x220ed9};var _0x2d6f2c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x250d9e){_0xbbc6['savename']=_0x250d9e;}return db[_0xfac5('0xc')][_0xfac5('0xd')](_0xbbc6,_0x2d6f2c);}function getHeaders(_0x162045){return _[_0xfac5('0xe')](_0x162045,function(_0x3dd7d9){return{'text':_0x3dd7d9,'style':'tableHeader'};});}function getRows(_0x278dd2,_0x4f5db7){return _[_0xfac5('0xe')](_0x4f5db7,function(_0x215393){return _(_0x215393)[_0xfac5('0xf')](_0x278dd2)[_0xfac5('0xe')](function(_0x13c23d){return _0x13c23d?_['toString'](_0x13c23d):'';})[_0xfac5('0x10')]();});}function createTable(_0x24808f,_0x27b8ce){var _0x3c2ff8={'widths':_[_0xfac5('0x11')](Array(_0x24808f['length']),0x91),'heights':function(_0x59066c){return _0x59066c===0x0?_0xfac5('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2400d3=getHeaders(_0x24808f);_0x3c2ff8[_0xfac5('0x13')][_0xfac5('0x14')](_0x2400d3);var _0xfbe5d7=getRows(_0x24808f,_0x27b8ce);_0x3c2ff8[_0xfac5('0x13')]=_0x3c2ff8[_0xfac5('0x13')][_0xfac5('0x15')](_0xfbe5d7);return _0x3c2ff8;}function createTables(_0x2d367c){var _0x1931ea=[];var _0x5372e7=_[_0xfac5('0x16')](Object['keys'](_0x2d367c[0x0]),0x5);_0x5372e7[_0xfac5('0x17')](function(_0x5e63fd){_0x1931ea[_0xfac5('0x14')](createTable(_0x5e63fd,_0x2d367c));});return _0x1931ea;}function getPDFDocDefinition(_0x5cd074){var _0x30fd4e=util[_0xfac5('0x18')](_0xfac5('0x19'),NAME,EXTRACTED_REPORT[_0xfac5('0x1a')],moment(EXTRACTED_REPORT[_0xfac5('0x1b')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xfac5('0x1c')])['format'](FORMAT));var _0x2f851a=[];for(var _0x2ae15b=0x0;_0x2ae15b<_0x5cd074[_0xfac5('0x1d')];_0x2ae15b++){var _0x48b8ce=[];if(_0x2ae15b===0x0){_0x48b8ce['push']({'text':_0x30fd4e,'style':_0xfac5('0x1e')});}var _0x4064a0={'table':_0x5cd074[_0x2ae15b]};if(_0x2ae15b>0x0){_0x4064a0[_0xfac5('0x1f')]='before';_0x4064a0[_0xfac5('0x20')]=[0x0,0x46,0x0,0x0];}_0x48b8ce[_0xfac5('0x14')](_0x4064a0);_0x2f851a[_0xfac5('0x14')](_0x48b8ce);}return{'pageSize':'A4','pageOrientation':_0xfac5('0x21'),'content':_0x2f851a,'footer':function(_0x25dcab,_0x227e85){return{'text':_0x25dcab[_0xfac5('0x22')]()+'\x20/\x20'+_0x227e85,'style':_0xfac5('0x23')};},'defaultStyle':{'font':_0xfac5('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xfac5('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x38af93){var _0x3e2bdf=0x1388;var _0x791ce3;if(!_0x38af93[0x0]['num']){return analyticExtractedReport(_0xfac5('0x26'));}return db['Setting'][_0xfac5('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfac5('0x28'),_0xfac5('0x29')]})['then'](function(_0x12ed67){if(_0x12ed67){_0x791ce3=_0x12ed67;_0x3e2bdf=_0x791ce3[_0xfac5('0x29')]||0x3e8;}})[_0xfac5('0x2a')](function(){var _0x3df310=[];var _0x4b2859=0x0;if(_0x791ce3[_0xfac5('0x28')]){if(_0x38af93&&_0x38af93['length']){var _0x2a2a5e=_['range'](_0x38af93[0x0]['num']/_0x3e2bdf);var _0x5c2722=Number['isInteger'](_0x38af93[0x0][_0xfac5('0x2b')]/_0x3e2bdf)?_0x38af93[0x0][_0xfac5('0x2b')]%_0x3e2bdf:0x0;_0x2a2a5e['forEach'](function(_0x5901b7){if(_0x5901b7>0x0){_0x4b2859+=_0x3e2bdf;}_0x3df310['push'](dbH['sequelize'][_0xfac5('0x2c')](util['format'](_0xfac5('0x2d'),QUERY,_0x3e2bdf,_0x4b2859),{'type':dbH[_0xfac5('0x2e')][_0xfac5('0x2f')]['SELECT']}));});if(_0x5c2722>0x0){_0x4b2859+=_0x3e2bdf;_0x3df310['push'](dbH[_0xfac5('0x2e')]['query'](util[_0xfac5('0x18')](_0xfac5('0x2d'),QUERY,_0x5c2722,_0x4b2859),{'type':dbH[_0xfac5('0x2e')][_0xfac5('0x2f')][_0xfac5('0x30')]}));}}}else{_0x3df310[_0xfac5('0x14')](dbH['sequelize'][_0xfac5('0x2c')](QUERY,{'type':dbH['sequelize'][_0xfac5('0x2f')][_0xfac5('0x30')]}));}var _0x157c3d=path[_0xfac5('0x31')](PATH);var _0x3d1863=path[_0xfac5('0x32')](PATH,_0xfac5('0x33'));var _0x1dd13b=_0x791ce3[_0xfac5('0x28')]&&_0x3df310['length']>0x1;var _0x5cc48c=[];if(!fs[_0xfac5('0x34')](path[_0xfac5('0x35')](_0x157c3d,_0x3d1863))&&_0x1dd13b){fs[_0xfac5('0x36')](path[_0xfac5('0x35')](_0x157c3d,_0x3d1863));}return BPromise['each'](_0x3df310,function(_0x2b78b6){_0x5cc48c[_0xfac5('0x14')](_0x2b78b6);})[_0xfac5('0x2a')](function(){var _0x5f16fa=[];for(var _0x4cf5da=0x0;_0x4cf5da<_0x5cc48c[_0xfac5('0x1d')];_0x4cf5da+=0x1){var _0x1705f1=_0x5cc48c[_0x4cf5da];var _0x3e7f8c=createTables(_[_0xfac5('0x37')](_0x1705f1));var _0x1234c6;var _0x298854=getPDFDocDefinition(_0x3e7f8c);var _0x4e7869=getPDFPrinter();var _0x15b6d1=_0x4e7869[_0xfac5('0x38')](_0x298854);if(_0x1dd13b){_0x1234c6=path[_0xfac5('0x35')](_0x157c3d,_0x3d1863,util[_0xfac5('0x18')](_0xfac5('0x39'),_0x3d1863,_0x4cf5da,_0xfac5('0x3a')));}else{_0x1234c6=path[_0xfac5('0x35')](_0x157c3d,util[_0xfac5('0x18')](_0xfac5('0x3b'),_0x3d1863,_0xfac5('0x3a')));}_0x5f16fa[_0xfac5('0x14')](writePDFDocument(_0x15b6d1,_0x1234c6));}return Promise[_0xfac5('0x3c')](_0x5f16fa);})['then'](function(){if(_0x1dd13b){return new Promise(function(_0x3e3b7b){zipdir(path[_0xfac5('0x35')](_0x157c3d,_0x3d1863),{'saveTo':path['join'](_0x157c3d,util[_0xfac5('0x18')](_0xfac5('0x3b'),_0x3d1863,_0xfac5('0x3d')))},function(){rimraf(path['join'](_0x157c3d,_0x3d1863),function(){});_0x3e3b7b('zip\x20finished');});});}})[_0xfac5('0x2a')](function(){if(!_0x1dd13b)return;rimraf(path[_0xfac5('0x35')](_0x157c3d,_0x3d1863),function(){});})['then'](function(){logger[_0xfac5('0x3e')](util[_0xfac5('0x18')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfac5('0x3f')));return analyticExtractedReport(_0xfac5('0x40'),_0x1dd13b?util[_0xfac5('0x18')](_0xfac5('0x3b'),_0x3d1863,_0x1dd13b?_0xfac5('0x3d'):_0xfac5('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xfac5('0x3e')](util[_0xfac5('0x18')](_0xfac5('0x41'),EXTRACTED_REPORT_ID,_0xfac5('0x3f')));return db[_0xfac5('0xc')][_0xfac5('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xfac5('0x2a')](function(_0x3ff916){EXTRACTED_REPORT=_0x3ff916;return dbH[_0xfac5('0x2e')][_0xfac5('0x2c')](util[_0xfac5('0x18')](_0xfac5('0x43'),QUERY),{'type':dbH[_0xfac5('0x2e')][_0xfac5('0x2f')]['SELECT']});})[_0xfac5('0x2a')](extractReport)[_0xfac5('0x44')](function(_0xef2483){logger[_0xfac5('0x3e')](util[_0xfac5('0x18')](_0xfac5('0x45'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0xef2483,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xfac5('0x46')](function(){process[_0xfac5('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x19356a=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xfac5('0x48'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xfac5('0x49')}});return _0x19356a;}function getPDFDocDefinitionFromHTML(_0x437970,_0x54842d){var _0x421ffe=util[_0xfac5('0x18')](_0xfac5('0x4a'),_0x54842d[_0xfac5('0x4b')],_0x54842d[_0xfac5('0x4c')]);var _0x19411d=moment()[_0xfac5('0x18')](_0xfac5('0x4d'))[_0xfac5('0x22')]();var _0x4f18c8=htmlToPdfmake(_0x437970,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4f18c8],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xfac5('0x4e')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x44bc75,_0x4e5035){return[{'text':util[_0xfac5('0x18')](_0xfac5('0x4f'),_0x421ffe,_0x44bc75,_0x4e5035,_0x19411d),'style':_0xfac5('0x23')}];}};}function writePDFDocument(_0x1110d4,_0x302582){return new Promise(function(_0x3359a9,_0x4ef578){var _0x98ca8f=_0x1110d4['pipe'](fs['createWriteStream'](_0x302582));_0x98ca8f['on'](_0xfac5('0x50'),function(){_0x3359a9(_0xfac5('0x50'));});_0x98ca8f['on'](_0xfac5('0x51'),function(_0x59f135){_0x4ef578(_0x59f135);});_0x1110d4[_0xfac5('0x52')]();});}exports['createPdfFromHTML']=function(_0x4fdfc3,_0x36ef10){var _0x424888=getPDFPrinter();var _0x14e576=getPDFDocDefinitionFromHTML(_0x4fdfc3,_0x36ef10);var _0x368ff3=_0x424888[_0xfac5('0x38')](_0x14e576);return writePDFDocument(_0x368ff3,_0x36ef10[_0xfac5('0x1')])[_0xfac5('0x44')](function(_0x261731){throw _0x261731;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 77652e0..6e4fd93 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 _0x99b7=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','isInteger','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','Failed','finally','exit','util','path','json2xls','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','split','splitSizeXlsx','then','query','format'];(function(_0x19bad1,_0x527258){var _0x2f99ef=function(_0x1ac7db){while(--_0x1ac7db){_0x19bad1['push'](_0x19bad1['shift']());}};_0x2f99ef(++_0x527258);}(_0x99b7,0x1e8));var _0x799b=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x99b7[_0x172747];return _0x509692;};'use strict';var util=require(_0x799b('0x0'));var path=require(_0x799b('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x799b('0x2'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x799b('0x3'));var db=require(_0x799b('0x4'))['db'];var dbH=require('../../mysqldb')[_0x799b('0x5')];var logger=require(_0x799b('0x6'))(_0x799b('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x799b('0x8')][0x2]);var QUERY=process[_0x799b('0x8')][0x3];var PATH=process[_0x799b('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x14c80a,_0x38a484){var _0x410a70={'status':_0x14c80a};var _0x1938ce={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x38a484){_0x410a70[_0x799b('0x9')]=_0x38a484;}return db['AnalyticExtractedReport'][_0x799b('0xa')](_0x410a70,_0x1938ce);}function main(){var _0x41501d=0x1388;var _0x507f4e;logger['info'](util['format'](_0x799b('0xb'),EXTRACTED_REPORT_ID,_0x799b('0xc')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x799b('0xd'),_0x799b('0xe')]})[_0x799b('0xf')](function(_0x31e8e8){if(_0x31e8e8){_0x507f4e=_0x31e8e8;_0x41501d=_0x507f4e[_0x799b('0xe')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x799b('0x10')](util[_0x799b('0x11')](_0x799b('0x12'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x799b('0x13')]});})[_0x799b('0xf')](function(_0x174cfb){if(!_0x174cfb[0x0]['num']){return analyticExtractedReport(_0x799b('0x14'));}var _0x20fd98=[];var _0xdd900e=0x0;if(_0x507f4e['split']){if(_0x174cfb&&_0x174cfb[_0x799b('0x15')]){var _0xd0d95b=_['range'](_0x174cfb[0x0][_0x799b('0x16')]/_0x41501d);var _0x2ce987=Number[_0x799b('0x17')](_0x174cfb[0x0]['num']/_0x41501d)?_0x174cfb[0x0]['num']%_0x41501d:0x0;_0xd0d95b[_0x799b('0x18')](function(_0x2256b){if(_0x2256b>0x0){_0xdd900e+=_0x41501d;}_0x20fd98[_0x799b('0x19')](dbH[_0x799b('0x1a')]['query'](util['format'](_0x799b('0x1b'),QUERY,_0x41501d,_0xdd900e),{'type':dbH[_0x799b('0x1a')]['QueryTypes'][_0x799b('0x13')]}));});if(_0x2ce987>0x0){_0xdd900e+=_0x41501d;_0x20fd98[_0x799b('0x19')](dbH[_0x799b('0x1a')][_0x799b('0x10')](util['format'](_0x799b('0x1b'),QUERY,_0x2ce987,_0xdd900e),{'type':dbH[_0x799b('0x1a')]['QueryTypes'][_0x799b('0x13')]}));}}}else{_0x20fd98[_0x799b('0x19')](dbH[_0x799b('0x1a')][_0x799b('0x10')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x799b('0x13')]}));}var _0x221bbf=path['dirname'](PATH);var _0x517ea6=path['basename'](PATH,'.xlsx');var _0x3105d1=_0x507f4e[_0x799b('0xd')]&&_0x20fd98[_0x799b('0x15')]>0x1;var _0x523c06=[];if(!fs[_0x799b('0x1c')](path[_0x799b('0x1d')](_0x221bbf,_0x517ea6))&&_0x3105d1){fs[_0x799b('0x1e')](path[_0x799b('0x1d')](_0x221bbf,_0x517ea6));}return BPromise[_0x799b('0x1f')](_0x20fd98,function(_0x4a2c58){_0x523c06[_0x799b('0x19')](_0x4a2c58);})[_0x799b('0xf')](function(){for(var _0x467788=0x0;_0x467788<_0x523c06[_0x799b('0x15')];_0x467788+=0x1){var _0xe458cf;var _0x1b58bd=_0x523c06[_0x467788];if(_0x3105d1){_0xe458cf=path[_0x799b('0x1d')](_0x221bbf,_0x517ea6,util[_0x799b('0x11')](_0x799b('0x20'),_0x517ea6,_0x467788,_0x799b('0x21')));}else{_0xe458cf=path[_0x799b('0x1d')](_0x221bbf,util[_0x799b('0x11')](_0x799b('0x22'),_0x517ea6,_0x799b('0x21')));}fs[_0x799b('0x23')](_0xe458cf,json2xls(_0x1b58bd),_0x799b('0x24'));}})[_0x799b('0xf')](function(){if(_0x3105d1){return new Promise(function(_0x210c84){zipdir(path[_0x799b('0x1d')](_0x221bbf,_0x517ea6),{'saveTo':path[_0x799b('0x1d')](_0x221bbf,util[_0x799b('0x11')](_0x799b('0x22'),_0x517ea6,_0x799b('0x25')))},function(_0x554b55,_0x267375){rimraf(path[_0x799b('0x1d')](_0x221bbf,_0x517ea6),function(){});_0x210c84(_0x799b('0x26'));});});}})[_0x799b('0xf')](function(){logger[_0x799b('0x27')](util[_0x799b('0x11')](_0x799b('0x28'),EXTRACTED_REPORT_ID,_0x799b('0xc')));return analyticExtractedReport(_0x799b('0x29'),_0x3105d1?util[_0x799b('0x11')](_0x799b('0x22'),_0x517ea6,_0x3105d1?_0x799b('0x25'):'xlsx'):null);});})['catch'](function(_0x32ead7){logger[_0x799b('0x27')](util[_0x799b('0x11')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x799b('0xc')),util[_0x799b('0x2a')](_0x32ead7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x799b('0x2b'));})[_0x799b('0x2c')](function(){process[_0x799b('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3d2b=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','then','num','Empty','split','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','.xlsx','length','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x59e13f,_0x541f21){var _0xf7c360=function(_0x170c75){while(--_0x170c75){_0x59e13f['push'](_0x59e13f['shift']());}};_0xf7c360(++_0x541f21);}(_0x3d2b,0x129));var _0xb3d2=function(_0x12c425,_0x587f49){_0x12c425=_0x12c425-0x0;var _0x4bf48e=_0x3d2b[_0x12c425];return _0x4bf48e;};'use strict';var util=require(_0xb3d2('0x0'));var path=require(_0xb3d2('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xb3d2('0x2'));var BPromise=require(_0xb3d2('0x3'));var zipdir=require(_0xb3d2('0x4'));var rimraf=require(_0xb3d2('0x5'));var db=require(_0xb3d2('0x6'))['db'];var dbH=require(_0xb3d2('0x6'))[_0xb3d2('0x7')];var logger=require(_0xb3d2('0x8'))(_0xb3d2('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb3d2('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x262480,_0x2c4a9d){var _0xf17c80={'status':_0x262480};var _0x3d81d7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c4a9d){_0xf17c80[_0xb3d2('0xb')]=_0x2c4a9d;}return db[_0xb3d2('0xc')][_0xb3d2('0xd')](_0xf17c80,_0x3d81d7);}function main(){var _0x196cca=0x1388;var _0xa7c0dd;logger[_0xb3d2('0xe')](util[_0xb3d2('0xf')](_0xb3d2('0x10'),EXTRACTED_REPORT_ID,_0xb3d2('0x11')));return db[_0xb3d2('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb3d2('0x13')]})['then'](function(_0x45a743){if(_0x45a743){_0xa7c0dd=_0x45a743;_0x196cca=_0xa7c0dd[_0xb3d2('0x13')]||0x1388;}})['then'](function(){return dbH[_0xb3d2('0x14')][_0xb3d2('0x15')](util[_0xb3d2('0xf')](_0xb3d2('0x16'),QUERY),{'type':dbH[_0xb3d2('0x14')]['QueryTypes']['SELECT']});})[_0xb3d2('0x17')](function(_0x45fea4){if(!_0x45fea4[0x0][_0xb3d2('0x18')]){return analyticExtractedReport(_0xb3d2('0x19'));}var _0x1d319d=[];var _0x5ae0bb=0x0;if(_0xa7c0dd[_0xb3d2('0x1a')]){if(_0x45fea4&&_0x45fea4['length']){var _0x1a5bce=_[_0xb3d2('0x1b')](_0x45fea4[0x0][_0xb3d2('0x18')]/_0x196cca);var _0xecc189=Number[_0xb3d2('0x1c')](_0x45fea4[0x0]['num']/_0x196cca)?_0x45fea4[0x0][_0xb3d2('0x18')]%_0x196cca:0x0;_0x1a5bce[_0xb3d2('0x1d')](function(_0x23397e){if(_0x23397e>0x0){_0x5ae0bb+=_0x196cca;}_0x1d319d[_0xb3d2('0x1e')](dbH[_0xb3d2('0x14')][_0xb3d2('0x15')](util[_0xb3d2('0xf')](_0xb3d2('0x1f'),QUERY,_0x196cca,_0x5ae0bb),{'type':dbH['sequelize']['QueryTypes'][_0xb3d2('0x20')]}));});if(_0xecc189>0x0){_0x5ae0bb+=_0x196cca;_0x1d319d['push'](dbH['sequelize'][_0xb3d2('0x15')](util[_0xb3d2('0xf')](_0xb3d2('0x1f'),QUERY,_0xecc189,_0x5ae0bb),{'type':dbH['sequelize'][_0xb3d2('0x21')][_0xb3d2('0x20')]}));}}}else{_0x1d319d[_0xb3d2('0x1e')](dbH[_0xb3d2('0x14')][_0xb3d2('0x15')](QUERY,{'type':dbH[_0xb3d2('0x14')][_0xb3d2('0x21')]['SELECT']}));}var _0x59add7=path['dirname'](PATH);var _0xc45741=path['basename'](PATH,_0xb3d2('0x22'));var _0x4b362c=_0xa7c0dd['split']&&_0x1d319d[_0xb3d2('0x23')]>0x1;var _0x1348ae=[];if(!fs[_0xb3d2('0x24')](path['join'](_0x59add7,_0xc45741))&&_0x4b362c){fs[_0xb3d2('0x25')](path[_0xb3d2('0x26')](_0x59add7,_0xc45741));}return BPromise[_0xb3d2('0x27')](_0x1d319d,function(_0x46dbd0){_0x1348ae['push'](_0x46dbd0);})['then'](function(){for(var _0x2d49cc=0x0;_0x2d49cc<_0x1348ae[_0xb3d2('0x23')];_0x2d49cc+=0x1){var _0x3eff51;var _0x1a69b7=_0x1348ae[_0x2d49cc];if(_0x4b362c){_0x3eff51=path[_0xb3d2('0x26')](_0x59add7,_0xc45741,util[_0xb3d2('0xf')](_0xb3d2('0x28'),_0xc45741,_0x2d49cc,'xlsx'));}else{_0x3eff51=path['join'](_0x59add7,util['format']('%s.%s',_0xc45741,_0xb3d2('0x29')));}fs[_0xb3d2('0x2a')](_0x3eff51,json2xls(_0x1a69b7),'binary');}})['then'](function(){if(_0x4b362c){return new Promise(function(_0x16eba2){zipdir(path['join'](_0x59add7,_0xc45741),{'saveTo':path[_0xb3d2('0x26')](_0x59add7,util[_0xb3d2('0xf')]('%s.%s',_0xc45741,_0xb3d2('0x2b')))},function(_0xb197d7,_0x4ba961){rimraf(path[_0xb3d2('0x26')](_0x59add7,_0xc45741),function(){});_0x16eba2(_0xb3d2('0x2c'));});});}})[_0xb3d2('0x17')](function(){logger[_0xb3d2('0xe')](util[_0xb3d2('0xf')](_0xb3d2('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xb3d2('0x2e'),_0x4b362c?util[_0xb3d2('0xf')](_0xb3d2('0x2f'),_0xc45741,_0x4b362c?_0xb3d2('0x2b'):_0xb3d2('0x29')):null);});})[_0xb3d2('0x30')](function(_0x4ae110){logger[_0xb3d2('0xe')](util[_0xb3d2('0xf')](_0xb3d2('0x31'),EXTRACTED_REPORT_ID,_0xb3d2('0x11')),util['inspect'](_0x4ae110,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb3d2('0x32')](function(){process[_0xb3d2('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 5612ce5..58f48c1 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 _0x9167=['GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','VoiceExtension','IntervalId','models','uniq','map','exten','filter','groupBy','queue','hasOwnProperty','extensions','extension','type','Set','format','CDR(type)=%s','priority','inbound','push','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice'];(function(_0x320a82,_0x4b09e2){var _0x4fbe70=function(_0x28553a){while(--_0x28553a){_0x320a82['push'](_0x320a82['shift']());}};_0x4fbe70(++_0x4b09e2);}(_0x9167,0xdd));var _0x7916=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9167[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7916('0x0'));var util=require(_0x7916('0x1'));function rewrite(_0x46ba3b,_0x30b158){var _0x3ebeec=this;return _0x46ba3b['models'][_0x7916('0x2')][_0x7916('0x3')]({'raw':!![]})[_0x7916('0x4')](function(_0x19e7a8){_0x3ebeec[_0x7916('0x5')]=_0x19e7a8;return _0x46ba3b['models'][_0x7916('0x6')][_0x7916('0x3')]({'where':{'IntervalId':_0x30b158[_0x7916('0x7')]},'raw':!![]});})[_0x7916('0x4')](function(_0x37af0c){return _0x46ba3b[_0x7916('0x8')][_0x7916('0x6')][_0x7916('0x3')]({'where':{'exten':{'$in':_[_0x7916('0x9')](_[_0x7916('0xa')](_0x37af0c,_0x7916('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x7916('0x4')](function(_0x19a840){var _0x478ff6=_['filter'](_0x19a840,{'priority':'1'});var _0x4f96e6=_[_0x7916('0xc')](_0x19a840,{'isApp':0x1});var _0x484adc=_[_0x7916('0xd')](_0x4f96e6,'exten');var _0xbbc9e1=[_0x7916('0xe'),'playback'];var _0x2797fc=[];var _0xcbcdd0=[];for(var _0x50b611 in _0x484adc){if(_0x484adc[_0x7916('0xf')](_0x50b611)){_0x3ebeec['priority']=0x2;_0x3ebeec[_0x7916('0x10')]=[];_0x3ebeec[_0x7916('0x11')]=_['find'](_0x478ff6,{'exten':_0x484adc[_0x50b611][0x0]['exten']});_0x3ebeec[_0x7916('0x10')]['push']({'type':_0x484adc[_0x50b611][0x0][_0x7916('0x12')],'app':_0x7916('0x13'),'appdata':util[_0x7916('0x14')](_0x7916('0x15'),_0x484adc[_0x50b611][0x0][_0x7916('0x12')]),'context':_0x484adc[_0x50b611][0x0]['context'],'exten':_0x484adc[_0x50b611][0x0]['exten'],'priority':_0x3ebeec[_0x7916('0x16')]++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0]['VoiceExtensionId']});if(_0x484adc[_0x50b611][0x0][_0x7916('0x12')]===_0x7916('0x17')){_0x3ebeec[_0x7916('0x10')][_0x7916('0x18')]({'type':_0x484adc[_0x50b611][0x0][_0x7916('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x484adc[_0x50b611][0x0]['VoiceExtensionId'],'context':_0x484adc[_0x50b611][0x0][_0x7916('0x19')],'exten':_0x484adc[_0x50b611][0x0][_0x7916('0xb')],'priority':_0x3ebeec[_0x7916('0x16')]++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});}else if(_0x484adc[_0x50b611][0x0][_0x7916('0x12')]===_0x7916('0x1b')){if(_0x3ebeec[_0x7916('0x11')]){_0x3ebeec[_0x7916('0x10')][_0x7916('0x18')]({'type':_0x484adc[_0x50b611][0x0][_0x7916('0x12')],'app':_0x7916('0x13'),'appdata':_0x7916('0x1c')+(_0x3ebeec[_0x7916('0x11')][_0x7916('0x1d')]?_0x7916('0x1e')+_0x3ebeec[_0x7916('0x11')][_0x7916('0x1d')]+'}':_0x7916('0x1f')),'context':_0x484adc[_0x50b611][0x0]['context'],'exten':_0x484adc[_0x50b611][0x0]['exten'],'priority':_0x3ebeec[_0x7916('0x16')]++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});}_0x3ebeec[_0x7916('0x10')][_0x7916('0x18')]({'type':_0x484adc[_0x50b611][0x0]['type'],'app':_0x7916('0x13'),'appdata':_0x7916('0x20')+_0x484adc[_0x50b611][0x0][_0x7916('0x1a')],'context':_0x484adc[_0x50b611][0x0]['context'],'exten':_0x484adc[_0x50b611][0x0]['exten'],'priority':_0x3ebeec[_0x7916('0x16')]++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});var _0x4ca9d=_0x3ebeec[_0x7916('0x16')]++;_0x3ebeec[_0x7916('0x10')][_0x7916('0x18')]({'type':_0x484adc[_0x50b611][0x0]['type'],'app':'ExecIf','appdata':_0x7916('0x21')+(_0x4ca9d+0x2)+_0x7916('0x22')+(_0x4ca9d+0x1)+')','context':_0x484adc[_0x50b611][0x0]['context'],'exten':_0x484adc[_0x50b611][0x0][_0x7916('0xb')],'priority':_0x4ca9d,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});if(_0x3ebeec[_0x7916('0x11')]){_0x3ebeec[_0x7916('0x10')][_0x7916('0x18')]({'type':_0x484adc[_0x50b611][0x0]['type'],'app':_0x7916('0x13'),'appdata':_0x3ebeec['extension']['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x3ebeec[_0x7916('0x11')][_0x7916('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x484adc[_0x50b611][0x0][_0x7916('0x19')],'exten':_0x484adc[_0x50b611][0x0]['exten'],'priority':_0x3ebeec[_0x7916('0x16')]++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});}_0x3ebeec[_0x7916('0x10')][_0x7916('0x18')]({'type':_0x484adc[_0x50b611][0x0][_0x7916('0x12')],'app':_0x7916('0x13'),'appdata':_0x7916('0x23')+_0x484adc[_0x50b611][0x0][_0x7916('0x1a')],'context':_0x484adc[_0x50b611][0x0][_0x7916('0x19')],'exten':_0x484adc[_0x50b611][0x0]['exten'],'priority':_0x3ebeec[_0x7916('0x16')]++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});if(_0x3ebeec[_0x7916('0x11')]&&_0x3ebeec[_0x7916('0x11')][_0x7916('0xf')](_0x7916('0x24'))&&_0x3ebeec[_0x7916('0x11')][_0x7916('0x24')]!==_0x7916('0x25')){_0x3ebeec[_0x7916('0x10')][_0x7916('0x18')]({'type':_0x484adc[_0x50b611][0x0][_0x7916('0x12')],'app':_0x7916('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x484adc[_0x50b611][0x0][_0x7916('0x19')],'exten':_0x484adc[_0x50b611][0x0][_0x7916('0xb')],'priority':_0x3ebeec[_0x7916('0x16')]++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});_0x3ebeec[_0x7916('0x10')]['push']({'type':_0x484adc[_0x50b611][0x0]['type'],'app':'Set','appdata':_0x7916('0x26')+_0x3ebeec['extension'][_0x7916('0x24')]||'wav','context':_0x484adc[_0x50b611][0x0]['context'],'exten':_0x484adc[_0x50b611][0x0][_0x7916('0xb')],'priority':_0x3ebeec['priority']++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});}}_0x3ebeec[_0x7916('0x10')][_0x7916('0x18')]({'type':_0x484adc[_0x50b611][0x0]['type'],'app':_0x7916('0x13'),'appdata':_0x7916('0x27'),'context':_0x484adc[_0x50b611][0x0][_0x7916('0x19')],'exten':_0x484adc[_0x50b611][0x0][_0x7916('0xb')],'priority':_0x3ebeec['priority']++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0]['VoiceExtensionId']});_0x3ebeec['extensions']['push']({'type':_0x484adc[_0x50b611][0x0]['type'],'app':_0x7916('0x13'),'appdata':_0x7916('0x28'),'context':_0x484adc[_0x50b611][0x0][_0x7916('0x19')],'exten':_0x484adc[_0x50b611][0x0][_0x7916('0xb')],'priority':_0x3ebeec['priority']++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});_0x3ebeec[_0x7916('0x10')][_0x7916('0x18')]({'type':_0x484adc[_0x50b611][0x0][_0x7916('0x12')],'app':'Set','appdata':_0x7916('0x29'),'context':_0x484adc[_0x50b611][0x0][_0x7916('0x19')],'exten':_0x484adc[_0x50b611][0x0][_0x7916('0xb')],'priority':_0x3ebeec[_0x7916('0x16')]++,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});for(var _0x310265=0x0,_0x1f51ea=0x0;_0x310265<_0x484adc[_0x50b611][_0x7916('0x2a')];_0x310265+=0x1,_0x1f51ea=0x0){var _0x171c28=_0x484adc[_0x50b611][_0x310265];if(_0x171c28[_0x7916('0x12')]){_0x171c28[_0x7916('0x12')]=_0x171c28[_0x7916('0x12')][_0x7916('0x2b')]();}var _0x2f7523=[];var _0x1222a1=[];delete _0x171c28['id'];delete _0x171c28[_0x7916('0x2c')];delete _0x171c28['updatedAt'];var _0x59d2ff=_0x171c28['interval']!==_0x7916('0x2d')?[_0x171c28[_0x7916('0x2e')]]:_0x171c28['IntervalId']?_['map'](_[_0x7916('0xc')](_0x3ebeec[_0x7916('0x5')],{'IntervalId':_0x171c28[_0x7916('0x7')]}),_0x7916('0x2e')):[];if(_0x171c28[_0x7916('0xf')](_0x7916('0x2f'))){if(_0x171c28['tag']&&_0x171c28[_0x7916('0x2f')]!=='--'){_0x2f7523[_0x7916('0x18')]({'type':_0x171c28[_0x7916('0x12')],'app':_0x7916('0x13'),'appdata':_0x7916('0x30')+_0x171c28[_0x7916('0x2f')],'context':_0x171c28[_0x7916('0x19')],'exten':_0x171c28['exten'],'priority':_0x59d2ff[_0x7916('0x2a')]+_0x3ebeec[_0x7916('0x16')]+_0x1f51ea++,'VoiceExtensionId':_0x171c28[_0x7916('0x1a')]});}}if(_0x171c28['type']===_0x7916('0x1b')&&_0x171c28['hasOwnProperty']('callerID')){if(_0x171c28['callerID']){_0x2f7523['push']({'type':_0x171c28[_0x7916('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x171c28[_0x7916('0x31')]+')','context':_0x171c28['context'],'exten':_0x171c28['exten'],'priority':_0x59d2ff['length']+_0x3ebeec[_0x7916('0x16')]+_0x1f51ea++,'VoiceExtensionId':_0x171c28[_0x7916('0x1a')]});}else{_0x2f7523[_0x7916('0x18')]({'type':_0x171c28[_0x7916('0x12')],'app':_0x7916('0x32'),'appdata':_0x7916('0x33'),'context':_0x171c28['context'],'exten':_0x171c28['exten'],'priority':_0x59d2ff[_0x7916('0x2a')]+_0x3ebeec[_0x7916('0x16')]+_0x1f51ea++,'VoiceExtensionId':_0x171c28[_0x7916('0x1a')]});}}if(_0x171c28[_0x7916('0xf')](_0x7916('0x34'))){if(_0xbbc9e1[_0x7916('0x35')](_0x171c28['app']['toLowerCase']())>=0x0&&_0x171c28[_0x7916('0x36')]!==_0x7916('0x37')){if(_0x171c28['answer']){_0x2f7523[_0x7916('0x18')]({'type':_0x171c28[_0x7916('0x12')],'app':_0x7916('0x32'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x171c28[_0x7916('0x19')],'exten':_0x171c28[_0x7916('0xb')],'priority':_0x59d2ff['length']+_0x3ebeec['priority']+_0x1f51ea++,'VoiceExtensionId':_0x171c28[_0x7916('0x1a')]});_0x2f7523[_0x7916('0x18')]({'type':_0x171c28['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x171c28[_0x7916('0x19')],'exten':_0x171c28[_0x7916('0xb')],'priority':_0x59d2ff[_0x7916('0x2a')]+_0x3ebeec[_0x7916('0x16')]+_0x1f51ea++,'VoiceExtensionId':_0x171c28[_0x7916('0x1a')]});}else{_0x2f7523[_0x7916('0x18')]({'type':_0x171c28['type'],'app':'ExecIf','appdata':_0x7916('0x38'),'context':_0x171c28[_0x7916('0x19')],'exten':_0x171c28[_0x7916('0xb')],'priority':_0x59d2ff[_0x7916('0x2a')]+_0x3ebeec[_0x7916('0x16')]+_0x1f51ea++,'VoiceExtensionId':_0x171c28[_0x7916('0x1a')]});_0x2f7523[_0x7916('0x18')]({'type':_0x171c28[_0x7916('0x12')],'app':_0x7916('0x13'),'appdata':_0x7916('0x39'),'context':_0x171c28[_0x7916('0x19')],'exten':_0x171c28[_0x7916('0xb')],'priority':_0x59d2ff[_0x7916('0x2a')]+_0x3ebeec[_0x7916('0x16')]+_0x1f51ea++,'VoiceExtensionId':_0x171c28['VoiceExtensionId']});}}}for(var _0x3152b5=0x0;_0x3152b5<_0x59d2ff[_0x7916('0x2a')];_0x3152b5+=0x1){var _0x2e0317=_0x3ebeec['priority']+_0x59d2ff[_0x7916('0x2a')];var _0x1a150e=_0x3152b5===_0x59d2ff['length']-0x1?_0x3ebeec[_0x7916('0x16')]+_0x2f7523['length']+_0x1222a1['length']+0x2:_0x3ebeec[_0x7916('0x16')]+_0x3152b5+0x1;_0x2f7523[_0x7916('0x3a')](_0x3152b5,0x0,{'type':_0x171c28['type'],'app':_0x7916('0x3b'),'appdata':_0x59d2ff[_0x3152b5]+'?'+_0x171c28[_0x7916('0x19')]+_0x7916('0x3c')+_0x2e0317+':'+_0x171c28[_0x7916('0x19')]+_0x7916('0x3c')+_0x1a150e,'exten':_0x171c28[_0x7916('0xb')],'context':_0x171c28[_0x7916('0x19')],'priority':_0x3ebeec[_0x7916('0x16')]+_0x3152b5,'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});}_0x171c28[_0x7916('0x16')]=_0x2f7523[_0x7916('0x2a')]?_[_0x7916('0x3d')](_0x2f7523)['priority']+0x1:_0x3ebeec[_0x7916('0x16')];_0x3ebeec[_0x7916('0x16')]=(_0x1222a1[_0x7916('0x2a')]?_['last'](_0x1222a1)[_0x7916('0x16')]:_0x171c28[_0x7916('0x16')])+0x1;_0x3ebeec[_0x7916('0x10')]=_[_0x7916('0x3e')](_0x3ebeec['extensions'],_0x2f7523,[_0x171c28],_0x1222a1);}_0x3ebeec[_0x7916('0x10')][_0x7916('0x18')]({'type':_0x484adc[_0x50b611][0x0]['type'],'app':_0x7916('0x3f'),'exten':_0x484adc[_0x50b611][0x0][_0x7916('0xb')],'context':_0x484adc[_0x50b611][0x0][_0x7916('0x19')],'priority':_0x3ebeec['priority'],'VoiceExtensionId':_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]});_0x2797fc[_0x7916('0x18')](_0x484adc[_0x50b611][0x0][_0x7916('0x1a')]);_0xcbcdd0=_[_0x7916('0x3e')](_0xcbcdd0,_0x3ebeec[_0x7916('0x10')]);}}return _0x46ba3b[_0x7916('0x40')](function(_0x4d83c5){return _0x46ba3b[_0x7916('0x8')][_0x7916('0x6')][_0x7916('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x2797fc}},'transaction':_0x4d83c5})['then'](function(_0x4eb4ed){return _0x46ba3b[_0x7916('0x8')][_0x7916('0x6')][_0x7916('0x42')](_['sortBy'](_0xcbcdd0,'priority'),{'transaction':_0x4d83c5});});});})[_0x7916('0x43')](function(_0x53bb5e){console[_0x7916('0x44')](_0x53bb5e);});}exports[_0x7916('0x45')]=rewrite; \ No newline at end of file +var _0xbdc1=['MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','filter','groupBy','exten','queue','hasOwnProperty','extensions','extension','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','priority','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0'];(function(_0x561195,_0x1f9dec){var _0x5c87c3=function(_0x32ee97){while(--_0x32ee97){_0x561195['push'](_0x561195['shift']());}};_0x5c87c3(++_0x1f9dec);}(_0xbdc1,0x163));var _0x1bdc=function(_0x512afa,_0x175a91){_0x512afa=_0x512afa-0x0;var _0x4d413c=_0xbdc1[_0x512afa];return _0x4d413c;};'use strict';var _=require('lodash');var util=require(_0x1bdc('0x0'));function rewrite(_0x1af9d8,_0x38d7a3){var _0x5a21bd=this;return _0x1af9d8[_0x1bdc('0x1')][_0x1bdc('0x2')][_0x1bdc('0x3')]({'raw':!![]})[_0x1bdc('0x4')](function(_0x3e7bf6){_0x5a21bd['intervals']=_0x3e7bf6;return _0x1af9d8[_0x1bdc('0x1')][_0x1bdc('0x5')]['findAll']({'where':{'IntervalId':_0x38d7a3[_0x1bdc('0x6')]},'raw':!![]});})[_0x1bdc('0x4')](function(_0x2273eb){return _0x1af9d8[_0x1bdc('0x1')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x1bdc('0x7')](_[_0x1bdc('0x8')](_0x2273eb,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x2e0f71){var _0x2fbe6f=_[_0x1bdc('0x9')](_0x2e0f71,{'priority':'1'});var _0x5dd656=_[_0x1bdc('0x9')](_0x2e0f71,{'isApp':0x1});var _0x1b0368=_[_0x1bdc('0xa')](_0x5dd656,_0x1bdc('0xb'));var _0x1305b1=[_0x1bdc('0xc'),'playback'];var _0x5360cc=[];var _0x44a267=[];for(var _0x5d57b2 in _0x1b0368){if(_0x1b0368[_0x1bdc('0xd')](_0x5d57b2)){_0x5a21bd['priority']=0x2;_0x5a21bd[_0x1bdc('0xe')]=[];_0x5a21bd[_0x1bdc('0xf')]=_[_0x1bdc('0x10')](_0x2fbe6f,{'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')]});_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':util['format'](_0x1bdc('0x14'),_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')]),'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd['priority']++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});if(_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')]===_0x1bdc('0x17')){_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0]['type'],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x18')+_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')],'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0]['VoiceExtensionId']});}else if(_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')]===_0x1bdc('0x1a')){if(_0x5a21bd['extension']){_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0]['type'],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x1b')+(_0x5a21bd['extension'][_0x1bdc('0x1c')]?_0x1bdc('0x1d')+_0x5a21bd[_0x1bdc('0xf')]['cutdigits']+'}':'${EXTEN}'),'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});}_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x18')+_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')],'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});var _0x4ec129=_0x5a21bd['priority']++;_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x1e'),'appdata':_0x1bdc('0x1f')+(_0x4ec129+0x2)+_0x1bdc('0x20')+(_0x4ec129+0x1)+')','context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x4ec129,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});if(_0x5a21bd[_0x1bdc('0xf')]){_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':_0x5a21bd[_0x1bdc('0xf')]['cutdigits']?_0x1bdc('0x21')+_0x5a21bd[_0x1bdc('0xf')][_0x1bdc('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd['priority']++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});}_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0]['type'],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x22')+_0x1b0368[_0x5d57b2][0x0]['VoiceExtensionId'],'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});if(_0x5a21bd[_0x1bdc('0xf')]&&_0x5a21bd['extension'][_0x1bdc('0xd')]('recordingFormat')&&_0x5a21bd[_0x1bdc('0xf')][_0x1bdc('0x23')]!==_0x1bdc('0x24')){_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0]['type'],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x25'),'context':_0x1b0368[_0x5d57b2][0x0]['context'],'exten':_0x1b0368[_0x5d57b2][0x0]['exten'],'priority':_0x5a21bd['priority']++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':'Set','appdata':_0x1bdc('0x26')+_0x5a21bd['extension'][_0x1bdc('0x23')]||_0x1bdc('0x27'),'context':_0x1b0368[_0x5d57b2][0x0]['context'],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});}}_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x28'),'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});_0x5a21bd[_0x1bdc('0xe')][_0x1bdc('0x11')]({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd['priority']++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});_0x5a21bd['extensions']['push']({'type':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x12')],'app':'Set','appdata':_0x1bdc('0x29'),'context':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x15')],'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'priority':_0x5a21bd[_0x1bdc('0x19')]++,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});for(var _0x59ddc9=0x0,_0x5aa109=0x0;_0x59ddc9<_0x1b0368[_0x5d57b2][_0x1bdc('0x2a')];_0x59ddc9+=0x1,_0x5aa109=0x0){var _0xf64556=_0x1b0368[_0x5d57b2][_0x59ddc9];if(_0xf64556['type']){_0xf64556[_0x1bdc('0x12')]=_0xf64556['type'][_0x1bdc('0x2b')]();}var _0x2c9e2b=[];var _0x1b82a1=[];delete _0xf64556['id'];delete _0xf64556[_0x1bdc('0x2c')];delete _0xf64556['updatedAt'];var _0x4fb629=_0xf64556['interval']!=='*,*,*,*'?[_0xf64556[_0x1bdc('0x2d')]]:_0xf64556[_0x1bdc('0x6')]?_[_0x1bdc('0x8')](_[_0x1bdc('0x9')](_0x5a21bd['intervals'],{'IntervalId':_0xf64556[_0x1bdc('0x6')]}),_0x1bdc('0x2d')):[];if(_0xf64556[_0x1bdc('0xd')]('tag')){if(_0xf64556[_0x1bdc('0x2e')]&&_0xf64556['tag']!=='--'){_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556[_0x1bdc('0x12')],'app':'Set','appdata':'CDR(tag)='+_0xf64556[_0x1bdc('0x2e')],'context':_0xf64556[_0x1bdc('0x15')],'exten':_0xf64556[_0x1bdc('0xb')],'priority':_0x4fb629[_0x1bdc('0x2a')]+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556[_0x1bdc('0x16')]});}}if(_0xf64556['type']===_0x1bdc('0x1a')&&_0xf64556[_0x1bdc('0xd')](_0x1bdc('0x2f'))){if(_0xf64556[_0x1bdc('0x2f')]){_0x2c9e2b['push']({'type':_0xf64556[_0x1bdc('0x12')],'app':'ExecIf','appdata':_0x1bdc('0x30')+_0xf64556[_0x1bdc('0x2f')]+')','context':_0xf64556['context'],'exten':_0xf64556[_0x1bdc('0xb')],'priority':_0x4fb629[_0x1bdc('0x2a')]+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556['VoiceExtensionId']});}else{_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556['type'],'app':_0x1bdc('0x1e'),'appdata':_0x1bdc('0x31'),'context':_0xf64556[_0x1bdc('0x15')],'exten':_0xf64556['exten'],'priority':_0x4fb629[_0x1bdc('0x2a')]+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556['VoiceExtensionId']});}}if(_0xf64556[_0x1bdc('0xd')](_0x1bdc('0x32'))){if(_0x1305b1[_0x1bdc('0x33')](_0xf64556['app'][_0x1bdc('0x2b')]())>=0x0&&_0xf64556[_0x1bdc('0x34')]!=='custom'){if(_0xf64556[_0x1bdc('0x32')]){_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556[_0x1bdc('0x12')],'app':_0x1bdc('0x1e'),'appdata':_0x1bdc('0x35'),'context':_0xf64556['context'],'exten':_0xf64556[_0x1bdc('0xb')],'priority':_0x4fb629['length']+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556[_0x1bdc('0x16')]});_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556[_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x36'),'context':_0xf64556[_0x1bdc('0x15')],'exten':_0xf64556[_0x1bdc('0xb')],'priority':_0x4fb629['length']+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556[_0x1bdc('0x16')]});}else{_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556[_0x1bdc('0x12')],'app':_0x1bdc('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xf64556[_0x1bdc('0x15')],'exten':_0xf64556['exten'],'priority':_0x4fb629[_0x1bdc('0x2a')]+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556[_0x1bdc('0x16')]});_0x2c9e2b[_0x1bdc('0x11')]({'type':_0xf64556[_0x1bdc('0x12')],'app':_0x1bdc('0x13'),'appdata':_0x1bdc('0x37'),'context':_0xf64556[_0x1bdc('0x15')],'exten':_0xf64556['exten'],'priority':_0x4fb629[_0x1bdc('0x2a')]+_0x5a21bd[_0x1bdc('0x19')]+_0x5aa109++,'VoiceExtensionId':_0xf64556[_0x1bdc('0x16')]});}}}for(var _0x471ce2=0x0;_0x471ce2<_0x4fb629['length'];_0x471ce2+=0x1){var _0x226709=_0x5a21bd[_0x1bdc('0x19')]+_0x4fb629['length'];var _0xf501f4=_0x471ce2===_0x4fb629[_0x1bdc('0x2a')]-0x1?_0x5a21bd['priority']+_0x2c9e2b[_0x1bdc('0x2a')]+_0x1b82a1['length']+0x2:_0x5a21bd['priority']+_0x471ce2+0x1;_0x2c9e2b[_0x1bdc('0x38')](_0x471ce2,0x0,{'type':_0xf64556[_0x1bdc('0x12')],'app':'GotoIfTime','appdata':_0x4fb629[_0x471ce2]+'?'+_0xf64556[_0x1bdc('0x15')]+_0x1bdc('0x39')+_0x226709+':'+_0xf64556[_0x1bdc('0x15')]+_0x1bdc('0x39')+_0xf501f4,'exten':_0xf64556[_0x1bdc('0xb')],'context':_0xf64556[_0x1bdc('0x15')],'priority':_0x5a21bd[_0x1bdc('0x19')]+_0x471ce2,'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});}_0xf64556['priority']=_0x2c9e2b[_0x1bdc('0x2a')]?_[_0x1bdc('0x3a')](_0x2c9e2b)[_0x1bdc('0x19')]+0x1:_0x5a21bd[_0x1bdc('0x19')];_0x5a21bd['priority']=(_0x1b82a1[_0x1bdc('0x2a')]?_[_0x1bdc('0x3a')](_0x1b82a1)[_0x1bdc('0x19')]:_0xf64556[_0x1bdc('0x19')])+0x1;_0x5a21bd[_0x1bdc('0xe')]=_[_0x1bdc('0x3b')](_0x5a21bd[_0x1bdc('0xe')],_0x2c9e2b,[_0xf64556],_0x1b82a1);}_0x5a21bd[_0x1bdc('0xe')]['push']({'type':_0x1b0368[_0x5d57b2][0x0]['type'],'app':_0x1bdc('0x3c'),'exten':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0xb')],'context':_0x1b0368[_0x5d57b2][0x0]['context'],'priority':_0x5a21bd[_0x1bdc('0x19')],'VoiceExtensionId':_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]});_0x5360cc['push'](_0x1b0368[_0x5d57b2][0x0][_0x1bdc('0x16')]);_0x44a267=_[_0x1bdc('0x3b')](_0x44a267,_0x5a21bd[_0x1bdc('0xe')]);}}return _0x1af9d8[_0x1bdc('0x3d')](function(_0x315fed){return _0x1af9d8['models']['VoiceExtension'][_0x1bdc('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x5360cc}},'transaction':_0x315fed})[_0x1bdc('0x4')](function(_0x174c54){return _0x1af9d8[_0x1bdc('0x1')][_0x1bdc('0x5')][_0x1bdc('0x3f')](_[_0x1bdc('0x40')](_0x44a267,'priority'),{'transaction':_0x315fed});});});})['catch'](function(_0x4891f7){console[_0x1bdc('0x41')](_0x4891f7);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index af8cd32..f8d124d 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 _0x7409=['undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','inspect','insert','cm_hopper','scheduledAt','updatedAt','select','field','NOW()','ContactId','toString','from','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','fromQuery','createdAt','cm_contacts','id\x20IN\x20?','str','cm_hopper_black','ListId\x20=\x20?','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','findAll','outbound','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x7409,0x1af));var _0x9740=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x7409[_0x4792c8];return _0x35edb1;};'use strict';var BPromise=require('bluebird');var util=require(_0x9740('0x0'));var _=require(_0x9740('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x9740('0x2'));var db=require(_0x9740('0x3'))['db'];var config=require(_0x9740('0x4'));var logger=require(_0x9740('0x5'))(_0x9740('0x6'));config[_0x9740('0x7')]=_['defaults'](config[_0x9740('0x7')],{'host':_0x9740('0x8'),'port':0x18eb});var socket=require(_0x9740('0x9'))(new Redis(config[_0x9740('0x7')]));require(_0x9740('0xa'))[_0x9740('0xb')](socket);try{if(!process[_0x9740('0xc')][0x2]||process[_0x9740('0xc')][0x2]===_0x9740('0xd')||process[_0x9740('0xc')][0x2]===_0x9740('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x9740('0xc')][0x2];if(!process[_0x9740('0xc')][0x3]||process[_0x9740('0xc')][0x3]===_0x9740('0xd')||process[_0x9740('0xc')][0x3]===_0x9740('0xe')||!process[_0x9740('0xc')][0x4]||process[_0x9740('0xc')][0x4]===_0x9740('0xd')||process[_0x9740('0xc')][0x4]==='null'){throw new Error(_0x9740('0xf'));}var FIELDS=_[_0x9740('0x10')](process[_0x9740('0xc')][0x3][_0x9740('0x11')](','),process[_0x9740('0xc')][0x4][_0x9740('0x11')](','));if(!process[_0x9740('0xc')][0x5]||process['argv'][0x5]===_0x9740('0xd')||process[_0x9740('0xc')][0x5]==='null'){throw new Error(_0x9740('0x12'));}var LISTID=process[_0x9740('0xc')][0x5];var COMPANYID=process[_0x9740('0xc')][0x6]&&process['argv'][0x6]!==_0x9740('0xd')&&process[_0x9740('0xc')][0x6]!==_0x9740('0xe')?process[_0x9740('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x9740('0xc')][0x7]!==_0x9740('0xd')&&process[_0x9740('0xc')][0x7]!==_0x9740('0xe')?process['argv'][0x7]:null;if(!process[_0x9740('0xc')][0x8]||process['argv'][0x8]===_0x9740('0xd')||process[_0x9740('0xc')][0x8]===_0x9740('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x7ebd01){logger[_0x9740('0x13')](_0x7ebd01);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(_0x26a587,_0x52cab8,_0x2d1772,_0x2870d9){var _0x11df05={'message':_0x52cab8};_0x11df05[_0x26a587]=!![];if(_0x2d1772){_0x11df05[_0x9740('0x14')]=_0x2d1772;}if(_0x2870d9){_0x11df05[_0x9740('0x15')]=_0x2870d9;}return _0x11df05;}function isEmail(_0x230ff2){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))*$/[_0x9740('0x16')](_0x230ff2);}function checkRow(_0x73ee62,_0x742d38,_0x52d767){return new BPromise(function(_0x21cf1a,_0x19c485){if(_[_0x9740('0x17')](_0x73ee62)){return _0x19c485(handleCheckRowError(_0x9740('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x52d767));}if(_0x73ee62[_0x9740('0x18')]&&_0x73ee62[_0x9740('0x18')][_0x9740('0x19')]){var _0x5d90ed=_[_0x9740('0x1a')](_0x73ee62[_0x9740('0x18')],_0x9740('0x1b'))[_0x9740('0x1c')](';');return _0x19c485(handleCheckRowError('error',_0x5d90ed,null,_0x52d767));}var _0xeb6649={};for(var _0x314a0b in FIELDS){if(FIELDS[_0x9740('0x1d')](_0x314a0b)&&FIELDS[_0x314a0b]){_0xeb6649[_0x314a0b]=_0x73ee62[_0x9740('0x1e')][0x0][FIELDS[_0x314a0b]]||_0x73ee62[_0x9740('0x1e')][0x0]['\ufeff'+FIELDS[_0x314a0b]];}}if(!_0xeb6649[_0x9740('0x1f')]){return _0x19c485(handleCheckRowError(_0x9740('0x13'),_0x9740('0x20'),null,_0x52d767));}if(!_0xeb6649[_0x9740('0x21')]){return _0x19c485(handleCheckRowError('error',_0x9740('0x22'),null,_0x52d767));}if(_0xeb6649[_0x9740('0x23')]){var _0xe84f88=moment(_0xeb6649[_0x9740('0x23')],_0x9740('0x24'));if(!_0xe84f88[_0x9740('0x25')]()){return _0x19c485(handleCheckRowError(_0x9740('0x13'),_0x9740('0x26'),null,_0x52d767));}}if(_0xeb6649[_0x9740('0x27')]){if(!isEmail(_0xeb6649[_0x9740('0x27')])){return _0x19c485(handleCheckRowError('error',_0x9740('0x28'),null,_0x52d767));}}_0xeb6649[_0x9740('0x29')]=LISTID;_0xeb6649[_0x9740('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x9740('0x19')]&&_0x742d38){var _0x40c86e={};for(var _0x3fe5fa=0x0,_0x4ea936=DUPLICATES[_0x9740('0x19')];_0x3fe5fa<_0x4ea936;_0x3fe5fa+=0x1){_0x40c86e[DUPLICATES[_0x3fe5fa]]=_0xeb6649[DUPLICATES[_0x3fe5fa]];}var _0x246dc1=_['find'](_0x742d38,_0x40c86e);if(_0x246dc1){return _0x19c485(handleCheckRowError(_0x9740('0x2b'),_0x9740('0x2c'),_0x246dc1,_0x52d767));}}return db[_0x9740('0x2d')][_0x9740('0x2e')](_0xeb6649,{'raw':!![],'hooks':![],'fields':_[_0x9740('0x2f')](_0xeb6649)})[_0x9740('0x30')](function(_0x1d2c7b){if(DUPLICATES&&DUPLICATES[_0x9740('0x19')]&&_0x742d38){_0x742d38[_0x9740('0x31')](_[_0x9740('0x32')](_0xeb6649,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1d2c7b['id'];return _0x21cf1a();})[_0x9740('0x33')](function(_0x32d5ec){return _0x19c485(handleCheckRowError(_0x9740('0x13'),'Error\x20while\x20creating\x20contact:\x20'+(_0x32d5ec[_0x9740('0x1b')]||JSON[_0x9740('0x34')](_0x32d5ec)),null,_0x52d767));});});}function checkHopper(){function _0x443b74(){return function(_0x3a131d){logger[_0x9740('0x13')](_0x9740('0x35'),'checkHopper',util[_0x9740('0x36')](_0x3a131d,{'showHidden':![],'depth':null}));};}var _0x20884b=function(_0x4dd0c9,_0x3a4bc2){var _0x5f1b7c=squel[_0x9740('0x37')]()['into'](_0x9740('0x38'))['fromQuery']([_0x9740('0x21'),_0x9740('0x39'),'ContactId',_0x9740('0x29'),_0x3a4bc2,'createdAt',_0x9740('0x3a')],squel[_0x9740('0x3b')]()[_0x9740('0x3c')](_0x9740('0x21'),_0x9740('0x21'))[_0x9740('0x3c')](_0x9740('0x3d'),_0x9740('0x39'))['field']('id',_0x9740('0x3e'))['field'](LISTID[_0x9740('0x3f')](),_0x9740('0x29'))[_0x9740('0x3c')](_0x4dd0c9['id'][_0x9740('0x3f')](),_0x3a4bc2)[_0x9740('0x3c')](_0x9740('0x3d'),'createdAt')[_0x9740('0x3c')](_0x9740('0x3d'),_0x9740('0x3a'))[_0x9740('0x40')]('cm_contacts')['where'](_0x9740('0x41'))[_0x9740('0x42')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x9740('0x43'))[_0x9740('0x42')](_0x9740('0x44'),squel['select']()[_0x9740('0x3c')](_0x9740('0x21'))['from'](_0x9740('0x38'))[_0x9740('0x42')](_0x3a4bc2+_0x9740('0x45'),_0x4dd0c9['id'][_0x9740('0x3f')]())))[_0x9740('0x3f')]();return _0x5f1b7c;};var _0x56a7fc=function(_0x23083f,_0x4f1685){var _0x1c8de7=squel[_0x9740('0x37')]()[_0x9740('0x46')](_0x9740('0x38'))[_0x9740('0x47')]([_0x9740('0x21'),_0x9740('0x39'),_0x9740('0x3e'),'ListId',_0x4f1685,_0x9740('0x48'),'updatedAt'],squel[_0x9740('0x3b')]()['field']('phone',_0x9740('0x21'))[_0x9740('0x3c')]('NOW()','scheduledAt')[_0x9740('0x3c')]('id',_0x9740('0x3e'))['field'](LISTID[_0x9740('0x3f')](),_0x9740('0x29'))['field'](_0x23083f['id'][_0x9740('0x3f')](),_0x4f1685)[_0x9740('0x3c')](_0x9740('0x3d'),_0x9740('0x48'))['field']('NOW()',_0x9740('0x3a'))[_0x9740('0x40')](_0x9740('0x49'))[_0x9740('0x42')](_0x9740('0x41'))['where']('ListId\x20=\x20?',LISTID[_0x9740('0x3f')]())[_0x9740('0x42')](_0x9740('0x4a'),squel['str'](hopperContacts))[_0x9740('0x42')](_0x9740('0x43'))['where'](_0x9740('0x44'),squel[_0x9740('0x3b')]()[_0x9740('0x3c')]('calleridnum')['from']('cm_hopper_final')['where'](_0x4f1685+_0x9740('0x45'),_0x23083f['id'][_0x9740('0x3f')]()))[_0x9740('0x42')](_0x9740('0x44'),squel[_0x9740('0x3b')]()[_0x9740('0x3c')](_0x9740('0x21'))[_0x9740('0x40')](_0x9740('0x38'))[_0x9740('0x42')](_0x4f1685+_0x9740('0x45'),_0x23083f['id'][_0x9740('0x3f')]())))[_0x9740('0x3f')]();return _0x1c8de7;};function _0x1aeac9(_0x103d07,_0x1513e9){var _0x3fda47=squel[_0x9740('0x37')]()[_0x9740('0x46')](_0x9740('0x38'))['fromQuery'](['phone',_0x9740('0x39'),_0x9740('0x3e'),'ListId',_0x1513e9,_0x9740('0x48'),_0x9740('0x3a')],squel[_0x9740('0x3b')]()[_0x9740('0x3c')](_0x9740('0x21'),_0x9740('0x21'))[_0x9740('0x3c')](_0x9740('0x3d'),_0x9740('0x39'))[_0x9740('0x3c')]('id','ContactId')[_0x9740('0x3c')](LISTID[_0x9740('0x3f')](),_0x9740('0x29'))[_0x9740('0x3c')](_0x103d07['id'][_0x9740('0x3f')](),_0x1513e9)[_0x9740('0x3c')](_0x9740('0x3d'),_0x9740('0x48'))[_0x9740('0x3c')]('NOW()',_0x9740('0x3a'))[_0x9740('0x40')](_0x9740('0x49'))[_0x9740('0x42')](_0x9740('0x41'))[_0x9740('0x42')]('ListId\x20=\x20?',LISTID[_0x9740('0x3f')]())['where']('id\x20IN\x20?',squel[_0x9740('0x4b')](hopperContacts))[_0x9740('0x42')](_0x9740('0x43')))[_0x9740('0x3f')]();return _0x3fda47;}function _0x36e4e5(_0x3519e1,_0x2984d9){var _0x2270e3=squel['insert']()[_0x9740('0x46')](_0x9740('0x4c'))[_0x9740('0x47')]([_0x9740('0x21'),_0x9740('0x3e'),'ListId',_0x2984d9,_0x9740('0x48'),_0x9740('0x3a')],squel[_0x9740('0x3b')]()[_0x9740('0x3c')](_0x9740('0x21'),'phone')[_0x9740('0x3c')]('id',_0x9740('0x3e'))['field'](LISTID[_0x9740('0x3f')](),_0x9740('0x29'))[_0x9740('0x3c')](_0x3519e1['id'][_0x9740('0x3f')](),_0x2984d9)['field'](_0x9740('0x3d'),_0x9740('0x48'))[_0x9740('0x3c')](_0x9740('0x3d'),_0x9740('0x3a'))[_0x9740('0x40')](_0x9740('0x49'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x9740('0x4d'),LISTID[_0x9740('0x3f')]())[_0x9740('0x42')](_0x9740('0x4a'),squel[_0x9740('0x4b')](hopperContacts))['where'](_0x9740('0x43')))[_0x9740('0x3f')]();return _0x2270e3;}return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x9740('0x4e')],'include':[{'model':db[_0x9740('0x4f')],'as':_0x9740('0x50'),'where':{'id':LISTID}}]})[_0x9740('0x30')](function(_0x35d6db){var _0x4a30fd=[];if(_0x35d6db){var _0x42db9c;for(var _0x31d620=0x0,_0x16088a;_0x31d620<_0x35d6db[_0x9740('0x19')];_0x31d620+=0x1){_0x16088a=_0x35d6db[_0x31d620][_0x9740('0x51')]({'plain':!![]});switch(_0x16088a['dialCheckDuplicateType']){case _0x9740('0x52'):_0x4a30fd[_0x9740('0x31')](db[_0x9740('0x53')][_0x9740('0x54')](_0x56a7fc(_0x16088a,_0x9740('0x55')))[_0x9740('0x30')](function(){})[_0x9740('0x33')](_0x443b74()));break;case _0x9740('0x56'):_0x4a30fd[_0x9740('0x31')](db[_0x9740('0x53')][_0x9740('0x54')](_0x20884b(_0x16088a,_0x9740('0x55')))[_0x9740('0x30')](function(){})[_0x9740('0x33')](_0x443b74()));break;default:_0x4a30fd[_0x9740('0x31')](db[_0x9740('0x53')][_0x9740('0x54')](_0x1aeac9(_0x16088a,'VoiceQueueId'))[_0x9740('0x30')](function(){})['catch'](_0x443b74()));}}}return _0x4a30fd;})['all']()[_0x9740('0x30')](function(){return db['VoiceQueue'][_0x9740('0x57')]({'where':{'type':_0x9740('0x58')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x58486b){var _0x5ee374=[];if(_0x58486b){var _0x373685;for(var _0x3f7476=0x0,_0x245a8e;_0x3f7476<_0x58486b[_0x9740('0x19')];_0x3f7476+=0x1){_0x245a8e=_0x58486b[_0x3f7476][_0x9740('0x51')]({'plain':!![]});_0x5ee374[_0x9740('0x31')](db[_0x9740('0x53')][_0x9740('0x54')](_0x36e4e5(_0x245a8e,_0x9740('0x55')))[_0x9740('0x30')](function(){})[_0x9740('0x33')](_0x443b74()));}}return _0x5ee374;})[_0x9740('0x59')]();})[_0x9740('0x30')](function(){return db[_0x9740('0x5a')][_0x9740('0x57')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x9740('0x4f')],'as':_0x9740('0x50'),'where':{'id':LISTID}}]})[_0x9740('0x30')](function(_0x256928){var _0x5e440f=[];if(_0x256928){for(var _0x40a744=0x0,_0x4961fe;_0x40a744<_0x256928[_0x9740('0x19')];_0x40a744+=0x1){_0x4961fe=_0x256928[_0x40a744][_0x9740('0x51')]({'plain':!![]});switch(_0x4961fe[_0x9740('0x4e')]){case _0x9740('0x52'):_0x5e440f[_0x9740('0x31')](db[_0x9740('0x53')][_0x9740('0x54')](_0x56a7fc(_0x4961fe,_0x9740('0x5b')))['then'](function(){})[_0x9740('0x33')](_0x443b74()));break;case'onlyIfOpen':_0x5e440f[_0x9740('0x31')](db['sequelize'][_0x9740('0x54')](_0x20884b(_0x4961fe,'CampaignId'))['then'](function(){})[_0x9740('0x33')](_0x443b74()));break;default:_0x5e440f[_0x9740('0x31')](db[_0x9740('0x53')][_0x9740('0x54')](_0x1aeac9(_0x4961fe,_0x9740('0x5b')))[_0x9740('0x30')](function(){})[_0x9740('0x33')](_0x443b74()));}}}return _0x5e440f;})[_0x9740('0x59')]();})[_0x9740('0x30')](function(){return db[_0x9740('0x5a')][_0x9740('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x9740('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x29a400){var _0x160416=[];if(_0x29a400){for(var _0x8b9203=0x0,_0x1cb70e;_0x8b9203<_0x29a400[_0x9740('0x19')];_0x8b9203+=0x1){_0x1cb70e=_0x29a400[_0x8b9203][_0x9740('0x51')]({'plain':!![]});_0x160416[_0x9740('0x31')](db[_0x9740('0x53')][_0x9740('0x54')](_0x36e4e5(_0x1cb70e,_0x9740('0x5b')))[_0x9740('0x30')](function(){})[_0x9740('0x33')](_0x443b74()));}}return _0x160416;})[_0x9740('0x59')]();})[_0x9740('0x33')](function(_0x514a04){logger[_0x9740('0x13')](_0x9740('0x5d'),_0x9740('0x5e'),_0x514a04['message']);});}var processPromises=function(_0x3953ea){return BPromise['all'](promises)['then'](function(_0x5d2b02){})[_0x9740('0x33')](function(_0x29e62d){logger[_0x9740('0x13')](_0x9740('0x5f'),JSON[_0x9740('0x34')](_0x29e62d));})[_0x9740('0x60')](function(){socket[_0x9740('0x61')](_0x9740('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3953ea){return _0x3953ea['resume']();}});};var endCsv=function(){return BPromise[_0x9740('0x63')]()[_0x9740('0x30')](function(){if(hopperContacts){return checkHopper();}})[_0x9740('0x30')](function(){socket['emit'](_0x9740('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x9740('0x64')](FILEPATH);}catch(_0x2c17ee){logger['error'](_0x9740('0x65'),JSON[_0x9740('0x34')](_0x2c17ee));}finally{process[_0x9740('0x66')](0x0);}});};process['on'](_0x9740('0x67'),function(){logger[_0x9740('0x68')](_0x9740('0x69'));endCsv();});function main(){return BPromise[_0x9740('0x63')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x9740('0x11')](',');return db['CmContact'][_0x9740('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x446fca){var _0x1b93c5=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x9740('0x6a')](_0x1b93c5,{'header':!![],'skipEmptyLines':!![],'step':function(_0x36158c,_0x401041){total+=0x1;var _0x9110c1=total;promises[_0x9740('0x31')](checkRow(_0x36158c,_0x446fca,_0x9110c1)[_0x9740('0x30')](function(){success+=0x1;})[_0x9740('0x33')](function(_0x145707){if(_0x145707[_0x9740('0x13')]){errors+=0x1;delete _0x145707[_0x9740('0x13')];}else if(_0x145707[_0x9740('0x2b')]){duplicates+=0x1;delete _0x145707[_0x9740('0x2b')];}rows[_0x9740('0x31')](_0x145707);}));if(total%0xc8===0x0){_0x401041[_0x9740('0x6b')]();return processPromises(_0x401041);}},'complete':function(){return processPromises()[_0x9740('0x30')](function(){logger[_0x9740('0x68')](_0x9740('0x6c'));endCsv();});},'error':function(_0xde4a8b,_0x4dacca){logger[_0x9740('0x68')](_0x9740('0x6d'),JSON[_0x9740('0x34')](_0xde4a8b));endCsv();}});})[_0x9740('0x33')](function(_0x93999a){logger['error'](_0x9740('0x6e'),JSON[_0x9740('0x34')](_0x93999a));});}main(); \ No newline at end of file +var _0xf55d=['into','cm_hopper','scheduledAt','ContactId','select','NOW()','field','toString','createdAt','updatedAt','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','deletedAt\x20IS\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','split','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','undefined','Missing\x20filepath\x20parameter!','argv','null','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','map','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert'];(function(_0x3c126c,_0x22f353){var _0x3b89e4=function(_0x1472c0){while(--_0x1472c0){_0x3c126c['push'](_0x3c126c['shift']());}};_0x3b89e4(++_0x22f353);}(_0xf55d,0xa7));var _0xdf55=function(_0x5607c5,_0x30a032){_0x5607c5=_0x5607c5-0x0;var _0x3eb0cf=_0xf55d[_0x5607c5];return _0x3eb0cf;};'use strict';var BPromise=require(_0xdf55('0x0'));var util=require('util');var _=require(_0xdf55('0x1'));var fs=require('fs');var squel=require(_0xdf55('0x2'));var Papa=require(_0xdf55('0x3'));var Redis=require('ioredis');var db=require(_0xdf55('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xdf55('0x5'))(_0xdf55('0x6'));config[_0xdf55('0x7')]=_[_0xdf55('0x8')](config[_0xdf55('0x7')],{'host':_0xdf55('0x9'),'port':0x18eb});var socket=require(_0xdf55('0xa'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0xdf55('0xb')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xdf55('0xc')||process['argv'][0x2]==='null'){throw new Error(_0xdf55('0xd'));}var FILEPATH=process[_0xdf55('0xe')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process[_0xdf55('0xe')][0x3]===_0xdf55('0xf')||!process[_0xdf55('0xe')][0x4]||process[_0xdf55('0xe')][0x4]===_0xdf55('0xc')||process[_0xdf55('0xe')][0x4]===_0xdf55('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0xdf55('0xe')][0x3]['split'](','),process[_0xdf55('0xe')][0x4]['split'](','));if(!process[_0xdf55('0xe')][0x5]||process[_0xdf55('0xe')][0x5]==='undefined'||process[_0xdf55('0xe')][0x5]===_0xdf55('0xf')){throw new Error(_0xdf55('0x10'));}var LISTID=process[_0xdf55('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0xdf55('0xc')&&process[_0xdf55('0xe')][0x6]!==_0xdf55('0xf')?process[_0xdf55('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xdf55('0xe')][0x7]!==_0xdf55('0xc')&&process[_0xdf55('0xe')][0x7]!==_0xdf55('0xf')?process[_0xdf55('0xe')][0x7]:null;if(!process[_0xdf55('0xe')][0x8]||process[_0xdf55('0xe')][0x8]===_0xdf55('0xc')||process[_0xdf55('0xe')][0x8]===_0xdf55('0xf')){throw new Error(_0xdf55('0x11'));}var SOCKET_TIMESTAMP=process[_0xdf55('0xe')][0x8];}catch(_0x17a4ae){logger[_0xdf55('0x12')](_0x17a4ae);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x13ffbc,_0x4a179f,_0x274edf,_0x1372d5){var _0x23869d={'message':_0x4a179f};_0x23869d[_0x13ffbc]=!![];if(_0x274edf){_0x23869d[_0xdf55('0x13')]=_0x274edf;}if(_0x1372d5){_0x23869d[_0xdf55('0x14')]=_0x1372d5;}return _0x23869d;}function isEmail(_0x24f176){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xdf55('0x15')](_0x24f176);}function checkRow(_0x234775,_0x5069fb,_0x40493d){return new BPromise(function(_0x12e393,_0x4b4a37){if(_[_0xdf55('0x16')](_0x234775)){return _0x4b4a37(handleCheckRowError(_0xdf55('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x40493d));}if(_0x234775[_0xdf55('0x17')]&&_0x234775[_0xdf55('0x17')][_0xdf55('0x18')]){var _0xf32bdd=_[_0xdf55('0x19')](_0x234775[_0xdf55('0x17')],'message')[_0xdf55('0x1a')](';');return _0x4b4a37(handleCheckRowError(_0xdf55('0x12'),_0xf32bdd,null,_0x40493d));}var _0x4f3615={};for(var _0x19f135 in FIELDS){if(FIELDS[_0xdf55('0x1b')](_0x19f135)&&FIELDS[_0x19f135]){_0x4f3615[_0x19f135]=_0x234775['data'][0x0][FIELDS[_0x19f135]]||_0x234775[_0xdf55('0x1c')][0x0]['\ufeff'+FIELDS[_0x19f135]];}}if(!_0x4f3615[_0xdf55('0x1d')]){return _0x4b4a37(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x40493d));}if(!_0x4f3615[_0xdf55('0x1e')]){return _0x4b4a37(handleCheckRowError(_0xdf55('0x12'),_0xdf55('0x1f'),null,_0x40493d));}if(_0x4f3615[_0xdf55('0x20')]){var _0x47f635=moment(_0x4f3615['birthDate'],_0xdf55('0x21'));if(!_0x47f635[_0xdf55('0x22')]()){return _0x4b4a37(handleCheckRowError(_0xdf55('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x40493d));}}if(_0x4f3615['email']){if(!isEmail(_0x4f3615['email'])){return _0x4b4a37(handleCheckRowError('error',_0xdf55('0x23'),null,_0x40493d));}}_0x4f3615[_0xdf55('0x24')]=LISTID;_0x4f3615[_0xdf55('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5069fb){var _0x1419a0={};for(var _0x1efb0a=0x0,_0x5adbb1=DUPLICATES[_0xdf55('0x18')];_0x1efb0a<_0x5adbb1;_0x1efb0a+=0x1){_0x1419a0[DUPLICATES[_0x1efb0a]]=_0x4f3615[DUPLICATES[_0x1efb0a]];}var _0x15f729=_['find'](_0x5069fb,_0x1419a0);if(_0x15f729){return _0x4b4a37(handleCheckRowError(_0xdf55('0x26'),'Duplicate\x20Contact',_0x15f729,_0x40493d));}}return db[_0xdf55('0x27')][_0xdf55('0x28')](_0x4f3615,{'raw':!![],'hooks':![],'fields':_[_0xdf55('0x29')](_0x4f3615)})[_0xdf55('0x2a')](function(_0x27aa0d){if(DUPLICATES&&DUPLICATES[_0xdf55('0x18')]&&_0x5069fb){_0x5069fb['push'](_['pick'](_0x4f3615,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x27aa0d['id'];return _0x12e393();})[_0xdf55('0x2b')](function(_0x29cb71){return _0x4b4a37(handleCheckRowError(_0xdf55('0x12'),_0xdf55('0x2c')+(_0x29cb71[_0xdf55('0x2d')]||JSON[_0xdf55('0x2e')](_0x29cb71)),null,_0x40493d));});});}function checkHopper(){function _0x7f8fa(){return function(_0xbbf31){logger[_0xdf55('0x12')](_0xdf55('0x2f'),_0xdf55('0x30'),util[_0xdf55('0x31')](_0xbbf31,{'showHidden':![],'depth':null}));};}var _0x4a3674=function(_0x5cd064,_0x3869d1){var _0xbcdb4d=squel[_0xdf55('0x32')]()[_0xdf55('0x33')](_0xdf55('0x34'))['fromQuery']([_0xdf55('0x1e'),_0xdf55('0x35'),_0xdf55('0x36'),_0xdf55('0x24'),_0x3869d1,'createdAt','updatedAt'],squel[_0xdf55('0x37')]()['field'](_0xdf55('0x1e'),'phone')['field'](_0xdf55('0x38'),_0xdf55('0x35'))[_0xdf55('0x39')]('id','ContactId')[_0xdf55('0x39')](LISTID[_0xdf55('0x3a')](),_0xdf55('0x24'))[_0xdf55('0x39')](_0x5cd064['id']['toString'](),_0x3869d1)[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x3b'))[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x3c'))[_0xdf55('0x3d')](_0xdf55('0x3e'))['where']('deletedAt\x20IS\x20NULL')[_0xdf55('0x3f')](_0xdf55('0x40'),LISTID[_0xdf55('0x3a')]())['where'](_0xdf55('0x41'))['where'](_0xdf55('0x42'),squel[_0xdf55('0x37')]()[_0xdf55('0x39')](_0xdf55('0x1e'))['from']('cm_hopper')['where'](_0x3869d1+_0xdf55('0x43'),_0x5cd064['id'][_0xdf55('0x3a')]())))[_0xdf55('0x3a')]();return _0xbcdb4d;};var _0x1ec09a=function(_0x370193,_0x19d90c){var _0x5e39a2=squel[_0xdf55('0x32')]()[_0xdf55('0x33')](_0xdf55('0x34'))[_0xdf55('0x44')]([_0xdf55('0x1e'),'scheduledAt',_0xdf55('0x36'),'ListId',_0x19d90c,_0xdf55('0x3b'),'updatedAt'],squel[_0xdf55('0x37')]()['field']('phone',_0xdf55('0x1e'))[_0xdf55('0x39')]('NOW()',_0xdf55('0x35'))[_0xdf55('0x39')]('id',_0xdf55('0x36'))[_0xdf55('0x39')](LISTID[_0xdf55('0x3a')](),_0xdf55('0x24'))[_0xdf55('0x39')](_0x370193['id'][_0xdf55('0x3a')](),_0x19d90c)[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x3b'))['field'](_0xdf55('0x38'),_0xdf55('0x3c'))[_0xdf55('0x3d')](_0xdf55('0x3e'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0xdf55('0x3a')]())['where'](_0xdf55('0x45'),squel[_0xdf55('0x46')](hopperContacts))[_0xdf55('0x3f')](_0xdf55('0x41'))['where'](_0xdf55('0x42'),squel[_0xdf55('0x37')]()[_0xdf55('0x39')](_0xdf55('0x47'))[_0xdf55('0x3d')](_0xdf55('0x48'))[_0xdf55('0x3f')](_0x19d90c+_0xdf55('0x43'),_0x370193['id']['toString']()))[_0xdf55('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdf55('0x37')]()['field'](_0xdf55('0x1e'))[_0xdf55('0x3d')](_0xdf55('0x34'))[_0xdf55('0x3f')](_0x19d90c+_0xdf55('0x43'),_0x370193['id']['toString']())))[_0xdf55('0x3a')]();return _0x5e39a2;};function _0x4c1704(_0x4234c5,_0x2f90d9){var _0x4e5f20=squel[_0xdf55('0x32')]()[_0xdf55('0x33')](_0xdf55('0x34'))[_0xdf55('0x44')]([_0xdf55('0x1e'),_0xdf55('0x35'),_0xdf55('0x36'),_0xdf55('0x24'),_0x2f90d9,_0xdf55('0x3b'),_0xdf55('0x3c')],squel[_0xdf55('0x37')]()[_0xdf55('0x39')]('phone','phone')[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x35'))[_0xdf55('0x39')]('id',_0xdf55('0x36'))['field'](LISTID[_0xdf55('0x3a')](),'ListId')[_0xdf55('0x39')](_0x4234c5['id'][_0xdf55('0x3a')](),_0x2f90d9)[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x3b'))['field']('NOW()',_0xdf55('0x3c'))[_0xdf55('0x3d')](_0xdf55('0x3e'))[_0xdf55('0x3f')](_0xdf55('0x49'))['where'](_0xdf55('0x40'),LISTID[_0xdf55('0x3a')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0xdf55('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0xdf55('0x3a')]();return _0x4e5f20;}function _0x401e8c(_0x48ff2b,_0x5bce0d){var _0x463794=squel[_0xdf55('0x32')]()['into'](_0xdf55('0x4a'))[_0xdf55('0x44')]([_0xdf55('0x1e'),_0xdf55('0x36'),_0xdf55('0x24'),_0x5bce0d,_0xdf55('0x3b'),_0xdf55('0x3c')],squel[_0xdf55('0x37')]()[_0xdf55('0x39')]('phone','phone')[_0xdf55('0x39')]('id',_0xdf55('0x36'))['field'](LISTID[_0xdf55('0x3a')](),_0xdf55('0x24'))[_0xdf55('0x39')](_0x48ff2b['id']['toString'](),_0x5bce0d)[_0xdf55('0x39')](_0xdf55('0x38'),'createdAt')[_0xdf55('0x39')](_0xdf55('0x38'),_0xdf55('0x3c'))[_0xdf55('0x3d')]('cm_contacts')[_0xdf55('0x3f')](_0xdf55('0x49'))['where'](_0xdf55('0x40'),LISTID[_0xdf55('0x3a')]())[_0xdf55('0x3f')]('id\x20IN\x20?',squel[_0xdf55('0x46')](hopperContacts))[_0xdf55('0x3f')](_0xdf55('0x41')))[_0xdf55('0x3a')]();return _0x463794;}return db[_0xdf55('0x4b')][_0xdf55('0x4c')]({'where':{'type':_0xdf55('0x4d')},'attributes':['id',_0xdf55('0x4e')],'include':[{'model':db[_0xdf55('0x4f')],'as':_0xdf55('0x50'),'where':{'id':LISTID}}]})[_0xdf55('0x2a')](function(_0x49d1b2){var _0x4e713b=[];if(_0x49d1b2){var _0x3de3e3;for(var _0x870789=0x0,_0x44cf63;_0x870789<_0x49d1b2[_0xdf55('0x18')];_0x870789+=0x1){_0x44cf63=_0x49d1b2[_0x870789][_0xdf55('0x51')]({'plain':!![]});switch(_0x44cf63[_0xdf55('0x4e')]){case _0xdf55('0x52'):_0x4e713b[_0xdf55('0x53')](db[_0xdf55('0x54')][_0xdf55('0x55')](_0x1ec09a(_0x44cf63,_0xdf55('0x56')))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));break;case _0xdf55('0x57'):_0x4e713b[_0xdf55('0x53')](db['sequelize']['query'](_0x4a3674(_0x44cf63,_0xdf55('0x56')))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));break;default:_0x4e713b[_0xdf55('0x53')](db[_0xdf55('0x54')][_0xdf55('0x55')](_0x4c1704(_0x44cf63,_0xdf55('0x56')))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));}}}return _0x4e713b;})['all']()[_0xdf55('0x2a')](function(){return db[_0xdf55('0x4b')][_0xdf55('0x4c')]({'where':{'type':_0xdf55('0x4d')},'attributes':['id'],'include':[{'model':db[_0xdf55('0x4f')],'as':_0xdf55('0x58'),'where':{'id':LISTID}}]})[_0xdf55('0x2a')](function(_0x57bdc2){var _0x2f0ccc=[];if(_0x57bdc2){var _0x439e7e;for(var _0x3dbfc3=0x0,_0x3e9d8e;_0x3dbfc3<_0x57bdc2[_0xdf55('0x18')];_0x3dbfc3+=0x1){_0x3e9d8e=_0x57bdc2[_0x3dbfc3]['get']({'plain':!![]});_0x2f0ccc['push'](db['sequelize'][_0xdf55('0x55')](_0x401e8c(_0x3e9d8e,'VoiceQueueId'))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));}}return _0x2f0ccc;})[_0xdf55('0x59')]();})[_0xdf55('0x2a')](function(){return db[_0xdf55('0x5a')][_0xdf55('0x4c')]({'attributes':['id',_0xdf55('0x4e')],'include':[{'model':db[_0xdf55('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0xdf55('0x2a')](function(_0x146a20){var _0x4d3730=[];if(_0x146a20){for(var _0x5ad104=0x0,_0x507ea9;_0x5ad104<_0x146a20[_0xdf55('0x18')];_0x5ad104+=0x1){_0x507ea9=_0x146a20[_0x5ad104][_0xdf55('0x51')]({'plain':!![]});switch(_0x507ea9[_0xdf55('0x4e')]){case _0xdf55('0x52'):_0x4d3730[_0xdf55('0x53')](db['sequelize'][_0xdf55('0x55')](_0x1ec09a(_0x507ea9,_0xdf55('0x5b')))[_0xdf55('0x2a')](function(){})['catch'](_0x7f8fa()));break;case _0xdf55('0x57'):_0x4d3730[_0xdf55('0x53')](db[_0xdf55('0x54')][_0xdf55('0x55')](_0x4a3674(_0x507ea9,'CampaignId'))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));break;default:_0x4d3730[_0xdf55('0x53')](db[_0xdf55('0x54')][_0xdf55('0x55')](_0x4c1704(_0x507ea9,'CampaignId'))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));}}}return _0x4d3730;})[_0xdf55('0x59')]();})[_0xdf55('0x2a')](function(){return db[_0xdf55('0x5a')][_0xdf55('0x4c')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xdf55('0x58'),'where':{'id':LISTID}}]})[_0xdf55('0x2a')](function(_0x29c7b5){var _0x455281=[];if(_0x29c7b5){for(var _0x126fb0=0x0,_0x2a7b35;_0x126fb0<_0x29c7b5[_0xdf55('0x18')];_0x126fb0+=0x1){_0x2a7b35=_0x29c7b5[_0x126fb0]['get']({'plain':!![]});_0x455281['push'](db['sequelize']['query'](_0x401e8c(_0x2a7b35,_0xdf55('0x5b')))[_0xdf55('0x2a')](function(){})[_0xdf55('0x2b')](_0x7f8fa()));}}return _0x455281;})['all']();})[_0xdf55('0x2b')](function(_0x2f640d){logger['error'](_0xdf55('0x5c'),_0xdf55('0x5d'),_0x2f640d[_0xdf55('0x2d')]);});}var processPromises=function(_0x231150){return BPromise[_0xdf55('0x59')](promises)[_0xdf55('0x2a')](function(_0x49b7e8){})[_0xdf55('0x2b')](function(_0x3c5a64){logger[_0xdf55('0x12')]('Error\x20processing\x20rows\x20block:',JSON[_0xdf55('0x2e')](_0x3c5a64));})[_0xdf55('0x5e')](function(){socket[_0xdf55('0x5f')](_0xdf55('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x231150){return _0x231150[_0xdf55('0x61')]();}});};var endCsv=function(){return BPromise[_0xdf55('0x62')]()[_0xdf55('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xdf55('0x2a')](function(){socket[_0xdf55('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xdf55('0x63')](FILEPATH);}catch(_0x3a7146){logger['error'](_0xdf55('0x64'),JSON['stringify'](_0x3a7146));}finally{process['exit'](0x0);}});};process['on'](_0xdf55('0x65'),function(){logger[_0xdf55('0x66')](_0xdf55('0x67'));endCsv();});function main(){return BPromise[_0xdf55('0x62')]()[_0xdf55('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xdf55('0x68')](',');return db['CmContact'][_0xdf55('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xdf55('0x2a')](function(_0x596d67){var _0x2c0942=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xdf55('0x69')](_0x2c0942,{'header':!![],'skipEmptyLines':!![],'step':function(_0x23adf9,_0x25482e){total+=0x1;var _0x428af6=total;promises[_0xdf55('0x53')](checkRow(_0x23adf9,_0x596d67,_0x428af6)[_0xdf55('0x2a')](function(){success+=0x1;})['catch'](function(_0x16a6d7){if(_0x16a6d7[_0xdf55('0x12')]){errors+=0x1;delete _0x16a6d7['error'];}else if(_0x16a6d7[_0xdf55('0x26')]){duplicates+=0x1;delete _0x16a6d7[_0xdf55('0x26')];}rows[_0xdf55('0x53')](_0x16a6d7);}));if(total%0xc8===0x0){_0x25482e['pause']();return processPromises(_0x25482e);}},'complete':function(){return processPromises()[_0xdf55('0x2a')](function(){logger['info'](_0xdf55('0x6a'));endCsv();});},'error':function(_0x44473a,_0x560509){logger[_0xdf55('0x66')](_0xdf55('0x6b'),JSON[_0xdf55('0x2e')](_0x44473a));endCsv();}});})[_0xdf55('0x2b')](function(_0x295a70){logger[_0xdf55('0x12')](_0xdf55('0x6c'),JSON['stringify'](_0x295a70));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 484f446..967bf71 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 _0x2694=['push','catch','main','stringify','start','binding','socket_timestamp','root','server/files/tmp','keys','header','writeFileSync','parse','createReadStream','data','length','hasOwnProperty','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','rows','emit','contact:import:','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','CampaignId','campaigns_has_cm_blacklists','campaigns','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','ListId','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','insert','cm_hopper_black','createdAt','updatedAt','ListId\x20=\x20?','\x20=\x20?','concat','into',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query'];(function(_0x19a2d3,_0xa762ee){var _0x500564=function(_0x35fa9b){while(--_0x35fa9b){_0x19a2d3['push'](_0x19a2d3['shift']());}};_0x500564(++_0xa762ee);}(_0x2694,0x151));var _0x4269=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2694[_0x3b380d];return _0x54502b;};'use strict';var fs=require('fs');var path=require(_0x4269('0x0'));var _=require('lodash');var Papa=require(_0x4269('0x1'));var util=require(_0x4269('0x2'));var BPromise=require(_0x4269('0x3'));var moment=require(_0x4269('0x4'));var squel=require(_0x4269('0x5'));var Redis=require('ioredis');var db=require(_0x4269('0x6'))['db'];var config=require(_0x4269('0x7'));var logger=require(_0x4269('0x8'))(_0x4269('0x9'));config['redis']=_['defaults'](config[_0x4269('0xa')],{'host':_0x4269('0xb'),'port':0x18eb});var socket=require(_0x4269('0xc'))(new Redis(config[_0x4269('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x4269('0xd')](_0x4269('0xe'));function isEmail(_0x56f44c){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))*$/[_0x4269('0xf')](_0x56f44c);}function selectNotIn(_0x2d8c8a,_0xb1c6ee,_0x2ea128,_0xb2fcf5,_0x1da041){return squel[_0x4269('0x10')]()[_0x4269('0x11')](_0x4269('0x12'))[_0x4269('0x13')](_0xb2fcf5)[_0x4269('0x14')](_0xb1c6ee,null,_0xb1c6ee+'.id\x20=\x20'+_0xb2fcf5+'.'+_0x2ea128)[_0x4269('0x15')](_0xb2fcf5+'.'+_0x2ea128+'\x20=\x20'+_0x2d8c8a+'.'+_0x2ea128)[_0x4269('0x15')](_0xb1c6ee+_0x4269('0x16')+_0x1da041['join']()+')');}function insertCmHopper(_0xd12874,_0x546d74,_0xfdd4ca,_0x388ccb,_0x1b23b4){var _0xbd143e=[_0x4269('0x17'),_0x4269('0x18'),_0x4269('0x19'),_0x4269('0x1a'),_0x546d74+'.'+_0x388ccb,_0x4269('0x1b'),'cm_contacts.updatedAt',_0x4269('0x1c'),_0x4269('0x1d'),'\x22'+_0x1b23b4+'\x22'];return squel['insert']()['into'](_0x4269('0x1e'))[_0x4269('0x1f')]([_0x4269('0x12'),'scheduledat','ContactId',_0x4269('0x20'),_0x388ccb,'createdAt','updatedAt',_0x4269('0x21'),_0x4269('0x22'),_0x4269('0x23')],squel[_0x4269('0x10')]()[_0x4269('0x24')](_0xbd143e)[_0x4269('0x13')](_0x546d74)['join'](_0x4269('0x25'),null,_0x4269('0x26')+_0x546d74+_0x4269('0x27'))['join'](_0xfdd4ca,null,_0xfdd4ca+_0x4269('0x28')+_0x546d74+'.'+_0x388ccb)[_0x4269('0x15')](_0x546d74+_0x4269('0x29'),_0xd12874)[_0x4269('0x15')](_0x4269('0x2a'),NOW)[_0x4269('0x15')](_0x4269('0x2b'),selectNotIn(_0x546d74,_0xfdd4ca,_0x388ccb,_0x4269('0x1e'),[_0x4269('0x2c'),_0x4269('0x2d')]))[_0x4269('0x15')](_0x4269('0x2b'),selectNotIn(_0x546d74,_0xfdd4ca,_0x388ccb,_0x4269('0x1e'),[_0x4269('0x2c')])))[_0x4269('0x2e')]();}function insertCmHopperBlack(_0x505ba2,_0x1a38e4,_0x1ea034,_0x5dad0d){var _0xeabdce=[_0x4269('0x17'),_0x4269('0x19'),'cm_contacts.ListId',_0x1a38e4+'.'+_0x5dad0d,_0x4269('0x1b'),_0x4269('0x2f')];return squel[_0x4269('0x30')]()['into'](_0x4269('0x31'))[_0x4269('0x1f')]([_0x4269('0x12'),'ContactId',_0x4269('0x20'),_0x5dad0d,_0x4269('0x32'),_0x4269('0x33')],squel[_0x4269('0x10')]()['fields'](_0xeabdce)['from'](_0x1a38e4)[_0x4269('0x14')](_0x4269('0x25'),null,_0x4269('0x26')+_0x1a38e4+_0x4269('0x27'))[_0x4269('0x14')](_0x1ea034,null,_0x1ea034+_0x4269('0x28')+_0x1a38e4+'.'+_0x5dad0d)['where'](_0x1a38e4+_0x4269('0x29'),_0x505ba2)[_0x4269('0x15')](_0x4269('0x2a'),NOW)[_0x4269('0x15')](_0x4269('0x2b'),squel['select']()[_0x4269('0x11')]('phone')[_0x4269('0x13')](_0x4269('0x31'))[_0x4269('0x15')](_0x4269('0x34'),_0x505ba2)[_0x4269('0x15')](_0x5dad0d+_0x4269('0x35'),_0x1a38e4+'.'+_0x5dad0d)))['toString']();}function insertCmContact(_0x55af02,_0x2cdec6,_0x10f062,_0x3af4f9){var _0x1fa35f=_[_0x4269('0x36')](_['keys'](_0x3af4f9),[_0x4269('0x20'),'CompanyId',_0x4269('0x32'),'updatedAt']);return squel[_0x4269('0x30')]()[_0x4269('0x37')](_0x4269('0x25'))[_0x4269('0x1f')](_0x1fa35f,squel[_0x4269('0x10')]()[_0x4269('0x24')](_0x1fa35f)['from'](_0x2cdec6)[_0x4269('0x15')]('('+_0x10f062[_0x4269('0x14')](',')+_0x4269('0x38'),squel['select']()[_0x4269('0x24')](_0x10f062)[_0x4269('0x13')]('cm_contacts')['where'](_0x4269('0x34'),_0x55af02)['where'](_0x4269('0x39')))['where'](_0x4269('0x3a'),squel[_0x4269('0x10')]()[_0x4269('0x11')](_0x4269('0x3b'),_0x4269('0x3c'))[_0x4269('0x13')](_0x2cdec6)[_0x4269('0x3d')](_0x10f062['join'](','))))['toString']();}function handleStop(){logger[_0x4269('0x3e')](_0x4269('0x3f'));stopped=!![];}function handleUncaughtException(_0x5a3375){logger[_0x4269('0x40')](_0x5a3375[_0x4269('0x41')]);process[_0x4269('0x42')](0x1);}function handleError(_0x30d0cf,_0x2892c7){stats[_0x4269('0x43')]['push']({'name':_0x2892c7[_0x4269('0x44')],'message':_0x2892c7[_0x4269('0x41')],'row':_0x30d0cf});}function handleQuery(_0xda1401){logger['info'](_0xda1401);return db[_0x4269('0x45')][_0x4269('0x46')](_0xda1401)['spread'](function(_0x11e037){results[_0x4269('0x47')](_0x11e037);})[_0x4269('0x48')](function(_0x9f7643){logger[_0x4269('0x40')](_0x9f7643[_0x4269('0x41')]);});}function main(_0x334fa1,_0x23b2d9,_0x253039,_0x1e4354){logger[_0x4269('0x3e')](_0x4269('0x49'),_0x334fa1,JSON[_0x4269('0x4a')](_0x23b2d9));process['send'](_0x4269('0x4b'));var _0x2a6b45=_0x23b2d9[_0x4269('0x4c')];var _0x464ff4=_0x23b2d9[_0x4269('0x4d')];var _0x25c7be=path[_0x4269('0x14')](config[_0x4269('0x4e')],_0x4269('0x4f'),_0x464ff4+'.csv');var _0x531b40=_[_0x4269('0x50')](_0x2a6b45)[_0x4269('0x14')]();logger[_0x4269('0x3e')](_0x4269('0x51'),_0x531b40);fs[_0x4269('0x52')](_0x25c7be,_0x531b40+'\x0a');Papa[_0x4269('0x53')](fs[_0x4269('0x54')](_0x334fa1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1d083b,_0x2f8862){try{for(var _0x3f257b=0x0,_0x5d862d=[];_0x3f257b<_0x1d083b[_0x4269('0x55')][_0x4269('0x56')];_0x3f257b++){stats['rows']+=0x1;if(_0x1d083b[_0x4269('0x43')][_0x3f257b]){handleError(_0x1d083b[_0x4269('0x55')][_0x3f257b],_0x1d083b[_0x4269('0x43')][_0x3f257b]);}else{var _0xce74e0=[];for(var _0x3d9403 in _0x2a6b45){if(_0x2a6b45[_0x4269('0x57')](_0x3d9403)){if(_0x1d083b['data'][_0x3f257b][_0x2a6b45[_0x3d9403]]){var _0x2c8402=_['trim'](_0x1d083b[_0x4269('0x55')][_0x3f257b][_0x2a6b45[_0x3d9403]][_0x4269('0x58')](/"/g,'\x27'));switch(_0x3d9403){case _0x4269('0x59'):var _0x2309f5=moment(_0x2c8402,_0x4269('0xe'),!![]);if(_0x2309f5[_0x4269('0x5a')]()){_0x5d862d[_0x4269('0x47')]('\x22'+_0x2c8402+'\x22');}else{_0xce74e0[_0x4269('0x47')](_0x4269('0x5b'));}break;case _0x4269('0x21'):var _0x5e8005=parseInt(_0x2c8402);_0x2c8402=_['isNaN'](_0x5e8005)||_0x5e8005<0x0||_0x5e8005>0x4?_0x1e4354?0x3:0x2:_0x5e8005;_0x5d862d['push']('\x22'+_0x2c8402+'\x22');break;case'UserId':var _0x17efa2=parseInt(_0x2c8402);if(_[_0x4269('0x5c')](_0x17efa2)&&_[_0x4269('0x5d')](_0x253039,_0x17efa2)){_0x5d862d['push']('\x22'+_0x17efa2+'\x22');}else{_0xce74e0[_0x4269('0x47')](_0x4269('0x5e'));}break;case _0x4269('0x5f'):if(isEmail(_0x2c8402)){_0x5d862d['push']('\x22'+_0x2c8402+'\x22');}else{_0xce74e0[_0x4269('0x47')](_0x4269('0x60'));}break;case _0x4269('0x61'):var _0x531cbb=moment(_0x2c8402,_0x4269('0x62'),!![]);if(_0x531cbb['isValid']()){_0x5d862d[_0x4269('0x47')]('\x22'+_0x2c8402+'\x22');}else{_0xce74e0['push'](_0x4269('0x63'));}break;default:_0x5d862d[_0x4269('0x47')]('\x22'+_0x2c8402+'\x22');}}else{switch(_0x3d9403){case _0x4269('0x64'):case'phone':_0xce74e0['push'](_0x3d9403+_0x4269('0x65'));break;default:_0x5d862d[_0x4269('0x47')]('\x22\x22');}}}}if(_0xce74e0[_0x4269('0x56')]){handleError(_0x1d083b[_0x4269('0x55')][_0x3f257b],{'code':'SystemRow','message':_0xce74e0[_0x4269('0x14')]()});}else{fs['appendFileSync'](_0x25c7be,_0x5d862d[_0x4269('0x14')]()+'\x0a');}_0x5d862d=[];}if(!(stats[_0x4269('0x66')]%0xc8)){socket[_0x4269('0x67')](_0x4269('0x68')+_0x464ff4,stats);stats['errors']=[];}}if(stopped){logger[_0x4269('0x3e')]('Abort\x20parser');_0x2f8862[_0x4269('0x69')]();}}catch(_0x4dd804){handleError(_0x1d083b[_0x4269('0x55')][_0x3f257b],{'code':'SystemError','message':_0x4dd804[_0x4269('0x41')]});logger[_0x4269('0x40')](_0x4269('0x6a'),_0x4dd804[_0x4269('0x41')]);}},'complete':function(){try{var _0x1980aa=[];var _0x1546d9=_0x4269('0x25');if(_0x23b2d9[_0x4269('0x6b')]&&_0x23b2d9[_0x4269('0x6b')][_0x4269('0x56')]){_0x1546d9=_0x4269('0x6c')+_0x464ff4;_0x1980aa[_0x4269('0x47')](_0x4269('0x6d')+_0x1546d9+_0x4269('0x6e'));}var _0xfb396f=util[_0x4269('0xd')](_0x4269('0x6f'),_0x25c7be,_0x1546d9,_0x531b40,_0x23b2d9[_0x4269('0x20')],_0x23b2d9[_0x4269('0x70')]||null,NOW,NOW);if(_[_0x4269('0x71')](_0x2a6b45[_0x4269('0x59')])){_0xfb396f+=_0x4269('0x72');}_0x1980aa[_0x4269('0x47')](_0xfb396f);if(_0x23b2d9['duplicates']&&_0x23b2d9[_0x4269('0x6b')][_0x4269('0x56')]){_0x1980aa[_0x4269('0x47')](insertCmContact(_0x23b2d9[_0x4269('0x20')],_0x1546d9,_0x23b2d9[_0x4269('0x6b')],_0x2a6b45));_0x1980aa[_0x4269('0x47')](_0x4269('0x73')+_0x1546d9+';');}_0x1980aa['push'](insertCmHopper(_0x23b2d9[_0x4269('0x20')],_0x4269('0x74'),'voice_queues',_0x4269('0x75'),_0x1e4354));_0x1980aa[_0x4269('0x47')](insertCmHopperBlack(_0x23b2d9[_0x4269('0x20')],_0x4269('0x76'),_0x4269('0x77'),_0x4269('0x75')));_0x1980aa[_0x4269('0x47')](insertCmHopper(_0x23b2d9[_0x4269('0x20')],'campaigns_has_cm_lists','campaigns',_0x4269('0x78'),_0x1e4354));_0x1980aa['push'](insertCmHopperBlack(_0x23b2d9[_0x4269('0x20')],_0x4269('0x79'),_0x4269('0x7a'),_0x4269('0x78')));BPromise['each'](_0x1980aa,handleQuery)['then'](function(_0x69e03d){stats[_0x4269('0x7b')]=!![];stats['affectedRows']=_0x23b2d9[_0x4269('0x6b')]&&_0x23b2d9[_0x4269('0x6b')][_0x4269('0x56')]?results[0x2]['affectedRows']:results[0x0][_0x4269('0x7c')];socket['emit'](_0x4269('0x68')+_0x464ff4,stats);fs[_0x4269('0x7d')](_0x334fa1);fs['unlink'](_0x25c7be);process['exit'](0x0);})[_0x4269('0x48')](function(_0x59ec8d){logger[_0x4269('0x40')](_0x59ec8d[_0x4269('0x41')]);process[_0x4269('0x42')](0x1);});}catch(_0x3c6ddb){logger[_0x4269('0x40')](_0x4269('0x7e'),_0x3c6ddb[_0x4269('0x41')]);process['exit'](0x1);}},'error':function(_0x3ead7f,_0x39f26a,_0xd297ad,_0x5b80b2){throw new Error(_0x5b80b2);}});}function validate(){if(process[_0x4269('0x7f')]&&process['argv']['length']<0x4){throw new Error(_0x4269('0x80'));}var _0x3e6aad=path[_0x4269('0x14')](config[_0x4269('0x4e')],_0x4269('0x4f'),process[_0x4269('0x7f')][0x2]);if(!fs['existsSync'](_0x3e6aad)){throw new Error(_0x4269('0x81'));}var _0x462e65={};try{_0x462e65=JSON[_0x4269('0x53')](process[_0x4269('0x7f')][0x3]);if(!_0x462e65[_0x4269('0x4c')]){throw new Error(_0x4269('0x82'));}if(!_0x462e65[_0x4269('0x4c')][_0x4269('0x12')]){throw new Error(_0x4269('0x83'));}if(!_0x462e65['binding'][_0x4269('0x64')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5281ec=0x0;if(_0x462e65[_0x4269('0x4c')][_0x4269('0x22')]){_0x5281ec=0x1;}if(!_0x462e65[_0x4269('0x20')]){throw new Error(_0x4269('0x84'));}}catch(_0x169044){throw new Error('body\x20id\x20mandatory');}var _0x54aa1e=[];try{_0x54aa1e=_[_0x4269('0x85')](JSON[_0x4269('0x53')](process[_0x4269('0x7f')][0x4]),'id');}catch(_0x3ecb48){logger[_0x4269('0x3e')](_0x4269('0x86'));}main(_0x3e6aad,_0x462e65,_0x54aa1e,_0x5281ec);}validate();process['on'](_0x4269('0x87'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x908e=['redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','createdAt','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','exit','errors','push','code','message','sequelize','query','spread','catch','stringify','send','start','socket_timestamp','root','server/files/tmp','writeFileSync','createReadStream','data','length','rows','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','abort','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','bluebird','moment','squel','ioredis','../../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x908e,0x182));var _0xe908=function(_0x1a0e40,_0x132da7){_0x1a0e40=_0x1a0e40-0x0;var _0x1bc002=_0x908e[_0x1a0e40];return _0x1bc002;};'use strict';var fs=require('fs');var path=require(_0xe908('0x0'));var _=require(_0xe908('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xe908('0x2'));var moment=require(_0xe908('0x3'));var squel=require(_0xe908('0x4'));var Redis=require(_0xe908('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xe908('0x6'));var logger=require('../../../config/logger')('import');config[_0xe908('0x7')]=_[_0xe908('0x8')](config[_0xe908('0x7')],{'host':_0xe908('0x9'),'port':0x18eb});var socket=require(_0xe908('0xa'))(new Redis(config[_0xe908('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0xe908('0xb'));function isEmail(_0x4794c5){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xe908('0xc')](_0x4794c5);}function selectNotIn(_0x2992dd,_0x5b8202,_0x4c0846,_0x22c5cc,_0x78a40a){return squel[_0xe908('0xd')]()[_0xe908('0xe')](_0xe908('0xf'))[_0xe908('0x10')](_0x22c5cc)[_0xe908('0x11')](_0x5b8202,null,_0x5b8202+_0xe908('0x12')+_0x22c5cc+'.'+_0x4c0846)['where'](_0x22c5cc+'.'+_0x4c0846+'\x20=\x20'+_0x2992dd+'.'+_0x4c0846)[_0xe908('0x13')](_0x5b8202+'.dialCheckDuplicateType\x20IN\x20('+_0x78a40a[_0xe908('0x11')]()+')');}function insertCmHopper(_0xf24ff1,_0x21029a,_0x15358b,_0x14329e,_0x582894){var _0x214997=[_0xe908('0x14'),_0xe908('0x15'),_0xe908('0x16'),'cm_contacts.ListId',_0x21029a+'.'+_0x14329e,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xe908('0x17'),_0xe908('0x18'),'\x22'+_0x582894+'\x22'];return squel[_0xe908('0x19')]()[_0xe908('0x1a')]('cm_hopper')[_0xe908('0x1b')]([_0xe908('0xf'),_0xe908('0x1c'),_0xe908('0x1d'),_0xe908('0x1e'),_0x14329e,'createdAt',_0xe908('0x1f'),'priority',_0xe908('0x20'),_0xe908('0x21')],squel[_0xe908('0xd')]()[_0xe908('0x22')](_0x214997)[_0xe908('0x10')](_0x21029a)[_0xe908('0x11')](_0xe908('0x23'),null,_0xe908('0x24')+_0x21029a+_0xe908('0x25'))[_0xe908('0x11')](_0x15358b,null,_0x15358b+_0xe908('0x12')+_0x21029a+'.'+_0x14329e)[_0xe908('0x13')](_0x21029a+_0xe908('0x26'),_0xf24ff1)[_0xe908('0x13')](_0xe908('0x27'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x21029a,_0x15358b,_0x14329e,_0xe908('0x28'),[_0xe908('0x29'),_0xe908('0x2a')]))['where'](_0xe908('0x2b'),selectNotIn(_0x21029a,_0x15358b,_0x14329e,_0xe908('0x28'),['\x22always\x22'])))[_0xe908('0x2c')]();}function insertCmHopperBlack(_0x347984,_0x23a325,_0x69f6c0,_0x296b02){var _0x53b512=[_0xe908('0x14'),_0xe908('0x16'),_0xe908('0x2d'),_0x23a325+'.'+_0x296b02,_0xe908('0x2e'),_0xe908('0x2f')];return squel['insert']()[_0xe908('0x1a')](_0xe908('0x30'))[_0xe908('0x1b')]([_0xe908('0xf'),_0xe908('0x1d'),_0xe908('0x1e'),_0x296b02,_0xe908('0x31'),_0xe908('0x1f')],squel['select']()[_0xe908('0x22')](_0x53b512)[_0xe908('0x10')](_0x23a325)[_0xe908('0x11')](_0xe908('0x23'),null,_0xe908('0x24')+_0x23a325+_0xe908('0x25'))[_0xe908('0x11')](_0x69f6c0,null,_0x69f6c0+_0xe908('0x12')+_0x23a325+'.'+_0x296b02)[_0xe908('0x13')](_0x23a325+'.CmListId\x20=\x20?',_0x347984)[_0xe908('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe908('0x13')](_0xe908('0x2b'),squel['select']()[_0xe908('0xe')]('phone')['from'](_0xe908('0x30'))[_0xe908('0x13')](_0xe908('0x32'),_0x347984)[_0xe908('0x13')](_0x296b02+'\x20=\x20?',_0x23a325+'.'+_0x296b02)))[_0xe908('0x2c')]();}function insertCmContact(_0x4c468d,_0x43904f,_0x484529,_0x12e2e5){var _0x495a99=_[_0xe908('0x33')](_[_0xe908('0x34')](_0x12e2e5),[_0xe908('0x1e'),_0xe908('0x35'),_0xe908('0x31'),_0xe908('0x1f')]);return squel[_0xe908('0x19')]()[_0xe908('0x1a')]('cm_contacts')[_0xe908('0x1b')](_0x495a99,squel[_0xe908('0xd')]()[_0xe908('0x22')](_0x495a99)[_0xe908('0x10')](_0x43904f)[_0xe908('0x13')]('('+_0x484529[_0xe908('0x11')](',')+_0xe908('0x36'),squel[_0xe908('0xd')]()[_0xe908('0x22')](_0x484529)[_0xe908('0x10')](_0xe908('0x23'))[_0xe908('0x13')]('ListId\x20=\x20?',_0x4c468d)[_0xe908('0x13')]('deletedAt\x20IS\x20NULL'))[_0xe908('0x13')](_0xe908('0x37'),squel[_0xe908('0xd')]()[_0xe908('0xe')](_0xe908('0x38'),'min_id')[_0xe908('0x10')](_0x43904f)['group'](_0x484529[_0xe908('0x11')](','))))['toString']();}function handleStop(){logger[_0xe908('0x39')](_0xe908('0x3a'));stopped=!![];}function handleUncaughtException(_0x2633c1){logger[_0xe908('0x3b')](_0x2633c1['message']);process[_0xe908('0x3c')](0x1);}function handleError(_0x2087b5,_0x5be68b){stats[_0xe908('0x3d')][_0xe908('0x3e')]({'name':_0x5be68b[_0xe908('0x3f')],'message':_0x5be68b[_0xe908('0x40')],'row':_0x2087b5});}function handleQuery(_0x484cd4){logger[_0xe908('0x39')](_0x484cd4);return db[_0xe908('0x41')][_0xe908('0x42')](_0x484cd4)[_0xe908('0x43')](function(_0x4821bb){results[_0xe908('0x3e')](_0x4821bb);})[_0xe908('0x44')](function(_0x44410a){logger[_0xe908('0x3b')](_0x44410a[_0xe908('0x40')]);});}function main(_0x12d33e,_0xa4d148,_0x28b853,_0x5a818a){logger[_0xe908('0x39')]('main',_0x12d33e,JSON[_0xe908('0x45')](_0xa4d148));process[_0xe908('0x46')](_0xe908('0x47'));var _0xe33f33=_0xa4d148['binding'];var _0x3fb04b=_0xa4d148[_0xe908('0x48')];var _0x2ab5bc=path[_0xe908('0x11')](config[_0xe908('0x49')],_0xe908('0x4a'),_0x3fb04b+'.csv');var _0x14afb9=_[_0xe908('0x34')](_0xe33f33)['join']();logger[_0xe908('0x39')]('header',_0x14afb9);fs[_0xe908('0x4b')](_0x2ab5bc,_0x14afb9+'\x0a');Papa['parse'](fs[_0xe908('0x4c')](_0x12d33e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5eda3a,_0x4f0d92){try{for(var _0x4abe38=0x0,_0x1c4e32=[];_0x4abe38<_0x5eda3a[_0xe908('0x4d')][_0xe908('0x4e')];_0x4abe38++){stats[_0xe908('0x4f')]+=0x1;if(_0x5eda3a['errors'][_0x4abe38]){handleError(_0x5eda3a[_0xe908('0x4d')][_0x4abe38],_0x5eda3a[_0xe908('0x3d')][_0x4abe38]);}else{var _0xf939d6=[];for(var _0x481a7f in _0xe33f33){if(_0xe33f33[_0xe908('0x50')](_0x481a7f)){if(_0x5eda3a['data'][_0x4abe38][_0xe33f33[_0x481a7f]]){var _0xcea8e7=_['trim'](_0x5eda3a[_0xe908('0x4d')][_0x4abe38][_0xe33f33[_0x481a7f]][_0xe908('0x51')](/"/g,'\x27'));switch(_0x481a7f){case'scheduledat':var _0x40b944=moment(_0xcea8e7,_0xe908('0xb'),!![]);if(_0x40b944[_0xe908('0x52')]()){_0x1c4e32[_0xe908('0x3e')]('\x22'+_0xcea8e7+'\x22');}else{_0xf939d6['push'](_0xe908('0x53'));}break;case _0xe908('0x54'):var _0x3cae36=parseInt(_0xcea8e7);_0xcea8e7=_[_0xe908('0x55')](_0x3cae36)||_0x3cae36<0x0||_0x3cae36>0x4?_0x5a818a?0x3:0x2:_0x3cae36;_0x1c4e32[_0xe908('0x3e')]('\x22'+_0xcea8e7+'\x22');break;case'UserId':var _0x7b80a2=parseInt(_0xcea8e7);if(_[_0xe908('0x56')](_0x7b80a2)&&_[_0xe908('0x57')](_0x28b853,_0x7b80a2)){_0x1c4e32['push']('\x22'+_0x7b80a2+'\x22');}else{_0xf939d6[_0xe908('0x3e')](_0xe908('0x58'));}break;case'email':if(isEmail(_0xcea8e7)){_0x1c4e32[_0xe908('0x3e')]('\x22'+_0xcea8e7+'\x22');}else{_0xf939d6[_0xe908('0x3e')](_0xe908('0x59'));}break;case'dateOfBirth':var _0x568794=moment(_0xcea8e7,_0xe908('0x5a'),!![]);if(_0x568794['isValid']()){_0x1c4e32['push']('\x22'+_0xcea8e7+'\x22');}else{_0xf939d6[_0xe908('0x3e')](_0xe908('0x5b'));}break;default:_0x1c4e32['push']('\x22'+_0xcea8e7+'\x22');}}else{switch(_0x481a7f){case _0xe908('0x5c'):case _0xe908('0xf'):_0xf939d6[_0xe908('0x3e')](_0x481a7f+_0xe908('0x5d'));break;default:_0x1c4e32[_0xe908('0x3e')]('\x22\x22');}}}}if(_0xf939d6[_0xe908('0x4e')]){handleError(_0x5eda3a[_0xe908('0x4d')][_0x4abe38],{'code':_0xe908('0x5e'),'message':_0xf939d6[_0xe908('0x11')]()});}else{fs[_0xe908('0x5f')](_0x2ab5bc,_0x1c4e32[_0xe908('0x11')]()+'\x0a');}_0x1c4e32=[];}if(!(stats['rows']%0xc8)){socket[_0xe908('0x60')](_0xe908('0x61')+_0x3fb04b,stats);stats[_0xe908('0x3d')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x4f0d92[_0xe908('0x62')]();}}catch(_0x38075b){handleError(_0x5eda3a[_0xe908('0x4d')][_0x4abe38],{'code':'SystemError','message':_0x38075b[_0xe908('0x40')]});logger[_0xe908('0x3b')]('step',_0x38075b['message']);}},'complete':function(){try{var _0xdd0305=[];var _0x2993b8=_0xe908('0x23');if(_0xa4d148['duplicates']&&_0xa4d148[_0xe908('0x63')][_0xe908('0x4e')]){_0x2993b8=_0xe908('0x64')+_0x3fb04b;_0xdd0305[_0xe908('0x3e')](_0xe908('0x65')+_0x2993b8+_0xe908('0x66'));}var _0x40e0a1=util[_0xe908('0x67')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x2ab5bc,_0x2993b8,_0x14afb9,_0xa4d148[_0xe908('0x1e')],_0xa4d148[_0xe908('0x35')]||null,NOW,NOW);if(_[_0xe908('0x68')](_0xe33f33[_0xe908('0x1c')])){_0x40e0a1+=',\x20scheduledAt\x20=\x20NOW()';}_0xdd0305['push'](_0x40e0a1);if(_0xa4d148[_0xe908('0x63')]&&_0xa4d148[_0xe908('0x63')][_0xe908('0x4e')]){_0xdd0305[_0xe908('0x3e')](insertCmContact(_0xa4d148[_0xe908('0x1e')],_0x2993b8,_0xa4d148[_0xe908('0x63')],_0xe33f33));_0xdd0305['push'](_0xe908('0x69')+_0x2993b8+';');}_0xdd0305[_0xe908('0x3e')](insertCmHopper(_0xa4d148[_0xe908('0x1e')],_0xe908('0x6a'),_0xe908('0x6b'),_0xe908('0x6c'),_0x5a818a));_0xdd0305['push'](insertCmHopperBlack(_0xa4d148[_0xe908('0x1e')],'voice_queues_has_cm_blacklists',_0xe908('0x6b'),_0xe908('0x6c')));_0xdd0305[_0xe908('0x3e')](insertCmHopper(_0xa4d148['ListId'],_0xe908('0x6d'),_0xe908('0x6e'),'CampaignId',_0x5a818a));_0xdd0305['push'](insertCmHopperBlack(_0xa4d148[_0xe908('0x1e')],_0xe908('0x6f'),_0xe908('0x6e'),_0xe908('0x70')));BPromise[_0xe908('0x71')](_0xdd0305,handleQuery)[_0xe908('0x72')](function(_0x3c90e7){stats[_0xe908('0x73')]=!![];stats[_0xe908('0x74')]=_0xa4d148['duplicates']&&_0xa4d148['duplicates'][_0xe908('0x4e')]?results[0x2][_0xe908('0x74')]:results[0x0][_0xe908('0x74')];socket[_0xe908('0x60')](_0xe908('0x61')+_0x3fb04b,stats);fs[_0xe908('0x75')](_0x12d33e);fs[_0xe908('0x75')](_0x2ab5bc);process[_0xe908('0x3c')](0x0);})['catch'](function(_0x53325d){logger[_0xe908('0x3b')](_0x53325d[_0xe908('0x40')]);process['exit'](0x1);});}catch(_0xc4ea3c){logger[_0xe908('0x3b')](_0xe908('0x76'),_0xc4ea3c[_0xe908('0x40')]);process[_0xe908('0x3c')](0x1);}},'error':function(_0x521f81,_0x1f8eb5,_0x1f09e0,_0x3a77e1){throw new Error(_0x3a77e1);}});}function validate(){if(process['argv']&&process[_0xe908('0x77')]['length']<0x4){throw new Error(_0xe908('0x78'));}var _0x24fb46=path[_0xe908('0x11')](config['root'],_0xe908('0x4a'),process[_0xe908('0x77')][0x2]);if(!fs[_0xe908('0x79')](_0x24fb46)){throw new Error(_0xe908('0x7a'));}var _0x4c864a={};try{_0x4c864a=JSON['parse'](process[_0xe908('0x77')][0x3]);if(!_0x4c864a['binding']){throw new Error(_0xe908('0x7b'));}if(!_0x4c864a[_0xe908('0x7c')]['phone']){throw new Error(_0xe908('0x7d'));}if(!_0x4c864a[_0xe908('0x7c')][_0xe908('0x5c')]){throw new Error(_0xe908('0x7e'));}var _0x164a4b=0x0;if(_0x4c864a[_0xe908('0x7c')][_0xe908('0x20')]){_0x164a4b=0x1;}if(!_0x4c864a[_0xe908('0x1e')]){throw new Error(_0xe908('0x7f'));}}catch(_0x16f698){throw new Error(_0xe908('0x80'));}var _0x4eca23=[];try{_0x4eca23=_['map'](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x4a5df7){logger[_0xe908('0x39')](_0xe908('0x81'));}main(_0x24fb46,_0x4c864a,_0x4eca23,_0x164a4b);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe908('0x82'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index b406f6d..165897a 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 _0xd06b=['Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','***\x20Call\x20Info\x20***','Called\x20Number','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','endtime','Duration','duration','Billable\x20Time','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','queue','push','calleridnum','outbound','Outbound\x20Call','variable','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','string','Agent\x20Ring','Agent\x20Connect'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd06b,0x94));var _0xbd06=function(_0x124d9d,_0x555729){_0x124d9d=_0x124d9d-0x0;var _0x2b8b0d=_0xd06b[_0x124d9d];return _0x2b8b0d;};'use strict';exports['getSubjects']=function(_0x36c55f,_0x49d499){var _0x2a41aa=[{'type':'string','content':_0xbd06('0x0'),'variableName':null}];switch(_0x36c55f['toLowerCase']()){case _0xbd06('0x1'):switch(_0x49d499[_0xbd06('0x2')]()){case _0xbd06('0x3'):_0x2a41aa['push']({'type':'variable','content':'','variableName':_0xbd06('0x4')});_0x2a41aa[_0xbd06('0x5')]({'type':'variable','content':'','variableName':_0xbd06('0x6')});break;case _0xbd06('0x7'):_0x2a41aa[_0xbd06('0x5')]({'type':'string','content':_0xbd06('0x8'),'variableName':null});_0x2a41aa[_0xbd06('0x5')]({'type':_0xbd06('0x9'),'content':'','variableName':_0xbd06('0xa')});break;}}return _0x2a41aa;};exports[_0xbd06('0xb')]=function(_0x48da63,_0x2df073){var _0x703cd0=[];switch(_0x48da63[_0xbd06('0x2')]()){case'voice':switch(_0x2df073[_0xbd06('0x2')]()){case _0xbd06('0x3'):_0x703cd0=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0xd'),'keyType':_0xbd06('0x9'),'variableName':_0xbd06('0x6')},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0xe'),'keyType':_0xbd06('0x9'),'variableName':'calleridname'},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0xf'),'keyType':_0xbd06('0x9'),'variableName':_0xbd06('0x10')},{'type':'keyValue','content':'','key':'Queue','keyType':'variable','variableName':_0xbd06('0x4')},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0x11'),'keyType':_0xbd06('0x9'),'variableName':_0xbd06('0x12')},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0x13'),'keyType':_0xbd06('0x9'),'variableName':_0xbd06('0x14')},{'type':'string','content':_0xbd06('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xbd06('0x16'),'keyType':_0xbd06('0x9'),'variableName':_0xbd06('0x17')},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0x18'),'keyType':_0xbd06('0x9'),'variableName':_0xbd06('0xa')},{'type':_0xbd06('0x19'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xbd06('0x1a'),'keyType':_0xbd06('0x9'),'variableName':_0xbd06('0x14')},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0x1b'),'keyType':'variable','variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0xbd06('0x1c'),'keyType':_0xbd06('0x9'),'variableName':_0xbd06('0x1d')},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0x1e'),'keyType':'variable','variableName':_0xbd06('0x1f')},{'type':_0xbd06('0xc'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0xbd06('0x20')}];break;case'outbound':_0x703cd0=[{'type':'string','content':_0xbd06('0x21'),'variableName':null},{'type':'keyValue','content':'','key':_0xbd06('0x22'),'keyType':_0xbd06('0x9'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0xbd06('0x23')},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0x11'),'keyType':_0xbd06('0x9'),'keyContent':'','variableName':_0xbd06('0x12')},{'type':'keyValue','content':'','key':'Date','keyType':_0xbd06('0x9'),'keyContent':'','variableName':_0xbd06('0x24')},{'type':_0xbd06('0x19'),'content':_0xbd06('0x25')},{'type':'keyValue','content':'','key':_0xbd06('0x26'),'keyType':_0xbd06('0x9'),'keyContent':'','variableName':_0xbd06('0x27')},{'type':_0xbd06('0xc'),'content':'','key':'Complete\x20Time','keyType':_0xbd06('0x9'),'keyContent':'','variableName':_0xbd06('0x28')},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0x29'),'keyType':'variable','keyContent':'','variableName':_0xbd06('0x2a')},{'type':_0xbd06('0xc'),'content':'','key':_0xbd06('0x2b'),'keyType':_0xbd06('0x9'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x703cd0;}; \ No newline at end of file +var _0xe407=['Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','Date','Answer\x20Time','answertime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','Call\x20To','Queue','queue','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt'];(function(_0xf3f58c,_0x38b821){var _0x53d7b6=function(_0x51b981){while(--_0x51b981){_0xf3f58c['push'](_0xf3f58c['shift']());}};_0x53d7b6(++_0x38b821);}(_0xe407,0x160));var _0x7e40=function(_0x51ac4b,_0x18e00a){_0x51ac4b=_0x51ac4b-0x0;var _0x387be7=_0xe407[_0x51ac4b];return _0x387be7;};'use strict';exports[_0x7e40('0x0')]=function(_0x3714ae,_0x5d6a34){var _0x4b2958=[{'type':'string','content':_0x7e40('0x1'),'variableName':null}];switch(_0x3714ae[_0x7e40('0x2')]()){case'voice':switch(_0x5d6a34['toLowerCase']()){case _0x7e40('0x3'):_0x4b2958[_0x7e40('0x4')]({'type':_0x7e40('0x5'),'content':'','variableName':'queue'});_0x4b2958['push']({'type':_0x7e40('0x5'),'content':'','variableName':_0x7e40('0x6')});break;case _0x7e40('0x7'):_0x4b2958['push']({'type':_0x7e40('0x8'),'content':_0x7e40('0x9'),'variableName':null});_0x4b2958[_0x7e40('0x4')]({'type':_0x7e40('0x5'),'content':'','variableName':_0x7e40('0xa')});break;}}return _0x4b2958;};exports['getDescriptions']=function(_0x34868a,_0xd12fc0){var _0x5374f0=[];switch(_0x34868a[_0x7e40('0x2')]()){case'voice':switch(_0xd12fc0['toLowerCase']()){case _0x7e40('0x3'):_0x5374f0=[{'type':'string','content':_0x7e40('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x7e40('0xc'),'keyType':'variable','variableName':_0x7e40('0x6')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0xe'),'keyType':_0x7e40('0x5'),'variableName':'calleridname'},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0xf'),'keyType':_0x7e40('0x5'),'variableName':'destexten'},{'type':'keyValue','content':'','key':_0x7e40('0x10'),'keyType':_0x7e40('0x5'),'variableName':_0x7e40('0x11')},{'type':'keyValue','content':'','key':_0x7e40('0x12'),'keyType':_0x7e40('0x5'),'variableName':_0x7e40('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0x7e40('0x5'),'variableName':'agentcalledAt'},{'type':_0x7e40('0x8'),'content':_0x7e40('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x15'),'keyType':_0x7e40('0x5'),'variableName':_0x7e40('0x16')},{'type':_0x7e40('0xd'),'content':'','key':'Agent\x20Number','keyType':_0x7e40('0x5'),'variableName':_0x7e40('0xa')},{'type':_0x7e40('0x8'),'content':_0x7e40('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x7e40('0x18'),'keyType':_0x7e40('0x5'),'variableName':_0x7e40('0x19')},{'type':'keyValue','content':'','key':_0x7e40('0x1a'),'keyType':_0x7e40('0x5'),'variableName':_0x7e40('0x1b')},{'type':'keyValue','content':'','key':_0x7e40('0x1c'),'keyType':_0x7e40('0x5'),'variableName':'agentcompleteAt'},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x1d'),'keyType':'variable','variableName':_0x7e40('0x1e')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x1f'),'keyType':'variable','variableName':'talktime'}];break;case _0x7e40('0x7'):_0x5374f0=[{'type':_0x7e40('0x8'),'content':_0x7e40('0xb'),'variableName':null},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x20'),'keyType':'variable','keyContent':'','variableName':_0x7e40('0xa')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x21'),'keyType':_0x7e40('0x5'),'keyContent':'','variableName':_0x7e40('0x22')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x12'),'keyType':_0x7e40('0x5'),'keyContent':'','variableName':_0x7e40('0x13')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x23'),'keyType':_0x7e40('0x5'),'keyContent':'','variableName':'starttime'},{'type':_0x7e40('0x8'),'content':_0x7e40('0x17')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x24'),'keyType':'variable','keyContent':'','variableName':_0x7e40('0x25')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x26'),'keyType':_0x7e40('0x5'),'keyContent':'','variableName':_0x7e40('0x27')},{'type':_0x7e40('0xd'),'content':'','key':_0x7e40('0x28'),'keyType':_0x7e40('0x5'),'keyContent':'','variableName':_0x7e40('0x29')}];break;}}return _0x5374f0;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index c77aec8..90fd8ea 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 _0x9412=['mobile','lodash','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','update','then','info','catch','error','user','query','clone','body','omit','html','fax'];(function(_0x510246,_0x103b24){var _0x2f4bfe=function(_0x341a33){while(--_0x341a33){_0x510246['push'](_0x510246['shift']());}};_0x2f4bfe(++_0x103b24);}(_0x9412,0xb5));var _0x2941=function(_0xdb5036,_0x914c61){_0xdb5036=_0xdb5036-0x0;var _0x58fb12=_0x9412[_0xdb5036];return _0x58fb12;};'use strict';var _=require(_0x2941('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x2941('0x1'))('mail-interactions'),'fax':require(_0x2941('0x1'))(_0x2941('0x2')),'sms':require(_0x2941('0x1'))(_0x2941('0x3')),'chat':require('../../config/logger')(_0x2941('0x4')),'whatsapp':require(_0x2941('0x1'))(_0x2941('0x5'))};function getInteractionId(_0x1e8f32,_0x448b78,_0x4e9a1e){if(_0x1e8f32&&_0x1e8f32[_[_0x2941('0x6')](_0x4e9a1e)+_0x2941('0x7')]){return _0x1e8f32[_[_0x2941('0x6')](_0x4e9a1e)+_0x2941('0x7')];}else if(_0x1e8f32&&_0x1e8f32['id']){return _0x1e8f32['id'];}else if(_0x448b78&&_0x448b78['id']){return _0x448b78['id'];}else{return _0x2941('0x8');}}function log(_0x5a3aa3,_0x364e6e,_0x5efcd0,_0x27196e,_0x99cbae,_0x1f57f9){loggers[_0x99cbae[_0x2941('0x9')]()][_0x5a3aa3](_0x2941('0xa'),_0x1f57f9[_0x2941('0xb')](),_0x364e6e?_0x364e6e['id']:null,_0x364e6e?_0x364e6e['name']:null,_0x364e6e?_0x364e6e[_0x2941('0xc')]:null,getInteractionId(_0x5efcd0,_0x27196e,_0x99cbae),_0x5efcd0?JSON[_0x2941('0xd')](_0x5efcd0):_0x2941('0xe'));}function updateUser(_0x45c8aa,_0x22296d,_0x15325f,_0x4e2ad1,_0x244920){db[_[_0x2941('0x6')](_0x4e2ad1)+_0x2941('0xf')][_0x2941('0x10')]({'where':{'id':getInteractionId(_0x22296d,_0x15325f,_0x4e2ad1)}})['then'](function(_0x1aeb89){if(_0x1aeb89){return _0x1aeb89[_0x2941('0x11')]({'UserId':_0x45c8aa?_0x45c8aa['id']:null});}})[_0x2941('0x12')](function(_0x35749c){if(_0x35749c){log(_0x2941('0x13'),_0x45c8aa,_0x22296d,_0x15325f,_0x4e2ad1,_0x244920);}})[_0x2941('0x14')](function(){log(_0x2941('0x15'),_0x45c8aa,_0x22296d,_0x15325f,_0x4e2ad1,_0x244920);});}exports['tracked']=function(_0x4937f6,_0x24b2a4){return function(_0x6928ce,_0x307a18,_0x561d7e){var _0x448b26=_0x6928ce[_0x2941('0x16')];var _0x1594aa={};var _0x2cb6f7=_0x6928ce[_0x2941('0x17')];if(_0x1594aa){_0x1594aa=_[_0x2941('0x18')](_0x6928ce[_0x2941('0x19')]);_0x1594aa=_[_0x2941('0x1a')](_0x1594aa,['body',_0x2941('0x1b'),'phone',_0x2941('0x1c'),_0x2941('0x1d')]);}updateUser(_0x448b26,_0x1594aa,_0x2cb6f7,_0x4937f6,_0x24b2a4);_0x561d7e(null);};}; \ No newline at end of file +var _0x11e2=['toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','info','catch','error','user','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','mail-interactions','../../config/logger','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown'];(function(_0x587240,_0x499228){var _0x3676d3=function(_0x550a6c){while(--_0x550a6c){_0x587240['push'](_0x587240['shift']());}};_0x3676d3(++_0x499228);}(_0x11e2,0xa9));var _0x211e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x11e2[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x211e('0x0'));var db=require(_0x211e('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x211e('0x2')),'mail':require('../../config/logger')(_0x211e('0x3')),'fax':require(_0x211e('0x4'))(_0x211e('0x5')),'sms':require(_0x211e('0x4'))(_0x211e('0x6')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require('../../config/logger')(_0x211e('0x7'))};function getInteractionId(_0x479b11,_0x4f49c8,_0x592e7d){if(_0x479b11&&_0x479b11[_[_0x211e('0x8')](_0x592e7d)+_0x211e('0x9')]){return _0x479b11[_[_0x211e('0x8')](_0x592e7d)+_0x211e('0x9')];}else if(_0x479b11&&_0x479b11['id']){return _0x479b11['id'];}else if(_0x4f49c8&&_0x4f49c8['id']){return _0x4f49c8['id'];}else{return _0x211e('0xa');}}function log(_0x1f66cb,_0x338054,_0x2f5677,_0x1d89aa,_0x4fb6e4,_0x3ab0f6){loggers[_0x4fb6e4[_0x211e('0xb')]()][_0x1f66cb](_0x211e('0xc'),_0x3ab0f6[_0x211e('0xd')](),_0x338054?_0x338054['id']:null,_0x338054?_0x338054[_0x211e('0xe')]:null,_0x338054?_0x338054[_0x211e('0xf')]:null,getInteractionId(_0x2f5677,_0x1d89aa,_0x4fb6e4),_0x2f5677?JSON[_0x211e('0x10')](_0x2f5677):_0x211e('0x11'));}function updateUser(_0x2ce109,_0x464e90,_0x5de4da,_0x3fa8ac,_0x4f74a8){db[_[_0x211e('0x8')](_0x3fa8ac)+'Interaction'][_0x211e('0x12')]({'where':{'id':getInteractionId(_0x464e90,_0x5de4da,_0x3fa8ac)}})[_0x211e('0x13')](function(_0x2e472c){if(_0x2e472c){return _0x2e472c['update']({'UserId':_0x2ce109?_0x2ce109['id']:null});}})[_0x211e('0x13')](function(_0x4e840b){if(_0x4e840b){log(_0x211e('0x14'),_0x2ce109,_0x464e90,_0x5de4da,_0x3fa8ac,_0x4f74a8);}})[_0x211e('0x15')](function(){log(_0x211e('0x16'),_0x2ce109,_0x464e90,_0x5de4da,_0x3fa8ac,_0x4f74a8);});}exports['tracked']=function(_0x318f85,_0x8e85dd){return function(_0x3e3f9f,_0x430669,_0x10c8b3){var _0x37a4c4=_0x3e3f9f[_0x211e('0x17')];var _0x3b9439={};var _0x3f1439=_0x3e3f9f['query'];if(_0x3b9439){_0x3b9439=_['clone'](_0x3e3f9f[_0x211e('0x18')]);_0x3b9439=_[_0x211e('0x19')](_0x3b9439,['body',_0x211e('0x1a'),_0x211e('0x1b'),_0x211e('0x1c'),_0x211e('0x1d')]);}updateUser(_0x37a4c4,_0x3b9439,_0x3f1439,_0x318f85,_0x8e85dd);_0x10c8b3(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index e2c91c9..d9f7c6a 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 _0x6116=['crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','utf8','parse','hasOwnProperty','findOne','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit'];(function(_0x56faab,_0x1214d0){var _0x292050=function(_0x1bfedf){while(--_0x1bfedf){_0x56faab['push'](_0x56faab['shift']());}};_0x292050(++_0x1214d0);}(_0x6116,0x190));var _0x6611=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x6116[_0x2c7618];return _0x5ce3f0;};'use strict';var crypto=require(_0x6611('0x0'));var util=require(_0x6611('0x1'));var compose=require(_0x6611('0x2'));var db=require(_0x6611('0x3'))['db'];var config=require(_0x6611('0x4'));function getValueFromLicense(_0x59cb47,_0x5dc91d){if(_0x59cb47&&_0x5dc91d){if(_0x5dc91d[_0x6611('0x5')]&&_0x5dc91d[_0x6611('0x6')]){var _0x34d2b3=_0x5dc91d[_0x6611('0x5')];var _0x2509b7=_0x5dc91d['license'];var _0xccb8e0=_0x34d2b3['split']('-')[0x4];var _0x3a5ace=_0x34d2b3[_0x6611('0x7')]('-')[0x0];var _0x4da229=crypto[_0x6611('0x8')](_0x6611('0x9'),util[_0x6611('0xa')]('%s:%s:%s',_0xccb8e0,_0x34d2b3,_0x3a5ace));var _0xf10e0b=_0x4da229[_0x6611('0xb')](_0x2509b7,'base64',_0x6611('0xc'));_0xf10e0b+=_0x4da229['final'](_0x6611('0xc'));var _0x358ad9=JSON[_0x6611('0xd')](_0xf10e0b);return _0x358ad9[_0x6611('0xe')](_0x59cb47)?_0x358ad9[_0x59cb47]:null;}}return null;}function isLimit(_0x3a7bed,_0x4284a7,_0x1d1448,_0x4f4ee9){var _0x321f26=_0x4284a7;return compose()['use'](function(_0x149a01,_0x933008,_0x49aeaf){return db['License'][_0x6611('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1cffeb){var _0x4232cd=getValueFromLicense(_0x3a7bed,_0x1cffeb);return _0x4232cd?_0x4232cd:_0x321f26;})['then'](function(_0x3b59db){_0x321f26=_0x3b59db;return _0x1d1448[_0x6611('0x10')](_0x4f4ee9);})['then'](function(_0x5383fa){if(_0x5383fa>=_0x321f26){return _0x933008[_0x6611('0x11')](0x193)[_0x6611('0x12')]({'message':util['format'](_0x6611('0x13'),_0x3a7bed)});}_0x49aeaf();})['catch'](function(_0x154c58){_0x49aeaf(_0x154c58);});});}function isUserLimit(){return isLimit(_0x6611('0x14'),0x1,db[_0x6611('0x15')],{'where':{'$or':[{'role':_0x6611('0x16')},{'role':_0x6611('0x17')}]}});}exports[_0x6611('0x18')]=isUserLimit; \ No newline at end of file +var _0x099c=['License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x099c,0x184));var _0xc099=function(_0x5d1d6c,_0x8c94ff){_0x5d1d6c=_0x5d1d6c-0x0;var _0x3f4b02=_0x099c[_0x5d1d6c];return _0x3f4b02;};'use strict';var crypto=require(_0xc099('0x0'));var util=require(_0xc099('0x1'));var compose=require('composable-middleware');var db=require(_0xc099('0x2'))['db'];var config=require(_0xc099('0x3'));function getValueFromLicense(_0x1cebd2,_0x1fff7a){if(_0x1cebd2&&_0x1fff7a){if(_0x1fff7a[_0xc099('0x4')]&&_0x1fff7a[_0xc099('0x5')]){var _0x343cfc=_0x1fff7a[_0xc099('0x4')];var _0x48460b=_0x1fff7a[_0xc099('0x5')];var _0x209f8a=_0x343cfc[_0xc099('0x6')]('-')[0x4];var _0x49cccf=_0x343cfc[_0xc099('0x6')]('-')[0x0];var _0x1cf0ec=crypto[_0xc099('0x7')](_0xc099('0x8'),util[_0xc099('0x9')](_0xc099('0xa'),_0x209f8a,_0x343cfc,_0x49cccf));var _0x26085a=_0x1cf0ec[_0xc099('0xb')](_0x48460b,_0xc099('0xc'),_0xc099('0xd'));_0x26085a+=_0x1cf0ec[_0xc099('0xe')]('utf8');var _0x276f74=JSON[_0xc099('0xf')](_0x26085a);return _0x276f74[_0xc099('0x10')](_0x1cebd2)?_0x276f74[_0x1cebd2]:null;}}return null;}function isLimit(_0x4c6228,_0x421eda,_0x42b9fd,_0x2e5233){var _0x4e0a15=_0x421eda;return compose()[_0xc099('0x11')](function(_0xdcffd6,_0xf4dab8,_0x900281){return db[_0xc099('0x12')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xc099('0x13')](function(_0x50fb83){var _0x48da11=getValueFromLicense(_0x4c6228,_0x50fb83);return _0x48da11?_0x48da11:_0x4e0a15;})[_0xc099('0x13')](function(_0x30b2ef){_0x4e0a15=_0x30b2ef;return _0x42b9fd[_0xc099('0x14')](_0x2e5233);})[_0xc099('0x13')](function(_0x484ed5){if(_0x484ed5>=_0x4e0a15){return _0xf4dab8[_0xc099('0x15')](0x193)[_0xc099('0x16')]({'message':util[_0xc099('0x9')](_0xc099('0x17'),_0x4c6228)});}_0x900281();})[_0xc099('0x18')](function(_0x144355){_0x900281(_0x144355);});});}function isUserLimit(){return isLimit(_0xc099('0x19'),0x1,db[_0xc099('0x1a')],{'where':{'$or':[{'role':_0xc099('0x1b')},{'role':'user'}]}});}exports[_0xc099('0x1c')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2bc59bf..d0afa2c 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 _0x2c52=['match','indexOf','map','conditions','push','buildExpression','DATE','$eq','$between','value','$lte','operator','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','add','hours','seconds','lodash','moment','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift'];(function(_0x195b54,_0x439b45){var _0x3d005c=function(_0x32c7b2){while(--_0x32c7b2){_0x195b54['push'](_0x195b54['shift']());}};_0x3d005c(++_0x439b45);}(_0x2c52,0x9d));var _0x22c5=function(_0x303f12,_0x2f8be6){_0x303f12=_0x303f12-0x0;var _0x15ec0b=_0x2c52[_0x303f12];return _0x15ec0b;};'use strict';var _=require(_0x22c5('0x0'));var moment=require(_0x22c5('0x1'));exports['parseSearch']=function(_0x1f6a60){var _0x4f1c58={'conditions':[]};_0x4f1c58['sqlOperator']=_[_0x22c5('0x2')](_0x1f6a60,_0x22c5('0x3'))?'or':_0x22c5('0x4');var _0x1ab970=_0x1f6a60[_0x22c5('0x5')](_0x22c5('0x6'),'')[_0x22c5('0x5')](_0x22c5('0x3'),'')[_0x22c5('0x7')]('||');for(var _0x52a6f6=0x0;_0x52a6f6<_0x1ab970[_0x22c5('0x8')];_0x52a6f6++){var _0x4cd6b6=_0x1ab970[_0x52a6f6][_0x22c5('0x7')](':=');var _0x423811=_0x4cd6b6[0x0];var _0xe35d72=_0x4cd6b6['slice'](0x1);_0xe35d72[_0x22c5('0x9')](function(_0x2b8b9a){var _0x2cb934=_0x2b8b9a['split']('[')[_0x22c5('0xa')]();var _0x2bc166=_0x2b8b9a[_0x22c5('0xb')](/\[(.*?)\]/g);_0x2bc166[_0x22c5('0x9')](function(_0x463229){var _0x1a411d=_0x463229[_0x22c5('0x7')]('[')['filter'](function(_0x5411f2){return _0x5411f2[_0x22c5('0xc')](']')>-0x1;})[_0x22c5('0xd')](function(_0x3bff54){return _0x3bff54['split'](']')[0x0];})[0x0];_0x4f1c58[_0x22c5('0xe')][_0x22c5('0xf')]({'field':_0x423811,'operator':_0x2cb934,'value':_0x1a411d});});});}return _0x4f1c58;};exports[_0x22c5('0x10')]=function(_0x27707e,_0x3ad8c2,_0x525f64){var _0x352520={};if(_0x3ad8c2===_0x22c5('0x11')){if(_0x525f64['operator']===_0x22c5('0x12')){_0x525f64['operator']=_0x22c5('0x13');_0x525f64[_0x22c5('0x14')]+=','+_0x525f64[_0x22c5('0x14')];}else if(_['includes'](['$gt',_0x22c5('0x15')],_0x525f64[_0x22c5('0x16')])){_0x525f64[_0x22c5('0x14')]=moment(_0x525f64[_0x22c5('0x14')])['add'](0x1,_0x22c5('0x17'))[_0x22c5('0x18')](_0x22c5('0x19'));}}if(_0x525f64[_0x22c5('0x1a')]){_0x3ad8c2=_0x525f64[_0x22c5('0x1a')];_0x352520[_0x22c5('0x1b')]='CAST('+_0x27707e+'.'+_0x525f64[_0x22c5('0x1c')]+_0x22c5('0x1d')+_0x525f64[_0x22c5('0x1a')]+')\x20'+parseOperator(_0x525f64[_0x22c5('0x16')]);}else{_0x352520[_0x22c5('0x1b')]=_0x27707e+'.'+_0x525f64[_0x22c5('0x1c')]+'\x20'+parseOperator(_0x525f64[_0x22c5('0x16')]);}if(_[_0x22c5('0x1e')]([_0x22c5('0x1f'),_0x22c5('0x20')],_0x525f64[_0x22c5('0x16')]))_0x352520[_0x22c5('0x1b')]='('+_0x352520[_0x22c5('0x1b')]+_0x22c5('0x21')+_0x27707e+'.'+_0x525f64['field']+_0x22c5('0x22');_0x352520['value']=parseValue(_0x3ad8c2,_0x525f64[_0x22c5('0x16')],_0x525f64[_0x22c5('0x14')]);return _0x352520;};function parseOperator(_0x530cb6){var _0x165f93;switch(_0x530cb6){case _0x22c5('0x23'):_0x165f93='IN\x20?';break;case _0x22c5('0x20'):_0x165f93=_0x22c5('0x24');break;case _0x22c5('0x12'):_0x165f93=_0x22c5('0x25');break;case _0x22c5('0x1f'):_0x165f93=_0x22c5('0x26');break;case _0x22c5('0x27'):case _0x22c5('0x28'):case _0x22c5('0x29'):_0x165f93=_0x22c5('0x2a');break;case'$lt':_0x165f93=_0x22c5('0x2b');break;case _0x22c5('0x2c'):_0x165f93=_0x22c5('0x2d');break;case'$lte':_0x165f93=_0x22c5('0x2e');break;case _0x22c5('0x2f'):_0x165f93=_0x22c5('0x30');break;case _0x22c5('0x13'):_0x165f93=_0x22c5('0x31');break;}return _0x165f93;}function parseValue(_0x5a41c8,_0x1073c1,_0x217c43){var _0x50029f={'start':undefined,'end':undefined};switch(_0x1073c1){case _0x22c5('0x23'):case'$notIn':_0x50029f[_0x22c5('0x32')]=_0x217c43[_0x22c5('0x7')](',');break;case'$substring':_0x50029f['start']='%'+_0x217c43+'%';break;case _0x22c5('0x28'):_0x50029f['start']=_0x217c43+'%';break;case _0x22c5('0x29'):_0x50029f[_0x22c5('0x32')]='%'+_0x217c43;break;case'$between':var _0x27f2a4=_0x217c43[_0x22c5('0x7')](',');var _0x217c43=_0x27f2a4[_0x22c5('0xa')]();var _0x1db06b=_0x27f2a4[_0x22c5('0x33')]();if(_0x5a41c8==='DATE'){_0x217c43=moment(_0x217c43)['utcOffset'](0x0,!![])[_0x22c5('0x18')]();_0x1db06b=moment(_0x1db06b)[_0x22c5('0x34')](0x0,!![])[_0x22c5('0x35')](0x17,_0x22c5('0x36'))[_0x22c5('0x35')](0x3b,'minutes')[_0x22c5('0x35')](0x3b,_0x22c5('0x37'))[_0x22c5('0x18')]();}_0x50029f={'start':_0x217c43,'end':_0x1db06b};break;default:_0x50029f[_0x22c5('0x32')]=_0x217c43;break;}return _0x50029f;} \ No newline at end of file +var _0xdb14=['CAST(','field','\x20AS\x20','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$startsWith','LIKE\x20?','<\x20?','$gt','>\x20?','<=\x20?','$gte','start','$substring','$endsWith','pop','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','match','filter','map','conditions','push','DATE','operator','$eq','$between','value','includes','$lte','add','format','YYYY-MM-DD','castTo','text'];(function(_0x272aa7,_0x4524a3){var _0x4bb6ce=function(_0x4dc538){while(--_0x4dc538){_0x272aa7['push'](_0x272aa7['shift']());}};_0x4bb6ce(++_0x4524a3);}(_0xdb14,0x1a1));var _0x4db1=function(_0x2582f8,_0x156206){_0x2582f8=_0x2582f8-0x0;var _0x44b633=_0xdb14[_0x2582f8];return _0x44b633;};'use strict';var _=require(_0x4db1('0x0'));var moment=require(_0x4db1('0x1'));exports[_0x4db1('0x2')]=function(_0x279701){var _0x4d003d={'conditions':[]};_0x4d003d[_0x4db1('0x3')]=_[_0x4db1('0x4')](_0x279701,_0x4db1('0x5'))?'or':_0x4db1('0x6');var _0x4d0469=_0x279701['replace'](_0x4db1('0x7'),'')[_0x4db1('0x8')]('[$or]','')[_0x4db1('0x9')]('||');for(var _0x5d1066=0x0;_0x5d1066<_0x4d0469[_0x4db1('0xa')];_0x5d1066++){var _0xc630e3=_0x4d0469[_0x5d1066][_0x4db1('0x9')](':=');var _0x5ea39d=_0xc630e3[0x0];var _0x2d85d5=_0xc630e3[_0x4db1('0xb')](0x1);_0x2d85d5[_0x4db1('0xc')](function(_0x38a730){var _0x572bd1=_0x38a730[_0x4db1('0x9')]('[')[_0x4db1('0xd')]();var _0x1d6ca7=_0x38a730[_0x4db1('0xe')](/\[(.*?)\]/g);_0x1d6ca7[_0x4db1('0xc')](function(_0xaf91fe){var _0x5dd63a=_0xaf91fe[_0x4db1('0x9')]('[')[_0x4db1('0xf')](function(_0x512bc2){return _0x512bc2['indexOf'](']')>-0x1;})[_0x4db1('0x10')](function(_0x331755){return _0x331755['split'](']')[0x0];})[0x0];_0x4d003d[_0x4db1('0x11')][_0x4db1('0x12')]({'field':_0x5ea39d,'operator':_0x572bd1,'value':_0x5dd63a});});});}return _0x4d003d;};exports['buildExpression']=function(_0xba7336,_0x1eaba9,_0x3e5566){var _0x59cbdd={};if(_0x1eaba9===_0x4db1('0x13')){if(_0x3e5566[_0x4db1('0x14')]===_0x4db1('0x15')){_0x3e5566[_0x4db1('0x14')]=_0x4db1('0x16');_0x3e5566[_0x4db1('0x17')]+=','+_0x3e5566[_0x4db1('0x17')];}else if(_[_0x4db1('0x18')](['$gt',_0x4db1('0x19')],_0x3e5566[_0x4db1('0x14')])){_0x3e5566['value']=moment(_0x3e5566[_0x4db1('0x17')])[_0x4db1('0x1a')](0x1,'days')[_0x4db1('0x1b')](_0x4db1('0x1c'));}}if(_0x3e5566['castTo']){_0x1eaba9=_0x3e5566[_0x4db1('0x1d')];_0x59cbdd[_0x4db1('0x1e')]=_0x4db1('0x1f')+_0xba7336+'.'+_0x3e5566[_0x4db1('0x20')]+_0x4db1('0x21')+_0x3e5566[_0x4db1('0x1d')]+')\x20'+parseOperator(_0x3e5566['operator']);}else{_0x59cbdd['text']=_0xba7336+'.'+_0x3e5566[_0x4db1('0x20')]+'\x20'+parseOperator(_0x3e5566[_0x4db1('0x14')]);}if(_[_0x4db1('0x18')](['$ne',_0x4db1('0x22')],_0x3e5566['operator']))_0x59cbdd[_0x4db1('0x1e')]='('+_0x59cbdd[_0x4db1('0x1e')]+'\x20OR\x20'+_0xba7336+'.'+_0x3e5566[_0x4db1('0x20')]+_0x4db1('0x23');_0x59cbdd[_0x4db1('0x17')]=parseValue(_0x1eaba9,_0x3e5566[_0x4db1('0x14')],_0x3e5566[_0x4db1('0x17')]);return _0x59cbdd;};function parseOperator(_0x35416b){var _0x5b7c62;switch(_0x35416b){case _0x4db1('0x24'):_0x5b7c62=_0x4db1('0x25');break;case _0x4db1('0x22'):_0x5b7c62=_0x4db1('0x26');break;case'$eq':_0x5b7c62=_0x4db1('0x27');break;case _0x4db1('0x28'):_0x5b7c62=_0x4db1('0x29');break;case'$substring':case _0x4db1('0x2a'):case'$endsWith':_0x5b7c62=_0x4db1('0x2b');break;case'$lt':_0x5b7c62=_0x4db1('0x2c');break;case _0x4db1('0x2d'):_0x5b7c62=_0x4db1('0x2e');break;case'$lte':_0x5b7c62=_0x4db1('0x2f');break;case _0x4db1('0x30'):_0x5b7c62='>=\x20?';break;case _0x4db1('0x16'):_0x5b7c62='BETWEEN\x20?\x20AND\x20?';break;}return _0x5b7c62;}function parseValue(_0xd22935,_0x385813,_0x855b71){var _0x266019={'start':undefined,'end':undefined};switch(_0x385813){case'$in':case _0x4db1('0x22'):_0x266019[_0x4db1('0x31')]=_0x855b71[_0x4db1('0x9')](',');break;case _0x4db1('0x32'):_0x266019[_0x4db1('0x31')]='%'+_0x855b71+'%';break;case _0x4db1('0x2a'):_0x266019[_0x4db1('0x31')]=_0x855b71+'%';break;case _0x4db1('0x33'):_0x266019[_0x4db1('0x31')]='%'+_0x855b71;break;case'$between':var _0x7f3da2=_0x855b71[_0x4db1('0x9')](',');var _0x855b71=_0x7f3da2['shift']();var _0x2438eb=_0x7f3da2[_0x4db1('0x34')]();if(_0xd22935===_0x4db1('0x13')){_0x855b71=moment(_0x855b71)['utcOffset'](0x0,!![])[_0x4db1('0x1b')]();_0x2438eb=moment(_0x2438eb)[_0x4db1('0x35')](0x0,!![])[_0x4db1('0x1a')](0x17,'hours')[_0x4db1('0x1a')](0x3b,_0x4db1('0x36'))[_0x4db1('0x1a')](0x3b,_0x4db1('0x37'))[_0x4db1('0x1b')]();}_0x266019={'start':_0x855b71,'end':_0x2438eb};break;default:_0x266019[_0x4db1('0x31')]=_0x855b71;break;}return _0x266019;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ed320c9..39f6fff 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 _0xbdc9=['moment','parse','keys','split','filters','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','unsigned','substr','col','ASC','omit','isEmpty','length','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach','replace','push','join','getOptions','$id','query','intersection','model','fields','attributes','hasOwnProperty','offset','order','where','pick','filter','type','VIRTUAL','name','lower','merge','options','lodash','sequelize'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0xbdc9,0x194));var _0x9bdc=function(_0x11bfc0,_0x1237b6){_0x11bfc0=_0x11bfc0-0x0;var _0x489087=_0xbdc9[_0x11bfc0];return _0x489087;};'use strict';var _=require(_0x9bdc('0x0'));var sequelize=require(_0x9bdc('0x1'));var moment=require(_0x9bdc('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x19f85d){var _0x62d87d=['ne'];try{var _0x482806=JSON[_0x9bdc('0x3')](_0x19f85d);var _0x3899a7=Object[_0x9bdc('0x4')](_0x482806)[0x0];return _0x62d87d['includes'](_0x3899a7);}catch(_0x3eba53){return![];}}function getOperatorValue(_0x3c4712){var _0x57d44b=JSON[_0x9bdc('0x3')](_0x3c4712);var _0x50a5f8=Object[_0x9bdc('0x4')](_0x57d44b)[0x0];var _0x5a465a=_0x57d44b[_0x50a5f8];return{['$'+_0x50a5f8]:_0x5a465a};}exports['fields']=function(_0x38eed8){var _0x325e12=null;if(_0x38eed8){_0x325e12=_0x38eed8[_0x9bdc('0x5')](',');}return _0x325e12;};exports[_0x9bdc('0x6')]=function(_0x3b451f,_0x12b43a){var _0x2a8e61={};if(!_['isEmpty'](_0x3b451f)){_['forOwn'](_0x3b451f,function(_0x3b609e,_0x59c4eb){try{if(_0x12b43a){var _0x567dcd=_['find'](_0x12b43a,{'name':_0x59c4eb})||{};if(hasSequelizeOperator(_0x3b609e)){_0x2a8e61[_0x59c4eb]=getOperatorValue(_0x3b609e);}else if(_0x567dcd['type']===_0x9bdc('0x7')&&_[_0x9bdc('0x8')](_0x3b609e)){var _0x5f5c6e=JSON['parse'](_0x3b609e);var _0x4931={'$gte':moment(moment(_0x5f5c6e['$gte'])[_0x9bdc('0x9')](_0x9bdc('0xa')))[_0x9bdc('0xb')]()[_0x9bdc('0x9')](),'$lte':moment(moment(_0x5f5c6e[_0x9bdc('0xc')])[_0x9bdc('0x9')](_0x9bdc('0xa')))[_0x9bdc('0xb')]()[_0x9bdc('0xd')](0x1,'s')[_0x9bdc('0x9')]()};_0x2a8e61[_0x59c4eb]=_0x4931;}else if(_0x567dcd['name']===_0x9bdc('0xe')){_0x2a8e61[_0x59c4eb]=_0x3b609e;}else{_0x2a8e61[_0x59c4eb]=_[_0x9bdc('0xf')](_0x3b609e)?_0x3b609e:JSON['parse'](_0x3b609e);}}else{_0x2a8e61[_0x59c4eb]=_[_0x9bdc('0xf')](_0x3b609e)?_0x3b609e:JSON[_0x9bdc('0x3')](_0x3b609e);}}catch(_0x49e89c){_0x2a8e61[_0x59c4eb]=_0x3b609e[_0x9bdc('0x5')](',');}});}return _0x2a8e61;};exports[_0x9bdc('0x10')]=function(_0x44ffd9){_0x44ffd9=parseInt(_0x44ffd9,0xa);if(!_0x44ffd9||_0x44ffd9<0x0){_0x44ffd9=LIMIT_VALUE;}return _0x44ffd9;};exports['offset']=function(_0x836ac8){_0x836ac8=parseInt(_0x836ac8,0xa);if(!_0x836ac8||_0x836ac8<0x0){_0x836ac8=0x0;}return _0x836ac8;};exports[_0x9bdc('0x11')]=function(_0x38621e){var _0xb31e8f,_0x51bfdc=null;if(_0x38621e){_0xb31e8f=_0x38621e[_0x9bdc('0x5')](',');_0x51bfdc=_[_0x9bdc('0x12')](_0xb31e8f,function(_0x174562){if(_0x174562[_0x9bdc('0x13')]('-')===0x0){return[_0x174562===_0x9bdc('0x14')?sequelize[_0x9bdc('0x15')](sequelize['col'](_0x9bdc('0x14')),_0x9bdc('0x16')):_0x174562[_0x9bdc('0x17')](0x1),'DESC'];}else{return[_0x174562===_0x9bdc('0x14')?sequelize['cast'](sequelize[_0x9bdc('0x18')](_0x9bdc('0x14')),'unsigned'):_0x174562,_0x9bdc('0x19')];}});}return _0x51bfdc;};exports[_0x9bdc('0x1a')]=function(_0x5c1fcb,_0x165e1a){if(_[_0x9bdc('0x1b')](_0x5c1fcb)){return _0x5c1fcb;}if(_[_0x9bdc('0xf')](_0x5c1fcb)){for(var _0x37bc9c=0x0;_0x37bc9c<_0x5c1fcb[_0x9bdc('0x1c')];_0x37bc9c+=0x1){_0x5c1fcb[_0x37bc9c]=this[_0x9bdc('0x1a')](_0x5c1fcb[_0x37bc9c],_0x165e1a);}return _0x5c1fcb;}if(!_['isObject'](_0x5c1fcb)){return _0x5c1fcb;}if(_[_0x9bdc('0x1d')](_0x165e1a)){_0x165e1a=[_0x165e1a];}if(!_[_0x9bdc('0xf')](_0x165e1a)){return _0x5c1fcb;}for(var _0x409f20=0x0;_0x409f20<_0x165e1a['length'];_0x409f20+=0x1){_[_0x9bdc('0x1e')](_0x5c1fcb,_0x165e1a[_0x409f20]);}for(var _0x28a5ff in _0x5c1fcb){if(_0x5c1fcb['hasOwnProperty'](_0x28a5ff)){_0x5c1fcb[_0x28a5ff]=this[_0x9bdc('0x1a')](_0x5c1fcb[_0x28a5ff],_0x165e1a);}}return _0x5c1fcb;};exports[_0x9bdc('0x1f')]=function(_0x378025){return _0x378025[_0x9bdc('0x20')](RegExp(_0x9bdc('0x21')))?!![]:![];};exports[_0x9bdc('0x22')]=function(_0x973895){return _0x973895['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x14159d){var _0x4e2d03=[];_0x14159d[_0x9bdc('0x5')](/[ ,]+/)[_0x9bdc('0x23')](function(_0x360bd1){_0x360bd1=_0x360bd1[_0x9bdc('0x24')](/([^:]")"+/g,'$1');_0x360bd1='+'+_0x360bd1+'*';if(_0x360bd1['includes']('@'))_0x360bd1='\x22'+_0x360bd1+'\x22';_0x4e2d03[_0x9bdc('0x25')](_0x360bd1);});return _0x4e2d03[_0x9bdc('0x26')]('\x20');};exports[_0x9bdc('0x27')]=function(_0x5a7199,_0x120add,_0x246d6c){var _0x255284={},_0x4225ce={};if(_0x120add['query'][_0x9bdc('0x28')]){_0x120add['query']['id']=_0x120add[_0x9bdc('0x29')][_0x9bdc('0x28')];delete _0x120add[_0x9bdc('0x29')][_0x9bdc('0x28')];}_0x255284['model']=_['map'](_0x5a7199,'name');_0x255284[_0x9bdc('0x29')]=_[_0x9bdc('0x4')](_0x120add[_0x9bdc('0x29')]);_0x255284[_0x9bdc('0x6')]=_[_0x9bdc('0x2a')](_0x255284[_0x9bdc('0x2b')],_0x255284[_0x9bdc('0x29')]);_0x4225ce['attributes']=_['intersection'](_0x255284['model'],this[_0x9bdc('0x2c')](_0x120add[_0x9bdc('0x29')][_0x9bdc('0x2c')]));_0x4225ce['attributes']=_0x4225ce[_0x9bdc('0x2d')]['length']?_0x4225ce['attributes']:_0x255284[_0x9bdc('0x2b')];if(!_0x120add[_0x9bdc('0x29')][_0x9bdc('0x2e')]('nolimit')){_0x4225ce[_0x9bdc('0x10')]=this[_0x9bdc('0x10')](_0x120add['query']['limit']);_0x4225ce[_0x9bdc('0x2f')]=this[_0x9bdc('0x2f')](_0x120add[_0x9bdc('0x29')]['offset']);}_0x4225ce[_0x9bdc('0x30')]=this['sort'](_0x120add[_0x9bdc('0x29')][_0x9bdc('0x11')]);_0x4225ce[_0x9bdc('0x31')]=this[_0x9bdc('0x6')](_[_0x9bdc('0x32')](_0x120add[_0x9bdc('0x29')],_0x255284[_0x9bdc('0x6')]),_0x5a7199);if(_0x120add[_0x9bdc('0x29')][_0x9bdc('0x33')]){_0x4225ce[_0x9bdc('0x31')]=_['merge'](_0x4225ce['where'],{'$or':_[_0x9bdc('0x12')](_0x5a7199,function(_0xf06fb8){if(_0xf06fb8[_0x9bdc('0x34')]!==_0x9bdc('0x35')){if(_0x246d6c){return sequelize[_0x9bdc('0x31')](sequelize['fn']('lower',sequelize[_0x9bdc('0x18')](_0xf06fb8[_0x9bdc('0x36')])),{'$like':sequelize['fn'](_0x9bdc('0x37'),'%'+_0x120add[_0x9bdc('0x29')]['filter']+'%')});}else{var _0x7803ed={};_0x7803ed[_0xf06fb8['name']]={'$like':'%'+_0x120add[_0x9bdc('0x29')]['filter']+'%'};return _0x7803ed;}}})});}_0x4225ce=_[_0x9bdc('0x38')]({},_0x4225ce,_0x120add[_0x9bdc('0x39')]);return _0x4225ce;}; \ No newline at end of file +var _0x5e08=['parse','keys','includes','fields','filters','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','offset','sort','priority','col','unsigned','substr','DESC','cast','ASC','omit','isEmpty','length','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','join','getOptions','query','$id','map','intersection','model','nolimit','order','where','filter','VIRTUAL','lower','lodash'];(function(_0x32456c,_0x259250){var _0x3e8ee1=function(_0x3a3ec8){while(--_0x3a3ec8){_0x32456c['push'](_0x32456c['shift']());}};_0x3e8ee1(++_0x259250);}(_0x5e08,0x1b7));var _0x85e0=function(_0xd86d4b,_0x3e7b8e){_0xd86d4b=_0xd86d4b-0x0;var _0x25c36f=_0x5e08[_0xd86d4b];return _0x25c36f;};'use strict';var _=require(_0x85e0('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x354874){var _0x2a151f=['ne'];try{var _0x1f1d96=JSON[_0x85e0('0x1')](_0x354874);var _0x281ca0=Object[_0x85e0('0x2')](_0x1f1d96)[0x0];return _0x2a151f[_0x85e0('0x3')](_0x281ca0);}catch(_0x48db35){return![];}}function getOperatorValue(_0x3a9c9b){var _0x49a90c=JSON[_0x85e0('0x1')](_0x3a9c9b);var _0x56a7b5=Object[_0x85e0('0x2')](_0x49a90c)[0x0];var _0xc09bae=_0x49a90c[_0x56a7b5];return{['$'+_0x56a7b5]:_0xc09bae};}exports[_0x85e0('0x4')]=function(_0x27c77e){var _0x20a2ae=null;if(_0x27c77e){_0x20a2ae=_0x27c77e['split'](',');}return _0x20a2ae;};exports[_0x85e0('0x5')]=function(_0x854fe9,_0x4339e6){var _0x31ad69={};if(!_['isEmpty'](_0x854fe9)){_[_0x85e0('0x6')](_0x854fe9,function(_0x3ccce1,_0x57cde0){try{if(_0x4339e6){var _0x48027e=_[_0x85e0('0x7')](_0x4339e6,{'name':_0x57cde0})||{};if(hasSequelizeOperator(_0x3ccce1)){_0x31ad69[_0x57cde0]=getOperatorValue(_0x3ccce1);}else if(_0x48027e[_0x85e0('0x8')]==='DATE'&&_[_0x85e0('0x9')](_0x3ccce1)){var _0x3505c8=JSON[_0x85e0('0x1')](_0x3ccce1);var _0x8975e7={'$gte':moment(moment(_0x3505c8[_0x85e0('0xa')])[_0x85e0('0xb')](_0x85e0('0xc')))[_0x85e0('0xd')]()[_0x85e0('0xb')](),'$lte':moment(moment(_0x3505c8[_0x85e0('0xe')])[_0x85e0('0xb')](_0x85e0('0xc')))[_0x85e0('0xd')]()[_0x85e0('0xf')](0x1,'s')[_0x85e0('0xb')]()};_0x31ad69[_0x57cde0]=_0x8975e7;}else if(_0x48027e[_0x85e0('0x10')]===_0x85e0('0x11')){_0x31ad69[_0x57cde0]=_0x3ccce1;}else{_0x31ad69[_0x57cde0]=_[_0x85e0('0x12')](_0x3ccce1)?_0x3ccce1:JSON['parse'](_0x3ccce1);}}else{_0x31ad69[_0x57cde0]=_[_0x85e0('0x12')](_0x3ccce1)?_0x3ccce1:JSON[_0x85e0('0x1')](_0x3ccce1);}}catch(_0x54f7eb){_0x31ad69[_0x57cde0]=_0x3ccce1[_0x85e0('0x13')](',');}});}return _0x31ad69;};exports[_0x85e0('0x14')]=function(_0x51dd74){_0x51dd74=parseInt(_0x51dd74,0xa);if(!_0x51dd74||_0x51dd74<0x0){_0x51dd74=LIMIT_VALUE;}return _0x51dd74;};exports[_0x85e0('0x15')]=function(_0x1b28ce){_0x1b28ce=parseInt(_0x1b28ce,0xa);if(!_0x1b28ce||_0x1b28ce<0x0){_0x1b28ce=0x0;}return _0x1b28ce;};exports[_0x85e0('0x16')]=function(_0x32b4cc){var _0x2a737a,_0x284319=null;if(_0x32b4cc){_0x2a737a=_0x32b4cc[_0x85e0('0x13')](',');_0x284319=_['map'](_0x2a737a,function(_0x116950){if(_0x116950['indexOf']('-')===0x0){return[_0x116950===_0x85e0('0x17')?sequelize['cast'](sequelize[_0x85e0('0x18')]('priority'),_0x85e0('0x19')):_0x116950[_0x85e0('0x1a')](0x1),_0x85e0('0x1b')];}else{return[_0x116950===_0x85e0('0x17')?sequelize[_0x85e0('0x1c')](sequelize[_0x85e0('0x18')]('priority'),'unsigned'):_0x116950,_0x85e0('0x1d')];}});}return _0x284319;};exports[_0x85e0('0x1e')]=function(_0x5b2c99,_0x1579d5){if(_[_0x85e0('0x1f')](_0x5b2c99)){return _0x5b2c99;}if(_[_0x85e0('0x12')](_0x5b2c99)){for(var _0x4ead87=0x0;_0x4ead87<_0x5b2c99[_0x85e0('0x20')];_0x4ead87+=0x1){_0x5b2c99[_0x4ead87]=this[_0x85e0('0x1e')](_0x5b2c99[_0x4ead87],_0x1579d5);}return _0x5b2c99;}if(!_['isObject'](_0x5b2c99)){return _0x5b2c99;}if(_[_0x85e0('0x21')](_0x1579d5)){_0x1579d5=[_0x1579d5];}if(!_[_0x85e0('0x12')](_0x1579d5)){return _0x5b2c99;}for(var _0x2edd64=0x0;_0x2edd64<_0x1579d5[_0x85e0('0x20')];_0x2edd64+=0x1){_[_0x85e0('0x22')](_0x5b2c99,_0x1579d5[_0x2edd64]);}for(var _0x10fef6 in _0x5b2c99){if(_0x5b2c99[_0x85e0('0x23')](_0x10fef6)){_0x5b2c99[_0x10fef6]=this[_0x85e0('0x1e')](_0x5b2c99[_0x10fef6],_0x1579d5);}}return _0x5b2c99;};exports[_0x85e0('0x24')]=function(_0x48ebc0){return _0x48ebc0[_0x85e0('0x25')](RegExp(_0x85e0('0x26')))?!![]:![];};exports[_0x85e0('0x27')]=function(_0x56e13e){return _0x56e13e[_0x85e0('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x85e0('0x28')]=function(_0x12abec){var _0x17db2c=[];_0x12abec[_0x85e0('0x13')](/[ ,]+/)[_0x85e0('0x29')](function(_0x3703c0){_0x3703c0=_0x3703c0['replace'](/([^:]")"+/g,'$1');_0x3703c0='+'+_0x3703c0+'*';if(_0x3703c0[_0x85e0('0x3')]('@'))_0x3703c0='\x22'+_0x3703c0+'\x22';_0x17db2c['push'](_0x3703c0);});return _0x17db2c[_0x85e0('0x2a')]('\x20');};exports[_0x85e0('0x2b')]=function(_0xc72c61,_0x316703,_0x2a4481){var _0x3adb1f={},_0x1f1a0f={};if(_0x316703[_0x85e0('0x2c')][_0x85e0('0x2d')]){_0x316703['query']['id']=_0x316703['query'][_0x85e0('0x2d')];delete _0x316703['query'][_0x85e0('0x2d')];}_0x3adb1f['model']=_[_0x85e0('0x2e')](_0xc72c61,_0x85e0('0x10'));_0x3adb1f[_0x85e0('0x2c')]=_[_0x85e0('0x2')](_0x316703[_0x85e0('0x2c')]);_0x3adb1f[_0x85e0('0x5')]=_[_0x85e0('0x2f')](_0x3adb1f['model'],_0x3adb1f[_0x85e0('0x2c')]);_0x1f1a0f['attributes']=_['intersection'](_0x3adb1f[_0x85e0('0x30')],this[_0x85e0('0x4')](_0x316703['query'][_0x85e0('0x4')]));_0x1f1a0f['attributes']=_0x1f1a0f['attributes'][_0x85e0('0x20')]?_0x1f1a0f['attributes']:_0x3adb1f[_0x85e0('0x30')];if(!_0x316703[_0x85e0('0x2c')][_0x85e0('0x23')](_0x85e0('0x31'))){_0x1f1a0f[_0x85e0('0x14')]=this['limit'](_0x316703[_0x85e0('0x2c')][_0x85e0('0x14')]);_0x1f1a0f['offset']=this['offset'](_0x316703[_0x85e0('0x2c')][_0x85e0('0x15')]);}_0x1f1a0f[_0x85e0('0x32')]=this[_0x85e0('0x16')](_0x316703['query'][_0x85e0('0x16')]);_0x1f1a0f[_0x85e0('0x33')]=this[_0x85e0('0x5')](_['pick'](_0x316703[_0x85e0('0x2c')],_0x3adb1f[_0x85e0('0x5')]),_0xc72c61);if(_0x316703[_0x85e0('0x2c')][_0x85e0('0x34')]){_0x1f1a0f[_0x85e0('0x33')]=_['merge'](_0x1f1a0f['where'],{'$or':_['map'](_0xc72c61,function(_0x110340){if(_0x110340[_0x85e0('0x8')]!==_0x85e0('0x35')){if(_0x2a4481){return sequelize[_0x85e0('0x33')](sequelize['fn'](_0x85e0('0x36'),sequelize[_0x85e0('0x18')](_0x110340[_0x85e0('0x10')])),{'$like':sequelize['fn'](_0x85e0('0x36'),'%'+_0x316703['query'][_0x85e0('0x34')]+'%')});}else{var _0x3c486b={};_0x3c486b[_0x110340[_0x85e0('0x10')]]={'$like':'%'+_0x316703[_0x85e0('0x2c')][_0x85e0('0x34')]+'%'};return _0x3c486b;}}})});}_0x1f1a0f=_['merge']({},_0x1f1a0f,_0x316703['options']);return _0x1f1a0f;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8fd8d7e..ac158db 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e5e=['set','appPath','join','public','development','test','client','use','json\x20replacer','toISOString','views','root','html','ejs','renderFile','view\x20engine','urlencoded','50mb','serve-favicon','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production'];(function(_0xa962ef,_0x24dc70){var _0x1fc2a5=function(_0x10ce26){while(--_0x10ce26){_0xa962ef['push'](_0xa962ef['shift']());}};_0x1fc2a5(++_0x24dc70);}(_0x3e5e,0x148));var _0xe3e5=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3e5e[_0x57b54c];return _0x59cc19;};'use strict';var express=require('express');var favicon=require(_0xe3e5('0x0'));var bodyParser=require('body-parser');var methodOverride=require(_0xe3e5('0x1'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xe3e5('0x2'));var path=require(_0xe3e5('0x3'));var passport=require(_0xe3e5('0x4'));var cors=require(_0xe3e5('0x5'));var moment=require(_0xe3e5('0x6'));var config=require(_0xe3e5('0x7'));var db=require(_0xe3e5('0x8'))['db'];exports[_0xe3e5('0x9')]=function(_0x257b93){var _0x25f7ba=_0x257b93[_0xe3e5('0xa')](_0xe3e5('0xb'));if(_0x25f7ba===_0xe3e5('0xc')){_0x257b93[_0xe3e5('0xd')](_0xe3e5('0xe'),path[_0xe3e5('0xf')](config['root'],_0xe3e5('0x10')));}if(_0x25f7ba===_0xe3e5('0x11')||_0x25f7ba===_0xe3e5('0x12')){_0x257b93[_0xe3e5('0xd')](_0xe3e5('0xe'),path[_0xe3e5('0xf')](config['root'],_0xe3e5('0x13')));_0x257b93[_0xe3e5('0x14')](errorHandler());}_0x257b93['set'](_0xe3e5('0x15'),function(_0x3d9754,_0x1ebf50){if(this[_0x3d9754]instanceof Date){_0x1ebf50=this[_0x3d9754][_0xe3e5('0x16')]()['split']('.')[0x0]+'Z';}return _0x1ebf50;});_0x257b93[_0xe3e5('0x14')](express['static'](_0x257b93[_0xe3e5('0xa')](_0xe3e5('0xe'))));_0x257b93['set'](_0xe3e5('0x17'),config[_0xe3e5('0x18')]+'/server/views');_0x257b93['engine'](_0xe3e5('0x19'),require(_0xe3e5('0x1a'))[_0xe3e5('0x1b')]);_0x257b93[_0xe3e5('0xd')](_0xe3e5('0x1c'),'html');_0x257b93[_0xe3e5('0x14')](bodyParser[_0xe3e5('0x1d')]({'limit':_0xe3e5('0x1e'),'extended':!![]}));_0x257b93[_0xe3e5('0x14')](bodyParser['json']({'limit':_0xe3e5('0x1e')}));_0x257b93[_0xe3e5('0x14')](cors());_0x257b93[_0xe3e5('0x14')](methodOverride());_0x257b93['use'](cookieParser());_0x257b93[_0xe3e5('0x14')](passport['initialize']());}; \ No newline at end of file +var _0x7dea=['path','passport','moment','default','get','env','production','set','appPath','join','root','development','client','toISOString','split','use','static','views','/server/views','engine','html','urlencoded','50mb','express','serve-favicon','method-override','cookie-parser','errorhandler'];(function(_0x30f67f,_0x236a59){var _0x21839f=function(_0x432cb8){while(--_0x432cb8){_0x30f67f['push'](_0x30f67f['shift']());}};_0x21839f(++_0x236a59);}(_0x7dea,0x87));var _0xa7de=function(_0x3da919,_0x401ebe){_0x3da919=_0x3da919-0x0;var _0x4275d0=_0x7dea[_0x3da919];return _0x4275d0;};'use strict';var express=require(_0xa7de('0x0'));var favicon=require(_0xa7de('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0xa7de('0x2'));var cookieParser=require(_0xa7de('0x3'));var errorHandler=require(_0xa7de('0x4'));var path=require(_0xa7de('0x5'));var passport=require(_0xa7de('0x6'));var cors=require('cors');var moment=require(_0xa7de('0x7'));var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0xa7de('0x8')]=function(_0x3e99e1){var _0x45b52d=_0x3e99e1[_0xa7de('0x9')](_0xa7de('0xa'));if(_0x45b52d===_0xa7de('0xb')){_0x3e99e1[_0xa7de('0xc')](_0xa7de('0xd'),path[_0xa7de('0xe')](config[_0xa7de('0xf')],'public'));}if(_0x45b52d===_0xa7de('0x10')||_0x45b52d==='test'){_0x3e99e1['set'](_0xa7de('0xd'),path[_0xa7de('0xe')](config[_0xa7de('0xf')],_0xa7de('0x11')));_0x3e99e1['use'](errorHandler());}_0x3e99e1['set']('json\x20replacer',function(_0x6baac0,_0x4579d1){if(this[_0x6baac0]instanceof Date){_0x4579d1=this[_0x6baac0][_0xa7de('0x12')]()[_0xa7de('0x13')]('.')[0x0]+'Z';}return _0x4579d1;});_0x3e99e1[_0xa7de('0x14')](express[_0xa7de('0x15')](_0x3e99e1[_0xa7de('0x9')](_0xa7de('0xd'))));_0x3e99e1[_0xa7de('0xc')](_0xa7de('0x16'),config[_0xa7de('0xf')]+_0xa7de('0x17'));_0x3e99e1[_0xa7de('0x18')](_0xa7de('0x19'),require('ejs')['renderFile']);_0x3e99e1[_0xa7de('0xc')]('view\x20engine','html');_0x3e99e1[_0xa7de('0x14')](bodyParser[_0xa7de('0x1a')]({'limit':_0xa7de('0x1b'),'extended':!![]}));_0x3e99e1['use'](bodyParser['json']({'limit':_0xa7de('0x1b')}));_0x3e99e1[_0xa7de('0x14')](cors());_0x3e99e1[_0xa7de('0x14')](methodOverride());_0x3e99e1[_0xa7de('0x14')](cookieParser());_0x3e99e1[_0xa7de('0x14')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 98c4d7e..b0d4391 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 _0x0601=['concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5','digest','hex','getUuid','licenseToken','test','dmidecode\x20--string\x20system-uuid','macAddress','ipAddress','createHash','update','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal'];(function(_0x434ec1,_0x16624f){var _0x2b6848=function(_0x53cbd5){while(--_0x53cbd5){_0x434ec1['push'](_0x434ec1['shift']());}};_0x2b6848(++_0x16624f);}(_0x0601,0x1ba));var _0x1060=function(_0x31dfdd,_0x4b55f9){_0x31dfdd=_0x31dfdd-0x0;var _0x30f59b=_0x0601[_0x31dfdd];return _0x30f59b;};'use strict';var _=require(_0x1060('0x0'));var os=require('os');var crypto=require(_0x1060('0x1'));var machine=require(_0x1060('0x2'));var exec=require('child_process')[_0x1060('0x3')];var config=require(_0x1060('0x4'));function getInterfaces(){var _0x4c4e93=[];var _0x240c89=os[_0x1060('0x5')]();var _0x5d5ece=_[_0x1060('0x6')](_[_0x1060('0x7')](_0x240c89));for(var _0x4b566d=0x0;_0x4b566d<_0x5d5ece[_0x1060('0x8')];_0x4b566d++){var _0x4591ac=_0x240c89[_0x5d5ece[_0x4b566d]][_0x1060('0x9')](function(_0x2a0d9c){return _0x2a0d9c[_0x1060('0xa')]===_0x1060('0xb')&&_0x2a0d9c[_0x1060('0xc')]===![];});_0x4c4e93=_0x4c4e93[_0x1060('0xd')](_0x4591ac);}return _0x4c4e93;}function getFirstInterface(){var _0x44c808=_[_0x1060('0xe')](getInterfaces());return{'macAddress':_0x44c808&&_0x44c808['mac']?_0x44c808[_0x1060('0xf')]:'00:00:00:00:00:00','ipAddress':_0x44c808&&_0x44c808[_0x1060('0x10')]?_0x44c808[_0x1060('0x10')]:_0x1060('0x11')};}exports[_0x1060('0x12')]=getFirstInterface;function getCPUhash(){var _0x2dc6a3=_[_0x1060('0x6')](os[_0x1060('0x13')]()[_0x1060('0x14')](function(_0x49a306){return _0x49a306[_0x1060('0x15')];}))[_0x1060('0x16')](':');return crypto['createHash'](_0x1060('0x17'))['update'](_0x2dc6a3)[_0x1060('0x18')](_0x1060('0x19'));}exports[_0x1060('0x1a')]=function(){var _0x9aba84=os['platform']();var _0x1f6da1=/[0-9a-f-]{36}/;if(config[_0x1060('0x1b')]&&_0x1f6da1[_0x1060('0x1c')](config['licenseToken'])){return config[_0x1060('0x1b')];}else if(_0x9aba84==='win32'){return exec(_0x1060('0x1d'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x3c4201=getFirstInterface();var _0x43b047=getCPUhash();var _0x4aa1e5=_0x43b047+'|'+os['hostname']()+'|'+_0x3c4201[_0x1060('0x1e')]+'|'+_0x3c4201[_0x1060('0x1f')];var _0x25999a=crypto[_0x1060('0x20')]('md5')[_0x1060('0x21')](_0x4aa1e5)['digest'](_0x1060('0x19'));return _0x25999a[_0x1060('0x22')](0x0,0x8)+'-'+_0x25999a[_0x1060('0x22')](0x8,0xc)+'-'+_0x25999a[_0x1060('0x22')](0xc,0x10)+'-'+_0x25999a[_0x1060('0x22')](0x10,0x14)+'-'+_0x25999a[_0x1060('0x22')](0x14);}}; \ No newline at end of file +var _0x493b=['win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','map','createHash','update','digest','hex','getUuid','platform','licenseToken','test'];(function(_0x5162ed,_0x386cb7){var _0x4c579b=function(_0x189260){while(--_0x189260){_0x5162ed['push'](_0x5162ed['shift']());}};_0x4c579b(++_0x386cb7);}(_0x493b,0x1b3));var _0xb493=function(_0x465cd1,_0xc513e3){_0x465cd1=_0x465cd1-0x0;var _0x1f4f70=_0x493b[_0x465cd1];return _0x1f4f70;};'use strict';var _=require(_0xb493('0x0'));var os=require('os');var crypto=require(_0xb493('0x1'));var machine=require(_0xb493('0x2'));var exec=require(_0xb493('0x3'))[_0xb493('0x4')];var config=require('../environment');function getInterfaces(){var _0x2618ea=[];var _0x18ebd5=os['networkInterfaces']();var _0x4b1ef9=_[_0xb493('0x5')](_[_0xb493('0x6')](_0x18ebd5));for(var _0x6a9c09=0x0;_0x6a9c09<_0x4b1ef9[_0xb493('0x7')];_0x6a9c09++){var _0x5be51e=_0x18ebd5[_0x4b1ef9[_0x6a9c09]][_0xb493('0x8')](function(_0x116c36){return _0x116c36[_0xb493('0x9')]===_0xb493('0xa')&&_0x116c36[_0xb493('0xb')]===![];});_0x2618ea=_0x2618ea[_0xb493('0xc')](_0x5be51e);}return _0x2618ea;}function getFirstInterface(){var _0x24daf9=_[_0xb493('0xd')](getInterfaces());return{'macAddress':_0x24daf9&&_0x24daf9[_0xb493('0xe')]?_0x24daf9['mac']:_0xb493('0xf'),'ipAddress':_0x24daf9&&_0x24daf9[_0xb493('0x10')]?_0x24daf9[_0xb493('0x10')]:_0xb493('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xcd88e6=_['orderBy'](os['cpus']()[_0xb493('0x12')](function(_0x3a9d91){return _0x3a9d91['model'];}))['join'](':');return crypto[_0xb493('0x13')]('md5')[_0xb493('0x14')](_0xcd88e6)[_0xb493('0x15')](_0xb493('0x16'));}exports[_0xb493('0x17')]=function(){var _0x1bb1b1=os[_0xb493('0x18')]();var _0x4329f2=/[0-9a-f-]{36}/;if(config[_0xb493('0x19')]&&_0x4329f2[_0xb493('0x1a')](config['licenseToken'])){return config[_0xb493('0x19')];}else if(_0x1bb1b1===_0xb493('0x1b')){return exec(_0xb493('0x1c'),{'encoding':_0xb493('0x1d')})['replace']('\x0d\x0a','');}else{var _0x137bbc=getFirstInterface();var _0x342c81=getCPUhash();var _0x445097=_0x342c81+'|'+os[_0xb493('0x1e')]()+'|'+_0x137bbc['macAddress']+'|'+_0x137bbc['ipAddress'];var _0x49b8f5=crypto[_0xb493('0x13')](_0xb493('0x1f'))[_0xb493('0x14')](_0x445097)[_0xb493('0x15')](_0xb493('0x16'));return _0x49b8f5[_0xb493('0x20')](0x0,0x8)+'-'+_0x49b8f5[_0xb493('0x20')](0x8,0xc)+'-'+_0x49b8f5['substring'](0xc,0x10)+'-'+_0x49b8f5[_0xb493('0x20')](0x10,0x14)+'-'+_0x49b8f5['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 2b355ef..9eeed95 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 _0x1f95=['request-promise','bluebird','pkginfo','./hardware','license','https://www.xcallymotion.com','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','format','YYYY-MM-DD\x20HH:mm','decryptString','days','catch','message','getUuid','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','moment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1f95,0x127));var _0x51f9=function(_0x5b10ca,_0x5b10fa){_0x5b10ca=_0x5b10ca-0x0;var _0x18b71e=_0x1f95[_0x5b10ca];return _0x18b71e;};'use strict';var util=require(_0x51f9('0x0'));var moment=require(_0x51f9('0x1'));var rp=require(_0x51f9('0x2'));var BPromise=require(_0x51f9('0x3'));var pkginfo=require(_0x51f9('0x4'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x51f9('0x5'));var logger=require('../logger')(_0x51f9('0x6'));var HOST=_0x51f9('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x34b37a){return new BPromise(function(_0x4dbbd5,_0x38a00b){var _0xcedb1d=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x34b37a,module[_0x51f9('0x8')][_0x51f9('0x9')]);if(oldToken){_0xcedb1d=util['format'](_0x51f9('0xa'),HOST,_0x34b37a,module[_0x51f9('0x8')][_0x51f9('0x9')],oldToken);}var _0x4e4dda={'uri':_0xcedb1d,'method':_0x51f9('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x4e4dda)[_0x51f9('0xc')](function(_0x2b60b1){_0x4dbbd5(_0x2b60b1);})['catch'](function(_0x1496c4){_0x38a00b(_0x1496c4);});});}function manageLicense(_0x3b8699,_0x26280c){var _0x53a35e=_0x26280c[_0x51f9('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x53a35e[_0x51f9('0xe')]!==_0x3b8699&&!_0x53a35e[_0x51f9('0xf')]){oldToken=_0x53a35e[_0x51f9('0xe')];}httpRequest(_0x3b8699)[_0x51f9('0xc')](function(_0x5831db){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5831db['active']){isOldTokenSent=![];if(!_0x53a35e['license']&&_0x53a35e[_0x51f9('0x6')]!=_0x5831db[_0x51f9('0x6')]||_0x53a35e['license']&&_0x53a35e[_0x51f9('0xf')]){logger[_0x51f9('0x10')](_0x51f9('0x11'));}if(_0x53a35e['license']&&!_0x53a35e[_0x51f9('0xf')]&&_0x53a35e[_0x51f9('0x6')]!=_0x5831db[_0x51f9('0x6')]){logger[_0x51f9('0x10')](_0x51f9('0x12'));}if(_0x53a35e[_0x51f9('0x6')]&&!_0x53a35e['data2']&&_0x53a35e[_0x51f9('0x6')]==_0x5831db[_0x51f9('0x6')]){return _0x26280c;}return _0x26280c[_0x51f9('0x13')]({'data1':_0x3b8699,'data2':null,'license':_0x5831db['license']});}else{if(_0x5831db[_0x51f9('0x6')]||_0x53a35e['license']){if(!_0x53a35e[_0x51f9('0xf')]){if(_0x53a35e[_0x51f9('0xe')]==_0x3b8699){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x51f9('0x14'));}else{GRAY_PERIOD_REASON=_0x51f9('0x15');logger[_0x51f9('0x10')](_0x51f9('0x16'),_0x53a35e[_0x51f9('0xe')],_0x3b8699);}logger[_0x51f9('0x10')](_0x51f9('0x17'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x51f9('0x18')](_0x51f9('0x19')));return _0x26280c[_0x51f9('0x13')]({'data2':encryptor['encryptString'](moment()[_0x51f9('0x18')](_0x51f9('0x19')))});}else{if(moment()['diff'](encryptor[_0x51f9('0x1a')](_0x53a35e['data2']),_0x51f9('0x1b'))>DAYS){logger[_0x51f9('0x10')]('DEMO\x20START\x20AT\x20%s',moment()[_0x51f9('0x18')](_0x51f9('0x19')));isOldTokenSent=![];return _0x26280c[_0x51f9('0x13')]({'data1':_0x3b8699,'data2':null,'license':null});}}}else{if(_0x53a35e[_0x51f9('0xe')]!=_0x3b8699){logger[_0x51f9('0x10')](_0x51f9('0x16'),_0x53a35e['data1'],_0x3b8699);return _0x26280c['update']({'data1':_0x3b8699,'data2':null,'license':null});}}}return _0x26280c;})[_0x51f9('0xc')](function(_0x419f7f){_0x26280c=_0x419f7f;})[_0x51f9('0x1c')](function(_0x318fd8){logger['error'](_0x318fd8[_0x51f9('0x1d')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x26280c);},TIME);});}function defaultLicense(){var _0x29d77f=hardware[_0x51f9('0x1e')]();if(_0x29d77f){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x29d77f}})['spread'](function(_0x4dd68a,_0x226179){logger[_0x51f9('0x10')](_0x51f9('0x1f'),_0x29d77f);manageLicense(_0x29d77f,_0x4dd68a);})['catch'](function(_0x487428){logger[_0x51f9('0x20')](_0x487428['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xe00a=['util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default'];(function(_0x1d1c93,_0x5e7bff){var _0x5eade1=function(_0x243cc7){while(--_0x243cc7){_0x1d1c93['push'](_0x1d1c93['shift']());}};_0x5eade1(++_0x5e7bff);}(_0xe00a,0x1c2));var _0xae00=function(_0x305c3d,_0x28f50d){_0x305c3d=_0x305c3d-0x0;var _0x403d5e=_0xe00a[_0x305c3d];return _0x403d5e;};'use strict';var util=require(_0xae00('0x0'));var moment=require(_0xae00('0x1'));var rp=require(_0xae00('0x2'));var BPromise=require(_0xae00('0x3'));var pkginfo=require(_0xae00('0x4'))(module,_0xae00('0x5'));var db=require(_0xae00('0x6'))['db'];var encryptor=require(_0xae00('0x7'));var hardware=require(_0xae00('0x8'));var logger=require(_0xae00('0x9'))(_0xae00('0xa'));var HOST=_0xae00('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x39ba43){return new BPromise(function(_0x4f277e,_0x3d8fa1){var _0x1c5544=util[_0xae00('0xc')](_0xae00('0xd'),HOST,_0x39ba43,module[_0xae00('0xe')][_0xae00('0x5')]);if(oldToken){_0x1c5544=util['format'](_0xae00('0xf'),HOST,_0x39ba43,module[_0xae00('0xe')][_0xae00('0x5')],oldToken);}var _0x2691d7={'uri':_0x1c5544,'method':_0xae00('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x2691d7)[_0xae00('0x11')](function(_0x2405ad){_0x4f277e(_0x2405ad);})['catch'](function(_0x36b4dd){_0x3d8fa1(_0x36b4dd);});});}function manageLicense(_0x344bcd,_0x4e076b){var _0x4eaca8=_0x4e076b['get']({'plain':!![]});if(!isOldTokenSent&&_0x4eaca8[_0xae00('0x12')]!==_0x344bcd&&!_0x4eaca8[_0xae00('0x13')]){oldToken=_0x4eaca8[_0xae00('0x12')];}httpRequest(_0x344bcd)[_0xae00('0x11')](function(_0x3c725c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3c725c[_0xae00('0x14')]){isOldTokenSent=![];if(!_0x4eaca8[_0xae00('0xa')]&&_0x4eaca8[_0xae00('0xa')]!=_0x3c725c[_0xae00('0xa')]||_0x4eaca8[_0xae00('0xa')]&&_0x4eaca8[_0xae00('0x13')]){logger[_0xae00('0x15')](_0xae00('0x16'));}if(_0x4eaca8[_0xae00('0xa')]&&!_0x4eaca8['data2']&&_0x4eaca8['license']!=_0x3c725c[_0xae00('0xa')]){logger['info'](_0xae00('0x17'));}if(_0x4eaca8[_0xae00('0xa')]&&!_0x4eaca8[_0xae00('0x13')]&&_0x4eaca8[_0xae00('0xa')]==_0x3c725c['license']){return _0x4e076b;}return _0x4e076b[_0xae00('0x18')]({'data1':_0x344bcd,'data2':null,'license':_0x3c725c[_0xae00('0xa')]});}else{if(_0x3c725c['license']||_0x4eaca8[_0xae00('0xa')]){if(!_0x4eaca8[_0xae00('0x13')]){if(_0x4eaca8[_0xae00('0x12')]==_0x344bcd){GRAY_PERIOD_REASON=_0xae00('0x19');logger[_0xae00('0x15')](_0xae00('0x1a'));}else{GRAY_PERIOD_REASON=_0xae00('0x1b');logger[_0xae00('0x15')](_0xae00('0x1c'),_0x4eaca8['data1'],_0x344bcd);}logger[_0xae00('0x15')](_0xae00('0x1d'),GRAY_PERIOD_REASON[_0xae00('0x1e')](),moment()[_0xae00('0xc')](_0xae00('0x1f')));return _0x4e076b['update']({'data2':encryptor[_0xae00('0x20')](moment()[_0xae00('0xc')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xae00('0x21')](_0x4eaca8[_0xae00('0x13')]),_0xae00('0x22'))>DAYS){logger[_0xae00('0x15')](_0xae00('0x23'),moment()['format'](_0xae00('0x1f')));isOldTokenSent=![];return _0x4e076b[_0xae00('0x18')]({'data1':_0x344bcd,'data2':null,'license':null});}}}else{if(_0x4eaca8[_0xae00('0x12')]!=_0x344bcd){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4eaca8[_0xae00('0x12')],_0x344bcd);return _0x4e076b[_0xae00('0x18')]({'data1':_0x344bcd,'data2':null,'license':null});}}}return _0x4e076b;})[_0xae00('0x11')](function(_0x110b61){_0x4e076b=_0x110b61;})[_0xae00('0x24')](function(_0x597824){logger[_0xae00('0x25')](_0x597824[_0xae00('0x26')]);})[_0xae00('0x27')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4e076b);},TIME);});}function defaultLicense(){var _0x315366=hardware[_0xae00('0x28')]();if(_0x315366){return db['License'][_0xae00('0x29')]({'where':{'id':0x1},'defaults':{'data1':_0x315366}})[_0xae00('0x2a')](function(_0x4940d7,_0x172cb4){logger[_0xae00('0x15')](_0xae00('0x2b'),_0x315366);manageLicense(_0x315366,_0x4940d7);})[_0xae00('0x24')](function(_0x33cd82){logger[_0xae00('0x25')](_0x33cd82[_0xae00('0x26')]);});}}exports[_0xae00('0x2c')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 8f3ccb8..0a3f844 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 _0x7ca0=['sequelize','COUNT','col','role','count','admin','user','telephone','users','forEach','countBy','exports','util','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','deadline','days','grayReason','machineUuid','changed','disabled','message','findAll'];(function(_0x398790,_0x5da700){var _0x2f2f77=function(_0x1a254f){while(--_0x1a254f){_0x398790['push'](_0x398790['shift']());}};_0x2f2f77(++_0x5da700);}(_0x7ca0,0x8d));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x07ca('0x0'));var _=require('lodash');var moment=require(_0x07ca('0x1'));var BPromise=require(_0x07ca('0x2'));var hardware=require(_0x07ca('0x3'));var encryptor=require(_0x07ca('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x07ca('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x07ca('0x6'),'machineUuid':hardware[_0x07ca('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':_0x07ca('0x8'),'machineUuid':hardware[_0x07ca('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4fc98f){return new BPromise(function(_0x293abe,_0x298f7b){return db[_0x07ca('0x9')]['find'](_['defaults'](_0x4fc98f,{'raw':!![],'where':{'id':0x1}}))[_0x07ca('0xa')](function(_0x275431){return checkLicense(_0x275431,null);})[_0x07ca('0xa')](function(_0x255f4d){_0x293abe(_0x255f4d);return;})[_0x07ca('0xb')](function(_0x58f6e6){_0x298f7b(_0x58f6e6);});});}function checkLicense(_0x594839,_0x353cf6){if(!_0x594839){demoLicense[_0x07ca('0xc')]=_0x594839[_0x07ca('0xd')];return demoLicense;}try{var _0x59d572=_0x353cf6||_0x594839[_0x07ca('0xe')];if(_[_0x07ca('0xf')](_0x59d572)){throw new Error(_0x07ca('0x10'));}var _0x392d78=_0x594839[_0x07ca('0xd')];var _0x1dd561=_0x594839[_0x07ca('0x11')];var _0x1dcc7a=_0x392d78[_0x07ca('0x12')]('-')[0x4];var _0x1b3162=_0x392d78[_0x07ca('0x12')]('-')[0x0];var _0x3338ae=encryptor[_0x07ca('0x13')](_0x59d572,util['format'](_0x07ca('0x14'),_0x1dcc7a,_0x392d78,_0x1b3162));var _0x4a60e9=JSON[_0x07ca('0x15')](_0x3338ae);_0x4a60e9[_0x07ca('0x16')]=![];_0x4a60e9[_0x07ca('0xc')]=_0x392d78;_0x4a60e9['machineUuid']=hardware['getUuid']();if(_0x1dd561){var _0x3cb66d=encryptor[_0x07ca('0x13')](_0x1dd561);_0x4a60e9['gray']=_0x3cb66d;_0x4a60e9[_0x07ca('0x17')]=moment(_0x3cb66d)['add'](0x7,_0x07ca('0x18'))['format']();_0x4a60e9[_0x07ca('0x19')]=_0x4a60e9['uuid']!=_0x4a60e9[_0x07ca('0x1a')]?_0x07ca('0x1b'):_0x07ca('0x1c');}return _0x4a60e9;}catch(_0xc1b5f6){breakingLicense[_0x07ca('0xc')]=_0x594839['data1'];breakingLicense[_0x07ca('0x1d')]=_0xc1b5f6[_0x07ca('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5e634a,_0x1b88c1){getLicense()[_0x07ca('0xa')](function(_0xc22e20){return db['User'][_0x07ca('0x1e')]({'attributes':['role',[db[_0x07ca('0x1f')]['fn'](_0x07ca('0x20'),db[_0x07ca('0x1f')][_0x07ca('0x21')](_0x07ca('0x22'))),_0x07ca('0x23')]],'group':_0x07ca('0x22'),'where':{'role':{'$or':[_0x07ca('0x24'),_0x07ca('0x25'),_0x07ca('0x26')]}},'raw':!![]})[_0x07ca('0xa')](function(_0x24e407){var _0x48e618={'user':_0xc22e20[_0x07ca('0x27')]||0x0,'telephone':_0xc22e20['telephones']||0x0};_0x24e407[_0x07ca('0x28')](function(_0x540015){var _0x455488=_0x540015[_0x07ca('0x22')]===_0x07ca('0x24')?'user':_0x540015['role'];_0x48e618[_0x455488]-=_0x540015[_0x07ca('0x23')];if(_0x48e618[_0x455488]<0x0)_0x48e618[_0x455488]=0x0;});_0x5e634a(_0x48e618);return;});})[_0x07ca('0xb')](function(_0x219666){_0x1b88c1(_0x219666);});});}function checkUserLimits(_0x357ae5){return new BPromise(function(_0x550cd5,_0x410983){getLimits()['then'](function(_0x5a4669){var _0x5cc29a=_['pick'](_[_0x07ca('0x29')](_0x357ae5,_0x07ca('0x22')),[_0x07ca('0x24'),'user','telephone']);var _0x4409ce=(_0x5cc29a['admin']||0x0)+(_0x5cc29a['user']||0x0);var _0x37e8c3=_0x5cc29a[_0x07ca('0x26')]||0x0;if(_0x4409ce>_0x5a4669[_0x07ca('0x25')])return _0x410983('License\x20limit\x20reached\x20for\x20users');if(_0x37e8c3>_0x5a4669[_0x07ca('0x26')])return _0x410983('License\x20limit\x20reached\x20for\x20telephones');return _0x550cd5();})[_0x07ca('0xb')](function(_0x48744a){_0x410983(_0x48744a);});});}module[_0x07ca('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7abb=['lodash','bluebird','../../components/encryptor','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','decryptString','format','%s:%s:%s','parse','demo','machineUuid','getUuid','gray','deadline','add','grayReason','disabled','message','User','findAll','role','COUNT','sequelize','admin','telephone','users','forEach','count','pick','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util'];(function(_0x456429,_0x347a34){var _0x1c5d59=function(_0x3199a3){while(--_0x3199a3){_0x456429['push'](_0x456429['shift']());}};_0x1c5d59(++_0x347a34);}(_0x7abb,0x194));var _0xb7ab=function(_0x447cae,_0x4d1684){_0x447cae=_0x447cae-0x0;var _0x4870ec=_0x7abb[_0x447cae];return _0x4870ec;};'use strict';var util=require(_0xb7ab('0x0'));var _=require(_0xb7ab('0x1'));var moment=require('moment');var BPromise=require(_0xb7ab('0x2'));var hardware=require('./hardware');var encryptor=require(_0xb7ab('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb7ab('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb7ab('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1c4906){return new BPromise(function(_0x26cb95,_0x55c6ed){return db[_0xb7ab('0x6')][_0xb7ab('0x7')](_[_0xb7ab('0x8')](_0x1c4906,{'raw':!![],'where':{'id':0x1}}))[_0xb7ab('0x9')](function(_0x2b5f0f){return checkLicense(_0x2b5f0f,null);})[_0xb7ab('0x9')](function(_0x4f3bc9){_0x26cb95(_0x4f3bc9);return;})[_0xb7ab('0xa')](function(_0x58a4af){_0x55c6ed(_0x58a4af);});});}function checkLicense(_0x30ec8c,_0x48928c){if(!_0x30ec8c){demoLicense[_0xb7ab('0xb')]=_0x30ec8c[_0xb7ab('0xc')];return demoLicense;}try{var _0x3dcdb5=_0x48928c||_0x30ec8c[_0xb7ab('0xd')];if(_[_0xb7ab('0xe')](_0x3dcdb5)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x404709=_0x30ec8c[_0xb7ab('0xc')];var _0x913e1a=_0x30ec8c[_0xb7ab('0xf')];var _0x12c995=_0x404709['split']('-')[0x4];var _0x33ce7f=_0x404709['split']('-')[0x0];var _0x5c0aa5=encryptor[_0xb7ab('0x10')](_0x3dcdb5,util[_0xb7ab('0x11')](_0xb7ab('0x12'),_0x12c995,_0x404709,_0x33ce7f));var _0x12a278=JSON[_0xb7ab('0x13')](_0x5c0aa5);_0x12a278[_0xb7ab('0x14')]=![];_0x12a278[_0xb7ab('0xb')]=_0x404709;_0x12a278[_0xb7ab('0x15')]=hardware[_0xb7ab('0x16')]();if(_0x913e1a){var _0x597b51=encryptor['decryptString'](_0x913e1a);_0x12a278[_0xb7ab('0x17')]=_0x597b51;_0x12a278[_0xb7ab('0x18')]=moment(_0x597b51)[_0xb7ab('0x19')](0x7,'days')[_0xb7ab('0x11')]();_0x12a278[_0xb7ab('0x1a')]=_0x12a278['uuid']!=_0x12a278[_0xb7ab('0x15')]?'changed':_0xb7ab('0x1b');}return _0x12a278;}catch(_0x1d909d){breakingLicense['uuid']=_0x30ec8c[_0xb7ab('0xc')];breakingLicense[_0xb7ab('0x1c')]=_0x1d909d[_0xb7ab('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x598372,_0x24d632){getLicense()[_0xb7ab('0x9')](function(_0x5a8281){return db[_0xb7ab('0x1d')][_0xb7ab('0x1e')]({'attributes':[_0xb7ab('0x1f'),[db['sequelize']['fn'](_0xb7ab('0x20'),db[_0xb7ab('0x21')]['col'](_0xb7ab('0x1f'))),'count']],'group':_0xb7ab('0x1f'),'where':{'role':{'$or':[_0xb7ab('0x22'),'user',_0xb7ab('0x23')]}},'raw':!![]})['then'](function(_0x3c8dad){var _0x4eebd0={'user':_0x5a8281[_0xb7ab('0x24')]||0x0,'telephone':_0x5a8281['telephones']||0x0};_0x3c8dad[_0xb7ab('0x25')](function(_0x206081){var _0x45a721=_0x206081[_0xb7ab('0x1f')]===_0xb7ab('0x22')?'user':_0x206081[_0xb7ab('0x1f')];_0x4eebd0[_0x45a721]-=_0x206081[_0xb7ab('0x26')];if(_0x4eebd0[_0x45a721]<0x0)_0x4eebd0[_0x45a721]=0x0;});_0x598372(_0x4eebd0);return;});})[_0xb7ab('0xa')](function(_0x1bca72){_0x24d632(_0x1bca72);});});}function checkUserLimits(_0x28789c){return new BPromise(function(_0x593d75,_0x1b4d61){getLimits()[_0xb7ab('0x9')](function(_0x520ed0){var _0x5983e3=_[_0xb7ab('0x27')](_[_0xb7ab('0x28')](_0x28789c,'role'),[_0xb7ab('0x22'),_0xb7ab('0x29'),_0xb7ab('0x23')]);var _0x1d92b1=(_0x5983e3[_0xb7ab('0x22')]||0x0)+(_0x5983e3[_0xb7ab('0x29')]||0x0);var _0x50d209=_0x5983e3[_0xb7ab('0x23')]||0x0;if(_0x1d92b1>_0x520ed0['user'])return _0x1b4d61(_0xb7ab('0x2a'));if(_0x50d209>_0x520ed0[_0xb7ab('0x23')])return _0x1b4d61(_0xb7ab('0x2b'));return _0x593d75();})['catch'](function(_0x1ff435){_0x1b4d61(_0x1ff435);});});}module[_0xb7ab('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index b2ad4e1..42a7978 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 _0x7334=['myappanuglar-secret','exports','http://localhost:9000'];(function(_0x568f33,_0x41c7c1){var _0x436a97=function(_0x25ace5){while(--_0x25ace5){_0x568f33['push'](_0x568f33['shift']());}};_0x436a97(++_0x41c7c1);}(_0x7334,0x184));var _0x4733=function(_0x389035,_0x4605e8){_0x389035=_0x389035-0x0;var _0x5576d6=_0x7334[_0x389035];return _0x5576d6;};'use strict';module[_0x4733('0x0')]={'DOMAIN':_0x4733('0x1'),'SESSION_SECRET':_0x4733('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xb10b=['app-id','secret','exports','myappanuglar-secret'];(function(_0x3ed3cb,_0x2ef1fe){var _0x1cecd1=function(_0x22f8ff){while(--_0x22f8ff){_0x3ed3cb['push'](_0x3ed3cb['shift']());}};_0x1cecd1(++_0x2ef1fe);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f6e2d,_0x3ba8a5){_0x2f6e2d=_0x2f6e2d-0x0;var _0x3d122c=_0xb10b[_0x2f6e2d];return _0x3d122c;};'use strict';module[_0xbb10('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xbb10('0x1'),'GOOGLE_ID':_0xbb10('0x2'),'GOOGLE_SECRET':_0xbb10('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 8a31bd6..a34ec5b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf03=['level','toUpperCase','exports','Logger','transports','File','format','%s-%s','error','info','Console','env','debugLevel','moment','util','path','INFO','join','/var','xcally','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0xbf03,0x1e1));var _0x3bf0=function(_0x20356b,_0x5bc8c3){_0x20356b=_0x20356b-0x0;var _0x5c88e6=_0xbf03[_0x20356b];return _0x5c88e6;};'use strict';var moment=require(_0x3bf0('0x0'));var winston=require('winston');var util=require(_0x3bf0('0x1'));var path=require(_0x3bf0('0x2'));var debugLevel=_0x3bf0('0x3');function filename(_0xae499c,_0x4a52ed){return path[_0x3bf0('0x4')](_0x3bf0('0x5'),'log',_0x3bf0('0x6'),util['format'](_0x3bf0('0x7'),_0xae499c,_0x4a52ed));}function formatter(_0x1ae97d,_0x2d8176){_0x2d8176[_0x3bf0('0x8')]=_0x2d8176[_0x3bf0('0x8')][_0x3bf0('0x9')](/@@{/g,_0x3bf0('0xa'))[_0x3bf0('0x9')](/}@@/g,_0x3bf0('0xb'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x3bf0('0xc'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x2d8176[_0x3bf0('0xd')][_0x3bf0('0xe')](),_0x1ae97d,_0x2d8176[_0x3bf0('0x8')]);}module[_0x3bf0('0xf')]=function(_0x318b30){return new winston[(_0x3bf0('0x10'))]({'transports':[new winston[(_0x3bf0('0x11'))][(_0x3bf0('0x12'))]({'name':util[_0x3bf0('0x13')](_0x3bf0('0x14'),_0x318b30,_0x3bf0('0x15')),'filename':filename(_0x318b30,_0x3bf0('0x15')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4f93f1){return formatter(_0x318b30,_0x4f93f1);}}),new winston[(_0x3bf0('0x11'))][(_0x3bf0('0x12'))]({'name':util[_0x3bf0('0x13')](_0x3bf0('0x14'),_0x318b30,_0x3bf0('0x16')),'filename':filename(_0x318b30,_0x3bf0('0x16')),'level':_0x3bf0('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x490e7a){return formatter(_0x318b30,_0x490e7a);}}),new winston['transports'][(_0x3bf0('0x17'))]({'level':process[_0x3bf0('0x18')][_0x3bf0('0x19')]||debugLevel,'json':![],'formatter':function(_0x12dd58){return formatter(_0x318b30,_0x12dd58);}})]});}; \ No newline at end of file +var _0x2e2f=['transports','Console','env','moment','winston','util','path','join','/var','xcally','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','File','%s-%s','error','info'];(function(_0x485e06,_0xb655f2){var _0x29629e=function(_0x19dc0a){while(--_0x19dc0a){_0x485e06['push'](_0x485e06['shift']());}};_0x29629e(++_0xb655f2);}(_0x2e2f,0x1e7));var _0xf2e2=function(_0x200703,_0x4cccfd){_0x200703=_0x200703-0x0;var _0x5a32dc=_0x2e2f[_0x200703];return _0x5a32dc;};'use strict';var moment=require(_0xf2e2('0x0'));var winston=require(_0xf2e2('0x1'));var util=require(_0xf2e2('0x2'));var path=require(_0xf2e2('0x3'));var debugLevel='INFO';function filename(_0x46d3a0,_0x1f7bfe){return path[_0xf2e2('0x4')](_0xf2e2('0x5'),'log',_0xf2e2('0x6'),util['format']('%s-%s.log',_0x46d3a0,_0x1f7bfe));}function formatter(_0x5d184c,_0x979e93){_0x979e93['message']=_0x979e93['message']['replace'](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0xf2e2('0x7')](/@{/g,'{{')[_0xf2e2('0x7')](/}@/g,'}}');return util[_0xf2e2('0x8')](_0xf2e2('0x9'),moment()['format'](_0xf2e2('0xa')),_0x979e93[_0xf2e2('0xb')][_0xf2e2('0xc')](),_0x5d184c,_0x979e93[_0xf2e2('0xd')]);}module[_0xf2e2('0xe')]=function(_0x548716){return new winston['Logger']({'transports':[new winston['transports'][(_0xf2e2('0xf'))]({'name':util[_0xf2e2('0x8')](_0xf2e2('0x10'),_0x548716,_0xf2e2('0x11')),'filename':filename(_0x548716,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x49b84a){return formatter(_0x548716,_0x49b84a);}}),new winston['transports'][(_0xf2e2('0xf'))]({'name':util[_0xf2e2('0x8')](_0xf2e2('0x10'),_0x548716,_0xf2e2('0x12')),'filename':filename(_0x548716,'info'),'level':_0xf2e2('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e35ec){return formatter(_0x548716,_0x4e35ec);}}),new winston[(_0xf2e2('0x13'))][(_0xf2e2('0x14'))]({'level':process[_0xf2e2('0x15')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x3ae7a9){return formatter(_0x548716,_0x3ae7a9);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e6215f0..3964ac5 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 _0x0ac5=['../../services/express/index.js','ami','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join'];(function(_0x1d5ad0,_0x11fc89){var _0xe660dc=function(_0x443a78){while(--_0x443a78){_0x1d5ad0['push'](_0x1d5ad0['shift']());}};_0xe660dc(++_0x11fc89);}(_0x0ac5,0x123));var _0x50ac=function(_0x218915,_0x8e0325){_0x218915=_0x218915-0x0;var _0x3b8ed7=_0x0ac5[_0x218915];return _0x3b8ed7;};'use strict';var path=require(_0x50ac('0x0'));var os=require('os');var config={'apps':[{'name':_0x50ac('0x1'),'script':path[_0x50ac('0x2')](__dirname,_0x50ac('0x3'))},{'name':_0x50ac('0x4'),'script':path[_0x50ac('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x50ac('0x5'),'script':path[_0x50ac('0x2')](__dirname,_0x50ac('0x6'))},{'name':_0x50ac('0x7'),'script':path[_0x50ac('0x2')](__dirname,_0x50ac('0x8'))},{'name':_0x50ac('0x9'),'script':path[_0x50ac('0x2')](__dirname,_0x50ac('0xa'))},{'name':_0x50ac('0xb'),'script':path[_0x50ac('0x2')](__dirname,_0x50ac('0xc'))}]};module[_0x50ac('0xd')]=config; \ No newline at end of file +var _0xd349=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','agi','email','../../services/email/index.js','routing'];(function(_0x1af05b,_0x5134b5){var _0x5be7cc=function(_0x2d4ac0){while(--_0x2d4ac0){_0x1af05b['push'](_0x1af05b['shift']());}};_0x5be7cc(++_0x5134b5);}(_0xd349,0x18a));var _0x9d34=function(_0x4092dc,_0x1f48d4){_0x4092dc=_0x4092dc-0x0;var _0x5c4c29=_0xd349[_0x4092dc];return _0x5c4c29;};'use strict';var path=require(_0x9d34('0x0'));var os=require('os');var config={'apps':[{'name':_0x9d34('0x1'),'script':path[_0x9d34('0x2')](__dirname,_0x9d34('0x3'))},{'name':_0x9d34('0x4'),'script':path[_0x9d34('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x9d34('0x5'),'script':path[_0x9d34('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x9d34('0x6'),'script':path[_0x9d34('0x2')](__dirname,_0x9d34('0x7'))},{'name':_0x9d34('0x8'),'script':path['join'](__dirname,_0x9d34('0x9'))},{'name':_0x9d34('0xa'),'script':path[_0x9d34('0x2')](__dirname,_0x9d34('0xb'))}]};module[_0x9d34('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e7ce493..65c7a52 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 _0x10e1=['saved','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x50f892,_0x2c61dd){var _0x95ecdf=function(_0x179719){while(--_0x179719){_0x50f892['push'](_0x50f892['shift']());}};_0x95ecdf(++_0x2c61dd);}(_0x10e1,0x160));var _0x110e=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x10e1[_0x44946b];return _0x249bc4;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x110e('0x0'));function connect(){return new BPromise(function(_0x1963b4,_0x42ae72){return pm2[_0x110e('0x1')](function(_0x370b15){if(_0x370b15){return _0x42ae72(_0x370b15);}return _0x1963b4(_0x110e('0x2'));});});};exports[_0x110e('0x3')]=function(_0xb57178){return connect()[_0x110e('0x4')](function(){return new BPromise(function(_0x1d5f19,_0x3dbd8b){return pm2['start'](_0xb57178,function(_0x3411fe,_0x20dd93){if(_0x3411fe){return _0x3dbd8b(_0x3411fe);}pm2[_0x110e('0x5')]();return _0x1d5f19(_0x20dd93);});});});};exports[_0x110e('0x6')]=function(_0x329191){return connect()[_0x110e('0x4')](function(){return new BPromise(function(_0x394d45,_0x12c02a){return pm2[_0x110e('0x6')](_0x329191,function(_0x437c7a,_0x170bb4){if(_0x437c7a){return _0x12c02a(_0x437c7a);}pm2[_0x110e('0x5')]();return _0x394d45(_0x170bb4);});});});};exports[_0x110e('0x7')]=function(_0x4da825){return connect()[_0x110e('0x4')](function(){return new BPromise(function(_0x1a285f,_0x2c1731){return pm2[_0x110e('0x7')](_0x4da825,function(_0xce96d3,_0x3e8936){if(_0xce96d3){return _0x2c1731(_0xce96d3);}pm2[_0x110e('0x5')]();return _0x1a285f(_0x3e8936);});});});};exports[_0x110e('0x8')]=function(){return connect()[_0x110e('0x4')](function(){return new BPromise(function(_0xb2f552,_0x11c84c){return pm2['list'](function(_0x53ab5f,_0x35d0a0){if(_0x53ab5f){return _0x11c84c(_0x53ab5f);}pm2['disconnect']();return _0xb2f552(_0x35d0a0);});});});};exports['describe']=function(_0x5f3518){return connect()[_0x110e('0x4')](function(){return new BPromise(function(_0x178492,_0x1e5903){return pm2[_0x110e('0x9')](_0x5f3518,function(_0x5d8c81,_0x26f326){if(_0x5d8c81){return _0x1e5903(_0x5d8c81);}pm2[_0x110e('0x5')]();return _0x178492(_0x26f326);});});});};exports['delete']=function(_0x7fcc61){return connect()['then'](function(){return new BPromise(function(_0x1655ef,_0x2ac08){return pm2[_0x110e('0xa')](_0x7fcc61,function(_0x4921b7,_0xb93c07){if(_0x4921b7){return _0x2ac08(_0x4921b7);}pm2[_0x110e('0x5')]();return _0x1655ef(_0xb93c07);});});});};exports[_0x110e('0xb')]=function(){return connect()[_0x110e('0x4')](function(){return new BPromise(function(_0xbff566,_0x3b5139){return pm2[_0x110e('0xb')](function(_0x5ee1c1){if(_0x5ee1c1){return _0x3b5139(_0x5ee1c1);}return _0xbff566(_0x110e('0xc'));});});});}; \ No newline at end of file +var _0x5446=['delete','dump','saved','./config','connect','connected','start','disconnect','stop','then','restart','list','describe'];(function(_0x1ee23a,_0xceccc7){var _0xb13872=function(_0x534e04){while(--_0x534e04){_0x1ee23a['push'](_0x1ee23a['shift']());}};_0xb13872(++_0xceccc7);}(_0x5446,0x114));var _0x6544=function(_0x592563,_0x48526d){_0x592563=_0x592563-0x0;var _0x3f929e=_0x5446[_0x592563];return _0x3f929e;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x6544('0x0'));function connect(){return new BPromise(function(_0x422562,_0x278f54){return pm2[_0x6544('0x1')](function(_0x3b2ee4){if(_0x3b2ee4){return _0x278f54(_0x3b2ee4);}return _0x422562(_0x6544('0x2'));});});};exports[_0x6544('0x3')]=function(_0x17cf6f){return connect()['then'](function(){return new BPromise(function(_0x403481,_0x5cc52e){return pm2[_0x6544('0x3')](_0x17cf6f,function(_0x7a3360,_0x344e3a){if(_0x7a3360){return _0x5cc52e(_0x7a3360);}pm2[_0x6544('0x4')]();return _0x403481(_0x344e3a);});});});};exports[_0x6544('0x5')]=function(_0x217456){return connect()[_0x6544('0x6')](function(){return new BPromise(function(_0x37076e,_0x3dc07d){return pm2['stop'](_0x217456,function(_0xa41b68,_0xb122e1){if(_0xa41b68){return _0x3dc07d(_0xa41b68);}pm2['disconnect']();return _0x37076e(_0xb122e1);});});});};exports[_0x6544('0x7')]=function(_0xc6b153){return connect()[_0x6544('0x6')](function(){return new BPromise(function(_0x163db2,_0x340611){return pm2['restart'](_0xc6b153,function(_0x22a577,_0x546798){if(_0x22a577){return _0x340611(_0x22a577);}pm2[_0x6544('0x4')]();return _0x163db2(_0x546798);});});});};exports[_0x6544('0x8')]=function(){return connect()[_0x6544('0x6')](function(){return new BPromise(function(_0x4ff561,_0x2110d0){return pm2['list'](function(_0x40dad3,_0x448fc2){if(_0x40dad3){return _0x2110d0(_0x40dad3);}pm2[_0x6544('0x4')]();return _0x4ff561(_0x448fc2);});});});};exports[_0x6544('0x9')]=function(_0x4ff2cb){return connect()[_0x6544('0x6')](function(){return new BPromise(function(_0x4cbbfc,_0xe3c9a2){return pm2[_0x6544('0x9')](_0x4ff2cb,function(_0x5617a8,_0x1592ca){if(_0x5617a8){return _0xe3c9a2(_0x5617a8);}pm2[_0x6544('0x4')]();return _0x4cbbfc(_0x1592ca);});});});};exports[_0x6544('0xa')]=function(_0x3178b9){return connect()['then'](function(){return new BPromise(function(_0x269b07,_0x30151a){return pm2[_0x6544('0xa')](_0x3178b9,function(_0x5daf66,_0x2d45cb){if(_0x5daf66){return _0x30151a(_0x5daf66);}pm2['disconnect']();return _0x269b07(_0x2d45cb);});});});};exports[_0x6544('0xb')]=function(){return connect()[_0x6544('0x6')](function(){return new BPromise(function(_0x443187,_0x1a3335){return pm2[_0x6544('0xb')](function(_0x736407){if(_0x736407){return _0x1a3335(_0x736407);}return _0x443187(_0x6544('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1234e1b..4bd6e63 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 _0xa76a=['[CHAT]\x20Interactions\x20to\x20close:','join','system','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa76a,0x141));var _0xaa76=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0xa76a[_0x339129];return _0x1570df;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xaa76('0x0'));var util=require(_0xaa76('0x1'));var config=require(_0xaa76('0x2'));var db=require(_0xaa76('0x3'))['db'];var logger=require('../logger')(_0xaa76('0x4'));config[_0xaa76('0x5')]=_[_0xaa76('0x6')](config[_0xaa76('0x5')],{'host':_0xaa76('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x13baff=0x0;var _0x1484d3=[];return db[_0xaa76('0x8')][_0xaa76('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xaa76('0xa')](function(_0x57301e){_0x13baff=_0x57301e[_0xaa76('0xb')];if(_0x13baff){return db[_0xaa76('0xc')][_0xaa76('0xd')]({'raw':!![],'attributes':['id',_0xaa76('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xaa76('0xf')](_0x57301e[_0xaa76('0xb')],_0xaa76('0x10'))}}});}else{return[];}})[_0xaa76('0xa')](function(_0x314a0c){if(_0x314a0c&&_0x314a0c[_0xaa76('0x11')]){_0x1484d3=_[_0xaa76('0x12')](_0x314a0c||[],'id');logger[_0xaa76('0x13')](_0xaa76('0x14'),_0x1484d3[_0xaa76('0x15')]());return db['ChatInteraction']['update']({'closeReason':_0xaa76('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xaa76('0x17'))},{'where':{'id':_0x1484d3}});}})[_0xaa76('0xa')](function(){if(_0x1484d3&&_0x1484d3['length']){logger[_0xaa76('0x13')](_0xaa76('0x18'),_0x1484d3[_0xaa76('0x15')]());for(var _0xd1cb33=0x0;_0xd1cb33<_0x1484d3[_0xaa76('0x11')];_0xd1cb33++){io[_0xaa76('0x19')]('chatInteraction:update',{'id':_0x1484d3[_0xd1cb33],'closed':!![]});}}})[_0xaa76('0x1a')](function(_0x51c7b1){logger[_0xaa76('0x1b')](_0xaa76('0x1c'),_0x51c7b1?util[_0xaa76('0x1d')](_0x51c7b1,{'showHidden':![],'depth':null}):'');});}exports[_0xaa76('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfc2f=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','error','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','subtract','minutes','length','map','info','join'];(function(_0x266d04,_0x3932cf){var _0x1c2550=function(_0x2fbdbd){while(--_0x2fbdbd){_0x266d04['push'](_0x266d04['shift']());}};_0x1c2550(++_0x3932cf);}(_0xfc2f,0x196));var _0xffc2=function(_0xd3dfdc,_0x3befc9){_0xd3dfdc=_0xd3dfdc-0x0;var _0x6155c0=_0xfc2f[_0xd3dfdc];return _0x6155c0;};'use strict';var _=require(_0xffc2('0x0'));var moment=require('moment');var Redis=require(_0xffc2('0x1'));var util=require(_0xffc2('0x2'));var config=require(_0xffc2('0x3'));var db=require(_0xffc2('0x4'))['db'];var logger=require(_0xffc2('0x5'))(_0xffc2('0x6'));config[_0xffc2('0x7')]=_[_0xffc2('0x8')](config[_0xffc2('0x7')],{'host':_0xffc2('0x9'),'port':0x18eb});var io=require(_0xffc2('0xa'))(new Redis(config[_0xffc2('0x7')]));function closeInteractions(){var _0x4d3f98=0x0;var _0x34b85e=[];return db[_0xffc2('0xb')][_0xffc2('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xffc2('0xd')](function(_0x2e8ad4){_0x4d3f98=_0x2e8ad4[_0xffc2('0xe')];if(_0x4d3f98){return db[_0xffc2('0xf')][_0xffc2('0x10')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xffc2('0x11')](_0x2e8ad4[_0xffc2('0xe')],_0xffc2('0x12'))}}});}else{return[];}})[_0xffc2('0xd')](function(_0x29c906){if(_0x29c906&&_0x29c906[_0xffc2('0x13')]){_0x34b85e=_[_0xffc2('0x14')](_0x29c906||[],'id');logger[_0xffc2('0x15')]('[CHAT]\x20Interactions\x20to\x20close:',_0x34b85e[_0xffc2('0x16')]());return db[_0xffc2('0xf')][_0xffc2('0x17')]({'closeReason':_0xffc2('0x18'),'disposition':_0xffc2('0x19'),'closed':!![],'closedAt':moment()[_0xffc2('0x1a')](_0xffc2('0x1b'))},{'where':{'id':_0x34b85e}});}})[_0xffc2('0xd')](function(){if(_0x34b85e&&_0x34b85e[_0xffc2('0x13')]){logger['info'](_0xffc2('0x1c'),_0x34b85e[_0xffc2('0x16')]());for(var _0x3fa066=0x0;_0x3fa066<_0x34b85e[_0xffc2('0x13')];_0x3fa066++){io[_0xffc2('0x1d')]('chatInteraction:update',{'id':_0x34b85e[_0x3fa066],'closed':!![]});}}})['catch'](function(_0x4f9808){logger[_0xffc2('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x4f9808?util[_0xffc2('0x1f')](_0x4f9808,{'showHidden':![],'depth':null}):'');});}exports[_0xffc2('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 8870c10..b57d52e 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 _0x7b9f=['subtractUnit\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','toRun','my\x20id','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop','stop\x20cron','active','update\x20cron','run','path','moment','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','\x22%s\x22\x20<%s>','bcc','format','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x7b9f,0xd8));var _0xf7b9=function(_0x28315f,_0x195f03){_0x28315f=_0x28315f-0x0;var _0x949efc=_0x7b9f[_0x28315f];return _0x949efc;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xf7b9('0x0'));var _=require('lodash');var moment=require(_0xf7b9('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xf7b9('0x2'));var BPromise=require(_0xf7b9('0x3'));var logger=require(_0xf7b9('0x4'))('schedule');var db=require(_0xf7b9('0x5'))['db'];var analyticCustomReportController=require(_0xf7b9('0x6'));var analyticDefaultReportController=require(_0xf7b9('0x7'));var client=jayson['client'][_0xf7b9('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3bd81c,_0x3a47a3){return function(){logger['info'](_0xf7b9('0x9'),_0x3bd81c[_0xf7b9('0xa')]);var _0x5eae0d=!![];var _0x41a51d={'tls':{'rejectUnauthorized':![]}};if(_0x3bd81c[_0xf7b9('0xb')][_0xf7b9('0xc')][_0xf7b9('0xd')]){_0x41a51d[_0xf7b9('0xd')]=_0x3bd81c['MailAccount'][_0xf7b9('0xc')]['service'];}else{_0x41a51d[_0xf7b9('0xe')]=_0x3bd81c['MailAccount'][_0xf7b9('0xc')]['host'];_0x41a51d['port']=_0x3bd81c[_0xf7b9('0xb')][_0xf7b9('0xc')][_0xf7b9('0xf')];_0x41a51d[_0xf7b9('0x10')]=_0x3bd81c[_0xf7b9('0xb')][_0xf7b9('0xc')]['secure'];}if(_0x3bd81c[_0xf7b9('0xb')][_0xf7b9('0xc')][_0xf7b9('0x11')]){_0x41a51d[_0xf7b9('0x12')]={'user':_0x3bd81c[_0xf7b9('0xb')][_0xf7b9('0xc')][_0xf7b9('0x13')],'pass':_0x3bd81c[_0xf7b9('0xb')][_0xf7b9('0xc')]['pass']};}var _0x3d541d={'account':_0x41a51d,'message':{'from':util['format'](_0xf7b9('0x14'),_0x3bd81c[_0xf7b9('0xb')]['name'],_0x3bd81c[_0xf7b9('0xb')]['email']||_0x3bd81c[_0xf7b9('0xb')][_0xf7b9('0xc')]['user']),'to':_0x3bd81c[_0xf7b9('0xa')],'cc':_0x3bd81c['cc'],'bcc':_0x3bd81c[_0xf7b9('0x15')],'subject':util[_0xf7b9('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x3a47a3['name'],_0x3bd81c[_0xf7b9('0x17')],_0x3bd81c['subtractUnit'])}};var _0x1bbed0=path[_0xf7b9('0x18')](__dirname,_0xf7b9('0x19'));var _0x53d54c=_0x3a47a3[_0xf7b9('0x1a')];var _0x6d3ca2=util[_0xf7b9('0x16')](_0xf7b9('0x1b'),path[_0xf7b9('0x1c')](_0x3a47a3[_0xf7b9('0x1a')],path[_0xf7b9('0x1d')](_0x3a47a3[_0xf7b9('0x1a')])),_0xf7b9('0x1e'));var _0x353e42=path[_0xf7b9('0x18')](_0x1bbed0,_0x53d54c);var _0x41f248=path[_0xf7b9('0x18')](_0x1bbed0,_0x6d3ca2);if(fs[_0xf7b9('0x1f')](_0x353e42)){_0x3a47a3[_0xf7b9('0x20')]=_0xf7b9('0x21');_0x3d541d[_0xf7b9('0x22')][_0xf7b9('0x23')]=[{'filename':_0x53d54c,'path':_0x353e42}];_0x3d541d[_0xf7b9('0x22')][_0xf7b9('0x24')]=util[_0xf7b9('0x16')](_0xf7b9('0x25'),JSON[_0xf7b9('0x26')](_0x3a47a3,null,0x2));}else if(fs['existsSync'](_0x41f248)){_0x3a47a3[_0xf7b9('0x20')]=_0xf7b9('0x21');_0x3d541d['message'][_0xf7b9('0x23')]=[{'filename':_0x6d3ca2,'path':_0x41f248}];}else{_0x3d541d[_0xf7b9('0x22')]['text']=_0xf7b9('0x27');if(!_0x3bd81c[_0xf7b9('0x28')]){_0x5eae0d=![];logger[_0xf7b9('0x29')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5eae0d){return client['request'](_0xf7b9('0x2a'),_0x3d541d)[_0xf7b9('0x2b')](function(_0x429491){if(_0x429491['error']){return logger[_0xf7b9('0x2c')]('error\x20mail',JSON[_0xf7b9('0x26')](_0x429491));}return logger['info'](_0xf7b9('0x2d'));})[_0xf7b9('0x2e')](function(_0x221461){return logger[_0xf7b9('0x2c')](_0xf7b9('0x2f'),JSON[_0xf7b9('0x26')](_0x221461));});}};}function handleError(){return function(_0x36750f){return logger['error'](JSON[_0xf7b9('0x26')](_0x36750f));};}function handleResult(_0x13616f){return function(_0x156307){logger[_0xf7b9('0x29')](_0xf7b9('0x30'),JSON[_0xf7b9('0x26')](_0x156307));if(_0x13616f[_0xf7b9('0xb')]&&_0x13616f[_0xf7b9('0xb')][_0xf7b9('0xc')]&&!_[_0xf7b9('0x31')](_0x13616f['email'])){setTimeout(handleSendEmail(_0x13616f,_0x156307),0x3c*0x3e8);}};}function handleJob(_0x388aa7){return function(){try{if(_['isNil'](_0x388aa7[_0xf7b9('0x17')])){return logger[_0xf7b9('0x29')](_0xf7b9('0x32'));}if(_[_0xf7b9('0x31')](_0x388aa7['subtractUnit'])){return logger[_0xf7b9('0x29')](_0xf7b9('0x33'));}var _0x29d38c={'startDate':moment()[_0xf7b9('0x34')](_0x388aa7['subtractNumber'],_0x388aa7[_0xf7b9('0x35')])[_0xf7b9('0x16')](_0xf7b9('0x36')),'endDate':moment()[_0xf7b9('0x16')](_0xf7b9('0x36')),'type':_0xf7b9('0x37'),'output':_0x388aa7[_0xf7b9('0x38')],'name':_0x388aa7[_0xf7b9('0x39')]};if(!_[_0xf7b9('0x31')](_0x388aa7[_0xf7b9('0x3a')])){logger[_0xf7b9('0x29')](_0xf7b9('0x3b'),_0x388aa7[_0xf7b9('0x3a')]);return analyticDefaultReportController[_0xf7b9('0x3c')]({'id':_0x388aa7[_0xf7b9('0x3a')]},_0x29d38c)[_0xf7b9('0x2b')](handleResult(_0x388aa7))[_0xf7b9('0x2e')](handleError());}if(!_[_0xf7b9('0x31')](_0x388aa7[_0xf7b9('0x3d')])){logger[_0xf7b9('0x29')](_0xf7b9('0x3e'),_0x388aa7['CustomReportId']);return analyticCustomReportController[_0xf7b9('0x3c')]({'id':_0x388aa7[_0xf7b9('0x3d')]},_0x29d38c)[_0xf7b9('0x2b')](handleResult(_0x388aa7))['catch'](handleError());}}catch(_0x292b5d){logger['error'](JSON[_0xf7b9('0x26')](_0x292b5d));}return logger[_0xf7b9('0x29')](_0xf7b9('0x3f'));};}function getJobs(_0x362b91){var _0x41355d={};if(_0x362b91){_0x41355d['id']=_0x362b91;}return db['Schedule'][_0xf7b9('0x40')]({'where':_0x41355d,'include':[{'model':db[_0xf7b9('0xb')],'attributes':['id',_0xf7b9('0x39'),_0xf7b9('0xa')],'include':[{'model':db[_0xf7b9('0x41')],'as':_0xf7b9('0xc')}]}]})[_0xf7b9('0x2b')](function(_0x3d6586){var _0x3cd587=_['keys'](manager[_0xf7b9('0x42')]);var _0x27e4cf=_[_0xf7b9('0x43')](_0x3d6586,function(_0x328016){return _0x328016['id'][_0xf7b9('0x44')]();});var _0xd20e3c=_[_0xf7b9('0x45')](_0x3d6586,function(_0x2f629){return _0x2f629['id'][_0xf7b9('0x44')]();});var _0x5b7a0a=_0x362b91?_0x27e4cf:_[_0xf7b9('0x46')](_0x27e4cf,_0x3cd587);var _0x57eaf0=_[_0xf7b9('0x47')](_0x27e4cf,_0x3cd587);var _0x317f0d=_[_0xf7b9('0x46')](_0x3cd587,_0x27e4cf);var _0x323f30;var _0x42a8a5;for(_0x323f30=0x0;_0x323f30<_0x317f0d[_0xf7b9('0x48')]&&!_0x362b91;_0x323f30+=0x1){_0x42a8a5=_0x317f0d[_0x323f30]['toString']();if(manager[_0xf7b9('0x49')](_0x42a8a5)){manager['stop'](_0x42a8a5);manager[_0xf7b9('0x4a')](_0x42a8a5);logger[_0xf7b9('0x29')]('delete\x20cron',_0x42a8a5);}}logger[_0xf7b9('0x29')](_0xf7b9('0x4b'),JSON['stringify'](_0x5b7a0a));for(_0x323f30=0x0;_0x323f30<_0x5b7a0a[_0xf7b9('0x48')];_0x323f30+=0x1){_0x42a8a5=_0x5b7a0a[_0x323f30][_0xf7b9('0x44')]();logger['info']('index',_0x42a8a5);if(_0x362b91){logger[_0xf7b9('0x29')](_0xf7b9('0x4c'),_0x362b91);logger[_0xf7b9('0x29')](JSON[_0xf7b9('0x26')](_0xd20e3c[_0x42a8a5]));BPromise['resolve']()['then'](handleJob(_0xd20e3c[_0x42a8a5]));logger[_0xf7b9('0x29')]('run\x20job',_0xd20e3c[_0x42a8a5][_0xf7b9('0x39')],_0xd20e3c[_0x42a8a5]['cron']);}else if(_0xd20e3c[_0x42a8a5][_0xf7b9('0x4d')]&&_0xd20e3c[_0x42a8a5]['active']&&moment()[_0xf7b9('0x4e')](_0xd20e3c[_0x42a8a5][_0xf7b9('0x4f')],_0xd20e3c[_0x42a8a5][_0xf7b9('0x50')])){manager[_0xf7b9('0x51')](_0x42a8a5,_0xd20e3c[_0x42a8a5][_0xf7b9('0x4d')],handleJob(_0xd20e3c[_0x42a8a5]));manager[_0xf7b9('0x52')](_0x42a8a5);logger[_0xf7b9('0x29')](_0xf7b9('0x53'),_0xd20e3c[_0x42a8a5][_0xf7b9('0x39')],_0xd20e3c[_0x42a8a5]['cron']);}else if(manager['exists'](_0x42a8a5)){manager[_0xf7b9('0x54')](_0x42a8a5);manager[_0xf7b9('0x4a')](_0x42a8a5);logger['info'](_0xf7b9('0x55'),_0xd20e3c[_0x42a8a5]['name'],_0xd20e3c[_0x42a8a5]['cron']);}}for(_0x323f30=0x0,_0x42a8a5;_0x323f30<_0x57eaf0[_0xf7b9('0x48')]&&!_0x362b91;_0x323f30+=0x1){_0x42a8a5=_0x57eaf0[_0x323f30][_0xf7b9('0x44')]();if(manager[_0xf7b9('0x49')](_0x42a8a5)){if(_0xd20e3c[_0x42a8a5]['cron']&&_0xd20e3c[_0x42a8a5][_0xf7b9('0x56')]&&moment()[_0xf7b9('0x4e')](_0xd20e3c[_0x42a8a5][_0xf7b9('0x4f')],_0xd20e3c[_0x42a8a5][_0xf7b9('0x50')])){manager['update'](_0x42a8a5,_0xd20e3c[_0x42a8a5][_0xf7b9('0x4d')],handleJob(_0xd20e3c[_0x42a8a5]));logger[_0xf7b9('0x29')](_0xf7b9('0x57'),_0xd20e3c[_0x42a8a5][_0xf7b9('0x39')],_0xd20e3c[_0x42a8a5][_0xf7b9('0x4d')]);}else{manager[_0xf7b9('0x54')](_0x42a8a5);manager['deleteJob'](_0x42a8a5);logger['info'](_0xf7b9('0x55'),_0xd20e3c[_0x42a8a5]['name'],_0xd20e3c[_0x42a8a5][_0xf7b9('0x4d')]);}}}})[_0xf7b9('0x2e')](function(_0x41e295){logger[_0xf7b9('0x2c')](JSON[_0xf7b9('0x26')](_0x41e295));});}exports[_0xf7b9('0x58')]=function(_0x1ec82e){return getJobs(_0x1ec82e);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2b7e=['secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','MailServerOut','keys','map','toString','keyBy','difference','intersection','length','exists','stop','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','run','path','lodash','moment','cron-job-manager','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port'];(function(_0x530dcc,_0x4f4750){var _0x43d59c=function(_0x3e059f){while(--_0x3e059f){_0x530dcc['push'](_0x530dcc['shift']());}};_0x43d59c(++_0x4f4750);}(_0x2b7e,0xf4));var _0xe2b7=function(_0x2e3a6f,_0x1dd540){_0x2e3a6f=_0x2e3a6f-0x0;var _0x1fab60=_0x2b7e[_0x2e3a6f];return _0x1fab60;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xe2b7('0x0'));var _=require(_0xe2b7('0x1'));var moment=require(_0xe2b7('0x2'));var CronJobManager=require(_0xe2b7('0x3'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xe2b7('0x4'))(_0xe2b7('0x5'));var db=require(_0xe2b7('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xe2b7('0x7'));var client=jayson['client'][_0xe2b7('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2e972b,_0x640f29){return function(){logger[_0xe2b7('0x9')](_0xe2b7('0xa'),_0x2e972b[_0xe2b7('0xb')]);var _0x5c1b1c=!![];var _0x4c070e={'tls':{'rejectUnauthorized':![]}};if(_0x2e972b[_0xe2b7('0xc')]['Smtp'][_0xe2b7('0xd')]){_0x4c070e[_0xe2b7('0xd')]=_0x2e972b[_0xe2b7('0xc')][_0xe2b7('0xe')][_0xe2b7('0xd')];}else{_0x4c070e[_0xe2b7('0xf')]=_0x2e972b[_0xe2b7('0xc')]['Smtp']['host'];_0x4c070e['port']=_0x2e972b['MailAccount'][_0xe2b7('0xe')][_0xe2b7('0x10')];_0x4c070e[_0xe2b7('0x11')]=_0x2e972b['MailAccount'][_0xe2b7('0xe')]['secure'];}if(_0x2e972b[_0xe2b7('0xc')][_0xe2b7('0xe')]['authentication']){_0x4c070e[_0xe2b7('0x12')]={'user':_0x2e972b[_0xe2b7('0xc')]['Smtp'][_0xe2b7('0x13')],'pass':_0x2e972b['MailAccount'][_0xe2b7('0xe')][_0xe2b7('0x14')]};}var _0x5e2c66={'account':_0x4c070e,'message':{'from':util[_0xe2b7('0x15')](_0xe2b7('0x16'),_0x2e972b['MailAccount'][_0xe2b7('0x17')],_0x2e972b[_0xe2b7('0xc')][_0xe2b7('0xb')]||_0x2e972b[_0xe2b7('0xc')]['Smtp'][_0xe2b7('0x13')]),'to':_0x2e972b[_0xe2b7('0xb')],'cc':_0x2e972b['cc'],'bcc':_0x2e972b[_0xe2b7('0x18')],'subject':util[_0xe2b7('0x15')](_0xe2b7('0x19'),_0x640f29[_0xe2b7('0x17')],_0x2e972b[_0xe2b7('0x1a')],_0x2e972b[_0xe2b7('0x1b')])}};var _0x2ed62f=path[_0xe2b7('0x1c')](__dirname,_0xe2b7('0x1d'));var _0x473d65=_0x640f29[_0xe2b7('0x1e')];var _0x206dea=util[_0xe2b7('0x15')](_0xe2b7('0x1f'),path[_0xe2b7('0x20')](_0x640f29[_0xe2b7('0x1e')],path['extname'](_0x640f29['savename'])),_0xe2b7('0x21'));var _0x5dda40=path['join'](_0x2ed62f,_0x473d65);var _0x3773cb=path[_0xe2b7('0x1c')](_0x2ed62f,_0x206dea);if(fs[_0xe2b7('0x22')](_0x5dda40)){_0x640f29[_0xe2b7('0x23')]='Sent';_0x5e2c66['message']['attachments']=[{'filename':_0x473d65,'path':_0x5dda40}];_0x5e2c66['message']['text']=util[_0xe2b7('0x15')](_0xe2b7('0x24'),JSON[_0xe2b7('0x25')](_0x640f29,null,0x2));}else if(fs[_0xe2b7('0x22')](_0x3773cb)){_0x640f29['status']=_0xe2b7('0x26');_0x5e2c66[_0xe2b7('0x27')][_0xe2b7('0x28')]=[{'filename':_0x206dea,'path':_0x3773cb}];}else{_0x5e2c66['message'][_0xe2b7('0x29')]=_0xe2b7('0x2a');if(!_0x2e972b[_0xe2b7('0x2b')]){_0x5c1b1c=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5c1b1c){return client[_0xe2b7('0x2c')](_0xe2b7('0x2d'),_0x5e2c66)[_0xe2b7('0x2e')](function(_0x2c79cd){if(_0x2c79cd[_0xe2b7('0x2f')]){return logger['error'](_0xe2b7('0x30'),JSON[_0xe2b7('0x25')](_0x2c79cd));}return logger[_0xe2b7('0x9')]('email\x20sent');})[_0xe2b7('0x31')](function(_0x393cd8){return logger[_0xe2b7('0x2f')](_0xe2b7('0x30'),JSON[_0xe2b7('0x25')](_0x393cd8));});}};}function handleError(){return function(_0x2688b1){return logger[_0xe2b7('0x2f')](JSON[_0xe2b7('0x25')](_0x2688b1));};}function handleResult(_0x355a44){return function(_0x35d102){logger['info']('data',JSON[_0xe2b7('0x25')](_0x35d102));if(_0x355a44[_0xe2b7('0xc')]&&_0x355a44[_0xe2b7('0xc')][_0xe2b7('0xe')]&&!_[_0xe2b7('0x32')](_0x355a44[_0xe2b7('0xb')])){setTimeout(handleSendEmail(_0x355a44,_0x35d102),0x3c*0x3e8);}};}function handleJob(_0x3d68ac){return function(){try{if(_[_0xe2b7('0x32')](_0x3d68ac[_0xe2b7('0x1a')])){return logger[_0xe2b7('0x9')](_0xe2b7('0x33'));}if(_[_0xe2b7('0x32')](_0x3d68ac[_0xe2b7('0x1b')])){return logger[_0xe2b7('0x9')](_0xe2b7('0x34'));}var _0x58ef58={'startDate':moment()[_0xe2b7('0x35')](_0x3d68ac[_0xe2b7('0x1a')],_0x3d68ac[_0xe2b7('0x1b')])['format'](_0xe2b7('0x36')),'endDate':moment()[_0xe2b7('0x15')](_0xe2b7('0x36')),'type':_0xe2b7('0x37'),'output':_0x3d68ac[_0xe2b7('0x38')],'name':_0x3d68ac[_0xe2b7('0x17')]};if(!_[_0xe2b7('0x32')](_0x3d68ac[_0xe2b7('0x39')])){logger['info'](_0xe2b7('0x3a'),_0x3d68ac[_0xe2b7('0x39')]);return analyticDefaultReportController[_0xe2b7('0x3b')]({'id':_0x3d68ac[_0xe2b7('0x39')]},_0x58ef58)[_0xe2b7('0x2e')](handleResult(_0x3d68ac))[_0xe2b7('0x31')](handleError());}if(!_[_0xe2b7('0x32')](_0x3d68ac[_0xe2b7('0x3c')])){logger[_0xe2b7('0x9')](_0xe2b7('0x3d'),_0x3d68ac[_0xe2b7('0x3c')]);return analyticCustomReportController[_0xe2b7('0x3b')]({'id':_0x3d68ac[_0xe2b7('0x3c')]},_0x58ef58)['then'](handleResult(_0x3d68ac))[_0xe2b7('0x31')](handleError());}}catch(_0x59d43e){logger[_0xe2b7('0x2f')](JSON['stringify'](_0x59d43e));}return logger[_0xe2b7('0x9')]('no\x20report\x20id');};}function getJobs(_0x46fad6){var _0x3f67c9={};if(_0x46fad6){_0x3f67c9['id']=_0x46fad6;}return db['Schedule']['findAll']({'where':_0x3f67c9,'include':[{'model':db['MailAccount'],'attributes':['id',_0xe2b7('0x17'),_0xe2b7('0xb')],'include':[{'model':db[_0xe2b7('0x3e')],'as':_0xe2b7('0xe')}]}]})[_0xe2b7('0x2e')](function(_0x2fa0fe){var _0x55b7a9=_[_0xe2b7('0x3f')](manager['jobs']);var _0x31bf16=_[_0xe2b7('0x40')](_0x2fa0fe,function(_0xe7ff29){return _0xe7ff29['id'][_0xe2b7('0x41')]();});var _0x568467=_[_0xe2b7('0x42')](_0x2fa0fe,function(_0x14d0ed){return _0x14d0ed['id'][_0xe2b7('0x41')]();});var _0x513037=_0x46fad6?_0x31bf16:_[_0xe2b7('0x43')](_0x31bf16,_0x55b7a9);var _0x43b3d3=_[_0xe2b7('0x44')](_0x31bf16,_0x55b7a9);var _0x2b60cc=_[_0xe2b7('0x43')](_0x55b7a9,_0x31bf16);var _0x4cee9c;var _0x33046b;for(_0x4cee9c=0x0;_0x4cee9c<_0x2b60cc[_0xe2b7('0x45')]&&!_0x46fad6;_0x4cee9c+=0x1){_0x33046b=_0x2b60cc[_0x4cee9c][_0xe2b7('0x41')]();if(manager[_0xe2b7('0x46')](_0x33046b)){manager[_0xe2b7('0x47')](_0x33046b);manager['deleteJob'](_0x33046b);logger[_0xe2b7('0x9')]('delete\x20cron',_0x33046b);}}logger['info'](_0xe2b7('0x48'),JSON['stringify'](_0x513037));for(_0x4cee9c=0x0;_0x4cee9c<_0x513037[_0xe2b7('0x45')];_0x4cee9c+=0x1){_0x33046b=_0x513037[_0x4cee9c][_0xe2b7('0x41')]();logger[_0xe2b7('0x9')](_0xe2b7('0x49'),_0x33046b);if(_0x46fad6){logger[_0xe2b7('0x9')](_0xe2b7('0x4a'),_0x46fad6);logger[_0xe2b7('0x9')](JSON['stringify'](_0x568467[_0x33046b]));BPromise[_0xe2b7('0x4b')]()[_0xe2b7('0x2e')](handleJob(_0x568467[_0x33046b]));logger[_0xe2b7('0x9')]('run\x20job',_0x568467[_0x33046b][_0xe2b7('0x17')],_0x568467[_0x33046b][_0xe2b7('0x4c')]);}else if(_0x568467[_0x33046b][_0xe2b7('0x4c')]&&_0x568467[_0x33046b][_0xe2b7('0x4d')]&&moment()[_0xe2b7('0x4e')](_0x568467[_0x33046b][_0xe2b7('0x4f')],_0x568467[_0x33046b][_0xe2b7('0x50')])){manager[_0xe2b7('0x51')](_0x33046b,_0x568467[_0x33046b][_0xe2b7('0x4c')],handleJob(_0x568467[_0x33046b]));manager[_0xe2b7('0x52')](_0x33046b);logger['info'](_0xe2b7('0x53'),_0x568467[_0x33046b][_0xe2b7('0x17')],_0x568467[_0x33046b][_0xe2b7('0x4c')]);}else if(manager[_0xe2b7('0x46')](_0x33046b)){manager[_0xe2b7('0x47')](_0x33046b);manager[_0xe2b7('0x54')](_0x33046b);logger[_0xe2b7('0x9')](_0xe2b7('0x55'),_0x568467[_0x33046b][_0xe2b7('0x17')],_0x568467[_0x33046b]['cron']);}}for(_0x4cee9c=0x0,_0x33046b;_0x4cee9c<_0x43b3d3[_0xe2b7('0x45')]&&!_0x46fad6;_0x4cee9c+=0x1){_0x33046b=_0x43b3d3[_0x4cee9c][_0xe2b7('0x41')]();if(manager[_0xe2b7('0x46')](_0x33046b)){if(_0x568467[_0x33046b][_0xe2b7('0x4c')]&&_0x568467[_0x33046b]['active']&&moment()[_0xe2b7('0x4e')](_0x568467[_0x33046b]['startAt'],_0x568467[_0x33046b][_0xe2b7('0x50')])){manager['update'](_0x33046b,_0x568467[_0x33046b]['cron'],handleJob(_0x568467[_0x33046b]));logger[_0xe2b7('0x9')]('update\x20cron',_0x568467[_0x33046b][_0xe2b7('0x17')],_0x568467[_0x33046b][_0xe2b7('0x4c')]);}else{manager[_0xe2b7('0x47')](_0x33046b);manager[_0xe2b7('0x54')](_0x33046b);logger[_0xe2b7('0x9')]('stop\x20cron',_0x568467[_0x33046b]['name'],_0x568467[_0x33046b][_0xe2b7('0x4c')]);}}}})[_0xe2b7('0x31')](function(_0x557132){logger['error'](JSON['stringify'](_0x557132));});}exports[_0xe2b7('0x56')]=function(_0x38719b){return getJobs(_0x38719b);};exports[_0xe2b7('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index a0bec59..9f17b14 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 _0xdfe9=['TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','CloudProvider','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','start','lodash','request-promise','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x101e7a,_0x593f5e){_0x101e7a=_0x101e7a-0x0;var _0x403290=_0xdfe9[_0x101e7a];return _0x403290;};var _=require(_0x9dfe('0x0'));var AWS=require('aws-sdk');var rp=require(_0x9dfe('0x1'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x9dfe('0x2'))['db'];var logger=require(_0x9dfe('0x3'))(_0x9dfe('0x4'));function getTranscriptionJob(_0x35fd64,_0x1ed50f,_0x3c6d5a,_0x287b2c){return new Promise(function(_0x3678b1,_0x2b0d0b){var _0x3471f0=new AWS[(_0x9dfe('0x5'))]({'accessKeyId':_0x1ed50f,'secretAccessKey':_0x35fd64,'region':_0x3c6d5a});_0x3471f0['getTranscriptionJob']({'TranscriptionJobName':_0x287b2c},function(_0x377c1e,_0xa21ae3){if(_0x377c1e){return _0x2b0d0b(_0x377c1e);}else{return _0x3678b1(_0xa21ae3);}});});}function sentiment(_0x24f572,_0x411842,_0xcd9ecb,_0x13fa46,_0xff1698){return new Promise(function(_0xaed877,_0x58e7bb){var _0x263ad7=new AWS[(_0x9dfe('0x6'))]({'accessKeyId':_0x411842,'secretAccessKey':_0x24f572,'region':_0xcd9ecb});_0x263ad7[_0x9dfe('0x7')]({'Text':_0x13fa46,'LanguageCode':_0xff1698[_0x9dfe('0x8')](0x0,0x2)},function(_0x5f4511,_0x4ebe42){if(_0x5f4511){return _0x58e7bb(_0x5f4511);}else{return _0xaed877(_0x4ebe42);}});});}function checkTranscribeJob(_0x825165,_0x1f3678,_0x4da42d){var _0x547ae1;return new BPromise(function(_0x5d9256,_0x173898){logger[_0x9dfe('0x9')](util[_0x9dfe('0xa')](_0x9dfe('0xb'),_0x825165['id'],_0x825165[_0x9dfe('0xc')]));return getTranscriptionJob(_0x4da42d[_0x9dfe('0xd')],_0x4da42d[_0x9dfe('0xe')],_0x1f3678[_0x9dfe('0xf')],_0x825165[_0x9dfe('0xc')])['then'](function(_0x538be3){logger[_0x9dfe('0x9')](util['format'](_0x9dfe('0x10'),_0x825165['id'],_0x825165[_0x9dfe('0xc')],_0x538be3[_0x9dfe('0x11')][_0x9dfe('0x12')]));if(!_0x825165[_0x9dfe('0x13')]){switch(_0x538be3[_0x9dfe('0x11')]['TranscriptionJobStatus']){case _0x9dfe('0x14'):var _0x94082a={'transcribeStatus':_0x538be3[_0x9dfe('0x11')][_0x9dfe('0x12')],'fileUri':_0x538be3[_0x9dfe('0x11')][_0x9dfe('0x15')][_0x9dfe('0x16')]};logger[_0x9dfe('0x9')](util[_0x9dfe('0xa')](_0x9dfe('0x17'),_0x825165['id']));return rp({'uri':_0x538be3[_0x9dfe('0x11')][_0x9dfe('0x15')][_0x9dfe('0x16')],'json':!![]})[_0x9dfe('0x18')](function(_0x54ee52){logger['info'](util[_0x9dfe('0xa')](_0x9dfe('0x19'),_0x825165['id']));if(_0x54ee52&&_0x54ee52[_0x9dfe('0x1a')]&&_0x54ee52[_0x9dfe('0x1a')][_0x9dfe('0x1b')]&&_0x54ee52[_0x9dfe('0x1a')][_0x9dfe('0x1b')][_0x9dfe('0x1c')]){_0x94082a[_0x9dfe('0x13')]='';for(var _0xf7fc28=0x0;_0xf7fc28<_0x54ee52[_0x9dfe('0x1a')]['transcripts']['length'];_0xf7fc28++){_0x94082a[_0x9dfe('0x13')]+=_0x54ee52[_0x9dfe('0x1a')]['transcripts'][_0xf7fc28][_0x9dfe('0x1d')]+'';}}return _0x825165[_0x9dfe('0x1e')](_0x94082a);})[_0x9dfe('0x18')](function(){logger['info'](util[_0x9dfe('0xa')](_0x9dfe('0x1f'),_0x825165['id']));if(!_0x825165[_0x9dfe('0x20')]){throw new db[(_0x9dfe('0x21'))][(_0x9dfe('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1f3678[_0x9dfe('0x23')]||!_0x1f3678['sentimentAccountId']||!_0x1f3678[_0x9dfe('0x24')]||!_0x1f3678[_0x9dfe('0x25')]||!_0x1f3678[_0x9dfe('0x26')]){throw new db[(_0x9dfe('0x21'))][(_0x9dfe('0x22'))](_0x9dfe('0x27'));}if(!_0x94082a[_0x9dfe('0x13')]){throw new Error(_0x9dfe('0x28'));}if(_0x1f3678['sentimentAccountId']===_0x4da42d['id']){return _0x4da42d;}else{return db['CloudProvider'][_0x9dfe('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x9dfe('0x18')](function(_0x22e72f){if(!_0x22e72f){throw new db[(_0x9dfe('0x21'))]['ValidationError'](_0x9dfe('0x2a'));}if(!_0x22e72f[_0x9dfe('0xd')]||!_0x22e72f['data2']){throw new db['Sequelize'][(_0x9dfe('0x22'))](_0x9dfe('0x2b'));}_0x547ae1=_0x22e72f;logger[_0x9dfe('0x9')](util[_0x9dfe('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x825165['id']));return sentiment(_0x547ae1[_0x9dfe('0xd')],_0x547ae1[_0x9dfe('0xe')],_0x1f3678[_0x9dfe('0x24')],_0x94082a[_0x9dfe('0x13')],_0x1f3678[_0x9dfe('0x25')]);})['then'](function(_0x2747fd){logger[_0x9dfe('0x9')](util[_0x9dfe('0xa')](_0x9dfe('0x2c'),_0x825165['id']));return _0x825165[_0x9dfe('0x1e')]({'sentiment':_0x2747fd[_0x9dfe('0x2d')],'sPositive':_0x2747fd[_0x9dfe('0x2e')]['Positive'],'sNegative':_0x2747fd[_0x9dfe('0x2e')][_0x9dfe('0x2f')],'sMixed':_0x2747fd[_0x9dfe('0x2e')][_0x9dfe('0x30')],'sNeutral':_0x2747fd[_0x9dfe('0x2e')]['Neutral']});})[_0x9dfe('0x18')](function(){logger[_0x9dfe('0x9')](util['format'](_0x9dfe('0x1f'),_0x825165['id']));_0x5d9256();});case'FAILED':return _0x825165[_0x9dfe('0x1e')]({'transcribeStatus':_0x9dfe('0x31'),'failureReason':_0x538be3[_0x9dfe('0x11')][_0x9dfe('0x32')]})[_0x9dfe('0x18')](function(){logger['info'](util['format'](_0x9dfe('0x1f'),_0x825165['id']));_0x5d9256();});default:logger[_0x9dfe('0x9')](util['format'](_0x9dfe('0x33'),_0x825165['id']));break;}}else{return BPromise['resolve']()[_0x9dfe('0x18')](function(){if(!_0x825165['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0x9dfe('0x34'));}if(!_0x1f3678['sentiment']||!_0x1f3678['sentimentAccountId']||!_0x1f3678[_0x9dfe('0x24')]||!_0x1f3678['language']||!_0x1f3678[_0x9dfe('0x26')]){throw new db[(_0x9dfe('0x21'))][(_0x9dfe('0x22'))](_0x9dfe('0x27'));}if(!_0x825165[_0x9dfe('0x13')]){throw new Error(_0x9dfe('0x28'));}if(_0x1f3678[_0x9dfe('0x35')]===_0x4da42d['id']){return _0x4da42d;}else{return db[_0x9dfe('0x36')][_0x9dfe('0x29')]({'where':{'id':_settings[_0x9dfe('0x35')]}});}})[_0x9dfe('0x18')](function(_0x10a870){if(!_0x10a870){throw new db[(_0x9dfe('0x21'))][(_0x9dfe('0x22'))](_0x9dfe('0x2a'));}if(!_0x10a870[_0x9dfe('0xd')]||!_0x10a870[_0x9dfe('0xe')]){throw new db[(_0x9dfe('0x21'))][(_0x9dfe('0x22'))](_0x9dfe('0x2b'));}_0x547ae1=_0x10a870;logger['info'](util['format'](_0x9dfe('0x37'),_0x825165['id']));return sentiment(_0x547ae1['data1'],_0x547ae1['data2'],_0x1f3678[_0x9dfe('0x24')],_0x825165[_0x9dfe('0x13')],_0x1f3678[_0x9dfe('0x25')]);})[_0x9dfe('0x18')](function(_0xd8b65f){logger[_0x9dfe('0x9')](util[_0x9dfe('0xa')](_0x9dfe('0x2c'),_0x825165['id']));return _0x825165[_0x9dfe('0x1e')]({'sentiment':_0xd8b65f[_0x9dfe('0x2d')],'sPositive':_0xd8b65f['SentimentScore'][_0x9dfe('0x38')],'sNegative':_0xd8b65f[_0x9dfe('0x2e')][_0x9dfe('0x2f')],'sMixed':_0xd8b65f[_0x9dfe('0x2e')][_0x9dfe('0x30')],'sNeutral':_0xd8b65f[_0x9dfe('0x2e')]['Neutral'],'transcribeStatus':_0x9dfe('0x14')});})[_0x9dfe('0x18')](function(){logger[_0x9dfe('0x9')](util[_0x9dfe('0xa')](_0x9dfe('0x1f'),_0x825165['id']));_0x5d9256();});}})[_0x9dfe('0x39')](function(_0x57ab88){if(_0x57ab88){if(!_0x57ab88[_0x9dfe('0x3a')]||_0x57ab88[_0x9dfe('0x3a')]!==_0x9dfe('0x3b')){logger[_0x9dfe('0x3c')](util[_0x9dfe('0xa')](_0x9dfe('0x3d'),_0x825165['id']),util[_0x9dfe('0x3e')](_0x57ab88,{'showHidden':![],'depth':null}));}}_0x5d9256();});});}function checkTranscribe(){var _0x188490;var _0x174188;var _0x36a433;return db[_0x9dfe('0x3f')][_0x9dfe('0x40')]({'where':{'transcribeStatus':_0x9dfe('0x41')}})[_0x9dfe('0x18')](function(_0x964e87){if(!_0x964e87||!_0x964e87['length']){throw new db[(_0x9dfe('0x21'))][(_0x9dfe('0x22'))]('No\x20transcribe\x20job\x20to\x20check');}_0x188490=_0x964e87;return db['Setting'][_0x9dfe('0x29')]({'where':{'id':0x1}});})[_0x9dfe('0x18')](function(_0x556309){if(!_0x556309){throw new db['Sequelize']['ValidationError'](_0x9dfe('0x42'));}_0x174188=_0x556309;if(!_0x174188[_0x9dfe('0x4')]||!_0x174188[_0x9dfe('0x43')]||!_0x174188[_0x9dfe('0xf')]||!_0x174188['language']||!_0x174188[_0x9dfe('0x26')]){throw new db[(_0x9dfe('0x21'))][(_0x9dfe('0x22'))](_0x9dfe('0x44'));}return db[_0x9dfe('0x36')]['findOne']({'where':{'id':_0x174188[_0x9dfe('0x43')]}});})[_0x9dfe('0x18')](function(_0x5a1f13){if(!_0x5a1f13){throw new db[(_0x9dfe('0x21'))][(_0x9dfe('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5a1f13[_0x9dfe('0xd')]||!_0x5a1f13[_0x9dfe('0xe')]){throw new db[(_0x9dfe('0x21'))]['ValidationError'](_0x9dfe('0x2b'));}_0x36a433=_0x5a1f13;var _0x32cb6e=[];_0x188490['forEach'](function(_0x5e81e1){_0x32cb6e[_0x9dfe('0x45')](checkTranscribeJob(_0x5e81e1,_0x174188,_0x36a433));});return BPromise['all'](_0x32cb6e);})['catch'](function(_0xa70ba3){if(_0xa70ba3){if(!_0xa70ba3[_0x9dfe('0x3a')]||_0xa70ba3[_0x9dfe('0x3a')]!=='SequelizeValidationError'){logger['error'](util[_0x9dfe('0x3e')](_0xa70ba3,{'showHidden':![],'depth':null}));}}});}exports[_0x9dfe('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0a6b=['forEach','all','catch','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','Sequelize','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','resolve','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Mixed','name','SequelizeValidationError','error','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','bucket','Transcribe\x20not\x20configured'];(function(_0x58f991,_0x46b264){var _0x3345db=function(_0x440f46){while(--_0x440f46){_0x58f991['push'](_0x58f991['shift']());}};_0x3345db(++_0x46b264);}(_0x0a6b,0x120));var _0xb0a6=function(_0x12ff13,_0x18398b){_0x12ff13=_0x12ff13-0x0;var _0xc74ebd=_0x0a6b[_0x12ff13];return _0xc74ebd;};var _=require(_0xb0a6('0x0'));var AWS=require('aws-sdk');var rp=require(_0xb0a6('0x1'));var util=require(_0xb0a6('0x2'));var BPromise=require(_0xb0a6('0x3'));var db=require(_0xb0a6('0x4'))['db'];var logger=require(_0xb0a6('0x5'))(_0xb0a6('0x6'));function getTranscriptionJob(_0x39d403,_0xa2c294,_0xbb5821,_0x38079a){return new Promise(function(_0x4b47bc,_0x30b3b7){var _0x504a45=new AWS[(_0xb0a6('0x7'))]({'accessKeyId':_0xa2c294,'secretAccessKey':_0x39d403,'region':_0xbb5821});_0x504a45['getTranscriptionJob']({'TranscriptionJobName':_0x38079a},function(_0x597b68,_0xdaa894){if(_0x597b68){return _0x30b3b7(_0x597b68);}else{return _0x4b47bc(_0xdaa894);}});});}function sentiment(_0x527f2a,_0x26fb4c,_0x423683,_0x549cc4,_0x41e68d){return new Promise(function(_0x30150c,_0x5cd9b3){var _0x1245ab=new AWS[(_0xb0a6('0x8'))]({'accessKeyId':_0x26fb4c,'secretAccessKey':_0x527f2a,'region':_0x423683});_0x1245ab[_0xb0a6('0x9')]({'Text':_0x549cc4,'LanguageCode':_0x41e68d[_0xb0a6('0xa')](0x0,0x2)},function(_0x275fc2,_0x37fdf8){if(_0x275fc2){return _0x5cd9b3(_0x275fc2);}else{return _0x30150c(_0x37fdf8);}});});}function checkTranscribeJob(_0x45e4b4,_0xda8c5f,_0x4b3a7e){var _0x2184f4;return new BPromise(function(_0x4495d6,_0x3db39b){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x45e4b4['id'],_0x45e4b4[_0xb0a6('0xd')]));return getTranscriptionJob(_0x4b3a7e[_0xb0a6('0xe')],_0x4b3a7e['data2'],_0xda8c5f[_0xb0a6('0xf')],_0x45e4b4['transcribeName'])['then'](function(_0x214699){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x10'),_0x45e4b4['id'],_0x45e4b4[_0xb0a6('0xd')],_0x214699[_0xb0a6('0x11')][_0xb0a6('0x12')]));if(!_0x45e4b4[_0xb0a6('0x13')]){switch(_0x214699[_0xb0a6('0x11')][_0xb0a6('0x12')]){case _0xb0a6('0x14'):var _0x57bf27={'transcribeStatus':_0x214699['TranscriptionJob'][_0xb0a6('0x12')],'fileUri':_0x214699[_0xb0a6('0x11')]['Transcript'][_0xb0a6('0x15')]};logger['info'](util[_0xb0a6('0xc')](_0xb0a6('0x16'),_0x45e4b4['id']));return rp({'uri':_0x214699[_0xb0a6('0x11')][_0xb0a6('0x17')]['TranscriptFileUri'],'json':!![]})[_0xb0a6('0x18')](function(_0x5e9765){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x19'),_0x45e4b4['id']));if(_0x5e9765&&_0x5e9765[_0xb0a6('0x1a')]&&_0x5e9765[_0xb0a6('0x1a')][_0xb0a6('0x1b')]&&_0x5e9765['results'][_0xb0a6('0x1b')][_0xb0a6('0x1c')]){_0x57bf27[_0xb0a6('0x13')]='';for(var _0x2e5101=0x0;_0x2e5101<_0x5e9765[_0xb0a6('0x1a')]['transcripts'][_0xb0a6('0x1c')];_0x2e5101++){_0x57bf27[_0xb0a6('0x13')]+=_0x5e9765[_0xb0a6('0x1a')]['transcripts'][_0x2e5101][_0xb0a6('0x1d')]+'';}}return _0x45e4b4[_0xb0a6('0x1e')](_0x57bf27);})['then'](function(){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x45e4b4['id']));if(!_0x45e4b4['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0xb0a6('0x1f'));}if(!_0xda8c5f[_0xb0a6('0x20')]||!_0xda8c5f[_0xb0a6('0x21')]||!_0xda8c5f[_0xb0a6('0x22')]||!_0xda8c5f['language']||!_0xda8c5f['bucket']){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x57bf27[_0xb0a6('0x13')]){throw new Error(_0xb0a6('0x25'));}if(_0xda8c5f['sentimentAccountId']===_0x4b3a7e['id']){return _0x4b3a7e;}else{return db[_0xb0a6('0x26')][_0xb0a6('0x27')]({'where':{'id':_settings[_0xb0a6('0x21')]}});}})[_0xb0a6('0x18')](function(_0x5a1427){if(!_0x5a1427){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5a1427['data1']||!_0x5a1427[_0xb0a6('0x28')]){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x2184f4=_0x5a1427;logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x29'),_0x45e4b4['id']));return sentiment(_0x2184f4[_0xb0a6('0xe')],_0x2184f4[_0xb0a6('0x28')],_0xda8c5f['sentimentRegion'],_0x57bf27[_0xb0a6('0x13')],_0xda8c5f['language']);})[_0xb0a6('0x18')](function(_0x5331d4){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x2a'),_0x45e4b4['id']));return _0x45e4b4[_0xb0a6('0x1e')]({'sentiment':_0x5331d4[_0xb0a6('0x2b')],'sPositive':_0x5331d4[_0xb0a6('0x2c')][_0xb0a6('0x2d')],'sNegative':_0x5331d4[_0xb0a6('0x2c')][_0xb0a6('0x2e')],'sMixed':_0x5331d4[_0xb0a6('0x2c')]['Mixed'],'sNeutral':_0x5331d4['SentimentScore'][_0xb0a6('0x2f')]});})['then'](function(){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x30'),_0x45e4b4['id']));_0x4495d6();});case _0xb0a6('0x31'):return _0x45e4b4['update']({'transcribeStatus':_0xb0a6('0x31'),'failureReason':_0x214699[_0xb0a6('0x11')]['FailureReason']})[_0xb0a6('0x18')](function(){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x30'),_0x45e4b4['id']));_0x4495d6();});default:logger['info'](util[_0xb0a6('0xc')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x45e4b4['id']));break;}}else{return BPromise[_0xb0a6('0x32')]()[_0xb0a6('0x18')](function(){if(!_0x45e4b4['tempSentiment']){throw new db[(_0xb0a6('0x23'))]['ValidationError'](_0xb0a6('0x1f'));}if(!_0xda8c5f['sentiment']||!_0xda8c5f[_0xb0a6('0x21')]||!_0xda8c5f[_0xb0a6('0x22')]||!_0xda8c5f[_0xb0a6('0x33')]||!_0xda8c5f['bucket']){throw new db[(_0xb0a6('0x23'))]['ValidationError'](_0xb0a6('0x34'));}if(!_0x45e4b4[_0xb0a6('0x13')]){throw new Error(_0xb0a6('0x25'));}if(_0xda8c5f[_0xb0a6('0x21')]===_0x4b3a7e['id']){return _0x4b3a7e;}else{return db[_0xb0a6('0x26')][_0xb0a6('0x27')]({'where':{'id':_settings[_0xb0a6('0x21')]}});}})['then'](function(_0x167112){if(!_0x167112){throw new db['Sequelize'][(_0xb0a6('0x24'))](_0xb0a6('0x35'));}if(!_0x167112[_0xb0a6('0xe')]||!_0x167112[_0xb0a6('0x28')]){throw new db['Sequelize']['ValidationError'](_0xb0a6('0x36'));}_0x2184f4=_0x167112;logger[_0xb0a6('0xb')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x45e4b4['id']));return sentiment(_0x2184f4[_0xb0a6('0xe')],_0x2184f4[_0xb0a6('0x28')],_0xda8c5f['sentimentRegion'],_0x45e4b4['fileText'],_0xda8c5f[_0xb0a6('0x33')]);})[_0xb0a6('0x18')](function(_0x887e16){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x2a'),_0x45e4b4['id']));return _0x45e4b4[_0xb0a6('0x1e')]({'sentiment':_0x887e16['Sentiment'],'sPositive':_0x887e16[_0xb0a6('0x2c')][_0xb0a6('0x2d')],'sNegative':_0x887e16['SentimentScore'][_0xb0a6('0x2e')],'sMixed':_0x887e16['SentimentScore'][_0xb0a6('0x37')],'sNeutral':_0x887e16[_0xb0a6('0x2c')][_0xb0a6('0x2f')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0xb0a6('0xb')](util[_0xb0a6('0xc')](_0xb0a6('0x30'),_0x45e4b4['id']));_0x4495d6();});}})['catch'](function(_0x408593){if(_0x408593){if(!_0x408593[_0xb0a6('0x38')]||_0x408593['name']!==_0xb0a6('0x39')){logger[_0xb0a6('0x3a')](util[_0xb0a6('0xc')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x45e4b4['id']),util[_0xb0a6('0x3b')](_0x408593,{'showHidden':![],'depth':null}));}}_0x4495d6();});});}function checkTranscribe(){var _0x46c87b;var _0x4b6fc3;var _0x58d1f3;return db[_0xb0a6('0x3c')]['findAll']({'where':{'transcribeStatus':_0xb0a6('0x3d')}})['then'](function(_0x5d902d){if(!_0x5d902d||!_0x5d902d[_0xb0a6('0x1c')]){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))](_0xb0a6('0x3e'));}_0x46c87b=_0x5d902d;return db[_0xb0a6('0x3f')][_0xb0a6('0x27')]({'where':{'id':0x1}});})[_0xb0a6('0x18')](function(_0x1f3410){if(!_0x1f3410){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))](_0xb0a6('0x40'));}_0x4b6fc3=_0x1f3410;if(!_0x4b6fc3[_0xb0a6('0x6')]||!_0x4b6fc3['transcribeAccountId']||!_0x4b6fc3[_0xb0a6('0xf')]||!_0x4b6fc3[_0xb0a6('0x33')]||!_0x4b6fc3[_0xb0a6('0x41')]){throw new db['Sequelize'][(_0xb0a6('0x24'))](_0xb0a6('0x42'));}return db[_0xb0a6('0x26')][_0xb0a6('0x27')]({'where':{'id':_0x4b6fc3['transcribeAccountId']}});})[_0xb0a6('0x18')](function(_0x537735){if(!_0x537735){throw new db[(_0xb0a6('0x23'))]['ValidationError'](_0xb0a6('0x35'));}if(!_0x537735[_0xb0a6('0xe')]||!_0x537735[_0xb0a6('0x28')]){throw new db[(_0xb0a6('0x23'))][(_0xb0a6('0x24'))](_0xb0a6('0x36'));}_0x58d1f3=_0x537735;var _0x49793c=[];_0x46c87b[_0xb0a6('0x43')](function(_0x53aa22){_0x49793c['push'](checkTranscribeJob(_0x53aa22,_0x4b6fc3,_0x58d1f3));});return BPromise[_0xb0a6('0x44')](_0x49793c);})[_0xb0a6('0x45')](function(_0x2674c6){if(_0x2674c6){if(!_0x2674c6['name']||_0x2674c6[_0xb0a6('0x38')]!=='SequelizeValidationError'){logger[_0xb0a6('0x3a')](util[_0xb0a6('0x3b')](_0x2674c6,{'showHidden':![],'depth':null}));}}});}exports[_0xb0a6('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index ccf43c1..6a5688c 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 _0x300d=['format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join'];(function(_0x17c197,_0x309146){var _0x47cb45=function(_0x4d7b09){while(--_0x4d7b09){_0x17c197['push'](_0x17c197['shift']());}};_0x47cb45(++_0x309146);}(_0x300d,0x173));var _0xd300=function(_0x3acab5,_0x59a05e){_0x3acab5=_0x3acab5-0x0;var _0x2e75c0=_0x300d[_0x3acab5];return _0x2e75c0;};'use strict';var _=require(_0xd300('0x0'));var moment=require(_0xd300('0x1'));var Redis=require(_0xd300('0x2'));var util=require('util');var config=require(_0xd300('0x3'));var db=require(_0xd300('0x4'))['db'];var logger=require(_0xd300('0x5'))(_0xd300('0x6'));config[_0xd300('0x7')]=_[_0xd300('0x8')](config['redis'],{'host':_0xd300('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd300('0x7')]));function closeInteractions(){var _0x153b0d=[];return db[_0xd300('0xa')][_0xd300('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xd300('0xc'))}}})[_0xd300('0xd')](function(_0x53ad41){if(_0x53ad41&&_0x53ad41[_0xd300('0xe')]){_0x153b0d=_[_0xd300('0xf')](_0x53ad41||[],'id');logger[_0xd300('0x10')](_0xd300('0x11'),_0x153b0d[_0xd300('0x12')]());return db[_0xd300('0xa')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xd300('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x153b0d}});}})[_0xd300('0xd')](function(){if(_0x153b0d&&_0x153b0d[_0xd300('0xe')]){logger[_0xd300('0x10')](_0xd300('0x14'),_0x153b0d[_0xd300('0x12')]());for(var _0x2c4a93=0x0;_0x2c4a93<_0x153b0d[_0xd300('0xe')];_0x2c4a93++){io[_0xd300('0x15')](_0xd300('0x16'),{'id':_0x153b0d[_0x2c4a93],'closed':!![]});}}})['catch'](function(_0x375f49){logger[_0xd300('0x17')](_0xd300('0x18'),_0x375f49?util[_0xd300('0x19')](_0x375f49,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9d1a=['then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','lastMsgAt','subtract'];(function(_0x20dd9b,_0x3c0fb8){var _0x2de3b0=function(_0x5673d2){while(--_0x5673d2){_0x20dd9b['push'](_0x20dd9b['shift']());}};_0x2de3b0(++_0x3c0fb8);}(_0x9d1a,0xa7));var _0xa9d1=function(_0x4731b0,_0x384141){_0x4731b0=_0x4731b0-0x0;var _0x4a5525=_0x9d1a[_0x4731b0];return _0x4a5525;};'use strict';var _=require(_0xa9d1('0x0'));var moment=require('moment');var Redis=require(_0xa9d1('0x1'));var util=require(_0xa9d1('0x2'));var config=require(_0xa9d1('0x3'));var db=require(_0xa9d1('0x4'))['db'];var logger=require(_0xa9d1('0x5'))(_0xa9d1('0x6'));config[_0xa9d1('0x7')]=_[_0xa9d1('0x8')](config[_0xa9d1('0x7')],{'host':_0xa9d1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa9d1('0x7')]));function closeInteractions(){var _0x54f8a2=[];return db[_0xa9d1('0xa')]['findAll']({'raw':!![],'attributes':['id',_0xa9d1('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa9d1('0xc')](0x18,'hours')}}})[_0xa9d1('0xd')](function(_0x493cfe){if(_0x493cfe&&_0x493cfe[_0xa9d1('0xe')]){_0x54f8a2=_['map'](_0x493cfe||[],'id');logger[_0xa9d1('0xf')](_0xa9d1('0x10'),_0x54f8a2[_0xa9d1('0x11')]());return db[_0xa9d1('0xa')][_0xa9d1('0x12')]({'closeReason':_0xa9d1('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xa9d1('0x14')](_0xa9d1('0x15'))},{'where':{'id':_0x54f8a2}});}})[_0xa9d1('0xd')](function(){if(_0x54f8a2&&_0x54f8a2[_0xa9d1('0xe')]){logger[_0xa9d1('0xf')](_0xa9d1('0x16'),_0x54f8a2[_0xa9d1('0x11')]());for(var _0x559ac3=0x0;_0x559ac3<_0x54f8a2[_0xa9d1('0xe')];_0x559ac3++){io[_0xa9d1('0x17')](_0xa9d1('0x18'),{'id':_0x54f8a2[_0x559ac3],'closed':!![]});}}})[_0xa9d1('0x19')](function(_0x272cbd){logger[_0xa9d1('0x1a')](_0xa9d1('0x1b'),_0x272cbd?util[_0xa9d1('0x1c')](_0x272cbd,{'showHidden':![],'depth':null}):'');});}exports[_0xa9d1('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 4e73619..c9ac209 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7524=['contacts1','CmHopper','destroy','then','hopper1','contacts2','hopper2','util','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','bulkCreate','log','finished\x20populating'];(function(_0x41e2eb,_0x3fc761){var _0x565b6e=function(_0x5a99c4){while(--_0x5a99c4){_0x41e2eb['push'](_0x41e2eb['shift']());}};_0x565b6e(++_0x3fc761);}(_0x7524,0x85));var _0x4752=function(_0x44b8fb,_0x262b7d){_0x44b8fb=_0x44b8fb-0x0;var _0x1bee24=_0x7524[_0x44b8fb];return _0x1bee24;};'use strict';var util=require(_0x4752('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4752('0x1')]({'id':i,'firstName':_0x4752('0x2')+i,'lastName':_0x4752('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4752('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4752('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x4752('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4752('0x5')](),'updatedAt':Date[_0x4752('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4752('0x1')]({'id':i,'firstName':_0x4752('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x4752('0x6')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x4752('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4752('0x5')]()});}db[_0x4752('0x7')]['destroy']({'where':{}})['then'](function(){return db[_0x4752('0x7')][_0x4752('0x8')](contacts);})['then'](function(){console[_0x4752('0x9')](_0x4752('0xa'),_0x4752('0xb'));return db[_0x4752('0xc')][_0x4752('0xd')]({'where':{}});})[_0x4752('0xe')](function(){return db[_0x4752('0xc')][_0x4752('0x8')](hopper);})[_0x4752('0xe')](function(){console[_0x4752('0x9')](_0x4752('0xa'),_0x4752('0xf'));return db[_0x4752('0x7')][_0x4752('0x8')](contacts2);})['then'](function(){console[_0x4752('0x9')]('finished\x20populating',_0x4752('0x10'));return db['CmHopper'][_0x4752('0x8')](hopper2);})[_0x4752('0xe')](function(){console[_0x4752('0x9')](_0x4752('0xa'),_0x4752('0x11'));})['catch'](function(_0x5a76be){console['log'](_0x5a76be);}); \ No newline at end of file +var _0xfebb=['bulkCreate','finished\x20populating','CmHopper','then','log','hopper1','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xfebb,0xbc));var _0xbfeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebb[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xbfeb('0x0'));var db=require(_0xbfeb('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbfeb('0x2')]({'id':i,'firstName':_0xbfeb('0x3')+i,'lastName':_0xbfeb('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xbfeb('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbfeb('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xbfeb('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbfeb('0x6')](),'updatedAt':Date[_0xbfeb('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbfeb('0x2')]({'id':i,'firstName':_0xbfeb('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbfeb('0x7')+i+_0xbfeb('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbfeb('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbfeb('0x6')](),'updatedAt':Date['now']()});}db[_0xbfeb('0x8')][_0xbfeb('0x9')]({'where':{}})['then'](function(){return db[_0xbfeb('0x8')][_0xbfeb('0xa')](contacts);})['then'](function(){console['log'](_0xbfeb('0xb'),'contacts1');return db[_0xbfeb('0xc')][_0xbfeb('0x9')]({'where':{}});})[_0xbfeb('0xd')](function(){return db['CmHopper'][_0xbfeb('0xa')](hopper);})[_0xbfeb('0xd')](function(){console[_0xbfeb('0xe')]('finished\x20populating',_0xbfeb('0xf'));return db[_0xbfeb('0x8')]['bulkCreate'](contacts2);})['then'](function(){console['log'](_0xbfeb('0xb'),_0xbfeb('0x10'));return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0xbfeb('0xe')](_0xbfeb('0xb'),_0xbfeb('0x11'));})['catch'](function(_0x2594ee){console[_0xbfeb('0xe')](_0x2594ee);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index eddd397..03673cc 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72d3=['friend','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password'];(function(_0x3fd8a0,_0x348b45){var _0x5304d4=function(_0x1d8e90){while(--_0x1d8e90){_0x3fd8a0['push'](_0x3fd8a0['shift']());}};_0x5304d4(++_0x348b45);}(_0x72d3,0x6a));var _0x372d=function(_0x4e1205,_0xb52446){_0x4e1205=_0x4e1205-0x0;var _0x180e0b=_0x72d3[_0x4e1205];return _0x180e0b;};'use strict';var util=require(_0x372d('0x0'));var db=require(_0x372d('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x372d('0x2')]({'name':util[_0x372d('0x3')](_0x372d('0x4'),_0x372d('0x5'),i),'fullname':util['format'](_0x372d('0x4'),'agent',i),'email':util[_0x372d('0x3')](_0x372d('0x6'),_0x372d('0x5'),i),'role':_0x372d('0x5'),'password':_0x372d('0x7'),'internal':0xfa0+i,'type':_0x372d('0x8'),'transport':['udp','ws','wss'],'disallow':[_0x372d('0x9')],'allow':[_0x372d('0xa')],'defaultuser':util[_0x372d('0x3')](_0x372d('0x4'),_0x372d('0x5'),i),'encryption':_0x372d('0xb'),'avpf':'yes','force_avp':_0x372d('0xb'),'icesupport':'yes','dtlsenable':_0x372d('0xb'),'dtlsverify':'no','dtlscertfile':_0x372d('0xc'),'dtlsprivatekey':_0x372d('0xd'),'dtlssetup':_0x372d('0xe'),'callerid':util[_0x372d('0x3')]('\x22%s\x22\x20<%s>',util[_0x372d('0x3')](_0x372d('0x4'),_0x372d('0x5'),i),0xfa0+i)});}db[_0x372d('0xf')][_0x372d('0x10')](users)['then'](function(){console['log'](_0x372d('0x11'));})[_0x372d('0x12')](function(_0x2ddd4d){console['log'](_0x2ddd4d);}); \ No newline at end of file +var _0x47fc=['agent','format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','%s%s'];(function(_0x5ecdf4,_0x430c66){var _0x457191=function(_0x579ce0){while(--_0x579ce0){_0x5ecdf4['push'](_0x5ecdf4['shift']());}};_0x457191(++_0x430c66);}(_0x47fc,0x15d));var _0xc47f=function(_0x284145,_0x5a7ef0){_0x284145=_0x284145-0x0;var _0x24c78c=_0x47fc[_0x284145];return _0x24c78c;};'use strict';var util=require(_0xc47f('0x0'));var db=require(_0xc47f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xc47f('0x2'),'agent',i),'fullname':util['format'](_0xc47f('0x2'),_0xc47f('0x3'),i),'email':util[_0xc47f('0x4')](_0xc47f('0x5'),_0xc47f('0x3'),i),'role':_0xc47f('0x3'),'password':_0xc47f('0x6'),'internal':0xfa0+i,'type':_0xc47f('0x7'),'transport':[_0xc47f('0x8'),'ws',_0xc47f('0x9')],'disallow':[_0xc47f('0xa')],'allow':[_0xc47f('0xb')],'defaultuser':util[_0xc47f('0x4')](_0xc47f('0x2'),_0xc47f('0x3'),i),'encryption':_0xc47f('0xc'),'avpf':_0xc47f('0xc'),'force_avp':_0xc47f('0xc'),'icesupport':_0xc47f('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xc47f('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xc47f('0xe'),'callerid':util[_0xc47f('0x4')](_0xc47f('0xf'),util[_0xc47f('0x4')]('%s%s','agent',i),0xfa0+i)});}db[_0xc47f('0x10')][_0xc47f('0x11')](users)[_0xc47f('0x12')](function(){console[_0xc47f('0x13')](_0xc47f('0x14'));})[_0xc47f('0x15')](function(_0x43c3cd){console[_0xc47f('0x13')](_0x43c3cd);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 2ed018b..f77eb2d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea4e=['then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','Campaign','%s:queue:%s','length','format','user:%s','handshake','find','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:inbound','voice:outbound','userProfileId','MailQueues','getVoiceQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','voice','chat','fax','sms','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','remoteAddress','request','connection','connectedAt','disconnect','DISCONNECTED','lodash','./environment','Agents','User','role','agent','name','telephone','type','UserProfileSection','findOne'];(function(_0x268308,_0x504fab){var _0x343e4f=function(_0x7333d1){while(--_0x7333d1){_0x268308['push'](_0x268308['shift']());}};_0x343e4f(++_0x504fab);}(_0xea4e,0x10c));var _0xeea4=function(_0x5a6f32,_0x58b204){_0x5a6f32=_0x5a6f32-0x0;var _0x18c961=_0xea4e[_0x5a6f32];return _0x18c961;};'use strict';var _=require(_0xeea4('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0xeea4('0x1'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xeea4('0x2'),'model':db[_0xeea4('0x3')],'attributes':['id','name',_0xeea4('0x4')],'raw':!![],'where':{'role':_0xeea4('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xeea4('0x6')],'where':{'role':_0xeea4('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xeea4('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0xeea4('0x6')],'where':{'role':_0xeea4('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xeea4('0x6'),_0xeea4('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0xc649e,_0x5b95b9,_0x3a4953){return db[_0xeea4('0x9')][_0xeea4('0xa')]({'where':{'name':_0xc649e,'userProfileId':_0x5b95b9},'raw':!![]})[_0xeea4('0xb')](function(_0x16a077){if(_0x16a077){if(_0x16a077[_0xeea4('0xc')]){switch(_0xc649e){case _0xeea4('0xd'):case _0xeea4('0xe'):case'FaxQueues':case _0xeea4('0xf'):case'MailQueues':case _0xeea4('0x10'):case _0xeea4('0x11'):return db[_0x3a4953][_0xeea4('0x12')](queryQueues);case _0xeea4('0x13'):return db[_0x3a4953][_0xeea4('0x12')](queryTelephones);case _0xeea4('0x14'):return db[_0x3a4953][_0xeea4('0x12')](queryTrunks);case _0xeea4('0x15'):return db[_0x3a4953]['findAll'](queryCampaigns);}}else{return db[_0xeea4('0x16')][_0xeea4('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x16a077['id']},'raw':!![]})[_0xeea4('0xb')](function(_0x4d47b0){if(_0x4d47b0){var _0x2d5a6c={'where':{'id':_[_0xeea4('0x17')](_0x4d47b0,_0xeea4('0x18'))},'raw':!![]};switch(_0x3a4953){case _0xeea4('0x3'):_0x2d5a6c[_0xeea4('0x19')][_0xeea4('0x4')]=_0xeea4('0x7');break;case _0xeea4('0x1a'):_0x2d5a6c[_0xeea4('0x19')][_0xeea4('0x8')]='ivr';break;}return db[_0x3a4953][_0xeea4('0x12')](_0x2d5a6c);}else{return[];}});}}else{return[];}})[_0xeea4('0xb')](function(_0x5c4e7b){return _0x5c4e7b;});}function joinOrLeaveQueues(_0x36a9b3,_0x472803,_0x4c039c,_0x23ef6a){_0x36a9b3[_0x472803](util['format'](_0xeea4('0x1b'),_0x4c039c,_0x23ef6a['name']));if(_0x23ef6a['Agents']){for(var _0x3756ad=0x0;_0x3756ad<_0x23ef6a['Agents'][_0xeea4('0x1c')];_0x3756ad+=0x1){_0x36a9b3[_0x472803](util[_0xeea4('0x1d')](_0xeea4('0x1e'),_0x23ef6a[_0xeea4('0x2')][_0x3756ad][_0xeea4('0x6')]));}}}function joinOrLeave(_0x50d509,_0x3f2cd2,_0x88ab4f){var _0x290983;if(_0x50d509[_0xeea4('0x1f')]['query']['id']){db[_0xeea4('0x3')][_0xeea4('0x20')]({'attributes':['id',_0xeea4('0x6'),_0xeea4('0x4'),'userProfileId'],'where':{'id':_0x50d509['handshake'][_0xeea4('0x21')]['id']},'include':[{'model':db[_0xeea4('0x22')],'as':_0xeea4('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xeea4('0x24')],'as':_0xeea4('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xeea4('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xeea4('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xeea4('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xeea4('0x29')],'as':_0xeea4('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xeea4('0xb')](function(_0x134f24){if(_0x134f24){_0x290983=_0x134f24;_0x50d509[_0x3f2cd2](util[_0xeea4('0x1d')](_0xeea4('0x1e'),_0x134f24[_0xeea4('0x6')]));var _0x4e68c4=[];switch(_0x134f24[_0xeea4('0x4')]){case _0xeea4('0x2b'):_0x50d509[_0x3f2cd2]('voice:inbound');_0x50d509[_0x3f2cd2]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xeea4('0x2c'))){delete queryQueues['include'];}_0x4e68c4[_0xeea4('0x2d')](db[_0xeea4('0x2e')][_0xeea4('0x12')](queryQueues));_0x4e68c4[_0xeea4('0x2d')](db[_0xeea4('0x2f')]['findAll'](queryQueues));_0x4e68c4[_0xeea4('0x2d')](db[_0xeea4('0x30')][_0xeea4('0x12')](queryQueues));_0x4e68c4['push'](db[_0xeea4('0x31')][_0xeea4('0x12')](queryQueues));_0x4e68c4[_0xeea4('0x2d')](db[_0xeea4('0x32')][_0xeea4('0x12')](queryQueues));_0x4e68c4[_0xeea4('0x2d')](db[_0xeea4('0x33')][_0xeea4('0x12')](queryQueues));_0x4e68c4[_0xeea4('0x2d')](db[_0xeea4('0x34')]['findAll'](queryQueues));_0x4e68c4['push'](db[_0xeea4('0x3')][_0xeea4('0x12')](queryTelephones));_0x4e68c4[_0xeea4('0x2d')](db[_0xeea4('0x35')][_0xeea4('0x12')](queryTrunks));_0x4e68c4[_0xeea4('0x2d')](db[_0xeea4('0x1a')]['findAll'](queryCampaigns));_0x4e68c4[_0xeea4('0x2d')](db[_0xeea4('0x3')][_0xeea4('0x12')](queryAgents));break;case'user':_0x50d509[_0x3f2cd2](_0xeea4('0x36'));_0x50d509[_0x3f2cd2](_0xeea4('0x37'));_0x4e68c4['push'](getAssociatedResources(_0xeea4('0xd'),_0x134f24[_0xeea4('0x38')],_0xeea4('0x2e')));_0x4e68c4[_0xeea4('0x2d')](getAssociatedResources(_0xeea4('0xe'),_0x134f24[_0xeea4('0x38')],_0xeea4('0x2f')));_0x4e68c4[_0xeea4('0x2d')](getAssociatedResources('FaxQueues',_0x134f24[_0xeea4('0x38')],_0xeea4('0x30')));_0x4e68c4['push'](getAssociatedResources(_0xeea4('0xf'),_0x134f24[_0xeea4('0x38')],_0xeea4('0x31')));_0x4e68c4[_0xeea4('0x2d')](getAssociatedResources(_0xeea4('0x39'),_0x134f24[_0xeea4('0x38')],_0xeea4('0x32')));_0x4e68c4['push'](getAssociatedResources(_0xeea4('0x10'),_0x134f24[_0xeea4('0x38')],'OpenchannelQueue'));_0x4e68c4[_0xeea4('0x2d')](getAssociatedResources('WhatsappQueues',_0x134f24[_0xeea4('0x38')],_0xeea4('0x34')));_0x4e68c4['push'](getAssociatedResources('Telephones',_0x134f24[_0xeea4('0x38')],'User'));_0x4e68c4[_0xeea4('0x2d')](getAssociatedResources(_0xeea4('0x14'),_0x134f24['userProfileId'],_0xeea4('0x35')));_0x4e68c4[_0xeea4('0x2d')](getAssociatedResources('IvrCampaigns',_0x134f24[_0xeea4('0x38')],_0xeea4('0x1a')));_0x4e68c4[_0xeea4('0x2d')](db[_0xeea4('0x3')][_0xeea4('0x12')](queryAgents));break;case _0xeea4('0x5'):_0x50d509[_0x3f2cd2](_0xeea4('0x36'));_0x50d509[_0x3f2cd2]('voice:outbound');_0x4e68c4[_0xeea4('0x2d')](_0x134f24[_0xeea4('0x3a')]({'attributes':['id',_0xeea4('0x6')]}));_0x4e68c4[_0xeea4('0x2d')](_0x134f24['getChatQueues']({'attributes':['id',_0xeea4('0x6')]}));_0x4e68c4[_0xeea4('0x2d')](_0x134f24[_0xeea4('0x3b')]({'attributes':['id','name']}));_0x4e68c4['push'](_0x134f24[_0xeea4('0x3c')]({'attributes':['id',_0xeea4('0x6')]}));_0x4e68c4['push'](_0x134f24['getMailQueues']({'attributes':['id',_0xeea4('0x6')]}));_0x4e68c4[_0xeea4('0x2d')](_0x134f24[_0xeea4('0x3d')]({'attributes':['id',_0xeea4('0x6')]}));_0x4e68c4[_0xeea4('0x2d')](_0x134f24['getWhatsappQueues']({'attributes':['id',_0xeea4('0x6')]}));break;}return BPromise['all'](_0x4e68c4);}})[_0xeea4('0xb')](function(_0x44e880){if(_0x44e880&&_0x44e880[_0xeea4('0x1c')]){for(var _0x546824=0x0;_0x546824<_0x44e880[_0xeea4('0x1c')];_0x546824+=0x1){for(var _0x504b3f=0x0;_0x504b3f<_0x44e880[_0x546824]['length'];_0x504b3f+=0x1){switch(_0x546824){case 0x0:joinOrLeaveQueues(_0x50d509,_0x3f2cd2,_0xeea4('0x3e'),_0x44e880[_0x546824][_0x504b3f]);break;case 0x1:joinOrLeaveQueues(_0x50d509,_0x3f2cd2,_0xeea4('0x3f'),_0x44e880[_0x546824][_0x504b3f]);break;case 0x2:joinOrLeaveQueues(_0x50d509,_0x3f2cd2,_0xeea4('0x40'),_0x44e880[_0x546824][_0x504b3f]);break;case 0x3:joinOrLeaveQueues(_0x50d509,_0x3f2cd2,_0xeea4('0x41'),_0x44e880[_0x546824][_0x504b3f]);break;case 0x4:joinOrLeaveQueues(_0x50d509,_0x3f2cd2,'mail',_0x44e880[_0x546824][_0x504b3f]);break;case 0x5:joinOrLeaveQueues(_0x50d509,_0x3f2cd2,'openchannel',_0x44e880[_0x546824][_0x504b3f]);break;case 0x6:joinOrLeaveQueues(_0x50d509,_0x3f2cd2,_0xeea4('0x42'),_0x44e880[_0x546824][_0x504b3f]);break;case 0x7:if(_0x290983[_0xeea4('0x4')]!==_0xeea4('0x5'))_0x50d509[_0x3f2cd2](util['format'](_0xeea4('0x43'),_0x44e880[_0x546824][_0x504b3f][_0xeea4('0x6')]));break;case 0x8:if(_0x290983['role']!=='agent')_0x50d509[_0x3f2cd2](util['format'](_0xeea4('0x44'),_0x44e880[_0x546824][_0x504b3f][_0xeea4('0x6')]));break;case 0x9:if(_0x290983[_0xeea4('0x4')]!==_0xeea4('0x5'))_0x50d509[_0x3f2cd2](util[_0xeea4('0x1d')](_0xeea4('0x45'),_0x44e880[_0x546824][_0x504b3f][_0xeea4('0x8')],_0x44e880[_0x546824][_0x504b3f][_0xeea4('0x6')]));break;case 0xa:_0x50d509[_0x3f2cd2](util['format']('user:%s',_0x44e880[_0x546824][_0x504b3f][_0xeea4('0x6')]));break;}}}}})['then'](function(){if(_0x3f2cd2===_0xeea4('0x46')){var _0x51b285=_[_0xeea4('0x17')](_0x290983[_0xeea4('0x23')],'id');return _0x290983['removeChatInteractions'](_0x51b285)[_0xeea4('0xb')](function(){for(var _0x25a503=0x0;_0x25a503<_0x51b285[_0xeea4('0x1c')];_0x25a503+=0x1){_0x88ab4f['emit'](_0xeea4('0x47'),{'ChatInteractionId':Number(_0x51b285[_0x25a503]),'UserId':Number(_0x290983['id'])});}});}})[_0xeea4('0xb')](function(){if(_0x3f2cd2===_0xeea4('0x46')){var _0x5e2914=_[_0xeea4('0x17')](_0x290983[_0xeea4('0x25')],'id');return _0x290983[_0xeea4('0x48')](_0x5e2914)[_0xeea4('0xb')](function(){for(var _0x11f6db=0x0;_0x11f6db<_0x5e2914[_0xeea4('0x1c')];_0x11f6db+=0x1){_0x88ab4f[_0xeea4('0x49')](_0xeea4('0x4a'),{'MailInteractionId':Number(_0x5e2914[_0x11f6db]),'UserId':Number(_0x290983['id'])});}});}})[_0xeea4('0xb')](function(){if(_0x3f2cd2===_0xeea4('0x46')){var _0x142086=_[_0xeea4('0x17')](_0x290983[_0xeea4('0x26')],'id');return _0x290983['removeFaxInteractions'](_0x142086)[_0xeea4('0xb')](function(){for(var _0x529edc=0x0;_0x529edc<_0x142086['length'];_0x529edc+=0x1){_0x88ab4f[_0xeea4('0x49')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x142086[_0x529edc]),'UserId':Number(_0x290983['id'])});}});}})[_0xeea4('0xb')](function(){if(_0x3f2cd2===_0xeea4('0x46')){var _0x16d1b7=_['map'](_0x290983[_0xeea4('0x4b')],'id');return _0x290983['removeSmsInteractions'](_0x16d1b7)[_0xeea4('0xb')](function(){for(var _0xcb3ba4=0x0;_0xcb3ba4<_0x16d1b7[_0xeea4('0x1c')];_0xcb3ba4+=0x1){_0x88ab4f[_0xeea4('0x49')](_0xeea4('0x4c'),{'SmsInteractionId':Number(_0x16d1b7[_0xcb3ba4]),'UserId':Number(_0x290983['id'])});}});}})['then'](function(){if(_0x3f2cd2===_0xeea4('0x46')){var _0x3f2d0c=_[_0xeea4('0x17')](_0x290983['OpenchannelInteractions'],'id');return _0x290983[_0xeea4('0x4d')](_0x3f2d0c)[_0xeea4('0xb')](function(){for(var _0x3ebb3c=0x0;_0x3ebb3c<_0x3f2d0c['length'];_0x3ebb3c+=0x1){_0x88ab4f[_0xeea4('0x49')](_0xeea4('0x4e'),{'OpenchannelInteractionId':Number(_0x3f2d0c[_0x3ebb3c]),'UserId':Number(_0x290983['id'])});}});}})[_0xeea4('0xb')](function(){if(_0x3f2cd2==='leave'){var _0x10eaed=_['map'](_0x290983[_0xeea4('0x2a')],'id');return _0x290983[_0xeea4('0x4f')](_0x10eaed)[_0xeea4('0xb')](function(){for(var _0x1d0062=0x0;_0x1d0062<_0x10eaed[_0xeea4('0x1c')];_0x1d0062+=0x1){_0x88ab4f[_0xeea4('0x49')](_0xeea4('0x50'),{'WhatsappInteractionId':Number(_0x10eaed[_0x1d0062]),'UserId':Number(_0x290983['id'])});}});}})[_0xeea4('0x51')](function(_0x1709d2){_0x50d509[_0xeea4('0x52')](_0x1709d2);});}}function onDisconnect(_0x5c39f3,_0x43302c){joinOrLeave(_0x5c39f3,_0xeea4('0x46'),_0x43302c);}function onConnect(_0x3fbffc){joinOrLeave(_0x3fbffc,_0xeea4('0x53'));}exports[_0xeea4('0x54')]=function(_0x2fde9e){_0x2fde9e['on']('connection',function(_0x3699d6){_0x3699d6[_0xeea4('0x55')](0x0);_0x3699d6[_0xeea4('0x56')]=_0x3699d6['request']['connection'][_0xeea4('0x57')]+':'+_0x3699d6[_0xeea4('0x58')][_0xeea4('0x59')]['remotePort'];_0x3699d6[_0xeea4('0x5a')]=new Date();_0x3699d6['log']=function(_0x5b8d9d){console[_0xeea4('0x52')]('SocketIO\x20'+_0x3699d6['nsp']['name']+'['+_0x3699d6[_0xeea4('0x56')]+']',_0x5b8d9d);};_0x3699d6['on'](_0xeea4('0x5b'),function(){onDisconnect(_0x3699d6,_0x2fde9e);_0x3699d6[_0xeea4('0x52')](_0xeea4('0x5c'));});onConnect(_0x3699d6);_0x3699d6[_0xeea4('0x52')]('CONNECTED');});}; \ No newline at end of file +var _0xd0bb=['trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','OpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','connection','setMaxListeners','address','request','remotePort','SocketIO\x20','nsp','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','type','UserProfileSection','findOne','then','autoAssociation','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','ivr','format','%s:queue:%s','Agents','length','user:%s','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','push','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','FaxQueues','agent','getVoiceQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s'];(function(_0x19b5c9,_0x437794){var _0x4243e4=function(_0x9c68e3){while(--_0x9c68e3){_0x19b5c9['push'](_0x19b5c9['shift']());}};_0x4243e4(++_0x437794);}(_0xd0bb,0x1a8));var _0xbd0b=function(_0x1e0d54,_0x46fbec){_0x1e0d54=_0x1e0d54-0x0;var _0x244204=_0xd0bb[_0x1e0d54];return _0x244204;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var BPromise=require(_0xbd0b('0x2'));var db=require(_0xbd0b('0x3'))['db'];var config=require(_0xbd0b('0x4'));var queryQueues={'attributes':['id',_0xbd0b('0x5')],'include':[{'as':'Agents','model':db[_0xbd0b('0x6')],'attributes':['id',_0xbd0b('0x5'),_0xbd0b('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xbd0b('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xbd0b('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xbd0b('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xbd0b('0x5'),_0xbd0b('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x200ecb,_0x2f14d5,_0x564b5d){return db[_0xbd0b('0x9')][_0xbd0b('0xa')]({'where':{'name':_0x200ecb,'userProfileId':_0x2f14d5},'raw':!![]})[_0xbd0b('0xb')](function(_0x432c48){if(_0x432c48){if(_0x432c48[_0xbd0b('0xc')]){switch(_0x200ecb){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0xbd0b('0xd'):case _0xbd0b('0xe'):case _0xbd0b('0xf'):case _0xbd0b('0x10'):return db[_0x564b5d][_0xbd0b('0x11')](queryQueues);case _0xbd0b('0x12'):return db[_0x564b5d][_0xbd0b('0x11')](queryTelephones);case _0xbd0b('0x13'):return db[_0x564b5d][_0xbd0b('0x11')](queryTrunks);case _0xbd0b('0x14'):return db[_0x564b5d]['findAll'](queryCampaigns);}}else{return db[_0xbd0b('0x15')][_0xbd0b('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x432c48['id']},'raw':!![]})[_0xbd0b('0xb')](function(_0x40dc51){if(_0x40dc51){var _0x4514ec={'where':{'id':_['map'](_0x40dc51,_0xbd0b('0x16'))},'raw':!![]};switch(_0x564b5d){case _0xbd0b('0x6'):_0x4514ec[_0xbd0b('0x17')][_0xbd0b('0x7')]=_0xbd0b('0x18');break;case _0xbd0b('0x19'):_0x4514ec[_0xbd0b('0x17')][_0xbd0b('0x8')]=_0xbd0b('0x1a');break;}return db[_0x564b5d][_0xbd0b('0x11')](_0x4514ec);}else{return[];}});}}else{return[];}})['then'](function(_0x525d01){return _0x525d01;});}function joinOrLeaveQueues(_0x4e1676,_0xed0bfd,_0x23455f,_0x5ef63e){_0x4e1676[_0xed0bfd](util[_0xbd0b('0x1b')](_0xbd0b('0x1c'),_0x23455f,_0x5ef63e[_0xbd0b('0x5')]));if(_0x5ef63e[_0xbd0b('0x1d')]){for(var _0x3c27d2=0x0;_0x3c27d2<_0x5ef63e[_0xbd0b('0x1d')][_0xbd0b('0x1e')];_0x3c27d2+=0x1){_0x4e1676[_0xed0bfd](util[_0xbd0b('0x1b')](_0xbd0b('0x1f'),_0x5ef63e[_0xbd0b('0x1d')][_0x3c27d2][_0xbd0b('0x5')]));}}}function joinOrLeave(_0x495210,_0x4ef8e1,_0x740e69){var _0x222901;if(_0x495210[_0xbd0b('0x20')]['query']['id']){db[_0xbd0b('0x6')][_0xbd0b('0x21')]({'attributes':['id',_0xbd0b('0x5'),_0xbd0b('0x7'),_0xbd0b('0x22')],'where':{'id':_0x495210[_0xbd0b('0x20')]['query']['id']},'include':[{'model':db[_0xbd0b('0x23')],'as':_0xbd0b('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd0b('0x25')],'as':_0xbd0b('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd0b('0x27')],'as':_0xbd0b('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd0b('0x29')],'as':_0xbd0b('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd0b('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbd0b('0x2c')],'as':_0xbd0b('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xbd0b('0xb')](function(_0x3732e7){if(_0x3732e7){_0x222901=_0x3732e7;_0x495210[_0x4ef8e1](util[_0xbd0b('0x1b')](_0xbd0b('0x1f'),_0x3732e7[_0xbd0b('0x5')]));var _0x8f4e86=[];switch(_0x3732e7['role']){case _0xbd0b('0x2e'):_0x495210[_0x4ef8e1](_0xbd0b('0x2f'));_0x495210[_0x4ef8e1](_0xbd0b('0x30'));if(queryQueues[_0xbd0b('0x31')](_0xbd0b('0x32'))){delete queryQueues[_0xbd0b('0x32')];}_0x8f4e86['push'](db[_0xbd0b('0x33')][_0xbd0b('0x11')](queryQueues));_0x8f4e86['push'](db[_0xbd0b('0x34')]['findAll'](queryQueues));_0x8f4e86['push'](db[_0xbd0b('0x35')][_0xbd0b('0x11')](queryQueues));_0x8f4e86['push'](db[_0xbd0b('0x36')]['findAll'](queryQueues));_0x8f4e86[_0xbd0b('0x37')](db[_0xbd0b('0x38')][_0xbd0b('0x11')](queryQueues));_0x8f4e86[_0xbd0b('0x37')](db[_0xbd0b('0x39')]['findAll'](queryQueues));_0x8f4e86[_0xbd0b('0x37')](db[_0xbd0b('0x3a')][_0xbd0b('0x11')](queryQueues));_0x8f4e86[_0xbd0b('0x37')](db[_0xbd0b('0x6')][_0xbd0b('0x11')](queryTelephones));_0x8f4e86['push'](db[_0xbd0b('0x3b')]['findAll'](queryTrunks));_0x8f4e86[_0xbd0b('0x37')](db['Campaign'][_0xbd0b('0x11')](queryCampaigns));_0x8f4e86['push'](db['User'][_0xbd0b('0x11')](queryAgents));break;case _0xbd0b('0x3c'):_0x495210[_0x4ef8e1]('voice:inbound');_0x495210[_0x4ef8e1](_0xbd0b('0x30'));_0x8f4e86['push'](getAssociatedResources('VoiceQueues',_0x3732e7['userProfileId'],_0xbd0b('0x33')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources('ChatQueues',_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x34')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources(_0xbd0b('0x3d'),_0x3732e7['userProfileId'],_0xbd0b('0x35')));_0x8f4e86['push'](getAssociatedResources(_0xbd0b('0xd'),_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x36')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources(_0xbd0b('0xe'),_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x38')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources(_0xbd0b('0xf'),_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x39')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources(_0xbd0b('0x10'),_0x3732e7['userProfileId'],'WhatsappQueue'));_0x8f4e86['push'](getAssociatedResources(_0xbd0b('0x12'),_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x6')));_0x8f4e86['push'](getAssociatedResources(_0xbd0b('0x13'),_0x3732e7['userProfileId'],_0xbd0b('0x3b')));_0x8f4e86[_0xbd0b('0x37')](getAssociatedResources(_0xbd0b('0x14'),_0x3732e7[_0xbd0b('0x22')],_0xbd0b('0x19')));_0x8f4e86['push'](db['User']['findAll'](queryAgents));break;case _0xbd0b('0x3e'):_0x495210[_0x4ef8e1](_0xbd0b('0x2f'));_0x495210[_0x4ef8e1](_0xbd0b('0x30'));_0x8f4e86[_0xbd0b('0x37')](_0x3732e7[_0xbd0b('0x3f')]({'attributes':['id',_0xbd0b('0x5')]}));_0x8f4e86[_0xbd0b('0x37')](_0x3732e7['getChatQueues']({'attributes':['id',_0xbd0b('0x5')]}));_0x8f4e86['push'](_0x3732e7[_0xbd0b('0x40')]({'attributes':['id',_0xbd0b('0x5')]}));_0x8f4e86['push'](_0x3732e7['getSmsQueues']({'attributes':['id',_0xbd0b('0x5')]}));_0x8f4e86[_0xbd0b('0x37')](_0x3732e7[_0xbd0b('0x41')]({'attributes':['id',_0xbd0b('0x5')]}));_0x8f4e86['push'](_0x3732e7[_0xbd0b('0x42')]({'attributes':['id','name']}));_0x8f4e86[_0xbd0b('0x37')](_0x3732e7[_0xbd0b('0x43')]({'attributes':['id',_0xbd0b('0x5')]}));break;}return BPromise['all'](_0x8f4e86);}})[_0xbd0b('0xb')](function(_0x231673){if(_0x231673&&_0x231673['length']){for(var _0x5dba32=0x0;_0x5dba32<_0x231673[_0xbd0b('0x1e')];_0x5dba32+=0x1){for(var _0x29fb0b=0x0;_0x29fb0b<_0x231673[_0x5dba32][_0xbd0b('0x1e')];_0x29fb0b+=0x1){switch(_0x5dba32){case 0x0:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x44'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x1:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x45'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x2:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x46'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x3:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x47'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x4:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x48'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x5:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x49'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x6:joinOrLeaveQueues(_0x495210,_0x4ef8e1,_0xbd0b('0x4a'),_0x231673[_0x5dba32][_0x29fb0b]);break;case 0x7:if(_0x222901[_0xbd0b('0x7')]!==_0xbd0b('0x3e'))_0x495210[_0x4ef8e1](util[_0xbd0b('0x1b')](_0xbd0b('0x4b'),_0x231673[_0x5dba32][_0x29fb0b]['name']));break;case 0x8:if(_0x222901[_0xbd0b('0x7')]!==_0xbd0b('0x3e'))_0x495210[_0x4ef8e1](util[_0xbd0b('0x1b')](_0xbd0b('0x4c'),_0x231673[_0x5dba32][_0x29fb0b][_0xbd0b('0x5')]));break;case 0x9:if(_0x222901[_0xbd0b('0x7')]!==_0xbd0b('0x3e'))_0x495210[_0x4ef8e1](util[_0xbd0b('0x1b')](_0xbd0b('0x4d'),_0x231673[_0x5dba32][_0x29fb0b][_0xbd0b('0x8')],_0x231673[_0x5dba32][_0x29fb0b][_0xbd0b('0x5')]));break;case 0xa:_0x495210[_0x4ef8e1](util[_0xbd0b('0x1b')]('user:%s',_0x231673[_0x5dba32][_0x29fb0b][_0xbd0b('0x5')]));break;}}}}})[_0xbd0b('0xb')](function(){if(_0x4ef8e1===_0xbd0b('0x4e')){var _0x2a5950=_[_0xbd0b('0x4f')](_0x222901[_0xbd0b('0x24')],'id');return _0x222901[_0xbd0b('0x50')](_0x2a5950)[_0xbd0b('0xb')](function(){for(var _0x2b43f6=0x0;_0x2b43f6<_0x2a5950[_0xbd0b('0x1e')];_0x2b43f6+=0x1){_0x740e69['emit'](_0xbd0b('0x51'),{'ChatInteractionId':Number(_0x2a5950[_0x2b43f6]),'UserId':Number(_0x222901['id'])});}});}})[_0xbd0b('0xb')](function(){if(_0x4ef8e1===_0xbd0b('0x4e')){var _0x32bed1=_[_0xbd0b('0x4f')](_0x222901[_0xbd0b('0x26')],'id');return _0x222901['removeMailInteractions'](_0x32bed1)[_0xbd0b('0xb')](function(){for(var _0x478dd0=0x0;_0x478dd0<_0x32bed1[_0xbd0b('0x1e')];_0x478dd0+=0x1){_0x740e69['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x32bed1[_0x478dd0]),'UserId':Number(_0x222901['id'])});}});}})[_0xbd0b('0xb')](function(){if(_0x4ef8e1===_0xbd0b('0x4e')){var _0x520587=_[_0xbd0b('0x4f')](_0x222901['FaxInteractions'],'id');return _0x222901[_0xbd0b('0x52')](_0x520587)[_0xbd0b('0xb')](function(){for(var _0x357ac0=0x0;_0x357ac0<_0x520587[_0xbd0b('0x1e')];_0x357ac0+=0x1){_0x740e69[_0xbd0b('0x53')](_0xbd0b('0x54'),{'FaxInteractionId':Number(_0x520587[_0x357ac0]),'UserId':Number(_0x222901['id'])});}});}})[_0xbd0b('0xb')](function(){if(_0x4ef8e1==='leave'){var _0x461f8f=_[_0xbd0b('0x4f')](_0x222901[_0xbd0b('0x2a')],'id');return _0x222901[_0xbd0b('0x55')](_0x461f8f)[_0xbd0b('0xb')](function(){for(var _0x2836ff=0x0;_0x2836ff<_0x461f8f['length'];_0x2836ff+=0x1){_0x740e69[_0xbd0b('0x53')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x461f8f[_0x2836ff]),'UserId':Number(_0x222901['id'])});}});}})[_0xbd0b('0xb')](function(){if(_0x4ef8e1===_0xbd0b('0x4e')){var _0x233c44=_[_0xbd0b('0x4f')](_0x222901[_0xbd0b('0x56')],'id');return _0x222901['removeOpenchannelInteractions'](_0x233c44)['then'](function(){for(var _0x2ffe1f=0x0;_0x2ffe1f<_0x233c44[_0xbd0b('0x1e')];_0x2ffe1f+=0x1){_0x740e69[_0xbd0b('0x53')](_0xbd0b('0x57'),{'OpenchannelInteractionId':Number(_0x233c44[_0x2ffe1f]),'UserId':Number(_0x222901['id'])});}});}})['then'](function(){if(_0x4ef8e1==='leave'){var _0x57540f=_[_0xbd0b('0x4f')](_0x222901[_0xbd0b('0x2d')],'id');return _0x222901[_0xbd0b('0x58')](_0x57540f)[_0xbd0b('0xb')](function(){for(var _0x3e7d6f=0x0;_0x3e7d6f<_0x57540f[_0xbd0b('0x1e')];_0x3e7d6f+=0x1){_0x740e69[_0xbd0b('0x53')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x57540f[_0x3e7d6f]),'UserId':Number(_0x222901['id'])});}});}})[_0xbd0b('0x59')](function(_0x1130af){_0x495210[_0xbd0b('0x5a')](_0x1130af);});}}function onDisconnect(_0x5b717f,_0xe8a91){joinOrLeave(_0x5b717f,_0xbd0b('0x4e'),_0xe8a91);}function onConnect(_0x27ff11){joinOrLeave(_0x27ff11,_0xbd0b('0x5b'));}exports['default']=function(_0x1858d1){_0x1858d1['on'](_0xbd0b('0x5c'),function(_0x45e155){_0x45e155[_0xbd0b('0x5d')](0x0);_0x45e155[_0xbd0b('0x5e')]=_0x45e155[_0xbd0b('0x5f')][_0xbd0b('0x5c')]['remoteAddress']+':'+_0x45e155[_0xbd0b('0x5f')][_0xbd0b('0x5c')][_0xbd0b('0x60')];_0x45e155['connectedAt']=new Date();_0x45e155['log']=function(_0x1bef9c){console[_0xbd0b('0x5a')](_0xbd0b('0x61')+_0x45e155[_0xbd0b('0x62')][_0xbd0b('0x5')]+'['+_0x45e155[_0xbd0b('0x5e')]+']',_0x1bef9c);};_0x45e155['on']('disconnect',function(){onDisconnect(_0x45e155,_0x1858d1);_0x45e155['log'](_0xbd0b('0x63'));});onConnect(_0x45e155);_0x45e155[_0xbd0b('0x5a')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 4439be0..3542b6d 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 _0xeaf3=['afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','substatus','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','code','error','catch','Trigger,\x20%s','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','find','email','internal','format','name','channel','agent','incomingmessage','get','opened','query','changed','closed','motionChannel','UserId','User','fullname','interface','SIP/%s','default','length','hasOwnProperty','model','hook','callback','toLowerCase','jayson/promise','../logger','http','Chat'];(function(_0x15411f,_0x42bef8){var _0x555650=function(_0x215e4f){while(--_0x215e4f){_0x15411f['push'](_0x15411f['shift']());}};_0x555650(++_0x42bef8);}(_0xeaf3,0xcb));var _0x3eaf=function(_0x4c9eb3,_0x510fec){_0x4c9eb3=_0x4c9eb3-0x0;var _0x5ae9f4=_0xeaf3[_0x4c9eb3];return _0x5ae9f4;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x3eaf('0x0'));var logger=require(_0x3eaf('0x1'))('triggers');var _=require('lodash');var client=jayson['client'][_0x3eaf('0x2')]({'port':0x232a});var triggers=[{'channel':_0x3eaf('0x3'),'model':'ChatInteraction','event':_0x3eaf('0x4'),'condition':_0x3eaf('0x5'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0x3eaf('0x6'),'condition':_0x3eaf('0x7'),'callback':afterUpdate},{'channel':_0x3eaf('0x3'),'model':_0x3eaf('0x8'),'event':_0x3eaf('0x4'),'condition':_0x3eaf('0x9'),'callback':afterCreateMessage},{'channel':_0x3eaf('0xa'),'model':_0x3eaf('0xb'),'event':_0x3eaf('0x4'),'condition':_0x3eaf('0x5'),'callback':afterCreate},{'channel':_0x3eaf('0xa'),'model':'SmsInteraction','event':_0x3eaf('0x6'),'condition':_0x3eaf('0x7'),'callback':afterUpdate},{'channel':_0x3eaf('0xa'),'model':_0x3eaf('0xc'),'event':_0x3eaf('0x4'),'condition':_0x3eaf('0x9'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x3eaf('0x4'),'condition':_0x3eaf('0x5'),'callback':afterCreate},{'channel':_0x3eaf('0xd'),'model':_0x3eaf('0xe'),'event':_0x3eaf('0x6'),'condition':_0x3eaf('0x7'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x3eaf('0xf'),'event':_0x3eaf('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3eaf('0x10'),'model':_0x3eaf('0x11'),'event':_0x3eaf('0x4'),'condition':_0x3eaf('0x5'),'callback':afterCreate},{'channel':_0x3eaf('0x10'),'model':_0x3eaf('0x11'),'event':_0x3eaf('0x6'),'condition':_0x3eaf('0x7'),'callback':afterUpdate},{'channel':'Fax','model':_0x3eaf('0x12'),'event':_0x3eaf('0x4'),'condition':_0x3eaf('0x9'),'callback':afterCreateMessage},{'channel':_0x3eaf('0x13'),'model':'MailInteraction','event':_0x3eaf('0x4'),'condition':_0x3eaf('0x5'),'callback':afterCreate},{'channel':'Mail','model':_0x3eaf('0x14'),'event':_0x3eaf('0x6'),'condition':_0x3eaf('0x7'),'callback':afterUpdate},{'channel':'Mail','model':_0x3eaf('0x14'),'event':_0x3eaf('0x15'),'condition':'substatus','callback':afterUpdate},{'channel':'Mail','model':_0x3eaf('0x16'),'event':_0x3eaf('0x4'),'condition':_0x3eaf('0x9'),'callback':afterCreateMessage},{'channel':_0x3eaf('0x17'),'model':_0x3eaf('0x18'),'event':_0x3eaf('0x4'),'condition':_0x3eaf('0x5'),'callback':afterCreate},{'channel':_0x3eaf('0x17'),'model':_0x3eaf('0x18'),'event':_0x3eaf('0x6'),'condition':_0x3eaf('0x7'),'callback':afterUpdate},{'channel':_0x3eaf('0x17'),'model':_0x3eaf('0x19'),'event':_0x3eaf('0x4'),'condition':_0x3eaf('0x9'),'callback':afterCreateMessage}];function request(_0x626c0){return client[_0x3eaf('0x1a')](_0x3eaf('0x1b'),_0x626c0)[_0x3eaf('0x1c')](function(_0x19f9ec){logger[_0x3eaf('0x1d')]('Trigger,\x20%s','EventManager',_0x19f9ec);if(_0x19f9ec['error']){if(_0x19f9ec['error'][_0x3eaf('0x1e')]===0x1f4){logger[_0x3eaf('0x1f')]('Trigger,\x20%s',_0x3eaf('0x1b'),_0x19f9ec['error']);}}})[_0x3eaf('0x20')](function(_0x428c18){logger[_0x3eaf('0x1f')](_0x3eaf('0x21'),_0x3eaf('0x1b'),_0x428c18);});}function afterCreateMessage(_0x583a5c,_0x49a473){return function(_0x5c5962,_0x375900){_0x5c5962=_0x5c5962['get']({'plain':!![]});_0x5c5962['channel']=_0x583a5c;_0x5c5962['motionChannel']=_0x583a5c;_0x5c5962[_0x3eaf('0x22')]=_0x5c5962[_0x3eaf('0x23')];var _0x4f9201=_0x3eaf('0x24')+_0x5c5962[_0x3eaf('0x25')];return db[_0x3eaf('0x26')]['query'](_0x4f9201,{'type':db[_0x3eaf('0x27')][_0x3eaf('0x28')][_0x3eaf('0x29')],'raw':!![]})[_0x3eaf('0x1c')](function(_0x1b5be4){return _0x1b5be4;})[_0x3eaf('0x1c')](function(_0x3494ef){if(_0x3494ef){_0x5c5962[_0x3eaf('0x2a')]=_0x3494ef[0x0];}if(_0x5c5962['UserId']){return db['User'][_0x3eaf('0x2b')]({'where':{'id':_0x5c5962['UserId']},'attributes':['id','name','fullname',_0x3eaf('0x2c'),_0x3eaf('0x2d')],'raw':!![]})[_0x3eaf('0x1c')](function(_0x544bf6){_0x5c5962['interface']=util[_0x3eaf('0x2e')]('SIP/%s',_0x544bf6[_0x3eaf('0x2f')]);_0x5c5962[_0x3eaf('0x30')]=_0x583a5c;_0x5c5962[_0x3eaf('0x31')]=_0x544bf6;return request({'event':_0x3eaf('0x32'),'message':_0x5c5962});})[_0x3eaf('0x20')](function(_0x1b2076){console[_0x3eaf('0x1f')](_0x1b2076);});}else{return request({'event':'outgoingmessage','message':_0x5c5962});}});};}function afterCreate(_0x180426,_0x27db2a){return function(_0x422062,_0x1db029){_0x422062=_0x422062[_0x3eaf('0x33')]({'plain':!![]});_0x422062[_0x3eaf('0x30')]=_0x180426;_0x422062['motionChannel']=_0x180426;_0x422062['event']=_0x3eaf('0x34');var _0x4fc13b=_0x3eaf('0x24')+_0x422062[_0x3eaf('0x25')];return db['sequelize'][_0x3eaf('0x35')](_0x4fc13b,{'type':db[_0x3eaf('0x27')][_0x3eaf('0x28')][_0x3eaf('0x29')],'raw':!![]})[_0x3eaf('0x1c')](function(_0xa351b3){return _0xa351b3;})['then'](function(_0x2ba8b5){if(_0x2ba8b5){_0x422062[_0x3eaf('0x2a')]=_0x2ba8b5[0x0];}return request({'event':_0x27db2a,'message':_0x422062});});};}function afterUpdate(_0x551f35,_0x140b34){return function(_0x2a559c,_0x346bee){if(_0x2a559c[_0x3eaf('0x36')](_0x3eaf('0x37'))&&_0x2a559c[_0x3eaf('0x37')]){_0x2a559c=_0x2a559c[_0x3eaf('0x33')]({'plain':!![]});_0x2a559c[_0x3eaf('0x30')]=_0x551f35;_0x2a559c[_0x3eaf('0x38')]=_0x551f35;_0x2a559c[_0x3eaf('0x22')]=_0x3eaf('0x37');var _0x55ded0=_0x3eaf('0x24')+_0x2a559c['ContactId'];return db[_0x3eaf('0x26')][_0x3eaf('0x35')](_0x55ded0,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x56493c){return _0x56493c;})[_0x3eaf('0x1c')](function(_0x2690e5){if(_0x2690e5){_0x2a559c[_0x3eaf('0x2a')]=_0x2690e5[0x0];}if(_0x2a559c[_0x3eaf('0x39')]){return db[_0x3eaf('0x3a')][_0x3eaf('0x2b')]({'where':{'id':_0x2a559c[_0x3eaf('0x39')]},'attributes':['id',_0x3eaf('0x2f'),_0x3eaf('0x3b'),_0x3eaf('0x2c'),'internal'],'raw':!![]})[_0x3eaf('0x1c')](function(_0x567e98){_0x2a559c[_0x3eaf('0x3c')]=util['format']('SIP/%s',_0x567e98['name']);_0x2a559c[_0x3eaf('0x31')]=_0x567e98;return request({'event':_0x140b34,'message':_0x2a559c});})[_0x3eaf('0x20')](function(_0x16b5d9){console[_0x3eaf('0x1f')](_0x16b5d9);});}else{return request({'event':_0x140b34,'message':_0x2a559c});}});}else if(_0x2a559c[_0x3eaf('0x36')](_0x3eaf('0x15'))){_0x2a559c=_0x2a559c[_0x3eaf('0x33')]({'plain':!![]});_0x2a559c[_0x3eaf('0x30')]=_0x551f35;_0x2a559c[_0x3eaf('0x22')]=_0x3eaf('0x15');var _0x55ded0=_0x3eaf('0x24')+_0x2a559c['ContactId'];return db[_0x3eaf('0x26')]['query'](_0x55ded0,{'type':db[_0x3eaf('0x27')][_0x3eaf('0x28')][_0x3eaf('0x29')],'raw':!![]})[_0x3eaf('0x1c')](function(_0x432661){return _0x432661;})[_0x3eaf('0x1c')](function(_0x176b2b){if(_0x176b2b){_0x2a559c[_0x3eaf('0x2a')]=_0x176b2b[0x0];}if(_0x2a559c[_0x3eaf('0x39')]){return db['User'][_0x3eaf('0x2b')]({'where':{'id':_0x2a559c[_0x3eaf('0x39')]},'attributes':['id',_0x3eaf('0x2f'),_0x3eaf('0x3b'),'email',_0x3eaf('0x2d')],'raw':!![]})[_0x3eaf('0x1c')](function(_0x41a2c8){_0x2a559c[_0x3eaf('0x3c')]=util['format'](_0x3eaf('0x3d'),_0x41a2c8[_0x3eaf('0x2f')]);_0x2a559c[_0x3eaf('0x31')]=_0x41a2c8;return request({'event':_0x140b34,'message':_0x2a559c});})[_0x3eaf('0x20')](function(_0x2fb3e2){console[_0x3eaf('0x1f')](_0x2fb3e2);});}else{return request({'event':_0x140b34,'message':_0x2a559c});}});}};}exports[_0x3eaf('0x3e')]=function(){for(var _0x30c952=0x0;_0x30c952=_0x876876['agents']){throw Error(_0x1cff('0x16'));}_0xb5b828(_0x19b326);})['catch'](function(_0x512981){_0x33dc77(_0x512981);});});}; \ No newline at end of file +var _0xd145=['clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','sms','whatsapp','openchannel','getChannels','isValidChannel','includes'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xd145,0xe3));var _0x5d14=function(_0x522cec,_0x40b6ed){_0x522cec=_0x522cec-0x0;var _0x5b6d5e=_0xd145[_0x522cec];return _0x5b6d5e;};'use strict';var _=require(_0x5d14('0x0'));var BPromise=require(_0x5d14('0x1'));var db=require(_0x5d14('0x2'))['db'];var util=require(_0x5d14('0x3'));var channels=[_0x5d14('0x4'),_0x5d14('0x5'),_0x5d14('0x6'),'fax',_0x5d14('0x7'),_0x5d14('0x8'),_0x5d14('0x9')];exports[_0x5d14('0xa')]=function(){return channels;};exports[_0x5d14('0xb')]=function(_0x1c30ba){_0x1c30ba=_0x1c30ba['toLowerCase']();return _[_0x5d14('0xc')](channels,_0x1c30ba);};exports[_0x5d14('0xd')]=function(_0x30fb0a,_0x32b5b9,_0x2b88c9,_0x4fb20b){var _0x59d96d={'loginAttempts':_0x32b5b9,'blocked':_0x2b88c9};if(!_[_0x5d14('0xe')](_0x4fb20b)){_0x59d96d[_0x5d14('0xf')]=_0x4fb20b;}return _0x30fb0a[_0x5d14('0x10')](_0x59d96d);};exports[_0x5d14('0x11')]=function(_0x51e104){return new BPromise(function(_0x150a2c,_0x14d35e){var _0x52a8c5=0x0;if(_0x51e104['role']!==_0x5d14('0x12')){_0x150a2c(_0x51e104);}db[_0x5d14('0x13')]['count']({'where':{'role':_0x5d14('0x12'),'online':!![],'id':{'$ne':_0x51e104['id']}}})['then'](function(_0x449445){_0x52a8c5=_0x449445;return util[_0x5d14('0x11')]();})[_0x5d14('0x14')](function(_0x79f023){if(_0x79f023&&_0x79f023[_0x5d14('0x15')]&&_0x52a8c5>=_0x79f023[_0x5d14('0x15')]){throw Error(_0x5d14('0x16'));}_0x150a2c(_0x51e104);})[_0x5d14('0x17')](function(_0x4cf961){_0x14d35e(_0x4cf961);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 81994cb..a920b1d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x242d=['send','exports','status','render','json'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x242d,0x11e));var _0xd242=function(_0x60b6df,_0xcbc63d){_0x60b6df=_0x60b6df-0x0;var _0x58dcf1=_0x242d[_0x60b6df];return _0x58dcf1;};'use strict';module[_0xd242('0x0')][0x194]=function pageNotFound(_0x1a659c,_0xac2b80){var _0x2612f6='404';var _0x36aaa4=0x194;var _0x4e85d1={'status':_0x36aaa4};_0xac2b80[_0xd242('0x1')](_0x4e85d1[_0xd242('0x1')]);_0xac2b80[_0xd242('0x2')](_0x2612f6,{},function(_0x380368,_0x495b97){if(_0x380368){return _0xac2b80[_0xd242('0x1')](_0x4e85d1['status'])[_0xd242('0x3')](_0x4e85d1);}_0xac2b80[_0xd242('0x4')](_0x495b97);});}; \ No newline at end of file +var _0x7129=['status','json','send'];(function(_0x5d990c,_0x461743){var _0xad431=function(_0x1ae457){while(--_0x1ae457){_0x5d990c['push'](_0x5d990c['shift']());}};_0xad431(++_0x461743);}(_0x7129,0x99));var _0x9712=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7129[_0xa464c9];return _0x3d73c4;};'use strict';module['exports'][0x194]=function pageNotFound(_0x4333c5,_0x150bb6){var _0x3189f3='404';var _0x120af8=0x194;var _0x2c0e4a={'status':_0x120af8};_0x150bb6['status'](_0x2c0e4a[_0x9712('0x0')]);_0x150bb6['render'](_0x3189f3,{},function(_0x2f9b6d,_0x1b9be0){if(_0x2f9b6d){return _0x150bb6['status'](_0x2c0e4a[_0x9712('0x0')])[_0x9712('0x1')](_0x2c0e4a);}_0x150bb6[_0x9712('0x2')](_0x1b9be0);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 32a44c6..47e369a 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb5=['../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','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','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction','ChatInteractions','WhatsappInteractions','UserNotifications','SenderId','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','SmsInteractions','user_has_openchannel_interactions','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','UserWhatsappQueue','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperFinals','HopperHistories','CmHopperBlack','TrunkId','TrunkBackup','TrunkBackupId','belongsTo','Interval','IntervalId','voice_queues_has_cm_lists','Team','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','uniqueid','AgentReports','ContactId','MailAccountId','MailServerOut','MailAccount','Smtp','Dispositions','Interactions','List','ListId','Template','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Dashboard','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','SmsAccountId','Answers','SmsApplication','SmsInteractionId','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroup','ChatInternalMessage','CompanyId','Hoppers','JscriptySessions','CmCompany','Company','cm_contact_has_tags','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','sms_interaction_has_tags','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','Configurations','AccountId','SalesforceField','Descriptions','DescriptionId','FieldId','SubjectId','Field','SugarcrmConfiguration','Subjects','Subject','VariableId','DeskAccount','int_desk_configuration_has_tags','Description','ZohoAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowField','Dynamics365Field','FreshsalesField','ChatQueueReport','SessionId','ProjectId','VoiceQueues','team_has_fax_queues','CampaignId','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','UserProfileSection','UserProfileSections','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','exports','../config/environment','sequelize','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','sequelizeHistory','utf8mb4','database','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration'];(function(_0x5b20e7,_0x4fdd80){var _0x38a218=function(_0x3a6c61){while(--_0x3a6c61){_0x5b20e7['push'](_0x5b20e7['shift']());}};_0x38a218(++_0x4fdd80);}(_0x0bb5,0x148));var _0x50bb=function(_0x269a8e,_0x5f550b){_0x269a8e=_0x269a8e-0x0;var _0x29c875=_0x0bb5[_0x269a8e];return _0x29c875;};'use strict';var config=require(_0x50bb('0x0'));var Sequelize=require(_0x50bb('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x50bb('0x2')]();config[_0x50bb('0x1')]=_[_0x50bb('0x3')](config[_0x50bb('0x1')],{'database':_0x50bb('0x4'),'username':_0x50bb('0x5'),'password':_0x50bb('0x6'),'options':{'host':_0x50bb('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x50bb('0x8')](),'define':{'charset':_0x50bb('0x9'),'collate':_0x50bb('0xa')}}});config[_0x50bb('0xb')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x50bb('0x4'),'username':_0x50bb('0x5'),'password':_0x50bb('0x6'),'options':{'host':_0x50bb('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x50bb('0xc')},'logging':![],'timezone':timezone[_0x50bb('0x8')](),'define':{'charset':_0x50bb('0x9'),'collate':_0x50bb('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x50bb('0x1')][_0x50bb('0xd')],config[_0x50bb('0x1')]['username'],config[_0x50bb('0x1')]['password'],config[_0x50bb('0x1')][_0x50bb('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x50bb('0xb')]['database'],config[_0x50bb('0xb')][_0x50bb('0xf')],config[_0x50bb('0xb')]['password'],config[_0x50bb('0xb')]['options'])};db[_0x50bb('0x10')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x12'));db[_0x50bb('0x13')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x14'));db['VoiceContext']=db[_0x50bb('0x1')]['import'](_0x50bb('0x15'));db[_0x50bb('0x16')]=db['sequelize']['import'](_0x50bb('0x17'));db[_0x50bb('0x18')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x50bb('0x19')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/voiceQueue/voiceQueue.model');db[_0x50bb('0x1a')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0x50bb('0x1b')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x1c'));db[_0x50bb('0x1d')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x1e'));db['VoiceMailMessage']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x1f'));db[_0x50bb('0x20')]=db['sequelize'][_0x50bb('0x11')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x50bb('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x50bb('0x21')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x22'));db[_0x50bb('0x23')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x24'));db['MemberReport']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x25'));db[_0x50bb('0x26')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x27'));db[_0x50bb('0x28')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x29'));db[_0x50bb('0x2a')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x2b'));db[_0x50bb('0x2c')]=db[_0x50bb('0x1')]['import'](_0x50bb('0x2d'));db[_0x50bb('0x2e')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x2f'));db[_0x50bb('0x30')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x31'));db[_0x50bb('0x32')]=db[_0x50bb('0x1')]['import'](_0x50bb('0x33'));db[_0x50bb('0x34')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x35'));db[_0x50bb('0x36')]=db['sequelize']['import'](_0x50bb('0x37'));db['UserWhatsappQueue']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x38'));db[_0x50bb('0x39')]=db[_0x50bb('0x1')]['import'](_0x50bb('0x3a'));db['MailServerOut']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x3b'));db['MailAccount']=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x3c'));db[_0x50bb('0x3d')]=db[_0x50bb('0x1')]['import'](_0x50bb('0x3e'));db['MailSubstatus']=db['sequelize'][_0x50bb('0x11')]('../api/mailSubstatus/mailSubstatus.model');db[_0x50bb('0x3f')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x40'));db[_0x50bb('0x41')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x42'));db[_0x50bb('0x43')]=db[_0x50bb('0x1')]['import']('../api/mailApplication/mailApplication.model');db[_0x50bb('0x44')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x45'));db['Dashboard']=db[_0x50bb('0x1')]['import'](_0x50bb('0x46'));db[_0x50bb('0x47')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x48'));db[_0x50bb('0x49')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x4a'));db[_0x50bb('0x4b')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x4c'));db[_0x50bb('0x4d')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/faxInteraction/faxInteraction.model');db[_0x50bb('0x4e')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x4f'));db[_0x50bb('0x50')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x51'));db[_0x50bb('0x52')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x53'));db[_0x50bb('0x54')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x55'));db['SmsApplication']=db[_0x50bb('0x1')]['import'](_0x50bb('0x56'));db[_0x50bb('0x57')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x58'));db[_0x50bb('0x59')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/smsMessage/smsMessage.model');db[_0x50bb('0x5a')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x5b'));db[_0x50bb('0x5c')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x5d'));db[_0x50bb('0x5e')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x50bb('0x1')]['import'](_0x50bb('0x5f'));db['OpenchannelMessage']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x60'));db['OpenchannelQueue']=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/openchannelQueue/openchannelQueue.model');db[_0x50bb('0x61')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x62'));db['OpenchannelQueueReport']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x63'));db[_0x50bb('0x64')]=db[_0x50bb('0x1')]['import'](_0x50bb('0x65'));db['ChatInteraction']=db[_0x50bb('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x50bb('0x66')]=db['sequelize']['import'](_0x50bb('0x67'));db[_0x50bb('0x68')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x69'));db[_0x50bb('0x6a')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x6b'));db[_0x50bb('0x6c')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x6d'));db['CmCompany']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x6e'));db[_0x50bb('0x6f')]=db[_0x50bb('0x1')]['import'](_0x50bb('0x70'));db[_0x50bb('0x71')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x72'));db['CmHopperBlack']=db[_0x50bb('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x50bb('0x73')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x74'));db[_0x50bb('0x75')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x76'));db[_0x50bb('0x77')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x50bb('0x78')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x79'));db['Action']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x7a'));db[_0x50bb('0x7b')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x7c'));db[_0x50bb('0x7d')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x7e'));db[_0x50bb('0x7f')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x80'));db[_0x50bb('0x81')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x82'));db['Interval']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x83'));db[_0x50bb('0x84')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/pause/pause.model');db[_0x50bb('0x85')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x86'));db[_0x50bb('0x87')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x88'));db[_0x50bb('0x89')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x8a'));db[_0x50bb('0x8b')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x8c'));db[_0x50bb('0x8d')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/tag/tag.model');db['Template']=db['sequelize'][_0x50bb('0x11')]('../api/template/template.model');db['Trigger']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x8e'));db[_0x50bb('0x8f')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x90'));db['Integration']=db[_0x50bb('0x1')]['import'](_0x50bb('0x91'));db[_0x50bb('0x92')]=db['sequelize'][_0x50bb('0x11')]('../api/integrationReport/integrationReport.model');db[_0x50bb('0x93')]=db[_0x50bb('0x1')]['import'](_0x50bb('0x94'));db[_0x50bb('0x95')]=db[_0x50bb('0x1')]['import'](_0x50bb('0x96'));db[_0x50bb('0x97')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x50bb('0x98')]=db[_0x50bb('0x1')]['import']('../api/analyticMetric/analyticMetric.model');db[_0x50bb('0x99')]=db[_0x50bb('0x1')]['import'](_0x50bb('0x9a'));db[_0x50bb('0x9b')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x9c'));db['SalesforceAccount']=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x9d'));db[_0x50bb('0x9e')]=db[_0x50bb('0x1')]['import'](_0x50bb('0x9f'));db['SalesforceField']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xa0'));db[_0x50bb('0xa1')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xa2'));db['SugarcrmConfiguration']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xa3'));db[_0x50bb('0xa4')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xa5'));db['DeskAccount']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xa6'));db[_0x50bb('0xa7')]=db[_0x50bb('0x1')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x50bb('0xa8')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xa9'));db['ZohoAccount']=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xaa'));db[_0x50bb('0xab')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xac'));db[_0x50bb('0xad')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xae'));db[_0x50bb('0xaf')]=db['sequelize']['import'](_0x50bb('0xb0'));db[_0x50bb('0xb1')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xb2'));db[_0x50bb('0xb3')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xb4'));db[_0x50bb('0xb5')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xb6'));db[_0x50bb('0xb7')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xb8'));db[_0x50bb('0xb9')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xba'));db[_0x50bb('0xbb')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xbc'));db[_0x50bb('0xbd')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xbe'));db[_0x50bb('0xbf')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xc0'));db[_0x50bb('0xc1')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xc2'));db[_0x50bb('0xc3')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xc4'));db['ServicenowField']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xc5'));db[_0x50bb('0xc6')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xc7'));db[_0x50bb('0xc8')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xc9'));db['Dynamics365Field']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xca'));db[_0x50bb('0xcb')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x50bb('0xcc')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xcd'));db['FreshsalesField']=db['sequelize']['import'](_0x50bb('0xce'));db[_0x50bb('0xcf')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x91'));db[_0x50bb('0xd0')]=db[_0x50bb('0x1')]['import'](_0x50bb('0xd1'));db['ChatQueueReport']=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x50bb('0x1')]['import'](_0x50bb('0xd2'));db[_0x50bb('0xd3')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xd4'));db[_0x50bb('0xd5')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xd6'));db[_0x50bb('0xd7')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xd8'));db[_0x50bb('0xd9')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xda'));db[_0x50bb('0xdb')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xdc'));db[_0x50bb('0xdd')]=db['sequelize'][_0x50bb('0x11')]('../api/jscriptyProject/jscriptyProject.model');db[_0x50bb('0xde')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xdf'));db[_0x50bb('0xe0')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/squareOdbc/squareOdbc.model');db[_0x50bb('0xe1')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xe2'));db[_0x50bb('0xe3')]=db[_0x50bb('0x1')]['import'](_0x50bb('0xe4'));db[_0x50bb('0xe5')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xe6'));db['Team']=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xe7'));db[_0x50bb('0xe8')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xe9'));db[_0x50bb('0xea')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/campaign/campaign.model');db[_0x50bb('0xeb')]=db[_0x50bb('0x1')]['import'](_0x50bb('0xec'));db[_0x50bb('0xed')]=db[_0x50bb('0x1')]['import'](_0x50bb('0xee'));db[_0x50bb('0xef')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0xf0'));db[_0x50bb('0xf1')]=db[_0x50bb('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xf2'));db[_0x50bb('0xf3')]=db[_0x50bb('0x1')]['import'](_0x50bb('0xf4'));db[_0x50bb('0xf5')]=db['sequelize'][_0x50bb('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x50bb('0xf6')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xf7'));db[_0x50bb('0xf8')]=db[_0x50bb('0x1')]['import'](_0x50bb('0xf9'));db[_0x50bb('0xfa')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xfb'));db['UserProfile']=db[_0x50bb('0x1')]['import']('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xfc'));db[_0x50bb('0xfd')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0xfe'));db[_0x50bb('0xff')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x100'));db['WhatsappAccount']=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x101'));db[_0x50bb('0x102')]=db[_0x50bb('0x1')][_0x50bb('0x11')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x50bb('0x103')]=db['sequelize'][_0x50bb('0x11')](_0x50bb('0x104'));db['WhatsappQueueReport']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x105'));db[_0x50bb('0x106')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x107'));db['WhatsappQueue']=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x108'));db[_0x50bb('0x109')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x10a'));db[_0x50bb('0x10b')]=db['sequelize'][_0x50bb('0x11')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x50bb('0x10c')]=db[_0x50bb('0x1')][_0x50bb('0x11')](_0x50bb('0x10d'));db[_0x50bb('0x10e')]=db[_0x50bb('0x1')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0x50bb('0x10')][_0x50bb('0x10f')](db[_0x50bb('0x1d')],{'as':_0x50bb('0x1d'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x111')});db[_0x50bb('0x10')][_0x50bb('0x112')](db[_0x50bb('0x1a')],{'as':'Recordings','foreignKey':'UserId'});db[_0x50bb('0x10')][_0x50bb('0x112')](db[_0x50bb('0x2a')],{'as':_0x50bb('0x113'),'foreignKey':_0x50bb('0x111')});db[_0x50bb('0x10')]['hasMany'](db[_0x50bb('0x16')],{'as':_0x50bb('0x114'),'onDelete':_0x50bb('0x110'),'hooks':!![]});db[_0x50bb('0x10')][_0x50bb('0x112')](db[_0x50bb('0x73')],{'as':'HopperFinals','foreignKey':'UserId'});db[_0x50bb('0x10')][_0x50bb('0x112')](db[_0x50bb('0x75')],{'as':_0x50bb('0x115'),'foreignKey':'UserId'});db[_0x50bb('0x10')]['hasMany'](db[_0x50bb('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x50bb('0x111')});db[_0x50bb('0x10')][_0x50bb('0x112')](db[_0x50bb('0x116')],{'as':_0x50bb('0x117'),'foreignKey':_0x50bb('0x111')});db['User'][_0x50bb('0x112')](db[_0x50bb('0x118')],{'as':_0x50bb('0x119'),'foreignKey':_0x50bb('0x111')});db[_0x50bb('0x10')][_0x50bb('0x112')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'UserId'});db['User'][_0x50bb('0x112')](db[_0x50bb('0x4d')],{'as':'FaxInteractions','foreignKey':_0x50bb('0x111')});db[_0x50bb('0x10')][_0x50bb('0x112')](db[_0x50bb('0x3f')],{'as':'MailInteractions','foreignKey':_0x50bb('0x111')});db[_0x50bb('0x10')][_0x50bb('0x112')](db[_0x50bb('0x102')],{'as':_0x50bb('0x11a'),'foreignKey':_0x50bb('0x111')});db[_0x50bb('0x10')][_0x50bb('0x112')](db[_0x50bb('0xff')],{'as':_0x50bb('0x11b'),'foreignKey':_0x50bb('0x11c')});db[_0x50bb('0x10')]['belongsTo'](db[_0x50bb('0x11d')],{'as':_0x50bb('0x11d'),'foreignKey':_0x50bb('0x11e')});db[_0x50bb('0x10')]['belongsToMany'](db['ChatGroup'],{'as':_0x50bb('0x11f'),'through':_0x50bb('0x120')});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0x6f')],{'as':_0x50bb('0x122'),'through':_0x50bb('0x123')});db[_0x50bb('0x10')][_0x50bb('0x121')](db['CmList'],{'as':_0x50bb('0x124'),'through':_0x50bb('0x125')});db[_0x50bb('0x10')]['belongsToMany'](db['Team'],{'through':_0x50bb('0x126')});db['User'][_0x50bb('0x121')](db[_0x50bb('0x3f')],{'as':_0x50bb('0x127'),'through':_0x50bb('0x128')});db['User'][_0x50bb('0x121')](db['ChatInteraction'],{'as':_0x50bb('0x119'),'through':_0x50bb('0x129')});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0x4d')],{'as':_0x50bb('0x12a'),'through':'user_has_fax_interactions'});db['User'][_0x50bb('0x121')](db[_0x50bb('0x57')],{'as':_0x50bb('0x12b'),'through':'user_has_sms_interactions'});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0x116')],{'as':_0x50bb('0x117'),'through':_0x50bb('0x12c')});db['User'][_0x50bb('0x121')](db[_0x50bb('0x102')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x50bb('0x10')][_0x50bb('0x121')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x50bb('0x2c'),'required':![]});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0xfa')],{'as':_0x50bb('0x12d'),'through':_0x50bb('0x10e'),'required':![]});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0x3d')],{'as':_0x50bb('0x12e'),'through':'UserMailQueue','required':![]});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0x6a')],{'as':_0x50bb('0x12f'),'through':_0x50bb('0x2e'),'required':![],'hooks':!![]});db[_0x50bb('0x10')]['belongsToMany'](db['FaxQueue'],{'as':_0x50bb('0x130'),'through':'UserFaxQueue','required':![]});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0x5a')],{'as':_0x50bb('0x131'),'through':_0x50bb('0x34'),'required':![]});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0x132')],{'as':_0x50bb('0x133'),'through':_0x50bb('0x36'),'required':![]});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0x134')],{'as':_0x50bb('0x135'),'through':_0x50bb('0x136'),'required':![]});db['User']['belongsToMany'](db[_0x50bb('0xf8')],{'through':_0x50bb('0x125')});db[_0x50bb('0x10')][_0x50bb('0x121')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x50bb('0x137')});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0x49')],{'as':_0x50bb('0x138'),'through':_0x50bb('0x139')});db[_0x50bb('0x10')]['belongsToMany'](db['MailAccount'],{'as':'MailAccounts','through':_0x50bb('0x13a')});db[_0x50bb('0x10')][_0x50bb('0x121')](db[_0x50bb('0x5c')],{'as':'OpenchannelAccounts','through':_0x50bb('0x13b')});db[_0x50bb('0x10')][_0x50bb('0x121')](db['SmsAccount'],{'as':_0x50bb('0x13c'),'through':_0x50bb('0x13d')});db[_0x50bb('0x10')][_0x50bb('0x121')](db['WhatsappAccount'],{'as':_0x50bb('0x13e'),'through':_0x50bb('0x13f')});db['User'][_0x50bb('0x121')](db['SquareProject'],{'as':_0x50bb('0x140'),'through':_0x50bb('0x141')});db[_0x50bb('0x13')][_0x50bb('0x112')](db[_0x50bb('0x16')],{'as':_0x50bb('0x142'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x143')});db[_0x50bb('0x144')][_0x50bb('0x112')](db[_0x50bb('0x16')],{'onDelete':'cascade'});db[_0x50bb('0x16')]['hasMany'](db[_0x50bb('0x16')],{'as':_0x50bb('0x145'),'onDelete':_0x50bb('0x110')});db['VoiceMusicOnHold'][_0x50bb('0x121')](db['Sound'],{'as':_0x50bb('0x146'),'through':_0x50bb('0x147')});db[_0x50bb('0x19')][_0x50bb('0x112')](db[_0x50bb('0x2a')],{'as':_0x50bb('0x148'),'foreignKey':_0x50bb('0x149')});db[_0x50bb('0x19')][_0x50bb('0x112')](db[_0x50bb('0x71')],{'as':'Hoppers','foreignKey':_0x50bb('0x149')});db[_0x50bb('0x19')][_0x50bb('0x112')](db[_0x50bb('0x73')],{'as':_0x50bb('0x14a'),'foreignKey':_0x50bb('0x149')});db[_0x50bb('0x19')][_0x50bb('0x112')](db[_0x50bb('0x75')],{'as':_0x50bb('0x14b'),'foreignKey':_0x50bb('0x149')});db[_0x50bb('0x19')]['hasMany'](db[_0x50bb('0x77')],{'as':_0x50bb('0x77'),'foreignKey':_0x50bb('0x149')});db['VoiceQueue'][_0x50bb('0x112')](db[_0x50bb('0x14c')],{'as':'HopperBlacks','foreignKey':_0x50bb('0x149')});db['VoiceQueue'][_0x50bb('0x112')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x50bb('0x149')});db[_0x50bb('0x19')]['belongsTo'](db[_0x50bb('0x26')],{'as':_0x50bb('0x26'),'foreignKey':_0x50bb('0x14d')});db[_0x50bb('0x19')]['belongsTo'](db[_0x50bb('0x26')],{'as':_0x50bb('0x14e'),'foreignKey':_0x50bb('0x14f')});db[_0x50bb('0x19')][_0x50bb('0x150')](db[_0x50bb('0x151')],{'as':_0x50bb('0x151'),'foreignKey':_0x50bb('0x152')});db['VoiceQueue']['belongsTo'](db[_0x50bb('0x84')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x50bb('0x19')][_0x50bb('0x121')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x124'),'through':_0x50bb('0x153')});db[_0x50bb('0x19')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x50bb('0x2c')});db[_0x50bb('0x19')]['belongsToMany'](db[_0x50bb('0x154')],{'as':'Teams','through':_0x50bb('0x10b')});db[_0x50bb('0x19')]['belongsToMany'](db[_0x50bb('0xf8')],{'as':'BlackLists','through':_0x50bb('0x155')});db[_0x50bb('0x1a')]['belongsTo'](db[_0x50bb('0x10')],{'as':_0x50bb('0x10'),'foreignKey':_0x50bb('0x111')});db[_0x50bb('0x1b')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'as':'User','foreignKey':_0x50bb('0x111')});db['VoiceMail'][_0x50bb('0x112')](db[_0x50bb('0x156')],{'as':_0x50bb('0x157'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x158'),'sourceKey':_0x50bb('0x159')});db[_0x50bb('0x156')][_0x50bb('0x150')](db[_0x50bb('0x1d')],{'foreignKey':_0x50bb('0x158'),'targetKey':_0x50bb('0x159')});db['VoiceCallReport'][_0x50bb('0x112')](db[_0x50bb('0x23')],{'as':'QueueCalls','foreignKey':_0x50bb('0x15a'),'constraints':![]});db[_0x50bb('0x20')][_0x50bb('0x112')](db[_0x50bb('0x21')],{'as':_0x50bb('0x15b'),'foreignKey':'uniqueid','constraints':![]});db[_0x50bb('0x20')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'as':_0x50bb('0x10'),'foreignKey':_0x50bb('0x111')});db['VoiceCallReport'][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'as':'Contact','foreignKey':_0x50bb('0x15c')});db[_0x50bb('0x39')][_0x50bb('0x150')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x50bb('0x15d')});db[_0x50bb('0x15e')][_0x50bb('0x150')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x50bb('0x15d')});db[_0x50bb('0x15f')][_0x50bb('0x10f')](db[_0x50bb('0x39')],{'as':'Imap','onDelete':_0x50bb('0x110')});db[_0x50bb('0x15f')][_0x50bb('0x10f')](db[_0x50bb('0x15e')],{'as':_0x50bb('0x160'),'onDelete':_0x50bb('0x110')});db[_0x50bb('0x15f')]['hasMany'](db['Disposition'],{'as':_0x50bb('0x161'),'foreignKey':_0x50bb('0x15d'),'onDelete':_0x50bb('0x110')});db['MailAccount'][_0x50bb('0x112')](db[_0x50bb('0x7d')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x50bb('0x15f')][_0x50bb('0x112')](db[_0x50bb('0x41')],{'as':'Messages','foreignKey':_0x50bb('0x15d')});db['MailAccount'][_0x50bb('0x112')](db[_0x50bb('0x3f')],{'as':_0x50bb('0x162')});db[_0x50bb('0x15f')]['hasMany'](db[_0x50bb('0x43')],{'as':'Applications'});db[_0x50bb('0x15f')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x163'),'foreignKey':_0x50bb('0x164')});db['MailAccount'][_0x50bb('0x150')](db[_0x50bb('0x165')],{'as':_0x50bb('0x165'),'foreignKey':'TemplateId'});db[_0x50bb('0x15f')][_0x50bb('0x150')](db[_0x50bb('0x84')],{'as':_0x50bb('0x166'),'foreignKey':_0x50bb('0x167')});db[_0x50bb('0x15f')][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x168'),'through':_0x50bb('0x13a')});db[_0x50bb('0x3d')]['belongsToMany'](db[_0x50bb('0x10')],{'as':_0x50bb('0x168'),'through':_0x50bb('0x30')});db[_0x50bb('0x3d')][_0x50bb('0x121')](db[_0x50bb('0x154')],{'through':'team_has_mail_queues','as':_0x50bb('0x169')});db[_0x50bb('0x3f')][_0x50bb('0x112')](db['MailMessage'],{'as':_0x50bb('0x157'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x16a')});db['MailInteraction'][_0x50bb('0x150')](db[_0x50bb('0x15f')],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x15d')});db[_0x50bb('0x3f')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'as':_0x50bb('0x16c'),'foreignKey':'ContactId'});db[_0x50bb('0x3f')][_0x50bb('0x150')](db['User'],{'as':_0x50bb('0x16d'),'foreignKey':_0x50bb('0x111')});db[_0x50bb('0x3f')][_0x50bb('0x121')](db[_0x50bb('0x8d')],{'through':_0x50bb('0x16e'),'as':_0x50bb('0x16f')});db['MailInteraction'][_0x50bb('0x121')](db['Tag'],{'through':_0x50bb('0x16e'),'as':_0x50bb('0x170')});db[_0x50bb('0x3f')][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x171'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x50bb('0x41')][_0x50bb('0x112')](db[_0x50bb('0xed')],{'as':_0x50bb('0x172'),'onDelete':'cascade'});db[_0x50bb('0x41')][_0x50bb('0x150')](db['User'],{'as':_0x50bb('0x10')});db[_0x50bb('0x41')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'onDelete':_0x50bb('0x110'),'as':_0x50bb('0x16c')});db[_0x50bb('0x41')]['belongsTo'](db[_0x50bb('0x3f')],{'as':_0x50bb('0x173'),'foreignKey':_0x50bb('0x16a')});db[_0x50bb('0x41')][_0x50bb('0x150')](db['MailAccount'],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x15d')});db[_0x50bb('0x41')][_0x50bb('0x150')](db[_0x50bb('0x61')],{'as':_0x50bb('0x61'),'foreignKey':_0x50bb('0x174')});db[_0x50bb('0x41')][_0x50bb('0x150')](db[_0x50bb('0x68')],{'as':'ChatOfflineMessage','foreignKey':_0x50bb('0x175')});db[_0x50bb('0x43')]['belongsTo'](db['User'],{'onDelete':_0x50bb('0x176')});db['MailApplication'][_0x50bb('0x150')](db['MailQueue'],{'onDelete':_0x50bb('0x176')});db['MailApplication']['belongsTo'](db[_0x50bb('0x15f')],{'onDelete':_0x50bb('0x176')});db['MailApplication'][_0x50bb('0x150')](db[_0x50bb('0x151')],{'onDelete':_0x50bb('0x176'),'foreignKey':_0x50bb('0x152')});db[_0x50bb('0x43')]['belongsTo'](db[_0x50bb('0x8d')],{'onDelete':'restrict','foreignKey':_0x50bb('0x177')});db[_0x50bb('0x44')][_0x50bb('0x150')](db[_0x50bb('0x15f')],{});db[_0x50bb('0x44')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x163'),'foreignKey':_0x50bb('0x164')});db[_0x50bb('0x44')]['belongsTo'](db[_0x50bb('0x6f')],{'as':_0x50bb('0x16c'),'foreignKey':_0x50bb('0x15c')});db['MailQueueReport'][_0x50bb('0x150')](db['MailInteraction'],{});db[_0x50bb('0x44')][_0x50bb('0x150')](db[_0x50bb('0x41')],{});db['MailQueueReport'][_0x50bb('0x150')](db[_0x50bb('0x10')],{});db['MailQueueReport'][_0x50bb('0x150')](db['MailQueue'],{});db[_0x50bb('0x178')][_0x50bb('0x112')](db[_0x50bb('0x47')],{'as':_0x50bb('0x179'),'onDelete':_0x50bb('0x110')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x50bb('0x17a'),'onDelete':_0x50bb('0x110')});db[_0x50bb('0x49')]['hasMany'](db[_0x50bb('0x7d')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x50bb('0x49')][_0x50bb('0x112')](db['FaxInteraction'],{'as':'Interactions'});db[_0x50bb('0x49')][_0x50bb('0x112')](db[_0x50bb('0x4b')],{'as':_0x50bb('0x145')});db[_0x50bb('0x49')][_0x50bb('0x112')](db[_0x50bb('0x16')],{'as':_0x50bb('0x17b'),'onDelete':_0x50bb('0x110')});db[_0x50bb('0x49')]['hasMany'](db[_0x50bb('0x4e')],{'as':_0x50bb('0x157')});db[_0x50bb('0x49')][_0x50bb('0x150')](db[_0x50bb('0x26')],{'as':_0x50bb('0x26')});db[_0x50bb('0x49')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x163'),'foreignKey':_0x50bb('0x164')});db['FaxAccount']['belongsTo'](db[_0x50bb('0x84')],{'as':_0x50bb('0x166'),'foreignKey':_0x50bb('0x167')});db[_0x50bb('0x49')]['belongsToMany'](db[_0x50bb('0x10')],{'as':'Agents','through':_0x50bb('0x139')});db[_0x50bb('0x4b')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'onDelete':_0x50bb('0x176')});db[_0x50bb('0x4b')][_0x50bb('0x150')](db[_0x50bb('0x50')],{'onDelete':_0x50bb('0x176')});db[_0x50bb('0x4b')][_0x50bb('0x150')](db[_0x50bb('0x49')],{'onDelete':'restrict'});db[_0x50bb('0x4b')]['belongsTo'](db['Tag'],{'onDelete':_0x50bb('0x176'),'foreignKey':'TagId'});db['FaxInteraction'][_0x50bb('0x112')](db['FaxMessage'],{'as':'Messages','onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x17c')});db[_0x50bb('0x4d')][_0x50bb('0x150')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x50bb('0x4d')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'as':_0x50bb('0x16c'),'foreignKey':_0x50bb('0x15c')});db[_0x50bb('0x4d')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'as':_0x50bb('0x16d'),'foreignKey':_0x50bb('0x111')});db[_0x50bb('0x4d')][_0x50bb('0x121')](db[_0x50bb('0x8d')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x50bb('0x4d')][_0x50bb('0x121')](db[_0x50bb('0x8d')],{'through':_0x50bb('0x17d'),'as':_0x50bb('0x170')});db[_0x50bb('0x4d')]['belongsToMany'](db[_0x50bb('0x10')],{'as':'Users','through':_0x50bb('0x17e'),'foreignKey':_0x50bb('0x17c')});db[_0x50bb('0x4e')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'onDelete':_0x50bb('0x110'),'as':_0x50bb('0x10')});db[_0x50bb('0x4e')]['belongsTo'](db[_0x50bb('0x4d')],{'as':_0x50bb('0x173'),'foreignKey':_0x50bb('0x17c')});db[_0x50bb('0x4e')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'onDelete':_0x50bb('0x110'),'as':_0x50bb('0x16c')});db[_0x50bb('0x4e')][_0x50bb('0x150')](db[_0x50bb('0xed')],{'as':_0x50bb('0xed'),'foreignKey':'AttachmentId'});db[_0x50bb('0x4e')][_0x50bb('0x150')](db[_0x50bb('0x49')],{'as':_0x50bb('0x16b'),'foreignKey':'FaxAccountId'});db[_0x50bb('0x50')][_0x50bb('0x121')](db['User'],{'as':_0x50bb('0x168'),'through':_0x50bb('0x32')});db['FaxQueue'][_0x50bb('0x121')](db[_0x50bb('0x154')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x50bb('0x52')][_0x50bb('0x150')](db[_0x50bb('0x49')],{});db['FaxQueueReport'][_0x50bb('0x150')](db['CmList'],{'as':_0x50bb('0x163'),'foreignKey':_0x50bb('0x164')});db[_0x50bb('0x52')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'as':_0x50bb('0x16c'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x50bb('0x150')](db['FaxInteraction'],{});db[_0x50bb('0x52')][_0x50bb('0x150')](db[_0x50bb('0x4e')],{});db['FaxQueueReport'][_0x50bb('0x150')](db[_0x50bb('0x10')],{});db[_0x50bb('0x52')][_0x50bb('0x150')](db[_0x50bb('0x50')],{});db[_0x50bb('0x54')][_0x50bb('0x112')](db[_0x50bb('0x7f')],{'as':_0x50bb('0x161'),'foreignKey':_0x50bb('0x17f'),'onDelete':_0x50bb('0x110')});db[_0x50bb('0x54')][_0x50bb('0x112')](db[_0x50bb('0x7d')],{'as':_0x50bb('0x180'),'foreignKey':_0x50bb('0x17f')});db['SmsAccount'][_0x50bb('0x112')](db[_0x50bb('0x59')],{'as':_0x50bb('0x157'),'foreignKey':_0x50bb('0x17f')});db['SmsAccount'][_0x50bb('0x112')](db[_0x50bb('0x57')],{'as':_0x50bb('0x162')});db[_0x50bb('0x54')][_0x50bb('0x112')](db[_0x50bb('0x181')],{'as':'Applications'});db[_0x50bb('0x54')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x50bb('0x54')]['belongsTo'](db['Pause'],{'as':_0x50bb('0x166'),'foreignKey':_0x50bb('0x167')});db[_0x50bb('0x54')][_0x50bb('0x121')](db['User'],{'as':_0x50bb('0x168'),'through':'user_has_sms_accounts'});db[_0x50bb('0x181')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'onDelete':'restrict'});db[_0x50bb('0x181')][_0x50bb('0x150')](db['SmsQueue'],{'onDelete':_0x50bb('0x176')});db[_0x50bb('0x181')][_0x50bb('0x150')](db[_0x50bb('0x54')],{'onDelete':_0x50bb('0x176')});db[_0x50bb('0x181')][_0x50bb('0x150')](db[_0x50bb('0x151')],{'onDelete':_0x50bb('0x176'),'foreignKey':_0x50bb('0x152')});db['SmsApplication'][_0x50bb('0x150')](db[_0x50bb('0x8d')],{'onDelete':_0x50bb('0x176'),'foreignKey':'TagId'});db['SmsInteraction']['hasMany'](db[_0x50bb('0x59')],{'as':_0x50bb('0x157'),'onDelete':'cascade','foreignKey':_0x50bb('0x182')});db['SmsInteraction'][_0x50bb('0x150')](db[_0x50bb('0x54')],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x17f')});db[_0x50bb('0x57')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'as':_0x50bb('0x16c'),'foreignKey':_0x50bb('0x15c')});db['SmsInteraction'][_0x50bb('0x150')](db[_0x50bb('0x10')],{'as':_0x50bb('0x16d'),'foreignKey':_0x50bb('0x111')});db['SmsInteraction'][_0x50bb('0x121')](db[_0x50bb('0x8d')],{'through':'sms_interaction_has_tags','as':_0x50bb('0x16f')});db['SmsInteraction'][_0x50bb('0x121')](db['Tag'],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db['SmsInteraction'][_0x50bb('0x121')](db['User'],{'as':_0x50bb('0x171'),'through':_0x50bb('0x183'),'foreignKey':_0x50bb('0x182')});db[_0x50bb('0x59')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'as':_0x50bb('0x10')});db[_0x50bb('0x59')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'onDelete':_0x50bb('0x110'),'as':'Contact'});db['SmsMessage']['belongsTo'](db['SmsInteraction'],{'onDelete':_0x50bb('0x110'),'as':'Interaction','foreignKey':_0x50bb('0x182')});db[_0x50bb('0x59')][_0x50bb('0x150')](db[_0x50bb('0x54')],{'as':_0x50bb('0x16b'),'foreignKey':'SmsAccountId'});db[_0x50bb('0x5a')]['belongsToMany'](db[_0x50bb('0x10')],{'as':_0x50bb('0x168'),'through':_0x50bb('0x34'),'foreignKey':_0x50bb('0x184')});db[_0x50bb('0x5a')][_0x50bb('0x121')](db['Team'],{'through':_0x50bb('0x185'),'as':_0x50bb('0x169')});db[_0x50bb('0x5c')][_0x50bb('0x112')](db['Disposition'],{'as':_0x50bb('0x161'),'foreignKey':_0x50bb('0x186'),'onDelete':_0x50bb('0x110')});db[_0x50bb('0x5c')][_0x50bb('0x112')](db[_0x50bb('0x7d')],{'as':_0x50bb('0x180'),'foreignKey':_0x50bb('0x186')});db['OpenchannelAccount'][_0x50bb('0x112')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0x50bb('0x5c')]['hasMany'](db[_0x50bb('0x187')],{'as':_0x50bb('0x157'),'foreignKey':_0x50bb('0x186')});db[_0x50bb('0x5c')][_0x50bb('0x112')](db[_0x50bb('0x5e')],{'as':_0x50bb('0x145'),'foreignKey':_0x50bb('0x186')});db[_0x50bb('0x5c')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x163'),'foreignKey':_0x50bb('0x164')});db[_0x50bb('0x5c')]['belongsTo'](db[_0x50bb('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0x50bb('0x167')});db[_0x50bb('0x5c')][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x168'),'through':_0x50bb('0x13b')});db[_0x50bb('0x5e')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'onDelete':'restrict'});db['OpenchannelApplication'][_0x50bb('0x150')](db[_0x50bb('0x132')],{'onDelete':_0x50bb('0x176'),'foreignKey':'OpenchannelQueueId'});db[_0x50bb('0x5e')]['belongsTo'](db[_0x50bb('0x5c')],{'onDelete':_0x50bb('0x176'),'foreignKey':_0x50bb('0x186')});db[_0x50bb('0x5e')]['belongsTo'](db[_0x50bb('0x151')],{'onDelete':_0x50bb('0x176'),'foreignKey':_0x50bb('0x152')});db[_0x50bb('0x5e')]['belongsTo'](db[_0x50bb('0x8d')],{'onDelete':_0x50bb('0x176'),'foreignKey':'TagId'});db[_0x50bb('0x116')][_0x50bb('0x112')](db[_0x50bb('0x187')],{'as':_0x50bb('0x157'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x188')});db['OpenchannelInteraction'][_0x50bb('0x150')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x50bb('0x186')});db[_0x50bb('0x116')]['belongsTo'](db[_0x50bb('0x6f')],{'as':_0x50bb('0x16c'),'foreignKey':'ContactId'});db[_0x50bb('0x116')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'as':_0x50bb('0x16d'),'foreignKey':_0x50bb('0x111')});db['OpenchannelInteraction'][_0x50bb('0x121')](db['Tag'],{'through':_0x50bb('0x189'),'as':'Tags'});db[_0x50bb('0x116')]['belongsToMany'](db['Tag'],{'through':_0x50bb('0x189'),'as':_0x50bb('0x170')});db[_0x50bb('0x116')][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x171'),'through':_0x50bb('0x12c'),'foreignKey':_0x50bb('0x188')});db[_0x50bb('0x187')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'onDelete':_0x50bb('0x110'),'as':_0x50bb('0x10')});db['OpenchannelMessage']['belongsTo'](db[_0x50bb('0x6f')],{'onDelete':_0x50bb('0x110'),'as':_0x50bb('0x16c')});db[_0x50bb('0x187')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x50bb('0x110'),'as':_0x50bb('0x173'),'foreignKey':'OpenchannelInteractionId'});db[_0x50bb('0x187')][_0x50bb('0x150')](db[_0x50bb('0xed')],{'as':_0x50bb('0xed'),'foreignKey':_0x50bb('0x18a')});db['OpenchannelMessage']['belongsTo'](db[_0x50bb('0x5c')],{'as':_0x50bb('0x16b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x50bb('0x18b')});db['OpenchannelQueue'][_0x50bb('0x121')](db['Team'],{'through':_0x50bb('0x18c'),'as':'Teams'});db['ChatWebsite'][_0x50bb('0x112')](db['Disposition'],{'as':_0x50bb('0x161'),'foreignKey':_0x50bb('0x174'),'onDelete':_0x50bb('0x110')});db[_0x50bb('0x61')][_0x50bb('0x112')](db[_0x50bb('0x7d')],{'as':_0x50bb('0x180'),'foreignKey':'ChatWebsiteId'});db[_0x50bb('0x61')][_0x50bb('0x112')](db[_0x50bb('0x6c')],{'as':_0x50bb('0x18d')});db[_0x50bb('0x61')][_0x50bb('0x112')](db['ChatInteraction'],{'as':_0x50bb('0x162')});db[_0x50bb('0x61')]['hasMany'](db[_0x50bb('0x64')],{'as':'Applications'});db[_0x50bb('0x61')]['hasMany'](db[_0x50bb('0x66')],{'as':_0x50bb('0x157')});db[_0x50bb('0x61')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x163'),'foreignKey':_0x50bb('0x164')});db[_0x50bb('0x61')][_0x50bb('0x150')](db[_0x50bb('0x151')],{'as':_0x50bb('0x151'),'foreignKey':'IntervalId'});db[_0x50bb('0x61')][_0x50bb('0x150')](db['MailAccount'],{'as':_0x50bb('0x15f'),'foreignKey':'MailAccountId'});db[_0x50bb('0x61')][_0x50bb('0x150')](db['Pause'],{'as':_0x50bb('0x166'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x50bb('0x61')][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x168'),'through':_0x50bb('0x137')});db[_0x50bb('0x18e')][_0x50bb('0x150')](db[_0x50bb('0x5c')],{});db[_0x50bb('0x18e')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':'List','foreignKey':_0x50bb('0x164')});db[_0x50bb('0x18e')][_0x50bb('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x50bb('0x15c')});db[_0x50bb('0x18e')][_0x50bb('0x150')](db[_0x50bb('0x116')],{});db['OpenchannelQueueReport'][_0x50bb('0x150')](db[_0x50bb('0x187')],{});db[_0x50bb('0x18e')][_0x50bb('0x150')](db['User'],{});db[_0x50bb('0x18e')][_0x50bb('0x150')](db[_0x50bb('0x132')],{});db['ChatApplication'][_0x50bb('0x150')](db['User'],{'as':_0x50bb('0x18f'),'foreignKey':'UserId','onDelete':_0x50bb('0x176')});db[_0x50bb('0x64')][_0x50bb('0x150')](db['ChatQueue'],{'as':_0x50bb('0x190'),'foreignKey':_0x50bb('0x191'),'onDelete':'restrict'});db[_0x50bb('0x64')][_0x50bb('0x150')](db[_0x50bb('0x61')],{'as':_0x50bb('0x192'),'foreignKey':_0x50bb('0x174'),'onDelete':_0x50bb('0x176')});db['ChatApplication'][_0x50bb('0x150')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x50bb('0x177')});db[_0x50bb('0x118')]['hasMany'](db[_0x50bb('0x66')],{'as':_0x50bb('0x157'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x193')});db[_0x50bb('0x118')][_0x50bb('0x150')](db[_0x50bb('0x61')],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x174')});db[_0x50bb('0x118')]['belongsTo'](db[_0x50bb('0x6f')],{'as':_0x50bb('0x16c'),'foreignKey':_0x50bb('0x15c')});db[_0x50bb('0x118')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'as':_0x50bb('0x16d'),'foreignKey':'UserId'});db[_0x50bb('0x118')]['belongsToMany'](db[_0x50bb('0x8d')],{'through':_0x50bb('0x194'),'as':_0x50bb('0x16f')});db[_0x50bb('0x118')][_0x50bb('0x121')](db[_0x50bb('0x8d')],{'through':_0x50bb('0x194'),'as':_0x50bb('0x170')});db[_0x50bb('0x118')][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x171'),'through':_0x50bb('0x129'),'foreignKey':'ChatInteractionId'});db[_0x50bb('0x66')][_0x50bb('0x150')](db['User'],{'onDelete':'cascade','as':_0x50bb('0x10')});db[_0x50bb('0x66')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'onDelete':'cascade','as':_0x50bb('0x16c'),'foreignKey':'ContactId'});db[_0x50bb('0x66')][_0x50bb('0x150')](db[_0x50bb('0x118')],{'onDelete':_0x50bb('0x110'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x50bb('0x66')]['belongsTo'](db['Attachment'],{'as':_0x50bb('0xed'),'foreignKey':_0x50bb('0x18a')});db[_0x50bb('0x66')][_0x50bb('0x150')](db[_0x50bb('0x61')],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x174')});db[_0x50bb('0x68')][_0x50bb('0x112')](db['Attachment'],{'as':_0x50bb('0x172'),'foreignKey':_0x50bb('0x175'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'onDelete':_0x50bb('0x110'),'as':_0x50bb('0x16c'),'foreignKey':_0x50bb('0x15c')});db[_0x50bb('0x68')]['belongsTo'](db['ChatWebsite'],{'as':_0x50bb('0x16b'),'foreignKey':'ChatWebsiteId'});db[_0x50bb('0x6a')][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x168'),'through':_0x50bb('0x2e'),'hooks':!![]});db[_0x50bb('0x6a')][_0x50bb('0x121')](db['Team'],{'through':_0x50bb('0x195'),'as':_0x50bb('0x169')});db[_0x50bb('0x196')][_0x50bb('0x112')](db[_0x50bb('0x197')],{'as':_0x50bb('0x157'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db['ChatGroup'][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x148'),'through':_0x50bb('0x120')});db[_0x50bb('0x6c')]['belongsTo'](db[_0x50bb('0x61')],{'as':_0x50bb('0x192'),'foreignKey':_0x50bb('0x174')});db['CmCompany']['hasMany'](db['CmContact'],{'as':_0x50bb('0x122'),'foreignKey':_0x50bb('0x198')});db[_0x50bb('0x6f')][_0x50bb('0x112')](db['CmHopper'],{'as':_0x50bb('0x199'),'foreignKey':_0x50bb('0x15c')});db['CmContact']['hasMany'](db['CmHopperFinal'],{'as':_0x50bb('0x14a'),'foreignKey':_0x50bb('0x15c')});db[_0x50bb('0x6f')]['hasMany'](db[_0x50bb('0x75')],{'as':_0x50bb('0x14b'),'foreignKey':_0x50bb('0x15c')});db[_0x50bb('0x6f')][_0x50bb('0x112')](db[_0x50bb('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x50bb('0x15c')});db[_0x50bb('0x6f')][_0x50bb('0x112')](db[_0x50bb('0xd7')],{'as':_0x50bb('0x19a'),'foreignKey':_0x50bb('0x15c')});db[_0x50bb('0x6f')][_0x50bb('0x112')](db[_0x50bb('0x116')],{'as':_0x50bb('0x117'),'foreignKey':'ContactId','onDelete':_0x50bb('0x176')});db[_0x50bb('0x6f')]['hasMany'](db[_0x50bb('0x118')],{'as':'ChatInteractions','foreignKey':_0x50bb('0x15c'),'onDelete':_0x50bb('0x176')});db[_0x50bb('0x6f')]['hasMany'](db[_0x50bb('0x57')],{'as':'SmsInteractions','foreignKey':_0x50bb('0x15c'),'onDelete':_0x50bb('0x176')});db[_0x50bb('0x6f')]['hasMany'](db[_0x50bb('0x4d')],{'as':_0x50bb('0x12a'),'foreignKey':_0x50bb('0x15c'),'onDelete':_0x50bb('0x176')});db[_0x50bb('0x6f')][_0x50bb('0x112')](db[_0x50bb('0x3f')],{'as':_0x50bb('0x127'),'foreignKey':_0x50bb('0x15c'),'onDelete':_0x50bb('0x176')});db['CmContact'][_0x50bb('0x150')](db[_0x50bb('0x19b')],{'as':_0x50bb('0x19c'),'foreignKey':_0x50bb('0x198')});db[_0x50bb('0x6f')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x163'),'foreignKey':_0x50bb('0x164'),'onDelete':_0x50bb('0x110')});db['CmContact'][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':'Users','through':_0x50bb('0x123')});db[_0x50bb('0x6f')]['belongsToMany'](db['Tag'],{'as':'Tags','through':'cm_contact_has_tags'});db['CmContact'][_0x50bb('0x121')](db[_0x50bb('0x8d')],{'through':_0x50bb('0x19d'),'as':_0x50bb('0x170')});db[_0x50bb('0x71')]['belongsTo'](db[_0x50bb('0x6f')],{'as':_0x50bb('0x16c'),'foreignKey':_0x50bb('0x15c'),'onDelete':_0x50bb('0x110')});db[_0x50bb('0x71')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':'List','foreignKey':_0x50bb('0x164'),'onDelete':_0x50bb('0x110')});db[_0x50bb('0x71')][_0x50bb('0x150')](db['User'],{'as':_0x50bb('0x18f'),'foreignKey':_0x50bb('0x111')});db[_0x50bb('0x71')][_0x50bb('0x150')](db[_0x50bb('0x19')],{'as':_0x50bb('0x190'),'foreignKey':_0x50bb('0x149'),'onDelete':_0x50bb('0x110')});db[_0x50bb('0x71')][_0x50bb('0x150')](db['Campaign'],{'as':_0x50bb('0xea'),'foreignKey':'CampaignId','onDelete':_0x50bb('0x110')});db[_0x50bb('0x71')]['belongsTo'](db['User'],{'as':_0x50bb('0x16d'),'foreignKey':'OwnerId'});db[_0x50bb('0x14c')][_0x50bb('0x150')](db['CmContact'],{'as':_0x50bb('0x16c'),'foreignKey':_0x50bb('0x15c'),'onDelete':_0x50bb('0x110')});db['CmHopperBlack']['belongsTo'](db[_0x50bb('0xf8')],{'as':'List','foreignKey':_0x50bb('0x164'),'onDelete':'cascade'});db[_0x50bb('0x14c')][_0x50bb('0x150')](db[_0x50bb('0x19')],{'as':_0x50bb('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0x50bb('0x110')});db[_0x50bb('0x14c')][_0x50bb('0x150')](db[_0x50bb('0xea')],{'as':_0x50bb('0xea'),'foreignKey':'CampaignId','onDelete':_0x50bb('0x110')});db[_0x50bb('0x7b')][_0x50bb('0x112')](db[_0x50bb('0x81')],{'as':{'plural':_0x50bb('0x19e'),'singular':_0x50bb('0x19f')},'foreignKey':_0x50bb('0x1a0'),'onDelete':_0x50bb('0x110'),'hooks':!![]});db[_0x50bb('0x7b')][_0x50bb('0x112')](db[_0x50bb('0x81')],{'as':{'plural':_0x50bb('0x1a1'),'singular':_0x50bb('0x1a2')},'foreignKey':_0x50bb('0x1a3'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x50bb('0x112')](db[_0x50bb('0x1a4')],{'as':_0x50bb('0x1a5'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x50bb('0x7f')][_0x50bb('0x112')](db[_0x50bb('0x7f')],{'as':'Dispositions','foreignKey':_0x50bb('0x1a6'),'onDelete':_0x50bb('0x110')});db['Interval'][_0x50bb('0x112')](db['Interval'],{'as':_0x50bb('0x1a7'),'foreignKey':_0x50bb('0x152'),'onDelete':_0x50bb('0x110'),'hooks':!![],'required':![]});db[_0x50bb('0x151')][_0x50bb('0x112')](db[_0x50bb('0x16')],{'as':_0x50bb('0x114'),'foreignKey':_0x50bb('0x152'),'onDelete':_0x50bb('0x176')});db[_0x50bb('0x151')][_0x50bb('0x112')](db[_0x50bb('0x43')],{'as':_0x50bb('0x1a8'),'foreignKey':_0x50bb('0x152')});db[_0x50bb('0x151')][_0x50bb('0x112')](db[_0x50bb('0x64')],{'as':_0x50bb('0x1a9'),'foreignKey':_0x50bb('0x152')});db['Interval'][_0x50bb('0x112')](db[_0x50bb('0x4b')],{'as':_0x50bb('0x1aa'),'foreignKey':'IntervalId'});db['Interval'][_0x50bb('0x112')](db[_0x50bb('0x181')],{'as':_0x50bb('0x1ab'),'foreignKey':_0x50bb('0x152')});db[_0x50bb('0x89')]['belongsTo'](db[_0x50bb('0x15f')],{});db['Schedule'][_0x50bb('0x150')](db[_0x50bb('0x95')],{'foreignKey':_0x50bb('0x1ac')});db['Schedule'][_0x50bb('0x150')](db[_0x50bb('0x93')],{'foreignKey':_0x50bb('0x1ad')});db[_0x50bb('0x8b')][_0x50bb('0x121')](db[_0x50bb('0x18')],{'as':_0x50bb('0x1ae'),'through':_0x50bb('0x147'),'onDelete':'restrict'});db['Tag'][_0x50bb('0x121')](db[_0x50bb('0x6f')],{'through':_0x50bb('0x19d')});db[_0x50bb('0x8d')][_0x50bb('0x121')](db[_0x50bb('0x118')],{'through':_0x50bb('0x194')});db['Tag'][_0x50bb('0x121')](db['MailInteraction'],{'through':_0x50bb('0x16e')});db[_0x50bb('0x8d')]['belongsToMany'](db[_0x50bb('0x57')],{'through':_0x50bb('0x1af')});db['Tag'][_0x50bb('0x121')](db[_0x50bb('0x4d')],{'through':_0x50bb('0x17d')});db[_0x50bb('0x8d')][_0x50bb('0x121')](db[_0x50bb('0x116')],{'through':_0x50bb('0x189')});db[_0x50bb('0x8d')][_0x50bb('0x121')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x50bb('0x1b0')]['hasMany'](db[_0x50bb('0x81')],{'as':{'plural':_0x50bb('0x1b1'),'singular':'AllCondition'},'foreignKey':_0x50bb('0x1b2'),'onDelete':'cascade','hooks':!![]});db[_0x50bb('0x1b0')][_0x50bb('0x112')](db['Condition'],{'as':{'plural':_0x50bb('0x1b3'),'singular':_0x50bb('0x1b4')},'foreignKey':_0x50bb('0x1b5'),'onDelete':_0x50bb('0x110'),'hooks':!![]});db[_0x50bb('0x1b0')]['hasMany'](db[_0x50bb('0x1a4')],{'as':_0x50bb('0x1a5'),'foreignKey':'TriggerId','onDelete':_0x50bb('0x110'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x50bb('0x99')],{'as':_0x50bb('0x1b6'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1ad'),'hooks':!![]});db[_0x50bb('0x95')][_0x50bb('0x112')](db[_0x50bb('0x99')],{'as':_0x50bb('0x1b6'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1ac')});db[_0x50bb('0x98')]['hasMany'](db[_0x50bb('0x99')],{'as':'Fields','onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1b7')});db['AnalyticFieldReport'][_0x50bb('0x150')](db[_0x50bb('0x98')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x50bb('0x112')](db['SalesforceConfiguration'],{'as':_0x50bb('0x1b8'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1b9')});db[_0x50bb('0x9e')][_0x50bb('0x112')](db[_0x50bb('0x1ba')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x50bb('0x9e')][_0x50bb('0x112')](db[_0x50bb('0x1ba')],{'as':_0x50bb('0x1bb'),'onDelete':'cascade','foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0x9e')][_0x50bb('0x112')](db[_0x50bb('0x1ba')],{'as':'Fields','onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1bd')});db[_0x50bb('0x9e')][_0x50bb('0x150')](db['SalesforceAccount'],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x1b9')});db['SalesforceField']['hasMany'](db[_0x50bb('0x1ba')],{'as':'Subject','foreignKey':_0x50bb('0x1be')});db[_0x50bb('0x1ba')][_0x50bb('0x112')](db[_0x50bb('0x1ba')],{'as':'Description','foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x50bb('0x1ba')],{'as':_0x50bb('0x1bf'),'foreignKey':'FieldId'});db[_0x50bb('0x1ba')][_0x50bb('0x150')](db[_0x50bb('0x8f')],{'as':_0x50bb('0x8f'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x50bb('0x112')](db[_0x50bb('0x1c0')],{'as':_0x50bb('0x1b8'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1b9')});db[_0x50bb('0x1c0')]['hasMany'](db[_0x50bb('0xa4')],{'as':_0x50bb('0x1c1'),'onDelete':_0x50bb('0x110'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x50bb('0x112')](db[_0x50bb('0xa4')],{'as':_0x50bb('0x1bb'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0x1c0')]['hasMany'](db['SugarcrmField'],{'as':_0x50bb('0x1b6'),'onDelete':'cascade','foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x50bb('0x150')](db['SugarcrmAccount'],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x1b9')});db[_0x50bb('0xa4')]['hasMany'](db[_0x50bb('0xa4')],{'as':_0x50bb('0x1c2'),'foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xa4')][_0x50bb('0x112')](db['SugarcrmField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x50bb('0xa4')][_0x50bb('0x112')](db[_0x50bb('0xa4')],{'as':_0x50bb('0x1bf'),'foreignKey':'FieldId'});db[_0x50bb('0xa4')][_0x50bb('0x150')](db[_0x50bb('0x8f')],{'as':_0x50bb('0x8f'),'foreignKey':_0x50bb('0x1c3')});db['DeskAccount']['hasMany'](db[_0x50bb('0xa7')],{'as':_0x50bb('0x1b8'),'onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration'][_0x50bb('0x112')](db[_0x50bb('0xa8')],{'as':_0x50bb('0x1c1'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xa7')]['hasMany'](db[_0x50bb('0xa8')],{'as':'Descriptions','onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0xa7')][_0x50bb('0x112')](db[_0x50bb('0xa8')],{'as':'Fields','onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1bd')});db[_0x50bb('0xa7')][_0x50bb('0x150')](db[_0x50bb('0x1c4')],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x1b9')});db['DeskConfiguration'][_0x50bb('0x121')](db[_0x50bb('0x8d')],{'through':_0x50bb('0x1c5')});db[_0x50bb('0xa8')]['hasMany'](db[_0x50bb('0xa8')],{'as':_0x50bb('0x1c2'),'foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xa8')][_0x50bb('0x112')](db['DeskField'],{'as':_0x50bb('0x1c6'),'foreignKey':_0x50bb('0x1bc')});db['DeskField'][_0x50bb('0x112')](db[_0x50bb('0xa8')],{'as':_0x50bb('0x1bf'),'foreignKey':'FieldId'});db[_0x50bb('0xa8')]['belongsTo'](db['Variable'],{'as':_0x50bb('0x8f'),'foreignKey':_0x50bb('0x1c3')});db['ZohoAccount'][_0x50bb('0x112')](db['ZohoConfiguration'],{'as':_0x50bb('0x1b8'),'onDelete':_0x50bb('0x110'),'foreignKey':'AccountId'});db[_0x50bb('0xab')][_0x50bb('0x112')](db['ZohoField'],{'as':_0x50bb('0x1c1'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xab')][_0x50bb('0x112')](db[_0x50bb('0xad')],{'as':'Descriptions','onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0xab')]['hasMany'](db[_0x50bb('0xad')],{'as':_0x50bb('0x1b6'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1bd')});db['ZohoConfiguration'][_0x50bb('0x150')](db[_0x50bb('0x1c7')],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x1b9')});db[_0x50bb('0xad')][_0x50bb('0x112')](db['ZohoField'],{'as':_0x50bb('0x1c2'),'foreignKey':_0x50bb('0x1be')});db['ZohoField'][_0x50bb('0x112')](db[_0x50bb('0xad')],{'as':_0x50bb('0x1c6'),'foreignKey':_0x50bb('0x1bc')});db['ZohoField'][_0x50bb('0x112')](db[_0x50bb('0xad')],{'as':_0x50bb('0x1bf'),'foreignKey':'FieldId'});db[_0x50bb('0xad')][_0x50bb('0x150')](db[_0x50bb('0x8f')],{'as':_0x50bb('0x8f'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0x50bb('0x112')](db[_0x50bb('0xb1')],{'as':_0x50bb('0x1b8'),'onDelete':_0x50bb('0x110'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x50bb('0x112')](db['ZendeskField'],{'as':_0x50bb('0x1c1'),'foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xb1')][_0x50bb('0x112')](db[_0x50bb('0xb3')],{'as':_0x50bb('0x1bb'),'foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0xb1')]['hasMany'](db[_0x50bb('0xb3')],{'as':'Fields','foreignKey':_0x50bb('0x1bd')});db['ZendeskConfiguration'][_0x50bb('0x150')](db[_0x50bb('0xaf')],{'as':'Account','foreignKey':'AccountId'});db[_0x50bb('0xb1')][_0x50bb('0x121')](db['Tag'],{'through':_0x50bb('0x1c8')});db[_0x50bb('0xb3')]['hasMany'](db['ZendeskField'],{'as':_0x50bb('0x1c2'),'foreignKey':'SubjectId'});db[_0x50bb('0xb3')][_0x50bb('0x112')](db[_0x50bb('0xb3')],{'as':_0x50bb('0x1c6'),'foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0xb3')]['hasMany'](db[_0x50bb('0xb3')],{'as':_0x50bb('0x1bf'),'foreignKey':_0x50bb('0x1bd')});db[_0x50bb('0xb3')][_0x50bb('0x150')](db[_0x50bb('0x8f')],{'as':_0x50bb('0x8f'),'foreignKey':_0x50bb('0x1c3')});db[_0x50bb('0xb5')][_0x50bb('0x112')](db[_0x50bb('0xb7')],{'as':_0x50bb('0x1b8'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1b9')});db[_0x50bb('0xb7')][_0x50bb('0x112')](db[_0x50bb('0xb9')],{'as':_0x50bb('0x1c1'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xb7')][_0x50bb('0x112')](db[_0x50bb('0xb9')],{'as':_0x50bb('0x1bb'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1bc')});db['FreshdeskConfiguration'][_0x50bb('0x112')](db[_0x50bb('0xb9')],{'as':_0x50bb('0x1b6'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1bd')});db[_0x50bb('0xb7')]['belongsTo'](db[_0x50bb('0xb5')],{'as':_0x50bb('0x16b'),'foreignKey':'AccountId'});db[_0x50bb('0xb7')]['belongsToMany'](db[_0x50bb('0x8d')],{'through':_0x50bb('0x1c9')});db[_0x50bb('0xb9')][_0x50bb('0x112')](db[_0x50bb('0xb9')],{'as':_0x50bb('0x1c2'),'foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xb9')][_0x50bb('0x112')](db[_0x50bb('0xb9')],{'as':_0x50bb('0x1c6'),'foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0xb9')]['hasMany'](db[_0x50bb('0xb9')],{'as':'Field','foreignKey':_0x50bb('0x1bd')});db[_0x50bb('0xb9')][_0x50bb('0x150')](db[_0x50bb('0x8f')],{'as':_0x50bb('0x8f'),'foreignKey':'VariableId'});db[_0x50bb('0xbb')]['hasMany'](db[_0x50bb('0xbd')],{'as':_0x50bb('0x1b8'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1b9')});db[_0x50bb('0xbd')][_0x50bb('0x112')](db[_0x50bb('0xbf')],{'as':'Subjects','foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xbd')][_0x50bb('0x112')](db[_0x50bb('0xbf')],{'as':_0x50bb('0x1bb'),'foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0xbd')][_0x50bb('0x112')](db[_0x50bb('0xbf')],{'as':_0x50bb('0x1b6'),'foreignKey':'FieldId'});db[_0x50bb('0xbd')][_0x50bb('0x150')](db[_0x50bb('0xbb')],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x1b9')});db[_0x50bb('0xbf')]['hasMany'](db[_0x50bb('0xbf')],{'as':'Subject','foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xbf')][_0x50bb('0x112')](db[_0x50bb('0xbf')],{'as':_0x50bb('0x1c6'),'foreignKey':_0x50bb('0x1bc')});db['VtigerField'][_0x50bb('0x112')](db[_0x50bb('0xbf')],{'as':_0x50bb('0x1bf'),'foreignKey':_0x50bb('0x1bd')});db[_0x50bb('0xbf')][_0x50bb('0x150')](db[_0x50bb('0x8f')],{'as':_0x50bb('0x8f'),'foreignKey':'VariableId'});db[_0x50bb('0xc1')]['hasMany'](db[_0x50bb('0xc3')],{'as':_0x50bb('0x1b8'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1b9')});db['ServicenowConfiguration'][_0x50bb('0x112')](db[_0x50bb('0x1ca')],{'as':_0x50bb('0x1c1'),'foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xc3')][_0x50bb('0x112')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0xc3')][_0x50bb('0x112')](db[_0x50bb('0x1ca')],{'as':_0x50bb('0x1b6'),'foreignKey':_0x50bb('0x1bd')});db[_0x50bb('0xc3')][_0x50bb('0x150')](db[_0x50bb('0xc1')],{'as':_0x50bb('0x16b'),'foreignKey':'AccountId'});db[_0x50bb('0x1ca')][_0x50bb('0x112')](db[_0x50bb('0x1ca')],{'as':_0x50bb('0x1c2'),'foreignKey':_0x50bb('0x1be')});db['ServicenowField'][_0x50bb('0x112')](db[_0x50bb('0x1ca')],{'as':_0x50bb('0x1c6'),'foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0x1ca')]['hasMany'](db['ServicenowField'],{'as':_0x50bb('0x1bf'),'foreignKey':_0x50bb('0x1bd')});db[_0x50bb('0x1ca')][_0x50bb('0x150')](db[_0x50bb('0x8f')],{'as':_0x50bb('0x8f'),'foreignKey':_0x50bb('0x1c3')});db['Dynamics365Account'][_0x50bb('0x112')](db['Dynamics365Configuration'],{'as':_0x50bb('0x1b8'),'onDelete':_0x50bb('0x110'),'foreignKey':'AccountId'});db[_0x50bb('0xc8')][_0x50bb('0x112')](db[_0x50bb('0x1cb')],{'as':_0x50bb('0x1c1'),'onDelete':_0x50bb('0x110'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x50bb('0x112')](db[_0x50bb('0x1cb')],{'as':_0x50bb('0x1bb'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1bc')});db['Dynamics365Configuration']['hasMany'](db[_0x50bb('0x1cb')],{'as':_0x50bb('0x1b6'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x50bb('0xc8')]['belongsTo'](db[_0x50bb('0xc6')],{'as':_0x50bb('0x16b'),'foreignKey':'AccountId'});db[_0x50bb('0x1cb')][_0x50bb('0x112')](db[_0x50bb('0x1cb')],{'as':_0x50bb('0x1c2'),'foreignKey':_0x50bb('0x1be')});db[_0x50bb('0x1cb')][_0x50bb('0x112')](db['Dynamics365Field'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x50bb('0x1cb')]['hasMany'](db[_0x50bb('0x1cb')],{'as':_0x50bb('0x1bf'),'foreignKey':_0x50bb('0x1bd')});db[_0x50bb('0x1cb')][_0x50bb('0x150')](db[_0x50bb('0x8f')],{'as':'Variable','foreignKey':_0x50bb('0x1c3')});db[_0x50bb('0xcb')][_0x50bb('0x112')](db[_0x50bb('0xcc')],{'as':_0x50bb('0x1b8'),'onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1b9')});db[_0x50bb('0xcc')]['hasMany'](db[_0x50bb('0x1cc')],{'as':_0x50bb('0x1c1'),'foreignKey':_0x50bb('0x1be')});db[_0x50bb('0xcc')][_0x50bb('0x112')](db[_0x50bb('0x1cc')],{'as':_0x50bb('0x1bb'),'foreignKey':_0x50bb('0x1bc')});db[_0x50bb('0xcc')][_0x50bb('0x112')](db[_0x50bb('0x1cc')],{'as':_0x50bb('0x1b6'),'foreignKey':_0x50bb('0x1bd')});db[_0x50bb('0xcc')][_0x50bb('0x150')](db[_0x50bb('0xcb')],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x1b9')});db[_0x50bb('0x1cc')][_0x50bb('0x112')](db[_0x50bb('0x1cc')],{'as':'Subject','foreignKey':_0x50bb('0x1be')});db[_0x50bb('0x1cc')][_0x50bb('0x112')](db['FreshsalesField'],{'as':_0x50bb('0x1c6'),'foreignKey':'DescriptionId'});db[_0x50bb('0x1cc')]['hasMany'](db['FreshsalesField'],{'as':'Field','foreignKey':_0x50bb('0x1bd')});db['FreshsalesField'][_0x50bb('0x150')](db[_0x50bb('0x8f')],{'as':'Variable','foreignKey':'VariableId'});db['ChatQueueReport'][_0x50bb('0x150')](db['ChatWebsite'],{});db[_0x50bb('0x1cd')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x163'),'foreignKey':_0x50bb('0x164')});db[_0x50bb('0x1cd')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db['ChatQueueReport'][_0x50bb('0x150')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x50bb('0x150')](db['ChatMessage'],{});db[_0x50bb('0x1cd')]['belongsTo'](db[_0x50bb('0x10')],{});db[_0x50bb('0x1cd')]['belongsTo'](db['ChatQueue'],{});db[_0x50bb('0x197')]['belongsTo'](db[_0x50bb('0x10')],{'onDelete':_0x50bb('0x110'),'foreignKey':'FromId'});db[_0x50bb('0x197')][_0x50bb('0x150')](db['User'],{'onDelete':_0x50bb('0x110'),'foreignKey':'ToId'});db[_0x50bb('0xd7')]['hasMany'](db[_0x50bb('0xd5')],{'foreignKey':_0x50bb('0x1ce'),'onDelete':_0x50bb('0x110')});db[_0x50bb('0xd7')][_0x50bb('0x112')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x50bb('0xd9')][_0x50bb('0x150')](db[_0x50bb('0x54')],{});db[_0x50bb('0xd9')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x163'),'foreignKey':_0x50bb('0x164')});db[_0x50bb('0xd9')][_0x50bb('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x50bb('0x15c')});db[_0x50bb('0xd9')][_0x50bb('0x150')](db['SmsInteraction'],{});db['SmsQueueReport'][_0x50bb('0x150')](db[_0x50bb('0x59')],{});db[_0x50bb('0xd9')]['belongsTo'](db['User'],{});db[_0x50bb('0xd9')][_0x50bb('0x150')](db[_0x50bb('0x5a')],{});db['JscriptyProject'][_0x50bb('0x112')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0x50bb('0xdd')][_0x50bb('0x112')](db[_0x50bb('0xd5')],{'foreignKey':_0x50bb('0x1cf')});db[_0x50bb('0xdd')][_0x50bb('0x112')](db[_0x50bb('0xd3')],{'foreignKey':_0x50bb('0x1cf')});db[_0x50bb('0xe1')][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x171'),'through':_0x50bb('0x141')});db[_0x50bb('0x154')]['belongsToMany'](db[_0x50bb('0x10')],{'as':_0x50bb('0x168'),'through':'user_has_teams'});db[_0x50bb('0x154')][_0x50bb('0x121')](db[_0x50bb('0x19')],{'through':_0x50bb('0x10b'),'as':_0x50bb('0x1d0')});db['Team']['belongsToMany'](db[_0x50bb('0x3d')],{'through':'team_has_mail_queues','as':_0x50bb('0x12e')});db[_0x50bb('0x154')][_0x50bb('0x121')](db[_0x50bb('0x6a')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x50bb('0x154')][_0x50bb('0x121')](db[_0x50bb('0x50')],{'through':_0x50bb('0x1d1'),'as':_0x50bb('0x130')});db[_0x50bb('0x154')][_0x50bb('0x121')](db['SmsQueue'],{'through':_0x50bb('0x185'),'as':_0x50bb('0x131')});db[_0x50bb('0x154')][_0x50bb('0x121')](db[_0x50bb('0x132')],{'through':_0x50bb('0x18c'),'as':'OpenchannelQueues'});db[_0x50bb('0x154')][_0x50bb('0x121')](db[_0x50bb('0x134')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x50bb('0x154')][_0x50bb('0x121')](db[_0x50bb('0xfa')],{'through':_0x50bb('0x10c'),'as':'VoicePrefixes'});db[_0x50bb('0xea')][_0x50bb('0x112')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x50bb('0x1d2')});db[_0x50bb('0xea')]['hasMany'](db[_0x50bb('0x73')],{'as':'HopperFinals','foreignKey':_0x50bb('0x1d2')});db['Campaign'][_0x50bb('0x112')](db[_0x50bb('0x75')],{'as':_0x50bb('0x14b'),'foreignKey':'CampaignId'});db[_0x50bb('0xea')]['hasMany'](db['CmHopperBlack'],{'as':_0x50bb('0x1d3'),'foreignKey':_0x50bb('0x1d2')});db[_0x50bb('0xea')][_0x50bb('0x150')](db['Trunk'],{'as':_0x50bb('0x26'),'foreignKey':'TrunkId'});db['Campaign'][_0x50bb('0x150')](db[_0x50bb('0x26')],{'as':_0x50bb('0x14e'),'foreignKey':_0x50bb('0x14f')});db[_0x50bb('0xea')][_0x50bb('0x150')](db['Interval'],{'as':_0x50bb('0x151'),'foreignKey':_0x50bb('0x152')});db[_0x50bb('0xea')][_0x50bb('0x150')](db[_0x50bb('0xe1')],{'as':_0x50bb('0xe1'),'foreignKey':_0x50bb('0x1d4')});db['Campaign'][_0x50bb('0x121')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x124'),'through':_0x50bb('0x1d5')});db[_0x50bb('0xea')][_0x50bb('0x121')](db[_0x50bb('0xf8')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['Attachment'][_0x50bb('0x150')](db[_0x50bb('0x68')],{'as':_0x50bb('0x68'),'foreignKey':'ChatOfflineMessageId'});db[_0x50bb('0xf1')][_0x50bb('0x150')](db[_0x50bb('0x41')],{});db['MailTransferReport'][_0x50bb('0x150')](db[_0x50bb('0x3f')],{});db[_0x50bb('0xf1')][_0x50bb('0x150')](db['MailAccount'],{'foreignKey':_0x50bb('0x1d6'),'as':_0x50bb('0x1d7')});db['MailTransferReport'][_0x50bb('0x150')](db[_0x50bb('0x10')],{'foreignKey':_0x50bb('0x1d8'),'as':_0x50bb('0x1d9')});db[_0x50bb('0xf1')][_0x50bb('0x150')](db['User'],{'foreignKey':_0x50bb('0x1da'),'as':_0x50bb('0x1db')});db[_0x50bb('0xf1')][_0x50bb('0x150')](db[_0x50bb('0x3d')],{'foreignKey':'ToMailQueueId','as':_0x50bb('0x1dc')});db[_0x50bb('0xf1')][_0x50bb('0x150')](db[_0x50bb('0x15f')],{'foreignKey':'ToMailAccountId','as':_0x50bb('0x1dd')});db[_0x50bb('0x1de')]['belongsTo'](db['ChatMessage'],{});db[_0x50bb('0x1de')][_0x50bb('0x150')](db[_0x50bb('0x118')],{});db[_0x50bb('0x1de')][_0x50bb('0x150')](db[_0x50bb('0x61')],{'foreignKey':_0x50bb('0x1df'),'as':_0x50bb('0x1d7')});db[_0x50bb('0x1de')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'foreignKey':_0x50bb('0x1d8'),'as':'FromAgent'});db[_0x50bb('0x1de')]['belongsTo'](db[_0x50bb('0x10')],{'foreignKey':_0x50bb('0x1da'),'as':_0x50bb('0x1db')});db['ChatTransferReport'][_0x50bb('0x150')](db[_0x50bb('0x6a')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport'][_0x50bb('0x150')](db[_0x50bb('0x61')],{'foreignKey':'ToChatWebsiteId','as':_0x50bb('0x1dd')});db[_0x50bb('0xf3')][_0x50bb('0x150')](db[_0x50bb('0x4e')],{});db[_0x50bb('0xf3')][_0x50bb('0x150')](db[_0x50bb('0x4d')],{});db[_0x50bb('0xf3')][_0x50bb('0x150')](db[_0x50bb('0x49')],{'foreignKey':_0x50bb('0x1e0'),'as':_0x50bb('0x1d7')});db[_0x50bb('0xf3')][_0x50bb('0x150')](db['User'],{'foreignKey':_0x50bb('0x1d8'),'as':_0x50bb('0x1d9')});db[_0x50bb('0xf3')][_0x50bb('0x150')](db['User'],{'foreignKey':_0x50bb('0x1da'),'as':_0x50bb('0x1db')});db[_0x50bb('0xf3')][_0x50bb('0x150')](db[_0x50bb('0x50')],{'foreignKey':_0x50bb('0x1e1'),'as':'ToQueue'});db[_0x50bb('0xf3')]['belongsTo'](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x50bb('0xf5')][_0x50bb('0x150')](db[_0x50bb('0x187')],{});db[_0x50bb('0xf5')][_0x50bb('0x150')](db[_0x50bb('0x116')],{});db['OpenchannelTransferReport'][_0x50bb('0x150')](db[_0x50bb('0x5c')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x50bb('0xf5')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'foreignKey':_0x50bb('0x1d8'),'as':'FromAgent'});db[_0x50bb('0xf5')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'foreignKey':_0x50bb('0x1da'),'as':_0x50bb('0x1db')});db[_0x50bb('0xf5')]['belongsTo'](db[_0x50bb('0x132')],{'foreignKey':_0x50bb('0x1e2'),'as':_0x50bb('0x1dc')});db[_0x50bb('0xf5')][_0x50bb('0x150')](db[_0x50bb('0x5c')],{'foreignKey':_0x50bb('0x1e3'),'as':_0x50bb('0x1dd')});db[_0x50bb('0xf6')][_0x50bb('0x150')](db['SmsMessage'],{});db['SmsTransferReport'][_0x50bb('0x150')](db[_0x50bb('0x57')],{});db[_0x50bb('0xf6')][_0x50bb('0x150')](db[_0x50bb('0x54')],{'foreignKey':_0x50bb('0x1e4'),'as':_0x50bb('0x1d7')});db['SmsTransferReport'][_0x50bb('0x150')](db[_0x50bb('0x10')],{'foreignKey':_0x50bb('0x1d8'),'as':_0x50bb('0x1d9')});db['SmsTransferReport'][_0x50bb('0x150')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x50bb('0xf6')][_0x50bb('0x150')](db[_0x50bb('0x5a')],{'foreignKey':_0x50bb('0x1e5'),'as':_0x50bb('0x1dc')});db[_0x50bb('0xf6')][_0x50bb('0x150')](db[_0x50bb('0x54')],{'foreignKey':'ToSmsAccountId','as':_0x50bb('0x1dd')});db[_0x50bb('0xf8')][_0x50bb('0x112')](db['Disposition'],{'as':_0x50bb('0x161'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x50bb('0xf8')][_0x50bb('0x112')](db['CmCustomField'],{'as':_0x50bb('0x1e6'),'foreignKey':_0x50bb('0x164')});db[_0x50bb('0xf8')][_0x50bb('0x112')](db['CmContact'],{'as':'Contacts','onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x164')});db[_0x50bb('0xf8')][_0x50bb('0x112')](db[_0x50bb('0x73')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x50bb('0xf8')]['hasMany'](db[_0x50bb('0x75')],{'as':_0x50bb('0x115'),'foreignKey':'ListId'});db['CmList'][_0x50bb('0x112')](db['ReportAgentPreview'],{'as':_0x50bb('0x77'),'foreignKey':'ListId'});db[_0x50bb('0xf8')][_0x50bb('0x121')](db[_0x50bb('0x19')],{'as':'Queues','through':_0x50bb('0x153')});db[_0x50bb('0xf8')]['belongsToMany'](db[_0x50bb('0x10')],{'as':_0x50bb('0x168'),'through':_0x50bb('0x125')});db[_0x50bb('0xfa')]['hasMany'](db[_0x50bb('0x16')],{'as':_0x50bb('0x114'),'onDelete':_0x50bb('0x110')});db['VoicePrefix'][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x168'),'through':_0x50bb('0x10e')});db['VoicePrefix'][_0x50bb('0x121')](db[_0x50bb('0x154')],{'through':'TeamVoicePrefix','as':'Teams'});db['UserProfile'][_0x50bb('0x112')](db[_0x50bb('0x10')],{'as':_0x50bb('0x171'),'foreignKey':_0x50bb('0x11e')});db[_0x50bb('0x11d')]['hasMany'](db[_0x50bb('0x1e7')],{'as':_0x50bb('0x1e8'),'foreignKey':_0x50bb('0x11e'),'onDelete':_0x50bb('0x110')});db['UserProfileSection']['hasMany'](db[_0x50bb('0xfd')],{'as':'Resources','foreignKey':_0x50bb('0x1e9'),'onDelete':'cascade'});db[_0x50bb('0x1ea')][_0x50bb('0x112')](db['Disposition'],{'as':_0x50bb('0x161'),'foreignKey':_0x50bb('0x1eb'),'onDelete':_0x50bb('0x110')});db['WhatsappAccount'][_0x50bb('0x112')](db[_0x50bb('0x7d')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0x50bb('0x1ea')][_0x50bb('0x112')](db[_0x50bb('0x103')],{'as':_0x50bb('0x157'),'foreignKey':_0x50bb('0x1eb')});db[_0x50bb('0x1ea')][_0x50bb('0x112')](db['WhatsappInteraction'],{'as':_0x50bb('0x162')});db['WhatsappAccount'][_0x50bb('0x112')](db['WhatsappApplication'],{'as':_0x50bb('0x145')});db[_0x50bb('0x1ea')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':'List','foreignKey':'ListId'});db[_0x50bb('0x1ea')]['belongsTo'](db['Pause'],{'as':_0x50bb('0x166'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x50bb('0x1ea')][_0x50bb('0x121')](db[_0x50bb('0x10')],{'as':_0x50bb('0x168'),'through':'user_has_whatsapp_accounts'});db[_0x50bb('0x1ec')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'onDelete':_0x50bb('0x176')});db[_0x50bb('0x1ec')][_0x50bb('0x150')](db[_0x50bb('0x134')],{'onDelete':_0x50bb('0x176')});db[_0x50bb('0x1ec')][_0x50bb('0x150')](db[_0x50bb('0x1ea')],{'onDelete':_0x50bb('0x176')});db[_0x50bb('0x1ec')][_0x50bb('0x150')](db[_0x50bb('0x151')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['WhatsappApplication']['belongsTo'](db[_0x50bb('0x8d')],{'onDelete':_0x50bb('0x176'),'foreignKey':_0x50bb('0x177')});db['WhatsappInteraction']['hasMany'](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x50bb('0x110'),'foreignKey':_0x50bb('0x1ed')});db[_0x50bb('0x102')]['belongsTo'](db[_0x50bb('0x1ea')],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x1eb')});db[_0x50bb('0x102')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'as':_0x50bb('0x16c'),'foreignKey':_0x50bb('0x15c')});db[_0x50bb('0x102')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'as':'Owner','foreignKey':'UserId'});db[_0x50bb('0x102')][_0x50bb('0x121')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x50bb('0x16f')});db['WhatsappInteraction'][_0x50bb('0x121')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x50bb('0x170')});db[_0x50bb('0x102')]['belongsToMany'](db[_0x50bb('0x10')],{'as':_0x50bb('0x171'),'through':_0x50bb('0x1ee'),'foreignKey':_0x50bb('0x1ed')});db[_0x50bb('0x103')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'as':_0x50bb('0x10')});db['WhatsappMessage'][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'onDelete':'cascade','as':'Contact'});db[_0x50bb('0x103')][_0x50bb('0x150')](db[_0x50bb('0x102')],{'onDelete':_0x50bb('0x110'),'as':_0x50bb('0x173'),'foreignKey':_0x50bb('0x1ed')});db[_0x50bb('0x103')][_0x50bb('0x150')](db['WhatsappAccount'],{'as':_0x50bb('0x16b'),'foreignKey':_0x50bb('0x1eb')});db[_0x50bb('0x1ef')][_0x50bb('0x150')](db['WhatsappAccount'],{});db[_0x50bb('0x1ef')][_0x50bb('0x150')](db[_0x50bb('0xf8')],{'as':_0x50bb('0x163'),'foreignKey':_0x50bb('0x164')});db[_0x50bb('0x1ef')][_0x50bb('0x150')](db[_0x50bb('0x6f')],{'as':_0x50bb('0x16c'),'foreignKey':_0x50bb('0x15c')});db['WhatsappQueueReport'][_0x50bb('0x150')](db[_0x50bb('0x102')],{});db[_0x50bb('0x1ef')][_0x50bb('0x150')](db[_0x50bb('0x134')],{});db[_0x50bb('0x1ef')][_0x50bb('0x150')](db[_0x50bb('0x103')],{});db['WhatsappQueueReport'][_0x50bb('0x150')](db['User'],{});db[_0x50bb('0x106')][_0x50bb('0x150')](db[_0x50bb('0x103')],{});db['WhatsappTransferReport'][_0x50bb('0x150')](db[_0x50bb('0x102')],{});db[_0x50bb('0x106')][_0x50bb('0x150')](db[_0x50bb('0x1ea')],{'foreignKey':_0x50bb('0x1f0'),'as':_0x50bb('0x1d7')});db['WhatsappTransferReport'][_0x50bb('0x150')](db[_0x50bb('0x1ea')],{'foreignKey':'ToWhatsappAccountId','as':_0x50bb('0x1dd')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x50bb('0x1f1'),'as':_0x50bb('0x1dc')});db[_0x50bb('0x106')][_0x50bb('0x150')](db[_0x50bb('0x10')],{'foreignKey':_0x50bb('0x1d8'),'as':_0x50bb('0x1d9')});db[_0x50bb('0x106')][_0x50bb('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x50bb('0x1db')});db[_0x50bb('0x134')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x50bb('0x136'),'foreignKey':'WhatsappQueueId'});db[_0x50bb('0x134')]['belongsToMany'](db[_0x50bb('0x154')],{'through':_0x50bb('0x1f2'),'as':_0x50bb('0x169')});module[_0x50bb('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x96cc=['../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','Applications','Sounds','moh_has_sounds','Hoppers','VoiceQueueId','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','uniqueid','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','MailServerOut','hasOne','Imap','Smtp','Dispositions','Answers','Interactions','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','List','Items','FaxAccountId','FaxApplication','Exntensions','ListId','TagId','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsite','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','Members','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','Automation','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','AnalyticCustomReport','CustomReportId','Mohs','Trigger','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','DefaultReportId','AnalyticMetric','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Field','VariableId','SugarcrmAccount','SugarcrmConfiguration','Subject','Description','DeskField','int_desk_configuration_has_tags','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Field','ChatQueueReport','FromId','ToId','SessionId','ProjectId','SquareProject','user_has_square_projects','WhatsappQueues','HopperHistories','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','ToAccount','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','../config/environment','lodash','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','database','username','options','password','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule'];(function(_0x85087d,_0x5d221f){var _0x38474a=function(_0x4cf251){while(--_0x4cf251){_0x85087d['push'](_0x85087d['shift']());}};_0x38474a(++_0x5d221f);}(_0x96cc,0x16c));var _0xc96c=function(_0x180d16,_0x24813e){_0x180d16=_0x180d16-0x0;var _0x54045e=_0x96cc[_0x180d16];return _0x54045e;};'use strict';var config=require(_0xc96c('0x0'));var Sequelize=require('sequelize');var _=require(_0xc96c('0x1'));var jstz=require('jstz');var timezone=jstz[_0xc96c('0x2')]();config[_0xc96c('0x3')]=_[_0xc96c('0x4')](config[_0xc96c('0x3')],{'database':_0xc96c('0x5'),'username':_0xc96c('0x6'),'password':_0xc96c('0x7'),'options':{'host':_0xc96c('0x8'),'port':0xcea,'dialect':_0xc96c('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xc96c('0xa')](),'define':{'charset':_0xc96c('0xb'),'collate':_0xc96c('0xc')}}});config[_0xc96c('0xd')]=_[_0xc96c('0x4')](config[_0xc96c('0xd')],{'database':_0xc96c('0x5'),'username':'xcall','password':_0xc96c('0x7'),'options':{'host':_0xc96c('0x8'),'port':0xcea,'dialect':_0xc96c('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xc96c('0xa')](),'define':{'charset':'utf8','collate':_0xc96c('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xc96c('0xe')],config[_0xc96c('0x3')][_0xc96c('0xf')],config[_0xc96c('0x3')]['password'],config[_0xc96c('0x3')][_0xc96c('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc96c('0xd')][_0xc96c('0xe')],config['sequelizeHistory'][_0xc96c('0xf')],config[_0xc96c('0xd')][_0xc96c('0x11')],config[_0xc96c('0xd')][_0xc96c('0x10')])};db[_0xc96c('0x12')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x14'));db[_0xc96c('0x15')]=db[_0xc96c('0x3')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0xc96c('0x16')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x17'));db['VoiceExtension']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x18'));db[_0xc96c('0x19')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x1a'));db[_0xc96c('0x1b')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x1c'));db[_0xc96c('0x1d')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x1e'));db[_0xc96c('0x1f')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x20'));db[_0xc96c('0x21')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x22'));db[_0xc96c('0x23')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x24'));db[_0xc96c('0x25')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x26'));db[_0xc96c('0x27')]=db[_0xc96c('0x3')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xc96c('0x28')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x29'));db[_0xc96c('0x2a')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x2b'));db[_0xc96c('0x2c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x2d'));db[_0xc96c('0x2e')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x2f'));db['VoiceTransferReport']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x30'));db['UserVoiceQueueRt']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x31'));db[_0xc96c('0x32')]=db['sequelize']['import'](_0xc96c('0x33'));db[_0xc96c('0x34')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x35'));db[_0xc96c('0x36')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0xc96c('0x37')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x38'));db[_0xc96c('0x39')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x3a'));db[_0xc96c('0x3b')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x3c'));db[_0xc96c('0x3d')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x3e'));db['MailServerIn']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x3f'));db['MailServerOut']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x40'));db[_0xc96c('0x41')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x42'));db[_0xc96c('0x43')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x44'));db[_0xc96c('0x45')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x46'));db[_0xc96c('0x47')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x48'));db[_0xc96c('0x49')]=db[_0xc96c('0x3')]['import']('../api/mailMessage/mailMessage.model');db[_0xc96c('0x4a')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/mailApplication/mailApplication.model');db[_0xc96c('0x4b')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x4c'));db[_0xc96c('0x4d')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x4e'));db[_0xc96c('0x4f')]=db['sequelize']['import'](_0xc96c('0x50'));db[_0xc96c('0x51')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x52'));db[_0xc96c('0x53')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x54'));db['FaxMessage']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x55'));db[_0xc96c('0x56')]=db['sequelize']['import'](_0xc96c('0x57'));db[_0xc96c('0x58')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x59'));db[_0xc96c('0x5a')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x5b'));db[_0xc96c('0x5c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x5d'));db['SmsInteraction']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x5e'));db[_0xc96c('0x5f')]=db['sequelize'][_0xc96c('0x13')]('../api/smsMessage/smsMessage.model');db[_0xc96c('0x60')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x61'));db[_0xc96c('0x62')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x63'));db[_0xc96c('0x64')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db[_0xc96c('0x65')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x66'));db[_0xc96c('0x67')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x68'));db[_0xc96c('0x69')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x6a'));db['ChatWebsite']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x6b'));db[_0xc96c('0x6c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x6d'));db[_0xc96c('0x6e')]=db['sequelize']['import']('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x6f'));db[_0xc96c('0x70')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x71'));db['ChatOfflineMessage']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x72'));db[_0xc96c('0x73')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x74'));db['ChatGroup']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x75'));db[_0xc96c('0x76')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x77'));db[_0xc96c('0x78')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x79'));db[_0xc96c('0x7a')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/cmContact/cmContact.model');db[_0xc96c('0x7b')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x7c'));db[_0xc96c('0x7d')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x7e'));db[_0xc96c('0x7f')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x80'));db[_0xc96c('0x81')]=db['sequelize']['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xc96c('0x82')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x83'));db[_0xc96c('0x84')]=db['sequelize']['import'](_0xc96c('0x85'));db[_0xc96c('0x86')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x87'));db['Automation']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x88'));db[_0xc96c('0x89')]=db['sequelize']['import'](_0xc96c('0x8a'));db[_0xc96c('0x8b')]=db['sequelize'][_0xc96c('0x13')]('../api/disposition/disposition.model');db[_0xc96c('0x8c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x8d'));db[_0xc96c('0x8e')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x8f'));db[_0xc96c('0x90')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x91'));db['Cdr']=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/cdr/cdr.model');db[_0xc96c('0x92')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x93'));db[_0xc96c('0x94')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x95'));db[_0xc96c('0x96')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/sound/sound.model');db[_0xc96c('0x97')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x98'));db['Template']=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/template/template.model');db['Trigger']=db[_0xc96c('0x3')]['import'](_0xc96c('0x99'));db[_0xc96c('0x9a')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x9b'));db[_0xc96c('0x9c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x9d'));db['IntegrationReport']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x9e'));db['AnalyticCustomReport']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x9f'));db[_0xc96c('0xa0')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xa1'));db[_0xc96c('0xa2')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xa3'));db['AnalyticMetric']=db[_0xc96c('0x3')]['import'](_0xc96c('0xa4'));db[_0xc96c('0xa5')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xa6'));db[_0xc96c('0xa7')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xa8'));db['SalesforceAccount']=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xc96c('0xa9')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xaa'));db[_0xc96c('0xab')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xac'));db['SugarcrmAccount']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xad'));db['SugarcrmConfiguration']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xae'));db[_0xc96c('0xaf')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xb0'));db[_0xc96c('0xb1')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xb2'));db[_0xc96c('0xb3')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xb4'));db['DeskField']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xb5'));db[_0xc96c('0xb6')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xb7'));db[_0xc96c('0xb8')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xb9'));db['ZohoField']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xba'));db['ZendeskAccount']=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xc96c('0xbb')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xbc'));db[_0xc96c('0xbd')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0xc96c('0xbe')]=db[_0xc96c('0x3')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xc96c('0xbf')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xc0'));db['FreshdeskField']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xc1'));db['VtigerAccount']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xc2'));db[_0xc96c('0xc3')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xc4'));db[_0xc96c('0xc5')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xc6'));db[_0xc96c('0xc7')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xc8'));db[_0xc96c('0xc9')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xca'));db[_0xc96c('0xcb')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xcc'));db[_0xc96c('0xcd')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xce'));db[_0xc96c('0xcf')]=db['sequelize'][_0xc96c('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db['sequelize']['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xc96c('0xd0')]=db[_0xc96c('0x3')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xc96c('0xd1')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xd2'));db[_0xc96c('0xd3')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xd4'));db[_0xc96c('0x9c')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x9d'));db[_0xc96c('0xd5')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xd6'));db['ChatQueueReport']=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0xc96c('0xd7')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xd8'));db[_0xc96c('0xd9')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xda'));db[_0xc96c('0xdb')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xdc'));db[_0xc96c('0xdd')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xde'));db[_0xc96c('0xdf')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xe0'));db['SquareReport']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xe1'));db[_0xc96c('0xe2')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xe3'));db[_0xc96c('0xe4')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xe5'));db[_0xc96c('0xe6')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xe7'));db['SquareOdbc']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xe8'));db['SquareProject']=db['sequelize']['import'](_0xc96c('0xe9'));db[_0xc96c('0xea')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xeb'));db[_0xc96c('0xec')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xed'));db[_0xc96c('0xee')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xef'));db[_0xc96c('0xf0')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/license/license.model');db[_0xc96c('0xf1')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xf2'));db[_0xc96c('0xf3')]=db[_0xc96c('0x3')]['import']('../api/migration/migration.model');db[_0xc96c('0xf4')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xf5'));db[_0xc96c('0xf6')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xf7'));db[_0xc96c('0xf8')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xf9'));db[_0xc96c('0xfa')]=db[_0xc96c('0x3')]['import'](_0xc96c('0xfb'));db[_0xc96c('0xfc')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0xfd'));db[_0xc96c('0xfe')]=db['sequelize'][_0xc96c('0x13')](_0xc96c('0xff'));db['SmsTransferReport']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x100'));db[_0xc96c('0x101')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x102'));db[_0xc96c('0x103')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x104'));db[_0xc96c('0x105')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/userProfile/userProfile.model');db[_0xc96c('0x106')]=db['sequelize']['import'](_0xc96c('0x107'));db[_0xc96c('0x108')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x109'));db[_0xc96c('0x10a')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x10b'));db[_0xc96c('0x10c')]=db['sequelize']['import']('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db['sequelize'][_0xc96c('0x13')](_0xc96c('0x10d'));db[_0xc96c('0x10e')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x10f'));db['WhatsappMessage']=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x110'));db['WhatsappQueueReport']=db[_0xc96c('0x3')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xc96c('0x111')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x112'));db[_0xc96c('0x113')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x114'));db[_0xc96c('0x115')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x116'));db[_0xc96c('0x117')]=db[_0xc96c('0x3')]['import'](_0xc96c('0x118'));db[_0xc96c('0x119')]=db[_0xc96c('0x3')][_0xc96c('0x13')](_0xc96c('0x11a'));db[_0xc96c('0x11b')]=db[_0xc96c('0x3')][_0xc96c('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xc96c('0x12')]['hasOne'](db[_0xc96c('0x21')],{'as':_0xc96c('0x21'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x11d')});db['User'][_0xc96c('0x11e')](db[_0xc96c('0x1d')],{'as':_0xc96c('0x11f'),'foreignKey':_0xc96c('0x11d')});db['User'][_0xc96c('0x11e')](db[_0xc96c('0x120')],{'as':'VoiceQueuesRt','foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x12')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'as':_0xc96c('0x122'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db['User']['hasMany'](db[_0xc96c('0x7f')],{'as':_0xc96c('0x123'),'foreignKey':_0xc96c('0x11d')});db['User'][_0xc96c('0x11e')](db[_0xc96c('0x81')],{'as':_0xc96c('0x124'),'foreignKey':'UserId'});db[_0xc96c('0x12')][_0xc96c('0x11e')](db[_0xc96c('0x82')],{'as':_0xc96c('0x82'),'foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x12')]['hasMany'](db[_0xc96c('0x65')],{'as':_0xc96c('0x125'),'foreignKey':_0xc96c('0x11d')});db['User']['hasMany'](db[_0xc96c('0x126')],{'as':'ChatInteractions','foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x12')][_0xc96c('0x11e')](db[_0xc96c('0x127')],{'as':_0xc96c('0x128'),'foreignKey':'UserId'});db['User'][_0xc96c('0x11e')](db['FaxInteraction'],{'as':_0xc96c('0x129'),'foreignKey':_0xc96c('0x11d')});db['User']['hasMany'](db[_0xc96c('0x47')],{'as':_0xc96c('0x12a'),'foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x12')][_0xc96c('0x11e')](db[_0xc96c('0x10e')],{'as':_0xc96c('0x12b'),'foreignKey':'UserId'});db[_0xc96c('0x12')][_0xc96c('0x11e')](db['UserNotification'],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0xc96c('0x12')][_0xc96c('0x12c')](db[_0xc96c('0x105')],{'as':_0xc96c('0x105'),'foreignKey':_0xc96c('0x12d')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x12f')],{'as':'Groups','through':_0xc96c('0x130')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['CmContact'],{'as':_0xc96c('0x131'),'through':_0xc96c('0x132')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x101')],{'as':'Lists','through':_0xc96c('0x133')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['Team'],{'through':_0xc96c('0x134')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['MailInteraction'],{'as':_0xc96c('0x12a'),'through':'user_has_mail_interactions'});db['User'][_0xc96c('0x12e')](db['ChatInteraction'],{'as':_0xc96c('0x135'),'through':_0xc96c('0x136')});db['User'][_0xc96c('0x12e')](db[_0xc96c('0x53')],{'as':_0xc96c('0x129'),'through':_0xc96c('0x137')});db[_0xc96c('0x12')]['belongsToMany'](db['SmsInteraction'],{'as':_0xc96c('0x128'),'through':_0xc96c('0x138')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x65')],{'as':'OpenchannelInteractions','through':_0xc96c('0x139')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x10e')],{'as':_0xc96c('0x12b'),'through':_0xc96c('0x13a')});db['User'][_0xc96c('0x12e')](db['VoiceQueue'],{'as':_0xc96c('0x13b'),'through':_0xc96c('0x32'),'required':![]});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x103')],{'as':_0xc96c('0x13c'),'through':_0xc96c('0x11b'),'required':![]});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['MailQueue'],{'as':_0xc96c('0x13d'),'through':_0xc96c('0x36'),'required':![]});db[_0xc96c('0x12')]['belongsToMany'](db[_0xc96c('0x73')],{'as':_0xc96c('0x13e'),'through':_0xc96c('0x34'),'required':![],'hooks':!![]});db['User'][_0xc96c('0x12e')](db[_0xc96c('0x56')],{'as':_0xc96c('0x13f'),'through':_0xc96c('0x37'),'required':![]});db[_0xc96c('0x12')]['belongsToMany'](db[_0xc96c('0x60')],{'as':_0xc96c('0x140'),'through':_0xc96c('0x39'),'required':![]});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x69')],{'as':_0xc96c('0x141'),'through':'UserOpenchannelQueue','required':![]});db[_0xc96c('0x12')]['belongsToMany'](db[_0xc96c('0x113')],{'as':'WhatsappQueues','through':_0xc96c('0x3d'),'required':![]});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x101')],{'through':'cm_user_has_lists'});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['ChatWebsite'],{'as':_0xc96c('0x142'),'through':_0xc96c('0x143')});db['User']['belongsToMany'](db['FaxAccount'],{'as':_0xc96c('0x144'),'through':_0xc96c('0x145')});db['User'][_0xc96c('0x12e')](db[_0xc96c('0x41')],{'as':_0xc96c('0x146'),'through':_0xc96c('0x147')});db[_0xc96c('0x12')]['belongsToMany'](db[_0xc96c('0x62')],{'as':_0xc96c('0x148'),'through':'user_has_openchannel_accounts'});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x5a')],{'as':_0xc96c('0x149'),'through':_0xc96c('0x14a')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db[_0xc96c('0x10c')],{'as':_0xc96c('0x14b'),'through':_0xc96c('0x14c')});db[_0xc96c('0x12')][_0xc96c('0x12e')](db['SquareProject'],{'as':_0xc96c('0x14d'),'through':'user_has_square_projects'});db[_0xc96c('0x15')]['hasMany'](db[_0xc96c('0x121')],{'as':_0xc96c('0x14e'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0xc96c('0x16')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x121')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'as':_0xc96c('0x14f'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x19')][_0xc96c('0x12e')](db[_0xc96c('0x96')],{'as':_0xc96c('0x150'),'through':_0xc96c('0x151')});db[_0xc96c('0x1b')][_0xc96c('0x11e')](db[_0xc96c('0x120')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0xc96c('0x1b')][_0xc96c('0x11e')](db[_0xc96c('0x7b')],{'as':_0xc96c('0x152'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xc96c('0x11e')](db[_0xc96c('0x7f')],{'as':_0xc96c('0x123'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xc96c('0x11e')](db[_0xc96c('0x81')],{'as':'HopperHistories','foreignKey':_0xc96c('0x153')});db[_0xc96c('0x1b')][_0xc96c('0x11e')](db[_0xc96c('0x82')],{'as':_0xc96c('0x82'),'foreignKey':'VoiceQueueId'});db[_0xc96c('0x1b')][_0xc96c('0x11e')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xc96c('0x153')});db[_0xc96c('0x1b')]['hasMany'](db[_0xc96c('0xdd')],{'as':_0xc96c('0x154'),'foreignKey':'VoiceQueueId'});db[_0xc96c('0x1b')]['belongsTo'](db[_0xc96c('0x2e')],{'as':_0xc96c('0x2e'),'foreignKey':_0xc96c('0x155')});db[_0xc96c('0x1b')][_0xc96c('0x12c')](db['Trunk'],{'as':_0xc96c('0x156'),'foreignKey':_0xc96c('0x157')});db[_0xc96c('0x1b')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0xc96c('0x158')});db[_0xc96c('0x1b')][_0xc96c('0x12c')](db[_0xc96c('0x90')],{'as':_0xc96c('0x159'),'foreignKey':_0xc96c('0x15a')});db[_0xc96c('0x1b')][_0xc96c('0x12e')](db[_0xc96c('0x101')],{'as':_0xc96c('0x15b'),'through':_0xc96c('0x15c')});db[_0xc96c('0x1b')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x32')});db['VoiceQueue']['belongsToMany'](db['Team'],{'as':_0xc96c('0x15e'),'through':_0xc96c('0x117')});db[_0xc96c('0x1b')][_0xc96c('0x12e')](db[_0xc96c('0x101')],{'as':'BlackLists','through':_0xc96c('0x15f')});db[_0xc96c('0x1d')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x12'),'foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x1f')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x12'),'foreignKey':'UserId'});db[_0xc96c('0x21')][_0xc96c('0x11e')](db[_0xc96c('0x23')],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':'mailboxuser','sourceKey':_0xc96c('0x161')});db[_0xc96c('0x23')][_0xc96c('0x12c')](db[_0xc96c('0x21')],{'foreignKey':_0xc96c('0x162'),'targetKey':_0xc96c('0x161')});db[_0xc96c('0x25')][_0xc96c('0x11e')](db[_0xc96c('0x2a')],{'as':'QueueCalls','foreignKey':_0xc96c('0x163'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0xc96c('0x28')],{'as':_0xc96c('0x164'),'foreignKey':_0xc96c('0x163'),'constraints':![]});db[_0xc96c('0x25')]['belongsTo'](db[_0xc96c('0x12')],{'as':_0xc96c('0x12'),'foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x25')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x167')]['belongsTo'](db[_0xc96c('0x41')],{'as':_0xc96c('0x41'),'foreignKey':_0xc96c('0x168')});db[_0xc96c('0x169')][_0xc96c('0x12c')](db[_0xc96c('0x41')],{'as':'MailAccount','foreignKey':_0xc96c('0x168')});db[_0xc96c('0x41')][_0xc96c('0x16a')](db[_0xc96c('0x167')],{'as':_0xc96c('0x16b'),'onDelete':_0xc96c('0x11c')});db['MailAccount'][_0xc96c('0x16a')](db[_0xc96c('0x169')],{'as':_0xc96c('0x16c'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x41')][_0xc96c('0x11e')](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':_0xc96c('0x168'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x41')][_0xc96c('0x11e')](db[_0xc96c('0x89')],{'as':_0xc96c('0x16e'),'foreignKey':_0xc96c('0x168')});db[_0xc96c('0x41')][_0xc96c('0x11e')](db['MailMessage'],{'as':_0xc96c('0x160'),'foreignKey':_0xc96c('0x168')});db['MailAccount'][_0xc96c('0x11e')](db[_0xc96c('0x47')],{'as':_0xc96c('0x16f')});db[_0xc96c('0x41')]['hasMany'](db[_0xc96c('0x4a')],{'as':'Applications'});db[_0xc96c('0x41')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xc96c('0x41')][_0xc96c('0x12c')](db[_0xc96c('0x170')],{'as':_0xc96c('0x170'),'foreignKey':_0xc96c('0x171')});db[_0xc96c('0x41')]['belongsTo'](db[_0xc96c('0x90')],{'as':_0xc96c('0x159'),'foreignKey':_0xc96c('0x15a')});db['MailAccount'][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x147')});db[_0xc96c('0x43')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':'Agents','through':_0xc96c('0x36')});db[_0xc96c('0x43')][_0xc96c('0x12e')](db[_0xc96c('0xee')],{'through':_0xc96c('0x172'),'as':'Teams'});db['MailInteraction'][_0xc96c('0x11e')](db['MailMessage'],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x173')});db['MailInteraction'][_0xc96c('0x12c')](db[_0xc96c('0x41')],{'as':_0xc96c('0x174'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':'Contact','foreignKey':_0xc96c('0x166')});db[_0xc96c('0x47')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x175'),'foreignKey':_0xc96c('0x11d')});db['MailInteraction'][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x176'),'as':_0xc96c('0x177')});db[_0xc96c('0x47')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x176'),'as':_0xc96c('0x178')});db[_0xc96c('0x47')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x179'),'through':_0xc96c('0x17a'),'foreignKey':_0xc96c('0x173')});db[_0xc96c('0x49')][_0xc96c('0x11e')](db[_0xc96c('0xf4')],{'as':'Attachments','onDelete':_0xc96c('0x11c')});db[_0xc96c('0x49')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x12')});db['MailMessage'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'onDelete':'cascade','as':'Contact'});db[_0xc96c('0x49')][_0xc96c('0x12c')](db[_0xc96c('0x47')],{'as':_0xc96c('0x17b'),'foreignKey':_0xc96c('0x173')});db['MailMessage']['belongsTo'](db[_0xc96c('0x41')],{'as':'Account','foreignKey':_0xc96c('0x168')});db[_0xc96c('0x49')][_0xc96c('0x12c')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0xc96c('0x17c')});db[_0xc96c('0x49')]['belongsTo'](db[_0xc96c('0x17d')],{'as':_0xc96c('0x17d'),'foreignKey':_0xc96c('0x17e')});db[_0xc96c('0x4a')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'onDelete':'restrict'});db[_0xc96c('0x4a')]['belongsTo'](db[_0xc96c('0x43')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x4a')]['belongsTo'](db[_0xc96c('0x41')],{'onDelete':'restrict'});db['MailApplication'][_0xc96c('0x12c')](db[_0xc96c('0x8e')],{'onDelete':'restrict','foreignKey':_0xc96c('0x158')});db[_0xc96c('0x4a')][_0xc96c('0x12c')](db[_0xc96c('0x97')],{'onDelete':_0xc96c('0x17f'),'foreignKey':'TagId'});db[_0xc96c('0x4b')][_0xc96c('0x12c')](db['MailAccount'],{});db[_0xc96c('0x4b')][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':_0xc96c('0x180'),'foreignKey':'ListId'});db['MailQueueReport'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':'ContactId'});db[_0xc96c('0x4b')][_0xc96c('0x12c')](db[_0xc96c('0x47')],{});db[_0xc96c('0x4b')][_0xc96c('0x12c')](db[_0xc96c('0x49')],{});db[_0xc96c('0x4b')]['belongsTo'](db[_0xc96c('0x12')],{});db[_0xc96c('0x4b')][_0xc96c('0x12c')](db[_0xc96c('0x43')],{});db[_0xc96c('0x4d')][_0xc96c('0x11e')](db['DashboardItem'],{'as':_0xc96c('0x181'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x51')]['hasMany'](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':_0xc96c('0x182'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x51')]['hasMany'](db['CannedAnswer'],{'as':_0xc96c('0x16e'),'foreignKey':_0xc96c('0x182')});db[_0xc96c('0x51')][_0xc96c('0x11e')](db['FaxInteraction'],{'as':_0xc96c('0x16f')});db[_0xc96c('0x51')]['hasMany'](db[_0xc96c('0x183')],{'as':_0xc96c('0x14f')});db[_0xc96c('0x51')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'as':_0xc96c('0x184'),'onDelete':'cascade'});db[_0xc96c('0x51')][_0xc96c('0x11e')](db['FaxMessage'],{'as':_0xc96c('0x160')});db['FaxAccount'][_0xc96c('0x12c')](db[_0xc96c('0x2e')],{'as':'Trunk'});db[_0xc96c('0x51')][_0xc96c('0x12c')](db['CmList'],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db[_0xc96c('0x51')]['belongsTo'](db[_0xc96c('0x90')],{'as':_0xc96c('0x159'),'foreignKey':_0xc96c('0x15a')});db[_0xc96c('0x51')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x145')});db[_0xc96c('0x183')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x183')][_0xc96c('0x12c')](db['FaxQueue'],{'onDelete':_0xc96c('0x17f')});db['FaxApplication']['belongsTo'](db[_0xc96c('0x51')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x183')][_0xc96c('0x12c')](db[_0xc96c('0x97')],{'onDelete':_0xc96c('0x17f'),'foreignKey':_0xc96c('0x186')});db[_0xc96c('0x53')][_0xc96c('0x11e')](db[_0xc96c('0x187')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xc96c('0x188')});db[_0xc96c('0x53')][_0xc96c('0x12c')](db[_0xc96c('0x51')],{'as':_0xc96c('0x174'),'foreignKey':'FaxAccountId'});db[_0xc96c('0x53')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x53')]['belongsTo'](db[_0xc96c('0x12')],{'as':_0xc96c('0x175'),'foreignKey':'UserId'});db[_0xc96c('0x53')][_0xc96c('0x12e')](db['Tag'],{'through':_0xc96c('0x189'),'as':'Tags'});db[_0xc96c('0x53')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x189'),'as':_0xc96c('0x178')});db[_0xc96c('0x53')][_0xc96c('0x12e')](db['User'],{'as':'Users','through':_0xc96c('0x137'),'foreignKey':_0xc96c('0x188')});db[_0xc96c('0x187')]['belongsTo'](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x12')});db[_0xc96c('0x187')]['belongsTo'](db[_0xc96c('0x53')],{'as':_0xc96c('0x17b'),'foreignKey':'FaxInteractionId'});db[_0xc96c('0x187')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x165')});db['FaxMessage']['belongsTo'](db[_0xc96c('0xf4')],{'as':'Attachment','foreignKey':_0xc96c('0x18a')});db['FaxMessage'][_0xc96c('0x12c')](db[_0xc96c('0x51')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x182')});db[_0xc96c('0x56')][_0xc96c('0x12e')](db['User'],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x37')});db[_0xc96c('0x56')][_0xc96c('0x12e')](db['Team'],{'through':_0xc96c('0x18b'),'as':_0xc96c('0x15e')});db['FaxQueueReport'][_0xc96c('0x12c')](db[_0xc96c('0x51')],{});db['FaxQueueReport'][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':'List','foreignKey':_0xc96c('0x185')});db['FaxQueueReport']['belongsTo'](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x58')][_0xc96c('0x12c')](db[_0xc96c('0x53')],{});db[_0xc96c('0x58')]['belongsTo'](db[_0xc96c('0x187')],{});db[_0xc96c('0x58')]['belongsTo'](db[_0xc96c('0x12')],{});db['FaxQueueReport'][_0xc96c('0x12c')](db[_0xc96c('0x56')],{});db[_0xc96c('0x5a')][_0xc96c('0x11e')](db['Disposition'],{'as':_0xc96c('0x16d'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0xc96c('0x5a')]['hasMany'](db[_0xc96c('0x89')],{'as':_0xc96c('0x16e'),'foreignKey':_0xc96c('0x18c')});db[_0xc96c('0x5a')][_0xc96c('0x11e')](db[_0xc96c('0x5f')],{'as':_0xc96c('0x160'),'foreignKey':_0xc96c('0x18c')});db[_0xc96c('0x5a')][_0xc96c('0x11e')](db['SmsInteraction'],{'as':'Interactions'});db[_0xc96c('0x5a')][_0xc96c('0x11e')](db[_0xc96c('0x5c')],{'as':'Applications'});db['SmsAccount']['belongsTo'](db[_0xc96c('0x101')],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db[_0xc96c('0x5a')][_0xc96c('0x12c')](db[_0xc96c('0x90')],{'as':_0xc96c('0x159'),'foreignKey':_0xc96c('0x15a')});db[_0xc96c('0x5a')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x14a')});db[_0xc96c('0x5c')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x5c')][_0xc96c('0x12c')](db[_0xc96c('0x60')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x5c')][_0xc96c('0x12c')](db[_0xc96c('0x5a')],{'onDelete':'restrict'});db[_0xc96c('0x5c')][_0xc96c('0x12c')](db[_0xc96c('0x8e')],{'onDelete':_0xc96c('0x17f'),'foreignKey':'IntervalId'});db[_0xc96c('0x5c')][_0xc96c('0x12c')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xc96c('0x186')});db[_0xc96c('0x127')][_0xc96c('0x11e')](db[_0xc96c('0x5f')],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':'SmsInteractionId'});db[_0xc96c('0x127')][_0xc96c('0x12c')](db[_0xc96c('0x5a')],{'as':'Account','foreignKey':_0xc96c('0x18c')});db['SmsInteraction'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db['SmsInteraction'][_0xc96c('0x12c')](db['User'],{'as':_0xc96c('0x175'),'foreignKey':'UserId'});db[_0xc96c('0x127')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':'sms_interaction_has_tags','as':_0xc96c('0x177')});db[_0xc96c('0x127')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x18d'),'as':'ThroughTags'});db['SmsInteraction']['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x179'),'through':_0xc96c('0x138'),'foreignKey':_0xc96c('0x18e')});db[_0xc96c('0x5f')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x12')});db[_0xc96c('0x5f')][_0xc96c('0x12c')](db['CmContact'],{'onDelete':_0xc96c('0x11c'),'as':'Contact'});db[_0xc96c('0x5f')]['belongsTo'](db[_0xc96c('0x127')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x17b'),'foreignKey':_0xc96c('0x18e')});db[_0xc96c('0x5f')][_0xc96c('0x12c')](db[_0xc96c('0x5a')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x18c')});db[_0xc96c('0x60')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x39'),'foreignKey':_0xc96c('0x18f')});db['SmsQueue'][_0xc96c('0x12e')](db[_0xc96c('0xee')],{'through':_0xc96c('0x190'),'as':_0xc96c('0x15e')});db[_0xc96c('0x62')]['hasMany'](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':'OpenchannelAccountId','onDelete':_0xc96c('0x11c')});db['OpenchannelAccount'][_0xc96c('0x11e')](db[_0xc96c('0x89')],{'as':'Answers','foreignKey':_0xc96c('0x191')});db[_0xc96c('0x62')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xc96c('0x16f'),'foreignKey':'OpenchannelAccountId'});db[_0xc96c('0x62')][_0xc96c('0x11e')](db['OpenchannelMessage'],{'as':_0xc96c('0x160'),'foreignKey':_0xc96c('0x191')});db['OpenchannelAccount'][_0xc96c('0x11e')](db[_0xc96c('0x64')],{'as':_0xc96c('0x14f'),'foreignKey':_0xc96c('0x191')});db['OpenchannelAccount'][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db[_0xc96c('0x62')][_0xc96c('0x12c')](db[_0xc96c('0x90')],{'as':_0xc96c('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc96c('0x62')]['belongsToMany'](db['User'],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x192')});db[_0xc96c('0x64')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x64')][_0xc96c('0x12c')](db[_0xc96c('0x69')],{'onDelete':'restrict','foreignKey':_0xc96c('0x193')});db['OpenchannelApplication'][_0xc96c('0x12c')](db[_0xc96c('0x62')],{'onDelete':_0xc96c('0x17f'),'foreignKey':'OpenchannelAccountId'});db[_0xc96c('0x64')][_0xc96c('0x12c')](db[_0xc96c('0x8e')],{'onDelete':_0xc96c('0x17f'),'foreignKey':_0xc96c('0x158')});db[_0xc96c('0x64')]['belongsTo'](db[_0xc96c('0x97')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xc96c('0x65')][_0xc96c('0x11e')](db['OpenchannelMessage'],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':'OpenchannelInteractionId'});db[_0xc96c('0x65')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x191')});db[_0xc96c('0x65')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db['OpenchannelInteraction'][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x175'),'foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x65')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x194'),'as':'Tags'});db[_0xc96c('0x65')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0xc96c('0x65')][_0xc96c('0x12e')](db['User'],{'as':'Users','through':_0xc96c('0x139'),'foreignKey':_0xc96c('0x195')});db[_0xc96c('0x67')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x12')});db['OpenchannelMessage'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'onDelete':_0xc96c('0x11c'),'as':'Contact'});db[_0xc96c('0x67')]['belongsTo'](db[_0xc96c('0x65')],{'onDelete':_0xc96c('0x11c'),'as':'Interaction','foreignKey':_0xc96c('0x195')});db[_0xc96c('0x67')][_0xc96c('0x12c')](db[_0xc96c('0xf4')],{'as':_0xc96c('0xf4'),'foreignKey':_0xc96c('0x18a')});db[_0xc96c('0x67')][_0xc96c('0x12c')](db[_0xc96c('0x62')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x191')});db[_0xc96c('0x69')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x3b'),'foreignKey':_0xc96c('0x193')});db[_0xc96c('0x69')][_0xc96c('0x12e')](db['Team'],{'through':_0xc96c('0x196'),'as':_0xc96c('0x15e')});db[_0xc96c('0x197')][_0xc96c('0x11e')](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':_0xc96c('0x17c'),'onDelete':_0xc96c('0x11c')});db['ChatWebsite']['hasMany'](db[_0xc96c('0x89')],{'as':'Answers','foreignKey':_0xc96c('0x17c')});db[_0xc96c('0x197')][_0xc96c('0x11e')](db[_0xc96c('0x76')],{'as':_0xc96c('0x198')});db[_0xc96c('0x197')]['hasMany'](db[_0xc96c('0x126')],{'as':_0xc96c('0x16f')});db[_0xc96c('0x197')]['hasMany'](db[_0xc96c('0x6e')],{'as':_0xc96c('0x14f')});db[_0xc96c('0x197')][_0xc96c('0x11e')](db['ChatMessage'],{'as':_0xc96c('0x160')});db[_0xc96c('0x197')][_0xc96c('0x12c')](db['CmList'],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db['ChatWebsite'][_0xc96c('0x12c')](db[_0xc96c('0x8e')],{'as':_0xc96c('0x8e'),'foreignKey':'IntervalId'});db['ChatWebsite']['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xc96c('0x168')});db[_0xc96c('0x197')][_0xc96c('0x12c')](db[_0xc96c('0x90')],{'as':'mandatoryDispositionPause','foreignKey':_0xc96c('0x15a')});db['ChatWebsite'][_0xc96c('0x12e')](db['User'],{'as':_0xc96c('0x15d'),'through':'user_has_chat_websites'});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db['OpenchannelAccount'],{});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':'List','foreignKey':_0xc96c('0x185')});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':'ContactId'});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db['OpenchannelInteraction'],{});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db[_0xc96c('0x67')],{});db[_0xc96c('0x6c')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xc96c('0x69')],{});db[_0xc96c('0x6e')]['belongsTo'](db[_0xc96c('0x12')],{'as':_0xc96c('0x199'),'foreignKey':_0xc96c('0x11d'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x6e')][_0xc96c('0x12c')](db[_0xc96c('0x73')],{'as':_0xc96c('0x19a'),'foreignKey':_0xc96c('0x19b'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x6e')][_0xc96c('0x12c')](db['ChatWebsite'],{'as':_0xc96c('0x19c'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0xc96c('0x6e')][_0xc96c('0x12c')](db['Tag'],{'onDelete':_0xc96c('0x17f'),'foreignKey':_0xc96c('0x186')});db[_0xc96c('0x126')]['hasMany'](db[_0xc96c('0x70')],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x19d')});db['ChatInteraction'][_0xc96c('0x12c')](db[_0xc96c('0x197')],{'as':_0xc96c('0x174'),'foreignKey':'ChatWebsiteId'});db[_0xc96c('0x126')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x126')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':'Owner','foreignKey':_0xc96c('0x11d')});db[_0xc96c('0x126')][_0xc96c('0x12e')](db['Tag'],{'through':_0xc96c('0x19e'),'as':'Tags'});db[_0xc96c('0x126')]['belongsToMany'](db[_0xc96c('0x97')],{'through':'chat_interaction_has_tags','as':_0xc96c('0x178')});db[_0xc96c('0x126')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x179'),'through':_0xc96c('0x136'),'foreignKey':'ChatInteractionId'});db[_0xc96c('0x70')][_0xc96c('0x12c')](db['User'],{'onDelete':_0xc96c('0x11c'),'as':'User'});db['ChatMessage'][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'onDelete':'cascade','as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x70')]['belongsTo'](db[_0xc96c('0x126')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x17b'),'foreignKey':_0xc96c('0x19d')});db[_0xc96c('0x70')]['belongsTo'](db['Attachment'],{'as':_0xc96c('0xf4'),'foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db[_0xc96c('0x197')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x17c')});db[_0xc96c('0x17d')]['hasMany'](db[_0xc96c('0xf4')],{'as':_0xc96c('0x19f'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x17d')][_0xc96c('0x12c')](db[_0xc96c('0x7a')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xc96c('0x166')});db[_0xc96c('0x17d')][_0xc96c('0x12c')](db[_0xc96c('0x197')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x17c')});db[_0xc96c('0x73')][_0xc96c('0x12e')](db['User'],{'as':_0xc96c('0x15d'),'through':'UserChatQueue','hooks':!![]});db[_0xc96c('0x73')][_0xc96c('0x12e')](db['Team'],{'through':_0xc96c('0x1a0'),'as':_0xc96c('0x15e')});db['ChatGroup'][_0xc96c('0x11e')](db[_0xc96c('0xd7')],{'as':_0xc96c('0x160'),'foreignKey':_0xc96c('0x1a1'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x12f')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x1a2'),'through':_0xc96c('0x130')});db[_0xc96c('0x76')][_0xc96c('0x12c')](db[_0xc96c('0x197')],{'as':_0xc96c('0x19c'),'foreignKey':_0xc96c('0x17c')});db[_0xc96c('0x78')]['hasMany'](db[_0xc96c('0x7a')],{'as':_0xc96c('0x131'),'foreignKey':'CompanyId'});db['CmContact'][_0xc96c('0x11e')](db[_0xc96c('0x7b')],{'as':_0xc96c('0x152'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x7a')]['hasMany'](db[_0xc96c('0x7f')],{'as':_0xc96c('0x123'),'foreignKey':'ContactId'});db['CmContact'][_0xc96c('0x11e')](db[_0xc96c('0x81')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0xc96c('0x7a')][_0xc96c('0x11e')](db['ReportAgentPreview'],{'as':_0xc96c('0x82'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x7a')][_0xc96c('0x11e')](db[_0xc96c('0xdd')],{'as':_0xc96c('0x154'),'foreignKey':_0xc96c('0x166')});db['CmContact'][_0xc96c('0x11e')](db['OpenchannelInteraction'],{'as':_0xc96c('0x125'),'foreignKey':_0xc96c('0x166'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x7a')][_0xc96c('0x11e')](db[_0xc96c('0x126')],{'as':_0xc96c('0x135'),'foreignKey':_0xc96c('0x166'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x7a')][_0xc96c('0x11e')](db[_0xc96c('0x127')],{'as':_0xc96c('0x128'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0xc96c('0x11e')](db[_0xc96c('0x53')],{'as':_0xc96c('0x129'),'foreignKey':_0xc96c('0x166'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x7a')]['hasMany'](db[_0xc96c('0x47')],{'as':_0xc96c('0x12a'),'foreignKey':'ContactId','onDelete':_0xc96c('0x17f')});db[_0xc96c('0x7a')][_0xc96c('0x12c')](db['CmCompany'],{'as':'Company','foreignKey':_0xc96c('0x1a3')});db['CmContact'][_0xc96c('0x12c')](db['CmList'],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x7a')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x179'),'through':_0xc96c('0x132')});db[_0xc96c('0x7a')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'as':'Tags','through':_0xc96c('0x1a4')});db[_0xc96c('0x7a')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':'cm_contact_has_tags','as':_0xc96c('0x178')});db[_0xc96c('0x7b')]['belongsTo'](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x7b')]['belongsTo'](db['CmList'],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x7b')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x199'),'foreignKey':'UserId'});db[_0xc96c('0x7b')][_0xc96c('0x12c')](db[_0xc96c('0x1b')],{'as':'Queue','foreignKey':_0xc96c('0x153'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x7b')]['belongsTo'](db[_0xc96c('0xf1')],{'as':'Campaign','foreignKey':_0xc96c('0x1a5'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x7b')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x175'),'foreignKey':_0xc96c('0x1a6')});db[_0xc96c('0x7d')]['belongsTo'](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166'),'onDelete':_0xc96c('0x11c')});db['CmHopperBlack'][_0xc96c('0x12c')](db['CmList'],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185'),'onDelete':_0xc96c('0x11c')});db['CmHopperBlack'][_0xc96c('0x12c')](db[_0xc96c('0x1b')],{'as':_0xc96c('0x19a'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xc96c('0x7d')]['belongsTo'](db[_0xc96c('0xf1')],{'as':_0xc96c('0xf1'),'foreignKey':_0xc96c('0x1a5'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x1a7')]['hasMany'](db[_0xc96c('0x8c')],{'as':{'plural':_0xc96c('0x1a8'),'singular':_0xc96c('0x1a9')},'foreignKey':_0xc96c('0x1aa'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x1a7')][_0xc96c('0x11e')](db[_0xc96c('0x8c')],{'as':{'plural':_0xc96c('0x1ab'),'singular':_0xc96c('0x1ac')},'foreignKey':_0xc96c('0x1ad'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db['Automation'][_0xc96c('0x11e')](db['Action'],{'as':_0xc96c('0x1ae'),'foreignKey':_0xc96c('0x1af'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x8b')][_0xc96c('0x11e')](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xc96c('0x8e')]['hasMany'](db[_0xc96c('0x8e')],{'as':_0xc96c('0x1b0'),'foreignKey':_0xc96c('0x158'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xc96c('0x8e')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'as':_0xc96c('0x122'),'foreignKey':_0xc96c('0x158'),'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x8e')][_0xc96c('0x11e')](db['MailApplication'],{'as':_0xc96c('0x1b1'),'foreignKey':_0xc96c('0x158')});db['Interval'][_0xc96c('0x11e')](db['ChatApplication'],{'as':_0xc96c('0x1b2'),'foreignKey':'IntervalId'});db[_0xc96c('0x8e')]['hasMany'](db['FaxApplication'],{'as':_0xc96c('0x1b3'),'foreignKey':_0xc96c('0x158')});db[_0xc96c('0x8e')][_0xc96c('0x11e')](db[_0xc96c('0x5c')],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule']['belongsTo'](db['MailAccount'],{});db[_0xc96c('0x94')][_0xc96c('0x12c')](db[_0xc96c('0xa0')],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db[_0xc96c('0x1b4')],{'foreignKey':_0xc96c('0x1b5')});db[_0xc96c('0x96')][_0xc96c('0x12e')](db[_0xc96c('0x19')],{'as':_0xc96c('0x1b6'),'through':_0xc96c('0x151'),'onDelete':_0xc96c('0x17f')});db['Tag'][_0xc96c('0x12e')](db[_0xc96c('0x7a')],{'through':_0xc96c('0x1a4')});db[_0xc96c('0x97')][_0xc96c('0x12e')](db[_0xc96c('0x126')],{'through':_0xc96c('0x19e')});db[_0xc96c('0x97')][_0xc96c('0x12e')](db[_0xc96c('0x47')],{'through':_0xc96c('0x176')});db['Tag'][_0xc96c('0x12e')](db[_0xc96c('0x127')],{'through':_0xc96c('0x18d')});db[_0xc96c('0x97')][_0xc96c('0x12e')](db[_0xc96c('0x53')],{'through':_0xc96c('0x189')});db[_0xc96c('0x97')][_0xc96c('0x12e')](db[_0xc96c('0x65')],{'through':_0xc96c('0x194')});db[_0xc96c('0x97')][_0xc96c('0x12e')](db[_0xc96c('0x10e')],{'through':'whatsapp_interaction_has_tags'});db[_0xc96c('0x1b7')][_0xc96c('0x11e')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xc96c('0x1b8')},'foreignKey':_0xc96c('0x1b9'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x1b7')][_0xc96c('0x11e')](db[_0xc96c('0x8c')],{'as':{'plural':_0xc96c('0x1ba'),'singular':_0xc96c('0x1bb')},'foreignKey':_0xc96c('0x1bc'),'onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x1b7')][_0xc96c('0x11e')](db[_0xc96c('0x86')],{'as':_0xc96c('0x1ae'),'foreignKey':'TriggerId','onDelete':_0xc96c('0x11c'),'hooks':!![]});db[_0xc96c('0x1b4')][_0xc96c('0x11e')](db['AnalyticFieldReport'],{'as':_0xc96c('0x1bd'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1b5'),'hooks':!![]});db[_0xc96c('0xa0')][_0xc96c('0x11e')](db['AnalyticFieldReport'],{'as':_0xc96c('0x1bd'),'onDelete':'cascade','foreignKey':_0xc96c('0x1be')});db[_0xc96c('0x1bf')][_0xc96c('0x11e')](db[_0xc96c('0xa5')],{'as':'Fields','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c0')});db['AnalyticFieldReport'][_0xc96c('0x12c')](db[_0xc96c('0x1bf')],{'foreignKey':_0xc96c('0x1c0')});db[_0xc96c('0x1c1')][_0xc96c('0x11e')](db[_0xc96c('0xa9')],{'as':_0xc96c('0x1c2'),'onDelete':'cascade','foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xa9')][_0xc96c('0x11e')](db[_0xc96c('0xab')],{'as':_0xc96c('0x1c4'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xa9')][_0xc96c('0x11e')](db['SalesforceField'],{'as':_0xc96c('0x1c6'),'onDelete':'cascade','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xa9')]['hasMany'](db[_0xc96c('0xab')],{'as':_0xc96c('0x1bd'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xa9')][_0xc96c('0x12c')](db['SalesforceAccount'],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':'Subject','foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xab')][_0xc96c('0x11e')](db[_0xc96c('0xab')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc96c('0xab')][_0xc96c('0x11e')](db[_0xc96c('0xab')],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xab')][_0xc96c('0x12c')](db['Variable'],{'as':'Variable','foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0x1cb')]['hasMany'](db[_0xc96c('0x1cc')],{'as':'Configurations','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0x1cc')]['hasMany'](db[_0xc96c('0xaf')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0x1cc')][_0xc96c('0x11e')](db[_0xc96c('0xaf')],{'as':_0xc96c('0x1c6'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0x1cc')]['hasMany'](db[_0xc96c('0xaf')],{'as':_0xc96c('0x1bd'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0x1cc')]['belongsTo'](db[_0xc96c('0x1cb')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db['SugarcrmField'][_0xc96c('0x11e')](db['SugarcrmField'],{'as':_0xc96c('0x1cd'),'foreignKey':'SubjectId'});db[_0xc96c('0xaf')][_0xc96c('0x11e')](db[_0xc96c('0xaf')],{'as':_0xc96c('0x1ce'),'foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xaf')]['hasMany'](db[_0xc96c('0xaf')],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xaf')][_0xc96c('0x12c')](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xb1')][_0xc96c('0x11e')](db[_0xc96c('0xb3')],{'as':_0xc96c('0x1c2'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xb3')][_0xc96c('0x11e')](db['DeskField'],{'as':_0xc96c('0x1c4'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c5')});db['DeskConfiguration'][_0xc96c('0x11e')](db[_0xc96c('0x1cf')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xc96c('0x1c7')});db['DeskConfiguration']['hasMany'](db[_0xc96c('0x1cf')],{'as':_0xc96c('0x1bd'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xb3')]['belongsTo'](db['DeskAccount'],{'as':_0xc96c('0x174'),'foreignKey':'AccountId'});db[_0xc96c('0xb3')]['belongsToMany'](db['Tag'],{'through':_0xc96c('0x1d0')});db[_0xc96c('0x1cf')][_0xc96c('0x11e')](db[_0xc96c('0x1cf')],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0x1cf')][_0xc96c('0x11e')](db[_0xc96c('0x1cf')],{'as':_0xc96c('0x1ce'),'foreignKey':_0xc96c('0x1c7')});db['DeskField']['hasMany'](db[_0xc96c('0x1cf')],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0x1cf')][_0xc96c('0x12c')](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xb6')][_0xc96c('0x11e')](db[_0xc96c('0xb8')],{'as':_0xc96c('0x1c2'),'onDelete':'cascade','foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xb8')]['hasMany'](db['ZohoField'],{'as':_0xc96c('0x1c4'),'onDelete':_0xc96c('0x11c'),'foreignKey':'SubjectId'});db[_0xc96c('0xb8')][_0xc96c('0x11e')](db[_0xc96c('0x1d1')],{'as':_0xc96c('0x1c6'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xb8')][_0xc96c('0x11e')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xb8')][_0xc96c('0x12c')](db['ZohoAccount'],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0x1d1')]['hasMany'](db['ZohoField'],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db['ZohoField'][_0xc96c('0x11e')](db[_0xc96c('0x1d1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc96c('0x1d1')][_0xc96c('0x11e')](db[_0xc96c('0x1d1')],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0x1d1')]['belongsTo'](db[_0xc96c('0x9a')],{'as':'Variable','foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0x1d2')][_0xc96c('0x11e')](db[_0xc96c('0xbb')],{'as':_0xc96c('0x1c2'),'onDelete':'cascade','foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xbb')][_0xc96c('0x11e')](db[_0xc96c('0xbd')],{'as':_0xc96c('0x1c4'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xbb')][_0xc96c('0x11e')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xbb')][_0xc96c('0x11e')](db[_0xc96c('0xbd')],{'as':'Fields','foreignKey':_0xc96c('0x1c8')});db['ZendeskConfiguration'][_0xc96c('0x12c')](db['ZendeskAccount'],{'as':_0xc96c('0x174'),'foreignKey':'AccountId'});db[_0xc96c('0xbb')][_0xc96c('0x12e')](db['Tag'],{'through':_0xc96c('0x1d3')});db[_0xc96c('0xbd')][_0xc96c('0x11e')](db['ZendeskField'],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xbd')][_0xc96c('0x11e')](db['ZendeskField'],{'as':'Description','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xbd')][_0xc96c('0x11e')](db['ZendeskField'],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db['ZendeskField']['belongsTo'](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xbe')]['hasMany'](db[_0xc96c('0xbf')],{'as':_0xc96c('0x1c2'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xbf')][_0xc96c('0x11e')](db[_0xc96c('0x1d4')],{'as':'Subjects','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xbf')][_0xc96c('0x11e')](db[_0xc96c('0x1d4')],{'as':'Descriptions','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xbf')][_0xc96c('0x11e')](db[_0xc96c('0x1d4')],{'as':_0xc96c('0x1bd'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xbf')][_0xc96c('0x12c')](db[_0xc96c('0xbe')],{'as':_0xc96c('0x174'),'foreignKey':'AccountId'});db[_0xc96c('0xbf')][_0xc96c('0x12e')](db[_0xc96c('0x97')],{'through':_0xc96c('0x1d5')});db['FreshdeskField'][_0xc96c('0x11e')](db[_0xc96c('0x1d4')],{'as':_0xc96c('0x1cd'),'foreignKey':'SubjectId'});db[_0xc96c('0x1d4')]['hasMany'](db[_0xc96c('0x1d4')],{'as':'Description','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0x1d4')]['hasMany'](db['FreshdeskField'],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0x1d4')]['belongsTo'](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db['VtigerAccount'][_0xc96c('0x11e')](db[_0xc96c('0xc3')],{'as':_0xc96c('0x1c2'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xc3')][_0xc96c('0x11e')](db[_0xc96c('0xc5')],{'as':'Subjects','foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xc3')]['hasMany'](db[_0xc96c('0xc5')],{'as':_0xc96c('0x1c6'),'foreignKey':'DescriptionId'});db[_0xc96c('0xc3')]['hasMany'](db[_0xc96c('0xc5')],{'as':_0xc96c('0x1bd'),'foreignKey':'FieldId'});db[_0xc96c('0xc3')][_0xc96c('0x12c')](db[_0xc96c('0x1d6')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db['VtigerField']['hasMany'](db[_0xc96c('0xc5')],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xc5')][_0xc96c('0x11e')](db[_0xc96c('0xc5')],{'as':_0xc96c('0x1ce'),'foreignKey':'DescriptionId'});db[_0xc96c('0xc5')][_0xc96c('0x11e')](db[_0xc96c('0xc5')],{'as':_0xc96c('0x1c9'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xc7')][_0xc96c('0x11e')](db[_0xc96c('0xc9')],{'as':'Configurations','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xc9')][_0xc96c('0x11e')](db[_0xc96c('0xcb')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xc96c('0xc9')]['hasMany'](db[_0xc96c('0xcb')],{'as':'Descriptions','foreignKey':_0xc96c('0x1c7')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0xc96c('0x1bd'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xc9')][_0xc96c('0x12c')](db[_0xc96c('0xc7')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xcb')][_0xc96c('0x11e')](db['ServicenowField'],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xcb')][_0xc96c('0x11e')](db['ServicenowField'],{'as':_0xc96c('0x1ce'),'foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xcb')][_0xc96c('0x11e')](db[_0xc96c('0xcb')],{'as':_0xc96c('0x1c9'),'foreignKey':'FieldId'});db[_0xc96c('0xcb')][_0xc96c('0x12c')](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xcd')][_0xc96c('0x11e')](db[_0xc96c('0xcf')],{'as':_0xc96c('0x1c2'),'onDelete':_0xc96c('0x11c'),'foreignKey':'AccountId'});db[_0xc96c('0xcf')][_0xc96c('0x11e')](db[_0xc96c('0x1d7')],{'as':_0xc96c('0x1c4'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xcf')][_0xc96c('0x11e')](db[_0xc96c('0x1d7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xcf')]['hasMany'](db[_0xc96c('0x1d7')],{'as':'Fields','onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0xcf')][_0xc96c('0x12c')](db[_0xc96c('0xcd')],{'as':_0xc96c('0x174'),'foreignKey':'AccountId'});db[_0xc96c('0x1d7')]['hasMany'](db['Dynamics365Field'],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0x1d7')]['hasMany'](db[_0xc96c('0x1d7')],{'as':'Description','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0x1d7')][_0xc96c('0x11e')](db['Dynamics365Field'],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db[_0xc96c('0x1d7')]['belongsTo'](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0xd0')][_0xc96c('0x11e')](db[_0xc96c('0xd1')],{'as':_0xc96c('0x1c2'),'onDelete':_0xc96c('0x11c'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0xc96c('0x11e')](db[_0xc96c('0xd3')],{'as':_0xc96c('0x1c4'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xd1')]['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xc96c('0x1c7')});db[_0xc96c('0xd1')][_0xc96c('0x11e')](db[_0xc96c('0xd3')],{'as':'Fields','foreignKey':_0xc96c('0x1c8')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1c3')});db[_0xc96c('0xd3')][_0xc96c('0x11e')](db[_0xc96c('0xd3')],{'as':_0xc96c('0x1cd'),'foreignKey':_0xc96c('0x1c5')});db[_0xc96c('0xd3')][_0xc96c('0x11e')](db[_0xc96c('0xd3')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc96c('0xd3')]['hasMany'](db[_0xc96c('0xd3')],{'as':_0xc96c('0x1c9'),'foreignKey':_0xc96c('0x1c8')});db['FreshsalesField'][_0xc96c('0x12c')](db[_0xc96c('0x9a')],{'as':_0xc96c('0x9a'),'foreignKey':_0xc96c('0x1ca')});db[_0xc96c('0x1d8')]['belongsTo'](db[_0xc96c('0x197')],{});db[_0xc96c('0x1d8')][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db[_0xc96c('0x1d8')]['belongsTo'](db[_0xc96c('0x7a')],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x1d8')]['belongsTo'](db[_0xc96c('0x126')],{});db[_0xc96c('0x1d8')]['belongsTo'](db['ChatMessage'],{});db[_0xc96c('0x1d8')]['belongsTo'](db['User'],{});db[_0xc96c('0x1d8')][_0xc96c('0x12c')](db[_0xc96c('0x73')],{});db[_0xc96c('0xd7')]['belongsTo'](db[_0xc96c('0x12')],{'onDelete':'cascade','foreignKey':_0xc96c('0x1d9')});db[_0xc96c('0xd7')][_0xc96c('0x12c')](db['User'],{'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1da')});db[_0xc96c('0xdd')][_0xc96c('0x11e')](db['JscriptyQuestionReport'],{'foreignKey':_0xc96c('0x1db'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0xdd')][_0xc96c('0x11e')](db[_0xc96c('0xd9')],{'foreignKey':_0xc96c('0x1db'),'onDelete':'cascade'});db[_0xc96c('0xdf')][_0xc96c('0x12c')](db[_0xc96c('0x5a')],{});db[_0xc96c('0xdf')][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':_0xc96c('0x180'),'foreignKey':_0xc96c('0x185')});db['SmsQueueReport'][_0xc96c('0x12c')](db['CmContact'],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0xdf')]['belongsTo'](db[_0xc96c('0x127')],{});db[_0xc96c('0xdf')][_0xc96c('0x12c')](db[_0xc96c('0x5f')],{});db[_0xc96c('0xdf')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{});db[_0xc96c('0xdf')]['belongsTo'](db['SmsQueue'],{});db[_0xc96c('0xe4')][_0xc96c('0x11e')](db['JscriptySessionReport'],{'foreignKey':_0xc96c('0x1dc')});db[_0xc96c('0xe4')][_0xc96c('0x11e')](db[_0xc96c('0xdb')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xc96c('0x11e')](db['JscriptyAnswerReport'],{'foreignKey':_0xc96c('0x1dc')});db[_0xc96c('0x1dd')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':'Users','through':_0xc96c('0x1de')});db[_0xc96c('0xee')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x134')});db['Team'][_0xc96c('0x12e')](db[_0xc96c('0x1b')],{'through':_0xc96c('0x117'),'as':'VoiceQueues'});db[_0xc96c('0xee')][_0xc96c('0x12e')](db[_0xc96c('0x43')],{'through':_0xc96c('0x172'),'as':_0xc96c('0x13d')});db[_0xc96c('0xee')]['belongsToMany'](db[_0xc96c('0x73')],{'through':'team_has_chat_queues','as':_0xc96c('0x13e')});db['Team'][_0xc96c('0x12e')](db[_0xc96c('0x56')],{'through':'team_has_fax_queues','as':_0xc96c('0x13f')});db[_0xc96c('0xee')]['belongsToMany'](db[_0xc96c('0x60')],{'through':_0xc96c('0x190'),'as':_0xc96c('0x140')});db[_0xc96c('0xee')]['belongsToMany'](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0xc96c('0x141')});db[_0xc96c('0xee')][_0xc96c('0x12e')](db[_0xc96c('0x113')],{'through':'team_has_whatsapp_queues','as':_0xc96c('0x1df')});db[_0xc96c('0xee')][_0xc96c('0x12e')](db[_0xc96c('0x103')],{'through':_0xc96c('0x119'),'as':_0xc96c('0x13c')});db[_0xc96c('0xf1')][_0xc96c('0x11e')](db[_0xc96c('0x7b')],{'as':'Hoppers','foreignKey':'CampaignId'});db['Campaign'][_0xc96c('0x11e')](db[_0xc96c('0x7f')],{'as':_0xc96c('0x123'),'foreignKey':_0xc96c('0x1a5')});db[_0xc96c('0xf1')][_0xc96c('0x11e')](db['CmHopperHistory'],{'as':_0xc96c('0x1e0'),'foreignKey':'CampaignId'});db[_0xc96c('0xf1')][_0xc96c('0x11e')](db[_0xc96c('0x7d')],{'as':_0xc96c('0x1e1'),'foreignKey':_0xc96c('0x1a5')});db['Campaign'][_0xc96c('0x12c')](db[_0xc96c('0x2e')],{'as':_0xc96c('0x2e'),'foreignKey':_0xc96c('0x155')});db[_0xc96c('0xf1')][_0xc96c('0x12c')](db[_0xc96c('0x2e')],{'as':'TrunkBackup','foreignKey':_0xc96c('0x157')});db[_0xc96c('0xf1')][_0xc96c('0x12c')](db['Interval'],{'as':_0xc96c('0x8e'),'foreignKey':_0xc96c('0x158')});db[_0xc96c('0xf1')][_0xc96c('0x12c')](db[_0xc96c('0x1dd')],{'as':'SquareProject','foreignKey':_0xc96c('0x1e2')});db['Campaign'][_0xc96c('0x12e')](db['CmList'],{'as':'Lists','through':_0xc96c('0x1e3')});db[_0xc96c('0xf1')]['belongsToMany'](db[_0xc96c('0x101')],{'as':_0xc96c('0x1e4'),'through':_0xc96c('0x1e5')});db[_0xc96c('0xf4')][_0xc96c('0x12c')](db[_0xc96c('0x17d')],{'as':_0xc96c('0x17d'),'foreignKey':_0xc96c('0x17e')});db['MailTransferReport']['belongsTo'](db[_0xc96c('0x49')],{});db[_0xc96c('0xf8')][_0xc96c('0x12c')](db[_0xc96c('0x47')],{});db['MailTransferReport'][_0xc96c('0x12c')](db[_0xc96c('0x41')],{'foreignKey':_0xc96c('0x1e6'),'as':_0xc96c('0x1e7')});db[_0xc96c('0xf8')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':'FromUserId','as':_0xc96c('0x1e8')});db[_0xc96c('0xf8')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1e9'),'as':_0xc96c('0x1ea')});db[_0xc96c('0xf8')][_0xc96c('0x12c')](db[_0xc96c('0x43')],{'foreignKey':'ToMailQueueId','as':_0xc96c('0x1eb')});db[_0xc96c('0xf8')][_0xc96c('0x12c')](db[_0xc96c('0x41')],{'foreignKey':_0xc96c('0x1ec'),'as':'ToAccount'});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x70')],{});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x126')],{});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db['ChatWebsite'],{'foreignKey':_0xc96c('0x1ed'),'as':_0xc96c('0x1e7')});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1ee'),'as':_0xc96c('0x1e8')});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1e9'),'as':_0xc96c('0x1ea')});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x73')],{'foreignKey':_0xc96c('0x1ef'),'as':'ToQueue'});db[_0xc96c('0xfa')][_0xc96c('0x12c')](db[_0xc96c('0x197')],{'foreignKey':_0xc96c('0x1f0'),'as':_0xc96c('0x1f1')});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db['FaxMessage'],{});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db[_0xc96c('0x53')],{});db[_0xc96c('0xfc')]['belongsTo'](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0xc96c('0x1e7')});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db['User'],{'foreignKey':'FromUserId','as':_0xc96c('0x1e8')});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1e9'),'as':'ToAgent'});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db[_0xc96c('0x56')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0xc96c('0xfc')][_0xc96c('0x12c')](db[_0xc96c('0x51')],{'foreignKey':_0xc96c('0x1f2'),'as':_0xc96c('0x1f1')});db['OpenchannelTransferReport'][_0xc96c('0x12c')](db[_0xc96c('0x67')],{});db['OpenchannelTransferReport'][_0xc96c('0x12c')](db[_0xc96c('0x65')],{});db[_0xc96c('0xfe')][_0xc96c('0x12c')](db[_0xc96c('0x62')],{'foreignKey':_0xc96c('0x1f3'),'as':'FromAccount'});db[_0xc96c('0xfe')][_0xc96c('0x12c')](db['User'],{'foreignKey':_0xc96c('0x1ee'),'as':_0xc96c('0x1e8')});db['OpenchannelTransferReport'][_0xc96c('0x12c')](db['User'],{'foreignKey':_0xc96c('0x1e9'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0xc96c('0x12c')](db[_0xc96c('0x69')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0xc96c('0xfe')][_0xc96c('0x12c')](db['OpenchannelAccount'],{'foreignKey':_0xc96c('0x1f4'),'as':_0xc96c('0x1f1')});db['SmsTransferReport']['belongsTo'](db[_0xc96c('0x5f')],{});db[_0xc96c('0x1f5')][_0xc96c('0x12c')](db[_0xc96c('0x127')],{});db[_0xc96c('0x1f5')]['belongsTo'](db[_0xc96c('0x5a')],{'foreignKey':_0xc96c('0x1f6'),'as':'FromAccount'});db[_0xc96c('0x1f5')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1ee'),'as':_0xc96c('0x1e8')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xc96c('0x1ea')});db[_0xc96c('0x1f5')][_0xc96c('0x12c')](db[_0xc96c('0x60')],{'foreignKey':'ToSmsQueueId','as':_0xc96c('0x1eb')});db[_0xc96c('0x1f5')][_0xc96c('0x12c')](db[_0xc96c('0x5a')],{'foreignKey':_0xc96c('0x1f7'),'as':_0xc96c('0x1f1')});db['CmList'][_0xc96c('0x11e')](db[_0xc96c('0x8b')],{'as':'Dispositions','foreignKey':_0xc96c('0x185'),'onDelete':_0xc96c('0x11c')});db['CmList'][_0xc96c('0x11e')](db[_0xc96c('0x84')],{'as':'CustomFields','foreignKey':'ListId'});db[_0xc96c('0x101')][_0xc96c('0x11e')](db[_0xc96c('0x7a')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xc96c('0x185')});db[_0xc96c('0x101')][_0xc96c('0x11e')](db[_0xc96c('0x7f')],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList'][_0xc96c('0x11e')](db[_0xc96c('0x81')],{'as':_0xc96c('0x124'),'foreignKey':'ListId'});db[_0xc96c('0x101')][_0xc96c('0x11e')](db[_0xc96c('0x82')],{'as':'ReportAgentPreview','foreignKey':_0xc96c('0x185')});db['CmList'][_0xc96c('0x12e')](db[_0xc96c('0x1b')],{'as':'Queues','through':_0xc96c('0x15c')});db[_0xc96c('0x101')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x133')});db[_0xc96c('0x103')][_0xc96c('0x11e')](db[_0xc96c('0x121')],{'as':_0xc96c('0x122'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x103')]['belongsToMany'](db[_0xc96c('0x12')],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x11b')});db[_0xc96c('0x103')][_0xc96c('0x12e')](db[_0xc96c('0xee')],{'through':_0xc96c('0x119'),'as':_0xc96c('0x15e')});db['UserProfile'][_0xc96c('0x11e')](db[_0xc96c('0x12')],{'as':'Users','foreignKey':_0xc96c('0x12d')});db[_0xc96c('0x105')]['hasMany'](db[_0xc96c('0x106')],{'as':'UserProfileSections','foreignKey':_0xc96c('0x12d'),'onDelete':_0xc96c('0x11c')});db[_0xc96c('0x106')][_0xc96c('0x11e')](db[_0xc96c('0x108')],{'as':'Resources','foreignKey':'sectionId','onDelete':'cascade'});db['WhatsappAccount'][_0xc96c('0x11e')](db[_0xc96c('0x8b')],{'as':_0xc96c('0x16d'),'foreignKey':_0xc96c('0x1f8'),'onDelete':'cascade'});db[_0xc96c('0x10c')]['hasMany'](db[_0xc96c('0x89')],{'as':'Answers','foreignKey':_0xc96c('0x1f8')});db[_0xc96c('0x10c')]['hasMany'](db[_0xc96c('0x1f9')],{'as':_0xc96c('0x160'),'foreignKey':_0xc96c('0x1f8')});db[_0xc96c('0x10c')][_0xc96c('0x11e')](db['WhatsappInteraction'],{'as':_0xc96c('0x16f')});db['WhatsappAccount'][_0xc96c('0x11e')](db[_0xc96c('0x1fa')],{'as':_0xc96c('0x14f')});db[_0xc96c('0x10c')][_0xc96c('0x12c')](db[_0xc96c('0x101')],{'as':'List','foreignKey':_0xc96c('0x185')});db[_0xc96c('0x10c')]['belongsTo'](db[_0xc96c('0x90')],{'as':'mandatoryDispositionPause','foreignKey':_0xc96c('0x15a')});db[_0xc96c('0x10c')][_0xc96c('0x12e')](db['User'],{'as':_0xc96c('0x15d'),'through':_0xc96c('0x14c')});db[_0xc96c('0x1fa')]['belongsTo'](db[_0xc96c('0x12')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x1fa')][_0xc96c('0x12c')](db[_0xc96c('0x113')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x1fa')][_0xc96c('0x12c')](db[_0xc96c('0x10c')],{'onDelete':_0xc96c('0x17f')});db[_0xc96c('0x1fa')]['belongsTo'](db[_0xc96c('0x8e')],{'onDelete':_0xc96c('0x17f'),'foreignKey':_0xc96c('0x158')});db[_0xc96c('0x1fa')]['belongsTo'](db[_0xc96c('0x97')],{'onDelete':_0xc96c('0x17f'),'foreignKey':_0xc96c('0x186')});db[_0xc96c('0x10e')][_0xc96c('0x11e')](db['WhatsappMessage'],{'as':_0xc96c('0x160'),'onDelete':_0xc96c('0x11c'),'foreignKey':_0xc96c('0x1fb')});db[_0xc96c('0x10e')][_0xc96c('0x12c')](db[_0xc96c('0x10c')],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1f8')});db[_0xc96c('0x10e')][_0xc96c('0x12c')](db['CmContact'],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x10e')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'as':_0xc96c('0x175'),'foreignKey':_0xc96c('0x11d')});db['WhatsappInteraction'][_0xc96c('0x12e')](db['Tag'],{'through':_0xc96c('0x1fc'),'as':'Tags'});db[_0xc96c('0x10e')]['belongsToMany'](db[_0xc96c('0x97')],{'through':_0xc96c('0x1fc'),'as':_0xc96c('0x178')});db[_0xc96c('0x10e')][_0xc96c('0x12e')](db[_0xc96c('0x12')],{'as':_0xc96c('0x179'),'through':_0xc96c('0x13a'),'foreignKey':_0xc96c('0x1fb')});db['WhatsappMessage'][_0xc96c('0x12c')](db['User'],{'as':_0xc96c('0x12')});db[_0xc96c('0x1f9')]['belongsTo'](db[_0xc96c('0x7a')],{'onDelete':_0xc96c('0x11c'),'as':_0xc96c('0x165')});db[_0xc96c('0x1f9')][_0xc96c('0x12c')](db[_0xc96c('0x10e')],{'onDelete':'cascade','as':_0xc96c('0x17b'),'foreignKey':_0xc96c('0x1fb')});db[_0xc96c('0x1f9')]['belongsTo'](db['WhatsappAccount'],{'as':_0xc96c('0x174'),'foreignKey':_0xc96c('0x1f8')});db['WhatsappQueueReport'][_0xc96c('0x12c')](db['WhatsappAccount'],{});db[_0xc96c('0x1fd')]['belongsTo'](db[_0xc96c('0x101')],{'as':'List','foreignKey':'ListId'});db[_0xc96c('0x1fd')][_0xc96c('0x12c')](db['CmContact'],{'as':_0xc96c('0x165'),'foreignKey':_0xc96c('0x166')});db[_0xc96c('0x1fd')]['belongsTo'](db[_0xc96c('0x10e')],{});db[_0xc96c('0x1fd')]['belongsTo'](db[_0xc96c('0x113')],{});db[_0xc96c('0x1fd')][_0xc96c('0x12c')](db[_0xc96c('0x1f9')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xc96c('0x12')],{});db[_0xc96c('0x111')]['belongsTo'](db['WhatsappMessage'],{});db[_0xc96c('0x111')][_0xc96c('0x12c')](db[_0xc96c('0x10e')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xc96c('0x10c')],{'foreignKey':'FromWhatsappAccountId','as':_0xc96c('0x1e7')});db[_0xc96c('0x111')][_0xc96c('0x12c')](db[_0xc96c('0x10c')],{'foreignKey':_0xc96c('0x1fe'),'as':_0xc96c('0x1f1')});db[_0xc96c('0x111')][_0xc96c('0x12c')](db['WhatsappQueue'],{'foreignKey':_0xc96c('0x1ff'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1ee'),'as':'FromAgent'});db[_0xc96c('0x111')][_0xc96c('0x12c')](db[_0xc96c('0x12')],{'foreignKey':_0xc96c('0x1e9'),'as':'ToAgent'});db[_0xc96c('0x113')][_0xc96c('0x12e')](db['User'],{'as':_0xc96c('0x15d'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0xc96c('0x12e')](db[_0xc96c('0xee')],{'through':_0xc96c('0x200'),'as':_0xc96c('0x15e')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index aa9ca2f..3ea9841 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd4b=['./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','./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/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','./api/system','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','username','password','apiKey','firstName','lastName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','clientEmail','privateKey','key','pass','accountSid','localstationid','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','includes','lodash','path','express','./errors','./config/environment','./config/logger','auth','default','use','logger','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','responseTime','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/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/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfd4b,0xd1));var _0xbfd4=function(_0x12ac2d,_0x2be2ba){_0x12ac2d=_0x12ac2d-0x0;var _0x32d686=_0xfd4b[_0x12ac2d];return _0x32d686;};'use strict';var _=require(_0xbfd4('0x0'));var path=require(_0xbfd4('0x1'));var express=require(_0xbfd4('0x2'));var ewinston=require('express-winston');var util=require('util');var errors=require(_0xbfd4('0x3'));var config=require(_0xbfd4('0x4'));var logger=require(_0xbfd4('0x5'))('api');var authLogger=require(_0xbfd4('0x5'))(_0xbfd4('0x6'));exports[_0xbfd4('0x7')]=function(_0x1de345){_0x1de345[_0xbfd4('0x8')](ewinston[_0xbfd4('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1f077a,_0x63bcfd){var _0x587587='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xbfd4('0xa')](_0x1f077a[_0xbfd4('0xb')])){_0x587587+=_0xbfd4('0xc');var _0xfaf1e1=_0x1f077a[_0xbfd4('0xb')];maskSensitiveData(_0xfaf1e1);}return util[_0xbfd4('0xd')](_0x587587,_0x1f077a['method'],_0x1f077a[_0xbfd4('0xe')][_0xbfd4('0xf')]?_0x1f077a[_0xbfd4('0xe')][_0xbfd4('0xf')]:_0x1f077a[_0xbfd4('0x10')][_0xbfd4('0x11')]||_0x1f077a['ip'],_0x1f077a[_0xbfd4('0x12')],_0x63bcfd[_0xbfd4('0x13')],_0x63bcfd['responseTime'],_0x1f077a['user']?_0x1f077a[_0xbfd4('0x14')]['id']:null,_0x1f077a[_0xbfd4('0x14')]?_0x1f077a[_0xbfd4('0x14')][_0xbfd4('0x15')]:null,_0x1f077a[_0xbfd4('0x14')]?_0x1f077a[_0xbfd4('0x14')][_0xbfd4('0x16')]:null,_0xfaf1e1?util[_0xbfd4('0x17')](_0xfaf1e1,![],null):'');}}));_0x1de345[_0xbfd4('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4380a6,_0x710206){var _0x36107a=_0xbfd4('0x18');if(_0x4380a6[_0xbfd4('0xb')]&&_0x4380a6[_0xbfd4('0xb')][_0xbfd4('0x19')]&&_0x4380a6['body'][_0xbfd4('0x1a')]){_0x36107a=_0xbfd4('0x1b');}return util[_0xbfd4('0xd')](_0x36107a,_0x4380a6[_0xbfd4('0x1c')],_0x4380a6['headers']['x-forwarded-for']?_0x4380a6['headers'][_0xbfd4('0xf')]:_0x4380a6[_0xbfd4('0x10')][_0xbfd4('0x11')]||_0x4380a6['ip'],_0x4380a6[_0xbfd4('0x12')],_0x710206[_0xbfd4('0x13')],_0x710206[_0xbfd4('0x1d')],_0x4380a6['user']?_0x4380a6[_0xbfd4('0x14')]['id']:null,_0x4380a6[_0xbfd4('0x14')]?_0x4380a6['user'][_0xbfd4('0x15')]:null,_0x4380a6[_0xbfd4('0x14')]?_0x4380a6[_0xbfd4('0x14')][_0xbfd4('0x16')]:null,_0x4380a6[_0xbfd4('0xb')]&&_0x4380a6[_0xbfd4('0xb')][_0xbfd4('0x19')]?_0x4380a6[_0xbfd4('0xb')][_0xbfd4('0x19')]:_0xbfd4('0x1e'),_0x4380a6[_0xbfd4('0xb')]&&_0x4380a6[_0xbfd4('0xb')][_0xbfd4('0x1a')]?_0x4380a6[_0xbfd4('0xb')][_0xbfd4('0x1a')]:'',_0x4380a6['body']&&_0x4380a6[_0xbfd4('0xb')][_0xbfd4('0x1f')]?_0x4380a6[_0xbfd4('0xb')][_0xbfd4('0x1f')]:'');},'ignoreRoute':function(_0x46d4c9){var _0x3bc7e4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3bc7e4[_0xbfd4('0x20')](_0x46d4c9[_0xbfd4('0x12')]);}}));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x21'),require(_0xbfd4('0x22')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x23'),require(_0xbfd4('0x24')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x25'),require(_0xbfd4('0x26')));_0x1de345[_0xbfd4('0x8')]('/api/voice/extensions',require('./api/voiceExtension'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x27'),require('./api/voiceMusicOnHold'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x28'),require(_0xbfd4('0x29')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x2a'),require(_0xbfd4('0x2b')));_0x1de345['use']('/api/screen/recordings',require('./api/screenRecording'));_0x1de345['use'](_0xbfd4('0x2c'),require(_0xbfd4('0x2d')));_0x1de345[_0xbfd4('0x8')]('/api/voice/mails/messages',require(_0xbfd4('0x2e')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x2f'),require('./api/voiceCallReport'));_0x1de345['use'](_0xbfd4('0x30'),require('./api/voiceDialReport'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x31'),require(_0xbfd4('0x32')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x33'),require(_0xbfd4('0x34')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x35'),require('./api/memberReport'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x36'),require(_0xbfd4('0x37')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x38'),require(_0xbfd4('0x39')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x3a'),require(_0xbfd4('0x3b')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x3c'),require(_0xbfd4('0x3d')));_0x1de345[_0xbfd4('0x8')]('/api/mail/queues',require('./api/mailQueue'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x3e'),require('./api/mailSubstatus'));_0x1de345[_0xbfd4('0x8')]('/api/mail/interactions',require(_0xbfd4('0x3f')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x40'),require(_0xbfd4('0x41')));_0x1de345[_0xbfd4('0x8')]('/api/mail/applications',require(_0xbfd4('0x42')));_0x1de345['use'](_0xbfd4('0x43'),require(_0xbfd4('0x44')));_0x1de345[_0xbfd4('0x8')]('/api/dashboards',require(_0xbfd4('0x45')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x46'),require(_0xbfd4('0x47')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x48'),require(_0xbfd4('0x49')));_0x1de345[_0xbfd4('0x8')]('/api/fax/applications',require('./api/faxApplication'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x4a'),require(_0xbfd4('0x4b')));_0x1de345[_0xbfd4('0x8')]('/api/fax/messages',require(_0xbfd4('0x4c')));_0x1de345[_0xbfd4('0x8')]('/api/fax/queues',require('./api/faxQueue'));_0x1de345['use'](_0xbfd4('0x4d'),require('./api/faxQueueReport'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x4e'),require(_0xbfd4('0x4f')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x50'),require(_0xbfd4('0x51')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x52'),require(_0xbfd4('0x53')));_0x1de345['use'](_0xbfd4('0x54'),require('./api/smsMessage'));_0x1de345['use']('/api/sms/queues',require(_0xbfd4('0x55')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x56'),require(_0xbfd4('0x57')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x58'),require(_0xbfd4('0x59')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x5a'),require('./api/openchannelInteraction'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x5b'),require(_0xbfd4('0x5c')));_0x1de345[_0xbfd4('0x8')]('/api/openchannel/queues',require(_0xbfd4('0x5d')));_0x1de345[_0xbfd4('0x8')]('/api/chat/websites',require(_0xbfd4('0x5e')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x5f'),require('./api/openchannelQueueReport'));_0x1de345['use'](_0xbfd4('0x60'),require(_0xbfd4('0x61')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x62'),require(_0xbfd4('0x63')));_0x1de345[_0xbfd4('0x8')]('/api/chat/messages',require(_0xbfd4('0x64')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x65'),require(_0xbfd4('0x66')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x67'),require(_0xbfd4('0x68')));_0x1de345['use'](_0xbfd4('0x69'),require(_0xbfd4('0x6a')));_0x1de345['use']('/api/chat/proactive_actions',require(_0xbfd4('0x6b')));_0x1de345['use'](_0xbfd4('0x6c'),require(_0xbfd4('0x6d')));_0x1de345[_0xbfd4('0x8')]('/api/cm/contacts',require(_0xbfd4('0x6e')));_0x1de345[_0xbfd4('0x8')]('/api/cm/hopper',require(_0xbfd4('0x6f')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x70'),require(_0xbfd4('0x71')));_0x1de345['use'](_0xbfd4('0x72'),require('./api/cmHopperFinal'));_0x1de345[_0xbfd4('0x8')]('/api/cm/hopper_history',require(_0xbfd4('0x73')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x74'),require(_0xbfd4('0x75')));_0x1de345['use'](_0xbfd4('0x76'),require(_0xbfd4('0x77')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x78'),require(_0xbfd4('0x79')));_0x1de345['use'](_0xbfd4('0x7a'),require(_0xbfd4('0x7b')));_0x1de345['use'](_0xbfd4('0x7c'),require(_0xbfd4('0x7d')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x7e'),require(_0xbfd4('0x7f')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x80'),require(_0xbfd4('0x81')));_0x1de345[_0xbfd4('0x8')]('/api/pauses',require(_0xbfd4('0x82')));_0x1de345['use']('/api/cdr',require('./api/cdr'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x83'),require(_0xbfd4('0x84')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x85'),require(_0xbfd4('0x86')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x87'),require('./api/sound'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x88'),require(_0xbfd4('0x89')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x8a'),require(_0xbfd4('0x8b')));_0x1de345[_0xbfd4('0x8')]('/api/triggers',require('./api/trigger'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x8c'),require(_0xbfd4('0x8d')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x8e'),require(_0xbfd4('0x8f')));_0x1de345[_0xbfd4('0x8')]('/api/integrations/reports',require('./api/integrationReport'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x90'),require('./api/analyticCustomReport'));_0x1de345['use'](_0xbfd4('0x91'),require(_0xbfd4('0x92')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x93'),require(_0xbfd4('0x94')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x95'),require(_0xbfd4('0x96')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x97'),require(_0xbfd4('0x98')));_0x1de345['use']('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x1de345[_0xbfd4('0x8')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x1de345[_0xbfd4('0x8')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x1de345[_0xbfd4('0x8')]('/api/integrations/salesforce/fields',require(_0xbfd4('0x99')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x9a'),require(_0xbfd4('0x9b')));_0x1de345['use'](_0xbfd4('0x9c'),require(_0xbfd4('0x9d')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x9e'),require('./api/intSugarcrmField'));_0x1de345['use'](_0xbfd4('0x9f'),require(_0xbfd4('0xa0')));_0x1de345['use'](_0xbfd4('0xa1'),require(_0xbfd4('0xa2')));_0x1de345['use'](_0xbfd4('0xa3'),require('./api/intDeskField'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xa4'),require('./api/intZohoAccount'));_0x1de345['use']('/api/integrations/zoho/configurations',require(_0xbfd4('0xa5')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xa6'),require(_0xbfd4('0xa7')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xa8'),require('./api/intZendeskAccount'));_0x1de345['use']('/api/integrations/zendesk/configurations',require(_0xbfd4('0xa9')));_0x1de345[_0xbfd4('0x8')]('/api/integrations/zendesk/fields',require(_0xbfd4('0xaa')));_0x1de345['use'](_0xbfd4('0xab'),require(_0xbfd4('0xac')));_0x1de345['use'](_0xbfd4('0xad'),require(_0xbfd4('0xae')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xaf'),require(_0xbfd4('0xb0')));_0x1de345['use'](_0xbfd4('0xb1'),require(_0xbfd4('0xb2')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xb3'),require('./api/intVtigerConfiguration'));_0x1de345['use'](_0xbfd4('0xb4'),require(_0xbfd4('0xb5')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xb6'),require('./api/intServicenowAccount'));_0x1de345[_0xbfd4('0x8')]('/api/integrations/servicenow/configurations',require(_0xbfd4('0xb7')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xb8'),require(_0xbfd4('0xb9')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xba'),require(_0xbfd4('0xbb')));_0x1de345[_0xbfd4('0x8')]('/api/integrations/dynamics365/configurations',require(_0xbfd4('0xbc')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xbd'),require(_0xbfd4('0xbe')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xbf'),require(_0xbfd4('0xc0')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xc1'),require(_0xbfd4('0xc2')));_0x1de345[_0xbfd4('0x8')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x1de345[_0xbfd4('0x8')]('/api/networks',require('./api/network'));_0x1de345[_0xbfd4('0x8')]('/api/chat/reports/queue',require(_0xbfd4('0xc3')));_0x1de345['use'](_0xbfd4('0xc4'),require(_0xbfd4('0xc5')));_0x1de345[_0xbfd4('0x8')]('/api/jscripty/answers/reports',require(_0xbfd4('0xc6')));_0x1de345['use'](_0xbfd4('0xc7'),require(_0xbfd4('0xc8')));_0x1de345[_0xbfd4('0x8')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xc9'),require(_0xbfd4('0xca')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xcb'),require('./api/squareReport'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xcc'),require('./api/squareReportDetail'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xcd'),require(_0xbfd4('0xce')));_0x1de345[_0xbfd4('0x8')]('/api/settings',require(_0xbfd4('0xcf')));_0x1de345['use']('/api/square/odbc',require(_0xbfd4('0xd0')));_0x1de345['use'](_0xbfd4('0xd1'),require(_0xbfd4('0xd2')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xd3'),require(_0xbfd4('0xd4')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xd5'),require(_0xbfd4('0xd6')));_0x1de345[_0xbfd4('0x8')]('/api/teams',require(_0xbfd4('0xd7')));_0x1de345[_0xbfd4('0x8')]('/api/license',require(_0xbfd4('0xd8')));_0x1de345['use'](_0xbfd4('0xd9'),require(_0xbfd4('0xda')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xdb'),require(_0xbfd4('0xdc')));_0x1de345[_0xbfd4('0x8')]('/api/attachments',require(_0xbfd4('0xdd')));_0x1de345['use']('/api/plugins',require('./api/plugin'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xde'),require(_0xbfd4('0xdf')));_0x1de345['use'](_0xbfd4('0xe0'),require('./api/chatTransferReport'));_0x1de345['use'](_0xbfd4('0xe1'),require(_0xbfd4('0xe2')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xe3'),require(_0xbfd4('0xe4')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xe5'),require(_0xbfd4('0xe6')));_0x1de345[_0xbfd4('0x8')]('/api/cm/lists',require('./api/cmList'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xe7'),require(_0xbfd4('0xe8')));_0x1de345['use'](_0xbfd4('0xe9'),require(_0xbfd4('0xea')));_0x1de345['use'](_0xbfd4('0xeb'),require('./api/userProfileSection'));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xec'),require(_0xbfd4('0xed')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xee'),require('./api/userNotification'));_0x1de345[_0xbfd4('0x8')]('/api/whatsapp/accounts',require(_0xbfd4('0xef')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xf0'),require(_0xbfd4('0xf1')));_0x1de345[_0xbfd4('0x8')]('/api/whatsapp/interactions',require(_0xbfd4('0xf2')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xf3'),require('./api/whatsappMessage'));_0x1de345['use'](_0xbfd4('0xf4'),require('./api/whatsappQueueReport'));_0x1de345[_0xbfd4('0x8')]('/api/whatsapp/reports/transfer',require(_0xbfd4('0xf5')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xf6'),require(_0xbfd4('0xf7')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0xf8'),require(_0xbfd4('0xf9')));_0x1de345[_0xbfd4('0x8')]('/api/realtime',require(_0xbfd4('0xfa')));_0x1de345['use']('/api/auth/local',require(_0xbfd4('0xfb')));_0x1de345['use'](_0xbfd4('0xfc'),require(_0xbfd4('0xfd')));_0x1de345['use'](_0xbfd4('0xfe'),require(_0xbfd4('0xff')));_0x1de345[_0xbfd4('0x8')]('/api/rpc',require(_0xbfd4('0x100')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x101'),require(_0xbfd4('0x102')));_0x1de345[_0xbfd4('0x8')]('/api/system',require(_0xbfd4('0x103')));_0x1de345[_0xbfd4('0x8')]('/api/pm2',require('./api/pm2'));_0x1de345['use']('/api/webbar',require(_0xbfd4('0x104')));_0x1de345['use'](_0xbfd4('0x105'),express['static'](path[_0xbfd4('0x106')](config[_0xbfd4('0x107')],'/apidoc')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x108'),express[_0xbfd4('0x109')](path[_0xbfd4('0x106')](config[_0xbfd4('0x107')],'/www')));_0x1de345['use'](_0xbfd4('0x10a'),express[_0xbfd4('0x109')](path['join'](config[_0xbfd4('0x107')],_0xbfd4('0x10a'))));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x10b'),express[_0xbfd4('0x109')](path[_0xbfd4('0x106')](config[_0xbfd4('0x107')],_0xbfd4('0x10c'),'3.0.0')));_0x1de345[_0xbfd4('0x8')](_0xbfd4('0x10d'),express['static'](path[_0xbfd4('0x106')](config[_0xbfd4('0x107')],_0xbfd4('0x10e'))));_0x1de345[_0xbfd4('0x10f')](_0xbfd4('0x110'))[_0xbfd4('0x111')](errors[0x194]);_0x1de345[_0xbfd4('0x10f')]('/*')[_0xbfd4('0x111')](function(_0x4f5976,_0x18aba7){_0x18aba7[_0xbfd4('0x112')](path[_0xbfd4('0x113')](_0x1de345[_0xbfd4('0x111')](_0xbfd4('0x114'))+'/index.html'));});};var sensitiveFields=[_0xbfd4('0x115'),_0xbfd4('0x116'),'newPassword',_0xbfd4('0x117'),_0xbfd4('0x118'),_0xbfd4('0x119'),_0xbfd4('0x11a'),_0xbfd4('0x11b'),_0xbfd4('0x11c'),'fax',_0xbfd4('0x11d'),_0xbfd4('0x11e'),_0xbfd4('0x11f'),_0xbfd4('0x120'),_0xbfd4('0x121'),_0xbfd4('0x122'),_0xbfd4('0x123'),_0xbfd4('0x124'),_0xbfd4('0x125'),_0xbfd4('0x126'),_0xbfd4('0x127'),_0xbfd4('0x128'),_0xbfd4('0x129'),_0xbfd4('0x12a'),_0xbfd4('0x12b'),_0xbfd4('0x12c'),_0xbfd4('0x12d'),_0xbfd4('0x12e'),'vidaooApiKey',_0xbfd4('0x12f'),_0xbfd4('0x130'),'accesskeyid','secretaccesskey',_0xbfd4('0x131'),'user',_0xbfd4('0x132'),_0xbfd4('0x133'),_0xbfd4('0x134'),'dsn',_0xbfd4('0x135'),_0xbfd4('0x136'),_0xbfd4('0x137')];function maskSensitiveData(_0xd9ee6b){var _0x3212e3=/(?!^)[\s\S](?!$)/g;if(!_[_0xbfd4('0x138')](_0xd9ee6b))return;for(var _0x53dc04 in _0xd9ee6b){if(_[_0xbfd4('0x139')](_0xd9ee6b[_0x53dc04])){for(var _0x290fb4=0x0;_0x290fb4<_0xd9ee6b[_0x53dc04][_0xbfd4('0x13a')];_0x290fb4++){maskSensitiveData(_0xd9ee6b[_0x53dc04][_0x290fb4]);}}else if(_[_0xbfd4('0x138')](_0xd9ee6b[_0x53dc04])){maskSensitiveData(_0xd9ee6b[_0x53dc04]);}else if(_[_0xbfd4('0x13b')](_0xd9ee6b[_0x53dc04])){_0xd9ee6b[_0x53dc04]=_0xd9ee6b[_0x53dc04]['replace'](/{{{/g,'@@{')['replace'](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xbfd4('0x13c')](/}}/g,'}@');if(_[_0xbfd4('0x13d')](sensitiveFields,_0x53dc04)){_0xd9ee6b[_0x53dc04]=_0xd9ee6b[_0x53dc04][_0xbfd4('0x13c')](_0x3212e3,'*');}}}} \ No newline at end of file +var _0xfbad=['/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/screenRecording','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/version','./api/system','/api/pm2','./api/webbar','static','join','/apidoc','root','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','phone','mobile','fax','email','clientId','clientSecret','code','accessKey','tenantId','token','channelSecret','accessTokenSecret','authToken','consumerSecret','membername','calleridnum','exten','privateKey','secretaccesskey','key','pass','dsn','secret','oldPassword','isPlainObject','isString','replace','@@{','}@@','includes','path','express','util','./config/environment','./config/logger','api','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','name','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','agent_name','test','/api/users','./api/user'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfbad,0x115));var _0xdfba=function(_0x13588c,_0x289580){_0x13588c=_0x13588c-0x0;var _0x53a0d0=_0xfbad[_0x13588c];return _0x53a0d0;};'use strict';var _=require('lodash');var path=require(_0xdfba('0x0'));var express=require(_0xdfba('0x1'));var ewinston=require('express-winston');var util=require(_0xdfba('0x2'));var errors=require('./errors');var config=require(_0xdfba('0x3'));var logger=require(_0xdfba('0x4'))(_0xdfba('0x5'));var authLogger=require(_0xdfba('0x4'))('auth');exports[_0xdfba('0x6')]=function(_0x297ce6){_0x297ce6[_0xdfba('0x7')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x46e83e,_0x993b4c){var _0x45dca2=_0xdfba('0x8');if(!_[_0xdfba('0x9')](_0x46e83e[_0xdfba('0xa')])){_0x45dca2+='\x20body=%s';var _0x571f47=_0x46e83e[_0xdfba('0xa')];maskSensitiveData(_0x571f47);}return util[_0xdfba('0xb')](_0x45dca2,_0x46e83e[_0xdfba('0xc')],_0x46e83e[_0xdfba('0xd')][_0xdfba('0xe')]?_0x46e83e[_0xdfba('0xd')][_0xdfba('0xe')]:_0x46e83e[_0xdfba('0xf')][_0xdfba('0x10')]||_0x46e83e['ip'],_0x46e83e['url'],_0x993b4c[_0xdfba('0x11')],_0x993b4c[_0xdfba('0x12')],_0x46e83e[_0xdfba('0x13')]?_0x46e83e['user']['id']:null,_0x46e83e[_0xdfba('0x13')]?_0x46e83e[_0xdfba('0x13')][_0xdfba('0x14')]:null,_0x46e83e[_0xdfba('0x13')]?_0x46e83e[_0xdfba('0x13')][_0xdfba('0x15')]:null,_0x571f47?util[_0xdfba('0x16')](_0x571f47,![],null):'');}}));_0x297ce6[_0xdfba('0x7')](ewinston[_0xdfba('0x17')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x54a3f8,_0x225728){var _0x52f131=_0xdfba('0x18');if(_0x54a3f8[_0xdfba('0xa')]&&_0x54a3f8[_0xdfba('0xa')][_0xdfba('0x19')]&&_0x54a3f8['body'][_0xdfba('0x1a')]){_0x52f131=_0xdfba('0x1b');}return util['format'](_0x52f131,_0x54a3f8[_0xdfba('0xc')],_0x54a3f8[_0xdfba('0xd')][_0xdfba('0xe')]?_0x54a3f8[_0xdfba('0xd')][_0xdfba('0xe')]:_0x54a3f8[_0xdfba('0xf')]['remoteAddress']||_0x54a3f8['ip'],_0x54a3f8[_0xdfba('0x1c')],_0x225728[_0xdfba('0x11')],_0x225728['responseTime'],_0x54a3f8['user']?_0x54a3f8[_0xdfba('0x13')]['id']:null,_0x54a3f8['user']?_0x54a3f8['user']['name']:null,_0x54a3f8['user']?_0x54a3f8[_0xdfba('0x13')][_0xdfba('0x15')]:null,_0x54a3f8[_0xdfba('0xa')]&&_0x54a3f8[_0xdfba('0xa')]['device']?_0x54a3f8[_0xdfba('0xa')][_0xdfba('0x19')]:'other',_0x54a3f8[_0xdfba('0xa')]&&_0x54a3f8[_0xdfba('0xa')]['agent_id']?_0x54a3f8[_0xdfba('0xa')][_0xdfba('0x1a')]:'',_0x54a3f8[_0xdfba('0xa')]&&_0x54a3f8[_0xdfba('0xa')][_0xdfba('0x1d')]?_0x54a3f8[_0xdfba('0xa')][_0xdfba('0x1d')]:'');},'ignoreRoute':function(_0x2d5b0a){var _0x2b1572=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2b1572[_0xdfba('0x1e')](_0x2d5b0a[_0xdfba('0x1c')]);}}));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x1f'),require(_0xdfba('0x20')));_0x297ce6['use'](_0xdfba('0x21'),require(_0xdfba('0x22')));_0x297ce6[_0xdfba('0x7')]('/api/voice/contexts',require('./api/voiceContext'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x23'),require('./api/voiceExtension'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x24'),require(_0xdfba('0x25')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x26'),require('./api/voiceQueue'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x27'),require('./api/voiceRecording'));_0x297ce6[_0xdfba('0x7')]('/api/screen/recordings',require(_0xdfba('0x28')));_0x297ce6['use']('/api/voice/mails',require('./api/voiceMail'));_0x297ce6[_0xdfba('0x7')]('/api/voice/mails/messages',require(_0xdfba('0x29')));_0x297ce6[_0xdfba('0x7')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x2a'),require(_0xdfba('0x2b')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x2c'),require(_0xdfba('0x2d')));_0x297ce6[_0xdfba('0x7')]('/api/voice/queues/reports',require(_0xdfba('0x2e')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x2f'),require('./api/memberReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x30'),require('./api/trunk'));_0x297ce6[_0xdfba('0x7')]('/api/voice/transfers/reports',require(_0xdfba('0x31')));_0x297ce6['use']('/api/mail/out_servers',require(_0xdfba('0x32')));_0x297ce6['use'](_0xdfba('0x33'),require(_0xdfba('0x34')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x35'),require(_0xdfba('0x36')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x37'),require(_0xdfba('0x38')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x39'),require(_0xdfba('0x3a')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x3b'),require(_0xdfba('0x3c')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x3d'),require(_0xdfba('0x3e')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x3f'),require('./api/mailQueueReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x40'),require('./api/dashboard'));_0x297ce6[_0xdfba('0x7')]('/api/dashboards/items',require(_0xdfba('0x41')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x42'),require('./api/faxAccount'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x43'),require(_0xdfba('0x44')));_0x297ce6['use'](_0xdfba('0x45'),require(_0xdfba('0x46')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x47'),require(_0xdfba('0x48')));_0x297ce6['use'](_0xdfba('0x49'),require(_0xdfba('0x4a')));_0x297ce6['use']('/api/fax/reports/queue',require(_0xdfba('0x4b')));_0x297ce6[_0xdfba('0x7')]('/api/sms/accounts',require('./api/smsAccount'));_0x297ce6['use'](_0xdfba('0x4c'),require(_0xdfba('0x4d')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x4e'),require('./api/smsInteraction'));_0x297ce6['use'](_0xdfba('0x4f'),require(_0xdfba('0x50')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x51'),require('./api/smsQueue'));_0x297ce6[_0xdfba('0x7')]('/api/openchannel/accounts',require(_0xdfba('0x52')));_0x297ce6['use'](_0xdfba('0x53'),require(_0xdfba('0x54')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x55'),require(_0xdfba('0x56')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x57'),require('./api/openchannelMessage'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x58'),require(_0xdfba('0x59')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x5a'),require(_0xdfba('0x5b')));_0x297ce6[_0xdfba('0x7')]('/api/openchannel/reports/queue',require(_0xdfba('0x5c')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x5d'),require(_0xdfba('0x5e')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x5f'),require(_0xdfba('0x60')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x61'),require('./api/chatMessage'));_0x297ce6['use'](_0xdfba('0x62'),require(_0xdfba('0x63')));_0x297ce6[_0xdfba('0x7')]('/api/chat/queues',require(_0xdfba('0x64')));_0x297ce6['use'](_0xdfba('0x65'),require('./api/chatGroup'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x66'),require(_0xdfba('0x67')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x68'),require(_0xdfba('0x69')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x6a'),require(_0xdfba('0x6b')));_0x297ce6['use']('/api/cm/hopper',require(_0xdfba('0x6c')));_0x297ce6['use'](_0xdfba('0x6d'),require(_0xdfba('0x6e')));_0x297ce6['use'](_0xdfba('0x6f'),require(_0xdfba('0x70')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x71'),require('./api/cmHopperHistory'));_0x297ce6[_0xdfba('0x7')]('/api/cm/custom_fields',require(_0xdfba('0x72')));_0x297ce6['use']('/api/actions',require(_0xdfba('0x73')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x74'),require(_0xdfba('0x75')));_0x297ce6['use'](_0xdfba('0x76'),require(_0xdfba('0x77')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x78'),require(_0xdfba('0x79')));_0x297ce6[_0xdfba('0x7')]('/api/conditions',require(_0xdfba('0x7a')));_0x297ce6['use']('/api/intervals',require('./api/interval'));_0x297ce6['use'](_0xdfba('0x7b'),require(_0xdfba('0x7c')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x7d'),require(_0xdfba('0x7e')));_0x297ce6['use'](_0xdfba('0x7f'),require(_0xdfba('0x80')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x81'),require(_0xdfba('0x82')));_0x297ce6['use'](_0xdfba('0x83'),require(_0xdfba('0x84')));_0x297ce6['use'](_0xdfba('0x85'),require(_0xdfba('0x86')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x87'),require('./api/template'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x88'),require(_0xdfba('0x89')));_0x297ce6['use']('/api/variables',require(_0xdfba('0x8a')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x8b'),require(_0xdfba('0x8c')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x8d'),require(_0xdfba('0x8e')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x8f'),require(_0xdfba('0x90')));_0x297ce6[_0xdfba('0x7')]('/api/analytics/default_reports',require(_0xdfba('0x91')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x92'),require(_0xdfba('0x93')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x94'),require(_0xdfba('0x95')));_0x297ce6['use'](_0xdfba('0x96'),require('./api/analyticFieldReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x97'),require('./api/analyticTreeReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x98'),require('./api/intSalesforceAccount'));_0x297ce6[_0xdfba('0x7')]('/api/integrations/salesforce/configurations',require(_0xdfba('0x99')));_0x297ce6[_0xdfba('0x7')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x9a'),require(_0xdfba('0x9b')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x9c'),require('./api/intSugarcrmConfiguration'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x9d'),require(_0xdfba('0x9e')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x9f'),require('./api/intDeskAccount'));_0x297ce6[_0xdfba('0x7')]('/api/integrations/desk/configurations',require(_0xdfba('0xa0')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xa1'),require(_0xdfba('0xa2')));_0x297ce6[_0xdfba('0x7')]('/api/integrations/zoho/accounts',require(_0xdfba('0xa3')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xa4'),require('./api/intZohoConfiguration'));_0x297ce6['use'](_0xdfba('0xa5'),require('./api/intZohoField'));_0x297ce6['use'](_0xdfba('0xa6'),require(_0xdfba('0xa7')));_0x297ce6['use']('/api/integrations/zendesk/configurations',require(_0xdfba('0xa8')));_0x297ce6[_0xdfba('0x7')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x297ce6[_0xdfba('0x7')]('/api/integrations/freshdesk/accounts',require(_0xdfba('0xa9')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xaa'),require('./api/intFreshdeskConfiguration'));_0x297ce6['use']('/api/integrations/freshdesk/fields',require(_0xdfba('0xab')));_0x297ce6['use'](_0xdfba('0xac'),require(_0xdfba('0xad')));_0x297ce6['use'](_0xdfba('0xae'),require('./api/intVtigerConfiguration'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xaf'),require(_0xdfba('0xb0')));_0x297ce6[_0xdfba('0x7')]('/api/integrations/servicenow/accounts',require(_0xdfba('0xb1')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xb2'),require(_0xdfba('0xb3')));_0x297ce6['use'](_0xdfba('0xb4'),require(_0xdfba('0xb5')));_0x297ce6['use'](_0xdfba('0xb6'),require(_0xdfba('0xb7')));_0x297ce6['use'](_0xdfba('0xb8'),require(_0xdfba('0xb9')));_0x297ce6['use']('/api/integrations/dynamics365/fields',require(_0xdfba('0xba')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xbb'),require(_0xdfba('0xbc')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xbd'),require('./api/intFreshsalesConfiguration'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xbe'),require('./api/intFreshsalesField'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xbf'),require('./api/network'));_0x297ce6[_0xdfba('0x7')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xc0'),require(_0xdfba('0xc1')));_0x297ce6[_0xdfba('0x7')]('/api/jscripty/answers/reports',require(_0xdfba('0xc2')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xc3'),require(_0xdfba('0xc4')));_0x297ce6[_0xdfba('0x7')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x297ce6['use'](_0xdfba('0xc5'),require(_0xdfba('0xc6')));_0x297ce6['use'](_0xdfba('0xc7'),require(_0xdfba('0xc8')));_0x297ce6[_0xdfba('0x7')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xc9'),require('./api/jscriptyProject'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xca'),require(_0xdfba('0xcb')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xcc'),require(_0xdfba('0xcd')));_0x297ce6['use'](_0xdfba('0xce'),require(_0xdfba('0xcf')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xd0'),require(_0xdfba('0xd1')));_0x297ce6[_0xdfba('0x7')]('/api/square/messages',require(_0xdfba('0xd2')));_0x297ce6[_0xdfba('0x7')]('/api/teams',require(_0xdfba('0xd3')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xd4'),require(_0xdfba('0xd5')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xd6'),require('./api/campaign'));_0x297ce6[_0xdfba('0x7')]('/api/migrations',require(_0xdfba('0xd7')));_0x297ce6['use'](_0xdfba('0xd8'),require(_0xdfba('0xd9')));_0x297ce6['use'](_0xdfba('0xda'),require(_0xdfba('0xdb')));_0x297ce6[_0xdfba('0x7')]('/api/mail/reports/transfer',require(_0xdfba('0xdc')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xdd'),require(_0xdfba('0xde')));_0x297ce6[_0xdfba('0x7')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xdf'),require(_0xdfba('0xe0')));_0x297ce6[_0xdfba('0x7')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x297ce6[_0xdfba('0x7')]('/api/cm/lists',require(_0xdfba('0xe1')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xe2'),require(_0xdfba('0xe3')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xe4'),require(_0xdfba('0xe5')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xe6'),require(_0xdfba('0xe7')));_0x297ce6['use'](_0xdfba('0xe8'),require('./api/userProfileResource'));_0x297ce6[_0xdfba('0x7')]('/api/userNotifications',require('./api/userNotification'));_0x297ce6['use'](_0xdfba('0xe9'),require(_0xdfba('0xea')));_0x297ce6['use'](_0xdfba('0xeb'),require(_0xdfba('0xec')));_0x297ce6[_0xdfba('0x7')]('/api/whatsapp/interactions',require(_0xdfba('0xed')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xee'),require(_0xdfba('0xef')));_0x297ce6[_0xdfba('0x7')]('/api/whatsapp/reports/queue',require(_0xdfba('0xf0')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xf1'),require(_0xdfba('0xf2')));_0x297ce6[_0xdfba('0x7')]('/api/whatsapp/queues',require(_0xdfba('0xf3')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xf4'),require(_0xdfba('0xf5')));_0x297ce6['use'](_0xdfba('0xf6'),require(_0xdfba('0xf7')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xf8'),require('./api/authLocal'));_0x297ce6['use'](_0xdfba('0xf9'),require(_0xdfba('0xfa')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xfb'),require(_0xdfba('0xfc')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0xfd'),require('./api/rpc'));_0x297ce6['use']('/api/version',require(_0xdfba('0xfe')));_0x297ce6[_0xdfba('0x7')]('/api/system',require(_0xdfba('0xff')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x100'),require('./api/pm2'));_0x297ce6[_0xdfba('0x7')]('/api/webbar',require(_0xdfba('0x101')));_0x297ce6[_0xdfba('0x7')]('/apidoc',express[_0xdfba('0x102')](path[_0xdfba('0x103')](config['root'],_0xdfba('0x104'))));_0x297ce6[_0xdfba('0x7')]('/www',express[_0xdfba('0x102')](path[_0xdfba('0x103')](config[_0xdfba('0x105')],'/www')));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x106'),express['static'](path[_0xdfba('0x103')](config['root'],_0xdfba('0x106'))));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x107'),express[_0xdfba('0x102')](path[_0xdfba('0x103')](config['root'],_0xdfba('0x108'),_0xdfba('0x109'))));_0x297ce6[_0xdfba('0x7')](_0xdfba('0x10a'),express[_0xdfba('0x102')](path[_0xdfba('0x103')](config[_0xdfba('0x105')],_0xdfba('0x10b'))));_0x297ce6[_0xdfba('0x10c')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xdfba('0x10d')](errors[0x194]);_0x297ce6['route']('/*')['get'](function(_0x7d3b2f,_0x39c34a){_0x39c34a[_0xdfba('0x10e')](path[_0xdfba('0x10f')](_0x297ce6[_0xdfba('0x10d')](_0xdfba('0x110'))+_0xdfba('0x111')));});};var sensitiveFields=[_0xdfba('0x112'),_0xdfba('0x113'),_0xdfba('0x114'),_0xdfba('0x115'),_0xdfba('0x116'),_0xdfba('0x117'),'street',_0xdfba('0x118'),_0xdfba('0x119'),_0xdfba('0x11a'),_0xdfba('0x11b'),_0xdfba('0x11c'),_0xdfba('0x11d'),'securityToken',_0xdfba('0x11e'),_0xdfba('0x11f'),_0xdfba('0x120'),_0xdfba('0x121'),_0xdfba('0x122'),'accessToken',_0xdfba('0x123'),_0xdfba('0x124'),'consumerKey',_0xdfba('0x125'),_0xdfba('0x126'),'calleridname',_0xdfba('0x127'),_0xdfba('0x128'),'vidaooApiKey','clientEmail',_0xdfba('0x129'),'accesskeyid',_0xdfba('0x12a'),_0xdfba('0x12b'),_0xdfba('0x13'),_0xdfba('0x12c'),'accountSid','localstationid',_0xdfba('0x12d'),_0xdfba('0x12e'),'registry',_0xdfba('0x12f')];function maskSensitiveData(_0x1f98bc){var _0x43115c=/(?!^)[\s\S](?!$)/g;if(!_[_0xdfba('0x130')](_0x1f98bc))return;for(var _0x548a03 in _0x1f98bc){if(_['isArray'](_0x1f98bc[_0x548a03])){for(var _0x242904=0x0;_0x242904<_0x1f98bc[_0x548a03]['length'];_0x242904++){maskSensitiveData(_0x1f98bc[_0x548a03][_0x242904]);}}else if(_[_0xdfba('0x130')](_0x1f98bc[_0x548a03])){maskSensitiveData(_0x1f98bc[_0x548a03]);}else if(_[_0xdfba('0x131')](_0x1f98bc[_0x548a03])){_0x1f98bc[_0x548a03]=_0x1f98bc[_0x548a03][_0xdfba('0x132')](/{{{/g,_0xdfba('0x133'))['replace'](/}}}/g,_0xdfba('0x134'))[_0xdfba('0x132')](/{{/g,'@{')[_0xdfba('0x132')](/}}/g,'}@');if(_[_0xdfba('0x135')](sensitiveFields,_0x548a03)){_0x1f98bc[_0x548a03]=_0x1f98bc[_0x548a03]['replace'](_0x43115c,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 4c0d132..da09628 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf31b=['../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../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/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0xf31b,0x195));var _0xbf31=function(_0x436fc1,_0x426952){_0x436fc1=_0x436fc1-0x0;var _0x117660=_0xf31b[_0x436fc1];return _0x117660;};'use strict';var jayson=require(_0xbf31('0x0'));var BPromise=require(_0xbf31('0x1'));var _=require(_0xbf31('0x2'));var config=require(_0xbf31('0x3'));exports[_0xbf31('0x4')]=function(){return new BPromise(function(_0x46463c,_0x39bce9){var _0x2a1b2d={};_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x6')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x7')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x8')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x9')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0xa')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0xb')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0xc')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0xd')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/memberReport/memberReport.rpc'));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0xe')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0xf')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x10')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x11')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x12')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/mailQueue/mailQueue.rpc'));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x13')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x14')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x15')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x16')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x17')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x18')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/faxInteraction/faxInteraction.rpc'));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x19')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x1a')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x1b')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x1c')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/smsInteraction/smsInteraction.rpc'));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x1d')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x1e')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x1f')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x20')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x21')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x22')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x23')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x24')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x25')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x26')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x27')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x28')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x29')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/interval/interval.rpc'));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/pause/pause.rpc'));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x2a')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/template/template.rpc'));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x2b')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/variable/variable.rpc'));_0x2a1b2d=_['merge'](_0x2a1b2d,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x2c')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x2d')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x2e')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x2f')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x30')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x31')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x32')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x33')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x34')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x35')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x36')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x37')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x38')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x39')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x3a')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x3b')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x3c')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x3d')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x3e')));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x3f')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require(_0xbf31('0x40')));_0x2a1b2d=_[_0xbf31('0x5')](_0x2a1b2d,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2a1b2d=_['merge'](_0x2a1b2d,require(_0xbf31('0x41')));var _0x1f300c=jayson[_0xbf31('0x42')](_0x2a1b2d)[_0xbf31('0x43')]();var _0x5231d3=config[_0xbf31('0x44')][_0xbf31('0x45')]||config[_0xbf31('0x45')]+0x1;var _0x58bfa9=config[_0xbf31('0x44')]['ip']||'localhost';_0x1f300c['on'](_0xbf31('0x46'),function(_0x304c28){return _0x39bce9(_0x304c28);});_0x1f300c[_0xbf31('0x4')](_0x5231d3,_0x58bfa9,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x58bfa9,_0x5231d3);require(_0xbf31('0x47'))[_0xbf31('0x48')]();return _0x46463c(_0xbf31('0x49')+_0x58bfa9+':'+_0x5231d3);});});}; \ No newline at end of file +var _0x09f9=['../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc'];(function(_0x5823a7,_0x3cc2d7){var _0x4f1d86=function(_0x26ff02){while(--_0x26ff02){_0x5823a7['push'](_0x5823a7['shift']());}};_0x4f1d86(++_0x3cc2d7);}(_0x09f9,0x1f2));var _0x909f=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x09f9[_0x24259d];return _0x5a701;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x909f('0x0'));var _=require(_0x909f('0x1'));var config=require('../config/environment');exports[_0x909f('0x2')]=function(){return new BPromise(function(_0x1a7e93,_0x115aa5){var _0xf316b4={};_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x4')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x5')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/voiceQueue/voiceQueue.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x6')));_0xf316b4=_['merge'](_0xf316b4,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x7')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x8')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x9')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0xa')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0xb')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0xc')));_0xf316b4=_['merge'](_0xf316b4,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/mailServerIn/mailServerIn.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0xd')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0xe')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0xf')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x10')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x11')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x12')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x13')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x14')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x15')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x16')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x17')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x18')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x19')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x1a')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x1b')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x1c')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x1d')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x1e')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x1f')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x20')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x21')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x22')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x23')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x24')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x25')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x26')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x27')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x28')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/interval/interval.rpc'));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x29')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x2a')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/template/template.rpc'));_0xf316b4=_['merge'](_0xf316b4,require('../api/trigger/trigger.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x2b')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x2c')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x2d')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x2e')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x2f')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x30')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x31')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x32')));_0xf316b4=_['merge'](_0xf316b4,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x33')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x34')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x35')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/squareReport/squareReport.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xf316b4=_['merge'](_0xf316b4,require('../api/setting/setting.rpc'));_0xf316b4=_['merge'](_0xf316b4,require('../api/squareOdbc/squareOdbc.rpc'));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x36')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x37')));_0xf316b4=_['merge'](_0xf316b4,require('../api/squareMessage/squareMessage.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x38')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require('../api/attachment/attachment.rpc'));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x39')));_0xf316b4=_['merge'](_0xf316b4,require(_0x909f('0x3a')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x3b')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x3c')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x3d')));_0xf316b4=_[_0x909f('0x3')](_0xf316b4,require(_0x909f('0x3e')));var _0x193e95=jayson[_0x909f('0x3f')](_0xf316b4)[_0x909f('0x40')]();var _0xf591b9=config[_0x909f('0x41')]['port']||config[_0x909f('0x42')]+0x1;var _0x33cce7=config[_0x909f('0x41')]['ip']||_0x909f('0x43');_0x193e95['on'](_0x909f('0x44'),function(_0x3c610a){return _0x115aa5(_0x3c610a);});_0x193e95[_0x909f('0x2')](_0xf591b9,_0x33cce7,function(){console['log'](_0x909f('0x45'),_0x33cce7,_0xf591b9);require(_0x909f('0x46'))['default']();return _0x1a7e93(_0x909f('0x47')+_0x33cce7+':'+_0xf591b9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e5a03c6..f3dca50 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 _0x2bb6=['inherits','prototype','answer','getData','beep','sendRequest','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','./reply','./error','call','utf8','setEncoding','headers','emit','ready','toLowerCase','hangup','function','substring','replace','indexOf','startsWith','length','match','error','code','close','timeout','E_AGI_SOCKET_TIMEOUT','command'];(function(_0x348615,_0x30c3b8){var _0x461c4b=function(_0x32438a){while(--_0x32438a){_0x348615['push'](_0x348615['shift']());}};_0x461c4b(++_0x30c3b8);}(_0x2bb6,0x146));var _0x62bb=function(_0x4872c9,_0x3efc87){_0x4872c9=_0x4872c9-0x0;var _0x445cc8=_0x2bb6[_0x4872c9];return _0x445cc8;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x62bb('0x0'))['EventEmitter'];var AGIReply=require(_0x62bb('0x1'));var AGIError=require(_0x62bb('0x2'));function AGIChannel(_0x3b213b){var _0x783af6=this,_0x206e8f=new AGIReply(),_0x3fa39a=![],_0x13066d={};EventEmitter[_0x62bb('0x3')](_0x783af6);_0x3b213b['setEncoding'](_0x62bb('0x4'));_0x3b213b['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x206e8f[_0x62bb('0x5')](_0x62bb('0x4'));_0x206e8f['on'](_0x62bb('0x6'),function(_0x145d6f){for(var _0x4e3e39 in _0x145d6f){_0x783af6[_0x4e3e39]=_0x145d6f[_0x4e3e39];}_0x783af6[_0x62bb('0x7')](_0x62bb('0x8'));});_0x206e8f['on']('line',function(_0x8f3754){if(_0x8f3754[_0x62bb('0x9')]()==_0x62bb('0xa')){_0x783af6[_0x62bb('0x7')](_0x62bb('0xa'));return;}if(_0x8f3754['substring'](0x0,0xb)=='520-Invalid'){_0x3fa39a=!![];}if(_0x3fa39a){_0x13066d['rx']+=_0x8f3754+'\x0a';if(_0x8f3754['search']('520\x20End\x20of\x20proper')!=-0x1){_0x3fa39a=![];}}else{_0x13066d['rx']=_0x8f3754;}if(_0x3fa39a){return;}if(typeof _0x13066d['cb']==_0x62bb('0xb')){var _0x273d81=_0x13066d['rx']['substring'](0x0,0x3),_0x2a05ef=null,_0x461fa5=null;_0x273d81=parseInt(_0x273d81);if(isNaN(_0x273d81)){_0x13066d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x273d81!=0xc8){_0x13066d['cb'](null,{'code':_0x273d81,'result':-0x1,'extra':'KO'});return;}_0x2a05ef=_0x13066d['rx'][_0x62bb('0xc')](0x4)[_0x62bb('0xd')]('result=','');if(_0x2a05ef['indexOf']('\x20')!=-0x1){_0x2a05ef=_0x2a05ef['substr'](0x0,_0x2a05ef[_0x62bb('0xe')]('\x20'));}if(_[_0x62bb('0xf')](_0x2a05ef,'-1')){_0x2a05ef=parseInt(_0x2a05ef);}_0x461fa5=_0x13066d['rx']['split']('\x20');if(_0x461fa5[_0x62bb('0x10')]==0x3){_0x461fa5=_0x461fa5[0x2][_0x62bb('0xc')](0x1,_0x461fa5[0x2][_0x62bb('0x10')]-0x1);}else if(_0x461fa5[_0x62bb('0x10')]>0x3){var _0x17b3fe=/\((.+)\)/;var _0x43c48e=_0x13066d['rx'][_0x62bb('0x11')](_0x17b3fe);if(_0x43c48e){_0x461fa5=_0x43c48e[0x1];}else{_0x461fa5=null;}}else{_0x461fa5=null;}_0x13066d['cb'](null,{'code':_0x273d81,'result':_0x2a05ef,'extra':_0x461fa5});}});_0x3b213b['on'](_0x62bb('0x12'),function(_0x250860){_0x783af6['emit'](_0x62bb('0x12'),new AGIError('E_AGI_SOCKET_ERROR',_0x250860[_0x62bb('0x13')]));});_0x3b213b['on'](_0x62bb('0x14'),function(){_0x783af6[_0x62bb('0x7')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3b213b['on'](_0x62bb('0x15'),function(){_0x783af6[_0x62bb('0x7')]('timeout',new AGIError(_0x62bb('0x16')));_0x3b213b['destroy']();});_0x3b213b['pipe'](_0x206e8f);this[_0x62bb('0x17')]=function(_0x45fbed,_0x379088){var _0x45fbed=_0x45fbed||'',_0x379088=typeof _0x379088=='function'?_0x379088:new Function();_0x13066d={'tx':_0x45fbed,'rx':'','cb':_0x379088};_0x3b213b['write'](_0x45fbed+'\x0a');},this[_0x62bb('0x14')]=function(){_0x3b213b['destroy']();};}util[_0x62bb('0x18')](AGIChannel,EventEmitter);AGIChannel[_0x62bb('0x19')]['sendRequest']=function(_0x31e923){return this[_0x62bb('0x17')]['sync'](this,_0x31e923);};AGIChannel[_0x62bb('0x19')][_0x62bb('0x1a')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x62bb('0x19')][_0x62bb('0x1b')]=function(_0x2c3032,_0x5c9eb1,_0x8d4833){_0x2c3032=_0x2c3032===undefined?_0x62bb('0x1c'):_0x2c3032;_0x5c9eb1=_0x5c9eb1===undefined?'5':_0x5c9eb1;_0x8d4833=_0x8d4833===undefined?'1':_0x8d4833;return this[_0x62bb('0x1d')](util['format'](_0x62bb('0x1e'),_0x2c3032,_0x5c9eb1*0x3e8,_0x8d4833));};AGIChannel[_0x62bb('0x19')][_0x62bb('0x1f')]=function(_0x4145ad){_0x4145ad=_0x4145ad||_0x62bb('0x20');return this[_0x62bb('0x1d')](util[_0x62bb('0x21')](_0x62bb('0x22'),_0x4145ad));};AGIChannel[_0x62bb('0x19')][_0x62bb('0x23')]=function(_0x21d717,_0xd59602){if(_[_0x62bb('0x24')](_0xd59602)){return this[_0x62bb('0x1d')](util[_0x62bb('0x21')](_0x62bb('0x25'),_0x21d717,_0xd59602[_0x62bb('0x26')](',')));}return this[_0x62bb('0x1d')](util[_0x62bb('0x21')](_0x62bb('0x25'),_0x21d717,_0xd59602));};AGIChannel['prototype'][_0x62bb('0x27')]=function(_0x1cfb43){return this[_0x62bb('0x1d')](util[_0x62bb('0x21')](_0x62bb('0x28'),_0x1cfb43));};AGIChannel['prototype'][_0x62bb('0x29')]=function(_0x48abf1){return this[_0x62bb('0x1d')](util['format'](_0x62bb('0x2a'),_0x48abf1));};AGIChannel[_0x62bb('0x19')]['setPriority']=function(_0x5b9329){return this[_0x62bb('0x1d')](util[_0x62bb('0x21')](_0x62bb('0x2b'),_0x5b9329));};AGIChannel[_0x62bb('0x19')][_0x62bb('0xa')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x62bb('0x19')][_0x62bb('0x2c')]=function(_0x199ecf,_0x4904de){var _0x70c5dd=_[_0x62bb('0x2d')](_0x4904de)||_[_0x62bb('0x2e')](_0x4904de)?_0x4904de[_0x62bb('0x2f')]():_0x4904de;return this['sendRequest'](util[_0x62bb('0x21')](_0x62bb('0x30'),_0x199ecf,_0x70c5dd?_0x70c5dd[_0x62bb('0x2f')]()[_0x62bb('0xd')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x62bb('0x19')][_0x62bb('0x31')]=function(_0x2aab73,_0x1e7b8e){return this[_0x62bb('0x1d')](util[_0x62bb('0x21')](_0x62bb('0x32'),_0x2aab73,_0x1e7b8e));};AGIChannel[_0x62bb('0x19')][_0x62bb('0x33')]=function(_0x22f49b,_0x528d1f){return this[_0x62bb('0x1d')](util[_0x62bb('0x21')](_0x62bb('0x34'),_0x22f49b,_0x528d1f));};AGIChannel['prototype'][_0x62bb('0x35')]=function(_0xa7c26d,_0x45997a){return this[_0x62bb('0x1d')](util[_0x62bb('0x21')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xa7c26d,_0x45997a));};AGIChannel['prototype'][_0x62bb('0x36')]=function(_0x5816d7,_0x5674a5,_0x1c453a){_0x5674a5=_0x5674a5||this[_0x62bb('0x37')];_0x1c453a=_0x1c453a||0x1;this['setContext'](_0x5816d7);this[_0x62bb('0x29')](_0x5674a5);this[_0x62bb('0x38')](_0x1c453a);return this['noop'](util[_0x62bb('0x21')](_0x62bb('0x39'),_0x5816d7,_0x5674a5,_0x1c453a));};AGIChannel[_0x62bb('0x19')][_0x62bb('0x3a')]=function(_0x4e8388){return this[_0x62bb('0x1d')](util['format'](_0x62bb('0x3b'),_0x4e8388));};AGIChannel[_0x62bb('0x19')]['recordFile']=function(_0x3dbc6c,_0x4ed881,_0x291aae,_0x4d3b6e,_0x31bff7,_0x4d04c1){_0x4ed881=_0x4ed881||_0x62bb('0x3c');_0x291aae=_0x291aae||'';_0x4d3b6e=_0x4d3b6e===undefined?-0x1:_0x4d3b6e==='-1'?-0x1:_0x4d3b6e*0x3e8;_0x31bff7=_0x31bff7===undefined?'':'s='+_0x31bff7;_0x4d04c1=_0x4d04c1?_0x62bb('0x3d'):'';return this[_0x62bb('0x1d')](util[_0x62bb('0x21')](_0x62bb('0x3e'),_0x3dbc6c,_0x4ed881,_0x291aae,_0x4d3b6e,_0x4d04c1,_0x31bff7));};AGIChannel[_0x62bb('0x19')][_0x62bb('0x3f')]=function(_0x175343,_0x7f13da){_0x7f13da=_0x7f13da||'';return this[_0x62bb('0x1d')](util[_0x62bb('0x21')](_0x62bb('0x40'),_0x175343,_0x7f13da));};AGIChannel[_0x62bb('0x19')][_0x62bb('0x41')]=function(_0x10689e){return this[_0x62bb('0x23')]('AGI',_0x10689e);};AGIChannel[_0x62bb('0x19')][_0x62bb('0x42')]=function(_0x3993e7){return this['exec'](_0x62bb('0x43'),_0x3993e7);};AGIChannel[_0x62bb('0x19')][_0x62bb('0x12')]=function(_0x45a5fa,_0x4482f8){this[_0x62bb('0x1f')](util[_0x62bb('0x21')](_0x62bb('0x44'),_0x45a5fa['id'],_0x45a5fa[_0x62bb('0x45')],_0x4482f8));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xb657=['recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','setEncoding','emit','line','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','no\x20code','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','function','write','inherits','prototype','sendRequest','sync','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0xb657,0x150));var _0x7b65=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xb657[_0x1573ea];return _0x51c0e2;};'use strict';var util=require(_0x7b65('0x0'));var _=require(_0x7b65('0x1'));var EventEmitter=require(_0x7b65('0x2'))[_0x7b65('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x7b65('0x4'));function AGIChannel(_0x11b3d4){var _0x1489f0=this,_0x1ba76f=new AGIReply(),_0x1f5805=![],_0x3616d1={};EventEmitter[_0x7b65('0x5')](_0x1489f0);_0x11b3d4['setEncoding'](_0x7b65('0x6'));_0x11b3d4[_0x7b65('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1ba76f[_0x7b65('0x8')](_0x7b65('0x6'));_0x1ba76f['on']('headers',function(_0x1e3457){for(var _0x26eb78 in _0x1e3457){_0x1489f0[_0x26eb78]=_0x1e3457[_0x26eb78];}_0x1489f0[_0x7b65('0x9')]('ready');});_0x1ba76f['on'](_0x7b65('0xa'),function(_0x414202){if(_0x414202[_0x7b65('0xb')]()==_0x7b65('0xc')){_0x1489f0[_0x7b65('0x9')]('hangup');return;}if(_0x414202[_0x7b65('0xd')](0x0,0xb)=='520-Invalid'){_0x1f5805=!![];}if(_0x1f5805){_0x3616d1['rx']+=_0x414202+'\x0a';if(_0x414202['search'](_0x7b65('0xe'))!=-0x1){_0x1f5805=![];}}else{_0x3616d1['rx']=_0x414202;}if(_0x1f5805){return;}if(typeof _0x3616d1['cb']=='function'){var _0x454263=_0x3616d1['rx'][_0x7b65('0xd')](0x0,0x3),_0x356103=null,_0x3c86a4=null;_0x454263=parseInt(_0x454263);if(isNaN(_0x454263)){_0x3616d1['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7b65('0xf')});return;}if(_0x454263!=0xc8){_0x3616d1['cb'](null,{'code':_0x454263,'result':-0x1,'extra':'KO'});return;}_0x356103=_0x3616d1['rx']['substring'](0x4)['replace']('result=','');if(_0x356103[_0x7b65('0x10')]('\x20')!=-0x1){_0x356103=_0x356103['substr'](0x0,_0x356103['indexOf']('\x20'));}if(_[_0x7b65('0x11')](_0x356103,'-1')){_0x356103=parseInt(_0x356103);}_0x3c86a4=_0x3616d1['rx'][_0x7b65('0x12')]('\x20');if(_0x3c86a4[_0x7b65('0x13')]==0x3){_0x3c86a4=_0x3c86a4[0x2][_0x7b65('0xd')](0x1,_0x3c86a4[0x2][_0x7b65('0x13')]-0x1);}else if(_0x3c86a4[_0x7b65('0x13')]>0x3){var _0x39d1a3=/\((.+)\)/;var _0x9a878e=_0x3616d1['rx'][_0x7b65('0x14')](_0x39d1a3);if(_0x9a878e){_0x3c86a4=_0x9a878e[0x1];}else{_0x3c86a4=null;}}else{_0x3c86a4=null;}_0x3616d1['cb'](null,{'code':_0x454263,'result':_0x356103,'extra':_0x3c86a4});}});_0x11b3d4['on'](_0x7b65('0x15'),function(_0x3e7a97){_0x1489f0[_0x7b65('0x9')]('error',new AGIError(_0x7b65('0x16'),_0x3e7a97[_0x7b65('0x17')]));});_0x11b3d4['on'](_0x7b65('0x18'),function(){_0x1489f0[_0x7b65('0x9')]('close',new AGIError(_0x7b65('0x19')));});_0x11b3d4['on'](_0x7b65('0x1a'),function(){_0x1489f0[_0x7b65('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x11b3d4[_0x7b65('0x1b')]();});_0x11b3d4[_0x7b65('0x1c')](_0x1ba76f);this[_0x7b65('0x1d')]=function(_0x4353cb,_0x28add0){var _0x4353cb=_0x4353cb||'',_0x28add0=typeof _0x28add0==_0x7b65('0x1e')?_0x28add0:new Function();_0x3616d1={'tx':_0x4353cb,'rx':'','cb':_0x28add0};_0x11b3d4[_0x7b65('0x1f')](_0x4353cb+'\x0a');},this[_0x7b65('0x18')]=function(){_0x11b3d4[_0x7b65('0x1b')]();};}util[_0x7b65('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x7b65('0x21')][_0x7b65('0x22')]=function(_0x1789db){return this[_0x7b65('0x1d')][_0x7b65('0x23')](this,_0x1789db);};AGIChannel[_0x7b65('0x21')]['answer']=function(){return this[_0x7b65('0x22')](_0x7b65('0x24'));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x25')]=function(_0x48b6eb,_0x5a6cf6,_0x184e76){_0x48b6eb=_0x48b6eb===undefined?_0x7b65('0x26'):_0x48b6eb;_0x5a6cf6=_0x5a6cf6===undefined?'5':_0x5a6cf6;_0x184e76=_0x184e76===undefined?'1':_0x184e76;return this[_0x7b65('0x22')](util[_0x7b65('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x48b6eb,_0x5a6cf6*0x3e8,_0x184e76));};AGIChannel['prototype'][_0x7b65('0x28')]=function(_0x4a6408){_0x4a6408=_0x4a6408||_0x7b65('0x29');return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x2a'),_0x4a6408));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x2b')]=function(_0x3ebfce,_0x216c88){if(_[_0x7b65('0x2c')](_0x216c88)){return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x2d'),_0x3ebfce,_0x216c88[_0x7b65('0x2e')](',')));}return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x2d'),_0x3ebfce,_0x216c88));};AGIChannel[_0x7b65('0x21')]['setContext']=function(_0x49e3eb){return this[_0x7b65('0x22')](util['format']('SET\x20CONTEXT\x20%s',_0x49e3eb));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x2f')]=function(_0x3be95){return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x30'),_0x3be95));};AGIChannel['prototype'][_0x7b65('0x31')]=function(_0x339bf9){return this[_0x7b65('0x22')](util['format'](_0x7b65('0x32'),_0x339bf9));};AGIChannel[_0x7b65('0x21')][_0x7b65('0xc')]=function(){return this[_0x7b65('0x22')](_0x7b65('0x33'));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x34')]=function(_0x23e9b7,_0x467f29){var _0x136e27=_[_0x7b65('0x35')](_0x467f29)||_[_0x7b65('0x36')](_0x467f29)?_0x467f29[_0x7b65('0x37')]():_0x467f29;return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x38'),_0x23e9b7,_0x136e27?_0x136e27[_0x7b65('0x37')]()[_0x7b65('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3a')]=function(_0x39c97d,_0x27267d){return this['sendRequest'](util['format'](_0x7b65('0x3b'),_0x39c97d,_0x27267d));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3c')]=function(_0x35afc0,_0x167062){return this[_0x7b65('0x22')](util['format'](_0x7b65('0x3d'),_0x35afc0,_0x167062));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3e')]=function(_0xf87fde,_0xe31bc6){return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x3f'),_0xf87fde,_0xe31bc6));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x40')]=function(_0xabc38b,_0x47f719,_0x4e0e9b){_0x47f719=_0x47f719||this['extension'];_0x4e0e9b=_0x4e0e9b||0x1;this[_0x7b65('0x41')](_0xabc38b);this[_0x7b65('0x2f')](_0x47f719);this['setPriority'](_0x4e0e9b);return this[_0x7b65('0x28')](util[_0x7b65('0x27')](_0x7b65('0x42'),_0xabc38b,_0x47f719,_0x4e0e9b));};AGIChannel['prototype'][_0x7b65('0x43')]=function(_0x39e729){return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x44'),_0x39e729));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x45')]=function(_0x2afd32,_0x54b55a,_0x564a56,_0x20b175,_0x19aa39,_0x482d2c){_0x54b55a=_0x54b55a||_0x7b65('0x46');_0x564a56=_0x564a56||'';_0x20b175=_0x20b175===undefined?-0x1:_0x20b175==='-1'?-0x1:_0x20b175*0x3e8;_0x19aa39=_0x19aa39===undefined?'':'s='+_0x19aa39;_0x482d2c=_0x482d2c?_0x7b65('0x47'):'';return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x48'),_0x2afd32,_0x54b55a,_0x564a56,_0x20b175,_0x482d2c,_0x19aa39));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x49')]=function(_0x5a25b8,_0x15d3a1){_0x15d3a1=_0x15d3a1||'';return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x4a'),_0x5a25b8,_0x15d3a1));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x4b')]=function(_0x27684a){return this[_0x7b65('0x2b')](_0x7b65('0x4c'),_0x27684a);};AGIChannel['prototype'][_0x7b65('0x4d')]=function(_0x13211f){return this[_0x7b65('0x2b')](_0x7b65('0x4e'),_0x13211f);};AGIChannel['prototype'][_0x7b65('0x15')]=function(_0x13adcd,_0x23bf51){this['noop'](util[_0x7b65('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x13adcd['id'],_0x13adcd[_0x7b65('0x4f')],_0x23bf51));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7b65('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 1093082..5b8be3b 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 _0x4727=['name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[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','apply','message'];(function(_0x55ab04,_0x180da3){var _0x1a4daa=function(_0x4d3111){while(--_0x4d3111){_0x55ab04['push'](_0x55ab04['shift']());}};_0x1a4daa(++_0x180da3);}(_0x4727,0x1ef));var _0x7472=function(_0x423262,_0x3a912b){_0x423262=_0x423262-0x0;var _0x4d1da4=_0x4727[_0x423262];return _0x4d1da4;};'use strict';var util=require(_0x7472('0x0'));var error={'E_AGI_UNDEFINED':_0x7472('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x7472('0x2'),'E_AGI_SERVER_CLOSE':_0x7472('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x7472('0x4'),'E_AGI_SOCKET_ERROR':_0x7472('0x5'),'E_AGI_SOCKET_CLOSE':_0x7472('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x7472('0x7'),'E_AGI_COMMAND_EMPTY':_0x7472('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7472('0x9'),'E_AGI_IVR_ENTRY':_0x7472('0xa')};function AGIError(_0x19667a){var _0x19667a=_0x19667a||null,_0x96d4f6=_0x96d4f6||[],_0x54cd12=0x1,_0x5334d9='';if(!error[_0x19667a]){_0x19667a=_0x7472('0xb');}_0x96d4f6[_0x7472('0xc')](error[_0x19667a]);while(arguments[_0x54cd12]){_0x96d4f6[_0x7472('0xc')](arguments[_0x54cd12]);_0x54cd12++;}_0x5334d9=util['format'][_0x7472('0xd')](util,_0x96d4f6);this[_0x7472('0xe')]=_0x5334d9;this[_0x7472('0xf')]=_0x19667a;}module[_0x7472('0x10')]=AGIError; \ No newline at end of file +var _0x7be7=['push','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x3d53c7,_0x2ea53c){var _0x51d6d8=function(_0x137919){while(--_0x137919){_0x3d53c7['push'](_0x3d53c7['shift']());}};_0x51d6d8(++_0x2ea53c);}(_0x7be7,0xdd));var _0x77be=function(_0x46de8b,_0x5a7a6b){_0x46de8b=_0x46de8b-0x0;var _0x3a0190=_0x7be7[_0x46de8b];return _0x3a0190;};'use strict';var util=require(_0x77be('0x0'));var error={'E_AGI_UNDEFINED':_0x77be('0x1'),'E_AGI_ARGUMENT_PORT':_0x77be('0x2'),'E_AGI_SERVER_ERROR':_0x77be('0x3'),'E_AGI_SERVER_CLOSE':_0x77be('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x77be('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x77be('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x57bd76){var _0x57bd76=_0x57bd76||null,_0x3903e1=_0x3903e1||[],_0x2ee153=0x1,_0x262389='';if(!error[_0x57bd76]){_0x57bd76='E_AGI_UNDEFINED';}_0x3903e1[_0x77be('0x7')](error[_0x57bd76]);while(arguments[_0x2ee153]){_0x3903e1[_0x77be('0x7')](arguments[_0x2ee153]);_0x2ee153++;}_0x262389=util[_0x77be('0x8')][_0x77be('0x9')](util,_0x3903e1);this[_0x77be('0xa')]=_0x262389;this[_0x77be('0xb')]=_0x57bd76;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index bf31866..d0ecf58 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 _0x74f5=['agicommand','target','default','menu','invalid','traverseBFS','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','relations','getVertex','no\x20vertex\x20found','info','stop\x20traverse','no\x20edge/s\x20available','length','condition','split'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0x74f5,0xb1));var _0x574f=function(_0x4cea31,_0x54ef05){_0x4cea31=_0x4cea31-0x0;var _0x30bf16=_0x74f5[_0x4cea31];return _0x30bf16;};'use strict';var _=require(_0x574f('0x0'));var logger=require(_0x574f('0x1'))(_0x574f('0x2'));var verticesWithRetry=['menu',_0x574f('0x3'),_0x574f('0x4')];var Graph=function(){this[_0x574f('0x5')]={};this[_0x574f('0x6')]={};this[_0x574f('0x7')]=0x0;};Graph[_0x574f('0x8')]['addVertex']=function(_0x1291e5){this['vertices'][_0x1291e5['id']]=_0x1291e5;this[_0x574f('0x6')][_0x1291e5['id']]=[];};Graph['prototype'][_0x574f('0x9')]=function(_0x43a3b8,_0x3fd840,_0x2fcc06){this['edges'][_0x43a3b8][_0x574f('0xa')]({'target':_0x3fd840,'condition':_0x2fcc06});this[_0x574f('0x7')]+=0x1;};Graph[_0x574f('0x8')]['size']=function(){return _[_0x574f('0xb')](this[_0x574f('0x5')]);};Graph[_0x574f('0x8')][_0x574f('0xc')]=function(){return this[_0x574f('0x7')];};Graph['prototype'][_0x574f('0xd')]=function(_0x1c72d5){return this[_0x574f('0x5')][_0x1c72d5];};Graph[_0x574f('0x8')]['traverseBFS']=function(_0x2630f1,_0x5bca23){if(!this[_0x574f('0x5')][_0x2630f1]){return logger['info'](_0x574f('0xe'));}var _0x467f27=_0x5bca23(this[_0x574f('0x5')][_0x2630f1]);if(!_0x467f27){return logger[_0x574f('0xf')](_0x574f('0x10'));}if(this[_0x574f('0x6')][_0x2630f1]['length']===0x0){return logger[_0x574f('0xf')](_0x574f('0x11'));}for(var _0x21e684=0x0,_0x3b8935=[],_0x53c544=![];_0x21e684\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','indexOf','agi_','substring','inspect','debug','variables','stringify','hangup','sync','production','start','root','joinAt','omit','traverseBFS','vertex','context','extension','priority','response','isUndefined','result','toString','agicommand\x20not\x20found','finally','clear','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log'];(function(_0x552204,_0x222864){var _0x24988d=function(_0x5d893b){while(--_0x5d893b){_0x552204['push'](_0x552204['shift']());}};_0x24988d(++_0x222864);}(_0x3ef5,0x15e));var _0x53ef=function(_0x4ab18e,_0x30724a){_0x4ab18e=_0x4ab18e-0x0;var _0x24ef0a=_0x3ef5[_0x4ab18e];return _0x24ef0a;};'use strict';var parser=require(_0x53ef('0x0'));var _=require(_0x53ef('0x1'));var syncho=require(_0x53ef('0x2'));var util=require(_0x53ef('0x3'));var moment=require(_0x53ef('0x4'));var config=require(_0x53ef('0x5'));var logger=require(_0x53ef('0x6'))(_0x53ef('0x7'));var utilLicense=require(_0x53ef('0x8'));var rpc=require(_0x53ef('0x9'));var mailRpc=require('./mailRpc');var Graph=require(_0x53ef('0xa'));var Vertices=require(_0x53ef('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x53ef('0x7')]=_[_0x53ef('0xc')](config[_0x53ef('0x7')],{'ip':_0x53ef('0xd'),'port':0x11dd});function connectionHandler(_0x478d05){process[_0x53ef('0xe')](function(){syncho(function(){try{setChannelVariables(_0x478d05);agiHandler(_0x478d05);}catch(_0x561b4d){logger[_0x53ef('0xf')](_0x561b4d[_0x53ef('0x10')]);}});});}function listeningHandler(){console[_0x53ef('0x11')](_0x53ef('0x12'),config['agi'][_0x53ef('0x13')]);logger['info'](util[_0x53ef('0x14')](_0x53ef('0x15'),config[_0x53ef('0x7')]['ip'],config[_0x53ef('0x7')]['port']));}function errorHandler(_0x588448){if(_0x588448&&_0x588448[_0x53ef('0x16')]&&_0x588448[_0x53ef('0x17')]){logger[_0x53ef('0xf')](util[_0x53ef('0x14')](_0x53ef('0x18'),_0x588448[_0x53ef('0x16')],_0x588448[_0x53ef('0x17')]));}else{logger[_0x53ef('0xf')](util[_0x53ef('0x14')](_0x53ef('0x19'),_0x588448[_0x53ef('0x10')]));}}function closeHandler(){logger[_0x53ef('0x1a')](util[_0x53ef('0x14')](_0x53ef('0x1b'),this[_0x53ef('0x1c')],this[_0x53ef('0x1d')],this['callerid'],this[_0x53ef('0x1e')],this[_0x53ef('0x1f')]));try{createSquareReport(this);}catch(_0x2b78ea){logger[_0x53ef('0xf')](_0x2b78ea[_0x53ef('0x10')]);}}function timeoutHandler(){logger['info'](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x53ef('0x20')],this[_0x53ef('0x1e')],this[_0x53ef('0x1f')]));}function hangupHandler(){logger[_0x53ef('0x1a')](util['format'](_0x53ef('0x21'),this[_0x53ef('0x1c')],this[_0x53ef('0x1d')],this[_0x53ef('0x20')],this[_0x53ef('0x1e')],this[_0x53ef('0x1f')]));this[_0x53ef('0x22')]=!![];}function getRoot(_0x9671db){return parser[_0x53ef('0x23')](_0x9671db,{'object':!![]})[_0x53ef('0x24')]['root'];}function addVertex(_0x557bf6,_0x29af21,_0x2288e3){_0x29af21[_0x53ef('0x25')]=_0x2288e3;if(_0x29af21[_0x53ef('0x26')](_0x53ef('0x27'))){_0x29af21[_0x53ef('0x28')]=parseInt(_0x29af21[_0x53ef('0x27')],0xa);}_0x557bf6[_0x53ef('0x29')](_['omit'](_0x29af21,_0x53ef('0x2a')));}function initGraph(_0x211146,_0x4c87c1){var _0x1e7db7=new Graph();for(var _0x59e0dc in _0x211146){if(_0x211146[_0x53ef('0x26')](_0x59e0dc)){if(_[_0x53ef('0x2b')](_0x211146[_0x59e0dc])){for(var _0x2cd2b1=0x0;_0x2cd2b1<_0x211146[_0x59e0dc][_0x53ef('0x2c')];_0x2cd2b1+=0x1){addVertex(_0x1e7db7,_0x211146[_0x59e0dc][_0x2cd2b1],_0x59e0dc);}}else{addVertex(_0x1e7db7,_0x211146[_0x59e0dc],_0x59e0dc);}}}for(var _0x6900a4=0x0;_0x6900a4<_0x4c87c1[_0x53ef('0x2c')];_0x6900a4+=0x1){if(_0x4c87c1[_0x6900a4]['source']&&_0x4c87c1[_0x6900a4][_0x53ef('0x2d')]){_0x1e7db7[_0x53ef('0x2e')](_0x4c87c1[_0x6900a4][_0x53ef('0x2f')],_0x4c87c1[_0x6900a4]['target'],_0x4c87c1[_0x6900a4][_0x53ef('0x30')]);}}return _0x1e7db7;}function getSquareProject(_0x5e50c6,_0x1b4f0a){rpc[_0x53ef('0x31')](_0x5e50c6)[_0x53ef('0x32')](function(_0x5ec243){_0x1b4f0a(null,_0x5ec243);})['catch'](function(_0x3e33c7){_0x1b4f0a(null,_0x3e33c7);});}function createSquareReport(_0x25ecf1,_0xaaa97a){rpc['createSquareReport'](_0x25ecf1)[_0x53ef('0x32')](function(_0x3a8d00){if(_0xaaa97a){_0xaaa97a(null,_0x3a8d00);}})[_0x53ef('0x33')](function(_0x3299ff){if(_0xaaa97a){_0xaaa97a(null,_0x3299ff);}});}function setChannelVariables(_0x30526d){for(var _0x3471fc in _0x30526d){if(_0x30526d['hasOwnProperty'](_0x3471fc)){if(_0x3471fc[_0x53ef('0x34')](_0x53ef('0x35'))===0x0){_0x30526d[_0x3471fc[_0x53ef('0x36')](0x4)]=_0x30526d[_0x3471fc];delete _0x30526d[_0x3471fc];}}}}function getLogFromObject(_0x29f04a){return util[_0x53ef('0x37')](_0x29f04a,{'showHidden':![],'depth':null});}function agiHandler(_0x5af854){var _0xd6fdc6,_0x23e321,_0x213782,_0x17472b,_0x3243a0;logger[_0x53ef('0x38')](_0x53ef('0x39'),JSON[_0x53ef('0x3a')](_0x5af854,null,0x2));logger[_0x53ef('0x1a')](util[_0x53ef('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5af854[_0x53ef('0x1c')],_0x5af854[_0x53ef('0x1d')],_0x5af854[_0x53ef('0x20')],_0x5af854[_0x53ef('0x1e')],_0x5af854[_0x53ef('0x1f')]));_0x5af854['on']('error',errorHandler);_0x5af854['on']('close',closeHandler);_0x5af854['on']('timeout',timeoutHandler);_0x5af854[_0x53ef('0x22')]=![];_0x5af854['on'](_0x53ef('0x3b'),hangupHandler);var _0x256505=getSquareProject[_0x53ef('0x3c')](null,_0x5af854['arg_1']);if(_0x256505){if(_0x256505[_0x53ef('0x3d')]){_0xd6fdc6=getRoot(_0x256505[_0x53ef('0x3d')]);if(_0xd6fdc6&&_0xd6fdc6[_0x53ef('0x3e')]){logger['debug'](_0x53ef('0x3f'),JSON['stringify'](_0xd6fdc6,null,0x2));_0x5af854[_0x53ef('0x40')]=moment()[_0x53ef('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x23e321=initGraph(_[_0x53ef('0x41')](_0xd6fdc6,_0x53ef('0x2a')),_0xd6fdc6['mxCell']);_0x213782=new Vertices(_0x5af854,rpc,mailRpc);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5af854[_0x53ef('0x1c')],_0x5af854[_0x53ef('0x1d')],_0x5af854[_0x53ef('0x20')],_0x5af854['dnid'],_0x5af854['uniqueid']));_0x23e321[_0x53ef('0x42')](_0xd6fdc6[_0x53ef('0x3e')]['id'],function(_0x3478eb){try{_0x3478eb=_0x213782['clear'](_0x3478eb);logger[_0x53ef('0x38')](_0x53ef('0x43'),JSON[_0x53ef('0x3a')](_0x3478eb,null,0x2));if(_0x3478eb[_0x53ef('0x25')]==='gotoc'){logger[_0x53ef('0x1a')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5af854['context']=_0x3478eb['context']||_0x5af854[_0x53ef('0x44')];_0x5af854[_0x53ef('0x45')]=_0x3478eb[_0x53ef('0x45')];_0x5af854['priority']=_0x3478eb[_0x53ef('0x46')]?_0x3478eb[_0x53ef('0x46')]-0x1:0x1;return null;}else if(_0x3478eb&&_0x213782[_0x3478eb['agicommand']]){_0x3243a0=_0x213782[_0x3478eb[_0x53ef('0x25')]](_0x3478eb);logger['info'](_0x53ef('0x47'),JSON[_0x53ef('0x3a')](_0x3243a0,null,0x2));if(_0x3243a0&&_0x3243a0['code']===AGI_CODE_SUCCESS&&_0x3243a0['result']!==AGI_RESULT_ERROR&&!_0x5af854['evtHangup']){logger['debug'](_0x53ef('0x47'),getLogFromObject(_0x3243a0));return _[_0x53ef('0x48')](_0x3243a0[_0x53ef('0x49')])?null:_0x3243a0[_0x53ef('0x49')][_0x53ef('0x4a')]();}else{logger[_0x53ef('0xf')]('response',getLogFromObject(_0x3243a0));return null;}}else{logger['error'](_0x53ef('0x4b'));return null;}}catch(_0x3fb6c2){logger[_0x53ef('0xf')](_0x3fb6c2[_0x53ef('0x10')]);return null;}});if(_0xd6fdc6[_0x53ef('0x4c')]){logger['info'](util[_0x53ef('0x14')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5af854[_0x53ef('0x1c')],_0x5af854[_0x53ef('0x1d')],_0x5af854['callerid'],_0x5af854['dnid'],_0x5af854[_0x53ef('0x1f')]));_0x23e321[_0x53ef('0x42')](_0xd6fdc6['finally']['id'],function(_0x12a400){try{_0x12a400=_0x213782[_0x53ef('0x4d')](_0x12a400);logger[_0x53ef('0x38')](_0x53ef('0x43'),JSON['stringify'](_0x12a400,null,0x2));if(_0x12a400&&_0x213782[_0x12a400['agicommand']]){_0x3243a0=_0x213782[_0x12a400[_0x53ef('0x25')]](_0x12a400);if(_0x3243a0){logger[_0x53ef('0x38')]('response',getLogFromObject(_0x3243a0));return _[_0x53ef('0x48')](_0x3243a0['result'])?null:_0x3243a0[_0x53ef('0x49')]['toString']();}else{logger['error'](_0x53ef('0x47'),getLogFromObject(_0x3243a0));return null;}}else{logger[_0x53ef('0xf')](_0x53ef('0x4b'));return null;}}catch(_0x133c41){logger[_0x53ef('0xf')](_0x133c41[_0x53ef('0x10')]);return null;}});}logger[_0x53ef('0x1a')](util[_0x53ef('0x14')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5af854[_0x53ef('0x1c')],_0x5af854[_0x53ef('0x1d')],_0x5af854[_0x53ef('0x20')],_0x5af854[_0x53ef('0x1e')],_0x5af854['uniqueid']));logger[_0x53ef('0x1a')](util[_0x53ef('0x14')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5af854['context'],_0x5af854[_0x53ef('0x45')],parseInt(_0x5af854[_0x53ef('0x46')],0xa)+0x1));_0x5af854[_0x53ef('0x4e')](_0x5af854[_0x53ef('0x44')],_0x5af854[_0x53ef('0x45')],parseInt(_0x5af854[_0x53ef('0x46')],0xa)+0x1);_0x5af854[_0x53ef('0x4f')]();}}else{logger[_0x53ef('0xf')](util[_0x53ef('0x14')](_0x53ef('0x50'),_0x5af854[_0x53ef('0x1c')]));_0x5af854[_0x53ef('0x4e')](_0x5af854['context'],_0x5af854['extension'],parseInt(_0x5af854[_0x53ef('0x46')],0xa)+0x1);_0x5af854[_0x53ef('0x4f')]();}}else{logger[_0x53ef('0xf')](util['format'](_0x53ef('0x51'),_0x5af854['arg_1']));_0x5af854['continueAt'](_0x5af854[_0x53ef('0x44')],_0x5af854[_0x53ef('0x45')],parseInt(_0x5af854[_0x53ef('0x46')],0xa)+0x1);_0x5af854['close']();}}function main(){var _0x28eb29;return utilLicense[_0x53ef('0x52')]()[_0x53ef('0x32')](function(_0x1eae36){if(_0x1eae36){if(_0x1eae36[_0x53ef('0x53')]){if(_0x1eae36['callysquare']&&_0x1eae36[_0x53ef('0x54')]>0x0){logger[_0x53ef('0x1a')](util[_0x53ef('0x14')](_0x53ef('0x55'),_0x1eae36[_0x53ef('0x54')]));_0x28eb29=_0x1eae36[_0x53ef('0x54')];}else{logger['info'](_0x53ef('0x56'));}}else{logger[_0x53ef('0x1a')](_0x53ef('0x57'));_0x28eb29=-0x1;}}})['catch'](function(_0x19b43b){logger['error'](_0x53ef('0x58'),_0x19b43b[_0x53ef('0x10')]);})[_0x53ef('0x4c')](function(){var _0x285ea4=require(_0x53ef('0x59'))(config[_0x53ef('0x7')]['port'],config[_0x53ef('0x7')]['ip'],_0x28eb29);_0x285ea4['on']('error',errorHandler);_0x285ea4['on'](_0x53ef('0x5a'),listeningHandler);_0x285ea4['on'](_0x53ef('0x5b'),connectionHandler);_0x285ea4['on'](_0x53ef('0x4f'),closeHandler);});}main(); \ No newline at end of file +var _0x41d9=['addEdge','value','getSquareProject','catch','createSquareReport','then','indexOf','agi_','substring','inspect','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','connection','xml2json','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson','mxGraphModel','root','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target'];(function(_0x5d89cf,_0xfd052d){var _0x5a4ef1=function(_0x17fecf){while(--_0x17fecf){_0x5d89cf['push'](_0x5d89cf['shift']());}};_0x5a4ef1(++_0xfd052d);}(_0x41d9,0x148));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require(_0x941d('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0x941d('0x1'));var moment=require(_0x941d('0x2'));var config=require(_0x941d('0x3'));var logger=require(_0x941d('0x4'))('agi');var utilLicense=require(_0x941d('0x5'));var rpc=require(_0x941d('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0x941d('0x7'));var Vertices=require(_0x941d('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x941d('0x9')]=_[_0x941d('0xa')](config[_0x941d('0x9')],{'ip':_0x941d('0xb'),'port':0x11dd});function connectionHandler(_0x4bb82b){process[_0x941d('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4bb82b);agiHandler(_0x4bb82b);}catch(_0x144211){logger[_0x941d('0xd')](_0x144211['stack']);}});});}function listeningHandler(){console[_0x941d('0xe')](_0x941d('0xf'),config[_0x941d('0x9')]['port']);logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x12'),config[_0x941d('0x9')]['ip'],config[_0x941d('0x9')][_0x941d('0x13')]));}function errorHandler(_0x30b079){if(_0x30b079&&_0x30b079[_0x941d('0x14')]&&_0x30b079[_0x941d('0x15')]){logger[_0x941d('0xd')](util[_0x941d('0x11')](_0x941d('0x16'),_0x30b079['name'],_0x30b079[_0x941d('0x15')]));}else{logger[_0x941d('0xd')](util[_0x941d('0x11')](_0x941d('0x17'),_0x30b079[_0x941d('0x18')]));}}function closeHandler(){logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x19'),this[_0x941d('0x1a')],this[_0x941d('0x1b')],this['callerid'],this[_0x941d('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x43a0b3){logger[_0x941d('0xd')](_0x43a0b3[_0x941d('0x18')]);}}function timeoutHandler(){logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x1d'),this['arg_1'],this[_0x941d('0x1b')],this[_0x941d('0x1e')],this[_0x941d('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x1f'),this[_0x941d('0x1a')],this[_0x941d('0x1b')],this[_0x941d('0x1e')],this[_0x941d('0x1c')],this[_0x941d('0x20')]));this[_0x941d('0x21')]=!![];}function getRoot(_0x497989){return parser[_0x941d('0x22')](_0x497989,{'object':!![]})[_0x941d('0x23')][_0x941d('0x24')];}function addVertex(_0xc3f65e,_0x467639,_0x24deb7){_0x467639[_0x941d('0x25')]=_0x24deb7;if(_0x467639['hasOwnProperty'](_0x941d('0x26'))){_0x467639[_0x941d('0x27')]=parseInt(_0x467639[_0x941d('0x26')],0xa);}_0xc3f65e[_0x941d('0x28')](_[_0x941d('0x29')](_0x467639,_0x941d('0x2a')));}function initGraph(_0x12443f,_0x2de0a5){var _0x4dd2a5=new Graph();for(var _0x13a93a in _0x12443f){if(_0x12443f[_0x941d('0x2b')](_0x13a93a)){if(_[_0x941d('0x2c')](_0x12443f[_0x13a93a])){for(var _0x25fd47=0x0;_0x25fd47<_0x12443f[_0x13a93a][_0x941d('0x2d')];_0x25fd47+=0x1){addVertex(_0x4dd2a5,_0x12443f[_0x13a93a][_0x25fd47],_0x13a93a);}}else{addVertex(_0x4dd2a5,_0x12443f[_0x13a93a],_0x13a93a);}}}for(var _0x47f430=0x0;_0x47f430<_0x2de0a5['length'];_0x47f430+=0x1){if(_0x2de0a5[_0x47f430][_0x941d('0x2e')]&&_0x2de0a5[_0x47f430][_0x941d('0x2f')]){_0x4dd2a5[_0x941d('0x30')](_0x2de0a5[_0x47f430][_0x941d('0x2e')],_0x2de0a5[_0x47f430]['target'],_0x2de0a5[_0x47f430][_0x941d('0x31')]);}}return _0x4dd2a5;}function getSquareProject(_0x3c4df5,_0x253435){rpc[_0x941d('0x32')](_0x3c4df5)['then'](function(_0x24080f){_0x253435(null,_0x24080f);})[_0x941d('0x33')](function(_0x35bbdf){_0x253435(null,_0x35bbdf);});}function createSquareReport(_0x29d116,_0x383821){rpc[_0x941d('0x34')](_0x29d116)[_0x941d('0x35')](function(_0x254631){if(_0x383821){_0x383821(null,_0x254631);}})[_0x941d('0x33')](function(_0x599d54){if(_0x383821){_0x383821(null,_0x599d54);}});}function setChannelVariables(_0x2dff0d){for(var _0x39ce54 in _0x2dff0d){if(_0x2dff0d[_0x941d('0x2b')](_0x39ce54)){if(_0x39ce54[_0x941d('0x36')](_0x941d('0x37'))===0x0){_0x2dff0d[_0x39ce54[_0x941d('0x38')](0x4)]=_0x2dff0d[_0x39ce54];delete _0x2dff0d[_0x39ce54];}}}}function getLogFromObject(_0x3bedf7){return util[_0x941d('0x39')](_0x3bedf7,{'showHidden':![],'depth':null});}function agiHandler(_0x1c5314){var _0x3ad6e4,_0x36a751,_0x575545,_0x5ab340,_0x522ee5;logger[_0x941d('0x3a')]('variables',JSON['stringify'](_0x1c5314,null,0x2));logger['info'](util['format'](_0x941d('0x3b'),_0x1c5314[_0x941d('0x1a')],_0x1c5314[_0x941d('0x1b')],_0x1c5314[_0x941d('0x1e')],_0x1c5314[_0x941d('0x1c')],_0x1c5314[_0x941d('0x20')]));_0x1c5314['on'](_0x941d('0xd'),errorHandler);_0x1c5314['on'](_0x941d('0x3c'),closeHandler);_0x1c5314['on'](_0x941d('0x3d'),timeoutHandler);_0x1c5314[_0x941d('0x21')]=![];_0x1c5314['on'](_0x941d('0x3e'),hangupHandler);var _0x1bf4cf=getSquareProject[_0x941d('0x3f')](null,_0x1c5314['arg_1']);if(_0x1bf4cf){if(_0x1bf4cf[_0x941d('0x40')]){_0x3ad6e4=getRoot(_0x1bf4cf[_0x941d('0x40')]);if(_0x3ad6e4&&_0x3ad6e4[_0x941d('0x41')]){logger[_0x941d('0x3a')](_0x941d('0x24'),JSON[_0x941d('0x42')](_0x3ad6e4,null,0x2));_0x1c5314[_0x941d('0x43')]=moment()['format'](_0x941d('0x44'));_0x36a751=initGraph(_[_0x941d('0x29')](_0x3ad6e4,_0x941d('0x2a')),_0x3ad6e4[_0x941d('0x2a')]);_0x575545=new Vertices(_0x1c5314,rpc,mailRpc);logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x45'),_0x1c5314[_0x941d('0x1a')],_0x1c5314['calleridname'],_0x1c5314['callerid'],_0x1c5314[_0x941d('0x1c')],_0x1c5314['uniqueid']));_0x36a751[_0x941d('0x46')](_0x3ad6e4[_0x941d('0x41')]['id'],function(_0x3d550a){try{_0x3d550a=_0x575545['clear'](_0x3d550a);logger[_0x941d('0x3a')](_0x941d('0x47'),JSON[_0x941d('0x42')](_0x3d550a,null,0x2));if(_0x3d550a[_0x941d('0x25')]==='gotoc'){logger['info'](_0x941d('0x48'));_0x1c5314['context']=_0x3d550a[_0x941d('0x49')]||_0x1c5314['context'];_0x1c5314[_0x941d('0x4a')]=_0x3d550a['extension'];_0x1c5314[_0x941d('0x4b')]=_0x3d550a[_0x941d('0x4b')]?_0x3d550a[_0x941d('0x4b')]-0x1:0x1;return null;}else if(_0x3d550a&&_0x575545[_0x3d550a[_0x941d('0x25')]]){_0x522ee5=_0x575545[_0x3d550a[_0x941d('0x25')]](_0x3d550a);logger[_0x941d('0x10')](_0x941d('0x4c'),JSON[_0x941d('0x42')](_0x522ee5,null,0x2));if(_0x522ee5&&_0x522ee5[_0x941d('0x4d')]===AGI_CODE_SUCCESS&&_0x522ee5['result']!==AGI_RESULT_ERROR&&!_0x1c5314[_0x941d('0x21')]){logger[_0x941d('0x3a')](_0x941d('0x4c'),getLogFromObject(_0x522ee5));return _[_0x941d('0x4e')](_0x522ee5[_0x941d('0x4f')])?null:_0x522ee5[_0x941d('0x4f')][_0x941d('0x50')]();}else{logger[_0x941d('0xd')](_0x941d('0x4c'),getLogFromObject(_0x522ee5));return null;}}else{logger[_0x941d('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x31bf20){logger[_0x941d('0xd')](_0x31bf20[_0x941d('0x18')]);return null;}});if(_0x3ad6e4[_0x941d('0x51')]){logger['info'](util[_0x941d('0x11')](_0x941d('0x52'),_0x1c5314[_0x941d('0x1a')],_0x1c5314[_0x941d('0x1b')],_0x1c5314[_0x941d('0x1e')],_0x1c5314[_0x941d('0x1c')],_0x1c5314['uniqueid']));_0x36a751['traverseBFS'](_0x3ad6e4[_0x941d('0x51')]['id'],function(_0x5deec5){try{_0x5deec5=_0x575545['clear'](_0x5deec5);logger['debug'](_0x941d('0x47'),JSON['stringify'](_0x5deec5,null,0x2));if(_0x5deec5&&_0x575545[_0x5deec5[_0x941d('0x25')]]){_0x522ee5=_0x575545[_0x5deec5['agicommand']](_0x5deec5);if(_0x522ee5){logger[_0x941d('0x3a')](_0x941d('0x4c'),getLogFromObject(_0x522ee5));return _[_0x941d('0x4e')](_0x522ee5[_0x941d('0x4f')])?null:_0x522ee5[_0x941d('0x4f')][_0x941d('0x50')]();}else{logger[_0x941d('0xd')]('response',getLogFromObject(_0x522ee5));return null;}}else{logger[_0x941d('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x3e3308){logger[_0x941d('0xd')](_0x3e3308[_0x941d('0x18')]);return null;}});}logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x53'),_0x1c5314[_0x941d('0x1a')],_0x1c5314[_0x941d('0x1b')],_0x1c5314['callerid'],_0x1c5314[_0x941d('0x1c')],_0x1c5314['uniqueid']));logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x54'),_0x1c5314[_0x941d('0x49')],_0x1c5314['extension'],parseInt(_0x1c5314[_0x941d('0x4b')],0xa)+0x1));_0x1c5314[_0x941d('0x55')](_0x1c5314[_0x941d('0x49')],_0x1c5314['extension'],parseInt(_0x1c5314[_0x941d('0x4b')],0xa)+0x1);_0x1c5314['close']();}}else{logger[_0x941d('0xd')](util[_0x941d('0x11')](_0x941d('0x56'),_0x1c5314['arg_1']));_0x1c5314[_0x941d('0x55')](_0x1c5314['context'],_0x1c5314[_0x941d('0x4a')],parseInt(_0x1c5314['priority'],0xa)+0x1);_0x1c5314['close']();}}else{logger[_0x941d('0xd')](util['format'](_0x941d('0x57'),_0x1c5314[_0x941d('0x1a')]));_0x1c5314[_0x941d('0x55')](_0x1c5314[_0x941d('0x49')],_0x1c5314[_0x941d('0x4a')],parseInt(_0x1c5314['priority'],0xa)+0x1);_0x1c5314['close']();}}function main(){var _0x27f702;return utilLicense[_0x941d('0x58')]()[_0x941d('0x35')](function(_0x502f1d){if(_0x502f1d){if(_0x502f1d['voice']){if(_0x502f1d['callysquare']&&_0x502f1d[_0x941d('0x59')]>0x0){logger[_0x941d('0x10')](util[_0x941d('0x11')](_0x941d('0x5a'),_0x502f1d[_0x941d('0x59')]));_0x27f702=_0x502f1d[_0x941d('0x59')];}else{logger[_0x941d('0x10')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x941d('0x10')](_0x941d('0x5b'));_0x27f702=-0x1;}}})[_0x941d('0x33')](function(_0x1c1eaa){logger[_0x941d('0xd')](_0x941d('0x5c'),_0x1c1eaa['stack']);})[_0x941d('0x51')](function(){var _0x5a5fa9=require('./server')(config[_0x941d('0x9')][_0x941d('0x13')],config[_0x941d('0x9')]['ip'],_0x27f702);_0x5a5fa9['on'](_0x941d('0xd'),errorHandler);_0x5a5fa9['on']('listening',listeningHandler);_0x5a5fa9['on'](_0x941d('0x5d'),connectionHandler);_0x5a5fa9['on'](_0x941d('0x3c'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 7669269..8716061 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 _0xf0ca=['request','then','error','message','catch','sendMailMessage','bluebird','jayson/promise','http'];(function(_0x47d92c,_0x189550){var _0x4f0dc3=function(_0x174e90){while(--_0x174e90){_0x47d92c['push'](_0x47d92c['shift']());}};_0x4f0dc3(++_0x189550);}(_0xf0ca,0xde));var _0xaf0c=function(_0x2534cf,_0x545be6){_0x2534cf=_0x2534cf-0x0;var _0x221461=_0xf0ca[_0x2534cf];return _0x221461;};'use strict';var BPromise=require(_0xaf0c('0x0'));var jayson=require(_0xaf0c('0x1'));var client=jayson['client'][_0xaf0c('0x2')]({'port':0x232b});function request(_0x48916d,_0x237674){return new BPromise(function(_0x32f20b,_0x52219e){return client[_0xaf0c('0x3')](_0x48916d,_0x237674)[_0xaf0c('0x4')](function(_0x553487){if(_0x553487[_0xaf0c('0x5')]){return _0x52219e(_0x553487[_0xaf0c('0x5')][_0xaf0c('0x6')]);}else{return _0x32f20b(_0x553487['result']);}})[_0xaf0c('0x7')](function(_0x504837){return _0x52219e(_0x504837);});});}exports[_0xaf0c('0x8')]=function(_0x1b27f7,_0x47900e){return request('SendMail',{'account':_0x1b27f7,'message':_0x47900e});}; \ No newline at end of file +var _0x3c90=['bluebird','jayson/promise','http','request','then','error','message','result','sendMailMessage','SendMail'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0x3c90,0x8c));var _0x03c9=function(_0x396b2d,_0x17b644){_0x396b2d=_0x396b2d-0x0;var _0x278f1f=_0x3c90[_0x396b2d];return _0x278f1f;};'use strict';var BPromise=require(_0x03c9('0x0'));var jayson=require(_0x03c9('0x1'));var client=jayson['client'][_0x03c9('0x2')]({'port':0x232b});function request(_0x54296b,_0x1f6458){return new BPromise(function(_0x33e7cf,_0x4cebb6){return client[_0x03c9('0x3')](_0x54296b,_0x1f6458)[_0x03c9('0x4')](function(_0x7e8186){if(_0x7e8186[_0x03c9('0x5')]){return _0x4cebb6(_0x7e8186[_0x03c9('0x5')][_0x03c9('0x6')]);}else{return _0x33e7cf(_0x7e8186[_0x03c9('0x7')]);}})['catch'](function(_0x232fa0){return _0x4cebb6(_0x232fa0);});});}exports[_0x03c9('0x8')]=function(_0x307c41,_0x1a3287){return request(_0x03c9('0x9'),{'account':_0x307c41,'message':_0x1a3287});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index fb66fde..782cd85 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 _0xd3d1=['toString','indexOf','substring','length','slice','trim','headers','emit','line','exports','util','stream','call','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x29a728,_0x352bf8){var _0x405405=function(_0x4555a4){while(--_0x4555a4){_0x29a728['push'](_0x29a728['shift']());}};_0x405405(++_0x352bf8);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd3d1[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x1d3d('0x0'));var Transform=require(_0x1d3d('0x1'))['Transform'];function AGIReply(_0x56f01c){Transform[_0x1d3d('0x2')](this,_0x56f01c);this[_0x1d3d('0x3')]='';this[_0x1d3d('0x4')]=![];}util[_0x1d3d('0x5')](AGIReply,Transform);AGIReply[_0x1d3d('0x6')][_0x1d3d('0x7')]=function(_0x2445e8,_0xc64465,_0x1cbe06){var _0x449475='\x0a',_0x3831ce=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xb1b3c6=-0x1,_0xe10bca=-0x1,_0x2c377c='',_0xbea61e=0x0,_0x2ba122='',_0x3683c9='';this[_0x1d3d('0x3')]+=_0x2445e8[_0x1d3d('0x8')]();_0x2ba122=this[_0x1d3d('0x3')];if(!this[_0x1d3d('0x4')]){_0xbea61e=0x0;while(_0x3831ce[_0xbea61e]){while((_0xe10bca=_0x2ba122[_0x1d3d('0x9')](_0x3831ce[_0xbea61e]))!=-0x1){_0x2c377c=_0x3831ce[_0xbea61e];_0x3683c9=_0x2ba122[_0x1d3d('0xa')](0x0,_0xe10bca);_0x2ba122=_0x2ba122[_0x1d3d('0xa')](_0xe10bca+_0x2c377c[_0x1d3d('0xb')]);var _0x3b3913=_0x3683c9['split'](_0x449475),_0x3cffa5=0x0,_0x29e17e={},_0x479216='',_0xb587d='',_0x2e375f=-0x1;while(_0x3b3913[_0x3cffa5]){_0x2e375f=_0x3b3913[_0x3cffa5]['indexOf'](':');if(_0x2e375f!=-0x1){_0x479216=_0x3b3913[_0x3cffa5][_0x1d3d('0xc')](0x0,_0x2e375f)[_0x1d3d('0xd')]();_0xb587d=_0x3b3913[_0x3cffa5][_0x1d3d('0xc')](_0x2e375f+0x1)['trim']();if(_0x479216[_0x1d3d('0xb')]>0x0){_0x29e17e[_0x479216]=_0xb587d;}}else{}_0x3cffa5++;}this['emit'](_0x1d3d('0xe'),_0x29e17e);this[_0x1d3d('0x4')]=!![];}_0xbea61e++;}this[_0x1d3d('0x3')]=_0x2ba122;}else{while((_0xb1b3c6=_0x2ba122[_0x1d3d('0x9')](_0x449475))!=-0x1){_0x3683c9=_0x2ba122[_0x1d3d('0xa')](0x0,_0xb1b3c6);this[_0x1d3d('0xf')](_0x1d3d('0x10'),_0x3683c9);_0x2ba122=_0x2ba122['substring'](_0xb1b3c6+_0x449475['length']);}this[_0x1d3d('0x3')]=_0x2ba122;}_0x1cbe06();};module[_0x1d3d('0x11')]=AGIReply; \ No newline at end of file +var _0x2055=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','trim','slice','length','emit','substring','line'];(function(_0x1e829d,_0x263e13){var _0x527b99=function(_0x42b6d8){while(--_0x42b6d8){_0x1e829d['push'](_0x1e829d['shift']());}};_0x527b99(++_0x263e13);}(_0x2055,0x157));var _0x5205=function(_0x342791,_0x467999){_0x342791=_0x342791-0x0;var _0x44fc33=_0x2055[_0x342791];return _0x44fc33;};'use strict';var util=require(_0x5205('0x0'));var Transform=require(_0x5205('0x1'))[_0x5205('0x2')];function AGIReply(_0x1bc705){Transform[_0x5205('0x3')](this,_0x1bc705);this[_0x5205('0x4')]='';this[_0x5205('0x5')]=![];}util[_0x5205('0x6')](AGIReply,Transform);AGIReply[_0x5205('0x7')][_0x5205('0x8')]=function(_0x1cebe8,_0x1b71f1,_0x42e9f2){var _0x28859f='\x0a',_0x2e57bb=['\x0a\x0a',_0x5205('0x9')],_0x2e9159=-0x1,_0x54885e=-0x1,_0x267879='',_0x5d9ada=0x0,_0x4c6321='',_0x47a27d='';this[_0x5205('0x4')]+=_0x1cebe8[_0x5205('0xa')]();_0x4c6321=this[_0x5205('0x4')];if(!this[_0x5205('0x5')]){_0x5d9ada=0x0;while(_0x2e57bb[_0x5d9ada]){while((_0x54885e=_0x4c6321['indexOf'](_0x2e57bb[_0x5d9ada]))!=-0x1){_0x267879=_0x2e57bb[_0x5d9ada];_0x47a27d=_0x4c6321['substring'](0x0,_0x54885e);_0x4c6321=_0x4c6321['substring'](_0x54885e+_0x267879['length']);var _0x2304d5=_0x47a27d['split'](_0x28859f),_0x250a91=0x0,_0x4ea223={},_0xbf02d0='',_0x1c224c='',_0x523df7=-0x1;while(_0x2304d5[_0x250a91]){_0x523df7=_0x2304d5[_0x250a91][_0x5205('0xb')](':');if(_0x523df7!=-0x1){_0xbf02d0=_0x2304d5[_0x250a91]['slice'](0x0,_0x523df7)[_0x5205('0xc')]();_0x1c224c=_0x2304d5[_0x250a91][_0x5205('0xd')](_0x523df7+0x1)[_0x5205('0xc')]();if(_0xbf02d0[_0x5205('0xe')]>0x0){_0x4ea223[_0xbf02d0]=_0x1c224c;}}else{}_0x250a91++;}this[_0x5205('0xf')]('headers',_0x4ea223);this[_0x5205('0x5')]=!![];}_0x5d9ada++;}this['_localBuffer']=_0x4c6321;}else{while((_0x2e9159=_0x4c6321['indexOf'](_0x28859f))!=-0x1){_0x47a27d=_0x4c6321[_0x5205('0x10')](0x0,_0x2e9159);this['emit'](_0x5205('0x11'),_0x47a27d);_0x4c6321=_0x4c6321[_0x5205('0x10')](_0x2e9159+_0x28859f[_0x5205('0xe')]);}this[_0x5205('0x4')]=_0x4c6321;}_0x42e9f2();};module[_0x5205('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index b98e316..afdaec0 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 _0x230a=['CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','http','request','error','message','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','ShowSmsAccount','createSmsMessage'];(function(_0x584548,_0x2f404f){var _0xc3087a=function(_0x5ac854){while(--_0x5ac854){_0x584548['push'](_0x584548['shift']());}};_0xc3087a(++_0x2f404f);}(_0x230a,0x80));var _0xa230=function(_0x2e84f0,_0x2d0245){_0x2e84f0=_0x2e84f0-0x0;var _0x2d7bf0=_0x230a[_0x2e84f0];return _0x2d7bf0;};'use strict';var BPromise=require(_0xa230('0x0'));var moment=require(_0xa230('0x1'));var _=require('lodash');var util=require(_0xa230('0x2'));var jayson=require(_0xa230('0x3'));var client=jayson[_0xa230('0x4')][_0xa230('0x5')]({'port':0x2329});function request(_0x295c7e,_0xba15f6){return new BPromise(function(_0x4a1412,_0x497c9e){return client[_0xa230('0x6')](_0x295c7e,_0xba15f6)['then'](function(_0x5417f2){if(_0x5417f2[_0xa230('0x7')]){return _0x497c9e(_0x5417f2[_0xa230('0x7')][_0xa230('0x8')]);}else{return _0x4a1412(_0x5417f2['result']);}})['catch'](function(_0x3fae30){return _0x497c9e(_0x3fae30);});});}exports[_0xa230('0x9')]=function(_0x529434){return request(_0xa230('0xa'),{'options':{'raw':![],'where':{'name':_0x529434},'attributes':['production']}});};exports[_0xa230('0xb')]=function(_0x55441c){return request(_0xa230('0xc'),{'options':{'raw':![],'where':{'id':_0x55441c},'include':[{'model':_0xa230('0xd'),'as':_0xa230('0xe')}],'attributes':['id',_0xa230('0xf'),_0xa230('0x10')]}});};exports[_0xa230('0x11')]=function(_0x158820){return request('ShowSquareProject',{'options':{'where':{'id':_0x158820},'attributes':[_0xa230('0xf')]}});};exports['getVoiceQueueById']=function(_0x246e3a){return request(_0xa230('0x12'),{'options':{'where':{'id':_0x246e3a},'attributes':['name']}});};exports[_0xa230('0x13')]=function(_0x4f839f){return request(_0xa230('0x14'),{'options':{'where':{'id':_0x4f839f},'attributes':[_0xa230('0xf')]}});};exports[_0xa230('0x15')]=function(_0x2d67b8){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2d67b8},'attributes':[_0xa230('0x16')]}});};exports[_0xa230('0x17')]=function(_0x140221){return request(_0xa230('0x18'),{'options':{'where':{'id':_0x140221},'attributes':[_0xa230('0xf')]}});};exports['getTrunkById']=function(_0xaaa658){return request(_0xa230('0x19'),{'options':{'where':{'id':_0xaaa658},'attributes':[_0xa230('0xf')]}});};exports[_0xa230('0x1a')]=function(_0x139d39){return request(_0xa230('0x1b'),{'options':{'where':{'id':_0x139d39},'attributes':[_0xa230('0x1c')]}});};exports[_0xa230('0x1d')]=function(_0x500004){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x500004},'include':[{'model':_0xa230('0x1e'),'as':_0xa230('0x1f')}]}});};exports['getSmsAccountById']=function(_0x5a96e5){return request(_0xa230('0x20'),{'options':{'where':{'id':_0x5a96e5},'attributes':['id','name']}});};exports[_0xa230('0x21')]=function(_0x3ea554){return request(_0xa230('0x22'),{'body':_0x3ea554});};exports[_0xa230('0x23')]=function(_0x449ede){return request(_0xa230('0x24'),{'body':_0x449ede});};exports[_0xa230('0x25')]=function(_0x227fda){return request(_0xa230('0x26'),{'body':_['merge'](_0x227fda,{'project_name':_0x227fda['arg_1'],'prev_project_name':_0x227fda['arg_2']||'','is_subproject':_0x227fda[_0xa230('0x27')]?!![]:![],'leaveAt':moment()['format'](_0xa230('0x28'))})});};exports[_0xa230('0x29')]=function(_0x495d0a){return request(_0xa230('0x2a'),{'body':_0x495d0a});};exports[_0xa230('0x2b')]=function(_0x558933){return request(_0xa230('0x2c'),{'body':_0x558933});};exports[_0xa230('0x2d')]=function(_0x234526){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x234526['phone'],'ListId':_0x234526['ListId']}}})['then'](function(_0x31e4d2){if(_0x31e4d2){return _0x31e4d2;}return request('CreateCmContact',{'body':_0x234526});});};exports['getPauseById']=function(_0x321d97){return request(_0xa230('0x2e'),{'options':{'where':{'id':_0x321d97},'attributes':[_0xa230('0xf')]}});};exports[_0xa230('0x2f')]=function(_0x143bf5,_0x5af9d7){return request(_0xa230('0x30'),{'body':{'interface':_0x5af9d7},'options':{'where':_0x143bf5}});};exports[_0xa230('0x31')]=function(_0x428f3b,_0x3a6274,_0xe3cd56){return request(_0xa230('0x32'),{'body':{'type':_0x3a6274,'uniqueid':_0xe3cd56},'options':{'where':_0x428f3b}});};exports[_0xa230('0x33')]=function(_0xd6e8be){return request('UnpauseUser',{'body':{},'options':{'where':_0xd6e8be}});};exports[_0xa230('0x34')]=function(_0xa18c3c){return request(_0xa230('0x35'),{'body':{},'options':{'where':_0xa18c3c}});}; \ No newline at end of file +var _0xa79c=['getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production'];(function(_0x2d0f71,_0x4d9c72){var _0x255123=function(_0x39947c){while(--_0x39947c){_0x2d0f71['push'](_0x2d0f71['shift']());}};_0x255123(++_0x4d9c72);}(_0xa79c,0xe5));var _0xca79=function(_0x3f86aa,_0x306778){_0x3f86aa=_0x3f86aa-0x0;var _0x5e60e1=_0xa79c[_0x3f86aa];return _0x5e60e1;};'use strict';var BPromise=require(_0xca79('0x0'));var moment=require(_0xca79('0x1'));var _=require(_0xca79('0x2'));var util=require(_0xca79('0x3'));var jayson=require(_0xca79('0x4'));var client=jayson['client'][_0xca79('0x5')]({'port':0x2329});function request(_0x489881,_0xd1eb85){return new BPromise(function(_0x50e34a,_0x30d94c){return client[_0xca79('0x6')](_0x489881,_0xd1eb85)[_0xca79('0x7')](function(_0xaaa9dd){if(_0xaaa9dd[_0xca79('0x8')]){return _0x30d94c(_0xaaa9dd[_0xca79('0x8')][_0xca79('0x9')]);}else{return _0x50e34a(_0xaaa9dd[_0xca79('0xa')]);}})[_0xca79('0xb')](function(_0x3a88d6){return _0x30d94c(_0x3a88d6);});});}exports[_0xca79('0xc')]=function(_0x46c2a4){return request(_0xca79('0xd'),{'options':{'raw':![],'where':{'name':_0x46c2a4},'attributes':[_0xca79('0xe')]}});};exports[_0xca79('0xf')]=function(_0x2fa1c5){return request(_0xca79('0x10'),{'options':{'raw':![],'where':{'id':_0x2fa1c5},'include':[{'model':_0xca79('0x11'),'as':'Smtp'}],'attributes':['id',_0xca79('0x12'),_0xca79('0x13')]}});};exports[_0xca79('0x14')]=function(_0x4adc75){return request(_0xca79('0xd'),{'options':{'where':{'id':_0x4adc75},'attributes':[_0xca79('0x12')]}});};exports[_0xca79('0x15')]=function(_0x27b6e0){return request(_0xca79('0x16'),{'options':{'where':{'id':_0x27b6e0},'attributes':[_0xca79('0x12')]}});};exports['getVariableById']=function(_0x57148a){return request(_0xca79('0x17'),{'options':{'where':{'id':_0x57148a},'attributes':[_0xca79('0x12')]}});};exports[_0xca79('0x18')]=function(_0xa320ec){return request(_0xca79('0x19'),{'options':{'where':{'id':_0xa320ec},'attributes':[_0xca79('0x1a')]}});};exports[_0xca79('0x1b')]=function(_0x4d1fad){return request(_0xca79('0x1c'),{'options':{'where':{'id':_0x4d1fad},'attributes':['name']}});};exports[_0xca79('0x1d')]=function(_0x140b5d){return request('ShowTrunk',{'options':{'where':{'id':_0x140b5d},'attributes':[_0xca79('0x12')]}});};exports['getSoundById']=function(_0x80304e){return request(_0xca79('0x1e'),{'options':{'where':{'id':_0x80304e},'attributes':[_0xca79('0x1f')]}});};exports[_0xca79('0x20')]=function(_0x51a884){return request(_0xca79('0x21'),{'options':{'raw':![],'where':{'id':_0x51a884},'include':[{'model':_0xca79('0x22'),'as':_0xca79('0x23')}]}});};exports[_0xca79('0x24')]=function(_0x527b41){return request(_0xca79('0x25'),{'options':{'where':{'id':_0x527b41},'attributes':['id',_0xca79('0x12')]}});};exports['createSmsMessage']=function(_0x27c644){return request(_0xca79('0x26'),{'body':_0x27c644});};exports['createSquareDetailsReport']=function(_0x33f632){return request(_0xca79('0x27'),{'body':_0x33f632});};exports['createSquareReport']=function(_0x1daba5){return request('CreateSquareReport',{'body':_['merge'](_0x1daba5,{'project_name':_0x1daba5[_0xca79('0x28')],'prev_project_name':_0x1daba5[_0xca79('0x29')]||'','is_subproject':_0x1daba5[_0xca79('0x29')]?!![]:![],'leaveAt':moment()[_0xca79('0x2a')](_0xca79('0x2b'))})});};exports[_0xca79('0x2c')]=function(_0x1236ea){return request(_0xca79('0x2d'),{'body':_0x1236ea});};exports[_0xca79('0x2e')]=function(_0x241125){return request(_0xca79('0x2f'),{'body':_0x241125});};exports[_0xca79('0x30')]=function(_0x368479){return request(_0xca79('0x31'),{'options':{'raw':![],'where':{'phone':_0x368479[_0xca79('0x32')],'ListId':_0x368479[_0xca79('0x33')]}}})[_0xca79('0x7')](function(_0x4965cb){if(_0x4965cb){return _0x4965cb;}return request('CreateCmContact',{'body':_0x368479});});};exports[_0xca79('0x34')]=function(_0x4f4515){return request('ShowPause',{'options':{'where':{'id':_0x4f4515},'attributes':[_0xca79('0x12')]}});};exports[_0xca79('0x35')]=function(_0x3e0be3,_0x2df351){return request(_0xca79('0x36'),{'body':{'interface':_0x2df351},'options':{'where':_0x3e0be3}});};exports[_0xca79('0x37')]=function(_0x3b6003,_0x5f23dc,_0x1bf5a9){return request(_0xca79('0x38'),{'body':{'type':_0x5f23dc,'uniqueid':_0x1bf5a9},'options':{'where':_0x3b6003}});};exports[_0xca79('0x39')]=function(_0x10c52b){return request(_0xca79('0x3a'),{'body':{},'options':{'where':_0x10c52b}});};exports[_0xca79('0x3b')]=function(_0x17cc4c){return request(_0xca79('0x3c'),{'body':{},'options':{'where':_0x17cc4c}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 0c80989..2757e21 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 _0x1696=['exports','./polly'];(function(_0x15dcd8,_0x437c52){var _0x37b89f=function(_0x1e540c){while(--_0x1e540c){_0x15dcd8['push'](_0x15dcd8['shift']());}};_0x37b89f(++_0x437c52);}(_0x1696,0x79));var _0x6169=function(_0x30b670,_0x3777ab){_0x30b670=_0x30b670-0x0;var _0x23f142=_0x1696[_0x30b670];return _0x23f142;};var polly=require(_0x6169('0x0'));var lex=require('./lex');module[_0x6169('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7e4b=['./polly','./lex'];(function(_0x1945f7,_0x39a397){var _0x1d7270=function(_0x1b9314){while(--_0x1b9314){_0x1945f7['push'](_0x1945f7['shift']());}};_0x1d7270(++_0x39a397);}(_0x7e4b,0x84));var _0xb7e4=function(_0x52caec,_0x17347b){_0x52caec=_0x52caec-0x0;var _0x3b90e5=_0x7e4b[_0x52caec];return _0x3b90e5;};var polly=require(_0xb7e4('0x0'));var lex=require(_0xb7e4('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 112964b..60862f5 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 _0xaa88=['exports','./lib/api'];(function(_0x5dce80,_0x30077e){var _0x5f1655=function(_0x99e12e){while(--_0x99e12e){_0x5dce80['push'](_0x5dce80['shift']());}};_0x5f1655(++_0x30077e);}(_0xaa88,0x137));var _0x8aa8=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0xaa88[_0x5b27da];return _0x3254f4;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ No newline at end of file +var _0xac4a=['exports','./lib/api'];(function(_0xab17fe,_0x4d7cbf){var _0x1ceb04=function(_0x985e2b){while(--_0x985e2b){_0xab17fe['push'](_0xab17fe['shift']());}};_0x1ceb04(++_0x4d7cbf);}(_0xac4a,0x13f));var _0xaac4=function(_0xca88b9,_0x4f5bb5){_0xca88b9=_0xca88b9-0x0;var _0x3e6ea3=_0xac4a[_0xca88b9];return _0x3e6ea3;};'use strict';var lex=require(_0xaac4('0x0'));module[_0xaac4('0x1')]=function(_0x2e2ad0,_0x132fc3,_0x38f4f4,_0x1dc251,_0x5aeb7d,_0x58626e){return lex(_0x2e2ad0,_0x132fc3,_0x38f4f4,_0x1dc251,_0x5aeb7d,_0x58626e);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 0fd6211..53fd11f 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(_0x8ecba6,_0x436155){var _0x4ceb1=function(_0x5a1739){while(--_0x5a1739){_0x8ecba6['push'](_0x8ecba6['shift']());}};_0x4ceb1(++_0x436155);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x16f546,_0x15187a){var _0x7e4c62=function(_0x3b7eb6){while(--_0x3b7eb6){_0x16f546['push'](_0x16f546['shift']());}};_0x7e4c62(++_0x15187a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index b73ad7b..a16e6ef 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 _0x064c=['exports'];(function(_0x506e4e,_0x1e893b){var _0x23719c=function(_0x33e3c0){while(--_0x33e3c0){_0x506e4e['push'](_0x506e4e['shift']());}};_0x23719c(++_0x1e893b);}(_0x064c,0x139));var _0xc064=function(_0x868b7c,_0xfa438b){_0x868b7c=_0x868b7c-0x0;var _0x21683c=_0x064c[_0x868b7c];return _0x21683c;};'use strict';var polly=require('./lib/api');module[_0xc064('0x0')]=function(_0x12a0d1,_0x30794a,_0x1b785a,_0x2bc912,_0x391336,_0x1e1d39,_0x28a097){return polly(_0x12a0d1,_0x30794a,_0x1b785a,_0x2bc912,_0x391336,_0x1e1d39,_0x28a097);}; \ No newline at end of file +var _0xc645=['exports'];(function(_0x41db71,_0x478e17){var _0x5c71d1=function(_0x1c88bf){while(--_0x1c88bf){_0x41db71['push'](_0x41db71['shift']());}};_0x5c71d1(++_0x478e17);}(_0xc645,0xc5));var _0x5c64=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xc645[_0x599f41];return _0x2e4d58;};'use strict';var polly=require('./lib/api');module[_0x5c64('0x0')]=function(_0x4673e3,_0x25f393,_0x25bee9,_0x56d4ea,_0x1a9bd8,_0xac30c2,_0x2482c0){return polly(_0x4673e3,_0x25f393,_0x25bee9,_0x56d4ea,_0x1a9bd8,_0xac30c2,_0x2482c0);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 25811f3..19baf11 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 _0x72cf=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','bluebird','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x72cf,0x125));var _0xf72c=function(_0x1e51cd,_0x4ec6ea){_0x1e51cd=_0x1e51cd-0x0;var _0x208968=_0x72cf[_0x1e51cd];return _0x208968;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xf72c('0x0'));var rs=require('randomstring');var AWS=require(_0xf72c('0x1'));function pollyResult(_0x295f2d,_0x452b04,_0x5db095){return new BPromise(function(_0x5f57f7,_0x4a4795){_0x295f2d[_0xf72c('0x2')](_0x452b04,function(_0x1a6f9a,_0x1f7ac3){if(_0x1a6f9a){_0x4a4795(_0x1a6f9a);}else if(_0x1f7ac3){if(_0x1f7ac3[_0xf72c('0x3')]instanceof Buffer){fs[_0xf72c('0x4')](_0x5db095,_0x1f7ac3[_0xf72c('0x3')],function(_0x15cced){if(_0x15cced){_0x4a4795(_0x15cced);}else{_0x5f57f7();}});}else{_0x4a4795(new Error(_0xf72c('0x5')));}}else{_0x4a4795(new Error(_0xf72c('0x6')));}});});}module['exports']=function(_0x37bca7,_0x445ebf,_0x490977,_0x4a32c7,_0x18bc97,_0x3e61e3,_0x2ab979){var _0x1bf168=new AWS[(_0xf72c('0x7'))]({'accessKeyId':_0x37bca7,'secretAccessKey':_0x445ebf,'region':_0x490977});var _0x103cf8={'Text':_0x18bc97,'TextType':_0x3e61e3||_0xf72c('0x8'),'OutputFormat':'mp3','VoiceId':_0x4a32c7};return pollyResult(_0x1bf168,_0x103cf8,_0x2ab979);}; \ No newline at end of file +var _0x21c6=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x20db54,_0x356b85){var _0x36f0ac=function(_0x5f14b5){while(--_0x5f14b5){_0x20db54['push'](_0x20db54['shift']());}};_0x36f0ac(++_0x356b85);}(_0x21c6,0x19f));var _0x621c=function(_0x5f1cd7,_0x6cb3de){_0x5f1cd7=_0x5f1cd7-0x0;var _0x35058c=_0x21c6[_0x5f1cd7];return _0x35058c;};'use strict';var fs=require('fs');var path=require(_0x621c('0x0'));var BPromise=require('bluebird');var rs=require(_0x621c('0x1'));var AWS=require(_0x621c('0x2'));function pollyResult(_0x11301f,_0x4937ad,_0x1fc257){return new BPromise(function(_0x428027,_0x35d33a){_0x11301f[_0x621c('0x3')](_0x4937ad,function(_0x4b66cb,_0x39495d){if(_0x4b66cb){_0x35d33a(_0x4b66cb);}else if(_0x39495d){if(_0x39495d[_0x621c('0x4')]instanceof Buffer){fs['writeFile'](_0x1fc257,_0x39495d[_0x621c('0x4')],function(_0x469623){if(_0x469623){_0x35d33a(_0x469623);}else{_0x428027();}});}else{_0x35d33a(new Error(_0x621c('0x5')));}}else{_0x35d33a(new Error(_0x621c('0x6')));}});});}module[_0x621c('0x7')]=function(_0x2fff64,_0x30cb6e,_0x121920,_0x575afb,_0x483375,_0x524f74,_0x1a40f8){var _0x247b29=new AWS[(_0x621c('0x8'))]({'accessKeyId':_0x2fff64,'secretAccessKey':_0x30cb6e,'region':_0x121920});var _0x297bb5={'Text':_0x483375,'TextType':_0x524f74||'text','OutputFormat':_0x621c('0x9'),'VoiceId':_0x575afb};return pollyResult(_0x247b29,_0x297bb5,_0x1a40f8);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 3c8373c..a11c313 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 _0xab30=['./lib/api'];(function(_0x40e76b,_0x9f1a5){var _0x8b2a31=function(_0x22a9d3){while(--_0x22a9d3){_0x40e76b['push'](_0x40e76b['shift']());}};_0x8b2a31(++_0x9f1a5);}(_0xab30,0x1e2));var _0x0ab3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xab30[_0xfae23b];return _0x200640;};'use strict';var asr=require(_0x0ab3('0x0'));module['exports']=function(_0x58438d,_0xa7f0ff,_0x274d59,_0x5ab869){return asr(_0x58438d,_0xa7f0ff,_0x274d59);}; \ No newline at end of file +var _0x6a1c=['exports'];(function(_0x173c29,_0x467a04){var _0xbd77bb=function(_0x4f0336){while(--_0x4f0336){_0x173c29['push'](_0x173c29['shift']());}};_0xbd77bb(++_0x467a04);}(_0x6a1c,0xad));var _0xc6a1=function(_0x35abd2,_0x5695bd){_0x35abd2=_0x35abd2-0x0;var _0x5768a7=_0x6a1c[_0x35abd2];return _0x5768a7;};'use strict';var asr=require('./lib/api');module[_0xc6a1('0x0')]=function(_0x3ed115,_0x207e59,_0x13895c,_0x43b5e8){return asr(_0x3ed115,_0x207e59,_0x13895c);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 6f1d60b..70f7552 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 _0x984b=['POST','/v1/speech:recognize?key=','LINEAR16','8000','exports','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','length','readFileSync','toString','base64'];(function(_0x5b7a46,_0x5843a3){var _0x55916f=function(_0xe8aa0a){while(--_0xe8aa0a){_0x5b7a46['push'](_0x5b7a46['shift']());}};_0x55916f(++_0x5843a3);}(_0x984b,0xee));var _0xb984=function(_0x58664a,_0x216320){_0x58664a=_0x58664a-0x0;var _0x4d63ab=_0x984b[_0x58664a];return _0x4d63ab;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xb984('0x0')]=function(_0x394106,_0x1a7da0,_0x572113){return new BPromise(function(_0x59ea63,_0x8384b0){var _0x340f2c;if(typeof _0x394106!=='string'||_0x394106['length']===0x0){return _0x8384b0(_0xb984('0x1'));}if(typeof _0x1a7da0!==_0xb984('0x2')||_0x1a7da0['length']===0x0){return _0x8384b0(_0xb984('0x3'));}if(typeof _0x572113!==_0xb984('0x4')&&(typeof _0x572113!=='string'||_0x572113[_0xb984('0x5')]===0x0)){return _0x8384b0('lang\x20should\x20be\x20a\x20string');}try{_0x340f2c=fs[_0xb984('0x6')](_0x394106)[_0xb984('0x7')](_0xb984('0x8'));}catch(_0x2f4e77){return _0x8384b0(_0x2f4e77);}return _0x59ea63({'method':_0xb984('0x9'),'uri':host+_0xb984('0xa')+_0x1a7da0,'body':{'config':{'encoding':_0xb984('0xb'),'sampleRateHertz':_0xb984('0xc'),'languageCode':_0x572113},'audio':{'content':_0x340f2c}},'json':!![]});});}; \ No newline at end of file +var _0xa7b4=['string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','bluebird','https://speech.googleapis.com'];(function(_0xf7167c,_0x392b43){var _0xf09584=function(_0x13b026){while(--_0x13b026){_0xf7167c['push'](_0xf7167c['shift']());}};_0xf09584(++_0x392b43);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x40d53c,_0xa40cf6){_0x40d53c=_0x40d53c-0x0;var _0x55693a=_0xa7b4[_0x40d53c];return _0x55693a;};'use strict';var url=require('url');var BPromise=require(_0x4a7b('0x0'));var fs=require('fs');var host=_0x4a7b('0x1');module['exports']=function(_0xb93675,_0x30092d,_0x56f161){return new BPromise(function(_0x5de6a2,_0x4cadbf){var _0x8c0229;if(typeof _0xb93675!==_0x4a7b('0x2')||_0xb93675['length']===0x0){return _0x4cadbf(_0x4a7b('0x3'));}if(typeof _0x30092d!==_0x4a7b('0x2')||_0x30092d[_0x4a7b('0x4')]===0x0){return _0x4cadbf(_0x4a7b('0x5'));}if(typeof _0x56f161!==_0x4a7b('0x6')&&(typeof _0x56f161!==_0x4a7b('0x2')||_0x56f161[_0x4a7b('0x4')]===0x0)){return _0x4cadbf(_0x4a7b('0x7'));}try{_0x8c0229=fs[_0x4a7b('0x8')](_0xb93675)[_0x4a7b('0x9')](_0x4a7b('0xa'));}catch(_0x3eb79b){return _0x4cadbf(_0x3eb79b);}return _0x5de6a2({'method':_0x4a7b('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x30092d,'body':{'config':{'encoding':_0x4a7b('0xc'),'sampleRateHertz':'8000','languageCode':_0x56f161},'audio':{'content':_0x8c0229}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 5e1c4b7..bc1dc55 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 _0x4567=['exports'];(function(_0x53d9f5,_0x72ff9b){var _0x1fc32f=function(_0x55e27d){while(--_0x55e27d){_0x53d9f5['push'](_0x53d9f5['shift']());}};_0x1fc32f(++_0x72ff9b);}(_0x4567,0x8b));var _0x7456=function(_0xa2a83f,_0x31fe82){_0xa2a83f=_0xa2a83f-0x0;var _0x520865=_0x4567[_0xa2a83f];return _0x520865;};var asr=require('./asr');module[_0x7456('0x0')]={'asr':asr}; \ No newline at end of file +var _0xb088=['exports','./asr'];(function(_0x1d3676,_0x21ed27){var _0x4cf321=function(_0x344ec0){while(--_0x344ec0){_0x1d3676['push'](_0x1d3676['shift']());}};_0x4cf321(++_0x21ed27);}(_0xb088,0x19f));var _0x8b08=function(_0xe183f2,_0x493947){_0xe183f2=_0xe183f2-0x0;var _0x1dbb20=_0xb088[_0xe183f2];return _0x1dbb20;};var asr=require(_0x8b08('0x0'));module[_0x8b08('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 3ebfcf1..b7df274 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 _0x589f=['request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','pipe','end','data','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','toString','googleCloudTTS','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','path'];(function(_0xfd1fcd,_0x3182b7){var _0x1e0646=function(_0x4f4fa4){while(--_0x4f4fa4){_0xfd1fcd['push'](_0xfd1fcd['shift']());}};_0x1e0646(++_0x3182b7);}(_0x589f,0x19f));var _0xf589=function(_0x3e7b59,_0x14a4cd){_0x3e7b59=_0x3e7b59-0x0;var _0x4bd64a=_0x589f[_0x3e7b59];return _0x4bd64a;};'use strict';var apiai=require(_0xf589('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xf589('0x1'));var fs=require('fs');var http=require(_0xf589('0x2'));var https=require(_0xf589('0x3'));var md5=require('md5');var path=require(_0xf589('0x4'));var querystring=require('querystring');var rp=require(_0xf589('0x5'));var rs=require(_0xf589('0x6'));var sox=require(_0xf589('0x7'));var tts=require(_0xf589('0x8'));var urlParse=require(_0xf589('0x9'))[_0xf589('0xa')];var util=require(_0xf589('0xb'));var aws=require(_0xf589('0xc'));var google=require(_0xf589('0xd'));var sestek=require(_0xf589('0xe'));var tilde=require(_0xf589('0xf'));var logger=require(_0xf589('0x10'))(_0xf589('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x1737ce,_0x50f3e1){return new BPromise(function(_0x187e92,_0x600792){var _0x56e9df=urlParse(_0x1737ce);var _0x5ac757=_0x56e9df['protocol']===_0xf589('0x12')?https:http;var _0x10ec9e={'host':_0x56e9df[_0xf589('0x13')],'path':_0x56e9df[_0xf589('0x4')],'headers':{'user-agent':_0xf589('0x14')}};_0x5ac757[_0xf589('0x15')](_0x10ec9e,function(_0xf190a9){if(_0xf190a9[_0xf589('0x16')]!==0xc8){logger[_0xf589('0x17')](_0xf589('0x18')+_0x1737ce+_0xf589('0x19')+_0xf190a9[_0xf589('0x16')]+'\x20('+_0xf190a9['statusMessage']+')');_0x600792(new Error(_0xf589('0x18')+_0x1737ce+_0xf589('0x19')+_0xf190a9[_0xf589('0x16')]+'\x20('+_0xf190a9[_0xf589('0x1a')]+')'));return;}var _0x52d7a2=fs[_0xf589('0x1b')](_0x50f3e1);_0x52d7a2['on'](_0xf589('0x1c'),function(){logger[_0xf589('0x1d')](_0xf589('0x1e'));_0x52d7a2['close'](_0x187e92);});_0x52d7a2['on']('error',function(_0x6f7ff9){fs[_0xf589('0x1f')](_0x50f3e1);logger[_0xf589('0x17')]('download\x20error',_0x6f7ff9);_0x600792(_0x6f7ff9);});_0xf190a9[_0xf589('0x20')](_0x52d7a2);})['on'](_0xf589('0x17'),function(_0x214047){logger['error'](_0x214047);_0x600792(_0x214047);})[_0xf589('0x21')]();});}function uploadFile(_0x251126){return new BPromise(function(_0x2cfb6b,_0x52db2f){var _0x498d55=urlParse(_0x251126);var _0x3aa12e=_0x498d55['protocol']===_0xf589('0x12')?https:http;var _0x573648={'host':_0x498d55['host'],'path':_0x498d55[_0xf589('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x3aa12e[_0xf589('0x15')](_0x573648,function(_0xfaa0ab){if(_0xfaa0ab['statusCode']!==0xc8){_0x52db2f(new Error('request\x20to\x20'+_0x251126+_0xf589('0x19')+_0xfaa0ab[_0xf589('0x16')]+'\x20('+_0xfaa0ab[_0xf589('0x1a')]+')'));return;}var _0x470fb3='';_0xfaa0ab['on'](_0xf589('0x22'),function(_0x53c03){_0x470fb3+=_0x53c03;});_0xfaa0ab['on'](_0xf589('0x21'),function(){_0x2cfb6b(_0x470fb3);});})['on'](_0xf589('0x17'),function(_0x7e305b){_0x52db2f(_0x7e305b);})[_0xf589('0x21')]();});}function convertFile(_0x3d52d5,_0x1438e2){return new BPromise(function(_0x35c29d,_0x1531d2){var _0x4ec870=sox['transcode'](_0x3d52d5,_0x1438e2,{'sampleRate':0x1f40,'format':_0xf589('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4ec870['on']('error',function(_0x1b49e6){logger[_0xf589('0x17')](_0xf589('0x24'),_0x1b49e6);_0x1531d2(_0x1b49e6);});_0x4ec870['on'](_0xf589('0x21'),function(){logger[_0xf589('0x1d')](_0xf589('0x25'));_0x35c29d();});_0x4ec870['start']();});}function base64Decode(_0x56b2b4,_0x527c34){var _0x10f9c3=path[_0xf589('0x26')](__dirname,_0xf589('0x27'),rs[_0xf589('0x28')](0x4)+_0xf589('0x29'));fs[_0xf589('0x2a')](_0x10f9c3,_0x56b2b4,_0xf589('0x2b'));return convertFile(_0x10f9c3,_0x527c34)['then'](function(){try{fs[_0xf589('0x1f')](_0x10f9c3);fs[_0xf589('0x2c')](_0x527c34,_0xf589('0x2d'));}catch(_0x5cfa05){logger[_0xf589('0x17')](_0x5cfa05);}return _0x527c34[_0xf589('0x2e')]('.')[0x0];});}function base64Encode(_0x555bf5){var _0x35c205=fs['readFileSync'](_0x555bf5);return new Buffer(_0x35c205)[_0xf589('0x2f')](_0xf589('0x2b'));}exports[_0xf589('0x30')]=function(_0x17fa54,_0x32f863,_0x8425dd,_0x1220fb,_0xfbbb2c,_0x3f70ca){var _0x1cd6c2,_0x9fa6a;var _0x4dbeac='https://texttospeech.googleapis.com/v1/';var _0x419988='?key='+_0x17fa54;var _0x4c3e8c={};if(_0x32f863==='ssml'){_0x4c3e8c[_0xf589('0x31')]={'ssml':_0x8425dd};}else{_0x4c3e8c[_0xf589('0x31')]={'text':_0x8425dd};};_0x4c3e8c[_0xf589('0x32')]={'languageCode':_0x1220fb,'ssmlGender':_0xfbbb2c};_0x4c3e8c[_0xf589('0x33')]={'audioEncoding':_0xf589('0x34'),'sampleRateHertz':0x1f40};var _0x2d6439={'url':_0x4dbeac+_0xf589('0x35')+_0x419988,'method':_0xf589('0x36'),'json':!![],'body':_0x4c3e8c};return rp(_0x2d6439)[_0xf589('0x37')](function(_0x831456){return new BPromise(function(_0x371e64,_0x5ed506){_0x1cd6c2=path[_0xf589('0x26')](__dirname,_0xf589('0x27'),rs[_0xf589('0x28')](0x4)+_0xf589('0x38'));var _0x30baf0=Buffer[_0xf589('0x39')](_0x831456[_0xf589('0x3a')],_0xf589('0x2b'));return fs[_0xf589('0x3b')](_0x1cd6c2,_0x30baf0,function(_0xaca881){_0x5ed506(_0xaca881);},function(_0x4dca44){fs[_0xf589('0x2c')](_0x1cd6c2,'777');_0x371e64(_0x4dca44);});});})[_0xf589('0x37')](function(_0x9de9dd){_0x9fa6a=path['resolve'](__dirname,_0xf589('0x27'),rs[_0xf589('0x28')](0x4)+_0xf589('0x29'));return convertFile(_0x1cd6c2,_0x9fa6a);})[_0xf589('0x37')](function(){try{fs[_0xf589('0x1f')](_0x1cd6c2);fs[_0xf589('0x2c')](_0x9fa6a,_0xf589('0x2d'));}catch(_0x741d37){logger[_0xf589('0x17')](_0x741d37);}logger[_0xf589('0x1d')](_0xf589('0x3c'),_0x9fa6a['split']('.')[0x0]);return _0x9fa6a[_0xf589('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x1df612,_0x76e4af){var _0x50ac13=_0xf589('0x3d');var _0x290abc,_0x23866b;var _0xf2fbb2;var _0x2d0578={'encoding':_0xf589('0x3e'),'method':'POST','timeout':0x2710,'url':_0x50ac13,'headers':{'Content-Type':_0xf589('0x3f')},'body':_0xf589('0x40')+encodeURIComponent(JSON[_0xf589('0x41')]([[[_0xf589('0x42'),JSON[_0xf589('0x41')]([_0x1df612,_0x76e4af||'en',![],_0xf589('0x43')]),null,_0xf589('0x44')]]]))};return rp(_0x2d0578)[_0xf589('0x37')](function(_0x4e164b){try{_0xf2fbb2=eval(_0x4e164b[_0xf589('0x45')](0x5))[0x0][0x2];}catch(_0x33dc29){throw new Error('parse\x20response\x20failed:\x0a'+_0x4e164b[_0xf589('0x22')]);}if(!_0xf2fbb2){if(_0x1df612['length']>0xc8){throw new Error(_0xf589('0x46'));}else{throw new Error('lang\x20\x22'+_0x76e4af+_0xf589('0x47'));}}try{_0xf2fbb2=eval(_0xf2fbb2)[0x0];}catch(_0x1d0a5f){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xf589('0x22')]);}const _0x31fdcc=_0xf2fbb2;_0x290abc=path[_0xf589('0x26')](__dirname,_0xf589('0x27'),rs[_0xf589('0x28')](0x4)+_0xf589('0x38'));fs[_0xf589('0x2a')](_0x290abc,_0xf2fbb2,{'encoding':_0xf589('0x2b')});_0x23866b=path[_0xf589('0x26')](__dirname,'tmp',rs[_0xf589('0x28')](0x4)+'.wav');return convertFile(_0x290abc,_0x23866b);})[_0xf589('0x37')](function(){try{fs[_0xf589('0x1f')](_0x290abc);fs[_0xf589('0x2c')](_0x23866b,_0xf589('0x2d'));}catch(_0x20f2f2){logger['error'](_0x20f2f2);}logger[_0xf589('0x1d')](_0xf589('0x48'),_0x23866b[_0xf589('0x2e')]('.')[0x0]);return _0x23866b['split']('.')[0x0];});};exports[_0xf589('0x49')]=function(_0x5c24d3,_0x55a453,_0x19e74e){return google['asr'](_0x5c24d3,_0x55a453,_0x19e74e)['then'](function(_0xedf6a3){logger[_0xf589('0x1d')](_0xedf6a3[_0xf589('0x4a')]);return rp(_0xedf6a3);})[_0xf589('0x37')](function(_0x7d72d5){var _0x25730a='';var _0xa5deac=0x0;try{fs[_0xf589('0x1f')](_0x5c24d3);}catch(_0x2e6c7c){logger[_0xf589('0x17')](_0x2e6c7c);}if(_0x7d72d5&&_0x7d72d5[_0xf589('0x4b')]){_0x25730a=_0x7d72d5[_0xf589('0x4b')][_0xf589('0x4c')](function(_0x5cdc09){return _0x5cdc09&&_0x5cdc09[_0xf589('0x4d')][0x0]&&_0x5cdc09[_0xf589('0x4d')][0x0][_0xf589('0x4e')]?_0x5cdc09[_0xf589('0x4d')][0x0][_0xf589('0x4e')]:'';})[_0xf589('0x4f')]('\x0a');_0xa5deac=_0x7d72d5[_0xf589('0x4b')]['map'](function(_0x5dcddf){return _0x5dcddf&&_0x5dcddf[_0xf589('0x4d')][0x0]&&_0x5dcddf['alternatives'][0x0][_0xf589('0x50')]?_0x5dcddf[_0xf589('0x4d')][0x0]['confidence']:0x0;})[_0xf589('0x4f')]('\x0a');}logger['info'](_0xf589('0x51'),_0x25730a);logger[_0xf589('0x1d')](_0xf589('0x52'),_0xa5deac);return{'transcript':_0x25730a,'confidence':_0xa5deac};})[_0xf589('0x53')](function(_0x2dfb12){logger[_0xf589('0x17')]('[%s]\x20%s:%s',_0x2dfb12[_0xf589('0x16')],_0x2dfb12[_0xf589('0x54')],_0x2dfb12[_0xf589('0x55')]);});};exports[_0xf589('0x56')]=function(_0x36a536,_0x33cd93,_0x199f6c,_0x5f56a2){var _0x234e39=apiai(_0x33cd93,{'language':_0x5f56a2||'en'});return _0x234e39[_0xf589('0x57')](_0x199f6c,{'sessionId':md5(_0x36a536)})[_0xf589('0x37')](function(_0x48ff22){logger[_0xf589('0x1d')](JSON[_0xf589('0x41')](_0x48ff22));return{'source':_0x48ff22[_0xf589('0x58')][_0xf589('0x59')],'resolvedQuery':_0x48ff22['result'][_0xf589('0x5a')],'action':_0x48ff22['result'][_0xf589('0x5b')],'actionIncomplete':_0x48ff22[_0xf589('0x58')][_0xf589('0x5c')],'speech':_0x48ff22[_0xf589('0x58')][_0xf589('0x5d')][_0xf589('0x5e')],'score':_0x48ff22['result'][_0xf589('0x5f')],'statusCode':_0x48ff22[_0xf589('0x60')][_0xf589('0x61')],'endConversation':_0x48ff22[_0xf589('0x58')][_0xf589('0x62')][_0xf589('0x63')]||![],'isFallbackIntent':_0x48ff22[_0xf589('0x58')][_0xf589('0x62')][_0xf589('0x64')]};});};exports[_0xf589('0x65')]=function(_0x52c762,_0x28c20d,_0x424e75,_0x43eebc,_0x35c2c7,_0x4cdf42){var _0x4c6c8c=_0x43eebc['replace'](/\\n/g,'\x0a');var _0x2e1149={'credentials':{'private_key':_0x4c6c8c,'client_email':_0x424e75}};var _0x1053e2=new dialogflow[(_0xf589('0x66'))](_0x2e1149);var _0x50e6ee=_0x1053e2[_0xf589('0x67')](_0x28c20d,md5(_0x52c762));var _0x492010={'session':_0x50e6ee,'queryInput':{'text':{'text':_0x35c2c7,'languageCode':_0x4cdf42}}};return _0x1053e2[_0xf589('0x68')](_0x492010)[_0xf589('0x37')](function(_0x287ed6){if(_0x287ed6&&_0x287ed6[_0xf589('0x69')]){logger[_0xf589('0x1d')](_0xf589('0x6a'),JSON[_0xf589('0x41')](_0x287ed6));var _0x8ad916=_0x287ed6[0x0];if(_0x8ad916){var _0x377467={'action':_0x8ad916[_0xf589('0x6b')][_0xf589('0x5b')],'allRequiredParamsPresent':_0x8ad916[_0xf589('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x8ad916[_0xf589('0x6b')]['diagnosticInfo']&&_0x8ad916['queryResult'][_0xf589('0x6c')][_0xf589('0x6d')]?_0x8ad916[_0xf589('0x6b')][_0xf589('0x6c')][_0xf589('0x6d')][_0xf589('0x6e')][_0xf589('0x6f')]:![],'fulfillmentText':_0x8ad916['queryResult'][_0xf589('0x70')],'intentName':_0x8ad916[_0xf589('0x6b')][_0xf589('0x71')][_0xf589('0x54')],'intentDisplayName':_0x8ad916[_0xf589('0x6b')][_0xf589('0x71')][_0xf589('0x72')],'isFallbackIntent':_0x8ad916[_0xf589('0x6b')]['intent'][_0xf589('0x73')],'languageCode':_0x8ad916[_0xf589('0x6b')][_0xf589('0x74')],'queryText':_0x8ad916[_0xf589('0x6b')][_0xf589('0x75')],'responseId':_0x8ad916['responseId'],'score':_0x8ad916[_0xf589('0x6b')]['intentDetectionConfidence'],'speech':_0x8ad916[_0xf589('0x6b')][_0xf589('0x70')],'providerResponse':JSON[_0xf589('0x41')](_0x287ed6)};return _0x377467;}}});};exports[_0xf589('0x76')]=function(_0x2534d4,_0xeb9296,_0x754807,_0x5a5ddb){return tilde['asr'](_0x2534d4,_0xeb9296,_0x754807,_0x5a5ddb)[_0xf589('0x37')](function(_0x26f8bb){try{fs[_0xf589('0x1f')](_0x2534d4);}catch(_0x3c05dc){logger[_0xf589('0x17')](_0x3c05dc);}logger[_0xf589('0x1d')](_0xf589('0x77'),_0x26f8bb[_0xf589('0x4e')]);logger[_0xf589('0x1d')](_0xf589('0x78'),_0x26f8bb[_0xf589('0x50')]);return _0x26f8bb;});};exports[_0xf589('0x79')]=function(_0xa5dd93,_0x582549,_0x133aad,_0x5b19ca,_0x1222e6,_0x3e3eb3){var _0x36ef84=path[_0xf589('0x26')](__dirname,_0xf589('0x27'),rs[_0xf589('0x28')](0x4)+_0xf589('0x38'));var _0x21d94a;return aws['polly'](_0xa5dd93,_0x582549,_0x133aad,_0x5b19ca,_0x1222e6,_0x3e3eb3,_0x36ef84)[_0xf589('0x37')](function(){_0x21d94a=path[_0xf589('0x26')](__dirname,_0xf589('0x27'),rs[_0xf589('0x28')](0x4)+_0xf589('0x29'));return convertFile(_0x36ef84,_0x21d94a);})[_0xf589('0x37')](function(){try{fs[_0xf589('0x1f')](_0x36ef84);fs[_0xf589('0x2c')](_0x21d94a,_0xf589('0x2d'));}catch(_0x92691){logger[_0xf589('0x17')](_0x92691);}return _0x21d94a[_0xf589('0x2e')]('.')[0x0];});};exports[_0xf589('0x7a')]=function(_0x5228ae,_0x4f3540,_0x8860fa,_0x531e1f,_0x1b3b8b,_0x265bdb){return aws[_0xf589('0x7b')](_0x5228ae,_0x4f3540,_0x8860fa,_0x531e1f,_0x1b3b8b,_0x265bdb)['then'](function(_0x25ccab){logger[_0xf589('0x1d')](JSON[_0xf589('0x41')](_0x25ccab));return _0x25ccab;});};exports[_0xf589('0x7c')]=function(_0x361808,_0x4c337e,_0x38aa32,_0x3e2aea){var _0x6ac396=util[_0xf589('0x7d')](_0xf589('0x7e'),ISPEECH_API,_0x361808,encodeURIComponent(_0x4c337e),_0x38aa32,_0x3e2aea);var _0x3f7788=path[_0xf589('0x26')](__dirname,_0xf589('0x27'),rs[_0xf589('0x28')](0x4)+_0xf589('0x38'));var _0x589e7f;return downloadFile(_0x6ac396,_0x3f7788)[_0xf589('0x37')](function(){_0x589e7f=path[_0xf589('0x26')](__dirname,_0xf589('0x27'),rs[_0xf589('0x28')](0x4)+_0xf589('0x29'));return convertFile(_0x3f7788,_0x589e7f);})[_0xf589('0x37')](function(){try{fs[_0xf589('0x1f')](_0x3f7788);fs[_0xf589('0x2c')](_0x589e7f,_0xf589('0x2d'));}catch(_0x32f858){logger[_0xf589('0x17')](_0x32f858);}return _0x589e7f['split']('.')[0x0];});};exports[_0xf589('0x7f')]=function(_0x3dbac7,_0x434f58,_0x4b42c7,_0x49f7b3){var _0x29ec1c=util['format'](_0xf589('0x80'),ISPEECH_API,_0x434f58,_0x4b42c7,base64Encode(_0x3dbac7),_0x49f7b3?util[_0xf589('0x7d')](_0xf589('0x81'),encodeURIComponent(_0x49f7b3)):_0xf589('0x82'));return uploadFile(_0x29ec1c)['then'](function(_0x4f5a8d){return querystring[_0xf589('0xa')](_0x4f5a8d);});};exports[_0xf589('0x83')]=function(_0x41a980,_0x55aab6){return sestek['nda'](_0x41a980,_0x55aab6)[_0xf589('0x37')](function(_0x25d6ba){logger[_0xf589('0x1d')](JSON[_0xf589('0x41')](_0x25d6ba));var _0x4b9b89={'speech':_0x25d6ba[_0xf589('0x84')],'action':_0x25d6ba[_0xf589('0x85')]?_0x25d6ba[_0xf589('0x85')][_0xf589('0x86')]:undefined,'actiondata':_0x25d6ba[_0xf589('0x85')]?_0x25d6ba[_0xf589('0x85')][_0xf589('0x87')]:undefined};if(_0x25d6ba['channelData']&&_0x25d6ba[_0xf589('0x85')][_0xf589('0x88')]){return base64Decode(_0x25d6ba['channelData'][_0xf589('0x88')][_0xf589('0x89')],path[_0xf589('0x26')](__dirname,_0xf589('0x27'),rs[_0xf589('0x28')](0x4)+_0xf589('0x29')))[_0xf589('0x37')](function(_0x323e97){_0x4b9b89[_0xf589('0x8a')]=_0x323e97;return _0x4b9b89;});}return _0x4b9b89;});};exports[_0xf589('0x8b')]=function(){return __dirname;}; \ No newline at end of file +var _0xcdf5=['sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','wav','finish\x20to\x20convert','resolve','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','text:synthesize','POST','tmp','.mp3','from','writeFile','generate','chmodSync','info','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','actionIncomplete','fulfillment','speech','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','length','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','end_conversation','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','fulfillmentText','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3'];(function(_0x427214,_0xaa01af){var _0x4a9fe0=function(_0x6ab42){while(--_0x6ab42){_0x427214['push'](_0x427214['shift']());}};_0x4a9fe0(++_0xaa01af);}(_0xcdf5,0x1a8));var _0x5cdf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xcdf5[_0x19e35c];return _0x3e1fe8;};'use strict';var apiai=require(_0x5cdf('0x0'));var BPromise=require(_0x5cdf('0x1'));var dialogflow=require(_0x5cdf('0x2'));var fs=require('fs');var http=require(_0x5cdf('0x3'));var https=require('https');var md5=require(_0x5cdf('0x4'));var path=require(_0x5cdf('0x5'));var querystring=require(_0x5cdf('0x6'));var rp=require(_0x5cdf('0x7'));var rs=require(_0x5cdf('0x8'));var sox=require(_0x5cdf('0x9'));var tts=require(_0x5cdf('0xa'));var urlParse=require(_0x5cdf('0xb'))[_0x5cdf('0xc')];var util=require(_0x5cdf('0xd'));var aws=require(_0x5cdf('0xe'));var google=require(_0x5cdf('0xf'));var sestek=require(_0x5cdf('0x10'));var tilde=require(_0x5cdf('0x11'));var logger=require(_0x5cdf('0x12'))(_0x5cdf('0x13'));var ISPEECH_API=_0x5cdf('0x14');function downloadFile(_0x29afb5,_0x457de0){return new BPromise(function(_0x4f37e0,_0x5803e4){var _0xd1191b=urlParse(_0x29afb5);var _0x400c27=_0xd1191b[_0x5cdf('0x15')]===_0x5cdf('0x16')?https:http;var _0x3cc61b={'host':_0xd1191b[_0x5cdf('0x17')],'path':_0xd1191b[_0x5cdf('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x400c27[_0x5cdf('0x18')](_0x3cc61b,function(_0x468015){if(_0x468015[_0x5cdf('0x19')]!==0xc8){logger[_0x5cdf('0x1a')](_0x5cdf('0x1b')+_0x29afb5+_0x5cdf('0x1c')+_0x468015[_0x5cdf('0x19')]+'\x20('+_0x468015['statusMessage']+')');_0x5803e4(new Error(_0x5cdf('0x1b')+_0x29afb5+_0x5cdf('0x1c')+_0x468015[_0x5cdf('0x19')]+'\x20('+_0x468015[_0x5cdf('0x1d')]+')'));return;}var _0x98cbca=fs['createWriteStream'](_0x457de0);_0x98cbca['on'](_0x5cdf('0x1e'),function(){logger['info'](_0x5cdf('0x1f'));_0x98cbca[_0x5cdf('0x20')](_0x4f37e0);});_0x98cbca['on']('error',function(_0x12bbaf){fs[_0x5cdf('0x21')](_0x457de0);logger['error'](_0x5cdf('0x22'),_0x12bbaf);_0x5803e4(_0x12bbaf);});_0x468015[_0x5cdf('0x23')](_0x98cbca);})['on'](_0x5cdf('0x1a'),function(_0x50db46){logger[_0x5cdf('0x1a')](_0x50db46);_0x5803e4(_0x50db46);})[_0x5cdf('0x24')]();});}function uploadFile(_0x499738){return new BPromise(function(_0x337440,_0x92d445){var _0x17f625=urlParse(_0x499738);var _0x2a0f74=_0x17f625['protocol']==='https:'?https:http;var _0x5005e0={'host':_0x17f625[_0x5cdf('0x17')],'path':_0x17f625[_0x5cdf('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x2a0f74['get'](_0x5005e0,function(_0x185440){if(_0x185440[_0x5cdf('0x19')]!==0xc8){_0x92d445(new Error(_0x5cdf('0x1b')+_0x499738+_0x5cdf('0x1c')+_0x185440[_0x5cdf('0x19')]+'\x20('+_0x185440['statusMessage']+')'));return;}var _0x15b788='';_0x185440['on'](_0x5cdf('0x25'),function(_0x309ab7){_0x15b788+=_0x309ab7;});_0x185440['on'](_0x5cdf('0x24'),function(){_0x337440(_0x15b788);});})['on'](_0x5cdf('0x1a'),function(_0x479ed8){_0x92d445(_0x479ed8);})['end']();});}function convertFile(_0x419b25,_0x266a4d){return new BPromise(function(_0x565fe7,_0x5c9350){var _0x3f07e3=sox[_0x5cdf('0x26')](_0x419b25,_0x266a4d,{'sampleRate':0x1f40,'format':_0x5cdf('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3f07e3['on']('error',function(_0xb959a5){logger[_0x5cdf('0x1a')]('error\x20convert',_0xb959a5);_0x5c9350(_0xb959a5);});_0x3f07e3['on'](_0x5cdf('0x24'),function(){logger['info'](_0x5cdf('0x28'));_0x565fe7();});_0x3f07e3['start']();});}function base64Decode(_0x550ded,_0x53207d){var _0x5bf1a4=path[_0x5cdf('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0x5cdf('0x2a'));fs[_0x5cdf('0x2b')](_0x5bf1a4,_0x550ded,_0x5cdf('0x2c'));return convertFile(_0x5bf1a4,_0x53207d)[_0x5cdf('0x2d')](function(){try{fs[_0x5cdf('0x21')](_0x5bf1a4);fs['chmodSync'](_0x53207d,_0x5cdf('0x2e'));}catch(_0x41b08f){logger[_0x5cdf('0x1a')](_0x41b08f);}return _0x53207d[_0x5cdf('0x2f')]('.')[0x0];});}function base64Encode(_0x5a8873){var _0x14aa57=fs[_0x5cdf('0x30')](_0x5a8873);return new Buffer(_0x14aa57)[_0x5cdf('0x31')](_0x5cdf('0x2c'));}exports[_0x5cdf('0x32')]=function(_0x28af43,_0x451e26,_0x50cc5e,_0x5c2cfd,_0x45e9ff,_0x1a8203){var _0x42f778,_0x2d76d6;var _0x56ed20=_0x5cdf('0x33');var _0x5c2488=_0x5cdf('0x34')+_0x28af43;var _0x25d5a9={};if(_0x451e26===_0x5cdf('0x35')){_0x25d5a9[_0x5cdf('0x36')]={'ssml':_0x50cc5e};}else{_0x25d5a9[_0x5cdf('0x36')]={'text':_0x50cc5e};};_0x25d5a9[_0x5cdf('0x37')]={'languageCode':_0x5c2cfd,'ssmlGender':_0x45e9ff};_0x25d5a9['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5b4849={'url':_0x56ed20+_0x5cdf('0x38')+_0x5c2488,'method':_0x5cdf('0x39'),'json':!![],'body':_0x25d5a9};return rp(_0x5b4849)['then'](function(_0x200e3e){return new BPromise(function(_0x2cb20c,_0x4ec7bb){_0x42f778=path['resolve'](__dirname,_0x5cdf('0x3a'),rs['generate'](0x4)+_0x5cdf('0x3b'));var _0x7d09ac=Buffer[_0x5cdf('0x3c')](_0x200e3e['audioContent'],_0x5cdf('0x2c'));return fs[_0x5cdf('0x3d')](_0x42f778,_0x7d09ac,function(_0x5e0471){_0x4ec7bb(_0x5e0471);},function(_0x3e1a72){fs['chmodSync'](_0x42f778,'777');_0x2cb20c(_0x3e1a72);});});})[_0x5cdf('0x2d')](function(_0x246cf9){_0x2d76d6=path[_0x5cdf('0x29')](__dirname,'tmp',rs[_0x5cdf('0x3e')](0x4)+_0x5cdf('0x2a'));return convertFile(_0x42f778,_0x2d76d6);})[_0x5cdf('0x2d')](function(){try{fs[_0x5cdf('0x21')](_0x42f778);fs[_0x5cdf('0x3f')](_0x2d76d6,_0x5cdf('0x2e'));}catch(_0x215a72){logger['error'](_0x215a72);}logger[_0x5cdf('0x40')](_0x5cdf('0x41'),_0x2d76d6[_0x5cdf('0x2f')]('.')[0x0]);return _0x2d76d6[_0x5cdf('0x2f')]('.')[0x0];});};exports[_0x5cdf('0x42')]=function(_0x384336,_0x3fc78d){var _0x19153a=_0x5cdf('0x43');var _0x2f01e9,_0x45d4f0;var _0x4dbc8f;var _0x4f220d={'encoding':_0x5cdf('0x44'),'method':_0x5cdf('0x39'),'timeout':0x2710,'url':_0x19153a,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x5cdf('0x45')+encodeURIComponent(JSON[_0x5cdf('0x46')]([[[_0x5cdf('0x47'),JSON[_0x5cdf('0x46')]([_0x384336,_0x3fc78d||'en',![],_0x5cdf('0x48')]),null,_0x5cdf('0x49')]]]))};return rp(_0x4f220d)['then'](function(_0xf763ef){try{_0x4dbc8f=eval(_0xf763ef[_0x5cdf('0x4a')](0x5))[0x0][0x2];}catch(_0x338dac){throw new Error(_0x5cdf('0x4b')+_0xf763ef[_0x5cdf('0x25')]);}if(!_0x4dbc8f){if(_0x384336['length']>0xc8){throw new Error(_0x5cdf('0x4c'));}else{throw new Error(_0x5cdf('0x4d')+_0x3fc78d+_0x5cdf('0x4e'));}}try{_0x4dbc8f=eval(_0x4dbc8f)[0x0];}catch(_0x3c497e){throw new Error(_0x5cdf('0x4b')+res['data']);}const _0x3b3fba=_0x4dbc8f;_0x2f01e9=path[_0x5cdf('0x29')](__dirname,_0x5cdf('0x3a'),rs[_0x5cdf('0x3e')](0x4)+_0x5cdf('0x3b'));fs['writeFileSync'](_0x2f01e9,_0x4dbc8f,{'encoding':_0x5cdf('0x2c')});_0x45d4f0=path[_0x5cdf('0x29')](__dirname,'tmp',rs[_0x5cdf('0x3e')](0x4)+_0x5cdf('0x2a'));return convertFile(_0x2f01e9,_0x45d4f0);})['then'](function(){try{fs[_0x5cdf('0x21')](_0x2f01e9);fs['chmodSync'](_0x45d4f0,_0x5cdf('0x2e'));}catch(_0x50719d){logger['error'](_0x50719d);}logger['info'](_0x5cdf('0x4f'),_0x45d4f0[_0x5cdf('0x2f')]('.')[0x0]);return _0x45d4f0['split']('.')[0x0];});};exports['googleASR']=function(_0x13b4fb,_0x1bff9f,_0x1a6414){return google[_0x5cdf('0x50')](_0x13b4fb,_0x1bff9f,_0x1a6414)[_0x5cdf('0x2d')](function(_0x53fd12){logger[_0x5cdf('0x40')](_0x53fd12[_0x5cdf('0x51')]);return rp(_0x53fd12);})[_0x5cdf('0x2d')](function(_0x2cf64a){var _0x183bf8='';var _0xd48aff=0x0;try{fs[_0x5cdf('0x21')](_0x13b4fb);}catch(_0x44bc85){logger['error'](_0x44bc85);}if(_0x2cf64a&&_0x2cf64a[_0x5cdf('0x52')]){_0x183bf8=_0x2cf64a[_0x5cdf('0x52')][_0x5cdf('0x53')](function(_0x530c23){return _0x530c23&&_0x530c23['alternatives'][0x0]&&_0x530c23[_0x5cdf('0x54')][0x0][_0x5cdf('0x55')]?_0x530c23[_0x5cdf('0x54')][0x0]['transcript']:'';})[_0x5cdf('0x56')]('\x0a');_0xd48aff=_0x2cf64a[_0x5cdf('0x52')][_0x5cdf('0x53')](function(_0x3c3ba7){return _0x3c3ba7&&_0x3c3ba7[_0x5cdf('0x54')][0x0]&&_0x3c3ba7[_0x5cdf('0x54')][0x0][_0x5cdf('0x57')]?_0x3c3ba7['alternatives'][0x0][_0x5cdf('0x57')]:0x0;})['join']('\x0a');}logger[_0x5cdf('0x40')]('googleASR\x20transcription',_0x183bf8);logger[_0x5cdf('0x40')](_0x5cdf('0x58'),_0xd48aff);return{'transcript':_0x183bf8,'confidence':_0xd48aff};})[_0x5cdf('0x59')](function(_0x4a6db4){logger[_0x5cdf('0x1a')]('[%s]\x20%s:%s',_0x4a6db4['statusCode'],_0x4a6db4[_0x5cdf('0x5a')],_0x4a6db4[_0x5cdf('0x5b')]);});};exports[_0x5cdf('0x5c')]=function(_0x16bcbb,_0x356d13,_0x59afc9,_0x4958af){var _0x6e5aa2=apiai(_0x356d13,{'language':_0x4958af||'en'});return _0x6e5aa2[_0x5cdf('0x5d')](_0x59afc9,{'sessionId':md5(_0x16bcbb)})[_0x5cdf('0x2d')](function(_0x3679c0){logger[_0x5cdf('0x40')](JSON[_0x5cdf('0x46')](_0x3679c0));return{'source':_0x3679c0[_0x5cdf('0x5e')]['source'],'resolvedQuery':_0x3679c0[_0x5cdf('0x5e')]['resolvedQuery'],'action':_0x3679c0['result']['action'],'actionIncomplete':_0x3679c0[_0x5cdf('0x5e')][_0x5cdf('0x5f')],'speech':_0x3679c0[_0x5cdf('0x5e')][_0x5cdf('0x60')][_0x5cdf('0x61')],'score':_0x3679c0[_0x5cdf('0x5e')]['score'],'statusCode':_0x3679c0['status'][_0x5cdf('0x62')],'endConversation':_0x3679c0[_0x5cdf('0x5e')][_0x5cdf('0x63')]['endConversation']||![],'isFallbackIntent':_0x3679c0[_0x5cdf('0x5e')][_0x5cdf('0x63')][_0x5cdf('0x64')]};});};exports[_0x5cdf('0x65')]=function(_0x410620,_0x4d06c9,_0x5af5ea,_0x237f35,_0x336fb6,_0x2baece){var _0x4cd149=_0x237f35[_0x5cdf('0x66')](/\\n/g,'\x0a');var _0x27bfc2={'credentials':{'private_key':_0x4cd149,'client_email':_0x5af5ea}};var _0x125f06=new dialogflow[(_0x5cdf('0x67'))](_0x27bfc2);var _0x4e5c57=_0x125f06[_0x5cdf('0x68')](_0x4d06c9,md5(_0x410620));var _0xc55511={'session':_0x4e5c57,'queryInput':{'text':{'text':_0x336fb6,'languageCode':_0x2baece}}};return _0x125f06['detectIntent'](_0xc55511)[_0x5cdf('0x2d')](function(_0x101272){if(_0x101272&&_0x101272[_0x5cdf('0x69')]){logger[_0x5cdf('0x40')](_0x5cdf('0x6a'),JSON['stringify'](_0x101272));var _0x13fe8d=_0x101272[0x0];if(_0x13fe8d){var _0x2bac04={'action':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x6c')],'allRequiredParamsPresent':_0x13fe8d[_0x5cdf('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x6d')]&&_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x6d')]['fields']?_0x13fe8d['queryResult'][_0x5cdf('0x6d')][_0x5cdf('0x6e')][_0x5cdf('0x6f')]['boolValue']:![],'fulfillmentText':_0x13fe8d[_0x5cdf('0x6b')]['fulfillmentText'],'intentName':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x70')]['name'],'intentDisplayName':_0x13fe8d[_0x5cdf('0x6b')]['intent'][_0x5cdf('0x71')],'isFallbackIntent':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x70')][_0x5cdf('0x72')],'languageCode':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x73')],'queryText':_0x13fe8d['queryResult'][_0x5cdf('0x74')],'responseId':_0x13fe8d['responseId'],'score':_0x13fe8d['queryResult'][_0x5cdf('0x75')],'speech':_0x13fe8d[_0x5cdf('0x6b')][_0x5cdf('0x76')],'providerResponse':JSON['stringify'](_0x101272)};return _0x2bac04;}}});};exports['tildeASR']=function(_0x292191,_0x7cedf1,_0x44f609,_0x512c4c){return tilde[_0x5cdf('0x50')](_0x292191,_0x7cedf1,_0x44f609,_0x512c4c)[_0x5cdf('0x2d')](function(_0x11d870){try{fs['unlink'](_0x292191);}catch(_0x1e6676){logger[_0x5cdf('0x1a')](_0x1e6676);}logger['info']('Tilde\x20ASR\x20transcription',_0x11d870[_0x5cdf('0x55')]);logger[_0x5cdf('0x40')]('Tilde\x20ASR\x20confidence',_0x11d870['confidence']);return _0x11d870;});};exports[_0x5cdf('0x77')]=function(_0x200585,_0x12b51a,_0x305c93,_0x2c2948,_0x37c8d0,_0x5be448){var _0x2f6601=path['resolve'](__dirname,_0x5cdf('0x3a'),rs['generate'](0x4)+_0x5cdf('0x3b'));var _0x2fa89a;return aws['polly'](_0x200585,_0x12b51a,_0x305c93,_0x2c2948,_0x37c8d0,_0x5be448,_0x2f6601)[_0x5cdf('0x2d')](function(){_0x2fa89a=path[_0x5cdf('0x29')](__dirname,_0x5cdf('0x3a'),rs['generate'](0x4)+'.wav');return convertFile(_0x2f6601,_0x2fa89a);})['then'](function(){try{fs['unlink'](_0x2f6601);fs[_0x5cdf('0x3f')](_0x2fa89a,'777');}catch(_0x571325){logger['error'](_0x571325);}return _0x2fa89a[_0x5cdf('0x2f')]('.')[0x0];});};exports[_0x5cdf('0x78')]=function(_0x30a5d9,_0x46262e,_0x5d3864,_0xca31fb,_0x2263bb,_0x1fdfb3){return aws[_0x5cdf('0x79')](_0x30a5d9,_0x46262e,_0x5d3864,_0xca31fb,_0x2263bb,_0x1fdfb3)[_0x5cdf('0x2d')](function(_0x3afe26){logger[_0x5cdf('0x40')](JSON[_0x5cdf('0x46')](_0x3afe26));return _0x3afe26;});};exports[_0x5cdf('0x7a')]=function(_0x306dcf,_0x49e237,_0x23c34e,_0x595899){var _0x46c258=util[_0x5cdf('0x7b')](_0x5cdf('0x7c'),ISPEECH_API,_0x306dcf,encodeURIComponent(_0x49e237),_0x23c34e,_0x595899);var _0x3b43f1=path[_0x5cdf('0x29')](__dirname,_0x5cdf('0x3a'),rs[_0x5cdf('0x3e')](0x4)+_0x5cdf('0x3b'));var _0x12ff34;return downloadFile(_0x46c258,_0x3b43f1)[_0x5cdf('0x2d')](function(){_0x12ff34=path['resolve'](__dirname,_0x5cdf('0x3a'),rs[_0x5cdf('0x3e')](0x4)+_0x5cdf('0x2a'));return convertFile(_0x3b43f1,_0x12ff34);})['then'](function(){try{fs[_0x5cdf('0x21')](_0x3b43f1);fs['chmodSync'](_0x12ff34,_0x5cdf('0x2e'));}catch(_0x51d087){logger[_0x5cdf('0x1a')](_0x51d087);}return _0x12ff34[_0x5cdf('0x2f')]('.')[0x0];});};exports[_0x5cdf('0x7d')]=function(_0x49d38b,_0x3ce636,_0x4adb36,_0x283eae){var _0x2c516d=util[_0x5cdf('0x7b')](_0x5cdf('0x7e'),ISPEECH_API,_0x3ce636,_0x4adb36,base64Encode(_0x49d38b),_0x283eae?util[_0x5cdf('0x7b')]('model=%s',encodeURIComponent(_0x283eae)):_0x5cdf('0x7f'));return uploadFile(_0x2c516d)[_0x5cdf('0x2d')](function(_0xa2ae2b){return querystring[_0x5cdf('0xc')](_0xa2ae2b);});};exports[_0x5cdf('0x80')]=function(_0x54f684,_0x5c28f0){return sestek[_0x5cdf('0x81')](_0x54f684,_0x5c28f0)[_0x5cdf('0x2d')](function(_0x5ef731){logger[_0x5cdf('0x40')](JSON[_0x5cdf('0x46')](_0x5ef731));var _0x57eca7={'speech':_0x5ef731[_0x5cdf('0x82')],'action':_0x5ef731['channelData']?_0x5ef731[_0x5cdf('0x83')][_0x5cdf('0x84')]:undefined,'actiondata':_0x5ef731[_0x5cdf('0x83')]?_0x5ef731[_0x5cdf('0x83')][_0x5cdf('0x85')]:undefined};if(_0x5ef731['channelData']&&_0x5ef731[_0x5cdf('0x83')][_0x5cdf('0x86')]){return base64Decode(_0x5ef731[_0x5cdf('0x83')][_0x5cdf('0x86')][_0x5cdf('0x87')],path['resolve'](__dirname,_0x5cdf('0x3a'),rs['generate'](0x4)+_0x5cdf('0x2a')))[_0x5cdf('0x2d')](function(_0xc4e4a1){_0x57eca7[_0x5cdf('0x88')]=_0xc4e4a1;return _0x57eca7;});}return _0x57eca7;});};exports[_0x5cdf('0x89')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index c0a5a4b..5881902 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 _0xa0da=['./nda'];(function(_0x13e862,_0x34a0ed){var _0x3766f1=function(_0x59ec28){while(--_0x59ec28){_0x13e862['push'](_0x13e862['shift']());}};_0x3766f1(++_0x34a0ed);}(_0xa0da,0x68));var _0xaa0d=function(_0x441568,_0x2539d5){_0x441568=_0x441568-0x0;var _0x1558d5=_0xa0da[_0x441568];return _0x1558d5;};var nda=require(_0xaa0d('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x0b88=['./nda'];(function(_0x46ecbb,_0x1ca801){var _0x55eefc=function(_0x5a4476){while(--_0x5a4476){_0x46ecbb['push'](_0x46ecbb['shift']());}};_0x55eefc(++_0x1ca801);}(_0x0b88,0x1c5));var _0x80b8=function(_0x46fe88,_0xcbb5c6){_0x46fe88=_0x46fe88-0x0;var _0x44f398=_0x0b88[_0x46fe88];return _0x44f398;};var nda=require(_0x80b8('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 5549cc9..426a7f1 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 _0xf257=['extension','text','Bearer\x20','access_token','project','body','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','message','callerid','dnid'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf257,0x82));var _0x7f25=function(_0x2e53aa,_0x5cfc99){_0x2e53aa=_0x2e53aa-0x0;var _0x2fb4ee=_0xf257[_0x2e53aa];return _0x2fb4ee;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x7f25('0x0'))(_0x7f25('0x1'));module[_0x7f25('0x2')]=function(_0x22d4a9,_0x5c712c){var _0x159dd1={'method':_0x7f25('0x3'),'uri':url[_0x7f25('0x4')](_0x5c712c[_0x7f25('0x5')],_0x7f25('0x6')),'form':{'grant_type':_0x7f25('0x7'),'username':_0x5c712c[_0x7f25('0x8')],'password':_0x5c712c[_0x7f25('0x7')]},'json':!![]};return rp(_0x159dd1)[_0x7f25('0x9')](function(_0x16e278){var _0x31a5d8={'method':_0x7f25('0x3'),'uri':url[_0x7f25('0x4')](_0x5c712c[_0x7f25('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5c712c[_0x7f25('0xb')]||_0x7f25('0xc'),'channelId':'Nda','conversation':{'id':_0x22d4a9['uniqueid']},'from':{'id':_0x22d4a9[_0x7f25('0xd')],'name':_0x22d4a9['calleridname']},'recipient':{'id':_0x22d4a9[_0x7f25('0xe')],'name':_0x22d4a9[_0x7f25('0xf')]},'text':_0x5c712c[_0x7f25('0x10')],'channelData':{}},'headers':{'Authorization':_0x7f25('0x11')+_0x16e278[_0x7f25('0x12')]},'json':!![]};if(_0x5c712c[_0x7f25('0x13')]){_0x31a5d8[_0x7f25('0x14')]['channelData']['ProjectName']=_0x5c712c[_0x7f25('0x13')];}if(_0x5c712c['ndagenerate_audio']=='1'){_0x31a5d8[_0x7f25('0x14')][_0x7f25('0x15')][_0x7f25('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7f25('0x17')};}if(_0x5c712c[_0x7f25('0x18')]){_0x31a5d8['body']['channelData']['CustomAction']=_0x5c712c[_0x7f25('0x18')];if(_0x5c712c[_0x7f25('0x19')]){_0x31a5d8[_0x7f25('0x14')][_0x7f25('0x15')][_0x7f25('0x1a')]=_0x5c712c[_0x7f25('0x19')];}}logger[_0x7f25('0x1b')](JSON[_0x7f25('0x1c')](_0x31a5d8));return rp(_0x31a5d8);});}; \ No newline at end of file +var _0x9354=['url','../../../../../config/logger','exports','resolve','ndauth_url','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','extension','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify'];(function(_0x51c3b1,_0x40d2b3){var _0x2a7b04=function(_0x25b27e){while(--_0x25b27e){_0x51c3b1['push'](_0x51c3b1['shift']());}};_0x2a7b04(++_0x40d2b3);}(_0x9354,0x96));var _0x4935=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x9354[_0x47aa64];return _0x549c7a;};'use strict';var rp=require('request-promise');var url=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('agi');module[_0x4935('0x2')]=function(_0x2a4993,_0x29d1eb){var _0x280bbc={'method':'POST','uri':url[_0x4935('0x3')](_0x29d1eb[_0x4935('0x4')],_0x4935('0x5')),'form':{'grant_type':_0x4935('0x6'),'username':_0x29d1eb[_0x4935('0x7')],'password':_0x29d1eb[_0x4935('0x6')]},'json':!![]};return rp(_0x280bbc)[_0x4935('0x8')](function(_0x2d735e){var _0x10793e={'method':'POST','uri':url[_0x4935('0x3')](_0x29d1eb['ndassistant_url'],_0x4935('0x9')),'body':{'type':_0x29d1eb[_0x4935('0xa')]||_0x4935('0xb'),'channelId':_0x4935('0xc'),'conversation':{'id':_0x2a4993[_0x4935('0xd')]},'from':{'id':_0x2a4993[_0x4935('0xe')],'name':_0x2a4993['calleridname']},'recipient':{'id':_0x2a4993['dnid'],'name':_0x2a4993[_0x4935('0xf')]},'text':_0x29d1eb['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2d735e[_0x4935('0x10')]},'json':!![]};if(_0x29d1eb[_0x4935('0x11')]){_0x10793e[_0x4935('0x12')][_0x4935('0x13')][_0x4935('0x14')]=_0x29d1eb[_0x4935('0x11')];}if(_0x29d1eb[_0x4935('0x15')]=='1'){_0x10793e[_0x4935('0x12')][_0x4935('0x13')][_0x4935('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4935('0x17')};}if(_0x29d1eb[_0x4935('0x18')]){_0x10793e[_0x4935('0x12')][_0x4935('0x13')][_0x4935('0x19')]=_0x29d1eb[_0x4935('0x18')];if(_0x29d1eb['custom_action_data']){_0x10793e[_0x4935('0x12')][_0x4935('0x13')][_0x4935('0x1a')]=_0x29d1eb[_0x4935('0x1b')];}}logger[_0x4935('0x1c')](JSON[_0x4935('0x1d')](_0x10793e));return rp(_0x10793e);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 5e4b293..f0656ff 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 _0xb7e0=['exports'];(function(_0x3a4203,_0xa6ff2e){var _0x1a5661=function(_0x584f45){while(--_0x584f45){_0x3a4203['push'](_0x3a4203['shift']());}};_0x1a5661(++_0xa6ff2e);}(_0xb7e0,0x195));var _0x0b7e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb7e0[_0x397e5f];return _0x5302b8;};'use strict';var asr=require('./lib/api');module[_0x0b7e('0x0')]=function(_0x26a01f,_0x46068f,_0x42c842,_0x437a84){return asr(_0x26a01f,_0x46068f,_0x42c842,_0x437a84);}; \ No newline at end of file +var _0x2c16=['./lib/api','exports'];(function(_0x4b8582,_0x32b967){var _0x4e538d=function(_0x383c35){while(--_0x383c35){_0x4b8582['push'](_0x4b8582['shift']());}};_0x4e538d(++_0x32b967);}(_0x2c16,0x76));var _0x62c1=function(_0x2fc94b,_0x109c1b){_0x2fc94b=_0x2fc94b-0x0;var _0x394808=_0x2c16[_0x2fc94b];return _0x394808;};'use strict';var asr=require(_0x62c1('0x0'));module[_0x62c1('0x1')]=function(_0x365ef8,_0x2681f8,_0x122a70,_0x3645f6){return asr(_0x365ef8,_0x2681f8,_0x122a70,_0x3645f6);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index fc6667d..18d4540 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 _0x5fb4=['unix','send','data','close','EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Close\x20Tilde\x20ASR\x20socket','isNil','open','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','Open\x20Tilde\x20ASR\x20socket'];(function(_0x5bd3f2,_0x49f10b){var _0x444bfb=function(_0xae7210){while(--_0xae7210){_0x5bd3f2['push'](_0x5bd3f2['shift']());}};_0x444bfb(++_0x49f10b);}(_0x5fb4,0xca));var _0x45fb=function(_0xd4a159,_0xf9b939){_0xd4a159=_0xd4a159-0x0;var _0x1cd742=_0x5fb4[_0xd4a159];return _0x1cd742;};'use strict';var BPromise=require(_0x45fb('0x0'));var _=require(_0x45fb('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x45fb('0x2'));var crypto=require(_0x45fb('0x3'));var logger=require(_0x45fb('0x4'))(_0x45fb('0x5'));module[_0x45fb('0x6')]=function(_0x1aab7a,_0x649e10,_0x1ef02f,_0x4fcf9c){return new BPromise(function(_0x158ce6,_0x15e2a0){logger[_0x45fb('0x7')](_0x45fb('0x8'),_0x4fcf9c||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2cafb8=new WebSocket(_0x4fcf9c||_0x45fb('0x9'),{'perMessageDeflate':![]});var _0x3146b9='';var _0x4b5863='0';var _0x132954='1';var _0x32d28a=_0x45fb('0xa');function _0x9db4e(_0x40fc16){var _0xfe80ea=crypto[_0x45fb('0xb')]('sha1');_0xfe80ea[_0x45fb('0xc')](_0x40fc16);return _0xfe80ea['digest']('hex');}function _0x1f6e84(){try{logger['info'](_0x45fb('0xd'));var _0x58474e=moment()[_0x45fb('0xe')]();var _0x5e9e59=_0x9db4e(_0x58474e+_0x649e10+_0x1ef02f);_0x2cafb8[_0x45fb('0xf')](JSON['stringify']({'appID':_0x649e10,'timestamp':_0x58474e,'appKey':_0x5e9e59}));var _0x5e02e4=fs['createReadStream'](_0x1aab7a);_0x5e02e4['on'](_0x45fb('0x10'),function(_0x1f3334){_0x2cafb8[_0x45fb('0xf')](_0x1f3334);});_0x5e02e4['on'](_0x45fb('0x11'),function(){_0x2cafb8['send'](_0x45fb('0x12'));});}catch(_0x832bc4){logger['error'](_0x45fb('0x13'),JSON[_0x45fb('0x14')](_0x832bc4));_0x2cafb8[_0x45fb('0x15')]();}}function _0x3615ff(_0x533921){try{if(_0x533921){var _0x886907=JSON[_0x45fb('0x16')](_0x533921);switch(_0x886907[_0x45fb('0x17')]){case 0x0:if(_0x886907[_0x45fb('0x18')]){if(_0x886907[_0x45fb('0x18')][_0x45fb('0x19')]){logger['info'](_0x45fb('0x1a'),JSON[_0x45fb('0x14')](_0x886907[_0x45fb('0x18')][_0x45fb('0x1b')]));_0x3146b9=_0x886907[_0x45fb('0x18')][_0x45fb('0x1b')][0x0]['transcript'];_0x4b5863=_0x886907[_0x45fb('0x18')]['hypotheses'][0x0]['likelihood'];_0x132954='0';_0x32d28a=_0x45fb('0x1c');_0x2cafb8['terminate']();}}break;case 0x1:logger['info'](_0x45fb('0xa'));_0x132954='1';_0x32d28a=_0x45fb('0xa');break;case 0x2:logger[_0x45fb('0x7')](_0x45fb('0x1d'));_0x132954='2';_0x32d28a=_0x45fb('0x1d');break;case 0x9:logger[_0x45fb('0x7')](_0x45fb('0x1e'));_0x132954='9';_0x32d28a=_0x45fb('0x1e');break;case 0xa:logger[_0x45fb('0x7')]('Authentication\x20failed.');_0x132954='10';_0x32d28a='Authentication\x20failed.';break;case 0xb:logger[_0x45fb('0x7')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x132954='11';_0x32d28a=_0x45fb('0x1f');}}}catch(_0x3d1fc2){logger[_0x45fb('0x20')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x45fb('0x14')](_0x3d1fc2));_0x2cafb8[_0x45fb('0x15')]();}}function _0x219fbe(){logger[_0x45fb('0x7')](_0x45fb('0x21'));_0x158ce6({'transcript':_0x3146b9,'confidence':_0x4b5863,'status':_0x132954,'status_message':_0x32d28a});}function _0x7dcada(_0x5ea2c){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x45fb('0x22')](_0x5ea2c)){logger['error'](_['isObject'](_0x5ea2c)?JSON[_0x45fb('0x14')](_0x5ea2c):_0x5ea2c);}}_0x2cafb8['on'](_0x45fb('0x23'),_0x1f6e84);_0x2cafb8['on']('message',_0x3615ff);_0x2cafb8['on'](_0x45fb('0x11'),_0x219fbe);_0x2cafb8['on'](_0x45fb('0x20'),_0x7dcada);});}; \ No newline at end of file +var _0x9cc1=['send','stringify','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix'];(function(_0x55bc90,_0x22f4d0){var _0x3093c6=function(_0x38732c){while(--_0x38732c){_0x55bc90['push'](_0x55bc90['shift']());}};_0x3093c6(++_0x22f4d0);}(_0x9cc1,0x109));var _0x19cc=function(_0x44a0e9,_0x959f63){_0x44a0e9=_0x44a0e9-0x0;var _0x3b8e8c=_0x9cc1[_0x44a0e9];return _0x3b8e8c;};'use strict';var BPromise=require(_0x19cc('0x0'));var _=require(_0x19cc('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x19cc('0x2'));var crypto=require('crypto');var logger=require(_0x19cc('0x3'))('agi');module[_0x19cc('0x4')]=function(_0x5c3c9d,_0x2b205b,_0x1f6a67,_0x158260){return new BPromise(function(_0x22fbaa,_0x45bd85){logger[_0x19cc('0x5')]('Tilde\x20URI',_0x158260||_0x19cc('0x6'));var _0x1ac095=new WebSocket(_0x158260||_0x19cc('0x6'),{'perMessageDeflate':![]});var _0x4ec220='';var _0x542e9='0';var _0x3cbd31='1';var _0x11b735=_0x19cc('0x7');function _0x5c1ff4(_0x9a9637){var _0x1872e6=crypto[_0x19cc('0x8')](_0x19cc('0x9'));_0x1872e6[_0x19cc('0xa')](_0x9a9637);return _0x1872e6[_0x19cc('0xb')](_0x19cc('0xc'));}function _0x5dd586(){try{logger['info'](_0x19cc('0xd'));var _0x3ba510=moment()[_0x19cc('0xe')]();var _0x251a0a=_0x5c1ff4(_0x3ba510+_0x2b205b+_0x1f6a67);_0x1ac095[_0x19cc('0xf')](JSON[_0x19cc('0x10')]({'appID':_0x2b205b,'timestamp':_0x3ba510,'appKey':_0x251a0a}));var _0xe77263=fs['createReadStream'](_0x5c3c9d);_0xe77263['on']('data',function(_0x224c61){_0x1ac095['send'](_0x224c61);});_0xe77263['on'](_0x19cc('0x11'),function(){_0x1ac095[_0x19cc('0xf')](_0x19cc('0x12'));});}catch(_0x320f2e){logger[_0x19cc('0x13')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x320f2e));_0x1ac095[_0x19cc('0x14')]();}}function _0x1706b5(_0x28df41){try{if(_0x28df41){var _0x18dead=JSON[_0x19cc('0x15')](_0x28df41);switch(_0x18dead[_0x19cc('0x16')]){case 0x0:if(_0x18dead['result']){if(_0x18dead[_0x19cc('0x17')][_0x19cc('0x18')]){logger[_0x19cc('0x5')](_0x19cc('0x19'),JSON['stringify'](_0x18dead[_0x19cc('0x17')]['hypotheses']));_0x4ec220=_0x18dead[_0x19cc('0x17')][_0x19cc('0x1a')][0x0]['transcript'];_0x542e9=_0x18dead['result'][_0x19cc('0x1a')][0x0]['likelihood'];_0x3cbd31='0';_0x11b735=_0x19cc('0x1b');_0x1ac095[_0x19cc('0x14')]();}}break;case 0x1:logger[_0x19cc('0x5')](_0x19cc('0x7'));_0x3cbd31='1';_0x11b735=_0x19cc('0x7');break;case 0x2:logger[_0x19cc('0x5')](_0x19cc('0x1c'));_0x3cbd31='2';_0x11b735=_0x19cc('0x1c');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3cbd31='9';_0x11b735='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x19cc('0x5')](_0x19cc('0x1d'));_0x3cbd31='10';_0x11b735=_0x19cc('0x1d');break;case 0xb:logger[_0x19cc('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x3cbd31='11';_0x11b735='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x5a4d92){logger[_0x19cc('0x13')](_0x19cc('0x1e'),JSON[_0x19cc('0x10')](_0x5a4d92));_0x1ac095[_0x19cc('0x14')]();}}function _0x4d52d7(){logger[_0x19cc('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x22fbaa({'transcript':_0x4ec220,'confidence':_0x542e9,'status':_0x3cbd31,'status_message':_0x11b735});}function _0x5b3cdf(_0x428b0e){logger[_0x19cc('0x13')](_0x19cc('0x1f'));if(!_[_0x19cc('0x20')](_0x428b0e)){logger[_0x19cc('0x13')](_[_0x19cc('0x21')](_0x428b0e)?JSON['stringify'](_0x428b0e):_0x428b0e);}}_0x1ac095['on']('open',_0x5dd586);_0x1ac095['on'](_0x19cc('0x22'),_0x1706b5);_0x1ac095['on'](_0x19cc('0x11'),_0x4d52d7);_0x1ac095['on'](_0x19cc('0x13'),_0x5b3cdf);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 4a6b870..10cb4be 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 _0xe9cd=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9cd,0x113));var _0xde9c=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xe9cd[_0x1b2ff7];return _0x31656a;};var asr=require('./asr');module[_0xde9c('0x0')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index d692e3f..2ad1e37 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 _0xa814=['error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION','destroy','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','./error','./channel','127.0.0.1','call','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa814,0x14a));var _0x4a81=function(_0x2c4d47,_0x5172da){_0x2c4d47=_0x2c4d47-0x0;var _0x427445=_0xa814[_0x2c4d47];return _0x427445;};'use strict';var util=require('util');var net=require(_0x4a81('0x0'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require(_0x4a81('0x1'));var AGIChannel=require(_0x4a81('0x2'));var AGIServer=function(_0x426c1b,_0x31f2b1,_0x3f41d9){var _0x5b2468=this,_0x426c1b=_0x426c1b||0x11dd,_0x31f2b1=_0x31f2b1||_0x4a81('0x3'),_0x2d1f8b=null,_0x5491d7=0x0;EventEmitter[_0x4a81('0x4')](_0x5b2468);function _0x158b6f(){if(!_0x426c1b){_0x5b2468[_0x4a81('0x5')](_0x4a81('0x6'),new AGIError(_0x4a81('0x7')));return![];}_0x2d1f8b=net['createServer']();_0x2d1f8b[_0x4a81('0x8')](_0x426c1b,_0x31f2b1);_0x2d1f8b['on'](_0x4a81('0x9'),function(){_0x5b2468[_0x4a81('0x5')](_0x4a81('0x9'));});_0x2d1f8b['on'](_0x4a81('0xa'),function(_0x3d43d9){_0x2d1f8b[_0x4a81('0xb')](function(_0x2a0abd,_0x3885f3){if(_0x2a0abd){_0x5b2468['emit'](_0x4a81('0x6'),new AGIError(_0x4a81('0xc'),_0x2a0abd));}else if(_0x3f41d9&&_0x3f41d9<0x0){_0x5b2468[_0x4a81('0x5')](_0x4a81('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x3d43d9['destroy']();}else if(_0x3f41d9&&_0x3f41d9>0x0&&_0x3f41d9<_0x3885f3){_0x5491d7+=0x1;_0x5b2468['emit'](_0x4a81('0x6'),new AGIError(_0x4a81('0xd'),_0x5491d7));_0x3d43d9[_0x4a81('0xe')]();}else{var _0x2fd366=new AGIChannel(_0x3d43d9);_0x2fd366['on'](_0x4a81('0xf'),function(){_0x5b2468['emit'](_0x4a81('0xa'),_0x2fd366);});}});});_0x2d1f8b['on'](_0x4a81('0x6'),function(_0x51c5d6){_0x5b2468['emit']('error',new AGIError(_0x4a81('0xc'),_0x51c5d6['code']));});_0x2d1f8b['on'](_0x4a81('0x10'),function(){_0x5b2468['emit'](_0x4a81('0x10'),new AGIError(_0x4a81('0x11')));});}process[_0x4a81('0x12')](function(){_0x158b6f();});};util[_0x4a81('0x13')](AGIServer,EventEmitter);module[_0x4a81('0x14')]=function(_0x5ea7a8,_0x1b20a3,_0x1040b3){return new AGIServer(_0x5ea7a8,_0x1b20a3,_0x1040b3);}; \ No newline at end of file +var _0xcb37=['ready','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','EventEmitter','./error','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0xcb37,0x123));var _0x7cb3=function(_0x40d82d,_0x2199ba){_0x40d82d=_0x40d82d-0x0;var _0x1c27a9=_0xcb37[_0x40d82d];return _0x1c27a9;};'use strict';var util=require(_0x7cb3('0x0'));var net=require(_0x7cb3('0x1'));var EventEmitter=require(_0x7cb3('0x2'))[_0x7cb3('0x3')];var AGIError=require(_0x7cb3('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x323c31,_0x444a06,_0x18674e){var _0x28dcde=this,_0x323c31=_0x323c31||0x11dd,_0x444a06=_0x444a06||_0x7cb3('0x5'),_0x5028c7=null,_0x21cbaa=0x0;EventEmitter[_0x7cb3('0x6')](_0x28dcde);function _0x4a36fa(){if(!_0x323c31){_0x28dcde[_0x7cb3('0x7')](_0x7cb3('0x8'),new AGIError(_0x7cb3('0x9')));return![];}_0x5028c7=net[_0x7cb3('0xa')]();_0x5028c7[_0x7cb3('0xb')](_0x323c31,_0x444a06);_0x5028c7['on']('listening',function(){_0x28dcde['emit'](_0x7cb3('0xc'));});_0x5028c7['on'](_0x7cb3('0xd'),function(_0x56c242){_0x5028c7[_0x7cb3('0xe')](function(_0x1c3cff,_0x4d7fa9){if(_0x1c3cff){_0x28dcde[_0x7cb3('0x7')]('error',new AGIError(_0x7cb3('0xf'),_0x1c3cff));}else if(_0x18674e&&_0x18674e<0x0){_0x28dcde['emit']('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x56c242[_0x7cb3('0x10')]();}else if(_0x18674e&&_0x18674e>0x0&&_0x18674e<_0x4d7fa9){_0x21cbaa+=0x1;_0x28dcde[_0x7cb3('0x7')](_0x7cb3('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x21cbaa));_0x56c242['destroy']();}else{var _0x484e9d=new AGIChannel(_0x56c242);_0x484e9d['on'](_0x7cb3('0x11'),function(){_0x28dcde['emit']('connection',_0x484e9d);});}});});_0x5028c7['on'](_0x7cb3('0x8'),function(_0xdb775a){_0x28dcde[_0x7cb3('0x7')](_0x7cb3('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0xdb775a['code']));});_0x5028c7['on'](_0x7cb3('0x12'),function(){_0x28dcde[_0x7cb3('0x7')](_0x7cb3('0x12'),new AGIError(_0x7cb3('0x13')));});}process['nextTick'](function(){_0x4a36fa();});};util[_0x7cb3('0x14')](AGIServer,EventEmitter);module[_0x7cb3('0x15')]=function(_0x506cc3,_0x36faaa,_0x401214){return new AGIServer(_0x506cc3,_0x36faaa,_0x401214);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 5b9fcf1..1fa928b 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 _0xc429=['exports','path','lodash','randomstring','moment','mustache','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','rpc','then','name','prototype','getVoiceQueue','catch','getSquareProject','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','priority','dnid','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','agent','agentUnpause','agentLogin','%s/%s@from-sip/n','shellCommand','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','includes','POST','PUT','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','stringify','statusMessage','statusCode','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','isString','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','trunk_id','no\x20trunk\x20selected','trunk_name','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','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','math','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','agentPause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','replace','sayNumber','number','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','service','host','port','secure','authentication','auth','pass','debug','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join'];(function(_0x4e658c,_0x3139a5){var _0x3a2973=function(_0x479a80){while(--_0x479a80){_0x4e658c['push'](_0x4e658c['shift']());}};_0x3a2973(++_0x3139a5);}(_0xc429,0x1ba));var _0x9c42=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0xc429[_0x40927b];return _0x2635e8;};'use strict';var fs=require('fs');var path=require(_0x9c42('0x0'));var util=require('util');var _=require(_0x9c42('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x9c42('0x2'));var moment=require(_0x9c42('0x3'));var Mustache=require(_0x9c42('0x4'));var rp=require(_0x9c42('0x5'));var logger=require(_0x9c42('0x6'))('agi');var config=require('../../config/environment');var scripts=require(_0x9c42('0x7'));var FILES_PATH=_0x9c42('0x8');var recursiveMapAttributes=[_0x9c42('0x9'),_0x9c42('0xa')];var verticesWithRetry=[_0x9c42('0xb'),_0x9c42('0xc'),_0x9c42('0xd')];var AGIVertices=function(_0x4c68a1,_0x37a7ab,_0x2541a2){this[_0x9c42('0xe')]=_0x4c68a1;this['rpc']=_0x37a7ab;this[_0x9c42('0xf')]=_0x2541a2;};AGIVertices['prototype'][_0x9c42('0x10')]=function(_0x48f0d5,_0x1a1531){this[_0x9c42('0x11')]['getVariableById'](_0x48f0d5)[_0x9c42('0x12')](function(_0x433d9f){_0x1a1531(null,_0x433d9f?_0x433d9f[_0x9c42('0x13')]:![]);})['catch'](function(_0x448641){_0x1a1531(_0x448641);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x15')]=function(_0x5b3fa9,_0x3af9ae){this['rpc']['getVoiceQueueById'](_0x5b3fa9)[_0x9c42('0x12')](function(_0x1d4208){_0x3af9ae(null,_0x1d4208?_0x1d4208['name']:![]);})[_0x9c42('0x16')](function(_0xc6a1f3){_0x3af9ae(_0xc6a1f3);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x17')]=function(_0x43507e,_0x24a809){this[_0x9c42('0x11')]['getSquareProjectById'](_0x43507e)[_0x9c42('0x12')](function(_0x5a5e07){_0x24a809(null,_0x5a5e07?_0x5a5e07['name']:![]);})['catch'](function(_0x1ab506){_0x24a809(_0x1ab506);});};AGIVertices[_0x9c42('0x14')]['getSquareOdbc']=function(_0x229288,_0x438993){this['rpc'][_0x9c42('0x18')](_0x229288)[_0x9c42('0x12')](function(_0x51aff6){_0x438993(null,_0x51aff6?_0x51aff6['dsn']:![]);})[_0x9c42('0x16')](function(_0x4a0492){_0x438993(_0x4a0492);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x19')]=function(_0x2804a2,_0x5bd15a){this[_0x9c42('0x11')][_0x9c42('0x1a')](_0x2804a2)['then'](function(_0x13f3a5){_0x5bd15a(null,_0x13f3a5?_0x13f3a5['name']:![]);})[_0x9c42('0x16')](function(_0x4fd4e5){_0x5bd15a(_0x4fd4e5);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x1b')]=function(_0xec4f0a,_0x17d10a){this[_0x9c42('0x11')][_0x9c42('0x1c')](_0xec4f0a)['then'](function(_0x564a95){_0x17d10a(null,_0x564a95?_0x564a95[_0x9c42('0x13')]:![]);})[_0x9c42('0x16')](function(_0x285398){_0x17d10a(_0x285398);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x1d')]=function(_0x5405c2,_0x17f3f7){var _0x4ef94d=this;this[_0x9c42('0x11')][_0x9c42('0x1e')](_0x5405c2)[_0x9c42('0x12')](function(_0x337d07){_0x17f3f7(null,_0x337d07?_0x4ef94d['getSoundPath'](_0x337d07[_0x9c42('0x1f')]):![]);})[_0x9c42('0x16')](function(_0x3e2ec7){_0x17f3f7(_0x3e2ec7);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x20')]=function(_0x1356ff,_0x29eb82){this[_0x9c42('0x11')][_0x9c42('0x21')](_0x1356ff)['then'](function(_0x542ebc){_0x29eb82(null,_0x542ebc?_0x542ebc:![]);})[_0x9c42('0x16')](function(_0x308644){_0x29eb82(_0x308644);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x22')]=function(_0x153d5c,_0x515f2f,_0x226cdd){this[_0x9c42('0xf')][_0x9c42('0x22')](_0x153d5c,_0x515f2f)[_0x9c42('0x12')](function(){_0x226cdd(null);})[_0x9c42('0x16')](function(_0x28652d){_0x226cdd(_0x28652d);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x23')]=function(_0x4307a3,_0x422041){this[_0x9c42('0x11')][_0x9c42('0x24')](_0x4307a3)[_0x9c42('0x12')](function(_0x1b1b10){if(_0x1b1b10){if(_0x1b1b10[_0x9c42('0x25')]){_0x422041(null,[_0x1b1b10[_0x9c42('0x26')]]);}else{_0x422041(null,_[_0x9c42('0x27')](_0x1b1b10['Intervals'],_0x9c42('0x26')));}}else{_0x422041(null,![]);}})[_0x9c42('0x16')](function(_0xc5fa28){_0x422041(_0xc5fa28);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x28')]=function(_0x50af85){return util[_0x9c42('0x29')](_0x9c42('0x2a'),FILES_PATH,_0x50af85);};AGIVertices['prototype'][_0x9c42('0x2b')]=function(_0x46d127,_0x4df62f,_0x448e70){odbc[_0x9c42('0x2c')](_0x46d127,function(_0x1d1b22){if(_0x1d1b22){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x1d1b22);_0x448e70(_0x1d1b22);}else{logger[_0x9c42('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0x9c42('0x2e')](_0x4df62f,function(_0x29c757,_0x205d80){if(_0x29c757){logger[_0x9c42('0x2d')](_0x9c42('0x2f'),_0x4df62f);_0x448e70(_0x29c757);}else{logger[_0x9c42('0x2d')](_0x9c42('0x30'),_0x4df62f);odbc[_0x9c42('0x31')](function(_0x29c822){if(_0x29c822){logger[_0x9c42('0x32')](_0x9c42('0x33'),_0x29c822);}_0x448e70(null,_0x205d80);});}});}});};AGIVertices['prototype'][_0x9c42('0x34')]=function(_0x2d6ec7,_0x4510c8){this[_0x9c42('0x11')]['getSmsAccountById'](_0x2d6ec7)[_0x9c42('0x12')](function(_0x4a8d59){_0x4510c8(null,_0x4a8d59?_0x4a8d59:![]);})[_0x9c42('0x16')](function(_0x47e959){_0x4510c8(_0x47e959);});};AGIVertices[_0x9c42('0x14')]['createSmsMessage']=function(_0x2f71d9,_0x54d143){this['rpc'][_0x9c42('0x35')](_0x2f71d9)[_0x9c42('0x12')](function(_0xd99dfe){_0x54d143(null,_0xd99dfe);})[_0x9c42('0x16')](function(_0x478646){_0x54d143(_0x478646);});};AGIVertices[_0x9c42('0x14')]['createSquareDetailsReport']=function(_0x2ff472,_0x2c5606,_0x2cc37b){this[_0x9c42('0x11')][_0x9c42('0x36')]({'uniqueid':this[_0x9c42('0xe')]['uniqueid'],'node':_0x2ff472[_0x9c42('0x37')],'application':_0x2ff472[_0x9c42('0x38')],'data':_0x2c5606||null,'project_name':this[_0x9c42('0xe')][_0x9c42('0x39')],'callerid':this['channel'][_0x9c42('0x3a')]})[_0x9c42('0x12')](function(_0x7ccbbd){if(_0x2cc37b){_0x2cc37b(null,_0x7ccbbd);}})['catch'](function(_0x1e680d){if(_0x2cc37b){_0x2cc37b(_0x1e680d);}});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x3b')]=function(_0x3d3031,_0x3bac29,_0x3d844b,_0x324618){this['rpc'][_0x9c42('0x3b')]({'uniqueid':this[_0x9c42('0xe')][_0x9c42('0x3c')],'callerid':this[_0x9c42('0xe')]['callerid'],'calleridname':this[_0x9c42('0xe')]['calleridname'],'context':this['channel']['context'],'extension':this[_0x9c42('0xe')]['extension'],'priority':this[_0x9c42('0xe')][_0x9c42('0x3d')],'accountcode':this[_0x9c42('0xe')]['accountcode'],'dnid':this[_0x9c42('0xe')][_0x9c42('0x3e')],'projectName':this[_0x9c42('0xe')][_0x9c42('0x39')],'saveName':_0x3bac29,'filename':_0x3d3031['file']||_0x3bac29,'savePath':_0x3d844b})[_0x9c42('0x12')](function(_0x586b62){_0x324618(null,_0x586b62);})['catch'](function(_0x2fef82){_0x324618(_0x2fef82);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x3f')]=function(_0x3c22c6,_0x45eab7,_0x360f3b,_0xda4f9,_0x579fbf){this['rpc'][_0x9c42('0x3f')]({'uniqueid':this[_0x9c42('0xe')][_0x9c42('0x3c')],'body':_0x3c22c6,'direction':_0x45eab7,'providerName':_0x360f3b,'providerResponse':_0xda4f9})[_0x9c42('0x12')](function(_0x3b3e41){if(_0x579fbf){_0x579fbf(null,_0x3b3e41);}})[_0x9c42('0x16')](function(_0x44b31e){if(_0x579fbf){_0x579fbf(_0x44b31e);}});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x40')]=function(_0x523753,_0xf6d4e9){this[_0x9c42('0x11')][_0x9c42('0x40')]({'firstName':_[_0x9c42('0x41')](_0x523753[_0x9c42('0x13')])||_[_0x9c42('0x42')](_0x523753[_0x9c42('0x13')])?'callback_'+Math['random']():_0x523753[_0x9c42('0x13')],'lastName':_[_0x9c42('0x41')](_0x523753['lastName'])||_[_0x9c42('0x42')](_0x523753[_0x9c42('0x43')])?null:_0x523753[_0x9c42('0x43')],'phone':_0x523753[_0x9c42('0x44')],'ListId':_0x523753[_0x9c42('0x45')],'scheduledat':_0x523753[_0x9c42('0x46')],'callbackUniqueid':this[_0x9c42('0xe')][_0x9c42('0x3c')],'tags':_0x9c42('0x47'),'description':_0x9c42('0x48')+_0x523753['scheduledAt']['toString'](),'priority':_0x523753['callback_priority']})['then'](function(_0xa96075){_0xf6d4e9(null,_0xa96075);})['catch'](function(_0x1aea94){_0xf6d4e9(_0x1aea94);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x49')]=function(_0x27260a,_0x5e7e27){this[_0x9c42('0x11')]['getPauseById'](_0x27260a)[_0x9c42('0x12')](function(_0xce636e){_0x5e7e27(null,_0xce636e?_0xce636e[_0x9c42('0x13')]:![]);})[_0x9c42('0x16')](function(_0x1b7948){_0x5e7e27(_0x1b7948);});};AGIVertices[_0x9c42('0x14')]['agentPause']=function(_0x54413b,_0x4cc5c6,_0x467121){var _0x4311b9={'role':_0x9c42('0x4a')};_0x4311b9[_0x54413b]=this['channel'][_0x9c42('0x3a')];this[_0x9c42('0x11')]['agentPause'](_0x4311b9,_0x4cc5c6,this[_0x9c42('0xe')]['uniqueid'])[_0x9c42('0x12')](function(_0x54754f){_0x467121(null,_['isNil'](_0x54754f)?![]:!![]);})[_0x9c42('0x16')](function(_0x4890b1){logger[_0x9c42('0x32')](_0x4890b1);_0x467121(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x362ba4,_0x3e6770){var _0xa6a6ef={'role':'agent'};_0xa6a6ef[_0x362ba4]=this[_0x9c42('0xe')][_0x9c42('0x3a')];this['rpc'][_0x9c42('0x4b')](_0xa6a6ef)[_0x9c42('0x12')](function(_0x1a4237){_0x3e6770(null,_[_0x9c42('0x42')](_0x1a4237)?![]:!![]);})[_0x9c42('0x16')](function(_0x5651c2){logger[_0x9c42('0x32')](_0x5651c2);_0x3e6770(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x274b0d,_0x11f186){var _0x57a4ed={'role':'agent'};_0x57a4ed[_0x274b0d]=this['channel'][_0x9c42('0x3a')];this[_0x9c42('0x11')]['agentLogout'](_0x57a4ed)[_0x9c42('0x12')](function(_0x457ac7){_0x11f186(null,_[_0x9c42('0x42')](_0x457ac7)?![]:!![]);})[_0x9c42('0x16')](function(_0x48d6ea){logger['error'](_0x48d6ea);_0x11f186(null,![]);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x4c')]=function(_0x357d15,_0x3cee77){var _0x250f21={'role':_0x9c42('0x4a')};_0x250f21[_0x357d15]=this[_0x9c42('0xe')][_0x9c42('0x3a')];var _0x4536f9=_0x357d15!='internal'?util[_0x9c42('0x29')](_0x9c42('0x4d'),'LOCAL',this['channel'][_0x9c42('0x3a')]):undefined;this[_0x9c42('0x11')][_0x9c42('0x4c')](_0x250f21,_0x4536f9)[_0x9c42('0x12')](function(_0x205572){_0x3cee77(null,_['isNil'](_0x205572)?![]:!![]);})[_0x9c42('0x16')](function(_0x3304b0){logger[_0x9c42('0x32')](_0x3304b0);_0x3cee77(null,![]);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x4e')]=function(_0x52c499,_0x5f3e19){sh[_0x9c42('0x4f')](_[_0x9c42('0x50')](_0x52c499),function(_0x31f059,_0x371a7c){var _0x543dbe=_0x371a7c['replace'](/(\r\n|\n|\r)/gm,'');_0x5f3e19(null,_0x543dbe);});};AGIVertices['prototype'][_0x9c42('0x51')]=function(_0x85ca92,_0x4db2c0){scripts[_0x9c42('0x51')](_0x85ca92['apiKey'],_0x85ca92[_0x9c42('0x52')]||_0x9c42('0x53'),_0x85ca92['text'],_0x85ca92[_0x9c42('0x54')]||_0x9c42('0x55'),_0x85ca92[_0x9c42('0x56')]||_0x9c42('0x57'),_0x85ca92[_0x9c42('0x58')]||'MP3')[_0x9c42('0x12')](function(_0x31fb35){_0x4db2c0(null,_0x31fb35);})[_0x9c42('0x16')](function(_0x378197){_0x4db2c0(_0x378197);});};AGIVertices['prototype'][_0x9c42('0x59')]=function(_0x27df4d,_0x5c64f7){scripts[_0x9c42('0x59')](_0x27df4d[_0x9c42('0x53')],_0x27df4d['google_tts_language']||'en',0x1)[_0x9c42('0x12')](function(_0x7b4865){_0x5c64f7(null,_0x7b4865);})['catch'](function(_0x5af81a){_0x5c64f7(_0x5af81a);});};AGIVertices['prototype'][_0x9c42('0x5a')]=function(_0x2c8543,_0x256555){var _0x66e18a={'uri':_0x2c8543[_0x9c42('0x5b')],'method':_0x2c8543[_0x9c42('0x5c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2c8543[_0x9c42('0x5d')])==='number'&&parseInt(_0x2c8543[_0x9c42('0x5d')])>=0x1?parseInt(_0x2c8543[_0x9c42('0x5d')])*0x3e8:0x5*0x3e8};if(_[_0x9c42('0x5e')]([_0x9c42('0x5f'),_0x9c42('0x60')],_0x66e18a[_0x9c42('0x5c')][_0x9c42('0x61')]())){try{_0x66e18a[_0x9c42('0x62')]=_0x2c8543[_0x9c42('0xa')]?JSON[_0x9c42('0x63')](_0x2c8543[_0x9c42('0xa')]):{};}catch(_0x3bd3db){logger[_0x9c42('0x32')](_0x9c42('0x64'),_0x3bd3db);}}try{_0x66e18a[_0x9c42('0x65')]=_0x2c8543[_0x9c42('0x9')]?JSON[_0x9c42('0x63')](_0x2c8543[_0x9c42('0x9')]):{};}catch(_0x2f9b21){logger['error'](_0x9c42('0x66'),_0x2f9b21);}if(_0x2c8543[_0x9c42('0x67')]){try{var _0x4c4271=require(_0x2c8543[_0x9c42('0x67')])[_0x9c42('0x68')](this,_0x66e18a);_0x66e18a[_0x9c42('0x69')]=Mustache[_0x9c42('0x6a')](_0x2c8543[_0x9c42('0x5b')],_0x4c4271,{},['$$','$$']);if(_0x66e18a['headers']){_0x66e18a[_0x9c42('0x65')]=JSON[_0x9c42('0x63')](Mustache[_0x9c42('0x6a')](JSON[_0x9c42('0x6b')](_0x66e18a[_0x9c42('0x65')]),_0x4c4271,{},['$$','$$']));}if(_0x66e18a[_0x9c42('0x62')]){_0x66e18a['body']=JSON[_0x9c42('0x63')](Mustache['render'](JSON[_0x9c42('0x6b')](_0x66e18a[_0x9c42('0x62')]),_0x4c4271,{},['$$','$$']));}}catch(_0x5035ba){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5035ba);}}rp(_0x66e18a)['then'](function(_0x4cc1f5){var _0x22f85f={'statusCode':_0x4cc1f5['statusCode']||0xc8,'statusMessage':_0x4cc1f5[_0x9c42('0x6c')]||'OK','headers':_0x4cc1f5[_0x9c42('0x65')]||{},'body':_0x4cc1f5[_0x9c42('0x62')]||{}};_0x256555(null,_0x22f85f);})[_0x9c42('0x16')](function(_0x4d5477){var _0x33e068={'statusCode':_0x4d5477[_0x9c42('0x6d')]||0x1f4,'statusMessage':_0x4d5477[_0x9c42('0x6e')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4d5477[_0x9c42('0x6f')]['headers']||{},'body':_0x4d5477[_0x9c42('0x6f')][_0x9c42('0x62')]||{}};_0x256555(null,_0x33e068);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x70')]=function(_0x1b1d88,_0x4b7325){scripts[_0x9c42('0x70')](this['channel'][_0x9c42('0x3c')],_0x1b1d88[_0x9c42('0x71')],_0x1b1d88[_0x9c42('0x53')],_0x1b1d88[_0x9c42('0x72')]||'en')[_0x9c42('0x12')](function(_0x38ff6b){_0x4b7325(null,_0x38ff6b);})[_0x9c42('0x16')](function(_0x25e81d){_0x4b7325(_0x25e81d);});};AGIVertices[_0x9c42('0x14')]['googleDialogflowV2']=function(_0x20b18b,_0x271e34){scripts[_0x9c42('0x73')](this[_0x9c42('0xe')][_0x9c42('0x3c')],_0x20b18b[_0x9c42('0x74')],_0x20b18b[_0x9c42('0x75')],_0x20b18b['private_key'],_0x20b18b[_0x9c42('0x53')],_0x20b18b[_0x9c42('0x76')]||'en')['then'](function(_0x8c779d){_0x271e34(null,_0x8c779d);})[_0x9c42('0x16')](function(_0xe3f660){_0x271e34(_0xe3f660);});};AGIVertices[_0x9c42('0x14')]['sestekNDA']=function(_0x2e6928,_0x4eb188){scripts[_0x9c42('0x77')](this[_0x9c42('0xe')],_0x2e6928)['then'](function(_0x2dcfcf){_0x4eb188(null,_0x2dcfcf);})[_0x9c42('0x16')](function(_0x36b85b){_0x4eb188(_0x36b85b);});};AGIVertices[_0x9c42('0x14')]['ispeechTTS']=function(_0x5a8160,_0x18b934){scripts['ispeechTTS'](_0x5a8160[_0x9c42('0x71')],_0x5a8160[_0x9c42('0x53')],_0x5a8160['ispeech_tts_language']||_0x9c42('0x55'),_0x5a8160[_0x9c42('0x78')])[_0x9c42('0x12')](function(_0x2ecb48){_0x18b934(null,_0x2ecb48);})[_0x9c42('0x16')](function(_0x70f3af){_0x18b934(_0x70f3af);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x79')]=function(_0x1e82f1,_0x49ffb9,_0x4b6fa3){scripts[_0x9c42('0x79')](_0x49ffb9,_0x1e82f1[_0x9c42('0x71')],_0x1e82f1['ispeech_asr_language']||'en-US',this[_0x9c42('0x7a')](_0x1e82f1[_0x9c42('0x7b')])?_0x1e82f1['model']:undefined)['then'](function(_0x4b38de){_0x4b6fa3(null,_0x4b38de);})['catch'](function(_0x306fa1){_0x4b6fa3(_0x306fa1);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x7c')]=function(_0x15c434,_0x1ef6b2){scripts[_0x9c42('0x7c')](_0x15c434[_0x9c42('0x7d')],_0x15c434[_0x9c42('0x7e')],_0x15c434['aws_polly_region'],_0x15c434[_0x9c42('0x7f')]||'Amy',_0x15c434[_0x9c42('0x53')],_0x15c434[_0x9c42('0x80')]||_0x9c42('0x53'))['then'](function(_0x2454ae){_0x1ef6b2(null,_0x2454ae);})['catch'](function(_0x24e361){_0x1ef6b2(_0x24e361);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x81')]=function(_0x2d986c,_0x5c120a){scripts['awsLex'](this['channel']['uniqueid'],_0x2d986c[_0x9c42('0x7d')],_0x2d986c[_0x9c42('0x7e')],_0x2d986c[_0x9c42('0x82')],_0x2d986c[_0x9c42('0x53')],_0x2d986c[_0x9c42('0x83')])[_0x9c42('0x12')](function(_0x2009a0){_0x5c120a(null,_0x2009a0);})[_0x9c42('0x16')](function(_0x110123){_0x5c120a(_0x110123);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x84')]=function(_0x546348,_0x1d2f3d,_0x333b3b){scripts['googleASR'](_0x1d2f3d,_0x546348['key'],_0x546348['google_asr_language']||_0x9c42('0x55'))['then'](function(_0x2dc4e4){_0x333b3b(null,_0x2dc4e4);})[_0x9c42('0x16')](function(_0x343356){_0x333b3b(_0x343356);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x85')]=function(_0x428e7c,_0xb24fb0,_0xb19320){scripts[_0x9c42('0x85')](_0xb24fb0,_0x428e7c[_0x9c42('0x86')],_0x428e7c[_0x9c42('0x87')],_0x428e7c[_0x9c42('0x69')])[_0x9c42('0x12')](function(_0x358157){_0xb19320(null,_0x358157);})[_0x9c42('0x16')](function(_0x1f1ebe){_0xb19320(_0x1f1ebe);});};AGIVertices[_0x9c42('0x14')][_0x9c42('0x88')]=function(_0x7c0564){var _0x49e01a=_[_0x9c42('0x5e')](verticesWithRetry,_0x7c0564[_0x9c42('0x38')])?_0x7c0564:_[_0x9c42('0x89')](_0x7c0564);for(var _0x5ebc59 in _0x49e01a){if(_0x49e01a['hasOwnProperty'](_0x5ebc59)){if(_0x49e01a[_0x5ebc59]&&_['isString'](_0x49e01a[_0x5ebc59])){if(_[_0x9c42('0x5e')](recursiveMapAttributes,_0x5ebc59)){_0x49e01a[_0x5ebc59]=this[_0x9c42('0x8a')](_0x49e01a[_0x5ebc59]);}else{_0x49e01a[_0x5ebc59]=this[_0x9c42('0x8b')](_0x49e01a[_0x5ebc59]);}}}}return _0x49e01a;};AGIVertices[_0x9c42('0x14')][_0x9c42('0x8c')]=function(_0xfcecbb){for(var _0x5aff83 in _0xfcecbb){if(_0xfcecbb[_0x9c42('0x8d')](_0x5aff83)){if(_[_0x9c42('0x8e')](_0xfcecbb[_0x5aff83])){this['recursiveNodeIndex'](_0xfcecbb[_0x5aff83]);}else if(_[_0x9c42('0x8f')](_0xfcecbb[_0x5aff83])){for(var _0x48eb34=0x0;_0x48eb34<_0xfcecbb[_0x5aff83]['length'];_0x48eb34++){this[_0x9c42('0x8c')](_0xfcecbb[_0x5aff83][_0x48eb34]);}}else if(_[_0x9c42('0x90')](_0xfcecbb[_0x5aff83])){_0xfcecbb[_0x5aff83]=this[_0x9c42('0x8b')](_0xfcecbb[_0x5aff83]);}}}};AGIVertices[_0x9c42('0x14')][_0x9c42('0x91')]=function(_0x249f84,_0x2f2f10){for(var _0x3281a6 in _0x249f84){if(_0x249f84[_0x9c42('0x8d')](_0x3281a6)){if(_[_0x9c42('0x8e')](_0x249f84[_0x3281a6])){if(!_[_0x9c42('0x41')](_0x249f84[_0x3281a6])){this[_0x9c42('0x91')](_0x249f84[_0x3281a6],util[_0x9c42('0x29')](_0x9c42('0x92'),_0x2f2f10,_0x3281a6));}}else if(_['isArray'](_0x249f84[_0x3281a6])){for(var _0x3feeee=0x0;_0x3feeee<_0x249f84[_0x3281a6][_0x9c42('0x93')];_0x3feeee++){this['saveRestApiResult'](_0x249f84[_0x3281a6][_0x3feeee],util['format'](_0x9c42('0x92'),_0x2f2f10,_0x3281a6+'['+_0x3feeee+']'));}}else{if(!_[_0x9c42('0x42')](_0x249f84[_0x3281a6])){this[_0x9c42('0xe')][_0x9c42('0x94')](util[_0x9c42('0x29')](_0x9c42('0x92'),_0x2f2f10,_0x3281a6),_0x249f84[_0x3281a6]);}}}}};AGIVertices[_0x9c42('0x14')]['replaceObjectAllVariables']=function(_0x55d08f){try{var _0x3df685=JSON[_0x9c42('0x63')](_0x55d08f);this[_0x9c42('0x8c')](_0x3df685);return JSON[_0x9c42('0x6b')](_0x3df685);}catch(_0x50e95a){return this[_0x9c42('0x8b')](_0x55d08f);}};AGIVertices[_0x9c42('0x14')][_0x9c42('0x8b')]=function(_0x2c3d85){var _0x136a4e=_0x2c3d85[_0x9c42('0x95')]('{');for(var _0x5e40a2=0x1;_0x5e40a2<_0x136a4e['length'];_0x5e40a2+=0x1){var _0x305117=_0x136a4e[_0x5e40a2][_0x9c42('0x95')]('}');if(_0x305117[_0x9c42('0x93')]>0x1){_0x2c3d85=_0x2c3d85[_0x9c42('0x96')]('{'+_0x305117[0x0]+'}',this[_0x9c42('0xe')][_0x9c42('0x10')](_0x305117[0x0])[_0x9c42('0x97')]||_0x305117[0x0]);}}if(_0x136a4e[_0x9c42('0x93')]===0x1){return _0x2c3d85['toString']();}return this[_0x9c42('0x8b')](_0x2c3d85);};AGIVertices['prototype'][_0x9c42('0x98')]=function(_0x3f5f82,_0x5ea620){var _0x324acb=this[_0x9c42('0xe')]['getVariable'](_0x3f5f82);if(_0x324acb[_0x9c42('0x99')]===-0x1){return _0x324acb;}logger[_0x9c42('0x2d')](util[_0x9c42('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5ea620,_0x324acb[_0x9c42('0x97')]));return this[_0x9c42('0xe')][_0x9c42('0x94')](_0x5ea620,_0x324acb[_0x9c42('0x97')]);};AGIVertices[_0x9c42('0x14')]['isConfigured']=function(_0x137359){return _0x137359&&_0x137359!=='0'&&_0x137359!=='-1'&&_0x137359!=='';};AGIVertices[_0x9c42('0x14')][_0x9c42('0x9a')]=function(_0x4a056d){this['createSquareDetailsReport']['sync'](this,_0x4a056d,'-');_0x4a056d[_0x9c42('0x9b')]=_0x4a056d[_0x9c42('0x9a')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9c42('0x14')]['mrcpsynth']=function(_0x5f5414){logger['info'](util[_0x9c42('0x29')](_0x9c42('0x9c'),_0x5f5414[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x5f5414['text'])){return this['channel'][_0x9c42('0x9d')](_0x9c42('0x9e'));}var _0x1d76b6='\x22'+_0x5f5414[_0x9c42('0x53')]+'\x22';if(this[_0x9c42('0x7a')](_0x5f5414['options'])){_0x1d76b6+=','+_0x5f5414[_0x9c42('0x6f')];}var _0x5f259f=this[_0x9c42('0xe')][_0x9c42('0x4f')](_0x9c42('0x9f'),_0x1d76b6);if(_0x5f259f['result']===-0x1){return _0x5f259f;}return this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')](_0x9c42('0xa0'),_0x1d76b6));};AGIVertices[_0x9c42('0x14')]['mrcprecog']=function(_0x38caf0){logger['info'](util[_0x9c42('0x29')](_0x9c42('0xa1'),_0x38caf0['label']));if(!this[_0x9c42('0x7a')](_0x38caf0[_0x9c42('0xa2')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0xa3'));}var _0x512e25=_0x38caf0[_0x9c42('0xa2')];if(this[_0x9c42('0x7a')](_0x38caf0['options'])){_0x512e25+=','+_0x38caf0[_0x9c42('0x6f')];}var _0x5d752b=this[_0x9c42('0xe')][_0x9c42('0x4f')]('MRCPRecog',_0x512e25);if(_0x5d752b[_0x9c42('0x99')]===-0x1){return _0x5d752b;}var _0x1c2fa1=this[_0x9c42('0x98')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x1c2fa1['result']===-0x1){return _0x1c2fa1;}var _0xbbefd5=this[_0x9c42('0x98')](_0x9c42('0xa4'),_0x9c42('0xa5'));if(_0xbbefd5[_0x9c42('0x99')]===-0x1){return _0xbbefd5;}var _0x15cf5a=this['getAndSetVariable']('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x15cf5a[_0x9c42('0x99')]===-0x1){return _0x15cf5a;}return this['channel']['noop'](util[_0x9c42('0x29')](_0x9c42('0xa6'),_0x512e25));};AGIVertices['prototype']['agi']=function(_0x161ece){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x161ece['label']));return this['channel'][_0x9c42('0xa7')]([_0x161ece[_0x9c42('0xa8')],_0x161ece[_0x9c42('0xa9')]]);};AGIVertices['prototype'][_0x9c42('0xaa')]=function(_0x18a19b){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0xab'),_0x18a19b[_0x9c42('0x37')]));if(this[_0x9c42('0x7a')](_0x18a19b['timeout'])){logger[_0x9c42('0x2d')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x18a19b[_0x9c42('0x5d')]));var _0x678d1a=this['channel'][_0x9c42('0xac')](_0x18a19b[_0x9c42('0x5d')]);if(_0x678d1a['result']===-0x1){return _0x678d1a;}}return this[_0x9c42('0xe')][_0x9c42('0xaa')]();};AGIVertices['prototype']['callback']=function(_0x227130){logger['info'](util['format'](_0x9c42('0xad'),_0x227130[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x227130[_0x9c42('0x45')])){return this['channel'][_0x9c42('0x32')](_0x227130,_0x9c42('0xae'));}_0x227130[_0x9c42('0x46')]=moment();if(this[_0x9c42('0x7a')](_0x227130[_0x9c42('0xaf')])){_0x227130[_0x9c42('0x46')]=moment()[_0x9c42('0xb0')](_0x227130['delay'],_0x9c42('0xb1'));}if(!this[_0x9c42('0x7a')](_0x227130[_0x9c42('0xb2')])){_0x227130['callback_priority']=0x2;}this[_0x9c42('0x40')][_0x9c42('0x68')](this,_0x227130);return this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x227130[_0x9c42('0x44')],_0x227130[_0x9c42('0x45')],_0x227130['scheduledAt']));};AGIVertices[_0x9c42('0x14')][_0x9c42('0xb3')]=function(_0xd67c){logger['info'](util['format'](_0x9c42('0xb4'),_0xd67c[_0x9c42('0x37')]));var _0x22c7e2=this['channel']['exec'](_0xd67c['application'],_0xd67c['options']);if(_0x22c7e2[_0x9c42('0x99')]===-0x1){return _0x22c7e2;}return this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')](_0x9c42('0xb5'),_0xd67c['application'],_0xd67c[_0x9c42('0x6f')]));};AGIVertices[_0x9c42('0x14')]['lumenvoxtts']=function(_0x20ecfa){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0xb6'),_0x20ecfa[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x20ecfa[_0x9c42('0x53')])){return this[_0x9c42('0xe')]['noop'](_0x9c42('0x9e'));}var _0x3b0b9b='\x22'+_0x20ecfa[_0x9c42('0x53')]+'\x22';if(this[_0x9c42('0x7a')](_0x20ecfa[_0x9c42('0x6f')])){_0x3b0b9b+=','+_0x20ecfa[_0x9c42('0x6f')];}var _0x1798e7=this['channel'][_0x9c42('0x4f')](_0x9c42('0x9f'),_0x3b0b9b);if(_0x1798e7[_0x9c42('0x99')]===-0x1){return _0x1798e7;}return this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3b0b9b));};AGIVertices['prototype'][_0x9c42('0xb7')]=function(_0x15e88f){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0xb8'),_0x15e88f[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x15e88f[_0x9c42('0x53')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x9e'));}var _0x4cc201='\x22'+_0x15e88f[_0x9c42('0x53')]+'\x22';if(this[_0x9c42('0x7a')](_0x15e88f[_0x9c42('0x6f')])){_0x4cc201+=','+_0x15e88f[_0x9c42('0x6f')];}var _0x307282=this[_0x9c42('0xe')][_0x9c42('0x4f')](_0x9c42('0x9f'),_0x4cc201);if(_0x307282['result']===-0x1){return _0x307282;}return this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4cc201));};AGIVertices['prototype']['lumenvoxasr']=function(_0x5642b3){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0xb9'),_0x5642b3[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x5642b3['grammar'])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0xa3'));}var _0x51ab73=_0x5642b3[_0x9c42('0xa2')];if(this[_0x9c42('0x7a')](_0x5642b3[_0x9c42('0x6f')])){_0x51ab73+=','+_0x5642b3[_0x9c42('0x6f')];}var _0x4032bf=this['channel'][_0x9c42('0x4f')](_0x9c42('0xba'),_0x51ab73);if(_0x4032bf['result']===-0x1){return _0x4032bf;}var _0xbbd9aa=this[_0x9c42('0x98')](_0x9c42('0xbb'),_0x9c42('0xbc'));if(_0xbbd9aa[_0x9c42('0x99')]===-0x1){return _0xbbd9aa;}var _0x474e97=this[_0x9c42('0x98')](_0x9c42('0xa4'),_0x9c42('0xbd'));if(_0x474e97[_0x9c42('0x99')]===-0x1){return _0x474e97;}var _0x596cee=this[_0x9c42('0x98')]('RECOG_INSTANCE()',_0x9c42('0xbe'));if(_0x596cee[_0x9c42('0x99')]===-0x1){return _0x596cee;}return this[_0x9c42('0xe')]['noop'](util['format'](_0x9c42('0xa6'),_0x51ab73));};AGIVertices['prototype']['sestekasr']=function(_0x3147c2){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0xbf'),_0x3147c2[_0x9c42('0x37')]));if(!this['isConfigured'](_0x3147c2['grammar'])){return this['channel'][_0x9c42('0x9d')](_0x9c42('0xa3'));}var _0x4de1d0=_0x3147c2[_0x9c42('0xa2')];if(this[_0x9c42('0x7a')](_0x3147c2[_0x9c42('0x6f')])){_0x4de1d0+=','+_0x3147c2['options'];}var _0x577c4d=this[_0x9c42('0xe')]['exec']('MRCPRecog',_0x4de1d0);if(_0x577c4d['result']===-0x1){return _0x577c4d;}var _0x8970de=this[_0x9c42('0x98')](_0x9c42('0xbb'),_0x9c42('0xc0'));if(_0x8970de[_0x9c42('0x99')]===-0x1){return _0x8970de;}var _0x3edda7=this[_0x9c42('0x98')](_0x9c42('0xa4'),_0x9c42('0xc1'));if(_0x3edda7[_0x9c42('0x99')]===-0x1){return _0x3edda7;}var _0x593f6f=this[_0x9c42('0x98')]('RECOG_INSTANCE()',_0x9c42('0xc2'));if(_0x593f6f[_0x9c42('0x99')]===-0x1){return _0x593f6f;}return this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4de1d0));};AGIVertices[_0x9c42('0x14')]['database']=function(_0x41b04b){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x41b04b[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x41b04b[_0x9c42('0xc3')])){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x41b04b,'no\x20database\x20selected');}var _0xc3281d=this[_0x9c42('0xc4')]['sync'](this,_0x41b04b[_0x9c42('0xc3')]);if(!_0xc3281d){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x41b04b,_0x9c42('0xc5'));}if(!this[_0x9c42('0x7a')](_0x41b04b['query'])){return this['channel'][_0x9c42('0x32')](_0x41b04b,'no\x20query\x20configured');}var _0x4f838f=_0x41b04b['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0xc6'),_0x4f838f));var _0x4a5e03=this[_0x9c42('0x2b')][_0x9c42('0x68')](this,_0xc3281d,_0x4f838f);this['createSquareDetailsReport'][_0x9c42('0x68')](this,_0x41b04b,_0x4f838f);if(!this[_0x9c42('0x7a')](_0x41b04b[_0x9c42('0xc7')])){return this['channel'][_0x9c42('0x9d')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x251062=this[_0x9c42('0x10')]['sync'](this,_0x41b04b[_0x9c42('0xc7')]);if(!_0x251062){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x41b04b,_0x9c42('0xc8'));}var _0x5ce7ff=this;_0x4a5e03[_0x9c42('0xc9')](function(_0x4d8aa1,_0x430be7){Object[_0x9c42('0xca')](_0x4d8aa1)['forEach'](function(_0x563f87){_0x5ce7ff[_0x9c42('0xe')]['setVariable'](util[_0x9c42('0x29')]('%s[%s][%s]',_0x251062,_0x430be7,_0x563f87),_0x4d8aa1[_0x563f87]);});});this[_0x9c42('0xe')]['setVariable'](util['format'](_0x9c42('0xcb'),_0x251062),_0x4a5e03[_0x9c42('0x93')]);return this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0xcc'),_0x251062));};AGIVertices[_0x9c42('0x14')][_0x9c42('0xcd')]=function(_0x502bb3){logger['debug'](util[_0x9c42('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x502bb3[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x502bb3[_0x9c42('0xce')])){return this[_0x9c42('0xe')]['error'](_0x502bb3,_0x9c42('0xcf'));}var _0x55c151=this[_0x9c42('0x19')][_0x9c42('0x68')](this,_0x502bb3[_0x9c42('0xce')]);if(!_0x55c151){return this['channel'][_0x9c42('0x32')](_0x502bb3,_0x9c42('0xd0'));}var _0x4badce=this[_0x9c42('0xe')]['exec'](_0x9c42('0xd1'),[util[_0x9c42('0x29')](_0x9c42('0xd2'),_0x55c151),_0x502bb3[_0x9c42('0x5d')],_0x502bb3[_0x9c42('0xd3')],_0x502bb3['url']]);if(_0x4badce[_0x9c42('0x99')]===-0x1){return _0x4badce;}return this[_0x9c42('0xe')][_0x9c42('0x9d')](util['format'](_0x9c42('0xd4'),_0x9c42('0xd1')));};AGIVertices[_0x9c42('0x14')][_0x9c42('0xd5')]=function(_0x4ac741){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0xd6'),_0x4ac741[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x4ac741['key'])){return this['channel'][_0x9c42('0x9d')](_0x9c42('0xd7'));}if(!this[_0x9c42('0x7a')](_0x4ac741[_0x9c42('0x53')])){return this[_0x9c42('0xe')]['noop']('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x9c42('0x36')](_0x4ac741);this[_0x9c42('0x3f')](_0x4ac741[_0x9c42('0x53')],'in','','');this[_0x9c42('0xe')][_0x9c42('0x9d')](util['format'](_0x9c42('0xd8'),_0x4ac741['text']));var _0x56cd76=this[_0x9c42('0x70')][_0x9c42('0x68')](this,_0x4ac741);if(_0x56cd76){for(var _0x40e98a in _0x56cd76){if(_0x56cd76[_0x9c42('0x8d')](_0x40e98a)){this['channel'][_0x9c42('0x94')](util[_0x9c42('0x29')](_0x9c42('0xd9'),_0x40e98a[_0x9c42('0x61')]()),_0x56cd76[_0x40e98a]);}}this['createSquareMessage'](_0x56cd76[_0x9c42('0xda')],_0x9c42('0xdb'),'dialogflow','');return this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0xdc'),_0x56cd76[_0x9c42('0xda')]));}return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x4ac741,_0x9c42('0xdd'));};AGIVertices[_0x9c42('0x14')][_0x9c42('0xde')]=function(_0x41f853){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0xdf'),_0x41f853[_0x9c42('0x37')]));if(!this['isConfigured'](_0x41f853[_0x9c42('0x74')])){return this['channel']['noop']('no\x20project_id\x20configured');}if(!this[_0x9c42('0x7a')](_0x41f853[_0x9c42('0x75')])){return this[_0x9c42('0xe')]['noop'](_0x9c42('0xe0'));}if(!this[_0x9c42('0x7a')](_0x41f853['private_key'])){return this['channel'][_0x9c42('0x9d')](_0x9c42('0xe1'));}if(!this[_0x9c42('0x7a')](_0x41f853[_0x9c42('0x76')])){return this[_0x9c42('0xe')]['noop'](_0x9c42('0xe2'));}if(!this['isConfigured'](_0x41f853[_0x9c42('0x53')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x9e'));}this[_0x9c42('0xe')][_0x9c42('0xe3')]=!![];this[_0x9c42('0x36')](_0x41f853);this[_0x9c42('0x3f')](_0x41f853['text'],'in','','');this['channel'][_0x9c42('0x9d')](util['format'](_0x9c42('0xe4'),_0x41f853['text']));var _0x5e21a7=this['googleDialogflowV2'][_0x9c42('0x68')](this,_0x41f853);if(_0x5e21a7){for(var _0x3674f0 in _0x5e21a7){if(_0x5e21a7[_0x9c42('0x8d')](_0x3674f0)){if(_0x3674f0!=='providerResponse'){this[_0x9c42('0xe')]['setVariable'](util[_0x9c42('0x29')](_0x9c42('0xd9'),_0x3674f0[_0x9c42('0x61')]()),_0x5e21a7[_0x3674f0]);}}}this[_0x9c42('0x3f')](_0x5e21a7[_0x9c42('0xda')],'out','dialogflowV2',_0x5e21a7['providerResponse']);return this[_0x9c42('0xe')]['noop'](util['format'](_0x9c42('0xe5'),_0x5e21a7[_0x9c42('0xda')]));}return this['channel'][_0x9c42('0x32')](_0x41f853,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x9c42('0x14')][_0x9c42('0xe6')]=function(_0x5acf60){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0xe7'),_0x5acf60[_0x9c42('0x37')]));if(!this['isConfigured'](_0x5acf60['ndauth_url'])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0xe8'));}if(!this[_0x9c42('0x7a')](_0x5acf60[_0x9c42('0xe9')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')]('no\x20username\x20configured');}if(!this[_0x9c42('0x7a')](_0x5acf60[_0x9c42('0xea')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')]('no\x20password\x20configured');}if(!this[_0x9c42('0x7a')](_0x5acf60[_0x9c42('0xeb')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x9e'));}this[_0x9c42('0xe')][_0x9c42('0xe3')]=!![];this[_0x9c42('0x36')](_0x5acf60);this['createSquareMessage'](_0x5acf60['text'],'in','','');this[_0x9c42('0xe')][_0x9c42('0x9d')](util['format'](_0x9c42('0xec'),_0x5acf60[_0x9c42('0x53')]));var _0x537aaf=this[_0x9c42('0x77')][_0x9c42('0x68')](this,_0x5acf60);if(_0x537aaf){for(var _0x26e8a4 in _0x537aaf){if(_0x537aaf[_0x9c42('0x8d')](_0x26e8a4)){this['channel'][_0x9c42('0x94')](util['format']('SESTEK_NDA_%s',_0x26e8a4[_0x9c42('0x61')]()),_0x537aaf[_0x26e8a4]);}}this[_0x9c42('0x3f')](_0x537aaf[_0x9c42('0xda')],_0x9c42('0xdb'),_0x9c42('0xe6'),'');if(_0x537aaf[_0x9c42('0xed')]){this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0xee'),_0x537aaf['audiofile']));var _0x3247e3=this[_0x9c42('0xe')][_0x9c42('0xef')](_0x537aaf['audiofile']);try{fs[_0x9c42('0xf0')](_0x537aaf[_0x9c42('0xed')]+_0x9c42('0xf1'));}catch(_0x1681a3){logger[_0x9c42('0x32')](_0x1681a3);}return _0x3247e3;}else{return this['channel']['noop'](util[_0x9c42('0x29')](_0x9c42('0xf2'),_0x537aaf[_0x9c42('0xda')]));}}return this['channel'][_0x9c42('0x32')](_0x5acf60,_0x9c42('0xf3'));};AGIVertices[_0x9c42('0x14')]['end']=function(_0x305664){logger['info'](util[_0x9c42('0x29')]('Enter\x20in\x20END\x20(%s)\x20block',_0x305664[_0x9c42('0x37')]));return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0xf4'));};AGIVertices[_0x9c42('0x14')]['ext_dial']=function(_0x301f90){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x301f90[_0x9c42('0x37')]));var _0x3cd8cc='';if(_0x301f90['trunk_id']){if(!this['isConfigured'](_0x301f90[_0x9c42('0xf5')])){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x301f90,_0x9c42('0xf6'));}else{var _0x132444=parseInt(_0x301f90['trunk_id'],0xa);if(isNaN(_0x132444)){_0x3cd8cc=_0x301f90[_0x9c42('0xf5')];}else{_0x3cd8cc=this[_0x9c42('0x1b')][_0x9c42('0x68')](this,_0x301f90[_0x9c42('0xf5')]);if(!_0x3cd8cc){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x301f90,'no\x20trunk\x20found');}}}}else if(_0x301f90[_0x9c42('0xf7')]){_0x3cd8cc=_0x301f90[_0x9c42('0xf7')];}else{return this['channel'][_0x9c42('0x32')](_0x301f90,_0x9c42('0xf6'));}var _0x2e87a6=this[_0x9c42('0xe')][_0x9c42('0x4f')](_0x9c42('0xd1'),[util['format'](_0x9c42('0xf8'),_0x3cd8cc,_0x301f90[_0x9c42('0x44')]),_0x301f90[_0x9c42('0x5d')],_0x301f90[_0x9c42('0xd3')],_0x301f90['url']]);if(_0x2e87a6[_0x9c42('0x99')]===-0x1){return _0x2e87a6;}return this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')]('Executed\x20command\x20%s',_0x9c42('0xd1')));};AGIVertices[_0x9c42('0x14')][_0x9c42('0xf9')]=function(_0x2add5b){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0xfa'),_0x2add5b[_0x9c42('0x37')]));return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0xf9'));};AGIVertices[_0x9c42('0x14')][_0x9c42('0xc')]=function(_0x19a1da){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0xfb'),_0x19a1da['label']));if(_0x19a1da['retry']===0x0){return this['maxRetry'](_0x19a1da);}_0x19a1da[_0x9c42('0x9b')]-=0x1;if(!this['isConfigured'](_0x19a1da['file_id'])){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x19a1da,_0x9c42('0xfc'));}var _0x30e04b=this[_0x9c42('0x1d')]['sync'](this,_0x19a1da[_0x9c42('0xfd')]);if(!_0x30e04b){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x19a1da,_0x9c42('0xfe'));}if(!this['isConfigured'](_0x19a1da[_0x9c42('0xc7')])){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x9c42('0xff'));}var _0x29aa50=this['channel']['getData'](_0x30e04b,_0x19a1da[_0x9c42('0x100')],_0x19a1da[_0x9c42('0x101')]);var _0x1543fb=_0x29aa50['result']?_0x29aa50[_0x9c42('0x99')]['toString']():'';logger[_0x9c42('0x2d')](_0x9c42('0x102'),JSON[_0x9c42('0x6b')](_0x29aa50));if(_0x29aa50[_0x9c42('0x99')]===-0x1){this[_0x9c42('0x36')][_0x9c42('0x68')](this,_0x19a1da,_0x1543fb);return _0x29aa50;}else if(_0x29aa50[_0x9c42('0x97')]==='timeout'){_0x29aa50[_0x9c42('0x99')]=_0x1543fb['length']>=parseInt(_0x19a1da[_0x9c42('0x103')])?'x':'i';}else{_0x29aa50[_0x9c42('0x99')]=_0x1543fb[_0x9c42('0x93')]>=parseInt(_0x19a1da['mindigit'])&&_0x1543fb[_0x9c42('0x93')]<=parseInt(_0x19a1da[_0x9c42('0x101')])?'x':'i';}var _0x527663=this[_0x9c42('0x10')][_0x9c42('0x68')](this,_0x19a1da[_0x9c42('0xc7')]);if(!_0x527663){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x19a1da,_0x9c42('0xc8'));}this[_0x9c42('0xe')][_0x9c42('0x94')](_0x527663,_0x1543fb);if(this[_0x9c42('0x7a')](_0x19a1da['hiddendigitsnum'])){var _0x50908a=parseInt(_0x19a1da[_0x9c42('0x104')],0xa);var _0x469cb4=rs[_0x9c42('0x105')]({'charset':'*','length':_0x50908a});var _0x19b226=_0x1543fb[_0x9c42('0x93')];if(_0x19b226>0x0){if(_0x19b226>_0x50908a){this['createSquareDetailsReport'][_0x9c42('0x68')](this,_0x19a1da,_0x19a1da[_0x9c42('0x106')]==='first'?_0x469cb4+_0x1543fb[_0x9c42('0x107')](_0x50908a):_0x1543fb[_0x9c42('0x107')](0x0,_0x19b226-_0x50908a)+_0x469cb4);}else{this[_0x9c42('0x36')][_0x9c42('0x68')](this,_0x19a1da,rs['generate']({'charset':'*','length':_0x19b226}));}}else{this[_0x9c42('0x36')][_0x9c42('0x68')](this,_0x19a1da,'');}}else{this[_0x9c42('0x36')][_0x9c42('0x68')](this,_0x19a1da,_0x1543fb);}return _0x29aa50;};AGIVertices[_0x9c42('0x14')][_0x9c42('0xd')]=function(_0x5dbfce){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x108'),_0x5dbfce['label']));return this['getdigits'](_0x5dbfce);};AGIVertices[_0x9c42('0x14')][_0x9c42('0x109')]=function(_0x279570){logger['info'](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x279570[_0x9c42('0x37')]));this[_0x9c42('0x36')][_0x9c42('0x68')](this,_0x279570,_0x279570[_0x9c42('0x10a')]);return this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')]('GOAL\x20%s',_0x279570['goalname']));};AGIVertices[_0x9c42('0x14')][_0x9c42('0x10b')]=function(_0x4da44d){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0x10c'),_0x4da44d['label']));if(!this['isConfigured'](_0x4da44d[_0x9c42('0x7d')])||!this[_0x9c42('0x7a')](_0x4da44d[_0x9c42('0x7e')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x10d'));}if(!this[_0x9c42('0x7a')](_0x4da44d[_0x9c42('0x53')])){return this['channel'][_0x9c42('0x9d')](_0x9c42('0x9e'));}this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x10e'),_0x4da44d[_0x9c42('0x53')]));var _0x478947=this[_0x9c42('0x7c')][_0x9c42('0x68')](this,_0x4da44d);if(_0x478947){this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x10f'),_0x478947));var _0x4e2865=this['channel'][_0x9c42('0xef')](_0x478947);try{fs[_0x9c42('0xf0')](_0x478947+_0x9c42('0xf1'));}catch(_0x5e35af){logger['error'](_0x5e35af);}return _0x4e2865;}return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x4da44d,_0x9c42('0x110'));};AGIVertices[_0x9c42('0x14')][_0x9c42('0x111')]=function(_0x204ed6){logger['info'](util[_0x9c42('0x29')](_0x9c42('0x112'),_0x204ed6['label']));if(!this[_0x9c42('0x7a')](_0x204ed6['aws_access_key_id'])||!this[_0x9c42('0x7a')](_0x204ed6[_0x9c42('0x7e')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x9c42('0x7a')](_0x204ed6[_0x9c42('0x83')])){return this[_0x9c42('0xe')]['noop'](_0x9c42('0x113'));}if(!this[_0x9c42('0x7a')](_0x204ed6['text'])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x9e'));}this['channel'][_0x9c42('0xe3')]=!![];this[_0x9c42('0x36')](_0x204ed6);this[_0x9c42('0x3f')](_0x204ed6[_0x9c42('0x53')],'in','','');this['channel'][_0x9c42('0x9d')](util['format'](_0x9c42('0x114'),_0x204ed6['text']));var _0x50b731=this[_0x9c42('0x81')]['sync'](this,_0x204ed6);if(_0x50b731){for(var _0x1ca890 in _0x50b731){if(_0x50b731['hasOwnProperty'](_0x1ca890)&&_['isString'](_0x50b731[_0x1ca890])){this[_0x9c42('0xe')]['setVariable'](util['format']('AWS_LEX_%s',_0x1ca890[_0x9c42('0x61')]()),_0x50b731[_0x1ca890]);}}if(_[_0x9c42('0x42')](_0x50b731[_0x9c42('0x6e')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x115'));}else{this['createSquareMessage'](_0x50b731[_0x9c42('0x6e')],_0x9c42('0xdb'),'amazonlex','');return this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x116'),_0x50b731[_0x9c42('0x6e')]));}}return this[_0x9c42('0xe')]['error'](_0x204ed6,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x9c42('0x14')][_0x9c42('0x117')]=function(_0x371799){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0x118'),_0x371799[_0x9c42('0x37')],_0x371799[_0x9c42('0x5d')]));if(!this[_0x9c42('0x7a')](_0x371799[_0x9c42('0x71')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0xd7'));}var _0x29d061=_0x9c42('0x119');var _0x295c1b=util[_0x9c42('0x29')](_0x9c42('0x11a'),FILES_PATH,rs[_0x9c42('0x105')](0x4));var _0x52d00f=util[_0x9c42('0x29')](_0x9c42('0x92'),_0x295c1b,_0x29d061);var _0x1316b2=!![];if(_0x371799[_0x9c42('0x11b')]===_0x9c42('0x11c')){_0x1316b2=![];}var _0x2593dd=this[_0x9c42('0xe')]['recordFile'](_0x295c1b,_0x29d061,_0x371799[_0x9c42('0x11d')],_0x371799[_0x9c42('0x5d')],undefined,_0x1316b2);if(_0x2593dd[_0x9c42('0x99')]!==-0x1){this['channel'][_0x9c42('0x9d')](util['format']('google\x20%s\x20file\x20created',_0x52d00f));var _0x1ea041=this[_0x9c42('0x84')]['sync'](this,_0x371799,_0x52d00f);if(_0x1ea041){for(var _0x5f54d8 in _0x1ea041){if(_0x1ea041[_0x9c42('0x8d')](_0x5f54d8)){this[_0x9c42('0xe')]['setVariable'](util[_0x9c42('0x29')](_0x9c42('0x11e'),_0x5f54d8[_0x9c42('0x61')]()),_0x1ea041[_0x5f54d8]);}}return this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')](_0x9c42('0x11f'),JSON[_0x9c42('0x6b')](_0x1ea041)));}}return _0x2593dd;};AGIVertices[_0x9c42('0x14')][_0x9c42('0x120')]=function(_0x3b2124){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0x121'),_0x3b2124['label']));if(!this['isConfigured'](_0x3b2124['appid'])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x122'));}if(!this[_0x9c42('0x7a')](_0x3b2124[_0x9c42('0x87')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x123'));}var _0x292e2c=_0x9c42('0x119');var _0x46e3fa=util[_0x9c42('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x9c42('0x105')](0x4));var _0x3a25d0=util[_0x9c42('0x29')](_0x9c42('0x92'),_0x46e3fa,_0x292e2c);var _0x3a774e=!![];if(_0x3b2124['beep']===_0x9c42('0x11c')){_0x3a774e=![];}var _0x190755=this[_0x9c42('0xe')][_0x9c42('0x124')](_0x46e3fa,_0x292e2c,_0x3b2124['intKey'],_0x3b2124[_0x9c42('0x5d')],undefined,_0x3a774e);if(_0x190755[_0x9c42('0x99')]!==-0x1){this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x125'),_0x3a25d0));var _0x588603=this[_0x9c42('0x85')][_0x9c42('0x68')](this,_0x3b2124,_0x3a25d0);if(_0x588603){for(var _0x396cd2 in _0x588603){if(_0x588603[_0x9c42('0x8d')](_0x396cd2)){this['channel'][_0x9c42('0x94')](util[_0x9c42('0x29')]('TILDE_ASR_%s',_0x396cd2['toUpperCase']()),_0x588603[_0x396cd2]);}}return this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')](_0x9c42('0x126'),JSON[_0x9c42('0x6b')](_0x588603)));}}return _0x190755;};AGIVertices[_0x9c42('0x14')][_0x9c42('0x127')]=function(_0x687865){logger['info'](util[_0x9c42('0x29')](_0x9c42('0x128'),_0x687865['label']));return this[_0x9c42('0xe')]['continueAt'](_0x687865['context'],_0x687865['extension'],_0x687865[_0x9c42('0x3d')]);};AGIVertices['prototype'][_0x9c42('0x129')]=function(_0x12a906){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x12a'),_0x12a906[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x12a906[_0x9c42('0x12b')])){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x12a906,_0x9c42('0x12c'));}try{var _0x59a26c=eval(_0x12a906[_0x9c42('0x12b')])?'true':_0x9c42('0x12d');this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')](_0x9c42('0x12e'),_0x12a906[_0x9c42('0x12b')],_0x59a26c));return{'code':0xc8,'result':_0x59a26c};}catch(_0x16f4fb){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0x4a3567){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0x12f'),_0x4a3567[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x4a3567['interval_id'])){return this['channel'][_0x9c42('0x32')](_0x4a3567,_0x9c42('0x130'));}var _0x218091=this['getIntervals'][_0x9c42('0x68')](this,_0x4a3567[_0x9c42('0x131')]);if(!_0x218091){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x4a3567,'no\x20intervals\x20found');}for(var _0x24ea63=0x0;_0x24ea63<_0x218091[_0x9c42('0x93')];_0x24ea63+=0x1){var _0xdc5816=this['channel'][_0x9c42('0x10')](util['format'](_0x9c42('0x132'),_0x218091[_0x24ea63]));if(_0xdc5816['result']===-0x1){return _0xdc5816;}logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x133'),_0x218091[_0x24ea63],_0xdc5816[_0x9c42('0x97')]));if(_0xdc5816['extra']===_0x9c42('0x134')){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x133'),_0x218091[_0x24ea63],_0x9c42('0x134')));this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')]('IFTIME\x20%s\x20%s',_0x218091[_0x24ea63],_0x9c42('0x134')));return{'code':0xc8,'result':_0x9c42('0x134')};}else{logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x133'),_0x218091[_0x24ea63],_0x9c42('0x12d')));this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x133'),_0x218091[_0x24ea63],'false'));}}return{'code':0xc8,'result':_0x9c42('0x12d')};};AGIVertices[_0x9c42('0x14')][_0x9c42('0x135')]=function(_0x41f815){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x136'),_0x41f815['label']));return this[_0x9c42('0xe')][_0x9c42('0x135')]();};AGIVertices[_0x9c42('0x14')][_0x9c42('0x137')]=function(_0x3ac292){logger['info'](util[_0x9c42('0x29')](_0x9c42('0x138'),_0x3ac292[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x3ac292[_0x9c42('0x71')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0xd7'));}var _0x369ef4=_0x9c42('0x119');var _0x577711=util[_0x9c42('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x9c42('0x105')](0x4));var _0x18c6f3=util[_0x9c42('0x29')](_0x9c42('0x92'),_0x577711,_0x369ef4);var _0x324611=!![];if(_0x3ac292[_0x9c42('0x11b')]===_0x9c42('0x11c')){_0x324611=![];}var _0xb4128e=this[_0x9c42('0xe')][_0x9c42('0x124')](_0x577711,_0x369ef4,_0x3ac292[_0x9c42('0x11d')],_0x3ac292['timeout'],undefined,_0x324611);if(_0xb4128e[_0x9c42('0x99')]!==-0x1){this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')](_0x9c42('0x139'),_0x18c6f3));var _0x26b4c9=this[_0x9c42('0x79')][_0x9c42('0x68')](this,_0x3ac292,_0x18c6f3);if(_0x26b4c9){for(var _0x461ff2 in _0x26b4c9){if(_0x26b4c9[_0x9c42('0x8d')](_0x461ff2)){this[_0x9c42('0xe')][_0x9c42('0x94')](util[_0x9c42('0x29')](_0x9c42('0x13a'),_0x461ff2[_0x9c42('0x61')]()),_0x26b4c9[_0x461ff2]);}}return this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x13b'),JSON['stringify'](_0x26b4c9)));}}return _0xb4128e;};AGIVertices['prototype'][_0x9c42('0x13c')]=function(_0x25ce34){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x25ce34[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x25ce34[_0x9c42('0x71')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x25ce34[_0x9c42('0x53')])){return this['channel'][_0x9c42('0x9d')](_0x9c42('0x9e'));}this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x13d'),_0x25ce34[_0x9c42('0x53')]));var _0x2db2b9=this[_0x9c42('0x13e')]['sync'](this,_0x25ce34);if(_0x2db2b9){this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')](_0x9c42('0x139'),_0x2db2b9));var _0x299bb2=this[_0x9c42('0xe')]['streamFile'](_0x2db2b9,_0x25ce34[_0x9c42('0x11d')]);try{fs[_0x9c42('0xf0')](_0x2db2b9+_0x9c42('0xf1'));}catch(_0x1efd15){logger[_0x9c42('0x32')](_0x1efd15);}return _0x299bb2;}return this[_0x9c42('0xe')]['error'](_0x25ce34,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x9c42('0x14')]['login']=function(_0x269e21){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0x13f'),_0x269e21[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x269e21[_0x9c42('0x140')])){return this[_0x9c42('0xe')]['error'](_0x269e21,_0x9c42('0x141'));}logger[_0x9c42('0x2d')](util['format'](_0x9c42('0x142'),this['channel'][_0x9c42('0x3a')],_0x269e21[_0x9c42('0x140')]));var _0x27c917=this[_0x9c42('0x4c')][_0x9c42('0x68')](this,_0x269e21['findBy']);if(_0x27c917){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9c42('0xe')][_0x9c42('0x3a')],_0x269e21[_0x9c42('0x140')]));this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x143'),this['channel'][_0x9c42('0x3a')],_0x269e21[_0x9c42('0x140')]));return{'code':0xc8,'result':_0x9c42('0x144')};}else{logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x145'),this[_0x9c42('0xe')][_0x9c42('0x3a')],_0x269e21[_0x9c42('0x140')]));this[_0x9c42('0xe')][_0x9c42('0x9d')](util['format'](_0x9c42('0x145'),this[_0x9c42('0xe')][_0x9c42('0x3a')],_0x269e21[_0x9c42('0x140')]));return{'code':0xc8,'result':_0x9c42('0x146')};}};AGIVertices['prototype'][_0x9c42('0x147')]=function(_0x1546e0){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x148'),_0x1546e0['label']));if(!this[_0x9c42('0x7a')](_0x1546e0[_0x9c42('0x140')])){return this['channel'][_0x9c42('0x32')](_0x1546e0,'no\x20find\x20by\x20configured');}logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x142'),this['channel']['callerid'],_0x1546e0[_0x9c42('0x140')]));var _0x26a217=this[_0x9c42('0x149')][_0x9c42('0x68')](this,_0x1546e0[_0x9c42('0x140')]);if(_0x26a217){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0x143'),this['channel'][_0x9c42('0x3a')],_0x1546e0[_0x9c42('0x140')]));this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1546e0['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x9c42('0x29')](_0x9c42('0x145'),this[_0x9c42('0xe')]['callerid'],_0x1546e0['findBy']));this[_0x9c42('0xe')][_0x9c42('0x9d')](util['format'](_0x9c42('0x145'),this[_0x9c42('0xe')][_0x9c42('0x3a')],_0x1546e0[_0x9c42('0x140')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9c42('0x14')][_0x9c42('0x14a')]=function(_0x3eab37){logger['info'](util[_0x9c42('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3eab37[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x3eab37['operation'])){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x3eab37,_0x9c42('0x14b'));}this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')](_0x9c42('0x14c'),_0x3eab37[_0x9c42('0x14d')]));var _0x19f7d8=eval(_0x3eab37[_0x9c42('0x14d')]);if(!this[_0x9c42('0x7a')](_0x3eab37[_0x9c42('0xc7')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0xff'));}var _0x2dbd2d=this[_0x9c42('0x10')][_0x9c42('0x68')](this,_0x3eab37['variable_id']);if(!_0x2dbd2d){return this['channel'][_0x9c42('0x32')](_0x3eab37,_0x9c42('0xc8'));}if(_[_0x9c42('0x8f')](_0x19f7d8)){var _0x3cabae=this;_0x19f7d8['forEach'](function(_0x1d864f,_0x201aa3){_0x3cabae['channel'][_0x9c42('0x94')](util[_0x9c42('0x29')]('%s[%s]',_0x2dbd2d,_0x201aa3),_0x1d864f);});return this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')](_0x9c42('0x14e'),_0x2dbd2d));}else{return this['channel'][_0x9c42('0x94')](_0x2dbd2d,_0x19f7d8);}};AGIVertices[_0x9c42('0x14')][_0x9c42('0xb')]=function(_0x2d3774){logger['info'](util[_0x9c42('0x29')](_0x9c42('0x14f'),_0x2d3774[_0x9c42('0x37')]));if(_0x2d3774[_0x9c42('0x9b')]===0x0){return this['maxRetry'](_0x2d3774);}_0x2d3774[_0x9c42('0x9b')]-=0x1;if(!this[_0x9c42('0x7a')](_0x2d3774[_0x9c42('0xfd')])){return this['channel'][_0x9c42('0x32')](_0x2d3774,_0x9c42('0xfc'));}var _0x10ee6d=this[_0x9c42('0x1d')][_0x9c42('0x68')](this,_0x2d3774[_0x9c42('0xfd')]);if(!_0x10ee6d){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x2d3774,_0x9c42('0xfe'));}var _0x1bc84f=this['channel'][_0x9c42('0x150')](_0x10ee6d,_0x2d3774[_0x9c42('0x100')],_0x2d3774[_0x9c42('0x151')]);var _0x369a1c=_0x1bc84f[_0x9c42('0x99')];if(_0x1bc84f[_0x9c42('0x99')]===-0x1){this[_0x9c42('0x36')][_0x9c42('0x68')](this,_0x2d3774,'-1');return _0x1bc84f;}else if(_0x1bc84f[_0x9c42('0x97')]===_0x9c42('0x5d')){_0x1bc84f[_0x9c42('0x99')]=_0x1bc84f['result'][_0x9c42('0x93')]>0x0?_0x1bc84f[_0x9c42('0x99')]:'t';}else if(_[_0x9c42('0x41')](_0x1bc84f['result'])){_0x1bc84f[_0x9c42('0x99')]='#';_0x369a1c='#';}if(!this[_0x9c42('0x7a')](_0x2d3774['variable_id'])){this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0xff'));}else{var _0x6d4521=this['getVariable'][_0x9c42('0x68')](this,_0x2d3774[_0x9c42('0xc7')]);if(!_0x6d4521){return this[_0x9c42('0xe')]['error'](_0x2d3774,_0x9c42('0xc8'));}this[_0x9c42('0xe')][_0x9c42('0x94')](_0x6d4521,_0x369a1c);}this[_0x9c42('0x36')][_0x9c42('0x68')](this,_0x2d3774,_0x369a1c);return _0x1bc84f;};AGIVertices[_0x9c42('0x14')][_0x9c42('0x9d')]=function(_0x546234){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x152'),_0x546234[_0x9c42('0x37')]));return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x546234['output']||_0x546234[_0x9c42('0x37')]);};AGIVertices[_0x9c42('0x14')][_0x9c42('0x153')]=function(_0x34ee0f){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x154'),_0x34ee0f[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x34ee0f[_0x9c42('0x140')])){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x34ee0f,'no\x20find\x20by\x20configured');}logger[_0x9c42('0x2d')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9c42('0xe')][_0x9c42('0x3a')],_0x34ee0f['findBy']));var _0x182997=this[_0x9c42('0x49')][_0x9c42('0x68')](this,_0x34ee0f['pause_id']);var _0xd57beb=this[_0x9c42('0x155')]['sync'](this,_0x34ee0f[_0x9c42('0x140')],_0x182997);if(_0xd57beb){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x143'),this[_0x9c42('0xe')]['callerid'],_0x34ee0f['findBy']));this[_0x9c42('0xe')]['noop'](util['format'](_0x9c42('0x143'),this[_0x9c42('0xe')]['callerid'],_0x34ee0f[_0x9c42('0x140')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x9c42('0x29')](_0x9c42('0x145'),this[_0x9c42('0xe')]['callerid'],_0x34ee0f[_0x9c42('0x140')]));this[_0x9c42('0xe')][_0x9c42('0x9d')](util['format'](_0x9c42('0x143'),this[_0x9c42('0xe')][_0x9c42('0x3a')],_0x34ee0f[_0x9c42('0x140')]));return{'code':0xc8,'result':_0x9c42('0x146')};}};AGIVertices[_0x9c42('0x14')]['playback']=function(_0x5398af){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x156'),_0x5398af[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x5398af['file_id'])){return this['channel'][_0x9c42('0x32')](_0x5398af,_0x9c42('0xfc'));}var _0x218060=this['getSound'][_0x9c42('0x68')](this,_0x5398af[_0x9c42('0xfd')]);if(!_0x218060){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x5398af,_0x9c42('0xfe'));}var _0x51cac7=this[_0x9c42('0xe')][_0x9c42('0x4f')](_0x9c42('0x157'),[_0x218060,_0x5398af['opts']]);if(_0x51cac7[_0x9c42('0x99')]===-0x1){return _0x51cac7;}return this[_0x9c42('0xe')][_0x9c42('0x9d')](util['format'](_0x9c42('0xb5'),_0x9c42('0x157'),_0x218060));};AGIVertices[_0x9c42('0x14')][_0x9c42('0x158')]=function(_0x5223ef){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x159'),_0x5223ef['label']));if(!this[_0x9c42('0x7a')](_0x5223ef['queue_id'])){return this['channel'][_0x9c42('0x32')](_0x5223ef,_0x9c42('0x15a'));}var _0x144b83='';var _0xb42a1=parseInt(_0x5223ef[_0x9c42('0x15b')],0xa);if(isNaN(_0xb42a1)){_0x144b83=_0x5223ef[_0x9c42('0x15b')];}else{_0x144b83=this[_0x9c42('0x15')][_0x9c42('0x68')](this,_0x5223ef['queue_id']);if(!_0x144b83){return this['channel'][_0x9c42('0x32')](_0x5223ef,_0x9c42('0x15c'));}}var _0x58f608='';if(this[_0x9c42('0x7a')](_0x5223ef[_0x9c42('0xfd')])){var _0x5691f5=this[_0x9c42('0x1d')][_0x9c42('0x68')](this,_0x5223ef[_0x9c42('0xfd')]);if(_0x5691f5){_0x58f608=_0x5691f5;}}this[_0x9c42('0x36')][_0x9c42('0x68')](this,_0x5223ef,_0x144b83);if(_0x5223ef[_0x9c42('0xd3')]['indexOf']('x')<0x0){_0x5223ef[_0x9c42('0xd3')]+='x';}if(_0x5223ef[_0x9c42('0xd3')][_0x9c42('0x15d')]('X')<0x0){_0x5223ef[_0x9c42('0xd3')]+='X';}this[_0x9c42('0xe')][_0x9c42('0x94')](_0x9c42('0x15e'),_0x144b83?_0x144b83[_0x9c42('0x15f')]():'');var _0xe0a469=this[_0x9c42('0xe')][_0x9c42('0x4f')]('QUEUE',[_0x144b83,_0x5223ef[_0x9c42('0xd3')],_0x5223ef[_0x9c42('0x5b')],_0x58f608,_0x5223ef[_0x9c42('0x5d')],_0x5223ef[_0x9c42('0xa7')],_0x5223ef[_0x9c42('0x160')],_0x5223ef[_0x9c42('0x161')],'',_0x5223ef[_0x9c42('0x162')]]);if(_0xe0a469[_0x9c42('0x99')]===-0x1){return _0xe0a469;}return this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0xb5'),_0x9c42('0x163'),_0x144b83));};AGIVertices[_0x9c42('0x14')][_0x9c42('0x164')]=function(_0x1ae936){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x165'),_0x1ae936[_0x9c42('0x37')]));var _0x495dca=_0x1ae936[_0x9c42('0x166')]||_0x9c42('0x119');var _0x530e48=util[_0x9c42('0x29')](_0x9c42('0x167'),this[_0x9c42('0xe')]['uniqueid'],rs[_0x9c42('0x105')](0x5));var _0x11bd1f=util['format'](_0x9c42('0x168'),FILES_PATH,_0x530e48,_0x495dca);var _0x373905=util['format'](_0x9c42('0x11a'),FILES_PATH,_0x530e48);this['createSquareRecording'][_0x9c42('0x68')](this,_0x1ae936,_0x530e48,_0x11bd1f);this[_0x9c42('0xe')][_0x9c42('0x94')](_0x9c42('0x169'),_0x530e48);logger[_0x9c42('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x373905,_0x495dca,_0x1ae936['escape_digits'],_0x1ae936[_0x9c42('0x5d')]);return this[_0x9c42('0xe')][_0x9c42('0x124')](_0x373905,_0x495dca,_0x1ae936[_0x9c42('0x16a')],_0x1ae936['timeout'],undefined,!![]);};AGIVertices[_0x9c42('0x14')]['restapi']=function(_0x245d75){logger['info'](util[_0x9c42('0x29')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x245d75[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x245d75[_0x9c42('0x5b')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x16b'));}var _0x9648a1=this[_0x9c42('0x5a')]['sync'](this,_0x245d75);logger['info'](util[_0x9c42('0x29')](_0x9c42('0x16c'),util[_0x9c42('0x16d')](_0x9648a1,{'showHidden':![],'depth':null})));if(!this[_0x9c42('0x7a')](_0x245d75[_0x9c42('0xc7')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0xd758f6=this['getVariable'][_0x9c42('0x68')](this,_0x245d75['variable_id']);if(!_0xd758f6){return this['channel'][_0x9c42('0x32')](_0x245d75,_0x9c42('0xc8'));}this[_0x9c42('0xe')]['setVariable'](util[_0x9c42('0x29')](_0x9c42('0x16e'),_0xd758f6),_0x9648a1[_0x9c42('0x6d')]?_0x9648a1[_0x9c42('0x6d')]:_0x9c42('0x16f'));this[_0x9c42('0xe')][_0x9c42('0x94')](util[_0x9c42('0x29')](_0x9c42('0x170'),_0xd758f6),_0x9648a1['statusMessage']?_0x9648a1[_0x9c42('0x6c')]:'OK');if(_0x9648a1[_0x9c42('0x62')]){try{this['saveRestApiResult'](_0x9648a1['body'],_0xd758f6);}catch(_0x38f22d){logger[_0x9c42('0x32')](util[_0x9c42('0x29')](_0x9c42('0x171'),_0xd758f6));}}return this[_0x9c42('0xe')][_0x9c42('0x9d')](util['format'](_0x9c42('0xcc'),_0xd758f6));};AGIVertices[_0x9c42('0x14')][_0x9c42('0x172')]=function(_0x673925){logger['info'](util[_0x9c42('0x29')](_0x9c42('0x173'),_0x673925['label']));return this[_0x9c42('0xe')][_0x9c42('0x174')](_0x673925['digits'][_0x9c42('0x175')](/\s+/g,''),_0x673925['escape_digits']);};AGIVertices[_0x9c42('0x14')]['saynumber']=function(_0x20e79e){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x20e79e[_0x9c42('0x37')]));return this[_0x9c42('0xe')][_0x9c42('0x176')](_0x20e79e[_0x9c42('0x177')][_0x9c42('0x175')](/\s+/g,''),_0x20e79e[_0x9c42('0x16a')]);};AGIVertices[_0x9c42('0x14')][_0x9c42('0x178')]=function(_0x35a4a6){logger['info'](util[_0x9c42('0x29')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x35a4a6[_0x9c42('0x37')]));return this[_0x9c42('0xe')][_0x9c42('0x179')](_0x35a4a6['text'],_0x35a4a6[_0x9c42('0x16a')]);};AGIVertices[_0x9c42('0x14')][_0x9c42('0x17a')]=function(_0x156638){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x17b'),_0x156638[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x156638[_0x9c42('0x17c')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x17d'));}var _0x33a6a4=this['getMailAccount'][_0x9c42('0x68')](this,_0x156638[_0x9c42('0x17c')]);if(!_0x33a6a4||!_0x33a6a4[_0x9c42('0x17e')]){return this[_0x9c42('0xe')]['error'](_0x156638,_0x9c42('0x17f'));}var _0x128e3c={'from':util['format'](_0x9c42('0x180'),_0x33a6a4[_0x9c42('0x13')],_0x33a6a4[_0x9c42('0x181')]||_0x33a6a4['Smtp']['user']),'to':_0x156638['to']||'','cc':_0x156638['cc']||'','bcc':_0x156638[_0x9c42('0x182')]||'','subject':_0x156638['subject'],'html':_0x156638['text'],'text':_0x156638[_0x9c42('0x53')]};var _0x37932c={'tls':{'rejectUnauthorized':![]}};if(_0x33a6a4[_0x9c42('0x17e')][_0x9c42('0x183')]){_0x37932c['service']=_0x33a6a4[_0x9c42('0x17e')][_0x9c42('0x183')];}else{_0x37932c[_0x9c42('0x184')]=_0x33a6a4['Smtp']['host'];_0x37932c[_0x9c42('0x185')]=_0x33a6a4['Smtp'][_0x9c42('0x185')];_0x37932c[_0x9c42('0x186')]=_0x33a6a4[_0x9c42('0x17e')][_0x9c42('0x186')];}if(_0x33a6a4[_0x9c42('0x17e')][_0x9c42('0x187')]){_0x37932c[_0x9c42('0x188')]={'user':_0x33a6a4['Smtp']['user'],'pass':_0x33a6a4[_0x9c42('0x17e')][_0x9c42('0x189')]};}if(this[_0x9c42('0x7a')](_0x156638['template_id'])){}logger[_0x9c42('0x18a')](_0x9c42('0x18b'),JSON[_0x9c42('0x6b')](_0x128e3c));this[_0x9c42('0x36')][_0x9c42('0x68')](this,_0x156638,_0x156638['account_id']);this['channel']['noop'](util[_0x9c42('0x29')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x33a6a4[_0x9c42('0x13')]));this[_0x9c42('0x22')]['sync'](this,_0x37932c,_0x128e3c);return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x18c'));};AGIVertices[_0x9c42('0x14')][_0x9c42('0x18d')]=function(_0x5d6054){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0x18e'),_0x5d6054[_0x9c42('0x37')]));return this['channel']['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x9c42('0x14')][_0x9c42('0x18f')]=function(_0x5b966c){logger[_0x9c42('0x2d')](util['format'](_0x9c42('0x190'),_0x5b966c[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0x5b966c[_0x9c42('0x191')])){return this[_0x9c42('0xe')]['noop']('no\x20sms\x20account\x20configured');}var _0x402030=this[_0x9c42('0x34')][_0x9c42('0x68')](this,_0x5b966c['sms_account_id']);if(!_0x402030){return this['channel'][_0x9c42('0x32')](_0x5b966c,_0x9c42('0x192'));}var _0x28275c={'body':_0x5b966c[_0x9c42('0x193')],'phone':_0x5b966c['to']||'','SmsAccountId':_0x402030['id']};logger[_0x9c42('0x18a')](_0x9c42('0x194'),JSON[_0x9c42('0x6b')](_0x28275c));this[_0x9c42('0x36')]['sync'](this,_0x5b966c,_0x5b966c[_0x9c42('0x191')]);this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x195'),_0x402030[_0x9c42('0x13')]));this[_0x9c42('0x35')][_0x9c42('0x68')](this,_0x28275c);return this['channel'][_0x9c42('0x9d')](_0x9c42('0x196'));};AGIVertices[_0x9c42('0x14')]['set']=function(_0x10dace){logger['info'](util['format'](_0x9c42('0x197'),_0x10dace['label']));if(!this[_0x9c42('0x7a')](_0x10dace[_0x9c42('0xc7')])){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x10dace,_0x9c42('0x198'));}var _0x295050=this[_0x9c42('0x10')][_0x9c42('0x68')](this,_0x10dace[_0x9c42('0xc7')]);if(!_0x295050){return this['channel']['error'](_0x10dace,_0x9c42('0xc8'));}return this['channel'][_0x9c42('0x94')](_0x295050,_0x10dace[_0x9c42('0x199')]);};AGIVertices[_0x9c42('0x14')][_0x9c42('0x19a')]=function(_0x3c4055){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x19b'),_0x3c4055[_0x9c42('0x37')]));this[_0x9c42('0xe')][_0x9c42('0x9d')]('START\x20CALLY\x20SQUARE');if(_0x3c4055[_0x9c42('0xaa')]===_0x9c42('0x19c')){this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x19d'));return this[_0x9c42('0xe')][_0x9c42('0xaa')]();}return this[_0x9c42('0xe')]['noop'](_0x9c42('0x19e'));};AGIVertices[_0x9c42('0x14')]['subproject']=function(_0xf31c81){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0xf31c81[_0x9c42('0x37')]));if(!this[_0x9c42('0x7a')](_0xf31c81[_0x9c42('0x19f')])){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0xf31c81,_0x9c42('0x1a0'));}var _0x1f490b=this[_0x9c42('0x17')][_0x9c42('0x68')](this,_0xf31c81['project_id']);if(!this[_0x9c42('0x7a')](_0x1f490b)){return this[_0x9c42('0xe')]['error'](_0xf31c81,util[_0x9c42('0x29')](_0x9c42('0x1a1'),_0xf31c81[_0x9c42('0x19f')]));}if(_0x1f490b===this[_0x9c42('0xe')][_0x9c42('0x39')]){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0xf31c81,_0x9c42('0x1a2'));}this['createSquareDetailsReport']['sync'](this,_0xf31c81,_0x1f490b);var _0x19002d=this['channel'][_0x9c42('0x4f')](_0x9c42('0x1a3'),util['format'](_0x9c42('0x1a4'),config[_0x9c42('0xa7')]['host']||_0x9c42('0x1a5'),_0x1f490b,this['channel'][_0x9c42('0x39')]));if(_0x19002d['result']===-0x1){return _0x19002d;}return this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')]('Executed\x20command\x20%s\x20%s','AGI',_0x1f490b));};AGIVertices[_0x9c42('0x14')][_0x9c42('0x1a6')]=function(_0x3ef645){logger['info'](util[_0x9c42('0x29')](_0x9c42('0x1a7'),_0x3ef645[_0x9c42('0x37')]));var _0x31fde9=this[_0x9c42('0x4e')][_0x9c42('0x68')](this,_0x3ef645[_0x9c42('0xa8')]);this[_0x9c42('0x36')][_0x9c42('0x68')](this,_0x3ef645,_0x3ef645[_0x9c42('0xa8')]);if(this['isConfigured'](_0x3ef645[_0x9c42('0xc7')])){var _0x12cc54=this[_0x9c42('0x10')][_0x9c42('0x68')](this,_0x3ef645[_0x9c42('0xc7')]);if(_0x12cc54){this[_0x9c42('0xe')][_0x9c42('0x94')](_0x12cc54,_0x31fde9);return this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x1a8'),_0x3ef645[_0x9c42('0xa8')],_0x12cc54));}}return this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x3ef645[_0x9c42('0xa8')]));};AGIVertices[_0x9c42('0x14')]['google_cloud_tts']=function(_0x889371){logger['info'](util[_0x9c42('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x889371[_0x9c42('0x37')]));_0x889371['text']=_0x889371[_0x9c42('0x53')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9c42('0x7a')](_0x889371['apiKey'])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x1a9'));}if(!this[_0x9c42('0x7a')](_0x889371[_0x9c42('0x53')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x9e'));}this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x889371[_0x9c42('0x53')]));var _0xc42734=this[_0x9c42('0x51')][_0x9c42('0x68')](this,_0x889371);if(_0xc42734){this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0xc42734));var _0x5b2e7a=this[_0x9c42('0xe')]['streamFile'](_0xc42734);try{fs[_0x9c42('0xf0')](_0xc42734+_0x9c42('0xf1'));}catch(_0x142d35){logger[_0x9c42('0x32')](_0x142d35);}return _0x5b2e7a;}return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x889371,_0x9c42('0x1aa'));};AGIVertices[_0x9c42('0x14')][_0x9c42('0x1ab')]=function(_0x5f4266){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x1ac'),_0x5f4266[_0x9c42('0x37')]));_0x5f4266[_0x9c42('0x53')]=_0x5f4266[_0x9c42('0x53')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9c42('0x7a')](_0x5f4266[_0x9c42('0x53')])){return this[_0x9c42('0xe')][_0x9c42('0x9d')](_0x9c42('0x9e'));}this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x1ad'),_0x5f4266[_0x9c42('0x53')]));var _0x1faf60=this[_0x9c42('0x59')][_0x9c42('0x68')](this,_0x5f4266);if(_0x1faf60){this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x1ae'),_0x1faf60));var _0x3674e2=this[_0x9c42('0xe')][_0x9c42('0xef')](_0x1faf60);try{fs[_0x9c42('0xf0')](_0x1faf60+'.wav');}catch(_0x1f9930){logger[_0x9c42('0x32')](_0x1f9930);}return _0x3674e2;}return this[_0x9c42('0xe')]['error'](_0x5f4266,_0x9c42('0x1af'));};AGIVertices[_0x9c42('0x14')]['unpause']=function(_0x13c990){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x1b0'),_0x13c990['label']));if(!this[_0x9c42('0x7a')](_0x13c990[_0x9c42('0x140')])){return this[_0x9c42('0xe')]['error'](_0x13c990,_0x9c42('0x141'));}logger[_0x9c42('0x2d')](util['format'](_0x9c42('0x142'),this[_0x9c42('0xe')]['callerid'],_0x13c990['findBy']));var _0x3226ca=this['agentUnpause'][_0x9c42('0x68')](this,_0x13c990[_0x9c42('0x140')]);if(_0x3226ca){logger['info'](util[_0x9c42('0x29')](_0x9c42('0x143'),this[_0x9c42('0xe')]['callerid'],_0x13c990[_0x9c42('0x140')]));this[_0x9c42('0xe')][_0x9c42('0x9d')](util[_0x9c42('0x29')](_0x9c42('0x143'),this[_0x9c42('0xe')]['callerid'],_0x13c990[_0x9c42('0x140')]));return{'code':0xc8,'result':_0x9c42('0x144')};}else{logger[_0x9c42('0x2d')](util[_0x9c42('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9c42('0xe')][_0x9c42('0x3a')],_0x13c990[_0x9c42('0x140')]));this[_0x9c42('0xe')]['noop'](util[_0x9c42('0x29')](_0x9c42('0x145'),this['channel'][_0x9c42('0x3a')],_0x13c990['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9c42('0x14')][_0x9c42('0x1b1')]=function(_0x55bce4){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x1b2'),_0x55bce4[_0x9c42('0x37')]));var _0x2007a7=this[_0x9c42('0xe')][_0x9c42('0x4f')]('VOICEMAIL',[_0x55bce4[_0x9c42('0x1b3')],_0x55bce4['options']]);if(_0x2007a7[_0x9c42('0x99')]===-0x1){return _0x2007a7;}return this['channel'][_0x9c42('0x9d')](util[_0x9c42('0x29')]('Executed\x20command\x20%s\x20%s',_0x9c42('0x1b4'),_0x55bce4[_0x9c42('0x1b3')]));};AGIVertices[_0x9c42('0x14')][_0x9c42('0x1b5')]=function(_0x387a24){logger[_0x9c42('0x2d')](util[_0x9c42('0x29')](_0x9c42('0x1b6'),_0x387a24['label']));if(!this['isConfigured'](_0x387a24[_0x9c42('0xc7')])){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x387a24,_0x9c42('0x198'));}var _0x3a8d49=this['getVariable'][_0x9c42('0x68')](this,_0x387a24[_0x9c42('0xc7')]);if(!_0x3a8d49){return this[_0x9c42('0xe')][_0x9c42('0x32')](_0x387a24,_0x9c42('0xc8'));}var _0x3ccbe9=this[_0x9c42('0xe')][_0x9c42('0x10')](_0x3a8d49);return{'code':0xc8,'result':_0x3ccbe9['extra']?_0x3ccbe9['extra']:'-'};};String[_0x9c42('0x14')]['replaceAll']=function(_0x23b4e6,_0x5bfb7a){return this['split'](_0x23b4e6)[_0x9c42('0x1b7')](_0x5bfb7a);};module[_0x9c42('0x1b8')]=AGIVertices; \ No newline at end of file +var _0x1f59=['no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20found','forEach','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','speech','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','number','sayphonetic','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','odbc','moment','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','file','createSquareMessage','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1f59,0xef));var _0x91f5=function(_0x484e3e,_0x4ca8f9){_0x484e3e=_0x484e3e-0x0;var _0x3304dd=_0x1f59[_0x484e3e];return _0x3304dd;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x91f5('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x91f5('0x1'))();var rs=require('randomstring');var moment=require(_0x91f5('0x2'));var Mustache=require('mustache');var rp=require(_0x91f5('0x3'));var logger=require(_0x91f5('0x4'))(_0x91f5('0x5'));var config=require('../../config/environment');var scripts=require(_0x91f5('0x6'));var FILES_PATH=_0x91f5('0x7');var recursiveMapAttributes=['rawHeaders',_0x91f5('0x8')];var verticesWithRetry=[_0x91f5('0x9'),_0x91f5('0xa'),_0x91f5('0xb')];var AGIVertices=function(_0x3475f1,_0x58ecab,_0x4f137a){this['channel']=_0x3475f1;this[_0x91f5('0xc')]=_0x58ecab;this[_0x91f5('0xd')]=_0x4f137a;};AGIVertices[_0x91f5('0xe')][_0x91f5('0xf')]=function(_0x72e0d3,_0x262c73){this[_0x91f5('0xc')][_0x91f5('0x10')](_0x72e0d3)[_0x91f5('0x11')](function(_0x53baa0){_0x262c73(null,_0x53baa0?_0x53baa0[_0x91f5('0x12')]:![]);})[_0x91f5('0x13')](function(_0x5a32d6){_0x262c73(_0x5a32d6);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x14')]=function(_0x1d6da9,_0x543810){this[_0x91f5('0xc')][_0x91f5('0x15')](_0x1d6da9)[_0x91f5('0x11')](function(_0x123022){_0x543810(null,_0x123022?_0x123022[_0x91f5('0x12')]:![]);})[_0x91f5('0x13')](function(_0x4bda9f){_0x543810(_0x4bda9f);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x16')]=function(_0x4792f5,_0x2b33ce){this[_0x91f5('0xc')][_0x91f5('0x17')](_0x4792f5)[_0x91f5('0x11')](function(_0x14274f){_0x2b33ce(null,_0x14274f?_0x14274f[_0x91f5('0x12')]:![]);})[_0x91f5('0x13')](function(_0x36a3e9){_0x2b33ce(_0x36a3e9);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x18')]=function(_0x3cfa4b,_0x68a35d){this[_0x91f5('0xc')]['getSquareOdbcById'](_0x3cfa4b)[_0x91f5('0x11')](function(_0x1221a6){_0x68a35d(null,_0x1221a6?_0x1221a6[_0x91f5('0x19')]:![]);})[_0x91f5('0x13')](function(_0x1f8856){_0x68a35d(_0x1f8856);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1a')]=function(_0x362714,_0x3bc893){this[_0x91f5('0xc')][_0x91f5('0x1b')](_0x362714)[_0x91f5('0x11')](function(_0x901b1c){_0x3bc893(null,_0x901b1c?_0x901b1c[_0x91f5('0x12')]:![]);})['catch'](function(_0x39a75b){_0x3bc893(_0x39a75b);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1c')]=function(_0x232b9a,_0x3d366b){this['rpc']['getTrunkById'](_0x232b9a)[_0x91f5('0x11')](function(_0x26f78a){_0x3d366b(null,_0x26f78a?_0x26f78a['name']:![]);})[_0x91f5('0x13')](function(_0x47b8be){_0x3d366b(_0x47b8be);});};AGIVertices['prototype'][_0x91f5('0x1d')]=function(_0x18a0ed,_0xaa3061){var _0xe29aec=this;this['rpc']['getSoundById'](_0x18a0ed)[_0x91f5('0x11')](function(_0x44305e){_0xaa3061(null,_0x44305e?_0xe29aec[_0x91f5('0x1e')](_0x44305e[_0x91f5('0x1f')]):![]);})['catch'](function(_0x28f708){_0xaa3061(_0x28f708);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x20')]=function(_0x4280df,_0x5ada78){this['rpc'][_0x91f5('0x21')](_0x4280df)[_0x91f5('0x11')](function(_0x419cbc){_0x5ada78(null,_0x419cbc?_0x419cbc:![]);})[_0x91f5('0x13')](function(_0x29c7cb){_0x5ada78(_0x29c7cb);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x22')]=function(_0x5badea,_0x299fd3,_0x4d566f){this['mailRpc']['sendMailMessage'](_0x5badea,_0x299fd3)[_0x91f5('0x11')](function(){_0x4d566f(null);})['catch'](function(_0x5e3c2a){_0x4d566f(_0x5e3c2a);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x23')]=function(_0x450403,_0x388be7){this[_0x91f5('0xc')]['getIntervalById'](_0x450403)[_0x91f5('0x11')](function(_0x569091){if(_0x569091){if(_0x569091[_0x91f5('0x24')]){_0x388be7(null,[_0x569091[_0x91f5('0x25')]]);}else{_0x388be7(null,_['map'](_0x569091[_0x91f5('0x26')],'interval'));}}else{_0x388be7(null,![]);}})['catch'](function(_0x2b651e){_0x388be7(_0x2b651e);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1e')]=function(_0x34c31f){return util[_0x91f5('0x27')](_0x91f5('0x28'),FILES_PATH,_0x34c31f);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x29')]=function(_0x4e39e6,_0x2a3ebf,_0x1dc747){odbc[_0x91f5('0x2a')](_0x4e39e6,function(_0x130d26){if(_0x130d26){logger['error'](_0x91f5('0x2b'),_0x130d26);_0x1dc747(_0x130d26);}else{logger[_0x91f5('0x2c')]('ODBC\x20connection\x20successfully');odbc[_0x91f5('0x2d')](_0x2a3ebf,function(_0x49d2ae,_0x5ca0cc){if(_0x49d2ae){logger[_0x91f5('0x2c')](_0x91f5('0x2e'),_0x2a3ebf);_0x1dc747(_0x49d2ae);}else{logger[_0x91f5('0x2c')](_0x91f5('0x2f'),_0x2a3ebf);odbc[_0x91f5('0x30')](function(_0x2e2e60){if(_0x2e2e60){logger[_0x91f5('0x31')](_0x91f5('0x32'),_0x2e2e60);}_0x1dc747(null,_0x5ca0cc);});}});}});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x33')]=function(_0xc62507,_0x3a6c95){this['rpc']['getSmsAccountById'](_0xc62507)['then'](function(_0x206a17){_0x3a6c95(null,_0x206a17?_0x206a17:![]);})['catch'](function(_0x5630ee){_0x3a6c95(_0x5630ee);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x34')]=function(_0x2be105,_0x3f3dad){this[_0x91f5('0xc')][_0x91f5('0x34')](_0x2be105)[_0x91f5('0x11')](function(_0x3f8432){_0x3f3dad(null,_0x3f8432);})[_0x91f5('0x13')](function(_0x49f472){_0x3f3dad(_0x49f472);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x35')]=function(_0x25010e,_0x48870e,_0x27bd38){this['rpc'][_0x91f5('0x35')]({'uniqueid':this[_0x91f5('0x36')][_0x91f5('0x37')],'node':_0x25010e[_0x91f5('0x38')],'application':_0x25010e[_0x91f5('0x39')],'data':_0x48870e||null,'project_name':this[_0x91f5('0x36')][_0x91f5('0x3a')],'callerid':this[_0x91f5('0x36')][_0x91f5('0x3b')]})[_0x91f5('0x11')](function(_0x4258f2){if(_0x27bd38){_0x27bd38(null,_0x4258f2);}})[_0x91f5('0x13')](function(_0x4c866e){if(_0x27bd38){_0x27bd38(_0x4c866e);}});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x3c')]=function(_0x2bddcd,_0x19b6ae,_0xf12cab,_0x33ff79){this[_0x91f5('0xc')]['createSquareRecording']({'uniqueid':this[_0x91f5('0x36')][_0x91f5('0x37')],'callerid':this[_0x91f5('0x36')][_0x91f5('0x3b')],'calleridname':this[_0x91f5('0x36')][_0x91f5('0x3d')],'context':this[_0x91f5('0x36')][_0x91f5('0x3e')],'extension':this[_0x91f5('0x36')][_0x91f5('0x3f')],'priority':this['channel'][_0x91f5('0x40')],'accountcode':this['channel'][_0x91f5('0x41')],'dnid':this[_0x91f5('0x36')]['dnid'],'projectName':this['channel'][_0x91f5('0x3a')],'saveName':_0x19b6ae,'filename':_0x2bddcd[_0x91f5('0x42')]||_0x19b6ae,'savePath':_0xf12cab})[_0x91f5('0x11')](function(_0x2399ee){_0x33ff79(null,_0x2399ee);})[_0x91f5('0x13')](function(_0x52dbc5){_0x33ff79(_0x52dbc5);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x43')]=function(_0x5e3630,_0x6f0619,_0x2dcbf9,_0x360bc1,_0x43b93d){this[_0x91f5('0xc')][_0x91f5('0x43')]({'uniqueid':this[_0x91f5('0x36')]['uniqueid'],'body':_0x5e3630,'direction':_0x6f0619,'providerName':_0x2dcbf9,'providerResponse':_0x360bc1})[_0x91f5('0x11')](function(_0x1a07c4){if(_0x43b93d){_0x43b93d(null,_0x1a07c4);}})['catch'](function(_0x413e98){if(_0x43b93d){_0x43b93d(_0x413e98);}});};AGIVertices[_0x91f5('0xe')]['createCmContact']=function(_0x2c4ee6,_0x579c29){this[_0x91f5('0xc')]['createCmContact']({'firstName':_[_0x91f5('0x44')](_0x2c4ee6[_0x91f5('0x12')])||_[_0x91f5('0x45')](_0x2c4ee6['name'])?_0x91f5('0x46')+Math['random']():_0x2c4ee6[_0x91f5('0x12')],'lastName':_[_0x91f5('0x44')](_0x2c4ee6['lastName'])||_['isNil'](_0x2c4ee6[_0x91f5('0x47')])?null:_0x2c4ee6[_0x91f5('0x47')],'phone':_0x2c4ee6[_0x91f5('0x48')],'ListId':_0x2c4ee6[_0x91f5('0x49')],'scheduledat':_0x2c4ee6[_0x91f5('0x4a')],'callbackUniqueid':this[_0x91f5('0x36')]['uniqueid'],'tags':'callback','description':_0x91f5('0x4b')+_0x2c4ee6[_0x91f5('0x4a')][_0x91f5('0x4c')](),'priority':_0x2c4ee6[_0x91f5('0x4d')]})[_0x91f5('0x11')](function(_0x51b898){_0x579c29(null,_0x51b898);})[_0x91f5('0x13')](function(_0x10cfc4){_0x579c29(_0x10cfc4);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x4e')]=function(_0x1927bf,_0x27b9c5){this[_0x91f5('0xc')]['getPauseById'](_0x1927bf)[_0x91f5('0x11')](function(_0x3fe638){_0x27b9c5(null,_0x3fe638?_0x3fe638['name']:![]);})[_0x91f5('0x13')](function(_0x8f56d3){_0x27b9c5(_0x8f56d3);});};AGIVertices['prototype'][_0x91f5('0x4f')]=function(_0x4aaf67,_0x242db9,_0x51cf36){var _0x30c3de={'role':'agent'};_0x30c3de[_0x4aaf67]=this[_0x91f5('0x36')]['callerid'];this['rpc'][_0x91f5('0x4f')](_0x30c3de,_0x242db9,this[_0x91f5('0x36')][_0x91f5('0x37')])['then'](function(_0x17f4a6){_0x51cf36(null,_[_0x91f5('0x45')](_0x17f4a6)?![]:!![]);})['catch'](function(_0x519f00){logger['error'](_0x519f00);_0x51cf36(null,![]);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x50')]=function(_0x25bc8d,_0x4df62c){var _0x5ce42d={'role':_0x91f5('0x51')};_0x5ce42d[_0x25bc8d]=this[_0x91f5('0x36')][_0x91f5('0x3b')];this[_0x91f5('0xc')][_0x91f5('0x50')](_0x5ce42d)['then'](function(_0x12ed2c){_0x4df62c(null,_[_0x91f5('0x45')](_0x12ed2c)?![]:!![]);})[_0x91f5('0x13')](function(_0x50135c){logger[_0x91f5('0x31')](_0x50135c);_0x4df62c(null,![]);});};AGIVertices[_0x91f5('0xe')]['agentLogout']=function(_0x5add85,_0x4cab56){var _0x1c59e8={'role':_0x91f5('0x51')};_0x1c59e8[_0x5add85]=this[_0x91f5('0x36')][_0x91f5('0x3b')];this['rpc'][_0x91f5('0x52')](_0x1c59e8)[_0x91f5('0x11')](function(_0x55c076){_0x4cab56(null,_[_0x91f5('0x45')](_0x55c076)?![]:!![]);})[_0x91f5('0x13')](function(_0xfdcb48){logger[_0x91f5('0x31')](_0xfdcb48);_0x4cab56(null,![]);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x53')]=function(_0x41d0bf,_0x3aaca5){var _0x160737={'role':_0x91f5('0x51')};_0x160737[_0x41d0bf]=this['channel'][_0x91f5('0x3b')];var _0x45c435=_0x41d0bf!=_0x91f5('0x54')?util[_0x91f5('0x27')]('%s/%s@from-sip/n',_0x91f5('0x55'),this['channel'][_0x91f5('0x3b')]):undefined;this['rpc'][_0x91f5('0x53')](_0x160737,_0x45c435)[_0x91f5('0x11')](function(_0x34b5da){_0x3aaca5(null,_[_0x91f5('0x45')](_0x34b5da)?![]:!![]);})[_0x91f5('0x13')](function(_0x74ed53){logger[_0x91f5('0x31')](_0x74ed53);_0x3aaca5(null,![]);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x56')]=function(_0x479273,_0x50d26a){sh[_0x91f5('0x57')](_[_0x91f5('0x58')](_0x479273),function(_0x5d268b,_0x188865){var _0xd2e224=_0x188865['replace'](/(\r\n|\n|\r)/gm,'');_0x50d26a(null,_0xd2e224);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x59')]=function(_0x53d48e,_0x5249ca){scripts[_0x91f5('0x59')](_0x53d48e['apiKey'],_0x53d48e[_0x91f5('0x5a')]||_0x91f5('0x5b'),_0x53d48e[_0x91f5('0x5b')],_0x53d48e[_0x91f5('0x5c')]||_0x91f5('0x5d'),_0x53d48e[_0x91f5('0x5e')]||_0x91f5('0x5f'),_0x53d48e[_0x91f5('0x60')]||'MP3')[_0x91f5('0x11')](function(_0x5b5b1e){_0x5249ca(null,_0x5b5b1e);})[_0x91f5('0x13')](function(_0x54d792){_0x5249ca(_0x54d792);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x61')]=function(_0x1d511a,_0x19e6e7){scripts[_0x91f5('0x61')](_0x1d511a[_0x91f5('0x5b')],_0x1d511a[_0x91f5('0x62')]||'en',0x1)[_0x91f5('0x11')](function(_0x43df9c){_0x19e6e7(null,_0x43df9c);})[_0x91f5('0x13')](function(_0x28a26e){_0x19e6e7(_0x28a26e);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x63')]=function(_0x35abf8,_0x2e821e){var _0x380b44={'uri':_0x35abf8[_0x91f5('0x64')],'method':_0x35abf8[_0x91f5('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x35abf8[_0x91f5('0x66')])==='number'&&parseInt(_0x35abf8[_0x91f5('0x66')])>=0x1?parseInt(_0x35abf8['timeout'])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x91f5('0x67')],_0x380b44[_0x91f5('0x65')][_0x91f5('0x68')]())){try{_0x380b44[_0x91f5('0x69')]=_0x35abf8[_0x91f5('0x8')]?JSON[_0x91f5('0x6a')](_0x35abf8[_0x91f5('0x8')]):{};}catch(_0x166715){logger[_0x91f5('0x31')](_0x91f5('0x6b'),_0x166715);}}try{_0x380b44[_0x91f5('0x6c')]=_0x35abf8[_0x91f5('0x6d')]?JSON[_0x91f5('0x6a')](_0x35abf8[_0x91f5('0x6d')]):{};}catch(_0x42ab25){logger[_0x91f5('0x31')](_0x91f5('0x6e'),_0x42ab25);}if(_0x35abf8[_0x91f5('0x6f')]){try{var _0x425d80=require(_0x35abf8[_0x91f5('0x6f')])[_0x91f5('0x70')](this,_0x380b44);_0x380b44[_0x91f5('0x71')]=Mustache[_0x91f5('0x72')](_0x35abf8['url'],_0x425d80,{},['$$','$$']);if(_0x380b44[_0x91f5('0x6c')]){_0x380b44[_0x91f5('0x6c')]=JSON[_0x91f5('0x6a')](Mustache[_0x91f5('0x72')](JSON['stringify'](_0x380b44[_0x91f5('0x6c')]),_0x425d80,{},['$$','$$']));}if(_0x380b44[_0x91f5('0x69')]){_0x380b44[_0x91f5('0x69')]=JSON[_0x91f5('0x6a')](Mustache[_0x91f5('0x72')](JSON[_0x91f5('0x73')](_0x380b44['body']),_0x425d80,{},['$$','$$']));}}catch(_0xa56d75){logger[_0x91f5('0x31')](_0x91f5('0x74'),_0xa56d75);}}rp(_0x380b44)['then'](function(_0x40d6dd){var _0x48389a={'statusCode':_0x40d6dd[_0x91f5('0x75')]||0xc8,'statusMessage':_0x40d6dd[_0x91f5('0x76')]||'OK','headers':_0x40d6dd[_0x91f5('0x6c')]||{},'body':_0x40d6dd[_0x91f5('0x69')]||{}};_0x2e821e(null,_0x48389a);})[_0x91f5('0x13')](function(_0xc35f95){var _0x989ef8={'statusCode':_0xc35f95[_0x91f5('0x75')]||0x1f4,'statusMessage':_0xc35f95[_0x91f5('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0xc35f95[_0x91f5('0x78')][_0x91f5('0x6c')]||{},'body':_0xc35f95[_0x91f5('0x78')][_0x91f5('0x69')]||{}};_0x2e821e(null,_0x989ef8);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x79')]=function(_0x4e239d,_0x1cf2a4){scripts['googleDialogflow'](this[_0x91f5('0x36')]['uniqueid'],_0x4e239d[_0x91f5('0x7a')],_0x4e239d['text'],_0x4e239d['dialogflow_language']||'en')[_0x91f5('0x11')](function(_0x23e256){_0x1cf2a4(null,_0x23e256);})[_0x91f5('0x13')](function(_0x5bfc47){_0x1cf2a4(_0x5bfc47);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x7b')]=function(_0x4635ef,_0x2e4ab9){scripts[_0x91f5('0x7b')](this[_0x91f5('0x36')]['uniqueid'],_0x4635ef[_0x91f5('0x7c')],_0x4635ef[_0x91f5('0x7d')],_0x4635ef[_0x91f5('0x7e')],_0x4635ef[_0x91f5('0x5b')],_0x4635ef[_0x91f5('0x7f')]||'en')[_0x91f5('0x11')](function(_0x17b3c6){_0x2e4ab9(null,_0x17b3c6);})['catch'](function(_0x2df5af){_0x2e4ab9(_0x2df5af);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x80')]=function(_0x22dddc,_0x11d0f4){scripts[_0x91f5('0x80')](this[_0x91f5('0x36')],_0x22dddc)[_0x91f5('0x11')](function(_0x10f3e3){_0x11d0f4(null,_0x10f3e3);})[_0x91f5('0x13')](function(_0x2686cd){_0x11d0f4(_0x2686cd);});};AGIVertices['prototype'][_0x91f5('0x81')]=function(_0x944f7,_0x45e85b){scripts['ispeechTTS'](_0x944f7[_0x91f5('0x7a')],_0x944f7['text'],_0x944f7[_0x91f5('0x82')]||'en-US',_0x944f7['speed'])[_0x91f5('0x11')](function(_0x3a71f9){_0x45e85b(null,_0x3a71f9);})[_0x91f5('0x13')](function(_0x177ba7){_0x45e85b(_0x177ba7);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x83')]=function(_0x34ad00,_0x5dd512,_0x2d89c8){scripts[_0x91f5('0x83')](_0x5dd512,_0x34ad00[_0x91f5('0x7a')],_0x34ad00['ispeech_asr_language']||_0x91f5('0x5d'),this['isConfigured'](_0x34ad00[_0x91f5('0x84')])?_0x34ad00[_0x91f5('0x84')]:undefined)[_0x91f5('0x11')](function(_0x13af73){_0x2d89c8(null,_0x13af73);})[_0x91f5('0x13')](function(_0x54cc91){_0x2d89c8(_0x54cc91);});};AGIVertices['prototype']['awsPolly']=function(_0x47060c,_0x4fc84a){scripts[_0x91f5('0x85')](_0x47060c[_0x91f5('0x86')],_0x47060c[_0x91f5('0x87')],_0x47060c[_0x91f5('0x88')],_0x47060c[_0x91f5('0x89')]||'Amy',_0x47060c[_0x91f5('0x5b')],_0x47060c[_0x91f5('0x8a')]||'text')[_0x91f5('0x11')](function(_0x3acfd4){_0x4fc84a(null,_0x3acfd4);})[_0x91f5('0x13')](function(_0x1e94af){_0x4fc84a(_0x1e94af);});};AGIVertices['prototype'][_0x91f5('0x8b')]=function(_0x48909c,_0x5d6921){scripts[_0x91f5('0x8b')](this['channel'][_0x91f5('0x37')],_0x48909c[_0x91f5('0x86')],_0x48909c[_0x91f5('0x87')],_0x48909c['aws_lex_region'],_0x48909c[_0x91f5('0x5b')],_0x48909c[_0x91f5('0x8c')])[_0x91f5('0x11')](function(_0x139e8c){_0x5d6921(null,_0x139e8c);})[_0x91f5('0x13')](function(_0x1c0282){_0x5d6921(_0x1c0282);});};AGIVertices[_0x91f5('0xe')][_0x91f5('0x8d')]=function(_0x3feaf2,_0x143d44,_0xa2702f){scripts['googleASR'](_0x143d44,_0x3feaf2[_0x91f5('0x7a')],_0x3feaf2[_0x91f5('0x8e')]||'en-US')[_0x91f5('0x11')](function(_0x5be7ed){_0xa2702f(null,_0x5be7ed);})[_0x91f5('0x13')](function(_0x5e4b43){_0xa2702f(_0x5e4b43);});};AGIVertices['prototype']['tildeASR']=function(_0xb7f93f,_0x1ee455,_0x1b1e0f){scripts['tildeASR'](_0x1ee455,_0xb7f93f[_0x91f5('0x8f')],_0xb7f93f[_0x91f5('0x90')],_0xb7f93f[_0x91f5('0x71')])[_0x91f5('0x11')](function(_0x2bf2a8){_0x1b1e0f(null,_0x2bf2a8);})[_0x91f5('0x13')](function(_0x1c5fb5){_0x1b1e0f(_0x1c5fb5);});};AGIVertices['prototype']['clear']=function(_0x1c3bdf){var _0x299f20=_[_0x91f5('0x91')](verticesWithRetry,_0x1c3bdf[_0x91f5('0x39')])?_0x1c3bdf:_[_0x91f5('0x92')](_0x1c3bdf);for(var _0x1bad32 in _0x299f20){if(_0x299f20[_0x91f5('0x93')](_0x1bad32)){if(_0x299f20[_0x1bad32]&&_[_0x91f5('0x94')](_0x299f20[_0x1bad32])){if(_[_0x91f5('0x91')](recursiveMapAttributes,_0x1bad32)){_0x299f20[_0x1bad32]=this[_0x91f5('0x95')](_0x299f20[_0x1bad32]);}else{_0x299f20[_0x1bad32]=this['replaceAllVariables'](_0x299f20[_0x1bad32]);}}}}return _0x299f20;};AGIVertices[_0x91f5('0xe')][_0x91f5('0x96')]=function(_0x3730b4){for(var _0x3128d1 in _0x3730b4){if(_0x3730b4[_0x91f5('0x93')](_0x3128d1)){if(_[_0x91f5('0x97')](_0x3730b4[_0x3128d1])){this[_0x91f5('0x96')](_0x3730b4[_0x3128d1]);}else if(_[_0x91f5('0x98')](_0x3730b4[_0x3128d1])){for(var _0x163be1=0x0;_0x163be1<_0x3730b4[_0x3128d1][_0x91f5('0x99')];_0x163be1++){this[_0x91f5('0x96')](_0x3730b4[_0x3128d1][_0x163be1]);}}else if(_[_0x91f5('0x94')](_0x3730b4[_0x3128d1])){_0x3730b4[_0x3128d1]=this['replaceAllVariables'](_0x3730b4[_0x3128d1]);}}}};AGIVertices['prototype'][_0x91f5('0x9a')]=function(_0x1ff4ad,_0x37587a){for(var _0x3bd20e in _0x1ff4ad){if(_0x1ff4ad['hasOwnProperty'](_0x3bd20e)){if(_['isPlainObject'](_0x1ff4ad[_0x3bd20e])){if(!_[_0x91f5('0x44')](_0x1ff4ad[_0x3bd20e])){this[_0x91f5('0x9a')](_0x1ff4ad[_0x3bd20e],util[_0x91f5('0x27')](_0x91f5('0x9b'),_0x37587a,_0x3bd20e));}}else if(_['isArray'](_0x1ff4ad[_0x3bd20e])){for(var _0x72fe0b=0x0;_0x72fe0b<_0x1ff4ad[_0x3bd20e][_0x91f5('0x99')];_0x72fe0b++){this[_0x91f5('0x9a')](_0x1ff4ad[_0x3bd20e][_0x72fe0b],util[_0x91f5('0x27')](_0x91f5('0x9b'),_0x37587a,_0x3bd20e+'['+_0x72fe0b+']'));}}else{if(!_['isNil'](_0x1ff4ad[_0x3bd20e])){this[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')](_0x91f5('0x9b'),_0x37587a,_0x3bd20e),_0x1ff4ad[_0x3bd20e]);}}}}};AGIVertices[_0x91f5('0xe')][_0x91f5('0x95')]=function(_0x3f563e){try{var _0x4cdec4=JSON[_0x91f5('0x6a')](_0x3f563e);this[_0x91f5('0x96')](_0x4cdec4);return JSON[_0x91f5('0x73')](_0x4cdec4);}catch(_0x3557c5){return this[_0x91f5('0x9d')](_0x3f563e);}};AGIVertices[_0x91f5('0xe')]['replaceAllVariables']=function(_0x4c6f26){var _0x283296=_0x4c6f26[_0x91f5('0x9e')]('{');for(var _0x2f841a=0x1;_0x2f841a<_0x283296[_0x91f5('0x99')];_0x2f841a+=0x1){var _0x3386e5=_0x283296[_0x2f841a][_0x91f5('0x9e')]('}');if(_0x3386e5[_0x91f5('0x99')]>0x1){_0x4c6f26=_0x4c6f26[_0x91f5('0x9f')]('{'+_0x3386e5[0x0]+'}',this[_0x91f5('0x36')]['getVariable'](_0x3386e5[0x0])[_0x91f5('0xa0')]||_0x3386e5[0x0]);}}if(_0x283296[_0x91f5('0x99')]===0x1){return _0x4c6f26['toString']();}return this[_0x91f5('0x9d')](_0x4c6f26);};AGIVertices[_0x91f5('0xe')][_0x91f5('0xa1')]=function(_0xa9f88,_0x216697){var _0x2843f8=this[_0x91f5('0x36')][_0x91f5('0xf')](_0xa9f88);if(_0x2843f8['result']===-0x1){return _0x2843f8;}logger['info'](util[_0x91f5('0x27')](_0x91f5('0xa2'),_0x216697,_0x2843f8[_0x91f5('0xa0')]));return this[_0x91f5('0x36')][_0x91f5('0x9c')](_0x216697,_0x2843f8[_0x91f5('0xa0')]);};AGIVertices['prototype'][_0x91f5('0xa3')]=function(_0x280504){return _0x280504&&_0x280504!=='0'&&_0x280504!=='-1'&&_0x280504!=='';};AGIVertices[_0x91f5('0xe')][_0x91f5('0xa4')]=function(_0x1e8958){this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x1e8958,'-');_0x1e8958[_0x91f5('0xa5')]=_0x1e8958['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x91f5('0xa6')]=function(_0x5267e0){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xa7'),_0x5267e0[_0x91f5('0x38')]));if(!this['isConfigured'](_0x5267e0[_0x91f5('0x5b')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xa9'));}var _0x2b9324='\x22'+_0x5267e0[_0x91f5('0x5b')]+'\x22';if(this[_0x91f5('0xa3')](_0x5267e0[_0x91f5('0x78')])){_0x2b9324+=','+_0x5267e0[_0x91f5('0x78')];}var _0x24b02d=this[_0x91f5('0x36')]['exec'](_0x91f5('0xaa'),_0x2b9324);if(_0x24b02d[_0x91f5('0xab')]===-0x1){return _0x24b02d;}return this[_0x91f5('0x36')]['noop'](util[_0x91f5('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2b9324));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xac')]=function(_0x42af49){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xad'),_0x42af49[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x42af49[_0x91f5('0xae')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xaf'));}var _0x50e721=_0x42af49[_0x91f5('0xae')];if(this[_0x91f5('0xa3')](_0x42af49[_0x91f5('0x78')])){_0x50e721+=','+_0x42af49['options'];}var _0x34fe69=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x91f5('0xb0'),_0x50e721);if(_0x34fe69['result']===-0x1){return _0x34fe69;}var _0x2b41eb=this[_0x91f5('0xa1')](_0x91f5('0xb1'),_0x91f5('0xb2'));if(_0x2b41eb[_0x91f5('0xab')]===-0x1){return _0x2b41eb;}var _0x287c33=this[_0x91f5('0xa1')](_0x91f5('0xb3'),_0x91f5('0xb4'));if(_0x287c33[_0x91f5('0xab')]===-0x1){return _0x287c33;}var _0x232902=this['getAndSetVariable'](_0x91f5('0xb5'),_0x91f5('0xb6'));if(_0x232902[_0x91f5('0xab')]===-0x1){return _0x232902;}return this[_0x91f5('0x36')]['noop'](util['format'](_0x91f5('0xb7'),_0x50e721));};AGIVertices[_0x91f5('0xe')]['agi']=function(_0x3d04b0){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xb8'),_0x3d04b0[_0x91f5('0x38')]));return this[_0x91f5('0x36')][_0x91f5('0x5')]([_0x3d04b0[_0x91f5('0xb9')],_0x3d04b0[_0x91f5('0xba')]]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0xbb')]=function(_0x17729b){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xbc'),_0x17729b[_0x91f5('0x38')]));if(this[_0x91f5('0xa3')](_0x17729b['timeout'])){logger[_0x91f5('0x2c')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x17729b[_0x91f5('0x66')]));var _0x457e09=this[_0x91f5('0x36')][_0x91f5('0xbd')](_0x17729b[_0x91f5('0x66')]);if(_0x457e09[_0x91f5('0xab')]===-0x1){return _0x457e09;}}return this[_0x91f5('0x36')][_0x91f5('0xbb')]();};AGIVertices['prototype'][_0x91f5('0xbe')]=function(_0x202d03){logger['info'](util[_0x91f5('0x27')](_0x91f5('0xbf'),_0x202d03[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x202d03['list_id'])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x202d03,_0x91f5('0xc0'));}_0x202d03[_0x91f5('0x4a')]=moment();if(this[_0x91f5('0xa3')](_0x202d03[_0x91f5('0xc1')])){_0x202d03[_0x91f5('0x4a')]=moment()[_0x91f5('0xc2')](_0x202d03[_0x91f5('0xc1')],_0x91f5('0xc3'));}if(!this[_0x91f5('0xa3')](_0x202d03[_0x91f5('0x4d')])){_0x202d03[_0x91f5('0x4d')]=0x2;}this[_0x91f5('0xc4')][_0x91f5('0x70')](this,_0x202d03);return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xc5'),_0x202d03[_0x91f5('0x48')],_0x202d03[_0x91f5('0x49')],_0x202d03[_0x91f5('0x4a')]));};AGIVertices['prototype'][_0x91f5('0xc6')]=function(_0x21894a){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xc7'),_0x21894a[_0x91f5('0x38')]));var _0x4e5956=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x21894a['application'],_0x21894a[_0x91f5('0x78')]);if(_0x4e5956[_0x91f5('0xab')]===-0x1){return _0x4e5956;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0xc8'),_0x21894a[_0x91f5('0xc9')],_0x21894a['options']));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xca')]=function(_0x4d889b){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0xcb'),_0x4d889b['label']));if(!this[_0x91f5('0xa3')](_0x4d889b['text'])){return this[_0x91f5('0x36')]['noop']('no\x20text\x20configured');}var _0x270c2e='\x22'+_0x4d889b[_0x91f5('0x5b')]+'\x22';if(this[_0x91f5('0xa3')](_0x4d889b[_0x91f5('0x78')])){_0x270c2e+=','+_0x4d889b[_0x91f5('0x78')];}var _0x1db19b=this[_0x91f5('0x36')]['exec']('MRCPSynth',_0x270c2e);if(_0x1db19b['result']===-0x1){return _0x1db19b;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xcc'),_0x270c2e));};AGIVertices['prototype'][_0x91f5('0xcd')]=function(_0x3f453f){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3f453f['label']));if(!this[_0x91f5('0xa3')](_0x3f453f[_0x91f5('0x5b')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xa9'));}var _0x1cf0e7='\x22'+_0x3f453f[_0x91f5('0x5b')]+'\x22';if(this['isConfigured'](_0x3f453f[_0x91f5('0x78')])){_0x1cf0e7+=','+_0x3f453f[_0x91f5('0x78')];}var _0x4c3874=this['channel'][_0x91f5('0x57')](_0x91f5('0xaa'),_0x1cf0e7);if(_0x4c3874[_0x91f5('0xab')]===-0x1){return _0x4c3874;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0xcc'),_0x1cf0e7));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xce')]=function(_0x464965){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0xcf'),_0x464965[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x464965['grammar'])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20grammar\x20configured');}var _0x5c6386=_0x464965[_0x91f5('0xae')];if(this[_0x91f5('0xa3')](_0x464965[_0x91f5('0x78')])){_0x5c6386+=','+_0x464965[_0x91f5('0x78')];}var _0x4c623a=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x91f5('0xb0'),_0x5c6386);if(_0x4c623a['result']===-0x1){return _0x4c623a;}var _0x5a0be1=this[_0x91f5('0xa1')](_0x91f5('0xb1'),_0x91f5('0xd0'));if(_0x5a0be1['result']===-0x1){return _0x5a0be1;}var _0x26706b=this[_0x91f5('0xa1')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x26706b[_0x91f5('0xab')]===-0x1){return _0x26706b;}var _0x38fa9a=this[_0x91f5('0xa1')](_0x91f5('0xb5'),_0x91f5('0xd1'));if(_0x38fa9a[_0x91f5('0xab')]===-0x1){return _0x38fa9a;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xb7'),_0x5c6386));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xd2')]=function(_0x571a9c){logger['info'](util[_0x91f5('0x27')](_0x91f5('0xd3'),_0x571a9c[_0x91f5('0x38')]));if(!this['isConfigured'](_0x571a9c[_0x91f5('0xae')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xaf'));}var _0x166dcd=_0x571a9c[_0x91f5('0xae')];if(this[_0x91f5('0xa3')](_0x571a9c['options'])){_0x166dcd+=','+_0x571a9c['options'];}var _0x4f2edb=this['channel'][_0x91f5('0x57')](_0x91f5('0xb0'),_0x166dcd);if(_0x4f2edb['result']===-0x1){return _0x4f2edb;}var _0x5b9778=this[_0x91f5('0xa1')]('RECOG_CONFIDENCE()',_0x91f5('0xd4'));if(_0x5b9778[_0x91f5('0xab')]===-0x1){return _0x5b9778;}var _0x77ddd2=this['getAndSetVariable']('RECOG_INPUT()',_0x91f5('0xd5'));if(_0x77ddd2[_0x91f5('0xab')]===-0x1){return _0x77ddd2;}var _0x4f9f85=this[_0x91f5('0xa1')](_0x91f5('0xb5'),_0x91f5('0xd6'));if(_0x4f9f85[_0x91f5('0xab')]===-0x1){return _0x4f9f85;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x166dcd));};AGIVertices['prototype']['database']=function(_0x4a10e5){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0xd7'),_0x4a10e5[_0x91f5('0x38')]));if(!this['isConfigured'](_0x4a10e5[_0x91f5('0xd8')])){return this['channel'][_0x91f5('0x31')](_0x4a10e5,_0x91f5('0xd9'));}var _0x270ed9=this['getSquareOdbc'][_0x91f5('0x70')](this,_0x4a10e5[_0x91f5('0xd8')]);if(!_0x270ed9){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x4a10e5,_0x91f5('0xda'));}if(!this[_0x91f5('0xa3')](_0x4a10e5['query'])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x4a10e5,_0x91f5('0xdb'));}var _0x2e44e1=_0x4a10e5[_0x91f5('0x2d')][_0x91f5('0xdc')](/(\r\n|\n|\r)/gm,'\x20');this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xdd'),_0x2e44e1));var _0x192a9d=this[_0x91f5('0x29')][_0x91f5('0x70')](this,_0x270ed9,_0x2e44e1);this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x4a10e5,_0x2e44e1);if(!this[_0x91f5('0xa3')](_0x4a10e5['variable_id'])){return this['channel'][_0x91f5('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x462ac0=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x4a10e5['variable_id']);if(!_0x462ac0){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x4a10e5,_0x91f5('0xde'));}var _0x59e9b9=this;_0x192a9d[_0x91f5('0xdf')](function(_0x14046d,_0xdbb33b){Object['keys'](_0x14046d)[_0x91f5('0xdf')](function(_0x3080bc){_0x59e9b9[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')]('%s[%s][%s]',_0x462ac0,_0xdbb33b,_0x3080bc),_0x14046d[_0x3080bc]);});});this['channel'][_0x91f5('0x9c')](util[_0x91f5('0x27')](_0x91f5('0xe0'),_0x462ac0),_0x192a9d['length']);return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format']('variable\x20%s\x20set',_0x462ac0));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xe1')]=function(_0xabf1b6){logger['debug'](util[_0x91f5('0x27')](_0x91f5('0xe2'),_0xabf1b6[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0xabf1b6[_0x91f5('0xe3')])){return this[_0x91f5('0x36')]['error'](_0xabf1b6,_0x91f5('0xe4'));}var _0x426462=this[_0x91f5('0x1a')][_0x91f5('0x70')](this,_0xabf1b6['sip_id']);if(!_0x426462){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0xabf1b6,_0x91f5('0xe5'));}var _0x24af6a=this[_0x91f5('0x36')]['exec']('DIAL',[util['format'](_0x91f5('0xe6'),_0x426462),_0xabf1b6['timeout'],_0xabf1b6[_0x91f5('0xe7')],_0xabf1b6[_0x91f5('0x64')]]);if(_0x24af6a[_0x91f5('0xab')]===-0x1){return _0x24af6a;}return this[_0x91f5('0x36')]['noop'](util['format'](_0x91f5('0xe8'),_0x91f5('0xe9')));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xea')]=function(_0x5c31c9){logger['info'](util[_0x91f5('0x27')](_0x91f5('0xeb'),_0x5c31c9[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x5c31c9['key'])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xec'));}if(!this[_0x91f5('0xa3')](_0x5c31c9[_0x91f5('0x5b')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xa9'));}this[_0x91f5('0x36')][_0x91f5('0xed')]=!![];this[_0x91f5('0x35')](_0x5c31c9);this['createSquareMessage'](_0x5c31c9[_0x91f5('0x5b')],'in','','');this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xee'),_0x5c31c9[_0x91f5('0x5b')]));var _0x36be5c=this[_0x91f5('0x79')][_0x91f5('0x70')](this,_0x5c31c9);if(_0x36be5c){for(var _0x1bc5d2 in _0x36be5c){if(_0x36be5c[_0x91f5('0x93')](_0x1bc5d2)){this[_0x91f5('0x36')]['setVariable'](util['format'](_0x91f5('0xef'),_0x1bc5d2[_0x91f5('0x68')]()),_0x36be5c[_0x1bc5d2]);}}this[_0x91f5('0x43')](_0x36be5c['speech'],_0x91f5('0xf0'),_0x91f5('0xea'),'');return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xf1'),_0x36be5c['speech']));}return this['channel'][_0x91f5('0x31')](_0x5c31c9,_0x91f5('0xf2'));};AGIVertices[_0x91f5('0xe')]['dialogflowV2']=function(_0x2e9ae3){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2e9ae3[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x2e9ae3[_0x91f5('0x7c')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x2e9ae3['client_email'])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xf3'));}if(!this[_0x91f5('0xa3')](_0x2e9ae3[_0x91f5('0x7e')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xf4'));}if(!this[_0x91f5('0xa3')](_0x2e9ae3[_0x91f5('0x7f')])){return this['channel'][_0x91f5('0xa8')]('no\x20anguage\x20configured');}if(!this[_0x91f5('0xa3')](_0x2e9ae3[_0x91f5('0x5b')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xa9'));}this['channel'][_0x91f5('0xed')]=!![];this[_0x91f5('0x35')](_0x2e9ae3);this[_0x91f5('0x43')](_0x2e9ae3['text'],'in','','');this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xf5'),_0x2e9ae3['text']));var _0x238f30=this[_0x91f5('0x7b')][_0x91f5('0x70')](this,_0x2e9ae3);if(_0x238f30){for(var _0x2954f8 in _0x238f30){if(_0x238f30[_0x91f5('0x93')](_0x2954f8)){if(_0x2954f8!=='providerResponse'){this[_0x91f5('0x36')]['setVariable'](util['format'](_0x91f5('0xef'),_0x2954f8[_0x91f5('0x68')]()),_0x238f30[_0x2954f8]);}}}this['createSquareMessage'](_0x238f30[_0x91f5('0xf6')],_0x91f5('0xf0'),_0x91f5('0xf7'),_0x238f30[_0x91f5('0xf8')]);return this['channel']['noop'](util['format'](_0x91f5('0xf9'),_0x238f30[_0x91f5('0xf6')]));}return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x2e9ae3,_0x91f5('0xfa'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xfb')]=function(_0x524911){logger['info'](util[_0x91f5('0x27')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x524911[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x524911[_0x91f5('0xfc')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xfd'));}if(!this['isConfigured'](_0x524911[_0x91f5('0xfe')])){return this['channel'][_0x91f5('0xa8')]('no\x20username\x20configured');}if(!this[_0x91f5('0xa3')](_0x524911['password'])){return this['channel']['noop'](_0x91f5('0xff'));}if(!this['isConfigured'](_0x524911[_0x91f5('0x100')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20text\x20configured');}this['channel'][_0x91f5('0xed')]=!![];this['createSquareDetailsReport'](_0x524911);this[_0x91f5('0x43')](_0x524911[_0x91f5('0x5b')],'in','','');this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x101'),_0x524911[_0x91f5('0x5b')]));var _0x2efcfd=this[_0x91f5('0x80')][_0x91f5('0x70')](this,_0x524911);if(_0x2efcfd){for(var _0x85ff42 in _0x2efcfd){if(_0x2efcfd[_0x91f5('0x93')](_0x85ff42)){this[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')](_0x91f5('0x102'),_0x85ff42[_0x91f5('0x68')]()),_0x2efcfd[_0x85ff42]);}}this['createSquareMessage'](_0x2efcfd[_0x91f5('0xf6')],_0x91f5('0xf0'),_0x91f5('0xfb'),'');if(_0x2efcfd[_0x91f5('0x103')]){this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0x104'),_0x2efcfd[_0x91f5('0x103')]));var _0x535543=this['channel'][_0x91f5('0x105')](_0x2efcfd[_0x91f5('0x103')]);try{fs[_0x91f5('0x106')](_0x2efcfd[_0x91f5('0x103')]+_0x91f5('0x107'));}catch(_0x175810){logger[_0x91f5('0x31')](_0x175810);}return _0x535543;}else{return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x108'),_0x2efcfd[_0x91f5('0xf6')]));}}return this[_0x91f5('0x36')]['error'](_0x524911,_0x91f5('0x109'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x10a')]=function(_0x2cae59){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20END\x20(%s)\x20block',_0x2cae59[_0x91f5('0x38')]));return this[_0x91f5('0x36')]['noop'](_0x91f5('0x10a'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x10b')]=function(_0x305fe6){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x10c'),_0x305fe6['label']));var _0x1df724='';if(_0x305fe6['trunk_id']){if(!this[_0x91f5('0xa3')](_0x305fe6['trunk_id'])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x305fe6,_0x91f5('0x10d'));}else{var _0x264483=parseInt(_0x305fe6[_0x91f5('0x10e')],0xa);if(isNaN(_0x264483)){_0x1df724=_0x305fe6[_0x91f5('0x10e')];}else{_0x1df724=this['getTrunk']['sync'](this,_0x305fe6[_0x91f5('0x10e')]);if(!_0x1df724){return this['channel'][_0x91f5('0x31')](_0x305fe6,_0x91f5('0x10f'));}}}}else if(_0x305fe6[_0x91f5('0x110')]){_0x1df724=_0x305fe6[_0x91f5('0x110')];}else{return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x305fe6,_0x91f5('0x10d'));}var _0x237288=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x91f5('0xe9'),[util['format']('SIP/%s/%s',_0x1df724,_0x305fe6[_0x91f5('0x48')]),_0x305fe6[_0x91f5('0x66')],_0x305fe6[_0x91f5('0xe7')],_0x305fe6[_0x91f5('0x64')]]);if(_0x237288['result']===-0x1){return _0x237288;}return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xe8'),'DIAL'));};AGIVertices['prototype'][_0x91f5('0x111')]=function(_0x218f5c){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x218f5c[_0x91f5('0x38')]));return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x111'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0xa')]=function(_0x283849){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x112'),_0x283849['label']));if(_0x283849[_0x91f5('0xa5')]===0x0){return this['maxRetry'](_0x283849);}_0x283849[_0x91f5('0xa5')]-=0x1;if(!this[_0x91f5('0xa3')](_0x283849[_0x91f5('0x113')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x283849,_0x91f5('0x114'));}var _0x9e0335=this[_0x91f5('0x1d')][_0x91f5('0x70')](this,_0x283849[_0x91f5('0x113')]);if(!_0x9e0335){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x283849,_0x91f5('0x115'));}if(!this['isConfigured'](_0x283849[_0x91f5('0x116')])){return this['channel'][_0x91f5('0x31')](_0x91f5('0x117'));}var _0x592a2e=this[_0x91f5('0x36')][_0x91f5('0x118')](_0x9e0335,_0x283849[_0x91f5('0x119')],_0x283849['maxdigit']);var _0x2d162d=_0x592a2e['result']?_0x592a2e[_0x91f5('0xab')][_0x91f5('0x4c')]():'';logger['info']('test',JSON[_0x91f5('0x73')](_0x592a2e));if(_0x592a2e[_0x91f5('0xab')]===-0x1){this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x283849,_0x2d162d);return _0x592a2e;}else if(_0x592a2e[_0x91f5('0xa0')]===_0x91f5('0x66')){_0x592a2e[_0x91f5('0xab')]=_0x2d162d[_0x91f5('0x99')]>=parseInt(_0x283849[_0x91f5('0x11a')])?'x':'i';}else{_0x592a2e[_0x91f5('0xab')]=_0x2d162d['length']>=parseInt(_0x283849[_0x91f5('0x11a')])&&_0x2d162d['length']<=parseInt(_0x283849[_0x91f5('0x11b')])?'x':'i';}var _0x41bfa9=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x283849['variable_id']);if(!_0x41bfa9){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x283849,'no\x20variable\x20found');}this[_0x91f5('0x36')]['setVariable'](_0x41bfa9,_0x2d162d);if(this['isConfigured'](_0x283849[_0x91f5('0x11c')])){var _0x994ce1=parseInt(_0x283849['hiddendigitsnum'],0xa);var _0x22340b=rs[_0x91f5('0x11d')]({'charset':'*','length':_0x994ce1});var _0x1b7939=_0x2d162d[_0x91f5('0x99')];if(_0x1b7939>0x0){if(_0x1b7939>_0x994ce1){this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x283849,_0x283849[_0x91f5('0x11e')]===_0x91f5('0x11f')?_0x22340b+_0x2d162d[_0x91f5('0x120')](_0x994ce1):_0x2d162d[_0x91f5('0x120')](0x0,_0x1b7939-_0x994ce1)+_0x22340b);}else{this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x283849,rs['generate']({'charset':'*','length':_0x1b7939}));}}else{this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x283849,'');}}else{this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x283849,_0x2d162d);}return _0x592a2e;};AGIVertices[_0x91f5('0xe')][_0x91f5('0xb')]=function(_0x43f66d){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x121'),_0x43f66d[_0x91f5('0x38')]));return this[_0x91f5('0xa')](_0x43f66d);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x122')]=function(_0x1e4316){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x123'),_0x1e4316[_0x91f5('0x38')]));this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x1e4316,_0x1e4316[_0x91f5('0x124')]);return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0x125'),_0x1e4316[_0x91f5('0x124')]));};AGIVertices['prototype'][_0x91f5('0x126')]=function(_0x55cc75){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x127'),_0x55cc75[_0x91f5('0x38')]));if(!this['isConfigured'](_0x55cc75[_0x91f5('0x86')])||!this[_0x91f5('0xa3')](_0x55cc75[_0x91f5('0x87')])){return this['channel']['noop'](_0x91f5('0x128'));}if(!this[_0x91f5('0xa3')](_0x55cc75[_0x91f5('0x5b')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xa9'));}this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x129'),_0x55cc75[_0x91f5('0x5b')]));var _0x44edf7=this[_0x91f5('0x85')][_0x91f5('0x70')](this,_0x55cc75);if(_0x44edf7){this['channel']['noop'](util[_0x91f5('0x27')](_0x91f5('0x12a'),_0x44edf7));var _0x43b793=this['channel'][_0x91f5('0x105')](_0x44edf7);try{fs['unlink'](_0x44edf7+_0x91f5('0x107'));}catch(_0x79753a){logger[_0x91f5('0x31')](_0x79753a);}return _0x43b793;}return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x55cc75,_0x91f5('0x12b'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x12c')]=function(_0x11665a){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x12d'),_0x11665a[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x11665a[_0x91f5('0x86')])||!this[_0x91f5('0xa3')](_0x11665a['aws_secret_access_key'])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x11665a[_0x91f5('0x8c')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20bot\x20name\x20configured');}if(!this[_0x91f5('0xa3')](_0x11665a[_0x91f5('0x5b')])){return this[_0x91f5('0x36')]['noop'](_0x91f5('0xa9'));}this[_0x91f5('0x36')][_0x91f5('0xed')]=!![];this['createSquareDetailsReport'](_0x11665a);this[_0x91f5('0x43')](_0x11665a[_0x91f5('0x5b')],'in','','');this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x11665a[_0x91f5('0x5b')]));var _0x1c0b1d=this[_0x91f5('0x8b')][_0x91f5('0x70')](this,_0x11665a);if(_0x1c0b1d){for(var _0x19206c in _0x1c0b1d){if(_0x1c0b1d[_0x91f5('0x93')](_0x19206c)&&_[_0x91f5('0x94')](_0x1c0b1d[_0x19206c])){this[_0x91f5('0x36')]['setVariable'](util[_0x91f5('0x27')]('AWS_LEX_%s',_0x19206c[_0x91f5('0x68')]()),_0x1c0b1d[_0x19206c]);}}if(_[_0x91f5('0x45')](_0x1c0b1d[_0x91f5('0x77')])){return this[_0x91f5('0x36')]['noop'](_0x91f5('0x12e'));}else{this[_0x91f5('0x43')](_0x1c0b1d[_0x91f5('0x77')],_0x91f5('0xf0'),_0x91f5('0x12f'),'');return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x130'),_0x1c0b1d[_0x91f5('0x77')]));}}return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x11665a,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x91f5('0xe')]['googleasr']=function(_0x4e63e9){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x131'),_0x4e63e9[_0x91f5('0x38')],_0x4e63e9[_0x91f5('0x66')]));if(!this[_0x91f5('0xa3')](_0x4e63e9[_0x91f5('0x7a')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0xec'));}var _0x5c210b=_0x91f5('0x132');var _0x23f85f=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x91f5('0x11d')](0x4));var _0x3024aa=util[_0x91f5('0x27')](_0x91f5('0x9b'),_0x23f85f,_0x5c210b);var _0x24dbae=!![];if(_0x4e63e9[_0x91f5('0x133')]===_0x91f5('0x134')){_0x24dbae=![];}var _0x31a72c=this[_0x91f5('0x36')][_0x91f5('0x135')](_0x23f85f,_0x5c210b,_0x4e63e9[_0x91f5('0x136')],_0x4e63e9[_0x91f5('0x66')],undefined,_0x24dbae);if(_0x31a72c[_0x91f5('0xab')]!==-0x1){this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0x137'),_0x3024aa));var _0x1d1a89=this[_0x91f5('0x8d')][_0x91f5('0x70')](this,_0x4e63e9,_0x3024aa);if(_0x1d1a89){for(var _0x129155 in _0x1d1a89){if(_0x1d1a89[_0x91f5('0x93')](_0x129155)){this[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')]('GOOGLE_ASR_%s',_0x129155['toUpperCase']()),_0x1d1a89[_0x129155]);}}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x138'),JSON[_0x91f5('0x73')](_0x1d1a89)));}}return _0x31a72c;};AGIVertices[_0x91f5('0xe')][_0x91f5('0x139')]=function(_0x189a59){logger['info'](util[_0x91f5('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x189a59[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x189a59[_0x91f5('0x8f')])){return this[_0x91f5('0x36')]['noop']('no\x20appid\x20configured');}if(!this[_0x91f5('0xa3')](_0x189a59[_0x91f5('0x90')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x13a'));}var _0xaf649d=_0x91f5('0x132');var _0x38037e=util[_0x91f5('0x27')](_0x91f5('0x13b'),FILES_PATH,rs['generate'](0x4));var _0x235902=util[_0x91f5('0x27')](_0x91f5('0x9b'),_0x38037e,_0xaf649d);var _0x53c4ab=!![];if(_0x189a59[_0x91f5('0x133')]===_0x91f5('0x134')){_0x53c4ab=![];}var _0x12dd88=this['channel'][_0x91f5('0x135')](_0x38037e,_0xaf649d,_0x189a59['intKey'],_0x189a59[_0x91f5('0x66')],undefined,_0x53c4ab);if(_0x12dd88['result']!==-0x1){this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x13c'),_0x235902));var _0x1a3a77=this['tildeASR']['sync'](this,_0x189a59,_0x235902);if(_0x1a3a77){for(var _0x4468d1 in _0x1a3a77){if(_0x1a3a77[_0x91f5('0x93')](_0x4468d1)){this['channel'][_0x91f5('0x9c')](util[_0x91f5('0x27')](_0x91f5('0x13d'),_0x4468d1[_0x91f5('0x68')]()),_0x1a3a77[_0x4468d1]);}}return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x13e'),JSON[_0x91f5('0x73')](_0x1a3a77)));}}return _0x12dd88;};AGIVertices['prototype']['gotoc']=function(_0x3aee6a){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x13f'),_0x3aee6a[_0x91f5('0x38')]));return this['channel'][_0x91f5('0x140')](_0x3aee6a['context'],_0x3aee6a[_0x91f5('0x3f')],_0x3aee6a[_0x91f5('0x40')]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x141')]=function(_0x1f82c4){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x142'),_0x1f82c4[_0x91f5('0x38')]));if(!this['isConfigured'](_0x1f82c4['condition'])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x1f82c4,_0x91f5('0x143'));}try{var _0x428efc=eval(_0x1f82c4[_0x91f5('0x144')])?_0x91f5('0x145'):_0x91f5('0x146');this['channel']['noop'](util[_0x91f5('0x27')](_0x91f5('0x147'),_0x1f82c4[_0x91f5('0x144')],_0x428efc));return{'code':0xc8,'result':_0x428efc};}catch(_0x1f8294){return{'code':0xc8,'result':_0x91f5('0x146')};}};AGIVertices[_0x91f5('0xe')][_0x91f5('0x148')]=function(_0x473e2d){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x473e2d[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x473e2d[_0x91f5('0x149')])){return this[_0x91f5('0x36')]['error'](_0x473e2d,_0x91f5('0x14a'));}var _0x397464=this[_0x91f5('0x23')]['sync'](this,_0x473e2d[_0x91f5('0x149')]);if(!_0x397464){return this['channel'][_0x91f5('0x31')](_0x473e2d,_0x91f5('0x14b'));}for(var _0x3119b9=0x0;_0x3119b9<_0x397464['length'];_0x3119b9+=0x1){var _0x29860b=this[_0x91f5('0x36')][_0x91f5('0xf')](util[_0x91f5('0x27')](_0x91f5('0x14c'),_0x397464[_0x3119b9]));if(_0x29860b['result']===-0x1){return _0x29860b;}logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('IFTIME\x20%s\x20%s',_0x397464[_0x3119b9],_0x29860b[_0x91f5('0xa0')]));if(_0x29860b[_0x91f5('0xa0')]==='true'){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x14d'),_0x397464[_0x3119b9],_0x91f5('0x145')));this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x14d'),_0x397464[_0x3119b9],_0x91f5('0x145')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x91f5('0x27')](_0x91f5('0x14d'),_0x397464[_0x3119b9],_0x91f5('0x146')));this[_0x91f5('0x36')]['noop'](util['format'](_0x91f5('0x14d'),_0x397464[_0x3119b9],_0x91f5('0x146')));}}return{'code':0xc8,'result':_0x91f5('0x146')};};AGIVertices[_0x91f5('0xe')][_0x91f5('0x14e')]=function(_0x2da800){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2da800[_0x91f5('0x38')]));return this[_0x91f5('0x36')]['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x5e97d8){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x14f'),_0x5e97d8[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x5e97d8[_0x91f5('0x7a')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xec'));}var _0x4fcd87=_0x91f5('0x132');var _0x474127=util[_0x91f5('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x91f5('0x11d')](0x4));var _0x114dce=util[_0x91f5('0x27')]('%s.%s',_0x474127,_0x4fcd87);var _0x48c964=!![];if(_0x5e97d8[_0x91f5('0x133')]===_0x91f5('0x134')){_0x48c964=![];}var _0x31ae58=this['channel'][_0x91f5('0x135')](_0x474127,_0x4fcd87,_0x5e97d8[_0x91f5('0x136')],_0x5e97d8[_0x91f5('0x66')],undefined,_0x48c964);if(_0x31ae58[_0x91f5('0xab')]!==-0x1){this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x150'),_0x114dce));var _0x30696c=this[_0x91f5('0x83')][_0x91f5('0x70')](this,_0x5e97d8,_0x114dce);if(_0x30696c){for(var _0x5c24ba in _0x30696c){if(_0x30696c['hasOwnProperty'](_0x5c24ba)){this[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')]('ISPEECH_ASR_%s',_0x5c24ba[_0x91f5('0x68')]()),_0x30696c[_0x5c24ba]);}}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x91f5('0x73')](_0x30696c)));}}return _0x31ae58;};AGIVertices[_0x91f5('0xe')][_0x91f5('0x151')]=function(_0x432506){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x152'),_0x432506[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x432506['key'])){return this[_0x91f5('0x36')][_0x91f5('0xa8')]('no\x20key\x20configured');}if(!this[_0x91f5('0xa3')](_0x432506[_0x91f5('0x5b')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xa9'));}this[_0x91f5('0x36')]['noop'](util[_0x91f5('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0x432506['text']));var _0x4b3308=this[_0x91f5('0x81')][_0x91f5('0x70')](this,_0x432506);if(_0x4b3308){this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x150'),_0x4b3308));var _0x1dacf6=this['channel'][_0x91f5('0x105')](_0x4b3308,_0x432506[_0x91f5('0x136')]);try{fs[_0x91f5('0x106')](_0x4b3308+_0x91f5('0x107'));}catch(_0x3ae7da){logger[_0x91f5('0x31')](_0x3ae7da);}return _0x1dacf6;}return this[_0x91f5('0x36')]['error'](_0x432506,_0x91f5('0x153'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x154')]=function(_0x2c27b8){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x155'),_0x2c27b8[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x2c27b8[_0x91f5('0x156')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x2c27b8,_0x91f5('0x157'));}logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x158'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x2c27b8[_0x91f5('0x156')]));var _0x5d5631=this[_0x91f5('0x53')][_0x91f5('0x70')](this,_0x2c27b8[_0x91f5('0x156')]);if(_0x5d5631){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x2c27b8[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x91f5('0x36')]['callerid'],_0x2c27b8[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x159')};}else{logger['info'](util[_0x91f5('0x27')](_0x91f5('0x15a'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x2c27b8[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15a'),this['channel'][_0x91f5('0x3b')],_0x2c27b8[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x15b')};}};AGIVertices[_0x91f5('0xe')][_0x91f5('0x15c')]=function(_0x100cf7){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x15d'),_0x100cf7[_0x91f5('0x38')]));if(!this['isConfigured'](_0x100cf7[_0x91f5('0x156')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x100cf7,_0x91f5('0x157'));}logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x158'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x100cf7[_0x91f5('0x156')]));var _0x461753=this[_0x91f5('0x52')][_0x91f5('0x70')](this,_0x100cf7[_0x91f5('0x156')]);if(_0x461753){logger['info'](util['format'](_0x91f5('0x15e'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x100cf7[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15e'),this['channel'][_0x91f5('0x3b')],_0x100cf7[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x159')};}else{logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x91f5('0x36')]['callerid'],_0x100cf7[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15a'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x100cf7['findBy']));return{'code':0xc8,'result':_0x91f5('0x15b')};}};AGIVertices[_0x91f5('0xe')][_0x91f5('0x15f')]=function(_0x2263f4){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x160'),_0x2263f4[_0x91f5('0x38')]));if(!this['isConfigured'](_0x2263f4[_0x91f5('0x161')])){return this[_0x91f5('0x36')]['error'](_0x2263f4,_0x91f5('0x162'));}this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0x163'),_0x2263f4[_0x91f5('0x161')]));var _0x5cc35c=eval(_0x2263f4['operation']);if(!this[_0x91f5('0xa3')](_0x2263f4[_0x91f5('0x116')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x117'));}var _0x4b7fc8=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x2263f4[_0x91f5('0x116')]);if(!_0x4b7fc8){return this['channel'][_0x91f5('0x31')](_0x2263f4,_0x91f5('0xde'));}if(_[_0x91f5('0x98')](_0x5cc35c)){var _0x230a34=this;_0x5cc35c[_0x91f5('0xdf')](function(_0xeea696,_0x3a7f3c){_0x230a34[_0x91f5('0x36')][_0x91f5('0x9c')](util[_0x91f5('0x27')](_0x91f5('0x164'),_0x4b7fc8,_0x3a7f3c),_0xeea696);});return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format']('variable\x20%s[key]\x20set',_0x4b7fc8));}else{return this[_0x91f5('0x36')][_0x91f5('0x9c')](_0x4b7fc8,_0x5cc35c);}};AGIVertices['prototype'][_0x91f5('0x9')]=function(_0x4132b5){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x165'),_0x4132b5[_0x91f5('0x38')]));if(_0x4132b5['retry']===0x0){return this[_0x91f5('0xa4')](_0x4132b5);}_0x4132b5[_0x91f5('0xa5')]-=0x1;if(!this[_0x91f5('0xa3')](_0x4132b5['file_id'])){return this['channel']['error'](_0x4132b5,_0x91f5('0x114'));}var _0x1f4baf=this['getSound']['sync'](this,_0x4132b5[_0x91f5('0x113')]);if(!_0x1f4baf){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x4132b5,_0x91f5('0x115'));}var _0x59f41c=this[_0x91f5('0x36')]['getData'](_0x1f4baf,_0x4132b5[_0x91f5('0x119')],_0x4132b5[_0x91f5('0x166')]);var _0xa61095=_0x59f41c[_0x91f5('0xab')];if(_0x59f41c[_0x91f5('0xab')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x4132b5,'-1');return _0x59f41c;}else if(_0x59f41c['extra']==='timeout'){_0x59f41c[_0x91f5('0xab')]=_0x59f41c[_0x91f5('0xab')][_0x91f5('0x99')]>0x0?_0x59f41c['result']:'t';}else if(_[_0x91f5('0x44')](_0x59f41c[_0x91f5('0xab')])){_0x59f41c[_0x91f5('0xab')]='#';_0xa61095='#';}if(!this[_0x91f5('0xa3')](_0x4132b5[_0x91f5('0x116')])){this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x117'));}else{var _0x2f68c0=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x4132b5[_0x91f5('0x116')]);if(!_0x2f68c0){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x4132b5,_0x91f5('0xde'));}this[_0x91f5('0x36')][_0x91f5('0x9c')](_0x2f68c0,_0xa61095);}this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x4132b5,_0xa61095);return _0x59f41c;};AGIVertices[_0x91f5('0xe')][_0x91f5('0xa8')]=function(_0x59d353){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x59d353[_0x91f5('0x38')]));return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x59d353['output']||_0x59d353[_0x91f5('0x38')]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x167')]=function(_0x2b3f66){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x168'),_0x2b3f66[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x2b3f66[_0x91f5('0x156')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x2b3f66,_0x91f5('0x157'));}logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x158'),this[_0x91f5('0x36')]['callerid'],_0x2b3f66['findBy']));var _0x33bdd1=this['getPause'][_0x91f5('0x70')](this,_0x2b3f66[_0x91f5('0x169')]);var _0x8d69b1=this['agentPause'][_0x91f5('0x70')](this,_0x2b3f66[_0x91f5('0x156')],_0x33bdd1);if(_0x8d69b1){logger['info'](util['format'](_0x91f5('0x15e'),this[_0x91f5('0x36')]['callerid'],_0x2b3f66[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x2b3f66[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x159')};}else{logger['info'](util[_0x91f5('0x27')](_0x91f5('0x15a'),this['channel'][_0x91f5('0x3b')],_0x2b3f66[_0x91f5('0x156')]));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15e'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0x2b3f66[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x15b')};}};AGIVertices['prototype'][_0x91f5('0x16a')]=function(_0x55422b){logger['info'](util[_0x91f5('0x27')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x55422b[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x55422b[_0x91f5('0x113')])){return this['channel'][_0x91f5('0x31')](_0x55422b,_0x91f5('0x114'));}var _0x3879f9=this[_0x91f5('0x1d')]['sync'](this,_0x55422b['file_id']);if(!_0x3879f9){return this['channel']['error'](_0x55422b,_0x91f5('0x115'));}var _0x4a5e79=this[_0x91f5('0x36')][_0x91f5('0x57')]('PLAYBACK',[_0x3879f9,_0x55422b[_0x91f5('0xe7')]]);if(_0x4a5e79[_0x91f5('0xab')]===-0x1){return _0x4a5e79;}return this[_0x91f5('0x36')]['noop'](util['format'](_0x91f5('0xc8'),_0x91f5('0x16b'),_0x3879f9));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x16c')]=function(_0x2c9888){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x16d'),_0x2c9888[_0x91f5('0x38')]));if(!this['isConfigured'](_0x2c9888[_0x91f5('0x16e')])){return this[_0x91f5('0x36')]['error'](_0x2c9888,_0x91f5('0x16f'));}var _0x441718='';var _0x4e472e=parseInt(_0x2c9888[_0x91f5('0x16e')],0xa);if(isNaN(_0x4e472e)){_0x441718=_0x2c9888[_0x91f5('0x16e')];}else{_0x441718=this[_0x91f5('0x14')][_0x91f5('0x70')](this,_0x2c9888[_0x91f5('0x16e')]);if(!_0x441718){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x2c9888,_0x91f5('0x170'));}}var _0x1d3509='';if(this['isConfigured'](_0x2c9888[_0x91f5('0x113')])){var _0x1a1506=this['getSound'][_0x91f5('0x70')](this,_0x2c9888[_0x91f5('0x113')]);if(_0x1a1506){_0x1d3509=_0x1a1506;}}this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x2c9888,_0x441718);if(_0x2c9888[_0x91f5('0xe7')]['indexOf']('x')<0x0){_0x2c9888[_0x91f5('0xe7')]+='x';}if(_0x2c9888[_0x91f5('0xe7')][_0x91f5('0x171')]('X')<0x0){_0x2c9888[_0x91f5('0xe7')]+='X';}this[_0x91f5('0x36')]['setVariable'](_0x91f5('0x172'),_0x441718?_0x441718[_0x91f5('0x173')]():'');var _0x48e135=this['channel']['exec']('QUEUE',[_0x441718,_0x2c9888[_0x91f5('0xe7')],_0x2c9888['url'],_0x1d3509,_0x2c9888['timeout'],_0x2c9888[_0x91f5('0x5')],_0x2c9888[_0x91f5('0x174')],_0x2c9888[_0x91f5('0x175')],'',_0x2c9888[_0x91f5('0x176')]]);if(_0x48e135[_0x91f5('0xab')]===-0x1){return _0x48e135;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util['format'](_0x91f5('0xc8'),_0x91f5('0x177'),_0x441718));};AGIVertices[_0x91f5('0xe')]['record']=function(_0x3552a5){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x178'),_0x3552a5[_0x91f5('0x38')]));var _0x1eea79=_0x3552a5[_0x91f5('0x179')]||_0x91f5('0x132');var _0x5931af=util[_0x91f5('0x27')](_0x91f5('0x17a'),this['channel']['uniqueid'],rs[_0x91f5('0x11d')](0x5));var _0x14cc62=util[_0x91f5('0x27')](_0x91f5('0x17b'),FILES_PATH,_0x5931af,_0x1eea79);var _0x1c846c=util[_0x91f5('0x27')]('%s/recordings/%s',FILES_PATH,_0x5931af);this[_0x91f5('0x3c')][_0x91f5('0x70')](this,_0x3552a5,_0x5931af,_0x14cc62);this[_0x91f5('0x36')][_0x91f5('0x9c')]('RECORDING_SAVENAME',_0x5931af);logger[_0x91f5('0x2c')](_0x91f5('0x17c'),_0x1c846c,_0x1eea79,_0x3552a5[_0x91f5('0x17d')],_0x3552a5[_0x91f5('0x66')]);return this[_0x91f5('0x36')]['recordFile'](_0x1c846c,_0x1eea79,_0x3552a5[_0x91f5('0x17d')],_0x3552a5[_0x91f5('0x66')],undefined,!![]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x17e')]=function(_0x4cf623){logger[_0x91f5('0x2c')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x4cf623[_0x91f5('0x38')]));if(!this['isConfigured'](_0x4cf623[_0x91f5('0x64')])){return this['channel'][_0x91f5('0xa8')]('no\x20url\x20configured');}var _0x1312a3=this['restAPI'][_0x91f5('0x70')](this,_0x4cf623);logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Response:',util[_0x91f5('0x17f')](_0x1312a3,{'showHidden':![],'depth':null})));if(!this[_0x91f5('0xa3')](_0x4cf623[_0x91f5('0x116')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x180'));}var _0x1b759f=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x4cf623[_0x91f5('0x116')]);if(!_0x1b759f){return this[_0x91f5('0x36')]['error'](_0x4cf623,_0x91f5('0xde'));}this['channel'][_0x91f5('0x9c')](util['format'](_0x91f5('0x181'),_0x1b759f),_0x1312a3[_0x91f5('0x75')]?_0x1312a3[_0x91f5('0x75')]:_0x91f5('0x182'));this[_0x91f5('0x36')][_0x91f5('0x9c')](util['format'](_0x91f5('0x183'),_0x1b759f),_0x1312a3[_0x91f5('0x76')]?_0x1312a3[_0x91f5('0x76')]:'OK');if(_0x1312a3[_0x91f5('0x69')]){try{this[_0x91f5('0x9a')](_0x1312a3['body'],_0x1b759f);}catch(_0x5c3e0e){logger[_0x91f5('0x31')](util[_0x91f5('0x27')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1b759f));}}return this[_0x91f5('0x36')]['noop'](util[_0x91f5('0x27')](_0x91f5('0x184'),_0x1b759f));};AGIVertices['prototype'][_0x91f5('0x185')]=function(_0x187e57){logger['info'](util[_0x91f5('0x27')](_0x91f5('0x186'),_0x187e57[_0x91f5('0x38')]));return this[_0x91f5('0x36')]['sayDigits'](_0x187e57['digits']['replace'](/\s+/g,''),_0x187e57[_0x91f5('0x17d')]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x187')]=function(_0x4e8b70){logger[_0x91f5('0x2c')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4e8b70['label']));return this[_0x91f5('0x36')]['sayNumber'](_0x4e8b70[_0x91f5('0x188')]['replace'](/\s+/g,''),_0x4e8b70[_0x91f5('0x17d')]);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x189')]=function(_0x48914f){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x48914f[_0x91f5('0x38')]));return this[_0x91f5('0x36')][_0x91f5('0x18a')](_0x48914f[_0x91f5('0x5b')],_0x48914f['escape_digits']);};AGIVertices[_0x91f5('0xe')]['sendMail']=function(_0x3dc942){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x18b'),_0x3dc942[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x3dc942[_0x91f5('0x18c')])){return this[_0x91f5('0x36')]['noop']('no\x20mail\x20account\x20configured');}var _0x527ecb=this[_0x91f5('0x20')][_0x91f5('0x70')](this,_0x3dc942['account_id']);if(!_0x527ecb||!_0x527ecb[_0x91f5('0x18d')]){return this['channel'][_0x91f5('0x31')](_0x3dc942,_0x91f5('0x18e'));}var _0x26f23c={'from':util[_0x91f5('0x27')](_0x91f5('0x18f'),_0x527ecb[_0x91f5('0x12')],_0x527ecb[_0x91f5('0x190')]||_0x527ecb[_0x91f5('0x18d')][_0x91f5('0x191')]),'to':_0x3dc942['to']||'','cc':_0x3dc942['cc']||'','bcc':_0x3dc942[_0x91f5('0x192')]||'','subject':_0x3dc942[_0x91f5('0x193')],'html':_0x3dc942[_0x91f5('0x5b')],'text':_0x3dc942[_0x91f5('0x5b')]};var _0x1c2603={'tls':{'rejectUnauthorized':![]}};if(_0x527ecb['Smtp'][_0x91f5('0x194')]){_0x1c2603[_0x91f5('0x194')]=_0x527ecb[_0x91f5('0x18d')][_0x91f5('0x194')];}else{_0x1c2603[_0x91f5('0x195')]=_0x527ecb[_0x91f5('0x18d')][_0x91f5('0x195')];_0x1c2603[_0x91f5('0x196')]=_0x527ecb[_0x91f5('0x18d')][_0x91f5('0x196')];_0x1c2603[_0x91f5('0x197')]=_0x527ecb['Smtp']['secure'];}if(_0x527ecb[_0x91f5('0x18d')][_0x91f5('0x198')]){_0x1c2603[_0x91f5('0x199')]={'user':_0x527ecb['Smtp'][_0x91f5('0x191')],'pass':_0x527ecb['Smtp'][_0x91f5('0x19a')]};}if(this[_0x91f5('0xa3')](_0x3dc942[_0x91f5('0x19b')])){}logger[_0x91f5('0x19c')](_0x91f5('0x19d'),JSON[_0x91f5('0x73')](_0x26f23c));this['createSquareDetailsReport'][_0x91f5('0x70')](this,_0x3dc942,_0x3dc942['account_id']);this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x19e'),_0x527ecb[_0x91f5('0x12')]));this[_0x91f5('0x22')][_0x91f5('0x70')](this,_0x1c2603,_0x26f23c);return this[_0x91f5('0x36')][_0x91f5('0xa8')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x91f5('0xe')][_0x91f5('0x19f')]=function(_0x41ecf0){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1a0'),_0x41ecf0[_0x91f5('0x38')]));return this[_0x91f5('0x36')][_0x91f5('0xa8')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x91f5('0xe')]['sendSMS']=function(_0x49e27f){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1a1'),_0x49e27f['label']));if(!this[_0x91f5('0xa3')](_0x49e27f[_0x91f5('0x1a2')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0x1a3'));}var _0x5ed31f=this[_0x91f5('0x33')][_0x91f5('0x70')](this,_0x49e27f[_0x91f5('0x1a2')]);if(!_0x5ed31f){return this['channel'][_0x91f5('0x31')](_0x49e27f,_0x91f5('0x1a4'));}var _0x124691={'body':_0x49e27f[_0x91f5('0x1a5')],'phone':_0x49e27f['to']||'','SmsAccountId':_0x5ed31f['id']};logger[_0x91f5('0x19c')]('sendSMS\x20message',JSON[_0x91f5('0x73')](_0x124691));this['createSquareDetailsReport'][_0x91f5('0x70')](this,_0x49e27f,_0x49e27f[_0x91f5('0x1a2')]);this[_0x91f5('0x36')]['noop'](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5ed31f['name']));this[_0x91f5('0x34')][_0x91f5('0x70')](this,_0x124691);return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0x1a6'));};AGIVertices['prototype'][_0x91f5('0x1a7')]=function(_0x233af0){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x233af0[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x233af0[_0x91f5('0x116')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x233af0,_0x91f5('0x1a8'));}var _0x3d29f0=this['getVariable']['sync'](this,_0x233af0[_0x91f5('0x116')]);if(!_0x3d29f0){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x233af0,_0x91f5('0xde'));}return this[_0x91f5('0x36')][_0x91f5('0x9c')](_0x3d29f0,_0x233af0['variable_value']);};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1a9')]=function(_0x53e7ff){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1aa'),_0x53e7ff[_0x91f5('0x38')]));this[_0x91f5('0x36')]['noop']('START\x20CALLY\x20SQUARE');if(_0x53e7ff[_0x91f5('0xbb')]===_0x91f5('0x1ab')){this['channel']['noop'](_0x91f5('0x1ac'));return this[_0x91f5('0x36')][_0x91f5('0xbb')]();}return this['channel']['noop'](_0x91f5('0x1ad'));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1ae')]=function(_0x212499){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x212499[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x212499[_0x91f5('0x1af')])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x212499,_0x91f5('0x1b0'));}var _0x438169=this[_0x91f5('0x16')][_0x91f5('0x70')](this,_0x212499[_0x91f5('0x1af')]);if(!this['isConfigured'](_0x438169)){return this['channel'][_0x91f5('0x31')](_0x212499,util[_0x91f5('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x212499[_0x91f5('0x1af')]));}if(_0x438169===this[_0x91f5('0x36')][_0x91f5('0x3a')]){return this['channel'][_0x91f5('0x31')](_0x212499,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x212499,_0x438169);var _0x11238b=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x91f5('0x1b1'),util[_0x91f5('0x27')](_0x91f5('0x1b2'),config[_0x91f5('0x5')][_0x91f5('0x195')]||_0x91f5('0x1b3'),_0x438169,this['channel'][_0x91f5('0x3a')]));if(_0x11238b[_0x91f5('0xab')]===-0x1){return _0x11238b;}return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xc8'),_0x91f5('0x1b1'),_0x438169));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1b4')]=function(_0x21a757){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1b5'),_0x21a757[_0x91f5('0x38')]));var _0x4c5ef6=this['shellCommand'][_0x91f5('0x70')](this,_0x21a757['command']);this[_0x91f5('0x35')][_0x91f5('0x70')](this,_0x21a757,_0x21a757[_0x91f5('0xb9')]);if(this['isConfigured'](_0x21a757[_0x91f5('0x116')])){var _0xd3ebd=this['getVariable'][_0x91f5('0x70')](this,_0x21a757[_0x91f5('0x116')]);if(_0xd3ebd){this[_0x91f5('0x36')]['setVariable'](_0xd3ebd,_0x4c5ef6);return this['channel'][_0x91f5('0xa8')](util[_0x91f5('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x21a757[_0x91f5('0xb9')],_0xd3ebd));}}return this[_0x91f5('0x36')]['noop'](util[_0x91f5('0x27')](_0x91f5('0x1b6'),_0x21a757[_0x91f5('0xb9')]));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1b7')]=function(_0x50db69){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1b8'),_0x50db69[_0x91f5('0x38')]));_0x50db69[_0x91f5('0x5b')]=_0x50db69[_0x91f5('0x5b')][_0x91f5('0xdc')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x91f5('0xa3')](_0x50db69[_0x91f5('0x1b9')])){return this['channel'][_0x91f5('0xa8')](_0x91f5('0x1ba'));}if(!this[_0x91f5('0xa3')](_0x50db69[_0x91f5('0x5b')])){return this[_0x91f5('0x36')]['noop'](_0x91f5('0xa9'));}this['channel'][_0x91f5('0xa8')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x50db69[_0x91f5('0x5b')]));var _0xadfad3=this[_0x91f5('0x59')][_0x91f5('0x70')](this,_0x50db69);if(_0xadfad3){this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x1bb'),_0xadfad3));var _0xc9e5d2=this['channel'][_0x91f5('0x105')](_0xadfad3);try{fs['unlink'](_0xadfad3+_0x91f5('0x107'));}catch(_0x2a41b6){logger[_0x91f5('0x31')](_0x2a41b6);}return _0xc9e5d2;}return this['channel'][_0x91f5('0x31')](_0x50db69,_0x91f5('0x1bc'));};AGIVertices[_0x91f5('0xe')]['tts']=function(_0x1a832a){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1bd'),_0x1a832a[_0x91f5('0x38')]));_0x1a832a[_0x91f5('0x5b')]=_0x1a832a['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x91f5('0xa3')](_0x1a832a[_0x91f5('0x5b')])){return this[_0x91f5('0x36')][_0x91f5('0xa8')](_0x91f5('0xa9'));}this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x1be'),_0x1a832a[_0x91f5('0x5b')]));var _0x1477a5=this[_0x91f5('0x61')][_0x91f5('0x70')](this,_0x1a832a);if(_0x1477a5){this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x1bf'),_0x1477a5));var _0x1f2ea7=this[_0x91f5('0x36')][_0x91f5('0x105')](_0x1477a5);try{fs['unlink'](_0x1477a5+_0x91f5('0x107'));}catch(_0x4e70b8){logger[_0x91f5('0x31')](_0x4e70b8);}return _0x1f2ea7;}return this[_0x91f5('0x36')][_0x91f5('0x31')](_0x1a832a,_0x91f5('0x1c0'));};AGIVertices[_0x91f5('0xe')]['unpause']=function(_0xbf873a){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1c1'),_0xbf873a[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0xbf873a['findBy'])){return this[_0x91f5('0x36')][_0x91f5('0x31')](_0xbf873a,_0x91f5('0x157'));}logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x158'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0xbf873a[_0x91f5('0x156')]));var _0x209707=this[_0x91f5('0x50')][_0x91f5('0x70')](this,_0xbf873a['findBy']);if(_0x209707){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x91f5('0x36')][_0x91f5('0x3b')],_0xbf873a['findBy']));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15e'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0xbf873a[_0x91f5('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x15a'),this['channel'][_0x91f5('0x3b')],_0xbf873a['findBy']));this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0x15a'),this[_0x91f5('0x36')][_0x91f5('0x3b')],_0xbf873a[_0x91f5('0x156')]));return{'code':0xc8,'result':_0x91f5('0x15b')};}};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1c2')]=function(_0xf6d119){logger[_0x91f5('0x2c')](util[_0x91f5('0x27')](_0x91f5('0x1c3'),_0xf6d119['label']));var _0x2e4bcd=this[_0x91f5('0x36')][_0x91f5('0x57')](_0x91f5('0x1c4'),[_0xf6d119[_0x91f5('0x1c5')],_0xf6d119[_0x91f5('0x78')]]);if(_0x2e4bcd[_0x91f5('0xab')]===-0x1){return _0x2e4bcd;}return this[_0x91f5('0x36')][_0x91f5('0xa8')](util[_0x91f5('0x27')](_0x91f5('0xc8'),_0x91f5('0x1c4'),_0xf6d119[_0x91f5('0x1c5')]));};AGIVertices[_0x91f5('0xe')][_0x91f5('0x1c6')]=function(_0x58a950){logger[_0x91f5('0x2c')](util['format'](_0x91f5('0x1c7'),_0x58a950[_0x91f5('0x38')]));if(!this[_0x91f5('0xa3')](_0x58a950[_0x91f5('0x116')])){return this['channel'][_0x91f5('0x31')](_0x58a950,_0x91f5('0x1a8'));}var _0xa55d49=this[_0x91f5('0xf')][_0x91f5('0x70')](this,_0x58a950['variable_id']);if(!_0xa55d49){return this['channel']['error'](_0x58a950,_0x91f5('0xde'));}var _0x1bf651=this[_0x91f5('0x36')]['getVariable'](_0xa55d49);return{'code':0xc8,'result':_0x1bf651['extra']?_0x1bf651[_0x91f5('0xa0')]:'-'};};String[_0x91f5('0xe')][_0x91f5('0x9f')]=function(_0x2fc5dc,_0x5d8f5f){return this[_0x91f5('0x9e')](_0x2fc5dc)['join'](_0x5d8f5f);};module[_0x91f5('0x1c8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index dd57a66..f781b4c 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 _0x4123=['destlinkedid','savePause','acwTimeout','stopAcw','lastPauseAt','format','uniqueid','updateAcw','timer','update','catch','[%s][UPDATE][ERRORS:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','channels','attended'];(function(_0x54bed5,_0x2eaf23){var _0x243d37=function(_0x4c3723){while(--_0x4c3723){_0x54bed5['push'](_0x54bed5['shift']());}};_0x243d37(++_0x2eaf23);}(_0x4123,0x1e4));var _0x3412=function(_0x56ef1e,_0x3226f2){_0x56ef1e=_0x56ef1e-0x0;var _0x19e171=_0x4123[_0x56ef1e];return _0x19e171;};'use strict';var util=require(_0x3412('0x0'));var _=require('lodash');var moment=require(_0x3412('0x1'));var ami=require(_0x3412('0x2'));var logger=require('../../../config/logger')(_0x3412('0x3'));var RpcUser=require(_0x3412('0x4'));var RpcVoiceAgentReport=require(_0x3412('0x5'));function Acw(_0x5c7bab){this[_0x3412('0x6')]=_0x5c7bab['voiceQueues'];this[_0x3412('0x7')]=_0x5c7bab[_0x3412('0x7')];this['timers']=_0x5c7bab[_0x3412('0x8')];this['channels']={};ami['on'](_0x3412('0x9'),this[_0x3412('0xa')]['bind'](this));ami['on'](_0x3412('0xb'),this[_0x3412('0xc')][_0x3412('0xd')](this));ami['on'](_0x3412('0xe'),this[_0x3412('0xf')][_0x3412('0xd')](this));ami['on']('agentringnoanswer',this[_0x3412('0x10')][_0x3412('0xd')](this));ami['on'](_0x3412('0x11'),this['syncAttendedTransfer'][_0x3412('0xd')](this));ami['on'](_0x3412('0x12'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x3412('0x13'),this[_0x3412('0x14')][_0x3412('0xd')](this));}function getDiff(_0x6e2b2e){var _0x8dd6dd=moment()[_0x3412('0x15')](0x0);var _0x3ffb50=moment(_0x6e2b2e)[_0x3412('0x15')](0x0);return _0x8dd6dd[_0x3412('0x16')](_0x3ffb50,_0x3412('0x17'));}Acw[_0x3412('0x18')][_0x3412('0x19')]=function(_0x43d188){try{var _0x20219f=this;var _0x3a8dc9=this['channels'][_0x43d188]['interface'];var _0x581250=this['channels'][_0x43d188][_0x3412('0x1a')];var _0xa305ef=this['voiceQueues'][_0x581250];var _0x4a7bc8=![];var _0x2dc110='ACW';if(_0xa305ef['mandatoryDisposition']){if(_0xa305ef[_0x3412('0x1b')]['name']){_0x4a7bc8=!![];_0x2dc110=_0xa305ef[_0x3412('0x1b')][_0x3412('0x1c')];}}ami[_0x3412('0x1d')]({'action':_0x3412('0x1e'),'interface':_0x3a8dc9,'paused':!![],'reason':_0x2dc110})[_0x3412('0x1f')](function(_0x499562){if(_0x20219f[_0x3412('0x7')][_0x3a8dc9]){return RpcUser[_0x3412('0x20')](_0x20219f[_0x3412('0x7')][_0x3a8dc9]['id'])[_0x3412('0x1f')](function(_0xc31d00){if(_0xc31d00&&!_0xc31d00[_0x3412('0x21')]){logger[_0x3412('0x22')](_0x3412('0x23'),_0x43d188,_0x3a8dc9,_0x581250);var _0x8c045c=_0x20219f[_0x3412('0x24')][_0x43d188][_0x3412('0x25')]&&_0x20219f['channels'][_0x43d188][_0x3412('0x26')]?_0x20219f[_0x3412('0x24')][_0x43d188][_0x3412('0x26')]:_0x43d188;return RpcUser[_0x3412('0x27')](_0x20219f[_0x3412('0x7')][_0x3a8dc9],_0x2dc110,_0x8c045c)[_0x3412('0x1f')](function(_0x341f2d){if(!_0x4a7bc8){_0x20219f['timers'][_0x3a8dc9]={};logger[_0x3412('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x43d188,_0x20219f[_0x3412('0x6')][_0x581250][_0x3412('0x28')],_0x3a8dc9,_0x581250);_0x20219f[_0x3412('0x8')][_0x3a8dc9]['timer']=setTimeout(_0x20219f[_0x3412('0x29')][_0x3412('0xd')](_0x20219f,_0x3a8dc9),_0x20219f[_0x3412('0x6')][_0x581250][_0x3412('0x28')]*0x3e8);_0x20219f[_0x3412('0x8')][_0x3a8dc9][_0x3412('0x2a')]=moment()[_0x3412('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');_0x20219f[_0x3412('0x8')][_0x3a8dc9][_0x3412('0x2c')]=_0x43d188;_0x20219f[_0x3412('0x8')][_0x3a8dc9]['queue']=_0x581250;_0x20219f['timers'][_0x3a8dc9][_0x3412('0x2d')]=function(){var _0x8d045f=getDiff(_0x20219f[_0x3412('0x8')][_0x3a8dc9][_0x3412('0x2a')]);clearTimeout(_0x20219f[_0x3412('0x8')][_0x3a8dc9]['timer']);_0x20219f[_0x3412('0x8')][_0x3a8dc9][_0x3412('0x2e')]=![];RpcVoiceAgentReport[_0x3412('0x2f')]({'acwtime':_0x8d045f},_0x20219f['timers'][_0x3a8dc9][_0x3412('0x2c')],_0x3a8dc9)[_0x3412('0x1f')](function(_0x1eb170){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x43d188,_0x8d045f,_0x1eb170);})[_0x3412('0x30')](function(_0x3fe196){logger['error'](_0x3412('0x31'),_0x43d188,_0x3fe196);});delete _0x20219f[_0x3412('0x8')][_0x3a8dc9];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x43d188,_0x3a8dc9,_0x581250);}});}})[_0x3412('0x30')](function(_0x415ed1){logger['error'](_0x3412('0x32'),_0x43d188,_0x20219f[_0x3412('0x6')][_0x581250]['acwTimeout'],_0x3a8dc9,_0x581250);})['finally'](function(){delete _0x20219f[_0x3412('0x24')][_0x43d188];});}catch(_0x4b40de){logger[_0x3412('0x33')](_0x3412('0x34'),_0x4b40de['message']);}};Acw[_0x3412('0x18')][_0x3412('0x29')]=function(_0x1e63d9){try{var _0x121eeb=this;if(_0x121eeb[_0x3412('0x8')][_0x1e63d9]){_0x121eeb[_0x3412('0x8')][_0x1e63d9][_0x3412('0x2e')]=![];var _0x1d7104=_0x121eeb[_0x3412('0x8')][_0x1e63d9][_0x3412('0x2c')];var _0x3211bd=_0x121eeb['timers'][_0x1e63d9][_0x3412('0x1a')];var _0x169d64=_0x121eeb[_0x3412('0x6')][_0x3211bd]['acwTimeout'];logger[_0x3412('0x22')](_0x3412('0x35'),_0x1d7104,_0x1e63d9);RpcUser[_0x3412('0x36')](this[_0x3412('0x7')][_0x1e63d9]);RpcVoiceAgentReport[_0x3412('0x2f')]({'acwtime':_0x169d64,'agentacw':!![]},_0x1d7104,_0x1e63d9)[_0x3412('0x1f')](function(_0x17865e){logger[_0x3412('0x22')](_0x3412('0x37'),_0x1d7104,_0x169d64,_0x17865e);})['catch'](function(_0x295e05){logger[_0x3412('0x33')](_0x3412('0x31'),_0x1d7104,_0x295e05);});}else{logger[_0x3412('0x33')](_0x3412('0x38'),_0x1e63d9);if(_0x121eeb[_0x3412('0x8')]){logger[_0x3412('0x22')](_0x3412('0x39'),JSON[_0x3412('0x3a')](_0x121eeb[_0x3412('0x8')]));}}}catch(_0x3db4fb){logger['error'](_0x3412('0x3b'),_0x3db4fb[_0x3412('0x3c')]);}};Acw['prototype'][_0x3412('0xa')]=function(_0x4a0eb1){try{if(this[_0x3412('0x6')][_0x4a0eb1[_0x3412('0x1a')]]&&(this[_0x3412('0x6')][_0x4a0eb1[_0x3412('0x1a')]][_0x3412('0x3')]||this[_0x3412('0x6')][_0x4a0eb1[_0x3412('0x1a')]]['mandatoryDisposition'])){if(this[_0x3412('0x7')][_0x4a0eb1[_0x3412('0x3d')]]){this[_0x3412('0x24')][_0x4a0eb1[_0x3412('0x2c')]]={'queue':_0x4a0eb1['queue'],'interface':_0x4a0eb1[_0x3412('0x3d')],'destlinkedid':_0x4a0eb1[_0x3412('0x26')]};}}}catch(_0x354a58){logger[_0x3412('0x33')]('[ACW][syncAgentConnect]\x20%s',_0x354a58[_0x3412('0x3c')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x5208cb){try{if(this[_0x3412('0x6')][_0x5208cb['queue']]&&(this['voiceQueues'][_0x5208cb[_0x3412('0x1a')]][_0x3412('0x3')]||this[_0x3412('0x6')][_0x5208cb['queue']]['mandatoryDisposition'])){if(this[_0x3412('0x7')][_0x5208cb[_0x3412('0x3d')]]){this[_0x3412('0x24')][_0x5208cb[_0x3412('0x2c')]]={'queue':_0x5208cb[_0x3412('0x1a')],'interface':_0x5208cb['interface']};}}}catch(_0x1111cb){logger[_0x3412('0x33')](_0x3412('0x3e'),_0x1111cb[_0x3412('0x3c')]);}};Acw[_0x3412('0x18')][_0x3412('0xc')]=function(_0x28616c){try{if(this[_0x3412('0x24')][_0x28616c[_0x3412('0x2c')]]&&_['isUndefined'](this[_0x3412('0x24')][_0x28616c['uniqueid']][_0x3412('0x25')])){logger[_0x3412('0x22')](_0x3412('0x3f'),_0x28616c[_0x3412('0x2c')]);this[_0x3412('0x19')](_0x28616c[_0x3412('0x2c')]);}else if(this[_0x3412('0x24')][_0x28616c[_0x3412('0x40')]]&&_[_0x3412('0x41')](this[_0x3412('0x24')][_0x28616c[_0x3412('0x40')]][_0x3412('0x25')])){logger[_0x3412('0x22')]('[%s][HANGUP:LINKEDID]',_0x28616c[_0x3412('0x40')]);this['startAcw'](_0x28616c['linkedid']);}}catch(_0x2319e3){logger[_0x3412('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x2319e3[_0x3412('0x3c')]);}};Acw['prototype'][_0x3412('0xf')]=function(_0x32ded8){try{if(this[_0x3412('0x24')][_0x32ded8[_0x3412('0x2c')]]&&this[_0x3412('0x24')][_0x32ded8[_0x3412('0x2c')]][_0x3412('0x25')]){logger[_0x3412('0x22')](_0x3412('0x42'),_0x32ded8['uniqueid']);this[_0x3412('0x19')](_0x32ded8[_0x3412('0x2c')]);}else if(this[_0x3412('0x24')][_0x32ded8[_0x3412('0x40')]]&&this[_0x3412('0x24')][_0x32ded8[_0x3412('0x40')]][_0x3412('0x25')]){logger[_0x3412('0x22')](_0x3412('0x43'),_0x32ded8[_0x3412('0x40')]);this['startAcw'](_0x32ded8[_0x3412('0x40')]);}}catch(_0xf4a987){logger[_0x3412('0x33')](_0x3412('0x44'),_0xf4a987[_0x3412('0x3c')]);}};Acw[_0x3412('0x18')]['syncAttendedTransfer']=function(_0x281de0){try{if(!_['isNil'](this[_0x3412('0x24')][_0x281de0[_0x3412('0x45')]])){this['startAcw'](_0x281de0[_0x3412('0x45')]);if(this[_0x3412('0x24')][_0x281de0[_0x3412('0x46')]]){this[_0x3412('0x24')][_0x281de0['secondtransfereruniqueid']][_0x3412('0x25')]=!![];this[_0x3412('0x24')][_0x281de0[_0x3412('0x47')]]=this[_0x3412('0x24')][_0x281de0[_0x3412('0x46')]];delete this[_0x3412('0x24')][_0x281de0['secondtransfereruniqueid']];}}else if(!_[_0x3412('0x48')](this[_0x3412('0x24')][_0x281de0[_0x3412('0x47')]])){this[_0x3412('0x19')](_0x281de0['transfertargetuniqueid']);if(this[_0x3412('0x24')][_0x281de0['origtransfereruniqueid']]){this['channels'][_0x281de0['origtransfereruniqueid']]['attended']=!![];this['channels'][_0x281de0[_0x3412('0x45')]]=this[_0x3412('0x24')][_0x281de0[_0x3412('0x49')]];delete this[_0x3412('0x24')][_0x281de0[_0x3412('0x49')]];}}}catch(_0x127607){logger[_0x3412('0x33')](_0x3412('0x4a'),_0x127607['message']);}};Acw[_0x3412('0x18')][_0x3412('0x4b')]=function(_0x4d83b8){try{if(this[_0x3412('0x24')][_0x4d83b8[_0x3412('0x4c')]]){logger[_0x3412('0x22')](_0x3412('0x4d'),JSON[_0x3412('0x3a')](_0x4d83b8[_0x3412('0x4c')]));this[_0x3412('0x19')](_0x4d83b8[_0x3412('0x4c')]);}else if(this[_0x3412('0x24')][_0x4d83b8[_0x3412('0x4e')]]){logger[_0x3412('0x22')](_0x3412('0x4f'),JSON[_0x3412('0x3a')](_0x4d83b8[_0x3412('0x4e')]));this[_0x3412('0x19')](_0x4d83b8[_0x3412('0x4e')]);}}catch(_0x34ae8a){logger[_0x3412('0x33')](_0x3412('0x50'),_0x34ae8a['message']);}};Acw[_0x3412('0x18')][_0x3412('0x10')]=function(_0x352a0f){try{if(this['voiceQueues'][_0x352a0f['queue']]&&this[_0x3412('0x6')][_0x352a0f[_0x3412('0x1a')]][_0x3412('0x51')]===_0x3412('0x52')){if(this[_0x3412('0x7')][_0x352a0f[_0x3412('0x3d')]]){logger[_0x3412('0x22')](_0x3412('0x53'),_0x352a0f[_0x3412('0x2c')],_0x352a0f[_0x3412('0x3d')],_0x352a0f['queue']);return RpcUser['savePause'](this[_0x3412('0x7')][_0x352a0f[_0x3412('0x3d')]],_0x3412('0x54'),_0x352a0f[_0x3412('0x2c')]);}}}catch(_0x165f54){logger['error'](_0x3412('0x55'),_0x165f54[_0x3412('0x3c')]);}};module[_0x3412('0x56')]=Acw; \ No newline at end of file +var _0x3c3b=['attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','error','[ACW][START]\x20%s','message','queue','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','info','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','syncHangup','syncAgentRingNoAnswer','bind'];(function(_0x472448,_0x192575){var _0xbe79cb=function(_0x228704){while(--_0x228704){_0x472448['push'](_0x472448['shift']());}};_0xbe79cb(++_0x192575);}(_0x3c3b,0x148));var _0xb3c3=function(_0x27ac81,_0x361c4d){_0x27ac81=_0x27ac81-0x0;var _0x2ae1da=_0x3c3b[_0x27ac81];return _0x2ae1da;};'use strict';var util=require('util');var _=require(_0xb3c3('0x0'));var moment=require(_0xb3c3('0x1'));var ami=require(_0xb3c3('0x2'));var logger=require('../../../config/logger')(_0xb3c3('0x3'));var RpcUser=require(_0xb3c3('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0xfc58d5){this[_0xb3c3('0x5')]=_0xfc58d5['voiceQueues'];this[_0xb3c3('0x6')]=_0xfc58d5[_0xb3c3('0x6')];this[_0xb3c3('0x7')]=_0xfc58d5[_0xb3c3('0x7')];this[_0xb3c3('0x8')]={};ami['on'](_0xb3c3('0x9'),this[_0xb3c3('0xa')]['bind'](this));ami['on'](_0xb3c3('0xb'),this[_0xb3c3('0xc')]['bind'](this));ami['on']('hangup',this[_0xb3c3('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0xb3c3('0xe')][_0xb3c3('0xf')](this));ami['on'](_0xb3c3('0x10'),this[_0xb3c3('0x11')][_0xb3c3('0xf')](this));ami['on'](_0xb3c3('0x12'),this[_0xb3c3('0x13')]['bind'](this));ami['on'](_0xb3c3('0x14'),this[_0xb3c3('0x15')][_0xb3c3('0xf')](this));}function getDiff(_0x50e7a2){var _0x5b176c=moment()[_0xb3c3('0x16')](0x0);var _0xe2f2eb=moment(_0x50e7a2)['milliseconds'](0x0);return _0x5b176c[_0xb3c3('0x17')](_0xe2f2eb,_0xb3c3('0x18'));}Acw[_0xb3c3('0x19')][_0xb3c3('0x1a')]=function(_0x77ba6){try{var _0x8a6c6=this;var _0x3e9e42=this['channels'][_0x77ba6][_0xb3c3('0x1b')];var _0x5bc518=this[_0xb3c3('0x8')][_0x77ba6]['queue'];var _0x17ebd7=this[_0xb3c3('0x5')][_0x5bc518];var _0x352efc=![];var _0x3eabd=_0xb3c3('0x1c');if(_0x17ebd7[_0xb3c3('0x1d')]){if(_0x17ebd7['mandatoryDispositionPause']['name']){_0x352efc=!![];_0x3eabd=_0x17ebd7[_0xb3c3('0x1e')][_0xb3c3('0x1f')];}}ami['Action']({'action':_0xb3c3('0x20'),'interface':_0x3e9e42,'paused':!![],'reason':_0x3eabd})[_0xb3c3('0x21')](function(_0x3f0ee4){if(_0x8a6c6['agents'][_0x3e9e42]){return RpcUser[_0xb3c3('0x22')](_0x8a6c6['agents'][_0x3e9e42]['id'])[_0xb3c3('0x21')](function(_0x19a1c9){if(_0x19a1c9&&!_0x19a1c9[_0xb3c3('0x23')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x77ba6,_0x3e9e42,_0x5bc518);var _0x14da10=_0x8a6c6[_0xb3c3('0x8')][_0x77ba6][_0xb3c3('0x24')]&&_0x8a6c6['channels'][_0x77ba6][_0xb3c3('0x25')]?_0x8a6c6[_0xb3c3('0x8')][_0x77ba6][_0xb3c3('0x25')]:_0x77ba6;return RpcUser['savePause'](_0x8a6c6['agents'][_0x3e9e42],_0x3eabd,_0x14da10)[_0xb3c3('0x21')](function(_0x143c3c){if(!_0x352efc){_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42]={};logger['info'](_0xb3c3('0x26'),_0x77ba6,_0x8a6c6[_0xb3c3('0x5')][_0x5bc518][_0xb3c3('0x27')],_0x3e9e42,_0x5bc518);_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42][_0xb3c3('0x28')]=setTimeout(_0x8a6c6[_0xb3c3('0x29')][_0xb3c3('0xf')](_0x8a6c6,_0x3e9e42),_0x8a6c6[_0xb3c3('0x5')][_0x5bc518][_0xb3c3('0x27')]*0x3e8);_0x8a6c6['timers'][_0x3e9e42][_0xb3c3('0x2a')]=moment()[_0xb3c3('0x2b')](_0xb3c3('0x2c'));_0x8a6c6['timers'][_0x3e9e42][_0xb3c3('0x2d')]=_0x77ba6;_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42]['queue']=_0x5bc518;_0x8a6c6['timers'][_0x3e9e42][_0xb3c3('0x2e')]=function(){var _0x395320=getDiff(_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42][_0xb3c3('0x2a')]);clearTimeout(_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42]['timer']);_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42][_0xb3c3('0x28')]=![];RpcVoiceAgentReport[_0xb3c3('0x2f')]({'acwtime':_0x395320},_0x8a6c6[_0xb3c3('0x7')][_0x3e9e42][_0xb3c3('0x2d')],_0x3e9e42)[_0xb3c3('0x21')](function(_0x12fc08){logger['info'](_0xb3c3('0x30'),_0x77ba6,_0x395320,_0x12fc08);})[_0xb3c3('0x31')](function(_0x92735b){logger['error'](_0xb3c3('0x32'),_0x77ba6,_0x92735b);});delete _0x8a6c6[_0xb3c3('0x7')][_0x3e9e42];};}});}else{logger['info'](_0xb3c3('0x33'),_0x77ba6,_0x3e9e42,_0x5bc518);}});}})[_0xb3c3('0x31')](function(_0x5be9d7){logger['error'](_0xb3c3('0x26'),_0x77ba6,_0x8a6c6['voiceQueues'][_0x5bc518][_0xb3c3('0x27')],_0x3e9e42,_0x5bc518);})[_0xb3c3('0x34')](function(){delete _0x8a6c6[_0xb3c3('0x8')][_0x77ba6];});}catch(_0x3fe71e){logger[_0xb3c3('0x35')](_0xb3c3('0x36'),_0x3fe71e[_0xb3c3('0x37')]);}};Acw['prototype'][_0xb3c3('0x29')]=function(_0x40da15){try{var _0x2d221d=this;if(_0x2d221d[_0xb3c3('0x7')][_0x40da15]){_0x2d221d[_0xb3c3('0x7')][_0x40da15][_0xb3c3('0x28')]=![];var _0x41da6a=_0x2d221d[_0xb3c3('0x7')][_0x40da15]['uniqueid'];var _0x2d17fa=_0x2d221d['timers'][_0x40da15][_0xb3c3('0x38')];var _0x4e242d=_0x2d221d[_0xb3c3('0x5')][_0x2d17fa][_0xb3c3('0x27')];logger['info'](_0xb3c3('0x39'),_0x41da6a,_0x40da15);RpcUser[_0xb3c3('0x3a')](this[_0xb3c3('0x6')][_0x40da15]);RpcVoiceAgentReport['update']({'acwtime':_0x4e242d,'agentacw':!![]},_0x41da6a,_0x40da15)[_0xb3c3('0x21')](function(_0x4a3cea){logger[_0xb3c3('0x3b')]('[%s][UPDATE][ACWTIME:%s]',_0x41da6a,_0x4e242d,_0x4a3cea);})['catch'](function(_0xbe37a2){logger[_0xb3c3('0x35')](_0xb3c3('0x32'),_0x41da6a,_0xbe37a2);});}else{logger[_0xb3c3('0x35')](_0xb3c3('0x3c'),_0x40da15);if(_0x2d221d[_0xb3c3('0x7')]){logger[_0xb3c3('0x3b')](_0xb3c3('0x3d'),JSON['stringify'](_0x2d221d['timers']));}}}catch(_0x269231){logger[_0xb3c3('0x35')]('[ACW][STOP]\x20%s',_0x269231[_0xb3c3('0x37')]);}};Acw[_0xb3c3('0x19')][_0xb3c3('0xa')]=function(_0xb66574){try{if(this[_0xb3c3('0x5')][_0xb66574[_0xb3c3('0x38')]]&&(this[_0xb3c3('0x5')][_0xb66574['queue']][_0xb3c3('0x3')]||this[_0xb3c3('0x5')][_0xb66574[_0xb3c3('0x38')]][_0xb3c3('0x1d')])){if(this['agents'][_0xb66574['interface']]){this['channels'][_0xb66574[_0xb3c3('0x2d')]]={'queue':_0xb66574[_0xb3c3('0x38')],'interface':_0xb66574['interface'],'destlinkedid':_0xb66574[_0xb3c3('0x25')]};}}}catch(_0x50d05e){logger[_0xb3c3('0x35')](_0xb3c3('0x3e'),_0x50d05e[_0xb3c3('0x37')]);}};Acw[_0xb3c3('0x19')][_0xb3c3('0x15')]=function(_0x4460dc){try{if(this[_0xb3c3('0x5')][_0x4460dc[_0xb3c3('0x38')]]&&(this[_0xb3c3('0x5')][_0x4460dc[_0xb3c3('0x38')]]['acw']||this[_0xb3c3('0x5')][_0x4460dc['queue']][_0xb3c3('0x1d')])){if(this['agents'][_0x4460dc[_0xb3c3('0x1b')]]){this['channels'][_0x4460dc['uniqueid']]={'queue':_0x4460dc['queue'],'interface':_0x4460dc['interface']};}}}catch(_0x1751e9){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x1751e9[_0xb3c3('0x37')]);}};Acw[_0xb3c3('0x19')][_0xb3c3('0xc')]=function(_0x1de426){try{if(this[_0xb3c3('0x8')][_0x1de426[_0xb3c3('0x2d')]]&&_['isUndefined'](this['channels'][_0x1de426['uniqueid']]['attended'])){logger[_0xb3c3('0x3b')](_0xb3c3('0x3f'),_0x1de426[_0xb3c3('0x2d')]);this[_0xb3c3('0x1a')](_0x1de426[_0xb3c3('0x2d')]);}else if(this[_0xb3c3('0x8')][_0x1de426[_0xb3c3('0x40')]]&&_[_0xb3c3('0x41')](this[_0xb3c3('0x8')][_0x1de426['linkedid']][_0xb3c3('0x24')])){logger[_0xb3c3('0x3b')]('[%s][HANGUP:LINKEDID]',_0x1de426[_0xb3c3('0x40')]);this[_0xb3c3('0x1a')](_0x1de426[_0xb3c3('0x40')]);}}catch(_0x2e3274){logger[_0xb3c3('0x35')](_0xb3c3('0x42'),_0x2e3274[_0xb3c3('0x37')]);}};Acw['prototype'][_0xb3c3('0xd')]=function(_0x4b75e2){try{if(this[_0xb3c3('0x8')][_0x4b75e2[_0xb3c3('0x2d')]]&&this[_0xb3c3('0x8')][_0x4b75e2['uniqueid']][_0xb3c3('0x24')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x4b75e2[_0xb3c3('0x2d')]);this[_0xb3c3('0x1a')](_0x4b75e2[_0xb3c3('0x2d')]);}else if(this['channels'][_0x4b75e2[_0xb3c3('0x40')]]&&this['channels'][_0x4b75e2['linkedid']][_0xb3c3('0x24')]){logger[_0xb3c3('0x3b')](_0xb3c3('0x43'),_0x4b75e2[_0xb3c3('0x40')]);this[_0xb3c3('0x1a')](_0x4b75e2['linkedid']);}}catch(_0x406ba6){logger[_0xb3c3('0x35')](_0xb3c3('0x44'),_0x406ba6[_0xb3c3('0x37')]);}};Acw['prototype'][_0xb3c3('0x11')]=function(_0x2d5cbe){try{if(!_['isNil'](this[_0xb3c3('0x8')][_0x2d5cbe['transfereeuniqueid']])){this[_0xb3c3('0x1a')](_0x2d5cbe[_0xb3c3('0x45')]);if(this['channels'][_0x2d5cbe[_0xb3c3('0x46')]]){this['channels'][_0x2d5cbe['secondtransfereruniqueid']][_0xb3c3('0x24')]=!![];this[_0xb3c3('0x8')][_0x2d5cbe[_0xb3c3('0x47')]]=this[_0xb3c3('0x8')][_0x2d5cbe[_0xb3c3('0x46')]];delete this[_0xb3c3('0x8')][_0x2d5cbe[_0xb3c3('0x46')]];}}else if(!_['isNil'](this['channels'][_0x2d5cbe[_0xb3c3('0x47')]])){this[_0xb3c3('0x1a')](_0x2d5cbe[_0xb3c3('0x47')]);if(this['channels'][_0x2d5cbe[_0xb3c3('0x48')]]){this[_0xb3c3('0x8')][_0x2d5cbe[_0xb3c3('0x48')]][_0xb3c3('0x24')]=!![];this[_0xb3c3('0x8')][_0x2d5cbe[_0xb3c3('0x45')]]=this[_0xb3c3('0x8')][_0x2d5cbe['origtransfereruniqueid']];delete this[_0xb3c3('0x8')][_0x2d5cbe['origtransfereruniqueid']];}}}catch(_0x3c2f4b){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x3c2f4b[_0xb3c3('0x37')]);}};Acw['prototype'][_0xb3c3('0x13')]=function(_0x27637a){try{if(this[_0xb3c3('0x8')][_0x27637a[_0xb3c3('0x49')]]){logger[_0xb3c3('0x3b')](_0xb3c3('0x4a'),JSON[_0xb3c3('0x4b')](_0x27637a[_0xb3c3('0x49')]));this[_0xb3c3('0x1a')](_0x27637a[_0xb3c3('0x49')]);}else if(this[_0xb3c3('0x8')][_0x27637a[_0xb3c3('0x4c')]]){logger[_0xb3c3('0x3b')](_0xb3c3('0x4d'),JSON['stringify'](_0x27637a[_0xb3c3('0x4c')]));this[_0xb3c3('0x1a')](_0x27637a[_0xb3c3('0x4c')]);}}catch(_0x28e57f){logger[_0xb3c3('0x35')](_0xb3c3('0x4e'),_0x28e57f['message']);}};Acw[_0xb3c3('0x19')][_0xb3c3('0xe')]=function(_0x565dd9){try{if(this['voiceQueues'][_0x565dd9[_0xb3c3('0x38')]]&&this[_0xb3c3('0x5')][_0x565dd9[_0xb3c3('0x38')]][_0xb3c3('0x4f')]===_0xb3c3('0x50')){if(this[_0xb3c3('0x6')][_0x565dd9['interface']]){logger[_0xb3c3('0x3b')](_0xb3c3('0x51'),_0x565dd9[_0xb3c3('0x2d')],_0x565dd9['interface'],_0x565dd9[_0xb3c3('0x38')]);return RpcUser[_0xb3c3('0x52')](this[_0xb3c3('0x6')][_0x565dd9['interface']],_0xb3c3('0x53'),_0x565dd9[_0xb3c3('0x2d')]);}}}catch(_0x4048e0){logger[_0xb3c3('0x35')](_0xb3c3('0x54'),_0x4048e0[_0xb3c3('0x37')]);}};module[_0xb3c3('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 6a2a787..094642f 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 _0x8ab3=['close','connect','shutdown','fullybooted','resolve','then','actionDeviceStateList','catch','exports','asterisk-manager','bluebird','moment','util','../../config/logger','ami','../../config/environment','port','asterisk','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','Action','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x8ab3,0x1a0));var _0x38ab=function(_0x4144ef,_0x3ed22b){_0x4144ef=_0x4144ef-0x0;var _0x3691ba=_0x8ab3[_0x4144ef];return _0x3691ba;};'use strict';var Manager=require(_0x38ab('0x0'));var BPromise=require(_0x38ab('0x1'));var moment=require(_0x38ab('0x2'));var util=require(_0x38ab('0x3'));var _=require('lodash');var logger=require(_0x38ab('0x4'))(_0x38ab('0x5'));var config=require(_0x38ab('0x6'));var ami=new Manager(config['asterisk'][_0x38ab('0x7')],config[_0x38ab('0x8')]['ip'],config[_0x38ab('0x8')]['username'],config[_0x38ab('0x8')][_0x38ab('0x9')],!![]);ami[_0x38ab('0xa')]();ami['Action']=BPromise[_0x38ab('0xb')](ami[_0x38ab('0xc')]);function error(_0x17dca3){logger[_0x38ab('0xd')](util[_0x38ab('0xe')](_0x38ab('0xf'),config[_0x38ab('0x8')][_0x38ab('0x10')],config[_0x38ab('0x8')]['ip'],config[_0x38ab('0x8')][_0x38ab('0x7')],util[_0x38ab('0x11')](_0x17dca3,![],null)));}function close(){logger[_0x38ab('0xd')](util[_0x38ab('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x38ab('0x8')][_0x38ab('0x10')],config[_0x38ab('0x8')]['ip'],config[_0x38ab('0x8')][_0x38ab('0x7')]));}ami[_0x38ab('0x12')]=function(){return function(){return ami[_0x38ab('0x13')]({'action':_0x38ab('0x14')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x38ab('0x13')]({'action':'devicestatelist'});};};ami[_0x38ab('0x15')]=function(){return function(){return ami[_0x38ab('0x13')]({'action':_0x38ab('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x38ab('0x13')]({'action':'queuesummary'});};};ami[_0x38ab('0x17')]=function(){return function(){return ami[_0x38ab('0x13')]({'action':_0x38ab('0x18')});};};function connect(_0x3c76ea){logger[_0x38ab('0x19')](util[_0x38ab('0xe')](_0x38ab('0x1a'),config[_0x38ab('0x8')]['username'],config[_0x38ab('0x8')]['ip'],config[_0x38ab('0x8')][_0x38ab('0x7')]));ami[_0x38ab('0x1b')](_0x38ab('0xd'),error);ami[_0x38ab('0x1b')](_0x38ab('0x1c'),close);}ami['on'](_0x38ab('0x1d'),connect);ami['on'](_0x38ab('0x1e'),function(_0x369fc6){logger[_0x38ab('0x19')](util[_0x38ab('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x38ab('0x8')][_0x38ab('0x10')],config['asterisk']['ip'],config['asterisk'][_0x38ab('0x7')],util[_0x38ab('0x11')](_0x369fc6,![],null)));});ami['on'](_0x38ab('0x1f'),function(_0x15ed4d){logger[_0x38ab('0x19')](util[_0x38ab('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x38ab('0x8')][_0x38ab('0x10')],config[_0x38ab('0x8')]['ip'],config[_0x38ab('0x8')]['port']));return BPromise[_0x38ab('0x20')]()['then'](ami[_0x38ab('0x12')]())[_0x38ab('0x21')](ami[_0x38ab('0x22')]())[_0x38ab('0x21')](ami[_0x38ab('0x15')]())['then'](ami['actionQueueSummary']())[_0x38ab('0x21')](ami[_0x38ab('0x17')]())[_0x38ab('0x23')](function(_0x47925d){console['log'](_0x47925d);});});ami[_0x38ab('0x1b')](_0x38ab('0xd'),error);ami[_0x38ab('0x1b')]('close',close);module[_0x38ab('0x24')]=ami; \ No newline at end of file +var _0x3f41=['shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','util','../../config/logger','asterisk','port','password','keepConnected','Action','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0x3f41,0x117));var _0x13f4=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x3f41[_0x2afbb0];return _0x411ff2;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require('moment');var util=require(_0x13f4('0x0'));var _=require('lodash');var logger=require(_0x13f4('0x1'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x13f4('0x2')][_0x13f4('0x3')],config[_0x13f4('0x2')]['ip'],config[_0x13f4('0x2')]['username'],config[_0x13f4('0x2')][_0x13f4('0x4')],!![]);ami[_0x13f4('0x5')]();ami[_0x13f4('0x6')]=BPromise['promisify'](ami[_0x13f4('0x7')]);function error(_0x3d9f35){logger['error'](util[_0x13f4('0x8')](_0x13f4('0x9'),config[_0x13f4('0x2')][_0x13f4('0xa')],config[_0x13f4('0x2')]['ip'],config[_0x13f4('0x2')][_0x13f4('0x3')],util[_0x13f4('0xb')](_0x3d9f35,![],null)));}function close(){logger[_0x13f4('0xc')](util[_0x13f4('0x8')](_0x13f4('0xd'),config[_0x13f4('0x2')][_0x13f4('0xa')],config[_0x13f4('0x2')]['ip'],config[_0x13f4('0x2')][_0x13f4('0x3')]));}ami[_0x13f4('0xe')]=function(){return function(){return ami['Action']({'action':_0x13f4('0xf')});};};ami[_0x13f4('0x10')]=function(){return function(){return ami['Action']({'action':_0x13f4('0x11')});};};ami[_0x13f4('0x12')]=function(){return function(){return ami[_0x13f4('0x6')]({'action':'sippeerstatus'});};};ami[_0x13f4('0x13')]=function(){return function(){return ami['Action']({'action':_0x13f4('0x14')});};};ami[_0x13f4('0x15')]=function(){return function(){return ami[_0x13f4('0x6')]({'action':_0x13f4('0x16')});};};function connect(_0x2a01a1){logger[_0x13f4('0x17')](util[_0x13f4('0x8')](_0x13f4('0x18'),config[_0x13f4('0x2')][_0x13f4('0xa')],config[_0x13f4('0x2')]['ip'],config[_0x13f4('0x2')][_0x13f4('0x3')]));ami['once'](_0x13f4('0xc'),error);ami[_0x13f4('0x19')](_0x13f4('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x13f4('0x1b'),function(_0x4e05ff){logger[_0x13f4('0x17')](util[_0x13f4('0x8')](_0x13f4('0x1c'),config[_0x13f4('0x2')][_0x13f4('0xa')],config[_0x13f4('0x2')]['ip'],config[_0x13f4('0x2')][_0x13f4('0x3')],util[_0x13f4('0xb')](_0x4e05ff,![],null)));});ami['on'](_0x13f4('0x1d'),function(_0x2cde19){logger[_0x13f4('0x17')](util[_0x13f4('0x8')](_0x13f4('0x1e'),config[_0x13f4('0x2')][_0x13f4('0xa')],config[_0x13f4('0x2')]['ip'],config['asterisk'][_0x13f4('0x3')]));return BPromise[_0x13f4('0x1f')]()[_0x13f4('0x20')](ami[_0x13f4('0xe')]())['then'](ami['actionDeviceStateList']())[_0x13f4('0x20')](ami[_0x13f4('0x12')]())['then'](ami['actionQueueSummary']())[_0x13f4('0x20')](ami[_0x13f4('0x15')]())['catch'](function(_0x1c5405){console[_0x13f4('0x21')](_0x1c5405);});});ami[_0x13f4('0x19')](_0x13f4('0xc'),error);ami[_0x13f4('0x19')](_0x13f4('0x1a'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index d4b83d0..3520778 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 _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0xcb91[_0x4b784d];return _0x2cdeaf;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xda3f,0xec));var _0xfda3=function(_0x346180,_0xc63f21){_0x346180=_0x346180-0x0;var _0x4f75b0=_0xda3f[_0x346180];return _0x4f75b0;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index c9d87c1..83dac4c 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 _0x7d43=['queue','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x7d43,0x7f));var _0x37d4=function(_0x159cbc,_0x5c2f5a){_0x159cbc=_0x159cbc-0x0;var _0x55e555=_0x7d43[_0x159cbc];return _0x55e555;};'use strict';var util=require(_0x37d4('0x0'));var _=require(_0x37d4('0x1'));var moment=require(_0x37d4('0x2'));function checkNameSurname(_0x426d68,_0x2aabdb,_0x3e2bd3){var _0x1d8bc6='';if(!_[_0x37d4('0x3')](_0x2aabdb)&&_0x37d4('0x4')===typeof _0x2aabdb){_0x1d8bc6+=_0x2aabdb;}if(!_['isNil'](_0x3e2bd3)&&_0x37d4('0x4')===typeof _0x3e2bd3){_0x1d8bc6+='\x20'+_0x3e2bd3;}if(_0x1d8bc6!==''){return _0x1d8bc6;}return _0x426d68;}function Action(_0x499a19,_0x2f411c,_0x46733e){this[_0x37d4('0x5')]=_0x499a19;this['uniqueid']=_0x46733e||undefined;this[_0x37d4('0x6')]=checkNameSurname(_0x2f411c[_0x37d4('0x7')][_0x37d4('0x8')],_0x2f411c[_0x37d4('0x7')]['firstName'],_0x2f411c['Contact'][_0x37d4('0x9')]);this[_0x37d4('0xa')]=_0x2f411c[_0x37d4('0x7')]['phone'];this['queue']=_0x499a19[_0x37d4('0x6')];this['active']=_0x2f411c[_0x37d4('0xb')]||![];this['type']=_0x499a19[_0x37d4('0xc')];this[_0x37d4('0xd')]=_0x499a19[_0x37d4('0xd')]||0x3;this[_0x37d4('0xe')]=_0x2f411c['scheduledat'];this['countbusyretry']=_0x2f411c['countbusyretry'];this['countcongestionretry']=_0x2f411c[_0x37d4('0xf')];this['countnoanswerretry']=_0x2f411c[_0x37d4('0x10')];this[_0x37d4('0x11')]=_0x2f411c[_0x37d4('0x11')];this['countdropretry']=_0x2f411c[_0x37d4('0x12')];this[_0x37d4('0x13')]=_0x2f411c['countabandonedretry'];this[_0x37d4('0x14')]=_0x2f411c[_0x37d4('0x14')];this[_0x37d4('0x15')]=_0x2f411c[_0x37d4('0x15')];this[_0x37d4('0x16')]=_0x2f411c[_0x37d4('0x16')];this['ListId']=_0x2f411c[_0x37d4('0x17')];this['UserId']=_0x2f411c[_0x37d4('0x18')];this['VoiceQueueId']=_0x2f411c[_0x37d4('0x19')];this[_0x37d4('0x1a')]=_0x2f411c['CampaignId'];this[_0x37d4('0x1b')]=_0x2f411c['id'];this[_0x37d4('0x1c')]=_0x2f411c[_0x37d4('0x7')][_0x37d4('0x1d')]||'';this['starttime']=moment()[_0x37d4('0x1e')](_0x37d4('0x1f'));this['callback']=_0x2f411c[_0x37d4('0x20')];this[_0x37d4('0x21')]=_0x2f411c[_0x37d4('0x21')];this[_0x37d4('0x22')]=_0x2f411c[_0x37d4('0x22')];this[_0x37d4('0x23')]=_0x2f411c[_0x37d4('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x37d4('0x24')]['getCaller']=function(){return util[_0x37d4('0x1e')](_0x37d4('0x25'),this['name'],this[_0x37d4('0x5')][_0x37d4('0x26')]>0x0?this[_0x37d4('0xa')][_0x37d4('0x27')](this[_0x37d4('0x5')][_0x37d4('0x26')]):this['number']);};Action[_0x37d4('0x24')][_0x37d4('0x28')]=function(){return this[_0x37d4('0x29')];};module['exports']=Action; \ No newline at end of file +var _0x80cb=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','format','substring','dialCutDigit','prototype','getQueue','exports','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x80cb,0x133));var _0xb80c=function(_0x26d018,_0xedb83d){_0x26d018=_0x26d018-0x0;var _0x296c00=_0x80cb[_0x26d018];return _0x296c00;};'use strict';var util=require('util');var _=require(_0xb80c('0x0'));var moment=require('moment');function checkNameSurname(_0x22e14d,_0x5b407e,_0x438724){var _0x563e9c='';if(!_[_0xb80c('0x1')](_0x5b407e)&&'string'===typeof _0x5b407e){_0x563e9c+=_0x5b407e;}if(!_['isNil'](_0x438724)&&_0xb80c('0x2')===typeof _0x438724){_0x563e9c+='\x20'+_0x438724;}if(_0x563e9c!==''){return _0x563e9c;}return _0x22e14d;}function Action(_0x418107,_0x4ba16d,_0x501f0c){this[_0xb80c('0x3')]=_0x418107;this[_0xb80c('0x4')]=_0x501f0c||undefined;this[_0xb80c('0x5')]=checkNameSurname(_0x4ba16d[_0xb80c('0x6')][_0xb80c('0x7')],_0x4ba16d[_0xb80c('0x6')][_0xb80c('0x8')],_0x4ba16d[_0xb80c('0x6')]['lastName']);this[_0xb80c('0x9')]=_0x4ba16d[_0xb80c('0x6')]['phone'];this[_0xb80c('0xa')]=_0x418107['name'];this[_0xb80c('0xb')]=_0x4ba16d[_0xb80c('0xb')]||![];this['type']=_0x418107[_0xb80c('0xc')];this[_0xb80c('0xd')]=_0x418107[_0xb80c('0xd')]||0x3;this[_0xb80c('0xe')]=_0x4ba16d['scheduledat'];this[_0xb80c('0xf')]=_0x4ba16d['countbusyretry'];this[_0xb80c('0x10')]=_0x4ba16d[_0xb80c('0x10')];this[_0xb80c('0x11')]=_0x4ba16d[_0xb80c('0x11')];this['countnosuchnumberretry']=_0x4ba16d['countnosuchnumberretry'];this[_0xb80c('0x12')]=_0x4ba16d[_0xb80c('0x12')];this['countabandonedretry']=_0x4ba16d[_0xb80c('0x13')];this['countmachineretry']=_0x4ba16d[_0xb80c('0x14')];this['countagentrejectretry']=_0x4ba16d['countagentrejectretry'];this[_0xb80c('0x15')]=_0x4ba16d[_0xb80c('0x15')];this[_0xb80c('0x16')]=_0x4ba16d[_0xb80c('0x16')];this[_0xb80c('0x17')]=_0x4ba16d[_0xb80c('0x17')];this[_0xb80c('0x18')]=_0x4ba16d[_0xb80c('0x18')];this[_0xb80c('0x19')]=_0x4ba16d[_0xb80c('0x19')];this[_0xb80c('0x1a')]=_0x4ba16d['id'];this[_0xb80c('0x1b')]=_0x4ba16d[_0xb80c('0x6')][_0xb80c('0x8')]||'';this['starttime']=moment()['format'](_0xb80c('0x1c'));this[_0xb80c('0x1d')]=_0x4ba16d[_0xb80c('0x1d')];this[_0xb80c('0x1e')]=_0x4ba16d['callbackuniqueid'];this[_0xb80c('0x1f')]=_0x4ba16d[_0xb80c('0x1f')];this[_0xb80c('0x20')]=_0x4ba16d[_0xb80c('0x20')];this[_0xb80c('0x21')]='';this[_0xb80c('0x22')]='';}Action['prototype'][_0xb80c('0x23')]=function(){return util[_0xb80c('0x24')]('\x22%s\x22\x20<%s>',this[_0xb80c('0x5')],this['voiceQueue']['dialCutDigit']>0x0?this[_0xb80c('0x9')][_0xb80c('0x25')](this[_0xb80c('0x3')][_0xb80c('0x26')]):this[_0xb80c('0x9')]);};Action[_0xb80c('0x27')][_0xb80c('0x28')]=function(){return this[_0xb80c('0xa')];};module[_0xb80c('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 35b3d95..46d4de3 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 _0xe001=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x2e1ee6,_0x584e3a){var _0xc9fa21=function(_0x3d19cd){while(--_0x3d19cd){_0x2e1ee6['push'](_0x2e1ee6['shift']());}};_0xc9fa21(++_0x584e3a);}(_0xe001,0x8f));var _0x1e00=function(_0x6b594e,_0x271521){_0x6b594e=_0x6b594e-0x0;var _0x5d19a6=_0xe001[_0x6b594e];return _0x5d19a6;};'use strict';var util=require('util');var _=require(_0x1e00('0x0'));var moment=require(_0x1e00('0x1'));function getSeconds(_0x41c124,_0x2a8c57){var _0x5df437=moment(_0x41c124)[_0x1e00('0x2')](0x0);var _0x2af0e4=moment(_0x2a8c57)[_0x1e00('0x2')](0x0);return _0x5df437[_0x1e00('0x3')](_0x2af0e4,_0x1e00('0x4'));}function AgentComplete(_0x542857,_0x297f91){this[_0x1e00('0x5')]=0x4;this[_0x1e00('0x6')]=_0x1e00('0x7');this['scheduledat']=_0x542857[_0x1e00('0x8')];this[_0x1e00('0x9')]=_0x542857[_0x1e00('0x9')];this[_0x1e00('0xa')]=_0x542857['type']==='outbound'?_0x1e00('0xb'):_0x542857[_0x1e00('0x9')];this[_0x1e00('0xc')]=_0x542857[_0x1e00('0xc')];this[_0x1e00('0xd')]=_0x542857[_0x1e00('0xd')];this[_0x1e00('0xe')]=_0x542857[_0x1e00('0xe')];this[_0x1e00('0xf')]=_0x542857[_0x1e00('0xc')]+_0x542857[_0x1e00('0xd')]+_0x542857[_0x1e00('0xe')]+_0x542857[_0x1e00('0x10')]+_0x542857[_0x1e00('0x11')]+_0x542857['countabandonedretry']+_0x542857[_0x1e00('0x12')]+_0x542857[_0x1e00('0x13')];this[_0x1e00('0x10')]=_0x542857['countnosuchnumberretry'];this[_0x1e00('0x11')]=_0x542857['countdropretry'];this[_0x1e00('0x14')]=_0x542857[_0x1e00('0x14')];this['countmachineretry']=_0x542857['countmachineretry'];this[_0x1e00('0x13')]=_0x542857['countagentrejectretry'];this[_0x1e00('0x15')]=_0x297f91[_0x1e00('0x15')];this['calleridname']=_0x542857[_0x1e00('0x16')];this[_0x1e00('0x17')]=_0x542857[_0x1e00('0x18')];this[_0x1e00('0x19')]=_0x542857[_0x1e00('0x19')];this[_0x1e00('0x1a')]=_0x542857[_0x1e00('0x1a')];this['answertime']=_0x542857[_0x1e00('0x1b')];this[_0x1e00('0x1c')]=moment()[_0x1e00('0x1d')](_0x1e00('0x1e'));this[_0x1e00('0x1f')]=getSeconds(_0x542857['responsetime'],_0x542857[_0x1e00('0x19')]);this['holdtime']=getSeconds(_0x542857[_0x1e00('0x1b')],_0x542857[_0x1e00('0x1a')]);this[_0x1e00('0x20')]=getSeconds(this[_0x1e00('0x1c')],_0x542857['answertime']);this['queue']=_0x297f91[_0x1e00('0xb')];this[_0x1e00('0x21')]=_0x297f91['membername'];this[_0x1e00('0x22')]=_0x297f91[_0x1e00('0x22')];this[_0x1e00('0x23')]=_0x542857[_0x1e00('0x23')];this['callbackuniqueid']=_0x542857[_0x1e00('0x24')];this[_0x1e00('0x25')]=_0x542857[_0x1e00('0x25')];this[_0x1e00('0x26')]=_0x542857[_0x1e00('0x26')];this[_0x1e00('0x27')]=_0x542857['ContactId'];this['ListId']=_0x542857[_0x1e00('0x28')];this['UserId']=_0x542857['UserId'];this[_0x1e00('0x29')]=_0x542857['VoiceQueueId'];this[_0x1e00('0x2a')]=_0x542857[_0x1e00('0x2a')];this[_0x1e00('0x2b')]=_0x542857['originatecalleridnum']||'';this[_0x1e00('0x2c')]=_0x542857['originatecalleridname']||'';}module[_0x1e00('0x2d')]=AgentComplete; \ No newline at end of file +var _0x73ae=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','format','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x3047c6,_0x58d606){var _0x28dd36=function(_0x60a63e){while(--_0x60a63e){_0x3047c6['push'](_0x3047c6['shift']());}};_0x28dd36(++_0x58d606);}(_0x73ae,0x146));var _0xe73a=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x73ae[_0x102e37];return _0x35a07c;};'use strict';var util=require(_0xe73a('0x0'));var _=require(_0xe73a('0x1'));var moment=require(_0xe73a('0x2'));function getSeconds(_0x590074,_0x385458){var _0x11e5bd=moment(_0x590074)[_0xe73a('0x3')](0x0);var _0x3afb2a=moment(_0x385458)['milliseconds'](0x0);return _0x11e5bd[_0xe73a('0x4')](_0x3afb2a,_0xe73a('0x5'));}function AgentComplete(_0x1c9e2a,_0x369a30){this[_0xe73a('0x6')]=0x4;this[_0xe73a('0x7')]='Answer';this[_0xe73a('0x8')]=_0x1c9e2a[_0xe73a('0x8')];this[_0xe73a('0x9')]=_0x1c9e2a['type'];this[_0xe73a('0xa')]=_0x1c9e2a[_0xe73a('0x9')]===_0xe73a('0xb')?_0xe73a('0xc'):_0x1c9e2a[_0xe73a('0x9')];this[_0xe73a('0xd')]=_0x1c9e2a[_0xe73a('0xd')];this[_0xe73a('0xe')]=_0x1c9e2a[_0xe73a('0xe')];this[_0xe73a('0xf')]=_0x1c9e2a['countnoanswerretry'];this['countglobal']=_0x1c9e2a[_0xe73a('0xd')]+_0x1c9e2a[_0xe73a('0xe')]+_0x1c9e2a[_0xe73a('0xf')]+_0x1c9e2a[_0xe73a('0x10')]+_0x1c9e2a[_0xe73a('0x11')]+_0x1c9e2a[_0xe73a('0x12')]+_0x1c9e2a[_0xe73a('0x13')]+_0x1c9e2a[_0xe73a('0x14')];this[_0xe73a('0x10')]=_0x1c9e2a[_0xe73a('0x10')];this[_0xe73a('0x11')]=_0x1c9e2a[_0xe73a('0x11')];this[_0xe73a('0x12')]=_0x1c9e2a[_0xe73a('0x12')];this[_0xe73a('0x13')]=_0x1c9e2a[_0xe73a('0x13')];this['countagentrejectretry']=_0x1c9e2a['countagentrejectretry'];this[_0xe73a('0x15')]=_0x369a30[_0xe73a('0x15')];this['calleridname']=_0x1c9e2a['name'];this[_0xe73a('0x16')]=_0x1c9e2a[_0xe73a('0x17')];this[_0xe73a('0x18')]=_0x1c9e2a['starttime'];this[_0xe73a('0x19')]=_0x1c9e2a[_0xe73a('0x19')];this[_0xe73a('0x1a')]=_0x1c9e2a[_0xe73a('0x1a')];this[_0xe73a('0x1b')]=moment()[_0xe73a('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x1c9e2a[_0xe73a('0x19')],_0x1c9e2a[_0xe73a('0x18')]);this['holdtime']=getSeconds(_0x1c9e2a[_0xe73a('0x1a')],_0x1c9e2a[_0xe73a('0x19')]);this[_0xe73a('0x1d')]=getSeconds(this[_0xe73a('0x1b')],_0x1c9e2a['answertime']);this[_0xe73a('0xc')]=_0x369a30[_0xe73a('0xc')];this['membername']=_0x369a30[_0xe73a('0x1e')];this[_0xe73a('0x1f')]=_0x369a30[_0xe73a('0x1f')];this[_0xe73a('0x20')]=_0x1c9e2a[_0xe73a('0x20')];this[_0xe73a('0x21')]=_0x1c9e2a[_0xe73a('0x21')];this['callbackat']=_0x1c9e2a[_0xe73a('0x22')];this['recallme']=_0x1c9e2a[_0xe73a('0x23')];this[_0xe73a('0x24')]=_0x1c9e2a['ContactId'];this[_0xe73a('0x25')]=_0x1c9e2a[_0xe73a('0x25')];this[_0xe73a('0x26')]=_0x1c9e2a['UserId'];this[_0xe73a('0x27')]=_0x1c9e2a[_0xe73a('0x27')];this['CampaignId']=_0x1c9e2a[_0xe73a('0x28')];this[_0xe73a('0x29')]=_0x1c9e2a[_0xe73a('0x29')]||'';this[_0xe73a('0x2a')]=_0x1c9e2a[_0xe73a('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e6a043b..16d11bd 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 _0x4300=['countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x39fb6a,_0x8b07ae){var _0x1452a1=function(_0x391804){while(--_0x391804){_0x39fb6a['push'](_0x39fb6a['shift']());}};_0x1452a1(++_0x8b07ae);}(_0x4300,0x1a6));var _0x0430=function(_0x17f77f,_0x2be8b5){_0x17f77f=_0x17f77f-0x0;var _0x508e47=_0x4300[_0x17f77f];return _0x508e47;};'use strict';var util=require(_0x0430('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x481e26,_0x54a4da){var _0x4388ad=moment(_0x481e26)[_0x0430('0x1')](0x0);var _0x1c139f=moment(_0x54a4da)[_0x0430('0x1')](0x0);return _0x4388ad[_0x0430('0x2')](_0x1c139f,'seconds');}function Final(_0x46b412){this['uniqueid']=_0x46b412[_0x0430('0x3')];this['scheduledat']=_0x46b412[_0x0430('0x4')];this[_0x0430('0x5')]=_0x46b412[_0x0430('0x5')];this[_0x0430('0x6')]=_0x46b412[_0x0430('0x5')]===_0x0430('0x7')?_0x0430('0x8'):_0x46b412[_0x0430('0x5')];this[_0x0430('0x9')]=_0x46b412['countbusyretry'];this[_0x0430('0xa')]=_0x46b412[_0x0430('0xa')];this[_0x0430('0xb')]=_0x46b412[_0x0430('0xb')];this[_0x0430('0xc')]=_0x46b412[_0x0430('0x9')]+_0x46b412[_0x0430('0xa')]+_0x46b412[_0x0430('0xb')]+_0x46b412['countnosuchnumberretry']+_0x46b412['countdropretry']+_0x46b412[_0x0430('0xd')]+_0x46b412[_0x0430('0xe')]+_0x46b412[_0x0430('0xf')];this[_0x0430('0x10')]=_0x46b412[_0x0430('0x10')];this[_0x0430('0x11')]=_0x46b412[_0x0430('0x11')];this['countabandonedretry']=_0x46b412[_0x0430('0xd')];this[_0x0430('0xe')]=_0x46b412[_0x0430('0xe')];this[_0x0430('0xf')]=_0x46b412['countagentrejectretry'];this['queue']=_0x46b412['queue'];this[_0x0430('0x12')]=_0x46b412['calleridname'];this['calleridnum']=_0x46b412[_0x0430('0x13')];this[_0x0430('0x14')]=_0x46b412[_0x0430('0x14')];this[_0x0430('0x15')]=_0x46b412[_0x0430('0x15')];this['endtime']=_0x46b412['responsetime'];this[_0x0430('0x16')]=_0x46b412[_0x0430('0x16')]||0x0;this[_0x0430('0x17')]=_0x46b412[_0x0430('0x17')]||0x0;this['talktime']=_0x46b412['talktime']||0x0;this[_0x0430('0x18')]=_0x46b412[_0x0430('0x18')];this[_0x0430('0x19')]=_0x46b412[_0x0430('0x19')];this[_0x0430('0x1a')]=_0x46b412[_0x0430('0x1a')];this['recallme']=_0x46b412[_0x0430('0x1b')];this[_0x0430('0x1c')]=_0x46b412[_0x0430('0x1c')];this[_0x0430('0x1d')]=_0x46b412['ListId'];this[_0x0430('0x1e')]=_0x46b412[_0x0430('0x1e')];this[_0x0430('0x1f')]=_0x46b412[_0x0430('0x1f')];this[_0x0430('0x20')]=_0x46b412[_0x0430('0x20')];this[_0x0430('0x21')]=_0x46b412[_0x0430('0x21')]||'';this[_0x0430('0x22')]=_0x46b412['originatecalleridname']||'';}module[_0x0430('0x23')]=Final; \ No newline at end of file +var _0x3937=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countglobal','countcongestionretry','countnosuchnumberretry'];(function(_0x91924,_0x581309){var _0x510e26=function(_0x391166){while(--_0x391166){_0x91924['push'](_0x91924['shift']());}};_0x510e26(++_0x581309);}(_0x3937,0xbf));var _0x7393=function(_0x1edaa9,_0x53b191){_0x1edaa9=_0x1edaa9-0x0;var _0x3b67a4=_0x3937[_0x1edaa9];return _0x3b67a4;};'use strict';var util=require(_0x7393('0x0'));var _=require('lodash');var moment=require(_0x7393('0x1'));function getSeconds(_0x182983,_0x49aa96){var _0x45cd02=moment(_0x182983)['milliseconds'](0x0);var _0x224468=moment(_0x49aa96)['milliseconds'](0x0);return _0x45cd02[_0x7393('0x2')](_0x224468,_0x7393('0x3'));}function Final(_0x20011b){this[_0x7393('0x4')]=_0x20011b[_0x7393('0x4')];this[_0x7393('0x5')]=_0x20011b[_0x7393('0x5')];this[_0x7393('0x6')]=_0x20011b[_0x7393('0x6')];this['campaigntype']=_0x20011b['type']===_0x7393('0x7')?_0x7393('0x8'):_0x20011b[_0x7393('0x6')];this['countbusyretry']=_0x20011b[_0x7393('0x9')];this['countcongestionretry']=_0x20011b['countcongestionretry'];this['countnoanswerretry']=_0x20011b['countnoanswerretry'];this[_0x7393('0xa')]=_0x20011b[_0x7393('0x9')]+_0x20011b[_0x7393('0xb')]+_0x20011b['countnoanswerretry']+_0x20011b[_0x7393('0xc')]+_0x20011b[_0x7393('0xd')]+_0x20011b[_0x7393('0xe')]+_0x20011b[_0x7393('0xf')]+_0x20011b[_0x7393('0x10')];this[_0x7393('0xc')]=_0x20011b[_0x7393('0xc')];this[_0x7393('0xd')]=_0x20011b[_0x7393('0xd')];this['countabandonedretry']=_0x20011b['countabandonedretry'];this[_0x7393('0xf')]=_0x20011b['countmachineretry'];this['countagentrejectretry']=_0x20011b['countagentrejectretry'];this[_0x7393('0x8')]=_0x20011b['queue'];this[_0x7393('0x11')]=_0x20011b[_0x7393('0x11')];this['calleridnum']=_0x20011b[_0x7393('0x12')];this['starttime']=_0x20011b['starttime'];this[_0x7393('0x13')]=_0x20011b[_0x7393('0x13')];this[_0x7393('0x14')]=_0x20011b[_0x7393('0x13')];this[_0x7393('0x15')]=_0x20011b[_0x7393('0x15')]||0x0;this[_0x7393('0x16')]=_0x20011b[_0x7393('0x16')]||0x0;this['talktime']=_0x20011b['talktime']||0x0;this[_0x7393('0x17')]=_0x20011b[_0x7393('0x17')];this[_0x7393('0x18')]=_0x20011b[_0x7393('0x18')];this[_0x7393('0x19')]=_0x20011b['callbackat'];this['recallme']=_0x20011b['recallme'];this[_0x7393('0x1a')]=_0x20011b['ContactId'];this['ListId']=_0x20011b[_0x7393('0x1b')];this[_0x7393('0x1c')]=_0x20011b['UserId'];this[_0x7393('0x1d')]=_0x20011b[_0x7393('0x1d')];this[_0x7393('0x1e')]=_0x20011b[_0x7393('0x1e')];this[_0x7393('0x1f')]=_0x20011b[_0x7393('0x1f')]||'';this[_0x7393('0x20')]=_0x20011b[_0x7393('0x20')]||'';}module[_0x7393('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 613082a..87ba0a8 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 _0xbe15=['YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','endtime','format'];(function(_0x328534,_0x33b41e){var _0x2796c0=function(_0x1ba8ad){while(--_0x1ba8ad){_0x328534['push'](_0x328534['shift']());}};_0x2796c0(++_0x33b41e);}(_0xbe15,0xc4));var _0x5be1=function(_0x5659b8,_0x303980){_0x5659b8=_0x5659b8-0x0;var _0x14d8cb=_0xbe15[_0x5659b8];return _0x14d8cb;};'use strict';var util=require(_0x5be1('0x0'));var _=require(_0x5be1('0x1'));var moment=require(_0x5be1('0x2'));function getSeconds(_0x247d41,_0x2d5ef8){var _0x42397c=moment(_0x247d41)[_0x5be1('0x3')](0x0);var _0x59ff3f=moment(_0x2d5ef8)[_0x5be1('0x3')](0x0);return _0x42397c[_0x5be1('0x4')](_0x59ff3f,_0x5be1('0x5'));}function Hangup(_0x3771ab,_0x443560){this[_0x5be1('0x6')]=0x4;this['statedesc']=_0x5be1('0x7');this[_0x5be1('0x8')]=_0x3771ab[_0x5be1('0x8')];this[_0x5be1('0x9')]=_0x3771ab[_0x5be1('0x9')];this[_0x5be1('0xa')]=_0x3771ab[_0x5be1('0x9')]===_0x5be1('0xb')?_0x5be1('0xc'):_0x3771ab[_0x5be1('0x9')];this[_0x5be1('0xd')]=_0x3771ab[_0x5be1('0xd')];this[_0x5be1('0xe')]=_0x3771ab[_0x5be1('0xe')];this['countnoanswerretry']=_0x3771ab[_0x5be1('0xf')];this[_0x5be1('0x10')]=_0x3771ab[_0x5be1('0xd')]+_0x3771ab['countcongestionretry']+_0x3771ab[_0x5be1('0xf')]+_0x3771ab[_0x5be1('0x11')]+_0x3771ab[_0x5be1('0x12')]+_0x3771ab['countabandonedretry']+_0x3771ab['countmachineretry']+_0x3771ab[_0x5be1('0x13')];this['countnosuchnumberretry']=_0x3771ab[_0x5be1('0x11')];this[_0x5be1('0x12')]=_0x3771ab[_0x5be1('0x12')];this['countabandonedretry']=_0x3771ab[_0x5be1('0x14')];this['countmachineretry']=_0x3771ab[_0x5be1('0x15')];this['countagentrejectretry']=_0x3771ab[_0x5be1('0x13')];this[_0x5be1('0x16')]=_0x443560[_0x5be1('0x16')];this[_0x5be1('0x17')]=_0x3771ab['name'];this[_0x5be1('0x18')]=_0x3771ab[_0x5be1('0x19')];this['starttime']=_0x3771ab[_0x5be1('0x1a')];this['responsetime']=_0x3771ab['responsetime'];this[_0x5be1('0x1b')]=moment()[_0x5be1('0x1c')](_0x5be1('0x1d'));this[_0x5be1('0x1e')]=getSeconds(_0x3771ab[_0x5be1('0x1f')],_0x3771ab[_0x5be1('0x1a')]);this[_0x5be1('0x20')]=0x0;this['talktime']=getSeconds(this[_0x5be1('0x1b')],_0x3771ab[_0x5be1('0x1f')]);this['queue']=_0x3771ab[_0x5be1('0xc')];this[_0x5be1('0x21')]=_0x5be1('0x22');this['reason']=_0x443560[_0x5be1('0x23')];this[_0x5be1('0x24')]=_0x3771ab[_0x5be1('0x24')];this[_0x5be1('0x25')]=_0x3771ab[_0x5be1('0x25')];this[_0x5be1('0x26')]=_0x3771ab[_0x5be1('0x26')];this[_0x5be1('0x27')]=_0x3771ab[_0x5be1('0x27')];this[_0x5be1('0x28')]=_0x3771ab['ContactId'];this[_0x5be1('0x29')]=_0x3771ab[_0x5be1('0x29')];this[_0x5be1('0x2a')]=_0x3771ab[_0x5be1('0x2a')];this[_0x5be1('0x2b')]=_0x3771ab[_0x5be1('0x2b')];this[_0x5be1('0x2c')]=_0x3771ab[_0x5be1('0x2c')];}module['exports']=Hangup; \ No newline at end of file +var _0x5e20=['YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime'];(function(_0x5bdfac,_0x4a76ae){var _0x53a288=function(_0xfb0672){while(--_0xfb0672){_0x5bdfac['push'](_0x5bdfac['shift']());}};_0x53a288(++_0x4a76ae);}(_0x5e20,0xe2));var _0x05e2=function(_0x31c205,_0x1236ca){_0x31c205=_0x31c205-0x0;var _0x5ece7e=_0x5e20[_0x31c205];return _0x5ece7e;};'use strict';var util=require('util');var _=require(_0x05e2('0x0'));var moment=require(_0x05e2('0x1'));function getSeconds(_0x2bd255,_0x4f94cf){var _0x544a04=moment(_0x2bd255)[_0x05e2('0x2')](0x0);var _0x2db8ba=moment(_0x4f94cf)['milliseconds'](0x0);return _0x544a04['diff'](_0x2db8ba,'seconds');}function Hangup(_0x196ebb,_0x3482c8){this[_0x05e2('0x3')]=0x4;this[_0x05e2('0x4')]='Answer';this[_0x05e2('0x5')]=_0x196ebb['scheduledat'];this[_0x05e2('0x6')]=_0x196ebb[_0x05e2('0x6')];this[_0x05e2('0x7')]=_0x196ebb[_0x05e2('0x6')]===_0x05e2('0x8')?_0x05e2('0x9'):_0x196ebb[_0x05e2('0x6')];this[_0x05e2('0xa')]=_0x196ebb[_0x05e2('0xa')];this[_0x05e2('0xb')]=_0x196ebb[_0x05e2('0xb')];this[_0x05e2('0xc')]=_0x196ebb[_0x05e2('0xc')];this[_0x05e2('0xd')]=_0x196ebb[_0x05e2('0xa')]+_0x196ebb[_0x05e2('0xb')]+_0x196ebb[_0x05e2('0xc')]+_0x196ebb[_0x05e2('0xe')]+_0x196ebb[_0x05e2('0xf')]+_0x196ebb['countabandonedretry']+_0x196ebb[_0x05e2('0x10')]+_0x196ebb[_0x05e2('0x11')];this[_0x05e2('0xe')]=_0x196ebb['countnosuchnumberretry'];this['countdropretry']=_0x196ebb[_0x05e2('0xf')];this[_0x05e2('0x12')]=_0x196ebb[_0x05e2('0x12')];this[_0x05e2('0x10')]=_0x196ebb[_0x05e2('0x10')];this[_0x05e2('0x11')]=_0x196ebb[_0x05e2('0x11')];this[_0x05e2('0x13')]=_0x3482c8[_0x05e2('0x13')];this[_0x05e2('0x14')]=_0x196ebb[_0x05e2('0x15')];this[_0x05e2('0x16')]=_0x196ebb['number'];this[_0x05e2('0x17')]=_0x196ebb['starttime'];this[_0x05e2('0x18')]=_0x196ebb['responsetime'];this[_0x05e2('0x19')]=moment()['format'](_0x05e2('0x1a'));this[_0x05e2('0x1b')]=getSeconds(_0x196ebb[_0x05e2('0x18')],_0x196ebb['starttime']);this[_0x05e2('0x1c')]=0x0;this['talktime']=getSeconds(this[_0x05e2('0x19')],_0x196ebb[_0x05e2('0x18')]);this[_0x05e2('0x9')]=_0x196ebb[_0x05e2('0x9')];this[_0x05e2('0x1d')]=_0x05e2('0x1e');this[_0x05e2('0x1f')]=_0x3482c8['cause-txt'];this[_0x05e2('0x20')]=_0x196ebb['callback'];this[_0x05e2('0x21')]=_0x196ebb[_0x05e2('0x21')];this[_0x05e2('0x22')]=_0x196ebb[_0x05e2('0x22')];this[_0x05e2('0x23')]=_0x196ebb[_0x05e2('0x23')];this[_0x05e2('0x24')]=_0x196ebb['ContactId'];this[_0x05e2('0x25')]=_0x196ebb[_0x05e2('0x25')];this[_0x05e2('0x26')]=_0x196ebb[_0x05e2('0x26')];this[_0x05e2('0x27')]=_0x196ebb['VoiceQueueId'];this['CampaignId']=_0x196ebb[_0x05e2('0x28')];}module[_0x05e2('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index ecea21d..5717844 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 _0x31f8=['name','calleridnum','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname'];(function(_0xbf1132,_0x176b34){var _0xe63ce4=function(_0x52d8ed){while(--_0x52d8ed){_0xbf1132['push'](_0xbf1132['shift']());}};_0xe63ce4(++_0x176b34);}(_0x31f8,0xc1));var _0x831f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x31f8[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x831f('0x0'));var _=require('lodash');var moment=require(_0x831f('0x1'));function getSeconds(_0x438572,_0x4fecaf){var _0x4d6c03=moment(_0x438572)['milliseconds'](0x0);var _0x9889eb=moment(_0x4fecaf)[_0x831f('0x2')](0x0);return _0x4d6c03['diff'](_0x9889eb,'seconds');}function History(_0x80158){this[_0x831f('0x3')]=_0x80158[_0x831f('0x3')];this[_0x831f('0x4')]=_0x80158[_0x831f('0x4')]||undefined;this[_0x831f('0x5')]=_0x80158[_0x831f('0x5')];this['campaigntype']=_0x80158['type']===_0x831f('0x6')?_0x831f('0x7'):_0x80158[_0x831f('0x5')];this[_0x831f('0x8')]=_0x80158[_0x831f('0x8')];this[_0x831f('0x9')]=_0x80158[_0x831f('0x9')];this[_0x831f('0xa')]=_0x80158[_0x831f('0xa')];this['countglobal']=_0x80158[_0x831f('0x8')]+_0x80158['countcongestionretry']+_0x80158['countnoanswerretry']+_0x80158[_0x831f('0xb')]+_0x80158[_0x831f('0xc')]+_0x80158[_0x831f('0xd')]+_0x80158[_0x831f('0xe')]+_0x80158[_0x831f('0xf')];this[_0x831f('0xb')]=_0x80158[_0x831f('0xb')];this[_0x831f('0xc')]=_0x80158[_0x831f('0xc')];this['countabandonedretry']=_0x80158[_0x831f('0xd')];this[_0x831f('0xe')]=_0x80158[_0x831f('0xe')];this[_0x831f('0xf')]=_0x80158[_0x831f('0xf')];this[_0x831f('0x7')]=_0x80158[_0x831f('0x7')];this[_0x831f('0x10')]=_0x80158[_0x831f('0x11')];this[_0x831f('0x12')]=_0x80158[_0x831f('0x13')];this['starttime']=_0x80158[_0x831f('0x14')];this[_0x831f('0x15')]=_0x80158['responsetime'];this[_0x831f('0x16')]=_0x80158[_0x831f('0x15')];this['ringtime']=getSeconds(_0x80158['responsetime'],_0x80158[_0x831f('0x14')]);this['holdtime']=0x0;this[_0x831f('0x17')]=0x0;this[_0x831f('0x18')]=_0x80158[_0x831f('0x18')];this[_0x831f('0x19')]=_0x80158[_0x831f('0x19')];this['callbackat']=_0x80158['callbackat'];this[_0x831f('0x1a')]=_0x80158[_0x831f('0x1a')];this[_0x831f('0x1b')]=_0x80158[_0x831f('0x1b')];this[_0x831f('0x1c')]=_0x80158[_0x831f('0x1c')];this[_0x831f('0x1d')]=_0x80158[_0x831f('0x1d')];this[_0x831f('0x1e')]=_0x80158[_0x831f('0x1e')];this['CampaignId']=_0x80158[_0x831f('0x1f')];this['originatecalleridnum']=_0x80158[_0x831f('0x20')]||'';this[_0x831f('0x21')]=_0x80158[_0x831f('0x21')]||'';}module[_0x831f('0x22')]=History; \ No newline at end of file +var _0x1f15=['endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','starttime','responsetime'];(function(_0x34ca82,_0x45d704){var _0x4711a8=function(_0x3e1448){while(--_0x3e1448){_0x34ca82['push'](_0x34ca82['shift']());}};_0x4711a8(++_0x45d704);}(_0x1f15,0xe6));var _0x51f1=function(_0x392951,_0xa1413e){_0x392951=_0x392951-0x0;var _0x482a16=_0x1f15[_0x392951];return _0x482a16;};'use strict';var util=require(_0x51f1('0x0'));var _=require(_0x51f1('0x1'));var moment=require('moment');function getSeconds(_0x4c3041,_0x501d8f){var _0x5431f8=moment(_0x4c3041)[_0x51f1('0x2')](0x0);var _0x21a799=moment(_0x501d8f)[_0x51f1('0x2')](0x0);return _0x5431f8[_0x51f1('0x3')](_0x21a799,_0x51f1('0x4'));}function History(_0x5e1507){this[_0x51f1('0x5')]=_0x5e1507[_0x51f1('0x5')];this['scheduledat']=_0x5e1507[_0x51f1('0x6')]||undefined;this['type']=_0x5e1507[_0x51f1('0x7')];this[_0x51f1('0x8')]=_0x5e1507[_0x51f1('0x7')]===_0x51f1('0x9')?_0x51f1('0xa'):_0x5e1507['type'];this[_0x51f1('0xb')]=_0x5e1507[_0x51f1('0xb')];this[_0x51f1('0xc')]=_0x5e1507['countcongestionretry'];this['countnoanswerretry']=_0x5e1507[_0x51f1('0xd')];this[_0x51f1('0xe')]=_0x5e1507[_0x51f1('0xb')]+_0x5e1507[_0x51f1('0xc')]+_0x5e1507[_0x51f1('0xd')]+_0x5e1507['countnosuchnumberretry']+_0x5e1507[_0x51f1('0xf')]+_0x5e1507[_0x51f1('0x10')]+_0x5e1507[_0x51f1('0x11')]+_0x5e1507[_0x51f1('0x12')];this[_0x51f1('0x13')]=_0x5e1507[_0x51f1('0x13')];this['countdropretry']=_0x5e1507[_0x51f1('0xf')];this[_0x51f1('0x10')]=_0x5e1507['countabandonedretry'];this[_0x51f1('0x11')]=_0x5e1507[_0x51f1('0x11')];this[_0x51f1('0x12')]=_0x5e1507['countagentrejectretry'];this['queue']=_0x5e1507[_0x51f1('0xa')];this['calleridname']=_0x5e1507['name'];this['calleridnum']=_0x5e1507['number'];this[_0x51f1('0x14')]=_0x5e1507[_0x51f1('0x14')];this['responsetime']=_0x5e1507[_0x51f1('0x15')];this[_0x51f1('0x16')]=_0x5e1507[_0x51f1('0x15')];this[_0x51f1('0x17')]=getSeconds(_0x5e1507['responsetime'],_0x5e1507[_0x51f1('0x14')]);this[_0x51f1('0x18')]=0x0;this[_0x51f1('0x19')]=0x0;this[_0x51f1('0x1a')]=_0x5e1507['callback'];this['callbackuniqueid']=_0x5e1507['callbackuniqueid'];this[_0x51f1('0x1b')]=_0x5e1507[_0x51f1('0x1b')];this[_0x51f1('0x1c')]=_0x5e1507[_0x51f1('0x1c')];this[_0x51f1('0x1d')]=_0x5e1507['ContactId'];this[_0x51f1('0x1e')]=_0x5e1507['ListId'];this[_0x51f1('0x1f')]=_0x5e1507[_0x51f1('0x1f')];this[_0x51f1('0x20')]=_0x5e1507[_0x51f1('0x20')];this[_0x51f1('0x21')]=_0x5e1507[_0x51f1('0x21')];this[_0x51f1('0x22')]=_0x5e1507[_0x51f1('0x22')]||'';this[_0x51f1('0x23')]=_0x5e1507[_0x51f1('0x23')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 1c6dd06..917515a 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 _0xd957=['saveInDb','pick','ContactId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','unmonitored','variable','amdstatus','exten','xcally-motion-dialer','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','[syncHangupInAMD]','dialAMDActive','value','MACHINE','uniqueid','countmachineretry','countglobal','amd','emit','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','Machine','stateGlobal','dialMachineMaxRetry','add','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','[syncQueueCallerAbandon]\x20[Drop]','responsetime','Drop','dropreason','TIMEOUT','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','locked','rrmemory','stateinterface','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','handleIvr','dialActive','checkIsTrunkReachable','dialTimezone','[syncQueueSummary]','syncCampaigns','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','match','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','callProgressDetecting','checkRetriveMax','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','RUNNING','ivrTotalCallsDays','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','reachable','countReScheduled','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','enqueue','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','syncAgentComplete','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','stringify','milliseconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','md5','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','merge','diff','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','prototype','clearZombieChannels','[uniqueid]','[actions]','sequence','isNil','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','resolve','[countReScheduled]\x20','[checkIsBlackList]\x20','checkIsBlackListIvr','then','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound'];(function(_0xf74ddb,_0x8383bd){var _0x44e4cd=function(_0x20be15){while(--_0x20be15){_0xf74ddb['push'](_0xf74ddb['shift']());}};_0x44e4cd(++_0x8383bd);}(_0xd957,0x153));var _0x7d95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd957[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x7d95('0x0'));var _=require(_0x7d95('0x1'));var BPromise=require('bluebird');var uuid=require(_0x7d95('0x2'));var moment=require(_0x7d95('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x7d95('0x4'));var ut=require(_0x7d95('0x5'));var config=require(_0x7d95('0x6'));var logger=require(_0x7d95('0x7'))(_0x7d95('0x8'));var loggerBooked=require(_0x7d95('0x7'))(_0x7d95('0x9'));var loggerPredictive=require('../../../config/logger')(_0x7d95('0xa'));var loggerPredictiveCalls=require(_0x7d95('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x7d95('0x7'))(_0x7d95('0xb'));var ami=require(_0x7d95('0xc'));config[_0x7d95('0xd')]=_[_0x7d95('0xe')](config['redis'],{'host':_0x7d95('0xf'),'port':0x18eb});var io=require(_0x7d95('0x10'))(new Redis(config[_0x7d95('0xd')]));var cmHopper=require(_0x7d95('0x11'));var cmHopperHistory=require(_0x7d95('0x12'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x7d95('0x13'));var History=require(_0x7d95('0x14'));var Final=require('./final');var AgentComplete=require(_0x7d95('0x15'));var QueueCallerAbandon=require(_0x7d95('0x16'));var Hangup=require(_0x7d95('0x17'));var ipAgi=process[_0x7d95('0x18')][_0x7d95('0x19')]||_0x7d95('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':_0x7d95('0x1b')};var Sequence=function(){};Sequence['prototype'][_0x7d95('0x1c')]=function(_0x5ac56a){this[_0x7d95('0x1d')]=this['tail']?this[_0x7d95('0x1d')][_0x7d95('0x1e')](_0x5ac56a):_0x5ac56a();};function Dialer(_0x293f87,_0x45bf02){this['sequence']=new Sequence();this['preview']=_0x45bf02;this[_0x7d95('0x1f')]=_0x293f87[_0x7d95('0x1f')];this[_0x7d95('0x20')]=_0x293f87[_0x7d95('0x20')];this['agents']=_0x293f87[_0x7d95('0x21')];this[_0x7d95('0x22')]=_0x293f87['trunks'];this[_0x7d95('0x23')]=config[_0x7d95('0x23')]||0x2;this[_0x7d95('0x24')]={};this[_0x7d95('0x25')]={};this[_0x7d95('0x26')]={};this[_0x7d95('0x27')]={};this[_0x7d95('0x28')]={};this[_0x7d95('0x29')]={};this[_0x7d95('0x2a')]={};this['ivrOriginated']={};this[_0x7d95('0x2b')]={};this['queueBookedRR']={};ami['on'](_0x7d95('0x2c'),this['syncAgentConnect']['bind'](this));ami['on'](_0x7d95('0x2d'),this[_0x7d95('0x2e')][_0x7d95('0x2f')](this));ami['on']('originateresponse',this[_0x7d95('0x30')][_0x7d95('0x2f')](this));ami['on']('agentcomplete',this[_0x7d95('0x31')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x7d95('0x2f')](this));ami['on'](_0x7d95('0x32'),this['syncHangup'][_0x7d95('0x2f')](this));ami['on'](_0x7d95('0x33'),this[_0x7d95('0x34')]['bind'](this));ami['on'](_0x7d95('0x35'),this[_0x7d95('0x36')][_0x7d95('0x2f')](this));ami['on']('queuemember',this[_0x7d95('0x37')]['bind'](this));ami['on'](_0x7d95('0x38'),this[_0x7d95('0x39')][_0x7d95('0x2f')](this));this[_0x7d95('0x3a')]();this[_0x7d95('0x3b')]();}function isNotNull(_0x109b37){return _0x109b37!==null&&!_[_0x7d95('0x3c')](_0x109b37);}function checkIsLoggedIn(_0x32ac56,_0x5e130a){return function(){if(_0x5e130a<=0x0){_0x32ac56[_0x7d95('0x3d')]='AGENTS_NOT_LOGGED';throw _0x32ac56[_0x7d95('0x3e')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x26c07c){return _0x26c07c;}function checkIsActive(_0x38ffc4,_0x2eaa39){return function(){if(!isActive(_0x2eaa39)){_0x38ffc4[_0x7d95('0x3d')]=_0x7d95('0x3f');throw _0x38ffc4[_0x7d95('0x3e')]+'\x20NOT\x20Active';}};}function checkInterval(_0x3efb6d){return function(){if(!isNotNull(_0x3efb6d[_0x7d95('0x40')])){_0x3efb6d[_0x7d95('0x3d')]=_0x7d95('0x41');throw _0x3efb6d[_0x7d95('0x3e')]+_0x7d95('0x42');}if(!isNotNull(_0x3efb6d['Interval'][_0x7d95('0x43')])){_0x3efb6d[_0x7d95('0x3d')]='INTERVAL_IS_NULL';throw _0x3efb6d['name']+_0x7d95('0x42');}if(!isNotNull(_[_0x7d95('0x44')](_0x3efb6d['Interval'][_0x7d95('0x43')]))){_0x3efb6d[_0x7d95('0x3d')]=_0x7d95('0x41');throw _0x3efb6d[_0x7d95('0x3e')]+_0x7d95('0x42');}};}function msgResponse(_0x1b5648,_0x1a58e0,_0x5f4a92){return{'action':_0x1b5648,'response':_0x1a58e0,'message':_0x5f4a92,'stack':_0x5f4a92};}function myreject(_0x1c1f48){return function(_0x110368){return _0x1c1f48(msgResponse(_0x7d95('0x45'),'Error',JSON[_0x7d95('0x46')](_0x110368)));};}function getSeconds(_0x247ff2,_0x5a7dc1){var _0x22735c=moment(_0x247ff2)[_0x7d95('0x47')](0x0);var _0x3e4568=moment(_0x5a7dc1)[_0x7d95('0x47')](0x0);return _0x22735c['diff'](_0x3e4568,'seconds');}function emit(_0x53c88a,_0x586480,_0x4bf41d){io['to'](_0x53c88a)['emit'](_0x586480,_0x4bf41d);}function emitVoiceQueueSummary(_0x58fd70){if(_0x58fd70[_0x7d95('0x48')]===_0x7d95('0x49')){var _0x40f2ae={'id':_0x58fd70['id'],'name':_0x58fd70[_0x7d95('0x3e')],'strategy':_0x58fd70[_0x7d95('0x4a')],'answered':_0x58fd70[_0x7d95('0x4b')],'available':_0x58fd70[_0x7d95('0x4c')],'loggedIn':_0x58fd70[_0x7d95('0x4d')],'pTalking':_0x58fd70[_0x7d95('0x4e')],'sumBillable':_0x58fd70[_0x7d95('0x4f')],'sumDuration':_0x58fd70['sumDuration'],'sumHoldTime':_0x58fd70[_0x7d95('0x50')]||0x0,'talking':_0x58fd70[_0x7d95('0x51')],'total':_0x58fd70[_0x7d95('0x52')],'type':_0x58fd70[_0x7d95('0x48')],'unmanaged':_0x58fd70[_0x7d95('0x53')],'abandoned':_0x58fd70[_0x7d95('0x54')],'waiting':_0x58fd70[_0x7d95('0x55')],'loggedInDb':_0x58fd70[_0x7d95('0x56')],'dialActive':_0x58fd70['dialActive'],'dialMethod':_0x58fd70[_0x7d95('0x57')],'dialOriginateCallerIdName':_0x58fd70[_0x7d95('0x58')],'dialOriginateCallerIdNumber':_0x58fd70['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x58fd70[_0x7d95('0x59')],'dialPrefix':_0x58fd70[_0x7d95('0x5a')],'outboundAnswerAgiCallsDay':_0x58fd70['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x58fd70[_0x7d95('0x5b')],'outboundBlacklistCallsDay':_0x58fd70['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x58fd70['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x58fd70[_0x7d95('0x5c')],'outboundDropCallsDayACS':_0x58fd70[_0x7d95('0x5d')],'outboundDropCallsDayCallersExit':_0x58fd70[_0x7d95('0x5e')],'outboundDropCallsDayTimeout':_0x58fd70[_0x7d95('0x5f')],'outboundNoAnswerCallsDay':_0x58fd70[_0x7d95('0x60')],'outboundNoSuchCallsDay':_0x58fd70[_0x7d95('0x61')],'outboundOriginateFailureCallsDay':_0x58fd70[_0x7d95('0x62')],'outboundReCallsDay':_0x58fd70[_0x7d95('0x63')],'outboundRejectCallsDay':_0x58fd70[_0x7d95('0x64')],'outboundUnknownCallsDay':_0x58fd70['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x58fd70[_0x7d95('0x65')],'predictiveIntervalAvgHoldtime':_0x58fd70['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x58fd70[_0x7d95('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x58fd70[_0x7d95('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x58fd70[_0x7d95('0x68')],'predictiveIntervalErlangCalls':_0x58fd70[_0x7d95('0x69')],'predictiveIntervalErlangCallsDroppedCalls':_0x58fd70[_0x7d95('0x6a')],'predictiveIntervalHitRate':_0x58fd70[_0x7d95('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x58fd70[_0x7d95('0x6c')],'predictiveIntervalPauses':_0x58fd70[_0x7d95('0x6d')],'predictiveIntervalAvailable':_0x58fd70[_0x7d95('0x6e')],'predictiveIntervalTotalCalls':_0x58fd70[_0x7d95('0x6f')],'message':_0x58fd70['message'],'originated':_0x58fd70[_0x7d95('0x70')],'erlangCalls':_0x58fd70[_0x7d95('0x71')],'erlangCallToSecond':_0x58fd70[_0x7d95('0x72')],'erlangAbandonmentRate':_0x58fd70[_0x7d95('0x73')],'erlangBusyFactor':_0x58fd70[_0x7d95('0x74')],'startPredictive':_0x58fd70[_0x7d95('0x29')],'startProgressive':_0x58fd70['startProgressive']};if(_0x58fd70['Trunk']){_0x40f2ae[_0x7d95('0x75')]={'id':_0x58fd70[_0x7d95('0x75')]['id'],'name':_0x58fd70['Trunk'][_0x7d95('0x3e')],'active':_0x58fd70[_0x7d95('0x75')]['active'],'callerid':_0x58fd70[_0x7d95('0x75')][_0x7d95('0x76')]};}if(_0x58fd70[_0x7d95('0x40')]){_0x40f2ae[_0x7d95('0x40')]={'id':_0x58fd70[_0x7d95('0x40')]['id'],'name':_0x58fd70[_0x7d95('0x40')][_0x7d95('0x3e')]};}var _0x3709f3=md5(JSON[_0x7d95('0x46')](_0x40f2ae));if(_0x58fd70['md5']!==_0x3709f3){_0x58fd70[_0x7d95('0x77')]=_0x3709f3;emit(util['format'](_0x7d95('0x78'),_0x40f2ae['name']),_0x7d95('0x79'),_0x40f2ae);}}}function emitCampaignSummary(_0x44cfdc){if(_0x44cfdc[_0x7d95('0x48')]===_0x7d95('0x7a')){emit(util[_0x7d95('0x7b')](_0x7d95('0x7c'),_0x44cfdc[_0x7d95('0x3e')]),_0x7d95('0x7d'),_0x44cfdc);}}function checkGetDataPredictive(_0x3f7944){if(isNotNull(_0x3f7944)&&!_['isEmpty'](_0x3f7944)){loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x7f'));loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x80'),_0x3f7944[_0x7d95('0x6f')]);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x81'),_0x3f7944[_0x7d95('0x65')]);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x82'),_0x3f7944[_0x7d95('0x68')]);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x83'),_0x3f7944[_0x7d95('0x67')]);loggerPredictive['info'](_0x7d95('0x84'),_0x3f7944[_0x7d95('0x85')]);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x86'),_0x3f7944[_0x7d95('0x66')]);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x87'));if(_0x3f7944[_0x7d95('0x6f')]>0x0){if(!_[_0x7d95('0x3c')](_0x3f7944[_0x7d95('0x66')])&&_0x3f7944[_0x7d95('0x66')]>0x0){return!![];}loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x88'));if(!_[_0x7d95('0x3c')](_0x3f7944[_0x7d95('0x85')])&&_0x3f7944[_0x7d95('0x85')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x89'));}}else{loggerPredictive[_0x7d95('0x7e')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x3750c5){return function(_0x22b302){loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x8a'));loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x8b'),_0x22b302['erlangCalls']);loggerPredictive['info'](_0x7d95('0x8c'),_0x22b302[_0x7d95('0x72')]);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x8d'),_0x22b302[_0x7d95('0x73')]);loggerPredictive[_0x7d95('0x7e')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22b302[_0x7d95('0x74')]);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x8d'),_0x22b302[_0x7d95('0x73')]);loggerPredictive[_0x7d95('0x7e')]('---------------------------');_[_0x7d95('0x8e')](_0x3750c5,_0x22b302);};}function getDiff(_0x28d8ae){var _0x3c1a6c=moment()[_0x7d95('0x47')](0x0);var _0x21da66=moment(_0x28d8ae)[_0x7d95('0x47')](0x0);return _0x3c1a6c[_0x7d95('0x8f')](_0x21da66,_0x7d95('0x90'));}function ifInterval(_0xd80946,_0x5b875f){if(_['isUndefined'](_0x5b875f)){return![];}return getDiff(_0x5b875f)<_0xd80946*0x3c;}function freeVariablesPredictive(_0x5dd876){if(isNotNull(_0x5dd876)){if(!_[_0x7d95('0x3c')](_0x5dd876[_0x7d95('0x2a')])){_0x5dd876[_0x7d95('0x2a')]=undefined;loggerPredictive[_0x7d95('0x7e')](_0x5dd876[_0x7d95('0x3e')],_0x7d95('0x91'));}if(!_['isUndefined'](_0x5dd876['startPredictive'])){_0x5dd876[_0x7d95('0x29')]=undefined;loggerPredictive[_0x7d95('0x7e')](_0x5dd876[_0x7d95('0x3e')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x5dd876['handlePredictive'])){clearInterval(_0x5dd876[_0x7d95('0x92')]);_0x5dd876['handlePredictive']=undefined;loggerPredictive['info'](_0x5dd876[_0x7d95('0x3e')],_0x7d95('0x93'));}}}function erlangb(_0x37cb2a,_0x57803f){if(_0x57803f===0x0){return 0x0;}var _0x3ab56e=0x1;for(var _0x29de59=0x1;_0x29de59<=_0x57803f;_0x29de59+=0x1){_0x3ab56e=0x1+_0x3ab56e*_0x29de59/_0x37cb2a;}return 0x1/_0x3ab56e;}function isVoiceQueueOutbound(_0x1dcb62){return _0x1dcb62===_0x7d95('0x49');}function isNotPreview(_0x2504d3){return _0x2504d3!==_0x7d95('0x94');}function isCampaignIvr(_0x43cb1f){return _0x43cb1f===_0x7d95('0x7a');}function getCallerId(_0x1aed14,_0x4ee25c,_0x5172c2){if(!_[_0x7d95('0x3c')](_0x5172c2)&&typeof _0x5172c2===_0x7d95('0x95')&&!_['isEmpty'](_0x5172c2)){if(!_['isUndefined'](_0x4ee25c)&&typeof _0x4ee25c===_0x7d95('0x95')&&!_[_0x7d95('0x44')](_0x4ee25c)){return util[_0x7d95('0x7b')](_0x7d95('0x96'),_0x4ee25c,_0x5172c2);}return util['format'](_0x7d95('0x96'),_0x5172c2,_0x5172c2);}if(!_[_0x7d95('0x3c')](_0x1aed14)&&typeof _0x1aed14===_0x7d95('0x95')&&!_[_0x7d95('0x44')](_0x1aed14)){return _0x1aed14;}return _0x7d95('0x97');}function loggerCatchQueueSummary(_0x327649,_0x2abdb1){return function(_0x5e32b5){freeVariablesPredictive(_0x2abdb1);emitVoiceQueueSummary(_0x2abdb1);emitCampaignSummary(_0x2abdb1);loggerSyncQueueSummary[_0x7d95('0x98')](_0x327649,util[_0x7d95('0x99')](_0x5e32b5,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x242f1b,_0x3a7853){return function(_0x7ee627){loggerPredictive[_0x7d95('0x98')](_0x3a7853[_0x7d95('0x3e')],_0x242f1b);loggerPredictive[_0x7d95('0x98')](_0x7ee627['stack']);freeVariablesPredictive(_0x3a7853);};}function loggerCatch(_0x271d56){return function(_0x52a99c){logger['error'](_0x271d56,util[_0x7d95('0x99')](_0x52a99c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3ad3fe){return _0x3ad3fe&&!_[_0x7d95('0x3c')](_0x3ad3fe)&&_0x3ad3fe[_0x7d95('0x9a')]>0x0;}function decremetOriginate(_0x4e1303){if(!_['isUndefined'](_0x4e1303)&&_0x4e1303!==null){if(typeof _0x4e1303[_0x7d95('0x70')]!==_0x7d95('0x9b')){if(_0x4e1303['originated']>0x0){_0x4e1303[_0x7d95('0x70')]-=0x1;}else{logger['error'](_0x7d95('0x9c'));}}}else{logger[_0x7d95('0x98')](_0x7d95('0x9d'));}}function checkContactLowerLimitOriginate(_0x4be6cd,_0x591217,_0x414d71){if(_0x591217>_0x414d71){for(var _0x1b965b=0x0;_0x1b965b<_0x591217-_0x414d71;_0x1b965b+=0x1){decremetOriginate(_0x4be6cd);}}}function loggerGetContactDialer(_0x164741,_0x2ef52,_0xa6ab67){return function(_0x3ef4e3){checkContactLowerLimitOriginate(_0x2ef52,_0xa6ab67,0x0);logger['error'](_0x164741,util[_0x7d95('0x99')](_0x3ef4e3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1aeb91){return function(_0x1c3e08){if(isNotNull(_0x1c3e08)&&isNotNull(_0x1c3e08[0x0])){if(_0x1c3e08[0x0][_0x7d95('0x9e')]>0x0){_0x1aeb91[_0x7d95('0x3d')]=_0x7d95('0x9f');logger[_0x7d95('0x7e')](_0x7d95('0xa0')+_0x1aeb91[_0x7d95('0x3e')],_0x1c3e08[0x0][_0x7d95('0x9e')],'contacts');}else{_0x1aeb91['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x7d95('0x7e')](_0x7d95('0xa1')+_0x1aeb91[_0x7d95('0x3e')]);}}};}function notSendMessagesQueue(_0x198ec4){if(_0x198ec4['sendMessageOneNotActive']){freeVariablesPredictive(_0x198ec4);if(_0x198ec4[_0x7d95('0x70')]===0x0&&_0x198ec4[_0x7d95('0x51')]===0x0&&_0x198ec4[_0x7d95('0x55')]===0x0&&(_0x198ec4[_0x7d95('0x4e')]||0x0)===0x0){_0x198ec4['sendMessageOneNotActive']=![];_0x198ec4[_0x7d95('0x4c')]=0x0;_0x198ec4[_0x7d95('0x3d')]=_0x7d95('0x3f');loggerSyncQueueSummary[_0x7d95('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x198ec4[_0x7d95('0x3e')],_0x7d95('0xa2'));}else{_0x198ec4[_0x7d95('0x3d')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x7d95('0x98')](_0x7d95('0xa3'),_0x198ec4[_0x7d95('0x3e')],_0x7d95('0xa4'));}emitVoiceQueueSummary(_0x198ec4);}}function notSendMessagesCampaign(_0x58e84e){if(_0x58e84e[_0x7d95('0xa5')]){if(_0x58e84e[_0x7d95('0x70')]===0x0){_0x58e84e[_0x7d95('0xa5')]=![];_0x58e84e[_0x7d95('0x3d')]=_0x7d95('0x3f');loggerSyncQueueSummary[_0x7d95('0x98')](_0x7d95('0xa6'),_0x58e84e[_0x7d95('0x3e')],_0x7d95('0xa2'));}else{_0x58e84e[_0x7d95('0x3d')]=_0x7d95('0xa7');loggerSyncQueueSummary[_0x7d95('0x98')](_0x7d95('0xa6'),_0x58e84e[_0x7d95('0x3e')],_0x7d95('0xa4'));}emitCampaignSummary(_0x58e84e);}}function createObjHistory(_0x4d3165,_0x3682c6,_0x45870a,_0xbcd41b,_0x2bb8b8){_0x4d3165[_0x7d95('0x3d')]=_0x45870a;var _0x42488e=new Action(_0x4d3165,_0x3682c6);var _0x3f1359=new History(_0x42488e);_0x3f1359[_0x7d95('0xa8')]=_0xbcd41b;_0x3f1359[_0x7d95('0xa9')]=_0x2bb8b8;_0x3f1359[_0x7d95('0xaa')]=_0x42488e[_0x7d95('0xab')];return _0x3f1359;}Dialer[_0x7d95('0xac')]['loopClearZombieChannels']=function(){var _0x6e5716=this;setInterval(function(){_0x6e5716[_0x7d95('0xad')](_0x6e5716[_0x7d95('0x27')],_0x7d95('0xae'));_0x6e5716[_0x7d95('0xad')](_0x6e5716[_0x7d95('0x25')],_0x7d95('0xaf'));},0x32c8);};Dialer[_0x7d95('0xac')]['clearZombieChannels']=function(_0x3fd7d8,_0x2e04ac){var _0x3ecdb3=this;for(var _0x4a8104 in _0x3fd7d8){if(typeof _0x3fd7d8[_0x4a8104]!==_0x7d95('0x9b')){this[_0x7d95('0xb0')][_0x7d95('0x1c')](function(){if(!_[_0x7d95('0xb1')](_0x3fd7d8[_0x4a8104])){return ami['Action']({'action':_0x7d95('0xb2'),'channel':_0x3fd7d8[_0x4a8104][_0x7d95('0xb3')]})[_0x7d95('0xb4')](function(_0x538bb1){if(_0x538bb1['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3fd7d8[_0x4a8104]&&_0x3fd7d8[_0x4a8104][_0x7d95('0x48')]!=='ivr'){_0x3ecdb3[_0x7d95('0xb5')](_0x3ecdb3[_0x7d95('0x1f')][_0x3fd7d8[_0x4a8104][_0x7d95('0xb6')]]);logger['error'](_0x7d95('0xb7'),_0x2e04ac,_0x4a8104,_0x3fd7d8[_0x4a8104][_0x7d95('0xb6')]);delete _0x3fd7d8[_0x4a8104];}if(_0x3fd7d8[_0x4a8104]&&_0x3fd7d8[_0x4a8104][_0x7d95('0x48')]===_0x7d95('0x7a')){_0x3ecdb3['updateOriginated'](_0x3ecdb3[_0x7d95('0x20')][_0x3fd7d8[_0x4a8104][_0x7d95('0xb6')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x2e04ac,_0x4a8104,_0x3fd7d8[_0x4a8104][_0x7d95('0xb6')]);delete _0x3fd7d8[_0x4a8104];}},0x2328);}});}});}}};Dialer[_0x7d95('0xac')]['countReScheduled']=function(_0x24f704){return BPromise[_0x7d95('0xb8')]()['then'](cmHopper['countReScheduled'](_0x24f704))[_0x7d95('0xb4')](loggerCatch(_0x7d95('0xb9')));};Dialer[_0x7d95('0xac')]['checkIsBlackList']=function(_0x4ffb93){return BPromise[_0x7d95('0xb8')]()['then'](cmHopperBlack['checkIsBlackList'](_0x4ffb93))[_0x7d95('0xb4')](loggerCatch(_0x7d95('0xba')));};Dialer[_0x7d95('0xac')][_0x7d95('0xbb')]=function(_0x26d8f5){return BPromise[_0x7d95('0xb8')]()[_0x7d95('0xbc')](cmHopperBlack[_0x7d95('0xbb')](_0x26d8f5))[_0x7d95('0xb4')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x7d95('0xac')][_0x7d95('0xbd')]=function(_0x24c4c5){return BPromise['resolve']()[_0x7d95('0xbc')](cmHopperHistory[_0x7d95('0xbe')](_0x24c4c5))['catch'](loggerCatch(_0x7d95('0xbf')));};Dialer[_0x7d95('0xac')][_0x7d95('0xc0')]=function(_0x374ac9){return BPromise[_0x7d95('0xb8')]()[_0x7d95('0xbc')](cmHopper[_0x7d95('0xc0')](_0x374ac9))[_0x7d95('0xb4')](loggerCatch(_0x7d95('0xc1')));};Dialer[_0x7d95('0xac')][_0x7d95('0xc2')]=function(_0x23f81e,_0x38f4f3,_0x2e2d4b){return BPromise['resolve']()[_0x7d95('0xbc')](cmHopper[_0x7d95('0xc2')](_0x23f81e,_0x38f4f3,_0x2e2d4b))[_0x7d95('0xb4')](loggerCatch(_0x7d95('0xc3')));};Dialer[_0x7d95('0xac')][_0x7d95('0xc4')]=function(_0x2899e2,_0x177f8a,_0x2bf542,_0x52c037,_0x4a123e){return BPromise[_0x7d95('0xb8')]()[_0x7d95('0xbc')](cmHopper[_0x7d95('0xc4')](_0x2899e2,_0x177f8a,_0x2bf542,_0x52c037))[_0x7d95('0xb4')](function(_0x5df8e8){_0x4a123e[_0x7d95('0xc5')]-=_0x2bf542;_0x4a123e[_0x7d95('0xc5')]=_0x4a123e[_0x7d95('0xc5')]>0x0?_0x4a123e['temp']:0x0;loggerCatch(_0x7d95('0xc6'))(_0x5df8e8);});};Dialer[_0x7d95('0xac')][_0x7d95('0xc7')]=function(_0x24bc36,_0x37b30b,_0x16e083,_0x183196){return BPromise[_0x7d95('0xb8')]()['then'](cmHopper[_0x7d95('0xc7')](_0x24bc36,_0x37b30b,_0x16e083))[_0x7d95('0xb4')](function(_0x1a09af){_0x183196[_0x7d95('0xc5')]-=_0x37b30b;_0x183196[_0x7d95('0xc5')]=_0x183196[_0x7d95('0xc5')]>0x0?_0x183196[_0x7d95('0xc5')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x1a09af);});};Dialer[_0x7d95('0xac')]['getVoiceQueueRtPauses']=function(_0x581534){return BPromise['resolve']()[_0x7d95('0xbc')](voiceQueueRt[_0x7d95('0xc8')](_0x581534))[_0x7d95('0xb4')](loggerCatch(_0x7d95('0xc9')));};Dialer['prototype'][_0x7d95('0xca')]=function(_0x244857){return BPromise[_0x7d95('0xb8')]()['then'](cmHopper['moveContactManagedDialer'](_0x244857))[_0x7d95('0xb4')](loggerCatch(_0x7d95('0xcb')));};Dialer[_0x7d95('0xac')][_0x7d95('0xcc')]=function(_0x1600d4){return BPromise[_0x7d95('0xb8')]()[_0x7d95('0xbc')](cmHopperHistory[_0x7d95('0xcc')](_0x1600d4))['catch'](loggerCatch(_0x7d95('0xcd')));};Dialer[_0x7d95('0xac')]['updateOriginated']=function(_0x2c1af0){if(!_[_0x7d95('0x3c')](_0x2c1af0)&&_0x2c1af0!==null){if(typeof _0x2c1af0[_0x7d95('0x70')]!==_0x7d95('0x9b')){if(_0x2c1af0[_0x7d95('0x70')]>0x0){_0x2c1af0['originated']-=0x1;}else{logger[_0x7d95('0x98')](_0x7d95('0xce'));}}}else{logger[_0x7d95('0x98')](_0x7d95('0xcf'));}};Dialer[_0x7d95('0xac')][_0x7d95('0xd0')]=function(_0x99c5f6,_0x1dca1b){var _0x1a36a4=this;return function(_0x14ee12){_0x1a36a4[_0x7d95('0xb5')](_0x1dca1b);logger[_0x7d95('0x98')](_0x99c5f6,util[_0x7d95('0x99')](_0x14ee12,{'showHidden':![],'depth':null}));};};Dialer[_0x7d95('0xac')][_0x7d95('0xd1')]=function(_0x3566a7,_0x5cd25c,_0x3229f8){var _0x4ee536={'state':0x19,'statedesc':_0x7d95('0xd2')};this['updateOriginated'](_0x5cd25c);this[_0x7d95('0xd3')](_[_0x7d95('0x8e')](_0x4ee536,_[_0x7d95('0xd4')](_0x3229f8,[_0x7d95('0xd5'),'ListId','UserId',_0x7d95('0xd6'),_0x7d95('0xd7')])),_0x7d95('0xd8'),_0x7d95('0xd9'));logger['error'](_0x3566a7);};Dialer[_0x7d95('0xac')][_0x7d95('0xda')]=function(_0x420dd3){return _0x420dd3===_0x7d95('0xdb');};Dialer[_0x7d95('0xac')][_0x7d95('0xdc')]=function(_0x2d2867){return!_['isUndefined'](_0x2d2867)&&_0x2d2867&&!_[_0x7d95('0x3c')](_0x2d2867[_0x7d95('0x3e')])&&!_[_0x7d95('0x3c')](_0x2d2867['active'])&&_0x2d2867[_0x7d95('0xdd')]&&(this[_0x7d95('0x22')][util['format'](_0x7d95('0xde'),_0x2d2867['name'])][_0x7d95('0xb2')]==='reachable'||this[_0x7d95('0x22')][util[_0x7d95('0x7b')](_0x7d95('0xde'),_0x2d2867[_0x7d95('0x3e')])][_0x7d95('0xb2')]===_0x7d95('0xdf'));};Dialer[_0x7d95('0xac')][_0x7d95('0xd3')]=function(_0x400383,_0x570d80,_0x39739e){this[_0x7d95('0xcc')](_0x400383)[_0x7d95('0xb4')](loggerCatch(_0x570d80));this[_0x7d95('0xca')](_0x400383)[_0x7d95('0xb4')](loggerCatch(_0x39739e));};Dialer[_0x7d95('0xac')][_0x7d95('0x36')]=function(_0xaa2906){var _0x358d6b=this['uniqueId'][_0xaa2906['uniqueid']];var _0x54c031;if(!_['isNil'](_0xaa2906)&&!_[_0x7d95('0xb1')](_0xaa2906[_0x7d95('0xe0')])&&!_[_0x7d95('0xb1')](_0xaa2906['variable'][_0x7d95('0xe1')])&&_0xaa2906[_0x7d95('0xe2')]===_0x7d95('0xe3')&&_0x358d6b){if(_0x358d6b['type']!==_0x7d95('0x7a')&&this[_0x7d95('0x1f')][_0x358d6b[_0x7d95('0xb6')]]['dialAMDActive']&&_0xaa2906['value']==='HANGUP'){delete this[_0x7d95('0x27')][_0xaa2906['uniqueid']];this[_0x7d95('0xb5')](this['voiceQueues'][_0x358d6b[_0x7d95('0xb6')]]);this['voiceQueues'][_0x358d6b['queue']][_0x7d95('0x5b')]+=0x1;this[_0x7d95('0x1f')][_0x358d6b[_0x7d95('0xb6')]][_0x7d95('0xe4')]+=0x1;_0x54c031=new Hangup(_0x358d6b,_0xaa2906);_0x54c031[_0x7d95('0xa8')]=0x12;_0x54c031[_0x7d95('0xa9')]=_0x7d95('0xe5');_0x54c031[_0x7d95('0xe6')]=_0x7d95('0xe7');ami['emit'](_0x7d95('0xe8'),ut[_0x7d95('0xe9')](_0x54c031,'amd'));this[_0x7d95('0xd3')](_0x54c031,'[syncHangupInAMD][createHistory]',_0x7d95('0xea'));}if(_0x358d6b[_0x7d95('0x48')]!==_0x7d95('0x7a')&&this[_0x7d95('0x1f')][_0x358d6b[_0x7d95('0xb6')]][_0x7d95('0xeb')]&&_0xaa2906[_0x7d95('0xec')]===_0x7d95('0xed')){var _0x3c0ee4=this;return new BPromise(function(_0x5f1432,_0xa4d2b4){delete _0x3c0ee4['uniqueId'][_0xaa2906[_0x7d95('0xee')]];_0x3c0ee4[_0x7d95('0xb5')](_0x3c0ee4[_0x7d95('0x1f')][_0x358d6b[_0x7d95('0xb6')]]);_0x3c0ee4[_0x7d95('0x1f')][_0x358d6b[_0x7d95('0xb6')]]['outboundAnswerCallsDay']+=0x1;_0x3c0ee4[_0x7d95('0x1f')][_0x358d6b['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x217ecf=_0x3c0ee4[_0x7d95('0x1f')][_0x358d6b[_0x7d95('0xb6')]];var _0x55c09c=new Hangup(_0x358d6b,_0xaa2906);_0x55c09c['state']=0x13;_0x55c09c[_0x7d95('0xa9')]='Machine';_0x55c09c['membername']=_0x7d95('0xe7');_0x55c09c[_0x7d95('0xef')]+=0x1;_0x55c09c[_0x7d95('0xf0')]+=0x1;_0x55c09c[_0x7d95('0xf1')]=!![];ami[_0x7d95('0xf2')](_0x7d95('0xe8'),ut[_0x7d95('0xe9')](_0x55c09c,_0x7d95('0xf1')));_0x3c0ee4[_0x7d95('0xcc')](_0x55c09c)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0xf3')));if(_0x55c09c[_0x7d95('0xf4')]+_0x55c09c['countcongestionretry']+_0x55c09c[_0x7d95('0xf5')]+_0x55c09c[_0x7d95('0xf6')]+_0x55c09c[_0x7d95('0xf7')]+_0x55c09c[_0x7d95('0xf8')]+_0x55c09c['countmachineretry']+_0x55c09c[_0x7d95('0xf9')]>=_0x217ecf[_0x7d95('0xfa')]){_0x3c0ee4['stateGlobal'](_0x55c09c,_0x5f1432,_0xa4d2b4,_0x7d95('0xfb'));}else{if(_0x55c09c[_0x7d95('0xef')]>=_0x217ecf['dialMachineMaxRetry']){_0x3c0ee4[_0x7d95('0xfc')](_0x55c09c,_0x5f1432,_0xa4d2b4,_0x7d95('0xfd'));}else{_0x3c0ee4[_0x7d95('0xc0')]({'active':![],'countmachineretry':_0x55c09c[_0x7d95('0xef')],'scheduledat':moment()['add'](_0x217ecf[_0x7d95('0xfe')],_0x7d95('0xff'))[_0x7d95('0x7b')](_0x7d95('0x100')),'ContactId':_0x55c09c[_0x7d95('0xd5')],'ListId':_0x55c09c[_0x7d95('0x101')],'VoiceQueueId':_0x55c09c[_0x7d95('0xd6')]||undefined,'CampaignId':_0x55c09c[_0x7d95('0xd7')]||undefined})['catch'](loggerCatch(_0x7d95('0x102')));_0x5f1432({'reschedule':0x1});}}});}if(_0x358d6b[_0x7d95('0x48')]==='ivr'&&this['campaigns'][_0x358d6b['queue']][_0x7d95('0xeb')]&&_0xaa2906[_0x7d95('0xec')]==='HANGUP'){delete this[_0x7d95('0x27')][_0xaa2906[_0x7d95('0xee')]];this[_0x7d95('0xb5')](this[_0x7d95('0x20')][_0x358d6b[_0x7d95('0xb6')]]);_0x54c031=new Hangup(_0x358d6b,_0xaa2906);_0x54c031[_0x7d95('0xa8')]=0x12;_0x54c031[_0x7d95('0xa9')]=_0x7d95('0xe5');_0x54c031[_0x7d95('0xe6')]=_0x7d95('0xe7');ami['emit'](_0x7d95('0xe8'),ut[_0x7d95('0xe9')](_0x54c031,_0x7d95('0xf1')));this[_0x7d95('0xd3')](_0x54c031,_0x7d95('0x103'),'[syncHangupInAMDIvr]');}if(_0x358d6b[_0x7d95('0x48')]==='ivr'&&this['campaigns'][_0x358d6b['queue']][_0x7d95('0xeb')]&&_0xaa2906['value']==='MACHINE'){var _0x3c0ee4=this;return new BPromise(function(_0x501b7a,_0x2afc0e){delete _0x3c0ee4[_0x7d95('0x27')][_0xaa2906[_0x7d95('0xee')]];_0x3c0ee4[_0x7d95('0xb5')](_0x3c0ee4[_0x7d95('0x20')][_0x358d6b[_0x7d95('0xb6')]]);_0x3c0ee4[_0x7d95('0x20')][_0x358d6b[_0x7d95('0xb6')]][_0x7d95('0x5b')]+=0x1;_0x3c0ee4['campaigns'][_0x358d6b[_0x7d95('0xb6')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x175599=_0x3c0ee4['campaigns'][_0x358d6b['queue']];var _0x2d491e=new Hangup(_0x358d6b,_0xaa2906);_0x2d491e['state']=0x13;_0x2d491e[_0x7d95('0xa9')]=_0x7d95('0x104');_0x2d491e['membername']=_0x7d95('0xe7');_0x2d491e[_0x7d95('0xef')]+=0x1;_0x2d491e[_0x7d95('0xf0')]+=0x1;_0x2d491e['amd']=!![];ami[_0x7d95('0xf2')](_0x7d95('0xe8'),ut[_0x7d95('0xe9')](_0x2d491e,_0x7d95('0xf1')));_0x3c0ee4[_0x7d95('0xcc')](_0x2d491e)[_0x7d95('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2d491e['countbusyretry']+_0x2d491e['countcongestionretry']+_0x2d491e[_0x7d95('0xf5')]+_0x2d491e['countnosuchnumberretry']+_0x2d491e[_0x7d95('0xf7')]+_0x2d491e[_0x7d95('0xf8')]+_0x2d491e[_0x7d95('0xef')]+_0x2d491e['countagentrejectretry']>=_0x175599[_0x7d95('0xfa')]){_0x3c0ee4[_0x7d95('0x105')](_0x2d491e,_0x501b7a,_0x2afc0e,_0x7d95('0xfb'));}else{if(_0x2d491e[_0x7d95('0xef')]>=_0x175599[_0x7d95('0x106')]){_0x3c0ee4['createStateFinal'](_0x2d491e,_0x501b7a,_0x2afc0e,_0x7d95('0xfd'));}else{_0x3c0ee4[_0x7d95('0xc0')]({'active':![],'countmachineretry':_0x2d491e[_0x7d95('0xef')],'scheduledat':moment()[_0x7d95('0x107')](_0x175599[_0x7d95('0xfe')],_0x7d95('0xff'))[_0x7d95('0x7b')](_0x7d95('0x100')),'ContactId':_0x2d491e['ContactId'],'ListId':_0x2d491e['ListId'],'VoiceQueueId':_0x2d491e[_0x7d95('0xd6')]||undefined,'CampaignId':_0x2d491e[_0x7d95('0xd7')]||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x102')));_0x501b7a({'reschedule':0x1});}}});}}};Dialer[_0x7d95('0xac')][_0x7d95('0x108')]=function(_0x51299a){var _0x5a4065=this[_0x7d95('0x27')][_0x51299a[_0x7d95('0xee')]];var _0x24f5b1=this;var _0x3d8810;if(_0x5a4065&&_0x5a4065[_0x7d95('0x48')]==='ivr'){delete this[_0x7d95('0x27')][_0x51299a[_0x7d95('0xee')]];this[_0x7d95('0xb5')](this['campaigns'][_0x5a4065['queue']]);this[_0x7d95('0x20')][_0x5a4065['queue']][_0x7d95('0x109')]+=0x1;_0x3d8810=new Hangup(_0x5a4065,_0x51299a);this[_0x7d95('0xcc')](_0x3d8810)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x10a')));this[_0x7d95('0xca')](_0x3d8810)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x10b')));}if(_0x5a4065&&_0x5a4065[_0x7d95('0x48')]!==_0x7d95('0x7a')&&isNotNull(this[_0x7d95('0x1f')][_0x5a4065[_0x7d95('0xb6')]][_0x7d95('0x10c')])){delete this[_0x7d95('0x27')][_0x51299a[_0x7d95('0xee')]];this[_0x7d95('0xb5')](this[_0x7d95('0x1f')][_0x5a4065[_0x7d95('0xb6')]]);this[_0x7d95('0x1f')][_0x5a4065['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x7d95('0x1f')][_0x5a4065[_0x7d95('0xb6')]][_0x7d95('0xe4')]+=0x1;_0x3d8810=new Hangup(_0x5a4065,_0x51299a);_0x3d8810[_0x7d95('0xa8')]=0x10;_0x3d8810['statedesc']=_0x7d95('0x10d');_0x3d8810['membername']=_0x7d95('0x10e');this[_0x7d95('0xcc')](_0x3d8810)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x10a')));this[_0x7d95('0xca')](_0x3d8810)['catch'](loggerCatch(_0x7d95('0x10b')));}if(_0x5a4065&&_0x5a4065[_0x7d95('0x48')]!==_0x7d95('0x7a')&&!isNotNull(this[_0x7d95('0x1f')][_0x5a4065[_0x7d95('0xb6')]][_0x7d95('0x10c')])){delete this[_0x7d95('0x27')][_0x51299a[_0x7d95('0xee')]];this[_0x7d95('0xb5')](this[_0x7d95('0x1f')][_0x5a4065[_0x7d95('0xb6')]]);this[_0x7d95('0x1f')][_0x5a4065['queue']][_0x7d95('0x10f')]+=0x1;_0x3d8810=new Hangup(_0x5a4065,_0x51299a);_0x3d8810[_0x7d95('0xa8')]=0xc;_0x3d8810[_0x7d95('0xa9')]=_0x51299a['cause-txt'];_0x3d8810['membername']=_0x7d95('0x110');this[_0x7d95('0xcc')](_0x3d8810)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x10a')));this[_0x7d95('0xca')](_0x3d8810)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x10b')));}};Dialer['prototype'][_0x7d95('0x31')]=function(_0x33885f){var _0x5fb20c=this[_0x7d95('0x27')][_0x33885f[_0x7d95('0xee')]];var _0x3f5334=this;if(this[_0x7d95('0x1f')][_0x33885f[_0x7d95('0xb6')]]){if(_0x5fb20c&&_0x5fb20c[_0x7d95('0x48')]!==_0x7d95('0x7a')){delete this[_0x7d95('0x27')][_0x33885f['uniqueid']];this[_0x7d95('0x1f')][_0x33885f[_0x7d95('0xb6')]]['outboundAnswerCallsDay']+=0x1;var _0x1e4c7d=new AgentComplete(_0x5fb20c,_0x33885f);if(_0x33885f['reason']===_0x7d95('0x111')){_0x1e4c7d[_0x7d95('0x112')]=this['voiceQueues'][_0x33885f[_0x7d95('0xb6')]][_0x7d95('0x113')]&&this['voiceQueues'][_0x33885f['queue']]['dialAgiAfterHangupAgent']?moment()[_0x7d95('0x7b')](_0x7d95('0x100')):undefined;}this[_0x7d95('0xcc')](_0x1e4c7d)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x114')));this['moveContactManagedDialer'](_0x1e4c7d)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x115')));}}};Dialer[_0x7d95('0xac')][_0x7d95('0x116')]=function(_0x173e88){if(this[_0x7d95('0x1f')][_0x173e88['queue']]){if(this[_0x7d95('0x27')][_0x173e88['uniqueid']]&&this[_0x7d95('0x27')][_0x173e88[_0x7d95('0xee')]][_0x7d95('0x48')]!==_0x7d95('0x7a')){this['updateOriginated'](this[_0x7d95('0x1f')][_0x173e88[_0x7d95('0xb6')]]);this[_0x7d95('0x27')][_0x173e88[_0x7d95('0xee')]][_0x7d95('0x117')]=moment()[_0x7d95('0x7b')](_0x7d95('0x100'));}}};Dialer[_0x7d95('0xac')]['queueCallerAbandonCreateState']=function(_0x299c49){this[_0x7d95('0xcc')](_0x299c49)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x114')));this[_0x7d95('0xca')](_0x299c49)['catch'](loggerCatch(_0x7d95('0x118')));};Dialer[_0x7d95('0xac')][_0x7d95('0x2e')]=function(_0xf29ace){var _0x459375=this[_0x7d95('0x27')][_0xf29ace[_0x7d95('0xee')]];var _0x57184a=this;if(this['voiceQueues'][_0xf29ace['queue']]){if(_0x459375&&_0x459375[_0x7d95('0x48')]!==_0x7d95('0x7a')){delete this[_0x7d95('0x27')][_0xf29ace[_0x7d95('0xee')]];this[_0x7d95('0xb5')](this['voiceQueues'][_0xf29ace[_0x7d95('0xb6')]]);_0x459375['droptime']=moment()[_0x7d95('0x7b')](_0x7d95('0x100'));var _0x1d06ac=new QueueCallerAbandon(_0x459375,_0xf29ace);if(getSeconds(_0x459375['droptime'],_0x459375[_0x7d95('0x119')])>=_0x459375['dialQueueTimeout']){this[_0x7d95('0x1f')][_0xf29ace[_0x7d95('0xb6')]][_0x7d95('0x68')]+=0x1;this[_0x7d95('0x1f')][_0xf29ace[_0x7d95('0xb6')]][_0x7d95('0x5f')]+=0x1;this['voiceQueues'][_0xf29ace[_0x7d95('0xb6')]][_0x7d95('0x6a')]+=0x1;_0x1d06ac[_0x7d95('0xa8')]=0xa;_0x1d06ac['statedesc']=_0x7d95('0x11a');_0x1d06ac[_0x7d95('0x11b')]=_0x7d95('0x11c');_0x1d06ac[_0x7d95('0x112')]=this['voiceQueues'][_0xf29ace[_0x7d95('0xb6')]]['dialQueueProject2']?moment()[_0x7d95('0x7b')](_0x7d95('0x100')):undefined;_0x1d06ac[_0x7d95('0xf7')]+=0x1;_0x1d06ac[_0x7d95('0xf0')]+=0x1;if(_0x1d06ac[_0x7d95('0xf7')]>=this['voiceQueues'][_0xf29ace[_0x7d95('0xb6')]][_0x7d95('0x11d')]){this[_0x7d95('0x11e')](_0x1d06ac);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x1d06ac[_0x7d95('0xf7')],'scheduledat':moment()[_0x7d95('0x107')](this[_0x7d95('0x1f')][_0xf29ace[_0x7d95('0xb6')]][_0x7d95('0x11f')],_0x7d95('0xff'))[_0x7d95('0x7b')](_0x7d95('0x100')),'ContactId':_0x459375[_0x7d95('0xd5')],'ListId':_0x459375[_0x7d95('0x101')],'VoiceQueueId':_0x459375[_0x7d95('0xd6')]||undefined,'CampaignId':_0x459375[_0x7d95('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x3bac81=new History(_0x1d06ac);_0x3bac81['state']=0xa;_0x3bac81[_0x7d95('0xa9')]=_0x7d95('0x11a');_0x3bac81[_0x7d95('0xab')]=moment()['format'](_0x7d95('0x100'));_0x3bac81[_0x7d95('0xaa')]=_0x3bac81[_0x7d95('0xab')];_0x3bac81[_0x7d95('0x120')]=_0x1d06ac['calleridname'];_0x3bac81[_0x7d95('0x121')]=_0x1d06ac[_0x7d95('0x121')];this[_0x7d95('0xcc')](_0x3bac81)[_0x7d95('0xb4')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x7d95('0x1f')][_0xf29ace['queue']][_0x7d95('0x67')]+=0x1;this[_0x7d95('0x1f')][_0xf29ace['queue']][_0x7d95('0x5e')]+=0x1;_0x1d06ac[_0x7d95('0xa8')]=0xb;_0x1d06ac[_0x7d95('0xa9')]=_0x7d95('0x122');_0x1d06ac['dropreason']=_0x7d95('0x123');_0x1d06ac[_0x7d95('0xf8')]+=0x1;_0x1d06ac[_0x7d95('0xf0')]+=0x1;if(_0x1d06ac['countabandonedretry']>=this[_0x7d95('0x1f')][_0xf29ace[_0x7d95('0xb6')]]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x1d06ac);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x1d06ac[_0x7d95('0xf8')],'scheduledat':moment()['add'](this[_0x7d95('0x1f')][_0xf29ace[_0x7d95('0xb6')]][_0x7d95('0x124')],_0x7d95('0xff'))['format'](_0x7d95('0x100')),'ContactId':_0x459375[_0x7d95('0xd5')],'ListId':_0x459375[_0x7d95('0x101')],'VoiceQueueId':_0x459375[_0x7d95('0xd6')]||undefined,'CampaignId':_0x459375['CampaignId']||undefined})['catch'](loggerCatch(_0x7d95('0x125')));var _0x3bac81=new History(_0x1d06ac);_0x3bac81[_0x7d95('0xa8')]=0xb;_0x3bac81[_0x7d95('0xa9')]=_0x7d95('0x122');_0x3bac81[_0x7d95('0xab')]=moment()['format'](_0x7d95('0x100'));_0x3bac81[_0x7d95('0xaa')]=_0x3bac81[_0x7d95('0xab')];_0x3bac81[_0x7d95('0x120')]=_0x1d06ac[_0x7d95('0x120')];_0x3bac81[_0x7d95('0x121')]=_0x1d06ac[_0x7d95('0x121')];this[_0x7d95('0xcc')](_0x3bac81)['catch'](loggerCatch(_0x7d95('0x126')));}}}}};Dialer[_0x7d95('0xac')][_0x7d95('0x34')]=function(_0x58623b){if(this[_0x7d95('0x25')][_0x58623b['uniqueid']]){this[_0x7d95('0x25')][_0x58623b[_0x7d95('0xee')]]['channel']=_0x58623b['channel'];}if(this['uniqueId'][_0x58623b['uniqueid']]){this[_0x7d95('0x27')][_0x58623b[_0x7d95('0xee')]][_0x7d95('0xb3')]=_0x58623b[_0x7d95('0xb3')];}};Dialer[_0x7d95('0xac')][_0x7d95('0x37')]=function(_0x41c9c6){if(strategy[this[_0x7d95('0x1f')][this[_0x7d95('0x25')][_0x41c9c6[_0x7d95('0x127')]][_0x7d95('0xb6')]][_0x7d95('0x4a')]]===_0x7d95('0x1b')){if(this['actions'][_0x41c9c6[_0x7d95('0x127')]]&&_['isNil'](this[_0x7d95('0x25')][_0x41c9c6['actionid']]['locked'])&&_0x41c9c6['status']==='1'&&_0x41c9c6[_0x7d95('0x128')]==='0'){if(this['agents'][_0x41c9c6['stateinterface']]){if(!this[_0x7d95('0x21')][_0x41c9c6['stateinterface']][_0x7d95('0x129')]){this[_0x7d95('0x21')][_0x41c9c6['stateinterface']][_0x7d95('0x129')]=!![];this[_0x7d95('0x25')][_0x41c9c6[_0x7d95('0x127')]]['locked']=!![];this[_0x7d95('0x25')][_0x41c9c6[_0x7d95('0x127')]]['stateinterface']=_0x41c9c6['stateinterface'];}}}}else if((strategy[this[_0x7d95('0x1f')][this[_0x7d95('0x25')][_0x41c9c6[_0x7d95('0x127')]][_0x7d95('0xb6')]][_0x7d95('0x4a')]]||_0x7d95('0x12a'))===_0x7d95('0x12a')){if(this['actions'][_0x41c9c6[_0x7d95('0x127')]]){if(this[_0x7d95('0x21')][_0x41c9c6[_0x7d95('0x12b')]]){this[_0x7d95('0x25')][_0x41c9c6[_0x7d95('0x127')]][_0x7d95('0x12b')]=_0x41c9c6[_0x7d95('0x12b')];if(_[_0x7d95('0xb1')](this['queueBooked'][this[_0x7d95('0x25')][_0x41c9c6[_0x7d95('0x127')]]['queue']])){this[_0x7d95('0x2b')][this[_0x7d95('0x25')][_0x41c9c6[_0x7d95('0x127')]]['queue']]=[];}this['queueBooked'][this[_0x7d95('0x25')][_0x41c9c6[_0x7d95('0x127')]][_0x7d95('0xb6')]][_0x7d95('0x12c')](_[_0x7d95('0x8e')](_[_0x7d95('0xd4')](this[_0x7d95('0x25')][_0x41c9c6[_0x7d95('0x127')]],['idHopper',_0x7d95('0x12b')]),{'status':_0x41c9c6[_0x7d95('0xb2')],'paused':_0x41c9c6[_0x7d95('0x128')]}));}}}};function unlockQueueStatus(_0x1b2ae0,_0x2bfc60){setTimeout(function(){if(_['isUndefined'](_0x1b2ae0[_0x7d95('0x12d')])){loggerBooked[_0x7d95('0x98')](_0x7d95('0x12e'),_0x2bfc60);}_0x1b2ae0['queueStatusComplete']=!![];loggerBooked[_0x7d95('0x7e')](_0x7d95('0x12f'),_0x2bfc60,JSON[_0x7d95('0x46')](_['pick'](_0x1b2ae0,[_0x7d95('0x3e'),_0x7d95('0x12d')])));},0x1f3);}Dialer['prototype'][_0x7d95('0x39')]=function(_0x317123){var _0xacbdc0=this;var _0x54e35e=_0xacbdc0['voiceQueues'][_0xacbdc0[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]][_0x7d95('0xb6')]];if(strategy[this[_0x7d95('0x1f')][this['actions'][_0x317123[_0x7d95('0x127')]][_0x7d95('0xb6')]][_0x7d95('0x4a')]]===_0x7d95('0x1b')){if(this[_0x7d95('0x25')][_0x317123['actionid']]&&this['actions'][_0x317123[_0x7d95('0x127')]]['stateinterface']){this[_0x7d95('0x94')][_0x7d95('0x130')](this[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]][_0x7d95('0x131')],this[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]][_0x7d95('0x12b')])[_0x7d95('0xb4')](function(_0x23928a){logger['error'](_0x7d95('0x132'),util[_0x7d95('0x99')](_0x23928a,{'showHidden':![],'depth':null}));})[_0x7d95('0x1e')](function(){_0xacbdc0[_0x7d95('0xb5')](_0xacbdc0['voiceQueues'][_0xacbdc0[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]][_0x7d95('0xb6')]]);_0xacbdc0[_0x7d95('0x21')][_0xacbdc0[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]][_0x7d95('0x12b')]]['locked']=![];delete _0xacbdc0[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]];unlockQueueStatus(_0x54e35e);});}else{this[_0x7d95('0xb5')](this[_0x7d95('0x1f')][this[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]][_0x7d95('0xb6')]]);this[_0x7d95('0xc0')]({'active':![],'ContactId':this[_0x7d95('0x25')][_0x317123['actionid']][_0x7d95('0xd5')],'ListId':this['actions'][_0x317123[_0x7d95('0x127')]][_0x7d95('0x101')],'VoiceQueueId':this[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]][_0x7d95('0xd6')]||undefined,'CampaignId':this[_0x7d95('0x25')][_0x317123['actionid']][_0x7d95('0xd7')]||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x133')));delete this[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]];unlockQueueStatus(_0x54e35e);}}else if((strategy[this['voiceQueues'][this['actions'][_0x317123[_0x7d95('0x127')]][_0x7d95('0xb6')]][_0x7d95('0x4a')]]||'rrmemory')===_0x7d95('0x12a')){var _0x28a88f;if(this['actions'][_0x317123['actionid']]&&!_[_0x7d95('0x44')](this[_0x7d95('0x2b')][this['actions'][_0x317123[_0x7d95('0x127')]][_0x7d95('0xb6')]])){if(this[_0x7d95('0x134')][_0xacbdc0[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]]['queue']]){this['queueBookedRR'][_0xacbdc0['actions'][_0x317123['actionid']]['queue']]=this[_0x7d95('0x134')][this[_0x7d95('0x25')][_0x317123['actionid']]['queue']]?this[_0x7d95('0x134')][this[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]][_0x7d95('0xb6')]]:this[_0x7d95('0x2b')][this[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]][_0x7d95('0xb6')]]?this[_0x7d95('0x2b')][this[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]]['queue']][_0x7d95('0x135')]||0x0:0x0;}this[_0x7d95('0x2b')][this[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]]['queue']][_0x7d95('0x135')]=this[_0x7d95('0x134')][this[_0x7d95('0x25')][_0x317123[_0x7d95('0x127')]][_0x7d95('0xb6')]];for(var _0x383a76=0x0;_0x383a76=0x0;})[_0x7d95('0xb4')](myreject(_0x14c0de)));}}else{_0x4f0bee[_0x7d95('0x12c')](ami[_0x7d95('0x14c')]({'action':'command','command':util[_0x7d95('0x7b')](_0x7d95('0x14e'),_0x1a359b,!_[_0x7d95('0x3c')](config[_0x7d95('0x148')][_0x1b217e])?_0x1b217e:'')})[_0x7d95('0xbc')](function(_0x59478d){return _0x59478d[_0x7d95('0x150')]['indexOf'](_0x7d95('0x152'))>=0x0;})[_0x7d95('0xb4')](myreject(_0x14c0de)));}BPromise[_0x7d95('0x153')](_0x4f0bee)[_0x7d95('0xbc')](function(_0x4286c7){var _0x12c8ae=_['some'](_0x4286c7);if(_0x12c8ae){return _0x5c3d0d(_0x12c8ae);}else{_0x3f4f49[_0x7d95('0x3d')]=_0x18a2c7?_0x7d95('0x154'):_0x7d95('0x155');return _0x14c0de(msgResponse(_0x7d95('0x156'),_0x7d95('0x144'),_0x7d95('0x157')+_0x18a2c7+'\x20'+_0x3b0364+_0x7d95('0x158')+util[_0x7d95('0x99')](_0x1a359b,{'showHidden':![],'depth':null})+_0x7d95('0x159')+_0x1b217e));}})[_0x7d95('0xb4')](function(_0x4b2a40){return _0x14c0de(msgResponse(_0x7d95('0x143'),_0x7d95('0x144'),JSON['stringify'](_0x4b2a40)));});});};Dialer[_0x7d95('0xac')][_0x7d95('0x15a')]=function(_0x5398d7){var _0x4212ce=this;return function(){switch(_0x5398d7[_0x7d95('0x57')]){case _0x7d95('0x15b'):freeVariablesPredictive(_0x5398d7);_0x4212ce[_0x7d95('0x15c')](_0x5398d7,0x1);break;case _0x7d95('0x15d'):freeVariablesPredictive(_0x5398d7);_0x4212ce[_0x7d95('0x15c')](_0x5398d7,_0x5398d7[_0x7d95('0x15e')]);break;case _0x7d95('0xa'):_0x4212ce[_0x7d95('0xa')](_0x5398d7);break;case _0x7d95('0x9'):freeVariablesPredictive(_0x5398d7);_0x4212ce[_0x7d95('0x15c')](_0x5398d7,0x1);break;default:freeVariablesPredictive(_0x5398d7);logger[_0x7d95('0x98')]('Queue',_0x5398d7[_0x7d95('0x3e')],_0x7d95('0x15f'));}};};Dialer[_0x7d95('0xac')]['launchHandleIvr']=function(_0x29f6f1){var _0x8fbb19=this;return function(){_0x8fbb19[_0x7d95('0x160')](_0x29f6f1);};};Dialer[_0x7d95('0xac')][_0x7d95('0xb')]=function(_0x22cd12){var _0x575cde=this;if(isNotPreview(_0x22cd12[_0x7d95('0x57')])){if(isVoiceQueueOutbound(_0x22cd12[_0x7d95('0x48')])&&isActive(_0x22cd12[_0x7d95('0x161')])){_0x22cd12[_0x7d95('0xa5')]=!![];BPromise[_0x7d95('0xb8')]()['then'](checkIsLoggedIn(_0x22cd12,_0x22cd12[_0x7d95('0x4d')]))[_0x7d95('0xbc')](checkIsActive(_0x22cd12,_0x22cd12['dialActive']))['then'](checkInterval(_0x22cd12))[_0x7d95('0xbc')](_0x575cde[_0x7d95('0x162')](_0x22cd12))[_0x7d95('0xbc')](_0x575cde[_0x7d95('0x141')](_0x22cd12['dialGlobalInterval'],_0x22cd12[_0x7d95('0x163')],_0x22cd12[_0x7d95('0x3e')],_0x22cd12))[_0x7d95('0xbc')](_0x575cde[_0x7d95('0x142')](_0x22cd12['Interval'],_0x22cd12[_0x7d95('0x163')],_0x22cd12['name'],_0x22cd12))[_0x7d95('0xbc')](_0x575cde[_0x7d95('0x15a')](_0x22cd12))['catch'](loggerCatchQueueSummary(_0x7d95('0x164'),_0x22cd12));}else{notSendMessagesQueue(_0x22cd12);}}else{freeVariablesPredictive(_0x22cd12);}};Dialer[_0x7d95('0xac')][_0x7d95('0x165')]=function(){var _0x2ab879=this;var _0x215fd2;for(var _0x297b35 in this[_0x7d95('0x20')]){if(typeof this[_0x7d95('0x20')][_0x297b35]!=='undefined'){_0x215fd2=this[_0x7d95('0x20')][_0x297b35];if(isCampaignIvr(_0x215fd2[_0x7d95('0x48')])&&isActive(_0x215fd2[_0x7d95('0xdd')])){_0x215fd2[_0x7d95('0xa5')]=!![];BPromise[_0x7d95('0xb8')]()[_0x7d95('0xbc')](checkIsActive(_0x215fd2,_0x215fd2[_0x7d95('0xdd')]))[_0x7d95('0xbc')](checkInterval(_0x215fd2))[_0x7d95('0xbc')](_0x2ab879[_0x7d95('0x162')](_0x215fd2))[_0x7d95('0xbc')](_0x2ab879['checkIfTime'](_0x215fd2[_0x7d95('0x166')],_0x215fd2[_0x7d95('0x163')],_0x215fd2['name'],_0x215fd2))[_0x7d95('0xbc')](_0x2ab879[_0x7d95('0x142')](_0x215fd2['Interval'],_0x215fd2[_0x7d95('0x163')],_0x215fd2[_0x7d95('0x3e')],_0x215fd2))[_0x7d95('0xbc')](_0x2ab879[_0x7d95('0x167')](_0x215fd2))[_0x7d95('0xb4')](loggerCatchQueueSummary(_0x7d95('0x168'),_0x215fd2));}else{notSendMessagesCampaign(_0x215fd2);}}}};function getCallerIdRandom(_0x4a6189,_0x196ef7){var _0x11f161;var _0x1e6939;var _0x4ae28c;if(_0x196ef7<=0x0){_0x196ef7=0x1;}_0x11f161=new RegExp(_0x7d95('0x169')+_0x196ef7+'}$');_0x1e6939=Math[_0x7d95('0x16a')](0xa,_0x196ef7-0x1);_0x4ae28c=Math['pow'](0xa,_0x196ef7)-0x1;return util[_0x7d95('0x7b')]('%s',_['replace'](_0x4a6189,_0x11f161,_['random'](_0x1e6939,_0x4ae28c)));}function extractCalleridName(_0x22f302){var _0x2d70ab=_0x22f302[_0x7d95('0x16b')](/"(.*?)"/);return _0x2d70ab?_0x2d70ab[0x1]:_0x22f302;}function extractCalleridNumber(_0x184c43){var _0x293e00=_0x184c43['match'](/<(.*?)>/);return _0x293e00?_0x293e00[0x1]:_0x184c43;}Dialer[_0x7d95('0xac')]['actionOriginate']=function(_0x14ff54,_0x4dcf0f){var _0x33fe28=this;var _0x38cfd8=uuid['v4']();this[_0x7d95('0x25')][_0x38cfd8]=new Action(_0x14ff54,_0x4dcf0f,_0x38cfd8);return new BPromise(function(_0x34263a,_0x5cb4b8){if(_[_0x7d95('0x3c')](_0x14ff54)&&typeof _0x14ff54!=='object'){return _0x5cb4b8(msgResponse(_0x7d95('0x16c'),_0x7d95('0x144'),_0x7d95('0x16d')));}if(_['isUndefined'](_0x4dcf0f['Contact']['phone'])||_0x4dcf0f[_0x7d95('0x16e')][_0x7d95('0x16f')]===null){return _0x5cb4b8(msgResponse(_0x7d95('0x16c'),_0x7d95('0x144'),_0x7d95('0x170')));}var _0x341c4e={'XMD-CALLERID':_0x33fe28[_0x7d95('0x25')][_0x38cfd8][_0x7d95('0x171')](),'XMD-AGI':_0x14ff54[_0x7d95('0x10c')]?util[_0x7d95('0x7b')](_0x7d95('0x172'),ipAgi,_0x14ff54['dialQueueProject']):_0x7d95('0x173'),'XMD-AGIAFTER':_0x14ff54[_0x7d95('0x113')]?util[_0x7d95('0x7b')](_0x7d95('0x172'),ipAgi,_0x14ff54['dialQueueProject2']):_0x7d95('0x173'),'XMD-QUEUE':_0x14ff54[_0x7d95('0x48')]===_0x7d95('0x49')?util[_0x7d95('0x7b')](_0x7d95('0x174'),_0x14ff54[_0x7d95('0x3e')],_0x14ff54['dialQueueOptions']||'',_0x14ff54['dialAgiAfterHangupAgent']?'c':'',_0x14ff54[_0x7d95('0x175')]||0x3):_0x7d95('0x173'),'XMD-CONTACTID':_0x4dcf0f[_0x7d95('0xd5')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x33fe28[_0x7d95('0x25')][_0x38cfd8][_0x7d95('0x171')](),'XMD-AMD':_0x14ff54[_0x7d95('0xeb')]?_0x7d95('0x176'):_0x7d95('0x173'),'XMD-DESTINATION':_0x7d95('0xe3')};if(_0x14ff54['dialAMDActive']){_0x341c4e[_0x7d95('0x177')]=_0x14ff54[_0x7d95('0x178')]||0x9c4;_0x341c4e[_0x7d95('0x179')]=_0x14ff54[_0x7d95('0x17a')]||0x5dc;_0x341c4e[_0x7d95('0x17b')]=_0x14ff54[_0x7d95('0x17c')]||0x320;_0x341c4e['XMD-AMDTOTALANALYSISTIME']=_0x14ff54['dialAMDTotalAnalysisTime']||0x1388;_0x341c4e[_0x7d95('0x17d')]=_0x14ff54[_0x7d95('0x17e')]||0x64;_0x341c4e[_0x7d95('0x17f')]=_0x14ff54[_0x7d95('0x180')]||0x32;_0x341c4e[_0x7d95('0x181')]=_0x14ff54['dialAMDMaximumNumberOfWords']||0x3;_0x341c4e[_0x7d95('0x182')]=_0x14ff54[_0x7d95('0x183')]||0x100;_0x341c4e[_0x7d95('0x184')]=_0x14ff54['dialAMDMaximumWordLength']||0x1388;}if(_0x14ff54[_0x7d95('0x48')]===_0x7d95('0x49')){_0x341c4e[_0x7d95('0x185')]=_0x4dcf0f['VoiceQueueId'];}else{_0x341c4e[_0x7d95('0x186')]=_0x4dcf0f[_0x7d95('0xd7')];}for(var _0x316e0f in _0x4dcf0f[_0x7d95('0x16e')]){if(typeof _0x4dcf0f['Contact'][_0x316e0f]!==_0x7d95('0x9b')){if(isNotNull(_0x4dcf0f['Contact'][_0x316e0f])&&_0x316e0f!=='id'&&_0x316e0f!==_0x7d95('0x187')&&_0x316e0f!==_0x7d95('0x188')&&_0x316e0f!==_0x7d95('0x189')){_0x341c4e[util[_0x7d95('0x7b')](_0x7d95('0x18a'),'XMD-',_[_0x7d95('0x18b')](_0x316e0f))]=_0x4dcf0f[_0x7d95('0x16e')][_0x316e0f];}}}var _0x1aa517=_0x33fe28[_0x7d95('0xdc')](_0x14ff54[_0x7d95('0x75')])?getCallerId(_0x14ff54[_0x7d95('0x75')]['callerid'],_0x14ff54[_0x7d95('0x58')],_0x14ff54[_0x7d95('0x18c')]>0x0?getCallerIdRandom(_0x14ff54[_0x7d95('0x18d')],_0x14ff54['dialRandomLastDigitCallerIdNumber']):_0x14ff54[_0x7d95('0x18d')]):getCallerId(_[_0x7d95('0xb1')](_0x14ff54[_0x7d95('0x18e')])?_0x14ff54[_0x7d95('0x75')]['callerid']:_0x14ff54[_0x7d95('0x18e')][_0x7d95('0x76')],_0x14ff54[_0x7d95('0x58')],_0x14ff54[_0x7d95('0x18c')]>0x0?getCallerIdRandom(_0x14ff54[_0x7d95('0x18d')],_0x14ff54['dialRandomLastDigitCallerIdNumber']):_0x14ff54[_0x7d95('0x18d')]);if(_0x1aa517){_0x341c4e['XMD-ORIGINATECALLERIDNAME']=_0x33fe28[_0x7d95('0x25')][_0x38cfd8][_0x7d95('0x18f')]=extractCalleridName(_0x1aa517);_0x341c4e[_0x7d95('0x190')]=_0x33fe28[_0x7d95('0x25')][_0x38cfd8]['originatecalleridnum']=extractCalleridNumber(_0x1aa517);}return ami[_0x7d95('0x14c')]({'actionid':_0x38cfd8,'action':_0x7d95('0x16c'),'channel':_0x33fe28['isTrunkReachable'](_0x14ff54['Trunk'])?util[_0x7d95('0x7b')](_0x7d95('0x191'),_0x14ff54[_0x7d95('0x75')][_0x7d95('0x3e')],isNotNull(_0x14ff54['dialPrefix'])?_0x14ff54['dialPrefix']['trim']()||'':'',_0x14ff54[_0x7d95('0x192')]>0x0?_0x4dcf0f[_0x7d95('0x16e')]['phone']['substring'](_0x14ff54['dialCutDigit']):_0x4dcf0f[_0x7d95('0x16e')][_0x7d95('0x16f')]):util[_0x7d95('0x7b')]('SIP/%s/%s%s',_[_0x7d95('0xb1')](_0x14ff54[_0x7d95('0x18e')])?_0x14ff54[_0x7d95('0x75')][_0x7d95('0x3e')]:_0x14ff54[_0x7d95('0x18e')]['name'],isNotNull(_0x14ff54['dialPrefix'])?_0x14ff54[_0x7d95('0x5a')]['trim']()||'':'',_0x14ff54[_0x7d95('0x192')]>0x0?_0x4dcf0f[_0x7d95('0x16e')]['phone'][_0x7d95('0x193')](_0x14ff54[_0x7d95('0x192')]):_0x4dcf0f[_0x7d95('0x16e')][_0x7d95('0x16f')]),'callerid':_0x1aa517,'Exten':'xcally-motion-dialer','Context':_0x7d95('0x194'),'Priority':'1','variable':_0x341c4e,'timeout':(_0x14ff54[_0x7d95('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x38cfd8})[_0x7d95('0xbc')](function(_0x567740){return _0x34263a(_0x567740);})['catch'](function(_0x19cd76){_0x14ff54['outboundOriginateFailureCallsDay']+=0x1;var _0x3760a3=new History(_0x33fe28[_0x7d95('0x25')][_0x38cfd8]);logger[_0x7d95('0x98')](util[_0x7d95('0x7b')](_0x7d95('0x195'),JSON[_0x7d95('0x46')](_0x19cd76)));_0x3760a3[_0x7d95('0xa8')]=0xe;_0x3760a3['statedesc']=_0x7d95('0x196');_0x3760a3['starttime']=moment()['format'](_0x7d95('0x100'));_0x3760a3[_0x7d95('0xaa')]=_0x3760a3[_0x7d95('0xab')];_0x33fe28['createHistory'](_0x3760a3)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x197')));_0x33fe28[_0x7d95('0xca')](_0x3760a3)['catch'](loggerCatch(_0x7d95('0x197')))[_0x7d95('0x1e')](function(){delete _0x33fe28[_0x7d95('0x25')][_0x38cfd8];return _0x5cb4b8(msgResponse(_0x7d95('0x16c'),_0x7d95('0x198'),_0x7d95('0x199')));});});});};Dialer['prototype'][_0x7d95('0x30')]=function(_0x55a258){var _0x2f780c=this['actions'][_0x55a258[_0x7d95('0x127')]];if(_0x2f780c){delete this[_0x7d95('0x25')][_0x55a258[_0x7d95('0x127')]];_0x2f780c['responsetime']=moment()['format'](_0x7d95('0x100'));var _0xcb0550=_0x2f780c[_0x7d95('0x48')]===_0x7d95('0x7a')?this['campaigns'][_0x2f780c[_0x7d95('0xb6')]]:this[_0x7d95('0x1f')][_0x2f780c[_0x7d95('0x19a')]()];if(!this[_0x7d95('0xda')](_0x55a258['response'])){this[_0x7d95('0xb5')](_0xcb0550);return this[_0x7d95('0x19b')](_0x2f780c,_0xcb0550,_0x55a258)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0x7d95('0x27')][_0x55a258['uniqueid']]=_0x2f780c;}};Dialer[_0x7d95('0xac')][_0x7d95('0x19c')]=function(_0x1020ef,_0x25dfe5,_0xf51dfa){var _0x1ecc4c=new History(_0x25dfe5);if(_0x1ecc4c[_0x7d95('0xf4')]+_0x1ecc4c[_0x7d95('0x19d')]+_0x1ecc4c['countnoanswerretry']+_0x1ecc4c['countnosuchnumberretry']+_0x1ecc4c[_0x7d95('0xf7')]+_0x1ecc4c[_0x7d95('0xf8')]+_0x1ecc4c['countmachineretry']+_0x1ecc4c[_0x7d95('0xf9')]>=_0xf51dfa[_0x7d95('0xfa')]-0x1){return!![];}switch(_0x1020ef){case 0x3:if(_0x1ecc4c[_0x7d95('0xf5')]>=_0xf51dfa[_0x7d95('0x19e')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x1ecc4c[_0x7d95('0xf5')]+=0x1,'scheduledat':moment()[_0x7d95('0x107')](_0xf51dfa[_0x7d95('0x19f')],'minutes')[_0x7d95('0x7b')](_0x7d95('0x100')),'ContactId':_0x1ecc4c['ContactId'],'ListId':_0x1ecc4c[_0x7d95('0x101')],'VoiceQueueId':_0x1ecc4c[_0x7d95('0xd6')]||undefined,'CampaignId':_0x1ecc4c['CampaignId']||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x1a0')));break;case 0x5:if(_0x1ecc4c[_0x7d95('0xf4')]>=_0xf51dfa[_0x7d95('0x1a1')]-0x1){return!![];}this[_0x7d95('0xc0')]({'active':![],'countbusyretry':_0x1ecc4c[_0x7d95('0xf4')]+=0x1,'scheduledat':moment()['add'](_0xf51dfa[_0x7d95('0x1a2')],_0x7d95('0xff'))[_0x7d95('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ecc4c[_0x7d95('0xd5')],'ListId':_0x1ecc4c[_0x7d95('0x101')],'VoiceQueueId':_0x1ecc4c['VoiceQueueId']||undefined,'CampaignId':_0x1ecc4c['CampaignId']||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x1a3')));break;case 0x8:if(_0x1ecc4c[_0x7d95('0x19d')]>=_0xf51dfa['dialCongestionMaxRetry']-0x1){return!![];}this[_0x7d95('0xc0')]({'active':![],'countcongestionretry':_0x1ecc4c[_0x7d95('0x19d')]+=0x1,'scheduledat':moment()['add'](_0xf51dfa['dialCongestionRetryFrequency'],_0x7d95('0xff'))[_0x7d95('0x7b')](_0x7d95('0x100')),'ContactId':_0x1ecc4c['ContactId'],'ListId':_0x1ecc4c[_0x7d95('0x101')],'VoiceQueueId':_0x1ecc4c[_0x7d95('0xd6')]||undefined,'CampaignId':_0x1ecc4c['CampaignId']||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x1a4')));break;case 0x0:if(_0x1ecc4c[_0x7d95('0xf6')]>=_0xf51dfa['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x7d95('0xc0')]({'active':![],'countnosuchnumberretry':_0x1ecc4c['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x7d95('0x107')](_0xf51dfa[_0x7d95('0x1a5')],'minutes')['format'](_0x7d95('0x100')),'ContactId':_0x1ecc4c[_0x7d95('0xd5')],'ListId':_0x1ecc4c['ListId'],'VoiceQueueId':_0x1ecc4c[_0x7d95('0xd6')]||undefined,'CampaignId':_0x1ecc4c[_0x7d95('0xd7')]||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x1a6')));}break;case 0xa:if(_0x1ecc4c['countdropretry']>=_0xf51dfa[_0x7d95('0x11d')]-0x1){return!![];}this[_0x7d95('0xc0')]({'active':![],'countdropretry':_0x1ecc4c[_0x7d95('0xf7')]+=0x1,'scheduledat':moment()['add'](_0xf51dfa[_0x7d95('0x11f')],_0x7d95('0xff'))[_0x7d95('0x7b')](_0x7d95('0x100')),'ContactId':_0x1ecc4c[_0x7d95('0xd5')],'ListId':_0x1ecc4c[_0x7d95('0x101')],'VoiceQueueId':_0x1ecc4c['VoiceQueueId']||undefined,'CampaignId':_0x1ecc4c['CampaignId']||undefined})[_0x7d95('0xb4')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1ecc4c[_0x7d95('0xf8')]>=_0xf51dfa['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x7d95('0xc0')]({'active':![],'countabandonedretry':_0x1ecc4c[_0x7d95('0xf8')]+=0x1,'scheduledat':moment()[_0x7d95('0x107')](_0xf51dfa[_0x7d95('0x124')],_0x7d95('0xff'))['format'](_0x7d95('0x100')),'ContactId':_0x1ecc4c[_0x7d95('0xd5')],'ListId':_0x1ecc4c['ListId'],'VoiceQueueId':_0x1ecc4c[_0x7d95('0xd6')]||undefined,'CampaignId':_0x1ecc4c[_0x7d95('0xd7')]||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x125')));break;case 0x13:if(_0x1ecc4c[_0x7d95('0xef')]>=_0xf51dfa[_0x7d95('0x106')]-0x1){return!![];}this[_0x7d95('0xc0')]({'active':![],'countmachineretry':_0x1ecc4c['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0xf51dfa[_0x7d95('0xfe')],_0x7d95('0xff'))['format'](_0x7d95('0x100')),'ContactId':_0x1ecc4c[_0x7d95('0xd5')],'ListId':_0x1ecc4c[_0x7d95('0x101')],'VoiceQueueId':_0x1ecc4c[_0x7d95('0xd6')]||undefined,'CampaignId':_0x1ecc4c[_0x7d95('0xd7')]||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x102')));break;case 0x14:if(_0x1ecc4c[_0x7d95('0xf9')]>=_0xf51dfa[_0x7d95('0x1a7')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x1ecc4c[_0x7d95('0xf9')]+=0x1,'scheduledat':moment()[_0x7d95('0x107')](_0xf51dfa[_0x7d95('0x1a8')],_0x7d95('0xff'))[_0x7d95('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ecc4c[_0x7d95('0xd5')],'ListId':_0x1ecc4c[_0x7d95('0x101')],'VoiceQueueId':_0x1ecc4c['VoiceQueueId']||undefined,'CampaignId':_0x1ecc4c[_0x7d95('0xd7')]||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x1a9')));break;default:return!![];}};Dialer['prototype'][_0x7d95('0x19b')]=function(_0x3d0b4f,_0x16aa15,_0x1d943c){var _0x52810f=this;var _0x22a1a7=new History(_0x3d0b4f);return new BPromise(function(_0x3a0cf9,_0x482f1a){if(_[_0x7d95('0x3c')](_0x16aa15)&&typeof _0x16aa15!==_0x7d95('0x1aa')){return _0x482f1a(msgResponse(_0x7d95('0x1ab'),'Failure','entity\x20is\x20undefine'));}if(_[_0x7d95('0x3c')](_0x1d943c)&&typeof _0x1d943c!==_0x7d95('0x1aa')){return _0x482f1a(msgResponse(_0x7d95('0x1ab'),_0x7d95('0x144'),_0x7d95('0x1ac')));}switch(_0x1d943c['reason']){case'0':_0x16aa15[_0x7d95('0x61')]+=0x1;_0x22a1a7[_0x7d95('0xa8')]=0x0;_0x22a1a7[_0x7d95('0xa9')]=_0x7d95('0x1ad');_0x22a1a7['countnosuchnumberretry']+=0x1;_0x22a1a7[_0x7d95('0xf0')]+=0x1;ami[_0x7d95('0xf2')](_0x7d95('0x1ae'),ut[_0x7d95('0xe9')](_0x3d0b4f,_0x7d95('0x1af')));_0x52810f[_0x7d95('0xcc')](_0x22a1a7)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0xf3')));if(_0x52810f[_0x7d95('0x19c')](0x0,_0x3d0b4f,_0x16aa15)){if(_0x22a1a7['countnosuchnumberretry']>=_0x16aa15[_0x7d95('0x1b0')]){_0x52810f['createStateFinal'](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1b1'));}else{_0x52810f[_0x7d95('0x105')](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1b1'));}}break;case'3':_0x16aa15[_0x7d95('0x60')]+=0x1;_0x22a1a7[_0x7d95('0xa8')]=0x3;_0x22a1a7[_0x7d95('0xa9')]=_0x7d95('0x1b2');_0x22a1a7[_0x7d95('0xf5')]+=0x1;_0x22a1a7['countglobal']+=0x1;ami[_0x7d95('0xf2')]('custom:agentnoanswer',ut[_0x7d95('0xe9')](_0x3d0b4f,_0x7d95('0x1b3')));_0x52810f['createHistory'](_0x22a1a7)[_0x7d95('0xb4')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x52810f['checkRetriveMax'](0x3,_0x3d0b4f,_0x16aa15)){if(_0x22a1a7['countnoanswerretry']>=_0x16aa15[_0x7d95('0x19e')]){_0x52810f['createStateFinal'](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1b4'));}else{_0x52810f['stateGlobal'](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1b4'));}}break;case'5':_0x16aa15['outboundBusyCallsDay']+=0x1;_0x22a1a7[_0x7d95('0xa8')]=0x5;_0x22a1a7[_0x7d95('0xa9')]=_0x7d95('0x1b5');_0x22a1a7[_0x7d95('0xf4')]+=0x1;_0x22a1a7[_0x7d95('0xf0')]+=0x1;ami[_0x7d95('0xf2')]('custom:agentbusy',ut[_0x7d95('0xe9')](_0x3d0b4f,_0x7d95('0x1b6')));_0x52810f[_0x7d95('0xcc')](_0x22a1a7)['catch'](loggerCatch(_0x7d95('0x1b7')));if(_0x52810f['checkRetriveMax'](0x5,_0x3d0b4f,_0x16aa15)){if(_0x22a1a7['countbusyretry']>=_0x16aa15['dialBusyMaxRetry']){_0x52810f[_0x7d95('0xfc')](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1b8'));}else{_0x52810f['stateGlobal'](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1b8'));}}break;case'8':_0x16aa15['outboundCongestionCallsDay']+=0x1;_0x22a1a7[_0x7d95('0xa8')]=0x8;_0x22a1a7[_0x7d95('0xa9')]=_0x7d95('0x1b9');_0x22a1a7[_0x7d95('0x19d')]+=0x1;_0x22a1a7['countglobal']+=0x1;ami[_0x7d95('0xf2')](_0x7d95('0x1ba'),ut[_0x7d95('0xe9')](_0x3d0b4f,_0x7d95('0x1bb')));_0x52810f[_0x7d95('0xcc')](_0x22a1a7)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x1bc')));if(_0x52810f[_0x7d95('0x19c')](0x8,_0x3d0b4f,_0x16aa15)){if(_0x22a1a7[_0x7d95('0x19d')]>=_0x16aa15[_0x7d95('0x1bd')]){_0x52810f[_0x7d95('0xfc')](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1be'));}else{_0x52810f[_0x7d95('0x105')](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1be'));}}break;case'11':_0x16aa15[_0x7d95('0x1bf')]+=0x1;_0x22a1a7['state']=0xb;_0x22a1a7[_0x7d95('0xa9')]=_0x7d95('0x122');_0x22a1a7[_0x7d95('0xf8')]+=0x1;_0x22a1a7[_0x7d95('0xf0')]+=0x1;_0x52810f[_0x7d95('0xcc')](_0x22a1a7)['catch'](loggerCatch(_0x7d95('0x126')));if(_0x52810f[_0x7d95('0x19c')](0xb,_0x3d0b4f,_0x16aa15)){if(_0x22a1a7[_0x7d95('0xf8')]>=_0x16aa15[_0x7d95('0x1c0')]){_0x52810f[_0x7d95('0xfc')](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1c1'));}else{_0x52810f[_0x7d95('0x105')](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1c1'));}}break;case'20':_0x16aa15[_0x7d95('0x64')]+=0x1;_0x22a1a7[_0x7d95('0xa8')]=0x14;_0x22a1a7[_0x7d95('0xa9')]='AgentReject';_0x22a1a7[_0x7d95('0xf9')]+=0x1;_0x22a1a7[_0x7d95('0xf0')]+=0x1;ami[_0x7d95('0xf2')](_0x7d95('0x1c2'),ut['buildObj'](_0x3d0b4f,_0x7d95('0x1c3')));_0x52810f['createHistory'](_0x22a1a7)[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x1c4')));if(_0x52810f['checkRetriveMax'](0x14,_0x3d0b4f,_0x16aa15)){if(_0x22a1a7[_0x7d95('0xf9')]>=_0x16aa15[_0x7d95('0x1a7')]){_0x52810f[_0x7d95('0xfc')](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1c5'));}else{_0x52810f[_0x7d95('0x105')](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x7d95('0x1c5'));}}break;default:_0x16aa15[_0x7d95('0x10f')]+=0x1;_0x22a1a7['state']=0xc;_0x22a1a7['statedesc']=_0x1d943c[_0x7d95('0x1c6')];_0x52810f[_0x7d95('0xcc')](_0x22a1a7)['catch'](loggerCatch(_0x7d95('0x1c7')));if(_0x52810f[_0x7d95('0x19c')](_0x1d943c[_0x7d95('0x1c6')],_0x3d0b4f,_0x16aa15)){if(_0x22a1a7[_0x7d95('0xf4')]+_0x22a1a7[_0x7d95('0x19d')]+_0x22a1a7[_0x7d95('0xf5')]+_0x22a1a7['countnosuchnumberretry']+_0x22a1a7[_0x7d95('0xf7')]+_0x22a1a7[_0x7d95('0xf8')]+_0x22a1a7['countmachineretry']+_0x22a1a7[_0x7d95('0xf9')]>=_0x16aa15[_0x7d95('0xfa')]){_0x52810f[_0x7d95('0x105')](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x1d943c[_0x7d95('0x1c6')]);}else{_0x52810f[_0x7d95('0xfc')](_0x22a1a7,_0x3a0cf9,_0x482f1a,_0x1d943c[_0x7d95('0x1c6')]);}}}});};Dialer['prototype'][_0x7d95('0x105')]=function(_0x27244e,_0x309f2b,_0x10c72b,_0x48d153){var _0x5c2016=new Final(_0x27244e);_0x5c2016['state']=0xf;_0x5c2016[_0x7d95('0xa9')]=_0x7d95('0x1c8');this[_0x7d95('0xfc')](_0x5c2016,_0x309f2b,_0x10c72b,_0x48d153);};Dialer[_0x7d95('0xac')][_0x7d95('0xfc')]=function(_0x57a1b6,_0x265514,_0x2b9326,_0xc1c290){this[_0x7d95('0xca')](_0x57a1b6)[_0x7d95('0xbc')](function(){return _0x265514(msgResponse(_0x7d95('0x1ab'),_0x7d95('0xdb'),_0xc1c290));})[_0x7d95('0xb4')](function(){return _0x2b9326(msgResponse(_0x7d95('0x1c9'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x7d95('0xac')][_0x7d95('0xa')]=function(_0x4492c7){var _0x5a9391=_0x4492c7['dialPredictiveOptimizationPercentage']/0x64;var _0x41634e=_0x4492c7['outboundDropCallsDayTimeout']/(_0x4492c7[_0x7d95('0x5f')]+_0x4492c7['outboundAnswerCallsDay']);var _0x464c74=Math[_0x7d95('0x1ca')](_0x4492c7[_0x7d95('0x6e')]*(_0x4492c7[_0x7d95('0x1cb')]/0x64));var _0x5c4a38=Math['round'](_0x4492c7[_0x7d95('0x6e')]*(_0x4492c7[_0x7d95('0x1cc')]/0x64));var _0x2813cd=_0x4492c7['available']+_0x4492c7[_0x7d95('0x51')];var _0x39ac51=Math[_0x7d95('0x1cd')](_0x4492c7[_0x7d95('0x71')]*_0x4492c7['erlangAbandonmentRate']*_0x4492c7[_0x7d95('0x6b')]*_0x4492c7['predictiveIntervalMultiplicativeFactor']);if(_[_0x7d95('0x3c')](_0x4492c7['startProgressive'])){if(!_[_0x7d95('0x3c')](_0x4492c7[_0x7d95('0x29')])){_0x4492c7[_0x7d95('0x29')]=undefined;loggerPredictive[_0x7d95('0x98')](_0x7d95('0x1ce'),_0x7d95('0x1cf'));}if(!_['isUndefined'](_0x4492c7[_0x7d95('0x92')])){loggerPredictive['error'](_0x7d95('0x1ce'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x4492c7[_0x7d95('0x92')]);_0x4492c7[_0x7d95('0x92')]=undefined;}_0x4492c7['startProgressive']=moment()[_0x7d95('0x7b')](_0x7d95('0x100'));loggerPredictive[_0x7d95('0x7e')](_0x4492c7['name'],_0x7d95('0x1d0'),_0x4492c7['startProgressive']);this['handlePower'](_0x4492c7,0x1);}else if(ifInterval(_0x4492c7[_0x7d95('0x1d1')],_0x4492c7[_0x7d95('0x2a')])){this[_0x7d95('0x15c')](_0x4492c7,0x1);loggerPredictiveCalls[_0x7d95('0x7e')](_0x7d95('0x1d2'),_0x4492c7[_0x7d95('0x2a')],_0x4492c7[_0x7d95('0x3e')]);_0x4492c7['erlangCalls']=0x0;_0x4492c7[_0x7d95('0x6a')]=0x0;}else if(_0x5a9391<_0x41634e&&_0x4492c7[_0x7d95('0x1d3')]===_0x7d95('0x1d4')){freeVariablesPredictive(_0x4492c7);loggerPredictive['info'](_0x7d95('0x1d5'),'Dropped\x20calls\x20day',_0x41634e,_0x7d95('0x2a'),_0x4492c7[_0x7d95('0x3e')]);}else if(_0x39ac51<_0x4492c7[_0x7d95('0x6a')]&&_0x4492c7[_0x7d95('0x1d3')]===_0x7d95('0x1d4')){freeVariablesPredictive(_0x4492c7);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x1d6'),_0x7d95('0x1d7'),_0x39ac51,_0x7d95('0x1d8'),_0x4492c7[_0x7d95('0x6a')],_0x7d95('0x2a'),_0x4492c7[_0x7d95('0x3e')]);}else if(!ifInterval(_0x4492c7[_0x7d95('0x1d1')],_0x4492c7[_0x7d95('0x2a')])&&_[_0x7d95('0x3c')](_0x4492c7[_0x7d95('0x29')])&&!_[_0x7d95('0x3c')](_0x4492c7['startProgressive'])){_0x4492c7[_0x7d95('0x29')]=moment()[_0x7d95('0x7b')](_0x7d95('0x100'));loggerPredictive[_0x7d95('0x7e')](_0x4492c7['name'],_0x7d95('0x1d9'),_0x4492c7[_0x7d95('0x29')]);this[_0x7d95('0xbd')](_0x4492c7[_0x7d95('0x1d1')])['then'](this[_0x7d95('0x1da')](_0x4492c7))['then'](mergeDataErlangB(_0x4492c7))[_0x7d95('0xbc')](this[_0x7d95('0x1db')](_0x4492c7))[_0x7d95('0xb4')](loggerCatchPredictive(_0x7d95('0x1dc'),_0x4492c7));}else if(!ifInterval(_0x4492c7[_0x7d95('0x1d1')],_0x4492c7[_0x7d95('0x29')])){_0x4492c7[_0x7d95('0x6a')]=0x0;_0x4492c7[_0x7d95('0x29')]=moment()['format'](_0x7d95('0x100'));loggerPredictive['info'](_0x4492c7[_0x7d95('0x3e')],'recalculate\x20predictive\x20at',_0x4492c7[_0x7d95('0x29')]);clearInterval(_0x4492c7[_0x7d95('0x92')]);_0x4492c7[_0x7d95('0x92')]=undefined;this[_0x7d95('0xbd')](_0x4492c7['dialPredictiveInterval'])[_0x7d95('0xbc')](this[_0x7d95('0x1da')](_0x4492c7))[_0x7d95('0xbc')](mergeDataErlangB(_0x4492c7))[_0x7d95('0xbc')](this[_0x7d95('0x1db')](_0x4492c7))[_0x7d95('0xb4')](loggerCatchPredictive(_0x7d95('0x1dd'),_0x4492c7));}else if(_0x4492c7[_0x7d95('0x6e')]&&_0x2813cd<_0x4492c7[_0x7d95('0x6e')]-_0x5c4a38){freeVariablesPredictive(_0x4492c7);loggerPredictive[_0x7d95('0x7e')](_0x4492c7['name'],_0x7d95('0x1de'),_0x2813cd,_0x7d95('0x1df'),_0x4492c7['predictiveIntervalAvailable'],'-',_0x5c4a38,'=',_0x4492c7[_0x7d95('0x6e')]-_0x5c4a38,')');}else if(_0x4492c7[_0x7d95('0x6e')]&&_0x2813cd>_0x4492c7[_0x7d95('0x6e')]+_0x464c74){freeVariablesPredictive(_0x4492c7);loggerPredictive[_0x7d95('0x7e')](_0x4492c7['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2813cd,_0x7d95('0x1e0'),_0x4492c7[_0x7d95('0x6e')],'+',_0x464c74,'=',_0x4492c7[_0x7d95('0x6e')]+_0x464c74,')');}};Dialer[_0x7d95('0xac')][_0x7d95('0x1da')]=function(_0x48bef4){var _0x3d1601=this;return function(_0x1fdb54){return new BPromise(function(_0x317b22,_0x16849a){_[_0x7d95('0x8e')](_0x48bef4,_0x1fdb54[0x0]);if(checkGetDataPredictive(_0x1fdb54[0x0])){var _0x1740bf=_0x48bef4[_0x7d95('0x6e')]=_0x48bef4[_0x7d95('0x51')]+_0x48bef4[_0x7d95('0x4c')];var _0x414a29=_0x48bef4[_0x7d95('0x1d1')]*0x3c;var _0x2b1fa5=_0x1fdb54[0x0][_0x7d95('0x66')]+_0x1fdb54[0x0][_0x7d95('0x85')];var _0x400953=(_0x1fdb54[0x0]['predictiveIntervalAnsweredCalls']+_0x1fdb54[0x0][_0x7d95('0x68')]+_0x1fdb54[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1fdb54[0x0][_0x7d95('0x6f')];_0x48bef4[_0x7d95('0x6b')]=_0x400953>0x0?_0x400953:0x1;switch(_0x48bef4[_0x7d95('0x1d3')]){case _0x7d95('0x1d4'):var _0x11a681=_0x48bef4[_0x7d95('0x1e1')]/0x64;return _0x3d1601[_0x7d95('0x1e2')](_0x1740bf,_0x414a29,_0x2b1fa5,_0x400953,_0x11a681)[_0x7d95('0xbc')](function(_0x57e956){return _0x317b22(_0x57e956);});case _0x7d95('0x1e3'):var _0x47eac8=_0x48bef4[_0x7d95('0x1e1')]/0x64;return _0x3d1601[_0x7d95('0x1e4')](_0x1740bf,_0x414a29,_0x2b1fa5,_0x400953,_0x47eac8)[_0x7d95('0xbc')](function(_0x3a035d){return _0x317b22(_0x3a035d);});default:return _0x16849a(msgResponse(_0x7d95('0x1e5'),_0x7d95('0x144'),_0x7d95('0x1e6')));}}else{return _0x16849a(msgResponse('[getDataPredictive]','Failure',_0x7d95('0x1e7')));}});};};Dialer[_0x7d95('0xac')][_0x7d95('0x1e8')]=function(_0x573ed8){var _0x1fa00e=this;return function(_0x13b65d){return new BPromise(function(_0x5cd741,_0x396a4b){_[_0x7d95('0x8e')](_0x573ed8,_0x13b65d[0x0]);if(checkGetDataPredictive(_0x13b65d[0x0])){loggerPredictive[_0x7d95('0x7e')](JSON[_0x7d95('0x46')](_0x13b65d[0x0]));if(_0x573ed8[_0x7d95('0x1d3')]===_0x7d95('0x1d4')){return _0x1fa00e[_0x7d95('0xc8')](_0x573ed8['id'])[_0x7d95('0xbc')](function(_0x2f4953){var _0x2cdd51=_0x573ed8[_0x7d95('0x4d')]-_0x2f4953[0x0][_0x7d95('0x1e9')];var _0x1342d4=_0x573ed8[_0x7d95('0x1d1')]*0x3c;var _0x44d425=_0x13b65d[0x0]['predictiveIntervalAvgTalktime']+_0x13b65d[0x0][_0x7d95('0x85')];var _0x47141e=(_0x13b65d[0x0]['predictiveIntervalAnsweredCalls']+_0x13b65d[0x0][_0x7d95('0x68')]+_0x13b65d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x13b65d[0x0]['predictiveIntervalTotalCalls'];var _0x57f73b=_0x573ed8[_0x7d95('0x1e1')]/0x64;_0x573ed8[_0x7d95('0x6d')]=_0x2f4953[0x0][_0x7d95('0x1e9')]||0x0;_0x573ed8[_0x7d95('0x6b')]=_0x47141e>0x0?_0x47141e:0x1;return _0x1fa00e[_0x7d95('0x1e2')](_0x2cdd51,_0x1342d4,_0x44d425,_0x47141e,_0x57f73b);})['then'](function(_0x2f9f50){return _0x5cd741(_0x2f9f50);})[_0x7d95('0xb4')](function(_0x5f105c){return _0x396a4b(msgResponse(_0x7d95('0x1ea'),_0x7d95('0x144'),JSON[_0x7d95('0x46')](_0x5f105c)));});}if(_0x573ed8[_0x7d95('0x1d3')]==='agentBusyFactor'){return _0x1fa00e[_0x7d95('0xc8')](_0x573ed8['id'])[_0x7d95('0xbc')](function(_0x5a2ef3){var _0x144ef5=_0x573ed8[_0x7d95('0x4d')]-_0x5a2ef3[0x0]['outboundQueuePauses'];var _0x1f92ca=_0x573ed8[_0x7d95('0x1d1')]*0x3c;var _0x5f1ef6=_0x13b65d[0x0]['predictiveIntervalAvgTalktime']+_0x13b65d[0x0][_0x7d95('0x85')];var _0x4437bd=(_0x13b65d[0x0][_0x7d95('0x65')]+_0x13b65d[0x0][_0x7d95('0x68')]+_0x13b65d[0x0][_0x7d95('0x67')])/_0x13b65d[0x0][_0x7d95('0x6f')];var _0x1c4c50=_0x573ed8['dialPredictiveOptimizationPercentage']/0x64;_0x573ed8[_0x7d95('0x6d')]=_0x5a2ef3[0x0]['outboundQueuePauses']||0x0;_0x573ed8[_0x7d95('0x6b')]=_0x4437bd>0x0?_0x4437bd:0x1;return _0x1fa00e[_0x7d95('0x1e4')](_0x144ef5,_0x1f92ca,_0x5f1ef6,_0x4437bd,_0x1c4c50);})[_0x7d95('0xbc')](function(_0x2d2fc4){return _0x5cd741(_0x2d2fc4);})[_0x7d95('0xb4')](function(_0x40fffe){return _0x396a4b(msgResponse('[CatchErlangB]',_0x7d95('0x144'),JSON['stringify'](_0x40fffe)));});}}else{return _0x396a4b(msgResponse(_0x7d95('0x1e5'),_0x7d95('0x144'),'check\x20failure'));}});};};Dialer[_0x7d95('0xac')][_0x7d95('0x1db')]=function(_0x4784be){var _0x3a2260=this;return function(){var _0x236441=0x0;var _0x5b8818=Math[_0x7d95('0x1cd')](_0x4784be[_0x7d95('0x72')]*0x3e8);if(_0x5b8818>0x0){_0x5b8818=_0x5b8818<0x64?0x64:_0x5b8818;loggerPredictive[_0x7d95('0x7e')](_0x4784be['name'],_0x7d95('0x1eb'),_0x5b8818,_0x7d95('0x47'));_0x4784be[_0x7d95('0x92')]=setInterval(function(){_0x3a2260[_0x7d95('0x92')](_0x4784be);loggerPredictiveCalls[_0x7d95('0x7e')](_0x7d95('0x1ec'),_0x236441+=0x1);},_0x5b8818);}else{loggerPredictive[_0x7d95('0x7e')](_0x4784be[_0x7d95('0x3e')],_0x7d95('0x1ed'));}};};Dialer[_0x7d95('0xac')]['checkContactBlack']=function(_0x302ffb,_0x3ea190){var _0x19b3dd=this;return function(_0x4e46c6){if(_[_0x7d95('0x44')](_0x4e46c6)){if(_[_0x7d95('0xb1')](_0x3ea190[_0x7d95('0x1ee')])||!_0x3ea190[_0x7d95('0x1ef')]){if(_0x302ffb['dialMethod']==='booked'){_0x302ffb[_0x7d95('0x12d')]=_[_0x7d95('0x3c')](_0x302ffb[_0x7d95('0x12d')])?!![]:_0x302ffb['queueStatusComplete'];var _0x6bd382=uuid['v4']();_0x19b3dd[_0x7d95('0x25')][_0x6bd382]=new Action(_0x302ffb,_0x3ea190,_0x6bd382);loggerBooked['info'](_0x7d95('0x1f0'),_0x6bd382,_0x7d95('0x1f1'),JSON[_0x7d95('0x46')](_0x302ffb[_0x7d95('0x12d')]),_0x7d95('0x1f2'),_0x302ffb[_0x7d95('0x3e')]);if(_0x302ffb[_0x7d95('0x12d')]){_0x302ffb['queueStatusComplete']=![];_0x19b3dd['queueBooked'][_0x19b3dd[_0x7d95('0x25')][_0x6bd382][_0x7d95('0xb6')]]=[];ami['Action']({'actionid':_0x6bd382,'action':_0x7d95('0x1f3'),'queue':_0x302ffb['name']})[_0x7d95('0xb4')](function(){_0x19b3dd[_0x7d95('0xb5')](_0x302ffb);_0x19b3dd[_0x7d95('0xc0')]({'active':![],'ContactId':_0x19b3dd[_0x7d95('0x25')][_0x6bd382]['ContactId'],'ListId':_0x19b3dd['actions'][_0x6bd382][_0x7d95('0x101')],'VoiceQueueId':_0x19b3dd[_0x7d95('0x25')][_0x6bd382][_0x7d95('0xd6')]||undefined,'CampaignId':_0x19b3dd['actions'][_0x6bd382]['CampaignId']||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x1f4')));delete _0x19b3dd[_0x7d95('0x25')][_0x6bd382];});}else{loggerBooked['info'](_0x7d95('0x1f5'),JSON[_0x7d95('0x46')](_0x302ffb[_0x7d95('0x12d')]),_0x7d95('0x1f2'),_0x302ffb[_0x7d95('0x3e')]);_0x19b3dd[_0x7d95('0xb5')](_0x302ffb);_0x19b3dd['rescheduleContact']({'active':![],'ContactId':_0x19b3dd[_0x7d95('0x25')][_0x6bd382][_0x7d95('0xd5')],'ListId':_0x19b3dd[_0x7d95('0x25')][_0x6bd382]['ListId'],'VoiceQueueId':_0x19b3dd[_0x7d95('0x25')][_0x6bd382]['VoiceQueueId']||undefined,'CampaignId':_0x19b3dd[_0x7d95('0x25')][_0x6bd382][_0x7d95('0xd7')]||undefined})['catch'](loggerCatch(_0x7d95('0x1f4')));delete _0x19b3dd[_0x7d95('0x25')][_0x6bd382];}}else{return _0x19b3dd[_0x7d95('0x1f6')](_0x302ffb,_0x3ea190);}}else{if(getDiff(_0x3ea190[_0x7d95('0x1f7')])<_0x302ffb['dialRecallMeTimeout']*0x3c){if(_0x3ea190[_0x7d95('0x1f8')]&&!_0x3ea190[_0x7d95('0x1f8')][_0x7d95('0x1f9')]){_0x19b3dd[_0x7d95('0x94')][_0x7d95('0x130')](_0x3ea190['id'])[_0x7d95('0x1e')](function(){_0x19b3dd[_0x7d95('0xb5')](_0x302ffb);});}else{_0x19b3dd['unlockContact']({'active':![]},_0x3ea190['id'],0x1)[_0x7d95('0x1e')](function(){_0x19b3dd[_0x7d95('0xb5')](_0x302ffb);});}}else{_0x302ffb[_0x7d95('0x63')]+=0x1;_0x19b3dd[_0x7d95('0xb5')](_0x302ffb);if(_0x302ffb[_0x7d95('0x1fa')]){_0x19b3dd[_0x7d95('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ea190[_0x7d95('0xd5')],'ListId':_0x3ea190[_0x7d95('0x101')],'VoiceQueueId':_0x3ea190[_0x7d95('0xd6')]||undefined,'CampaignId':_0x3ea190[_0x7d95('0xd7')]||undefined})[_0x7d95('0xb4')](loggerCatch(_0x7d95('0x1fb')));_0x19b3dd[_0x7d95('0xcc')](createObjHistory(_0x302ffb,_0x3ea190,_0x7d95('0x1fc'),0x17,_0x7d95('0x1fd')))['catch'](loggerCatch(_0x7d95('0x1fe')));}else{_0x19b3dd[_0x7d95('0xd3')](createObjHistory(_0x302ffb,_0x3ea190,_0x7d95('0x1ff'),0x16,'RecallFailedTimeout'),_0x7d95('0x200'),_0x7d95('0x201'));}}}}else{_0x302ffb[_0x7d95('0x202')]+=0x1;_0x19b3dd['saveInDb'](createObjHistory(_0x302ffb,_0x3ea190,'BLACKLIST',0xd,_0x7d95('0x203')),_0x7d95('0x204'),'[Originate][MoveBlacklist]');throw _0x7d95('0x205');}};};Dialer['prototype'][_0x7d95('0x160')]=function(_0x2f786e){var _0x1aeea2=this;var _0x55e5e0=_0x2f786e[_0x7d95('0x206')]-_0x2f786e[_0x7d95('0x70')]-_0x2f786e[_0x7d95('0xc5')];emitCampaignSummary(_0x2f786e);if(_0x55e5e0>0x0){if(_0x55e5e0>this['maxNumberOriginate']){_0x55e5e0=this[_0x7d95('0x23')];}_0x2f786e[_0x7d95('0xc5')]+=_0x55e5e0;this[_0x7d95('0xc7')](_0x2f786e['id'],_0x55e5e0,_0x2f786e[_0x7d95('0x207')],_0x2f786e)[_0x7d95('0xbc')](function(_0x574776){_0x2f786e[_0x7d95('0xc5')]-=_0x55e5e0;_0x2f786e[_0x7d95('0xc5')]=_0x2f786e['temp']>0x0?_0x2f786e[_0x7d95('0xc5')]:0x0;if(!checkContactEmpty(_0x574776)){_0x2f786e[_0x7d95('0x3d')]=_0x7d95('0x208');logger[_0x7d95('0x7e')]('[getContactCampaign2][Empty]'+_0x2f786e['name']);}else{_0x2f786e['originated']+=_0x574776[_0x7d95('0x9a')];_0x2f786e[_0x7d95('0x3d')]=_0x7d95('0x209');for(var _0x8de0a6=0x0;_0x8de0a6<_0x574776[_0x7d95('0x9a')];_0x8de0a6+=0x1){_0x2f786e[_0x7d95('0x20a')]+=0x1;if(_[_0x7d95('0xb1')](_0x574776[_0x8de0a6])||_[_0x7d95('0xb1')](_0x574776[_0x8de0a6][_0x7d95('0x16e')])||_[_0x7d95('0xb1')](_0x574776[_0x8de0a6][_0x7d95('0x16e')][_0x7d95('0x16f')])){_0x1aeea2['emptyContact']('[actionOriginate]\x20',_0x2f786e,_0x574776[_0x8de0a6]);}else{_0x1aeea2['checkIsBlackListIvr'](_[_0x7d95('0xd4')](_0x574776[_0x8de0a6],[_0x7d95('0xd7'),_0x7d95('0x20b')]))[_0x7d95('0xbc')](_0x1aeea2[_0x7d95('0x20c')](_0x2f786e,_0x574776[_0x8de0a6]))[_0x7d95('0xb4')](_0x1aeea2['loggerHandler'](_0x7d95('0x20d'),_0x2f786e));}}}})[_0x7d95('0xb4')](loggerGetContactDialer('[getContactCampaign2]',_0x2f786e,_0x55e5e0));}};Dialer[_0x7d95('0xac')]['handlePower']=function(_0x5f2c36,_0x208e27){var _0x1d0647=this;var _0x586fc2=[];var _0x388efe=_0x208e27>=0x1?_0x208e27:0x1;if(_0x5f2c36[_0x7d95('0x57')]===_0x7d95('0x9')){_0x388efe=0x1;}var _0x30de3d=Math[_0x7d95('0x1cd')](_0x5f2c36['available']*_0x388efe)-_0x5f2c36[_0x7d95('0x70')]-_0x5f2c36['temp'];emitVoiceQueueSummary(_0x5f2c36);if(_0x5f2c36[_0x7d95('0x20e')]>0x0){var _0x356c3c=_0x5f2c36[_0x7d95('0x20e')]-_0x5f2c36['originated']-_0x5f2c36[_0x7d95('0x51')]-_0x5f2c36[_0x7d95('0xc5')]-_0x5f2c36[_0x7d95('0x4e')];if(_0x30de3d>_0x356c3c){_0x30de3d=_0x356c3c;}}if(_0x30de3d>0x0){if(_0x5f2c36[_0x7d95('0x57')]===_0x7d95('0x9')){_0x30de3d=0x1;}if(_0x30de3d>this[_0x7d95('0x23')]){_0x30de3d=this[_0x7d95('0x23')];}_0x5f2c36[_0x7d95('0xc5')]+=_0x30de3d;for(var _0xe91023 in this[_0x7d95('0x21')]){if(typeof this[_0x7d95('0x21')][_0xe91023]!==_0x7d95('0x9b')){if(this[_0x7d95('0x21')][_0xe91023][_0x7d95('0xa8')]===_0x7d95('0x20f')&&this[_0x7d95('0x21')][_0xe91023][_0x7d95('0xb2')]===_0x7d95('0x210')){_0x586fc2[_0x7d95('0x12c')](this[_0x7d95('0x21')][_0xe91023]['id']);}}}this[_0x7d95('0xc4')](_0x5f2c36['id'],_0x586fc2,_0x30de3d,_0x5f2c36[_0x7d95('0x207')],_0x5f2c36)['then'](function(_0x473c10){_0x5f2c36[_0x7d95('0xc5')]-=_0x30de3d;_0x5f2c36['temp']=_0x5f2c36[_0x7d95('0xc5')]>0x0?_0x5f2c36[_0x7d95('0xc5')]:0x0;if(!checkContactEmpty(_0x473c10)){_0x1d0647[_0x7d95('0x211')](_0x5f2c36)[_0x7d95('0xbc')](sendMessageReschedule(_0x5f2c36))[_0x7d95('0xb4')](loggerCatch('[countReScheduled]\x20'));}else{_0x5f2c36[_0x7d95('0x70')]+=_0x473c10['length'];_0x5f2c36[_0x7d95('0x3d')]=_0x5f2c36[_0x7d95('0x57')]===_0x7d95('0x9')?'ACTIVE':_0x7d95('0x209');for(var _0xf25de5=0x0;_0xf25de5<_0x473c10[_0x7d95('0x9a')];_0xf25de5+=0x1){if(_[_0x7d95('0xb1')](_0x473c10[_0xf25de5])||_[_0x7d95('0xb1')](_0x473c10[_0xf25de5][_0x7d95('0x16e')])||_[_0x7d95('0xb1')](_0x473c10[_0xf25de5][_0x7d95('0x16e')][_0x7d95('0x16f')])){_0x1d0647[_0x7d95('0xd1')](_0x7d95('0x212'),_0x5f2c36,_0x473c10[_0xf25de5]);}else{_0x1d0647[_0x7d95('0x213')](_['pick'](_0x473c10[_0xf25de5],[_0x7d95('0xd6'),'Contact.phone']))[_0x7d95('0xbc')](_0x1d0647[_0x7d95('0x20c')](_0x5f2c36,_0x473c10[_0xf25de5]))[_0x7d95('0xb4')](_0x1d0647[_0x7d95('0xd0')](_0x7d95('0x212'),_0x5f2c36));}}}})[_0x7d95('0xb4')](loggerGetContactDialer(_0x7d95('0x214'),_0x5f2c36,_0x30de3d));}};Dialer['prototype'][_0x7d95('0x92')]=function(_0x3e03f1){if(_0x3e03f1[_0x7d95('0x20e')]>0x0){var _0x2ac9f6=_0x3e03f1[_0x7d95('0x20e')]-_0x3e03f1['originated']-_0x3e03f1[_0x7d95('0x51')];if(_0x2ac9f6>0x0){this[_0x7d95('0x215')](_0x3e03f1);}else{loggerPredictiveCalls[_0x7d95('0x7e')](_0x7d95('0x216'));}}else{this[_0x7d95('0x215')](_0x3e03f1);}};Dialer[_0x7d95('0xac')][_0x7d95('0x215')]=function(_0x3a316f){var _0x3b7bc6=this;var _0x5bf368=[];_0x3a316f[_0x7d95('0x70')]+=0x1;for(var _0x4014f1 in this['agents']){if(typeof this[_0x7d95('0x21')][_0x4014f1]!=='undefined'){if(this[_0x7d95('0x21')][_0x4014f1][_0x7d95('0xa8')]==='not_inuse'&&this[_0x7d95('0x21')][_0x4014f1][_0x7d95('0xb2')]===_0x7d95('0x210')){_0x5bf368[_0x7d95('0x12c')](this[_0x7d95('0x21')][_0x4014f1]['id']);}}}this['getContactDialer'](_0x3a316f['id'],_0x5bf368,0x1,_0x3a316f['dialOrderByScheduledAt'],_0x3a316f)[_0x7d95('0xbc')](function(_0x16d230){if(!checkContactEmpty(_0x16d230)){checkContactLowerLimitOriginate(_0x3a316f,0x1,0x0);_0x3b7bc6[_0x7d95('0x211')](_0x3a316f)[_0x7d95('0xbc')](sendMessageReschedule(_0x3a316f))[_0x7d95('0xb4')](loggerCatch(_0x7d95('0xb9')));}else{_0x3a316f[_0x7d95('0x3d')]=_0x7d95('0x209');if(_[_0x7d95('0xb1')](_0x16d230[0x0])||_[_0x7d95('0xb1')](_0x16d230[0x0][_0x7d95('0x16e')])||_['isNil'](_0x16d230[0x0][_0x7d95('0x16e')][_0x7d95('0x16f')])){_0x3b7bc6[_0x7d95('0xd1')]('[actionOriginate]\x20',_0x3a316f,_0x16d230[0x0]);}else{_0x3b7bc6[_0x7d95('0x213')](_[_0x7d95('0xd4')](_0x16d230[0x0],[_0x7d95('0xd6'),_0x7d95('0x20b')]))[_0x7d95('0xbc')](_0x3b7bc6['checkContactBlack'](_0x3a316f,_0x16d230[0x0]))[_0x7d95('0xb4')](_0x3b7bc6[_0x7d95('0xd0')]('[actionOriginatePredictive]\x20',_0x3a316f));}}})[_0x7d95('0xb4')](loggerGetContactDialer(_0x7d95('0x217'),_0x3a316f,0x1));emitVoiceQueueSummary(_0x3a316f);};Dialer[_0x7d95('0xac')]['abandonmentRate']=function(_0x23738b,_0x565030,_0xf91812,_0x5500c7,_0x4292c3,_0x243d90){loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x218'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23738b);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x565030);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x219'),_0xf91812);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x21a'),_0x5500c7);loggerPredictive[_0x7d95('0x7e')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4292c3);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x87'));return new BPromise(function(_0x211d64,_0x50f826){if(_0x23738b<=0x0||isNaN(_0x23738b)){return _0x50f826(msgResponse(_0x7d95('0x21b'),_0x7d95('0x198'),_0x7d95('0x21c')+_0x23738b));}if(_0xf91812<=0x0||isNaN(_0xf91812)){return _0x50f826(msgResponse(_0x7d95('0x21b'),_0x7d95('0x198'),_0x7d95('0x21d')+_0xf91812));}if(_0x5500c7<=0x0||isNaN(_0x5500c7)){return _0x50f826(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x5500c7));}if(_0x565030<=0x0||isNaN(_0x565030)){return _0x50f826(msgResponse(_0x7d95('0x21b'),_0x7d95('0x198'),_0x7d95('0x21e')+_0x565030));}if(_0x4292c3<=0x0||isNaN(_0x4292c3)){return _0x50f826(msgResponse(_0x7d95('0x21b'),'Error','Amax\x20=\x20'+_0x4292c3));}_0x243d90=_0x243d90||0x0;var _0x19bad1=0x1/_0xf91812;var _0x441169=0x0;var _0x5e4724=0x0;var _0x3fa031=0x0;var _0x2e7b9a=0x0;for(var _0x569763=0x0;_0x3fa031<_0x4292c3;_0x569763+=0x1){_0x5e4724=_0x569763/_0x565030;_0x441169=(_0x5500c7*_0x5e4724+_0x243d90)/_0x19bad1;_0x3fa031=erlangb(_0x441169,_0x23738b);_0x2e7b9a=_0x441169/_0x23738b*(0x1-erlangb(_0x441169,_0x23738b));}return _0x211d64({'erlangCalls':_0x569763,'erlangCallToSecond':_0x565030/_0x569763,'erlangAbandonmentRate':_0x3fa031,'erlangBusyFactor':_0x2e7b9a});});};Dialer[_0x7d95('0xac')]['busyFactor']=function(_0x13fe85,_0x17cc56,_0x4fd262,_0x1cf7b0,_0x1b9715,_0x4bdda6){loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x21f'));loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x220'),_0x13fe85);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x221'),_0x17cc56);loggerPredictive['info'](_0x7d95('0x219'),_0x4fd262);loggerPredictive[_0x7d95('0x7e')](_0x7d95('0x21a'),_0x1cf7b0);loggerPredictive['info'](_0x7d95('0x222'),_0x1b9715);loggerPredictive[_0x7d95('0x7e')]('---------------------------');return new BPromise(function(_0x36f4f6,_0x53a145){if(_0x13fe85<=0x0||isNaN(_0x13fe85)){return _0x53a145(msgResponse(_0x7d95('0x223'),_0x7d95('0x198'),_0x7d95('0x21c')+_0x13fe85));}if(_0x4fd262<=0x0||isNaN(_0x4fd262)){return _0x53a145(msgResponse(_0x7d95('0x223'),_0x7d95('0x198'),'Ts\x20=\x20'+_0x4fd262));}if(_0x1cf7b0<=0x0||isNaN(_0x1cf7b0)){return _0x53a145(msgResponse(_0x7d95('0x223'),_0x7d95('0x198'),'p\x20=\x20'+_0x1cf7b0));}if(_0x17cc56<=0x0||isNaN(_0x17cc56)){return _0x53a145(msgResponse(_0x7d95('0x223'),'Error',_0x7d95('0x21e')+_0x17cc56));}if(_0x1b9715<=0x0||isNaN(_0x1b9715)){return _0x53a145(msgResponse(_0x7d95('0x223'),'Error',_0x7d95('0x224')+_0x1b9715));}_0x4bdda6=_0x4bdda6||0x0;var _0xd01ead=0x1/_0x4fd262;var _0x46ad33=0x0;var _0x200878=0x0;var _0x1791e7=0x0;var _0x40695c=0x0;for(var _0x49703b=0x0;_0x40695c<_0x1b9715;_0x49703b+=0x1){_0x200878=_0x49703b/_0x17cc56;_0x46ad33=(_0x1cf7b0*_0x200878+_0x4bdda6)/_0xd01ead;_0x1791e7=erlangb(_0x46ad33,_0x13fe85);_0x40695c=_0x46ad33/_0x13fe85*(0x1-erlangb(_0x46ad33,_0x13fe85));}return _0x36f4f6({'erlangCalls':_0x49703b,'erlangCallToSecond':_0x17cc56/_0x49703b,'erlangAbandonmentRate':_0x1791e7,'erlangBusyFactor':_0x40695c});});};module[_0x7d95('0x225')]=Dialer; \ No newline at end of file +var _0xac4a=['ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','reason19\x20machine....','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ListId','[syncAgentComplete][createHistory][0]','countabandonedretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','minutes','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','strategy','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','match','actionOriginate','object','Contact','phone','originate','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','dialPrefix','trim','substring','dialCutDigit','SIP/%s/%s%s','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','Error','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','handlePredictive','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','message','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','format','voice_queue:save','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','clearing\x20variable\x20handle\x20predictive','ivr','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','[uniqueid]','clearZombieChannels','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick'];(function(_0xc97200,_0x402a15){var _0x3abfe8=function(_0x45d06b){while(--_0x45d06b){_0xc97200['push'](_0xc97200['shift']());}};_0x3abfe8(++_0x402a15);}(_0xac4a,0x13f));var _0xaac4=function(_0x58aeca,_0x3778a2){_0x58aeca=_0x58aeca-0x0;var _0x221487=_0xac4a[_0x58aeca];return _0x221487;};'use strict';var util=require(_0xaac4('0x0'));var _=require(_0xaac4('0x1'));var BPromise=require(_0xaac4('0x2'));var uuid=require(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var rr=require('rr');var md5=require(_0xaac4('0x5'));var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0xaac4('0x6'));var logger=require(_0xaac4('0x7'))(_0xaac4('0x8'));var loggerBooked=require('../../../config/logger')(_0xaac4('0x9'));var loggerPredictive=require('../../../config/logger')(_0xaac4('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xaac4('0xb'));var loggerSyncQueueSummary=require(_0xaac4('0x7'))('syncQueueSummary');var ami=require('../ami');config[_0xaac4('0xc')]=_['defaults'](config[_0xaac4('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaac4('0xc')]));var cmHopper=require(_0xaac4('0xd'));var cmHopperHistory=require(_0xaac4('0xe'));var cmHopperBlack=require(_0xaac4('0xf'));var voiceQueueRt=require(_0xaac4('0x10'));var Action=require('./action');var History=require('./history');var Final=require(_0xaac4('0x11'));var AgentComplete=require(_0xaac4('0x12'));var QueueCallerAbandon=require(_0xaac4('0x13'));var Hangup=require('./hangup');var ipAgi=process[_0xaac4('0x14')][_0xaac4('0x15')]||'127.0.0.1';var strategy={'rrmemory':_0xaac4('0x16'),'roundrobin':_0xaac4('0x17')};var Sequence=function(){};Sequence[_0xaac4('0x18')][_0xaac4('0x19')]=function(_0x187624){this[_0xaac4('0x1a')]=this[_0xaac4('0x1a')]?this[_0xaac4('0x1a')][_0xaac4('0x1b')](_0x187624):_0x187624();};function Dialer(_0xb8466e,_0x35bc32){this[_0xaac4('0x1c')]=new Sequence();this[_0xaac4('0x1d')]=_0x35bc32;this['voiceQueues']=_0xb8466e[_0xaac4('0x1e')];this['campaigns']=_0xb8466e[_0xaac4('0x1f')];this['agents']=_0xb8466e[_0xaac4('0x20')];this[_0xaac4('0x21')]=_0xb8466e[_0xaac4('0x21')];this[_0xaac4('0x22')]=config[_0xaac4('0x22')]||0x2;this[_0xaac4('0x23')]={};this[_0xaac4('0x24')]={};this[_0xaac4('0x25')]={};this[_0xaac4('0x26')]={};this['optionPredictive']={};this[_0xaac4('0x27')]={};this['startProgressive']={};this[_0xaac4('0x28')]={};this[_0xaac4('0x29')]={};this[_0xaac4('0x2a')]={};ami['on'](_0xaac4('0x2b'),this[_0xaac4('0x2c')][_0xaac4('0x2d')](this));ami['on']('queuecallerabandon',this[_0xaac4('0x2e')][_0xaac4('0x2d')](this));ami['on'](_0xaac4('0x2f'),this[_0xaac4('0x30')][_0xaac4('0x2d')](this));ami['on'](_0xaac4('0x31'),this[_0xaac4('0x32')]['bind'](this));ami['on'](_0xaac4('0x33'),this['syncQueueSummary']['bind'](this));ami['on']('hangup',this['syncHangup'][_0xaac4('0x2d')](this));ami['on'](_0xaac4('0x34'),this[_0xaac4('0x35')][_0xaac4('0x2d')](this));ami['on'](_0xaac4('0x36'),this[_0xaac4('0x37')][_0xaac4('0x2d')](this));ami['on'](_0xaac4('0x38'),this[_0xaac4('0x39')][_0xaac4('0x2d')](this));ami['on']('queuestatuscomplete',this[_0xaac4('0x3a')][_0xaac4('0x2d')](this));this[_0xaac4('0x3b')]();this[_0xaac4('0x3c')]();}function isNotNull(_0x669b34){return _0x669b34!==null&&!_[_0xaac4('0x3d')](_0x669b34);}function checkIsLoggedIn(_0x5e469a,_0xcf6c1){return function(){if(_0xcf6c1<=0x0){_0x5e469a['message']=_0xaac4('0x3e');throw _0x5e469a[_0xaac4('0x3f')]+_0xaac4('0x40');}};}function isActive(_0x2aaa68){return _0x2aaa68;}function checkIsActive(_0x48bf50,_0x5000e1){return function(){if(!isActive(_0x5000e1)){_0x48bf50['message']=_0xaac4('0x41');throw _0x48bf50[_0xaac4('0x3f')]+_0xaac4('0x42');}};}function checkInterval(_0x244e36){return function(){if(!isNotNull(_0x244e36[_0xaac4('0x43')])){_0x244e36[_0xaac4('0x44')]=_0xaac4('0x45');throw _0x244e36[_0xaac4('0x3f')]+_0xaac4('0x46');}if(!isNotNull(_0x244e36[_0xaac4('0x43')][_0xaac4('0x47')])){_0x244e36[_0xaac4('0x44')]=_0xaac4('0x45');throw _0x244e36[_0xaac4('0x3f')]+_0xaac4('0x46');}if(!isNotNull(_['isEmpty'](_0x244e36['Interval'][_0xaac4('0x47')]))){_0x244e36[_0xaac4('0x44')]=_0xaac4('0x45');throw _0x244e36['name']+_0xaac4('0x46');}};}function msgResponse(_0x16fae8,_0x2cbf8d,_0x1bce61){return{'action':_0x16fae8,'response':_0x2cbf8d,'message':_0x1bce61,'stack':_0x1bce61};}function myreject(_0x1ec59d){return function(_0x1e1853){return _0x1ec59d(msgResponse(_0xaac4('0x48'),'Error',JSON[_0xaac4('0x49')](_0x1e1853)));};}function getSeconds(_0x31ec51,_0x1ffa56){var _0x5d64a2=moment(_0x31ec51)[_0xaac4('0x4a')](0x0);var _0x497e7b=moment(_0x1ffa56)['milliseconds'](0x0);return _0x5d64a2[_0xaac4('0x4b')](_0x497e7b,_0xaac4('0x4c'));}function emit(_0x2da28a,_0x591924,_0x5000ed){io['to'](_0x2da28a)[_0xaac4('0x4d')](_0x591924,_0x5000ed);}function emitVoiceQueueSummary(_0x33cc4){if(_0x33cc4[_0xaac4('0x4e')]===_0xaac4('0x4f')){var _0x2b65b1={'id':_0x33cc4['id'],'name':_0x33cc4[_0xaac4('0x3f')],'strategy':_0x33cc4['strategy'],'answered':_0x33cc4['answered'],'available':_0x33cc4[_0xaac4('0x50')],'loggedIn':_0x33cc4[_0xaac4('0x51')],'pTalking':_0x33cc4['pTalking'],'sumBillable':_0x33cc4[_0xaac4('0x52')],'sumDuration':_0x33cc4[_0xaac4('0x53')],'sumHoldTime':_0x33cc4[_0xaac4('0x54')]||0x0,'talking':_0x33cc4['talking'],'total':_0x33cc4[_0xaac4('0x55')],'type':_0x33cc4[_0xaac4('0x4e')],'unmanaged':_0x33cc4[_0xaac4('0x56')],'abandoned':_0x33cc4['abandoned'],'waiting':_0x33cc4[_0xaac4('0x57')],'loggedInDb':_0x33cc4[_0xaac4('0x58')],'dialActive':_0x33cc4[_0xaac4('0x59')],'dialMethod':_0x33cc4[_0xaac4('0x5a')],'dialOriginateCallerIdName':_0x33cc4['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x33cc4[_0xaac4('0x5b')],'dialOriginateTimeout':_0x33cc4['dialOriginateTimeout'],'dialPrefix':_0x33cc4['dialPrefix'],'outboundAnswerAgiCallsDay':_0x33cc4[_0xaac4('0x5c')],'outboundAnswerCallsDay':_0x33cc4[_0xaac4('0x5d')],'outboundBlacklistCallsDay':_0x33cc4[_0xaac4('0x5e')],'outboundBusyCallsDay':_0x33cc4[_0xaac4('0x5f')],'outboundCongestionCallsDay':_0x33cc4[_0xaac4('0x60')],'outboundDropCallsDayACS':_0x33cc4[_0xaac4('0x61')],'outboundDropCallsDayCallersExit':_0x33cc4[_0xaac4('0x62')],'outboundDropCallsDayTimeout':_0x33cc4[_0xaac4('0x63')],'outboundNoAnswerCallsDay':_0x33cc4['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x33cc4[_0xaac4('0x64')],'outboundOriginateFailureCallsDay':_0x33cc4[_0xaac4('0x65')],'outboundReCallsDay':_0x33cc4[_0xaac4('0x66')],'outboundRejectCallsDay':_0x33cc4[_0xaac4('0x67')],'outboundUnknownCallsDay':_0x33cc4['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x33cc4[_0xaac4('0x68')],'predictiveIntervalAvgHoldtime':_0x33cc4[_0xaac4('0x69')],'predictiveIntervalAvgTalktime':_0x33cc4[_0xaac4('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x33cc4['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x33cc4[_0xaac4('0x6b')],'predictiveIntervalErlangCalls':_0x33cc4[_0xaac4('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x33cc4[_0xaac4('0x6d')],'predictiveIntervalHitRate':_0x33cc4[_0xaac4('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x33cc4['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x33cc4[_0xaac4('0x6f')],'predictiveIntervalAvailable':_0x33cc4[_0xaac4('0x70')],'predictiveIntervalTotalCalls':_0x33cc4[_0xaac4('0x71')],'message':_0x33cc4['message'],'originated':_0x33cc4[_0xaac4('0x72')],'erlangCalls':_0x33cc4[_0xaac4('0x73')],'erlangCallToSecond':_0x33cc4[_0xaac4('0x74')],'erlangAbandonmentRate':_0x33cc4[_0xaac4('0x75')],'erlangBusyFactor':_0x33cc4[_0xaac4('0x76')],'startPredictive':_0x33cc4[_0xaac4('0x27')],'startProgressive':_0x33cc4[_0xaac4('0x77')]};if(_0x33cc4[_0xaac4('0x78')]){_0x2b65b1[_0xaac4('0x78')]={'id':_0x33cc4['Trunk']['id'],'name':_0x33cc4[_0xaac4('0x78')][_0xaac4('0x3f')],'active':_0x33cc4[_0xaac4('0x78')][_0xaac4('0x79')],'callerid':_0x33cc4[_0xaac4('0x78')]['callerid']};}if(_0x33cc4['Interval']){_0x2b65b1[_0xaac4('0x43')]={'id':_0x33cc4[_0xaac4('0x43')]['id'],'name':_0x33cc4[_0xaac4('0x43')][_0xaac4('0x3f')]};}var _0x5f33ea=md5(JSON[_0xaac4('0x49')](_0x2b65b1));if(_0x33cc4['md5']!==_0x5f33ea){_0x33cc4[_0xaac4('0x5')]=_0x5f33ea;emit(util[_0xaac4('0x7a')]('voice:queue:%s',_0x2b65b1[_0xaac4('0x3f')]),_0xaac4('0x7b'),_0x2b65b1);}}}function emitCampaignSummary(_0x357bc6){if(_0x357bc6['type']==='ivr'){emit(util[_0xaac4('0x7a')](_0xaac4('0x7c'),_0x357bc6[_0xaac4('0x3f')]),_0xaac4('0x7d'),_0x357bc6);}}function checkGetDataPredictive(_0x1877c2){if(isNotNull(_0x1877c2)&&!_[_0xaac4('0x7e')](_0x1877c2)){loggerPredictive['info'](_0xaac4('0x7f'));loggerPredictive[_0xaac4('0x80')](_0xaac4('0x81'),_0x1877c2[_0xaac4('0x71')]);loggerPredictive['info'](_0xaac4('0x82'),_0x1877c2['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x83'),_0x1877c2[_0xaac4('0x6b')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x84'),_0x1877c2[_0xaac4('0x85')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x86'),_0x1877c2[_0xaac4('0x69')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x87'),_0x1877c2[_0xaac4('0x6a')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x88'));if(_0x1877c2['predictiveIntervalTotalCalls']>0x0){if(!_[_0xaac4('0x3d')](_0x1877c2[_0xaac4('0x6a')])&&_0x1877c2[_0xaac4('0x6a')]>0x0){return!![];}loggerPredictive[_0xaac4('0x80')](_0xaac4('0x89'));if(!_[_0xaac4('0x3d')](_0x1877c2[_0xaac4('0x69')])&&_0x1877c2[_0xaac4('0x69')]>0x0){return!![];}loggerPredictive['info'](_0xaac4('0x8a'));}else{loggerPredictive['info'](_0xaac4('0x8b'));}}else{loggerPredictive['info'](_0xaac4('0x8c'));}return![];}function mergeDataErlangB(_0x5d56ae){return function(_0x5155a4){loggerPredictive[_0xaac4('0x80')](_0xaac4('0x8d'));loggerPredictive['info'](_0xaac4('0x8e'),_0x5155a4[_0xaac4('0x73')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x8f'),_0x5155a4[_0xaac4('0x74')]);loggerPredictive[_0xaac4('0x80')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5155a4[_0xaac4('0x75')]);loggerPredictive['info'](_0xaac4('0x90'),_0x5155a4['erlangBusyFactor']);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5155a4[_0xaac4('0x75')]);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x88'));_[_0xaac4('0x91')](_0x5d56ae,_0x5155a4);};}function getDiff(_0x4c1d3c){var _0x372f96=moment()[_0xaac4('0x4a')](0x0);var _0x471af6=moment(_0x4c1d3c)['milliseconds'](0x0);return _0x372f96[_0xaac4('0x4b')](_0x471af6,_0xaac4('0x4c'));}function ifInterval(_0x2e1503,_0xab8baf){if(_[_0xaac4('0x3d')](_0xab8baf)){return![];}return getDiff(_0xab8baf)<_0x2e1503*0x3c;}function freeVariablesPredictive(_0x431838){if(isNotNull(_0x431838)){if(!_[_0xaac4('0x3d')](_0x431838['startProgressive'])){_0x431838['startProgressive']=undefined;loggerPredictive[_0xaac4('0x80')](_0x431838['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xaac4('0x3d')](_0x431838['startPredictive'])){_0x431838[_0xaac4('0x27')]=undefined;loggerPredictive['info'](_0x431838[_0xaac4('0x3f')],_0xaac4('0x92'));}if(!_['isUndefined'](_0x431838['handlePredictive'])){clearInterval(_0x431838['handlePredictive']);_0x431838['handlePredictive']=undefined;loggerPredictive[_0xaac4('0x80')](_0x431838[_0xaac4('0x3f')],_0xaac4('0x93'));}}}function erlangb(_0x399c74,_0x592b10){if(_0x592b10===0x0){return 0x0;}var _0x1037e0=0x1;for(var _0x354ec9=0x1;_0x354ec9<=_0x592b10;_0x354ec9+=0x1){_0x1037e0=0x1+_0x1037e0*_0x354ec9/_0x399c74;}return 0x1/_0x1037e0;}function isVoiceQueueOutbound(_0x3b0470){return _0x3b0470===_0xaac4('0x4f');}function isNotPreview(_0x3f5f8d){return _0x3f5f8d!==_0xaac4('0x1d');}function isCampaignIvr(_0x3a450d){return _0x3a450d===_0xaac4('0x94');}function getCallerId(_0x1c5d72,_0x40271c,_0x43aeee){if(!_['isUndefined'](_0x43aeee)&&typeof _0x43aeee==='string'&&!_[_0xaac4('0x7e')](_0x43aeee)){if(!_['isUndefined'](_0x40271c)&&typeof _0x40271c==='string'&&!_[_0xaac4('0x7e')](_0x40271c)){return util['format'](_0xaac4('0x95'),_0x40271c,_0x43aeee);}return util[_0xaac4('0x7a')](_0xaac4('0x95'),_0x43aeee,_0x43aeee);}if(!_[_0xaac4('0x3d')](_0x1c5d72)&&typeof _0x1c5d72==='string'&&!_[_0xaac4('0x7e')](_0x1c5d72)){return _0x1c5d72;}return _0xaac4('0x96');}function loggerCatchQueueSummary(_0x987b2e,_0xd5e0e2){return function(_0x300b0e){freeVariablesPredictive(_0xd5e0e2);emitVoiceQueueSummary(_0xd5e0e2);emitCampaignSummary(_0xd5e0e2);loggerSyncQueueSummary[_0xaac4('0x97')](_0x987b2e,util['inspect'](_0x300b0e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1db7c7,_0x429661){return function(_0x5b5e57){loggerPredictive[_0xaac4('0x97')](_0x429661[_0xaac4('0x3f')],_0x1db7c7);loggerPredictive['error'](_0x5b5e57['stack']);freeVariablesPredictive(_0x429661);};}function loggerCatch(_0x334396){return function(_0x3a2e77){logger[_0xaac4('0x97')](_0x334396,util[_0xaac4('0x98')](_0x3a2e77,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x65dfc2){return _0x65dfc2&&!_[_0xaac4('0x3d')](_0x65dfc2)&&_0x65dfc2[_0xaac4('0x99')]>0x0;}function decremetOriginate(_0x3e589a){if(!_['isUndefined'](_0x3e589a)&&_0x3e589a!==null){if(typeof _0x3e589a[_0xaac4('0x72')]!==_0xaac4('0x9a')){if(_0x3e589a[_0xaac4('0x72')]>0x0){_0x3e589a[_0xaac4('0x72')]-=0x1;}else{logger[_0xaac4('0x97')](_0xaac4('0x9b'));}}}else{logger['error'](_0xaac4('0x9c'));}}function checkContactLowerLimitOriginate(_0x16c480,_0x53059b,_0x5c3c89){if(_0x53059b>_0x5c3c89){for(var _0x5357ad=0x0;_0x5357ad<_0x53059b-_0x5c3c89;_0x5357ad+=0x1){decremetOriginate(_0x16c480);}}}function loggerGetContactDialer(_0x25617a,_0x488b34,_0x5e3bf1){return function(_0x5cc49b){checkContactLowerLimitOriginate(_0x488b34,_0x5e3bf1,0x0);logger['error'](_0x25617a,util['inspect'](_0x5cc49b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x430a49){return function(_0x46b0d6){if(isNotNull(_0x46b0d6)&&isNotNull(_0x46b0d6[0x0])){if(_0x46b0d6[0x0][_0xaac4('0x9d')]>0x0){_0x430a49[_0xaac4('0x44')]='RESCHEDULED_CONTACTS';logger[_0xaac4('0x80')](_0xaac4('0x9e')+_0x430a49[_0xaac4('0x3f')],_0x46b0d6[0x0][_0xaac4('0x9d')],_0xaac4('0x9f'));}else{_0x430a49[_0xaac4('0x44')]=_0xaac4('0xa0');logger['info'](_0xaac4('0xa1')+_0x430a49['name']);}}};}function notSendMessagesQueue(_0x551e53){if(_0x551e53[_0xaac4('0xa2')]){freeVariablesPredictive(_0x551e53);if(_0x551e53[_0xaac4('0x72')]===0x0&&_0x551e53[_0xaac4('0xa3')]===0x0&&_0x551e53[_0xaac4('0x57')]===0x0&&(_0x551e53[_0xaac4('0xa4')]||0x0)===0x0){_0x551e53[_0xaac4('0xa2')]=![];_0x551e53[_0xaac4('0x50')]=0x0;_0x551e53[_0xaac4('0x44')]=_0xaac4('0x41');loggerSyncQueueSummary[_0xaac4('0x97')](_0xaac4('0xa5'),_0x551e53[_0xaac4('0x3f')],_0xaac4('0xa6'));}else{_0x551e53[_0xaac4('0x44')]=_0xaac4('0xa7');loggerSyncQueueSummary[_0xaac4('0x97')](_0xaac4('0xa5'),_0x551e53[_0xaac4('0x3f')],_0xaac4('0xa8'));}emitVoiceQueueSummary(_0x551e53);}}function notSendMessagesCampaign(_0x3d452f){if(_0x3d452f[_0xaac4('0xa2')]){if(_0x3d452f[_0xaac4('0x72')]===0x0){_0x3d452f[_0xaac4('0xa2')]=![];_0x3d452f[_0xaac4('0x44')]=_0xaac4('0x41');loggerSyncQueueSummary['error'](_0xaac4('0xa9'),_0x3d452f[_0xaac4('0x3f')],_0xaac4('0xa6'));}else{_0x3d452f[_0xaac4('0x44')]=_0xaac4('0xa7');loggerSyncQueueSummary['error'](_0xaac4('0xa9'),_0x3d452f[_0xaac4('0x3f')],_0xaac4('0xa8'));}emitCampaignSummary(_0x3d452f);}}function createObjHistory(_0x2e24c4,_0x270b56,_0x508c4e,_0x30818a,_0x584ad9){_0x2e24c4[_0xaac4('0x44')]=_0x508c4e;var _0x36d642=new Action(_0x2e24c4,_0x270b56);var _0x57e692=new History(_0x36d642);_0x57e692[_0xaac4('0xaa')]=_0x30818a;_0x57e692['statedesc']=_0x584ad9;_0x57e692[_0xaac4('0xab')]=_0x36d642[_0xaac4('0xac')];return _0x57e692;}Dialer['prototype'][_0xaac4('0x3c')]=function(){var _0x3fe616=this;setInterval(function(){_0x3fe616['clearZombieChannels'](_0x3fe616[_0xaac4('0x26')],_0xaac4('0xad'));_0x3fe616[_0xaac4('0xae')](_0x3fe616[_0xaac4('0x24')],_0xaac4('0xaf'));},0x32c8);};Dialer[_0xaac4('0x18')][_0xaac4('0xae')]=function(_0x220f18,_0x3c47af){var _0x518af6=this;for(var _0x18d811 in _0x220f18){if(typeof _0x220f18[_0x18d811]!==_0xaac4('0x9a')){this[_0xaac4('0x1c')]['enqueue'](function(){if(!_[_0xaac4('0xb0')](_0x220f18[_0x18d811])){return ami[_0xaac4('0xb1')]({'action':_0xaac4('0xb2'),'channel':_0x220f18[_0x18d811][_0xaac4('0xb3')]})[_0xaac4('0xb4')](function(_0x3d397a){if(_0x3d397a[_0xaac4('0x44')]===_0xaac4('0xb5')){setTimeout(function(){if(_0x220f18[_0x18d811]&&_0x220f18[_0x18d811][_0xaac4('0x4e')]!==_0xaac4('0x94')){_0x518af6[_0xaac4('0xb6')](_0x518af6[_0xaac4('0x1e')][_0x220f18[_0x18d811][_0xaac4('0xb7')]]);logger[_0xaac4('0x97')](_0xaac4('0xb8'),_0x3c47af,_0x18d811,_0x220f18[_0x18d811][_0xaac4('0xb7')]);delete _0x220f18[_0x18d811];}if(_0x220f18[_0x18d811]&&_0x220f18[_0x18d811]['type']===_0xaac4('0x94')){_0x518af6[_0xaac4('0xb6')](_0x518af6[_0xaac4('0x1f')][_0x220f18[_0x18d811]['queue']]);logger[_0xaac4('0x97')](_0xaac4('0xb9'),_0x3c47af,_0x18d811,_0x220f18[_0x18d811]['queue']);delete _0x220f18[_0x18d811];}},0x2328);}});}});}}};Dialer[_0xaac4('0x18')]['countReScheduled']=function(_0x3ae162){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xbc')](_0x3ae162))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xbd')));};Dialer['prototype'][_0xaac4('0xbe')]=function(_0x207c90){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopperBlack['checkIsBlackList'](_0x207c90))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xbf')));};Dialer[_0xaac4('0x18')]['checkIsBlackListIvr']=function(_0xa78f15){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopperBlack[_0xaac4('0xc0')](_0xa78f15))[_0xaac4('0xb4')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0xaac4('0xc1')]=function(_0x1467f5){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopperHistory['avgHandleTime'](_0x1467f5))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xc2')));};Dialer[_0xaac4('0x18')][_0xaac4('0xc3')]=function(_0x3d220c){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xc3')](_0x3d220c))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xc4')));};Dialer[_0xaac4('0x18')][_0xaac4('0xc5')]=function(_0x370219,_0x4dde7f,_0x2ac631){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xc5')](_0x370219,_0x4dde7f,_0x2ac631))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xc6')));};Dialer[_0xaac4('0x18')]['getContactDialer']=function(_0x3fe063,_0x3abb63,_0x32ca0b,_0x12df94,_0x87c461){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xc7')](_0x3fe063,_0x3abb63,_0x32ca0b,_0x12df94))['catch'](function(_0x2968b5){_0x87c461[_0xaac4('0xc8')]-=_0x32ca0b;_0x87c461[_0xaac4('0xc8')]=_0x87c461[_0xaac4('0xc8')]>0x0?_0x87c461[_0xaac4('0xc8')]:0x0;loggerCatch(_0xaac4('0xc9'))(_0x2968b5);});};Dialer[_0xaac4('0x18')][_0xaac4('0xca')]=function(_0x3ecb21,_0x1580f4,_0x5489d8,_0x59e944){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xca')](_0x3ecb21,_0x1580f4,_0x5489d8))[_0xaac4('0xb4')](function(_0x384a7a){_0x59e944['temp']-=_0x1580f4;_0x59e944[_0xaac4('0xc8')]=_0x59e944[_0xaac4('0xc8')]>0x0?_0x59e944[_0xaac4('0xc8')]:0x0;loggerCatch(_0xaac4('0xcb'))(_0x384a7a);});};Dialer[_0xaac4('0x18')][_0xaac4('0xcc')]=function(_0x71343b){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](voiceQueueRt[_0xaac4('0xcc')](_0x71343b))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xcd')));};Dialer[_0xaac4('0x18')][_0xaac4('0xce')]=function(_0x103cb0){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopper[_0xaac4('0xce')](_0x103cb0))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xcf')));};Dialer[_0xaac4('0x18')][_0xaac4('0xd0')]=function(_0x30ca3e){return BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](cmHopperHistory[_0xaac4('0xd0')](_0x30ca3e))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xd1')));};Dialer[_0xaac4('0x18')][_0xaac4('0xb6')]=function(_0x5974fe){if(!_[_0xaac4('0x3d')](_0x5974fe)&&_0x5974fe!==null){if(typeof _0x5974fe[_0xaac4('0x72')]!==_0xaac4('0x9a')){if(_0x5974fe['originated']>0x0){_0x5974fe[_0xaac4('0x72')]-=0x1;}else{logger[_0xaac4('0x97')](_0xaac4('0xd2'));}}}else{logger[_0xaac4('0x97')](_0xaac4('0xd3'));}};Dialer[_0xaac4('0x18')][_0xaac4('0xd4')]=function(_0x3b0af8,_0x5ecd51){var _0x3f9a25=this;return function(_0x3ee211){_0x3f9a25['updateOriginated'](_0x5ecd51);logger[_0xaac4('0x97')](_0x3b0af8,util[_0xaac4('0x98')](_0x3ee211,{'showHidden':![],'depth':null}));};};Dialer[_0xaac4('0x18')][_0xaac4('0xd5')]=function(_0x51cc1b,_0x127278,_0x1a26f9){var _0x425a9b={'state':0x19,'statedesc':_0xaac4('0xd6')};this[_0xaac4('0xb6')](_0x127278);this[_0xaac4('0xd7')](_[_0xaac4('0x91')](_0x425a9b,_[_0xaac4('0xd8')](_0x1a26f9,[_0xaac4('0xd9'),'ListId',_0xaac4('0xda'),_0xaac4('0xdb'),_0xaac4('0xdc')])),_0xaac4('0xdd'),_0xaac4('0xde'));logger[_0xaac4('0x97')](_0x51cc1b);};Dialer[_0xaac4('0x18')][_0xaac4('0xdf')]=function(_0x299b63){return _0x299b63==='Success';};Dialer[_0xaac4('0x18')][_0xaac4('0xe0')]=function(_0x5cffd5){return!_['isUndefined'](_0x5cffd5)&&_0x5cffd5&&!_[_0xaac4('0x3d')](_0x5cffd5[_0xaac4('0x3f')])&&!_[_0xaac4('0x3d')](_0x5cffd5[_0xaac4('0x79')])&&_0x5cffd5[_0xaac4('0x79')]&&(this[_0xaac4('0x21')][util['format'](_0xaac4('0xe1'),_0x5cffd5[_0xaac4('0x3f')])]['status']===_0xaac4('0xe2')||this[_0xaac4('0x21')][util[_0xaac4('0x7a')]('SIP/%s',_0x5cffd5[_0xaac4('0x3f')])][_0xaac4('0xb2')]===_0xaac4('0xe3'));};Dialer[_0xaac4('0x18')]['saveInDb']=function(_0x523e8f,_0x264e7e,_0x2bd4c5){this[_0xaac4('0xd0')](_0x523e8f)[_0xaac4('0xb4')](loggerCatch(_0x264e7e));this[_0xaac4('0xce')](_0x523e8f)[_0xaac4('0xb4')](loggerCatch(_0x2bd4c5));};Dialer[_0xaac4('0x18')][_0xaac4('0x37')]=function(_0x180857){var _0x51bdf7=this[_0xaac4('0x26')][_0x180857[_0xaac4('0xe4')]];var _0x22e9b8;if(!_[_0xaac4('0xb0')](_0x180857)&&!_[_0xaac4('0xb0')](_0x180857[_0xaac4('0xe5')])&&!_[_0xaac4('0xb0')](_0x180857['variable'][_0xaac4('0xe6')])&&_0x180857[_0xaac4('0xe7')]==='xcally-motion-dialer'&&_0x51bdf7){if(_0x51bdf7['type']!=='ivr'&&this[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0xe8')]&&_0x180857[_0xaac4('0xe9')]===_0xaac4('0xea')){delete this[_0xaac4('0x26')][_0x180857[_0xaac4('0xe4')]];this[_0xaac4('0xb6')](this[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]]);this[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0x5d')]+=0x1;this[_0xaac4('0x1e')][_0x51bdf7['queue']][_0xaac4('0x5c')]+=0x1;_0x22e9b8=new Hangup(_0x51bdf7,_0x180857);_0x22e9b8['state']=0x12;_0x22e9b8[_0xaac4('0xeb')]=_0xaac4('0xec');_0x22e9b8[_0xaac4('0xed')]='AMD';ami[_0xaac4('0x4d')](_0xaac4('0xee'),ut[_0xaac4('0xef')](_0x22e9b8,_0xaac4('0xf0')));this['saveInDb'](_0x22e9b8,_0xaac4('0xf1'),_0xaac4('0xf2'));}if(_0x51bdf7[_0xaac4('0x4e')]!==_0xaac4('0x94')&&this[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]]['dialAMDActive']&&_0x180857[_0xaac4('0xe9')]===_0xaac4('0xf3')){var _0xc01bd=this;return new BPromise(function(_0x6d7f55,_0x258214){delete _0xc01bd['uniqueId'][_0x180857['uniqueid']];_0xc01bd['updateOriginated'](_0xc01bd[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]]);_0xc01bd[_0xaac4('0x1e')][_0x51bdf7['queue']][_0xaac4('0x5d')]+=0x1;_0xc01bd['voiceQueues'][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0x5c')]+=0x1;var _0x4388d0=_0xc01bd[_0xaac4('0x1e')][_0x51bdf7[_0xaac4('0xb7')]];var _0x56115e=new Hangup(_0x51bdf7,_0x180857);_0x56115e[_0xaac4('0xaa')]=0x13;_0x56115e['statedesc']=_0xaac4('0xf4');_0x56115e[_0xaac4('0xed')]=_0xaac4('0xf5');_0x56115e[_0xaac4('0xf6')]+=0x1;_0x56115e[_0xaac4('0xf7')]+=0x1;_0x56115e[_0xaac4('0xf0')]=!![];ami[_0xaac4('0x4d')]('custom:amd',ut[_0xaac4('0xef')](_0x56115e,_0xaac4('0xf0')));_0xc01bd[_0xaac4('0xd0')](_0x56115e)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x56115e[_0xaac4('0xf8')]+_0x56115e[_0xaac4('0xf9')]+_0x56115e[_0xaac4('0xfa')]+_0x56115e['countnosuchnumberretry']+_0x56115e['countdropretry']+_0x56115e['countabandonedretry']+_0x56115e[_0xaac4('0xf6')]+_0x56115e[_0xaac4('0xfb')]>=_0x4388d0['dialGlobalMaxRetry']){_0xc01bd['stateGlobal'](_0x56115e,_0x6d7f55,_0x258214,_0xaac4('0xfc'));}else{if(_0x56115e[_0xaac4('0xf6')]>=_0x4388d0['dialMachineMaxRetry']){_0xc01bd['createStateFinal'](_0x56115e,_0x6d7f55,_0x258214,_0xaac4('0xfd'));}else{_0xc01bd[_0xaac4('0xc3')]({'active':![],'countmachineretry':_0x56115e['countmachineretry'],'scheduledat':moment()[_0xaac4('0xfe')](_0x4388d0[_0xaac4('0xff')],'minutes')[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x56115e[_0xaac4('0xd9')],'ListId':_0x56115e[_0xaac4('0x101')],'VoiceQueueId':_0x56115e[_0xaac4('0xdb')]||undefined,'CampaignId':_0x56115e[_0xaac4('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x6d7f55({'reschedule':0x1});}}});}if(_0x51bdf7['type']===_0xaac4('0x94')&&this['campaigns'][_0x51bdf7[_0xaac4('0xb7')]]['dialAMDActive']&&_0x180857[_0xaac4('0xe9')]==='HANGUP'){delete this[_0xaac4('0x26')][_0x180857[_0xaac4('0xe4')]];this['updateOriginated'](this[_0xaac4('0x1f')][_0x51bdf7['queue']]);_0x22e9b8=new Hangup(_0x51bdf7,_0x180857);_0x22e9b8[_0xaac4('0xaa')]=0x12;_0x22e9b8['statedesc']=_0xaac4('0xec');_0x22e9b8[_0xaac4('0xed')]='AMD';ami[_0xaac4('0x4d')](_0xaac4('0xee'),ut[_0xaac4('0xef')](_0x22e9b8,_0xaac4('0xf0')));this['saveInDb'](_0x22e9b8,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x51bdf7['type']===_0xaac4('0x94')&&this[_0xaac4('0x1f')][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0xe8')]&&_0x180857[_0xaac4('0xe9')]===_0xaac4('0xf3')){var _0xc01bd=this;return new BPromise(function(_0x4ef5dc,_0x815df5){delete _0xc01bd['uniqueId'][_0x180857[_0xaac4('0xe4')]];_0xc01bd[_0xaac4('0xb6')](_0xc01bd[_0xaac4('0x1f')][_0x51bdf7[_0xaac4('0xb7')]]);_0xc01bd[_0xaac4('0x1f')][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0x5d')]+=0x1;_0xc01bd[_0xaac4('0x1f')][_0x51bdf7[_0xaac4('0xb7')]][_0xaac4('0x5c')]+=0x1;var _0x52c4c9=_0xc01bd[_0xaac4('0x1f')][_0x51bdf7[_0xaac4('0xb7')]];var _0x3f5e36=new Hangup(_0x51bdf7,_0x180857);_0x3f5e36[_0xaac4('0xaa')]=0x13;_0x3f5e36[_0xaac4('0xeb')]=_0xaac4('0xf4');_0x3f5e36[_0xaac4('0xed')]='AMD';_0x3f5e36[_0xaac4('0xf6')]+=0x1;_0x3f5e36[_0xaac4('0xf7')]+=0x1;_0x3f5e36[_0xaac4('0xf0')]=!![];ami[_0xaac4('0x4d')](_0xaac4('0xee'),ut[_0xaac4('0xef')](_0x3f5e36,_0xaac4('0xf0')));_0xc01bd['createHistory'](_0x3f5e36)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x102')));if(_0x3f5e36[_0xaac4('0xf8')]+_0x3f5e36[_0xaac4('0xf9')]+_0x3f5e36[_0xaac4('0xfa')]+_0x3f5e36['countnosuchnumberretry']+_0x3f5e36['countdropretry']+_0x3f5e36[_0xaac4('0x103')]+_0x3f5e36[_0xaac4('0xf6')]+_0x3f5e36[_0xaac4('0xfb')]>=_0x52c4c9[_0xaac4('0x104')]){_0xc01bd[_0xaac4('0x105')](_0x3f5e36,_0x4ef5dc,_0x815df5,_0xaac4('0xfc'));}else{if(_0x3f5e36[_0xaac4('0xf6')]>=_0x52c4c9[_0xaac4('0x106')]){_0xc01bd[_0xaac4('0x107')](_0x3f5e36,_0x4ef5dc,_0x815df5,_0xaac4('0xfd'));}else{_0xc01bd[_0xaac4('0xc3')]({'active':![],'countmachineretry':_0x3f5e36['countmachineretry'],'scheduledat':moment()[_0xaac4('0xfe')](_0x52c4c9['dialMachineRetryFrequency'],'minutes')[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f5e36[_0xaac4('0xd9')],'ListId':_0x3f5e36[_0xaac4('0x101')],'VoiceQueueId':_0x3f5e36['VoiceQueueId']||undefined,'CampaignId':_0x3f5e36['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x108')));_0x4ef5dc({'reschedule':0x1});}}});}}};Dialer[_0xaac4('0x18')][_0xaac4('0x109')]=function(_0x23546e){var _0x437e01=this[_0xaac4('0x26')][_0x23546e['uniqueid']];var _0x347281=this;var _0x4f6875;if(_0x437e01&&_0x437e01[_0xaac4('0x4e')]===_0xaac4('0x94')){delete this[_0xaac4('0x26')][_0x23546e[_0xaac4('0xe4')]];this['updateOriginated'](this[_0xaac4('0x1f')][_0x437e01[_0xaac4('0xb7')]]);this[_0xaac4('0x1f')][_0x437e01[_0xaac4('0xb7')]][_0xaac4('0x10a')]+=0x1;_0x4f6875=new Hangup(_0x437e01,_0x23546e);this[_0xaac4('0xd0')](_0x4f6875)['catch'](loggerCatch(_0xaac4('0x10b')));this[_0xaac4('0xce')](_0x4f6875)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x10c')));}if(_0x437e01&&_0x437e01['type']!==_0xaac4('0x94')&&isNotNull(this[_0xaac4('0x1e')][_0x437e01[_0xaac4('0xb7')]][_0xaac4('0x10d')])){delete this[_0xaac4('0x26')][_0x23546e[_0xaac4('0xe4')]];this[_0xaac4('0xb6')](this[_0xaac4('0x1e')][_0x437e01[_0xaac4('0xb7')]]);this[_0xaac4('0x1e')][_0x437e01['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xaac4('0x1e')][_0x437e01[_0xaac4('0xb7')]][_0xaac4('0x5c')]+=0x1;_0x4f6875=new Hangup(_0x437e01,_0x23546e);_0x4f6875[_0xaac4('0xaa')]=0x10;_0x4f6875['statedesc']=_0xaac4('0x10e');_0x4f6875['membername']='AGI';this[_0xaac4('0xd0')](_0x4f6875)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x10b')));this[_0xaac4('0xce')](_0x4f6875)['catch'](loggerCatch(_0xaac4('0x10c')));}if(_0x437e01&&_0x437e01[_0xaac4('0x4e')]!=='ivr'&&!isNotNull(this[_0xaac4('0x1e')][_0x437e01[_0xaac4('0xb7')]][_0xaac4('0x10d')])){delete this[_0xaac4('0x26')][_0x23546e[_0xaac4('0xe4')]];this['updateOriginated'](this['voiceQueues'][_0x437e01['queue']]);this[_0xaac4('0x1e')][_0x437e01[_0xaac4('0xb7')]][_0xaac4('0x10f')]+=0x1;_0x4f6875=new Hangup(_0x437e01,_0x23546e);_0x4f6875[_0xaac4('0xaa')]=0xc;_0x4f6875[_0xaac4('0xeb')]=_0x23546e['cause-txt'];_0x4f6875[_0xaac4('0xed')]=_0xaac4('0x110');this[_0xaac4('0xd0')](_0x4f6875)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x10b')));this['moveContactManagedDialer'](_0x4f6875)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x10c')));}};Dialer['prototype']['syncAgentComplete']=function(_0x145a51){var _0x5cbd00=this[_0xaac4('0x26')][_0x145a51['uniqueid']];var _0x4c1541=this;if(this['voiceQueues'][_0x145a51['queue']]){if(_0x5cbd00&&_0x5cbd00[_0xaac4('0x4e')]!==_0xaac4('0x94')){delete this[_0xaac4('0x26')][_0x145a51['uniqueid']];this[_0xaac4('0x1e')][_0x145a51[_0xaac4('0xb7')]][_0xaac4('0x5d')]+=0x1;var _0x4a0d74=new AgentComplete(_0x5cbd00,_0x145a51);if(_0x145a51[_0xaac4('0x111')]==='agent'){_0x4a0d74[_0xaac4('0x112')]=this[_0xaac4('0x1e')][_0x145a51[_0xaac4('0xb7')]][_0xaac4('0x113')]&&this[_0xaac4('0x1e')][_0x145a51[_0xaac4('0xb7')]][_0xaac4('0x114')]?moment()['format'](_0xaac4('0x100')):undefined;}this[_0xaac4('0xd0')](_0x4a0d74)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x115')));this[_0xaac4('0xce')](_0x4a0d74)[_0xaac4('0xb4')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xaac4('0x18')][_0xaac4('0x2c')]=function(_0x427213){if(this[_0xaac4('0x1e')][_0x427213[_0xaac4('0xb7')]]){if(this['uniqueId'][_0x427213[_0xaac4('0xe4')]]&&this['uniqueId'][_0x427213[_0xaac4('0xe4')]][_0xaac4('0x4e')]!==_0xaac4('0x94')){this[_0xaac4('0xb6')](this[_0xaac4('0x1e')][_0x427213[_0xaac4('0xb7')]]);this[_0xaac4('0x26')][_0x427213[_0xaac4('0xe4')]][_0xaac4('0x116')]=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));}}};Dialer['prototype'][_0xaac4('0x117')]=function(_0x34e0fa){this[_0xaac4('0xd0')](_0x34e0fa)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xaac4('0xce')](_0x34e0fa)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x118')));};Dialer['prototype'][_0xaac4('0x2e')]=function(_0x12a29f){var _0x31371c=this[_0xaac4('0x26')][_0x12a29f[_0xaac4('0xe4')]];var _0x1f2610=this;if(this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]]){if(_0x31371c&&_0x31371c[_0xaac4('0x4e')]!==_0xaac4('0x94')){delete this[_0xaac4('0x26')][_0x12a29f[_0xaac4('0xe4')]];this[_0xaac4('0xb6')](this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]]);_0x31371c[_0xaac4('0x119')]=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));var _0x45aca0=new QueueCallerAbandon(_0x31371c,_0x12a29f);if(getSeconds(_0x31371c['droptime'],_0x31371c[_0xaac4('0x11a')])>=_0x31371c[_0xaac4('0x11b')]){this['voiceQueues'][_0x12a29f[_0xaac4('0xb7')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xaac4('0x1e')][_0x12a29f['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]][_0xaac4('0x6d')]+=0x1;_0x45aca0[_0xaac4('0xaa')]=0xa;_0x45aca0[_0xaac4('0xeb')]=_0xaac4('0x11c');_0x45aca0[_0xaac4('0x11d')]=_0xaac4('0x11e');_0x45aca0['agiafterat']=this['voiceQueues'][_0x12a29f['queue']][_0xaac4('0x113')]?moment()[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x45aca0[_0xaac4('0x11f')]+=0x1;_0x45aca0['countglobal']+=0x1;if(_0x45aca0['countdropretry']>=this[_0xaac4('0x1e')][_0x12a29f['queue']][_0xaac4('0x120')]){this[_0xaac4('0x117')](_0x45aca0);}else{this[_0xaac4('0xc3')]({'active':![],'countdropretry':_0x45aca0[_0xaac4('0x11f')],'scheduledat':moment()[_0xaac4('0xfe')](this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]]['dialDropRetryFrequency'],_0xaac4('0x121'))[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x31371c[_0xaac4('0xd9')],'ListId':_0x31371c['ListId'],'VoiceQueueId':_0x31371c[_0xaac4('0xdb')]||undefined,'CampaignId':_0x31371c[_0xaac4('0xdc')]||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x122')));var _0x35e9d0=new History(_0x45aca0);_0x35e9d0[_0xaac4('0xaa')]=0xa;_0x35e9d0[_0xaac4('0xeb')]=_0xaac4('0x11c');_0x35e9d0['starttime']=moment()[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x35e9d0[_0xaac4('0xab')]=_0x35e9d0[_0xaac4('0xac')];_0x35e9d0[_0xaac4('0x123')]=_0x45aca0[_0xaac4('0x123')];_0x35e9d0[_0xaac4('0x124')]=_0x45aca0[_0xaac4('0x124')];this[_0xaac4('0xd0')](_0x35e9d0)['catch'](loggerCatch(_0xaac4('0x125')));}}else{this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xaac4('0x1e')][_0x12a29f['queue']][_0xaac4('0x62')]+=0x1;_0x45aca0[_0xaac4('0xaa')]=0xb;_0x45aca0[_0xaac4('0xeb')]=_0xaac4('0x126');_0x45aca0[_0xaac4('0x11d')]=_0xaac4('0x127');_0x45aca0[_0xaac4('0x103')]+=0x1;_0x45aca0[_0xaac4('0xf7')]+=0x1;if(_0x45aca0[_0xaac4('0x103')]>=this[_0xaac4('0x1e')][_0x12a29f[_0xaac4('0xb7')]][_0xaac4('0x128')]){this[_0xaac4('0x117')](_0x45aca0);}else{this[_0xaac4('0xc3')]({'active':![],'countabandonedretry':_0x45aca0[_0xaac4('0x103')],'scheduledat':moment()[_0xaac4('0xfe')](this['voiceQueues'][_0x12a29f[_0xaac4('0xb7')]][_0xaac4('0x129')],'minutes')[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x31371c[_0xaac4('0xd9')],'ListId':_0x31371c['ListId'],'VoiceQueueId':_0x31371c[_0xaac4('0xdb')]||undefined,'CampaignId':_0x31371c[_0xaac4('0xdc')]||undefined})['catch'](loggerCatch(_0xaac4('0x12a')));var _0x35e9d0=new History(_0x45aca0);_0x35e9d0[_0xaac4('0xaa')]=0xb;_0x35e9d0[_0xaac4('0xeb')]=_0xaac4('0x126');_0x35e9d0[_0xaac4('0xac')]=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));_0x35e9d0[_0xaac4('0xab')]=_0x35e9d0[_0xaac4('0xac')];_0x35e9d0['calleridname']=_0x45aca0[_0xaac4('0x123')];_0x35e9d0[_0xaac4('0x124')]=_0x45aca0[_0xaac4('0x124')];this[_0xaac4('0xd0')](_0x35e9d0)[_0xaac4('0xb4')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xaac4('0x18')][_0xaac4('0x35')]=function(_0x465892){if(this[_0xaac4('0x24')][_0x465892[_0xaac4('0xe4')]]){this[_0xaac4('0x24')][_0x465892[_0xaac4('0xe4')]][_0xaac4('0xb3')]=_0x465892[_0xaac4('0xb3')];}if(this['uniqueId'][_0x465892[_0xaac4('0xe4')]]){this[_0xaac4('0x26')][_0x465892['uniqueid']][_0xaac4('0xb3')]=_0x465892['channel'];}};Dialer[_0xaac4('0x18')][_0xaac4('0x39')]=function(_0xc42483){if(strategy[this[_0xaac4('0x1e')][this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0xb7')]][_0xaac4('0x12c')]]==='roundrobin'){if(this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]]&&_[_0xaac4('0xb0')](this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0x12d')])&&_0xc42483['status']==='1'&&_0xc42483[_0xaac4('0x12e')]==='0'){if(this['agents'][_0xc42483[_0xaac4('0x12f')]]){if(!this['agents'][_0xc42483[_0xaac4('0x12f')]][_0xaac4('0x12d')]){this[_0xaac4('0x20')][_0xc42483[_0xaac4('0x12f')]][_0xaac4('0x12d')]=!![];this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0x12d')]=!![];this[_0xaac4('0x24')][_0xc42483['actionid']]['stateinterface']=_0xc42483['stateinterface'];}}}}else if((strategy[this[_0xaac4('0x1e')][this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0xb7')]][_0xaac4('0x12c')]]||_0xaac4('0x16'))===_0xaac4('0x16')){if(this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]]){if(this[_0xaac4('0x20')][_0xc42483['stateinterface']]){this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0x12f')]=_0xc42483['stateinterface'];if(_[_0xaac4('0xb0')](this[_0xaac4('0x29')][this['actions'][_0xc42483[_0xaac4('0x12b')]]['queue']])){this[_0xaac4('0x29')][this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]]['queue']]=[];}this[_0xaac4('0x29')][this[_0xaac4('0x24')][_0xc42483[_0xaac4('0x12b')]][_0xaac4('0xb7')]][_0xaac4('0x130')](_[_0xaac4('0x91')](_[_0xaac4('0xd8')](this['actions'][_0xc42483[_0xaac4('0x12b')]],[_0xaac4('0x131'),'stateinterface']),{'status':_0xc42483[_0xaac4('0xb2')],'paused':_0xc42483[_0xaac4('0x12e')]}));}}}};function unlockQueueStatus(_0x11f6ac,_0x185fce){setTimeout(function(){if(_[_0xaac4('0x3d')](_0x11f6ac[_0xaac4('0x132')])){loggerBooked[_0xaac4('0x97')](_0xaac4('0x133'),_0x185fce);}_0x11f6ac[_0xaac4('0x132')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x185fce,JSON[_0xaac4('0x49')](_[_0xaac4('0xd8')](_0x11f6ac,[_0xaac4('0x3f'),_0xaac4('0x132')])));},0x1f3);}Dialer[_0xaac4('0x18')][_0xaac4('0x3a')]=function(_0x4e64cf){var _0x328872=this;var _0x46df79=_0x328872[_0xaac4('0x1e')][_0x328872[_0xaac4('0x24')][_0x4e64cf['actionid']][_0xaac4('0xb7')]];if(strategy[this[_0xaac4('0x1e')][this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]]['strategy']]===_0xaac4('0x17')){if(this[_0xaac4('0x24')][_0x4e64cf['actionid']]&&this['actions'][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0x12f')]){this[_0xaac4('0x1d')][_0xaac4('0x134')](this['actions'][_0x4e64cf['actionid']][_0xaac4('0x131')],this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0x12f')])[_0xaac4('0xb4')](function(_0x1d63e9){logger['error'](_0xaac4('0x135'),util[_0xaac4('0x98')](_0x1d63e9,{'showHidden':![],'depth':null}));})[_0xaac4('0x1b')](function(){_0x328872[_0xaac4('0xb6')](_0x328872['voiceQueues'][_0x328872[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]]);_0x328872[_0xaac4('0x20')][_0x328872[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0x12f')]][_0xaac4('0x12d')]=![];delete _0x328872['actions'][_0x4e64cf['actionid']];unlockQueueStatus(_0x46df79);});}else{this[_0xaac4('0xb6')](this[_0xaac4('0x1e')][this['actions'][_0x4e64cf['actionid']][_0xaac4('0xb7')]]);this[_0xaac4('0xc3')]({'active':![],'ContactId':this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]]['ContactId'],'ListId':this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0x101')],'VoiceQueueId':this['actions'][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xdb')]||undefined,'CampaignId':this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xdc')]||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x136')));delete this['actions'][_0x4e64cf[_0xaac4('0x12b')]];unlockQueueStatus(_0x46df79);}}else if((strategy[this[_0xaac4('0x1e')][this[_0xaac4('0x24')][_0x4e64cf['actionid']][_0xaac4('0xb7')]][_0xaac4('0x12c')]]||'rrmemory')===_0xaac4('0x16')){var _0x3c9b4e;if(this['actions'][_0x4e64cf[_0xaac4('0x12b')]]&&!_[_0xaac4('0x7e')](this[_0xaac4('0x29')][this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]]['queue']])){if(this[_0xaac4('0x2a')][_0x328872[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]]){this['queueBookedRR'][_0x328872[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]]=this[_0xaac4('0x2a')][this[_0xaac4('0x24')][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]]?this['queueBookedRR'][this['actions'][_0x4e64cf['actionid']][_0xaac4('0xb7')]]:this[_0xaac4('0x29')][this[_0xaac4('0x24')][_0x4e64cf['actionid']][_0xaac4('0xb7')]]?this[_0xaac4('0x29')][this[_0xaac4('0x24')][_0x4e64cf['actionid']][_0xaac4('0xb7')]][_0xaac4('0x137')]||0x0:0x0;}this[_0xaac4('0x29')][this['actions'][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]][_0xaac4('0x137')]=this['queueBookedRR'][this['actions'][_0x4e64cf[_0xaac4('0x12b')]][_0xaac4('0xb7')]];for(var _0x4b6c7e=0x0;_0x4b6c7e=0x0;})[_0xaac4('0xb4')](myreject(_0x3c17b8)));}}else{_0x217e88[_0xaac4('0x130')](ami[_0xaac4('0xb1')]({'action':_0xaac4('0x14d'),'command':util[_0xaac4('0x7a')](_0xaac4('0x14e'),_0x1a56a6,!_[_0xaac4('0x3d')](config[_0xaac4('0x14f')][_0x4c539b])?_0x4c539b:'')})[_0xaac4('0xbb')](function(_0x19a236){return _0x19a236[_0xaac4('0x150')][_0xaac4('0x151')]('true')>=0x0;})['catch'](myreject(_0x3c17b8)));}BPromise[_0xaac4('0x153')](_0x217e88)[_0xaac4('0xbb')](function(_0x376426){var _0x4864b4=_[_0xaac4('0x154')](_0x376426);if(_0x4864b4){return _0x248f3e(_0x4864b4);}else{_0x36e765[_0xaac4('0x44')]=_0x130b82?_0xaac4('0x155'):'INTERVAL_IS_OVERTIME';return _0x3c17b8(msgResponse(_0xaac4('0x156'),_0xaac4('0x146'),_0xaac4('0x157')+_0x130b82+'\x20'+_0x5ad458+_0xaac4('0x158')+util[_0xaac4('0x98')](_0x1a56a6,{'showHidden':![],'depth':null})+_0xaac4('0x159')+_0x4c539b));}})[_0xaac4('0xb4')](function(_0x510881){return _0x3c17b8(msgResponse(_0xaac4('0x144'),_0xaac4('0x146'),JSON[_0xaac4('0x49')](_0x510881)));});});};Dialer['prototype'][_0xaac4('0x15a')]=function(_0x115e1f){var _0x48d670=this;return function(){switch(_0x115e1f[_0xaac4('0x5a')]){case _0xaac4('0x15b'):freeVariablesPredictive(_0x115e1f);_0x48d670[_0xaac4('0x15c')](_0x115e1f,0x1);break;case _0xaac4('0x15d'):freeVariablesPredictive(_0x115e1f);_0x48d670['handlePower'](_0x115e1f,_0x115e1f['dialPowerLevel']);break;case _0xaac4('0xa'):_0x48d670[_0xaac4('0xa')](_0x115e1f);break;case'booked':freeVariablesPredictive(_0x115e1f);_0x48d670[_0xaac4('0x15c')](_0x115e1f,0x1);break;default:freeVariablesPredictive(_0x115e1f);logger[_0xaac4('0x97')](_0xaac4('0x15e'),_0x115e1f[_0xaac4('0x3f')],_0xaac4('0x15f'));}};};Dialer[_0xaac4('0x18')][_0xaac4('0x160')]=function(_0x5f30cf){var _0x425771=this;return function(){_0x425771['handleIvr'](_0x5f30cf);};};Dialer['prototype']['syncQueueSummary']=function(_0x15fa36){var _0x3ebaf2=this;if(isNotPreview(_0x15fa36['dialMethod'])){if(isVoiceQueueOutbound(_0x15fa36[_0xaac4('0x4e')])&&isActive(_0x15fa36[_0xaac4('0x59')])){_0x15fa36[_0xaac4('0xa2')]=!![];BPromise['resolve']()[_0xaac4('0xbb')](checkIsLoggedIn(_0x15fa36,_0x15fa36[_0xaac4('0x51')]))[_0xaac4('0xbb')](checkIsActive(_0x15fa36,_0x15fa36['dialActive']))['then'](checkInterval(_0x15fa36))['then'](_0x3ebaf2[_0xaac4('0x141')](_0x15fa36))[_0xaac4('0xbb')](_0x3ebaf2[_0xaac4('0x161')](_0x15fa36[_0xaac4('0x162')],_0x15fa36[_0xaac4('0x163')],_0x15fa36['name'],_0x15fa36))[_0xaac4('0xbb')](_0x3ebaf2[_0xaac4('0x145')](_0x15fa36['Interval'],_0x15fa36['dialTimezone'],_0x15fa36[_0xaac4('0x3f')],_0x15fa36))[_0xaac4('0xbb')](_0x3ebaf2['checkDialMethod'](_0x15fa36))[_0xaac4('0xb4')](loggerCatchQueueSummary(_0xaac4('0x164'),_0x15fa36));}else{notSendMessagesQueue(_0x15fa36);}}else{freeVariablesPredictive(_0x15fa36);}};Dialer['prototype'][_0xaac4('0x140')]=function(){var _0x33935a=this;var _0x35e92b;for(var _0x18e9e5 in this[_0xaac4('0x1f')]){if(typeof this['campaigns'][_0x18e9e5]!=='undefined'){_0x35e92b=this[_0xaac4('0x1f')][_0x18e9e5];if(isCampaignIvr(_0x35e92b[_0xaac4('0x4e')])&&isActive(_0x35e92b['active'])){_0x35e92b['sendMessageOneNotActive']=!![];BPromise[_0xaac4('0xba')]()[_0xaac4('0xbb')](checkIsActive(_0x35e92b,_0x35e92b['active']))['then'](checkInterval(_0x35e92b))[_0xaac4('0xbb')](_0x33935a[_0xaac4('0x141')](_0x35e92b))[_0xaac4('0xbb')](_0x33935a[_0xaac4('0x161')](_0x35e92b[_0xaac4('0x162')],_0x35e92b[_0xaac4('0x163')],_0x35e92b[_0xaac4('0x3f')],_0x35e92b))[_0xaac4('0xbb')](_0x33935a['checkIfTimeIntervals'](_0x35e92b[_0xaac4('0x43')],_0x35e92b[_0xaac4('0x163')],_0x35e92b['name'],_0x35e92b))['then'](_0x33935a['launchHandleIvr'](_0x35e92b))[_0xaac4('0xb4')](loggerCatchQueueSummary('[syncCampaigns]',_0x35e92b));}else{notSendMessagesCampaign(_0x35e92b);}}}};function getCallerIdRandom(_0x9c5dd,_0xa6b172){var _0x357fe7;var _0x35b3f4;var _0x7b786a;if(_0xa6b172<=0x0){_0xa6b172=0x1;}_0x357fe7=new RegExp(_0xaac4('0x165')+_0xa6b172+'}$');_0x35b3f4=Math[_0xaac4('0x166')](0xa,_0xa6b172-0x1);_0x7b786a=Math[_0xaac4('0x166')](0xa,_0xa6b172)-0x1;return util[_0xaac4('0x7a')]('%s',_[_0xaac4('0x167')](_0x9c5dd,_0x357fe7,_['random'](_0x35b3f4,_0x7b786a)));}function extractCalleridName(_0x4cde3d){var _0x37e797=_0x4cde3d[_0xaac4('0x168')](/"(.*?)"/);return _0x37e797?_0x37e797[0x1]:_0x4cde3d;}function extractCalleridNumber(_0x10b207){var _0x51ff3e=_0x10b207[_0xaac4('0x168')](/<(.*?)>/);return _0x51ff3e?_0x51ff3e[0x1]:_0x10b207;}Dialer['prototype'][_0xaac4('0x169')]=function(_0x18c5ce,_0x4b3508){var _0x5491c6=this;var _0xc39ca5=uuid['v4']();this[_0xaac4('0x24')][_0xc39ca5]=new Action(_0x18c5ce,_0x4b3508,_0xc39ca5);return new BPromise(function(_0x33b5e4,_0x49afc0){if(_['isUndefined'](_0x18c5ce)&&typeof _0x18c5ce!==_0xaac4('0x16a')){return _0x49afc0(msgResponse('originate',_0xaac4('0x146'),'voiceQueue\x20is\x20undefine'));}if(_[_0xaac4('0x3d')](_0x4b3508[_0xaac4('0x16b')][_0xaac4('0x16c')])||_0x4b3508['Contact']['phone']===null){return _0x49afc0(msgResponse(_0xaac4('0x16d'),_0xaac4('0x146'),'contact\x20is\x20undefine'));}var _0x12707c={'XMD-CALLERID':_0x5491c6[_0xaac4('0x24')][_0xc39ca5][_0xaac4('0x16e')](),'XMD-AGI':_0x18c5ce[_0xaac4('0x10d')]?util[_0xaac4('0x7a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x18c5ce[_0xaac4('0x10d')]):_0xaac4('0x16f'),'XMD-AGIAFTER':_0x18c5ce[_0xaac4('0x113')]?util[_0xaac4('0x7a')](_0xaac4('0x170'),ipAgi,_0x18c5ce[_0xaac4('0x113')]):'NONE','XMD-QUEUE':_0x18c5ce[_0xaac4('0x4e')]===_0xaac4('0x4f')?util[_0xaac4('0x7a')](_0xaac4('0x171'),_0x18c5ce[_0xaac4('0x3f')],_0x18c5ce[_0xaac4('0x172')]||'',_0x18c5ce[_0xaac4('0x114')]?'c':'',_0x18c5ce[_0xaac4('0x11b')]||0x3):_0xaac4('0x16f'),'XMD-CONTACTID':_0x4b3508[_0xaac4('0xd9')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5491c6[_0xaac4('0x24')][_0xc39ca5][_0xaac4('0x16e')](),'XMD-AMD':_0x18c5ce[_0xaac4('0xe8')]?_0xaac4('0x173'):'NONE','XMD-DESTINATION':_0xaac4('0x174')};if(_0x18c5ce[_0xaac4('0xe8')]){_0x12707c[_0xaac4('0x175')]=_0x18c5ce[_0xaac4('0x176')]||0x9c4;_0x12707c[_0xaac4('0x177')]=_0x18c5ce['dialAMDGreeting']||0x5dc;_0x12707c['XMD-AMDAFTERGREETINGSILENCE']=_0x18c5ce[_0xaac4('0x178')]||0x320;_0x12707c['XMD-AMDTOTALANALYSISTIME']=_0x18c5ce[_0xaac4('0x179')]||0x1388;_0x12707c[_0xaac4('0x17a')]=_0x18c5ce['dialAMDMinWordLength']||0x64;_0x12707c[_0xaac4('0x17b')]=_0x18c5ce[_0xaac4('0x17c')]||0x32;_0x12707c[_0xaac4('0x17d')]=_0x18c5ce[_0xaac4('0x17e')]||0x3;_0x12707c[_0xaac4('0x17f')]=_0x18c5ce['dialAMDSilenceThreshold']||0x100;_0x12707c[_0xaac4('0x180')]=_0x18c5ce['dialAMDMaximumWordLength']||0x1388;}if(_0x18c5ce[_0xaac4('0x4e')]===_0xaac4('0x4f')){_0x12707c[_0xaac4('0x181')]=_0x4b3508[_0xaac4('0xdb')];}else{_0x12707c[_0xaac4('0x182')]=_0x4b3508[_0xaac4('0xdc')];}for(var _0x3345cf in _0x4b3508['Contact']){if(typeof _0x4b3508[_0xaac4('0x16b')][_0x3345cf]!=='undefined'){if(isNotNull(_0x4b3508[_0xaac4('0x16b')][_0x3345cf])&&_0x3345cf!=='id'&&_0x3345cf!=='tags'&&_0x3345cf!==_0xaac4('0x183')&&_0x3345cf!=='updatedAt'){_0x12707c[util[_0xaac4('0x7a')]('%s%s',_0xaac4('0x184'),_[_0xaac4('0x185')](_0x3345cf))]=_0x4b3508[_0xaac4('0x16b')][_0x3345cf];}}}var _0x28bde8=_0x5491c6[_0xaac4('0xe0')](_0x18c5ce[_0xaac4('0x78')])?getCallerId(_0x18c5ce['Trunk']['callerid'],_0x18c5ce[_0xaac4('0x186')],_0x18c5ce[_0xaac4('0x187')]>0x0?getCallerIdRandom(_0x18c5ce[_0xaac4('0x5b')],_0x18c5ce['dialRandomLastDigitCallerIdNumber']):_0x18c5ce[_0xaac4('0x5b')]):getCallerId(_[_0xaac4('0xb0')](_0x18c5ce[_0xaac4('0x142')])?_0x18c5ce[_0xaac4('0x78')][_0xaac4('0x188')]:_0x18c5ce['TrunkBackup'][_0xaac4('0x188')],_0x18c5ce['dialOriginateCallerIdName'],_0x18c5ce[_0xaac4('0x187')]>0x0?getCallerIdRandom(_0x18c5ce[_0xaac4('0x5b')],_0x18c5ce[_0xaac4('0x187')]):_0x18c5ce[_0xaac4('0x5b')]);if(_0x28bde8){_0x12707c[_0xaac4('0x189')]=_0x5491c6['actions'][_0xc39ca5]['originatecalleridname']=extractCalleridName(_0x28bde8);_0x12707c[_0xaac4('0x18a')]=_0x5491c6[_0xaac4('0x24')][_0xc39ca5][_0xaac4('0x18b')]=extractCalleridNumber(_0x28bde8);}return ami[_0xaac4('0xb1')]({'actionid':_0xc39ca5,'action':_0xaac4('0x16d'),'channel':_0x5491c6[_0xaac4('0xe0')](_0x18c5ce[_0xaac4('0x78')])?util[_0xaac4('0x7a')]('SIP/%s/%s%s',_0x18c5ce[_0xaac4('0x78')]['name'],isNotNull(_0x18c5ce[_0xaac4('0x18c')])?_0x18c5ce[_0xaac4('0x18c')][_0xaac4('0x18d')]()||'':'',_0x18c5ce['dialCutDigit']>0x0?_0x4b3508[_0xaac4('0x16b')]['phone'][_0xaac4('0x18e')](_0x18c5ce[_0xaac4('0x18f')]):_0x4b3508[_0xaac4('0x16b')][_0xaac4('0x16c')]):util['format'](_0xaac4('0x190'),_[_0xaac4('0xb0')](_0x18c5ce[_0xaac4('0x142')])?_0x18c5ce[_0xaac4('0x78')][_0xaac4('0x3f')]:_0x18c5ce['TrunkBackup'][_0xaac4('0x3f')],isNotNull(_0x18c5ce['dialPrefix'])?_0x18c5ce[_0xaac4('0x18c')][_0xaac4('0x18d')]()||'':'',_0x18c5ce[_0xaac4('0x18f')]>0x0?_0x4b3508[_0xaac4('0x16b')][_0xaac4('0x16c')][_0xaac4('0x18e')](_0x18c5ce['dialCutDigit']):_0x4b3508[_0xaac4('0x16b')][_0xaac4('0x16c')]),'callerid':_0x28bde8,'Exten':_0xaac4('0x174'),'Context':_0xaac4('0x191'),'Priority':'1','variable':_0x12707c,'timeout':(_0x18c5ce[_0xaac4('0x192')]||0x1e)*0x3e8,'async':!![],'channelid':_0xc39ca5})[_0xaac4('0xbb')](function(_0x472eae){return _0x33b5e4(_0x472eae);})[_0xaac4('0xb4')](function(_0x5da8ea){_0x18c5ce['outboundOriginateFailureCallsDay']+=0x1;var _0x1a66b6=new History(_0x5491c6[_0xaac4('0x24')][_0xc39ca5]);logger['error'](util[_0xaac4('0x7a')](_0xaac4('0x193'),JSON[_0xaac4('0x49')](_0x5da8ea)));_0x1a66b6[_0xaac4('0xaa')]=0xe;_0x1a66b6['statedesc']=_0xaac4('0x194');_0x1a66b6[_0xaac4('0xac')]=moment()[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a66b6[_0xaac4('0xab')]=_0x1a66b6[_0xaac4('0xac')];_0x5491c6[_0xaac4('0xd0')](_0x1a66b6)[_0xaac4('0xb4')](loggerCatch('[originate][error]'));_0x5491c6[_0xaac4('0xce')](_0x1a66b6)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x195')))[_0xaac4('0x1b')](function(){delete _0x5491c6['actions'][_0xc39ca5];return _0x49afc0(msgResponse(_0xaac4('0x16d'),_0xaac4('0x196'),'originate\x20action\x20Error'));});});});};Dialer[_0xaac4('0x18')][_0xaac4('0x30')]=function(_0x9208d1){var _0x2196f5=this[_0xaac4('0x24')][_0x9208d1[_0xaac4('0x12b')]];if(_0x2196f5){delete this[_0xaac4('0x24')][_0x9208d1[_0xaac4('0x12b')]];_0x2196f5[_0xaac4('0x11a')]=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));var _0x352cf2=_0x2196f5['type']===_0xaac4('0x94')?this[_0xaac4('0x1f')][_0x2196f5[_0xaac4('0xb7')]]:this[_0xaac4('0x1e')][_0x2196f5['getQueue']()];if(!this[_0xaac4('0xdf')](_0x9208d1['response'])){this[_0xaac4('0xb6')](_0x352cf2);return this[_0xaac4('0x197')](_0x2196f5,_0x352cf2,_0x9208d1)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x198')));}this['uniqueId'][_0x9208d1[_0xaac4('0xe4')]]=_0x2196f5;}};Dialer[_0xaac4('0x18')][_0xaac4('0x199')]=function(_0x47cab2,_0x4741cf,_0x57290f){var _0x4a30bb=new History(_0x4741cf);if(_0x4a30bb[_0xaac4('0xf8')]+_0x4a30bb[_0xaac4('0xf9')]+_0x4a30bb[_0xaac4('0xfa')]+_0x4a30bb[_0xaac4('0x19a')]+_0x4a30bb[_0xaac4('0x11f')]+_0x4a30bb['countabandonedretry']+_0x4a30bb[_0xaac4('0xf6')]+_0x4a30bb[_0xaac4('0xfb')]>=_0x57290f[_0xaac4('0x104')]-0x1){return!![];}switch(_0x47cab2){case 0x3:if(_0x4a30bb[_0xaac4('0xfa')]>=_0x57290f[_0xaac4('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4a30bb[_0xaac4('0xfa')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0x19c')],_0xaac4('0x121'))[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x4a30bb['ContactId'],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb['VoiceQueueId']||undefined,'CampaignId':_0x4a30bb[_0xaac4('0xdc')]||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x19d')));break;case 0x5:if(_0x4a30bb[_0xaac4('0xf8')]>=_0x57290f[_0xaac4('0x19e')]-0x1){return!![];}this[_0xaac4('0xc3')]({'active':![],'countbusyretry':_0x4a30bb['countbusyretry']+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0x19f')],'minutes')[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb['ListId'],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb['CampaignId']||undefined})['catch'](loggerCatch(_0xaac4('0x1a0')));break;case 0x8:if(_0x4a30bb[_0xaac4('0xf9')]>=_0x57290f['dialCongestionMaxRetry']-0x1){return!![];}this[_0xaac4('0xc3')]({'active':![],'countcongestionretry':_0x4a30bb[_0xaac4('0xf9')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f['dialCongestionRetryFrequency'],_0xaac4('0x121'))[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb['ListId'],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4a30bb[_0xaac4('0x19a')]>=_0x57290f['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xaac4('0xc3')]({'active':![],'countnosuchnumberretry':_0x4a30bb[_0xaac4('0x19a')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0x1a1')],_0xaac4('0x121'))[_0xaac4('0x7a')](_0xaac4('0x100')),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb[_0xaac4('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4a30bb[_0xaac4('0x11f')]>=_0x57290f['dialDropMaxRetry']-0x1){return!![];}this[_0xaac4('0xc3')]({'active':![],'countdropretry':_0x4a30bb['countdropretry']+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0x1a2')],_0xaac4('0x121'))[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x122')));break;case 0xb:if(_0x4a30bb[_0xaac4('0x103')]>=_0x57290f[_0xaac4('0x128')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x4a30bb[_0xaac4('0x103')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f['dialAbandonedRetryFrequency'],_0xaac4('0x121'))['format'](_0xaac4('0x100')),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb[_0xaac4('0xdc')]||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x12a')));break;case 0x13:if(_0x4a30bb['countmachineretry']>=_0x57290f['dialMachineMaxRetry']-0x1){return!![];}this[_0xaac4('0xc3')]({'active':![],'countmachineretry':_0x4a30bb[_0xaac4('0xf6')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0xff')],_0xaac4('0x121'))[_0xaac4('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a30bb['ContactId'],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x108')));break;case 0x14:if(_0x4a30bb['countagentrejectretry']>=_0x57290f[_0xaac4('0x1a3')]-0x1){return!![];}this[_0xaac4('0xc3')]({'active':![],'countagentrejectretry':_0x4a30bb[_0xaac4('0xfb')]+=0x1,'scheduledat':moment()[_0xaac4('0xfe')](_0x57290f[_0xaac4('0x1a4')],_0xaac4('0x121'))['format'](_0xaac4('0x100')),'ContactId':_0x4a30bb[_0xaac4('0xd9')],'ListId':_0x4a30bb[_0xaac4('0x101')],'VoiceQueueId':_0x4a30bb[_0xaac4('0xdb')]||undefined,'CampaignId':_0x4a30bb[_0xaac4('0xdc')]||undefined})['catch'](loggerCatch(_0xaac4('0x1a5')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x149e1f,_0x23d336,_0x1f0e45){var _0x173b34=this;var _0x153fec=new History(_0x149e1f);return new BPromise(function(_0x44dcef,_0x5e4cf7){if(_['isUndefined'](_0x23d336)&&typeof _0x23d336!==_0xaac4('0x16a')){return _0x5e4cf7(msgResponse(_0xaac4('0x1a6'),_0xaac4('0x146'),'entity\x20is\x20undefine'));}if(_[_0xaac4('0x3d')](_0x1f0e45)&&typeof _0x1f0e45!==_0xaac4('0x16a')){return _0x5e4cf7(msgResponse(_0xaac4('0x1a6'),_0xaac4('0x146'),_0xaac4('0x1a7')));}switch(_0x1f0e45[_0xaac4('0x111')]){case'0':_0x23d336['outboundNoSuchCallsDay']+=0x1;_0x153fec[_0xaac4('0xaa')]=0x0;_0x153fec['statedesc']='NoSuchNumber';_0x153fec[_0xaac4('0x19a')]+=0x1;_0x153fec[_0xaac4('0xf7')]+=0x1;ami[_0xaac4('0x4d')]('custom:agentnosuchnumber',ut[_0xaac4('0xef')](_0x149e1f,'nosuchnumber'));_0x173b34['createHistory'](_0x153fec)[_0xaac4('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x173b34['checkRetriveMax'](0x0,_0x149e1f,_0x23d336)){if(_0x153fec['countnosuchnumberretry']>=_0x23d336['dialNoSuchNumberMaxRetry']){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1a8'));}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1a8'));}}break;case'3':_0x23d336[_0xaac4('0x1a9')]+=0x1;_0x153fec[_0xaac4('0xaa')]=0x3;_0x153fec[_0xaac4('0xeb')]='NoAnswer';_0x153fec[_0xaac4('0xfa')]+=0x1;_0x153fec['countglobal']+=0x1;ami[_0xaac4('0x4d')](_0xaac4('0x1aa'),ut[_0xaac4('0xef')](_0x149e1f,'noanswer'));_0x173b34[_0xaac4('0xd0')](_0x153fec)['catch'](loggerCatch(_0xaac4('0x1ab')));if(_0x173b34[_0xaac4('0x199')](0x3,_0x149e1f,_0x23d336)){if(_0x153fec[_0xaac4('0xfa')]>=_0x23d336[_0xaac4('0x19b')]){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1ac'));}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x23d336['outboundBusyCallsDay']+=0x1;_0x153fec[_0xaac4('0xaa')]=0x5;_0x153fec[_0xaac4('0xeb')]=_0xaac4('0x1ad');_0x153fec[_0xaac4('0xf8')]+=0x1;_0x153fec[_0xaac4('0xf7')]+=0x1;ami[_0xaac4('0x4d')](_0xaac4('0x1ae'),ut['buildObj'](_0x149e1f,'busy'));_0x173b34[_0xaac4('0xd0')](_0x153fec)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x1af')));if(_0x173b34[_0xaac4('0x199')](0x5,_0x149e1f,_0x23d336)){if(_0x153fec[_0xaac4('0xf8')]>=_0x23d336[_0xaac4('0x19e')]){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,'reason\x205\x20busy');}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,'reason\x205\x20busy');}}break;case'8':_0x23d336[_0xaac4('0x60')]+=0x1;_0x153fec[_0xaac4('0xaa')]=0x8;_0x153fec[_0xaac4('0xeb')]=_0xaac4('0x1b0');_0x153fec[_0xaac4('0xf9')]+=0x1;_0x153fec[_0xaac4('0xf7')]+=0x1;ami[_0xaac4('0x4d')](_0xaac4('0x1b1'),ut[_0xaac4('0xef')](_0x149e1f,_0xaac4('0x1b2')));_0x173b34[_0xaac4('0xd0')](_0x153fec)[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x1b3')));if(_0x173b34[_0xaac4('0x199')](0x8,_0x149e1f,_0x23d336)){if(_0x153fec[_0xaac4('0xf9')]>=_0x23d336[_0xaac4('0x1b4')]){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1b5'));}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1b5'));}}break;case'11':_0x23d336[_0xaac4('0x1b6')]+=0x1;_0x153fec[_0xaac4('0xaa')]=0xb;_0x153fec['statedesc']=_0xaac4('0x126');_0x153fec[_0xaac4('0x103')]+=0x1;_0x153fec['countglobal']+=0x1;_0x173b34[_0xaac4('0xd0')](_0x153fec)['catch'](loggerCatch(_0xaac4('0x1b7')));if(_0x173b34[_0xaac4('0x199')](0xb,_0x149e1f,_0x23d336)){if(_0x153fec[_0xaac4('0x103')]>=_0x23d336['dialAbandonedMaxRetry']){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1b8'));}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1b8'));}}break;case'20':_0x23d336['outboundRejectCallsDay']+=0x1;_0x153fec[_0xaac4('0xaa')]=0x14;_0x153fec[_0xaac4('0xeb')]=_0xaac4('0x1b9');_0x153fec['countagentrejectretry']+=0x1;_0x153fec['countglobal']+=0x1;ami[_0xaac4('0x4d')](_0xaac4('0x1ba'),ut[_0xaac4('0xef')](_0x149e1f,_0xaac4('0x1bb')));_0x173b34[_0xaac4('0xd0')](_0x153fec)[_0xaac4('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x173b34[_0xaac4('0x199')](0x14,_0x149e1f,_0x23d336)){if(_0x153fec['countagentrejectretry']>=_0x23d336['dialAgentRejectMaxRetry']){_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1bc'));}else{_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,_0xaac4('0x1bc'));}}break;default:_0x23d336[_0xaac4('0x10f')]+=0x1;_0x153fec[_0xaac4('0xaa')]=0xc;_0x153fec[_0xaac4('0xeb')]=_0x1f0e45[_0xaac4('0x111')];_0x173b34[_0xaac4('0xd0')](_0x153fec)['catch'](loggerCatch(_0xaac4('0x1bd')));if(_0x173b34[_0xaac4('0x199')](_0x1f0e45['reason'],_0x149e1f,_0x23d336)){if(_0x153fec[_0xaac4('0xf8')]+_0x153fec[_0xaac4('0xf9')]+_0x153fec[_0xaac4('0xfa')]+_0x153fec['countnosuchnumberretry']+_0x153fec['countdropretry']+_0x153fec['countabandonedretry']+_0x153fec[_0xaac4('0xf6')]+_0x153fec[_0xaac4('0xfb')]>=_0x23d336[_0xaac4('0x104')]){_0x173b34[_0xaac4('0x105')](_0x153fec,_0x44dcef,_0x5e4cf7,_0x1f0e45[_0xaac4('0x111')]);}else{_0x173b34[_0xaac4('0x107')](_0x153fec,_0x44dcef,_0x5e4cf7,_0x1f0e45[_0xaac4('0x111')]);}}}});};Dialer[_0xaac4('0x18')][_0xaac4('0x105')]=function(_0x50c438,_0x542bcf,_0x299ea0,_0x5f46aa){var _0x1520ad=new Final(_0x50c438);_0x1520ad[_0xaac4('0xaa')]=0xf;_0x1520ad[_0xaac4('0xeb')]=_0xaac4('0x1be');this['createStateFinal'](_0x1520ad,_0x542bcf,_0x299ea0,_0x5f46aa);};Dialer[_0xaac4('0x18')][_0xaac4('0x107')]=function(_0x344851,_0x23dd25,_0x13ee41,_0x103b7c){this['moveContactManagedDialer'](_0x344851)[_0xaac4('0xbb')](function(){return _0x23dd25(msgResponse(_0xaac4('0x1a6'),_0xaac4('0x1bf'),_0x103b7c));})[_0xaac4('0xb4')](function(){return _0x13ee41(msgResponse(_0xaac4('0x1c0'),_0xaac4('0x146'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xaac4('0xa')]=function(_0x5ba7c4){var _0x4228ce=_0x5ba7c4['dialPredictiveOptimizationPercentage']/0x64;var _0x4b98d1=_0x5ba7c4[_0xaac4('0x63')]/(_0x5ba7c4[_0xaac4('0x63')]+_0x5ba7c4['outboundAnswerCallsDay']);var _0x10d30c=Math[_0xaac4('0x1c1')](_0x5ba7c4[_0xaac4('0x70')]*(_0x5ba7c4['predictiveIntervalMaxThreshold']/0x64));var _0x4fb19a=Math[_0xaac4('0x1c1')](_0x5ba7c4[_0xaac4('0x70')]*(_0x5ba7c4[_0xaac4('0x1c2')]/0x64));var _0x155070=_0x5ba7c4[_0xaac4('0x50')]+_0x5ba7c4[_0xaac4('0xa3')];var _0x5bd3e9=Math[_0xaac4('0x1c3')](_0x5ba7c4[_0xaac4('0x73')]*_0x5ba7c4['erlangAbandonmentRate']*_0x5ba7c4[_0xaac4('0x6e')]*_0x5ba7c4[_0xaac4('0x1c4')]);if(_[_0xaac4('0x3d')](_0x5ba7c4[_0xaac4('0x77')])){if(!_['isUndefined'](_0x5ba7c4[_0xaac4('0x27')])){_0x5ba7c4[_0xaac4('0x27')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x5ba7c4['handlePredictive'])){loggerPredictive['error'](_0xaac4('0x1c5'),_0xaac4('0x1c6'));clearInterval(_0x5ba7c4[_0xaac4('0x1c7')]);_0x5ba7c4[_0xaac4('0x1c7')]=undefined;}_0x5ba7c4['startProgressive']=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));loggerPredictive[_0xaac4('0x80')](_0x5ba7c4[_0xaac4('0x3f')],_0xaac4('0x1c8'),_0x5ba7c4['startProgressive']);this[_0xaac4('0x15c')](_0x5ba7c4,0x1);}else if(ifInterval(_0x5ba7c4[_0xaac4('0x1c9')],_0x5ba7c4['startProgressive'])){this['handlePower'](_0x5ba7c4,0x1);loggerPredictiveCalls[_0xaac4('0x80')](_0xaac4('0x1ca'),_0x5ba7c4[_0xaac4('0x77')],_0x5ba7c4[_0xaac4('0x3f')]);_0x5ba7c4[_0xaac4('0x73')]=0x0;_0x5ba7c4['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4228ce<_0x4b98d1&&_0x5ba7c4['dialPredictiveOptimization']===_0xaac4('0x1cb')){freeVariablesPredictive(_0x5ba7c4);loggerPredictive['info'](_0xaac4('0x1cc'),_0xaac4('0x1cd'),_0x4b98d1,_0xaac4('0x77'),_0x5ba7c4[_0xaac4('0x3f')]);}else if(_0x5bd3e9<_0x5ba7c4['predictiveIntervalErlangCallsDroppedCalls']&&_0x5ba7c4[_0xaac4('0x1ce')]===_0xaac4('0x1cb')){freeVariablesPredictive(_0x5ba7c4);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x1cf'),'Max\x20Drop\x20',_0x5bd3e9,_0xaac4('0x1d0'),_0x5ba7c4[_0xaac4('0x6d')],_0xaac4('0x77'),_0x5ba7c4[_0xaac4('0x3f')]);}else if(!ifInterval(_0x5ba7c4[_0xaac4('0x1c9')],_0x5ba7c4['startProgressive'])&&_[_0xaac4('0x3d')](_0x5ba7c4[_0xaac4('0x27')])&&!_[_0xaac4('0x3d')](_0x5ba7c4[_0xaac4('0x77')])){_0x5ba7c4[_0xaac4('0x27')]=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));loggerPredictive[_0xaac4('0x80')](_0x5ba7c4[_0xaac4('0x3f')],_0xaac4('0x1d1'),_0x5ba7c4[_0xaac4('0x27')]);this[_0xaac4('0xc1')](_0x5ba7c4['dialPredictiveInterval'])[_0xaac4('0xbb')](this[_0xaac4('0x1d2')](_0x5ba7c4))[_0xaac4('0xbb')](mergeDataErlangB(_0x5ba7c4))[_0xaac4('0xbb')](this[_0xaac4('0x1d3')](_0x5ba7c4))['catch'](loggerCatchPredictive(_0xaac4('0x1d4'),_0x5ba7c4));}else if(!ifInterval(_0x5ba7c4[_0xaac4('0x1c9')],_0x5ba7c4[_0xaac4('0x27')])){_0x5ba7c4['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5ba7c4['startPredictive']=moment()[_0xaac4('0x7a')](_0xaac4('0x100'));loggerPredictive['info'](_0x5ba7c4[_0xaac4('0x3f')],_0xaac4('0x1d5'),_0x5ba7c4['startPredictive']);clearInterval(_0x5ba7c4['handlePredictive']);_0x5ba7c4[_0xaac4('0x1c7')]=undefined;this[_0xaac4('0xc1')](_0x5ba7c4[_0xaac4('0x1c9')])[_0xaac4('0xbb')](this[_0xaac4('0x1d2')](_0x5ba7c4))[_0xaac4('0xbb')](mergeDataErlangB(_0x5ba7c4))[_0xaac4('0xbb')](this['startMethodPredictive'](_0x5ba7c4))[_0xaac4('0xb4')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5ba7c4));}else if(_0x5ba7c4['predictiveIntervalAvailable']&&_0x155070<_0x5ba7c4[_0xaac4('0x70')]-_0x4fb19a){freeVariablesPredictive(_0x5ba7c4);loggerPredictive['info'](_0x5ba7c4[_0xaac4('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x155070,_0xaac4('0x1d6'),_0x5ba7c4[_0xaac4('0x70')],'-',_0x4fb19a,'=',_0x5ba7c4[_0xaac4('0x70')]-_0x4fb19a,')');}else if(_0x5ba7c4[_0xaac4('0x70')]&&_0x155070>_0x5ba7c4[_0xaac4('0x70')]+_0x10d30c){freeVariablesPredictive(_0x5ba7c4);loggerPredictive[_0xaac4('0x80')](_0x5ba7c4['name'],_0xaac4('0x1d7'),_0x155070,_0xaac4('0x1d8'),_0x5ba7c4[_0xaac4('0x70')],'+',_0x10d30c,'=',_0x5ba7c4[_0xaac4('0x70')]+_0x10d30c,')');}};Dialer[_0xaac4('0x18')][_0xaac4('0x1d2')]=function(_0x39a960){var _0x2489cb=this;return function(_0x36bd1b){return new BPromise(function(_0x37fa99,_0x5940ae){_[_0xaac4('0x91')](_0x39a960,_0x36bd1b[0x0]);if(checkGetDataPredictive(_0x36bd1b[0x0])){var _0x12c263=_0x39a960[_0xaac4('0x70')]=_0x39a960[_0xaac4('0xa3')]+_0x39a960[_0xaac4('0x50')];var _0x346f39=_0x39a960[_0xaac4('0x1c9')]*0x3c;var _0x47f1b0=_0x36bd1b[0x0]['predictiveIntervalAvgTalktime']+_0x36bd1b[0x0][_0xaac4('0x69')];var _0x591e0d=(_0x36bd1b[0x0][_0xaac4('0x68')]+_0x36bd1b[0x0][_0xaac4('0x6b')]+_0x36bd1b[0x0][_0xaac4('0x85')])/_0x36bd1b[0x0][_0xaac4('0x71')];_0x39a960[_0xaac4('0x6e')]=_0x591e0d>0x0?_0x591e0d:0x1;switch(_0x39a960['dialPredictiveOptimization']){case _0xaac4('0x1cb'):var _0x1e9e9c=_0x39a960['dialPredictiveOptimizationPercentage']/0x64;return _0x2489cb[_0xaac4('0x1d9')](_0x12c263,_0x346f39,_0x47f1b0,_0x591e0d,_0x1e9e9c)['then'](function(_0x3fb60b){return _0x37fa99(_0x3fb60b);});case _0xaac4('0x1da'):var _0x401ad6=_0x39a960[_0xaac4('0x1db')]/0x64;return _0x2489cb['busyFactor'](_0x12c263,_0x346f39,_0x47f1b0,_0x591e0d,_0x401ad6)[_0xaac4('0xbb')](function(_0x30ca45){return _0x37fa99(_0x30ca45);});default:return _0x5940ae(msgResponse(_0xaac4('0x1dc'),_0xaac4('0x146'),_0xaac4('0x1dd')));}}else{return _0x5940ae(msgResponse(_0xaac4('0x1dc'),'Failure',_0xaac4('0x1de')));}});};};Dialer[_0xaac4('0x18')][_0xaac4('0x1df')]=function(_0x487bc4){var _0x1c65e2=this;return function(_0x50ea1c){return new BPromise(function(_0x12d620,_0x300fb2){_['merge'](_0x487bc4,_0x50ea1c[0x0]);if(checkGetDataPredictive(_0x50ea1c[0x0])){loggerPredictive[_0xaac4('0x80')](JSON[_0xaac4('0x49')](_0x50ea1c[0x0]));if(_0x487bc4[_0xaac4('0x1ce')]===_0xaac4('0x1cb')){return _0x1c65e2[_0xaac4('0xcc')](_0x487bc4['id'])[_0xaac4('0xbb')](function(_0x2fa144){var _0x2bd23c=_0x487bc4[_0xaac4('0x51')]-_0x2fa144[0x0][_0xaac4('0x1e0')];var _0x2e39b3=_0x487bc4[_0xaac4('0x1c9')]*0x3c;var _0x1fe92f=_0x50ea1c[0x0]['predictiveIntervalAvgTalktime']+_0x50ea1c[0x0]['predictiveIntervalAvgHoldtime'];var _0x295ddd=(_0x50ea1c[0x0][_0xaac4('0x68')]+_0x50ea1c[0x0][_0xaac4('0x6b')]+_0x50ea1c[0x0][_0xaac4('0x85')])/_0x50ea1c[0x0][_0xaac4('0x71')];var _0x1ae33e=_0x487bc4[_0xaac4('0x1db')]/0x64;_0x487bc4[_0xaac4('0x6f')]=_0x2fa144[0x0][_0xaac4('0x1e0')]||0x0;_0x487bc4[_0xaac4('0x6e')]=_0x295ddd>0x0?_0x295ddd:0x1;return _0x1c65e2[_0xaac4('0x1d9')](_0x2bd23c,_0x2e39b3,_0x1fe92f,_0x295ddd,_0x1ae33e);})[_0xaac4('0xbb')](function(_0x15ecaa){return _0x12d620(_0x15ecaa);})[_0xaac4('0xb4')](function(_0x5448e8){return _0x300fb2(msgResponse(_0xaac4('0x1e1'),_0xaac4('0x146'),JSON[_0xaac4('0x49')](_0x5448e8)));});}if(_0x487bc4[_0xaac4('0x1ce')]===_0xaac4('0x1da')){return _0x1c65e2[_0xaac4('0xcc')](_0x487bc4['id'])[_0xaac4('0xbb')](function(_0x50bdee){var _0x63602a=_0x487bc4[_0xaac4('0x51')]-_0x50bdee[0x0]['outboundQueuePauses'];var _0x2a413f=_0x487bc4[_0xaac4('0x1c9')]*0x3c;var _0x5f5cdf=_0x50ea1c[0x0]['predictiveIntervalAvgTalktime']+_0x50ea1c[0x0][_0xaac4('0x69')];var _0x463421=(_0x50ea1c[0x0][_0xaac4('0x68')]+_0x50ea1c[0x0][_0xaac4('0x6b')]+_0x50ea1c[0x0][_0xaac4('0x85')])/_0x50ea1c[0x0][_0xaac4('0x71')];var _0x160c10=_0x487bc4[_0xaac4('0x1db')]/0x64;_0x487bc4[_0xaac4('0x6f')]=_0x50bdee[0x0][_0xaac4('0x1e0')]||0x0;_0x487bc4[_0xaac4('0x6e')]=_0x463421>0x0?_0x463421:0x1;return _0x1c65e2[_0xaac4('0x1e2')](_0x63602a,_0x2a413f,_0x5f5cdf,_0x463421,_0x160c10);})[_0xaac4('0xbb')](function(_0x45fab1){return _0x12d620(_0x45fab1);})[_0xaac4('0xb4')](function(_0x4cd630){return _0x300fb2(msgResponse(_0xaac4('0x1e1'),_0xaac4('0x146'),JSON[_0xaac4('0x49')](_0x4cd630)));});}}else{return _0x300fb2(msgResponse(_0xaac4('0x1dc'),_0xaac4('0x146'),'check\x20failure'));}});};};Dialer[_0xaac4('0x18')][_0xaac4('0x1d3')]=function(_0xd3a87b){var _0x27e033=this;return function(){var _0x3b4e8e=0x0;var _0x2b1d23=Math[_0xaac4('0x1c3')](_0xd3a87b[_0xaac4('0x74')]*0x3e8);if(_0x2b1d23>0x0){_0x2b1d23=_0x2b1d23<0x64?0x64:_0x2b1d23;loggerPredictive['info'](_0xd3a87b[_0xaac4('0x3f')],_0xaac4('0x1e3'),_0x2b1d23,'milliseconds');_0xd3a87b['handlePredictive']=setInterval(function(){_0x27e033[_0xaac4('0x1c7')](_0xd3a87b);loggerPredictiveCalls[_0xaac4('0x80')](_0xaac4('0x1e4'),_0x3b4e8e+=0x1);},_0x2b1d23);}else{loggerPredictive[_0xaac4('0x80')](_0xd3a87b[_0xaac4('0x3f')],_0xaac4('0x1e5'));}};};Dialer[_0xaac4('0x18')][_0xaac4('0x1e6')]=function(_0x5bb9db,_0x577fff){var _0xe0ad18=this;return function(_0x1134e8){if(_[_0xaac4('0x7e')](_0x1134e8)){if(_[_0xaac4('0xb0')](_0x577fff[_0xaac4('0xda')])||!_0x577fff[_0xaac4('0x1e7')]){if(_0x5bb9db[_0xaac4('0x5a')]==='booked'){_0x5bb9db[_0xaac4('0x132')]=_[_0xaac4('0x3d')](_0x5bb9db[_0xaac4('0x132')])?!![]:_0x5bb9db[_0xaac4('0x132')];var _0x1eb463=uuid['v4']();_0xe0ad18[_0xaac4('0x24')][_0x1eb463]=new Action(_0x5bb9db,_0x577fff,_0x1eb463);loggerBooked[_0xaac4('0x80')]('[booked][checkContactBlack]',_0x1eb463,'queueStatusComplete:\x20',JSON['stringify'](_0x5bb9db['queueStatusComplete']),_0xaac4('0x1e8'),_0x5bb9db[_0xaac4('0x3f')]);if(_0x5bb9db[_0xaac4('0x132')]){_0x5bb9db['queueStatusComplete']=![];_0xe0ad18[_0xaac4('0x29')][_0xe0ad18['actions'][_0x1eb463][_0xaac4('0xb7')]]=[];ami[_0xaac4('0xb1')]({'actionid':_0x1eb463,'action':_0xaac4('0x1e9'),'queue':_0x5bb9db[_0xaac4('0x3f')]})[_0xaac4('0xb4')](function(){_0xe0ad18[_0xaac4('0xb6')](_0x5bb9db);_0xe0ad18['rescheduleContact']({'active':![],'ContactId':_0xe0ad18['actions'][_0x1eb463]['ContactId'],'ListId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463][_0xaac4('0x101')],'VoiceQueueId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463][_0xaac4('0xdb')]||undefined,'CampaignId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463][_0xaac4('0xdc')]||undefined})[_0xaac4('0xb4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xe0ad18[_0xaac4('0x24')][_0x1eb463];});}else{loggerBooked[_0xaac4('0x80')]('[booked][checkContactBlack][else]',JSON[_0xaac4('0x49')](_0x5bb9db[_0xaac4('0x132')]),'Queue:\x20',_0x5bb9db[_0xaac4('0x3f')]);_0xe0ad18[_0xaac4('0xb6')](_0x5bb9db);_0xe0ad18[_0xaac4('0xc3')]({'active':![],'ContactId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463]['ContactId'],'ListId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463][_0xaac4('0x101')],'VoiceQueueId':_0xe0ad18[_0xaac4('0x24')][_0x1eb463][_0xaac4('0xdb')]||undefined,'CampaignId':_0xe0ad18['actions'][_0x1eb463]['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x1ea')));delete _0xe0ad18[_0xaac4('0x24')][_0x1eb463];}}else{return _0xe0ad18[_0xaac4('0x169')](_0x5bb9db,_0x577fff);}}else{if(getDiff(_0x577fff[_0xaac4('0x1eb')])<_0x5bb9db[_0xaac4('0x1ec')]*0x3c){if(_0x577fff[_0xaac4('0x1ed')]&&!_0x577fff[_0xaac4('0x1ed')][_0xaac4('0x1ee')]){_0xe0ad18['preview'][_0xaac4('0x134')](_0x577fff['id'])[_0xaac4('0x1b')](function(){_0xe0ad18['updateOriginated'](_0x5bb9db);});}else{_0xe0ad18[_0xaac4('0xc5')]({'active':![]},_0x577fff['id'],0x1)[_0xaac4('0x1b')](function(){_0xe0ad18[_0xaac4('0xb6')](_0x5bb9db);});}}else{_0x5bb9db['outboundReCallsDay']+=0x1;_0xe0ad18['updateOriginated'](_0x5bb9db);if(_0x5bb9db[_0xaac4('0x1ef')]){_0xe0ad18[_0xaac4('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x577fff[_0xaac4('0xd9')],'ListId':_0x577fff[_0xaac4('0x101')],'VoiceQueueId':_0x577fff[_0xaac4('0xdb')]||undefined,'CampaignId':_0x577fff['CampaignId']||undefined})[_0xaac4('0xb4')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0xe0ad18[_0xaac4('0xd0')](createObjHistory(_0x5bb9db,_0x577fff,_0xaac4('0x1f0'),0x17,'RecallInQueue'))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0x1f1')));}else{_0xe0ad18[_0xaac4('0xd7')](createObjHistory(_0x5bb9db,_0x577fff,_0xaac4('0x1f2'),0x16,_0xaac4('0x1f3')),_0xaac4('0x1f4'),_0xaac4('0x1f5'));}}}}else{_0x5bb9db['outboundBlacklistCallsDay']+=0x1;_0xe0ad18[_0xaac4('0xd7')](createObjHistory(_0x5bb9db,_0x577fff,_0xaac4('0x1f6'),0xd,_0xaac4('0x1f7')),_0xaac4('0x1f8'),'[Originate][MoveBlacklist]');throw _0xaac4('0x1f9');}};};Dialer[_0xaac4('0x18')][_0xaac4('0x1fa')]=function(_0x2a189c){var _0x2ea627=this;var _0x1c5967=_0x2a189c['limitCalls']-_0x2a189c[_0xaac4('0x72')]-_0x2a189c[_0xaac4('0xc8')];emitCampaignSummary(_0x2a189c);if(_0x1c5967>0x0){if(_0x1c5967>this[_0xaac4('0x22')]){_0x1c5967=this[_0xaac4('0x22')];}_0x2a189c[_0xaac4('0xc8')]+=_0x1c5967;this[_0xaac4('0xca')](_0x2a189c['id'],_0x1c5967,_0x2a189c[_0xaac4('0x1fb')],_0x2a189c)['then'](function(_0x11ac88){_0x2a189c[_0xaac4('0xc8')]-=_0x1c5967;_0x2a189c[_0xaac4('0xc8')]=_0x2a189c[_0xaac4('0xc8')]>0x0?_0x2a189c[_0xaac4('0xc8')]:0x0;if(!checkContactEmpty(_0x11ac88)){_0x2a189c[_0xaac4('0x44')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xaac4('0x80')](_0xaac4('0x1fc')+_0x2a189c['name']);}else{_0x2a189c[_0xaac4('0x72')]+=_0x11ac88[_0xaac4('0x99')];_0x2a189c['message']=_0xaac4('0x1fd');for(var _0x3299b2=0x0;_0x3299b2<_0x11ac88[_0xaac4('0x99')];_0x3299b2+=0x1){_0x2a189c['ivrTotalCallsDays']+=0x1;if(_[_0xaac4('0xb0')](_0x11ac88[_0x3299b2])||_[_0xaac4('0xb0')](_0x11ac88[_0x3299b2][_0xaac4('0x16b')])||_[_0xaac4('0xb0')](_0x11ac88[_0x3299b2][_0xaac4('0x16b')][_0xaac4('0x16c')])){_0x2ea627[_0xaac4('0xd5')](_0xaac4('0x1fe'),_0x2a189c,_0x11ac88[_0x3299b2]);}else{_0x2ea627['checkIsBlackListIvr'](_['pick'](_0x11ac88[_0x3299b2],[_0xaac4('0xdc'),_0xaac4('0x1ff')]))[_0xaac4('0xbb')](_0x2ea627['checkContactBlack'](_0x2a189c,_0x11ac88[_0x3299b2]))['catch'](_0x2ea627[_0xaac4('0xd4')](_0xaac4('0x200'),_0x2a189c));}}}})[_0xaac4('0xb4')](loggerGetContactDialer(_0xaac4('0x201'),_0x2a189c,_0x1c5967));}};Dialer[_0xaac4('0x18')][_0xaac4('0x15c')]=function(_0x934da0,_0x32a855){var _0x47a82a=this;var _0x30b304=[];var _0x59b4a5=_0x32a855>=0x1?_0x32a855:0x1;if(_0x934da0[_0xaac4('0x5a')]==='booked'){_0x59b4a5=0x1;}var _0x42cc88=Math['floor'](_0x934da0[_0xaac4('0x50')]*_0x59b4a5)-_0x934da0['originated']-_0x934da0[_0xaac4('0xc8')];emitVoiceQueueSummary(_0x934da0);if(_0x934da0[_0xaac4('0x202')]>0x0){var _0xd592d7=_0x934da0[_0xaac4('0x202')]-_0x934da0[_0xaac4('0x72')]-_0x934da0[_0xaac4('0xa3')]-_0x934da0[_0xaac4('0xc8')]-_0x934da0['pTalking'];if(_0x42cc88>_0xd592d7){_0x42cc88=_0xd592d7;}}if(_0x42cc88>0x0){if(_0x934da0[_0xaac4('0x5a')]==='booked'){_0x42cc88=0x1;}if(_0x42cc88>this[_0xaac4('0x22')]){_0x42cc88=this['maxNumberOriginate'];}_0x934da0[_0xaac4('0xc8')]+=_0x42cc88;for(var _0x3057ae in this[_0xaac4('0x20')]){if(typeof this[_0xaac4('0x20')][_0x3057ae]!=='undefined'){if(this[_0xaac4('0x20')][_0x3057ae][_0xaac4('0xaa')]===_0xaac4('0x203')&&this['agents'][_0x3057ae]['status']===_0xaac4('0xe2')){_0x30b304[_0xaac4('0x130')](this[_0xaac4('0x20')][_0x3057ae]['id']);}}}this[_0xaac4('0xc7')](_0x934da0['id'],_0x30b304,_0x42cc88,_0x934da0[_0xaac4('0x1fb')],_0x934da0)[_0xaac4('0xbb')](function(_0x3bceeb){_0x934da0[_0xaac4('0xc8')]-=_0x42cc88;_0x934da0['temp']=_0x934da0[_0xaac4('0xc8')]>0x0?_0x934da0[_0xaac4('0xc8')]:0x0;if(!checkContactEmpty(_0x3bceeb)){_0x47a82a[_0xaac4('0xbc')](_0x934da0)[_0xaac4('0xbb')](sendMessageReschedule(_0x934da0))[_0xaac4('0xb4')](loggerCatch(_0xaac4('0xbd')));}else{_0x934da0[_0xaac4('0x72')]+=_0x3bceeb[_0xaac4('0x99')];_0x934da0[_0xaac4('0x44')]=_0x934da0[_0xaac4('0x5a')]===_0xaac4('0x9')?_0xaac4('0x173'):'RUNNING';for(var _0x1ba72e=0x0;_0x1ba72e<_0x3bceeb[_0xaac4('0x99')];_0x1ba72e+=0x1){if(_['isNil'](_0x3bceeb[_0x1ba72e])||_[_0xaac4('0xb0')](_0x3bceeb[_0x1ba72e][_0xaac4('0x16b')])||_[_0xaac4('0xb0')](_0x3bceeb[_0x1ba72e][_0xaac4('0x16b')][_0xaac4('0x16c')])){_0x47a82a[_0xaac4('0xd5')]('[actionOriginate]\x20',_0x934da0,_0x3bceeb[_0x1ba72e]);}else{_0x47a82a[_0xaac4('0xbe')](_[_0xaac4('0xd8')](_0x3bceeb[_0x1ba72e],[_0xaac4('0xdb'),'Contact.phone']))[_0xaac4('0xbb')](_0x47a82a[_0xaac4('0x1e6')](_0x934da0,_0x3bceeb[_0x1ba72e]))[_0xaac4('0xb4')](_0x47a82a[_0xaac4('0xd4')](_0xaac4('0x1fe'),_0x934da0));}}}})['catch'](loggerGetContactDialer(_0xaac4('0x204'),_0x934da0,_0x42cc88));}};Dialer[_0xaac4('0x18')][_0xaac4('0x1c7')]=function(_0x1e897a){if(_0x1e897a[_0xaac4('0x202')]>0x0){var _0x341acb=_0x1e897a[_0xaac4('0x202')]-_0x1e897a['originated']-_0x1e897a[_0xaac4('0xa3')];if(_0x341acb>0x0){this[_0xaac4('0x205')](_0x1e897a);}else{loggerPredictiveCalls[_0xaac4('0x80')](_0xaac4('0x206'));}}else{this[_0xaac4('0x205')](_0x1e897a);}};Dialer[_0xaac4('0x18')][_0xaac4('0x205')]=function(_0xb25bfc){var _0x236c5a=this;var _0x1834da=[];_0xb25bfc[_0xaac4('0x72')]+=0x1;for(var _0x58f704 in this[_0xaac4('0x20')]){if(typeof this[_0xaac4('0x20')][_0x58f704]!==_0xaac4('0x9a')){if(this[_0xaac4('0x20')][_0x58f704][_0xaac4('0xaa')]===_0xaac4('0x203')&&this[_0xaac4('0x20')][_0x58f704][_0xaac4('0xb2')]==='reachable'){_0x1834da['push'](this[_0xaac4('0x20')][_0x58f704]['id']);}}}this[_0xaac4('0xc7')](_0xb25bfc['id'],_0x1834da,0x1,_0xb25bfc[_0xaac4('0x1fb')],_0xb25bfc)[_0xaac4('0xbb')](function(_0x5bca64){if(!checkContactEmpty(_0x5bca64)){checkContactLowerLimitOriginate(_0xb25bfc,0x1,0x0);_0x236c5a[_0xaac4('0xbc')](_0xb25bfc)[_0xaac4('0xbb')](sendMessageReschedule(_0xb25bfc))[_0xaac4('0xb4')](loggerCatch('[countReScheduled]\x20'));}else{_0xb25bfc[_0xaac4('0x44')]='RUNNING';if(_[_0xaac4('0xb0')](_0x5bca64[0x0])||_[_0xaac4('0xb0')](_0x5bca64[0x0][_0xaac4('0x16b')])||_[_0xaac4('0xb0')](_0x5bca64[0x0]['Contact']['phone'])){_0x236c5a[_0xaac4('0xd5')]('[actionOriginate]\x20',_0xb25bfc,_0x5bca64[0x0]);}else{_0x236c5a[_0xaac4('0xbe')](_['pick'](_0x5bca64[0x0],[_0xaac4('0xdb'),'Contact.phone']))[_0xaac4('0xbb')](_0x236c5a[_0xaac4('0x1e6')](_0xb25bfc,_0x5bca64[0x0]))[_0xaac4('0xb4')](_0x236c5a['loggerHandler'](_0xaac4('0x207'),_0xb25bfc));}}})[_0xaac4('0xb4')](loggerGetContactDialer(_0xaac4('0x208'),_0xb25bfc,0x1));emitVoiceQueueSummary(_0xb25bfc);};Dialer[_0xaac4('0x18')][_0xaac4('0x1d9')]=function(_0x423087,_0x562789,_0x5484c0,_0x218028,_0x5bedce,_0xf45fc1){loggerPredictive[_0xaac4('0x80')](_0xaac4('0x209'));loggerPredictive[_0xaac4('0x80')](_0xaac4('0x20a'),_0x423087);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x20b'),_0x562789);loggerPredictive['info'](_0xaac4('0x20c'),_0x5484c0);loggerPredictive[_0xaac4('0x80')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x218028);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x20d'),_0x5bedce);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x88'));return new BPromise(function(_0xe61b98,_0x51fadc){if(_0x423087<=0x0||isNaN(_0x423087)){return _0x51fadc(msgResponse(_0xaac4('0x20e'),_0xaac4('0x196'),_0xaac4('0x20f')+_0x423087));}if(_0x5484c0<=0x0||isNaN(_0x5484c0)){return _0x51fadc(msgResponse(_0xaac4('0x20e'),_0xaac4('0x196'),_0xaac4('0x210')+_0x5484c0));}if(_0x218028<=0x0||isNaN(_0x218028)){return _0x51fadc(msgResponse(_0xaac4('0x20e'),_0xaac4('0x196'),_0xaac4('0x211')+_0x218028));}if(_0x562789<=0x0||isNaN(_0x562789)){return _0x51fadc(msgResponse('[abandonmentRate]',_0xaac4('0x196'),'interval\x20=\x20'+_0x562789));}if(_0x5bedce<=0x0||isNaN(_0x5bedce)){return _0x51fadc(msgResponse(_0xaac4('0x20e'),_0xaac4('0x196'),'Amax\x20=\x20'+_0x5bedce));}_0xf45fc1=_0xf45fc1||0x0;var _0x17027c=0x1/_0x5484c0;var _0xb95c5d=0x0;var _0x47dc6d=0x0;var _0x4649be=0x0;var _0x405b4c=0x0;for(var _0x1112d0=0x0;_0x4649be<_0x5bedce;_0x1112d0+=0x1){_0x47dc6d=_0x1112d0/_0x562789;_0xb95c5d=(_0x218028*_0x47dc6d+_0xf45fc1)/_0x17027c;_0x4649be=erlangb(_0xb95c5d,_0x423087);_0x405b4c=_0xb95c5d/_0x423087*(0x1-erlangb(_0xb95c5d,_0x423087));}return _0xe61b98({'erlangCalls':_0x1112d0,'erlangCallToSecond':_0x562789/_0x1112d0,'erlangAbandonmentRate':_0x4649be,'erlangBusyFactor':_0x405b4c});});};Dialer[_0xaac4('0x18')][_0xaac4('0x1e2')]=function(_0x5504ca,_0x826776,_0x352b8e,_0x516d53,_0x1e2945,_0x2a5e07){loggerPredictive[_0xaac4('0x80')](_0xaac4('0x212'));loggerPredictive['info'](_0xaac4('0x20a'),_0x5504ca);loggerPredictive[_0xaac4('0x80')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x826776);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x20c'),_0x352b8e);loggerPredictive['info'](_0xaac4('0x213'),_0x516d53);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x214'),_0x1e2945);loggerPredictive[_0xaac4('0x80')](_0xaac4('0x88'));return new BPromise(function(_0x43b406,_0x3e2c50){if(_0x5504ca<=0x0||isNaN(_0x5504ca)){return _0x3e2c50(msgResponse(_0xaac4('0x215'),_0xaac4('0x196'),_0xaac4('0x20f')+_0x5504ca));}if(_0x352b8e<=0x0||isNaN(_0x352b8e)){return _0x3e2c50(msgResponse(_0xaac4('0x215'),_0xaac4('0x196'),_0xaac4('0x210')+_0x352b8e));}if(_0x516d53<=0x0||isNaN(_0x516d53)){return _0x3e2c50(msgResponse(_0xaac4('0x215'),_0xaac4('0x196'),'p\x20=\x20'+_0x516d53));}if(_0x826776<=0x0||isNaN(_0x826776)){return _0x3e2c50(msgResponse(_0xaac4('0x215'),_0xaac4('0x196'),'interval\x20=\x20'+_0x826776));}if(_0x1e2945<=0x0||isNaN(_0x1e2945)){return _0x3e2c50(msgResponse(_0xaac4('0x215'),_0xaac4('0x196'),_0xaac4('0x216')+_0x1e2945));}_0x2a5e07=_0x2a5e07||0x0;var _0x7b1340=0x1/_0x352b8e;var _0x585522=0x0;var _0x1644ed=0x0;var _0x541c96=0x0;var _0xb045b9=0x0;for(var _0x408949=0x0;_0xb045b9<_0x1e2945;_0x408949+=0x1){_0x1644ed=_0x408949/_0x826776;_0x585522=(_0x516d53*_0x1644ed+_0x2a5e07)/_0x7b1340;_0x541c96=erlangb(_0x585522,_0x5504ca);_0xb045b9=_0x585522/_0x5504ca*(0x1-erlangb(_0x585522,_0x5504ca));}return _0x43b406({'erlangCalls':_0x408949,'erlangCallToSecond':_0x826776/_0x408949,'erlangAbandonmentRate':_0x541c96,'erlangBusyFactor':_0xb045b9});});};module[_0xaac4('0x217')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 06d5777..d4f6e0f 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 _0x6de9=['seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x114058,_0x4cfc28){var _0x759f25=function(_0x59fcca){while(--_0x59fcca){_0x114058['push'](_0x114058['shift']());}};_0x759f25(++_0x4cfc28);}(_0x6de9,0x17f));var _0x96de=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6de9[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0x96de('0x0'));var _=require(_0x96de('0x1'));var moment=require(_0x96de('0x2'));function getSeconds(_0x182985,_0xba0930){var _0x1f2fd8=moment(_0x182985)[_0x96de('0x3')](0x0);var _0x51486a=moment(_0xba0930)['milliseconds'](0x0);return _0x1f2fd8['diff'](_0x51486a,_0x96de('0x4'));}function QueueCallerAbandon(_0xb8d7e8,_0x315af5){this[_0x96de('0x5')]=_0xb8d7e8[_0x96de('0x5')];this[_0x96de('0x6')]=_0xb8d7e8[_0x96de('0x6')];this[_0x96de('0x7')]=_0xb8d7e8[_0x96de('0x6')]===_0x96de('0x8')?_0x96de('0x9'):_0xb8d7e8['type'];this[_0x96de('0xa')]=_0xb8d7e8[_0x96de('0xa')];this[_0x96de('0xb')]=_0xb8d7e8[_0x96de('0xb')];this[_0x96de('0xc')]=_0xb8d7e8['countnoanswerretry'];this[_0x96de('0xd')]=_0xb8d7e8['countbusyretry']+_0xb8d7e8[_0x96de('0xb')]+_0xb8d7e8[_0x96de('0xc')]+_0xb8d7e8[_0x96de('0xe')]+_0xb8d7e8['countdropretry']+_0xb8d7e8[_0x96de('0xf')]+_0xb8d7e8['countmachineretry']+_0xb8d7e8[_0x96de('0x10')];this[_0x96de('0xe')]=_0xb8d7e8[_0x96de('0xe')];this[_0x96de('0x11')]=_0xb8d7e8[_0x96de('0x11')];this[_0x96de('0xf')]=_0xb8d7e8[_0x96de('0xf')];this[_0x96de('0x12')]=_0xb8d7e8[_0x96de('0x12')];this[_0x96de('0x10')]=_0xb8d7e8[_0x96de('0x10')];this[_0x96de('0x13')]=_0x315af5['uniqueid'];this[_0x96de('0x14')]=_0xb8d7e8[_0x96de('0x15')];this['calleridnum']=_0xb8d7e8[_0x96de('0x16')];this[_0x96de('0x17')]=_0xb8d7e8[_0x96de('0x17')];this['responsetime']=_0xb8d7e8[_0x96de('0x18')];this[_0x96de('0x19')]=_0xb8d7e8[_0x96de('0x19')];this[_0x96de('0x1a')]=this[_0x96de('0x19')];this['ringtime']=getSeconds(_0xb8d7e8[_0x96de('0x18')],_0xb8d7e8[_0x96de('0x17')]);this['holdtime']=getSeconds(this[_0x96de('0x19')],_0xb8d7e8[_0x96de('0x18')]);this[_0x96de('0x1b')]=0x0;this[_0x96de('0x9')]=_0x315af5[_0x96de('0x9')];this[_0x96de('0x1c')]=_0x315af5[_0x96de('0x1d')];this[_0x96de('0x1e')]=_0x315af5['reason'];this[_0x96de('0x1f')]=_0xb8d7e8[_0x96de('0x1f')];this['callbackuniqueid']=_0xb8d7e8[_0x96de('0x20')];this['callbackat']=_0xb8d7e8[_0x96de('0x21')];this['recallme']=_0xb8d7e8[_0x96de('0x22')];this[_0x96de('0x23')]=_0xb8d7e8[_0x96de('0x23')];this[_0x96de('0x24')]=_0xb8d7e8[_0x96de('0x24')];this['UserId']=_0xb8d7e8[_0x96de('0x25')];this['VoiceQueueId']=_0xb8d7e8[_0x96de('0x26')];this[_0x96de('0x27')]=_0xb8d7e8[_0x96de('0x27')];this['originatecalleridnum']=_0xb8d7e8[_0x96de('0x28')]||'';this['originatecalleridname']=_0xb8d7e8[_0x96de('0x29')]||'';}module[_0x96de('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x3383=['lodash','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','talktime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x3242cd,_0x299125){var _0x209c55=function(_0x24e784){while(--_0x24e784){_0x3242cd['push'](_0x3242cd['shift']());}};_0x209c55(++_0x299125);}(_0x3383,0x1cd));var _0x3338=function(_0x244eab,_0x443a51){_0x244eab=_0x244eab-0x0;var _0x329ef6=_0x3383[_0x244eab];return _0x329ef6;};'use strict';var util=require(_0x3338('0x0'));var _=require(_0x3338('0x1'));var moment=require('moment');function getSeconds(_0x96bd5d,_0x46f95c){var _0x25be7b=moment(_0x96bd5d)['milliseconds'](0x0);var _0x3449fe=moment(_0x46f95c)[_0x3338('0x2')](0x0);return _0x25be7b[_0x3338('0x3')](_0x3449fe,'seconds');}function QueueCallerAbandon(_0x45657d,_0x463b1b){this['scheduledat']=_0x45657d[_0x3338('0x4')];this[_0x3338('0x5')]=_0x45657d[_0x3338('0x5')];this[_0x3338('0x6')]=_0x45657d[_0x3338('0x5')]===_0x3338('0x7')?_0x3338('0x8'):_0x45657d[_0x3338('0x5')];this[_0x3338('0x9')]=_0x45657d[_0x3338('0x9')];this[_0x3338('0xa')]=_0x45657d['countcongestionretry'];this[_0x3338('0xb')]=_0x45657d[_0x3338('0xb')];this[_0x3338('0xc')]=_0x45657d['countbusyretry']+_0x45657d['countcongestionretry']+_0x45657d[_0x3338('0xb')]+_0x45657d[_0x3338('0xd')]+_0x45657d[_0x3338('0xe')]+_0x45657d[_0x3338('0xf')]+_0x45657d[_0x3338('0x10')]+_0x45657d['countagentrejectretry'];this[_0x3338('0xd')]=_0x45657d['countnosuchnumberretry'];this[_0x3338('0xe')]=_0x45657d[_0x3338('0xe')];this[_0x3338('0xf')]=_0x45657d[_0x3338('0xf')];this[_0x3338('0x10')]=_0x45657d[_0x3338('0x10')];this[_0x3338('0x11')]=_0x45657d[_0x3338('0x11')];this[_0x3338('0x12')]=_0x463b1b['uniqueid'];this[_0x3338('0x13')]=_0x45657d[_0x3338('0x14')];this[_0x3338('0x15')]=_0x45657d[_0x3338('0x16')];this['starttime']=_0x45657d[_0x3338('0x17')];this[_0x3338('0x18')]=_0x45657d[_0x3338('0x18')];this[_0x3338('0x19')]=_0x45657d[_0x3338('0x19')];this['endtime']=this['droptime'];this[_0x3338('0x1a')]=getSeconds(_0x45657d[_0x3338('0x18')],_0x45657d['starttime']);this['holdtime']=getSeconds(this[_0x3338('0x19')],_0x45657d[_0x3338('0x18')]);this[_0x3338('0x1b')]=0x0;this[_0x3338('0x8')]=_0x463b1b['queue'];this[_0x3338('0x1c')]=_0x463b1b[_0x3338('0x1d')];this[_0x3338('0x1e')]=_0x463b1b[_0x3338('0x1e')];this['callback']=_0x45657d['callback'];this[_0x3338('0x1f')]=_0x45657d[_0x3338('0x1f')];this[_0x3338('0x20')]=_0x45657d['callbackat'];this['recallme']=_0x45657d[_0x3338('0x21')];this[_0x3338('0x22')]=_0x45657d[_0x3338('0x22')];this[_0x3338('0x23')]=_0x45657d[_0x3338('0x23')];this[_0x3338('0x24')]=_0x45657d['UserId'];this[_0x3338('0x25')]=_0x45657d[_0x3338('0x25')];this[_0x3338('0x26')]=_0x45657d[_0x3338('0x26')];this['originatecalleridnum']=_0x45657d[_0x3338('0x27')]||'';this[_0x3338('0x28')]=_0x45657d[_0x3338('0x28')]||'';}module[_0x3338('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 6c6d3ee..a33d165 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(_0x3d48f9,_0x1c236d){var _0x151214=function(_0x3eea37){while(--_0x3eea37){_0x3d48f9['push'](_0x3d48f9['shift']());}};_0x151214(++_0x1c236d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0xb4eca7,_0x18c07d){var _0x38468e=function(_0x43087b){while(--_0x43087b){_0xb4eca7['push'](_0xb4eca7['shift']());}};_0x38468e(++_0x18c07d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 86be631..1ac72fc 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 _0xa8ea=['./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','newstate','syncNewState','newexten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','syncNewchannel','context','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','application/pdf','then','\x20notify\x20','stringify','catch','error','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkTrunk','Trunk','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','%s/%s.tif','dir','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','util','lodash','bluebird','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami'];(function(_0x59eb02,_0xdba397){var _0x259391=function(_0x609f31){while(--_0x609f31){_0x59eb02['push'](_0x59eb02['shift']());}};_0x259391(++_0xdba397);}(_0xa8ea,0x153));var _0xaa8e=function(_0x592aea,_0x523681){_0x592aea=_0x592aea-0x0;var _0x5638e3=_0xa8ea[_0x592aea];return _0x5638e3;};'use strict';var util=require(_0xaa8e('0x0'));var _=require(_0xaa8e('0x1'));var BPromise=require(_0xaa8e('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0xaa8e('0x3'));var tiff2pdf=require(_0xaa8e('0x4'));var gs=require(_0xaa8e('0x5'));var logger=require(_0xaa8e('0x6'))(_0xaa8e('0x7'));var ami=require(_0xaa8e('0x8'));var rpcDb=require(_0xaa8e('0x9'));var Channel=require(_0xaa8e('0xa'));var ut=require(_0xaa8e('0xb'));var Action=require(_0xaa8e('0xc'));var faxAccount=require(_0xaa8e('0xd'));var attachment=require(_0xaa8e('0xe'));var faxMessage=require(_0xaa8e('0xf'));function Fax(_0x33d8e7){this[_0xaa8e('0x10')]={};this['faxAccounts']=_0x33d8e7[_0xaa8e('0x11')];this[_0xaa8e('0x12')]=_0x33d8e7[_0xaa8e('0x12')];this[_0xaa8e('0x13')]={};ami['on'](_0xaa8e('0x14'),this['syncNewchannel'][_0xaa8e('0x15')](this));ami['on']('varset',this[_0xaa8e('0x16')]['bind'](this));ami['on'](_0xaa8e('0x17'),this[_0xaa8e('0x18')][_0xaa8e('0x15')](this));ami['on'](_0xaa8e('0x19'),this['syncNewExten'][_0xaa8e('0x15')](this));ami['on'](_0xaa8e('0x1a'),this['syncFaxStatus'][_0xaa8e('0x15')](this));ami['on'](_0xaa8e('0x1b'),this[_0xaa8e('0x1c')]['bind'](this));ami['on'](_0xaa8e('0x1d'),this[_0xaa8e('0x1e')]['bind'](this));ami['on']('originateresponse',this[_0xaa8e('0x1f')][_0xaa8e('0x15')](this));}Fax['prototype'][_0xaa8e('0x20')]=function(_0x15ec59){if(_0x15ec59[_0xaa8e('0x21')]==='from-voip-provider'){for(var _0x3825f2 in this['faxAccounts']){if(this[_0xaa8e('0x11')][_0xaa8e('0x22')](_0x3825f2)){if(_0x15ec59[_0xaa8e('0x23')]===this[_0xaa8e('0x11')][_0x3825f2]['localstationid']){this[_0xaa8e('0x10')][_0x15ec59[_0xaa8e('0x24')]]={};this[_0xaa8e('0x10')][_0x15ec59[_0xaa8e('0x24')]][_0xaa8e('0x25')]=_0x15ec59['channel'];this[_0xaa8e('0x10')][_0x15ec59['uniqueid']]['id']=this[_0xaa8e('0x11')][_0x3825f2]['id'];this['channels'][_0x15ec59[_0xaa8e('0x24')]]['name']=this[_0xaa8e('0x11')][_0x3825f2][_0xaa8e('0x26')];logger[_0xaa8e('0x27')](_0x15ec59[_0xaa8e('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0xaa8e('0x13')][_0x15ec59[_0xaa8e('0x24')]]){this[_0xaa8e('0x10')][_0x15ec59[_0xaa8e('0x24')]]={};this[_0xaa8e('0x10')][_0x15ec59[_0xaa8e('0x24')]][_0xaa8e('0x25')]=_0x15ec59[_0xaa8e('0x25')];logger[_0xaa8e('0x27')](_0x15ec59[_0xaa8e('0x24')],_0xaa8e('0x28'));}};Fax[_0xaa8e('0x29')]['syncVarSet']=function(_0xcdb505){if(this[_0xaa8e('0x10')][_0xcdb505[_0xaa8e('0x24')]]){for(var _0x1cb76e in _0xcdb505['variable']){if(_0xcdb505[_0xaa8e('0x2a')][_0xaa8e('0x22')](_0x1cb76e)){this['channels'][_0xcdb505['uniqueid']][_0x1cb76e]=_0xcdb505[_0xaa8e('0x2b')];}}}};Fax[_0xaa8e('0x29')][_0xaa8e('0x18')]=function(_0x243227){if(this[_0xaa8e('0x10')][_0x243227[_0xaa8e('0x24')]]){this[_0xaa8e('0x10')][_0x243227[_0xaa8e('0x24')]]['channelstate']=_0x243227[_0xaa8e('0x2c')];this['channels'][_0x243227[_0xaa8e('0x24')]][_0xaa8e('0x2d')]=_0x243227[_0xaa8e('0x2d')];}};Fax[_0xaa8e('0x29')][_0xaa8e('0x2e')]=function(_0x125f57){if(this[_0xaa8e('0x10')][_0x125f57[_0xaa8e('0x24')]]){for(var _0xbc8eb2 in _0x125f57[_0xaa8e('0x2a')]){if(_0x125f57[_0xaa8e('0x2a')][_0xaa8e('0x22')](_0xbc8eb2)){this[_0xaa8e('0x10')][_0x125f57[_0xaa8e('0x24')]][_0xbc8eb2]=_0x125f57[_0xaa8e('0x2b')];}}}};Fax[_0xaa8e('0x29')][_0xaa8e('0x2f')]=function(_0x403cde){if(this[_0xaa8e('0x10')][_0x403cde[_0xaa8e('0x24')]]){this[_0xaa8e('0x10')][_0x403cde['uniqueid']]['operation']=_0x403cde[_0xaa8e('0x30')];this[_0xaa8e('0x10')][_0x403cde[_0xaa8e('0x24')]][_0xaa8e('0x31')]=_0x403cde[_0xaa8e('0x31')];this[_0xaa8e('0x10')][_0x403cde[_0xaa8e('0x24')]][_0xaa8e('0x32')]=_0x403cde[_0xaa8e('0x32')];this[_0xaa8e('0x10')][_0x403cde['uniqueid']][_0xaa8e('0x33')]=_0x403cde['filename'];logger[_0xaa8e('0x27')](_0x403cde['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0xaa8e('0x29')]['syncReceiveFax']=function(_0x113b8d){var _0x5a31bb=this;if(this['channels'][_0x113b8d[_0xaa8e('0x24')]]){var _0x21f682=this['channels'][_0x113b8d[_0xaa8e('0x24')]]['id'];this[_0xaa8e('0x10')][_0x113b8d[_0xaa8e('0x24')]][_0xaa8e('0x34')]=_0x113b8d[_0xaa8e('0x34')];this[_0xaa8e('0x10')][_0x113b8d[_0xaa8e('0x24')]][_0xaa8e('0x35')]=_0x113b8d[_0xaa8e('0x35')];this['channels'][_0x113b8d[_0xaa8e('0x24')]][_0xaa8e('0x32')]=_0x113b8d['localstationid'];this[_0xaa8e('0x10')][_0x113b8d[_0xaa8e('0x24')]][_0xaa8e('0x36')]=_0x113b8d[_0xaa8e('0x36')];this['channels'][_0x113b8d[_0xaa8e('0x24')]][_0xaa8e('0x37')]=_0x113b8d[_0xaa8e('0x37')];this['channels'][_0x113b8d[_0xaa8e('0x24')]][_0xaa8e('0x33')]=_0x113b8d['filename'];this[_0xaa8e('0x10')][_0x113b8d['uniqueid']]['calleridnum']=_0x113b8d[_0xaa8e('0x38')];if(this['channels'][_0x113b8d['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x113b8d[_0xaa8e('0x33')],_0xaa8e('0x39'),function(_0x204d2e){logger['info'](_0x113b8d['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x204d2e[_0xaa8e('0x3a')]);attachment['create']({'name':path[_0xaa8e('0x3b')](_0x113b8d[_0xaa8e('0x33')])[_0xaa8e('0x26')],'basename':path[_0xaa8e('0x3b')](_0x113b8d[_0xaa8e('0x33')])[_0xaa8e('0x26')]+_0xaa8e('0x3c'),'type':_0xaa8e('0x3d')})[_0xaa8e('0x3e')](function(_0x1f84de){faxAccount['notify'](_0x21f682,{'from':_0x113b8d['calleridnum'],'mapKey':_0xaa8e('0x7'),'body':path[_0xaa8e('0x3b')](_0x113b8d['filename'])[_0xaa8e('0x26')]+'.pdf','AttachmentId':_0x1f84de['id']})['catch'](function(_0x26225e){logger['error'](_0x113b8d[_0xaa8e('0x24')],_0xaa8e('0x3f'),JSON[_0xaa8e('0x40')](_0x26225e));});})[_0xaa8e('0x41')](function(_0x461bd8){logger[_0xaa8e('0x42')](_0x113b8d[_0xaa8e('0x24')],'\x20receiveFax\x20',JSON[_0xaa8e('0x40')](_0x461bd8));});});}logger[_0xaa8e('0x27')](_0x113b8d['uniqueid'],'\x20receiveFax\x20');}};Fax[_0xaa8e('0x29')][_0xaa8e('0x1f')]=function(_0x3eb98f){if(this[_0xaa8e('0x13')][_0x3eb98f[_0xaa8e('0x24')]]){_[_0xaa8e('0x43')](this['channels'][_0x3eb98f[_0xaa8e('0x24')]],_[_0xaa8e('0x44')](_0x3eb98f,[_0xaa8e('0x45'),_0xaa8e('0x46')]));}};function updateStatus(_0x4fc5dc){if(_0x4fc5dc[_0xaa8e('0x47')]){faxMessage['update'](_0x4fc5dc[_0xaa8e('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xaa8e('0x3e')](function(_0x3e9779){ut[_0xaa8e('0x48')](_0xaa8e('0x49'),_0x3e9779);})[_0xaa8e('0x41')](function(_0x24e30a){ut[_0xaa8e('0x48')](_0xaa8e('0x4a'),_0x24e30a);});}else{ut[_0xaa8e('0x48')](_0xaa8e('0x4b'));}}Fax[_0xaa8e('0x29')][_0xaa8e('0x4c')]=function(_0x198697,_0xe41ddc,_0x197152){var _0xed89d9=this;var _0x40c713={};if(_0xe41ddc){_0x40c713={'read':_0xe41ddc};}else{_0x40c713={'failMessage':_0x197152};}if(this[_0xaa8e('0x13')][_0x198697][_0xaa8e('0x47')]){faxMessage[_0xaa8e('0x4d')](this[_0xaa8e('0x13')][_0x198697][_0xaa8e('0x47')],_0x40c713)[_0xaa8e('0x3e')](function(_0x224a91){ut[_0xaa8e('0x48')](_0xaa8e('0x4e'),_0x224a91);})[_0xaa8e('0x41')](function(_0x442323){ut[_0xaa8e('0x48')](_0xaa8e('0x4f'),_0x442323);})[_0xaa8e('0x50')](function(){delete _0xed89d9['channels'][_0x198697];delete _0xed89d9[_0xaa8e('0x13')][_0x198697];});}else{ut[_0xaa8e('0x48')](_0xaa8e('0x51'));delete this[_0xaa8e('0x10')][_0x198697];delete this['actions'][_0x198697];}};Fax[_0xaa8e('0x29')][_0xaa8e('0x1e')]=function(_0x1f003c){var _0x378f57=this;if(this[_0xaa8e('0x10')][_0x1f003c['uniqueid']]){if(this['actions'][_0x1f003c[_0xaa8e('0x24')]]){this[_0xaa8e('0x10')][_0x1f003c[_0xaa8e('0x24')]]['id']=this['actions'][_0x1f003c[_0xaa8e('0x24')]]['id'];this['channels'][_0x1f003c['uniqueid']][_0xaa8e('0x26')]=this[_0xaa8e('0x13')][_0x1f003c[_0xaa8e('0x24')]][_0xaa8e('0x26')];}logger[_0xaa8e('0x27')](_0x1f003c[_0xaa8e('0x24')],this[_0xaa8e('0x13')][_0x1f003c[_0xaa8e('0x24')]]?_0xaa8e('0x52'):'\x20hangup\x20faxRiceive\x20',JSON[_0xaa8e('0x40')](this[_0xaa8e('0x10')][_0x1f003c['uniqueid']]));if(this[_0xaa8e('0x13')][_0x1f003c[_0xaa8e('0x24')]]){if(this[_0xaa8e('0x10')][_0x1f003c[_0xaa8e('0x24')]][_0xaa8e('0x53')]>0x0&&this['channels'][_0x1f003c[_0xaa8e('0x24')]][_0xaa8e('0x1a')]===_0xaa8e('0x54')){this[_0xaa8e('0x4c')](_0x1f003c[_0xaa8e('0x24')],!![]);}else{this['updateStatus'](_0x1f003c[_0xaa8e('0x24')],![],this[_0xaa8e('0x10')][_0x1f003c['uniqueid']][_0xaa8e('0x55')]?_0xaa8e('0x56')+this['channels'][_0x1f003c[_0xaa8e('0x24')]][_0xaa8e('0x55')]:_0xaa8e('0x57'));}}}};Fax['prototype'][_0xaa8e('0x58')]=function(_0x5cffe3){var _0x2788db=this;return new BPromise(function(_0x16b1ba,_0x285e8f){_0x2788db[_0xaa8e('0x59')](_0x5cffe3,_0x2788db['faxAccounts'][_0x5cffe3[_0xaa8e('0x5a')]])[_0xaa8e('0x3e')](function(_0x3bf742){ut[_0xaa8e('0x48')](_0xaa8e('0x5b'),_0x3bf742);_0x16b1ba(ut['message'](_0xaa8e('0x5c')));})[_0xaa8e('0x41')](function(_0x18e7ac){ut[_0xaa8e('0x48')]('[Fax][execOriginate][failure]',_0x18e7ac);updateStatus(_0x5cffe3);_0x285e8f(ut[_0xaa8e('0x3a')](_0xaa8e('0x5d')));});});};Fax[_0xaa8e('0x29')]['checkAfterSend']=function(_0xc98673){var _0x4f34e5=this;return new BPromise(function(_0x36ef3c,_0x19864c){var _0x13b789=_0x4f34e5[_0xaa8e('0x5e')](_0x4f34e5[_0xaa8e('0x11')][_0xc98673['FaxAccountId']][_0xaa8e('0x5f')],_0xc98673);if(_0x13b789['isValid']){_0x36ef3c(ut['message'](_0xaa8e('0x60')));}else{_0x19864c(ut['message'](_0x13b789['message']));}});};function originate(_0x1b8279,_0x36712d,_0x18a968){return new BPromise(function(_0x390baf,_0xfe6e5){if(_0x18a968){var _0x20bcdc=util[_0xaa8e('0x61')](_0xaa8e('0x62'),path[_0xaa8e('0x3b')](_0x1b8279[_0xaa8e('0x3')])['name'],_0x1b8279[_0xaa8e('0x3')]);gs['execute'](_0x20bcdc)[_0xaa8e('0x3e')](function(){_0x1b8279[_0xaa8e('0x3')]=util[_0xaa8e('0x61')](_0xaa8e('0x63'),path[_0xaa8e('0x3b')](_0x1b8279[_0xaa8e('0x3')])[_0xaa8e('0x64')],path['parse'](_0x1b8279[_0xaa8e('0x3')])[_0xaa8e('0x26')]);_0x36712d['XMF-PATH']=_0x1b8279['path'];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0xaa8e('0x65')](ut[_0xaa8e('0x66')](_0x1b8279,_0x36712d))[_0xaa8e('0x3e')](function(_0xb10fec){_0x390baf(_0xb10fec);})[_0xaa8e('0x41')](function(_0x33c93b){_0xfe6e5(_0x33c93b);});})[_0xaa8e('0x41')](function(_0x466154){_0xfe6e5(_0x466154);});}else{ami[_0xaa8e('0x65')](ut['variablesAction'](_0x1b8279,_0x36712d))[_0xaa8e('0x3e')](function(_0x42987d){_0x390baf(_0x42987d);})['catch'](function(_0x52e580){_0xfe6e5(_0x52e580);});}});}Fax[_0xaa8e('0x29')][_0xaa8e('0x59')]=function(_0x3130f4,_0x449afc){var _0x2d54f4=this;return new BPromise(function(_0x2c2190,_0x8120cd){var _0x430164=uuid['v4']();var _0x344215=ut['addVariables'](_0x3130f4,_0x449afc);_0x2d54f4['actions'][_0x430164]=new Action(_0x430164,_0x449afc,_0x3130f4);var _0x5ce01e=_0x2d54f4[_0xaa8e('0x13')][_0x430164];if(path['parse'](_0x3130f4[_0xaa8e('0x3')])[_0xaa8e('0x67')]===_0xaa8e('0x3c')){originate(_0x5ce01e,_0x344215,!![])[_0xaa8e('0x3e')](function(_0x2de21e){_0x2c2190(_0x2de21e);})['catch'](function(_0x3cd282){_0x8120cd(_0x3cd282);});}else{originate(_0x5ce01e,_0x344215,![])[_0xaa8e('0x3e')](function(_0x3cfab3){_0x2c2190(_0x3cfab3);})[_0xaa8e('0x41')](function(_0x25c564){_0x8120cd(_0x25c564);});}});};Fax[_0xaa8e('0x29')][_0xaa8e('0x68')]=function(_0x11eccd){return!_[_0xaa8e('0x69')](_0x11eccd)&&!_[_0xaa8e('0x69')](_0x11eccd[_0xaa8e('0x26')])&&!_[_0xaa8e('0x69')](_0x11eccd[_0xaa8e('0x6a')])&&_0x11eccd[_0xaa8e('0x6a')]&&!_['isNil'](this[_0xaa8e('0x12')][util[_0xaa8e('0x61')]('SIP/%s',_0x11eccd[_0xaa8e('0x26')])])&&!_[_0xaa8e('0x69')](this[_0xaa8e('0x12')][util[_0xaa8e('0x61')](_0xaa8e('0x6b'),_0x11eccd[_0xaa8e('0x26')])]['status'])&&(this[_0xaa8e('0x12')][util[_0xaa8e('0x61')](_0xaa8e('0x6b'),_0x11eccd[_0xaa8e('0x26')])][_0xaa8e('0x31')]===_0xaa8e('0x6c')||this[_0xaa8e('0x12')][util[_0xaa8e('0x61')](_0xaa8e('0x6b'),_0x11eccd[_0xaa8e('0x26')])][_0xaa8e('0x31')]===_0xaa8e('0x6d'));};Fax[_0xaa8e('0x29')][_0xaa8e('0x5e')]=function(_0x29834f,_0x1a2bfd){if(!this[_0xaa8e('0x68')](_0x29834f)){ut[_0xaa8e('0x48')](_0xaa8e('0x6e'),_[_0xaa8e('0x69')](_0x29834f)?'':_0x29834f['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xaa8e('0x6f')};}if(_[_0xaa8e('0x69')](_0x1a2bfd[_0xaa8e('0x7')])){ut['logger'](_0xaa8e('0x70'),JSON['stringify'](_0x1a2bfd));return{'isValid':![],'message':_0xaa8e('0x71')};}if(_['isNil'](_0x1a2bfd[_0xaa8e('0x3')])){ut[_0xaa8e('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xaa8e('0x40')](_0x1a2bfd));return{'isValid':![],'message':_0xaa8e('0x72')};}return{'isValid':!![],'message':_0xaa8e('0x73')};};module['exports']=Fax; \ No newline at end of file +var _0x79cd=['channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','notify','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','response','AttachmentId','update','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','channel','name','info','uniqueid','\x20syncNewchannel\x20','syncVarSet','variable','value'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x79cd,0x1ab));var _0xd79c=function(_0xbd236a,_0x274557){_0xbd236a=_0xbd236a-0x0;var _0x19154b=_0x79cd[_0xbd236a];return _0x19154b;};'use strict';var util=require(_0xd79c('0x0'));var _=require(_0xd79c('0x1'));var BPromise=require(_0xd79c('0x2'));var uuid=require(_0xd79c('0x3'));var moment=require(_0xd79c('0x4'));var path=require(_0xd79c('0x5'));var tiff2pdf=require(_0xd79c('0x6'));var gs=require(_0xd79c('0x7'));var logger=require(_0xd79c('0x8'))(_0xd79c('0x9'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0xd79c('0xa'));var ut=require(_0xd79c('0xb'));var Action=require(_0xd79c('0xc'));var faxAccount=require(_0xd79c('0xd'));var attachment=require(_0xd79c('0xe'));var faxMessage=require(_0xd79c('0xf'));function Fax(_0xafdda){this[_0xd79c('0x10')]={};this[_0xd79c('0x11')]=_0xafdda['faxAccounts'];this[_0xd79c('0x12')]=_0xafdda[_0xd79c('0x12')];this[_0xd79c('0x13')]={};ami['on'](_0xd79c('0x14'),this[_0xd79c('0x15')][_0xd79c('0x16')](this));ami['on']('varset',this['syncVarSet'][_0xd79c('0x16')](this));ami['on'](_0xd79c('0x17'),this[_0xd79c('0x18')][_0xd79c('0x16')](this));ami['on'](_0xd79c('0x19'),this[_0xd79c('0x1a')][_0xd79c('0x16')](this));ami['on'](_0xd79c('0x1b'),this[_0xd79c('0x1c')][_0xd79c('0x16')](this));ami['on'](_0xd79c('0x1d'),this[_0xd79c('0x1e')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0xd79c('0x16')](this));ami['on']('originateresponse',this[_0xd79c('0x1f')]['bind'](this));}Fax[_0xd79c('0x20')]['syncNewchannel']=function(_0x27b808){if(_0x27b808[_0xd79c('0x21')]==='from-voip-provider'){for(var _0xab6493 in this[_0xd79c('0x11')]){if(this[_0xd79c('0x11')][_0xd79c('0x22')](_0xab6493)){if(_0x27b808[_0xd79c('0x23')]===this['faxAccounts'][_0xab6493][_0xd79c('0x24')]){this['channels'][_0x27b808['uniqueid']]={};this['channels'][_0x27b808['uniqueid']][_0xd79c('0x25')]=_0x27b808[_0xd79c('0x25')];this[_0xd79c('0x10')][_0x27b808['uniqueid']]['id']=this[_0xd79c('0x11')][_0xab6493]['id'];this['channels'][_0x27b808['uniqueid']][_0xd79c('0x26')]=this['faxAccounts'][_0xab6493][_0xd79c('0x26')];logger[_0xd79c('0x27')](_0x27b808[_0xd79c('0x28')],_0xd79c('0x29'));}}}}if(this[_0xd79c('0x13')][_0x27b808[_0xd79c('0x28')]]){this[_0xd79c('0x10')][_0x27b808[_0xd79c('0x28')]]={};this[_0xd79c('0x10')][_0x27b808['uniqueid']]['channel']=_0x27b808['channel'];logger[_0xd79c('0x27')](_0x27b808[_0xd79c('0x28')],_0xd79c('0x29'));}};Fax[_0xd79c('0x20')][_0xd79c('0x2a')]=function(_0x3a8a5c){if(this[_0xd79c('0x10')][_0x3a8a5c[_0xd79c('0x28')]]){for(var _0x1adfe4 in _0x3a8a5c[_0xd79c('0x2b')]){if(_0x3a8a5c['variable'][_0xd79c('0x22')](_0x1adfe4)){this[_0xd79c('0x10')][_0x3a8a5c['uniqueid']][_0x1adfe4]=_0x3a8a5c[_0xd79c('0x2c')];}}}};Fax['prototype'][_0xd79c('0x18')]=function(_0x4f93ff){if(this[_0xd79c('0x10')][_0x4f93ff[_0xd79c('0x28')]]){this[_0xd79c('0x10')][_0x4f93ff[_0xd79c('0x28')]][_0xd79c('0x2d')]=_0x4f93ff[_0xd79c('0x2d')];this['channels'][_0x4f93ff[_0xd79c('0x28')]][_0xd79c('0x2e')]=_0x4f93ff[_0xd79c('0x2e')];}};Fax['prototype']['syncNewExten']=function(_0x2c6625){if(this[_0xd79c('0x10')][_0x2c6625[_0xd79c('0x28')]]){for(var _0xd258d7 in _0x2c6625[_0xd79c('0x2b')]){if(_0x2c6625['variable']['hasOwnProperty'](_0xd258d7)){this[_0xd79c('0x10')][_0x2c6625[_0xd79c('0x28')]][_0xd258d7]=_0x2c6625[_0xd79c('0x2c')];}}}};Fax['prototype'][_0xd79c('0x1c')]=function(_0x3e1a14){if(this['channels'][_0x3e1a14[_0xd79c('0x28')]]){this['channels'][_0x3e1a14['uniqueid']][_0xd79c('0x2f')]=_0x3e1a14[_0xd79c('0x2f')];this[_0xd79c('0x10')][_0x3e1a14[_0xd79c('0x28')]]['status']=_0x3e1a14[_0xd79c('0x30')];this[_0xd79c('0x10')][_0x3e1a14[_0xd79c('0x28')]][_0xd79c('0x24')]=_0x3e1a14['localstationid'];this[_0xd79c('0x10')][_0x3e1a14[_0xd79c('0x28')]][_0xd79c('0x31')]=_0x3e1a14[_0xd79c('0x31')];logger['info'](_0x3e1a14[_0xd79c('0x28')],_0xd79c('0x32'));}};Fax['prototype']['syncReceiveFax']=function(_0x29aca1){var _0xfe9070=this;if(this['channels'][_0x29aca1[_0xd79c('0x28')]]){var _0x320001=this[_0xd79c('0x10')][_0x29aca1['uniqueid']]['id'];this[_0xd79c('0x10')][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x33')]=_0x29aca1[_0xd79c('0x33')];this['channels'][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x34')]=_0x29aca1['pagestransferred'];this['channels'][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x24')]=_0x29aca1[_0xd79c('0x24')];this[_0xd79c('0x10')][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x35')]=_0x29aca1[_0xd79c('0x35')];this[_0xd79c('0x10')][_0x29aca1[_0xd79c('0x28')]]['transferrate']=_0x29aca1[_0xd79c('0x36')];this[_0xd79c('0x10')][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x31')]=_0x29aca1[_0xd79c('0x31')];this[_0xd79c('0x10')][_0x29aca1[_0xd79c('0x28')]]['calleridnum']=_0x29aca1[_0xd79c('0x37')];if(this['channels'][_0x29aca1[_0xd79c('0x28')]][_0xd79c('0x34')]>0x0){tiff2pdf(_0x29aca1[_0xd79c('0x31')],_0xd79c('0x38'),function(_0xa808b6){logger[_0xd79c('0x27')](_0x29aca1[_0xd79c('0x28')],_0xd79c('0x39'),_0xa808b6[_0xd79c('0x3a')]);attachment[_0xd79c('0x3b')]({'name':path[_0xd79c('0x3c')](_0x29aca1[_0xd79c('0x31')])[_0xd79c('0x26')],'basename':path[_0xd79c('0x3c')](_0x29aca1[_0xd79c('0x31')])[_0xd79c('0x26')]+'.pdf','type':_0xd79c('0x3d')})['then'](function(_0x3b44f2){faxAccount[_0xd79c('0x3e')](_0x320001,{'from':_0x29aca1[_0xd79c('0x37')],'mapKey':'fax','body':path[_0xd79c('0x3c')](_0x29aca1[_0xd79c('0x31')])[_0xd79c('0x26')]+_0xd79c('0x3f'),'AttachmentId':_0x3b44f2['id']})[_0xd79c('0x40')](function(_0x9ae253){logger['error'](_0x29aca1[_0xd79c('0x28')],_0xd79c('0x41'),JSON[_0xd79c('0x42')](_0x9ae253));});})['catch'](function(_0x52a636){logger[_0xd79c('0x43')](_0x29aca1['uniqueid'],_0xd79c('0x44'),JSON[_0xd79c('0x42')](_0x52a636));});});}logger[_0xd79c('0x27')](_0x29aca1[_0xd79c('0x28')],_0xd79c('0x44'));}};Fax[_0xd79c('0x20')][_0xd79c('0x1f')]=function(_0x41e6dc){if(this[_0xd79c('0x13')][_0x41e6dc['uniqueid']]){_[_0xd79c('0x45')](this[_0xd79c('0x10')][_0x41e6dc[_0xd79c('0x28')]],_['pick'](_0x41e6dc,[_0xd79c('0x46'),'reason']));}};function updateStatus(_0x397a71){if(_0x397a71[_0xd79c('0x47')]){faxMessage[_0xd79c('0x48')](_0x397a71[_0xd79c('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xd79c('0x49')](function(_0x2b9829){ut[_0xd79c('0x4a')]('[Fax][Message][Error][Updated]',_0x2b9829);})['catch'](function(_0x13857c){ut[_0xd79c('0x4a')](_0xd79c('0x4b'),_0x13857c);});}else{ut[_0xd79c('0x4a')](_0xd79c('0x4c'));}}Fax[_0xd79c('0x20')][_0xd79c('0x4d')]=function(_0x532de8,_0x1598df,_0x7194a7){var _0x597759=this;var _0x2ec753={};if(_0x1598df){_0x2ec753={'read':_0x1598df};}else{_0x2ec753={'failMessage':_0x7194a7};}if(this[_0xd79c('0x13')][_0x532de8][_0xd79c('0x47')]){faxMessage[_0xd79c('0x48')](this['actions'][_0x532de8][_0xd79c('0x47')],_0x2ec753)[_0xd79c('0x49')](function(_0x467342){ut[_0xd79c('0x4a')]('[Fax][Message][Updated]',_0x467342);})[_0xd79c('0x40')](function(_0x4f7463){ut[_0xd79c('0x4a')]('[Fax][Message][NoUpdate1]',_0x4f7463);})[_0xd79c('0x4e')](function(){delete _0x597759[_0xd79c('0x10')][_0x532de8];delete _0x597759[_0xd79c('0x13')][_0x532de8];});}else{ut[_0xd79c('0x4a')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x532de8];delete this[_0xd79c('0x13')][_0x532de8];}};Fax['prototype']['syncHangup']=function(_0x50d510){var _0xb61760=this;if(this['channels'][_0x50d510[_0xd79c('0x28')]]){if(this[_0xd79c('0x13')][_0x50d510[_0xd79c('0x28')]]){this['channels'][_0x50d510[_0xd79c('0x28')]]['id']=this[_0xd79c('0x13')][_0x50d510[_0xd79c('0x28')]]['id'];this[_0xd79c('0x10')][_0x50d510[_0xd79c('0x28')]][_0xd79c('0x26')]=this['actions'][_0x50d510['uniqueid']][_0xd79c('0x26')];}logger[_0xd79c('0x27')](_0x50d510[_0xd79c('0x28')],this[_0xd79c('0x13')][_0x50d510[_0xd79c('0x28')]]?'\x20hangup\x20sendFile\x20':_0xd79c('0x4f'),JSON[_0xd79c('0x42')](this[_0xd79c('0x10')][_0x50d510[_0xd79c('0x28')]]));if(this['actions'][_0x50d510[_0xd79c('0x28')]]){if(this[_0xd79c('0x10')][_0x50d510['uniqueid']][_0xd79c('0x50')]>0x0&&this[_0xd79c('0x10')][_0x50d510['uniqueid']][_0xd79c('0x1b')]===_0xd79c('0x51')){this[_0xd79c('0x4d')](_0x50d510[_0xd79c('0x28')],!![]);}else{this[_0xd79c('0x4d')](_0x50d510[_0xd79c('0x28')],![],this[_0xd79c('0x10')][_0x50d510[_0xd79c('0x28')]][_0xd79c('0x52')]?_0xd79c('0x53')+this['channels'][_0x50d510['uniqueid']]['faxstatusstring']:_0xd79c('0x54'));}}}};Fax[_0xd79c('0x20')][_0xd79c('0x55')]=function(_0x22eb5e){var _0x56fd6c=this;return new BPromise(function(_0x1c61b4,_0x58bb16){_0x56fd6c[_0xd79c('0x56')](_0x22eb5e,_0x56fd6c[_0xd79c('0x11')][_0x22eb5e['FaxAccountId']])['then'](function(_0x5d57d0){ut[_0xd79c('0x4a')](_0xd79c('0x57'),_0x5d57d0);_0x1c61b4(ut['message'](_0xd79c('0x58')));})[_0xd79c('0x40')](function(_0x5e405e){ut[_0xd79c('0x4a')](_0xd79c('0x59'),_0x5e405e);updateStatus(_0x22eb5e);_0x58bb16(ut[_0xd79c('0x3a')](_0xd79c('0x5a')));});});};Fax[_0xd79c('0x20')][_0xd79c('0x5b')]=function(_0x45f61a){var _0x5e490c=this;return new BPromise(function(_0x457c0e,_0x505fa1){var _0x3c076a=_0x5e490c[_0xd79c('0x5c')](_0x5e490c[_0xd79c('0x11')][_0x45f61a[_0xd79c('0x5d')]][_0xd79c('0x5e')],_0x45f61a);if(_0x3c076a[_0xd79c('0x5f')]){_0x457c0e(ut[_0xd79c('0x3a')]('Trunk\x20Reachable'));}else{_0x505fa1(ut['message'](_0x3c076a[_0xd79c('0x3a')]));}});};function originate(_0x4bde09,_0xeb6872,_0x1b068d){return new BPromise(function(_0x34c711,_0x400d0b){if(_0x1b068d){var _0x63f31f=util[_0xd79c('0x60')](_0xd79c('0x61'),path[_0xd79c('0x3c')](_0x4bde09[_0xd79c('0x5')])[_0xd79c('0x26')],_0x4bde09[_0xd79c('0x5')]);gs[_0xd79c('0x62')](_0x63f31f)[_0xd79c('0x49')](function(){_0x4bde09['path']=util[_0xd79c('0x60')](_0xd79c('0x63'),path[_0xd79c('0x3c')](_0x4bde09[_0xd79c('0x5')])[_0xd79c('0x64')],path['parse'](_0x4bde09[_0xd79c('0x5')])['name']);_0xeb6872[_0xd79c('0x65')]=_0x4bde09[_0xd79c('0x5')];ut[_0xd79c('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami[_0xd79c('0x66')](ut[_0xd79c('0x67')](_0x4bde09,_0xeb6872))[_0xd79c('0x49')](function(_0x20bd6b){_0x34c711(_0x20bd6b);})[_0xd79c('0x40')](function(_0xe8e48f){_0x400d0b(_0xe8e48f);});})['catch'](function(_0xfebdca){_0x400d0b(_0xfebdca);});}else{ami[_0xd79c('0x66')](ut[_0xd79c('0x67')](_0x4bde09,_0xeb6872))[_0xd79c('0x49')](function(_0x2546ed){_0x34c711(_0x2546ed);})['catch'](function(_0x42a4e4){_0x400d0b(_0x42a4e4);});}});}Fax[_0xd79c('0x20')][_0xd79c('0x56')]=function(_0x3908de,_0x3b4799){var _0x4990c3=this;return new BPromise(function(_0x10de66,_0xe00c71){var _0x2b248b=uuid['v4']();var _0x43767a=ut['addVariables'](_0x3908de,_0x3b4799);_0x4990c3[_0xd79c('0x13')][_0x2b248b]=new Action(_0x2b248b,_0x3b4799,_0x3908de);var _0x96815b=_0x4990c3[_0xd79c('0x13')][_0x2b248b];if(path[_0xd79c('0x3c')](_0x3908de[_0xd79c('0x5')])[_0xd79c('0x68')]===_0xd79c('0x3f')){originate(_0x96815b,_0x43767a,!![])[_0xd79c('0x49')](function(_0x314a90){_0x10de66(_0x314a90);})[_0xd79c('0x40')](function(_0x136ce3){_0xe00c71(_0x136ce3);});}else{originate(_0x96815b,_0x43767a,![])[_0xd79c('0x49')](function(_0x59db4a){_0x10de66(_0x59db4a);})[_0xd79c('0x40')](function(_0x39be82){_0xe00c71(_0x39be82);});}});};Fax[_0xd79c('0x20')]['isTrunkReachable']=function(_0x3809c2){return!_[_0xd79c('0x69')](_0x3809c2)&&!_[_0xd79c('0x69')](_0x3809c2[_0xd79c('0x26')])&&!_[_0xd79c('0x69')](_0x3809c2[_0xd79c('0x6a')])&&_0x3809c2[_0xd79c('0x6a')]&&!_[_0xd79c('0x69')](this[_0xd79c('0x12')][util[_0xd79c('0x60')]('SIP/%s',_0x3809c2[_0xd79c('0x26')])])&&!_[_0xd79c('0x69')](this[_0xd79c('0x12')][util['format']('SIP/%s',_0x3809c2[_0xd79c('0x26')])][_0xd79c('0x30')])&&(this[_0xd79c('0x12')][util[_0xd79c('0x60')](_0xd79c('0x6b'),_0x3809c2[_0xd79c('0x26')])]['status']===_0xd79c('0x6c')||this[_0xd79c('0x12')][util[_0xd79c('0x60')](_0xd79c('0x6b'),_0x3809c2[_0xd79c('0x26')])][_0xd79c('0x30')]===_0xd79c('0x6d'));};Fax[_0xd79c('0x20')][_0xd79c('0x5c')]=function(_0x26cad4,_0x220be1){if(!this[_0xd79c('0x6e')](_0x26cad4)){ut[_0xd79c('0x4a')](_0xd79c('0x6f'),_[_0xd79c('0x69')](_0x26cad4)?'':_0x26cad4[_0xd79c('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xd79c('0x69')](_0x220be1['fax'])){ut[_0xd79c('0x4a')](_0xd79c('0x70'),JSON[_0xd79c('0x42')](_0x220be1));return{'isValid':![],'message':_0xd79c('0x71')};}if(_['isNil'](_0x220be1[_0xd79c('0x5')])){ut[_0xd79c('0x4a')](_0xd79c('0x72'),JSON['stringify'](_0x220be1));return{'isValid':![],'message':_0xd79c('0x73')};}return{'isValid':!![],'message':_0xd79c('0x74')};};module[_0xd79c('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 98e5dfd..4ff228f 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 _0x2ad5=['lodash','../rpc/faxAccount','error','inspect','notify','resolve','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x571675,_0xe50f38){var _0x319cbd=function(_0x405487){while(--_0x405487){_0x571675['push'](_0x571675['shift']());}};_0x319cbd(++_0xe50f38);}(_0x2ad5,0x146));var _0x52ad=function(_0x26f302,_0x34409c){_0x26f302=_0x26f302-0x0;var _0x53250e=_0x2ad5[_0x26f302];return _0x53250e;};'use strict';var util=require(_0x52ad('0x0'));var BPromise=require(_0x52ad('0x1'));var logger=require(_0x52ad('0x2'))(_0x52ad('0x3'));var _=require(_0x52ad('0x4'));var faxAccount=require(_0x52ad('0x5'));function loggerCatch(_0x106555){return function(_0x187db5){logger[_0x52ad('0x6')](_0x106555,util[_0x52ad('0x7')](_0x187db5,{'showHidden':![],'depth':null}));};}exports[_0x52ad('0x8')]=function(_0x21292e,_0x153aef){return BPromise[_0x52ad('0x9')]()['then'](faxAccount['notify'](_0x21292e,_0x153aef))['catch'](loggerCatch(_0x52ad('0xa')));}; \ No newline at end of file +var _0xb9c8=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util','bluebird'];(function(_0x396067,_0x3d9454){var _0x14f19c=function(_0x44e59a){while(--_0x44e59a){_0x396067['push'](_0x396067['shift']());}};_0x14f19c(++_0x3d9454);}(_0xb9c8,0x9a));var _0x8b9c=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0xb9c8[_0x359377];return _0x8be18a;};'use strict';var util=require(_0x8b9c('0x0'));var BPromise=require(_0x8b9c('0x1'));var logger=require(_0x8b9c('0x2'))(_0x8b9c('0x3'));var _=require(_0x8b9c('0x4'));var faxAccount=require(_0x8b9c('0x5'));function loggerCatch(_0x57a844){return function(_0x1cb9d8){logger[_0x8b9c('0x6')](_0x57a844,util[_0x8b9c('0x7')](_0x1cb9d8,{'showHidden':![],'depth':null}));};}exports[_0x8b9c('0x8')]=function(_0x5c4d76,_0x596ae9){return BPromise[_0x8b9c('0x9')]()[_0x8b9c('0xa')](faxAccount[_0x8b9c('0x8')](_0x5c4d76,_0x596ae9))['catch'](loggerCatch(_0x8b9c('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 9076e62..96012b4 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 _0x0702=['info','Exec\x20gs','\x20Error\x20:','util','bluebird','child_process','exec','execute'];(function(_0x1c6471,_0x29f86e){var _0x474a68=function(_0x2a14d4){while(--_0x2a14d4){_0x1c6471['push'](_0x1c6471['shift']());}};_0x474a68(++_0x29f86e);}(_0x0702,0x143));var _0x2070=function(_0x35c7d5,_0x54782e){_0x35c7d5=_0x35c7d5-0x0;var _0x19b4e6=_0x0702[_0x35c7d5];return _0x19b4e6;};'use strict';var util=require(_0x2070('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x2070('0x1'));var exec=require(_0x2070('0x2'))[_0x2070('0x3')];exports[_0x2070('0x4')]=function(_0x298fa1){return new BPromise(function(_0xba0bec,_0x36dcc8){exec(_0x298fa1,function(_0x567cb5,_0x3d6a26,_0x1a3d40){logger[_0x2070('0x5')](_0x2070('0x6'),_0x3d6a26);if(_0x567cb5){logger[_0x2070('0x5')](_0x2070('0x6'),_0x2070('0x7'),util['inspect'](_0x567cb5,{'showHidden':![],'depth':null}),_0x3d6a26,_0x1a3d40);_0x36dcc8(_0x567cb5);}_0xba0bec(_0x3d6a26);});});}; \ No newline at end of file +var _0x97b9=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x1d50a3,_0x3213ff){var _0x4d8902=function(_0x79d1ba){while(--_0x79d1ba){_0x1d50a3['push'](_0x1d50a3['shift']());}};_0x4d8902(++_0x3213ff);}(_0x97b9,0x86));var _0x997b=function(_0xa5d547,_0x49e8e8){_0xa5d547=_0xa5d547-0x0;var _0x3139b5=_0x97b9[_0xa5d547];return _0x3139b5;};'use strict';var util=require(_0x997b('0x0'));var logger=require(_0x997b('0x1'))(_0x997b('0x2'));var BPromise=require(_0x997b('0x3'));var exec=require(_0x997b('0x4'))[_0x997b('0x5')];exports['execute']=function(_0x1b39c0){return new BPromise(function(_0x30c43d,_0xb60cc1){exec(_0x1b39c0,function(_0x411156,_0x201e16,_0x55fd41){logger[_0x997b('0x6')]('Exec\x20gs',_0x201e16);if(_0x411156){logger['info'](_0x997b('0x7'),_0x997b('0x8'),util[_0x997b('0x9')](_0x411156,{'showHidden':![],'depth':null}),_0x201e16,_0x55fd41);_0xb60cc1(_0x411156);}_0x30c43d(_0x201e16);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 99e8028..aff7dc9 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 _0xf57b=['modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','headerinfo','util','lodash','moment','logger','info','addVariables','maxrate','format','\x22%s\x22'];(function(_0x5a335a,_0x11001d){var _0x25ac39=function(_0x852fb6){while(--_0x852fb6){_0x5a335a['push'](_0x5a335a['shift']());}};_0x25ac39(++_0x11001d);}(_0xf57b,0x1c3));var _0xbf57=function(_0x2b45de,_0x2e5b2e){_0x2b45de=_0x2b45de-0x0;var _0x596120=_0xf57b[_0x2b45de];return _0x596120;};'use strict';var util=require(_0xbf57('0x0'));var _=require(_0xbf57('0x1'));var moment=require(_0xbf57('0x2'));var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x39a644){return{'message':_0x39a644};};exports[_0xbf57('0x3')]=function(_0x40183a,_0x2bc8d6){logger[_0xbf57('0x4')](_0x40183a,util['inspect'](_0x2bc8d6,{'showHidden':![],'depth':null}));};exports[_0xbf57('0x5')]=function(_0x16c741,_0x45c5ef){var _0x3be423={'XMF-ECM':_0x45c5ef['ecm'],'XMF-HEADERINFO':_0x45c5ef['headerinfo'],'XMF-MINRATE':_0x45c5ef['minrate'],'XMF-MAXRATE':_0x45c5ef[_0xbf57('0x6')],'XMF-MODEM':util[_0xbf57('0x7')](_0xbf57('0x8'),_0x45c5ef[_0xbf57('0x9')]),'XMF-GATEWAY':_0x45c5ef[_0xbf57('0xa')],'XMF-FAXDETECT':_0x45c5ef[_0xbf57('0xb')],'XMF-T38TIMEOUT':_0x45c5ef[_0xbf57('0xc')],'XMF-LOCALSTATIONID':_0x45c5ef[_0xbf57('0xd')],'XMF-PATH':_0x16c741['path']};return _0x3be423;};exports[_0xbf57('0xe')]=function(_0x211cde,_0x1e5d47){return{'actionid':_0x211cde[_0xbf57('0xf')],'action':_0xbf57('0x10'),'channel':_0x211cde[_0xbf57('0x11')],'Exten':_0xbf57('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0xbf57('0x7')]('\x22%s\x22\x20<%s>',_0x211cde['headerinfo']?_0x211cde[_0xbf57('0x13')]:'',_0x211cde[_0xbf57('0xd')]),'variable':_0x1e5d47,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x211cde[_0xbf57('0xf')]};}; \ No newline at end of file +var _0x98c0=['\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','fax','message','logger','info','inspect','addVariables','ecm','minrate','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','format'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x98c0,0xc2));var _0x098c=function(_0x526b3c,_0x5f261a){_0x526b3c=_0x526b3c-0x0;var _0x5e09b8=_0x98c0[_0x526b3c];return _0x5e09b8;};'use strict';var util=require(_0x098c('0x0'));var _=require(_0x098c('0x1'));var moment=require(_0x098c('0x2'));var logger=require('../../../../config/logger')(_0x098c('0x3'));exports[_0x098c('0x4')]=function(_0x4d7480){return{'message':_0x4d7480};};exports[_0x098c('0x5')]=function(_0x29e704,_0x1418e2){logger[_0x098c('0x6')](_0x29e704,util[_0x098c('0x7')](_0x1418e2,{'showHidden':![],'depth':null}));};exports[_0x098c('0x8')]=function(_0x556e9e,_0x4055d4){var _0x5360cb={'XMF-ECM':_0x4055d4[_0x098c('0x9')],'XMF-HEADERINFO':_0x4055d4['headerinfo'],'XMF-MINRATE':_0x4055d4[_0x098c('0xa')],'XMF-MAXRATE':_0x4055d4['maxrate'],'XMF-MODEM':util['format']('\x22%s\x22',_0x4055d4[_0x098c('0xb')]),'XMF-GATEWAY':_0x4055d4[_0x098c('0xc')],'XMF-FAXDETECT':_0x4055d4[_0x098c('0xd')],'XMF-T38TIMEOUT':_0x4055d4[_0x098c('0xe')],'XMF-LOCALSTATIONID':_0x4055d4[_0x098c('0xf')],'XMF-PATH':_0x556e9e['path']};return _0x5360cb;};exports[_0x098c('0x10')]=function(_0x30f543,_0x3d32f8){return{'actionid':_0x30f543[_0x098c('0x11')],'action':_0x098c('0x12'),'channel':_0x30f543[_0x098c('0x13')],'Exten':_0x098c('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x098c('0x15')](_0x098c('0x16'),_0x30f543[_0x098c('0x17')]?_0x30f543[_0x098c('0x17')]:'',_0x30f543[_0x098c('0xf')]),'variable':_0x3d32f8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x30f543[_0x098c('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ab82581..2f0345a 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 _0x3570=['./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','./server','./report','./preview','./fax','./rpc/voiceQueue'];(function(_0x40aee4,_0xf3059b){var _0x166804=function(_0xb2ccc){while(--_0xb2ccc){_0x40aee4['push'](_0x40aee4['shift']());}};_0x166804(++_0xf3059b);}(_0x3570,0xb1));var _0x0357=function(_0x143abf,_0x5084c8){_0x143abf=_0x143abf-0x0;var _0x340e21=_0x3570[_0x143abf];return _0x340e21;};'use strict';var BPromise=require(_0x0357('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x0357('0x1'));var Realtime=require('./realtime');var Report=require(_0x0357('0x2'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x0357('0x3'));var Fax=require(_0x0357('0x4'));var user=require('./rpc/user');var voiceQueue=require(_0x0357('0x5'));var voiceQueueReport=require(_0x0357('0x6'));var voiceCallReport=require(_0x0357('0x7'));var trunk=require('./rpc/trunk');var trigger=require(_0x0357('0x8'));var template=require(_0x0357('0x9'));var cmHopperHistory=require(_0x0357('0xa'));var campaign=require(_0x0357('0xb'));var voiceExtension=require(_0x0357('0xc'));var faxAccount=require(_0x0357('0xd'));var zendesk=require(_0x0357('0xe'));var salesforce=require(_0x0357('0xf'));var sugarcrm=require(_0x0357('0x10'));var freshdesk=require(_0x0357('0x11'));var desk=require(_0x0357('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x0357('0x13'));var dynamics365=require(_0x0357('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0357('0x15')](_0x0357('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0357('0x15')](_0x0357('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0357('0x17')]()[_0x0357('0x18')](user['getAgents']())[_0x0357('0x18')](realtime['initAgents']())[_0x0357('0x18')](user[_0x0357('0x19')]())[_0x0357('0x18')](realtime[_0x0357('0x1a')]())[_0x0357('0x18')](trunk[_0x0357('0x1b')]())[_0x0357('0x18')](realtime[_0x0357('0x1c')]())[_0x0357('0x18')](voiceQueue['getVoiceQueues']())[_0x0357('0x18')](realtime[_0x0357('0x1d')]())[_0x0357('0x18')](trigger[_0x0357('0x1e')]())['then'](realtime[_0x0357('0x1f')]())[_0x0357('0x18')](template['getTemplates']())[_0x0357('0x18')](realtime['initTemplates']())[_0x0357('0x18')](zendesk[_0x0357('0x20')]())[_0x0357('0x18')](realtime[_0x0357('0x21')]())['then'](salesforce[_0x0357('0x22')]())[_0x0357('0x18')](realtime[_0x0357('0x23')]())[_0x0357('0x18')](sugarcrm['getSugarcrmAccounts']())[_0x0357('0x18')](realtime['initSugarcrmAccounts']())[_0x0357('0x18')](freshdesk[_0x0357('0x24')]())[_0x0357('0x18')](realtime[_0x0357('0x25')]())[_0x0357('0x18')](desk[_0x0357('0x26')]())[_0x0357('0x18')](realtime[_0x0357('0x27')]())[_0x0357('0x18')](zoho[_0x0357('0x28')]())['then'](realtime[_0x0357('0x29')]())[_0x0357('0x18')](vtiger[_0x0357('0x2a')]())['then'](realtime[_0x0357('0x2b')]())[_0x0357('0x18')](freshsales[_0x0357('0x2c')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow['getServicenowAccounts']())['then'](realtime[_0x0357('0x2d')]())[_0x0357('0x18')](dynamics365['getDynamics365Accounts']())[_0x0357('0x18')](realtime[_0x0357('0x2e')]())[_0x0357('0x18')](campaign[_0x0357('0x2f')]())[_0x0357('0x18')](realtime[_0x0357('0x30')]())[_0x0357('0x18')](voiceExtension['getVoiceExtensions']())[_0x0357('0x18')](realtime[_0x0357('0x31')]())[_0x0357('0x18')](faxAccount[_0x0357('0x32')]())[_0x0357('0x18')](realtime[_0x0357('0x33')]())[_0x0357('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x0357('0x17')]()[_0x0357('0x18')](voiceQueueReport[_0x0357('0x34')]())[_0x0357('0x18')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x0357('0x18')](realtime[_0x0357('0x35')]())[_0x0357('0x18')](cmHopperHistory[_0x0357('0x36')]())[_0x0357('0x18')](realtime['initCampaignHopperHistory']())[_0x0357('0x18')](voiceCallReport[_0x0357('0x37')]())['then'](realtime[_0x0357('0x38')]())['then'](function(_0x225daf){})[_0x0357('0x39')](function(_0x4697f5){console[_0x0357('0x3a')](_0x4697f5);});}function main(){return server[_0x0357('0x3b')](realtime,preview,fax)[_0x0357('0x18')](function(_0x34f239){return initRealtime();})[_0x0357('0x18')](function(){return initParams();})[_0x0357('0x18')](function(){report[_0x0357('0x3c')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x222274){console['log'](_0x222274);});}main(); \ No newline at end of file +var _0xd200=['sync','log','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getDynamics365Accounts','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen'];(function(_0x4464bc,_0x24d9bc){var _0x516215=function(_0x4ed6e5){while(--_0x4ed6e5){_0x4464bc['push'](_0x4464bc['shift']());}};_0x516215(++_0x24d9bc);}(_0xd200,0x8e));var _0x0d20=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xd200[_0x2064e5];return _0x21a233;};'use strict';var BPromise=require(_0x0d20('0x0'));var util=require(_0x0d20('0x1'));var moment=require(_0x0d20('0x2'));var server=require(_0x0d20('0x3'));var Realtime=require(_0x0d20('0x4'));var Report=require(_0x0d20('0x5'));var Acw=require(_0x0d20('0x6'));var Trigger=require(_0x0d20('0x7'));var Dialer=require('./dialer');var Preview=require(_0x0d20('0x8'));var Fax=require(_0x0d20('0x9'));var user=require(_0x0d20('0xa'));var voiceQueue=require(_0x0d20('0xb'));var voiceQueueReport=require(_0x0d20('0xc'));var voiceCallReport=require(_0x0d20('0xd'));var trunk=require(_0x0d20('0xe'));var trigger=require(_0x0d20('0xf'));var template=require(_0x0d20('0x10'));var cmHopperHistory=require(_0x0d20('0x11'));var campaign=require(_0x0d20('0x12'));var voiceExtension=require(_0x0d20('0x13'));var faxAccount=require(_0x0d20('0x14'));var zendesk=require(_0x0d20('0x15'));var salesforce=require(_0x0d20('0x16'));var sugarcrm=require(_0x0d20('0x17'));var freshdesk=require(_0x0d20('0x18'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x0d20('0x19'));var vtiger=require(_0x0d20('0x1a'));var freshsales=require(_0x0d20('0x1b'));var servicenow=require(_0x0d20('0x1c'));var dynamics365=require(_0x0d20('0x1d'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0d20('0x1e')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0d20('0x1e')](_0x0d20('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0d20('0x20')]()[_0x0d20('0x21')](user[_0x0d20('0x22')]())[_0x0d20('0x21')](realtime[_0x0d20('0x23')]())[_0x0d20('0x21')](user[_0x0d20('0x24')]())[_0x0d20('0x21')](realtime[_0x0d20('0x25')]())[_0x0d20('0x21')](trunk[_0x0d20('0x26')]())[_0x0d20('0x21')](realtime[_0x0d20('0x27')]())['then'](voiceQueue['getVoiceQueues']())[_0x0d20('0x21')](realtime[_0x0d20('0x28')]())[_0x0d20('0x21')](trigger[_0x0d20('0x29')]())[_0x0d20('0x21')](realtime[_0x0d20('0x2a')]())[_0x0d20('0x21')](template[_0x0d20('0x2b')]())['then'](realtime[_0x0d20('0x2c')]())['then'](zendesk['getZendeskAccounts']())[_0x0d20('0x21')](realtime[_0x0d20('0x2d')]())['then'](salesforce[_0x0d20('0x2e')]())[_0x0d20('0x21')](realtime[_0x0d20('0x2f')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x0d20('0x21')](realtime['initSugarcrmAccounts']())[_0x0d20('0x21')](freshdesk[_0x0d20('0x30')]())[_0x0d20('0x21')](realtime['initFreshdeskAccounts']())[_0x0d20('0x21')](desk[_0x0d20('0x31')]())[_0x0d20('0x21')](realtime['initDeskAccounts']())[_0x0d20('0x21')](zoho[_0x0d20('0x32')]())[_0x0d20('0x21')](realtime['initZohoAccounts']())[_0x0d20('0x21')](vtiger[_0x0d20('0x33')]())[_0x0d20('0x21')](realtime[_0x0d20('0x34')]())[_0x0d20('0x21')](freshsales['getFreshsalesAccounts']())[_0x0d20('0x21')](realtime[_0x0d20('0x35')]())[_0x0d20('0x21')](servicenow['getServicenowAccounts']())[_0x0d20('0x21')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x0d20('0x36')]())['then'](realtime['initDynamics365Accounts']())[_0x0d20('0x21')](campaign['getCampaigns']())[_0x0d20('0x21')](realtime['initCampaigns']())[_0x0d20('0x21')](voiceExtension[_0x0d20('0x37')]())[_0x0d20('0x21')](realtime['initVoiceExtensions']())[_0x0d20('0x21')](faxAccount[_0x0d20('0x38')]())[_0x0d20('0x21')](realtime[_0x0d20('0x39')]())[_0x0d20('0x21')](function(){return realtime;});}function initParams(){return BPromise[_0x0d20('0x20')]()[_0x0d20('0x21')](voiceQueueReport[_0x0d20('0x3a')]())['then'](realtime[_0x0d20('0x3b')]())[_0x0d20('0x21')](cmHopperHistory[_0x0d20('0x3c')]())[_0x0d20('0x21')](realtime[_0x0d20('0x3d')]())['then'](cmHopperHistory[_0x0d20('0x3e')]())[_0x0d20('0x21')](realtime[_0x0d20('0x3f')]())[_0x0d20('0x21')](voiceCallReport[_0x0d20('0x40')]())[_0x0d20('0x21')](realtime[_0x0d20('0x41')]())[_0x0d20('0x21')](function(_0x10c118){})[_0x0d20('0x42')](function(_0x4e519f){console['log'](_0x4e519f);});}function main(){return server[_0x0d20('0x43')](realtime,preview,fax)['then'](function(_0xf300e5){return initRealtime();})[_0x0d20('0x21')](function(){return initParams();})[_0x0d20('0x21')](function(){report[_0x0d20('0x44')]();setInterval(initRealtime,0x1388);})[_0x0d20('0x42')](function(_0xbc17bf){console[_0x0d20('0x45')](_0xbc17bf);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 31fcc9f..3d4b970 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x1cb75f,_0x4baa0b){var _0x2a09de=function(_0x438cf0){while(--_0x438cf0){_0x1cb75f['push'](_0x1cb75f['shift']());}};_0x2a09de(++_0x4baa0b);}(_0xe706,0xa3));var _0x6e70=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0xe706[_0x38af48];return _0x445384;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xedd9,0xfc));var _0x9edd=function(_0x279d3f,_0x55285d){_0x279d3f=_0x279d3f-0x0;var _0xb6b0ed=_0xedd9[_0x279d3f];return _0xb6b0ed;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 1123b55..6078111 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 _0x7571=['dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7571,0x18f));var _0x1757=function(_0x427780,_0x545709){_0x427780=_0x427780-0x0;var _0x459e8c=_0x7571[_0x427780];return _0x459e8c;};'use strict';function Campaign(_0x3aaab9){this['id']=_0x3aaab9['id']||0x0;this[_0x1757('0x0')]=_0x3aaab9[_0x1757('0x0')]||'';this[_0x1757('0x1')]=_0x3aaab9[_0x1757('0x1')]||_0x1757('0x2');this['originated']=0x0;this[_0x1757('0x3')]=0x0;this[_0x1757('0x4')]=0x0;this[_0x1757('0x5')]=0x0;this[_0x1757('0x6')]='';this[_0x1757('0x7')]=!![];this[_0x1757('0x8')]=_0x3aaab9['active'];this[_0x1757('0x9')]=_0x3aaab9['limitCalls'];this['dialTimezone']=_0x3aaab9[_0x1757('0xa')]||null;this[_0x1757('0xb')]=_0x3aaab9[_0x1757('0xb')]?_0x3aaab9['dialGlobalInterval']:null;this[_0x1757('0xc')]=_0x3aaab9[_0x1757('0xc')];this[_0x1757('0xd')]=_0x3aaab9[_0x1757('0xd')];this[_0x1757('0xe')]=_0x3aaab9['dialOriginateTimeout']||0x1e;this[_0x1757('0xf')]=_0x3aaab9[_0x1757('0xf')];this['dialCongestionRetryFrequency']=_0x3aaab9['dialCongestionRetryFrequency'];this[_0x1757('0x10')]=_0x3aaab9[_0x1757('0x10')];this[_0x1757('0x11')]=_0x3aaab9['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x3aaab9[_0x1757('0x12')];this[_0x1757('0x13')]=_0x3aaab9[_0x1757('0x13')];this[_0x1757('0x14')]=_0x3aaab9[_0x1757('0x14')];this['dialNoSuchNumberMaxRetry']=_0x3aaab9[_0x1757('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3aaab9['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x3aaab9[_0x1757('0x16')]||0x3;this[_0x1757('0x17')]=_0x3aaab9['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x3aaab9[_0x1757('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x3aaab9[_0x1757('0x19')]||0x96;this[_0x1757('0x1a')]=_0x3aaab9[_0x1757('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x3aaab9[_0x1757('0x1b')]||0x96;this[_0x1757('0x1c')]=_0x3aaab9[_0x1757('0x1c')]||0x3;this[_0x1757('0x1d')]=_0x3aaab9['dialAgentRejectRetryFrequency']||0x96;this[_0x1757('0x1e')]=_0x3aaab9[_0x1757('0x1e')]||_0x1757('0x1f');this[_0x1757('0x20')]=_0x3aaab9['dialPrefix']||undefined;this[_0x1757('0x21')]=_0x3aaab9[_0x1757('0x21')]||undefined;this[_0x1757('0x22')]=_0x3aaab9[_0x1757('0x22')]||undefined;this[_0x1757('0x23')]=_0x3aaab9[_0x1757('0x23')]?_0x3aaab9['TrunkBackup']:undefined;this[_0x1757('0x24')]=_0x3aaab9[_0x1757('0x24')]?_0x3aaab9[_0x1757('0x24')]:undefined;this[_0x1757('0x25')]=_0x3aaab9['Interval']?_0x3aaab9[_0x1757('0x25')]:undefined;this['SquareProject']=_0x3aaab9[_0x1757('0x26')]?_0x3aaab9[_0x1757('0x26')]:undefined;this['dialQueueProject']=_0x3aaab9['SquareProject']?_0x3aaab9[_0x1757('0x26')]['name']:undefined;this[_0x1757('0x27')]=_0x3aaab9[_0x1757('0x27')]||![];this['dialAMDInitialSilence']=_0x3aaab9[_0x1757('0x28')];this['dialAMDGreeting']=_0x3aaab9['dialAMDGreeting'];this[_0x1757('0x29')]=_0x3aaab9[_0x1757('0x29')];this[_0x1757('0x2a')]=_0x3aaab9['dialAMDTotalAnalysisTime'];this[_0x1757('0x2b')]=_0x3aaab9[_0x1757('0x2b')];this[_0x1757('0x2c')]=_0x3aaab9[_0x1757('0x2c')];this[_0x1757('0x2d')]=_0x3aaab9[_0x1757('0x2d')];this[_0x1757('0x2e')]=_0x3aaab9[_0x1757('0x2e')];this[_0x1757('0x2f')]=_0x3aaab9[_0x1757('0x2f')];}module['exports']=Campaign; \ No newline at end of file +var _0xb37c=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x34b1fe,_0x1dbd20){var _0x51caa2=function(_0x22f266){while(--_0x22f266){_0x34b1fe['push'](_0x34b1fe['shift']());}};_0x51caa2(++_0x1dbd20);}(_0xb37c,0x175));var _0xcb37=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb37c[_0x2b4411];return _0x8e41ef;};'use strict';function Campaign(_0x369769){this['id']=_0x369769['id']||0x0;this['name']=_0x369769[_0xcb37('0x0')]||'';this[_0xcb37('0x1')]=_0x369769[_0xcb37('0x1')]||_0xcb37('0x2');this[_0xcb37('0x3')]=0x0;this[_0xcb37('0x4')]=0x0;this[_0xcb37('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xcb37('0x6')]='';this[_0xcb37('0x7')]=!![];this[_0xcb37('0x8')]=_0x369769[_0xcb37('0x8')];this[_0xcb37('0x9')]=_0x369769[_0xcb37('0x9')];this[_0xcb37('0xa')]=_0x369769[_0xcb37('0xa')]||null;this['dialGlobalInterval']=_0x369769[_0xcb37('0xb')]?_0x369769['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x369769['dialOriginateCallerIdName'];this[_0xcb37('0xc')]=_0x369769[_0xcb37('0xc')];this['dialOriginateTimeout']=_0x369769[_0xcb37('0xd')]||0x1e;this[_0xcb37('0xe')]=_0x369769[_0xcb37('0xe')];this[_0xcb37('0xf')]=_0x369769['dialCongestionRetryFrequency'];this[_0xcb37('0x10')]=_0x369769[_0xcb37('0x10')];this[_0xcb37('0x11')]=_0x369769[_0xcb37('0x11')];this[_0xcb37('0x12')]=_0x369769[_0xcb37('0x12')];this[_0xcb37('0x13')]=_0x369769[_0xcb37('0x13')];this['dialGlobalMaxRetry']=_0x369769[_0xcb37('0x14')];this[_0xcb37('0x15')]=_0x369769['dialNoSuchNumberMaxRetry']||0x3;this[_0xcb37('0x16')]=_0x369769[_0xcb37('0x16')]||0x96;this[_0xcb37('0x17')]=_0x369769[_0xcb37('0x17')]||0x3;this[_0xcb37('0x18')]=_0x369769[_0xcb37('0x18')]||0x96;this[_0xcb37('0x19')]=_0x369769[_0xcb37('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x369769[_0xcb37('0x1a')]||0x96;this[_0xcb37('0x1b')]=_0x369769[_0xcb37('0x1b')]||0x3;this[_0xcb37('0x1c')]=_0x369769[_0xcb37('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x369769['dialAgentRejectMaxRetry']||0x3;this[_0xcb37('0x1d')]=_0x369769[_0xcb37('0x1d')]||0x96;this[_0xcb37('0x1e')]=_0x369769['dialOrderByScheduledAt']||_0xcb37('0x1f');this[_0xcb37('0x20')]=_0x369769['dialPrefix']||undefined;this[_0xcb37('0x21')]=_0x369769[_0xcb37('0x21')]||undefined;this[_0xcb37('0x22')]=_0x369769[_0xcb37('0x22')]||undefined;this['TrunkBackup']=_0x369769['TrunkBackup']?_0x369769['TrunkBackup']:undefined;this['Trunk']=_0x369769[_0xcb37('0x23')]?_0x369769['Trunk']:undefined;this[_0xcb37('0x24')]=_0x369769[_0xcb37('0x24')]?_0x369769[_0xcb37('0x24')]:undefined;this[_0xcb37('0x25')]=_0x369769[_0xcb37('0x25')]?_0x369769[_0xcb37('0x25')]:undefined;this[_0xcb37('0x26')]=_0x369769[_0xcb37('0x25')]?_0x369769[_0xcb37('0x25')][_0xcb37('0x0')]:undefined;this[_0xcb37('0x27')]=_0x369769[_0xcb37('0x27')]||![];this['dialAMDInitialSilence']=_0x369769[_0xcb37('0x28')];this['dialAMDGreeting']=_0x369769[_0xcb37('0x29')];this[_0xcb37('0x2a')]=_0x369769[_0xcb37('0x2a')];this[_0xcb37('0x2b')]=_0x369769['dialAMDTotalAnalysisTime'];this[_0xcb37('0x2c')]=_0x369769['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x369769['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x369769[_0xcb37('0x2d')];this[_0xcb37('0x2e')]=_0x369769[_0xcb37('0x2e')];this[_0xcb37('0x2f')]=_0x369769[_0xcb37('0x2f')];}module[_0xcb37('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6ee6fc9..3f0bda1 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 _0xa099=['connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','exports','calleridnum','calleridname','connectedlinenum'];(function(_0x4c1199,_0x132804){var _0x45cd21=function(_0x3bff77){while(--_0x3bff77){_0x4c1199['push'](_0x4c1199['shift']());}};_0x45cd21(++_0x132804);}(_0xa099,0x69));var _0x9a09=function(_0x5d1d89,_0x1f5e09){_0x5d1d89=_0x5d1d89-0x0;var _0x46f86c=_0xa099[_0x5d1d89];return _0x46f86c;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this['destinationchannel']='';this[_0x9a09('0x0')]=0x0;this[_0x9a09('0x1')]='';this[_0x9a09('0x2')]=undefined;this[_0x9a09('0x3')]=undefined;this[_0x9a09('0x4')]=0x0;this[_0x9a09('0x5')]='';this[_0x9a09('0x6')]=0x0;this['linkedid']=0x0;this[_0x9a09('0x7')]=0x0;this[_0x9a09('0x8')]=![];this[_0x9a09('0x9')]=null;this[_0x9a09('0xa')]=null;this[_0x9a09('0xb')]=![];this[_0x9a09('0xc')]=![];this[_0x9a09('0xd')]='';this[_0x9a09('0xe')]='';this[_0x9a09('0xf')]=0x0;this[_0x9a09('0x10')]=0x0;this['holdtime']=0x0;this[_0x9a09('0x11')]=null;this['tag']=null;this[_0x9a09('0x12')]=null;this[_0x9a09('0x13')]=![];this[_0x9a09('0x14')]=null;this[_0x9a09('0x15')]=null;this[_0x9a09('0x16')]=[];this[_0x9a09('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x9a09('0x18')]=undefined;this[_0x9a09('0x19')]=0x0;}module[_0x9a09('0x1a')]=Channel; \ No newline at end of file +var _0x8c7d=['accountcode','context','uniqueid','linkedid','exten','answered','unmanaged','abandoned','lastdata','holdtime','type','tag','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename'];(function(_0xe4c0d8,_0x37d245){var _0xe26e24=function(_0x1be860){while(--_0x1be860){_0xe4c0d8['push'](_0xe4c0d8['shift']());}};_0xe26e24(++_0x37d245);}(_0x8c7d,0xe1));var _0xd8c7=function(_0x16f524,_0x92e2df){_0x16f524=_0x16f524-0x0;var _0x33b24f=_0x8c7d[_0x16f524];return _0x33b24f;};'use strict';function Channel(){this[_0xd8c7('0x0')]=null;this['channel']='';this[_0xd8c7('0x1')]='';this['calleridnum']=0x0;this[_0xd8c7('0x2')]='';this[_0xd8c7('0x3')]=undefined;this[_0xd8c7('0x4')]=undefined;this[_0xd8c7('0x5')]=0x0;this[_0xd8c7('0x6')]='';this[_0xd8c7('0x7')]=0x0;this[_0xd8c7('0x8')]=0x0;this[_0xd8c7('0x9')]=0x0;this[_0xd8c7('0xa')]=![];this['answertime']=null;this['endtime']=null;this[_0xd8c7('0xb')]=![];this[_0xd8c7('0xc')]=![];this['lastapplication']='';this[_0xd8c7('0xd')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0xd8c7('0xe')]=0x0;this[_0xd8c7('0xf')]=null;this[_0xd8c7('0x10')]=null;this[_0xd8c7('0x11')]=null;this['monitor']=![];this[_0xd8c7('0x12')]=null;this['queue']=null;this[_0xd8c7('0x13')]=[];this[_0xd8c7('0x14')]=undefined;this[_0xd8c7('0x15')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xd8c7('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 1841e3d..b86d35c 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 _0x4048=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4048,0x1f0));var _0x8404=function(_0x23f2e1,_0x33d31b){_0x23f2e1=_0x23f2e1-0x0;var _0x25b446=_0x4048[_0x23f2e1];return _0x25b446;};'use strict';function DeskAccount(_0x21fc65){this['id']=_0x21fc65['id']||0x0;this[_0x8404('0x0')]=_0x21fc65[_0x8404('0x0')]||'';this[_0x8404('0x1')]=_0x21fc65[_0x8404('0x1')]||'';this[_0x8404('0x2')]=_0x21fc65[_0x8404('0x2')]||'';this[_0x8404('0x3')]=_0x21fc65['authType']||'';this[_0x8404('0x4')]=_0x21fc65['password']||'';this[_0x8404('0x5')]=_0x21fc65['consumerKey']||'';this[_0x8404('0x6')]=_0x21fc65[_0x8404('0x6')]||'';this['token']=_0x21fc65[_0x8404('0x7')]||'';this[_0x8404('0x8')]=_0x21fc65[_0x8404('0x8')]||'';this['type']=_0x21fc65[_0x8404('0x9')]||'';this[_0x8404('0xa')]=_0x21fc65[_0x8404('0xa')]||'';this['Configurations']=_0x21fc65[_0x8404('0xb')]||{};}module[_0x8404('0xc')]=DeskAccount; \ No newline at end of file +var _0xae04=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xae04,0x1e1));var _0x4ae0=function(_0x56ef0e,_0x5c1b73){_0x56ef0e=_0x56ef0e-0x0;var _0x22e164=_0xae04[_0x56ef0e];return _0x22e164;};'use strict';function DeskAccount(_0x94c1de){this['id']=_0x94c1de['id']||0x0;this[_0x4ae0('0x0')]=_0x94c1de[_0x4ae0('0x0')]||'';this[_0x4ae0('0x1')]=_0x94c1de['username']||'';this[_0x4ae0('0x2')]=_0x94c1de[_0x4ae0('0x2')]||'';this['authType']=_0x94c1de[_0x4ae0('0x3')]||'';this[_0x4ae0('0x4')]=_0x94c1de[_0x4ae0('0x4')]||'';this[_0x4ae0('0x5')]=_0x94c1de[_0x4ae0('0x5')]||'';this[_0x4ae0('0x6')]=_0x94c1de[_0x4ae0('0x6')]||'';this[_0x4ae0('0x7')]=_0x94c1de['token']||'';this[_0x4ae0('0x8')]=_0x94c1de[_0x4ae0('0x8')]||'';this[_0x4ae0('0x9')]=_0x94c1de[_0x4ae0('0x9')]||'';this[_0x4ae0('0xa')]=_0x94c1de[_0x4ae0('0xa')]||'';this[_0x4ae0('0xb')]=_0x94c1de[_0x4ae0('0xb')]||{};}module[_0x4ae0('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 27ad422..ea363cc 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 _0x13f6=['clientId','clientSecret','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x3ccec7,_0x42b95e){var _0x51b37e=function(_0x457d4f){while(--_0x457d4f){_0x3ccec7['push'](_0x3ccec7['shift']());}};_0x51b37e(++_0x42b95e);}(_0x13f6,0x124));var _0x613f=function(_0x176846,_0x4bc17c){_0x176846=_0x176846-0x0;var _0x1cff6b=_0x13f6[_0x176846];return _0x1cff6b;};'use strict';function Dynamics365Account(_0xf31e04){this['id']=_0xf31e04['id']||0x0;this[_0x613f('0x0')]=_0xf31e04['name']||'';this['username']=_0xf31e04[_0x613f('0x1')]||'';this[_0x613f('0x2')]=_0xf31e04[_0x613f('0x2')]||'';this['remoteUri']=_0xf31e04[_0x613f('0x3')]||'';this[_0x613f('0x4')]=_0xf31e04[_0x613f('0x4')]||'';this['clientId']=_0xf31e04[_0x613f('0x5')]||'';this[_0x613f('0x6')]=_0xf31e04['clientSecret']||{};this['serverUrl']=_0xf31e04['serverUrl']||'';this['Configurations']=_0xf31e04[_0x613f('0x7')]||{};}module[_0x613f('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x1339=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x1566fa,_0x3c7010){var _0x567569=function(_0x320410){while(--_0x320410){_0x1566fa['push'](_0x1566fa['shift']());}};_0x567569(++_0x3c7010);}(_0x1339,0x1ed));var _0x9133=function(_0x111269,_0x2871be){_0x111269=_0x111269-0x0;var _0x183196=_0x1339[_0x111269];return _0x183196;};'use strict';function Dynamics365Account(_0x421620){this['id']=_0x421620['id']||0x0;this['name']=_0x421620[_0x9133('0x0')]||'';this[_0x9133('0x1')]=_0x421620[_0x9133('0x1')]||'';this[_0x9133('0x2')]=_0x421620[_0x9133('0x2')]||'';this[_0x9133('0x3')]=_0x421620[_0x9133('0x3')]||'';this[_0x9133('0x4')]=_0x421620['tenantId']||'';this[_0x9133('0x5')]=_0x421620[_0x9133('0x5')]||'';this[_0x9133('0x6')]=_0x421620['clientSecret']||{};this[_0x9133('0x7')]=_0x421620[_0x9133('0x7')]||'';this[_0x9133('0x8')]=_0x421620[_0x9133('0x8')]||{};}module[_0x9133('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a58f062..4b9b274 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 _0x9ab6=['ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name'];(function(_0xf66b55,_0x20e56d){var _0x2ef557=function(_0x17f1a6){while(--_0x17f1a6){_0xf66b55['push'](_0xf66b55['shift']());}};_0x2ef557(++_0x20e56d);}(_0x9ab6,0x86));var _0x69ab=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x9ab6[_0x2be8c2];return _0x97f531;};'use strict';function FaxAccount(_0x50a168){this['id']=_0x50a168['id']||0x0;this[_0x69ab('0x0')]=_0x50a168[_0x69ab('0x0')]||'';this['description']=_0x50a168['description'];this[_0x69ab('0x1')]=_0x50a168['ecm'];this[_0x69ab('0x2')]=_0x50a168[_0x69ab('0x2')];this[_0x69ab('0x3')]=_0x50a168['localstationid'];this['minrate']=_0x50a168[_0x69ab('0x4')]||0x960;this[_0x69ab('0x5')]=_0x50a168['maxrate']||0x3840;this[_0x69ab('0x6')]=_0x50a168['modem']||'v17,v27,v29';this['gateway']=_0x50a168[_0x69ab('0x7')]||'no';this['faxdetect']=_0x50a168[_0x69ab('0x8')]||'no';this[_0x69ab('0x9')]=_0x50a168[_0x69ab('0x9')]||0x1388;this[_0x69ab('0xa')]=_0x50a168[_0x69ab('0xa')]||_0x69ab('0xb');this['Trunk']=_0x50a168[_0x69ab('0xc')]?_0x50a168[_0x69ab('0xc')]:undefined;this[_0x69ab('0xd')]=_0x50a168[_0x69ab('0xd')];this['key']=_0x50a168[_0x69ab('0xe')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xa962=['maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xa962,0xea));var _0x2a96=function(_0xed6261,_0x1f0ee2){_0xed6261=_0xed6261-0x0;var _0x4de7a5=_0xa962[_0xed6261];return _0x4de7a5;};'use strict';function FaxAccount(_0x49d30b){this['id']=_0x49d30b['id']||0x0;this[_0x2a96('0x0')]=_0x49d30b['name']||'';this[_0x2a96('0x1')]=_0x49d30b[_0x2a96('0x1')];this[_0x2a96('0x2')]=_0x49d30b[_0x2a96('0x2')];this['headerinfo']=_0x49d30b[_0x2a96('0x3')];this[_0x2a96('0x4')]=_0x49d30b[_0x2a96('0x4')];this['minrate']=_0x49d30b[_0x2a96('0x5')]||0x960;this[_0x2a96('0x6')]=_0x49d30b[_0x2a96('0x6')]||0x3840;this[_0x2a96('0x7')]=_0x49d30b[_0x2a96('0x7')]||'v17,v27,v29';this[_0x2a96('0x8')]=_0x49d30b[_0x2a96('0x8')]||'no';this[_0x2a96('0x9')]=_0x49d30b['faxdetect']||'no';this[_0x2a96('0xa')]=_0x49d30b['t38timeout']||0x1388;this[_0x2a96('0xb')]=_0x49d30b['tech']||'SIP';this[_0x2a96('0xc')]=_0x49d30b[_0x2a96('0xc')]?_0x49d30b['Trunk']:undefined;this[_0x2a96('0xd')]=_0x49d30b['ListId'];this[_0x2a96('0xe')]=_0x49d30b['key'];}module[_0x2a96('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 8112d64..9b6c76c 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 _0x7165=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x305bbf,_0x5647b3){var _0x4ed772=function(_0x3315ed){while(--_0x3315ed){_0x305bbf['push'](_0x305bbf['shift']());}};_0x4ed772(++_0x5647b3);}(_0x7165,0x154));var _0x5716=function(_0x15f47b,_0x30b781){_0x15f47b=_0x15f47b-0x0;var _0x1bf922=_0x7165[_0x15f47b];return _0x1bf922;};'use strict';function FreshdeskAccount(_0x107dde){this['id']=_0x107dde['id']||0x0;this[_0x5716('0x0')]=_0x107dde['name']||'';this[_0x5716('0x1')]=_0x107dde[_0x5716('0x1')]||'';this[_0x5716('0x2')]=_0x107dde[_0x5716('0x3')]||'';this[_0x5716('0x4')]=_0x107dde['remoteUri']||'';this[_0x5716('0x5')]=_0x107dde[_0x5716('0x5')]||'';this[_0x5716('0x6')]=_0x107dde[_0x5716('0x6')]||{};}module[_0x5716('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xf4ce=['name','username','token','remoteUri','Configurations','exports'];(function(_0xed0ca7,_0x300f49){var _0x32dfd2=function(_0x17df0a){while(--_0x17df0a){_0xed0ca7['push'](_0xed0ca7['shift']());}};_0x32dfd2(++_0x300f49);}(_0xf4ce,0x66));var _0xef4c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf4ce[_0x2dafbe];return _0x58a45a;};'use strict';function FreshdeskAccount(_0x5597e7){this['id']=_0x5597e7['id']||0x0;this['name']=_0x5597e7[_0xef4c('0x0')]||'';this[_0xef4c('0x1')]=_0x5597e7['username']||'';this['apiKey']=_0x5597e7[_0xef4c('0x2')]||'';this[_0xef4c('0x3')]=_0x5597e7[_0xef4c('0x3')]||'';this['serverUrl']=_0x5597e7['serverUrl']||'';this[_0xef4c('0x4')]=_0x5597e7[_0xef4c('0x4')]||{};}module[_0xef4c('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 0d52ac0..163bb59 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 _0xe4d6=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x583e60,_0x415c19){var _0x303850=function(_0x1003a0){while(--_0x1003a0){_0x583e60['push'](_0x583e60['shift']());}};_0x303850(++_0x415c19);}(_0xe4d6,0xd7));var _0x6e4d=function(_0x641e77,_0x49ca09){_0x641e77=_0x641e77-0x0;var _0x47dcd4=_0xe4d6[_0x641e77];return _0x47dcd4;};'use strict';function FreshsalesAccount(_0x32e1d9){this['id']=_0x32e1d9['id']||0x0;this[_0x6e4d('0x0')]=_0x32e1d9[_0x6e4d('0x0')]||'';this[_0x6e4d('0x1')]=_0x32e1d9['username']||'';this[_0x6e4d('0x2')]=_0x32e1d9[_0x6e4d('0x3')]||'';this[_0x6e4d('0x4')]=_0x32e1d9['remoteUri']||'';this['serverUrl']=_0x32e1d9[_0x6e4d('0x5')]||'';this['Configurations']=_0x32e1d9[_0x6e4d('0x6')]||{};}module[_0x6e4d('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x2975=['apiKey','token','serverUrl','Configurations','exports','name','username'];(function(_0x2326d8,_0x75fba0){var _0x2cd15d=function(_0x26b2c1){while(--_0x26b2c1){_0x2326d8['push'](_0x2326d8['shift']());}};_0x2cd15d(++_0x75fba0);}(_0x2975,0x1c5));var _0x5297=function(_0x28d3fc,_0x88901f){_0x28d3fc=_0x28d3fc-0x0;var _0x1ca6b0=_0x2975[_0x28d3fc];return _0x1ca6b0;};'use strict';function FreshsalesAccount(_0xda2e11){this['id']=_0xda2e11['id']||0x0;this[_0x5297('0x0')]=_0xda2e11[_0x5297('0x0')]||'';this[_0x5297('0x1')]=_0xda2e11[_0x5297('0x1')]||'';this[_0x5297('0x2')]=_0xda2e11[_0x5297('0x3')]||'';this['remoteUri']=_0xda2e11['remoteUri']||'';this['serverUrl']=_0xda2e11[_0x5297('0x4')]||'';this[_0x5297('0x5')]=_0xda2e11[_0x5297('0x5')]||{};}module[_0x5297('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 6226f80..8dff7ef 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 _0x30a6=['connectedlinename','exten','priority','assigned','motionChannel','voice','variables','type','inbound','calleridnum','calleridname','queuecallerjoinAt','position','count','queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','channel','connectedlinenum'];(function(_0x516bb4,_0x3b399e){var _0x5b3778=function(_0x542675){while(--_0x542675){_0x516bb4['push'](_0x516bb4['shift']());}};_0x5b3778(++_0x3b399e);}(_0x30a6,0x6b));var _0x630a=function(_0x5d65d2,_0x1ba711){_0x5d65d2=_0x5d65d2-0x0;var _0x8d8355=_0x30a6[_0x5d65d2];return _0x8d8355;};'use strict';function QueueReport(){this[_0x630a('0x0')]=_0x630a('0x1');this['uniqueid']='';this[_0x630a('0x2')]='';this[_0x630a('0x3')]='';this['queue']='';this[_0x630a('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x630a('0x5')]=0x1;this[_0x630a('0x6')]=0x1;this[_0x630a('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x630a('0x8')]=![];this['queuecallercompleteAt']=null;this[_0x630a('0x9')]=![];this[_0x630a('0xa')]=null;this['originalposition']=0x1;this[_0x630a('0xb')]='';this[_0x630a('0xc')]='';this[_0x630a('0xd')]='';this['accountcode']='';this['context']='';this[_0x630a('0xe')]='';this[_0x630a('0xf')]='';this['holdtime']=0x0;this[_0x630a('0x10')]=![];this['lastAssignedTo']='';this[_0x630a('0x11')]=_0x630a('0x12');this['mohtime']=0x0;this[_0x630a('0x13')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x7802=['originalposition','connectedlinename','accountcode','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt'];(function(_0xf0de92,_0x239c6d){var _0x5ba079=function(_0x19aa4c){while(--_0x19aa4c){_0xf0de92['push'](_0xf0de92['shift']());}};_0x5ba079(++_0x239c6d);}(_0x7802,0x164));var _0x2780=function(_0x4f51f2,_0x277484){_0x4f51f2=_0x4f51f2-0x0;var _0x1cfdf3=_0x7802[_0x4f51f2];return _0x1cfdf3;};'use strict';function QueueReport(){this[_0x2780('0x0')]=_0x2780('0x1');this[_0x2780('0x2')]='';this[_0x2780('0x3')]='';this['calleridname']='';this[_0x2780('0x4')]='';this[_0x2780('0x5')]=null;this[_0x2780('0x6')]=null;this['position']=0x1;this[_0x2780('0x7')]=0x1;this[_0x2780('0x8')]=![];this[_0x2780('0x9')]=null;this[_0x2780('0xa')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x2780('0xb')]=null;this[_0x2780('0xc')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x2780('0xd')]='';this[_0x2780('0xe')]='';this['context']='';this['exten']='';this[_0x2780('0xf')]='';this[_0x2780('0x10')]=0x0;this[_0x2780('0x11')]=![];this[_0x2780('0x12')]='';this[_0x2780('0x13')]=_0x2780('0x14');this[_0x2780('0x15')]=0x0;this[_0x2780('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 14c2dd4..af3e44e 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 _0x8de9=['remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x8de9,0x1e2));var _0x98de=function(_0x4b3349,_0x207271){_0x4b3349=_0x4b3349-0x0;var _0x3683af=_0x8de9[_0x4b3349];return _0x3683af;};'use strict';function SalesforceAccount(_0x4fd9de){this['id']=_0x4fd9de['id']||0x0;this[_0x98de('0x0')]=_0x4fd9de[_0x98de('0x0')]||'';this[_0x98de('0x1')]=_0x4fd9de['username']||'';this['remoteUri']=_0x4fd9de[_0x98de('0x2')]||'';this[_0x98de('0x3')]=_0x4fd9de['password']||'';this[_0x98de('0x4')]=_0x4fd9de[_0x98de('0x4')]||'';this[_0x98de('0x5')]=_0x4fd9de[_0x98de('0x5')]||'';this[_0x98de('0x6')]=_0x4fd9de[_0x98de('0x6')]||'';this[_0x98de('0x7')]=_0x4fd9de['type']||'integrationTab';this[_0x98de('0x8')]=_0x4fd9de[_0x98de('0x8')]||'';this[_0x98de('0x9')]=_0x4fd9de['Configurations']||{};}module[_0x98de('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x19b6=['securityToken','type','serverUrl','exports','name','username','remoteUri','password','clientId'];(function(_0x35a4a3,_0x282840){var _0x56c301=function(_0x64677c){while(--_0x64677c){_0x35a4a3['push'](_0x35a4a3['shift']());}};_0x56c301(++_0x282840);}(_0x19b6,0xa6));var _0x619b=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0x19b6[_0x1b76e6];return _0x333b53;};'use strict';function SalesforceAccount(_0x16e982){this['id']=_0x16e982['id']||0x0;this[_0x619b('0x0')]=_0x16e982[_0x619b('0x0')]||'';this[_0x619b('0x1')]=_0x16e982[_0x619b('0x1')]||'';this[_0x619b('0x2')]=_0x16e982[_0x619b('0x2')]||'';this[_0x619b('0x3')]=_0x16e982[_0x619b('0x3')]||'';this[_0x619b('0x4')]=_0x16e982[_0x619b('0x4')]||'';this['clientSecret']=_0x16e982['clientSecret']||'';this['securityToken']=_0x16e982[_0x619b('0x5')]||'';this[_0x619b('0x6')]=_0x16e982[_0x619b('0x6')]||'integrationTab';this[_0x619b('0x7')]=_0x16e982[_0x619b('0x7')]||'';this['Configurations']=_0x16e982['Configurations']||{};}module[_0x619b('0x8')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 1fabe8e..2d1e242 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 _0x655f=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x5ee3f1,_0xa74eed){var _0x30a362=function(_0x3d676b){while(--_0x3d676b){_0x5ee3f1['push'](_0x5ee3f1['shift']());}};_0x30a362(++_0xa74eed);}(_0x655f,0xbf));var _0xf655=function(_0xe11a29,_0x3a996f){_0xe11a29=_0xe11a29-0x0;var _0x478c43=_0x655f[_0xe11a29];return _0x478c43;};'use strict';function ServicenowAccount(_0x7f2405){this['id']=_0x7f2405['id']||0x0;this[_0xf655('0x0')]=_0x7f2405['name']||'';this[_0xf655('0x1')]=_0x7f2405[_0xf655('0x1')]||'';this[_0xf655('0x2')]=_0x7f2405['password']||'';this[_0xf655('0x3')]=_0x7f2405[_0xf655('0x3')]||'';this['serverUrl']=_0x7f2405[_0xf655('0x4')]||'';this[_0xf655('0x5')]=_0x7f2405[_0xf655('0x5')]||{};}module[_0xf655('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x25ab=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x2f3226,_0x4ffd12){var _0x4b1f29=function(_0x36cb0d){while(--_0x36cb0d){_0x2f3226['push'](_0x2f3226['shift']());}};_0x4b1f29(++_0x4ffd12);}(_0x25ab,0xe9));var _0xb25a=function(_0x512d07,_0x11dfa0){_0x512d07=_0x512d07-0x0;var _0x12a190=_0x25ab[_0x512d07];return _0x12a190;};'use strict';function ServicenowAccount(_0x30b8ee){this['id']=_0x30b8ee['id']||0x0;this[_0xb25a('0x0')]=_0x30b8ee[_0xb25a('0x0')]||'';this[_0xb25a('0x1')]=_0x30b8ee[_0xb25a('0x1')]||'';this[_0xb25a('0x2')]=_0x30b8ee['password']||'';this[_0xb25a('0x3')]=_0x30b8ee[_0xb25a('0x3')]||'';this[_0xb25a('0x4')]=_0x30b8ee['serverUrl']||'';this[_0xb25a('0x5')]=_0x30b8ee['Configurations']||{};}module[_0xb25a('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d27699d..8563b40 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 _0x0389=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x4dad38,_0x276c4f){var _0x297f5b=function(_0x5139d1){while(--_0x5139d1){_0x4dad38['push'](_0x4dad38['shift']());}};_0x297f5b(++_0x276c4f);}(_0x0389,0x175));var _0x9038=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x0389[_0x588011];return _0x3b3773;};'use strict';function SugarcrmAccount(_0x3271ab){this['id']=_0x3271ab['id']||0x0;this['name']=_0x3271ab[_0x9038('0x0')]||'';this[_0x9038('0x1')]=_0x3271ab[_0x9038('0x1')]||'';this[_0x9038('0x2')]=_0x3271ab[_0x9038('0x2')]||'';this[_0x9038('0x3')]=_0x3271ab[_0x9038('0x3')]||'';this['serverUrl']=_0x3271ab[_0x9038('0x4')]||'';this[_0x9038('0x5')]=_0x3271ab[_0x9038('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xa8a9=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xa8a9,0x185));var _0x9a8a=function(_0x1abb91,_0x567600){_0x1abb91=_0x1abb91-0x0;var _0x50e563=_0xa8a9[_0x1abb91];return _0x50e563;};'use strict';function SugarcrmAccount(_0x115b57){this['id']=_0x115b57['id']||0x0;this['name']=_0x115b57[_0x9a8a('0x0')]||'';this[_0x9a8a('0x1')]=_0x115b57['username']||'';this[_0x9a8a('0x2')]=_0x115b57[_0x9a8a('0x2')]||'';this['remoteUri']=_0x115b57[_0x9a8a('0x3')]||'';this[_0x9a8a('0x4')]=_0x115b57[_0x9a8a('0x4')]||'';this['Configurations']=_0x115b57[_0x9a8a('0x5')]||{};}module[_0x9a8a('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 96e250d..0cdcde5 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 _0x0d9e=['status','exports','name','accountcode','unknown','stateTime'];(function(_0x47f6e7,_0x2ef61e){var _0x1a9ac1=function(_0x182973){while(--_0x182973){_0x47f6e7['push'](_0x47f6e7['shift']());}};_0x1a9ac1(++_0x2ef61e);}(_0x0d9e,0x14c));var _0xe0d9=function(_0x3b3c20,_0x4610ad){_0x3b3c20=_0x3b3c20-0x0;var _0x579346=_0x0d9e[_0x3b3c20];return _0x579346;};'use strict';function Telephone(_0xafa1ec){this['id']=_0xafa1ec['id']||0x0;this[_0xe0d9('0x0')]=_0xafa1ec[_0xe0d9('0x0')]||'';this[_0xe0d9('0x1')]=_0xafa1ec[_0xe0d9('0x1')]||'';this['state']=_0xe0d9('0x2');this[_0xe0d9('0x3')]=0x0;this[_0xe0d9('0x4')]='unknown';this['address']='';}module[_0xe0d9('0x5')]=Telephone; \ No newline at end of file +var _0x00d0=['exports','name','accountcode','stateTime','status','address'];(function(_0x430727,_0x362183){var _0x361f1b=function(_0xa3a979){while(--_0xa3a979){_0x430727['push'](_0x430727['shift']());}};_0x361f1b(++_0x362183);}(_0x00d0,0x163));var _0x000d=function(_0x3d5e9e,_0x384c41){_0x3d5e9e=_0x3d5e9e-0x0;var _0x57b336=_0x00d0[_0x3d5e9e];return _0x57b336;};'use strict';function Telephone(_0x44ab67){this['id']=_0x44ab67['id']||0x0;this[_0x000d('0x0')]=_0x44ab67['name']||'';this[_0x000d('0x1')]=_0x44ab67[_0x000d('0x1')]||'';this['state']='unknown';this[_0x000d('0x2')]=0x0;this[_0x000d('0x3')]='unknown';this[_0x000d('0x4')]='';}module[_0x000d('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 13db7c2..e5d2b9a 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(_0x2ce6a2,_0x44aa86){var _0x36b635=function(_0x37f43e){while(--_0x37f43e){_0x2ce6a2['push'](_0x2ce6a2['shift']());}};_0x36b635(++_0x44aa86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x4b5172,_0x50e130){var _0x2256dd=function(_0x259467){while(--_0x259467){_0x4b5172['push'](_0x4b5172['shift']());}};_0x2256dd(++_0x50e130);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index d0b6cf0..557cc78 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'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 +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x446841,_0x13bbc1){var _0x227a52=function(_0x467200){while(--_0x467200){_0x446841['push'](_0x446841['shift']());}};_0x227a52(++_0x13bbc1);}(_0x2032,0xd9));var _0x2203=function(_0x36e866,_0x438f9e){_0x36e866=_0x36e866-0x0;var _0x3c7d21=_0x2032[_0x36e866];return _0x3c7d21;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 9828d73..9bbbb89 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 _0x5ef9=['host','domain','refresh','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','registry','indexOf','split'];(function(_0x4e1ce5,_0x285ce8){var _0x42b11a=function(_0x515020){while(--_0x515020){_0x4e1ce5['push'](_0x4e1ce5['shift']());}};_0x42b11a(++_0x285ce8);}(_0x5ef9,0xf4));var _0x95ef=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x5ef9[_0x1ebe90];return _0x447c82;};'use strict';function Trunk(_0x1bcad2){this['id']=_0x1bcad2['id']||0x0;this[_0x95ef('0x0')]=_0x1bcad2['active']||![];this[_0x95ef('0x1')]=_0x1bcad2[_0x95ef('0x1')]||'';this[_0x95ef('0x2')]=_0x95ef('0x3');this[_0x95ef('0x4')]=0x0;this['status']=_0x95ef('0x3');this[_0x95ef('0x5')]=_0x1bcad2[_0x95ef('0x5')]&&_0x1bcad2[_0x95ef('0x5')][_0x95ef('0x6')](':')?_0x1bcad2[_0x95ef('0x5')][_0x95ef('0x7')](':')[0x0]:'';this[_0x95ef('0x8')]='';this['port']='';this[_0x95ef('0x9')]='';this['domainport']='';this[_0x95ef('0xa')]='';this['stateRegistry']=_0x95ef('0x3');this[_0x95ef('0xb')]='';this[_0x95ef('0xc')]='';this[_0x95ef('0xd')]=_0x1bcad2[_0x95ef('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xb29e=['port','domain','domainport','refresh','address','defaultuser','exports','active','name','state','unknown','registry','split','host'];(function(_0x2135fc,_0xd0f39e){var _0x5affe4=function(_0x322d8c){while(--_0x322d8c){_0x2135fc['push'](_0x2135fc['shift']());}};_0x5affe4(++_0xd0f39e);}(_0xb29e,0x173));var _0xeb29=function(_0x3a887d,_0x439f75){_0x3a887d=_0x3a887d-0x0;var _0x280152=_0xb29e[_0x3a887d];return _0x280152;};'use strict';function Trunk(_0x13ed66){this['id']=_0x13ed66['id']||0x0;this[_0xeb29('0x0')]=_0x13ed66[_0xeb29('0x0')]||![];this[_0xeb29('0x1')]=_0x13ed66[_0xeb29('0x1')]||'';this[_0xeb29('0x2')]=_0xeb29('0x3');this['stateTime']=0x0;this['status']=_0xeb29('0x3');this[_0xeb29('0x4')]=_0x13ed66[_0xeb29('0x4')]&&_0x13ed66[_0xeb29('0x4')]['indexOf'](':')?_0x13ed66[_0xeb29('0x4')][_0xeb29('0x5')](':')[0x0]:'';this[_0xeb29('0x6')]='';this[_0xeb29('0x7')]='';this[_0xeb29('0x8')]='';this[_0xeb29('0x9')]='';this[_0xeb29('0xa')]='';this['stateRegistry']='unknown';this['registrationtime']='';this[_0xeb29('0xb')]='';this[_0xeb29('0xc')]=_0x13ed66[_0xeb29('0xc')]||'';}module[_0xeb29('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8f57b26..d6eb98a 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 _0xbed7=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x1efc1c,_0x1df4b0){var _0x4a9060=function(_0x264ac8){while(--_0x264ac8){_0x1efc1c['push'](_0x1efc1c['shift']());}};_0x4a9060(++_0x1df4b0);}(_0xbed7,0x1a3));var _0x7bed=function(_0x516601,_0x4d4f86){_0x516601=_0x516601-0x0;var _0x58f970=_0xbed7[_0x516601];return _0x58f970;};'use strict';function voiceExtension(_0x4432d2){this['id']=_0x4432d2['id']||0x0;this[_0x7bed('0x0')]=_0x4432d2[_0x7bed('0x0')]||'';this[_0x7bed('0x1')]=_0x4432d2[_0x7bed('0x1')]||_0x7bed('0x2');this[_0x7bed('0x3')]=_0x4432d2[_0x7bed('0x3')]||![];}module[_0x7bed('0x4')]=voiceExtension; \ No newline at end of file +var _0x4815=['mandatoryDisposition','exports','none'];(function(_0x190214,_0x72ea0f){var _0x117bff=function(_0x5c478a){while(--_0x5c478a){_0x190214['push'](_0x190214['shift']());}};_0x117bff(++_0x72ea0f);}(_0x4815,0x104));var _0x5481=function(_0x4cddb7,_0x380bd6){_0x4cddb7=_0x4cddb7-0x0;var _0xf5cf=_0x4815[_0x4cddb7];return _0xf5cf;};'use strict';function voiceExtension(_0x2e9167){this['id']=_0x2e9167['id']||0x0;this['exten']=_0x2e9167['exten']||'';this['recordingFormat']=_0x2e9167['recordingFormat']||_0x5481('0x0');this['mandatoryDisposition']=_0x2e9167[_0x5481('0x1')]||![];}module[_0x5481('0x2')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index d3b2a9e..64d39f3 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 _0x28b2=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','acw','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval'];(function(_0x331c90,_0x220679){var _0x3a3b28=function(_0x33eef1){while(--_0x33eef1){_0x331c90['push'](_0x331c90['shift']());}};_0x3a3b28(++_0x220679);}(_0x28b2,0xb8));var _0x228b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x28b2[_0x4a9fb1];return _0x348672;};'use strict';var statusDesc=[_0x228b('0x0'),_0x228b('0x1'),_0x228b('0x2'),'busy',_0x228b('0x3'),_0x228b('0x4'),_0x228b('0x5'),_0x228b('0x6'),_0x228b('0x7')];var monitorFormat={'wav':_0x228b('0x8'),'wav49':_0x228b('0x9'),'gsm':_0x228b('0xa')};var strategy={'rrmemory':_0x228b('0xb'),'roundrobin':_0x228b('0xc')};function VoiceQueue(_0x5e8e9a){this['id']=_0x5e8e9a['id']||0x0;this['name']=_0x5e8e9a[_0x228b('0xd')]||'';this[_0x228b('0xe')]=_0x5e8e9a['monitor_format']||'';this['type']=_0x5e8e9a[_0x228b('0xf')]||'inbound';this[_0x228b('0x10')]=0x0;this['talking']=0x0;this[_0x228b('0x11')]=0x0;this[_0x228b('0x12')]=0x0;this[_0x228b('0x13')]=0x0;this[_0x228b('0x14')]=0x0;this[_0x228b('0x15')]=0x0;this['unmanaged']=0x0;this[_0x228b('0x16')]=0x0;this['loggedIn']=0x0;this[_0x228b('0x17')]=0x0;this[_0x228b('0x18')]=_0x5e8e9a[_0x228b('0x18')]||![];this['acwTimeout']=_0x5e8e9a['acwTimeout']||0xa;this[_0x228b('0x19')]=_0x5e8e9a['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x228b('0x1a')]='';this[_0x228b('0x1b')]=0x0;this['temp']=0x0;this[_0x228b('0x1c')]=_0x5e8e9a[_0x228b('0x1c')]||null;this[_0x228b('0x1d')]=_0x5e8e9a[_0x228b('0x1d')]?_0x5e8e9a['dialGlobalInterval']:null;this[_0x228b('0x1e')]=_0x5e8e9a['dialActive'];this['dialMethod']=_0x5e8e9a['dialMethod']||'progressive';this['dialLimitChannel']=_0x5e8e9a[_0x228b('0x1f')]||0x0;this[_0x228b('0x20')]=_0x5e8e9a[_0x228b('0x20')]||0x0;this[_0x228b('0x21')]=_0x5e8e9a[_0x228b('0x21')]||0x1;this[_0x228b('0x22')]=_0x5e8e9a['dialPredictiveOptimization']||_0x228b('0x23');this[_0x228b('0x24')]=_0x5e8e9a[_0x228b('0x24')]||0.03;this[_0x228b('0x25')]=_0x5e8e9a[_0x228b('0x25')]||0x258;this[_0x228b('0x26')]=_0x5e8e9a[_0x228b('0x26')]||'anonymous';this[_0x228b('0x27')]=_0x5e8e9a[_0x228b('0x27')]||'anonymous';this[_0x228b('0x28')]=_0x5e8e9a['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x5e8e9a[_0x228b('0x29')]||_0x228b('0x2a');this[_0x228b('0x2b')]=_0x5e8e9a[_0x228b('0x2b')]||0x3;this[_0x228b('0x2c')]=_0x5e8e9a[_0x228b('0x2c')]||undefined;this['dialCongestionMaxRetry']=_0x5e8e9a[_0x228b('0x2d')]||0x3;this[_0x228b('0x2e')]=_0x5e8e9a['dialCongestionRetryFrequency']||0x96;this[_0x228b('0x2f')]=_0x5e8e9a[_0x228b('0x2f')]||0x3;this[_0x228b('0x30')]=_0x5e8e9a[_0x228b('0x30')]||0x96;this[_0x228b('0x31')]=_0x5e8e9a[_0x228b('0x31')]||0x3;this[_0x228b('0x32')]=_0x5e8e9a[_0x228b('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x5e8e9a[_0x228b('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5e8e9a['dialNoSuchNumberRetryFrequency']||0x96;this[_0x228b('0x34')]=_0x5e8e9a[_0x228b('0x34')]||0x3;this['dialDropRetryFrequency']=_0x5e8e9a[_0x228b('0x35')]||0x96;this[_0x228b('0x36')]=_0x5e8e9a[_0x228b('0x36')]||0x3;this[_0x228b('0x37')]=_0x5e8e9a[_0x228b('0x37')]||0x96;this[_0x228b('0x38')]=_0x5e8e9a['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x5e8e9a[_0x228b('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x5e8e9a[_0x228b('0x3a')]||0x3;this[_0x228b('0x3b')]=_0x5e8e9a[_0x228b('0x3b')]||0x96;this[_0x228b('0x3c')]=_0x5e8e9a[_0x228b('0x3c')]||0x4;this['Trunk']=_0x5e8e9a['Trunk']?_0x5e8e9a[_0x228b('0x3d')]:undefined;this[_0x228b('0x3e')]=_0x5e8e9a[_0x228b('0x3e')]?_0x5e8e9a['TrunkBackup']:undefined;this[_0x228b('0x3f')]=_0x5e8e9a[_0x228b('0x3f')]||undefined;this['Interval']=_0x5e8e9a[_0x228b('0x40')]?_0x5e8e9a['Interval']:undefined;this[_0x228b('0x41')]=_0x5e8e9a[_0x228b('0x41')]||_0x228b('0x42');this['dialRandomLastDigitCallerIdNumber']=_0x5e8e9a[_0x228b('0x43')]||undefined;this['dialCutDigit']=_0x5e8e9a['dialCutDigit']||undefined;this['strategy']=strategy[_0x5e8e9a['strategy']]||_0x228b('0xb');this[_0x228b('0x44')]=!![];this[_0x228b('0x45')]=_0x5e8e9a[_0x228b('0x45')]||![];this[_0x228b('0x46')]=_0x5e8e9a['dialAMDInitialSilence'];this[_0x228b('0x47')]=_0x5e8e9a[_0x228b('0x47')];this['dialAMDAfterGreetingSilence']=_0x5e8e9a['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x5e8e9a[_0x228b('0x48')];this[_0x228b('0x49')]=_0x5e8e9a[_0x228b('0x49')];this[_0x228b('0x4a')]=_0x5e8e9a[_0x228b('0x4a')];this[_0x228b('0x4b')]=_0x5e8e9a[_0x228b('0x4b')];this[_0x228b('0x4c')]=_0x5e8e9a[_0x228b('0x4c')];this[_0x228b('0x4d')]=_0x5e8e9a[_0x228b('0x4d')];this[_0x228b('0x4e')]=0x0;this[_0x228b('0x4f')]=0x0;this[_0x228b('0x50')]=_0x5e8e9a['timeout'];this[_0x228b('0x51')]=0x0;this[_0x228b('0x52')]=0x0;this[_0x228b('0x53')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x228b('0x54')]=0x0;this[_0x228b('0x55')]=0x0;this[_0x228b('0x56')]=0x0;this[_0x228b('0x57')]=0x0;this[_0x228b('0x58')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x228b('0x59')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x228b('0x5a')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x228b('0x5b')]=undefined;this[_0x228b('0x5c')]=undefined;this[_0x228b('0x5d')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x228b('0x5e')]=0x0;this[_0x228b('0x5f')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x228b('0x60')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x228b('0x61')]=_0x5e8e9a['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x228b('0x62')]=_0x5e8e9a['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x228b('0x63')]=0x0;this[_0x228b('0x64')]=0x1;this[_0x228b('0x65')]=0x0;this[_0x228b('0x66')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x228b('0x67')]=0x0;this[_0x228b('0x68')]=_0x5e8e9a['dialRecallMeTimeout']||0x1e;this[_0x228b('0x69')]=_0x5e8e9a[_0x228b('0x69')]||![];this['dialQueueProject2']=_0x5e8e9a[_0x228b('0x6a')]||undefined;this['dialAgiAfterHangupClient']=_0x5e8e9a[_0x228b('0x6b')]||![];this[_0x228b('0x6c')]=_0x5e8e9a[_0x228b('0x6c')]||![];this[_0x228b('0xe')]=monitorFormat[_0x5e8e9a[_0x228b('0xe')]]?monitorFormat[_0x5e8e9a[_0x228b('0xe')]]:undefined;this[_0x228b('0x6d')]=_0x5e8e9a[_0x228b('0x6d')]||![];this[_0x228b('0x6e')]=_0x5e8e9a[_0x228b('0x6e')]?_0x5e8e9a['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xd5fc=['Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','roundrobin','monitor_format','type','inbound','talking','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry'];(function(_0x388781,_0x29fca6){var _0x47f362=function(_0x3098b0){while(--_0x3098b0){_0x388781['push'](_0x388781['shift']());}};_0x47f362(++_0x29fca6);}(_0xd5fc,0xae));var _0xcd5f=function(_0x4c9578,_0x1d5c78){_0x4c9578=_0x4c9578-0x0;var _0x4e2730=_0xd5fc[_0x4c9578];return _0x4e2730;};'use strict';var statusDesc=[_0xcd5f('0x0'),'not_inuse','inuse','busy',_0xcd5f('0x1'),_0xcd5f('0x2'),_0xcd5f('0x3'),_0xcd5f('0x4'),_0xcd5f('0x5')];var monitorFormat={'wav':_0xcd5f('0x6'),'wav49':'wav49','gsm':_0xcd5f('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xcd5f('0x8')};function VoiceQueue(_0x159b3f){this['id']=_0x159b3f['id']||0x0;this['name']=_0x159b3f['name']||'';this['monitor_format']=_0x159b3f[_0xcd5f('0x9')]||'';this['type']=_0x159b3f[_0xcd5f('0xa')]||_0xcd5f('0xb');this['waiting']=0x0;this[_0xcd5f('0xc')]=0x0;this['total']=0x0;this[_0xcd5f('0xd')]=0x0;this['sumDuration']=0x0;this[_0xcd5f('0xe')]=0x0;this[_0xcd5f('0xf')]=0x0;this[_0xcd5f('0x10')]=0x0;this[_0xcd5f('0x11')]=0x0;this['loggedIn']=0x0;this[_0xcd5f('0x12')]=0x0;this[_0xcd5f('0x13')]=_0x159b3f['acw']||![];this[_0xcd5f('0x14')]=_0x159b3f[_0xcd5f('0x14')]||0xa;this[_0xcd5f('0x15')]=_0x159b3f[_0xcd5f('0x15')]||'no';this[_0xcd5f('0x16')]=!![];this['message']='';this[_0xcd5f('0x17')]=0x0;this[_0xcd5f('0x18')]=0x0;this[_0xcd5f('0x19')]=_0x159b3f[_0xcd5f('0x19')]||null;this[_0xcd5f('0x1a')]=_0x159b3f[_0xcd5f('0x1a')]?_0x159b3f[_0xcd5f('0x1a')]:null;this['dialActive']=_0x159b3f[_0xcd5f('0x1b')];this[_0xcd5f('0x1c')]=_0x159b3f[_0xcd5f('0x1c')]||_0xcd5f('0x1d');this['dialLimitChannel']=_0x159b3f[_0xcd5f('0x1e')]||0x0;this['dialLimitQueue']=_0x159b3f[_0xcd5f('0x1f')]||0x0;this[_0xcd5f('0x20')]=_0x159b3f['dialPowerLevel']||0x1;this[_0xcd5f('0x21')]=_0x159b3f[_0xcd5f('0x21')]||'dropRate';this[_0xcd5f('0x22')]=_0x159b3f['dialPredictiveOptimizationPercentage']||0.03;this[_0xcd5f('0x23')]=_0x159b3f['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x159b3f[_0xcd5f('0x24')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x159b3f['dialOriginateCallerIdNumber']||_0xcd5f('0x25');this['dialOriginateTimeout']=_0x159b3f[_0xcd5f('0x26')]||0x1e;this[_0xcd5f('0x27')]=_0x159b3f[_0xcd5f('0x27')]||_0xcd5f('0x28');this[_0xcd5f('0x29')]=_0x159b3f['dialQueueTimeout']||0x3;this[_0xcd5f('0x2a')]=_0x159b3f[_0xcd5f('0x2a')]||undefined;this[_0xcd5f('0x2b')]=_0x159b3f[_0xcd5f('0x2b')]||0x3;this[_0xcd5f('0x2c')]=_0x159b3f[_0xcd5f('0x2c')]||0x96;this[_0xcd5f('0x2d')]=_0x159b3f[_0xcd5f('0x2d')]||0x3;this[_0xcd5f('0x2e')]=_0x159b3f[_0xcd5f('0x2e')]||0x96;this[_0xcd5f('0x2f')]=_0x159b3f[_0xcd5f('0x2f')]||0x3;this[_0xcd5f('0x30')]=_0x159b3f[_0xcd5f('0x30')]||0x96;this[_0xcd5f('0x31')]=_0x159b3f[_0xcd5f('0x31')]||0x3;this[_0xcd5f('0x32')]=_0x159b3f['dialNoSuchNumberRetryFrequency']||0x96;this[_0xcd5f('0x33')]=_0x159b3f[_0xcd5f('0x33')]||0x3;this['dialDropRetryFrequency']=_0x159b3f[_0xcd5f('0x34')]||0x96;this['dialAbandonedMaxRetry']=_0x159b3f[_0xcd5f('0x35')]||0x3;this[_0xcd5f('0x36')]=_0x159b3f[_0xcd5f('0x36')]||0x96;this[_0xcd5f('0x37')]=_0x159b3f[_0xcd5f('0x37')]||0x3;this[_0xcd5f('0x38')]=_0x159b3f['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x159b3f[_0xcd5f('0x39')]||0x3;this[_0xcd5f('0x3a')]=_0x159b3f[_0xcd5f('0x3a')]||0x96;this[_0xcd5f('0x3b')]=_0x159b3f[_0xcd5f('0x3b')]||0x4;this[_0xcd5f('0x3c')]=_0x159b3f[_0xcd5f('0x3c')]?_0x159b3f['Trunk']:undefined;this[_0xcd5f('0x3d')]=_0x159b3f[_0xcd5f('0x3d')]?_0x159b3f[_0xcd5f('0x3d')]:undefined;this[_0xcd5f('0x3e')]=_0x159b3f['dialPrefix']||undefined;this[_0xcd5f('0x3f')]=_0x159b3f[_0xcd5f('0x3f')]?_0x159b3f[_0xcd5f('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x159b3f[_0xcd5f('0x40')]||_0xcd5f('0x41');this[_0xcd5f('0x42')]=_0x159b3f[_0xcd5f('0x42')]||undefined;this[_0xcd5f('0x43')]=_0x159b3f[_0xcd5f('0x43')]||undefined;this[_0xcd5f('0x44')]=strategy[_0x159b3f[_0xcd5f('0x44')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0xcd5f('0x45')]=_0x159b3f['dialAMDActive']||![];this[_0xcd5f('0x46')]=_0x159b3f[_0xcd5f('0x46')];this[_0xcd5f('0x47')]=_0x159b3f['dialAMDGreeting'];this[_0xcd5f('0x48')]=_0x159b3f[_0xcd5f('0x48')];this[_0xcd5f('0x49')]=_0x159b3f[_0xcd5f('0x49')];this['dialAMDMinWordLength']=_0x159b3f[_0xcd5f('0x4a')];this['dialAMDBetweenWordsSilence']=_0x159b3f[_0xcd5f('0x4b')];this[_0xcd5f('0x4c')]=_0x159b3f[_0xcd5f('0x4c')];this[_0xcd5f('0x4d')]=_0x159b3f[_0xcd5f('0x4d')];this[_0xcd5f('0x4e')]=_0x159b3f['dialAMDMaximumWordLength'];this[_0xcd5f('0x4f')]=0x0;this['pTalking']=0x0;this[_0xcd5f('0x50')]=_0x159b3f[_0xcd5f('0x50')];this[_0xcd5f('0x51')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xcd5f('0x52')]=0x0;this[_0xcd5f('0x53')]=0x0;this[_0xcd5f('0x54')]=0x0;this[_0xcd5f('0x55')]=0x0;this[_0xcd5f('0x56')]=0x0;this[_0xcd5f('0x57')]=0x0;this[_0xcd5f('0x58')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xcd5f('0x59')]=0x0;this[_0xcd5f('0x5a')]=0x0;this[_0xcd5f('0x5b')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xcd5f('0x5c')]=undefined;this['handlePredictive']=undefined;this[_0xcd5f('0x5d')]=1.05;this[_0xcd5f('0x5e')]=0x0;this[_0xcd5f('0x5f')]=0x0;this[_0xcd5f('0x60')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xcd5f('0x61')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xcd5f('0x62')]=0x0;this[_0xcd5f('0x63')]=0x0;this[_0xcd5f('0x64')]=_0x159b3f['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xcd5f('0x65')]=_0x159b3f[_0xcd5f('0x66')]||0xa;this[_0xcd5f('0x67')]=0x0;this[_0xcd5f('0x68')]=0x0;this[_0xcd5f('0x69')]=0x1;this[_0xcd5f('0x6a')]=0x0;this[_0xcd5f('0x6b')]=0x0;this[_0xcd5f('0x6c')]=0x0;this[_0xcd5f('0x6d')]=0x0;this[_0xcd5f('0x6e')]=_0x159b3f['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x159b3f[_0xcd5f('0x6f')]||![];this[_0xcd5f('0x70')]=_0x159b3f[_0xcd5f('0x70')]||undefined;this[_0xcd5f('0x71')]=_0x159b3f['dialAgiAfterHangupClient']||![];this[_0xcd5f('0x72')]=_0x159b3f['dialAgiAfterHangupAgent']||![];this[_0xcd5f('0x9')]=monitorFormat[_0x159b3f[_0xcd5f('0x9')]]?monitorFormat[_0x159b3f[_0xcd5f('0x9')]]:undefined;this['mandatoryDisposition']=_0x159b3f['mandatoryDisposition']||![];this[_0xcd5f('0x73')]=_0x159b3f[_0xcd5f('0x73')]?_0x159b3f[_0xcd5f('0x73')]:undefined;}module[_0xcd5f('0x74')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index cbf9a05..31fd77c 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 _0xa6ed=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x3b6deb,_0x2c6252){var _0x5ed15b=function(_0x1ad275){while(--_0x1ad275){_0x3b6deb['push'](_0x3b6deb['shift']());}};_0x5ed15b(++_0x2c6252);}(_0xa6ed,0x17e));var _0xda6e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa6ed[_0x126558];return _0x1f6d14;};'use strict';function VtigerAccount(_0x4e01b0){this['id']=_0x4e01b0['id']||0x0;this[_0xda6e('0x0')]=_0x4e01b0[_0xda6e('0x0')]||'';this[_0xda6e('0x1')]=_0x4e01b0['username']||'';this[_0xda6e('0x2')]=_0x4e01b0[_0xda6e('0x2')]||'';this[_0xda6e('0x3')]=_0x4e01b0[_0xda6e('0x3')]||'';this[_0xda6e('0x4')]=_0x4e01b0[_0xda6e('0x4')]||'';this[_0xda6e('0x5')]=_0x4e01b0['Configurations']||{};}module[_0xda6e('0x6')]=VtigerAccount; \ No newline at end of file +var _0x2a9a=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x484fb4,_0x55e308){var _0x33c0e4=function(_0xdf71d6){while(--_0xdf71d6){_0x484fb4['push'](_0x484fb4['shift']());}};_0x33c0e4(++_0x55e308);}(_0x2a9a,0x12d));var _0xa2a9=function(_0x3a781d,_0x2d75b4){_0x3a781d=_0x3a781d-0x0;var _0x51d76d=_0x2a9a[_0x3a781d];return _0x51d76d;};'use strict';function VtigerAccount(_0x33b92e){this['id']=_0x33b92e['id']||0x0;this[_0xa2a9('0x0')]=_0x33b92e[_0xa2a9('0x0')]||'';this[_0xa2a9('0x1')]=_0x33b92e[_0xa2a9('0x1')]||'';this[_0xa2a9('0x2')]=_0x33b92e['accessKey']||'';this[_0xa2a9('0x3')]=_0x33b92e[_0xa2a9('0x3')]||'';this[_0xa2a9('0x4')]=_0x33b92e[_0xa2a9('0x4')]||'';this[_0xa2a9('0x5')]=_0x33b92e[_0xa2a9('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index ba19ec4..f40f053 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 _0x9447=['Configurations','name','username','password','token','remoteUri','authType','serverUrl'];(function(_0x8084d2,_0x43d8df){var _0x486ab4=function(_0x1d7147){while(--_0x1d7147){_0x8084d2['push'](_0x8084d2['shift']());}};_0x486ab4(++_0x43d8df);}(_0x9447,0x81));var _0x7944=function(_0x32d415,_0x22a0bd){_0x32d415=_0x32d415-0x0;var _0x41796a=_0x9447[_0x32d415];return _0x41796a;};'use strict';function ZendeskAccount(_0x158942){this['id']=_0x158942['id']||0x0;this[_0x7944('0x0')]=_0x158942[_0x7944('0x0')]||'';this[_0x7944('0x1')]=_0x158942[_0x7944('0x1')]||'';this[_0x7944('0x2')]=_0x158942[_0x7944('0x2')]||'';this[_0x7944('0x3')]=_0x158942[_0x7944('0x3')]||'';this[_0x7944('0x4')]=_0x158942[_0x7944('0x4')]||'';this['authType']=_0x158942[_0x7944('0x5')]||'';this['type']=_0x158942['type']||'integrationTab';this['serverUrl']=_0x158942[_0x7944('0x6')]||'';this[_0x7944('0x7')]=_0x158942['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x1d43=['authType','type','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x349bb4,_0x2fab61){var _0x1311c2=function(_0x54fb9a){while(--_0x54fb9a){_0x349bb4['push'](_0x349bb4['shift']());}};_0x1311c2(++_0x2fab61);}(_0x1d43,0x19a));var _0x31d4=function(_0x289b70,_0x1ed00d){_0x289b70=_0x289b70-0x0;var _0x28353b=_0x1d43[_0x289b70];return _0x28353b;};'use strict';function ZendeskAccount(_0x278c06){this['id']=_0x278c06['id']||0x0;this[_0x31d4('0x0')]=_0x278c06[_0x31d4('0x0')]||'';this[_0x31d4('0x1')]=_0x278c06[_0x31d4('0x1')]||'';this[_0x31d4('0x2')]=_0x278c06[_0x31d4('0x2')]||'';this['token']=_0x278c06['token']||'';this[_0x31d4('0x3')]=_0x278c06[_0x31d4('0x3')]||'';this[_0x31d4('0x4')]=_0x278c06[_0x31d4('0x4')]||'';this[_0x31d4('0x5')]=_0x278c06[_0x31d4('0x5')]||'integrationTab';this[_0x31d4('0x6')]=_0x278c06[_0x31d4('0x6')]||'';this[_0x31d4('0x7')]=_0x278c06[_0x31d4('0x7')]||{};}module[_0x31d4('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index d413ba5..6b9af92 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 _0x1167=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x3f474e,_0x151e02){var _0x936083=function(_0x1f26fe){while(--_0x1f26fe){_0x3f474e['push'](_0x3f474e['shift']());}};_0x936083(++_0x151e02);}(_0x1167,0x98));var _0x7116=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1167[_0x580576];return _0x3f55a0;};'use strict';function ZohoAccount(_0x8b5017){this['id']=_0x8b5017['id']||0x0;this[_0x7116('0x0')]=_0x8b5017[_0x7116('0x0')]||'';this['description']=_0x8b5017[_0x7116('0x1')]||'';this[_0x7116('0x2')]=_0x8b5017[_0x7116('0x2')]||'';this[_0x7116('0x3')]=_0x8b5017['zone']||'';this[_0x7116('0x4')]=_0x8b5017[_0x7116('0x4')]||'';this[_0x7116('0x5')]=_0x8b5017[_0x7116('0x5')]||'';this[_0x7116('0x6')]=_0x8b5017['serverUrl']||'';this[_0x7116('0x7')]=_0x8b5017[_0x7116('0x7')]||'';this[_0x7116('0x8')]=_0x8b5017[_0x7116('0x8')]||'';this[_0x7116('0x9')]=_0x8b5017[_0x7116('0x9')]||{};}module[_0x7116('0xa')]=ZohoAccount; \ No newline at end of file +var _0x2099=['name','description','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x455795,_0x280de5){var _0x18d046=function(_0x5e0297){while(--_0x5e0297){_0x455795['push'](_0x455795['shift']());}};_0x18d046(++_0x280de5);}(_0x2099,0x19a));var _0x9209=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2099[_0x57b54c];return _0x59cc19;};'use strict';function ZohoAccount(_0x54778f){this['id']=_0x54778f['id']||0x0;this[_0x9209('0x0')]=_0x54778f[_0x9209('0x0')]||'';this[_0x9209('0x1')]=_0x54778f['description']||'';this['host']=_0x54778f['host']||'';this[_0x9209('0x2')]=_0x54778f[_0x9209('0x2')]||'';this['clientId']=_0x54778f[_0x9209('0x3')]||'';this[_0x9209('0x4')]=_0x54778f[_0x9209('0x4')]||'';this['serverUrl']=_0x54778f[_0x9209('0x5')]||'';this[_0x9209('0x6')]=_0x54778f['code']||'';this[_0x9209('0x7')]=_0x54778f['refreshToken']||'';this[_0x9209('0x8')]=_0x54778f[_0x9209('0x8')]||{};}module[_0x9209('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 9409b9c..b1294f5 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 _0x28ae=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','number','exports','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry'];(function(_0x3ea66d,_0x501383){var _0x1f28c7=function(_0x2a8caf){while(--_0x2a8caf){_0x3ea66d['push'](_0x3ea66d['shift']());}};_0x1f28c7(++_0x501383);}(_0x28ae,0x64));var _0xe28a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28ae[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xe28a('0x0'));var moment=require(_0xe28a('0x1'));function checkNameSurname(_0x3aac2f,_0x454790,_0x56a9e1){var _0x4993b6='';if(!_[_0xe28a('0x2')](_0x454790)&&_0xe28a('0x3')===typeof _0x454790){_0x4993b6+=_0x454790;}if(!_[_0xe28a('0x2')](_0x56a9e1)&&_0xe28a('0x3')===typeof _0x56a9e1){_0x4993b6+='\x20'+_0x56a9e1;}if(_0x4993b6!==''){return _0x4993b6;}return _0x3aac2f;}function Action(_0x6cad09,_0xf434d7,_0x58cd21,_0x2edff5,_0x3b48f2){this['uniqueid']=_0x58cd21||undefined;this[_0xe28a('0x4')]=_0x6cad09['id'];this[_0xe28a('0x5')]=_0xf434d7[_0xe28a('0x6')];this[_0xe28a('0x7')]=_0xf434d7[_0xe28a('0x7')];this[_0xe28a('0x8')]=_0xe28a('0x5');this[_0xe28a('0x9')]=![];this[_0xe28a('0xa')]=_[_0xe28a('0x2')](_0x6cad09['Agent'])?undefined:_0x6cad09[_0xe28a('0xb')][_0xe28a('0x6')];this[_0xe28a('0xc')]=this['membername']?util[_0xe28a('0xd')]('SIP/%s',this[_0xe28a('0xa')]):_0x2edff5||undefined;this[_0xe28a('0xe')]=checkNameSurname(_0x6cad09[_0xe28a('0xf')][_0xe28a('0x10')],_0x6cad09[_0xe28a('0xf')][_0xe28a('0x11')],_0x6cad09['Contact'][_0xe28a('0x12')]);this[_0xe28a('0x13')]=_0x6cad09[_0xe28a('0x13')]||![];this[_0xe28a('0x14')]=_0x6cad09[_0xe28a('0xf')]['phone'];this[_0xe28a('0x15')]=_0x6cad09[_0xe28a('0x15')];this['countbusyretry']=_0x6cad09['countbusyretry']||0x0;this[_0xe28a('0x16')]=_0x6cad09['countcongestionretry']||0x0;this[_0xe28a('0x17')]=_0x6cad09[_0xe28a('0x17')]||0x0;this['countglobal']=(_0x6cad09[_0xe28a('0x18')]||0x0)+(_0x6cad09[_0xe28a('0x16')]||0x0)+(_0x6cad09[_0xe28a('0x17')]||0x0)+(_0x6cad09[_0xe28a('0x19')]||0x0)+(_0x6cad09[_0xe28a('0x1a')]||0x0)+(_0x6cad09[_0xe28a('0x1b')]||0x0)+(_0x6cad09['countmachineretry']||0x0)+(_0x6cad09[_0xe28a('0x1c')]||0x0);this[_0xe28a('0x19')]=_0x6cad09[_0xe28a('0x19')]||0x0;this[_0xe28a('0x1a')]=_0x6cad09[_0xe28a('0x1a')]||0x0;this['countabandonedretry']=_0x6cad09[_0xe28a('0x1b')]||0x0;this[_0xe28a('0x1d')]=_0x6cad09[_0xe28a('0x1d')]||0x0;this['countagentrejectretry']=_0x6cad09['countagentrejectretry']||0x0;this[_0xe28a('0x1e')]=_0x6cad09[_0xe28a('0x1e')];this[_0xe28a('0x1f')]=_0x6cad09[_0xe28a('0x1f')];this[_0xe28a('0x20')]=_0x6cad09[_0xe28a('0x20')];this[_0xe28a('0x21')]=_0x6cad09[_0xe28a('0x21')];this[_0xe28a('0x22')]=_0x6cad09[_0xe28a('0x22')];this[_0xe28a('0x23')]=_0x6cad09['ListId'];this['UserId']=_['isNil'](_0x6cad09[_0xe28a('0xb')])?_0x6cad09['UserId']:_0x6cad09['Agent']['id'];this[_0xe28a('0x24')]=_0x6cad09[_0xe28a('0x24')];this[_0xe28a('0x25')]='';this[_0xe28a('0x26')]='';}Action[_0xe28a('0x27')]['getCaller']=function(){return util[_0xe28a('0xd')]('\x22%s\x22\x20<%s>',this[_0xe28a('0xe')],this[_0xe28a('0x28')]);};module[_0xe28a('0x29')]=Action; \ No newline at end of file +var _0x7b1e=['campaigntype','queue','dialAnswer','isNil','Agent','membername','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','calleridname','exports','util','lodash','moment','string','uniqueid','idContact','name','type'];(function(_0x5f3d89,_0x2fa852){var _0x5177be=function(_0x20a956){while(--_0x20a956){_0x5f3d89['push'](_0x5f3d89['shift']());}};_0x5177be(++_0x2fa852);}(_0x7b1e,0x1ba));var _0xe7b1=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x7b1e[_0x43a37c];return _0x5d1d40;};'use strict';var util=require(_0xe7b1('0x0'));var _=require(_0xe7b1('0x1'));var moment=require(_0xe7b1('0x2'));function checkNameSurname(_0x31dce9,_0x3a58f6,_0x52282e){var _0x8c7b72='';if(!_['isNil'](_0x3a58f6)&&_0xe7b1('0x3')===typeof _0x3a58f6){_0x8c7b72+=_0x3a58f6;}if(!_['isNil'](_0x52282e)&&'string'===typeof _0x52282e){_0x8c7b72+='\x20'+_0x52282e;}if(_0x8c7b72!==''){return _0x8c7b72;}return _0x31dce9;}function Action(_0x2fcc3b,_0x5325d7,_0x395106,_0x25af4c,_0x477fe1){this[_0xe7b1('0x4')]=_0x395106||undefined;this[_0xe7b1('0x5')]=_0x2fcc3b['id'];this['queue']=_0x5325d7[_0xe7b1('0x6')];this[_0xe7b1('0x7')]=_0x5325d7[_0xe7b1('0x7')];this[_0xe7b1('0x8')]=_0xe7b1('0x9');this[_0xe7b1('0xa')]=![];this['membername']=_[_0xe7b1('0xb')](_0x2fcc3b[_0xe7b1('0xc')])?undefined:_0x2fcc3b['Agent'][_0xe7b1('0x6')];this['channelAgent']=this[_0xe7b1('0xd')]?util[_0xe7b1('0xe')](_0xe7b1('0xf'),this['membername']):_0x25af4c||undefined;this['calleridname']=checkNameSurname(_0x2fcc3b[_0xe7b1('0x10')][_0xe7b1('0x11')],_0x2fcc3b['Contact'][_0xe7b1('0x12')],_0x2fcc3b[_0xe7b1('0x10')][_0xe7b1('0x13')]);this[_0xe7b1('0x14')]=_0x2fcc3b[_0xe7b1('0x14')]||![];this[_0xe7b1('0x15')]=_0x2fcc3b[_0xe7b1('0x10')][_0xe7b1('0x11')];this[_0xe7b1('0x16')]=_0x2fcc3b[_0xe7b1('0x16')];this['countbusyretry']=_0x2fcc3b[_0xe7b1('0x17')]||0x0;this[_0xe7b1('0x18')]=_0x2fcc3b[_0xe7b1('0x18')]||0x0;this[_0xe7b1('0x19')]=_0x2fcc3b[_0xe7b1('0x19')]||0x0;this[_0xe7b1('0x1a')]=(_0x2fcc3b[_0xe7b1('0x17')]||0x0)+(_0x2fcc3b['countcongestionretry']||0x0)+(_0x2fcc3b[_0xe7b1('0x19')]||0x0)+(_0x2fcc3b[_0xe7b1('0x1b')]||0x0)+(_0x2fcc3b[_0xe7b1('0x1c')]||0x0)+(_0x2fcc3b[_0xe7b1('0x1d')]||0x0)+(_0x2fcc3b['countmachineretry']||0x0)+(_0x2fcc3b[_0xe7b1('0x1e')]||0x0);this[_0xe7b1('0x1b')]=_0x2fcc3b[_0xe7b1('0x1b')]||0x0;this[_0xe7b1('0x1c')]=_0x2fcc3b['countdropretry']||0x0;this[_0xe7b1('0x1d')]=_0x2fcc3b[_0xe7b1('0x1d')]||0x0;this[_0xe7b1('0x1f')]=_0x2fcc3b[_0xe7b1('0x1f')]||0x0;this['countagentrejectretry']=_0x2fcc3b[_0xe7b1('0x1e')]||0x0;this[_0xe7b1('0x20')]=_0x2fcc3b[_0xe7b1('0x20')];this[_0xe7b1('0x21')]=_0x2fcc3b[_0xe7b1('0x21')];this[_0xe7b1('0x22')]=_0x2fcc3b[_0xe7b1('0x22')];this[_0xe7b1('0x23')]=_0x2fcc3b[_0xe7b1('0x23')];this[_0xe7b1('0x24')]=_0x2fcc3b[_0xe7b1('0x24')];this[_0xe7b1('0x25')]=_0x2fcc3b['ListId'];this[_0xe7b1('0x26')]=_[_0xe7b1('0xb')](_0x2fcc3b[_0xe7b1('0xc')])?_0x2fcc3b['UserId']:_0x2fcc3b[_0xe7b1('0xc')]['id'];this[_0xe7b1('0x27')]=_0x2fcc3b[_0xe7b1('0x27')];this['originatecalleridnum']='';this[_0xe7b1('0x28')]='';}Action['prototype'][_0xe7b1('0x29')]=function(){return util[_0xe7b1('0xe')](_0xe7b1('0x2a'),this[_0xe7b1('0x2b')],this['number']);};module[_0xe7b1('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 84d1381..f0cb1ed 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 _0x9003=['dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlockContact','disableContact','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','extractCalleridName','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','channelAgent','destconnectedlinenum','user:%s','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destlinkedid','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','lodash','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','emit','type','name','strategy','available','pTalking','sumHoldTime','talking','total','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','campaignsPreview','hasOwnProperty','booked','outbound','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','status','catch','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','length','getDiff','Agent','voicePause','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','answertime','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentcomplete','complete','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9003,0x92));var _0x3900=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9003[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var _=require(_0x3900('0x0'));var BPromise=require('bluebird');var uuid=require(_0x3900('0x1'));var moment=require(_0x3900('0x2'));var md5=require(_0x3900('0x3'));var Redis=require(_0x3900('0x4'));var config=require(_0x3900('0x5'));var logger=require(_0x3900('0x6'))(_0x3900('0x7'));var loggerAction=require(_0x3900('0x6'))(_0x3900('0x8'));var ami=require(_0x3900('0x9'));var rpcDb=require(_0x3900('0xa'));var Action=require('./action');var ut=require('./util/util');config[_0x3900('0xb')]=_[_0x3900('0xc')](config[_0x3900('0xb')],{'host':_0x3900('0xd'),'port':0x18eb});var io=require(_0x3900('0xe'))(new Redis(config[_0x3900('0xb')]));var Sequence=function(){};Sequence[_0x3900('0xf')][_0x3900('0x10')]=function(_0x27847a){this[_0x3900('0x11')]=this[_0x3900('0x11')]?this[_0x3900('0x11')][_0x3900('0x12')](_0x27847a):_0x27847a();};function Preview(_0x253226){this['sequence']=new Sequence();this['campaignsPreview']=_0x253226[_0x3900('0x13')];this[_0x3900('0x14')]=_0x253226[_0x3900('0x14')];this[_0x3900('0x15')]={};this[_0x3900('0x16')]=_0x253226['agents'];this[_0x3900('0x17')]=0x0;ami['on'](_0x3900('0x18'),this[_0x3900('0x19')][_0x3900('0x1a')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x3900('0x1b'),this[_0x3900('0x1c')]['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0x3900('0x1a')](this));ami['on']('newexten',this['syncNewExten'][_0x3900('0x1a')](this));ami['on'](_0x3900('0x1d'),this[_0x3900('0x1e')][_0x3900('0x1a')](this));ami['on'](_0x3900('0x1f'),this[_0x3900('0x20')][_0x3900('0x1a')](this));ami['on'](_0x3900('0x21'),this['syncBlindTransfer'][_0x3900('0x1a')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x38901c,_0x5495c0,_0x373aaf){io['to'](_0x38901c)[_0x3900('0x22')](_0x5495c0,_0x373aaf);}function emitCampaignPreview(_0x462a55){if(_0x462a55[_0x3900('0x23')]==='outbound'){var _0xa8b00c={'id':_0x462a55['id'],'name':_0x462a55[_0x3900('0x24')],'strategy':_0x462a55[_0x3900('0x25')],'answered':_0x462a55['answered'],'available':_0x462a55[_0x3900('0x26')],'loggedIn':_0x462a55['loggedIn'],'pTalking':_0x462a55[_0x3900('0x27')],'sumBillable':_0x462a55['sumBillable'],'sumDuration':_0x462a55['sumDuration'],'sumHoldTime':_0x462a55[_0x3900('0x28')]||0x0,'talking':_0x462a55[_0x3900('0x29')],'total':_0x462a55[_0x3900('0x2a')],'type':_0x462a55[_0x3900('0x23')],'unmanaged':_0x462a55['unmanaged'],'abandoned':_0x462a55[_0x3900('0x2b')],'waiting':_0x462a55[_0x3900('0x2c')],'loggedInDb':_0x462a55['loggedInDb'],'dialActive':_0x462a55[_0x3900('0x2d')],'dialMethod':_0x462a55[_0x3900('0x2e')],'dialOriginateCallerIdName':_0x462a55['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x462a55[_0x3900('0x2f')],'dialOriginateTimeout':_0x462a55[_0x3900('0x30')],'dialPrefix':_0x462a55['dialPrefix'],'outboundAnswerAgiCallsDay':_0x462a55[_0x3900('0x31')],'outboundAnswerCallsDay':_0x462a55[_0x3900('0x32')],'outboundBlacklistCallsDay':_0x462a55['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x462a55[_0x3900('0x33')],'outboundCongestionCallsDay':_0x462a55[_0x3900('0x34')],'outboundDropCallsDayACS':_0x462a55[_0x3900('0x35')],'outboundDropCallsDayCallersExit':_0x462a55[_0x3900('0x36')],'outboundDropCallsDayTimeout':_0x462a55[_0x3900('0x37')],'outboundNoAnswerCallsDay':_0x462a55[_0x3900('0x38')],'outboundNoSuchCallsDay':_0x462a55[_0x3900('0x39')],'outboundOriginateFailureCallsDay':_0x462a55['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x462a55['outboundReCallsDay'],'outboundRejectCallsDay':_0x462a55[_0x3900('0x3a')],'outboundUnknownCallsDay':_0x462a55[_0x3900('0x3b')],'outboundAbandonedCallsDay':_0x462a55[_0x3900('0x3c')],'predictiveIntervalAnsweredCalls':_0x462a55[_0x3900('0x3d')],'predictiveIntervalAvgHoldtime':_0x462a55[_0x3900('0x3e')],'predictiveIntervalAvgTalktime':_0x462a55[_0x3900('0x3f')],'predictiveIntervalDroppedCallsCallersExit':_0x462a55[_0x3900('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x462a55[_0x3900('0x41')],'predictiveIntervalErlangCalls':_0x462a55[_0x3900('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x462a55[_0x3900('0x43')],'predictiveIntervalHitRate':_0x462a55['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x462a55['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x462a55[_0x3900('0x44')],'predictiveIntervalAvailable':_0x462a55['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x462a55[_0x3900('0x45')],'message':_0x462a55[_0x3900('0x46')],'originated':_0x462a55['originated'],'erlangCalls':_0x462a55[_0x3900('0x47')],'erlangCallToSecond':_0x462a55[_0x3900('0x48')],'erlangAbandonmentRate':_0x462a55['erlangAbandonmentRate'],'erlangBusyFactor':_0x462a55['erlangBusyFactor'],'startPredictive':_0x462a55[_0x3900('0x49')],'startProgressive':_0x462a55[_0x3900('0x4a')]};if(_0x462a55['Trunk']){_0xa8b00c[_0x3900('0x4b')]={'id':_0x462a55['Trunk']['id'],'name':_0x462a55[_0x3900('0x4b')][_0x3900('0x24')],'active':_0x462a55['Trunk'][_0x3900('0x4c')],'callerid':_0x462a55['Trunk']['callerid']};}if(_0x462a55[_0x3900('0x4d')]){_0xa8b00c['Interval']={'id':_0x462a55['Interval']['id'],'name':_0x462a55[_0x3900('0x4d')][_0x3900('0x24')]};}var _0x53bb89=md5(JSON[_0x3900('0x4e')](_0xa8b00c));if(_0x462a55['md5']!==_0x53bb89){_0x462a55[_0x3900('0x3')]=_0x53bb89;emit(util[_0x3900('0x4f')](_0x3900('0x50'),_0xa8b00c['name']),_0x3900('0x51'),_0xa8b00c);}}}function emitVoiceQueueChannelRemove(_0x53e5b5){logger[_0x3900('0x52')](_0x3900('0x53'),JSON[_0x3900('0x4e')](_0x53e5b5));emit(util[_0x3900('0x4f')](_0x3900('0x50'),_0x53e5b5['name']),_0x3900('0x54'),_0x53e5b5);io[_0x3900('0x22')](_0x3900('0x55'),_0x53e5b5);}function notSendMessagesQueue(_0x354aa3){if(_0x354aa3[_0x3900('0x56')]){if(_0x354aa3[_0x3900('0x57')]===0x0&&_0x354aa3[_0x3900('0x27')]===0x0){_0x354aa3[_0x3900('0x56')]=![];_0x354aa3['available']=0x0;_0x354aa3[_0x3900('0x58')]=0x0;_0x354aa3['message']=_0x3900('0x59');ut[_0x3900('0x5a')](_0x3900('0x5b'),_0x354aa3[_0x3900('0x24')]+'\x20is\x20not\x20active');}else{_0x354aa3[_0x3900('0x46')]=_0x3900('0x5c');ut[_0x3900('0x5a')](_0x3900('0x5b'),_0x354aa3['name']+_0x3900('0x5d'));}emitCampaignPreview(_0x354aa3);}}Preview[_0x3900('0xf')]['loopCampaigns']=function(){var _0x559bf7=this;setInterval(function(){_0x559bf7[_0x3900('0x5e')]();},0x7cf);};Preview[_0x3900('0xf')][_0x3900('0x5e')]=function(){var _0x20a1e0=this[_0x3900('0x5f')];this[_0x3900('0x17')]+=0x1;for(var _0x57977b in _0x20a1e0){if(_0x20a1e0[_0x3900('0x60')](_0x57977b)&&(_0x20a1e0[_0x57977b]['dialMethod']===_0x3900('0x7')||_0x20a1e0[_0x57977b][_0x3900('0x2e')]===_0x3900('0x61'))&&_0x20a1e0[_0x57977b][_0x3900('0x23')]===_0x3900('0x62')){if(this['clockClearZombieChannels']>0x7){this[_0x3900('0x17')]=0x0;this[_0x3900('0x63')]();}}if(_0x20a1e0[_0x3900('0x60')](_0x57977b)&&_0x20a1e0[_0x57977b][_0x3900('0x2e')]==='preview'&&_0x20a1e0[_0x57977b][_0x3900('0x23')]==='outbound'){if(_0x20a1e0[_0x57977b][_0x3900('0x2d')]){this[_0x3900('0x64')](_0x20a1e0[_0x57977b]);this[_0x3900('0x65')](_0x20a1e0[_0x57977b]);}else{notSendMessagesQueue(_0x20a1e0[_0x57977b]);}}}};Preview['prototype'][_0x3900('0x66')]=function(_0x5384b8){var _0x44530b=this;this['sequence'][_0x3900('0x10')](function(){if(!_[_0x3900('0x67')](_0x44530b[_0x3900('0x15')][_0x5384b8])){loggerAction[_0x3900('0x52')](_0x3900('0x68'),_0x5384b8,_0x3900('0x69'),_0x44530b['actions'][_0x5384b8]['queue'],_0x3900('0x6a'),JSON[_0x3900('0x4e')](_0x44530b[_0x3900('0x5f')][_0x44530b[_0x3900('0x15')][_0x5384b8][_0x3900('0x6b')]]['originated']),_0x3900('0x6c'),JSON[_0x3900('0x4e')](_0x44530b[_0x3900('0x5f')][_0x44530b[_0x3900('0x15')][_0x5384b8][_0x3900('0x6b')]][_0x3900('0x27')]),JSON[_0x3900('0x4e')](_0x44530b['actions'][_0x5384b8][_0x3900('0x6d')]),JSON[_0x3900('0x4e')](_[_0x3900('0x6e')](_0x44530b[_0x3900('0x15')][_0x5384b8],[_0x3900('0x6f'),_0x3900('0x70'),'VoiceQueueId',_0x3900('0x71')])));return ami[_0x3900('0x72')]({'action':_0x3900('0x73'),'channel':_0x44530b[_0x3900('0x15')][_0x5384b8]['channel']})[_0x3900('0x74')](function(_0x2ae6d6){if(_0x2ae6d6['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x44530b['actions'][_0x5384b8]){ut['updateOriginated'](_0x44530b[_0x3900('0x5f')][_0x44530b[_0x3900('0x15')][_0x5384b8]['queue']],_0x3900('0x75'));if(_0x44530b['actions'][_0x5384b8][_0x3900('0x6d')]===!![]){ut[_0x3900('0x76')](_0x44530b[_0x3900('0x5f')][_0x44530b[_0x3900('0x15')][_0x5384b8][_0x3900('0x6b')]],_0x3900('0x75'));ut[_0x3900('0x77')](_0x3900('0x78')+_0x5384b8,_0x44530b[_0x3900('0x15')][_0x5384b8]['queue']);}ut[_0x3900('0x77')](_0x3900('0x79')+_0x5384b8,_0x44530b[_0x3900('0x15')][_0x5384b8][_0x3900('0x6b')]);delete _0x44530b[_0x3900('0x15')][_0x5384b8];}},0x2328);}});}});};Preview['prototype'][_0x3900('0x63')]=function(){var _0x5361b5=this;loggerAction[_0x3900('0x52')](_0x3900('0x7a'),_[_0x3900('0x7b')](this[_0x3900('0x15')]));for(var _0x4d09ab in this[_0x3900('0x15')]){if(_0x5361b5[_0x3900('0x15')][_0x3900('0x60')](_0x4d09ab)){_0x5361b5[_0x3900('0x66')](_0x4d09ab);}}};Preview[_0x3900('0xf')][_0x3900('0x65')]=function(_0x1e7902){var _0xbc1cd5=this;rpcDb[_0x3900('0x7c')](_0x1e7902['id'],ut['agentReadyId'](this[_0x3900('0x16')]))[_0x3900('0x7d')](function(_0x276c51){if(!_[_0x3900('0x67')](_0x276c51)){for(var _0x5344b4=0x0;_0x5344b4<_0x276c51[_0x3900('0x7e')];_0x5344b4+=0x1){if(ut[_0x3900('0x7f')](_0x276c51[_0x5344b4]['scheduledat'])<_0x1e7902['dialRecallMeTimeout']*0x3c){if(_0x276c51[_0x5344b4][_0x3900('0x80')]&&!_0x276c51[_0x5344b4][_0x3900('0x80')][_0x3900('0x81')]){_0xbc1cd5['run'](_0x276c51[_0x5344b4]['id'])['then'](ut[_0x3900('0x82')](_0x3900('0x83')))[_0x3900('0x74')](ut[_0x3900('0x82')](_0x3900('0x83')));}else{rpcDb['disableContact'](_0x276c51[_0x5344b4]['id']);}}else{var _0x6aa4bb=new Action(_0x276c51[_0x5344b4],_0x1e7902);_0x6aa4bb[_0x3900('0x84')]=moment()[_0x3900('0x4f')](_0x3900('0x85'));_0x1e7902[_0x3900('0x86')]+=0x1;ut[_0x3900('0x87')](_0x6aa4bb,0x17,_0x3900('0x88'));if(_0x1e7902[_0x3900('0x89')]){rpcDb[_0x3900('0x8a')](ut[_0x3900('0x8b')](_0x276c51[_0x5344b4]));rpcDb[_0x3900('0x8c')](_0x6aa4bb,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x6aa4bb,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x6aa4bb,'[HistoryRecallClose]');rpcDb[_0x3900('0x8d')](_0x6aa4bb,_0x3900('0x8e'));}}}}})['catch'](ut[_0x3900('0x82')](_0x3900('0x8f')));};Preview['prototype']['setMessage']=function(_0xb70ed5){_0xb70ed5[_0x3900('0x56')]=!![];if(ut['IsNotLoggedIn'](_0xb70ed5['loggedIn'])){_0xb70ed5[_0x3900('0x46')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x3900('0x90')](_0xb70ed5[_0x3900('0x2d')])){_0xb70ed5[_0x3900('0x46')]=_0x3900('0x59');}else if(!this['isTrunkReachable'](_0xb70ed5[_0x3900('0x4b')])){if(!this[_0x3900('0x91')](_0xb70ed5[_0x3900('0x92')])){_0xb70ed5['message']=_0x3900('0x93');}else{_0xb70ed5['message']=_0x3900('0x94');}}else{_0xb70ed5[_0x3900('0x46')]='ACTIVE';}emitCampaignPreview(_0xb70ed5);};Preview['prototype'][_0x3900('0x95')]=function(_0x1e7f5c,_0x368e84,_0x59e795){var _0xac1ccc=this;var _0x520519=this[_0x3900('0x15')][_0x368e84];var _0x2e3e40=this['campaignsPreview'][_0x520519[_0x3900('0x6b')]];var _0x591664;if(_0x2e3e40){switch(_0x59e795){case'1':_0x2e3e40[_0x3900('0x39')]+=0x1;_0x520519['countnosuchnumberretry']+=0x1;_0x520519['countglobal']=ut['totalGlobal'](_0x520519);ut[_0x3900('0x87')](_0x520519,0x0,_0x3900('0x96'));ami[_0x3900('0x22')]('custom:agentnosuchnumber',ut[_0x3900('0x97')](_0x520519,_0x3900('0x98')));rpcDb['createCustomerHistory'](_0x520519,_0x3900('0x99'));if(ut[_0x3900('0x9a')](_0x520519)>=_0x2e3e40['dialGlobalMaxRetry']){_0x591664=ut[_0x3900('0x9b')](_0x520519,0xf,_0x3900('0x9c'));rpcDb['createCustomerFinal'](_0x591664,_0x3900('0x9d'));}else{if(_0x520519[_0x3900('0x9e')]>=_0x2e3e40[_0x3900('0x9f')]){rpcDb[_0x3900('0x8d')](_0x520519,_0x3900('0x9d'));}else{rpcDb[_0x3900('0xa0')](ut['scheduledAt'](_0x520519,'countnosuchnumberretry',_0x2e3e40[_0x3900('0xa1')]),_0x520519[_0x3900('0xa2')],_0x520519[_0x3900('0xa3')]);}}delete this[_0x3900('0x15')][_0x1e7f5c[_0x3900('0xa4')]];break;case'ANSWER':var _0x464825=moment()['format'](_0x3900('0x85'));_0x520519['responsetime']=_0x464825;_0x520519[_0x3900('0xa5')]=_0x464825;_0x520519[_0x3900('0x6d')]=!![];_0x2e3e40[_0x3900('0x27')]+=0x1;logger[_0x3900('0x52')]('[syncHangup][talking][increment]',_0x520519[_0x3900('0xa6')],_0x3900('0xa7'),_0x2e3e40[_0x3900('0x24')],_0x3900('0x6c'),_0x2e3e40[_0x3900('0x27')]);ami[_0x3900('0x22')](_0x3900('0xa8'),ut['buildObj'](_0x520519,_0x3900('0xa9'),this['campaignsPreview'][_0x520519[_0x3900('0x6b')]]));if(_0x2e3e40[_0x3900('0xaa')]){ami['emit']('custom:agentConnectPreview',ut['buildAcw'](_0x520519));}break;case'16':ami['emit'](_0x3900('0xab'),ut['buildObj'](_0x520519,'complete',this[_0x3900('0x5f')][_0x520519[_0x3900('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0x3900('0x97')](_0x520519,_0x3900('0xac')));_0x2e3e40['outboundAnswerCallsDay']+=0x1;_0x2e3e40[_0x3900('0x2a')]+=0x1;_0x2e3e40[_0x3900('0xad')]+=0x1;ut[_0x3900('0x76')](_0x2e3e40,_0x3900('0xae'));_0x520519[_0x3900('0xaf')]=ut['totalGlobal'](_0x520519);ut['logCustomer'](_0x520519,0x4,_0x3900('0xb0'));rpcDb[_0x3900('0x8c')](_0x520519,_0x3900('0xb1'));rpcDb['createCustomerFinal'](_0x520519,_0x3900('0xb2'));rpcDb[_0x3900('0xb3')](_0x520519);_0x2e3e40[_0x3900('0xb4')]+=_0x520519['talktime'];_0x2e3e40[_0x3900('0xb5')]+=_0x520519[_0x3900('0xb6')];logger[_0x3900('0x52')](_0x3900('0xb7'),_0x520519[_0x3900('0xa6')],_0x3900('0xa7'),_0x2e3e40['name'],_0x3900('0x6c'),_0x2e3e40[_0x3900('0x27')]);delete this['actions'][_0x1e7f5c['linkedid']];break;case _0x3900('0xb8'):_0x2e3e40[_0x3900('0x33')]+=0x1;_0x520519[_0x3900('0xb9')]+=0x1;_0x520519[_0x3900('0xaf')]=ut[_0x3900('0x9a')](_0x520519);ut[_0x3900('0x87')](_0x520519,0x5,_0x3900('0xba'));ami['emit'](_0x3900('0xbb'),ut['buildObj'](_0x520519,'busy'));rpcDb[_0x3900('0x8c')](_0x520519,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x3900('0x9a')](_0x520519)>=_0x2e3e40['dialGlobalMaxRetry']){_0x591664=ut[_0x3900('0x9b')](_0x520519,0xf,_0x3900('0x9c'));rpcDb[_0x3900('0x8d')](_0x591664,_0x3900('0xbc'));}else{if(_0x520519[_0x3900('0xb9')]>=_0x2e3e40[_0x3900('0xbd')]){rpcDb[_0x3900('0x8d')](_0x520519,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x3900('0xa0')](ut[_0x3900('0xbe')](_0x520519,'countbusyretry',_0x2e3e40[_0x3900('0xbf')]),_0x520519[_0x3900('0xa2')],_0x520519[_0x3900('0xa3')]);}}break;case _0x3900('0xc0'):_0x2e3e40[_0x3900('0x38')]+=0x1;_0x520519['countnoanswerretry']+=0x1;_0x520519[_0x3900('0xaf')]=ut['totalGlobal'](_0x520519);ut[_0x3900('0x87')](_0x520519,0x3,_0x3900('0xc1'));ami['emit']('custom:agentnoanswer',ut[_0x3900('0x97')](_0x520519,_0x3900('0xc2')));rpcDb['createCustomerHistory'](_0x520519,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x520519)>=_0x2e3e40['dialGlobalMaxRetry']){_0x591664=ut['cloneAction'](_0x520519,0xf,_0x3900('0x9c'));rpcDb[_0x3900('0x8d')](_0x591664,_0x3900('0xc3'));}else{if(_0x520519[_0x3900('0xc4')]>=_0x2e3e40[_0x3900('0xc5')]){rpcDb[_0x3900('0x8d')](_0x520519,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x3900('0xa0')](ut[_0x3900('0xbe')](_0x520519,_0x3900('0xc4'),_0x2e3e40['dialNoAnswerRetryFrequency']),_0x520519[_0x3900('0xa2')],_0x520519[_0x3900('0xa3')]);}}break;case _0x3900('0xc6'):_0x2e3e40[_0x3900('0x34')]+=0x1;_0x520519[_0x3900('0xc7')]+=0x1;_0x520519[_0x3900('0xaf')]=ut[_0x3900('0x9a')](_0x520519);ut[_0x3900('0x87')](_0x520519,0x8,_0x3900('0xc8'));ami['emit']('custom:agentcongestion',ut[_0x3900('0x97')](_0x520519,'congestion'));rpcDb[_0x3900('0x8c')](_0x520519,_0x3900('0xc9'));if(ut[_0x3900('0x9a')](_0x520519)>=_0x2e3e40['dialGlobalMaxRetry']){_0x591664=ut['cloneAction'](_0x520519,0xf,_0x3900('0x9c'));rpcDb[_0x3900('0x8d')](_0x591664,_0x3900('0xca'));}else{if(_0x520519['countcongestionretry']>=_0x2e3e40[_0x3900('0xcb')]){rpcDb[_0x3900('0x8d')](_0x520519,_0x3900('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0x3900('0xbe')](_0x520519,'countcongestionretry',_0x2e3e40[_0x3900('0xbf')]),_0x520519[_0x3900('0xa2')],_0x520519[_0x3900('0xa3')]);}}break;case'CANCEL':_0x2e3e40[_0x3900('0x3a')]+=0x1;_0x520519['countagentrejectretry']+=0x1;_0x520519[_0x3900('0xaf')]=ut[_0x3900('0x9a')](_0x520519);ut['logCustomer'](_0x520519,0x14,_0x3900('0xcc'));ami[_0x3900('0x22')]('custom:agentreject',ut[_0x3900('0x97')](_0x520519,_0x3900('0xcd')));rpcDb[_0x3900('0x8c')](_0x520519,_0x3900('0xce'));if(ut['totalGlobal'](_0x520519)>=_0x2e3e40[_0x3900('0xcf')]){_0x591664=ut[_0x3900('0x9b')](_0x520519,0x14,'AgentReject');rpcDb[_0x3900('0x8d')](_0x591664,_0x3900('0xd0'));}else{if(_0x520519[_0x3900('0xd1')]>=_0x2e3e40[_0x3900('0xd2')]){rpcDb[_0x3900('0x8d')](_0x520519,_0x3900('0xd0'));}else{rpcDb[_0x3900('0xa0')](ut[_0x3900('0xbe')](_0x520519,_0x3900('0xd1'),_0x2e3e40['dialAgentRejectRetryFrequency']),_0x520519[_0x3900('0xa2')],_0x520519[_0x3900('0xa3')]);}}break;case _0x3900('0xd3'):_0x2e3e40[_0x3900('0x3c')]+=0x1;_0x520519[_0x3900('0xd4')]+=0x1;_0x520519[_0x3900('0xaf')]=ut[_0x3900('0x9a')](_0x520519);ut['logCustomer'](_0x520519,0xb,_0x3900('0xd5'));rpcDb[_0x3900('0x8c')](_0x520519,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x3900('0x9a')](_0x520519)>=_0x2e3e40[_0x3900('0xcf')]){_0x591664=ut[_0x3900('0x9b')](_0x520519,0xf,_0x3900('0x9c'));rpcDb[_0x3900('0x8d')](_0x591664,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x520519[_0x3900('0xd6')]>=_0x2e3e40[_0x3900('0xd7')]){rpcDb[_0x3900('0x8d')](_0x520519,_0x3900('0xd8'));}else{rpcDb[_0x3900('0xa0')](ut[_0x3900('0xbe')](_0x520519,_0x3900('0xd4'),_0x2e3e40['dialAbandonedRetryFrequency']),_0x520519['unlockAgent'],_0x520519[_0x3900('0xa3')]);}}break;case'18':_0x2e3e40[_0x3900('0x3b')]+=0x1;_0x520519['countmachineretry']+=0x1;_0x520519[_0x3900('0xaf')]=ut[_0x3900('0x9a')](_0x520519);ut[_0x3900('0x87')](_0x520519,0x12,_0x1e7f5c[_0x3900('0xd9')]||_0x1e7f5c[_0x3900('0xda')]);ami[_0x3900('0x22')](_0x3900('0xdb'),ut[_0x3900('0x97')](_0x520519,_0x3900('0xdc')));rpcDb[_0x3900('0x8c')](_0x520519,'[callProgressDetectingCustomer][hangupInAMD]');if(ut['totalGlobal'](_0x520519)>=_0x2e3e40[_0x3900('0xcf')]){_0x591664=ut[_0x3900('0x9b')](_0x520519,0xf,_0x3900('0x9c'));rpcDb['createCustomerFinal'](_0x591664,_0x3900('0xdd'));}else{rpcDb[_0x3900('0x8d')](_0x520519,_0x3900('0xdd'));}delete this[_0x3900('0x15')][_0x1e7f5c[_0x3900('0xa4')]];break;case'19':_0x2e3e40['outboundUnknownCallsDay']+=0x1;_0x520519[_0x3900('0xaf')]=ut['totalGlobal'](_0x520519);ut[_0x3900('0x87')](_0x520519,0x13,_0x1e7f5c[_0x3900('0xd9')]||_0x1e7f5c[_0x3900('0xda')]);ami['emit'](_0x3900('0xdb'),ut[_0x3900('0x97')](_0x520519,_0x3900('0xdc')));rpcDb[_0x3900('0x8c')](_0x520519,_0x3900('0xde'));if(ut[_0x3900('0x9a')](_0x520519)>=_0x2e3e40['dialGlobalMaxRetry']){_0x591664=ut[_0x3900('0x9b')](_0x520519,0xf,'Global');rpcDb['createCustomerFinal'](_0x591664,_0x3900('0xde'));}else{rpcDb[_0x3900('0x8d')](_0x520519,_0x3900('0xde'));}delete this[_0x3900('0x15')][_0x1e7f5c[_0x3900('0xa4')]];break;default:if(_0x520519[_0x3900('0x6d')]){ut[_0x3900('0x76')](_0x2e3e40,'[default]');ut[_0x3900('0x77')](_0x3900('0xdf')+_0x2e3e40[_0x3900('0x24')],_0x1e7f5c);}_0x2e3e40[_0x3900('0x3b')]+=0x1;_0x520519[_0x3900('0xaf')]=ut['totalGlobal'](_0x520519);ut[_0x3900('0x87')](_0x520519,0xc,_0x1e7f5c[_0x3900('0xd9')]||_0x1e7f5c[_0x3900('0xda')]);rpcDb[_0x3900('0x8c')](_0x520519,_0x3900('0xe0'));if(ut[_0x3900('0x9a')](_0x520519)>=_0x2e3e40[_0x3900('0xcf')]){_0x591664=ut[_0x3900('0x9b')](_0x520519,0xf,_0x3900('0x9c'));rpcDb[_0x3900('0x8d')](_0x591664,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x3900('0x8d')](_0x520519,_0x3900('0xe1'));}delete this['actions'][_0x1e7f5c['linkedid']];}if(!(_0x520519[_0x3900('0x6d')]&&_0x59e795==='16')){ut[_0x3900('0xe2')](_0x2e3e40,_0x3900('0xe3'));logger['info'](_0x3900('0xe4'),_0x520519[_0x3900('0xa6')],_0x3900('0xa7'),_0x2e3e40[_0x3900('0x24')],_0x3900('0x6a'),_0x2e3e40[_0x3900('0x57')]);}if(_0x59e795!==_0x3900('0xe5')){delete this[_0x3900('0x15')][_0x1e7f5c[_0x3900('0xa4')]];delete this['actions'][_0x1e7f5c['destlinkedid']];}}};Preview[_0x3900('0xf')][_0x3900('0xe6')]=function(_0x197474,_0x45e2d8,_0x4d980f){if(_[_0x3900('0xe7')](_0x45e2d8)&&'object'!==typeof _0x45e2d8){return;}if(_[_0x3900('0xe7')](_0x4d980f)&&_0x3900('0xe8')!==typeof _0x4d980f){return;}switch(_0x4d980f[_0x3900('0xe9')]){case'0':ut[_0x3900('0xea')](_0x197474,0x0,_0x3900('0x96'));rpcDb['createAgentHistory'](_0x197474,_0x3900('0xeb'));break;case'3':ut[_0x3900('0xea')](_0x197474,0x3,_0x3900('0xc1'));rpcDb[_0x3900('0xec')](_0x197474,_0x3900('0xed'));break;case'5':ut[_0x3900('0xea')](_0x197474,0x5,'Busy');rpcDb['createAgentHistory'](_0x197474,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x3900('0xea')](_0x197474,0x8,'Congestion');rpcDb['createAgentHistory'](_0x197474,_0x3900('0xee'));break;case'22':ut[_0x3900('0xea')](_0x197474,0x16,_0x3900('0xef'));rpcDb['createAgentHistory'](_0x197474,_0x3900('0xf0'));break;default:ut['logAgent'](_0x197474,0xc,_0x4d980f['reason']);rpcDb[_0x3900('0xec')](_0x197474,_0x3900('0xee'));}ut['updateOriginated'](_0x45e2d8,_0x3900('0xf1'));logger[_0x3900('0x52')](_0x3900('0xf2'),_0x197474[_0x3900('0xa6')],'\x20Queue',_0x45e2d8[_0x3900('0x24')],_0x3900('0x6a'),_0x45e2d8[_0x3900('0x57')]);delete this[_0x3900('0x15')][_0x197474['uniqueid']];};Preview[_0x3900('0xf')][_0x3900('0xf3')]=function(_0xc9142c,_0x4f21cb,_0x5b6e94,_0x29e9b1,_0x190fd5){var _0xc55a4=this;return new BPromise(function(_0x32468a,_0x308253){if(_[_0x3900('0x67')](_0x4f21cb)||_['isNil'](_0x4f21cb[_0x3900('0xf4')])||_[_0x3900('0x67')](_0x4f21cb[_0x3900('0xf4')][_0x3900('0xf5')])||_[_0x3900('0x67')](_0x4f21cb[_0x3900('0xf6')])){_0x308253(ut['message'](_0x3900('0xf7'),_0x29e9b1,_0x190fd5));return;}var _0x28d98e=uuid['v4']();var _0x3e5a92=_0xc55a4[_0x3900('0x5f')][_0x4f21cb['Queue'][_0x3900('0x24')]];var _0x27ca0a=_0x5b6e94?_0xc55a4['agents'][_0x5b6e94]['id']:undefined;_0xc55a4[_0x3900('0x15')][_0x28d98e]=new Action(_0x4f21cb,_0x3e5a92,_0x28d98e,_0x5b6e94,_0x27ca0a);var _0x19eb50=_0xc55a4[_0x3900('0x15')][_0x28d98e];_0x19eb50['unlockAgent']=_0x29e9b1;_0x19eb50[_0x3900('0xa3')]=_0x190fd5;_0x19eb50[_0x3900('0xf8')]=_0x5b6e94;if(_[_0x3900('0xf9')](_0xc9142c)){_0xc55a4[_0x3900('0xfa')](_0x19eb50,_0x3e5a92,_0x4f21cb,_0x5b6e94)[_0x3900('0x7d')](function(_0x2737bd){logger[_0x3900('0x52')](_0x3900('0xfb'),_0x3900('0xfc')+_0x19eb50[_0x3900('0x6b')]+'\x20IdHopper:\x20'+_0x19eb50[_0x3900('0xfd')],JSON[_0x3900('0x4e')](_0x2737bd));ami[_0x3900('0x22')](_0x3900('0xfe'),ut[_0x3900('0x97')](_0x19eb50,'called',_0xc55a4[_0x3900('0x5f')][_0x19eb50['queue']]));_0x32468a(ut[_0x3900('0x46')](_0x3900('0xff')));})[_0x3900('0x74')](function(_0xa1ac72){ut[_0x3900('0x5a')](_0x3900('0x100'),_0xa1ac72);_0x308253(ut[_0x3900('0x46')](_0x3900('0x101'),_0x29e9b1,_0x190fd5));});}else{_0x3e5a92[_0x3900('0x102')]+=0x1;ut[_0x3900('0x103')](_0x19eb50);rpcDb['createHistory'](_0x19eb50,_0x3900('0x104'));delete _0xc55a4['actions'][_0x28d98e];_0x308253(ut[_0x3900('0x46')]('Contact\x20in\x20black\x20List',_0x29e9b1,_0x190fd5));}});};Preview[_0x3900('0xf')][_0x3900('0x91')]=function(_0x2a754b){return!_[_0x3900('0x67')](_0x2a754b)&&!_[_0x3900('0x67')](_0x2a754b['name'])&&!_[_0x3900('0x67')](_0x2a754b[_0x3900('0x4c')])&&_0x2a754b[_0x3900('0x4c')]&&!_[_0x3900('0x67')](this[_0x3900('0x14')][util[_0x3900('0x4f')](_0x3900('0x105'),_0x2a754b['name'])])&&!_[_0x3900('0x67')](this[_0x3900('0x14')][util[_0x3900('0x4f')](_0x3900('0x105'),_0x2a754b['name'])][_0x3900('0x73')])&&(this[_0x3900('0x14')][util[_0x3900('0x4f')]('SIP/%s',_0x2a754b[_0x3900('0x24')])][_0x3900('0x73')]===_0x3900('0x106')||this['trunks'][util[_0x3900('0x4f')]('SIP/%s',_0x2a754b[_0x3900('0x24')])][_0x3900('0x73')]===_0x3900('0x107'));};Preview[_0x3900('0xf')]['run']=function(_0x8fc3,_0x534289){var _0x465b42=this;return new BPromise(function(_0x2606d2,_0x456367){_0x465b42[_0x3900('0x108')](_0x8fc3,_0x534289)[_0x3900('0x7d')](function(_0x223578){_0x2606d2(_[_0x3900('0x6e')](_0x223578,[_0x3900('0x46')]));})[_0x3900('0x74')](function(_0x5d0fca){if(_0x5d0fca['unlock']){rpcDb[_0x3900('0x109')](_0x8fc3);}if(_0x5d0fca[_0x3900('0x4c')]){rpcDb[_0x3900('0x10a')](_0x8fc3);}_0x456367(_[_0x3900('0x6e')](_0x5d0fca,['message']));});});};Preview[_0x3900('0xf')][_0x3900('0x108')]=function(_0x34af3b,_0x159178){var _0x38e69e=this;return new BPromise(function(_0x12a93,_0x41e070){var _0x3cb801,_0x4b7fc8;rpcDb['getContactPreview'](_0x34af3b)[_0x3900('0x7d')](function(_0x134c6b){if(!_[_0x3900('0x67')](_0x134c6b[0x0])){_0x4b7fc8=_0x134c6b[0x0][_0x3900('0x10b')]?![]:!![];_0x3cb801=_0x134c6b[0x0][_0x3900('0x10b')]?!![]:![];_0x3cb801=_0x159178?!![]:_0x3cb801;}var _0x18c083=_0x38e69e['validateContact'](_0x134c6b);if(_0x18c083[_0x3900('0x10c')]){rpcDb[_0x3900('0x10d')](_[_0x3900('0x6e')](_0x134c6b[0x0],[_0x3900('0xf6'),_0x3900('0x10e')]))['then'](function(_0x2fa814){_0x38e69e[_0x3900('0xf3')](_0x2fa814,_0x134c6b[0x0],_0x159178,_0x4b7fc8,_0x3cb801)['then'](function(_0x296d8b){_0x12a93(_0x296d8b);})['catch'](function(_0xa26032){_0x41e070(_0xa26032);});})['catch'](function(_0x29bf32){ut['logger']('[Preview][checkIsBlackList]',_0x29bf32);_0x41e070(ut[_0x3900('0x46')]('Call\x20unsuccessful',_0x4b7fc8,_0x3cb801));});}else{_0x41e070(ut[_0x3900('0x46')](_0x18c083[_0x3900('0x46')],_0x4b7fc8,_0x3cb801));}})[_0x3900('0x74')](function(_0x4b5f91){ut[_0x3900('0x5a')](_0x3900('0x10f'),_0x4b5f91);_0x41e070(ut[_0x3900('0x46')](_0x3900('0x110'),![],!![]));});});};Preview[_0x3900('0xf')][_0x3900('0x111')]=function(_0x336070){if(_[_0x3900('0x67')](_0x336070)||_[_0x3900('0xf9')](_0x336070)||!_[_0x3900('0x67')](_0x336070[0x0][_0x3900('0x80')])&&_['isNil'](_0x336070[0x0]['Agent'][_0x3900('0x24')])){ut['logger'](_0x3900('0x112'),_0x336070);return{'isValid':![],'message':_0x3900('0x113')};}var _0xbc7d0=this[_0x3900('0x5f')][_0x336070[0x0][_0x3900('0x69')]['name']];_0xbc7d0[_0x3900('0x46')]=_0x3900('0x94');if(_['isNil'](_0xbc7d0)){ut[_0x3900('0x5a')](_0x3900('0x114'),_0xbc7d0);return{'isValid':![],'message':_0x3900('0x115')};}if(!this[_0x3900('0x91')](_0xbc7d0['Trunk'])){ut[_0x3900('0x5a')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x3900('0x116')+_0xbc7d0[_0x3900('0x24')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x3900('0x91')](_0xbc7d0['TrunkBackup'])){ut[_0x3900('0x5a')](_0x3900('0x117'),_0xbc7d0['name']+_0x3900('0x118'));return{'isValid':![],'message':_0x3900('0x119')};}}if(!ut['isActive'](_0xbc7d0[_0x3900('0x2d')])){ut[_0x3900('0x5a')](_0x3900('0x11a'),_0xbc7d0[_0x3900('0x24')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x3900('0x116')+_0xbc7d0[_0x3900('0x24')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x3900('0x11b')};};Preview[_0x3900('0xf')][_0x3900('0xfa')]=function(_0x32225f,_0x5be425,_0x4cf29d,_0x3d1438){var _0xb848fc=this;return new BPromise(function(_0x460911,_0x27c902){var _0x432da1=_0x32225f[_0x3900('0xa6')];var _0x1c682e=_0xb848fc[_0x3900('0x91')](_0x5be425[_0x3900('0x4b')])?util['format'](_0x3900('0x11c'),_0x5be425[_0x3900('0x4b')][_0x3900('0x24')],_[_0x3900('0x67')](_0x5be425[_0x3900('0x11d')])?'':_0x5be425[_0x3900('0x11d')][_0x3900('0x11e')]()||'',_0x5be425['dialCutDigit']>0x0?_0x4cf29d[_0x3900('0xf4')]['phone'][_0x3900('0x11f')](_0x5be425['dialCutDigit']):_0x4cf29d['Contact']['phone']):util['format'](_0x3900('0x11c'),_['isNil'](_0x5be425[_0x3900('0x92')])?_0x5be425['Trunk'][_0x3900('0x24')]:_0x5be425['TrunkBackup'][_0x3900('0x24')],_[_0x3900('0x67')](_0x5be425[_0x3900('0x11d')])?'':_0x5be425[_0x3900('0x11d')]['trim']()||'',_0x5be425[_0x3900('0x120')]>0x0?_0x4cf29d[_0x3900('0xf4')]['phone'][_0x3900('0x11f')](_0x5be425[_0x3900('0x120')]):_0x4cf29d[_0x3900('0xf4')][_0x3900('0xf5')]);var _0x3d5ea8=_0xb848fc[_0x3900('0x91')](_0x5be425[_0x3900('0x4b')])?ut[_0x3900('0x121')](_0x5be425[_0x3900('0x4b')][_0x3900('0x122')],_0x5be425['dialOriginateCallerIdName'],_0x5be425['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x5be425[_0x3900('0x2f')],_0x5be425[_0x3900('0x123')]):_0x5be425[_0x3900('0x2f')]):ut[_0x3900('0x121')](_[_0x3900('0x67')](_0x5be425['TrunkBackup'])?_0x5be425['Trunk'][_0x3900('0x122')]:_0x5be425[_0x3900('0x92')][_0x3900('0x122')],_0x5be425[_0x3900('0x124')],_0x5be425[_0x3900('0x123')]>0x0?ut['getCallerIdRandom'](_0x5be425[_0x3900('0x2f')],_0x5be425[_0x3900('0x123')]):_0x5be425['dialOriginateCallerIdNumber']);if(_0x3d5ea8){_0x32225f['originatecalleridname']=ut[_0x3900('0x125')](_0x3d5ea8);_0x32225f['originatecalleridnum']=ut[_0x3900('0x126')](_0x3d5ea8);}var _0x4e546a=ut[_0x3900('0x127')](_0x5be425,_0x4cf29d,_0x1c682e,_0x3d5ea8,_0x432da1,_0x32225f);_['merge'](_0x32225f,ut[_0x3900('0x128')](_0x4e546a));_0x32225f['starttime']=moment()[_0x3900('0x4f')](_0x3900('0x85'));ami['Action'](ut[_0x3900('0x129')](_0x32225f,_0x5be425,_0x4e546a,_0x32225f[_0x3900('0xa3')],_0x3d1438))[_0x3900('0x7d')](function(_0x4b9b54){var _0x2669a7=_0x32225f[_0x3900('0x12a')];if(!_['isNil'](_0x2669a7)){if(!_[_0x3900('0x67')](_0xb848fc[_0x3900('0x16')][_0x2669a7])){_0xb848fc['agents'][_0x2669a7][_0x3900('0x12b')]=_0x32225f['calleridnum'];emit(util[_0x3900('0x4f')](_0x3900('0x12c'),_0xb848fc[_0x3900('0x16')][_0x2669a7]['name']),'user:agentconnect',{'destaccountcode':_0xb848fc[_0x3900('0x16')][_0x2669a7][_0x3900('0x12d')],'destconnectedlinenum':_0x32225f['calleridnum']});}}_0x5be425[_0x3900('0x57')]+=0x1;logger['info'](_0x3900('0x12e'),_0x432da1,_0x3900('0xa7'),_0x5be425[_0x3900('0x24')],_0x3900('0x6a'),_0x5be425[_0x3900('0x57')]);_0x460911(_0x4b9b54);})[_0x3900('0x74')](function(_0x2ec195){ut[_0x3900('0xea')](_0x32225f,0xe,_0x3900('0x12f'));rpcDb['createAgentHistory'](_0x32225f,_0x3900('0x130'));_0x27c902(_0x2ec195);});});};Preview[_0x3900('0xf')]['syncNewExten']=function(_0x19742e){if(this[_0x3900('0x15')][_0x19742e[_0x3900('0xa4')]]){this[_0x3900('0x15')][_0x19742e['linkedid']][_0x3900('0x131')]=_0x19742e[_0x3900('0x131')];}};Preview['prototype'][_0x3900('0x19')]=function(_0x1fdcb4){var _0x26bf56=this;var _0x38c8f6=this['actions'][_0x1fdcb4['actionid']];if(_0x38c8f6){if(_0x38c8f6[_0x3900('0xf8')]&&this[_0x3900('0x16')][_0x38c8f6[_0x3900('0xf8')]]){ut[_0x3900('0x132')](_0x38c8f6,this[_0x3900('0x16')][_0x38c8f6[_0x3900('0xf8')]][_0x3900('0x24')],this[_0x3900('0x16')][_0x38c8f6[_0x3900('0xf8')]]['id']);}var _0x506e9a=_[_0x3900('0x133')](_0x38c8f6);_0x506e9a['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x38a93a=_0x26bf56[_0x3900('0x5f')][_0x38c8f6[_0x3900('0x6b')]];if(ut[_0x3900('0x134')](_0x1fdcb4[_0x3900('0x135')])){if(_0x38c8f6[_0x3900('0xa2')]){rpcDb[_0x3900('0x109')](_0x38c8f6[_0x3900('0xfd')]);}if(_0x38c8f6[_0x3900('0xa3')]){rpcDb[_0x3900('0x10a')](_0x38c8f6[_0x3900('0xfd')]);}ami[_0x3900('0x22')](_0x3900('0x136'),ut[_0x3900('0x97')](_0x38c8f6,_0x3900('0x137'),this['campaignsPreview'][_0x38c8f6[_0x3900('0x6b')]]));this[_0x3900('0xe6')](_0x506e9a,_0x38a93a,_0x1fdcb4);}else{_0x38c8f6[_0x3900('0x84')]=moment()[_0x3900('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x3900('0xea')](_0x506e9a,0x4,_0x3900('0xb0'));rpcDb[_0x3900('0xec')](_0x506e9a,_0x3900('0x138'));}}};Preview[_0x3900('0xf')][_0x3900('0x139')]=function(_0xe35fd){var _0x212fb5=this;var _0xe9ba8b=this[_0x3900('0x15')][_0xe35fd[_0x3900('0xa4')]];var _0x56c9c2;if(_0xe9ba8b){_0x56c9c2=this['campaignsPreview'][_0xe9ba8b[_0x3900('0x6b')]];logger[_0x3900('0x52')](_0x3900('0x13a'),_0xe35fd[_0x3900('0xa4')],_0x3900('0xa7'),_0x56c9c2[_0x3900('0x24')],_0x3900('0x6c'),_0x56c9c2['pTalking']);}if(this[_0x3900('0x15')][_0xe35fd[_0x3900('0xa4')]]&&_0xe35fd['linkedid']!==_0xe35fd[_0x3900('0xa6')]){if(_0xe35fd[_0x3900('0x13b')]==='16'&&this[_0x3900('0x15')][_0xe35fd['linkedid']][_0x3900('0x6d')]){this[_0x3900('0x95')](_0xe35fd,_0xe35fd[_0x3900('0xa4')],_0xe35fd[_0x3900('0x13b')]);}else if(this[_0x3900('0x15')][_0xe35fd[_0x3900('0xa4')]][_0x3900('0x6d')]){logger[_0x3900('0x52')]('[syncHangup][talking][cause]',_0xe35fd[_0x3900('0xa4')],_0xe35fd[_0x3900('0x13b')],_0x3900('0xa7'),_0x56c9c2['name'],_0x3900('0x6c'),_0x56c9c2['pTalking']);this['callProgressDetectingCustomer'](_0xe35fd,_0xe35fd['linkedid'],_0xe35fd[_0x3900('0x13b')]);}}else if(_0xe9ba8b&&_[_0x3900('0x67')](_0xe9ba8b[_0x3900('0x13c')])&&_0x56c9c2[_0x3900('0x13d')]&&_0xe35fd[_0x3900('0xa4')]===_0xe35fd[_0x3900('0xa6')]&&_[_0x3900('0x67')](_0xe35fd[_0x3900('0xe9')])&&_0xe35fd[_0x3900('0x13b')]==='16'&&_0xe35fd[_0x3900('0x13e')]==='6'&&_[_0x3900('0xe7')](_0xe9ba8b[_0x3900('0x13f')])){if(_0xe9ba8b[_0x3900('0xa2')]){rpcDb[_0x3900('0x109')](_0xe9ba8b[_0x3900('0xfd')]);}if(_0xe9ba8b[_0x3900('0xa3')]){rpcDb[_0x3900('0x10a')](_0xe9ba8b[_0x3900('0xfd')]);}_0xe35fd['reason']='22';this[_0x3900('0xe6')](_0xe9ba8b,_0x56c9c2,_0xe35fd);}else if(_0xe9ba8b&&_0xe9ba8b[_0x3900('0x13f')]){if(_0xe35fd['cause']==='16'&&this[_0x3900('0x15')][_0xe35fd['linkedid']][_0x3900('0x6d')]){logger[_0x3900('0x52')](_0x3900('0x140'),_0xe35fd[_0x3900('0xa4')],_0xe35fd[_0x3900('0x13b')],_0x3900('0xa7'),_0x56c9c2[_0x3900('0x24')],_0x3900('0x6c'),_0x56c9c2[_0x3900('0x27')]);this[_0x3900('0x95')](_0xe35fd,_0xe35fd['linkedid'],_0xe35fd['cause']);}else if(this[_0x3900('0x15')][_0xe35fd[_0x3900('0xa4')]][_0x3900('0x6d')]){logger[_0x3900('0x52')](_0x3900('0x141'),_0xe35fd[_0x3900('0xa4')],_0xe35fd[_0x3900('0x13b')],_0x3900('0xa7'),_0x56c9c2[_0x3900('0x24')],_0x3900('0x6c'),_0x56c9c2['pTalking']);this[_0x3900('0x95')](_0xe35fd,_0xe35fd['linkedid'],_0xe35fd['cause']);}}};Preview[_0x3900('0xf')][_0x3900('0x142')]=function(_0x13b753){if(this[_0x3900('0x15')][_0x13b753['destlinkedid']]&&_0x13b753[_0x3900('0x143')]!==_0x13b753['destuniqueid']){this['callProgressDetectingCustomer'](_0x13b753,_0x13b753[_0x3900('0x143')],_0x13b753[_0x3900('0xda')]);}};Preview[_0x3900('0xf')][_0x3900('0x1c')]=function(_0x92e530){if(this[_0x3900('0x15')][_0x92e530[_0x3900('0xa4')]]&&_0x92e530[_0x3900('0xa4')]!==_0x92e530['uniqueid']&&!this['actions'][_0x92e530[_0x3900('0xa4')]][_0x3900('0x6d')]){if(_0x92e530[_0x3900('0x13b')]==='1'){this[_0x3900('0x95')](_0x92e530,_0x92e530['linkedid'],_0x92e530[_0x3900('0x13b')]);}}};Preview[_0x3900('0xf')][_0x3900('0x144')]=function(_0x5aacac,_0x4585de,_0x1e0c7b){if(this[_0x3900('0x15')][_0x5aacac]){if(_['isNil'](this[_0x3900('0x15')][_0x5aacac][_0x3900('0x145')])){this[_0x3900('0x15')][_0x5aacac][_0x3900('0x145')]={};}this['actions'][_0x5aacac][_0x3900('0x145')][_0x4585de]=_0x1e0c7b;}};Preview['prototype'][_0x3900('0x1e')]=function(_0x41b1d2){try{if(!_['isNil'](_0x41b1d2)){if(ut[_0x3900('0x146')](_[_0x3900('0x147')](_0x41b1d2['variable'])[0x0])){this['addVariable'](_0x41b1d2['uniqueid'],_[_0x3900('0x147')](_0x41b1d2[_0x3900('0x148')])[0x0],_0x41b1d2[_0x3900('0x149')]);}}}catch(_0x29be21){logger['error'](_0x3900('0x14a'),util[_0x3900('0x14b')](_0x29be21,{'showHidden':![],'depth':null}));}};Preview[_0x3900('0xf')][_0x3900('0x20')]=function(_0x5ec3e3){if(_0x5ec3e3){if(this[_0x3900('0x15')][_0x5ec3e3['transfertargetlinkedid']]){this[_0x3900('0x15')][_0x5ec3e3[_0x3900('0x14c')]][_0x3900('0x13f')]=!![];}}};Preview[_0x3900('0xf')][_0x3900('0x14d')]=function(_0x55458c){if(_0x55458c){if(this[_0x3900('0x15')][_0x55458c[_0x3900('0x14e')]]){this[_0x3900('0x15')][_0x55458c[_0x3900('0x14e')]][_0x3900('0x13f')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xdf83=['dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','stringify','voice_queue:save','info','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','IS_DISACTIVED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','outbound','clearZombieChannels','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','contactId','ListId','Action','status','channel','catch','[clearZombieChannel]','dialAnswer','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','setMessage','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','countagentrejectretry','AgentReject','custom:agentreject','agentreject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','updateOriginated','[callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','channelAgent','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','clone','response','idContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','variable','keys','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','defaults','localhost','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','loopCampaigns','campaignsPreview','emit','name','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout'];(function(_0xa3c15b,_0x29a743){var _0x2ba867=function(_0x6da708){while(--_0x6da708){_0xa3c15b['push'](_0xa3c15b['shift']());}};_0x2ba867(++_0x29a743);}(_0xdf83,0x120));var _0x3df8=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0xdf83[_0x2a1b33];return _0x4c50e7;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x3df8('0x0'));var moment=require(_0x3df8('0x1'));var md5=require(_0x3df8('0x2'));var Redis=require(_0x3df8('0x3'));var config=require(_0x3df8('0x4'));var logger=require(_0x3df8('0x5'))(_0x3df8('0x6'));var loggerAction=require(_0x3df8('0x5'))(_0x3df8('0x7'));var ami=require(_0x3df8('0x8'));var rpcDb=require(_0x3df8('0x9'));var Action=require(_0x3df8('0xa'));var ut=require('./util/util');config[_0x3df8('0xb')]=_[_0x3df8('0xc')](config['redis'],{'host':_0x3df8('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x8503e1){this['tail']=this['tail']?this['tail']['finally'](_0x8503e1):_0x8503e1();};function Preview(_0x193560){this[_0x3df8('0xe')]=new Sequence();this['campaignsPreview']=_0x193560[_0x3df8('0xf')];this[_0x3df8('0x10')]=_0x193560[_0x3df8('0x10')];this[_0x3df8('0x11')]={};this[_0x3df8('0x12')]=_0x193560[_0x3df8('0x12')];this[_0x3df8('0x13')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x3df8('0x14')](this));ami['on'](_0x3df8('0x15'),this['syncHangup'][_0x3df8('0x14')](this));ami['on'](_0x3df8('0x16'),this[_0x3df8('0x17')][_0x3df8('0x14')](this));ami['on'](_0x3df8('0x18'),this[_0x3df8('0x19')][_0x3df8('0x14')](this));ami['on'](_0x3df8('0x1a'),this[_0x3df8('0x1b')][_0x3df8('0x14')](this));ami['on'](_0x3df8('0x1c'),this[_0x3df8('0x1d')][_0x3df8('0x14')](this));ami['on']('attendedtransfer',this[_0x3df8('0x1e')][_0x3df8('0x14')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x3df8('0x14')](this));this[_0x3df8('0x1f')](this[_0x3df8('0x20')]);}function emit(_0x345ae0,_0x3f62c2,_0x21de02){io['to'](_0x345ae0)[_0x3df8('0x21')](_0x3f62c2,_0x21de02);}function emitCampaignPreview(_0x17ea65){if(_0x17ea65['type']==='outbound'){var _0x52d8b3={'id':_0x17ea65['id'],'name':_0x17ea65[_0x3df8('0x22')],'strategy':_0x17ea65[_0x3df8('0x23')],'answered':_0x17ea65[_0x3df8('0x24')],'available':_0x17ea65['available'],'loggedIn':_0x17ea65[_0x3df8('0x25')],'pTalking':_0x17ea65[_0x3df8('0x26')],'sumBillable':_0x17ea65[_0x3df8('0x27')],'sumDuration':_0x17ea65['sumDuration'],'sumHoldTime':_0x17ea65[_0x3df8('0x28')]||0x0,'talking':_0x17ea65[_0x3df8('0x29')],'total':_0x17ea65[_0x3df8('0x2a')],'type':_0x17ea65[_0x3df8('0x2b')],'unmanaged':_0x17ea65[_0x3df8('0x2c')],'abandoned':_0x17ea65[_0x3df8('0x2d')],'waiting':_0x17ea65['waiting'],'loggedInDb':_0x17ea65[_0x3df8('0x2e')],'dialActive':_0x17ea65[_0x3df8('0x2f')],'dialMethod':_0x17ea65[_0x3df8('0x30')],'dialOriginateCallerIdName':_0x17ea65[_0x3df8('0x31')],'dialOriginateCallerIdNumber':_0x17ea65['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x17ea65[_0x3df8('0x32')],'dialPrefix':_0x17ea65[_0x3df8('0x33')],'outboundAnswerAgiCallsDay':_0x17ea65[_0x3df8('0x34')],'outboundAnswerCallsDay':_0x17ea65[_0x3df8('0x35')],'outboundBlacklistCallsDay':_0x17ea65['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x17ea65['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x17ea65[_0x3df8('0x36')],'outboundDropCallsDayACS':_0x17ea65[_0x3df8('0x37')],'outboundDropCallsDayCallersExit':_0x17ea65['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x17ea65['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x17ea65[_0x3df8('0x38')],'outboundNoSuchCallsDay':_0x17ea65['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x17ea65['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x17ea65[_0x3df8('0x39')],'outboundRejectCallsDay':_0x17ea65[_0x3df8('0x3a')],'outboundUnknownCallsDay':_0x17ea65[_0x3df8('0x3b')],'outboundAbandonedCallsDay':_0x17ea65['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x17ea65[_0x3df8('0x3c')],'predictiveIntervalAvgHoldtime':_0x17ea65[_0x3df8('0x3d')],'predictiveIntervalAvgTalktime':_0x17ea65[_0x3df8('0x3e')],'predictiveIntervalDroppedCallsCallersExit':_0x17ea65[_0x3df8('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x17ea65[_0x3df8('0x40')],'predictiveIntervalErlangCalls':_0x17ea65[_0x3df8('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x17ea65[_0x3df8('0x42')],'predictiveIntervalHitRate':_0x17ea65[_0x3df8('0x43')],'predictiveIntervalMultiplicativeFactor':_0x17ea65[_0x3df8('0x44')],'predictiveIntervalPauses':_0x17ea65['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x17ea65['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x17ea65[_0x3df8('0x45')],'message':_0x17ea65[_0x3df8('0x46')],'originated':_0x17ea65[_0x3df8('0x47')],'erlangCalls':_0x17ea65[_0x3df8('0x48')],'erlangCallToSecond':_0x17ea65[_0x3df8('0x49')],'erlangAbandonmentRate':_0x17ea65['erlangAbandonmentRate'],'erlangBusyFactor':_0x17ea65[_0x3df8('0x4a')],'startPredictive':_0x17ea65[_0x3df8('0x4b')],'startProgressive':_0x17ea65[_0x3df8('0x4c')]};if(_0x17ea65[_0x3df8('0x4d')]){_0x52d8b3['Trunk']={'id':_0x17ea65['Trunk']['id'],'name':_0x17ea65[_0x3df8('0x4d')][_0x3df8('0x22')],'active':_0x17ea65[_0x3df8('0x4d')]['active'],'callerid':_0x17ea65[_0x3df8('0x4d')]['callerid']};}if(_0x17ea65['Interval']){_0x52d8b3[_0x3df8('0x4e')]={'id':_0x17ea65[_0x3df8('0x4e')]['id'],'name':_0x17ea65[_0x3df8('0x4e')]['name']};}var _0x2ed241=md5(JSON[_0x3df8('0x4f')](_0x52d8b3));if(_0x17ea65['md5']!==_0x2ed241){_0x17ea65[_0x3df8('0x2')]=_0x2ed241;emit(util['format']('voice:queue:%s',_0x52d8b3[_0x3df8('0x22')]),_0x3df8('0x50'),_0x52d8b3);}}}function emitVoiceQueueChannelRemove(_0x139896){logger[_0x3df8('0x51')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x3df8('0x4f')](_0x139896));emit(util['format']('voice:queue:%s',_0x139896[_0x3df8('0x22')]),'voice_queue_channel:remove',_0x139896);io[_0x3df8('0x21')](_0x3df8('0x52'),_0x139896);}function notSendMessagesQueue(_0xa44cc0){if(_0xa44cc0[_0x3df8('0x53')]){if(_0xa44cc0['originated']===0x0&&_0xa44cc0[_0x3df8('0x26')]===0x0){_0xa44cc0[_0x3df8('0x53')]=![];_0xa44cc0[_0x3df8('0x54')]=0x0;_0xa44cc0[_0x3df8('0x55')]=0x0;_0xa44cc0['message']=_0x3df8('0x56');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xa44cc0[_0x3df8('0x22')]+'\x20is\x20not\x20active');}else{_0xa44cc0[_0x3df8('0x46')]=_0x3df8('0x57');ut[_0x3df8('0x58')](_0x3df8('0x59'),_0xa44cc0[_0x3df8('0x22')]+_0x3df8('0x5a'));}emitCampaignPreview(_0xa44cc0);}}Preview[_0x3df8('0x5b')][_0x3df8('0x1f')]=function(){var _0x5960b3=this;setInterval(function(){_0x5960b3[_0x3df8('0x5c')]();},0x7cf);};Preview[_0x3df8('0x5b')][_0x3df8('0x5c')]=function(){var _0x4af7da=this[_0x3df8('0x20')];this[_0x3df8('0x13')]+=0x1;for(var _0x30c61b in _0x4af7da){if(_0x4af7da[_0x3df8('0x5d')](_0x30c61b)&&(_0x4af7da[_0x30c61b][_0x3df8('0x30')]===_0x3df8('0x6')||_0x4af7da[_0x30c61b][_0x3df8('0x30')]==='booked')&&_0x4af7da[_0x30c61b][_0x3df8('0x2b')]===_0x3df8('0x5e')){if(this[_0x3df8('0x13')]>0x7){this[_0x3df8('0x13')]=0x0;this[_0x3df8('0x5f')]();}}if(_0x4af7da[_0x3df8('0x5d')](_0x30c61b)&&_0x4af7da[_0x30c61b]['dialMethod']===_0x3df8('0x6')&&_0x4af7da[_0x30c61b][_0x3df8('0x2b')]===_0x3df8('0x5e')){if(_0x4af7da[_0x30c61b][_0x3df8('0x2f')]){this['setMessage'](_0x4af7da[_0x30c61b]);this[_0x3df8('0x60')](_0x4af7da[_0x30c61b]);}else{notSendMessagesQueue(_0x4af7da[_0x30c61b]);}}}};Preview[_0x3df8('0x5b')][_0x3df8('0x61')]=function(_0x187a1b){var _0x19aad5=this;this[_0x3df8('0xe')][_0x3df8('0x62')](function(){if(!_[_0x3df8('0x63')](_0x19aad5[_0x3df8('0x11')][_0x187a1b])){loggerAction[_0x3df8('0x51')](_0x3df8('0x64'),_0x187a1b,_0x3df8('0x65'),_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x66')],_0x3df8('0x67'),JSON[_0x3df8('0x4f')](_0x19aad5[_0x3df8('0x20')][_0x19aad5[_0x3df8('0x11')][_0x187a1b]['queue']][_0x3df8('0x47')]),_0x3df8('0x68'),JSON['stringify'](_0x19aad5['campaignsPreview'][_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x66')]]['pTalking']),JSON[_0x3df8('0x4f')](_0x19aad5[_0x3df8('0x11')][_0x187a1b]['dialAnswer']),JSON['stringify'](_[_0x3df8('0x69')](_0x19aad5[_0x3df8('0x11')][_0x187a1b],[_0x3df8('0x6a'),'UserId','VoiceQueueId',_0x3df8('0x6b')])));return ami[_0x3df8('0x6c')]({'action':_0x3df8('0x6d'),'channel':_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x6e')]})[_0x3df8('0x6f')](function(_0x28f117){if(_0x28f117['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x19aad5[_0x3df8('0x11')][_0x187a1b]){ut['updateOriginated'](_0x19aad5[_0x3df8('0x20')][_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x66')]],_0x3df8('0x70'));if(_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x71')]===!![]){ut[_0x3df8('0x72')](_0x19aad5['campaignsPreview'][_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x66')]],'[clearZombieChannel]');ut['loggerError'](_0x3df8('0x73')+_0x187a1b,_0x19aad5[_0x3df8('0x11')][_0x187a1b][_0x3df8('0x66')]);}ut[_0x3df8('0x74')]('[Dialer][checkChannel][Preview]'+_0x187a1b,_0x19aad5['actions'][_0x187a1b][_0x3df8('0x66')]);delete _0x19aad5['actions'][_0x187a1b];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x315ffc=this;loggerAction[_0x3df8('0x51')]('[action]',_['size'](this['actions']));for(var _0x3af571 in this[_0x3df8('0x11')]){if(_0x315ffc[_0x3df8('0x11')][_0x3df8('0x5d')](_0x3af571)){_0x315ffc['clearZombieChannel'](_0x3af571);}}};Preview['prototype'][_0x3df8('0x60')]=function(_0x5ca768){var _0x297b91=this;rpcDb[_0x3df8('0x75')](_0x5ca768['id'],ut[_0x3df8('0x76')](this[_0x3df8('0x12')]))[_0x3df8('0x77')](function(_0x5dadac){if(!_['isNil'](_0x5dadac)){for(var _0x4a293d=0x0;_0x4a293d<_0x5dadac[_0x3df8('0x78')];_0x4a293d+=0x1){if(ut[_0x3df8('0x79')](_0x5dadac[_0x4a293d][_0x3df8('0x7a')])<_0x5ca768[_0x3df8('0x7b')]*0x3c){if(_0x5dadac[_0x4a293d]['Agent']&&!_0x5dadac[_0x4a293d]['Agent'][_0x3df8('0x7c')]){_0x297b91[_0x3df8('0x7d')](_0x5dadac[_0x4a293d]['id'])[_0x3df8('0x77')](ut[_0x3df8('0x7e')](_0x3df8('0x7f')))[_0x3df8('0x6f')](ut[_0x3df8('0x7e')](_0x3df8('0x7f')));}else{rpcDb[_0x3df8('0x80')](_0x5dadac[_0x4a293d]['id']);}}else{var _0x431309=new Action(_0x5dadac[_0x4a293d],_0x5ca768);_0x431309[_0x3df8('0x81')]=moment()[_0x3df8('0x82')](_0x3df8('0x83'));_0x5ca768[_0x3df8('0x39')]+=0x1;ut[_0x3df8('0x84')](_0x431309,0x17,_0x3df8('0x85'));if(_0x5ca768[_0x3df8('0x86')]){rpcDb[_0x3df8('0x87')](ut[_0x3df8('0x88')](_0x5dadac[_0x4a293d]));rpcDb['createCustomerHistory'](_0x431309,_0x3df8('0x89'));}else{ut['logCustomer'](_0x431309,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x431309,_0x3df8('0x8a'));rpcDb[_0x3df8('0x8b')](_0x431309,_0x3df8('0x8a'));}}}}})['catch'](ut[_0x3df8('0x7e')]('[getContactRecallMe]'));};Preview['prototype'][_0x3df8('0x8c')]=function(_0xeed5af){_0xeed5af['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0xeed5af['loggedIn'])){_0xeed5af[_0x3df8('0x46')]=_0x3df8('0x8d');}else if(!ut[_0x3df8('0x8e')](_0xeed5af['dialActive'])){_0xeed5af[_0x3df8('0x46')]=_0x3df8('0x56');}else if(!this[_0x3df8('0x8f')](_0xeed5af[_0x3df8('0x4d')])){if(!this[_0x3df8('0x8f')](_0xeed5af[_0x3df8('0x90')])){_0xeed5af[_0x3df8('0x46')]=_0x3df8('0x91');}else{_0xeed5af['message']='ACTIVE';}}else{_0xeed5af[_0x3df8('0x46')]=_0x3df8('0x92');}emitCampaignPreview(_0xeed5af);};Preview[_0x3df8('0x5b')]['callProgressDetectingCustomer']=function(_0x3540a3,_0x3f5c6e,_0x8b015a){var _0x485093=this;var _0x3a96b6=this['actions'][_0x3f5c6e];var _0x411521=this[_0x3df8('0x20')][_0x3a96b6[_0x3df8('0x66')]];var _0x21e899;if(_0x411521){switch(_0x8b015a){case'1':_0x411521[_0x3df8('0x93')]+=0x1;_0x3a96b6['countnosuchnumberretry']+=0x1;_0x3a96b6['countglobal']=ut[_0x3df8('0x94')](_0x3a96b6);ut['logCustomer'](_0x3a96b6,0x0,_0x3df8('0x95'));ami[_0x3df8('0x21')](_0x3df8('0x96'),ut['buildObj'](_0x3a96b6,'nosuchnumber'));rpcDb[_0x3df8('0x97')](_0x3a96b6,_0x3df8('0x98'));if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,_0x3df8('0x9c'));}else{if(_0x3a96b6[_0x3df8('0x9d')]>=_0x411521[_0x3df8('0x9e')]){rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0x9c'));}else{rpcDb[_0x3df8('0x9f')](ut[_0x3df8('0xa0')](_0x3a96b6,_0x3df8('0x9d'),_0x411521[_0x3df8('0xa1')]),_0x3a96b6[_0x3df8('0xa2')],_0x3a96b6[_0x3df8('0xa3')]);}}delete this[_0x3df8('0x11')][_0x3540a3['linkedid']];break;case _0x3df8('0xa4'):var _0x4d7717=moment()['format'](_0x3df8('0x83'));_0x3a96b6[_0x3df8('0xa5')]=_0x4d7717;_0x3a96b6[_0x3df8('0xa6')]=_0x4d7717;_0x3a96b6[_0x3df8('0x71')]=!![];_0x411521['pTalking']+=0x1;logger[_0x3df8('0x51')]('[syncHangup][talking][increment]',_0x3a96b6[_0x3df8('0xa7')],_0x3df8('0xa8'),_0x411521[_0x3df8('0x22')],_0x3df8('0x68'),_0x411521[_0x3df8('0x26')]);ami[_0x3df8('0x21')](_0x3df8('0xa9'),ut[_0x3df8('0xaa')](_0x3a96b6,_0x3df8('0xab'),this[_0x3df8('0x20')][_0x3a96b6['queue']]));if(_0x411521['acw']){ami['emit'](_0x3df8('0xac'),ut['buildAcw'](_0x3a96b6));}break;case'16':ami[_0x3df8('0x21')](_0x3df8('0xad'),ut[_0x3df8('0xaa')](_0x3a96b6,_0x3df8('0xae'),this[_0x3df8('0x20')][_0x3a96b6[_0x3df8('0x66')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x3a96b6,_0x3df8('0xae')));_0x411521[_0x3df8('0x35')]+=0x1;_0x411521[_0x3df8('0x2a')]+=0x1;_0x411521[_0x3df8('0x24')]+=0x1;ut[_0x3df8('0x72')](_0x411521,_0x3df8('0xaf'));_0x3a96b6[_0x3df8('0xb0')]=ut['totalGlobal'](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0x4,_0x3df8('0xb1'));rpcDb['createCustomerHistory'](_0x3a96b6,_0x3df8('0xb2'));rpcDb['createCustomerFinal'](_0x3a96b6,_0x3df8('0xb3'));rpcDb[_0x3df8('0xb4')](_0x3a96b6);_0x411521[_0x3df8('0xb5')]+=_0x3a96b6[_0x3df8('0xb6')];_0x411521[_0x3df8('0x27')]+=_0x3a96b6[_0x3df8('0xb6')];logger[_0x3df8('0x51')](_0x3df8('0xb7'),_0x3a96b6['uniqueid'],_0x3df8('0xa8'),_0x411521[_0x3df8('0x22')],_0x3df8('0x68'),_0x411521[_0x3df8('0x26')]);delete this[_0x3df8('0x11')][_0x3540a3[_0x3df8('0xb8')]];break;case _0x3df8('0xb9'):_0x411521[_0x3df8('0xba')]+=0x1;_0x3a96b6[_0x3df8('0xbb')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut['totalGlobal'](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0x5,'Busy');ami['emit'](_0x3df8('0xbc'),ut[_0x3df8('0xaa')](_0x3a96b6,_0x3df8('0xbd')));rpcDb[_0x3df8('0x97')](_0x3a96b6,_0x3df8('0xbe'));if(ut['totalGlobal'](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3a96b6['countbusyretry']>=_0x411521[_0x3df8('0xbf')]){rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0xbe'));}else{rpcDb[_0x3df8('0x9f')](ut[_0x3df8('0xa0')](_0x3a96b6,_0x3df8('0xbb'),_0x411521['dialBusyRetryFrequency']),_0x3a96b6[_0x3df8('0xa2')],_0x3a96b6[_0x3df8('0xa3')]);}}break;case _0x3df8('0xc0'):_0x411521[_0x3df8('0x38')]+=0x1;_0x3a96b6[_0x3df8('0xc1')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut[_0x3df8('0x94')](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0x3,_0x3df8('0xc2'));ami[_0x3df8('0x21')](_0x3df8('0xc3'),ut['buildObj'](_0x3a96b6,_0x3df8('0xc4')));rpcDb[_0x3df8('0x97')](_0x3a96b6,_0x3df8('0xc5'));if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut['cloneAction'](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,_0x3df8('0xc6'));}else{if(_0x3a96b6[_0x3df8('0xc1')]>=_0x411521[_0x3df8('0xc7')]){rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0xc5'));}else{rpcDb[_0x3df8('0x9f')](ut[_0x3df8('0xa0')](_0x3a96b6,_0x3df8('0xc1'),_0x411521[_0x3df8('0xc8')]),_0x3a96b6[_0x3df8('0xa2')],_0x3a96b6['activeContact']);}}break;case _0x3df8('0xc9'):_0x411521['outboundCongestionCallsDay']+=0x1;_0x3a96b6[_0x3df8('0xca')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut['totalGlobal'](_0x3a96b6);ut['logCustomer'](_0x3a96b6,0x8,_0x3df8('0xcb'));ami[_0x3df8('0x21')](_0x3df8('0xcc'),ut[_0x3df8('0xaa')](_0x3a96b6,_0x3df8('0xcd')));rpcDb[_0x3df8('0x97')](_0x3a96b6,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,'Global');rpcDb[_0x3df8('0x8b')](_0x21e899,_0x3df8('0xce'));}else{if(_0x3a96b6[_0x3df8('0xca')]>=_0x411521[_0x3df8('0xcf')]){rpcDb['createCustomerFinal'](_0x3a96b6,_0x3df8('0xd0'));}else{rpcDb[_0x3df8('0x9f')](ut[_0x3df8('0xa0')](_0x3a96b6,_0x3df8('0xca'),_0x411521['dialBusyRetryFrequency']),_0x3a96b6[_0x3df8('0xa2')],_0x3a96b6[_0x3df8('0xa3')]);}}break;case'CANCEL':_0x411521[_0x3df8('0x3a')]+=0x1;_0x3a96b6[_0x3df8('0xd1')]+=0x1;_0x3a96b6['countglobal']=ut[_0x3df8('0x94')](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0x14,_0x3df8('0xd2'));ami['emit'](_0x3df8('0xd3'),ut[_0x3df8('0xaa')](_0x3a96b6,_0x3df8('0xd4')));rpcDb['createCustomerHistory'](_0x3a96b6,'[syncHangupRequest][logAgentReject]');if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut['cloneAction'](_0x3a96b6,0x14,_0x3df8('0xd2'));rpcDb['createCustomerFinal'](_0x21e899,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x3a96b6[_0x3df8('0xd1')]>=_0x411521[_0x3df8('0xd5')]){rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0xd6'));}else{rpcDb[_0x3df8('0x9f')](ut[_0x3df8('0xa0')](_0x3a96b6,_0x3df8('0xd1'),_0x411521[_0x3df8('0xd7')]),_0x3a96b6[_0x3df8('0xa2')],_0x3a96b6[_0x3df8('0xa3')]);}}break;case'ABANDONED':_0x411521['outboundAbandonedCallsDay']+=0x1;_0x3a96b6[_0x3df8('0xd8')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut[_0x3df8('0x94')](_0x3a96b6);ut['logCustomer'](_0x3a96b6,0xb,_0x3df8('0xd9'));rpcDb[_0x3df8('0x97')](_0x3a96b6,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3a96b6['countabandonedetry']>=_0x411521[_0x3df8('0xda')]){rpcDb[_0x3df8('0x8b')](_0x3a96b6,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x3df8('0x9f')](ut['scheduledAt'](_0x3a96b6,_0x3df8('0xd8'),_0x411521[_0x3df8('0xdb')]),_0x3a96b6['unlockAgent'],_0x3a96b6[_0x3df8('0xa3')]);}}break;case'18':_0x411521[_0x3df8('0x3b')]+=0x1;_0x3a96b6[_0x3df8('0xdc')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut[_0x3df8('0x94')](_0x3a96b6);ut['logCustomer'](_0x3a96b6,0x12,_0x3540a3['cause-txt']||_0x3540a3['dialstatus']);ami[_0x3df8('0x21')]('custom:amd',ut['buildObj'](_0x3a96b6,_0x3df8('0xdd')));rpcDb[_0x3df8('0x97')](_0x3a96b6,_0x3df8('0xde'));if(ut['totalGlobal'](_0x3a96b6)>=_0x411521[_0x3df8('0x99')]){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,'Global');rpcDb[_0x3df8('0x8b')](_0x21e899,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0xde'));}delete this[_0x3df8('0x11')][_0x3540a3[_0x3df8('0xb8')]];break;case'19':_0x411521[_0x3df8('0x3b')]+=0x1;_0x3a96b6[_0x3df8('0xb0')]=ut['totalGlobal'](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0x13,_0x3540a3[_0x3df8('0xdf')]||_0x3540a3[_0x3df8('0xe0')]);ami['emit'](_0x3df8('0xe1'),ut[_0x3df8('0xaa')](_0x3a96b6,'amd'));rpcDb[_0x3df8('0x97')](_0x3a96b6,'[callProgressDetectingCustomer][machine]');if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521['dialGlobalMaxRetry']){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,_0x3df8('0xe2'));}else{rpcDb[_0x3df8('0x8b')](_0x3a96b6,_0x3df8('0xe2'));}delete this[_0x3df8('0x11')][_0x3540a3['linkedid']];break;default:if(_0x3a96b6[_0x3df8('0x71')]){ut[_0x3df8('0x72')](_0x411521,_0x3df8('0xe3'));ut[_0x3df8('0x74')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x411521['name'],_0x3540a3);}_0x411521['outboundUnknownCallsDay']+=0x1;_0x3a96b6['countglobal']=ut[_0x3df8('0x94')](_0x3a96b6);ut[_0x3df8('0x84')](_0x3a96b6,0xc,_0x3540a3[_0x3df8('0xdf')]||_0x3540a3['dialstatus']);rpcDb[_0x3df8('0x97')](_0x3a96b6,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x3df8('0x94')](_0x3a96b6)>=_0x411521['dialGlobalMaxRetry']){_0x21e899=ut[_0x3df8('0x9a')](_0x3a96b6,0xf,_0x3df8('0x9b'));rpcDb[_0x3df8('0x8b')](_0x21e899,_0x3df8('0xe4'));}else{rpcDb['createCustomerFinal'](_0x3a96b6,_0x3df8('0xe4'));}delete this['actions'][_0x3540a3['linkedid']];}if(!(_0x3a96b6[_0x3df8('0x71')]&&_0x8b015a==='16')){ut['updateOriginated'](_0x411521,_0x3df8('0xe5'));logger[_0x3df8('0x51')](_0x3df8('0xe6'),_0x3a96b6[_0x3df8('0xa7')],_0x3df8('0xa8'),_0x411521[_0x3df8('0x22')],_0x3df8('0x67'),_0x411521[_0x3df8('0x47')]);}if(_0x8b015a!==_0x3df8('0xa4')){delete this[_0x3df8('0x11')][_0x3540a3['linkedid']];delete this[_0x3df8('0x11')][_0x3540a3[_0x3df8('0xe7')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x118d9,_0x151fe3,_0x5e96bb){if(_[_0x3df8('0xe8')](_0x151fe3)&&_0x3df8('0xe9')!==typeof _0x151fe3){return;}if(_[_0x3df8('0xe8')](_0x5e96bb)&&_0x3df8('0xe9')!==typeof _0x5e96bb){return;}switch(_0x5e96bb['reason']){case'0':ut[_0x3df8('0xea')](_0x118d9,0x0,_0x3df8('0x95'));rpcDb[_0x3df8('0xeb')](_0x118d9,_0x3df8('0xec'));break;case'3':ut[_0x3df8('0xea')](_0x118d9,0x3,_0x3df8('0xc2'));rpcDb['createAgentHistory'](_0x118d9,_0x3df8('0xed'));break;case'5':ut[_0x3df8('0xea')](_0x118d9,0x5,_0x3df8('0xee'));rpcDb['createAgentHistory'](_0x118d9,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x3df8('0xea')](_0x118d9,0x8,_0x3df8('0xcb'));rpcDb[_0x3df8('0xeb')](_0x118d9,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x3df8('0xea')](_0x118d9,0x16,_0x3df8('0xef'));rpcDb[_0x3df8('0xeb')](_0x118d9,_0x3df8('0xf0'));break;default:ut[_0x3df8('0xea')](_0x118d9,0xc,_0x5e96bb[_0x3df8('0xf1')]);rpcDb['createAgentHistory'](_0x118d9,_0x3df8('0xf2'));}ut[_0x3df8('0xf3')](_0x151fe3,_0x3df8('0xf4'));logger[_0x3df8('0x51')]('[originated][decrement][callProgressDetectingAgent]',_0x118d9[_0x3df8('0xa7')],'\x20Queue',_0x151fe3[_0x3df8('0x22')],_0x3df8('0x67'),_0x151fe3[_0x3df8('0x47')]);delete this[_0x3df8('0x11')][_0x118d9['uniqueid']];};Preview['prototype'][_0x3df8('0xf5')]=function(_0x90ab5b,_0x288f77,_0x5b2092,_0x3fe976,_0x5a7d45){var _0x54bbde=this;return new BPromise(function(_0x4fcd48,_0x1ae866){if(_[_0x3df8('0x63')](_0x288f77)||_[_0x3df8('0x63')](_0x288f77[_0x3df8('0xf6')])||_['isNil'](_0x288f77[_0x3df8('0xf6')][_0x3df8('0xf7')])||_[_0x3df8('0x63')](_0x288f77[_0x3df8('0xf8')])){_0x1ae866(ut['message'](_0x3df8('0xf9'),_0x3fe976,_0x5a7d45));return;}var _0x1e8d09=uuid['v4']();var _0x35b5e0=_0x54bbde[_0x3df8('0x20')][_0x288f77['Queue'][_0x3df8('0x22')]];var _0x1c051b=_0x5b2092?_0x54bbde['agents'][_0x5b2092]['id']:undefined;_0x54bbde[_0x3df8('0x11')][_0x1e8d09]=new Action(_0x288f77,_0x35b5e0,_0x1e8d09,_0x5b2092,_0x1c051b);var _0x4e1ac6=_0x54bbde[_0x3df8('0x11')][_0x1e8d09];_0x4e1ac6[_0x3df8('0xa2')]=_0x3fe976;_0x4e1ac6[_0x3df8('0xa3')]=_0x5a7d45;_0x4e1ac6['lookAgent']=_0x5b2092;if(_[_0x3df8('0xfa')](_0x90ab5b)){_0x54bbde[_0x3df8('0xfb')](_0x4e1ac6,_0x35b5e0,_0x288f77,_0x5b2092)[_0x3df8('0x77')](function(_0x143a12){logger[_0x3df8('0x51')](_0x3df8('0xfc'),'Queue:\x20'+_0x4e1ac6[_0x3df8('0x66')]+_0x3df8('0xfd')+_0x4e1ac6['idContact'],JSON[_0x3df8('0x4f')](_0x143a12));ami[_0x3df8('0x21')](_0x3df8('0xfe'),ut[_0x3df8('0xaa')](_0x4e1ac6,_0x3df8('0xff'),_0x54bbde[_0x3df8('0x20')][_0x4e1ac6[_0x3df8('0x66')]]));_0x4fcd48(ut['message'](_0x3df8('0x100')));})[_0x3df8('0x6f')](function(_0x219737){ut[_0x3df8('0x58')]('[Preview][execCall][failure]',_0x219737);_0x1ae866(ut[_0x3df8('0x46')](_0x3df8('0x101'),_0x3fe976,_0x5a7d45));});}else{_0x35b5e0['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x4e1ac6);rpcDb[_0x3df8('0x102')](_0x4e1ac6,_0x3df8('0x103'));delete _0x54bbde[_0x3df8('0x11')][_0x1e8d09];_0x1ae866(ut[_0x3df8('0x46')](_0x3df8('0x104'),_0x3fe976,_0x5a7d45));}});};Preview[_0x3df8('0x5b')][_0x3df8('0x8f')]=function(_0x2ce425){return!_[_0x3df8('0x63')](_0x2ce425)&&!_[_0x3df8('0x63')](_0x2ce425[_0x3df8('0x22')])&&!_['isNil'](_0x2ce425['active'])&&_0x2ce425[_0x3df8('0x105')]&&!_[_0x3df8('0x63')](this[_0x3df8('0x10')][util['format'](_0x3df8('0x106'),_0x2ce425[_0x3df8('0x22')])])&&!_[_0x3df8('0x63')](this[_0x3df8('0x10')][util[_0x3df8('0x82')](_0x3df8('0x106'),_0x2ce425[_0x3df8('0x22')])][_0x3df8('0x6d')])&&(this[_0x3df8('0x10')][util['format'](_0x3df8('0x106'),_0x2ce425[_0x3df8('0x22')])][_0x3df8('0x6d')]===_0x3df8('0x107')||this[_0x3df8('0x10')][util['format']('SIP/%s',_0x2ce425[_0x3df8('0x22')])][_0x3df8('0x6d')]===_0x3df8('0x108'));};Preview[_0x3df8('0x5b')][_0x3df8('0x7d')]=function(_0xc51796,_0x46f1fd){var _0x46cdd4=this;return new BPromise(function(_0x367b54,_0x411364){_0x46cdd4[_0x3df8('0x109')](_0xc51796,_0x46f1fd)['then'](function(_0x4c4149){_0x367b54(_['pick'](_0x4c4149,[_0x3df8('0x46')]));})['catch'](function(_0x579a47){if(_0x579a47['unlock']){rpcDb[_0x3df8('0x10a')](_0xc51796);}if(_0x579a47['active']){rpcDb['disableContact'](_0xc51796);}_0x411364(_[_0x3df8('0x69')](_0x579a47,[_0x3df8('0x46')]));});});};Preview['prototype'][_0x3df8('0x109')]=function(_0x42a49f,_0x1a8fb1){var _0x4bcc96=this;return new BPromise(function(_0xd6e9b7,_0x3fe4e8){var _0x564704,_0xe7f4c0;rpcDb[_0x3df8('0x10b')](_0x42a49f)[_0x3df8('0x77')](function(_0xf82887){if(!_[_0x3df8('0x63')](_0xf82887[0x0])){_0xe7f4c0=_0xf82887[0x0][_0x3df8('0x10c')]?![]:!![];_0x564704=_0xf82887[0x0][_0x3df8('0x10c')]?!![]:![];_0x564704=_0x1a8fb1?!![]:_0x564704;}var _0x3a13c0=_0x4bcc96[_0x3df8('0x10d')](_0xf82887);if(_0x3a13c0[_0x3df8('0x10e')]){rpcDb[_0x3df8('0x10f')](_[_0x3df8('0x69')](_0xf82887[0x0],[_0x3df8('0xf8'),'Contact.phone']))[_0x3df8('0x77')](function(_0x5eb74a){_0x4bcc96[_0x3df8('0xf5')](_0x5eb74a,_0xf82887[0x0],_0x1a8fb1,_0xe7f4c0,_0x564704)[_0x3df8('0x77')](function(_0x17c5d0){_0xd6e9b7(_0x17c5d0);})[_0x3df8('0x6f')](function(_0x496fe1){_0x3fe4e8(_0x496fe1);});})[_0x3df8('0x6f')](function(_0x5cfd41){ut[_0x3df8('0x58')](_0x3df8('0x110'),_0x5cfd41);_0x3fe4e8(ut[_0x3df8('0x46')]('Call\x20unsuccessful',_0xe7f4c0,_0x564704));});}else{_0x3fe4e8(ut[_0x3df8('0x46')](_0x3a13c0[_0x3df8('0x46')],_0xe7f4c0,_0x564704));}})[_0x3df8('0x6f')](function(_0x14ae28){ut[_0x3df8('0x58')](_0x3df8('0x111'),_0x14ae28);_0x3fe4e8(ut[_0x3df8('0x46')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x3df8('0x5b')][_0x3df8('0x10d')]=function(_0x5758a8){if(_[_0x3df8('0x63')](_0x5758a8)||_[_0x3df8('0xfa')](_0x5758a8)||!_[_0x3df8('0x63')](_0x5758a8[0x0][_0x3df8('0x112')])&&_[_0x3df8('0x63')](_0x5758a8[0x0][_0x3df8('0x112')]['name'])){ut[_0x3df8('0x58')](_0x3df8('0x113'),_0x5758a8);return{'isValid':![],'message':_0x3df8('0x114')};}var _0x4d200e=this[_0x3df8('0x20')][_0x5758a8[0x0][_0x3df8('0x65')][_0x3df8('0x22')]];_0x4d200e[_0x3df8('0x46')]=_0x3df8('0x92');if(_['isNil'](_0x4d200e)){ut[_0x3df8('0x58')](_0x3df8('0x115'),_0x4d200e);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x4d200e['Trunk'])){ut['logger'](_0x3df8('0x116'),_0x3df8('0x117')+_0x4d200e[_0x3df8('0x22')]+_0x3df8('0x118'));if(!this[_0x3df8('0x8f')](_0x4d200e[_0x3df8('0x90')])){ut[_0x3df8('0x58')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x4d200e[_0x3df8('0x22')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x3df8('0x119')};}}if(!ut[_0x3df8('0x8e')](_0x4d200e[_0x3df8('0x2f')])){ut[_0x3df8('0x58')](_0x3df8('0x11a'),_0x4d200e[_0x3df8('0x22')]+_0x3df8('0x11b'));return{'isValid':![],'message':_0x3df8('0x117')+_0x4d200e[_0x3df8('0x22')]+_0x3df8('0x11b')};}return{'isValid':!![],'message':_0x3df8('0x11c')};};Preview['prototype'][_0x3df8('0xfb')]=function(_0x4d5ef5,_0x291ef1,_0x4bba84,_0x5bfeba){var _0x575ed0=this;return new BPromise(function(_0x31a453,_0x349186){var _0x2cc21e=_0x4d5ef5[_0x3df8('0xa7')];var _0x25fda7=_0x575ed0[_0x3df8('0x8f')](_0x291ef1[_0x3df8('0x4d')])?util[_0x3df8('0x82')](_0x3df8('0x11d'),_0x291ef1[_0x3df8('0x4d')]['name'],_[_0x3df8('0x63')](_0x291ef1[_0x3df8('0x33')])?'':_0x291ef1[_0x3df8('0x33')]['trim']()||'',_0x291ef1[_0x3df8('0x11e')]>0x0?_0x4bba84['Contact']['phone'][_0x3df8('0x11f')](_0x291ef1[_0x3df8('0x11e')]):_0x4bba84['Contact'][_0x3df8('0xf7')]):util[_0x3df8('0x82')](_0x3df8('0x11d'),_[_0x3df8('0x63')](_0x291ef1[_0x3df8('0x90')])?_0x291ef1[_0x3df8('0x4d')][_0x3df8('0x22')]:_0x291ef1[_0x3df8('0x90')][_0x3df8('0x22')],_['isNil'](_0x291ef1[_0x3df8('0x33')])?'':_0x291ef1['dialPrefix']['trim']()||'',_0x291ef1[_0x3df8('0x11e')]>0x0?_0x4bba84[_0x3df8('0xf6')][_0x3df8('0xf7')][_0x3df8('0x11f')](_0x291ef1[_0x3df8('0x11e')]):_0x4bba84[_0x3df8('0xf6')][_0x3df8('0xf7')]);var _0x21084d=_0x575ed0[_0x3df8('0x8f')](_0x291ef1[_0x3df8('0x4d')])?ut['getCallerId'](_0x291ef1[_0x3df8('0x4d')][_0x3df8('0x120')],_0x291ef1[_0x3df8('0x31')],_0x291ef1[_0x3df8('0x121')]>0x0?ut[_0x3df8('0x122')](_0x291ef1[_0x3df8('0x123')],_0x291ef1['dialRandomLastDigitCallerIdNumber']):_0x291ef1[_0x3df8('0x123')]):ut[_0x3df8('0x124')](_['isNil'](_0x291ef1['TrunkBackup'])?_0x291ef1[_0x3df8('0x4d')][_0x3df8('0x120')]:_0x291ef1[_0x3df8('0x90')][_0x3df8('0x120')],_0x291ef1[_0x3df8('0x31')],_0x291ef1[_0x3df8('0x121')]>0x0?ut[_0x3df8('0x122')](_0x291ef1[_0x3df8('0x123')],_0x291ef1[_0x3df8('0x121')]):_0x291ef1[_0x3df8('0x123')]);if(_0x21084d){_0x4d5ef5[_0x3df8('0x125')]=ut[_0x3df8('0x126')](_0x21084d);_0x4d5ef5[_0x3df8('0x127')]=ut[_0x3df8('0x128')](_0x21084d);}var _0x317e85=ut[_0x3df8('0x129')](_0x291ef1,_0x4bba84,_0x25fda7,_0x21084d,_0x2cc21e,_0x4d5ef5);_[_0x3df8('0x12a')](_0x4d5ef5,ut[_0x3df8('0x12b')](_0x317e85));_0x4d5ef5[_0x3df8('0x81')]=moment()['format'](_0x3df8('0x83'));ami[_0x3df8('0x6c')](ut[_0x3df8('0x12c')](_0x4d5ef5,_0x291ef1,_0x317e85,_0x4d5ef5['activeContact'],_0x5bfeba))[_0x3df8('0x77')](function(_0x4b8a50){var _0x540c41=_0x4d5ef5[_0x3df8('0x12d')];if(!_[_0x3df8('0x63')](_0x540c41)){if(!_[_0x3df8('0x63')](_0x575ed0[_0x3df8('0x12')][_0x540c41])){_0x575ed0[_0x3df8('0x12')][_0x540c41]['destconnectedlinenum']=_0x4d5ef5[_0x3df8('0x12e')];emit(util[_0x3df8('0x82')](_0x3df8('0x12f'),_0x575ed0['agents'][_0x540c41][_0x3df8('0x22')]),_0x3df8('0x130'),{'destaccountcode':_0x575ed0[_0x3df8('0x12')][_0x540c41][_0x3df8('0x131')],'destconnectedlinenum':_0x4d5ef5['calleridnum']});}}_0x291ef1[_0x3df8('0x47')]+=0x1;logger[_0x3df8('0x51')](_0x3df8('0x132'),_0x2cc21e,_0x3df8('0xa8'),_0x291ef1[_0x3df8('0x22')],'originated:\x20',_0x291ef1[_0x3df8('0x47')]);_0x31a453(_0x4b8a50);})[_0x3df8('0x6f')](function(_0x11cfe6){ut[_0x3df8('0xea')](_0x4d5ef5,0xe,'OriginateError');rpcDb[_0x3df8('0xeb')](_0x4d5ef5,_0x3df8('0x133'));_0x349186(_0x11cfe6);});});};Preview['prototype']['syncNewExten']=function(_0xdac658){if(this[_0x3df8('0x11')][_0xdac658[_0x3df8('0xb8')]]){this['actions'][_0xdac658[_0x3df8('0xb8')]][_0x3df8('0x6e')]=_0xdac658['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x5b13ab){var _0x13c9ce=this;var _0x31158b=this[_0x3df8('0x11')][_0x5b13ab[_0x3df8('0x134')]];if(_0x31158b){if(_0x31158b['lookAgent']&&this[_0x3df8('0x12')][_0x31158b['lookAgent']]){ut['logLookAgent'](_0x31158b,this[_0x3df8('0x12')][_0x31158b[_0x3df8('0x135')]][_0x3df8('0x22')],this[_0x3df8('0x12')][_0x31158b[_0x3df8('0x135')]]['id']);}var _0x62d1dd=_[_0x3df8('0x136')](_0x31158b);_0x62d1dd[_0x3df8('0xa5')]=moment()[_0x3df8('0x82')](_0x3df8('0x83'));var _0x357797=_0x13c9ce[_0x3df8('0x20')][_0x31158b[_0x3df8('0x66')]];if(ut['isFailure'](_0x5b13ab[_0x3df8('0x137')])){if(_0x31158b[_0x3df8('0xa2')]){rpcDb[_0x3df8('0x10a')](_0x31158b['idContact']);}if(_0x31158b[_0x3df8('0xa3')]){rpcDb[_0x3df8('0x80')](_0x31158b[_0x3df8('0x138')]);}ami[_0x3df8('0x21')](_0x3df8('0x139'),ut[_0x3df8('0xaa')](_0x31158b,_0x3df8('0x13a'),this[_0x3df8('0x20')][_0x31158b[_0x3df8('0x66')]]));this[_0x3df8('0x13b')](_0x62d1dd,_0x357797,_0x5b13ab);}else{_0x31158b[_0x3df8('0x81')]=moment()[_0x3df8('0x82')](_0x3df8('0x83'));ut[_0x3df8('0xea')](_0x62d1dd,0x4,_0x3df8('0xb1'));rpcDb['createAgentHistory'](_0x62d1dd,_0x3df8('0x13c'));}}};Preview[_0x3df8('0x5b')][_0x3df8('0x13d')]=function(_0x3605be){var _0x31d1e9=this;var _0x145c16=this['actions'][_0x3605be[_0x3df8('0xb8')]];var _0x1e5eca;if(_0x145c16){_0x1e5eca=this['campaignsPreview'][_0x145c16[_0x3df8('0x66')]];logger[_0x3df8('0x51')](_0x3df8('0x13e'),_0x3605be[_0x3df8('0xb8')],_0x3df8('0xa8'),_0x1e5eca[_0x3df8('0x22')],_0x3df8('0x68'),_0x1e5eca[_0x3df8('0x26')]);}if(this[_0x3df8('0x11')][_0x3605be['linkedid']]&&_0x3605be[_0x3df8('0xb8')]!==_0x3605be[_0x3df8('0xa7')]){if(_0x3605be[_0x3df8('0x13f')]==='16'&&this[_0x3df8('0x11')][_0x3605be[_0x3df8('0xb8')]]['dialAnswer']){this[_0x3df8('0x140')](_0x3605be,_0x3605be[_0x3df8('0xb8')],_0x3605be[_0x3df8('0x13f')]);}else if(this['actions'][_0x3605be[_0x3df8('0xb8')]][_0x3df8('0x71')]){logger[_0x3df8('0x51')](_0x3df8('0x141'),_0x3605be[_0x3df8('0xb8')],_0x3605be[_0x3df8('0x13f')],_0x3df8('0xa8'),_0x1e5eca[_0x3df8('0x22')],'pTalking:\x20',_0x1e5eca['pTalking']);this[_0x3df8('0x140')](_0x3605be,_0x3605be['linkedid'],_0x3605be[_0x3df8('0x13f')]);}}else if(_0x145c16&&_[_0x3df8('0x63')](_0x145c16[_0x3df8('0x142')])&&_0x1e5eca[_0x3df8('0x143')]&&_0x3605be[_0x3df8('0xb8')]===_0x3605be['uniqueid']&&_[_0x3df8('0x63')](_0x3605be[_0x3df8('0xf1')])&&_0x3605be['cause']==='16'&&_0x3605be['channelstate']==='6'&&_[_0x3df8('0xe8')](_0x145c16['transfer'])){if(_0x145c16[_0x3df8('0xa2')]){rpcDb[_0x3df8('0x10a')](_0x145c16[_0x3df8('0x138')]);}if(_0x145c16[_0x3df8('0xa3')]){rpcDb[_0x3df8('0x80')](_0x145c16[_0x3df8('0x138')]);}_0x3605be[_0x3df8('0xf1')]='22';this[_0x3df8('0x13b')](_0x145c16,_0x1e5eca,_0x3605be);}else if(_0x145c16&&_0x145c16[_0x3df8('0x144')]){if(_0x3605be[_0x3df8('0x13f')]==='16'&&this[_0x3df8('0x11')][_0x3605be[_0x3df8('0xb8')]]['dialAnswer']){logger['info'](_0x3df8('0x145'),_0x3605be[_0x3df8('0xb8')],_0x3605be[_0x3df8('0x13f')],_0x3df8('0xa8'),_0x1e5eca[_0x3df8('0x22')],_0x3df8('0x68'),_0x1e5eca[_0x3df8('0x26')]);this[_0x3df8('0x140')](_0x3605be,_0x3605be[_0x3df8('0xb8')],_0x3605be['cause']);}else if(this['actions'][_0x3605be[_0x3df8('0xb8')]][_0x3df8('0x71')]){logger['info'](_0x3df8('0x141'),_0x3605be[_0x3df8('0xb8')],_0x3605be['cause'],'\x20Queue',_0x1e5eca['name'],_0x3df8('0x68'),_0x1e5eca[_0x3df8('0x26')]);this[_0x3df8('0x140')](_0x3605be,_0x3605be[_0x3df8('0xb8')],_0x3605be['cause']);}}};Preview[_0x3df8('0x5b')]['syncDialEnd']=function(_0x2fdd64){if(this[_0x3df8('0x11')][_0x2fdd64[_0x3df8('0xe7')]]&&_0x2fdd64[_0x3df8('0xe7')]!==_0x2fdd64[_0x3df8('0x146')]){this[_0x3df8('0x140')](_0x2fdd64,_0x2fdd64[_0x3df8('0xe7')],_0x2fdd64['dialstatus']);}};Preview[_0x3df8('0x5b')][_0x3df8('0x17')]=function(_0x2d7090){if(this[_0x3df8('0x11')][_0x2d7090[_0x3df8('0xb8')]]&&_0x2d7090[_0x3df8('0xb8')]!==_0x2d7090[_0x3df8('0xa7')]&&!this[_0x3df8('0x11')][_0x2d7090[_0x3df8('0xb8')]][_0x3df8('0x71')]){if(_0x2d7090[_0x3df8('0x13f')]==='1'){this[_0x3df8('0x140')](_0x2d7090,_0x2d7090[_0x3df8('0xb8')],_0x2d7090[_0x3df8('0x13f')]);}}};Preview[_0x3df8('0x5b')][_0x3df8('0x147')]=function(_0x29ee02,_0x83bdd7,_0x40dc67){if(this[_0x3df8('0x11')][_0x29ee02]){if(_[_0x3df8('0x63')](this[_0x3df8('0x11')][_0x29ee02][_0x3df8('0x148')])){this[_0x3df8('0x11')][_0x29ee02][_0x3df8('0x148')]={};}this['actions'][_0x29ee02][_0x3df8('0x148')][_0x83bdd7]=_0x40dc67;}};Preview[_0x3df8('0x5b')]['syncVarSet']=function(_0x5ece10){try{if(!_[_0x3df8('0x63')](_0x5ece10)){if(ut[_0x3df8('0x149')](_['keys'](_0x5ece10[_0x3df8('0x14a')])[0x0])){this['addVariable'](_0x5ece10[_0x3df8('0xa7')],_[_0x3df8('0x14b')](_0x5ece10['variable'])[0x0],_0x5ece10[_0x3df8('0x14c')]);}}}catch(_0x39fde2){logger['error'](_0x3df8('0x14d'),util[_0x3df8('0x14e')](_0x39fde2,{'showHidden':![],'depth':null}));}};Preview[_0x3df8('0x5b')][_0x3df8('0x1e')]=function(_0x23b746){if(_0x23b746){if(this[_0x3df8('0x11')][_0x23b746['transfertargetlinkedid']]){this[_0x3df8('0x11')][_0x23b746[_0x3df8('0x14f')]]['transfer']=!![];}}};Preview[_0x3df8('0x5b')][_0x3df8('0x150')]=function(_0xdd3da6){if(_0xdd3da6){if(this[_0x3df8('0x11')][_0xdd3da6[_0x3df8('0x151')]]){this[_0x3df8('0x11')][_0xdd3da6['transfererlinkedid']][_0x3df8('0x144')]=!![];}}};module[_0x3df8('0x152')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index f3e98cc..61e791e 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 _0x3310=['getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/voiceQueueRt','../rpc/agentReportPreview','inspect','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20'];(function(_0x26931c,_0x428970){var _0x15476f=function(_0x5085a5){while(--_0x5085a5){_0x26931c['push'](_0x26931c['shift']());}};_0x15476f(++_0x428970);}(_0x3310,0x108));var _0x0331=function(_0x34e896,_0xca7a03){_0x34e896=_0x34e896-0x0;var _0x2c765d=_0x3310[_0x34e896];return _0x2c765d;};'use strict';var util=require(_0x0331('0x0'));var BPromise=require(_0x0331('0x1'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require(_0x0331('0x2'));var cmHopperFinal=require(_0x0331('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x0331('0x4'));var agentReportPreview=require(_0x0331('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4cac78){return function(_0x3e6098){logger['error'](_0x4cac78,util[_0x0331('0x6')](_0x3e6098,{'showHidden':![],'depth':null}));};}function create(_0x2407eb){return BPromise[_0x0331('0x7')]()[_0x0331('0x8')](cmHopperHistory[_0x0331('0x9')](_0x2407eb))['catch'](loggerCatch(_0x0331('0xa')));}function createAgent(_0x1d4f10){return BPromise[_0x0331('0x7')]()[_0x0331('0x8')](agentReportPreview[_0x0331('0x9')](_0x1d4f10))[_0x0331('0xb')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x17e5d2){return BPromise[_0x0331('0x7')]()[_0x0331('0x8')](cmHopper[_0x0331('0xc')](_0x17e5d2,!![]))[_0x0331('0xb')](loggerCatch(_0x0331('0xd')));}exports[_0x0331('0xe')]=function(_0x2e72ae){return BPromise[_0x0331('0x7')]()[_0x0331('0x8')](cmHopperBlack[_0x0331('0xe')](_0x2e72ae))[_0x0331('0xb')](loggerCatch(_0x0331('0xf')));};exports['getContactPreview']=function(_0x22c7c9){return BPromise['resolve']()['then'](cmHopper[_0x0331('0x10')](_0x22c7c9))[_0x0331('0xb')](loggerCatch('[getContactPreview]\x20'));};exports[_0x0331('0x9')]=function(_0x513980,_0x3461c1){create(_0x513980)['catch'](loggerCatch(_0x3461c1));moveContact(_0x513980)[_0x0331('0xb')](loggerCatch(_0x3461c1));};exports[_0x0331('0x11')]=function(_0x3436fb,_0x1115ef){createAgent(_0x3436fb)['catch'](loggerCatch(_0x1115ef));};exports['createCustomerHistory']=function(_0x301dde,_0x153cd5){create(_0x301dde)[_0x0331('0xb')](loggerCatch(_0x153cd5));};exports[_0x0331('0x12')]=function(_0x3374e5,_0xaa7d73){moveContact(_0x3374e5)[_0x0331('0xb')](loggerCatch(_0xaa7d73));};exports[_0x0331('0x13')]=function(_0x37c98f,_0x4c4b52,_0x379ee6){if(_0x4c4b52){_0x37c98f['UserId']=null;}if(_0x379ee6){_0x37c98f[_0x0331('0x14')]=![];}return BPromise[_0x0331('0x7')]()[_0x0331('0x8')](cmHopper[_0x0331('0x13')](_0x37c98f))[_0x0331('0xb')](loggerCatch(_0x0331('0x15')));};exports[_0x0331('0x16')]=function(_0x15230b){return BPromise[_0x0331('0x7')]()[_0x0331('0x8')](cmHopper[_0x0331('0x16')](_0x15230b))[_0x0331('0xb')](loggerCatch(_0x0331('0x17')));};exports[_0x0331('0x18')]=function(_0x23ccb1){return BPromise[_0x0331('0x7')]()[_0x0331('0x8')](cmHopper['unlockContact']({'UserId':null},_0x23ccb1,0x1))[_0x0331('0xb')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x18080a){return BPromise['resolve']()[_0x0331('0x8')](cmHopper[_0x0331('0x18')]({'active':![]},_0x18080a,0x1))[_0x0331('0xb')](loggerCatch('[activeContact]\x20'));};exports[_0x0331('0x19')]=function(_0x532bd2){var _0x2c8000={};_0x2c8000['type']=_0x532bd2[_0x0331('0x1a')];_0x2c8000['uniqueid']=_0x532bd2[_0x0331('0x1b')];_0x2c8000[_0x0331('0x1c')]=_0x532bd2['calleridnum'];_0x2c8000[_0x0331('0x1d')]=_0x532bd2[_0x0331('0x1d')];_0x2c8000[_0x0331('0x1e')]=_0x532bd2['queue'];_0x2c8000[_0x0331('0x1f')]=_0x532bd2[_0x0331('0x20')];_0x2c8000[_0x0331('0x21')]=_0x532bd2['answertime'];_0x2c8000[_0x0331('0x22')]=0x1;_0x2c8000[_0x0331('0x23')]=_0x532bd2[_0x0331('0x24')];_0x2c8000[_0x0331('0x25')]=_0x532bd2[_0x0331('0x26')];_0x2c8000[_0x0331('0x27')]='from-sip';_0x2c8000[_0x0331('0x28')]='xcally-motion-preview';_0x2c8000[_0x0331('0x29')]=0x0;_0x2c8000[_0x0331('0x2a')]=0x1;_0x2c8000[_0x0331('0x2b')]=_0x532bd2[_0x0331('0x26')];_0x2c8000[_0x0331('0x2c')]=_0x0331('0x2d');return BPromise[_0x0331('0x7')]()[_0x0331('0x8')](voiceQueueReport[_0x0331('0x2e')](_0x2c8000))[_0x0331('0xb')](loggerCatch(_0x0331('0x2f')));};exports['getContactRecallMe']=function(_0x296d88,_0xffdcf9){return BPromise[_0x0331('0x7')]()[_0x0331('0x8')](cmHopper[_0x0331('0x30')](_0x296d88,_0xffdcf9))['catch'](loggerCatch(_0x0331('0x31')));};exports[_0x0331('0x32')]=function(_0x19a89e){return BPromise[_0x0331('0x7')]()['then'](cmHopper[_0x0331('0x13')](_0x19a89e,!![],!![]))[_0x0331('0xb')](loggerCatch(_0x0331('0x33')));}; \ No newline at end of file +var _0xfa09=['exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','[createHistory]\x20','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xfa09,0x76));var _0x9fa0=function(_0x2e10e7,_0x1fed41){_0x2e10e7=_0x2e10e7-0x0;var _0x4250d8=_0xfa09[_0x2e10e7];return _0x4250d8;};'use strict';var util=require(_0x9fa0('0x0'));var BPromise=require('bluebird');var logger=require(_0x9fa0('0x1'))('preview');var _=require(_0x9fa0('0x2'));var cmHopper=require(_0x9fa0('0x3'));var cmHopperFinal=require(_0x9fa0('0x4'));var cmHopperHistory=require(_0x9fa0('0x5'));var cmHopperBlack=require(_0x9fa0('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x9fa0('0x7'));var voiceQueueReport=require(_0x9fa0('0x8'));function loggerCatch(_0x61535f){return function(_0x5b19d1){logger[_0x9fa0('0x9')](_0x61535f,util[_0x9fa0('0xa')](_0x5b19d1,{'showHidden':![],'depth':null}));};}function create(_0x5e7615){return BPromise[_0x9fa0('0xb')]()['then'](cmHopperHistory[_0x9fa0('0xc')](_0x5e7615))['catch'](loggerCatch(_0x9fa0('0xd')));}function createAgent(_0x174b76){return BPromise['resolve']()[_0x9fa0('0xe')](agentReportPreview[_0x9fa0('0xc')](_0x174b76))[_0x9fa0('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3a3dee){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x10')](_0x3a3dee,!![]))[_0x9fa0('0xf')](loggerCatch(_0x9fa0('0x11')));}exports[_0x9fa0('0x12')]=function(_0x10f432){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopperBlack[_0x9fa0('0x12')](_0x10f432))['catch'](loggerCatch(_0x9fa0('0x13')));};exports[_0x9fa0('0x14')]=function(_0x5c258e){return BPromise['resolve']()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x14')](_0x5c258e))[_0x9fa0('0xf')](loggerCatch('[getContactPreview]\x20'));};exports[_0x9fa0('0xc')]=function(_0xa54b3d,_0x7c3d09){create(_0xa54b3d)['catch'](loggerCatch(_0x7c3d09));moveContact(_0xa54b3d)['catch'](loggerCatch(_0x7c3d09));};exports[_0x9fa0('0x15')]=function(_0x1e4a0e,_0x30b8cf){createAgent(_0x1e4a0e)[_0x9fa0('0xf')](loggerCatch(_0x30b8cf));};exports['createCustomerHistory']=function(_0xf89f19,_0x498070){create(_0xf89f19)['catch'](loggerCatch(_0x498070));};exports[_0x9fa0('0x16')]=function(_0xae6ea5,_0x148fdf){moveContact(_0xae6ea5)[_0x9fa0('0xf')](loggerCatch(_0x148fdf));};exports[_0x9fa0('0x17')]=function(_0x343997,_0x49ebec,_0x5d45c1){if(_0x49ebec){_0x343997['UserId']=null;}if(_0x5d45c1){_0x343997[_0x9fa0('0x18')]=![];}return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper['rescheduleContact'](_0x343997))[_0x9fa0('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x9fa0('0x19')]=function(_0x4c93ac){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x19')](_0x4c93ac))[_0x9fa0('0xf')](loggerCatch(_0x9fa0('0x1a')));};exports[_0x9fa0('0x1b')]=function(_0x3090f4){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper['unlockContact']({'UserId':null},_0x3090f4,0x1))[_0x9fa0('0xf')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x33cb96){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x1b')]({'active':![]},_0x33cb96,0x1))[_0x9fa0('0xf')](loggerCatch(_0x9fa0('0x1c')));};exports[_0x9fa0('0x1d')]=function(_0x3ddfed){var _0x5d7604={};_0x5d7604['type']=_0x3ddfed['type'];_0x5d7604[_0x9fa0('0x1e')]=_0x3ddfed['uniqueid'];_0x5d7604[_0x9fa0('0x1f')]=_0x3ddfed[_0x9fa0('0x1f')];_0x5d7604['calleridname']=_0x3ddfed[_0x9fa0('0x20')];_0x5d7604['queue']=_0x3ddfed[_0x9fa0('0x21')];_0x5d7604[_0x9fa0('0x22')]=_0x3ddfed['answertime'];_0x5d7604[_0x9fa0('0x23')]=_0x3ddfed['answertime'];_0x5d7604[_0x9fa0('0x24')]=0x1;_0x5d7604[_0x9fa0('0x25')]=_0x3ddfed[_0x9fa0('0x26')];_0x5d7604[_0x9fa0('0x27')]=_0x3ddfed['membername'];_0x5d7604[_0x9fa0('0x28')]='from-sip';_0x5d7604[_0x9fa0('0x29')]=_0x9fa0('0x2a');_0x5d7604[_0x9fa0('0x2b')]=0x0;_0x5d7604[_0x9fa0('0x2c')]=0x1;_0x5d7604[_0x9fa0('0x2d')]=_0x3ddfed[_0x9fa0('0x2e')];_0x5d7604[_0x9fa0('0x2f')]=_0x9fa0('0x30');return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](voiceQueueReport['create'](_0x5d7604))[_0x9fa0('0xf')](loggerCatch(_0x9fa0('0x31')));};exports[_0x9fa0('0x32')]=function(_0x24009c,_0x87e165){return BPromise['resolve']()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x32')](_0x24009c,_0x87e165))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x9fa0('0x33')]=function(_0x428080){return BPromise[_0x9fa0('0xb')]()[_0x9fa0('0xe')](cmHopper[_0x9fa0('0x17')](_0x428080,!![],!![]))[_0x9fa0('0xf')](loggerCatch(_0x9fa0('0x34')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index ac6b984..25e2283 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 _0x7c6f=['YYYY-MM-DD\x20HH:mm:ss','talktime','answertime','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','uniqueid','not_inuse','status','reachable','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','active','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','starttime','responsetime','endtime','logAgent','state','ringtime','logLookAgent','UserId','logCustomer'];(function(_0x684f8d,_0x35f431){var _0x1487d4=function(_0x342f8f){while(--_0x342f8f){_0x684f8d['push'](_0x684f8d['shift']());}};_0x1487d4(++_0x35f431);}(_0x7c6f,0x177));var _0xf7c6=function(_0x41acd1,_0x47ccf3){_0x41acd1=_0x41acd1-0x0;var _0x90f019=_0x7c6f[_0x41acd1];return _0x90f019;};'use strict';var util=require(_0xf7c6('0x0'));var _=require('lodash');var moment=require(_0xf7c6('0x1'));var logger=require('../../../../config/logger')(_0xf7c6('0x2'));var ipAgi=process[_0xf7c6('0x3')][_0xf7c6('0x4')]||_0xf7c6('0x5');function getSeconds(_0x332dd4,_0x310219){var _0x102e09=moment(_0x332dd4)['milliseconds'](0x0);var _0x554778=moment(_0x310219)[_0xf7c6('0x6')](0x0);return _0x102e09['diff'](_0x554778,_0xf7c6('0x7'));}exports[_0xf7c6('0x8')]=function(_0x5537bb){return function(_0x488e93){logger[_0xf7c6('0x9')](_0x5537bb,util[_0xf7c6('0xa')](_0x488e93,{'showHidden':![],'depth':null}));};};exports[_0xf7c6('0xb')]=function(_0x570648,_0x31deec){logger[_0xf7c6('0xc')](_0x570648,util[_0xf7c6('0xa')](_0x31deec,{'showHidden':![],'depth':null}));};exports[_0xf7c6('0xd')]=function(_0x47d6fe,_0x2a912b){logger[_0xf7c6('0x9')](_0x47d6fe,util[_0xf7c6('0xa')](_0x2a912b,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x85758a){return function(_0x21900b){logger[_0xf7c6('0xc')](_0x85758a,util[_0xf7c6('0xa')](_0x21900b,{'showHidden':![],'depth':null}));};};exports[_0xf7c6('0xe')]=function(_0x15ed79,_0x2f3c91,_0x579a88){return{'message':_0x15ed79,'unlock':_0x2f3c91,'active':_0x579a88};};exports[_0xf7c6('0xf')]=function(_0x29b016,_0x767392,_0x4ee033){if(!_[_0xf7c6('0x10')](_0x4ee033)&&_0xf7c6('0x11')===typeof _0x4ee033&&!_[_0xf7c6('0x12')](_0x4ee033)){if(!_[_0xf7c6('0x10')](_0x767392)&&_0xf7c6('0x11')===typeof _0x767392&&!_[_0xf7c6('0x12')](_0x767392)){return util[_0xf7c6('0x13')]('\x22%s\x22\x20<%s>',_0x767392,_0x4ee033);}return util[_0xf7c6('0x13')](_0xf7c6('0x14'),_0x4ee033,_0x4ee033);}if(!_['isUndefined'](_0x29b016)&&'string'===typeof _0x29b016&&!_[_0xf7c6('0x12')](_0x29b016)){return _0x29b016;}return _0xf7c6('0x15');};exports[_0xf7c6('0x16')]=function(_0x1a74f9){if(_[_0xf7c6('0x17')](_0x1a74f9)){return![];}return _0x1a74f9;};exports['addVariables']=function(_0x2f89e3,_0x111077,_0x51170b,_0x5e2559,_0x28cc66,_0x1d1b2b){var _0x36a6e6={'XMD-QUEUE':_0x111077[_0xf7c6('0x18')]?_0x111077['Queue'][_0xf7c6('0x19')]:'','XMD-CALLERID':_0x5e2559,'XMD-CALLERID-PREVIEW':_0x1d1b2b?util[_0xf7c6('0x13')](_0xf7c6('0x14'),_0x1d1b2b[_0xf7c6('0x1a')],_0x1d1b2b[_0xf7c6('0x1b')]):_0x5e2559,'XMD-DIALID':_0x28cc66,'XMD-CONTACTID':_0x111077[_0xf7c6('0x1c')],'XMD-CDRTYPE':_0xf7c6('0x1d'),'CALLERID(all)':_0x5e2559,'XMD-VOICEQUEUEID':_0x111077['VoiceQueueId'],'XMD-DIALCHANNEL':_0x51170b,'XMD-DIALTIMEOUT':_0x2f89e3[_0xf7c6('0x1e')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x2f89e3[_0xf7c6('0x1f')]?'g':'',_['isEmpty'](_0x2f89e3[_0xf7c6('0x20')])?'':_0xf7c6('0x21')),'XMD-DIALURL':_0x2f89e3[_0xf7c6('0x22')]||'','XMD-AGI':_0x2f89e3[_0xf7c6('0x23')]?util[_0xf7c6('0x13')](_0xf7c6('0x24'),ipAgi,_0x2f89e3[_0xf7c6('0x23')]):_0xf7c6('0x25'),'XMD-AGIAFTER':_0x2f89e3[_0xf7c6('0x1f')]?util['format'](_0xf7c6('0x24'),ipAgi,_0x2f89e3[_0xf7c6('0x1f')]):_0xf7c6('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x1d1b2b?_0x1d1b2b['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1d1b2b?_0x1d1b2b[_0xf7c6('0x26')]:'','XMD-DESTINATION':_0xf7c6('0x27')};if(!_[_0xf7c6('0x12')](_0x2f89e3['monitor_format'])){_0x36a6e6[util['format']('%s',_0xf7c6('0x28'))]=_0x2f89e3[_0xf7c6('0x20')];_0x36a6e6[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x28cc66;}if(_0x111077&&_0x111077[_0xf7c6('0x29')]){for(var _0x2e1a11 in _0x111077[_0xf7c6('0x29')]){if(_0x111077['Contact']['hasOwnProperty'](_0x2e1a11)){if(!_[_0xf7c6('0x17')](_0x111077['Contact'][_0x2e1a11])&&_0x2e1a11!=='id'&&_0x2e1a11!==_0xf7c6('0x2a')&&_0x2e1a11!==_0xf7c6('0x2b')&&_0x2e1a11!==_0xf7c6('0x2c')){_0x36a6e6[util['format'](_0xf7c6('0x2d'),_0xf7c6('0x2e'),_[_0xf7c6('0x2f')](_0x2e1a11))]=_0x111077['Contact'][_0x2e1a11];}}}}return _0x36a6e6;};exports[_0xf7c6('0x30')]=function(_0x40313b){var _0xe8bcab={};for(var _0x4b3b91 in _0x40313b){if(_0x40313b[_0xf7c6('0x31')](_0x4b3b91)){_0xe8bcab[util[_0xf7c6('0x13')]('%s',_[_0xf7c6('0x32')](_0x4b3b91))]=_0x40313b[_0x4b3b91];}}return{'variables':_0xe8bcab};};exports[_0xf7c6('0x33')]=function(_0x2276a7,_0x207f4e){if(!_['isNil'](_0x2276a7)){if(_0x2276a7[_0xf7c6('0x31')]('originated')){if(_0x2276a7[_0xf7c6('0x34')]>0x0){_0x2276a7['originated']-=0x1;}else{logger[_0xf7c6('0x9')](_0xf7c6('0x35'),_0x207f4e);}}}else{logger[_0xf7c6('0x9')](_0xf7c6('0x36'),_0x207f4e);}};exports[_0xf7c6('0x37')]=function(_0x40bacf){var _0x58de02=moment()[_0xf7c6('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x40bacf['state']=0xd;_0x40bacf[_0xf7c6('0x38')]='Blacklist';_0x40bacf[_0xf7c6('0x39')]=_0x58de02;_0x40bacf[_0xf7c6('0x3a')]=_0x58de02;_0x40bacf[_0xf7c6('0x3b')]=_0x58de02;};exports[_0xf7c6('0x3c')]=function(_0x44ac69,_0x2f9a69,_0x5e1c82){var _0x12df44=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x44ac69[_0xf7c6('0x3d')]=_0x2f9a69;_0x44ac69[_0xf7c6('0x38')]=_0x5e1c82;_0x44ac69[_0xf7c6('0x3a')]=_0x12df44;_0x44ac69[_0xf7c6('0x3e')]=getSeconds(_0x44ac69[_0xf7c6('0x3a')],_0x44ac69[_0xf7c6('0x39')]);};exports[_0xf7c6('0x3f')]=function(_0x2d8080,_0x2b66ba,_0x2cb80e){_0x2d8080['membername']=_0x2b66ba;_0x2d8080[_0xf7c6('0x40')]=_0x2cb80e;};exports[_0xf7c6('0x41')]=function(_0x341567,_0x439f30,_0x1eb49c){var _0x268390=moment()[_0xf7c6('0x13')](_0xf7c6('0x42'));_0x341567['state']=_0x439f30;_0x341567[_0xf7c6('0x38')]=_0x1eb49c;_0x341567[_0xf7c6('0x3a')]=_0x341567[_0xf7c6('0x3a')]?_0x341567[_0xf7c6('0x3a')]:_0x268390;_0x341567[_0xf7c6('0x3b')]=_0x341567[_0xf7c6('0x3b')]?_0x341567[_0xf7c6('0x3b')]:_0x268390;_0x341567[_0xf7c6('0x3e')]=getSeconds(_0x341567[_0xf7c6('0x3a')]||0x0,_0x341567['starttime']||0x0);_0x341567[_0xf7c6('0x43')]=_0x341567[_0xf7c6('0x44')]?getSeconds(_0x341567[_0xf7c6('0x3b')],_0x341567[_0xf7c6('0x44')]):0x0;};exports['isFailure']=function(_0x1ee7f4){return _0x1ee7f4==='Failure';};exports[_0xf7c6('0x45')]=function(_0x4406af,_0x14bc61,_0xf4494,_0x2fc10c,_0x24ce42){var _0x172f5f=_0x2fc10c?_0xf7c6('0x46'):_0x4406af['calleridname'];_0x172f5f=_0x24ce42?_0xf7c6('0x47'):_0x172f5f;return{'actionid':_0x4406af['uniqueid'],'action':_0xf7c6('0x48'),'channel':_0x4406af[_0xf7c6('0x49')],'callerid':util['format'](_0xf7c6('0x14'),_0x172f5f,_0x4406af[_0xf7c6('0x1b')]),'Exten':'xcally-motion-preview','Context':_0xf7c6('0x4a'),'Priority':'1','variable':_0xf4494,'timeout':(_0x14bc61[_0xf7c6('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4406af['uniqueid']};};exports['totalGlobal']=function(_0xae8888){return _0xae8888['countbusyretry']+_0xae8888[_0xf7c6('0x4c')]+_0xae8888[_0xf7c6('0x4d')]+_0xae8888[_0xf7c6('0x4e')]+_0xae8888[_0xf7c6('0x4f')];};exports[_0xf7c6('0x50')]=function(_0x441335){var _0x1993d6=_['clone'](_0x441335);_0x1993d6[_0xf7c6('0x3d')]=0xf;_0x1993d6[_0xf7c6('0x38')]=_0xf7c6('0x51');return _0x1993d6;};exports[_0xf7c6('0x52')]=function(_0x377010,_0x36c64d,_0x3638a0){var _0xb6d243={};_0xb6d243[_0x36c64d]=_0x377010[_0x36c64d];_0xb6d243['active']=![];_0xb6d243[_0xf7c6('0x53')]=moment()[_0xf7c6('0x54')](_0x3638a0,_0xf7c6('0x55'))[_0xf7c6('0x13')](_0xf7c6('0x42'));_0xb6d243[_0xf7c6('0x1c')]=_0x377010['ContactId'];_0xb6d243[_0xf7c6('0x56')]=_0x377010[_0xf7c6('0x56')];_0xb6d243[_0xf7c6('0x57')]=_0x377010['VoiceQueueId']||undefined;return _0xb6d243;};exports['decrementTalkink']=function(_0x579a2d,_0x54542b){if(!_[_0xf7c6('0x17')](_0x579a2d)){if(_0x579a2d[_0xf7c6('0x58')]>0x0){_0x579a2d[_0xf7c6('0x58')]-=0x1;}else{logger[_0xf7c6('0x9')](_0x54542b,_0xf7c6('0x59'));}}else{logger[_0xf7c6('0x9')](_0x54542b,_0xf7c6('0x5a'));}};exports[_0xf7c6('0x5b')]=function(_0x6671f4){if(_0x6671f4<=0x0){return!![];}return![];};exports[_0xf7c6('0x5c')]=function(_0x41adec,_0x5e3c5c,_0x7a1c2c){_0x41adec[_0xf7c6('0x5d')]=_0x5e3c5c;_0x41adec[_0xf7c6('0x19')]=_0x41adec[_0xf7c6('0x5e')];_0x41adec[_0xf7c6('0x5f')]=_0x41adec[_0xf7c6('0x49')];_0x41adec[_0xf7c6('0x60')]=_0xf7c6('0x61');if(_0x7a1c2c){_0x41adec['mandatoryDisposition']=_0x7a1c2c[_0xf7c6('0x62')];}return _0x41adec;};exports[_0xf7c6('0x63')]=function(_0xa0bc66){var _0x419c2a={};_0x419c2a['queue']=_0xa0bc66[_0xf7c6('0x5e')];_0x419c2a[_0xf7c6('0x5f')]=_0xa0bc66[_0xf7c6('0x49')];_0x419c2a['uniqueid']=_0xa0bc66[_0xf7c6('0x64')];return _0x419c2a;};exports['agentReadyId']=function(_0x523bd0){var _0x4517fd=[];for(var _0x348a08 in _0x523bd0){if(_0x523bd0[_0xf7c6('0x31')](_0x348a08)){if(!_['isNil'](_0x523bd0[_0x348a08])&&_0x523bd0[_0x348a08][_0xf7c6('0x3d')]===_0xf7c6('0x65')&&_0x523bd0[_0x348a08][_0xf7c6('0x66')]===_0xf7c6('0x67')){_0x4517fd['push'](_0x523bd0[_0x348a08]['id']);}}}return _0x4517fd;};exports[_0xf7c6('0x68')]=function(_0x4aad76){var _0x380ee2=moment()[_0xf7c6('0x6')](0x0);var _0x5cef0b=moment(_0x4aad76)[_0xf7c6('0x6')](0x0);return _0x380ee2['diff'](_0x5cef0b,_0xf7c6('0x7'));};exports['createBody']=function(_0x44c3b4){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x44c3b4[_0xf7c6('0x1c')],'ListId':_0x44c3b4['ListId'],'VoiceQueueId':_0x44c3b4['VoiceQueueId']||undefined,'CampaignId':_0x44c3b4[_0xf7c6('0x69')]||undefined};};exports[_0xf7c6('0x6a')]=function(_0x1c890f){if(_0x1c890f===_0xf7c6('0x64')||_0x1c890f===_0xf7c6('0x6b')||_0x1c890f===_0xf7c6('0x5e')||_0x1c890f===_0xf7c6('0x6c')||_0x1c890f===_0xf7c6('0x6d')||_0x1c890f===_0xf7c6('0x6e')||_0x1c890f===_0xf7c6('0x6f')||_0x1c890f===_0xf7c6('0x49')||_0x1c890f===_0xf7c6('0x1a')||_0x1c890f===_0xf7c6('0x70')||_0x1c890f==='calleridnum'||_0x1c890f==='scheduledat'||_0x1c890f===_0xf7c6('0x71')||_0x1c890f==='countcongestionretry'||_0x1c890f===_0xf7c6('0x4d')||_0x1c890f===_0xf7c6('0x72')||_0x1c890f===_0xf7c6('0x73')||_0x1c890f===_0xf7c6('0x74')||_0x1c890f===_0xf7c6('0x75')||_0x1c890f===_0xf7c6('0x76')||_0x1c890f===_0xf7c6('0x1c')||_0x1c890f==='ListId'||_0x1c890f===_0xf7c6('0x40')||_0x1c890f===_0xf7c6('0x57')||_0x1c890f===_0xf7c6('0x77')||_0x1c890f===_0xf7c6('0x78')||_0x1c890f===_0xf7c6('0x79')||_0x1c890f===_0xf7c6('0x7a')||_0x1c890f===_0xf7c6('0x7b')||_0x1c890f===_0xf7c6('0x7c')||_0x1c890f===_0xf7c6('0x7d')||_0x1c890f===_0xf7c6('0x7e')||_0x1c890f==='xmd-dialid'||_0x1c890f===_0xf7c6('0x7f')||_0x1c890f===_0xf7c6('0x80')||_0x1c890f===_0xf7c6('0x81')||_0x1c890f===_0xf7c6('0x82')||_0x1c890f===_0xf7c6('0x83')||_0x1c890f==='xmd-agi'||_0x1c890f==='rtpaudioqos'||_0x1c890f===_0xf7c6('0x84')||_0x1c890f===_0xf7c6('0x85')||_0x1c890f===_0xf7c6('0x86')||_0x1c890f===_0xf7c6('0x87')||_0x1c890f===_0xf7c6('0x88')||_0x1c890f===_0xf7c6('0x89')||_0x1c890f==='rtpaudioqosrttbridged'||_0x1c890f==='rtpaudioqos'||_0x1c890f===_0xf7c6('0x84')||_0x1c890f===_0xf7c6('0x85')||_0x1c890f===_0xf7c6('0x86')||_0x1c890f===_0xf7c6('0x87')||_0x1c890f===_0xf7c6('0x88')||_0x1c890f===_0xf7c6('0x89')||_0x1c890f==='rtpaudioqosrttbridged'||_0x1c890f===_0xf7c6('0x8a')||_0x1c890f===_0xf7c6('0x8b')||_0x1c890f==='state'||_0x1c890f===_0xf7c6('0x38')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2054fa,_0x1cb788){var _0x44cdd8,_0x5d17c8,_0x30b8fa;if(_0x1cb788<=0x0){_0x1cb788=0x1;}_0x44cdd8=new RegExp(_0xf7c6('0x8c')+_0x1cb788+'}$');_0x5d17c8=Math[_0xf7c6('0x8d')](0xa,_0x1cb788-0x1);_0x30b8fa=Math['pow'](0xa,_0x1cb788)-0x1;return util[_0xf7c6('0x13')]('%s',_[_0xf7c6('0x8e')](_0x2054fa,_0x44cdd8,_[_0xf7c6('0x8f')](_0x5d17c8,_0x30b8fa)));};exports[_0xf7c6('0x90')]=function(_0x524e7c){var _0x7dc6d4=_0x524e7c[_0xf7c6('0x91')](/"(.*?)"/);return _0x7dc6d4?_0x7dc6d4[0x1]:_0x524e7c;};exports[_0xf7c6('0x92')]=function(_0x56e027){var _0x1b14cc=_0x56e027[_0xf7c6('0x91')](/<(.*?)>/);return _0x1b14cc?_0x1b14cc[0x1]:_0x56e027;}; \ No newline at end of file +var _0x2b3e=['format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','inspect','logger','error','logger2','info','getCallerId','isUndefined','isEmpty','string','\x22%s\x22\x20<%s>'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2b3e,0x19d));var _0xe2b3=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2b3e[_0x5c351c];return _0x26f3b3;};'use strict';var util=require(_0xe2b3('0x0'));var _=require(_0xe2b3('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xe2b3('0x2'));var ipAgi=process[_0xe2b3('0x3')][_0xe2b3('0x4')]||_0xe2b3('0x5');function getSeconds(_0x20d17e,_0x37f822){var _0x4e8248=moment(_0x20d17e)['milliseconds'](0x0);var _0x240d35=moment(_0x37f822)[_0xe2b3('0x6')](0x0);return _0x4e8248[_0xe2b3('0x7')](_0x240d35,_0xe2b3('0x8'));}exports['loggerCatch']=function(_0x3fb724){return function(_0x399b17){logger['error'](_0x3fb724,util[_0xe2b3('0x9')](_0x399b17,{'showHidden':![],'depth':null}));};};exports[_0xe2b3('0xa')]=function(_0x3c455d,_0xeef479){logger['info'](_0x3c455d,util[_0xe2b3('0x9')](_0xeef479,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x23eb05,_0x194a0b){logger[_0xe2b3('0xb')](_0x23eb05,util[_0xe2b3('0x9')](_0x194a0b,{'showHidden':![],'depth':null}));};exports[_0xe2b3('0xc')]=function(_0xe59762){return function(_0x211bea){logger[_0xe2b3('0xd')](_0xe59762,util[_0xe2b3('0x9')](_0x211bea,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x556aeb,_0x4a1df7,_0x5a167){return{'message':_0x556aeb,'unlock':_0x4a1df7,'active':_0x5a167};};exports[_0xe2b3('0xe')]=function(_0x30b6af,_0x2b4cf8,_0x4fbf3e){if(!_[_0xe2b3('0xf')](_0x4fbf3e)&&'string'===typeof _0x4fbf3e&&!_[_0xe2b3('0x10')](_0x4fbf3e)){if(!_[_0xe2b3('0xf')](_0x2b4cf8)&&_0xe2b3('0x11')===typeof _0x2b4cf8&&!_['isEmpty'](_0x2b4cf8)){return util['format'](_0xe2b3('0x12'),_0x2b4cf8,_0x4fbf3e);}return util[_0xe2b3('0x13')]('\x22%s\x22\x20<%s>',_0x4fbf3e,_0x4fbf3e);}if(!_[_0xe2b3('0xf')](_0x30b6af)&&_0xe2b3('0x11')===typeof _0x30b6af&&!_['isEmpty'](_0x30b6af)){return _0x30b6af;}return _0xe2b3('0x14');};exports[_0xe2b3('0x15')]=function(_0x293609){if(_[_0xe2b3('0x16')](_0x293609)){return![];}return _0x293609;};exports[_0xe2b3('0x17')]=function(_0x4f8dc2,_0x2be64d,_0x1971c9,_0x3cc1c2,_0x39c3c5,_0x4a8cec){var _0x23ee53={'XMD-QUEUE':_0x2be64d[_0xe2b3('0x18')]?_0x2be64d[_0xe2b3('0x18')][_0xe2b3('0x19')]:'','XMD-CALLERID':_0x3cc1c2,'XMD-CALLERID-PREVIEW':_0x4a8cec?util[_0xe2b3('0x13')]('\x22%s\x22\x20<%s>',_0x4a8cec[_0xe2b3('0x1a')],_0x4a8cec[_0xe2b3('0x1b')]):_0x3cc1c2,'XMD-DIALID':_0x39c3c5,'XMD-CONTACTID':_0x2be64d['ContactId'],'XMD-CDRTYPE':_0xe2b3('0x1c'),'CALLERID(all)':_0x3cc1c2,'XMD-VOICEQUEUEID':_0x2be64d[_0xe2b3('0x1d')],'XMD-DIALCHANNEL':_0x1971c9,'XMD-DIALTIMEOUT':_0x4f8dc2['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xe2b3('0x13')](_0xe2b3('0x1e'),_0x4f8dc2[_0xe2b3('0x1f')]?'g':'',_[_0xe2b3('0x10')](_0x4f8dc2[_0xe2b3('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4f8dc2[_0xe2b3('0x21')]||'','XMD-AGI':_0x4f8dc2['dialQueueProject']?util[_0xe2b3('0x13')](_0xe2b3('0x22'),ipAgi,_0x4f8dc2[_0xe2b3('0x23')]):_0xe2b3('0x24'),'XMD-AGIAFTER':_0x4f8dc2[_0xe2b3('0x1f')]?util['format'](_0xe2b3('0x22'),ipAgi,_0x4f8dc2['dialQueueProject2']):_0xe2b3('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x4a8cec?_0x4a8cec['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x4a8cec?_0x4a8cec[_0xe2b3('0x25')]:'','XMD-DESTINATION':_0xe2b3('0x26')};if(!_[_0xe2b3('0x10')](_0x4f8dc2['monitor_format'])){_0x23ee53[util[_0xe2b3('0x13')]('%s',_0xe2b3('0x27'))]=_0x4f8dc2[_0xe2b3('0x20')];_0x23ee53[util[_0xe2b3('0x13')]('%s',_0xe2b3('0x28'))]=_0x39c3c5;}if(_0x2be64d&&_0x2be64d[_0xe2b3('0x29')]){for(var _0x1cd113 in _0x2be64d[_0xe2b3('0x29')]){if(_0x2be64d['Contact'][_0xe2b3('0x2a')](_0x1cd113)){if(!_[_0xe2b3('0x16')](_0x2be64d[_0xe2b3('0x29')][_0x1cd113])&&_0x1cd113!=='id'&&_0x1cd113!=='tags'&&_0x1cd113!==_0xe2b3('0x2b')&&_0x1cd113!==_0xe2b3('0x2c')){_0x23ee53[util[_0xe2b3('0x13')]('%s%s',_0xe2b3('0x2d'),_[_0xe2b3('0x2e')](_0x1cd113))]=_0x2be64d['Contact'][_0x1cd113];}}}}return _0x23ee53;};exports[_0xe2b3('0x2f')]=function(_0x3c38bd){var _0x14e480={};for(var _0x208d45 in _0x3c38bd){if(_0x3c38bd[_0xe2b3('0x2a')](_0x208d45)){_0x14e480[util['format']('%s',_[_0xe2b3('0x30')](_0x208d45))]=_0x3c38bd[_0x208d45];}}return{'variables':_0x14e480};};exports[_0xe2b3('0x31')]=function(_0x1a7dfb,_0x344a78){if(!_['isNil'](_0x1a7dfb)){if(_0x1a7dfb[_0xe2b3('0x2a')](_0xe2b3('0x32'))){if(_0x1a7dfb[_0xe2b3('0x32')]>0x0){_0x1a7dfb[_0xe2b3('0x32')]-=0x1;}else{logger[_0xe2b3('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x344a78);}}}else{logger[_0xe2b3('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x344a78);}};exports[_0xe2b3('0x33')]=function(_0x1cff5c){var _0x2a1893=moment()[_0xe2b3('0x13')](_0xe2b3('0x34'));_0x1cff5c[_0xe2b3('0x35')]=0xd;_0x1cff5c[_0xe2b3('0x36')]='Blacklist';_0x1cff5c[_0xe2b3('0x37')]=_0x2a1893;_0x1cff5c[_0xe2b3('0x38')]=_0x2a1893;_0x1cff5c[_0xe2b3('0x39')]=_0x2a1893;};exports['logAgent']=function(_0x48fb83,_0x2126f4,_0xe350e5){var _0x190b86=moment()[_0xe2b3('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x48fb83[_0xe2b3('0x35')]=_0x2126f4;_0x48fb83[_0xe2b3('0x36')]=_0xe350e5;_0x48fb83['responsetime']=_0x190b86;_0x48fb83[_0xe2b3('0x3a')]=getSeconds(_0x48fb83[_0xe2b3('0x38')],_0x48fb83[_0xe2b3('0x37')]);};exports[_0xe2b3('0x3b')]=function(_0x4e72c7,_0x513704,_0x2858e8){_0x4e72c7[_0xe2b3('0x3c')]=_0x513704;_0x4e72c7[_0xe2b3('0x3d')]=_0x2858e8;};exports[_0xe2b3('0x3e')]=function(_0x406e70,_0x3e867b,_0x2ebbae){var _0x3e555d=moment()[_0xe2b3('0x13')](_0xe2b3('0x34'));_0x406e70['state']=_0x3e867b;_0x406e70[_0xe2b3('0x36')]=_0x2ebbae;_0x406e70[_0xe2b3('0x38')]=_0x406e70[_0xe2b3('0x38')]?_0x406e70[_0xe2b3('0x38')]:_0x3e555d;_0x406e70[_0xe2b3('0x39')]=_0x406e70['endtime']?_0x406e70[_0xe2b3('0x39')]:_0x3e555d;_0x406e70[_0xe2b3('0x3a')]=getSeconds(_0x406e70[_0xe2b3('0x38')]||0x0,_0x406e70[_0xe2b3('0x37')]||0x0);_0x406e70[_0xe2b3('0x3f')]=_0x406e70['answertime']?getSeconds(_0x406e70[_0xe2b3('0x39')],_0x406e70[_0xe2b3('0x40')]):0x0;};exports[_0xe2b3('0x41')]=function(_0x62df74){return _0x62df74===_0xe2b3('0x42');};exports[_0xe2b3('0x43')]=function(_0x16ce50,_0x24e093,_0x4fdb0f,_0x433b3d,_0x3e9360){var _0x4fb073=_0x433b3d?'RECALL':_0x16ce50['calleridname'];_0x4fb073=_0x3e9360?'BOOKED':_0x4fb073;return{'actionid':_0x16ce50[_0xe2b3('0x44')],'action':'originate','channel':_0x16ce50[_0xe2b3('0x45')],'callerid':util['format'](_0xe2b3('0x12'),_0x4fb073,_0x16ce50[_0xe2b3('0x1b')]),'Exten':_0xe2b3('0x26'),'Context':_0xe2b3('0x46'),'Priority':'1','variable':_0x4fdb0f,'timeout':(_0x24e093[_0xe2b3('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x16ce50[_0xe2b3('0x44')]};};exports[_0xe2b3('0x48')]=function(_0x24457b){return _0x24457b[_0xe2b3('0x49')]+_0x24457b['countcongestionretry']+_0x24457b[_0xe2b3('0x4a')]+_0x24457b[_0xe2b3('0x4b')]+_0x24457b['countnosuchnumberretry'];};exports[_0xe2b3('0x4c')]=function(_0x3287d5){var _0x298323=_[_0xe2b3('0x4d')](_0x3287d5);_0x298323['state']=0xf;_0x298323['statedesc']=_0xe2b3('0x4e');return _0x298323;};exports['scheduledAt']=function(_0x1cc69d,_0x2a20f2,_0x5050a5){var _0x8bb104={};_0x8bb104[_0x2a20f2]=_0x1cc69d[_0x2a20f2];_0x8bb104[_0xe2b3('0x4f')]=![];_0x8bb104[_0xe2b3('0x50')]=moment()[_0xe2b3('0x51')](_0x5050a5,_0xe2b3('0x52'))[_0xe2b3('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x8bb104['ContactId']=_0x1cc69d[_0xe2b3('0x53')];_0x8bb104[_0xe2b3('0x54')]=_0x1cc69d['ListId'];_0x8bb104['VoiceQueueId']=_0x1cc69d[_0xe2b3('0x1d')]||undefined;return _0x8bb104;};exports[_0xe2b3('0x55')]=function(_0xa964da,_0x16897c){if(!_[_0xe2b3('0x16')](_0xa964da)){if(_0xa964da[_0xe2b3('0x56')]>0x0){_0xa964da[_0xe2b3('0x56')]-=0x1;}else{logger[_0xe2b3('0xb')](_0x16897c,_0xe2b3('0x57'));}}else{logger[_0xe2b3('0xb')](_0x16897c,_0xe2b3('0x58'));}};exports[_0xe2b3('0x59')]=function(_0x163cc1){if(_0x163cc1<=0x0){return!![];}return![];};exports[_0xe2b3('0x5a')]=function(_0x43a61c,_0x39f78a,_0xb5a6de){_0x43a61c[_0xe2b3('0x5b')]=_0x39f78a;_0x43a61c[_0xe2b3('0x19')]=_0x43a61c[_0xe2b3('0x5c')];_0x43a61c[_0xe2b3('0x5d')]=_0x43a61c[_0xe2b3('0x45')];_0x43a61c[_0xe2b3('0x5e')]=_0xe2b3('0x5f');if(_0xb5a6de){_0x43a61c[_0xe2b3('0x60')]=_0xb5a6de[_0xe2b3('0x60')];}return _0x43a61c;};exports[_0xe2b3('0x61')]=function(_0x10bee0){var _0x3c41ad={};_0x3c41ad[_0xe2b3('0x5c')]=_0x10bee0[_0xe2b3('0x5c')];_0x3c41ad[_0xe2b3('0x5d')]=_0x10bee0['channelAgent'];_0x3c41ad[_0xe2b3('0x44')]=_0x10bee0[_0xe2b3('0x44')];return _0x3c41ad;};exports[_0xe2b3('0x62')]=function(_0xe05379){var _0x5d3c1a=[];for(var _0x2f7ab6 in _0xe05379){if(_0xe05379[_0xe2b3('0x2a')](_0x2f7ab6)){if(!_[_0xe2b3('0x16')](_0xe05379[_0x2f7ab6])&&_0xe05379[_0x2f7ab6]['state']===_0xe2b3('0x63')&&_0xe05379[_0x2f7ab6]['status']===_0xe2b3('0x64')){_0x5d3c1a['push'](_0xe05379[_0x2f7ab6]['id']);}}}return _0x5d3c1a;};exports[_0xe2b3('0x65')]=function(_0x5041d9){var _0x503223=moment()[_0xe2b3('0x6')](0x0);var _0x3fb85d=moment(_0x5041d9)[_0xe2b3('0x6')](0x0);return _0x503223[_0xe2b3('0x7')](_0x3fb85d,'seconds');};exports[_0xe2b3('0x66')]=function(_0x55c295){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x55c295[_0xe2b3('0x53')],'ListId':_0x55c295['ListId'],'VoiceQueueId':_0x55c295[_0xe2b3('0x1d')]||undefined,'CampaignId':_0x55c295[_0xe2b3('0x67')]||undefined};};exports[_0xe2b3('0x68')]=function(_0x48736c){if(_0x48736c===_0xe2b3('0x44')||_0x48736c===_0xe2b3('0x69')||_0x48736c===_0xe2b3('0x5c')||_0x48736c===_0xe2b3('0x6a')||_0x48736c===_0xe2b3('0x6b')||_0x48736c===_0xe2b3('0x6c')||_0x48736c===_0xe2b3('0x3c')||_0x48736c==='channelAgent'||_0x48736c==='calleridname'||_0x48736c===_0xe2b3('0x4f')||_0x48736c===_0xe2b3('0x1b')||_0x48736c===_0xe2b3('0x50')||_0x48736c===_0xe2b3('0x49')||_0x48736c===_0xe2b3('0x6d')||_0x48736c===_0xe2b3('0x4a')||_0x48736c===_0xe2b3('0x6e')||_0x48736c===_0xe2b3('0x6f')||_0x48736c===_0xe2b3('0x70')||_0x48736c===_0xe2b3('0x71')||_0x48736c===_0xe2b3('0x72')||_0x48736c===_0xe2b3('0x53')||_0x48736c===_0xe2b3('0x54')||_0x48736c===_0xe2b3('0x3d')||_0x48736c===_0xe2b3('0x1d')||_0x48736c==='sipcallid'||_0x48736c==='xmd-voicequeueid'||_0x48736c===_0xe2b3('0x73')||_0x48736c===_0xe2b3('0x74')||_0x48736c===_0xe2b3('0x75')||_0x48736c===_0xe2b3('0x76')||_0x48736c===_0xe2b3('0x77')||_0x48736c===_0xe2b3('0x78')||_0x48736c===_0xe2b3('0x79')||_0x48736c===_0xe2b3('0x7a')||_0x48736c==='xmd-contactid'||_0x48736c===_0xe2b3('0x7b')||_0x48736c===_0xe2b3('0x7c')||_0x48736c===_0xe2b3('0x7d')||_0x48736c===_0xe2b3('0x7e')||_0x48736c===_0xe2b3('0x7f')||_0x48736c===_0xe2b3('0x80')||_0x48736c===_0xe2b3('0x81')||_0x48736c===_0xe2b3('0x82')||_0x48736c==='rtpaudioqosloss'||_0x48736c===_0xe2b3('0x83')||_0x48736c===_0xe2b3('0x84')||_0x48736c===_0xe2b3('0x85')||_0x48736c===_0xe2b3('0x7f')||_0x48736c==='rtpaudioqosbridged'||_0x48736c==='rtpaudioqosjitter'||_0x48736c===_0xe2b3('0x82')||_0x48736c===_0xe2b3('0x86')||_0x48736c===_0xe2b3('0x83')||_0x48736c==='rtpaudioqosrtt'||_0x48736c===_0xe2b3('0x85')||_0x48736c===_0xe2b3('0x87')||_0x48736c===_0xe2b3('0x88')||_0x48736c===_0xe2b3('0x35')||_0x48736c===_0xe2b3('0x36')){return![];}return!![];};exports[_0xe2b3('0x89')]=function(_0x13505f,_0x2778d3){var _0x1ebce1,_0x1b8607,_0x4661b6;if(_0x2778d3<=0x0){_0x2778d3=0x1;}_0x1ebce1=new RegExp(_0xe2b3('0x8a')+_0x2778d3+'}$');_0x1b8607=Math[_0xe2b3('0x8b')](0xa,_0x2778d3-0x1);_0x4661b6=Math[_0xe2b3('0x8b')](0xa,_0x2778d3)-0x1;return util[_0xe2b3('0x13')]('%s',_[_0xe2b3('0x8c')](_0x13505f,_0x1ebce1,_['random'](_0x1b8607,_0x4661b6)));};exports[_0xe2b3('0x8d')]=function(_0xfd2e37){var _0x2abe69=_0xfd2e37[_0xe2b3('0x8e')](/"(.*?)"/);return _0x2abe69?_0x2abe69[0x1]:_0xfd2e37;};exports[_0xe2b3('0x8f')]=function(_0x2719b2){var _0x44f193=_0x2719b2[_0xe2b3('0x8e')](/<(.*?)>/);return _0x44f193?_0x44f193[0x1]:_0x2719b2;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index bab9701..8efb88a 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 _0xf9c7=['queueremove','queuepause','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x24ae9c,_0x28fd04){var _0x54ee30=function(_0x32d4e1){while(--_0x32d4e1){_0x24ae9c['push'](_0x24ae9c['shift']());}};_0x54ee30(++_0x28fd04);}(_0xf9c7,0x16d));var _0x7f9c=function(_0x1f9552,_0x5ddb91){_0x1f9552=_0x1f9552-0x0;var _0x37822d=_0xf9c7[_0x1f9552];return _0x37822d;};'use strict';exports[_0x7f9c('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x7f9c('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x7f9c('0x2'),'required':![]},'paused':{'type':_0x7f9c('0x3'),'required':![]}};exports[_0x7f9c('0x4')]={'queue':{'type':_0x7f9c('0x1'),'required':!![]},'interface':{'type':_0x7f9c('0x1'),'required':!![]}};exports[_0x7f9c('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x7f9c('0x3')},'reason':{'type':_0x7f9c('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x7f9c('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x7f9c('0x1'),'required':!![]}};exports[_0x7f9c('0x6')]={'uniqueid':{'type':_0x7f9c('0x1'),'required':!![]},'filename':{'type':_0x7f9c('0x1')},'format':{'type':_0x7f9c('0x1')},'mixmonitorid':{'type':_0x7f9c('0x1')}};exports[_0x7f9c('0x7')]={'uniqueid':{'type':_0x7f9c('0x1'),'required':!![]}};exports[_0x7f9c('0x8')]={'uniqueid':{'type':_0x7f9c('0x1'),'required':!![]},'exten':{'type':_0x7f9c('0x1'),'required':!![]},'context':{'type':_0x7f9c('0x1')}}; \ No newline at end of file +var _0xa767=['queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove'];(function(_0x40515a,_0x451cfc){var _0x1edc47=function(_0x32f243){while(--_0x32f243){_0x40515a['push'](_0x40515a['shift']());}};_0x1edc47(++_0x451cfc);}(_0xa767,0x9e));var _0x7a76=function(_0x19e7e8,_0x2c265c){_0x19e7e8=_0x19e7e8-0x0;var _0x3103dd=_0xa767[_0x19e7e8];return _0x3103dd;};'use strict';exports[_0x7a76('0x0')]={'queue':{'type':_0x7a76('0x1'),'required':!![]},'interface':{'type':_0x7a76('0x1'),'required':!![]},'membername':{'type':_0x7a76('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x7a76('0x2'),'required':![]}};exports[_0x7a76('0x3')]={'queue':{'type':_0x7a76('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x7a76('0x4')]={'interface':{'type':_0x7a76('0x1'),'required':!![]},'paused':{'type':_0x7a76('0x2')},'reason':{'type':_0x7a76('0x1'),'required':![]}};exports[_0x7a76('0x5')]={'module':{'type':_0x7a76('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x7a76('0x1'),'required':!![]}};exports[_0x7a76('0x6')]={'uniqueid':{'type':_0x7a76('0x1'),'required':!![]},'filename':{'type':_0x7a76('0x1')},'format':{'type':_0x7a76('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x7a76('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x7a76('0x8')]={'uniqueid':{'type':_0x7a76('0x1'),'required':!![]},'exten':{'type':_0x7a76('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index e18c244..b0f5f20 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 _0x74e7=['prototype','hasOwnProperty','length','isNil','mergeFromDatabase','initTelephones','telephones','isUndefined','voiceQueues','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','abandoned','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','sumBillable','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/servicenowAccount','../model/faxAccount','agents','trunks','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','interface','name','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x74e7,0x175));var _0x774e=function(_0x31158a,_0x41ba43){_0x31158a=_0x31158a-0x0;var _0x19d49f=_0x74e7[_0x31158a];return _0x19d49f;};'use strict';var BPromise=require('bluebird');var util=require(_0x774e('0x0'));var _=require('lodash');var moment=require(_0x774e('0x1'));var Agent=require(_0x774e('0x2'));var Telephone=require(_0x774e('0x3'));var Trunk=require(_0x774e('0x4'));var VoiceQueue=require(_0x774e('0x5'));var Trigger=require(_0x774e('0x6'));var Template=require(_0x774e('0x7'));var Campaign=require(_0x774e('0x8'));var VoiceExtension=require(_0x774e('0x9'));var ZendeskAccount=require(_0x774e('0xa'));var SalesforceAccount=require(_0x774e('0xb'));var FreshdeskAccount=require(_0x774e('0xc'));var SugarcrmAccount=require(_0x774e('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x774e('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x774e('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x774e('0x10'));var Realtime=function(){this[_0x774e('0x11')]={};this['telephones']={};this[_0x774e('0x12')]={};this['voiceQueues']={};this[_0x774e('0x13')]={};this['campaigns']={};this[_0x774e('0x14')]={};this[_0x774e('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x774e('0x16')]={};this[_0x774e('0x17')]={};this[_0x774e('0x18')]={};this[_0x774e('0x19')]={};this[_0x774e('0x1a')]={};this['settings']={};this['zendeskAccounts']={};this[_0x774e('0x1b')]={};this[_0x774e('0x1c')]={};this[_0x774e('0x1d')]={};this[_0x774e('0x1e')]={};this[_0x774e('0x1f')]={};this[_0x774e('0x20')]={};this[_0x774e('0x21')]={};this[_0x774e('0x22')]={};this[_0x774e('0x23')]={};this[_0x774e('0x24')]={};};function freeIsNotKey(_0x1219a4,_0x4ce5a7,_0x36d1f0){var _0x37878c=_[_0x774e('0x25')](_0x1219a4,function(_0x1bfe18,_0x46cf2c){return _0x1bfe18[_0x36d1f0];});for(var _0x5a28c6 in _0x4ce5a7){if(_0x4ce5a7['hasOwnProperty'](_0x5a28c6)){if(!_0x37878c[_0x5a28c6]){delete _0x4ce5a7[_0x5a28c6];}}}}function freeIsNotKeySip(_0xead233,_0x411140){var _0x4c5bc9=_['mapKeys'](_0xead233,function(_0x750a49,_0x13d6e9){return util[_0x774e('0x26')](_0x774e('0x27'),_0x750a49['name']);});for(var _0x4d3a59 in _0x411140){if(_0x411140['hasOwnProperty'](_0x4d3a59)){if(!_0x4c5bc9[_0x4d3a59]){delete _0x411140[_0x4d3a59];}}}}function freeIsNotKeyAgent(_0x45be3f,_0x10265d){var _0xdc0d1b=_[_0x774e('0x25')](_0x45be3f,function(_0x45e7b2,_0x4c3af8){var _0x38a962=_['isNil'](_0x45e7b2[_0x774e('0x28')])?util[_0x774e('0x26')]('SIP/%s',_0x45e7b2[_0x774e('0x29')]):_0x45e7b2['interface'];return _0x38a962;});for(var _0x527df4 in _0x10265d){if(_0x10265d['hasOwnProperty'](_0x527df4)){if(!_0xdc0d1b[_0x527df4]){delete _0x10265d[_0x527df4];}}}}function clearVoiceCallReports(_0x5a8235){_0x5a8235[_0x774e('0x2a')]=0x0;_0x5a8235[_0x774e('0x2b')]=0x0;_0x5a8235[_0x774e('0x2c')]=0x0;_0x5a8235[_0x774e('0x2d')]=0x0;_0x5a8235['sumBillable']=0x0;}function clearCampaigns(_0x1800a7){if(!_[_0x774e('0x2e')](_0x1800a7)){for(var _0x428a55 in _0x1800a7){if(_0x1800a7['hasOwnProperty'](_0x428a55)){_0x1800a7[_0x428a55][_0x774e('0x2f')]=0x0;_0x1800a7[_0x428a55][_0x774e('0x30')]=0x0;}}}}function clearVoiceQueues(_0x1964c1){if(!_[_0x774e('0x2e')](_0x1964c1)){for(var _0x2cbedc in _0x1964c1){if(_0x1964c1['hasOwnProperty'](_0x2cbedc)){_0x1964c1[_0x2cbedc][_0x774e('0x2a')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x2b')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x31')]=0x0;_0x1964c1[_0x2cbedc]['abandoned']=0x0;_0x1964c1[_0x2cbedc]['sumHoldTime']=0x0;_0x1964c1[_0x2cbedc]['sumDuration']=0x0;_0x1964c1[_0x2cbedc]['sumBillable']=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x32')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x33')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x34')]=0x0;_0x1964c1[_0x2cbedc]['outboundCongestionCallsDay']=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x35')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x36')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x37')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x38')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x39')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x3a')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x3b')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x3c')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x32')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x3d')]=0x0;_0x1964c1[_0x2cbedc][_0x774e('0x3e')]=!![];}}}}Realtime[_0x774e('0x3f')]['mergeFromDatabase']=function(_0x5740ac,_0x20d4f8){for(var _0x566523 in _0x20d4f8){if(_0x5740ac[_0x774e('0x40')](_0x566523)){_0x5740ac[_0x566523]=_0x20d4f8[_0x566523];}}};Realtime[_0x774e('0x3f')]['initAgents']=function(){var _0x2c279a=this;return function(_0x5df459){if(_0x5df459){freeIsNotKeyAgent(_0x5df459,_0x2c279a[_0x774e('0x11')]);for(var _0x3046fa=0x0,_0x26c640={},_0x48e623={};_0x3046fa<_0x5df459[_0x774e('0x41')];_0x3046fa+=0x1){_0x26c640=_0x5df459[_0x3046fa];var _0xa5b6b6=_[_0x774e('0x42')](_0x26c640[_0x774e('0x28')])?util[_0x774e('0x26')](_0x774e('0x27'),_0x26c640[_0x774e('0x29')]):_0x26c640[_0x774e('0x28')];if(_['isUndefined'](_0x2c279a[_0x774e('0x11')][_0xa5b6b6])){_0x2c279a[_0x774e('0x11')][_0xa5b6b6]=new Agent(_0x26c640);}else{_0x2c279a[_0x774e('0x43')](_0x2c279a['agents'][_0xa5b6b6],_0x26c640);}}}return _0x2c279a[_0x774e('0x11')];};};Realtime[_0x774e('0x3f')][_0x774e('0x44')]=function(){var _0x49d207=this;return function(_0x403e8f){if(_0x403e8f){freeIsNotKeySip(_0x403e8f,_0x49d207[_0x774e('0x45')]);for(var _0x505c93=0x0,_0x359a9a={},_0x409138={};_0x505c93<_0x403e8f[_0x774e('0x41')];_0x505c93+=0x1){_0x359a9a=_0x403e8f[_0x505c93];if(_[_0x774e('0x46')](_0x49d207['telephones'][util[_0x774e('0x26')]('SIP/%s',_0x359a9a['name'])])){_0x49d207[_0x774e('0x45')][util[_0x774e('0x26')](_0x774e('0x27'),_0x359a9a[_0x774e('0x29')])]=new Telephone(_0x359a9a);}else{_0x49d207[_0x774e('0x43')](_0x49d207[_0x774e('0x45')][util[_0x774e('0x26')]('SIP/%s',_0x359a9a[_0x774e('0x29')])],_0x359a9a);}}}return _0x49d207['telephones'];};};Realtime[_0x774e('0x3f')]['initTrunks']=function(){var _0x36b3e6=this;return function(_0xbdc03d){if(_0xbdc03d){freeIsNotKeySip(_0xbdc03d,_0x36b3e6[_0x774e('0x12')]);for(var _0x5db0f2=0x0,_0x433408={},_0x50a588={};_0x5db0f2<_0xbdc03d[_0x774e('0x41')];_0x5db0f2+=0x1){_0x433408=_0xbdc03d[_0x5db0f2];if(_[_0x774e('0x46')](_0x36b3e6[_0x774e('0x12')][util[_0x774e('0x26')](_0x774e('0x27'),_0x433408[_0x774e('0x29')])])){_0x36b3e6[_0x774e('0x12')][util[_0x774e('0x26')](_0x774e('0x27'),_0x433408[_0x774e('0x29')])]=new Trunk(_0x433408);}else{_0x36b3e6[_0x774e('0x43')](_0x36b3e6[_0x774e('0x12')][util[_0x774e('0x26')](_0x774e('0x27'),_0x433408[_0x774e('0x29')])],_0x433408);}}}return _0x36b3e6[_0x774e('0x12')];};};Realtime[_0x774e('0x3f')]['initVoiceQueues']=function(){var _0x2f25a8=this;return function(_0x321c0b){if(_0x321c0b){freeIsNotKey(_0x321c0b,_0x2f25a8[_0x774e('0x47')],_0x774e('0x29'));for(var _0x41a536=0x0,_0x416fa1={},_0x6749d={};_0x41a536<_0x321c0b[_0x774e('0x41')];_0x41a536+=0x1){_0x416fa1=_0x321c0b[_0x41a536];if(_[_0x774e('0x46')](_0x2f25a8[_0x774e('0x47')][_0x416fa1[_0x774e('0x29')]])){_0x2f25a8[_0x774e('0x47')][_0x416fa1[_0x774e('0x29')]]=new VoiceQueue(_0x416fa1);}else{_0x2f25a8['mergeFromDatabase'](_0x2f25a8['voiceQueues'][_0x416fa1[_0x774e('0x29')]],_0x416fa1);}}}return _0x2f25a8[_0x774e('0x47')];};};Realtime['prototype']['initTriggers']=function(){var _0x3bf293=this;return function(_0x17ff41){if(_0x17ff41){freeIsNotKey(_0x17ff41,_0x3bf293['triggers'],'id');for(var _0x257a25=0x0,_0x52dc7a={},_0x440e75={};_0x257a25<_0x17ff41[_0x774e('0x41')];_0x257a25+=0x1){_0x52dc7a=_0x17ff41[_0x257a25];if(_['isUndefined'](_0x3bf293[_0x774e('0x13')][_0x52dc7a['id']])){_0x3bf293[_0x774e('0x13')][_0x52dc7a['id']]=new Trigger(_0x52dc7a);}else{_0x3bf293[_0x774e('0x43')](_0x3bf293[_0x774e('0x13')][_0x52dc7a['id']],_0x52dc7a);}}}return _0x3bf293[_0x774e('0x13')];};};Realtime[_0x774e('0x3f')][_0x774e('0x48')]=function(){var _0x44f26d=this;return function(_0x3eb8f4){if(_0x3eb8f4){freeIsNotKey(_0x3eb8f4,_0x44f26d[_0x774e('0x14')],'id');for(var _0x4ca0a5=0x0,_0x5b24a3={},_0x459dd2={};_0x4ca0a5<_0x3eb8f4[_0x774e('0x41')];_0x4ca0a5+=0x1){_0x5b24a3=_0x3eb8f4[_0x4ca0a5];if(_[_0x774e('0x46')](_0x44f26d[_0x774e('0x14')][_0x5b24a3['id']])){_0x44f26d[_0x774e('0x14')][_0x5b24a3['id']]=new Template(_0x5b24a3);}else{_0x44f26d['mergeFromDatabase'](_0x44f26d[_0x774e('0x14')][_0x5b24a3['id']],_0x5b24a3);}}}return _0x44f26d[_0x774e('0x14')];};};Realtime['prototype'][_0x774e('0x49')]=function(){var _0x15765a=this;return function(_0x33390e){if(_0x33390e){freeIsNotKey(_0x33390e,_0x15765a['zendeskAccounts'],'id');for(var _0x532ede=0x0,_0x1a6eb2={},_0x3219d0={};_0x532ede<_0x33390e[_0x774e('0x41')];_0x532ede+=0x1){_0x1a6eb2=_0x33390e[_0x532ede];if(_[_0x774e('0x46')](_0x15765a['zendeskAccounts'][_0x1a6eb2['id']])){_0x15765a[_0x774e('0x4a')][_0x1a6eb2['id']]=new ZendeskAccount(_0x1a6eb2);}else{_0x15765a[_0x774e('0x43')](_0x15765a[_0x774e('0x4a')][_0x1a6eb2['id']],_0x1a6eb2);}}}return _0x15765a[_0x774e('0x4a')];};};Realtime['prototype'][_0x774e('0x4b')]=function(){var _0x46fd28=this;return function(_0x48160a){if(_0x48160a){freeIsNotKey(_0x48160a,_0x46fd28[_0x774e('0x1b')],'id');for(var _0x158912=0x0,_0x2628e5={},_0xc7d32a={};_0x158912<_0x48160a[_0x774e('0x41')];_0x158912+=0x1){_0x2628e5=_0x48160a[_0x158912];if(_[_0x774e('0x46')](_0x46fd28['salesforceAccounts'][_0x2628e5['id']])){_0x46fd28['salesforceAccounts'][_0x2628e5['id']]=new SalesforceAccount(_0x2628e5);}else{_0x46fd28[_0x774e('0x43')](_0x46fd28[_0x774e('0x1b')][_0x2628e5['id']],_0x2628e5);}}}return _0x46fd28[_0x774e('0x1b')];};};Realtime['prototype'][_0x774e('0x4c')]=function(){var _0x4903a7=this;return function(_0x3e7bf6){if(_0x3e7bf6){freeIsNotKey(_0x3e7bf6,_0x4903a7[_0x774e('0x1d')],'id');for(var _0x50d65d=0x0,_0x54ca09={},_0x1c21eb={};_0x50d65d<_0x3e7bf6[_0x774e('0x41')];_0x50d65d+=0x1){_0x54ca09=_0x3e7bf6[_0x50d65d];if(_['isUndefined'](_0x4903a7[_0x774e('0x1d')][_0x54ca09['id']])){_0x4903a7[_0x774e('0x1d')][_0x54ca09['id']]=new FreshdeskAccount(_0x54ca09);}else{_0x4903a7['mergeFromDatabase'](_0x4903a7[_0x774e('0x1d')][_0x54ca09['id']],_0x54ca09);}}}return _0x4903a7[_0x774e('0x1d')];};};Realtime[_0x774e('0x3f')]['initZohoAccounts']=function(){var _0xd247c1=this;return function(_0x2e8b5b){if(_0x2e8b5b){freeIsNotKey(_0x2e8b5b,_0xd247c1[_0x774e('0x1e')],'id');for(var _0x132c73=0x0,_0x1ed780={},_0x210e1f={};_0x132c73<_0x2e8b5b[_0x774e('0x41')];_0x132c73+=0x1){_0x1ed780=_0x2e8b5b[_0x132c73];if(_['isUndefined'](_0xd247c1['zohoAccounts'][_0x1ed780['id']])){_0xd247c1[_0x774e('0x1e')][_0x1ed780['id']]=new ZohoAccount(_0x1ed780);}else{_0xd247c1['mergeFromDatabase'](_0xd247c1['zohoAccounts'][_0x1ed780['id']],_0x1ed780);}}}return _0xd247c1['zohoAccounts'];};};Realtime[_0x774e('0x3f')][_0x774e('0x4d')]=function(){var _0x23eda4=this;return function(_0x1937df){if(_0x1937df){freeIsNotKey(_0x1937df,_0x23eda4[_0x774e('0x1f')],'id');for(var _0x4a9014=0x0,_0x35e217={},_0x1aa5c5={};_0x4a9014<_0x1937df[_0x774e('0x41')];_0x4a9014+=0x1){_0x35e217=_0x1937df[_0x4a9014];if(_[_0x774e('0x46')](_0x23eda4['deskAccounts'][_0x35e217['id']])){_0x23eda4[_0x774e('0x1f')][_0x35e217['id']]=new DeskAccount(_0x35e217);}else{_0x23eda4[_0x774e('0x43')](_0x23eda4[_0x774e('0x1f')][_0x35e217['id']],_0x35e217);}}}return _0x23eda4['deskAccounts'];};};Realtime[_0x774e('0x3f')][_0x774e('0x4e')]=function(){var _0x2f360b=this;return function(_0x557d22){if(_0x557d22){freeIsNotKey(_0x557d22,_0x2f360b[_0x774e('0x1c')],'id');for(var _0x13b188=0x0,_0x1ba394={},_0x2da5cd={};_0x13b188<_0x557d22[_0x774e('0x41')];_0x13b188+=0x1){_0x1ba394=_0x557d22[_0x13b188];if(_[_0x774e('0x46')](_0x2f360b['sugarcrmAccounts'][_0x1ba394['id']])){_0x2f360b[_0x774e('0x1c')][_0x1ba394['id']]=new SugarcrmAccount(_0x1ba394);}else{_0x2f360b['mergeFromDatabase'](_0x2f360b[_0x774e('0x1c')][_0x1ba394['id']],_0x1ba394);}}}return _0x2f360b[_0x774e('0x1c')];};};Realtime[_0x774e('0x3f')][_0x774e('0x4f')]=function(){var _0x45c968=this;return function(_0x2813f1){if(_0x2813f1){freeIsNotKey(_0x2813f1,_0x45c968[_0x774e('0x20')],'id');for(var _0x224158=0x0,_0x335395={},_0xa07993={};_0x224158<_0x2813f1['length'];_0x224158+=0x1){_0x335395=_0x2813f1[_0x224158];if(_[_0x774e('0x46')](_0x45c968[_0x774e('0x20')][_0x335395['id']])){_0x45c968[_0x774e('0x20')][_0x335395['id']]=new VtigerAccount(_0x335395);}else{_0x45c968[_0x774e('0x43')](_0x45c968[_0x774e('0x20')][_0x335395['id']],_0x335395);}}}return _0x45c968[_0x774e('0x20')];};};Realtime[_0x774e('0x3f')][_0x774e('0x50')]=function(){var _0x4c2a33=this;return function(_0x1d657f){if(_0x1d657f){freeIsNotKey(_0x1d657f,_0x4c2a33[_0x774e('0x21')],'id');for(var _0x4b5a3d=0x0,_0x45d632={},_0x46465e={};_0x4b5a3d<_0x1d657f['length'];_0x4b5a3d+=0x1){_0x45d632=_0x1d657f[_0x4b5a3d];if(_[_0x774e('0x46')](_0x4c2a33['servicenowAccounts'][_0x45d632['id']])){_0x4c2a33[_0x774e('0x21')][_0x45d632['id']]=new ServicenowAccount(_0x45d632);}else{_0x4c2a33[_0x774e('0x43')](_0x4c2a33['servicenowAccounts'][_0x45d632['id']],_0x45d632);}}}return _0x4c2a33[_0x774e('0x21')];};};Realtime[_0x774e('0x3f')][_0x774e('0x51')]=function(){var _0x4181e7=this;return function(_0x10836b){if(_0x10836b){freeIsNotKey(_0x10836b,_0x4181e7[_0x774e('0x22')],'id');for(var _0x524089=0x0,_0x1c20d5={},_0x3bffc3={};_0x524089<_0x10836b['length'];_0x524089+=0x1){_0x1c20d5=_0x10836b[_0x524089];if(_[_0x774e('0x46')](_0x4181e7['dynamics365Accounts'][_0x1c20d5['id']])){_0x4181e7[_0x774e('0x22')][_0x1c20d5['id']]=new Dynamics365Account(_0x1c20d5);}else{_0x4181e7['mergeFromDatabase'](_0x4181e7[_0x774e('0x22')][_0x1c20d5['id']],_0x1c20d5);}}}return _0x4181e7[_0x774e('0x22')];};};Realtime['prototype'][_0x774e('0x52')]=function(){var _0x594286=this;return function(_0x12fd03){if(_0x12fd03){freeIsNotKey(_0x12fd03,_0x594286[_0x774e('0x23')],'id');for(var _0x5d6ea6=0x0,_0x432851={},_0x5dc673={};_0x5d6ea6<_0x12fd03['length'];_0x5d6ea6+=0x1){_0x432851=_0x12fd03[_0x5d6ea6];if(_['isUndefined'](_0x594286[_0x774e('0x23')][_0x432851['id']])){_0x594286[_0x774e('0x23')][_0x432851['id']]=new FreshsalesAccount(_0x432851);}else{_0x594286[_0x774e('0x43')](_0x594286[_0x774e('0x23')][_0x432851['id']],_0x432851);}}}return _0x594286['freshsalesAccounts'];};};Realtime[_0x774e('0x3f')][_0x774e('0x53')]=function(){var _0x3884f4=this;return function(_0x1f5cad){for(var _0x316644=0x0;_0x316644<_0x1f5cad[_0x774e('0x41')];_0x316644+=0x1){_[_0x774e('0x54')](_0x3884f4[_0x774e('0x47')][_0x1f5cad[_0x316644]['name']],_0x1f5cad[_0x316644]);}return _0x3884f4[_0x774e('0x47')];};};Realtime['prototype'][_0x774e('0x55')]=function(){var _0x19ac0c=this;return function(_0x1170d6){clearVoiceQueues(_0x19ac0c[_0x774e('0x47')]);if(_0x1170d6){_0x1170d6=_[_0x774e('0x56')](_0x1170d6,_0x774e('0x57'));for(var _0x583cce in _0x1170d6){if(_0x1170d6[_0x774e('0x40')](_0x583cce)){var _0x254ecf={};for(var _0x5b1557=0x0;_0x5b1557<_0x1170d6[_0x583cce][_0x774e('0x41')];_0x5b1557+=0x1){var _0x3ac613=_0x1170d6[_0x583cce][_0x5b1557]['queue'];if(_0x19ac0c[_0x774e('0x47')][_0x3ac613]){if(_0x1170d6[_0x583cce][_0x5b1557][_0x774e('0x58')]){_0x19ac0c['voiceQueues'][_0x3ac613][_0x774e('0x31')]+=0x1;}if(_0x1170d6[_0x583cce][_0x5b1557][_0x774e('0x59')]){_0x19ac0c[_0x774e('0x47')][_0x3ac613][_0x774e('0x5a')]+=0x1;}_0x19ac0c[_0x774e('0x47')][_0x3ac613][_0x774e('0x2c')]+=moment(_0x1170d6[_0x583cce][_0x5b1557]['queuecallerleaveAt'])[_0x774e('0x5b')](moment(_0x1170d6[_0x583cce][_0x5b1557]['queuecallerjoinAt']),_0x774e('0x5c'))||0x0;if(_0x5b1557===_0x1170d6[_0x583cce][_0x774e('0x41')]-0x1){_0x19ac0c[_0x774e('0x47')][_0x3ac613]['sumDuration']+=moment(_0x1170d6[_0x583cce][_0x5b1557][_0x774e('0x5d')]||_0x1170d6[_0x583cce][_0x5b1557][_0x774e('0x5e')]||_0x1170d6[_0x583cce][_0x5b1557]['queuecallerexitAt'])[_0x774e('0x5b')](moment(_0x1170d6[_0x583cce][_0x5b1557][_0x774e('0x5f')]),_0x774e('0x5c'))||0x0;_0x19ac0c[_0x774e('0x47')][_0x3ac613][_0x774e('0x2a')]+=0x1;if(_0x1170d6[_0x583cce][_0x5b1557]['queuecallercomplete']){_0x19ac0c['voiceQueues'][_0x3ac613][_0x774e('0x2b')]+=0x1;_0x19ac0c['voiceQueues'][_0x3ac613][_0x774e('0x60')]+=moment(_0x1170d6[_0x583cce][_0x5b1557][_0x774e('0x5d')])['diff'](moment(_0x1170d6[_0x583cce][_0x5b1557][_0x774e('0x61')]),_0x774e('0x5c'))||0x0;}}else{_0x19ac0c[_0x774e('0x47')][_0x3ac613]['sumDuration']+=_0x19ac0c[_0x774e('0x47')][_0x3ac613][_0x774e('0x2c')]||0x0;}}}}}}return _0x19ac0c[_0x774e('0x47')];};};Realtime['prototype'][_0x774e('0x62')]=function(){var _0x2f4036=this;return function(_0x29e0a1){clearVoiceCallReports(_0x2f4036[_0x774e('0x15')]);if(_0x29e0a1){for(var _0x3ced1c=0x0;_0x3ced1c<_0x29e0a1[_0x774e('0x41')];_0x3ced1c+=0x1){_0x2f4036['outbound'][_0x774e('0x2a')]+=0x1;_0x2f4036[_0x774e('0x15')][_0x774e('0x2d')]+=_0x29e0a1[_0x3ced1c][_0x774e('0x63')];if(_0x29e0a1[_0x3ced1c][_0x774e('0x64')]===_0x774e('0x65')){_0x2f4036[_0x774e('0x15')]['answered']+=0x1;_0x2f4036[_0x774e('0x15')][_0x774e('0x2c')]+=_0x29e0a1[_0x3ced1c][_0x774e('0x63')]-_0x29e0a1[_0x3ced1c][_0x774e('0x66')]||0x0;_0x2f4036[_0x774e('0x15')][_0x774e('0x60')]+=_0x29e0a1[_0x3ced1c][_0x774e('0x66')];}}}return _0x2f4036[_0x774e('0x15')];};};Realtime['prototype']['initCampaigns']=function(){var _0x4eb8d2=this;return function(_0x2ad340){if(_0x2ad340){freeIsNotKey(_0x2ad340,_0x4eb8d2[_0x774e('0x67')],_0x774e('0x29'));for(var _0x223a60=0x0,_0x424dce={};_0x223a60<_0x2ad340['length'];_0x223a60+=0x1){_0x424dce=_0x2ad340[_0x223a60];if(_[_0x774e('0x46')](_0x4eb8d2[_0x774e('0x67')][_0x424dce[_0x774e('0x29')]])){_0x4eb8d2[_0x774e('0x67')][_0x424dce[_0x774e('0x29')]]=new Campaign(_0x424dce);}else{_0x4eb8d2[_0x774e('0x43')](_0x4eb8d2[_0x774e('0x67')][_0x424dce[_0x774e('0x29')]],_0x424dce);_0x4eb8d2[_0x774e('0x67')][_0x424dce['name']]['dialQueueProject']=_0x424dce[_0x774e('0x68')]?_0x424dce[_0x774e('0x68')]['name']:undefined;}}}return _0x4eb8d2['campaigns'];};};Realtime['prototype'][_0x774e('0x69')]=function(){var _0x118687=this;return function(_0x532f79){if(_0x532f79){freeIsNotKey(_0x532f79,_0x118687['voiceExtensions'],'id');for(var _0x37bc9c=0x0,_0x9da036={};_0x37bc9c<_0x532f79[_0x774e('0x41')];_0x37bc9c+=0x1){_0x9da036=_0x532f79[_0x37bc9c];if(_[_0x774e('0x46')](_0x118687[_0x774e('0x16')][_0x9da036['id']])){_0x118687[_0x774e('0x16')][_0x9da036['id']]=new VoiceExtension(_0x9da036);}else{_0x118687[_0x774e('0x43')](_0x118687[_0x774e('0x16')][_0x9da036['id']],_0x9da036);}}}return _0x118687[_0x774e('0x16')];};};Realtime[_0x774e('0x3f')][_0x774e('0x6a')]=function(){var _0x27b6a4=this;return function(_0x949ec9){clearCampaigns(_0x27b6a4[_0x774e('0x67')]);for(var _0x717a22=0x0;_0x717a22<_0x949ec9[_0x774e('0x41')];_0x717a22+=0x1){_[_0x774e('0x54')](_0x27b6a4[_0x774e('0x67')][_0x949ec9[_0x717a22]['name']],_0x949ec9[_0x717a22]);}return _0x27b6a4[_0x774e('0x67')];};};Realtime[_0x774e('0x3f')][_0x774e('0x6b')]=function(){var _0x51afc2=this;return function(_0x49b167){if(_0x49b167){freeIsNotKey(_0x49b167,_0x51afc2[_0x774e('0x24')],'id');for(var _0x2b81fc=0x0,_0x2fcd53={},_0x4895bc={};_0x2b81fc<_0x49b167[_0x774e('0x41')];_0x2b81fc+=0x1){_0x2fcd53=_0x49b167[_0x2b81fc];if(_[_0x774e('0x46')](_0x51afc2['faxAccounts'][_0x2fcd53['id']])){_0x51afc2[_0x774e('0x24')][_0x2fcd53['id']]=new FaxAccount(_0x2fcd53);}else{_0x51afc2[_0x774e('0x43')](_0x51afc2['faxAccounts'][_0x2fcd53['id']],_0x2fcd53);}}}return _0x51afc2['faxAccounts'];};};module[_0x774e('0x6c')]=Realtime; \ No newline at end of file +var _0xd329=['outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','name','initTelephones','initTrunks','isUndefined','initVoiceQueues','initTriggers','triggers','initTemplates','zendeskAccounts','initFreshdeskAccounts','freshdeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','outbound','duration','disposition','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','outboundChannels','settings','salesforceAccounts','sugarcrmAccounts','zohoAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','format','SIP/%s','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','hasOwnProperty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay'];(function(_0xb7a913,_0x543b17){var _0x3ae7dc=function(_0xca3f0d){while(--_0xca3f0d){_0xb7a913['push'](_0xb7a913['shift']());}};_0x3ae7dc(++_0x543b17);}(_0xd329,0x106));var _0x9d32=function(_0x34fac7,_0x2df475){_0x34fac7=_0x34fac7-0x0;var _0x2dc371=_0xd329[_0x34fac7];return _0x2dc371;};'use strict';var BPromise=require(_0x9d32('0x0'));var util=require(_0x9d32('0x1'));var _=require(_0x9d32('0x2'));var moment=require(_0x9d32('0x3'));var Agent=require(_0x9d32('0x4'));var Telephone=require(_0x9d32('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x9d32('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x9d32('0x7'));var Campaign=require(_0x9d32('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x9d32('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x9d32('0xa'));var SugarcrmAccount=require(_0x9d32('0xb'));var ZohoAccount=require(_0x9d32('0xc'));var DeskAccount=require(_0x9d32('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x9d32('0xe'));var Dynamics365Account=require(_0x9d32('0xf'));var FreshsalesAccount=require(_0x9d32('0x10'));var FaxAccount=require(_0x9d32('0x11'));var Realtime=function(){this[_0x9d32('0x12')]={};this[_0x9d32('0x13')]={};this[_0x9d32('0x14')]={};this[_0x9d32('0x15')]={};this['triggers']={};this[_0x9d32('0x16')]={};this[_0x9d32('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x9d32('0x18')]={};this['channels']={};this['queueChannels']={};this[_0x9d32('0x19')]={};this['timers']={};this[_0x9d32('0x1a')]={};this['zendeskAccounts']={};this[_0x9d32('0x1b')]={};this[_0x9d32('0x1c')]={};this['freshdeskAccounts']={};this[_0x9d32('0x1d')]={};this['deskAccounts']={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0x9d32('0x1e')]={};this[_0x9d32('0x1f')]={};this['faxAccounts']={};};function freeIsNotKey(_0x536873,_0x520fe9,_0x15929f){var _0x3bbde3=_['mapKeys'](_0x536873,function(_0x86e733,_0x52290f){return _0x86e733[_0x15929f];});for(var _0x32ab4b in _0x520fe9){if(_0x520fe9['hasOwnProperty'](_0x32ab4b)){if(!_0x3bbde3[_0x32ab4b]){delete _0x520fe9[_0x32ab4b];}}}}function freeIsNotKeySip(_0x483473,_0x12488c){var _0x43190f=_[_0x9d32('0x20')](_0x483473,function(_0xf1269f,_0x413fca){return util[_0x9d32('0x21')](_0x9d32('0x22'),_0xf1269f['name']);});for(var _0x28b719 in _0x12488c){if(_0x12488c['hasOwnProperty'](_0x28b719)){if(!_0x43190f[_0x28b719]){delete _0x12488c[_0x28b719];}}}}function freeIsNotKeyAgent(_0x16a669,_0x55c36f){var _0x8c4b5f=_['mapKeys'](_0x16a669,function(_0x42ecdb,_0x4987a1){var _0x30ff2d=_[_0x9d32('0x23')](_0x42ecdb[_0x9d32('0x24')])?util[_0x9d32('0x21')](_0x9d32('0x22'),_0x42ecdb['name']):_0x42ecdb[_0x9d32('0x24')];return _0x30ff2d;});for(var _0x2deabb in _0x55c36f){if(_0x55c36f['hasOwnProperty'](_0x2deabb)){if(!_0x8c4b5f[_0x2deabb]){delete _0x55c36f[_0x2deabb];}}}}function clearVoiceCallReports(_0x12434e){_0x12434e[_0x9d32('0x25')]=0x0;_0x12434e['answered']=0x0;_0x12434e[_0x9d32('0x26')]=0x0;_0x12434e[_0x9d32('0x27')]=0x0;_0x12434e[_0x9d32('0x28')]=0x0;}function clearCampaigns(_0x21aac8){if(!_[_0x9d32('0x29')](_0x21aac8)){for(var _0x24fbb3 in _0x21aac8){if(_0x21aac8[_0x9d32('0x2a')](_0x24fbb3)){_0x21aac8[_0x24fbb3][_0x9d32('0x2b')]=0x0;_0x21aac8[_0x24fbb3][_0x9d32('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x53ac29){if(!_[_0x9d32('0x29')](_0x53ac29)){for(var _0x18e2a2 in _0x53ac29){if(_0x53ac29[_0x9d32('0x2a')](_0x18e2a2)){_0x53ac29[_0x18e2a2][_0x9d32('0x25')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x2d')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x2e')]=0x0;_0x53ac29[_0x18e2a2]['abandoned']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x26')]=0x0;_0x53ac29[_0x18e2a2]['sumDuration']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x28')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x2f')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x30')]=0x0;_0x53ac29[_0x18e2a2]['outboundBusyCallsDay']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x31')]=0x0;_0x53ac29[_0x18e2a2]['outboundNoSuchCallsDay']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x32')]=0x0;_0x53ac29[_0x18e2a2]['outboundDropCallsDayTimeout']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x33')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x34')]=0x0;_0x53ac29[_0x18e2a2]['outboundOriginateFailureCallsDay']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x35')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x36')]=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x2f')]=0x0;_0x53ac29[_0x18e2a2]['outboundAnswerCallsDay']=0x0;_0x53ac29[_0x18e2a2][_0x9d32('0x37')]=!![];}}}}Realtime[_0x9d32('0x38')][_0x9d32('0x39')]=function(_0x332528,_0x3b7d65){for(var _0x2e1f77 in _0x3b7d65){if(_0x332528['hasOwnProperty'](_0x2e1f77)){_0x332528[_0x2e1f77]=_0x3b7d65[_0x2e1f77];}}};Realtime[_0x9d32('0x38')][_0x9d32('0x3a')]=function(){var _0x218da0=this;return function(_0x3fea23){if(_0x3fea23){freeIsNotKeyAgent(_0x3fea23,_0x218da0[_0x9d32('0x12')]);for(var _0x2d7b1a=0x0,_0x451535={},_0x5aa0b3={};_0x2d7b1a<_0x3fea23[_0x9d32('0x3b')];_0x2d7b1a+=0x1){_0x451535=_0x3fea23[_0x2d7b1a];var _0x1659e5=_[_0x9d32('0x23')](_0x451535['interface'])?util['format'](_0x9d32('0x22'),_0x451535[_0x9d32('0x3c')]):_0x451535[_0x9d32('0x24')];if(_['isUndefined'](_0x218da0[_0x9d32('0x12')][_0x1659e5])){_0x218da0[_0x9d32('0x12')][_0x1659e5]=new Agent(_0x451535);}else{_0x218da0[_0x9d32('0x39')](_0x218da0[_0x9d32('0x12')][_0x1659e5],_0x451535);}}}return _0x218da0[_0x9d32('0x12')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x3d')]=function(){var _0x47b20d=this;return function(_0x1d27c7){if(_0x1d27c7){freeIsNotKeySip(_0x1d27c7,_0x47b20d[_0x9d32('0x13')]);for(var _0x15ca20=0x0,_0x4c0f08={},_0x20f154={};_0x15ca20<_0x1d27c7[_0x9d32('0x3b')];_0x15ca20+=0x1){_0x4c0f08=_0x1d27c7[_0x15ca20];if(_['isUndefined'](_0x47b20d[_0x9d32('0x13')][util[_0x9d32('0x21')]('SIP/%s',_0x4c0f08[_0x9d32('0x3c')])])){_0x47b20d['telephones'][util[_0x9d32('0x21')](_0x9d32('0x22'),_0x4c0f08['name'])]=new Telephone(_0x4c0f08);}else{_0x47b20d[_0x9d32('0x39')](_0x47b20d[_0x9d32('0x13')][util[_0x9d32('0x21')](_0x9d32('0x22'),_0x4c0f08[_0x9d32('0x3c')])],_0x4c0f08);}}}return _0x47b20d['telephones'];};};Realtime[_0x9d32('0x38')][_0x9d32('0x3e')]=function(){var _0x1d457b=this;return function(_0x234a35){if(_0x234a35){freeIsNotKeySip(_0x234a35,_0x1d457b[_0x9d32('0x14')]);for(var _0x48d9da=0x0,_0x2a9472={},_0x410c23={};_0x48d9da<_0x234a35['length'];_0x48d9da+=0x1){_0x2a9472=_0x234a35[_0x48d9da];if(_[_0x9d32('0x3f')](_0x1d457b[_0x9d32('0x14')][util[_0x9d32('0x21')](_0x9d32('0x22'),_0x2a9472['name'])])){_0x1d457b['trunks'][util[_0x9d32('0x21')](_0x9d32('0x22'),_0x2a9472['name'])]=new Trunk(_0x2a9472);}else{_0x1d457b[_0x9d32('0x39')](_0x1d457b['trunks'][util[_0x9d32('0x21')]('SIP/%s',_0x2a9472[_0x9d32('0x3c')])],_0x2a9472);}}}return _0x1d457b[_0x9d32('0x14')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x40')]=function(){var _0x16a403=this;return function(_0x237f07){if(_0x237f07){freeIsNotKey(_0x237f07,_0x16a403['voiceQueues'],'name');for(var _0x46323a=0x0,_0x1bee34={},_0x2689f1={};_0x46323a<_0x237f07[_0x9d32('0x3b')];_0x46323a+=0x1){_0x1bee34=_0x237f07[_0x46323a];if(_[_0x9d32('0x3f')](_0x16a403[_0x9d32('0x15')][_0x1bee34[_0x9d32('0x3c')]])){_0x16a403['voiceQueues'][_0x1bee34['name']]=new VoiceQueue(_0x1bee34);}else{_0x16a403[_0x9d32('0x39')](_0x16a403[_0x9d32('0x15')][_0x1bee34['name']],_0x1bee34);}}}return _0x16a403['voiceQueues'];};};Realtime[_0x9d32('0x38')][_0x9d32('0x41')]=function(){var _0x1d6ecd=this;return function(_0x9aab61){if(_0x9aab61){freeIsNotKey(_0x9aab61,_0x1d6ecd['triggers'],'id');for(var _0x5f450e=0x0,_0x37748e={},_0x392b2c={};_0x5f450e<_0x9aab61[_0x9d32('0x3b')];_0x5f450e+=0x1){_0x37748e=_0x9aab61[_0x5f450e];if(_['isUndefined'](_0x1d6ecd[_0x9d32('0x42')][_0x37748e['id']])){_0x1d6ecd[_0x9d32('0x42')][_0x37748e['id']]=new Trigger(_0x37748e);}else{_0x1d6ecd[_0x9d32('0x39')](_0x1d6ecd[_0x9d32('0x42')][_0x37748e['id']],_0x37748e);}}}return _0x1d6ecd[_0x9d32('0x42')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x43')]=function(){var _0x21c7d9=this;return function(_0xad1708){if(_0xad1708){freeIsNotKey(_0xad1708,_0x21c7d9[_0x9d32('0x17')],'id');for(var _0x5409cf=0x0,_0x543b16={},_0x464073={};_0x5409cf<_0xad1708[_0x9d32('0x3b')];_0x5409cf+=0x1){_0x543b16=_0xad1708[_0x5409cf];if(_[_0x9d32('0x3f')](_0x21c7d9[_0x9d32('0x17')][_0x543b16['id']])){_0x21c7d9['templates'][_0x543b16['id']]=new Template(_0x543b16);}else{_0x21c7d9[_0x9d32('0x39')](_0x21c7d9[_0x9d32('0x17')][_0x543b16['id']],_0x543b16);}}}return _0x21c7d9[_0x9d32('0x17')];};};Realtime[_0x9d32('0x38')]['initZendeskAccounts']=function(){var _0x10ff7a=this;return function(_0xfcfcef){if(_0xfcfcef){freeIsNotKey(_0xfcfcef,_0x10ff7a[_0x9d32('0x44')],'id');for(var _0x45a1ca=0x0,_0x1efb0c={},_0x1aa843={};_0x45a1ca<_0xfcfcef[_0x9d32('0x3b')];_0x45a1ca+=0x1){_0x1efb0c=_0xfcfcef[_0x45a1ca];if(_[_0x9d32('0x3f')](_0x10ff7a['zendeskAccounts'][_0x1efb0c['id']])){_0x10ff7a[_0x9d32('0x44')][_0x1efb0c['id']]=new ZendeskAccount(_0x1efb0c);}else{_0x10ff7a[_0x9d32('0x39')](_0x10ff7a['zendeskAccounts'][_0x1efb0c['id']],_0x1efb0c);}}}return _0x10ff7a['zendeskAccounts'];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x34d714=this;return function(_0x3dc12e){if(_0x3dc12e){freeIsNotKey(_0x3dc12e,_0x34d714[_0x9d32('0x1b')],'id');for(var _0x30113c=0x0,_0x2c9767={},_0x27a68c={};_0x30113c<_0x3dc12e[_0x9d32('0x3b')];_0x30113c+=0x1){_0x2c9767=_0x3dc12e[_0x30113c];if(_[_0x9d32('0x3f')](_0x34d714[_0x9d32('0x1b')][_0x2c9767['id']])){_0x34d714['salesforceAccounts'][_0x2c9767['id']]=new SalesforceAccount(_0x2c9767);}else{_0x34d714['mergeFromDatabase'](_0x34d714['salesforceAccounts'][_0x2c9767['id']],_0x2c9767);}}}return _0x34d714[_0x9d32('0x1b')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x45')]=function(){var _0x11540b=this;return function(_0x594005){if(_0x594005){freeIsNotKey(_0x594005,_0x11540b[_0x9d32('0x46')],'id');for(var _0x5ecf19=0x0,_0x4a2a38={},_0x52b947={};_0x5ecf19<_0x594005['length'];_0x5ecf19+=0x1){_0x4a2a38=_0x594005[_0x5ecf19];if(_[_0x9d32('0x3f')](_0x11540b[_0x9d32('0x46')][_0x4a2a38['id']])){_0x11540b[_0x9d32('0x46')][_0x4a2a38['id']]=new FreshdeskAccount(_0x4a2a38);}else{_0x11540b[_0x9d32('0x39')](_0x11540b[_0x9d32('0x46')][_0x4a2a38['id']],_0x4a2a38);}}}return _0x11540b[_0x9d32('0x46')];};};Realtime[_0x9d32('0x38')]['initZohoAccounts']=function(){var _0x2d0efe=this;return function(_0x340d85){if(_0x340d85){freeIsNotKey(_0x340d85,_0x2d0efe[_0x9d32('0x1d')],'id');for(var _0x188cd8=0x0,_0x2eaaf5={},_0x5e3d2b={};_0x188cd8<_0x340d85[_0x9d32('0x3b')];_0x188cd8+=0x1){_0x2eaaf5=_0x340d85[_0x188cd8];if(_[_0x9d32('0x3f')](_0x2d0efe['zohoAccounts'][_0x2eaaf5['id']])){_0x2d0efe[_0x9d32('0x1d')][_0x2eaaf5['id']]=new ZohoAccount(_0x2eaaf5);}else{_0x2d0efe['mergeFromDatabase'](_0x2d0efe[_0x9d32('0x1d')][_0x2eaaf5['id']],_0x2eaaf5);}}}return _0x2d0efe[_0x9d32('0x1d')];};};Realtime[_0x9d32('0x38')]['initDeskAccounts']=function(){var _0x443622=this;return function(_0x2fa4b9){if(_0x2fa4b9){freeIsNotKey(_0x2fa4b9,_0x443622[_0x9d32('0x47')],'id');for(var _0x364c38=0x0,_0x5b074a={},_0x3ac8c6={};_0x364c38<_0x2fa4b9[_0x9d32('0x3b')];_0x364c38+=0x1){_0x5b074a=_0x2fa4b9[_0x364c38];if(_['isUndefined'](_0x443622[_0x9d32('0x47')][_0x5b074a['id']])){_0x443622[_0x9d32('0x47')][_0x5b074a['id']]=new DeskAccount(_0x5b074a);}else{_0x443622[_0x9d32('0x39')](_0x443622[_0x9d32('0x47')][_0x5b074a['id']],_0x5b074a);}}}return _0x443622[_0x9d32('0x47')];};};Realtime['prototype'][_0x9d32('0x48')]=function(){var _0x1c0e6b=this;return function(_0x571f00){if(_0x571f00){freeIsNotKey(_0x571f00,_0x1c0e6b['sugarcrmAccounts'],'id');for(var _0x39382e=0x0,_0x372f10={},_0x8118bc={};_0x39382e<_0x571f00[_0x9d32('0x3b')];_0x39382e+=0x1){_0x372f10=_0x571f00[_0x39382e];if(_[_0x9d32('0x3f')](_0x1c0e6b[_0x9d32('0x1c')][_0x372f10['id']])){_0x1c0e6b[_0x9d32('0x1c')][_0x372f10['id']]=new SugarcrmAccount(_0x372f10);}else{_0x1c0e6b[_0x9d32('0x39')](_0x1c0e6b['sugarcrmAccounts'][_0x372f10['id']],_0x372f10);}}}return _0x1c0e6b[_0x9d32('0x1c')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x49')]=function(){var _0x52d218=this;return function(_0x22d7d1){if(_0x22d7d1){freeIsNotKey(_0x22d7d1,_0x52d218['vtigerAccounts'],'id');for(var _0x47e821=0x0,_0x2d67f7={},_0x1ca82f={};_0x47e821<_0x22d7d1['length'];_0x47e821+=0x1){_0x2d67f7=_0x22d7d1[_0x47e821];if(_[_0x9d32('0x3f')](_0x52d218[_0x9d32('0x4a')][_0x2d67f7['id']])){_0x52d218['vtigerAccounts'][_0x2d67f7['id']]=new VtigerAccount(_0x2d67f7);}else{_0x52d218[_0x9d32('0x39')](_0x52d218['vtigerAccounts'][_0x2d67f7['id']],_0x2d67f7);}}}return _0x52d218[_0x9d32('0x4a')];};};Realtime['prototype'][_0x9d32('0x4b')]=function(){var _0x3f968f=this;return function(_0x33f88d){if(_0x33f88d){freeIsNotKey(_0x33f88d,_0x3f968f[_0x9d32('0x4c')],'id');for(var _0x47b41d=0x0,_0x4e1377={},_0x37ce96={};_0x47b41d<_0x33f88d['length'];_0x47b41d+=0x1){_0x4e1377=_0x33f88d[_0x47b41d];if(_[_0x9d32('0x3f')](_0x3f968f[_0x9d32('0x4c')][_0x4e1377['id']])){_0x3f968f[_0x9d32('0x4c')][_0x4e1377['id']]=new ServicenowAccount(_0x4e1377);}else{_0x3f968f['mergeFromDatabase'](_0x3f968f[_0x9d32('0x4c')][_0x4e1377['id']],_0x4e1377);}}}return _0x3f968f[_0x9d32('0x4c')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x4d')]=function(){var _0x830bfb=this;return function(_0x31d021){if(_0x31d021){freeIsNotKey(_0x31d021,_0x830bfb[_0x9d32('0x1e')],'id');for(var _0x25981d=0x0,_0x11b5ae={},_0xf059dd={};_0x25981d<_0x31d021[_0x9d32('0x3b')];_0x25981d+=0x1){_0x11b5ae=_0x31d021[_0x25981d];if(_['isUndefined'](_0x830bfb[_0x9d32('0x1e')][_0x11b5ae['id']])){_0x830bfb['dynamics365Accounts'][_0x11b5ae['id']]=new Dynamics365Account(_0x11b5ae);}else{_0x830bfb[_0x9d32('0x39')](_0x830bfb[_0x9d32('0x1e')][_0x11b5ae['id']],_0x11b5ae);}}}return _0x830bfb[_0x9d32('0x1e')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x4e')]=function(){var _0x5b88c7=this;return function(_0x25d080){if(_0x25d080){freeIsNotKey(_0x25d080,_0x5b88c7['freshsalesAccounts'],'id');for(var _0x288f69=0x0,_0x56a1cf={},_0x11b6ae={};_0x288f69<_0x25d080['length'];_0x288f69+=0x1){_0x56a1cf=_0x25d080[_0x288f69];if(_['isUndefined'](_0x5b88c7[_0x9d32('0x1f')][_0x56a1cf['id']])){_0x5b88c7[_0x9d32('0x1f')][_0x56a1cf['id']]=new FreshsalesAccount(_0x56a1cf);}else{_0x5b88c7[_0x9d32('0x39')](_0x5b88c7[_0x9d32('0x1f')][_0x56a1cf['id']],_0x56a1cf);}}}return _0x5b88c7[_0x9d32('0x1f')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x4f')]=function(){var _0x339fb1=this;return function(_0x42e708){for(var _0x3e7646=0x0;_0x3e7646<_0x42e708[_0x9d32('0x3b')];_0x3e7646+=0x1){_[_0x9d32('0x50')](_0x339fb1[_0x9d32('0x15')][_0x42e708[_0x3e7646][_0x9d32('0x3c')]],_0x42e708[_0x3e7646]);}return _0x339fb1[_0x9d32('0x15')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x51')]=function(){var _0x768faa=this;return function(_0x33a543){clearVoiceQueues(_0x768faa[_0x9d32('0x15')]);if(_0x33a543){_0x33a543=_[_0x9d32('0x52')](_0x33a543,'uniqueid');for(var _0x3bdef2 in _0x33a543){if(_0x33a543['hasOwnProperty'](_0x3bdef2)){var _0x139918={};for(var _0x1b2353=0x0;_0x1b2353<_0x33a543[_0x3bdef2][_0x9d32('0x3b')];_0x1b2353+=0x1){var _0x3c043e=_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x53')];if(_0x768faa[_0x9d32('0x15')][_0x3c043e]){if(_0x33a543[_0x3bdef2][_0x1b2353]['queuecallerexit']){_0x768faa['voiceQueues'][_0x3c043e]['unmanaged']+=0x1;}if(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x54')]){_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x55')]+=0x1;}_0x768faa[_0x9d32('0x15')][_0x3c043e]['sumHoldTime']+=moment(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x56')])[_0x9d32('0x57')](moment(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x58')]),_0x9d32('0x59'))||0x0;if(_0x1b2353===_0x33a543[_0x3bdef2][_0x9d32('0x3b')]-0x1){_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x27')]+=moment(_0x33a543[_0x3bdef2][_0x1b2353]['queuecallercompleteAt']||_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x5a')]||_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x5b')])['diff'](moment(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x58')]),_0x9d32('0x59'))||0x0;_0x768faa['voiceQueues'][_0x3c043e][_0x9d32('0x25')]+=0x1;if(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x5c')]){_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x2d')]+=0x1;_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x28')]+=moment(_0x33a543[_0x3bdef2][_0x1b2353][_0x9d32('0x5d')])[_0x9d32('0x57')](moment(_0x33a543[_0x3bdef2][_0x1b2353]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x27')]+=_0x768faa[_0x9d32('0x15')][_0x3c043e][_0x9d32('0x26')]||0x0;}}}}}}return _0x768faa[_0x9d32('0x15')];};};Realtime[_0x9d32('0x38')][_0x9d32('0x5e')]=function(){var _0x344d3c=this;return function(_0x1e9b54){clearVoiceCallReports(_0x344d3c['outbound']);if(_0x1e9b54){for(var _0x3ad676=0x0;_0x3ad676<_0x1e9b54[_0x9d32('0x3b')];_0x3ad676+=0x1){_0x344d3c[_0x9d32('0x5f')][_0x9d32('0x25')]+=0x1;_0x344d3c[_0x9d32('0x5f')]['sumDuration']+=_0x1e9b54[_0x3ad676][_0x9d32('0x60')];if(_0x1e9b54[_0x3ad676][_0x9d32('0x61')]==='ANSWERED'){_0x344d3c['outbound'][_0x9d32('0x2d')]+=0x1;_0x344d3c['outbound']['sumHoldTime']+=_0x1e9b54[_0x3ad676][_0x9d32('0x60')]-_0x1e9b54[_0x3ad676][_0x9d32('0x62')]||0x0;_0x344d3c[_0x9d32('0x5f')][_0x9d32('0x28')]+=_0x1e9b54[_0x3ad676][_0x9d32('0x62')];}}}return _0x344d3c['outbound'];};};Realtime[_0x9d32('0x38')][_0x9d32('0x63')]=function(){var _0x335d44=this;return function(_0x106eac){if(_0x106eac){freeIsNotKey(_0x106eac,_0x335d44['campaigns'],_0x9d32('0x3c'));for(var _0x109a11=0x0,_0x32a806={};_0x109a11<_0x106eac[_0x9d32('0x3b')];_0x109a11+=0x1){_0x32a806=_0x106eac[_0x109a11];if(_['isUndefined'](_0x335d44[_0x9d32('0x16')][_0x32a806['name']])){_0x335d44[_0x9d32('0x16')][_0x32a806['name']]=new Campaign(_0x32a806);}else{_0x335d44[_0x9d32('0x39')](_0x335d44[_0x9d32('0x16')][_0x32a806['name']],_0x32a806);_0x335d44[_0x9d32('0x16')][_0x32a806[_0x9d32('0x3c')]]['dialQueueProject']=_0x32a806[_0x9d32('0x64')]?_0x32a806[_0x9d32('0x64')][_0x9d32('0x3c')]:undefined;}}}return _0x335d44['campaigns'];};};Realtime[_0x9d32('0x38')][_0x9d32('0x65')]=function(){var _0x30e000=this;return function(_0x4cf662){if(_0x4cf662){freeIsNotKey(_0x4cf662,_0x30e000[_0x9d32('0x18')],'id');for(var _0x44390f=0x0,_0x251753={};_0x44390f<_0x4cf662[_0x9d32('0x3b')];_0x44390f+=0x1){_0x251753=_0x4cf662[_0x44390f];if(_[_0x9d32('0x3f')](_0x30e000['voiceExtensions'][_0x251753['id']])){_0x30e000['voiceExtensions'][_0x251753['id']]=new VoiceExtension(_0x251753);}else{_0x30e000['mergeFromDatabase'](_0x30e000[_0x9d32('0x18')][_0x251753['id']],_0x251753);}}}return _0x30e000['voiceExtensions'];};};Realtime[_0x9d32('0x38')][_0x9d32('0x66')]=function(){var _0x13682f=this;return function(_0x56100d){clearCampaigns(_0x13682f[_0x9d32('0x16')]);for(var _0xb303f8=0x0;_0xb303f8<_0x56100d[_0x9d32('0x3b')];_0xb303f8+=0x1){_[_0x9d32('0x50')](_0x13682f[_0x9d32('0x16')][_0x56100d[_0xb303f8][_0x9d32('0x3c')]],_0x56100d[_0xb303f8]);}return _0x13682f[_0x9d32('0x16')];};};Realtime['prototype'][_0x9d32('0x67')]=function(){var _0x40b522=this;return function(_0xd8b7a){if(_0xd8b7a){freeIsNotKey(_0xd8b7a,_0x40b522[_0x9d32('0x68')],'id');for(var _0x5a5ba0=0x0,_0x55ed1a={},_0x28d017={};_0x5a5ba0<_0xd8b7a['length'];_0x5a5ba0+=0x1){_0x55ed1a=_0xd8b7a[_0x5a5ba0];if(_[_0x9d32('0x3f')](_0x40b522['faxAccounts'][_0x55ed1a['id']])){_0x40b522['faxAccounts'][_0x55ed1a['id']]=new FaxAccount(_0x55ed1a);}else{_0x40b522['mergeFromDatabase'](_0x40b522[_0x9d32('0x68')][_0x55ed1a['id']],_0x55ed1a);}}}return _0x40b522[_0x9d32('0x68')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index a01911f..c5602a4 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 _0x9c2a=['../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','create','destination','exten','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','channel','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','transfereelinkedid','uniqueid','monitor','monitors','createdAt','connectedlinename','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','transfererlinkedid','exports','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport'];(function(_0xb5053f,_0x193b54){var _0x50188c=function(_0x5877e0){while(--_0x5877e0){_0xb5053f['push'](_0xb5053f['shift']());}};_0x50188c(++_0x193b54);}(_0x9c2a,0x1d6));var _0xa9c2=function(_0x1220dc,_0x448145){_0x1220dc=_0x1220dc-0x0;var _0x264ada=_0x9c2a[_0x1220dc];return _0x264ada;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xa9c2('0x0'));var config=require(_0xa9c2('0x1'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xa9c2('0x2'));var RpcVoiceCallReport=require(_0xa9c2('0x3'));var RpcVoiceDialReport=require(_0xa9c2('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xa9c2('0x5'));var RpcVoiceTransferReport=require(_0xa9c2('0x6'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xa9c2('0x7'));var VoiceDialReport=require(_0xa9c2('0x8'));var UserReport=require(_0xa9c2('0x9'));function Report(_0x51a106){this[_0xa9c2('0xa')]=_0x51a106;this[_0xa9c2('0xb')]=_0x51a106[_0xa9c2('0xb')];this[_0xa9c2('0xc')]=_0x51a106[_0xa9c2('0xc')];}Report[_0xa9c2('0xd')]['sync']=function(_0x169805){var _0x50aac6=new VoiceQueueReport(this['realtime']);var _0x4eecba=new VoiceAgentReport(this[_0xa9c2('0xa')]);var _0x1e917f=new VoiceDialReport(this[_0xa9c2('0xa')]);var _0x33670a=new VoiceCallReport(this[_0xa9c2('0xa')]);var _0x1f403b=new UserReport(this[_0xa9c2('0xa')]);if(config[_0xa9c2('0xe')]&&config[_0xa9c2('0xe')][_0xa9c2('0xf')]){ami['on'](_0xa9c2('0x10'),this[_0xa9c2('0x11')][_0xa9c2('0x12')](this));ami['on'](_0xa9c2('0x13'),this[_0xa9c2('0x14')][_0xa9c2('0x12')](this));ami['on'](_0xa9c2('0x15'),this[_0xa9c2('0x16')]['bind'](this));ami['on'](_0xa9c2('0x17'),this['voiceDialReport'][_0xa9c2('0x12')](this));ami['on'](_0xa9c2('0x18'),this[_0xa9c2('0x19')][_0xa9c2('0x12')](this));ami['on'](_0xa9c2('0x1a'),this[_0xa9c2('0x1b')]['bind'](this));}};Report[_0xa9c2('0xd')][_0xa9c2('0x1c')]=function(_0x368da3){var _0x29a926;_0x29a926=_[_0xa9c2('0x1d')](this[_0xa9c2('0xb')],function(_0x55126c){return _0x55126c[_0xa9c2('0x1e')]==_0x368da3||_0x55126c[_0xa9c2('0x1f')]==_0x368da3;});if(_['isNil'](_0x29a926)){var _0x40706=_[_0xa9c2('0x1d')](this[_0xa9c2('0xc')],function(_0x5b3734){return _0x5b3734['accountcode']==_0x368da3||_0x5b3734['name']==_0x368da3;});if(_0x40706){_0x29a926=_[_0xa9c2('0x1d')](this[_0xa9c2('0xb')],function(_0x4067c3){return _0x4067c3[_0xa9c2('0x20')]==util[_0xa9c2('0x21')](_0xa9c2('0x22'),_0x40706[_0xa9c2('0x1f')]);});}}return _0x29a926;};Report['prototype'][_0xa9c2('0x11')]=function(_0x496fb2){for(var _0x4ec550=0x0;_0x4ec550<_0x496fb2[_0xa9c2('0x23')];_0x4ec550+=0x1){var _0x45a3cd=this[_0xa9c2('0x1c')](_0x496fb2[_0x4ec550][_0xa9c2('0x24')]);if(_0x45a3cd){_0x496fb2[_0x4ec550][_0xa9c2('0x1e')]=_0x45a3cd['accountcode'];_0x496fb2[_0x4ec550][_0xa9c2('0x25')]=!![];_0x496fb2[_0x4ec550][_0xa9c2('0x26')]=_0x45a3cd[_0xa9c2('0x1f')];_0x496fb2[_0x4ec550]['interface']=_['isNil'](_0x45a3cd[_0xa9c2('0x20')])?util['format'](_0xa9c2('0x22'),_0x45a3cd[_0xa9c2('0x1f')]):_0x45a3cd[_0xa9c2('0x20')];if(_0x496fb2[_0x4ec550][_0xa9c2('0x27')]){_0x496fb2[_0x4ec550][_0xa9c2('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x496fb2[_0x4ec550]['queuecallerexit']){_0x496fb2[_0x4ec550]['queuecallerexitAt']=moment()[_0xa9c2('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xa9c2('0x11')](_0x496fb2[_0x4ec550]);}RpcVoiceQueueReport[_0xa9c2('0x29')](_0x496fb2[_0x4ec550]);}};function extractCalleridNumber(_0x1992ca){var _0x31b837=_0x1992ca['match'](/<(.*?)>/);return _0x31b837?_0x31b837[0x1]:_0x1992ca;}Report[_0xa9c2('0xd')][_0xa9c2('0x14')]=function(_0x3ba011){_0x3ba011['destination']=_0x3ba011[_0xa9c2('0x2a')]||_0x3ba011[_0xa9c2('0x2b')];if(_0x3ba011[_0xa9c2('0x2c')]==_0xa9c2('0x2d')){_0x3ba011[_0xa9c2('0x2e')]='queue';_0x3ba011[_0xa9c2('0x2f')]=_0x3ba011[_0xa9c2('0x30')];if(_0x3ba011[_0xa9c2('0x31')]==_0xa9c2('0x32')){_0x3ba011['accountcode']='';_0x3ba011[_0xa9c2('0x2a')]=extractCalleridNumber(_0x3ba011[_0xa9c2('0x33')]);}else if(_0x3ba011[_0xa9c2('0x31')]==_0xa9c2('0x34')){if(_0x3ba011[_0xa9c2('0x2a')]=='xcally-motion-preview'){_0x3ba011[_0xa9c2('0x2a')]=extractCalleridNumber(_0x3ba011[_0xa9c2('0x35')]);_0x3ba011[_0xa9c2('0x36')]=_0x3ba011[_0xa9c2('0x37')];_0x3ba011['destinationchannel']=[_0x3ba011['channel'],_0x3ba011[_0xa9c2('0x38')]=_0x3ba011['destinationchannel']][0x0];_0x3ba011[_0xa9c2('0x33')]=_0x3ba011[_0xa9c2('0x35')];}else{_0x3ba011[_0xa9c2('0x2a')]=_0x3ba011[_0xa9c2('0x36')];_0x3ba011[_0xa9c2('0x36')]=_0x3ba011[_0xa9c2('0x37')];if(_0x3ba011[_0xa9c2('0x39')]=='ANSWERED'){_0x3ba011[_0xa9c2('0x1e')]=_0x3ba011[_0xa9c2('0x24')];}else{_0x3ba011[_0xa9c2('0x1e')]='';}}}}else{_0x3ba011[_0xa9c2('0x33')]=util[_0xa9c2('0x21')](_0xa9c2('0x3a'),_0x3ba011[_0xa9c2('0x3b')],_0x3ba011[_0xa9c2('0x36')]);}if(RpcVoiceTransferReport[_0xa9c2('0x3c')][_0x3ba011['linkedid']]){var _0x410f67=RpcVoiceTransferReport[_0xa9c2('0x3c')][_0x3ba011['linkedid']];_0x410f67[_0xa9c2('0x3d')]=_0x3ba011[_0xa9c2('0x3e')];RpcVoiceTransferReport['blindTransfer'](_0x410f67);delete RpcVoiceTransferReport['transfers'][_0x3ba011['linkedid']];}RpcVoiceCallReport[_0xa9c2('0x29')](_0x3ba011);if(_0x3ba011[_0xa9c2('0x3f')]){for(var _0x5a05f1=0x0;_0x5a05f1<_0x3ba011[_0xa9c2('0x40')][_0xa9c2('0x23')];_0x5a05f1+=0x1){_0x3ba011['monitorFilename']=_0x3ba011[_0xa9c2('0x40')][_0x5a05f1]['filename'];_0x3ba011[_0xa9c2('0x41')]=_0x3ba011['monitors'][_0x5a05f1][_0xa9c2('0x41')];if(_0x3ba011[_0xa9c2('0x2b')]=='xcally-motion-preview'){_0x3ba011['calleridnum']=_0x3ba011[_0xa9c2('0x24')];_0x3ba011[_0xa9c2('0x3b')]=_0x3ba011[_0xa9c2('0x42')];_0x3ba011[_0xa9c2('0x24')]=_0x3ba011[_0xa9c2('0x1e')];_0x3ba011['connectedlinename']=_0x3ba011['membername'];_0x3ba011[_0xa9c2('0x2b')]=_0x3ba011[_0xa9c2('0x37')];}else if(_0x3ba011[_0xa9c2('0x2b')]=='xcally-motion-dialer'){_0x3ba011[_0xa9c2('0x36')]=_0x3ba011[_0xa9c2('0x2a')];_0x3ba011[_0xa9c2('0x2b')]=_0x3ba011[_0xa9c2('0x37')];}RpcVoiceRecording['create'](_0x3ba011);}}};Report[_0xa9c2('0xd')][_0xa9c2('0x16')]=function(_0x48ffce){if(_['isArray'](_0x48ffce)){_0x48ffce[_0xa9c2('0x43')](function(_0x4fefe0){RpcVoiceAgentReport[_0xa9c2('0x29')](_0x4fefe0);});}else{RpcVoiceAgentReport[_0xa9c2('0x29')](_0x48ffce);}};Report[_0xa9c2('0xd')][_0xa9c2('0x44')]=function(_0xd90415){RpcVoiceDialReport[_0xa9c2('0x29')](_0xd90415);var _0x742cc0;var _0x25605c;var _0x641301=_0xd90415[_0xa9c2('0x38')];if(_[_0xa9c2('0x45')](_0x641301,_0xa9c2('0x46'))){_0x25605c=_0x641301[_0xa9c2('0x47')](_0x641301[_0xa9c2('0x48')]('/')+0x1,_0x641301['indexOf']('@'));_0x742cc0=_[_0xa9c2('0x1d')](this[_0xa9c2('0xb')],function(_0x3f7a57){return _0x3f7a57[_0xa9c2('0x49')]==_0x25605c||_0x3f7a57[_0xa9c2('0x4a')]==_0x25605c||_0x3f7a57[_0xa9c2('0x1e')]==_0x25605c;});}else{_0x25605c=_0x641301[_0xa9c2('0x47')](_0x641301[_0xa9c2('0x48')]('/')+0x1,_0x641301[_0xa9c2('0x4b')]('-'));_0x742cc0=this['findAgent'](_0x25605c);}if(_0x742cc0){_0xd90415[_0xa9c2('0x20')]=_['isNil'](_0x742cc0[_0xa9c2('0x20')])?util[_0xa9c2('0x21')](_0xa9c2('0x22'),_0x742cc0[_0xa9c2('0x1f')]):_0x742cc0[_0xa9c2('0x20')];_0xd90415[_0xa9c2('0x4c')]=_0x742cc0['name'];_0xd90415[_0xa9c2('0x1e')]=_0x742cc0['accountcode'];RpcMemberReport['voiceDialReport'](_0xd90415);}};Report[_0xa9c2('0xd')][_0xa9c2('0x19')]=function(_0x412c51){RpcVoiceTransferReport[_0xa9c2('0x3c')][_0x412c51[_0xa9c2('0x4d')]]=_0x412c51;};Report[_0xa9c2('0xd')][_0xa9c2('0x1b')]=function(_0x59181e){RpcVoiceTransferReport[_0xa9c2('0x1b')](_0x59181e);};module[_0xa9c2('0x4e')]=Report; \ No newline at end of file +var _0x74fd=['blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','type','lastapplication','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','monitor','monitors','length','monitorFilename','filename','createdAt','connectedlinename','connectedlinenum','membername','xcally-motion-dialer','create','voiceAgentReport','isArray','forEach','Local','indexOf','mobile','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x74fd,0x145));var _0xd74f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x74fd[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xd74f('0x0'));var moment=require(_0xd74f('0x1'));var util=require(_0xd74f('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xd74f('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xd74f('0x4'));var RpcMemberReport=require(_0xd74f('0x5'));var RpcVoiceQueueReport=require(_0xd74f('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xd74f('0x7'));var VoiceQueueReport=require(_0xd74f('0x8'));var VoiceCallReport=require(_0xd74f('0x9'));var VoiceAgentReport=require(_0xd74f('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xd74f('0xb'));function Report(_0x2f8c7a){this['realtime']=_0x2f8c7a;this[_0xd74f('0xc')]=_0x2f8c7a[_0xd74f('0xc')];this[_0xd74f('0xd')]=_0x2f8c7a['telephones'];}Report[_0xd74f('0xe')][_0xd74f('0xf')]=function(_0x13d66d){var _0x488720=new VoiceQueueReport(this[_0xd74f('0x10')]);var _0x3bb5e6=new VoiceAgentReport(this[_0xd74f('0x10')]);var _0x3a2aad=new VoiceDialReport(this[_0xd74f('0x10')]);var _0x19b80c=new VoiceCallReport(this[_0xd74f('0x10')]);var _0xbee703=new UserReport(this['realtime']);if(config[_0xd74f('0x11')]&&config[_0xd74f('0x11')][_0xd74f('0x12')]){ami['on'](_0xd74f('0x13'),this[_0xd74f('0x14')][_0xd74f('0x15')](this));ami['on'](_0xd74f('0x16'),this[_0xd74f('0x17')][_0xd74f('0x15')](this));ami['on'](_0xd74f('0x18'),this['voiceAgentReport'][_0xd74f('0x15')](this));ami['on'](_0xd74f('0x19'),this[_0xd74f('0x1a')]['bind'](this));ami['on']('blindtransfer',this[_0xd74f('0x1b')]['bind'](this));ami['on'](_0xd74f('0x1c'),this['attendedTransfer'][_0xd74f('0x15')](this));}};Report[_0xd74f('0xe')][_0xd74f('0x1d')]=function(_0x330219){var _0x24674a;_0x24674a=_[_0xd74f('0x1e')](this['agents'],function(_0x1dada4){return _0x1dada4[_0xd74f('0x1f')]==_0x330219||_0x1dada4[_0xd74f('0x20')]==_0x330219;});if(_[_0xd74f('0x21')](_0x24674a)){var _0x1d105b=_['find'](this[_0xd74f('0xd')],function(_0x1d5fe0){return _0x1d5fe0[_0xd74f('0x1f')]==_0x330219||_0x1d5fe0[_0xd74f('0x20')]==_0x330219;});if(_0x1d105b){_0x24674a=_[_0xd74f('0x1e')](this[_0xd74f('0xc')],function(_0x2ba738){return _0x2ba738['interface']==util[_0xd74f('0x22')](_0xd74f('0x23'),_0x1d105b['name']);});}}return _0x24674a;};Report[_0xd74f('0xe')][_0xd74f('0x14')]=function(_0x22648c){for(var _0x37dbf3=0x0;_0x37dbf3<_0x22648c['length'];_0x37dbf3+=0x1){var _0x47209c=this[_0xd74f('0x1d')](_0x22648c[_0x37dbf3]['connectedlinenum']);if(_0x47209c){_0x22648c[_0x37dbf3][_0xd74f('0x1f')]=_0x47209c[_0xd74f('0x1f')];_0x22648c[_0x37dbf3][_0xd74f('0x24')]=!![];_0x22648c[_0x37dbf3][_0xd74f('0x25')]=_0x47209c[_0xd74f('0x20')];_0x22648c[_0x37dbf3]['interface']=_[_0xd74f('0x21')](_0x47209c[_0xd74f('0x26')])?util[_0xd74f('0x22')]('SIP/%s',_0x47209c['name']):_0x47209c[_0xd74f('0x26')];if(_0x22648c[_0x37dbf3][_0xd74f('0x27')]){_0x22648c[_0x37dbf3][_0xd74f('0x28')]=moment()[_0xd74f('0x22')](_0xd74f('0x29'));}if(_0x22648c[_0x37dbf3][_0xd74f('0x2a')]){_0x22648c[_0x37dbf3][_0xd74f('0x2b')]=moment()['format'](_0xd74f('0x29'));}RpcMemberReport[_0xd74f('0x14')](_0x22648c[_0x37dbf3]);}RpcVoiceQueueReport['create'](_0x22648c[_0x37dbf3]);}};function extractCalleridNumber(_0x19df1b){var _0x9ec6c0=_0x19df1b[_0xd74f('0x2c')](/<(.*?)>/);return _0x9ec6c0?_0x9ec6c0[0x1]:_0x19df1b;}Report[_0xd74f('0xe')][_0xd74f('0x17')]=function(_0x1cc4c5){_0x1cc4c5['destination']=_0x1cc4c5[_0xd74f('0x2d')]||_0x1cc4c5[_0xd74f('0x2e')];if(_0x1cc4c5[_0xd74f('0x2f')]=='dialer'){_0x1cc4c5[_0xd74f('0x30')]='queue';_0x1cc4c5[_0xd74f('0x31')]=_0x1cc4c5['queue'];if(_0x1cc4c5[_0xd74f('0x32')]==_0xd74f('0x33')){_0x1cc4c5['accountcode']='';_0x1cc4c5[_0xd74f('0x2d')]=extractCalleridNumber(_0x1cc4c5[_0xd74f('0x34')]);}else if(_0x1cc4c5[_0xd74f('0x32')]==_0xd74f('0x35')){if(_0x1cc4c5[_0xd74f('0x2d')]==_0xd74f('0x36')){_0x1cc4c5['destination']=extractCalleridNumber(_0x1cc4c5['calleridpreview']);_0x1cc4c5['calleridnum']=_0x1cc4c5[_0xd74f('0x37')];_0x1cc4c5[_0xd74f('0x38')]=[_0x1cc4c5[_0xd74f('0x39')],_0x1cc4c5['channel']=_0x1cc4c5['destinationchannel']][0x0];_0x1cc4c5[_0xd74f('0x34')]=_0x1cc4c5[_0xd74f('0x3a')];}else{_0x1cc4c5[_0xd74f('0x2d')]=_0x1cc4c5['calleridnum'];_0x1cc4c5[_0xd74f('0x3b')]=_0x1cc4c5[_0xd74f('0x37')];if(_0x1cc4c5[_0xd74f('0x3c')]==_0xd74f('0x3d')){_0x1cc4c5[_0xd74f('0x1f')]=_0x1cc4c5['connectedlinenum'];}else{_0x1cc4c5[_0xd74f('0x1f')]='';}}}}else{_0x1cc4c5['callerid']=util[_0xd74f('0x22')](_0xd74f('0x3e'),_0x1cc4c5[_0xd74f('0x3f')],_0x1cc4c5['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x1cc4c5[_0xd74f('0x40')]]){var _0x85c2d5=RpcVoiceTransferReport['transfers'][_0x1cc4c5[_0xd74f('0x40')]];_0x85c2d5[_0xd74f('0x41')]=_0x1cc4c5[_0xd74f('0x42')];RpcVoiceTransferReport[_0xd74f('0x1b')](_0x85c2d5);delete RpcVoiceTransferReport['transfers'][_0x1cc4c5[_0xd74f('0x40')]];}RpcVoiceCallReport['create'](_0x1cc4c5);if(_0x1cc4c5[_0xd74f('0x43')]){for(var _0x5f615=0x0;_0x5f615<_0x1cc4c5[_0xd74f('0x44')][_0xd74f('0x45')];_0x5f615+=0x1){_0x1cc4c5[_0xd74f('0x46')]=_0x1cc4c5[_0xd74f('0x44')][_0x5f615][_0xd74f('0x47')];_0x1cc4c5[_0xd74f('0x48')]=_0x1cc4c5[_0xd74f('0x44')][_0x5f615][_0xd74f('0x48')];if(_0x1cc4c5[_0xd74f('0x2e')]==_0xd74f('0x36')){_0x1cc4c5[_0xd74f('0x3b')]=_0x1cc4c5['connectedlinenum'];_0x1cc4c5['calleridname']=_0x1cc4c5[_0xd74f('0x49')];_0x1cc4c5[_0xd74f('0x4a')]=_0x1cc4c5[_0xd74f('0x1f')];_0x1cc4c5[_0xd74f('0x49')]=_0x1cc4c5[_0xd74f('0x4b')];_0x1cc4c5['exten']=_0x1cc4c5[_0xd74f('0x37')];}else if(_0x1cc4c5[_0xd74f('0x2e')]==_0xd74f('0x4c')){_0x1cc4c5['calleridnum']=_0x1cc4c5[_0xd74f('0x2d')];_0x1cc4c5[_0xd74f('0x2e')]=_0x1cc4c5['originatecalleridnum'];}RpcVoiceRecording[_0xd74f('0x4d')](_0x1cc4c5);}}};Report[_0xd74f('0xe')][_0xd74f('0x4e')]=function(_0x474566){if(_[_0xd74f('0x4f')](_0x474566)){_0x474566[_0xd74f('0x50')](function(_0x393432){RpcVoiceAgentReport[_0xd74f('0x4d')](_0x393432);});}else{RpcVoiceAgentReport[_0xd74f('0x4d')](_0x474566);}};Report['prototype']['voiceDialReport']=function(_0x5f3982){RpcVoiceDialReport[_0xd74f('0x4d')](_0x5f3982);var _0xfcb89a;var _0x3f040c;var _0x321004=_0x5f3982[_0xd74f('0x39')];if(_['startsWith'](_0x321004,_0xd74f('0x51'))){_0x3f040c=_0x321004['substring'](_0x321004[_0xd74f('0x52')]('/')+0x1,_0x321004[_0xd74f('0x52')]('@'));_0xfcb89a=_[_0xd74f('0x1e')](this['agents'],function(_0x2147a5){return _0x2147a5[_0xd74f('0x53')]==_0x3f040c||_0x2147a5['phone']==_0x3f040c||_0x2147a5[_0xd74f('0x1f')]==_0x3f040c;});}else{_0x3f040c=_0x321004[_0xd74f('0x54')](_0x321004[_0xd74f('0x52')]('/')+0x1,_0x321004[_0xd74f('0x55')]('-'));_0xfcb89a=this[_0xd74f('0x1d')](_0x3f040c);}if(_0xfcb89a){_0x5f3982[_0xd74f('0x26')]=_[_0xd74f('0x21')](_0xfcb89a[_0xd74f('0x26')])?util[_0xd74f('0x22')]('SIP/%s',_0xfcb89a['name']):_0xfcb89a[_0xd74f('0x26')];_0x5f3982[_0xd74f('0x4b')]=_0xfcb89a[_0xd74f('0x20')];_0x5f3982[_0xd74f('0x1f')]=_0xfcb89a['accountcode'];RpcMemberReport[_0xd74f('0x1a')](_0x5f3982);}};Report['prototype']['blindTransfer']=function(_0x3040c1){RpcVoiceTransferReport['transfers'][_0x3040c1[_0xd74f('0x56')]]=_0x3040c1;};Report[_0xd74f('0xe')]['attendedTransfer']=function(_0x182559){RpcVoiceTransferReport['attendedTransfer'](_0x182559);};module[_0xd74f('0x57')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 9023c67..7e39afa 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8f5=['[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','ioredis','bluebird','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','registry','syncRegistry','bind','syncDeviceState','peerstatus','actionSipShowRegistry','catch','error','inspect','resolve','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','find','username','stateRegistry','state','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','toLowerCase','inuse','device','local','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','startsWith','Local','indexOf','mobile','phone','accountcode','syncPeerStatus'];(function(_0x208d8b,_0x2ba352){var _0x5422f7=function(_0x3f952c){while(--_0x3f952c){_0x208d8b['push'](_0x208d8b['shift']());}};_0x5422f7(++_0x2ba352);}(_0xc8f5,0x17f));var _0x5c8f=function(_0x45c9f4,_0x2eec90){_0x45c9f4=_0x45c9f4-0x0;var _0x1f9be9=_0xc8f5[_0x45c9f4];return _0x1f9be9;};'use strict';var _=require(_0x5c8f('0x0'));var moment=require(_0x5c8f('0x1'));var util=require('util');var Redis=require(_0x5c8f('0x2'));var BPromise=require(_0x5c8f('0x3'));var config=require('../../../config/environment');var logger=require(_0x5c8f('0x4'))(_0x5c8f('0x5'));var ami=require(_0x5c8f('0x6'));config['redis']=_['defaults'](config[_0x5c8f('0x7')],{'host':_0x5c8f('0x8'),'port':0x18eb});var io=require(_0x5c8f('0x9'))(new Redis(config[_0x5c8f('0x7')]));function UserReport(_0x72a246){this[_0x5c8f('0xa')]=_0x72a246[_0x5c8f('0xa')];this[_0x5c8f('0xb')]=_0x72a246[_0x5c8f('0xb')];this[_0x5c8f('0xc')]=_0x72a246[_0x5c8f('0xc')];ami['on'](_0x5c8f('0xd'),this['syncRegistry']['bind'](this));ami['on'](_0x5c8f('0xe'),this[_0x5c8f('0xf')][_0x5c8f('0x10')](this));ami['on']('devicestatechange',this[_0x5c8f('0x11')][_0x5c8f('0x10')](this));ami['on'](_0x5c8f('0x12'),this['syncPeerStatus']['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()['then'](ami[_0x5c8f('0x13')]())[_0x5c8f('0x14')](function(_0x240f43){logger[_0x5c8f('0x15')]('[userReport][sipshowregistry]',util[_0x5c8f('0x16')](_0x240f43,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x5c8f('0x17')]()[_0x5c8f('0x18')](ami[_0x5c8f('0x19')]())[_0x5c8f('0x14')](function(_0x2aa31d){logger[_0x5c8f('0x15')](_0x5c8f('0x1a'),util[_0x5c8f('0x16')](_0x2aa31d,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x5c8f('0x17')]()['then'](ami[_0x5c8f('0x1b')]())[_0x5c8f('0x14')](function(_0x5cafe6){logger['error'](_0x5c8f('0x1c'),util['inspect'](_0x5cafe6,{'showHidden':![],'depth':null}));});}UserReport[_0x5c8f('0x1d')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x5c8f('0x17')]()[_0x5c8f('0x18')](showSipRegistrations())['then'](listDeviceStates())[_0x5c8f('0x18')](showPeersStatus());},0x32c8);};UserReport[_0x5c8f('0x1d')][_0x5c8f('0x1e')]=function(_0x5aa4a9){return _0x5aa4a9!==null&&!_['isUndefined'](_0x5aa4a9);};UserReport[_0x5c8f('0x1d')][_0x5c8f('0x1f')]=function(_0x29d715,_0x2ddeca,_0x1783d5){io['to'](_0x29d715)[_0x5c8f('0x1f')](_0x2ddeca,_0x1783d5);};UserReport[_0x5c8f('0x1d')]['syncRegistry']=function(_0x1d7346){try{if(this[_0x5c8f('0x1e')](_0x1d7346)){logger[_0x5c8f('0x20')](_0x5c8f('0x21'),_0x1d7346['username'],_0x1d7346['state']);logger[_0x5c8f('0x22')]('[userReport][registry]',util[_0x5c8f('0x16')](_0x1d7346,{'showHidden':![],'depth':null}));var _0x249f42=_[_0x5c8f('0x23')](this[_0x5c8f('0xa')],{'defaultuser':_0x1d7346[_0x5c8f('0x24')]});if(_0x249f42){_0x1d7346[_0x5c8f('0x25')]=_0x1d7346[_0x5c8f('0x26')];_[_0x5c8f('0x27')](_0x249f42,_[_0x5c8f('0x28')](_0x1d7346,[_0x5c8f('0x29'),'actionid',_0x5c8f('0x24'),_0x5c8f('0x26')]));logger[_0x5c8f('0x22')](_0x5c8f('0x2a'),util['inspect'](_0x249f42,{'showHidden':![],'depth':null}));this[_0x5c8f('0x1f')](util[_0x5c8f('0x2b')](_0x5c8f('0x2c'),_0x249f42[_0x5c8f('0x2d')]),_0x5c8f('0x2e'),_0x249f42);}}}catch(_0x82c0bf){logger['error'](_0x5c8f('0x2f'),util[_0x5c8f('0x16')](_0x82c0bf,{'showHidden':![],'depth':null}));}};UserReport[_0x5c8f('0x1d')][_0x5c8f('0x11')]=function(_0x26c85d){try{if(this[_0x5c8f('0x1e')](_0x26c85d)){logger['info'](_0x5c8f('0x30'),_0x26c85d['device'],_0x26c85d[_0x5c8f('0x26')]);logger[_0x5c8f('0x22')](_0x5c8f('0x31'),util[_0x5c8f('0x16')](_0x26c85d,{'showHidden':![],'depth':null}));if(this['agents'][_0x26c85d['device']]){if(!this[_0x5c8f('0xb')][_0x26c85d['device']]['local']||_0x26c85d[_0x5c8f('0x26')][_0x5c8f('0x32')]()==_0x5c8f('0x33')){this['agents'][_0x26c85d[_0x5c8f('0x34')]][_0x5c8f('0x35')]=![];if(this[_0x5c8f('0xb')][_0x26c85d[_0x5c8f('0x34')]]['state']!==_0x26c85d[_0x5c8f('0x26')]['toLowerCase']()){this['agents'][_0x26c85d[_0x5c8f('0x34')]][_0x5c8f('0x36')]=_[_0x5c8f('0x37')](moment()[_0x5c8f('0x2b')]('x'));}this[_0x5c8f('0xb')][_0x26c85d[_0x5c8f('0x34')]][_0x5c8f('0x26')]=_0x26c85d[_0x5c8f('0x26')][_0x5c8f('0x32')]();this[_0x5c8f('0xb')][_0x26c85d[_0x5c8f('0x34')]][_0x5c8f('0x38')](_0x26c85d);}}else if(this[_0x5c8f('0xc')][_0x26c85d['device']]){if(this[_0x5c8f('0xc')][_0x26c85d[_0x5c8f('0x34')]][_0x5c8f('0x26')]!==_0x26c85d[_0x5c8f('0x26')][_0x5c8f('0x32')]()){this[_0x5c8f('0xc')][_0x26c85d[_0x5c8f('0x34')]][_0x5c8f('0x36')]=_[_0x5c8f('0x37')](moment()[_0x5c8f('0x2b')]('x'));}this[_0x5c8f('0xc')][_0x26c85d['device']][_0x5c8f('0x26')]=_0x26c85d[_0x5c8f('0x26')][_0x5c8f('0x32')]();logger[_0x5c8f('0x22')](_0x5c8f('0x39'),util[_0x5c8f('0x16')](this[_0x5c8f('0xc')][_0x26c85d[_0x5c8f('0x34')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x5c8f('0x3a'),this[_0x5c8f('0xc')][_0x26c85d[_0x5c8f('0x34')]][_0x5c8f('0x2d')]),_0x5c8f('0x3b'),this[_0x5c8f('0xc')][_0x26c85d[_0x5c8f('0x34')]]);}else if(this[_0x5c8f('0xa')][_0x26c85d[_0x5c8f('0x34')]]){if(this[_0x5c8f('0xa')][_0x26c85d[_0x5c8f('0x34')]]['state']!==_0x26c85d['state'][_0x5c8f('0x32')]()){this[_0x5c8f('0xa')][_0x26c85d[_0x5c8f('0x34')]][_0x5c8f('0x36')]=_['toNumber'](moment()['format']('x'));}this[_0x5c8f('0xa')][_0x26c85d[_0x5c8f('0x34')]][_0x5c8f('0x26')]=_0x26c85d[_0x5c8f('0x26')][_0x5c8f('0x32')]();logger[_0x5c8f('0x22')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x5c8f('0x16')](this[_0x5c8f('0xa')][_0x26c85d[_0x5c8f('0x34')]],{'showHidden':![],'depth':null}));this[_0x5c8f('0x1f')](util['format']('trunk:%s',this[_0x5c8f('0xa')][_0x26c85d[_0x5c8f('0x34')]][_0x5c8f('0x2d')]),'trunk:save',this['trunks'][_0x26c85d[_0x5c8f('0x34')]]);}else if(_[_0x5c8f('0x3c')](_0x26c85d[_0x5c8f('0x34')],_0x5c8f('0x3d'))){var _0x1199e5=_0x26c85d[_0x5c8f('0x34')];var _0x437895=_0x1199e5['substring'](_0x1199e5['indexOf']('/')+0x1,_0x1199e5[_0x5c8f('0x3e')]('@'));var _0x4cff1a=_[_0x5c8f('0x23')](this[_0x5c8f('0xb')],function(_0x1fa104){return _0x1fa104[_0x5c8f('0x3f')]==_0x437895||_0x1fa104[_0x5c8f('0x40')]==_0x437895||_0x1fa104[_0x5c8f('0x41')]==_0x437895;});if(_0x4cff1a){if(_0x4cff1a[_0x5c8f('0x26')]!==_0x26c85d[_0x5c8f('0x26')][_0x5c8f('0x32')]()){_0x4cff1a[_0x5c8f('0x36')]=_[_0x5c8f('0x37')](moment()[_0x5c8f('0x2b')]('x'));}_0x4cff1a['state']=_0x26c85d[_0x5c8f('0x26')][_0x5c8f('0x32')]();_0x4cff1a['local']=!![];_0x4cff1a['updateStatusRealtime'](_0x26c85d);}}}}catch(_0x52c0fb){logger[_0x5c8f('0x15')](_0x5c8f('0x31'),util[_0x5c8f('0x16')](_0x52c0fb,{'showHidden':![],'depth':null}));}};UserReport[_0x5c8f('0x1d')][_0x5c8f('0x42')]=function(_0x4455b7){try{if(this[_0x5c8f('0x1e')](_0x4455b7)&&this[_0x5c8f('0x1e')](_0x4455b7[_0x5c8f('0x12')])){logger[_0x5c8f('0x20')](_0x5c8f('0x43'),_0x4455b7[_0x5c8f('0x44')],_0x4455b7[_0x5c8f('0x45')],_0x4455b7[_0x5c8f('0x12')]);logger['debug'](_0x5c8f('0x46'),util[_0x5c8f('0x16')](_0x4455b7,{'showHidden':![],'depth':null}));if(this[_0x5c8f('0xb')][_0x4455b7['peer']]){if(!this[_0x5c8f('0xb')][_0x4455b7[_0x5c8f('0x44')]][_0x5c8f('0x35')]||_0x4455b7[_0x5c8f('0x12')]['toLowerCase']()=='registered'){this[_0x5c8f('0xb')][_0x4455b7[_0x5c8f('0x44')]]['local']=![];this[_0x5c8f('0xb')][_0x4455b7[_0x5c8f('0x44')]][_0x5c8f('0x47')]=_0x4455b7[_0x5c8f('0x12')][_0x5c8f('0x32')]();this[_0x5c8f('0xb')][_0x4455b7[_0x5c8f('0x44')]]['address']=_0x4455b7[_0x5c8f('0x45')];this[_0x5c8f('0xb')][_0x4455b7[_0x5c8f('0x44')]][_0x5c8f('0x38')](_0x4455b7);}}else if(this[_0x5c8f('0xc')][_0x4455b7[_0x5c8f('0x44')]]){this[_0x5c8f('0xc')][_0x4455b7[_0x5c8f('0x44')]][_0x5c8f('0x47')]=_0x4455b7[_0x5c8f('0x12')][_0x5c8f('0x32')]();this[_0x5c8f('0xc')][_0x4455b7['peer']][_0x5c8f('0x45')]=_0x4455b7[_0x5c8f('0x45')];logger['debug'](_0x5c8f('0x48'),util[_0x5c8f('0x16')](this[_0x5c8f('0xc')][_0x4455b7['peer']],{'showHidden':![],'depth':null}));this[_0x5c8f('0x1f')](util[_0x5c8f('0x2b')](_0x5c8f('0x3a'),this['telephones'][_0x4455b7[_0x5c8f('0x44')]][_0x5c8f('0x2d')]),'telephone:save',this[_0x5c8f('0xc')][_0x4455b7[_0x5c8f('0x44')]]);}else if(this[_0x5c8f('0xa')][_0x4455b7['peer']]){this[_0x5c8f('0xa')][_0x4455b7[_0x5c8f('0x44')]][_0x5c8f('0x47')]=_0x4455b7[_0x5c8f('0x12')][_0x5c8f('0x32')]();this['trunks'][_0x4455b7[_0x5c8f('0x44')]][_0x5c8f('0x45')]=_0x4455b7[_0x5c8f('0x45')];logger[_0x5c8f('0x22')](_0x5c8f('0x49'),util['inspect'](this[_0x5c8f('0xa')][_0x4455b7['peer']],{'showHidden':![],'depth':null}));this[_0x5c8f('0x1f')](util[_0x5c8f('0x2b')](_0x5c8f('0x2c'),this[_0x5c8f('0xa')][_0x4455b7[_0x5c8f('0x44')]]['name']),_0x5c8f('0x2e'),this['trunks'][_0x4455b7[_0x5c8f('0x44')]]);}}}catch(_0x33b80){logger[_0x5c8f('0x15')](_0x5c8f('0x46'),util[_0x5c8f('0x16')](_0x33b80,{'showHidden':![],'depth':null}));}};module[_0x5c8f('0x4a')]=UserReport; \ No newline at end of file +var _0x96a6=['debug','[userReport][registry]','find','stateRegistry','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','agents','device','local','toLowerCase','inuse','toNumber','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','substring','indexOf','mobile','phone','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','exports','lodash','moment','ioredis','bluebird','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','registryentry','syncRegistry','bind','devicestatechange','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','resolve','actionDeviceStateList','error','inspect','prototype','isUndefined','emit','isNotNull','info','username','state'];(function(_0x271766,_0x3914ec){var _0x264c21=function(_0x5d599f){while(--_0x5d599f){_0x271766['push'](_0x271766['shift']());}};_0x264c21(++_0x3914ec);}(_0x96a6,0x195));var _0x696a=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x96a6[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x696a('0x0'));var moment=require(_0x696a('0x1'));var util=require('util');var Redis=require(_0x696a('0x2'));var BPromise=require(_0x696a('0x3'));var config=require(_0x696a('0x4'));var logger=require('../../../config/logger')(_0x696a('0x5'));var ami=require(_0x696a('0x6'));config[_0x696a('0x7')]=_[_0x696a('0x8')](config[_0x696a('0x7')],{'host':_0x696a('0x9'),'port':0x18eb});var io=require(_0x696a('0xa'))(new Redis(config[_0x696a('0x7')]));function UserReport(_0x31f7c7){this[_0x696a('0xb')]=_0x31f7c7[_0x696a('0xb')];this['agents']=_0x31f7c7['agents'];this[_0x696a('0xc')]=_0x31f7c7[_0x696a('0xc')];ami['on'](_0x696a('0xd'),this[_0x696a('0xe')][_0x696a('0xf')](this));ami['on']('registry',this['syncRegistry']['bind'](this));ami['on'](_0x696a('0x10'),this['syncDeviceState']['bind'](this));ami['on']('peerstatus',this[_0x696a('0x11')][_0x696a('0xf')](this));return this[_0x696a('0x12')]();}function showSipRegistrations(){Promise['resolve']()[_0x696a('0x13')](ami[_0x696a('0x14')]())[_0x696a('0x15')](function(_0xc233ef){logger['error']('[userReport][sipshowregistry]',util['inspect'](_0xc233ef,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x696a('0x16')]()[_0x696a('0x13')](ami[_0x696a('0x17')]())[_0x696a('0x15')](function(_0x1043d9){logger[_0x696a('0x18')]('[userReport][devicestatelist]',util['inspect'](_0x1043d9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x696a('0x16')]()[_0x696a('0x13')](ami['actionSipPeerStatus']())['catch'](function(_0x867acc){logger[_0x696a('0x18')]('[userReport][sippeerstatus]',util[_0x696a('0x19')](_0x867acc,{'showHidden':![],'depth':null}));});}UserReport[_0x696a('0x1a')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x696a('0x16')]()[_0x696a('0x13')](showSipRegistrations())[_0x696a('0x13')](listDeviceStates())[_0x696a('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x696a('0x1a')]['isNotNull']=function(_0x40a5b7){return _0x40a5b7!==null&&!_[_0x696a('0x1b')](_0x40a5b7);};UserReport['prototype']['emit']=function(_0x513aeb,_0x54dd32,_0x5ca6ee){io['to'](_0x513aeb)[_0x696a('0x1c')](_0x54dd32,_0x5ca6ee);};UserReport[_0x696a('0x1a')][_0x696a('0xe')]=function(_0x143e21){try{if(this[_0x696a('0x1d')](_0x143e21)){logger[_0x696a('0x1e')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x143e21[_0x696a('0x1f')],_0x143e21[_0x696a('0x20')]);logger[_0x696a('0x21')](_0x696a('0x22'),util[_0x696a('0x19')](_0x143e21,{'showHidden':![],'depth':null}));var _0x3a744e=_[_0x696a('0x23')](this['trunks'],{'defaultuser':_0x143e21['username']});if(_0x3a744e){_0x143e21[_0x696a('0x24')]=_0x143e21['state'];_['merge'](_0x3a744e,_[_0x696a('0x25')](_0x143e21,[_0x696a('0x26'),_0x696a('0x27'),_0x696a('0x1f'),_0x696a('0x20')]));logger['debug'](_0x696a('0x28'),util['inspect'](_0x3a744e,{'showHidden':![],'depth':null}));this[_0x696a('0x1c')](util[_0x696a('0x29')]('trunk:%s',_0x3a744e[_0x696a('0x2a')]),_0x696a('0x2b'),_0x3a744e);}}}catch(_0x10f59f){logger[_0x696a('0x18')](_0x696a('0x22'),util[_0x696a('0x19')](_0x10f59f,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x696a('0x2c')]=function(_0x506740){try{if(this['isNotNull'](_0x506740)){logger[_0x696a('0x1e')](_0x696a('0x2d'),_0x506740['device'],_0x506740['state']);logger['debug'](_0x696a('0x2e'),util[_0x696a('0x19')](_0x506740,{'showHidden':![],'depth':null}));if(this[_0x696a('0x2f')][_0x506740[_0x696a('0x30')]]){if(!this[_0x696a('0x2f')][_0x506740['device']][_0x696a('0x31')]||_0x506740[_0x696a('0x20')][_0x696a('0x32')]()==_0x696a('0x33')){this[_0x696a('0x2f')][_0x506740['device']][_0x696a('0x31')]=![];if(this['agents'][_0x506740['device']]['state']!==_0x506740[_0x696a('0x20')][_0x696a('0x32')]()){this[_0x696a('0x2f')][_0x506740[_0x696a('0x30')]]['stateTime']=_[_0x696a('0x34')](moment()[_0x696a('0x29')]('x'));}this[_0x696a('0x2f')][_0x506740[_0x696a('0x30')]][_0x696a('0x20')]=_0x506740['state']['toLowerCase']();this[_0x696a('0x2f')][_0x506740[_0x696a('0x30')]][_0x696a('0x35')](_0x506740);}}else if(this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]]){if(this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]][_0x696a('0x20')]!==_0x506740[_0x696a('0x20')][_0x696a('0x32')]()){this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]][_0x696a('0x36')]=_[_0x696a('0x34')](moment()[_0x696a('0x29')]('x'));}this[_0x696a('0xc')][_0x506740['device']][_0x696a('0x20')]=_0x506740['state']['toLowerCase']();logger[_0x696a('0x21')](_0x696a('0x37'),util[_0x696a('0x19')](this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]],{'showHidden':![],'depth':null}));this[_0x696a('0x1c')](util['format'](_0x696a('0x38'),this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]][_0x696a('0x2a')]),'telephone:save',this[_0x696a('0xc')][_0x506740[_0x696a('0x30')]]);}else if(this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]]){if(this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]][_0x696a('0x20')]!==_0x506740['state'][_0x696a('0x32')]()){this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]][_0x696a('0x36')]=_['toNumber'](moment()[_0x696a('0x29')]('x'));}this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]][_0x696a('0x20')]=_0x506740[_0x696a('0x20')][_0x696a('0x32')]();logger[_0x696a('0x21')](_0x696a('0x39'),util[_0x696a('0x19')](this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]],{'showHidden':![],'depth':null}));this[_0x696a('0x1c')](util['format'](_0x696a('0x3a'),this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]][_0x696a('0x2a')]),_0x696a('0x2b'),this[_0x696a('0xb')][_0x506740[_0x696a('0x30')]]);}else if(_[_0x696a('0x3b')](_0x506740[_0x696a('0x30')],_0x696a('0x3c'))){var _0xc678dd=_0x506740['device'];var _0x226b80=_0xc678dd[_0x696a('0x3d')](_0xc678dd[_0x696a('0x3e')]('/')+0x1,_0xc678dd[_0x696a('0x3e')]('@'));var _0x131a3d=_[_0x696a('0x23')](this[_0x696a('0x2f')],function(_0x2f545c){return _0x2f545c[_0x696a('0x3f')]==_0x226b80||_0x2f545c[_0x696a('0x40')]==_0x226b80||_0x2f545c['accountcode']==_0x226b80;});if(_0x131a3d){if(_0x131a3d[_0x696a('0x20')]!==_0x506740[_0x696a('0x20')][_0x696a('0x32')]()){_0x131a3d[_0x696a('0x36')]=_[_0x696a('0x34')](moment()[_0x696a('0x29')]('x'));}_0x131a3d[_0x696a('0x20')]=_0x506740[_0x696a('0x20')][_0x696a('0x32')]();_0x131a3d[_0x696a('0x31')]=!![];_0x131a3d[_0x696a('0x35')](_0x506740);}}}}catch(_0xf58851){logger[_0x696a('0x18')](_0x696a('0x2e'),util[_0x696a('0x19')](_0xf58851,{'showHidden':![],'depth':null}));}};UserReport[_0x696a('0x1a')]['syncPeerStatus']=function(_0x53a650){try{if(this['isNotNull'](_0x53a650)&&this[_0x696a('0x1d')](_0x53a650[_0x696a('0x41')])){logger[_0x696a('0x1e')](_0x696a('0x42'),_0x53a650[_0x696a('0x43')],_0x53a650[_0x696a('0x44')],_0x53a650['peerstatus']);logger['debug'](_0x696a('0x45'),util['inspect'](_0x53a650,{'showHidden':![],'depth':null}));if(this['agents'][_0x53a650[_0x696a('0x43')]]){if(!this[_0x696a('0x2f')][_0x53a650[_0x696a('0x43')]][_0x696a('0x31')]||_0x53a650['peerstatus']['toLowerCase']()==_0x696a('0x46')){this['agents'][_0x53a650[_0x696a('0x43')]]['local']=![];this[_0x696a('0x2f')][_0x53a650[_0x696a('0x43')]][_0x696a('0x47')]=_0x53a650[_0x696a('0x41')][_0x696a('0x32')]();this[_0x696a('0x2f')][_0x53a650['peer']][_0x696a('0x44')]=_0x53a650[_0x696a('0x44')];this[_0x696a('0x2f')][_0x53a650[_0x696a('0x43')]][_0x696a('0x35')](_0x53a650);}}else if(this['telephones'][_0x53a650[_0x696a('0x43')]]){this[_0x696a('0xc')][_0x53a650[_0x696a('0x43')]][_0x696a('0x47')]=_0x53a650[_0x696a('0x41')]['toLowerCase']();this[_0x696a('0xc')][_0x53a650[_0x696a('0x43')]][_0x696a('0x44')]=_0x53a650['address'];logger[_0x696a('0x21')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x696a('0x19')](this[_0x696a('0xc')][_0x53a650[_0x696a('0x43')]],{'showHidden':![],'depth':null}));this[_0x696a('0x1c')](util[_0x696a('0x29')](_0x696a('0x38'),this[_0x696a('0xc')][_0x53a650[_0x696a('0x43')]]['name']),'telephone:save',this['telephones'][_0x53a650[_0x696a('0x43')]]);}else if(this['trunks'][_0x53a650[_0x696a('0x43')]]){this[_0x696a('0xb')][_0x53a650['peer']][_0x696a('0x47')]=_0x53a650['peerstatus'][_0x696a('0x32')]();this[_0x696a('0xb')][_0x53a650[_0x696a('0x43')]][_0x696a('0x44')]=_0x53a650[_0x696a('0x44')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x696a('0x19')](this[_0x696a('0xb')][_0x53a650[_0x696a('0x43')]],{'showHidden':![],'depth':null}));this[_0x696a('0x1c')](util['format'](_0x696a('0x3a'),this[_0x696a('0xb')][_0x53a650[_0x696a('0x43')]][_0x696a('0x2a')]),_0x696a('0x2b'),this[_0x696a('0xb')][_0x53a650['peer']]);}}}catch(_0x31bea5){logger[_0x696a('0x18')]('[userReport][peerstatus]',util[_0x696a('0x19')](_0x31bea5,{'showHidden':![],'depth':null}));}};module[_0x696a('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 51a2da1..c05a751 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93bb=['defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','voice','omit','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','lastevent','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','channel','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x93bb,0x135));var _0xb93b=function(_0xbbf6f1,_0x323df9){_0xbbf6f1=_0xbbf6f1-0x0;var _0x21e8cd=_0x93bb[_0xbbf6f1];return _0x21e8cd;};'use strict';var _=require(_0xb93b('0x0'));var moment=require(_0xb93b('0x1'));var util=require(_0xb93b('0x2'));var Redis=require(_0xb93b('0x3'));var config=require(_0xb93b('0x4'));var logger=require(_0xb93b('0x5'))(_0xb93b('0x6'));var ami=require(_0xb93b('0x7'));config[_0xb93b('0x8')]=_[_0xb93b('0x9')](config['redis'],{'host':_0xb93b('0xa'),'port':0x18eb});var io=require(_0xb93b('0xb'))(new Redis(config['redis']));function VoiceAgentReport(_0x3c4dcf){this[_0xb93b('0xc')]={};this['voiceChannels']=_0x3c4dcf[_0xb93b('0xc')];this[_0xb93b('0xd')]=_0x3c4dcf[_0xb93b('0xd')];this[_0xb93b('0xe')]=_0x3c4dcf[_0xb93b('0xe')];this[_0xb93b('0xf')]={};ami['on'](_0xb93b('0x10'),this[_0xb93b('0x11')][_0xb93b('0x12')](this));ami['on'](_0xb93b('0x13'),this[_0xb93b('0x14')]['bind'](this));ami['on'](_0xb93b('0x15'),this[_0xb93b('0x16')][_0xb93b('0x12')](this));ami['on'](_0xb93b('0x17'),this['syncQueueCallerAbandon'][_0xb93b('0x12')](this));ami['on'](_0xb93b('0x18'),this[_0xb93b('0x19')][_0xb93b('0x12')](this));ami['on'](_0xb93b('0x1a'),this[_0xb93b('0x1b')][_0xb93b('0x12')](this));ami['on']('hangup',this[_0xb93b('0x1c')][_0xb93b('0x12')](this));ami['on'](_0xb93b('0x1d'),this[_0xb93b('0x1e')][_0xb93b('0x12')](this));ami['on'](_0xb93b('0x1f'),this['syncMusicOnHoldStop'][_0xb93b('0x12')](this));ami['on']('attendedtransfer',this[_0xb93b('0x20')][_0xb93b('0x12')](this));ami['on'](_0xb93b('0x21'),this[_0xb93b('0x22')][_0xb93b('0x12')](this));}VoiceAgentReport[_0xb93b('0x23')]['emit']=function(_0x302b5e,_0x435e7b,_0x3567cf){io['to'](_0x302b5e)[_0xb93b('0x24')](_0x435e7b,_0x3567cf);};VoiceAgentReport[_0xb93b('0x23')][_0xb93b('0x25')]=function(_0x58fd35){return _0x58fd35!==null&&!_['isUndefined'](_0x58fd35);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x1add64){try{if(this['isNotNull'](_0x1add64)){logger['info'](_0xb93b('0x26'),_0x1add64[_0xb93b('0x27')],_0x1add64[_0xb93b('0x28')],_0x1add64['destuniqueid']);logger[_0xb93b('0x29')](_0xb93b('0x2a'),_0x1add64['uniqueid'],util[_0xb93b('0x2b')](_0x1add64,{'showHidden':![],'depth':null}));if(_[_0xb93b('0x2c')](this[_0xb93b('0xc')][_0x1add64[_0xb93b('0x27')]])){this[_0xb93b('0xc')][_0x1add64[_0xb93b('0x27')]]={};}if(_['isUndefined'](this[_0xb93b('0xc')][_0x1add64[_0xb93b('0x27')]][_0x1add64[_0xb93b('0x2d')]])){this[_0xb93b('0xc')][_0x1add64['uniqueid']][_0x1add64[_0xb93b('0x2d')]]={'agentcalledAt':moment()[_0xb93b('0x2e')](_0xb93b('0x2f')),'lastevent':_0xb93b('0x30'),'mandatoryDisposition':this[_0xb93b('0xd')][_0x1add64[_0xb93b('0x31')]]?this[_0xb93b('0xd')][_0x1add64['queue']][_0xb93b('0x32')]||![]:![],'type':this['voiceQueues'][_0x1add64[_0xb93b('0x31')]]?this[_0xb93b('0xd')][_0x1add64[_0xb93b('0x31')]][_0xb93b('0x33')]||_0xb93b('0x34'):_0xb93b('0x34'),'variables':this[_0xb93b('0xf')][_0x1add64[_0xb93b('0x27')]],'motionChannel':_0xb93b('0x35')};}_['merge'](this['channels'][_0x1add64[_0xb93b('0x27')]][_0x1add64[_0xb93b('0x2d')]],_[_0xb93b('0x36')](_0x1add64,['event','privilege']));logger[_0xb93b('0x29')](_0xb93b('0x37'),_0x1add64[_0xb93b('0x27')],util['inspect'](this['channels'][_0x1add64[_0xb93b('0x27')]][_0x1add64[_0xb93b('0x2d')]],{'showHidden':![],'depth':null}));ami[_0xb93b('0x24')](_0xb93b('0x38'),this[_0xb93b('0xc')][_0x1add64[_0xb93b('0x27')]][_0x1add64[_0xb93b('0x2d')]]);logger['debug'](_0xb93b('0x39'),_0x1add64[_0xb93b('0x27')],util[_0xb93b('0x2b')](this[_0xb93b('0xc')][_0x1add64[_0xb93b('0x27')]][_0x1add64[_0xb93b('0x2d')]],{'showHidden':![],'depth':null}));this[_0xb93b('0x24')](util['format'](_0xb93b('0x3a'),_0x1add64[_0xb93b('0x28')]),_0xb93b('0x3b'),this[_0xb93b('0xc')][_0x1add64[_0xb93b('0x27')]][_0x1add64[_0xb93b('0x2d')]]);}}catch(_0x446e45){logger['error'](_0xb93b('0x3c'),_0x1add64[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x446e45,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb93b('0x23')][_0xb93b('0x14')]=function(_0x265050){try{if(this[_0xb93b('0x25')](_0x265050)){if(this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]]){logger[_0xb93b('0x29')](_0xb93b('0x3d'),_0x265050[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x265050,{'showHidden':![],'depth':null}));for(var _0x2adc47 in this['channels'][_0x265050[_0xb93b('0x27')]]){if(this[_0xb93b('0xc')][_0x265050['uniqueid']][_0xb93b('0x3e')](_0x2adc47)){if(_0x265050[_0xb93b('0x2d')]===_0x2adc47){logger[_0xb93b('0x3f')](_0xb93b('0x40'),_0x265050[_0xb93b('0x27')],_0x265050[_0xb93b('0x28')],_0x265050['destuniqueid']);this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x2adc47][_0xb93b('0x41')]=moment()[_0xb93b('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x265050[_0xb93b('0x27')]][_0x2adc47][_0xb93b('0x42')]=_0x265050[_0xb93b('0x42')];this[_0xb93b('0xc')][_0x265050['uniqueid']][_0x2adc47][_0xb93b('0x43')]=_0x265050['connectedlinenum'];this[_0xb93b('0xc')][_0x265050['uniqueid']][_0x2adc47][_0xb93b('0x44')]=_0x265050[_0xb93b('0x44')];this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x2adc47][_0xb93b('0x45')]=_0x265050[_0xb93b('0x45')];this[_0xb93b('0xc')][_0x265050['uniqueid']][_0x2adc47][_0xb93b('0x46')]=_0x265050['holdtime'];this[_0xb93b('0xc')][_0x265050['uniqueid']][_0x2adc47]['lastevent']=_0xb93b('0x47');if(this[_0xb93b('0x48')][this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x2adc47][_0xb93b('0x27')]]){var _0x4821a9=this['voiceChannels'][this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x2adc47][_0xb93b('0x27')]]['routealias'];this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x2adc47]['routealias']=_0x4821a9;_0x265050[_0xb93b('0x49')]=_0x4821a9;}_[_0xb93b('0x4a')](this[_0xb93b('0xe')][_0x265050[_0xb93b('0x4b')]],_['pick'](_0x265050,[_0xb93b('0x31'),_0xb93b('0x4c'),'routealias']));logger[_0xb93b('0x29')](_0xb93b('0x4d'),_0x265050['uniqueid'],util['inspect'](this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x265050['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xb93b('0x24')](_0xb93b('0x4e'),this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x265050[_0xb93b('0x2d')]]);logger[_0xb93b('0x29')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x265050[_0xb93b('0x27')],util[_0xb93b('0x2b')](this['channels'][_0x265050[_0xb93b('0x27')]][_0x265050['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xb93b('0x24')](util[_0xb93b('0x2e')](_0xb93b('0x3a'),_0x265050[_0xb93b('0x28')]),_0xb93b('0x4f'),this['channels'][_0x265050['uniqueid']][_0x265050[_0xb93b('0x2d')]]);}else if(!this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x2adc47][_0xb93b('0x15')]&&!this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x2adc47][_0xb93b('0x18')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x265050['uniqueid'],this[_0xb93b('0xc')][_0x265050['uniqueid']][_0x2adc47]['membername'],_0x2adc47);this['channels'][_0x265050[_0xb93b('0x27')]][_0x2adc47][_0xb93b('0x15')]=!![];this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x2adc47]['agentringnoanswerAt']=moment()['format'](_0xb93b('0x2f'));this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x2adc47][_0xb93b('0x50')]=_0x265050[_0xb93b('0x2d')];this[_0xb93b('0xc')][_0x265050['uniqueid']][_0x2adc47][_0xb93b('0x51')]=_0x265050[_0xb93b('0x28')];this['channels'][_0x265050['uniqueid']][_0x2adc47]['lastevent']=_0xb93b('0x52');this[_0xb93b('0xc')][_0x265050[_0xb93b('0x27')]][_0x2adc47][_0xb93b('0x53')]=_0xb93b('0x52');logger['debug'](_0xb93b('0x54'),_0x265050[_0xb93b('0x27')],util[_0xb93b('0x2b')](this['channels'][_0x265050[_0xb93b('0x27')]][_0x2adc47],{'showHidden':![],'depth':null}));ami[_0xb93b('0x24')](_0xb93b('0x55'),this['channels'][_0x265050['uniqueid']][_0x2adc47]);}}}}}}catch(_0xb9b106){logger[_0xb93b('0x56')](_0xb93b('0x57'),_0x265050[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0xb9b106,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb93b('0x16')]=function(_0x2072fe){try{if(this[_0xb93b('0x25')](_0x2072fe)){logger[_0xb93b('0x29')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x2072fe[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x2072fe,{'showHidden':![],'depth':null}));if(this['channels'][_0x2072fe['uniqueid']]&&this[_0xb93b('0xc')][_0x2072fe['uniqueid']][_0x2072fe[_0xb93b('0x2d')]]){logger[_0xb93b('0x3f')](_0xb93b('0x58'),_0x2072fe[_0xb93b('0x27')],_0x2072fe['membername'],_0x2072fe[_0xb93b('0x2d')]);this[_0xb93b('0xc')][_0x2072fe[_0xb93b('0x27')]][_0x2072fe[_0xb93b('0x2d')]][_0xb93b('0x15')]=!![];this[_0xb93b('0xc')][_0x2072fe[_0xb93b('0x27')]][_0x2072fe['destuniqueid']][_0xb93b('0x59')]=moment()[_0xb93b('0x2e')](_0xb93b('0x2f'));this[_0xb93b('0xc')][_0x2072fe[_0xb93b('0x27')]][_0x2072fe[_0xb93b('0x2d')]][_0xb93b('0x5a')]=_0xb93b('0x5b');this[_0xb93b('0xc')][_0x2072fe['uniqueid']][_0x2072fe['destuniqueid']]['reason']=_0xb93b('0x5b');logger['debug'](_0xb93b('0x5c'),_0x2072fe['uniqueid'],util[_0xb93b('0x2b')](this[_0xb93b('0xc')][_0x2072fe[_0xb93b('0x27')]][_0x2072fe[_0xb93b('0x2d')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentringnoanswer',this[_0xb93b('0xc')][_0x2072fe[_0xb93b('0x27')]][_0x2072fe[_0xb93b('0x2d')]]);}}}catch(_0x55312f){logger[_0xb93b('0x56')](_0xb93b('0x5d'),_0x2072fe['uniqueid'],util[_0xb93b('0x2b')](_0x55312f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb93b('0x5e')]=function(_0x3a1ed2){try{if(this['isNotNull'](_0x3a1ed2)){logger['debug'](_0xb93b('0x5f'),_0x3a1ed2[_0xb93b('0x27')],util['inspect'](_0x3a1ed2,{'showHidden':![],'depth':null}));if(this[_0xb93b('0xc')][_0x3a1ed2['uniqueid']]){for(var _0x1885a6 in this[_0xb93b('0xc')][_0x3a1ed2['uniqueid']]){if(this[_0xb93b('0xc')][_0x3a1ed2['uniqueid']][_0xb93b('0x3e')](_0x1885a6)&&!this[_0xb93b('0xc')][_0x3a1ed2[_0xb93b('0x27')]][_0x1885a6]['agentringnoanswer']&&!this[_0xb93b('0xc')][_0x3a1ed2[_0xb93b('0x27')]][_0x1885a6]['agentcomplete']){logger[_0xb93b('0x3f')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3a1ed2[_0xb93b('0x27')],this[_0xb93b('0xc')][_0x3a1ed2[_0xb93b('0x27')]][_0x1885a6][_0xb93b('0x28')],_0x1885a6);this[_0xb93b('0xc')][_0x3a1ed2[_0xb93b('0x27')]][_0x1885a6]['agentringnoanswer']=!![];this['channels'][_0x3a1ed2[_0xb93b('0x27')]][_0x1885a6][_0xb93b('0x59')]=moment()[_0xb93b('0x2e')](_0xb93b('0x2f'));this[_0xb93b('0xc')][_0x3a1ed2[_0xb93b('0x27')]][_0x1885a6][_0xb93b('0x5a')]='abandoned';this[_0xb93b('0xc')][_0x3a1ed2[_0xb93b('0x27')]][_0x1885a6]['reason']=_0xb93b('0x60');logger[_0xb93b('0x29')](_0xb93b('0x61'),_0x3a1ed2['uniqueid'],util['inspect'](this['channels'][_0x3a1ed2[_0xb93b('0x27')]][_0x1885a6],{'showHidden':![],'depth':null}));ami[_0xb93b('0x24')]('custom:agentqueuecallerabandon',this['channels'][_0x3a1ed2['uniqueid']][_0x1885a6]);}}}}}catch(_0x209dc5){logger[_0xb93b('0x56')](_0xb93b('0x62'),_0x3a1ed2['uniqueid'],util['inspect'](_0x209dc5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb93b('0x19')]=function(_0x5b0e1a){try{if(this[_0xb93b('0x25')](_0x5b0e1a)){logger[_0xb93b('0x29')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x5b0e1a['uniqueid'],util[_0xb93b('0x2b')](_0x5b0e1a,{'showHidden':![],'depth':null}));if(this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]]){for(var _0x5603b9 in this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]]){if(this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0xb93b('0x3e')](_0x5603b9)){if(this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9][_0xb93b('0x41')]&&!this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9][_0xb93b('0x18')]){logger[_0xb93b('0x3f')](_0xb93b('0x63'),_0x5b0e1a[_0xb93b('0x27')],this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9][_0xb93b('0x28')],_0x5603b9);this[_0xb93b('0xc')][_0x5b0e1a['uniqueid']][_0x5603b9][_0xb93b('0x18')]=!![];this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9][_0xb93b('0x64')]=moment()[_0xb93b('0x2e')](_0xb93b('0x2f'));this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9]['lastevent']=_0xb93b('0x65');this['channels'][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9][_0xb93b('0x53')]=_0x5b0e1a[_0xb93b('0x53')]==_0xb93b('0x66')?_0xb93b('0x67'):_0x5b0e1a[_0xb93b('0x53')];this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9]['talktime']=_0x5b0e1a[_0xb93b('0x68')];if(this[_0xb93b('0xd')][_0x5b0e1a[_0xb93b('0x31')]]&&this['voiceQueues'][_0x5b0e1a[_0xb93b('0x31')]][_0xb93b('0x69')]){this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9][_0xb93b('0x6a')]=this['voiceQueues'][_0x5b0e1a[_0xb93b('0x31')]]['acwTimeout'];this[_0xb93b('0xc')][_0x5b0e1a['uniqueid']][_0x5603b9][_0xb93b('0x6b')]=!![];}this[_0xb93b('0xe')][_0x5b0e1a[_0xb93b('0x4b')]]=_[_0xb93b('0x36')](this[_0xb93b('0xe')][_0x5b0e1a['interface']],[_0xb93b('0x31'),'destconnectedlinenum']);logger['debug'](_0xb93b('0x6c'),_0x5b0e1a['uniqueid'],util[_0xb93b('0x2b')](this['channels'][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9],{'showHidden':![],'depth':null}));ami[_0xb93b('0x24')](_0xb93b('0x6d'),this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9]);logger['debug'](_0xb93b('0x6e'),_0x5b0e1a[_0xb93b('0x27')],util[_0xb93b('0x2b')](this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9],{'showHidden':![],'depth':null}));this[_0xb93b('0x24')](util[_0xb93b('0x2e')](_0xb93b('0x3a'),_0x5b0e1a[_0xb93b('0x28')]),_0xb93b('0x6f'),this[_0xb93b('0xc')][_0x5b0e1a[_0xb93b('0x27')]][_0x5603b9]);}}}}}}catch(_0x5e4234){logger[_0xb93b('0x56')](_0xb93b('0x70'),_0x5b0e1a[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x5e4234,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb93b('0x23')][_0xb93b('0x1b')]=function(_0xeb03cd){try{if(this[_0xb93b('0x25')](_0xeb03cd)){logger[_0xb93b('0x29')](_0xb93b('0x71'),_0xeb03cd[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0xeb03cd,{'showHidden':![],'depth':null}));this['addVariable'](_0xeb03cd['uniqueid'],_[_0xb93b('0x72')](_0xeb03cd[_0xb93b('0x73')])[0x0],_0xeb03cd[_0xb93b('0x74')]);if(this[_0xb93b('0xc')][_0xeb03cd[_0xb93b('0x27')]]){for(var _0x19ffa8 in this['channels'][_0xeb03cd[_0xb93b('0x27')]]){if(this['channels'][_0xeb03cd[_0xb93b('0x27')]][_0xb93b('0x3e')](_0x19ffa8)){logger['info'](_0xb93b('0x75'),_0xeb03cd[_0xb93b('0x27')],_0x19ffa8,_[_0xb93b('0x72')](_0xeb03cd['variable'])[0x0],_0xeb03cd[_0xb93b('0x74')]);if(_[_0xb93b('0x2c')](this[_0xb93b('0xc')][_0xeb03cd[_0xb93b('0x27')]][_0x19ffa8][_0xb93b('0xf')])){this[_0xb93b('0xc')][_0xeb03cd['uniqueid']][_0x19ffa8][_0xb93b('0xf')]={};}this[_0xb93b('0xc')][_0xeb03cd[_0xb93b('0x27')]][_0x19ffa8][_0xb93b('0xf')]=this[_0xb93b('0xf')][_0xeb03cd[_0xb93b('0x27')]];}}}}}catch(_0x387f1b){logger[_0xb93b('0x56')](_0xb93b('0x76'),_0xeb03cd[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x387f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb93b('0x23')][_0xb93b('0x77')]=function(_0x10da09,_0x31abcb,_0x4c8158){var _0x3242ae=['rtpaudioqos',_0xb93b('0x78'),_0xb93b('0x79'),_0xb93b('0x7a'),_0xb93b('0x7b'),_0xb93b('0x7c'),_0xb93b('0x7d'),_0xb93b('0x7e'),'sipcallid',_0xb93b('0x7f'),_0xb93b('0x80'),_0xb93b('0x81'),_0xb93b('0x82'),_0xb93b('0x83'),_0xb93b('0x84'),_0xb93b('0x85'),_0xb93b('0x28'),_0xb93b('0x86'),_0xb93b('0x87')];if(!_['isNil'](_0x31abcb)&&!_[_0xb93b('0x88')](_0x3242ae,_0x31abcb)){if(_[_0xb93b('0x2c')](this[_0xb93b('0xf')][_0x10da09])){this[_0xb93b('0xf')][_0x10da09]={};}this['variables'][_0x10da09][_0x31abcb]=_0x4c8158;}};VoiceAgentReport[_0xb93b('0x23')][_0xb93b('0x1c')]=function(_0x547b1b){try{if(this[_0xb93b('0x25')](_0x547b1b)){logger[_0xb93b('0x29')]('[%s][voiceAgentReport][hangup]\x20event:',_0x547b1b[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x547b1b,{'showHidden':![],'depth':null}));if(this[_0xb93b('0xc')][_0x547b1b[_0xb93b('0x27')]]){for(var _0xcddcf8 in this[_0xb93b('0xc')][_0x547b1b[_0xb93b('0x27')]]){if(this[_0xb93b('0xc')][_0x547b1b[_0xb93b('0x27')]][_0xb93b('0x3e')](_0xcddcf8)){if(this[_0xb93b('0xc')][_0x547b1b[_0xb93b('0x27')]][_0xcddcf8][_0xb93b('0x53')]==_0xb93b('0x66')&&this['channels'][_0x547b1b[_0xb93b('0x27')]][_0xcddcf8][_0xb93b('0x18')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x547b1b['uniqueid'],_0xcddcf8);this[_0xb93b('0xc')][_0x547b1b['uniqueid']][_0xcddcf8][_0xb93b('0x64')]=moment()['format'](_0xb93b('0x2f'));}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x547b1b['uniqueid'],util[_0xb93b('0x2b')](_['values'](this[_0xb93b('0xc')][_0x547b1b['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xb93b('0x24')](_0xb93b('0x89'),_['values'](this[_0xb93b('0xc')][_0x547b1b[_0xb93b('0x27')]]));delete this[_0xb93b('0xc')][_0x547b1b['uniqueid']];}if(this[_0xb93b('0xf')][_0x547b1b[_0xb93b('0x27')]]){delete this[_0xb93b('0xf')][_0x547b1b[_0xb93b('0x27')]];}}}catch(_0x31e1f2){logger[_0xb93b('0x56')](_0xb93b('0x8a'),_0x547b1b['uniqueid'],util[_0xb93b('0x2b')](_0x31e1f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb93b('0x23')][_0xb93b('0x20')]=function(_0x8f418a){try{if(this[_0xb93b('0x25')](_0x8f418a)){logger[_0xb93b('0x29')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x8f418a[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x8f418a,{'showHidden':![],'depth':null}));if(this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8b')]]){for(var _0x356180 in this['channels'][_0x8f418a[_0xb93b('0x8b')]]){if(this['channels'][_0x8f418a[_0xb93b('0x8b')]][_0xb93b('0x3e')](_0x356180)){if(_0x8f418a[_0xb93b('0x8c')]===_0x356180){logger[_0xb93b('0x3f')](_0xb93b('0x8d'),_0x8f418a[_0xb93b('0x27')],this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8b')]][_0x356180][_0xb93b('0x28')],_0x356180);var _0x372801=moment();this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8b')]][_0x356180][_0xb93b('0x18')]=!![];this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8b')]][_0x356180][_0xb93b('0x64')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8b')]][_0x356180][_0xb93b('0x5a')]=_0xb93b('0x65');this[_0xb93b('0xc')][_0x8f418a['transfereeuniqueid']][_0x356180]['reason']=_0xb93b('0x66');this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8b')]][_0x356180][_0xb93b('0x68')]=_0x372801['diff'](this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8b')]][_0x356180][_0xb93b('0x41')],'seconds');}}}}if(this['channels'][_0x8f418a[_0xb93b('0x8e')]]){var _0xe15a17=this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8e')]];this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8e')]]=this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8b')]];this[_0xb93b('0xc')][_0x8f418a[_0xb93b('0x8b')]]=_0xe15a17;}}}catch(_0x3e9d80){logger[_0xb93b('0x56')](_0xb93b('0x8f'),_0x8f418a[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x3e9d80,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb93b('0x23')][_0xb93b('0x22')]=function(_0x56ec22){try{if(this['isNotNull'](_0x56ec22)){logger[_0xb93b('0x29')](_0xb93b('0x90'),_0x56ec22[_0xb93b('0x27')],util['inspect'](_0x56ec22,{'showHidden':![],'depth':null}));if(this[_0xb93b('0xc')][_0x56ec22[_0xb93b('0x8b')]]){for(var _0x33498b in this[_0xb93b('0xc')][_0x56ec22[_0xb93b('0x8b')]]){if(this[_0xb93b('0xc')][_0x56ec22[_0xb93b('0x8b')]]['hasOwnProperty'](_0x33498b)){if(_0x56ec22[_0xb93b('0x91')]===_0x33498b){logger[_0xb93b('0x3f')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x56ec22['uniqueid'],this[_0xb93b('0xc')][_0x56ec22[_0xb93b('0x8b')]][_0x33498b]['membername'],_0x33498b);var _0x49ef33=moment();this[_0xb93b('0xc')][_0x56ec22[_0xb93b('0x8b')]][_0x33498b][_0xb93b('0x18')]=!![];this[_0xb93b('0xc')][_0x56ec22['transfereeuniqueid']][_0x33498b][_0xb93b('0x64')]=_0x49ef33;this[_0xb93b('0xc')][_0x56ec22[_0xb93b('0x8b')]][_0x33498b]['lastevent']=_0xb93b('0x65');this['channels'][_0x56ec22[_0xb93b('0x8b')]][_0x33498b][_0xb93b('0x53')]=_0xb93b('0x66');this[_0xb93b('0xc')][_0x56ec22[_0xb93b('0x8b')]][_0x33498b][_0xb93b('0x68')]=_0x49ef33[_0xb93b('0x92')](this[_0xb93b('0xc')][_0x56ec22[_0xb93b('0x8b')]][_0x33498b][_0xb93b('0x41')],'seconds');}}}}}}catch(_0x139018){logger[_0xb93b('0x56')](_0xb93b('0x93'),_0x56ec22[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x139018,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb93b('0x23')]['syncMusicOnHoldStart']=function(_0x315681){var _0x5d694c='';try{if(this[_0xb93b('0x25')](_0x315681)){logger['debug'](_0xb93b('0x94'),_0x315681[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x315681,{'showHidden':![],'depth':null}));if(_0x315681['channel']){_0x5d694c=_0x315681['channel'][_0xb93b('0x95')](0x0,_0x315681['channel'][_0xb93b('0x96')]('-'));if(this[_0xb93b('0xe')][_0x5d694c]){logger[_0xb93b('0x3f')](_0xb93b('0x97'),_0x315681[_0xb93b('0x27')],_0x5d694c);this[_0xb93b('0xe')][_0x5d694c][_0xb93b('0x98')]=!![];}}}}catch(_0x3c2dfe){logger[_0xb93b('0x56')](_0xb93b('0x99'),_0x315681[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x3c2dfe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb93b('0x23')][_0xb93b('0x9a')]=function(_0x45b769){var _0x595662='';try{if(this[_0xb93b('0x25')](_0x45b769)){logger[_0xb93b('0x29')](_0xb93b('0x9b'),_0x45b769['uniqueid'],util['inspect'](_0x45b769,{'showHidden':![],'depth':null}));if(_0x45b769[_0xb93b('0x9c')]){_0x595662=_0x45b769[_0xb93b('0x9c')][_0xb93b('0x95')](0x0,_0x45b769[_0xb93b('0x9c')][_0xb93b('0x96')]('-'));if(this['agents'][_0x595662]){logger[_0xb93b('0x3f')](_0xb93b('0x9d'),_0x45b769['uniqueid'],_0x595662);this['agents'][_0x595662][_0xb93b('0x98')]=![];}}}}catch(_0x1c0c0e){logger[_0xb93b('0x56')](_0xb93b('0x9e'),_0x45b769[_0xb93b('0x27')],util[_0xb93b('0x2b')](_0x1c0c0e,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x5f71=['[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','format','YYYY-MM-DD\x20HH:mm:ss','queue','type','inbound','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentcomplete','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','lastevent','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acw','acwTimeout','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet'];(function(_0x4da17e,_0x24787b){var _0x478b46=function(_0x33e5eb){while(--_0x33e5eb){_0x4da17e['push'](_0x4da17e['shift']());}};_0x478b46(++_0x24787b);}(_0x5f71,0xc9));var _0x15f7=function(_0x20a9df,_0x176db6){_0x20a9df=_0x20a9df-0x0;var _0x55b96c=_0x5f71[_0x20a9df];return _0x55b96c;};'use strict';var _=require(_0x15f7('0x0'));var moment=require('moment');var util=require(_0x15f7('0x1'));var Redis=require('ioredis');var config=require(_0x15f7('0x2'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0x15f7('0x3')]=_[_0x15f7('0x4')](config['redis'],{'host':_0x15f7('0x5'),'port':0x18eb});var io=require(_0x15f7('0x6'))(new Redis(config[_0x15f7('0x3')]));function VoiceAgentReport(_0x1de7b3){this[_0x15f7('0x7')]={};this[_0x15f7('0x8')]=_0x1de7b3[_0x15f7('0x7')];this[_0x15f7('0x9')]=_0x1de7b3[_0x15f7('0x9')];this[_0x15f7('0xa')]=_0x1de7b3[_0x15f7('0xa')];this[_0x15f7('0xb')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x15f7('0xc')](this));ami['on'](_0x15f7('0xd'),this['syncAgentConnect'][_0x15f7('0xc')](this));ami['on'](_0x15f7('0xe'),this[_0x15f7('0xf')][_0x15f7('0xc')](this));ami['on'](_0x15f7('0x10'),this[_0x15f7('0x11')][_0x15f7('0xc')](this));ami['on']('agentcomplete',this[_0x15f7('0x12')][_0x15f7('0xc')](this));ami['on'](_0x15f7('0x13'),this['syncVarSet'][_0x15f7('0xc')](this));ami['on'](_0x15f7('0x14'),this['syncHangup'][_0x15f7('0xc')](this));ami['on'](_0x15f7('0x15'),this[_0x15f7('0x16')][_0x15f7('0xc')](this));ami['on'](_0x15f7('0x17'),this[_0x15f7('0x18')][_0x15f7('0xc')](this));ami['on']('attendedtransfer',this[_0x15f7('0x19')][_0x15f7('0xc')](this));ami['on']('blindtransfer',this[_0x15f7('0x1a')][_0x15f7('0xc')](this));}VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x1c')]=function(_0x26627b,_0x2bb463,_0x3ced97){io['to'](_0x26627b)['emit'](_0x2bb463,_0x3ced97);};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x1d')]=function(_0x1362e1){return _0x1362e1!==null&&!_[_0x15f7('0x1e')](_0x1362e1);};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x1f')]=function(_0x3bf068){try{if(this['isNotNull'](_0x3bf068)){logger['info'](_0x15f7('0x20'),_0x3bf068[_0x15f7('0x21')],_0x3bf068[_0x15f7('0x22')],_0x3bf068[_0x15f7('0x23')]);logger[_0x15f7('0x24')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x3bf068[_0x15f7('0x21')],util['inspect'](_0x3bf068,{'showHidden':![],'depth':null}));if(_[_0x15f7('0x1e')](this[_0x15f7('0x7')][_0x3bf068['uniqueid']])){this['channels'][_0x3bf068[_0x15f7('0x21')]]={};}if(_['isUndefined'](this['channels'][_0x3bf068[_0x15f7('0x21')]][_0x3bf068['destuniqueid']])){this[_0x15f7('0x7')][_0x3bf068[_0x15f7('0x21')]][_0x3bf068[_0x15f7('0x23')]]={'agentcalledAt':moment()[_0x15f7('0x25')](_0x15f7('0x26')),'lastevent':'called','mandatoryDisposition':this[_0x15f7('0x9')][_0x3bf068[_0x15f7('0x27')]]?this[_0x15f7('0x9')][_0x3bf068['queue']]['mandatoryDisposition']||![]:![],'type':this['voiceQueues'][_0x3bf068['queue']]?this[_0x15f7('0x9')][_0x3bf068[_0x15f7('0x27')]][_0x15f7('0x28')]||_0x15f7('0x29'):_0x15f7('0x29'),'variables':this[_0x15f7('0xb')][_0x3bf068['uniqueid']],'motionChannel':'voice'};}_[_0x15f7('0x2a')](this[_0x15f7('0x7')][_0x3bf068[_0x15f7('0x21')]][_0x3bf068['destuniqueid']],_[_0x15f7('0x2b')](_0x3bf068,['event',_0x15f7('0x2c')]));logger['debug'](_0x15f7('0x2d'),_0x3bf068[_0x15f7('0x21')],util[_0x15f7('0x2e')](this[_0x15f7('0x7')][_0x3bf068['uniqueid']][_0x3bf068['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x15f7('0x1c')](_0x15f7('0x2f'),this[_0x15f7('0x7')][_0x3bf068[_0x15f7('0x21')]][_0x3bf068[_0x15f7('0x23')]]);logger[_0x15f7('0x24')](_0x15f7('0x30'),_0x3bf068[_0x15f7('0x21')],util[_0x15f7('0x2e')](this[_0x15f7('0x7')][_0x3bf068[_0x15f7('0x21')]][_0x3bf068['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x15f7('0x1c')](util['format'](_0x15f7('0x31'),_0x3bf068[_0x15f7('0x22')]),_0x15f7('0x32'),this[_0x15f7('0x7')][_0x3bf068[_0x15f7('0x21')]][_0x3bf068[_0x15f7('0x23')]]);}}catch(_0x5c7cb9){logger[_0x15f7('0x33')]('[%s][voiceAgentReport][agentcalled]',_0x3bf068[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x5c7cb9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x34')]=function(_0x437f11){try{if(this['isNotNull'](_0x437f11)){if(this[_0x15f7('0x7')][_0x437f11['uniqueid']]){logger['debug'](_0x15f7('0x35'),_0x437f11['uniqueid'],util[_0x15f7('0x2e')](_0x437f11,{'showHidden':![],'depth':null}));for(var _0x3a1b7a in this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]]){if(this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x15f7('0x36')](_0x3a1b7a)){if(_0x437f11['destuniqueid']===_0x3a1b7a){logger[_0x15f7('0x37')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x437f11[_0x15f7('0x21')],_0x437f11[_0x15f7('0x22')],_0x437f11['destuniqueid']);this['channels'][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x38')]=moment()[_0x15f7('0x25')](_0x15f7('0x26'));this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x39')]=_0x437f11[_0x15f7('0x39')];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x3a')]=_0x437f11[_0x15f7('0x3a')];this['channels'][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x3b')]=_0x437f11['destchannelstate'];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['destchannelstatedesc']=_0x437f11[_0x15f7('0x3c')];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['holdtime']=_0x437f11[_0x15f7('0x3d')];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['lastevent']=_0x15f7('0x3e');if(this['voiceChannels'][this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x21')]]){var _0x3a3feb=this[_0x15f7('0x8')][this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x21')]][_0x15f7('0x3f')];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x3f')]=_0x3a3feb;_0x437f11['routealias']=_0x3a3feb;}_[_0x15f7('0x2a')](this['agents'][_0x437f11[_0x15f7('0x40')]],_[_0x15f7('0x41')](_0x437f11,['queue','destconnectedlinenum',_0x15f7('0x3f')]));logger[_0x15f7('0x24')](_0x15f7('0x42'),_0x437f11['uniqueid'],util[_0x15f7('0x2e')](this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x437f11[_0x15f7('0x23')]],{'showHidden':![],'depth':null}));ami[_0x15f7('0x1c')](_0x15f7('0x43'),this['channels'][_0x437f11['uniqueid']][_0x437f11[_0x15f7('0x23')]]);logger['debug'](_0x15f7('0x44'),_0x437f11[_0x15f7('0x21')],util['inspect'](this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x437f11[_0x15f7('0x23')]],{'showHidden':![],'depth':null}));this[_0x15f7('0x1c')](util[_0x15f7('0x25')](_0x15f7('0x31'),_0x437f11[_0x15f7('0x22')]),'user:agentconnect',this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x437f11[_0x15f7('0x23')]]);}else if(!this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0xe')]&&!this[_0x15f7('0x7')][_0x437f11['uniqueid']][_0x3a1b7a][_0x15f7('0x45')]){logger[_0x15f7('0x37')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x437f11[_0x15f7('0x21')],this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['membername'],_0x3a1b7a);this[_0x15f7('0x7')][_0x437f11['uniqueid']][_0x3a1b7a][_0x15f7('0xe')]=!![];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['agentringnoanswerAt']=moment()[_0x15f7('0x25')](_0x15f7('0x26'));this[_0x15f7('0x7')][_0x437f11['uniqueid']][_0x3a1b7a][_0x15f7('0x46')]=_0x437f11[_0x15f7('0x23')];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x47')]=_0x437f11['membername'];this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]['lastevent']='answered_elsewhere';this['channels'][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a][_0x15f7('0x48')]=_0x15f7('0x49');logger['debug'](_0x15f7('0x4a'),_0x437f11[_0x15f7('0x21')],util['inspect'](this[_0x15f7('0x7')][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a],{'showHidden':![],'depth':null}));ami[_0x15f7('0x1c')](_0x15f7('0x4b'),this['channels'][_0x437f11[_0x15f7('0x21')]][_0x3a1b7a]);}}}}}}catch(_0x363f8c){logger[_0x15f7('0x33')](_0x15f7('0x4c'),_0x437f11['uniqueid'],util[_0x15f7('0x2e')](_0x363f8c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0xf')]=function(_0x21d62d){try{if(this['isNotNull'](_0x21d62d)){logger['debug'](_0x15f7('0x4d'),_0x21d62d[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x21d62d,{'showHidden':![],'depth':null}));if(this['channels'][_0x21d62d['uniqueid']]&&this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d[_0x15f7('0x23')]]){logger[_0x15f7('0x37')](_0x15f7('0x4e'),_0x21d62d[_0x15f7('0x21')],_0x21d62d[_0x15f7('0x22')],_0x21d62d[_0x15f7('0x23')]);this[_0x15f7('0x7')][_0x21d62d['uniqueid']][_0x21d62d['destuniqueid']]['agentringnoanswer']=!![];this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d[_0x15f7('0x23')]][_0x15f7('0x4f')]=moment()[_0x15f7('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d[_0x15f7('0x23')]][_0x15f7('0x50')]=_0x15f7('0x51');this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d['destuniqueid']][_0x15f7('0x48')]='rejected';logger[_0x15f7('0x24')](_0x15f7('0x52'),_0x21d62d[_0x15f7('0x21')],util[_0x15f7('0x2e')](this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d[_0x15f7('0x23')]],{'showHidden':![],'depth':null}));ami[_0x15f7('0x1c')]('custom:agentringnoanswer',this[_0x15f7('0x7')][_0x21d62d[_0x15f7('0x21')]][_0x21d62d['destuniqueid']]);}}}catch(_0x1627d5){logger['error'](_0x15f7('0x53'),_0x21d62d[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x1627d5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')]['syncQueueCallerAbandon']=function(_0x55c79a){try{if(this['isNotNull'](_0x55c79a)){logger[_0x15f7('0x24')](_0x15f7('0x54'),_0x55c79a[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x55c79a,{'showHidden':![],'depth':null}));if(this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]]){for(var _0x57383f in this['channels'][_0x55c79a['uniqueid']]){if(this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]]['hasOwnProperty'](_0x57383f)&&!this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0xe')]&&!this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0x45')]){logger['info'](_0x15f7('0x55'),_0x55c79a[_0x15f7('0x21')],this['channels'][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0x22')],_0x57383f);this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f]['agentringnoanswer']=!![];this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0x4f')]=moment()[_0x15f7('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0x50')]=_0x15f7('0x56');this[_0x15f7('0x7')][_0x55c79a[_0x15f7('0x21')]][_0x57383f][_0x15f7('0x48')]='abandoned';logger[_0x15f7('0x24')](_0x15f7('0x57'),_0x55c79a[_0x15f7('0x21')],util['inspect'](this[_0x15f7('0x7')][_0x55c79a['uniqueid']][_0x57383f],{'showHidden':![],'depth':null}));ami['emit'](_0x15f7('0x58'),this[_0x15f7('0x7')][_0x55c79a['uniqueid']][_0x57383f]);}}}}}catch(_0x493d88){logger['error'](_0x15f7('0x59'),_0x55c79a[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x493d88,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x12')]=function(_0x4e2c26){try{if(this[_0x15f7('0x1d')](_0x4e2c26)){logger['debug'](_0x15f7('0x5a'),_0x4e2c26[_0x15f7('0x21')],util['inspect'](_0x4e2c26,{'showHidden':![],'depth':null}));if(this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]]){for(var _0x8c0a2a in this['channels'][_0x4e2c26[_0x15f7('0x21')]]){if(this[_0x15f7('0x7')][_0x4e2c26['uniqueid']]['hasOwnProperty'](_0x8c0a2a)){if(this[_0x15f7('0x7')][_0x4e2c26['uniqueid']][_0x8c0a2a][_0x15f7('0x38')]&&!this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a][_0x15f7('0x45')]){logger[_0x15f7('0x37')](_0x15f7('0x5b'),_0x4e2c26[_0x15f7('0x21')],this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a][_0x15f7('0x22')],_0x8c0a2a);this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a][_0x15f7('0x45')]=!![];this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a][_0x15f7('0x5c')]=moment()[_0x15f7('0x25')](_0x15f7('0x26'));this['channels'][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a]['lastevent']='complete';this[_0x15f7('0x7')][_0x4e2c26['uniqueid']][_0x8c0a2a][_0x15f7('0x48')]=_0x4e2c26['reason']==_0x15f7('0x5d')?_0x15f7('0x5e'):_0x4e2c26[_0x15f7('0x48')];this[_0x15f7('0x7')][_0x4e2c26['uniqueid']][_0x8c0a2a][_0x15f7('0x5f')]=_0x4e2c26[_0x15f7('0x5f')];if(this[_0x15f7('0x9')][_0x4e2c26[_0x15f7('0x27')]]&&this[_0x15f7('0x9')][_0x4e2c26[_0x15f7('0x27')]][_0x15f7('0x60')]){this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a]['acwtime']=this[_0x15f7('0x9')][_0x4e2c26['queue']][_0x15f7('0x61')];this['channels'][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a]['agentacw']=!![];}this[_0x15f7('0xa')][_0x4e2c26[_0x15f7('0x40')]]=_[_0x15f7('0x2b')](this['agents'][_0x4e2c26['interface']],[_0x15f7('0x27'),_0x15f7('0x62')]);logger[_0x15f7('0x24')](_0x15f7('0x63'),_0x4e2c26[_0x15f7('0x21')],util[_0x15f7('0x2e')](this[_0x15f7('0x7')][_0x4e2c26['uniqueid']][_0x8c0a2a],{'showHidden':![],'depth':null}));ami['emit'](_0x15f7('0x64'),this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a]);logger[_0x15f7('0x24')](_0x15f7('0x65'),_0x4e2c26[_0x15f7('0x21')],util[_0x15f7('0x2e')](this['channels'][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a],{'showHidden':![],'depth':null}));this[_0x15f7('0x1c')](util['format']('user:%s',_0x4e2c26['membername']),_0x15f7('0x66'),this[_0x15f7('0x7')][_0x4e2c26[_0x15f7('0x21')]][_0x8c0a2a]);}}}}}}catch(_0x22923b){logger[_0x15f7('0x33')](_0x15f7('0x67'),_0x4e2c26[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x22923b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x68')]=function(_0x1c53d7){try{if(this['isNotNull'](_0x1c53d7)){logger[_0x15f7('0x24')](_0x15f7('0x69'),_0x1c53d7[_0x15f7('0x21')],util['inspect'](_0x1c53d7,{'showHidden':![],'depth':null}));this['addVariable'](_0x1c53d7[_0x15f7('0x21')],_[_0x15f7('0x6a')](_0x1c53d7[_0x15f7('0x6b')])[0x0],_0x1c53d7[_0x15f7('0x6c')]);if(this[_0x15f7('0x7')][_0x1c53d7[_0x15f7('0x21')]]){for(var _0x4452e2 in this['channels'][_0x1c53d7[_0x15f7('0x21')]]){if(this['channels'][_0x1c53d7['uniqueid']][_0x15f7('0x36')](_0x4452e2)){logger['info'](_0x15f7('0x6d'),_0x1c53d7[_0x15f7('0x21')],_0x4452e2,_[_0x15f7('0x6a')](_0x1c53d7[_0x15f7('0x6b')])[0x0],_0x1c53d7[_0x15f7('0x6c')]);if(_[_0x15f7('0x1e')](this[_0x15f7('0x7')][_0x1c53d7[_0x15f7('0x21')]][_0x4452e2][_0x15f7('0xb')])){this[_0x15f7('0x7')][_0x1c53d7[_0x15f7('0x21')]][_0x4452e2][_0x15f7('0xb')]={};}this[_0x15f7('0x7')][_0x1c53d7[_0x15f7('0x21')]][_0x4452e2][_0x15f7('0xb')]=this[_0x15f7('0xb')][_0x1c53d7[_0x15f7('0x21')]];}}}}}catch(_0x122351){logger[_0x15f7('0x33')](_0x15f7('0x6e'),_0x1c53d7[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x122351,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x15f7('0x6f')]=function(_0x516ffd,_0x3c5687,_0x51f027){var _0x5296c4=[_0x15f7('0x70'),_0x15f7('0x71'),_0x15f7('0x72'),'rtpaudioqosjitterbridged',_0x15f7('0x73'),_0x15f7('0x74'),_0x15f7('0x75'),_0x15f7('0x76'),'sipcallid',_0x15f7('0x77'),_0x15f7('0x78'),_0x15f7('0x79'),'membercalls','memberdynamic',_0x15f7('0x7a'),_0x15f7('0x7b'),'membername',_0x15f7('0x7c'),_0x15f7('0x7d')];if(!_[_0x15f7('0x7e')](_0x3c5687)&&!_[_0x15f7('0x7f')](_0x5296c4,_0x3c5687)){if(_[_0x15f7('0x1e')](this[_0x15f7('0xb')][_0x516ffd])){this[_0x15f7('0xb')][_0x516ffd]={};}this['variables'][_0x516ffd][_0x3c5687]=_0x51f027;}};VoiceAgentReport[_0x15f7('0x1b')]['syncHangup']=function(_0x44a885){try{if(this[_0x15f7('0x1d')](_0x44a885)){logger[_0x15f7('0x24')](_0x15f7('0x80'),_0x44a885[_0x15f7('0x21')],util['inspect'](_0x44a885,{'showHidden':![],'depth':null}));if(this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]]){for(var _0x1a3041 in this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]]){if(this[_0x15f7('0x7')][_0x44a885['uniqueid']][_0x15f7('0x36')](_0x1a3041)){if(this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]][_0x1a3041][_0x15f7('0x48')]==_0x15f7('0x5d')&&this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]][_0x1a3041][_0x15f7('0x45')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x44a885[_0x15f7('0x21')],_0x1a3041);this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]][_0x1a3041][_0x15f7('0x5c')]=moment()[_0x15f7('0x25')](_0x15f7('0x26'));}}}logger[_0x15f7('0x24')](_0x15f7('0x81'),_0x44a885[_0x15f7('0x21')],util[_0x15f7('0x2e')](_[_0x15f7('0x82')](this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x15f7('0x83'),_[_0x15f7('0x82')](this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]]));delete this[_0x15f7('0x7')][_0x44a885[_0x15f7('0x21')]];}if(this[_0x15f7('0xb')][_0x44a885[_0x15f7('0x21')]]){delete this[_0x15f7('0xb')][_0x44a885['uniqueid']];}}}catch(_0x462406){logger['error'](_0x15f7('0x84'),_0x44a885[_0x15f7('0x21')],util['inspect'](_0x462406,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x19')]=function(_0x173e34){try{if(this['isNotNull'](_0x173e34)){logger[_0x15f7('0x24')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x173e34[_0x15f7('0x21')],util['inspect'](_0x173e34,{'showHidden':![],'depth':null}));if(this['channels'][_0x173e34['transfereeuniqueid']]){for(var _0x841a4c in this[_0x15f7('0x7')][_0x173e34['transfereeuniqueid']]){if(this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x85')]][_0x15f7('0x36')](_0x841a4c)){if(_0x173e34['origtransfereruniqueid']===_0x841a4c){logger[_0x15f7('0x37')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x173e34[_0x15f7('0x21')],this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x85')]][_0x841a4c][_0x15f7('0x22')],_0x841a4c);var _0x1ed83a=moment();this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x85')]][_0x841a4c]['agentcomplete']=!![];this['channels'][_0x173e34['transfereeuniqueid']][_0x841a4c][_0x15f7('0x5c')]=moment()[_0x15f7('0x25')](_0x15f7('0x26'));this[_0x15f7('0x7')][_0x173e34['transfereeuniqueid']][_0x841a4c][_0x15f7('0x50')]=_0x15f7('0x86');this['channels'][_0x173e34['transfereeuniqueid']][_0x841a4c][_0x15f7('0x48')]='transfer';this[_0x15f7('0x7')][_0x173e34['transfereeuniqueid']][_0x841a4c][_0x15f7('0x5f')]=_0x1ed83a['diff'](this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x85')]][_0x841a4c][_0x15f7('0x38')],_0x15f7('0x87'));}}}}if(this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x88')]]){var _0x1308bb=this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x88')]];this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x88')]]=this[_0x15f7('0x7')][_0x173e34['transfereeuniqueid']];this[_0x15f7('0x7')][_0x173e34[_0x15f7('0x85')]]=_0x1308bb;}}}catch(_0x18f391){logger['error'](_0x15f7('0x89'),_0x173e34[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x18f391,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')]['syncBlindTransfer']=function(_0x193708){try{if(this[_0x15f7('0x1d')](_0x193708)){logger[_0x15f7('0x24')](_0x15f7('0x8a'),_0x193708['uniqueid'],util[_0x15f7('0x2e')](_0x193708,{'showHidden':![],'depth':null}));if(this[_0x15f7('0x7')][_0x193708['transfereeuniqueid']]){for(var _0x13040a in this[_0x15f7('0x7')][_0x193708['transfereeuniqueid']]){if(this[_0x15f7('0x7')][_0x193708['transfereeuniqueid']][_0x15f7('0x36')](_0x13040a)){if(_0x193708[_0x15f7('0x8b')]===_0x13040a){logger[_0x15f7('0x37')](_0x15f7('0x8c'),_0x193708['uniqueid'],this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a][_0x15f7('0x22')],_0x13040a);var _0x42dad8=moment();this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a]['agentcomplete']=!![];this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a][_0x15f7('0x5c')]=_0x42dad8;this['channels'][_0x193708[_0x15f7('0x85')]][_0x13040a][_0x15f7('0x50')]=_0x15f7('0x86');this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a]['reason']=_0x15f7('0x5d');this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a][_0x15f7('0x5f')]=_0x42dad8[_0x15f7('0x8d')](this[_0x15f7('0x7')][_0x193708[_0x15f7('0x85')]][_0x13040a][_0x15f7('0x38')],_0x15f7('0x87'));}}}}}}catch(_0x3d4246){logger[_0x15f7('0x33')](_0x15f7('0x8e'),_0x193708[_0x15f7('0x21')],util['inspect'](_0x3d4246,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x15f7('0x1b')][_0x15f7('0x16')]=function(_0x3d29f2){var _0x8c5218='';try{if(this[_0x15f7('0x1d')](_0x3d29f2)){logger[_0x15f7('0x24')](_0x15f7('0x8f'),_0x3d29f2[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x3d29f2,{'showHidden':![],'depth':null}));if(_0x3d29f2['channel']){_0x8c5218=_0x3d29f2['channel'][_0x15f7('0x90')](0x0,_0x3d29f2[_0x15f7('0x91')][_0x15f7('0x92')]('-'));if(this[_0x15f7('0xa')][_0x8c5218]){logger[_0x15f7('0x37')](_0x15f7('0x93'),_0x3d29f2['uniqueid'],_0x8c5218);this[_0x15f7('0xa')][_0x8c5218][_0x15f7('0x94')]=!![];}}}}catch(_0x56f099){logger[_0x15f7('0x33')](_0x15f7('0x95'),_0x3d29f2[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x56f099,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x15f7('0x18')]=function(_0x2f89f5){var _0x4c595d='';try{if(this[_0x15f7('0x1d')](_0x2f89f5)){logger['debug'](_0x15f7('0x96'),_0x2f89f5[_0x15f7('0x21')],util[_0x15f7('0x2e')](_0x2f89f5,{'showHidden':![],'depth':null}));if(_0x2f89f5[_0x15f7('0x91')]){_0x4c595d=_0x2f89f5[_0x15f7('0x91')]['substring'](0x0,_0x2f89f5[_0x15f7('0x91')][_0x15f7('0x92')]('-'));if(this['agents'][_0x4c595d]){logger[_0x15f7('0x37')](_0x15f7('0x97'),_0x2f89f5[_0x15f7('0x21')],_0x4c595d);this[_0x15f7('0xa')][_0x4c595d]['onhold']=![];}}}}catch(_0x2f4668){logger['error'](_0x15f7('0x98'),_0x2f89f5['uniqueid'],util['inspect'](_0x2f4668,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 752628c..5de6075 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99dd=['diff','connectedlinename','toNumber','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','undefined','isEmpty','getSettings','Action','StopMixMonitor','destinationchannel','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','some','origtransfererlinkedid','routeid','transferType','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','transferconnectedlinenum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','socket.io-emitter','agents','blindTransfers','syncNewExten','bind','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','isUndefined','channels','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','emit','format','name','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','merge','includes','lastdata','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x99dd,0x69));var _0xd99d=function(_0xebf845,_0x64b33){_0xebf845=_0xebf845-0x0;var _0x501855=_0x99dd[_0xebf845];return _0x501855;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0xd99d('0x0'));var util=require(_0xd99d('0x1'));var path=require(_0xd99d('0x2'));var Redis=require('ioredis');var config=require(_0xd99d('0x3'));var logger=require(_0xd99d('0x4'))(_0xd99d('0x5'));var ami=require(_0xd99d('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0xd99d('0x7'));var statusDesc=[_0xd99d('0x8'),_0xd99d('0x9'),'inuse',_0xd99d('0xa'),_0xd99d('0xb'),_0xd99d('0xc'),_0xd99d('0xd'),_0xd99d('0xe'),'onhold'];var applications=[_0xd99d('0xf'),_0xd99d('0x10'),_0xd99d('0x11'),_0xd99d('0x12'),_0xd99d('0x13'),_0xd99d('0x14')];var dispositions=[_0xd99d('0x15'),_0xd99d('0x16'),_0xd99d('0x16'),_0xd99d('0x15'),_0xd99d('0x15'),_0xd99d('0x15'),_0xd99d('0x17'),_0xd99d('0x18'),_0xd99d('0x16'),_0xd99d('0x16'),_0xd99d('0x16')];var actions={};config['redis']=_[_0xd99d('0x19')](config[_0xd99d('0x1a')],{'host':'localhost','port':0x18eb});var io=require(_0xd99d('0x1b'))(new Redis(config[_0xd99d('0x1a')]));function VoiceCallReport(_0x4a5e7d){this['channels']=_0x4a5e7d['channels'];this[_0xd99d('0x1c')]=_0x4a5e7d['agents'];this[_0xd99d('0x1d')]={};ami['on']('coreshowchannel',this[_0xd99d('0x1e')][_0xd99d('0x1f')](this));ami['on']('newexten',this[_0xd99d('0x1e')][_0xd99d('0x1f')](this));ami['on'](_0xd99d('0x20'),this[_0xd99d('0x21')][_0xd99d('0x1f')](this));ami['on'](_0xd99d('0x22'),this['syncNewState'][_0xd99d('0x1f')](this));ami['on'](_0xd99d('0x23'),this[_0xd99d('0x24')]['bind'](this));ami['on'](_0xd99d('0x25'),this[_0xd99d('0x26')][_0xd99d('0x1f')](this));ami['on'](_0xd99d('0x27'),this[_0xd99d('0x28')][_0xd99d('0x1f')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0xd99d('0x29'),this[_0xd99d('0x2a')][_0xd99d('0x1f')](this));ami['on'](_0xd99d('0x2b'),this[_0xd99d('0x2c')][_0xd99d('0x1f')](this));ami['on'](_0xd99d('0x2d'),this[_0xd99d('0x2e')][_0xd99d('0x1f')](this));try{logger[_0xd99d('0x2f')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xd99d('0x30')]();}catch(_0x50f676){logger[_0xd99d('0x31')](_0xd99d('0x32'),util[_0xd99d('0x33')](_0x50f676,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xd99d('0x34')][_0xd99d('0x35')]=function(_0x424b5a){return _0x424b5a!==null&&!_['isUndefined'](_0x424b5a);};VoiceCallReport['prototype']['emit']=function(_0x4f2b1a,_0xb36eb3,_0x29fab6){io['to'](_0x4f2b1a)['emit'](_0xb36eb3,_0x29fab6);};VoiceCallReport[_0xd99d('0x34')][_0xd99d('0x28')]=function(_0x461384){try{if(this[_0xd99d('0x35')](_0x461384)){logger[_0xd99d('0x2f')](_0xd99d('0x36'),_0x461384['uniqueid'],_0x461384[_0xd99d('0x37')],_0x461384[_0xd99d('0x38')]);logger[_0xd99d('0x39')](_0xd99d('0x3a'),_0x461384['uniqueid'],util['inspect'](_0x461384,{'showHidden':![],'depth':null}));if(_0x461384[_0xd99d('0x3b')]===_0x461384[_0xd99d('0x3c')]){if(!_[_0xd99d('0x3d')](this[_0xd99d('0x3e')][_0x461384[_0xd99d('0x3b')]])){_['merge'](this[_0xd99d('0x3e')][_0x461384[_0xd99d('0x3b')]],_[_0xd99d('0x3f')](_0x461384,_[_0xd99d('0x40')](this[_0xd99d('0x3e')][_0x461384[_0xd99d('0x3b')]])));}}if(_0x461384[_0xd99d('0x41')]===_0xd99d('0x42')){if(this[_0xd99d('0x1c')][_0x461384[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]]){if(_0x461384[_0xd99d('0x45')]==_0xd99d('0x46')){this[_0xd99d('0x1c')][_0x461384['channel'][_0xd99d('0x44')]('-')[0x0]][_0xd99d('0x47')]=_0x461384[_0xd99d('0x48')];this[_0xd99d('0x49')](util[_0xd99d('0x4a')]('user:%s',this[_0xd99d('0x1c')][_0x461384['channel']['split']('-')[0x0]][_0xd99d('0x4b')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x461384['channel'][_0xd99d('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x461384[_0xd99d('0x48')]});}}}}}catch(_0x8de1b7){logger[_0xd99d('0x31')](_0xd99d('0x4c'),_0x461384[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x8de1b7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd99d('0x34')][_0xd99d('0x21')]=function(_0x5e3efd){try{if(this['isNotNull'](_0x5e3efd)){logger[_0xd99d('0x39')]('[%s][voiceCallReport][newchannel]\x20event:',_0x5e3efd[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x5e3efd,{'showHidden':![],'depth':null}));if(_0x5e3efd[_0xd99d('0x3b')]===_0x5e3efd[_0xd99d('0x3c')]&&_0x5e3efd[_0xd99d('0x43')]!=_0xd99d('0x4d')){if(_['isUndefined'](this[_0xd99d('0x3e')][_0x5e3efd['uniqueid']])){logger['info'](_0xd99d('0x4e'),_0x5e3efd[_0xd99d('0x3b')],_0x5e3efd[_0xd99d('0x41')],_0x5e3efd[_0xd99d('0x45')]);this[_0xd99d('0x3e')][_0x5e3efd[_0xd99d('0x3b')]]=new Channel();this[_0xd99d('0x3e')][_0x5e3efd[_0xd99d('0x3b')]][_0xd99d('0x4f')]=moment()[_0xd99d('0x4a')](_0xd99d('0x50'));this['channels'][_0x5e3efd[_0xd99d('0x3b')]][_0xd99d('0x51')]=dispositions[_['toNumber'](_0x5e3efd[_0xd99d('0x52')])];_['merge'](this[_0xd99d('0x3e')][_0x5e3efd['uniqueid']],_[_0xd99d('0x3f')](_0x5e3efd,_[_0xd99d('0x40')](this['channels'][_0x5e3efd[_0xd99d('0x3b')]])));if(_0x5e3efd[_0xd99d('0x41')]===_0xd99d('0x42')){if(this[_0xd99d('0x1c')][_0x5e3efd[_0xd99d('0x43')]['split']('-')[0x0]]){if(_[_0xd99d('0x3d')](this[_0xd99d('0x1c')][_0x5e3efd[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]][_0xd99d('0x47')])){this[_0xd99d('0x1c')][_0x5e3efd[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x5e3efd[_0xd99d('0x45')];logger[_0xd99d('0x39')](_0xd99d('0x53'),_0x5e3efd[_0xd99d('0x3b')],util[_0xd99d('0x33')]({'destaccountcode':this[_0xd99d('0x1c')][_0x5e3efd[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5e3efd[_0xd99d('0x45')]},{'showHidden':![],'depth':null}));this[_0xd99d('0x49')](util[_0xd99d('0x4a')](_0xd99d('0x54'),this[_0xd99d('0x1c')][_0x5e3efd[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]]['name']),_0xd99d('0x55'),{'destaccountcode':this[_0xd99d('0x1c')][_0x5e3efd['channel'][_0xd99d('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5e3efd[_0xd99d('0x45')]});}}}}}}}catch(_0x4c1701){logger[_0xd99d('0x31')]('[%s][voiceCallReport][newchannel]',_0x5e3efd['uniqueid'],util['inspect'](_0x4c1701,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd99d('0x34')]['syncNewExten']=function(_0x21e395){try{if(this[_0xd99d('0x35')](_0x21e395)){logger['debug'](_0xd99d('0x56'),_0x21e395['uniqueid'],util[_0xd99d('0x33')](_0x21e395,{'showHidden':![],'depth':null}));if(_0x21e395['uniqueid']===_0x21e395[_0xd99d('0x3c')]&&_0x21e395[_0xd99d('0x45')]!='h'&&_0x21e395[_0xd99d('0x43')]!=_0xd99d('0x4d')){_0x21e395[_0xd99d('0x57')]=_0x21e395[_0xd99d('0x57')][_0xd99d('0x58')]();_0x21e395[_0xd99d('0x59')]=_0x21e395[_0xd99d('0x5a')]&&_0x21e395['appdata'][_0xd99d('0x5b')](_0xd99d('0x5c'))?_0x21e395[_0xd99d('0x5a')]:(_0x21e395[_0xd99d('0x5a')]||_0x21e395[_0xd99d('0x59')])[_0xd99d('0x58')]();logger[_0xd99d('0x2f')](_0xd99d('0x5d'),_0x21e395['uniqueid'],_0x21e395[_0xd99d('0x57')],_0x21e395[_0xd99d('0x59')]);if(_['isUndefined'](this[_0xd99d('0x3e')][_0x21e395[_0xd99d('0x3b')]])){this['channels'][_0x21e395['uniqueid']]=new Channel();this[_0xd99d('0x3e')][_0x21e395[_0xd99d('0x3b')]][_0xd99d('0x4f')]=_0x21e395['duration']?moment()[_0xd99d('0x5e')](moment['duration'](_0x21e395[_0xd99d('0x5f')])[_0xd99d('0x60')](),_0xd99d('0x60'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xd99d('0x4a')](_0xd99d('0x50'));this['channels'][_0x21e395[_0xd99d('0x3b')]][_0xd99d('0x51')]=_0xd99d('0x15');}_[_0xd99d('0x61')](this[_0xd99d('0x3e')][_0x21e395[_0xd99d('0x3b')]],_[_0xd99d('0x3f')](_0x21e395,_[_0xd99d('0x40')](this['channels'][_0x21e395[_0xd99d('0x3b')]])));if(_[_0xd99d('0x62')](applications,_0x21e395[_0xd99d('0x57')])){this['channels'][_0x21e395[_0xd99d('0x3b')]]['lastapplication']=_0x21e395['application'];this['channels'][_0x21e395[_0xd99d('0x3b')]][_0xd99d('0x63')]=_0x21e395['applicationdata'];if(_0x21e395[_0xd99d('0x57')]===_0xd99d('0xf')&&_[_0xd99d('0x5b')](_0x21e395[_0xd99d('0x59')][_0xd99d('0x58')](),'cdr(')){var _0x1fe8dc=_0x21e395[_0xd99d('0x59')][_0xd99d('0x44')]('=');var _0x184669=_0x1fe8dc[0x0][_0xd99d('0x58')]()['match'](/cdr\((.*)\)/);if(_0x184669){this[_0xd99d('0x3e')][_0x21e395[_0xd99d('0x3b')]][_0x184669[0x1]]=_0x1fe8dc[0x1];}}else if(_0x21e395['application']===_0xd99d('0x10')){this[_0xd99d('0x3e')][_0x21e395[_0xd99d('0x3b')]]['queue']=_0x21e395[_0xd99d('0x59')]['split'](',')[0x0];}}}}}catch(_0x323e36){logger[_0xd99d('0x31')](_0xd99d('0x64'),_0x21e395[_0xd99d('0x3b')],util['inspect'](_0x323e36,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd99d('0x34')]['syncNewState']=function(_0x55c4fb){try{if(this[_0xd99d('0x35')](_0x55c4fb)){logger['info'](_0xd99d('0x65'),_0x55c4fb[_0xd99d('0x3b')],_0x55c4fb[_0xd99d('0x3c')],_0x55c4fb[_0xd99d('0x37')],_0x55c4fb[_0xd99d('0x38')]);logger[_0xd99d('0x39')](_0xd99d('0x66'),_0x55c4fb[_0xd99d('0x3b')],util['inspect'](_0x55c4fb,{'showHidden':![],'depth':null}));if(_0x55c4fb[_0xd99d('0x3b')]!==_0x55c4fb[_0xd99d('0x3c')]){if(this['channels'][_0x55c4fb['linkedid']]){if(_0x55c4fb[_0xd99d('0x52')]==='6'){if(!this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3c')]][_0xd99d('0x67')]){var _0x2c3a50=moment();this['channels'][_0x55c4fb[_0xd99d('0x3c')]][_0xd99d('0x67')]=!![];this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3c')]][_0xd99d('0x68')]=_0x2c3a50[_0xd99d('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3c')]]['starttime']){this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3c')]][_0xd99d('0x69')]=_0x2c3a50[_0xd99d('0x6a')](this[_0xd99d('0x3e')][_0x55c4fb['linkedid']][_0xd99d('0x4f')],'seconds');}}this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3c')]][_0xd99d('0x3c')]=_0x55c4fb[_0xd99d('0x3b')];if(_0x55c4fb[_0xd99d('0x38')]!=='xcally-motion-preview'){this[_0xd99d('0x3e')][_0x55c4fb['linkedid']]['connectedlinenum']=_0x55c4fb[_0xd99d('0x38')];}this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3c')]][_0xd99d('0x6b')]=_0x55c4fb[_0xd99d('0x37')];this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3c')]]['destinationchannel']=_0x55c4fb[_0xd99d('0x43')];this['channels'][_0x55c4fb[_0xd99d('0x3c')]]['disposition']=dispositions[_[_0xd99d('0x6c')](_0x55c4fb[_0xd99d('0x52')])];if(this[_0xd99d('0x1c')][_0x55c4fb[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]]){this[_0xd99d('0x3e')][_0x55c4fb['linkedid']][_0xd99d('0x6d')]=this[_0xd99d('0x1c')][_0x55c4fb[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]]['id'];this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3c')]][_0xd99d('0x6e')]=this[_0xd99d('0x1c')][_0x55c4fb['channel'][_0xd99d('0x44')]('-')[0x0]][_0xd99d('0x4b')];}}}}else{if(this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3b')]]){if(_0x55c4fb['channelstate']==='6'){if(this[_0xd99d('0x1c')][_0x55c4fb[_0xd99d('0x43')]['split']('-')[0x0]]){this[_0xd99d('0x3e')][_0x55c4fb['uniqueid']][_0xd99d('0x6d')]=this[_0xd99d('0x1c')][_0x55c4fb[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]]['id'];this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3b')]][_0xd99d('0x6e')]=this[_0xd99d('0x1c')][_0x55c4fb[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]]['name'];}}}}if(_0x55c4fb['channelstate']==='6'&&_0x55c4fb[_0xd99d('0x41')]==='from-sip'){if(this[_0xd99d('0x1c')][_0x55c4fb[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]]){this['agents'][_0x55c4fb[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]][_0xd99d('0x47')]=_0x55c4fb[_0xd99d('0x45')];var _0x3f733d;if(this['channels'][_0x55c4fb[_0xd99d('0x3b')]])_0x3f733d=this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3b')]]['routealias'];else if(this['channels'][_0x55c4fb[_0xd99d('0x3c')]])_0x3f733d=this[_0xd99d('0x3e')][_0x55c4fb[_0xd99d('0x3c')]][_0xd99d('0x6f')];logger[_0xd99d('0x39')](_0xd99d('0x70'),_0x55c4fb['uniqueid'],util[_0xd99d('0x33')]({'destaccountcode':this[_0xd99d('0x1c')][_0x55c4fb['channel'][_0xd99d('0x44')]('-')[0x0]][_0xd99d('0x71')],'destconnectedlinenum':_0x55c4fb[_0xd99d('0x45')],'routealias':_0x3f733d},{'showHidden':![],'depth':null}));this[_0xd99d('0x49')](util[_0xd99d('0x4a')]('user:%s',this[_0xd99d('0x1c')][_0x55c4fb[_0xd99d('0x43')]['split']('-')[0x0]]['name']),_0xd99d('0x55'),{'destaccountcode':this[_0xd99d('0x1c')][_0x55c4fb['channel'][_0xd99d('0x44')]('-')[0x0]][_0xd99d('0x71')],'destconnectedlinenum':_0x55c4fb['exten'],'routealias':_0x3f733d});}}}}catch(_0x4e938a){logger[_0xd99d('0x31')](_0xd99d('0x72'),_0x55c4fb[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x4e938a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd99d('0x34')][_0xd99d('0x73')]=function(_0x1a9b8b,_0x4cbc60){try{if(this[_0xd99d('0x3e')][_0x1a9b8b]){logger[_0xd99d('0x2f')](_0xd99d('0x74'),_0x1a9b8b,_0x4cbc60);this[_0xd99d('0x3e')][_0x1a9b8b]['monitor']=!![];if(_[_0xd99d('0x75')](_0x4cbc60,_0xd99d('0x76'))){_0x4cbc60=_0x4cbc60[_0xd99d('0x77')](_0xd99d('0x76'),_0xd99d('0x78'));}this[_0xd99d('0x3e')][_0x1a9b8b]['monitorFilename']=_0x4cbc60;var _0x105365=_[_0xd99d('0x79')](this['channels'][_0x1a9b8b][_0xd99d('0x7a')],{'filename':_0x4cbc60});if(_[_0xd99d('0x7b')](_0x105365)){this[_0xd99d('0x3e')][_0x1a9b8b][_0xd99d('0x7a')][_0xd99d('0x7c')]({'filename':_0x4cbc60,'createdAt':moment()[_0xd99d('0x4a')](_0xd99d('0x50')),'mixmonitorid':'','status':_0xd99d('0x7d')});}}}catch(_0x2efaad){logger[_0xd99d('0x31')](_0xd99d('0x7e'),_0x1a9b8b,util[_0xd99d('0x33')](_0x2efaad,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd99d('0x34')][_0xd99d('0x24')]=function(_0x5c99b0){try{if(this[_0xd99d('0x35')](_0x5c99b0)){logger[_0xd99d('0x39')](_0xd99d('0x7f'),_0x5c99b0[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x5c99b0,{'showHidden':![],'depth':null}));if(this[_0xd99d('0x3e')][_0x5c99b0[_0xd99d('0x3b')]]&&_0x5c99b0[_0xd99d('0x43')]!=_0xd99d('0x4d')){if(this[_0xd99d('0x35')](_0x5c99b0[_0xd99d('0x80')])){if(this['isNotNull'](_0x5c99b0[_0xd99d('0x80')][_0xd99d('0x81')])){logger[_0xd99d('0x2f')](_0xd99d('0x82'),_0x5c99b0[_0xd99d('0x3b')],_0x5c99b0['value']);this[_0xd99d('0x73')](_0x5c99b0[_0xd99d('0x3b')],_0x5c99b0[_0xd99d('0x83')]);}else if(this[_0xd99d('0x35')](_0x5c99b0[_0xd99d('0x80')][_0xd99d('0x84')])){logger[_0xd99d('0x2f')](_0xd99d('0x85'),_0x5c99b0[_0xd99d('0x3b')],_0x5c99b0[_0xd99d('0x83')]);this[_0xd99d('0x3e')][_0x5c99b0[_0xd99d('0x3b')]]['calleridnum']=_0x5c99b0[_0xd99d('0x83')];}else if(this['isNotNull'](_0x5c99b0[_0xd99d('0x80')][_0xd99d('0x86')])){logger[_0xd99d('0x2f')](_0xd99d('0x87'),_0x5c99b0[_0xd99d('0x3b')],_0x5c99b0[_0xd99d('0x83')]);this[_0xd99d('0x3e')][_0x5c99b0[_0xd99d('0x3b')]]['callerid']=_0x5c99b0[_0xd99d('0x83')];}else if(this[_0xd99d('0x35')](_0x5c99b0[_0xd99d('0x80')][_0xd99d('0x88')])){logger['info'](_0xd99d('0x89'),_0x5c99b0[_0xd99d('0x3b')],_0x5c99b0[_0xd99d('0x83')]);this[_0xd99d('0x3e')][_0x5c99b0['uniqueid']][_0xd99d('0x8a')]=_0x5c99b0[_0xd99d('0x83')];}else if(this[_0xd99d('0x35')](_0x5c99b0[_0xd99d('0x80')][_0xd99d('0x8b')])){logger[_0xd99d('0x2f')](_0xd99d('0x8c'),_0x5c99b0[_0xd99d('0x3b')],_0x5c99b0[_0xd99d('0x83')][_0xd99d('0x44')](',')[0x0]);this['channels'][_0x5c99b0['uniqueid']][_0xd99d('0x10')]=_0x5c99b0[_0xd99d('0x83')][_0xd99d('0x44')](',')[0x0];}else if(this[_0xd99d('0x35')](_0x5c99b0[_0xd99d('0x80')]['xmd-originatecalleridnum'])){logger[_0xd99d('0x2f')](_0xd99d('0x8d'),_0x5c99b0[_0xd99d('0x3b')],_0x5c99b0['value']);this['channels'][_0x5c99b0[_0xd99d('0x3b')]][_0xd99d('0x8e')]=_0x5c99b0[_0xd99d('0x83')];}else if(this['isNotNull'](_0x5c99b0[_0xd99d('0x80')]['xmd-destination'])){logger[_0xd99d('0x2f')](_0xd99d('0x8f'),_0x5c99b0['uniqueid'],_0x5c99b0[_0xd99d('0x83')]);this[_0xd99d('0x3e')][_0x5c99b0[_0xd99d('0x3b')]][_0xd99d('0x90')]=_0x5c99b0[_0xd99d('0x83')];}else if(this['isNotNull'](_0x5c99b0[_0xd99d('0x80')]['xmd-callerid-preview'])){logger[_0xd99d('0x2f')](_0xd99d('0x91'),_0x5c99b0['uniqueid'],_0x5c99b0[_0xd99d('0x83')]);this[_0xd99d('0x3e')][_0x5c99b0[_0xd99d('0x3b')]][_0xd99d('0x92')]=_0x5c99b0['value'];}else if(this[_0xd99d('0x35')](_0x5c99b0['variable'][_0xd99d('0x93')])){logger[_0xd99d('0x2f')](_0xd99d('0x94'),_0x5c99b0[_0xd99d('0x3b')],_0x5c99b0[_0xd99d('0x83')]);this['channels'][_0x5c99b0[_0xd99d('0x3b')]]['queue']=_0x5c99b0[_0xd99d('0x83')];}else if(this['isNotNull'](_0x5c99b0[_0xd99d('0x80')][_0xd99d('0x95')])){logger[_0xd99d('0x2f')](_0xd99d('0x96'),_0x5c99b0['uniqueid'],_0x5c99b0[_0xd99d('0x83')]);this['channels'][_0x5c99b0[_0xd99d('0x3b')]][_0xd99d('0x97')]=_0x5c99b0['value'];}}}else if(this[_0xd99d('0x35')](_0x5c99b0[_0xd99d('0x80')][_0xd99d('0x81')])){if(_0x5c99b0[_0xd99d('0x83')]){var _0x160121=path[_0xd99d('0x98')](_0x5c99b0['value'])[_0xd99d('0x4b')];logger[_0xd99d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x160121,_0x5c99b0[_0xd99d('0x83')]);this[_0xd99d('0x73')](_0x160121,_0x5c99b0['value']);}}else if(this[_0xd99d('0x3e')][_0x5c99b0[_0xd99d('0x3c')]]){if(this[_0xd99d('0x35')](_0x5c99b0[_0xd99d('0x80')])){if(this[_0xd99d('0x35')](_0x5c99b0[_0xd99d('0x80')][_0xd99d('0x95')])){logger[_0xd99d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5c99b0[_0xd99d('0x3c')],_0x5c99b0[_0xd99d('0x83')]);this['channels'][_0x5c99b0[_0xd99d('0x3c')]][_0xd99d('0x99')]=_0x5c99b0['value'];}}}}}catch(_0x2d79f2){logger[_0xd99d('0x31')]('[%s][voiceCallReport][varset]',_0x5c99b0[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x2d79f2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd99d('0x26')]=function(_0x2bec16){try{if(this[_0xd99d('0x35')](_0x2bec16)){logger['debug'](_0xd99d('0x9a'),_0x2bec16['uniqueid'],util[_0xd99d('0x33')](_0x2bec16,{'showHidden':![],'depth':null}));if(this[_0xd99d('0x3e')][_0x2bec16[_0xd99d('0x3b')]]){logger[_0xd99d('0x2f')](_0xd99d('0x9b'),_0x2bec16['uniqueid'],_0x2bec16['cause-txt']);var _0x35dc31=moment();this[_0xd99d('0x3e')][_0x2bec16['uniqueid']][_0xd99d('0x9c')]=_0x35dc31[_0xd99d('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd99d('0x3e')][_0x2bec16[_0xd99d('0x3b')]]['duration']=_0x35dc31[_0xd99d('0x6a')](this['channels'][_0x2bec16[_0xd99d('0x3b')]][_0xd99d('0x4f')],'seconds');if(this[_0xd99d('0x3e')][_0x2bec16[_0xd99d('0x3b')]][_0xd99d('0x67')]){this['channels'][_0x2bec16['uniqueid']]['billableseconds']=_0x35dc31[_0xd99d('0x6a')](this[_0xd99d('0x3e')][_0x2bec16['uniqueid']][_0xd99d('0x68')],'seconds');this[_0xd99d('0x3e')][_0x2bec16[_0xd99d('0x3b')]][_0xd99d('0x69')]=this[_0xd99d('0x3e')][_0x2bec16['uniqueid']][_0xd99d('0x5f')]-this[_0xd99d('0x3e')][_0x2bec16['uniqueid']][_0xd99d('0x9d')];}if(_0x2bec16[_0xd99d('0x41')]===_0xd99d('0x42')){if(this['agents'][_0x2bec16[_0xd99d('0x43')]['split']('-')[0x0]]){this[_0xd99d('0x1c')][_0x2bec16['channel'][_0xd99d('0x44')]('-')[0x0]]=_[_0xd99d('0x9e')](this['agents'][_0x2bec16[_0xd99d('0x43')]['split']('-')[0x0]],[_0xd99d('0x47')]);logger[_0xd99d('0x39')](_0xd99d('0x9f'),_0x2bec16['uniqueid'],util['inspect']({'id':this[_0xd99d('0x1c')][_0x2bec16[_0xd99d('0x43')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x2bec16[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]][_0xd99d('0x71')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xd99d('0x4a')](_0xd99d('0x54'),this[_0xd99d('0x1c')][_0x2bec16['channel'][_0xd99d('0x44')]('-')[0x0]][_0xd99d('0x4b')]),_0xd99d('0xa0'),{'id':this[_0xd99d('0x1c')][_0x2bec16[_0xd99d('0x43')][_0xd99d('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0xd99d('0x1c')][_0x2bec16[_0xd99d('0x43')]['split']('-')[0x0]][_0xd99d('0x71')]});}}var _0x201270=this;Promise[_0xd99d('0xa1')]()[_0xd99d('0xa2')](function(){var _0xd72c94=_0x201270['channels'][_0x2bec16[_0xd99d('0x3b')]];if(typeof _0xd72c94['transferType']===_0xd99d('0xa3'))return;if(_[_0xd99d('0xa4')](_0xd72c94[_0xd99d('0x7a')]))return;return RpcSetting[_0xd99d('0xa5')]()[_0xd99d('0xa2')](function(_0x3ecee5){if(!_0x3ecee5['stopRecordingOnTransfer'])return;return Promise[_0xd99d('0xa1')]()['then'](function(){return ami[_0xd99d('0xa6')]({'action':_0xd99d('0xa7'),'channel':_0xd72c94[_0xd99d('0x43')]})['catch'](function(){});})[_0xd99d('0xa2')](function(){return ami['Action']({'action':_0xd99d('0xa7'),'channel':_0xd72c94[_0xd99d('0xa8')]})['catch'](function(){})[_0xd99d('0xa9')](function(){var _0x3b1428=_0x201270['agents'][_0xd72c94[_0xd99d('0xa8')][_0xd99d('0x44')]('-')[0x0]];if(!_0x3b1428)return;io['emit'](_0xd99d('0xaa'),{'agentId':_0x3b1428['id'],'uniqueid':_0xd72c94[_0xd99d('0x3b')]});});});});})[_0xd99d('0xa2')](function(){if(_0x2bec16[_0xd99d('0xab')]===_0xd99d('0xac')){_0x201270[_0xd99d('0x1d')][_0x2bec16[_0xd99d('0x3b')]]=_0x201270[_0xd99d('0x3e')][_0x2bec16[_0xd99d('0x3b')]];}else{if(_0x201270['channels'][_0x2bec16[_0xd99d('0x3b')]][_0xd99d('0x8a')]===_0xd99d('0xad')&&_0x201270[_0xd99d('0x1d')][_0x2bec16[_0xd99d('0x3b')]]){_0x201270[_0xd99d('0x3e')][_0x2bec16['uniqueid']][_0xd99d('0x3b')]=[_0x201270[_0xd99d('0x3e')][_0x2bec16[_0xd99d('0x3b')]][_0xd99d('0x3c')],_0x201270[_0xd99d('0x3e')][_0x2bec16['uniqueid']][_0xd99d('0x3c')]=_0x201270[_0xd99d('0x3e')][_0x2bec16[_0xd99d('0x3b')]]['uniqueid']][0x0];delete _0x201270[_0xd99d('0x1d')][_0x2bec16['uniqueid']];}}logger['debug'](_0xd99d('0xae'),_0x2bec16[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x201270[_0xd99d('0x3e')][_0x2bec16['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd99d('0x49')](_0xd99d('0xaf'),_0x201270[_0xd99d('0x3e')][_0x2bec16[_0xd99d('0x3b')]]);delete _0x201270[_0xd99d('0x3e')][_0x2bec16[_0xd99d('0x3b')]];});}}}catch(_0x2617bf){logger['error'](_0xd99d('0xb0'),_0x2bec16[_0xd99d('0x3b')],util['inspect'](_0x2617bf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd99d('0x34')][_0xd99d('0xb1')]=function(_0x43f839){try{if(this[_0xd99d('0x35')](_0x43f839)){logger[_0xd99d('0x2f')](_0xd99d('0xb2'),_0x43f839['uniqueid'],_0x43f839['origtransferercalleridnum'],_0x43f839['transfertargetcalleridnum']);logger[_0xd99d('0x39')](_0xd99d('0xb3'),_0x43f839[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x43f839,{'showHidden':![],'depth':null}));if(this[_0xd99d('0x3e')][_0x43f839['transfereeuniqueid']]){this['channels'][_0x43f839[_0xd99d('0xb4')]]['transfercalleridnum']=_0x43f839[_0xd99d('0xb5')];this['channels'][_0x43f839[_0xd99d('0xb4')]]['transferconnectedlinenum']=_0x43f839[_0xd99d('0xb6')];if(this[_0xd99d('0x3e')][_0x43f839['secondtransfereruniqueid']]){var _0x528f03=this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xb7')]];this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xb7')]]=this[_0xd99d('0x3e')][_0x43f839['transfereeuniqueid']];this[_0xd99d('0x3e')][_0x43f839['transfereeuniqueid']]=_0x528f03;}}else if(this['channels'][_0x43f839[_0xd99d('0xb8')]]){this['channels'][_0x43f839['transfertargetuniqueid']][_0xd99d('0xb9')]=_0x43f839[_0xd99d('0xb5')];this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xb8')]]['transferconnectedlinenum']=_0x43f839[_0xd99d('0xb6')];if(this['channels'][_0x43f839['origtransfereruniqueid']]){var _0x528f03=this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xba')]];this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xba')]]=this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xb8')]];this['channels'][_0x43f839[_0xd99d('0xb8')]]=_0x528f03;}}if((this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xba')]]||this['channels'][_0x43f839['origtransfererlinkedid']])&&this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xb7')]]){var _0x20495f=_[_0xd99d('0xbb')]([this['channels'][_0x43f839[_0xd99d('0xba')]],this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xbc')]],this['channels'][_0x43f839[_0xd99d('0xb7')]]],function(_0x5e541d){return _0x5e541d&&_0x5e541d[_0xd99d('0x8a')]===_0xd99d('0xad')&&_0x5e541d[_0xd99d('0xbd')];});if(_0x20495f){if(this['channels'][_0x43f839[_0xd99d('0xba')]])this['channels'][_0x43f839[_0xd99d('0xba')]][_0xd99d('0xbe')]=_0xd99d('0xbf');if(this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xbc')]])this[_0xd99d('0x3e')][_0x43f839[_0xd99d('0xbc')]]['transferType']=_0xd99d('0xbf');this[_0xd99d('0x3e')][_0x43f839['secondtransfereruniqueid']][_0xd99d('0xbe')]=_0xd99d('0xbf');}}}}catch(_0x3b44f8){logger[_0xd99d('0x31')](_0xd99d('0xc0'),_0x43f839[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x3b44f8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd99d('0x34')]['syncBlindTransfer']=function(_0x4cfdf9){try{if(this[_0xd99d('0x35')](_0x4cfdf9)){logger[_0xd99d('0x2f')](_0xd99d('0xc1'),_0x4cfdf9[_0xd99d('0x3b')],_0x4cfdf9['transfereecalleridnum'],_0x4cfdf9[_0xd99d('0xc2')]);logger[_0xd99d('0x39')](_0xd99d('0xc3'),_0x4cfdf9[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x4cfdf9,{'showHidden':![],'depth':null}));if(this['channels'][_0x4cfdf9['transfereeuniqueid']]){this[_0xd99d('0x3e')][_0x4cfdf9[_0xd99d('0xb4')]]['transfercalleridnum']=_0x4cfdf9[_0xd99d('0xc4')];this[_0xd99d('0x3e')][_0x4cfdf9[_0xd99d('0xb4')]][_0xd99d('0xc5')]=_0x4cfdf9[_0xd99d('0xc2')];this[_0xd99d('0x3e')][_0x4cfdf9['transfereeuniqueid']][_0xd99d('0xbe')]=_0xd99d('0xc6');this['syncHangup']({'event':_0xd99d('0xac'),'uniqueid':_0x4cfdf9['transfereeuniqueid'],'context':_0x4cfdf9[_0xd99d('0x41')],'channel':_0x4cfdf9[_0xd99d('0xc7')]});}else{this[_0xd99d('0x3e')][_0x4cfdf9[_0xd99d('0xc8')]]['transferType']=_0xd99d('0xc6');}}}catch(_0x51823d){logger[_0xd99d('0x31')](_0xd99d('0xc9'),_0x4cfdf9[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x51823d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd99d('0x34')]['syncMusicOnHoldStart']=function(_0xff2389){try{if(this['isNotNull'](_0xff2389)){logger['debug'](_0xd99d('0xca'),_0xff2389['uniqueid'],util[_0xd99d('0x33')](_0xff2389,{'showHidden':![],'depth':null}));if(this[_0xd99d('0x3e')][_0xff2389[_0xd99d('0x3b')]]){if(!_[_0xd99d('0x7b')](this[_0xd99d('0x3e')][_0xff2389[_0xd99d('0x3b')]][_0xd99d('0x68')])){this['channels'][_0xff2389[_0xd99d('0x3b')]][_0xd99d('0xcb')]=moment()[_0xd99d('0x4a')](_0xd99d('0x50'));logger['info']('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0xff2389[_0xd99d('0x3b')],this['channels'][_0xff2389[_0xd99d('0x3b')]]['mohstarttime']);}}}}catch(_0x3ea840){logger[_0xd99d('0x31')](_0xd99d('0xcc'),_0xff2389[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x3ea840,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x31c14d){try{if(this[_0xd99d('0x35')](_0x31c14d)){logger[_0xd99d('0x39')](_0xd99d('0xcd'),_0x31c14d[_0xd99d('0x3b')],util['inspect'](_0x31c14d,{'showHidden':![],'depth':null}));if(this[_0xd99d('0x3e')][_0x31c14d[_0xd99d('0x3b')]]){if(!_[_0xd99d('0x7b')](this['channels'][_0x31c14d['uniqueid']][_0xd99d('0xcb')])){this['channels'][_0x31c14d['uniqueid']][_0xd99d('0xce')]+=moment()[_0xd99d('0xcf')](0x0)[_0xd99d('0x6a')](this[_0xd99d('0x3e')][_0x31c14d[_0xd99d('0x3b')]][_0xd99d('0xcb')],_0xd99d('0x60'));logger['info'](_0xd99d('0xd0'),_0x31c14d[_0xd99d('0x3b')],this[_0xd99d('0x3e')][_0x31c14d[_0xd99d('0x3b')]][_0xd99d('0xce')]);delete this[_0xd99d('0x3e')][_0x31c14d[_0xd99d('0x3b')]][_0xd99d('0xcb')];}}}}catch(_0x5f17de){logger[_0xd99d('0x31')](_0xd99d('0xd1'),_0x31c14d[_0xd99d('0x3b')],util[_0xd99d('0x33')](_0x5f17de,{'showHidden':![],'depth':null}));}};module[_0xd99d('0xd2')]=VoiceCallReport; \ No newline at end of file +var _0x3064=['ATTENDED','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','transfererchannel','transfereruniqueid','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','queue','agi','dial','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','channels','agents','blindTransfers','syncNewExten','bind','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:%s','accountcode','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastdata','set','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','answertime','diff','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','answered','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','transferType','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid'];(function(_0x1c5b3f,_0xc7f4af){var _0x38cfa8=function(_0x1fb92a){while(--_0x1fb92a){_0x1c5b3f['push'](_0x1c5b3f['shift']());}};_0x38cfa8(++_0xc7f4af);}(_0x3064,0xd7));var _0x4306=function(_0x3458c2,_0x375f87){_0x3458c2=_0x3458c2-0x0;var _0x3376e8=_0x3064[_0x3458c2];return _0x3376e8;};'use strict';var BPromise=require(_0x4306('0x0'));var _=require(_0x4306('0x1'));var moment=require(_0x4306('0x2'));var util=require(_0x4306('0x3'));var path=require(_0x4306('0x4'));var Redis=require(_0x4306('0x5'));var config=require(_0x4306('0x6'));var logger=require(_0x4306('0x7'))(_0x4306('0x8'));var ami=require(_0x4306('0x9'));var Channel=require(_0x4306('0xa'));var RpcSetting=require(_0x4306('0xb'));var statusDesc=[_0x4306('0xc'),_0x4306('0xd'),_0x4306('0xe'),_0x4306('0xf'),_0x4306('0x10'),'unavailable',_0x4306('0x11'),_0x4306('0x12'),'onhold'];var applications=['set',_0x4306('0x13'),_0x4306('0x14'),_0x4306('0x15'),'playback','voicemail'];var dispositions=['NO\x20ANSWER','FAILED',_0x4306('0x16'),_0x4306('0x17'),_0x4306('0x17'),'NO\x20ANSWER',_0x4306('0x18'),_0x4306('0x19'),_0x4306('0x16'),_0x4306('0x16'),_0x4306('0x16')];var actions={};config[_0x4306('0x1a')]=_['defaults'](config[_0x4306('0x1a')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4306('0x1a')]));function VoiceCallReport(_0x2bc5be){this[_0x4306('0x1b')]=_0x2bc5be['channels'];this[_0x4306('0x1c')]=_0x2bc5be['agents'];this[_0x4306('0x1d')]={};ami['on']('coreshowchannel',this[_0x4306('0x1e')]['bind'](this));ami['on']('newexten',this[_0x4306('0x1e')][_0x4306('0x1f')](this));ami['on']('newchannel',this[_0x4306('0x20')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x21'),this[_0x4306('0x22')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x23'),this[_0x4306('0x24')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x25'),this[_0x4306('0x26')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x27'),this[_0x4306('0x28')]['bind'](this));ami['on'](_0x4306('0x29'),this['syncAttendedTransfer'][_0x4306('0x1f')](this));ami['on'](_0x4306('0x2a'),this[_0x4306('0x2b')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x2c'),this[_0x4306('0x2d')][_0x4306('0x1f')](this));ami['on'](_0x4306('0x2e'),this[_0x4306('0x2f')][_0x4306('0x1f')](this));try{logger['info'](_0x4306('0x30'));ami[_0x4306('0x31')]();}catch(_0x2109c0){logger[_0x4306('0x32')]('[voiceCallReport][coreshowchannels]',util[_0x4306('0x33')](_0x2109c0,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x4306('0x34')][_0x4306('0x35')]=function(_0x5be3f6){return _0x5be3f6!==null&&!_[_0x4306('0x36')](_0x5be3f6);};VoiceCallReport[_0x4306('0x34')]['emit']=function(_0x3ccdde,_0xa35a3,_0x544c4f){io['to'](_0x3ccdde)[_0x4306('0x37')](_0xa35a3,_0x544c4f);};VoiceCallReport[_0x4306('0x34')][_0x4306('0x28')]=function(_0x88ee75){try{if(this[_0x4306('0x35')](_0x88ee75)){logger[_0x4306('0x38')](_0x4306('0x39'),_0x88ee75[_0x4306('0x3a')],_0x88ee75[_0x4306('0x3b')],_0x88ee75[_0x4306('0x3c')]);logger[_0x4306('0x3d')](_0x4306('0x3e'),_0x88ee75[_0x4306('0x3a')],util[_0x4306('0x33')](_0x88ee75,{'showHidden':![],'depth':null}));if(_0x88ee75[_0x4306('0x3a')]===_0x88ee75[_0x4306('0x3f')]){if(!_[_0x4306('0x36')](this['channels'][_0x88ee75[_0x4306('0x3a')]])){_[_0x4306('0x40')](this['channels'][_0x88ee75[_0x4306('0x3a')]],_[_0x4306('0x41')](_0x88ee75,_[_0x4306('0x42')](this['channels'][_0x88ee75[_0x4306('0x3a')]])));}}if(_0x88ee75[_0x4306('0x43')]==='from-sip'){if(this[_0x4306('0x1c')][_0x88ee75[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]){if(_0x88ee75[_0x4306('0x46')]==_0x4306('0x47')){this[_0x4306('0x1c')][_0x88ee75['channel'][_0x4306('0x45')]('-')[0x0]][_0x4306('0x48')]=_0x88ee75[_0x4306('0x49')];this[_0x4306('0x37')](util['format'](_0x4306('0x4a'),this['agents'][_0x88ee75[_0x4306('0x44')]['split']('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this['agents'][_0x88ee75['channel'][_0x4306('0x45')]('-')[0x0]][_0x4306('0x4b')],'destconnectedlinenum':_0x88ee75[_0x4306('0x49')]});}}}}}catch(_0x17b3de){logger[_0x4306('0x32')](_0x4306('0x4c'),_0x88ee75[_0x4306('0x3a')],util[_0x4306('0x33')](_0x17b3de,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')]['syncNewChannel']=function(_0x2f9c5e){try{if(this[_0x4306('0x35')](_0x2f9c5e)){logger['debug']('[%s][voiceCallReport][newchannel]\x20event:',_0x2f9c5e[_0x4306('0x3a')],util['inspect'](_0x2f9c5e,{'showHidden':![],'depth':null}));if(_0x2f9c5e[_0x4306('0x3a')]===_0x2f9c5e[_0x4306('0x3f')]&&_0x2f9c5e[_0x4306('0x44')]!=_0x4306('0x4d')){if(_['isUndefined'](this[_0x4306('0x1b')][_0x2f9c5e['uniqueid']])){logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x2f9c5e[_0x4306('0x3a')],_0x2f9c5e[_0x4306('0x43')],_0x2f9c5e[_0x4306('0x46')]);this[_0x4306('0x1b')][_0x2f9c5e[_0x4306('0x3a')]]=new Channel();this[_0x4306('0x1b')][_0x2f9c5e[_0x4306('0x3a')]]['starttime']=moment()[_0x4306('0x4e')](_0x4306('0x4f'));this[_0x4306('0x1b')][_0x2f9c5e[_0x4306('0x3a')]][_0x4306('0x50')]=dispositions[_[_0x4306('0x51')](_0x2f9c5e['channelstate'])];_[_0x4306('0x40')](this['channels'][_0x2f9c5e[_0x4306('0x3a')]],_[_0x4306('0x41')](_0x2f9c5e,_[_0x4306('0x42')](this[_0x4306('0x1b')][_0x2f9c5e[_0x4306('0x3a')]])));if(_0x2f9c5e[_0x4306('0x43')]===_0x4306('0x52')){if(this['agents'][_0x2f9c5e[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]){if(_[_0x4306('0x36')](this[_0x4306('0x1c')][_0x2f9c5e[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x48')])){this['agents'][_0x2f9c5e['channel'][_0x4306('0x45')]('-')[0x0]][_0x4306('0x48')]=_0x2f9c5e['exten'];logger[_0x4306('0x3d')](_0x4306('0x53'),_0x2f9c5e['uniqueid'],util[_0x4306('0x33')]({'destaccountcode':this[_0x4306('0x1c')][_0x2f9c5e[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x4b')],'destconnectedlinenum':_0x2f9c5e[_0x4306('0x46')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x4306('0x4e')](_0x4306('0x4a'),this['agents'][_0x2f9c5e[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x54')]),'user:agentconnect',{'destaccountcode':this[_0x4306('0x1c')][_0x2f9c5e[_0x4306('0x44')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2f9c5e[_0x4306('0x46')]});}}}}}}}catch(_0x4d2ce3){logger['error'](_0x4306('0x55'),_0x2f9c5e['uniqueid'],util[_0x4306('0x33')](_0x4d2ce3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0x1e')]=function(_0x292ab1){try{if(this[_0x4306('0x35')](_0x292ab1)){logger['debug'](_0x4306('0x56'),_0x292ab1[_0x4306('0x3a')],util[_0x4306('0x33')](_0x292ab1,{'showHidden':![],'depth':null}));if(_0x292ab1[_0x4306('0x3a')]===_0x292ab1[_0x4306('0x3f')]&&_0x292ab1[_0x4306('0x46')]!='h'&&_0x292ab1['channel']!=_0x4306('0x4d')){_0x292ab1[_0x4306('0x57')]=_0x292ab1[_0x4306('0x57')]['toLowerCase']();_0x292ab1[_0x4306('0x58')]=_0x292ab1[_0x4306('0x59')]&&_0x292ab1[_0x4306('0x59')][_0x4306('0x5a')]('CDR(routeAlias)')?_0x292ab1[_0x4306('0x59')]:(_0x292ab1['appdata']||_0x292ab1[_0x4306('0x58')])[_0x4306('0x5b')]();logger[_0x4306('0x38')](_0x4306('0x5c'),_0x292ab1[_0x4306('0x3a')],_0x292ab1['application'],_0x292ab1['applicationdata']);if(_[_0x4306('0x36')](this[_0x4306('0x1b')][_0x292ab1['uniqueid']])){this[_0x4306('0x1b')][_0x292ab1[_0x4306('0x3a')]]=new Channel();this[_0x4306('0x1b')][_0x292ab1[_0x4306('0x3a')]][_0x4306('0x5d')]=_0x292ab1[_0x4306('0x5e')]?moment()[_0x4306('0x5f')](moment[_0x4306('0x5e')](_0x292ab1[_0x4306('0x5e')])[_0x4306('0x60')](),_0x4306('0x60'))[_0x4306('0x4e')](_0x4306('0x4f')):moment()[_0x4306('0x4e')](_0x4306('0x4f'));this['channels'][_0x292ab1[_0x4306('0x3a')]][_0x4306('0x50')]=_0x4306('0x17');}_[_0x4306('0x40')](this['channels'][_0x292ab1[_0x4306('0x3a')]],_['pick'](_0x292ab1,_['keys'](this[_0x4306('0x1b')][_0x292ab1[_0x4306('0x3a')]])));if(_[_0x4306('0x61')](applications,_0x292ab1[_0x4306('0x57')])){this[_0x4306('0x1b')][_0x292ab1[_0x4306('0x3a')]]['lastapplication']=_0x292ab1['application'];this[_0x4306('0x1b')][_0x292ab1['uniqueid']][_0x4306('0x62')]=_0x292ab1[_0x4306('0x58')];if(_0x292ab1[_0x4306('0x57')]===_0x4306('0x63')&&_[_0x4306('0x5a')](_0x292ab1['applicationdata'][_0x4306('0x5b')](),_0x4306('0x64'))){var _0x5c1956=_0x292ab1[_0x4306('0x58')]['split']('=');var _0x4b151f=_0x5c1956[0x0]['toLowerCase']()['match'](/cdr\((.*)\)/);if(_0x4b151f){this[_0x4306('0x1b')][_0x292ab1[_0x4306('0x3a')]][_0x4b151f[0x1]]=_0x5c1956[0x1];}}else if(_0x292ab1[_0x4306('0x57')]===_0x4306('0x13')){this['channels'][_0x292ab1['uniqueid']][_0x4306('0x13')]=_0x292ab1[_0x4306('0x58')][_0x4306('0x45')](',')[0x0];}}}}}catch(_0x2d6919){logger['error'](_0x4306('0x65'),_0x292ab1[_0x4306('0x3a')],util[_0x4306('0x33')](_0x2d6919,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0x22')]=function(_0x5a8a24){try{if(this['isNotNull'](_0x5a8a24)){logger[_0x4306('0x38')](_0x4306('0x66'),_0x5a8a24[_0x4306('0x3a')],_0x5a8a24['linkedid'],_0x5a8a24[_0x4306('0x3b')],_0x5a8a24[_0x4306('0x3c')]);logger[_0x4306('0x3d')](_0x4306('0x67'),_0x5a8a24[_0x4306('0x3a')],util[_0x4306('0x33')](_0x5a8a24,{'showHidden':![],'depth':null}));if(_0x5a8a24[_0x4306('0x3a')]!==_0x5a8a24['linkedid']){if(this['channels'][_0x5a8a24[_0x4306('0x3f')]]){if(_0x5a8a24[_0x4306('0x68')]==='6'){if(!this['channels'][_0x5a8a24['linkedid']]['answered']){var _0x5bf6e3=moment();this[_0x4306('0x1b')][_0x5a8a24['linkedid']]['answered']=!![];this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x69')]=_0x5bf6e3[_0x4306('0x4e')](_0x4306('0x4f'));if(this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x5d')]){this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]]['holdtime']=_0x5bf6e3[_0x4306('0x6a')](this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x5d')],_0x4306('0x60'));}}this['channels'][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x3f')]=_0x5a8a24[_0x4306('0x3a')];if(_0x5a8a24[_0x4306('0x3c')]!==_0x4306('0x47')){this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x49')]=_0x5a8a24[_0x4306('0x3c')];}this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]]['connectedlinename']=_0x5a8a24[_0x4306('0x3b')];this['channels'][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x6b')]=_0x5a8a24[_0x4306('0x44')];this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x50')]=dispositions[_[_0x4306('0x51')](_0x5a8a24[_0x4306('0x68')])];if(this[_0x4306('0x1c')][_0x5a8a24[_0x4306('0x44')]['split']('-')[0x0]]){this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x6c')]=this[_0x4306('0x1c')][_0x5a8a24['channel'][_0x4306('0x45')]('-')[0x0]]['id'];this['channels'][_0x5a8a24['linkedid']][_0x4306('0x6d')]=this[_0x4306('0x1c')][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]['name'];}}}}else{if(this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3a')]]){if(_0x5a8a24[_0x4306('0x68')]==='6'){if(this[_0x4306('0x1c')][_0x5a8a24[_0x4306('0x44')]['split']('-')[0x0]]){this[_0x4306('0x1b')][_0x5a8a24['uniqueid']][_0x4306('0x6c')]=this['agents'][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]['id'];this['channels'][_0x5a8a24[_0x4306('0x3a')]][_0x4306('0x6d')]=this['agents'][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x54')];}}}}if(_0x5a8a24[_0x4306('0x68')]==='6'&&_0x5a8a24[_0x4306('0x43')]==='from-sip'){if(this['agents'][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]){this[_0x4306('0x1c')][_0x5a8a24[_0x4306('0x44')]['split']('-')[0x0]][_0x4306('0x48')]=_0x5a8a24[_0x4306('0x46')];var _0x35e6ca;if(this['channels'][_0x5a8a24[_0x4306('0x3a')]])_0x35e6ca=this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3a')]]['routealias'];else if(this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]])_0x35e6ca=this[_0x4306('0x1b')][_0x5a8a24[_0x4306('0x3f')]][_0x4306('0x6e')];logger[_0x4306('0x3d')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x5a8a24[_0x4306('0x3a')],util[_0x4306('0x33')]({'destaccountcode':this[_0x4306('0x1c')][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x4b')],'destconnectedlinenum':_0x5a8a24[_0x4306('0x46')],'routealias':_0x35e6ca},{'showHidden':![],'depth':null}));this[_0x4306('0x37')](util[_0x4306('0x4e')](_0x4306('0x4a'),this['agents'][_0x5a8a24[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x54')]),'user:agentconnect',{'destaccountcode':this[_0x4306('0x1c')][_0x5a8a24['channel'][_0x4306('0x45')]('-')[0x0]][_0x4306('0x4b')],'destconnectedlinenum':_0x5a8a24['exten'],'routealias':_0x35e6ca});}}}}catch(_0x53a8f9){logger[_0x4306('0x32')](_0x4306('0x6f'),_0x5a8a24['uniqueid'],util[_0x4306('0x33')](_0x53a8f9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4306('0x70')]=function(_0x33f789,_0x508f30){try{if(this[_0x4306('0x1b')][_0x33f789]){logger[_0x4306('0x38')](_0x4306('0x71'),_0x33f789,_0x508f30);this['channels'][_0x33f789][_0x4306('0x72')]=!![];if(_[_0x4306('0x73')](_0x508f30,_0x4306('0x74'))){_0x508f30=_0x508f30[_0x4306('0x75')]('.wav49',_0x4306('0x76'));}this[_0x4306('0x1b')][_0x33f789][_0x4306('0x77')]=_0x508f30;var _0x4cafec=_['find'](this['channels'][_0x33f789][_0x4306('0x78')],{'filename':_0x508f30});if(_[_0x4306('0x79')](_0x4cafec)){this['channels'][_0x33f789][_0x4306('0x78')][_0x4306('0x7a')]({'filename':_0x508f30,'createdAt':moment()['format'](_0x4306('0x4f')),'mixmonitorid':'','status':_0x4306('0x7b')});}}}catch(_0x31a5b5){logger['error'](_0x4306('0x7c'),_0x33f789,util[_0x4306('0x33')](_0x31a5b5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0x24')]=function(_0x5948ad){try{if(this['isNotNull'](_0x5948ad)){logger[_0x4306('0x3d')](_0x4306('0x7d'),_0x5948ad[_0x4306('0x3a')],util[_0x4306('0x33')](_0x5948ad,{'showHidden':![],'depth':null}));if(this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]]&&_0x5948ad[_0x4306('0x44')]!='OutgoingSpoolFailed'){if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')])){if(this[_0x4306('0x35')](_0x5948ad['variable'][_0x4306('0x7f')])){logger[_0x4306('0x38')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5948ad[_0x4306('0x3a')],_0x5948ad[_0x4306('0x80')]);this['syncMixMonitorFilename'](_0x5948ad[_0x4306('0x3a')],_0x5948ad[_0x4306('0x80')]);}else if(this[_0x4306('0x35')](_0x5948ad['variable'][_0x4306('0x81')])){logger[_0x4306('0x38')](_0x4306('0x82'),_0x5948ad[_0x4306('0x3a')],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad['uniqueid']][_0x4306('0x3c')]=_0x5948ad[_0x4306('0x80')];}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x83')])){logger['info'](_0x4306('0x84'),_0x5948ad[_0x4306('0x3a')],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]][_0x4306('0x85')]=_0x5948ad[_0x4306('0x80')];}else if(this['isNotNull'](_0x5948ad[_0x4306('0x7e')][_0x4306('0x86')])){logger[_0x4306('0x38')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5948ad[_0x4306('0x3a')],_0x5948ad['value']);this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]][_0x4306('0x87')]=_0x5948ad[_0x4306('0x80')];}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')]['xmd-queue'])){logger[_0x4306('0x38')](_0x4306('0x88'),_0x5948ad[_0x4306('0x3a')],_0x5948ad[_0x4306('0x80')][_0x4306('0x45')](',')[0x0]);this['channels'][_0x5948ad[_0x4306('0x3a')]]['queue']=_0x5948ad[_0x4306('0x80')][_0x4306('0x45')](',')[0x0];}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x89')])){logger[_0x4306('0x38')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5948ad['uniqueid'],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad['uniqueid']][_0x4306('0x8a')]=_0x5948ad[_0x4306('0x80')];}else if(this['isNotNull'](_0x5948ad['variable']['xmd-destination'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5948ad['uniqueid'],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]][_0x4306('0x8b')]=_0x5948ad['value'];}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x8c')])){logger[_0x4306('0x38')](_0x4306('0x8d'),_0x5948ad[_0x4306('0x3a')],_0x5948ad['value']);this['channels'][_0x5948ad['uniqueid']][_0x4306('0x8e')]=_0x5948ad['value'];}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x8f')])){logger['info'](_0x4306('0x90'),_0x5948ad['uniqueid'],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]][_0x4306('0x13')]=_0x5948ad[_0x4306('0x80')];}else if(this['isNotNull'](_0x5948ad[_0x4306('0x7e')][_0x4306('0x91')])){logger[_0x4306('0x38')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5948ad['uniqueid'],_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x1b')][_0x5948ad[_0x4306('0x3a')]][_0x4306('0x92')]=_0x5948ad['value'];}}}else if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x7f')])){if(_0x5948ad[_0x4306('0x80')]){var _0x4c618b=path['parse'](_0x5948ad['value'])[_0x4306('0x54')];logger[_0x4306('0x38')](_0x4306('0x93'),_0x4c618b,_0x5948ad[_0x4306('0x80')]);this[_0x4306('0x70')](_0x4c618b,_0x5948ad[_0x4306('0x80')]);}}else if(this[_0x4306('0x1b')][_0x5948ad['linkedid']]){if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')])){if(this[_0x4306('0x35')](_0x5948ad[_0x4306('0x7e')][_0x4306('0x91')])){logger[_0x4306('0x38')](_0x4306('0x94'),_0x5948ad[_0x4306('0x3f')],_0x5948ad['value']);this[_0x4306('0x1b')][_0x5948ad['linkedid']][_0x4306('0x95')]=_0x5948ad[_0x4306('0x80')];}}}}}catch(_0x3dd96a){logger[_0x4306('0x32')]('[%s][voiceCallReport][varset]',_0x5948ad['uniqueid'],util[_0x4306('0x33')](_0x3dd96a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0x26')]=function(_0x2eecdb){try{if(this[_0x4306('0x35')](_0x2eecdb)){logger[_0x4306('0x3d')](_0x4306('0x96'),_0x2eecdb[_0x4306('0x3a')],util[_0x4306('0x33')](_0x2eecdb,{'showHidden':![],'depth':null}));if(this[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]]){logger[_0x4306('0x38')](_0x4306('0x97'),_0x2eecdb[_0x4306('0x3a')],_0x2eecdb[_0x4306('0x98')]);var _0x2dfc71=moment();this[_0x4306('0x1b')][_0x2eecdb['uniqueid']]['endtime']=_0x2dfc71[_0x4306('0x4e')](_0x4306('0x4f'));this['channels'][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x5e')]=_0x2dfc71[_0x4306('0x6a')](this[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x5d')],_0x4306('0x60'));if(this['channels'][_0x2eecdb['uniqueid']][_0x4306('0x99')]){this['channels'][_0x2eecdb['uniqueid']][_0x4306('0x9a')]=_0x2dfc71[_0x4306('0x6a')](this['channels'][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x69')],_0x4306('0x60'));this[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x9b')]=this[_0x4306('0x1b')][_0x2eecdb['uniqueid']][_0x4306('0x5e')]-this[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x9a')];}if(_0x2eecdb['context']===_0x4306('0x52')){if(this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]){this[_0x4306('0x1c')][_0x2eecdb['channel'][_0x4306('0x45')]('-')[0x0]]=_[_0x4306('0x9c')](this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]],['destconnectedlinenum']);logger[_0x4306('0x3d')](_0x4306('0x9d'),_0x2eecdb[_0x4306('0x3a')],util['inspect']({'id':this[_0x4306('0x1c')][_0x2eecdb['channel'][_0x4306('0x45')]('-')[0x0]]['id'],'destaccountcode':this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')]['split']('-')[0x0]][_0x4306('0x4b')]},{'showHidden':![],'depth':null}));this[_0x4306('0x37')](util[_0x4306('0x4e')](_0x4306('0x4a'),this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x54')]),_0x4306('0x9e'),{'id':this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]]['id'],'destaccountcode':this[_0x4306('0x1c')][_0x2eecdb[_0x4306('0x44')][_0x4306('0x45')]('-')[0x0]][_0x4306('0x4b')]});}}var _0x320d49=this;Promise[_0x4306('0x9f')]()['then'](function(){var _0x33ccc6=_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]];if(typeof _0x33ccc6[_0x4306('0xa0')]==='undefined')return;if(_[_0x4306('0xa1')](_0x33ccc6[_0x4306('0x78')]))return;return RpcSetting[_0x4306('0xa2')]()[_0x4306('0xa3')](function(_0x1d21c5){if(!_0x1d21c5[_0x4306('0xa4')])return;return Promise[_0x4306('0x9f')]()['then'](function(){return ami[_0x4306('0xa5')]({'action':'StopMixMonitor','channel':_0x33ccc6[_0x4306('0x44')]})[_0x4306('0xa6')](function(){});})[_0x4306('0xa3')](function(){return ami[_0x4306('0xa5')]({'action':_0x4306('0xa7'),'channel':_0x33ccc6[_0x4306('0x6b')]})['catch'](function(){})[_0x4306('0xa8')](function(){var _0x25ae01=_0x320d49[_0x4306('0x1c')][_0x33ccc6[_0x4306('0x6b')][_0x4306('0x45')]('-')[0x0]];if(!_0x25ae01)return;io[_0x4306('0x37')](_0x4306('0xa9'),{'agentId':_0x25ae01['id'],'uniqueid':_0x33ccc6[_0x4306('0x3a')]});});});});})[_0x4306('0xa3')](function(){if(_0x2eecdb[_0x4306('0xaa')]===_0x4306('0xab')){_0x320d49[_0x4306('0x1d')][_0x2eecdb['uniqueid']]=_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]];}else{if(_0x320d49['channels'][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x87')]==='outbound'&&_0x320d49[_0x4306('0x1d')][_0x2eecdb[_0x4306('0x3a')]]){_0x320d49[_0x4306('0x1b')][_0x2eecdb['uniqueid']]['uniqueid']=[_0x320d49[_0x4306('0x1b')][_0x2eecdb['uniqueid']]['linkedid'],_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]]['linkedid']=_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]][_0x4306('0x3a')]][0x0];delete _0x320d49[_0x4306('0x1d')][_0x2eecdb[_0x4306('0x3a')]];}}logger[_0x4306('0x3d')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x2eecdb[_0x4306('0x3a')],util['inspect'](_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceCallReport',_0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]]);delete _0x320d49[_0x4306('0x1b')][_0x2eecdb[_0x4306('0x3a')]];});}}}catch(_0x2a314d){logger[_0x4306('0x32')](_0x4306('0xac'),_0x2eecdb[_0x4306('0x3a')],util[_0x4306('0x33')](_0x2a314d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0xad')]=function(_0x4dff5c){try{if(this['isNotNull'](_0x4dff5c)){logger[_0x4306('0x38')](_0x4306('0xae'),_0x4dff5c['uniqueid'],_0x4dff5c[_0x4306('0xaf')],_0x4dff5c[_0x4306('0xb0')]);logger[_0x4306('0x3d')](_0x4306('0xb1'),_0x4dff5c[_0x4306('0x3a')],util[_0x4306('0x33')](_0x4dff5c,{'showHidden':![],'depth':null}));if(this['channels'][_0x4dff5c[_0x4306('0xb2')]]){this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb2')]][_0x4306('0xb3')]=_0x4dff5c[_0x4306('0xaf')];this['channels'][_0x4dff5c['transfereeuniqueid']][_0x4306('0xb4')]=_0x4dff5c[_0x4306('0xb0')];if(this['channels'][_0x4dff5c[_0x4306('0xb5')]]){var _0x43a169=this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb5')]];this['channels'][_0x4dff5c[_0x4306('0xb5')]]=this['channels'][_0x4dff5c['transfereeuniqueid']];this[_0x4306('0x1b')][_0x4dff5c['transfereeuniqueid']]=_0x43a169;}}else if(this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb6')]]){this[_0x4306('0x1b')][_0x4dff5c['transfertargetuniqueid']]['transfercalleridnum']=_0x4dff5c[_0x4306('0xaf')];this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb6')]][_0x4306('0xb4')]=_0x4dff5c[_0x4306('0xb0')];if(this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb7')]]){var _0x43a169=this['channels'][_0x4dff5c[_0x4306('0xb7')]];this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb7')]]=this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb6')]];this['channels'][_0x4dff5c[_0x4306('0xb6')]]=_0x43a169;}}if((this['channels'][_0x4dff5c[_0x4306('0xb7')]]||this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb8')]])&&this['channels'][_0x4dff5c[_0x4306('0xb5')]]){var _0x34625a=_[_0x4306('0xb9')]([this[_0x4306('0x1b')][_0x4dff5c['origtransfereruniqueid']],this[_0x4306('0x1b')][_0x4dff5c['origtransfererlinkedid']],this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb5')]]],function(_0x3503db){return _0x3503db&&_0x3503db[_0x4306('0x87')]==='outbound'&&_0x3503db[_0x4306('0xba')];});if(_0x34625a){if(this[_0x4306('0x1b')][_0x4dff5c['origtransfereruniqueid']])this[_0x4306('0x1b')][_0x4dff5c['origtransfereruniqueid']][_0x4306('0xa0')]=_0x4306('0xbb');if(this['channels'][_0x4dff5c[_0x4306('0xb8')]])this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb8')]][_0x4306('0xa0')]=_0x4306('0xbb');this[_0x4306('0x1b')][_0x4dff5c[_0x4306('0xb5')]]['transferType']=_0x4306('0xbb');}}}}catch(_0x1e75d9){logger['error']('[%s][voiceCallReport][attendedtransfer]',_0x4dff5c['uniqueid'],util['inspect'](_0x1e75d9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4306('0x34')][_0x4306('0x2b')]=function(_0x5239ff){try{if(this[_0x4306('0x35')](_0x5239ff)){logger[_0x4306('0x38')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x5239ff['uniqueid'],_0x5239ff['transfereecalleridnum'],_0x5239ff[_0x4306('0xbc')]);logger[_0x4306('0x3d')](_0x4306('0xbd'),_0x5239ff[_0x4306('0x3a')],util['inspect'](_0x5239ff,{'showHidden':![],'depth':null}));if(this[_0x4306('0x1b')][_0x5239ff[_0x4306('0xb2')]]){this['channels'][_0x5239ff['transfereeuniqueid']][_0x4306('0xb3')]=_0x5239ff[_0x4306('0xbe')];this[_0x4306('0x1b')][_0x5239ff[_0x4306('0xb2')]][_0x4306('0xb4')]=_0x5239ff[_0x4306('0xbc')];this[_0x4306('0x1b')][_0x5239ff[_0x4306('0xb2')]][_0x4306('0xa0')]=_0x4306('0xbf');this[_0x4306('0x26')]({'event':_0x4306('0xab'),'uniqueid':_0x5239ff['transfereeuniqueid'],'context':_0x5239ff[_0x4306('0x43')],'channel':_0x5239ff[_0x4306('0xc0')]});}else{this[_0x4306('0x1b')][_0x5239ff[_0x4306('0xc1')]][_0x4306('0xa0')]=_0x4306('0xbf');}}}catch(_0x21e8c1){logger[_0x4306('0x32')]('[%s][voiceCallReport][blindtransfer]',_0x5239ff[_0x4306('0x3a')],util[_0x4306('0x33')](_0x21e8c1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4306('0x2d')]=function(_0x1f0a3b){try{if(this[_0x4306('0x35')](_0x1f0a3b)){logger[_0x4306('0x3d')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x1f0a3b['uniqueid'],util[_0x4306('0x33')](_0x1f0a3b,{'showHidden':![],'depth':null}));if(this[_0x4306('0x1b')][_0x1f0a3b[_0x4306('0x3a')]]){if(!_[_0x4306('0x79')](this[_0x4306('0x1b')][_0x1f0a3b[_0x4306('0x3a')]]['answertime'])){this[_0x4306('0x1b')][_0x1f0a3b[_0x4306('0x3a')]][_0x4306('0xc2')]=moment()[_0x4306('0x4e')](_0x4306('0x4f'));logger['info'](_0x4306('0xc3'),_0x1f0a3b['uniqueid'],this[_0x4306('0x1b')][_0x1f0a3b['uniqueid']][_0x4306('0xc2')]);}}}}catch(_0x5f135f){logger['error'](_0x4306('0xc4'),_0x1f0a3b[_0x4306('0x3a')],util[_0x4306('0x33')](_0x5f135f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4306('0x2f')]=function(_0x171676){try{if(this['isNotNull'](_0x171676)){logger[_0x4306('0x3d')](_0x4306('0xc5'),_0x171676[_0x4306('0x3a')],util['inspect'](_0x171676,{'showHidden':![],'depth':null}));if(this[_0x4306('0x1b')][_0x171676[_0x4306('0x3a')]]){if(!_[_0x4306('0x79')](this[_0x4306('0x1b')][_0x171676[_0x4306('0x3a')]]['mohstarttime'])){this[_0x4306('0x1b')][_0x171676[_0x4306('0x3a')]][_0x4306('0xc6')]+=moment()[_0x4306('0xc7')](0x0)[_0x4306('0x6a')](this['channels'][_0x171676[_0x4306('0x3a')]][_0x4306('0xc2')],'seconds');logger['info']('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x171676[_0x4306('0x3a')],this['channels'][_0x171676['uniqueid']][_0x4306('0xc6')]);delete this[_0x4306('0x1b')][_0x171676[_0x4306('0x3a')]][_0x4306('0xc2')];}}}}catch(_0x385680){logger[_0x4306('0x32')]('[%s][voiceCallReport][musiconholdstop]',_0x171676[_0x4306('0x3a')],util['inspect'](_0x385680,{'showHidden':![],'depth':null}));}};module[_0x4306('0xc8')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 0e90372..735e625 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ae4=['billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','bind','dialend','varset','syncVarSet','syncHangup','prototype','isUndefined','emit','syncDialBegin','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','answertime','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','error','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','endtime','duration','diff','complete','total','holdtime','starttime','sumHoldTime','sumBillable'];(function(_0x5db0d3,_0x464862){var _0x327b6f=function(_0x50f2bb){while(--_0x50f2bb){_0x5db0d3['push'](_0x5db0d3['shift']());}};_0x327b6f(++_0x464862);}(_0x7ae4,0x8e));var _0x47ae=function(_0x5d4528,_0x55709d){_0x5d4528=_0x5d4528-0x0;var _0x528890=_0x7ae4[_0x5d4528];return _0x528890;};'use strict';var _=require('lodash');var moment=require(_0x47ae('0x0'));var util=require(_0x47ae('0x1'));var Redis=require(_0x47ae('0x2'));var config=require(_0x47ae('0x3'));var logger=require(_0x47ae('0x4'))('ami');var ami=require(_0x47ae('0x5'));config[_0x47ae('0x6')]=_[_0x47ae('0x7')](config[_0x47ae('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x47ae('0x8'))(new Redis(config[_0x47ae('0x6')]));function VoiceDialReport(_0x267de3){this[_0x47ae('0x9')]=_0x267de3[_0x47ae('0xa')];this[_0x47ae('0xb')]=_0x267de3[_0x47ae('0xb')];this[_0x47ae('0xc')]={};this[_0x47ae('0xd')]={};ami['on'](_0x47ae('0xe'),this['syncDialBegin'][_0x47ae('0xf')](this));ami['on'](_0x47ae('0x10'),this['syncDialEnd'][_0x47ae('0xf')](this));ami['on'](_0x47ae('0x11'),this[_0x47ae('0x12')][_0x47ae('0xf')](this));ami['on']('newexten',this['syncNewExten'][_0x47ae('0xf')](this));ami['on']('hangup',this[_0x47ae('0x13')][_0x47ae('0xf')](this));}VoiceDialReport[_0x47ae('0x14')]['isNotNull']=function(_0x242501){return _0x242501!==null&&!_[_0x47ae('0x15')](_0x242501);};VoiceDialReport[_0x47ae('0x14')][_0x47ae('0x16')]=function(_0x510ad9,_0x3d9149,_0x5baea0){io['to'](_0x510ad9)[_0x47ae('0x16')](_0x3d9149,_0x5baea0);};VoiceDialReport[_0x47ae('0x14')][_0x47ae('0x17')]=function(_0x176ddb){try{if(this[_0x47ae('0x18')](_0x176ddb)){logger['debug'](_0x47ae('0x19'),_0x176ddb[_0x47ae('0x1a')],util['inspect'](_0x176ddb,{'showHidden':![],'depth':null}));if(this[_0x47ae('0x9')][_0x176ddb[_0x47ae('0x1a')]]){_[_0x47ae('0x1b')](this[_0x47ae('0x9')][_0x176ddb[_0x47ae('0x1a')]],{'starttime':moment()[_0x47ae('0x1c')](_0x47ae('0x1d')),'lastevent':_0x47ae('0x1e'),'interface':_0x176ddb[_0x47ae('0x1f')]['substring'](0x0,_0x176ddb[_0x47ae('0x1f')][_0x47ae('0x20')]('-')),'membername':_0x176ddb['channel'][_0x47ae('0x21')](_0x176ddb['channel'][_0x47ae('0x20')]('/')+0x1,_0x176ddb[_0x47ae('0x1f')]['lastIndexOf']('-'))},_[_0x47ae('0x22')](_0x176ddb,[_0x47ae('0x23'),_0x47ae('0x24')]));logger['info'](_0x47ae('0x25'),_0x176ddb[_0x47ae('0x1a')],this[_0x47ae('0x9')][_0x176ddb['uniqueid']][_0x47ae('0x26')],this[_0x47ae('0x9')][_0x176ddb[_0x47ae('0x1a')]][_0x47ae('0x27')]);logger['debug'](_0x47ae('0x28'),_0x176ddb[_0x47ae('0x1a')],util[_0x47ae('0x29')](this[_0x47ae('0x9')][_0x176ddb[_0x47ae('0x1a')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x176ddb[_0x47ae('0x1a')]])_[_0x47ae('0x1b')](this[_0x47ae('0x9')][_0x176ddb[_0x47ae('0x1a')]],this[_0x47ae('0xc')][_0x176ddb[_0x47ae('0x1a')]]);this[_0x47ae('0x16')](_0x47ae('0x2a'),'voice_outbound_channel:save',this[_0x47ae('0x9')][_0x176ddb[_0x47ae('0x1a')]]);logger[_0x47ae('0x2b')](_0x47ae('0x2c'),_0x176ddb[_0x47ae('0x1a')],util['inspect'](this[_0x47ae('0x9')][_0x176ddb[_0x47ae('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x47ae('0x16')](_0x47ae('0x2d'),this[_0x47ae('0x9')][_0x176ddb[_0x47ae('0x1a')]]);}}}catch(_0xc189f3){logger['error'](_0x47ae('0x2e'),_0x176ddb[_0x47ae('0x1a')],util['inspect'](_0xc189f3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x47ae('0x14')][_0x47ae('0x2f')]=function(_0x1c0b08){try{if(this[_0x47ae('0x18')](_0x1c0b08)){logger[_0x47ae('0x2b')](_0x47ae('0x30'),_0x1c0b08['uniqueid'],util[_0x47ae('0x29')](_0x1c0b08,{'showHidden':![],'depth':null}));if(this['channels'][_0x1c0b08[_0x47ae('0x1a')]]){this[_0x47ae('0x9')][_0x1c0b08[_0x47ae('0x1a')]][_0x47ae('0x31')]=_0x1c0b08[_0x47ae('0x31')];if(_0x1c0b08[_0x47ae('0x31')]===_0x47ae('0x32')){this[_0x47ae('0x9')][_0x1c0b08[_0x47ae('0x1a')]]['connectedlinenum']=_0x1c0b08['connectedlinenum'];this[_0x47ae('0x9')][_0x1c0b08[_0x47ae('0x1a')]]['connectedlinename']=_0x1c0b08['connectedlinename'];this[_0x47ae('0x9')][_0x1c0b08['uniqueid']][_0x47ae('0x33')]=moment()[_0x47ae('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x47ae('0x9')][_0x1c0b08[_0x47ae('0x1a')]][_0x47ae('0x34')]=_0x47ae('0x35');logger[_0x47ae('0x36')](_0x47ae('0x37'),_0x1c0b08[_0x47ae('0x1a')],_0x1c0b08[_0x47ae('0x1f')][_0x47ae('0x21')](_0x1c0b08[_0x47ae('0x1f')][_0x47ae('0x20')]('/')+0x1,_0x1c0b08[_0x47ae('0x1f')][_0x47ae('0x20')]('-')));logger['debug'](_0x47ae('0x38'),_0x1c0b08[_0x47ae('0x1a')],util[_0x47ae('0x29')](this[_0x47ae('0x9')][_0x1c0b08[_0x47ae('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x47ae('0x39'),this[_0x47ae('0x9')][_0x1c0b08['uniqueid']]);}logger['debug'](_0x47ae('0x3a'),_0x1c0b08[_0x47ae('0x1a')],util[_0x47ae('0x29')](this['channels'][_0x1c0b08[_0x47ae('0x1a')]],{'showHidden':![],'depth':null}));this[_0x47ae('0x16')](_0x47ae('0x2a'),_0x47ae('0x3b'),this[_0x47ae('0x9')][_0x1c0b08[_0x47ae('0x1a')]]);}}}catch(_0x6ffd15){logger[_0x47ae('0x3c')]('[%s][voiceDialReport][dialend]',_0x1c0b08['uniqueid'],util['inspect'](_0x6ffd15,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x47ae('0x14')]['syncVarSet']=function(_0x3d1961){try{if(this['isNotNull'](_0x3d1961)){logger['debug'](_0x47ae('0x3d'),_0x3d1961[_0x47ae('0x1a')],util[_0x47ae('0x29')](_0x3d1961,{'showHidden':![],'depth':null}));this[_0x47ae('0x3e')](_0x3d1961[_0x47ae('0x1a')],_[_0x47ae('0x3f')](_0x3d1961[_0x47ae('0x40')])[0x0],_0x3d1961[_0x47ae('0x41')]);if(this[_0x47ae('0x18')](_0x3d1961[_0x47ae('0x40')])&&this[_0x47ae('0x18')](_0x3d1961[_0x47ae('0x40')][_0x47ae('0x42')])){if(_[_0x47ae('0x15')](this[_0x47ae('0x9')][_0x3d1961[_0x47ae('0x1a')]])){this[_0x47ae('0x9')][_0x3d1961[_0x47ae('0x1a')]]={'routeId':_0x3d1961['value'],'variables':this[_0x47ae('0xd')][_0x3d1961['uniqueid']],'motionChannel':_0x47ae('0x43')};logger[_0x47ae('0x36')](_0x47ae('0x44'),_0x3d1961['uniqueid'],_0x3d1961[_0x47ae('0x40')]['outboundrouteid'],_[_0x47ae('0x3f')](_0x3d1961[_0x47ae('0x40')])[0x0],_0x3d1961[_0x47ae('0x41')]);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x3d1961[_0x47ae('0x1a')],util['inspect'](this[_0x47ae('0x9')][_0x3d1961['uniqueid']],{'showHidden':![],'depth':null}));this[_0x47ae('0x16')]('voice:outbound',_0x47ae('0x3b'),this['channels'][_0x3d1961[_0x47ae('0x1a')]]);}}}}catch(_0x35a95b){logger[_0x47ae('0x3c')]('[%s][voiceDialReport][varset]',_0x3d1961['uniqueid'],util[_0x47ae('0x29')](_0x35a95b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x47ae('0x14')][_0x47ae('0x3e')]=function(_0x50be70,_0x378cc7,_0x3a7d2e){var _0xe3fdcb=[_0x47ae('0x45'),_0x47ae('0x46'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x47ae('0x47'),_0x47ae('0x48'),_0x47ae('0x49'),_0x47ae('0x4a'),_0x47ae('0x4b'),_0x47ae('0x4c'),_0x47ae('0x4d'),_0x47ae('0x4e'),_0x47ae('0x4f'),_0x47ae('0x50'),_0x47ae('0x51'),_0x47ae('0x52'),'membername',_0x47ae('0x53'),'memberrealtime'];if(!_[_0x47ae('0x54')](_0x378cc7)&&!_[_0x47ae('0x55')](_0xe3fdcb,_0x378cc7)){if(_['isUndefined'](this[_0x47ae('0xd')][_0x50be70])){this[_0x47ae('0xd')][_0x50be70]={};}this['variables'][_0x50be70][_0x378cc7]=_0x3a7d2e;}};VoiceDialReport[_0x47ae('0x14')][_0x47ae('0x13')]=function(_0x494001){try{if(this[_0x47ae('0x18')](_0x494001)){logger[_0x47ae('0x2b')](_0x47ae('0x56'),_0x494001['uniqueid'],util['inspect'](_0x494001,{'showHidden':![],'depth':null}));if(this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]]){logger[_0x47ae('0x36')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x494001[_0x47ae('0x1a')],_0x494001['cause-txt']);this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]][_0x47ae('0x57')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]][_0x47ae('0x58')]=moment(this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]]['endtime'])[_0x47ae('0x59')](this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]]['starttime'],'seconds');this[_0x47ae('0x9')][_0x494001['uniqueid']][_0x47ae('0x34')]=_0x47ae('0x5a');this[_0x47ae('0xb')][_0x47ae('0x5b')]+=0x1;if(this['channels'][_0x494001[_0x47ae('0x1a')]][_0x47ae('0x33')]){this[_0x47ae('0xb')]['answered']+=0x1;this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]][_0x47ae('0x5c')]=moment(this['channels'][_0x494001[_0x47ae('0x1a')]][_0x47ae('0x33')])[_0x47ae('0x59')](this[_0x47ae('0x9')][_0x494001['uniqueid']][_0x47ae('0x5d')],'seconds');this['channels'][_0x494001[_0x47ae('0x1a')]]['billableseconds']=moment(this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]][_0x47ae('0x57')])[_0x47ae('0x59')](this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]][_0x47ae('0x33')],'seconds');this['outbound'][_0x47ae('0x5e')]+=this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]][_0x47ae('0x5c')]||0x0;this[_0x47ae('0xb')][_0x47ae('0x5f')]+=this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]][_0x47ae('0x60')];}this['outbound'][_0x47ae('0x61')]+=this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]][_0x47ae('0x58')];logger[_0x47ae('0x2b')](_0x47ae('0x62'),_0x494001['uniqueid'],util[_0x47ae('0x29')](this['channels'][_0x494001['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x47ae('0x16')](_0x47ae('0x63'),this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]]);logger[_0x47ae('0x2b')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x494001['uniqueid'],util[_0x47ae('0x29')](this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x47ae('0x16')]('custom:dialend',this['channels'][_0x494001[_0x47ae('0x1a')]]);logger['debug'](_0x47ae('0x64'),_0x494001[_0x47ae('0x1a')],util[_0x47ae('0x29')](this[_0x47ae('0x9')][_0x494001['uniqueid']],{'showHidden':![],'depth':null}));this[_0x47ae('0x16')](_0x47ae('0x2a'),'voice_outbound:save',this['outbound']);logger[_0x47ae('0x36')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this['channels'][_0x494001[_0x47ae('0x1a')]]));logger[_0x47ae('0x2b')](_0x47ae('0x65'),_0x494001[_0x47ae('0x1a')],util['inspect'](this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]],{'showHidden':![],'depth':null}));this[_0x47ae('0x16')]('voice:outbound',_0x47ae('0x66'),this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]]);delete this[_0x47ae('0x9')][_0x494001[_0x47ae('0x1a')]];}else if(this['channels'][_0x494001[_0x47ae('0x67')]]){this[_0x47ae('0x9')][_0x494001['linkedid']][_0x47ae('0x1a')]=this[_0x47ae('0x9')][_0x494001['linkedid']][_0x47ae('0x68')];}if(this[_0x47ae('0xd')][_0x494001[_0x47ae('0x1a')]]){delete this[_0x47ae('0xd')][_0x494001[_0x47ae('0x1a')]];}}}catch(_0x242ae5){logger[_0x47ae('0x3c')](_0x47ae('0x69'),_0x494001[_0x47ae('0x1a')],util['inspect'](_0x242ae5,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x47ae('0x6a')]=function(_0x203a7d){try{if(this[_0x47ae('0x18')](_0x203a7d)){logger[_0x47ae('0x2b')](_0x47ae('0x6b'),_0x203a7d['uniqueid'],util[_0x47ae('0x29')](_0x203a7d,{'showHidden':![],'depth':null}));if(_0x203a7d[_0x47ae('0x6c')][_0x47ae('0x6d')]()===_0x47ae('0x6e')){_0x203a7d[_0x47ae('0x6f')]=(_0x203a7d[_0x47ae('0x70')]||_0x203a7d['applicationdata'])[_0x47ae('0x6d')]();if(_['startsWith'](_0x203a7d[_0x47ae('0x6f')],_0x47ae('0x71'))){if(_[_0x47ae('0x15')](this[_0x47ae('0xc')][_0x203a7d[_0x47ae('0x1a')]]))this[_0x47ae('0xc')][_0x203a7d['uniqueid']]={};logger[_0x47ae('0x36')](_0x47ae('0x72'),_0x203a7d[_0x47ae('0x1a')],_0x203a7d[_0x47ae('0x6c')],_0x203a7d[_0x47ae('0x6f')]);var _0x1ab3ad=_0x203a7d[_0x47ae('0x6f')][_0x47ae('0x73')]('=');var _0x2ce1c0=_0x1ab3ad[0x0][_0x47ae('0x74')](/cdr\((.*)\)/);if(_0x2ce1c0)this['applications'][_0x203a7d['uniqueid']][_0x2ce1c0[0x1]]=_0x1ab3ad[0x1];}}}}catch(_0x361f4e){logger[_0x47ae('0x3c')](_0x47ae('0x75'),_0x203a7d[_0x47ae('0x1a')],util[_0x47ae('0x29')](_0x361f4e,{'showHidden':![],'depth':null}));}};module[_0x47ae('0x76')]=VoiceDialReport; \ No newline at end of file +var _0xcb2c=['includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','diff','starttime','seconds','complete','total','answered','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice:outbound','voice_outbound:save','stringify','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','privilege','info','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','answertime','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil'];(function(_0x51ff4b,_0x158964){var _0x24317c=function(_0x395f70){while(--_0x395f70){_0x51ff4b['push'](_0x51ff4b['shift']());}};_0x24317c(++_0x158964);}(_0xcb2c,0x17a));var _0xccb2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xcb2c[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xccb2('0x0'));var moment=require(_0xccb2('0x1'));var util=require(_0xccb2('0x2'));var Redis=require(_0xccb2('0x3'));var config=require(_0xccb2('0x4'));var logger=require('../../../config/logger')(_0xccb2('0x5'));var ami=require(_0xccb2('0x6'));config[_0xccb2('0x7')]=_[_0xccb2('0x8')](config[_0xccb2('0x7')],{'host':_0xccb2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x3e078d){this[_0xccb2('0xa')]=_0x3e078d[_0xccb2('0xb')];this[_0xccb2('0xc')]=_0x3e078d[_0xccb2('0xc')];this[_0xccb2('0xd')]={};this[_0xccb2('0xe')]={};ami['on'](_0xccb2('0xf'),this[_0xccb2('0x10')][_0xccb2('0x11')](this));ami['on'](_0xccb2('0x12'),this[_0xccb2('0x13')]['bind'](this));ami['on'](_0xccb2('0x14'),this[_0xccb2('0x15')][_0xccb2('0x11')](this));ami['on'](_0xccb2('0x16'),this[_0xccb2('0x17')]['bind'](this));ami['on'](_0xccb2('0x18'),this[_0xccb2('0x19')]['bind'](this));}VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x1b')]=function(_0x35868d){return _0x35868d!==null&&!_[_0xccb2('0x1c')](_0x35868d);};VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x1d')]=function(_0x2b998b,_0x27256c,_0x332da0){io['to'](_0x2b998b)[_0xccb2('0x1d')](_0x27256c,_0x332da0);};VoiceDialReport['prototype'][_0xccb2('0x10')]=function(_0x1a60ea){try{if(this[_0xccb2('0x1b')](_0x1a60ea)){logger['debug'](_0xccb2('0x1e'),_0x1a60ea[_0xccb2('0x1f')],util[_0xccb2('0x20')](_0x1a60ea,{'showHidden':![],'depth':null}));if(this[_0xccb2('0xa')][_0x1a60ea[_0xccb2('0x1f')]]){_[_0xccb2('0x21')](this[_0xccb2('0xa')][_0x1a60ea[_0xccb2('0x1f')]],{'starttime':moment()[_0xccb2('0x22')](_0xccb2('0x23')),'lastevent':_0xccb2('0x24'),'interface':_0x1a60ea[_0xccb2('0x25')]['substring'](0x0,_0x1a60ea[_0xccb2('0x25')][_0xccb2('0x26')]('-')),'membername':_0x1a60ea[_0xccb2('0x25')][_0xccb2('0x27')](_0x1a60ea[_0xccb2('0x25')]['lastIndexOf']('/')+0x1,_0x1a60ea[_0xccb2('0x25')][_0xccb2('0x26')]('-'))},_[_0xccb2('0x28')](_0x1a60ea,['event',_0xccb2('0x29')]));logger[_0xccb2('0x2a')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x1a60ea[_0xccb2('0x1f')],this[_0xccb2('0xa')][_0x1a60ea['uniqueid']][_0xccb2('0x2b')],this[_0xccb2('0xa')][_0x1a60ea[_0xccb2('0x1f')]][_0xccb2('0x2c')]);logger[_0xccb2('0x2d')](_0xccb2('0x2e'),_0x1a60ea[_0xccb2('0x1f')],util[_0xccb2('0x20')](this[_0xccb2('0xa')][_0x1a60ea['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0xccb2('0xd')][_0x1a60ea[_0xccb2('0x1f')]])_['merge'](this['channels'][_0x1a60ea['uniqueid']],this[_0xccb2('0xd')][_0x1a60ea[_0xccb2('0x1f')]]);this[_0xccb2('0x1d')]('voice:outbound',_0xccb2('0x2f'),this[_0xccb2('0xa')][_0x1a60ea['uniqueid']]);logger[_0xccb2('0x2d')](_0xccb2('0x30'),_0x1a60ea['uniqueid'],util['inspect'](this[_0xccb2('0xa')][_0x1a60ea[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));ami[_0xccb2('0x1d')](_0xccb2('0x31'),this['channels'][_0x1a60ea['uniqueid']]);}}}catch(_0x47203b){logger[_0xccb2('0x32')](_0xccb2('0x33'),_0x1a60ea[_0xccb2('0x1f')],util[_0xccb2('0x20')](_0x47203b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x13')]=function(_0x146658){try{if(this[_0xccb2('0x1b')](_0x146658)){logger[_0xccb2('0x2d')](_0xccb2('0x34'),_0x146658[_0xccb2('0x1f')],util['inspect'](_0x146658,{'showHidden':![],'depth':null}));if(this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]]){this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]][_0xccb2('0x35')]=_0x146658[_0xccb2('0x35')];if(_0x146658[_0xccb2('0x35')]===_0xccb2('0x36')){this['channels'][_0x146658[_0xccb2('0x1f')]]['connectedlinenum']=_0x146658[_0xccb2('0x37')];this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]]['connectedlinename']=_0x146658['connectedlinename'];this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]][_0xccb2('0x38')]=moment()[_0xccb2('0x22')](_0xccb2('0x23'));this[_0xccb2('0xa')][_0x146658['uniqueid']][_0xccb2('0x39')]='connect';logger[_0xccb2('0x2a')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x146658[_0xccb2('0x1f')],_0x146658[_0xccb2('0x25')][_0xccb2('0x27')](_0x146658[_0xccb2('0x25')][_0xccb2('0x26')]('/')+0x1,_0x146658[_0xccb2('0x25')][_0xccb2('0x26')]('-')));logger[_0xccb2('0x2d')](_0xccb2('0x3a'),_0x146658[_0xccb2('0x1f')],util[_0xccb2('0x20')](this['channels'][_0x146658[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));ami[_0xccb2('0x1d')]('custom:dialconnect',this[_0xccb2('0xa')][_0x146658['uniqueid']]);}logger[_0xccb2('0x2d')](_0xccb2('0x3b'),_0x146658[_0xccb2('0x1f')],util[_0xccb2('0x20')](this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));this[_0xccb2('0x1d')]('voice:outbound',_0xccb2('0x2f'),this[_0xccb2('0xa')][_0x146658[_0xccb2('0x1f')]]);}}}catch(_0x478407){logger[_0xccb2('0x32')](_0xccb2('0x3c'),_0x146658[_0xccb2('0x1f')],util[_0xccb2('0x20')](_0x478407,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x15')]=function(_0x4244f4){try{if(this[_0xccb2('0x1b')](_0x4244f4)){logger[_0xccb2('0x2d')](_0xccb2('0x3d'),_0x4244f4['uniqueid'],util[_0xccb2('0x20')](_0x4244f4,{'showHidden':![],'depth':null}));this[_0xccb2('0x3e')](_0x4244f4[_0xccb2('0x1f')],_[_0xccb2('0x3f')](_0x4244f4[_0xccb2('0x40')])[0x0],_0x4244f4[_0xccb2('0x41')]);if(this[_0xccb2('0x1b')](_0x4244f4['variable'])&&this[_0xccb2('0x1b')](_0x4244f4[_0xccb2('0x40')][_0xccb2('0x42')])){if(_['isUndefined'](this[_0xccb2('0xa')][_0x4244f4[_0xccb2('0x1f')]])){this[_0xccb2('0xa')][_0x4244f4[_0xccb2('0x1f')]]={'routeId':_0x4244f4[_0xccb2('0x41')],'variables':this[_0xccb2('0xe')][_0x4244f4['uniqueid']],'motionChannel':_0xccb2('0x43')};logger[_0xccb2('0x2a')](_0xccb2('0x44'),_0x4244f4[_0xccb2('0x1f')],_0x4244f4[_0xccb2('0x40')][_0xccb2('0x42')],_[_0xccb2('0x3f')](_0x4244f4[_0xccb2('0x40')])[0x0],_0x4244f4[_0xccb2('0x41')]);logger[_0xccb2('0x2d')](_0xccb2('0x45'),_0x4244f4[_0xccb2('0x1f')],util[_0xccb2('0x20')](this['channels'][_0x4244f4[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));this[_0xccb2('0x1d')]('voice:outbound',_0xccb2('0x2f'),this[_0xccb2('0xa')][_0x4244f4[_0xccb2('0x1f')]]);}}}}catch(_0x2b3a00){logger[_0xccb2('0x32')](_0xccb2('0x46'),_0x4244f4['uniqueid'],util[_0xccb2('0x20')](_0x2b3a00,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x3e')]=function(_0x26f6c5,_0x5a3da2,_0x5a0973){var _0x428c5d=[_0xccb2('0x47'),_0xccb2('0x48'),'rtpaudioqosjitter',_0xccb2('0x49'),_0xccb2('0x4a'),'rtpaudioqoslossbridged',_0xccb2('0x4b'),_0xccb2('0x4c'),_0xccb2('0x4d'),_0xccb2('0x4e'),_0xccb2('0x4f'),_0xccb2('0x50'),'membercalls',_0xccb2('0x51'),'memberinterface',_0xccb2('0x52'),'membername',_0xccb2('0x53'),_0xccb2('0x54')];if(!_[_0xccb2('0x55')](_0x5a3da2)&&!_[_0xccb2('0x56')](_0x428c5d,_0x5a3da2)){if(_[_0xccb2('0x1c')](this['variables'][_0x26f6c5])){this['variables'][_0x26f6c5]={};}this[_0xccb2('0xe')][_0x26f6c5][_0x5a3da2]=_0x5a0973;}};VoiceDialReport[_0xccb2('0x1a')][_0xccb2('0x19')]=function(_0x30de5d){try{if(this['isNotNull'](_0x30de5d)){logger[_0xccb2('0x2d')]('[%s][voiceDialReport][hangup]\x20event:',_0x30de5d['uniqueid'],util[_0xccb2('0x20')](_0x30de5d,{'showHidden':![],'depth':null}));if(this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]){logger[_0xccb2('0x2a')](_0xccb2('0x57'),_0x30de5d[_0xccb2('0x1f')],_0x30de5d['cause-txt']);this['channels'][_0x30de5d['uniqueid']][_0xccb2('0x58')]=moment()[_0xccb2('0x22')](_0xccb2('0x23'));this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]][_0xccb2('0x59')]=moment(this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]][_0xccb2('0x58')])[_0xccb2('0x5a')](this[_0xccb2('0xa')][_0x30de5d['uniqueid']][_0xccb2('0x5b')],_0xccb2('0x5c'));this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]['lastevent']=_0xccb2('0x5d');this[_0xccb2('0xc')][_0xccb2('0x5e')]+=0x1;if(this[_0xccb2('0xa')][_0x30de5d['uniqueid']][_0xccb2('0x38')]){this['outbound'][_0xccb2('0x5f')]+=0x1;this['channels'][_0x30de5d[_0xccb2('0x1f')]]['holdtime']=moment(this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]['answertime'])[_0xccb2('0x5a')](this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]['starttime'],_0xccb2('0x5c'));this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]][_0xccb2('0x60')]=moment(this[_0xccb2('0xa')][_0x30de5d['uniqueid']]['endtime'])['diff'](this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]['answertime'],_0xccb2('0x5c'));this['outbound'][_0xccb2('0x61')]+=this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]]['holdtime']||0x0;this[_0xccb2('0xc')]['sumBillable']+=this[_0xccb2('0xa')][_0x30de5d['uniqueid']][_0xccb2('0x60')];}this[_0xccb2('0xc')][_0xccb2('0x62')]+=this['channels'][_0x30de5d['uniqueid']][_0xccb2('0x59')];logger[_0xccb2('0x2d')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x30de5d['uniqueid'],util[_0xccb2('0x20')](this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));ami[_0xccb2('0x1d')]('custom:voiceDialReport',this['channels'][_0x30de5d[_0xccb2('0x1f')]]);logger[_0xccb2('0x2d')](_0xccb2('0x63'),_0x30de5d['uniqueid'],util[_0xccb2('0x20')](this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));ami[_0xccb2('0x1d')]('custom:dialend',this['channels'][_0x30de5d[_0xccb2('0x1f')]]);logger[_0xccb2('0x2d')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x30de5d[_0xccb2('0x1f')],util['inspect'](this[_0xccb2('0xa')][_0x30de5d['uniqueid']],{'showHidden':![],'depth':null}));this[_0xccb2('0x1d')](_0xccb2('0x64'),_0xccb2('0x65'),this[_0xccb2('0xc')]);logger[_0xccb2('0x2a')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xccb2('0x66')](this['channels'][_0x30de5d[_0xccb2('0x1f')]]));logger[_0xccb2('0x2d')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x30de5d[_0xccb2('0x1f')],util['inspect'](this['channels'][_0x30de5d[_0xccb2('0x1f')]],{'showHidden':![],'depth':null}));this[_0xccb2('0x1d')]('voice:outbound',_0xccb2('0x67'),this[_0xccb2('0xa')][_0x30de5d['uniqueid']]);delete this[_0xccb2('0xa')][_0x30de5d['uniqueid']];}else if(this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x68')]]){this['channels'][_0x30de5d[_0xccb2('0x68')]][_0xccb2('0x1f')]=this[_0xccb2('0xa')][_0x30de5d[_0xccb2('0x68')]]['destuniqueid'];}if(this[_0xccb2('0xe')][_0x30de5d[_0xccb2('0x1f')]]){delete this[_0xccb2('0xe')][_0x30de5d[_0xccb2('0x1f')]];}}}catch(_0x316958){logger['error']('[%s][voiceDialReport][hangup]',_0x30de5d[_0xccb2('0x1f')],util[_0xccb2('0x20')](_0x316958,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x9a5886){try{if(this[_0xccb2('0x1b')](_0x9a5886)){logger[_0xccb2('0x2d')](_0xccb2('0x69'),_0x9a5886[_0xccb2('0x1f')],util['inspect'](_0x9a5886,{'showHidden':![],'depth':null}));if(_0x9a5886['application'][_0xccb2('0x6a')]()===_0xccb2('0x6b')){_0x9a5886[_0xccb2('0x6c')]=(_0x9a5886['appdata']||_0x9a5886[_0xccb2('0x6c')])[_0xccb2('0x6a')]();if(_[_0xccb2('0x6d')](_0x9a5886[_0xccb2('0x6c')],'cdr(')){if(_[_0xccb2('0x1c')](this['applications'][_0x9a5886[_0xccb2('0x1f')]]))this[_0xccb2('0xd')][_0x9a5886['uniqueid']]={};logger[_0xccb2('0x2a')](_0xccb2('0x6e'),_0x9a5886[_0xccb2('0x1f')],_0x9a5886[_0xccb2('0x6f')],_0x9a5886[_0xccb2('0x6c')]);var _0x4f4ef7=_0x9a5886[_0xccb2('0x6c')][_0xccb2('0x70')]('=');var _0x3978d9=_0x4f4ef7[0x0][_0xccb2('0x71')](/cdr\((.*)\)/);if(_0x3978d9)this[_0xccb2('0xd')][_0x9a5886['uniqueid']][_0x3978d9[0x1]]=_0x4f4ef7[0x1];}}}}catch(_0xc0b542){logger[_0xccb2('0x32')](_0xccb2('0x72'),_0x9a5886[_0xccb2('0x1f')],util['inspect'](_0xc0b542,{'showHidden':![],'depth':null}));}};module[_0xccb2('0x73')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 0eb3adc..273abe2 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fcf=['application','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','ioredis','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','newexten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','prototype','switch','sequence','isNil','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','name','voice_queue_presence:save','emitVoiceQueueChannelRemove','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','unmanaged','abandoned','waiting','Trunk','active','callerid','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','isNotNull','isUndefined','loopQueueShow','clearZombieChannels','Action','queues','then','queue','countBy','callers','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','count','routealias','info','pick','keys','push','queuecallerjoin','[%s][voiceQueueReport][queuecallerabandon]','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallerleave','queuecallerexitreason','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','local/','linkedid','queuecallerexitAt','seconds','transferexten','transferuniqueid','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queuecallerabandonAt','queueposition','[%s][voiceQueueReport][varset]','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','includes','diff','length','milliseconds','total','answered','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','transfertype','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','syncHangup','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','toLowerCase','set','applicationdata','CDR(routeAlias)','appdata','startsWith','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x8fcf,0x1db));var _0xf8fc=function(_0x251da9,_0x30adf5){_0x251da9=_0x251da9-0x0;var _0x1b0ed6=_0x8fcf[_0x251da9];return _0x1b0ed6;};'use strict';var _=require(_0xf8fc('0x0'));var moment=require(_0xf8fc('0x1'));var util=require(_0xf8fc('0x2'));var md5=require('md5');var Redis=require(_0xf8fc('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0xf8fc('0x4'));var QueueReport=require(_0xf8fc('0x5'));config[_0xf8fc('0x6')]=_[_0xf8fc('0x7')](config[_0xf8fc('0x6')],{'host':_0xf8fc('0x8'),'port':0x18eb});var io=require(_0xf8fc('0x9'))(new Redis(config[_0xf8fc('0x6')]));var Sequence=function(){};Sequence['prototype'][_0xf8fc('0xa')]=function(_0x5b91e9){this[_0xf8fc('0xb')]=this[_0xf8fc('0xb')]?this[_0xf8fc('0xb')][_0xf8fc('0xc')](_0x5b91e9):_0x5b91e9();};function VoiceQueueReport(_0x284c7e){this['sequence']=new Sequence();this[_0xf8fc('0xd')]={};this[_0xf8fc('0xe')]=_0x284c7e['agents'];this[_0xf8fc('0xf')]=_0x284c7e[_0xf8fc('0x10')];this[_0xf8fc('0x11')]=_0x284c7e[_0xf8fc('0x11')];this[_0xf8fc('0x12')]=!![];this[_0xf8fc('0x13')]=_0x284c7e['campaigns'];this[_0xf8fc('0x14')]={};ami['on'](_0xf8fc('0x15'),this[_0xf8fc('0x16')][_0xf8fc('0x17')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete']['bind'](this));ami['on']('queuecallerjoin',this[_0xf8fc('0x18')][_0xf8fc('0x17')](this));ami['on'](_0xf8fc('0x19'),this[_0xf8fc('0x1a')][_0xf8fc('0x17')](this));ami['on']('queuecallerleave',this[_0xf8fc('0x1b')][_0xf8fc('0x17')](this));ami['on'](_0xf8fc('0x1c'),this[_0xf8fc('0x1d')][_0xf8fc('0x17')](this));ami['on'](_0xf8fc('0x1e'),this[_0xf8fc('0x1f')][_0xf8fc('0x17')](this));ami['on'](_0xf8fc('0x20'),this[_0xf8fc('0x21')][_0xf8fc('0x17')](this));ami['on'](_0xf8fc('0x22'),this['syncHangup'][_0xf8fc('0x17')](this));ami['on'](_0xf8fc('0x23'),this[_0xf8fc('0x24')]['bind'](this));ami['on'](_0xf8fc('0x25'),this['syncNewExten'][_0xf8fc('0x17')](this));ami['on'](_0xf8fc('0x26'),this[_0xf8fc('0x27')]['bind'](this));ami['on'](_0xf8fc('0x28'),this[_0xf8fc('0x29')][_0xf8fc('0x17')](this));ami['on'](_0xf8fc('0x2a'),this[_0xf8fc('0x2b')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xf8fc('0x17')](this));this[_0xf8fc('0x2c')]();this['loopQueueShow']();}function clearChannels(_0x4a91b0){if(!_[_0xf8fc('0x2d')](_0x4a91b0)){for(var _0x38d3b6 in _0x4a91b0){if(_0x4a91b0[_0xf8fc('0x2e')](_0x38d3b6)){delete _0x4a91b0[_0x38d3b6];}}}}function clearCampaigns(_0x419533){if(!_[_0xf8fc('0x2d')](_0x419533)){for(var _0x288a56 in _0x419533){if(_0x419533[_0xf8fc('0x2e')](_0x288a56)){_0x419533[_0x288a56][_0xf8fc('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x2322fa){if(!_[_0xf8fc('0x2d')](_0x2322fa)){for(var _0x47c92c in _0x2322fa){if(_0x2322fa[_0xf8fc('0x2e')](_0x47c92c)){_0x2322fa[_0x47c92c][_0xf8fc('0x2f')]=0x0;_0x2322fa[_0x47c92c][_0xf8fc('0x30')]=0x0;_0x2322fa[_0x47c92c][_0xf8fc('0x31')]=0x0;_0x2322fa[_0x47c92c]['waiting']=0x0;_0x2322fa[_0x47c92c][_0xf8fc('0x32')]=!![];}}}}function clearAgentBooked(_0x551cd3){if(!_[_0xf8fc('0x2d')](_0x551cd3)){for(var _0x6f5e3b in _0x551cd3){if(_0x551cd3['hasOwnProperty'](_0x6f5e3b)){_0x551cd3[_0x6f5e3b][_0xf8fc('0x33')]=!![];}}}}VoiceQueueReport[_0xf8fc('0x34')]['clearZombieChannels']=function(){var _0x3edb6f=this;for(var _0x51918b in this[_0xf8fc('0xf')]){if(this[_0xf8fc('0xf')][_0xf8fc('0x2e')](_0x51918b)&&!this[_0xf8fc('0xf')][_0x51918b][_0xf8fc('0x35')]){this[_0xf8fc('0x36')][_0xf8fc('0xa')](function(){if(!_[_0xf8fc('0x37')](_0x3edb6f['channels'][_0x51918b])){return ami['Action']({'action':_0xf8fc('0x38'),'channel':_0x3edb6f[_0xf8fc('0xf')][_0x51918b][_0xf8fc('0x39')]})[_0xf8fc('0x3a')](function(_0x68f4de){if(_0x68f4de[_0xf8fc('0x3b')]===_0xf8fc('0x3c')){setTimeout(function(){if(_0x3edb6f[_0xf8fc('0xf')][_0x51918b]){delete _0x3edb6f[_0xf8fc('0xf')][_0x51918b];logger[_0xf8fc('0x3d')](_0xf8fc('0x3e'),_0x51918b,util[_0xf8fc('0x3f')](_0x68f4de,{'showHidden':![],'depth':null}));}if(_0x3edb6f[_0xf8fc('0xd')][_0x51918b]){delete _0x3edb6f[_0xf8fc('0xd')][_0x51918b];logger['error'](_0xf8fc('0x40'),_0x51918b,util['inspect'](_0x68f4de,{'showHidden':![],'depth':null}));}if(_0x3edb6f['variables'][_0x51918b]){delete _0x3edb6f[_0xf8fc('0x14')][_0x51918b];logger['error'](_0xf8fc('0x41'),_0x51918b,util['inspect'](_0x68f4de,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xf8fc('0x24')]=function(){logger[_0xf8fc('0x3d')](_0xf8fc('0x42'));clearChannels(this[_0xf8fc('0xf')]);this[_0xf8fc('0x43')](this[_0xf8fc('0xd')]);clearAgentBooked(this[_0xf8fc('0xe')]);clearVoiceQueues(this[_0xf8fc('0x11')]);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype']['clearQueueReport']=function(_0x2ae5b1){var _0x30faf5=this;if(!_[_0xf8fc('0x2d')](_0x2ae5b1)){for(var _0x5afe7e in _0x2ae5b1){if(_0x2ae5b1[_0xf8fc('0x2e')](_0x5afe7e)){_0x30faf5['emitVoiceQueueChannelRemove'](_0x2ae5b1[_0x5afe7e],'clearqueuereport');delete _0x2ae5b1[_0x5afe7e];}}}};VoiceQueueReport[_0xf8fc('0x34')][_0xf8fc('0x44')]=function(_0x265bb5,_0x3ffb7e,_0x1f902c){io['to'](_0x265bb5)[_0xf8fc('0x44')](_0x3ffb7e,_0x1f902c);};VoiceQueueReport[_0xf8fc('0x34')][_0xf8fc('0x45')]=function(_0x2b946f,_0xd057f9){logger['debug'](_0xf8fc('0x46')+_0xd057f9+_0xf8fc('0x47'),_0x2b946f[_0xf8fc('0x48')],util[_0xf8fc('0x3f')](_0x2b946f,{'showHidden':![],'depth':null}));this[_0xf8fc('0x44')](util[_0xf8fc('0x49')](_0xf8fc('0x4a'),_0x2b946f[_0xf8fc('0x4b')]),'voice_queue_channel:save',_0x2b946f);io[_0xf8fc('0x44')](_0xf8fc('0x4c'),_0x2b946f);};VoiceQueueReport[_0xf8fc('0x34')][_0xf8fc('0x4d')]=function(_0x5c1728,_0xc60ea4){logger[_0xf8fc('0x4e')](_0xf8fc('0x46')+_0xc60ea4+_0xf8fc('0x4f'),_0x5c1728['uniqueid'],util['inspect'](_0x5c1728,{'showHidden':![],'depth':null}));this[_0xf8fc('0x44')](util[_0xf8fc('0x49')]('voice:queue:%s',_0x5c1728[_0xf8fc('0x4b')]),_0xf8fc('0x50'),_0x5c1728);io[_0xf8fc('0x44')](_0xf8fc('0x51'),_0x5c1728);};VoiceQueueReport['prototype'][_0xf8fc('0x52')]=function(_0x2be2f2,_0x486c2a){if(_0x2be2f2[_0xf8fc('0x53')]===_0xf8fc('0x54')){var _0x4b1425={'id':_0x2be2f2['id'],'name':_0x2be2f2[_0xf8fc('0x4b')],'strategy':_0x2be2f2[_0xf8fc('0x55')],'answered':_0x2be2f2['answered'],'available':_0x2be2f2[_0xf8fc('0x56')],'loggedIn':_0x2be2f2[_0xf8fc('0x57')],'pTalking':_0x2be2f2['pTalking'],'sumBillable':_0x2be2f2[_0xf8fc('0x58')],'sumDuration':_0x2be2f2[_0xf8fc('0x59')],'sumHoldTime':_0x2be2f2[_0xf8fc('0x5a')]||0x0,'talking':_0x2be2f2[_0xf8fc('0x30')],'total':_0x2be2f2['total'],'type':_0x2be2f2[_0xf8fc('0x53')],'unmanaged':_0x2be2f2[_0xf8fc('0x5b')],'abandoned':_0x2be2f2[_0xf8fc('0x5c')],'waiting':_0x2be2f2[_0xf8fc('0x5d')]};if(_0x2be2f2[_0xf8fc('0x5e')]){_0x4b1425['Trunk']={'id':_0x2be2f2[_0xf8fc('0x5e')]['id'],'name':_0x2be2f2[_0xf8fc('0x5e')][_0xf8fc('0x4b')],'active':_0x2be2f2[_0xf8fc('0x5e')][_0xf8fc('0x5f')],'callerid':_0x2be2f2[_0xf8fc('0x5e')][_0xf8fc('0x60')]};}if(_0x2be2f2['Interval']){_0x4b1425[_0xf8fc('0x61')]={'id':_0x2be2f2[_0xf8fc('0x61')]['id'],'name':_0x2be2f2[_0xf8fc('0x61')][_0xf8fc('0x4b')]};}var _0x370ca4=md5(JSON[_0xf8fc('0x62')](_0x4b1425));if(_0x2be2f2[_0xf8fc('0x63')]!==_0x370ca4){_0x2be2f2[_0xf8fc('0x63')]=_0x370ca4;logger[_0xf8fc('0x4e')](_0xf8fc('0x64')+_0x486c2a+_0xf8fc('0x65'),util[_0xf8fc('0x3f')](_0x4b1425,{'showHidden':![],'depth':null}));this[_0xf8fc('0x44')](util['format'](_0xf8fc('0x4a'),_0x4b1425[_0xf8fc('0x4b')]),'voice_queue:save',_0x4b1425);}}};VoiceQueueReport['prototype'][_0xf8fc('0x66')]=function(_0x45c11a){return _0x45c11a!==null&&!_[_0xf8fc('0x67')](_0x45c11a);};VoiceQueueReport[_0xf8fc('0x34')][_0xf8fc('0x68')]=function(){var _0x3c7e53=this;setInterval(function(){_0x3c7e53[_0xf8fc('0x69')]();ami[_0xf8fc('0x6a')]({'action':_0xf8fc('0x6b')})[_0xf8fc('0x3a')](function(_0xf83dd8){logger[_0xf8fc('0x3d')]('[voiceQueueReport][queues]',util[_0xf8fc('0x3f')](_0xf83dd8,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xf8fc('0x34')][_0xf8fc('0x2c')]=function(){var _0x22bfb6=this;setInterval(function(){if(_0x22bfb6[_0xf8fc('0x12')]){return ami[_0xf8fc('0x6a')]({'action':_0xf8fc('0x15')})[_0xf8fc('0x6c')](function(_0x9a1b67){_0x22bfb6[_0xf8fc('0x12')]=![];})['catch'](function(_0x2c6190){logger['error']('[voiceQueueReport][queuesummary]',util[_0xf8fc('0x3f')](_0x2c6190,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xf8fc('0x16')]=function(_0x130105){try{if(this[_0xf8fc('0x66')](_0x130105)&&this[_0xf8fc('0x66')](_0x130105[_0xf8fc('0x6d')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0xf8fc('0x3f')](_0x130105,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x130105[_0xf8fc('0x6d')]]){logger['info']('[voiceQueueReport][queuesummary]\x20name:%s',_0x130105[_0xf8fc('0x6d')]);var _0x460a4d=_[_0xf8fc('0x6e')](this[_0xf8fc('0xf')],_0xf8fc('0x6d'))[_0x130105['queue']]||0x0;var _0x17c5ec=_0x460a4d-_0x130105[_0xf8fc('0x6f')];if(this[_0xf8fc('0x11')][_0x130105['queue']][_0xf8fc('0x5d')]!==_[_0xf8fc('0x70')](_0x130105[_0xf8fc('0x6f')])||this['voiceQueues'][_0x130105['queue']][_0xf8fc('0x57')]!==_[_0xf8fc('0x70')](_0x130105[_0xf8fc('0x71')])||this['voiceQueues'][_0x130105['queue']][_0xf8fc('0x56')]!==_[_0xf8fc('0x70')](_0x130105[_0xf8fc('0x56')])||this[_0xf8fc('0x11')][_0x130105[_0xf8fc('0x6d')]][_0xf8fc('0x30')]!==_0x17c5ec){this['voiceQueues'][_0x130105['queue']][_0xf8fc('0x5d')]=_[_0xf8fc('0x70')](_0x130105['callers']);this[_0xf8fc('0x11')][_0x130105[_0xf8fc('0x6d')]][_0xf8fc('0x57')]=_['toNumber'](_0x130105[_0xf8fc('0x71')]);this[_0xf8fc('0x11')][_0x130105[_0xf8fc('0x6d')]][_0xf8fc('0x56')]=_['toNumber'](_0x130105['available']);this[_0xf8fc('0x11')][_0x130105['queue']]['talking']=_0x17c5ec>0x0?_0x17c5ec:0x0;this[_0xf8fc('0x11')][_0x130105[_0xf8fc('0x6d')]][_0xf8fc('0x30')]=this[_0xf8fc('0x11')][_0x130105[_0xf8fc('0x6d')]][_0xf8fc('0x30')]>_['toNumber'](_0x130105['loggedin'])?_[_0xf8fc('0x70')](_0x130105['loggedin']):this[_0xf8fc('0x11')][_0x130105[_0xf8fc('0x6d')]][_0xf8fc('0x30')];this[_0xf8fc('0x52')](this[_0xf8fc('0x11')][_0x130105['queue']],_0xf8fc('0x15'));}logger['debug'](_0xf8fc('0x72'),util['inspect'](this[_0xf8fc('0x11')][_0x130105[_0xf8fc('0x6d')]],{'showHidden':![],'depth':null}));ami[_0xf8fc('0x44')](_0xf8fc('0x73'),this['voiceQueues'][_0x130105[_0xf8fc('0x6d')]]);}}}catch(_0x404287){logger[_0xf8fc('0x3d')](_0xf8fc('0x74'),util[_0xf8fc('0x3f')](_0x404287,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x39ae95){logger['debug'](_0xf8fc('0x75'),util[_0xf8fc('0x3f')](_0x39ae95,{'showHidden':![],'depth':null}));this[_0xf8fc('0x12')]=!![];};VoiceQueueReport[_0xf8fc('0x34')][_0xf8fc('0x18')]=function(_0x288bf7){try{if(this[_0xf8fc('0x66')](_0x288bf7)){logger[_0xf8fc('0x4e')](_0xf8fc('0x76'),_0x288bf7[_0xf8fc('0x48')],util[_0xf8fc('0x3f')](_0x288bf7,{'showHidden':![],'depth':null}));if(_[_0xf8fc('0x67')](this[_0xf8fc('0xd')][_0x288bf7[_0xf8fc('0x48')]]))this[_0xf8fc('0xd')][_0x288bf7[_0xf8fc('0x48')]]=[];if(_[_0xf8fc('0x67')](this['channels'][_0x288bf7['uniqueid']]))this[_0xf8fc('0xf')][_0x288bf7[_0xf8fc('0x48')]]={};var _0x2ee506=new QueueReport();_0x2ee506[_0xf8fc('0x4b')]=_0x288bf7[_0xf8fc('0x6d')];_0x2ee506['type']=this[_0xf8fc('0x11')][_0x2ee506[_0xf8fc('0x4b')]]&&this[_0xf8fc('0x11')][_0x2ee506[_0xf8fc('0x4b')]][_0xf8fc('0x53')]?this['voiceQueues'][_0x2ee506['name']]['type']||_0xf8fc('0x54'):_0xf8fc('0x54');_0x2ee506[_0xf8fc('0x6d')]=_0x288bf7[_0xf8fc('0x6d')];_0x2ee506[_0xf8fc('0x77')]=moment()[_0xf8fc('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ee506['position']=_0x288bf7['position'];_0x2ee506['count']=_0x288bf7[_0xf8fc('0x78')];_0x2ee506['uniqueid']=_0x288bf7[_0xf8fc('0x48')];_0x2ee506['routealias']=this[_0xf8fc('0xf')][_0x288bf7[_0xf8fc('0x48')]][_0xf8fc('0x79')];logger[_0xf8fc('0x7a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x2ee506[_0xf8fc('0x4b')],_0x2ee506[_0xf8fc('0x53')]);_['merge'](_0x2ee506,_[_0xf8fc('0x7b')](_0x288bf7,_[_0xf8fc('0x7c')](_0x2ee506)));this[_0xf8fc('0xd')][_0x288bf7[_0xf8fc('0x48')]][_0xf8fc('0x7d')](_0x2ee506);this[_0xf8fc('0xf')][_0x288bf7[_0xf8fc('0x48')]]=_0x2ee506;this['emitVoiceQueueChannelSave'](_0x2ee506,_0xf8fc('0x7e'));}}catch(_0x89b9c8){logger[_0xf8fc('0x3d')](_0xf8fc('0x76'),_0x288bf7[_0xf8fc('0x48')],util[_0xf8fc('0x3f')](_0x89b9c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf8fc('0x34')]['syncQueueCallerAbandon']=function(_0x391439){try{if(this[_0xf8fc('0x66')](_0x391439)){logger[_0xf8fc('0x4e')](_0xf8fc('0x7f'),_0x391439[_0xf8fc('0x48')],util['inspect'](_0x391439,{'showHidden':![],'depth':null}));if(this[_0xf8fc('0xd')][_0x391439['uniqueid']]){var _0x1aeee1=_['last'](this['queueReports'][_0x391439[_0xf8fc('0x48')]]);_0x1aeee1[_0xf8fc('0x80')]=![];_0x1aeee1[_0xf8fc('0x81')]=null;_0x1aeee1[_0xf8fc('0x82')]=_0x391439[_0xf8fc('0x82')];_0x1aeee1[_0xf8fc('0x83')]=_0x391439[_0xf8fc('0x83')];_0x1aeee1[_0xf8fc('0x19')]=!![];_0x1aeee1['queuecallerabandonAt']=moment()['format'](_0xf8fc('0x84'));_0x1aeee1['queuecallerexitreason']=_0xf8fc('0x85');_0x1aeee1[_0xf8fc('0x86')]=null;logger[_0xf8fc('0x7a')](_0xf8fc('0x87'),_0x1aeee1[_0xf8fc('0x4b')],_0x1aeee1[_0xf8fc('0x53')]);this[_0xf8fc('0xf')][_0x391439['uniqueid']]=_0x1aeee1;this[_0xf8fc('0x4d')](_0x1aeee1,_0xf8fc('0x19'));}}}catch(_0x3175d5){logger[_0xf8fc('0x3d')](_0xf8fc('0x7f'),_0x391439[_0xf8fc('0x48')],util['inspect'](_0x3175d5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf8fc('0x34')]['syncQueueCallerLeave']=function(_0xd8c174){try{if(this[_0xf8fc('0x66')](_0xd8c174)){logger[_0xf8fc('0x4e')](_0xf8fc('0x88'),_0xd8c174[_0xf8fc('0x48')],util['inspect'](_0xd8c174,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xd8c174[_0xf8fc('0x48')]]){var _0x3354e7=_[_0xf8fc('0x89')](this[_0xf8fc('0xd')][_0xd8c174['uniqueid']]);_0x3354e7[_0xf8fc('0x8a')]=moment()[_0xf8fc('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x3354e7['connectedlinenum']=_0xd8c174[_0xf8fc('0x8b')];_0x3354e7[_0xf8fc('0x8c')]=_0xd8c174[_0xf8fc('0x8c')];logger[_0xf8fc('0x7a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3354e7[_0xf8fc('0x4b')],_0x3354e7[_0xf8fc('0x53')],_0xd8c174[_0xf8fc('0x8b')],_0xd8c174[_0xf8fc('0x8c')]);this[_0xf8fc('0xf')][_0xd8c174[_0xf8fc('0x48')]]=_0x3354e7;this[_0xf8fc('0x45')](_0x3354e7,_0xf8fc('0x8d'));}}}catch(_0x4b960b){logger[_0xf8fc('0x3d')](_0xf8fc('0x88'),_0xd8c174[_0xf8fc('0x48')],util['inspect'](_0x4b960b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf8fc('0x34')][_0xf8fc('0x1f')]=function(_0x38bb52){try{if(this[_0xf8fc('0x66')](_0x38bb52)){logger[_0xf8fc('0x4e')]('[%s][voiceQueueReport][agentconnect]',_0x38bb52[_0xf8fc('0x48')],util[_0xf8fc('0x3f')](_0x38bb52,{'showHidden':![],'depth':null}));if(this[_0xf8fc('0xd')][_0x38bb52['uniqueid']]){var _0x544ad2=_['last'](this[_0xf8fc('0xd')][_0x38bb52[_0xf8fc('0x48')]]);_0x544ad2['queuecallercomplete']=!![];_0x544ad2[_0xf8fc('0x8e')]='COMPLETEDBYAGENT';logger['info'](_0xf8fc('0x8f'),_0x544ad2[_0xf8fc('0x4b')],_0x544ad2[_0xf8fc('0x53')]);}}}catch(_0x435674){logger[_0xf8fc('0x3d')](_0xf8fc('0x90'),_0x38bb52[_0xf8fc('0x48')],util[_0xf8fc('0x3f')](_0x435674,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf8fc('0x1d')]=function(_0x13c41d){try{if(this['isNotNull'](_0x13c41d)){logger['debug'](_0xf8fc('0x91'),_0x13c41d['uniqueid'],util[_0xf8fc('0x3f')](_0x13c41d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x13c41d[_0xf8fc('0x48')]]){var _0x2f3497=_[_0xf8fc('0x89')](this[_0xf8fc('0xd')][_0x13c41d[_0xf8fc('0x48')]]);_0x2f3497[_0xf8fc('0x19')]=![];_0x2f3497['queuecallerabandonAt']=null;_0x2f3497[_0xf8fc('0x92')]=!![];_0x2f3497[_0xf8fc('0x86')]=_0x13c41d[_0xf8fc('0x93')];_0x2f3497['holdtime']=_0x13c41d[_0xf8fc('0x82')];_0x2f3497[_0xf8fc('0x80')]=!![];_0x2f3497[_0xf8fc('0x94')]=![];_0x2f3497['queuecallerexitAt']=null;if(!_0x2f3497[_0xf8fc('0x95')]){if(_0x13c41d['reason']==_0xf8fc('0x95')){_0x2f3497[_0xf8fc('0x8e')]=_0xf8fc('0x96');logger[_0xf8fc('0x7a')](_0xf8fc('0x97'),_0x2f3497['name'],_0x2f3497[_0xf8fc('0x53')]);}else{if(_['startsWith'](_0x13c41d['channel']['toLowerCase'](),_0xf8fc('0x98'))){if(this[_0xf8fc('0xd')][_0x13c41d[_0xf8fc('0x99')]]){var _0x5d1e00=_['last'](this[_0xf8fc('0xd')][_0x13c41d['linkedid']]);_0x5d1e00[_0xf8fc('0x80')]=![];_0x5d1e00[_0xf8fc('0x94')]=!![];_0x5d1e00[_0xf8fc('0x9a')]=moment(_0x2f3497['queuecallerjoinAt'])['add'](_0x13c41d[_0xf8fc('0x82')],_0xf8fc('0x9b'))[_0xf8fc('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d1e00['queuecallerexitreason']='FORWARDTRANSFER';_0x5d1e00[_0xf8fc('0x95')]=!![];_0x5d1e00['transfertype']='FORWARD';_0x5d1e00[_0xf8fc('0x9c')]=_0x13c41d['destexten'];_0x5d1e00[_0xf8fc('0x9d')]=_0x13c41d[_0xf8fc('0x48')];logger[_0xf8fc('0x7a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x5d1e00[_0xf8fc('0x4b')],_0x5d1e00[_0xf8fc('0x53')]);var _0x5220b0=this[_0xf8fc('0xd')][_0x13c41d[_0xf8fc('0x99')]];this[_0xf8fc('0xd')][_0x13c41d['linkedid']]=this[_0xf8fc('0xd')][_0x13c41d[_0xf8fc('0x48')]];this[_0xf8fc('0xd')][_0x13c41d[_0xf8fc('0x48')]]=_0x5220b0;}}else{_0x2f3497[_0xf8fc('0x8e')]=_0xf8fc('0x9e')+_0x13c41d['reason'][_0xf8fc('0x9f')]();logger[_0xf8fc('0x7a')](_0xf8fc('0xa0'),_0x2f3497[_0xf8fc('0x4b')],_0x2f3497[_0xf8fc('0x53')],_0x2f3497[_0xf8fc('0x8e')]);}}}this[_0xf8fc('0xf')][_0x13c41d[_0xf8fc('0x48')]]=_0x2f3497;this[_0xf8fc('0x4d')](_0x2f3497,_0xf8fc('0x1c'));}}}catch(_0x4c61b6){logger[_0xf8fc('0x3d')](_0xf8fc('0x91'),_0x13c41d[_0xf8fc('0x48')],util[_0xf8fc('0x3f')](_0x4c61b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf8fc('0x34')][_0xf8fc('0x21')]=function(_0x4b14f7){try{if(this[_0xf8fc('0x66')](_0x4b14f7)){logger['debug']('[%s][voiceQueueReport][varset]',_0x4b14f7[_0xf8fc('0x48')],util['inspect'](_0x4b14f7,{'showHidden':![],'depth':null}));this[_0xf8fc('0xa1')](_0x4b14f7[_0xf8fc('0x48')],_['keys'](_0x4b14f7[_0xf8fc('0xa2')])[0x0],_0x4b14f7[_0xf8fc('0xa3')]);if(this['queueReports'][_0x4b14f7[_0xf8fc('0x48')]]){var _0xee3fea=_[_0xf8fc('0x89')](this[_0xf8fc('0xd')][_0x4b14f7[_0xf8fc('0x48')]]);if(_0xee3fea){if(this[_0xf8fc('0x66')](_0x4b14f7['variable'])&&this[_0xf8fc('0x66')](_0x4b14f7['variable'][_0xf8fc('0xa4')])){switch(_0x4b14f7['value']){case _0xf8fc('0xa5'):_0xee3fea['queuecallerexit']=![];_0xee3fea[_0xf8fc('0x9a')]=null;break;case _0xf8fc('0xa6'):_0xee3fea[_0xf8fc('0xa7')]=_0xf8fc('0xa8');_0xee3fea[_0xf8fc('0x94')]=!![];_0xee3fea[_0xf8fc('0x9a')]=moment()[_0xf8fc('0x49')](_0xf8fc('0x84'));_0xee3fea[_0xf8fc('0x8a')]=moment()[_0xf8fc('0x49')](_0xf8fc('0x84'));logger[_0xf8fc('0x4e')](_0xf8fc('0xa9'),_0x4b14f7[_0xf8fc('0x48')],util[_0xf8fc('0x3f')](_0xee3fea,{'showHidden':![],'depth':null}));ami[_0xf8fc('0x44')]('custom:timeout',_0xee3fea);break;default:_0xee3fea[_0xf8fc('0x94')]=!![];_0xee3fea['queuecallerexitAt']=moment()[_0xf8fc('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0xee3fea[_0xf8fc('0x8a')]=moment()[_0xf8fc('0x49')](_0xf8fc('0x84'));}_0xee3fea[_0xf8fc('0x19')]=![];_0xee3fea[_0xf8fc('0xaa')]=null;_0xee3fea['queuecallerexitreason']=_0x4b14f7[_0xf8fc('0xa3')];this[_0xf8fc('0xf')][_0x4b14f7['uniqueid']]=_0xee3fea;this[_0xf8fc('0x4d')](_0xee3fea,_0xf8fc('0x20'));}else if(this['isNotNull'](_0x4b14f7['variable'])&&this['isNotNull'](_0x4b14f7['variable'][_0xf8fc('0xab')])){if(!_0xee3fea['queuecallerabandon']){_0xee3fea['queuecallerexit']=!![];_0xee3fea[_0xf8fc('0x9a')]=moment()[_0xf8fc('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0xee3fea[_0xf8fc('0x8e')]='EXITWITHKEY';_0xee3fea[_0xf8fc('0x8a')]=moment()['format'](_0xf8fc('0x84'));this[_0xf8fc('0xf')][_0x4b14f7[_0xf8fc('0x48')]]=_0xee3fea;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x4b14f7[_0xf8fc('0x48')],_0xee3fea['name'],_0xee3fea[_0xf8fc('0x53')],_['keys'](_0x4b14f7[_0xf8fc('0xa2')])[0x0],_0x4b14f7[_0xf8fc('0xa3')]);_0xee3fea[_0xf8fc('0x14')]=this[_0xf8fc('0x14')][_0x4b14f7[_0xf8fc('0x48')]];}}}}catch(_0x31113b){logger[_0xf8fc('0x3d')](_0xf8fc('0xac'),_0x4b14f7[_0xf8fc('0x48')],util['inspect'](_0x31113b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf8fc('0x34')][_0xf8fc('0xa1')]=function(_0x5c3cd2,_0x4c39d2,_0x24d020){var _0x5769e1=['rtpaudioqos','rtpaudioqosbridged',_0xf8fc('0xad'),'rtpaudioqosjitterbridged',_0xf8fc('0xae'),_0xf8fc('0xaf'),_0xf8fc('0xb0'),_0xf8fc('0xb1'),_0xf8fc('0xb2'),_0xf8fc('0xb3'),_0xf8fc('0xb4'),'bridgepvtcallid',_0xf8fc('0xb5'),_0xf8fc('0xb6'),'memberinterface',_0xf8fc('0xb7'),_0xf8fc('0x93'),_0xf8fc('0xb8'),_0xf8fc('0xb9')];if(!_['isNil'](_0x4c39d2)&&!_[_0xf8fc('0xba')](_0x5769e1,_0x4c39d2)){if(_[_0xf8fc('0x67')](this[_0xf8fc('0x14')][_0x5c3cd2])){this[_0xf8fc('0x14')][_0x5c3cd2]={};}this[_0xf8fc('0x14')][_0x5c3cd2][_0x4c39d2]=_0x24d020;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x2ea82b){try{if(this[_0xf8fc('0x66')](_0x2ea82b)){logger['debug']('[%s][voiceQueueReport][hangup]',_0x2ea82b[_0xf8fc('0x48')],util[_0xf8fc('0x3f')](_0x2ea82b,{'showHidden':![],'depth':null}));if(this[_0xf8fc('0xd')][_0x2ea82b[_0xf8fc('0x48')]]){for(var _0x5bcaf9=0x0,_0x30c99a={};_0x5bcaf90x0?_0x3b5588:0x0;this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]][_0xaffa('0x36')]=this[_0xaffa('0x12')][_0x1822e8['queue']]['talking']>_[_0xaffa('0x6e')](_0x1822e8[_0xaffa('0x70')])?_[_0xaffa('0x6e')](_0x1822e8['loggedin']):this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]][_0xaffa('0x36')];this[_0xaffa('0x72')](this['voiceQueues'][_0x1822e8[_0xaffa('0x6a')]],_0xaffa('0x66'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xaffa('0x44')](this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]],{'showHidden':![],'depth':null}));ami[_0xaffa('0x48')](_0xaffa('0x73'),this[_0xaffa('0x12')][_0x1822e8[_0xaffa('0x6a')]]);}}}catch(_0x245b28){logger[_0xaffa('0x42')]('[voiceQueueReport][queuesummary]',util[_0xaffa('0x44')](_0x245b28,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x18')]=function(_0x5a028a){logger['debug'](_0xaffa('0x74'),util[_0xaffa('0x44')](_0x5a028a,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x1b')]=function(_0x46f44d){try{if(this[_0xaffa('0x69')](_0x46f44d)){logger[_0xaffa('0x4f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x46f44d[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x46f44d,{'showHidden':![],'depth':null}));if(_[_0xaffa('0x75')](this['queueReports'][_0x46f44d['uniqueid']]))this[_0xaffa('0x10')][_0x46f44d['uniqueid']]=[];if(_['isUndefined'](this[_0xaffa('0x3a')][_0x46f44d[_0xaffa('0x4c')]]))this[_0xaffa('0x3a')][_0x46f44d[_0xaffa('0x4c')]]={};var _0x135b41=new QueueReport();_0x135b41[_0xaffa('0x52')]=_0x46f44d[_0xaffa('0x6a')];_0x135b41[_0xaffa('0x55')]=this['voiceQueues'][_0x135b41[_0xaffa('0x52')]]&&this[_0xaffa('0x12')][_0x135b41[_0xaffa('0x52')]]['type']?this[_0xaffa('0x12')][_0x135b41['name']][_0xaffa('0x55')]||_0xaffa('0x56'):_0xaffa('0x56');_0x135b41[_0xaffa('0x6a')]=_0x46f44d[_0xaffa('0x6a')];_0x135b41[_0xaffa('0x76')]=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x135b41[_0xaffa('0x78')]=_0x46f44d['position'];_0x135b41['count']=_0x46f44d[_0xaffa('0x79')];_0x135b41[_0xaffa('0x4c')]=_0x46f44d[_0xaffa('0x4c')];_0x135b41[_0xaffa('0x7a')]=this[_0xaffa('0x3a')][_0x46f44d[_0xaffa('0x4c')]]['routealias'];logger[_0xaffa('0x6c')](_0xaffa('0x7b'),_0x135b41[_0xaffa('0x52')],_0x135b41[_0xaffa('0x55')]);_[_0xaffa('0x7c')](_0x135b41,_[_0xaffa('0x7d')](_0x46f44d,_[_0xaffa('0x7e')](_0x135b41)));this[_0xaffa('0x10')][_0x46f44d[_0xaffa('0x4c')]]['push'](_0x135b41);this[_0xaffa('0x3a')][_0x46f44d[_0xaffa('0x4c')]]=_0x135b41;this[_0xaffa('0x49')](_0x135b41,'queuecallerjoin');}}catch(_0x3ea954){logger['error'](_0xaffa('0x7f'),_0x46f44d[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x3ea954,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x1c3075){try{if(this[_0xaffa('0x69')](_0x1c3075)){logger[_0xaffa('0x4f')](_0xaffa('0x80'),_0x1c3075[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x1c3075,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x10')][_0x1c3075['uniqueid']]){var _0x576832=_[_0xaffa('0x81')](this[_0xaffa('0x10')][_0x1c3075[_0xaffa('0x4c')]]);_0x576832[_0xaffa('0x82')]=![];_0x576832[_0xaffa('0x83')]=null;_0x576832[_0xaffa('0x84')]=_0x1c3075[_0xaffa('0x84')];_0x576832[_0xaffa('0x85')]=_0x1c3075[_0xaffa('0x85')];_0x576832[_0xaffa('0x1c')]=!![];_0x576832[_0xaffa('0x86')]=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x576832[_0xaffa('0x87')]=_0xaffa('0x88');_0x576832['lastAssignedTo']=null;logger[_0xaffa('0x6c')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x576832[_0xaffa('0x52')],_0x576832[_0xaffa('0x55')]);this[_0xaffa('0x3a')][_0x1c3075['uniqueid']]=_0x576832;this[_0xaffa('0x46')](_0x576832,_0xaffa('0x1c'));}}}catch(_0x26ed78){logger[_0xaffa('0x42')](_0xaffa('0x80'),_0x1c3075[_0xaffa('0x4c')],util['inspect'](_0x26ed78,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x1f')]=function(_0x41b7f4){try{if(this['isNotNull'](_0x41b7f4)){logger[_0xaffa('0x4f')]('[%s][voiceQueueReport][queuecallerleave]',_0x41b7f4[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x41b7f4,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x10')][_0x41b7f4[_0xaffa('0x4c')]]){var _0x1934a9=_[_0xaffa('0x81')](this[_0xaffa('0x10')][_0x41b7f4[_0xaffa('0x4c')]]);_0x1934a9[_0xaffa('0x89')]=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x1934a9[_0xaffa('0x8a')]=_0x41b7f4[_0xaffa('0x8a')];_0x1934a9[_0xaffa('0x8b')]=_0x41b7f4[_0xaffa('0x8b')];logger[_0xaffa('0x6c')](_0xaffa('0x8c'),_0x1934a9[_0xaffa('0x52')],_0x1934a9[_0xaffa('0x55')],_0x41b7f4[_0xaffa('0x8a')],_0x41b7f4[_0xaffa('0x8b')]);this[_0xaffa('0x3a')][_0x41b7f4[_0xaffa('0x4c')]]=_0x1934a9;this[_0xaffa('0x49')](_0x1934a9,'queuecallerleave');}}}catch(_0x426826){logger[_0xaffa('0x42')](_0xaffa('0x8d'),_0x41b7f4[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x426826,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x22')]=function(_0x2d401d){try{if(this['isNotNull'](_0x2d401d)){logger[_0xaffa('0x4f')](_0xaffa('0x8e'),_0x2d401d[_0xaffa('0x4c')],util['inspect'](_0x2d401d,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x10')][_0x2d401d[_0xaffa('0x4c')]]){var _0xd98922=_[_0xaffa('0x81')](this[_0xaffa('0x10')][_0x2d401d[_0xaffa('0x4c')]]);_0xd98922['queuecallercomplete']=!![];_0xd98922[_0xaffa('0x87')]=_0xaffa('0x8f');logger[_0xaffa('0x6c')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0xd98922[_0xaffa('0x52')],_0xd98922['type']);}}}catch(_0x330a4b){logger[_0xaffa('0x42')](_0xaffa('0x8e'),_0x2d401d[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x330a4b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')]['syncAgentComplete']=function(_0xc63f0e){try{if(this[_0xaffa('0x69')](_0xc63f0e)){logger[_0xaffa('0x4f')](_0xaffa('0x90'),_0xc63f0e[_0xaffa('0x4c')],util['inspect'](_0xc63f0e,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x4c')]]){var _0x2d9db3=_[_0xaffa('0x81')](this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x4c')]]);_0x2d9db3[_0xaffa('0x1c')]=![];_0x2d9db3['queuecallerabandonAt']=null;_0x2d9db3['assigned']=!![];_0x2d9db3[_0xaffa('0x91')]=_0xc63f0e[_0xaffa('0x92')];_0x2d9db3[_0xaffa('0x84')]=_0xc63f0e[_0xaffa('0x84')];_0x2d9db3[_0xaffa('0x82')]=!![];_0x2d9db3[_0xaffa('0x93')]=![];_0x2d9db3[_0xaffa('0x94')]=null;if(!_0x2d9db3['transfer']){if(_0xc63f0e[_0xaffa('0x95')]==_0xaffa('0x96')){_0x2d9db3[_0xaffa('0x87')]=_0xaffa('0x97');logger[_0xaffa('0x6c')](_0xaffa('0x98'),_0x2d9db3['name'],_0x2d9db3['type']);}else{if(_[_0xaffa('0x99')](_0xc63f0e[_0xaffa('0x9a')][_0xaffa('0x9b')](),'local/')){if(this['queueReports'][_0xc63f0e[_0xaffa('0x9c')]]){var _0x523c73=_[_0xaffa('0x81')](this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x9c')]]);_0x523c73[_0xaffa('0x82')]=![];_0x523c73[_0xaffa('0x93')]=!![];_0x523c73[_0xaffa('0x94')]=moment(_0x2d9db3[_0xaffa('0x76')])[_0xaffa('0x9d')](_0xc63f0e[_0xaffa('0x84')],_0xaffa('0x9e'))[_0xaffa('0x51')](_0xaffa('0x77'));_0x523c73[_0xaffa('0x87')]=_0xaffa('0x9f');_0x523c73['transfer']=!![];_0x523c73['transfertype']=_0xaffa('0xa0');_0x523c73['transferexten']=_0xc63f0e[_0xaffa('0xa1')];_0x523c73[_0xaffa('0xa2')]=_0xc63f0e[_0xaffa('0x4c')];logger[_0xaffa('0x6c')](_0xaffa('0xa3'),_0x523c73['name'],_0x523c73[_0xaffa('0x55')]);var _0x480dd0=this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x9c')]];this['queueReports'][_0xc63f0e[_0xaffa('0x9c')]]=this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x4c')]];this[_0xaffa('0x10')][_0xc63f0e[_0xaffa('0x4c')]]=_0x480dd0;}}else{_0x2d9db3[_0xaffa('0x87')]=_0xaffa('0xa4')+_0xc63f0e['reason'][_0xaffa('0xa5')]();logger[_0xaffa('0x6c')](_0xaffa('0xa6'),_0x2d9db3['name'],_0x2d9db3[_0xaffa('0x55')],_0x2d9db3[_0xaffa('0x87')]);}}}this[_0xaffa('0x3a')][_0xc63f0e['uniqueid']]=_0x2d9db3;this[_0xaffa('0x46')](_0x2d9db3,_0xaffa('0x20'));}}}catch(_0x15862d){logger['error'](_0xaffa('0x90'),_0xc63f0e[_0xaffa('0x4c')],util['inspect'](_0x15862d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x24')]=function(_0xb2b241){try{if(this[_0xaffa('0x69')](_0xb2b241)){logger[_0xaffa('0x4f')]('[%s][voiceQueueReport][varset]',_0xb2b241[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0xb2b241,{'showHidden':![],'depth':null}));this[_0xaffa('0xa7')](_0xb2b241[_0xaffa('0x4c')],_[_0xaffa('0x7e')](_0xb2b241[_0xaffa('0xa8')])[0x0],_0xb2b241[_0xaffa('0xa9')]);if(this['queueReports'][_0xb2b241[_0xaffa('0x4c')]]){var _0x454ffb=_['last'](this[_0xaffa('0x10')][_0xb2b241[_0xaffa('0x4c')]]);if(_0x454ffb){if(this['isNotNull'](_0xb2b241[_0xaffa('0xa8')])&&this[_0xaffa('0x69')](_0xb2b241[_0xaffa('0xa8')]['queuestatus'])){switch(_0xb2b241[_0xaffa('0xa9')]){case _0xaffa('0xaa'):_0x454ffb[_0xaffa('0x93')]=![];_0x454ffb[_0xaffa('0x94')]=null;break;case'TIMEOUT':_0x454ffb[_0xaffa('0xab')]=_0xaffa('0xac');_0x454ffb[_0xaffa('0x93')]=!![];_0x454ffb['queuecallerexitAt']=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x454ffb['queuecallerleaveAt']=moment()[_0xaffa('0x51')](_0xaffa('0x77'));logger[_0xaffa('0x4f')](_0xaffa('0xad'),_0xb2b241['uniqueid'],util[_0xaffa('0x44')](_0x454ffb,{'showHidden':![],'depth':null}));ami[_0xaffa('0x48')]('custom:timeout',_0x454ffb);break;default:_0x454ffb[_0xaffa('0x93')]=!![];_0x454ffb[_0xaffa('0x94')]=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x454ffb[_0xaffa('0x89')]=moment()['format'](_0xaffa('0x77'));}_0x454ffb[_0xaffa('0x1c')]=![];_0x454ffb['queuecallerabandonAt']=null;_0x454ffb[_0xaffa('0x87')]=_0xb2b241[_0xaffa('0xa9')];this[_0xaffa('0x3a')][_0xb2b241[_0xaffa('0x4c')]]=_0x454ffb;this['emitVoiceQueueChannelRemove'](_0x454ffb,_0xaffa('0x23'));}else if(this[_0xaffa('0x69')](_0xb2b241['variable'])&&this[_0xaffa('0x69')](_0xb2b241['variable'][_0xaffa('0xae')])){if(!_0x454ffb['queuecallerabandon']){_0x454ffb[_0xaffa('0x93')]=!![];_0x454ffb[_0xaffa('0x94')]=moment()[_0xaffa('0x51')](_0xaffa('0x77'));_0x454ffb['queuecallerexitreason']='EXITWITHKEY';_0x454ffb[_0xaffa('0x89')]=moment()['format'](_0xaffa('0x77'));this[_0xaffa('0x3a')][_0xb2b241[_0xaffa('0x4c')]]=_0x454ffb;}}logger[_0xaffa('0x6c')](_0xaffa('0xaf'),_0xb2b241[_0xaffa('0x4c')],_0x454ffb['name'],_0x454ffb[_0xaffa('0x55')],_[_0xaffa('0x7e')](_0xb2b241['variable'])[0x0],_0xb2b241[_0xaffa('0xa9')]);_0x454ffb['variables']=this[_0xaffa('0x15')][_0xb2b241[_0xaffa('0x4c')]];}}}}catch(_0x247c4d){logger['error'](_0xaffa('0xb0'),_0xb2b241['uniqueid'],util[_0xaffa('0x44')](_0x247c4d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0xa7')]=function(_0x1c6bff,_0x5f512d,_0x2575a4){var _0x37beca=[_0xaffa('0xb1'),_0xaffa('0xb2'),_0xaffa('0xb3'),'rtpaudioqosjitterbridged',_0xaffa('0xb4'),_0xaffa('0xb5'),_0xaffa('0xb6'),'rtpaudioqosrttbridged',_0xaffa('0xb7'),_0xaffa('0xb8'),_0xaffa('0xb9'),_0xaffa('0xba'),_0xaffa('0xbb'),'memberdynamic',_0xaffa('0xbc'),_0xaffa('0xbd'),_0xaffa('0x92'),_0xaffa('0xbe'),'memberrealtime'];if(!_['isNil'](_0x5f512d)&&!_[_0xaffa('0xbf')](_0x37beca,_0x5f512d)){if(_[_0xaffa('0x75')](this[_0xaffa('0x15')][_0x1c6bff])){this['variables'][_0x1c6bff]={};}this[_0xaffa('0x15')][_0x1c6bff][_0x5f512d]=_0x2575a4;}};VoiceQueueReport[_0xaffa('0xc')][_0xaffa('0x26')]=function(_0x60d24){try{if(this[_0xaffa('0x69')](_0x60d24)){logger[_0xaffa('0x4f')](_0xaffa('0xc0'),_0x60d24[_0xaffa('0x4c')],util[_0xaffa('0x44')](_0x60d24,{'showHidden':![],'depth':null}));if(this[_0xaffa('0x10')][_0x60d24[_0xaffa('0x4c')]]){for(var _0xe95914=0x0,_0x489552={};_0xe95914=0x0?moment(_0x531ba8[_0xe646('0x1c')])['diff'](_0x531ba8[_0xe646('0x1b')],_0xe646('0x1d')):null,'data1':'outbound','data2':_0x531ba8[_0xe646('0x17')],'data3':_0x531ba8['exten'],'data4':_0x531ba8[_0xe646('0x1e')]||null,'role':_0xe646('0x15'),'internal':_0x531ba8['accountcode']?_[_0xe646('0x16')](_0x531ba8[_0xe646('0x17')]):undefined,'uniqueid':_0x531ba8[_0xe646('0x18')]},'log':_0xe646('0x7')});}; \ No newline at end of file +var _0x030c=['calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','Request','voice','membername','interface','starttime','endtime','diff','outbound','moment','lodash','../client','voiceQueueReport','queuecallerexitAt','isNil','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','seconds','inbound'];(function(_0x58d3a4,_0x35111e){var _0x390b95=function(_0x533cb2){while(--_0x533cb2){_0x58d3a4['push'](_0x58d3a4['shift']());}};_0x390b95(++_0x35111e);}(_0x030c,0xdb));var _0xc030=function(_0x556945,_0x1cdc40){_0x556945=_0x556945-0x0;var _0x4ebc73=_0x030c[_0x556945];return _0x4ebc73;};'use strict';var moment=require(_0xc030('0x0'));var _=require(_0xc030('0x1'));var util=require('util');var client=require(_0xc030('0x2'));exports[_0xc030('0x3')]=function(_0x3c4596){var _0x40c665=_0x3c4596['queuecallercompleteAt']||_0x3c4596[_0xc030('0x4')];return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0x3c4596['lastAssignedTo'],'interface':_[_0xc030('0x5')](_0x3c4596['interface'])?util[_0xc030('0x6')](_0xc030('0x7'),_0x3c4596[_0xc030('0x8')]):_0x3c4596['interface'],'type':_0xc030('0x9'),'enterAt':_0x3c4596[_0xc030('0xa')],'exitAt':_0x40c665,'duration':moment(_0x40c665)['diff'](_0x3c4596[_0xc030('0xa')],_0xc030('0xb')),'data1':_0xc030('0xc'),'data2':_0x3c4596[_0xc030('0xd')],'data3':_0x3c4596[_0xc030('0xe')],'data4':null,'data5':_0x3c4596[_0xc030('0xf')],'role':_0xc030('0x10'),'internal':_0x3c4596[_0xc030('0x11')]?_[_0xc030('0x12')](_0x3c4596[_0xc030('0x11')]):undefined,'uniqueid':_0x3c4596[_0xc030('0x13')]},'log':_0xc030('0x14')});};exports['voiceDialReport']=function(_0x187e3c){return client[_0xc030('0x15')](_0xc030('0x14'),{'body':{'channel':_0xc030('0x16'),'membername':_0x187e3c[_0xc030('0x17')],'interface':_0x187e3c[_0xc030('0x18')],'type':_0xc030('0x9'),'enterAt':_0x187e3c[_0xc030('0x19')],'exitAt':_0x187e3c[_0xc030('0x1a')],'duration':moment(_0x187e3c[_0xc030('0x1a')])[_0xc030('0x1b')](_0x187e3c['starttime'],'seconds')>=0x0?moment(_0x187e3c[_0xc030('0x1a')])[_0xc030('0x1b')](_0x187e3c['starttime'],_0xc030('0xb')):null,'data1':_0xc030('0x1c'),'data2':_0x187e3c[_0xc030('0x11')],'data3':_0x187e3c[_0xc030('0xe')],'data4':_0x187e3c['dialstring']||null,'role':_0xc030('0x10'),'internal':_0x187e3c[_0xc030('0x11')]?_[_0xc030('0x12')](_0x187e3c[_0xc030('0x11')]):undefined,'uniqueid':_0x187e3c[_0xc030('0x13')]},'log':_0xc030('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4a4773b..1254e28 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 _0xfbb2=['getSettings','Request','ShowSetting','GetSettings','../client'];(function(_0xa1f296,_0x328194){var _0x405dae=function(_0x2856e1){while(--_0x2856e1){_0xa1f296['push'](_0xa1f296['shift']());}};_0x405dae(++_0x328194);}(_0xfbb2,0xae));var _0x2fbb=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0xfbb2[_0x3ec333];return _0x15ccb8;};'use strict';var client=require(_0x2fbb('0x0'));exports[_0x2fbb('0x1')]=function(){return client[_0x2fbb('0x2')](_0x2fbb('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x2fbb('0x4')});}; \ No newline at end of file +var _0xa477=['../client','getSettings','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x5c5502,_0x47cf47){var _0x359546=function(_0x5b0561){while(--_0x5b0561){_0x5c5502['push'](_0x5c5502['shift']());}};_0x359546(++_0x47cf47);}(_0xa477,0xe6));var _0x7a47=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xa477[_0x3e5086];return _0xfeb102;};'use strict';var client=require(_0x7a47('0x0'));exports[_0x7a47('0x1')]=function(){return client['Request'](_0x7a47('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7a47('0x3')]},'log':_0x7a47('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0eea344..cd61df0 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 _0x7177=['GetTemplate','name','html','../client','getTemplates'];(function(_0x4512bc,_0x1bc22e){var _0x5a60cf=function(_0x3468ad){while(--_0x3468ad){_0x4512bc['push'](_0x4512bc['shift']());}};_0x5a60cf(++_0x1bc22e);}(_0x7177,0x76));var _0x7717=function(_0x517869,_0x1f383b){_0x517869=_0x517869-0x0;var _0x2e6dd7=_0x7177[_0x517869];return _0x2e6dd7;};'use strict';var client=require(_0x7717('0x0'));exports[_0x7717('0x1')]=function(_0x187922){return function(_0x5c53bc){return client['Request'](_0x7717('0x2'),{'options':{'raw':!![],'attributes':['id',_0x7717('0x3'),_0x7717('0x4')]},'log':_0x7717('0x2')});};}; \ No newline at end of file +var _0x5b97=['Request','GetTemplate'];(function(_0x596dd3,_0x491fc8){var _0x69e45e=function(_0x3a2e67){while(--_0x3a2e67){_0x596dd3['push'](_0x596dd3['shift']());}};_0x69e45e(++_0x491fc8);}(_0x5b97,0xac));var _0x75b9=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x5b97[_0x36c6eb];return _0x30675b;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x1f4ea4){return function(_0x6b1a0){return client[_0x75b9('0x0')](_0x75b9('0x1'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0x75b9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index d5a6a91..f45ccf4 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 _0x8aae=['name','channel','AllConditions','field','operator','AnyConditions','value','Action','Actions','data1','data2','data3','data4','data5','data7','getTriggers','Request','GetTrigger'];(function(_0x228328,_0x3dc843){var _0x57af57=function(_0x971e78){while(--_0x971e78){_0x228328['push'](_0x228328['shift']());}};_0x57af57(++_0x3dc843);}(_0x8aae,0x9f));var _0xe8aa=function(_0x2c494e,_0x1f979d){_0x2c494e=_0x2c494e-0x0;var _0x5acc0d=_0x8aae[_0x2c494e];return _0x5acc0d;};'use strict';var client=require('../client');exports[_0xe8aa('0x0')]=function(_0x57233f){return function(_0x3335c6){return client[_0xe8aa('0x1')](_0xe8aa('0x2'),{'options':{'raw':![],'attributes':['id',_0xe8aa('0x3'),_0xe8aa('0x4'),'status'],'include':[{'model':'Condition','as':_0xe8aa('0x5'),'attributes':['id',_0xe8aa('0x6'),_0xe8aa('0x7'),'value']},{'model':'Condition','as':_0xe8aa('0x8'),'attributes':['id',_0xe8aa('0x6'),'operator',_0xe8aa('0x9')]},{'model':_0xe8aa('0xa'),'as':_0xe8aa('0xb'),'attributes':['id','action',_0xe8aa('0xc'),_0xe8aa('0xd'),_0xe8aa('0xe'),_0xe8aa('0xf'),_0xe8aa('0x10'),'data6',_0xe8aa('0x11')]}]},'log':_0xe8aa('0x2')});};}; \ No newline at end of file +var _0xf36c=['getTriggers','Request','GetTrigger','channel','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','action','data2','data3','data5','data6','data7'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xf36c,0x90));var _0xcf36=function(_0x2f2210,_0x4e02ed){_0x2f2210=_0x2f2210-0x0;var _0x57aae3=_0xf36c[_0x2f2210];return _0x57aae3;};'use strict';var client=require('../client');exports[_0xcf36('0x0')]=function(_0x23ac24){return function(_0xa895b){return client[_0xcf36('0x1')](_0xcf36('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xcf36('0x3'),'status'],'include':[{'model':'Condition','as':_0xcf36('0x4'),'attributes':['id',_0xcf36('0x5'),_0xcf36('0x6'),_0xcf36('0x7')]},{'model':_0xcf36('0x8'),'as':_0xcf36('0x9'),'attributes':['id',_0xcf36('0x5'),'operator',_0xcf36('0x7')]},{'model':_0xcf36('0xa'),'as':_0xcf36('0xb'),'attributes':['id',_0xcf36('0xc'),'data1',_0xcf36('0xd'),_0xcf36('0xe'),'data4',_0xcf36('0xf'),_0xcf36('0x10'),_0xcf36('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f9f7de4..e714ae8 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 _0x291c=['name','registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x291c,0x137));var _0xc291=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x291c[_0x1cc8fe];return _0x230054;};'use strict';var client=require(_0xc291('0x0'));exports[_0xc291('0x1')]=function(_0x1918fc){return function(_0x180bc4){return client[_0xc291('0x2')](_0xc291('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc291('0x4'),_0xc291('0x5'),_0xc291('0x6')]},'log':_0xc291('0x3')});};}; \ No newline at end of file +var _0xccb9=['registry','defaultuser','../client','Request','GetTrunk'];(function(_0x42fcf1,_0x65ee17){var _0x5af641=function(_0x4f0c44){while(--_0x4f0c44){_0x42fcf1['push'](_0x42fcf1['shift']());}};_0x5af641(++_0x65ee17);}(_0xccb9,0x124));var _0x9ccb=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xccb9[_0x39096d];return _0x13da4f;};'use strict';var client=require(_0x9ccb('0x0'));exports['getTrunks']=function(_0x2f856e){return function(_0x313fa1){return client[_0x9ccb('0x1')](_0x9ccb('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x9ccb('0x3'),_0x9ccb('0x4')]},'log':_0x9ccb('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 9601da1..a83f950 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x14b20f,_0x1b388b){var _0x58298a=function(_0x29187a){while(--_0x29187a){_0x14b20f['push'](_0x14b20f['shift']());}};_0x58298a(++_0x1b388b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ad54fd5..ac81b58 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 _0x5e5a=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x5e5a,0x120));var _0xa5e5=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x5e5a[_0x1573ea];return _0x51c0e2;};'use strict';var client=require(_0xa5e5('0x0'));exports[_0xa5e5('0x1')]=function(_0xd27544){return client[_0xa5e5('0x2')](_0xa5e5('0x3'),{'body':_0xd27544,'log':_0xa5e5('0x3')});};exports[_0xa5e5('0x4')]=function(_0x40d7ec,_0x275a60,_0x25cb0d){return client[_0xa5e5('0x2')](_0xa5e5('0x5'),{'body':_0x40d7ec,'options':{'where':{'uniqueid':_0x275a60,'interface':_0x25cb0d,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x9cf2=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client','create'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x9cf2,0x13e));var _0x29cf=function(_0x367492,_0x1941d8){_0x367492=_0x367492-0x0;var _0x4e7f9d=_0x9cf2[_0x367492];return _0x4e7f9d;};'use strict';var client=require(_0x29cf('0x0'));exports[_0x29cf('0x1')]=function(_0xda381d){return client['Request']('CreateVoiceAgentReport',{'body':_0xda381d,'log':_0x29cf('0x2')});};exports['update']=function(_0x2c1930,_0x5efa2c,_0x321fa8){return client[_0x29cf('0x3')](_0x29cf('0x4'),{'body':_0x2c1930,'options':{'where':{'uniqueid':_0x5efa2c,'interface':_0x321fa8,'agentcomplete':!![]}},'log':_0x29cf('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index c5fcb9a..f0da29b 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 _0xf85c=['create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash'];(function(_0x1bfe2b,_0x34856e){var _0x1477d4=function(_0x1d558c){while(--_0x1d558c){_0x1bfe2b['push'](_0x1bfe2b['shift']());}};_0x1477d4(++_0x34856e);}(_0xf85c,0x179));var _0xcf85=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xf85c[_0x5a95fa];return _0x1a61b8;};'use strict';var moment=require(_0xcf85('0x0'));var util=require(_0xcf85('0x1'));var _=require(_0xcf85('0x2'));var client=require('../client');exports[_0xcf85('0x3')]=function(_0x22359f){return client[_0xcf85('0x4')](_0xcf85('0x5'),{'body':_[_0xcf85('0x6')](_0x22359f,{'source':_0x22359f[_0xcf85('0x7')],'destinationcontext':_0x22359f[_0xcf85('0x8')],'callerid':_0x22359f[_0xcf85('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0xcf85('0x5')});};exports[_0xcf85('0xa')]=function(){return function(){return client[_0xcf85('0x4')](_0xcf85('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf']('day')[_0xcf85('0xc')](_0xcf85('0xd')),moment()[_0xcf85('0xe')]('day')['format'](_0xcf85('0xd'))]}},'attributes':[_0xcf85('0xf'),_0xcf85('0x10'),_0xcf85('0x11'),_0xcf85('0x12')]},'log':_0xcf85('0x13')});};}; \ No newline at end of file +var _0x9ee3=['DOCUMENTATION','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','format','duration','billableseconds','util','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid'];(function(_0x2e66ac,_0x5c5ea2){var _0x5d0eee=function(_0x4b8a2d){while(--_0x4b8a2d){_0x2e66ac['push'](_0x2e66ac['shift']());}};_0x5d0eee(++_0x5c5ea2);}(_0x9ee3,0x1b2));var _0x39ee=function(_0x6bcc5b,_0x919609){_0x6bcc5b=_0x6bcc5b-0x0;var _0x228519=_0x9ee3[_0x6bcc5b];return _0x228519;};'use strict';var moment=require('moment');var util=require(_0x39ee('0x0'));var _=require(_0x39ee('0x1'));var client=require('../client');exports[_0x39ee('0x2')]=function(_0x3477c4){return client[_0x39ee('0x3')](_0x39ee('0x4'),{'body':_[_0x39ee('0x5')](_0x3477c4,{'source':_0x3477c4[_0x39ee('0x6')],'destinationcontext':_0x3477c4['context'],'callerid':_0x3477c4[_0x39ee('0x7')],'amaflags':_0x39ee('0x8')}),'log':_0x39ee('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x39ee('0x3')](_0x39ee('0x9'),{'options':{'where':{'type':[_0x39ee('0xa')],'createdAt':{'$between':[moment()[_0x39ee('0xb')]('day')['format'](_0x39ee('0xc')),moment()[_0x39ee('0xd')]('day')[_0x39ee('0xe')](_0x39ee('0xc'))]}},'attributes':['type','disposition',_0x39ee('0xf'),_0x39ee('0x10')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 701da25..11b49ba 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 _0xc1d5=['Request','../client','create'];(function(_0x1a44ac,_0xc81498){var _0x3b9d1d=function(_0x5508fa){while(--_0x5508fa){_0x1a44ac['push'](_0x1a44ac['shift']());}};_0x3b9d1d(++_0xc81498);}(_0xc1d5,0x97));var _0x5c1d=function(_0x1720f6,_0x5e9128){_0x1720f6=_0x1720f6-0x0;var _0x46e9fd=_0xc1d5[_0x1720f6];return _0x46e9fd;};'use strict';var client=require(_0x5c1d('0x0'));exports[_0x5c1d('0x1')]=function(_0xd21714){return client[_0x5c1d('0x2')]('CreateVoiceDialReport',{'body':_0xd21714,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xee16=['CreateVoiceDialReport','../client','create','Request'];(function(_0x3094fb,_0x30e138){var _0x42fa9b=function(_0x2c5a55){while(--_0x2c5a55){_0x3094fb['push'](_0x3094fb['shift']());}};_0x42fa9b(++_0x30e138);}(_0xee16,0x181));var _0x6ee1=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0xee16[_0x4e90e3];return _0x295e5b;};'use strict';var client=require(_0x6ee1('0x0'));exports[_0x6ee1('0x1')]=function(_0x2a58d5){return client[_0x6ee1('0x2')](_0x6ee1('0x3'),{'body':_0x2a58d5,'log':_0x6ee1('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7d71dc8..84db896 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 _0xe600=['recordingFormat','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xe600,0x159));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports[_0x0e60('0x0')]=function(){return function(){return client['Request'](_0x0e60('0x1'),{'options':{'raw':!![],'attributes':['id',_0x0e60('0x2'),_0x0e60('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x0e60('0x0')});};}; \ No newline at end of file +var _0x6f0d=['getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x2a851f,_0x202189){var _0xcb44ed=function(_0x6d2019){while(--_0x6d2019){_0x2a851f['push'](_0x2a851f['shift']());}};_0xcb44ed(++_0x202189);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xd5c6ea,_0xc4112a){_0xd5c6ea=_0xd5c6ea-0x0;var _0x371dbd=_0x6f0d[_0xd5c6ea];return _0x371dbd;};'use strict';var client=require('../client');exports[_0xd6f0('0x0')]=function(){return function(){return client[_0xd6f0('0x1')](_0xd6f0('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd6f0('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xd6f0('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 68a2433..df561ad 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 _0xbc8f=['Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xbc8f,0x13c));var _0xfbc8=function(_0xbde966,_0x356883){_0xbde966=_0xbde966-0x0;var _0x19f34a=_0xbc8f[_0xbde966];return _0x19f34a;};'use strict';var client=require(_0xfbc8('0x0'));exports[_0xfbc8('0x1')]=function(){return function(){return client[_0xfbc8('0x2')](_0xfbc8('0x3'),{'options':{'raw':![],'attributes':['id',_0xfbc8('0x4'),_0xfbc8('0x5'),_0xfbc8('0x6'),_0xfbc8('0x7'),_0xfbc8('0x8'),_0xfbc8('0x9'),_0xfbc8('0xa'),_0xfbc8('0xb'),'dialLimitChannel',_0xfbc8('0xc'),'dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0xfbc8('0xd'),_0xfbc8('0xe'),_0xfbc8('0xf'),_0xfbc8('0x10'),_0xfbc8('0x11'),_0xfbc8('0x12'),'dialQueueProject',_0xfbc8('0x13'),_0xfbc8('0x14'),'dialBusyMaxRetry',_0xfbc8('0x15'),_0xfbc8('0x16'),_0xfbc8('0x17'),_0xfbc8('0x18'),'dialTimezone',_0xfbc8('0x19'),_0xfbc8('0x1a'),_0xfbc8('0x1b'),_0xfbc8('0x1c'),_0xfbc8('0x1d'),_0xfbc8('0x1e'),_0xfbc8('0x1f'),_0xfbc8('0x20'),_0xfbc8('0x21'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0xfbc8('0x22'),'dialAMDMaximumWordLength',_0xfbc8('0x23'),_0xfbc8('0x24'),_0xfbc8('0x25'),'dialOrderByScheduledAt',_0xfbc8('0x26'),_0xfbc8('0x27'),_0xfbc8('0x28'),'monitor_format',_0xfbc8('0x29'),_0xfbc8('0x2a'),'dialCutDigit',_0xfbc8('0x2b'),_0xfbc8('0x2c'),'dialDropMaxRetry',_0xfbc8('0x2d'),'dialAbandonedMaxRetry',_0xfbc8('0x2e'),_0xfbc8('0x2f'),_0xfbc8('0x30'),_0xfbc8('0x31'),_0xfbc8('0x32'),_0xfbc8('0x33'),_0xfbc8('0x34'),_0xfbc8('0x35')],'include':[{'model':_0xfbc8('0x36'),'as':_0xfbc8('0x36'),'attributes':['id',_0xfbc8('0x4'),'callerid',_0xfbc8('0x37')]},{'model':_0xfbc8('0x38'),'as':_0xfbc8('0x39'),'attributes':['id','name']},{'model':_0xfbc8('0x36'),'as':_0xfbc8('0x3a'),'attributes':['id',_0xfbc8('0x4'),'callerid',_0xfbc8('0x37')]},{'model':'Interval','as':'Interval','attributes':['id',_0xfbc8('0x4')],'include':[{'model':_0xfbc8('0x3b'),'as':_0xfbc8('0x3c'),'attributes':['id',_0xfbc8('0x4'),_0xfbc8('0x3d')]}]}]},'log':_0xfbc8('0x1')});};}; \ No newline at end of file +var _0x4d88=['dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient'];(function(_0x190c9f,_0x1c29e7){var _0x2151b8=function(_0x157e2c){while(--_0x157e2c){_0x190c9f['push'](_0x190c9f['shift']());}};_0x2151b8(++_0x1c29e7);}(_0x4d88,0x8d));var _0x84d8=function(_0x4b77c1,_0x4c8fdc){_0x4b77c1=_0x4b77c1-0x0;var _0x2a54e6=_0x4d88[_0x4b77c1];return _0x2a54e6;};'use strict';var client=require(_0x84d8('0x0'));exports[_0x84d8('0x1')]=function(){return function(){return client[_0x84d8('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x84d8('0x3'),_0x84d8('0x4'),_0x84d8('0x5'),_0x84d8('0x6'),_0x84d8('0x7'),_0x84d8('0x8'),_0x84d8('0x9'),_0x84d8('0xa'),_0x84d8('0xb'),_0x84d8('0xc'),_0x84d8('0xd'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x84d8('0xe'),_0x84d8('0xf'),_0x84d8('0x10'),_0x84d8('0x11'),_0x84d8('0x12'),'dialQueueProject',_0x84d8('0x13'),_0x84d8('0x14'),'dialBusyMaxRetry',_0x84d8('0x15'),_0x84d8('0x16'),_0x84d8('0x17'),_0x84d8('0x18'),_0x84d8('0x19'),_0x84d8('0x1a'),_0x84d8('0x1b'),_0x84d8('0x1c'),_0x84d8('0x1d'),_0x84d8('0x1e'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x84d8('0x1f'),_0x84d8('0x20'),_0x84d8('0x21'),'dialAMDMaximumNumberOfWords',_0x84d8('0x22'),_0x84d8('0x23'),_0x84d8('0x24'),_0x84d8('0x25'),_0x84d8('0x26'),_0x84d8('0x27'),_0x84d8('0x28'),_0x84d8('0x29'),'dialQueueProject2',_0x84d8('0x7'),'strategy',_0x84d8('0x2a'),_0x84d8('0x2b'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x84d8('0x2c'),_0x84d8('0x2d'),_0x84d8('0x2e'),_0x84d8('0x2f'),_0x84d8('0x30'),_0x84d8('0x31'),_0x84d8('0x32'),_0x84d8('0x33'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x84d8('0x34')],'include':[{'model':_0x84d8('0x35'),'as':_0x84d8('0x35'),'attributes':['id',_0x84d8('0x3'),'callerid',_0x84d8('0x36')]},{'model':_0x84d8('0x37'),'as':_0x84d8('0x38'),'attributes':['id',_0x84d8('0x3')]},{'model':_0x84d8('0x35'),'as':_0x84d8('0x39'),'attributes':['id',_0x84d8('0x3'),_0x84d8('0x3a'),_0x84d8('0x36')]},{'model':_0x84d8('0x3b'),'as':_0x84d8('0x3b'),'attributes':['id',_0x84d8('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x84d8('0x3'),_0x84d8('0x3c')]}]}]},'log':_0x84d8('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f57862a..086f2b9 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(_0x5619ab,_0x368693){var _0x265efc=function(_0xc4b359){while(--_0xc4b359){_0x5619ab['push'](_0x5619ab['shift']());}};_0x265efc(++_0x368693);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0xca9a67,_0x59ad83){var _0x48621c=function(_0x14852){while(--_0x14852){_0xca9a67['push'](_0xca9a67['shift']());}};_0x48621c(++_0x59ad83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 4c19d49..b6ecbd5 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 _0x9064=['getVoiceQueueRtPauses','Request','../client'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x9064,0x182));var _0x4906=function(_0x5214de,_0x2fe973){_0x5214de=_0x5214de-0x0;var _0x2e1c5a=_0x9064[_0x5214de];return _0x2e1c5a;};'use strict';var client=require(_0x4906('0x0'));exports[_0x4906('0x1')]=function(_0xcfe34b){return function(){return client[_0x4906('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0xcfe34b,'paused':!![]},'raw':!![]},'log':_0x4906('0x1')});};}; \ No newline at end of file +var _0x3fce=['../client','GetVoiceQueueRtPauses'];(function(_0x4de1b3,_0x5bc6a1){var _0x9ba804=function(_0x49cd76){while(--_0x49cd76){_0x4de1b3['push'](_0x4de1b3['shift']());}};_0x9ba804(++_0x5bc6a1);}(_0x3fce,0x1d0));var _0xe3fc=function(_0x209302,_0x5826ac){_0x209302=_0x209302-0x0;var _0x1df8e9=_0x3fce[_0x209302];return _0x1df8e9;};'use strict';var client=require(_0xe3fc('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4e2ef3){return function(){return client['Request'](_0xe3fc('0x1'),{'options':{'where':{'VoiceQueueId':_0x4e2ef3,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4805e0a..ad17ff4 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(_0x384d16,_0x2248e1){var _0x184096=function(_0x343134){while(--_0x343134){_0x384d16['push'](_0x384d16['shift']());}};_0x184096(++_0x2248e1);}(_0x7a54,0x106));var _0x47a5=function(_0x51e8e3,_0x4c28f7){_0x51e8e3=_0x51e8e3-0x0;var _0x4df2d0=_0x7a54[_0x51e8e3];return _0x4df2d0;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x24db8f,_0x10064c){var _0x4d0c00=function(_0x5e3830){while(--_0x5e3830){_0x24db8f['push'](_0x24db8f['shift']());}};_0x4d0c00(++_0x10064c);}(_0x7a54,0x106));var _0x47a5=function(_0x37c68f,_0xf7f6ac){_0x37c68f=_0x37c68f-0x0;var _0x5362ca=_0x7a54[_0x37c68f];return _0x5362ca;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index d55198b..a116592 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 _0xba84=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','Request','CreateVoiceTransferReport','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x14c8e6,_0x5270db){var _0xf2c58e=function(_0x3c6fa9){while(--_0x3c6fa9){_0x14c8e6['push'](_0x14c8e6['shift']());}};_0xf2c58e(++_0x5270db);}(_0xba84,0x15c));var _0x4ba8=function(_0x2e471c,_0x389b3d){_0x2e471c=_0x2e471c-0x0;var _0xedad0a=_0xba84[_0x2e471c];return _0xedad0a;};'use strict';var client=require(_0x4ba8('0x0'));exports[_0x4ba8('0x1')]={};exports[_0x4ba8('0x2')]=function(_0x1c0ee0){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x1c0ee0[_0x4ba8('0x3')],'transfererchannel':_0x1c0ee0[_0x4ba8('0x4')],'transferercalleridnum':_0x1c0ee0[_0x4ba8('0x5')],'transferercalleridname':_0x1c0ee0[_0x4ba8('0x6')],'transfererconnectedlinenum':_0x1c0ee0[_0x4ba8('0x7')],'transfererconnectedlinename':_0x1c0ee0[_0x4ba8('0x8')],'transfereraccountcode':_0x1c0ee0[_0x4ba8('0x9')],'transferercontext':_0x1c0ee0[_0x4ba8('0xa')],'transfererexten':_0x1c0ee0[_0x4ba8('0xb')],'transfererlinkedid':_0x1c0ee0[_0x4ba8('0xc')],'transfereechannel':_0x1c0ee0[_0x4ba8('0xd')],'transfereecalleridnum':_0x1c0ee0[_0x4ba8('0xe')],'transfereecalleridname':_0x1c0ee0[_0x4ba8('0xf')],'transfereeconnectedlinenum':_0x1c0ee0[_0x4ba8('0x10')],'transfereeconnectedlinename':_0x1c0ee0[_0x4ba8('0x11')],'transfereeaccountcode':_0x1c0ee0[_0x4ba8('0x12')],'transfereecontext':_0x1c0ee0[_0x4ba8('0x13')],'transfereeexten':_0x1c0ee0[_0x4ba8('0x14')],'transfereelinkedid':_0x1c0ee0[_0x4ba8('0x15')],'isexternal':_0x1c0ee0[_0x4ba8('0x16')],'context':_0x1c0ee0[_0x4ba8('0x17')],'extension':_0x1c0ee0[_0x4ba8('0x18')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x2350b8){return client[_0x4ba8('0x19')](_0x4ba8('0x1a'),{'body':{'result':_0x2350b8[_0x4ba8('0x3')],'transfererchannel':_0x2350b8['origtransfererchannel'],'transferercalleridnum':_0x2350b8['origtransferercalleridnum'],'transferercalleridname':_0x2350b8[_0x4ba8('0x1b')],'transfererconnectedlinenum':_0x2350b8[_0x4ba8('0x1c')],'transfererconnectedlinename':_0x2350b8['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2350b8[_0x4ba8('0x1d')],'transferercontext':_0x2350b8[_0x4ba8('0x1e')],'transfererexten':_0x2350b8[_0x4ba8('0x1f')],'transfererlinkedid':_0x2350b8[_0x4ba8('0x20')],'transfereechannel':_0x2350b8[_0x4ba8('0x21')],'transfereecalleridnum':_0x2350b8['transfertargetcalleridnum'],'transfereecalleridname':_0x2350b8[_0x4ba8('0x22')],'transfereeconnectedlinenum':_0x2350b8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2350b8[_0x4ba8('0x23')],'transfereeaccountcode':_0x2350b8[_0x4ba8('0x24')],'transfereecontext':_0x2350b8[_0x4ba8('0x25')],'transfereeexten':_0x2350b8[_0x4ba8('0x26')],'transfereelinkedid':_0x2350b8['transfertargetlinkedid'],'isexternal':_0x2350b8[_0x4ba8('0x16')],'context':_0x2350b8[_0x4ba8('0x27')],'extension':_0x2350b8[_0x4ba8('0x28')],'type':_0x4ba8('0x29')},'log':_0x4ba8('0x1a')});}; \ No newline at end of file +var _0xb0ee=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x3b6735,_0x1c6cd4){var _0x364538=function(_0x26d0da){while(--_0x26d0da){_0x3b6735['push'](_0x3b6735['shift']());}};_0x364538(++_0x1c6cd4);}(_0xb0ee,0x103));var _0xeb0e=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xb0ee[_0x119d5a];return _0x15bff4;};'use strict';var client=require(_0xeb0e('0x0'));exports[_0xeb0e('0x1')]={};exports[_0xeb0e('0x2')]=function(_0x5e90ab){return client[_0xeb0e('0x3')](_0xeb0e('0x4'),{'body':{'result':_0x5e90ab[_0xeb0e('0x5')],'transfererchannel':_0x5e90ab[_0xeb0e('0x6')],'transferercalleridnum':_0x5e90ab[_0xeb0e('0x7')],'transferercalleridname':_0x5e90ab['transferercalleridname'],'transfererconnectedlinenum':_0x5e90ab[_0xeb0e('0x8')],'transfererconnectedlinename':_0x5e90ab[_0xeb0e('0x9')],'transfereraccountcode':_0x5e90ab[_0xeb0e('0xa')],'transferercontext':_0x5e90ab[_0xeb0e('0xb')],'transfererexten':_0x5e90ab[_0xeb0e('0xc')],'transfererlinkedid':_0x5e90ab[_0xeb0e('0xd')],'transfereechannel':_0x5e90ab[_0xeb0e('0xe')],'transfereecalleridnum':_0x5e90ab[_0xeb0e('0xf')],'transfereecalleridname':_0x5e90ab['transfereecalleridname'],'transfereeconnectedlinenum':_0x5e90ab['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5e90ab[_0xeb0e('0x10')],'transfereeaccountcode':_0x5e90ab[_0xeb0e('0x11')],'transfereecontext':_0x5e90ab['transfereecontext'],'transfereeexten':_0x5e90ab[_0xeb0e('0x12')],'transfereelinkedid':_0x5e90ab[_0xeb0e('0x13')],'isexternal':_0x5e90ab[_0xeb0e('0x14')],'context':_0x5e90ab[_0xeb0e('0x15')],'extension':_0x5e90ab[_0xeb0e('0x16')],'type':_0xeb0e('0x17')},'log':_0xeb0e('0x4')});};exports['attendedTransfer']=function(_0x24587e){return client[_0xeb0e('0x3')](_0xeb0e('0x4'),{'body':{'result':_0x24587e[_0xeb0e('0x5')],'transfererchannel':_0x24587e['origtransfererchannel'],'transferercalleridnum':_0x24587e[_0xeb0e('0x18')],'transferercalleridname':_0x24587e[_0xeb0e('0x19')],'transfererconnectedlinenum':_0x24587e[_0xeb0e('0x1a')],'transfererconnectedlinename':_0x24587e[_0xeb0e('0x1b')],'transfereraccountcode':_0x24587e[_0xeb0e('0x1c')],'transferercontext':_0x24587e[_0xeb0e('0x1d')],'transfererexten':_0x24587e[_0xeb0e('0x1e')],'transfererlinkedid':_0x24587e[_0xeb0e('0x1f')],'transfereechannel':_0x24587e[_0xeb0e('0x20')],'transfereecalleridnum':_0x24587e['transfertargetcalleridnum'],'transfereecalleridname':_0x24587e[_0xeb0e('0x21')],'transfereeconnectedlinenum':_0x24587e[_0xeb0e('0x22')],'transfereeconnectedlinename':_0x24587e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x24587e[_0xeb0e('0x23')],'transfereecontext':_0x24587e[_0xeb0e('0x24')],'transfereeexten':_0x24587e[_0xeb0e('0x25')],'transfereelinkedid':_0x24587e[_0xeb0e('0x26')],'isexternal':_0x24587e[_0xeb0e('0x14')],'context':_0x24587e[_0xeb0e('0x27')],'extension':_0x24587e['origtransfererexten'],'type':_0xeb0e('0x28')},'log':_0xeb0e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index aad3708..26921ad 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 _0x2b29=['dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','push','length','find','undefined','values','voicechannel','%s.%s','filename','uniqueid','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','channels','resolve','StopMixMonitor','channel','destinationchannel','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','action','Action','message','catch','username','command','Command','then','voiceQueues','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','outbound','dialActive'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x2b29,0x163));var _0x92b2=function(_0x5a5e0a,_0x19d4b5){_0x5a5e0a=_0x5a5e0a-0x0;var _0x128dcd=_0x2b29[_0x5a5e0a];return _0x128dcd;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var jayson=require(_0x92b2('0x1'));var schema=require(_0x92b2('0x2'));var BPromise=require(_0x92b2('0x3'));var moment=require('moment');var config=require(_0x92b2('0x4'));var properties=require(_0x92b2('0x5'));var ami=require(_0x92b2('0x6'));exports[_0x92b2('0x7')]=function(_0x16c1b0,_0x3166e8,_0x47c522){return new BPromise(function(_0xb1d856,_0x536e21){var _0x29f183={'QueuePause':function(_0x43a292){return new Promise(function(_0x5c1d94,_0x3e2204){var _0x14c8e3=util[_0x92b2('0x8')](_0x92b2('0x9'),'SIP',_0x43a292[_0x92b2('0xa')]);if(_0x16c1b0[_0x92b2('0xb')]&&_0x16c1b0[_0x92b2('0xb')][_0x14c8e3]&&_0x16c1b0[_0x92b2('0xb')][_0x14c8e3][_0x92b2('0xc')]){_0x16c1b0[_0x92b2('0xb')][_0x14c8e3][_0x92b2('0xd')]();}if(_0x16c1b0['agents'][_0x14c8e3]){_0x16c1b0[_0x92b2('0xe')][_0x14c8e3][_0x92b2('0xf')]({'statePause':_0x43a292[_0x92b2('0x10')]?!![]:![]});}_0x5c1d94({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1b7dd6){var _0x3e5309=this;return new Promise(function(_0x3c5db1,_0x4d597b){if(ami[_0x92b2('0x11')]()==![]){return _0x4d597b(_0x3e5309[_0x92b2('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x92b2('0x13')]['username'],_0x92b2('0x14')][_0x92b2('0x15')]('\x20')));}_0x1b7dd6=_[_0x92b2('0x16')](_0x1b7dd6,_['keys'](properties['module']));_0x1b7dd6[_0x92b2('0x17')]='Reload';return ami[_0x92b2('0x18')](_0x1b7dd6)['then'](function(_0x42872b){_0x3c5db1({'code':0xc8,'message':_0x42872b[_0x92b2('0x19')]});})[_0x92b2('0x1a')](function(_0xceaa2f){_0x4d597b(_0x3e5309[_0x92b2('0x12')](0x1f5,_0xceaa2f[_0x92b2('0x19')]));});});},'Command':function(_0x1cb43e){var _0x692704=this;return new Promise(function(_0x21bc07,_0xa08831){if(ami[_0x92b2('0x11')]()==![]){return _0xa08831(_0x692704[_0x92b2('0x12')](0x1f4,[config[_0x92b2('0x13')]['ip'],config[_0x92b2('0x13')][_0x92b2('0x1b')],'ami\x20disconnected'][_0x92b2('0x15')]('\x20')));}_0x1cb43e=_['pick'](_0x1cb43e,_0x92b2('0x1c'));_0x1cb43e[_0x92b2('0x17')]=_0x92b2('0x1d');return ami[_0x92b2('0x18')](_0x1cb43e)[_0x92b2('0x1e')](function(_0x574c3e){_0x21bc07({'code':0xc8,'message':_0x574c3e['content']});})[_0x92b2('0x1a')](function(_0x31567c){_0xa08831(_0x692704[_0x92b2('0x12')](0x1f5,_0x31567c[_0x92b2('0x19')]));});});},'VoiceQueues':function(_0x5a6c76){return new Promise(function(_0x30a205,_0x15faf5){var _0x49b81e=[];for(var _0xbbbfa7 in _0x16c1b0['voiceQueues']){if(_0x16c1b0[_0x92b2('0x1f')]['hasOwnProperty'](_0xbbbfa7)){var _0x183f81=_0x16c1b0['voiceQueues'][_0xbbbfa7];var _0x5e9688={'id':_0x183f81['id'],'name':_0x183f81[_0x92b2('0xa')],'strategy':_0x183f81[_0x92b2('0x20')],'answered':_0x183f81[_0x92b2('0x21')],'available':_0x183f81['available'],'loggedIn':_0x183f81[_0x92b2('0x22')],'pTalking':_0x183f81['pTalking'],'sumBillable':_0x183f81[_0x92b2('0x23')],'sumDuration':_0x183f81[_0x92b2('0x24')],'sumHoldTime':_0x183f81[_0x92b2('0x25')]||0x0,'talking':_0x183f81[_0x92b2('0x26')],'total':_0x183f81[_0x92b2('0x27')],'type':_0x183f81[_0x92b2('0x28')],'unmanaged':_0x183f81[_0x92b2('0x29')],'abandoned':_0x183f81['abandoned'],'waiting':_0x183f81['waiting'],'loggedInDb':_0x183f81['loggedInDb']};if(_0x183f81[_0x92b2('0x28')]===_0x92b2('0x2a')){_0x5e9688[_0x92b2('0x2b')]=_0x183f81['dialActive'];_0x5e9688['dialMethod']=_0x183f81[_0x92b2('0x2c')];_0x5e9688[_0x92b2('0x2d')]=_0x183f81[_0x92b2('0x2d')];_0x5e9688[_0x92b2('0x2e')]=_0x183f81[_0x92b2('0x2e')];_0x5e9688['dialOriginateTimeout']=_0x183f81['dialOriginateTimeout'];_0x5e9688['dialPrefix']=_0x183f81[_0x92b2('0x2f')];_0x5e9688[_0x92b2('0x30')]=_0x183f81['temp'];_0x5e9688[_0x92b2('0x31')]=_0x183f81[_0x92b2('0x31')];_0x5e9688[_0x92b2('0x32')]=_0x183f81[_0x92b2('0x32')];_0x5e9688[_0x92b2('0x33')]=_0x183f81[_0x92b2('0x33')];_0x5e9688[_0x92b2('0x34')]=_0x183f81[_0x92b2('0x34')];_0x5e9688['outboundCongestionCallsDay']=_0x183f81[_0x92b2('0x35')];_0x5e9688[_0x92b2('0x36')]=_0x183f81[_0x92b2('0x36')];_0x5e9688['outboundDropCallsDayCallersExit']=_0x183f81[_0x92b2('0x37')];_0x5e9688['outboundDropCallsDayTimeout']=_0x183f81[_0x92b2('0x38')];_0x5e9688[_0x92b2('0x39')]=_0x183f81['outboundNoAnswerCallsDay'];_0x5e9688['outboundNoSuchCallsDay']=_0x183f81[_0x92b2('0x3a')];_0x5e9688[_0x92b2('0x3b')]=_0x183f81['outboundOriginateFailureCallsDay'];_0x5e9688['outboundReCallsDay']=_0x183f81[_0x92b2('0x3c')];_0x5e9688[_0x92b2('0x3d')]=_0x183f81['outboundRejectCallsDay'];_0x5e9688[_0x92b2('0x3e')]=_0x183f81[_0x92b2('0x3e')];_0x5e9688[_0x92b2('0x3f')]=_0x183f81['predictiveIntervalAnsweredCalls'];_0x5e9688[_0x92b2('0x40')]=_0x183f81['predictiveIntervalAvgHoldtime'];_0x5e9688[_0x92b2('0x41')]=_0x183f81[_0x92b2('0x41')];_0x5e9688[_0x92b2('0x42')]=_0x183f81[_0x92b2('0x42')];_0x5e9688[_0x92b2('0x43')]=_0x183f81[_0x92b2('0x43')];_0x5e9688['predictiveIntervalErlangCalls']=_0x183f81[_0x92b2('0x44')];_0x5e9688[_0x92b2('0x45')]=_0x183f81['predictiveIntervalErlangCallsDroppedCalls'];_0x5e9688[_0x92b2('0x46')]=_0x183f81[_0x92b2('0x46')];_0x5e9688[_0x92b2('0x47')]=_0x183f81[_0x92b2('0x47')];_0x5e9688[_0x92b2('0x48')]=_0x183f81[_0x92b2('0x48')];_0x5e9688[_0x92b2('0x49')]=_0x183f81['predictiveIntervalAvailable'];_0x5e9688[_0x92b2('0x4a')]=_0x183f81['predictiveIntervalTotalCalls'];_0x5e9688[_0x92b2('0x19')]=_0x183f81['message'];_0x5e9688[_0x92b2('0x4b')]=_0x183f81[_0x92b2('0x4b')];_0x5e9688[_0x92b2('0x4c')]=_0x183f81['erlangCalls'];_0x5e9688[_0x92b2('0x4d')]=_0x183f81[_0x92b2('0x4d')];_0x5e9688[_0x92b2('0x4e')]=_0x183f81['erlangAbandonmentRate'];_0x5e9688[_0x92b2('0x4f')]=_0x183f81[_0x92b2('0x4f')];_0x5e9688[_0x92b2('0x50')]=_0x183f81[_0x92b2('0x50')];_0x5e9688['startProgressive']=_0x183f81['startProgressive'];}if(_0x183f81['Trunk']){_0x5e9688[_0x92b2('0x51')]={'id':_0x183f81[_0x92b2('0x51')]['id'],'name':_0x183f81[_0x92b2('0x51')]['name'],'active':_0x183f81[_0x92b2('0x51')]['active'],'callerid':_0x183f81[_0x92b2('0x51')][_0x92b2('0x52')]};}if(_0x183f81[_0x92b2('0x53')]){_0x5e9688[_0x92b2('0x53')]={'id':_0x183f81[_0x92b2('0x53')]['id'],'name':_0x183f81[_0x92b2('0x53')][_0x92b2('0xa')]};}_0x49b81e[_0x92b2('0x54')](_0x5e9688);}}_0x30a205({'count':_0x49b81e[_0x92b2('0x55')],'rows':_0x49b81e});});},'UpdateVoiceQueue':function(_0x2f18d6){return new Promise(function(_0x3c245d,_0x440cdc){var _0x558855=_[_0x92b2('0x56')](_0x16c1b0['voiceQueues'],{'id':parseInt(_0x2f18d6['id'])});var _0x191e15=_['omit'](_0x2f18d6,['id']);if(_0x558855){for(var _0x18b4ba in _0x191e15){if(typeof _0x191e15[_0x18b4ba]!==_0x92b2('0x57')&&typeof _0x558855[_0x18b4ba]!==_0x92b2('0x57')){_0x558855[_0x18b4ba]=_0x191e15[_0x18b4ba];}}_0x3c245d(_0x558855);}else{_0x440cdc();}});},'VoiceChannels':function(_0x4f7f0f){return new Promise(function(_0x397448,_0x4a670c){var _0xd89d2=_[_0x92b2('0x58')](_0x16c1b0['channels']);_0x397448({'count':_0xd89d2[_0x92b2('0x55')],'rows':_0xd89d2});});},'VoiceChannelMixMonitor':function(_0x24923e){var _0x4753cf=this;return new Promise(function(_0x442af6,_0x2f749f){if(ami[_0x92b2('0x11')]()==![]){return _0x2f749f(_0x4753cf[_0x92b2('0x12')](0x1f4,[config[_0x92b2('0x13')]['ip'],config[_0x92b2('0x13')][_0x92b2('0x1b')],_0x92b2('0x14')][_0x92b2('0x15')]('\x20')));}var _0x3b85e2=schema(properties[_0x92b2('0x59')])['validate'](_0x24923e);if(_0x3b85e2[_0x92b2('0x55')]>0x0){return _0x2f749f(_0x4753cf[_0x92b2('0x12')](0x1f4,_['map'](_0x3b85e2,'message')['join'](',\x20')));}var _0x1ab4da=_[_0x92b2('0x56')](_0x16c1b0['channels'],{'uniqueid':_0x24923e['uniqueid']});if(_0x1ab4da&&_0x1ab4da['channel']){var _0x427e92=util[_0x92b2('0x8')](_0x92b2('0x5a'),_0x24923e[_0x92b2('0x5b')]||_0x24923e[_0x92b2('0x5c')],_0x24923e[_0x92b2('0x8')]||_0x92b2('0x5d'));return ami[_0x92b2('0x18')]({'action':'MixMonitor','channel':_0x1ab4da['channel'],'file':_0x427e92,'options':'ai(mixmonitorid)'})[_0x92b2('0x1e')](function(_0x4d3f8f){var _0x68db6d=_['find'](_0x1ab4da[_0x92b2('0x5e')],{'filename':_0x92b2('0x5f')+_0x427e92[_0x92b2('0x60')]()});if(_[_0x92b2('0x61')](_0x68db6d)){_0x1ab4da['monitors'][_0x92b2('0x54')]({'filename':_0x92b2('0x5f')+_0x427e92[_0x92b2('0x60')](),'createdAt':moment()[_0x92b2('0x8')](_0x92b2('0x62')),'mixmonitorid':_0x4d3f8f[_0x92b2('0x63')],'status':_0x92b2('0x64')});}else{_0x68db6d[_0x92b2('0x63')]=_0x4d3f8f[_0x92b2('0x63')];_0x68db6d[_0x92b2('0x65')]=_0x92b2('0x64');}_0x442af6({'code':0xc8,'message':[_0x24923e[_0x92b2('0x5c')],_0x92b2('0x66'),_0x4d3f8f[_0x92b2('0x63')]][_0x92b2('0x15')]('\x20'),'mixmonitorid':_0x4d3f8f['mixmonitorid']});})['catch'](function(_0x3f6ec3){_0x2f749f(_0x4753cf[_0x92b2('0x12')](0x1f5,[_0x24923e[_0x92b2('0x5c')],_0x3f6ec3['message'][_0x92b2('0x60')]()][_0x92b2('0x15')]('\x20')));});}else{return _0x2f749f(_0x4753cf[_0x92b2('0x12')](0x1f5,_0x92b2('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x33a015){var _0x46b4de=this;return new Promise(function(_0x883121,_0x4de976){if(ami[_0x92b2('0x11')]()==![]){return _0x4de976(_0x46b4de[_0x92b2('0x12')](0x1f4,[config[_0x92b2('0x13')]['ip'],config['asterisk'][_0x92b2('0x1b')],_0x92b2('0x14')]['join']('\x20')));}var _0x4a0355=schema(properties[_0x92b2('0x59')])[_0x92b2('0x2')](_0x33a015);if(_0x4a0355['length']>0x0){return _0x4de976(_0x46b4de[_0x92b2('0x12')](0x1f4,_[_0x92b2('0x68')](_0x4a0355,_0x92b2('0x19'))[_0x92b2('0x15')](',\x20')));}var _0x466c79=_[_0x92b2('0x56')](_0x16c1b0[_0x92b2('0x69')],{'uniqueid':_0x33a015[_0x92b2('0x5c')]});if(_0x466c79){return BPromise[_0x92b2('0x6a')]()[_0x92b2('0x1e')](function(){if(_0x466c79['channel']){return ami[_0x92b2('0x18')]({'action':_0x92b2('0x6b'),'channel':_0x466c79[_0x92b2('0x6c')],'mixmonitorid':_0x33a015[_0x92b2('0x63')]})[_0x92b2('0x1a')](function(_0x4c5973){});}})['then'](function(){if(_0x466c79[_0x92b2('0x6d')]){return ami[_0x92b2('0x18')]({'action':_0x92b2('0x6b'),'channel':_0x466c79[_0x92b2('0x6d')],'mixmonitorid':_0x33a015[_0x92b2('0x63')]})[_0x92b2('0x1a')](function(_0x2607ed){});}})['then'](function(_0xd7eff){var _0x105e9a=_['find'](_0x466c79[_0x92b2('0x5e')],{'mixmonitorid':_0x33a015['mixmonitorid']});if(_0x105e9a){_0x105e9a[_0x92b2('0x65')]=_0x92b2('0x6e');}})[_0x92b2('0x1e')](function(){var _0x4c4e32=util['format'](_0x92b2('0x5a'),_0x33a015['filename']||_0x33a015['uniqueid'],_0x33a015[_0x92b2('0x8')]||_0x92b2('0x5d'));var _0x800070=_[_0x92b2('0x56')](_0x466c79[_0x92b2('0x5e')],{'filename':_0x92b2('0x5f')+_0x4c4e32[_0x92b2('0x60')]()});if(_0x800070){_0x800070['status']=_0x92b2('0x6e');}})[_0x92b2('0x1e')](function(){_0x883121({'code':0xc8,'message':[_0x33a015['uniqueid'],_0x92b2('0x6f')][_0x92b2('0x15')]('\x20')});})[_0x92b2('0x1a')](function(_0x1bcc26){_0x4de976(_0x46b4de[_0x92b2('0x12')](0x1f5,[_0x33a015['uniqueid'],_0x1bcc26[_0x92b2('0x19')][_0x92b2('0x60')]()]['join']('\x20')));});}else{return _0x4de976(_0x46b4de[_0x92b2('0x12')](0x1f5,_0x92b2('0x67')));}});},'VoiceQueuesChannels':function(_0x2ebf05){return new Promise(function(_0x3f94ec,_0x142377){var _0x2bb502=_[_0x92b2('0x58')](_0x16c1b0['queueChannels']);_0x3f94ec({'count':_0x2bb502[_0x92b2('0x55')],'rows':_0x2bb502});});},'VoiceQueuesChannel':function(_0x3a2ea5){var _0xf14365=this;return new Promise(function(_0x3c3e33,_0x55b6ed){var _0x4f2c30=schema(properties[_0x92b2('0x70')])[_0x92b2('0x2')](_0x3a2ea5);if(_0x4f2c30[_0x92b2('0x55')]>0x0){return _0x55b6ed(_0xf14365['error'](0x1f4,_[_0x92b2('0x68')](_0x4f2c30,_0x92b2('0x19'))[_0x92b2('0x15')](',\x20')));}var _0x18edcd=_[_0x92b2('0x56')](_0x16c1b0[_0x92b2('0x71')],{'uniqueid':_0x3a2ea5[_0x92b2('0x5c')]});if(_0x18edcd){_0x3c3e33(_0x18edcd);}else{return _0x55b6ed(_0xf14365[_0x92b2('0x12')](0x1f5,_0x92b2('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x1df280){var _0x774af7=this;return new Promise(function(_0x2f970b,_0x1710f0){if(ami[_0x92b2('0x11')]()==![]){return _0x1710f0(_0x774af7[_0x92b2('0x12')](0x1f4,[config[_0x92b2('0x13')]['ip'],config[_0x92b2('0x13')][_0x92b2('0x1b')],_0x92b2('0x14')][_0x92b2('0x15')]('\x20')));}var _0x116c26=schema(properties[_0x92b2('0x72')])['validate'](_0x1df280);if(_0x116c26['length']>0x0){return _0x1710f0(_0x774af7['error'](0x1f4,_['map'](_0x116c26,_0x92b2('0x19'))[_0x92b2('0x15')](',\x20')));}var _0xca863=_['find'](_0x16c1b0[_0x92b2('0x71')],{'uniqueid':_0x1df280[_0x92b2('0x5c')]});if(_0xca863&&_0xca863[_0x92b2('0x6c')]){return ami[_0x92b2('0x18')]({'action':'Hangup','channel':_0xca863[_0x92b2('0x6c')]})[_0x92b2('0x1e')](function(_0x187dbb){_0x2f970b({'code':0xc8,'message':[_0x1df280[_0x92b2('0x5c')],_0x187dbb[_0x92b2('0x19')][_0x92b2('0x60')]()][_0x92b2('0x15')]('\x20')});})[_0x92b2('0x1a')](function(_0x8fcd9a){_0x1710f0(_0x774af7[_0x92b2('0x12')](0x1f5,[_0x1df280['uniqueid'],_0x8fcd9a[_0x92b2('0x19')][_0x92b2('0x60')]()]['join']('\x20')));});}else{return _0x1710f0(_0x774af7[_0x92b2('0x12')](0x1f5,_0x92b2('0x67')));}});},'VoiceQueuesChannelRedirect':function(_0x39f2c8){var _0xc6be47=this;return new Promise(function(_0x9c143c,_0x3cda7a){if(ami[_0x92b2('0x11')]()==![]){return _0x3cda7a(_0xc6be47[_0x92b2('0x12')](0x1f4,[config[_0x92b2('0x13')]['ip'],config[_0x92b2('0x13')][_0x92b2('0x1b')],_0x92b2('0x14')][_0x92b2('0x15')]('\x20')));}var _0x361cad=schema(properties[_0x92b2('0x73')])[_0x92b2('0x2')](_0x39f2c8);if(_0x361cad[_0x92b2('0x55')]>0x0){return _0x3cda7a(_0xc6be47['error'](0x1f4,_[_0x92b2('0x68')](_0x361cad,_0x92b2('0x19'))[_0x92b2('0x15')](',\x20')));}var _0x125851=_['find'](_0x16c1b0['queueChannels'],{'uniqueid':_0x39f2c8[_0x92b2('0x5c')]});if(_0x125851&&_0x125851['channel']){return ami[_0x92b2('0x18')]({'action':_0x92b2('0x74'),'channel':_0x125851[_0x92b2('0x6c')],'exten':_0x39f2c8[_0x92b2('0x75')],'context':_0x39f2c8[_0x92b2('0x76')]||_0x125851[_0x92b2('0x76')],'priority':0x1})[_0x92b2('0x1e')](function(_0x3d68b0){_0x9c143c({'code':0xc8,'message':[_0x39f2c8['uniqueid'],_0x3d68b0[_0x92b2('0x19')][_0x92b2('0x60')]()]['join']('\x20')});})[_0x92b2('0x1a')](function(_0x5dddec){_0x3cda7a(_0xc6be47[_0x92b2('0x12')](0x1f5,[_0x39f2c8['uniqueid'],_0x5dddec[_0x92b2('0x19')][_0x92b2('0x60')]()][_0x92b2('0x15')]('\x20')));});}else{return _0x3cda7a(_0xc6be47[_0x92b2('0x12')](0x1f5,_0x92b2('0x67')));}});},'Agents':function(_0xa8f72a){return new Promise(function(_0x2e5c07,_0x230506){var _0x4f1691=_[_0x92b2('0x58')](_0x16c1b0['agents']);_0x2e5c07({'count':_0x4f1691[_0x92b2('0x55')],'rows':_0x4f1691});});},'Telephones':function(_0x14321d){return new Promise(function(_0x2dfbb1,_0x55591){var _0x2f8308=_[_0x92b2('0x58')](_0x16c1b0[_0x92b2('0x77')]);_0x2dfbb1({'count':_0x2f8308['length'],'rows':_0x2f8308});});},'Trunks':function(_0xed7f70){return new Promise(function(_0xb35ba8,_0x29e9dd){var _0x251a11=_['values'](_0x16c1b0[_0x92b2('0x78')]);_0xb35ba8({'count':_0x251a11['length'],'rows':_0x251a11});});},'OutboundChannels':function(_0x3893ec){return new Promise(function(_0x11315a,_0x39ca7c){var _0x1cdce0=_[_0x92b2('0x58')](_0x16c1b0[_0x92b2('0x79')]);_0x11315a({'count':_0x1cdce0[_0x92b2('0x55')],'rows':_0x1cdce0});});},'Outbound':function(_0x254a11){return new Promise(function(_0x323d76,_0x5e9e49){_0x323d76(_0x16c1b0[_0x92b2('0x2a')]);});},'Campaigns':function(_0x7a3c04){return new Promise(function(_0x484b82,_0x382713){var _0x4bcb71=_[_0x92b2('0x58')](_0x16c1b0[_0x92b2('0x7a')]);_0x484b82({'count':_0x4bcb71[_0x92b2('0x55')],'rows':_0x4bcb71});});},'VoiceQueuesPreview':function(_0x42a0be){var _0x462d02=this;return new Promise(function(_0x56a002,_0x3ff15e){_0x3166e8[_0x92b2('0x7b')](_0x42a0be['id'])[_0x92b2('0x1e')](function(_0x36c190){_0x56a002({'code':0xc8,'message':_0x36c190[_0x92b2('0x19')]});})['catch'](function(_0x1ea1ff){_0x3ff15e(_0x462d02[_0x92b2('0x12')](0x1f4,_0x1ea1ff[_0x92b2('0x19')]));});});},'EventManager':function(_0x42b87b){var _0x14ae16=this;return new Promise(function(_0x23e666,_0x382ce0){if(!_0x42b87b[_0x92b2('0x7c')]){return _0x382ce0(_0x14ae16[_0x92b2('0x12')](0x1f4,_0x92b2('0x7d')));}ami['emit'](_0x92b2('0x7e')+_0x42b87b['event'],_0x42b87b[_0x92b2('0x19')]);_0x23e666({'code':0xc8,'message':_0x42b87b});});},'FaxAccounts':function(_0x32af40){return new Promise(function(_0x5d3db9,_0x3b37c1){var _0x4d7645=_[_0x92b2('0x58')](_0x16c1b0[_0x92b2('0x7f')]);_0x5d3db9({'count':_0x4d7645[_0x92b2('0x55')],'rows':_0x4d7645});});},'SendFax':function(_0x531127){var _0x13162e=this;return new Promise(function(_0x351e4d,_0x33f215){_0x47c522[_0x92b2('0x80')](_0x531127)[_0x92b2('0x1e')](function(_0xc05160){_0x351e4d({'code':0xc8,'message':_0xc05160['message']});})[_0x92b2('0x1a')](function(_0x13edf5){_0x33f215(_0x13162e['error'](0x1f4,_0x13edf5['message']));});});},'CheckAfterSend':function(_0x212999){var _0x3ae16a=this;return new Promise(function(_0xe16e90,_0x40c656){_0x47c522[_0x92b2('0x81')](_0x212999)[_0x92b2('0x1e')](function(_0x5bfa72){_0xe16e90({'code':0xc8,'message':_0x5bfa72[_0x92b2('0x19')]});})[_0x92b2('0x1a')](function(_0x294415){_0x40c656(_0x3ae16a[_0x92b2('0x12')](0x1f4,_0x294415['message']));});});}};var _0x4e558a=jayson['server'](_0x29f183)[_0x92b2('0x82')]();_0x4e558a['on'](_0x92b2('0x12'),function(_0x37fefc){return _0x536e21(_0x37fefc);});_0x4e558a[_0x92b2('0x7')](0x232a,'127.0.0.1',function(){console['log'](_0x92b2('0x83'),0x232a);return _0xb1d856(_0x92b2('0x84')+0x232a);});});}; \ No newline at end of file +var _0x781d=['erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','validate','map','channel','%s.%s','uniqueid','MixMonitor','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','resolve','StopMixMonitor','destinationchannel','stop','filename','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','campaigns','run','event','emit','custom:','faxAccounts','checkAfterSend','server','http','log','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','message','catch','error','username','join','command','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','sumDuration','talking','type','unmanaged','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var config=require(_0xd781('0x4'));var properties=require(_0xd781('0x5'));var ami=require(_0xd781('0x6'));exports[_0xd781('0x7')]=function(_0x446534,_0x1d4f4e,_0x830b){return new BPromise(function(_0x2f98ee,_0x5a07f0){var _0x133509={'QueuePause':function(_0x1a242d){return new Promise(function(_0x50610d,_0x248172){var _0x4b1a57=util[_0xd781('0x8')]('%s/%s',_0xd781('0x9'),_0x1a242d[_0xd781('0xa')]);if(_0x446534['timers']&&_0x446534[_0xd781('0xb')][_0x4b1a57]&&_0x446534[_0xd781('0xb')][_0x4b1a57]['timer']){_0x446534['timers'][_0x4b1a57][_0xd781('0xc')]();}if(_0x446534[_0xd781('0xd')][_0x4b1a57]){_0x446534[_0xd781('0xd')][_0x4b1a57][_0xd781('0xe')]({'statePause':_0x1a242d[_0xd781('0xf')]?!![]:![]});}_0x50610d({'code':0xc8,'message':_0xd781('0x10')});});},'Reload':function(_0xc7758f){var _0x3eb78=this;return new Promise(function(_0xb895a1,_0x12b1b2){if(ami[_0xd781('0x11')]()==![]){return _0x12b1b2(_0x3eb78['error'](0x1f4,[config[_0xd781('0x12')]['ip'],config[_0xd781('0x12')]['username'],_0xd781('0x13')]['join']('\x20')));}_0xc7758f=_[_0xd781('0x14')](_0xc7758f,_[_0xd781('0x15')](properties[_0xd781('0x16')]));_0xc7758f[_0xd781('0x17')]=_0xd781('0x18');return ami[_0xd781('0x19')](_0xc7758f)[_0xd781('0x1a')](function(_0x5770b0){_0xb895a1({'code':0xc8,'message':_0x5770b0[_0xd781('0x1b')]});})[_0xd781('0x1c')](function(_0x395d9c){_0x12b1b2(_0x3eb78[_0xd781('0x1d')](0x1f5,_0x395d9c[_0xd781('0x1b')]));});});},'Command':function(_0x35e1bb){var _0x260aa8=this;return new Promise(function(_0x1d6fc7,_0x5a5ff5){if(ami[_0xd781('0x11')]()==![]){return _0x5a5ff5(_0x260aa8[_0xd781('0x1d')](0x1f4,[config[_0xd781('0x12')]['ip'],config[_0xd781('0x12')][_0xd781('0x1e')],_0xd781('0x13')][_0xd781('0x1f')]('\x20')));}_0x35e1bb=_['pick'](_0x35e1bb,_0xd781('0x20'));_0x35e1bb['action']='Command';return ami[_0xd781('0x19')](_0x35e1bb)['then'](function(_0x175ba6){_0x1d6fc7({'code':0xc8,'message':_0x175ba6[_0xd781('0x21')]});})[_0xd781('0x1c')](function(_0x31bf57){_0x5a5ff5(_0x260aa8[_0xd781('0x1d')](0x1f5,_0x31bf57[_0xd781('0x1b')]));});});},'VoiceQueues':function(_0x221f14){return new Promise(function(_0x316d43,_0x10940b){var _0x5662db=[];for(var _0x529ca1 in _0x446534[_0xd781('0x22')]){if(_0x446534[_0xd781('0x22')][_0xd781('0x23')](_0x529ca1)){var _0x57b41e=_0x446534[_0xd781('0x22')][_0x529ca1];var _0x5a431b={'id':_0x57b41e['id'],'name':_0x57b41e['name'],'strategy':_0x57b41e[_0xd781('0x24')],'answered':_0x57b41e['answered'],'available':_0x57b41e[_0xd781('0x25')],'loggedIn':_0x57b41e[_0xd781('0x26')],'pTalking':_0x57b41e['pTalking'],'sumBillable':_0x57b41e['sumBillable'],'sumDuration':_0x57b41e[_0xd781('0x27')],'sumHoldTime':_0x57b41e['sumHoldTime']||0x0,'talking':_0x57b41e[_0xd781('0x28')],'total':_0x57b41e['total'],'type':_0x57b41e[_0xd781('0x29')],'unmanaged':_0x57b41e[_0xd781('0x2a')],'abandoned':_0x57b41e['abandoned'],'waiting':_0x57b41e['waiting'],'loggedInDb':_0x57b41e[_0xd781('0x2b')]};if(_0x57b41e[_0xd781('0x29')]===_0xd781('0x2c')){_0x5a431b['dialActive']=_0x57b41e['dialActive'];_0x5a431b[_0xd781('0x2d')]=_0x57b41e[_0xd781('0x2d')];_0x5a431b[_0xd781('0x2e')]=_0x57b41e['dialOriginateCallerIdName'];_0x5a431b['dialOriginateCallerIdNumber']=_0x57b41e[_0xd781('0x2f')];_0x5a431b[_0xd781('0x30')]=_0x57b41e['dialOriginateTimeout'];_0x5a431b[_0xd781('0x31')]=_0x57b41e[_0xd781('0x31')];_0x5a431b['temp']=_0x57b41e[_0xd781('0x32')];_0x5a431b[_0xd781('0x33')]=_0x57b41e[_0xd781('0x33')];_0x5a431b[_0xd781('0x34')]=_0x57b41e['outboundAnswerCallsDay'];_0x5a431b[_0xd781('0x35')]=_0x57b41e[_0xd781('0x35')];_0x5a431b[_0xd781('0x36')]=_0x57b41e[_0xd781('0x36')];_0x5a431b['outboundCongestionCallsDay']=_0x57b41e[_0xd781('0x37')];_0x5a431b[_0xd781('0x38')]=_0x57b41e['outboundDropCallsDayACS'];_0x5a431b[_0xd781('0x39')]=_0x57b41e['outboundDropCallsDayCallersExit'];_0x5a431b[_0xd781('0x3a')]=_0x57b41e[_0xd781('0x3a')];_0x5a431b['outboundNoAnswerCallsDay']=_0x57b41e[_0xd781('0x3b')];_0x5a431b[_0xd781('0x3c')]=_0x57b41e['outboundNoSuchCallsDay'];_0x5a431b[_0xd781('0x3d')]=_0x57b41e['outboundOriginateFailureCallsDay'];_0x5a431b[_0xd781('0x3e')]=_0x57b41e[_0xd781('0x3e')];_0x5a431b['outboundRejectCallsDay']=_0x57b41e[_0xd781('0x3f')];_0x5a431b[_0xd781('0x40')]=_0x57b41e['outboundUnknownCallsDay'];_0x5a431b[_0xd781('0x41')]=_0x57b41e[_0xd781('0x41')];_0x5a431b[_0xd781('0x42')]=_0x57b41e['predictiveIntervalAvgHoldtime'];_0x5a431b[_0xd781('0x43')]=_0x57b41e[_0xd781('0x43')];_0x5a431b[_0xd781('0x44')]=_0x57b41e[_0xd781('0x44')];_0x5a431b[_0xd781('0x45')]=_0x57b41e[_0xd781('0x45')];_0x5a431b[_0xd781('0x46')]=_0x57b41e[_0xd781('0x46')];_0x5a431b[_0xd781('0x47')]=_0x57b41e['predictiveIntervalErlangCallsDroppedCalls'];_0x5a431b[_0xd781('0x48')]=_0x57b41e['predictiveIntervalHitRate'];_0x5a431b[_0xd781('0x49')]=_0x57b41e[_0xd781('0x49')];_0x5a431b['predictiveIntervalPauses']=_0x57b41e[_0xd781('0x4a')];_0x5a431b[_0xd781('0x4b')]=_0x57b41e[_0xd781('0x4b')];_0x5a431b[_0xd781('0x4c')]=_0x57b41e['predictiveIntervalTotalCalls'];_0x5a431b[_0xd781('0x1b')]=_0x57b41e['message'];_0x5a431b[_0xd781('0x4d')]=_0x57b41e[_0xd781('0x4d')];_0x5a431b['erlangCalls']=_0x57b41e['erlangCalls'];_0x5a431b[_0xd781('0x4e')]=_0x57b41e[_0xd781('0x4e')];_0x5a431b[_0xd781('0x4f')]=_0x57b41e[_0xd781('0x4f')];_0x5a431b['erlangBusyFactor']=_0x57b41e[_0xd781('0x50')];_0x5a431b[_0xd781('0x51')]=_0x57b41e['startPredictive'];_0x5a431b['startProgressive']=_0x57b41e[_0xd781('0x52')];}if(_0x57b41e[_0xd781('0x53')]){_0x5a431b[_0xd781('0x53')]={'id':_0x57b41e['Trunk']['id'],'name':_0x57b41e['Trunk'][_0xd781('0xa')],'active':_0x57b41e[_0xd781('0x53')][_0xd781('0x54')],'callerid':_0x57b41e[_0xd781('0x53')][_0xd781('0x55')]};}if(_0x57b41e[_0xd781('0x56')]){_0x5a431b['Interval']={'id':_0x57b41e['Interval']['id'],'name':_0x57b41e[_0xd781('0x56')][_0xd781('0xa')]};}_0x5662db[_0xd781('0x57')](_0x5a431b);}}_0x316d43({'count':_0x5662db[_0xd781('0x58')],'rows':_0x5662db});});},'UpdateVoiceQueue':function(_0x10a6e4){return new Promise(function(_0x4e28e6,_0x1014e5){var _0x3746e3=_[_0xd781('0x59')](_0x446534['voiceQueues'],{'id':parseInt(_0x10a6e4['id'])});var _0x1009d5=_[_0xd781('0x5a')](_0x10a6e4,['id']);if(_0x3746e3){for(var _0x2f1f7a in _0x1009d5){if(typeof _0x1009d5[_0x2f1f7a]!=='undefined'&&typeof _0x3746e3[_0x2f1f7a]!==_0xd781('0x5b')){_0x3746e3[_0x2f1f7a]=_0x1009d5[_0x2f1f7a];}}_0x4e28e6(_0x3746e3);}else{_0x1014e5();}});},'VoiceChannels':function(_0x335b64){return new Promise(function(_0x54c2a3,_0x4fc5e9){var _0x13a907=_[_0xd781('0x5c')](_0x446534[_0xd781('0x5d')]);_0x54c2a3({'count':_0x13a907['length'],'rows':_0x13a907});});},'VoiceChannelMixMonitor':function(_0x2a251b){var _0x37e0bd=this;return new Promise(function(_0x3abfb2,_0x39ecdb){if(ami[_0xd781('0x11')]()==![]){return _0x39ecdb(_0x37e0bd[_0xd781('0x1d')](0x1f4,[config[_0xd781('0x12')]['ip'],config['asterisk'][_0xd781('0x1e')],_0xd781('0x13')][_0xd781('0x1f')]('\x20')));}var _0x4c7cb6=schema(properties[_0xd781('0x5e')])[_0xd781('0x5f')](_0x2a251b);if(_0x4c7cb6['length']>0x0){return _0x39ecdb(_0x37e0bd[_0xd781('0x1d')](0x1f4,_[_0xd781('0x60')](_0x4c7cb6,_0xd781('0x1b'))[_0xd781('0x1f')](',\x20')));}var _0x42a2f9=_['find'](_0x446534[_0xd781('0x5d')],{'uniqueid':_0x2a251b['uniqueid']});if(_0x42a2f9&&_0x42a2f9[_0xd781('0x61')]){var _0x556ea4=util[_0xd781('0x8')](_0xd781('0x62'),_0x2a251b['filename']||_0x2a251b[_0xd781('0x63')],_0x2a251b['format']||'wav');return ami['Action']({'action':_0xd781('0x64'),'channel':_0x42a2f9[_0xd781('0x61')],'file':_0x556ea4,'options':'ai(mixmonitorid)'})[_0xd781('0x1a')](function(_0x58becd){var _0x24b20f=_[_0xd781('0x59')](_0x42a2f9[_0xd781('0x65')],{'filename':_0xd781('0x66')+_0x556ea4['toLowerCase']()});if(_[_0xd781('0x67')](_0x24b20f)){_0x42a2f9['monitors'][_0xd781('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x556ea4[_0xd781('0x68')](),'createdAt':moment()[_0xd781('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x58becd[_0xd781('0x69')],'status':_0xd781('0x6a')});}else{_0x24b20f[_0xd781('0x69')]=_0x58becd[_0xd781('0x69')];_0x24b20f[_0xd781('0x6b')]=_0xd781('0x6a');}_0x3abfb2({'code':0xc8,'message':[_0x2a251b['uniqueid'],'MixMonitor\x20Success',_0x58becd[_0xd781('0x69')]][_0xd781('0x1f')]('\x20'),'mixmonitorid':_0x58becd[_0xd781('0x69')]});})[_0xd781('0x1c')](function(_0x5e995c){_0x39ecdb(_0x37e0bd[_0xd781('0x1d')](0x1f5,[_0x2a251b['uniqueid'],_0x5e995c[_0xd781('0x1b')][_0xd781('0x68')]()][_0xd781('0x1f')]('\x20')));});}else{return _0x39ecdb(_0x37e0bd[_0xd781('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x53dae6){var _0x41cb25=this;return new Promise(function(_0x567345,_0x17abb1){if(ami[_0xd781('0x11')]()==![]){return _0x17abb1(_0x41cb25[_0xd781('0x1d')](0x1f4,[config[_0xd781('0x12')]['ip'],config[_0xd781('0x12')]['username'],_0xd781('0x13')][_0xd781('0x1f')]('\x20')));}var _0x51a9dd=schema(properties[_0xd781('0x5e')])[_0xd781('0x5f')](_0x53dae6);if(_0x51a9dd[_0xd781('0x58')]>0x0){return _0x17abb1(_0x41cb25[_0xd781('0x1d')](0x1f4,_[_0xd781('0x60')](_0x51a9dd,_0xd781('0x1b'))[_0xd781('0x1f')](',\x20')));}var _0x12d2ab=_[_0xd781('0x59')](_0x446534[_0xd781('0x5d')],{'uniqueid':_0x53dae6[_0xd781('0x63')]});if(_0x12d2ab){return BPromise[_0xd781('0x6c')]()[_0xd781('0x1a')](function(){if(_0x12d2ab[_0xd781('0x61')]){return ami[_0xd781('0x19')]({'action':_0xd781('0x6d'),'channel':_0x12d2ab[_0xd781('0x61')],'mixmonitorid':_0x53dae6['mixmonitorid']})[_0xd781('0x1c')](function(_0x947f4c){});}})[_0xd781('0x1a')](function(){if(_0x12d2ab[_0xd781('0x6e')]){return ami[_0xd781('0x19')]({'action':'StopMixMonitor','channel':_0x12d2ab['destinationchannel'],'mixmonitorid':_0x53dae6[_0xd781('0x69')]})['catch'](function(_0x5846a2){});}})['then'](function(_0x4f2b3a){var _0x4150ce=_['find'](_0x12d2ab[_0xd781('0x65')],{'mixmonitorid':_0x53dae6[_0xd781('0x69')]});if(_0x4150ce){_0x4150ce[_0xd781('0x6b')]=_0xd781('0x6f');}})[_0xd781('0x1a')](function(){var _0x5480de=util[_0xd781('0x8')](_0xd781('0x62'),_0x53dae6[_0xd781('0x70')]||_0x53dae6[_0xd781('0x63')],_0x53dae6[_0xd781('0x8')]||_0xd781('0x71'));var _0x4ca9a0=_['find'](_0x12d2ab[_0xd781('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x5480de[_0xd781('0x68')]()});if(_0x4ca9a0){_0x4ca9a0[_0xd781('0x6b')]=_0xd781('0x6f');}})[_0xd781('0x1a')](function(){_0x567345({'code':0xc8,'message':[_0x53dae6['uniqueid'],_0xd781('0x72')][_0xd781('0x1f')]('\x20')});})[_0xd781('0x1c')](function(_0x267e03){_0x17abb1(_0x41cb25[_0xd781('0x1d')](0x1f5,[_0x53dae6['uniqueid'],_0x267e03[_0xd781('0x1b')]['toLowerCase']()][_0xd781('0x1f')]('\x20')));});}else{return _0x17abb1(_0x41cb25[_0xd781('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4d5c37){return new Promise(function(_0x15b7e6,_0xbf6d54){var _0x106cf3=_[_0xd781('0x5c')](_0x446534[_0xd781('0x73')]);_0x15b7e6({'count':_0x106cf3[_0xd781('0x58')],'rows':_0x106cf3});});},'VoiceQueuesChannel':function(_0x2e0401){var _0xcfeb63=this;return new Promise(function(_0x8250f,_0x4a493c){var _0x143fe7=schema(properties[_0xd781('0x74')])['validate'](_0x2e0401);if(_0x143fe7[_0xd781('0x58')]>0x0){return _0x4a493c(_0xcfeb63['error'](0x1f4,_[_0xd781('0x60')](_0x143fe7,_0xd781('0x1b'))['join'](',\x20')));}var _0x57184f=_[_0xd781('0x59')](_0x446534[_0xd781('0x73')],{'uniqueid':_0x2e0401[_0xd781('0x63')]});if(_0x57184f){_0x8250f(_0x57184f);}else{return _0x4a493c(_0xcfeb63[_0xd781('0x1d')](0x1f5,_0xd781('0x75')));}});},'VoiceQueuesChannelHangup':function(_0x45e2f1){var _0x5e71c9=this;return new Promise(function(_0x9523a0,_0xc8d5c1){if(ami[_0xd781('0x11')]()==![]){return _0xc8d5c1(_0x5e71c9[_0xd781('0x1d')](0x1f4,[config[_0xd781('0x12')]['ip'],config[_0xd781('0x12')][_0xd781('0x1e')],_0xd781('0x13')][_0xd781('0x1f')]('\x20')));}var _0x383f0d=schema(properties[_0xd781('0x76')])['validate'](_0x45e2f1);if(_0x383f0d[_0xd781('0x58')]>0x0){return _0xc8d5c1(_0x5e71c9['error'](0x1f4,_[_0xd781('0x60')](_0x383f0d,_0xd781('0x1b'))[_0xd781('0x1f')](',\x20')));}var _0x25731b=_[_0xd781('0x59')](_0x446534[_0xd781('0x73')],{'uniqueid':_0x45e2f1[_0xd781('0x63')]});if(_0x25731b&&_0x25731b[_0xd781('0x61')]){return ami[_0xd781('0x19')]({'action':_0xd781('0x77'),'channel':_0x25731b['channel']})[_0xd781('0x1a')](function(_0x4156d6){_0x9523a0({'code':0xc8,'message':[_0x45e2f1['uniqueid'],_0x4156d6[_0xd781('0x1b')][_0xd781('0x68')]()][_0xd781('0x1f')]('\x20')});})['catch'](function(_0x495ace){_0xc8d5c1(_0x5e71c9[_0xd781('0x1d')](0x1f5,[_0x45e2f1['uniqueid'],_0x495ace[_0xd781('0x1b')][_0xd781('0x68')]()][_0xd781('0x1f')]('\x20')));});}else{return _0xc8d5c1(_0x5e71c9[_0xd781('0x1d')](0x1f5,_0xd781('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x489139){var _0x73f18d=this;return new Promise(function(_0x415beb,_0xb07462){if(ami[_0xd781('0x11')]()==![]){return _0xb07462(_0x73f18d[_0xd781('0x1d')](0x1f4,[config[_0xd781('0x12')]['ip'],config[_0xd781('0x12')][_0xd781('0x1e')],_0xd781('0x13')][_0xd781('0x1f')]('\x20')));}var _0x47d6a3=schema(properties['voicequeuechannelredirect'])[_0xd781('0x5f')](_0x489139);if(_0x47d6a3[_0xd781('0x58')]>0x0){return _0xb07462(_0x73f18d['error'](0x1f4,_[_0xd781('0x60')](_0x47d6a3,_0xd781('0x1b'))[_0xd781('0x1f')](',\x20')));}var _0x557cbe=_[_0xd781('0x59')](_0x446534[_0xd781('0x73')],{'uniqueid':_0x489139['uniqueid']});if(_0x557cbe&&_0x557cbe[_0xd781('0x61')]){return ami['Action']({'action':_0xd781('0x78'),'channel':_0x557cbe[_0xd781('0x61')],'exten':_0x489139[_0xd781('0x79')],'context':_0x489139[_0xd781('0x7a')]||_0x557cbe[_0xd781('0x7a')],'priority':0x1})['then'](function(_0x4a5bde){_0x415beb({'code':0xc8,'message':[_0x489139[_0xd781('0x63')],_0x4a5bde[_0xd781('0x1b')][_0xd781('0x68')]()][_0xd781('0x1f')]('\x20')});})[_0xd781('0x1c')](function(_0x5b87b0){_0xb07462(_0x73f18d[_0xd781('0x1d')](0x1f5,[_0x489139[_0xd781('0x63')],_0x5b87b0['message'][_0xd781('0x68')]()][_0xd781('0x1f')]('\x20')));});}else{return _0xb07462(_0x73f18d['error'](0x1f5,_0xd781('0x75')));}});},'Agents':function(_0x612135){return new Promise(function(_0x44e8c9,_0x178b52){var _0x3414f6=_['values'](_0x446534['agents']);_0x44e8c9({'count':_0x3414f6['length'],'rows':_0x3414f6});});},'Telephones':function(_0x3224ed){return new Promise(function(_0x1fa149,_0x476023){var _0x423334=_[_0xd781('0x5c')](_0x446534[_0xd781('0x7b')]);_0x1fa149({'count':_0x423334[_0xd781('0x58')],'rows':_0x423334});});},'Trunks':function(_0x2da9fa){return new Promise(function(_0x2eef85,_0x4b8fc7){var _0x2c2217=_[_0xd781('0x5c')](_0x446534[_0xd781('0x7c')]);_0x2eef85({'count':_0x2c2217[_0xd781('0x58')],'rows':_0x2c2217});});},'OutboundChannels':function(_0x434d63){return new Promise(function(_0x5dccc5,_0x4a1907){var _0x529b3b=_[_0xd781('0x5c')](_0x446534['outboundChannels']);_0x5dccc5({'count':_0x529b3b[_0xd781('0x58')],'rows':_0x529b3b});});},'Outbound':function(_0x554500){return new Promise(function(_0x4dcba3,_0x524aaf){_0x4dcba3(_0x446534[_0xd781('0x2c')]);});},'Campaigns':function(_0x747d4a){return new Promise(function(_0x1e1af2,_0x3151d4){var _0x5b6163=_[_0xd781('0x5c')](_0x446534[_0xd781('0x7d')]);_0x1e1af2({'count':_0x5b6163[_0xd781('0x58')],'rows':_0x5b6163});});},'VoiceQueuesPreview':function(_0x297246){var _0x2837ba=this;return new Promise(function(_0x4f7ebd,_0x3d5f26){_0x1d4f4e[_0xd781('0x7e')](_0x297246['id'])['then'](function(_0x13709d){_0x4f7ebd({'code':0xc8,'message':_0x13709d[_0xd781('0x1b')]});})[_0xd781('0x1c')](function(_0x15857c){_0x3d5f26(_0x2837ba[_0xd781('0x1d')](0x1f4,_0x15857c[_0xd781('0x1b')]));});});},'EventManager':function(_0x289ecb){var _0x1b41b6=this;return new Promise(function(_0x517142,_0x48bde3){if(!_0x289ecb[_0xd781('0x7f')]){return _0x48bde3(_0x1b41b6[_0xd781('0x1d')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xd781('0x80')](_0xd781('0x81')+_0x289ecb['event'],_0x289ecb[_0xd781('0x1b')]);_0x517142({'code':0xc8,'message':_0x289ecb});});},'FaxAccounts':function(_0xe6b615){return new Promise(function(_0x5e14fe,_0x18f3dd){var _0x5bd9bc=_[_0xd781('0x5c')](_0x446534[_0xd781('0x82')]);_0x5e14fe({'count':_0x5bd9bc[_0xd781('0x58')],'rows':_0x5bd9bc});});},'SendFax':function(_0x52b9c6){var _0x5a2252=this;return new Promise(function(_0x356c56,_0x3d5db3){_0x830b['send'](_0x52b9c6)[_0xd781('0x1a')](function(_0x1ade1d){_0x356c56({'code':0xc8,'message':_0x1ade1d[_0xd781('0x1b')]});})[_0xd781('0x1c')](function(_0xb777fd){_0x3d5db3(_0x5a2252[_0xd781('0x1d')](0x1f4,_0xb777fd[_0xd781('0x1b')]));});});},'CheckAfterSend':function(_0x1780b8){var _0x532fd8=this;return new Promise(function(_0x1369f9,_0x1b8a4e){_0x830b[_0xd781('0x83')](_0x1780b8)[_0xd781('0x1a')](function(_0x89b7f2){_0x1369f9({'code':0xc8,'message':_0x89b7f2['message']});})[_0xd781('0x1c')](function(_0x194685){_0x1b8a4e(_0x532fd8[_0xd781('0x1d')](0x1f4,_0x194685[_0xd781('0x1b')]));});});}};var _0x253409=jayson[_0xd781('0x84')](_0x133509)[_0xd781('0x85')]();_0x253409['on']('error',function(_0x50907b){return _0x5a07f0(_0x50907b);});_0x253409['listen'](0x232a,'127.0.0.1',function(){console[_0xd781('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x2f98ee(_0xd781('0x87')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index d090c7c..c4704a3 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 _0x00bb=['length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridnum','calleridname','','Unknown','firstName','destcalleridname','[CM][%s][%s]\x20Contact\x20created:%s','push','format','action','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','defaults','redis','info','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','$or','map','destcalleridnum','lastName','mobile','fax','scheduledAt','union','resolve','then','isEmpty'];(function(_0x23059e,_0x44cbeb){var _0x2563e8=function(_0x117b2e){while(--_0x117b2e){_0x23059e['push'](_0x23059e['shift']());}};_0x2563e8(++_0x44cbeb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x00bb[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var Redis=require(_0xb00b('0x2'));var util=require('util');var config=require(_0xb00b('0x3'));var logger=require('../../../../config/logger')(_0xb00b('0x4'));var cmContactRpc=require(_0xb00b('0x5'));config['redis']=_[_0xb00b('0x6')](config[_0xb00b('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x36e363,_0xf737d0,_0x41dfc9,_0x37f07d,_0xfa4181){logger[_0xb00b('0x8')]('[CM][%s][%s]',_0x36e363,_0xf737d0['id'],_0x41dfc9,_0x37f07d,JSON['stringify'](_0xfa4181));io['to'](_0x41dfc9)[_0xb00b('0x9')](_0x37f07d,_0xfa4181);}exports[_0xb00b('0xa')]=function(_0x5851d4,_0x46a25c,_0x28d3cc,_0x48e125){var _0x3182db,_0x5a63ed;var _0x5a4fea={};var _0x594075=Number(_0x28d3cc[_0xb00b('0xb')]);var _0x2d8ddf=_0x28d3cc[_0xb00b('0xc')]?Boolean(Number(_0x28d3cc[_0xb00b('0xc')])):![];var _0xef5d52;var _0x1f1c1d=![];if(!_['isNil'](_0x28d3cc[_0xb00b('0xd')])){if(_0x28d3cc[_0xb00b('0xd')]=='1')_0x1f1c1d=!![];}if(!_0x1f1c1d){if(_0x48e125['xmd-contactid']){_0x5a4fea['id']=_0x48e125[_0xb00b('0xe')];}}if(!_0x5a4fea['id']){_0x5a4fea[_0xb00b('0xf')]=_0x594075;_0xef5d52=_0x28d3cc['data3']&&_0x28d3cc['data3']!=='0'?_0x28d3cc[_0xb00b('0x10')]['split'](','):['phone'];_0x5a4fea[_0xb00b('0x11')]=_[_0xb00b('0x12')](_0xef5d52,function(_0x387d97){var _0xbb72fc={};_0xbb72fc[_0x387d97]=_0x48e125['routeId']?_0x48e125[_0xb00b('0x13')]:_0x48e125['calleridnum'];return _0xbb72fc;});}var _0x415f91=['id','firstName',_0xb00b('0x14'),'phone',_0xb00b('0x15'),_0xb00b('0x16'),'ListId','createdAt',_0xb00b('0x17'),'updatedAt'];var _0x1344c4=_[_0xb00b('0x18')](_0x415f91,_0xef5d52);BPromise[_0xb00b('0x19')]()[_0xb00b('0x1a')](cmContactRpc['getContacts']({'attributes':_0x1344c4,'where':_0x5a4fea}))[_0xb00b('0x1a')](function(_0x4df284){_0x5a63ed=_0x4df284;if(!_[_0xb00b('0x1b')](_0x5a63ed)){if(_0x5a63ed[_0xb00b('0x1c')]===0x1){_0x3182db=_0x5a63ed[0x0];logger['info'](_0xb00b('0x1d'),_0x48e125[_0xb00b('0x1e')],_0x46a25c['id'],_0x3182db['id']);}else{logger['info'](_0xb00b('0x1f'),_0x48e125[_0xb00b('0x1e')],_0x46a25c['id'],_['map'](_0x5a63ed,'id')[_0xb00b('0x20')](','));}return;}else{logger[_0xb00b('0x8')](_0xb00b('0x21'),_0x48e125[_0xb00b('0x1e')],_0x46a25c['id']);var _0x520e55={'ListId':_0x594075};var _0x50be6c=_0x28d3cc[_0xb00b('0x22')]&&_0x28d3cc['data4']!=='0'?_0x28d3cc['data4']:'phone';if(_0x2d8ddf){logger[_0xb00b('0x8')](_0xb00b('0x23'),_0x48e125[_0xb00b('0x1e')],_0x46a25c['id']);_0x520e55[_0x50be6c]=_[_0xb00b('0x24')](_0x48e125[_0xb00b('0x25')])?_0x48e125[_0xb00b('0x26')]:_0x48e125[_0xb00b('0x13')];if(_['isNil'](_0x48e125[_0xb00b('0x25')])){_0x520e55['firstName']=_0x48e125[_0xb00b('0x27')]&&_0x48e125[_0xb00b('0x27')]!==_0xb00b('0x28')?_0x48e125['calleridname']:_0xb00b('0x29');}else{_0x520e55[_0xb00b('0x2a')]=_0x48e125[_0xb00b('0x2b')]&&_0x48e125[_0xb00b('0x2b')]!==_0xb00b('0x28')?_0x48e125[_0xb00b('0x2b')]:_0xb00b('0x29');}return BPromise[_0xb00b('0x19')]()[_0xb00b('0x1a')](cmContactRpc['createContact'](_0x520e55))[_0xb00b('0x1a')](function(_0x44918d){_0x3182db=_0x44918d;_0x5a63ed['push'](_0x44918d);if(_0x3182db){logger[_0xb00b('0x8')](_0xb00b('0x2c'),_0x48e125['uniqueid'],_0x46a25c['id'],_0x3182db['id']);}return;});}else{logger[_0xb00b('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x48e125[_0xb00b('0x1e')],_0x46a25c['id']);_0x520e55[_0x50be6c]=_[_0xb00b('0x24')](_0x48e125[_0xb00b('0x25')])?_0x48e125[_0xb00b('0x26')]:_0x48e125[_0xb00b('0x13')];if(_[_0xb00b('0x24')](_0x48e125[_0xb00b('0x25')])){_0x520e55['firstName']=_0x48e125['calleridname']&&_0x48e125['calleridname']!==_0xb00b('0x28')?_0x48e125[_0xb00b('0x27')]:_0xb00b('0x29');}else{_0x520e55[_0xb00b('0x2a')]=_0x48e125['destcalleridname']&&_0x48e125[_0xb00b('0x2b')]!==_0xb00b('0x28')?_0x48e125[_0xb00b('0x2b')]:_0xb00b('0x29');}_0x3182db=_0x520e55;_0x5a63ed[_0xb00b('0x2d')](_0x520e55);return;}}})[_0xb00b('0x1a')](function(){if(_0x5851d4){emit(_0x48e125[_0xb00b('0x1e')],_0x46a25c,util[_0xb00b('0x2e')]('user:%s',_0x5851d4['name']),util[_0xb00b('0x2e')]('trigger:%s',_0x28d3cc[_0xb00b('0x2f')][_0xb00b('0x30')]()),{'evt':_[_0xb00b('0x31')](_0x48e125,{'autoCreate':_0x2d8ddf}),'contact':_0x3182db===undefined?{}:_0x3182db,'contacts':_0x5a63ed[_0xb00b('0x1c')]===0x0?undefined:_0x5a63ed});}});}; \ No newline at end of file +var _0xbec5=['fax','scheduledAt','union','resolve','then','getContacts','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridnum','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','push','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','info','[CM][%s][%s]','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','map','routeId','firstName','phone','mobile'];(function(_0x247144,_0x44f6db){var _0x26788f=function(_0x52e744){while(--_0x52e744){_0x247144['push'](_0x247144['shift']());}};_0x26788f(++_0x44f6db);}(_0xbec5,0xe5));var _0x5bec=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xbec5[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require(_0x5bec('0x0'));var BPromise=require(_0x5bec('0x1'));var Redis=require('ioredis');var util=require(_0x5bec('0x2'));var config=require(_0x5bec('0x3'));var logger=require(_0x5bec('0x4'))(_0x5bec('0x5'));var cmContactRpc=require(_0x5bec('0x6'));config['redis']=_[_0x5bec('0x7')](config[_0x5bec('0x8')],{'host':_0x5bec('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bec('0x8')]));function emit(_0x28a427,_0x38456e,_0x406e65,_0x43d96e,_0x302aae){logger[_0x5bec('0xa')](_0x5bec('0xb'),_0x28a427,_0x38456e['id'],_0x406e65,_0x43d96e,JSON['stringify'](_0x302aae));io['to'](_0x406e65)[_0x5bec('0xc')](_0x43d96e,_0x302aae);}exports['exec']=function(_0x748f75,_0x2a70a7,_0x117162,_0x4a5482){var _0x288d1b,_0x18fa47;var _0x16226b={};var _0x57ffc4=Number(_0x117162[_0x5bec('0xd')]);var _0x1c888f=_0x117162['data2']?Boolean(Number(_0x117162[_0x5bec('0xe')])):![];var _0xaa984d;var _0x35393a=![];if(!_[_0x5bec('0xf')](_0x117162[_0x5bec('0x10')])){if(_0x117162[_0x5bec('0x10')]=='1')_0x35393a=!![];}if(!_0x35393a){if(_0x4a5482[_0x5bec('0x11')]){_0x16226b['id']=_0x4a5482[_0x5bec('0x11')];}}if(!_0x16226b['id']){_0x16226b[_0x5bec('0x12')]=_0x57ffc4;_0xaa984d=_0x117162[_0x5bec('0x13')]&&_0x117162[_0x5bec('0x13')]!=='0'?_0x117162[_0x5bec('0x13')][_0x5bec('0x14')](','):['phone'];_0x16226b['$or']=_[_0x5bec('0x15')](_0xaa984d,function(_0x773740){var _0x31ad9c={};_0x31ad9c[_0x773740]=_0x4a5482[_0x5bec('0x16')]?_0x4a5482['destcalleridnum']:_0x4a5482['calleridnum'];return _0x31ad9c;});}var _0x3cd354=['id',_0x5bec('0x17'),'lastName',_0x5bec('0x18'),_0x5bec('0x19'),_0x5bec('0x1a'),_0x5bec('0x12'),'createdAt',_0x5bec('0x1b'),'updatedAt'];var _0x191c0f=_[_0x5bec('0x1c')](_0x3cd354,_0xaa984d);BPromise[_0x5bec('0x1d')]()[_0x5bec('0x1e')](cmContactRpc[_0x5bec('0x1f')]({'attributes':_0x191c0f,'where':_0x16226b}))['then'](function(_0x232584){_0x18fa47=_0x232584;if(!_['isEmpty'](_0x18fa47)){if(_0x18fa47[_0x5bec('0x20')]===0x1){_0x288d1b=_0x18fa47[0x0];logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_0x288d1b['id']);}else{logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_[_0x5bec('0x15')](_0x18fa47,'id')[_0x5bec('0x22')](','));}return;}else{logger[_0x5bec('0xa')](_0x5bec('0x23'),_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id']);var _0x2dc014={'ListId':_0x57ffc4};var _0x4de66a=_0x117162['data4']&&_0x117162['data4']!=='0'?_0x117162[_0x5bec('0x24')]:_0x5bec('0x18');if(_0x1c888f){logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id']);_0x2dc014[_0x4de66a]=_[_0x5bec('0xf')](_0x4a5482['routeId'])?_0x4a5482[_0x5bec('0x25')]:_0x4a5482[_0x5bec('0x26')];if(_['isNil'](_0x4a5482['routeId'])){_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x27')]&&_0x4a5482[_0x5bec('0x27')]!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x27')]:_0x5bec('0x29');}else{_0x2dc014['firstName']=_0x4a5482[_0x5bec('0x2a')]&&_0x4a5482['destcalleridname']!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x2a')]:_0x5bec('0x29');}return BPromise[_0x5bec('0x1d')]()['then'](cmContactRpc[_0x5bec('0x2b')](_0x2dc014))[_0x5bec('0x1e')](function(_0xfc7d41){_0x288d1b=_0xfc7d41;_0x18fa47['push'](_0xfc7d41);if(_0x288d1b){logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_0x288d1b['id']);}return;});}else{logger[_0x5bec('0xa')](_0x5bec('0x2c'),_0x4a5482['uniqueid'],_0x2a70a7['id']);_0x2dc014[_0x4de66a]=_[_0x5bec('0xf')](_0x4a5482[_0x5bec('0x16')])?_0x4a5482['calleridnum']:_0x4a5482[_0x5bec('0x26')];if(_[_0x5bec('0xf')](_0x4a5482[_0x5bec('0x16')])){_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x27')]&&_0x4a5482['calleridname']!==_0x5bec('0x28')?_0x4a5482['calleridname']:_0x5bec('0x29');}else{_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x2a')]&&_0x4a5482[_0x5bec('0x2a')]!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x2a')]:'Unknown';}_0x288d1b=_0x2dc014;_0x18fa47[_0x5bec('0x2d')](_0x2dc014);return;}}})[_0x5bec('0x1e')](function(){if(_0x748f75){emit(_0x4a5482[_0x5bec('0x21')],_0x2a70a7,util['format'](_0x5bec('0x2e'),_0x748f75[_0x5bec('0x2f')]),util['format'](_0x5bec('0x30'),_0x117162['action'][_0x5bec('0x31')]()),{'evt':_[_0x5bec('0x32')](_0x4a5482,{'autoCreate':_0x1c888f}),'contact':_0x288d1b===undefined?{}:_0x288d1b,'contacts':_0x18fa47[_0x5bec('0x20')]===0x0?undefined:_0x18fa47});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2f866b9..2147db2 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 _0x51e1=['hasOwnProperty','status','checkTrigger','Actions','length','action','toLowerCase','contactmanager','browser','data1','popup','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winapp','winApplication','format','user:%s','name','trigger:%s:%s','merge','jscripty','integration','exec','accounts','queue','routeId','urlforward','parse','query','channel','AllConditions','AnyConditions','some','checkConditions','field','chat','value','ChatWebsiteId','upperFirst','AccountId','operator','message','event','agent','membername','lastevent','url','mustache','ioredis','./urlforward','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:closedinteraction','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','checkTriggers','interface'];(function(_0x18fbc6,_0x5385c7){var _0x19b95e=function(_0x5b17b6){while(--_0x5b17b6){_0x18fbc6['push'](_0x18fbc6['shift']());}};_0x19b95e(++_0x5385c7);}(_0x51e1,0x18f));var _0x151e=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0x51e1[_0x17c8cc];return _0x3db4eb;};'use strict';var util=require('util');var _=require('lodash');var url=require(_0x151e('0x0'));var Mustache=require(_0x151e('0x1'));var Redis=require(_0x151e('0x2'));var urlforward=require(_0x151e('0x3'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require('./script');var config=require('../../../config/environment');var logger=require(_0x151e('0x4'))(_0x151e('0x5'));var ami=require(_0x151e('0x6'));config[_0x151e('0x7')]=_[_0x151e('0x8')](config[_0x151e('0x7')],{'host':_0x151e('0x9'),'port':0x18eb});var io=require(_0x151e('0xa'))(new Redis(config[_0x151e('0x7')]));var operators={'equals':function(_0x1a2628,_0x1c55c9){return _0x1a2628==_0x1c55c9;},'not_equals':function(_0x32aae4,_0x4aba2c){return _0x32aae4!=_0x4aba2c;}};var barAndWebActions=['popup',_0x151e('0x0'),'winapp'];function Trigger(_0x3a81c4){this[_0x151e('0xb')]=_0x3a81c4['triggers'];this['agents']=_0x3a81c4[_0x151e('0xc')];this[_0x151e('0xd')]=_0x3a81c4[_0x151e('0xd')];this['templates']=_0x3a81c4[_0x151e('0xe')];this[_0x151e('0xf')]=_0x3a81c4[_0x151e('0xf')];this[_0x151e('0x10')]=_0x3a81c4[_0x151e('0x10')];this[_0x151e('0x11')]=_0x3a81c4[_0x151e('0x11')];this[_0x151e('0x12')]=_0x3a81c4[_0x151e('0x12')];this[_0x151e('0x13')]=_0x3a81c4['sugarcrmAccounts'];this[_0x151e('0x14')]=_0x3a81c4[_0x151e('0x14')];this[_0x151e('0x15')]=_0x3a81c4[_0x151e('0x15')];this[_0x151e('0x16')]=_0x3a81c4[_0x151e('0x16')];this[_0x151e('0x17')]=_0x3a81c4[_0x151e('0x17')];this['dynamics365Accounts']=_0x3a81c4['dynamics365Accounts'];this['freshsalesAccounts']=_0x3a81c4[_0x151e('0x18')];this['accounts']={'zendesk':this[_0x151e('0x10')],'salesforce':this[_0x151e('0x12')],'freshdesk':this[_0x151e('0x11')],'sugarcrm':this[_0x151e('0x13')],'zoho':this[_0x151e('0x14')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x151e('0x18')],'servicenow':this[_0x151e('0x17')]};ami['on'](_0x151e('0x19'),this[_0x151e('0x1a')][_0x151e('0x1b')](this));ami['on']('custom:agentconnect',this[_0x151e('0x1a')][_0x151e('0x1b')](this));ami['on'](_0x151e('0x1c'),this[_0x151e('0x1a')]['bind'](this));ami['on'](_0x151e('0x1d'),this['syncCustomEvent']['bind'](this));ami['on'](_0x151e('0x1e'),this['syncCustomEvent'][_0x151e('0x1b')](this));ami['on'](_0x151e('0x1f'),this['syncCustomEvent'][_0x151e('0x1b')](this));ami['on']('custom:agentbusy',this[_0x151e('0x1a')][_0x151e('0x1b')](this));ami['on'](_0x151e('0x20'),this[_0x151e('0x1a')][_0x151e('0x1b')](this));ami['on']('custom:agentreject',this[_0x151e('0x1a')][_0x151e('0x1b')](this));ami['on'](_0x151e('0x21'),this[_0x151e('0x1a')][_0x151e('0x1b')](this));ami['on'](_0x151e('0x22'),this['syncCustomEvent'][_0x151e('0x1b')](this));ami['on'](_0x151e('0x23'),this[_0x151e('0x1a')]['bind'](this));ami['on'](_0x151e('0x24'),this['syncAgentDial'][_0x151e('0x1b')](this));ami['on'](_0x151e('0x25'),this[_0x151e('0x26')][_0x151e('0x1b')](this));ami['on'](_0x151e('0x27'),this['syncAgentDial']['bind'](this));ami['on']('custom:newinteraction',this[_0x151e('0x1a')][_0x151e('0x1b')](this));ami['on'](_0x151e('0x28'),this[_0x151e('0x1a')][_0x151e('0x1b')](this));ami['on']('custom:incomingmessage',this[_0x151e('0x1a')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0x151e('0x1a')][_0x151e('0x1b')](this));ami['on'](_0x151e('0x29'),this['syncCustomEvent']['bind'](this));ami['on'](_0x151e('0x2a'),this[_0x151e('0x1a')][_0x151e('0x1b')](this));}Trigger[_0x151e('0x2b')][_0x151e('0x2c')]=function(_0x5b76c1,_0x597ac6,_0x2dbcc8){logger[_0x151e('0x2d')](_0x5b76c1,_0x597ac6,JSON[_0x151e('0x2e')](_0x2dbcc8));io['to'](_0x5b76c1)['emit'](_0x597ac6,_0x2dbcc8);};Trigger['prototype'][_0x151e('0x1a')]=function(_0x6e79f5){var _0x301674=_[_0x151e('0x2f')](_0x6e79f5);if(typeof _0x301674[_0x151e('0x30')]===_0x151e('0x31')){_0x301674[_0x151e('0x30')]=_0x151e('0x32');}this[_0x151e('0x33')](_0x301674);};Trigger[_0x151e('0x2b')][_0x151e('0x26')]=function(_0x151461){if(this[_0x151e('0xc')][_0x151461[_0x151e('0x34')]]){this[_0x151e('0x1a')](_0x151461);}};Trigger['prototype'][_0x151e('0x33')]=function(_0x4ce63c){var _0x11922f;for(var _0x3a10fd in this[_0x151e('0xb')]){if(this['triggers'][_0x151e('0x35')](_0x3a10fd)){if(this[_0x151e('0xb')][_0x3a10fd][_0x151e('0x36')]){_0x11922f=this[_0x151e('0x37')](this[_0x151e('0xb')][_0x3a10fd],_0x4ce63c);if(_0x11922f){_['merge'](_0x4ce63c,_0x4ce63c['variables']);for(var _0x71de7f=0x0,_0x5ce041,_0x257481,_0x300e16;_0x71de7f0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x4993e1,_0x2653cd){var _0x3c7229=function(_0x52ba1f){while(--_0x52ba1f){_0x4993e1['push'](_0x4993e1['shift']());}};_0x3c7229(++_0x2653cd);}(_0x55ca,0x126));var _0xa55c=function(_0x134058,_0x423995){_0x134058=_0x134058-0x0;var _0x14a1a9=_0x55ca[_0x134058];return _0x14a1a9;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f207447..a689eac 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 _0x15dc=['idField','indexOf','content','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','callDirection','queue','odata-entityid','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','socket.io-emitter','POST','password','then','error','toUpperCase',']\x20Wrong\x20credentials!','message','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','4.0','headers','substring','enduserId','catch','outbound','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid','forEach','includes','string','picklist','type','nameField','customField'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x15dc,0x91));var _0xc15d=function(_0x120900,_0x1b16c7){_0x120900=_0x120900-0x0;var _0x356528=_0x15dc[_0x120900];return _0x356528;};'use strict';var _=require('lodash');var BPromise=require(_0xc15d('0x0'));var rp=require(_0xc15d('0x1'));var util=require(_0xc15d('0x2'));var intUtil=require(_0xc15d('0x3'));var md5=require(_0xc15d('0x4'));var Redis=require(_0xc15d('0x5'));var logger=require(_0xc15d('0x6'))('dynamics365');var config=require(_0xc15d('0x7'));config[_0xc15d('0x8')]=_['defaults'](config[_0xc15d('0x8')],{'host':_0xc15d('0x9'),'port':0x18eb});var io=require(_0xc15d('0xa'))(new Redis(config[_0xc15d('0x8')]));function getAuthToken(_0x204f7e,_0x19386e,_0x298dae){var _0x28285e={'method':_0xc15d('0xb'),'uri':_0x19386e,'form':{'client_id':_0x204f7e['clientId'],'resource':_0x204f7e['remoteUri'],'username':_0x204f7e['username'],'password':_0x204f7e[_0xc15d('0xc')],'grant_type':'password','client_secret':_0x204f7e['clientSecret']},'json':!![]};return rp(_0x28285e)[_0xc15d('0xd')](function(_0x16800b){return _0x16800b['access_token'];})['catch'](function(_0x11a220){logger[_0xc15d('0xe')]('['+[_0x298dae[_0xc15d('0xf')]()]+_0xc15d('0x10'));return _0x11a220[_0xc15d('0x11')];});}function getUser(_0x41858e,_0x3d9ebd,_0x529acd,_0x2ded13,_0x5d2283,_0x4b3691){return new BPromise(function(_0x32dc69,_0x279707){return getAuthToken(_0x3d9ebd,_0x2ded13,_0x4b3691)[_0xc15d('0xd')](function(_0x428df5){var _0x18590a={'method':'GET','uri':_0x5d2283+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x428df5,'OData-Version':'4.0'},'json':!![]};return rp(_0x18590a);})['then'](function(_0x1dcfee){var _0x5e1e37=_0x1dcfee[_0xc15d('0x12')];var _0x35a4c5=![];var _0x2daa7e=null;if(!_[_0xc15d('0x13')](_0x529acd)){if(intUtil[_0xc15d('0x14')](_0x529acd[_0xc15d('0x15')])){_0x41858e[_0xc15d('0x16')]=_0x529acd[_0xc15d('0x15')];for(_0x2daa7e=0x0;_0x2daa7e<_0x5e1e37[_0xc15d('0x17')];_0x2daa7e++){if(_0x5e1e37[_0x2daa7e][_0xc15d('0x18')]===_0x529acd[_0xc15d('0x15')]&&!_0x5e1e37[_0x2daa7e][_0xc15d('0x19')]){_0x35a4c5=!![];logger[_0xc15d('0x1a')]('['+[_0x4b3691['toUpperCase']()]+_0xc15d('0x1b')+_0x5e1e37[_0x2daa7e][_0xc15d('0x1c')]+'!');_0x41858e[_0xc15d('0x1d')]=_0x5e1e37[_0x2daa7e][_0xc15d('0x1c')];}}}}if(!_0x35a4c5){logger[_0xc15d('0x1a')]('['+[_0x4b3691[_0xc15d('0xf')]()]+_0xc15d('0x1e'));_0x41858e[_0xc15d('0x16')]=_0x3d9ebd[_0xc15d('0x1f')];for(_0x2daa7e=0x0;_0x2daa7e<_0x5e1e37['length'];_0x2daa7e++){if(_0x5e1e37[_0x2daa7e]['internalemailaddress']===_0x3d9ebd['username']){_0x41858e[_0xc15d('0x1d')]=_0x5e1e37[_0x2daa7e][_0xc15d('0x1c')];}}}_0x32dc69(_0x41858e);})['catch'](function(_0x1c593a){_0x279707(_0x1c593a['message']);});});}function createEndUser(_0x531a7d,_0x4bc0fd,_0x583ea6,_0x3009bb,_0x1cbebc,_0x31592a){return new BPromise(function(_0x305ffa,_0x2ba399){return getAuthToken(_0x4bc0fd,_0x583ea6,_0x31592a)['then'](function(_0x4d0edb){var _0x2a2b64=_0x31592a[_0xc15d('0x20')]()==='outbound'?_0x1cbebc[_0xc15d('0x21')]:_0x1cbebc[_0xc15d('0x22')];var _0xada222={'method':'POST','uri':_0x3009bb+_0xc15d('0x23'),'body':{'telephone1':_0x2a2b64,'fullname':_0x2a2b64,'firstname':_0x2a2b64,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc15d('0x24')+_0x531a7d['userId']+')'},'headers':{'Authorization':_0xc15d('0x25')+_0x4d0edb,'OData-Version':_0xc15d('0x26')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xada222);})[_0xc15d('0xd')](function(_0x2319da){var _0x20b1f6=_0x2319da[_0xc15d('0x27')]['odata-entityid'];var _0x5ba760=_0x20b1f6[_0xc15d('0x28')](_0x20b1f6['lastIndexOf']('(')+0x1,_0x20b1f6['lastIndexOf'](')'));_0x531a7d[_0xc15d('0x29')]=_0x5ba760;_0x305ffa(_0x531a7d);})[_0xc15d('0x2a')](function(_0x86ebd3){_0x2ba399(_0x86ebd3[_0xc15d('0x11')]);});});}function getEndUser(_0x52263e,_0x1fb99e,_0x426152,_0x56c62e,_0x3f8993,_0x1f577e){return new BPromise(function(_0x381134,_0x3d9e62){var _0x164891=_0x1f577e[_0xc15d('0x20')]()===_0xc15d('0x2b')?_0x3f8993[_0xc15d('0x21')]:_0x3f8993[_0xc15d('0x22')];return getAuthToken(_0x1fb99e,_0x426152,_0x1f577e)['then'](function(_0x2c965e){var _0x229c3e={'method':_0xc15d('0x2c'),'uri':_0x56c62e+_0xc15d('0x2d')+_0x164891[_0xc15d('0x2e')]('+',_0xc15d('0x2f'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x2c965e,'If-None-Match':null,'OData-Version':_0xc15d('0x26')},'json':!![]};return rp(_0x229c3e);})['then'](function(_0x80f885){var _0x45fad5=null;if(_0x80f885){var _0x45a7e7=_0x80f885[_0xc15d('0x12')];var _0x5a4193=![];for(_0x45fad5=0x0;_0x45fad5<_0x45a7e7[_0xc15d('0x17')];_0x45fad5++){if(_0x45a7e7[_0x45fad5][_0xc15d('0x30')]===_0x164891){_0x5a4193=!![];_0x52263e[_0xc15d('0x29')]=_0x45a7e7[_0x45fad5][_0xc15d('0x31')];}}if(_0x5a4193){_0x381134(_0x52263e);}else{return createEndUser(_0x52263e,_0x1fb99e,_0x426152,_0x56c62e,_0x3f8993,_0x1f577e)[_0xc15d('0xd')](function(_0x2a2844){logger[_0xc15d('0x1a')]('['+[_0x1f577e['toUpperCase']()]+']\x20Enduser\x20created!',_0x2a2844['enduserId']);_0x381134(_0x2a2844);});}}else{return createEndUser(_0x52263e,_0x1fb99e,_0x426152,_0x56c62e,_0x3f8993,_0x1f577e)['then'](function(_0x57329c){logger['info']('['+[_0x1f577e[_0xc15d('0xf')]()]+']\x20Enduser\x20Created!',_0x57329c[_0xc15d('0x29')]);_0x381134(_0x57329c);});}});});}function getCustomFields(_0x2f0a28,_0x4c58d8,_0x1250c6){var _0x5b9c5d={};if(_0x2f0a28[_0xc15d('0x17')]>0x0){_[_0xc15d('0x32')](_0x2f0a28,function(_0x15e250){if(_[_0xc15d('0x33')]([_0xc15d('0x34'),_0xc15d('0x35')],_0x15e250[_0xc15d('0x36')])&&_0x15e250[_0xc15d('0x37')]&&!_0x15e250[_0xc15d('0x38')]){var _0x3d9f4f=_0x15e250[_0xc15d('0x39')][_0xc15d('0x20')]();var _0x2935e0=_0x3d9f4f[_0xc15d('0x28')](0x0,_0x3d9f4f[_0xc15d('0x3a')]('_'));var _0x8a244a=_0x3d9f4f[_0xc15d('0x28')](_0x3d9f4f[_0xc15d('0x3a')]('_')+0x1);if(_0x2935e0===_0x1250c6){_0x5b9c5d[_0x8a244a]=_0x15e250[_0xc15d('0x3b')];}}});}return _0x5b9c5d;}function getTicket(_0x291610,_0x37432a,_0x2d2d7b,_0x40733a,_0x5e602e,_0x256a72,_0xf913e9){return new BPromise(function(_0x5d6a49,_0x2c1970){var _0x477d28;return getAuthToken(_0x37432a,_0x2d2d7b,_0xf913e9)['then'](function(_0x4d8d9f){if(_0x256a72['ticketType']==='incident'){_0x477d28={'method':_0xc15d('0xb'),'uri':_0x40733a+_0xc15d('0x3c'),'body':Object[_0xc15d('0x3d')]({},{'title':intUtil[_0xc15d('0x3e')](_0x256a72[_0xc15d('0x3f')],_0x5e602e,'\x20'),'description':intUtil[_0xc15d('0x3e')](_0x256a72[_0xc15d('0x40')],_0x5e602e,'\x0a'),'customerid_contact@odata.bind':_0xc15d('0x41')+_0x291610[_0xc15d('0x29')]+')','ownerid@odata.bind':'/systemusers('+_0x291610[_0xc15d('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x256a72[_0xc15d('0x42')],_0x5e602e,_0x256a72[_0xc15d('0x43')])),'headers':{'Authorization':_0xc15d('0x25')+_0x4d8d9f,'OData-Version':_0xc15d('0x26')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x256a72[_0xc15d('0x43')]==='phonecall'){_0x477d28={'method':_0xc15d('0xb'),'uri':_0x40733a+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xc15d('0x3e')](_0x256a72[_0xc15d('0x3f')],_0x5e602e,'\x20'),'phonenumber':String(_0x5e602e['calleridnum']),'description':intUtil[_0xc15d('0x3e')](_0x256a72[_0xc15d('0x40')],_0x5e602e,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x291610['enduserId']+')','ownerid@odata.bind':_0xc15d('0x24')+_0x291610['userId']+')','directioncode':_0x291610[_0xc15d('0x44')]===_0xc15d('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xc15d('0x24')+_0x291610[_0xc15d('0x1d')]+')','participationtypemask':_0x291610[_0xc15d('0x44')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x291610['enduserId']+')','participationtypemask':_0x291610[_0xc15d('0x44')]===_0xc15d('0x45')?0x1:0x2}]},getCustomFields(_0x256a72['Fields'],_0x5e602e,_0x256a72[_0xc15d('0x43')])),'headers':{'Authorization':_0xc15d('0x25')+_0x4d8d9f,'OData-Version':_0xc15d('0x26')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x477d28);})[_0xc15d('0xd')](function(_0x2441ec){var _0x285103=_0x2441ec[_0xc15d('0x27')][_0xc15d('0x46')];var _0x733e55=_0x285103[_0xc15d('0x28')](_0x285103[_0xc15d('0x47')]('(')+0x1,_0x285103[_0xc15d('0x47')](')'));_0x291610[_0xc15d('0x48')]=_0x733e55;_0x5d6a49(_0x291610);})[_0xc15d('0x2a')](function(_0x3d4c8f){_0x2c1970(_0x3d4c8f[_0xc15d('0x11')]);});});}function emit(_0x9ea7c7,_0x4bdce9,_0x5108ea,_0x4ca07e){var _0x246367={'uri':util[_0xc15d('0x49')](_0xc15d('0x4a'),_0x9ea7c7,_0x5108ea,_0x4ca07e)};io['to'](util[_0xc15d('0x49')](_0xc15d('0x4b'),_0x4bdce9))[_0xc15d('0x4c')](_0xc15d('0x4d'),_0x246367);}exports['cs']=function(_0x5f5549,_0x57e1c5,_0x37dff1,_0xb81968,_0x357ca2,_0x13d085,_0x597e90,_0x1ab5a4){var _0x14a925={};_0x13d085[_0xc15d('0x4e')]=intUtil[_0xc15d('0x4f')](_0x13d085[_0xc15d('0x4e')]);_0x13d085[_0xc15d('0x50')]=intUtil['stripTrailingSlash'](_0x13d085[_0xc15d('0x50')]);_0x14a925[_0xc15d('0x44')]=_0x1ab5a4===_0xc15d('0x45')||_0x1ab5a4===_0xc15d('0x51')?'queue':_0xc15d('0x2b');var _0xbe47f0=util[_0xc15d('0x49')](_0xc15d('0x52'),_0x13d085[_0xc15d('0x4e')]);var _0x22eadd=util['format'](_0xc15d('0x53'),_0x13d085['tenantId']);var _0x62a3cc=util[_0xc15d('0x49')](_0xc15d('0x54'),_0x13d085[_0xc15d('0x50')],_0x57e1c5['uniqueid'],md5(_0x57e1c5[_0xc15d('0x55')]));if(_0x357ca2&&_0x357ca2[_0xc15d('0x56')]){logger[_0xc15d('0x1a')](_0xc15d('0x57'),_0xc15d('0x58'));_0x57e1c5['recordingURL']=_0x62a3cc;}else if(_0x597e90&&_0x597e90[_0xc15d('0x59')]&&_0x597e90['recordingFormat']!==_0xc15d('0x5a')){logger['info'](_0xc15d('0x5b'),_0xc15d('0x58'));_0x57e1c5[_0xc15d('0x5c')]=_0x62a3cc;}else{_0x57e1c5['recordingURL']='';}return getUser(_0x14a925,_0x13d085,_0xb81968,_0x22eadd,_0xbe47f0,_0x1ab5a4)[_0xc15d('0xd')](function(_0x47a306){logger[_0xc15d('0x1a')]('['+_0x1ab5a4[_0xc15d('0xf')]()+_0xc15d('0x5d'),_0x47a306[_0xc15d('0x1d')]);logger['info']('['+_0x1ab5a4[_0xc15d('0xf')]()+_0xc15d('0x5e'),_0x47a306['userEmail']);return getEndUser(_0x47a306,_0x13d085,_0x22eadd,_0xbe47f0,_0x57e1c5,_0x1ab5a4);})[_0xc15d('0xd')](function(_0xe1d9ae){logger[_0xc15d('0x1a')]('['+_0x1ab5a4[_0xc15d('0xf')]()+_0xc15d('0x5f'),_0xe1d9ae['enduserId']);logger[_0xc15d('0x1a')]('['+_0x1ab5a4[_0xc15d('0xf')]()+_0xc15d('0x60'),_0x57e1c5[_0xc15d('0x22')]);return getTicket(_0xe1d9ae,_0x13d085,_0x22eadd,_0xbe47f0,_0x57e1c5,_0x37dff1,_0x1ab5a4);})[_0xc15d('0xd')](function(_0x170f8f){logger[_0xc15d('0x1a')](util[_0xc15d('0x49')]('['+_0x1ab5a4[_0xc15d('0xf')]()+_0xc15d('0x61'),_0x37dff1[_0xc15d('0x43')],_0x170f8f[_0xc15d('0x48')]));logger[_0xc15d('0x1a')](util[_0xc15d('0x49')]('['+_0x1ab5a4[_0xc15d('0xf')]()+_0xc15d('0x62'),_0x1ab5a4));if(_0x1ab5a4!=='unmanaged'){logger[_0xc15d('0x1a')]('['+_0x1ab5a4[_0xc15d('0xf')]()+']',_0xc15d('0x63'));emit(_0x13d085['remoteUri'],_0xb81968[_0xc15d('0x64')],_0x37dff1[_0xc15d('0x43')],_0x170f8f[_0xc15d('0x48')]);}})[_0xc15d('0x2a')](function(_0x171bfb){logger[_0xc15d('0xe')]('['+_0x1ab5a4['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x171bfb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x01be=['recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','remoteUri','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','Bearer\x20','value','isNil','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','toLowerCase','outbound','4.0','substring','lastIndexOf','enduserId','calleridnum','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','customField','indexOf','content','ticketType','incident','POST','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','phonecall','phonecalls','callDirection','queue','headers','odata-entityid','ticketId','format','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x548f8c,_0x55245a){var _0x9827ac=function(_0x33e1a7){while(--_0x33e1a7){_0x548f8c['push'](_0x548f8c['shift']());}};_0x9827ac(++_0x55245a);}(_0x01be,0x136));var _0xe01b=function(_0x67b0ca,_0x235f9a){_0x67b0ca=_0x67b0ca-0x0;var _0x226329=_0x01be[_0x67b0ca];return _0x226329;};'use strict';var _=require(_0xe01b('0x0'));var BPromise=require(_0xe01b('0x1'));var rp=require(_0xe01b('0x2'));var util=require(_0xe01b('0x3'));var intUtil=require(_0xe01b('0x4'));var md5=require('md5');var Redis=require(_0xe01b('0x5'));var logger=require(_0xe01b('0x6'))('dynamics365');var config=require(_0xe01b('0x7'));config[_0xe01b('0x8')]=_[_0xe01b('0x9')](config[_0xe01b('0x8')],{'host':_0xe01b('0xa'),'port':0x18eb});var io=require(_0xe01b('0xb'))(new Redis(config['redis']));function getAuthToken(_0x31599c,_0x5ab7dc,_0xb847ad){var _0x428adb={'method':'POST','uri':_0x5ab7dc,'form':{'client_id':_0x31599c[_0xe01b('0xc')],'resource':_0x31599c[_0xe01b('0xd')],'username':_0x31599c['username'],'password':_0x31599c['password'],'grant_type':_0xe01b('0xe'),'client_secret':_0x31599c[_0xe01b('0xf')]},'json':!![]};return rp(_0x428adb)[_0xe01b('0x10')](function(_0x54dff2){return _0x54dff2[_0xe01b('0x11')];})[_0xe01b('0x12')](function(_0x34f0fd){logger[_0xe01b('0x13')]('['+[_0xb847ad[_0xe01b('0x14')]()]+_0xe01b('0x15'));return _0x34f0fd[_0xe01b('0x16')];});}function getUser(_0xd43915,_0x3e4b22,_0x49ed01,_0x21294e,_0x415fc2,_0x208f29){return new BPromise(function(_0x56778e,_0x2b17d4){return getAuthToken(_0x3e4b22,_0x21294e,_0x208f29)['then'](function(_0x232d83){var _0x4b6b4a={'method':'GET','uri':_0x415fc2+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xe01b('0x17')+_0x232d83,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b6b4a);})['then'](function(_0x1ece61){var _0x5536f3=_0x1ece61[_0xe01b('0x18')];var _0x67bf8c=![];var _0x35dca5=null;if(!_[_0xe01b('0x19')](_0x49ed01)){if(intUtil['validateEmail'](_0x49ed01[_0xe01b('0x1a')])){_0xd43915[_0xe01b('0x1b')]=_0x49ed01[_0xe01b('0x1a')];for(_0x35dca5=0x0;_0x35dca5<_0x5536f3[_0xe01b('0x1c')];_0x35dca5++){if(_0x5536f3[_0x35dca5]['internalemailaddress']===_0x49ed01['email']&&!_0x5536f3[_0x35dca5][_0xe01b('0x1d')]){_0x67bf8c=!![];logger[_0xe01b('0x1e')]('['+[_0x208f29[_0xe01b('0x14')]()]+_0xe01b('0x1f')+_0x5536f3[_0x35dca5][_0xe01b('0x20')]+'!');_0xd43915[_0xe01b('0x21')]=_0x5536f3[_0x35dca5][_0xe01b('0x20')];}}}}if(!_0x67bf8c){logger[_0xe01b('0x1e')]('['+[_0x208f29[_0xe01b('0x14')]()]+_0xe01b('0x22'));_0xd43915[_0xe01b('0x1b')]=_0x3e4b22[_0xe01b('0x23')];for(_0x35dca5=0x0;_0x35dca5<_0x5536f3[_0xe01b('0x1c')];_0x35dca5++){if(_0x5536f3[_0x35dca5][_0xe01b('0x24')]===_0x3e4b22[_0xe01b('0x23')]){_0xd43915[_0xe01b('0x21')]=_0x5536f3[_0x35dca5][_0xe01b('0x20')];}}}_0x56778e(_0xd43915);})[_0xe01b('0x12')](function(_0x327b5d){_0x2b17d4(_0x327b5d[_0xe01b('0x16')]);});});}function createEndUser(_0x540acf,_0x46822f,_0x5c83f6,_0x266938,_0x599b5a,_0x52741f){return new BPromise(function(_0x11940c,_0x224d49){return getAuthToken(_0x46822f,_0x5c83f6,_0x52741f)[_0xe01b('0x10')](function(_0x23b586){var _0x460d16=_0x52741f[_0xe01b('0x25')]()===_0xe01b('0x26')?_0x599b5a['destcalleridnum']:_0x599b5a['calleridnum'];var _0x48da7f={'method':'POST','uri':_0x266938+'contacts','body':{'telephone1':_0x460d16,'fullname':_0x460d16,'firstname':_0x460d16,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x540acf[_0xe01b('0x21')]+')'},'headers':{'Authorization':_0xe01b('0x17')+_0x23b586,'OData-Version':_0xe01b('0x27')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x48da7f);})[_0xe01b('0x10')](function(_0x4a8a38){var _0x4ccf01=_0x4a8a38['headers']['odata-entityid'];var _0x59e2f1=_0x4ccf01[_0xe01b('0x28')](_0x4ccf01['lastIndexOf']('(')+0x1,_0x4ccf01[_0xe01b('0x29')](')'));_0x540acf[_0xe01b('0x2a')]=_0x59e2f1;_0x11940c(_0x540acf);})[_0xe01b('0x12')](function(_0x47cce6){_0x224d49(_0x47cce6[_0xe01b('0x16')]);});});}function getEndUser(_0x856f29,_0x19a6b9,_0x3a7823,_0x13d5c4,_0x1aff54,_0x55e481){return new BPromise(function(_0x434046,_0x5a6f2f){var _0x5aa153=_0x55e481[_0xe01b('0x25')]()===_0xe01b('0x26')?_0x1aff54['destcalleridnum']:_0x1aff54[_0xe01b('0x2b')];return getAuthToken(_0x19a6b9,_0x3a7823,_0x55e481)[_0xe01b('0x10')](function(_0x14ea91){var _0x55e11a={'method':_0xe01b('0x2c'),'uri':_0x13d5c4+_0xe01b('0x2d')+_0x5aa153[_0xe01b('0x2e')]('+','%2b')+'\x27','headers':{'Authorization':_0xe01b('0x17')+_0x14ea91,'If-None-Match':null,'OData-Version':_0xe01b('0x27')},'json':!![]};return rp(_0x55e11a);})['then'](function(_0x2fc10e){var _0x45ab0f=null;if(_0x2fc10e){var _0x15217a=_0x2fc10e['value'];var _0xd97023=![];for(_0x45ab0f=0x0;_0x45ab0f<_0x15217a['length'];_0x45ab0f++){if(_0x15217a[_0x45ab0f][_0xe01b('0x2f')]===_0x5aa153){_0xd97023=!![];_0x856f29[_0xe01b('0x2a')]=_0x15217a[_0x45ab0f]['contactid'];}}if(_0xd97023){_0x434046(_0x856f29);}else{return createEndUser(_0x856f29,_0x19a6b9,_0x3a7823,_0x13d5c4,_0x1aff54,_0x55e481)[_0xe01b('0x10')](function(_0x4ed05e){logger[_0xe01b('0x1e')]('['+[_0x55e481['toUpperCase']()]+_0xe01b('0x30'),_0x4ed05e[_0xe01b('0x2a')]);_0x434046(_0x4ed05e);});}}else{return createEndUser(_0x856f29,_0x19a6b9,_0x3a7823,_0x13d5c4,_0x1aff54,_0x55e481)[_0xe01b('0x10')](function(_0x169854){logger[_0xe01b('0x1e')]('['+[_0x55e481[_0xe01b('0x14')]()]+_0xe01b('0x31'),_0x169854[_0xe01b('0x2a')]);_0x434046(_0x169854);});}});});}function getCustomFields(_0x41446c,_0x1b1286,_0x425c2e){var _0x55cb85={};if(_0x41446c[_0xe01b('0x1c')]>0x0){_[_0xe01b('0x32')](_0x41446c,function(_0x5e5151){if(_[_0xe01b('0x33')]([_0xe01b('0x34'),_0xe01b('0x35')],_0x5e5151['type'])&&_0x5e5151['nameField']&&!_0x5e5151[_0xe01b('0x36')]){var _0x12b52b=_0x5e5151['idField'][_0xe01b('0x25')]();var _0x1932ce=_0x12b52b[_0xe01b('0x28')](0x0,_0x12b52b[_0xe01b('0x37')]('_'));var _0x24e5a2=_0x12b52b['substring'](_0x12b52b['indexOf']('_')+0x1);if(_0x1932ce===_0x425c2e){_0x55cb85[_0x24e5a2]=_0x5e5151[_0xe01b('0x38')];}}});}return _0x55cb85;}function getTicket(_0x46c582,_0x1128c9,_0x4d51b1,_0xf992a3,_0x576faa,_0x356111,_0x5df112){return new BPromise(function(_0x4507bf,_0x543aed){var _0x48eab6;return getAuthToken(_0x1128c9,_0x4d51b1,_0x5df112)[_0xe01b('0x10')](function(_0x2eeb02){if(_0x356111[_0xe01b('0x39')]===_0xe01b('0x3a')){_0x48eab6={'method':_0xe01b('0x3b'),'uri':_0xf992a3+_0xe01b('0x3c'),'body':Object[_0xe01b('0x3d')]({},{'title':intUtil[_0xe01b('0x3e')](_0x356111[_0xe01b('0x3f')],_0x576faa,'\x20'),'description':intUtil[_0xe01b('0x3e')](_0x356111[_0xe01b('0x40')],_0x576faa,'\x0a'),'customerid_contact@odata.bind':_0xe01b('0x41')+_0x46c582[_0xe01b('0x2a')]+')','ownerid@odata.bind':_0xe01b('0x42')+_0x46c582[_0xe01b('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x356111['Fields'],_0x576faa,_0x356111[_0xe01b('0x39')])),'headers':{'Authorization':_0xe01b('0x17')+_0x2eeb02,'OData-Version':_0xe01b('0x27')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x356111[_0xe01b('0x39')]===_0xe01b('0x43')){_0x48eab6={'method':_0xe01b('0x3b'),'uri':_0xf992a3+_0xe01b('0x44'),'body':Object[_0xe01b('0x3d')]({},{'subject':intUtil[_0xe01b('0x3e')](_0x356111['Subjects'],_0x576faa,'\x20'),'phonenumber':String(_0x576faa[_0xe01b('0x2b')]),'description':intUtil['getString'](_0x356111['Descriptions'],_0x576faa,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x46c582[_0xe01b('0x2a')]+')','ownerid@odata.bind':_0xe01b('0x42')+_0x46c582[_0xe01b('0x21')]+')','directioncode':_0x46c582[_0xe01b('0x45')]===_0xe01b('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xe01b('0x42')+_0x46c582[_0xe01b('0x21')]+')','participationtypemask':_0x46c582[_0xe01b('0x45')]===_0xe01b('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0xe01b('0x41')+_0x46c582[_0xe01b('0x2a')]+')','participationtypemask':_0x46c582[_0xe01b('0x45')]===_0xe01b('0x46')?0x1:0x2}]},getCustomFields(_0x356111['Fields'],_0x576faa,_0x356111['ticketType'])),'headers':{'Authorization':_0xe01b('0x17')+_0x2eeb02,'OData-Version':_0xe01b('0x27')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x48eab6);})[_0xe01b('0x10')](function(_0x5df2be){var _0xa04590=_0x5df2be[_0xe01b('0x47')][_0xe01b('0x48')];var _0x2eb385=_0xa04590[_0xe01b('0x28')](_0xa04590[_0xe01b('0x29')]('(')+0x1,_0xa04590[_0xe01b('0x29')](')'));_0x46c582[_0xe01b('0x49')]=_0x2eb385;_0x4507bf(_0x46c582);})['catch'](function(_0x237bf6){_0x543aed(_0x237bf6['message']);});});}function emit(_0x1897d0,_0x3db203,_0xbdaa58,_0x325387){var _0x330812={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1897d0,_0xbdaa58,_0x325387)};io['to'](util[_0xe01b('0x4a')](_0xe01b('0x4b'),_0x3db203))[_0xe01b('0x4c')](_0xe01b('0x4d'),_0x330812);}exports['cs']=function(_0x27d349,_0x19212e,_0xd8246e,_0x59d2dc,_0x5aae00,_0x4515e5,_0x2c9d8e,_0x2e7bc2){var _0x1c8196={};_0x4515e5[_0xe01b('0xd')]=intUtil['stripTrailingSlash'](_0x4515e5['remoteUri']);_0x4515e5[_0xe01b('0x4e')]=intUtil[_0xe01b('0x4f')](_0x4515e5['serverUrl']);_0x1c8196['callDirection']=_0x2e7bc2==='queue'||_0x2e7bc2===_0xe01b('0x50')?_0xe01b('0x46'):_0xe01b('0x26');var _0x481c06=util[_0xe01b('0x4a')](_0xe01b('0x51'),_0x4515e5[_0xe01b('0xd')]);var _0x27d88d=util[_0xe01b('0x4a')](_0xe01b('0x52'),_0x4515e5[_0xe01b('0x53')]);var _0x3a2458=util['format'](_0xe01b('0x54'),_0x4515e5[_0xe01b('0x4e')],_0x19212e[_0xe01b('0x55')],md5(_0x19212e[_0xe01b('0x55')]));if(_0x5aae00&&_0x5aae00[_0xe01b('0x56')]){logger['info'](_0xe01b('0x57'),_0xe01b('0x58'));_0x19212e[_0xe01b('0x59')]=_0x3a2458;}else if(_0x2c9d8e&&_0x2c9d8e[_0xe01b('0x5a')]&&_0x2c9d8e[_0xe01b('0x5a')]!=='none'){logger['info'](_0xe01b('0x5b'),'Recording\x20is\x20enabled!');_0x19212e[_0xe01b('0x59')]=_0x3a2458;}else{_0x19212e[_0xe01b('0x59')]='';}return getUser(_0x1c8196,_0x4515e5,_0x59d2dc,_0x27d88d,_0x481c06,_0x2e7bc2)[_0xe01b('0x10')](function(_0x4abb57){logger[_0xe01b('0x1e')]('['+_0x2e7bc2['toUpperCase']()+_0xe01b('0x5c'),_0x4abb57[_0xe01b('0x21')]);logger[_0xe01b('0x1e')]('['+_0x2e7bc2['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x4abb57[_0xe01b('0x1b')]);return getEndUser(_0x4abb57,_0x4515e5,_0x27d88d,_0x481c06,_0x19212e,_0x2e7bc2);})[_0xe01b('0x10')](function(_0x18aa45){logger['info']('['+_0x2e7bc2[_0xe01b('0x14')]()+_0xe01b('0x5d'),_0x18aa45[_0xe01b('0x2a')]);logger[_0xe01b('0x1e')]('['+_0x2e7bc2[_0xe01b('0x14')]()+_0xe01b('0x5e'),_0x19212e['calleridnum']);return getTicket(_0x18aa45,_0x4515e5,_0x27d88d,_0x481c06,_0x19212e,_0xd8246e,_0x2e7bc2);})[_0xe01b('0x10')](function(_0xedc501){logger['info'](util[_0xe01b('0x4a')]('['+_0x2e7bc2[_0xe01b('0x14')]()+_0xe01b('0x5f'),_0xd8246e[_0xe01b('0x39')],_0xedc501['ticketId']));logger[_0xe01b('0x1e')](util[_0xe01b('0x4a')]('['+_0x2e7bc2[_0xe01b('0x14')]()+_0xe01b('0x60'),_0x2e7bc2));if(_0x2e7bc2!=='unmanaged'){logger[_0xe01b('0x1e')]('['+_0x2e7bc2[_0xe01b('0x14')]()+']',_0xe01b('0x61'));emit(_0x4515e5[_0xe01b('0xd')],_0x59d2dc[_0xe01b('0x62')],_0xd8246e[_0xe01b('0x39')],_0xedc501['ticketId']);}})[_0xe01b('0x12')](function(_0x2c153f){logger[_0xe01b('0x13')]('['+_0x2e7bc2[_0xe01b('0x14')]()+_0xe01b('0x63'),util['inspect'](_0x2c153f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 65624e6..70d4231 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 _0x2a03=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','customField','nameField','toLowerCase','content','picklist','idField','push','type','variableName','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','catch','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','calleridname','error','lodash','request-promise','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email'];(function(_0x494262,_0x47b898){var _0x40e96d=function(_0x3176e9){while(--_0x3176e9){_0x494262['push'](_0x494262['shift']());}};_0x40e96d(++_0x47b898);}(_0x2a03,0x14c));var _0x32a0=function(_0x47b63a,_0x3a3c6f){_0x47b63a=_0x47b63a-0x0;var _0x19e9ce=_0x2a03[_0x47b63a];return _0x19e9ce;};'use strict';var _=require(_0x32a0('0x0'));var rp=require(_0x32a0('0x1'));var md5=require(_0x32a0('0x2'));var util=require(_0x32a0('0x3'));var Redis=require(_0x32a0('0x4'));var intUtil=require(_0x32a0('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x32a0('0x6'));config[_0x32a0('0x7')]=_[_0x32a0('0x8')](config[_0x32a0('0x7')],{'host':_0x32a0('0x9'),'port':0x18eb});var io=require(_0x32a0('0xa'))(new Redis(config[_0x32a0('0x7')]));var headers={'Content-Type':_0x32a0('0xb'),'Accept':_0x32a0('0xb')};function emit(_0x2afc44,_0x49aa18,_0xf29404){io['to'](_0x2afc44)['emit'](_0x49aa18,_0xf29404);}function getTicket(_0xb63fa0,_0x48e151,_0xf9d50f,_0x51bcd6,_0x3ff19a){logger[_0x32a0('0xc')](_0x32a0('0xd'));var _0x4739a3=_['merge']({'responder_id':_0x48e151['id'],'requester_id':_0xf9d50f['id'],'name':util[_0x32a0('0xe')](_0x32a0('0xf'),_0x3ff19a['calleridname']),'phone':_0x3ff19a[_0x32a0('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x32a0('0x11')](_0x51bcd6[_0x32a0('0x12')],_0x3ff19a,'\x20'),'description':intUtil[_0x32a0('0x11')](_0x51bcd6['Descriptions'],_0x3ff19a,'
'),'tags':getTags(_0x51bcd6[_0x32a0('0x13')],_0x32a0('0x14'))},getCustomFields(_0x51bcd6[_0x32a0('0x15')],_0x3ff19a));_0x4739a3[_0x32a0('0x16')]=_[_0x32a0('0x17')](_['keyBy'](_0x4739a3[_0x32a0('0x16')],'id'),_0x32a0('0x18'));return request({'uri':util[_0x32a0('0xe')](_0x32a0('0x19'),_0xb63fa0[_0x32a0('0x1a')]),'method':_0x32a0('0x1b'),'body':_0x4739a3})[_0x32a0('0x1c')](function(_0x26b150){logger['info'](_0x32a0('0x1d'));return _0x26b150;});}function getUser(_0x1f4494,_0x4bfb72){if(intUtil[_0x32a0('0x1e')](_0x4bfb72)){return request({'uri':util[_0x32a0('0xe')](_0x32a0('0x1f'),_0x1f4494[_0x32a0('0x1a')]),'qs':{'email':_0x4bfb72}})[_0x32a0('0x1c')](function(_0x3659a){if(_0x3659a['length']){logger[_0x32a0('0xc')](_0x32a0('0x20'));return _[_0x32a0('0x21')](_0x3659a,function(_0x2977a5){return _0x2977a5[_0x32a0('0x22')][_0x32a0('0x23')]===_0x4bfb72;});}else{logger[_0x32a0('0xc')](_0x32a0('0x24'));return request({'uri':util['format'](_0x32a0('0x25'),_0x1f4494['remoteUri'])})[_0x32a0('0x1c')](function(_0x48bfd3){logger['info']('Admin\x20account\x20selected.');return _0x48bfd3;});}});}else{logger[_0x32a0('0xc')](_0x32a0('0x26'));return request({'uri':util['format'](_0x32a0('0x25'),_0x1f4494['remoteUri'])})[_0x32a0('0x1c')](function(_0x3eb7f0){logger['info']('Admin\x20account\x20selected.');return _0x3eb7f0;});}}function getEndUser(_0x5f5b5c,_0x26a058,_0x4c1c53){logger['info'](_0x32a0('0x27'),_0x4c1c53);return request({'uri':util[_0x32a0('0xe')](_0x32a0('0x28'),_0x5f5b5c['remoteUri']),'qs':{'phone':_0x4c1c53}})[_0x32a0('0x1c')](function(_0x3e692d){if(_0x3e692d[_0x32a0('0x29')]){logger[_0x32a0('0xc')](_0x32a0('0x2a'));return _[_0x32a0('0x21')](_0x3e692d,{'phone':_0x4c1c53});}else{logger[_0x32a0('0xc')](_0x32a0('0x2b'));return request({'uri':util[_0x32a0('0xe')](_0x32a0('0x28'),_0x5f5b5c[_0x32a0('0x1a')]),'method':_0x32a0('0x1b'),'body':{'name':_0x26a058,'phone':_0x4c1c53}})['then'](function(_0x46a2ec){logger[_0x32a0('0xc')]('Enduser\x20created.');return _0x46a2ec;});}});}function getAuth(_0x149608){return util['format'](_0x32a0('0x2c'),new Buffer(_0x149608[_0x32a0('0x2d')]+':X')[_0x32a0('0x2e')](_0x32a0('0x2f')));}function request(_0x304af1){logger[_0x32a0('0x30')](_0x32a0('0x31'),JSON[_0x32a0('0x32')](_0x304af1));return rp(_[_0x32a0('0x8')](_0x304af1,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4d3c0a,_0x984587){var _0x16b86f=[];if(_0x4d3c0a&&_0x4d3c0a[_0x32a0('0x29')]>0x0){_0x16b86f=_[_0x32a0('0x33')](_0x4d3c0a,_0x984587);}return _0x16b86f;}function getCustomFields(_0x5f34c1,_0x2029f0){var _0x4057b7=[];var _0x52e55e={'custom_fields':[]};if(_0x5f34c1[_0x32a0('0x29')]>0x0){_[_0x32a0('0x34')](_0x5f34c1,function(_0x3c84af){if(_[_0x32a0('0x35')]([_0x32a0('0x36'),'picklist'],_0x3c84af['type'])&&_0x3c84af['nameField']&&!_0x3c84af[_0x32a0('0x37')]){_0x52e55e[_0x3c84af[_0x32a0('0x38')][_0x32a0('0x39')]()]=_0x3c84af[_0x32a0('0x3a')][_0x32a0('0x2e')]();}else if(_['includes']([_0x32a0('0x36'),_0x32a0('0x3b')],_0x3c84af['type'])&&_0x3c84af[_0x32a0('0x3c')]&&_0x3c84af['customField']){_0x52e55e[_0x32a0('0x16')][_0x32a0('0x3d')]({'id':_0x3c84af[_0x32a0('0x3c')],'value':_0x3c84af[_0x32a0('0x3a')][_0x32a0('0x2e')]()});}else if(_0x3c84af[_0x32a0('0x3e')]==='variable'&&_0x3c84af[_0x32a0('0x3f')]&&_0x3c84af['idField']&&_0x3c84af['customField']){_0x2029f0[_0x3c84af['variableName']]&&_0x52e55e['custom_fields'][_0x32a0('0x3d')]({'id':_0x3c84af[_0x32a0('0x3c')],'value':_0x2029f0[_0x3c84af['variableName']][_0x32a0('0x2e')]()});}else if(_0x3c84af[_0x32a0('0x3e')]===_0x32a0('0x40')&&_0x3c84af['Variable']&&_0x3c84af[_0x32a0('0x41')][_0x32a0('0x14')]&&_0x3c84af[_0x32a0('0x3c')]&&_0x3c84af[_0x32a0('0x37')]){_0x2029f0[_0x3c84af[_0x32a0('0x41')]['name'][_0x32a0('0x39')]()]&&_0x52e55e[_0x32a0('0x16')][_0x32a0('0x3d')]({'id':_0x3c84af[_0x32a0('0x3c')],'value':_0x2029f0[_0x3c84af[_0x32a0('0x41')][_0x32a0('0x14')][_0x32a0('0x39')]()]['toString']()});}});}return _0x52e55e;}exports['queue']=function(_0x2a2376,_0x791135,_0xb54f6a,_0x3f3b7a,_0x1b8e9e,_0x5bb899){var _0x4e4156,_0x444422;_0x5bb899[_0x32a0('0x1a')]=intUtil['stripTrailingSlash'](_0x5bb899['remoteUri']);_0x5bb899[_0x32a0('0x42')]=intUtil[_0x32a0('0x43')](_0x5bb899[_0x32a0('0x42')]);if(_0x1b8e9e&&_0x1b8e9e[_0x32a0('0x44')]){logger[_0x32a0('0xc')](_0x32a0('0x45'),'Recording\x20is\x20enabled!');_0x791135[_0x32a0('0x46')]=util[_0x32a0('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5bb899[_0x32a0('0x42')],_0x791135[_0x32a0('0x47')],md5(_0x791135['uniqueid']));}else{_0x791135[_0x32a0('0x46')]='';}headers[_0x32a0('0x48')]=getAuth(_0x5bb899);return getUser(_0x5bb899,_0x3f3b7a[_0x32a0('0x23')])[_0x32a0('0x1c')](function(_0x41502c){_0x4e4156=_0x41502c;logger[_0x32a0('0xc')]('The\x20User\x20ID\x20is:',_0x4e4156['id']);return getEndUser(_0x5bb899,_0x791135['calleridname'],_0x791135[_0x32a0('0x10')]);})[_0x32a0('0x1c')](function(_0x50c25a){_0x444422=_0x50c25a;logger[_0x32a0('0xc')]('The\x20Enduser\x20ID\x20is:',_0x444422['id']);return getTicket(_0x5bb899,_0x4e4156,_0x444422,_0xb54f6a,_0x791135);})[_0x32a0('0x1c')](function(_0x5cefc3){if(_0x5cefc3&&_0x5cefc3['id']){logger[_0x32a0('0xc')](_0x32a0('0x1d'));logger[_0x32a0('0xc')](_0x32a0('0x49'),_0x5cefc3['id']);logger[_0x32a0('0xc')]('[QUEUE]',_0x32a0('0x4a'));emit(util[_0x32a0('0xe')](_0x32a0('0x4b'),_0x3f3b7a['name']),_0x32a0('0x4c'),{'uri':util[_0x32a0('0xe')](_0x32a0('0x4d'),_0x5bb899[_0x32a0('0x1a')],_0x5cefc3['id'])});}})['catch'](function(_0x4bb5c6){logger['error']('[QUEUE]',JSON[_0x32a0('0x32')](_0x4bb5c6));});};exports[_0x32a0('0x4e')]=function(_0x5be3a1,_0x3d206d,_0x2aae3c,_0xe2210f,_0x5c2325,_0x4ec58c,_0xa71780){var _0x48bf4e,_0x4e3dc6;_0x4ec58c[_0x32a0('0x1a')]=intUtil['stripTrailingSlash'](_0x4ec58c[_0x32a0('0x1a')]);_0x4ec58c[_0x32a0('0x42')]=intUtil[_0x32a0('0x43')](_0x4ec58c[_0x32a0('0x42')]);if(_0xa71780&&_0xa71780[_0x32a0('0x4f')]&&_0xa71780[_0x32a0('0x4f')]!=='none'){logger['info'](_0x32a0('0x50'),'Recording\x20is\x20enabled!');_0x3d206d[_0x32a0('0x46')]=util[_0x32a0('0xe')](_0x32a0('0x51'),_0x4ec58c[_0x32a0('0x42')],_0x3d206d['uniqueid'],md5(_0x3d206d[_0x32a0('0x47')]));}headers[_0x32a0('0x48')]=getAuth(_0x4ec58c);return getUser(_0x4ec58c,_0xe2210f[_0x32a0('0x23')])[_0x32a0('0x1c')](function(_0xe2871a){_0x48bf4e=_0xe2871a;logger[_0x32a0('0xc')]('The\x20User\x20ID\x20is:',_0x48bf4e['id']);return getEndUser(_0x4ec58c,_0x3d206d[_0x32a0('0x52')],_0x3d206d[_0x32a0('0x53')]);})[_0x32a0('0x1c')](function(_0x2e532a){_0x4e3dc6=_0x2e532a;logger['info'](_0x32a0('0x54'),_0x4e3dc6['id']);return getTicket(_0x4ec58c,_0x48bf4e,_0x4e3dc6,_0x2aae3c,_0x3d206d);})[_0x32a0('0x1c')](function(_0x196183){if(_0x196183&&_0x196183['id']){logger[_0x32a0('0xc')](_0x32a0('0x1d'));logger[_0x32a0('0xc')](_0x32a0('0x49'),_0x196183['id']);logger[_0x32a0('0xc')](_0x32a0('0x50'),_0x32a0('0x4a'));emit(util[_0x32a0('0xe')](_0x32a0('0x4b'),_0xe2210f[_0x32a0('0x14')]),_0x32a0('0x4c'),{'uri':util['format'](_0x32a0('0x4d'),_0x4ec58c[_0x32a0('0x1a')],_0x196183['id'])});}})[_0x32a0('0x55')](function(_0xab85d){logger['error']('[OUTBOUND]',JSON[_0x32a0('0x32')](_0xab85d));});};exports[_0x32a0('0x56')]=function(_0x431dca,_0x30f3f6,_0x411d98,_0x5f3897,_0x579972,_0x3534cb){var _0x4e1705,_0x1b57c7;_0x3534cb[_0x32a0('0x1a')]=intUtil[_0x32a0('0x43')](_0x3534cb[_0x32a0('0x1a')]);_0x3534cb[_0x32a0('0x42')]=intUtil['stripTrailingSlash'](_0x3534cb['serverUrl']);if(_0x579972&&_0x579972[_0x32a0('0x44')]){logger[_0x32a0('0xc')]('['+_0x30f3f6[_0x32a0('0x57')][_0x32a0('0x58')]()+']','Recording\x20is\x20enabled!');_0x30f3f6['recordingURL']=util[_0x32a0('0xe')](_0x32a0('0x51'),_0x3534cb[_0x32a0('0x42')],_0x30f3f6[_0x32a0('0x47')],md5(_0x30f3f6[_0x32a0('0x47')]));}else{_0x30f3f6['recordingURL']='';}headers[_0x32a0('0x48')]=getAuth(_0x3534cb);return getUser(_0x3534cb,'')['then'](function(_0xba80f8){_0x4e1705=_0xba80f8;logger[_0x32a0('0xc')](_0x32a0('0x59'),_0x4e1705['id']);return getEndUser(_0x3534cb,_0x30f3f6[_0x32a0('0x5a')],_0x30f3f6[_0x32a0('0x10')]);})['then'](function(_0x3ad6f6){_0x1b57c7=_0x3ad6f6;logger[_0x32a0('0xc')](_0x32a0('0x54'),_0x1b57c7['id']);return getTicket(_0x3534cb,_0x4e1705,_0x1b57c7,_0x411d98,_0x30f3f6);})[_0x32a0('0x1c')](function(_0x124cb0){if(_0x124cb0){logger[_0x32a0('0xc')](_0x32a0('0x1d'));logger[_0x32a0('0xc')](_0x32a0('0x49'),_0x124cb0['id']);}})[_0x32a0('0x55')](function(_0xd240f9){logger[_0x32a0('0x5b')]('['+_0x30f3f6[_0x32a0('0x57')]['toUpperCase']()+']',JSON[_0x32a0('0x32')](_0xd240f9));});}; \ No newline at end of file +var _0x5585=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','info','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','forEach','includes','type','nameField','customField','content','picklist','idField','variable','variableName','push','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x17b0db,_0x165158){var _0x3f26bc=function(_0x50c85d){while(--_0x50c85d){_0x17b0db['push'](_0x17b0db['shift']());}};_0x3f26bc(++_0x165158);}(_0x5585,0xcb));var _0x5558=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5585[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5558('0x0'));var rp=require(_0x5558('0x1'));var md5=require(_0x5558('0x2'));var util=require(_0x5558('0x3'));var Redis=require('ioredis');var intUtil=require(_0x5558('0x4'));var config=require(_0x5558('0x5'));var logger=require(_0x5558('0x6'))(_0x5558('0x7'));config[_0x5558('0x8')]=_[_0x5558('0x9')](config[_0x5558('0x8')],{'host':_0x5558('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5558('0x8')]));var headers={'Content-Type':_0x5558('0xb'),'Accept':_0x5558('0xb')};function emit(_0x2bd4ab,_0x1516e7,_0x4e5a90){io['to'](_0x2bd4ab)[_0x5558('0xc')](_0x1516e7,_0x4e5a90);}function getTicket(_0x57563e,_0x4601a9,_0x4f472b,_0xc7fc18,_0x22c1fb){logger['info'](_0x5558('0xd'));var _0x982770=_[_0x5558('0xe')]({'responder_id':_0x4601a9['id'],'requester_id':_0x4f472b['id'],'name':util[_0x5558('0xf')]('Caller\x20-\x20%s',_0x22c1fb['calleridname']),'phone':_0x22c1fb[_0x5558('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5558('0x11')](_0xc7fc18[_0x5558('0x12')],_0x22c1fb,'\x20'),'description':intUtil['getString'](_0xc7fc18[_0x5558('0x13')],_0x22c1fb,_0x5558('0x14')),'tags':getTags(_0xc7fc18['Tags'],_0x5558('0x15'))},getCustomFields(_0xc7fc18[_0x5558('0x16')],_0x22c1fb));_0x982770[_0x5558('0x17')]=_['mapValues'](_[_0x5558('0x18')](_0x982770[_0x5558('0x17')],'id'),_0x5558('0x19'));return request({'uri':util['format'](_0x5558('0x1a'),_0x57563e['remoteUri']),'method':'POST','body':_0x982770})['then'](function(_0x1e8a44){logger[_0x5558('0x1b')]('Ticket\x20created!');return _0x1e8a44;});}function getUser(_0x29ef25,_0x490633){if(intUtil[_0x5558('0x1c')](_0x490633)){return request({'uri':util['format'](_0x5558('0x1d'),_0x29ef25[_0x5558('0x1e')]),'qs':{'email':_0x490633}})[_0x5558('0x1f')](function(_0x2301f0){if(_0x2301f0[_0x5558('0x20')]){logger[_0x5558('0x1b')](_0x5558('0x21'));return _['find'](_0x2301f0,function(_0x46ef6b){return _0x46ef6b[_0x5558('0x22')][_0x5558('0x23')]===_0x490633;});}else{logger[_0x5558('0x1b')](_0x5558('0x24'));return request({'uri':util[_0x5558('0xf')](_0x5558('0x25'),_0x29ef25[_0x5558('0x1e')])})[_0x5558('0x1f')](function(_0x29955b){logger[_0x5558('0x1b')]('Admin\x20account\x20selected.');return _0x29955b;});}});}else{logger[_0x5558('0x1b')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5558('0xf')]('%s/api/v2/agents/me',_0x29ef25[_0x5558('0x1e')])})[_0x5558('0x1f')](function(_0x2d5924){logger[_0x5558('0x1b')](_0x5558('0x26'));return _0x2d5924;});}}function getEndUser(_0x346fad,_0x272923,_0x35c19a){logger['info'](_0x5558('0x27'),_0x35c19a);return request({'uri':util[_0x5558('0xf')](_0x5558('0x28'),_0x346fad[_0x5558('0x1e')]),'qs':{'phone':_0x35c19a}})[_0x5558('0x1f')](function(_0x31f90e){if(_0x31f90e[_0x5558('0x20')]){logger[_0x5558('0x1b')](_0x5558('0x29'));return _[_0x5558('0x2a')](_0x31f90e,{'phone':_0x35c19a});}else{logger[_0x5558('0x1b')](_0x5558('0x2b'));return request({'uri':util[_0x5558('0xf')](_0x5558('0x28'),_0x346fad[_0x5558('0x1e')]),'method':_0x5558('0x2c'),'body':{'name':_0x272923,'phone':_0x35c19a}})[_0x5558('0x1f')](function(_0x22ba18){logger['info'](_0x5558('0x2d'));return _0x22ba18;});}});}function getAuth(_0x909c5){return util['format'](_0x5558('0x2e'),new Buffer(_0x909c5['apiKey']+':X')[_0x5558('0x2f')](_0x5558('0x30')));}function request(_0x58011b){logger[_0x5558('0x31')]('[HTTP]',JSON[_0x5558('0x32')](_0x58011b));return rp(_['defaults'](_0x58011b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5eb1e8,_0x401d99){var _0x5ca9c5=[];if(_0x5eb1e8&&_0x5eb1e8[_0x5558('0x20')]>0x0){_0x5ca9c5=_['map'](_0x5eb1e8,_0x401d99);}return _0x5ca9c5;}function getCustomFields(_0x38ce94,_0x4f4c7f){var _0x14985b=[];var _0x26f9e4={'custom_fields':[]};if(_0x38ce94[_0x5558('0x20')]>0x0){_[_0x5558('0x33')](_0x38ce94,function(_0x1135a4){if(_[_0x5558('0x34')](['string','picklist'],_0x1135a4[_0x5558('0x35')])&&_0x1135a4[_0x5558('0x36')]&&!_0x1135a4[_0x5558('0x37')]){_0x26f9e4[_0x1135a4['nameField']['toLowerCase']()]=_0x1135a4[_0x5558('0x38')][_0x5558('0x2f')]();}else if(_['includes'](['string',_0x5558('0x39')],_0x1135a4[_0x5558('0x35')])&&_0x1135a4[_0x5558('0x3a')]&&_0x1135a4[_0x5558('0x37')]){_0x26f9e4['custom_fields']['push']({'id':_0x1135a4[_0x5558('0x3a')],'value':_0x1135a4[_0x5558('0x38')][_0x5558('0x2f')]()});}else if(_0x1135a4['type']===_0x5558('0x3b')&&_0x1135a4[_0x5558('0x3c')]&&_0x1135a4[_0x5558('0x3a')]&&_0x1135a4[_0x5558('0x37')]){_0x4f4c7f[_0x1135a4[_0x5558('0x3c')]]&&_0x26f9e4['custom_fields'][_0x5558('0x3d')]({'id':_0x1135a4[_0x5558('0x3a')],'value':_0x4f4c7f[_0x1135a4[_0x5558('0x3c')]][_0x5558('0x2f')]()});}else if(_0x1135a4[_0x5558('0x35')]==='customVariable'&&_0x1135a4[_0x5558('0x3e')]&&_0x1135a4[_0x5558('0x3e')][_0x5558('0x15')]&&_0x1135a4['idField']&&_0x1135a4['customField']){_0x4f4c7f[_0x1135a4['Variable']['name']['toLowerCase']()]&&_0x26f9e4[_0x5558('0x17')][_0x5558('0x3d')]({'id':_0x1135a4[_0x5558('0x3a')],'value':_0x4f4c7f[_0x1135a4[_0x5558('0x3e')][_0x5558('0x15')][_0x5558('0x3f')]()][_0x5558('0x2f')]()});}});}return _0x26f9e4;}exports[_0x5558('0x40')]=function(_0x26ad8a,_0x326874,_0x360135,_0x595a89,_0x350bb9,_0x1dac7f){var _0xee03b7,_0x50ec1e;_0x1dac7f[_0x5558('0x1e')]=intUtil[_0x5558('0x41')](_0x1dac7f['remoteUri']);_0x1dac7f[_0x5558('0x42')]=intUtil['stripTrailingSlash'](_0x1dac7f['serverUrl']);if(_0x350bb9&&_0x350bb9[_0x5558('0x43')]){logger['info'](_0x5558('0x44'),_0x5558('0x45'));_0x326874['recordingURL']=util[_0x5558('0xf')](_0x5558('0x46'),_0x1dac7f['serverUrl'],_0x326874['uniqueid'],md5(_0x326874[_0x5558('0x47')]));}else{_0x326874[_0x5558('0x48')]='';}headers[_0x5558('0x49')]=getAuth(_0x1dac7f);return getUser(_0x1dac7f,_0x595a89[_0x5558('0x23')])[_0x5558('0x1f')](function(_0x3e7811){_0xee03b7=_0x3e7811;logger[_0x5558('0x1b')](_0x5558('0x4a'),_0xee03b7['id']);return getEndUser(_0x1dac7f,_0x326874['calleridname'],_0x326874[_0x5558('0x10')]);})[_0x5558('0x1f')](function(_0x40a898){_0x50ec1e=_0x40a898;logger[_0x5558('0x1b')](_0x5558('0x4b'),_0x50ec1e['id']);return getTicket(_0x1dac7f,_0xee03b7,_0x50ec1e,_0x360135,_0x326874);})[_0x5558('0x1f')](function(_0x2bd2b){if(_0x2bd2b&&_0x2bd2b['id']){logger[_0x5558('0x1b')](_0x5558('0x4c'));logger[_0x5558('0x1b')](_0x5558('0x4d'),_0x2bd2b['id']);logger['info'](_0x5558('0x44'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5558('0x4e'),_0x595a89['name']),'trigger:browser:url',{'uri':util['format'](_0x5558('0x4f'),_0x1dac7f[_0x5558('0x1e')],_0x2bd2b['id'])});}})[_0x5558('0x50')](function(_0x2e9960){logger[_0x5558('0x51')](_0x5558('0x44'),JSON['stringify'](_0x2e9960));});};exports[_0x5558('0x52')]=function(_0x50daa1,_0x55f76c,_0xe88281,_0x4d4ac7,_0x22ee5b,_0x1c660f,_0x5518cf){var _0xd2eeb1,_0xb99477;_0x1c660f[_0x5558('0x1e')]=intUtil[_0x5558('0x41')](_0x1c660f['remoteUri']);_0x1c660f[_0x5558('0x42')]=intUtil['stripTrailingSlash'](_0x1c660f[_0x5558('0x42')]);if(_0x5518cf&&_0x5518cf[_0x5558('0x53')]&&_0x5518cf[_0x5558('0x53')]!=='none'){logger['info']('[OUTBOUND]',_0x5558('0x45'));_0x55f76c[_0x5558('0x48')]=util['format'](_0x5558('0x46'),_0x1c660f[_0x5558('0x42')],_0x55f76c['uniqueid'],md5(_0x55f76c[_0x5558('0x47')]));}headers[_0x5558('0x49')]=getAuth(_0x1c660f);return getUser(_0x1c660f,_0x4d4ac7[_0x5558('0x23')])[_0x5558('0x1f')](function(_0x1b35b6){_0xd2eeb1=_0x1b35b6;logger[_0x5558('0x1b')](_0x5558('0x4a'),_0xd2eeb1['id']);return getEndUser(_0x1c660f,_0x55f76c['destcalleridname'],_0x55f76c[_0x5558('0x54')]);})[_0x5558('0x1f')](function(_0x1965a2){_0xb99477=_0x1965a2;logger['info']('The\x20Enduser\x20ID\x20is:',_0xb99477['id']);return getTicket(_0x1c660f,_0xd2eeb1,_0xb99477,_0xe88281,_0x55f76c);})['then'](function(_0x244f12){if(_0x244f12&&_0x244f12['id']){logger[_0x5558('0x1b')](_0x5558('0x4c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x244f12['id']);logger[_0x5558('0x1b')](_0x5558('0x55'),_0x5558('0x56'));emit(util[_0x5558('0xf')](_0x5558('0x4e'),_0x4d4ac7[_0x5558('0x15')]),'trigger:browser:url',{'uri':util['format'](_0x5558('0x4f'),_0x1c660f[_0x5558('0x1e')],_0x244f12['id'])});}})['catch'](function(_0x334459){logger['error'](_0x5558('0x55'),JSON[_0x5558('0x32')](_0x334459));});};exports[_0x5558('0x57')]=function(_0x18a457,_0xc82323,_0x9dbd0f,_0x5dc6bf,_0x270233,_0x49a2de){var _0x3ac1d3,_0x49890a;_0x49a2de[_0x5558('0x1e')]=intUtil[_0x5558('0x41')](_0x49a2de[_0x5558('0x1e')]);_0x49a2de['serverUrl']=intUtil[_0x5558('0x41')](_0x49a2de[_0x5558('0x42')]);if(_0x270233&&_0x270233[_0x5558('0x43')]){logger[_0x5558('0x1b')]('['+_0xc82323[_0x5558('0x58')][_0x5558('0x59')]()+']',_0x5558('0x45'));_0xc82323['recordingURL']=util[_0x5558('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49a2de['serverUrl'],_0xc82323['uniqueid'],md5(_0xc82323['uniqueid']));}else{_0xc82323['recordingURL']='';}headers['Authorization']=getAuth(_0x49a2de);return getUser(_0x49a2de,'')[_0x5558('0x1f')](function(_0x3e3438){_0x3ac1d3=_0x3e3438;logger[_0x5558('0x1b')](_0x5558('0x4a'),_0x3ac1d3['id']);return getEndUser(_0x49a2de,_0xc82323[_0x5558('0x5a')],_0xc82323['calleridnum']);})[_0x5558('0x1f')](function(_0x69f939){_0x49890a=_0x69f939;logger[_0x5558('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x49890a['id']);return getTicket(_0x49a2de,_0x3ac1d3,_0x49890a,_0x9dbd0f,_0xc82323);})[_0x5558('0x1f')](function(_0x4f4f5e){if(_0x4f4f5e){logger['info'](_0x5558('0x4c'));logger[_0x5558('0x1b')](_0x5558('0x4d'),_0x4f4f5e['id']);}})[_0x5558('0x50')](function(_0x55742c){logger[_0x5558('0x51')]('['+_0xc82323[_0x5558('0x58')][_0x5558('0x59')]()+']',JSON[_0x5558('0x32')](_0x55742c));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 9b3b533..8690042 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 _0xd7c8=['socket.io-emitter','GET','/api/selector/owners','info','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','adminEmail','then','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','contactNumber','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','getString','add','ticketId','task','Task\x20created:','toUpperCase','/contacts/','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','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','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','md5','moment','bluebird','ioredis','./util','../../../../config/environment','defaults','redis','localhost'];(function(_0x1c7f50,_0x5e0e96){var _0x1feea8=function(_0x4deb1e){while(--_0x4deb1e){_0x1c7f50['push'](_0x1c7f50['shift']());}};_0x1feea8(++_0x5e0e96);}(_0xd7c8,0x91));var _0x8d7c=function(_0xcb881,_0x29c3a8){_0xcb881=_0xcb881-0x0;var _0x38816b=_0xd7c8[_0xcb881];return _0x38816b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x8d7c('0x0'));var util=require('util');var moment=require(_0x8d7c('0x1'));var Promise=require(_0x8d7c('0x2'));var Redis=require(_0x8d7c('0x3'));var intUtil=require(_0x8d7c('0x4'));var config=require(_0x8d7c('0x5'));var logger=require('../../../../config/logger')('freshsales');config['redis']=_[_0x8d7c('0x6')](config[_0x8d7c('0x7')],{'host':_0x8d7c('0x8'),'port':0x18eb});var io=require(_0x8d7c('0x9'))(new Redis(config[_0x8d7c('0x7')]));function getAdminId(_0x5634be,_0x5421eb,_0x100b83,_0x55c772){return new Promise(function(_0x3e1256,_0x18c5b5){var _0x5658d5=![];var _0x134305={'method':_0x8d7c('0xa'),'uri':_0x55c772+_0x8d7c('0xb'),'json':!![]};_0x134305['headers']=_0x100b83;logger[_0x8d7c('0xc')]('Getting\x20admin\x20information');return rp(_0x134305)['then'](function(_0x2b9237){if(_0x2b9237){var _0x19d230=_0x2b9237[_0x8d7c('0xd')];var _0x397e94=null;for(_0x397e94=0x0;_0x397e94<_0x19d230[_0x8d7c('0xe')];_0x397e94++){if(_0x19d230[_0x397e94][_0x8d7c('0xf')]===_0x5634be['adminEmail']){_0x5634be[_0x8d7c('0x10')]=_0x19d230[_0x397e94]['id'];_0x5658d5=!![];}}if(_0x5658d5){logger['info']('Admin\x20found:',_0x5634be[_0x8d7c('0x10')]);_0x3e1256(_0x5634be);}else{_0x18c5b5({'statusCode':0x194,'message':_0x8d7c('0x11')});}}else{_0x18c5b5({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x8d7c('0x12')](function(_0x268146){logger[_0x8d7c('0x13')]('['+[_0x5421eb['toUpperCase']()]+']',_0x268146[_0x8d7c('0x14')]);_0x18c5b5(_0x268146);});});}function getUser(_0x152cc4,_0x5d4c66,_0x233762){return function(_0x4e5d6b){return new Promise(function(_0x30a7c2,_0x5125dd){var _0x5ec18c={'method':'GET','uri':_0x233762+_0x8d7c('0xb'),'json':!![]};_0x5ec18c[_0x8d7c('0x15')]=_0x5d4c66;logger['info'](_0x8d7c('0x16'));return rp(_0x5ec18c)['then'](function(_0x28d4ac){if(_0x28d4ac){var _0x4ff847=_0x28d4ac[_0x8d7c('0xd')];var _0x4e4411=![];var _0x3eb030=null;if(_0x4e5d6b[_0x8d7c('0x17')]!==null){logger[_0x8d7c('0xc')](_0x8d7c('0x18'),_0x4e5d6b[_0x8d7c('0x17')]);_0x4e5d6b[_0x8d7c('0x19')]=_0x4e5d6b[_0x8d7c('0x17')];for(_0x3eb030=0x0;_0x3eb030<_0x4ff847[_0x8d7c('0xe')];_0x3eb030++){if(_0x4ff847[_0x3eb030][_0x8d7c('0xf')]===_0x4e5d6b[_0x8d7c('0x17')]){_0x4e4411=!![];_0x4e5d6b['userId']=_0x4ff847[_0x3eb030]['id'];logger[_0x8d7c('0xc')]('User\x20found:',_0x4e5d6b[_0x8d7c('0x1a')]);}}}if(!_0x4e4411){logger[_0x8d7c('0xc')](_0x8d7c('0x1b'));_0x4e5d6b['userEmail']=_0x4e5d6b[_0x8d7c('0x1c')];_0x4e5d6b[_0x8d7c('0x1a')]=_0x4e5d6b[_0x8d7c('0x10')];_0x4e4411=!![];}if(_0x4e4411){_0x30a7c2(_0x4e5d6b);}else{_0x5125dd({'statusCode':0x194,'message':_0x8d7c('0x11')});}}else{_0x5125dd({'statusCode':0x194,'message':_0x8d7c('0x11')});}})[_0x8d7c('0x12')](function(_0x55f81b){logger['error']('['+[_0x152cc4['toUpperCase']()]+']',_0x55f81b[_0x8d7c('0x14')]);_0x5125dd(_0x55f81b);});});};}function searchContact(_0xd0ef8d,_0xd48dde,_0x5e6699,_0x42d671){return new Promise(function(_0xa96efb,_0x45a3f8){var _0x4a836f={'method':_0x8d7c('0xa'),'headers':_0xd48dde,'uri':_0xd0ef8d+'/api/lookup?q='+_0x42d671+'&f='+_0x5e6699+'&entities=contact','json':!![]};rp(_0x4a836f)[_0x8d7c('0x1d')](function(_0x3e5055){var _0x4d378e=_[_0x8d7c('0x1e')](_0x3e5055[_0x8d7c('0x1f')][_0x8d7c('0x1f')],[_0x5e6699,_0x42d671]);_0xa96efb(_0x4d378e);})['catch'](function(_0x5468bb){_0x45a3f8(_0x5468bb);});});}function getEndUser(_0x587178,_0x1b9401,_0x3cdf06){return function(_0x3c1db7){return new Promise(function(_0x598f14,_0x576262){logger[_0x8d7c('0xc')](util[_0x8d7c('0x20')](_0x8d7c('0x21'),_0x3c1db7['contactNumber']));searchContact(_0x3cdf06,_0x1b9401,_0x8d7c('0x22'),_0x3c1db7['contactNumber'])[_0x8d7c('0x1d')](function(_0x379c52){if(_0x379c52){_0x3c1db7['endUserId']=_0x379c52['id'];logger[_0x8d7c('0xc')](_0x8d7c('0x23'),_0x3c1db7[_0x8d7c('0x24')]);return _0x598f14(_0x3c1db7);}searchContact(_0x3cdf06,_0x1b9401,_0x8d7c('0x25'),_0x3c1db7[_0x8d7c('0x26')])['then'](function(_0x4e587b){if(_0x4e587b){_0x3c1db7[_0x8d7c('0x24')]=_0x4e587b['id'];logger[_0x8d7c('0xc')]('Contact\x20found\x20work_number:',_0x3c1db7[_0x8d7c('0x24')]);return _0x598f14(_0x3c1db7);}createEndUser(_0x3c1db7,_0x587178,_0x1b9401,_0x3cdf06)['then'](function(_0x33ad8e){logger[_0x8d7c('0xc')]('Contact\x20created:',_0x33ad8e['endUserId']);return _0x598f14(_0x33ad8e);});});})[_0x8d7c('0x12')](function(_0x319b3d){_0x576262(_0x319b3d);});});};}function createEndUser(_0x4ad5aa,_0x5b522e,_0x41b019,_0x1c75b4){return new Promise(function(_0x3f14a8,_0x5b22d8){var _0x4e899f=moment();var _0x1217da={'method':_0x8d7c('0x27'),'uri':_0x1c75b4+_0x8d7c('0x28'),'body':{'contact':{'last_name':_0x4ad5aa[_0x8d7c('0x26')],'work_number':_0x4ad5aa[_0x8d7c('0x26')],'mobile_number':_0x4ad5aa[_0x8d7c('0x26')],'owner_id':_0x4ad5aa['userId'],'created_at':_0x4e899f[_0x8d7c('0x20')](_0x8d7c('0x29'))}},'json':!![]};_0x1217da[_0x8d7c('0x15')]=_0x41b019;logger[_0x8d7c('0xc')](_0x8d7c('0x2a'));return rp(_0x1217da)[_0x8d7c('0x1d')](function(_0x27a492){_0x4ad5aa[_0x8d7c('0x24')]=_0x27a492[_0x8d7c('0x2b')]['id'];_0x3f14a8(_0x4ad5aa);})[_0x8d7c('0x12')](function(_0x525337){logger[_0x8d7c('0x13')]('['+[_0x5b522e['toUpperCase']()]+']',_0x525337[_0x8d7c('0x14')]);_0x5b22d8(_0x525337['message']);});});}function getTicket(_0x310b3a,_0x19af15,_0x211f09,_0x4a47bb,_0x30bcb8){return function(_0x4f94ac){logger[_0x8d7c('0xc')]('Creating\x20new\x20task');return new Promise(function(_0x96c7f5,_0x3f2eff){var _0x409472=moment();var _0x7e2ca6={'method':_0x8d7c('0x27'),'uri':_0x211f09+'/api/tasks','body':{'title':intUtil[_0x8d7c('0x2c')](_0x4a47bb['Subjects'],_0x30bcb8,'\x20'),'description':intUtil[_0x8d7c('0x2c')](_0x4a47bb['Descriptions'],_0x30bcb8,'\x0a'),'owner_id':_0x4f94ac[_0x8d7c('0x1a')],'creater_id':_0x4f94ac[_0x8d7c('0x10')],'targetable_id':_0x4f94ac[_0x8d7c('0x24')],'targetable_type':'Contact','created_at':_0x409472[_0x8d7c('0x20')](_0x8d7c('0x29')),'due_date':_0x409472[_0x8d7c('0x2d')](0x1e,'m')[_0x8d7c('0x20')](_0x8d7c('0x29'))},'json':!![]};_0x7e2ca6['headers']=_0x19af15;return rp(_0x7e2ca6)[_0x8d7c('0x1d')](function(_0x4774b9){_0x4f94ac[_0x8d7c('0x2e')]=_0x4774b9[_0x8d7c('0x2f')]['id'];logger[_0x8d7c('0xc')](_0x8d7c('0x30'),_0x4f94ac[_0x8d7c('0x2e')]);_0x96c7f5(_0x4f94ac);})[_0x8d7c('0x12')](function(_0x2ca6a3){logger[_0x8d7c('0x13')]('['+[_0x310b3a[_0x8d7c('0x31')]()]+']',_0x2ca6a3[_0x8d7c('0x14')]);_0x3f2eff(_0x2ca6a3[_0x8d7c('0x14')]);});});};}function emit(_0x2bcdd8,_0x46c2b4,_0x7ecb6){var _0x129ce4={'uri':_0x2bcdd8+_0x8d7c('0x32')+_0x7ecb6};io['to'](util[_0x8d7c('0x20')](_0x8d7c('0x33'),_0x46c2b4))[_0x8d7c('0x34')](_0x8d7c('0x35'),_0x129ce4);}exports['cs']=function(_0x43c68e,_0x1c740a,_0x156258,_0x164bf4,_0x1633d5,_0x28483f,_0x4eb209,_0x2cccbe){var _0x4ebf4c={};var _0x29ab70={'Authorization':'Token\x20token='+_0x28483f[_0x8d7c('0x36')]};_0x28483f[_0x8d7c('0x37')]=intUtil[_0x8d7c('0x38')](_0x28483f[_0x8d7c('0x37')]);_0x28483f[_0x8d7c('0x39')]=intUtil['stripTrailingSlash'](_0x28483f[_0x8d7c('0x39')]);var _0xb31100=_0x28483f[_0x8d7c('0x37')];_0x4ebf4c[_0x8d7c('0x1c')]=_0x28483f[_0x8d7c('0x3a')];_0x4ebf4c[_0x8d7c('0x26')]=_0x2cccbe[_0x8d7c('0x3b')]()===_0x8d7c('0x3c')?_0x1c740a[_0x8d7c('0x3d')]:_0x1c740a[_0x8d7c('0x3e')];_0x4ebf4c[_0x8d7c('0x3f')]=_0x2cccbe===_0x8d7c('0x40')||_0x2cccbe===_0x8d7c('0x41')?'queue':_0x8d7c('0x3c');if(_0x164bf4){_0x4ebf4c[_0x8d7c('0x17')]=_0x164bf4[_0x8d7c('0xf')];}var _0x572734=util[_0x8d7c('0x20')](_0x8d7c('0x42'),_0x28483f[_0x8d7c('0x39')],_0x1c740a[_0x8d7c('0x43')],md5(_0x1c740a[_0x8d7c('0x43')]));if(_0x1633d5&&_0x1633d5[_0x8d7c('0x44')]){logger[_0x8d7c('0xc')](_0x8d7c('0x45'),_0x8d7c('0x46'));_0x1c740a[_0x8d7c('0x47')]=_0x572734;}else if(_0x4eb209&&_0x4eb209['recordingFormat']&&_0x4eb209['recordingFormat']!==_0x8d7c('0x48')){logger['info'](_0x8d7c('0x49'),_0x8d7c('0x46'));_0x1c740a['recordingURL']=_0x572734;}else{_0x1c740a['recordingURL']='';}return getAdminId(_0x4ebf4c,_0x2cccbe,_0x29ab70,_0xb31100)['then'](getUser(_0x2cccbe,_0x29ab70,_0xb31100))[_0x8d7c('0x1d')](getEndUser(_0x2cccbe,_0x29ab70,_0xb31100))['then'](getTicket(_0x2cccbe,_0x29ab70,_0xb31100,_0x156258,_0x1c740a))[_0x8d7c('0x1d')](function(_0x2126d2){logger[_0x8d7c('0xc')](util[_0x8d7c('0x20')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2126d2[_0x8d7c('0x2e')]));if(_0x2cccbe!=='unmanaged'){logger[_0x8d7c('0xc')]('['+[_0x2cccbe[_0x8d7c('0x31')]()]+']',_0x8d7c('0x4a'));emit(_0xb31100,_0x164bf4[_0x8d7c('0x4b')],_0x2126d2[_0x8d7c('0x24')]);}})[_0x8d7c('0x12')](function(_0x23d5a6){logger[_0x8d7c('0x13')]('['+[_0x2cccbe[_0x8d7c('0x31')]()]+_0x8d7c('0x4c'),util['inspect'](_0x23d5a6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9497=['redis','defaults','localhost','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','message','Getting\x20user\x20list','agentEmail','userEmail','length','userId','error','toUpperCase','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','bluebird','./util','../../../../config/environment','../../../../config/logger'];(function(_0x6a9231,_0x1f7cdb){var _0x290f5b=function(_0x1a5ac1){while(--_0x1a5ac1){_0x6a9231['push'](_0x6a9231['shift']());}};_0x290f5b(++_0x1f7cdb);}(_0x9497,0x193));var _0x7949=function(_0x3bdb9a,_0x4d9d2c){_0x3bdb9a=_0x3bdb9a-0x0;var _0x1f8848=_0x9497[_0x3bdb9a];return _0x1f8848;};'use strict';var _=require(_0x7949('0x0'));var rp=require(_0x7949('0x1'));var md5=require('md5');var util=require(_0x7949('0x2'));var moment=require('moment');var Promise=require(_0x7949('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7949('0x4'));var config=require(_0x7949('0x5'));var logger=require(_0x7949('0x6'))('freshsales');config[_0x7949('0x7')]=_[_0x7949('0x8')](config[_0x7949('0x7')],{'host':_0x7949('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7949('0x7')]));function getAdminId(_0x54817e,_0x16797c,_0x4197de,_0x3d9325){return new Promise(function(_0x52ba84,_0x1d9b05){var _0x2014db=![];var _0x17f86b={'method':_0x7949('0xa'),'uri':_0x3d9325+_0x7949('0xb'),'json':!![]};_0x17f86b[_0x7949('0xc')]=_0x4197de;logger['info'](_0x7949('0xd'));return rp(_0x17f86b)[_0x7949('0xe')](function(_0x27d169){if(_0x27d169){var _0x1f8b2d=_0x27d169[_0x7949('0xf')];var _0x1d6de9=null;for(_0x1d6de9=0x0;_0x1d6de9<_0x1f8b2d['length'];_0x1d6de9++){if(_0x1f8b2d[_0x1d6de9][_0x7949('0x10')]===_0x54817e[_0x7949('0x11')]){_0x54817e[_0x7949('0x12')]=_0x1f8b2d[_0x1d6de9]['id'];_0x2014db=!![];}}if(_0x2014db){logger[_0x7949('0x13')](_0x7949('0x14'),_0x54817e[_0x7949('0x12')]);_0x52ba84(_0x54817e);}else{_0x1d9b05({'statusCode':0x194,'message':_0x7949('0x15')});}}else{_0x1d9b05({'statusCode':0x194,'message':_0x7949('0x15')});}})[_0x7949('0x16')](function(_0x5a14bd){logger['error']('['+[_0x16797c['toUpperCase']()]+']',_0x5a14bd[_0x7949('0x17')]);_0x1d9b05(_0x5a14bd);});});}function getUser(_0xb8b586,_0x5ec2eb,_0xf36eae){return function(_0x68f1b9){return new Promise(function(_0x45d730,_0xfb2492){var _0x1da55b={'method':_0x7949('0xa'),'uri':_0xf36eae+_0x7949('0xb'),'json':!![]};_0x1da55b[_0x7949('0xc')]=_0x5ec2eb;logger[_0x7949('0x13')](_0x7949('0x18'));return rp(_0x1da55b)['then'](function(_0x3e8ec7){if(_0x3e8ec7){var _0x2c1dc4=_0x3e8ec7[_0x7949('0xf')];var _0xff795a=![];var _0x15450f=null;if(_0x68f1b9[_0x7949('0x19')]!==null){logger[_0x7949('0x13')]('Getting\x20user\x20with\x20email',_0x68f1b9[_0x7949('0x19')]);_0x68f1b9[_0x7949('0x1a')]=_0x68f1b9[_0x7949('0x19')];for(_0x15450f=0x0;_0x15450f<_0x2c1dc4[_0x7949('0x1b')];_0x15450f++){if(_0x2c1dc4[_0x15450f]['email']===_0x68f1b9['agentEmail']){_0xff795a=!![];_0x68f1b9[_0x7949('0x1c')]=_0x2c1dc4[_0x15450f]['id'];logger['info']('User\x20found:',_0x68f1b9['userId']);}}}if(!_0xff795a){logger[_0x7949('0x13')]('Admin\x20selected');_0x68f1b9['userEmail']=_0x68f1b9[_0x7949('0x11')];_0x68f1b9['userId']=_0x68f1b9[_0x7949('0x12')];_0xff795a=!![];}if(_0xff795a){_0x45d730(_0x68f1b9);}else{_0xfb2492({'statusCode':0x194,'message':_0x7949('0x15')});}}else{_0xfb2492({'statusCode':0x194,'message':_0x7949('0x15')});}})[_0x7949('0x16')](function(_0xe7c6bf){logger[_0x7949('0x1d')]('['+[_0xb8b586[_0x7949('0x1e')]()]+']',_0xe7c6bf[_0x7949('0x17')]);_0xfb2492(_0xe7c6bf);});});};}function searchContact(_0x7fa01,_0x337180,_0x2bd5d2,_0x53a6db){return new Promise(function(_0x138245,_0x556984){var _0x33de5a={'method':_0x7949('0xa'),'headers':_0x337180,'uri':_0x7fa01+_0x7949('0x1f')+_0x53a6db+_0x7949('0x20')+_0x2bd5d2+'&entities=contact','json':!![]};rp(_0x33de5a)['then'](function(_0x118285){var _0x30fcef=_[_0x7949('0x21')](_0x118285[_0x7949('0x22')]['contacts'],[_0x2bd5d2,_0x53a6db]);_0x138245(_0x30fcef);})[_0x7949('0x16')](function(_0x5f11c0){_0x556984(_0x5f11c0);});});}function getEndUser(_0x2b4e41,_0x19db3c,_0x26f533){return function(_0x5eeddd){return new Promise(function(_0x5484a1,_0x2a1b90){logger[_0x7949('0x13')](util[_0x7949('0x23')](_0x7949('0x24'),_0x5eeddd[_0x7949('0x25')]));searchContact(_0x26f533,_0x19db3c,_0x7949('0x26'),_0x5eeddd[_0x7949('0x25')])[_0x7949('0xe')](function(_0x30b984){if(_0x30b984){_0x5eeddd[_0x7949('0x27')]=_0x30b984['id'];logger[_0x7949('0x13')]('Contact\x20found\x20mobile_number:',_0x5eeddd[_0x7949('0x27')]);return _0x5484a1(_0x5eeddd);}searchContact(_0x26f533,_0x19db3c,_0x7949('0x28'),_0x5eeddd[_0x7949('0x25')])[_0x7949('0xe')](function(_0x240d15){if(_0x240d15){_0x5eeddd[_0x7949('0x27')]=_0x240d15['id'];logger[_0x7949('0x13')]('Contact\x20found\x20work_number:',_0x5eeddd[_0x7949('0x27')]);return _0x5484a1(_0x5eeddd);}createEndUser(_0x5eeddd,_0x2b4e41,_0x19db3c,_0x26f533)[_0x7949('0xe')](function(_0x512e33){logger[_0x7949('0x13')]('Contact\x20created:',_0x512e33['endUserId']);return _0x5484a1(_0x512e33);});});})['catch'](function(_0x55f572){_0x2a1b90(_0x55f572);});});};}function createEndUser(_0x232ebb,_0xd20a5f,_0x103ea3,_0x28b8f9){return new Promise(function(_0x4a52f4,_0x2bbb83){var _0x375883=moment();var _0x26721d={'method':_0x7949('0x29'),'uri':_0x28b8f9+_0x7949('0x2a'),'body':{'contact':{'last_name':_0x232ebb[_0x7949('0x25')],'work_number':_0x232ebb[_0x7949('0x25')],'mobile_number':_0x232ebb[_0x7949('0x25')],'owner_id':_0x232ebb[_0x7949('0x1c')],'created_at':_0x375883[_0x7949('0x23')](_0x7949('0x2b'))}},'json':!![]};_0x26721d[_0x7949('0xc')]=_0x103ea3;logger[_0x7949('0x13')](_0x7949('0x2c'));return rp(_0x26721d)[_0x7949('0xe')](function(_0x57ce83){_0x232ebb[_0x7949('0x27')]=_0x57ce83[_0x7949('0x2d')]['id'];_0x4a52f4(_0x232ebb);})[_0x7949('0x16')](function(_0x35af56){logger[_0x7949('0x1d')]('['+[_0xd20a5f['toUpperCase']()]+']',_0x35af56['message']);_0x2bbb83(_0x35af56[_0x7949('0x17')]);});});}function getTicket(_0x2b113e,_0x17450a,_0x5a43c3,_0x49d047,_0x1d7efe){return function(_0xfb1677){logger[_0x7949('0x13')]('Creating\x20new\x20task');return new Promise(function(_0x10ac06,_0x1621c6){var _0x450cd4=moment();var _0x40657c={'method':_0x7949('0x29'),'uri':_0x5a43c3+_0x7949('0x2e'),'body':{'title':intUtil[_0x7949('0x2f')](_0x49d047[_0x7949('0x30')],_0x1d7efe,'\x20'),'description':intUtil['getString'](_0x49d047[_0x7949('0x31')],_0x1d7efe,'\x0a'),'owner_id':_0xfb1677[_0x7949('0x1c')],'creater_id':_0xfb1677[_0x7949('0x12')],'targetable_id':_0xfb1677[_0x7949('0x27')],'targetable_type':'Contact','created_at':_0x450cd4[_0x7949('0x23')](_0x7949('0x2b')),'due_date':_0x450cd4[_0x7949('0x32')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x40657c[_0x7949('0xc')]=_0x17450a;return rp(_0x40657c)[_0x7949('0xe')](function(_0xb2e48c){_0xfb1677[_0x7949('0x33')]=_0xb2e48c[_0x7949('0x34')]['id'];logger[_0x7949('0x13')](_0x7949('0x35'),_0xfb1677[_0x7949('0x33')]);_0x10ac06(_0xfb1677);})['catch'](function(_0x3c361d){logger[_0x7949('0x1d')]('['+[_0x2b113e[_0x7949('0x1e')]()]+']',_0x3c361d['message']);_0x1621c6(_0x3c361d[_0x7949('0x17')]);});});};}function emit(_0x3c572c,_0x36b878,_0x1598ed){var _0x513784={'uri':_0x3c572c+_0x7949('0x36')+_0x1598ed};io['to'](util[_0x7949('0x23')]('user:%s',_0x36b878))[_0x7949('0x37')](_0x7949('0x38'),_0x513784);}exports['cs']=function(_0x120ea4,_0x4cbc10,_0x3ed47b,_0x22731f,_0x16a43f,_0x4bfecf,_0x40c50e,_0x215c85){var _0x4d2297={};var _0x8c3bf0={'Authorization':_0x7949('0x39')+_0x4bfecf[_0x7949('0x3a')]};_0x4bfecf['remoteUri']=intUtil[_0x7949('0x3b')](_0x4bfecf[_0x7949('0x3c')]);_0x4bfecf[_0x7949('0x3d')]=intUtil[_0x7949('0x3b')](_0x4bfecf[_0x7949('0x3d')]);var _0x42692a=_0x4bfecf['remoteUri'];_0x4d2297[_0x7949('0x11')]=_0x4bfecf[_0x7949('0x3e')];_0x4d2297[_0x7949('0x25')]=_0x215c85[_0x7949('0x3f')]()===_0x7949('0x40')?_0x4cbc10['destcalleridnum']:_0x4cbc10[_0x7949('0x41')];_0x4d2297[_0x7949('0x42')]=_0x215c85===_0x7949('0x43')||_0x215c85===_0x7949('0x44')?_0x7949('0x43'):'outbound';if(_0x22731f){_0x4d2297[_0x7949('0x19')]=_0x22731f[_0x7949('0x10')];}var _0x3abcda=util[_0x7949('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfecf[_0x7949('0x3d')],_0x4cbc10[_0x7949('0x45')],md5(_0x4cbc10[_0x7949('0x45')]));if(_0x16a43f&&_0x16a43f[_0x7949('0x46')]){logger[_0x7949('0x13')](_0x7949('0x47'),'Recording\x20is\x20enabled!');_0x4cbc10[_0x7949('0x48')]=_0x3abcda;}else if(_0x40c50e&&_0x40c50e[_0x7949('0x49')]&&_0x40c50e[_0x7949('0x49')]!==_0x7949('0x4a')){logger[_0x7949('0x13')](_0x7949('0x4b'),_0x7949('0x4c'));_0x4cbc10[_0x7949('0x48')]=_0x3abcda;}else{_0x4cbc10[_0x7949('0x48')]='';}return getAdminId(_0x4d2297,_0x215c85,_0x8c3bf0,_0x42692a)[_0x7949('0xe')](getUser(_0x215c85,_0x8c3bf0,_0x42692a))['then'](getEndUser(_0x215c85,_0x8c3bf0,_0x42692a))[_0x7949('0xe')](getTicket(_0x215c85,_0x8c3bf0,_0x42692a,_0x3ed47b,_0x4cbc10))[_0x7949('0xe')](function(_0x4fb8a4){logger['info'](util[_0x7949('0x23')](_0x7949('0x4d'),_0x4fb8a4[_0x7949('0x33')]));if(_0x215c85!==_0x7949('0x44')){logger[_0x7949('0x13')]('['+[_0x215c85[_0x7949('0x1e')]()]+']',_0x7949('0x4e'));emit(_0x42692a,_0x22731f[_0x7949('0x4f')],_0x4fb8a4[_0x7949('0x27')]);}})[_0x7949('0x16')](function(_0x428f92){logger[_0x7949('0x1d')]('['+[_0x215c85['toUpperCase']()]+_0x7949('0x50'),util[_0x7949('0x51')](_0x428f92,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 3b459ad..bb53a24 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 _0xd665=['error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./freshdesk','./desk','./servicenow','./dynamics365','./freshsales','zendesk','freshdesk','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','sugarcrm','zoho','freshsales','unknown\x20integration','../../../../config/logger'];(function(_0x5660d5,_0x235c27){var _0x2a144d=function(_0x54fb3f){while(--_0x54fb3f){_0x5660d5['push'](_0x5660d5['shift']());}};_0x2a144d(++_0x235c27);}(_0xd665,0x151));var _0x5d66=function(_0x4ee52d,_0x34600f){_0x4ee52d=_0x4ee52d-0x0;var _0x3c8548=_0xd665[_0x4ee52d];return _0x3c8548;};'use strict';var _=require(_0x5d66('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x5d66('0x1'));var sugarcrm=require(_0x5d66('0x2'));var freshdesk=require(_0x5d66('0x3'));var zoho=require('./zoho');var desk=require(_0x5d66('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0x5d66('0x5'));var dynamics365=require(_0x5d66('0x6'));var freshsales=require(_0x5d66('0x7'));var integrations=[_0x5d66('0x8'),'salesforce','sugarcrm',_0x5d66('0x9'),'zoho',_0x5d66('0xa'),_0x5d66('0xb'),_0x5d66('0xc'),'freshsales',_0x5d66('0xd')];exports[_0x5d66('0xe')]=function(_0x3926a7,_0x16a44c,_0x37c8e6,_0x25bb95,_0x79c90c,_0x355e6b){if(_0x37c8e6){if(_[_0x5d66('0xf')](integrations,_0x3926a7[_0x5d66('0x10')][_0x5d66('0x11')]())){try{var _0x5cdaaa=null;var _0x1902a2='';var _0x1b3485=_0x37c8e6[_0x3926a7[_0x5d66('0x10')][_0x5d66('0x11')]()];if(_0x1b3485){var _0x539013=_0x1b3485[_0x3926a7[_0x5d66('0x12')]];if(_0x539013){var _0x4f6c06=_[_0x5d66('0x13')](_0x539013[_0x5d66('0x14')],{'id':parseInt(_0x3926a7['data3'],0xa)});if(_0x4f6c06){if(_0x25bb95){if(_0x79c90c&&_0x16a44c[_0x5d66('0x15')]){_0x1902a2=_0x5d66('0x15');}else if(_0x16a44c[_0x5d66('0x16')]){_0x1902a2=_0x5d66('0x17');}else{console[_0x5d66('0x18')](_0x5d66('0x19'),_0x16a44c);}}else{_0x1902a2=_0x5d66('0x1a');}switch(_0x3926a7[_0x5d66('0x10')][_0x5d66('0x11')]()){case _0x5d66('0x8'):zendesk[_0x1902a2](_0x3926a7,_0x16a44c,_0x4f6c06,_0x25bb95,_0x79c90c,_0x539013,_0x355e6b);break;case _0x5d66('0x1b'):salesforce[_0x1902a2](_0x3926a7,_0x16a44c,_0x4f6c06,_0x25bb95,_0x79c90c,_0x539013,_0x355e6b);break;case _0x5d66('0x1c'):sugarcrm[_0x1902a2](_0x3926a7,_0x16a44c,_0x4f6c06,_0x25bb95,_0x79c90c,_0x539013,_0x355e6b);break;case _0x5d66('0x9'):freshdesk[_0x1902a2](_0x3926a7,_0x16a44c,_0x4f6c06,_0x25bb95,_0x79c90c,_0x539013,_0x355e6b);break;case _0x5d66('0x1d'):zoho[_0x1902a2](_0x3926a7,_0x16a44c,_0x4f6c06,_0x25bb95,_0x79c90c,_0x539013,_0x355e6b);break;case _0x5d66('0xa'):desk[_0x1902a2](_0x3926a7,_0x16a44c,_0x4f6c06,_0x25bb95,_0x79c90c,_0x539013,_0x355e6b);break;case _0x5d66('0xb'):vtiger[_0x1902a2](_0x3926a7,_0x16a44c,_0x4f6c06,_0x25bb95,_0x79c90c,_0x539013,_0x355e6b);break;case _0x5d66('0x1e'):freshsales['cs'](_0x3926a7,_0x16a44c,_0x4f6c06,_0x25bb95,_0x79c90c,_0x539013,_0x355e6b,_0x1902a2);break;case _0x5d66('0xd'):servicenow['cs'](_0x3926a7,_0x16a44c,_0x4f6c06,_0x25bb95,_0x79c90c,_0x539013,_0x355e6b,_0x1902a2);break;case _0x5d66('0xc'):dynamics365['cs'](_0x3926a7,_0x16a44c,_0x4f6c06,_0x25bb95,_0x79c90c,_0x539013,_0x355e6b,_0x1902a2);break;default:console[_0x5d66('0x18')](_0x5d66('0x1f'));}}else{_0x5cdaaa=require(_0x5d66('0x20'))(_0x3926a7[_0x5d66('0x10')][_0x5d66('0x11')]());_0x5cdaaa[_0x5d66('0x21')](_0x5d66('0x22'),util[_0x5d66('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3926a7[_0x5d66('0x10')]['toLowerCase'](),_0x3926a7['data3']));}}else{_0x5cdaaa=require(_0x5d66('0x20'))(_0x3926a7[_0x5d66('0x10')][_0x5d66('0x11')]());_0x5cdaaa['error']('[EXEC]',util[_0x5d66('0x23')](_0x5d66('0x24'),_0x3926a7[_0x5d66('0x10')][_0x5d66('0x11')](),_0x3926a7[_0x5d66('0x12')]));}}else{}}catch(_0x52fc1b){console[_0x5d66('0x21')](_0x52fc1b);}}}}; \ No newline at end of file +var _0xfb69=['./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','includes','toLowerCase','data2','find','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','freshsales','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','error','lodash','util','./zendesk','./salesforce','./sugarcrm'];(function(_0x5543b0,_0x22bf63){var _0x41248a=function(_0x263fc9){while(--_0x263fc9){_0x5543b0['push'](_0x5543b0['shift']());}};_0x41248a(++_0x22bf63);}(_0xfb69,0x12b));var _0x9fb6=function(_0x1cca67,_0x4fad50){_0x1cca67=_0x1cca67-0x0;var _0x2152ea=_0xfb69[_0x1cca67];return _0x2152ea;};'use strict';var _=require(_0x9fb6('0x0'));var util=require(_0x9fb6('0x1'));var zendesk=require(_0x9fb6('0x2'));var salesforce=require(_0x9fb6('0x3'));var sugarcrm=require(_0x9fb6('0x4'));var freshdesk=require(_0x9fb6('0x5'));var zoho=require(_0x9fb6('0x6'));var desk=require(_0x9fb6('0x7'));var vtiger=require(_0x9fb6('0x8'));var servicenow=require(_0x9fb6('0x9'));var dynamics365=require('./dynamics365');var freshsales=require(_0x9fb6('0xa'));var integrations=[_0x9fb6('0xb'),_0x9fb6('0xc'),_0x9fb6('0xd'),_0x9fb6('0xe'),_0x9fb6('0xf'),_0x9fb6('0x10'),_0x9fb6('0x11'),'dynamics365','freshsales','servicenow'];exports['exec']=function(_0x1b3ccd,_0x5cdf8,_0x54adec,_0x2c04a1,_0x4093e6,_0x812bfb){if(_0x54adec){if(_[_0x9fb6('0x12')](integrations,_0x1b3ccd['data1'][_0x9fb6('0x13')]())){try{var _0x4f3f16=null;var _0x5c95a9='';var _0x249f3d=_0x54adec[_0x1b3ccd['data1'][_0x9fb6('0x13')]()];if(_0x249f3d){var _0x7d3dd5=_0x249f3d[_0x1b3ccd[_0x9fb6('0x14')]];if(_0x7d3dd5){var _0x2e19ca=_[_0x9fb6('0x15')](_0x7d3dd5['Configurations'],{'id':parseInt(_0x1b3ccd[_0x9fb6('0x16')],0xa)});if(_0x2e19ca){if(_0x2c04a1){if(_0x4093e6&&_0x5cdf8[_0x9fb6('0x17')]){_0x5c95a9='queue';}else if(_0x5cdf8['routeId']){_0x5c95a9=_0x9fb6('0x18');}else{console[_0x9fb6('0x19')](_0x9fb6('0x1a'),_0x5cdf8);}}else{_0x5c95a9=_0x9fb6('0x1b');}switch(_0x1b3ccd[_0x9fb6('0x1c')][_0x9fb6('0x13')]()){case _0x9fb6('0xb'):zendesk[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case _0x9fb6('0xc'):salesforce[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case _0x9fb6('0xd'):sugarcrm[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case'freshdesk':freshdesk[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case'zoho':zoho[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case _0x9fb6('0x10'):desk[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case _0x9fb6('0x11'):vtiger[_0x5c95a9](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb);break;case _0x9fb6('0x1d'):freshsales['cs'](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb,_0x5c95a9);break;case _0x9fb6('0x1e'):servicenow['cs'](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb,_0x5c95a9);break;case _0x9fb6('0x1f'):dynamics365['cs'](_0x1b3ccd,_0x5cdf8,_0x2e19ca,_0x2c04a1,_0x4093e6,_0x7d3dd5,_0x812bfb,_0x5c95a9);break;default:console[_0x9fb6('0x19')](_0x9fb6('0x20'));}}else{_0x4f3f16=require(_0x9fb6('0x21'))(_0x1b3ccd[_0x9fb6('0x1c')][_0x9fb6('0x13')]());_0x4f3f16['error'](_0x9fb6('0x22'),util[_0x9fb6('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1b3ccd['data1'][_0x9fb6('0x13')](),_0x1b3ccd[_0x9fb6('0x16')]));}}else{_0x4f3f16=require('../../../../config/logger')(_0x1b3ccd['data1'][_0x9fb6('0x13')]());_0x4f3f16['error'](_0x9fb6('0x22'),util['format'](_0x9fb6('0x24'),_0x1b3ccd['data1'][_0x9fb6('0x13')](),_0x1b3ccd['data2']));}}else{}}catch(_0x5e669a){console[_0x9fb6('0x25')](_0x5e669a);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index f356f27..d28a8e2 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 _0x0a10=['Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','No\x20Company','forEach','includes','string','picklist','variableName','idField','Variable','name','toString','password','concat','securityToken','Connection','clientId','login','username','queue','serverUrl','remoteUri','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','./util','../../../../config/environment','salesforce','redis','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','IsRecurrence','contact','endUserType','lead','WhoId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then','length','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','type','toLowerCase'];(function(_0x361db9,_0x434828){var _0x27b640=function(_0x26ff41){while(--_0x26ff41){_0x361db9['push'](_0x361db9['shift']());}};_0x27b640(++_0x434828);}(_0x0a10,0x1a0));var _0x00a1=function(_0xce8bce,_0x5bc5e8){_0xce8bce=_0xce8bce-0x0;var _0x135d09=_0x0a10[_0xce8bce];return _0x135d09;};'use strict';var _=require(_0x00a1('0x0'));var rp=require(_0x00a1('0x1'));var moment=require('moment');var BPromise=require(_0x00a1('0x2'));var md5=require(_0x00a1('0x3'));var jsforce=require(_0x00a1('0x4'));var util=require(_0x00a1('0x5'));var Redis=require('ioredis');var intUtil=require(_0x00a1('0x6'));var config=require(_0x00a1('0x7'));var logger=require('../../../../config/logger')(_0x00a1('0x8'));config['redis']=_['defaults'](config[_0x00a1('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x00a1('0xa'))(new Redis(config['redis']));function emit(_0x3a7e45,_0x559200,_0x439c0d){io['to'](_0x3a7e45)['emit'](_0x559200,_0x439c0d);}function getTicket(_0x23ec4c,_0x53749c,_0x208439,_0x4d38db,_0x4619ab,_0x4922a5,_0x5cb624,_0x1eadeb){var _0x55950d=Object[_0x00a1('0xb')]({},{'OwnerId':_0x53749c['id'],'Subject':intUtil[_0x00a1('0xc')](_0x4d38db[_0x00a1('0xd')],_0x4619ab,'\x20'),'Description':intUtil[_0x00a1('0xc')](_0x4d38db[_0x00a1('0xe')],_0x4619ab,'\x0a')},getCustomFields(_0x4922a5,_0x4619ab));if(_0x208439){if(_0x4d38db[_0x00a1('0xf')]===_0x00a1('0x10')){_0x55950d['ActivityDate']=moment['utc']();_0x55950d['IsReminderSet']=![];_0x55950d[_0x00a1('0x11')]=![];if(_0x208439['endUserType']===_0x00a1('0x12')||_0x208439[_0x00a1('0x13')]===_0x00a1('0x14')){_0x55950d[_0x00a1('0x15')]=_0x208439['id'];}else if(_0x208439[_0x00a1('0x13')]===_0x00a1('0x16')){_0x55950d['WhatId']=_0x208439['id'];}}else if(_0x4d38db[_0x00a1('0xf')]==='Case'){if(_0x208439['endUserType']===_0x00a1('0x12')){_0x55950d['ContactId']=_0x208439['id'];}else if(_0x208439[_0x00a1('0x13')]===_0x00a1('0x16')){_0x55950d[_0x00a1('0x17')]=_0x208439['id'];}else if(_0x208439[_0x00a1('0x13')]==='lead'&&_0x4d38db['leadId']){_0x55950d[_0x4d38db[_0x00a1('0x18')]]=_0x208439['id'];}else{logger[_0x00a1('0x19')](_0x00a1('0x1a'));}}}return _0x5cb624[_0x00a1('0x1b')](_0x4d38db[_0x00a1('0xf')])[_0x00a1('0x1c')](_0x55950d);}function getUser(_0x3c1316,_0x2fa4b7,_0x39fd22){if(!_[_0x00a1('0x1d')](_0x2fa4b7)&&intUtil[_0x00a1('0x1e')](_0x2fa4b7)){var _0x3b81f9={'Email':_0x2fa4b7};var _0x346f55={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x39fd22[_0x00a1('0x1b')]('User')[_0x00a1('0x1f')](_0x3b81f9,_0x346f55)[_0x00a1('0x20')]()[_0x00a1('0x21')](function(_0x3faf9f){if(_0x3faf9f[_0x00a1('0x22')]){var _0x541c1c=_[_0x00a1('0x1f')](_0x3faf9f,function(_0x15863b){return _0x15863b['Email']===_0x2fa4b7;});if(_0x541c1c){logger[_0x00a1('0x19')]('Agent\x20%s\x20found.',_0x2fa4b7);return BPromise[_0x00a1('0x23')]({'id':_0x541c1c['Id'],'name':_0x541c1c[_0x00a1('0x24')]});}}else{logger[_0x00a1('0x19')](_0x00a1('0x25'),_0x2fa4b7);return _0x39fd22[_0x00a1('0x26')]()[_0x00a1('0x21')](function(_0x1355b9){return BPromise[_0x00a1('0x23')]({'id':_0x1355b9[_0x00a1('0x27')],'name':_0x1355b9[_0x00a1('0x28')]});});}});}else{logger[_0x00a1('0x19')](_0x00a1('0x25'),_0x2fa4b7);return _0x39fd22[_0x00a1('0x26')]()[_0x00a1('0x21')](function(_0x17daa5){return BPromise[_0x00a1('0x23')]({'id':_0x17daa5[_0x00a1('0x27')],'name':_0x17daa5[_0x00a1('0x28')]});});}}function getEndUser(_0x4ecf08,_0x4be1ae,_0x244ddd,_0x31c5a4,_0x55c06a){var _0x24d85c={'$or':{'Phone':_0x31c5a4}};var _0x24da5f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x00a1('0x23')]()['then'](function(){logger[_0x00a1('0x19')](_0x00a1('0x29'),_0x31c5a4,_0x4be1ae[_0x00a1('0x2a')]);switch(_0x4be1ae[_0x00a1('0x2a')]){case _0x00a1('0x2b'):var _0x420673=_[_0x00a1('0x2c')](_0x24d85c);if(_0x4be1ae[_0x00a1('0x2d')]){var _0xcc622c={};_0xcc622c[_0x4be1ae[_0x00a1('0x2d')]]=_0x31c5a4;_['merge'](_0x420673[_0x00a1('0x2e')],_0xcc622c);}return _0x55c06a[_0x00a1('0x1b')](_0x00a1('0x2f'))[_0x00a1('0x1f')](_0x420673,_0x24da5f)[_0x00a1('0x20')]()[_0x00a1('0x21')](function(_0x4a0129){if(_0x4a0129&&_0x4a0129[_0x00a1('0x22')]){return _0x4a0129;}else{var _0x20c773=_[_0x00a1('0x2c')](_0x24d85c);if(_0x4be1ae[_0x00a1('0x30')]){var _0xd26d2={};_0xd26d2[_0x4be1ae[_0x00a1('0x30')]]=_0x31c5a4;_[_0x00a1('0x31')](_0x20c773[_0x00a1('0x2e')],_0xd26d2);}return _0x55c06a['sobject'](_0x00a1('0x32'))['find'](_0x20c773,_0x24da5f);}});case _0x00a1('0x33'):var _0x5b166c=_['cloneDeep'](_0x24d85c);if(_0x4be1ae['additionalSearchAccount']){var _0xcc622c={};_0xcc622c[_0x4be1ae[_0x00a1('0x34')]]=_0x31c5a4;_[_0x00a1('0x31')](_0x5b166c[_0x00a1('0x2e')],_0xcc622c);}return _0x55c06a[_0x00a1('0x1b')](_0x00a1('0x35'))['find'](_0x5b166c,_0x24da5f)[_0x00a1('0x20')]()[_0x00a1('0x21')](function(_0x2020de){if(_0x2020de&&_0x2020de['length']){return _0x2020de;}else{var _0x4059b1=_[_0x00a1('0x2c')](_0x24d85c);if(_0x4be1ae[_0x00a1('0x2d')]){var _0x55abc0={};_0x55abc0[_0x4be1ae[_0x00a1('0x2d')]]=_0x31c5a4;_[_0x00a1('0x31')](_0x4059b1[_0x00a1('0x2e')],_0x55abc0);}return _0x55c06a[_0x00a1('0x1b')]('Contact')[_0x00a1('0x1f')](_0x4059b1,_0x24da5f)[_0x00a1('0x21')](function(_0x21b178){if(_0x21b178&&_0x21b178['length']){return _0x21b178;}else{var _0xdb3835=_[_0x00a1('0x2c')](_0x24d85c);if(_0x4be1ae[_0x00a1('0x30')]){var _0x4d7b71={};_0x4d7b71[_0x4be1ae[_0x00a1('0x30')]]=_0x31c5a4;_[_0x00a1('0x31')](_0xdb3835[_0x00a1('0x2e')],_0x4d7b71);}return _0x55c06a[_0x00a1('0x1b')](_0x00a1('0x32'))[_0x00a1('0x1f')](_0xdb3835,_0x24da5f);}});}});case _0x00a1('0x12'):var _0x420673=_['cloneDeep'](_0x24d85c);if(_0x4be1ae[_0x00a1('0x2d')]){var _0xcc622c={};_0xcc622c[_0x4be1ae[_0x00a1('0x2d')]]=_0x31c5a4;_['merge'](_0x420673[_0x00a1('0x2e')],_0xcc622c);}return _0x55c06a[_0x00a1('0x1b')]('Contact')[_0x00a1('0x1f')](_0x420673,_0x24da5f)[_0x00a1('0x20')]();case _0x00a1('0x14'):var _0x258792=_[_0x00a1('0x2c')](_0x24d85c);if(_0x4be1ae[_0x00a1('0x30')]){var _0xcc622c={};_0xcc622c[_0x4be1ae[_0x00a1('0x30')]]=_0x31c5a4;_['merge'](_0x258792['$or'],_0xcc622c);}return _0x55c06a[_0x00a1('0x1b')](_0x00a1('0x32'))[_0x00a1('0x1f')](_0x258792,_0x24da5f);case _0x00a1('0x16'):var _0x5b166c=_[_0x00a1('0x2c')](_0x24d85c);if(_0x4be1ae[_0x00a1('0x34')]){var _0xcc622c={};_0xcc622c[_0x4be1ae[_0x00a1('0x34')]]=_0x31c5a4;_[_0x00a1('0x31')](_0x5b166c[_0x00a1('0x2e')],_0xcc622c);}return _0x55c06a[_0x00a1('0x1b')](_0x00a1('0x35'))[_0x00a1('0x1f')](_0x5b166c,_0x24da5f);default:return null;}})[_0x00a1('0x21')](function(_0x32e2a9){if(_0x32e2a9&&_0x32e2a9[_0x00a1('0x22')]){var _0x52d148=_['first'](_0x32e2a9);if(_0x52d148){return BPromise[_0x00a1('0x23')]({'id':_0x52d148['Id'],'name':_0x52d148['Name'],'phone':_0x52d148['Phone'],'endUserType':_0x52d148['attributes'][_0x00a1('0x36')][_0x00a1('0x37')]()});}}})['then'](function(_0x1c7f66){if(_0x1c7f66){logger['info'](_0x00a1('0x38'),_0x1c7f66[_0x00a1('0x13')],_0x31c5a4);return BPromise['resolve'](_0x1c7f66);}else{logger[_0x00a1('0x19')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x31c5a4);var _0x1208e1={'Phone':_0x31c5a4};if(_0x4be1ae[_0x00a1('0x39')]){if(_0x4be1ae[_0x00a1('0x39')]===_0x00a1('0x12')){logger[_0x00a1('0x19')](_0x00a1('0x3a'),_0x31c5a4,_0x4be1ae[_0x00a1('0x39')]);_0x1208e1[_0x00a1('0x3b')]=_0x244ddd!==_0x00a1('0x3c')?_0x244ddd:util['format'](_0x00a1('0x3d'),_0x31c5a4);}else if(_0x4be1ae[_0x00a1('0x39')]==='lead'){logger[_0x00a1('0x19')](_0x00a1('0x3a'),_0x31c5a4,_0x4be1ae[_0x00a1('0x39')]);_0x1208e1['LastName']=_0x244ddd!==_0x00a1('0x3c')?_0x244ddd:util[_0x00a1('0x3e')]('Caller\x20-\x20%s',_0x31c5a4);_0x1208e1['Company']=_0x00a1('0x3f');}else if(_0x4be1ae[_0x00a1('0x39')]===_0x00a1('0x16')){logger[_0x00a1('0x19')](_0x00a1('0x3a'),_0x31c5a4,_0x4be1ae[_0x00a1('0x39')]);_0x1208e1[_0x00a1('0x24')]=_0x244ddd!==''?_0x244ddd:util[_0x00a1('0x3e')](_0x00a1('0x3d'),_0x31c5a4);}else{return null;}}return _0x55c06a[_0x00a1('0x1b')](_['upperFirst'](_0x4be1ae[_0x00a1('0x39')]))[_0x00a1('0x1c')](_0x1208e1)['then'](function(_0x5171ea){return BPromise[_0x00a1('0x23')]({'id':_0x5171ea['id'],'endUserType':_0x4be1ae[_0x00a1('0x39')]});});}});}function getCustomFields(_0x1f1aaf,_0x5e258a){var _0x55385f={};if(_0x1f1aaf[_0x00a1('0x22')]>0x0){_[_0x00a1('0x40')](_0x1f1aaf,function(_0x26b97d){if(_[_0x00a1('0x41')]([_0x00a1('0x42'),_0x00a1('0x43')],_0x26b97d[_0x00a1('0x36')])&&_0x26b97d['idField']){_0x55385f[_0x26b97d['idField']]=_0x26b97d['content']['toString']();}else if(_0x26b97d['type']==='variable'&&_0x26b97d[_0x00a1('0x44')]&&_0x26b97d[_0x00a1('0x45')]){_0x5e258a[_0x26b97d[_0x00a1('0x44')]]&&(_0x55385f[_0x26b97d[_0x00a1('0x45')]]=_0x5e258a[_0x26b97d['variableName']]['toString']());}else if(_0x26b97d[_0x00a1('0x36')]==='customVariable'&&_0x26b97d[_0x00a1('0x46')]&&_0x26b97d[_0x00a1('0x46')][_0x00a1('0x47')]&&_0x26b97d[_0x00a1('0x45')]){_0x5e258a[_0x26b97d[_0x00a1('0x46')][_0x00a1('0x47')][_0x00a1('0x37')]()]&&(_0x55385f[_0x26b97d[_0x00a1('0x45')]]=_0x5e258a[_0x26b97d[_0x00a1('0x46')]['name'][_0x00a1('0x37')]()][_0x00a1('0x48')]());}});}return _0x55385f;}function getConnection(_0x166d21){var _0x3e4e29=_0x166d21[_0x00a1('0x49')][_0x00a1('0x4a')](_0x166d21[_0x00a1('0x4b')]);var _0x380493=new jsforce[(_0x00a1('0x4c'))]({'oauth2':{'loginUrl':_0x166d21['remoteUri']||'https://login.salesforce.com','clientId':_0x166d21[_0x00a1('0x4d')],'clientSecret':_0x166d21['clientSecret']}});return _0x380493[_0x00a1('0x4e')](_0x166d21[_0x00a1('0x4f')],_0x3e4e29)['then'](function(){logger[_0x00a1('0x19')]('Connection\x20established.');return _0x380493;});}exports[_0x00a1('0x50')]=function(_0x272e3b,_0xf592aa,_0x5c1985,_0xf12376,_0xdc936,_0x2250f3){var _0x5a2644,_0x46be2f,_0x558fef,_0x427de2;_0x2250f3[_0x00a1('0x51')]=intUtil['stripTrailingSlash'](_0x2250f3[_0x00a1('0x51')]);_0x2250f3[_0x00a1('0x52')]=intUtil[_0x00a1('0x53')](_0x2250f3[_0x00a1('0x52')]);if(_0xdc936&&_0xdc936[_0x00a1('0x54')]){logger['info'](_0x00a1('0x55'),_0x00a1('0x56'));_0xf592aa[_0x00a1('0x57')]=util[_0x00a1('0x3e')](_0x00a1('0x58'),_0x2250f3[_0x00a1('0x51')],_0xf592aa[_0x00a1('0x59')],md5(_0xf592aa[_0x00a1('0x59')]));}else{_0xf592aa[_0x00a1('0x57')]='';}return getConnection(_0x2250f3)[_0x00a1('0x21')](function(_0x28f13a){_0x427de2=_0x28f13a;return getUser(_0x2250f3,_0xf12376[_0x00a1('0x5a')],_0x427de2);})[_0x00a1('0x21')](function(_0x5e159f){_0x5a2644=_0x5e159f;return getEndUser(_0x2250f3,_0x5c1985,_0xf592aa[_0x00a1('0x5b')],_0xf592aa['calleridnum'],_0x427de2);})[_0x00a1('0x21')](function(_0x3092a7){_0x46be2f=_0x3092a7;return getTicket(_0x2250f3,_0x5a2644,_0x46be2f,_0x5c1985,_0xf592aa,_0x5c1985[_0x00a1('0x5c')],_0x427de2,'queue');})[_0x00a1('0x21')](function(_0x1b7af4){_0x558fef=_0x1b7af4;logger[_0x00a1('0x19')](_0x00a1('0x5d'),_0x558fef['id']);logger['info'](_0x00a1('0x5e'),_0x558fef['id'],_0xf12376[_0x00a1('0x47')],_0x2250f3[_0x00a1('0x36')]);switch(_0x2250f3[_0x00a1('0x36')]){case _0x00a1('0x5f'):emit(util[_0x00a1('0x3e')]('user:%s',_0xf12376['name']),_0x00a1('0x60'),{'recordId':_0x558fef['id']});break;case _0x00a1('0x61'):emit(util[_0x00a1('0x3e')](_0x00a1('0x62'),_0xf12376['name']),_0x00a1('0x63'),{'uri':util['format'](_0x00a1('0x64'),_0x427de2['instanceUrl'],_0x558fef['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x00a1('0x65')](function(_0x2a04a9){logger[_0x00a1('0x66')](_0x00a1('0x55'),_0x2a04a9);});};exports[_0x00a1('0x67')]=function(_0x2bcd0a,_0x1e7dbf,_0x22eab0,_0x3551d0,_0x50198d,_0x265319,_0x58b8f5){var _0x43b4b3,_0x3948b1,_0x20e90e,_0x22caa5;_0x265319['serverUrl']=intUtil[_0x00a1('0x53')](_0x265319[_0x00a1('0x51')]);_0x265319[_0x00a1('0x52')]=intUtil[_0x00a1('0x53')](_0x265319[_0x00a1('0x52')]);if(_0x58b8f5&&_0x58b8f5[_0x00a1('0x68')]&&_0x58b8f5['recordingFormat']!==_0x00a1('0x69')){logger[_0x00a1('0x19')](_0x00a1('0x6a'),_0x00a1('0x56'));_0x1e7dbf['recordingURL']=util[_0x00a1('0x3e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x265319['serverUrl'],_0x1e7dbf[_0x00a1('0x59')],md5(_0x1e7dbf[_0x00a1('0x59')]));}return getConnection(_0x265319)[_0x00a1('0x21')](function(_0x34ed1e){_0x22caa5=_0x34ed1e;return getUser(_0x265319,_0x3551d0[_0x00a1('0x5a')],_0x22caa5);})[_0x00a1('0x21')](function(_0x1159b0){_0x43b4b3=_0x1159b0;return getEndUser(_0x265319,_0x22eab0,_0x1e7dbf['destcalleridname'],_0x1e7dbf[_0x00a1('0x6b')],_0x22caa5);})[_0x00a1('0x21')](function(_0x15ddb2){_0x3948b1=_0x15ddb2;return getTicket(_0x265319,_0x43b4b3,_0x3948b1,_0x22eab0,_0x1e7dbf,_0x22eab0[_0x00a1('0x5c')],_0x22caa5,_0x00a1('0x67'));})[_0x00a1('0x21')](function(_0x2dc1bc){_0x20e90e=_0x2dc1bc;logger[_0x00a1('0x19')](_0x00a1('0x6c'),_0x20e90e['id']);logger['info'](_0x00a1('0x6d'),_0x20e90e['id'],_0x3551d0[_0x00a1('0x47')],_0x265319[_0x00a1('0x36')]);switch(_0x265319[_0x00a1('0x36')]){case _0x00a1('0x5f'):emit(util[_0x00a1('0x3e')]('user:%s',_0x3551d0[_0x00a1('0x47')]),_0x00a1('0x60'),{'recordId':_0x20e90e['id']});break;case _0x00a1('0x61'):emit(util[_0x00a1('0x3e')]('user:%s',_0x3551d0[_0x00a1('0x47')]),'trigger:browser:url',{'uri':util['format'](_0x00a1('0x64'),_0x22caa5[_0x00a1('0x6e')],_0x20e90e['id'])});break;default:logger[_0x00a1('0x66')](_0x00a1('0x6a'),_0x00a1('0x6f'));}})[_0x00a1('0x65')](function(_0x1b4176){logger[_0x00a1('0x66')](_0x00a1('0x6a'),_0x1b4176);});};exports[_0x00a1('0x70')]=function(_0x59fa0d,_0x3e0da8,_0x5eb618,_0x2f8cd0,_0x4879a6,_0x33019a){var _0x2ac5ed,_0x30196d,_0x15ae13,_0x1c3feb;_0x33019a['serverUrl']=intUtil['stripTrailingSlash'](_0x33019a[_0x00a1('0x51')]);_0x33019a[_0x00a1('0x52')]=intUtil[_0x00a1('0x53')](_0x33019a[_0x00a1('0x52')]);if(_0x4879a6&&_0x4879a6[_0x00a1('0x54')]){logger[_0x00a1('0x19')]('['+_0x3e0da8[_0x00a1('0x71')][_0x00a1('0x72')]()+']',_0x00a1('0x56'));_0x3e0da8[_0x00a1('0x57')]=util[_0x00a1('0x3e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x33019a['serverUrl'],_0x3e0da8[_0x00a1('0x59')],md5(_0x3e0da8[_0x00a1('0x59')]));}else{_0x3e0da8[_0x00a1('0x57')]='';}return getConnection(_0x33019a)[_0x00a1('0x21')](function(_0x5b7195){_0x1c3feb=_0x5b7195;if(!_[_0x00a1('0x1d')](_0x2f8cd0)){return getUser(_0x33019a,_0x2f8cd0[_0x00a1('0x47')],_0x1c3feb);}else{return getUser(_0x33019a,null,_0x1c3feb);}})['then'](function(_0x22c56f){_0x2ac5ed=_0x22c56f;return getEndUser(_0x33019a,_0x5eb618,_0x3e0da8[_0x00a1('0x5b')],_0x3e0da8[_0x00a1('0x73')],_0x1c3feb);})[_0x00a1('0x21')](function(_0x36db4c){_0x30196d=_0x36db4c;return getTicket(_0x33019a,_0x2ac5ed,_0x30196d,_0x5eb618,_0x3e0da8,_0x5eb618[_0x00a1('0x5c')],_0x1c3feb);})[_0x00a1('0x21')](function(_0x1fcde0){_0x15ae13=_0x1fcde0;logger[_0x00a1('0x19')]('['+_0x3e0da8[_0x00a1('0x71')]['toUpperCase']()+_0x00a1('0x74'),_0x15ae13['id']);logger[_0x00a1('0x19')]('['+_0x3e0da8['lastevent'][_0x00a1('0x72')]()+_0x00a1('0x75'),_0x33019a[_0x00a1('0x36')]);})['catch'](function(_0x47f3f8){logger[_0x00a1('0x66')]('['+_0x3e0da8['lastevent'][_0x00a1('0x72')]()+']',_0x47f3f8);});}; \ No newline at end of file +var _0xdbaa=['isNil','sobject','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','LastName','Caller\x20-\x20%s','Company','No\x20Company','includes','string','toString','variable','idField','variableName','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','./util','salesforce','defaults','socket.io-emitter','redis','emit','Subjects','getString','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','contact','endUserType','lead','WhoId','account','Case','leadId','info','create'];(function(_0x22754d,_0x3ffa6b){var _0x4e2724=function(_0x3e4691){while(--_0x3e4691){_0x22754d['push'](_0x22754d['shift']());}};_0x4e2724(++_0x3ffa6b);}(_0xdbaa,0x156));var _0xadba=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xdbaa[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xadba('0x0'));var rp=require(_0xadba('0x1'));var moment=require(_0xadba('0x2'));var BPromise=require(_0xadba('0x3'));var md5=require('md5');var jsforce=require(_0xadba('0x4'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xadba('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xadba('0x6'));config['redis']=_[_0xadba('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xadba('0x8'))(new Redis(config[_0xadba('0x9')]));function emit(_0x442c9d,_0x97775f,_0x46d546){io['to'](_0x442c9d)[_0xadba('0xa')](_0x97775f,_0x46d546);}function getTicket(_0x32cd87,_0x1368cb,_0x175973,_0x4f9be1,_0x1fb272,_0x3b7c26,_0x4740a2,_0x5ef5b1){var _0x449280=Object['assign']({},{'OwnerId':_0x1368cb['id'],'Subject':intUtil['getString'](_0x4f9be1[_0xadba('0xb')],_0x1fb272,'\x20'),'Description':intUtil[_0xadba('0xc')](_0x4f9be1[_0xadba('0xd')],_0x1fb272,'\x0a')},getCustomFields(_0x3b7c26,_0x1fb272));if(_0x175973){if(_0x4f9be1[_0xadba('0xe')]==='Task'){_0x449280[_0xadba('0xf')]=moment[_0xadba('0x10')]();_0x449280['IsReminderSet']=![];_0x449280[_0xadba('0x11')]=![];if(_0x175973['endUserType']===_0xadba('0x12')||_0x175973[_0xadba('0x13')]===_0xadba('0x14')){_0x449280[_0xadba('0x15')]=_0x175973['id'];}else if(_0x175973[_0xadba('0x13')]===_0xadba('0x16')){_0x449280['WhatId']=_0x175973['id'];}}else if(_0x4f9be1['ticketType']===_0xadba('0x17')){if(_0x175973[_0xadba('0x13')]===_0xadba('0x12')){_0x449280['ContactId']=_0x175973['id'];}else if(_0x175973[_0xadba('0x13')]===_0xadba('0x16')){_0x449280['AccountId']=_0x175973['id'];}else if(_0x175973[_0xadba('0x13')]===_0xadba('0x14')&&_0x4f9be1['leadId']){_0x449280[_0x4f9be1[_0xadba('0x18')]]=_0x175973['id'];}else{logger[_0xadba('0x19')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4740a2['sobject'](_0x4f9be1[_0xadba('0xe')])[_0xadba('0x1a')](_0x449280);}function getUser(_0x471c77,_0x34cde5,_0x55b8fb){if(!_[_0xadba('0x1b')](_0x34cde5)&&intUtil['validateEmail'](_0x34cde5)){var _0x31c12c={'Email':_0x34cde5};var _0x41b7ef={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x55b8fb[_0xadba('0x1c')](_0xadba('0x1d'))[_0xadba('0x1e')](_0x31c12c,_0x41b7ef)[_0xadba('0x1f')]()[_0xadba('0x20')](function(_0x56bab7){if(_0x56bab7['length']){var _0x1881b6=_[_0xadba('0x1e')](_0x56bab7,function(_0x440f47){return _0x440f47[_0xadba('0x21')]===_0x34cde5;});if(_0x1881b6){logger[_0xadba('0x19')](_0xadba('0x22'),_0x34cde5);return BPromise[_0xadba('0x23')]({'id':_0x1881b6['Id'],'name':_0x1881b6[_0xadba('0x24')]});}}else{logger[_0xadba('0x19')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x34cde5);return _0x55b8fb[_0xadba('0x25')]()['then'](function(_0x52d19a){return BPromise[_0xadba('0x23')]({'id':_0x52d19a[_0xadba('0x26')],'name':_0x52d19a[_0xadba('0x27')]});});}});}else{logger[_0xadba('0x19')](_0xadba('0x28'),_0x34cde5);return _0x55b8fb[_0xadba('0x25')]()[_0xadba('0x20')](function(_0x194f0c){return BPromise[_0xadba('0x23')]({'id':_0x194f0c[_0xadba('0x26')],'name':_0x194f0c[_0xadba('0x27')]});});}}function getEndUser(_0x57e918,_0x9a7b69,_0x3185f1,_0x54ba9b,_0xbfa0e7){var _0x1308c1={'$or':{'Phone':_0x54ba9b}};var _0x32b649={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xadba('0x23')]()[_0xadba('0x20')](function(){logger[_0xadba('0x19')](_0xadba('0x29'),_0x54ba9b,_0x9a7b69[_0xadba('0x2a')]);switch(_0x9a7b69[_0xadba('0x2a')]){case _0xadba('0x2b'):var _0xb75d24=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x2d')]){var _0x3c8856={};_0x3c8856[_0x9a7b69[_0xadba('0x2d')]]=_0x54ba9b;_[_0xadba('0x2e')](_0xb75d24[_0xadba('0x2f')],_0x3c8856);}return _0xbfa0e7[_0xadba('0x1c')](_0xadba('0x30'))[_0xadba('0x1e')](_0xb75d24,_0x32b649)[_0xadba('0x1f')]()[_0xadba('0x20')](function(_0x180021){if(_0x180021&&_0x180021[_0xadba('0x31')]){return _0x180021;}else{var _0x5c105a=_['cloneDeep'](_0x1308c1);if(_0x9a7b69['additionalSearchLead']){var _0x2f66e5={};_0x2f66e5[_0x9a7b69[_0xadba('0x32')]]=_0x54ba9b;_[_0xadba('0x2e')](_0x5c105a['$or'],_0x2f66e5);}return _0xbfa0e7['sobject'](_0xadba('0x33'))[_0xadba('0x1e')](_0x5c105a,_0x32b649);}});case _0xadba('0x34'):var _0x108ad7=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x35')]){var _0x3c8856={};_0x3c8856[_0x9a7b69[_0xadba('0x35')]]=_0x54ba9b;_['merge'](_0x108ad7[_0xadba('0x2f')],_0x3c8856);}return _0xbfa0e7[_0xadba('0x1c')](_0xadba('0x36'))[_0xadba('0x1e')](_0x108ad7,_0x32b649)[_0xadba('0x1f')]()[_0xadba('0x20')](function(_0x1371db){if(_0x1371db&&_0x1371db[_0xadba('0x31')]){return _0x1371db;}else{var _0x29e722=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x2d')]){var _0x25e4bb={};_0x25e4bb[_0x9a7b69['additionalSearchContact']]=_0x54ba9b;_[_0xadba('0x2e')](_0x29e722[_0xadba('0x2f')],_0x25e4bb);}return _0xbfa0e7[_0xadba('0x1c')]('Contact')[_0xadba('0x1e')](_0x29e722,_0x32b649)[_0xadba('0x20')](function(_0x9018a4){if(_0x9018a4&&_0x9018a4[_0xadba('0x31')]){return _0x9018a4;}else{var _0x27d5f2=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x32')]){var _0x2ee3c8={};_0x2ee3c8[_0x9a7b69[_0xadba('0x32')]]=_0x54ba9b;_[_0xadba('0x2e')](_0x27d5f2[_0xadba('0x2f')],_0x2ee3c8);}return _0xbfa0e7[_0xadba('0x1c')]('Lead')[_0xadba('0x1e')](_0x27d5f2,_0x32b649);}});}});case'contact':var _0xb75d24=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x2d')]){var _0x3c8856={};_0x3c8856[_0x9a7b69[_0xadba('0x2d')]]=_0x54ba9b;_[_0xadba('0x2e')](_0xb75d24['$or'],_0x3c8856);}return _0xbfa0e7[_0xadba('0x1c')](_0xadba('0x30'))[_0xadba('0x1e')](_0xb75d24,_0x32b649)[_0xadba('0x1f')]();case _0xadba('0x14'):var _0x58736c=_[_0xadba('0x2c')](_0x1308c1);if(_0x9a7b69[_0xadba('0x32')]){var _0x3c8856={};_0x3c8856[_0x9a7b69[_0xadba('0x32')]]=_0x54ba9b;_[_0xadba('0x2e')](_0x58736c[_0xadba('0x2f')],_0x3c8856);}return _0xbfa0e7[_0xadba('0x1c')](_0xadba('0x33'))[_0xadba('0x1e')](_0x58736c,_0x32b649);case _0xadba('0x16'):var _0x108ad7=_['cloneDeep'](_0x1308c1);if(_0x9a7b69[_0xadba('0x35')]){var _0x3c8856={};_0x3c8856[_0x9a7b69['additionalSearchAccount']]=_0x54ba9b;_['merge'](_0x108ad7[_0xadba('0x2f')],_0x3c8856);}return _0xbfa0e7['sobject']('Account')[_0xadba('0x1e')](_0x108ad7,_0x32b649);default:return null;}})[_0xadba('0x20')](function(_0x1ecea6){if(_0x1ecea6&&_0x1ecea6[_0xadba('0x31')]){var _0x10a231=_[_0xadba('0x37')](_0x1ecea6);if(_0x10a231){return BPromise[_0xadba('0x23')]({'id':_0x10a231['Id'],'name':_0x10a231['Name'],'phone':_0x10a231['Phone'],'endUserType':_0x10a231[_0xadba('0x38')][_0xadba('0x39')][_0xadba('0x3a')]()});}}})[_0xadba('0x20')](function(_0xe2762f){if(_0xe2762f){logger[_0xadba('0x19')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0xe2762f[_0xadba('0x13')],_0x54ba9b);return BPromise['resolve'](_0xe2762f);}else{logger[_0xadba('0x19')](_0xadba('0x3b'),_0x54ba9b);var _0x36affa={'Phone':_0x54ba9b};if(_0x9a7b69[_0xadba('0x3c')]){if(_0x9a7b69[_0xadba('0x3c')]===_0xadba('0x12')){logger[_0xadba('0x19')](_0xadba('0x3d'),_0x54ba9b,_0x9a7b69[_0xadba('0x3c')]);_0x36affa['LastName']=_0x3185f1!==_0xadba('0x3e')?_0x3185f1:util[_0xadba('0x3f')]('Caller\x20-\x20%s',_0x54ba9b);}else if(_0x9a7b69[_0xadba('0x3c')]===_0xadba('0x14')){logger[_0xadba('0x19')](_0xadba('0x3d'),_0x54ba9b,_0x9a7b69[_0xadba('0x3c')]);_0x36affa[_0xadba('0x40')]=_0x3185f1!==_0xadba('0x3e')?_0x3185f1:util[_0xadba('0x3f')](_0xadba('0x41'),_0x54ba9b);_0x36affa[_0xadba('0x42')]=_0xadba('0x43');}else if(_0x9a7b69[_0xadba('0x3c')]===_0xadba('0x16')){logger[_0xadba('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x54ba9b,_0x9a7b69[_0xadba('0x3c')]);_0x36affa[_0xadba('0x24')]=_0x3185f1!==_0xadba('0x3e')?_0x3185f1:util['format'](_0xadba('0x41'),_0x54ba9b);}else{return null;}}return _0xbfa0e7[_0xadba('0x1c')](_['upperFirst'](_0x9a7b69[_0xadba('0x3c')]))['create'](_0x36affa)[_0xadba('0x20')](function(_0x26d7aa){return BPromise[_0xadba('0x23')]({'id':_0x26d7aa['id'],'endUserType':_0x9a7b69[_0xadba('0x3c')]});});}});}function getCustomFields(_0xc31181,_0x507e5e){var _0x108a54={};if(_0xc31181[_0xadba('0x31')]>0x0){_['forEach'](_0xc31181,function(_0x13f306){if(_[_0xadba('0x44')]([_0xadba('0x45'),'picklist'],_0x13f306[_0xadba('0x39')])&&_0x13f306['idField']){_0x108a54[_0x13f306['idField']]=_0x13f306['content'][_0xadba('0x46')]();}else if(_0x13f306['type']===_0xadba('0x47')&&_0x13f306['variableName']&&_0x13f306[_0xadba('0x48')]){_0x507e5e[_0x13f306[_0xadba('0x49')]]&&(_0x108a54[_0x13f306[_0xadba('0x48')]]=_0x507e5e[_0x13f306[_0xadba('0x49')]][_0xadba('0x46')]());}else if(_0x13f306['type']===_0xadba('0x4a')&&_0x13f306['Variable']&&_0x13f306[_0xadba('0x4b')][_0xadba('0x4c')]&&_0x13f306['idField']){_0x507e5e[_0x13f306[_0xadba('0x4b')][_0xadba('0x4c')][_0xadba('0x3a')]()]&&(_0x108a54[_0x13f306['idField']]=_0x507e5e[_0x13f306[_0xadba('0x4b')][_0xadba('0x4c')][_0xadba('0x3a')]()][_0xadba('0x46')]());}});}return _0x108a54;}function getConnection(_0x44b69f){var _0x2de293=_0x44b69f['password'][_0xadba('0x4d')](_0x44b69f[_0xadba('0x4e')]);var _0x6b4734=new jsforce[(_0xadba('0x4f'))]({'oauth2':{'loginUrl':_0x44b69f['remoteUri']||_0xadba('0x50'),'clientId':_0x44b69f[_0xadba('0x51')],'clientSecret':_0x44b69f[_0xadba('0x52')]}});return _0x6b4734[_0xadba('0x53')](_0x44b69f[_0xadba('0x54')],_0x2de293)[_0xadba('0x20')](function(){logger['info'](_0xadba('0x55'));return _0x6b4734;});}exports[_0xadba('0x56')]=function(_0x2261d2,_0x2568d8,_0x139536,_0x3df117,_0x3eadc4,_0x40fb89){var _0x5c6da0,_0x7c8714,_0x1dbe60,_0x34ea7a;_0x40fb89[_0xadba('0x57')]=intUtil[_0xadba('0x58')](_0x40fb89[_0xadba('0x57')]);_0x40fb89[_0xadba('0x59')]=intUtil[_0xadba('0x58')](_0x40fb89[_0xadba('0x59')]);if(_0x3eadc4&&_0x3eadc4[_0xadba('0x5a')]){logger[_0xadba('0x19')]('[QUEUE]',_0xadba('0x5b'));_0x2568d8[_0xadba('0x5c')]=util[_0xadba('0x3f')](_0xadba('0x5d'),_0x40fb89['serverUrl'],_0x2568d8['uniqueid'],md5(_0x2568d8[_0xadba('0x5e')]));}else{_0x2568d8[_0xadba('0x5c')]='';}return getConnection(_0x40fb89)['then'](function(_0x82745){_0x34ea7a=_0x82745;return getUser(_0x40fb89,_0x3df117['email'],_0x34ea7a);})[_0xadba('0x20')](function(_0x1a59cb){_0x5c6da0=_0x1a59cb;return getEndUser(_0x40fb89,_0x139536,_0x2568d8[_0xadba('0x5f')],_0x2568d8[_0xadba('0x60')],_0x34ea7a);})['then'](function(_0x3a74a3){_0x7c8714=_0x3a74a3;return getTicket(_0x40fb89,_0x5c6da0,_0x7c8714,_0x139536,_0x2568d8,_0x139536[_0xadba('0x61')],_0x34ea7a,'queue');})[_0xadba('0x20')](function(_0x895c9d){_0x1dbe60=_0x895c9d;logger[_0xadba('0x19')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x1dbe60['id']);logger[_0xadba('0x19')](_0xadba('0x62'),_0x1dbe60['id'],_0x3df117[_0xadba('0x4c')],_0x40fb89[_0xadba('0x39')]);switch(_0x40fb89[_0xadba('0x39')]){case _0xadba('0x63'):emit(util['format'](_0xadba('0x64'),_0x3df117[_0xadba('0x4c')]),_0xadba('0x65'),{'recordId':_0x1dbe60['id']});break;case _0xadba('0x66'):emit(util[_0xadba('0x3f')](_0xadba('0x64'),_0x3df117['name']),'trigger:browser:url',{'uri':util[_0xadba('0x3f')]('%s/%s/e',_0x34ea7a[_0xadba('0x67')],_0x1dbe60['id'])});break;default:logger['error'](_0xadba('0x68'));}})['catch'](function(_0x4219ff){logger[_0xadba('0x69')](_0xadba('0x6a'),_0x4219ff);});};exports[_0xadba('0x6b')]=function(_0x2be5ba,_0x114afc,_0x40e088,_0xd04928,_0xc82bb5,_0x14a96a,_0x1e5a82){var _0x2c01d5,_0x51cb8b,_0x5b6fb6,_0x338fbe;_0x14a96a[_0xadba('0x57')]=intUtil[_0xadba('0x58')](_0x14a96a[_0xadba('0x57')]);_0x14a96a[_0xadba('0x59')]=intUtil[_0xadba('0x58')](_0x14a96a[_0xadba('0x59')]);if(_0x1e5a82&&_0x1e5a82[_0xadba('0x6c')]&&_0x1e5a82[_0xadba('0x6c')]!==_0xadba('0x6d')){logger['info'](_0xadba('0x6e'),'Recording\x20is\x20enabled!');_0x114afc['recordingURL']=util['format'](_0xadba('0x5d'),_0x14a96a[_0xadba('0x57')],_0x114afc[_0xadba('0x5e')],md5(_0x114afc[_0xadba('0x5e')]));}return getConnection(_0x14a96a)['then'](function(_0x33b6ef){_0x338fbe=_0x33b6ef;return getUser(_0x14a96a,_0xd04928[_0xadba('0x6f')],_0x338fbe);})[_0xadba('0x20')](function(_0x2d3ca2){_0x2c01d5=_0x2d3ca2;return getEndUser(_0x14a96a,_0x40e088,_0x114afc[_0xadba('0x70')],_0x114afc[_0xadba('0x71')],_0x338fbe);})[_0xadba('0x20')](function(_0x437852){_0x51cb8b=_0x437852;return getTicket(_0x14a96a,_0x2c01d5,_0x51cb8b,_0x40e088,_0x114afc,_0x40e088[_0xadba('0x61')],_0x338fbe,'outbound');})[_0xadba('0x20')](function(_0xa004a7){_0x5b6fb6=_0xa004a7;logger[_0xadba('0x19')](_0xadba('0x72'),_0x5b6fb6['id']);logger[_0xadba('0x19')](_0xadba('0x73'),_0x5b6fb6['id'],_0xd04928[_0xadba('0x4c')],_0x14a96a[_0xadba('0x39')]);switch(_0x14a96a[_0xadba('0x39')]){case _0xadba('0x63'):emit(util[_0xadba('0x3f')]('user:%s',_0xd04928[_0xadba('0x4c')]),_0xadba('0x65'),{'recordId':_0x5b6fb6['id']});break;case _0xadba('0x66'):emit(util['format'](_0xadba('0x64'),_0xd04928['name']),_0xadba('0x74'),{'uri':util['format']('%s/%s/e',_0x338fbe[_0xadba('0x67')],_0x5b6fb6['id'])});break;default:logger[_0xadba('0x69')](_0xadba('0x6e'),_0xadba('0x75'));}})[_0xadba('0x76')](function(_0x4917fe){logger[_0xadba('0x69')](_0xadba('0x6e'),_0x4917fe);});};exports['unmanaged']=function(_0x3485fd,_0x4c0dd1,_0x7e96f9,_0x5ec22a,_0x34834e,_0x1fceda){var _0x42a67b,_0x2d46d8,_0x12de67,_0x305fa6;_0x1fceda[_0xadba('0x57')]=intUtil[_0xadba('0x58')](_0x1fceda[_0xadba('0x57')]);_0x1fceda[_0xadba('0x59')]=intUtil[_0xadba('0x58')](_0x1fceda['remoteUri']);if(_0x34834e&&_0x34834e['monitor_format']){logger[_0xadba('0x19')]('['+_0x4c0dd1[_0xadba('0x77')][_0xadba('0x78')]()+']',_0xadba('0x5b'));_0x4c0dd1[_0xadba('0x5c')]=util[_0xadba('0x3f')](_0xadba('0x5d'),_0x1fceda[_0xadba('0x57')],_0x4c0dd1[_0xadba('0x5e')],md5(_0x4c0dd1[_0xadba('0x5e')]));}else{_0x4c0dd1[_0xadba('0x5c')]='';}return getConnection(_0x1fceda)['then'](function(_0x3973ca){_0x305fa6=_0x3973ca;if(!_[_0xadba('0x1b')](_0x5ec22a)){return getUser(_0x1fceda,_0x5ec22a[_0xadba('0x4c')],_0x305fa6);}else{return getUser(_0x1fceda,null,_0x305fa6);}})['then'](function(_0x51299c){_0x42a67b=_0x51299c;return getEndUser(_0x1fceda,_0x7e96f9,_0x4c0dd1['calleridname'],_0x4c0dd1[_0xadba('0x60')],_0x305fa6);})[_0xadba('0x20')](function(_0x1f4273){_0x2d46d8=_0x1f4273;return getTicket(_0x1fceda,_0x42a67b,_0x2d46d8,_0x7e96f9,_0x4c0dd1,_0x7e96f9[_0xadba('0x61')],_0x305fa6);})['then'](function(_0x84ca8b){_0x12de67=_0x84ca8b;logger[_0xadba('0x19')]('['+_0x4c0dd1['lastevent'][_0xadba('0x78')]()+_0xadba('0x79'),_0x12de67['id']);logger[_0xadba('0x19')]('['+_0x4c0dd1[_0xadba('0x77')][_0xadba('0x78')]()+_0xadba('0x7a'),_0x1fceda[_0xadba('0x39')]);})[_0xadba('0x76')](function(_0x156a98){logger[_0xadba('0x69')]('['+_0x4c0dd1[_0xadba('0x77')][_0xadba('0x78')]()+']',_0x156a98);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 08a33eb..f02e43c 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 _0x850d=['calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','System','endUserNumber','],\x20getEndUser\x20input\x20crm','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','toString','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','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','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum'];(function(_0x135a1c,_0x28b5f6){var _0x295c98=function(_0x2747fc){while(--_0x2747fc){_0x135a1c['push'](_0x135a1c['shift']());}};_0x295c98(++_0x28b5f6);}(_0x850d,0x1c1));var _0xd850=function(_0x2ef7b0,_0x3c1a32){_0x2ef7b0=_0x2ef7b0-0x0;var _0x41739b=_0x850d[_0x2ef7b0];return _0x41739b;};'use strict';var _=require(_0xd850('0x0'));var Promise=require('bluebird');var rp=require(_0xd850('0x1'));var util=require(_0xd850('0x2'));var md5=require(_0xd850('0x3'));var Redis=require(_0xd850('0x4'));var intUtil=require(_0xd850('0x5'));var config=require(_0xd850('0x6'));var logger=require(_0xd850('0x7'))('servicenow');config[_0xd850('0x8')]=_[_0xd850('0x9')](config['redis'],{'host':_0xd850('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd850('0x8')]));function getAdminUser(_0x1469ea,_0x272f72,_0x3a4850,_0x2846b9,_0x23049d,_0x3a1ef2){return new Promise(function(_0x274f61,_0x39c421){var _0x1cc2eb={'method':_0xd850('0xb'),'uri':_0x2846b9+_0xd850('0xc')+'&'+_0x23049d+'&'+_0x3a1ef2,'auth':_0x272f72,'json':!![]};return rp(_0x1cc2eb)[_0xd850('0xd')](function(_0x159915){if(_0x159915[_0xd850('0xe')][_0xd850('0xf')]>0x0){_0x3a4850[_0xd850('0x10')]=_0x159915[_0xd850('0xe')][0x0][_0xd850('0x11')];}logger[_0xd850('0x12')]('['+[_0x1469ea['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x3a4850);_0x274f61(_0x3a4850);})[_0xd850('0x13')](function(_0x12b822){logger[_0xd850('0x14')]('['+[_0x1469ea[_0xd850('0x15')]()]+']',_0x12b822[_0xd850('0x16')]);_0x39c421(_0x12b822[_0xd850('0x16')]);});});}function getUser(_0x4bf103,_0x23a4fb,_0x305f29,_0x380b51,_0x5a7a08){return function(_0x2dee06){logger[_0xd850('0x12')]('['+[_0x4bf103[_0xd850('0x15')]()]+_0xd850('0x17'),_0x2dee06);return new Promise(function(_0x282b58,_0x1d63a1){if(intUtil[_0xd850('0x18')](_0x2dee06[_0xd850('0x19')])){var _0x423e5a={'method':_0xd850('0xb'),'uri':_0x305f29+_0xd850('0x1a')+_0x2dee06[_0xd850('0x19')]+'&'+_0x380b51+'&'+_0x5a7a08,'auth':_0x23a4fb,'json':!![]};logger[_0xd850('0x12')]('['+[_0x4bf103[_0xd850('0x15')]()]+_0xd850('0x1b'),_0x423e5a);return rp(_0x423e5a)[_0xd850('0xd')](function(_0x307ddf){logger[_0xd850('0x12')]('['+[_0x4bf103[_0xd850('0x15')]()]+_0xd850('0x1c'),_0x307ddf);if(_0x307ddf[_0xd850('0xe')][_0xd850('0xf')]>0x0&&String(_0x307ddf[_0xd850('0xe')][0x0][_0xd850('0x1d')])===_0xd850('0x1e')){_0x2dee06[_0xd850('0x1f')]=_0x307ddf['result'][0x0][_0xd850('0x11')];}else{_0x2dee06['userId']=_0x2dee06['adminId'];_0x2dee06[_0xd850('0x19')]=_0x2dee06[_0xd850('0x20')];}logger[_0xd850('0x12')]('['+[_0x4bf103[_0xd850('0x15')]()]+_0xd850('0x21'),_0x2dee06);_0x282b58(_0x2dee06);})[_0xd850('0x13')](function(_0x1f89bb){logger['error']('['+[_0x4bf103[_0xd850('0x15')]()]+']',_0x1f89bb[_0xd850('0x16')]);_0x1d63a1(_0x1f89bb['message']);});}else{logger['info']('['+[_0x4bf103['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x2dee06[_0xd850('0x1f')]=_0x2dee06[_0xd850('0x10')];_0x2dee06[_0xd850('0x19')]=_0x2dee06[_0xd850('0x20')];_0x282b58(_0x2dee06);}});};}function createEndUser(_0x1fd6ad,_0x5d2cf0,_0x48f4bf,_0x5dbb65,_0xf0e802){logger['info']('['+[_0x1fd6ad[_0xd850('0x15')]()]+_0xd850('0x22'),_0x48f4bf);return new Promise(function(_0x3c291e,_0xf62e65){var _0x36b42d={'method':_0xd850('0x23'),'uri':_0x5dbb65+_0xd850('0x24')+_0xf0e802,'body':{'user_name':_0x48f4bf['endUserNumber'],'roles':_0xd850('0x25'),'first_name':_0x48f4bf['endUserNumber'],'active':'true','date_format':_0xd850('0x26'),'phone':_0x48f4bf[_0xd850('0x27')]},'auth':_0x5d2cf0,'json':!![]};return rp(_0x36b42d)[_0xd850('0xd')](function(_0x3989e1){logger[_0xd850('0x12')]('['+[_0x1fd6ad['toUpperCase']()]+'],\x20EndUser\x20schema',_0x3989e1[_0xd850('0xe')]);_0x48f4bf['endUserId']=_0x3989e1[_0xd850('0xe')][_0xd850('0x11')];_0x3c291e(_0x48f4bf);})[_0xd850('0x13')](function(_0x516a6c){logger[_0xd850('0x14')]('['+[_0x1fd6ad[_0xd850('0x15')]()]+']',_0x516a6c['message']);_0xf62e65(_0x516a6c[_0xd850('0x16')]);});});}function getEndUser(_0x330c71,_0x23d2d7,_0x230a13,_0xa18588,_0x218dda){return function(_0x1b26e8){logger[_0xd850('0x12')]('['+[_0x330c71[_0xd850('0x15')]()]+_0xd850('0x28'),_0x1b26e8);return new Promise(function(_0x273999,_0x44c581){var _0x19f369={'method':_0xd850('0xb'),'uri':_0x230a13+'sys_user?sysparm_query=phone%3D'+_0x1b26e8[_0xd850('0x27')]+'&'+_0xa18588+'&'+_0x218dda,'auth':_0x23d2d7,'json':!![]};return rp(_0x19f369)[_0xd850('0xd')](function(_0x3242eb){if(_0x3242eb[_0xd850('0xe')][_0xd850('0xf')]>0x0){_0x1b26e8[_0xd850('0x29')]=_0x3242eb['result'][0x0][_0xd850('0x11')];logger[_0xd850('0x12')]('['+[_0x330c71['toUpperCase']()]+_0xd850('0x2a'),_0x1b26e8);_0x273999(_0x1b26e8);}else{return createEndUser(_0x330c71,_0x23d2d7,_0x1b26e8,_0x230a13,_0xa18588)[_0xd850('0xd')](function(_0x2c24d4){logger[_0xd850('0x12')]('['+[_0x330c71[_0xd850('0x15')]()]+_0xd850('0x2b'),_0x2c24d4);_0x273999(_0x2c24d4);});}})['catch'](function(_0x2eb16e){logger['error']('['+[_0x330c71['toUpperCase']()]+']',_0x2eb16e[_0xd850('0x16')]);_0x44c581(_0x2eb16e['message']);});});};}function getCustomFields(_0x59f27e,_0x14434d){var _0x311656={};if(_0x59f27e[_0xd850('0xf')]>0x0){_[_0xd850('0x2c')](_0x59f27e,function(_0x1c0c1a){if(_[_0xd850('0x2d')]([_0xd850('0x2e'),_0xd850('0x2f')],_0x1c0c1a[_0xd850('0x30')])&&_0x1c0c1a[_0xd850('0x31')]&&!_0x1c0c1a[_0xd850('0x32')]){_0x311656[_0x1c0c1a[_0xd850('0x31')][_0xd850('0x33')]()]=_0x1c0c1a[_0xd850('0x34')]['toString']();}else if(_[_0xd850('0x2d')]([_0xd850('0x2e'),_0xd850('0x2f')],_0x1c0c1a[_0xd850('0x30')])&&_0x1c0c1a['idField']&&_0x1c0c1a['customField']){_0x311656[_0x1c0c1a[_0xd850('0x35')][_0xd850('0x33')]()]=_0x1c0c1a[_0xd850('0x34')]['toString']();}else if(_0x1c0c1a[_0xd850('0x30')]===_0xd850('0x36')&&_0x1c0c1a['variableName']&&_0x1c0c1a[_0xd850('0x35')]&&_0x1c0c1a['customField']){_0x311656[_0x1c0c1a[_0xd850('0x35')][_0xd850('0x33')]()]=_0x14434d[_0x1c0c1a[_0xd850('0x37')]][_0xd850('0x38')]();}else if(_0x1c0c1a[_0xd850('0x30')]==='customVariable'&&_0x1c0c1a[_0xd850('0x39')]&&_0x1c0c1a[_0xd850('0x39')][_0xd850('0x3a')]&&_0x1c0c1a[_0xd850('0x35')]&&_0x1c0c1a[_0xd850('0x32')]){_0x311656[_0x1c0c1a[_0xd850('0x35')]['toLowerCase']()]=_0x14434d[_0x1c0c1a[_0xd850('0x39')]['name'][_0xd850('0x33')]()][_0xd850('0x38')]();}});}return _0x311656;}function getTicket(_0x495f60,_0x43998c,_0xb5dc82,_0x5b6e28,_0x1cca31,_0x46938d){return function(_0x5eb411){logger['info']('['+[_0x495f60[_0xd850('0x15')]()]+_0xd850('0x3b'),_0x5eb411);return new Promise(function(_0x54b7ed,_0x3f41d4){var _0x142b21=_0x495f60[_0xd850('0x33')]()===_0xd850('0x3c')?_0x5eb411[_0xd850('0x1f')]:_0x5eb411[_0xd850('0x29')];var _0x47833a={'method':_0xd850('0x23'),'uri':_0xb5dc82+_0xd850('0x3d')+'?'+_0x46938d,'body':Object[_0xd850('0x3e')]({},{'active':_0xd850('0x1e'),'caller_id':_0x142b21,'assigned_to':_0x5eb411[_0xd850('0x1f')],'short_description':intUtil[_0xd850('0x3f')](_0x5b6e28[_0xd850('0x40')],_0x1cca31,'\x20'),'description':intUtil[_0xd850('0x3f')](_0x5b6e28['Descriptions'],_0x1cca31,'\x0a')},getCustomFields(_0x5b6e28['Fields'],_0x1cca31)),'auth':_0x43998c,'json':!![]};return rp(_0x47833a)[_0xd850('0xd')](function(_0xf7e787){logger[_0xd850('0x12')]('['+[_0x495f60[_0xd850('0x15')]()]+_0xd850('0x41'),_0xf7e787['result']);_0x5eb411[_0xd850('0x42')]=_0xf7e787['result'][_0xd850('0x11')];_0x5eb411[_0xd850('0x43')]=_0xf7e787[_0xd850('0xe')]['number'];logger[_0xd850('0x12')]('['+[_0x495f60[_0xd850('0x15')]()]+_0xd850('0x44'),_0x5eb411);_0x54b7ed(_0x5eb411);})[_0xd850('0x13')](function(_0x26f26b){logger[_0xd850('0x14')]('['+[_0x495f60[_0xd850('0x15')]()]+']',_0x26f26b[_0xd850('0x16')]);_0x3f41d4(_0x26f26b[_0xd850('0x16')]);});});};}function createRemoteTag(_0x22e5ea,_0xd808b9,_0x16dfc9,_0x22b9d3){return new Promise(function(_0x24dbc6,_0x29c25d){var _0x4c88f4={'method':_0xd850('0x23'),'uri':_0x16dfc9+_0xd850('0x45')+'?'+_0x22b9d3,'body':{'short_description':_0x22e5ea,'global':!![],'active':!![],'name':_0x22e5ea},'auth':_0xd808b9,'json':!![]};return rp(_0x4c88f4)[_0xd850('0xd')](function(_0x474dcb){var _0x25b1cf=_0x474dcb['result'][_0xd850('0x11')];_0x24dbc6(_0x25b1cf);});});}function getRemoteTag(_0x3bfadc,_0x3cb539,_0x23e52b,_0x5d6e62,_0x561d49){return new Promise(function(_0x5439e6,_0x201327){var _0x363d94={'method':'GET','uri':_0x23e52b+_0xd850('0x45')+_0xd850('0x46')+_0x3bfadc+'&'+_0x5d6e62,'auth':_0x3cb539,'json':!![]};return rp(_0x363d94)[_0xd850('0xd')](function(_0x1b1d13){if(_0x1b1d13[_0xd850('0xe')][_0xd850('0xf')]>0x0){var _0x38175d=_0x1b1d13[_0xd850('0xe')][0x0][_0xd850('0x11')];_0x5439e6(_0x38175d);}else{return createRemoteTag(_0x3bfadc,_0x3cb539,_0x23e52b,_0x5d6e62)[_0xd850('0xd')](function(_0xc07876){_0x5439e6(_0xc07876);});}});});}function assignTagToIncident(_0x31eedb,_0x5cc32a,_0x4aaf47,_0x4855ab,_0x58e836){return new Promise(function(_0x160a81,_0x118f97){var _0x8ffcf5={'method':_0xd850('0x23'),'uri':_0x4aaf47+_0xd850('0x47')+'?'+_0x58e836,'body':{'label':_0x31eedb,'table':'incident','id_type':_0xd850('0x48'),'table_key':_0x4855ab['ticketId'],'title':_0xd850('0x49')+_0x4855ab['ticketNumber'],'id_display':_0x4855ab[_0xd850('0x43')]},'auth':_0x5cc32a,'json':!![]};return rp(_0x8ffcf5)['then'](function(_0x5469d7){_0x160a81();})[_0xd850('0x13')](function(){_0x160a81();});});}function manageTags(_0x33f489,_0x79c802,_0x409bfc,_0x124140,_0x292070,_0x20cdec,_0x3dd5d1){return new Promise(function(_0x233f39,_0x2ce375){var _0x47873d=[];_0x79c802[_0xd850('0x2c')](function(_0x4f3548){_0x47873d[_0xd850('0x4a')](getRemoteTag(_0x4f3548,_0x409bfc,_0x124140,_0x20cdec,_0x3dd5d1));});return Promise[_0xd850('0x4b')](_0x47873d)[_0xd850('0xd')](function(_0x4dfe0d){if(_0x4dfe0d[_0xd850('0xf')]){logger[_0xd850('0x12')]('['+[_0x33f489['toUpperCase']()]+_0xd850('0x4c'),_0x4dfe0d);var _0x12030b=[];_0x4dfe0d[_0xd850('0x2c')](function(_0x1f324a){_0x12030b[_0xd850('0x4a')](assignTagToIncident(_0x1f324a,_0x409bfc,_0x124140,_0x292070,_0x20cdec));});return Promise[_0xd850('0x4b')](_0x12030b)[_0xd850('0xd')](function(){_0x233f39();})[_0xd850('0x13')](function(){_0x233f39();});}else{_0x233f39();}});});}function getTags(_0x1ade57,_0x4cd062,_0x3579fb,_0x1c3b7c,_0x2589bc,_0x35deb2){return function(_0x1ec5a0){return new Promise(function(_0x3022cb,_0x21f368){var _0x42e1fd=[];var _0x505eaf=_0x1c3b7c[_0xd850('0x4d')];if(_0x505eaf&&_0x505eaf[_0xd850('0xf')]>0x0){_0x42e1fd=_[_0xd850('0x4e')](_0x505eaf,_0xd850('0x3a'));}if(_0x42e1fd['length']>0x0){return manageTags(_0x1ade57,_0x42e1fd,_0x4cd062,_0x3579fb,_0x1ec5a0,_0x2589bc,_0x35deb2)[_0xd850('0xd')](function(){_0x3022cb(_0x1ec5a0);});}else{_0x3022cb(_0x1ec5a0);}});};}function emit(_0x1b445e,_0x2c8e0a,_0x2ec0b2){var _0x2d46e7=_0xd850('0x4f')+_0xd850('0x50')+_0xd850('0x51')+_0xd850('0x52');var _0x2ba924={'uri':_0x1b445e+_0xd850('0x53')+_0x2ec0b2+_0x2d46e7};io['to'](util[_0xd850('0x54')](_0xd850('0x55'),_0x2c8e0a))['emit'](_0xd850('0x56'),_0x2ba924);}exports['cs']=function(_0x5b976f,_0x333c35,_0xf200cf,_0x4544a6,_0x3e9f8b,_0xf111a1,_0x63ca0e,_0x321a3c){var _0x1725ee={};var _0x227ec1={'user':_0xf111a1[_0xd850('0x57')],'pass':_0xf111a1['password']};var _0x22dfb4=_0xd850('0x58');var _0x5bb287=_0xd850('0x59');_0xf111a1[_0xd850('0x5a')]=intUtil[_0xd850('0x5b')](_0xf111a1[_0xd850('0x5a')]);_0xf111a1[_0xd850('0x5c')]=intUtil['stripTrailingSlash'](_0xf111a1['serverUrl']);var _0xe4fb91=util[_0xd850('0x54')](_0xd850('0x5d'),_0xf111a1[_0xd850('0x5a')]);_0x1725ee[_0xd850('0x19')]=!_['isNil'](_0x4544a6)?_0x4544a6[_0xd850('0x5e')]:null;_0x1725ee[_0xd850('0x20')]=_0xf111a1['email'];_0x1725ee[_0xd850('0x27')]=_0x321a3c['toLowerCase']()===_0xd850('0x3c')?_0x333c35[_0xd850('0x5f')]:_0x333c35[_0xd850('0x60')];_0x1725ee['callDirection']=_0x321a3c==='queue'||_0x321a3c===_0xd850('0x61')?_0xd850('0x62'):'outbound';var _0x783997=util[_0xd850('0x54')](_0xd850('0x63'),_0xf111a1[_0xd850('0x5c')],_0x333c35[_0xd850('0x64')],md5(_0x333c35['uniqueid']));if(_0x3e9f8b&&_0x3e9f8b[_0xd850('0x65')]){logger[_0xd850('0x12')](_0xd850('0x66'),_0xd850('0x67'));_0x333c35[_0xd850('0x68')]=_0x783997;}else if(_0x63ca0e&&_0x63ca0e[_0xd850('0x69')]&&_0x63ca0e[_0xd850('0x69')]!=='none'){logger[_0xd850('0x12')](_0xd850('0x6a'),_0xd850('0x67'));_0x333c35[_0xd850('0x68')]=_0x783997;}else{_0x333c35[_0xd850('0x68')]='';}return getAdminUser(_0x321a3c,_0x227ec1,_0x1725ee,_0xe4fb91,_0x5bb287,_0x22dfb4)[_0xd850('0xd')](getUser(_0x321a3c,_0x227ec1,_0xe4fb91,_0x5bb287,_0x22dfb4))['then'](getEndUser(_0x321a3c,_0x227ec1,_0xe4fb91,_0x5bb287,_0x22dfb4))[_0xd850('0xd')](getTicket(_0x321a3c,_0x227ec1,_0xe4fb91,_0xf200cf,_0x333c35,_0x5bb287))[_0xd850('0xd')](function(_0x24a6e0){logger['info'](util[_0xd850('0x54')](_0xd850('0x6b'),_0x24a6e0[_0xd850('0x42')]));logger[_0xd850('0x12')](util[_0xd850('0x54')]('call\x20direction:\x20%s',_0x321a3c));if(_0x321a3c!==_0xd850('0x61')){logger[_0xd850('0x12')]('['+[_0x321a3c['toUpperCase']()]+']',_0xd850('0x6c'));emit(_0xf111a1[_0xd850('0x5a')],_0x4544a6['name'],_0x24a6e0[_0xd850('0x42')]);}})[_0xd850('0x13')](function(_0x2dd4e0){logger[_0xd850('0x14')]('['+[_0x321a3c[_0xd850('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x2dd4e0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe38d=['],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','userId','adminId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','toLowerCase','content','toString','type','idField','variable','variableName','customField','customVariable','Variable','name','assign','Subjects','getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','push','all','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','trigger:browser:url','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','GET','then','result','sys_id','info','toUpperCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe38d,0xce));var _0xde38=function(_0x258e37,_0x28c2ec){_0x258e37=_0x258e37-0x0;var _0x41a810=_0xe38d[_0x258e37];return _0x41a810;};'use strict';var _=require(_0xde38('0x0'));var Promise=require(_0xde38('0x1'));var rp=require(_0xde38('0x2'));var util=require(_0xde38('0x3'));var md5=require(_0xde38('0x4'));var Redis=require(_0xde38('0x5'));var intUtil=require(_0xde38('0x6'));var config=require(_0xde38('0x7'));var logger=require(_0xde38('0x8'))(_0xde38('0x9'));config['redis']=_['defaults'](config[_0xde38('0xa')],{'host':_0xde38('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xde38('0xa')]));function getAdminUser(_0x772a3,_0x39e501,_0x12fdde,_0x5c0d3c,_0x3ad25b,_0x157624){return new Promise(function(_0x1c7cd9,_0x36bc2a){var _0x9233d5={'method':_0xde38('0xc'),'uri':_0x5c0d3c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x3ad25b+'&'+_0x157624,'auth':_0x39e501,'json':!![]};return rp(_0x9233d5)[_0xde38('0xd')](function(_0x383009){if(_0x383009[_0xde38('0xe')]['length']>0x0){_0x12fdde['adminId']=_0x383009[_0xde38('0xe')][0x0][_0xde38('0xf')];}logger[_0xde38('0x10')]('['+[_0x772a3[_0xde38('0x11')]()]+_0xde38('0x12'),_0x12fdde);_0x1c7cd9(_0x12fdde);})['catch'](function(_0x199020){logger[_0xde38('0x13')]('['+[_0x772a3[_0xde38('0x11')]()]+']',_0x199020[_0xde38('0x14')]);_0x36bc2a(_0x199020[_0xde38('0x14')]);});});}function getUser(_0x5c18ac,_0x42ff3a,_0x37e2f9,_0x2ef1ca,_0x3fd972){return function(_0x456343){logger[_0xde38('0x10')]('['+[_0x5c18ac[_0xde38('0x11')]()]+_0xde38('0x15'),_0x456343);return new Promise(function(_0x14b863,_0x4d4e24){if(intUtil[_0xde38('0x16')](_0x456343[_0xde38('0x17')])){var _0x18eac9={'method':_0xde38('0xc'),'uri':_0x37e2f9+_0xde38('0x18')+_0x456343[_0xde38('0x17')]+'&'+_0x2ef1ca+'&'+_0x3fd972,'auth':_0x42ff3a,'json':!![]};logger[_0xde38('0x10')]('['+[_0x5c18ac[_0xde38('0x11')]()]+_0xde38('0x19'),_0x18eac9);return rp(_0x18eac9)[_0xde38('0xd')](function(_0x4c8833){logger[_0xde38('0x10')]('['+[_0x5c18ac['toUpperCase']()]+_0xde38('0x1a'),_0x4c8833);if(_0x4c8833['result'][_0xde38('0x1b')]>0x0&&String(_0x4c8833[_0xde38('0xe')][0x0][_0xde38('0x1c')])==='true'){_0x456343[_0xde38('0x1d')]=_0x4c8833[_0xde38('0xe')][0x0][_0xde38('0xf')];}else{_0x456343[_0xde38('0x1d')]=_0x456343[_0xde38('0x1e')];_0x456343[_0xde38('0x17')]=_0x456343['adminEmail'];}logger['info']('['+[_0x5c18ac[_0xde38('0x11')]()]+_0xde38('0x1f'),_0x456343);_0x14b863(_0x456343);})[_0xde38('0x20')](function(_0x232c6b){logger[_0xde38('0x13')]('['+[_0x5c18ac[_0xde38('0x11')]()]+']',_0x232c6b['message']);_0x4d4e24(_0x232c6b[_0xde38('0x14')]);});}else{logger[_0xde38('0x10')]('['+[_0x5c18ac['toUpperCase']()]+_0xde38('0x21'));_0x456343[_0xde38('0x1d')]=_0x456343['adminId'];_0x456343['userEmail']=_0x456343[_0xde38('0x22')];_0x14b863(_0x456343);}});};}function createEndUser(_0xd052dd,_0x4aef11,_0x4c8917,_0x1f19c3,_0x1374ed){logger[_0xde38('0x10')]('['+[_0xd052dd[_0xde38('0x11')]()]+_0xde38('0x23'),_0x4c8917);return new Promise(function(_0x48c4e6,_0x5f443e){var _0x425ace={'method':_0xde38('0x24'),'uri':_0x1f19c3+_0xde38('0x25')+_0x1374ed,'body':{'user_name':_0x4c8917['endUserNumber'],'roles':_0xde38('0x26'),'first_name':_0x4c8917[_0xde38('0x27')],'active':_0xde38('0x28'),'date_format':_0xde38('0x29'),'phone':_0x4c8917[_0xde38('0x27')]},'auth':_0x4aef11,'json':!![]};return rp(_0x425ace)['then'](function(_0x3922b3){logger[_0xde38('0x10')]('['+[_0xd052dd[_0xde38('0x11')]()]+_0xde38('0x2a'),_0x3922b3[_0xde38('0xe')]);_0x4c8917['endUserId']=_0x3922b3[_0xde38('0xe')][_0xde38('0xf')];_0x48c4e6(_0x4c8917);})[_0xde38('0x20')](function(_0x400bd2){logger[_0xde38('0x13')]('['+[_0xd052dd[_0xde38('0x11')]()]+']',_0x400bd2['message']);_0x5f443e(_0x400bd2[_0xde38('0x14')]);});});}function getEndUser(_0x4c065c,_0xd511a1,_0x47386c,_0xe0f782,_0x3e365e){return function(_0x59ffb2){logger[_0xde38('0x10')]('['+[_0x4c065c[_0xde38('0x11')]()]+_0xde38('0x2b'),_0x59ffb2);return new Promise(function(_0xc5085,_0x42ac88){var _0x531f7b={'method':_0xde38('0xc'),'uri':_0x47386c+_0xde38('0x2c')+_0x59ffb2[_0xde38('0x27')]+'&'+_0xe0f782+'&'+_0x3e365e,'auth':_0xd511a1,'json':!![]};return rp(_0x531f7b)['then'](function(_0x2774f4){if(_0x2774f4[_0xde38('0xe')][_0xde38('0x1b')]>0x0){_0x59ffb2[_0xde38('0x2d')]=_0x2774f4['result'][0x0][_0xde38('0xf')];logger['info']('['+[_0x4c065c[_0xde38('0x11')]()]+_0xde38('0x2e'),_0x59ffb2);_0xc5085(_0x59ffb2);}else{return createEndUser(_0x4c065c,_0xd511a1,_0x59ffb2,_0x47386c,_0xe0f782)[_0xde38('0xd')](function(_0x70e11a){logger[_0xde38('0x10')]('['+[_0x4c065c['toUpperCase']()]+_0xde38('0x2f'),_0x70e11a);_0xc5085(_0x70e11a);});}})['catch'](function(_0x512692){logger['error']('['+[_0x4c065c[_0xde38('0x11')]()]+']',_0x512692[_0xde38('0x14')]);_0x42ac88(_0x512692[_0xde38('0x14')]);});});};}function getCustomFields(_0x5a02b3,_0xbc3484){var _0x44401c={};if(_0x5a02b3[_0xde38('0x1b')]>0x0){_[_0xde38('0x30')](_0x5a02b3,function(_0x41dd00){if(_[_0xde38('0x31')]([_0xde38('0x32'),_0xde38('0x33')],_0x41dd00['type'])&&_0x41dd00[_0xde38('0x34')]&&!_0x41dd00['customField']){_0x44401c[_0x41dd00[_0xde38('0x34')][_0xde38('0x35')]()]=_0x41dd00[_0xde38('0x36')][_0xde38('0x37')]();}else if(_[_0xde38('0x31')]([_0xde38('0x32'),_0xde38('0x33')],_0x41dd00[_0xde38('0x38')])&&_0x41dd00[_0xde38('0x39')]&&_0x41dd00['customField']){_0x44401c[_0x41dd00['idField']['toLowerCase']()]=_0x41dd00[_0xde38('0x36')][_0xde38('0x37')]();}else if(_0x41dd00[_0xde38('0x38')]===_0xde38('0x3a')&&_0x41dd00[_0xde38('0x3b')]&&_0x41dd00[_0xde38('0x39')]&&_0x41dd00[_0xde38('0x3c')]){_0x44401c[_0x41dd00[_0xde38('0x39')][_0xde38('0x35')]()]=_0xbc3484[_0x41dd00['variableName']][_0xde38('0x37')]();}else if(_0x41dd00[_0xde38('0x38')]===_0xde38('0x3d')&&_0x41dd00[_0xde38('0x3e')]&&_0x41dd00[_0xde38('0x3e')][_0xde38('0x3f')]&&_0x41dd00['idField']&&_0x41dd00[_0xde38('0x3c')]){_0x44401c[_0x41dd00[_0xde38('0x39')][_0xde38('0x35')]()]=_0xbc3484[_0x41dd00[_0xde38('0x3e')][_0xde38('0x3f')][_0xde38('0x35')]()][_0xde38('0x37')]();}});}return _0x44401c;}function getTicket(_0xefcd09,_0x283510,_0x12e191,_0x576e3c,_0x353cb1,_0x2fe8ca){return function(_0x3d0ff8){logger[_0xde38('0x10')]('['+[_0xefcd09[_0xde38('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x3d0ff8);return new Promise(function(_0x1267cd,_0x46c544){var _0x48f689=_0xefcd09[_0xde38('0x35')]()==='outbound'?_0x3d0ff8[_0xde38('0x1d')]:_0x3d0ff8['endUserId'];var _0x3635da={'method':_0xde38('0x24'),'uri':_0x12e191+'incident'+'?'+_0x2fe8ca,'body':Object[_0xde38('0x40')]({},{'active':_0xde38('0x28'),'caller_id':_0x48f689,'assigned_to':_0x3d0ff8[_0xde38('0x1d')],'short_description':intUtil['getString'](_0x576e3c[_0xde38('0x41')],_0x353cb1,'\x20'),'description':intUtil[_0xde38('0x42')](_0x576e3c[_0xde38('0x43')],_0x353cb1,'\x0a')},getCustomFields(_0x576e3c[_0xde38('0x44')],_0x353cb1)),'auth':_0x283510,'json':!![]};return rp(_0x3635da)[_0xde38('0xd')](function(_0x508384){logger[_0xde38('0x10')]('['+[_0xefcd09[_0xde38('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x508384[_0xde38('0xe')]);_0x3d0ff8[_0xde38('0x45')]=_0x508384[_0xde38('0xe')][_0xde38('0xf')];_0x3d0ff8[_0xde38('0x46')]=_0x508384[_0xde38('0xe')][_0xde38('0x47')];logger['info']('['+[_0xefcd09[_0xde38('0x11')]()]+_0xde38('0x48'),_0x3d0ff8);_0x1267cd(_0x3d0ff8);})[_0xde38('0x20')](function(_0x3cbee5){logger[_0xde38('0x13')]('['+[_0xefcd09['toUpperCase']()]+']',_0x3cbee5[_0xde38('0x14')]);_0x46c544(_0x3cbee5[_0xde38('0x14')]);});});};}function createRemoteTag(_0x139b4b,_0x21cbb3,_0x240b05,_0x1a530e){return new Promise(function(_0x7d44fc,_0x90121b){var _0x2dad5f={'method':_0xde38('0x24'),'uri':_0x240b05+'label'+'?'+_0x1a530e,'body':{'short_description':_0x139b4b,'global':!![],'active':!![],'name':_0x139b4b},'auth':_0x21cbb3,'json':!![]};return rp(_0x2dad5f)['then'](function(_0x4a5a9a){var _0x5aa550=_0x4a5a9a[_0xde38('0xe')][_0xde38('0xf')];_0x7d44fc(_0x5aa550);});});}function getRemoteTag(_0x287fb5,_0x2f0d07,_0x3e0d0a,_0x552a4e,_0x3ee435){return new Promise(function(_0x2f6b9a,_0x5b0432){var _0x38a26f={'method':_0xde38('0xc'),'uri':_0x3e0d0a+_0xde38('0x49')+_0xde38('0x4a')+_0x287fb5+'&'+_0x552a4e,'auth':_0x2f0d07,'json':!![]};return rp(_0x38a26f)[_0xde38('0xd')](function(_0x3b0b7c){if(_0x3b0b7c[_0xde38('0xe')][_0xde38('0x1b')]>0x0){var _0x18aec9=_0x3b0b7c[_0xde38('0xe')][0x0][_0xde38('0xf')];_0x2f6b9a(_0x18aec9);}else{return createRemoteTag(_0x287fb5,_0x2f0d07,_0x3e0d0a,_0x552a4e)['then'](function(_0x254943){_0x2f6b9a(_0x254943);});}});});}function assignTagToIncident(_0x576507,_0x462278,_0x2684a1,_0x1a4edb,_0x3a27bb){return new Promise(function(_0x59aa5c,_0x4ef609){var _0x52db05={'method':_0xde38('0x24'),'uri':_0x2684a1+_0xde38('0x4b')+'?'+_0x3a27bb,'body':{'label':_0x576507,'table':_0xde38('0x4c'),'id_type':_0xde38('0x4d'),'table_key':_0x1a4edb[_0xde38('0x45')],'title':_0xde38('0x4e')+_0x1a4edb['ticketNumber'],'id_display':_0x1a4edb['ticketNumber']},'auth':_0x462278,'json':!![]};return rp(_0x52db05)[_0xde38('0xd')](function(_0x332f76){_0x59aa5c();})[_0xde38('0x20')](function(){_0x59aa5c();});});}function manageTags(_0x3b0893,_0x50ff2e,_0x45f3fb,_0x38f2f9,_0x40ddea,_0x1a70d6,_0xffcc80){return new Promise(function(_0x1afcde,_0x109d78){var _0x2c81cf=[];_0x50ff2e['forEach'](function(_0x202716){_0x2c81cf[_0xde38('0x4f')](getRemoteTag(_0x202716,_0x45f3fb,_0x38f2f9,_0x1a70d6,_0xffcc80));});return Promise[_0xde38('0x50')](_0x2c81cf)['then'](function(_0x4cd96b){if(_0x4cd96b['length']){logger[_0xde38('0x10')]('['+[_0x3b0893['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4cd96b);var _0x5be668=[];_0x4cd96b[_0xde38('0x30')](function(_0x141625){_0x5be668[_0xde38('0x4f')](assignTagToIncident(_0x141625,_0x45f3fb,_0x38f2f9,_0x40ddea,_0x1a70d6));});return Promise[_0xde38('0x50')](_0x5be668)[_0xde38('0xd')](function(){_0x1afcde();})[_0xde38('0x20')](function(){_0x1afcde();});}else{_0x1afcde();}});});}function getTags(_0x34fb59,_0x2d1922,_0x332238,_0x150492,_0x169f60,_0x1351af){return function(_0x8f6b69){return new Promise(function(_0x435619,_0x1cdf0f){var _0x11e5cc=[];var _0x7969af=_0x150492[_0xde38('0x51')];if(_0x7969af&&_0x7969af[_0xde38('0x1b')]>0x0){_0x11e5cc=_['map'](_0x7969af,_0xde38('0x3f'));}if(_0x11e5cc[_0xde38('0x1b')]>0x0){return manageTags(_0x34fb59,_0x11e5cc,_0x2d1922,_0x332238,_0x8f6b69,_0x169f60,_0x1351af)[_0xde38('0xd')](function(){_0x435619(_0x8f6b69);});}else{_0x435619(_0x8f6b69);}});};}function emit(_0x201f8e,_0x509a62,_0x4578b9){var _0x3a1daa='%26sysparm_record_target%3Dincident'+_0xde38('0x52')+_0xde38('0x53')+_0xde38('0x54');var _0x44dbc5={'uri':_0x201f8e+_0xde38('0x55')+_0x4578b9+_0x3a1daa};io['to'](util['format'](_0xde38('0x56'),_0x509a62))['emit'](_0xde38('0x57'),_0x44dbc5);}exports['cs']=function(_0xe39102,_0x4cc19f,_0x2ea27d,_0x54dee6,_0x2bf2f1,_0x36b70a,_0x2437bd,_0x245479){var _0x35af83={};var _0x4a4aab={'user':_0x36b70a['username'],'pass':_0x36b70a['password']};var _0x44fbec=_0xde38('0x58');var _0x4de35e=_0xde38('0x59');_0x36b70a[_0xde38('0x5a')]=intUtil[_0xde38('0x5b')](_0x36b70a[_0xde38('0x5a')]);_0x36b70a[_0xde38('0x5c')]=intUtil[_0xde38('0x5b')](_0x36b70a[_0xde38('0x5c')]);var _0x4937c3=util[_0xde38('0x5d')](_0xde38('0x5e'),_0x36b70a['remoteUri']);_0x35af83['userEmail']=!_[_0xde38('0x5f')](_0x54dee6)?_0x54dee6['email']:null;_0x35af83[_0xde38('0x22')]=_0x36b70a[_0xde38('0x60')];_0x35af83['endUserNumber']=_0x245479[_0xde38('0x35')]()===_0xde38('0x61')?_0x4cc19f[_0xde38('0x62')]:_0x4cc19f[_0xde38('0x63')];_0x35af83[_0xde38('0x64')]=_0x245479==='queue'||_0x245479==='unmanaged'?_0xde38('0x65'):_0xde38('0x61');var _0x35f3e0=util[_0xde38('0x5d')](_0xde38('0x66'),_0x36b70a[_0xde38('0x5c')],_0x4cc19f[_0xde38('0x67')],md5(_0x4cc19f[_0xde38('0x67')]));if(_0x2bf2f1&&_0x2bf2f1['monitor_format']){logger['info']('[QUEUE]',_0xde38('0x68'));_0x4cc19f[_0xde38('0x69')]=_0x35f3e0;}else if(_0x2437bd&&_0x2437bd[_0xde38('0x6a')]&&_0x2437bd[_0xde38('0x6a')]!==_0xde38('0x6b')){logger['info']('[OUTBOUND]',_0xde38('0x68'));_0x4cc19f[_0xde38('0x69')]=_0x35f3e0;}else{_0x4cc19f[_0xde38('0x69')]='';}return getAdminUser(_0x245479,_0x4a4aab,_0x35af83,_0x4937c3,_0x4de35e,_0x44fbec)[_0xde38('0xd')](getUser(_0x245479,_0x4a4aab,_0x4937c3,_0x4de35e,_0x44fbec))[_0xde38('0xd')](getEndUser(_0x245479,_0x4a4aab,_0x4937c3,_0x4de35e,_0x44fbec))[_0xde38('0xd')](getTicket(_0x245479,_0x4a4aab,_0x4937c3,_0x2ea27d,_0x4cc19f,_0x4de35e))[_0xde38('0xd')](function(_0x38c431){logger['info'](util[_0xde38('0x5d')](_0xde38('0x6c'),_0x38c431[_0xde38('0x45')]));logger[_0xde38('0x10')](util[_0xde38('0x5d')]('call\x20direction:\x20%s',_0x245479));if(_0x245479!==_0xde38('0x6d')){logger[_0xde38('0x10')]('['+[_0x245479[_0xde38('0x11')]()]+']',_0xde38('0x6e'));emit(_0x36b70a['remoteUri'],_0x54dee6['name'],_0x38c431[_0xde38('0x45')]);}})[_0xde38('0x20')](function(_0x307ab){logger[_0xde38('0x13')]('['+[_0x245479[_0xde38('0x11')]()]+_0xde38('0x6f'),util['inspect'](_0x307ab,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 8934146..dc21a02 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 _0xba5f=['Variable','POST','login','password','PLAIN','sessionID','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','./util','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','length','forEach','variableName','push','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','stringify','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','idField','customVariable'];(function(_0x31785c,_0x54806d){var _0x163457=function(_0x1b32c7){while(--_0x1b32c7){_0x31785c['push'](_0x31785c['shift']());}};_0x163457(++_0x54806d);}(_0xba5f,0x195));var _0xfba5=function(_0x3fcb37,_0x5111fd){_0x3fcb37=_0x3fcb37-0x0;var _0x2b2789=_0xba5f[_0x3fcb37];return _0x2b2789;};'use strict';var _=require(_0xfba5('0x0'));var rp=require(_0xfba5('0x1'));var BPromise=require(_0xfba5('0x2'));var md5=require(_0xfba5('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xfba5('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xfba5('0x5'));config[_0xfba5('0x6')]=_[_0xfba5('0x7')](config[_0xfba5('0x6')],{'host':_0xfba5('0x8'),'port':0x18eb});var io=require(_0xfba5('0x9'))(new Redis(config[_0xfba5('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x266fc3,_0x9dfbb3,_0x3043f5){io['to'](_0x266fc3)[_0xfba5('0xa')](_0x9dfbb3,_0x3043f5);}function getTicket(_0x1e0078,_0x581821,_0x3e1b23,_0x43245e,_0x5f05d4,_0xde1a69,_0x286fb8,_0x36371b){logger['info'](_0xfba5('0xb'));var _0x490a1c=new Date();var _0x290ce1=[{'name':_0xfba5('0xc'),'value':intUtil[_0xfba5('0xd')](_0x43245e[_0xfba5('0xe')],_0x5f05d4,'\x20')},{'name':_0xfba5('0xf'),'value':_0x581821['id']},{'name':_0xfba5('0x10'),'value':_0x581821['id']},{'name':'description','value':intUtil[_0xfba5('0xd')](_0x43245e['Descriptions'],_0x5f05d4,'\x0a')},{'name':_0xfba5('0x11'),'value':_0x490a1c[_0xfba5('0x12')]()[_0xfba5('0x13')](0x0,0x13)[_0xfba5('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xfba5('0x15'),'value':'15'},{'name':_0xfba5('0x16'),'value':_0x3e1b23['id']},{'name':_0xfba5('0x17'),'value':_0xfba5('0x18')},{'name':'parent_name','value':_0x3e1b23[_0xfba5('0xc')]},{'name':'direction','value':_0x36371b}];if(_0xde1a69[_0xfba5('0x19')]){_[_0xfba5('0x1a')](_0xde1a69,function(_0x58d6c6){if(_0x5f05d4[_0x58d6c6[_0xfba5('0x1b')]]){_0x290ce1[_0xfba5('0x1c')]({'name':_0x58d6c6['idField'],'value':_0x5f05d4[_0x58d6c6[_0xfba5('0x1b')]]});}});}return request({'form':{'method':_0xfba5('0x1d'),'input_type':_0xfba5('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x286fb8['id'],'module_name':_0xfba5('0x1f'),'name_value_list':_0x290ce1})}});}function getAuth(_0x9f47e8){return util[_0xfba5('0x20')](_0xfba5('0x21'),new Buffer(_0x9f47e8[_0xfba5('0x22')]+':X')[_0xfba5('0x23')](_0xfba5('0x24')));}function getServerInfo(_0x436833){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0xfba5('0x1e'),'rest_data':JSON[_0xfba5('0x25')]({'session':_0x436833['id']})}});}function getUser(_0xeaca7a,_0x21b4aa,_0x4c89e4){if(!_[_0xfba5('0x26')](_0x21b4aa)){logger[_0xfba5('0x27')](_0xfba5('0x28'),_0x21b4aa);return request({'form':{'method':_0xfba5('0x29'),'input_type':_0xfba5('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4c89e4['id'],'module_name':_0xfba5('0x2a'),'query':util[_0xfba5('0x20')](_0xfba5('0x2b'),_0x21b4aa),'order_by':'','offset':'0','select_fields':['id',_0xfba5('0xc'),_0xfba5('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfba5('0x2d')](function(_0x30af80){if(_0x30af80[_0xfba5('0x2e')][_0xfba5('0x19')]){var _0x30c547=_[_0xfba5('0x2f')](_0x30af80['entry_list'],function(_0x3a612f){return _0x3a612f['name_value_list'][_0xfba5('0x2c')][_0xfba5('0x30')]===_0x21b4aa;});if(_0x30c547){logger[_0xfba5('0x27')](_0xfba5('0x31'));return BPromise[_0xfba5('0x32')]({'id':_0x30c547[_0xfba5('0x33')]['id']['value'],'name':_0x30c547[_0xfba5('0x33')][_0xfba5('0xc')][_0xfba5('0x30')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xfba5('0x32')]({'id':_0x4c89e4[_0xfba5('0x33')][_0xfba5('0x34')][_0xfba5('0x30')],'name':_0x4c89e4[_0xfba5('0x33')]['user_name'][_0xfba5('0x30')]});});}else{logger[_0xfba5('0x27')](_0xfba5('0x35'));return BPromise[_0xfba5('0x32')]({'id':_0x4c89e4[_0xfba5('0x33')][_0xfba5('0x34')][_0xfba5('0x30')],'name':_0x4c89e4[_0xfba5('0x33')][_0xfba5('0x2c')]['value']});}}function getEndUser(_0x2db887,_0x4ae541,_0x195a10,_0x328d6d){logger['info'](_0xfba5('0x36'),_0x195a10);return request({'form':{'method':'get_entry_list','input_type':_0xfba5('0x1e'),'response_type':_0xfba5('0x1e'),'rest_data':JSON['stringify']({'session':_0x328d6d['id'],'module_name':_0xfba5('0x18'),'query':util['format'](_0xfba5('0x37'),_0x195a10),'order_by':'','offset':'0','select_fields':['id','name',_0xfba5('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfba5('0x2d')](function(_0x45e1e4){if(_0x45e1e4[_0xfba5('0x2e')][_0xfba5('0x19')]){var _0x24c387=_[_0xfba5('0x2f')](_0x45e1e4[_0xfba5('0x2e')],function(_0x34764d){return _0x34764d[_0xfba5('0x33')]['phone_home'][_0xfba5('0x30')]===_0x195a10;});if(_0x24c387){logger[_0xfba5('0x27')]('Enduser\x20found!');return BPromise[_0xfba5('0x32')]({'id':_0x24c387['name_value_list']['id'][_0xfba5('0x30')],'name':_0x24c387[_0xfba5('0x33')]['name']['value'],'phone':_0x24c387[_0xfba5('0x33')][_0xfba5('0x38')][_0xfba5('0x30')]});}}else{logger[_0xfba5('0x27')](_0xfba5('0x39'));return request({'form':{'method':_0xfba5('0x1d'),'input_type':'JSON','response_type':_0xfba5('0x1e'),'rest_data':JSON['stringify']({'session':_0x328d6d['id'],'module_name':_0xfba5('0x18'),'name_value_list':[{'name':'first_name','value':_0x4ae541!==_0xfba5('0x3a')?_0x4ae541:util[_0xfba5('0x20')](_0xfba5('0x3b'),_0x195a10)},{'name':_0xfba5('0x38'),'value':_0x195a10}]})}})[_0xfba5('0x2d')](function(_0x4509fc){logger[_0xfba5('0x27')](_0xfba5('0x3c'));return BPromise['resolve']({'id':_0x4509fc['id'],'name':_0x4509fc[_0xfba5('0x2e')][_0xfba5('0x3d')]['value'],'phone':_0x4509fc[_0xfba5('0x2e')][_0xfba5('0x38')]['value']});});}});}function request(_0x1896d0){logger[_0xfba5('0x3e')](_0xfba5('0x3f'),JSON[_0xfba5('0x25')](_0x1896d0));return rp(_[_0xfba5('0x40')](def,_0x1896d0));}function getTags(_0x1a96ac,_0x1b5fd2){var _0x6a4cb4=[];if(_0x1a96ac&&_0x1a96ac['length']>0x0){_0x6a4cb4=_[_0xfba5('0x41')](_0x1a96ac,_0x1b5fd2);}return _0x6a4cb4;}function getCustomFields(_0x1b83ee,_0x319e74){var _0x38940b=[];var _0x4acec5={'custom_fields':[]};if(_0x1b83ee['length']>0x0){_[_0xfba5('0x1a')](_0x1b83ee,function(_0x358557){if(_0x358557[_0xfba5('0x42')]===_0xfba5('0x43')&&_0x358557[_0xfba5('0x44')]&&!_0x358557[_0xfba5('0x45')]){_0x4acec5[_0x358557['nameField'][_0xfba5('0x46')]()]=_0x358557[_0xfba5('0x47')][_0xfba5('0x23')]();}else if(_0x358557[_0xfba5('0x42')]==='string'&&_0x358557['idField']&&_0x358557[_0xfba5('0x45')]){_0x4acec5[_0xfba5('0x48')][_0xfba5('0x1c')]({'id':_0x358557[_0xfba5('0x49')],'value':_0x358557[_0xfba5('0x47')][_0xfba5('0x23')]()});}else if(_0x358557[_0xfba5('0x42')]==='variable'&&_0x358557[_0xfba5('0x1b')]&&_0x358557[_0xfba5('0x49')]&&_0x358557['customField']){_0x319e74[_0x358557[_0xfba5('0x1b')]]&&_0x4acec5[_0xfba5('0x48')][_0xfba5('0x1c')]({'id':_0x358557[_0xfba5('0x49')],'value':_0x319e74[_0x358557['variableName']]['toString']()});}else if(_0x358557[_0xfba5('0x42')]===_0xfba5('0x4a')&&_0x358557[_0xfba5('0x4b')]&&_0x358557['Variable'][_0xfba5('0xc')]&&_0x358557['idField']&&_0x358557[_0xfba5('0x45')]){_0x319e74[_0x358557[_0xfba5('0x4b')][_0xfba5('0xc')][_0xfba5('0x46')]()]&&_0x4acec5[_0xfba5('0x48')][_0xfba5('0x1c')]({'id':_0x358557[_0xfba5('0x49')],'value':_0x319e74[_0x358557[_0xfba5('0x4b')][_0xfba5('0xc')][_0xfba5('0x46')]()][_0xfba5('0x23')]()});}});}return _0x4acec5;}function getConnection(_0x2f6fb8){return request({'method':_0xfba5('0x4c'),'form':{'method':_0xfba5('0x4d'),'input_type':_0xfba5('0x1e'),'response_type':_0xfba5('0x1e'),'rest_data':JSON[_0xfba5('0x25')]({'user_auth':{'user_name':_0x2f6fb8['username'],'password':_0x2f6fb8[_0xfba5('0x4e')],'encryption':_0xfba5('0x4f')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xfba5('0x2d')](function(_0xbde79a){var _0x34e217=_0xbde79a;if(_0x34e217['id']){def[_0xfba5('0x50')]=_0x34e217['id'];return BPromise[_0xfba5('0x32')](_0x34e217);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x2f6fb8['id']));}});}function setRelationship(_0x59671e,_0xda1965,_0x487ff1,_0x2aeb06){return request({'form':{'method':_0xfba5('0x51'),'input_type':_0xfba5('0x1e'),'response_type':_0xfba5('0x1e'),'rest_data':JSON['stringify']({'session':_0x59671e['id'],'module_name':'Calls','module_id':_0x487ff1['id'],'link_field_name':_0x2aeb06,'related_ids':[_0xda1965['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xfba5('0x52')]=function(_0x439347,_0x5e4a9b,_0x2bed58,_0x446c17,_0x31c99f,_0x555892){var _0x46c773,_0x4735fe,_0x5f2c2f,_0x533bcc;_0x555892[_0xfba5('0x53')]=intUtil['stripTrailingSlash'](_0x555892[_0xfba5('0x53')]);_0x555892[_0xfba5('0x54')]=intUtil[_0xfba5('0x55')](_0x555892[_0xfba5('0x54')]);def[_0xfba5('0x56')]=util[_0xfba5('0x20')](_0xfba5('0x57'),_0x555892[_0xfba5('0x53')]);if(_0x31c99f&&_0x31c99f[_0xfba5('0x58')]){logger[_0xfba5('0x27')](_0xfba5('0x59'),'Recording\x20is\x20enabled!');_0x5e4a9b[_0xfba5('0x5a')]=util[_0xfba5('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x555892[_0xfba5('0x54')],_0x5e4a9b[_0xfba5('0x5b')],md5(_0x5e4a9b[_0xfba5('0x5b')]));}else{_0x5e4a9b[_0xfba5('0x5a')]='';}return getConnection(_0x555892)['then'](function(_0x2dba4b){_0x533bcc=_0x2dba4b;return getUser(_0x555892,_0x446c17[_0xfba5('0xc')],_0x533bcc);})[_0xfba5('0x2d')](function(_0x3a534b){_0x46c773=_0x3a534b;logger[_0xfba5('0x27')](_0xfba5('0x5c'),_0x46c773['id']);return getEndUser(_0x555892,_0x5e4a9b['calleridname'],_0x5e4a9b[_0xfba5('0x5d')],_0x533bcc);})[_0xfba5('0x2d')](function(_0x3acd8b){_0x4735fe=_0x3acd8b;logger[_0xfba5('0x27')](_0xfba5('0x5e'),_0x4735fe['id']);return getTicket(_0x555892,_0x46c773,_0x4735fe,_0x2bed58,_0x5e4a9b,_0x2bed58[_0xfba5('0x5f')],_0x533bcc,_0xfba5('0x60'));})[_0xfba5('0x2d')](function(_0x284465){_0x5f2c2f=_0x284465;logger[_0xfba5('0x27')]('Ticket\x20created!');logger[_0xfba5('0x27')](_0xfba5('0x61'),_0x5f2c2f['id']);return setRelationship(_0x533bcc,_0x46c773,_0x5f2c2f,_0xfba5('0x62'));})[_0xfba5('0x2d')](function(){return setRelationship(_0x533bcc,_0x4735fe,_0x5f2c2f,_0xfba5('0x63'));})['then'](function(){return getServerInfo(_0x533bcc);})[_0xfba5('0x2d')](function(_0x5032f8){var _0x4e0be8=parseInt(_0x5032f8[_0xfba5('0x64')][_0xfba5('0x65')](0x0));var _0x2642f4=util[_0xfba5('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x555892[_0xfba5('0x53')],_0x5f2c2f['id']);if(_0x4e0be8>0x6){_0x2642f4=util['format'](_0xfba5('0x66'),_0x555892[_0xfba5('0x53')],_0x5f2c2f['id']);}logger[_0xfba5('0x27')](_0xfba5('0x59'),_0xfba5('0x67'));emit(util[_0xfba5('0x20')](_0xfba5('0x68'),_0x446c17[_0xfba5('0xc')]),'trigger:browser:url',{'uri':_0x2642f4});})[_0xfba5('0x69')](function(_0xafb185){logger[_0xfba5('0x6a')](_0xfba5('0x59'),JSON[_0xfba5('0x25')](_0xafb185));});};exports[_0xfba5('0x6b')]=function(_0x1c67c5,_0x1184ce,_0x3e1835,_0x1c3843,_0x28db22,_0x294a02,_0x3c45ab){var _0x4107d3,_0x48e538,_0x74c333,_0x4d913b;_0x294a02[_0xfba5('0x53')]=intUtil[_0xfba5('0x55')](_0x294a02[_0xfba5('0x53')]);_0x294a02[_0xfba5('0x54')]=intUtil[_0xfba5('0x55')](_0x294a02[_0xfba5('0x54')]);def[_0xfba5('0x56')]=util[_0xfba5('0x20')](_0xfba5('0x57'),_0x294a02[_0xfba5('0x53')]);if(_0x3c45ab&&_0x3c45ab[_0xfba5('0x6c')]&&_0x3c45ab['recordingFormat']!==_0xfba5('0x6d')){logger[_0xfba5('0x27')](_0xfba5('0x6e'),_0xfba5('0x6f'));_0x1184ce['recordingURL']=util[_0xfba5('0x20')](_0xfba5('0x70'),_0x294a02[_0xfba5('0x54')],_0x1184ce[_0xfba5('0x5b')],md5(_0x1184ce['uniqueid']));}return getConnection(_0x294a02)[_0xfba5('0x2d')](function(_0x1adef6){_0x4d913b=_0x1adef6;return getUser(_0x294a02,_0x1c3843[_0xfba5('0xc')],_0x4d913b);})[_0xfba5('0x2d')](function(_0x7fc13d){_0x4107d3=_0x7fc13d;logger[_0xfba5('0x27')](_0xfba5('0x5c'),_0x4107d3['id']);return getEndUser(_0x294a02,_0x1184ce[_0xfba5('0x71')],_0x1184ce[_0xfba5('0x72')],_0x4d913b);})[_0xfba5('0x2d')](function(_0x124d8a){_0x48e538=_0x124d8a;logger[_0xfba5('0x27')](_0xfba5('0x5e'),_0x48e538['id']);return getTicket(_0x294a02,_0x4107d3,_0x48e538,_0x3e1835,_0x1184ce,_0x3e1835['Fields'],_0x4d913b,_0xfba5('0x73'));})['then'](function(_0x48dbed){_0x74c333=_0x48dbed;logger[_0xfba5('0x27')]('Ticket\x20created!');logger[_0xfba5('0x27')](_0xfba5('0x61'),_0x74c333['id']);return setRelationship(_0x4d913b,_0x4107d3,_0x74c333,_0xfba5('0x62'));})[_0xfba5('0x2d')](function(){return setRelationship(_0x4d913b,_0x48e538,_0x74c333,_0xfba5('0x63'));})[_0xfba5('0x2d')](function(){return getServerInfo(_0x4d913b);})['then'](function(_0x2fab1a){var _0x1646eb=parseInt(_0x2fab1a[_0xfba5('0x64')][_0xfba5('0x65')](0x0));var _0x436999=util[_0xfba5('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x294a02[_0xfba5('0x53')],_0x74c333['id']);if(_0x1646eb>0x6){_0x436999=util['format'](_0xfba5('0x66'),_0x294a02[_0xfba5('0x53')],_0x74c333['id']);}logger['info'](_0xfba5('0x6e'),_0xfba5('0x67'));emit(util['format'](_0xfba5('0x68'),_0x1c3843[_0xfba5('0xc')]),'trigger:browser:url',{'uri':_0x436999});})[_0xfba5('0x69')](function(_0x1adb7c){logger[_0xfba5('0x6a')](_0xfba5('0x6e'),JSON['stringify'](_0x1adb7c));});};exports[_0xfba5('0x74')]=function(_0x3cf528,_0x5a3604,_0x31cf43,_0x540a2b,_0x15516a,_0xf499b1){var _0x575c21,_0x301c90,_0x4da032,_0x2d73ad;_0xf499b1[_0xfba5('0x53')]=intUtil[_0xfba5('0x55')](_0xf499b1[_0xfba5('0x53')]);_0xf499b1['serverUrl']=intUtil[_0xfba5('0x55')](_0xf499b1[_0xfba5('0x54')]);def[_0xfba5('0x56')]=util[_0xfba5('0x20')](_0xfba5('0x57'),_0xf499b1[_0xfba5('0x53')]);if(_0x15516a&&_0x15516a['monitor_format']){logger[_0xfba5('0x27')]('['+_0x5a3604[_0xfba5('0x75')][_0xfba5('0x76')]()+']',_0xfba5('0x6f'));_0x5a3604[_0xfba5('0x5a')]=util['format'](_0xfba5('0x70'),_0xf499b1[_0xfba5('0x54')],_0x5a3604[_0xfba5('0x5b')],md5(_0x5a3604[_0xfba5('0x5b')]));}else{_0x5a3604[_0xfba5('0x5a')]='';}return getConnection(_0xf499b1)[_0xfba5('0x2d')](function(_0x2a2b30){_0x2d73ad=_0x2a2b30;if(!_['isNil'](_0x540a2b)){return getUser(_0xf499b1,_0x540a2b[_0xfba5('0xc')],_0x2d73ad);}else{return getUser(_0xf499b1,null,_0x2d73ad);}})[_0xfba5('0x2d')](function(_0x19d00f){_0x575c21=_0x19d00f;logger[_0xfba5('0x27')](_0xfba5('0x5c'),_0x575c21['id']);return getEndUser(_0xf499b1,_0x5a3604[_0xfba5('0x77')],_0x5a3604[_0xfba5('0x5d')],_0x2d73ad);})[_0xfba5('0x2d')](function(_0x3951a2){_0x301c90=_0x3951a2;logger[_0xfba5('0x27')](_0xfba5('0x5e'),_0x301c90['id']);return getTicket(_0xf499b1,_0x575c21,_0x301c90,_0x31cf43,_0x5a3604,_0x31cf43[_0xfba5('0x5f')],_0x2d73ad,'Inbound');})[_0xfba5('0x2d')](function(_0x478c55){_0x4da032=_0x478c55;logger['info']('Ticket\x20created!');logger[_0xfba5('0x27')]('The\x20Ticket\x20ID\x20is:',_0x4da032['id']);return setRelationship(_0x2d73ad,_0x575c21,_0x4da032,'users');})[_0xfba5('0x2d')](function(){return setRelationship(_0x2d73ad,_0x301c90,_0x4da032,_0xfba5('0x63'));})[_0xfba5('0x2d')](function(){return getServerInfo(_0x2d73ad);})[_0xfba5('0x69')](function(_0x1ad4ed){logger[_0xfba5('0x6a')]('['+_0x5a3604[_0xfba5('0x75')][_0xfba5('0x76')]()+']',JSON[_0xfba5('0x25')](_0x1ad4ed));});}; \ No newline at end of file +var _0x4846=['Outbound','catch','[OUTBOUND]','unmanaged','lastevent','toUpperCase','users','request-promise','bluebird','md5','ioredis','sugarcrm','redis','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','Subjects','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','length','forEach','variableName','push','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','Employees','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','Contacts','','Caller\x20-\x20%s','first_name','[HTTP]','merge','nameField','content','string','idField','customField','custom_fields','type','variable','customVariable','Variable','toLowerCase','login','username','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','stripTrailingSlash','recordingFormat','none','destcalleridname','Fields'];(function(_0x2d7ead,_0x48cb08){var _0x4ecf0e=function(_0xca9c69){while(--_0xca9c69){_0x2d7ead['push'](_0x2d7ead['shift']());}};_0x4ecf0e(++_0x48cb08);}(_0x4846,0x7b));var _0x6484=function(_0x5bae5f,_0x3dee66){_0x5bae5f=_0x5bae5f-0x0;var _0x1742e1=_0x4846[_0x5bae5f];return _0x1742e1;};'use strict';var _=require('lodash');var rp=require(_0x6484('0x0'));var BPromise=require(_0x6484('0x1'));var md5=require(_0x6484('0x2'));var util=require('util');var Redis=require(_0x6484('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x6484('0x4'));config[_0x6484('0x5')]=_['defaults'](config[_0x6484('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x6484('0x6'))(new Redis(config[_0x6484('0x5')]));var def={'method':_0x6484('0x7'),'json':!![]};function emit(_0x1db75b,_0x29f3c3,_0x16b85a){io['to'](_0x1db75b)['emit'](_0x29f3c3,_0x16b85a);}function getTicket(_0x3a2c34,_0x3d361f,_0xb684ac,_0x108455,_0x4df8a6,_0x474e43,_0x884c41,_0x2ce7b8){logger[_0x6484('0x8')](_0x6484('0x9'));var _0xd8e05=new Date();var _0x550831=[{'name':_0x6484('0xa'),'value':intUtil['getString'](_0x108455[_0x6484('0xb')],_0x4df8a6,'\x20')},{'name':'assigned_user_id','value':_0x3d361f['id']},{'name':_0x6484('0xc'),'value':_0x3d361f['id']},{'name':_0x6484('0xd'),'value':intUtil['getString'](_0x108455['Descriptions'],_0x4df8a6,'\x0a')},{'name':_0x6484('0xe'),'value':_0xd8e05[_0x6484('0xf')]()[_0x6484('0x10')](0x0,0x13)[_0x6484('0x11')]('T','\x20')},{'name':_0x6484('0x12'),'value':'0'},{'name':_0x6484('0x13'),'value':'15'},{'name':_0x6484('0x14'),'value':_0xb684ac['id']},{'name':_0x6484('0x15'),'value':'Contacts'},{'name':_0x6484('0x16'),'value':_0xb684ac[_0x6484('0xa')]},{'name':'direction','value':_0x2ce7b8}];if(_0x474e43[_0x6484('0x17')]){_[_0x6484('0x18')](_0x474e43,function(_0x6cbfae){if(_0x4df8a6[_0x6cbfae[_0x6484('0x19')]]){_0x550831[_0x6484('0x1a')]({'name':_0x6cbfae['idField'],'value':_0x4df8a6[_0x6cbfae[_0x6484('0x19')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x6484('0x1b'),'response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'session':_0x884c41['id'],'module_name':'Calls','name_value_list':_0x550831})}});}function getAuth(_0x577be3){return util[_0x6484('0x1d')](_0x6484('0x1e'),new Buffer(_0x577be3[_0x6484('0x1f')]+':X')[_0x6484('0x20')](_0x6484('0x21')));}function getServerInfo(_0x5dd23e){return request({'form':{'method':_0x6484('0x22'),'input_type':_0x6484('0x1b'),'response_type':'JSON','rest_data':JSON[_0x6484('0x1c')]({'session':_0x5dd23e['id']})}});}function getUser(_0x5670ca,_0x4d3dab,_0x2192e6){if(!_['isNil'](_0x4d3dab)){logger[_0x6484('0x8')](_0x6484('0x23'),_0x4d3dab);return request({'form':{'method':'get_entry_list','input_type':_0x6484('0x1b'),'response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'session':_0x2192e6['id'],'module_name':_0x6484('0x24'),'query':util[_0x6484('0x1d')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x4d3dab),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6484('0x25')](function(_0x3f4d2e){if(_0x3f4d2e[_0x6484('0x26')][_0x6484('0x17')]){var _0x3497fa=_[_0x6484('0x27')](_0x3f4d2e[_0x6484('0x26')],function(_0x3b84a7){return _0x3b84a7[_0x6484('0x28')][_0x6484('0x29')][_0x6484('0x2a')]===_0x4d3dab;});if(_0x3497fa){logger['info'](_0x6484('0x2b'));return BPromise['resolve']({'id':_0x3497fa[_0x6484('0x28')]['id'][_0x6484('0x2a')],'name':_0x3497fa[_0x6484('0x28')][_0x6484('0xa')][_0x6484('0x2a')]});}}logger[_0x6484('0x8')](_0x6484('0x2c'));return BPromise[_0x6484('0x2d')]({'id':_0x2192e6[_0x6484('0x28')]['user_id'][_0x6484('0x2a')],'name':_0x2192e6[_0x6484('0x28')][_0x6484('0x29')]['value']});});}else{logger[_0x6484('0x8')](_0x6484('0x2e'));return BPromise[_0x6484('0x2d')]({'id':_0x2192e6['name_value_list'][_0x6484('0x2f')]['value'],'name':_0x2192e6[_0x6484('0x28')][_0x6484('0x29')][_0x6484('0x2a')]});}}function getEndUser(_0x475b50,_0x2e4ca7,_0x1af124,_0x8c3c0c){logger[_0x6484('0x8')]('Searching\x20enduser\x20with\x20phone',_0x1af124);return request({'form':{'method':_0x6484('0x30'),'input_type':_0x6484('0x1b'),'response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'session':_0x8c3c0c['id'],'module_name':'Contacts','query':util[_0x6484('0x1d')](_0x6484('0x31'),_0x1af124),'order_by':'','offset':'0','select_fields':['id',_0x6484('0xa'),_0x6484('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x563a51){if(_0x563a51[_0x6484('0x26')]['length']){var _0x27ebd7=_[_0x6484('0x27')](_0x563a51[_0x6484('0x26')],function(_0x2a875c){return _0x2a875c[_0x6484('0x28')][_0x6484('0x32')][_0x6484('0x2a')]===_0x1af124;});if(_0x27ebd7){logger[_0x6484('0x8')](_0x6484('0x33'));return BPromise[_0x6484('0x2d')]({'id':_0x27ebd7[_0x6484('0x28')]['id'][_0x6484('0x2a')],'name':_0x27ebd7[_0x6484('0x28')][_0x6484('0xa')][_0x6484('0x2a')],'phone':_0x27ebd7[_0x6484('0x28')][_0x6484('0x32')][_0x6484('0x2a')]});}}else{logger[_0x6484('0x8')](_0x6484('0x34'));return request({'form':{'method':_0x6484('0x35'),'input_type':'JSON','response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'session':_0x8c3c0c['id'],'module_name':_0x6484('0x36'),'name_value_list':[{'name':'first_name','value':_0x2e4ca7!==_0x6484('0x37')?_0x2e4ca7:util[_0x6484('0x1d')](_0x6484('0x38'),_0x1af124)},{'name':'phone_home','value':_0x1af124}]})}})[_0x6484('0x25')](function(_0x4b1cbc){logger[_0x6484('0x8')]('Enduser\x20created.');return BPromise[_0x6484('0x2d')]({'id':_0x4b1cbc['id'],'name':_0x4b1cbc[_0x6484('0x26')][_0x6484('0x39')][_0x6484('0x2a')],'phone':_0x4b1cbc[_0x6484('0x26')][_0x6484('0x32')]['value']});});}});}function request(_0x48062a){logger['debug'](_0x6484('0x3a'),JSON['stringify'](_0x48062a));return rp(_[_0x6484('0x3b')](def,_0x48062a));}function getTags(_0x45cc69,_0x1784d0){var _0x280d18=[];if(_0x45cc69&&_0x45cc69['length']>0x0){_0x280d18=_['map'](_0x45cc69,_0x1784d0);}return _0x280d18;}function getCustomFields(_0x58c813,_0x114337){var _0x2cb097=[];var _0x303358={'custom_fields':[]};if(_0x58c813[_0x6484('0x17')]>0x0){_[_0x6484('0x18')](_0x58c813,function(_0x5cf272){if(_0x5cf272['type']==='string'&&_0x5cf272[_0x6484('0x3c')]&&!_0x5cf272['customField']){_0x303358[_0x5cf272[_0x6484('0x3c')]['toLowerCase']()]=_0x5cf272[_0x6484('0x3d')][_0x6484('0x20')]();}else if(_0x5cf272['type']===_0x6484('0x3e')&&_0x5cf272[_0x6484('0x3f')]&&_0x5cf272[_0x6484('0x40')]){_0x303358[_0x6484('0x41')]['push']({'id':_0x5cf272[_0x6484('0x3f')],'value':_0x5cf272[_0x6484('0x3d')][_0x6484('0x20')]()});}else if(_0x5cf272[_0x6484('0x42')]===_0x6484('0x43')&&_0x5cf272[_0x6484('0x19')]&&_0x5cf272['idField']&&_0x5cf272[_0x6484('0x40')]){_0x114337[_0x5cf272[_0x6484('0x19')]]&&_0x303358['custom_fields'][_0x6484('0x1a')]({'id':_0x5cf272[_0x6484('0x3f')],'value':_0x114337[_0x5cf272['variableName']][_0x6484('0x20')]()});}else if(_0x5cf272[_0x6484('0x42')]===_0x6484('0x44')&&_0x5cf272[_0x6484('0x45')]&&_0x5cf272['Variable'][_0x6484('0xa')]&&_0x5cf272['idField']&&_0x5cf272['customField']){_0x114337[_0x5cf272['Variable'][_0x6484('0xa')][_0x6484('0x46')]()]&&_0x303358[_0x6484('0x41')]['push']({'id':_0x5cf272[_0x6484('0x3f')],'value':_0x114337[_0x5cf272[_0x6484('0x45')][_0x6484('0xa')][_0x6484('0x46')]()]['toString']()});}});}return _0x303358;}function getConnection(_0x10d142){return request({'method':_0x6484('0x7'),'form':{'method':_0x6484('0x47'),'input_type':_0x6484('0x1b'),'response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'user_auth':{'user_name':_0x10d142[_0x6484('0x48')],'password':_0x10d142['password'],'encryption':'PLAIN'},'application':_0x6484('0x49')})}})[_0x6484('0x25')](function(_0x447d05){var _0x1304da=_0x447d05;if(_0x1304da['id']){def['sessionID']=_0x1304da['id'];return BPromise[_0x6484('0x2d')](_0x1304da);}else{throw new Error(util[_0x6484('0x1d')](_0x6484('0x4a'),_0x10d142['id']));}});}function setRelationship(_0x545e29,_0x8d8fd9,_0x28de26,_0x502aca){return request({'form':{'method':_0x6484('0x4b'),'input_type':_0x6484('0x1b'),'response_type':_0x6484('0x1b'),'rest_data':JSON[_0x6484('0x1c')]({'session':_0x545e29['id'],'module_name':_0x6484('0x4c'),'module_id':_0x28de26['id'],'link_field_name':_0x502aca,'related_ids':[_0x8d8fd9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6484('0x4d')]=function(_0x7bf909,_0x49e157,_0x232f01,_0x101a78,_0x2ba4a1,_0x23e1e9){var _0x5132ea,_0x283164,_0x5b0f13,_0x4d6ace;_0x23e1e9[_0x6484('0x4e')]=intUtil['stripTrailingSlash'](_0x23e1e9[_0x6484('0x4e')]);_0x23e1e9[_0x6484('0x4f')]=intUtil['stripTrailingSlash'](_0x23e1e9[_0x6484('0x4f')]);def[_0x6484('0x50')]=util[_0x6484('0x1d')](_0x6484('0x51'),_0x23e1e9[_0x6484('0x4e')]);if(_0x2ba4a1&&_0x2ba4a1[_0x6484('0x52')]){logger['info'](_0x6484('0x53'),_0x6484('0x54'));_0x49e157[_0x6484('0x55')]=util['format'](_0x6484('0x56'),_0x23e1e9[_0x6484('0x4f')],_0x49e157[_0x6484('0x57')],md5(_0x49e157[_0x6484('0x57')]));}else{_0x49e157[_0x6484('0x55')]='';}return getConnection(_0x23e1e9)[_0x6484('0x25')](function(_0x322411){_0x4d6ace=_0x322411;return getUser(_0x23e1e9,_0x101a78[_0x6484('0xa')],_0x4d6ace);})['then'](function(_0x378531){_0x5132ea=_0x378531;logger[_0x6484('0x8')](_0x6484('0x58'),_0x5132ea['id']);return getEndUser(_0x23e1e9,_0x49e157[_0x6484('0x59')],_0x49e157[_0x6484('0x5a')],_0x4d6ace);})[_0x6484('0x25')](function(_0x287b35){_0x283164=_0x287b35;logger[_0x6484('0x8')](_0x6484('0x5b'),_0x283164['id']);return getTicket(_0x23e1e9,_0x5132ea,_0x283164,_0x232f01,_0x49e157,_0x232f01['Fields'],_0x4d6ace,_0x6484('0x5c'));})[_0x6484('0x25')](function(_0x578ee1){_0x5b0f13=_0x578ee1;logger[_0x6484('0x8')](_0x6484('0x5d'));logger['info'](_0x6484('0x5e'),_0x5b0f13['id']);return setRelationship(_0x4d6ace,_0x5132ea,_0x5b0f13,'users');})['then'](function(){return setRelationship(_0x4d6ace,_0x283164,_0x5b0f13,_0x6484('0x5f'));})[_0x6484('0x25')](function(){return getServerInfo(_0x4d6ace);})[_0x6484('0x25')](function(_0x175dd7){var _0x25d0d4=parseInt(_0x175dd7[_0x6484('0x60')][_0x6484('0x61')](0x0));var _0x33e0db=util['format'](_0x6484('0x62'),_0x23e1e9['remoteUri'],_0x5b0f13['id']);if(_0x25d0d4>0x6){_0x33e0db=util[_0x6484('0x1d')](_0x6484('0x63'),_0x23e1e9[_0x6484('0x4e')],_0x5b0f13['id']);}logger[_0x6484('0x8')](_0x6484('0x53'),_0x6484('0x64'));emit(util[_0x6484('0x1d')](_0x6484('0x65'),_0x101a78['name']),_0x6484('0x66'),{'uri':_0x33e0db});})['catch'](function(_0x30418a){logger[_0x6484('0x67')]('[QUEUE]',JSON[_0x6484('0x1c')](_0x30418a));});};exports['outbound']=function(_0xa2cd0c,_0xaaf9d7,_0x269211,_0x497c23,_0x539bd6,_0xec409b,_0x46a8aa){var _0x120a8b,_0x21ff47,_0x22ac6a,_0x2c4521;_0xec409b[_0x6484('0x4e')]=intUtil[_0x6484('0x68')](_0xec409b['remoteUri']);_0xec409b['serverUrl']=intUtil[_0x6484('0x68')](_0xec409b['serverUrl']);def[_0x6484('0x50')]=util['format'](_0x6484('0x51'),_0xec409b['remoteUri']);if(_0x46a8aa&&_0x46a8aa['recordingFormat']&&_0x46a8aa[_0x6484('0x69')]!==_0x6484('0x6a')){logger[_0x6484('0x8')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xaaf9d7['recordingURL']=util['format'](_0x6484('0x56'),_0xec409b['serverUrl'],_0xaaf9d7[_0x6484('0x57')],md5(_0xaaf9d7[_0x6484('0x57')]));}return getConnection(_0xec409b)[_0x6484('0x25')](function(_0x59cf29){_0x2c4521=_0x59cf29;return getUser(_0xec409b,_0x497c23[_0x6484('0xa')],_0x2c4521);})['then'](function(_0x5c9a5a){_0x120a8b=_0x5c9a5a;logger[_0x6484('0x8')]('The\x20User\x20ID\x20is:',_0x120a8b['id']);return getEndUser(_0xec409b,_0xaaf9d7[_0x6484('0x6b')],_0xaaf9d7['destcalleridnum'],_0x2c4521);})[_0x6484('0x25')](function(_0x2e8ea4){_0x21ff47=_0x2e8ea4;logger[_0x6484('0x8')](_0x6484('0x5b'),_0x21ff47['id']);return getTicket(_0xec409b,_0x120a8b,_0x21ff47,_0x269211,_0xaaf9d7,_0x269211[_0x6484('0x6c')],_0x2c4521,_0x6484('0x6d'));})[_0x6484('0x25')](function(_0x4bf260){_0x22ac6a=_0x4bf260;logger['info'](_0x6484('0x5d'));logger[_0x6484('0x8')](_0x6484('0x5e'),_0x22ac6a['id']);return setRelationship(_0x2c4521,_0x120a8b,_0x22ac6a,'users');})[_0x6484('0x25')](function(){return setRelationship(_0x2c4521,_0x21ff47,_0x22ac6a,'contacts');})['then'](function(){return getServerInfo(_0x2c4521);})[_0x6484('0x25')](function(_0x31a2dc){var _0x4b17fd=parseInt(_0x31a2dc['version'][_0x6484('0x61')](0x0));var _0x5d3642=util[_0x6484('0x1d')](_0x6484('0x62'),_0xec409b['remoteUri'],_0x22ac6a['id']);if(_0x4b17fd>0x6){_0x5d3642=util[_0x6484('0x1d')](_0x6484('0x63'),_0xec409b['remoteUri'],_0x22ac6a['id']);}logger[_0x6484('0x8')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6484('0x1d')](_0x6484('0x65'),_0x497c23['name']),_0x6484('0x66'),{'uri':_0x5d3642});})[_0x6484('0x6e')](function(_0x7afdff){logger[_0x6484('0x67')](_0x6484('0x6f'),JSON[_0x6484('0x1c')](_0x7afdff));});};exports[_0x6484('0x70')]=function(_0x7d3a92,_0x212334,_0x185e74,_0x2b1457,_0x409318,_0xfc2c13){var _0x307e00,_0x41b531,_0x494eb8,_0x1116ec;_0xfc2c13['remoteUri']=intUtil[_0x6484('0x68')](_0xfc2c13[_0x6484('0x4e')]);_0xfc2c13['serverUrl']=intUtil['stripTrailingSlash'](_0xfc2c13['serverUrl']);def[_0x6484('0x50')]=util[_0x6484('0x1d')]('%s/service/v4_1/rest.php',_0xfc2c13[_0x6484('0x4e')]);if(_0x409318&&_0x409318[_0x6484('0x52')]){logger[_0x6484('0x8')]('['+_0x212334[_0x6484('0x71')][_0x6484('0x72')]()+']',_0x6484('0x54'));_0x212334[_0x6484('0x55')]=util[_0x6484('0x1d')](_0x6484('0x56'),_0xfc2c13[_0x6484('0x4f')],_0x212334[_0x6484('0x57')],md5(_0x212334[_0x6484('0x57')]));}else{_0x212334[_0x6484('0x55')]='';}return getConnection(_0xfc2c13)[_0x6484('0x25')](function(_0x4a4126){_0x1116ec=_0x4a4126;if(!_['isNil'](_0x2b1457)){return getUser(_0xfc2c13,_0x2b1457[_0x6484('0xa')],_0x1116ec);}else{return getUser(_0xfc2c13,null,_0x1116ec);}})[_0x6484('0x25')](function(_0x2908ce){_0x307e00=_0x2908ce;logger[_0x6484('0x8')](_0x6484('0x58'),_0x307e00['id']);return getEndUser(_0xfc2c13,_0x212334[_0x6484('0x59')],_0x212334[_0x6484('0x5a')],_0x1116ec);})['then'](function(_0x2f9f96){_0x41b531=_0x2f9f96;logger[_0x6484('0x8')](_0x6484('0x5b'),_0x41b531['id']);return getTicket(_0xfc2c13,_0x307e00,_0x41b531,_0x185e74,_0x212334,_0x185e74[_0x6484('0x6c')],_0x1116ec,_0x6484('0x5c'));})[_0x6484('0x25')](function(_0x453e8f){_0x494eb8=_0x453e8f;logger[_0x6484('0x8')](_0x6484('0x5d'));logger[_0x6484('0x8')](_0x6484('0x5e'),_0x494eb8['id']);return setRelationship(_0x1116ec,_0x307e00,_0x494eb8,_0x6484('0x73'));})['then'](function(){return setRelationship(_0x1116ec,_0x41b531,_0x494eb8,'contacts');})[_0x6484('0x25')](function(){return getServerInfo(_0x1116ec);})[_0x6484('0x6e')](function(_0x5d4287){logger[_0x6484('0x67')]('['+_0x212334[_0x6484('0x71')][_0x6484('0x72')]()+']',JSON[_0x6484('0x1c')](_0x5d4287));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index dd35b30..6ea9db4 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 _0x651b=['keyContent','keyType','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','lodash','getString','length','sortBy','type','string','content','variable','variableName','push','customVariable','Variable','name','toLowerCase','toString','key','format','%s:\x20%s'];(function(_0x1f19a2,_0x180dc7){var _0x5ae0a4=function(_0x1cbfe){while(--_0x1cbfe){_0x1f19a2['push'](_0x1f19a2['shift']());}};_0x5ae0a4(++_0x180dc7);}(_0x651b,0x15a));var _0xb651=function(_0x2541ff,_0x3bb2eb){_0x2541ff=_0x2541ff-0x0;var _0x2e25ce=_0x651b[_0x2541ff];return _0x2e25ce;};'use strict';var _=require(_0xb651('0x0'));var util=require('util');exports[_0xb651('0x1')]=function(_0x295aa6,_0x147937,_0x2f0260){var _0x4927e6=[];if(_0x295aa6[_0xb651('0x2')]>0x0){var _0x3976a5=_[_0xb651('0x3')](_0x295aa6,['id']);for(var _0x5b3d1c=0x0;_0x5b3d1c<_0x3976a5['length'];_0x5b3d1c++){var _0x47754b=_0x3976a5[_0x5b3d1c];if(_0x47754b[_0xb651('0x4')]===_0xb651('0x5')){_0x4927e6['push'](_0x47754b[_0xb651('0x6')]);}else if(_0x47754b['type']===_0xb651('0x7')&&_0x47754b[_0xb651('0x8')]){_0x147937[_0x47754b['variableName']]&&_0x4927e6[_0xb651('0x9')](_0x147937[_0x47754b[_0xb651('0x8')]]['toString']());}else if(_0x47754b['type']===_0xb651('0xa')&&_0x47754b[_0xb651('0xb')]&&_0x47754b['Variable'][_0xb651('0xc')]){_0x147937[_0x47754b[_0xb651('0xb')][_0xb651('0xc')][_0xb651('0xd')]()]&&_0x4927e6[_0xb651('0x9')](_0x147937[_0x47754b[_0xb651('0xb')]['name'][_0xb651('0xd')]()][_0xb651('0xe')]());}else if(_0x47754b['type']==='keyValue'){if(_0x47754b['keyType']===_0xb651('0x5')&&_0x47754b[_0xb651('0xf')]){_0x4927e6['push'](util[_0xb651('0x10')](_0xb651('0x11'),_0x47754b[_0xb651('0xf')],_0x47754b[_0xb651('0x12')]));}else if(_0x47754b[_0xb651('0x13')]==='variable'&&_0x47754b[_0xb651('0x8')]&&_0x47754b['key']){_0x147937[_0x47754b['variableName']]&&_0x4927e6[_0xb651('0x9')](util[_0xb651('0x10')](_0xb651('0x11'),_0x47754b[_0xb651('0xf')],_0x147937[_0x47754b['variableName']]));}else if(_0x47754b[_0xb651('0x13')]===_0xb651('0xa')&&_0x47754b[_0xb651('0xb')]&&_0x47754b[_0xb651('0xb')][_0xb651('0xc')]&&_0x47754b[_0xb651('0xf')]){_0x147937[_0x47754b[_0xb651('0xb')][_0xb651('0xc')][_0xb651('0xd')]()]&&_0x4927e6[_0xb651('0x9')](util[_0xb651('0x10')](_0xb651('0x11'),_0x47754b[_0xb651('0xf')],_0x147937[_0x47754b[_0xb651('0xb')][_0xb651('0xc')][_0xb651('0xd')]()]));}}}}return _0x4927e6[_0xb651('0x14')](_0x2f0260);};exports[_0xb651('0x15')]=function(_0x243b23){var _0x5abe77=_0x243b23[_0xb651('0x16')](-0x1);if(_0x5abe77==='/'){_0x243b23=_0x243b23[_0xb651('0x17')](0x0,_0x243b23[_0xb651('0x18')](_0x5abe77));}return _0x243b23;};exports[_0xb651('0x19')]=function(_0x2d7f3e){if(!_['isNil'](_0x2d7f3e)&&_0x2d7f3e!==''){var _0x230834=/^(([^<>()\[\]\\.,;:\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 _0x230834['test'](String(_0x2d7f3e)[_0xb651('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xb09a=['%s:\x20%s','customVariable','format','join','stripTrailingSlash','substring','lastIndexOf','isNil','test','lodash','util','getString','sortBy','length','type','string','content','variable','variableName','Variable','name','toLowerCase','push','keyValue','key','keyContent','keyType'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0xb09a,0x90));var _0xab09=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb09a[_0x17928f];return _0x500b63;};'use strict';var _=require(_0xab09('0x0'));var util=require(_0xab09('0x1'));exports[_0xab09('0x2')]=function(_0x5d8cc2,_0x1acc5f,_0x344423){var _0x299df3=[];if(_0x5d8cc2['length']>0x0){var _0x48ea75=_[_0xab09('0x3')](_0x5d8cc2,['id']);for(var _0x45554c=0x0;_0x45554c<_0x48ea75[_0xab09('0x4')];_0x45554c++){var _0x189ce4=_0x48ea75[_0x45554c];if(_0x189ce4[_0xab09('0x5')]===_0xab09('0x6')){_0x299df3['push'](_0x189ce4[_0xab09('0x7')]);}else if(_0x189ce4['type']===_0xab09('0x8')&&_0x189ce4[_0xab09('0x9')]){_0x1acc5f[_0x189ce4[_0xab09('0x9')]]&&_0x299df3['push'](_0x1acc5f[_0x189ce4[_0xab09('0x9')]]['toString']());}else if(_0x189ce4['type']==='customVariable'&&_0x189ce4[_0xab09('0xa')]&&_0x189ce4[_0xab09('0xa')][_0xab09('0xb')]){_0x1acc5f[_0x189ce4['Variable']['name'][_0xab09('0xc')]()]&&_0x299df3[_0xab09('0xd')](_0x1acc5f[_0x189ce4[_0xab09('0xa')]['name'][_0xab09('0xc')]()]['toString']());}else if(_0x189ce4[_0xab09('0x5')]===_0xab09('0xe')){if(_0x189ce4['keyType']===_0xab09('0x6')&&_0x189ce4['key']){_0x299df3[_0xab09('0xd')](util['format']('%s:\x20%s',_0x189ce4[_0xab09('0xf')],_0x189ce4[_0xab09('0x10')]));}else if(_0x189ce4[_0xab09('0x11')]===_0xab09('0x8')&&_0x189ce4[_0xab09('0x9')]&&_0x189ce4[_0xab09('0xf')]){_0x1acc5f[_0x189ce4[_0xab09('0x9')]]&&_0x299df3[_0xab09('0xd')](util['format'](_0xab09('0x12'),_0x189ce4['key'],_0x1acc5f[_0x189ce4[_0xab09('0x9')]]));}else if(_0x189ce4['keyType']===_0xab09('0x13')&&_0x189ce4[_0xab09('0xa')]&&_0x189ce4[_0xab09('0xa')][_0xab09('0xb')]&&_0x189ce4[_0xab09('0xf')]){_0x1acc5f[_0x189ce4['Variable']['name'][_0xab09('0xc')]()]&&_0x299df3[_0xab09('0xd')](util[_0xab09('0x14')](_0xab09('0x12'),_0x189ce4[_0xab09('0xf')],_0x1acc5f[_0x189ce4[_0xab09('0xa')]['name'][_0xab09('0xc')]()]));}}}}return _0x299df3[_0xab09('0x15')](_0x344423);};exports[_0xab09('0x16')]=function(_0x1a1167){var _0x14888b=_0x1a1167['slice'](-0x1);if(_0x14888b==='/'){_0x1a1167=_0x1a1167[_0xab09('0x17')](0x0,_0x1a1167[_0xab09('0x18')](_0x14888b));}return _0x1a1167;};exports['validateEmail']=function(_0x537314){if(!_[_0xab09('0x19')](_0x537314)&&_0x537314!==''){var _0x2ff887=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x2ff887[_0xab09('0x1a')](String(_0x537314)[_0xab09('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index e9d1c8d..d33e50c 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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 6c5418c..4e2e977 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 _0x8dda=['Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridname','calleridnum','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...','user:%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','trigger:browser:url','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','count','Agent\x20found!','find','results','agent','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','defaults','GET','map','includes','string','type','customField','nameField','toLowerCase','content','picklist','idField','custom_fields','push','variableName','customVariable'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8dda,0x1cd));var _0xa8dd=function(_0x1f0ad7,_0xbdbf69){_0x1f0ad7=_0x1f0ad7-0x0;var _0xc907ef=_0x8dda[_0x1f0ad7];return _0xc907ef;};'use strict';var _=require(_0xa8dd('0x0'));var rp=require(_0xa8dd('0x1'));var md5=require(_0xa8dd('0x2'));var util=require(_0xa8dd('0x3'));var Redis=require(_0xa8dd('0x4'));var intUtil=require(_0xa8dd('0x5'));var config=require('../../../../config/environment');var logger=require(_0xa8dd('0x6'))(_0xa8dd('0x7'));config[_0xa8dd('0x8')]=_['defaults'](config[_0xa8dd('0x8')],{'host':_0xa8dd('0x9'),'port':0x18eb});var io=require(_0xa8dd('0xa'))(new Redis(config[_0xa8dd('0x8')]));function emit(_0x1ea951,_0x4d3625,_0x1e03d9){io['to'](_0x1ea951)[_0xa8dd('0xb')](_0x4d3625,_0x1e03d9);}var headers={'Content-Type':'application/json','Accept':_0xa8dd('0xc')};function getTicket(_0x443aa1,_0xb79825,_0x392c4a,_0x398922,_0x310610){logger[_0xa8dd('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xa8dd('0xe')]('%s/tickets.json',_0x443aa1[_0xa8dd('0xf')]),'method':_0xa8dd('0x10'),'body':{'ticket':_[_0xa8dd('0x11')]({'requester_id':_0x392c4a['id'],'submitter_id':_0xb79825?_0xb79825['id']:undefined,'assignee_id':_0xb79825?_0xb79825['id']:undefined,'tags':getTags(_0x398922[_0xa8dd('0x12')],_0xa8dd('0x13')),'subject':intUtil[_0xa8dd('0x14')](_0x398922[_0xa8dd('0x15')],_0x310610,'\x20'),'description':intUtil[_0xa8dd('0x14')](_0x398922['Descriptions'],_0x310610,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa8dd('0x14')](_0x398922['Descriptions'],_0x310610,'\x0a')}},getCustomFields(_0x398922[_0xa8dd('0x16')],_0x310610))}})[_0xa8dd('0x17')](function(_0x2bb37c){logger[_0xa8dd('0xd')](_0xa8dd('0x18'));return _0x2bb37c[_0xa8dd('0x19')];});}function getUser(_0x3d29a6,_0x46f205){if(intUtil[_0xa8dd('0x1a')](_0x46f205)){logger[_0xa8dd('0xd')]('Getting\x20agent\x20with\x20email',_0x46f205);return request({'uri':util['format'](_0xa8dd('0x1b'),_0x3d29a6[_0xa8dd('0xf')]),'qs':{'query':util[_0xa8dd('0xe')]('type:user\x20role:agent\x20email:%s',_0x46f205)}})[_0xa8dd('0x17')](function(_0x17ec6e){if(_0x17ec6e[_0xa8dd('0x1c')]){logger[_0xa8dd('0xd')](_0xa8dd('0x1d'));return _[_0xa8dd('0x1e')](_0x17ec6e[_0xa8dd('0x1f')],{'email':_0x46f205,'role':_0xa8dd('0x20')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa8dd('0xe')]('%s/users/me.json',_0x3d29a6[_0xa8dd('0xf')])})[_0xa8dd('0x17')](function(_0x47212f){logger[_0xa8dd('0xd')]('Admin\x20account\x20selected.');return _0x47212f[_0xa8dd('0x21')];});}});}else{logger[_0xa8dd('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x3d29a6['remoteUri'])})[_0xa8dd('0x17')](function(_0x27d2f5){logger[_0xa8dd('0xd')]('Admin\x20account\x20selected.');return _0x27d2f5[_0xa8dd('0x21')];});}}function getEndUser(_0x490bcc,_0x21a34b,_0x3dcedb){logger['info'](_0xa8dd('0x22'),_0x3dcedb);return request({'uri':util[_0xa8dd('0xe')](_0xa8dd('0x1b'),_0x490bcc[_0xa8dd('0xf')]),'qs':{'query':util[_0xa8dd('0xe')](_0xa8dd('0x23'),_0x3dcedb)}})[_0xa8dd('0x17')](function(_0x10ae48){var _0x53c734;if(_0x10ae48[_0xa8dd('0x1f')][_0xa8dd('0x24')]){_0x10ae48[_0xa8dd('0x1f')]=_[_0xa8dd('0x25')](_0x10ae48[_0xa8dd('0x1f')],{'suspended':![],'role':_0xa8dd('0x26')});if(_0x10ae48[_0xa8dd('0x1f')][_0xa8dd('0x24')]){_0x53c734=_['first'](_0x10ae48[_0xa8dd('0x1f')]);}}if(_0x53c734){logger['info'](_0xa8dd('0x27'));return _0x53c734;}else{logger[_0xa8dd('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xa8dd('0xe')](_0xa8dd('0x28'),_0x490bcc[_0xa8dd('0xf')]),'method':'POST','body':{'user':{'role':_0xa8dd('0x26'),'name':util['format']('Caller\x20-\x20%s',_0x21a34b||_0x3dcedb),'phone':_0x3dcedb}}})[_0xa8dd('0x17')](function(_0x5a334a){logger['info'](_0xa8dd('0x29'));return _0x5a334a[_0xa8dd('0x21')];});}});}function getAuth(_0x310719){var _0x47340a;if(_0x310719[_0xa8dd('0x2a')]===_0xa8dd('0x2b')){_0x47340a=util[_0xa8dd('0xe')](_0xa8dd('0x2c'),_0x310719[_0xa8dd('0x2d')],_0x310719['password']);}else if(_0x310719[_0xa8dd('0x2a')]===_0xa8dd('0x2e')){_0x47340a=util['format'](_0xa8dd('0x2f'),_0x310719[_0xa8dd('0x2d')],_0x310719[_0xa8dd('0x2e')]);}return util[_0xa8dd('0xe')](_0xa8dd('0x30'),new Buffer(_0x47340a)[_0xa8dd('0x31')](_0xa8dd('0x32')));}function request(_0x2c6dd0){logger[_0xa8dd('0x33')]('[HTTP]',JSON[_0xa8dd('0x34')](_0x2c6dd0));return rp(_[_0xa8dd('0x35')](_0x2c6dd0,{'method':_0xa8dd('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x4f0d02,_0x5e90e0){var _0x4693e7=[];if(_0x4f0d02&&_0x4f0d02[_0xa8dd('0x24')]>0x0){_0x4693e7=_[_0xa8dd('0x37')](_0x4f0d02,_0x5e90e0);}return _0x4693e7;}function getCustomFields(_0xe0e8f9,_0x26b064){var _0x317ac7=[];var _0x51f8e0={'custom_fields':[]};if(_0xe0e8f9[_0xa8dd('0x24')]>0x0){_['forEach'](_0xe0e8f9,function(_0x2ba5df){if(_[_0xa8dd('0x38')]([_0xa8dd('0x39'),'picklist'],_0x2ba5df[_0xa8dd('0x3a')])&&_0x2ba5df['nameField']&&!_0x2ba5df[_0xa8dd('0x3b')]){_0x51f8e0[_0x2ba5df[_0xa8dd('0x3c')][_0xa8dd('0x3d')]()]=_0x2ba5df[_0xa8dd('0x3e')][_0xa8dd('0x31')]();}else if(_[_0xa8dd('0x38')]([_0xa8dd('0x39'),_0xa8dd('0x3f')],_0x2ba5df[_0xa8dd('0x3a')])&&_0x2ba5df[_0xa8dd('0x40')]&&_0x2ba5df[_0xa8dd('0x3b')]){_0x51f8e0[_0xa8dd('0x41')][_0xa8dd('0x42')]({'id':_0x2ba5df[_0xa8dd('0x40')],'value':_0x2ba5df[_0xa8dd('0x3e')][_0xa8dd('0x31')]()});}else if(_0x2ba5df['type']==='variable'&&_0x2ba5df[_0xa8dd('0x43')]&&_0x2ba5df[_0xa8dd('0x40')]&&_0x2ba5df[_0xa8dd('0x3b')]){_0x26b064[_0x2ba5df[_0xa8dd('0x43')]]&&_0x51f8e0[_0xa8dd('0x41')][_0xa8dd('0x42')]({'id':_0x2ba5df[_0xa8dd('0x40')],'value':_0x26b064[_0x2ba5df[_0xa8dd('0x43')]][_0xa8dd('0x31')]()});}else if(_0x2ba5df[_0xa8dd('0x3a')]===_0xa8dd('0x44')&&_0x2ba5df[_0xa8dd('0x45')]&&_0x2ba5df['Variable']['name']&&_0x2ba5df[_0xa8dd('0x40')]&&_0x2ba5df[_0xa8dd('0x3b')]){_0x26b064[_0x2ba5df[_0xa8dd('0x45')][_0xa8dd('0x13')]['toLowerCase']()]&&_0x51f8e0['custom_fields'][_0xa8dd('0x42')]({'id':_0x2ba5df['idField'],'value':_0x26b064[_0x2ba5df['Variable'][_0xa8dd('0x13')][_0xa8dd('0x3d')]()][_0xa8dd('0x31')]()});}});}return _0x51f8e0;}exports['queue']=function(_0x3c0ebb,_0x1d20ec,_0x28e066,_0x18540e,_0x2ae027,_0xcf94b1){var _0x53a401,_0x3bed8a;_0xcf94b1[_0xa8dd('0xf')]=intUtil[_0xa8dd('0x46')](_0xcf94b1[_0xa8dd('0xf')]);_0xcf94b1['serverUrl']=intUtil[_0xa8dd('0x46')](_0xcf94b1[_0xa8dd('0x47')]);if(_0x2ae027&&_0x2ae027['monitor_format']){logger[_0xa8dd('0xd')](_0xa8dd('0x48'),_0xa8dd('0x49'));_0x1d20ec['recordingURL']=util[_0xa8dd('0xe')](_0xa8dd('0x4a'),_0xcf94b1[_0xa8dd('0x47')],_0x1d20ec[_0xa8dd('0x4b')],md5(_0x1d20ec[_0xa8dd('0x4b')]));}else{_0x1d20ec[_0xa8dd('0x4c')]='';}headers[_0xa8dd('0x4d')]=getAuth(_0xcf94b1);return getUser(_0xcf94b1,_0x18540e[_0xa8dd('0x4e')])['then'](function(_0xc38363){_0x53a401=_0xc38363;logger[_0xa8dd('0xd')]('The\x20User\x20ID\x20is:',_0x53a401['id']);return getEndUser(_0xcf94b1,_0x1d20ec[_0xa8dd('0x4f')],_0x1d20ec[_0xa8dd('0x50')]);})['then'](function(_0x390f4e){_0x3bed8a=_0x390f4e;logger[_0xa8dd('0xd')](_0xa8dd('0x51'),_0x3bed8a['id']);return getTicket(_0xcf94b1,_0x53a401,_0x3bed8a,_0x28e066,_0x1d20ec);})[_0xa8dd('0x17')](function(_0x46a64b){if(_0x46a64b){logger[_0xa8dd('0xd')](_0xa8dd('0x52'),_0x46a64b['id']);switch(_0xcf94b1['type']){case _0xa8dd('0x53'):logger['info'](_0xa8dd('0x48'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xa8dd('0xe')](_0xa8dd('0x54'),_0xcf94b1[_0xa8dd('0xf')],_0x53a401['id'],_0x46a64b['id']),'method':_0xa8dd('0x10')});case _0xa8dd('0x55'):logger[_0xa8dd('0xd')](_0xa8dd('0x48'),_0xa8dd('0x56'));emit(util[_0xa8dd('0xe')](_0xa8dd('0x57'),_0x18540e[_0xa8dd('0x13')]),'trigger:browser:url',{'uri':util[_0xa8dd('0xe')]('%s/agent/tickets/%s',_0xcf94b1[_0xa8dd('0xf')][_0xa8dd('0x58')](_0xa8dd('0x59'),''),_0x46a64b['id'])});break;default:logger[_0xa8dd('0x5a')](_0xa8dd('0x48'),_0xa8dd('0x5b'));}}})[_0xa8dd('0x5c')](function(_0x2b1d53){logger[_0xa8dd('0x5a')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xa8dd('0x5d')](_0x2b1d53,{'showHidden':!![],'depth':null}));});};exports[_0xa8dd('0x5e')]=function(_0x388fc8,_0x558c39,_0xd5c3f9,_0x33f789,_0x12dce0,_0x37920e,_0x3d535b){var _0xb20369,_0x59d29e;_0x37920e['remoteUri']=intUtil['stripTrailingSlash'](_0x37920e['remoteUri']);_0x37920e[_0xa8dd('0x47')]=intUtil['stripTrailingSlash'](_0x37920e['serverUrl']);if(_0x3d535b&&_0x3d535b[_0xa8dd('0x5f')]&&_0x3d535b[_0xa8dd('0x5f')]!==_0xa8dd('0x60')){logger[_0xa8dd('0xd')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x558c39['recordingURL']=util[_0xa8dd('0xe')](_0xa8dd('0x4a'),_0x37920e[_0xa8dd('0x47')],_0x558c39[_0xa8dd('0x4b')],md5(_0x558c39[_0xa8dd('0x4b')]));}headers[_0xa8dd('0x4d')]=getAuth(_0x37920e);return getUser(_0x37920e,_0x33f789[_0xa8dd('0x4e')])[_0xa8dd('0x17')](function(_0x5c858e){_0xb20369=_0x5c858e;logger[_0xa8dd('0xd')](_0xa8dd('0x61'),_0xb20369['id']);return getEndUser(_0x37920e,_0x558c39['destcalleridname'],_0x558c39[_0xa8dd('0x62')]);})['then'](function(_0x4ed0e2){_0x59d29e=_0x4ed0e2;logger[_0xa8dd('0xd')](_0xa8dd('0x51'),_0x59d29e['id']);return getTicket(_0x37920e,_0xb20369,_0x59d29e,_0xd5c3f9,_0x558c39);})[_0xa8dd('0x17')](function(_0xbee158){if(_0xbee158){logger[_0xa8dd('0xd')]('The\x20Ticket\x20ID\x20is:',_0xbee158['id']);switch(_0x37920e['type']){case _0xa8dd('0x53'):logger[_0xa8dd('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xa8dd('0x54'),_0x37920e[_0xa8dd('0xf')],_0xb20369['id'],_0xbee158['id']),'method':_0xa8dd('0x10')});case _0xa8dd('0x55'):logger[_0xa8dd('0xd')](_0xa8dd('0x63'),_0xa8dd('0x56'));emit(util[_0xa8dd('0xe')](_0xa8dd('0x57'),_0x33f789[_0xa8dd('0x13')]),_0xa8dd('0x64'),{'uri':util['format'](_0xa8dd('0x65'),_0x37920e['remoteUri'][_0xa8dd('0x58')](_0xa8dd('0x59'),''),_0xbee158['id'])});break;default:logger[_0xa8dd('0x5a')]('[OUTBOUND]',_0xa8dd('0x5b'));}}})[_0xa8dd('0x5c')](function(_0x695d26){logger[_0xa8dd('0x5a')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xa8dd('0x5d')](_0x695d26,{'showHidden':!![],'depth':null}));});};exports[_0xa8dd('0x66')]=function(_0x405ef7,_0x3cb305,_0x10da47,_0x403f1b,_0x5ac6a6,_0x34e387){var _0x25e29d,_0x2530c4;_0x34e387[_0xa8dd('0xf')]=intUtil['stripTrailingSlash'](_0x34e387[_0xa8dd('0xf')]);_0x34e387[_0xa8dd('0x47')]=intUtil[_0xa8dd('0x46')](_0x34e387[_0xa8dd('0x47')]);if(_0x5ac6a6&&_0x5ac6a6['monitor_format']){logger[_0xa8dd('0xd')]('['+_0x3cb305[_0xa8dd('0x67')][_0xa8dd('0x68')]()+']','Recording\x20is\x20enabled!');_0x3cb305['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34e387[_0xa8dd('0x47')],_0x3cb305['uniqueid'],md5(_0x3cb305[_0xa8dd('0x4b')]));}else{_0x3cb305[_0xa8dd('0x4c')]='';}headers['Authorization']=getAuth(_0x34e387);return getUser(_0x34e387)[_0xa8dd('0x17')](function(_0x3e2162){_0x25e29d=_0x3e2162;logger[_0xa8dd('0xd')](_0xa8dd('0x61'),_0x25e29d['id']);return getEndUser(_0x34e387,_0x3cb305['calleridname'],_0x3cb305['calleridnum']);})[_0xa8dd('0x17')](function(_0x14ca0a){_0x2530c4=_0x14ca0a;logger[_0xa8dd('0xd')]('The\x20Enduser\x20ID\x20is:',_0x2530c4['id']);return getTicket(_0x34e387,_0x25e29d,_0x2530c4,_0x10da47,_0x3cb305);})['then'](function(_0x40ef1e){if(_0x40ef1e){logger[_0xa8dd('0xd')](_0xa8dd('0x52'),_0x40ef1e['id']);}})['catch'](function(_0x41d8d9){logger[_0xa8dd('0x5a')]('['+_0x3cb305[_0xa8dd('0x67')][_0xa8dd('0x68')]()+']'+_0xa8dd('0x69'),util[_0xa8dd('0x5d')](_0x41d8d9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x478b=['error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','util','ioredis','./util','../../../../config/environment','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','ticket','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','filter','end-user','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','base64','debug','stringify','map','forEach','includes','picklist','nameField','content','toString','string','type','customField','custom_fields','push','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2'];(function(_0x4b667f,_0x28750b){var _0xc2dd0a=function(_0x47195f){while(--_0x47195f){_0x4b667f['push'](_0x4b667f['shift']());}};_0xc2dd0a(++_0x28750b);}(_0x478b,0x1b1));var _0xb478=function(_0x4f3db7,_0x1cf338){_0x4f3db7=_0x4f3db7-0x0;var _0x11a76a=_0x478b[_0x4f3db7];return _0x11a76a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xb478('0x0'));var Redis=require(_0xb478('0x1'));var intUtil=require(_0xb478('0x2'));var config=require(_0xb478('0x3'));var logger=require('../../../../config/logger')(_0xb478('0x4'));config['redis']=_['defaults'](config[_0xb478('0x5')],{'host':_0xb478('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb478('0x5')]));function emit(_0xb0ac9f,_0x4b6b6f,_0xdbb58e){io['to'](_0xb0ac9f)[_0xb478('0x7')](_0x4b6b6f,_0xdbb58e);}var headers={'Content-Type':'application/json','Accept':_0xb478('0x8')};function getTicket(_0x4f56dc,_0x23244a,_0x37ab2c,_0x29c68b,_0x3701b2){logger[_0xb478('0x9')](_0xb478('0xa'));return request({'uri':util[_0xb478('0xb')]('%s/tickets.json',_0x4f56dc[_0xb478('0xc')]),'method':_0xb478('0xd'),'body':{'ticket':_[_0xb478('0xe')]({'requester_id':_0x37ab2c['id'],'submitter_id':_0x23244a?_0x23244a['id']:undefined,'assignee_id':_0x23244a?_0x23244a['id']:undefined,'tags':getTags(_0x29c68b[_0xb478('0xf')],_0xb478('0x10')),'subject':intUtil[_0xb478('0x11')](_0x29c68b[_0xb478('0x12')],_0x3701b2,'\x20'),'description':intUtil[_0xb478('0x11')](_0x29c68b['Descriptions'],_0x3701b2,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb478('0x11')](_0x29c68b[_0xb478('0x13')],_0x3701b2,'\x0a')}},getCustomFields(_0x29c68b['Fields'],_0x3701b2))}})[_0xb478('0x14')](function(_0x39006c){logger['info']('Ticket\x20created!');return _0x39006c[_0xb478('0x15')];});}function getUser(_0x524ee4,_0x143797){if(intUtil['validateEmail'](_0x143797)){logger[_0xb478('0x9')]('Getting\x20agent\x20with\x20email',_0x143797);return request({'uri':util['format'](_0xb478('0x16'),_0x524ee4[_0xb478('0xc')]),'qs':{'query':util['format'](_0xb478('0x17'),_0x143797)}})[_0xb478('0x14')](function(_0x148e67){if(_0x148e67['count']){logger[_0xb478('0x9')](_0xb478('0x18'));return _[_0xb478('0x19')](_0x148e67[_0xb478('0x1a')],{'email':_0x143797,'role':_0xb478('0x1b')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb478('0xb')](_0xb478('0x1c'),_0x524ee4['remoteUri'])})[_0xb478('0x14')](function(_0x1e3cfd){logger[_0xb478('0x9')](_0xb478('0x1d'));return _0x1e3cfd[_0xb478('0x1e')];});}});}else{logger[_0xb478('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb478('0xb')](_0xb478('0x1c'),_0x524ee4[_0xb478('0xc')])})[_0xb478('0x14')](function(_0x278e1c){logger[_0xb478('0x9')](_0xb478('0x1d'));return _0x278e1c['user'];});}}function getEndUser(_0x474dda,_0x41ac9f,_0x273e9a){logger[_0xb478('0x9')]('Searching\x20enduser\x20with\x20phone',_0x273e9a);return request({'uri':util['format'](_0xb478('0x16'),_0x474dda[_0xb478('0xc')]),'qs':{'query':util[_0xb478('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x273e9a)}})[_0xb478('0x14')](function(_0x723178){var _0x4b58f5;if(_0x723178[_0xb478('0x1a')]['length']){_0x723178['results']=_[_0xb478('0x1f')](_0x723178[_0xb478('0x1a')],{'suspended':![],'role':_0xb478('0x20')});if(_0x723178[_0xb478('0x1a')][_0xb478('0x21')]){_0x4b58f5=_['first'](_0x723178[_0xb478('0x1a')]);}}if(_0x4b58f5){logger[_0xb478('0x9')]('Enduser\x20found!');return _0x4b58f5;}else{logger[_0xb478('0x9')](_0xb478('0x22'));return request({'uri':util[_0xb478('0xb')](_0xb478('0x23'),_0x474dda[_0xb478('0xc')]),'method':_0xb478('0xd'),'body':{'user':{'role':_0xb478('0x20'),'name':util['format'](_0xb478('0x24'),_0x41ac9f||_0x273e9a),'phone':_0x273e9a}}})['then'](function(_0x2c3e2a){logger[_0xb478('0x9')](_0xb478('0x25'));return _0x2c3e2a[_0xb478('0x1e')];});}});}function getAuth(_0x4a4e96){var _0x507e43;if(_0x4a4e96[_0xb478('0x26')]===_0xb478('0x27')){_0x507e43=util['format'](_0xb478('0x28'),_0x4a4e96[_0xb478('0x29')],_0x4a4e96['password']);}else if(_0x4a4e96[_0xb478('0x26')]===_0xb478('0x2a')){_0x507e43=util[_0xb478('0xb')]('%s/token:%s',_0x4a4e96[_0xb478('0x29')],_0x4a4e96['token']);}return util['format'](_0xb478('0x2b'),new Buffer(_0x507e43)['toString'](_0xb478('0x2c')));}function request(_0x90a02d){logger[_0xb478('0x2d')]('[HTTP]',JSON[_0xb478('0x2e')](_0x90a02d));return rp(_['defaults'](_0x90a02d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4d572f,_0x1e0477){var _0x55095a=[];if(_0x4d572f&&_0x4d572f['length']>0x0){_0x55095a=_[_0xb478('0x2f')](_0x4d572f,_0x1e0477);}return _0x55095a;}function getCustomFields(_0xec40e5,_0x2d9da9){var _0xb435d8=[];var _0x3f1342={'custom_fields':[]};if(_0xec40e5['length']>0x0){_[_0xb478('0x30')](_0xec40e5,function(_0x3840fa){if(_[_0xb478('0x31')](['string',_0xb478('0x32')],_0x3840fa['type'])&&_0x3840fa[_0xb478('0x33')]&&!_0x3840fa['customField']){_0x3f1342[_0x3840fa[_0xb478('0x33')]['toLowerCase']()]=_0x3840fa[_0xb478('0x34')][_0xb478('0x35')]();}else if(_[_0xb478('0x31')]([_0xb478('0x36'),'picklist'],_0x3840fa[_0xb478('0x37')])&&_0x3840fa['idField']&&_0x3840fa[_0xb478('0x38')]){_0x3f1342[_0xb478('0x39')][_0xb478('0x3a')]({'id':_0x3840fa[_0xb478('0x3b')],'value':_0x3840fa['content'][_0xb478('0x35')]()});}else if(_0x3840fa[_0xb478('0x37')]===_0xb478('0x3c')&&_0x3840fa[_0xb478('0x3d')]&&_0x3840fa[_0xb478('0x3b')]&&_0x3840fa[_0xb478('0x38')]){_0x2d9da9[_0x3840fa['variableName']]&&_0x3f1342[_0xb478('0x39')][_0xb478('0x3a')]({'id':_0x3840fa[_0xb478('0x3b')],'value':_0x2d9da9[_0x3840fa[_0xb478('0x3d')]]['toString']()});}else if(_0x3840fa[_0xb478('0x37')]===_0xb478('0x3e')&&_0x3840fa['Variable']&&_0x3840fa['Variable'][_0xb478('0x10')]&&_0x3840fa['idField']&&_0x3840fa[_0xb478('0x38')]){_0x2d9da9[_0x3840fa[_0xb478('0x3f')]['name']['toLowerCase']()]&&_0x3f1342['custom_fields']['push']({'id':_0x3840fa[_0xb478('0x3b')],'value':_0x2d9da9[_0x3840fa[_0xb478('0x3f')]['name'][_0xb478('0x40')]()][_0xb478('0x35')]()});}});}return _0x3f1342;}exports[_0xb478('0x41')]=function(_0x16c8ac,_0x3e7604,_0x38388a,_0x21b341,_0x1b74cd,_0x5aa111){var _0x5010e5,_0xf05cfb;_0x5aa111[_0xb478('0xc')]=intUtil['stripTrailingSlash'](_0x5aa111[_0xb478('0xc')]);_0x5aa111[_0xb478('0x42')]=intUtil[_0xb478('0x43')](_0x5aa111[_0xb478('0x42')]);if(_0x1b74cd&&_0x1b74cd['monitor_format']){logger[_0xb478('0x9')](_0xb478('0x44'),_0xb478('0x45'));_0x3e7604['recordingURL']=util[_0xb478('0xb')](_0xb478('0x46'),_0x5aa111[_0xb478('0x42')],_0x3e7604[_0xb478('0x47')],md5(_0x3e7604[_0xb478('0x47')]));}else{_0x3e7604[_0xb478('0x48')]='';}headers[_0xb478('0x49')]=getAuth(_0x5aa111);return getUser(_0x5aa111,_0x21b341[_0xb478('0x4a')])['then'](function(_0x24d111){_0x5010e5=_0x24d111;logger[_0xb478('0x9')]('The\x20User\x20ID\x20is:',_0x5010e5['id']);return getEndUser(_0x5aa111,_0x3e7604['calleridname'],_0x3e7604['calleridnum']);})[_0xb478('0x14')](function(_0x4caf8c){_0xf05cfb=_0x4caf8c;logger[_0xb478('0x9')]('The\x20Enduser\x20ID\x20is:',_0xf05cfb['id']);return getTicket(_0x5aa111,_0x5010e5,_0xf05cfb,_0x38388a,_0x3e7604);})['then'](function(_0x341dc8){if(_0x341dc8){logger[_0xb478('0x9')]('The\x20Ticket\x20ID\x20is:',_0x341dc8['id']);switch(_0x5aa111[_0xb478('0x37')]){case _0xb478('0x4b'):logger[_0xb478('0x9')](_0xb478('0x44'),_0xb478('0x4c'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5aa111[_0xb478('0xc')],_0x5010e5['id'],_0x341dc8['id']),'method':_0xb478('0xd')});case _0xb478('0x4d'):logger['info'](_0xb478('0x44'),_0xb478('0x4e'));emit(util[_0xb478('0xb')]('user:%s',_0x21b341[_0xb478('0x10')]),_0xb478('0x4f'),{'uri':util[_0xb478('0xb')]('%s/agent/tickets/%s',_0x5aa111[_0xb478('0xc')][_0xb478('0x50')](_0xb478('0x51'),''),_0x341dc8['id'])});break;default:logger[_0xb478('0x52')](_0xb478('0x44'),_0xb478('0x53'));}}})[_0xb478('0x54')](function(_0x218dff){logger[_0xb478('0x52')](_0xb478('0x55'),util[_0xb478('0x56')](_0x218dff,{'showHidden':!![],'depth':null}));});};exports[_0xb478('0x57')]=function(_0x3da489,_0x5d8165,_0x706457,_0x510e6f,_0x338d94,_0x5083dc,_0x4d69bd){var _0xa6eb04,_0x55d179;_0x5083dc[_0xb478('0xc')]=intUtil[_0xb478('0x43')](_0x5083dc[_0xb478('0xc')]);_0x5083dc[_0xb478('0x42')]=intUtil['stripTrailingSlash'](_0x5083dc['serverUrl']);if(_0x4d69bd&&_0x4d69bd[_0xb478('0x58')]&&_0x4d69bd['recordingFormat']!==_0xb478('0x59')){logger[_0xb478('0x9')](_0xb478('0x5a'),_0xb478('0x45'));_0x5d8165[_0xb478('0x48')]=util[_0xb478('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5083dc[_0xb478('0x42')],_0x5d8165[_0xb478('0x47')],md5(_0x5d8165[_0xb478('0x47')]));}headers[_0xb478('0x49')]=getAuth(_0x5083dc);return getUser(_0x5083dc,_0x510e6f[_0xb478('0x4a')])['then'](function(_0x502323){_0xa6eb04=_0x502323;logger[_0xb478('0x9')](_0xb478('0x5b'),_0xa6eb04['id']);return getEndUser(_0x5083dc,_0x5d8165['destcalleridname'],_0x5d8165['destcalleridnum']);})['then'](function(_0x53511d){_0x55d179=_0x53511d;logger[_0xb478('0x9')](_0xb478('0x5c'),_0x55d179['id']);return getTicket(_0x5083dc,_0xa6eb04,_0x55d179,_0x706457,_0x5d8165);})[_0xb478('0x14')](function(_0x3e6f4b){if(_0x3e6f4b){logger[_0xb478('0x9')](_0xb478('0x5d'),_0x3e6f4b['id']);switch(_0x5083dc[_0xb478('0x37')]){case'integrationTab':logger[_0xb478('0x9')]('[OUTBOUND]',_0xb478('0x4c'));return request({'uri':util[_0xb478('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5083dc[_0xb478('0xc')],_0xa6eb04['id'],_0x3e6f4b['id']),'method':_0xb478('0xd')});case _0xb478('0x4d'):logger['info'](_0xb478('0x5a'),_0xb478('0x4e'));emit(util[_0xb478('0xb')](_0xb478('0x5e'),_0x510e6f[_0xb478('0x10')]),_0xb478('0x4f'),{'uri':util['format'](_0xb478('0x5f'),_0x5083dc[_0xb478('0xc')][_0xb478('0x50')](_0xb478('0x51'),''),_0x3e6f4b['id'])});break;default:logger['error'](_0xb478('0x5a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x104686){logger[_0xb478('0x52')](_0xb478('0x60'),util[_0xb478('0x56')](_0x104686,{'showHidden':!![],'depth':null}));});};exports[_0xb478('0x61')]=function(_0x1bd46d,_0xb228bb,_0x3f06e1,_0x44c74b,_0x40ed21,_0x730d05){var _0x237b28,_0x260abd;_0x730d05[_0xb478('0xc')]=intUtil[_0xb478('0x43')](_0x730d05['remoteUri']);_0x730d05['serverUrl']=intUtil['stripTrailingSlash'](_0x730d05[_0xb478('0x42')]);if(_0x40ed21&&_0x40ed21['monitor_format']){logger[_0xb478('0x9')]('['+_0xb228bb[_0xb478('0x62')][_0xb478('0x63')]()+']','Recording\x20is\x20enabled!');_0xb228bb['recordingURL']=util[_0xb478('0xb')](_0xb478('0x46'),_0x730d05['serverUrl'],_0xb228bb[_0xb478('0x47')],md5(_0xb228bb[_0xb478('0x47')]));}else{_0xb228bb[_0xb478('0x48')]='';}headers[_0xb478('0x49')]=getAuth(_0x730d05);return getUser(_0x730d05)[_0xb478('0x14')](function(_0x4e2393){_0x237b28=_0x4e2393;logger[_0xb478('0x9')](_0xb478('0x5b'),_0x237b28['id']);return getEndUser(_0x730d05,_0xb228bb[_0xb478('0x64')],_0xb228bb[_0xb478('0x65')]);})[_0xb478('0x14')](function(_0x3161a9){_0x260abd=_0x3161a9;logger[_0xb478('0x9')](_0xb478('0x5c'),_0x260abd['id']);return getTicket(_0x730d05,_0x237b28,_0x260abd,_0x3f06e1,_0xb228bb);})['then'](function(_0x41f81c){if(_0x41f81c){logger[_0xb478('0x9')]('The\x20Ticket\x20ID\x20is:',_0x41f81c['id']);}})[_0xb478('0x54')](function(_0x4a1d78){logger['error']('['+_0xb228bb[_0xb478('0x62')][_0xb478('0x63')]()+']'+_0xb478('0x66'),util[_0xb478('0x56')](_0x4a1d78,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index fc5ca92..301ec89 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 _0x1cde=['agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','toUpperCase','com','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','type','content','toString','variable','variableName','Variable','idField','toLowerCase','indexOf','split','isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','name','Administrator','user','profile','The\x20failing\x20result\x20is','data','https://www.zohoapis.','startCase','role','last_name','enduserType','moduleCreate','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','Contacts','nothing','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Leads','What_Id','Last_Name','$se_module','talktime','utc','mm:ss','answertime','Call_Duration','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','Answered','abandoned','timeout','Timeout'];(function(_0x2ec8f2,_0x2f7f44){var _0x140e81=function(_0x221252){while(--_0x221252){_0x2ec8f2['push'](_0x2ec8f2['shift']());}};_0x140e81(++_0x2f7f44);}(_0x1cde,0x1e7));var _0xe1cd=function(_0xef5fea,_0x2b1285){_0xef5fea=_0xef5fea-0x0;var _0x2f8561=_0x1cde[_0xef5fea];return _0x2f8561;};'use strict';var _=require(_0xe1cd('0x0'));var rp=require(_0xe1cd('0x1'));var md5=require(_0xe1cd('0x2'));var util=require('util');var intUtil=require(_0xe1cd('0x3'));var moment=require(_0xe1cd('0x4'));var Redis=require(_0xe1cd('0x5'));var BPromise=require(_0xe1cd('0x6'));var config=require(_0xe1cd('0x7'));var logger=require(_0xe1cd('0x8'))(_0xe1cd('0x9'));config[_0xe1cd('0xa')]=_[_0xe1cd('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe1cd('0xc'))(new Redis(config[_0xe1cd('0xa')]));function emit(_0x23006e,_0x1fd4cd,_0x27a4bf){io['to'](_0x23006e)[_0xe1cd('0xd')](_0x1fd4cd,_0x27a4bf);}function request(_0x267f96){logger[_0xe1cd('0xe')](_0xe1cd('0xf'),JSON[_0xe1cd('0x10')](_0x267f96));return rp(_0x267f96);}function getCustomFields(_0x412bc5,_0x3b84e1){var _0x94c965={};if(_0x412bc5[_0xe1cd('0x11')]>0x0){_[_0xe1cd('0x12')](_0x412bc5,function(_0x1ee593){if(_[_0xe1cd('0x13')](['string','picklist'],_0x1ee593[_0xe1cd('0x14')])&&_0x1ee593['idField']){_0x94c965[_0x1ee593['idField']]=_0x1ee593[_0xe1cd('0x15')][_0xe1cd('0x16')]();}else if(_0x1ee593['type']===_0xe1cd('0x17')&&_0x1ee593[_0xe1cd('0x18')]&&_0x1ee593['idField']&&_0x3b84e1[_0x1ee593[_0xe1cd('0x18')]]){_0x94c965[_0x1ee593['idField']]=_0x3b84e1[_0x1ee593[_0xe1cd('0x18')]][_0xe1cd('0x16')]();}else if(_0x1ee593[_0xe1cd('0x14')]==='customVariable'&&_0x1ee593[_0xe1cd('0x19')]&&_0x1ee593[_0xe1cd('0x19')]['name']&&_0x1ee593[_0xe1cd('0x1a')]&&_0x3b84e1[_0x1ee593[_0xe1cd('0x19')]['name'][_0xe1cd('0x1b')]()]){_0x94c965[_0x1ee593[_0xe1cd('0x1a')]]=_0x3b84e1[_0x1ee593[_0xe1cd('0x19')]['name'][_0xe1cd('0x1b')]()][_0xe1cd('0x16')]();}});}return _0x94c965;}function getName(_0x2d6b6f){if(_0x2d6b6f[_0xe1cd('0x1c')]('\x20')>0x0){var _0x501183=_0x2d6b6f[_0xe1cd('0x1d')](/ (.+)/);if(_0x501183[0x1]){return _0x501183;}}return[_0x2d6b6f,_0x2d6b6f];}var accountsTokens={};function getAccessToken(_0x1c8b93){return new Promise(function(_0x4f9ada,_0x476cba){if(!_[_0xe1cd('0x1e')](accountsTokens[_0x1c8b93['id']])&&!_[_0xe1cd('0x1e')](accountsTokens[_0x1c8b93['id']][_0xe1cd('0x1f')])){if(moment()[_0xe1cd('0x20')](accountsTokens[_0x1c8b93['id']]['expires_in'])){_0x4f9ada(accountsTokens[_0x1c8b93['id']][_0xe1cd('0x1f')]);}}var _0x3b5a6f;switch(_0x1c8b93['zone']){case'US':_0x3b5a6f=_0xe1cd('0x21');break;case'AU':_0x3b5a6f=_0xe1cd('0x22');break;case'EU':_0x3b5a6f=_0xe1cd('0x23');break;case'IN':_0x3b5a6f='https://accounts.zoho.in';break;case'CN':_0x3b5a6f=_0xe1cd('0x24');break;default:_0x3b5a6f='https://accounts.zoho.eu';break;}var _0x55cd8f={'method':_0xe1cd('0x25'),'uri':_0x3b5a6f+_0xe1cd('0x26'),'qs':{'refresh_token':_0x1c8b93['refreshToken'],'client_id':_0x1c8b93['clientId'],'client_secret':_0x1c8b93[_0xe1cd('0x27')],'grant_type':_0xe1cd('0x28')},'json':!![]};return rp(_0x55cd8f)[_0xe1cd('0x29')](function(_0x49cfc3){accountsTokens[_0x1c8b93['id']]={'access_token':_0x49cfc3['access_token'],'expires_in':moment()[_0xe1cd('0x2a')](_0x49cfc3['expires_in'],_0xe1cd('0x2b'))};_0x4f9ada(_0x49cfc3[_0xe1cd('0x1f')]);})[_0xe1cd('0x2c')](function(_0x57c5f5){logger[_0xe1cd('0x2d')](_0xe1cd('0x2e'),_0x57c5f5[_0xe1cd('0x2f')]);_0x476cba(_0x57c5f5);});});}function getUser(_0x440a17,_0x5a802a,_0x27dc9b,_0x53bc31){logger[_0xe1cd('0x30')]('Search\x20user');return request({'method':_0xe1cd('0x31'),'uri':util[_0xe1cd('0x32')](_0xe1cd('0x33'),_0x5a802a),'qs':{'type':_0xe1cd('0x34')},'headers':{'Authorization':_0xe1cd('0x35')+_0x440a17},'json':!![]})['then'](function(_0x585296){if(_0x585296[_0xe1cd('0x36')]){var _0x55765=-0x1;if(_[_0xe1cd('0x37')](_0x585296[_0xe1cd('0x36')])){if(!_['isNil'](_0x53bc31)){_0x55765=_[_0xe1cd('0x38')](_0x585296['users'],function(_0x9545e8){return _0x9545e8[_0xe1cd('0x39')]===_0x53bc31;});}if(_0x55765>=0x0){logger[_0xe1cd('0x30')]('Agent\x20found!');}else{logger[_0xe1cd('0x30')](_0xe1cd('0x3a'));_0x55765=_[_0xe1cd('0x38')](_0x585296[_0xe1cd('0x36')],function(_0x193e0d){return _0x193e0d['profile'][_0xe1cd('0x3b')]===_0xe1cd('0x3c');});}return _0x585296['users'][_0x55765];}else{if(_0x585296[_0xe1cd('0x3d')][_0xe1cd('0x3e')]['name']===_0xe1cd('0x3c')){logger[_0xe1cd('0x30')](_0xe1cd('0x3a'));user=_0x585296[_0xe1cd('0x3d')];return user;}else{logger[_0xe1cd('0x2d')]('The\x20failing\x20result\x20is',JSON[_0xe1cd('0x10')](_0x585296));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xe1cd('0x10')](_0x585296));}}}else{logger[_0xe1cd('0x2d')](_0xe1cd('0x3f'),JSON[_0xe1cd('0x10')](_0x585296));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xe1cd('0x10')](_0x585296));}})[_0xe1cd('0x2c')](function(_0x372449){console[_0xe1cd('0x2d')](_0x372449);});}function getZohoUser(_0x22028a,_0x57bc88){return new BPromise(function(_0x380f33,_0x5b857b){request(_0x22028a)['then'](function(_0x59c304){var _0x386c14=null;if(_0x59c304){_0x386c14=_0x59c304[_0xe1cd('0x40')][0x0];_0x386c14['enduserType']=_0x57bc88;}_0x380f33(_0x386c14);})[_0xe1cd('0x2c')](function(_0x3a3ca0){_0x5b857b(_0x3a3ca0);});});}function createEndUser(_0x3c8f3b,_0x22dd08,_0x13c688,_0x599bb4,_0x35165a,_0x3a2938){var _0x13c688=getName(_0x13c688);return request({'method':_0xe1cd('0x25'),'uri':_0xe1cd('0x41')+_0x22dd08+'/crm/v2/'+_[_0xe1cd('0x42')](_0x3a2938['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x13c688[0x1],'First_Name':_0x13c688[0x0],'Phone':_0x599bb4,'Owner':{'name':!_['isNil'](_0x35165a[_0xe1cd('0x43')][_0xe1cd('0x3b')])?_0x35165a[_0xe1cd('0x43')]['name']:!_[_0xe1cd('0x1e')](_0x35165a['first_name'])?_0x35165a['first_name']+'\x20'+_0x35165a[_0xe1cd('0x44')]:_0x35165a[_0xe1cd('0x44')],'id':_0x35165a['id']}}]},'headers':{'Authorization':_0xe1cd('0x35')+_0x3c8f3b},'json':!![]})['then'](function(_0x2e90d0){if(_0x2e90d0&&_0x2e90d0['data'][0x0]['code']==='SUCCESS'){var _0x5b6080=_0x2e90d0['data'][0x0]['details'];_0x5b6080[_0xe1cd('0x45')]=_[_0xe1cd('0x42')](_0x3a2938[_0xe1cd('0x46')])+'s';return _0x5b6080;}logger[_0xe1cd('0x2d')](_0xe1cd('0x3f'),JSON['stringify'](data));throw new Error(_0xe1cd('0x47')+JSON[_0xe1cd('0x10')](data));})['catch'](function(_0x432eac){console[_0xe1cd('0x48')](_0xe1cd('0x49'),_0x432eac);});}function getEndUser(_0x94d093,_0x51efe6,_0xd664ab,_0x5ebe69,_0x514afa,_0x2dc18e,_0x15d53c){var _0x4c04a8={'method':_0xe1cd('0x31'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x94d093},'json':!![]};switch(_0x15d53c['moduleSearch']){case _0xe1cd('0x4a'):_0x4c04a8[_0xe1cd('0x4b')]=_0xe1cd('0x41')+_0x51efe6+_0xe1cd('0x4c')+_0x514afa+'))';return getZohoUser(_0x4c04a8,'Contacts')[_0xe1cd('0x29')](function(_0xbbb64){if(_0xbbb64)return _0xbbb64;_0x4c04a8['uri']=_0xe1cd('0x41')+_0x51efe6+_0xe1cd('0x4d')+_0x514afa+'))';return getZohoUser(_0x4c04a8,'Leads')[_0xe1cd('0x29')](function(_0x3539a2){if(_0x3539a2)return _0x3539a2;if(_0x15d53c[_0xe1cd('0x46')]!='nothing'){return createEndUser(_0x94d093,_0x51efe6,_0x5ebe69,_0x514afa,_0x2dc18e,_0x15d53c);}else{return{};}});});break;case _0xe1cd('0x4e'):_0x4c04a8[_0xe1cd('0x4b')]='https://www.zohoapis.'+_0x51efe6+_0xe1cd('0x4c')+_0x514afa+'))';return getZohoUser(_0x4c04a8,_0xe1cd('0x4f'))[_0xe1cd('0x29')](function(_0x30a92b){if(_0x30a92b)return _0x30a92b;if(_0x15d53c[_0xe1cd('0x46')]!=_0xe1cd('0x50')){return createEndUser(_0x94d093,_0x51efe6,_0x5ebe69,_0x514afa,_0x2dc18e,_0x15d53c);}else{return{};}});break;case'lead':_0x4c04a8[_0xe1cd('0x4b')]='https://www.zohoapis.'+_0x51efe6+_0xe1cd('0x4d')+_0x514afa+'))';return getZohoUser(_0x4c04a8,'Leads')['then'](function(_0x16f378){if(_0x16f378)return _0x16f378;if(_0x15d53c[_0xe1cd('0x46')]!=_0xe1cd('0x50')){return createEndUser(_0x94d093,_0x51efe6,_0x5ebe69,_0x514afa,_0x2dc18e,_0x15d53c);}else{return{};}});break;}}function getCall(_0x3758ce,_0x110b98,_0x3d3c51,_0x2d61f4,_0x20cb53,_0x353fe2,_0x3c8423,_0xfb67fd){logger[_0xe1cd('0x30')](_0xe1cd('0x51'));var _0x3706d3={};_0x3706d3[_0xe1cd('0x52')]={'name':!_['isNil'](_0x2d61f4[_0xe1cd('0x43')][_0xe1cd('0x3b')])&&!_[_0xe1cd('0x1e')](_0x2d61f4[_0xe1cd('0x3e')][_0xe1cd('0x3b')])&&_0x2d61f4[_0xe1cd('0x3e')][_0xe1cd('0x3b')]===_0xe1cd('0x53')?_0x2d61f4['role'][_0xe1cd('0x3b')]:!_[_0xe1cd('0x1e')](_0x2d61f4[_0xe1cd('0x54')])?_0x2d61f4[_0xe1cd('0x54')]+'\x20'+_0x2d61f4[_0xe1cd('0x44')]:_0x2d61f4[_0xe1cd('0x44')],'id':_0x2d61f4['id']};_0x3706d3[_0xe1cd('0x55')]=intUtil[_0xe1cd('0x56')](_0x353fe2['Subjects'],_0x3c8423,'\x20');_0x3706d3['Description']=intUtil[_0xe1cd('0x56')](_0x353fe2[_0xe1cd('0x57')],_0x3c8423,'\x0a');if(_0x20cb53['enduserType']===_0xe1cd('0x4f')){_0x3706d3[_0xe1cd('0x58')]={'name':!_['isNil'](_0x20cb53[_0xe1cd('0x59')])?_0x20cb53[_0xe1cd('0x59')]:!_[_0xe1cd('0x1e')](_0x20cb53[_0xe1cd('0x5a')])?_0x20cb53['First_Name']+'\x20'+_0x20cb53['Last_Name']:_0x20cb53['Last_Name'],'id':_0x20cb53['id']};}if(_0x20cb53[_0xe1cd('0x45')]===_0xe1cd('0x5b')){_0x3706d3[_0xe1cd('0x5c')]={'name':!_['isNil'](_0x20cb53[_0xe1cd('0x59')])?_0x20cb53['Full_Name']:!_[_0xe1cd('0x1e')](_0x20cb53[_0xe1cd('0x5a')])?_0x20cb53['First_Name']+'\x20'+_0x20cb53['Last_Name']:_0x20cb53[_0xe1cd('0x5d')],'id':_0x20cb53['id']};_0x3706d3[_0xe1cd('0x5e')]=_['startCase'](_0x20cb53[_0xe1cd('0x45')]);}if(_0x3c8423[_0xe1cd('0x5f')]){_0x3706d3['Call_Duration']=moment[_0xe1cd('0x60')](parseInt(_0x3c8423[_0xe1cd('0x5f')])*0x3e8)[_0xe1cd('0x32')](_0xe1cd('0x61'));}else if(_0x3c8423[_0xe1cd('0x62')]&&_0x3c8423['endtime']){_0x3706d3[_0xe1cd('0x63')]=moment[_0xe1cd('0x60')](moment(_0x3c8423[_0xe1cd('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xe1cd('0x65')](moment(_0x3c8423[_0xe1cd('0x66')],_0xe1cd('0x67'))))[_0xe1cd('0x32')](_0xe1cd('0x61'));}switch(_0x3c8423[_0xe1cd('0x68')]){case _0xe1cd('0x69'):_0x3706d3[_0xe1cd('0x6a')]=_0xe1cd('0x6b');break;case _0xe1cd('0x6c'):case'connect':_0x3706d3[_0xe1cd('0x6a')]=_0xe1cd('0x6d');break;case'rejected':_0x3706d3['Call_Result']='Rejected';break;case _0xe1cd('0x6e'):_0x3706d3[_0xe1cd('0x6a')]='Abandoned';break;case _0xe1cd('0x6f'):_0x3706d3[_0xe1cd('0x6a')]=_0xe1cd('0x70');default:}_0x3706d3['Call_Start_Time']=(_0xfb67fd==='outbound'?moment(_0x3c8423[_0xe1cd('0x66')])[_0xe1cd('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3c8423[_0xe1cd('0x71')])[_0xe1cd('0x32')](_0xe1cd('0x67')))||moment()[_0xe1cd('0x32')](_0xe1cd('0x67'));_0x3706d3[_0xe1cd('0x72')]=_0xfb67fd||_0xe1cd('0x73');_0x3706d3=_[_0xe1cd('0x74')](_0x3706d3,getCustomFields(_0x353fe2['Fields'],_0x3c8423));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x110b98+_0xe1cd('0x75'),'headers':{'Authorization':_0xe1cd('0x35')+_0x3758ce},'body':{'data':[_0x3706d3]},'json':!![]})[_0xe1cd('0x29')](function(_0x27e385){if(_0x27e385&&_0x27e385[_0xe1cd('0x40')][0x0]['code']==='SUCCESS'){logger['info'](_0xe1cd('0x76'));return{'id':_0x27e385['data'][0x0][_0xe1cd('0x77')]['id']};}})[_0xe1cd('0x2c')](function(_0x3a3ec0){logger['info'](_0xe1cd('0x78'),_0x3a3ec0[_0xe1cd('0x2f')]);console[_0xe1cd('0x48')](_0xe1cd('0x78'),_0x3a3ec0);});}exports[_0xe1cd('0x79')]=function(_0x3b0a92,_0x4b6801,_0x40b0f2,_0x3f6b5a,_0x306c4b,_0x4b20a1){var _0x468a91,_0x1b7000,_0x3ce337;_0x4b20a1[_0xe1cd('0x7a')]=intUtil[_0xe1cd('0x7b')](_0x4b20a1[_0xe1cd('0x7a')]);_0x4b20a1[_0xe1cd('0x7c')]=intUtil[_0xe1cd('0x7b')](_0x4b20a1[_0xe1cd('0x7c')]);if(_0x306c4b&&_0x306c4b['monitor_format']){logger['info'](_0xe1cd('0x7d'),_0xe1cd('0x7e'));_0x4b6801[_0xe1cd('0x7f')]=_0x4b20a1[_0xe1cd('0x7c')]+'/api/voice/recordings/'+_0x4b6801[_0xe1cd('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x4b6801['uniqueid']);}else{_0x4b6801['recordingURL']='';}var _0x49fb5f=_0x4b20a1['host']===_0xe1cd('0x81')?'eu':'com';return getAccessToken(_0x4b20a1)['then'](function(_0xa69360){_0x3ce337=_0xa69360;return getUser(_0x3ce337,_0x49fb5f,_0x4b20a1,_0x3f6b5a['email']);})[_0xe1cd('0x29')](function(_0x14f56e){_0x468a91=_0x14f56e;logger[_0xe1cd('0x30')]('The\x20User\x20ID\x20is:',_0x468a91['id']);return getEndUser(_0x3ce337,_0x49fb5f,_0x4b20a1,_0x4b6801[_0xe1cd('0x82')],_0x4b6801[_0xe1cd('0x83')],_0x468a91,_0x40b0f2);})[_0xe1cd('0x29')](function(_0x142346){_0x1b7000=_0x142346;return getCall(_0x3ce337,_0x49fb5f,_0x4b20a1,_0x468a91,_0x1b7000,_0x40b0f2,_0x4b6801,'Inbound');})[_0xe1cd('0x29')](function(_0x3288ff){if(_0x3288ff){logger[_0xe1cd('0x30')](_0xe1cd('0x84'),_0x3288ff['id']);logger[_0xe1cd('0x30')](_0xe1cd('0x7d'),_0xe1cd('0x85'));emit(util[_0xe1cd('0x32')](_0xe1cd('0x86'),_0x3f6b5a[_0xe1cd('0x3b')]),_0xe1cd('0x87'),{'uri':'https://crm.'+_0x4b20a1[_0xe1cd('0x7a')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3288ff['id']});}})[_0xe1cd('0x2c')](function(_0x310e10){logger['error'](_0xe1cd('0x7d'),JSON[_0xe1cd('0x10')](_0x310e10));});};exports[_0xe1cd('0x88')]=function(_0x4ba0f9,_0x3d8a4a,_0x3f363f,_0x465f17,_0x11535b,_0x42148f,_0x248000){var _0x3a208c,_0x73ba10,_0x3a5fad;_0x42148f[_0xe1cd('0x7a')]=intUtil[_0xe1cd('0x7b')](_0x42148f[_0xe1cd('0x7a')]);_0x42148f[_0xe1cd('0x7c')]=intUtil[_0xe1cd('0x7b')](_0x42148f[_0xe1cd('0x7c')]);if(_0x248000&&_0x248000['recordingFormat']&&_0x248000['recordingFormat']!=='none'){logger['info'](_0xe1cd('0x89'),_0xe1cd('0x7e'));_0x3d8a4a[_0xe1cd('0x7f')]=_0x42148f['serverUrl']+_0xe1cd('0x8a')+_0x3d8a4a[_0xe1cd('0x80')]+_0xe1cd('0x8b')+md5(_0x3d8a4a[_0xe1cd('0x80')]);}var _0x593796=_0x42148f[_0xe1cd('0x7a')]===_0xe1cd('0x81')?'eu':'com';return getAccessToken(_0x42148f)[_0xe1cd('0x29')](function(_0xa4dbe){_0x3a5fad=_0xa4dbe;return getUser(_0x3a5fad,_0x593796,_0x42148f,_0x465f17['email']);})[_0xe1cd('0x29')](function(_0x3eaa84){_0x3a208c=_0x3eaa84;logger[_0xe1cd('0x30')](_0xe1cd('0x8c'),_0x3a208c['id']);return getEndUser(_0x3a5fad,_0x593796,_0x42148f,_0x3d8a4a[_0xe1cd('0x8d')],_0x3d8a4a[_0xe1cd('0x8e')],_0x3a208c,_0x3f363f);})['then'](function(_0x9454d9){_0x73ba10=_0x9454d9;return getCall(_0x3a5fad,_0x593796,_0x42148f,_0x3a208c,_0x73ba10,_0x3f363f,_0x3d8a4a,_0xe1cd('0x8f'));})[_0xe1cd('0x29')](function(_0x575967){if(_0x575967){logger[_0xe1cd('0x30')]('The\x20Call\x20ID\x20is:',_0x575967['id']);logger['info'](_0xe1cd('0x89'),_0xe1cd('0x85'));emit(util[_0xe1cd('0x32')](_0xe1cd('0x86'),_0x465f17[_0xe1cd('0x3b')]),_0xe1cd('0x87'),{'uri':_0xe1cd('0x90')+_0x42148f[_0xe1cd('0x7a')]+_0xe1cd('0x91')+_0x575967['id']});}})[_0xe1cd('0x2c')](function(_0x4395d0){logger[_0xe1cd('0x2d')](_0xe1cd('0x89'),JSON[_0xe1cd('0x10')](_0x4395d0));});};exports[_0xe1cd('0x92')]=function(_0x2c0815,_0x54dbde,_0x1fd117,_0x2916fc,_0x187088,_0x506ed4){var _0x42063e,_0x2e15e3,_0x1d88c9;_0x506ed4[_0xe1cd('0x7a')]=intUtil[_0xe1cd('0x7b')](_0x506ed4[_0xe1cd('0x7a')]);_0x506ed4[_0xe1cd('0x7c')]=intUtil['stripTrailingSlash'](_0x506ed4[_0xe1cd('0x7c')]);if(_0x187088&&_0x187088[_0xe1cd('0x93')]){logger[_0xe1cd('0x30')]('['+_0x54dbde[_0xe1cd('0x68')][_0xe1cd('0x94')]()+']','Recording\x20is\x20enabled!');_0x54dbde[_0xe1cd('0x7f')]=_0x506ed4[_0xe1cd('0x7c')]+_0xe1cd('0x8a')+_0x54dbde['uniqueid']+_0xe1cd('0x8b')+md5(_0x54dbde['uniqueid']);}else{_0x54dbde[_0xe1cd('0x7f')]='';}var _0x581843=_0x506ed4[_0xe1cd('0x7a')]==='zoho.eu'?'eu':_0xe1cd('0x95');return getAccessToken(_0x506ed4)['then'](function(_0x20b65d){_0x1d88c9=_0x20b65d;return getUser(_0x1d88c9,_0x581843,_0x506ed4);})[_0xe1cd('0x29')](function(_0x52eb5d){_0x42063e=_0x52eb5d;logger['info'](_0xe1cd('0x8c'),_0x42063e['id']);return getEndUser(_0x1d88c9,_0x581843,_0x506ed4,_0x54dbde[_0xe1cd('0x82')],_0x54dbde[_0xe1cd('0x83')],_0x42063e,_0x1fd117);})[_0xe1cd('0x29')](function(_0xa9f5b4){_0x2e15e3=_0xa9f5b4;return getCall(_0x1d88c9,_0x581843,_0x506ed4,_0x42063e,_0x2e15e3,_0x1fd117,_0x54dbde,_0xe1cd('0x73'));})[_0xe1cd('0x29')](function(_0x1d730a){if(_0x1d730a){logger[_0xe1cd('0x30')](_0xe1cd('0x84'),_0x1d730a['id']);}})['catch'](function(_0x40158e){logger[_0xe1cd('0x2d')]('['+_0x54dbde[_0xe1cd('0x68')][_0xe1cd('0x94')]()+']',JSON[_0xe1cd('0x10')](_0x40158e));});}; \ No newline at end of file +var _0xe3f2=['clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','info','GET','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','format','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Rejected','abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','details','stack','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','none','[OUTBOUND]','zoho.eu','destcalleridname','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','calleridnum','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','zoho','defaults','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','indexOf','split','isNil','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token'];(function(_0x138a81,_0x1e506e){var _0x857750=function(_0x272b2d){while(--_0x272b2d){_0x138a81['push'](_0x138a81['shift']());}};_0x857750(++_0x1e506e);}(_0xe3f2,0x101));var _0x2e3f=function(_0x5258f4,_0x5970d6){_0x5258f4=_0x5258f4-0x0;var _0x5ca2f7=_0xe3f2[_0x5258f4];return _0x5ca2f7;};'use strict';var _=require(_0x2e3f('0x0'));var rp=require(_0x2e3f('0x1'));var md5=require(_0x2e3f('0x2'));var util=require(_0x2e3f('0x3'));var intUtil=require('./util');var moment=require(_0x2e3f('0x4'));var Redis=require(_0x2e3f('0x5'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x2e3f('0x6'));config['redis']=_[_0x2e3f('0x7')](config[_0x2e3f('0x8')],{'host':_0x2e3f('0x9'),'port':0x18eb});var io=require(_0x2e3f('0xa'))(new Redis(config[_0x2e3f('0x8')]));function emit(_0x48ace0,_0x425d61,_0x17f75c){io['to'](_0x48ace0)['emit'](_0x425d61,_0x17f75c);}function request(_0x2ca1db){logger[_0x2e3f('0xb')](_0x2e3f('0xc'),JSON[_0x2e3f('0xd')](_0x2ca1db));return rp(_0x2ca1db);}function getCustomFields(_0x2e7854,_0xec779b){var _0x3ed5d2={};if(_0x2e7854[_0x2e3f('0xe')]>0x0){_[_0x2e3f('0xf')](_0x2e7854,function(_0x5b7d8e){if(_[_0x2e3f('0x10')]([_0x2e3f('0x11'),_0x2e3f('0x12')],_0x5b7d8e[_0x2e3f('0x13')])&&_0x5b7d8e[_0x2e3f('0x14')]){_0x3ed5d2[_0x5b7d8e[_0x2e3f('0x14')]]=_0x5b7d8e[_0x2e3f('0x15')][_0x2e3f('0x16')]();}else if(_0x5b7d8e['type']===_0x2e3f('0x17')&&_0x5b7d8e[_0x2e3f('0x18')]&&_0x5b7d8e[_0x2e3f('0x14')]&&_0xec779b[_0x5b7d8e[_0x2e3f('0x18')]]){_0x3ed5d2[_0x5b7d8e[_0x2e3f('0x14')]]=_0xec779b[_0x5b7d8e[_0x2e3f('0x18')]][_0x2e3f('0x16')]();}else if(_0x5b7d8e[_0x2e3f('0x13')]===_0x2e3f('0x19')&&_0x5b7d8e['Variable']&&_0x5b7d8e['Variable'][_0x2e3f('0x1a')]&&_0x5b7d8e[_0x2e3f('0x14')]&&_0xec779b[_0x5b7d8e[_0x2e3f('0x1b')][_0x2e3f('0x1a')]['toLowerCase']()]){_0x3ed5d2[_0x5b7d8e[_0x2e3f('0x14')]]=_0xec779b[_0x5b7d8e['Variable']['name'][_0x2e3f('0x1c')]()][_0x2e3f('0x16')]();}});}return _0x3ed5d2;}function getName(_0x10820c){if(_0x10820c[_0x2e3f('0x1d')]('\x20')>0x0){var _0x3f4961=_0x10820c[_0x2e3f('0x1e')](/ (.+)/);if(_0x3f4961[0x1]){return _0x3f4961;}}return[_0x10820c,_0x10820c];}var accountsTokens={};function getAccessToken(_0x2b79eb){return new Promise(function(_0x827424,_0x203d13){if(!_['isNil'](accountsTokens[_0x2b79eb['id']])&&!_[_0x2e3f('0x1f')](accountsTokens[_0x2b79eb['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x2b79eb['id']][_0x2e3f('0x20')])){_0x827424(accountsTokens[_0x2b79eb['id']][_0x2e3f('0x21')]);}}var _0x11015b;switch(_0x2b79eb['zone']){case'US':_0x11015b=_0x2e3f('0x22');break;case'AU':_0x11015b=_0x2e3f('0x23');break;case'EU':_0x11015b=_0x2e3f('0x24');break;case'IN':_0x11015b=_0x2e3f('0x25');break;case'CN':_0x11015b=_0x2e3f('0x26');break;default:_0x11015b=_0x2e3f('0x24');break;}var _0x59914a={'method':_0x2e3f('0x27'),'uri':_0x11015b+_0x2e3f('0x28'),'qs':{'refresh_token':_0x2b79eb['refreshToken'],'client_id':_0x2b79eb[_0x2e3f('0x29')],'client_secret':_0x2b79eb[_0x2e3f('0x2a')],'grant_type':_0x2e3f('0x2b')},'json':!![]};return rp(_0x59914a)[_0x2e3f('0x2c')](function(_0x81294e){accountsTokens[_0x2b79eb['id']]={'access_token':_0x81294e[_0x2e3f('0x21')],'expires_in':moment()[_0x2e3f('0x2d')](_0x81294e[_0x2e3f('0x20')],'seconds')};_0x827424(_0x81294e[_0x2e3f('0x21')]);})[_0x2e3f('0x2e')](function(_0x3bf27c){logger[_0x2e3f('0x2f')](_0x2e3f('0x30'),_0x3bf27c['stack']);_0x203d13(_0x3bf27c);});});}function getUser(_0x25f474,_0x3e8b48,_0x146e4c,_0x6f6de8){logger[_0x2e3f('0x31')]('Search\x20user');return request({'method':_0x2e3f('0x32'),'uri':util['format'](_0x2e3f('0x33'),_0x3e8b48),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x2e3f('0x34')+_0x25f474},'json':!![]})[_0x2e3f('0x2c')](function(_0xafeef2){if(_0xafeef2['users']){var _0x3e7575=-0x1;if(_[_0x2e3f('0x35')](_0xafeef2['users'])){if(!_['isNil'](_0x6f6de8)){_0x3e7575=_['findIndex'](_0xafeef2[_0x2e3f('0x36')],function(_0x4ca511){return _0x4ca511[_0x2e3f('0x37')]===_0x6f6de8;});}if(_0x3e7575>=0x0){logger[_0x2e3f('0x31')]('Agent\x20found!');}else{logger['info'](_0x2e3f('0x38'));_0x3e7575=_['findIndex'](_0xafeef2[_0x2e3f('0x36')],function(_0x1ea807){return _0x1ea807[_0x2e3f('0x39')]['name']===_0x2e3f('0x3a');});}return _0xafeef2[_0x2e3f('0x36')][_0x3e7575];}else{if(_0xafeef2[_0x2e3f('0x3b')][_0x2e3f('0x39')]['name']===_0x2e3f('0x3a')){logger[_0x2e3f('0x31')](_0x2e3f('0x38'));user=_0xafeef2['user'];return user;}else{logger[_0x2e3f('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x2e3f('0xd')](_0xafeef2));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x2e3f('0xd')](_0xafeef2));}}}else{logger['error'](_0x2e3f('0x3c'),JSON['stringify'](_0xafeef2));throw new Error(_0x2e3f('0x3d')+JSON['stringify'](_0xafeef2));}})[_0x2e3f('0x2e')](function(_0x196308){console[_0x2e3f('0x2f')](_0x196308);});}function getZohoUser(_0x5ce303,_0x19c660){return new BPromise(function(_0x33b3fa,_0x3adfd5){request(_0x5ce303)[_0x2e3f('0x2c')](function(_0x3d4cb6){var _0x4d1ddc=null;if(_0x3d4cb6){_0x4d1ddc=_0x3d4cb6[_0x2e3f('0x3e')][0x0];_0x4d1ddc[_0x2e3f('0x3f')]=_0x19c660;}_0x33b3fa(_0x4d1ddc);})['catch'](function(_0x10476c){_0x3adfd5(_0x10476c);});});}function createEndUser(_0x3c14dc,_0x146145,_0x2db616,_0x5b7dff,_0x580131,_0x3dde80){var _0x2db616=getName(_0x2db616);return request({'method':_0x2e3f('0x27'),'uri':_0x2e3f('0x40')+_0x146145+_0x2e3f('0x41')+_[_0x2e3f('0x42')](_0x3dde80[_0x2e3f('0x43')])+'s','body':{'data':[{'Last_Name':_0x2db616[0x1],'First_Name':_0x2db616[0x0],'Phone':_0x5b7dff,'Owner':{'name':!_['isNil'](_0x580131[_0x2e3f('0x44')][_0x2e3f('0x1a')])?_0x580131[_0x2e3f('0x44')][_0x2e3f('0x1a')]:!_[_0x2e3f('0x1f')](_0x580131[_0x2e3f('0x45')])?_0x580131[_0x2e3f('0x45')]+'\x20'+_0x580131[_0x2e3f('0x46')]:_0x580131[_0x2e3f('0x46')],'id':_0x580131['id']}}]},'headers':{'Authorization':_0x2e3f('0x34')+_0x3c14dc},'json':!![]})['then'](function(_0x38e33d){if(_0x38e33d&&_0x38e33d[_0x2e3f('0x3e')][0x0][_0x2e3f('0x47')]==='SUCCESS'){var _0x13c31a=_0x38e33d[_0x2e3f('0x3e')][0x0]['details'];_0x13c31a[_0x2e3f('0x3f')]=_[_0x2e3f('0x42')](_0x3dde80[_0x2e3f('0x43')])+'s';return _0x13c31a;}logger['error'](_0x2e3f('0x3c'),JSON[_0x2e3f('0xd')](data));throw new Error('Error:\x20'+JSON[_0x2e3f('0xd')](data));})['catch'](function(_0x3611e0){console[_0x2e3f('0x48')](_0x2e3f('0x49'),_0x3611e0);});}function getEndUser(_0x306a0f,_0x52183f,_0x57a521,_0x3e1752,_0x69df1a,_0x3d41f0,_0x3e8a9c){var _0x53e88a={'method':_0x2e3f('0x32'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x306a0f},'json':!![]};switch(_0x3e8a9c[_0x2e3f('0x4a')]){case _0x2e3f('0x4b'):_0x53e88a[_0x2e3f('0x4c')]=_0x2e3f('0x40')+_0x52183f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x69df1a+'))';return getZohoUser(_0x53e88a,_0x2e3f('0x4d'))['then'](function(_0x456f5c){if(_0x456f5c)return _0x456f5c;_0x53e88a['uri']=_0x2e3f('0x40')+_0x52183f+_0x2e3f('0x4e')+_0x69df1a+'))';return getZohoUser(_0x53e88a,_0x2e3f('0x4f'))[_0x2e3f('0x2c')](function(_0x37b561){if(_0x37b561)return _0x37b561;if(_0x3e8a9c['moduleCreate']!=_0x2e3f('0x50')){return createEndUser(_0x306a0f,_0x52183f,_0x3e1752,_0x69df1a,_0x3d41f0,_0x3e8a9c);}else{return{};}});});break;case _0x2e3f('0x51'):_0x53e88a[_0x2e3f('0x4c')]=_0x2e3f('0x40')+_0x52183f+_0x2e3f('0x52')+_0x69df1a+'))';return getZohoUser(_0x53e88a,_0x2e3f('0x4d'))[_0x2e3f('0x2c')](function(_0x3245d4){if(_0x3245d4)return _0x3245d4;if(_0x3e8a9c[_0x2e3f('0x43')]!=_0x2e3f('0x50')){return createEndUser(_0x306a0f,_0x52183f,_0x3e1752,_0x69df1a,_0x3d41f0,_0x3e8a9c);}else{return{};}});break;case'lead':_0x53e88a[_0x2e3f('0x4c')]=_0x2e3f('0x40')+_0x52183f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x69df1a+'))';return getZohoUser(_0x53e88a,_0x2e3f('0x4f'))[_0x2e3f('0x2c')](function(_0x28c04b){if(_0x28c04b)return _0x28c04b;if(_0x3e8a9c['moduleCreate']!=_0x2e3f('0x50')){return createEndUser(_0x306a0f,_0x52183f,_0x3e1752,_0x69df1a,_0x3d41f0,_0x3e8a9c);}else{return{};}});break;}}function getCall(_0x2ecd8e,_0xb75e6b,_0x3c986b,_0x4446ab,_0x461fb9,_0x2db6a2,_0x32315e,_0x5d9b1c){logger[_0x2e3f('0x31')](_0x2e3f('0x53'));var _0x312340={};_0x312340[_0x2e3f('0x54')]={'name':!_[_0x2e3f('0x1f')](_0x4446ab['role'][_0x2e3f('0x1a')])&&!_[_0x2e3f('0x1f')](_0x4446ab[_0x2e3f('0x39')]['name'])&&_0x4446ab[_0x2e3f('0x39')][_0x2e3f('0x1a')]===_0x2e3f('0x55')?_0x4446ab[_0x2e3f('0x44')][_0x2e3f('0x1a')]:!_[_0x2e3f('0x1f')](_0x4446ab[_0x2e3f('0x45')])?_0x4446ab[_0x2e3f('0x45')]+'\x20'+_0x4446ab[_0x2e3f('0x46')]:_0x4446ab['last_name'],'id':_0x4446ab['id']};_0x312340['Subject']=intUtil['getString'](_0x2db6a2['Subjects'],_0x32315e,'\x20');_0x312340[_0x2e3f('0x56')]=intUtil[_0x2e3f('0x57')](_0x2db6a2['Descriptions'],_0x32315e,'\x0a');if(_0x461fb9[_0x2e3f('0x3f')]==='Contacts'){_0x312340[_0x2e3f('0x58')]={'name':!_[_0x2e3f('0x1f')](_0x461fb9[_0x2e3f('0x59')])?_0x461fb9['Full_Name']:!_[_0x2e3f('0x1f')](_0x461fb9[_0x2e3f('0x5a')])?_0x461fb9[_0x2e3f('0x5a')]+'\x20'+_0x461fb9[_0x2e3f('0x5b')]:_0x461fb9[_0x2e3f('0x5b')],'id':_0x461fb9['id']};}if(_0x461fb9['enduserType']==='Leads'){_0x312340[_0x2e3f('0x5c')]={'name':!_[_0x2e3f('0x1f')](_0x461fb9[_0x2e3f('0x59')])?_0x461fb9[_0x2e3f('0x59')]:!_['isNil'](_0x461fb9['First_Name'])?_0x461fb9['First_Name']+'\x20'+_0x461fb9[_0x2e3f('0x5b')]:_0x461fb9[_0x2e3f('0x5b')],'id':_0x461fb9['id']};_0x312340[_0x2e3f('0x5d')]=_[_0x2e3f('0x42')](_0x461fb9[_0x2e3f('0x3f')]);}if(_0x32315e['talktime']){_0x312340[_0x2e3f('0x5e')]=moment['utc'](parseInt(_0x32315e['talktime'])*0x3e8)[_0x2e3f('0x5f')]('mm:ss');}else if(_0x32315e[_0x2e3f('0x60')]&&_0x32315e[_0x2e3f('0x61')]){_0x312340[_0x2e3f('0x5e')]=moment[_0x2e3f('0x62')](moment(_0x32315e[_0x2e3f('0x61')],_0x2e3f('0x63'))['diff'](moment(_0x32315e[_0x2e3f('0x64')],'YYYY-MM-DDTHH:mm:ss')))[_0x2e3f('0x5f')](_0x2e3f('0x65'));}switch(_0x32315e[_0x2e3f('0x66')]){case _0x2e3f('0x67'):_0x312340[_0x2e3f('0x68')]=_0x2e3f('0x69');break;case _0x2e3f('0x6a'):case _0x2e3f('0x6b'):_0x312340[_0x2e3f('0x68')]='Answered';break;case'rejected':_0x312340[_0x2e3f('0x68')]=_0x2e3f('0x6c');break;case _0x2e3f('0x6d'):_0x312340[_0x2e3f('0x68')]='Abandoned';break;case'timeout':_0x312340[_0x2e3f('0x68')]=_0x2e3f('0x6e');default:}_0x312340[_0x2e3f('0x6f')]=(_0x5d9b1c===_0x2e3f('0x70')?moment(_0x32315e[_0x2e3f('0x64')])[_0x2e3f('0x5f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x32315e['agentcalledAt'])['format'](_0x2e3f('0x63')))||moment()[_0x2e3f('0x5f')]('YYYY-MM-DDTHH:mm:ss');_0x312340[_0x2e3f('0x71')]=_0x5d9b1c||_0x2e3f('0x72');_0x312340=_[_0x2e3f('0x73')](_0x312340,getCustomFields(_0x2db6a2[_0x2e3f('0x74')],_0x32315e));return request({'method':_0x2e3f('0x27'),'uri':_0x2e3f('0x40')+_0xb75e6b+_0x2e3f('0x75'),'headers':{'Authorization':_0x2e3f('0x34')+_0x2ecd8e},'body':{'data':[_0x312340]},'json':!![]})[_0x2e3f('0x2c')](function(_0x3d7ddd){if(_0x3d7ddd&&_0x3d7ddd[_0x2e3f('0x3e')][0x0]['code']==='SUCCESS'){logger[_0x2e3f('0x31')](_0x2e3f('0x76'));return{'id':_0x3d7ddd['data'][0x0][_0x2e3f('0x77')]['id']};}})[_0x2e3f('0x2e')](function(_0x31aafc){logger[_0x2e3f('0x31')]('err',_0x31aafc[_0x2e3f('0x78')]);console[_0x2e3f('0x48')](_0x2e3f('0x79'),_0x31aafc);});}exports[_0x2e3f('0x7a')]=function(_0x7936c8,_0x57d6ac,_0x54a1bd,_0x202d47,_0x37ddb6,_0x38c05){var _0x281942,_0x378714,_0x5afee5;_0x38c05[_0x2e3f('0x7b')]=intUtil[_0x2e3f('0x7c')](_0x38c05[_0x2e3f('0x7b')]);_0x38c05[_0x2e3f('0x7d')]=intUtil[_0x2e3f('0x7c')](_0x38c05[_0x2e3f('0x7d')]);if(_0x37ddb6&&_0x37ddb6[_0x2e3f('0x7e')]){logger[_0x2e3f('0x31')]('[QUEUE]',_0x2e3f('0x7f'));_0x57d6ac[_0x2e3f('0x80')]=_0x38c05[_0x2e3f('0x7d')]+_0x2e3f('0x81')+_0x57d6ac[_0x2e3f('0x82')]+_0x2e3f('0x83')+md5(_0x57d6ac[_0x2e3f('0x82')]);}else{_0x57d6ac[_0x2e3f('0x80')]='';}var _0xddb7c1=_0x38c05['host']==='zoho.eu'?'eu':_0x2e3f('0x84');return getAccessToken(_0x38c05)['then'](function(_0x33622f){_0x5afee5=_0x33622f;return getUser(_0x5afee5,_0xddb7c1,_0x38c05,_0x202d47[_0x2e3f('0x37')]);})[_0x2e3f('0x2c')](function(_0x117b53){_0x281942=_0x117b53;logger[_0x2e3f('0x31')](_0x2e3f('0x85'),_0x281942['id']);return getEndUser(_0x5afee5,_0xddb7c1,_0x38c05,_0x57d6ac[_0x2e3f('0x86')],_0x57d6ac['calleridnum'],_0x281942,_0x54a1bd);})[_0x2e3f('0x2c')](function(_0x1d28fb){_0x378714=_0x1d28fb;return getCall(_0x5afee5,_0xddb7c1,_0x38c05,_0x281942,_0x378714,_0x54a1bd,_0x57d6ac,'Inbound');})[_0x2e3f('0x2c')](function(_0x1dafd3){if(_0x1dafd3){logger['info'](_0x2e3f('0x87'),_0x1dafd3['id']);logger[_0x2e3f('0x31')](_0x2e3f('0x88'),_0x2e3f('0x89'));emit(util['format']('user:%s',_0x202d47[_0x2e3f('0x1a')]),_0x2e3f('0x8a'),{'uri':'https://crm.'+_0x38c05['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1dafd3['id']});}})[_0x2e3f('0x2e')](function(_0x23956d){logger[_0x2e3f('0x2f')](_0x2e3f('0x88'),JSON[_0x2e3f('0xd')](_0x23956d));});};exports[_0x2e3f('0x70')]=function(_0x4a6f72,_0x419975,_0x35a30b,_0x1cbdfa,_0x4b9090,_0x217b91,_0x13d894){var _0x3def61,_0xc36587,_0x1e993d;_0x217b91[_0x2e3f('0x7b')]=intUtil[_0x2e3f('0x7c')](_0x217b91[_0x2e3f('0x7b')]);_0x217b91['serverUrl']=intUtil[_0x2e3f('0x7c')](_0x217b91['serverUrl']);if(_0x13d894&&_0x13d894['recordingFormat']&&_0x13d894['recordingFormat']!==_0x2e3f('0x8b')){logger[_0x2e3f('0x31')](_0x2e3f('0x8c'),_0x2e3f('0x7f'));_0x419975[_0x2e3f('0x80')]=_0x217b91[_0x2e3f('0x7d')]+'/api/voice/recordings/'+_0x419975['uniqueid']+_0x2e3f('0x83')+md5(_0x419975['uniqueid']);}var _0x243315=_0x217b91[_0x2e3f('0x7b')]===_0x2e3f('0x8d')?'eu':'com';return getAccessToken(_0x217b91)[_0x2e3f('0x2c')](function(_0x25b8aa){_0x1e993d=_0x25b8aa;return getUser(_0x1e993d,_0x243315,_0x217b91,_0x1cbdfa[_0x2e3f('0x37')]);})[_0x2e3f('0x2c')](function(_0x5a1b5e){_0x3def61=_0x5a1b5e;logger[_0x2e3f('0x31')](_0x2e3f('0x85'),_0x3def61['id']);return getEndUser(_0x1e993d,_0x243315,_0x217b91,_0x419975[_0x2e3f('0x8e')],_0x419975['destcalleridnum'],_0x3def61,_0x35a30b);})['then'](function(_0x50a89d){_0xc36587=_0x50a89d;return getCall(_0x1e993d,_0x243315,_0x217b91,_0x3def61,_0xc36587,_0x35a30b,_0x419975,'Outbound');})['then'](function(_0x3f4fde){if(_0x3f4fde){logger[_0x2e3f('0x31')](_0x2e3f('0x87'),_0x3f4fde['id']);logger['info']('[OUTBOUND]',_0x2e3f('0x89'));emit(util[_0x2e3f('0x5f')](_0x2e3f('0x8f'),_0x1cbdfa[_0x2e3f('0x1a')]),_0x2e3f('0x8a'),{'uri':_0x2e3f('0x90')+_0x217b91[_0x2e3f('0x7b')]+_0x2e3f('0x91')+_0x3f4fde['id']});}})[_0x2e3f('0x2e')](function(_0x3b8b51){logger['error'](_0x2e3f('0x8c'),JSON[_0x2e3f('0xd')](_0x3b8b51));});};exports[_0x2e3f('0x92')]=function(_0x2d0437,_0x290a9d,_0x4bc383,_0x4828b1,_0xf0395d,_0x50d9fa){var _0x1a671e,_0x3d82c8,_0xe38754;_0x50d9fa['host']=intUtil[_0x2e3f('0x7c')](_0x50d9fa[_0x2e3f('0x7b')]);_0x50d9fa['serverUrl']=intUtil[_0x2e3f('0x7c')](_0x50d9fa[_0x2e3f('0x7d')]);if(_0xf0395d&&_0xf0395d['monitor_format']){logger[_0x2e3f('0x31')]('['+_0x290a9d[_0x2e3f('0x66')]['toUpperCase']()+']',_0x2e3f('0x7f'));_0x290a9d[_0x2e3f('0x80')]=_0x50d9fa[_0x2e3f('0x7d')]+_0x2e3f('0x81')+_0x290a9d[_0x2e3f('0x82')]+_0x2e3f('0x83')+md5(_0x290a9d['uniqueid']);}else{_0x290a9d[_0x2e3f('0x80')]='';}var _0x6b1917=_0x50d9fa['host']==='zoho.eu'?'eu':_0x2e3f('0x84');return getAccessToken(_0x50d9fa)['then'](function(_0x22e7e9){_0xe38754=_0x22e7e9;return getUser(_0xe38754,_0x6b1917,_0x50d9fa);})[_0x2e3f('0x2c')](function(_0x5b542f){_0x1a671e=_0x5b542f;logger[_0x2e3f('0x31')](_0x2e3f('0x85'),_0x1a671e['id']);return getEndUser(_0xe38754,_0x6b1917,_0x50d9fa,_0x290a9d[_0x2e3f('0x86')],_0x290a9d[_0x2e3f('0x93')],_0x1a671e,_0x4bc383);})[_0x2e3f('0x2c')](function(_0x2080f8){_0x3d82c8=_0x2080f8;return getCall(_0xe38754,_0x6b1917,_0x50d9fa,_0x1a671e,_0x3d82c8,_0x4bc383,_0x290a9d,'Inbound');})[_0x2e3f('0x2c')](function(_0x8aeaff){if(_0x8aeaff){logger[_0x2e3f('0x31')](_0x2e3f('0x87'),_0x8aeaff['id']);}})[_0x2e3f('0x2e')](function(_0x5cef24){logger[_0x2e3f('0x2f')]('['+_0x290a9d['lastevent'][_0x2e3f('0x94')]()+']',JSON['stringify'](_0x5cef24));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 7bb981f..e6b0e55 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 _0x5f0d=['util','shelljs','mustache','trigger','data2','Script','data3','render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x1c1a14,_0x1d917f){var _0x559834=function(_0x14db0b){while(--_0x14db0b){_0x1c1a14['push'](_0x1c1a14['shift']());}};_0x559834(++_0x1d917f);}(_0x5f0d,0x9c));var _0xd5f0=function(_0x4de6b2,_0x8ceb51){_0x4de6b2=_0x4de6b2-0x0;var _0x497d15=_0x5f0d[_0x4de6b2];return _0x497d15;};'use strict';var util=require(_0xd5f0('0x0'));var sh=require(_0xd5f0('0x1'));var Mustache=require(_0xd5f0('0x2'));var logger=require('../../../../config/logger')(_0xd5f0('0x3'));exports['exec']=function(_0x3eb7da,_0x4f9d40){var _0x383155=_0x3eb7da[_0xd5f0('0x4')]?_0x3eb7da[_0xd5f0('0x4')]:_0xd5f0('0x5');var _0x46c570=_0x3eb7da[_0xd5f0('0x6')]?Mustache[_0xd5f0('0x7')](_0x3eb7da['data3'],_0x4f9d40):_0x4f9d40;sh[_0xd5f0('0x8')](_0x46c570,function(_0x424570,_0x5819ff,_0xf4fd0a){if(_0x424570!==0x0){logger[_0xd5f0('0x9')](util[_0xd5f0('0xa')](_0xd5f0('0xb'),_0x383155,_0x46c570,_0x424570,_0xf4fd0a));}else{logger[_0xd5f0('0xc')](util[_0xd5f0('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x383155,_0x46c570,_0x5819ff));}});}; \ No newline at end of file +var _0xcb3c=['Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2'];(function(_0x34ef44,_0x3c6c08){var _0x43044a=function(_0x31e296){while(--_0x31e296){_0x34ef44['push'](_0x34ef44['shift']());}};_0x43044a(++_0x3c6c08);}(_0xcb3c,0x1ba));var _0xccb3=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xcb3c[_0x1602ef];return _0x5870ee;};'use strict';var util=require(_0xccb3('0x0'));var sh=require(_0xccb3('0x1'));var Mustache=require(_0xccb3('0x2'));var logger=require('../../../../config/logger')(_0xccb3('0x3'));exports[_0xccb3('0x4')]=function(_0x5cc4f8,_0x25df1c){var _0x1f682e=_0x5cc4f8[_0xccb3('0x5')]?_0x5cc4f8[_0xccb3('0x5')]:_0xccb3('0x6');var _0x50391a=_0x5cc4f8[_0xccb3('0x7')]?Mustache[_0xccb3('0x8')](_0x5cc4f8[_0xccb3('0x7')],_0x25df1c):_0x25df1c;sh['exec'](_0x50391a,function(_0x1eafc8,_0x52b488,_0xc6b54b){if(_0x1eafc8!==0x0){logger[_0xccb3('0x9')](util[_0xccb3('0xa')](_0xccb3('0xb'),_0x1f682e,_0x50391a,_0x1eafc8,_0xc6b54b));}else{logger[_0xccb3('0xc')](util[_0xccb3('0xa')](_0xccb3('0xd'),_0x1f682e,_0x50391a,_0x52b488));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 49ddf2c..5264add 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 _0x654a=['data1','toUpperCase','GET','DELETE','POST','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil','stringify','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','lodash','../../../../config/logger','trigger','exec','render','data2','data5','number','headers','data6','error','stack'];(function(_0x1f1fb4,_0x15a561){var _0x12fa15=function(_0x5ecc9b){while(--_0x5ecc9b){_0x1f1fb4['push'](_0x1f1fb4['shift']());}};_0x12fa15(++_0x15a561);}(_0x654a,0x1c4));var _0xa654=function(_0x25f983,_0x352b9d){_0x25f983=_0x25f983-0x0;var _0x50a304=_0x654a[_0x25f983];return _0x50a304;};'use strict';var rp=require(_0xa654('0x0'));var util=require('util');var _=require(_0xa654('0x1'));var Mustache=require('mustache');var logger=require(_0xa654('0x2'))(_0xa654('0x3'));exports[_0xa654('0x4')]=function(_0x3e7332,_0x5d8689){var _0x389baa,_0x76b460;var _0x91a0dc={'method':_0x3e7332['data1']['toUpperCase'](),'uri':Mustache[_0xa654('0x5')](_0x3e7332[_0xa654('0x6')],_0x5d8689),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3e7332[_0xa654('0x7')])===_0xa654('0x8')&&parseInt(_0x3e7332[_0xa654('0x7')])>=0x1&&parseInt(_0x3e7332[_0xa654('0x7')])<=0xa?parseInt(_0x3e7332[_0xa654('0x7')])*0x3e8:0x5*0x3e8};try{_0x91a0dc[_0xa654('0x9')]=_0x3e7332[_0xa654('0xa')]?JSON['parse'](Mustache['render'](_0x3e7332[_0xa654('0xa')],_0x5d8689)):{};}catch(_0x245807){logger[_0xa654('0xb')](_0x245807[_0xa654('0xc')]);}switch(_0x3e7332[_0xa654('0xd')][_0xa654('0xe')]()){case _0xa654('0xf'):case _0xa654('0x10'):_0x389baa=null;_0x91a0dc['qs']=_0x5d8689;break;case _0xa654('0x11'):case'PUT':if(_0x3e7332[_0xa654('0x12')]){try{_0x389baa=JSON[_0xa654('0x13')](Mustache[_0xa654('0x5')](_0x3e7332['data7'],_0x5d8689));_0x91a0dc[_0xa654('0x14')]=_0x389baa;}catch(_0x1d8598){logger['error'](_0x1d8598[_0xa654('0xc')]);logger[_0xa654('0xb')](_0xa654('0x15'));}}else{_0x389baa=_0x5d8689;_0x91a0dc[_0xa654('0x14')]=_0x389baa;}break;}logger[_0xa654('0x16')](util[_0xa654('0x17')](_0xa654('0x18'),_0x3e7332[_0xa654('0xd')],_0x3e7332['data2'],JSON['stringify'](_0x91a0dc)));rp(_0x91a0dc)[_0xa654('0x19')](function(_0x41409e){_0x389baa=!_[_0xa654('0x1a')](_0x389baa)?',\x20request\x20body:\x20'+_0x389baa:'';_0x76b460=typeof _0x41409e[_0xa654('0x14')]==='object'?JSON[_0xa654('0x1b')](_0x41409e['body']):_0x41409e[_0xa654('0x14')];logger[_0xa654('0x16')](util[_0xa654('0x17')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3e7332[_0xa654('0xd')],_0x3e7332[_0xa654('0x6')],_0x41409e[_0xa654('0x1c')],_0x76b460));})['catch'](function(_0x481e09){logger[_0xa654('0xb')](util[_0xa654('0x17')](_0xa654('0x1d'),_0x3e7332['data1'],_0x3e7332[_0xa654('0x6')],_0x481e09[_0xa654('0x1c')],_0x481e09['name'],_0x481e09[_0xa654('0x1e')]));});}; \ No newline at end of file +var _0x4432=['lodash','mustache','trigger','exec','toUpperCase','render','data2','data5','number','data6','parse','error','stack','data1','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then',',\x20request\x20body:\x20','object','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','request-promise'];(function(_0x388e89,_0x21f300){var _0x4be2c7=function(_0xac8e84){while(--_0xac8e84){_0x388e89['push'](_0x388e89['shift']());}};_0x4be2c7(++_0x21f300);}(_0x4432,0x1d0));var _0x2443=function(_0x52b8a5,_0x1333cd){_0x52b8a5=_0x52b8a5-0x0;var _0x18c976=_0x4432[_0x52b8a5];return _0x18c976;};'use strict';var rp=require(_0x2443('0x0'));var util=require('util');var _=require(_0x2443('0x1'));var Mustache=require(_0x2443('0x2'));var logger=require('../../../../config/logger')(_0x2443('0x3'));exports[_0x2443('0x4')]=function(_0x4537eb,_0x9a3233){var _0x33c075,_0x38707c;var _0x55a019={'method':_0x4537eb['data1'][_0x2443('0x5')](),'uri':Mustache[_0x2443('0x6')](_0x4537eb[_0x2443('0x7')],_0x9a3233),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4537eb[_0x2443('0x8')])===_0x2443('0x9')&&parseInt(_0x4537eb['data5'])>=0x1&&parseInt(_0x4537eb['data5'])<=0xa?parseInt(_0x4537eb['data5'])*0x3e8:0x5*0x3e8};try{_0x55a019['headers']=_0x4537eb[_0x2443('0xa')]?JSON[_0x2443('0xb')](Mustache['render'](_0x4537eb['data6'],_0x9a3233)):{};}catch(_0x15058d){logger[_0x2443('0xc')](_0x15058d[_0x2443('0xd')]);}switch(_0x4537eb[_0x2443('0xe')][_0x2443('0x5')]()){case'GET':case _0x2443('0xf'):_0x33c075=null;_0x55a019['qs']=_0x9a3233;break;case _0x2443('0x10'):case _0x2443('0x11'):if(_0x4537eb['data7']){try{_0x33c075=JSON[_0x2443('0xb')](Mustache[_0x2443('0x6')](_0x4537eb[_0x2443('0x12')],_0x9a3233));_0x55a019[_0x2443('0x13')]=_0x33c075;}catch(_0x21ac08){logger['error'](_0x21ac08[_0x2443('0xd')]);logger['error'](_0x2443('0x14'));}}else{_0x33c075=_0x9a3233;_0x55a019[_0x2443('0x13')]=_0x33c075;}break;}logger[_0x2443('0x15')](util[_0x2443('0x16')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x4537eb[_0x2443('0xe')],_0x4537eb[_0x2443('0x7')],JSON[_0x2443('0x17')](_0x55a019)));rp(_0x55a019)[_0x2443('0x18')](function(_0x217a81){_0x33c075=!_['isNil'](_0x33c075)?_0x2443('0x19')+_0x33c075:'';_0x38707c=typeof _0x217a81[_0x2443('0x13')]===_0x2443('0x1a')?JSON[_0x2443('0x17')](_0x217a81[_0x2443('0x13')]):_0x217a81[_0x2443('0x13')];logger['info'](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x4537eb[_0x2443('0xe')],_0x4537eb[_0x2443('0x7')],_0x217a81['statusCode'],_0x38707c));})[_0x2443('0x1b')](function(_0x5ba0c6){logger['error'](util[_0x2443('0x16')](_0x2443('0x1c'),_0x4537eb[_0x2443('0xe')],_0x4537eb[_0x2443('0x7')],_0x5ba0c6[_0x2443('0x1d')],_0x5ba0c6[_0x2443('0x1e')],_0x5ba0c6['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 98a619a..c8bc13c 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 _0x6b69=['rpc','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','error'];(function(_0x8b0754,_0x4e05a3){var _0x5501f9=function(_0x37622b){while(--_0x37622b){_0x8b0754['push'](_0x8b0754['shift']());}};_0x5501f9(++_0x4e05a3);}(_0x6b69,0x13f));var _0x96b6=function(_0x11d453,_0x4cc738){_0x11d453=_0x11d453-0x0;var _0x1ccbd1=_0x6b69[_0x11d453];return _0x1ccbd1;};'use strict';var jayson=require(_0x96b6('0x0'));var BPromise=require(_0x96b6('0x1'));var logger=require(_0x96b6('0x2'))(_0x96b6('0x3'));var client=jayson[_0x96b6('0x4')][_0x96b6('0x5')]({'port':0x2329});client[_0x96b6('0x6')]=function(_0x4bdba9,_0x26778e){return new BPromise(function(_0x2b6c3d,_0x41b48a){return client[_0x96b6('0x7')](_0x4bdba9,_0x26778e)[_0x96b6('0x8')](function(_0x1519ce){logger[_0x96b6('0x9')]('rpc',_0x96b6('0x3'),_0x4bdba9,_0x26778e,_0x1519ce);if(_0x1519ce[_0x96b6('0xa')]){logger[_0x96b6('0xa')](_0x96b6('0xb'),'routing',_0x4bdba9,_0x1519ce[_0x96b6('0xa')][_0x96b6('0xc')],_0x26778e);return _0x41b48a(_0x1519ce[_0x96b6('0xa')][_0x96b6('0xc')]);}else{return _0x2b6c3d(_0x1519ce[_0x96b6('0xd')]);}})[_0x96b6('0xe')](function(_0x2e9982){logger['error'](_0x96b6('0xb'),_0x96b6('0x3'),_0x4bdba9,_0x2e9982,_0x26778e);return _0x41b48a(_0x2e9982);});});};module['exports']=client; \ No newline at end of file +var _0x53e7=['bluebird','routing','http','Request','request','then','debug','error','message','result','catch','exports','jayson/promise'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x53e7,0xc2));var _0x753e=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0x53e7[_0x7b484];return _0x2ae1cf;};'use strict';var jayson=require(_0x753e('0x0'));var BPromise=require(_0x753e('0x1'));var logger=require('../../config/logger')(_0x753e('0x2'));var client=jayson['client'][_0x753e('0x3')]({'port':0x2329});client[_0x753e('0x4')]=function(_0x5e6b4d,_0xf23a07){return new BPromise(function(_0x5c9847,_0x27f149){return client[_0x753e('0x5')](_0x5e6b4d,_0xf23a07)[_0x753e('0x6')](function(_0x406deb){logger[_0x753e('0x7')]('rpc',_0x753e('0x2'),_0x5e6b4d,_0xf23a07,_0x406deb);if(_0x406deb[_0x753e('0x8')]){logger[_0x753e('0x8')]('rpc',_0x753e('0x2'),_0x5e6b4d,_0x406deb[_0x753e('0x8')]['message'],_0xf23a07);return _0x27f149(_0x406deb[_0x753e('0x8')][_0x753e('0x9')]);}else{return _0x5c9847(_0x406deb[_0x753e('0xa')]);}})[_0x753e('0xb')](function(_0x5a98ff){logger['error']('rpc',_0x753e('0x2'),_0x5e6b4d,_0x5a98ff,_0xf23a07);return _0x27f149(_0x5a98ff);});});};module[_0x753e('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d46888d..ad70c69 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 _0xd4ad=['bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','then','getMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch'];(function(_0x3a0e81,_0x12034f){var _0x321b9a=function(_0x546eb8){while(--_0x546eb8){_0x3a0e81['push'](_0x3a0e81['shift']());}};_0x321b9a(++_0x12034f);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x77b41c,_0x688c2e){_0x77b41c=_0x77b41c-0x0;var _0x1457a6=_0xd4ad[_0x77b41c];return _0x1457a6;};'use strict';var BPromise=require(_0xdd4a('0x0'));var server=require(_0xdd4a('0x1'));var Realtime=require(_0xdd4a('0x2'));var EmailChannel=require(_0xdd4a('0x3'));var mailAccount=require(_0xdd4a('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0xdd4a('0x5')](mailAccount[_0xdd4a('0x6')]())['then'](realtime['initMailAccounts']())['then'](function(){email['refresh'](realtime[_0xdd4a('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xdd4a('0x5')](function(){return initRealtime();})['then'](function(){return setting[_0xdd4a('0x8')]();})[_0xdd4a('0x5')](function(_0x3a9192){return setInterval(initRealtime,_0x3a9192[_0xdd4a('0x9')]*0x3e8);})[_0xdd4a('0xa')](function(_0x12d408){console['log'](_0x12d408);});}main(); \ No newline at end of file +var _0x77ed=['listen','getSettings','loginMailFrequency','log','bluebird','./server','./lib/email','./rpc/mailAccount','./rpc/setting','then','getMailAccounts','initMailAccounts','refresh','mailAccounts'];(function(_0x54c60f,_0x2b6144){var _0xb1db44=function(_0x3b3741){while(--_0x3b3741){_0x54c60f['push'](_0x54c60f['shift']());}};_0xb1db44(++_0x2b6144);}(_0x77ed,0x11c));var _0xd77e=function(_0x1342fc,_0xbdaae3){_0x1342fc=_0x1342fc-0x0;var _0x568486=_0x77ed[_0x1342fc];return _0x568486;};'use strict';var BPromise=require(_0xd77e('0x0'));var server=require(_0xd77e('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0xd77e('0x2'));var mailAccount=require(_0xd77e('0x3'));var setting=require(_0xd77e('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0xd77e('0x5')](mailAccount[_0xd77e('0x6')]())[_0xd77e('0x5')](realtime[_0xd77e('0x7')]())[_0xd77e('0x5')](function(){email[_0xd77e('0x8')](realtime[_0xd77e('0x9')]);return realtime;});}function main(){return server[_0xd77e('0xa')](realtime,email)['then'](function(){return initRealtime();})[_0xd77e('0x5')](function(){return setting[_0xd77e('0xb')]();})[_0xd77e('0x5')](function(_0x2577b5){return setInterval(initRealtime,_0x2577b5[_0xd77e('0xc')]*0x3e8);})['catch'](function(_0x4bfb90){console[_0xd77e('0xd')](_0x4bfb90);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8aac379..de7020c 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 _0x235a=['moment','bluebird','ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','mailAccounts','imapAccounts','name','key','active','Imap','messageStatus','total','isNil','md5','emit','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','status','disabled','prototype','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','smtp','send','Smtp','lastSync','verify','exports','lodash'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x235a,0x1d3));var _0xa235=function(_0x29f84c,_0x5669d7){_0x29f84c=_0x29f84c-0x0;var _0x3a9a6e=_0x235a[_0x29f84c];return _0x3a9a6e;};'use strict';var _=require(_0xa235('0x0'));var moment=require(_0xa235('0x1'));var BPromise=require(_0xa235('0x2'));var md5=require('md5');var Redis=require(_0xa235('0x3'));var config=require(_0xa235('0x4'));var logger=require('../../../config/logger')(_0xa235('0x5'));config[_0xa235('0x6')]=_['defaults'](config[_0xa235('0x6')],{'host':_0xa235('0x7'),'port':0x18eb});var io=require(_0xa235('0x8'))(new Redis(config['redis']));var EmailImap=require(_0xa235('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xa235('0xa'));var md5Accounts={};function EmailChannel(_0x2dafc2){logger['info']('start\x20email\x20channel');this[_0xa235('0xb')]=_0x2dafc2[_0xa235('0xb')];this[_0xa235('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x372e91){var _0x5765bb=this['mailAccounts'][_0x372e91];var _0x2d30b7={'id':_0x5765bb['id'],'name':_0x5765bb[_0xa235('0xd')],'key':_0x5765bb[_0xa235('0xe')],'active':_0x5765bb[_0xa235('0xf')],'Imap':{'status':_0x5765bb[_0xa235('0x10')]['status'],'messageStatus':_0x5765bb[_0xa235('0x10')][_0xa235('0x11')],'total':_0x5765bb[_0xa235('0x10')][_0xa235('0x12')]}};if(_[_0xa235('0x13')](md5Accounts[_0x372e91])){md5Accounts[_0x372e91]={};}var _0x5aab63=md5(JSON['stringify'](_0x2d30b7));if(md5Accounts[_0x372e91][_0xa235('0x14')]!==_0x5aab63){md5Accounts[_0x372e91][_0xa235('0x14')]=_0x5aab63;io[_0xa235('0x15')]('mailAccount:update',_0x2d30b7);}};EmailChannel['prototype'][_0xa235('0x16')]=function(_0x27b60b){for(var _0x512b67 in _0x27b60b){if(_0x27b60b[_0xa235('0x17')](_0x512b67)){if(_0x27b60b[_0x512b67][_0xa235('0x10')]&&_0x27b60b[_0x512b67][_0xa235('0xf')]){var _0x1e1fbc=_0x27b60b[_0x512b67]['Imap'];if(!this[_0xa235('0xc')][_0xa235('0x17')](_0x1e1fbc['id'])){this[_0xa235('0xc')][_0x1e1fbc['id']]=new EmailImap(_0x1e1fbc,_0x27b60b[_0x512b67][_0xa235('0x5')]);this['imapAccounts'][_0x1e1fbc['id']]['on'](_0xa235('0x18'),this[_0xa235('0x19')][_0xa235('0x1a')](this,_0x512b67));this[_0xa235('0xc')][_0x1e1fbc['id']]['on'](_0xa235('0x5'),this[_0xa235('0x1b')][_0xa235('0x1a')](this,_0x512b67));this['imapAccounts'][_0x1e1fbc['id']]['on'](_0xa235('0x1c'),this['handleImapEnd']['bind'](this,_0x512b67));this[_0xa235('0xc')][_0x1e1fbc['id']]['on'](_0xa235('0x1d'),this[_0xa235('0x1e')][_0xa235('0x1a')](this,_0x512b67));}}else{if(_['isNil'](this[_0xa235('0xb')][_0x512b67][_0xa235('0x10')])){this['mailAccounts'][_0x512b67][_0xa235('0x10')]={};}this['mailAccounts'][_0x512b67][_0xa235('0x10')][_0xa235('0x1f')]=_0xa235('0x20');this[_0xa235('0xb')][_0x512b67]['Imap']['messageStatus']='';this[_0xa235('0x15')](_0x512b67);}}}};EmailChannel[_0xa235('0x21')][_0xa235('0x19')]=function(_0x20e4eb,_0x1df797){if(this['mailAccounts'][_0x20e4eb]){this[_0xa235('0xb')][_0x20e4eb][_0xa235('0x10')][_0xa235('0x1f')]=_0xa235('0x22');this['mailAccounts'][_0x20e4eb][_0xa235('0x10')][_0xa235('0x11')]=_0x1df797[_0xa235('0xd')];if(_0x1df797[_0xa235('0x23')]){this[_0xa235('0xb')][_0x20e4eb][_0xa235('0x10')][_0xa235('0x12')]=_0x1df797[_0xa235('0x23')][_0xa235('0x12')];}return this[_0xa235('0x15')](_0x20e4eb);}};EmailChannel[_0xa235('0x21')][_0xa235('0x1b')]=function(_0x2854ed,_0x374bb3){logger[_0xa235('0x24')](_0xa235('0x25'),_0x374bb3[_0xa235('0x26')],_0x374bb3['lastName'],_0x374bb3[_0xa235('0x27')],_0x2854ed);if(this['mailAccounts'][_0x2854ed]){return mailAccount[_0xa235('0x28')](_0x2854ed,_0x374bb3)[_0xa235('0x29')](function(_0xfe5467){if(_0xfe5467){logger[_0xa235('0x24')](_0xa235('0x2a'));}})[_0xa235('0x2b')](function(_0x216618){logger[_0xa235('0x1d')](_0xa235('0x2c'),JSON['stringify'](_0x216618));});}};EmailChannel[_0xa235('0x21')]['handleImapEnd']=function(_0x5cfffe){if(this[_0xa235('0xb')][_0x5cfffe]&&this[_0xa235('0xb')][_0x5cfffe][_0xa235('0x10')]){if(this['imapAccounts'][this[_0xa235('0xb')][_0x5cfffe][_0xa235('0x10')]['id']]){delete this[_0xa235('0xc')][this[_0xa235('0xb')][_0x5cfffe][_0xa235('0x10')]['id']];}this[_0xa235('0xb')][_0x5cfffe]['Imap']['lastSync']=moment();this['emit'](_0x5cfffe);}};EmailChannel[_0xa235('0x21')][_0xa235('0x1e')]=function(_0x2eda56,_0xc0039e){if(this[_0xa235('0xb')][_0x2eda56]){this['mailAccounts'][_0x2eda56][_0xa235('0x10')][_0xa235('0x1f')]=_0xa235('0x1d');this[_0xa235('0xb')][_0x2eda56][_0xa235('0x10')][_0xa235('0x11')]=_0xc0039e;return this[_0xa235('0x15')](_0x2eda56);}};EmailChannel[_0xa235('0x21')][_0xa235('0x2d')]=function(_0x583a52,_0x1dd328){return this[_0xa235('0x2e')][_0xa235('0x2f')](_0x583a52,_0x1dd328);};EmailChannel[_0xa235('0x21')]['verifySmtp']=function(_0x27e2d2){var _0x2ce702=this;if(this[_0xa235('0xb')][_0x27e2d2['id']]){if(_[_0xa235('0x13')](this[_0xa235('0xb')][_0x27e2d2['id']][_0xa235('0x30')])){this[_0xa235('0xb')][_0x27e2d2['id']][_0xa235('0x30')]={};}this[_0xa235('0xb')][_0x27e2d2['id']]['Smtp'][_0xa235('0x31')]=moment();return new BPromise(function(_0x39a3d3,_0x188ae8){return _0x2ce702['smtp']['verify'](_0x27e2d2)[_0xa235('0x29')](function(_0x22ccc2){_0x2ce702[_0xa235('0xb')][_0x27e2d2['id']][_0xa235('0x30')][_0xa235('0x1f')]='verified';_0x2ce702[_0xa235('0xb')][_0x27e2d2['id']][_0xa235('0x30')][_0xa235('0x11')]='';_0x2ce702[_0xa235('0x15')](_0x27e2d2['id']);_0x39a3d3(_0x22ccc2);})[_0xa235('0x2b')](function(_0x5c8615){_0x2ce702[_0xa235('0xb')][_0x27e2d2['id']]['Smtp'][_0xa235('0x1f')]=_0xa235('0x1d');_0x2ce702[_0xa235('0xb')][_0x27e2d2['id']][_0xa235('0x30')][_0xa235('0x11')]=_0x5c8615;_0x2ce702[_0xa235('0x15')](_0x27e2d2['id']);_0x188ae8(_0x5c8615);});});}return this[_0xa235('0x2e')][_0xa235('0x32')](_0x27e2d2);};module[_0xa235('0x33')]=EmailChannel; \ No newline at end of file +var _0x540e=['mailAccounts','smtp','prototype','name','key','active','Imap','status','messageStatus','total','stringify','emit','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','handleImapEmail','bind','handleImapError','isNil','disabled','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','lodash','md5','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','./smtp'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x540e,0x11d));var _0xe540=function(_0x156c55,_0x10b85c){_0x156c55=_0x156c55-0x0;var _0x5e476f=_0x540e[_0x156c55];return _0x5e476f;};'use strict';var _=require(_0xe540('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xe540('0x1'));var Redis=require('ioredis');var config=require(_0xe540('0x2'));var logger=require(_0xe540('0x3'))(_0xe540('0x4'));config[_0xe540('0x5')]=_[_0xe540('0x6')](config[_0xe540('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xe540('0x7'));var EmailSmtp=require(_0xe540('0x8'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4de34a){logger['info']('start\x20email\x20channel');this[_0xe540('0x9')]=_0x4de34a['mailAccounts'];this['imapAccounts']={};this[_0xe540('0xa')]=new EmailSmtp();}EmailChannel[_0xe540('0xb')]['emit']=function(_0x116c20){var _0x1f5b76=this['mailAccounts'][_0x116c20];var _0x572f73={'id':_0x1f5b76['id'],'name':_0x1f5b76[_0xe540('0xc')],'key':_0x1f5b76[_0xe540('0xd')],'active':_0x1f5b76[_0xe540('0xe')],'Imap':{'status':_0x1f5b76[_0xe540('0xf')][_0xe540('0x10')],'messageStatus':_0x1f5b76[_0xe540('0xf')][_0xe540('0x11')],'total':_0x1f5b76['Imap'][_0xe540('0x12')]}};if(_['isNil'](md5Accounts[_0x116c20])){md5Accounts[_0x116c20]={};}var _0x3a1f16=md5(JSON[_0xe540('0x13')](_0x572f73));if(md5Accounts[_0x116c20][_0xe540('0x1')]!==_0x3a1f16){md5Accounts[_0x116c20][_0xe540('0x1')]=_0x3a1f16;io[_0xe540('0x14')]('mailAccount:update',_0x572f73);}};EmailChannel[_0xe540('0xb')][_0xe540('0x15')]=function(_0x2db82c){for(var _0x174b4f in _0x2db82c){if(_0x2db82c[_0xe540('0x16')](_0x174b4f)){if(_0x2db82c[_0x174b4f][_0xe540('0xf')]&&_0x2db82c[_0x174b4f]['active']){var _0x1c4396=_0x2db82c[_0x174b4f][_0xe540('0xf')];if(!this[_0xe540('0x17')][_0xe540('0x16')](_0x1c4396['id'])){this[_0xe540('0x17')][_0x1c4396['id']]=new EmailImap(_0x1c4396,_0x2db82c[_0x174b4f][_0xe540('0x4')]);this[_0xe540('0x17')][_0x1c4396['id']]['on'](_0xe540('0x18'),this[_0xe540('0x19')]['bind'](this,_0x174b4f));this[_0xe540('0x17')][_0x1c4396['id']]['on'](_0xe540('0x4'),this[_0xe540('0x1a')][_0xe540('0x1b')](this,_0x174b4f));this[_0xe540('0x17')][_0x1c4396['id']]['on']('end',this['handleImapEnd'][_0xe540('0x1b')](this,_0x174b4f));this[_0xe540('0x17')][_0x1c4396['id']]['on']('error',this[_0xe540('0x1c')][_0xe540('0x1b')](this,_0x174b4f));}}else{if(_[_0xe540('0x1d')](this['mailAccounts'][_0x174b4f][_0xe540('0xf')])){this[_0xe540('0x9')][_0x174b4f][_0xe540('0xf')]={};}this[_0xe540('0x9')][_0x174b4f]['Imap'][_0xe540('0x10')]=_0xe540('0x1e');this[_0xe540('0x9')][_0x174b4f][_0xe540('0xf')][_0xe540('0x11')]='';this[_0xe540('0x14')](_0x174b4f);}}}};EmailChannel[_0xe540('0xb')][_0xe540('0x19')]=function(_0x2a45fe,_0x13f1ec){if(this[_0xe540('0x9')][_0x2a45fe]){this['mailAccounts'][_0x2a45fe][_0xe540('0xf')]['status']=_0xe540('0x1f');this[_0xe540('0x9')][_0x2a45fe][_0xe540('0xf')]['messageStatus']=_0x13f1ec[_0xe540('0xc')];if(_0x13f1ec['messages']){this['mailAccounts'][_0x2a45fe][_0xe540('0xf')][_0xe540('0x12')]=_0x13f1ec[_0xe540('0x20')]['total'];}return this[_0xe540('0x14')](_0x2a45fe);}};EmailChannel[_0xe540('0xb')][_0xe540('0x1a')]=function(_0x778c98,_0xe5338b){logger[_0xe540('0x21')](_0xe540('0x22'),_0xe5338b['firstName'],_0xe5338b['lastName'],_0xe5338b[_0xe540('0x23')],_0x778c98);if(this[_0xe540('0x9')][_0x778c98]){return mailAccount['notify'](_0x778c98,_0xe5338b)[_0xe540('0x24')](function(_0x177678){if(_0x177678){logger[_0xe540('0x21')](_0xe540('0x25'));}})[_0xe540('0x26')](function(_0x31c568){logger[_0xe540('0x27')](_0xe540('0x28'),JSON[_0xe540('0x13')](_0x31c568));});}};EmailChannel['prototype'][_0xe540('0x29')]=function(_0x2d2926){if(this[_0xe540('0x9')][_0x2d2926]&&this[_0xe540('0x9')][_0x2d2926][_0xe540('0xf')]){if(this['imapAccounts'][this[_0xe540('0x9')][_0x2d2926]['Imap']['id']]){delete this[_0xe540('0x17')][this[_0xe540('0x9')][_0x2d2926][_0xe540('0xf')]['id']];}this[_0xe540('0x9')][_0x2d2926][_0xe540('0xf')]['lastSync']=moment();this[_0xe540('0x14')](_0x2d2926);}};EmailChannel[_0xe540('0xb')][_0xe540('0x1c')]=function(_0x392e2b,_0x3ad6b8){if(this[_0xe540('0x9')][_0x392e2b]){this[_0xe540('0x9')][_0x392e2b][_0xe540('0xf')][_0xe540('0x10')]=_0xe540('0x27');this[_0xe540('0x9')][_0x392e2b][_0xe540('0xf')]['messageStatus']=_0x3ad6b8;return this['emit'](_0x392e2b);}};EmailChannel[_0xe540('0xb')][_0xe540('0x2a')]=function(_0x435c70,_0x500ddf){return this['smtp'][_0xe540('0x2b')](_0x435c70,_0x500ddf);};EmailChannel['prototype'][_0xe540('0x2c')]=function(_0x4767d6){var _0x483d1e=this;if(this[_0xe540('0x9')][_0x4767d6['id']]){if(_[_0xe540('0x1d')](this[_0xe540('0x9')][_0x4767d6['id']][_0xe540('0x2d')])){this[_0xe540('0x9')][_0x4767d6['id']]['Smtp']={};}this['mailAccounts'][_0x4767d6['id']][_0xe540('0x2d')][_0xe540('0x2e')]=moment();return new BPromise(function(_0x3d5689,_0x5984ba){return _0x483d1e[_0xe540('0xa')][_0xe540('0x2f')](_0x4767d6)[_0xe540('0x24')](function(_0x1d80d9){_0x483d1e[_0xe540('0x9')][_0x4767d6['id']]['Smtp'][_0xe540('0x10')]=_0xe540('0x30');_0x483d1e['mailAccounts'][_0x4767d6['id']]['Smtp']['messageStatus']='';_0x483d1e[_0xe540('0x14')](_0x4767d6['id']);_0x3d5689(_0x1d80d9);})['catch'](function(_0x19d282){_0x483d1e[_0xe540('0x9')][_0x4767d6['id']][_0xe540('0x2d')][_0xe540('0x10')]=_0xe540('0x27');_0x483d1e[_0xe540('0x9')][_0x4767d6['id']][_0xe540('0x2d')]['messageStatus']=_0x19d282;_0x483d1e[_0xe540('0x14')](_0x4767d6['id']);_0x5984ba(_0x19d282);});});}return this['smtp'][_0xe540('0x2f')](_0x4767d6);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e021533..c03480a 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 _0x2aa7=['service','authentication','password','host','port','tls','autotls','required','user','getHost','handleReady','openBox','handleOpenBox','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','handleFetchEnd','emit','stringify','textCode','exports','util','imap','randomstring','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','once','end','handleEnd','error','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout'];(function(_0x51af34,_0xb71e25){var _0x3f8416=function(_0x3ce3bd){while(--_0x3ce3bd){_0x51af34['push'](_0x51af34['shift']());}};_0x3f8416(++_0xb71e25);}(_0x2aa7,0x11c));var _0x72aa=function(_0x374740,_0x9323de){_0x374740=_0x374740-0x0;var _0x2ced6a=_0x2aa7[_0x374740];return _0x2ced6a;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x72aa('0x0'));var Imap=require(_0x72aa('0x1'));var _=require('lodash');var rs=require(_0x72aa('0x2'));var simpleParser=require('mailparser')[_0x72aa('0x3')];var Iconv=require('iconv')[_0x72aa('0x4')];var EventEmitter=require(_0x72aa('0x5'))[_0x72aa('0x6')];var utils=require(_0x72aa('0x7'));var logger=require(_0x72aa('0x8'))(_0x72aa('0x9'));function EmailImap(_0x4d05c0,_0x462cb3){this[_0x72aa('0xa')]=_0x72aa('0xb');this[_0x72aa('0xc')]=this[_0x72aa('0xd')](_0x4d05c0,_0x462cb3);this['imap']=new Imap(this[_0x72aa('0xc')]);this[_0x72aa('0x1')]['once'](_0x72aa('0xe'),this['handleReady']['bind'](this));this[_0x72aa('0x1')][_0x72aa('0xf')](_0x72aa('0x10'),this[_0x72aa('0x11')]['bind'](this));this[_0x72aa('0x1')]['on'](_0x72aa('0x12'),this[_0x72aa('0x13')][_0x72aa('0x14')](this));this['imap'][_0x72aa('0x15')]();}util[_0x72aa('0x16')](EmailImap,EventEmitter);EmailImap[_0x72aa('0x17')][_0x72aa('0xd')]=function(_0x3f00ae,_0x2b855e){var _0x4a7e7c={'connTimeout':_0x3f00ae[_0x72aa('0x18')]?_0x3f00ae[_0x72aa('0x18')]*0x3e8:0x2710,'authTimeout':_0x3f00ae[_0x72aa('0x19')]?_0x3f00ae[_0x72aa('0x19')]*0x3e8:0x1388};if(_['isNil'](_0x3f00ae[_0x72aa('0x1a')])){if(_0x3f00ae[_0x72aa('0x1b')]){_0x4a7e7c['user']=_0x3f00ae['user'];_0x4a7e7c[_0x72aa('0x1c')]=_0x3f00ae[_0x72aa('0x1c')];}_0x4a7e7c[_0x72aa('0x1d')]=_0x3f00ae[_0x72aa('0x1d')];_0x4a7e7c['port']=_0x3f00ae[_0x72aa('0x1e')]||0x3e1;if(_0x3f00ae[_0x72aa('0x1f')]){_0x4a7e7c['tls']=!![];}else{_0x4a7e7c[_0x72aa('0x1f')]=![];_0x4a7e7c[_0x72aa('0x20')]=_0x72aa('0x21');}}else{_0x4a7e7c[_0x72aa('0x22')]=_0x3f00ae[_0x72aa('0x22')];_0x4a7e7c[_0x72aa('0x1c')]=_0x3f00ae['password'];_0x4a7e7c[_0x72aa('0x1d')]=utils[_0x72aa('0x23')](_0x3f00ae['service']);_0x4a7e7c['port']=0x3e1;_0x4a7e7c['tls']=!![];}_0x4a7e7c[_0x72aa('0x9')]=_0x2b855e||_0x3f00ae[_0x72aa('0x22')]||'anonymous@xcally.com';return _0x4a7e7c;};EmailImap['prototype'][_0x72aa('0x24')]=function(){this[_0x72aa('0x1')][_0x72aa('0x25')](this[_0x72aa('0xa')],![],this[_0x72aa('0x26')][_0x72aa('0x14')](this));};EmailImap[_0x72aa('0x17')][_0x72aa('0x26')]=function(_0x713997,_0xe23e05){if(_0x713997){this[_0x72aa('0x13')](_0x713997,!![]);}else{this['emit']('box',_0xe23e05);this[_0x72aa('0x27')]();}};EmailImap['prototype'][_0x72aa('0x28')]=function(_0x3d3fa3){if(_0x3d3fa3){this['handleError'](_0x3d3fa3,!![]);}else{this[_0x72aa('0x1')]['end']();}};EmailImap[_0x72aa('0x17')]['readUnseen']=function(){this[_0x72aa('0x1')][_0x72aa('0x29')]([_0x72aa('0x2a')],this['handleReadUnseen'][_0x72aa('0x14')](this));};EmailImap[_0x72aa('0x17')][_0x72aa('0x2b')]=function(_0x4d8c82,_0x388c7f){if(_0x4d8c82){this[_0x72aa('0x13')](_0x4d8c82,!![]);}else{if(_0x388c7f[_0x72aa('0x2c')]){try{var _0x18b4f3=this['imap'][_0x72aa('0x2d')](_0x388c7f,{'bodies':'','markSeen':!![]});_0x18b4f3['on'](_0x72aa('0x2e'),this[_0x72aa('0x2f')][_0x72aa('0x14')](this));_0x18b4f3[_0x72aa('0xf')]('error',this[_0x72aa('0x30')][_0x72aa('0x14')](this));_0x18b4f3[_0x72aa('0xf')](_0x72aa('0x10'),this['handleFetchEnd'][_0x72aa('0x14')](this));}catch(_0x4b9306){logger['error'](_0x4b9306);}}else{this[_0x72aa('0x1')][_0x72aa('0x31')](!![],this[_0x72aa('0x28')]['bind'](this));}}};EmailImap[_0x72aa('0x17')][_0x72aa('0x2f')]=function(_0x77af52,_0x54a7e2){_0x77af52['on'](_0x72aa('0x32'),this[_0x72aa('0x33')][_0x72aa('0x14')](this));_0x77af52[_0x72aa('0xf')](_0x72aa('0x34'),this['handleMessageAttributes']['bind'](this));_0x77af52['once']('end',this[_0x72aa('0x35')]['bind'](this));};EmailImap[_0x72aa('0x17')][_0x72aa('0x33')]=function(_0x2d54ea,_0x173de8){simpleParser(_0x2d54ea,{'Iconv':Iconv},this[_0x72aa('0x36')]['bind'](this));};EmailImap['prototype'][_0x72aa('0x37')]=function(_0x3a73cf){};EmailImap['prototype'][_0x72aa('0x35')]=function(){};EmailImap[_0x72aa('0x17')][_0x72aa('0x36')]=function(_0x403720,_0x484f49){if(_0x403720){logger['error'](_0x403720);}else{var _0x7aeb95=this;utils[_0x72aa('0x38')](this[_0x72aa('0xc')],_0x484f49,function(_0x480918){_0x7aeb95['emit'](_0x72aa('0x9'),_0x480918);});}};EmailImap['prototype'][_0x72aa('0x39')]=function(){this[_0x72aa('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x72aa('0x14')](this));};EmailImap['prototype'][_0x72aa('0x30')]=function(_0x3d2f69){this[_0x72aa('0x13')](_0x3d2f69);this[_0x72aa('0x1')][_0x72aa('0x31')](!![],this[_0x72aa('0x28')][_0x72aa('0x14')](this));};EmailImap[_0x72aa('0x17')][_0x72aa('0x11')]=function(){this[_0x72aa('0x3a')](_0x72aa('0x10'));};EmailImap['prototype'][_0x72aa('0x13')]=function(_0x2067f8,_0x34b43a){logger[_0x72aa('0x12')](_0x72aa('0x13'),this['account'][_0x72aa('0x9')],JSON[_0x72aa('0x3b')](_0x2067f8));var _0x3c0196='';if(_0x2067f8){if(_0x2067f8[_0x72aa('0x3c')]){_0x3c0196=_0x2067f8['textCode'];}else{for(var _0x1a2f44 in _0x2067f8){if(_0x2067f8['hasOwnProperty'](_0x1a2f44)){_0x3c0196+=_['upperFirst'](_0x1a2f44)+':\x20'+_0x2067f8[_0x1a2f44]+'\x0a';}}}}if(_0x34b43a){this['imap']['end']();}else{this[_0x72aa('0x3a')](_0x72aa('0x12'),_0x3c0196);this[_0x72aa('0x3a')](_0x72aa('0x10'));}};module[_0x72aa('0x3d')]=EmailImap; \ No newline at end of file +var _0x9744=['handleFetchError','handleFetchEnd','body','handleMessageBody','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','emit','closeBox','stringify','textCode','hasOwnProperty','upperFirst','path','util','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','imap','account','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','password','host','port','tls','autotls','required','user','getHost','anonymous@xcally.com','openBox','handleOpenBox','box','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','once'];(function(_0x49b523,_0x30ad2f){var _0x5c891f=function(_0x554e2f){while(--_0x554e2f){_0x49b523['push'](_0x49b523['shift']());}};_0x5c891f(++_0x30ad2f);}(_0x9744,0x1ea));var _0x4974=function(_0x10a9ba,_0x3896a1){_0x10a9ba=_0x10a9ba-0x0;var _0x4e7305=_0x9744[_0x10a9ba];return _0x4e7305;};'use strict';var fs=require('fs');var path=require(_0x4974('0x0'));var util=require(_0x4974('0x1'));var Imap=require('imap');var _=require(_0x4974('0x2'));var rs=require(_0x4974('0x3'));var simpleParser=require(_0x4974('0x4'))[_0x4974('0x5')];var Iconv=require(_0x4974('0x6'))[_0x4974('0x7')];var EventEmitter=require(_0x4974('0x8'))[_0x4974('0x9')];var utils=require(_0x4974('0xa'));var logger=require(_0x4974('0xb'))(_0x4974('0xc'));function EmailImap(_0x29b8dd,_0x3b5e06){this[_0x4974('0xd')]=_0x4974('0xe');this['account']=this[_0x4974('0xf')](_0x29b8dd,_0x3b5e06);this[_0x4974('0x10')]=new Imap(this[_0x4974('0x11')]);this[_0x4974('0x10')]['once'](_0x4974('0x12'),this[_0x4974('0x13')][_0x4974('0x14')](this));this['imap']['once'](_0x4974('0x15'),this[_0x4974('0x16')][_0x4974('0x14')](this));this[_0x4974('0x10')]['on'](_0x4974('0x17'),this[_0x4974('0x18')]['bind'](this));this[_0x4974('0x10')][_0x4974('0x19')]();}util[_0x4974('0x1a')](EmailImap,EventEmitter);EmailImap[_0x4974('0x1b')][_0x4974('0xf')]=function(_0x30f063,_0x4d8f9a){var _0x374e7c={'connTimeout':_0x30f063[_0x4974('0x1c')]?_0x30f063[_0x4974('0x1c')]*0x3e8:0x2710,'authTimeout':_0x30f063[_0x4974('0x1d')]?_0x30f063[_0x4974('0x1d')]*0x3e8:0x1388};if(_[_0x4974('0x1e')](_0x30f063[_0x4974('0x1f')])){if(_0x30f063[_0x4974('0x20')]){_0x374e7c['user']=_0x30f063['user'];_0x374e7c['password']=_0x30f063[_0x4974('0x21')];}_0x374e7c[_0x4974('0x22')]=_0x30f063[_0x4974('0x22')];_0x374e7c[_0x4974('0x23')]=_0x30f063[_0x4974('0x23')]||0x3e1;if(_0x30f063[_0x4974('0x24')]){_0x374e7c[_0x4974('0x24')]=!![];}else{_0x374e7c[_0x4974('0x24')]=![];_0x374e7c[_0x4974('0x25')]=_0x4974('0x26');}}else{_0x374e7c[_0x4974('0x27')]=_0x30f063[_0x4974('0x27')];_0x374e7c[_0x4974('0x21')]=_0x30f063[_0x4974('0x21')];_0x374e7c[_0x4974('0x22')]=utils[_0x4974('0x28')](_0x30f063[_0x4974('0x1f')]);_0x374e7c[_0x4974('0x23')]=0x3e1;_0x374e7c[_0x4974('0x24')]=!![];}_0x374e7c[_0x4974('0xc')]=_0x4d8f9a||_0x30f063[_0x4974('0x27')]||_0x4974('0x29');return _0x374e7c;};EmailImap[_0x4974('0x1b')]['handleReady']=function(){this[_0x4974('0x10')][_0x4974('0x2a')](this[_0x4974('0xd')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x4974('0x1b')][_0x4974('0x2b')]=function(_0x3b933d,_0x166076){if(_0x3b933d){this[_0x4974('0x18')](_0x3b933d,!![]);}else{this['emit'](_0x4974('0x2c'),_0x166076);this['readUnseen']();}};EmailImap[_0x4974('0x1b')][_0x4974('0x2d')]=function(_0x1e3b7f){if(_0x1e3b7f){this[_0x4974('0x18')](_0x1e3b7f,!![]);}else{this[_0x4974('0x10')][_0x4974('0x15')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x4974('0x10')][_0x4974('0x2e')]([_0x4974('0x2f')],this['handleReadUnseen'][_0x4974('0x14')](this));};EmailImap[_0x4974('0x1b')][_0x4974('0x30')]=function(_0x95145b,_0x2783fe){if(_0x95145b){this[_0x4974('0x18')](_0x95145b,!![]);}else{if(_0x2783fe[_0x4974('0x31')]){try{var _0x250bbd=this['imap'][_0x4974('0x32')](_0x2783fe,{'bodies':'','markSeen':!![]});_0x250bbd['on'](_0x4974('0x33'),this[_0x4974('0x34')]['bind'](this));_0x250bbd[_0x4974('0x35')]('error',this[_0x4974('0x36')][_0x4974('0x14')](this));_0x250bbd[_0x4974('0x35')]('end',this[_0x4974('0x37')][_0x4974('0x14')](this));}catch(_0xcb3bb9){logger[_0x4974('0x17')](_0xcb3bb9);}}else{this[_0x4974('0x10')]['closeBox'](!![],this[_0x4974('0x2d')]['bind'](this));}}};EmailImap[_0x4974('0x1b')]['handleFetchMessage']=function(_0xb5cf55,_0x45b6d4){_0xb5cf55['on'](_0x4974('0x38'),this[_0x4974('0x39')][_0x4974('0x14')](this));_0xb5cf55[_0x4974('0x35')]('attributes',this['handleMessageAttributes']['bind'](this));_0xb5cf55[_0x4974('0x35')](_0x4974('0x15'),this[_0x4974('0x3a')][_0x4974('0x14')](this));};EmailImap[_0x4974('0x1b')]['handleMessageBody']=function(_0x22b812,_0x9aeb98){simpleParser(_0x22b812,{'Iconv':Iconv},this[_0x4974('0x3b')][_0x4974('0x14')](this));};EmailImap['prototype'][_0x4974('0x3c')]=function(_0xd6fe9f){};EmailImap[_0x4974('0x1b')][_0x4974('0x3a')]=function(){};EmailImap[_0x4974('0x1b')][_0x4974('0x3b')]=function(_0x16ec8c,_0x44b0d1){if(_0x16ec8c){logger['error'](_0x16ec8c);}else{var _0x3be12b=this;utils[_0x4974('0x3d')](this['account'],_0x44b0d1,function(_0x2ece99){_0x3be12b[_0x4974('0x3e')](_0x4974('0xc'),_0x2ece99);});}};EmailImap[_0x4974('0x1b')][_0x4974('0x37')]=function(){this[_0x4974('0x10')][_0x4974('0x3f')](!![],this[_0x4974('0x2d')][_0x4974('0x14')](this));};EmailImap[_0x4974('0x1b')][_0x4974('0x36')]=function(_0x25e038){this['handleError'](_0x25e038);this[_0x4974('0x10')][_0x4974('0x3f')](!![],this[_0x4974('0x2d')][_0x4974('0x14')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x4974('0x3e')](_0x4974('0x15'));};EmailImap[_0x4974('0x1b')][_0x4974('0x18')]=function(_0x2dc8a2,_0x52129a){logger[_0x4974('0x17')](_0x4974('0x18'),this[_0x4974('0x11')][_0x4974('0xc')],JSON[_0x4974('0x40')](_0x2dc8a2));var _0x54f12e='';if(_0x2dc8a2){if(_0x2dc8a2[_0x4974('0x41')]){_0x54f12e=_0x2dc8a2[_0x4974('0x41')];}else{for(var _0x592e14 in _0x2dc8a2){if(_0x2dc8a2[_0x4974('0x42')](_0x592e14)){_0x54f12e+=_[_0x4974('0x43')](_0x592e14)+':\x20'+_0x2dc8a2[_0x592e14]+'\x0a';}}}}if(_0x52129a){this[_0x4974('0x10')][_0x4974('0x15')]();}else{this[_0x4974('0x3e')](_0x4974('0x17'),_0x54f12e);this['emit'](_0x4974('0x15'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 851cd9f..28fa58c 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 _0xd3d7=['nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','toString','bluebird'];(function(_0x3eb350,_0x40205e){var _0x175e2d=function(_0x5a81f6){while(--_0x5a81f6){_0x3eb350['push'](_0x3eb350['shift']());}};_0x175e2d(++_0x40205e);}(_0xd3d7,0x170));var _0x7d3d=function(_0xb055a4,_0x1cc937){_0xb055a4=_0xb055a4-0x0;var _0x256dae=_0xd3d7[_0xb055a4];return _0x256dae;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x7d3d('0x0'));var inlineBase64=require(_0x7d3d('0x1'));function EmailSmtp(){}EmailSmtp[_0x7d3d('0x2')][_0x7d3d('0x3')]=function(_0x2cb2fe,_0x6e0ee4){return new BPromise(function(_0x273505,_0x25b8d2){var _0x417d1a=nodemailer[_0x7d3d('0x4')](_0x2cb2fe);_0x417d1a[_0x7d3d('0x5')](_0x7d3d('0x6'),inlineBase64());_0x417d1a[_0x7d3d('0x7')](_0x6e0ee4,function(_0x5f254b,_0x1fd71c){if(_0x5f254b){_0x25b8d2(_0x5f254b[_0x7d3d('0x8')]());}else{_0x273505(_0x1fd71c);}});});};EmailSmtp[_0x7d3d('0x2')]['verify']=function(_0x49bf3b){return new BPromise(function(_0x3d39be,_0x5d2752){var _0x151958=nodemailer[_0x7d3d('0x4')](_0x49bf3b);_0x151958['verify'](function(_0x34e8eb,_0x3a0260){if(_0x34e8eb){_0x5d2752(_0x34e8eb['toString']());}else{if(_0x3a0260){_0x3d39be(_0x3a0260);}else{_0x5d2752('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x66aa=['toString','verify','Not\x20verifired','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail'];(function(_0x1fee59,_0x393c7b){var _0x4ab835=function(_0x383ddf){while(--_0x383ddf){_0x1fee59['push'](_0x1fee59['shift']());}};_0x4ab835(++_0x393c7b);}(_0x66aa,0xb7));var _0xa66a=function(_0x137c33,_0x27a274){_0x137c33=_0x137c33-0x0;var _0x23aa2d=_0x66aa[_0x137c33];return _0x23aa2d;};'use strict';var nodemailer=require(_0xa66a('0x0'));var BPromise=require(_0xa66a('0x1'));var inlineBase64=require(_0xa66a('0x2'));function EmailSmtp(){}EmailSmtp[_0xa66a('0x3')][_0xa66a('0x4')]=function(_0x51a0a7,_0x5416f7){return new BPromise(function(_0x58c66e,_0x4ce641){var _0x88dbf3=nodemailer[_0xa66a('0x5')](_0x51a0a7);_0x88dbf3[_0xa66a('0x6')](_0xa66a('0x7'),inlineBase64());_0x88dbf3[_0xa66a('0x8')](_0x5416f7,function(_0x58d725,_0x270d26){if(_0x58d725){_0x4ce641(_0x58d725[_0xa66a('0x9')]());}else{_0x58c66e(_0x270d26);}});});};EmailSmtp[_0xa66a('0x3')][_0xa66a('0xa')]=function(_0x1db75e){return new BPromise(function(_0x3873a8,_0x445ff7){var _0x4b7563=nodemailer['createTransport'](_0x1db75e);_0x4b7563[_0xa66a('0xa')](function(_0x8db2b4,_0x14d1ed){if(_0x8db2b4){_0x445ff7(_0x8db2b4[_0xa66a('0x9')]());}else{if(_0x14d1ed){_0x3873a8(_0x14d1ed);}else{_0x445ff7(_0xa66a('0xb'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a971d3f..b6e0903 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 _0x6edc=['isAutoreply','parser','from','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook.office365.com','lodash','moment','randomstring','path','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','indexOf','split','slice','length','generate','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x2719ea[_0xc6ed('0xf')](0x0,-0x1)['join']('\x20'):_0x31049e[_0xc6ed('0xc')];}return'Anonymous';}function getLastName(_0x470cbf){var _0x39d8dd=_[_0xc6ed('0x7')](_0x470cbf['value']);if(_0x39d8dd&&_0x39d8dd[_0xc6ed('0xc')]){var _0x282ea6=_0x39d8dd[_0xc6ed('0xc')]['split'](/\s+/);return _0x282ea6[_0xc6ed('0x10')]>0x1?_0x282ea6['pop']():'';}return'';}function getMails(_0x130bff,_0x35e1d8){var _0x16ee41='';for(var _0x5346fe=0x0;_0x5346fe<_0x35e1d8[_0xc6ed('0x8')][_0xc6ed('0x10')];_0x5346fe+=0x1){if(_0x35e1d8[_0xc6ed('0x8')][_0x5346fe][_0xc6ed('0x9')]!==_0x130bff){if(!_['isEmpty'](_0x16ee41)){_0x16ee41+=',';}_0x16ee41+=_0x35e1d8['value'][_0x5346fe][_0xc6ed('0xc')]||_0x35e1d8[_0xc6ed('0x8')][_0x5346fe][_0xc6ed('0x9')]||'';_0x16ee41+='\x20<';_0x16ee41+=_0x35e1d8[_0xc6ed('0x8')][_0x5346fe][_0xc6ed('0x9')]?_0x35e1d8[_0xc6ed('0x8')][_0x5346fe][_0xc6ed('0x9')]:_0xc6ed('0xa')+random[_0xc6ed('0x11')](0x6)+_0xc6ed('0xb');_0x16ee41+='>';}}return _0x16ee41;}function parseEmail(_0x2fd9e9,_0x776f5,_0x2664a9){if(_0x776f5[_0xc6ed('0x12')]){var _0x587699=/)<[^<]*)*<\/script>/gi;while(_0x587699['test'](_0x776f5[_0xc6ed('0x12')])){_0x776f5['html']=_0x776f5['html'][_0xc6ed('0x13')](_0x587699,'');}if(_0x776f5['html'][_0xc6ed('0x14')](_0xc6ed('0x15'))){var _0x4682c5=[];_0x776f5['attachments']['forEach'](_0x4b5d2d=>{_0x4682c5[_0xc6ed('0x16')](_0x4b5d2d[_0xc6ed('0x17')]);});var _0x34f312=/]+>/g;var _0x33a3c2=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1c78bf=_0x776f5[_0xc6ed('0x12')][_0xc6ed('0x13')](_0x33a3c2,_0xc6ed('0x18'));var _0x10e2a6=_0x1c78bf[_0xc6ed('0x13')](_0x34f312,_0xc6ed('0x19'));for(let _0x1abee=0x0;_0x1abee<_0x4682c5['length'];_0x1abee++){var _0x499163=_0x10e2a6[_0xc6ed('0x13')](_0xc6ed('0x19'),_0xc6ed('0x1a')+_0x4682c5[_0x1abee]+_0xc6ed('0x1b'));_0x10e2a6=_0x499163;}_0x776f5['html']=_0x10e2a6;}_0x2664a9[_0xc6ed('0x1c')]=_0x776f5[_0xc6ed('0x12')];}else{_0x2664a9[_0xc6ed('0x1c')]=_0x776f5[_0xc6ed('0x1d')];}if(_0x2664a9[_0xc6ed('0x1c')]){_0x2664a9['body']=_0x2664a9[_0xc6ed('0x1c')][_0xc6ed('0x13')](/0x0){var _0x3ef554=[_0xc6ed('0x2e'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x471582=0x0;_0x471582<_0x776f5[_0xc6ed('0x2d')][_0xc6ed('0x10')];_0x471582++){var _0x22b53b=_[_0xc6ed('0xd')](_0x3ef554,_0x776f5[_0xc6ed('0x2d')][_0x471582][_0xc6ed('0x2f')]);if(_0x22b53b>=0x0){_0x2664a9[_0xc6ed('0x30')]=!![];}}}return _0x2664a9;}exports[_0xc6ed('0x31')]=function(_0x447112,_0x5d5afc,_0x384851){var _0x1686b4={'from':getAddress(_0x5d5afc['from']),'firstName':getFirstName(_0x5d5afc[_0xc6ed('0x32')]),'lastName':getLastName(_0x5d5afc['from']),'mapKey':_0xc6ed('0x5'),'message':{'from':getMails(_0x447112[_0xc6ed('0x5')],_0x5d5afc[_0xc6ed('0x32')]),'to':_0x447112[_0xc6ed('0x5')],'cc':'','subject':_0x5d5afc['subject']||'','messageId':_0x5d5afc[_0xc6ed('0x33')],'inReplyTo':_0x5d5afc[_0xc6ed('0x34')],'sentAt':moment(_0x5d5afc['date'])[_0xc6ed('0x26')](_0xc6ed('0x35')),'attach':![],'attachments':[]}};if(!_0x5d5afc['html']&&!_0x5d5afc[_0xc6ed('0x1d')]){var _0x12c63e=_[_0xc6ed('0x36')](_0x5d5afc[_0xc6ed('0x24')],{'contentType':_0xc6ed('0x37')});if(_0x12c63e[_0xc6ed('0x10')]){logger[_0xc6ed('0x38')](util[_0xc6ed('0x26')](_0xc6ed('0x39'),_0x5d5afc['messageId']));tnef[_0xc6ed('0x3a')](_[_0xc6ed('0x3b')](_0x12c63e)[_0xc6ed('0x3c')],function(_0x5735fe,_0x2bd58f){if(_0x2bd58f){_0x5d5afc[_0xc6ed('0x12')]=_0x2bd58f[_0xc6ed('0x3d')]||_0xc6ed('0x3e');if(_0x2bd58f[_0xc6ed('0x3f')]){for(var _0x448577=0x0;_0x448577<_0x2bd58f['Attachments'][_0xc6ed('0x10')];_0x448577++){var _0x1a8f0c=_0x2bd58f['Attachments'][_0x448577];_0x1686b4['message'][_0xc6ed('0x24')]['push']({'filename':_0x1a8f0c[_0xc6ed('0x40')],'content':Buffer[_0xc6ed('0x32')](_0x1a8f0c[_0xc6ed('0x41')])});}}}_0x384851(parseEmail(_0x447112,_0x5d5afc,_0x1686b4));});}else{_0x5d5afc[_0xc6ed('0x12')]=_0xc6ed('0x3e');_0x384851(parseEmail(_0x447112,_0x5d5afc,_0x1686b4));}}else{_0x384851(parseEmail(_0x447112,_0x5d5afc,_0x1686b4));}};exports[_0xc6ed('0x42')]=function(_0x466519){switch(_0x466519){case _0xc6ed('0x43'):return _0xc6ed('0x44');case _0xc6ed('0x45'):return _0xc6ed('0x46');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return _0xc6ed('0x47');}return'127.0.0.1';}; \ No newline at end of file +var _0x1410=['gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','node-tnef','email','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','join','length','pop','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','isEmpty','originCc','bcc','attach','type','attachment','attachment-','format','now','server/files/attachments/','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','parser','from','subject','messageId','inReplyTo','date','application/ms-tnef','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost'];(function(_0x1af71a,_0x5ea38f){var _0x3f5fdb=function(_0x53dc32){while(--_0x53dc32){_0x1af71a['push'](_0x1af71a['shift']());}};_0x3f5fdb(++_0x5ea38f);}(_0x1410,0x130));var _0x0141=function(_0x5824c1,_0x3c61f1){_0x5824c1=_0x5824c1-0x0;var _0x397d9d=_0x1410[_0x5824c1];return _0x397d9d;};'use strict';var _=require(_0x0141('0x0'));var moment=require(_0x0141('0x1'));var random=require(_0x0141('0x2'));var fs=require('fs');var path=require(_0x0141('0x3'));var util=require('util');var tnef=require(_0x0141('0x4'));var logger=require('../../../config/logger')(_0x0141('0x5'));var config=require('../../../config/environment');function getAddress(_0x194c72){var _0x454af1=_[_0x0141('0x6')](_0x194c72[_0x0141('0x7')]);return _0x454af1&&_0x454af1[_0x0141('0x8')]?_0x454af1[_0x0141('0x8')]:_0x0141('0x9')+random[_0x0141('0xa')](0x6)+_0x0141('0xb');}function getFirstName(_0x57cfbb){var _0x19ff64=_[_0x0141('0x6')](_0x57cfbb[_0x0141('0x7')]);if(_0x19ff64&&_0x19ff64[_0x0141('0xc')]){if(_0x19ff64[_0x0141('0xc')]==_0x19ff64[_0x0141('0x8')]){return _0x19ff64[_0x0141('0xc')][_0x0141('0xd')](0x0,_0x19ff64['name'][_0x0141('0xe')]('@'));}var _0x3b7718=_0x19ff64[_0x0141('0xc')][_0x0141('0xf')](/\s+/);return _0x3b7718['length']>0x1?_0x3b7718['slice'](0x0,-0x1)[_0x0141('0x10')]('\x20'):_0x19ff64[_0x0141('0xc')];}return'Anonymous';}function getLastName(_0x278f18){var _0x5d8795=_[_0x0141('0x6')](_0x278f18[_0x0141('0x7')]);if(_0x5d8795&&_0x5d8795[_0x0141('0xc')]){var _0x51a855=_0x5d8795[_0x0141('0xc')]['split'](/\s+/);return _0x51a855[_0x0141('0x11')]>0x1?_0x51a855[_0x0141('0x12')]():'';}return'';}function getMails(_0x345fbd,_0x310e2b){var _0x3bf5b4='';for(var _0x3c91e8=0x0;_0x3c91e8<_0x310e2b['value']['length'];_0x3c91e8+=0x1){if(_0x310e2b[_0x0141('0x7')][_0x3c91e8][_0x0141('0x8')]!==_0x345fbd){if(!_['isEmpty'](_0x3bf5b4)){_0x3bf5b4+=',';}_0x3bf5b4+=_0x310e2b[_0x0141('0x7')][_0x3c91e8][_0x0141('0xc')]||_0x310e2b[_0x0141('0x7')][_0x3c91e8][_0x0141('0x8')]||'';_0x3bf5b4+='\x20<';_0x3bf5b4+=_0x310e2b['value'][_0x3c91e8][_0x0141('0x8')]?_0x310e2b[_0x0141('0x7')][_0x3c91e8]['address']:_0x0141('0x9')+random[_0x0141('0xa')](0x6)+_0x0141('0xb');_0x3bf5b4+='>';}}return _0x3bf5b4;}function parseEmail(_0x30a141,_0x316f70,_0x13ac96){if(_0x316f70['html']){var _0x21d8fc=/)<[^<]*)*<\/script>/gi;while(_0x21d8fc[_0x0141('0x13')](_0x316f70[_0x0141('0x14')])){_0x316f70[_0x0141('0x14')]=_0x316f70[_0x0141('0x14')][_0x0141('0x15')](_0x21d8fc,'');}if(_0x316f70[_0x0141('0x14')][_0x0141('0x16')](_0x0141('0x17'))){var _0x3869b7=[];_0x316f70[_0x0141('0x18')][_0x0141('0x19')](_0x59bdbd=>{_0x3869b7[_0x0141('0x1a')](_0x59bdbd[_0x0141('0x1b')]);});var _0xb80072=/]+>/g;var _0x3e242c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xcc5658=_0x316f70['html'][_0x0141('0x15')](_0x3e242c,_0x0141('0x1c'));var _0x2bb7c4=_0xcc5658['replace'](_0xb80072,_0x0141('0x1d'));for(let _0x4d1cb3=0x0;_0x4d1cb3<_0x3869b7[_0x0141('0x11')];_0x4d1cb3++){var _0x13d8d1=_0x2bb7c4[_0x0141('0x15')](_0x0141('0x1d'),_0x0141('0x1e')+_0x3869b7[_0x4d1cb3]+_0x0141('0x1f'));_0x2bb7c4=_0x13d8d1;}_0x316f70[_0x0141('0x14')]=_0x2bb7c4;}_0x13ac96[_0x0141('0x20')]=_0x316f70[_0x0141('0x14')];}else{_0x13ac96[_0x0141('0x20')]=_0x316f70[_0x0141('0x21')];}if(_0x13ac96[_0x0141('0x20')]){_0x13ac96[_0x0141('0x20')]=_0x13ac96['body'][_0x0141('0x15')](/0x0){var _0x1d545b=[_0x0141('0x31'),_0x0141('0x32'),_0x0141('0x33')];for(var _0x37c228=0x0;_0x37c228<_0x316f70['headerLines'][_0x0141('0x11')];_0x37c228++){var _0x56ac88=_[_0x0141('0xe')](_0x1d545b,_0x316f70['headerLines'][_0x37c228]['line']);if(_0x56ac88>=0x0){_0x13ac96['isAutoreply']=!![];}}}return _0x13ac96;}exports[_0x0141('0x34')]=function(_0x2579df,_0x210a8c,_0x5dfd8a){var _0x8e0b85={'from':getAddress(_0x210a8c[_0x0141('0x35')]),'firstName':getFirstName(_0x210a8c[_0x0141('0x35')]),'lastName':getLastName(_0x210a8c[_0x0141('0x35')]),'mapKey':'email','message':{'from':getMails(_0x2579df[_0x0141('0x5')],_0x210a8c[_0x0141('0x35')]),'to':_0x2579df[_0x0141('0x5')],'cc':'','subject':_0x210a8c[_0x0141('0x36')]||'','messageId':_0x210a8c[_0x0141('0x37')],'inReplyTo':_0x210a8c[_0x0141('0x38')],'sentAt':moment(_0x210a8c[_0x0141('0x39')])[_0x0141('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x210a8c[_0x0141('0x14')]&&!_0x210a8c[_0x0141('0x21')]){var _0xbacb30=_['filter'](_0x210a8c[_0x0141('0x18')],{'contentType':_0x0141('0x3a')});if(_0xbacb30[_0x0141('0x11')]){logger['info'](util[_0x0141('0x2b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x210a8c[_0x0141('0x37')]));tnef['parseBuffer'](_[_0x0141('0x3b')](_0xbacb30)['content'],function(_0xaa2b6d,_0xf2ef01){if(_0xf2ef01){_0x210a8c[_0x0141('0x14')]=_0xf2ef01[_0x0141('0x3c')]||_0x0141('0x3d');if(_0xf2ef01['Attachments']){for(var _0x3890ef=0x0;_0x3890ef<_0xf2ef01[_0x0141('0x3e')][_0x0141('0x11')];_0x3890ef++){var _0x5edf0a=_0xf2ef01[_0x0141('0x3e')][_0x3890ef];_0x8e0b85[_0x0141('0x22')][_0x0141('0x18')]['push']({'filename':_0x5edf0a[_0x0141('0x3f')],'content':Buffer['from'](_0x5edf0a[_0x0141('0x40')])});}}}_0x5dfd8a(parseEmail(_0x2579df,_0x210a8c,_0x8e0b85));});}else{_0x210a8c[_0x0141('0x14')]=_0x0141('0x3d');_0x5dfd8a(parseEmail(_0x2579df,_0x210a8c,_0x8e0b85));}}else{_0x5dfd8a(parseEmail(_0x2579df,_0x210a8c,_0x8e0b85));}};exports[_0x0141('0x41')]=function(_0x5c8f64){switch(_0x5c8f64){case _0x0141('0x42'):return _0x0141('0x43');case _0x0141('0x44'):return _0x0141('0x45');case _0x0141('0x46'):return _0x0141('0x47');case _0x0141('0x48'):return'outlook.office365.com';}return _0x0141('0x49');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 9f9561b..03994e8 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 _0x5f9c=['exports','lodash','name','key','active','Imap','Smtp'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5f9c,0xda));var _0xc5f9=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x5f9c[_0x4eafed];return _0x159c85;};'use strict';var _=require(_0xc5f9('0x0'));function MailAccount(_0x46483a){this['id']=_0x46483a['id']||0x0;this[_0xc5f9('0x1')]=_0x46483a[_0xc5f9('0x1')]||'Service';this[_0xc5f9('0x2')]=_0x46483a[_0xc5f9('0x2')]||'SERV';this['active']=_0x46483a[_0xc5f9('0x3')]||![];this['Imap']=_0x46483a[_0xc5f9('0x4')]||[];this[_0xc5f9('0x5')]=_0x46483a['Smtp']||[];}module[_0xc5f9('0x6')]=MailAccount; \ No newline at end of file +var _0x38c1=['Imap','Smtp','exports','lodash','name','Service','key','SERV','active'];(function(_0x35b89c,_0x5ef9c6){var _0x3e1549=function(_0x488d6b){while(--_0x488d6b){_0x35b89c['push'](_0x35b89c['shift']());}};_0x3e1549(++_0x5ef9c6);}(_0x38c1,0x111));var _0x138c=function(_0x277415,_0x38968b){_0x277415=_0x277415-0x0;var _0x376342=_0x38c1[_0x277415];return _0x376342;};'use strict';var _=require(_0x138c('0x0'));function MailAccount(_0x52d844){this['id']=_0x52d844['id']||0x0;this[_0x138c('0x1')]=_0x52d844[_0x138c('0x1')]||_0x138c('0x2');this['key']=_0x52d844[_0x138c('0x3')]||_0x138c('0x4');this[_0x138c('0x5')]=_0x52d844['active']||![];this[_0x138c('0x6')]=_0x52d844[_0x138c('0x6')]||[];this[_0x138c('0x7')]=_0x52d844[_0x138c('0x7')]||[];}module[_0x138c('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 5995c5e..43aa74d 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 _0xb77b=['prototype','initMailAccounts','mailAccounts','length','isUndefined','merge','exports','lodash','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x4af356,_0x298d74){var _0x40566=function(_0x3cd2b2){while(--_0x3cd2b2){_0x4af356['push'](_0x4af356['shift']());}};_0x40566(++_0x298d74);}(_0xb77b,0xf9));var _0xbb77=function(_0x46e9f2,_0xb8c5f9){_0x46e9f2=_0x46e9f2-0x0;var _0x2ff437=_0xb77b[_0x46e9f2];return _0x2ff437;};'use strict';var _=require(_0xbb77('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x13ef89,_0x4ec5c0,_0x4b5a9e){var _0x242676=_[_0xbb77('0x1')](_0x13ef89,function(_0x53572e,_0x138d99){return _0x53572e[_0x4b5a9e];});for(var _0xebc58e in _0x4ec5c0){if(_0x4ec5c0[_0xbb77('0x2')](_0xebc58e)){if(!_0x242676[_0xebc58e]){delete _0x4ec5c0[_0xebc58e];}}}}Realtime['prototype'][_0xbb77('0x3')]=function(_0x254293,_0x40d640){for(var _0xef3e0e in _0x40d640){if(_0x254293['hasOwnProperty'](_0xef3e0e)){_0x254293[_0xef3e0e]=_0x40d640[_0xef3e0e];}}};Realtime[_0xbb77('0x4')][_0xbb77('0x5')]=function(){var _0x306185=this;return function(_0x34ef2a){if(_0x34ef2a){freeIsNotKey(_0x34ef2a,_0x306185[_0xbb77('0x6')],'id');for(var _0x571ecf=0x0,_0x66add0={},_0x329656={};_0x571ecf<_0x34ef2a[_0xbb77('0x7')];_0x571ecf+=0x1){_0x66add0=_0x34ef2a[_0x571ecf];if(_[_0xbb77('0x8')](_0x306185['mailAccounts'][_0x66add0['id']])){_0x306185[_0xbb77('0x6')][_0x66add0['id']]=new MailAccount(_0x66add0);}else{_[_0xbb77('0x9')](_0x306185[_0xbb77('0x6')][_0x66add0['id']],_0x66add0);}}}return _0x306185[_0xbb77('0x6')];};};module[_0xbb77('0xa')]=Realtime; \ No newline at end of file +var _0x64db=['hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x5723b6,_0x115a57){var _0xaa8065=function(_0x1e2613){while(--_0x1e2613){_0x5723b6['push'](_0x5723b6['shift']());}};_0xaa8065(++_0x115a57);}(_0x64db,0x1bf));var _0xb64d=function(_0xa86b2e,_0x428354){_0xa86b2e=_0xa86b2e-0x0;var _0x34ba67=_0x64db[_0xa86b2e];return _0x34ba67;};'use strict';var _=require('lodash');var MailAccount=require(_0xb64d('0x0'));var Realtime=function(){this[_0xb64d('0x1')]={};};function freeIsNotKey(_0x3a51fd,_0x36aed9,_0x4d064d){var _0x213eea=_[_0xb64d('0x2')](_0x3a51fd,function(_0x5c633c,_0x5cc907){return _0x5c633c[_0x4d064d];});for(var _0x316034 in _0x36aed9){if(_0x36aed9[_0xb64d('0x3')](_0x316034)){if(!_0x213eea[_0x316034]){delete _0x36aed9[_0x316034];}}}}Realtime[_0xb64d('0x4')]['mergeFromDatabase']=function(_0x4d3c95,_0x4f8fd2){for(var _0x5dde1d in _0x4f8fd2){if(_0x4d3c95[_0xb64d('0x3')](_0x5dde1d)){_0x4d3c95[_0x5dde1d]=_0x4f8fd2[_0x5dde1d];}}};Realtime[_0xb64d('0x4')][_0xb64d('0x5')]=function(){var _0x21c07c=this;return function(_0x2cb939){if(_0x2cb939){freeIsNotKey(_0x2cb939,_0x21c07c['mailAccounts'],'id');for(var _0x46cc6d=0x0,_0x1c6539={},_0x30c684={};_0x46cc6d<_0x2cb939[_0xb64d('0x6')];_0x46cc6d+=0x1){_0x1c6539=_0x2cb939[_0x46cc6d];if(_[_0xb64d('0x7')](_0x21c07c[_0xb64d('0x1')][_0x1c6539['id']])){_0x21c07c[_0xb64d('0x1')][_0x1c6539['id']]=new MailAccount(_0x1c6539);}else{_[_0xb64d('0x8')](_0x21c07c['mailAccounts'][_0x1c6539['id']],_0x1c6539);}}}return _0x21c07c[_0xb64d('0x1')];};};module[_0xb64d('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index e110697..e659753 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 _0x7919=['GetMailAccount','name','service','email','key','ListId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','../client','getMailAccounts','Request'];(function(_0x23b57d,_0xae9980){var _0x579775=function(_0x40e3cd){while(--_0x40e3cd){_0x23b57d['push'](_0x23b57d['shift']());}};_0x579775(++_0xae9980);}(_0x7919,0xeb));var _0x9791=function(_0x3e7b07,_0x19364a){_0x3e7b07=_0x3e7b07-0x0;var _0x33c396=_0x7919[_0x3e7b07];return _0x33c396;};'use strict';var client=require(_0x9791('0x0'));exports[_0x9791('0x1')]=function(){return function(){return client[_0x9791('0x2')](_0x9791('0x3'),{'options':{'attributes':['id',_0x9791('0x4'),_0x9791('0x5'),_0x9791('0x6'),'active',_0x9791('0x7'),_0x9791('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x9791('0x9'),'as':_0x9791('0xa')},{'model':_0x9791('0xb'),'as':_0x9791('0xc')}]},'log':_0x9791('0xd')});};};exports['notify']=function(_0x222ab5,_0x50088f){return client[_0x9791('0x2')]('NotifyMailAccount',{'account':{'id':_0x222ab5},'body':_0x50088f,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x11d1=['GetMailAccount','name','email','active','key','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','NotifyMailAccount','../client','Request'];(function(_0x4edb1f,_0x558fbc){var _0x15e97f=function(_0x286c06){while(--_0x286c06){_0x4edb1f['push'](_0x4edb1f['shift']());}};_0x15e97f(++_0x558fbc);}(_0x11d1,0x184));var _0x111d=function(_0x23b081,_0x4220ab){_0x23b081=_0x23b081-0x0;var _0x246c3f=_0x11d1[_0x23b081];return _0x246c3f;};'use strict';var client=require(_0x111d('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x111d('0x1')](_0x111d('0x2'),{'options':{'attributes':['id',_0x111d('0x3'),'service',_0x111d('0x4'),_0x111d('0x5'),_0x111d('0x6'),'ListId',_0x111d('0x7')],'raw':![],'include':[{'model':_0x111d('0x8'),'as':_0x111d('0x9')},{'model':_0x111d('0xa'),'as':_0x111d('0xb')}]},'log':'getMailAccount'});};};exports['notify']=function(_0x1ba64c,_0xdf4197){return client['Request'](_0x111d('0xc'),{'account':{'id':_0x1ba64c},'body':_0xdf4197,'log':_0x111d('0xc')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index ab5f720..e4a134c 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 _0xc729=['GetSettings','getSettings','Request'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xc729,0x14e));var _0x9c72=function(_0x1086b5,_0x8e1a8d){_0x1086b5=_0x1086b5-0x0;var _0x5e2f6b=_0xc729[_0x1086b5];return _0x5e2f6b;};'use strict';var client=require('../client');exports[_0x9c72('0x0')]=function(){return client[_0x9c72('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x9c72('0x2')});}; \ No newline at end of file +var _0x33f4=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x33f4,0xcf));var _0x433f=function(_0x9ede64,_0x3c7a41){_0x9ede64=_0x9ede64-0x0;var _0x52c0b5=_0x33f4[_0x9ede64];return _0x52c0b5;};'use strict';var client=require(_0x433f('0x0'));exports[_0x433f('0x1')]=function(){return client[_0x433f('0x2')](_0x433f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x433f('0x4')]},'log':_0x433f('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 4e448f9..426a609 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 67d8ab5..4171a6f 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 _0x3101=['createServer','timeout','port','socket.io','websocket','polling','redis','localhost','default','../../config/socketio','../../config/express','../../routes','once','listening','log','exports','lodash','http','express','sticky-session','ioredis','../../config/environment'];(function(_0x264c57,_0x19e655){var _0x36e78f=function(_0x551c4f){while(--_0x551c4f){_0x264c57['push'](_0x264c57['shift']());}};_0x36e78f(++_0x19e655);}(_0x3101,0x1b2));var _0x1310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3101[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1310('0x0'));var http=require(_0x1310('0x1'));var express=require(_0x1310('0x2'));var sticky=require(_0x1310('0x3'));var Redis=require(_0x1310('0x4'));var config=require(_0x1310('0x5'));var app=express();var server=http[_0x1310('0x6')](app);server[_0x1310('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0x1310('0x8')])){var socketio=require(_0x1310('0x9'))(server,{'transports':[_0x1310('0xa'),_0x1310('0xb')]});config[_0x1310('0xc')]=_['defaults'](config[_0x1310('0xc')],{'host':_0x1310('0xd'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x1310('0xc')]),'subClient':new Redis(config[_0x1310('0xc')])}));require('../../config/triggers')[_0x1310('0xe')]();require(_0x1310('0xf'))[_0x1310('0xe')](socketio);require(_0x1310('0x10'))[_0x1310('0xe')](app);require(_0x1310('0x11'))['default'](app);}else{server[_0x1310('0x12')](_0x1310('0x13'),function(){console[_0x1310('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x1310('0x8')]);});}exports=module[_0x1310('0x15')]=app; \ No newline at end of file +var _0x6f69=['websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io'];(function(_0x3070f7,_0x142b7a){var _0x5a231f=function(_0x506689){while(--_0x506689){_0x3070f7['push'](_0x3070f7['shift']());}};_0x5a231f(++_0x142b7a);}(_0x6f69,0x118));var _0x96f6=function(_0x31c038,_0x6a6fdc){_0x31c038=_0x31c038-0x0;var _0xe53800=_0x6f69[_0x31c038];return _0xe53800;};'use strict';var _=require(_0x96f6('0x0'));var http=require('http');var express=require('express');var sticky=require(_0x96f6('0x1'));var Redis=require(_0x96f6('0x2'));var config=require(_0x96f6('0x3'));var app=express();var server=http[_0x96f6('0x4')](app);server[_0x96f6('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0x96f6('0x6')])){var socketio=require(_0x96f6('0x7'))(server,{'transports':[_0x96f6('0x8'),_0x96f6('0x9')]});config[_0x96f6('0xa')]=_[_0x96f6('0xb')](config[_0x96f6('0xa')],{'host':_0x96f6('0xc'),'port':0x18eb});socketio[_0x96f6('0xd')](require(_0x96f6('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x96f6('0xa')])}));require(_0x96f6('0xf'))[_0x96f6('0x10')]();require(_0x96f6('0x11'))[_0x96f6('0x10')](socketio);require(_0x96f6('0x12'))['default'](app);require(_0x96f6('0x13'))['default'](app);}else{server[_0x96f6('0x14')](_0x96f6('0x15'),function(){console[_0x96f6('0x16')](_0x96f6('0x17'),config[_0x96f6('0x6')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 7e14b83..8d46b77 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 _0x2b1c=['routing','client','http','Request','debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger'];(function(_0x3df871,_0xda2e11){var _0x570f7b=function(_0xfaac78){while(--_0xfaac78){_0x3df871['push'](_0x3df871['shift']());}};_0x570f7b(++_0xda2e11);}(_0x2b1c,0xb3));var _0xc2b1=function(_0x3e6f51,_0x53823c){_0x3e6f51=_0x3e6f51-0x0;var _0x35ab08=_0x2b1c[_0x3e6f51];return _0x35ab08;};'use strict';var jayson=require(_0xc2b1('0x0'));var BPromise=require(_0xc2b1('0x1'));var logger=require(_0xc2b1('0x2'))(_0xc2b1('0x3'));var client=jayson[_0xc2b1('0x4')][_0xc2b1('0x5')]({'port':0x2329});client[_0xc2b1('0x6')]=function(_0x41eed3,_0x10485d){return new BPromise(function(_0x257af6,_0x340e7f){return client['request'](_0x41eed3,_0x10485d)['then'](function(_0x6e1339){logger[_0xc2b1('0x7')](_0xc2b1('0x8'),_0xc2b1('0x3'),_0x41eed3,_0x10485d,_0x6e1339);if(_0x6e1339['error']){logger[_0xc2b1('0x9')](_0xc2b1('0x8'),'routing',_0x41eed3,_0x6e1339[_0xc2b1('0x9')][_0xc2b1('0xa')],_0x10485d);return _0x340e7f(_0x6e1339['error'][_0xc2b1('0xa')]);}else{return _0x257af6(_0x6e1339[_0xc2b1('0xb')]);}})[_0xc2b1('0xc')](function(_0x3567b0){logger[_0xc2b1('0x9')](_0xc2b1('0x8'),_0xc2b1('0x3'),_0x41eed3,_0x3567b0,_0x10485d);return _0x340e7f(_0x3567b0);});});};module['exports']=client; \ No newline at end of file +var _0xd3ef=['message','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error'];(function(_0x292600,_0x120a55){var _0x2ef83b=function(_0xe2e801){while(--_0xe2e801){_0x292600['push'](_0x292600['shift']());}};_0x2ef83b(++_0x120a55);}(_0xd3ef,0x199));var _0xfd3e=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0xd3ef[_0xf1af27];return _0x46b274;};'use strict';var jayson=require(_0xfd3e('0x0'));var BPromise=require('bluebird');var logger=require(_0xfd3e('0x1'))(_0xfd3e('0x2'));var client=jayson[_0xfd3e('0x3')][_0xfd3e('0x4')]({'port':0x2329});client[_0xfd3e('0x5')]=function(_0x1793b6,_0x53fe1e){return new BPromise(function(_0x373739,_0x419e6a){return client[_0xfd3e('0x6')](_0x1793b6,_0x53fe1e)[_0xfd3e('0x7')](function(_0x4aa3c1){logger[_0xfd3e('0x8')](_0xfd3e('0x9'),_0xfd3e('0x2'),_0x1793b6,_0x53fe1e,_0x4aa3c1);if(_0x4aa3c1['error']){logger[_0xfd3e('0xa')](_0xfd3e('0x9'),_0xfd3e('0x2'),_0x1793b6,_0x4aa3c1[_0xfd3e('0xa')][_0xfd3e('0xb')],_0x53fe1e);return _0x419e6a(_0x4aa3c1['error'][_0xfd3e('0xb')]);}else{return _0x373739(_0x4aa3c1['result']);}})[_0xfd3e('0xc')](function(_0x39c170){logger[_0xfd3e('0xa')](_0xfd3e('0x9'),_0xfd3e('0x2'),_0x1793b6,_0x39c170,_0x53fe1e);return _0x419e6a(_0x39c170);});});};module[_0xfd3e('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 34bc1da..5e4d2a5 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 _0xbaa4=['listen','catch','log','bluebird','./server','./rpc/openchannelQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initOpenchannelQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xbaa4,0xd5));var _0x4baa=function(_0xb4abe9,_0x355af1){_0xb4abe9=_0xb4abe9-0x0;var _0x2b206e=_0xbaa4[_0xb4abe9];return _0x2b206e;};'use strict';var BPromise=require(_0x4baa('0x0'));var server=require(_0x4baa('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0x4baa('0x2'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x4baa('0x3'));var whatsappQueue=require(_0x4baa('0x4'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x4baa('0x5')]()[_0x4baa('0x6')](user[_0x4baa('0x7')]())[_0x4baa('0x6')](realtime[_0x4baa('0x8')]())[_0x4baa('0x6')](interval[_0x4baa('0x9')]())[_0x4baa('0x6')](realtime['initIntervals']())['then'](openchannelQueue['getOpenchannelQueues']())[_0x4baa('0x6')](realtime[_0x4baa('0xa')]())['then'](chatQueue['getChatQueues']())['then'](realtime['initChatQueues']())[_0x4baa('0x6')](smsQueue[_0x4baa('0xb')]())[_0x4baa('0x6')](realtime[_0x4baa('0xc')]())['then'](mailQueue[_0x4baa('0xd')]())['then'](realtime[_0x4baa('0xe')]())['then'](faxQueue['getFaxQueues']())[_0x4baa('0x6')](realtime[_0x4baa('0xf')]())[_0x4baa('0x6')](whatsappQueue[_0x4baa('0x10')]())[_0x4baa('0x6')](realtime[_0x4baa('0x11')]())[_0x4baa('0x6')](function(){return realtime;});}function main(){return server[_0x4baa('0x12')](realtime)[_0x4baa('0x6')](function(_0x47d76e){return initRealtime();})['then'](function(_0x15ee92){return setInterval(initRealtime,0x1388);})[_0x4baa('0x13')](function(_0x46b706){console[_0x4baa('0x14')](_0x46b706);});}main(); \ No newline at end of file +var _0xb2d5=['initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','getIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues'];(function(_0x5b9fd4,_0x5a61dd){var _0xd7cf72=function(_0x38de4a){while(--_0x38de4a){_0x5b9fd4['push'](_0x5b9fd4['shift']());}};_0xd7cf72(++_0x5a61dd);}(_0xb2d5,0xc4));var _0x5b2d=function(_0x5d2360,_0x4efab1){_0x5d2360=_0x5d2360-0x0;var _0x5df16e=_0xb2d5[_0x5d2360];return _0x5df16e;};'use strict';var BPromise=require(_0x5b2d('0x0'));var server=require(_0x5b2d('0x1'));var Realtime=require(_0x5b2d('0x2'));var user=require(_0x5b2d('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x5b2d('0x4'));var chatQueue=require(_0x5b2d('0x5'));var smsQueue=require(_0x5b2d('0x6'));var mailQueue=require(_0x5b2d('0x7'));var faxQueue=require(_0x5b2d('0x8'));var whatsappQueue=require(_0x5b2d('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x5b2d('0xa')]()['then'](user[_0x5b2d('0xb')]())['then'](realtime['initAgents']())[_0x5b2d('0xc')](interval[_0x5b2d('0xd')]())['then'](realtime['initIntervals']())[_0x5b2d('0xc')](openchannelQueue[_0x5b2d('0xe')]())[_0x5b2d('0xc')](realtime['initOpenchannelQueues']())[_0x5b2d('0xc')](chatQueue[_0x5b2d('0xf')]())[_0x5b2d('0xc')](realtime[_0x5b2d('0x10')]())[_0x5b2d('0xc')](smsQueue[_0x5b2d('0x11')]())[_0x5b2d('0xc')](realtime[_0x5b2d('0x12')]())[_0x5b2d('0xc')](mailQueue[_0x5b2d('0x13')]())[_0x5b2d('0xc')](realtime[_0x5b2d('0x14')]())[_0x5b2d('0xc')](faxQueue['getFaxQueues']())['then'](realtime[_0x5b2d('0x15')]())[_0x5b2d('0xc')](whatsappQueue[_0x5b2d('0x16')]())['then'](realtime[_0x5b2d('0x17')]())[_0x5b2d('0xc')](function(){return realtime;});}function main(){return server[_0x5b2d('0x18')](realtime)[_0x5b2d('0xc')](function(_0x1e5197){return initRealtime();})['then'](function(_0x17d8ed){return setInterval(initRealtime,0x1388);})[_0x5b2d('0x19')](function(_0x543ed6){console[_0x5b2d('0x1a')](_0x543ed6);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index e8c6e8f..3a79936 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 _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x4e9a7f,_0x3bb6df){var _0x4c9165=function(_0x35f0c9){while(--_0x35f0c9){_0x4e9a7f['push'](_0x4e9a7f['shift']());}};_0x4c9165(++_0x3bb6df);}(_0x2ef3,0xba));var _0x32ef=function(_0x54a0a8,_0x4e8e57){_0x54a0a8=_0x54a0a8-0x0;var _0x312816=_0x2ef3[_0x54a0a8];return _0x312816;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x241179,_0x41e5b1){var _0x508ead=function(_0xaefffd){while(--_0xaefffd){_0x241179['push'](_0x241179['shift']());}};_0x508ead(++_0x41e5b1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 64de137..46f0258 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 _0xda27=['sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then','error','message','catch'];(function(_0x5abdfc,_0x385c27){var _0x124657=function(_0x667dde){while(--_0x667dde){_0x5abdfc['push'](_0x5abdfc['shift']());}};_0x124657(++_0x385c27);}(_0xda27,0x142));var _0x7da2=function(_0x4978fa,_0x573026){_0x4978fa=_0x4978fa-0x0;var _0x2f548c=_0xda27[_0x4978fa];return _0x2f548c;};'use strict';var BPromise=require(_0x7da2('0x0'));var jayson=require(_0x7da2('0x1'));var client=jayson[_0x7da2('0x2')][_0x7da2('0x3')]({'port':0x232b});function request(_0x24c3fe,_0x45db40){return new BPromise(function(_0x362cd3,_0x174668){return client['request'](_0x24c3fe,_0x45db40)[_0x7da2('0x4')](function(_0x29a845){if(_0x29a845[_0x7da2('0x5')]){return _0x174668(_0x29a845[_0x7da2('0x5')][_0x7da2('0x6')]);}else{return _0x362cd3(_0x29a845['result']);}})[_0x7da2('0x7')](function(_0x93a239){return _0x174668(_0x93a239);});});}exports[_0x7da2('0x8')]=function(_0x22347a,_0x24e2e3){return request(_0x7da2('0x9'),{'account':_0x22347a,'message':_0x24e2e3});}; \ No newline at end of file +var _0xaf04=['jayson/promise','http','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x49a906,_0xfd85db){var _0x1340ca=function(_0x582ed6){while(--_0x582ed6){_0x49a906['push'](_0x49a906['shift']());}};_0x1340ca(++_0xfd85db);}(_0xaf04,0x8e));var _0x4af0=function(_0x38456c,_0x4be32f){_0x38456c=_0x38456c-0x0;var _0x376186=_0xaf04[_0x38456c];return _0x376186;};'use strict';var BPromise=require(_0x4af0('0x0'));var jayson=require(_0x4af0('0x1'));var client=jayson['client'][_0x4af0('0x2')]({'port':0x232b});function request(_0x445b76,_0x2adb3e){return new BPromise(function(_0x23b50b,_0x5cd408){return client[_0x4af0('0x3')](_0x445b76,_0x2adb3e)[_0x4af0('0x4')](function(_0x2693d0){if(_0x2693d0[_0x4af0('0x5')]){return _0x5cd408(_0x2693d0['error'][_0x4af0('0x6')]);}else{return _0x23b50b(_0x2693d0[_0x4af0('0x7')]);}})[_0x4af0('0x8')](function(_0x1a4370){return _0x5cd408(_0x1a4370);});});}exports[_0x4af0('0x9')]=function(_0x33442c,_0x377e1b){return request(_0x4af0('0xa'),{'account':_0x33442c,'message':_0x377e1b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3c26e94..0a195fb 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 _0x7bfd=['openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','maxcapacity','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','chatCapacity','mailStatus','faxStatusTime','openchannelStatus','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0x7bfd,0x1b5));var _0xd7bf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7bfd[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd7bf('0x0'));var moment=require(_0xd7bf('0x1'));var md5=require(_0xd7bf('0x2'));var Redis=require(_0xd7bf('0x3'));var config=require(_0xd7bf('0x4'));config[_0xd7bf('0x5')]=_[_0xd7bf('0x6')](config[_0xd7bf('0x5')],{'host':_0xd7bf('0x7'),'port':0x18eb});var io=require(_0xd7bf('0x8'))(new Redis(config[_0xd7bf('0x5')]));function Agent(_0x4715b1){this['id']=_0x4715b1['id']||0x0;this['name']=_0x4715b1[_0xd7bf('0x9')]||'';this[_0xd7bf('0xa')]=_0x4715b1['online']||!![];this[_0xd7bf('0xb')]=_0x4715b1[_0xd7bf('0xb')]||![];this[_0xd7bf('0xc')]=_0x4715b1[_0xd7bf('0xc')]||![];this[_0xd7bf('0xd')]=_0x4715b1['mailPause']||![];this['faxPause']=_0x4715b1['faxPause']||![];this[_0xd7bf('0xe')]=_0x4715b1[_0xd7bf('0xe')]||![];this[_0xd7bf('0xf')]=_0x4715b1[_0xd7bf('0xf')]||![];this[_0xd7bf('0x10')]=_0xd7bf('0x11');this[_0xd7bf('0x12')]=0x0;this['chatCapacity']=_0x4715b1['chatCapacity']||0x0;this[_0xd7bf('0x13')]=0x0;this['mailStatus']=_0xd7bf('0x11');this[_0xd7bf('0x14')]=0x0;this[_0xd7bf('0x15')]=_0x4715b1[_0xd7bf('0x15')]||0x0;this[_0xd7bf('0x16')]=0x0;this[_0xd7bf('0x17')]=_0xd7bf('0x11');this['faxStatusTime']=0x0;this[_0xd7bf('0x18')]=_0x4715b1[_0xd7bf('0x18')]||0x0;this[_0xd7bf('0x19')]=0x0;this[_0xd7bf('0x1a')]=_0xd7bf('0x11');this[_0xd7bf('0x1b')]=0x0;this[_0xd7bf('0x1c')]=_0x4715b1[_0xd7bf('0x1c')]||0x0;this[_0xd7bf('0x1d')]=0x0;this[_0xd7bf('0x1e')]=_0xd7bf('0x11');this[_0xd7bf('0x1f')]=0x0;this['whatsappCapacity']=_0x4715b1[_0xd7bf('0x20')]||0x0;this[_0xd7bf('0x21')]=0x0;this['openchannelStatus']='unknown';this[_0xd7bf('0x22')]=0x0;this['openchannelCapacity']=_0x4715b1[_0xd7bf('0x23')]||0x0;this[_0xd7bf('0x24')]=0x0;this[_0xd7bf('0x25')]=![];this[_0xd7bf('0x26')]=undefined;this[_0xd7bf('0x2')]='';this['updateRealtime']();}Agent[_0xd7bf('0x27')][_0xd7bf('0x28')]=function(_0x2664a0){if(this[_0x2664a0+_0xd7bf('0x29')]>0x0){if(this[_0x2664a0+'Capacity']>0x0&&this[_0x2664a0+_0xd7bf('0x29')]>=this[_0x2664a0+'Capacity']){return _0xd7bf('0x2a');}else{return'working';}}else{return'idle';}};Agent[_0xd7bf('0x27')]['updateRealtime']=function(){var _0x5d7d42=[_0xd7bf('0x2b'),_0xd7bf('0x2c'),_0xd7bf('0x2d'),_0xd7bf('0x2e'),'sms',_0xd7bf('0x2f')];for(var _0x4777b2=0x0;_0x4777b2<_0x5d7d42[_0xd7bf('0x30')];_0x4777b2+=0x1){var _0x2150b7=this['getChannelStatus'](_0x5d7d42[_0x4777b2]);if(this[_0x5d7d42[_0x4777b2]+_0xd7bf('0x31')]!==_0x2150b7){this[_0x5d7d42[_0x4777b2]+_0xd7bf('0x32')]=_['toNumber'](moment()['format']('x'));}this[_0x5d7d42[_0x4777b2]+_0xd7bf('0x31')]=_0x2150b7;}var _0x24dfac={'id':this['id'],'name':this[_0xd7bf('0x9')],'online':this['online'],'voicePause':this[_0xd7bf('0xb')],'chatPause':this[_0xd7bf('0xc')],'mailPause':this[_0xd7bf('0xd')],'smsPause':this[_0xd7bf('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0xd7bf('0xf')],'chatStatus':this[_0xd7bf('0x10')],'chatStatusTime':this[_0xd7bf('0x12')],'chatCapacity':this[_0xd7bf('0x33')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xd7bf('0x34')],'mailStatusTime':this[_0xd7bf('0x14')],'mailCapacity':this[_0xd7bf('0x15')],'mailCurrentCapacity':this[_0xd7bf('0x16')],'faxStatus':this[_0xd7bf('0x17')],'faxStatusTime':this[_0xd7bf('0x35')],'faxCapacity':this[_0xd7bf('0x18')],'faxCurrentCapacity':this[_0xd7bf('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xd7bf('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xd7bf('0x1d')],'whatsappStatus':this[_0xd7bf('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xd7bf('0x21')],'openchannelStatus':this[_0xd7bf('0x36')],'openchannelStatusTime':this[_0xd7bf('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd7bf('0x24')],'busy':this[_0xd7bf('0x25')],'busyQueue':this[_0xd7bf('0x26')]};var _0x16b501=md5(JSON[_0xd7bf('0x37')](_0x24dfac));if(this[_0xd7bf('0x2')]!==_0x16b501){this[_0xd7bf('0x2')]=_0x16b501;io[_0xd7bf('0x38')](_0xd7bf('0x39'),_0x24dfac);}};module[_0xd7bf('0x3a')]=Agent; \ No newline at end of file +var _0x0e16=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailPause','faxStatus','faxStatusTime','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatusTime','busyQueue','stringify','emit','user:save','exports','lodash','moment','md5'];(function(_0x7341a9,_0x9e663b){var _0x52bca9=function(_0x372a82){while(--_0x372a82){_0x7341a9['push'](_0x7341a9['shift']());}};_0x52bca9(++_0x9e663b);}(_0x0e16,0x183));var _0x60e1=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x0e16[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x60e1('0x0'));var moment=require(_0x60e1('0x1'));var md5=require(_0x60e1('0x2'));var Redis=require(_0x60e1('0x3'));var config=require(_0x60e1('0x4'));config[_0x60e1('0x5')]=_[_0x60e1('0x6')](config[_0x60e1('0x5')],{'host':_0x60e1('0x7'),'port':0x18eb});var io=require(_0x60e1('0x8'))(new Redis(config[_0x60e1('0x5')]));function Agent(_0x3664e2){this['id']=_0x3664e2['id']||0x0;this['name']=_0x3664e2[_0x60e1('0x9')]||'';this['online']=_0x3664e2[_0x60e1('0xa')]||!![];this[_0x60e1('0xb')]=_0x3664e2[_0x60e1('0xb')]||![];this[_0x60e1('0xc')]=_0x3664e2[_0x60e1('0xc')]||![];this['mailPause']=_0x3664e2['mailPause']||![];this[_0x60e1('0xd')]=_0x3664e2[_0x60e1('0xd')]||![];this[_0x60e1('0xe')]=_0x3664e2[_0x60e1('0xe')]||![];this[_0x60e1('0xf')]=_0x3664e2[_0x60e1('0xf')]||![];this[_0x60e1('0x10')]=_0x60e1('0x11');this[_0x60e1('0x12')]=0x0;this[_0x60e1('0x13')]=_0x3664e2[_0x60e1('0x13')]||0x0;this[_0x60e1('0x14')]=0x0;this['mailStatus']=_0x60e1('0x11');this[_0x60e1('0x15')]=0x0;this[_0x60e1('0x16')]=_0x3664e2[_0x60e1('0x16')]||0x0;this[_0x60e1('0x17')]=0x0;this['faxStatus']=_0x60e1('0x11');this['faxStatusTime']=0x0;this[_0x60e1('0x18')]=_0x3664e2['faxCapacity']||0x0;this[_0x60e1('0x19')]=0x0;this[_0x60e1('0x1a')]='unknown';this[_0x60e1('0x1b')]=0x0;this[_0x60e1('0x1c')]=_0x3664e2[_0x60e1('0x1c')]||0x0;this[_0x60e1('0x1d')]=0x0;this[_0x60e1('0x1e')]='unknown';this['whatsappStatusTime']=0x0;this[_0x60e1('0x1f')]=_0x3664e2['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x60e1('0x20')]='unknown';this['openchannelStatusTime']=0x0;this[_0x60e1('0x21')]=_0x3664e2['openchannelCapacity']||0x0;this[_0x60e1('0x22')]=0x0;this[_0x60e1('0x23')]=![];this['busyQueue']=undefined;this[_0x60e1('0x2')]='';this[_0x60e1('0x24')]();}Agent[_0x60e1('0x25')][_0x60e1('0x26')]=function(_0x88f777){if(this[_0x88f777+'CurrentCapacity']>0x0){if(this[_0x88f777+_0x60e1('0x27')]>0x0&&this[_0x88f777+'CurrentCapacity']>=this[_0x88f777+'Capacity']){return _0x60e1('0x28');}else{return _0x60e1('0x29');}}else{return _0x60e1('0x2a');}};Agent[_0x60e1('0x25')][_0x60e1('0x24')]=function(){var _0x1b1617=[_0x60e1('0x2b'),_0x60e1('0x2c'),_0x60e1('0x2d'),_0x60e1('0x2e'),_0x60e1('0x2f'),_0x60e1('0x30')];for(var _0x5ea803=0x0;_0x5ea803<_0x1b1617[_0x60e1('0x31')];_0x5ea803+=0x1){var _0x3fef77=this['getChannelStatus'](_0x1b1617[_0x5ea803]);if(this[_0x1b1617[_0x5ea803]+_0x60e1('0x32')]!==_0x3fef77){this[_0x1b1617[_0x5ea803]+_0x60e1('0x33')]=_[_0x60e1('0x34')](moment()[_0x60e1('0x35')]('x'));}this[_0x1b1617[_0x5ea803]+_0x60e1('0x32')]=_0x3fef77;}var _0x1be296={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x60e1('0xb')],'chatPause':this[_0x60e1('0xc')],'mailPause':this[_0x60e1('0x36')],'smsPause':this[_0x60e1('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0x60e1('0xf')],'chatStatus':this[_0x60e1('0x10')],'chatStatusTime':this[_0x60e1('0x12')],'chatCapacity':this[_0x60e1('0x13')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x60e1('0x15')],'mailCapacity':this[_0x60e1('0x16')],'mailCurrentCapacity':this[_0x60e1('0x17')],'faxStatus':this[_0x60e1('0x37')],'faxStatusTime':this[_0x60e1('0x38')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x60e1('0x19')],'smsStatus':this[_0x60e1('0x1a')],'smsStatusTime':this[_0x60e1('0x1b')],'smsCapacity':this[_0x60e1('0x1c')],'smsCurrentCapacity':this[_0x60e1('0x1d')],'whatsappStatus':this[_0x60e1('0x1e')],'whatsappStatusTime':this[_0x60e1('0x39')],'whatsappCapacity':this[_0x60e1('0x1f')],'whatsappCurrentCapacity':this[_0x60e1('0x3a')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x60e1('0x3b')],'openchannelCapacity':this[_0x60e1('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x60e1('0x3c')]};var _0x176efc=md5(JSON[_0x60e1('0x3d')](_0x1be296));if(this['md5']!==_0x176efc){this[_0x60e1('0x2')]=_0x176efc;io[_0x60e1('0x3e')](_0x60e1('0x3f'),_0x1be296);}};module[_0x60e1('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 4e1e61d..0218ad6 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 _0x3e5d=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','map','_rr','loggedIn','paused','length','online','available','stringify','format','chat:queue:%s','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x43d4ec,_0x4e53ff){var _0x233d65=function(_0x250d7f){while(--_0x250d7f){_0x43d4ec['push'](_0x43d4ec['shift']());}};_0x233d65(++_0x4e53ff);}(_0x3e5d,0x11c));var _0xd3e5=function(_0x31a58e,_0x31842d){_0x31a58e=_0x31a58e-0x0;var _0x25ce60=_0x3e5d[_0x31a58e];return _0x25ce60;};'use strict';var _=require('lodash');var md5=require(_0xd3e5('0x0'));var util=require(_0xd3e5('0x1'));var Redis=require(_0xd3e5('0x2'));var config=require(_0xd3e5('0x3'));config[_0xd3e5('0x4')]=_[_0xd3e5('0x5')](config[_0xd3e5('0x4')],{'host':_0xd3e5('0x6'),'port':0x18eb});var io=require(_0xd3e5('0x7'))(new Redis(config['redis']));function ChatQueue(_0x433853){this['id']=_0x433853['id']||0x0;this[_0xd3e5('0x8')]=_0x433853['name']||'';this[_0xd3e5('0x9')]=_0x433853['timeout']||0xa;this[_0xd3e5('0xa')]=_0x433853['strategy']||_0xd3e5('0xb');this[_0xd3e5('0xc')]=_0x433853[_0xd3e5('0xc')];this['mapAgentsId']={};this[_0xd3e5('0xd')]=0x0;this['md5']='';this[_0xd3e5('0xe')]();this[_0xd3e5('0xf')]();}ChatQueue['prototype'][_0xd3e5('0xe')]=function(){var _0x49ecc1=this[_0xd3e5('0x10')]['_rr'];this['mapAgentsId']=_[_0xd3e5('0x11')](this['Agents'],'id');this[_0xd3e5('0x10')][_0xd3e5('0x12')]=_0x49ecc1;};ChatQueue['prototype'][_0xd3e5('0xf')]=function(){this[_0xd3e5('0x13')]=0x0;this[_0xd3e5('0x14')]=0x0;for(var _0x243adc=0x0;_0x243adc=0x0?this[_0xd3e5('0x17')]:0x0;var _0x26ca95={'id':this['id'],'available':this[_0xd3e5('0x17')],'loggedIn':this[_0xd3e5('0x13')],'name':this['name'],'paused':this[_0xd3e5('0x14')],'waiting':this['waiting']};var _0x3f5309=md5(JSON[_0xd3e5('0x18')](_0x26ca95));if(this[_0xd3e5('0x0')]!==_0x3f5309){this[_0xd3e5('0x0')]=_0x3f5309;io['to'](util[_0xd3e5('0x19')](_0xd3e5('0x1a'),_0x26ca95[_0xd3e5('0x8')]))['emit'](_0xd3e5('0x1b'),_0x26ca95);}};module[_0xd3e5('0x1c')]=ChatQueue; \ No newline at end of file +var _0x6bae=['available','paused','stringify','format','chat:queue:%s','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','length','online','chatPause'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x6bae,0x102));var _0xe6ba=function(_0x53051d,_0x4346c1){_0x53051d=_0x53051d-0x0;var _0x8e374e=_0x6bae[_0x53051d];return _0x8e374e;};'use strict';var _=require(_0xe6ba('0x0'));var md5=require(_0xe6ba('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xe6ba('0x2'));config[_0xe6ba('0x3')]=_['defaults'](config['redis'],{'host':_0xe6ba('0x4'),'port':0x18eb});var io=require(_0xe6ba('0x5'))(new Redis(config[_0xe6ba('0x3')]));function ChatQueue(_0x37a510){this['id']=_0x37a510['id']||0x0;this[_0xe6ba('0x6')]=_0x37a510[_0xe6ba('0x6')]||'';this[_0xe6ba('0x7')]=_0x37a510[_0xe6ba('0x7')]||0xa;this['strategy']=_0x37a510[_0xe6ba('0x8')]||_0xe6ba('0x9');this[_0xe6ba('0xa')]=_0x37a510[_0xe6ba('0xa')];this[_0xe6ba('0xb')]={};this[_0xe6ba('0xc')]=0x0;this[_0xe6ba('0x1')]='';this['updateRouting']();this[_0xe6ba('0xd')]();}ChatQueue[_0xe6ba('0xe')][_0xe6ba('0xf')]=function(){var _0x57548e=this['mapAgentsId']['_rr'];this[_0xe6ba('0xb')]=_[_0xe6ba('0x10')](this[_0xe6ba('0xa')],'id');this[_0xe6ba('0xb')][_0xe6ba('0x11')]=_0x57548e;};ChatQueue[_0xe6ba('0xe')][_0xe6ba('0xd')]=function(){this[_0xe6ba('0x12')]=0x0;this['paused']=0x0;for(var _0x5bbe88=0x0;_0x5bbe88=0x0?this[_0xe6ba('0x16')]:0x0;var _0xe93fc3={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xe6ba('0x6')],'paused':this[_0xe6ba('0x17')],'waiting':this[_0xe6ba('0xc')]};var _0x3edce6=md5(JSON[_0xe6ba('0x18')](_0xe93fc3));if(this[_0xe6ba('0x1')]!==_0x3edce6){this[_0xe6ba('0x1')]=_0x3edce6;io['to'](util[_0xe6ba('0x19')](_0xe6ba('0x1a'),_0xe93fc3[_0xe6ba('0x6')]))['emit']('chat_queue:save',_0xe93fc3);}};module[_0xe6ba('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 0ec0d16..ec10bdc 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 _0x9977=['util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','paused','length','online','loggedIn','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5'];(function(_0x3810b1,_0x176a2f){var _0x59c52c=function(_0x1f132b){while(--_0x1f132b){_0x3810b1['push'](_0x3810b1['shift']());}};_0x59c52c(++_0x176a2f);}(_0x9977,0x11f));var _0x7997=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x9977[_0x45f951];return _0x24756c;};'use strict';var _=require('lodash');var md5=require(_0x7997('0x0'));var util=require(_0x7997('0x1'));var Redis=require(_0x7997('0x2'));var config=require(_0x7997('0x3'));config['redis']=_[_0x7997('0x4')](config[_0x7997('0x5')],{'host':_0x7997('0x6'),'port':0x18eb});var io=require(_0x7997('0x7'))(new Redis(config[_0x7997('0x5')]));function FaxQueue(_0x202e72){this['id']=_0x202e72['id']||0x0;this[_0x7997('0x8')]=_0x202e72[_0x7997('0x8')]||'';this[_0x7997('0x9')]=_0x202e72[_0x7997('0x9')]||0xa;this[_0x7997('0xa')]=_0x202e72[_0x7997('0xa')]||_0x7997('0xb');this[_0x7997('0xc')]=_0x202e72[_0x7997('0xc')];this[_0x7997('0xd')]={};this[_0x7997('0xe')]=0x0;this['md5']='';this[_0x7997('0xf')]();this[_0x7997('0x10')]();}FaxQueue[_0x7997('0x11')][_0x7997('0xf')]=function(){var _0x281e7b=this['mapAgentsId']['_rr'];this[_0x7997('0xd')]=_[_0x7997('0x12')](this[_0x7997('0xc')],'id');this[_0x7997('0xd')][_0x7997('0x13')]=_0x281e7b;};FaxQueue[_0x7997('0x11')][_0x7997('0x10')]=function(){this['loggedIn']=0x0;this[_0x7997('0x14')]=0x0;for(var _0x29f410=0x0;_0x29f410=0x0?this[_0x7997('0x19')]:0x0;var _0x5d8153={'id':this['id'],'available':this[_0x7997('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x7997('0x14')],'waiting':this[_0x7997('0xe')]};var _0x16967d=md5(JSON[_0x7997('0x1a')](_0x5d8153));if(this['md5']!==_0x16967d){this[_0x7997('0x0')]=_0x16967d;io['to'](util[_0x7997('0x1b')](_0x7997('0x1c'),_0x5d8153['name']))[_0x7997('0x1d')](_0x7997('0x1e'),_0x5d8153);}};module[_0x7997('0x1f')]=FaxQueue; \ No newline at end of file +var _0x9945=['fax_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','available','fax:queue:%s'];(function(_0x346d45,_0x6db175){var _0x548330=function(_0x41e453){while(--_0x41e453){_0x346d45['push'](_0x346d45['shift']());}};_0x548330(++_0x6db175);}(_0x9945,0x1bc));var _0x5994=function(_0x1305a2,_0x35767d){_0x1305a2=_0x1305a2-0x0;var _0x536183=_0x9945[_0x1305a2];return _0x536183;};'use strict';var _=require(_0x5994('0x0'));var md5=require(_0x5994('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x5994('0x2'));config[_0x5994('0x3')]=_[_0x5994('0x4')](config['redis'],{'host':_0x5994('0x5'),'port':0x18eb});var io=require(_0x5994('0x6'))(new Redis(config[_0x5994('0x3')]));function FaxQueue(_0x3d0359){this['id']=_0x3d0359['id']||0x0;this[_0x5994('0x7')]=_0x3d0359[_0x5994('0x7')]||'';this[_0x5994('0x8')]=_0x3d0359[_0x5994('0x8')]||0xa;this[_0x5994('0x9')]=_0x3d0359['strategy']||_0x5994('0xa');this[_0x5994('0xb')]=_0x3d0359[_0x5994('0xb')];this[_0x5994('0xc')]={};this[_0x5994('0xd')]=0x0;this[_0x5994('0x1')]='';this[_0x5994('0xe')]();this[_0x5994('0xf')]();}FaxQueue[_0x5994('0x10')][_0x5994('0xe')]=function(){var _0x1db2f5=this[_0x5994('0xc')][_0x5994('0x11')];this['mapAgentsId']=_[_0x5994('0x12')](this[_0x5994('0xb')],'id');this['mapAgentsId'][_0x5994('0x11')]=_0x1db2f5;};FaxQueue[_0x5994('0x10')]['updateRealtime']=function(){this[_0x5994('0x13')]=0x0;this[_0x5994('0x14')]=0x0;for(var _0x5c5b43=0x0;_0x5c5b43=0x0?this[_0x5994('0x16')]:0x0;var _0x43babf={'id':this['id'],'available':this[_0x5994('0x16')],'loggedIn':this[_0x5994('0x13')],'name':this['name'],'paused':this[_0x5994('0x14')],'waiting':this[_0x5994('0xd')]};var _0x310c6d=md5(JSON['stringify'](_0x43babf));if(this[_0x5994('0x1')]!==_0x310c6d){this[_0x5994('0x1')]=_0x310c6d;io['to'](util['format'](_0x5994('0x17'),_0x43babf['name']))['emit'](_0x5994('0x18'),_0x43babf);}};module[_0x5994('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 1e9397a..6163a68 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 _0xc38c=['exports','name','Intervals'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xc38c,0xf7));var _0xcc38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc38c[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x51fe75){this['id']=_0x51fe75['id']||0x0;this[_0xcc38('0x0')]=_0x51fe75[_0xcc38('0x0')]||'';this[_0xcc38('0x1')]=_0x51fe75[_0xcc38('0x1')]||{};}module[_0xcc38('0x2')]=Interval; \ No newline at end of file +var _0xa6e2=['Intervals','name'];(function(_0x35d90b,_0x157231){var _0x4bd6f4=function(_0x1d3fbf){while(--_0x1d3fbf){_0x35d90b['push'](_0x35d90b['shift']());}};_0x4bd6f4(++_0x157231);}(_0xa6e2,0x137));var _0x2a6e=function(_0x5a5273,_0x49908b){_0x5a5273=_0x5a5273-0x0;var _0x3a2abb=_0xa6e2[_0x5a5273];return _0x3a2abb;};'use strict';function Interval(_0x1b7121){this['id']=_0x1b7121['id']||0x0;this['name']=_0x1b7121[_0x2a6e('0x0')]||'';this[_0x2a6e('0x1')]=_0x1b7121[_0x2a6e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 7ff5318..6159dbe 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 _0x55d3=['ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','length','online','paused','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util'];(function(_0x45399b,_0x30f992){var _0x3f895a=function(_0x19c060){while(--_0x19c060){_0x45399b['push'](_0x45399b['shift']());}};_0x3f895a(++_0x30f992);}(_0x55d3,0x1a1));var _0x355d=function(_0x1d90a5,_0xb42dfc){_0x1d90a5=_0x1d90a5-0x0;var _0x206b6d=_0x55d3[_0x1d90a5];return _0x206b6d;};'use strict';var _=require(_0x355d('0x0'));var md5=require(_0x355d('0x1'));var util=require(_0x355d('0x2'));var Redis=require(_0x355d('0x3'));var config=require('../../../config/environment');config[_0x355d('0x4')]=_[_0x355d('0x5')](config['redis'],{'host':_0x355d('0x6'),'port':0x18eb});var io=require(_0x355d('0x7'))(new Redis(config['redis']));function MailQueue(_0x2deb55){this['id']=_0x2deb55['id']||0x0;this[_0x355d('0x8')]=_0x2deb55[_0x355d('0x8')]||'';this[_0x355d('0x9')]=_0x2deb55[_0x355d('0x9')]||0xa;this[_0x355d('0xa')]=_0x2deb55[_0x355d('0xa')]||_0x355d('0xb');this[_0x355d('0xc')]=_0x2deb55[_0x355d('0xc')];this['mapAgentsId']={};this[_0x355d('0xd')]=0x0;this[_0x355d('0x1')]='';this[_0x355d('0xe')]();this[_0x355d('0xf')]();}MailQueue[_0x355d('0x10')][_0x355d('0xe')]=function(){var _0x4500f1=this['mapAgentsId'][_0x355d('0x11')];this[_0x355d('0x12')]=_[_0x355d('0x13')](this[_0x355d('0xc')],'id');this['mapAgentsId'][_0x355d('0x11')]=_0x4500f1;};MailQueue[_0x355d('0x10')][_0x355d('0xf')]=function(){this[_0x355d('0x14')]=0x0;this['paused']=0x0;for(var _0x32f2e4=0x0;_0x32f2e4=0x0?this[_0x355d('0x18')]:0x0;var _0x4f33ee={'id':this['id'],'available':this[_0x355d('0x18')],'loggedIn':this[_0x355d('0x14')],'name':this[_0x355d('0x8')],'paused':this[_0x355d('0x17')],'waiting':this[_0x355d('0xd')]};var _0x379538=md5(JSON[_0x355d('0x19')](_0x4f33ee));if(this[_0x355d('0x1')]!==_0x379538){this['md5']=_0x379538;io['to'](util[_0x355d('0x1a')](_0x355d('0x1b'),_0x4f33ee['name']))['emit'](_0x355d('0x1c'),_0x4f33ee);}};module[_0x355d('0x1d')]=MailQueue; \ No newline at end of file +var _0x1609=['_rr','map','loggedIn','length','online','mailPause','paused','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype'];(function(_0x5178fb,_0x121e19){var _0x348183=function(_0x52c2ec){while(--_0x52c2ec){_0x5178fb['push'](_0x5178fb['shift']());}};_0x348183(++_0x121e19);}(_0x1609,0x79));var _0x9160=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1609[_0x311c35];return _0x5cc50c;};'use strict';var _=require('lodash');var md5=require(_0x9160('0x0'));var util=require(_0x9160('0x1'));var Redis=require(_0x9160('0x2'));var config=require(_0x9160('0x3'));config[_0x9160('0x4')]=_['defaults'](config[_0x9160('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x9160('0x5'))(new Redis(config[_0x9160('0x4')]));function MailQueue(_0x883235){this['id']=_0x883235['id']||0x0;this[_0x9160('0x6')]=_0x883235[_0x9160('0x6')]||'';this[_0x9160('0x7')]=_0x883235[_0x9160('0x7')]||0xa;this[_0x9160('0x8')]=_0x883235['strategy']||'beepall';this['Agents']=_0x883235[_0x9160('0x9')];this[_0x9160('0xa')]={};this[_0x9160('0xb')]=0x0;this[_0x9160('0x0')]='';this['updateRouting']();this[_0x9160('0xc')]();}MailQueue[_0x9160('0xd')]['updateRouting']=function(){var _0xed18ff=this['mapAgentsId'][_0x9160('0xe')];this[_0x9160('0xa')]=_[_0x9160('0xf')](this[_0x9160('0x9')],'id');this['mapAgentsId'][_0x9160('0xe')]=_0xed18ff;};MailQueue[_0x9160('0xd')]['updateRealtime']=function(){this[_0x9160('0x10')]=0x0;this['paused']=0x0;for(var _0x2b5fcb=0x0;_0x2b5fcb=0x0?this[_0x9160('0x15')]:0x0;var _0x48f6c6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9160('0x10')],'name':this[_0x9160('0x6')],'paused':this[_0x9160('0x14')],'waiting':this['waiting']};var _0x37eca3=md5(JSON[_0x9160('0x16')](_0x48f6c6));if(this['md5']!==_0x37eca3){this[_0x9160('0x0')]=_0x37eca3;io['to'](util['format'](_0x9160('0x17'),_0x48f6c6[_0x9160('0x6')]))[_0x9160('0x18')](_0x9160('0x19'),_0x48f6c6);}};module[_0x9160('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b0fa6a5..fffeead 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x193b59,_0x1d3454){var _0x339e71=function(_0x401922){while(--_0x401922){_0x193b59['push'](_0x193b59['shift']());}};_0x339e71(++_0x1d3454);}(_0xadb5,0xad));var _0x5adb=function(_0x48c511,_0x16b9a3){_0x48c511=_0x48c511-0x0;var _0x2ed3c0=_0xadb5[_0x48c511];return _0x2ed3c0;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x2ef3,0xba));var _0x32ef=function(_0x1961f1,_0x8c0bcd){_0x1961f1=_0x1961f1-0x0;var _0x1b7c7c=_0x2ef3[_0x1961f1];return _0x1b7c7c;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 274bdf6..ed82c6a 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 _0x9de3=['sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','Agents','loggedIn','paused','length','online','available','stringify','format','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9de3,0xea));var _0x39de=function(_0x5000dc,_0x5ac1b7){_0x5000dc=_0x5000dc-0x0;var _0x567c64=_0x9de3[_0x5000dc];return _0x567c64;};'use strict';var _=require(_0x39de('0x0'));var md5=require('md5');var util=require(_0x39de('0x1'));var Redis=require(_0x39de('0x2'));var config=require(_0x39de('0x3'));config['redis']=_[_0x39de('0x4')](config['redis'],{'host':_0x39de('0x5'),'port':0x18eb});var io=require(_0x39de('0x6'))(new Redis(config[_0x39de('0x7')]));function SmsQueue(_0x1d59d6){this['id']=_0x1d59d6['id']||0x0;this['name']=_0x1d59d6[_0x39de('0x8')]||'';this[_0x39de('0x9')]=_0x1d59d6[_0x39de('0x9')]||0xa;this[_0x39de('0xa')]=_0x1d59d6[_0x39de('0xa')]||'beepall';this['Agents']=_0x1d59d6['Agents'];this[_0x39de('0xb')]={};this[_0x39de('0xc')]=0x0;this[_0x39de('0xd')]='';this[_0x39de('0xe')]();this[_0x39de('0xf')]();}SmsQueue[_0x39de('0x10')][_0x39de('0xe')]=function(){var _0x1cc2b4=this['mapAgentsId'][_0x39de('0x11')];this['mapAgentsId']=_['map'](this[_0x39de('0x12')],'id');this[_0x39de('0xb')][_0x39de('0x11')]=_0x1cc2b4;};SmsQueue['prototype'][_0x39de('0xf')]=function(){this[_0x39de('0x13')]=0x0;this[_0x39de('0x14')]=0x0;for(var _0x905132=0x0;_0x905132=0x0?this[_0x39de('0x17')]:0x0;var _0x5e9e37={'id':this['id'],'available':this[_0x39de('0x17')],'loggedIn':this[_0x39de('0x13')],'name':this['name'],'paused':this[_0x39de('0x14')],'waiting':this['waiting']};var _0x440201=md5(JSON[_0x39de('0x18')](_0x5e9e37));if(this['md5']!==_0x440201){this['md5']=_0x440201;io['to'](util[_0x39de('0x19')]('sms:queue:%s',_0x5e9e37['name']))[_0x39de('0x1a')](_0x39de('0x1b'),_0x5e9e37);}};module[_0x39de('0x1c')]=SmsQueue; \ No newline at end of file +var _0x0e85=['waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','localhost','redis','name','timeout','strategy','beepall','Agents'];(function(_0x456ee5,_0x4d3336){var _0x38fbc8=function(_0x39f8e7){while(--_0x39f8e7){_0x456ee5['push'](_0x456ee5['shift']());}};_0x38fbc8(++_0x4d3336);}(_0x0e85,0x7c));var _0x50e8=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x0e85[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x50e8('0x0'));var md5=require(_0x50e8('0x1'));var util=require('util');var Redis=require(_0x50e8('0x2'));var config=require(_0x50e8('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x50e8('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x50e8('0x5')]));function SmsQueue(_0x2401b2){this['id']=_0x2401b2['id']||0x0;this[_0x50e8('0x6')]=_0x2401b2[_0x50e8('0x6')]||'';this['timeout']=_0x2401b2[_0x50e8('0x7')]||0xa;this[_0x50e8('0x8')]=_0x2401b2[_0x50e8('0x8')]||_0x50e8('0x9');this[_0x50e8('0xa')]=_0x2401b2[_0x50e8('0xa')];this['mapAgentsId']={};this[_0x50e8('0xb')]=0x0;this[_0x50e8('0x1')]='';this[_0x50e8('0xc')]();this[_0x50e8('0xd')]();}SmsQueue[_0x50e8('0xe')][_0x50e8('0xc')]=function(){var _0x45dc6f=this[_0x50e8('0xf')]['_rr'];this['mapAgentsId']=_[_0x50e8('0x10')](this[_0x50e8('0xa')],'id');this['mapAgentsId']['_rr']=_0x45dc6f;};SmsQueue[_0x50e8('0xe')][_0x50e8('0xd')]=function(){this[_0x50e8('0x11')]=0x0;this[_0x50e8('0x12')]=0x0;for(var _0x54efd3=0x0;_0x54efd3=0x0?this[_0x50e8('0x15')]:0x0;var _0xc97063={'id':this['id'],'available':this[_0x50e8('0x15')],'loggedIn':this[_0x50e8('0x11')],'name':this[_0x50e8('0x6')],'paused':this[_0x50e8('0x12')],'waiting':this[_0x50e8('0xb')]};var _0x53e0a1=md5(JSON[_0x50e8('0x16')](_0xc97063));if(this['md5']!==_0x53e0a1){this[_0x50e8('0x1')]=_0x53e0a1;io['to'](util[_0x50e8('0x17')](_0x50e8('0x18'),_0xc97063[_0x50e8('0x6')]))[_0x50e8('0x19')]('sms_queue:save',_0xc97063);}};module[_0x50e8('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e248221..ac4cc61 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 _0xfbaf=['ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','paused','length','online','whatsappPause','available','loggedIn','stringify','emit','whatsapp_queue:save','lodash','md5','util'];(function(_0x5de57a,_0x1c4370){var _0x42c593=function(_0x510aad){while(--_0x510aad){_0x5de57a['push'](_0x5de57a['shift']());}};_0x42c593(++_0x1c4370);}(_0xfbaf,0x159));var _0xffba=function(_0xe744a2,_0x19f973){_0xe744a2=_0xe744a2-0x0;var _0x37ed88=_0xfbaf[_0xe744a2];return _0x37ed88;};'use strict';var _=require(_0xffba('0x0'));var md5=require(_0xffba('0x1'));var util=require(_0xffba('0x2'));var Redis=require(_0xffba('0x3'));var config=require(_0xffba('0x4'));config['redis']=_[_0xffba('0x5')](config['redis'],{'host':_0xffba('0x6'),'port':0x18eb});var io=require(_0xffba('0x7'))(new Redis(config[_0xffba('0x8')]));function WhatsappQueue(_0x33df79){this['id']=_0x33df79['id']||0x0;this[_0xffba('0x9')]=_0x33df79[_0xffba('0x9')]||'';this['timeout']=_0x33df79[_0xffba('0xa')]||0xa;this[_0xffba('0xb')]=_0x33df79[_0xffba('0xb')]||'beepall';this[_0xffba('0xc')]=_0x33df79[_0xffba('0xc')];this['mapAgentsId']={};this[_0xffba('0xd')]=0x0;this[_0xffba('0x1')]='';this[_0xffba('0xe')]();this[_0xffba('0xf')]();}WhatsappQueue['prototype'][_0xffba('0xe')]=function(){var _0x37e3cc=this[_0xffba('0x10')][_0xffba('0x11')];this['mapAgentsId']=_[_0xffba('0x12')](this[_0xffba('0xc')],'id');this[_0xffba('0x10')][_0xffba('0x11')]=_0x37e3cc;};WhatsappQueue[_0xffba('0x13')][_0xffba('0xf')]=function(){this['loggedIn']=0x0;this[_0xffba('0x14')]=0x0;for(var _0x527f1f=0x0;_0x527f1f=0x0?this['available']:0x0;var _0x47f4ce={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xffba('0x9')],'paused':this[_0xffba('0x14')],'waiting':this['waiting']};var _0x2dd813=md5(JSON[_0xffba('0x1a')](_0x47f4ce));if(this[_0xffba('0x1')]!==_0x2dd813){this[_0xffba('0x1')]=_0x2dd813;io['to'](util['format']('whatsapp:queue:%s',_0x47f4ce[_0xffba('0x9')]))[_0xffba('0x1b')](_0xffba('0x1c'),_0x47f4ce);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x30f1=['online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30f1,0xd9));var _0x130f=function(_0x5bf217,_0x2660a4){_0x5bf217=_0x5bf217-0x0;var _0x26d927=_0x30f1[_0x5bf217];return _0x26d927;};'use strict';var _=require(_0x130f('0x0'));var md5=require(_0x130f('0x1'));var util=require(_0x130f('0x2'));var Redis=require(_0x130f('0x3'));var config=require('../../../config/environment');config[_0x130f('0x4')]=_[_0x130f('0x5')](config[_0x130f('0x4')],{'host':_0x130f('0x6'),'port':0x18eb});var io=require(_0x130f('0x7'))(new Redis(config[_0x130f('0x4')]));function WhatsappQueue(_0x23bc2f){this['id']=_0x23bc2f['id']||0x0;this[_0x130f('0x8')]=_0x23bc2f[_0x130f('0x8')]||'';this[_0x130f('0x9')]=_0x23bc2f[_0x130f('0x9')]||0xa;this[_0x130f('0xa')]=_0x23bc2f[_0x130f('0xa')]||_0x130f('0xb');this[_0x130f('0xc')]=_0x23bc2f[_0x130f('0xc')];this[_0x130f('0xd')]={};this[_0x130f('0xe')]=0x0;this[_0x130f('0x1')]='';this[_0x130f('0xf')]();this[_0x130f('0x10')]();}WhatsappQueue[_0x130f('0x11')][_0x130f('0xf')]=function(){var _0x4fa253=this[_0x130f('0xd')][_0x130f('0x12')];this[_0x130f('0xd')]=_[_0x130f('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x130f('0x12')]=_0x4fa253;};WhatsappQueue['prototype'][_0x130f('0x10')]=function(){this[_0x130f('0x14')]=0x0;this[_0x130f('0x15')]=0x0;for(var _0x5d928c=0x0;_0x5d928c=0x0?this[_0x130f('0x18')]:0x0;var _0x3b10a2={'id':this['id'],'available':this[_0x130f('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x130f('0x8')],'paused':this['paused'],'waiting':this[_0x130f('0xe')]};var _0x5956c4=md5(JSON[_0x130f('0x19')](_0x3b10a2));if(this[_0x130f('0x1')]!==_0x5956c4){this[_0x130f('0x1')]=_0x5956c4;io['to'](util[_0x130f('0x1a')](_0x130f('0x1b'),_0x3b10a2[_0x130f('0x8')]))[_0x130f('0x1c')](_0x130f('0x1d'),_0x3b10a2);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 7dce83d..5c52a1e 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index b6faabf..a660b50 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 _0x6829=['UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','update','Request'];(function(_0x302bba,_0x3bc075){var _0x504fbc=function(_0x3f99af){while(--_0x3f99af){_0x302bba['push'](_0x302bba['shift']());}};_0x504fbc(++_0x3bc075);}(_0x6829,0xc4));var _0x9682=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6829[_0x17d9e3];return _0x14192d;};'use strict';var client=require('../client');exports[_0x9682('0x0')]=function(_0x492d63,_0x350b18){return client[_0x9682('0x1')](_0x9682('0x2'),{'body':_0x350b18,'options':{'where':{'id':_0x492d63}},'log':_0x9682('0x3')});};exports[_0x9682('0x4')]=function(_0x56deca,_0x1b5608){return client['Request']('AddTagsToChatInteraction',{'body':_0x1b5608,'options':{'where':{'id':_0x56deca}},'log':_0x9682('0x5')});}; \ No newline at end of file +var _0xdd3d=['addTags','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x4cb9d5,_0x187d5a){var _0x444523=function(_0x46497c){while(--_0x46497c){_0x4cb9d5['push'](_0x4cb9d5['shift']());}};_0x444523(++_0x187d5a);}(_0xdd3d,0x17b));var _0xddd3=function(_0x1af977,_0x9bc5dd){_0x1af977=_0x1af977-0x0;var _0x162641=_0xdd3d[_0x1af977];return _0x162641;};'use strict';var client=require(_0xddd3('0x0'));exports[_0xddd3('0x1')]=function(_0x4cd51c,_0x71d442){return client[_0xddd3('0x2')](_0xddd3('0x3'),{'body':_0x71d442,'options':{'where':{'id':_0x4cd51c}},'log':_0xddd3('0x4')});};exports[_0xddd3('0x5')]=function(_0x989560,_0x4ad634){return client['Request']('AddTagsToChatInteraction',{'body':_0x4ad634,'options':{'where':{'id':_0x989560}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 511e682..852ae0c 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 _0x5c24=['../client','create','createChatMessage'];(function(_0xe71cf6,_0x120a90){var _0x1ffd42=function(_0x5b1ab5){while(--_0x5b1ab5){_0xe71cf6['push'](_0xe71cf6['shift']());}};_0x1ffd42(++_0x120a90);}(_0x5c24,0xae));var _0x45c2=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x5c24[_0x310a1b];return _0xdea206;};'use strict';var client=require(_0x45c2('0x0'));exports[_0x45c2('0x1')]=function(_0x5e999b){return client['Request']('CreateChatMessage',{'body':_0x5e999b,'log':_0x45c2('0x2')});}; \ No newline at end of file +var _0xb498=['Request','CreateChatMessage','../client','create'];(function(_0x3d1244,_0x156028){var _0x5d6372=function(_0x509c76){while(--_0x509c76){_0x3d1244['push'](_0x3d1244['shift']());}};_0x5d6372(++_0x156028);}(_0xb498,0x1ca));var _0x8b49=function(_0x3a0935,_0xec761e){_0x3a0935=_0x3a0935-0x0;var _0x16a5bc=_0xb498[_0x3a0935];return _0x16a5bc;};'use strict';var client=require(_0x8b49('0x0'));exports[_0x8b49('0x1')]=function(_0x365502){return client[_0x8b49('0x2')](_0x8b49('0x3'),{'body':_0x365502,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 303d24d..359efde 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 _0xc949=['User','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout'];(function(_0x580065,_0x14c6c9){var _0x1a9a49=function(_0x36bd6f){while(--_0x36bd6f){_0x580065['push'](_0x580065['shift']());}};_0x1a9a49(++_0x14c6c9);}(_0xc949,0x181));var _0x9c94=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xc949[_0x481bf7];return _0x461787;};'use strict';var client=require(_0x9c94('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x9c94('0x1')](_0x9c94('0x2'),{'options':{'raw':![],'attributes':['id',_0x9c94('0x3'),_0x9c94('0x4'),'strategy'],'include':[{'model':_0x9c94('0x5'),'as':_0x9c94('0x6'),'attributes':['id','name',_0x9c94('0x7'),_0x9c94('0x8')]}]},'log':_0x9c94('0x9')});};}; \ No newline at end of file +var _0x21d1=['Request','GetChatQueue','name','timeout','Agents','online','chatPause','../client','getChatQueues'];(function(_0x4dbd82,_0x1e3cfe){var _0x4d48f5=function(_0x11bb18){while(--_0x11bb18){_0x4dbd82['push'](_0x4dbd82['shift']());}};_0x4d48f5(++_0x1e3cfe);}(_0x21d1,0x1c9));var _0x121d=function(_0x3950e0,_0x214c8f){_0x3950e0=_0x3950e0-0x0;var _0x32c861=_0x21d1[_0x3950e0];return _0x32c861;};'use strict';var client=require(_0x121d('0x0'));exports[_0x121d('0x1')]=function(){return function(){return client[_0x121d('0x2')](_0x121d('0x3'),{'options':{'raw':![],'attributes':['id',_0x121d('0x4'),_0x121d('0x5'),'strategy'],'include':[{'model':'User','as':_0x121d('0x6'),'attributes':['id',_0x121d('0x4'),_0x121d('0x7'),_0x121d('0x8')]}]},'log':_0x121d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 87062d2..6815f1e 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 _0x579c=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x4ad789,_0x21a3b5){var _0x325a58=function(_0x592bd5){while(--_0x592bd5){_0x4ad789['push'](_0x4ad789['shift']());}};_0x325a58(++_0x21a3b5);}(_0x579c,0xda));var _0xc579=function(_0x1479dc,_0x1f3dc1){_0x1479dc=_0x1479dc-0x0;var _0x29e589=_0x579c[_0x1479dc];return _0x29e589;};'use strict';var client=require(_0xc579('0x0'));exports[_0xc579('0x1')]=function(_0x2757c6){return client[_0xc579('0x2')](_0xc579('0x3'),{'body':_0x2757c6,'log':'CreateChatQueueReport'});};exports[_0xc579('0x4')]=function(_0x5399d7,_0x21a0a2){return client[_0xc579('0x2')](_0xc579('0x5'),{'body':_0x21a0a2,'options':{'where':{'uniqueid':_0x5399d7},'order':[['id',_0xc579('0x6')]],'limit':0x1},'log':_0xc579('0x5')});}; \ No newline at end of file +var _0xce9b=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport','update'];(function(_0xb77dd4,_0x371dd8){var _0x29db3c=function(_0x37f493){while(--_0x37f493){_0xb77dd4['push'](_0xb77dd4['shift']());}};_0x29db3c(++_0x371dd8);}(_0xce9b,0xc6));var _0xbce9=function(_0x3c81fc,_0x2b3485){_0x3c81fc=_0x3c81fc-0x0;var _0x1f82e5=_0xce9b[_0x3c81fc];return _0x1f82e5;};'use strict';var client=require(_0xbce9('0x0'));exports[_0xbce9('0x1')]=function(_0x1f36fb){return client[_0xbce9('0x2')](_0xbce9('0x3'),{'body':_0x1f36fb,'log':_0xbce9('0x3')});};exports[_0xbce9('0x4')]=function(_0x306247,_0x54ef29){return client[_0xbce9('0x2')](_0xbce9('0x5'),{'body':_0x54ef29,'options':{'where':{'uniqueid':_0x306247},'order':[['id',_0xbce9('0x6')]],'limit':0x1},'log':_0xbce9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index dc48f96..54218d4 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x386213,_0x308bfc){var _0x4a0cc7=function(_0x491962){while(--_0x491962){_0x386213['push'](_0x386213['shift']());}};_0x4a0cc7(++_0x308bfc);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1f4acf,_0x4ea06c){var _0x25ea54=function(_0x5b2c90){while(--_0x5b2c90){_0x1f4acf['push'](_0x1f4acf['shift']());}};_0x25ea54(++_0x4ea06c);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index d1fe433..cb2b93a 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 _0xf00d=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x29182e,_0xf266a){var _0x525c26=function(_0x2d841c){while(--_0x2d841c){_0x29182e['push'](_0x29182e['shift']());}};_0x525c26(++_0xf266a);}(_0xf00d,0x1bb));var _0xdf00=function(_0x3f758f,_0x302451){_0x3f758f=_0x3f758f-0x0;var _0x26e4ae=_0xf00d[_0x3f758f];return _0x26e4ae;};'use strict';var client=require(_0xdf00('0x0'));exports[_0xdf00('0x1')]=function(_0x2ff0b9){return client[_0xdf00('0x2')](_0xdf00('0x3'),{'body':_0x2ff0b9,'log':_0xdf00('0x4')});}; \ No newline at end of file +var _0x8997=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x270a88,_0x5b92a8){var _0x3b6db7=function(_0xf4eb29){while(--_0xf4eb29){_0x270a88['push'](_0x270a88['shift']());}};_0x3b6db7(++_0x5b92a8);}(_0x8997,0xc9));var _0x7899=function(_0x523b15,_0x552b41){_0x523b15=_0x523b15-0x0;var _0x6ac017=_0x8997[_0x523b15];return _0x6ac017;};'use strict';var client=require(_0x7899('0x0'));exports[_0x7899('0x1')]=function(_0x1462d0){return client[_0x7899('0x2')](_0x7899('0x3'),{'body':_0x1462d0,'log':_0x7899('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d1f49df..79959f4 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 _0x6d2a=['Request','GetFaxQueue','User','name','online','faxPause','../client','getFaxQueues'];(function(_0x36fc83,_0x2dfe69){var _0x8a6f7b=function(_0xd1d66b){while(--_0xd1d66b){_0x36fc83['push'](_0x36fc83['shift']());}};_0x8a6f7b(++_0x2dfe69);}(_0x6d2a,0x1ce));var _0xa6d2=function(_0x3727a9,_0x1c2edb){_0x3727a9=_0x3727a9-0x0;var _0xa16806=_0x6d2a[_0x3727a9];return _0xa16806;};'use strict';var client=require(_0xa6d2('0x0'));exports[_0xa6d2('0x1')]=function(){return function(){return client[_0xa6d2('0x2')](_0xa6d2('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xa6d2('0x4'),'as':'Agents','attributes':['id',_0xa6d2('0x5'),_0xa6d2('0x6'),_0xa6d2('0x7')]}]},'log':_0xa6d2('0x1')});};}; \ No newline at end of file +var _0x0e34=['Agents','../client','getFaxQueues','Request','timeout','strategy','User'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e34,0x1c1));var _0x40e3=function(_0xcb0b48,_0x55480a){_0xcb0b48=_0xcb0b48-0x0;var _0x36887b=_0x0e34[_0xcb0b48];return _0x36887b;};'use strict';var client=require(_0x40e3('0x0'));exports[_0x40e3('0x1')]=function(){return function(){return client[_0x40e3('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x40e3('0x3'),_0x40e3('0x4')],'include':[{'model':_0x40e3('0x5'),'as':_0x40e3('0x6'),'attributes':['id','name','online','faxPause']}]},'log':_0x40e3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 27f8da7..3a00632 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 _0x263e=['DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x45c481,_0x5736cd){var _0x38a5c0=function(_0x512486){while(--_0x512486){_0x45c481['push'](_0x45c481['shift']());}};_0x38a5c0(++_0x5736cd);}(_0x263e,0x1db));var _0xe263=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x263e[_0x1a9204];return _0x17ca68;};'use strict';var client=require(_0xe263('0x0'));exports[_0xe263('0x1')]=function(_0x261363){return client[_0xe263('0x2')](_0xe263('0x3'),{'body':_0x261363,'log':_0xe263('0x3')});};exports[_0xe263('0x4')]=function(_0x1f3b9a,_0x5564b3){return client[_0xe263('0x2')]('UpdateFaxQueueReport',{'body':_0x5564b3,'options':{'where':{'uniqueid':_0x1f3b9a},'order':[['id',_0xe263('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x19b7=['../client','create','Request','CreateFaxQueueReport','update','DESC'];(function(_0x53c559,_0x124f10){var _0x1b93f4=function(_0x34650a){while(--_0x34650a){_0x53c559['push'](_0x53c559['shift']());}};_0x1b93f4(++_0x124f10);}(_0x19b7,0x1b0));var _0x719b=function(_0x3cc70d,_0x4f50cb){_0x3cc70d=_0x3cc70d-0x0;var _0x1c5315=_0x19b7[_0x3cc70d];return _0x1c5315;};'use strict';var client=require(_0x719b('0x0'));exports[_0x719b('0x1')]=function(_0x551d5c){return client[_0x719b('0x2')]('CreateFaxQueueReport',{'body':_0x551d5c,'log':_0x719b('0x3')});};exports[_0x719b('0x4')]=function(_0xb993cf,_0x522bea){return client[_0x719b('0x2')]('UpdateFaxQueueReport',{'body':_0x522bea,'options':{'where':{'uniqueid':_0xb993cf},'order':[['id',_0x719b('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 97ed744..7dd8e37 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 _0xfcb3=['Interval','Intervals','interval','getIntervals','GetInterval','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcb3,0xb1));var _0x3fcb=function(_0x4ad042,_0x28eb47){_0x4ad042=_0x4ad042-0x0;var _0xcc6685=_0xfcb3[_0x4ad042];return _0xcc6685;};'use strict';var client=require('../client');exports[_0x3fcb('0x0')]=function(){return function(){return client['Request'](_0x3fcb('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3fcb('0x2')],'include':[{'model':_0x3fcb('0x3'),'as':_0x3fcb('0x4'),'attributes':['id',_0x3fcb('0x2'),_0x3fcb('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xc7ab=['../client','getIntervals','GetInterval','name','Interval','Intervals','interval'];(function(_0x1b5d6f,_0x50a344){var _0x233c74=function(_0x4b7b29){while(--_0x4b7b29){_0x1b5d6f['push'](_0x1b5d6f['shift']());}};_0x233c74(++_0x50a344);}(_0xc7ab,0xd9));var _0xbc7a=function(_0x3501ed,_0x571ae3){_0x3501ed=_0x3501ed-0x0;var _0x1b64c8=_0xc7ab[_0x3501ed];return _0x1b64c8;};'use strict';var client=require(_0xbc7a('0x0'));exports[_0xbc7a('0x1')]=function(){return function(){return client['Request'](_0xbc7a('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xbc7a('0x3')],'include':[{'model':_0xbc7a('0x4'),'as':_0xbc7a('0x5'),'attributes':['id',_0xbc7a('0x3'),_0xbc7a('0x6')]}]},'log':_0xbc7a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 474829a..4c86089 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 _0xfff0=['addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x9982be,_0x214547){var _0x58366f=function(_0x4bc803){while(--_0x4bc803){_0x9982be['push'](_0x9982be['shift']());}};_0x58366f(++_0x214547);}(_0xfff0,0x139));var _0x0fff=function(_0x487c2c,_0x3aac67){_0x487c2c=_0x487c2c-0x0;var _0x52406c=_0xfff0[_0x487c2c];return _0x52406c;};'use strict';var client=require('../client');exports[_0x0fff('0x0')]=function(_0x2b95e0,_0x148db8){return client['Request'](_0x0fff('0x1'),{'body':_0x148db8,'options':{'where':{'id':_0x2b95e0}},'log':_0x0fff('0x2')});};exports[_0x0fff('0x3')]=function(_0x4bec60,_0x2cd3d5){return client[_0x0fff('0x4')]('AddTagsToMailInteraction',{'body':_0x2cd3d5,'options':{'where':{'id':_0x4bec60}},'log':_0x0fff('0x5')});}; \ No newline at end of file +var _0x47c5=['UpdateMailInteraction','addTags','AddTagsToMailInteraction','../client','update','Request'];(function(_0x351619,_0x1beeec){var _0x4a3b34=function(_0x3e99a2){while(--_0x3e99a2){_0x351619['push'](_0x351619['shift']());}};_0x4a3b34(++_0x1beeec);}(_0x47c5,0x165));var _0x547c=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x47c5[_0x5447fd];return _0x15b28a;};'use strict';var client=require(_0x547c('0x0'));exports[_0x547c('0x1')]=function(_0x2b2280,_0x123697){return client[_0x547c('0x2')](_0x547c('0x3'),{'body':_0x123697,'options':{'where':{'id':_0x2b2280}},'log':'updateMailInteraction'});};exports[_0x547c('0x4')]=function(_0x16f4db,_0x5b48c9){return client[_0x547c('0x2')](_0x547c('0x5'),{'body':_0x5b48c9,'options':{'where':{'id':_0x16f4db}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 0cffce4..59a0319 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 _0xb640=['create','Request','createMailMessage','../client'];(function(_0x3b656f,_0x34dab5){var _0x57dd9b=function(_0x526cb7){while(--_0x526cb7){_0x3b656f['push'](_0x3b656f['shift']());}};_0x57dd9b(++_0x34dab5);}(_0xb640,0x17f));var _0x0b64=function(_0x243911,_0x167f2b){_0x243911=_0x243911-0x0;var _0x55762d=_0xb640[_0x243911];return _0x55762d;};'use strict';var client=require(_0x0b64('0x0'));exports[_0x0b64('0x1')]=function(_0x3abc95){return client[_0x0b64('0x2')]('CreateMailMessage',{'body':_0x3abc95,'log':_0x0b64('0x3')});}; \ No newline at end of file +var _0x6637=['CreateMailMessage','createMailMessage'];(function(_0x13431e,_0x154b58){var _0x3a8846=function(_0x395980){while(--_0x395980){_0x13431e['push'](_0x13431e['shift']());}};_0x3a8846(++_0x154b58);}(_0x6637,0xae));var _0x7663=function(_0xa48cd5,_0x4c11ee){_0xa48cd5=_0xa48cd5-0x0;var _0x49272e=_0x6637[_0xa48cd5];return _0x49272e;};'use strict';var client=require('../client');exports['create']=function(_0x41be4a){return client['Request'](_0x7663('0x0'),{'body':_0x41be4a,'log':_0x7663('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e375805..bbaf38d 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 _0x478a=['Agents','name','online','../client','getMailQueues','Request','timeout','strategy','User'];(function(_0x3446c6,_0x47bade){var _0x3246f1=function(_0x148012){while(--_0x148012){_0x3446c6['push'](_0x3446c6['shift']());}};_0x3246f1(++_0x47bade);}(_0x478a,0x1d7));var _0xa478=function(_0x11b1af,_0x1346e5){_0x11b1af=_0x11b1af-0x0;var _0x168f96=_0x478a[_0x11b1af];return _0x168f96;};'use strict';var client=require(_0xa478('0x0'));exports[_0xa478('0x1')]=function(){return function(){return client[_0xa478('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xa478('0x3'),_0xa478('0x4')],'include':[{'model':_0xa478('0x5'),'as':_0xa478('0x6'),'attributes':['id',_0xa478('0x7'),_0xa478('0x8'),'mailPause']}]},'log':_0xa478('0x1')});};}; \ No newline at end of file +var _0x9eed=['Agents','online','mailPause','getMailQueues','../client','GetMailQueue','name','strategy','User'];(function(_0x4e1464,_0x113b31){var _0x31971d=function(_0x40252f){while(--_0x40252f){_0x4e1464['push'](_0x4e1464['shift']());}};_0x31971d(++_0x113b31);}(_0x9eed,0x70));var _0xd9ee=function(_0x4f66c7,_0x330220){_0x4f66c7=_0x4f66c7-0x0;var _0x5f1f90=_0x9eed[_0x4f66c7];return _0x5f1f90;};'use strict';var client=require(_0xd9ee('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0xd9ee('0x1'),{'options':{'raw':![],'attributes':['id',_0xd9ee('0x2'),'timeout',_0xd9ee('0x3')],'include':[{'model':_0xd9ee('0x4'),'as':_0xd9ee('0x5'),'attributes':['id','name',_0xd9ee('0x6'),_0xd9ee('0x7')]}]},'log':_0xd9ee('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 1d790ee..78841ad 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 _0xfe4a=['../client','create','CreateMailQueueReport','update','DESC'];(function(_0x323ff1,_0x50475c){var _0x34d29e=function(_0x21fea8){while(--_0x21fea8){_0x323ff1['push'](_0x323ff1['shift']());}};_0x34d29e(++_0x50475c);}(_0xfe4a,0x15e));var _0xafe4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xfe4a[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0xafe4('0x0'));exports[_0xafe4('0x1')]=function(_0x2c247c){return client['Request'](_0xafe4('0x2'),{'body':_0x2c247c,'log':_0xafe4('0x2')});};exports[_0xafe4('0x3')]=function(_0x2242b7,_0xb2b38b){return client['Request']('UpdateMailQueueReport',{'body':_0xb2b38b,'options':{'where':{'uniqueid':_0x2242b7},'order':[['id',_0xafe4('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x193b=['UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport','update'];(function(_0xa6e1ec,_0x3e9eb7){var _0x411776=function(_0x1d7d2f){while(--_0x1d7d2f){_0xa6e1ec['push'](_0xa6e1ec['shift']());}};_0x411776(++_0x3e9eb7);}(_0x193b,0xb0));var _0xb193=function(_0x3ad1ab,_0x3c8799){_0x3ad1ab=_0x3ad1ab-0x0;var _0x26d4c9=_0x193b[_0x3ad1ab];return _0x26d4c9;};'use strict';var client=require('../client');exports[_0xb193('0x0')]=function(_0x3609d5){return client[_0xb193('0x1')](_0xb193('0x2'),{'body':_0x3609d5,'log':_0xb193('0x2')});};exports[_0xb193('0x3')]=function(_0x2d679a,_0x337d51){return client[_0xb193('0x1')](_0xb193('0x4'),{'body':_0x337d51,'options':{'where':{'uniqueid':_0x2d679a},'order':[['id',_0xb193('0x5')]],'limit':0x1},'log':_0xb193('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f0a6a56..f96cab1 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 _0xd753=['addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x5673c6,_0xc302ec){var _0x130bd9=function(_0x1653f5){while(--_0x1653f5){_0x5673c6['push'](_0x5673c6['shift']());}};_0x130bd9(++_0xc302ec);}(_0xd753,0x154));var _0x3d75=function(_0x4275a2,_0x1e0939){_0x4275a2=_0x4275a2-0x0;var _0xa16078=_0xd753[_0x4275a2];return _0xa16078;};'use strict';var client=require(_0x3d75('0x0'));exports[_0x3d75('0x1')]=function(_0x4cdd92,_0x4af8cc){return client['Request'](_0x3d75('0x2'),{'body':_0x4af8cc,'options':{'where':{'id':_0x4cdd92}},'log':_0x3d75('0x3')});};exports[_0x3d75('0x4')]=function(_0x29ee1c,_0x593200){return client[_0x3d75('0x5')](_0x3d75('0x6'),{'body':_0x593200,'options':{'where':{'id':_0x29ee1c}},'log':_0x3d75('0x7')});}; \ No newline at end of file +var _0x1ca1=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x1e2e47,_0x28c9bb){var _0x471f21=function(_0x4d1fc3){while(--_0x4d1fc3){_0x1e2e47['push'](_0x1e2e47['shift']());}};_0x471f21(++_0x28c9bb);}(_0x1ca1,0x82));var _0x11ca=function(_0x46eee8,_0x550585){_0x46eee8=_0x46eee8-0x0;var _0x2b8ce1=_0x1ca1[_0x46eee8];return _0x2b8ce1;};'use strict';var client=require(_0x11ca('0x0'));exports[_0x11ca('0x1')]=function(_0x2cad72,_0x41146d){return client[_0x11ca('0x2')](_0x11ca('0x3'),{'body':_0x41146d,'options':{'where':{'id':_0x2cad72}},'log':_0x11ca('0x4')});};exports[_0x11ca('0x5')]=function(_0x40bd82,_0x192f37){return client[_0x11ca('0x2')](_0x11ca('0x6'),{'body':_0x192f37,'options':{'where':{'id':_0x40bd82}},'log':_0x11ca('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index c16b8e0..a8cccce 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 _0xd003=['CreateOpenchannelMessage','createOpenchannelMessage','create','Request'];(function(_0x290bf4,_0x1f0823){var _0x124ee2=function(_0x520b46){while(--_0x520b46){_0x290bf4['push'](_0x290bf4['shift']());}};_0x124ee2(++_0x1f0823);}(_0xd003,0x1b2));var _0x3d00=function(_0x437583,_0x2897ee){_0x437583=_0x437583-0x0;var _0x16d549=_0xd003[_0x437583];return _0x16d549;};'use strict';var client=require('../client');exports[_0x3d00('0x0')]=function(_0x5393f6){return client[_0x3d00('0x1')](_0x3d00('0x2'),{'body':_0x5393f6,'log':_0x3d00('0x3')});}; \ No newline at end of file +var _0x9e31=['createOpenchannelMessage','../client','Request'];(function(_0x5212cf,_0xf4d01){var _0x471ea2=function(_0x38ed9f){while(--_0x38ed9f){_0x5212cf['push'](_0x5212cf['shift']());}};_0x471ea2(++_0xf4d01);}(_0x9e31,0x184));var _0x19e3=function(_0x1c18b9,_0x4f761a){_0x1c18b9=_0x1c18b9-0x0;var _0x58f75f=_0x9e31[_0x1c18b9];return _0x58f75f;};'use strict';var client=require(_0x19e3('0x0'));exports['create']=function(_0x27d2cd){return client[_0x19e3('0x1')]('CreateOpenchannelMessage',{'body':_0x27d2cd,'log':_0x19e3('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d897493..4ea8140 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 _0xe81f=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues'];(function(_0x3ca1f8,_0x4afa33){var _0x94fb6b=function(_0x10c639){while(--_0x10c639){_0x3ca1f8['push'](_0x3ca1f8['shift']());}};_0x94fb6b(++_0x4afa33);}(_0xe81f,0x134));var _0xfe81=function(_0x5581c9,_0x3792da){_0x5581c9=_0x5581c9-0x0;var _0x1a2ef7=_0xe81f[_0x5581c9];return _0x1a2ef7;};'use strict';var client=require(_0xfe81('0x0'));exports[_0xfe81('0x1')]=function(){return function(){return client[_0xfe81('0x2')](_0xfe81('0x3'),{'options':{'raw':![],'attributes':['id',_0xfe81('0x4'),_0xfe81('0x5'),_0xfe81('0x6')],'include':[{'model':_0xfe81('0x7'),'as':_0xfe81('0x8'),'attributes':['id',_0xfe81('0x4'),'online',_0xfe81('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x35d8=['Request','GetOpenchannelQueue','name','timeout','strategy','online','openchannelPause','getOpenchannelQueues'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x35d8,0xa7));var _0x835d=function(_0x178968,_0x5eda25){_0x178968=_0x178968-0x0;var _0xaa3a82=_0x35d8[_0x178968];return _0xaa3a82;};'use strict';var client=require('../client');exports[_0x835d('0x0')]=function(){return function(){return client[_0x835d('0x1')](_0x835d('0x2'),{'options':{'raw':![],'attributes':['id',_0x835d('0x3'),_0x835d('0x4'),_0x835d('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x835d('0x6'),_0x835d('0x7')]}]},'log':_0x835d('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 63adc0a..bbc5e4f 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 _0x6abf=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','create'];(function(_0x42c689,_0x1ac833){var _0x440ce5=function(_0x532b2a){while(--_0x532b2a){_0x42c689['push'](_0x42c689['shift']());}};_0x440ce5(++_0x1ac833);}(_0x6abf,0x1b5));var _0xf6ab=function(_0x4f87c5,_0x26b722){_0x4f87c5=_0x4f87c5-0x0;var _0x201375=_0x6abf[_0x4f87c5];return _0x201375;};'use strict';var client=require('../client');exports[_0xf6ab('0x0')]=function(_0x5434d0){return client[_0xf6ab('0x1')](_0xf6ab('0x2'),{'body':_0x5434d0,'log':_0xf6ab('0x2')});};exports[_0xf6ab('0x3')]=function(_0x1c566e,_0x1065a1){return client[_0xf6ab('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x1065a1,'options':{'where':{'uniqueid':_0x1c566e},'order':[['id',_0xf6ab('0x4')]],'limit':0x1},'log':_0xf6ab('0x5')});}; \ No newline at end of file +var _0x7abb=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','create'];(function(_0xa39eab,_0x59df6e){var _0x4bc4e3=function(_0x3ecb57){while(--_0x3ecb57){_0xa39eab['push'](_0xa39eab['shift']());}};_0x4bc4e3(++_0x59df6e);}(_0x7abb,0xe5));var _0xb7ab=function(_0x5c463f,_0x50e2dc){_0x5c463f=_0x5c463f-0x0;var _0xe89216=_0x7abb[_0x5c463f];return _0xe89216;};'use strict';var client=require(_0xb7ab('0x0'));exports[_0xb7ab('0x1')]=function(_0xc2cac3){return client[_0xb7ab('0x2')](_0xb7ab('0x3'),{'body':_0xc2cac3,'log':_0xb7ab('0x3')});};exports[_0xb7ab('0x4')]=function(_0x2e98b4,_0x31b155){return client[_0xb7ab('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x31b155,'options':{'where':{'uniqueid':_0x2e98b4},'order':[['id',_0xb7ab('0x5')]],'limit':0x1},'log':_0xb7ab('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 59c2dfd..fe44767 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 _0x16d8=['AddTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x452e71,_0x19b0d2){var _0x525bf5=function(_0x5f416f){while(--_0x5f416f){_0x452e71['push'](_0x452e71['shift']());}};_0x525bf5(++_0x19b0d2);}(_0x16d8,0xa3));var _0x816d=function(_0x2f42e6,_0x42ee41){_0x2f42e6=_0x2f42e6-0x0;var _0x382487=_0x16d8[_0x2f42e6];return _0x382487;};'use strict';var client=require('../client');exports[_0x816d('0x0')]=function(_0x1b32c1,_0x1cb443){return client[_0x816d('0x1')](_0x816d('0x2'),{'body':_0x1cb443,'options':{'where':{'id':_0x1b32c1}},'log':_0x816d('0x3')});};exports[_0x816d('0x4')]=function(_0x2c491b,_0x29b15c){return client['Request'](_0x816d('0x5'),{'body':_0x29b15c,'options':{'where':{'id':_0x2c491b}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xef8b=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x404edd,_0x42a1cf){var _0x45b5ef=function(_0x455c02){while(--_0x455c02){_0x404edd['push'](_0x404edd['shift']());}};_0x45b5ef(++_0x42a1cf);}(_0xef8b,0x192));var _0xbef8=function(_0x14b767,_0x577e84){_0x14b767=_0x14b767-0x0;var _0x22267a=_0xef8b[_0x14b767];return _0x22267a;};'use strict';var client=require('../client');exports[_0xbef8('0x0')]=function(_0x2c70dc,_0x98588a){return client[_0xbef8('0x1')](_0xbef8('0x2'),{'body':_0x98588a,'options':{'where':{'id':_0x2c70dc}},'log':_0xbef8('0x3')});};exports[_0xbef8('0x4')]=function(_0x224dd2,_0x201996){return client[_0xbef8('0x1')](_0xbef8('0x5'),{'body':_0x201996,'options':{'where':{'id':_0x224dd2}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 5b0536d..1ad5492 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 _0xdd46=['create','Request','createSmsMessage','../client'];(function(_0x4f1550,_0x34864a){var _0x2ea3ca=function(_0x272eb5){while(--_0x272eb5){_0x4f1550['push'](_0x4f1550['shift']());}};_0x2ea3ca(++_0x34864a);}(_0xdd46,0x16b));var _0x6dd4=function(_0x48f871,_0x3fe2bb){_0x48f871=_0x48f871-0x0;var _0x5c9a4e=_0xdd46[_0x48f871];return _0x5c9a4e;};'use strict';var client=require(_0x6dd4('0x0'));exports[_0x6dd4('0x1')]=function(_0x134e9e){return client[_0x6dd4('0x2')]('CreateSmsMessage',{'body':_0x134e9e,'log':_0x6dd4('0x3')});}; \ No newline at end of file +var _0xaab3=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaab3,0x13d));var _0x3aab=function(_0x406a70,_0x5a3d96){_0x406a70=_0x406a70-0x0;var _0x317fbe=_0xaab3[_0x406a70];return _0x317fbe;};'use strict';var client=require(_0x3aab('0x0'));exports[_0x3aab('0x1')]=function(_0x336daa){return client[_0x3aab('0x2')](_0x3aab('0x3'),{'body':_0x336daa,'log':_0x3aab('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 06f0e21..5d9b5f3 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x2d3d18,_0x475f4c){var _0x202f49=function(_0x41abb5){while(--_0x41abb5){_0x2d3d18['push'](_0x2d3d18['shift']());}};_0x202f49(++_0x475f4c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x424dd9,_0x47bf9c){var _0x117db7=function(_0x25a0c2){while(--_0x25a0c2){_0x424dd9['push'](_0x424dd9['shift']());}};_0x117db7(++_0x47bf9c);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9d02c76..3359b29 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x49d8d8,_0x34f631){var _0x21b823=function(_0x1fd0f9){while(--_0x1fd0f9){_0x49d8d8['push'](_0x49d8d8['shift']());}};_0x21b823(++_0x34f631);}(_0x70e0,0x17b));var _0x070e=function(_0x4e4c28,_0x2ea456){_0x4e4c28=_0x4e4c28-0x0;var _0x204db2=_0x70e0[_0x4e4c28];return _0x204db2;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x209aee,_0x21d407){var _0x4e7264=function(_0x4ddbc2){while(--_0x4ddbc2){_0x209aee['push'](_0x209aee['shift']());}};_0x4e7264(++_0x21d407);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6ee470c..7e39a65 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(_0xe9078d,_0x47a2df){var _0x4250e9=function(_0x46174d){while(--_0x46174d){_0xe9078d['push'](_0xe9078d['shift']());}};_0x4250e9(++_0x47a2df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x1f51e3,_0x3d93f0){var _0x281148=function(_0x5b17f6){while(--_0x5b17f6){_0x1f51e3['push'](_0x1f51e3['shift']());}};_0x281148(++_0x3d93f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 2a72e25..33bf283 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 _0x5bc1=['AddTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x55fd31,_0x2e7d09){var _0x1a16ed=function(_0x163aab){while(--_0x163aab){_0x55fd31['push'](_0x55fd31['shift']());}};_0x1a16ed(++_0x2e7d09);}(_0x5bc1,0xb5));var _0x15bc=function(_0x2d9da8,_0x5d5072){_0x2d9da8=_0x2d9da8-0x0;var _0x57a29c=_0x5bc1[_0x2d9da8];return _0x57a29c;};'use strict';var client=require('../client');exports[_0x15bc('0x0')]=function(_0x15c2f4,_0x34aa12){return client[_0x15bc('0x1')](_0x15bc('0x2'),{'body':_0x34aa12,'options':{'where':{'id':_0x15c2f4}},'log':_0x15bc('0x3')});};exports['addTags']=function(_0x514d81,_0xe94345){return client[_0x15bc('0x1')](_0x15bc('0x4'),{'body':_0xe94345,'options':{'where':{'id':_0x514d81}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xa786=['update','Request','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x55c40b,_0x1f5717){var _0xe2958c=function(_0x561681){while(--_0x561681){_0x55c40b['push'](_0x55c40b['shift']());}};_0xe2958c(++_0x1f5717);}(_0xa786,0x71));var _0x6a78=function(_0x100326,_0x5b3c7a){_0x100326=_0x100326-0x0;var _0x1f5e40=_0xa786[_0x100326];return _0x1f5e40;};'use strict';var client=require(_0x6a78('0x0'));exports[_0x6a78('0x1')]=function(_0x18a14d,_0x4a3fd4){return client[_0x6a78('0x2')]('UpdateWhatsappInteraction',{'body':_0x4a3fd4,'options':{'where':{'id':_0x18a14d}},'log':'updateWhatsappInteraction'});};exports[_0x6a78('0x3')]=function(_0x2b0fed,_0x3b3608){return client[_0x6a78('0x2')](_0x6a78('0x4'),{'body':_0x3b3608,'options':{'where':{'id':_0x2b0fed}},'log':_0x6a78('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2615da6..433241e 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 _0xe1d3=['CreateWhatsappMessage','../client','create','Request'];(function(_0x12e2f4,_0x472ed3){var _0x2416a0=function(_0x169faa){while(--_0x169faa){_0x12e2f4['push'](_0x12e2f4['shift']());}};_0x2416a0(++_0x472ed3);}(_0xe1d3,0x1ed));var _0x3e1d=function(_0x79d70c,_0x3ce35d){_0x79d70c=_0x79d70c-0x0;var _0x4e70a9=_0xe1d3[_0x79d70c];return _0x4e70a9;};'use strict';var client=require(_0x3e1d('0x0'));exports[_0x3e1d('0x1')]=function(_0x51238f){return client[_0x3e1d('0x2')](_0x3e1d('0x3'),{'body':_0x51238f,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x3aeb=['CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x2c5c53,_0x73a70a){var _0xda11fd=function(_0x5b896f){while(--_0x5b896f){_0x2c5c53['push'](_0x2c5c53['shift']());}};_0xda11fd(++_0x73a70a);}(_0x3aeb,0x13a));var _0xb3ae=function(_0x510961,_0x2f9bf3){_0x510961=_0x510961-0x0;var _0x9dc8d9=_0x3aeb[_0x510961];return _0x9dc8d9;};'use strict';var client=require(_0xb3ae('0x0'));exports[_0xb3ae('0x1')]=function(_0x25c334){return client['Request'](_0xb3ae('0x2'),{'body':_0x25c334,'log':_0xb3ae('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3f37917..f06d069 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 _0xe2b4=['Request','GetWhatsappQueue','name','strategy','User','online','../client','getWhatsappQueues'];(function(_0xadd386,_0x1fda2a){var _0xb996dd=function(_0x2c95b8){while(--_0x2c95b8){_0xadd386['push'](_0xadd386['shift']());}};_0xb996dd(++_0x1fda2a);}(_0xe2b4,0x1b6));var _0x4e2b=function(_0x46e789,_0x565713){_0x46e789=_0x46e789-0x0;var _0x2017e3=_0xe2b4[_0x46e789];return _0x2017e3;};'use strict';var client=require(_0x4e2b('0x0'));exports[_0x4e2b('0x1')]=function(){return function(){return client[_0x4e2b('0x2')](_0x4e2b('0x3'),{'options':{'raw':![],'attributes':['id',_0x4e2b('0x4'),'timeout',_0x4e2b('0x5')],'include':[{'model':_0x4e2b('0x6'),'as':'Agents','attributes':['id',_0x4e2b('0x4'),_0x4e2b('0x7'),'whatsappPause']}]},'log':_0x4e2b('0x1')});};}; \ No newline at end of file +var _0xcbfe=['Agents','name','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xcbfe,0x164));var _0xecbf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcbfe[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xecbf('0x0'));exports[_0xecbf('0x1')]=function(){return function(){return client[_0xecbf('0x2')](_0xecbf('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xecbf('0x4'),_0xecbf('0x5')],'include':[{'model':_0xecbf('0x6'),'as':_0xecbf('0x7'),'attributes':['id',_0xecbf('0x8'),_0xecbf('0x9'),_0xecbf('0xa')]}]},'log':_0xecbf('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 901f9a6..78d675e 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 _0xdf43=['update','UpdateWhatsappQueueReport','DESC','Request','CreateWhatsappQueueReport'];(function(_0x3bdd40,_0x414ee6){var _0x216370=function(_0x3e6252){while(--_0x3e6252){_0x3bdd40['push'](_0x3bdd40['shift']());}};_0x216370(++_0x414ee6);}(_0xdf43,0x107));var _0x3df4=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xdf43[_0x2261ce];return _0x524640;};'use strict';var client=require('../client');exports['create']=function(_0x62a110){return client[_0x3df4('0x0')](_0x3df4('0x1'),{'body':_0x62a110,'log':_0x3df4('0x1')});};exports[_0x3df4('0x2')]=function(_0x8d18c7,_0x402462){return client[_0x3df4('0x0')](_0x3df4('0x3'),{'body':_0x402462,'options':{'where':{'uniqueid':_0x8d18c7},'order':[['id',_0x3df4('0x4')]],'limit':0x1},'log':_0x3df4('0x3')});}; \ No newline at end of file +var _0xfde0=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x62a1f1,_0x10ca9c){var _0x195f17=function(_0xea8d9a){while(--_0xea8d9a){_0x62a1f1['push'](_0x62a1f1['shift']());}};_0x195f17(++_0x10ca9c);}(_0xfde0,0x143));var _0x0fde=function(_0x32a47e,_0x3bc378){_0x32a47e=_0x32a47e-0x0;var _0x4a9368=_0xfde0[_0x32a47e];return _0x4a9368;};'use strict';var client=require(_0x0fde('0x0'));exports[_0x0fde('0x1')]=function(_0x2db49c){return client[_0x0fde('0x2')](_0x0fde('0x3'),{'body':_0x2db49c,'log':_0x0fde('0x3')});};exports[_0x0fde('0x4')]=function(_0x231a86,_0x183f1d){return client[_0x0fde('0x2')](_0x0fde('0x5'),{'body':_0x183f1d,'options':{'where':{'uniqueid':_0x231a86},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 98a242c..9b39a95 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 _0x998c=['[%s][QUEUE]\x20%s','stack','stop','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','message','join','timeout','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log'];(function(_0x48a509,_0x30df45){var _0x4155e9=function(_0x29301f){while(--_0x29301f){_0x48a509['push'](_0x48a509['shift']());}};_0x4155e9(++_0x30df45);}(_0x998c,0x1d7));var _0xc998=function(_0x2330c5,_0x5ddb84){_0x2330c5=_0x2330c5-0x0;var _0x48133d=_0x998c[_0x2330c5];return _0x48133d;};'use strict';var schema=require(_0xc998('0x0'));var _=require(_0xc998('0x1'));var util=require('util');var seqqueue=require(_0xc998('0x2'));var logger=require(_0xc998('0x3'))(_0xc998('0x4'));var strategy=require(_0xc998('0x5'));var queue=schema({'name':{'type':_0xc998('0x6'),'required':!![],'message':_0xc998('0x7')},'timeout':{'type':_0xc998('0x8'),'message':_0xc998('0x9')}});function writeLog(_0x15a062,_0x1ff2d8,_0x3854d0){return logger['info'](util[_0xc998('0xa')](_0xc998('0xb'),_0x15a062,_0x1ff2d8[_0xc998('0xc')],_0x3854d0));}function handleFindAgent(_0x25b77c){return function(_0x51fd9e){return _0x51fd9e[_0xc998('0xc')][_0xc998('0xd')]()===_0x25b77c[_0xc998('0xd')]();};}exports['consequence']=function(_0x46889f,_0x2333a7,_0x1f38c5,_0x399853){return function(_0x187928){try{var _0x5b84ef={'name':_0x2333a7[0x0],'timeout':_0x2333a7[0x1]};var _0x1dc09b=queue[_0xc998('0x0')](_0x5b84ef,{'typecast':!![]});if(_0x1dc09b[_0xc998('0xe')]){logger[_0xc998('0xf')](_0xc998('0x10'),_0x46889f,_['map'](_0x1dc09b,_0xc998('0x11'))[_0xc998('0x12')](',\x20'));_0x187928['stop']();}else{var _0xdc2a66=_['find'](_0x1f38c5['agents'],handleFindAgent(_0x5b84ef['name']));if(_0xdc2a66){var _0x367052=(_0x5b84ef[_0xc998('0x13')]||0xa)*0x3e8;var _0x498c49,_0x57a414;var _0x432868=seqqueue[_0xc998('0x14')](_0x367052);_0x432868['id']=_0x46889f;_0x432868[_0xc998('0x15')]=_0x367052;_0x432868[_0xc998('0x16')]=_0x399853[_0xc998('0x16')];writeLog(_0x46889f,_0xdc2a66,util['format'](_0xc998('0x17'),_0x367052));_0x1f38c5[_0xc998('0x18')][_0x46889f]['on'](_0xc998('0x19'),function(){logger[_0xc998('0x1a')](_0xc998('0x1b'),_0x46889f);clearTimeout(_0x57a414);_0x57a414=undefined;_0x432868[_0xc998('0x1c')]();if(_0x1f38c5['rules'][_0x46889f]){delete _0x1f38c5[_0xc998('0x18')][_0x46889f];}_0x187928['stop']();});_0x1f38c5[_0xc998('0x18')][_0x46889f]['on']('complete',function(){if(_0x1f38c5[_0xc998('0x18')][_0x46889f]){delete _0x1f38c5[_0xc998('0x18')][_0x46889f];}});_0x57a414=setTimeout(function(){logger[_0xc998('0x1a')](_0xc998('0x1d'),_0x46889f);clearTimeout(_0x57a414);_0x432868[_0xc998('0x1c')]();_0x187928[_0xc998('0x1e')]();},_0x367052);strategy['agent'](_0x432868,_0xdc2a66,_0x1f38c5,_0x399853);}else{logger[_0xc998('0xf')](_0xc998('0x1f'),_0x46889f,_0x5b84ef[_0xc998('0xc')]);_0x187928['stop']();}}}catch(_0x3425b9){console[_0xc998('0x20')](_0x3425b9);logger[_0xc998('0xf')](_0xc998('0x21'),_0x46889f,_0x3425b9[_0xc998('0x22')]);_0x187928[_0xc998('0x23')]();}};}; \ No newline at end of file +var _0x4c4a=['number','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','join','stop','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x3263f5,_0x3a846b){var _0x3f225f=function(_0x24484e){while(--_0x24484e){_0x3263f5['push'](_0x3263f5['shift']());}};_0x3f225f(++_0x3a846b);}(_0x4c4a,0x190));var _0xa4c4=function(_0x5cabf8,_0x1660c9){_0x5cabf8=_0x5cabf8-0x0;var _0x4bf0fc=_0x4c4a[_0x5cabf8];return _0x4bf0fc;};'use strict';var schema=require(_0xa4c4('0x0'));var _=require(_0xa4c4('0x1'));var util=require(_0xa4c4('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xa4c4('0x3'))(_0xa4c4('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xa4c4('0x5'),'required':!![],'message':_0xa4c4('0x6')},'timeout':{'type':_0xa4c4('0x7'),'message':_0xa4c4('0x8')}});function writeLog(_0x46e381,_0x56f8c4,_0x433d8f){return logger[_0xa4c4('0x9')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x46e381,_0x56f8c4[_0xa4c4('0xa')],_0x433d8f));}function handleFindAgent(_0x3c0699){return function(_0x2aa221){return _0x2aa221['name'][_0xa4c4('0xb')]()===_0x3c0699[_0xa4c4('0xb')]();};}exports[_0xa4c4('0xc')]=function(_0x24b0cd,_0x2cbd5c,_0x5cd398,_0x70d3e8){return function(_0x26b086){try{var _0xf93aad={'name':_0x2cbd5c[0x0],'timeout':_0x2cbd5c[0x1]};var _0x4dcd77=queue[_0xa4c4('0x0')](_0xf93aad,{'typecast':!![]});if(_0x4dcd77[_0xa4c4('0xd')]){logger[_0xa4c4('0xe')](_0xa4c4('0xf'),_0x24b0cd,_[_0xa4c4('0x10')](_0x4dcd77,'message')[_0xa4c4('0x11')](',\x20'));_0x26b086[_0xa4c4('0x12')]();}else{var _0x1d4b43=_['find'](_0x5cd398[_0xa4c4('0x13')],handleFindAgent(_0xf93aad[_0xa4c4('0xa')]));if(_0x1d4b43){var _0x1c291c=(_0xf93aad[_0xa4c4('0x14')]||0xa)*0x3e8;var _0x3e68bf,_0x14766c;var _0x4b8bc7=seqqueue[_0xa4c4('0x15')](_0x1c291c);_0x4b8bc7['id']=_0x24b0cd;_0x4b8bc7[_0xa4c4('0x16')]=_0x1c291c;_0x4b8bc7[_0xa4c4('0x17')]=_0x70d3e8['channel'];writeLog(_0x24b0cd,_0x1d4b43,util[_0xa4c4('0x18')](_0xa4c4('0x19'),_0x1c291c));_0x5cd398[_0xa4c4('0x1a')][_0x24b0cd]['on'](_0xa4c4('0x1b'),function(){logger[_0xa4c4('0x9')](_0xa4c4('0x1c'),_0x24b0cd);clearTimeout(_0x14766c);_0x14766c=undefined;_0x4b8bc7['close']();if(_0x5cd398[_0xa4c4('0x1a')][_0x24b0cd]){delete _0x5cd398['rules'][_0x24b0cd];}_0x26b086[_0xa4c4('0x12')]();});_0x5cd398[_0xa4c4('0x1a')][_0x24b0cd]['on'](_0xa4c4('0x1d'),function(){if(_0x5cd398['rules'][_0x24b0cd]){delete _0x5cd398[_0xa4c4('0x1a')][_0x24b0cd];}});_0x14766c=setTimeout(function(){logger[_0xa4c4('0x9')](_0xa4c4('0x1e'),_0x24b0cd);clearTimeout(_0x14766c);_0x4b8bc7[_0xa4c4('0x1f')]();_0x26b086[_0xa4c4('0x20')]();},_0x1c291c);strategy['agent'](_0x4b8bc7,_0x1d4b43,_0x5cd398,_0x70d3e8);}else{logger[_0xa4c4('0xe')](_0xa4c4('0x21'),_0x24b0cd,_0xf93aad['name']);_0x26b086['stop']();}}}catch(_0x3eb742){console[_0xa4c4('0x22')](_0x3eb742);logger['error'](_0xa4c4('0x23'),_0x24b0cd,_0x3eb742[_0xa4c4('0x24')]);_0x26b086[_0xa4c4('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 62ce992..08e8add 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 _0xba96=['created','isEmpty','getMustacheRender','create','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','message','toString','amazonlex','providerName','providerResponse','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst'];(function(_0x2f1682,_0x5586f0){var _0x5b76e8=function(_0x338ef6){while(--_0x338ef6){_0x2f1682['push'](_0x2f1682['shift']());}};_0x5b76e8(++_0x5586f0);}(_0xba96,0x14d));var _0x6ba9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba96[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0x6ba9('0x0'));var AWS=require(_0x6ba9('0x1'));var utils=require(_0x6ba9('0x2'));var logger=require(_0x6ba9('0x3'))('routing');var rpc={'chatMessage':require(_0x6ba9('0x4')),'openchannelMessage':require(_0x6ba9('0x5')),'mailMessage':require(_0x6ba9('0x6')),'smsMessage':require(_0x6ba9('0x7')),'faxMessage':require(_0x6ba9('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x6ba9('0x9')]=function(_0x31d499,_0x1c20fd){return function(_0xf7d33f){try{if(!_[_0x6ba9('0xa')](this[_0x6ba9('0xb')]['UserId'])){logger[_0x6ba9('0xc')](_0x6ba9('0xd'),_0x31d499,_0x6ba9('0xe'));return _0xf7d33f[_0x6ba9('0xf')]();}var _0x2ab7b1={'ContactId':this[_0x6ba9('0x10')]['id'],'sentAt':moment()[_0x6ba9('0x11')](_0x6ba9('0x12')),'direction':_0x6ba9('0x13')};if(this[_0x6ba9('0x14')]===_0x6ba9('0x15')||this[_0x6ba9('0x14')]==='whatsapp'){_0x2ab7b1[_0x6ba9('0x16')]=this['interaction'][_0x6ba9('0x16')];}var _0x4f3448=this['channel'];if(_0x4f3448===_0x6ba9('0x17')){_0x2ab7b1[_0x6ba9('0x18')]=this[_0x6ba9('0x19')]['id'];}else{_0x2ab7b1[_[_0x6ba9('0x1a')](_0x4f3448)+'AccountId']=this[_0x6ba9('0x19')]['id'];}_0x2ab7b1[_[_0x6ba9('0x1a')](_0x4f3448)+'InteractionId']=this[_0x6ba9('0xb')]['id'];if(this[_0x6ba9('0xb')][_0x6ba9('0x1b')]){var _0x133381=_0x1c20fd[0x4];if(!_[_0x6ba9('0x1c')](_0x133381)){_0x2ab7b1['body']=utils[_0x6ba9('0x1d')](_0x133381,this);return rpc[_0x4f3448+'Message'][_0x6ba9('0x1e')](_0x2ab7b1)[_0x6ba9('0x1f')](function(_0x454950){logger[_0x6ba9('0xc')]('[%s][AMAZONLEX]\x20%s',_0x31d499,_0x2ab7b1[_0x6ba9('0x20')]);})[_0x6ba9('0x21')](function(_0xdb8dcd){logger[_0x6ba9('0x22')](_0x6ba9('0xd'),_0x31d499,JSON[_0x6ba9('0x23')](_0xdb8dcd));})[_0x6ba9('0x24')](function(){logger[_0x6ba9('0xc')](_0x6ba9('0x25'),_0x31d499);_0xf7d33f[_0x6ba9('0x26')]();});}else{logger[_0x6ba9('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x31d499);_0xf7d33f[_0x6ba9('0x26')]();}}else{var _0x5483ba=this;var _0x4e25cd=new AWS[(_0x6ba9('0x27'))]({'accessKeyId':_0x1c20fd[0x0],'secretAccessKey':_0x1c20fd[0x1],'region':_0x1c20fd[0x2]});var _0x5da2ef={'botAlias':'$LATEST','botName':_0x1c20fd[0x3],'inputText':this[_0x6ba9('0x28')][_0x6ba9('0x20')],'userId':this['channel']+':'+this['interaction']['id'][_0x6ba9('0x29')]()};_0x4e25cd['postText'](_0x5da2ef,function(_0x2ca857,_0x3deb83){if(_0x2ca857){logger[_0x6ba9('0x22')](_0x6ba9('0xd'),_0x31d499,_0x2ca857[_0x6ba9('0x28')]);_0xf7d33f[_0x6ba9('0xf')]();}else if(_0x3deb83&&_0x3deb83[_0x6ba9('0x28')]){_0x5483ba[_0x6ba9('0x20')][_0x6ba9('0x2a')]=_0x3deb83;_0x2ab7b1[_0x6ba9('0x20')]=_0x3deb83['message'];_0x2ab7b1[_0x6ba9('0x2b')]=_0x6ba9('0x2a');_0x2ab7b1[_0x6ba9('0x2c')]=JSON[_0x6ba9('0x23')](_0x3deb83);return rpc[_0x4f3448+'Message'][_0x6ba9('0x1e')](_0x2ab7b1)[_0x6ba9('0x1f')](function(_0x346b62){logger[_0x6ba9('0xc')]('[%s][AMAZONLEX]\x20%s',_0x31d499,_0x2ab7b1['body']);if(_0x3deb83['dialogState']=='Failed'){_0xf7d33f[_0x6ba9('0xf')]();}else{_0xf7d33f[_0x6ba9('0x26')]();}})[_0x6ba9('0x21')](function(_0x1fae06){logger[_0x6ba9('0x22')]('[%s][AMAZONLEX]\x20%s',_0x31d499,JSON['stringify'](_0x1fae06));_0xf7d33f[_0x6ba9('0xf')]();});}else{_0xf7d33f[_0x6ba9('0xf')]();}});}}catch(_0x172f82){logger[_0x6ba9('0x22')]('[%s][AMAZONLEX]\x20%s',_0x31d499,JSON['stringify'](_0x172f82));_0xf7d33f['stop']();}};}; \ No newline at end of file +var _0x63ea=['isEmpty','getMustacheRender','Message','create','[%s][AMAZONLEX]\x20%s','body','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','error','amazonlex','providerName','providerResponse','then','dialogState','catch','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created'];(function(_0x121cc8,_0x1a644f){var _0x495371=function(_0x1b120e){while(--_0x1b120e){_0x121cc8['push'](_0x121cc8['shift']());}};_0x495371(++_0x1a644f);}(_0x63ea,0x109));var _0xa63e=function(_0x29474f,_0x1c2837){_0x29474f=_0x29474f-0x0;var _0x1a65b1=_0x63ea[_0x29474f];return _0x1a65b1;};'use strict';var _=require(_0xa63e('0x0'));var moment=require(_0xa63e('0x1'));var AWS=require('aws-sdk');var utils=require(_0xa63e('0x2'));var logger=require(_0xa63e('0x3'))('routing');var rpc={'chatMessage':require(_0xa63e('0x4')),'openchannelMessage':require(_0xa63e('0x5')),'mailMessage':require(_0xa63e('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa63e('0x7')),'whatsappMessage':require(_0xa63e('0x8'))};exports[_0xa63e('0x9')]=function(_0x18a717,_0x46336b){return function(_0x5483d2){try{if(!_[_0xa63e('0xa')](this[_0xa63e('0xb')][_0xa63e('0xc')])){logger[_0xa63e('0xd')]('[%s][AMAZONLEX]\x20%s',_0x18a717,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5483d2[_0xa63e('0xe')]();}var _0xf0ad11={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa63e('0xf')](_0xa63e('0x10')),'direction':_0xa63e('0x11')};if(this['channel']===_0xa63e('0x12')||this['channel']===_0xa63e('0x13')){_0xf0ad11[_0xa63e('0x14')]=this[_0xa63e('0xb')][_0xa63e('0x14')];}var _0x135216=this[_0xa63e('0x15')];if(_0x135216===_0xa63e('0x16')){_0xf0ad11[_0xa63e('0x17')]=this[_0xa63e('0x18')]['id'];}else{_0xf0ad11[_['upperFirst'](_0x135216)+_0xa63e('0x19')]=this[_0xa63e('0x18')]['id'];}_0xf0ad11[_[_0xa63e('0x1a')](_0x135216)+_0xa63e('0x1b')]=this[_0xa63e('0xb')]['id'];if(this[_0xa63e('0xb')][_0xa63e('0x1c')]){var _0x29890e=_0x46336b[0x4];if(!_[_0xa63e('0x1d')](_0x29890e)){_0xf0ad11['body']=utils[_0xa63e('0x1e')](_0x29890e,this);return rpc[_0x135216+_0xa63e('0x1f')][_0xa63e('0x20')](_0xf0ad11)['then'](function(_0x2f05de){logger['info'](_0xa63e('0x21'),_0x18a717,_0xf0ad11[_0xa63e('0x22')]);})['catch'](function(_0x57decc){logger['error'](_0xa63e('0x21'),_0x18a717,JSON[_0xa63e('0x23')](_0x57decc));})['finally'](function(){logger[_0xa63e('0xd')](_0xa63e('0x24'),_0x18a717);_0x5483d2['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x18a717);_0x5483d2[_0xa63e('0x25')]();}}else{var _0x5de25e=this;var _0x339b03=new AWS[(_0xa63e('0x26'))]({'accessKeyId':_0x46336b[0x0],'secretAccessKey':_0x46336b[0x1],'region':_0x46336b[0x2]});var _0x5ccb92={'botAlias':_0xa63e('0x27'),'botName':_0x46336b[0x3],'inputText':this[_0xa63e('0x28')][_0xa63e('0x22')],'userId':this['channel']+':'+this['interaction']['id'][_0xa63e('0x29')]()};_0x339b03['postText'](_0x5ccb92,function(_0x417ea1,_0x3201f1){if(_0x417ea1){logger[_0xa63e('0x2a')](_0xa63e('0x21'),_0x18a717,_0x417ea1[_0xa63e('0x28')]);_0x5483d2[_0xa63e('0xe')]();}else if(_0x3201f1&&_0x3201f1[_0xa63e('0x28')]){_0x5de25e[_0xa63e('0x22')][_0xa63e('0x2b')]=_0x3201f1;_0xf0ad11[_0xa63e('0x22')]=_0x3201f1[_0xa63e('0x28')];_0xf0ad11[_0xa63e('0x2c')]=_0xa63e('0x2b');_0xf0ad11[_0xa63e('0x2d')]=JSON[_0xa63e('0x23')](_0x3201f1);return rpc[_0x135216+'Message'][_0xa63e('0x20')](_0xf0ad11)[_0xa63e('0x2e')](function(_0x17f1ee){logger[_0xa63e('0xd')](_0xa63e('0x21'),_0x18a717,_0xf0ad11['body']);if(_0x3201f1[_0xa63e('0x2f')]=='Failed'){_0x5483d2['next']();}else{_0x5483d2[_0xa63e('0x25')]();}})[_0xa63e('0x30')](function(_0x351681){logger[_0xa63e('0x2a')](_0xa63e('0x21'),_0x18a717,JSON[_0xa63e('0x23')](_0x351681));_0x5483d2[_0xa63e('0xe')]();});}else{_0x5483d2[_0xa63e('0xe')]();}});}}catch(_0x2f7a53){logger[_0xa63e('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x18a717,JSON[_0xa63e('0x23')](_0x2f7a53));_0x5483d2['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index dbe0fff..51e345b 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 _0xd669=['next','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','service','Smtp','host','port','secure','authentication','auth','user','pass','html','body',''+_['replace'](_0x3e668d[_0x9d66('0x36')],'';_0x3e668d['headers']={'Auto-Submitted':_0x9d66('0x38'),'X-Auto-Response-Suppress':_0x9d66('0x39'),'Precedence':_0x9d66('0x3a')};return mailRpc[_0x9d66('0x3b')](_0x46e8c0,_0x3e668d)[_0x9d66('0x3c')](function(_0xe6c465){logger[_0x9d66('0x11')](_0x9d66('0x3d'),_0x5adbf7);_0x3e668d[_0x9d66('0x3e')]=_0xe6c465[_0x9d66('0x1e')]['messageId'];return rpc[_0x54b0eb+'Message'][_0x9d66('0x3f')](_0x3e668d);})[_0x9d66('0x3c')](function(_0x599505){logger[_0x9d66('0x11')]('[%s][AUTOREPLY]\x20%s',_0x5adbf7,JSON[_0x9d66('0x40')](_0x599505));})[_0x9d66('0x41')](function(_0x14d3c0){logger[_0x9d66('0x42')](_0x9d66('0x43'),_0x5adbf7,JSON[_0x9d66('0x40')](_0x14d3c0));})[_0x9d66('0x44')](function(){Promise[_0x9d66('0x45')]()[_0x9d66('0x3c')](function(){if(_0x46b241[0x0]!=='2'||_0x310066[_0x9d66('0x46')])return;return rpc[_0x54b0eb+_0x9d66('0x47')]['update'](_0x310066['id'],{'autoreplyExecuted':!![]})['then'](function(_0x333166){logger[_0x9d66('0x11')](_0x9d66('0x17'),_0x5adbf7,JSON['stringify'](_0x333166));})[_0x9d66('0x41')](function(_0x485413){logger[_0x9d66('0x42')](_0x9d66('0x48'),_0x5adbf7,JSON[_0x9d66('0x40')](_0x485413));});})[_0x9d66('0x3c')](function(){_0x3e0774[_0x9d66('0x13')]();});});}else{return rpc[this[_0x9d66('0x1c')]+_0x9d66('0x2b')][_0x9d66('0x3f')](_0x3e668d)[_0x9d66('0x3c')](function(_0xdfa498){logger[_0x9d66('0x11')](_0x9d66('0x49'),_0x5adbf7,_0x3e668d['body']);})[_0x9d66('0x41')](function(_0x1c8665){logger[_0x9d66('0x42')](_0x9d66('0x49'),_0x5adbf7,JSON[_0x9d66('0x40')](_0x1c8665));})[_0x9d66('0x44')](function(){Promise[_0x9d66('0x45')]()['then'](function(){if(_0x46b241[0x0]!=='2'||_0x310066[_0x9d66('0x46')])return;return rpc[_0x54b0eb+_0x9d66('0x47')]['update'](_0x310066['id'],{'autoreplyExecuted':!![]})[_0x9d66('0x3c')](function(_0xd77454){logger[_0x9d66('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5adbf7,JSON[_0x9d66('0x40')](_0xd77454));})[_0x9d66('0x41')](function(_0x14367e){logger[_0x9d66('0x42')](_0x9d66('0x48'),_0x5adbf7,JSON[_0x9d66('0x40')](_0x14367e));});})[_0x9d66('0x3c')](function(){_0x3e0774['next']();});});}}}catch(_0x69eeac){logger[_0x9d66('0x42')](_0x9d66('0x49'),_0x5adbf7,JSON['stringify'](_0x69eeac));_0x3e0774['stop']();}};}; \ No newline at end of file +var _0xea8c=['../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','Smtp','service','host','port','secure','auth','user','messageId','html','replace','','auto-replied','All','auto_reply','sendMailMessage','then','create','stringify','error','finally','resolve','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','update','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction'];(function(_0xcb5a3c,_0x5588c3){var _0x1229a0=function(_0x2be096){while(--_0x2be096){_0xcb5a3c['push'](_0xcb5a3c['shift']());}};_0x1229a0(++_0x5588c3);}(_0xea8c,0xd4));var _0xcea8=function(_0x31aace,_0x415c7c){_0x31aace=_0x31aace-0x0;var _0x397f6d=_0xea8c[_0x31aace];return _0x397f6d;};'use strict';var _=require(_0xcea8('0x0'));var moment=require(_0xcea8('0x1'));var utils=require(_0xcea8('0x2'));var logger=require(_0xcea8('0x3'))('routing');var rpc={'chatMessage':require(_0xcea8('0x4')),'openchannelMessage':require(_0xcea8('0x5')),'mailMessage':require(_0xcea8('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xcea8('0x7')),'whatsappMessage':require(_0xcea8('0x8')),'chatInteraction':require(_0xcea8('0x9')),'openchannelInteraction':require(_0xcea8('0xa')),'mailInteraction':require(_0xcea8('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xcea8('0xc')),'whatsappInteraction':require(_0xcea8('0xd'))};var mailRpc=require(_0xcea8('0xe'));exports['consequence']=function(_0x5e29e4,_0x2b03a4,_0x86430d,_0x404262){return function(_0x22fa39){try{var _0x29c404=this[_0xcea8('0xf')];if(_0x29c404===_0xcea8('0x10')&&_0x404262[_0xcea8('0x11')][_0xcea8('0x12')]){logger[_0xcea8('0x13')](_0xcea8('0x14'),_0x5e29e4,_0xcea8('0x15'));return _0x22fa39[_0xcea8('0x16')]();}if(_0x2b03a4[0x0]==='1'&&(_[_0xcea8('0x17')](this[_0xcea8('0x18')]['created'])||!this[_0xcea8('0x18')][_0xcea8('0x19')])){logger['info'](_0xcea8('0x14'),_0x5e29e4,_0xcea8('0x1a'));return _0x22fa39[_0xcea8('0x16')]();}if(_0x2b03a4[0x0]==='2'&&this['interaction'][_0xcea8('0x1b')]){logger['info'](_0xcea8('0x1c'),_0x5e29e4,_0xcea8('0x1d'));return _0x22fa39[_0xcea8('0x16')]();}var _0x4039f1={'ContactId':this[_0xcea8('0x1e')]['id'],'sentAt':moment()[_0xcea8('0x1f')](_0xcea8('0x20')),'direction':_0xcea8('0x21')};if(this[_0xcea8('0xf')]===_0xcea8('0x10')){_0x4039f1[_0xcea8('0x11')]=utils[_0xcea8('0x22')](_0x2b03a4[0x2],this);}else{_0x4039f1[_0xcea8('0x11')]=utils[_0xcea8('0x22')](_0x2b03a4[0x1],this);}if(this[_0xcea8('0x23')]){_0x4039f1['to']=this[_0xcea8('0x23')]['from']||'';if(this[_0xcea8('0xf')]===_0xcea8('0x10')&&_0x2b03a4[0x1]==='1'){_0x4039f1['cc']=this[_0xcea8('0x23')]['cc']||'';}_0x4039f1['from']=this[_0xcea8('0x23')]['to']||'';_0x4039f1[_0xcea8('0x24')]=this[_0xcea8('0x23')][_0xcea8('0x24')]||'';_0x4039f1[_0xcea8('0x25')]=!![];if(this[_0xcea8('0x23')][_0xcea8('0x26')]){_0x4039f1[_0xcea8('0x26')]='';_0x4039f1['subject']+=_[_0xcea8('0x27')](this[_0xcea8('0x23')]['subject'],'Re:')?'':_0xcea8('0x28');_0x4039f1[_0xcea8('0x26')]+=this[_0xcea8('0x23')][_0xcea8('0x26')];}}if(this[_0xcea8('0xf')]===_0xcea8('0x29')){_0x4039f1[_0xcea8('0x2a')]=this[_0xcea8('0x2b')]['id'];}else{_0x4039f1[_[_0xcea8('0x2c')](this['channel'])+_0xcea8('0x2d')]=this[_0xcea8('0x2b')]['id'];}_0x4039f1[_[_0xcea8('0x2c')](this[_0xcea8('0xf')])+'InteractionId']=this[_0xcea8('0x18')]['id'];var _0x17904d=this[_0xcea8('0x18')];if(rpc[this[_0xcea8('0xf')]+_0xcea8('0x2e')]){if(this['channel']===_0xcea8('0x10')){var _0x2aa338={'tls':{'rejectUnauthorized':![]}};if(this[_0xcea8('0x2b')][_0xcea8('0x2f')][_0xcea8('0x30')]){_0x2aa338[_0xcea8('0x30')]=this[_0xcea8('0x2b')][_0xcea8('0x2f')][_0xcea8('0x30')];}else{_0x2aa338[_0xcea8('0x31')]=this['account'][_0xcea8('0x2f')]['host'];_0x2aa338[_0xcea8('0x32')]=this[_0xcea8('0x2b')][_0xcea8('0x2f')][_0xcea8('0x32')];_0x2aa338[_0xcea8('0x33')]=this[_0xcea8('0x2b')][_0xcea8('0x2f')][_0xcea8('0x33')];}if(this[_0xcea8('0x2b')][_0xcea8('0x2f')]['authentication']){_0x2aa338[_0xcea8('0x34')]={'user':this[_0xcea8('0x2b')][_0xcea8('0x2f')][_0xcea8('0x35')],'pass':this[_0xcea8('0x2b')][_0xcea8('0x2f')]['pass']};}_0x4039f1['inReplyTo']=this['message'][_0xcea8('0x36')];_0x4039f1[_0xcea8('0x37')]=''+_[_0xcea8('0x38')](_0x4039f1[_0xcea8('0x11')],_0xcea8('0x39'),']+(>|$)/g,''),'priorityTrue':_0x4479ee[0x1],'priorityFalse':_0x4479ee[0x2]};var _0x53545e=gotoif[_0x65ca('0x0')](_0x1eb64e,{'typecast':!![]});if(_0x53545e['length']){logger[_0x65ca('0xc')](_0x65ca('0xd'),_0x68bce9,_[_0x65ca('0xe')](_0x53545e,_0x65ca('0xf'))[_0x65ca('0x10')](',\x20'));_0x3d4f51['stop']();}else{try{var _0x2f64b8=eval('('+_0x1eb64e[_0x65ca('0x11')]+')');var _0x1ddea0=_0x2f64b8?_0x1eb64e[_0x65ca('0x12')]:_0x1eb64e[_0x65ca('0x13')];logger[_0x65ca('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x68bce9,_0x1eb64e['condition'],_0x2f64b8,_0x1ddea0||'next');if(_0x1ddea0){var _0xa6db9b=_[_0x65ca('0x15')](_0x3d4f51[_0x65ca('0x16')](),{'p':_0x1ddea0});if(_0xa6db9b>=0x0){logger[_0x65ca('0x14')](_0x65ca('0x17'),_0x68bce9,_0x1ddea0||_0x65ca('0x18'),_0xa6db9b);_0x3d4f51[_0x65ca('0x18')](_0xa6db9b);}else{logger[_0x65ca('0x14')](_0x65ca('0x19'),_0x68bce9,_0x1ddea0||'next');_0x3d4f51[_0x65ca('0x1a')]();}}else{_0x3d4f51[_0x65ca('0x18')]();}}catch(_0x119b43){logger[_0x65ca('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x68bce9,_0x119b43[_0x65ca('0xf')]);_0x3d4f51[_0x65ca('0x1a')]();}}}catch(_0x31232b){logger[_0x65ca('0xc')](_0x65ca('0xd'),_0x68bce9,JSON[_0x65ca('0x1b')](_0x31232b));_0x3d4f51[_0x65ca('0x1a')]();}};}; \ No newline at end of file +var _0x9f56=['info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','stop','condition','priorityTrue','priorityFalse'];(function(_0x5a3498,_0x6c4923){var _0x57ad21=function(_0x553d56){while(--_0x553d56){_0x5a3498['push'](_0x5a3498['shift']());}};_0x57ad21(++_0x6c4923);}(_0x9f56,0x9a));var _0x69f5=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x9f56[_0x2eb5bc];return _0x51c7b1;};'use strict';var schema=require(_0x69f5('0x0'));var _=require(_0x69f5('0x1'));var htmlToText=require(_0x69f5('0x2'));var utils=require(_0x69f5('0x3'));var logger=require('../../../../config/logger')(_0x69f5('0x4'));var gotoif=schema({'condition':{'type':_0x69f5('0x5'),'required':!![],'message':_0x69f5('0x6')},'priorityTrue':{'type':_0x69f5('0x7'),'message':_0x69f5('0x8')},'priorityFalse':{'type':_0x69f5('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x8aba82,_0x588ae7){return function(_0x4e71dc){try{var _0x1936ca={'condition':htmlToText[_0x69f5('0x9')](utils[_0x69f5('0xa')](_0x588ae7[0x0],this),{'wordwrap':![]})[_0x69f5('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x588ae7[0x1],'priorityFalse':_0x588ae7[0x2]};var _0x188d6a=gotoif[_0x69f5('0x0')](_0x1936ca,{'typecast':!![]});if(_0x188d6a[_0x69f5('0xc')]){logger[_0x69f5('0xd')](_0x69f5('0xe'),_0x8aba82,_[_0x69f5('0xf')](_0x188d6a,'message')['join'](',\x20'));_0x4e71dc[_0x69f5('0x10')]();}else{try{var _0x4f606b=eval('('+_0x1936ca[_0x69f5('0x11')]+')');var _0x37a02e=_0x4f606b?_0x1936ca[_0x69f5('0x12')]:_0x1936ca[_0x69f5('0x13')];logger[_0x69f5('0x14')](_0x69f5('0x15'),_0x8aba82,_0x1936ca[_0x69f5('0x11')],_0x4f606b,_0x37a02e||_0x69f5('0x16'));if(_0x37a02e){var _0x2626c3=_['findIndex'](_0x4e71dc[_0x69f5('0x17')](),{'p':_0x37a02e});if(_0x2626c3>=0x0){logger[_0x69f5('0x14')](_0x69f5('0x18'),_0x8aba82,_0x37a02e||_0x69f5('0x16'),_0x2626c3);_0x4e71dc[_0x69f5('0x16')](_0x2626c3);}else{logger[_0x69f5('0x14')](_0x69f5('0x19'),_0x8aba82,_0x37a02e||'next');_0x4e71dc[_0x69f5('0x10')]();}}else{_0x4e71dc[_0x69f5('0x16')]();}}catch(_0x2f9b96){logger[_0x69f5('0xd')](_0x69f5('0x1a'),_0x8aba82,_0x2f9b96[_0x69f5('0x1b')]);_0x4e71dc[_0x69f5('0x10')]();}}}catch(_0x4b7762){logger['error'](_0x69f5('0xe'),_0x8aba82,JSON[_0x69f5('0x1c')](_0x4b7762));_0x4e71dc['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 56b3680..d348853 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 _0x63b9=['routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','map','message','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','stop','validate','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x63b9,0x16e));var _0x963b=function(_0x58ac0e,_0x1821fe){_0x58ac0e=_0x58ac0e-0x0;var _0x4f5862=_0x63b9[_0x58ac0e];return _0x4f5862;};'use strict';var schema=require(_0x963b('0x0'));var _=require(_0x963b('0x1'));var logger=require('../../../../config/logger')(_0x963b('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x963b('0x3')}});exports['consequence']=function(_0x15e9f2,_0x43be6e){return function(_0x1059d2){try{var _0x343eeb={'priority':_0x43be6e[0x0]};var _0x18bd3c=gotop[_0x963b('0x0')](_0x343eeb,{'typecast':!![]});if(_0x18bd3c[_0x963b('0x4')]){logger['error']('[%s][GOTOP]\x20%s',_0x15e9f2,_[_0x963b('0x5')](_0x18bd3c,_0x963b('0x6'))['join'](',\x20'));_0x1059d2['stop']();}else{logger[_0x963b('0x7')](_0x963b('0x8'),_0x15e9f2,_0x343eeb[_0x963b('0x9')]);if(_0x343eeb['priority']){var _0x5319a1=_[_0x963b('0xa')](_0x1059d2[_0x963b('0xb')](),{'p':_0x343eeb[_0x963b('0x9')]});if(_0x5319a1>=0x0){logger[_0x963b('0x7')](_0x963b('0xc'),_0x15e9f2,_0x343eeb['priority']||_0x963b('0xd'),_0x5319a1);_0x1059d2[_0x963b('0xd')](_0x5319a1);}else{logger[_0x963b('0x7')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x15e9f2,_0x343eeb[_0x963b('0x9')]||_0x963b('0xd'));_0x1059d2['stop']();}}else{_0x1059d2[_0x963b('0xd')]();}}}catch(_0x3681fc){logger['error'](_0x963b('0xe'),_0x15e9f2,JSON['stringify'](_0x3681fc));_0x1059d2[_0x963b('0xf')]();}};}; \ No newline at end of file +var _0x4041=['findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','error','stringify','validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','map','stop','info','priority'];(function(_0x19ad3f,_0x347c34){var _0x3e2946=function(_0x9aad42){while(--_0x9aad42){_0x19ad3f['push'](_0x19ad3f['shift']());}};_0x3e2946(++_0x347c34);}(_0x4041,0x126));var _0x1404=function(_0x5b2410,_0x28fa4f){_0x5b2410=_0x5b2410-0x0;var _0x4d43fc=_0x4041[_0x5b2410];return _0x4d43fc;};'use strict';var schema=require(_0x1404('0x0'));var _=require(_0x1404('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0x1404('0x2'),'required':!![],'message':_0x1404('0x3')}});exports[_0x1404('0x4')]=function(_0xee1047,_0x2eac71){return function(_0x243fb7){try{var _0x4d92f3={'priority':_0x2eac71[0x0]};var _0x276a89=gotop[_0x1404('0x0')](_0x4d92f3,{'typecast':!![]});if(_0x276a89['length']){logger['error'](_0x1404('0x5'),_0xee1047,_[_0x1404('0x6')](_0x276a89,'message')['join'](',\x20'));_0x243fb7[_0x1404('0x7')]();}else{logger[_0x1404('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0xee1047,_0x4d92f3[_0x1404('0x9')]);if(_0x4d92f3['priority']){var _0x35f8b9=_[_0x1404('0xa')](_0x243fb7[_0x1404('0xb')](),{'p':_0x4d92f3[_0x1404('0x9')]});if(_0x35f8b9>=0x0){logger[_0x1404('0x8')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xee1047,_0x4d92f3[_0x1404('0x9')]||'next',_0x35f8b9);_0x243fb7['next'](_0x35f8b9);}else{logger[_0x1404('0x8')](_0x1404('0xc'),_0xee1047,_0x4d92f3[_0x1404('0x9')]||_0x1404('0xd'));_0x243fb7[_0x1404('0x7')]();}}else{_0x243fb7[_0x1404('0xd')]();}}}catch(_0x48d27f){logger[_0x1404('0xe')](_0x1404('0x5'),_0xee1047,JSON[_0x1404('0xf')](_0x48d27f));_0x243fb7[_0x1404('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index e63cc28..e9babbb 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 _0x9d26=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9d26,0x17d));var _0x69d2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9d26[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x69d2('0x0'));var utils=require('./utils');var logger=require(_0x69d2('0x1'))(_0x69d2('0x2'));var rpc={'chatMessage':require(_0x69d2('0x3')),'openchannelMessage':require(_0x69d2('0x4')),'mailMessage':require(_0x69d2('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x69d2('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x69d2('0x7')]=function(_0x42612f,_0x433136){return function(_0x4f55b0){try{var _0xc9b811={'body':utils[_0x69d2('0x8')](_0x433136[0x0],this),'ContactId':this[_0x69d2('0x9')]['id']};if(this[_0x69d2('0xa')]===_0x69d2('0xb')){_0xc9b811[_0x69d2('0xc')]=this[_0x69d2('0xd')]['id'];}else{_0xc9b811[_[_0x69d2('0xe')](this[_0x69d2('0xa')])+_0x69d2('0xf')]=this['account']['id'];}_0xc9b811[_[_0x69d2('0xe')](this[_0x69d2('0xa')])+_0x69d2('0x10')]=this[_0x69d2('0x11')]['id'];if(rpc[this[_0x69d2('0xa')]+_0x69d2('0x12')]){return rpc[this['channel']+_0x69d2('0x12')][_0x69d2('0x13')](_0xc9b811)[_0x69d2('0x14')](function(_0x21379a){logger[_0x69d2('0x15')](_0x69d2('0x16'),_0x42612f,_0xc9b811[_0x69d2('0x17')]);_0x4f55b0[_0x69d2('0x18')]();})['catch'](function(_0x3a4a66){logger[_0x69d2('0x19')]('[%s][MESSAGE]\x20%s',_0x42612f,JSON[_0x69d2('0x1a')](_0x3a4a66));_0x4f55b0[_0x69d2('0x1b')]();});}}catch(_0x1b169f){logger['error']('[%s][MESSAGE]\x20%s',_0x42612f,JSON['stringify'](_0x1b169f));_0x4f55b0[_0x69d2('0x1b')]();}};}; \ No newline at end of file +var _0x2128=['[%s][MESSAGE]\x20%s','body','next','catch','stop','error','stringify','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','then'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x2128,0x1c9));var _0x8212=function(_0x8c2e66,_0xf79589){_0x8c2e66=_0x8c2e66-0x0;var _0x31492f=_0x2128[_0x8c2e66];return _0x31492f;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x8212('0x0'));var rpc={'chatMessage':require(_0x8212('0x1')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8212('0x2')),'smsMessage':require(_0x8212('0x3')),'faxMessage':require(_0x8212('0x4')),'whatsappMessage':require(_0x8212('0x5'))};exports['consequence']=function(_0x1eb10b,_0x1a52d4){return function(_0x4fa944){try{var _0x19f876={'body':utils[_0x8212('0x6')](_0x1a52d4[0x0],this),'ContactId':this[_0x8212('0x7')]['id']};if(this[_0x8212('0x8')]===_0x8212('0x9')){_0x19f876[_0x8212('0xa')]=this[_0x8212('0xb')]['id'];}else{_0x19f876[_[_0x8212('0xc')](this[_0x8212('0x8')])+_0x8212('0xd')]=this[_0x8212('0xb')]['id'];}_0x19f876[_[_0x8212('0xc')](this['channel'])+_0x8212('0xe')]=this[_0x8212('0xf')]['id'];if(rpc[this[_0x8212('0x8')]+_0x8212('0x10')]){return rpc[this[_0x8212('0x8')]+_0x8212('0x10')]['create'](_0x19f876)[_0x8212('0x11')](function(_0x28a9b0){logger['info'](_0x8212('0x12'),_0x1eb10b,_0x19f876[_0x8212('0x13')]);_0x4fa944[_0x8212('0x14')]();})[_0x8212('0x15')](function(_0x5275ce){logger['error'](_0x8212('0x12'),_0x1eb10b,JSON['stringify'](_0x5275ce));_0x4fa944[_0x8212('0x16')]();});}}catch(_0x3dcf41){logger[_0x8212('0x17')](_0x8212('0x12'),_0x1eb10b,JSON[_0x8212('0x18')](_0x3dcf41));_0x4fa944['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 2f7c75e..1a4ec0c 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 _0xf0d8=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','routing'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0xf0d8,0x13f));var _0x8f0d=function(_0x1a6503,_0x406b1c){_0x1a6503=_0x1a6503-0x0;var _0x598102=_0xf0d8[_0x1a6503];return _0x598102;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x8f0d('0x0'));exports[_0x8f0d('0x1')]=function(_0x1fe955,_0x239404){return function(_0xde5520){try{logger[_0x8f0d('0x2')](_0x8f0d('0x3'),_0x1fe955,utils[_0x8f0d('0x4')](_0x239404[0x0],this));_0xde5520['next']();}catch(_0xd65a17){logger['error'](_0x8f0d('0x3'),_0x1fe955,JSON['stringify'](_0xd65a17));_0xde5520['stop']();}};}; \ No newline at end of file +var _0xfc66=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xfc66,0x1a2));var _0x6fc6=function(_0x286ec3,_0x13b30d){_0x286ec3=_0x286ec3-0x0;var _0x325a83=_0xfc66[_0x286ec3];return _0x325a83;};'use strict';var utils=require(_0x6fc6('0x0'));var logger=require(_0x6fc6('0x1'))(_0x6fc6('0x2'));exports[_0x6fc6('0x3')]=function(_0x375b15,_0x5ebe8f){return function(_0x34c786){try{logger[_0x6fc6('0x4')](_0x6fc6('0x5'),_0x375b15,utils[_0x6fc6('0x6')](_0x5ebe8f[0x0],this));_0x34c786[_0x6fc6('0x7')]();}catch(_0x5f18d3){logger[_0x6fc6('0x8')](_0x6fc6('0x5'),_0x375b15,JSON[_0x6fc6('0x9')](_0x5f18d3));_0x34c786[_0x6fc6('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 6c3c7d5..ecdfbb0 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 _0xd447=['lodash','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','interaction','MessageId','message','channel','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','rrmemory','log','stack','validate'];(function(_0x21a8dd,_0x5e5842){var _0x1571c8=function(_0x44ed97){while(--_0x44ed97){_0x21a8dd['push'](_0x21a8dd['shift']());}};_0x1571c8(++_0x5e5842);}(_0xd447,0x1e9));var _0x7d44=function(_0x222da3,_0x32c991){_0x222da3=_0x222da3-0x0;var _0xa79b04=_0xd447[_0x222da3];return _0xa79b04;};'use strict';var schema=require(_0x7d44('0x0'));var _=require(_0x7d44('0x1'));var util=require(_0x7d44('0x2'));var seqqueue=require(_0x7d44('0x3'));var moment=require(_0x7d44('0x4'));var Redis=require(_0x7d44('0x5'));var config=require(_0x7d44('0x6'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7d44('0x7'));config[_0x7d44('0x8')]=_['defaults'](config[_0x7d44('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x7d44('0x9'))(new Redis(config[_0x7d44('0x8')]));var attributes=['id',_0x7d44('0xa'),_0x7d44('0xb'),_0x7d44('0xc'),_0x7d44('0xd'),_0x7d44('0xe')];function emit(_0x4043eb,_0x295924,_0x46e736){io['to'](_0x4043eb)[_0x7d44('0xf')](_0x295924,_0x46e736);}function emitChannelQueueInteraction(_0x420947,_0x1c0f3c,_0x498c50,_0x1a58a3,_0x1965e7,_0x6efb5,_0x3265ad,_0x5ce0a4){var _0x453ae0=_['clone'](_0x498c50);_0x453ae0[_0x7d44('0xa')]=_0x5ce0a4;_0x453ae0[_0x7d44('0xc')]=_0x1c0f3c;_0x453ae0['account']=_0x1a58a3;_0x453ae0['id']=_0x1965e7;if(_0x6efb5){_0x3265ad[util[_0x7d44('0x10')]('%sQueuesWaitingInteractions',_0x420947)][_0x1965e7]=_[_0x7d44('0x11')](_0x453ae0,attributes);}else{delete _0x3265ad[util[_0x7d44('0x10')](_0x7d44('0x12'),_0x420947)][_0x1965e7];}emit(util[_0x7d44('0x10')](_0x7d44('0x13'),_0x420947,_0x1c0f3c),util[_0x7d44('0x10')](_0x7d44('0x14'),_0x420947,_0x6efb5?'save':'remove'),_[_0x7d44('0x11')](_0x453ae0,attributes));}var rpc={'openchannelQueueReport':require(_0x7d44('0x15')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7d44('0x16')),'whatsappQueueReport':require(_0x7d44('0x17'))};var queue=schema({'name':{'type':_0x7d44('0x18'),'required':!![],'message':_0x7d44('0x19')},'timeout':{'type':_0x7d44('0x1a'),'message':_0x7d44('0x1b')}});function startRouting(_0x5a582a,_0x35160b,_0x15e03b,_0x3c678f){if(_0x5a582a&&_0x35160b&&_0x15e03b){_0x35160b[_0x7d44('0x1c')]+=0x1;var _0x1b7e17={'uniqueid':_0x5a582a,'from':_0x15e03b['body']?_0x15e03b[_0x7d44('0x1d')]['from']:'','joinAt':moment()[_0x7d44('0x10')](_0x7d44('0x1e')),'ContactId':_0x15e03b['contact']?_0x15e03b[_0x7d44('0x1f')]['id']:null,'ListId':_0x15e03b['list']?_0x15e03b[_0x7d44('0x20')]['id']:null};_0x1b7e17[_[_0x7d44('0x21')](_0x15e03b['channel'])+_0x7d44('0x22')]=_0x35160b['id']||null;_0x1b7e17[_['upperFirst'](_0x15e03b['channel'])+'InteractionId']=_0x15e03b['interaction']?_0x15e03b[_0x7d44('0x23')]['id']:null;_0x1b7e17[_[_0x7d44('0x21')](_0x15e03b['channel'])+_0x7d44('0x24')]=_0x15e03b[_0x7d44('0x25')]?_0x15e03b[_0x7d44('0x25')]['id']:null;_0x1b7e17[_[_0x7d44('0x21')](_0x15e03b[_0x7d44('0x26')])+(_0x15e03b[_0x7d44('0x26')]!=='chat'?_0x7d44('0x27'):_0x7d44('0x28'))]=_0x15e03b['account']?_0x15e03b[_0x7d44('0xb')]['id']:null;logger[_0x7d44('0x29')](util[_0x7d44('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x5a582a,_0x35160b[_0x7d44('0x2a')]));emitChannelQueueInteraction(_0x15e03b[_0x7d44('0x26')],_0x35160b[_0x7d44('0x2a')],_0x1b7e17,_0x15e03b[_0x7d44('0xb')]['name'],_0x15e03b[_0x7d44('0x25')]['id'],!![],_0x3c678f,_0x35160b['id']);if(rpc[_0x15e03b[_0x7d44('0x26')]+_0x7d44('0x2b')]){return rpc[_0x15e03b[_0x7d44('0x26')]+_0x7d44('0x2b')][_0x7d44('0x2c')](_0x1b7e17)[_0x7d44('0x2d')](function(_0x32e960){logger[_0x7d44('0x2e')](_0x7d44('0x2f'));});}}}function stopRouting(_0x21b796,_0x4a1c9d,_0x5695b8,_0x59f86b){if(_0x21b796&&_0x4a1c9d){_0x4a1c9d[_0x7d44('0x1c')]-=0x1;var _0x5dacf5={'leaveAt':moment()[_0x7d44('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x7d44('0x10')](_0x7d44('0x1e')),'reason':_0x7d44('0x30')};logger[_0x7d44('0x29')](util[_0x7d44('0x10')]('[%s][STOP:QUEUE][NAME:%s]',_0x21b796,_0x4a1c9d[_0x7d44('0x2a')]));emitChannelQueueInteraction(_0x5695b8['channel'],_0x4a1c9d[_0x7d44('0x2a')],_0x5695b8[_0x7d44('0x1d')],_0x5695b8[_0x7d44('0xb')][_0x7d44('0x2a')],_0x5695b8['message']['id'],![],_0x59f86b,_0x4a1c9d['id']);if(rpc[_0x5695b8[_0x7d44('0x26')]+_0x7d44('0x2b')]){return rpc[_0x5695b8['channel']+_0x7d44('0x2b')][_0x7d44('0x31')](_0x21b796,_0x5dacf5)[_0x7d44('0x2d')](function(_0xe010fb){logger[_0x7d44('0x2e')]('update\x20queue\x20report');});}}}function endRouting(_0x2bd843,_0x554328,_0x4ea76e,_0x1742a1){if(_0x2bd843&&_0x554328){_0x554328['waiting']-=0x1;var _0x5ebb25={'leaveAt':moment()[_0x7d44('0x10')](_0x7d44('0x1e')),'exitAt':moment()[_0x7d44('0x10')](_0x7d44('0x1e')),'reason':_0x7d44('0x32')};logger[_0x7d44('0x29')](util['format'](_0x7d44('0x33'),_0x2bd843,_0x554328[_0x7d44('0x2a')]));emitChannelQueueInteraction(_0x4ea76e['channel'],_0x554328[_0x7d44('0x2a')],_0x4ea76e[_0x7d44('0x1d')],_0x4ea76e[_0x7d44('0xb')][_0x7d44('0x2a')],_0x4ea76e[_0x7d44('0x25')]['id'],![],_0x1742a1);if(rpc[_0x4ea76e[_0x7d44('0x26')]+_0x7d44('0x2b')]){return rpc[_0x4ea76e[_0x7d44('0x26')]+_0x7d44('0x2b')][_0x7d44('0x31')](_0x2bd843,_0x5ebb25)[_0x7d44('0x2d')](function(_0x5932b4){logger['error'](_0x7d44('0x34'));});}}}function handleFindQueue(_0x255f26){return function(_0x1f6323){return _0x1f6323[_0x7d44('0x2a')][_0x7d44('0x35')]()===_0x255f26[_0x7d44('0x35')]();};}exports['consequence']=function(_0x4daebc,_0xc02ddb,_0x5a0158,_0x1a673c){return function(_0x24843c){try{var _0x1b43b3={'name':_0xc02ddb[0x0],'timeout':_0xc02ddb[0x1]};var _0x27410d=queue[_0x7d44('0x0')](_0x1b43b3,{'typecast':!![]});if(_0x27410d['length']){logger[_0x7d44('0x2e')](_0x7d44('0x36'),_0x4daebc,_[_0x7d44('0x37')](_0x27410d,'message')[_0x7d44('0x38')](',\x20'));_0x24843c['stop']();}else{var _0x371ed4=_[_0x7d44('0x39')](_0x5a0158[_0x1a673c[_0x7d44('0x26')]+_0x7d44('0x3a')],handleFindQueue(_0x1b43b3['name']));if(_0x371ed4){startRouting(_0x4daebc,_0x371ed4,_0x1a673c,_0x5a0158);var _0x16f443=(_0x371ed4[_0x7d44('0x32')]||0xa)*0x3e8;var _0x6f3c22=(_0x1b43b3[_0x7d44('0x32')]||0x14)*0x3e8;var _0x1301bd,_0x581f43;if(_0x16f443>_0x6f3c22){_0x6f3c22=_0x16f443;}var _0x324f08=seqqueue[_0x7d44('0x3b')](_0x16f443);_0x324f08['id']=_0x4daebc;_0x324f08[_0x7d44('0x3c')]=_0x16f443;_0x324f08[_0x7d44('0x3d')]=_0x6f3c22;_0x324f08[_0x7d44('0x26')]=_0x1a673c[_0x7d44('0x26')];_0x5a0158[_0x7d44('0x3e')][_0x4daebc]['on']('end',function(){logger[_0x7d44('0x29')](_0x7d44('0x3f'),_0x4daebc);stopRouting(_0x4daebc,_0x371ed4,_0x1a673c,_0x5a0158);clearTimeout(_0x1301bd);_0x1301bd=undefined;_0x324f08[_0x7d44('0x40')](!![]);if(_0x5a0158[_0x7d44('0x3e')][_0x4daebc]){delete _0x5a0158[_0x7d44('0x3e')][_0x4daebc];}_0x24843c[_0x7d44('0x41')]();});_0x5a0158['rules'][_0x4daebc]['on'](_0x7d44('0x42'),function(){if(_0x5a0158[_0x7d44('0x3e')][_0x4daebc]){delete _0x5a0158[_0x7d44('0x3e')][_0x4daebc];}});_0x1301bd=setTimeout(function(){logger[_0x7d44('0x29')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4daebc);endRouting(_0x4daebc,_0x371ed4,_0x1a673c,_0x5a0158);clearTimeout(_0x1301bd);_0x324f08[_0x7d44('0x40')](!![]);_0x24843c['next']();},_0x6f3c22);switch(_0x371ed4['strategy']){case _0x7d44('0x43'):strategy[_0x7d44('0x43')](_0x324f08,_0x371ed4,_0x5a0158,_0x1a673c);break;default:strategy['beepall'](_0x324f08,_0x371ed4,_0x5a0158,_0x1a673c);}}else{logger[_0x7d44('0x2e')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4daebc,_0x1b43b3[_0x7d44('0x2a')]);_0x24843c[_0x7d44('0x41')]();}}}catch(_0x380da9){console[_0x7d44('0x44')](_0x380da9);logger[_0x7d44('0x2e')](_0x7d44('0x36'),_0x4daebc,_0x380da9[_0x7d44('0x45')]);_0x24843c['stop']();}};}; \ No newline at end of file +var _0xaf90=['localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','map','join','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0xaf90,0x1e3));var _0x0af9=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xaf90[_0x4243a3];return _0x1b2a33;};'use strict';var schema=require(_0x0af9('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x0af9('0x1'));var moment=require(_0x0af9('0x2'));var Redis=require(_0x0af9('0x3'));var config=require(_0x0af9('0x4'));var logger=require('../../../../config/logger')(_0x0af9('0x5'));var strategy=require(_0x0af9('0x6'));config[_0x0af9('0x7')]=_[_0x0af9('0x8')](config['redis'],{'host':_0x0af9('0x9'),'port':0x18eb});var io=require(_0x0af9('0xa'))(new Redis(config['redis']));var attributes=['id',_0x0af9('0xb'),_0x0af9('0xc'),_0x0af9('0xd'),_0x0af9('0xe'),_0x0af9('0xf')];function emit(_0x4f8db1,_0x2d186d,_0x4bbb2b){io['to'](_0x4f8db1)[_0x0af9('0x10')](_0x2d186d,_0x4bbb2b);}function emitChannelQueueInteraction(_0x267fc2,_0x3acba9,_0x19ee3e,_0x4eb2e1,_0x25599b,_0x49ed60,_0xf195e5,_0x1152d1){var _0x46ba18=_[_0x0af9('0x11')](_0x19ee3e);_0x46ba18['queue_id']=_0x1152d1;_0x46ba18[_0x0af9('0xd')]=_0x3acba9;_0x46ba18[_0x0af9('0xc')]=_0x4eb2e1;_0x46ba18['id']=_0x25599b;if(_0x49ed60){_0xf195e5[util[_0x0af9('0x12')](_0x0af9('0x13'),_0x267fc2)][_0x25599b]=_[_0x0af9('0x14')](_0x46ba18,attributes);}else{delete _0xf195e5[util[_0x0af9('0x12')](_0x0af9('0x13'),_0x267fc2)][_0x25599b];}emit(util[_0x0af9('0x12')](_0x0af9('0x15'),_0x267fc2,_0x3acba9),util['format'](_0x0af9('0x16'),_0x267fc2,_0x49ed60?'save':_0x0af9('0x17')),_['pick'](_0x46ba18,attributes));}var rpc={'openchannelQueueReport':require(_0x0af9('0x18')),'mailQueueReport':require(_0x0af9('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x0af9('0x1a')),'faxQueueReport':require(_0x0af9('0x1b')),'whatsappQueueReport':require(_0x0af9('0x1c'))};var queue=schema({'name':{'type':_0x0af9('0x1d'),'required':!![],'message':_0x0af9('0x1e')},'timeout':{'type':_0x0af9('0x1f'),'message':_0x0af9('0x20')}});function startRouting(_0x3577f4,_0x5c2cca,_0x256349,_0xf79ad){if(_0x3577f4&&_0x5c2cca&&_0x256349){_0x5c2cca[_0x0af9('0x21')]+=0x1;var _0x2dd0ce={'uniqueid':_0x3577f4,'from':_0x256349['body']?_0x256349[_0x0af9('0x22')]['from']:'','joinAt':moment()[_0x0af9('0x12')](_0x0af9('0x23')),'ContactId':_0x256349[_0x0af9('0x24')]?_0x256349[_0x0af9('0x24')]['id']:null,'ListId':_0x256349['list']?_0x256349[_0x0af9('0x25')]['id']:null};_0x2dd0ce[_[_0x0af9('0x26')](_0x256349[_0x0af9('0x27')])+_0x0af9('0x28')]=_0x5c2cca['id']||null;_0x2dd0ce[_[_0x0af9('0x26')](_0x256349[_0x0af9('0x27')])+_0x0af9('0x29')]=_0x256349[_0x0af9('0x2a')]?_0x256349[_0x0af9('0x2a')]['id']:null;_0x2dd0ce[_[_0x0af9('0x26')](_0x256349[_0x0af9('0x27')])+'MessageId']=_0x256349[_0x0af9('0x2b')]?_0x256349[_0x0af9('0x2b')]['id']:null;_0x2dd0ce[_[_0x0af9('0x26')](_0x256349[_0x0af9('0x27')])+(_0x256349[_0x0af9('0x27')]!==_0x0af9('0x2c')?_0x0af9('0x2d'):_0x0af9('0x2e'))]=_0x256349[_0x0af9('0xc')]?_0x256349[_0x0af9('0xc')]['id']:null;logger[_0x0af9('0x2f')](util[_0x0af9('0x12')](_0x0af9('0x30'),_0x3577f4,_0x5c2cca[_0x0af9('0x31')]));emitChannelQueueInteraction(_0x256349[_0x0af9('0x27')],_0x5c2cca['name'],_0x2dd0ce,_0x256349[_0x0af9('0xc')][_0x0af9('0x31')],_0x256349[_0x0af9('0x2b')]['id'],!![],_0xf79ad,_0x5c2cca['id']);if(rpc[_0x256349[_0x0af9('0x27')]+_0x0af9('0x32')]){return rpc[_0x256349[_0x0af9('0x27')]+_0x0af9('0x32')]['create'](_0x2dd0ce)[_0x0af9('0x33')](function(_0x340d06){logger[_0x0af9('0x34')](_0x0af9('0x35'));});}}}function stopRouting(_0x282c2f,_0x2c67be,_0x491e4f,_0x5c4f7d){if(_0x282c2f&&_0x2c67be){_0x2c67be['waiting']-=0x1;var _0x57318d={'leaveAt':moment()[_0x0af9('0x12')](_0x0af9('0x23')),'acceptAt':moment()[_0x0af9('0x12')](_0x0af9('0x23')),'reason':_0x0af9('0x36')};logger[_0x0af9('0x2f')](util[_0x0af9('0x12')](_0x0af9('0x37'),_0x282c2f,_0x2c67be[_0x0af9('0x31')]));emitChannelQueueInteraction(_0x491e4f[_0x0af9('0x27')],_0x2c67be[_0x0af9('0x31')],_0x491e4f['body'],_0x491e4f[_0x0af9('0xc')]['name'],_0x491e4f[_0x0af9('0x2b')]['id'],![],_0x5c4f7d,_0x2c67be['id']);if(rpc[_0x491e4f[_0x0af9('0x27')]+'QueueReport']){return rpc[_0x491e4f['channel']+_0x0af9('0x32')][_0x0af9('0x38')](_0x282c2f,_0x57318d)[_0x0af9('0x33')](function(_0x41201c){logger[_0x0af9('0x34')](_0x0af9('0x39'));});}}}function endRouting(_0x3609ee,_0x3b3e67,_0x299f8c,_0x5067b0){if(_0x3609ee&&_0x3b3e67){_0x3b3e67[_0x0af9('0x21')]-=0x1;var _0x366552={'leaveAt':moment()[_0x0af9('0x12')](_0x0af9('0x23')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0x0af9('0x12')](_0x0af9('0x3a'),_0x3609ee,_0x3b3e67['name']));emitChannelQueueInteraction(_0x299f8c[_0x0af9('0x27')],_0x3b3e67[_0x0af9('0x31')],_0x299f8c['body'],_0x299f8c[_0x0af9('0xc')][_0x0af9('0x31')],_0x299f8c[_0x0af9('0x2b')]['id'],![],_0x5067b0);if(rpc[_0x299f8c[_0x0af9('0x27')]+_0x0af9('0x32')]){return rpc[_0x299f8c[_0x0af9('0x27')]+_0x0af9('0x32')][_0x0af9('0x38')](_0x3609ee,_0x366552)['catch'](function(_0x23dfc4){logger[_0x0af9('0x34')](_0x0af9('0x39'));});}}}function handleFindQueue(_0x3d4a0d){return function(_0x3cdb8d){return _0x3cdb8d[_0x0af9('0x31')]['toLowerCase']()===_0x3d4a0d[_0x0af9('0x3b')]();};}exports['consequence']=function(_0x3b78d3,_0x2c9f68,_0x1f6a15,_0x52dbdf){return function(_0x48e34e){try{var _0x105a48={'name':_0x2c9f68[0x0],'timeout':_0x2c9f68[0x1]};var _0x405211=queue['validate'](_0x105a48,{'typecast':!![]});if(_0x405211[_0x0af9('0x3c')]){logger[_0x0af9('0x34')]('[%s][QUEUE]\x20%s',_0x3b78d3,_[_0x0af9('0x3d')](_0x405211,_0x0af9('0x2b'))[_0x0af9('0x3e')](',\x20'));_0x48e34e[_0x0af9('0x3f')]();}else{var _0x154dca=_[_0x0af9('0x40')](_0x1f6a15[_0x52dbdf['channel']+_0x0af9('0x41')],handleFindQueue(_0x105a48[_0x0af9('0x31')]));if(_0x154dca){startRouting(_0x3b78d3,_0x154dca,_0x52dbdf,_0x1f6a15);var _0x486ef9=(_0x154dca[_0x0af9('0x42')]||0xa)*0x3e8;var _0x1d9712=(_0x105a48[_0x0af9('0x42')]||0x14)*0x3e8;var _0x3396d6,_0x204ce4;if(_0x486ef9>_0x1d9712){_0x1d9712=_0x486ef9;}var _0x1ef090=seqqueue[_0x0af9('0x43')](_0x486ef9);_0x1ef090['id']=_0x3b78d3;_0x1ef090[_0x0af9('0x44')]=_0x486ef9;_0x1ef090[_0x0af9('0x45')]=_0x1d9712;_0x1ef090['channel']=_0x52dbdf[_0x0af9('0x27')];_0x1f6a15[_0x0af9('0x46')][_0x3b78d3]['on'](_0x0af9('0x47'),function(){logger[_0x0af9('0x2f')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x3b78d3);stopRouting(_0x3b78d3,_0x154dca,_0x52dbdf,_0x1f6a15);clearTimeout(_0x3396d6);_0x3396d6=undefined;_0x1ef090[_0x0af9('0x48')](!![]);if(_0x1f6a15[_0x0af9('0x46')][_0x3b78d3]){delete _0x1f6a15['rules'][_0x3b78d3];}_0x48e34e['stop']();});_0x1f6a15[_0x0af9('0x46')][_0x3b78d3]['on'](_0x0af9('0x49'),function(){if(_0x1f6a15[_0x0af9('0x46')][_0x3b78d3]){delete _0x1f6a15['rules'][_0x3b78d3];}});_0x3396d6=setTimeout(function(){logger[_0x0af9('0x2f')](_0x0af9('0x4a'),_0x3b78d3);endRouting(_0x3b78d3,_0x154dca,_0x52dbdf,_0x1f6a15);clearTimeout(_0x3396d6);_0x1ef090[_0x0af9('0x48')](!![]);_0x48e34e[_0x0af9('0x4b')]();},_0x1d9712);switch(_0x154dca[_0x0af9('0x4c')]){case _0x0af9('0x4d'):strategy[_0x0af9('0x4d')](_0x1ef090,_0x154dca,_0x1f6a15,_0x52dbdf);break;default:strategy[_0x0af9('0x4e')](_0x1ef090,_0x154dca,_0x1f6a15,_0x52dbdf);}}else{logger[_0x0af9('0x34')](_0x0af9('0x4f'),_0x3b78d3,_0x105a48[_0x0af9('0x31')]);_0x48e34e[_0x0af9('0x3f')]();}}}catch(_0x3257d4){console[_0x0af9('0x50')](_0x3257d4);logger[_0x0af9('0x34')]('[%s][QUEUE]\x20%s',_0x3b78d3,_0x3257d4[_0x0af9('0x51')]);_0x48e34e[_0x0af9('0x3f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 3c69846..9ed5a56 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 _0x5481=['handleTimeout','timeout','drained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind'];(function(_0x40867e,_0x3e6d66){var _0x47bf56=function(_0x27d1ed){while(--_0x27d1ed){_0x40867e['push'](_0x40867e['shift']());}};_0x47bf56(++_0x3e6d66);}(_0x5481,0x1a3));var _0x1548=function(_0xd26938,_0x166c39){_0xd26938=_0xd26938-0x0;var _0x547bf0=_0x5481[_0xd26938];return _0x547bf0;};'use strict';var _=require(_0x1548('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x1548('0x1'))(_0x1548('0x2'));var Agent=function(_0x2c431e,_0x4ab471,_0x556a50,_0x3fcfaf){this[_0x1548('0x3')]=uuid['v4']();this[_0x1548('0x4')]=_0x2c431e;this[_0x1548('0x5')]=_0x4ab471;this[_0x1548('0x6')]=_0x556a50;this[_0x1548('0x2')]=_0x3fcfaf;this[_0x1548('0x4')][_0x1548('0x7')](this[_0x1548('0x8')][_0x1548('0x9')](this),this[_0x1548('0xa')][_0x1548('0x9')](this));this[_0x1548('0x4')]['on'](_0x1548('0xb'),this['handleTimeout'][_0x1548('0x9')](this));this['squeue']['on'](_0x1548('0xc'),this['handleDrained'][_0x1548('0x9')](this));};Agent[_0x1548('0xd')]['push']=function(){this['squeue'][_0x1548('0x7')](this['handleRun'][_0x1548('0x9')](this),this['handleTimeout'][_0x1548('0x9')](this));};Agent[_0x1548('0xd')]['handleDrained']=function(){this[_0x1548('0xa')](!![]);};Agent[_0x1548('0xd')][_0x1548('0x8')]=function(_0x304354){logger[_0x1548('0xe')](_0x1548('0xf'),this[_0x1548('0x4')]['id'],this[_0x1548('0x5')]['id']);if(_['isNil'](this['realtime'][_0x1548('0x10')][this[_0x1548('0x5')]['id']])){logger[_0x1548('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x1548('0x4')]['id'],this[_0x1548('0x5')]['id']);setTimeout(this[_0x1548('0x7')][_0x1548('0x9')](this),0x3e8);}else{if(this[_0x1548('0x2')][_0x1548('0x11')]||util[_0x1548('0x12')](this[_0x1548('0x4')]['id'],this['realtime'][_0x1548('0x10')][this[_0x1548('0x5')]['id']],this[_0x1548('0x4')][_0x1548('0x13')],![])){this[_0x1548('0x6')][_0x1548('0x10')][this[_0x1548('0x5')]['id']][_0x1548('0x14')]=!![];this[_0x1548('0x6')][_0x1548('0x10')][this['agent']['id']][_0x1548('0x15')]=undefined;util[_0x1548('0x16')](this[_0x1548('0x3')],this[_0x1548('0x4')]['id'],this[_0x1548('0x6')]['agents'][this[_0x1548('0x5')]['id']],null,this['routing']);util[_0x1548('0x17')](this[_0x1548('0x4')]['id'],this[_0x1548('0x6')][_0x1548('0x10')][this['agent']['id']],_0x1548('0x18')+(this[_0x1548('0x2')]['forcedOwnership']?_0x1548('0x19'):''));}else{logger[_0x1548('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x1548('0x5')]['id']);setTimeout(this[_0x1548('0x7')][_0x1548('0x9')](this),0x3e8);}}};Agent['prototype'][_0x1548('0xa')]=function(_0x367940){if(_[_0x1548('0x1a')](this[_0x1548('0x6')][_0x1548('0x10')][this['agent']['id']])){return logger[_0x1548('0xe')](_0x1548('0x1b'),this[_0x1548('0x4')]['id'],this['agent']['id']);}else{logger['info'](_0x1548('0x1c'),this['squeue']['id'],this['agent']['id']);util[_0x1548('0x1d')](this[_0x1548('0x3')],this[_0x1548('0x4')]['id'],this[_0x1548('0x6')]['agents'][this[_0x1548('0x5')]['id']],null,this[_0x1548('0x2')]);this[_0x1548('0x6')][_0x1548('0x10')][this[_0x1548('0x5')]['id']][_0x1548('0x14')]=![];this['realtime'][_0x1548('0x10')][this[_0x1548('0x5')]['id']]['busyQueue']=undefined;util[_0x1548('0x17')](this['squeue']['id'],this[_0x1548('0x6')][_0x1548('0x10')][this['agent']['id']],_0x367940?_0x1548('0x1e'):_0x1548('0x1f'));}if(!_0x367940){setTimeout(this[_0x1548('0x7')]['bind'](this),0x3e8);}};function agent(_0x446532,_0x2dc0bb,_0x57de7c,_0x34473d){return new Agent(_0x446532,_0x2dc0bb,_0x57de7c,_0x34473d);}module[_0x1548('0x20')]=agent; \ No newline at end of file +var _0xacfb=['writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','busy','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','info','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacfb,0xca));var _0xbacf=function(_0x1104f1,_0x2a4be1){_0x1104f1=_0x1104f1-0x0;var _0x3ea157=_0xacfb[_0x1104f1];return _0x3ea157;};'use strict';var _=require('lodash');var uuid=require(_0xbacf('0x0'));var util=require(_0xbacf('0x1'));var logger=require(_0xbacf('0x2'))('routing');var Agent=function(_0x15656f,_0x3a084a,_0x3f1aa4,_0x47af67){this['notificationId']=uuid['v4']();this[_0xbacf('0x3')]=_0x15656f;this[_0xbacf('0x4')]=_0x3a084a;this[_0xbacf('0x5')]=_0x3f1aa4;this[_0xbacf('0x6')]=_0x47af67;this['squeue'][_0xbacf('0x7')](this[_0xbacf('0x8')][_0xbacf('0x9')](this),this[_0xbacf('0xa')][_0xbacf('0x9')](this));this['squeue']['on'](_0xbacf('0xb'),this[_0xbacf('0xa')][_0xbacf('0x9')](this));this['squeue']['on']('drained',this[_0xbacf('0xc')][_0xbacf('0x9')](this));};Agent[_0xbacf('0xd')][_0xbacf('0x7')]=function(){this[_0xbacf('0x3')]['push'](this[_0xbacf('0x8')][_0xbacf('0x9')](this),this[_0xbacf('0xa')]['bind'](this));};Agent[_0xbacf('0xd')][_0xbacf('0xc')]=function(){this[_0xbacf('0xa')](!![]);};Agent[_0xbacf('0xd')][_0xbacf('0x8')]=function(_0x1941c9){logger[_0xbacf('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xbacf('0x3')]['id'],this[_0xbacf('0x4')]['id']);if(_['isNil'](this[_0xbacf('0x5')][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']])){logger[_0xbacf('0xe')](_0xbacf('0x10'),this[_0xbacf('0x3')]['id'],this[_0xbacf('0x4')]['id']);setTimeout(this[_0xbacf('0x7')][_0xbacf('0x9')](this),0x3e8);}else{if(this['routing'][_0xbacf('0x11')]||util[_0xbacf('0x12')](this[_0xbacf('0x3')]['id'],this[_0xbacf('0x5')][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']],this[_0xbacf('0x3')][_0xbacf('0x13')],![])){this['realtime'][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']]['busy']=!![];this['realtime'][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']][_0xbacf('0x14')]=undefined;util[_0xbacf('0x15')](this['notificationId'],this['squeue']['id'],this[_0xbacf('0x5')][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']],null,this[_0xbacf('0x6')]);util[_0xbacf('0x16')](this[_0xbacf('0x3')]['id'],this[_0xbacf('0x5')][_0xbacf('0xf')][this['agent']['id']],_0xbacf('0x17')+(this[_0xbacf('0x6')][_0xbacf('0x11')]?_0xbacf('0x18'):''));}else{logger[_0xbacf('0xe')](_0xbacf('0x19'),this[_0xbacf('0x3')]['id'],this[_0xbacf('0x4')]['id']);setTimeout(this[_0xbacf('0x7')][_0xbacf('0x9')](this),0x3e8);}}};Agent[_0xbacf('0xd')]['handleTimeout']=function(_0xee626f){if(_['isNil'](this[_0xbacf('0x5')][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']])){return logger[_0xbacf('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbacf('0x3')]['id'],this['agent']['id']);}else{logger[_0xbacf('0xe')](_0xbacf('0x1a'),this['squeue']['id'],this[_0xbacf('0x4')]['id']);util[_0xbacf('0x1b')](this[_0xbacf('0x1c')],this['squeue']['id'],this[_0xbacf('0x5')]['agents'][this[_0xbacf('0x4')]['id']],null,this[_0xbacf('0x6')]);this['realtime'][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']][_0xbacf('0x1d')]=![];this[_0xbacf('0x5')][_0xbacf('0xf')][this[_0xbacf('0x4')]['id']][_0xbacf('0x14')]=undefined;util[_0xbacf('0x16')](this[_0xbacf('0x3')]['id'],this[_0xbacf('0x5')][_0xbacf('0xf')][this['agent']['id']],_0xee626f?_0xbacf('0x1e'):_0xbacf('0x1f'));}if(!_0xee626f){setTimeout(this[_0xbacf('0x7')][_0xbacf('0x9')](this),0x3e8);}};function agent(_0x1017b0,_0x4c50aa,_0xcc0101,_0x240e76){return new Agent(_0x1017b0,_0x4c50aa,_0xcc0101,_0x240e76);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 804be67..14d3858 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 _0xb76d=['TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','showNotification','info'];(function(_0x4be8d2,_0x37f267){var _0x6fa479=function(_0x5bf1d8){while(--_0x5bf1d8){_0x4be8d2['push'](_0x4be8d2['shift']());}};_0x6fa479(++_0x37f267);}(_0xb76d,0x119));var _0xdb76=function(_0x19ef81,_0x54e235){_0x19ef81=_0x19ef81-0x0;var _0x86ed81=_0xb76d[_0x19ef81];return _0x86ed81;};'use strict';var _=require(_0xdb76('0x0'));var uuid=require('uuid');var util=require(_0xdb76('0x1'));var logger=require(_0xdb76('0x2'))(_0xdb76('0x3'));var Beepall=function(_0x5376b1,_0x2dca57,_0x1053d0,_0x281c24){this[_0xdb76('0x4')]=uuid['v4']();this[_0xdb76('0x5')]=_0x5376b1;this[_0xdb76('0x6')]=_0x2dca57;this['realtime']=_0x1053d0;this[_0xdb76('0x3')]=_0x281c24;this[_0xdb76('0x5')][_0xdb76('0x7')](this[_0xdb76('0x8')]['bind'](this),this[_0xdb76('0x9')][_0xdb76('0xa')](this));this['squeue']['on'](_0xdb76('0xb'),this[_0xdb76('0x9')][_0xdb76('0xa')](this));this[_0xdb76('0x5')]['on'](_0xdb76('0xc'),this[_0xdb76('0xd')][_0xdb76('0xa')](this));};Beepall['prototype']['push']=function(){this[_0xdb76('0x5')][_0xdb76('0x7')](this[_0xdb76('0x8')]['bind'](this),this['handleTimeout'][_0xdb76('0xa')](this));};Beepall['prototype'][_0xdb76('0xd')]=function(_0x51ebc2){this['handleTimeout'](!![]);};Beepall[_0xdb76('0xe')][_0xdb76('0x8')]=function(_0x1196fb){var _0x8d2de2=!![];if(!_['isNil'](this[_0xdb76('0x6')])&&!_[_0xdb76('0xf')](this['queue'][_0xdb76('0x10')])&&this[_0xdb76('0x6')][_0xdb76('0x10')][_0xdb76('0x11')]>0x0){for(var _0x388fb0=0x0,_0x1e3c5e;_0x388fb00x0){for(var _0x363323=0x0,_0x1d6030;_0x3633230x0&&_0x441d79[_0x4fc66d+'CurrentCapacity']>=_0x441d79[_0x4fc66d+'Capacity']){writeLog(_0x5cf7ec,_0x441d79,_0x4fc66d[_0x44fb('0x26')]()+_0x44fb('0x27'));return![];}}return!![];};exports[_0x44fb('0x28')]=function(_0x1f5d4c,_0xb7e5e8,_0x15e748,_0x2ce72d,_0x35652e){return sendNotification(!![],_0x1f5d4c,_0xb7e5e8,_0x15e748,_0x2ce72d,_0x35652e);};exports[_0x44fb('0x29')]=function(_0x4f079d,_0x48eb7d,_0x587984,_0x51b40e,_0x4a957f){return sendNotification(![],_0x4f079d,_0x48eb7d,_0x587984,_0x51b40e,_0x4a957f);};exports[_0x44fb('0x2a')]=writeLog; \ No newline at end of file +var _0x27a0=['writeLog','util','../utils','mustache','ioredis','../../../../../config/environment','redis','localhost','socket.io-emitter','emit','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','getMustacheRender','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','message','notification:%s','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification'];(function(_0x29f8c6,_0x2e4cdf){var _0x3172cd=function(_0x1e5fde){while(--_0x1e5fde){_0x29f8c6['push'](_0x29f8c6['shift']());}};_0x3172cd(++_0x2e4cdf);}(_0x27a0,0xbf));var _0x027a=function(_0x3851ee,_0x345bf7){_0x3851ee=_0x3851ee-0x0;var _0xbba0ba=_0x27a0[_0x3851ee];return _0xbba0ba;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var utils=require(_0x027a('0x1'));var Mustache=require(_0x027a('0x2'));var Redis=require(_0x027a('0x3'));var config=require(_0x027a('0x4'));var logger=require('../../../../../config/logger')('routing');config['redis']=_['defaults'](config[_0x027a('0x5')],{'host':_0x027a('0x6'),'port':0x18eb});var io=require(_0x027a('0x7'))(new Redis(config[_0x027a('0x5')]));function emit(_0xe233ed,_0x3c7d67,_0x550fbb){io['to'](_0xe233ed)[_0x027a('0x8')](_0x3c7d67,_0x550fbb);}function sendNotification(_0x271dfe,_0x277f49,_0x4ccee2,_0x44c56a,_0x42ccac,_0x2d13a2){io['to'](util['format'](_0x027a('0x9'),_0x44c56a[_0x027a('0xa')]))[_0x027a('0x8')](_0x027a('0xb'),_0x44c56a);var _0x172eb4=_0x2d13a2||{};var _0x267afc=_0x4ccee2[_0x027a('0xc')]('.');var _0x874d2d={'uniqueid':_0x277f49,'channel':_0x267afc[0x0],'id':_0x267afc[0x1],'title':_0x267afc[0x0]+_0x027a('0xd'),'interactionId':_0x267afc[0x2],'queue':_0x42ccac?_0x42ccac[_0x027a('0xa')]:null,'sound':_0x172eb4[_0x027a('0xe')]['notificationSound'],'shake':_0x172eb4[_0x027a('0xe')][_0x027a('0xf')]};try{if(!_0x172eb4[_0x027a('0x10')]){_0x172eb4[_0x027a('0x10')]={};}if(_0x42ccac){_0x172eb4[_0x027a('0x10')]['queue']=_0x42ccac;}else if(_0x172eb4['body'][_0x027a('0x11')]){delete _0x172eb4['body'][_0x027a('0x11')];}_0x874d2d['msg']=utils[_0x027a('0x12')](_0x172eb4['account']['notificationTemplate'],_0x172eb4);}catch(_0x47ceb7){_0x874d2d[_0x027a('0x13')]=_0x027a('0x14');logger[_0x027a('0x15')](util[_0x027a('0x16')]('[%s][QUEUE]\x20%s',_0x277f49,_0x47ceb7[_0x027a('0x17')]));}io['to'](util[_0x027a('0x16')]('user:%s',_0x44c56a['name']))[_0x027a('0x8')](util['format'](_0x027a('0x18'),_0x271dfe?'save':'remove'),_0x874d2d);}function writeLog(_0x58b129,_0x4b4f90,_0x18efe7){return logger[_0x027a('0x19')](util[_0x027a('0x16')](_0x027a('0x1a'),_0x58b129,_0x4b4f90['name'],_0x18efe7));}exports[_0x027a('0x1b')]=function(_0x119a5c,_0x20e2da,_0x3dee99,_0x178ed8){if(_0x20e2da[_0x027a('0x1c')]){writeLog(_0x119a5c,_0x20e2da,'BUSY');return![];}if(!_0x20e2da[_0x027a('0x1d')]){writeLog(_0x119a5c,_0x20e2da,'OFFLINE');return![];}if(_0x20e2da[_0x3dee99+_0x027a('0x1e')]){writeLog(_0x119a5c,_0x20e2da,_0x027a('0x1f'));return![];}if(_0x178ed8&&_0x20e2da[_0x027a('0x20')](_0x3dee99+_0x027a('0x21'))&&_0x20e2da['hasOwnProperty'](_0x3dee99+'CurrentCapacity')){if(_0x20e2da[_0x3dee99+_0x027a('0x21')]>0x0&&_0x20e2da[_0x3dee99+_0x027a('0x22')]>=_0x20e2da[_0x3dee99+_0x027a('0x21')]){writeLog(_0x119a5c,_0x20e2da,_0x3dee99[_0x027a('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x027a('0x24')]=function(_0x55a8cd,_0x953887,_0x488920,_0x2be389,_0x4d5a25){return sendNotification(!![],_0x55a8cd,_0x953887,_0x488920,_0x2be389,_0x4d5a25);};exports['hideNotification']=function(_0x31385d,_0x5782ac,_0x47a365,_0x448ba0,_0x52ca99){return sendNotification(![],_0x31385d,_0x5782ac,_0x47a365,_0x448ba0,_0x52ca99);};exports[_0x027a('0x25')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 102f16f..ca5ad87 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 _0x450f=['stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x450f,0x15d));var _0xf450=function(_0x292a97,_0x49fb87){_0x292a97=_0x292a97-0x0;var _0x36aa25=_0x450f[_0x292a97];return _0x36aa25;};'use strict';var schema=require(_0xf450('0x0'));var sh=require(_0xf450('0x1'));var _=require(_0xf450('0x2'));var utils=require(_0xf450('0x3'));var logger=require(_0xf450('0x4'))(_0xf450('0x5'));var system=schema({'command':{'type':_0xf450('0x6'),'required':!![],'message':_0xf450('0x7')}});exports[_0xf450('0x8')]=function(_0x276924,_0x42d54c){return function(_0x4c092a){try{var _0x109fca={'command':_0x42d54c[0x0]};var _0x112f61=system[_0xf450('0x0')](_0x109fca,{'typecast':!![]});if(_0x112f61[_0xf450('0x9')]){logger[_0xf450('0xa')](_0xf450('0xb'),_0x276924,_[_0xf450('0xc')](_0x112f61,_0xf450('0xd'))[_0xf450('0xe')](',\x20'));logger['info'](_0xf450('0xf'),_0x276924);_0x4c092a[_0xf450('0x10')]();}else{var _0x3cba0e=this;var _0xa025c7=utils['getMustacheRender'](_0x42d54c[0x0],this);logger[_0xf450('0x11')](_0xf450('0x12'),_0x276924,_0xa025c7);sh[_0xf450('0x13')](_[_0xf450('0x14')](_0xa025c7),function(_0x1b3228,_0x83866f){logger[_0xf450('0x11')](_0xf450('0x15'),_0x276924,_0x1b3228);if(_0x1b3228==0x0){var _0x10b48c=_0x83866f[_0xf450('0x16')](/(\r\n|\n|\r)/gm,'');if(_[_0xf450('0x17')](_0x42d54c[0x1])||_[_0xf450('0x18')](_0x42d54c[0x1])){logger['info'](_0xf450('0x19'),_0x276924);_0x3cba0e[_0xf450('0x1a')][_0x42d54c[0x1]]=_0x10b48c;}else{logger[_0xf450('0x11')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x276924,_0x42d54c[0x1],_0x10b48c);_0x3cba0e[_0xf450('0x1a')][_0x42d54c[0x1]]=_0x10b48c;}}_0x4c092a[_0xf450('0x10')]();});}}catch(_0x38502d){logger['error']('[%s][SYSTEM]\x20%s',_0x276924,_[_0xf450('0x1b')](_0x38502d)?JSON[_0xf450('0x1c')](_0x38502d):_0x38502d);logger[_0xf450('0x11')](_0xf450('0xf'),_0x276924);_0x4c092a[_0xf450('0x10')]();}};}; \ No newline at end of file +var _0x3d46=['replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','validate','lodash','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x41ce3c,_0x5690a9){var _0x493b99=function(_0x48be02){while(--_0x48be02){_0x41ce3c['push'](_0x41ce3c['shift']());}};_0x493b99(++_0x5690a9);}(_0x3d46,0x1cf));var _0x63d4=function(_0x4515d1,_0x587c9f){_0x4515d1=_0x4515d1-0x0;var _0x1adc79=_0x3d46[_0x4515d1];return _0x1adc79;};'use strict';var schema=require(_0x63d4('0x0'));var sh=require('shelljs');var _=require(_0x63d4('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x63d4('0x2'));var system=schema({'command':{'type':'string','required':!![],'message':_0x63d4('0x3')}});exports[_0x63d4('0x4')]=function(_0x2bc618,_0x3fb852){return function(_0x512963){try{var _0x194b1b={'command':_0x3fb852[0x0]};var _0x2a83f9=system[_0x63d4('0x0')](_0x194b1b,{'typecast':!![]});if(_0x2a83f9[_0x63d4('0x5')]){logger[_0x63d4('0x6')](_0x63d4('0x7'),_0x2bc618,_[_0x63d4('0x8')](_0x2a83f9,_0x63d4('0x9'))[_0x63d4('0xa')](',\x20'));logger[_0x63d4('0xb')](_0x63d4('0xc'),_0x2bc618);_0x512963['next']();}else{var _0x26663c=this;var _0x40f1c1=utils['getMustacheRender'](_0x3fb852[0x0],this);logger['info'](_0x63d4('0xd'),_0x2bc618,_0x40f1c1);sh[_0x63d4('0xe')](_[_0x63d4('0xf')](_0x40f1c1),function(_0x11472c,_0x503155){logger[_0x63d4('0xb')](_0x63d4('0x10'),_0x2bc618,_0x11472c);if(_0x11472c==0x0){var _0x315d29=_0x503155[_0x63d4('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3fb852[0x1])||_[_0x63d4('0x12')](_0x3fb852[0x1])){logger[_0x63d4('0xb')](_0x63d4('0x13'),_0x2bc618);_0x26663c[_0x63d4('0x14')][_0x3fb852[0x1]]=_0x315d29;}else{logger['info'](_0x63d4('0x15'),_0x2bc618,_0x3fb852[0x1],_0x315d29);_0x26663c[_0x63d4('0x14')][_0x3fb852[0x1]]=_0x315d29;}}_0x512963[_0x63d4('0x16')]();});}}catch(_0xb701f8){logger[_0x63d4('0x6')]('[%s][SYSTEM]\x20%s',_0x2bc618,_[_0x63d4('0x17')](_0xb701f8)?JSON['stringify'](_0xb701f8):_0xb701f8);logger[_0x63d4('0xb')](_0x63d4('0xc'),_0x2bc618);_0x512963[_0x63d4('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index fb3cf52..3678e4f 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 _0xcc2e=['next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0xcc2e,0x1c5));var _0xecc2=function(_0x40c0d2,_0x470bb0){_0x40c0d2=_0x40c0d2-0x0;var _0x458107=_0xcc2e[_0x40c0d2];return _0x458107;};'use strict';var schema=require(_0xecc2('0x0'));var _=require(_0xecc2('0x1'));var rpc={'chatInteraction':require(_0xecc2('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xecc2('0x3')),'mailInteraction':require(_0xecc2('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xecc2('0x5'))};var logger=require(_0xecc2('0x6'))(_0xecc2('0x7'));var tag=schema({'tag':{'type':_0xecc2('0x8'),'required':!![],'message':_0xecc2('0x9')}});exports['consequence']=function(_0x316115,_0x1222f8,_0x25c937,_0xe70eb3){return function(_0xa14043){try{var _0x5cc032={'tag':_0x1222f8[0x0]};var _0x573582=tag['validate'](_0x5cc032,{'typecast':!![]});if(_0x573582['length']){logger[_0xecc2('0xa')]('[%s][TAG]\x20%s',_0x316115,_[_0xecc2('0xb')](_0x573582,'message')[_0xecc2('0xc')](',\x20'));logger[_0xecc2('0xd')](_0xecc2('0xe'),_0x316115);_0xa14043[_0xecc2('0xf')]();}else{var _0xf92034={'ids':[_0x1222f8[0x0]]};if(rpc[_0xe70eb3[_0xecc2('0x10')]+_0xecc2('0x11')]){rpc[_0xe70eb3[_0xecc2('0x10')]+'Interaction'][_0xecc2('0x12')](_0xe70eb3['interaction']['id'],_0xf92034)[_0xecc2('0x13')](function(_0x1fb225){logger[_0xecc2('0xd')](_0xecc2('0x14'),_0x316115,_0x1222f8[0x1],_0xe70eb3[_0xecc2('0x10')],_0xe70eb3[_0xecc2('0x15')]['id']);})[_0xecc2('0x16')](function(_0x205a0a){logger[_0xecc2('0xa')](_0xecc2('0x17'),_0x316115,JSON[_0xecc2('0x18')](_0x205a0a));logger[_0xecc2('0xd')](_0xecc2('0xe'),_0x316115);})[_0xecc2('0x19')](function(){_0xa14043['next']();});}}}catch(_0x341d75){logger[_0xecc2('0xa')]('[%s][TAG]\x20%s',_0x316115,_['isObject'](_0x341d75)?JSON[_0xecc2('0x18')](_0x341d75):_0x341d75);logger[_0xecc2('0xd')](_0xecc2('0xe'),_0x316115);_0xa14043[_0xecc2('0xf')]();}};}; \ No newline at end of file +var _0xd153=['Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xd153,0x1d3));var _0x3d15=function(_0x37123c,_0x3d26d8){_0x37123c=_0x37123c-0x0;var _0x22df3b=_0xd153[_0x37123c];return _0x22df3b;};'use strict';var schema=require('validate');var _=require(_0x3d15('0x0'));var rpc={'chatInteraction':require(_0x3d15('0x1')),'openchannelInteraction':require(_0x3d15('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x3d15('0x3')),'whatsappInteraction':require(_0x3d15('0x4'))};var logger=require(_0x3d15('0x5'))('routing');var tag=schema({'tag':{'type':_0x3d15('0x6'),'required':!![],'message':_0x3d15('0x7')}});exports[_0x3d15('0x8')]=function(_0x242e4f,_0x28ff91,_0x4f5d17,_0x56b9bb){return function(_0x3b9734){try{var _0x3fe309={'tag':_0x28ff91[0x0]};var _0x419071=tag[_0x3d15('0x9')](_0x3fe309,{'typecast':!![]});if(_0x419071['length']){logger[_0x3d15('0xa')](_0x3d15('0xb'),_0x242e4f,_[_0x3d15('0xc')](_0x419071,_0x3d15('0xd'))[_0x3d15('0xe')](',\x20'));logger[_0x3d15('0xf')](_0x3d15('0x10'),_0x242e4f);_0x3b9734[_0x3d15('0x11')]();}else{var _0x1d317a={'ids':[_0x28ff91[0x0]]};if(rpc[_0x56b9bb[_0x3d15('0x12')]+_0x3d15('0x13')]){rpc[_0x56b9bb['channel']+_0x3d15('0x13')][_0x3d15('0x14')](_0x56b9bb[_0x3d15('0x15')]['id'],_0x1d317a)[_0x3d15('0x16')](function(_0x5ea56f){logger['info'](_0x3d15('0x17'),_0x242e4f,_0x28ff91[0x1],_0x56b9bb[_0x3d15('0x12')],_0x56b9bb[_0x3d15('0x15')]['id']);})[_0x3d15('0x18')](function(_0x144b90){logger[_0x3d15('0xa')]('[%s][TAG]\x20%s',_0x242e4f,JSON[_0x3d15('0x19')](_0x144b90));logger[_0x3d15('0xf')](_0x3d15('0x10'),_0x242e4f);})[_0x3d15('0x1a')](function(){_0x3b9734['next']();});}}}catch(_0x25f48a){logger[_0x3d15('0xa')](_0x3d15('0xb'),_0x242e4f,_['isObject'](_0x25f48a)?JSON[_0x3d15('0x19')](_0x25f48a):_0x25f48a);logger[_0x3d15('0xf')](_0x3d15('0x10'),_0x242e4f);_0x3b9734[_0x3d15('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 75963c2..bd95537 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x156d81,_0x26abc7){var _0x45a86e=function(_0x553408){while(--_0x553408){_0x156d81['push'](_0x156d81['shift']());}};_0x45a86e(++_0x26abc7);}(_0xe706,0xa3));var _0x6e70=function(_0x49365d,_0x227a7c){_0x49365d=_0x49365d-0x0;var _0x508eaa=_0xe706[_0x49365d];return _0x508eaa;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x41dc08,_0x48dd15){var _0x4391c5=function(_0x65b33f){while(--_0x65b33f){_0x41dc08['push'](_0x41dc08['shift']());}};_0x4391c5(++_0x48dd15);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8d5f0d8..1d2caaf 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 _0xf020=['message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','existsSync','join','app','.js','autoreply','appdata','push','slice','length','dialogflow','dialogflowv2','split','amazonlex','tag','TagId','./interval','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId'];(function(_0x528a56,_0x223ce7){var _0x3107e4=function(_0x5c423d){while(--_0x5c423d){_0x528a56['push'](_0x528a56['shift']());}};_0x3107e4(++_0x223ce7);}(_0xf020,0x194));var _0x0f02=function(_0x15ce51,_0x4f50c1){_0x15ce51=_0x15ce51-0x0;var _0x343c75=_0xf020[_0x15ce51];return _0x343c75;};'use strict';var _=require(_0x0f02('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x0f02('0x1'));var BPromise=require(_0x0f02('0x2'));var uuid=require('uuid');var config=require(_0x0f02('0x3'));var logger=require('../../../config/logger')(_0x0f02('0x4'));var rpc={'openchannelQueueReport':require(_0x0f02('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x0f02('0x6')),'smsQueueReport':require(_0x0f02('0x7')),'faxQueueReport':require(_0x0f02('0x8')),'whatsappQueueReport':require(_0x0f02('0x9'))};var RuleEngine=require(_0x0f02('0xa'));function getId(_0xc72646,_0x13f5cb,_0x1c715a){return util[_0x0f02('0xb')]('%s.%s.%s',_0xc72646,_0x13f5cb||0x0,_0x1c715a||0x0);}function getIntervals(_0x23761,_0x362274){var _0x176228=[];if(!_['isNil'](_0x362274[_0x0f02('0xc')])&&!_[_0x0f02('0xd')](_0x23761[_0x362274[_0x0f02('0xc')]])&&!_[_0x0f02('0xd')](_0x23761[_0x362274[_0x0f02('0xc')]][_0x0f02('0xe')])){_0x176228=_[_0x0f02('0xf')](_0x23761[_0x362274[_0x0f02('0xc')]][_0x0f02('0xe')],_0x0f02('0x10'));}else if(!_[_0x0f02('0xd')](_0x362274[_0x0f02('0x10')])){_0x176228=[_0x362274['interval']];}return _0x176228;}exports[_0x0f02('0x11')]=function(_0x1dda86){_0x1dda86[_0x0f02('0x12')]={};return new BPromise(function(_0x3fb54d,_0x545b5b){var _0x34cf30={'Start':function(_0x37f684){var _0x3036d8=this;return new Promise(function(_0x5a2ea7,_0x2e5900){if(_0x37f684){try{var _0x44a9f0=[];var _0x26d28b=getId(_0x37f684[_0x0f02('0x13')],_0x37f684[_0x0f02('0x14')]?_0x37f684[_0x0f02('0x14')]['id']:0x0,_0x37f684['interaction']?_0x37f684[_0x0f02('0x15')]['id']:0x0);if(_0x37f684['applications']&&_['isArray'](_0x37f684[_0x0f02('0x16')])&&_0x37f684['applications']['length']){for(var _0x18f0ce=0x0;_0x18f0ce<_0x37f684[_0x0f02('0x16')]['length'];_0x18f0ce+=0x1){var _0x2de6a3=_0x37f684['applications'][_0x18f0ce];if(fs[_0x0f02('0x17')](path[_0x0f02('0x18')](__dirname,'applications',_0x2de6a3[_0x0f02('0x19')]+_0x0f02('0x1a')))){var _0x2158b7=[];switch(_0x2de6a3[_0x0f02('0x19')]['toLowerCase']()){case _0x0f02('0x1b'):var _0x2ffe3e=_0x2de6a3[_0x0f02('0x1c')]['split'](',');if(_0x37f684[_0x0f02('0x13')]==='mail'){_0x2158b7[_0x0f02('0x1d')](_0x2ffe3e[0x0]);_0x2158b7[_0x0f02('0x1d')](_0x2ffe3e[0x1]);_0x2158b7[_0x0f02('0x1d')](_0x2ffe3e[_0x0f02('0x1e')](0x2,_0x2ffe3e[_0x0f02('0x1f')])[_0x0f02('0x18')](','));}else{_0x2158b7[_0x0f02('0x1d')](_0x2ffe3e[0x0]);_0x2158b7[_0x0f02('0x1d')](_0x2ffe3e[_0x0f02('0x1e')](0x1,_0x2ffe3e[_0x0f02('0x1f')])[_0x0f02('0x18')](','));}break;case _0x0f02('0x20'):var _0xe5cd65=_0x2de6a3[_0x0f02('0x1c')]['split'](',');_0x2158b7[_0x0f02('0x1d')](_0xe5cd65[0x0]);_0x2158b7[_0x0f02('0x1d')](_0xe5cd65[0x1]);_0x2158b7[_0x0f02('0x1d')](_0xe5cd65[_0x0f02('0x1e')](0x2,_0xe5cd65['length'])['join'](','));break;case _0x0f02('0x21'):var _0x20524c=_0x2de6a3['appdata'][_0x0f02('0x22')](',');_0x2158b7[_0x0f02('0x1d')](_0x20524c[0x0]);_0x2158b7[_0x0f02('0x1d')](_0x20524c[0x1]);_0x2158b7[_0x0f02('0x1d')](_0x20524c[0x2]);_0x2158b7[_0x0f02('0x1d')](_0x20524c[0x3]);_0x2158b7[_0x0f02('0x1d')](_0x20524c[_0x0f02('0x1e')](0x4,_0x20524c[_0x0f02('0x1f')])['join'](','));break;case _0x0f02('0x23'):var _0x5ac04e=_0x2de6a3['appdata'][_0x0f02('0x22')](',');_0x2158b7[_0x0f02('0x1d')](_0x5ac04e[0x0]);_0x2158b7[_0x0f02('0x1d')](_0x5ac04e[0x1]);_0x2158b7[_0x0f02('0x1d')](_0x5ac04e[0x2]);_0x2158b7[_0x0f02('0x1d')](_0x5ac04e[0x3]);_0x2158b7[_0x0f02('0x1d')](_0x5ac04e['slice'](0x4,_0x5ac04e['length'])[_0x0f02('0x18')](','));break;case _0x0f02('0x14'):_0x2158b7[_0x0f02('0x1d')](_0x2de6a3['appdata']);break;case _0x0f02('0x24'):_0x2158b7[_0x0f02('0x1d')](_0x2de6a3[_0x0f02('0x25')]);_0x2158b7['push'](_0x2de6a3[_0x0f02('0x1c')]);break;default:_0x2158b7=_['isNil'](_0x2de6a3['appdata'])?[]:_0x2de6a3[_0x0f02('0x1c')][_0x0f02('0x22')](',');}var _0x3a43fa={'id':util[_0x0f02('0xb')]('%s:%s:%s',_0x26d28b,_0x2de6a3['id'],_0x2de6a3['app']),'condition':require(_0x0f02('0x26'))['condition'](_0x26d28b,getIntervals(_0x1dda86['intervals'],_0x2de6a3),_0x1dda86),'consequence':require(_0x0f02('0x27')+_0x2de6a3['app'])[_0x0f02('0x28')](_0x26d28b,_0x2158b7,_0x1dda86,_0x37f684),'p':_0x2de6a3[_0x0f02('0x29')]||0x0};logger[_0x0f02('0x2a')](_0x0f02('0x2b'),_0x3a43fa['id'],_0x0f02('0x2c'),getIntervals(_0x1dda86[_0x0f02('0x2d')],_0x2de6a3)['join'](_0x0f02('0x2e')));_0x44a9f0[_0x0f02('0x1d')](_0x3a43fa);}else{logger[_0x0f02('0x2f')](_0x0f02('0x30'),path[_0x0f02('0x18')](__dirname,'applications',_0x2de6a3[_0x0f02('0x19')]+'.js'));}}_0x1dda86['rules'][_0x26d28b]=new RuleEngine(_0x44a9f0);_0x1dda86['rules'][_0x26d28b][_0x0f02('0x31')](_0x37f684,function(_0x5c6548){logger[_0x0f02('0x2a')](_0x0f02('0x32'),JSON[_0x0f02('0x33')](_0x5c6548[_0x0f02('0x34')]));if(_0x1dda86[_0x0f02('0x12')][_0x26d28b]){_0x1dda86[_0x0f02('0x12')][_0x26d28b][_0x0f02('0x35')](_0x0f02('0x36'));}});return _0x5a2ea7({'code':0xc8,'message':_0x37f684});}else{logger['info'](_0x0f02('0x37'));return _0x5a2ea7({'code':0xc8,'message':_0x37f684});}}catch(_0x24558f){logger['error'](_0x24558f[_0x0f02('0x38')]);return _0x2e5900(_0x3036d8[_0x0f02('0x2f')](0x1f4,_0x24558f));}}return _0x2e5900(_0x0f02('0x39'));});},'AcceptMessage':function(_0xd5dde8){var _0x414c93=this;return new Promise(function(_0xf15b8,_0x3a280d){if(_0xd5dde8[_0x0f02('0x3a')]&&_0xd5dde8['agent']['id']){if(_0x1dda86[_0x0f02('0x3b')][_0xd5dde8[_0x0f02('0x3a')]['id']]){_0x1dda86['agents'][_0xd5dde8[_0x0f02('0x3a')]['id']][_0x0f02('0x3c')]=![];_0x1dda86['agents'][_0xd5dde8[_0x0f02('0x3a')]['id']][_0x0f02('0x3d')]=undefined;}}if(_0xd5dde8[_0x0f02('0x14')]&&_0xd5dde8['message']['id']){try{var _0x4e6e85=getId(_0xd5dde8[_0x0f02('0x13')],_0xd5dde8[_0x0f02('0x14')]?_0xd5dde8[_0x0f02('0x14')]['id']:0x0,_0xd5dde8[_0x0f02('0x15')]?_0xd5dde8[_0x0f02('0x15')]['id']:0x0);if(_0x1dda86[_0x0f02('0x12')][_0x4e6e85]){_0x1dda86[_0x0f02('0x12')][_0x4e6e85][_0x0f02('0x35')](_0x0f02('0x3e'));if(rpc[_0xd5dde8[_0x0f02('0x13')]+_0x0f02('0x3f')]){rpc[_0xd5dde8['channel']+'QueueReport'][_0x0f02('0x40')](_0x4e6e85,{'UserId':_0xd5dde8[_0x0f02('0x14')][_0x0f02('0x41')]})['catch'](function(_0x1ae2f6){logger['error']('error\x20update\x20queue\x20report');});}}return _0xf15b8({'code':0xc8,'message':_0xd5dde8});}catch(_0x53d804){logger[_0x0f02('0x2f')](_0x53d804[_0x0f02('0x38')]);return _0x3a280d(_0x414c93['error'](0x1f4,_0x53d804));}}logger[_0x0f02('0x2f')]('message\x20is\x20empty');return _0x3a280d(_0x414c93[_0x0f02('0x2f')](0x1f4,_0x0f02('0x42')));});},'RejectMessage':function(_0x1a8718){var _0x2b94b9=this;return new Promise(function(_0x328c6d,_0x34b2fb){if(_0x1a8718[_0x0f02('0x3a')]&&_0x1a8718[_0x0f02('0x3a')]['id']){try{if(_0x1dda86[_0x0f02('0x3b')][_0x1a8718[_0x0f02('0x3a')]['id']]){_0x1dda86[_0x0f02('0x3b')][_0x1a8718['agent']['id']]['busy']=![];_0x1dda86['agents'][_0x1a8718[_0x0f02('0x3a')]['id']][_0x0f02('0x3d')]=undefined;}return _0x328c6d({'code':0xc8,'message':_0x1a8718});}catch(_0x2a67b3){logger[_0x0f02('0x2f')](_0x2a67b3[_0x0f02('0x38')]);return _0x34b2fb(_0x2b94b9[_0x0f02('0x2f')](0x1f4,_0x2a67b3));}}logger[_0x0f02('0x2f')]('message\x20is\x20empty');return _0x34b2fb(_0x2b94b9[_0x0f02('0x2f')](0x1f4,_0x0f02('0x42')));});},'AbandonInteraction':function(_0xe2d069){var _0x2ef144=this;return new Promise(function(_0x1a7146,_0x525079){if(_0xe2d069[_0x0f02('0x13')]&&_0xe2d069[_0x0f02('0x15')]&&_0xe2d069[_0x0f02('0x15')]['id']){try{var _0x45ec8b=getId(_0xe2d069[_0x0f02('0x13')],_0xe2d069[_0x0f02('0x14')]?_0xe2d069[_0x0f02('0x14')]['id']:0x0,_0xe2d069[_0x0f02('0x15')]?_0xe2d069[_0x0f02('0x15')]['id']:0x0);if(_0x1dda86[_0x0f02('0x12')][_0x45ec8b]){_0x1dda86[_0x0f02('0x12')][_0x45ec8b][_0x0f02('0x35')](_0x0f02('0x3e'));}return _0x1a7146({'code':0xc8,'message':_0xe2d069});}catch(_0x786d7b){logger['error'](_0x786d7b[_0x0f02('0x38')]);return _0x525079(_0x2ef144['error'](0x1f4,_0x786d7b));}}logger[_0x0f02('0x2f')](_0x0f02('0x42'));return _0x525079(_0x2ef144['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x50ff57){var _0x5475e8=this;return new Promise(function(_0x5a0eef,_0x53fe72){if(_0x1dda86[_0x0f02('0x3b')][_0x0f02('0x43')](_0x50ff57['id'])){for(var _0x360d76 in _0x50ff57[_0x0f02('0x44')]){if(_0x50ff57[_0x0f02('0x44')][_0x0f02('0x43')](_0x360d76)){if(_0x1dda86[_0x0f02('0x3b')][_0x50ff57['id']][_0x0f02('0x43')](_0x360d76+_0x0f02('0x45'))){_0x1dda86[_0x0f02('0x3b')][_0x50ff57['id']][_0x360d76+_0x0f02('0x45')]=parseInt(_0x50ff57['capacity'][_0x360d76],0xa);}}}_0x1dda86['agents'][_0x50ff57['id']][_0x0f02('0x46')]();return _0x5a0eef({'code':0xc8,'message':_0x1dda86[_0x0f02('0x3b')][_0x50ff57['id']]});}else{return _0x53fe72(_0x5475e8[_0x0f02('0x2f')](0x1f4,_0x0f02('0x47')));}});},'Agents':function(_0x394838){return new Promise(function(_0x294d51,_0xd6c4fd){var _0x46120e=_['values'](_0x1dda86[_0x0f02('0x3b')]);_0x294d51({'count':_0x46120e[_0x0f02('0x1f')],'rows':_0x46120e});});},'ChatQueues':function(_0x495434){return new Promise(function(_0x249583,_0xa38d61){var _0x28d11b=[];for(var _0x154bcc in _0x1dda86['chatQueues']){if(_0x1dda86[_0x0f02('0x48')][_0x0f02('0x43')](_0x154bcc)){var _0x45dc49=_0x1dda86[_0x0f02('0x48')][_0x154bcc];var _0x28c5df={'id':_0x45dc49['id'],'available':_0x45dc49['available'],'loggedIn':_0x45dc49[_0x0f02('0x49')],'name':_0x45dc49[_0x0f02('0x4a')],'paused':_0x45dc49[_0x0f02('0x4b')],'waiting':_0x45dc49[_0x0f02('0x4c')]};_0x28d11b['push'](_0x28c5df);}}_0x249583({'count':_0x28d11b[_0x0f02('0x1f')],'rows':_0x28d11b});});},'MailQueues':function(_0x3b1da1){return new Promise(function(_0x40ecb9,_0x508353){var _0x2429a0=[];for(var _0x2f0049 in _0x1dda86['mailQueues']){if(_0x1dda86[_0x0f02('0x4d')][_0x0f02('0x43')](_0x2f0049)){var _0x597b79=_0x1dda86[_0x0f02('0x4d')][_0x2f0049];var _0x3e128f={'id':_0x597b79['id'],'available':_0x597b79[_0x0f02('0x4e')],'loggedIn':_0x597b79[_0x0f02('0x49')],'name':_0x597b79[_0x0f02('0x4a')],'paused':_0x597b79['paused'],'waiting':_0x597b79[_0x0f02('0x4c')]};_0x2429a0[_0x0f02('0x1d')](_0x3e128f);}}_0x40ecb9({'count':_0x2429a0['length'],'rows':_0x2429a0});});},'OpenchannelQueues':function(_0x30f3a3){return new Promise(function(_0x31ba72,_0x2751b2){var _0x53f784=[];for(var _0x12e94 in _0x1dda86[_0x0f02('0x4f')]){if(_0x1dda86[_0x0f02('0x4f')][_0x0f02('0x43')](_0x12e94)){var _0x5c0910=_0x1dda86['openchannelQueues'][_0x12e94];var _0x5af967={'id':_0x5c0910['id'],'available':_0x5c0910[_0x0f02('0x4e')],'loggedIn':_0x5c0910[_0x0f02('0x49')],'name':_0x5c0910[_0x0f02('0x4a')],'paused':_0x5c0910['paused'],'waiting':_0x5c0910[_0x0f02('0x4c')]};_0x53f784[_0x0f02('0x1d')](_0x5af967);}}_0x31ba72({'count':_0x53f784[_0x0f02('0x1f')],'rows':_0x53f784});});},'SmsQueues':function(_0xf230a2){return new Promise(function(_0x4b759b,_0x13a33f){var _0x4975ec=[];for(var _0x12123e in _0x1dda86['smsQueues']){if(_0x1dda86[_0x0f02('0x50')]['hasOwnProperty'](_0x12123e)){var _0x252d66=_0x1dda86['smsQueues'][_0x12123e];var _0x1fb013={'id':_0x252d66['id'],'available':_0x252d66[_0x0f02('0x4e')],'loggedIn':_0x252d66[_0x0f02('0x49')],'name':_0x252d66[_0x0f02('0x4a')],'paused':_0x252d66[_0x0f02('0x4b')],'waiting':_0x252d66['waiting']};_0x4975ec[_0x0f02('0x1d')](_0x1fb013);}}_0x4b759b({'count':_0x4975ec['length'],'rows':_0x4975ec});});},'FaxQueues':function(_0x5d4df3){return new Promise(function(_0x21d7d0,_0x47a6f9){var _0xd4a93c=[];for(var _0x16cc15 in _0x1dda86[_0x0f02('0x51')]){if(_0x1dda86[_0x0f02('0x51')][_0x0f02('0x43')](_0x16cc15)){var _0x150d66=_0x1dda86[_0x0f02('0x51')][_0x16cc15];var _0x1c2adf={'id':_0x150d66['id'],'available':_0x150d66[_0x0f02('0x4e')],'loggedIn':_0x150d66['loggedIn'],'name':_0x150d66[_0x0f02('0x4a')],'paused':_0x150d66['paused'],'waiting':_0x150d66[_0x0f02('0x4c')]};_0xd4a93c['push'](_0x1c2adf);}}_0x21d7d0({'count':_0xd4a93c[_0x0f02('0x1f')],'rows':_0xd4a93c});});},'WhatsappQueues':function(_0x353e46){return new Promise(function(_0x50c5dc,_0x10c13b){var _0x4c846e=[];for(var _0x128a5c in _0x1dda86['whatsappQueues']){if(_0x1dda86[_0x0f02('0x52')]['hasOwnProperty'](_0x128a5c)){var _0x4ec7ef=_0x1dda86[_0x0f02('0x52')][_0x128a5c];var _0x2b5849={'id':_0x4ec7ef['id'],'available':_0x4ec7ef[_0x0f02('0x4e')],'loggedIn':_0x4ec7ef['loggedIn'],'name':_0x4ec7ef[_0x0f02('0x4a')],'paused':_0x4ec7ef[_0x0f02('0x4b')],'waiting':_0x4ec7ef[_0x0f02('0x4c')]};_0x4c846e[_0x0f02('0x1d')](_0x2b5849);}}_0x50c5dc({'count':_0x4c846e[_0x0f02('0x1f')],'rows':_0x4c846e});});},'ChatQueuesWaitingInteractions':function(_0x5636d8){return new Promise(function(_0x3e6fbb,_0x134ea4){var _0xc9f238=_[_0x0f02('0x53')](_0x1dda86[_0x0f02('0x54')]);_0x3e6fbb({'count':_0xc9f238['length'],'rows':_0xc9f238});});},'MailQueuesWaitingInteractions':function(_0x3bdd5c){return new Promise(function(_0x52760e,_0x582a33){var _0x44475f=_[_0x0f02('0x53')](_0x1dda86['mailQueuesWaitingInteractions']);_0x52760e({'count':_0x44475f[_0x0f02('0x1f')],'rows':_0x44475f});});},'OpenchannelQueuesWaitingInteractions':function(_0x16bed9){return new Promise(function(_0x38b5c8,_0x527631){var _0x1dfcc5=_[_0x0f02('0x53')](_0x1dda86[_0x0f02('0x55')]);_0x38b5c8({'count':_0x1dfcc5[_0x0f02('0x1f')],'rows':_0x1dfcc5});});},'SmsQueuesWaitingInteractions':function(_0x1dab11){return new Promise(function(_0x31c8fc,_0x18efc4){var _0x329c2b=_[_0x0f02('0x53')](_0x1dda86[_0x0f02('0x56')]);_0x31c8fc({'count':_0x329c2b[_0x0f02('0x1f')],'rows':_0x329c2b});});},'FaxQueuesWaitingInteractions':function(_0x1b402a){return new Promise(function(_0x57ecad,_0x15f679){var _0x2f2d8b=_[_0x0f02('0x53')](_0x1dda86[_0x0f02('0x57')]);_0x57ecad({'count':_0x2f2d8b[_0x0f02('0x1f')],'rows':_0x2f2d8b});});},'WhatsappQueuesWaitingInteractions':function(_0x2eccb9){return new Promise(function(_0xc07bbb,_0x56aa76){var _0x50fcf8=_['values'](_0x1dda86[_0x0f02('0x58')]);_0xc07bbb({'count':_0x50fcf8[_0x0f02('0x1f')],'rows':_0x50fcf8});});}};var _0x1186df=jayson['server'](_0x34cf30)[_0x0f02('0x59')]();_0x1186df['on'](_0x0f02('0x2f'),function(_0x57f6ac){logger[_0x0f02('0x2f')](JSON[_0x0f02('0x33')](_0x57f6ac));return _0x545b5b(_0x57f6ac);});_0x1186df[_0x0f02('0x11')](0x232c,_0x0f02('0x5a'),function(){console[_0x0f02('0x5b')](_0x0f02('0x5c'),0x232c);return _0x3fb54d(_0x0f02('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x4977=['format','%s.%s.%s','isNil','IntervalId','map','interval','listen','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','TagId','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','rules','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','mailQueues','name','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine'];(function(_0x543faa,_0x3cd1f9){var _0x375043=function(_0x9d51a9){while(--_0x9d51a9){_0x543faa['push'](_0x543faa['shift']());}};_0x375043(++_0x3cd1f9);}(_0x4977,0x1cd));var _0x7497=function(_0x43982f,_0x47be5f){_0x43982f=_0x43982f-0x0;var _0x3f6c47=_0x4977[_0x43982f];return _0x3f6c47;};'use strict';var _=require(_0x7497('0x0'));var util=require(_0x7497('0x1'));var path=require(_0x7497('0x2'));var fs=require('fs');var jayson=require(_0x7497('0x3'));var BPromise=require(_0x7497('0x4'));var uuid=require('uuid');var config=require(_0x7497('0x5'));var logger=require(_0x7497('0x6'))(_0x7497('0x7'));var rpc={'openchannelQueueReport':require(_0x7497('0x8')),'mailQueueReport':require(_0x7497('0x9')),'chatQueueReport':require(_0x7497('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x7497('0xb')),'whatsappQueueReport':require(_0x7497('0xc'))};var RuleEngine=require(_0x7497('0xd'));function getId(_0x15c322,_0x180bf8,_0x54da2d){return util[_0x7497('0xe')](_0x7497('0xf'),_0x15c322,_0x180bf8||0x0,_0x54da2d||0x0);}function getIntervals(_0x5b4f54,_0x28c035){var _0x264d9f=[];if(!_[_0x7497('0x10')](_0x28c035[_0x7497('0x11')])&&!_[_0x7497('0x10')](_0x5b4f54[_0x28c035[_0x7497('0x11')]])&&!_[_0x7497('0x10')](_0x5b4f54[_0x28c035[_0x7497('0x11')]]['Intervals'])){_0x264d9f=_[_0x7497('0x12')](_0x5b4f54[_0x28c035[_0x7497('0x11')]]['Intervals'],'interval');}else if(!_[_0x7497('0x10')](_0x28c035[_0x7497('0x13')])){_0x264d9f=[_0x28c035[_0x7497('0x13')]];}return _0x264d9f;}exports[_0x7497('0x14')]=function(_0x20faeb){_0x20faeb['rules']={};return new BPromise(function(_0x454656,_0x55521f){var _0x230d7c={'Start':function(_0x366ee3){var _0x1b240e=this;return new Promise(function(_0x44c562,_0x2f3dce){if(_0x366ee3){try{var _0x51b7d5=[];var _0x26842c=getId(_0x366ee3[_0x7497('0x15')],_0x366ee3[_0x7497('0x16')]?_0x366ee3[_0x7497('0x16')]['id']:0x0,_0x366ee3[_0x7497('0x17')]?_0x366ee3['interaction']['id']:0x0);if(_0x366ee3['applications']&&_[_0x7497('0x18')](_0x366ee3[_0x7497('0x19')])&&_0x366ee3[_0x7497('0x19')][_0x7497('0x1a')]){for(var _0x324ab3=0x0;_0x324ab3<_0x366ee3[_0x7497('0x19')]['length'];_0x324ab3+=0x1){var _0xbe6c82=_0x366ee3[_0x7497('0x19')][_0x324ab3];if(fs[_0x7497('0x1b')](path[_0x7497('0x1c')](__dirname,'applications',_0xbe6c82[_0x7497('0x1d')]+_0x7497('0x1e')))){var _0x1794c7=[];switch(_0xbe6c82[_0x7497('0x1d')][_0x7497('0x1f')]()){case _0x7497('0x20'):var _0x3c7ecb=_0xbe6c82[_0x7497('0x21')][_0x7497('0x22')](',');if(_0x366ee3['channel']===_0x7497('0x23')){_0x1794c7[_0x7497('0x24')](_0x3c7ecb[0x0]);_0x1794c7[_0x7497('0x24')](_0x3c7ecb[0x1]);_0x1794c7[_0x7497('0x24')](_0x3c7ecb[_0x7497('0x25')](0x2,_0x3c7ecb[_0x7497('0x1a')])[_0x7497('0x1c')](','));}else{_0x1794c7['push'](_0x3c7ecb[0x0]);_0x1794c7[_0x7497('0x24')](_0x3c7ecb[_0x7497('0x25')](0x1,_0x3c7ecb[_0x7497('0x1a')])[_0x7497('0x1c')](','));}break;case _0x7497('0x26'):var _0x4a99ac=_0xbe6c82['appdata'][_0x7497('0x22')](',');_0x1794c7[_0x7497('0x24')](_0x4a99ac[0x0]);_0x1794c7[_0x7497('0x24')](_0x4a99ac[0x1]);_0x1794c7[_0x7497('0x24')](_0x4a99ac[_0x7497('0x25')](0x2,_0x4a99ac[_0x7497('0x1a')])[_0x7497('0x1c')](','));break;case _0x7497('0x27'):var _0x4e4c05=_0xbe6c82[_0x7497('0x21')]['split'](',');_0x1794c7[_0x7497('0x24')](_0x4e4c05[0x0]);_0x1794c7[_0x7497('0x24')](_0x4e4c05[0x1]);_0x1794c7['push'](_0x4e4c05[0x2]);_0x1794c7['push'](_0x4e4c05[0x3]);_0x1794c7[_0x7497('0x24')](_0x4e4c05[_0x7497('0x25')](0x4,_0x4e4c05['length'])[_0x7497('0x1c')](','));break;case'amazonlex':var _0x3ba3d6=_0xbe6c82[_0x7497('0x21')][_0x7497('0x22')](',');_0x1794c7[_0x7497('0x24')](_0x3ba3d6[0x0]);_0x1794c7[_0x7497('0x24')](_0x3ba3d6[0x1]);_0x1794c7[_0x7497('0x24')](_0x3ba3d6[0x2]);_0x1794c7[_0x7497('0x24')](_0x3ba3d6[0x3]);_0x1794c7['push'](_0x3ba3d6[_0x7497('0x25')](0x4,_0x3ba3d6[_0x7497('0x1a')])[_0x7497('0x1c')](','));break;case'message':_0x1794c7[_0x7497('0x24')](_0xbe6c82[_0x7497('0x21')]);break;case'tag':_0x1794c7['push'](_0xbe6c82[_0x7497('0x28')]);_0x1794c7[_0x7497('0x24')](_0xbe6c82['appdata']);break;default:_0x1794c7=_[_0x7497('0x10')](_0xbe6c82['appdata'])?[]:_0xbe6c82['appdata'][_0x7497('0x22')](',');}var _0x1c15c9={'id':util[_0x7497('0xe')](_0x7497('0x29'),_0x26842c,_0xbe6c82['id'],_0xbe6c82['app']),'condition':require(_0x7497('0x2a'))['condition'](_0x26842c,getIntervals(_0x20faeb[_0x7497('0x2b')],_0xbe6c82),_0x20faeb),'consequence':require(_0x7497('0x2c')+_0xbe6c82[_0x7497('0x1d')])[_0x7497('0x2d')](_0x26842c,_0x1794c7,_0x20faeb,_0x366ee3),'p':_0xbe6c82[_0x7497('0x2e')]||0x0};logger[_0x7497('0x2f')](_0x7497('0x30'),_0x1c15c9['id'],_0x7497('0x31'),getIntervals(_0x20faeb[_0x7497('0x2b')],_0xbe6c82)[_0x7497('0x1c')](_0x7497('0x32')));_0x51b7d5[_0x7497('0x24')](_0x1c15c9);}else{logger[_0x7497('0x33')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x7497('0x1c')](__dirname,_0x7497('0x19'),_0xbe6c82[_0x7497('0x1d')]+_0x7497('0x1e')));}}_0x20faeb['rules'][_0x26842c]=new RuleEngine(_0x51b7d5);_0x20faeb['rules'][_0x26842c][_0x7497('0x34')](_0x366ee3,function(_0x5befd2){logger[_0x7497('0x2f')](_0x7497('0x35'),JSON[_0x7497('0x36')](_0x5befd2[_0x7497('0x37')]));if(_0x20faeb[_0x7497('0x38')][_0x26842c]){_0x20faeb[_0x7497('0x38')][_0x26842c]['emit'](_0x7497('0x39'));}});return _0x44c562({'code':0xc8,'message':_0x366ee3});}else{logger[_0x7497('0x2f')](_0x7497('0x3a'));return _0x44c562({'code':0xc8,'message':_0x366ee3});}}catch(_0x201e4a){logger[_0x7497('0x33')](_0x201e4a[_0x7497('0x3b')]);return _0x2f3dce(_0x1b240e[_0x7497('0x33')](0x1f4,_0x201e4a));}}return _0x2f3dce(_0x7497('0x3c'));});},'AcceptMessage':function(_0x306999){var _0x5ef292=this;return new Promise(function(_0x35d350,_0x276a57){if(_0x306999[_0x7497('0x3d')]&&_0x306999[_0x7497('0x3d')]['id']){if(_0x20faeb[_0x7497('0x3e')][_0x306999[_0x7497('0x3d')]['id']]){_0x20faeb['agents'][_0x306999[_0x7497('0x3d')]['id']][_0x7497('0x3f')]=![];_0x20faeb['agents'][_0x306999[_0x7497('0x3d')]['id']][_0x7497('0x40')]=undefined;}}if(_0x306999[_0x7497('0x16')]&&_0x306999[_0x7497('0x16')]['id']){try{var _0x189c2e=getId(_0x306999[_0x7497('0x15')],_0x306999['message']?_0x306999[_0x7497('0x16')]['id']:0x0,_0x306999['interaction']?_0x306999[_0x7497('0x17')]['id']:0x0);if(_0x20faeb[_0x7497('0x38')][_0x189c2e]){_0x20faeb[_0x7497('0x38')][_0x189c2e]['emit'](_0x7497('0x41'));if(rpc[_0x306999['channel']+'QueueReport']){rpc[_0x306999[_0x7497('0x15')]+_0x7497('0x42')]['update'](_0x189c2e,{'UserId':_0x306999[_0x7497('0x16')][_0x7497('0x43')]})[_0x7497('0x44')](function(_0x24d297){logger[_0x7497('0x33')]('error\x20update\x20queue\x20report');});}}return _0x35d350({'code':0xc8,'message':_0x306999});}catch(_0x46b7a8){logger[_0x7497('0x33')](_0x46b7a8[_0x7497('0x3b')]);return _0x276a57(_0x5ef292['error'](0x1f4,_0x46b7a8));}}logger['error']('message\x20is\x20empty');return _0x276a57(_0x5ef292[_0x7497('0x33')](0x1f4,_0x7497('0x45')));});},'RejectMessage':function(_0x221ca4){var _0x2e02ae=this;return new Promise(function(_0x184fd1,_0x165322){if(_0x221ca4[_0x7497('0x3d')]&&_0x221ca4[_0x7497('0x3d')]['id']){try{if(_0x20faeb[_0x7497('0x3e')][_0x221ca4[_0x7497('0x3d')]['id']]){_0x20faeb[_0x7497('0x3e')][_0x221ca4[_0x7497('0x3d')]['id']][_0x7497('0x3f')]=![];_0x20faeb[_0x7497('0x3e')][_0x221ca4['agent']['id']]['busyQueue']=undefined;}return _0x184fd1({'code':0xc8,'message':_0x221ca4});}catch(_0x252f8a){logger[_0x7497('0x33')](_0x252f8a[_0x7497('0x3b')]);return _0x165322(_0x2e02ae[_0x7497('0x33')](0x1f4,_0x252f8a));}}logger['error'](_0x7497('0x45'));return _0x165322(_0x2e02ae[_0x7497('0x33')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x249723){var _0x143b0f=this;return new Promise(function(_0x5a0404,_0x833bee){if(_0x249723[_0x7497('0x15')]&&_0x249723[_0x7497('0x17')]&&_0x249723[_0x7497('0x17')]['id']){try{var _0x203c2d=getId(_0x249723['channel'],_0x249723[_0x7497('0x16')]?_0x249723['message']['id']:0x0,_0x249723[_0x7497('0x17')]?_0x249723[_0x7497('0x17')]['id']:0x0);if(_0x20faeb['rules'][_0x203c2d]){_0x20faeb[_0x7497('0x38')][_0x203c2d]['emit'](_0x7497('0x41'));}return _0x5a0404({'code':0xc8,'message':_0x249723});}catch(_0x572e76){logger[_0x7497('0x33')](_0x572e76[_0x7497('0x3b')]);return _0x833bee(_0x143b0f[_0x7497('0x33')](0x1f4,_0x572e76));}}logger[_0x7497('0x33')](_0x7497('0x45'));return _0x833bee(_0x143b0f[_0x7497('0x33')](0x1f4,_0x7497('0x45')));});},'AgentCapacity':function(_0x77a3ac){var _0x2bdaf3=this;return new Promise(function(_0x311842,_0x1c163c){if(_0x20faeb[_0x7497('0x3e')][_0x7497('0x46')](_0x77a3ac['id'])){for(var _0x235cf1 in _0x77a3ac[_0x7497('0x47')]){if(_0x77a3ac['capacity'][_0x7497('0x46')](_0x235cf1)){if(_0x20faeb[_0x7497('0x3e')][_0x77a3ac['id']][_0x7497('0x46')](_0x235cf1+_0x7497('0x48'))){_0x20faeb[_0x7497('0x3e')][_0x77a3ac['id']][_0x235cf1+_0x7497('0x48')]=parseInt(_0x77a3ac['capacity'][_0x235cf1],0xa);}}}_0x20faeb['agents'][_0x77a3ac['id']][_0x7497('0x49')]();return _0x311842({'code':0xc8,'message':_0x20faeb[_0x7497('0x3e')][_0x77a3ac['id']]});}else{return _0x1c163c(_0x2bdaf3[_0x7497('0x33')](0x1f4,_0x7497('0x4a')));}});},'Agents':function(_0x2d337d){return new Promise(function(_0x175923,_0x6a418){var _0x2b1c9a=_['values'](_0x20faeb[_0x7497('0x3e')]);_0x175923({'count':_0x2b1c9a['length'],'rows':_0x2b1c9a});});},'ChatQueues':function(_0x78c694){return new Promise(function(_0x31f6e2,_0x7343c6){var _0x535281=[];for(var _0x7ce766 in _0x20faeb[_0x7497('0x4b')]){if(_0x20faeb[_0x7497('0x4b')]['hasOwnProperty'](_0x7ce766)){var _0x338c54=_0x20faeb[_0x7497('0x4b')][_0x7ce766];var _0x51e80b={'id':_0x338c54['id'],'available':_0x338c54[_0x7497('0x4c')],'loggedIn':_0x338c54[_0x7497('0x4d')],'name':_0x338c54['name'],'paused':_0x338c54['paused'],'waiting':_0x338c54['waiting']};_0x535281[_0x7497('0x24')](_0x51e80b);}}_0x31f6e2({'count':_0x535281['length'],'rows':_0x535281});});},'MailQueues':function(_0x203156){return new Promise(function(_0x295bb6,_0x1131fe){var _0x35e0ea=[];for(var _0x427d36 in _0x20faeb['mailQueues']){if(_0x20faeb[_0x7497('0x4e')][_0x7497('0x46')](_0x427d36)){var _0x24b479=_0x20faeb[_0x7497('0x4e')][_0x427d36];var _0x4a7294={'id':_0x24b479['id'],'available':_0x24b479[_0x7497('0x4c')],'loggedIn':_0x24b479[_0x7497('0x4d')],'name':_0x24b479[_0x7497('0x4f')],'paused':_0x24b479[_0x7497('0x50')],'waiting':_0x24b479[_0x7497('0x51')]};_0x35e0ea[_0x7497('0x24')](_0x4a7294);}}_0x295bb6({'count':_0x35e0ea[_0x7497('0x1a')],'rows':_0x35e0ea});});},'OpenchannelQueues':function(_0x2a04a3){return new Promise(function(_0x38b504,_0x1d4609){var _0x3922c6=[];for(var _0x96713b in _0x20faeb['openchannelQueues']){if(_0x20faeb[_0x7497('0x52')]['hasOwnProperty'](_0x96713b)){var _0x1c4c5d=_0x20faeb[_0x7497('0x52')][_0x96713b];var _0x57c12d={'id':_0x1c4c5d['id'],'available':_0x1c4c5d[_0x7497('0x4c')],'loggedIn':_0x1c4c5d[_0x7497('0x4d')],'name':_0x1c4c5d[_0x7497('0x4f')],'paused':_0x1c4c5d[_0x7497('0x50')],'waiting':_0x1c4c5d[_0x7497('0x51')]};_0x3922c6[_0x7497('0x24')](_0x57c12d);}}_0x38b504({'count':_0x3922c6[_0x7497('0x1a')],'rows':_0x3922c6});});},'SmsQueues':function(_0x381bc4){return new Promise(function(_0x4193eb,_0x5131cb){var _0x263ea2=[];for(var _0x15c20a in _0x20faeb['smsQueues']){if(_0x20faeb['smsQueues']['hasOwnProperty'](_0x15c20a)){var _0x3d649a=_0x20faeb[_0x7497('0x53')][_0x15c20a];var _0x34361b={'id':_0x3d649a['id'],'available':_0x3d649a['available'],'loggedIn':_0x3d649a['loggedIn'],'name':_0x3d649a[_0x7497('0x4f')],'paused':_0x3d649a[_0x7497('0x50')],'waiting':_0x3d649a[_0x7497('0x51')]};_0x263ea2[_0x7497('0x24')](_0x34361b);}}_0x4193eb({'count':_0x263ea2['length'],'rows':_0x263ea2});});},'FaxQueues':function(_0x1c9071){return new Promise(function(_0x295879,_0x598d8d){var _0xe581f4=[];for(var _0x71a999 in _0x20faeb[_0x7497('0x54')]){if(_0x20faeb[_0x7497('0x54')][_0x7497('0x46')](_0x71a999)){var _0xa06461=_0x20faeb[_0x7497('0x54')][_0x71a999];var _0x2886a0={'id':_0xa06461['id'],'available':_0xa06461[_0x7497('0x4c')],'loggedIn':_0xa06461[_0x7497('0x4d')],'name':_0xa06461[_0x7497('0x4f')],'paused':_0xa06461['paused'],'waiting':_0xa06461[_0x7497('0x51')]};_0xe581f4[_0x7497('0x24')](_0x2886a0);}}_0x295879({'count':_0xe581f4[_0x7497('0x1a')],'rows':_0xe581f4});});},'WhatsappQueues':function(_0x40efb1){return new Promise(function(_0x7c7ef6,_0x4bfe68){var _0x4ad794=[];for(var _0x2d5d82 in _0x20faeb[_0x7497('0x55')]){if(_0x20faeb[_0x7497('0x55')]['hasOwnProperty'](_0x2d5d82)){var _0x38ea66=_0x20faeb[_0x7497('0x55')][_0x2d5d82];var _0x489d8d={'id':_0x38ea66['id'],'available':_0x38ea66[_0x7497('0x4c')],'loggedIn':_0x38ea66[_0x7497('0x4d')],'name':_0x38ea66[_0x7497('0x4f')],'paused':_0x38ea66[_0x7497('0x50')],'waiting':_0x38ea66['waiting']};_0x4ad794[_0x7497('0x24')](_0x489d8d);}}_0x7c7ef6({'count':_0x4ad794[_0x7497('0x1a')],'rows':_0x4ad794});});},'ChatQueuesWaitingInteractions':function(_0x3c5dfc){return new Promise(function(_0x307a41,_0x985ec3){var _0x3b9a8e=_[_0x7497('0x56')](_0x20faeb[_0x7497('0x57')]);_0x307a41({'count':_0x3b9a8e['length'],'rows':_0x3b9a8e});});},'MailQueuesWaitingInteractions':function(_0x4761be){return new Promise(function(_0x1fe72b,_0x33efb2){var _0x32ac3e=_['values'](_0x20faeb[_0x7497('0x58')]);_0x1fe72b({'count':_0x32ac3e['length'],'rows':_0x32ac3e});});},'OpenchannelQueuesWaitingInteractions':function(_0x2acffd){return new Promise(function(_0x164dff,_0x1fd5d0){var _0xc6147d=_['values'](_0x20faeb[_0x7497('0x59')]);_0x164dff({'count':_0xc6147d['length'],'rows':_0xc6147d});});},'SmsQueuesWaitingInteractions':function(_0x1eaecd){return new Promise(function(_0x26205f,_0x32d0ee){var _0x9ebc80=_[_0x7497('0x56')](_0x20faeb[_0x7497('0x5a')]);_0x26205f({'count':_0x9ebc80[_0x7497('0x1a')],'rows':_0x9ebc80});});},'FaxQueuesWaitingInteractions':function(_0x3626e2){return new Promise(function(_0x415448,_0x15c9da){var _0x103c9e=_[_0x7497('0x56')](_0x20faeb['faxQueuesWaitingInteractions']);_0x415448({'count':_0x103c9e['length'],'rows':_0x103c9e});});},'WhatsappQueuesWaitingInteractions':function(_0x1489c4){return new Promise(function(_0x3ef491,_0x517ed7){var _0x3c9c88=_[_0x7497('0x56')](_0x20faeb[_0x7497('0x5b')]);_0x3ef491({'count':_0x3c9c88[_0x7497('0x1a')],'rows':_0x3c9c88});});}};var _0x573afe=jayson[_0x7497('0x5c')](_0x230d7c)['http']();_0x573afe['on'](_0x7497('0x33'),function(_0x16134a){logger[_0x7497('0x33')](JSON[_0x7497('0x36')](_0x16134a));return _0x55521f(_0x16134a);});_0x573afe[_0x7497('0x14')](0x232c,'127.0.0.1',function(){console[_0x7497('0x5d')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x454656(_0x7497('0x5e')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 80f8a88..cf210db 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 _0x4eff=['client','http','request','then','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','iftime\x20%s','indexOf','true','catch','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing'];(function(_0x18ad3a,_0xdcc596){var _0x2698ac=function(_0x1711d8){while(--_0x1711d8){_0x18ad3a['push'](_0x18ad3a['shift']());}};_0x2698ac(++_0xdcc596);}(_0x4eff,0x1cb));var _0xf4ef=function(_0x35c39a,_0x2b6a00){_0x35c39a=_0x35c39a-0x0;var _0x2d5cc0=_0x4eff[_0x35c39a];return _0x2d5cc0;};'use strict';var util=require(_0xf4ef('0x0'));var BPromise=require(_0xf4ef('0x1'));var jayson=require(_0xf4ef('0x2'));var _=require(_0xf4ef('0x3'));var logger=require(_0xf4ef('0x4'))(_0xf4ef('0x5'));var client=jayson[_0xf4ef('0x6')][_0xf4ef('0x7')]({'port':0x232a});function request(_0x19d2db,_0x3dbbc5){return new BPromise(function(_0x3dbb51,_0xaebec5){return client[_0xf4ef('0x8')](_0x19d2db,_0x3dbbc5)[_0xf4ef('0x9')](function(_0x8f698a){if(_0x8f698a[_0xf4ef('0xa')]){return _0xaebec5(_0x8f698a['error'][_0xf4ef('0xb')]);}else{return _0x3dbb51(_0x8f698a[_0xf4ef('0xc')]);}})['catch'](function(_0x541202){return _0xaebec5(_0x541202);});});}exports['condition']=function(_0x96cc5e,_0xdcd3af,_0x4a35d7){return function(_0x3a2b2a){if(_0x4a35d7[_0xf4ef('0xd')]&&!_0x4a35d7['rules'][_0x96cc5e]){logger[_0xf4ef('0xe')](_0xf4ef('0xf'),_0x96cc5e);return _0x3a2b2a['stop']();}var _0x394fe3=[];for(var _0x6dc9de=0x0;_0x6dc9de<_0xdcd3af[_0xf4ef('0x10')];_0x6dc9de+=0x1){_0x394fe3[_0xf4ef('0x11')](request('Command',{'command':util['format'](_0xf4ef('0x12'),_0xdcd3af[_0x6dc9de])})['then'](function(_0xdca0e2){return _0xdca0e2&&_0xdca0e2[_0xf4ef('0xb')]&&_0xdca0e2[_0xf4ef('0xb')][_0xf4ef('0x13')](_0xf4ef('0x14'))>=0x0?!![]:![];})[_0xf4ef('0x15')](function(_0x3b8b0f){logger[_0xf4ef('0xa')]('[%s][INTERVAL]\x20%s',_0x96cc5e,_0xdcd3af[_0x6dc9de]);}));}BPromise[_0xf4ef('0x16')](_0x394fe3)[_0xf4ef('0x9')](function(_0x38efa9){var _0x2f61ce=_[_0xf4ef('0x17')](_0x38efa9);logger[_0xf4ef('0xe')](_0xf4ef('0x18'),_0x96cc5e,_0xdcd3af['join'](_0xf4ef('0x19')),_0x2f61ce);_0x3a2b2a[_0xf4ef('0x1a')](_0x2f61ce);})[_0xf4ef('0x15')](function(_0x181ea6){console[_0xf4ef('0x1b')](_0x181ea6);logger[_0xf4ef('0xa')]('[%s][INTERVAL]\x20%s\x20%s',_0x96cc5e,_0xdcd3af[_0xf4ef('0x1c')](_0xf4ef('0x19')),_0x181ea6[_0xf4ef('0x1d')]);_0x3a2b2a[_0xf4ef('0x1e')]();});};}; \ No newline at end of file +var _0xb16c=['true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','log','stack','util','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','format','iftime\x20%s','indexOf'];(function(_0x10c201,_0x2111a6){var _0x3c7576=function(_0x2aa6e1){while(--_0x2aa6e1){_0x10c201['push'](_0x10c201['shift']());}};_0x3c7576(++_0x2111a6);}(_0xb16c,0x8e));var _0xcb16=function(_0x1c9649,_0x1da993){_0x1c9649=_0x1c9649-0x0;var _0x248718=_0xb16c[_0x1c9649];return _0x248718;};'use strict';var util=require(_0xcb16('0x0'));var BPromise=require('bluebird');var jayson=require(_0xcb16('0x1'));var _=require(_0xcb16('0x2'));var logger=require(_0xcb16('0x3'))(_0xcb16('0x4'));var client=jayson['client'][_0xcb16('0x5')]({'port':0x232a});function request(_0x9fbbb0,_0x4dc1df){return new BPromise(function(_0x58fdc7,_0x5e9fa5){return client[_0xcb16('0x6')](_0x9fbbb0,_0x4dc1df)[_0xcb16('0x7')](function(_0x341e7c){if(_0x341e7c[_0xcb16('0x8')]){return _0x5e9fa5(_0x341e7c['error'][_0xcb16('0x9')]);}else{return _0x58fdc7(_0x341e7c['result']);}})[_0xcb16('0xa')](function(_0x508b87){return _0x5e9fa5(_0x508b87);});});}exports[_0xcb16('0xb')]=function(_0x7748bb,_0x5d7e99,_0x4cd8f4){return function(_0x47c93e){if(_0x4cd8f4[_0xcb16('0xc')]&&!_0x4cd8f4['rules'][_0x7748bb]){logger[_0xcb16('0xd')](_0xcb16('0xe'),_0x7748bb);return _0x47c93e[_0xcb16('0xf')]();}var _0x5d0932=[];for(var _0xcca3be=0x0;_0xcca3be<_0x5d7e99['length'];_0xcca3be+=0x1){_0x5d0932[_0xcb16('0x10')](request('Command',{'command':util[_0xcb16('0x11')](_0xcb16('0x12'),_0x5d7e99[_0xcca3be])})[_0xcb16('0x7')](function(_0x486482){return _0x486482&&_0x486482[_0xcb16('0x9')]&&_0x486482['message'][_0xcb16('0x13')](_0xcb16('0x14'))>=0x0?!![]:![];})[_0xcb16('0xa')](function(_0x448e22){logger[_0xcb16('0x8')](_0xcb16('0x15'),_0x7748bb,_0x5d7e99[_0xcca3be]);}));}BPromise[_0xcb16('0x16')](_0x5d0932)['then'](function(_0x475e2f){var _0x12e395=_['some'](_0x475e2f);logger['info'](_0xcb16('0x17'),_0x7748bb,_0x5d7e99[_0xcb16('0x18')]('\x20|\x20'),_0x12e395);_0x47c93e['when'](_0x12e395);})['catch'](function(_0x370044){console[_0xcb16('0x19')](_0x370044);logger[_0xcb16('0x8')](_0xcb16('0x17'),_0x7748bb,_0x5d7e99[_0xcb16('0x18')]('\x20|\x20'),_0x370044[_0xcb16('0x1a')]);_0x47c93e[_0xcb16('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index bec96b8..ee9db69 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 _0xe1e3=['agentcompleteAt','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transferexten','transfereeuniqueid','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transferuniqueid','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','complete','lodash','util','format','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','agentcomplete','acwtime','agentacw','acwTimeout','CreateVoiceAgentReport','[%s][agents][agentcalled]','destuniqueid','now','called','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','debug','agentringnoanswer','agentringnoanswerAt','timeout','talktime','error','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','reason','holdtime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime'];(function(_0x520d04,_0x5f1c2a){var _0x282a7a=function(_0x5e5ee3){while(--_0x5e5ee3){_0x520d04['push'](_0x520d04['shift']());}};_0x282a7a(++_0x5f1c2a);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x49dd00,_0x3b29e3){_0x49dd00=_0x49dd00-0x0;var _0x2a09ec=_0xe1e3[_0x49dd00];return _0x2a09ec;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0xdbdabb,_0x5e9f9a){utils['info'](util[_0x3e1e('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xdbdabb[_0x3e1e('0x3')],_0xdbdabb[_0x3e1e('0x4')],_0xdbdabb[_0x3e1e('0x5')],_0xdbdabb[_0x3e1e('0x6')],_0xdbdabb[_0x3e1e('0x7')],_0xdbdabb[_0x3e1e('0x8')],_0xdbdabb['connectedlinenum'],_0xdbdabb[_0x3e1e('0x9')]));if(_0xdbdabb[_0x3e1e('0x5')]){utils[_0x3e1e('0xa')](_0xdbdabb[_0x3e1e('0x5')])[_0x3e1e('0xb')](function(_0x1e5173){if(_0x1e5173){_0xdbdabb['type']=_0x1e5173['type'];_0xdbdabb['agentacw']=_0xdbdabb[_0x3e1e('0xc')]?_0x1e5173['acw']:![];_0xdbdabb[_0x3e1e('0xd')]=_0xdbdabb[_0x3e1e('0xe')]?_0x1e5173[_0x3e1e('0xf')]:0x0;}utils['request'](_0x3e1e('0x10'),_0xdbdabb);});}else{utils['request']('CreateVoiceAgentReport',_0xdbdabb);}if(_0x5e9f9a){delete transfers[_0xdbdabb['uniqueid']];}else{delete agents[_0xdbdabb['destuniqueid']];}}exports['agentcalled']=function(_0x14ad58){try{utils['debug'](util['format'](_0x3e1e('0x11'),_0x14ad58[_0x3e1e('0x3')]),_0x14ad58);agents[_0x14ad58[_0x3e1e('0x12')]]=_0x14ad58;agents[_0x14ad58['destuniqueid']]['agentcalledAt']=utils[_0x3e1e('0x13')]();agents[_0x14ad58[_0x3e1e('0x12')]]['lastevent']=_0x3e1e('0x14');agents[_0x14ad58[_0x3e1e('0x12')]]['connectedlinenum']=null;agents[_0x14ad58[_0x3e1e('0x12')]]['connectedlinename']=null;utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x16'),_0x14ad58[_0x3e1e('0x3')],agents[_0x14ad58[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x14ad58['destuniqueid']));}catch(_0x5dccb8){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x11'),_0x14ad58[_0x3e1e('0x3')]),_0x5dccb8);}};exports['agentringnoanswer']=function(_0x1c5acd){try{if(!_['isNil'](agents[_0x1c5acd[_0x3e1e('0x12')]])){utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]',_0x1c5acd[_0x3e1e('0x3')]),_0x1c5acd);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1c5acd['uniqueid'],agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x1c5acd['destuniqueid']));agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x18')]=!![];agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x19')]=utils[_0x3e1e('0x13')]();agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x9')]=_0x3e1e('0x1a');agents[_0x1c5acd['destuniqueid']]['reason']=_0x3e1e('0x1a');agents[_0x1c5acd[_0x3e1e('0x12')]]['holdtime']=_0x1c5acd['ringtime']?parseInt(_0x1c5acd['ringtime'])/0x3e8:0x0;agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x1b')]=0x0;unanswered['push'](_0x1c5acd[_0x3e1e('0x12')]);}}catch(_0x5ac814){utils[_0x3e1e('0x1c')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]',_0x1c5acd[_0x3e1e('0x3')]),_0x5ac814);}};exports[_0x3e1e('0x1d')]=function(_0x45ed0e){try{_['forIn'](agents,function(_0xdef39,_0x4ec149){if(_0xdef39['uniqueid']==_0x45ed0e['uniqueid']&&!_[_0x3e1e('0x1e')](unanswered,_0xdef39['destuniqueid'])){utils['debug'](util[_0x3e1e('0x2')](_0x3e1e('0x1f'),_0x45ed0e[_0x3e1e('0x3')]),_0x45ed0e);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x45ed0e['uniqueid'],_0xdef39['membername'],_0xdef39['destuniqueid']));_0xdef39[_0x3e1e('0x18')]=!![];_0xdef39[_0x3e1e('0x19')]=utils[_0x3e1e('0x13')]();_0xdef39[_0x3e1e('0x9')]=_0x3e1e('0x20');_0xdef39[_0x3e1e('0x21')]=_0x3e1e('0x20');_0xdef39[_0x3e1e('0x22')]=_0x45ed0e['holdtime'];_0xdef39[_0x3e1e('0x1b')]=0x0;writeDB(_0xdef39);}});}catch(_0x348ef5){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x1f'),_0x45ed0e[_0x3e1e('0x3')]),_0x348ef5);}};exports[_0x3e1e('0x23')]=function(_0x55a082){try{if(agents[_0x55a082['destuniqueid']]){utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')]('[%s][agents][agentconnect]',_0x55a082[_0x3e1e('0x3')]),_0x55a082);utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x24'),_0x55a082[_0x3e1e('0x3')],agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x55a082[_0x3e1e('0x12')]));agents[_0x55a082['destuniqueid']][_0x3e1e('0x25')]=utils[_0x3e1e('0x13')]();agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x26')]=_0x55a082['connectedlinenum'];agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x27')]=_0x55a082[_0x3e1e('0x27')];agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x22')]=_0x55a082[_0x3e1e('0x28')];agents[_0x55a082[_0x3e1e('0x12')]]['lastevent']=_0x3e1e('0x29');_['forIn'](agents,function(_0x53bdf5,_0x4f598e){if(_0x53bdf5[_0x3e1e('0x12')]!=_0x55a082[_0x3e1e('0x12')]&&_0x53bdf5['uniqueid']==_0x55a082[_0x3e1e('0x3')]){_0x53bdf5[_0x3e1e('0x1b')]=0x0;_0x53bdf5['holdtime']=_0x55a082[_0x3e1e('0x28')];_0x53bdf5[_0x3e1e('0x18')]=!![];_0x53bdf5['agentringnoanswerAt']=utils['now']();_0x53bdf5[_0x3e1e('0x9')]='answered_elsewhere';_0x53bdf5['reason']=_0x3e1e('0x2a');_0x53bdf5[_0x3e1e('0x2b')]=_0x55a082[_0x3e1e('0x12')];_0x53bdf5[_0x3e1e('0x2c')]=_0x55a082[_0x3e1e('0x6')];writeDB(_0x53bdf5);}});}}catch(_0x55ea1d){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x2d'),_0x55a082[_0x3e1e('0x3')]),_0x55ea1d);}};exports['agentcomplete']=function(_0x1124d0){try{if(!_[_0x3e1e('0x2e')](agents[_0x1124d0[_0x3e1e('0x12')]])){utils['debug'](util[_0x3e1e('0x2')]('[%s][agents][agentcomplete]',_0x1124d0['uniqueid']),_0x1124d0);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x2f'),_0x1124d0[_0x3e1e('0x3')],agents[_0x1124d0['destuniqueid']]['membername'],_0x1124d0['destuniqueid']));agents[_0x1124d0['destuniqueid']][_0x3e1e('0xc')]=!![];agents[_0x1124d0[_0x3e1e('0x12')]]['agentcompleteAt']=utils['now']();agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x1b')]=utils[_0x3e1e('0x30')](agents[_0x1124d0['destuniqueid']][_0x3e1e('0x31')],agents[_0x1124d0['destuniqueid']][_0x3e1e('0x25')]);agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x21')]=_0x1124d0[_0x3e1e('0x21')];agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x9')]='complete';writeDB(agents[_0x1124d0[_0x3e1e('0x12')]]);}}catch(_0x1ce1cd){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x32'),_0x1124d0['uniqueid']),_0x1ce1cd);}};exports[_0x3e1e('0x33')]=function(_0x347b3f){try{if(!_[_0x3e1e('0x2e')](agents[_0x347b3f[_0x3e1e('0x34')]])){utils['debug'](util[_0x3e1e('0x2')](_0x3e1e('0x35'),_0x347b3f[_0x3e1e('0x3')]),_0x347b3f);utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x36'),_0x347b3f[_0x3e1e('0x3')],agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x6')],agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x3')]));agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x37')]=!![];agents[_0x347b3f['transfereruniqueid']][_0x3e1e('0x38')]='blind';agents[_0x347b3f['transfereruniqueid']]['transferexten']=_0x347b3f[_0x3e1e('0x39')];agents[_0x347b3f[_0x3e1e('0x34')]]['transferuniqueid']=agents[_0x347b3f[_0x3e1e('0x34')]]['uniqueid'];}}catch(_0x5b2416){utils[_0x3e1e('0x1c')](util['format']('[%s][agents][blindtransfer]',_0x347b3f['uniqueid']),_0x5b2416);}};exports[_0x3e1e('0x3a')]=function(_0xe577b2){try{utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')](_0x3e1e('0x3b'),_0xe577b2[_0x3e1e('0x3c')]),_0xe577b2);if(_0xe577b2[_0x3e1e('0x3c')]==_0xe577b2['origtransfererlinkedid']){if(!_[_0x3e1e('0x2e')](agents[_0xe577b2['secondtransfereruniqueid']])){utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x3d'),_0xe577b2['origtransfereruniqueid'],agents[_0xe577b2['secondtransfereruniqueid']][_0x3e1e('0x6')]));agents[_0xe577b2[_0x3e1e('0x3e')]]['transfer']=!![];agents[_0xe577b2[_0x3e1e('0x3e')]]['transfertype']='ATTENDED';agents[_0xe577b2[_0x3e1e('0x3e')]][_0x3e1e('0x3f')]=_0xe577b2['origtransfererexten'];agents[_0xe577b2[_0x3e1e('0x3e')]]['transferuniqueid']=_0xe577b2['origtransfereruniqueid'];}if(_0xe577b2[_0x3e1e('0x40')]&&agents[_0xe577b2['transfereeuniqueid']]){agents[_0xe577b2[_0x3e1e('0x40')]]['agententerreason']=0x1;transfers[_0xe577b2[_0x3e1e('0x40')]]=_['clone'](agents[_0xe577b2[_0x3e1e('0x40')]]);transfers[_0xe577b2[_0x3e1e('0x40')]]['calleridnum']=agents[_0xe577b2['secondtransfereruniqueid']]['calleridnum'];transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x41')]=agents[_0xe577b2[_0x3e1e('0x3e')]]['calleridname'];transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x42')]=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfereeuniqueid']]['agentconnectAt']=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfereeuniqueid']][_0x3e1e('0x22')]=0x0;transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x43')]=0x2;}}else if(_0xe577b2['secondtransfereruniqueid']==_0xe577b2[_0x3e1e('0x44')]){if(!_['isNil'](agents[_0xe577b2[_0x3e1e('0x3c')]])){utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x3d'),_0xe577b2['origtransfereruniqueid'],agents[_0xe577b2[_0x3e1e('0x3c')]]['membername']));agents[_0xe577b2[_0x3e1e('0x3c')]]['transfer']=!![];agents[_0xe577b2[_0x3e1e('0x3c')]][_0x3e1e('0x38')]=_0x3e1e('0x45');agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x3f')]=_0xe577b2[_0x3e1e('0x46')];agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x47')]=_0xe577b2['secondtransfereruniqueid'];}if(_0xe577b2['transfertargetuniqueid']&&agents[_0xe577b2['transfertargetuniqueid']]){agents[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x43')]=0x1;transfers[_0xe577b2[_0x3e1e('0x48')]]=_[_0x3e1e('0x49')](agents[_0xe577b2[_0x3e1e('0x48')]]);transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x8')]=agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x8')];transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x41')]=agents[_0xe577b2[_0x3e1e('0x3c')]][_0x3e1e('0x41')];transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x42')]=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfertargetuniqueid']]['agentconnectAt']=utils[_0x3e1e('0x13')]();transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x22')]=0x0;transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x43')]=0x2;}}}catch(_0x2e950d){utils[_0x3e1e('0x1c')](util[_0x3e1e('0x2')](_0x3e1e('0x3b'),_0xe577b2[_0x3e1e('0x3c')]),_0x2e950d);}};exports[_0x3e1e('0x4a')]=function(_0x50ba57){try{utils['debug'](util['format'](_0x3e1e('0x4b'),_0x50ba57[_0x3e1e('0x3')]),_0x50ba57);if(agents[_0x50ba57[_0x3e1e('0x3')]]&&agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')]==='timeout'){if(_0x50ba57[_0x3e1e('0x4c')]==='21'){agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')]=_0x3e1e('0x4d');agents[_0x50ba57[_0x3e1e('0x3')]]['lastevent']=_0x3e1e('0x4d');}utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],agents[_0x50ba57[_0x3e1e('0x3')]]['membername'],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x9')]));writeDB(agents[_0x50ba57[_0x3e1e('0x3')]]);var _0x372581=unanswered['indexOf'](_0x50ba57[_0x3e1e('0x3')]);if(_0x372581>-0x1){unanswered[_0x3e1e('0x4f')](_0x372581,0x1);}}if(transfers[_0x50ba57[_0x3e1e('0x3')]]){transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0xc')]=!![];transfers[_0x50ba57[_0x3e1e('0x3')]]['agentcompleteAt']=utils[_0x3e1e('0x13')]();transfers[_0x50ba57['uniqueid']][_0x3e1e('0x1b')]=utils[_0x3e1e('0x30')](transfers[_0x50ba57['uniqueid']][_0x3e1e('0x31')],transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x25')]);transfers[_0x50ba57[_0x3e1e('0x3')]]['reason']=_0x3e1e('0x50');transfers[_0x50ba57['uniqueid']][_0x3e1e('0x9')]=_0x3e1e('0x51');utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],transfers[_0x50ba57['uniqueid']][_0x3e1e('0x6')],transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],transfers[_0x50ba57[_0x3e1e('0x3')]]['lastevent']));writeDB(transfers[_0x50ba57[_0x3e1e('0x3')]],!![]);}if(agents[_0x50ba57[_0x3e1e('0x3')]]&&agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x25')]){agents[_0x50ba57['uniqueid']][_0x3e1e('0xc')]=!![];agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x31')]=utils[_0x3e1e('0x13')]();agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x1b')]=utils['diffTime'](agents[_0x50ba57['uniqueid']]['agentcompleteAt'],agents[_0x50ba57[_0x3e1e('0x3')]]['agentconnectAt']);agents[_0x50ba57[_0x3e1e('0x3')]]['reason']=agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x37')]?_0x3e1e('0x37'):_0x3e1e('0x50');agents[_0x50ba57['uniqueid']][_0x3e1e('0x9')]='complete';utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],agents[_0x50ba57['uniqueid']][_0x3e1e('0x6')],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],agents[_0x50ba57['uniqueid']]['lastevent']));writeDB(agents[_0x50ba57[_0x3e1e('0x3')]]);}}catch(_0x20bb6d){utils[_0x3e1e('0x1c')](util['format'](_0x3e1e('0x4b'),_0x50ba57['uniqueid']),_0x20bb6d);}}; \ No newline at end of file +var _0xe706=['then','type','agentacw','agentcomplete','acw','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','now','called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName'];(function(_0x41bc73,_0x3844e7){var _0x40278e=function(_0x5f114a){while(--_0x5f114a){_0x41bc73['push'](_0x41bc73['shift']());}};_0x40278e(++_0x3844e7);}(_0xe706,0xa3));var _0x6e70=function(_0x5b9ac9,_0x374422){_0x5b9ac9=_0x5b9ac9-0x0;var _0x7e6db3=_0xe706[_0x5b9ac9];return _0x7e6db3;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var utils=require(_0x6e70('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e8446,_0x2cae77){utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x5'),_0x5e8446[_0x6e70('0x6')],_0x5e8446[_0x6e70('0x7')],_0x5e8446[_0x6e70('0x8')],_0x5e8446[_0x6e70('0x9')],_0x5e8446[_0x6e70('0xa')],_0x5e8446[_0x6e70('0xb')],_0x5e8446[_0x6e70('0xc')],_0x5e8446[_0x6e70('0xd')]));if(_0x5e8446[_0x6e70('0x8')]){utils[_0x6e70('0xe')](_0x5e8446[_0x6e70('0x8')])[_0x6e70('0xf')](function(_0x954545){if(_0x954545){_0x5e8446[_0x6e70('0x10')]=_0x954545[_0x6e70('0x10')];_0x5e8446[_0x6e70('0x11')]=_0x5e8446[_0x6e70('0x12')]?_0x954545[_0x6e70('0x13')]:![];_0x5e8446[_0x6e70('0x14')]=_0x5e8446[_0x6e70('0x11')]?_0x954545['acwTimeout']:0x0;}utils['request'](_0x6e70('0x15'),_0x5e8446);});}else{utils[_0x6e70('0x16')](_0x6e70('0x15'),_0x5e8446);}if(_0x2cae77){delete transfers[_0x5e8446[_0x6e70('0x6')]];}else{delete agents[_0x5e8446[_0x6e70('0x17')]];}}exports[_0x6e70('0x18')]=function(_0xa1eb74){try{utils[_0x6e70('0x19')](util['format']('[%s][agents][agentcalled]',_0xa1eb74['uniqueid']),_0xa1eb74);agents[_0xa1eb74[_0x6e70('0x17')]]=_0xa1eb74;agents[_0xa1eb74['destuniqueid']]['agentcalledAt']=utils[_0x6e70('0x1a')]();agents[_0xa1eb74[_0x6e70('0x17')]]['lastevent']=_0x6e70('0x1b');agents[_0xa1eb74['destuniqueid']][_0x6e70('0xc')]=null;agents[_0xa1eb74[_0x6e70('0x17')]]['connectedlinename']=null;utils['info'](util[_0x6e70('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa1eb74[_0x6e70('0x6')],agents[_0xa1eb74[_0x6e70('0x17')]]['membername'],_0xa1eb74['destuniqueid']));}catch(_0xc238ba){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x1d'),_0xa1eb74[_0x6e70('0x6')]),_0xc238ba);}};exports[_0x6e70('0x1e')]=function(_0x1b2453){try{if(!_[_0x6e70('0x1f')](agents[_0x1b2453[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x1b2453);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x21'),_0x1b2453[_0x6e70('0x6')],agents[_0x1b2453[_0x6e70('0x17')]]['membername'],_0x1b2453[_0x6e70('0x17')]));agents[_0x1b2453['destuniqueid']]['agentringnoanswer']=!![];agents[_0x1b2453['destuniqueid']][_0x6e70('0x22')]=utils[_0x6e70('0x1a')]();agents[_0x1b2453['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x23');agents[_0x1b2453['destuniqueid']][_0x6e70('0x24')]=_0x6e70('0x23');agents[_0x1b2453[_0x6e70('0x17')]]['holdtime']=_0x1b2453['ringtime']?parseInt(_0x1b2453[_0x6e70('0x25')])/0x3e8:0x0;agents[_0x1b2453[_0x6e70('0x17')]][_0x6e70('0x26')]=0x0;unanswered[_0x6e70('0x27')](_0x1b2453[_0x6e70('0x17')]);}}catch(_0x5d772a){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x5d772a);}};exports[_0x6e70('0x28')]=function(_0x20a225){try{_[_0x6e70('0x29')](agents,function(_0x24114a,_0x3a0821){if(_0x24114a[_0x6e70('0x6')]==_0x20a225['uniqueid']&&!_[_0x6e70('0x2a')](unanswered,_0x24114a['destuniqueid'])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x2b'),_0x20a225[_0x6e70('0x6')]),_0x20a225);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x2c'),_0x20a225[_0x6e70('0x6')],_0x24114a['membername'],_0x24114a[_0x6e70('0x17')]));_0x24114a[_0x6e70('0x1e')]=!![];_0x24114a['agentringnoanswerAt']=utils[_0x6e70('0x1a')]();_0x24114a[_0x6e70('0xd')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x24')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x2e')]=_0x20a225[_0x6e70('0x2e')];_0x24114a[_0x6e70('0x26')]=0x0;writeDB(_0x24114a);}});}catch(_0xf146fd){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x2b'),_0x20a225['uniqueid']),_0xf146fd);}};exports[_0x6e70('0x2f')]=function(_0x3222a2){try{if(agents[_0x3222a2[_0x6e70('0x17')]]){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x30'),_0x3222a2[_0x6e70('0x6')]),_0x3222a2);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x31'),_0x3222a2[_0x6e70('0x6')],agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x9')],_0x3222a2['destuniqueid']));agents[_0x3222a2['destuniqueid']]['agentconnectAt']=utils[_0x6e70('0x1a')]();agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xc')]=_0x3222a2[_0x6e70('0xc')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x32')]=_0x3222a2['connectedlinename'];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xd')]=_0x6e70('0x33');_[_0x6e70('0x29')](agents,function(_0x16fc7d,_0x5be100){if(_0x16fc7d[_0x6e70('0x17')]!=_0x3222a2[_0x6e70('0x17')]&&_0x16fc7d[_0x6e70('0x6')]==_0x3222a2[_0x6e70('0x6')]){_0x16fc7d[_0x6e70('0x26')]=0x0;_0x16fc7d[_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];_0x16fc7d['agentringnoanswer']=!![];_0x16fc7d['agentringnoanswerAt']=utils['now']();_0x16fc7d[_0x6e70('0xd')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x24')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x35')]=_0x3222a2['destuniqueid'];_0x16fc7d[_0x6e70('0x36')]=_0x3222a2[_0x6e70('0x9')];writeDB(_0x16fc7d);}});}}catch(_0x2a2aca){utils['error'](util['format']('[%s][agents][agentconnect]',_0x3222a2[_0x6e70('0x6')]),_0x2a2aca);}};exports['agentcomplete']=function(_0x42f49a){try{if(!_[_0x6e70('0x1f')](agents[_0x42f49a[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x42f49a);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x38'),_0x42f49a[_0x6e70('0x6')],agents[_0x42f49a['destuniqueid']][_0x6e70('0x9')],_0x42f49a[_0x6e70('0x17')]));agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x12')]=!![];agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')]=utils[_0x6e70('0x1a')]();agents[_0x42f49a['destuniqueid']][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')],agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x3b')]);agents[_0x42f49a[_0x6e70('0x17')]]['reason']=_0x42f49a[_0x6e70('0x24')];agents[_0x42f49a['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x3c');writeDB(agents[_0x42f49a['destuniqueid']]);}}catch(_0x53efc3){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x53efc3);}};exports['blindtransfer']=function(_0x238ebb){try{if(!_[_0x6e70('0x1f')](agents[_0x238ebb[_0x6e70('0x3d')]])){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb['uniqueid']),_0x238ebb);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x3f'),_0x238ebb[_0x6e70('0x6')],agents[_0x238ebb[_0x6e70('0x3d')]]['membername'],agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')]));agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x40')]=!![];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x41')]='blind';agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x42')]=_0x238ebb[_0x6e70('0x43')];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x44')]=agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')];}}catch(_0x1dd242){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb[_0x6e70('0x6')]),_0x1dd242);}};exports['attendedtransfer']=function(_0x40e7c6){try{utils[_0x6e70('0x19')](util['format'](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x40e7c6);if(_0x40e7c6['origtransfereruniqueid']==_0x40e7c6[_0x6e70('0x47')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x48')]])){utils[_0x6e70('0x3')](util[_0x6e70('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x9')]));agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x40')]=!![];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x41')]=_0x6e70('0x49');agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x42')]=_0x40e7c6[_0x6e70('0x4a')];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x46')];}if(_0x40e7c6[_0x6e70('0x4b')]&&agents[_0x40e7c6[_0x6e70('0x4b')]]){agents[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x4b')]]=_[_0x6e70('0x4d')](agents[_0x40e7c6['transfereeuniqueid']]);transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0xb')];transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4e')]=agents[_0x40e7c6['secondtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x4b')]]['agentcalledAt']=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x3b')]=utils['now']();transfers[_0x40e7c6['transfereeuniqueid']][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x2;}}else if(_0x40e7c6[_0x6e70('0x48')]==_0x40e7c6[_0x6e70('0x4f')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x46')]])){utils['info'](util['format'](_0x6e70('0x50'),_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x9')]));agents[_0x40e7c6['origtransfereruniqueid']]['transfer']=!![];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x41')]='ATTENDED';agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x42')]=_0x40e7c6['secondtransfererexten'];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x48')];}if(_0x40e7c6[_0x6e70('0x51')]&&agents[_0x40e7c6[_0x6e70('0x51')]]){agents[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x51')]]=_['clone'](agents[_0x40e7c6[_0x6e70('0x51')]]);transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0xb')];transfers[_0x40e7c6['transfertargetuniqueid']]['calleridname']=agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x52')]=utils['now']();transfers[_0x40e7c6['transfertargetuniqueid']][_0x6e70('0x3b')]=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x2;}}}catch(_0x5eb6f0){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x5eb6f0);}};exports['hangup']=function(_0xce964b){try{utils['debug'](util['format'](_0x6e70('0x53'),_0xce964b[_0x6e70('0x6')]),_0xce964b);if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]===_0x6e70('0x23')){if(_0xce964b['cause']==='21'){agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x54');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x54');}utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')],agents[_0xce964b['uniqueid']]['lastevent']));writeDB(agents[_0xce964b[_0x6e70('0x6')]]);var _0x18ecf0=unanswered[_0x6e70('0x56')](_0xce964b[_0x6e70('0x6')]);if(_0x18ecf0>-0x1){unanswered[_0x6e70('0x57')](_0x18ecf0,0x1);}}if(transfers[_0xce964b['uniqueid']]){transfers[_0xce964b['uniqueid']][_0x6e70('0x12')]=!![];transfers[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x3b')]);transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x58');transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils['info'](util['format'](_0x6e70('0x55'),_0xce964b['uniqueid'],transfers[_0xce964b[_0x6e70('0x6')]]['membername'],transfers[_0xce964b['uniqueid']][_0x6e70('0x24')],transfers[_0xce964b['uniqueid']]['lastevent']));writeDB(transfers[_0xce964b[_0x6e70('0x6')]],!![]);}if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']){agents[_0xce964b['uniqueid']]['agentcomplete']=!![];agents[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']);agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=agents[_0xce964b[_0x6e70('0x6')]]['transfer']?_0x6e70('0x40'):_0x6e70('0x58');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]]['reason'],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]));writeDB(agents[_0xce964b['uniqueid']]);}}catch(_0x596d71){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x53'),_0xce964b['uniqueid']),_0x596d71);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 006b508..bf76b80 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 _0x60e5=['ANSWERED','BUSY','blinds','uniqueid','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','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','xmd-originatecalleridnum','value','[%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','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED'];(function(_0x3e016c,_0x2a3cc7){var _0x4cd430=function(_0x5245f1){while(--_0x5245f1){_0x3e016c['push'](_0x3e016c['shift']());}};_0x4cd430(++_0x2a3cc7);}(_0x60e5,0x6e));var _0x560e=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x60e5[_0xa4c85];return _0x172c1f;};'use strict';var _=require(_0x560e('0x0'));var util=require('util');var utils=require(_0x560e('0x1'));var transfers=require(_0x560e('0x2'));var dispositions=[_0x560e('0x3'),_0x560e('0x4'),_0x560e('0x4'),_0x560e('0x3'),_0x560e('0x3'),_0x560e('0x3'),_0x560e('0x5'),_0x560e('0x6'),_0x560e('0x4'),_0x560e('0x4'),'FAILED'];var channels={};function writeDB(_0x5a0e0d){var _0x8b7295;if(transfers[_0x560e('0x7')][_0x5a0e0d['uniqueid']]){_0x8b7295=_0x5a0e0d['uniqueid'];_0x5a0e0d[_0x560e('0x8')]=transfers['blinds'][_0x5a0e0d['uniqueid']]['transfereeuniqueid'];}utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0xb'),_0x5a0e0d[_0x560e('0x8')],_0x5a0e0d[_0x560e('0xc')],_0x5a0e0d[_0x560e('0xd')],_0x5a0e0d[_0x560e('0xe')],_0x5a0e0d[_0x560e('0xf')],_0x5a0e0d['calleridnum'],_0x5a0e0d[_0x560e('0x10')],_0x5a0e0d[_0x560e('0x11')]));if(_0x5a0e0d[_0x560e('0x12')]){utils[_0x560e('0x13')](_0x5a0e0d[_0x560e('0x12')])[_0x560e('0x14')](function(_0x5f4055){if(_0x5f4055){_0x5a0e0d[_0x560e('0x15')]=_0x5f4055['id'];}utils[_0x560e('0x16')](_0x560e('0x17'),_0x5a0e0d);});}else{utils[_0x560e('0x16')](_0x560e('0x17'),_0x5a0e0d);}if(channels[_0x5a0e0d[_0x560e('0x8')]]){delete channels[_0x5a0e0d[_0x560e('0x8')]];}else if(_0x8b7295&&channels[_0x8b7295]){delete transfers[_0x560e('0x7')][_0x8b7295];delete channels[_0x8b7295];}}exports[_0x560e('0x18')]=function(_0x3ec14a){try{utils[_0x560e('0x19')](util['format'](_0x560e('0x1a'),_0x3ec14a[_0x560e('0x8')]),_0x3ec14a);if(_0x3ec14a[_0x560e('0x8')]==_0x3ec14a[_0x560e('0x1b')]&&_0x3ec14a[_0x560e('0xc')]!=_0x560e('0x1c')){utils['info'](util[_0x560e('0xa')](_0x560e('0x1d'),_0x3ec14a['uniqueid'],_0x3ec14a[_0x560e('0x1e')],_0x3ec14a['exten']));channels[_0x3ec14a[_0x560e('0x8')]]={'uniqueid':_0x3ec14a['uniqueid'],'accountcode':_0x3ec14a[_0x560e('0x12')],'source':_0x3ec14a[_0x560e('0x1f')],'destination':_0x3ec14a[_0x560e('0x20')],'destinationcontext':_0x3ec14a[_0x560e('0x1e')],'channel':_0x3ec14a[_0x560e('0xc')],'starttime':utils[_0x560e('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x560e('0x3'),'amaflags':_0x560e('0x22')};}}catch(_0x3d8c9e){utils[_0x560e('0x23')](util[_0x560e('0xa')](_0x560e('0x1a'),_0x3ec14a['uniqueid']),_0x3d8c9e);}};exports[_0x560e('0x24')]=function(_0x331918){try{utils[_0x560e('0x19')](util[_0x560e('0xa')]('[%s][calls][newstate]',_0x331918[_0x560e('0x8')]),_0x331918);if(!_[_0x560e('0x25')](channels[_0x331918[_0x560e('0x8')]])&&_0x331918[_0x560e('0x26')]==0x6){utils['info'](util[_0x560e('0xa')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x331918[_0x560e('0x8')],_0x331918['context'],_0x331918[_0x560e('0xc')]));if(_[_0x560e('0x25')](channels[_0x331918[_0x560e('0x8')]][_0x560e('0x27')])){channels[_0x331918[_0x560e('0x8')]][_0x560e('0x27')]=utils[_0x560e('0x21')]();}}else if(!_[_0x560e('0x25')](channels[_0x331918[_0x560e('0x1b')]])&&_0x331918[_0x560e('0x26')]==0x6&&_0x331918['context']!=_0x560e('0x28')){utils['info'](util['format'](_0x560e('0x29'),_0x331918['uniqueid'],_0x331918[_0x560e('0x1b')],_0x331918[_0x560e('0x1e')],_0x331918[_0x560e('0xc')]));channels[_0x331918[_0x560e('0x1b')]][_0x560e('0x12')]=_0x331918[_0x560e('0x12')];channels[_0x331918[_0x560e('0x1b')]][_0x560e('0x2a')]=_0x331918[_0x560e('0xc')];if(_['isNil'](channels[_0x331918[_0x560e('0x1b')]][_0x560e('0x2b')])){channels[_0x331918[_0x560e('0x1b')]][_0x560e('0x2b')]=utils[_0x560e('0x21')]();}channels[_0x331918['linkedid']][_0x560e('0x2c')]=dispositions[_[_0x560e('0x2d')](_0x331918[_0x560e('0x26')])]||_0x560e('0x5');}}catch(_0x27abf3){utils[_0x560e('0x23')](util['format'](_0x560e('0x2e'),_0x331918[_0x560e('0x8')]),_0x27abf3);}};exports[_0x560e('0x2f')]=function(_0x12690b){try{if(!_[_0x560e('0x25')](channels[_0x12690b[_0x560e('0x8')]])){utils[_0x560e('0x19')](util['format'](_0x560e('0x30'),_0x12690b[_0x560e('0x8')]),_0x12690b);if(_['isNil'](channels[_0x12690b[_0x560e('0x8')]]['callerid'])){channels[_0x12690b[_0x560e('0x8')]]['callerid']=_0x12690b[_0x560e('0x31')]+'\x20<'+_0x12690b[_0x560e('0x1f')]+'>';}utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0x32'),_0x12690b['uniqueid'],channels[_0x12690b['uniqueid']][_0x560e('0x33')],_0x12690b[_0x560e('0x34')]));channels[_0x12690b[_0x560e('0x8')]][_0x560e('0x35')]=utils[_0x560e('0x21')]();channels[_0x12690b[_0x560e('0x8')]][_0x560e('0x36')]=utils[_0x560e('0x37')](channels[_0x12690b[_0x560e('0x8')]]['endtime'],channels[_0x12690b['uniqueid']][_0x560e('0x38')]);channels[_0x12690b['uniqueid']][_0x560e('0x39')]=channels[_0x12690b[_0x560e('0x8')]][_0x560e('0x2b')]?utils[_0x560e('0x37')](channels[_0x12690b['uniqueid']][_0x560e('0x35')],channels[_0x12690b[_0x560e('0x8')]][_0x560e('0x2b')]):0x0;writeDB(channels[_0x12690b[_0x560e('0x8')]]);}}catch(_0x58018a){utils['error'](util[_0x560e('0xa')](_0x560e('0x30'),_0x12690b['uniqueid']),_0x58018a);}};exports[_0x560e('0x3a')]=function(_0x39f477){try{if(!_[_0x560e('0x25')](channels[_0x39f477['localtwolinkedid']])){utils[_0x560e('0x19')](util[_0x560e('0xa')](_0x560e('0x3b'),_0x39f477[_0x560e('0x3c')]),_0x39f477);if(channels[_0x39f477[_0x560e('0x3d')]]['channel']==_0x39f477[_0x560e('0x3e')]){utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0x3f'),_0x39f477['origtransfereruniqueid'],_0x39f477[_0x560e('0x3d')],_0x39f477[_0x560e('0x40')]));channels[_0x39f477[_0x560e('0x3d')]][_0x560e('0x2a')]=_0x39f477[_0x560e('0x40')];channels[_0x39f477[_0x560e('0x3d')]][_0x560e('0x41')]=_0x560e('0x42');}else if(channels[_0x39f477[_0x560e('0x3d')]]['channel']=_0x39f477[_0x560e('0x43')]){utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0x3f'),_0x39f477[_0x560e('0x3c')],_0x39f477[_0x560e('0x3d')],_0x39f477[_0x560e('0x44')]));channels[_0x39f477['localtwolinkedid']][_0x560e('0x2a')]=_0x39f477[_0x560e('0x44')];channels[_0x39f477[_0x560e('0x3d')]][_0x560e('0x41')]=_0x560e('0x42');}}}catch(_0x338cbd){utils[_0x560e('0x23')](util[_0x560e('0xa')]('[%s][calls][attendedtransfer]',_0x39f477['origtransfereruniqueid']),_0x338cbd);}};exports[_0x560e('0x45')]=function(_0x1081c0){try{if(!_[_0x560e('0x25')](channels[_0x1081c0[_0x560e('0x8')]])){utils[_0x560e('0x19')](util[_0x560e('0xa')](_0x560e('0x46'),_0x1081c0[_0x560e('0x8')]),_0x1081c0);channels[_0x1081c0['uniqueid']][_0x560e('0x47')]=utils[_0x560e('0x21')]();utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0x48'),_0x1081c0[_0x560e('0x8')],channels[_0x1081c0[_0x560e('0x8')]]['musiconholdstartAt']));}}catch(_0x5e659b){utils[_0x560e('0x23')](util[_0x560e('0xa')]('[%s][calls][musiconholdstart]',_0x1081c0[_0x560e('0x8')]),_0x5e659b);}};exports[_0x560e('0x49')]=function(_0x58505f){try{if(!_['isNil'](channels[_0x58505f[_0x560e('0x8')]])){utils['debug'](util['format'](_0x560e('0x4a'),_0x58505f['uniqueid']),_0x58505f);if(!_['isNil'](channels[_0x58505f['uniqueid']][_0x560e('0x47')])){channels[_0x58505f[_0x560e('0x8')]][_0x560e('0x4b')]+=utils[_0x560e('0x37')](utils['now'](),channels[_0x58505f[_0x560e('0x8')]]['musiconholdstartAt']);utils[_0x560e('0x9')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x58505f['uniqueid'],channels[_0x58505f['uniqueid']][_0x560e('0x4b')]));delete channels[_0x58505f[_0x560e('0x8')]]['musiconholdstartAt'];}}}catch(_0x2346c2){utils[_0x560e('0x23')](util[_0x560e('0xa')](_0x560e('0x4a'),_0x58505f['uniqueid']),_0x2346c2);}};exports[_0x560e('0x4c')]=function(_0x6c4234){try{if(!_['isNil'](channels[_0x6c4234['uniqueid']])){utils['debug'](util['format']('[%s][calls][varset]',_0x6c4234['uniqueid']),_0x6c4234);if(!_['isNil'](_0x6c4234['variable'][_0x560e('0x4d')])){utils[_0x560e('0x9')](util[_0x560e('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x6c4234[_0x560e('0x8')],_0x6c4234[_0x560e('0x4e')]));channels[_0x6c4234[_0x560e('0x8')]]['source']=_0x6c4234[_0x560e('0x4e')];}if(!_[_0x560e('0x25')](_0x6c4234['variable']['xmd-phone'])){utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0x4f'),_0x6c4234[_0x560e('0x8')],_0x6c4234[_0x560e('0x4e')]));channels[_0x6c4234[_0x560e('0x8')]][_0x560e('0x50')]=_0x6c4234[_0x560e('0x4e')];channels[_0x6c4234['uniqueid']]['callerid']='\x22'+_0x6c4234['value']+_0x560e('0x51')+_0x6c4234[_0x560e('0x4e')]+'>';}if(!_['isNil'](_0x6c4234[_0x560e('0x52')][_0x560e('0x53')])||!_[_0x560e('0x25')](_0x6c4234['variable']['xmd-callerid'])){utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0x54'),_0x6c4234['uniqueid'],!_[_0x560e('0x25')](_0x6c4234[_0x560e('0x52')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0x560e('0x55'),_0x6c4234['value']));channels[_0x6c4234[_0x560e('0x8')]]['callerid']=_0x6c4234['value'];}if(!_[_0x560e('0x25')](_0x6c4234[_0x560e('0x52')][_0x560e('0x56')])||!_['isNil'](_0x6c4234[_0x560e('0x52')][_0x560e('0x57')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x6c4234['uniqueid'],!_[_0x560e('0x25')](_0x6c4234[_0x560e('0x52')]['xmd-queue'])?_0x560e('0x56'):_0x560e('0x57'),_0x6c4234[_0x560e('0x4e')]));channels[_0x6c4234[_0x560e('0x8')]][_0x560e('0x58')]=_0x560e('0x59');channels[_0x6c4234[_0x560e('0x8')]]['lastdata']=_0x6c4234[_0x560e('0x4e')];channels[_0x6c4234[_0x560e('0x8')]][_0x560e('0xd')]=!![];}if(!_[_0x560e('0x25')](_0x6c4234[_0x560e('0x52')][_0x560e('0x5a')])){utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0x5b'),_0x6c4234[_0x560e('0x8')],_0x6c4234['value']));channels[_0x6c4234[_0x560e('0x8')]]['ContactId']=_0x6c4234['value'];}if(!_['isNil'](_0x6c4234[_0x560e('0x52')][_0x560e('0x5c')])){utils[_0x560e('0x9')](util['format'](_0x560e('0x5d'),_0x6c4234['uniqueid'],_0x6c4234[_0x560e('0x4e')]));channels[_0x6c4234[_0x560e('0x8')]]['type']=_0x6c4234[_0x560e('0x4e')];}if(!_[_0x560e('0x25')](_0x6c4234[_0x560e('0x52')][_0x560e('0x5e')])){utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0x5f'),_0x6c4234[_0x560e('0x8')],_0x6c4234[_0x560e('0x4e')]));channels[_0x6c4234['uniqueid']][_0x560e('0x60')]=_0x6c4234[_0x560e('0x4e')];}if(!_['isNil'](_0x6c4234[_0x560e('0x52')][_0x560e('0x61')])){utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0x62'),_0x6c4234['uniqueid'],_0x6c4234[_0x560e('0x4e')]));channels[_0x6c4234[_0x560e('0x8')]][_0x560e('0x61')]=_0x6c4234[_0x560e('0x4e')];}}}catch(_0xdc4a3b){utils['error'](util['format'](_0x560e('0x63'),_0x6c4234[_0x560e('0x8')]),_0xdc4a3b);}};exports[_0x560e('0x64')]=function(_0x225e0f){try{if(!_['isNil'](channels[_0x225e0f[_0x560e('0x8')]])){utils['debug'](util['format'](_0x560e('0x65'),_0x225e0f[_0x560e('0x8')]),_0x225e0f);utils[_0x560e('0x9')](util[_0x560e('0xa')](_0x560e('0x66'),_0x225e0f[_0x560e('0x8')],_0x225e0f[_0x560e('0x67')],_0x225e0f[_0x560e('0x68')]));if(_0x225e0f[_0x560e('0x67')]['toLowerCase']()==_0x560e('0x69')&&_['startsWith'](_0x225e0f[_0x560e('0x68')][_0x560e('0x6a')](),_0x560e('0x6b'))){var _0x261be2=_0x225e0f[_0x560e('0x68')][_0x560e('0x6c')]('=');var _0x1fddcb=_0x261be2[0x0][_0x560e('0x6d')](_0x261be2[0x0][_0x560e('0x6e')]('(')+0x1,_0x261be2[0x0][_0x560e('0x6e')](')'));var _0x151332=_0x261be2[0x1];channels[_0x225e0f[_0x560e('0x8')]][_0x1fddcb]=_0x151332;}if(!_[_0x560e('0x6f')]([_0x560e('0x2f'),_0x560e('0x70'),_0x560e('0x71'),'set',_0x560e('0x72')],_0x225e0f['application'][_0x560e('0x6a')]())){channels[_0x225e0f[_0x560e('0x8')]][_0x560e('0x58')]=_0x225e0f[_0x560e('0x67')];channels[_0x225e0f[_0x560e('0x8')]]['lastdata']=_0x225e0f['appdata'];}}}catch(_0x851500){utils['error'](util[_0x560e('0xa')](_0x560e('0x65'),_0x225e0f[_0x560e('0x8')]),_0x851500);}}; \ No newline at end of file +var _0x8b30=['musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','info','format','channel','queue','interface','calleridnum','lastevent','accountcode','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','destinationchannel','musiconholdstart','[%s][calls][musiconholdstart]'];(function(_0x9d9343,_0x494c83){var _0x2abcd2=function(_0x101a63){while(--_0x101a63){_0x9d9343['push'](_0x9d9343['shift']());}};_0x2abcd2(++_0x494c83);}(_0x8b30,0x1e7));var _0x08b3=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x8b30[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x08b3('0x0'));var util=require(_0x08b3('0x1'));var utils=require(_0x08b3('0x2'));var transfers=require(_0x08b3('0x3'));var dispositions=[_0x08b3('0x4'),_0x08b3('0x5'),_0x08b3('0x5'),_0x08b3('0x4'),_0x08b3('0x4'),'NO\x20ANSWER',_0x08b3('0x6'),_0x08b3('0x7'),_0x08b3('0x5'),'FAILED',_0x08b3('0x5')];var channels={};function writeDB(_0x430635){var _0x47349d;if(transfers['blinds'][_0x430635[_0x08b3('0x8')]]){_0x47349d=_0x430635['uniqueid'];_0x430635[_0x08b3('0x8')]=transfers[_0x08b3('0x9')][_0x430635[_0x08b3('0x8')]][_0x08b3('0xa')];}utils[_0x08b3('0xb')](util[_0x08b3('0xc')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x430635['uniqueid'],_0x430635[_0x08b3('0xd')],_0x430635[_0x08b3('0xe')],_0x430635['membername'],_0x430635[_0x08b3('0xf')],_0x430635[_0x08b3('0x10')],_0x430635['connectedlinenum'],_0x430635[_0x08b3('0x11')]));if(_0x430635['accountcode']){utils['getUserByInternal'](_0x430635[_0x08b3('0x12')])['then'](function(_0x4742a3){if(_0x4742a3){_0x430635[_0x08b3('0x13')]=_0x4742a3['id'];}utils[_0x08b3('0x14')]('CreateVoiceCallReport',_0x430635);});}else{utils['request'](_0x08b3('0x15'),_0x430635);}if(channels[_0x430635[_0x08b3('0x8')]]){delete channels[_0x430635[_0x08b3('0x8')]];}else if(_0x47349d&&channels[_0x47349d]){delete transfers[_0x08b3('0x9')][_0x47349d];delete channels[_0x47349d];}}exports[_0x08b3('0x16')]=function(_0x286631){try{utils['debug'](util['format'](_0x08b3('0x17'),_0x286631[_0x08b3('0x8')]),_0x286631);if(_0x286631[_0x08b3('0x8')]==_0x286631['linkedid']&&_0x286631['channel']!=_0x08b3('0x18')){utils[_0x08b3('0xb')](util[_0x08b3('0xc')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x286631[_0x08b3('0x8')],_0x286631[_0x08b3('0x19')],_0x286631[_0x08b3('0x1a')]));channels[_0x286631[_0x08b3('0x8')]]={'uniqueid':_0x286631['uniqueid'],'accountcode':_0x286631[_0x08b3('0x12')],'source':_0x286631['calleridnum'],'destination':_0x286631['exten'],'destinationcontext':_0x286631[_0x08b3('0x19')],'channel':_0x286631[_0x08b3('0xd')],'starttime':utils[_0x08b3('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x08b3('0x4'),'amaflags':_0x08b3('0x1c')};}}catch(_0x12512a){utils[_0x08b3('0x1d')](util[_0x08b3('0xc')](_0x08b3('0x17'),_0x286631[_0x08b3('0x8')]),_0x12512a);}};exports[_0x08b3('0x1e')]=function(_0x5a4740){try{utils[_0x08b3('0x1f')](util['format']('[%s][calls][newstate]',_0x5a4740['uniqueid']),_0x5a4740);if(!_[_0x08b3('0x20')](channels[_0x5a4740[_0x08b3('0x8')]])&&_0x5a4740[_0x08b3('0x21')]==0x6){utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x22'),_0x5a4740[_0x08b3('0x8')],_0x5a4740[_0x08b3('0x19')],_0x5a4740['channel']));if(_['isNil'](channels[_0x5a4740[_0x08b3('0x8')]][_0x08b3('0x23')])){channels[_0x5a4740[_0x08b3('0x8')]][_0x08b3('0x23')]=utils[_0x08b3('0x1b')]();}}else if(!_[_0x08b3('0x20')](channels[_0x5a4740[_0x08b3('0x24')]])&&_0x5a4740[_0x08b3('0x21')]==0x6&&_0x5a4740[_0x08b3('0x19')]!=_0x08b3('0x25')){utils['info'](util[_0x08b3('0xc')](_0x08b3('0x26'),_0x5a4740[_0x08b3('0x8')],_0x5a4740[_0x08b3('0x24')],_0x5a4740[_0x08b3('0x19')],_0x5a4740[_0x08b3('0xd')]));channels[_0x5a4740[_0x08b3('0x24')]][_0x08b3('0x12')]=_0x5a4740[_0x08b3('0x12')];channels[_0x5a4740['linkedid']]['destinationchannel']=_0x5a4740[_0x08b3('0xd')];if(_[_0x08b3('0x20')](channels[_0x5a4740[_0x08b3('0x24')]]['answertime'])){channels[_0x5a4740[_0x08b3('0x24')]][_0x08b3('0x27')]=utils['now']();}channels[_0x5a4740[_0x08b3('0x24')]][_0x08b3('0x28')]=dispositions[_[_0x08b3('0x29')](_0x5a4740['channelstate'])]||_0x08b3('0x6');}}catch(_0x364735){utils['error'](util[_0x08b3('0xc')]('[%s][calls][newstate]',_0x5a4740[_0x08b3('0x8')]),_0x364735);}};exports[_0x08b3('0x2a')]=function(_0x11cea9){try{if(!_[_0x08b3('0x20')](channels[_0x11cea9[_0x08b3('0x8')]])){utils[_0x08b3('0x1f')](util['format'](_0x08b3('0x2b'),_0x11cea9[_0x08b3('0x8')]),_0x11cea9);if(_['isNil'](channels[_0x11cea9[_0x08b3('0x8')]][_0x08b3('0x2c')])){channels[_0x11cea9['uniqueid']][_0x08b3('0x2c')]=_0x11cea9['calleridname']+'\x20<'+_0x11cea9[_0x08b3('0x10')]+'>';}utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x2d'),_0x11cea9[_0x08b3('0x8')],channels[_0x11cea9['uniqueid']][_0x08b3('0x2c')],_0x11cea9[_0x08b3('0x2e')]));channels[_0x11cea9[_0x08b3('0x8')]]['endtime']=utils[_0x08b3('0x1b')]();channels[_0x11cea9['uniqueid']]['duration']=utils[_0x08b3('0x2f')](channels[_0x11cea9['uniqueid']][_0x08b3('0x30')],channels[_0x11cea9[_0x08b3('0x8')]][_0x08b3('0x31')]);channels[_0x11cea9[_0x08b3('0x8')]]['billableseconds']=channels[_0x11cea9[_0x08b3('0x8')]][_0x08b3('0x27')]?utils[_0x08b3('0x2f')](channels[_0x11cea9[_0x08b3('0x8')]]['endtime'],channels[_0x11cea9['uniqueid']][_0x08b3('0x27')]):0x0;writeDB(channels[_0x11cea9[_0x08b3('0x8')]]);}}catch(_0xb5d23a){utils[_0x08b3('0x1d')](util['format']('[%s][calls][hangup]',_0x11cea9[_0x08b3('0x8')]),_0xb5d23a);}};exports[_0x08b3('0x32')]=function(_0xef7020){try{if(!_[_0x08b3('0x20')](channels[_0xef7020[_0x08b3('0x33')]])){utils[_0x08b3('0x1f')](util[_0x08b3('0xc')](_0x08b3('0x34'),_0xef7020[_0x08b3('0x35')]),_0xef7020);if(channels[_0xef7020['localtwolinkedid']][_0x08b3('0xd')]==_0xef7020[_0x08b3('0x36')]){utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x37'),_0xef7020[_0x08b3('0x35')],_0xef7020[_0x08b3('0x33')],_0xef7020[_0x08b3('0x38')]));channels[_0xef7020[_0x08b3('0x33')]]['destinationchannel']=_0xef7020[_0x08b3('0x38')];channels[_0xef7020[_0x08b3('0x33')]][_0x08b3('0x39')]=_0x08b3('0x3a');}else if(channels[_0xef7020[_0x08b3('0x33')]][_0x08b3('0xd')]=_0xef7020['transfertargetchannel']){utils[_0x08b3('0xb')](util['format'](_0x08b3('0x37'),_0xef7020[_0x08b3('0x35')],_0xef7020[_0x08b3('0x33')],_0xef7020[_0x08b3('0x3b')]));channels[_0xef7020[_0x08b3('0x33')]][_0x08b3('0x3c')]=_0xef7020['origtransfererchannel'];channels[_0xef7020[_0x08b3('0x33')]]['userfield']=_0x08b3('0x3a');}}}catch(_0x205f16){utils[_0x08b3('0x1d')](util[_0x08b3('0xc')](_0x08b3('0x34'),_0xef7020['origtransfereruniqueid']),_0x205f16);}};exports[_0x08b3('0x3d')]=function(_0x43b8fe){try{if(!_['isNil'](channels[_0x43b8fe[_0x08b3('0x8')]])){utils[_0x08b3('0x1f')](util['format'](_0x08b3('0x3e'),_0x43b8fe[_0x08b3('0x8')]),_0x43b8fe);channels[_0x43b8fe[_0x08b3('0x8')]][_0x08b3('0x3f')]=utils[_0x08b3('0x1b')]();utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x40'),_0x43b8fe[_0x08b3('0x8')],channels[_0x43b8fe['uniqueid']][_0x08b3('0x3f')]));}}catch(_0x19cf9c){utils[_0x08b3('0x1d')](util['format']('[%s][calls][musiconholdstart]',_0x43b8fe[_0x08b3('0x8')]),_0x19cf9c);}};exports[_0x08b3('0x41')]=function(_0x19f1f9){try{if(!_['isNil'](channels[_0x19f1f9[_0x08b3('0x8')]])){utils['debug'](util['format'](_0x08b3('0x42'),_0x19f1f9['uniqueid']),_0x19f1f9);if(!_[_0x08b3('0x20')](channels[_0x19f1f9['uniqueid']][_0x08b3('0x3f')])){channels[_0x19f1f9[_0x08b3('0x8')]][_0x08b3('0x43')]+=utils[_0x08b3('0x2f')](utils['now'](),channels[_0x19f1f9[_0x08b3('0x8')]][_0x08b3('0x3f')]);utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x44'),_0x19f1f9[_0x08b3('0x8')],channels[_0x19f1f9['uniqueid']]['mohtime']));delete channels[_0x19f1f9[_0x08b3('0x8')]]['musiconholdstartAt'];}}}catch(_0x2dbc3e){utils['error'](util[_0x08b3('0xc')](_0x08b3('0x42'),_0x19f1f9['uniqueid']),_0x2dbc3e);}};exports[_0x08b3('0x45')]=function(_0x3c11e3){try{if(!_[_0x08b3('0x20')](channels[_0x3c11e3[_0x08b3('0x8')]])){utils[_0x08b3('0x1f')](util[_0x08b3('0xc')]('[%s][calls][varset]',_0x3c11e3[_0x08b3('0x8')]),_0x3c11e3);if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x47')])){utils[_0x08b3('0xb')](util['format'](_0x08b3('0x48'),_0x3c11e3[_0x08b3('0x8')],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]]['source']=_0x3c11e3[_0x08b3('0x49')];}if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x4a')])){utils[_0x08b3('0xb')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x3c11e3[_0x08b3('0x8')],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x4b')]=_0x3c11e3[_0x08b3('0x49')];channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x2c')]='\x22'+_0x3c11e3[_0x08b3('0x49')]+_0x08b3('0x4c')+_0x3c11e3[_0x08b3('0x49')]+'>';}if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x4d')])||!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x4e')])){utils[_0x08b3('0xb')](util['format'](_0x08b3('0x4f'),_0x3c11e3['uniqueid'],!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x4d')])?'xmd-callerid-preview':_0x08b3('0x4e'),_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x2c')]=_0x3c11e3[_0x08b3('0x49')];}if(!_[_0x08b3('0x20')](_0x3c11e3['variable'][_0x08b3('0x50')])||!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x51')])){utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x4f'),_0x3c11e3[_0x08b3('0x8')],!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x50')])?_0x08b3('0x50'):_0x08b3('0x51'),_0x3c11e3['value']));channels[_0x3c11e3['uniqueid']][_0x08b3('0x52')]=_0x08b3('0x53');channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x54')]=_0x3c11e3[_0x08b3('0x49')];channels[_0x3c11e3['uniqueid']]['queue']=!![];}if(!_[_0x08b3('0x20')](_0x3c11e3['variable'][_0x08b3('0x55')])){utils['info'](util[_0x08b3('0xc')](_0x08b3('0x56'),_0x3c11e3[_0x08b3('0x8')],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x57')]=_0x3c11e3[_0x08b3('0x49')];}if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x58')])){utils[_0x08b3('0xb')](util[_0x08b3('0xc')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3c11e3['uniqueid'],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3['uniqueid']][_0x08b3('0x59')]=_0x3c11e3[_0x08b3('0x49')];}if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x5a')])){utils['info'](util[_0x08b3('0xc')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x3c11e3['uniqueid'],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]][_0x08b3('0x5b')]=_0x3c11e3[_0x08b3('0x49')];}if(!_[_0x08b3('0x20')](_0x3c11e3[_0x08b3('0x46')][_0x08b3('0x5c')])){utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x5d'),_0x3c11e3['uniqueid'],_0x3c11e3[_0x08b3('0x49')]));channels[_0x3c11e3[_0x08b3('0x8')]]['sipcallid']=_0x3c11e3['value'];}}}catch(_0x1f67c8){utils[_0x08b3('0x1d')](util[_0x08b3('0xc')](_0x08b3('0x5e'),_0x3c11e3[_0x08b3('0x8')]),_0x1f67c8);}};exports[_0x08b3('0x5f')]=function(_0xaf5103){try{if(!_['isNil'](channels[_0xaf5103[_0x08b3('0x8')]])){utils[_0x08b3('0x1f')](util['format']('[%s][calls][newexten]',_0xaf5103[_0x08b3('0x8')]),_0xaf5103);utils[_0x08b3('0xb')](util[_0x08b3('0xc')](_0x08b3('0x60'),_0xaf5103[_0x08b3('0x8')],_0xaf5103[_0x08b3('0x61')],_0xaf5103[_0x08b3('0x62')]));if(_0xaf5103['application']['toLowerCase']()==_0x08b3('0x63')&&_[_0x08b3('0x64')](_0xaf5103[_0x08b3('0x62')][_0x08b3('0x65')](),_0x08b3('0x66'))){var _0x493a28=_0xaf5103['appdata'][_0x08b3('0x67')]('=');var _0x4eb261=_0x493a28[0x0][_0x08b3('0x68')](_0x493a28[0x0]['lastIndexOf']('(')+0x1,_0x493a28[0x0][_0x08b3('0x69')](')'));var _0x12d95c=_0x493a28[0x1];channels[_0xaf5103[_0x08b3('0x8')]][_0x4eb261]=_0x12d95c;}if(!_['includes']([_0x08b3('0x2a'),_0x08b3('0x6a'),_0x08b3('0x6b'),_0x08b3('0x63'),_0x08b3('0x6c')],_0xaf5103[_0x08b3('0x61')][_0x08b3('0x65')]())){channels[_0xaf5103[_0x08b3('0x8')]][_0x08b3('0x52')]=_0xaf5103['application'];channels[_0xaf5103['uniqueid']][_0x08b3('0x54')]=_0xaf5103[_0x08b3('0x62')];}}}catch(_0x48d2d3){utils[_0x08b3('0x1d')](util[_0x08b3('0xc')](_0x08b3('0x6d'),_0xaf5103[_0x08b3('0x8')]),_0x48d2d3);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 064296a..85eda60 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 _0xc073=['shutdown','fullybooted','error','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc073,0x1c7));var _0x3c07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc073[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x3c07('0x0'));exports[_0x3c07('0x1')]=function(){utils[_0x3c07('0x2')](_0x3c07('0x3'));};exports[_0x3c07('0x4')]=function(){utils[_0x3c07('0x2')]('[core]\x20shutdown');};exports[_0x3c07('0x5')]=function(){utils[_0x3c07('0x2')]('[core]\x20fullybooted');};exports[_0x3c07('0x6')]=function(_0x432591){utils[_0x3c07('0x6')]('[core]\x20error',_0x432591);};exports['close']=function(){utils[_0x3c07('0x2')](_0x3c07('0x7'));};exports[_0x3c07('0x8')]=function(_0x2916a0){}; \ No newline at end of file +var _0x1b3f=['info','[core]\x20connected','shutdown','fullybooted','error','[core]\x20error','[core]\x20close','./utils','connect'];(function(_0x4fb560,_0x4dd846){var _0x57ef21=function(_0x14eea8){while(--_0x14eea8){_0x4fb560['push'](_0x4fb560['shift']());}};_0x57ef21(++_0x4dd846);}(_0x1b3f,0x166));var _0xf1b3=function(_0x4791b1,_0x4223ff){_0x4791b1=_0x4791b1-0x0;var _0x41c85a=_0x1b3f[_0x4791b1];return _0x41c85a;};'use strict';var utils=require(_0xf1b3('0x0'));exports[_0xf1b3('0x1')]=function(){utils[_0xf1b3('0x2')](_0xf1b3('0x3'));};exports[_0xf1b3('0x4')]=function(){utils[_0xf1b3('0x2')]('[core]\x20shutdown');};exports[_0xf1b3('0x5')]=function(){utils[_0xf1b3('0x2')]('[core]\x20fullybooted');};exports[_0xf1b3('0x6')]=function(_0x33aa94){utils['error'](_0xf1b3('0x7'),_0x33aa94);};exports['close']=function(){utils[_0xf1b3('0x2')](_0xf1b3('0x8'));};exports['managerevent']=function(_0x1d836e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d2fd19d..80ce130 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 _0xbdf2=['toLowerCase','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','debug','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','endtime','[%s][dials][hangup]','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbdf2,0x1da));var _0x2bdf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbdf2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2bdf('0x0'));var util=require(_0x2bdf('0x1'));var utils=require(_0x2bdf('0x2'));var dials={};function writeDB(_0x221144){utils[_0x2bdf('0x3')](util[_0x2bdf('0x4')](_0x2bdf('0x5'),_0x221144['uniqueid'],_0x221144[_0x2bdf('0x6')],_0x221144[_0x2bdf('0x7')],_0x221144[_0x2bdf('0x8')],_0x221144[_0x2bdf('0x9')],_0x221144[_0x2bdf('0xa')]));utils[_0x2bdf('0xb')](_0x2bdf('0xc'),_0x221144);delete dials[_0x221144['uniqueid']];}exports[_0x2bdf('0xd')]=function(_0x4dbb3e){try{utils['debug'](util[_0x2bdf('0x4')](_0x2bdf('0xe'),_0x4dbb3e[_0x2bdf('0xf')]),_0x4dbb3e);utils[_0x2bdf('0x3')](util[_0x2bdf('0x4')](_0x2bdf('0x10'),_0x4dbb3e['uniqueid'],_0x4dbb3e[_0x2bdf('0x11')],_0x4dbb3e['appdata']));if(_0x4dbb3e[_0x2bdf('0x11')]['toLowerCase']()==_0x2bdf('0x12')&&_[_0x2bdf('0x13')](_0x4dbb3e[_0x2bdf('0x14')][_0x2bdf('0x15')](),'cdr(routeid)')){var _0x1ebc85=_0x4dbb3e['appdata'][_0x2bdf('0x16')]('=');dials[_0x4dbb3e[_0x2bdf('0xf')]]={'routeId':_0x1ebc85[0x1]};}}catch(_0x3d0de6){utils[_0x2bdf('0x17')](util[_0x2bdf('0x4')]('[%s][dials][newexten]',_0x4dbb3e[_0x2bdf('0xf')]),_0x3d0de6);}};exports[_0x2bdf('0x18')]=function(_0x513c98){try{utils['debug'](util['format'](_0x2bdf('0x19'),_0x513c98[_0x2bdf('0xf')]),_0x513c98);if(!_[_0x2bdf('0x1a')](_0x513c98[_0x2bdf('0x1b')][_0x2bdf('0x1c')])){utils[_0x2bdf('0x3')](util[_0x2bdf('0x4')](_0x2bdf('0x1d'),_0x513c98[_0x2bdf('0xf')],_0x513c98['value']));dials[_0x513c98['uniqueid']]={'routeId':_0x513c98[_0x2bdf('0x1e')]};}}catch(_0x502154){utils[_0x2bdf('0x17')](util[_0x2bdf('0x4')](_0x2bdf('0x19'),_0x513c98[_0x2bdf('0xf')]),_0x502154);}};exports[_0x2bdf('0x1f')]=function(_0x4f77f3){try{if(!_[_0x2bdf('0x1a')](dials[_0x4f77f3[_0x2bdf('0xf')]])){utils['debug'](util[_0x2bdf('0x4')](_0x2bdf('0x20'),_0x4f77f3[_0x2bdf('0xf')]),_0x4f77f3);dials[_0x4f77f3[_0x2bdf('0xf')]]=_[_0x2bdf('0x21')](dials[_0x4f77f3['uniqueid']],_0x4f77f3);dials[_0x4f77f3[_0x2bdf('0xf')]][_0x2bdf('0x22')]=utils['now']();dials[_0x4f77f3['uniqueid']]['lastevent']=_0x2bdf('0x23');utils['info'](util[_0x2bdf('0x4')](_0x2bdf('0x24'),_0x4f77f3[_0x2bdf('0xf')],dials[_0x4f77f3[_0x2bdf('0xf')]]['starttime']));}}catch(_0x56bb87){utils[_0x2bdf('0x17')](util[_0x2bdf('0x4')](_0x2bdf('0x20'),_0x4f77f3[_0x2bdf('0xf')]),_0x56bb87);}};exports[_0x2bdf('0x25')]=function(_0x3dede0){try{if(!_[_0x2bdf('0x1a')](dials[_0x3dede0[_0x2bdf('0xf')]])){utils['debug'](util[_0x2bdf('0x4')](_0x2bdf('0x26'),_0x3dede0[_0x2bdf('0xf')]),_0x3dede0);dials[_0x3dede0['uniqueid']]['dialstatus']=_0x3dede0['dialstatus'];if(_0x3dede0[_0x2bdf('0xa')]==_0x2bdf('0x27')){dials[_0x3dede0['uniqueid']]=_['assign'](dials[_0x3dede0[_0x2bdf('0xf')]],_0x3dede0);dials[_0x3dede0['uniqueid']]['answertime']=utils[_0x2bdf('0x28')]();dials[_0x3dede0[_0x2bdf('0xf')]][_0x2bdf('0x29')]=_0x2bdf('0x2a');utils[_0x2bdf('0x3')](util['format'](_0x2bdf('0x2b'),_0x3dede0[_0x2bdf('0xf')],_0x3dede0[_0x2bdf('0xa')],dials[_0x3dede0[_0x2bdf('0xf')]][_0x2bdf('0x2c')]));}else{utils[_0x2bdf('0x3')](util[_0x2bdf('0x4')](_0x2bdf('0x2d'),_0x3dede0[_0x2bdf('0xf')],_0x3dede0[_0x2bdf('0xa')]));}}}catch(_0x2197af){utils['error'](util[_0x2bdf('0x4')](_0x2bdf('0x26'),_0x3dede0[_0x2bdf('0xf')]),_0x2197af);}};exports[_0x2bdf('0x2e')]=function(_0x332392){try{if(!_[_0x2bdf('0x1a')](dials[_0x332392[_0x2bdf('0xf')]])){utils[_0x2bdf('0x2f')](util[_0x2bdf('0x4')]('[%s][dials][hangup]',_0x332392['uniqueid']),_0x332392);utils[_0x2bdf('0x3')](util[_0x2bdf('0x4')](_0x2bdf('0x30'),_0x332392[_0x2bdf('0xf')],_0x332392[_0x2bdf('0x8')],_0x332392['calleridname'],_0x332392[_0x2bdf('0x31')]));dials[_0x332392[_0x2bdf('0xf')]]=_['assign'](dials[_0x332392[_0x2bdf('0xf')]],{'endtime':utils[_0x2bdf('0x28')](),'lastevent':_0x2bdf('0x32')});dials[_0x332392[_0x2bdf('0xf')]][_0x2bdf('0x33')]=utils[_0x2bdf('0x34')](dials[_0x332392[_0x2bdf('0xf')]][_0x2bdf('0x35')],dials[_0x332392[_0x2bdf('0xf')]]['starttime']);dials[_0x332392[_0x2bdf('0xf')]]['holdtime']=utils[_0x2bdf('0x34')](dials[_0x332392[_0x2bdf('0xf')]][_0x2bdf('0x2c')]||dials[_0x332392['uniqueid']][_0x2bdf('0x35')],dials[_0x332392[_0x2bdf('0xf')]][_0x2bdf('0x22')]);dials[_0x332392[_0x2bdf('0xf')]]['billableseconds']=dials[_0x332392['uniqueid']]['answertime']?utils[_0x2bdf('0x34')](dials[_0x332392[_0x2bdf('0xf')]]['endtime'],dials[_0x332392['uniqueid']][_0x2bdf('0x2c')]):0x0;writeDB(dials[_0x332392[_0x2bdf('0xf')]]);}}catch(_0x2ab7fc){utils['error'](util[_0x2bdf('0x4')](_0x2bdf('0x36'),_0x332392['uniqueid']),_0x2ab7fc);}}; \ No newline at end of file +var _0xcc5d=['dialstatus','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','endtime','holdtime','diffTime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','uniqueid','application','toLowerCase','set','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','dialend'];(function(_0x3eb4ae,_0x493c5b){var _0x1aa0d4=function(_0x194a3b){while(--_0x194a3b){_0x3eb4ae['push'](_0x3eb4ae['shift']());}};_0x1aa0d4(++_0x493c5b);}(_0xcc5d,0x115));var _0xdcc5=function(_0xc2ae30,_0x18293c){_0xc2ae30=_0xc2ae30-0x0;var _0x531e4d=_0xcc5d[_0xc2ae30];return _0x531e4d;};'use strict';var _=require('lodash');var util=require(_0xdcc5('0x0'));var utils=require(_0xdcc5('0x1'));var dials={};function writeDB(_0x5a8c61){utils[_0xdcc5('0x2')](util[_0xdcc5('0x3')](_0xdcc5('0x4'),_0x5a8c61['uniqueid'],_0x5a8c61[_0xdcc5('0x5')],_0x5a8c61[_0xdcc5('0x6')],_0x5a8c61[_0xdcc5('0x7')],_0x5a8c61['connectedlinenum'],_0x5a8c61['dialstatus']));utils[_0xdcc5('0x8')](_0xdcc5('0x9'),_0x5a8c61);delete dials[_0x5a8c61['uniqueid']];}exports[_0xdcc5('0xa')]=function(_0x9b0c20){try{utils[_0xdcc5('0xb')](util[_0xdcc5('0x3')](_0xdcc5('0xc'),_0x9b0c20[_0xdcc5('0xd')]),_0x9b0c20);utils[_0xdcc5('0x2')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x9b0c20[_0xdcc5('0xd')],_0x9b0c20['application'],_0x9b0c20['appdata']));if(_0x9b0c20[_0xdcc5('0xe')][_0xdcc5('0xf')]()==_0xdcc5('0x10')&&_['startsWith'](_0x9b0c20[_0xdcc5('0x11')]['toLowerCase'](),_0xdcc5('0x12'))){var _0x1e0c96=_0x9b0c20[_0xdcc5('0x11')][_0xdcc5('0x13')]('=');dials[_0x9b0c20[_0xdcc5('0xd')]]={'routeId':_0x1e0c96[0x1]};}}catch(_0x2d9305){utils[_0xdcc5('0x14')](util[_0xdcc5('0x3')](_0xdcc5('0xc'),_0x9b0c20[_0xdcc5('0xd')]),_0x2d9305);}};exports[_0xdcc5('0x15')]=function(_0x172730){try{utils[_0xdcc5('0xb')](util[_0xdcc5('0x3')](_0xdcc5('0x16'),_0x172730['uniqueid']),_0x172730);if(!_[_0xdcc5('0x17')](_0x172730[_0xdcc5('0x18')][_0xdcc5('0x19')])){utils[_0xdcc5('0x2')](util[_0xdcc5('0x3')](_0xdcc5('0x1a'),_0x172730[_0xdcc5('0xd')],_0x172730[_0xdcc5('0x1b')]));dials[_0x172730[_0xdcc5('0xd')]]={'routeId':_0x172730[_0xdcc5('0x1b')]};}}catch(_0x123d5f){utils[_0xdcc5('0x14')](util[_0xdcc5('0x3')](_0xdcc5('0x16'),_0x172730[_0xdcc5('0xd')]),_0x123d5f);}};exports[_0xdcc5('0x1c')]=function(_0x14779f){try{if(!_[_0xdcc5('0x17')](dials[_0x14779f[_0xdcc5('0xd')]])){utils[_0xdcc5('0xb')](util[_0xdcc5('0x3')](_0xdcc5('0x1d'),_0x14779f[_0xdcc5('0xd')]),_0x14779f);dials[_0x14779f[_0xdcc5('0xd')]]=_[_0xdcc5('0x1e')](dials[_0x14779f[_0xdcc5('0xd')]],_0x14779f);dials[_0x14779f[_0xdcc5('0xd')]][_0xdcc5('0x1f')]=utils[_0xdcc5('0x20')]();dials[_0x14779f['uniqueid']]['lastevent']=_0xdcc5('0x21');utils[_0xdcc5('0x2')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x14779f[_0xdcc5('0xd')],dials[_0x14779f[_0xdcc5('0xd')]]['starttime']));}}catch(_0x4d01c3){utils[_0xdcc5('0x14')](util[_0xdcc5('0x3')](_0xdcc5('0x1d'),_0x14779f['uniqueid']),_0x4d01c3);}};exports[_0xdcc5('0x22')]=function(_0x418954){try{if(!_[_0xdcc5('0x17')](dials[_0x418954[_0xdcc5('0xd')]])){utils[_0xdcc5('0xb')](util[_0xdcc5('0x3')]('[%s][dials][dialend]',_0x418954[_0xdcc5('0xd')]),_0x418954);dials[_0x418954[_0xdcc5('0xd')]]['dialstatus']=_0x418954['dialstatus'];if(_0x418954[_0xdcc5('0x23')]==_0xdcc5('0x24')){dials[_0x418954[_0xdcc5('0xd')]]=_[_0xdcc5('0x1e')](dials[_0x418954[_0xdcc5('0xd')]],_0x418954);dials[_0x418954[_0xdcc5('0xd')]][_0xdcc5('0x25')]=utils[_0xdcc5('0x20')]();dials[_0x418954['uniqueid']][_0xdcc5('0x26')]=_0xdcc5('0x27');utils[_0xdcc5('0x2')](util['format'](_0xdcc5('0x28'),_0x418954[_0xdcc5('0xd')],_0x418954[_0xdcc5('0x23')],dials[_0x418954[_0xdcc5('0xd')]][_0xdcc5('0x25')]));}else{utils[_0xdcc5('0x2')](util[_0xdcc5('0x3')](_0xdcc5('0x29'),_0x418954[_0xdcc5('0xd')],_0x418954['dialstatus']));}}}catch(_0x17728f){utils[_0xdcc5('0x14')](util[_0xdcc5('0x3')](_0xdcc5('0x2a'),_0x418954[_0xdcc5('0xd')]),_0x17728f);}};exports[_0xdcc5('0x2b')]=function(_0x2eb5db){try{if(!_[_0xdcc5('0x17')](dials[_0x2eb5db['uniqueid']])){utils['debug'](util[_0xdcc5('0x3')](_0xdcc5('0x2c'),_0x2eb5db['uniqueid']),_0x2eb5db);utils['info'](util[_0xdcc5('0x3')](_0xdcc5('0x2d'),_0x2eb5db[_0xdcc5('0xd')],_0x2eb5db[_0xdcc5('0x7')],_0x2eb5db[_0xdcc5('0x2e')],_0x2eb5db['cause-txt']));dials[_0x2eb5db['uniqueid']]=_['assign'](dials[_0x2eb5db[_0xdcc5('0xd')]],{'endtime':utils[_0xdcc5('0x20')](),'lastevent':_0xdcc5('0x2f')});dials[_0x2eb5db[_0xdcc5('0xd')]]['duration']=utils['diffTime'](dials[_0x2eb5db[_0xdcc5('0xd')]][_0xdcc5('0x30')],dials[_0x2eb5db['uniqueid']][_0xdcc5('0x1f')]);dials[_0x2eb5db[_0xdcc5('0xd')]][_0xdcc5('0x31')]=utils[_0xdcc5('0x32')](dials[_0x2eb5db['uniqueid']][_0xdcc5('0x25')]||dials[_0x2eb5db[_0xdcc5('0xd')]]['endtime'],dials[_0x2eb5db[_0xdcc5('0xd')]]['starttime']);dials[_0x2eb5db[_0xdcc5('0xd')]][_0xdcc5('0x33')]=dials[_0x2eb5db[_0xdcc5('0xd')]]['answertime']?utils['diffTime'](dials[_0x2eb5db[_0xdcc5('0xd')]][_0xdcc5('0x30')],dials[_0x2eb5db[_0xdcc5('0xd')]]['answertime']):0x0;writeDB(dials[_0x2eb5db[_0xdcc5('0xd')]]);}}catch(_0x598d62){utils[_0xdcc5('0x14')](util[_0xdcc5('0x3')](_0xdcc5('0x2c'),_0x2eb5db['uniqueid']),_0x598d62);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index bb56df9..1bd23ac 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 _0xf466=['dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','port','asterisk','username','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','devicestatechange','device','agentcalled','uniqueid','[%s][index][agentringnoanswer]','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][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin'];(function(_0x54d33f,_0x1f557b){var _0x3c541c=function(_0x12ce61){while(--_0x12ce61){_0x54d33f['push'](_0x54d33f['shift']());}};_0x3c541c(++_0x1f557b);}(_0xf466,0x1d0));var _0x6f46=function(_0x5a7625,_0x560c50){_0x5a7625=_0x5a7625-0x0;var _0x2a3954=_0xf466[_0x5a7625];return _0x2a3954;};var AsteriskManager=require(_0x6f46('0x0'));var config=require(_0x6f46('0x1'));var utils=require(_0x6f46('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0x6f46('0x3')],config[_0x6f46('0x4')]['ip'],config[_0x6f46('0x4')][_0x6f46('0x5')],config[_0x6f46('0x4')]['password'],!![]);ami['keepConnected']();if(config[_0x6f46('0x6')]&&config[_0x6f46('0x6')][_0x6f46('0x7')]){utils[_0x6f46('0x8')](_0x6f46('0x9'));}else{var agents=require(_0x6f46('0xa'));var calls=require(_0x6f46('0xb'));var queues=require(_0x6f46('0xc'));var recordings=require(_0x6f46('0xd'));var members=require(_0x6f46('0xe'));var dials=require('./dials.controller');var transfers=require(_0x6f46('0xf'));var core=require('./core.controller');ami['on']('connect',core[_0x6f46('0x10')]);ami['on'](_0x6f46('0x11'),core[_0x6f46('0x11')]);ami['on'](_0x6f46('0x12'),core[_0x6f46('0x12')]);ami['on'](_0x6f46('0x13'),core[_0x6f46('0x13')]);ami['on'](_0x6f46('0x14'),core[_0x6f46('0x14')]);ami['on'](_0x6f46('0x15'),core[_0x6f46('0x15')]);ami['on']('devicestatechange',function(_0x150020){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')](_0x6f46('0x18'),_0x150020['device']),_0x150020);members[_0x6f46('0x19')](_0x150020);}catch(_0xa949f4){utils[_0x6f46('0x13')](util[_0x6f46('0x17')](_0x6f46('0x18'),_0x150020[_0x6f46('0x1a')]),_0xa949f4);}});ami['on'](_0x6f46('0x1b'),function(_0x1173ab){try{utils[_0x6f46('0x16')](util['format']('[%s][index][agentcalled]',_0x1173ab[_0x6f46('0x1c')]),_0x1173ab);agents[_0x6f46('0x1b')](_0x1173ab);}catch(_0x49c39d){utils[_0x6f46('0x13')](util[_0x6f46('0x17')]('[%s][index][agentcalled]',_0x1173ab[_0x6f46('0x1c')]),_0x49c39d);}});ami['on']('agentringnoanswer',function(_0x394f9b){try{utils[_0x6f46('0x16')](util['format'](_0x6f46('0x1d'),_0x394f9b['uniqueid']),_0x394f9b);agents[_0x6f46('0x1e')](_0x394f9b);}catch(_0x3611c0){utils[_0x6f46('0x13')](util['format']('[%s][index][agentringnoanswer]',_0x394f9b[_0x6f46('0x1c')]),_0x3611c0);}});ami['on']('agentconnect',function(_0x11c869){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')](_0x6f46('0x1f'),_0x11c869['uniqueid']),_0x11c869);agents[_0x6f46('0x20')](_0x11c869);queues[_0x6f46('0x20')](_0x11c869);}catch(_0x20b333){utils[_0x6f46('0x13')](util[_0x6f46('0x17')]('[%s][index][agentconnect]',_0x11c869[_0x6f46('0x1c')]),_0x20b333);}});ami['on'](_0x6f46('0x21'),function(_0x2941a4){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')]('[%s][index][agentcomplete]',_0x2941a4[_0x6f46('0x1c')]),_0x2941a4);agents[_0x6f46('0x21')](_0x2941a4);queues[_0x6f46('0x21')](_0x2941a4);members[_0x6f46('0x21')](_0x2941a4);}catch(_0x2237d3){utils[_0x6f46('0x13')](util[_0x6f46('0x17')](_0x6f46('0x22'),_0x2941a4[_0x6f46('0x1c')]),_0x2237d3);}});ami['on'](_0x6f46('0x23'),function(_0x1aa7d7){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')]('[%s][index][queuecallerabandon]',_0x1aa7d7[_0x6f46('0x1c')]),_0x1aa7d7);agents[_0x6f46('0x23')](_0x1aa7d7);queues[_0x6f46('0x23')](_0x1aa7d7);}catch(_0x57d7ab){utils['error'](util['format'](_0x6f46('0x24'),_0x1aa7d7[_0x6f46('0x1c')]),_0x57d7ab);}});ami['on'](_0x6f46('0x25'),function(_0x6ea32){try{utils['debug'](util[_0x6f46('0x17')]('[%s][index][queuecallerjoin]',_0x6ea32[_0x6f46('0x1c')]),_0x6ea32);queues['queuecallerjoin'](_0x6ea32);recordings[_0x6f46('0x25')](_0x6ea32);}catch(_0x4acccb){utils[_0x6f46('0x13')](util[_0x6f46('0x17')](_0x6f46('0x26'),_0x6ea32['uniqueid']),_0x4acccb);}});ami['on']('queuecallerleave',function(_0x14fd17){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')]('[%s][index][queuecallerleave]',_0x14fd17['uniqueid']),_0x14fd17);queues[_0x6f46('0x27')](_0x14fd17);}catch(_0x47905c){utils['error'](util[_0x6f46('0x17')](_0x6f46('0x28'),_0x14fd17[_0x6f46('0x1c')]),_0x47905c);}});ami['on'](_0x6f46('0x29'),function(_0x1a2b20){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')](_0x6f46('0x2a'),_0x1a2b20[_0x6f46('0x1c')]),_0x1a2b20);queues[_0x6f46('0x29')](_0x1a2b20);calls['musiconholdstart'](_0x1a2b20);}catch(_0x3b3f08){utils[_0x6f46('0x13')](util[_0x6f46('0x17')](_0x6f46('0x2a'),_0x1a2b20[_0x6f46('0x1c')]),_0x3b3f08);}});ami['on'](_0x6f46('0x2b'),function(_0x34dfa9){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')]('[%s][index][musiconholdstop]',_0x34dfa9[_0x6f46('0x1c')]),_0x34dfa9);queues['musiconholdstop'](_0x34dfa9);calls[_0x6f46('0x2b')](_0x34dfa9);}catch(_0x1db5b5){utils[_0x6f46('0x13')](util[_0x6f46('0x17')]('[%s][index][musiconholdstop]',_0x34dfa9['uniqueid']),_0x1db5b5);}});ami['on']('newstate',function(_0x55e13e){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')](_0x6f46('0x2c'),_0x55e13e['uniqueid']),_0x55e13e);calls[_0x6f46('0x2d')](_0x55e13e);recordings[_0x6f46('0x2d')](_0x55e13e);}catch(_0x14b21a){utils['error'](util['format']('[%s][index][newstate]',_0x55e13e['uniqueid']),_0x14b21a);}});ami['on'](_0x6f46('0x2e'),function(_0x445af3){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')](_0x6f46('0x2f'),_0x445af3[_0x6f46('0x1c')]),_0x445af3);calls[_0x6f46('0x2e')](_0x445af3);recordings[_0x6f46('0x2e')](_0x445af3);dials[_0x6f46('0x2e')](_0x445af3);agents[_0x6f46('0x2e')](_0x445af3);queues[_0x6f46('0x2e')](_0x445af3);}catch(_0x1dc9b5){utils[_0x6f46('0x13')](util[_0x6f46('0x17')](_0x6f46('0x2f'),_0x445af3[_0x6f46('0x1c')]),_0x1dc9b5);}});ami['on'](_0x6f46('0x30'),function(_0x4a6de4){try{utils['debug'](util[_0x6f46('0x17')]('[%s][index][cdr]',_0x4a6de4[_0x6f46('0x1c')]),_0x4a6de4);members[_0x6f46('0x30')](_0x4a6de4);}catch(_0x59246f){utils['error'](util[_0x6f46('0x17')](_0x6f46('0x31'),_0x4a6de4['uniqueid']),_0x59246f);}});ami['on'](_0x6f46('0x32'),function(_0x11df17){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')](_0x6f46('0x33'),_0x11df17[_0x6f46('0x1c')]),_0x11df17);queues[_0x6f46('0x32')](_0x11df17);agents[_0x6f46('0x32')](_0x11df17);transfers['blindtransfer'](_0x11df17);}catch(_0x11d7db){utils[_0x6f46('0x13')](util[_0x6f46('0x17')](_0x6f46('0x33'),_0x11df17[_0x6f46('0x1c')]),_0x11d7db);}});ami['on'](_0x6f46('0x34'),function(_0x5f295f){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')]('[%s][index][attendedtransfer]',_0x5f295f[_0x6f46('0x35')]),_0x5f295f);queues[_0x6f46('0x34')](_0x5f295f);transfers[_0x6f46('0x34')](_0x5f295f);agents[_0x6f46('0x34')](_0x5f295f);calls['attendedtransfer'](_0x5f295f);}catch(_0x1dc40d){utils['error'](util[_0x6f46('0x17')](_0x6f46('0x36'),_0x5f295f[_0x6f46('0x35')]),_0x1dc40d);}});ami['on'](_0x6f46('0x37'),function(_0x2d14dd){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')](_0x6f46('0x38'),_0x2d14dd['uniqueid']),_0x2d14dd);queues[_0x6f46('0x37')](_0x2d14dd);recordings[_0x6f46('0x37')](_0x2d14dd);calls[_0x6f46('0x37')](_0x2d14dd);dials[_0x6f46('0x37')](_0x2d14dd);}catch(_0x458913){utils['error'](util['format'](_0x6f46('0x38'),_0x2d14dd[_0x6f46('0x1c')]),_0x458913);}});ami['on']('newexten',function(_0x56cf59){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')](_0x6f46('0x39'),_0x56cf59[_0x6f46('0x1c')]),_0x56cf59);calls[_0x6f46('0x3a')](_0x56cf59);recordings[_0x6f46('0x3a')](_0x56cf59);dials[_0x6f46('0x3a')](_0x56cf59);}catch(_0x3dad6a){utils[_0x6f46('0x13')](util[_0x6f46('0x17')](_0x6f46('0x39'),_0x56cf59[_0x6f46('0x1c')]),_0x3dad6a);}});ami['on'](_0x6f46('0x3b'),function(_0x3ed0a1){try{utils[_0x6f46('0x16')](util[_0x6f46('0x17')](_0x6f46('0x3c'),_0x3ed0a1[_0x6f46('0x1c')]),_0x3ed0a1);calls['newchannel'](_0x3ed0a1);recordings[_0x6f46('0x3b')](_0x3ed0a1);}catch(_0x145bd8){utils[_0x6f46('0x13')](util[_0x6f46('0x17')](_0x6f46('0x3c'),_0x3ed0a1[_0x6f46('0x1c')]),_0x145bd8);}});ami['on'](_0x6f46('0x3d'),function(_0x2752a0){try{utils[_0x6f46('0x16')](util['format'](_0x6f46('0x3e'),_0x2752a0[_0x6f46('0x1c')]),_0x2752a0);dials['dialbegin'](_0x2752a0);}catch(_0xddab4d){utils['error'](util[_0x6f46('0x17')](_0x6f46('0x3f'),_0x2752a0[_0x6f46('0x1c')]),_0xddab4d);}});ami['on'](_0x6f46('0x40'),function(_0x21c419){try{utils[_0x6f46('0x16')](util['format']('[%s][index][dialend]',_0x21c419[_0x6f46('0x1c')]),_0x21c419);dials['dialend'](_0x21c419);}catch(_0x1af1d4){utils['error'](util['format'](_0x6f46('0x41'),_0x21c419[_0x6f46('0x1c')]),_0x1af1d4);}});} \ No newline at end of file +var _0x9498=['agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','username','keepConnected','xdr','disabled','info','./agents.controller','./queues.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','[%s][index][devicestatechange]'];(function(_0x16e8da,_0x3f4f97){var _0x462bc1=function(_0x18fc9c){while(--_0x18fc9c){_0x16e8da['push'](_0x16e8da['shift']());}};_0x462bc1(++_0x3f4f97);}(_0x9498,0x19c));var _0x8949=function(_0x93a7a9,_0x430651){_0x93a7a9=_0x93a7a9-0x0;var _0x151c25=_0x9498[_0x93a7a9];return _0x151c25;};var AsteriskManager=require(_0x8949('0x0'));var config=require(_0x8949('0x1'));var utils=require(_0x8949('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk']['port'],config[_0x8949('0x3')]['ip'],config[_0x8949('0x3')][_0x8949('0x4')],config['asterisk']['password'],!![]);ami[_0x8949('0x5')]();if(config[_0x8949('0x6')]&&config[_0x8949('0x6')][_0x8949('0x7')]){utils[_0x8949('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0x8949('0x9'));var calls=require('./calls.controller');var queues=require(_0x8949('0xa'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x8949('0xb'));var core=require(_0x8949('0xc'));ami['on']('connect',core['connect']);ami['on'](_0x8949('0xd'),core['shutdown']);ami['on'](_0x8949('0xe'),core[_0x8949('0xe')]);ami['on'](_0x8949('0xf'),core['error']);ami['on'](_0x8949('0x10'),core[_0x8949('0x10')]);ami['on']('managerevent',core[_0x8949('0x11')]);ami['on'](_0x8949('0x12'),function(_0x16783c){try{utils['debug'](util[_0x8949('0x13')]('[%s][index][devicestatechange]',_0x16783c[_0x8949('0x14')]),_0x16783c);members[_0x8949('0x12')](_0x16783c);}catch(_0x370e0e){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x15'),_0x16783c['device']),_0x370e0e);}});ami['on'](_0x8949('0x16'),function(_0x1370ed){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x18'),_0x1370ed[_0x8949('0x19')]),_0x1370ed);agents[_0x8949('0x16')](_0x1370ed);}catch(_0x548c98){utils[_0x8949('0xf')](util[_0x8949('0x13')]('[%s][index][agentcalled]',_0x1370ed[_0x8949('0x19')]),_0x548c98);}});ami['on'](_0x8949('0x1a'),function(_0x5d4800){try{utils[_0x8949('0x17')](util[_0x8949('0x13')]('[%s][index][agentringnoanswer]',_0x5d4800[_0x8949('0x19')]),_0x5d4800);agents[_0x8949('0x1a')](_0x5d4800);}catch(_0xbb197f){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x1b'),_0x5d4800['uniqueid']),_0xbb197f);}});ami['on'](_0x8949('0x1c'),function(_0x427d52){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x1d'),_0x427d52[_0x8949('0x19')]),_0x427d52);agents[_0x8949('0x1c')](_0x427d52);queues[_0x8949('0x1c')](_0x427d52);}catch(_0x3fd24b){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x1d'),_0x427d52[_0x8949('0x19')]),_0x3fd24b);}});ami['on'](_0x8949('0x1e'),function(_0x1ec56c){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x1f'),_0x1ec56c[_0x8949('0x19')]),_0x1ec56c);agents[_0x8949('0x1e')](_0x1ec56c);queues[_0x8949('0x1e')](_0x1ec56c);members[_0x8949('0x1e')](_0x1ec56c);}catch(_0x13f1ef){utils['error'](util[_0x8949('0x13')]('[%s][index][agentcomplete]',_0x1ec56c[_0x8949('0x19')]),_0x13f1ef);}});ami['on']('queuecallerabandon',function(_0x5dbd71){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x20'),_0x5dbd71[_0x8949('0x19')]),_0x5dbd71);agents[_0x8949('0x21')](_0x5dbd71);queues['queuecallerabandon'](_0x5dbd71);}catch(_0xe26b6f){utils['error'](util[_0x8949('0x13')]('[%s][index][queuecallerabandon]',_0x5dbd71['uniqueid']),_0xe26b6f);}});ami['on'](_0x8949('0x22'),function(_0x7f341d){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x23'),_0x7f341d[_0x8949('0x19')]),_0x7f341d);queues[_0x8949('0x22')](_0x7f341d);recordings[_0x8949('0x22')](_0x7f341d);}catch(_0x33d7b2){utils[_0x8949('0xf')](util[_0x8949('0x13')]('[%s][index][queuecallerjoin]',_0x7f341d['uniqueid']),_0x33d7b2);}});ami['on']('queuecallerleave',function(_0x83d87f){try{utils[_0x8949('0x17')](util['format'](_0x8949('0x24'),_0x83d87f[_0x8949('0x19')]),_0x83d87f);queues[_0x8949('0x25')](_0x83d87f);}catch(_0x3baf41){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x24'),_0x83d87f[_0x8949('0x19')]),_0x3baf41);}});ami['on'](_0x8949('0x26'),function(_0x2e9db1){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x27'),_0x2e9db1[_0x8949('0x19')]),_0x2e9db1);queues[_0x8949('0x26')](_0x2e9db1);calls[_0x8949('0x26')](_0x2e9db1);}catch(_0x1e2ede){utils[_0x8949('0xf')](util['format'](_0x8949('0x27'),_0x2e9db1[_0x8949('0x19')]),_0x1e2ede);}});ami['on'](_0x8949('0x28'),function(_0x34898f){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x29'),_0x34898f[_0x8949('0x19')]),_0x34898f);queues[_0x8949('0x28')](_0x34898f);calls[_0x8949('0x28')](_0x34898f);}catch(_0x542667){utils[_0x8949('0xf')](util['format'](_0x8949('0x29'),_0x34898f[_0x8949('0x19')]),_0x542667);}});ami['on'](_0x8949('0x2a'),function(_0x81e0c3){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x2b'),_0x81e0c3['uniqueid']),_0x81e0c3);calls['newstate'](_0x81e0c3);recordings[_0x8949('0x2a')](_0x81e0c3);}catch(_0x27a459){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x2b'),_0x81e0c3['uniqueid']),_0x27a459);}});ami['on'](_0x8949('0x2c'),function(_0x2c0589){try{utils[_0x8949('0x17')](util[_0x8949('0x13')]('[%s][index][hangup]',_0x2c0589['uniqueid']),_0x2c0589);calls['hangup'](_0x2c0589);recordings[_0x8949('0x2c')](_0x2c0589);dials[_0x8949('0x2c')](_0x2c0589);agents[_0x8949('0x2c')](_0x2c0589);queues[_0x8949('0x2c')](_0x2c0589);}catch(_0x41cda1){utils['error'](util[_0x8949('0x13')]('[%s][index][hangup]',_0x2c0589['uniqueid']),_0x41cda1);}});ami['on'](_0x8949('0x2d'),function(_0x36ec7c){try{utils['debug'](util[_0x8949('0x13')](_0x8949('0x2e'),_0x36ec7c[_0x8949('0x19')]),_0x36ec7c);members[_0x8949('0x2d')](_0x36ec7c);}catch(_0x102997){utils[_0x8949('0xf')](util[_0x8949('0x13')]('[%s][index][cdr]',_0x36ec7c[_0x8949('0x19')]),_0x102997);}});ami['on'](_0x8949('0x2f'),function(_0x10257e){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x30'),_0x10257e['uniqueid']),_0x10257e);queues[_0x8949('0x2f')](_0x10257e);agents[_0x8949('0x2f')](_0x10257e);transfers[_0x8949('0x2f')](_0x10257e);}catch(_0x3bea82){utils['error'](util['format']('[%s][index][blindtransfer]',_0x10257e[_0x8949('0x19')]),_0x3bea82);}});ami['on']('attendedtransfer',function(_0x331e01){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x31'),_0x331e01[_0x8949('0x32')]),_0x331e01);queues[_0x8949('0x33')](_0x331e01);transfers['attendedtransfer'](_0x331e01);agents[_0x8949('0x33')](_0x331e01);calls[_0x8949('0x33')](_0x331e01);}catch(_0xead868){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x31'),_0x331e01[_0x8949('0x32')]),_0xead868);}});ami['on'](_0x8949('0x34'),function(_0x43e316){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x35'),_0x43e316[_0x8949('0x19')]),_0x43e316);queues[_0x8949('0x34')](_0x43e316);recordings[_0x8949('0x34')](_0x43e316);calls[_0x8949('0x34')](_0x43e316);dials[_0x8949('0x34')](_0x43e316);}catch(_0x5cb403){utils[_0x8949('0xf')](util['format']('[%s][index][varset]',_0x43e316[_0x8949('0x19')]),_0x5cb403);}});ami['on']('newexten',function(_0x5abdc2){try{utils['debug'](util[_0x8949('0x13')](_0x8949('0x36'),_0x5abdc2[_0x8949('0x19')]),_0x5abdc2);calls[_0x8949('0x37')](_0x5abdc2);recordings[_0x8949('0x37')](_0x5abdc2);dials[_0x8949('0x37')](_0x5abdc2);}catch(_0x2900fd){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x36'),_0x5abdc2[_0x8949('0x19')]),_0x2900fd);}});ami['on'](_0x8949('0x38'),function(_0x317ac2){try{utils[_0x8949('0x17')](util[_0x8949('0x13')](_0x8949('0x39'),_0x317ac2['uniqueid']),_0x317ac2);calls[_0x8949('0x38')](_0x317ac2);recordings[_0x8949('0x38')](_0x317ac2);}catch(_0x45230c){utils[_0x8949('0xf')](util['format']('[%s][index][newchannel]',_0x317ac2['uniqueid']),_0x45230c);}});ami['on'](_0x8949('0x3a'),function(_0x53481c){try{utils['debug'](util[_0x8949('0x13')]('[%s][index][dialbegin]',_0x53481c[_0x8949('0x19')]),_0x53481c);dials[_0x8949('0x3a')](_0x53481c);}catch(_0x51f074){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x3b'),_0x53481c[_0x8949('0x19')]),_0x51f074);}});ami['on'](_0x8949('0x3c'),function(_0x563c7e){try{utils[_0x8949('0x17')](util['format'](_0x8949('0x3d'),_0x563c7e['uniqueid']),_0x563c7e);dials[_0x8949('0x3c')](_0x563c7e);}catch(_0x3c922a){utils[_0x8949('0xf')](util[_0x8949('0x13')](_0x8949('0x3d'),_0x563c7e[_0x8949('0x19')]),_0x3c922a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a8c2ed2..de47001 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 _0xc716=['[%s][members][cdr]','data1','source','destination','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','split','name','catch','format','[%s][members][writeDB]','startsWith','devicestatechange','[%s][members][devicestatechange]','device','uniqueid','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','error','agentcomplete','debug','[%s][members][agentcomplete]','queue','assign'];(function(_0x1cf43e,_0x35e3b3){var _0x134abb=function(_0x4893a7){while(--_0x4893a7){_0x1cf43e['push'](_0x1cf43e['shift']());}};_0x134abb(++_0x35e3b3);}(_0xc716,0x16c));var _0x6c71=function(_0x499ba7,_0xcb40e3){_0x499ba7=_0x499ba7-0x0;var _0x3a1cff=_0xc716[_0x499ba7];return _0x3a1cff;};'use strict';var _=require(_0x6c71('0x0'));var util=require('util');var utils=require(_0x6c71('0x1'));var members={};var exclude=[_0x6c71('0x2'),_0x6c71('0x3')];function writeDB(_0x278471){utils[_0x6c71('0x4')](util['format'](_0x6c71('0x5'),_0x278471['uniqueid'],_0x278471[_0x6c71('0x6')],_0x278471[_0x6c71('0x7')],_0x278471[_0x6c71('0x8')],_0x278471[_0x6c71('0x9')],_0x278471[_0x6c71('0xa')]));if(_0x278471[_0x6c71('0x6')]){utils[_0x6c71('0xb')](_0x278471[_0x6c71('0x6')])[_0x6c71('0xc')](function(_0x51c234){if(_0x51c234){_0x278471[_0x6c71('0x9')]=_0x51c234['name'];_0x278471[_0x6c71('0xd')]=_0x51c234['internal'];utils[_0x6c71('0xe')](_0x6c71('0xf'),_0x278471);}else{utils['getUserByName'](_0x278471[_0x6c71('0x6')][_0x6c71('0x10')]('/')[0x1])[_0x6c71('0xc')](function(_0x2d6d68){if(_0x2d6d68){_0x278471[_0x6c71('0x9')]=_0x2d6d68[_0x6c71('0x11')];_0x278471[_0x6c71('0xd')]=_0x2d6d68[_0x6c71('0xd')];utils['request'](_0x6c71('0xf'),_0x278471);}});}})[_0x6c71('0x12')](function(_0x42e79f){utils['error'](util[_0x6c71('0x13')](_0x6c71('0x14'),_0x278471['uniqueid']),_0x42e79f);});}delete members[_0x278471[_0x6c71('0x6')]];}function startsWith(_0x4fc900,_0x87b25a){return _['some'](_0x4fc900,function(_0x599513){return _[_0x6c71('0x15')](_0x87b25a,_0x599513);});}exports[_0x6c71('0x16')]=function(_0x4e616e){try{utils['debug'](util['format'](_0x6c71('0x17'),members[_0x4e616e[_0x6c71('0x18')]]?members[_0x4e616e['device']][_0x6c71('0x19')]:_0x4e616e[_0x6c71('0x18')]),_0x4e616e);utils[_0x6c71('0x4')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4e616e[_0x6c71('0x18')]]?members[_0x4e616e[_0x6c71('0x18')]][_0x6c71('0x19')]:_0x4e616e[_0x6c71('0x18')],_0x4e616e[_0x6c71('0x1a')],_0x4e616e[_0x6c71('0x18')]));switch(_0x4e616e[_0x6c71('0x1a')]){case _0x6c71('0x1b'):case _0x6c71('0x1c'):if(!startsWith(exclude,_0x4e616e[_0x6c71('0x18')])){members[_0x4e616e[_0x6c71('0x18')]]={'channel':_0x6c71('0x1d'),'interface':_0x4e616e['device'],'type':_0x6c71('0x1e'),'enterAt':utils[_0x6c71('0x1f')](),'role':_0x6c71('0x20')};}break;case _0x6c71('0x21'):if(!_[_0x6c71('0x22')](members[_0x4e616e[_0x6c71('0x18')]])){members[_0x4e616e[_0x6c71('0x18')]][_0x6c71('0x23')]=utils[_0x6c71('0x1f')]();members[_0x4e616e['device']][_0x6c71('0x24')]=utils['diffTime'](members[_0x4e616e[_0x6c71('0x18')]]['exitAt'],members[_0x4e616e[_0x6c71('0x18')]][_0x6c71('0x25')]);if(members[_0x4e616e[_0x6c71('0x18')]][_0x6c71('0x19')]){writeDB(members[_0x4e616e[_0x6c71('0x18')]]);}}break;default:break;}}catch(_0x268af0){utils[_0x6c71('0x26')](util[_0x6c71('0x13')](_0x6c71('0x17'),members[_0x4e616e[_0x6c71('0x18')]]?members[_0x4e616e[_0x6c71('0x18')]][_0x6c71('0x19')]:_0x4e616e[_0x6c71('0x18')]),_0x268af0);}};exports[_0x6c71('0x27')]=function(_0x3ffac5){try{if(!_[_0x6c71('0x22')](members[_0x3ffac5[_0x6c71('0x6')]])){utils[_0x6c71('0x28')](util['format'](_0x6c71('0x29'),_0x3ffac5[_0x6c71('0x19')]),_0x3ffac5);utils[_0x6c71('0x4')](util[_0x6c71('0x13')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3ffac5[_0x6c71('0x19')],_0x3ffac5[_0x6c71('0x6')],_0x3ffac5[_0x6c71('0x2a')]));members[_0x3ffac5[_0x6c71('0x6')]]=_[_0x6c71('0x2b')](members[_0x3ffac5[_0x6c71('0x6')]],{'data4':_0x3ffac5[_0x6c71('0x2a')],'uniqueid':_0x3ffac5['uniqueid']});}}catch(_0x261300){utils['error'](util[_0x6c71('0x13')](_0x6c71('0x29'),_0x3ffac5[_0x6c71('0x19')]),_0x261300);}};exports['cdr']=function(_0x4fdb39){try{utils[_0x6c71('0x28')](util[_0x6c71('0x13')](_0x6c71('0x2c'),_0x4fdb39[_0x6c71('0x19')]),_0x4fdb39);if(_0x4fdb39[_0x6c71('0x7')]){var _0x59306e=_0x4fdb39['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x59306e])){members[_0x59306e]=_[_0x6c71('0x2b')](members[_0x59306e],{'data1':members[_0x59306e][_0x6c71('0x2d')]||_0x4fdb39[_0x6c71('0xa')],'data2':members[_0x59306e][_0x6c71('0x8')]||_0x4fdb39[_0x6c71('0x2e')],'data3':members[_0x59306e]['data3']||_0x4fdb39[_0x6c71('0x2f')],'uniqueid':members[_0x59306e][_0x6c71('0x19')]||_0x4fdb39[_0x6c71('0x19')]});utils[_0x6c71('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4fdb39['uniqueid'],members[_0x59306e][_0x6c71('0x2d')],members[_0x59306e][_0x6c71('0x8')],members[_0x59306e][_0x6c71('0x30')]));if(members[_0x59306e][_0x6c71('0x23')]){writeDB(members[_0x59306e]);}}}if(_0x4fdb39['destinationchannel']){var _0x3d2f4b=_0x4fdb39[_0x6c71('0x31')]['split']('-')[0x0];if(!_[_0x6c71('0x22')](members[_0x3d2f4b])){members[_0x3d2f4b]=_[_0x6c71('0x2b')](members[_0x3d2f4b],{'data1':members[_0x3d2f4b][_0x6c71('0x2d')]||_0x4fdb39[_0x6c71('0xa')],'data2':members[_0x3d2f4b][_0x6c71('0x8')]||_0x4fdb39['source'],'data3':members[_0x3d2f4b]['data3']||_0x4fdb39[_0x6c71('0x2f')],'uniqueid':members[_0x3d2f4b][_0x6c71('0x19')]||_0x4fdb39[_0x6c71('0x19')]});utils[_0x6c71('0x4')](util[_0x6c71('0x13')](_0x6c71('0x32'),_0x4fdb39[_0x6c71('0x19')],members[_0x3d2f4b][_0x6c71('0x2d')],members[_0x3d2f4b]['data2'],members[_0x3d2f4b][_0x6c71('0x30')]));if(members[_0x3d2f4b]['exitAt']){writeDB(members[_0x3d2f4b]);}}}}catch(_0x5a162c){utils[_0x6c71('0x26')](util[_0x6c71('0x13')](_0x6c71('0x2c'),_0x4fdb39[_0x6c71('0x19')]),_0x5a162c);}}; \ No newline at end of file +var _0xbab3=['destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','lodash','./utils','Local/_attended@transfer','Queue:','info','interface','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','CreateMemberReport','catch','error','format','[%s][members][writeDB]','uniqueid','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','agent','NOT_INUSE','exitAt','now','duration','enterAt','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','source','data3'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xbab3,0x130));var _0x3bab=function(_0x22b0cb,_0x5a764a){_0x22b0cb=_0x22b0cb-0x0;var _0x444178=_0xbab3[_0x22b0cb];return _0x444178;};'use strict';var _=require(_0x3bab('0x0'));var util=require('util');var utils=require(_0x3bab('0x1'));var members={};var exclude=[_0x3bab('0x2'),_0x3bab('0x3')];function writeDB(_0x54da45){utils[_0x3bab('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x54da45['uniqueid'],_0x54da45[_0x3bab('0x5')],_0x54da45['channel'],_0x54da45[_0x3bab('0x6')],_0x54da45[_0x3bab('0x7')],_0x54da45[_0x3bab('0x8')]));if(_0x54da45[_0x3bab('0x5')]){utils[_0x3bab('0x9')](_0x54da45[_0x3bab('0x5')])[_0x3bab('0xa')](function(_0x31b4a9){if(_0x31b4a9){_0x54da45[_0x3bab('0x7')]=_0x31b4a9[_0x3bab('0xb')];_0x54da45[_0x3bab('0xc')]=_0x31b4a9['internal'];utils[_0x3bab('0xd')]('CreateMemberReport',_0x54da45);}else{utils[_0x3bab('0xe')](_0x54da45[_0x3bab('0x5')]['split']('/')[0x1])[_0x3bab('0xa')](function(_0x1ebce4){if(_0x1ebce4){_0x54da45[_0x3bab('0x7')]=_0x1ebce4[_0x3bab('0xb')];_0x54da45[_0x3bab('0xc')]=_0x1ebce4[_0x3bab('0xc')];utils[_0x3bab('0xd')](_0x3bab('0xf'),_0x54da45);}});}})[_0x3bab('0x10')](function(_0x10d3ca){utils[_0x3bab('0x11')](util[_0x3bab('0x12')](_0x3bab('0x13'),_0x54da45[_0x3bab('0x14')]),_0x10d3ca);});}delete members[_0x54da45[_0x3bab('0x5')]];}function startsWith(_0x173d14,_0x12a2a0){return _[_0x3bab('0x15')](_0x173d14,function(_0x51b3e3){return _['startsWith'](_0x12a2a0,_0x51b3e3);});}exports['devicestatechange']=function(_0x1af796){try{utils[_0x3bab('0x16')](util[_0x3bab('0x12')](_0x3bab('0x17'),members[_0x1af796[_0x3bab('0x18')]]?members[_0x1af796[_0x3bab('0x18')]][_0x3bab('0x14')]:_0x1af796[_0x3bab('0x18')]),_0x1af796);utils[_0x3bab('0x4')](util['format'](_0x3bab('0x19'),members[_0x1af796[_0x3bab('0x18')]]?members[_0x1af796[_0x3bab('0x18')]]['uniqueid']:_0x1af796[_0x3bab('0x18')],_0x1af796[_0x3bab('0x1a')],_0x1af796[_0x3bab('0x18')]));switch(_0x1af796['state']){case _0x3bab('0x1b'):case'BUSY':if(!startsWith(exclude,_0x1af796[_0x3bab('0x18')])){members[_0x1af796[_0x3bab('0x18')]]={'channel':_0x3bab('0x1c'),'interface':_0x1af796[_0x3bab('0x18')],'type':_0x3bab('0x1d'),'enterAt':utils['now'](),'role':_0x3bab('0x1e')};}break;case _0x3bab('0x1f'):if(!_['isNil'](members[_0x1af796['device']])){members[_0x1af796[_0x3bab('0x18')]][_0x3bab('0x20')]=utils[_0x3bab('0x21')]();members[_0x1af796[_0x3bab('0x18')]][_0x3bab('0x22')]=utils['diffTime'](members[_0x1af796[_0x3bab('0x18')]][_0x3bab('0x20')],members[_0x1af796[_0x3bab('0x18')]][_0x3bab('0x23')]);if(members[_0x1af796['device']][_0x3bab('0x14')]){writeDB(members[_0x1af796[_0x3bab('0x18')]]);}}break;default:break;}}catch(_0x1a7e66){utils['error'](util[_0x3bab('0x12')](_0x3bab('0x17'),members[_0x1af796['device']]?members[_0x1af796[_0x3bab('0x18')]]['uniqueid']:_0x1af796[_0x3bab('0x18')]),_0x1a7e66);}};exports['agentcomplete']=function(_0x15513e){try{if(!_[_0x3bab('0x24')](members[_0x15513e[_0x3bab('0x5')]])){utils['debug'](util['format'](_0x3bab('0x25'),_0x15513e[_0x3bab('0x14')]),_0x15513e);utils['info'](util[_0x3bab('0x12')](_0x3bab('0x26'),_0x15513e[_0x3bab('0x14')],_0x15513e['interface'],_0x15513e['queue']));members[_0x15513e[_0x3bab('0x5')]]=_[_0x3bab('0x27')](members[_0x15513e[_0x3bab('0x5')]],{'data4':_0x15513e[_0x3bab('0x28')],'uniqueid':_0x15513e['uniqueid']});}}catch(_0x4b2b94){utils[_0x3bab('0x11')](util[_0x3bab('0x12')](_0x3bab('0x25'),_0x15513e[_0x3bab('0x14')]),_0x4b2b94);}};exports[_0x3bab('0x29')]=function(_0x1ba60d){try{utils['debug'](util[_0x3bab('0x12')](_0x3bab('0x2a'),_0x1ba60d[_0x3bab('0x14')]),_0x1ba60d);if(_0x1ba60d['channel']){var _0x2c09bc=_0x1ba60d['channel']['split']('-')[0x0];if(!_[_0x3bab('0x24')](members[_0x2c09bc])){members[_0x2c09bc]=_[_0x3bab('0x27')](members[_0x2c09bc],{'data1':members[_0x2c09bc][_0x3bab('0x2b')]||_0x1ba60d['type'],'data2':members[_0x2c09bc]['data2']||_0x1ba60d[_0x3bab('0x2c')],'data3':members[_0x2c09bc][_0x3bab('0x2d')]||_0x1ba60d[_0x3bab('0x2e')],'uniqueid':members[_0x2c09bc][_0x3bab('0x14')]||_0x1ba60d[_0x3bab('0x14')]});utils[_0x3bab('0x4')](util[_0x3bab('0x12')](_0x3bab('0x2f'),_0x1ba60d[_0x3bab('0x14')],members[_0x2c09bc][_0x3bab('0x2b')],members[_0x2c09bc][_0x3bab('0x6')],members[_0x2c09bc][_0x3bab('0x2d')]));if(members[_0x2c09bc]['exitAt']){writeDB(members[_0x2c09bc]);}}}if(_0x1ba60d[_0x3bab('0x30')]){var _0xd462c3=_0x1ba60d['destinationchannel'][_0x3bab('0x31')]('-')[0x0];if(!_[_0x3bab('0x24')](members[_0xd462c3])){members[_0xd462c3]=_[_0x3bab('0x27')](members[_0xd462c3],{'data1':members[_0xd462c3][_0x3bab('0x2b')]||_0x1ba60d['type'],'data2':members[_0xd462c3][_0x3bab('0x6')]||_0x1ba60d[_0x3bab('0x2c')],'data3':members[_0xd462c3][_0x3bab('0x2d')]||_0x1ba60d[_0x3bab('0x2e')],'uniqueid':members[_0xd462c3][_0x3bab('0x14')]||_0x1ba60d[_0x3bab('0x14')]});utils[_0x3bab('0x4')](util[_0x3bab('0x12')](_0x3bab('0x2f'),_0x1ba60d[_0x3bab('0x14')],members[_0xd462c3][_0x3bab('0x2b')],members[_0xd462c3][_0x3bab('0x6')],members[_0xd462c3][_0x3bab('0x2d')]));if(members[_0xd462c3][_0x3bab('0x20')]){writeDB(members[_0xd462c3]);}}}}catch(_0x1ace0c){utils[_0x3bab('0x11')](util['format'](_0x3bab('0x2a'),_0x1ba60d[_0x3bab('0x14')]),_0x1ace0c);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2ffa117..c9db697 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 _0x4ab7=['secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','CONTINUE','queuecallerexitAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','name','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transfereelinkedid','clone','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s'];(function(_0x4f4f31,_0x5cadd0){var _0x5ba659=function(_0x2bceae){while(--_0x2bceae){_0x4f4f31['push'](_0x4f4f31['shift']());}};_0x5ba659(++_0x5cadd0);}(_0x4ab7,0x144));var _0x74ab=function(_0x5c5779,_0x44844f){_0x5c5779=_0x5c5779-0x0;var _0x1bd28e=_0x4ab7[_0x5c5779];return _0x1bd28e;};'use strict';var _=require('lodash');var util=require(_0x74ab('0x0'));var utils=require(_0x74ab('0x1'));var queues={};function writeDB(_0x383afa){utils[_0x74ab('0x2')](util[_0x74ab('0x3')](_0x74ab('0x4'),_0x383afa[_0x74ab('0x5')],_0x383afa[_0x74ab('0x6')],_0x383afa['queue'],_0x383afa[_0x74ab('0x7')],_0x383afa[_0x74ab('0x8')],_0x383afa[_0x74ab('0x9')],_0x383afa[_0x74ab('0xa')]));if(_0x383afa[_0x74ab('0xb')]){utils['getVoiceQueueByName'](_0x383afa[_0x74ab('0xb')])[_0x74ab('0xc')](function(_0x3665e1){if(_0x3665e1){_0x383afa[_0x74ab('0xd')]=_0x3665e1[_0x74ab('0xd')];}utils[_0x74ab('0xe')](_0x74ab('0xf'),_0x383afa);});}else{utils[_0x74ab('0xe')]('CreateVoiceQueueReport',_0x383afa);}if(_0x383afa[_0x74ab('0x10')]){delete queues[_0x383afa[_0x74ab('0x10')]];}else{delete queues[_0x383afa['uniqueid']];}}exports[_0x74ab('0x11')]=function(_0x5e975b){try{utils['debug'](util['format']('[%s][queues][queuecallerjoin]',_0x5e975b['uniqueid']),_0x5e975b);utils[_0x74ab('0x2')](util['format'](_0x74ab('0x12'),_0x5e975b[_0x74ab('0x5')],_0x5e975b[_0x74ab('0xb')],_0x5e975b[_0x74ab('0x13')]));queues[_0x5e975b[_0x74ab('0x5')]]=_[_0x74ab('0x14')](_0x5e975b,{'originalposition':_0x5e975b[_0x74ab('0x13')],'queuecallerjoinAt':utils[_0x74ab('0x15')](),'mohtime':0x0});}catch(_0x4b3c0a){utils[_0x74ab('0x16')](util['format']('[%s][queues][queuecallerjoin]',_0x5e975b['uniqueid']),_0x4b3c0a);}};exports[_0x74ab('0x17')]=function(_0x230961){try{if(!_['isNil'](queues[_0x230961[_0x74ab('0x5')]])){utils[_0x74ab('0x18')](util[_0x74ab('0x3')](_0x74ab('0x19'),_0x230961['uniqueid']),_0x230961);if(queues[_0x230961['uniqueid']][_0x74ab('0x1a')]){if(!queues[_0x230961[_0x74ab('0x5')]][_0x74ab('0x1b')]&&!queues[_0x230961[_0x74ab('0x5')]][_0x74ab('0x1c')]){queues[_0x230961[_0x74ab('0x5')]][_0x74ab('0x1d')]=!![];queues[_0x230961[_0x74ab('0x5')]][_0x74ab('0x1e')]=utils[_0x74ab('0x15')]();queues[_0x230961[_0x74ab('0x5')]]['queuecallerexitreason']=_0x74ab('0x1f');}utils[_0x74ab('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x230961[_0x74ab('0x5')],queues[_0x230961[_0x74ab('0x5')]]['name'],queues[_0x230961[_0x74ab('0x5')]][_0x74ab('0xa')]));writeDB(queues[_0x230961['uniqueid']]);}else if(queues[_0x230961[_0x74ab('0x5')]][_0x74ab('0x10')]){utils[_0x74ab('0x2')](util[_0x74ab('0x3')](_0x74ab('0x20'),_0x230961[_0x74ab('0x5')],queues[_0x230961[_0x74ab('0x5')]]['name'],queues[_0x230961[_0x74ab('0x5')]][_0x74ab('0x10')]));queues[queues[_0x230961[_0x74ab('0x5')]][_0x74ab('0x10')]]=queues[_0x230961[_0x74ab('0x5')]];queues[queues[_0x230961['uniqueid']][_0x74ab('0x10')]][_0x74ab('0x21')]=0x2;delete queues[_0x230961['uniqueid']];}}}catch(_0x254f76){utils[_0x74ab('0x16')](util[_0x74ab('0x3')](_0x74ab('0x19'),_0x230961[_0x74ab('0x5')]),_0x254f76);}};exports[_0x74ab('0x22')]=function(_0x149b09){try{utils['debug'](util[_0x74ab('0x3')](_0x74ab('0x23'),_0x149b09[_0x74ab('0x5')]),_0x149b09);if(!_[_0x74ab('0x24')](_0x149b09[_0x74ab('0x25')][_0x74ab('0x26')])&&_0x149b09['value']['toUpperCase']()!==_0x74ab('0x27')){if(!_['isNil'](queues[_0x149b09[_0x74ab('0x5')]])){queues[_0x149b09[_0x74ab('0x5')]][_0x74ab('0x1b')]=![];queues[_0x149b09['uniqueid']]['queuecallerabandonAt']=null;queues[_0x149b09[_0x74ab('0x5')]][_0x74ab('0x1c')]=!![];queues[_0x149b09[_0x74ab('0x5')]][_0x74ab('0x28')]=utils[_0x74ab('0x15')]();queues[_0x149b09['uniqueid']]['queuecallerexitreason']=_0x149b09[_0x74ab('0x29')][_0x74ab('0x2a')]();utils[_0x74ab('0x2')](util[_0x74ab('0x3')](_0x74ab('0x2b'),_0x149b09[_0x74ab('0x5')],queues[_0x149b09['uniqueid']]['name'],_0x149b09['value'],queues[_0x149b09['uniqueid']][_0x74ab('0xa')]));writeDB(queues[_0x149b09[_0x74ab('0x5')]]);}}else if(!_['isNil'](_0x149b09[_0x74ab('0x25')][_0x74ab('0x2c')])){if(!_['isNil'](queues[_0x149b09[_0x74ab('0x5')]])&&!queues[_0x149b09[_0x74ab('0x5')]][_0x74ab('0x1b')]){queues[_0x149b09[_0x74ab('0x5')]][_0x74ab('0x1b')]=![];queues[_0x149b09[_0x74ab('0x5')]][_0x74ab('0x2d')]=null;queues[_0x149b09[_0x74ab('0x5')]]['queuecallerexit']=!![];queues[_0x149b09[_0x74ab('0x5')]][_0x74ab('0x28')]=utils['now']();queues[_0x149b09[_0x74ab('0x5')]][_0x74ab('0xa')]='EXITWITHKEY';utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x149b09['uniqueid'],queues[_0x149b09[_0x74ab('0x5')]][_0x74ab('0x2e')],_0x149b09[_0x74ab('0x29')],queues[_0x149b09['uniqueid']][_0x74ab('0xa')]));}}}catch(_0x11b276){utils[_0x74ab('0x16')](util['format'](_0x74ab('0x23'),_0x149b09[_0x74ab('0x5')]),_0x11b276);}};exports[_0x74ab('0x1b')]=function(_0x54a076){try{if(!_[_0x74ab('0x24')](queues[_0x54a076[_0x74ab('0x5')]])){utils['debug'](util[_0x74ab('0x3')]('[%s][queues][queuecallerabandon]',_0x54a076[_0x74ab('0x5')]),_0x54a076);queues[_0x54a076[_0x74ab('0x5')]][_0x74ab('0x1c')]=![];queues[_0x54a076['uniqueid']]['queuecallerexitAt']=null;queues[_0x54a076['uniqueid']][_0x74ab('0x1b')]=!![];queues[_0x54a076[_0x74ab('0x5')]][_0x74ab('0x2d')]=utils[_0x74ab('0x15')]();queues[_0x54a076[_0x74ab('0x5')]][_0x74ab('0xa')]='ABANDONED';utils[_0x74ab('0x2')](util['format'](_0x74ab('0x2f'),_0x54a076[_0x74ab('0x5')],queues[_0x54a076[_0x74ab('0x5')]]['name'],queues[_0x54a076[_0x74ab('0x5')]][_0x74ab('0xa')]));}}catch(_0x5d0d68){utils[_0x74ab('0x16')](util[_0x74ab('0x3')](_0x74ab('0x30'),_0x54a076['uniqueid']),_0x5d0d68);}};exports['queuecallerleave']=function(_0x29e38f){try{if(!_[_0x74ab('0x24')](queues[_0x29e38f[_0x74ab('0x5')]])){utils[_0x74ab('0x18')](util['format'](_0x74ab('0x31'),_0x29e38f['uniqueid']),_0x29e38f);utils[_0x74ab('0x2')](util[_0x74ab('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x29e38f[_0x74ab('0x5')],queues[_0x29e38f[_0x74ab('0x5')]][_0x74ab('0x2e')],_0x29e38f[_0x74ab('0x32')],_0x29e38f[_0x74ab('0x33')]));queues[_0x29e38f[_0x74ab('0x5')]][_0x74ab('0x34')]=!![];queues[_0x29e38f['uniqueid']][_0x74ab('0x1a')]=utils['now']();queues[_0x29e38f['uniqueid']][_0x74ab('0x35')]=utils[_0x74ab('0x36')](queues[_0x29e38f['uniqueid']][_0x74ab('0x1a')],queues[_0x29e38f['uniqueid']]['queuecallerjoinAt']);queues[_0x29e38f['uniqueid']]['position']=_0x29e38f['position'];queues[_0x29e38f['uniqueid']][_0x74ab('0x37')]=_0x29e38f[_0x74ab('0x37')];queues[_0x29e38f[_0x74ab('0x5')]][_0x74ab('0x32')]=_0x29e38f['connectedlinenum'];queues[_0x29e38f[_0x74ab('0x5')]][_0x74ab('0x33')]=_0x29e38f['connectedlinename'];}}catch(_0xfc7d1a){utils['error'](util[_0x74ab('0x3')](_0x74ab('0x31'),_0x29e38f['uniqueid']),_0xfc7d1a);}};exports[_0x74ab('0x38')]=function(_0x5c8033){try{if(!_[_0x74ab('0x24')](queues[_0x5c8033[_0x74ab('0x5')]])){utils[_0x74ab('0x18')](util[_0x74ab('0x3')](_0x74ab('0x39'),_0x5c8033[_0x74ab('0x5')]),_0x5c8033);utils[_0x74ab('0x2')](util[_0x74ab('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5c8033[_0x74ab('0x5')],queues[_0x5c8033[_0x74ab('0x5')]][_0x74ab('0x2e')],_0x5c8033[_0x74ab('0x3a')],_0x5c8033[_0x74ab('0x3b')]));queues[_0x5c8033[_0x74ab('0x5')]][_0x74ab('0x1b')]=![];queues[_0x5c8033[_0x74ab('0x5')]][_0x74ab('0x1b')]=![];queues[_0x5c8033[_0x74ab('0x5')]]['queuecallerabandonAt']=null;queues[_0x5c8033[_0x74ab('0x5')]][_0x74ab('0x1c')]=![];queues[_0x5c8033['uniqueid']][_0x74ab('0xa')]=null;queues[_0x5c8033[_0x74ab('0x5')]][_0x74ab('0x28')]=null;queues[_0x5c8033[_0x74ab('0x5')]][_0x74ab('0x3c')]=!![];queues[_0x5c8033[_0x74ab('0x5')]]['accountcode']=_0x5c8033[_0x74ab('0x3b')];queues[_0x5c8033[_0x74ab('0x5')]][_0x74ab('0x7')]=_0x5c8033[_0x74ab('0x3a')];}}catch(_0x467973){utils[_0x74ab('0x16')](util[_0x74ab('0x3')](_0x74ab('0x39'),_0x5c8033[_0x74ab('0x5')]),_0x467973);}};exports['agentcomplete']=function(_0x5de418){try{if(!_[_0x74ab('0x24')](queues[_0x5de418[_0x74ab('0x5')]])){if(queues[_0x5de418['uniqueid']]['queuecallerleaveAt']){utils[_0x74ab('0x18')](util[_0x74ab('0x3')](_0x74ab('0x3d'),_0x5de418[_0x74ab('0x5')]),_0x5de418);queues[_0x5de418[_0x74ab('0x5')]][_0x74ab('0x1b')]=![];queues[_0x5de418['uniqueid']][_0x74ab('0x1b')]=![];queues[_0x5de418[_0x74ab('0x5')]][_0x74ab('0x2d')]=null;queues[_0x5de418['uniqueid']][_0x74ab('0x1c')]=![];queues[_0x5de418[_0x74ab('0x5')]][_0x74ab('0x28')]=null;queues[_0x5de418[_0x74ab('0x5')]]['assigned']=!![];queues[_0x5de418[_0x74ab('0x5')]][_0x74ab('0x7')]=_0x5de418[_0x74ab('0x3a')];queues[_0x5de418[_0x74ab('0x5')]][_0x74ab('0x1d')]=!![];queues[_0x5de418['uniqueid']][_0x74ab('0x1e')]=utils[_0x74ab('0x15')]();if(_0x5de418[_0x74ab('0x3e')]=='transfer'){if(!queues[_0x5de418[_0x74ab('0x5')]][_0x74ab('0x3f')]){queues[_0x5de418['uniqueid']][_0x74ab('0xa')]=_0x74ab('0x40');}}else{queues[_0x5de418[_0x74ab('0x5')]]['queuecallerexitreason']=_0x74ab('0x41')+_0x5de418[_0x74ab('0x3e')][_0x74ab('0x2a')]();}utils[_0x74ab('0x2')](util['format'](_0x74ab('0x42'),_0x5de418[_0x74ab('0x5')],queues[_0x5de418[_0x74ab('0x5')]][_0x74ab('0x2e')],_0x5de418[_0x74ab('0x3a')],queues[_0x5de418[_0x74ab('0x5')]][_0x74ab('0xa')]));writeDB(queues[_0x5de418[_0x74ab('0x5')]]);}}}catch(_0x1b5789){utils['error'](util['format'](_0x74ab('0x3d'),_0x5de418[_0x74ab('0x5')]),_0x1b5789);}};exports[_0x74ab('0x43')]=function(_0x3189f1){try{if(!_[_0x74ab('0x24')](queues[_0x3189f1['transfereeuniqueid']])){utils['debug'](util['format'](_0x74ab('0x44'),_0x3189f1['uniqueid']),_0x3189f1);queues[_0x3189f1[_0x74ab('0x45')]][_0x74ab('0x3f')]=!![];queues[_0x3189f1[_0x74ab('0x45')]][_0x74ab('0x46')]=_0x74ab('0x47');queues[_0x3189f1[_0x74ab('0x45')]][_0x74ab('0x48')]=_0x3189f1[_0x74ab('0x49')];queues[_0x3189f1[_0x74ab('0x45')]][_0x74ab('0x4a')]=_0x3189f1[_0x74ab('0x45')];queues[_0x3189f1[_0x74ab('0x45')]]['queuecallerexitreason']=_0x74ab('0x4b');utils[_0x74ab('0x2')](util[_0x74ab('0x3')](_0x74ab('0x4c'),_0x3189f1[_0x74ab('0x5')],queues[_0x3189f1[_0x74ab('0x45')]][_0x74ab('0x2e')],_0x3189f1[_0x74ab('0x45')],_0x3189f1[_0x74ab('0x49')]));}}catch(_0x4cc21e){utils['error'](util[_0x74ab('0x3')](_0x74ab('0x44'),_0x3189f1[_0x74ab('0x5')]),_0x4cc21e);}};exports[_0x74ab('0x4d')]=function(_0x52628e){try{utils[_0x74ab('0x18')](util['format'](_0x74ab('0x4e'),_0x52628e['origtransfereruniqueid']),_0x52628e);if(_0x52628e[_0x74ab('0x4f')]==_0x52628e[_0x74ab('0x50')]){if(!_[_0x74ab('0x24')](queues[_0x52628e['secondtransfererlinkedid']])){utils[_0x74ab('0x2')](util[_0x74ab('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x52628e['origtransfereruniqueid'],queues[_0x52628e[_0x74ab('0x51')]][_0x74ab('0x2e')],_0x52628e[_0x74ab('0x52')]));queues[_0x52628e['secondtransfererlinkedid']][_0x74ab('0x3f')]=!![];queues[_0x52628e[_0x74ab('0x51')]]['transfertype']=_0x74ab('0x53');queues[_0x52628e['secondtransfererlinkedid']][_0x74ab('0x48')]=_0x52628e[_0x74ab('0x52')];queues[_0x52628e[_0x74ab('0x51')]][_0x74ab('0x4a')]=_0x52628e[_0x74ab('0x4f')];queues[_0x52628e['secondtransfererlinkedid']][_0x74ab('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x74ab('0x24')](queues[_0x52628e['origtransfererlinkedid']])){if(_0x52628e[_0x74ab('0x54')]&&queues[_0x52628e[_0x74ab('0x54')]]){queues[_0x52628e[_0x74ab('0x54')]][_0x74ab('0x21')]=0x1;queues[_0x52628e['transfereeuniqueid']]=_[_0x74ab('0x55')](queues[_0x52628e['transfereelinkedid']]);queues[_0x52628e[_0x74ab('0x45')]][_0x74ab('0x10')]=_0x52628e['transfertargetuniqueid'];queues[_0x52628e[_0x74ab('0x45')]][_0x74ab('0x21')]=0x2;queues[_0x52628e[_0x74ab('0x45')]][_0x74ab('0x8')]=queues[_0x52628e[_0x74ab('0x51')]]['calleridnum'];queues[_0x52628e[_0x74ab('0x45')]][_0x74ab('0x56')]=queues[_0x52628e['secondtransfererlinkedid']][_0x74ab('0x56')];queues[_0x52628e[_0x74ab('0x45')]]['queuecallerjoinAt']=utils[_0x74ab('0x15')]();queues[_0x52628e['transfereeuniqueid']][_0x74ab('0x1a')]=utils['now']();queues[_0x52628e['transfereeuniqueid']][_0x74ab('0x35')]=0x0;queues[_0x52628e[_0x74ab('0x45')]]['mohtime']=0x0;utils[_0x74ab('0x2')](util['format'](_0x74ab('0x57'),_0x52628e['origtransfereruniqueid'],queues[_0x52628e['transfereeuniqueid']][_0x74ab('0x2e')],queues[_0x52628e['transfereeuniqueid']][_0x74ab('0x8')],queues[_0x52628e['transfereeuniqueid']][_0x74ab('0x56')]));}else{utils['info'](util[_0x74ab('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x52628e['origtransfereruniqueid'],queues[_0x52628e[_0x74ab('0x50')]]['name'],_0x52628e['secondtransfererlinkedid']));queues[_0x52628e[_0x74ab('0x50')]][_0x74ab('0x10')]=_0x52628e[_0x74ab('0x51')];}}}else if(_0x52628e[_0x74ab('0x58')]==_0x52628e['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x52628e[_0x74ab('0x50')]])){utils[_0x74ab('0x2')](util[_0x74ab('0x3')](_0x74ab('0x59'),_0x52628e[_0x74ab('0x4f')],queues[_0x52628e[_0x74ab('0x50')]][_0x74ab('0x2e')],_0x52628e['secondtransfereruniqueid'],_0x52628e[_0x74ab('0x5a')]));queues[_0x52628e['origtransfererlinkedid']]['transfer']=!![];queues[_0x52628e['origtransfererlinkedid']][_0x74ab('0x46')]=_0x74ab('0x53');queues[_0x52628e['origtransfererlinkedid']][_0x74ab('0x48')]=_0x52628e[_0x74ab('0x5a')];queues[_0x52628e[_0x74ab('0x50')]][_0x74ab('0x4a')]=_0x52628e['secondtransfereruniqueid'];queues[_0x52628e[_0x74ab('0x50')]][_0x74ab('0xa')]=_0x74ab('0x5b');}if(!_['isNil'](queues[_0x52628e[_0x74ab('0x51')]])){if(_0x52628e['transfertargetlinkedid']&&queues[_0x52628e[_0x74ab('0x5c')]]){queues[_0x52628e[_0x74ab('0x5c')]][_0x74ab('0x21')]=0x1;queues[_0x52628e[_0x74ab('0x5d')]]=_[_0x74ab('0x55')](queues[_0x52628e['transfertargetlinkedid']]);queues[_0x52628e[_0x74ab('0x5d')]][_0x74ab('0x10')]=_0x52628e[_0x74ab('0x5d')];queues[_0x52628e[_0x74ab('0x5d')]][_0x74ab('0x21')]=0x2;queues[_0x52628e[_0x74ab('0x5d')]][_0x74ab('0x8')]=queues[_0x52628e[_0x74ab('0x50')]][_0x74ab('0x8')];queues[_0x52628e['transfertargetuniqueid']][_0x74ab('0x56')]=queues[_0x52628e[_0x74ab('0x50')]]['calleridname'];queues[_0x52628e[_0x74ab('0x5d')]][_0x74ab('0x5e')]=utils['now']();queues[_0x52628e['transfertargetuniqueid']][_0x74ab('0x1a')]=utils[_0x74ab('0x15')]();queues[_0x52628e[_0x74ab('0x5d')]][_0x74ab('0x35')]=0x0;queues[_0x52628e[_0x74ab('0x5d')]][_0x74ab('0x5f')]=0x0;utils[_0x74ab('0x2')](util[_0x74ab('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x52628e[_0x74ab('0x4f')],queues[_0x52628e[_0x74ab('0x5d')]][_0x74ab('0x2e')],queues[_0x52628e[_0x74ab('0x5d')]][_0x74ab('0x10')],queues[_0x52628e[_0x74ab('0x5d')]][_0x74ab('0x8')],queues[_0x52628e[_0x74ab('0x5d')]][_0x74ab('0x56')]));}else{utils[_0x74ab('0x2')](util[_0x74ab('0x3')](_0x74ab('0x60'),_0x52628e[_0x74ab('0x4f')],queues[_0x52628e[_0x74ab('0x51')]][_0x74ab('0x2e')],_0x52628e[_0x74ab('0x50')]));queues[_0x52628e[_0x74ab('0x51')]]['transfereduniqueid']=_0x52628e[_0x74ab('0x50')];}}}}catch(_0x10ae15){utils[_0x74ab('0x16')](util['format'](_0x74ab('0x4e'),_0x52628e['origtransfereruniqueid']),_0x10ae15);}};exports[_0x74ab('0x61')]=function(_0x4475eb){try{if(!_[_0x74ab('0x24')](queues[_0x4475eb[_0x74ab('0x5')]])){utils[_0x74ab('0x18')](util[_0x74ab('0x3')](_0x74ab('0x62'),_0x4475eb[_0x74ab('0x5')]),_0x4475eb);queues[_0x4475eb[_0x74ab('0x5')]][_0x74ab('0x63')]=utils['now']();utils[_0x74ab('0x2')](util[_0x74ab('0x3')](_0x74ab('0x64'),_0x4475eb[_0x74ab('0x5')],queues[_0x4475eb['uniqueid']][_0x74ab('0x2e')],queues[_0x4475eb['uniqueid']][_0x74ab('0x63')]));}}catch(_0x2cbc6f){utils[_0x74ab('0x16')](util[_0x74ab('0x3')](_0x74ab('0x62'),_0x4475eb[_0x74ab('0x5')]),_0x2cbc6f);}};exports[_0x74ab('0x65')]=function(_0x2cb852){try{if(!_[_0x74ab('0x24')](queues[_0x2cb852[_0x74ab('0x5')]])){if(!_[_0x74ab('0x24')](queues[_0x2cb852[_0x74ab('0x5')]][_0x74ab('0x63')])){utils[_0x74ab('0x18')](util[_0x74ab('0x3')](_0x74ab('0x66'),_0x2cb852[_0x74ab('0x5')]),_0x2cb852);queues[_0x2cb852[_0x74ab('0x5')]][_0x74ab('0x5f')]+=utils[_0x74ab('0x36')](utils['now'](),queues[_0x2cb852[_0x74ab('0x5')]][_0x74ab('0x63')]);utils[_0x74ab('0x2')](util[_0x74ab('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x2cb852[_0x74ab('0x5')],queues[_0x2cb852['uniqueid']]['name'],queues[_0x2cb852['uniqueid']]['mohtime']));delete queues[_0x2cb852[_0x74ab('0x5')]]['musiconholdstartAt'];}}}catch(_0x310677){utils['error'](util[_0x74ab('0x3')]('[%s][queues][musiconholdstop]',_0x2cb852[_0x74ab('0x5')]),_0x310677);}}; \ No newline at end of file +var _0x7d3b=['[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','transferuniqueid','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','diffTime','lodash','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','destaccountcode','assigned','membername'];(function(_0x59f7b8,_0x1ad270){var _0x4fa326=function(_0x374665){while(--_0x374665){_0x59f7b8['push'](_0x59f7b8['shift']());}};_0x4fa326(++_0x1ad270);}(_0x7d3b,0x1b4));var _0xb7d3=function(_0x149569,_0x1d67a9){_0x149569=_0x149569-0x0;var _0x461c0d=_0x7d3b[_0x149569];return _0x461c0d;};'use strict';var _=require(_0xb7d3('0x0'));var util=require(_0xb7d3('0x1'));var utils=require(_0xb7d3('0x2'));var queues={};function writeDB(_0x3f2a74){utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x3f2a74[_0xb7d3('0x5')],_0x3f2a74[_0xb7d3('0x6')],_0x3f2a74[_0xb7d3('0x7')],_0x3f2a74[_0xb7d3('0x8')],_0x3f2a74['calleridnum'],_0x3f2a74[_0xb7d3('0x9')],_0x3f2a74[_0xb7d3('0xa')]));if(_0x3f2a74[_0xb7d3('0x7')]){utils['getVoiceQueueByName'](_0x3f2a74[_0xb7d3('0x7')])['then'](function(_0x2707dc){if(_0x2707dc){_0x3f2a74['type']=_0x2707dc['type'];}utils[_0xb7d3('0xb')](_0xb7d3('0xc'),_0x3f2a74);});}else{utils['request'](_0xb7d3('0xc'),_0x3f2a74);}if(_0x3f2a74[_0xb7d3('0xd')]){delete queues[_0x3f2a74[_0xb7d3('0xd')]];}else{delete queues[_0x3f2a74[_0xb7d3('0x5')]];}}exports[_0xb7d3('0xe')]=function(_0x33af50){try{utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')](_0xb7d3('0x10'),_0x33af50[_0xb7d3('0x5')]),_0x33af50);utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x11'),_0x33af50[_0xb7d3('0x5')],_0x33af50[_0xb7d3('0x7')],_0x33af50[_0xb7d3('0x12')]));queues[_0x33af50[_0xb7d3('0x5')]]=_[_0xb7d3('0x13')](_0x33af50,{'originalposition':_0x33af50[_0xb7d3('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4caf59){utils[_0xb7d3('0x14')](util['format'](_0xb7d3('0x10'),_0x33af50[_0xb7d3('0x5')]),_0x4caf59);}};exports[_0xb7d3('0x15')]=function(_0x3986e0){try{if(!_[_0xb7d3('0x16')](queues[_0x3986e0[_0xb7d3('0x5')]])){utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')](_0xb7d3('0x17'),_0x3986e0[_0xb7d3('0x5')]),_0x3986e0);if(queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0x18')]){if(!queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0x19')]&&!queues[_0x3986e0['uniqueid']][_0xb7d3('0x1a')]){queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0x1b')]=!![];queues[_0x3986e0[_0xb7d3('0x5')]]['queuecallercompleteAt']=utils[_0xb7d3('0x1c')]();queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0xa')]=_0xb7d3('0x1d');}utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x3986e0[_0xb7d3('0x5')],queues[_0x3986e0['uniqueid']]['name'],queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0xa')]));writeDB(queues[_0x3986e0[_0xb7d3('0x5')]]);}else if(queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0xd')]){utils['info'](util[_0xb7d3('0x4')](_0xb7d3('0x1e'),_0x3986e0[_0xb7d3('0x5')],queues[_0x3986e0['uniqueid']][_0xb7d3('0x1f')],queues[_0x3986e0['uniqueid']][_0xb7d3('0xd')]));queues[queues[_0x3986e0[_0xb7d3('0x5')]][_0xb7d3('0xd')]]=queues[_0x3986e0[_0xb7d3('0x5')]];queues[queues[_0x3986e0['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x3986e0[_0xb7d3('0x5')]];}}}catch(_0x27a679){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')]('[%s][queues][hangup]',_0x3986e0['uniqueid']),_0x27a679);}};exports[_0xb7d3('0x20')]=function(_0x19e96e){try{utils[_0xb7d3('0xf')](util['format'](_0xb7d3('0x21'),_0x19e96e[_0xb7d3('0x5')]),_0x19e96e);if(!_[_0xb7d3('0x16')](_0x19e96e['variable'][_0xb7d3('0x22')])&&_0x19e96e[_0xb7d3('0x23')][_0xb7d3('0x24')]()!==_0xb7d3('0x25')){if(!_[_0xb7d3('0x16')](queues[_0x19e96e['uniqueid']])){queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0x19')]=![];queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0x26')]=null;queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0x1a')]=!![];queues[_0x19e96e['uniqueid']]['queuecallerexitAt']=utils[_0xb7d3('0x1c')]();queues[_0x19e96e[_0xb7d3('0x5')]]['queuecallerexitreason']=_0x19e96e[_0xb7d3('0x23')][_0xb7d3('0x24')]();utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x27'),_0x19e96e[_0xb7d3('0x5')],queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0x1f')],_0x19e96e[_0xb7d3('0x23')],queues[_0x19e96e['uniqueid']][_0xb7d3('0xa')]));writeDB(queues[_0x19e96e[_0xb7d3('0x5')]]);}}else if(!_[_0xb7d3('0x16')](_0x19e96e[_0xb7d3('0x28')][_0xb7d3('0x29')])){if(!_[_0xb7d3('0x16')](queues[_0x19e96e['uniqueid']])&&!queues[_0x19e96e['uniqueid']][_0xb7d3('0x19')]){queues[_0x19e96e['uniqueid']][_0xb7d3('0x19')]=![];queues[_0x19e96e[_0xb7d3('0x5')]]['queuecallerabandonAt']=null;queues[_0x19e96e['uniqueid']]['queuecallerexit']=!![];queues[_0x19e96e['uniqueid']][_0xb7d3('0x2a')]=utils[_0xb7d3('0x1c')]();queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0xa')]=_0xb7d3('0x2b');utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x2c'),_0x19e96e[_0xb7d3('0x5')],queues[_0x19e96e[_0xb7d3('0x5')]]['name'],_0x19e96e[_0xb7d3('0x23')],queues[_0x19e96e[_0xb7d3('0x5')]][_0xb7d3('0xa')]));}}}catch(_0x1eb8d5){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')]('[%s][queues][varset]',_0x19e96e[_0xb7d3('0x5')]),_0x1eb8d5);}};exports[_0xb7d3('0x19')]=function(_0x41f376){try{if(!_[_0xb7d3('0x16')](queues[_0x41f376['uniqueid']])){utils['debug'](util[_0xb7d3('0x4')](_0xb7d3('0x2d'),_0x41f376[_0xb7d3('0x5')]),_0x41f376);queues[_0x41f376[_0xb7d3('0x5')]][_0xb7d3('0x1a')]=![];queues[_0x41f376['uniqueid']][_0xb7d3('0x2a')]=null;queues[_0x41f376['uniqueid']]['queuecallerabandon']=!![];queues[_0x41f376['uniqueid']][_0xb7d3('0x26')]=utils[_0xb7d3('0x1c')]();queues[_0x41f376[_0xb7d3('0x5')]][_0xb7d3('0xa')]=_0xb7d3('0x2e');utils[_0xb7d3('0x3')](util['format'](_0xb7d3('0x2f'),_0x41f376[_0xb7d3('0x5')],queues[_0x41f376[_0xb7d3('0x5')]][_0xb7d3('0x1f')],queues[_0x41f376[_0xb7d3('0x5')]]['queuecallerexitreason']));}}catch(_0x1f2ba7){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')](_0xb7d3('0x2d'),_0x41f376[_0xb7d3('0x5')]),_0x1f2ba7);}};exports['queuecallerleave']=function(_0x149ccf){try{if(!_[_0xb7d3('0x16')](queues[_0x149ccf[_0xb7d3('0x5')]])){utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')]('[%s][queues][queuecallerleave]',_0x149ccf[_0xb7d3('0x5')]),_0x149ccf);utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x30'),_0x149ccf[_0xb7d3('0x5')],queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x1f')],_0x149ccf[_0xb7d3('0x31')],_0x149ccf[_0xb7d3('0x32')]));queues[_0x149ccf['uniqueid']]['queuecallerleave']=!![];queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x18')]=utils[_0xb7d3('0x1c')]();queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x33')]=utils['diffTime'](queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x18')],queues[_0x149ccf['uniqueid']]['queuecallerjoinAt']);queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x12')]=_0x149ccf[_0xb7d3('0x12')];queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x34')]=_0x149ccf['count'];queues[_0x149ccf[_0xb7d3('0x5')]][_0xb7d3('0x31')]=_0x149ccf[_0xb7d3('0x31')];queues[_0x149ccf[_0xb7d3('0x5')]]['connectedlinename']=_0x149ccf[_0xb7d3('0x32')];}}catch(_0x1c7fe1){utils['error'](util[_0xb7d3('0x4')](_0xb7d3('0x35'),_0x149ccf[_0xb7d3('0x5')]),_0x1c7fe1);}};exports[_0xb7d3('0x36')]=function(_0x37a6db){try{if(!_[_0xb7d3('0x16')](queues[_0x37a6db[_0xb7d3('0x5')]])){utils['debug'](util[_0xb7d3('0x4')](_0xb7d3('0x37'),_0x37a6db[_0xb7d3('0x5')]),_0x37a6db);utils[_0xb7d3('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x37a6db[_0xb7d3('0x5')],queues[_0x37a6db[_0xb7d3('0x5')]]['name'],_0x37a6db['membername'],_0x37a6db[_0xb7d3('0x38')]));queues[_0x37a6db['uniqueid']][_0xb7d3('0x19')]=![];queues[_0x37a6db[_0xb7d3('0x5')]][_0xb7d3('0x19')]=![];queues[_0x37a6db[_0xb7d3('0x5')]]['queuecallerabandonAt']=null;queues[_0x37a6db[_0xb7d3('0x5')]]['queuecallerexit']=![];queues[_0x37a6db[_0xb7d3('0x5')]][_0xb7d3('0xa')]=null;queues[_0x37a6db[_0xb7d3('0x5')]][_0xb7d3('0x2a')]=null;queues[_0x37a6db['uniqueid']][_0xb7d3('0x39')]=!![];queues[_0x37a6db[_0xb7d3('0x5')]][_0xb7d3('0x9')]=_0x37a6db[_0xb7d3('0x38')];queues[_0x37a6db[_0xb7d3('0x5')]][_0xb7d3('0x8')]=_0x37a6db[_0xb7d3('0x3a')];}}catch(_0x453115){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')](_0xb7d3('0x37'),_0x37a6db['uniqueid']),_0x453115);}};exports['agentcomplete']=function(_0x5813c4){try{if(!_['isNil'](queues[_0x5813c4['uniqueid']])){if(queues[_0x5813c4['uniqueid']][_0xb7d3('0x18')]){utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')](_0xb7d3('0x3b'),_0x5813c4['uniqueid']),_0x5813c4);queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x19')]=![];queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x19')]=![];queues[_0x5813c4['uniqueid']][_0xb7d3('0x26')]=null;queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x1a')]=![];queues[_0x5813c4['uniqueid']][_0xb7d3('0x2a')]=null;queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x39')]=!![];queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x8')]=_0x5813c4[_0xb7d3('0x3a')];queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x1b')]=!![];queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x3c')]=utils['now']();if(_0x5813c4[_0xb7d3('0x3d')]==_0xb7d3('0x3e')){if(!queues[_0x5813c4[_0xb7d3('0x5')]]['transfer']){queues[_0x5813c4['uniqueid']]['queuecallerexitreason']=_0xb7d3('0x3f');}}else{queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0xa')]='COMPLETEDBY'+_0x5813c4['reason'][_0xb7d3('0x24')]();}utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x40'),_0x5813c4[_0xb7d3('0x5')],queues[_0x5813c4[_0xb7d3('0x5')]][_0xb7d3('0x1f')],_0x5813c4[_0xb7d3('0x3a')],queues[_0x5813c4[_0xb7d3('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x5813c4[_0xb7d3('0x5')]]);}}}catch(_0x48087c){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')](_0xb7d3('0x3b'),_0x5813c4['uniqueid']),_0x48087c);}};exports['blindtransfer']=function(_0x1208ad){try{if(!_['isNil'](queues[_0x1208ad[_0xb7d3('0x41')]])){utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')]('[%s][queues][blindtransfer]',_0x1208ad[_0xb7d3('0x5')]),_0x1208ad);queues[_0x1208ad[_0xb7d3('0x41')]][_0xb7d3('0x3e')]=!![];queues[_0x1208ad[_0xb7d3('0x41')]][_0xb7d3('0x42')]=_0xb7d3('0x43');queues[_0x1208ad['transfereeuniqueid']]['transferexten']=_0x1208ad['extension'];queues[_0x1208ad[_0xb7d3('0x41')]]['transferuniqueid']=_0x1208ad[_0xb7d3('0x41')];queues[_0x1208ad[_0xb7d3('0x41')]]['queuecallerexitreason']=_0xb7d3('0x44');utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1208ad[_0xb7d3('0x5')],queues[_0x1208ad[_0xb7d3('0x41')]]['name'],_0x1208ad['transfereeuniqueid'],_0x1208ad['extension']));}}catch(_0x6c2ef0){utils['error'](util[_0xb7d3('0x4')]('[%s][queues][blindtransfer]',_0x1208ad[_0xb7d3('0x5')]),_0x6c2ef0);}};exports[_0xb7d3('0x45')]=function(_0x4b617a){try{utils['debug'](util[_0xb7d3('0x4')](_0xb7d3('0x46'),_0x4b617a['origtransfereruniqueid']),_0x4b617a);if(_0x4b617a[_0xb7d3('0x47')]==_0x4b617a['origtransfererlinkedid']){if(!_[_0xb7d3('0x16')](queues[_0x4b617a[_0xb7d3('0x48')]])){utils['info'](util[_0xb7d3('0x4')](_0xb7d3('0x49'),_0x4b617a[_0xb7d3('0x47')],queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x1f')],_0x4b617a['origtransfererexten']));queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x3e')]=!![];queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x42')]=_0xb7d3('0x4a');queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x4b')]=_0x4b617a['origtransfererexten'];queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x4c')]=_0x4b617a[_0xb7d3('0x47')];queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0xa')]='ATTENDEDTRANSFER';}if(!_[_0xb7d3('0x16')](queues[_0x4b617a[_0xb7d3('0x4d')]])){if(_0x4b617a['transfereelinkedid']&&queues[_0x4b617a[_0xb7d3('0x4e')]]){queues[_0x4b617a[_0xb7d3('0x4e')]][_0xb7d3('0x4f')]=0x1;queues[_0x4b617a[_0xb7d3('0x41')]]=_[_0xb7d3('0x50')](queues[_0x4b617a[_0xb7d3('0x4e')]]);queues[_0x4b617a['transfereeuniqueid']][_0xb7d3('0xd')]=_0x4b617a[_0xb7d3('0x51')];queues[_0x4b617a[_0xb7d3('0x41')]][_0xb7d3('0x4f')]=0x2;queues[_0x4b617a['transfereeuniqueid']][_0xb7d3('0x52')]=queues[_0x4b617a['secondtransfererlinkedid']][_0xb7d3('0x52')];queues[_0x4b617a['transfereeuniqueid']]['calleridname']=queues[_0x4b617a['secondtransfererlinkedid']][_0xb7d3('0x53')];queues[_0x4b617a[_0xb7d3('0x41')]][_0xb7d3('0x54')]=utils['now']();queues[_0x4b617a['transfereeuniqueid']][_0xb7d3('0x18')]=utils['now']();queues[_0x4b617a[_0xb7d3('0x41')]]['holdtime']=0x0;queues[_0x4b617a[_0xb7d3('0x41')]]['mohtime']=0x0;utils[_0xb7d3('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x4b617a[_0xb7d3('0x47')],queues[_0x4b617a[_0xb7d3('0x41')]][_0xb7d3('0x1f')],queues[_0x4b617a['transfereeuniqueid']]['calleridnum'],queues[_0x4b617a['transfereeuniqueid']][_0xb7d3('0x53')]));}else{utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4b617a[_0xb7d3('0x47')],queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x1f')],_0x4b617a[_0xb7d3('0x48')]));queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0xd')]=_0x4b617a[_0xb7d3('0x48')];}}}else if(_0x4b617a[_0xb7d3('0x55')]==_0x4b617a[_0xb7d3('0x48')]){if(!_[_0xb7d3('0x16')](queues[_0x4b617a['origtransfererlinkedid']])){utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x56'),_0x4b617a[_0xb7d3('0x47')],queues[_0x4b617a['origtransfererlinkedid']][_0xb7d3('0x1f')],_0x4b617a['secondtransfereruniqueid'],_0x4b617a[_0xb7d3('0x57')]));queues[_0x4b617a[_0xb7d3('0x4d')]]['transfer']=!![];queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x42')]='ATTENDED';queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x4b')]=_0x4b617a[_0xb7d3('0x57')];queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x4c')]=_0x4b617a[_0xb7d3('0x55')];queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0xa')]=_0xb7d3('0x58');}if(!_[_0xb7d3('0x16')](queues[_0x4b617a['secondtransfererlinkedid']])){if(_0x4b617a[_0xb7d3('0x59')]&&queues[_0x4b617a['transfertargetlinkedid']]){queues[_0x4b617a[_0xb7d3('0x59')]][_0xb7d3('0x4f')]=0x1;queues[_0x4b617a[_0xb7d3('0x51')]]=_[_0xb7d3('0x50')](queues[_0x4b617a[_0xb7d3('0x59')]]);queues[_0x4b617a[_0xb7d3('0x51')]]['transfereduniqueid']=_0x4b617a['transfertargetuniqueid'];queues[_0x4b617a['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0x52')]=queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x52')];queues[_0x4b617a['transfertargetuniqueid']][_0xb7d3('0x53')]=queues[_0x4b617a[_0xb7d3('0x4d')]][_0xb7d3('0x53')];queues[_0x4b617a[_0xb7d3('0x51')]]['queuecallerjoinAt']=utils['now']();queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0x18')]=utils[_0xb7d3('0x1c')]();queues[_0x4b617a['transfertargetuniqueid']][_0xb7d3('0x33')]=0x0;queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0x5a')]=0x0;utils[_0xb7d3('0x3')](util['format'](_0xb7d3('0x5b'),_0x4b617a['origtransfereruniqueid'],queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0x1f')],queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0xd')],queues[_0x4b617a[_0xb7d3('0x51')]][_0xb7d3('0x52')],queues[_0x4b617a['transfertargetuniqueid']]['calleridname']));}else{utils[_0xb7d3('0x3')](util[_0xb7d3('0x4')](_0xb7d3('0x5c'),_0x4b617a['origtransfereruniqueid'],queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0x1f')],_0x4b617a[_0xb7d3('0x4d')]));queues[_0x4b617a[_0xb7d3('0x48')]][_0xb7d3('0xd')]=_0x4b617a['origtransfererlinkedid'];}}}}catch(_0x2c3351){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')](_0xb7d3('0x46'),_0x4b617a[_0xb7d3('0x47')]),_0x2c3351);}};exports[_0xb7d3('0x5d')]=function(_0x5317ef){try{if(!_[_0xb7d3('0x16')](queues[_0x5317ef['uniqueid']])){utils['debug'](util[_0xb7d3('0x4')]('[%s][queues][musiconholdstart]',_0x5317ef['uniqueid']),_0x5317ef);queues[_0x5317ef[_0xb7d3('0x5')]][_0xb7d3('0x5e')]=utils['now']();utils['info'](util[_0xb7d3('0x4')](_0xb7d3('0x5f'),_0x5317ef[_0xb7d3('0x5')],queues[_0x5317ef[_0xb7d3('0x5')]]['name'],queues[_0x5317ef[_0xb7d3('0x5')]][_0xb7d3('0x5e')]));}}catch(_0x154b9e){utils[_0xb7d3('0x14')](util[_0xb7d3('0x4')](_0xb7d3('0x60'),_0x5317ef[_0xb7d3('0x5')]),_0x154b9e);}};exports['musiconholdstop']=function(_0x4e5401){try{if(!_[_0xb7d3('0x16')](queues[_0x4e5401[_0xb7d3('0x5')]])){if(!_[_0xb7d3('0x16')](queues[_0x4e5401[_0xb7d3('0x5')]]['musiconholdstartAt'])){utils[_0xb7d3('0xf')](util[_0xb7d3('0x4')](_0xb7d3('0x61'),_0x4e5401['uniqueid']),_0x4e5401);queues[_0x4e5401['uniqueid']]['mohtime']+=utils[_0xb7d3('0x62')](utils[_0xb7d3('0x1c')](),queues[_0x4e5401[_0xb7d3('0x5')]][_0xb7d3('0x5e')]);utils['info'](util[_0xb7d3('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x4e5401[_0xb7d3('0x5')],queues[_0x4e5401[_0xb7d3('0x5')]]['name'],queues[_0x4e5401[_0xb7d3('0x5')]][_0xb7d3('0x5a')]));delete queues[_0x4e5401[_0xb7d3('0x5')]][_0xb7d3('0x5e')];}}}catch(_0x1b3ce7){utils['error'](util[_0xb7d3('0x4')](_0xb7d3('0x61'),_0x4e5401[_0xb7d3('0x5')]),_0x1b3ce7);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index ffa3bfa..c876ea4 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 _0xa487=['[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','format','getUserByInternal','membername','name','UserId','request','newchannel','debug','uniqueid','linkedid','info','context','exten','channel','error','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','accountcode','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]'];(function(_0x52b828,_0x359d0f){var _0x2721d8=function(_0x4f4222){while(--_0x4f4222){_0x52b828['push'](_0x52b828['shift']());}};_0x2721d8(++_0x359d0f);}(_0xa487,0x108));var _0x7a48=function(_0x381ad2,_0x205283){_0x381ad2=_0x381ad2-0x0;var _0x3f790d=_0xa487[_0x381ad2];return _0x3f790d;};'use strict';var _=require(_0x7a48('0x0'));var util=require(_0x7a48('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x243690){utils['info'](util[_0x7a48('0x2')]('[%s][recordings][writeDB]',_0x243690['uniqueid']));if(_0x243690['accountcode']){utils[_0x7a48('0x3')](_0x243690['accountcode'])['then'](function(_0x3b07e0){if(_0x3b07e0){_0x243690[_0x7a48('0x4')]=_0x3b07e0[_0x7a48('0x5')];_0x243690[_0x7a48('0x6')]=_0x3b07e0['id'];}utils['request']('CreateVoiceRecording',_0x243690);});}else{utils[_0x7a48('0x7')]('CreateVoiceRecording',_0x243690);}}exports[_0x7a48('0x8')]=function(_0x42ccda){try{utils[_0x7a48('0x9')](util['format']('[%s][recordings][newchannel]',_0x42ccda[_0x7a48('0xa')]),_0x42ccda);if(_0x42ccda['uniqueid']==_0x42ccda[_0x7a48('0xb')]){utils[_0x7a48('0xc')](util[_0x7a48('0x2')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x42ccda[_0x7a48('0xa')],_0x42ccda[_0x7a48('0xd')],_0x42ccda['exten']));recordings[_0x42ccda[_0x7a48('0xa')]]={'uniqueid':_0x42ccda['uniqueid'],'accountcode':_0x42ccda['accountcode'],'exten':_0x42ccda[_0x7a48('0xe')],'context':_0x42ccda[_0x7a48('0xd')],'channel':_0x42ccda[_0x7a48('0xf')],'monitors':[]};}}catch(_0x4135c4){utils[_0x7a48('0x10')](util[_0x7a48('0x2')]('[%s][recordings][newchannel]',_0x42ccda[_0x7a48('0xa')]),_0x4135c4);}};exports['newstate']=function(_0x31a51b){try{utils['debug'](util[_0x7a48('0x2')]('[%s][recordings][newstate]',_0x31a51b[_0x7a48('0xa')]),_0x31a51b);if(!_['isNil'](recordings[_0x31a51b[_0x7a48('0xa')]])&&_0x31a51b[_0x7a48('0x11')]==0x6){utils['info'](util[_0x7a48('0x2')](_0x7a48('0x12'),_0x31a51b[_0x7a48('0xa')],_0x31a51b[_0x7a48('0xd')],_0x31a51b[_0x7a48('0xf')]));}else if(!_[_0x7a48('0x13')](recordings[_0x31a51b[_0x7a48('0xb')]])&&_0x31a51b[_0x7a48('0x11')]==0x6&&_0x31a51b[_0x7a48('0xd')]!=_0x7a48('0x14')){utils[_0x7a48('0xc')](util[_0x7a48('0x2')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x31a51b[_0x7a48('0xa')],_0x31a51b[_0x7a48('0xb')],_0x31a51b['context'],_0x31a51b[_0x7a48('0xf')]));recordings[_0x31a51b['linkedid']]['accountcode']=_0x31a51b[_0x7a48('0x15')];}}catch(_0x44a74c){utils[_0x7a48('0x10')](util[_0x7a48('0x2')](_0x7a48('0x16'),_0x31a51b['uniqueid']),_0x44a74c);}};exports[_0x7a48('0x17')]=function(_0x2c10c0){try{if(!_[_0x7a48('0x13')](_0x2c10c0[_0x7a48('0x18')])&&!_[_0x7a48('0x13')](_0x2c10c0[_0x7a48('0x18')]['mixmonitor_filename'])){utils['debug'](util[_0x7a48('0x2')](_0x7a48('0x19'),_0x2c10c0[_0x7a48('0xa')]),_0x2c10c0);utils['info'](util[_0x7a48('0x2')](_0x7a48('0x1a'),_0x2c10c0[_0x7a48('0xa')],_0x2c10c0['variable'],_0x2c10c0['value']));if(_[_0x7a48('0x1b')](_0x2c10c0[_0x7a48('0x1c')],_0x7a48('0x1d'))){_0x2c10c0[_0x7a48('0x1c')]=_0x2c10c0[_0x7a48('0x1c')][_0x7a48('0x1e')](_0x7a48('0x1d'),_0x7a48('0x1f'));}if(recordings[_0x2c10c0['linkedid']]){var _0xd3c20f=_['find'](recordings[_0x2c10c0[_0x7a48('0xb')]]['monitors'],{'value':_0x2c10c0[_0x7a48('0x1c')]});if(_[_0x7a48('0x13')](_0xd3c20f)){recordings[_0x2c10c0[_0x7a48('0xb')]][_0x7a48('0x20')][_0x7a48('0x21')]({'value':_0x2c10c0['value']});}}}}catch(_0x2199ad){utils[_0x7a48('0x10')](util[_0x7a48('0x2')](_0x7a48('0x19'),_0x2c10c0[_0x7a48('0xa')]),_0x2199ad);}};exports[_0x7a48('0x22')]=function(_0x4926f5){try{if(!_['isNil'](recordings[_0x4926f5[_0x7a48('0xa')]])){utils[_0x7a48('0x9')](util[_0x7a48('0x2')](_0x7a48('0x23'),_0x4926f5[_0x7a48('0xa')]),_0x4926f5);utils[_0x7a48('0xc')](util[_0x7a48('0x2')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4926f5[_0x7a48('0xa')],_0x4926f5[_0x7a48('0x24')],_0x4926f5[_0x7a48('0x25')],_0x4926f5['cause-txt']));recordings[_0x4926f5['uniqueid']][_0x7a48('0x24')]=_0x4926f5[_0x7a48('0x24')];recordings[_0x4926f5[_0x7a48('0xa')]]['calleridname']=_0x4926f5[_0x7a48('0x25')];recordings[_0x4926f5['uniqueid']][_0x7a48('0x26')]=_0x4926f5[_0x7a48('0x26')];recordings[_0x4926f5['uniqueid']][_0x7a48('0x27')]=_0x4926f5[_0x7a48('0x27')];if(recordings[_0x4926f5[_0x7a48('0xa')]][_0x7a48('0x28')]=='outbound'&&recordings[_0x4926f5[_0x7a48('0xa')]][_0x7a48('0x15')]){recordings[_0x4926f5[_0x7a48('0xa')]][_0x7a48('0x26')]=recordings[_0x4926f5[_0x7a48('0xa')]][_0x7a48('0x15')];recordings[_0x4926f5[_0x7a48('0xa')]][_0x7a48('0x27')]='';}recordings[_0x4926f5['uniqueid']][_0x7a48('0x20')][_0x7a48('0x29')](function(_0x432dcc){var _0x173490=_[_0x7a48('0x2a')](recordings[_0x4926f5[_0x7a48('0xa')]]);_0x173490[_0x7a48('0x1c')]=_0x432dcc[_0x7a48('0x1c')];writeDB(_0x173490);});delete recordings[_0x4926f5[_0x7a48('0xa')]];}}catch(_0x4b25e7){utils[_0x7a48('0x10')](util[_0x7a48('0x2')](_0x7a48('0x23'),_0x4926f5[_0x7a48('0xa')]),_0x4b25e7);}};exports[_0x7a48('0x2b')]=function(_0x13f65d){try{if(!_[_0x7a48('0x13')](recordings[_0x13f65d['uniqueid']])){utils[_0x7a48('0x9')](util['format'](_0x7a48('0x2c'),_0x13f65d[_0x7a48('0xa')]),_0x13f65d);utils[_0x7a48('0xc')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x13f65d[_0x7a48('0xa')],_0x13f65d[_0x7a48('0x2d')],_0x13f65d[_0x7a48('0x2e')]));if(_0x13f65d[_0x7a48('0x2d')]['toLowerCase']()==_0x7a48('0x2f')&&_[_0x7a48('0x30')](_0x13f65d[_0x7a48('0x2e')][_0x7a48('0x31')](),_0x7a48('0x32'))){var _0x5c8da0=_0x13f65d[_0x7a48('0x2e')][_0x7a48('0x33')]('=');var _0xbdace5=_0x5c8da0[0x0][_0x7a48('0x34')](_0x5c8da0[0x0][_0x7a48('0x35')]('(')+0x1,_0x5c8da0[0x0]['lastIndexOf'](')'));var _0x348fdb=_0x5c8da0[0x1];recordings[_0x13f65d[_0x7a48('0xa')]][_0xbdace5]=_0x348fdb;}}}catch(_0x1e53dc){utils[_0x7a48('0x10')](util[_0x7a48('0x2')](_0x7a48('0x2c'),_0x13f65d[_0x7a48('0xa')]),_0x1e53dc);}};exports[_0x7a48('0x36')]=function(_0x4ab803){try{if(!_[_0x7a48('0x13')](recordings[_0x4ab803[_0x7a48('0xa')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x4ab803['uniqueid']),_0x4ab803);utils[_0x7a48('0xc')](util[_0x7a48('0x2')](_0x7a48('0x37'),_0x4ab803[_0x7a48('0xa')],_0x4ab803[_0x7a48('0x38')]));recordings[_0x4ab803['uniqueid']]['queue']=_0x4ab803[_0x7a48('0x38')];}}catch(_0x43f191){utils[_0x7a48('0x10')](util[_0x7a48('0x2')](_0x7a48('0x39'),_0x4ab803[_0x7a48('0xa')]),_0x43f191);}}; \ No newline at end of file +var _0xb794=['connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','info','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum'];(function(_0x1ce7dd,_0x1cbada){var _0x32dea1=function(_0x2302d0){while(--_0x2302d0){_0x1ce7dd['push'](_0x1ce7dd['shift']());}};_0x32dea1(++_0x1cbada);}(_0xb794,0x181));var _0x4b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb794[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4b79('0x0'));var utils=require(_0x4b79('0x1'));var recordings={};function writeDB(_0x69cfc9){utils['info'](util[_0x4b79('0x2')](_0x4b79('0x3'),_0x69cfc9[_0x4b79('0x4')]));if(_0x69cfc9[_0x4b79('0x5')]){utils['getUserByInternal'](_0x69cfc9[_0x4b79('0x5')])[_0x4b79('0x6')](function(_0x3661ec){if(_0x3661ec){_0x69cfc9[_0x4b79('0x7')]=_0x3661ec[_0x4b79('0x8')];_0x69cfc9[_0x4b79('0x9')]=_0x3661ec['id'];}utils[_0x4b79('0xa')]('CreateVoiceRecording',_0x69cfc9);});}else{utils[_0x4b79('0xa')](_0x4b79('0xb'),_0x69cfc9);}}exports[_0x4b79('0xc')]=function(_0x37e585){try{utils[_0x4b79('0xd')](util[_0x4b79('0x2')](_0x4b79('0xe'),_0x37e585[_0x4b79('0x4')]),_0x37e585);if(_0x37e585[_0x4b79('0x4')]==_0x37e585[_0x4b79('0xf')]){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x37e585[_0x4b79('0x4')],_0x37e585[_0x4b79('0x10')],_0x37e585[_0x4b79('0x11')]));recordings[_0x37e585['uniqueid']]={'uniqueid':_0x37e585['uniqueid'],'accountcode':_0x37e585[_0x4b79('0x5')],'exten':_0x37e585[_0x4b79('0x11')],'context':_0x37e585[_0x4b79('0x10')],'channel':_0x37e585['channel'],'monitors':[]};}}catch(_0x414260){utils[_0x4b79('0x12')](util[_0x4b79('0x2')](_0x4b79('0xe'),_0x37e585[_0x4b79('0x4')]),_0x414260);}};exports[_0x4b79('0x13')]=function(_0x4fbcc9){try{utils[_0x4b79('0xd')](util[_0x4b79('0x2')](_0x4b79('0x14'),_0x4fbcc9[_0x4b79('0x4')]),_0x4fbcc9);if(!_['isNil'](recordings[_0x4fbcc9[_0x4b79('0x4')]])&&_0x4fbcc9[_0x4b79('0x15')]==0x6){utils['info'](util[_0x4b79('0x2')](_0x4b79('0x16'),_0x4fbcc9[_0x4b79('0x4')],_0x4fbcc9[_0x4b79('0x10')],_0x4fbcc9['channel']));}else if(!_['isNil'](recordings[_0x4fbcc9[_0x4b79('0xf')]])&&_0x4fbcc9[_0x4b79('0x15')]==0x6&&_0x4fbcc9[_0x4b79('0x10')]!='transfer'){utils[_0x4b79('0x17')](util[_0x4b79('0x2')](_0x4b79('0x18'),_0x4fbcc9['uniqueid'],_0x4fbcc9[_0x4b79('0xf')],_0x4fbcc9[_0x4b79('0x10')],_0x4fbcc9['channel']));recordings[_0x4fbcc9['linkedid']][_0x4b79('0x5')]=_0x4fbcc9[_0x4b79('0x5')];}}catch(_0x1f3abb){utils['error'](util[_0x4b79('0x2')](_0x4b79('0x14'),_0x4fbcc9[_0x4b79('0x4')]),_0x1f3abb);}};exports[_0x4b79('0x19')]=function(_0x31d95e){try{if(!_[_0x4b79('0x1a')](_0x31d95e['variable'])&&!_[_0x4b79('0x1a')](_0x31d95e[_0x4b79('0x1b')][_0x4b79('0x1c')])){utils['debug'](util['format']('[%s][recordings][varset]',_0x31d95e[_0x4b79('0x4')]),_0x31d95e);utils[_0x4b79('0x17')](util['format'](_0x4b79('0x1d'),_0x31d95e[_0x4b79('0x4')],_0x31d95e['variable'],_0x31d95e[_0x4b79('0x1e')]));if(_['endsWith'](_0x31d95e['value'],_0x4b79('0x1f'))){_0x31d95e[_0x4b79('0x1e')]=_0x31d95e[_0x4b79('0x1e')][_0x4b79('0x20')](_0x4b79('0x1f'),_0x4b79('0x21'));}if(recordings[_0x31d95e[_0x4b79('0xf')]]){var _0xfef11a=_[_0x4b79('0x22')](recordings[_0x31d95e['linkedid']][_0x4b79('0x23')],{'value':_0x31d95e[_0x4b79('0x1e')]});if(_['isNil'](_0xfef11a)){recordings[_0x31d95e[_0x4b79('0xf')]][_0x4b79('0x23')]['push']({'value':_0x31d95e[_0x4b79('0x1e')]});}}}}catch(_0x103246){utils[_0x4b79('0x12')](util[_0x4b79('0x2')]('[%s][recordings][varset]',_0x31d95e[_0x4b79('0x4')]),_0x103246);}};exports[_0x4b79('0x24')]=function(_0x20f56a){try{if(!_['isNil'](recordings[_0x20f56a[_0x4b79('0x4')]])){utils[_0x4b79('0xd')](util[_0x4b79('0x2')]('[%s][recordings][hangup]',_0x20f56a[_0x4b79('0x4')]),_0x20f56a);utils[_0x4b79('0x17')](util[_0x4b79('0x2')](_0x4b79('0x25'),_0x20f56a[_0x4b79('0x4')],_0x20f56a[_0x4b79('0x26')],_0x20f56a[_0x4b79('0x27')],_0x20f56a[_0x4b79('0x28')]));recordings[_0x20f56a['uniqueid']][_0x4b79('0x26')]=_0x20f56a['calleridnum'];recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x27')]=_0x20f56a[_0x4b79('0x27')];recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x29')]=_0x20f56a[_0x4b79('0x29')];recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x2a')]=_0x20f56a[_0x4b79('0x2a')];if(recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x2b')]==_0x4b79('0x2c')&&recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x5')]){recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x29')]=recordings[_0x20f56a['uniqueid']]['accountcode'];recordings[_0x20f56a['uniqueid']][_0x4b79('0x2a')]='';}recordings[_0x20f56a[_0x4b79('0x4')]][_0x4b79('0x23')][_0x4b79('0x2d')](function(_0x3582e7){var _0x3df16d=_['clone'](recordings[_0x20f56a['uniqueid']]);_0x3df16d[_0x4b79('0x1e')]=_0x3582e7['value'];writeDB(_0x3df16d);});delete recordings[_0x20f56a[_0x4b79('0x4')]];}}catch(_0x42d996){utils[_0x4b79('0x12')](util[_0x4b79('0x2')](_0x4b79('0x2e'),_0x20f56a[_0x4b79('0x4')]),_0x42d996);}};exports[_0x4b79('0x2f')]=function(_0x5b6ec5){try{if(!_[_0x4b79('0x1a')](recordings[_0x5b6ec5[_0x4b79('0x4')]])){utils[_0x4b79('0xd')](util[_0x4b79('0x2')](_0x4b79('0x30'),_0x5b6ec5['uniqueid']),_0x5b6ec5);utils[_0x4b79('0x17')](util[_0x4b79('0x2')](_0x4b79('0x31'),_0x5b6ec5[_0x4b79('0x4')],_0x5b6ec5[_0x4b79('0x32')],_0x5b6ec5['appdata']));if(_0x5b6ec5[_0x4b79('0x32')]['toLowerCase']()==_0x4b79('0x33')&&_[_0x4b79('0x34')](_0x5b6ec5[_0x4b79('0x35')][_0x4b79('0x36')](),'cdr')){var _0x43c26f=_0x5b6ec5[_0x4b79('0x35')][_0x4b79('0x37')]('=');var _0x43b57e=_0x43c26f[0x0]['substring'](_0x43c26f[0x0]['lastIndexOf']('(')+0x1,_0x43c26f[0x0][_0x4b79('0x38')](')'));var _0xb4d8b4=_0x43c26f[0x1];recordings[_0x5b6ec5['uniqueid']][_0x43b57e]=_0xb4d8b4;}}}catch(_0x5d2981){utils[_0x4b79('0x12')](util[_0x4b79('0x2')](_0x4b79('0x30'),_0x5b6ec5[_0x4b79('0x4')]),_0x5d2981);}};exports[_0x4b79('0x39')]=function(_0x237811){try{if(!_['isNil'](recordings[_0x237811[_0x4b79('0x4')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x237811['uniqueid']),_0x237811);utils[_0x4b79('0x17')](util['format'](_0x4b79('0x3a'),_0x237811[_0x4b79('0x4')],_0x237811['queue']));recordings[_0x237811[_0x4b79('0x4')]][_0x4b79('0x3b')]=_0x237811[_0x4b79('0x3b')];}}catch(_0x15b9a6){utils['error'](util[_0x4b79('0x2')](_0x4b79('0x3c'),_0x237811[_0x4b79('0x4')]),_0x15b9a6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a550fee..5de12b3 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 _0x7651=['transfereecalleridname','blinds','transfereruniqueid','error','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum'];(function(_0x2fcd39,_0x35eba5){var _0x42a76f=function(_0x5852fe){while(--_0x5852fe){_0x2fcd39['push'](_0x2fcd39['shift']());}};_0x42a76f(++_0x35eba5);}(_0x7651,0x193));var _0x1765=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7651[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1765('0x0'));var utils=require(_0x1765('0x1'));function writeDB(_0x5d7b58){utils[_0x1765('0x2')](util[_0x1765('0x3')](_0x1765('0x4'),_0x5d7b58[_0x1765('0x5')]===_0x1765('0x6')?_0x5d7b58['origtransfereruniqueid']:_0x5d7b58[_0x1765('0x7')],_0x5d7b58['type']));utils[_0x1765('0x8')](_0x1765('0x9'),_0x5d7b58);}exports['blinds']={};exports[_0x1765('0xa')]=function(_0xcf788b){try{utils[_0x1765('0xb')](util['format'](_0x1765('0xc'),_0xcf788b[_0x1765('0x7')]),_0xcf788b);utils[_0x1765('0x2')](util['format'](_0x1765('0xd'),_0xcf788b[_0x1765('0x7')],_0xcf788b[_0x1765('0xe')],_0xcf788b[_0x1765('0xf')],_0xcf788b[_0x1765('0x10')],_0xcf788b[_0x1765('0x11')]));_0xcf788b[_0x1765('0x5')]='blind';exports[_0x1765('0x12')][_0xcf788b[_0x1765('0x13')]]=_0xcf788b;writeDB(_0xcf788b);}catch(_0x5e420f){utils[_0x1765('0x14')](util[_0x1765('0x3')](_0x1765('0xc'),_0xcf788b['uniqueid']),_0x5e420f);}};exports['attendedtransfer']=function(_0x5c0c11){try{utils[_0x1765('0xb')](util[_0x1765('0x3')]('[%s][transfers][attendedtransfer]',_0x5c0c11[_0x1765('0x15')]),_0x5c0c11);utils[_0x1765('0x2')](util[_0x1765('0x3')](_0x1765('0x16'),_0x5c0c11[_0x1765('0x15')],_0x5c0c11[_0x1765('0x17')],_0x5c0c11[_0x1765('0x18')],_0x5c0c11[_0x1765('0x19')],_0x5c0c11[_0x1765('0x1a')]));_0x5c0c11=_['assign'](_0x5c0c11,{'transfererchannel':_0x5c0c11['origtransfererchannel'],'transferercalleridnum':_0x5c0c11[_0x1765('0x17')],'transferercalleridname':_0x5c0c11[_0x1765('0x18')],'transfererconnectedlinenum':_0x5c0c11[_0x1765('0x1b')],'transfererconnectedlinename':_0x5c0c11[_0x1765('0x1c')],'transfereraccountcode':_0x5c0c11['origtransfereraccountcode'],'transferercontext':_0x5c0c11[_0x1765('0x1d')],'transfererexten':_0x5c0c11['secondtransfererexten'],'transfererlinkedid':_0x5c0c11[_0x1765('0x1e')],'context':_0x5c0c11[_0x1765('0x1f')],'extension':_0x5c0c11[_0x1765('0x20')],'type':_0x1765('0x6')});if(_[_0x1765('0x21')](_0x5c0c11['transfereechannel'])){_0x5c0c11=_[_0x1765('0x22')](_0x5c0c11,{'transfereechannel':_0x5c0c11[_0x1765('0x23')],'transfereecalleridnum':_0x5c0c11[_0x1765('0x19')],'transfereecalleridname':_0x5c0c11[_0x1765('0x1a')],'transfereeconnectedlinenum':_0x5c0c11[_0x1765('0x24')],'transfereeconnectedlinename':_0x5c0c11[_0x1765('0x25')],'transfereeaccountcode':_0x5c0c11['transfertargetaccountcode'],'transfereecontext':_0x5c0c11[_0x1765('0x26')],'transfereeexten':_0x5c0c11[_0x1765('0x27')],'transfereelinkedid':_0x5c0c11[_0x1765('0x28')]});}writeDB(_0x5c0c11);}catch(_0x1faaa6){utils[_0x1765('0x14')](util[_0x1765('0x3')](_0x1765('0x29'),_0x5c0c11[_0x1765('0x15')]),_0x1faaa6);}}; \ No newline at end of file +var _0x1e04=['request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid'];(function(_0x2f63c4,_0x404e35){var _0x59cf49=function(_0x424327){while(--_0x424327){_0x2f63c4['push'](_0x2f63c4['shift']());}};_0x59cf49(++_0x404e35);}(_0x1e04,0x71));var _0x41e0=function(_0xf69aa4,_0x345358){_0xf69aa4=_0xf69aa4-0x0;var _0x296474=_0x1e04[_0xf69aa4];return _0x296474;};'use strict';var _=require('lodash');var util=require(_0x41e0('0x0'));var utils=require('./utils');function writeDB(_0x40beae){utils[_0x41e0('0x1')](util[_0x41e0('0x2')](_0x41e0('0x3'),_0x40beae[_0x41e0('0x4')]===_0x41e0('0x5')?_0x40beae[_0x41e0('0x6')]:_0x40beae['uniqueid'],_0x40beae[_0x41e0('0x4')]));utils[_0x41e0('0x7')](_0x41e0('0x8'),_0x40beae);}exports[_0x41e0('0x9')]={};exports[_0x41e0('0xa')]=function(_0x363c10){try{utils['debug'](util[_0x41e0('0x2')](_0x41e0('0xb'),_0x363c10['uniqueid']),_0x363c10);utils[_0x41e0('0x1')](util[_0x41e0('0x2')](_0x41e0('0xc'),_0x363c10['uniqueid'],_0x363c10[_0x41e0('0xd')],_0x363c10[_0x41e0('0xe')],_0x363c10[_0x41e0('0xf')],_0x363c10[_0x41e0('0x10')]));_0x363c10[_0x41e0('0x4')]=_0x41e0('0x11');exports[_0x41e0('0x9')][_0x363c10[_0x41e0('0x12')]]=_0x363c10;writeDB(_0x363c10);}catch(_0x1cced4){utils[_0x41e0('0x13')](util[_0x41e0('0x2')](_0x41e0('0xb'),_0x363c10['uniqueid']),_0x1cced4);}};exports[_0x41e0('0x14')]=function(_0x21abab){try{utils[_0x41e0('0x15')](util[_0x41e0('0x2')](_0x41e0('0x16'),_0x21abab[_0x41e0('0x6')]),_0x21abab);utils[_0x41e0('0x1')](util['format'](_0x41e0('0x17'),_0x21abab['origtransfereruniqueid'],_0x21abab[_0x41e0('0x18')],_0x21abab[_0x41e0('0x19')],_0x21abab[_0x41e0('0x1a')],_0x21abab[_0x41e0('0x1b')]));_0x21abab=_[_0x41e0('0x1c')](_0x21abab,{'transfererchannel':_0x21abab[_0x41e0('0x1d')],'transferercalleridnum':_0x21abab[_0x41e0('0x18')],'transferercalleridname':_0x21abab[_0x41e0('0x19')],'transfererconnectedlinenum':_0x21abab['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x21abab[_0x41e0('0x1e')],'transfereraccountcode':_0x21abab[_0x41e0('0x1f')],'transferercontext':_0x21abab[_0x41e0('0x20')],'transfererexten':_0x21abab['secondtransfererexten'],'transfererlinkedid':_0x21abab['origtransfererlinkedid'],'context':_0x21abab[_0x41e0('0x21')],'extension':_0x21abab[_0x41e0('0x22')],'type':_0x41e0('0x5')});if(_[_0x41e0('0x23')](_0x21abab[_0x41e0('0x24')])){_0x21abab=_[_0x41e0('0x1c')](_0x21abab,{'transfereechannel':_0x21abab[_0x41e0('0x25')],'transfereecalleridnum':_0x21abab[_0x41e0('0x1a')],'transfereecalleridname':_0x21abab[_0x41e0('0x1b')],'transfereeconnectedlinenum':_0x21abab['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x21abab['transfertargetconnectedlinename'],'transfereeaccountcode':_0x21abab[_0x41e0('0x26')],'transfereecontext':_0x21abab[_0x41e0('0x27')],'transfereeexten':_0x21abab['transfertargetexten'],'transfereelinkedid':_0x21abab['transfertargetlinkedid']});}writeDB(_0x21abab);}catch(_0xdd656c){utils[_0x41e0('0x13')](util[_0x41e0('0x2')]('[%s][transfers][attendedtransfer]',_0x21abab[_0x41e0('0x6')]),_0xdd656c);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2223c74..eab052b 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 _0x3d05=['catch','GetUser','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','now','isAfter','isBefore','bluebird','moment','client','../../config/logger','info','debug','error','request','then','[utils][request]\x20name:%s','inspect'];(function(_0x193525,_0x5669b6){var _0x4a66e8=function(_0x5f0726){while(--_0x5f0726){_0x193525['push'](_0x193525['shift']());}};_0x4a66e8(++_0x5669b6);}(_0x3d05,0x185));var _0x53d0=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x3d05[_0x36b037];return _0x409194;};'use strict';var BPromise=require(_0x53d0('0x0'));var jayson=require('jayson/promise');var moment=require(_0x53d0('0x1'));var util=require('util');var client=jayson[_0x53d0('0x2')]['http']({'port':0x2329});var logger=require(_0x53d0('0x3'))('xdr');exports['info']=function(_0x4f3907,_0x141cc4){logger[_0x53d0('0x4')](_0x4f3907,_0x141cc4?util['inspect'](_0x141cc4,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x5d9c3e,_0x254821){logger[_0x53d0('0x5')](_0x5d9c3e,_0x254821?util['inspect'](_0x254821,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3f2e3b,_0x53ff88){logger[_0x53d0('0x6')](_0x3f2e3b,_0x53ff88?util['inspect'](_0x53ff88,{'showHidden':![],'depth':null}):'');};exports[_0x53d0('0x7')]=function(_0x3dd9e3,_0x341a91){return client[_0x53d0('0x7')](_0x3dd9e3,{'body':_0x341a91})[_0x53d0('0x8')](function(_0x52ea93){logger[_0x53d0('0x5')](_0x53d0('0x9'),_0x3dd9e3,_0x52ea93?util[_0x53d0('0xa')](_0x52ea93,{'showHidden':![],'depth':null}):'');})[_0x53d0('0xb')](function(_0x168227){logger[_0x53d0('0x6')](_0x53d0('0x9'),_0x3dd9e3,_0x168227?util['inspect'](_0x168227,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2140b8){return client['request'](_0x53d0('0xc'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x53d0('0xd')],'where':_0x2140b8,'limit':0x1}})[_0x53d0('0x8')](function(_0xc5202c){logger[_0x53d0('0x5')](_0x53d0('0xe'),JSON[_0x53d0('0xf')](_0x2140b8),_0xc5202c?util[_0x53d0('0xa')](_0xc5202c,{'showHidden':![],'depth':null}):'');return _0xc5202c[_0x53d0('0x10')][_0x53d0('0x11')]?_0xc5202c['result'][0x0]:null;});}exports[_0x53d0('0x12')]=function(_0x15b724){return new BPromise(function(_0x1b22ce,_0x401e12){if(_0x15b724){return getUser({'internal':_0x15b724})[_0x53d0('0x8')](function(_0x53d9b2){logger[_0x53d0('0x4')](_0x53d0('0x13'),_0x15b724,_0x53d9b2?_0x53d0('0x14'):_0x53d0('0x15'));return _0x1b22ce(_0x53d9b2);})[_0x53d0('0xb')](function(_0x2a6ff6){logger[_0x53d0('0x6')](_0x53d0('0x16'),_0x2a6ff6?util[_0x53d0('0xa')](_0x2a6ff6,{'showHidden':![],'depth':null}):'');return _0x1b22ce(null);});}return _0x1b22ce(null);});};exports['getUserByInterface']=function(_0x5817d7){return new BPromise(function(_0x319efc,_0x55391a){if(_0x5817d7){return getUser({'interface':_0x5817d7})['then'](function(_0x5a4bba){logger[_0x53d0('0x4')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x5817d7,_0x5a4bba?_0x53d0('0x14'):_0x53d0('0x15'));return _0x319efc(_0x5a4bba);})['catch'](function(_0x56e9e2){logger['error'](_0x53d0('0x17'),_0x56e9e2?util[_0x53d0('0xa')](_0x56e9e2,{'showHidden':![],'depth':null}):'');return _0x319efc(null);});}return _0x319efc(null);});};exports[_0x53d0('0x18')]=function(_0x522ce3){return new BPromise(function(_0x12df54,_0x13449b){if(_0x522ce3){return getUser({'name':_0x522ce3})['then'](function(_0x403383){logger[_0x53d0('0x4')](_0x53d0('0x19'),_0x522ce3,_0x403383?'found':_0x53d0('0x15'));return _0x12df54(_0x403383);})[_0x53d0('0xb')](function(_0x400aca){logger[_0x53d0('0x6')]('[utils][getUserByName]',_0x400aca?util[_0x53d0('0xa')](_0x400aca,{'showHidden':![],'depth':null}):'');return _0x12df54(null);});}return _0x12df54(null);});};exports[_0x53d0('0x1a')]=function(_0x1edb56){return new BPromise(function(_0xf4396e,_0x30e91e){if(_0x1edb56){return client[_0x53d0('0x7')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x53d0('0x1b'),_0x53d0('0x1c'),_0x53d0('0x1d'),_0x53d0('0x1e')],'where':{'name':_0x1edb56},'limit':0x1}})[_0x53d0('0x8')](function(_0x299e7f){logger[_0x53d0('0x5')]('[utils][getVoiceQueueByName]\x20name:%s',_0x1edb56,_0x299e7f?util['inspect'](_0x299e7f,{'showHidden':![],'depth':null}):'');logger['info'](_0x53d0('0x1f'),_0x1edb56,_0x299e7f?'found':_0x53d0('0x15'));return _0xf4396e(_0x299e7f[_0x53d0('0x10')]['length']?_0x299e7f[_0x53d0('0x10')][0x0]:null);})['catch'](function(_0x35a523){logger[_0x53d0('0x6')]('[utils][getVoiceQueueByName]',_0x35a523?util[_0x53d0('0xa')](_0x35a523,{'showHidden':![],'depth':null}):'');return _0xf4396e(null);});}return _0xf4396e(null);});};exports[_0x53d0('0x20')]=function(_0x24788e,_0x33624d){return moment(_0x24788e)['add'](_0x33624d,_0x53d0('0x21'))[_0x53d0('0x22')](_0x53d0('0x23'));};exports[_0x53d0('0x24')]=function(_0x4b9b1f,_0x106161){return moment(_0x4b9b1f)['subtract'](_0x106161,_0x53d0('0x21'))[_0x53d0('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x15dcae,_0x4d785f){return moment(_0x15dcae)['diff'](moment(_0x4d785f),_0x53d0('0x21'));};exports['sumTime']=function(_0x4cd015,_0x1e5d04){return parseInt(_0x4cd015,0xa)+parseInt(_0x1e5d04,0xa);};exports[_0x53d0('0x25')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x53d0('0x26')]=function(_0x4a9aef,_0x2489cd){if(_0x2489cd){return moment(_0x4a9aef)[_0x53d0('0x26')](_0x2489cd);}return!![];};exports[_0x53d0('0x27')]=function(_0x224c0d,_0x54293a){if(_0x54293a){return moment(_0x224c0d)[_0x53d0('0x27')](_0x54293a);}else if(_0x224c0d){return!![];}return![];}; \ No newline at end of file +var _0x3e8a=['getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','catch','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acwTimeout','result','[utils][getVoiceQueueByName]','addTime','add','seconds','subtract','format','diffTime','sumTime','now','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','found','[utils][getUserByInternal]'];(function(_0x405ae6,_0x40b3e6){var _0x266ea2=function(_0x238c05){while(--_0x238c05){_0x405ae6['push'](_0x405ae6['shift']());}};_0x266ea2(++_0x40b3e6);}(_0x3e8a,0x78));var _0xa3e8=function(_0x4e9bb4,_0x286ed8){_0x4e9bb4=_0x4e9bb4-0x0;var _0x399a77=_0x3e8a[_0x4e9bb4];return _0x399a77;};'use strict';var BPromise=require(_0xa3e8('0x0'));var jayson=require(_0xa3e8('0x1'));var moment=require(_0xa3e8('0x2'));var util=require(_0xa3e8('0x3'));var client=jayson[_0xa3e8('0x4')][_0xa3e8('0x5')]({'port':0x2329});var logger=require(_0xa3e8('0x6'))(_0xa3e8('0x7'));exports[_0xa3e8('0x8')]=function(_0x5d2466,_0x16fa1b){logger[_0xa3e8('0x8')](_0x5d2466,_0x16fa1b?util[_0xa3e8('0x9')](_0x16fa1b,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x40acab,_0x40c324){logger[_0xa3e8('0xa')](_0x40acab,_0x40c324?util[_0xa3e8('0x9')](_0x40c324,{'showHidden':![],'depth':null}):'');};exports[_0xa3e8('0xb')]=function(_0x57de64,_0x20d95b){logger[_0xa3e8('0xb')](_0x57de64,_0x20d95b?util['inspect'](_0x20d95b,{'showHidden':![],'depth':null}):'');};exports[_0xa3e8('0xc')]=function(_0x29ea1b,_0x1c5a89){return client[_0xa3e8('0xc')](_0x29ea1b,{'body':_0x1c5a89})[_0xa3e8('0xd')](function(_0x4a8068){logger[_0xa3e8('0xa')](_0xa3e8('0xe'),_0x29ea1b,_0x4a8068?util[_0xa3e8('0x9')](_0x4a8068,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3ac218){logger[_0xa3e8('0xb')](_0xa3e8('0xe'),_0x29ea1b,_0x3ac218?util[_0xa3e8('0x9')](_0x3ac218,{'showHidden':![],'depth':null}):'');});};function getUser(_0x96037d){return client['request'](_0xa3e8('0xf'),{'options':{'raw':!![],'attributes':['id',_0xa3e8('0x10'),_0xa3e8('0x11'),_0xa3e8('0x12')],'where':_0x96037d,'limit':0x1}})[_0xa3e8('0xd')](function(_0x2f9d77){logger[_0xa3e8('0xa')](_0xa3e8('0x13'),JSON[_0xa3e8('0x14')](_0x96037d),_0x2f9d77?util[_0xa3e8('0x9')](_0x2f9d77,{'showHidden':![],'depth':null}):'');return _0x2f9d77['result'][_0xa3e8('0x15')]?_0x2f9d77['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x15b1e2){return new BPromise(function(_0x53d50c,_0x2d0a5e){if(_0x15b1e2){return getUser({'internal':_0x15b1e2})[_0xa3e8('0xd')](function(_0x4bc60b){logger[_0xa3e8('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x15b1e2,_0x4bc60b?_0xa3e8('0x16'):'notfound');return _0x53d50c(_0x4bc60b);})['catch'](function(_0x1e7928){logger[_0xa3e8('0xb')](_0xa3e8('0x17'),_0x1e7928?util[_0xa3e8('0x9')](_0x1e7928,{'showHidden':![],'depth':null}):'');return _0x53d50c(null);});}return _0x53d50c(null);});};exports[_0xa3e8('0x18')]=function(_0x1b015a){return new BPromise(function(_0x1f994b,_0x5ddc22){if(_0x1b015a){return getUser({'interface':_0x1b015a})[_0xa3e8('0xd')](function(_0x2081a2){logger[_0xa3e8('0x8')](_0xa3e8('0x19'),_0x1b015a,_0x2081a2?'found':'notfound');return _0x1f994b(_0x2081a2);})['catch'](function(_0x4041c0){logger['error'](_0xa3e8('0x1a'),_0x4041c0?util['inspect'](_0x4041c0,{'showHidden':![],'depth':null}):'');return _0x1f994b(null);});}return _0x1f994b(null);});};exports[_0xa3e8('0x1b')]=function(_0x4ee977){return new BPromise(function(_0x25e9a8,_0xfdbebb){if(_0x4ee977){return getUser({'name':_0x4ee977})[_0xa3e8('0xd')](function(_0x270b35){logger['info'](_0xa3e8('0x1c'),_0x4ee977,_0x270b35?'found':_0xa3e8('0x1d'));return _0x25e9a8(_0x270b35);})[_0xa3e8('0x1e')](function(_0x514237){logger[_0xa3e8('0xb')](_0xa3e8('0x1f'),_0x514237?util[_0xa3e8('0x9')](_0x514237,{'showHidden':![],'depth':null}):'');return _0x25e9a8(null);});}return _0x25e9a8(null);});};exports[_0xa3e8('0x20')]=function(_0x623a79){return new BPromise(function(_0xf6918,_0x146594){if(_0x623a79){return client['request'](_0xa3e8('0x21'),{'options':{'raw':!![],'attributes':['id',_0xa3e8('0x11'),'type','acw',_0xa3e8('0x22')],'where':{'name':_0x623a79},'limit':0x1}})[_0xa3e8('0xd')](function(_0x3b0422){logger[_0xa3e8('0xa')]('[utils][getVoiceQueueByName]\x20name:%s',_0x623a79,_0x3b0422?util['inspect'](_0x3b0422,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x623a79,_0x3b0422?_0xa3e8('0x16'):_0xa3e8('0x1d'));return _0xf6918(_0x3b0422[_0xa3e8('0x23')][_0xa3e8('0x15')]?_0x3b0422[_0xa3e8('0x23')][0x0]:null);})[_0xa3e8('0x1e')](function(_0x31917b){logger[_0xa3e8('0xb')](_0xa3e8('0x24'),_0x31917b?util[_0xa3e8('0x9')](_0x31917b,{'showHidden':![],'depth':null}):'');return _0xf6918(null);});}return _0xf6918(null);});};exports[_0xa3e8('0x25')]=function(_0xe2c76d,_0x599539){return moment(_0xe2c76d)[_0xa3e8('0x26')](_0x599539,_0xa3e8('0x27'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x32d883,_0x44f141){return moment(_0x32d883)[_0xa3e8('0x28')](_0x44f141,_0xa3e8('0x27'))[_0xa3e8('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xa3e8('0x2a')]=function(_0x3a3261,_0x3ea679){return moment(_0x3a3261)['diff'](moment(_0x3ea679),_0xa3e8('0x27'));};exports[_0xa3e8('0x2b')]=function(_0x5cd1c2,_0x343140){return parseInt(_0x5cd1c2,0xa)+parseInt(_0x343140,0xa);};exports[_0xa3e8('0x2c')]=function(){return moment()[_0xa3e8('0x29')](_0xa3e8('0x2d'));};exports[_0xa3e8('0x2e')]=function(_0xfadb2,_0x2ed772){if(_0x2ed772){return moment(_0xfadb2)['isAfter'](_0x2ed772);}return!![];};exports[_0xa3e8('0x2f')]=function(_0xde5e9,_0x1afdb3){if(_0x1afdb3){return moment(_0xde5e9)[_0xa3e8('0x2f')](_0x1afdb3);}else if(_0xde5e9){return!![];}return![];}; \ No newline at end of file